diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 12afadc55a6..00000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,41 +0,0 @@ -stages: - - builder - - build -variables: - GIT_SUBMODULE_STRATEGY: recursive -builder: - stage: builder - when: manual - services: - - docker:dind - script: - - docker info - - apk add --no-cache git curl binutils ca-certificates - - docker login -u gitlab -p nopasswd $CI_REGISTRY - - docker build -t yandex/clickhouse-builder ./docker/builder - - docker tag yandex/clickhouse-builder $CI_REGISTRY/yandex/clickhouse-builder - - docker push $CI_REGISTRY/yandex/clickhouse-builder - tags: - - docker -build: - stage: build - when: manual - services: - - docker:dind - script: - - apk add --no-cache git curl binutils ca-certificates - - git submodule sync --recursive - - git submodule update --init --recursive - - docker info - - docker login -u gitlab -p nopasswd $CI_REGISTRY - - docker pull $CI_REGISTRY/yandex/clickhouse-builder - - docker run --rm --volumes-from "${HOSTNAME}-build" --workdir "${CI_PROJECT_DIR}" --env CI_PROJECT_DIR=${CI_PROJECT_DIR} $CI_REGISTRY/yandex/clickhouse-builder /build_gitlab_ci.sh - # You can upload your binary to nexus - - curl -v --keepalive-time 60 --keepalive --user "$NEXUS_USER:$NEXUS_PASSWORD" -XPUT "http://$NEXUS_HOST/repository/binaries/$CI_PROJECT_NAME" --upload-file ./src/Server/clickhouse - # Or download artifacts from gitlab - artifacts: - paths: - - ./src/Server/clickhouse - expire_in: 1 day - tags: - - docker diff --git a/CMakeLists.txt b/CMakeLists.txt index 65d8bc15502..681b22b47d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a pos # For more info see https://cmake.org/cmake/help/latest/prop_gbl/USE_FOLDERS.html set_property(GLOBAL PROPERTY USE_FOLDERS ON) -option(ENABLE_IPO "Enable inter-procedural optimization (aka LTO)" OFF) # need cmake 3.9+ +option(ENABLE_IPO "Enable full link time optimization (it's usually impractical; see also ENABLE_THINLTO)" OFF) # need cmake 3.9+ if(ENABLE_IPO) cmake_policy(SET CMP0069 NEW) include(CheckIPOSupported) @@ -214,11 +214,6 @@ set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3 ${ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3 -ggdb3 -fno-inline ${CMAKE_C_FLAGS_ADD}") if (COMPILER_CLANG) - # Exception unwinding doesn't work in clang release build without this option - # TODO investigate that - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer") - if (OS_DARWIN) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-U,_inside_main") @@ -226,6 +221,36 @@ if (COMPILER_CLANG) # Display absolute paths in error messages. Otherwise KDevelop fails to navigate to correct file and opens a new file instead. set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdiagnostics-absolute-paths") + + option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON) + + # We cannot afford to use LTO when compiling unitests, and it's not enough + # to only supply -fno-lto at the final linking stage. So we disable it + # completely. + if (ENABLE_THINLTO AND NOT ENABLE_TESTS AND NOT SANITIZE) + # Link time optimization + set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto=thin") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto=thin") + set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -flto=thin") + endif () + + # Always prefer llvm tools when using clang. For instance, we cannot use GNU ar when llvm LTO is enabled + + find_program (LLVM_AR_PATH NAMES "llvm-ar" "llvm-ar-10" "llvm-ar-9" "llvm-ar-8") + if (LLVM_AR_PATH) + message(STATUS "Using llvm-ar: ${LLVM_AR_PATH}.") + set (CMAKE_AR ${LLVM_AR_PATH}) + else () + message(WARNING "Cannot find llvm-ar. System ar will be used instead. It does not work with ThinLTO.") + endif () + + find_program (LLVM_RANLIB_PATH NAMES "llvm-ranlib" "llvm-ranlib-10" "llvm-ranlib-9" "llvm-ranlib-8") + if (LLVM_RANLIB_PATH) + message(STATUS "Using llvm-ranlib: ${LLVM_RANLIB_PATH}.") + set (CMAKE_RANLIB ${LLVM_RANLIB_PATH}) + else () + message(WARNING "Cannot find llvm-ranlib. System ranlib will be used instead. It does not work with ThinLTO.") + endif () endif () option (ENABLE_LIBRARIES "Enable all libraries (Global default switch)" ON) diff --git a/README.md b/README.md index b01e25ab733..955f9d1a5d1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,5 @@ ClickHouse is an open-source column-oriented database management system that all ## Upcoming Events -* [ClickHouse Online Meetup East (in English)](https://www.eventbrite.com/e/clickhouse-online-meetup-east-registration-102989325846) on April 28, 2020. * [ClickHouse Workshop in Novosibirsk](https://2020.codefest.ru/lecture/1628) on TBD date. * [Yandex C++ Open-Source Sprints in Moscow](https://events.yandex.ru/events/otkrytyj-kod-v-yandek-28-03-2020) on TBD date. diff --git a/base/loggers/Loggers.cpp b/base/loggers/Loggers.cpp index d5fd4e4e142..ed806741895 100644 --- a/base/loggers/Loggers.cpp +++ b/base/loggers/Loggers.cpp @@ -166,12 +166,29 @@ void Loggers::buildLoggers(Poco::Util::AbstractConfiguration & config, Poco::Log logger.root().setChannel(logger.getChannel()); // Explicitly specified log levels for specific loggers. - Poco::Util::AbstractConfiguration::Keys levels; - config.keys("logger.levels", levels); + { + Poco::Util::AbstractConfiguration::Keys loggers_level; + config.keys("logger.levels", loggers_level); - if (!levels.empty()) - for (const auto & level : levels) - logger.root().get(level).setLevel(config.getString("logger.levels." + level, "trace")); + if (!loggers_level.empty()) + { + for (const auto & key : loggers_level) + { + if (key == "logger" || key.starts_with("logger[")) + { + const std::string name(config.getString("logger.levels." + key + ".name")); + const std::string level(config.getString("logger.levels." + key + ".level")); + logger.root().get(name).setLevel(level); + } + else + { + // Legacy syntax + const std::string level(config.getString("logger.levels." + key, "trace")); + logger.root().get(key).setLevel(level); + } + } + } + } } void Loggers::closeLogs(Poco::Logger & logger) diff --git a/cmake/freebsd/toolchain-x86_64.cmake b/cmake/freebsd/toolchain-x86_64.cmake index 30468731b69..0961250ef8e 100644 --- a/cmake/freebsd/toolchain-x86_64.cmake +++ b/cmake/freebsd/toolchain-x86_64.cmake @@ -7,6 +7,9 @@ set (CMAKE_SYSROOT "${CMAKE_CURRENT_LIST_DIR}/../toolchain/freebsd-x86_64") set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) # disable linkage check - it doesn't work in CMake +set (CMAKE_AR "/usr/bin/ar" CACHE FILEPATH "" FORCE) +set (CMAKE_RANLIB "/usr/bin/ranlib" CACHE FILEPATH "" FORCE) + set (LINKER_NAME "lld" CACHE STRING "" FORCE) set (CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld") diff --git a/cmake/target.cmake b/cmake/target.cmake index 03d470b0aea..1325758811f 100644 --- a/cmake/target.cmake +++ b/cmake/target.cmake @@ -27,6 +27,7 @@ if (CMAKE_CROSSCOMPILING) elseif (OS_FREEBSD) # FIXME: broken dependencies set (ENABLE_PROTOBUF OFF CACHE INTERNAL "") + set (ENABLE_EMBEDDED_COMPILER OFF CACHE INTERNAL "") else () message (FATAL_ERROR "Trying to cross-compile to unsupported system: ${CMAKE_SYSTEM_NAME}!") endif () diff --git a/cmake/version.cmake b/cmake/version.cmake index 3b05193cb83..3f51f59cf0f 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -1,11 +1,11 @@ # This strings autochanged from release_lib.sh: -set(VERSION_REVISION 54434) +set(VERSION_REVISION 54435) set(VERSION_MAJOR 20) -set(VERSION_MINOR 4) +set(VERSION_MINOR 5) set(VERSION_PATCH 1) -set(VERSION_GITHASH 05da1bff8b5826608d05618dab984cdf8f96e679) -set(VERSION_DESCRIBE v20.4.1.1-prestable) -set(VERSION_STRING 20.4.1.1) +set(VERSION_GITHASH 91df18a906dcffdbee6816e5389df6c65f86e35f) +set(VERSION_DESCRIBE v20.5.1.1-prestable) +set(VERSION_STRING 20.5.1.1) # end of autochange set(VERSION_EXTRA "" CACHE STRING "") diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index f90f86fb0a8..01e9f14d241 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -335,10 +335,6 @@ if (USE_SIMDJSON) add_subdirectory (simdjson-cmake) endif() -if (USE_MIMALLOC) - add_subdirectory (mimalloc) -endif() - if (USE_FASTOPS) add_subdirectory (fastops-cmake) endif() diff --git a/contrib/aws b/contrib/aws index 45dd8552d3c..04d54dfa034 160000 --- a/contrib/aws +++ b/contrib/aws @@ -1 +1 @@ -Subproject commit 45dd8552d3c492defca79d2720bcc809e35654da +Subproject commit 04d54dfa0342d9465fb2eb3bfd4b77a3f7682e99 diff --git a/contrib/lz4 b/contrib/lz4 index 3d67671559b..f39b79fb029 160000 --- a/contrib/lz4 +++ b/contrib/lz4 @@ -1 +1 @@ -Subproject commit 3d67671559be723b0912bbee2fcd2eb14783a721 +Subproject commit f39b79fb02962a1cd880bbdecb6dffba4f754a11 diff --git a/debian/changelog b/debian/changelog index 870d5e4bac3..4ce601e18aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,5 @@ -clickhouse (20.4.1.1) unstable; urgency=low +clickhouse (20.5.1.1) unstable; urgency=low * Modified source code - -- clickhouse-release Thu, 12 Mar 2020 16:07:04 +0300 + -- clickhouse-release Tue, 28 Apr 2020 20:12:13 +0300 diff --git a/docker/builder/Dockerfile b/docker/builder/Dockerfile index f2dc484a438..53a591ca4da 100644 --- a/docker/builder/Dockerfile +++ b/docker/builder/Dockerfile @@ -23,6 +23,7 @@ RUN apt-get update -y \ python-termcolor \ sudo \ tzdata \ + llvm-10 \ clang-10 \ clang-tidy-10 \ lld-10 \ diff --git a/docker/client/Dockerfile b/docker/client/Dockerfile index b696e0688ae..978538e73cc 100644 --- a/docker/client/Dockerfile +++ b/docker/client/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:18.04 ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" -ARG version=20.4.1.* +ARG version=20.5.1.* RUN apt-get update \ && apt-get install --yes --no-install-recommends \ diff --git a/docker/packager/README.md b/docker/packager/README.md index 9c764ec3640..9fbc2d7f8b5 100644 --- a/docker/packager/README.md +++ b/docker/packager/README.md @@ -18,11 +18,11 @@ $ ls -l deb/test_output ``` -Build ClickHouse binary with `clang-9` and `address` sanitizer in `relwithdebuginfo` +Build ClickHouse binary with `clang-10` and `address` sanitizer in `relwithdebuginfo` mode: ``` $ mkdir $HOME/some_clickhouse -$ ./packager --output-dir=$HOME/some_clickhouse --package-type binary --compiler=clang-9 --sanitizer=address +$ ./packager --output-dir=$HOME/some_clickhouse --package-type binary --compiler=clang-10 --sanitizer=address $ ls -l $HOME/some_clickhouse -rwxr-xr-x 1 root root 787061952 clickhouse lrwxrwxrwx 1 root root 10 clickhouse-benchmark -> clickhouse diff --git a/docker/packager/binary/Dockerfile b/docker/packager/binary/Dockerfile index 03c807cfaae..93ac0eaff6c 100644 --- a/docker/packager/binary/Dockerfile +++ b/docker/packager/binary/Dockerfile @@ -1,4 +1,3 @@ -# Trigger new image build # docker build -t yandex/clickhouse-binary-builder . FROM ubuntu:19.10 @@ -27,6 +26,7 @@ RUN apt-get update -y \ curl \ gcc-9 \ g++-9 \ + llvm-10 \ clang-10 \ lld-10 \ clang-tidy-10 \ diff --git a/docker/packager/deb/Dockerfile b/docker/packager/deb/Dockerfile index b8e7b06bf6b..172dcad4e3c 100644 --- a/docker/packager/deb/Dockerfile +++ b/docker/packager/deb/Dockerfile @@ -23,6 +23,7 @@ RUN apt-get --allow-unauthenticated update -y \ apt-get --allow-unauthenticated install --yes --no-install-recommends \ gcc-9 \ g++-9 \ + llvm-10 \ clang-10 \ lld-10 \ clang-tidy-10 \ diff --git a/docker/packager/packager b/docker/packager/packager index 71380b92fac..40e0f346582 100755 --- a/docker/packager/packager +++ b/docker/packager/packager @@ -165,7 +165,7 @@ if __name__ == "__main__": parser.add_argument("--clickhouse-repo-path", default="../../") parser.add_argument("--output-dir", required=True) parser.add_argument("--build-type", choices=("debug", ""), default="") - parser.add_argument("--compiler", choices=("clang-8", "clang-8-darwin", "clang-9-aarch64", "clang-9-freebsd", "gcc-8", "gcc-9", "clang-9"), default="gcc-8") + parser.add_argument("--compiler", choices=("clang-8", "clang-8-darwin", "clang-9-aarch64", "clang-9-freebsd", "gcc-9", "clang-9", "clang-10"), default="gcc-9") parser.add_argument("--sanitizer", choices=("address", "thread", "memory", "undefined", ""), default="") parser.add_argument("--unbundled", action="store_true") parser.add_argument("--split-binary", action="store_true") diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index 9c35a429419..faa5a593eb2 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:18.04 ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" -ARG version=20.4.1.* +ARG version=20.5.1.* ARG gosu_ver=1.10 RUN apt-get update \ diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile index 412849049f1..1dd756ed7c2 100644 --- a/docker/test/Dockerfile +++ b/docker/test/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:18.04 ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" -ARG version=20.4.1.* +ARG version=20.5.1.* RUN apt-get update && \ apt-get install -y apt-transport-https dirmngr && \ diff --git a/docker/test/integration/compose/docker_compose_minio.yml b/docker/test/integration/compose/docker_compose_minio.yml index 41816427794..5b93369e3e2 100644 --- a/docker/test/integration/compose/docker_compose_minio.yml +++ b/docker/test/integration/compose/docker_compose_minio.yml @@ -27,5 +27,16 @@ services: - SERVER_REDIRECT_CODE=307 - SERVER_ACCESS_LOG=/nginx/access.log +# HTTP proxies for Minio. + proxy1: + image: vimagick/tinyproxy + ports: + - "4081:8888" + + proxy2: + image: vimagick/tinyproxy + ports: + - "4082:8888" + volumes: data1-1: diff --git a/docker/test/performance-comparison/compare.sh b/docker/test/performance-comparison/compare.sh index e2c9bc45e9b..5e6846cb6b6 100755 --- a/docker/test/performance-comparison/compare.sh +++ b/docker/test/performance-comparison/compare.sh @@ -93,53 +93,52 @@ function run_tests # Just check that the script runs at all "$script_dir/perf.py" --help > /dev/null - # When testing commits from master, use the older test files. This allows the - # tests to pass even when we add new functions and tests for them, that are - # not supported in the old revision. - # When testing a PR, use the test files from the PR so that we can test their - # changes. - test_prefix=$([ "$PR_TO_TEST" == "0" ] && echo left || echo right)/performance + # Find the directory with test files. + if [ -v CHPC_TEST_PATH ] + then + # Use the explicitly set path to directory with test files. + test_prefix="$CHPC_TEST_PATH" + elif [ "$PR_TO_TEST" = "0" ] + then + # When testing commits from master, use the older test files. This + # allows the tests to pass even when we add new functions and tests for + # them, that are not supported in the old revision. + test_prefix=left/performance + elif [ "$PR_TO_TEST" != "" ] && [ "$PR_TO_TEST" != "0" ] + then + # For PRs, use newer test files so we can test these changes. + test_prefix=right/performance - for x in {test-times,skipped-tests,wall-clock-times}.tsv + # If some tests were changed in the PR, we may want to run only these + # ones. The list of changed tests in changed-test.txt is prepared in + # entrypoint.sh from git diffs, because it has the cloned repo. Used + # to use rsync for that but it was really ugly and not always correct + # (e.g. when the reference SHA is really old and has some other + # differences to the tested SHA, besides the one introduced by the PR). + changed_test_files=$(sed "s/tests\/performance/${test_prefix//\//\\/}/" changed-tests.txt) + fi + + # Determine which tests to run. + if [ -v CHPC_TEST_GREP ] + then + # Run only explicitly specified tests, if any. + test_files=$(ls "$test_prefix" | grep "$CHPC_TEST_GREP" | xargs -I{} -n1 readlink -f "$test_prefix/{}") + elif [ "$changed_test_files" != "" ] + then + # Use test files that changed in the PR. + test_files="$changed_test_files" + else + # The default -- run all tests found in the test dir. + test_files=$(ls "$test_prefix"/*.xml) + fi + + # Delete old report files. + for x in {test-times,skipped-tests,wall-clock-times,report-thresholds,client-times}.tsv do rm -v "$x" ||: touch "$x" done - - # FIXME a quick crutch to bring the run time down for the unstable tests -- - # if some performance tests xmls were changed in a PR, run only these ones. - if [ "$PR_TO_TEST" != "0" ] - then - # changed-test.txt prepared in entrypoint.sh from git diffs, because it - # has the cloned repo. Used to use rsync for that but it was really ugly - # and not always correct (e.g. when the reference SHA is really old and - # has some other differences to the tested SHA, besides the one introduced - # by the PR). - test_files_override=$(sed "s/tests\/performance/${test_prefix//\//\\/}/" changed-tests.txt) - if [ "$test_files_override" != "" ] - then - test_files=$test_files_override - fi - fi - - # Run only explicitly specified tests, if any - if [ -v CHPC_TEST_GREP ] - then - test_files=$(ls "$test_prefix" | grep "$CHPC_TEST_GREP" | xargs -I{} -n1 readlink -f "$test_prefix/{}") - fi - - if [ "$test_files" == "" ] - then - # FIXME remove some broken long tests - for test_name in {IPv4,IPv6,modulo,parse_engine_file,number_formatting_formats,select_format,arithmetic,cryptographic_hashes,logical_functions_{medium,small}} - do - printf "%s\tMarked as broken (see compare.sh)\n" "$test_name">> skipped-tests.tsv - rm "$test_prefix/$test_name.xml" ||: - done - test_files=$(ls "$test_prefix"/*.xml) - fi - # Run the tests. test_name="" for test in $test_files @@ -159,14 +158,6 @@ function run_tests # The test completed with zero status, so we treat stderr as warnings mv "$test_name-err.log" "$test_name-warn.log" - - grep ^query "$test_name-raw.tsv" | cut -f2- > "$test_name-queries.tsv" - grep ^client-time "$test_name-raw.tsv" | cut -f2- > "$test_name-client-time.tsv" - skipped=$(grep ^skipped "$test_name-raw.tsv" | cut -f2-) - if [ "$skipped" != "" ] - then - printf "%s\t%s\n" "$test_name" "$skipped">> skipped-tests.tsv - fi done unset TIMEFORMAT @@ -182,11 +173,11 @@ function get_profiles_watchdog for pid in $(pgrep -f clickhouse) do - gdb -p $pid --batch --ex "info proc all" --ex "thread apply all bt" --ex quit &> "$pid.gdb.log" & + gdb -p "$pid" --batch --ex "info proc all" --ex "thread apply all bt" --ex quit &> "$pid.gdb.log" & done wait - for i in {1..10} + for _ in {1..10} do if ! pkill -f clickhouse then @@ -229,7 +220,19 @@ function get_profiles # Build and analyze randomization distribution for all queries. function analyze_queries { -rm -v analyze-commands.txt analyze-errors.log all-queries.tsv unstable-queries.tsv *-report.tsv ||: +rm -v analyze-commands.txt analyze-errors.log all-queries.tsv unstable-queries.tsv ./*-report.tsv raw-queries.tsv client-times.tsv report-thresholds.tsv ||: + +# Split the raw test output into files suitable for analysis. +IFS=$'\n' +for test_file in $(find . -maxdepth 1 -name "*-raw.tsv" -print) +do + test_name=$(basename "$test_file" "-raw.tsv") + sed -n "s/^query\t//p" < "$test_file" > "$test_name-queries.tsv" + sed -n "s/^client-time/$test_name/p" < "$test_file" >> "client-times.tsv" + sed -n "s/^report-threshold/$test_name/p" < "$test_file" >> "report-thresholds.tsv" + sed -n "s/^skipped/$test_name/p" < "$test_file" >> "skipped-tests.tsv" +done +unset IFS # This is a lateral join in bash... please forgive me. # We don't have arrayPermute(), so I have to make random permutations with @@ -245,14 +248,14 @@ do for query in $(cut -d' ' -f1 "$test_file" | sort | uniq) do query_prefix="$test_name.q$query_index" - query_index=$(($query_index + 1)) + query_index=$((query_index + 1)) grep -F "$query " "$test_file" > "$query_prefix.tmp" printf "%s\0\n" \ "clickhouse-local \ - --file "$query_prefix.tmp" \ + --file \"$query_prefix.tmp\" \ --structure 'query text, run int, version UInt32, time float' \ --query \"$(cat "$script_dir/eqmed.sql")\" \ - >> "$test_name-report.tsv"" \ + >> \"$test_name-report.tsv\"" \ 2>> analyze-errors.log \ >> analyze-commands.txt done @@ -267,6 +270,108 @@ parallel --verbose --null < analyze-commands.txt function report { +rm -r report ||: +mkdir report ||: + + +rm ./*.{rep,svg} test-times.tsv test-dump.tsv unstable.tsv unstable-query-ids.tsv unstable-query-metrics.tsv changed-perf.tsv unstable-tests.tsv unstable-queries.tsv bad-tests.tsv slow-on-client.tsv all-queries.tsv ||: + +cat analyze-errors.log >> report/errors.log ||: +cat profile-errors.log >> report/errors.log ||: + +clickhouse-local --query " +create table queries engine File(TSVWithNamesAndTypes, 'report/queries.tsv') + as select + -- FIXME Comparison mode doesn't make sense for queries that complete + -- immediately, so for now we pretend they don't exist. We don't want to + -- remove them altogether because we want to be able to detect regressions, + -- but the right way to do this is not yet clear. + (left + right) / 2 < 0.02 as short, + + not short and abs(diff) > report_threshold and abs(diff) > stat_threshold as changed_fail, + not short and abs(diff) > report_threshold - 0.05 and abs(diff) > stat_threshold as changed_show, + + not short and not changed_fail and stat_threshold > report_threshold + 0.10 as unstable_fail, + not short and not changed_show and stat_threshold > report_threshold - 0.05 as unstable_show, + + left, right, diff, stat_threshold, + if(report_threshold > 0, report_threshold, 0.10) as report_threshold, + reports.test, + query + from + ( + select *, + replaceAll(_file, '-report.tsv', '') test + from file('*-report.tsv', TSV, 'left float, right float, diff float, stat_threshold float, query text') + ) reports + left join file('report-thresholds.tsv', TSV, 'test text, report_threshold float') thresholds + using test + ; + +-- keep the table in old format so that we can analyze new and old data together +create table queries_old_format engine File(TSVWithNamesAndTypes, 'queries.rep') + as select short, changed_fail, unstable_fail, left, right, diff, stat_threshold, test, query + from queries + ; + +create table changed_perf_tsv engine File(TSV, 'report/changed-perf.tsv') as + select left, right, diff, stat_threshold, changed_fail, test, query from queries where changed_show + order by abs(diff) desc; + +create table unstable_queries_tsv engine File(TSV, 'report/unstable-queries.tsv') as + select left, right, diff, stat_threshold, unstable_fail, test, query from queries where unstable_show + order by stat_threshold desc; + +create table queries_for_flamegraph engine File(TSVWithNamesAndTypes, 'report/queries-for-flamegraph.tsv') as + select query, test from queries where unstable_show or changed_show + ; + +create table unstable_tests_tsv engine File(TSV, 'report/bad-tests.tsv') as + select test, sum(unstable_fail) u, sum(changed_fail) c, u + c s from queries + group by test having s > 0 order by s desc; + +create table query_time engine Memory as select * + from file('client-times.tsv', TSV, 'test text, query text, client float, server float'); + +create table wall_clock engine Memory as select * + from file('wall-clock-times.tsv', TSV, 'test text, real float, user float, system float'); + +create table slow_on_client_tsv engine File(TSV, 'report/slow-on-client.tsv') as + select client, server, floor(client/server, 3) p, query + from query_time where p > 1.02 order by p desc; + +create table test_time engine Memory as + select test, sum(client) total_client_time, + maxIf(client, not short) query_max, + minIf(client, not short) query_min, + count(*) queries, + sum(short) short_queries + from query_time full join queries + on query_time.query = queries.query + group by test; + +create table test_times_tsv engine File(TSV, 'report/test-times.tsv') as + select wall_clock.test, real, + floor(total_client_time, 3), + queries, + short_queries, + floor(query_max, 3), + floor(real / queries, 3) avg_real_per_query, + floor(query_min, 3) + from test_time + -- wall clock times are also measured for skipped tests, so don't + -- do full join + left join wall_clock using test + order by avg_real_per_query desc; + +create table all_tests_tsv engine File(TSV, 'report/all-queries.tsv') as + select changed_fail, unstable_fail, + left, right, diff, + floor(left > right ? left / right : right / left, 3), + stat_threshold, test, query + from queries order by test, query; +" 2> >(tee -a report/errors.log 1>&2) + for x in {right,left}-{addresses,{query,query-thread,trace,metric}-log}.tsv do # FIXME This loop builds column definitons from TSVWithNamesAndTypes in an @@ -277,88 +382,12 @@ do | tr '\n' ', ' | sed 's/,$//' > "$x.columns" done -rm ./*.{rep,svg} test-times.tsv test-dump.tsv unstable.tsv unstable-query-ids.tsv unstable-query-metrics.tsv changed-perf.tsv unstable-tests.tsv unstable-queries.tsv bad-tests.tsv slow-on-client.tsv all-queries.tsv ||: - -cat analyze-errors.log >> report-errors.rep ||: -cat profile-errors.log >> report-errors.rep ||: - -clickhouse-local --query " -create table queries engine File(TSVWithNamesAndTypes, 'queries.rep') - as select - -- FIXME Comparison mode doesn't make sense for queries that complete - -- immediately, so for now we pretend they don't exist. We don't want to - -- remove them altogether because we want to be able to detect regressions, - -- but the right way to do this is not yet clear. - (left + right) / 2 < 0.02 as short, - - not short and abs(diff) > 0.05 and abs(diff) > threshold as changed, - - not short and not changed and threshold > 0.05 as unstable, - - left, right, diff, threshold, - replaceAll(_file, '-report.tsv', '') test, - - -- Truncate long queries. - if(length(query) < 300, query, substr(query, 1, 298) || '...') query - from file('*-report.tsv', TSV, 'left float, right float, diff float, threshold float, query text'); - -create table changed_perf_tsv engine File(TSV, 'changed-perf.tsv') as - select left, right, diff, threshold, test, query from queries where changed - order by abs(diff) desc; - -create table unstable_queries_tsv engine File(TSV, 'unstable-queries.tsv') as - select left, right, diff, threshold, test, query from queries where unstable - order by threshold desc; - -create table unstable_tests_tsv engine File(TSV, 'bad-tests.tsv') as - select test, sum(unstable) u, sum(changed) c, u + c s from queries - group by test having s > 0 order by s desc; - -create table query_time engine Memory as select *, replaceAll(_file, '-client-time.tsv', '') test - from file('*-client-time.tsv', TSV, 'query text, client float, server float'); - -create table wall_clock engine Memory as select * - from file('wall-clock-times.tsv', TSV, 'test text, real float, user float, system float'); - -create table slow_on_client_tsv engine File(TSV, 'slow-on-client.tsv') as - select client, server, floor(client/server, 3) p, query - from query_time where p > 1.02 order by p desc; - -create table test_time engine Memory as - select test, sum(client) total_client_time, - maxIf(client, not short) query_max, - minIf(client, not short) query_min, - count(*) queries, - sum(short) short_queries - from query_time, queries - where query_time.query = queries.query - group by test; - -create table test_times_tsv engine File(TSV, 'test-times.tsv') as - select wall_clock.test, real, - floor(total_client_time, 3), - queries, - short_queries, - floor(query_max, 3), - floor(real / queries, 3) avg_real_per_query, - floor(query_min, 3) - from test_time join wall_clock using test - order by avg_real_per_query desc; - -create table all_tests_tsv engine File(TSV, 'all-queries.tsv') as - select left, right, diff, - floor(left > right ? left / right : right / left, 3), - threshold, test, query - from queries order by test, query; -" 2> >(head -2 >> report-errors.rep) ||: - for version in {right,left} do clickhouse-local --query " -create view queries as - select * from file('queries.rep', TSVWithNamesAndTypes, - 'short int, changed int, unstable int, left float, right float, - diff float, threshold float, test text, query text'); +create view queries_for_flamegraph as + select * from file('report/queries-for-flamegraph.tsv', TSVWithNamesAndTypes, + 'query text, test text'); create view query_log as select * from file('$version-query-log.tsv', TSVWithNamesAndTypes, @@ -377,9 +406,9 @@ create table addresses_join_$version engine Join(any, left, address) as create table unstable_query_runs engine File(TSVWithNamesAndTypes, 'unstable-query-runs.$version.rep') as - select query_id, query from query_log - join queries using query - where query_id not like 'prewarm %' and (unstable or changed) + select query, query_id from query_log + where query in (select query from queries_for_flamegraph) + and query_id not like 'prewarm %' ; create table unstable_query_log engine File(Vertical, @@ -427,10 +456,10 @@ create table metric_devation engine File(TSVWithNamesAndTypes, from (select * from unstable_run_metrics union all select * from unstable_run_traces union all select * from unstable_run_metrics_2) mm - join queries using query + join queries_for_flamegraph using query group by query, metric having d > 0.5 - order by any(threshold) desc, query desc, d desc + order by query desc, d desc ; create table stacks engine File(TSV, 'stacks.$version.rep') as @@ -447,7 +476,7 @@ create table stacks engine File(TSV, 'stacks.$version.rep') as join unstable_query_runs using query_id group by query, trace ; -" 2> >(head -2 >> report-errors.rep) ||: # do not run in parallel because they use the same data dir for StorageJoins which leads to weird errors. +" 2> >(tee -a report/errors.log 1>&2) # do not run in parallel because they use the same data dir for StorageJoins which leads to weird errors. done wait @@ -529,7 +558,7 @@ case "$stage" in "report") time report ||: - time "$script_dir/report.py" --report=all-queries > all-queries.html 2> >(head -2 >> report-errors.rep) ||: + time "$script_dir/report.py" --report=all-queries > all-queries.html 2> >(tee -a report/errors.log 1>&2) ||: time "$script_dir/report.py" > report.html ;& esac diff --git a/docker/test/performance-comparison/download.sh b/docker/test/performance-comparison/download.sh index bf066997f7f..dd030e9f39d 100755 --- a/docker/test/performance-comparison/download.sh +++ b/docker/test/performance-comparison/download.sh @@ -30,7 +30,8 @@ function download wget -nv -nd -c "https://clickhouse-builds.s3.yandex.net/$left_pr/$left_sha/performance/performance.tgz" -O- | tar -C left --strip-components=1 -zxv & wget -nv -nd -c "https://clickhouse-builds.s3.yandex.net/$right_pr/$right_sha/performance/performance.tgz" -O- | tar -C right --strip-components=1 -zxv & else - wget -nv -nd -c "https://clickhouse-builds.s3.yandex.net/$left_pr/$left_sha/performance/performance.tgz" -O- | tar -C left --strip-components=1 -zxv && cp -a left right & + mkdir right ||: + wget -nv -nd -c "https://clickhouse-builds.s3.yandex.net/$left_pr/$left_sha/performance/performance.tgz" -O- | tar -C left --strip-components=1 -zxv && cp -a left/* right & fi for dataset_name in $datasets diff --git a/docker/test/performance-comparison/entrypoint.sh b/docker/test/performance-comparison/entrypoint.sh index f316a659f3c..500dd872c8d 100755 --- a/docker/test/performance-comparison/entrypoint.sh +++ b/docker/test/performance-comparison/entrypoint.sh @@ -119,5 +119,5 @@ done dmesg -T > dmesg.log -7z a /output/output.7z ./*.{log,tsv,html,txt,rep,svg} {right,left}/{performance,db/preprocessed_configs} +7z a /output/output.7z ./*.{log,tsv,html,txt,rep,svg} {right,left}/{performance,db/preprocessed_configs,scripts} ./report cp compare.log /output diff --git a/docker/test/performance-comparison/eqmed.sql b/docker/test/performance-comparison/eqmed.sql index 9d0e54def58..4f8482ea74b 100644 --- a/docker/test/performance-comparison/eqmed.sql +++ b/docker/test/performance-comparison/eqmed.sql @@ -9,8 +9,12 @@ from ( -- quantiles of randomization distributions select quantileExact(0.999)(abs(time_by_label[1] - time_by_label[2]) as d) threshold - -- uncomment to see what the distribution is really like - -- , sumMap([d], [1]) full_histogram + ---- uncomment to see what the distribution is really like + --, uniqExact(d) u + --, arraySort(x->x.1, + -- arrayZip( + -- (sumMap([d], [1]) as f).1, + -- f.2)) full_histogram from ( select virtual_run, groupArrayInsertAt(median_time, random_label) time_by_label -- make array 'random label' -> 'median time' diff --git a/docker/test/performance-comparison/perf.py b/docker/test/performance-comparison/perf.py index 06f8ca8d784..a749b158e83 100755 --- a/docker/test/performance-comparison/perf.py +++ b/docker/test/performance-comparison/perf.py @@ -48,6 +48,10 @@ infinite_sign = root.find('.//average_speed_not_changing_for_ms') if infinite_sign is not None: raise Exception('Looks like the test is infinite (sign 1)') +# Print report threshold for the test if it is set. +if 'max_ignored_relative_change' in root.attrib: + print(f'report-threshold\t{root.attrib["max_ignored_relative_change"]}') + # Open connections servers = [{'host': host, 'port': port} for (host, port) in zip(args.host, args.port)] connections = [clickhouse_driver.Client(**server) for server in servers] @@ -137,17 +141,25 @@ test_queries = substitute_parameters(test_query_templates) report_stage_end('substitute2') -for q in test_queries: +for i, q in enumerate(test_queries): + # We have some crazy long queries (about 100kB), so trim them to a sane + # length. + query_display_name = q + if len(query_display_name) > 1000: + query_display_name = f'{query_display_name[:1000]}...({i})' + # Prewarm: run once on both servers. Helps to bring the data into memory, # precompile the queries, etc. try: for conn_index, c in enumerate(connections): - res = c.execute(q, query_id = 'prewarm {} {}'.format(0, q)) - print('prewarm\t' + tsv_escape(q) + '\t' + str(conn_index) + '\t' + str(c.last_query.elapsed)) + res = c.execute(q, query_id = f'prewarm {0} {query_display_name}') + print(f'prewarm\t{tsv_escape(query_display_name)}\t{conn_index}\t{c.last_query.elapsed}') except: # If prewarm fails for some query -- skip it, and try to test the others. # This might happen if the new test introduces some function that the # old server doesn't support. Still, report it as an error. + # FIXME the driver reconnects on error and we lose settings, so this might + # lead to further errors or unexpected behavior. print(traceback.format_exc(), file=sys.stderr) continue @@ -160,11 +172,11 @@ for q in test_queries: for run in range(0, args.runs): for conn_index, c in enumerate(connections): res = c.execute(q) - print('query\t' + tsv_escape(q) + '\t' + str(run) + '\t' + str(conn_index) + '\t' + str(c.last_query.elapsed)) + print(f'query\t{tsv_escape(query_display_name)}\t{run}\t{conn_index}\t{c.last_query.elapsed}') server_seconds += c.last_query.elapsed client_seconds = time.perf_counter() - start_seconds - print('client-time\t{}\t{}\t{}'.format(tsv_escape(q), client_seconds, server_seconds)) + print(f'client-time\t{tsv_escape(query_display_name)}\t{client_seconds}\t{server_seconds}') report_stage_end('benchmark') diff --git a/docker/test/performance-comparison/performance_comparison.md b/docker/test/performance-comparison/performance_comparison.md index e14bb9d024d..66fce3426fb 100644 --- a/docker/test/performance-comparison/performance_comparison.md +++ b/docker/test/performance-comparison/performance_comparison.md @@ -53,6 +53,29 @@ More stages are available, e.g. restart servers or run the tests. See the code. docker/test/performance-comparison/perf.py --host=localhost --port=9000 --runs=1 tests/performance/logical_functions_small.xml ``` +#### Run all tests on some custom configuration +Start two servers manually on ports `9001` (old) and `9002` (new). Change to a +new directory to be used as workspace for tests, and try something like this: +``` +$ PATH=$PATH:~/ch4/build-gcc9-rel/programs \ + CHPC_TEST_PATH=~/ch3/ch/tests/performance \ + CHPC_TEST_GREP=visit_param \ + stage=run_tests \ + ~/ch3/ch/docker/test/performance-comparison/compare.sh +``` +* `PATH` must contain `clickhouse-local` and `clickhouse-client`. +* `CHPC_TEST_PATH` -- path to performance test cases, e.g. `tests/performance`. +* `CHPC_TEST_GREP` -- a filter for which tests to run, as a grep pattern. +* `stage` -- from which execution stage to start. To run the tests, use + `run_tests` stage. + +The tests will run, and the `report.html` will be generated in the current +directory. + +More complex setup is possible, but inconvenient and requires some scripting. +See `manual-run.sh` for inspiration. + + #### Statistical considerations Generating randomization distribution for medians is tricky. Suppose we have N runs for each version, and then use the combined 2N run results to make a diff --git a/docker/test/performance-comparison/report.py b/docker/test/performance-comparison/report.py index b929de7307c..43050430596 100755 --- a/docker/test/performance-comparison/report.py +++ b/docker/test/performance-comparison/report.py @@ -22,6 +22,9 @@ slower_queries = 0 unstable_queries = 0 very_unstable_queries = 0 +# max seconds to run one query by itself, not counting preparation +allowed_single_run_time = 2 + header_template = """ @@ -95,7 +98,8 @@ def tableRow(cell_values, cell_attributes = []): return tr(''.join([td(v, a) for v, a in itertools.zip_longest( cell_values, cell_attributes, - fillvalue = '')])) + fillvalue = '') + if a is not None])) def tableHeader(r): return tr(''.join([th(f) for f in r])) @@ -139,16 +143,45 @@ def printSimpleTable(caption, columns, rows): print(tableRow(row)) print(tableEnd()) +def print_tested_commits(): + global report_errors + try: + printSimpleTable('Tested commits', ['Old', 'New'], + [['
{}
'.format(x) for x in + [open('left-commit.txt').read(), + open('right-commit.txt').read()]]]) + except: + # Don't fail if no commit info -- maybe it's a manual run. + report_errors.append( + traceback.format_exception_only( + *sys.exc_info()[:2])[-1]) + pass + +def print_report_errors(): + global report_errors + # Add the errors reported by various steps of comparison script + try: + report_errors += [l.strip() for l in open('report/errors.log')] + except: + report_errors.append( + traceback.format_exception_only( + *sys.exc_info()[:2])[-1]) + pass + + if len(report_errors): + print(tableStart('Errors while building the report')) + print(tableHeader(['Error'])) + for x in report_errors: + print(tableRow([x])) + print(tableEnd()) + if args.report == 'main': print(header_template.format()) - printSimpleTable('Tested commits', ['Old', 'New'], - [['
{}
'.format(x) for x in - [open('left-commit.txt').read(), - open('right-commit.txt').read()]]]) + print_tested_commits() def print_changes(): - rows = tsvRows('changed-perf.tsv') + rows = tsvRows('report/changed-perf.tsv') if not rows: return @@ -160,22 +193,25 @@ if args.report == 'main': 'New, s', # 1 'Relative difference (new - old)/old', # 2 'p < 0.001 threshold', # 3 - 'Test', # 4 - 'Query', # 5 + # Failed # 4 + 'Test', # 5 + 'Query', # 6 ] print(tableHeader(columns)) attrs = ['' for c in columns] + attrs[4] = None for row in rows: - attrs[2] = '' - if abs(float(row[2])) > 0.10: + if int(row[4]): if float(row[2]) < 0.: faster_queries += 1 attrs[2] = 'style="background: #adbdff"' else: slower_queries += 1 attrs[2] = 'style="background: #ffb0a0"' + else: + attrs[2] = '' print(tableRow(row, attrs)) @@ -183,7 +219,7 @@ if args.report == 'main': print_changes() - slow_on_client_rows = tsvRows('slow-on-client.tsv') + slow_on_client_rows = tsvRows('report/slow-on-client.tsv') error_tests += len(slow_on_client_rows) printSimpleTable('Slow on client', ['Client time, s', 'Server time, s', 'Ratio', 'Query'], @@ -193,7 +229,7 @@ if args.report == 'main': global unstable_queries global very_unstable_queries - unstable_rows = tsvRows('unstable-queries.tsv') + unstable_rows = tsvRows('report/unstable-queries.tsv') if not unstable_rows: return @@ -204,16 +240,18 @@ if args.report == 'main': 'New, s', #1 'Relative difference (new - old)/old', #2 'p < 0.001 threshold', #3 - 'Test', #4 - 'Query' #5 + # Failed #4 + 'Test', #5 + 'Query' #6 ] print(tableStart('Unstable queries')) print(tableHeader(columns)) attrs = ['' for c in columns] + attrs[4] = None for r in unstable_rows: - if float(r[3]) > 0.2: + if int(r[4]): very_unstable_queries += 1 attrs[3] = 'style="background: #ffb0a0"' else: @@ -234,11 +272,11 @@ if args.report == 'main': printSimpleTable('Tests with most unstable queries', ['Test', 'Unstable', 'Changed perf', 'Total not OK'], - tsvRows('bad-tests.tsv')) + tsvRows('report/bad-tests.tsv')) def print_test_times(): global slow_average_tests - rows = tsvRows('test-times.tsv') + rows = tsvRows('report/test-times.tsv') if not rows: return @@ -256,17 +294,18 @@ if args.report == 'main': print(tableStart('Test times')) print(tableHeader(columns)) - runs = 13 # FIXME pass this as an argument + nominal_runs = 13 # FIXME pass this as an argument + total_runs = (nominal_runs + 1) * 2 # one prewarm run, two servers attrs = ['' for c in columns] for r in rows: - if float(r[6]) > 3 * runs: + if float(r[6]) > 1.5 * total_runs: # FIXME should be 15s max -- investigate parallel_insert slow_average_tests += 1 attrs[6] = 'style="background: #ffb0a0"' else: attrs[6] = '' - if float(r[5]) > 4 * runs: + if float(r[5]) > allowed_single_run_time * total_runs: slow_average_tests += 1 attrs[5] = 'style="background: #ffb0a0"' else: @@ -278,15 +317,7 @@ if args.report == 'main': print_test_times() - # Add the errors reported by various steps of comparison script - report_errors += [l.strip() for l in open('report-errors.rep')] - if len(report_errors): - print(tableStart('Errors while building the report')) - print(tableHeader(['Error'])) - for x in report_errors: - print(tableRow([x])) - print(tableEnd()) - + print_report_errors() print("""
{}
'.format(x) for x in - [open('left-commit.txt').read(), - open('right-commit.txt').read()]]]) + print_tested_commits() def print_all_queries(): - rows = tsvRows('all-queries.tsv') + rows = tsvRows('report/all-queries.tsv') if not rows: return columns = [ - 'Old, s', #0 - 'New, s', #1 - 'Relative difference (new - old)/old', #2 - 'Times speedup/slowdown', #3 - 'p < 0.001 threshold', #4 - 'Test', #5 - 'Query', #6 + # Changed #0 + # Unstable #1 + 'Old, s', #2 + 'New, s', #3 + 'Relative difference (new - old)/old', #4 + 'Times speedup/slowdown', #5 + 'p < 0.001 threshold', #6 + 'Test', #7 + 'Query', #8 ] print(tableStart('All query times')) print(tableHeader(columns)) attrs = ['' for c in columns] + attrs[0] = None + attrs[1] = None for r in rows: - threshold = float(r[3]) - if threshold > 0.2: - attrs[4] = 'style="background: #ffb0a0"' + if int(r[1]): + attrs[6] = 'style="background: #ffb0a0"' + else: + attrs[6] = '' + + if int(r[0]): + if float(r[4]) > 0.: + attrs[4] = 'style="background: #ffb0a0"' + else: + attrs[4] = 'style="background: #adbdff"' else: attrs[4] = '' - diff = float(r[2]) - if abs(diff) > threshold and threshold >= 0.05: - if diff > 0.: - attrs[3] = 'style="background: #ffb0a0"' - else: - attrs[3] = 'style="background: #adbdff"' + if (float(r[2]) + float(r[3])) / 2 > allowed_single_run_time: + attrs[2] = 'style="background: #ffb0a0"' + attrs[3] = 'style="background: #ffb0a0"' else: + attrs[2] = '' attrs[3] = '' print(tableRow(r, attrs)) @@ -386,6 +423,8 @@ elif args.report == 'all-queries': print_all_queries() + print_report_errors() + print("""
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects. If possible, switch old projects to the method described above. + +``` sql +Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format + [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) +``` + +
+ +## Description {#description} + +The delivered messages are tracked automatically, so each message in a group is only counted once. If you want to get the data twice, then create a copy of the table with another group name. + +Groups are flexible and synced on the cluster. For instance, if you have 10 topics and 5 copies of a table in a cluster, then each copy gets 2 topics. If the number of copies changes, the topics are redistributed across the copies automatically. Read more about this at http://kafka.apache.org/intro. + +`SELECT` is not particularly useful for reading messages (except for debugging), because each message can be read only once. It is more practical to create real-time threads using materialized views. To do this: + +1. Use the engine to create a Kafka consumer and consider it a data stream. +2. Create a table with the desired structure. +3. Create a materialized view that converts data from the engine and puts it into a previously created table. + +When the `MATERIALIZED VIEW` joins the engine, it starts collecting data in the background. This allows you to continually receive messages from Kafka and convert them to the required format using `SELECT`. +One kafka table can have as many materialized views as you like, they do not read data from the kafka table directly, but receive new records (in blocks), this way you can write to several tables with different detail level (with grouping - aggregation and without). + +Example: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + CREATE TABLE daily ( + day Date, + level String, + total UInt64 + ) ENGINE = SummingMergeTree(day, (day, level), 8192); + + CREATE MATERIALIZED VIEW consumer TO daily + AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total + FROM queue GROUP BY day, level; + + SELECT level, sum(total) FROM daily GROUP BY level; +``` + +To improve performance, received messages are grouped into blocks the size of [max\_insert\_block\_size](../../../operations/server-configuration-parameters/settings.md#settings-max_insert_block_size). If the block wasn’t formed within [stream\_flush\_interval\_ms](../../../operations/server-configuration-parameters/settings.md) milliseconds, the data will be flushed to the table regardless of the completeness of the block. + +To stop receiving topic data or to change the conversion logic, detach the materialized view: + +``` sql + DETACH TABLE consumer; + ATTACH TABLE consumer; +``` + +If you want to change the target table by using `ALTER`, we recommend disabling the material view to avoid discrepancies between the target table and the data from the view. + +## Configuration {#configuration} + +Similar to GraphiteMergeTree, the Kafka engine supports extended configuration using the ClickHouse config file. There are two configuration keys that you can use: global (`kafka`) and topic-level (`kafka_*`). The global configuration is applied first, and then the topic-level configuration is applied (if it exists). + +``` xml + + + cgrp + smallest + + + + + 250 + 100000 + +``` + +For a list of possible configuration options, see the [librdkafka configuration reference](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Use the underscore (`_`) instead of a dot in the ClickHouse configuration. For example, `check.crcs=true` will be `true`. + +## Virtual Columns {#virtual-columns} + +- `_topic` — Kafka topic. +- `_key` — Key of the message. +- `_offset` — Offset of the message. +- `_timestamp` — Timestamp of the message. +- `_partition` — Partition of Kafka topic. + +**See Also** + +- [Virtual columns](../index.md#table_engines-virtual_columns) + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/en/engines/table-engines/integrations/mysql.md b/docs/en/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..c98d492322f --- /dev/null +++ b/docs/en/engines/table-engines/integrations/mysql.md @@ -0,0 +1,103 @@ +--- +toc_priority: 33 +toc_title: MySQL +--- + +# Mysql {#mysql} + +The MySQL engine allows you to perform `SELECT` queries on data that is stored on a remote MySQL server. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... +) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +See a detailed description of the [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) query. + +The table structure can differ from the original MySQL table structure: + +- Column names should be the same as in the original MySQL table, but you can use just some of these columns and in any order. +- Column types may differ from those in the original MySQL table. ClickHouse tries to [cast](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) values to the ClickHouse data types. + +**Engine Parameters** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` queries to `REPLACE INTO`. If `replace_query=1`, the query is substituted. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expression that is added to the `INSERT` query. + + Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the [MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. + + To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. + +Simple `WHERE` clauses such as `=, !=, >, >=, <, <=` are executed on the MySQL server. + +The rest of the conditions and the `LIMIT` sampling constraint are executed in ClickHouse only after the query to MySQL finishes. + +## Usage Example {#usage-example} + +Table in MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Table in ClickHouse, retrieving data from the MySQL table created above: + +``` sql +CREATE TABLE mysql_table +( + `float_nullable` Nullable(Float32), + `int_id` Int32 +) +ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` sql +SELECT * FROM mysql_table +``` + +``` text +┌─float_nullable─┬─int_id─┐ +│ ᴺᵁᴸᴸ │ 1 │ +└────────────────┴────────┘ +``` + +## See Also {#see-also} + +- [The ‘mysql’ table function](../../../sql-reference/table-functions/mysql.md) +- [Using MySQL as a source of external dictionary](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/en/engines/table-engines/integrations/odbc.md b/docs/en/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..04387760fb4 --- /dev/null +++ b/docs/en/engines/table-engines/integrations/odbc.md @@ -0,0 +1,130 @@ +--- +toc_priority: 35 +toc_title: ODBC +--- + +# ODBC {#table-engine-odbc} + +Allows ClickHouse to connect to external databases via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +To safely implement ODBC connections, ClickHouse uses a separate program `clickhouse-odbc-bridge`. If the ODBC driver is loaded directly from `clickhouse-server`, driver problems can crash the ClickHouse server. ClickHouse automatically starts `clickhouse-odbc-bridge` when it is required. The ODBC bridge program is installed from the same package as the `clickhouse-server`. + +This engine supports the [Nullable](../../../sql-reference/data-types/nullable.md) data type. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +See a detailed description of the [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) query. + +The table structure can differ from the source table structure: + +- Column names should be the same as in the source table, but you can use just some of these columns and in any order. +- Column types may differ from those in the source table. ClickHouse tries to [cast](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) values to the ClickHouse data types. + +**Engine Parameters** + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` file. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +## Usage Example {#usage-example} + +**Retrieving data from the local MySQL installation via ODBC** + +This example is checked for Ubuntu Linux 18.04 and MySQL server 5.7. + +Ensure that unixODBC and MySQL Connector are installed. + +By default (if installed from packages), ClickHouse starts as user `clickhouse`. Thus, you need to create and configure this user in the MySQL server. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +Then configure the connection in `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +You can check the connection using the `isql` utility from the unixODBC installation. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +Table in MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Table in ClickHouse, retrieving data from the MySQL table: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## See Also {#see-also} + +- [ODBC external dictionaries](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [ODBC table function](../../../sql-reference/table-functions/odbc.md) + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/en/engines/table-engines/log-family/index.md b/docs/en/engines/table-engines/log-family/index.md new file mode 100644 index 00000000000..a5d93c4c7c3 --- /dev/null +++ b/docs/en/engines/table-engines/log-family/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Log Family +toc_priority: 29 +--- + + diff --git a/docs/en/engines/table-engines/log-family/log-family.md b/docs/en/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..af87625393c --- /dev/null +++ b/docs/en/engines/table-engines/log-family/log-family.md @@ -0,0 +1,44 @@ +--- +toc_priority: 31 +toc_title: Introduction +--- + +# Log Engine Family {#log-engine-family} + +These engines were developed for scenarios when you need to quickly write many small tables (up to about 1 million rows) and read them later as a whole. + +Engines of the family: + +- [StripeLog](stripelog.md) +- [Log](log.md) +- [TinyLog](tinylog.md) + +## Common Properties {#common-properties} + +Engines: + +- Store data on a disk. + +- Append data to the end of file when writing. + +- Support locks for concurrent data access. + + During `INSERT` queries, the table is locked, and other queries for reading and writing data both wait for the table to unlock. If there are no data writing queries, any number of data reading queries can be performed concurrently. + +- Do not support [mutation](../../../sql-reference/statements/alter.md#alter-mutations) operations. + +- Do not support indexes. + + This means that `SELECT` queries for ranges of data are not efficient. + +- Do not write data atomically. + + You can get a table with corrupted data if something breaks the write operation, for example, abnormal server shutdown. + +## Differences {#differences} + +The `TinyLog` engine is the simplest in the family and provides the poorest functionality and lowest efficiency. The `TinyLog` engine doesn’t support parallel data reading by several threads. It reads data slower than other engines in the family that support parallel reading and it uses almost as many descriptors as the `Log` engine because it stores each column in a separate file. Use it in simple low-load scenarios. + +The `Log` and `StripeLog` engines support parallel data reading. When reading data, ClickHouse uses multiple threads. Each thread processes a separate data block. The `Log` engine uses a separate file for each column of the table. `StripeLog` stores all the data in one file. As a result, the `StripeLog` engine uses fewer descriptors in the operating system, but the `Log` engine provides higher efficiency when reading data. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/en/engines/table-engines/log-family/log.md b/docs/en/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..1bc229837a4 --- /dev/null +++ b/docs/en/engines/table-engines/log-family/log.md @@ -0,0 +1,14 @@ +--- +toc_priority: 33 +toc_title: Log +--- + +# Log {#log} + +Engine belongs to the family of log engines. See the common properties of log engines and their differences in the [Log Engine Family](log-family.md) article. + +Log differs from [TinyLog](tinylog.md) in that a small file of “marks” resides with the column files. These marks are written on every data block and contain offsets that indicate where to start reading the file in order to skip the specified number of rows. This makes it possible to read table data in multiple threads. +For concurrent data access, the read operations can be performed simultaneously, while write operations block reads and each other. +The Log engine does not support indexes. Similarly, if writing to a table failed, the table is broken, and reading from it returns an error. The Log engine is appropriate for temporary data, write-once tables, and for testing or demonstration purposes. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/en/engines/table-engines/log-family/stripelog.md b/docs/en/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..87e8999fb51 --- /dev/null +++ b/docs/en/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,93 @@ +--- +toc_priority: 32 +toc_title: StripeLog +--- + +# Stripelog {#stripelog} + +This engine belongs to the family of log engines. See the common properties of log engines and their differences in the [Log Engine Family](log-family.md) article. + +Use this engine in scenarios when you need to write many tables with a small amount of data (less than 1 million rows). + +## Creating a Table {#table_engines-stripelog-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = StripeLog +``` + +See the detailed description of the [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) query. + +## Writing the Data {#table_engines-stripelog-writing-the-data} + +The `StripeLog` engine stores all the columns in one file. For each `INSERT` query, ClickHouse appends the data block to the end of a table file, writing columns one by one. + +For each table ClickHouse writes the files: + +- `data.bin` — Data file. +- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. + +The `StripeLog` engine does not support the `ALTER UPDATE` and `ALTER DELETE` operations. + +## Reading the Data {#table_engines-stripelog-reading-the-data} + +The file with marks allows ClickHouse to parallelize the reading of data. This means that a `SELECT` query returns rows in an unpredictable order. Use the `ORDER BY` clause to sort rows. + +## Example of Use {#table_engines-stripelog-example-of-use} + +Creating a table: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +Inserting data: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +We used two `INSERT` queries to create two data blocks inside the `data.bin` file. + +ClickHouse uses multiple threads when selecting data. Each thread reads a separate data block and returns resulting rows independently as it finishes. As a result, the order of blocks of rows in the output does not match the order of the same blocks in the input in most cases. For example: + +``` sql +SELECT * FROM stripe_log_table +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +┌───────────timestamp─┬─message_type─┬─message───────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +└─────────────────────┴──────────────┴───────────────────────────┘ +``` + +Sorting the results (ascending order by default): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +``` + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/en/engines/table-engines/log-family/tinylog.md b/docs/en/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..8dc5a837028 --- /dev/null +++ b/docs/en/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,14 @@ +--- +toc_priority: 34 +toc_title: TinyLog +--- + +# TinyLog {#tinylog} + +The engine belongs to the log engine family. See [Log Engine Family](log-family.md) for common properties of log engines and their differences. + +This table engine is typically used with the write-once method: write data one time, then read it as many times as necessary. For example, you can use `TinyLog`-type tables for intermediary data that is processed in small batches. Note that storing data in a large number of small tables is inefficient. + +Queries are executed in a single stream. In other words, this engine is intended for relatively small tables (up to about 1,000,000 rows). It makes sense to use this table engine if you have many small tables, since it’s simpler than the [Log](log.md) engine (fewer files need to be opened). + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/en/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/en/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..7e1c04a17e7 --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,103 @@ +--- +toc_priority: 35 +toc_title: AggregatingMergeTree +--- + +# Aggregatingmergetree {#aggregatingmergetree} + +The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree), altering the logic for data parts merging. ClickHouse replaces all rows with the same primary key (or more accurately, with the same [sorting key](mergetree.md)) with a single row (within a one data part) that stores a combination of states of aggregate functions. + +You can use `AggregatingMergeTree` tables for incremental data aggregation, including for aggregated materialized views. + +The engine processes all columns with the following types: + +- [AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md) +- [SimpleAggregateFunction](../../../sql-reference/data-types/simpleaggregatefunction.md) + +It is appropriate to use `AggregatingMergeTree` if it reduces the number of rows by orders. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[TTL expr] +[SETTINGS name=value, ...] +``` + +For a description of request parameters, see [request description](../../../sql-reference/statements/create.md). + +**Query clauses** + +When creating a `AggregatingMergeTree` table the same [clauses](mergetree.md) are required, as when creating a `MergeTree` table. + +
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects and, if possible, switch the old projects to the method described above. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +All of the parameters have the same meaning as in `MergeTree`. +
+ +## SELECT and INSERT {#select-and-insert} + +To insert data, use [INSERT SELECT](../../../sql-reference/statements/insert-into.md) query with aggregate -State- functions. +When selecting data from `AggregatingMergeTree` table, use `GROUP BY` clause and the same aggregate functions as when inserting data, but using `-Merge` suffix. + +In the results of `SELECT` query, the values of `AggregateFunction` type have implementation-specific binary representation for all of the ClickHouse output formats. If dump data into, for example, `TabSeparated` format with `SELECT` query then this dump can be loaded back using `INSERT` query. + +## Example of an Aggregated Materialized View {#example-of-an-aggregated-materialized-view} + +`AggregatingMergeTree` materialized view that watches the `test.visits` table: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +Inserting data into the `test.visits` table. + +``` sql +INSERT INTO test.visits ... +``` + +The data are inserted in both the table and view `test.basic` that will perform the aggregation. + +To get the aggregated data, we need to execute a query such as `SELECT ... GROUP BY ...` from the view `test.basic`: + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/en/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/en/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..e09f1ba78d8 --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,307 @@ +--- +toc_priority: 36 +toc_title: CollapsingMergeTree +--- + +# CollapsingMergeTree {#table_engine-collapsingmergetree} + +The engine inherits from [MergeTree](mergetree.md) and adds the logic of rows collapsing to data parts merge algorithm. + +`CollapsingMergeTree` asynchronously deletes (collapses) pairs of rows if all of the fields in a sorting key (`ORDER BY`) are equivalent excepting the particular field `Sign` which can have `1` and `-1` values. Rows without a pair are kept. For more details see the [Collapsing](#table_engine-collapsingmergetree-collapsing) section of the document. + +The engine may significantly reduce the volume of storage and increase the efficiency of `SELECT` query as a consequence. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +For a description of query parameters, see [query description](../../../sql-reference/statements/create.md). + +**CollapsingMergeTree Parameters** + +- `sign` — Name of the column with the type of row: `1` is a “state” row, `-1` is a “cancel” row. + + Column data type — `Int8`. + +**Query clauses** + +When creating a `CollapsingMergeTree` table, the same [query clauses](mergetree.md#table_engine-mergetree-creating-a-table) are required, as when creating a `MergeTree` table. + +
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects and, if possible, switch the old projects to the method described above. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +All of the parameters excepting `sign` have the same meaning as in `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` — “state” row, `-1` — “cancel” row. + + Column Data Type — `Int8`. + +
+ +## Collapsing {#table_engine-collapsingmergetree-collapsing} + +### Data {#data} + +Consider the situation where you need to save continually changing data for some object. It sounds logical to have one row for an object and update it at any change, but update operation is expensive and slow for DBMS because it requires rewriting of the data in the storage. If you need to write data quickly, update not acceptable, but you can write the changes of an object sequentially as follows. + +Use the particular column `Sign`. If `Sign = 1` it means that the row is a state of an object, let’s call it “state” row. If `Sign = -1` it means the cancellation of the state of an object with the same attributes, let’s call it “cancel” row. + +For example, we want to calculate how much pages users checked at some site and how long they were there. At some moment we write the following row with the state of user activity: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +At some moment later we register the change of user activity and write it with the following two rows. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +The first row cancels the previous state of the object (user). It should copy the sorting key fields of the cancelled state excepting `Sign`. + +The second row contains the current state. + +As we need only the last state of user activity, the rows + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +can be deleted collapsing the invalid (old) state of an object. `CollapsingMergeTree` does this while merging of the data parts. + +Why we need 2 rows for each change read in the [Algorithm](#table_engine-collapsingmergetree-collapsing-algorithm) paragraph. + +**Peculiar properties of such approach** + +1. The program that writes the data should remember the state of an object to be able to cancel it. “Cancel” string should contain copies of the sorting key fields of the “state” string and the opposite `Sign`. It increases the initial size of storage but allows to write the data quickly. +2. Long growing arrays in columns reduce the efficiency of the engine due to load for writing. The more straightforward data, the higher the efficiency. +3. The `SELECT` results depend strongly on the consistency of object changes history. Be accurate when preparing data for inserting. You can get unpredictable results in inconsistent data, for example, negative values for non-negative metrics such as session depth. + +### Algorithm {#table_engine-collapsingmergetree-collapsing-algorithm} + +When ClickHouse merges data parts, each group of consecutive rows with the same sorting key (`ORDER BY`) is reduced to not more than two rows, one with `Sign = 1` (“state” row) and another with `Sign = -1` (“cancel” row). In other words, entries collapse. + +For each resulting data part ClickHouse saves: + +1. The first “cancel” and the last “state” rows, if the number of “state” and “cancel” rows matches and the last row is a “state” row. + +2. The last “state” row, if there are more “state” rows than “cancel” rows. + +3. The first “cancel” row, if there are more “cancel” rows than “state” rows. + +4. None of the rows, in all other cases. + +Also when there are at least 2 more “state” rows than “cancel” rows, or at least 2 more “cancel” rows then “state” rows, the merge continues, but ClickHouse treats this situation as a logical error and records it in the server log. This error can occur if the same data were inserted more than once. + +Thus, collapsing should not change the results of calculating statistics. +Changes gradually collapsed so that in the end only the last state of almost every object left. + +The `Sign` is required because the merging algorithm doesn’t guarantee that all of the rows with the same sorting key will be in the same resulting data part and even on the same physical server. ClickHouse process `SELECT` queries with multiple threads, and it can not predict the order of rows in the result. The aggregation is required if there is a need to get completely “collapsed” data from `CollapsingMergeTree` table. + +To finalize collapsing, write a query with `GROUP BY` clause and aggregate functions that account for the sign. For example, to calculate quantity, use `sum(Sign)` instead of `count()`. To calculate the sum of something, use `sum(Sign * x)` instead of `sum(x)`, and so on, and also add `HAVING sum(Sign) > 0`. + +The aggregates `count`, `sum` and `avg` could be calculated this way. The aggregate `uniq` could be calculated if an object has at least one state not collapsed. The aggregates `min` and `max` could not be calculated because `CollapsingMergeTree` does not save the values history of the collapsed states. + +If you need to extract data without aggregation (for example, to check whether rows are present whose newest values match certain conditions), you can use the `FINAL` modifier for the `FROM` clause. This approach is significantly less efficient. + +## Example of Use {#example-of-use} + +Example data: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Creation of the table: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Insertion of the data: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +We use two `INSERT` queries to create two different data parts. If we insert the data with one query ClickHouse creates one data part and will not perform any merge ever. + +Getting the data: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +What do we see and where is collapsing? + +With two `INSERT` queries, we created 2 data parts. The `SELECT` query was performed in 2 threads, and we got a random order of rows. Collapsing not occurred because there was no merge of the data parts yet. ClickHouse merges data part in an unknown moment which we can not predict. + +Thus we need aggregation: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +If we do not need aggregation and want to force collapsing, we can use `FINAL` modifier for `FROM` clause. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +This way of selecting the data is very inefficient. Don’t use it for big tables. + +## Example of Another Approach {#example-of-another-approach} + +Example data: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ -5 │ -146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +The idea is that merges take into account only key fields. And in the “Cancel” line we can specify negative values that equalize the previous version of the row when summing without using the Sign column. For this approach, it is necessary to change the data type `PageViews`,`Duration` to store negative values of UInt8 -\> Int16. + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews Int16, + Duration Int16, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Let’s test the approach: + +``` sql +insert into UAct values(4324182021466249494, 5, 146, 1); +insert into UAct values(4324182021466249494, -5, -146, -1); +insert into UAct values(4324182021466249494, 6, 185, 1); + +select * from UAct final; // avoid using final in production (just for a test or small tables) +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +``` sql +SELECT + UserID, + sum(PageViews) AS PageViews, + sum(Duration) AS Duration +FROM UAct +GROUP BY UserID +```text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +``` sqk +select count() FROM UAct +``` + +``` text +┌─count()─┐ +│ 3 │ +└─────────┘ +``` + +``` sql +optimize table UAct final; + +select * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) 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 new file mode 100644 index 00000000000..4925abae98f --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,125 @@ +--- +toc_priority: 32 +toc_title: Custom Partitioning Key +--- + +# Custom Partitioning Key {#custom-partitioning-key} + +Partitioning is available for the [MergeTree](mergetree.md) family tables (including [replicated](replication.md) tables). [Materialized views](../special/materializedview.md) based on MergeTree tables support partitioning, as well. + +A partition is a logical combination of records in a table by a specified criterion. You can set a partition by an arbitrary criterion, such as by month, by day, or by event type. Each partition is stored separately to simplify manipulations of this data. When accessing the data, ClickHouse uses the smallest subset of partitions possible. + +The partition is specified in the `PARTITION BY expr` clause when [creating a table](mergetree.md#table_engine-mergetree-creating-a-table). The partition key can be any expression from the table columns. For example, to specify partitioning by month, use the expression `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour; +``` + +The partition key can also be a tuple of expressions (similar to the [primary key](mergetree.md#primary-keys-and-indexes-in-queries)). For example: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +In this example, we set partitioning by the event types that occurred during the current week. + +When inserting new data to a table, this data is stored as a separate part (chunk) sorted by the primary key. In 10-15 minutes after inserting, the parts of the same partition are merged into the entire part. + +!!! info "Info" + A merge only works for data parts that have the same value for the partitioning expression. This means **you shouldn’t make overly granular partitions** (more than about a thousand partitions). Otherwise, the `SELECT` query performs poorly because of an unreasonably large number of files in the file system and open file descriptors. + +Use the [system.parts](../../../operations/system-tables.md#system_tables-parts) table to view the table parts and partitions. For example, let’s assume that we have a `visits` table with partitioning by month. Let’s perform the `SELECT` query for the `system.parts` table: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 1 │ +│ 201902 │ 201902_11_11_0 │ 1 │ +└───────────┴────────────────┴────────┘ +``` + +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](#alter_manipulations-with-partitions) 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](#alter_attach-partition) query. + +Let’s break down the name of the first part: `201901_1_3_1`: + +- `201901` is the partition name. +- `1` is the minimum number of the data block. +- `3` is the maximum number of the data block. +- `1` is the chunk level (the depth of the merge tree it is formed from). + +!!! info "Info" + The parts of old-type tables have the name: `20190117_20190123_2_2_0` (minimum date - maximum date - minimum block number - maximum block number - level). + +The `active` column shows the status of the part. `1` is active; `0` is inactive. The inactive parts are, for example, source parts remaining after merging to a larger part. The corrupted data parts are also indicated as inactive. + +As you can see in the example, there are several separated parts of the same partition (for example, `201901_1_3_1` and `201901_1_9_2`). This means that these parts are not merged yet. ClickHouse merges the inserted parts of data periodically, approximately 15 minutes after inserting. In addition, you can perform a non-scheduled merge using the [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) query. Example: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 0 │ +│ 201902 │ 201902_4_11_2 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 0 │ +│ 201902 │ 201902_11_11_0 │ 0 │ +└───────────┴────────────────┴────────┘ +``` + +Inactive parts will be deleted approximately 10 minutes after merging. + +Another way to view a set of parts and partitions is to go into the directory of the table: `/var/lib/clickhouse/data///`. For example: + +``` bash +/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +The folders ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ and so on are the directories of the parts. Each part relates to a corresponding partition and contains data just for a certain month (the table in this example has partitioning by month). + +The `detached` directory contains parts that were detached from the table using the [DETACH](#alter_detach-partition) query. The corrupted parts are also moved to this directory, instead of being deleted. The server does not use the parts from the `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql-reference/statements/alter.md#alter_attach-partition) query. + +Note that on the operating server, you cannot manually change the set of parts or their data on the file system, since the server will not know about it. For non-replicated tables, you can do this when the server is stopped, but it isn’t recommended. For replicated tables, the set of parts cannot be changed in any case. + +ClickHouse allows you to perform operations with the partitions: delete them, copy from one table to another, or create a backup. See the list of all operations in the section [Manipulations With Partitions and Parts](../../../sql-reference/statements/alter.md#alter_manipulations-with-partitions). + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/en/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/en/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..009f98081ae --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,172 @@ +--- +toc_priority: 38 +toc_title: GraphiteMergeTree +--- + +# GraphiteMergeTree {#graphitemergetree} + +This engine is designed for thinning and aggregating/averaging (rollup) [Graphite](http://graphite.readthedocs.io/en/latest/index.html) data. It may be helpful to developers who want to use ClickHouse as a data store for Graphite. + +You can use any ClickHouse table engine to store the Graphite data if you don’t need rollup, but if you need a rollup use `GraphiteMergeTree`. The engine reduces the volume of storage and increases the efficiency of queries from Graphite. + +The engine inherits properties from [MergeTree](mergetree.md). + +## Creating a Table {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +See a detailed description of the [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) query. + +A table for the Graphite data should have the following columns for the following data: + +- Metric name (Graphite sensor). Data type: `String`. + +- Time of measuring the metric. Data type: `DateTime`. + +- Value of the metric. Data type: any numeric. + +- Version of the metric. Data type: any numeric. + + ClickHouse saves the rows with the highest version or the last written if versions are the same. Other rows are deleted during the merge of data parts. + +The names of these columns should be set in the rollup configuration. + +**GraphiteMergeTree parameters** + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +**Query clauses** + +When creating a `GraphiteMergeTree` table, the same [clauses](mergetree.md#table_engine-mergetree-creating-a-table) are required, as when creating a `MergeTree` table. + +
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects and, if possible, switch the old projects to the method described above. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +All of the parameters excepting `config_section` have the same meaning as in `MergeTree`. + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +
+ +## Rollup Configuration {#rollup-configuration} + +The settings for rollup are defined by the [graphite\_rollup](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) parameter in the server configuration. The name of the parameter could be any. You can create several configurations and use them for different tables. + +Rollup configuration structure: + + required-columns + patterns + +### Required Columns {#required-columns} + +- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. +- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. +- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Default value: `Value`. +- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. + +### Patterns {#patterns} + +Structure of the `patterns` section: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "Attention" + Patterns must be strictly ordered: + + 1. Patterns without `function` or `retention`. + 1. Patterns with both `function` and `retention`. + 1. Pattern `default`. + +When processing a row, ClickHouse checks the rules in the `pattern` sections. Each of `pattern` (including `default`) sections can contain `function` parameter for aggregation, `retention` parameters or both. If the metric name matches the `regexp`, the rules from the `pattern` section (or sections) are applied; otherwise, the rules from the `default` section are used. + +Fields for `pattern` and `default` sections: + +- `regexp`– A pattern for the metric name. +- `age` – The minimum age of the data in seconds. +- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). +- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. + +### Configuration Example {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/en/engines/table-engines/mergetree-family/index.md b/docs/en/engines/table-engines/mergetree-family/index.md new file mode 100644 index 00000000000..9e989d807da --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: MergeTree Family +toc_priority: 28 +--- + + diff --git a/docs/en/engines/table-engines/mergetree-family/mergetree.md b/docs/en/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..0802e4a8857 --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,652 @@ +--- +toc_priority: 30 +toc_title: MergeTree +--- + +# MergeTree {#table_engines-mergetree} + +The `MergeTree` engine and other engines of this family (`*MergeTree`) are the most robust ClickHouse table engines. + +Engines in the `MergeTree` family are designed for inserting a very large amount of data into a table. The data is quickly written to the table part by part, then rules are applied for merging the parts in the background. This method is much more efficient than continually rewriting the data in storage during insert. + +Main features: + +- Stores data sorted by primary key. + + This allows you to create a small sparse index that helps find data faster. + +- Partitions can be used if the [partitioning key](custom-partitioning-key.md) is specified. + + ClickHouse supports certain operations with partitions that are more effective than general operations on the same data with the same result. ClickHouse also automatically cuts off the partition data where the partitioning key is specified in the query. This also improves query performance. + +- Data replication support. + + The family of `ReplicatedMergeTree` tables provides data replication. For more information, see [Data replication](replication.md). + +- Data sampling support. + + If necessary, you can set the data sampling method in the table. + +!!! info "Info" + The [Merge](../special/merge.md) engine does not belong to the `*MergeTree` family. + +## Creating a Table {#table_engine-mergetree-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 +) ENGINE = MergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] +[SETTINGS name=value, ...] +``` + +For a description of parameters, see the [CREATE query description](../../../sql-reference/statements/create.md). + +!!! note "Note" + `INDEX` is an experimental feature, see [Data Skipping Indexes](#table_engine-mergetree-data_skipping-indexes). + +### Query Clauses {#mergetree-query-clauses} + +- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. The `MergeTree` engine does not have parameters. + +- `PARTITION BY` — The [partitioning key](custom-partitioning-key.md). + + For partitioning by month, use the `toYYYYMM(date_column)` expression, where `date_column` is a column with a date of the type [Date](../../../sql-reference/data-types/date.md). The partition names here have the `"YYYYMM"` format. + +- `ORDER BY` — The sorting key. + + A tuple of columns or arbitrary expressions. Example: `ORDER BY (CounterID, EventDate)`. + +- `PRIMARY KEY` — The primary key if it [differs from the sorting key](#choosing-a-primary-key-that-differs-from-the-sorting-key). + + By default the primary key is the same as the sorting key (which is specified by the `ORDER BY` clause). Thus in most cases it is unnecessary to specify a separate `PRIMARY KEY` clause. + +- `SAMPLE BY` — An expression for sampling. + + If a sampling expression is used, the primary key must contain it. Example: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. + +- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [between disks and volumes](#table_engine-mergetree-multiple-volumes). + + Expression must have one `Date` or `DateTime` column as a result. Example: + `TTL date + INTERVAL 1 DAY` + + Type of the rule `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` specifies an action to be done with the part if the expression is satisfied (reaches current time): removal of expired rows, moving a part (if expression is satisfied for all rows in a part) to specified disk (`TO DISK 'xxx'`) or to volume (`TO VOLUME 'xxx'`). Default type of the rule is removal (`DELETE`). List of multiple rules can specified, but there should be no more than one `DELETE` rule. + + For more details, see [TTL for columns and tables](#table_engine-mergetree-ttl) + +- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: + + - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Data Storage](#mergetree-data-storage). + - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Data Storage](#mergetree-data-storage). + - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` setting. Before version 19.11, there was only the `index_granularity` setting for restricting granule size. The `index_granularity_bytes` setting improves ClickHouse performance when selecting data from tables with big rows (tens and hundreds of megabytes). If you have tables with big rows, you can enable this setting for the tables to improve the efficiency of `SELECT` queries. + - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, then ZooKeeper stores less data. For more information, see the [setting description](../../../operations/server-configuration-parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) in “Server configuration parameters”. + - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` bytes, ClickHouse reads and writes the data to the storage disk using the direct I/O interface (`O_DIRECT` option). If `min_merge_bytes_to_use_direct_io = 0`, then direct I/O is disabled. Default value: `10 * 1024 * 1024 * 1024` bytes. + + - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). + - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don’t turn it off. + - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. + - `storage_policy` — Storage policy. See [Using Multiple Block Devices for Data Storage](#table_engine-mergetree-multiple-volumes). + +**Example of Sections Setting** + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 +``` + +In the example, we set partitioning by month. + +We also set an expression for sampling as a hash by the user ID. This allows you to pseudorandomize the data in the table for each `CounterID` and `EventDate`. If you define a [SAMPLE](../../../sql-reference/statements/select.md#select-sample-clause) clause when selecting the data, ClickHouse will return an evenly pseudorandom data sample for a subset of users. + +The `index_granularity` setting can be omitted because 8192 is the default value. + +
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects. If possible, switch old projects to the method described above. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +**MergeTree() Parameters** + +- `date-column` — The name of a column of the [Date](../../../sql-reference/data-types/date.md) type. ClickHouse automatically creates partitions by month based on this column. The partition names are in the `"YYYYMM"` format. +- `sampling_expression` — An expression for sampling. +- `(primary, key)` — Primary key. Type: [Tuple()](../../../sql-reference/data-types/tuple.md) +- `index_granularity` — The granularity of an index. The number of data rows between the “marks” of an index. The value 8192 is appropriate for most tasks. + +**Example** + +``` sql +MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) +``` + +The `MergeTree` engine is configured in the same way as in the example above for the main engine configuration method. +
+ +## Data Storage {#mergetree-data-storage} + +A table consists of data parts sorted by primary key. + +When data is inserted in a table, separate data parts are created and each of them is lexicographically sorted by primary key. For example, if the primary key is `(CounterID, Date)`, the data in the part is sorted by `CounterID`, and within each `CounterID`, it is ordered by `Date`. + +Data belonging to different partitions are separated into different parts. In the background, ClickHouse merges data parts for more efficient storage. Parts belonging to different partitions are not merged. The merge mechanism does not guarantee that all rows with the same primary key will be in the same data part. + +Each data part is logically divided into granules. A granule is the smallest indivisible data set that ClickHouse reads when selecting data. ClickHouse doesn’t split rows or values, so each granule always contains an integer number of rows. The first row of a granule is marked with the value of the primary key for the row. For each data part, ClickHouse creates an index file that stores the marks. For each column, whether it’s in the primary key or not, ClickHouse also stores the same marks. These marks let you find data directly in column files. + +The granule size is restricted by the `index_granularity` and `index_granularity_bytes` settings of the table engine. The number of rows in a granule lays in the `[1, index_granularity]` range, depending on the size of the rows. The size of a granule can exceed `index_granularity_bytes` if the size of a single row is greater than the value of the setting. In this case, the size of the granule equals the size of the row. + +## Primary Keys and Indexes in Queries {#primary-keys-and-indexes-in-queries} + +Take the `(CounterID, Date)` primary key as an example. In this case, the sorting and index can be illustrated as follows: + + Whole data: [---------------------------------------------] + CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] + Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] + Marks: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 + Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 + +If the data query specifies: + +- `CounterID in ('a', 'h')`, the server reads the data in the ranges of marks `[0, 3)` and `[6, 8)`. +- `CounterID IN ('a', 'h') AND Date = 3`, the server reads the data in the ranges of marks `[1, 3)` and `[7, 8)`. +- `Date = 3`, the server reads the data in the range of marks `[1, 10]`. + +The examples above show that it is always more effective to use an index than a full scan. + +A sparse index allows extra data to be read. When reading a single range of the primary key, up to `index_granularity * 2` extra rows in each data block can be read. + +Sparse indexes allow you to work with a very large number of table rows, because in most cases, such indexes fit in the computer’s RAM. + +ClickHouse does not require a unique primary key. You can insert multiple rows with the same primary key. + +### Selecting the Primary Key {#selecting-the-primary-key} + +The number of columns in the primary key is not explicitly limited. Depending on the data structure, you can include more or fewer columns in the primary key. This may: + +- Improve the performance of an index. + + If the primary key is `(a, b)`, then adding another column `c` will improve the performance if the following conditions are met: + + - There are queries with a condition on column `c`. + - Long data ranges (several times longer than the `index_granularity`) with identical values for `(a, b)` are common. In other words, when adding another column allows you to skip quite long data ranges. + +- Improve data compression. + + ClickHouse sorts data by primary key, so the higher the consistency, the better the compression. + +- Provide additional logic when merging data parts in the [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) and [SummingMergeTree](summingmergetree.md) engines. + + In this case it makes sense to specify the *sorting key* that is different from the primary key. + +A long primary key will negatively affect the insert performance and memory consumption, but extra columns in the primary key do not affect ClickHouse performance during `SELECT` queries. + +### Choosing a Primary Key that Differs from the Sorting Key {#choosing-a-primary-key-that-differs-from-the-sorting-key} + +It is possible to specify a primary key (an expression with values that are written in the index file for each mark) that is different from the sorting key (an expression for sorting the rows in data parts). In this case the primary key expression tuple must be a prefix of the sorting key expression tuple. + +This feature is helpful when using the [SummingMergeTree](summingmergetree.md) and +[AggregatingMergeTree](aggregatingmergetree.md) table engines. In a common case when using these engines, the table has two types of columns: *dimensions* and *measures*. Typical queries aggregate values of measure columns with arbitrary `GROUP BY` and filtering by dimensions. Because SummingMergeTree and AggregatingMergeTree aggregate rows with the same value of the sorting key, it is natural to add all dimensions to it. As a result, the key expression consists of a long list of columns and this list must be frequently updated with newly added dimensions. + +In this case it makes sense to leave only a few columns in the primary key that will provide efficient range scans and add the remaining dimension columns to the sorting key tuple. + +[ALTER](../../../sql-reference/statements/alter.md) of the sorting key is a lightweight operation because when a new column is simultaneously added to the table and to the sorting key, existing data parts don’t need to be changed. Since the old sorting key is a prefix of the new sorting key and there is no data in the newly added column, the data is sorted by both the old and new sorting keys at the moment of table modification. + +### Use of Indexes and Partitions in Queries {#use-of-indexes-and-partitions-in-queries} + +For `SELECT` queries, ClickHouse analyzes whether an index can be used. An index can be used if the `WHERE/PREWHERE` clause has an expression (as one of the conjunction elements, or entirely) that represents an equality or inequality comparison operation, or if it has `IN` or `LIKE` with a fixed prefix on columns or expressions that are in the primary key or partitioning key, or on certain partially repetitive functions of these columns, or logical relationships of these expressions. + +Thus, it is possible to quickly run queries on one or many ranges of the primary key. In this example, queries will be fast when run for a specific tracking tag, for a specific tag and date range, for a specific tag and date, for multiple tags with a date range, and so on. + +Let’s look at the engine configured as follows: + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 + +In this case, in queries: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +ClickHouse will use the primary key index to trim improper data and the monthly partitioning key to trim partitions that are in improper date ranges. + +The queries above show that the index is used even for complex expressions. Reading from the table is organized so that using the index can’t be slower than a full scan. + +In the example below, the index can’t be used. + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +To check whether ClickHouse can use the index when running a query, use the settings [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) and [force\_primary\_key](../../../operations/settings/settings.md). + +The key for partitioning by month allows reading only those data blocks which contain dates from the proper range. In this case, the data block may contain data for many dates (up to an entire month). Within a block, data is sorted by primary key, which might not contain the date as the first column. Because of this, using a query with only a date condition that does not specify the primary key prefix will cause more data to be read than for a single date. + +### Use of Index for Partially-monotonic Primary Keys {#use-of-index-for-partially-monotonic-primary-keys} + +Consider, for example, the days of the month. They form a [monotonic sequence](https://en.wikipedia.org/wiki/Monotonic_function) for one month, but not monotonic for more extended periods. This is a partially-monotonic sequence. If a user creates the table with partially-monotonic primary key, ClickHouse creates a sparse index as usual. When a user selects data from this kind of table, ClickHouse analyzes the query conditions. If the user wants to get data between two marks of the index and both these marks fall within one month, ClickHouse can use the index in this particular case because it can calculate the distance between the parameters of a query and index marks. + +ClickHouse cannot use an index if the values of the primary key in the query parameter range don’t represent a monotonic sequence. In this case, ClickHouse uses the full scan method. + +ClickHouse uses this logic not only for days of the month sequences, but for any primary key that represents a partially-monotonic sequence. + +### Data Skipping Indexes (experimental) {#table_engine-mergetree-data_skipping-indexes} + +The index declaration is in the columns section of the `CREATE` query. + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +For tables from the `*MergeTree` family, data skipping indices can be specified. + +These indices aggregate some information about the specified expression on blocks, which consist of `granularity_value` granules (the size of the granule is specified using the `index_granularity` setting in the table engine). Then these aggregates are used in `SELECT` queries for reducing the amount of data to read from the disk by skipping big blocks of data where the `where` query cannot be satisfied. + +**Example** + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +Indices from the example can be used by ClickHouse to reduce the amount of data to read from disk in the following queries: + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### Available Types of Indices {#available-types-of-indices} + +- `minmax` + + Stores extremes of the specified expression (if the expression is `tuple`, then it stores extremes for each element of `tuple`), uses stored info for skipping blocks of data like the primary key. + +- `set(max_rows)` + + Stores unique values of the specified expression (no more than `max_rows` rows, `max_rows=0` means “no limits”). Uses the values to check if the `WHERE` expression is not satisfiable on a block of data. + +- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + Stores a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) that contains all ngrams from a block of data. Works only with strings. Can be used for optimization of `equals`, `like` and `in` expressions. + + - `n` — ngram size, + - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). + - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. + - `random_seed` — The seed for Bloom filter hash functions. + +- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + The same as `ngrambf_v1`, but stores tokens instead of ngrams. Tokens are sequences separated by non-alphanumeric characters. + +- `bloom_filter([false_positive])` — Stores a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) for the specified columns. + + The optional `false_positive` parameter is the probability of receiving a false positive response from the filter. Possible values: (0, 1). Default value: 0.025. + + Supported data types: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. + + The following functions can use it: [equals](../../../sql-reference/functions/comparison-functions.md), [notEquals](../../../sql-reference/functions/comparison-functions.md), [in](../../../sql-reference/functions/in-functions.md), [notIn](../../../sql-reference/functions/in-functions.md), [has](../../../sql-reference/functions/array-functions.md). + + + +``` sql +INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 +INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 +``` + +#### Functions Support {#functions-support} + +Conditions in the `WHERE` clause contains calls of the functions that operate with columns. If the column is a part of an index, ClickHouse tries to use this index when performing the functions. ClickHouse supports different subsets of functions for using indexes. + +The `set` index can be used with all functions. Function subsets for other indexes are shown in the table below. + +| Function (operator) / Index | primary key | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | +|------------------------------------------------------------------------------------------------------------|-------------|--------|-------------|-------------|---------------| +| [equals (=, ==)](../../../sql-reference/functions/comparison-functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notEquals(!=, \<\>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [like](../../../sql-reference/functions/string-search-functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [notLike](../../../sql-reference/functions/string-search-functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [startsWith](../../../sql-reference/functions/string-functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [endsWith](../../../sql-reference/functions/string-functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [multiSearchAny](../../../sql-reference/functions/string-search-functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | +| [in](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notIn](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [less (\<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [greater (\>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [lessOrEquals (\<=)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [greaterOrEquals (\>=)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [empty](../../../sql-reference/functions/array-functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [notEmpty](../../../sql-reference/functions/array-functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | + +Functions with a constant argument that is less than ngram size can’t be used by `ngrambf_v1` for query optimization. + +Bloom filters can have false positive matches, so the `ngrambf_v1`, `tokenbf_v1`, and `bloom_filter` indexes can’t be used for optimizing queries where the result of a function is expected to be false, for example: + +- Can be optimized: + - `s LIKE '%test%'` + - `NOT s NOT LIKE '%test%'` + - `s = 1` + - `NOT s != 1` + - `startsWith(s, 'test')` +- Can’t be optimized: + - `NOT s LIKE '%test%'` + - `s NOT LIKE '%test%'` + - `NOT s = 1` + - `s != 1` + - `NOT startsWith(s, 'test')` + +## Concurrent Data Access {#concurrent-data-access} + +For concurrent table access, we use multi-versioning. In other words, when a table is simultaneously read and updated, data is read from a set of parts that is current at the time of the query. There are no lengthy locks. Inserts do not get in the way of read operations. + +Reading from a table is automatically parallelized. + +## TTL for Columns and Tables {#table_engine-mergetree-ttl} + +Determines the lifetime of values. + +The `TTL` clause can be set for the whole table and for each individual column. Table-level TTL can also specify logic of automatic move of data between disks and volumes. + +Expressions must evaluate to [Date](../../../sql-reference/data-types/date.md) or [DateTime](../../../sql-reference/data-types/datetime.md) data type. + +Example: + +``` sql +TTL time_column +TTL time_column + interval +``` + +To define `interval`, use [time interval](../../../sql-reference/operators.md#operators-datetime) operators. + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### Column TTL {#mergetree-column-ttl} + +When the values in the column expire, ClickHouse replaces them with the default values for the column data type. If all the column values in the data part expire, ClickHouse deletes this column from the data part in a filesystem. + +The `TTL` clause can’t be used for key columns. + +Examples: + +Creating a table with TTL + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +Adding TTL to a column of an existing table + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +Altering TTL of the column + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### Table TTL {#mergetree-table-ttl} + +Table can have an expression for removal of expired rows, and multiple expressions for automatic move of parts between [disks or volumes](#table_engine-mergetree-multiple-volumes). When rows in the table expire, ClickHouse deletes all corresponding rows. For parts moving feature, all rows of a part must satisfy the movement expression criteria. + +``` sql +TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... +``` + +Type of TTL rule may follow each TTL expression. It affects an action which is to be done once the expression is satisfied (reaches current time): + +- `DELETE` - delete expired rows (default action); +- `TO DISK 'aaa'` - move part to the disk `aaa`; +- `TO VOLUME 'bbb'` - move part to the disk `bbb`. + +Examples: + +Creating a table with TTL + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH [DELETE], + d + INTERVAL 1 WEEK TO VOLUME 'aaa', + d + INTERVAL 2 WEEK TO DISK 'bbb'; +``` + +Altering TTL of the table + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**Removing Data** + +Data with an expired TTL is removed when ClickHouse merges data parts. + +When ClickHouse see that data is expired, it performs an off-schedule merge. To control the frequency of such merges, you can set [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). If the value is too low, it will perform many off-schedule merges that may consume a lot of resources. + +If you perform the `SELECT` query between merges, you may get expired data. To avoid it, use the [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) query before `SELECT`. + +## Using Multiple Block Devices for Data Storage {#table_engine-mergetree-multiple-volumes} + +### Introduction {#introduction} + +`MergeTree` family table engines can store data on multiple block devices. For example, it can be useful when the data of a certain table are implicitly split into “hot” and “cold”. The most recent data is regularly requested but requires only a small amount of space. On the contrary, the fat-tailed historical data is requested rarely. If several disks are available, the “hot” data may be located on fast disks (for example, NVMe SSDs or in memory), while the “cold” data - on relatively slow ones (for example, HDD). + +Data part is the minimum movable unit for `MergeTree`-engine tables. The data belonging to one part are stored on one disk. Data parts can be moved between disks in the background (according to user settings) as well as by means of the [ALTER](../../../sql-reference/statements/alter.md#alter_move-partition) queries. + +### Terms {#terms} + +- Disk — Block device mounted to the filesystem. +- Default disk — Disk that stores the path specified in the [path](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) server setting. +- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). +- Storage policy — Set of volumes and the rules for moving data between them. + +The names given to the described entities can be found in the system tables, [system.storage\_policies](../../../operations/system-tables.md#system_tables-storage_policies) and [system.disks](../../../operations/system-tables.md#system_tables-disks). To apply one of the configured storage policies for a table, use the `storage_policy` setting of `MergeTree`-engine family tables. + +### Configuration {#table_engine-mergetree-multiple-volumes-configure} + +Disks, volumes and storage policies should be declared inside the `` tag either in the main file `config.xml` or in a distinct file in the `config.d` directory. + +Configuration structure: + +``` xml + + + + /mnt/fast_ssd/clickhouse/ + + + /mnt/hdd1/clickhouse/ + 10485760 + + + /mnt/hdd2/clickhouse/ + 10485760 + + + ... + + + ... + +``` + +Tags: + +- `` — Disk name. Names must be different for all disks. +- `path` — path under which a server will store data (`data` and `shadow` folders), should be terminated with ‘/’. +- `keep_free_space_bytes` — the amount of free disk space to be reserved. + +The order of the disk definition is not important. + +Storage policies configuration markup: + +``` xml + + ... + + + + + disk_name_from_disks_configuration + 1073741824 + + + + + + + 0.2 + + + + + + + + ... + +``` + +Tags: + +- `policy_name_N` — Policy name. Policy names must be unique. +- `volume_name_N` — Volume name. Volume names must be unique. +- `disk` — a disk within a volume. +- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. +- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). + +Cofiguration examples: + +``` xml + + ... + + + + + disk1 + disk2 + + + + + + + + fast_ssd + 1073741824 + + + disk1 + + + 0.2 + + + ... + +``` + +In given example, the `hdd_in_order` policy implements the [round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) approach. Thus this policy defines only one volume (`single`), the data parts are stored on all its disks in circular order. Such policy can be quite useful if there are several similar disks are mounted to the system, but RAID is not configured. Keep in mind that each individual disk drive is not reliable and you might want to compensate it with replication factor of 3 or more. + +If there are different kinds of disks available in the system, `moving_from_ssd_to_hdd` policy can be used instead. The volume `hot` consists of an SSD disk (`fast_ssd`), and the maximum size of a part that can be stored on this volume is 1GB. All the parts with the size larger than 1GB will be stored directly on the `cold` volume, which contains an HDD disk `disk1`. +Also, once the disk `fast_ssd` gets filled by more than 80%, data will be transferred to the `disk1` by a background process. + +The order of volume enumeration within a storage policy is important. Once a volume is overfilled, data are moved to the next one. The order of disk enumeration is important as well because data are stored on them in turns. + +When creating a table, one can apply one of the configured storage policies to it: + +``` sql +CREATE TABLE table_with_non_default_policy ( + EventDate Date, + OrderID UInt64, + BannerID UInt64, + SearchPhrase String +) ENGINE = MergeTree +ORDER BY (OrderID, BannerID) +PARTITION BY toYYYYMM(EventDate) +SETTINGS storage_policy = 'moving_from_ssd_to_hdd' +``` + +The `default` storage policy implies using only one volume, which consists of only one disk given in ``. Once a table is created, its storage policy cannot be changed. + +### Details {#details} + +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](../../../sql-reference/statements/alter.md#alter-mutations). +- When downloading from another replica. +- As a result of partition freezing [ALTER TABLE … FREEZE PARTITION](../../../sql-reference/statements/alter.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: + +1. The first volume (in the order of definition) that has enough disk space for storing a part (`unreserved_space > current_part_size`) and allows for storing parts of a given size (`max_data_part_size_bytes > current_part_size`) is chosen. +2. Within this volume, that disk is chosen that follows the one, which was used for storing the previous chunk of data, and that has free space more than the part size (`unreserved_space - keep_free_space_bytes > current_part_size`). + +Under the hood, mutations and partition freezing make use of [hard links](https://en.wikipedia.org/wiki/Hard_link). Hard links between different disks are not supported, therefore in such cases the resulting parts are stored on the same disks as the initial ones. + +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](../../../operations/system-tables.md#system_tables-part-log) (field `type = MOVE_PART`) and [system.parts](../../../operations/system-tables.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 …](../../../sql-reference/statements/alter.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. + +After the completion of background merges and mutations, old parts are removed only after a certain amount of time (`old_parts_lifetime`). +During this time, they are not moved to other volumes or disks. Therefore, until the parts are finally removed, they are still taken into account for evaluation of the occupied disk space. + +[Original article](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/en/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/en/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..6ca8be1912e --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,67 @@ +--- +toc_priority: 33 +toc_title: ReplacingMergeTree +--- + +# ReplacingMergeTree {#replacingmergetree} + +The engine differs from [MergeTree](mergetree.md#table_engines-mergetree) in that it removes duplicate entries with the same primary key value (or more accurately, with the same [sorting key](mergetree.md) value). + +Data deduplication occurs only during a merge. Merging occurs in the background at an unknown time, so you can’t plan for it. Some of the data may remain unprocessed. Although you can run an unscheduled merge using the `OPTIMIZE` query, don’t count on using it, because the `OPTIMIZE` query will read and write a large amount of data. + +Thus, `ReplacingMergeTree` is suitable for clearing out duplicate data in the background in order to save space, but it doesn’t guarantee the absence of duplicates. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +For a description of request parameters, see [request description](../../../sql-reference/statements/create.md). + +**ReplacingMergeTree Parameters** + +- `ver` — column with version. Type `UInt*`, `Date` or `DateTime`. Optional parameter. + + When merging, `ReplacingMergeTree` from all the rows with the same primary key leaves only one: + + - Last in the selection, if `ver` not set. + - With the maximum version, if `ver` specified. + +**Query clauses** + +When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md) are required, as when creating a `MergeTree` table. + +
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects and, if possible, switch the old projects to the method described above. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +All of the parameters excepting `ver` have the same meaning as in `MergeTree`. + +- `ver` - column with the version. Optional parameter. For a description, see the text above. + +
+ +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/en/engines/table-engines/mergetree-family/replication.md b/docs/en/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..dd83fb61f2b --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,216 @@ +--- +toc_priority: 31 +toc_title: Data Replication +--- + +# Data Replication {#table_engines-replication} + +Replication is only supported for tables in the MergeTree family: + +- ReplicatedMergeTree +- ReplicatedSummingMergeTree +- ReplicatedReplacingMergeTree +- ReplicatedAggregatingMergeTree +- ReplicatedCollapsingMergeTree +- ReplicatedVersionedCollapsingMergeTree +- ReplicatedGraphiteMergeTree + +Replication works at the level of an individual table, not the entire server. A server can store both replicated and non-replicated tables at the same time. + +Replication does not depend on sharding. Each shard has its own independent replication. + +Compressed data for `INSERT` and `ALTER` queries is replicated (for more information, see the documentation for [ALTER](../../../sql-reference/statements/alter.md#query_language_queries_alter)). + +`CREATE`, `DROP`, `ATTACH`, `DETACH` and `RENAME` queries are executed on a single server and are not replicated: + +- The `CREATE TABLE` query creates a new replicatable table on the server where the query is run. If this table already exists on other servers, it adds a new replica. +- The `DROP TABLE` query deletes the replica located on the server where the query is run. +- The `RENAME` query renames the table on one of the replicas. In other words, replicated tables can have different names on different replicas. + +ClickHouse uses [Apache ZooKeeper](https://zookeeper.apache.org) for storing replicas meta information. Use ZooKeeper version 3.4.5 or newer. + +To use replication, set parameters in the [zookeeper](../../../operations/server-configuration-parameters/settings.md#server-settings_zookeeper) server configuration section. + +!!! attention "Attention" + Don’t neglect the security setting. ClickHouse supports the `digest` [ACL scheme](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) of the ZooKeeper security subsystem. + +Example of setting the addresses of the ZooKeeper cluster: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +You can specify any existing ZooKeeper cluster and the system will use a directory on it for its own data (the directory is specified when creating a replicatable table). + +If ZooKeeper isn’t set in the config file, you can’t create replicated tables, and any existing replicated tables will be read-only. + +ZooKeeper is not used in `SELECT` queries because replication does not affect the performance of `SELECT` and queries run just as fast as they do for non-replicated tables. When querying distributed replicated tables, ClickHouse behavior is controlled by the settings [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) and [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). + +For each `INSERT` query, approximately ten entries are added to ZooKeeper through several transactions. (To be more precise, this is for each inserted block of data; an INSERT query contains one block or one block per `max_insert_block_size = 1048576` rows.) This leads to slightly longer latencies for `INSERT` compared to non-replicated tables. But if you follow the recommendations to insert data in batches of no more than one `INSERT` per second, it doesn’t create any problems. The entire ClickHouse cluster used for coordinating one ZooKeeper cluster has a total of several hundred `INSERTs` per second. The throughput on data inserts (the number of rows per second) is just as high as for non-replicated data. + +For very large clusters, you can use different ZooKeeper clusters for different shards. However, this hasn’t proven necessary on the Yandex.Metrica cluster (approximately 300 servers). + +Replication is asynchronous and multi-master. `INSERT` queries (as well as `ALTER`) can be sent to any available server. Data is inserted on the server where the query is run, and then it is copied to the other servers. Because it is asynchronous, recently inserted data appears on the other replicas with some latency. If part of the replicas are not available, the data is written when they become available. If a replica is available, the latency is the amount of time it takes to transfer the block of compressed data over the network. + +By default, an INSERT query waits for confirmation of writing the data from only one replica. If the data was successfully written to only one replica and the server with this replica ceases to exist, the stored data will be lost. To enable getting confirmation of data writes from multiple replicas, use the `insert_quorum` option. + +Each block of data is written atomically. The INSERT query is divided into blocks up to `max_insert_block_size = 1048576` rows. In other words, if the `INSERT` query has less than 1048576 rows, it is made atomically. + +Data blocks are deduplicated. For multiple writes of the same data block (data blocks of the same size containing the same rows in the same order), the block is only written once. The reason for this is in case of network failures when the client application doesn’t know if the data was written to the DB, so the `INSERT` query can simply be repeated. It doesn’t matter which replica INSERTs were sent to with identical data. `INSERTs` are idempotent. Deduplication parameters are controlled by [merge\_tree](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-merge_tree) server settings. + +During replication, only the source data to insert is transferred over the network. Further data transformation (merging) is coordinated and performed on all the replicas in the same way. This minimizes network usage, which means that replication works well when replicas reside in different datacenters. (Note that duplicating data in different datacenters is the main goal of replication.) + +You can have any number of replicas of the same data. Yandex.Metrica uses double replication in production. Each server uses RAID-5 or RAID-6, and RAID-10 in some cases. This is a relatively reliable and convenient solution. + +The system monitors data synchronicity on replicas and is able to recover after a failure. Failover is automatic (for small differences in data) or semi-automatic (when data differs too much, which may indicate a configuration error). + +## Creating Replicated Tables {#creating-replicated-tables} + +The `Replicated` prefix is added to the table engine name. For example:`ReplicatedMergeTree`. + +**Replicated\*MergeTree parameters** + +- `zoo_path` — The path to the table in ZooKeeper. +- `replica_name` — The replica name in ZooKeeper. + +Example: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +
+ +Example in deprecated syntax + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +
+ +As the example shows, these parameters can contain substitutions in curly brackets. The substituted values are taken from the ‘macros’ section of the configuration file. Example: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +The path to the table in ZooKeeper should be unique for each replicated table. Tables on different shards should have different paths. +In this case, the path consists of the following parts: + +`/clickhouse/tables/` is the common prefix. We recommend using exactly this one. + +`{layer}-{shard}` is the shard identifier. In this example it consists of two parts, since the Yandex.Metrica cluster uses bi-level sharding. For most tasks, you can leave just the {shard} substitution, which will be expanded to the shard identifier. + +`table_name` is the name of the node for the table in ZooKeeper. It is a good idea to make it the same as the table name. It is defined explicitly, because in contrast to the table name, it doesn’t change after a RENAME query. +*HINT*: you could add a database name in front of `table_name` as well. E.g. `db_name.table_name` + +The replica name identifies different replicas of the same table. You can use the server name for this, as in the example. The name only needs to be unique within each shard. + +You can define the parameters explicitly instead of using substitutions. This might be convenient for testing and for configuring small clusters. However, you can’t use distributed DDL queries (`ON CLUSTER`) in this case. + +When working with large clusters, we recommend using substitutions because they reduce the probability of error. + +Run the `CREATE TABLE` query on each replica. This query creates a new replicated table, or adds a new replica to an existing one. + +If you add a new replica after the table already contains some data on other replicas, the data will be copied from the other replicas to the new one after running the query. In other words, the new replica syncs itself with the others. + +To delete a replica, run `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. + +## Recovery After Failures {#recovery-after-failures} + +If ZooKeeper is unavailable when a server starts, replicated tables switch to read-only mode. The system periodically attempts to connect to ZooKeeper. + +If ZooKeeper is unavailable during an `INSERT`, or an error occurs when interacting with ZooKeeper, an exception is thrown. + +After connecting to ZooKeeper, the system checks whether the set of data in the local file system matches the expected set of data (ZooKeeper stores this information). If there are minor inconsistencies, the system resolves them by syncing data with the replicas. + +If the system detects broken data parts (with the wrong size of files) or unrecognized parts (parts written to the file system but not recorded in ZooKeeper), it moves them to the `detached` subdirectory (they are not deleted). Any missing parts are copied from the replicas. + +Note that ClickHouse does not perform any destructive actions such as automatically deleting a large amount of data. + +When the server starts (or establishes a new session with ZooKeeper), it only checks the quantity and sizes of all files. If the file sizes match but bytes have been changed somewhere in the middle, this is not detected immediately, but only when attempting to read the data for a `SELECT` query. The query throws an exception about a non-matching checksum or size of a compressed block. In this case, data parts are added to the verification queue and copied from the replicas if necessary. + +If the local set of data differs too much from the expected one, a safety mechanism is triggered. The server enters this in the log and refuses to launch. The reason for this is that this case may indicate a configuration error, such as if a replica on a shard was accidentally configured like a replica on a different shard. However, the thresholds for this mechanism are set fairly low, and this situation might occur during normal failure recovery. In this case, data is restored semi-automatically - by “pushing a button”. + +To start recovery, create the node `/path_to_table/replica_name/flags/force_restore_data` in ZooKeeper with any content, or run the command to restore all replicated tables: + +``` bash +sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +Then restart the server. On start, the server deletes these flags and starts recovery. + +## Recovery After Complete Data Loss {#recovery-after-complete-data-loss} + +If all data and metadata disappeared from one of the servers, follow these steps for recovery: + +1. Install ClickHouse on the server. Define substitutions correctly in the config file that contains the shard identifier and replicas, if you use them. +2. If you had unreplicated tables that must be manually duplicated on the servers, copy their data from a replica (in the directory `/var/lib/clickhouse/data/db_name/table_name/`). +3. Copy table definitions located in `/var/lib/clickhouse/metadata/` from a replica. If a shard or replica identifier is defined explicitly in the table definitions, correct it so that it corresponds to this replica. (Alternatively, start the server and make all the `ATTACH TABLE` queries that should have been in the .sql files in `/var/lib/clickhouse/metadata/`.) +4. To start recovery, create the ZooKeeper node `/path_to_table/replica_name/flags/force_restore_data` with any content, or run the command to restore all replicated tables: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +Then start the server (restart, if it is already running). Data will be downloaded from replicas. + +An alternative recovery option is to delete information about the lost replica from ZooKeeper (`/path_to_table/replica_name`), then create the replica again as described in “[Creating replicated tables](#creating-replicated-tables)”. + +There is no restriction on network bandwidth during recovery. Keep this in mind if you are restoring many replicas at once. + +## Converting from MergeTree to ReplicatedMergeTree {#converting-from-mergetree-to-replicatedmergetree} + +We use the term `MergeTree` to refer to all table engines in the `MergeTree family`, the same as for `ReplicatedMergeTree`. + +If you had a `MergeTree` table that was manually replicated, you can convert it to a replicated table. You might need to do this if you have already collected a large amount of data in a `MergeTree` table and now you want to enable replication. + +If the data differs on various replicas, first sync it, or delete this data on all the replicas except one. + +Rename the existing MergeTree table, then create a `ReplicatedMergeTree` table with the old name. +Move the data from the old table to the `detached` subdirectory inside the directory with the new table data (`/var/lib/clickhouse/data/db_name/table_name/`). +Then run `ALTER TABLE ATTACH PARTITION` on one of the replicas to add these data parts to the working set. + +## Converting from ReplicatedMergeTree to MergeTree {#converting-from-replicatedmergetree-to-mergetree} + +Create a MergeTree table with a different name. Move all the data from the directory with the `ReplicatedMergeTree` table data to the new table’s data directory. Then delete the `ReplicatedMergeTree` table and restart the server. + +If you want to get rid of a `ReplicatedMergeTree` table without launching the server: + +- Delete the corresponding `.sql` file in the metadata directory (`/var/lib/clickhouse/metadata/`). +- Delete the corresponding path in ZooKeeper (`/path_to_table/replica_name`). + +After this, you can launch the server, create a `MergeTree` table, move the data to its directory, and then restart the server. + +## Recovery When Metadata in the Zookeeper Cluster Is Lost or Damaged {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} + +If the data in ZooKeeper was lost or damaged, you can save data by moving it to an unreplicated table as described above. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/en/engines/table-engines/mergetree-family/summingmergetree.md b/docs/en/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..53c76044051 --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,139 @@ +--- +toc_priority: 34 +toc_title: SummingMergeTree +--- + +# SummingMergeTree {#summingmergetree} + +The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree). The difference is that when merging data parts for `SummingMergeTree` tables ClickHouse replaces all the rows with the same primary key (or more accurately, with the same [sorting key](mergetree.md)) with one row which contains summarized values for the columns with the numeric data type. If the sorting key is composed in a way that a single key value corresponds to large number of rows, this significantly reduces storage volume and speeds up data selection. + +We recommend to use the engine together with `MergeTree`. Store complete data in `MergeTree` table, and use `SummingMergeTree` for aggregated data storing, for example, when preparing reports. Such an approach will prevent you from losing valuable data due to an incorrectly composed primary key. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = SummingMergeTree([columns]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +For a description of request parameters, see [request description](../../../sql-reference/statements/create.md). + +**Parameters of SummingMergeTree** + +- `columns` - a tuple with the names of columns where values will be summarized. Optional parameter. + The columns must be of a numeric type and must not be in the primary key. + + If `columns` not specified, ClickHouse summarizes the values in all columns with a numeric data type that are not in the primary key. + +**Query clauses** + +When creating a `SummingMergeTree` table the same [clauses](mergetree.md) are required, as when creating a `MergeTree` table. + +
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects and, if possible, switch the old projects to the method described above. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) +``` + +All of the parameters excepting `columns` have the same meaning as in `MergeTree`. + +- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. + +
+ +## Usage Example {#usage-example} + +Consider the following table: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +Insert data to it: + +``` sql +INSERT INTO summtt Values(1,1),(1,2),(2,1) +``` + +ClickHouse may sum all the rows not completely ([see below](#data-processing)), so we use an aggregate function `sum` and `GROUP BY` clause in the query. + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + +``` text +┌─key─┬─sum(value)─┐ +│ 2 │ 1 │ +│ 1 │ 3 │ +└─────┴────────────┘ +``` + +## Data Processing {#data-processing} + +When data are inserted into a table, they are saved as-is. ClickHouse merges the inserted parts of data periodically and this is when rows with the same primary key are summed and replaced with one for each resulting part of data. + +ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) an aggregate function [sum()](../../../sql-reference/aggregate-functions/reference.md#agg_function-sum) and `GROUP BY` clause should be used in a query as described in the example above. + +### Common Rules for Summation {#common-rules-for-summation} + +The values in the columns with the numeric data type are summarized. The set of columns is defined by the parameter `columns`. + +If the values were 0 in all of the columns for summation, the row is deleted. + +If column is not in the primary key and is not summarized, an arbitrary value is selected from the existing ones. + +The values are not summarized for columns in the primary key. + +### The Summation in the Aggregatefunction Columns {#the-summation-in-the-aggregatefunction-columns} + +For columns of [AggregateFunction type](../../../sql-reference/data-types/aggregatefunction.md) ClickHouse behaves as [AggregatingMergeTree](aggregatingmergetree.md) engine aggregating according to the function. + +### Nested Structures {#nested-structures} + +Table can have nested data structures that are processed in a special way. + +If the name of a nested table ends with `Map` and it contains at least two columns that meet the following criteria: + +- the first column is numeric `(*Int*, Date, DateTime)` or a string `(String, FixedString)`, let’s call it `key`, +- the other columns are arithmetic `(*Int*, Float32/64)`, let’s call it `(values...)`, + +then this nested table is interpreted as a mapping of `key => (values...)`, and when merging its rows, the elements of two data sets are merged by `key` with a summation of the corresponding `(values...)`. + +Examples: + +``` text +[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] +[(1, 100)] + [(1, 150)] -> [(1, 250)] +[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] +[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] +``` + +When requesting data, use the [sumMap(key, value)](../../../sql-reference/aggregate-functions/reference.md) function for aggregation of `Map`. + +For nested data structure, you do not need to specify its columns in the tuple of columns for summation. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/en/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/en/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..cc717c77a7a --- /dev/null +++ b/docs/en/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,236 @@ +--- +toc_priority: 37 +toc_title: VersionedCollapsingMergeTree +--- + +# VersionedCollapsingMergeTree {#versionedcollapsingmergetree} + +This engine: + +- Allows quick writing of object states that are continually changing. +- Deletes old object states in the background. This significantly reduces the volume of storage. + +See the section [Collapsing](#table_engines_versionedcollapsingmergetree) for details. + +The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree) and adds the logic for collapsing rows to the algorithm for merging data parts. `VersionedCollapsingMergeTree` serves the same purpose as [CollapsingMergeTree](collapsingmergetree.md) but uses a different collapsing algorithm that allows inserting the data in any order with multiple threads. In particular, the `Version` column helps to collapse the rows properly even if they are inserted in the wrong order. In contrast, `CollapsingMergeTree` allows only strictly consecutive insertion. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +For a description of query parameters, see the [query description](../../../sql-reference/statements/create.md). + +**Engine Parameters** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Name of the column with the type of row: `1` is a “state” row, `-1` is a “cancel” row. + + The column data type should be `Int8`. + +- `version` — Name of the column with the version of the object state. + + The column data type should be `UInt*`. + +**Query Clauses** + +When creating a `VersionedCollapsingMergeTree` table, the same [clauses](mergetree.md) are required as when creating a `MergeTree` table. + +
+ +Deprecated Method for Creating a Table + +!!! attention "Attention" + Do not use this method in new projects. If possible, switch the old projects to the method described above. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +All of the parameters except `sign` and `version` have the same meaning as in `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` is a “state” row, `-1` is a “cancel” row. + + Column Data Type — `Int8`. + +- `version` — Name of the column with the version of the object state. + + The column data type should be `UInt*`. + +
+ +## Collapsing {#table_engines-versionedcollapsingmergetree} + +### Data {#data} + +Consider a situation where you need to save continually changing data for some object. It is reasonable to have one row for an object and update the row whenever there are changes. However, the update operation is expensive and slow for a DBMS because it requires rewriting the data in the storage. Update is not acceptable if you need to write data quickly, but you can write the changes to an object sequentially as follows. + +Use the `Sign` column when writing the row. If `Sign = 1` it means that the row is a state of an object (let’s call it the “state” row). If `Sign = -1` it indicates the cancellation of the state of an object with the same attributes (let’s call it the “cancel” row). Also use the `Version` column, which should identify each state of an object with a separate number. + +For example, we want to calculate how many pages users visited on some site and how long they were there. At some point in time we write the following row with the state of user activity: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +At some point later we register the change of user activity and write it with the following two rows. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +The first row cancels the previous state of the object (user). It should copy all of the fields of the canceled state except `Sign`. + +The second row contains the current state. + +Because we need only the last state of user activity, the rows + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +can be deleted, collapsing the invalid (old) state of the object. `VersionedCollapsingMergeTree` does this while merging the data parts. + +To find out why we need two rows for each change, see [Algorithm](#table_engines-versionedcollapsingmergetree-algorithm). + +**Notes on Usage** + +1. The program that writes the data should remember the state of an object in order to cancel it. The “cancel” string should be a copy of the “state” string with the opposite `Sign`. This increases the initial size of storage but allows to write the data quickly. +2. Long growing arrays in columns reduce the efficiency of the engine due to the load for writing. The more straightforward the data, the better the efficiency. +3. `SELECT` results depend strongly on the consistency of the history of object changes. Be accurate when preparing data for inserting. You can get unpredictable results with inconsistent data, such as negative values for non-negative metrics like session depth. + +### Algorithm {#table_engines-versionedcollapsingmergetree-algorithm} + +When ClickHouse merges data parts, it deletes each pair of rows that have the same primary key and version and different `Sign`. The order of rows does not matter. + +When ClickHouse inserts data, it orders rows by the primary key. If the `Version` column is not in the primary key, ClickHouse adds it to the primary key implicitly as the last field and uses it for ordering. + +## Selecting Data {#selecting-data} + +ClickHouse doesn’t guarantee that all of the rows with the same primary key will be in the same resulting data part or even on the same physical server. This is true both for writing the data and for subsequent merging of the data parts. In addition, ClickHouse processes `SELECT` queries with multiple threads, and it cannot predict the order of rows in the result. This means that aggregation is required if there is a need to get completely “collapsed” data from a `VersionedCollapsingMergeTree` table. + +To finalize collapsing, write a query with a `GROUP BY` clause and aggregate functions that account for the sign. For example, to calculate quantity, use `sum(Sign)` instead of `count()`. To calculate the sum of something, use `sum(Sign * x)` instead of `sum(x)`, and add `HAVING sum(Sign) > 0`. + +The aggregates `count`, `sum` and `avg` can be calculated this way. The aggregate `uniq` can be calculated if an object has at least one non-collapsed state. The aggregates `min` and `max` can’t be calculated because `VersionedCollapsingMergeTree` does not save the history of values of collapsed states. + +If you need to extract the data with “collapsing” but without aggregation (for example, to check whether rows are present whose newest values match certain conditions), you can use the `FINAL` modifier for the `FROM` clause. This approach is inefficient and should not be used with large tables. + +## Example of Use {#example-of-use} + +Example data: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Creating the table: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +Inserting the data: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +We use two `INSERT` queries to create two different data parts. If we insert the data with a single query, ClickHouse creates one data part and will never perform any merge. + +Getting the data: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +What do we see here and where are the collapsed parts? +We created two data parts using two `INSERT` queries. The `SELECT` query was performed in two threads, and the result is a random order of rows. +Collapsing did not occur because the data parts have not been merged yet. ClickHouse merges data parts at an unknown point in time which we cannot predict. + +This is why we need aggregation: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +If we don’t need aggregation and want to force collapsing, we can use the `FINAL` modifier for the `FROM` clause. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +This is a very inefficient way to select data. Don’t use it for large tables. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/en/engines/table_engines/special/buffer.md b/docs/en/engines/table-engines/special/buffer.md similarity index 100% rename from docs/en/engines/table_engines/special/buffer.md rename to docs/en/engines/table-engines/special/buffer.md diff --git a/docs/en/engines/table-engines/special/dictionary.md b/docs/en/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..31806b54ff3 --- /dev/null +++ b/docs/en/engines/table-engines/special/dictionary.md @@ -0,0 +1,95 @@ +--- +toc_priority: 35 +toc_title: Dictionary +--- + +# Dictionary {#dictionary} + +The `Dictionary` engine displays the [dictionary](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) data as a ClickHouse table. + +As an example, consider a dictionary of `products` with the following configuration: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +Query the dictionary data: + +``` sql +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + +``` text +┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ +│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ +└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ +``` + +You can use the [dictGet\*](../../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions) function to get the dictionary data in this format. + +This view isn’t helpful when you need to get raw data, or when performing a `JOIN` operation. For these cases, you can use the `Dictionary` engine, which displays the dictionary data in a table. + +Syntax: + +``` sql +CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` +``` + +Usage example: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); +``` + + Ok + +Take a look at what’s in the table. + +``` sql +select * from products limit 1; +``` + +``` text +┌────product_id─┬─title───────────┐ +│ 152689 │ Some item │ +└───────────────┴─────────────────┘ +``` + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/en/engines/table-engines/special/distributed.md b/docs/en/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..9e86c74d9b8 --- /dev/null +++ b/docs/en/engines/table-engines/special/distributed.md @@ -0,0 +1,150 @@ +--- +toc_priority: 33 +toc_title: Distributed +--- + +# Distributed {#distributed} + +**Tables with Distributed engine do not store any data by themself**, but allow distributed query processing on multiple servers. +Reading is automatically parallelized. During a read, the table indexes on remote servers are used, if there are any. + +The Distributed engine accepts parameters: + +- the cluster name in the server’s config file + +- the name of a remote database + +- the name of a remote table + +- (optionally) sharding key + +- (optionally) policy name, it will be used to store temporary files for async send + + See also: + + - `insert_distributed_sync` setting + - [MergeTree](../mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) for the examples + +Example: + +``` sql +Distributed(logs, default, hits[, sharding_key[, policy_name]]) +``` + +Data will be read from all servers in the ‘logs’ cluster, from the default.hits table located on every server in the cluster. +Data is not only read but is partially processed on the remote servers (to the extent that this is possible). +For example, for a query with GROUP BY, data will be aggregated on remote servers, and the intermediate states of aggregate functions will be sent to the requestor server. Then data will be further aggregated. + +Instead of the database name, you can use a constant expression that returns a string. For example: currentDatabase(). + +logs – The cluster name in the server’s config file. + +Clusters are set like this: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 1 + 9440 + + + + +``` + +Here a cluster is defined with the name ‘logs’ that consists of two shards, each of which contains two replicas. +Shards refer to the servers that contain different parts of the data (in order to read all the data, you must access all the shards). +Replicas are duplicating servers (in order to read all the data, you can access the data on any one of the replicas). + +Cluster names must not contain dots. + +The parameters `host`, `port`, and optionally `user`, `password`, `secure`, `compression` are specified for each server: +- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn’t start. If you change the DNS record, restart the server. +- `port` – The TCP port for messenger activity (‘tcp\_port’ in the config, usually set to 9000). Do not confuse it with http\_port. +- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Access rights](../../../operations/access-rights.md). +- `password` – The password for connecting to a remote server (not masked). Default value: empty string. +- `secure` - Use ssl for connection, usually you also should define `port` = 9440. Server should listen on 9440 and have correct certificates. +- `compression` - Use data compression. Default value: true. + +When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing) setting. +If the connection with the server is not established, there will be an attempt to connect with a short timeout. If the connection failed, the next replica will be selected, and so on for all the replicas. If the connection attempt failed for all the replicas, the attempt will be repeated the same way, several times. +This works in favour of resiliency, but does not provide complete fault tolerance: a remote server might accept the connection, but might not work, or work poorly. + +You can specify just one of the shards (in this case, query processing should be called remote, rather than distributed) or up to any number of shards. In each shard, you can specify from one to any number of replicas. You can specify a different number of replicas for each shard. + +You can specify as many clusters as you wish in the configuration. + +To view your clusters, use the ‘system.clusters’ table. + +The Distributed engine allows working with a cluster like a local server. However, the cluster is inextensible: you must write its configuration in the server config file (even better, for all the cluster’s servers). + +The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don’t need to create a Distributed table – use the ‘remote’ table function instead. See the section [Table functions](../../../sql-reference/table-functions/index.md). + +There are two methods for writing data to a cluster: + +First, you can define which servers to write which data to and perform the write directly on each shard. In other words, perform INSERT in the tables that the distributed table “looks at”. This is the most flexible solution as you can use any sharding scheme, which could be non-trivial due to the requirements of the subject area. This is also the most optimal solution since data can be written to different shards completely independently. + +Second, you can perform INSERT in a Distributed table. In this case, the table will distribute the inserted data across the servers itself. In order to write to a Distributed table, it must have a sharding key set (the last parameter). In addition, if there is only one shard, the write operation works without specifying the sharding key, since it doesn’t mean anything in this case. + +Each shard can have a weight defined in the config file. By default, the weight is equal to one. Data is distributed across shards in the amount proportional to the shard weight. For example, if there are two shards and the first has a weight of 9 while the second has a weight of 10, the first will be sent 9 / 19 parts of the rows, and the second will be sent 10 / 19. + +Each shard can have the ‘internal\_replication’ parameter defined in the config file. + +If this parameter is set to ‘true’, the write operation selects the first healthy replica and writes data to it. Use this alternative if the Distributed table “looks at” replicated tables. In other words, if the table where data will be written is going to replicate them itself. + +If it is set to ‘false’ (the default), data is written to all replicas. In essence, this means that the Distributed table replicates data itself. This is worse than using replicated tables, because the consistency of replicas is not checked, and over time they will contain slightly different data. + +To select the shard that a row of data is sent to, the sharding expression is analyzed, and its remainder is taken from dividing it by the total weight of the shards. The row is sent to the shard that corresponds to the half-interval of the remainders from ‘prev\_weight’ to ‘prev\_weights + weight’, where ‘prev\_weights’ is the total weight of the shards with the smallest number, and ‘weight’ is the weight of this shard. For example, if there are two shards, and the first has a weight of 9 while the second has a weight of 10, the row will be sent to the first shard for the remainders from the range \[0, 9), and to the second for the remainders from the range \[9, 19). + +The sharding expression can be any expression from constants and table columns that returns an integer. For example, you can use the expression ‘rand()’ for random distribution of data, or ‘UserID’ for distribution by the remainder from dividing the user’s ID (then the data of a single user will reside on a single shard, which simplifies running IN and JOIN by users). If one of the columns is not distributed evenly enough, you can wrap it in a hash function: intHash64(UserID). + +A simple reminder from the division is a limited solution for sharding and isn’t always appropriate. It works for medium and large volumes of data (dozens of servers), but not for very large volumes of data (hundreds of servers or more). In the latter case, use the sharding scheme required by the subject area, rather than using entries in Distributed tables. + +SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don’t have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. + +You should be concerned about the sharding scheme in the following cases: + +- Queries are used that require joining data (IN or JOIN) by a specific key. If data is sharded by this key, you can use local IN or JOIN instead of GLOBAL IN or GLOBAL JOIN, which is much more efficient. +- A large number of servers is used (hundreds or more) with a large number of small queries (queries of individual clients - websites, advertisers, or partners). In order for the small queries to not affect the entire cluster, it makes sense to locate data for a single client on a single shard. Alternatively, as we’ve done in Yandex.Metrica, you can set up bi-level sharding: divide the entire cluster into “layers”, where a layer may consist of multiple shards. Data for a single client is located on a single layer, but shards can be added to a layer as necessary, and data is randomly distributed within them. Distributed tables are created for each layer, and a single shared distributed table is created for global queries. + +Data is written asynchronously. When inserted in the table, the data block is just written to the local file system. The data is sent to the remote servers in the background as soon as possible. The period for sending data is managed by the [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) and [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) settings. The `Distributed` engine sends each file with inserted data separately, but you can enable batch sending of files with the [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) setting. This setting improves cluster performance by better utilizing local server and network resources. You should check whether data is sent successfully by checking the list of files (data waiting to be sent) in the table directory: `/var/lib/clickhouse/data/database/table/`. + +If the server ceased to exist or had a rough restart (for example, after a device failure) after an INSERT to a Distributed table, the inserted data might be lost. If a damaged data part is detected in the table directory, it is transferred to the ‘broken’ subdirectory and no longer used. + +When the max\_parallel\_replicas option is enabled, query processing is parallelized across all replicas within a single shard. For more information, see the section [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). + +## Virtual Columns {#virtual-columns} + +- `_shard_num` — Contains the `shard_num` (from `system.clusters`). Type: [UInt32](../../../sql-reference/data-types/int-uint.md). + +!!! note "Note" + Since [`remote`](../../../sql-reference/table-functions/remote.md)/`cluster` table functions internally create temporary instance of the same Distributed engine, `_shard_num` is available there too. + +**See Also** + +- [Virtual columns](index.md#table_engines-virtual_columns) + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/en/engines/table_engines/special/external_data.md b/docs/en/engines/table-engines/special/external-data.md similarity index 100% rename from docs/en/engines/table_engines/special/external_data.md rename to docs/en/engines/table-engines/special/external-data.md diff --git a/docs/en/engines/table-engines/special/file.md b/docs/en/engines/table-engines/special/file.md new file mode 100644 index 00000000000..28470e526b2 --- /dev/null +++ b/docs/en/engines/table-engines/special/file.md @@ -0,0 +1,88 @@ +--- +toc_priority: 37 +toc_title: File +--- + +# File {#table_engines-file} + +The File table engine keeps the data in a file in one of the supported [file +formats](../../../interfaces/formats.md#formats) (TabSeparated, Native, etc.). + +Usage examples: + +- Data export from ClickHouse to file. +- Convert data from one format to another. +- Updating data in ClickHouse via editing a file on a disk. + +## Usage in ClickHouse Server {#usage-in-clickhouse-server} + +``` sql +File(Format) +``` + +The `Format` parameter specifies one of the available file formats. To perform +`SELECT` queries, the format must be supported for input, and to perform +`INSERT` queries – for output. The available formats are listed in the +[Formats](../../../interfaces/formats.md#formats) section. + +ClickHouse does not allow to specify filesystem path for`File`. It will use folder defined by [path](../../../operations/server-configuration-parameters/settings.md) setting in server configuration. + +When creating table using `File(Format)` it creates empty subdirectory in that folder. When data is written to that table, it’s put into `data.Format` file in that subdirectory. + +You may manually create this subfolder and file in server filesystem and then [ATTACH](../../../sql-reference/statements/misc.md) it to table information with matching name, so you can query data from that file. + +!!! warning "Warning" + Be careful with this functionality, because ClickHouse does not keep track of external changes to such files. The result of simultaneous writes via ClickHouse and outside of ClickHouse is undefined. + +**Example:** + +**1.** Set up the `file_engine_table` table: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +By default ClickHouse will create folder `/var/lib/clickhouse/data/default/file_engine_table`. + +**2.** Manually create `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` containing: + +``` bash +$ cat data.TabSeparated +one 1 +two 2 +``` + +**3.** Query the data: + +``` sql +SELECT * FROM file_engine_table +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Usage in ClickHouse-local {#usage-in-clickhouse-local} + +In [clickhouse-local](../../../operations/utilities/clickhouse-local.md) File engine accepts file path in addition to `Format`. Default input/output streams can be specified using numeric or human-readable names like `0` or `stdin`, `1` or `stdout`. +**Example:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## Details of Implementation {#details-of-implementation} + +- Multiple `SELECT` queries can be performed concurrently, but `INSERT` queries will wait each other. +- Supported creating new file by `INSERT` query. +- If file exists, `INSERT` would append new values in it. +- Not supported: + - `ALTER` + - `SELECT ... SAMPLE` + - Indices + - Replication + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/en/engines/table-engines/special/generate.md b/docs/en/engines/table-engines/special/generate.md new file mode 100644 index 00000000000..396b039f8df --- /dev/null +++ b/docs/en/engines/table-engines/special/generate.md @@ -0,0 +1,59 @@ +--- +toc_priority: 46 +toc_title: GenerateRandom +--- + +# Generaterandom {#table_engines-generate} + +The GenerateRandom table engine produces random data for given table schema. + +Usage examples: + +- Use in test to populate reproducible large table. +- Generate random input for fuzzing tests. + +## Usage in ClickHouse Server {#usage-in-clickhouse-server} + +``` sql +ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) +``` + +The `max_array_length` and `max_string_length` parameters specify maximum length of all +array columns and strings correspondingly in generated data. + +Generate table engine supports only `SELECT` queries. + +It supports all [DataTypes](../../../sql-reference/data-types/index.md) that can be stored in a table except `LowCardinality` and `AggregateFunction`. + +**Example:** + +**1.** Set up the `generate_engine_table` table: + +``` sql +CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) +``` + +**2.** Query the data: + +``` sql +SELECT * FROM generate_engine_table LIMIT 3 +``` + +``` text +┌─name─┬──────value─┐ +│ c4xJ │ 1412771199 │ +│ r │ 1791099446 │ +│ 7#$ │ 124312908 │ +└──────┴────────────┘ +``` + +## Details of Implementation {#details-of-implementation} + +- Not supported: + - `ALTER` + - `SELECT ... SAMPLE` + - `INSERT` + - Indices + - Replication + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/en/engines/table-engines/special/index.md b/docs/en/engines/table-engines/special/index.md new file mode 100644 index 00000000000..b1789f34347 --- /dev/null +++ b/docs/en/engines/table-engines/special/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Special +toc_priority: 31 +--- + + diff --git a/docs/en/engines/table-engines/special/join.md b/docs/en/engines/table-engines/special/join.md new file mode 100644 index 00000000000..adc88115be3 --- /dev/null +++ b/docs/en/engines/table-engines/special/join.md @@ -0,0 +1,109 @@ +--- +toc_priority: 40 +toc_title: Join +--- + +# Join {#join} + +Prepared data structure for using in [JOIN](../../../sql-reference/statements/select.md#select-join) operations. + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], +) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) +``` + +See the detailed description of the [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) query. + +**Engine Parameters** + +- `join_strictness` – [JOIN strictness](../../../sql-reference/statements/select.md#select-join-strictness). +- `join_type` – [JOIN type](../../../sql-reference/statements/select.md#select-join-types). +- `k1[, k2, ...]` – Key columns from the `USING` clause that the `JOIN` operation is made with. + +Enter `join_strictness` and `join_type` parameters without quotes, for example, `Join(ANY, LEFT, col1)`. They must match the `JOIN` operation that the table will be used for. If the parameters don’t match, ClickHouse doesn’t throw an exception and may return incorrect data. + +## Table Usage {#table-usage} + +### Example {#example} + +Creating the left-side table: + +``` sql +CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog +``` + +``` sql +INSERT INTO id_val VALUES (1,11)(2,12)(3,13) +``` + +Creating the right-side `Join` table: + +``` sql +CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) +``` + +``` sql +INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) +``` + +Joining the tables: + +``` sql +SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 +``` + +``` text +┌─id─┬─val─┬─id_val_join.val─┐ +│ 1 │ 11 │ 21 │ +│ 2 │ 12 │ ᴺᵁᴸᴸ │ +│ 3 │ 13 │ 23 │ +└────┴─────┴─────────────────┘ +``` + +As an alternative, you can retrieve data from the `Join` table, specifying the join key value: + +``` sql +SELECT joinGet('id_val_join', 'val', toUInt32(1)) +``` + +``` text +┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ +│ 21 │ +└────────────────────────────────────────────┘ +``` + +### Selecting and Inserting Data {#selecting-and-inserting-data} + +You can use `INSERT` queries to add data to the `Join`-engine tables. If the table was created with the `ANY` strictness, data for duplicate keys are ignored. With the `ALL` strictness, all rows are added. + +You cannot perform a `SELECT` query directly from the table. Instead, use one of the following methods: + +- Place the table to the right side in a `JOIN` clause. +- Call the [joinGet](../../../sql-reference/functions/other-functions.md#joinget) function, which lets you extract data from the table the same way as from a dictionary. + +### Limitations and Settings {#join-limitations-and-settings} + +When creating a table, the following settings are applied: + +- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) +- [max\_rows\_in\_join](../../../operations/settings/query-complexity.md#settings-max_rows_in_join) +- [max\_bytes\_in\_join](../../../operations/settings/query-complexity.md#settings-max_bytes_in_join) +- [join\_overflow\_mode](../../../operations/settings/query-complexity.md#settings-join_overflow_mode) +- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) + +The `Join`-engine tables can’t be used in `GLOBAL JOIN` operations. + +The `Join`-engine allows use [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) setting in the `CREATE TABLE` statement. And [SELECT](../../../sql-reference/statements/select.md) query allows use `join_use_nulls` too. If you have different `join_use_nulls` settings, you can get an error joining table. It depends on kind of JOIN. When you use [joinGet](../../../sql-reference/functions/other-functions.md#joinget) function, you have to use the same `join_use_nulls` setting in `CRATE TABLE` and `SELECT` statements. + +## Data Storage {#data-storage} + +`Join` table data is always located in the RAM. When inserting rows into a table, ClickHouse writes data blocks to the directory on the disk so that they can be restored when the server restarts. + +If the server restarts incorrectly, the data block on the disk might get lost or damaged. In this case, you may need to manually delete the file with damaged data. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/en/engines/table-engines/special/materializedview.md b/docs/en/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..b0d99bc67d9 --- /dev/null +++ b/docs/en/engines/table-engines/special/materializedview.md @@ -0,0 +1,10 @@ +--- +toc_priority: 43 +toc_title: MaterializedView +--- + +# Materializedview {#materializedview} + +Used for implementing materialized views (for more information, see [CREATE TABLE](../../../sql-reference/statements/create.md)). For storing data, it uses a different engine that was specified when creating the view. When reading from a table, it just uses this engine. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/en/engines/table_engines/special/memory.md b/docs/en/engines/table-engines/special/memory.md similarity index 100% rename from docs/en/engines/table_engines/special/memory.md rename to docs/en/engines/table-engines/special/memory.md diff --git a/docs/en/engines/table-engines/special/merge.md b/docs/en/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..a683fcdbc9e --- /dev/null +++ b/docs/en/engines/table-engines/special/merge.md @@ -0,0 +1,68 @@ +--- +toc_priority: 36 +toc_title: Merge +--- + +# Merge {#merge} + +The `Merge` engine (not to be confused with `MergeTree`) does not store data itself, but allows reading from any number of other tables simultaneously. +Reading is automatically parallelized. Writing to a table is not supported. When reading, the indexes of tables that are actually being read are used, if they exist. +The `Merge` engine accepts parameters: the database name and a regular expression for tables. + +Example: + +``` sql +Merge(hits, '^WatchLog') +``` + +Data will be read from the tables in the `hits` database that have names that match the regular expression ‘`^WatchLog`’. + +Instead of the database name, you can use a constant expression that returns a string. For example, `currentDatabase()`. + +Regular expressions — [re2](https://github.com/google/re2) (supports a subset of PCRE), case-sensitive. +See the notes about escaping symbols in regular expressions in the “match” section. + +When selecting tables to read, the `Merge` table itself will not be selected, even if it matches the regex. This is to avoid loops. +It is possible to create two `Merge` tables that will endlessly try to read each others’ data, but this is not a good idea. + +The typical way to use the `Merge` engine is for working with a large number of `TinyLog` tables as if with a single table. + +Example 2: + +Let’s say you have a old table (WatchLog\_old) and decided to change partitioning without moving data to a new table (WatchLog\_new) and you need to see data from both tables. + +``` sql +CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree(date, (UserId, EventType), 8192); +INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + +CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; +INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + +CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + +SELECT * +FROM WatchLog +``` + +``` text +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-01 │ 1 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-02 │ 2 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +``` + +## Virtual Columns {#virtual-columns} + +- `_table` — Contains the name of the table from which data was read. Type: [String](../../../sql-reference/data-types/string.md). + + You can set the constant conditions on `_table` in the `WHERE/PREWHERE` clause (for example, `WHERE _table='xyz'`). In this case the read operation is performed only for that tables where the condition on `_table` is satisfied, so the `_table` column acts as an index. + +**See Also** + +- [Virtual columns](index.md#table_engines-virtual_columns) + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/en/engines/table_engines/special/null.md b/docs/en/engines/table-engines/special/null.md similarity index 100% rename from docs/en/engines/table_engines/special/null.md rename to docs/en/engines/table-engines/special/null.md diff --git a/docs/en/engines/table_engines/special/set.md b/docs/en/engines/table-engines/special/set.md similarity index 100% rename from docs/en/engines/table_engines/special/set.md rename to docs/en/engines/table-engines/special/set.md diff --git a/docs/en/engines/table-engines/special/url.md b/docs/en/engines/table-engines/special/url.md new file mode 100644 index 00000000000..d560487c788 --- /dev/null +++ b/docs/en/engines/table-engines/special/url.md @@ -0,0 +1,80 @@ +--- +toc_priority: 41 +toc_title: URL +--- + +# URL(URL, Format) {#table_engines-url} + +Manages data on a remote HTTP/HTTPS server. This engine is similar +to the [File](file.md) engine. + +## Using the Engine in the ClickHouse Server {#using-the-engine-in-the-clickhouse-server} + +The `format` must be one that ClickHouse can use in +`SELECT` queries and, if necessary, in `INSERTs`. For the full list of supported formats, see +[Formats](../../../interfaces/formats.md#formats). + +The `URL` must conform to the structure of a Uniform Resource Locator. The specified URL must point to a server +that uses HTTP or HTTPS. This does not require any +additional headers for getting a response from the server. + +`INSERT` and `SELECT` queries are transformed to `POST` and `GET` requests, +respectively. For processing `POST` requests, the remote server must support +[Chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). + +You can limit the maximum number of HTTP GET redirect hops using the [max\_http\_get\_redirects](../../../operations/settings/settings.md#setting-max_http_get_redirects) setting. + +**Example:** + +**1.** Create a `url_engine_table` table on the server : + +``` sql +CREATE TABLE url_engine_table (word String, value UInt64) +ENGINE=URL('http://127.0.0.1:12345/', CSV) +``` + +**2.** Create a basic HTTP server using the standard Python 3 tools and +start it: + +``` python3 +from http.server import BaseHTTPRequestHandler, HTTPServer + +class CSVHTTPServer(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-type', 'text/csv') + self.end_headers() + + self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) + +if __name__ == "__main__": + server_address = ('127.0.0.1', 12345) + HTTPServer(server_address, CSVHTTPServer).serve_forever() +``` + +``` bash +$ python3 server.py +``` + +**3.** Request data: + +``` sql +SELECT * FROM url_engine_table +``` + +``` text +┌─word──┬─value─┐ +│ Hello │ 1 │ +│ World │ 2 │ +└───────┴───────┘ +``` + +## Details of Implementation {#details-of-implementation} + +- Reads and writes can be parallel +- Not supported: + - `ALTER` and `SELECT...SAMPLE` operations. + - Indexes. + - Replication. + +[Original article](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/en/engines/table_engines/special/view.md b/docs/en/engines/table-engines/special/view.md similarity index 100% rename from docs/en/engines/table_engines/special/view.md rename to docs/en/engines/table-engines/special/view.md diff --git a/docs/en/engines/table_engines/index.md b/docs/en/engines/table_engines/index.md deleted file mode 100644 index 00f53a6f9f0..00000000000 --- a/docs/en/engines/table_engines/index.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -toc_folder_title: Table Engines -toc_priority: 26 -toc_title: Introduction ---- - -# Table Engines {#table_engines} - -The table engine (type of table) determines: - -- How and where data is stored, where to write it to, and where to read it from. -- Which queries are supported, and how. -- Concurrent data access. -- Use of indexes, if present. -- Whether multithreaded request execution is possible. -- Data replication parameters. - -## Engine Families {#engine-families} - -### MergeTree {#mergetree} - -The most universal and functional table engines for high-load tasks. The property shared by these engines is quick data insertion with subsequent background data processing. `MergeTree` family engines support data replication (with [Replicated\*](mergetree_family/replication.md) versions of engines), partitioning, and other features not supported in other engines. - -Engines in the family: - -- [MergeTree](mergetree_family/mergetree.md) -- [ReplacingMergeTree](mergetree_family/replacingmergetree.md) -- [SummingMergeTree](mergetree_family/summingmergetree.md) -- [AggregatingMergeTree](mergetree_family/aggregatingmergetree.md) -- [CollapsingMergeTree](mergetree_family/collapsingmergetree.md) -- [VersionedCollapsingMergeTree](mergetree_family/versionedcollapsingmergetree.md) -- [GraphiteMergeTree](mergetree_family/graphitemergetree.md) - -### Log {#log} - -Lightweight [engines](log_family/index.md) with minimum functionality. They’re the most effective when you need to quickly write many small tables (up to approximately 1 million rows) and read them later as a whole. - -Engines in the family: - -- [TinyLog](log_family/tinylog.md) -- [StripeLog](log_family/stripelog.md) -- [Log](log_family/log.md) - -### Integration Engines {#integration-engines} - -Engines for communicating with other data storage and processing systems. - -Engines in the family: - -- [Kafka](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) -- [HDFS](integrations/hdfs.md) - -### Special Engines {#special-engines} - -Engines in the family: - -- [Distributed](special/distributed.md) -- [MaterializedView](special/materializedview.md) -- [Dictionary](special/dictionary.md) -- [Merge](special/merge.md) -- [File](special/file.md) -- [Null](special/null.md) -- [Set](special/set.md) -- [Join](special/join.md) -- [URL](special/url.md) -- [View](special/view.md) -- [Memory](special/memory.md) -- [Buffer](special/buffer.md) - -## Virtual Columns {#table_engines-virtual-columns} - -Virtual column is an integral table engine attribute that is defined in the engine source code. - -You shouldn’t specify virtual columns in the `CREATE TABLE` query and you can’t see them in `SHOW CREATE TABLE` and `DESCRIBE TABLE` query results. Virtual columns are also read-only, so you can’t insert data into virtual columns. - -To select data from a virtual column, you must specify its name in the `SELECT` query. `SELECT *` doesn’t return values from virtual columns. - -If you create a table with a column that has the same name as one of the table virtual columns, the virtual column becomes inaccessible. We don’t recommend doing this. To help avoid conflicts, virtual column names are usually prefixed with an underscore. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/en/engines/table_engines/integrations/hdfs.md b/docs/en/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index b24313e682a..00000000000 --- a/docs/en/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -toc_priority: 36 -toc_title: HDFS ---- - -# HDFS {#table_engines-hdfs} - -This engine provides integration with [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) ecosystem by allowing to manage data on [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)via ClickHouse. This engine is similar -to the [File](../special/file.md) and [URL](../special/url.md) engines, but provides Hadoop-specific features. - -## Usage {#usage} - -``` sql -ENGINE = HDFS(URI, format) -``` - -The `URI` parameter is the whole file URI in HDFS. -The `format` parameter specifies one of the available file formats. To perform -`SELECT` queries, the format must be supported for input, and to perform -`INSERT` queries – for output. The available formats are listed in the -[Formats](../../../interfaces/formats.md#formats) section. -The path part of `URI` may contain globs. In this case the table would be readonly. - -**Example:** - -**1.** Set up the `hdfs_engine_table` table: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** Fill file: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** Query the data: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Implementation Details {#implementation-details} - -- Reads and writes can be parallel -- Not supported: - - `ALTER` and `SELECT...SAMPLE` operations. - - Indexes. - - Replication. - -**Globs in path** - -Multiple path components can have globs. For being processed file should exists and matches to the whole path pattern. Listing of files determines during `SELECT` (not at `CREATE` moment). - -- `*` — Substitutes any number of any characters except `/` including empty string. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Constructions with `{}` are similar to the [remote](../../../sql_reference/table_functions/remote.md) table function. - -**Example** - -1. Suppose we have several files in TSV format with the following URIs on HDFS: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. There are several ways to make a table consisting of all six files: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -Another way: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -Table consists of all the files in both directories (all files should satisfy format and schema described in query): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "Warning" - If the listing of files contains number ranges with leading zeros, use the construction with braces for each digit separately or use `?`. - -**Example** - -Create table with files named `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') -``` - -## Virtual Columns {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**See Also** - -- [Virtual columns](../index.md#table_engines-virtual_columns) - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/en/engines/table_engines/integrations/index.md b/docs/en/engines/table_engines/integrations/index.md deleted file mode 100644 index 716d00cdd98..00000000000 --- a/docs/en/engines/table_engines/integrations/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Integrations -toc_priority: 30 ---- - diff --git a/docs/en/engines/table_engines/integrations/jdbc.md b/docs/en/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index e3ba45ac06e..00000000000 --- a/docs/en/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -toc_priority: 34 -toc_title: JDBC ---- - -# JDBC {#table-engine-jdbc} - -Allows ClickHouse to connect to external databases via [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -To implement the JDBC connection, ClickHouse uses the separate program [clickhouse-jdbc-bridge](https://github.com/alex-krash/clickhouse-jdbc-bridge) that should run as a daemon. - -This engine supports the [Nullable](../../../sql_reference/data_types/nullable.md) data type. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -( - columns list... -) -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**Engine Parameters** - -- `dbms_uri` — URI of an external DBMS. - - Format: `jdbc:://:/?user=&password=`. - Example for MySQL: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — Database in an external DBMS. - -- `external_table` — Name of the table in `external_database`. - -## Usage Example {#usage-example} - -Creating a table in MySQL server by connecting directly with it’s console client: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Creating a table in ClickHouse server and selecting data from it: - -``` sql -CREATE TABLE jdbc_table -( - `int_id` Int32, - `int_nullable` Nullable(Int32), - `float` Float32, - `float_nullable` Nullable(Float32) -) -ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## See Also {#see-also} - -- [JDBC table function](../../../sql_reference/table_functions/jdbc.md). - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/en/engines/table_engines/integrations/kafka.md b/docs/en/engines/table_engines/integrations/kafka.md deleted file mode 100644 index 31a218c85b5..00000000000 --- a/docs/en/engines/table_engines/integrations/kafka.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -toc_priority: 32 -toc_title: Kafka ---- - -# Kafka {#kafka} - -This engine works with [Apache Kafka](http://kafka.apache.org/). - -Kafka lets you: - -- Publish or subscribe to data flows. -- Organize fault-tolerant storage. -- Process streams as they become available. - -## Creating a Table {#table_engine-kafka-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = Kafka() -SETTINGS - kafka_broker_list = 'host:port', - kafka_topic_list = 'topic1,topic2,...', - kafka_group_name = 'group_name', - kafka_format = 'data_format'[,] - [kafka_row_delimiter = 'delimiter_symbol',] - [kafka_schema = '',] - [kafka_num_consumers = N,] - [kafka_skip_broken_messages = N] -``` - -Required parameters: - -- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). -- `kafka_topic_list` – A list of Kafka topics. -- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don’t want messages to be duplicated in the cluster, use the same group name everywhere. -- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` function, such as `JSONEachRow`. For more information, see the [Formats](../../../interfaces/formats.md) section. - -Optional parameters: - -- `kafka_row_delimiter` – Delimiter character, which ends the message. -- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap’n Proto](https://capnproto.org/) requires the path to the schema file and the name of the root `schema.capnp:Message` object. -- `kafka_num_consumers` – The number of consumers per table. Default: `1`. Specify more consumers if the throughput of one consumer is insufficient. The total number of consumers should not exceed the number of partitions in the topic, since only one consumer can be assigned per partition. -- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. If `kafka_skip_broken_messages = N` then the engine skips *N* Kafka messages that cannot be parsed (a message equals a row of data). - -Examples: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - SELECT * FROM queue LIMIT 5; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') - SETTINGS kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; -``` - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects. If possible, switch old projects to the method described above. - -``` sql -Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format - [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) -``` - -
- -## Description {#description} - -The delivered messages are tracked automatically, so each message in a group is only counted once. If you want to get the data twice, then create a copy of the table with another group name. - -Groups are flexible and synced on the cluster. For instance, if you have 10 topics and 5 copies of a table in a cluster, then each copy gets 2 topics. If the number of copies changes, the topics are redistributed across the copies automatically. Read more about this at http://kafka.apache.org/intro. - -`SELECT` is not particularly useful for reading messages (except for debugging), because each message can be read only once. It is more practical to create real-time threads using materialized views. To do this: - -1. Use the engine to create a Kafka consumer and consider it a data stream. -2. Create a table with the desired structure. -3. Create a materialized view that converts data from the engine and puts it into a previously created table. - -When the `MATERIALIZED VIEW` joins the engine, it starts collecting data in the background. This allows you to continually receive messages from Kafka and convert them to the required format using `SELECT`. -One kafka table can have as many materialized views as you like, they do not read data from the kafka table directly, but receive new records (in blocks), this way you can write to several tables with different detail level (with grouping - aggregation and without). - -Example: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - CREATE TABLE daily ( - day Date, - level String, - total UInt64 - ) ENGINE = SummingMergeTree(day, (day, level), 8192); - - CREATE MATERIALIZED VIEW consumer TO daily - AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total - FROM queue GROUP BY day, level; - - SELECT level, sum(total) FROM daily GROUP BY level; -``` - -To improve performance, received messages are grouped into blocks the size of [max\_insert\_block\_size](../../../operations/server_configuration_parameters/settings.md#settings-max_insert_block_size). If the block wasn’t formed within [stream\_flush\_interval\_ms](../../../operations/server_configuration_parameters/settings.md) milliseconds, the data will be flushed to the table regardless of the completeness of the block. - -To stop receiving topic data or to change the conversion logic, detach the materialized view: - -``` sql - DETACH TABLE consumer; - ATTACH TABLE consumer; -``` - -If you want to change the target table by using `ALTER`, we recommend disabling the material view to avoid discrepancies between the target table and the data from the view. - -## Configuration {#configuration} - -Similar to GraphiteMergeTree, the Kafka engine supports extended configuration using the ClickHouse config file. There are two configuration keys that you can use: global (`kafka`) and topic-level (`kafka_*`). The global configuration is applied first, and then the topic-level configuration is applied (if it exists). - -``` xml - - - cgrp - smallest - - - - - 250 - 100000 - -``` - -For a list of possible configuration options, see the [librdkafka configuration reference](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Use the underscore (`_`) instead of a dot in the ClickHouse configuration. For example, `check.crcs=true` will be `true`. - -## Virtual Columns {#virtual-columns} - -- `_topic` — Kafka topic. -- `_key` — Key of the message. -- `_offset` — Offset of the message. -- `_timestamp` — Timestamp of the message. -- `_partition` — Partition of Kafka topic. - -**See Also** - -- [Virtual columns](../index.md#table_engines-virtual_columns) - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/en/engines/table_engines/integrations/mysql.md b/docs/en/engines/table_engines/integrations/mysql.md deleted file mode 100644 index 49410887242..00000000000 --- a/docs/en/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -toc_priority: 33 -toc_title: MySQL ---- - -# Mysql {#mysql} - -The MySQL engine allows you to perform `SELECT` queries on data that is stored on a remote MySQL server. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... -) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -See a detailed description of the [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) query. - -The table structure can differ from the original MySQL table structure: - -- Column names should be the same as in the original MySQL table, but you can use just some of these columns and in any order. -- Column types may differ from those in the original MySQL table. ClickHouse tries to [cast](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) values to the ClickHouse data types. - -**Engine Parameters** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` queries to `REPLACE INTO`. If `replace_query=1`, the query is substituted. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expression that is added to the `INSERT` query. - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the [MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -Simple `WHERE` clauses such as `=, !=, >, >=, <, <=` are executed on the MySQL server. - -The rest of the conditions and the `LIMIT` sampling constraint are executed in ClickHouse only after the query to MySQL finishes. - -## Usage Example {#usage-example} - -Table in MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Table in ClickHouse, retrieving data from the MySQL table created above: - -``` sql -CREATE TABLE mysql_table -( - `float_nullable` Nullable(Float32), - `int_id` Int32 -) -ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` sql -SELECT * FROM mysql_table -``` - -``` text -┌─float_nullable─┬─int_id─┐ -│ ᴺᵁᴸᴸ │ 1 │ -└────────────────┴────────┘ -``` - -## See Also {#see-also} - -- [The ‘mysql’ table function](../../../sql_reference/table_functions/mysql.md) -- [Using MySQL as a source of external dictionary](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/en/engines/table_engines/integrations/odbc.md b/docs/en/engines/table_engines/integrations/odbc.md deleted file mode 100644 index a537150313f..00000000000 --- a/docs/en/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,130 +0,0 @@ ---- -toc_priority: 35 -toc_title: ODBC ---- - -# ODBC {#table-engine-odbc} - -Allows ClickHouse to connect to external databases via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -To safely implement ODBC connections, ClickHouse uses a separate program `clickhouse-odbc-bridge`. If the ODBC driver is loaded directly from `clickhouse-server`, driver problems can crash the ClickHouse server. ClickHouse automatically starts `clickhouse-odbc-bridge` when it is required. The ODBC bridge program is installed from the same package as the `clickhouse-server`. - -This engine supports the [Nullable](../../../sql_reference/data_types/nullable.md) data type. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -See a detailed description of the [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) query. - -The table structure can differ from the source table structure: - -- Column names should be the same as in the source table, but you can use just some of these columns and in any order. -- Column types may differ from those in the source table. ClickHouse tries to [cast](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) values to the ClickHouse data types. - -**Engine Parameters** - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` file. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -## Usage Example {#usage-example} - -**Retrieving data from the local MySQL installation via ODBC** - -This example is checked for Ubuntu Linux 18.04 and MySQL server 5.7. - -Ensure that unixODBC and MySQL Connector are installed. - -By default (if installed from packages), ClickHouse starts as user `clickhouse`. Thus, you need to create and configure this user in the MySQL server. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Then configure the connection in `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -You can check the connection using the `isql` utility from the unixODBC installation. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -Table in MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Table in ClickHouse, retrieving data from the MySQL table: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## See Also {#see-also} - -- [ODBC external dictionaries](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBC table function](../../../sql_reference/table_functions/odbc.md) - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/en/engines/table_engines/log_family/index.md b/docs/en/engines/table_engines/log_family/index.md deleted file mode 100644 index a64371200a6..00000000000 --- a/docs/en/engines/table_engines/log_family/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Log Family -toc_priority: 29 ---- - diff --git a/docs/en/engines/table_engines/log_family/log.md b/docs/en/engines/table_engines/log_family/log.md deleted file mode 100644 index b34fdd4116e..00000000000 --- a/docs/en/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -toc_priority: 33 -toc_title: Log ---- - -# Log {#log} - -Engine belongs to the family of log engines. See the common properties of log engines and their differences in the [Log Engine Family](log_family.md) article. - -Log differs from [TinyLog](tinylog.md) in that a small file of “marks” resides with the column files. These marks are written on every data block and contain offsets that indicate where to start reading the file in order to skip the specified number of rows. This makes it possible to read table data in multiple threads. -For concurrent data access, the read operations can be performed simultaneously, while write operations block reads and each other. -The Log engine does not support indexes. Similarly, if writing to a table failed, the table is broken, and reading from it returns an error. The Log engine is appropriate for temporary data, write-once tables, and for testing or demonstration purposes. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/en/engines/table_engines/log_family/log_family.md b/docs/en/engines/table_engines/log_family/log_family.md deleted file mode 100644 index a238a844002..00000000000 --- a/docs/en/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -toc_priority: 31 -toc_title: Introduction ---- - -# Log Engine Family {#log-engine-family} - -These engines were developed for scenarios when you need to quickly write many small tables (up to about 1 million rows) and read them later as a whole. - -Engines of the family: - -- [StripeLog](stripelog.md) -- [Log](log.md) -- [TinyLog](tinylog.md) - -## Common Properties {#common-properties} - -Engines: - -- Store data on a disk. - -- Append data to the end of file when writing. - -- Support locks for concurrent data access. - - During `INSERT` queries, the table is locked, and other queries for reading and writing data both wait for the table to unlock. If there are no data writing queries, any number of data reading queries can be performed concurrently. - -- Do not support [mutation](../../../sql_reference/statements/alter.md#alter-mutations) operations. - -- Do not support indexes. - - This means that `SELECT` queries for ranges of data are not efficient. - -- Do not write data atomically. - - You can get a table with corrupted data if something breaks the write operation, for example, abnormal server shutdown. - -## Differences {#differences} - -The `TinyLog` engine is the simplest in the family and provides the poorest functionality and lowest efficiency. The `TinyLog` engine doesn’t support parallel data reading by several threads. It reads data slower than other engines in the family that support parallel reading and it uses almost as many descriptors as the `Log` engine because it stores each column in a separate file. Use it in simple low-load scenarios. - -The `Log` and `StripeLog` engines support parallel data reading. When reading data, ClickHouse uses multiple threads. Each thread processes a separate data block. The `Log` engine uses a separate file for each column of the table. `StripeLog` stores all the data in one file. As a result, the `StripeLog` engine uses fewer descriptors in the operating system, but the `Log` engine provides higher efficiency when reading data. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/en/engines/table_engines/log_family/stripelog.md b/docs/en/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index 1aace26ceeb..00000000000 --- a/docs/en/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -toc_priority: 32 -toc_title: StripeLog ---- - -# Stripelog {#stripelog} - -This engine belongs to the family of log engines. See the common properties of log engines and their differences in the [Log Engine Family](log_family.md) article. - -Use this engine in scenarios when you need to write many tables with a small amount of data (less than 1 million rows). - -## Creating a Table {#table_engines-stripelog-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = StripeLog -``` - -See the detailed description of the [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) query. - -## Writing the Data {#table_engines-stripelog-writing-the-data} - -The `StripeLog` engine stores all the columns in one file. For each `INSERT` query, ClickHouse appends the data block to the end of a table file, writing columns one by one. - -For each table ClickHouse writes the files: - -- `data.bin` — Data file. -- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. - -The `StripeLog` engine does not support the `ALTER UPDATE` and `ALTER DELETE` operations. - -## Reading the Data {#table_engines-stripelog-reading-the-data} - -The file with marks allows ClickHouse to parallelize the reading of data. This means that a `SELECT` query returns rows in an unpredictable order. Use the `ORDER BY` clause to sort rows. - -## Example Of Use {#table_engines-stripelog-example-of-use} - -Creating a table: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -Inserting data: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -We used two `INSERT` queries to create two data blocks inside the `data.bin` file. - -ClickHouse uses multiple threads when selecting data. Each thread reads a separate data block and returns resulting rows independently as it finishes. As a result, the order of blocks of rows in the output does not match the order of the same blocks in the input in most cases. For example: - -``` sql -SELECT * FROM stripe_log_table -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -┌───────────timestamp─┬─message_type─┬─message───────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -└─────────────────────┴──────────────┴───────────────────────────┘ -``` - -Sorting the results (ascending order by default): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/en/engines/table_engines/log_family/tinylog.md b/docs/en/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index 7b91becc4d7..00000000000 --- a/docs/en/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -toc_priority: 34 -toc_title: TinyLog ---- - -# TinyLog {#tinylog} - -The engine belongs to the log engine family. See [Log Engine Family](log_family.md) for common properties of log engines and their differences. - -This table engine is typically used with the write-once method: write data one time, then read it as many times as necessary. For example, you can use `TinyLog`-type tables for intermediary data that is processed in small batches. Note that storing data in a large number of small tables is inefficient. - -Queries are executed in a single stream. In other words, this engine is intended for relatively small tables (up to about 1,000,000 rows). It makes sense to use this table engine if you have many small tables, since it’s simpler than the [Log](log.md) engine (fewer files need to be opened). - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/en/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/en/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index 9e310d313b9..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -toc_priority: 35 -toc_title: AggregatingMergeTree ---- - -# Aggregatingmergetree {#aggregatingmergetree} - -The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree), altering the logic for data parts merging. ClickHouse replaces all rows with the same primary key (or more accurately, with the same [sorting key](mergetree.md)) with a single row (within a one data part) that stores a combination of states of aggregate functions. - -You can use `AggregatingMergeTree` tables for incremental data aggregation, including for aggregated materialized views. - -The engine processes all columns with the following types: - -- [AggregateFunction](../../../sql_reference/data_types/aggregatefunction.md) -- [SimpleAggregateFunction](../../../sql_reference/data_types/simpleaggregatefunction.md) - -It is appropriate to use `AggregatingMergeTree` if it reduces the number of rows by orders. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[TTL expr] -[SETTINGS name=value, ...] -``` - -For a description of request parameters, see [request description](../../../sql_reference/statements/create.md). - -**Query clauses** - -When creating a `AggregatingMergeTree` table the same [clauses](mergetree.md) are required, as when creating a `MergeTree` table. - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects and, if possible, switch the old projects to the method described above. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -All of the parameters have the same meaning as in `MergeTree`. -
- -## SELECT and INSERT {#select-and-insert} - -To insert data, use [INSERT SELECT](../../../sql_reference/statements/insert_into.md) query with aggregate -State- functions. -When selecting data from `AggregatingMergeTree` table, use `GROUP BY` clause and the same aggregate functions as when inserting data, but using `-Merge` suffix. - -In the results of `SELECT` query, the values of `AggregateFunction` type have implementation-specific binary representation for all of the ClickHouse output formats. If dump data into, for example, `TabSeparated` format with `SELECT` query then this dump can be loaded back using `INSERT` query. - -## Example Of an Aggregated Materialized View {#example-of-an-aggregated-materialized-view} - -`AggregatingMergeTree` materialized view that watches the `test.visits` table: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -Inserting data into the `test.visits` table. - -``` sql -INSERT INTO test.visits ... -``` - -The data are inserted in both the table and view `test.basic` that will perform the aggregation. - -To get the aggregated data, we need to execute a query such as `SELECT ... GROUP BY ...` from the view `test.basic`: - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/en/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/en/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index 973377c0b58..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,307 +0,0 @@ ---- -toc_priority: 36 -toc_title: CollapsingMergeTree ---- - -# CollapsingMergeTree {#table_engine-collapsingmergetree} - -The engine inherits from [MergeTree](mergetree.md) and adds the logic of rows collapsing to data parts merge algorithm. - -`CollapsingMergeTree` asynchronously deletes (collapses) pairs of rows if all of the fields in a sorting key (`ORDER BY`) are equivalent excepting the particular field `Sign` which can have `1` and `-1` values. Rows without a pair are kept. For more details see the [Collapsing](#table_engine-collapsingmergetree-collapsing) section of the document. - -The engine may significantly reduce the volume of storage and increase the efficiency of `SELECT` query as a consequence. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -For a description of query parameters, see [query description](../../../sql_reference/statements/create.md). - -**CollapsingMergeTree Parameters** - -- `sign` — Name of the column with the type of row: `1` is a “state” row, `-1` is a “cancel” row. - - Column data type — `Int8`. - -**Query clauses** - -When creating a `CollapsingMergeTree` table, the same [query clauses](mergetree.md#table_engine-mergetree-creating-a-table) are required, as when creating a `MergeTree` table. - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects and, if possible, switch the old projects to the method described above. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -All of the parameters excepting `sign` have the same meaning as in `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` — “state” row, `-1` — “cancel” row. - - Column Data Type — `Int8`. - -
- -## Collapsing {#table_engine-collapsingmergetree-collapsing} - -### Data {#data} - -Consider the situation where you need to save continually changing data for some object. It sounds logical to have one row for an object and update it at any change, but update operation is expensive and slow for DBMS because it requires rewriting of the data in the storage. If you need to write data quickly, update not acceptable, but you can write the changes of an object sequentially as follows. - -Use the particular column `Sign`. If `Sign = 1` it means that the row is a state of an object, let’s call it “state” row. If `Sign = -1` it means the cancellation of the state of an object with the same attributes, let’s call it “cancel” row. - -For example, we want to calculate how much pages users checked at some site and how long they were there. At some moment we write the following row with the state of user activity: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -At some moment later we register the change of user activity and write it with the following two rows. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -The first row cancels the previous state of the object (user). It should copy the sorting key fields of the cancelled state excepting `Sign`. - -The second row contains the current state. - -As we need only the last state of user activity, the rows - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -can be deleted collapsing the invalid (old) state of an object. `CollapsingMergeTree` does this while merging of the data parts. - -Why we need 2 rows for each change read in the [Algorithm](#table_engine-collapsingmergetree-collapsing-algorithm) paragraph. - -**Peculiar properties of such approach** - -1. The program that writes the data should remember the state of an object to be able to cancel it. “Cancel” string should contain copies of the sorting key fields of the “state” string and the opposite `Sign`. It increases the initial size of storage but allows to write the data quickly. -2. Long growing arrays in columns reduce the efficiency of the engine due to load for writing. The more straightforward data, the higher the efficiency. -3. The `SELECT` results depend strongly on the consistency of object changes history. Be accurate when preparing data for inserting. You can get unpredictable results in inconsistent data, for example, negative values for non-negative metrics such as session depth. - -### Algorithm {#table_engine-collapsingmergetree-collapsing-algorithm} - -When ClickHouse merges data parts, each group of consecutive rows with the same sorting key (`ORDER BY`) is reduced to not more than two rows, one with `Sign = 1` (“state” row) and another with `Sign = -1` (“cancel” row). In other words, entries collapse. - -For each resulting data part ClickHouse saves: - -1. The first “cancel” and the last “state” rows, if the number of “state” and “cancel” rows matches and the last row is a “state” row. - -2. The last “state” row, if there are more “state” rows than “cancel” rows. - -3. The first “cancel” row, if there are more “cancel” rows than “state” rows. - -4. None of the rows, in all other cases. - -Also when there are at least 2 more “state” rows than “cancel” rows, or at least 2 more “cancel” rows then “state” rows, the merge continues, but ClickHouse treats this situation as a logical error and records it in the server log. This error can occur if the same data were inserted more than once. - -Thus, collapsing should not change the results of calculating statistics. -Changes gradually collapsed so that in the end only the last state of almost every object left. - -The `Sign` is required because the merging algorithm doesn’t guarantee that all of the rows with the same sorting key will be in the same resulting data part and even on the same physical server. ClickHouse process `SELECT` queries with multiple threads, and it can not predict the order of rows in the result. The aggregation is required if there is a need to get completely “collapsed” data from `CollapsingMergeTree` table. - -To finalize collapsing, write a query with `GROUP BY` clause and aggregate functions that account for the sign. For example, to calculate quantity, use `sum(Sign)` instead of `count()`. To calculate the sum of something, use `sum(Sign * x)` instead of `sum(x)`, and so on, and also add `HAVING sum(Sign) > 0`. - -The aggregates `count`, `sum` and `avg` could be calculated this way. The aggregate `uniq` could be calculated if an object has at least one state not collapsed. The aggregates `min` and `max` could not be calculated because `CollapsingMergeTree` does not save the values history of the collapsed states. - -If you need to extract data without aggregation (for example, to check whether rows are present whose newest values match certain conditions), you can use the `FINAL` modifier for the `FROM` clause. This approach is significantly less efficient. - -## Example Of Use {#example-of-use} - -Example data: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Creation of the table: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Insertion of the data: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -We use two `INSERT` queries to create two different data parts. If we insert the data with one query ClickHouse creates one data part and will not perform any merge ever. - -Getting the data: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -What do we see and where is collapsing? - -With two `INSERT` queries, we created 2 data parts. The `SELECT` query was performed in 2 threads, and we got a random order of rows. Collapsing not occurred because there was no merge of the data parts yet. ClickHouse merges data part in an unknown moment which we can not predict. - -Thus we need aggregation: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -If we do not need aggregation and want to force collapsing, we can use `FINAL` modifier for `FROM` clause. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -This way of selecting the data is very inefficient. Don’t use it for big tables. - -## Example Of Another Approach {#example-of-another-approach} - -Example data: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ -5 │ -146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -The idea is that merges take into account only key fields. And in the “Cancel” line we can specify negative values that equalize the previous version of the row when summing without using the Sign column. For this approach, it is necessary to change the data type `PageViews`,`Duration` to store negative values of UInt8 -\> Int16. - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews Int16, - Duration Int16, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Let’s test the approach: - -``` sql -insert into UAct values(4324182021466249494, 5, 146, 1); -insert into UAct values(4324182021466249494, -5, -146, -1); -insert into UAct values(4324182021466249494, 6, 185, 1); - -select * from UAct final; // avoid using final in production (just for a test or small tables) -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -``` sql -SELECT - UserID, - sum(PageViews) AS PageViews, - sum(Duration) AS Duration -FROM UAct -GROUP BY UserID -```text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -``` sqk -select count() FROM UAct -``` - -``` text -┌─count()─┐ -│ 3 │ -└─────────┘ -``` - -``` sql -optimize table UAct final; - -select * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) 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 deleted file mode 100644 index 0d5891955a9..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -toc_priority: 32 -toc_title: Custom Partitioning Key ---- - -# Custom Partitioning Key {#custom-partitioning-key} - -Partitioning is available for the [MergeTree](mergetree.md) family tables (including [replicated](replication.md) tables). [Materialized views](../special/materializedview.md) based on MergeTree tables support partitioning, as well. - -A partition is a logical combination of records in a table by a specified criterion. You can set a partition by an arbitrary criterion, such as by month, by day, or by event type. Each partition is stored separately to simplify manipulations of this data. When accessing the data, ClickHouse uses the smallest subset of partitions possible. - -The partition is specified in the `PARTITION BY expr` clause when [creating a table](mergetree.md#table_engine-mergetree-creating-a-table). The partition key can be any expression from the table columns. For example, to specify partitioning by month, use the expression `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour; -``` - -The partition key can also be a tuple of expressions (similar to the [primary key](mergetree.md#primary-keys-and-indexes-in-queries)). For example: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -In this example, we set partitioning by the event types that occurred during the current week. - -When inserting new data to a table, this data is stored as a separate part (chunk) sorted by the primary key. In 10-15 minutes after inserting, the parts of the same partition are merged into the entire part. - -!!! info "Info" - A merge only works for data parts that have the same value for the partitioning expression. This means **you shouldn’t make overly granular partitions** (more than about a thousand partitions). Otherwise, the `SELECT` query performs poorly because of an unreasonably large number of files in the file system and open file descriptors. - -Use the [system.parts](../../../operations/system_tables.md#system_tables-parts) table to view the table parts and partitions. For example, let’s assume that we have a `visits` table with partitioning by month. Let’s perform the `SELECT` query for the `system.parts` table: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 1 │ -│ 201902 │ 201902_11_11_0 │ 1 │ -└───────────┴────────────────┴────────┘ -``` - -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](#alter_manipulations-with-partitions) 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](#alter_attach-partition) query. - -Let’s break down the name of the first part: `201901_1_3_1`: - -- `201901` is the partition name. -- `1` is the minimum number of the data block. -- `3` is the maximum number of the data block. -- `1` is the chunk level (the depth of the merge tree it is formed from). - -!!! info "Info" - The parts of old-type tables have the name: `20190117_20190123_2_2_0` (minimum date - maximum date - minimum block number - maximum block number - level). - -The `active` column shows the status of the part. `1` is active; `0` is inactive. The inactive parts are, for example, source parts remaining after merging to a larger part. The corrupted data parts are also indicated as inactive. - -As you can see in the example, there are several separated parts of the same partition (for example, `201901_1_3_1` and `201901_1_9_2`). This means that these parts are not merged yet. ClickHouse merges the inserted parts of data periodically, approximately 15 minutes after inserting. In addition, you can perform a non-scheduled merge using the [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) query. Example: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 0 │ -│ 201902 │ 201902_4_11_2 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 0 │ -│ 201902 │ 201902_11_11_0 │ 0 │ -└───────────┴────────────────┴────────┘ -``` - -Inactive parts will be deleted approximately 10 minutes after merging. - -Another way to view a set of parts and partitions is to go into the directory of the table: `/var/lib/clickhouse/data///`. For example: - -``` bash -/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -The folders ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ and so on are the directories of the parts. Each part relates to a corresponding partition and contains data just for a certain month (the table in this example has partitioning by month). - -The `detached` directory contains parts that were detached from the table using the [DETACH](#alter_detach-partition) query. The corrupted parts are also moved to this directory, instead of being deleted. The server does not use the parts from the `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql_reference/statements/alter.md#alter_attach-partition) query. - -Note that on the operating server, you cannot manually change the set of parts or their data on the file system, since the server will not know about it. For non-replicated tables, you can do this when the server is stopped, but it isn’t recommended. For replicated tables, the set of parts cannot be changed in any case. - -ClickHouse allows you to perform operations with the partitions: delete them, copy from one table to another, or create a backup. See the list of all operations in the section [Manipulations With Partitions and Parts](../../../sql_reference/statements/alter.md#alter_manipulations-with-partitions). - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/en/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/en/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index ebfdfe4685a..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,172 +0,0 @@ ---- -toc_priority: 38 -toc_title: GraphiteMergeTree ---- - -# GraphiteMergeTree {#graphitemergetree} - -This engine is designed for thinning and aggregating/averaging (rollup) [Graphite](http://graphite.readthedocs.io/en/latest/index.html) data. It may be helpful to developers who want to use ClickHouse as a data store for Graphite. - -You can use any ClickHouse table engine to store the Graphite data if you don’t need rollup, but if you need a rollup use `GraphiteMergeTree`. The engine reduces the volume of storage and increases the efficiency of queries from Graphite. - -The engine inherits properties from [MergeTree](mergetree.md). - -## Creating a Table {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -See a detailed description of the [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) query. - -A table for the Graphite data should have the following columns for the following data: - -- Metric name (Graphite sensor). Data type: `String`. - -- Time of measuring the metric. Data type: `DateTime`. - -- Value of the metric. Data type: any numeric. - -- Version of the metric. Data type: any numeric. - - ClickHouse saves the rows with the highest version or the last written if versions are the same. Other rows are deleted during the merge of data parts. - -The names of these columns should be set in the rollup configuration. - -**GraphiteMergeTree parameters** - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -**Query clauses** - -When creating a `GraphiteMergeTree` table, the same [clauses](mergetree.md#table_engine-mergetree-creating-a-table) are required, as when creating a `MergeTree` table. - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects and, if possible, switch the old projects to the method described above. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -All of the parameters excepting `config_section` have the same meaning as in `MergeTree`. - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -
- -## Rollup Configuration {#rollup-configuration} - -The settings for rollup are defined by the [graphite\_rollup](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) parameter in the server configuration. The name of the parameter could be any. You can create several configurations and use them for different tables. - -Rollup configuration structure: - - required-columns - patterns - -### Required Columns {#required-columns} - -- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. -- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. -- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Default value: `Value`. -- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. - -### Patterns {#patterns} - -Structure of the `patterns` section: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "Attention" - Patterns must be strictly ordered: - - 1. Patterns without `function` or `retention`. - 1. Patterns with both `function` and `retention`. - 1. Pattern `default`. - -When processing a row, ClickHouse checks the rules in the `pattern` sections. Each of `pattern` (including `default`) sections can contain `function` parameter for aggregation, `retention` parameters or both. If the metric name matches the `regexp`, the rules from the `pattern` section (or sections) are applied; otherwise, the rules from the `default` section are used. - -Fields for `pattern` and `default` sections: - -- `regexp`– A pattern for the metric name. -- `age` – The minimum age of the data in seconds. -- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). -- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. - -### Configuration Example {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/en/engines/table_engines/mergetree_family/index.md b/docs/en/engines/table_engines/mergetree_family/index.md deleted file mode 100644 index 6a23ef23a8e..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: MergeTree Family -toc_priority: 28 ---- - diff --git a/docs/en/engines/table_engines/mergetree_family/mergetree.md b/docs/en/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index d7b624fa2f7..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,652 +0,0 @@ ---- -toc_priority: 30 -toc_title: MergeTree ---- - -# MergeTree {#table_engines-mergetree} - -The `MergeTree` engine and other engines of this family (`*MergeTree`) are the most robust ClickHouse table engines. - -Engines in the `MergeTree` family are designed for inserting a very large amount of data into a table. The data is quickly written to the table part by part, then rules are applied for merging the parts in the background. This method is much more efficient than continually rewriting the data in storage during insert. - -Main features: - -- Stores data sorted by primary key. - - This allows you to create a small sparse index that helps find data faster. - -- Partitions can be used if the [partitioning key](custom_partitioning_key.md) is specified. - - ClickHouse supports certain operations with partitions that are more effective than general operations on the same data with the same result. ClickHouse also automatically cuts off the partition data where the partitioning key is specified in the query. This also improves query performance. - -- Data replication support. - - The family of `ReplicatedMergeTree` tables provides data replication. For more information, see [Data replication](replication.md). - -- Data sampling support. - - If necessary, you can set the data sampling method in the table. - -!!! info "Info" - The [Merge](../special/merge.md) engine does not belong to the `*MergeTree` family. - -## Creating a Table {#table_engine-mergetree-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 -) ENGINE = MergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] -[SETTINGS name=value, ...] -``` - -For a description of parameters, see the [CREATE query description](../../../sql_reference/statements/create.md). - -!!! note "Note" - `INDEX` is an experimental feature, see [Data Skipping Indexes](#table_engine-mergetree-data_skipping-indexes). - -### Query Clauses {#mergetree-query-clauses} - -- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. The `MergeTree` engine does not have parameters. - -- `PARTITION BY` — The [partitioning key](custom_partitioning_key.md). - - For partitioning by month, use the `toYYYYMM(date_column)` expression, where `date_column` is a column with a date of the type [Date](../../../sql_reference/data_types/date.md). The partition names here have the `"YYYYMM"` format. - -- `ORDER BY` — The sorting key. - - A tuple of columns or arbitrary expressions. Example: `ORDER BY (CounterID, EventDate)`. - -- `PRIMARY KEY` — The primary key if it [differs from the sorting key](#choosing-a-primary-key-that-differs-from-the-sorting-key). - - By default the primary key is the same as the sorting key (which is specified by the `ORDER BY` clause). Thus in most cases it is unnecessary to specify a separate `PRIMARY KEY` clause. - -- `SAMPLE BY` — An expression for sampling. - - If a sampling expression is used, the primary key must contain it. Example: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. - -- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [between disks and volumes](#table_engine-mergetree-multiple-volumes). - - Expression must have one `Date` or `DateTime` column as a result. Example: - `TTL date + INTERVAL 1 DAY` - - Type of the rule `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` specifies an action to be done with the part if the expression is satisfied (reaches current time): removal of expired rows, moving a part (if expression is satisfied for all rows in a part) to specified disk (`TO DISK 'xxx'`) or to volume (`TO VOLUME 'xxx'`). Default type of the rule is removal (`DELETE`). List of multiple rules can specified, but there should be no more than one `DELETE` rule. - - For more details, see [TTL for columns and tables](#table_engine-mergetree-ttl) - -- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: - - - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Data Storage](#mergetree-data-storage). - - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Data Storage](#mergetree-data-storage). - - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` setting. Before version 19.11, there was only the `index_granularity` setting for restricting granule size. The `index_granularity_bytes` setting improves ClickHouse performance when selecting data from tables with big rows (tens and hundreds of megabytes). If you have tables with big rows, you can enable this setting for the tables to improve the efficiency of `SELECT` queries. - - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, then ZooKeeper stores less data. For more information, see the [setting description](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) in “Server configuration parameters”. - - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` bytes, ClickHouse reads and writes the data to the storage disk using the direct I/O interface (`O_DIRECT` option). If `min_merge_bytes_to_use_direct_io = 0`, then direct I/O is disabled. Default value: `10 * 1024 * 1024 * 1024` bytes. - - - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). - - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don’t turn it off. - - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. - - `storage_policy` — Storage policy. See [Using Multiple Block Devices for Data Storage](#table_engine-mergetree-multiple-volumes). - -**Example of Sections Setting** - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 -``` - -In the example, we set partitioning by month. - -We also set an expression for sampling as a hash by the user ID. This allows you to pseudorandomize the data in the table for each `CounterID` and `EventDate`. If you define a [SAMPLE](../../../sql_reference/statements/select.md#select-sample-clause) clause when selecting the data, ClickHouse will return an evenly pseudorandom data sample for a subset of users. - -The `index_granularity` setting can be omitted because 8192 is the default value. - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects. If possible, switch old projects to the method described above. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -**MergeTree() Parameters** - -- `date-column` — The name of a column of the [Date](../../../sql_reference/data_types/date.md) type. ClickHouse automatically creates partitions by month based on this column. The partition names are in the `"YYYYMM"` format. -- `sampling_expression` — An expression for sampling. -- `(primary, key)` — Primary key. Type: [Tuple()](../../../sql_reference/data_types/tuple.md) -- `index_granularity` — The granularity of an index. The number of data rows between the “marks” of an index. The value 8192 is appropriate for most tasks. - -**Example** - -``` sql -MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) -``` - -The `MergeTree` engine is configured in the same way as in the example above for the main engine configuration method. -
- -## Data Storage {#mergetree-data-storage} - -A table consists of data parts sorted by primary key. - -When data is inserted in a table, separate data parts are created and each of them is lexicographically sorted by primary key. For example, if the primary key is `(CounterID, Date)`, the data in the part is sorted by `CounterID`, and within each `CounterID`, it is ordered by `Date`. - -Data belonging to different partitions are separated into different parts. In the background, ClickHouse merges data parts for more efficient storage. Parts belonging to different partitions are not merged. The merge mechanism does not guarantee that all rows with the same primary key will be in the same data part. - -Each data part is logically divided into granules. A granule is the smallest indivisible data set that ClickHouse reads when selecting data. ClickHouse doesn’t split rows or values, so each granule always contains an integer number of rows. The first row of a granule is marked with the value of the primary key for the row. For each data part, ClickHouse creates an index file that stores the marks. For each column, whether it’s in the primary key or not, ClickHouse also stores the same marks. These marks let you find data directly in column files. - -The granule size is restricted by the `index_granularity` and `index_granularity_bytes` settings of the table engine. The number of rows in a granule lays in the `[1, index_granularity]` range, depending on the size of the rows. The size of a granule can exceed `index_granularity_bytes` if the size of a single row is greater than the value of the setting. In this case, the size of the granule equals the size of the row. - -## Primary Keys and Indexes In Queries {#primary-keys-and-indexes-in-queries} - -Take the `(CounterID, Date)` primary key as an example. In this case, the sorting and index can be illustrated as follows: - - Whole data: [---------------------------------------------] - CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] - Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] - Marks: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 - Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 - -If the data query specifies: - -- `CounterID in ('a', 'h')`, the server reads the data in the ranges of marks `[0, 3)` and `[6, 8)`. -- `CounterID IN ('a', 'h') AND Date = 3`, the server reads the data in the ranges of marks `[1, 3)` and `[7, 8)`. -- `Date = 3`, the server reads the data in the range of marks `[1, 10]`. - -The examples above show that it is always more effective to use an index than a full scan. - -A sparse index allows extra data to be read. When reading a single range of the primary key, up to `index_granularity * 2` extra rows in each data block can be read. - -Sparse indexes allow you to work with a very large number of table rows, because in most cases, such indexes fit in the computer’s RAM. - -ClickHouse does not require a unique primary key. You can insert multiple rows with the same primary key. - -### Selecting the Primary Key {#selecting-the-primary-key} - -The number of columns in the primary key is not explicitly limited. Depending on the data structure, you can include more or fewer columns in the primary key. This may: - -- Improve the performance of an index. - - If the primary key is `(a, b)`, then adding another column `c` will improve the performance if the following conditions are met: - - - There are queries with a condition on column `c`. - - Long data ranges (several times longer than the `index_granularity`) with identical values for `(a, b)` are common. In other words, when adding another column allows you to skip quite long data ranges. - -- Improve data compression. - - ClickHouse sorts data by primary key, so the higher the consistency, the better the compression. - -- Provide additional logic when merging data parts in the [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) and [SummingMergeTree](summingmergetree.md) engines. - - In this case it makes sense to specify the *sorting key* that is different from the primary key. - -A long primary key will negatively affect the insert performance and memory consumption, but extra columns in the primary key do not affect ClickHouse performance during `SELECT` queries. - -### Choosing a Primary Key That Differs From the Sorting Key {#choosing-a-primary-key-that-differs-from-the-sorting-key} - -It is possible to specify a primary key (an expression with values that are written in the index file for each mark) that is different from the sorting key (an expression for sorting the rows in data parts). In this case the primary key expression tuple must be a prefix of the sorting key expression tuple. - -This feature is helpful when using the [SummingMergeTree](summingmergetree.md) and -[AggregatingMergeTree](aggregatingmergetree.md) table engines. In a common case when using these engines, the table has two types of columns: *dimensions* and *measures*. Typical queries aggregate values of measure columns with arbitrary `GROUP BY` and filtering by dimensions. Because SummingMergeTree and AggregatingMergeTree aggregate rows with the same value of the sorting key, it is natural to add all dimensions to it. As a result, the key expression consists of a long list of columns and this list must be frequently updated with newly added dimensions. - -In this case it makes sense to leave only a few columns in the primary key that will provide efficient range scans and add the remaining dimension columns to the sorting key tuple. - -[ALTER](../../../sql_reference/statements/alter.md) of the sorting key is a lightweight operation because when a new column is simultaneously added to the table and to the sorting key, existing data parts don’t need to be changed. Since the old sorting key is a prefix of the new sorting key and there is no data in the newly added column, the data is sorted by both the old and new sorting keys at the moment of table modification. - -### Use Of Indexes and Partitions In Queries {#use-of-indexes-and-partitions-in-queries} - -For `SELECT` queries, ClickHouse analyzes whether an index can be used. An index can be used if the `WHERE/PREWHERE` clause has an expression (as one of the conjunction elements, or entirely) that represents an equality or inequality comparison operation, or if it has `IN` or `LIKE` with a fixed prefix on columns or expressions that are in the primary key or partitioning key, or on certain partially repetitive functions of these columns, or logical relationships of these expressions. - -Thus, it is possible to quickly run queries on one or many ranges of the primary key. In this example, queries will be fast when run for a specific tracking tag, for a specific tag and date range, for a specific tag and date, for multiple tags with a date range, and so on. - -Let’s look at the engine configured as follows: - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 - -In this case, in queries: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -ClickHouse will use the primary key index to trim improper data and the monthly partitioning key to trim partitions that are in improper date ranges. - -The queries above show that the index is used even for complex expressions. Reading from the table is organized so that using the index can’t be slower than a full scan. - -In the example below, the index can’t be used. - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -To check whether ClickHouse can use the index when running a query, use the settings [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) and [force\_primary\_key](../../../operations/settings/settings.md). - -The key for partitioning by month allows reading only those data blocks which contain dates from the proper range. In this case, the data block may contain data for many dates (up to an entire month). Within a block, data is sorted by primary key, which might not contain the date as the first column. Because of this, using a query with only a date condition that does not specify the primary key prefix will cause more data to be read than for a single date. - -### Use Of Index For Partially-monotonic Primary Keys {#use-of-index-for-partially-monotonic-primary-keys} - -Consider, for example, the days of the month. They form a [monotonic sequence](https://en.wikipedia.org/wiki/Monotonic_function) for one month, but not monotonic for more extended periods. This is a partially-monotonic sequence. If a user creates the table with partially-monotonic primary key, ClickHouse creates a sparse index as usual. When a user selects data from this kind of table, ClickHouse analyzes the query conditions. If the user wants to get data between two marks of the index and both these marks fall within one month, ClickHouse can use the index in this particular case because it can calculate the distance between the parameters of a query and index marks. - -ClickHouse cannot use an index if the values of the primary key in the query parameter range don’t represent a monotonic sequence. In this case, ClickHouse uses the full scan method. - -ClickHouse uses this logic not only for days of the month sequences, but for any primary key that represents a partially-monotonic sequence. - -### Data Skipping Indexes (experimental) {#table_engine-mergetree-data_skipping-indexes} - -The index declaration is in the columns section of the `CREATE` query. - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -For tables from the `*MergeTree` family, data skipping indices can be specified. - -These indices aggregate some information about the specified expression on blocks, which consist of `granularity_value` granules (the size of the granule is specified using the `index_granularity` setting in the table engine). Then these aggregates are used in `SELECT` queries for reducing the amount of data to read from the disk by skipping big blocks of data where the `where` query cannot be satisfied. - -**Example** - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -Indices from the example can be used by ClickHouse to reduce the amount of data to read from disk in the following queries: - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### Available Types Of Indices {#available-types-of-indices} - -- `minmax` - - Stores extremes of the specified expression (if the expression is `tuple`, then it stores extremes for each element of `tuple`), uses stored info for skipping blocks of data like the primary key. - -- `set(max_rows)` - - Stores unique values of the specified expression (no more than `max_rows` rows, `max_rows=0` means “no limits”). Uses the values to check if the `WHERE` expression is not satisfiable on a block of data. - -- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - Stores a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) that contains all ngrams from a block of data. Works only with strings. Can be used for optimization of `equals`, `like` and `in` expressions. - - - `n` — ngram size, - - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). - - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. - - `random_seed` — The seed for Bloom filter hash functions. - -- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - The same as `ngrambf_v1`, but stores tokens instead of ngrams. Tokens are sequences separated by non-alphanumeric characters. - -- `bloom_filter([false_positive])` — Stores a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) for the specified columns. - - The optional `false_positive` parameter is the probability of receiving a false positive response from the filter. Possible values: (0, 1). Default value: 0.025. - - Supported data types: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. - - The following functions can use it: [equals](../../../sql_reference/functions/comparison_functions.md), [notEquals](../../../sql_reference/functions/comparison_functions.md), [in](../../../sql_reference/functions/in_functions.md), [notIn](../../../sql_reference/functions/in_functions.md), [has](../../../sql_reference/functions/array_functions.md). - - - -``` sql -INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 -INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 -``` - -#### Functions Support {#functions-support} - -Conditions in the `WHERE` clause contains calls of the functions that operate with columns. If the column is a part of an index, ClickHouse tries to use this index when performing the functions. ClickHouse supports different subsets of functions for using indexes. - -The `set` index can be used with all functions. Function subsets for other indexes are shown in the table below. - -| Function (operator) / Index | primary key | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | -|------------------------------------------------------------------|---------|------|---------|---------|---------| -| [equals (=, ==)](../../../sql_reference/functions/comparison_functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notEquals(!=, \<\>)](../../../sql_reference/functions/comparison_functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [like](../../../sql_reference/functions/string_search_functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [notLike](../../../sql_reference/functions/string_search_functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [startsWith](../../../sql_reference/functions/string_functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [endsWith](../../../sql_reference/functions/string_functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [multiSearchAny](../../../sql_reference/functions/string_search_functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | -| [in](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notIn](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [less (\<)](../../../sql_reference/functions/comparison_functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [greater (\>)](../../../sql_reference/functions/comparison_functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [lessOrEquals (\<=)](../../../sql_reference/functions/comparison_functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [greaterOrEquals (\>=)](../../../sql_reference/functions/comparison_functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [empty](../../../sql_reference/functions/array_functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [notEmpty](../../../sql_reference/functions/array_functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | - -Functions with a constant argument that is less than ngram size can’t be used by `ngrambf_v1` for query optimization. - -Bloom filters can have false positive matches, so the `ngrambf_v1`, `tokenbf_v1`, and `bloom_filter` indexes can’t be used for optimizing queries where the result of a function is expected to be false, for example: - -- Can be optimized: - - `s LIKE '%test%'` - - `NOT s NOT LIKE '%test%'` - - `s = 1` - - `NOT s != 1` - - `startsWith(s, 'test')` -- Can’t be optimized: - - `NOT s LIKE '%test%'` - - `s NOT LIKE '%test%'` - - `NOT s = 1` - - `s != 1` - - `NOT startsWith(s, 'test')` - -## Concurrent Data Access {#concurrent-data-access} - -For concurrent table access, we use multi-versioning. In other words, when a table is simultaneously read and updated, data is read from a set of parts that is current at the time of the query. There are no lengthy locks. Inserts do not get in the way of read operations. - -Reading from a table is automatically parallelized. - -## TTL For Columns and Tables {#table_engine-mergetree-ttl} - -Determines the lifetime of values. - -The `TTL` clause can be set for the whole table and for each individual column. Table-level TTL can also specify logic of automatic move of data between disks and volumes. - -Expressions must evaluate to [Date](../../../sql_reference/data_types/date.md) or [DateTime](../../../sql_reference/data_types/datetime.md) data type. - -Example: - -``` sql -TTL time_column -TTL time_column + interval -``` - -To define `interval`, use [time interval](../../../sql_reference/operators.md#operators-datetime) operators. - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### Column TTL {#mergetree-column-ttl} - -When the values in the column expire, ClickHouse replaces them with the default values for the column data type. If all the column values in the data part expire, ClickHouse deletes this column from the data part in a filesystem. - -The `TTL` clause can’t be used for key columns. - -Examples: - -Creating a table with TTL - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -Adding TTL to a column of an existing table - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -Altering TTL of the column - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### Table TTL {#mergetree-table-ttl} - -Table can have an expression for removal of expired rows, and multiple expressions for automatic move of parts between [disks or volumes](#table_engine-mergetree-multiple-volumes). When rows in the table expire, ClickHouse deletes all corresponding rows. For parts moving feature, all rows of a part must satisfy the movement expression criteria. - -``` sql -TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... -``` - -Type of TTL rule may follow each TTL expression. It affects an action which is to be done once the expression is satisfied (reaches current time): - -- `DELETE` - delete expired rows (default action); -- `TO DISK 'aaa'` - move part to the disk `aaa`; -- `TO VOLUME 'bbb'` - move part to the disk `bbb`. - -Examples: - -Creating a table with TTL - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH [DELETE], - d + INTERVAL 1 WEEK TO VOLUME 'aaa', - d + INTERVAL 2 WEEK TO DISK 'bbb'; -``` - -Altering TTL of the table - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**Removing Data** - -Data with an expired TTL is removed when ClickHouse merges data parts. - -When ClickHouse see that data is expired, it performs an off-schedule merge. To control the frequency of such merges, you can set [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). If the value is too low, it will perform many off-schedule merges that may consume a lot of resources. - -If you perform the `SELECT` query between merges, you may get expired data. To avoid it, use the [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) query before `SELECT`. - -## Using Multiple Block Devices For Data Storage {#table_engine-mergetree-multiple-volumes} - -### Introduction {#introduction} - -`MergeTree` family table engines can store data on multiple block devices. For example, it can be useful when the data of a certain table are implicitly split into “hot” and “cold”. The most recent data is regularly requested but requires only a small amount of space. On the contrary, the fat-tailed historical data is requested rarely. If several disks are available, the “hot” data may be located on fast disks (for example, NVMe SSDs or in memory), while the “cold” data - on relatively slow ones (for example, HDD). - -Data part is the minimum movable unit for `MergeTree`-engine tables. The data belonging to one part are stored on one disk. Data parts can be moved between disks in the background (according to user settings) as well as by means of the [ALTER](../../../sql_reference/statements/alter.md#alter_move-partition) queries. - -### Terms {#terms} - -- Disk — Block device mounted to the filesystem. -- Default disk — Disk that stores the path specified in the [path](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) server setting. -- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). -- Storage policy — Set of volumes and the rules for moving data between them. - -The names given to the described entities can be found in the system tables, [system.storage\_policies](../../../operations/system_tables.md#system_tables-storage_policies) and [system.disks](../../../operations/system_tables.md#system_tables-disks). To apply one of the configured storage policies for a table, use the `storage_policy` setting of `MergeTree`-engine family tables. - -### Configuration {#table_engine-mergetree-multiple-volumes-configure} - -Disks, volumes and storage policies should be declared inside the `` tag either in the main file `config.xml` or in a distinct file in the `config.d` directory. - -Configuration structure: - -``` xml - - - - /mnt/fast_ssd/clickhouse/ - - - /mnt/hdd1/clickhouse/ - 10485760 - - - /mnt/hdd2/clickhouse/ - 10485760 - - - ... - - - ... - -``` - -Tags: - -- `` — Disk name. Names must be different for all disks. -- `path` — path under which a server will store data (`data` and `shadow` folders), should be terminated with ‘/’. -- `keep_free_space_bytes` — the amount of free disk space to be reserved. - -The order of the disk definition is not important. - -Storage policies configuration markup: - -``` xml - - ... - - - - - disk_name_from_disks_configuration - 1073741824 - - - - - - - 0.2 - - - - - - - - ... - -``` - -Tags: - -- `policy_name_N` — Policy name. Policy names must be unique. -- `volume_name_N` — Volume name. Volume names must be unique. -- `disk` — a disk within a volume. -- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. -- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). - -Cofiguration examples: - -``` xml - - ... - - - - - disk1 - disk2 - - - - - - - - fast_ssd - 1073741824 - - - disk1 - - - 0.2 - - - ... - -``` - -In given example, the `hdd_in_order` policy implements the [round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) approach. Thus this policy defines only one volume (`single`), the data parts are stored on all its disks in circular order. Such policy can be quite useful if there are several similar disks are mounted to the system, but RAID is not configured. Keep in mind that each individual disk drive is not reliable and you might want to compensate it with replication factor of 3 or more. - -If there are different kinds of disks available in the system, `moving_from_ssd_to_hdd` policy can be used instead. The volume `hot` consists of an SSD disk (`fast_ssd`), and the maximum size of a part that can be stored on this volume is 1GB. All the parts with the size larger than 1GB will be stored directly on the `cold` volume, which contains an HDD disk `disk1`. -Also, once the disk `fast_ssd` gets filled by more than 80%, data will be transferred to the `disk1` by a background process. - -The order of volume enumeration within a storage policy is important. Once a volume is overfilled, data are moved to the next one. The order of disk enumeration is important as well because data are stored on them in turns. - -When creating a table, one can apply one of the configured storage policies to it: - -``` sql -CREATE TABLE table_with_non_default_policy ( - EventDate Date, - OrderID UInt64, - BannerID UInt64, - SearchPhrase String -) ENGINE = MergeTree -ORDER BY (OrderID, BannerID) -PARTITION BY toYYYYMM(EventDate) -SETTINGS storage_policy = 'moving_from_ssd_to_hdd' -``` - -The `default` storage policy implies using only one volume, which consists of only one disk given in ``. Once a table is created, its storage policy cannot be changed. - -### Details {#details} - -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](../../../sql_reference/statements/alter.md#alter-mutations). -- When downloading from another replica. -- As a result of partition freezing [ALTER TABLE … FREEZE PARTITION](../../../sql_reference/statements/alter.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: - -1. The first volume (in the order of definition) that has enough disk space for storing a part (`unreserved_space > current_part_size`) and allows for storing parts of a given size (`max_data_part_size_bytes > current_part_size`) is chosen. -2. Within this volume, that disk is chosen that follows the one, which was used for storing the previous chunk of data, and that has free space more than the part size (`unreserved_space - keep_free_space_bytes > current_part_size`). - -Under the hood, mutations and partition freezing make use of [hard links](https://en.wikipedia.org/wiki/Hard_link). Hard links between different disks are not supported, therefore in such cases the resulting parts are stored on the same disks as the initial ones. - -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](../../../operations/system_tables.md#system_tables-part-log) (field `type = MOVE_PART`) and [system.parts](../../../operations/system_tables.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 …](../../../sql_reference/statements/alter.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. - -After the completion of background merges and mutations, old parts are removed only after a certain amount of time (`old_parts_lifetime`). -During this time, they are not moved to other volumes or disks. Therefore, until the parts are finally removed, they are still taken into account for evaluation of the occupied disk space. - -[Original article](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/en/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/en/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index 7fbd4edec68..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -toc_priority: 33 -toc_title: ReplacingMergeTree ---- - -# ReplacingMergeTree {#replacingmergetree} - -The engine differs from [MergeTree](mergetree.md#table_engines-mergetree) in that it removes duplicate entries with the same primary key value (or more accurately, with the same [sorting key](mergetree.md) value). - -Data deduplication occurs only during a merge. Merging occurs in the background at an unknown time, so you can’t plan for it. Some of the data may remain unprocessed. Although you can run an unscheduled merge using the `OPTIMIZE` query, don’t count on using it, because the `OPTIMIZE` query will read and write a large amount of data. - -Thus, `ReplacingMergeTree` is suitable for clearing out duplicate data in the background in order to save space, but it doesn’t guarantee the absence of duplicates. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -For a description of request parameters, see [request description](../../../sql_reference/statements/create.md). - -**ReplacingMergeTree Parameters** - -- `ver` — column with version. Type `UInt*`, `Date` or `DateTime`. Optional parameter. - - When merging, `ReplacingMergeTree` from all the rows with the same primary key leaves only one: - - - Last in the selection, if `ver` not set. - - With the maximum version, if `ver` specified. - -**Query clauses** - -When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md) are required, as when creating a `MergeTree` table. - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects and, if possible, switch the old projects to the method described above. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -All of the parameters excepting `ver` have the same meaning as in `MergeTree`. - -- `ver` - column with the version. Optional parameter. For a description, see the text above. - -
- -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/en/engines/table_engines/mergetree_family/replication.md b/docs/en/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index 9de68fdb9ed..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -toc_priority: 31 -toc_title: Data Replication ---- - -# Data Replication {#table_engines-replication} - -Replication is only supported for tables in the MergeTree family: - -- ReplicatedMergeTree -- ReplicatedSummingMergeTree -- ReplicatedReplacingMergeTree -- ReplicatedAggregatingMergeTree -- ReplicatedCollapsingMergeTree -- ReplicatedVersionedCollapsingMergeTree -- ReplicatedGraphiteMergeTree - -Replication works at the level of an individual table, not the entire server. A server can store both replicated and non-replicated tables at the same time. - -Replication does not depend on sharding. Each shard has its own independent replication. - -Compressed data for `INSERT` and `ALTER` queries is replicated (for more information, see the documentation for [ALTER](../../../sql_reference/statements/alter.md#query_language_queries_alter)). - -`CREATE`, `DROP`, `ATTACH`, `DETACH` and `RENAME` queries are executed on a single server and are not replicated: - -- The `CREATE TABLE` query creates a new replicatable table on the server where the query is run. If this table already exists on other servers, it adds a new replica. -- The `DROP TABLE` query deletes the replica located on the server where the query is run. -- The `RENAME` query renames the table on one of the replicas. In other words, replicated tables can have different names on different replicas. - -ClickHouse uses [Apache ZooKeeper](https://zookeeper.apache.org) for storing replicas meta information. Use ZooKeeper version 3.4.5 or newer. - -To use replication, set parameters in the [zookeeper](../../../operations/server_configuration_parameters/settings.md#server-settings_zookeeper) server configuration section. - -!!! attention "Attention" - Don’t neglect the security setting. ClickHouse supports the `digest` [ACL scheme](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) of the ZooKeeper security subsystem. - -Example of setting the addresses of the ZooKeeper cluster: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -You can specify any existing ZooKeeper cluster and the system will use a directory on it for its own data (the directory is specified when creating a replicatable table). - -If ZooKeeper isn’t set in the config file, you can’t create replicated tables, and any existing replicated tables will be read-only. - -ZooKeeper is not used in `SELECT` queries because replication does not affect the performance of `SELECT` and queries run just as fast as they do for non-replicated tables. When querying distributed replicated tables, ClickHouse behavior is controlled by the settings [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) and [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). - -For each `INSERT` query, approximately ten entries are added to ZooKeeper through several transactions. (To be more precise, this is for each inserted block of data; an INSERT query contains one block or one block per `max_insert_block_size = 1048576` rows.) This leads to slightly longer latencies for `INSERT` compared to non-replicated tables. But if you follow the recommendations to insert data in batches of no more than one `INSERT` per second, it doesn’t create any problems. The entire ClickHouse cluster used for coordinating one ZooKeeper cluster has a total of several hundred `INSERTs` per second. The throughput on data inserts (the number of rows per second) is just as high as for non-replicated data. - -For very large clusters, you can use different ZooKeeper clusters for different shards. However, this hasn’t proven necessary on the Yandex.Metrica cluster (approximately 300 servers). - -Replication is asynchronous and multi-master. `INSERT` queries (as well as `ALTER`) can be sent to any available server. Data is inserted on the server where the query is run, and then it is copied to the other servers. Because it is asynchronous, recently inserted data appears on the other replicas with some latency. If part of the replicas are not available, the data is written when they become available. If a replica is available, the latency is the amount of time it takes to transfer the block of compressed data over the network. - -By default, an INSERT query waits for confirmation of writing the data from only one replica. If the data was successfully written to only one replica and the server with this replica ceases to exist, the stored data will be lost. To enable getting confirmation of data writes from multiple replicas, use the `insert_quorum` option. - -Each block of data is written atomically. The INSERT query is divided into blocks up to `max_insert_block_size = 1048576` rows. In other words, if the `INSERT` query has less than 1048576 rows, it is made atomically. - -Data blocks are deduplicated. For multiple writes of the same data block (data blocks of the same size containing the same rows in the same order), the block is only written once. The reason for this is in case of network failures when the client application doesn’t know if the data was written to the DB, so the `INSERT` query can simply be repeated. It doesn’t matter which replica INSERTs were sent to with identical data. `INSERTs` are idempotent. Deduplication parameters are controlled by [merge\_tree](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-merge_tree) server settings. - -During replication, only the source data to insert is transferred over the network. Further data transformation (merging) is coordinated and performed on all the replicas in the same way. This minimizes network usage, which means that replication works well when replicas reside in different datacenters. (Note that duplicating data in different datacenters is the main goal of replication.) - -You can have any number of replicas of the same data. Yandex.Metrica uses double replication in production. Each server uses RAID-5 or RAID-6, and RAID-10 in some cases. This is a relatively reliable and convenient solution. - -The system monitors data synchronicity on replicas and is able to recover after a failure. Failover is automatic (for small differences in data) or semi-automatic (when data differs too much, which may indicate a configuration error). - -## Creating Replicated Tables {#creating-replicated-tables} - -The `Replicated` prefix is added to the table engine name. For example:`ReplicatedMergeTree`. - -**Replicated\*MergeTree parameters** - -- `zoo_path` — The path to the table in ZooKeeper. -- `replica_name` — The replica name in ZooKeeper. - -Example: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -
- -Example in deprecated syntax - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -
- -As the example shows, these parameters can contain substitutions in curly brackets. The substituted values are taken from the ‘macros’ section of the configuration file. Example: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -The path to the table in ZooKeeper should be unique for each replicated table. Tables on different shards should have different paths. -In this case, the path consists of the following parts: - -`/clickhouse/tables/` is the common prefix. We recommend using exactly this one. - -`{layer}-{shard}` is the shard identifier. In this example it consists of two parts, since the Yandex.Metrica cluster uses bi-level sharding. For most tasks, you can leave just the {shard} substitution, which will be expanded to the shard identifier. - -`table_name` is the name of the node for the table in ZooKeeper. It is a good idea to make it the same as the table name. It is defined explicitly, because in contrast to the table name, it doesn’t change after a RENAME query. -*HINT*: you could add a database name in front of `table_name` as well. E.g. `db_name.table_name` - -The replica name identifies different replicas of the same table. You can use the server name for this, as in the example. The name only needs to be unique within each shard. - -You can define the parameters explicitly instead of using substitutions. This might be convenient for testing and for configuring small clusters. However, you can’t use distributed DDL queries (`ON CLUSTER`) in this case. - -When working with large clusters, we recommend using substitutions because they reduce the probability of error. - -Run the `CREATE TABLE` query on each replica. This query creates a new replicated table, or adds a new replica to an existing one. - -If you add a new replica after the table already contains some data on other replicas, the data will be copied from the other replicas to the new one after running the query. In other words, the new replica syncs itself with the others. - -To delete a replica, run `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. - -## Recovery After Failures {#recovery-after-failures} - -If ZooKeeper is unavailable when a server starts, replicated tables switch to read-only mode. The system periodically attempts to connect to ZooKeeper. - -If ZooKeeper is unavailable during an `INSERT`, or an error occurs when interacting with ZooKeeper, an exception is thrown. - -After connecting to ZooKeeper, the system checks whether the set of data in the local file system matches the expected set of data (ZooKeeper stores this information). If there are minor inconsistencies, the system resolves them by syncing data with the replicas. - -If the system detects broken data parts (with the wrong size of files) or unrecognized parts (parts written to the file system but not recorded in ZooKeeper), it moves them to the `detached` subdirectory (they are not deleted). Any missing parts are copied from the replicas. - -Note that ClickHouse does not perform any destructive actions such as automatically deleting a large amount of data. - -When the server starts (or establishes a new session with ZooKeeper), it only checks the quantity and sizes of all files. If the file sizes match but bytes have been changed somewhere in the middle, this is not detected immediately, but only when attempting to read the data for a `SELECT` query. The query throws an exception about a non-matching checksum or size of a compressed block. In this case, data parts are added to the verification queue and copied from the replicas if necessary. - -If the local set of data differs too much from the expected one, a safety mechanism is triggered. The server enters this in the log and refuses to launch. The reason for this is that this case may indicate a configuration error, such as if a replica on a shard was accidentally configured like a replica on a different shard. However, the thresholds for this mechanism are set fairly low, and this situation might occur during normal failure recovery. In this case, data is restored semi-automatically - by “pushing a button”. - -To start recovery, create the node `/path_to_table/replica_name/flags/force_restore_data` in ZooKeeper with any content, or run the command to restore all replicated tables: - -``` bash -sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -Then restart the server. On start, the server deletes these flags and starts recovery. - -## Recovery After Complete Data Loss {#recovery-after-complete-data-loss} - -If all data and metadata disappeared from one of the servers, follow these steps for recovery: - -1. Install ClickHouse on the server. Define substitutions correctly in the config file that contains the shard identifier and replicas, if you use them. -2. If you had unreplicated tables that must be manually duplicated on the servers, copy their data from a replica (in the directory `/var/lib/clickhouse/data/db_name/table_name/`). -3. Copy table definitions located in `/var/lib/clickhouse/metadata/` from a replica. If a shard or replica identifier is defined explicitly in the table definitions, correct it so that it corresponds to this replica. (Alternatively, start the server and make all the `ATTACH TABLE` queries that should have been in the .sql files in `/var/lib/clickhouse/metadata/`.) -4. To start recovery, create the ZooKeeper node `/path_to_table/replica_name/flags/force_restore_data` with any content, or run the command to restore all replicated tables: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -Then start the server (restart, if it is already running). Data will be downloaded from replicas. - -An alternative recovery option is to delete information about the lost replica from ZooKeeper (`/path_to_table/replica_name`), then create the replica again as described in “[Creating replicated tables](#creating-replicated-tables)”. - -There is no restriction on network bandwidth during recovery. Keep this in mind if you are restoring many replicas at once. - -## Converting From MergeTree To ReplicatedMergeTree {#converting-from-mergetree-to-replicatedmergetree} - -We use the term `MergeTree` to refer to all table engines in the `MergeTree family`, the same as for `ReplicatedMergeTree`. - -If you had a `MergeTree` table that was manually replicated, you can convert it to a replicated table. You might need to do this if you have already collected a large amount of data in a `MergeTree` table and now you want to enable replication. - -If the data differs on various replicas, first sync it, or delete this data on all the replicas except one. - -Rename the existing MergeTree table, then create a `ReplicatedMergeTree` table with the old name. -Move the data from the old table to the `detached` subdirectory inside the directory with the new table data (`/var/lib/clickhouse/data/db_name/table_name/`). -Then run `ALTER TABLE ATTACH PARTITION` on one of the replicas to add these data parts to the working set. - -## Converting From ReplicatedMergeTree To MergeTree {#converting-from-replicatedmergetree-to-mergetree} - -Create a MergeTree table with a different name. Move all the data from the directory with the `ReplicatedMergeTree` table data to the new table’s data directory. Then delete the `ReplicatedMergeTree` table and restart the server. - -If you want to get rid of a `ReplicatedMergeTree` table without launching the server: - -- Delete the corresponding `.sql` file in the metadata directory (`/var/lib/clickhouse/metadata/`). -- Delete the corresponding path in ZooKeeper (`/path_to_table/replica_name`). - -After this, you can launch the server, create a `MergeTree` table, move the data to its directory, and then restart the server. - -## Recovery When Metadata In The Zookeeper Cluster Is Lost or Damaged {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} - -If the data in ZooKeeper was lost or damaged, you can save data by moving it to an unreplicated table as described above. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/en/engines/table_engines/mergetree_family/summingmergetree.md b/docs/en/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index c8f76b60c53..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -toc_priority: 34 -toc_title: SummingMergeTree ---- - -# SummingMergeTree {#summingmergetree} - -The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree). The difference is that when merging data parts for `SummingMergeTree` tables ClickHouse replaces all the rows with the same primary key (or more accurately, with the same [sorting key](mergetree.md)) with one row which contains summarized values for the columns with the numeric data type. If the sorting key is composed in a way that a single key value corresponds to large number of rows, this significantly reduces storage volume and speeds up data selection. - -We recommend to use the engine together with `MergeTree`. Store complete data in `MergeTree` table, and use `SummingMergeTree` for aggregated data storing, for example, when preparing reports. Such an approach will prevent you from losing valuable data due to an incorrectly composed primary key. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = SummingMergeTree([columns]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -For a description of request parameters, see [request description](../../../sql_reference/statements/create.md). - -**Parameters of SummingMergeTree** - -- `columns` - a tuple with the names of columns where values will be summarized. Optional parameter. - The columns must be of a numeric type and must not be in the primary key. - - If `columns` not specified, ClickHouse summarizes the values in all columns with a numeric data type that are not in the primary key. - -**Query clauses** - -When creating a `SummingMergeTree` table the same [clauses](mergetree.md) are required, as when creating a `MergeTree` table. - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects and, if possible, switch the old projects to the method described above. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) -``` - -All of the parameters excepting `columns` have the same meaning as in `MergeTree`. - -- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. - -
- -## Usage Example {#usage-example} - -Consider the following table: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -Insert data to it: - -``` sql -INSERT INTO summtt Values(1,1),(1,2),(2,1) -``` - -ClickHouse may sum all the rows not completely ([see below](#data-processing)), so we use an aggregate function `sum` and `GROUP BY` clause in the query. - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - -``` text -┌─key─┬─sum(value)─┐ -│ 2 │ 1 │ -│ 1 │ 3 │ -└─────┴────────────┘ -``` - -## Data Processing {#data-processing} - -When data are inserted into a table, they are saved as-is. ClickHouse merges the inserted parts of data periodically and this is when rows with the same primary key are summed and replaced with one for each resulting part of data. - -ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) an aggregate function [sum()](../../../sql_reference/aggregate_functions/reference.md#agg_function-sum) and `GROUP BY` clause should be used in a query as described in the example above. - -### Common Rules For Summation {#common-rules-for-summation} - -The values in the columns with the numeric data type are summarized. The set of columns is defined by the parameter `columns`. - -If the values were 0 in all of the columns for summation, the row is deleted. - -If column is not in the primary key and is not summarized, an arbitrary value is selected from the existing ones. - -The values are not summarized for columns in the primary key. - -### The Summation In the Aggregatefunction Columns {#the-summation-in-the-aggregatefunction-columns} - -For columns of [AggregateFunction type](../../../sql_reference/data_types/aggregatefunction.md) ClickHouse behaves as [AggregatingMergeTree](aggregatingmergetree.md) engine aggregating according to the function. - -### Nested Structures {#nested-structures} - -Table can have nested data structures that are processed in a special way. - -If the name of a nested table ends with `Map` and it contains at least two columns that meet the following criteria: - -- the first column is numeric `(*Int*, Date, DateTime)` or a string `(String, FixedString)`, let’s call it `key`, -- the other columns are arithmetic `(*Int*, Float32/64)`, let’s call it `(values...)`, - -then this nested table is interpreted as a mapping of `key => (values...)`, and when merging its rows, the elements of two data sets are merged by `key` with a summation of the corresponding `(values...)`. - -Examples: - -``` text -[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] -[(1, 100)] + [(1, 150)] -> [(1, 250)] -[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] -[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] -``` - -When requesting data, use the [sumMap(key, value)](../../../sql_reference/aggregate_functions/reference.md) function for aggregation of `Map`. - -For nested data structure, you do not need to specify its columns in the tuple of columns for summation. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/en/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/en/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index f9a95dbd626..00000000000 --- a/docs/en/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,236 +0,0 @@ ---- -toc_priority: 37 -toc_title: VersionedCollapsingMergeTree ---- - -# VersionedCollapsingMergeTree {#versionedcollapsingmergetree} - -This engine: - -- Allows quick writing of object states that are continually changing. -- Deletes old object states in the background. This significantly reduces the volume of storage. - -See the section [Collapsing](#table_engines_versionedcollapsingmergetree) for details. - -The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree) and adds the logic for collapsing rows to the algorithm for merging data parts. `VersionedCollapsingMergeTree` serves the same purpose as [CollapsingMergeTree](collapsingmergetree.md) but uses a different collapsing algorithm that allows inserting the data in any order with multiple threads. In particular, the `Version` column helps to collapse the rows properly even if they are inserted in the wrong order. In contrast, `CollapsingMergeTree` allows only strictly consecutive insertion. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -For a description of query parameters, see the [query description](../../../sql_reference/statements/create.md). - -**Engine Parameters** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Name of the column with the type of row: `1` is a “state” row, `-1` is a “cancel” row. - - The column data type should be `Int8`. - -- `version` — Name of the column with the version of the object state. - - The column data type should be `UInt*`. - -**Query Clauses** - -When creating a `VersionedCollapsingMergeTree` table, the same [clauses](mergetree.md) are required as when creating a `MergeTree` table. - -
- -Deprecated Method for Creating a Table - -!!! attention "Attention" - Do not use this method in new projects. If possible, switch the old projects to the method described above. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -All of the parameters except `sign` and `version` have the same meaning as in `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` is a “state” row, `-1` is a “cancel” row. - - Column Data Type — `Int8`. - -- `version` — Name of the column with the version of the object state. - - The column data type should be `UInt*`. - -
- -## Collapsing {#table_engines-versionedcollapsingmergetree} - -### Data {#data} - -Consider a situation where you need to save continually changing data for some object. It is reasonable to have one row for an object and update the row whenever there are changes. However, the update operation is expensive and slow for a DBMS because it requires rewriting the data in the storage. Update is not acceptable if you need to write data quickly, but you can write the changes to an object sequentially as follows. - -Use the `Sign` column when writing the row. If `Sign = 1` it means that the row is a state of an object (let’s call it the “state” row). If `Sign = -1` it indicates the cancellation of the state of an object with the same attributes (let’s call it the “cancel” row). Also use the `Version` column, which should identify each state of an object with a separate number. - -For example, we want to calculate how many pages users visited on some site and how long they were there. At some point in time we write the following row with the state of user activity: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -At some point later we register the change of user activity and write it with the following two rows. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -The first row cancels the previous state of the object (user). It should copy all of the fields of the canceled state except `Sign`. - -The second row contains the current state. - -Because we need only the last state of user activity, the rows - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -can be deleted, collapsing the invalid (old) state of the object. `VersionedCollapsingMergeTree` does this while merging the data parts. - -To find out why we need two rows for each change, see [Algorithm](#table_engines-versionedcollapsingmergetree-algorithm). - -**Notes on Usage** - -1. The program that writes the data should remember the state of an object in order to cancel it. The “cancel” string should be a copy of the “state” string with the opposite `Sign`. This increases the initial size of storage but allows to write the data quickly. -2. Long growing arrays in columns reduce the efficiency of the engine due to the load for writing. The more straightforward the data, the better the efficiency. -3. `SELECT` results depend strongly on the consistency of the history of object changes. Be accurate when preparing data for inserting. You can get unpredictable results with inconsistent data, such as negative values for non-negative metrics like session depth. - -### Algorithm {#table_engines-versionedcollapsingmergetree-algorithm} - -When ClickHouse merges data parts, it deletes each pair of rows that have the same primary key and version and different `Sign`. The order of rows does not matter. - -When ClickHouse inserts data, it orders rows by the primary key. If the `Version` column is not in the primary key, ClickHouse adds it to the primary key implicitly as the last field and uses it for ordering. - -## Selecting Data {#selecting-data} - -ClickHouse doesn’t guarantee that all of the rows with the same primary key will be in the same resulting data part or even on the same physical server. This is true both for writing the data and for subsequent merging of the data parts. In addition, ClickHouse processes `SELECT` queries with multiple threads, and it cannot predict the order of rows in the result. This means that aggregation is required if there is a need to get completely “collapsed” data from a `VersionedCollapsingMergeTree` table. - -To finalize collapsing, write a query with a `GROUP BY` clause and aggregate functions that account for the sign. For example, to calculate quantity, use `sum(Sign)` instead of `count()`. To calculate the sum of something, use `sum(Sign * x)` instead of `sum(x)`, and add `HAVING sum(Sign) > 0`. - -The aggregates `count`, `sum` and `avg` can be calculated this way. The aggregate `uniq` can be calculated if an object has at least one non-collapsed state. The aggregates `min` and `max` can’t be calculated because `VersionedCollapsingMergeTree` does not save the history of values of collapsed states. - -If you need to extract the data with “collapsing” but without aggregation (for example, to check whether rows are present whose newest values match certain conditions), you can use the `FINAL` modifier for the `FROM` clause. This approach is inefficient and should not be used with large tables. - -## Example Of Use {#example-of-use} - -Example data: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Creating the table: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -Inserting the data: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -We use two `INSERT` queries to create two different data parts. If we insert the data with a single query, ClickHouse creates one data part and will never perform any merge. - -Getting the data: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -What do we see here and where are the collapsed parts? -We created two data parts using two `INSERT` queries. The `SELECT` query was performed in two threads, and the result is a random order of rows. -Collapsing did not occur because the data parts have not been merged yet. ClickHouse merges data parts at an unknown point in time which we cannot predict. - -This is why we need aggregation: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -If we don’t need aggregation and want to force collapsing, we can use the `FINAL` modifier for the `FROM` clause. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -This is a very inefficient way to select data. Don’t use it for large tables. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/en/engines/table_engines/special/dictionary.md b/docs/en/engines/table_engines/special/dictionary.md deleted file mode 100644 index 86b8214c8e5..00000000000 --- a/docs/en/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -toc_priority: 35 -toc_title: Dictionary ---- - -# Dictionary {#dictionary} - -The `Dictionary` engine displays the [dictionary](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) data as a ClickHouse table. - -As an example, consider a dictionary of `products` with the following configuration: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -Query the dictionary data: - -``` sql -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - -``` text -┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ -│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ -└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ -``` - -You can use the [dictGet\*](../../../sql_reference/functions/ext_dict_functions.md#ext_dict_functions) function to get the dictionary data in this format. - -This view isn’t helpful when you need to get raw data, or when performing a `JOIN` operation. For these cases, you can use the `Dictionary` engine, which displays the dictionary data in a table. - -Syntax: - -``` sql -CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` -``` - -Usage example: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); -``` - - Ok - -Take a look at what’s in the table. - -``` sql -select * from products limit 1; -``` - -``` text -┌────product_id─┬─title───────────┐ -│ 152689 │ Some item │ -└───────────────┴─────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/en/engines/table_engines/special/distributed.md b/docs/en/engines/table_engines/special/distributed.md deleted file mode 100644 index c23aa10efb8..00000000000 --- a/docs/en/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,150 +0,0 @@ ---- -toc_priority: 33 -toc_title: Distributed ---- - -# Distributed {#distributed} - -**Tables with Distributed engine do not store any data by themself**, but allow distributed query processing on multiple servers. -Reading is automatically parallelized. During a read, the table indexes on remote servers are used, if there are any. - -The Distributed engine accepts parameters: - -- the cluster name in the server’s config file - -- the name of a remote database - -- the name of a remote table - -- (optionally) sharding key - -- (optionally) policy name, it will be used to store temporary files for async send - - See also: - - - `insert_distributed_sync` setting - - [MergeTree](../mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) for the examples - -Example: - -``` sql -Distributed(logs, default, hits[, sharding_key[, policy_name]]) -``` - -Data will be read from all servers in the ‘logs’ cluster, from the default.hits table located on every server in the cluster. -Data is not only read but is partially processed on the remote servers (to the extent that this is possible). -For example, for a query with GROUP BY, data will be aggregated on remote servers, and the intermediate states of aggregate functions will be sent to the requestor server. Then data will be further aggregated. - -Instead of the database name, you can use a constant expression that returns a string. For example: currentDatabase(). - -logs – The cluster name in the server’s config file. - -Clusters are set like this: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 1 - 9440 - - - - -``` - -Here a cluster is defined with the name ‘logs’ that consists of two shards, each of which contains two replicas. -Shards refer to the servers that contain different parts of the data (in order to read all the data, you must access all the shards). -Replicas are duplicating servers (in order to read all the data, you can access the data on any one of the replicas). - -Cluster names must not contain dots. - -The parameters `host`, `port`, and optionally `user`, `password`, `secure`, `compression` are specified for each server: -- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn’t start. If you change the DNS record, restart the server. -- `port` – The TCP port for messenger activity (‘tcp\_port’ in the config, usually set to 9000). Do not confuse it with http\_port. -- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Access rights](../../../operations/access_rights.md). -- `password` – The password for connecting to a remote server (not masked). Default value: empty string. -- `secure` - Use ssl for connection, usually you also should define `port` = 9440. Server should listen on 9440 and have correct certificates. -- `compression` - Use data compression. Default value: true. - -When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing) setting. -If the connection with the server is not established, there will be an attempt to connect with a short timeout. If the connection failed, the next replica will be selected, and so on for all the replicas. If the connection attempt failed for all the replicas, the attempt will be repeated the same way, several times. -This works in favour of resiliency, but does not provide complete fault tolerance: a remote server might accept the connection, but might not work, or work poorly. - -You can specify just one of the shards (in this case, query processing should be called remote, rather than distributed) or up to any number of shards. In each shard, you can specify from one to any number of replicas. You can specify a different number of replicas for each shard. - -You can specify as many clusters as you wish in the configuration. - -To view your clusters, use the ‘system.clusters’ table. - -The Distributed engine allows working with a cluster like a local server. However, the cluster is inextensible: you must write its configuration in the server config file (even better, for all the cluster’s servers). - -The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don’t need to create a Distributed table – use the ‘remote’ table function instead. See the section [Table functions](../../../sql_reference/table_functions/index.md). - -There are two methods for writing data to a cluster: - -First, you can define which servers to write which data to and perform the write directly on each shard. In other words, perform INSERT in the tables that the distributed table “looks at”. This is the most flexible solution as you can use any sharding scheme, which could be non-trivial due to the requirements of the subject area. This is also the most optimal solution since data can be written to different shards completely independently. - -Second, you can perform INSERT in a Distributed table. In this case, the table will distribute the inserted data across the servers itself. In order to write to a Distributed table, it must have a sharding key set (the last parameter). In addition, if there is only one shard, the write operation works without specifying the sharding key, since it doesn’t mean anything in this case. - -Each shard can have a weight defined in the config file. By default, the weight is equal to one. Data is distributed across shards in the amount proportional to the shard weight. For example, if there are two shards and the first has a weight of 9 while the second has a weight of 10, the first will be sent 9 / 19 parts of the rows, and the second will be sent 10 / 19. - -Each shard can have the ‘internal\_replication’ parameter defined in the config file. - -If this parameter is set to ‘true’, the write operation selects the first healthy replica and writes data to it. Use this alternative if the Distributed table “looks at” replicated tables. In other words, if the table where data will be written is going to replicate them itself. - -If it is set to ‘false’ (the default), data is written to all replicas. In essence, this means that the Distributed table replicates data itself. This is worse than using replicated tables, because the consistency of replicas is not checked, and over time they will contain slightly different data. - -To select the shard that a row of data is sent to, the sharding expression is analyzed, and its remainder is taken from dividing it by the total weight of the shards. The row is sent to the shard that corresponds to the half-interval of the remainders from ‘prev\_weight’ to ‘prev\_weights + weight’, where ‘prev\_weights’ is the total weight of the shards with the smallest number, and ‘weight’ is the weight of this shard. For example, if there are two shards, and the first has a weight of 9 while the second has a weight of 10, the row will be sent to the first shard for the remainders from the range \[0, 9), and to the second for the remainders from the range \[9, 19). - -The sharding expression can be any expression from constants and table columns that returns an integer. For example, you can use the expression ‘rand()’ for random distribution of data, or ‘UserID’ for distribution by the remainder from dividing the user’s ID (then the data of a single user will reside on a single shard, which simplifies running IN and JOIN by users). If one of the columns is not distributed evenly enough, you can wrap it in a hash function: intHash64(UserID). - -A simple reminder from the division is a limited solution for sharding and isn’t always appropriate. It works for medium and large volumes of data (dozens of servers), but not for very large volumes of data (hundreds of servers or more). In the latter case, use the sharding scheme required by the subject area, rather than using entries in Distributed tables. - -SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don’t have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. - -You should be concerned about the sharding scheme in the following cases: - -- Queries are used that require joining data (IN or JOIN) by a specific key. If data is sharded by this key, you can use local IN or JOIN instead of GLOBAL IN or GLOBAL JOIN, which is much more efficient. -- A large number of servers is used (hundreds or more) with a large number of small queries (queries of individual clients - websites, advertisers, or partners). In order for the small queries to not affect the entire cluster, it makes sense to locate data for a single client on a single shard. Alternatively, as we’ve done in Yandex.Metrica, you can set up bi-level sharding: divide the entire cluster into “layers”, where a layer may consist of multiple shards. Data for a single client is located on a single layer, but shards can be added to a layer as necessary, and data is randomly distributed within them. Distributed tables are created for each layer, and a single shared distributed table is created for global queries. - -Data is written asynchronously. When inserted in the table, the data block is just written to the local file system. The data is sent to the remote servers in the background as soon as possible. The period for sending data is managed by the [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) and [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) settings. The `Distributed` engine sends each file with inserted data separately, but you can enable batch sending of files with the [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) setting. This setting improves cluster performance by better utilizing local server and network resources. You should check whether data is sent successfully by checking the list of files (data waiting to be sent) in the table directory: `/var/lib/clickhouse/data/database/table/`. - -If the server ceased to exist or had a rough restart (for example, after a device failure) after an INSERT to a Distributed table, the inserted data might be lost. If a damaged data part is detected in the table directory, it is transferred to the ‘broken’ subdirectory and no longer used. - -When the max\_parallel\_replicas option is enabled, query processing is parallelized across all replicas within a single shard. For more information, see the section [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). - -## Virtual Columns {#virtual-columns} - -- `_shard_num` — Contains the `shard_num` (from `system.clusters`). Type: [UInt32](../../../sql_reference/data_types/int_uint.md). - -!!! note "Note" - Since [`remote`](../../../sql_reference/table_functions/remote.md)/`cluster` table functions internally create temporary instance of the same Distributed engine, `_shard_num` is available there too. - -**See Also** - -- [Virtual columns](index.md#table_engines-virtual_columns) - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/en/engines/table_engines/special/file.md b/docs/en/engines/table_engines/special/file.md deleted file mode 100644 index b9a79ed2e3e..00000000000 --- a/docs/en/engines/table_engines/special/file.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -toc_priority: 37 -toc_title: File ---- - -# File {#table_engines-file} - -The File table engine keeps the data in a file in one of the supported [file -formats](../../../interfaces/formats.md#formats) (TabSeparated, Native, etc.). - -Usage examples: - -- Data export from ClickHouse to file. -- Convert data from one format to another. -- Updating data in ClickHouse via editing a file on a disk. - -## Usage In ClickHouse Server {#usage-in-clickhouse-server} - -``` sql -File(Format) -``` - -The `Format` parameter specifies one of the available file formats. To perform -`SELECT` queries, the format must be supported for input, and to perform -`INSERT` queries – for output. The available formats are listed in the -[Formats](../../../interfaces/formats.md#formats) section. - -ClickHouse does not allow to specify filesystem path for`File`. It will use folder defined by [path](../../../operations/server_configuration_parameters/settings.md) setting in server configuration. - -When creating table using `File(Format)` it creates empty subdirectory in that folder. When data is written to that table, it’s put into `data.Format` file in that subdirectory. - -You may manually create this subfolder and file in server filesystem and then [ATTACH](../../../sql_reference/statements/misc.md) it to table information with matching name, so you can query data from that file. - -!!! warning "Warning" - Be careful with this functionality, because ClickHouse does not keep track of external changes to such files. The result of simultaneous writes via ClickHouse and outside of ClickHouse is undefined. - -**Example:** - -**1.** Set up the `file_engine_table` table: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -By default ClickHouse will create folder `/var/lib/clickhouse/data/default/file_engine_table`. - -**2.** Manually create `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` containing: - -``` bash -$ cat data.TabSeparated -one 1 -two 2 -``` - -**3.** Query the data: - -``` sql -SELECT * FROM file_engine_table -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Usage In ClickHouse-local {#usage-in-clickhouse-local} - -In [clickhouse-local](../../../operations/utilities/clickhouse-local.md) File engine accepts file path in addition to `Format`. Default input/output streams can be specified using numeric or human-readable names like `0` or `stdin`, `1` or `stdout`. -**Example:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## Details Of Implementation {#details-of-implementation} - -- Multiple `SELECT` queries can be performed concurrently, but `INSERT` queries will wait each other. -- Supported creating new file by `INSERT` query. -- If file exists, `INSERT` would append new values in it. -- Not supported: - - `ALTER` - - `SELECT ... SAMPLE` - - Indices - - Replication - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/en/engines/table_engines/special/generate.md b/docs/en/engines/table_engines/special/generate.md deleted file mode 100644 index 6e592674346..00000000000 --- a/docs/en/engines/table_engines/special/generate.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -toc_priority: 46 -toc_title: GenerateRandom ---- - -# Generaterandom {#table_engines-generate} - -The GenerateRandom table engine produces random data for given table schema. - -Usage examples: - -- Use in test to populate reproducible large table. -- Generate random input for fuzzing tests. - -## Usage In ClickHouse Server {#usage-in-clickhouse-server} - -``` sql -ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) -``` - -The `max_array_length` and `max_string_length` parameters specify maximum length of all -array columns and strings correspondingly in generated data. - -Generate table engine supports only `SELECT` queries. - -It supports all [DataTypes](../../../sql_reference/data_types/index.md) that can be stored in a table except `LowCardinality` and `AggregateFunction`. - -**Example:** - -**1.** Set up the `generate_engine_table` table: - -``` sql -CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) -``` - -**2.** Query the data: - -``` sql -SELECT * FROM generate_engine_table LIMIT 3 -``` - -``` text -┌─name─┬──────value─┐ -│ c4xJ │ 1412771199 │ -│ r │ 1791099446 │ -│ 7#$ │ 124312908 │ -└──────┴────────────┘ -``` - -## Details Of Implementation {#details-of-implementation} - -- Not supported: - - `ALTER` - - `SELECT ... SAMPLE` - - `INSERT` - - Indices - - Replication - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/en/engines/table_engines/special/index.md b/docs/en/engines/table_engines/special/index.md deleted file mode 100644 index 22cebf295c1..00000000000 --- a/docs/en/engines/table_engines/special/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Special -toc_priority: 31 ---- - diff --git a/docs/en/engines/table_engines/special/join.md b/docs/en/engines/table_engines/special/join.md deleted file mode 100644 index 5c41396141d..00000000000 --- a/docs/en/engines/table_engines/special/join.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -toc_priority: 40 -toc_title: Join ---- - -# Join {#join} - -Prepared data structure for using in [JOIN](../../../sql_reference/statements/select.md#select-join) operations. - -## Creating a Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], -) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) -``` - -See the detailed description of the [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) query. - -**Engine Parameters** - -- `join_strictness` – [JOIN strictness](../../../sql_reference/statements/select.md#select-join-strictness). -- `join_type` – [JOIN type](../../../sql_reference/statements/select.md#select-join-types). -- `k1[, k2, ...]` – Key columns from the `USING` clause that the `JOIN` operation is made with. - -Enter `join_strictness` and `join_type` parameters without quotes, for example, `Join(ANY, LEFT, col1)`. They must match the `JOIN` operation that the table will be used for. If the parameters don’t match, ClickHouse doesn’t throw an exception and may return incorrect data. - -## Table Usage {#table-usage} - -### Example {#example} - -Creating the left-side table: - -``` sql -CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog -``` - -``` sql -INSERT INTO id_val VALUES (1,11)(2,12)(3,13) -``` - -Creating the right-side `Join` table: - -``` sql -CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) -``` - -``` sql -INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) -``` - -Joining the tables: - -``` sql -SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 -``` - -``` text -┌─id─┬─val─┬─id_val_join.val─┐ -│ 1 │ 11 │ 21 │ -│ 2 │ 12 │ ᴺᵁᴸᴸ │ -│ 3 │ 13 │ 23 │ -└────┴─────┴─────────────────┘ -``` - -As an alternative, you can retrieve data from the `Join` table, specifying the join key value: - -``` sql -SELECT joinGet('id_val_join', 'val', toUInt32(1)) -``` - -``` text -┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ -│ 21 │ -└────────────────────────────────────────────┘ -``` - -### Selecting and Inserting Data {#selecting-and-inserting-data} - -You can use `INSERT` queries to add data to the `Join`-engine tables. If the table was created with the `ANY` strictness, data for duplicate keys are ignored. With the `ALL` strictness, all rows are added. - -You cannot perform a `SELECT` query directly from the table. Instead, use one of the following methods: - -- Place the table to the right side in a `JOIN` clause. -- Call the [joinGet](../../../sql_reference/functions/other_functions.md#joinget) function, which lets you extract data from the table the same way as from a dictionary. - -### Limitations and Settings {#join-limitations-and-settings} - -When creating a table, the following settings are applied: - -- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) -- [max\_rows\_in\_join](../../../operations/settings/query_complexity.md#settings-max_rows_in_join) -- [max\_bytes\_in\_join](../../../operations/settings/query_complexity.md#settings-max_bytes_in_join) -- [join\_overflow\_mode](../../../operations/settings/query_complexity.md#settings-join_overflow_mode) -- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) - -The `Join`-engine tables can’t be used in `GLOBAL JOIN` operations. - -The `Join`-engine allows use [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) setting in the `CREATE TABLE` statement. And [SELECT](../../../sql_reference/statements/select.md) query allows use `join_use_nulls` too. If you have different `join_use_nulls` settings, you can get an error joining table. It depends on kind of JOIN. When you use [joinGet](../../../sql_reference/functions/other_functions.md#joinget) function, you have to use the same `join_use_nulls` setting in `CRATE TABLE` and `SELECT` statements. - -## Data Storage {#data-storage} - -`Join` table data is always located in the RAM. When inserting rows into a table, ClickHouse writes data blocks to the directory on the disk so that they can be restored when the server restarts. - -If the server restarts incorrectly, the data block on the disk might get lost or damaged. In this case, you may need to manually delete the file with damaged data. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/en/engines/table_engines/special/materializedview.md b/docs/en/engines/table_engines/special/materializedview.md deleted file mode 100644 index 49ad2411f83..00000000000 --- a/docs/en/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -toc_priority: 43 -toc_title: MaterializedView ---- - -# Materializedview {#materializedview} - -Used for implementing materialized views (for more information, see [CREATE TABLE](../../../sql_reference/statements/create.md)). For storing data, it uses a different engine that was specified when creating the view. When reading from a table, it just uses this engine. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/en/engines/table_engines/special/merge.md b/docs/en/engines/table_engines/special/merge.md deleted file mode 100644 index 8027266b441..00000000000 --- a/docs/en/engines/table_engines/special/merge.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -toc_priority: 36 -toc_title: Merge ---- - -# Merge {#merge} - -The `Merge` engine (not to be confused with `MergeTree`) does not store data itself, but allows reading from any number of other tables simultaneously. -Reading is automatically parallelized. Writing to a table is not supported. When reading, the indexes of tables that are actually being read are used, if they exist. -The `Merge` engine accepts parameters: the database name and a regular expression for tables. - -Example: - -``` sql -Merge(hits, '^WatchLog') -``` - -Data will be read from the tables in the `hits` database that have names that match the regular expression ‘`^WatchLog`’. - -Instead of the database name, you can use a constant expression that returns a string. For example, `currentDatabase()`. - -Regular expressions — [re2](https://github.com/google/re2) (supports a subset of PCRE), case-sensitive. -See the notes about escaping symbols in regular expressions in the “match” section. - -When selecting tables to read, the `Merge` table itself will not be selected, even if it matches the regex. This is to avoid loops. -It is possible to create two `Merge` tables that will endlessly try to read each others’ data, but this is not a good idea. - -The typical way to use the `Merge` engine is for working with a large number of `TinyLog` tables as if with a single table. - -Example 2: - -Let’s say you have a old table (WatchLog\_old) and decided to change partitioning without moving data to a new table (WatchLog\_new) and you need to see data from both tables. - -``` sql -CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree(date, (UserId, EventType), 8192); -INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - -CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; -INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - -CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - -SELECT * -FROM WatchLog -``` - -``` text -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-01 │ 1 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-02 │ 2 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -``` - -## Virtual Columns {#virtual-columns} - -- `_table` — Contains the name of the table from which data was read. Type: [String](../../../sql_reference/data_types/string.md). - - You can set the constant conditions on `_table` in the `WHERE/PREWHERE` clause (for example, `WHERE _table='xyz'`). In this case the read operation is performed only for that tables where the condition on `_table` is satisfied, so the `_table` column acts as an index. - -**See Also** - -- [Virtual columns](index.md#table_engines-virtual_columns) - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/en/engines/table_engines/special/url.md b/docs/en/engines/table_engines/special/url.md deleted file mode 100644 index db679b97c54..00000000000 --- a/docs/en/engines/table_engines/special/url.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -toc_priority: 41 -toc_title: URL ---- - -# URL(URL, Format) {#table_engines-url} - -Manages data on a remote HTTP/HTTPS server. This engine is similar -to the [File](file.md) engine. - -## Using the Engine In the ClickHouse Server {#using-the-engine-in-the-clickhouse-server} - -The `format` must be one that ClickHouse can use in -`SELECT` queries and, if necessary, in `INSERTs`. For the full list of supported formats, see -[Formats](../../../interfaces/formats.md#formats). - -The `URL` must conform to the structure of a Uniform Resource Locator. The specified URL must point to a server -that uses HTTP or HTTPS. This does not require any -additional headers for getting a response from the server. - -`INSERT` and `SELECT` queries are transformed to `POST` and `GET` requests, -respectively. For processing `POST` requests, the remote server must support -[Chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). - -You can limit the maximum number of HTTP GET redirect hops using the [max\_http\_get\_redirects](../../../operations/settings/settings.md#setting-max_http_get_redirects) setting. - -**Example:** - -**1.** Create a `url_engine_table` table on the server : - -``` sql -CREATE TABLE url_engine_table (word String, value UInt64) -ENGINE=URL('http://127.0.0.1:12345/', CSV) -``` - -**2.** Create a basic HTTP server using the standard Python 3 tools and -start it: - -``` python3 -from http.server import BaseHTTPRequestHandler, HTTPServer - -class CSVHTTPServer(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type', 'text/csv') - self.end_headers() - - self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) - -if __name__ == "__main__": - server_address = ('127.0.0.1', 12345) - HTTPServer(server_address, CSVHTTPServer).serve_forever() -``` - -``` bash -$ python3 server.py -``` - -**3.** Request data: - -``` sql -SELECT * FROM url_engine_table -``` - -``` text -┌─word──┬─value─┐ -│ Hello │ 1 │ -│ World │ 2 │ -└───────┴───────┘ -``` - -## Details Of Implementation {#details-of-implementation} - -- Reads and writes can be parallel -- Not supported: - - `ALTER` and `SELECT...SAMPLE` operations. - - Indexes. - - Replication. - -[Original article](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/en/faq/general.md b/docs/en/faq/general.md index a382daf3f0e..860356e46f6 100644 --- a/docs/en/faq/general.md +++ b/docs/en/faq/general.md @@ -27,7 +27,7 @@ NLS_LANG=RUSSIAN_RUSSIA.UTF8 ### Using INTO OUTFILE Clause {#using-into-outfile-clause} -Add an [INTO OUTFILE](../sql_reference/statements/select.md#into-outfile-clause) clause to your query. +Add an [INTO OUTFILE](../sql-reference/statements/select.md#into-outfile-clause) clause to your query. For example: @@ -35,7 +35,7 @@ For example: SELECT * FROM table INTO OUTFILE 'file' ``` -By default, ClickHouse uses the [TabSeparated](../interfaces/formats.md#tabseparated) format for output data. To select the [data format](../interfaces/formats.md), use the [FORMAT clause](../sql_reference/statements/select.md#format-clause). +By default, ClickHouse uses the [TabSeparated](../interfaces/formats.md#tabseparated) format for output data. To select the [data format](../interfaces/formats.md), use the [FORMAT clause](../sql-reference/statements/select.md#format-clause). For example: @@ -45,7 +45,7 @@ SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV ### Using a File-Engine Table {#using-a-file-engine-table} -See [File](../engines/table_engines/special/file.md). +See [File](../engines/table-engines/special/file.md). ### Using Command-Line Redirection {#using-command-line-redirection} diff --git a/docs/en/getting_started/example_datasets/amplab_benchmark.md b/docs/en/getting-started/example-datasets/amplab-benchmark.md similarity index 100% rename from docs/en/getting_started/example_datasets/amplab_benchmark.md rename to docs/en/getting-started/example-datasets/amplab-benchmark.md diff --git a/docs/en/getting_started/example_datasets/criteo.md b/docs/en/getting-started/example-datasets/criteo.md similarity index 100% rename from docs/en/getting_started/example_datasets/criteo.md rename to docs/en/getting-started/example-datasets/criteo.md diff --git a/docs/en/getting-started/example-datasets/index.md b/docs/en/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..c81b272d029 --- /dev/null +++ b/docs/en/getting-started/example-datasets/index.md @@ -0,0 +1,20 @@ +--- +toc_folder_title: Example Datasets +toc_priority: 12 +toc_title: Introduction +--- + +# Example Datasets {#example-datasets} + +This section describes how to obtain example datasets and import them into ClickHouse. +For some datasets example queries are also available. + +- [Anonymized Yandex.Metrica Dataset](metrica.md) +- [Star Schema Benchmark](star-schema.md) +- [WikiStat](wikistat.md) +- [Terabyte of Click Logs from Criteo](criteo.md) +- [AMPLab Big Data Benchmark](amplab-benchmark.md) +- [New York Taxi Data](nyc-taxi.md) +- [OnTime](ontime.md) + +[Original article](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/en/getting-started/example-datasets/metrica.md b/docs/en/getting-started/example-datasets/metrica.md new file mode 100644 index 00000000000..b13859845a8 --- /dev/null +++ b/docs/en/getting-started/example-datasets/metrica.md @@ -0,0 +1,68 @@ +--- +toc_priority: 21 +toc_title: Yandex.Metrica Data +--- + +# Anonymized Yandex.Metrica Data {#anonymized-yandex-metrica-data} + +Dataset consists of two tables containing anonymized data about hits (`hits_v1`) and visits (`visits_v1`) of Yandex.Metrica. You can read more about Yandex.Metrica in [ClickHouse history](../../introduction/history.md) section. + +The dataset consists of two tables, either of them can be downloaded as a compressed `tsv.xz` file or as prepared partitions. In addition to that, an extended version of the `hits` table containing 100 million rows is available as TSV at https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz and as prepared partitions at https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. + +## Obtaining Tables from Prepared Partitions {#obtaining-tables-from-prepared-partitions} + +Download and import hits table: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar +tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +Download and import visits: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar +tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Obtaining Tables from Compressed TSV File {#obtaining-tables-from-compressed-tsv-file} + +Download and import hits from compressed TSV file: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +Download and import visits from compressed tsv-file: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Example Queries {#example-queries} + +[ClickHouse tutorial](../../getting-started/tutorial.md) is based on Yandex.Metrica dataset and the recommended way to get started with this dataset is to just go through tutorial. + +Additional examples of queries to these tables can be found among [stateful tests](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) of ClickHouse (they are named `test.hists` and `test.visits` there). diff --git a/docs/en/getting-started/example-datasets/nyc-taxi.md b/docs/en/getting-started/example-datasets/nyc-taxi.md new file mode 100644 index 00000000000..4a069e247b3 --- /dev/null +++ b/docs/en/getting-started/example-datasets/nyc-taxi.md @@ -0,0 +1,388 @@ +--- +toc_priority: 16 +toc_title: New York Taxi Data +--- + +# New York Taxi Data {#new-york-taxi-data} + +This dataset can be obtained in two ways: + +- import from raw data +- download of prepared partitions + +## How to Import the Raw Data {#how-to-import-the-raw-data} + +See https://github.com/toddwschneider/nyc-taxi-data and http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html for the description of a dataset and instructions for downloading. + +Downloading will result in about 227 GB of uncompressed data in CSV files. The download takes about an hour over a 1 Gbit connection (parallel downloading from s3.amazonaws.com recovers at least half of a 1 Gbit channel). +Some of the files might not download fully. Check the file sizes and re-download any that seem doubtful. + +Some of the files might contain invalid rows. You can fix them as follows: + +``` bash +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ +mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv +mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv +``` + +Then the data must be pre-processed in PostgreSQL. This will create selections of points in the polygons (to match points on the map with the boroughs of New York City) and combine all the data into a single denormalized flat table by using a JOIN. To do this, you will need to install PostgreSQL with PostGIS support. + +Be careful when running `initialize_database.sh` and manually re-check that all the tables were created correctly. + +It takes about 20-30 minutes to process each month’s worth of data in PostgreSQL, for a total of about 48 hours. + +You can check the number of downloaded rows as follows: + +``` bash +$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" +## Count + 1298979494 +(1 row) + +real 7m9.164s +``` + +(This is slightly more than 1.1 billion rows reported by Mark Litwintschik in a series of blog posts.) + +The data in PostgreSQL uses 370 GB of space. + +Exporting the data from PostgreSQL: + +``` sql +COPY +( + SELECT trips.id, + trips.vendor_id, + trips.pickup_datetime, + trips.dropoff_datetime, + trips.store_and_fwd_flag, + trips.rate_code_id, + trips.pickup_longitude, + trips.pickup_latitude, + trips.dropoff_longitude, + trips.dropoff_latitude, + trips.passenger_count, + trips.trip_distance, + trips.fare_amount, + trips.extra, + trips.mta_tax, + trips.tip_amount, + trips.tolls_amount, + trips.ehail_fee, + trips.improvement_surcharge, + trips.total_amount, + trips.payment_type, + trips.trip_type, + trips.pickup, + trips.dropoff, + + cab_types.type cab_type, + + weather.precipitation_tenths_of_mm rain, + weather.snow_depth_mm, + weather.snowfall_mm, + weather.max_temperature_tenths_degrees_celsius max_temp, + weather.min_temperature_tenths_degrees_celsius min_temp, + weather.average_wind_speed_tenths_of_meters_per_second wind, + + pick_up.gid pickup_nyct2010_gid, + pick_up.ctlabel pickup_ctlabel, + pick_up.borocode pickup_borocode, + pick_up.boroname pickup_boroname, + pick_up.ct2010 pickup_ct2010, + pick_up.boroct2010 pickup_boroct2010, + pick_up.cdeligibil pickup_cdeligibil, + pick_up.ntacode pickup_ntacode, + pick_up.ntaname pickup_ntaname, + pick_up.puma pickup_puma, + + drop_off.gid dropoff_nyct2010_gid, + drop_off.ctlabel dropoff_ctlabel, + drop_off.borocode dropoff_borocode, + drop_off.boroname dropoff_boroname, + drop_off.ct2010 dropoff_ct2010, + drop_off.boroct2010 dropoff_boroct2010, + drop_off.cdeligibil dropoff_cdeligibil, + drop_off.ntacode dropoff_ntacode, + drop_off.ntaname dropoff_ntaname, + drop_off.puma dropoff_puma + FROM trips + LEFT JOIN cab_types + ON trips.cab_type_id = cab_types.id + LEFT JOIN central_park_weather_observations_raw weather + ON weather.date = trips.pickup_datetime::date + LEFT JOIN nyct2010 pick_up + ON pick_up.gid = trips.pickup_nyct2010_gid + LEFT JOIN nyct2010 drop_off + ON drop_off.gid = trips.dropoff_nyct2010_gid +) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; +``` + +The data snapshot is created at a speed of about 50 MB per second. While creating the snapshot, PostgreSQL reads from the disk at a speed of about 28 MB per second. +This takes about 5 hours. The resulting TSV file is 590612904969 bytes. + +Create a temporary table in ClickHouse: + +``` sql +CREATE TABLE trips +( +trip_id UInt32, +vendor_id String, +pickup_datetime DateTime, +dropoff_datetime Nullable(DateTime), +store_and_fwd_flag Nullable(FixedString(1)), +rate_code_id Nullable(UInt8), +pickup_longitude Nullable(Float64), +pickup_latitude Nullable(Float64), +dropoff_longitude Nullable(Float64), +dropoff_latitude Nullable(Float64), +passenger_count Nullable(UInt8), +trip_distance Nullable(Float64), +fare_amount Nullable(Float32), +extra Nullable(Float32), +mta_tax Nullable(Float32), +tip_amount Nullable(Float32), +tolls_amount Nullable(Float32), +ehail_fee Nullable(Float32), +improvement_surcharge Nullable(Float32), +total_amount Nullable(Float32), +payment_type Nullable(String), +trip_type Nullable(UInt8), +pickup Nullable(String), +dropoff Nullable(String), +cab_type Nullable(String), +precipitation Nullable(UInt8), +snow_depth Nullable(UInt8), +snowfall Nullable(UInt8), +max_temperature Nullable(UInt8), +min_temperature Nullable(UInt8), +average_wind_speed Nullable(UInt8), +pickup_nyct2010_gid Nullable(UInt8), +pickup_ctlabel Nullable(String), +pickup_borocode Nullable(UInt8), +pickup_boroname Nullable(String), +pickup_ct2010 Nullable(String), +pickup_boroct2010 Nullable(String), +pickup_cdeligibil Nullable(FixedString(1)), +pickup_ntacode Nullable(String), +pickup_ntaname Nullable(String), +pickup_puma Nullable(String), +dropoff_nyct2010_gid Nullable(UInt8), +dropoff_ctlabel Nullable(String), +dropoff_borocode Nullable(UInt8), +dropoff_boroname Nullable(String), +dropoff_ct2010 Nullable(String), +dropoff_boroct2010 Nullable(String), +dropoff_cdeligibil Nullable(String), +dropoff_ntacode Nullable(String), +dropoff_ntaname Nullable(String), +dropoff_puma Nullable(String) +) ENGINE = Log; +``` + +It is needed for converting fields to more correct data types and, if possible, to eliminate NULLs. + +``` bash +$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv + +real 75m56.214s +``` + +Data is read at a speed of 112-140 Mb/second. +Loading data into a Log type table in one stream took 76 minutes. +The data in this table uses 142 GB. + +(Importing data directly from Postgres is also possible using `COPY ... TO PROGRAM`.) + +Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. + +To start, we’ll create a table on a single server. Later we will make the table distributed. + +Create and populate a summary table: + +``` sql +CREATE TABLE trips_mergetree +ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +AS SELECT + +trip_id, +CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, +toDate(pickup_datetime) AS pickup_date, +ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, +toDate(dropoff_datetime) AS dropoff_date, +ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, +assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, +assumeNotNull(rate_code_id) AS rate_code_id, +assumeNotNull(pickup_longitude) AS pickup_longitude, +assumeNotNull(pickup_latitude) AS pickup_latitude, +assumeNotNull(dropoff_longitude) AS dropoff_longitude, +assumeNotNull(dropoff_latitude) AS dropoff_latitude, +assumeNotNull(passenger_count) AS passenger_count, +assumeNotNull(trip_distance) AS trip_distance, +assumeNotNull(fare_amount) AS fare_amount, +assumeNotNull(extra) AS extra, +assumeNotNull(mta_tax) AS mta_tax, +assumeNotNull(tip_amount) AS tip_amount, +assumeNotNull(tolls_amount) AS tolls_amount, +assumeNotNull(ehail_fee) AS ehail_fee, +assumeNotNull(improvement_surcharge) AS improvement_surcharge, +assumeNotNull(total_amount) AS total_amount, +CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, +assumeNotNull(trip_type) AS trip_type, +ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, +ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, +CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, + +assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, +toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, +assumeNotNull(pickup_borocode) AS pickup_borocode, +CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, +toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, +toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, +CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, +toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, + +CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, + +toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, + +assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, +toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, +assumeNotNull(dropoff_borocode) AS dropoff_borocode, +CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, +toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, +toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, +CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, +toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, + +CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, + +toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma + +FROM trips +``` + +This takes 3030 seconds at a speed of about 428,000 rows per second. +To load it faster, you can create the table with the `Log` engine instead of `MergeTree`. In this case, the download works faster than 200 seconds. + +The table uses 126 GB of disk space. + +``` sql +SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active +``` + +``` text +┌─formatReadableSize(sum(bytes))─┐ +│ 126.18 GiB │ +└────────────────────────────────┘ +``` + +Among other things, you can run the OPTIMIZE query on MergeTree. But it’s not required since everything will be fine without it. + +## Download of Prepared Partitions {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar +$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" +``` + +!!! info "Info" + If you will run the queries described below, you have to use the full table name, `datasets.trips_mergetree`. + +## Results on Single Server {#results-on-single-server} + +Q1: + +``` sql +SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type +``` + +0.490 seconds. + +Q2: + +``` sql +SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count +``` + +1.224 seconds. + +Q3: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year +``` + +2.104 seconds. + +Q4: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) +FROM trips_mergetree +GROUP BY passenger_count, year, distance +ORDER BY year, count(*) DESC +``` + +3.593 seconds. + +The following server was used: + +Two Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz, 16 physical kernels total,128 GiB RAM,8x6 TB HD on hardware RAID-5 + +Execution time is the best of three runs. But starting from the second run, queries read data from the file system cache. No further caching occurs: the data is read out and processed in each run. + +Creating a table on three servers: + +On each server: + +``` sql +CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +``` + +On the source server: + +``` sql +CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) +``` + +The following query redistributes data: + +``` sql +INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree +``` + +This takes 2454 seconds. + +On three servers: + +Q1: 0.212 seconds. +Q2: 0.438 seconds. +Q3: 0.733 seconds. +Q4: 1.241 seconds. + +No surprises here, since the queries are scaled linearly. + +We also have the results from a cluster of 140 servers: + +Q1: 0.028 sec. +Q2: 0.043 sec. +Q3: 0.051 sec. +Q4: 0.072 sec. + +In this case, the query processing time is determined above all by network latency. +We ran queries using a client located in a Yandex datacenter in Finland on a cluster in Russia, which added about 20 ms of latency. + +## Summary {#summary} + +| servers | Q1 | Q2 | Q3 | Q4 | +|---------|-------|-------|-------|-------| +| 1 | 0.490 | 1.224 | 2.104 | 3.593 | +| 3 | 0.212 | 0.438 | 0.733 | 1.241 | +| 140 | 0.028 | 0.043 | 0.051 | 0.072 | + +[Original article](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/en/getting-started/example-datasets/ontime.md b/docs/en/getting-started/example-datasets/ontime.md new file mode 100644 index 00000000000..91b6913e223 --- /dev/null +++ b/docs/en/getting-started/example-datasets/ontime.md @@ -0,0 +1,410 @@ +--- +toc_priority: 15 +toc_title: OnTime +--- + +# OnTime {#ontime} + +This dataset can be obtained in two ways: + +- import from raw data +- download of prepared partitions + +## Import from Raw Data {#import-from-raw-data} + +Downloading data: + +``` bash +for s in `seq 1987 2018` +do +for m in `seq 1 12` +do +wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip +done +done +``` + +(from https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) + +Creating a table: + +``` sql +CREATE TABLE `ontime` ( + `Year` UInt16, + `Quarter` UInt8, + `Month` UInt8, + `DayofMonth` UInt8, + `DayOfWeek` UInt8, + `FlightDate` Date, + `UniqueCarrier` FixedString(7), + `AirlineID` Int32, + `Carrier` FixedString(2), + `TailNum` String, + `FlightNum` String, + `OriginAirportID` Int32, + `OriginAirportSeqID` Int32, + `OriginCityMarketID` Int32, + `Origin` FixedString(5), + `OriginCityName` String, + `OriginState` FixedString(2), + `OriginStateFips` String, + `OriginStateName` String, + `OriginWac` Int32, + `DestAirportID` Int32, + `DestAirportSeqID` Int32, + `DestCityMarketID` Int32, + `Dest` FixedString(5), + `DestCityName` String, + `DestState` FixedString(2), + `DestStateFips` String, + `DestStateName` String, + `DestWac` Int32, + `CRSDepTime` Int32, + `DepTime` Int32, + `DepDelay` Int32, + `DepDelayMinutes` Int32, + `DepDel15` Int32, + `DepartureDelayGroups` String, + `DepTimeBlk` String, + `TaxiOut` Int32, + `WheelsOff` Int32, + `WheelsOn` Int32, + `TaxiIn` Int32, + `CRSArrTime` Int32, + `ArrTime` Int32, + `ArrDelay` Int32, + `ArrDelayMinutes` Int32, + `ArrDel15` Int32, + `ArrivalDelayGroups` Int32, + `ArrTimeBlk` String, + `Cancelled` UInt8, + `CancellationCode` FixedString(1), + `Diverted` UInt8, + `CRSElapsedTime` Int32, + `ActualElapsedTime` Int32, + `AirTime` Int32, + `Flights` Int32, + `Distance` Int32, + `DistanceGroup` UInt8, + `CarrierDelay` Int32, + `WeatherDelay` Int32, + `NASDelay` Int32, + `SecurityDelay` Int32, + `LateAircraftDelay` Int32, + `FirstDepTime` String, + `TotalAddGTime` String, + `LongestAddGTime` String, + `DivAirportLandings` String, + `DivReachedDest` String, + `DivActualElapsedTime` String, + `DivArrDelay` String, + `DivDistance` String, + `Div1Airport` String, + `Div1AirportID` Int32, + `Div1AirportSeqID` Int32, + `Div1WheelsOn` String, + `Div1TotalGTime` String, + `Div1LongestGTime` String, + `Div1WheelsOff` String, + `Div1TailNum` String, + `Div2Airport` String, + `Div2AirportID` Int32, + `Div2AirportSeqID` Int32, + `Div2WheelsOn` String, + `Div2TotalGTime` String, + `Div2LongestGTime` String, + `Div2WheelsOff` String, + `Div2TailNum` String, + `Div3Airport` String, + `Div3AirportID` Int32, + `Div3AirportSeqID` Int32, + `Div3WheelsOn` String, + `Div3TotalGTime` String, + `Div3LongestGTime` String, + `Div3WheelsOff` String, + `Div3TailNum` String, + `Div4Airport` String, + `Div4AirportID` Int32, + `Div4AirportSeqID` Int32, + `Div4WheelsOn` String, + `Div4TotalGTime` String, + `Div4LongestGTime` String, + `Div4WheelsOff` String, + `Div4TailNum` String, + `Div5Airport` String, + `Div5AirportID` Int32, + `Div5AirportSeqID` Int32, + `Div5WheelsOn` String, + `Div5TotalGTime` String, + `Div5LongestGTime` String, + `Div5WheelsOff` String, + `Div5TailNum` String +) ENGINE = MergeTree +PARTITION BY Year +ORDER BY (Carrier, FlightDate) +SETTINGS index_granularity = 8192; +``` + +Loading data: + +``` bash +$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done +``` + +## Download of Prepared Partitions {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar +$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.ontime" +``` + +!!! info "Info" + If you will run the queries described below, you have to use the full table name, `datasets.ontime`. + +## Queries {#queries} + +Q0. + +``` sql +SELECT avg(c1) +FROM +( + SELECT Year, Month, count(*) AS c1 + FROM ontime + GROUP BY Year, Month +); +``` + +Q1. The number of flights per day from the year 2000 to 2008 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +Q2. The number of flights delayed by more than 10 minutes, grouped by the day of the week, for 2000-2008 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +Q3. The number of delays by the airport for 2000-2008 + +``` sql +SELECT Origin, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY Origin +ORDER BY c DESC +LIMIT 10; +``` + +Q4. The number of delays by carrier for 2007 + +``` sql +SELECT Carrier, count(*) +FROM ontime +WHERE DepDelay>10 AND Year=2007 +GROUP BY Carrier +ORDER BY count(*) DESC; +``` + +Q5. The percentage of delays by carrier for 2007 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year=2007 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year=2007 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Better version of the same query: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year=2007 +GROUP BY Carrier +ORDER BY c3 DESC +``` + +Q6. The previous request for a broader range of years, 2000-2008 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year>=2000 AND Year<=2008 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year>=2000 AND Year<=2008 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Better version of the same query: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY Carrier +ORDER BY c3 DESC; +``` + +Q7. Percentage of flights delayed for more than 10 minutes, by year + +``` sql +SELECT Year, c1/c2 +FROM +( + select + Year, + count(*)*100 as c1 + from ontime + WHERE DepDelay>10 + GROUP BY Year +) +JOIN +( + select + Year, + count(*) as c2 + from ontime + GROUP BY Year +) USING (Year) +ORDER BY Year; +``` + +Better version of the same query: + +``` sql +SELECT Year, avg(DepDelay>10)*100 +FROM ontime +GROUP BY Year +ORDER BY Year; +``` + +Q8. The most popular destinations by the number of directly connected cities for various year ranges + +``` sql +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +WHERE Year >= 2000 and Year <= 2010 +GROUP BY DestCityName +ORDER BY u DESC LIMIT 10; +``` + +Q9. + +``` sql +SELECT Year, count(*) AS c1 +FROM ontime +GROUP BY Year; +``` + +Q10. + +``` sql +SELECT + min(Year), max(Year), Carrier, count(*) AS cnt, + sum(ArrDelayMinutes>30) AS flights_delayed, + round(sum(ArrDelayMinutes>30)/count(*),2) AS rate +FROM ontime +WHERE + DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') + AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') + AND FlightDate < '2010-01-01' +GROUP by Carrier +HAVING cnt>100000 and max(Year)>1990 +ORDER by rate DESC +LIMIT 1000; +``` + +Bonus: + +``` sql +SELECT avg(cnt) +FROM +( + SELECT Year,Month,count(*) AS cnt + FROM ontime + WHERE DepDel15=1 + GROUP BY Year,Month +); + +SELECT avg(c1) FROM +( + SELECT Year,Month,count(*) AS c1 + FROM ontime + GROUP BY Year,Month +); + +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +GROUP BY DestCityName +ORDER BY u DESC +LIMIT 10; + +SELECT OriginCityName, DestCityName, count() AS c +FROM ontime +GROUP BY OriginCityName, DestCityName +ORDER BY c DESC +LIMIT 10; + +SELECT OriginCityName, count() AS c +FROM ontime +GROUP BY OriginCityName +ORDER BY c DESC +LIMIT 10; +``` + +This performance test was created by Vadim Tkachenko. See: + +- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ +- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ +- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ +- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ +- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ +- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html + +[Original article](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/en/getting_started/example_datasets/star_schema.md b/docs/en/getting-started/example-datasets/star-schema.md similarity index 100% rename from docs/en/getting_started/example_datasets/star_schema.md rename to docs/en/getting-started/example-datasets/star-schema.md diff --git a/docs/en/getting_started/example_datasets/wikistat.md b/docs/en/getting-started/example-datasets/wikistat.md similarity index 100% rename from docs/en/getting_started/example_datasets/wikistat.md rename to docs/en/getting-started/example-datasets/wikistat.md diff --git a/docs/en/getting-started/index.md b/docs/en/getting-started/index.md new file mode 100644 index 00000000000..c84b3c7c9a6 --- /dev/null +++ b/docs/en/getting-started/index.md @@ -0,0 +1,15 @@ +--- +toc_folder_title: Getting Started +toc_hidden: true +toc_priority: 8 +toc_title: hidden +--- + +# Getting Started {#getting-started} + +If you are new to ClickHouse and want to get a hands-on feeling of its performance, first of all, you need to go through the [installation process](install.md). After that you can: + +- [Go through detailed tutorial](tutorial.md) +- [Experiment with example datasets](example-datasets/ontime.md) + +[Original article](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/en/getting-started/install.md b/docs/en/getting-started/install.md new file mode 100644 index 00000000000..8f8c09f6632 --- /dev/null +++ b/docs/en/getting-started/install.md @@ -0,0 +1,180 @@ +--- +toc_priority: 11 +toc_title: Installation +--- + +# Installation {#installation} + +## System Requirements {#system-requirements} + +ClickHouse can run on any Linux, FreeBSD, or Mac OS X with x86\_64, AArch64, or PowerPC64LE CPU architecture. + +Official pre-built binaries are typically compiled for x86\_64 and leverage SSE 4.2 instruction set, so unless otherwise stated usage of CPU that supports it becomes an additional system requirement. Here’s the command to check if current CPU has support for SSE 4.2: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +To run ClickHouse on processors that do not support SSE 4.2 or have AArch64 or PowerPC64LE architecture, you should [build ClickHouse from sources](#from-sources) with proper configuration adjustments. + +## Available Installation Options {#available-installation-options} + +### From DEB Packages {#install-from-deb-packages} + +It is recommended to use official pre-compiled `deb` packages for Debian or Ubuntu. Run these commands to install packages: + +``` bash +{% include 'install/deb.sh' %} +``` + +If you want to use the most recent version, replace `stable` with `testing` (this is recommended for your testing environments). + +You can also download and install packages manually from [here](https://repo.clickhouse.tech/deb/stable/main/). + +#### Packages {#packages} + +- `clickhouse-common-static` — Installs ClickHouse compiled binary files. +- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` and installs the default server configuration. +- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` and other client-related tools. and installs client configuration files. +- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. + +### From RPM Packages {#from-rpm-packages} + +It is recommended to use official pre-compiled `rpm` packages for CentOS, RedHat, and all other rpm-based Linux distributions. + +First, you need to add the official repository: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 +``` + +If you want to use the most recent version, replace `stable` with `testing` (this is recommended for your testing environments). The `prestable` tag is sometimes available too. + +Then run these commands to install packages: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +You can also download and install packages manually from [here](https://repo.clickhouse.tech/rpm/stable/x86_64). + +### From Tgz Archives {#from-tgz-archives} + +It is recommended to use official pre-compiled `tgz` archives for all Linux distributions, where installation of `deb` or `rpm` packages is not possible. + +The required version can be downloaded with `curl` or `wget` from repository https://repo.yandex.ru/clickhouse/tgz/. +After that downloaded archives should be unpacked and installed with installation scripts. Example for the latest version: + +``` bash +export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz + +tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz +sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz +sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-server-$LATEST_VERSION.tgz +sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh +sudo /etc/init.d/clickhouse-server start + +tar -xzvf clickhouse-client-$LATEST_VERSION.tgz +sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh +``` + +For production environments, it’s recommended to use the latest `stable`-version. You can find its number on GitHub page https://github.com/ClickHouse/ClickHouse/tags with postfix `-stable`. + +### From Docker Image {#from-docker-image} + +To run ClickHouse inside Docker follow the guide on [Docker Hub](https://hub.docker.com/r/yandex/clickhouse-server/). Those images use official `deb` packages inside. + +### From Sources {#from-sources} + +To manually compile ClickHouse, follow the instructions for [Linux](../development/build.md) or [Mac OS X](../development/build-osx.md). + +You can compile packages and install them or use programs without installing packages. Also by building manually you can disable SSE 4.2 requirement or build for AArch64 CPUs. + + Client: programs/clickhouse-client + Server: programs/clickhouse-server + +You’ll need to create a data and metadata folders and `chown` them for the desired user. Their paths can be changed in server config (src/programs/server/config.xml), by default they are: + + /opt/clickhouse/data/default/ + /opt/clickhouse/metadata/default/ + +On Gentoo, you can just use `emerge clickhouse` to install ClickHouse from sources. + +## Launch {#launch} + +To start the server as a daemon, run: + +``` bash +$ sudo service clickhouse-server start +``` + +If you don’t have `service` command, run as + +``` bash +$ sudo /etc/init.d/clickhouse-server start +``` + +See the logs in the `/var/log/clickhouse-server/` directory. + +If the server doesn’t start, check the configurations in the file `/etc/clickhouse-server/config.xml`. + +You can also manually launch the server from the console: + +``` bash +$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +In this case, the log will be printed to the console, which is convenient during development. +If the configuration file is in the current directory, you don’t need to specify the `--config-file` parameter. By default, it uses `./config.xml`. + +ClickHouse supports access restriction settings. They are located in the `users.xml` file (next to `config.xml`). +By default, access is allowed from anywhere for the `default` user, without a password. See `user/default/networks`. +For more information, see the section [“Configuration Files”](../operations/configuration-files.md). + +After launching server, you can use the command-line client to connect to it: + +``` bash +$ clickhouse-client +``` + +By default, it connects to `localhost:9000` on behalf of the user `default` without a password. It can also be used to connect to a remote server using `--host` argument. + +The terminal must use UTF-8 encoding. +For more information, see the section [“Command-line client”](../interfaces/cli.md). + +Example: + +``` bash +$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**Congratulations, the system works!** + +To continue experimenting, you can download one of the test data sets or go through [tutorial](https://clickhouse.tech/tutorial.html). + +[Original article](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/en/getting_started/playground.md b/docs/en/getting-started/playground.md similarity index 100% rename from docs/en/getting_started/playground.md rename to docs/en/getting-started/playground.md diff --git a/docs/en/getting-started/tutorial.md b/docs/en/getting-started/tutorial.md new file mode 100644 index 00000000000..5cf4b1b31a1 --- /dev/null +++ b/docs/en/getting-started/tutorial.md @@ -0,0 +1,663 @@ +--- +toc_priority: 12 +toc_title: Tutorial +--- + +# ClickHouse Tutorial {#clickhouse-tutorial} + +## What to Expect from This Tutorial? {#what-to-expect-from-this-tutorial} + +By going through this tutorial, you’ll learn how to set up a simple ClickHouse cluster. It’ll be small, but fault-tolerant and scalable. Then we will use one of the example datasets to fill it with data and execute some demo queries. + +## Single Node Setup {#single-node-setup} + +To postpone the complexities of a distributed environment, we’ll start with deploying ClickHouse on a single server or virtual machine. ClickHouse is usually installed from [deb](install.md#install-from-deb-packages) or [rpm](install.md#from-rpm-packages) packages, but there are [alternatives](install.md#from-docker-image) for the operating systems that do no support them. + +For example, you have chosen `deb` packages and executed: + +``` bash +{% include 'install/deb.sh' %} +``` + +What do we have in the packages that got installed: + +- `clickhouse-client` package contains [clickhouse-client](../interfaces/cli.md) application, interactive ClickHouse console client. +- `clickhouse-common` package contains a ClickHouse executable file. +- `clickhouse-server` package contains configuration files to run ClickHouse as a server. + +Server config files are located in `/etc/clickhouse-server/`. Before going further, please notice the `` element in `config.xml`. Path determines the location for data storage, so it should be located on volume with large disk capacity; the default value is `/var/lib/clickhouse/`. If you want to adjust the configuration, it’s not handy to directly edit `config.xml` file, considering it might get rewritten on future package updates. The recommended way to override the config elements is to create [files in config.d directory](../operations/configuration-files.md) which serve as “patches” to config.xml. + +As you might have noticed, `clickhouse-server` is not launched automatically after package installation. It won’t be automatically restarted after updates, either. The way you start the server depends on your init system, usually, it is: + +``` bash +sudo service clickhouse-server start +``` + +or + +``` bash +sudo /etc/init.d/clickhouse-server start +``` + +The default location for server logs is `/var/log/clickhouse-server/`. The server is ready to handle client connections once it logs the `Ready for connections` message. + +Once the `clickhouse-server` is up and running, we can use `clickhouse-client` to connect to the server and run some test queries like `SELECT "Hello, world!";`. + +
+ +Quick tips for clickhouse-client +Interactive mode: + +``` bash +clickhouse-client +clickhouse-client --host=... --port=... --user=... --password=... +``` + +Enable multiline queries: + +``` bash +clickhouse-client -m +clickhouse-client --multiline +``` + +Run queries in batch-mode: + +``` bash +clickhouse-client --query='SELECT 1' +echo 'SELECT 1' | clickhouse-client +clickhouse-client <<< 'SELECT 1' +``` + +Insert data from a file in specified format: + +``` bash +clickhouse-client --query='INSERT INTO table VALUES' < data.txt +clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv +``` + +
+ +## Import Sample Dataset {#import-sample-dataset} + +Now it’s time to fill our ClickHouse server with some sample data. In this tutorial, we’ll use the anonymized data of Yandex.Metrica, the first service that runs ClickHouse in production way before it became open-source (more on that in [history section](../introduction/history.md)). There are [multiple ways to import Yandex.Metrica dataset](example-datasets/metrica.md), and for the sake of the tutorial, we’ll go with the most realistic one. + +### Download and Extract Table Data {#download-and-extract-table-data} + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +``` + +The extracted files are about 10GB in size. + +### Create Tables {#create-tables} + +As in most databases management systems, ClickHouse logically groups tables into “databases”. There’s a `default` database, but we’ll create a new one named `tutorial`: + +``` bash +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" +``` + +Syntax for creating tables is way more complicated compared to databases (see [reference](../sql-reference/statements/create.md). In general `CREATE TABLE` statement has to specify three key things: + +1. Name of table to create. +2. Table schema, i.e. list of columns and their [data types](../sql-reference/data-types/index.md). +3. [Table engine](../engines/table-engines/index.md) and its settings, which determines all the details on how queries to this table will be physically executed. + +Yandex.Metrica is a web analytics service, and sample dataset doesn’t cover its full functionality, so there are only two tables to create: + +- `hits` is a table with each action done by all users on all websites covered by the service. +- `visits` is a table that contains pre-built sessions instead of individual actions. + +Let’s see and execute the real create table queries for these tables: + +``` sql +CREATE TABLE tutorial.hits_v1 +( + `WatchID` UInt64, + `JavaEnable` UInt8, + `Title` String, + `GoodEvent` Int16, + `EventTime` DateTime, + `EventDate` Date, + `CounterID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RegionID` UInt32, + `UserID` UInt64, + `CounterClass` Int8, + `OS` UInt8, + `UserAgent` UInt8, + `URL` String, + `Referer` String, + `URLDomain` String, + `RefererDomain` String, + `Refresh` UInt8, + `IsRobot` UInt8, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `FlashMinor2` String, + `NetMajor` UInt8, + `NetMinor` UInt8, + `UserAgentMajor` UInt16, + `UserAgentMinor` FixedString(2), + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `MobilePhone` UInt8, + `MobilePhoneModel` String, + `Params` String, + `IPNetworkID` UInt32, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `IsArtifical` UInt8, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `ClientTimeZone` Int16, + `ClientEventTime` DateTime, + `SilverlightVersion1` UInt8, + `SilverlightVersion2` UInt8, + `SilverlightVersion3` UInt32, + `SilverlightVersion4` UInt16, + `PageCharset` String, + `CodeVersion` UInt32, + `IsLink` UInt8, + `IsDownload` UInt8, + `IsNotBounce` UInt8, + `FUniqID` UInt64, + `HID` UInt32, + `IsOldCounter` UInt8, + `IsEvent` UInt8, + `IsParameter` UInt8, + `DontCountHits` UInt8, + `WithHash` UInt8, + `HitColor` FixedString(1), + `UTCEventTime` DateTime, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `WindowName` Int32, + `OpenerName` Int32, + `HistoryLength` Int16, + `BrowserLanguage` FixedString(2), + `BrowserCountry` FixedString(2), + `SocialNetwork` String, + `SocialAction` String, + `HTTPError` UInt16, + `SendTiming` Int32, + `DNSTiming` Int32, + `ConnectTiming` Int32, + `ResponseStartTiming` Int32, + `ResponseEndTiming` Int32, + `FetchTiming` Int32, + `RedirectTiming` Int32, + `DOMInteractiveTiming` Int32, + `DOMContentLoadedTiming` Int32, + `DOMCompleteTiming` Int32, + `LoadEventStartTiming` Int32, + `LoadEventEndTiming` Int32, + `NSToDOMContentLoadedTiming` Int32, + `FirstPaintTiming` Int32, + `RedirectCount` Int8, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `ParamPrice` Int64, + `ParamOrderID` String, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `GoalsReached` Array(UInt32), + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `RefererHash` UInt64, + `URLHash` UInt64, + `CLID` UInt32, + `YCLID` UInt64, + `ShareService` String, + `ShareURL` String, + `ShareTitle` String, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `IslandID` FixedString(16), + `RequestNum` UInt32, + `RequestTry` UInt8 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +``` sql +CREATE TABLE tutorial.visits_v1 +( + `CounterID` UInt32, + `StartDate` Date, + `Sign` Int8, + `IsNew` UInt8, + `VisitID` UInt64, + `UserID` UInt64, + `StartTime` DateTime, + `Duration` UInt32, + `UTCStartTime` DateTime, + `PageViews` Int32, + `Hits` Int32, + `IsBounce` UInt8, + `Referer` String, + `StartURL` String, + `RefererDomain` String, + `StartURLDomain` String, + `EndURL` String, + `LinkURL` String, + `IsDownload` UInt8, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `PlaceID` Int32, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `IsYandex` UInt8, + `GoalReachesDepth` Int32, + `GoalReachesURL` Int32, + `GoalReachesAny` Int32, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `MobilePhoneModel` String, + `ClientEventTime` DateTime, + `RegionID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `IPNetworkID` UInt32, + `SilverlightVersion3` UInt32, + `CodeVersion` UInt32, + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `UserAgentMajor` UInt16, + `UserAgentMinor` UInt16, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `SilverlightVersion2` UInt8, + `SilverlightVersion4` UInt16, + `FlashVersion3` UInt16, + `FlashVersion4` UInt16, + `ClientTimeZone` Int16, + `OS` UInt8, + `UserAgent` UInt8, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `NetMajor` UInt8, + `NetMinor` UInt8, + `MobilePhone` UInt8, + `SilverlightVersion1` UInt8, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `JavaEnable` UInt8, + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `BrowserLanguage` UInt16, + `BrowserCountry` UInt16, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `Params` Array(String), + `Goals` Nested( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32), + `WatchIDs` Array(UInt64), + `ParamSumPrice` Int64, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `ClickLogID` UInt64, + `ClickEventID` Int32, + `ClickGoodEvent` Int32, + `ClickEventTime` DateTime, + `ClickPriorityID` Int32, + `ClickPhraseID` Int32, + `ClickPageID` Int32, + `ClickPlaceID` Int32, + `ClickTypeID` Int32, + `ClickResourceID` Int32, + `ClickCost` UInt32, + `ClickClientIP` UInt32, + `ClickDomainID` UInt32, + `ClickURL` String, + `ClickAttempt` UInt8, + `ClickOrderID` UInt32, + `ClickBannerID` UInt32, + `ClickMarketCategoryID` UInt32, + `ClickMarketPP` UInt32, + `ClickMarketCategoryName` String, + `ClickMarketPPName` String, + `ClickAWAPSCampaignName` String, + `ClickPageName` String, + `ClickTargetType` UInt16, + `ClickTargetPhraseID` UInt64, + `ClickContextType` UInt8, + `ClickSelectType` Int8, + `ClickOptions` String, + `ClickGroupBannerID` Int32, + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `FirstVisit` DateTime, + `PredLastVisit` Date, + `LastVisit` Date, + `TotalVisits` UInt32, + `TraficSource` Nested( + ID Int8, + SearchEngineID UInt16, + AdvEngineID UInt8, + PlaceID UInt16, + SocialSourceNetworkID UInt8, + Domain String, + SearchPhrase String, + SocialSourcePage String), + `Attendance` FixedString(16), + `CLID` UInt32, + `YCLID` UInt64, + `NormalizedRefererHash` UInt64, + `SearchPhraseHash` UInt64, + `RefererDomainHash` UInt64, + `NormalizedStartURLHash` UInt64, + `StartURLDomainHash` UInt64, + `NormalizedEndURLHash` UInt64, + `TopLevelDomain` UInt64, + `URLScheme` UInt64, + `OpenstatServiceNameHash` UInt64, + `OpenstatCampaignIDHash` UInt64, + `OpenstatAdIDHash` UInt64, + `OpenstatSourceIDHash` UInt64, + `UTMSourceHash` UInt64, + `UTMMediumHash` UInt64, + `UTMCampaignHash` UInt64, + `UTMContentHash` UInt64, + `UTMTermHash` UInt64, + `FromHash` UInt64, + `WebVisorEnabled` UInt8, + `WebVisorActivity` UInt32, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `Market` Nested( + Type UInt8, + GoalID UInt32, + OrderID String, + OrderPrice Int64, + PP UInt32, + DirectPlaceID UInt32, + DirectOrderID UInt32, + DirectBannerID UInt32, + GoodID String, + GoodName String, + GoodQuantity Int32, + GoodPrice Int64), + `IslandID` FixedString(16) +) +ENGINE = CollapsingMergeTree(Sign) +PARTITION BY toYYYYMM(StartDate) +ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +You can execute those queries using the interactive mode of `clickhouse-client` (just launch it in a terminal without specifying a query in advance) or try some [alternative interface](../interfaces/index.md) if you want. + +As we can see, `hits_v1` uses the [basic MergeTree engine](../engines/table-engines/mergetree-family/mergetree.md), while the `visits_v1` uses the [Collapsing](../engines/table-engines/mergetree-family/collapsingmergetree.md) variant. + +### Import Data {#import-data} + +Data import to ClickHouse is done via [INSERT INTO](../sql-reference/statements/insert-into.md) query like in many other SQL databases. However, data is usually provided in one of the [supported serialization formats](../interfaces/formats.md) instead of `VALUES` clause (which is also supported). + +The files we downloaded earlier are in tab-separated format, so here’s how to import them via console client: + +``` bash +clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv +clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv +``` + +ClickHouse has a lot of [settings to tune](../operations/settings/index.md) and one way to specify them in console client is via arguments, as we can see with `--max_insert_block_size`. The easiest way to figure out what settings are available, what do they mean and what the defaults are is to query the `system.settings` table: + +``` sql +SELECT name, value, changed, description +FROM system.settings +WHERE name LIKE '%max_insert_b%' +FORMAT TSV + +max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." +``` + +Optionally you can [OPTIMIZE](../sql-reference/statements/misc.md#misc_operations-optimize) the tables after import. Tables that are configured with an engine from MergeTree-family always do merges of data parts in the background to optimize data storage (or at least check if it makes sense). These queries force the table engine to do storage optimization right now instead of some time later: + +``` bash +clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" +clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" +``` + +These queries start an I/O and CPU intensive operation, so if the table consistently receives new data, it’s better to leave it alone and let merges run in the background. + +Now we can check if the table import was successful: + +``` bash +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" +``` + +## Example Queries {#example-queries} + +``` sql +SELECT + StartURL AS URL, + AVG(Duration) AS AvgDuration +FROM tutorial.visits_v1 +WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' +GROUP BY URL +ORDER BY AvgDuration DESC +LIMIT 10 +``` + +``` sql +SELECT + sum(Sign) AS visits, + sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, + (100. * goal_visits) / visits AS goal_percent +FROM tutorial.visits_v1 +WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') +``` + +## Cluster Deployment {#cluster-deployment} + +ClickHouse cluster is a homogenous cluster. Steps to set up: + +1. Install ClickHouse server on all machines of the cluster +2. Set up cluster configs in configuration files +3. Create local tables on each instance +4. Create a [Distributed table](../engines/table-engines/special/distributed.md) + +[Distributed table](../engines/table-engines/special/distributed.md) is actually a kind of “view” to local tables of ClickHouse cluster. SELECT query from a distributed table executes using resources of all cluster’s shards. You may specify configs for multiple clusters and create multiple distributed tables providing views to different clusters. + +Example config for a cluster with three shards, one replica each: + +``` xml + + + + + example-perftest01j.yandex.ru + 9000 + + + + + example-perftest02j.yandex.ru + 9000 + + + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +For further demonstration, let’s create a new local table with the same `CREATE TABLE` query that we used for `hits_v1`, but different table name: + +``` sql +CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... +``` + +Creating a distributed table providing a view into local tables of the cluster: + +``` sql +CREATE TABLE tutorial.hits_all AS tutorial.hits_local +ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); +``` + +A common practice is to create similar Distributed tables on all machines of the cluster. It allows running distributed queries on any machine of the cluster. Also there’s an alternative option to create temporary distributed table for a given SELECT query using [remote](../sql-reference/table-functions/remote.md) table function. + +Let’s run [INSERT SELECT](../sql-reference/statements/insert-into.md) into the Distributed table to spread the table to multiple servers. + +``` sql +INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; +``` + +!!! warning "Notice" + This approach is not suitable for the sharding of large tables. There’s a separate tool [clickhouse-copier](../operations/utilities/clickhouse-copier.md) that can re-shard arbitrary large tables. + +As you could expect, computationally heavy queries run N times faster if they utilize 3 servers instead of one. + +In this case, we have used a cluster with 3 shards, and each contains a single replica. + +To provide resilience in a production environment, we recommend that each shard should contain 2-3 replicas spread between multiple availability zones or datacenters (or at least racks). Note that ClickHouse supports an unlimited number of replicas. + +Example config for a cluster of one shard containing three replicas: + +``` xml + + ... + + + + example-perftest01j.yandex.ru + 9000 + + + example-perftest02j.yandex.ru + 9000 + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +To enable native replication [ZooKeeper](http://zookeeper.apache.org/) is required. ClickHouse takes care of data consistency on all replicas and runs restore procedure after failure automatically. It’s recommended to deploy the ZooKeeper cluster on separate servers (where no other processes including ClickHouse are running). + +!!! note "Note" + ZooKeeper is not a strict requirement: in some simple cases, you can duplicate the data by writing it into all the replicas from your application code. This approach is **not** recommended, in this case, ClickHouse won’t be able to guarantee data consistency on all replicas. Thus it becomes the responsibility of your application. + +ZooKeeper locations are specified in the configuration file: + +``` xml + + + zoo01.yandex.ru + 2181 + + + zoo02.yandex.ru + 2181 + + + zoo03.yandex.ru + 2181 + + +``` + +Also, we need to set macros for identifying each shard and replica which are used on table creation: + +``` xml + + 01 + 01 + +``` + +If there are no replicas at the moment on replicated table creation, a new first replica is instantiated. If there are already live replicas, the new replica clones data from existing ones. You have an option to create all replicated tables first, and then insert data to it. Another option is to create some replicas and add the others after or during data insertion. + +``` sql +CREATE TABLE tutorial.hits_replica (...) +ENGINE = ReplcatedMergeTree( + '/clickhouse_perftest/tables/{shard}/hits', + '{replica}' +) +... +``` + +Here we use [ReplicatedMergeTree](../engines/table-engines/mergetree-family/replication.md) table engine. In parameters we specify ZooKeeper path containing shard and replica identifiers. + +``` sql +INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; +``` + +Replication operates in multi-master mode. Data can be loaded into any replica, and the system then syncs it with other instances automatically. Replication is asynchronous so at a given moment, not all replicas may contain recently inserted data. At least one replica should be up to allow data ingestion. Others will sync up data and repair consistency once they will become active again. Note that this approach allows for the low possibility of a loss of recently inserted data. + +[Original article](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/en/getting_started/example_datasets/index.md b/docs/en/getting_started/example_datasets/index.md deleted file mode 100644 index a94dff3cef8..00000000000 --- a/docs/en/getting_started/example_datasets/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -toc_folder_title: Example Datasets -toc_priority: 12 -toc_title: Introduction ---- - -# Example Datasets - -This section describes how to obtain example datasets and import them into ClickHouse. -For some datasets example queries are also available. - -* [Anonymized Yandex.Metrica Dataset](metrica.md) -* [Star Schema Benchmark](star_schema.md) -* [WikiStat](wikistat.md) -* [Terabyte of Click Logs from Criteo](criteo.md) -* [AMPLab Big Data Benchmark](amplab_benchmark.md) -* [New York Taxi Data](nyc_taxi.md) -* [OnTime](ontime.md) - -[Original article](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/en/getting_started/example_datasets/metrica.md b/docs/en/getting_started/example_datasets/metrica.md deleted file mode 100644 index 366531fa8e7..00000000000 --- a/docs/en/getting_started/example_datasets/metrica.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -toc_priority: 21 -toc_title: Yandex.Metrica Data ---- - -# Anonymized Yandex.Metrica Data {#anonymized-yandex-metrica-data} - -Dataset consists of two tables containing anonymized data about hits (`hits_v1`) and visits (`visits_v1`) of Yandex.Metrica. You can read more about Yandex.Metrica in [ClickHouse history](../../introduction/history.md) section. - -The dataset consists of two tables, either of them can be downloaded as a compressed `tsv.xz` file or as prepared partitions. In addition to that, an extended version of the `hits` table containing 100 million rows is available as TSV at https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_100m_obfuscated_v1.tsv.xz and as prepared partitions at https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz. - -## Obtaining Tables from Prepared Partitions {#obtaining-tables-from-prepared-partitions} - -Download and import hits table: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar -tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -Download and import visits: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar -tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Obtaining Tables from Compressed TSV File {#obtaining-tables-from-compressed-tsv-file} - -Download and import hits from compressed TSV file: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -Download and import visits from compressed tsv-file: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Example Queries {#example-queries} - -[ClickHouse tutorial](../../getting_started/tutorial.md) is based on Yandex.Metrica dataset and the recommended way to get started with this dataset is to just go through tutorial. - -Additional examples of queries to these tables can be found among [stateful tests](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) of ClickHouse (they are named `test.hists` and `test.visits` there). diff --git a/docs/en/getting_started/example_datasets/nyc_taxi.md b/docs/en/getting_started/example_datasets/nyc_taxi.md deleted file mode 100644 index 6c7b274e7d4..00000000000 --- a/docs/en/getting_started/example_datasets/nyc_taxi.md +++ /dev/null @@ -1,388 +0,0 @@ ---- -toc_priority: 16 -toc_title: New York Taxi Data ---- - -# New York Taxi Data {#new-york-taxi-data} - -This dataset can be obtained in two ways: - -- import from raw data -- download of prepared partitions - -## How to Import The Raw Data {#how-to-import-the-raw-data} - -See https://github.com/toddwschneider/nyc-taxi-data and http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html for the description of a dataset and instructions for downloading. - -Downloading will result in about 227 GB of uncompressed data in CSV files. The download takes about an hour over a 1 Gbit connection (parallel downloading from s3.amazonaws.com recovers at least half of a 1 Gbit channel). -Some of the files might not download fully. Check the file sizes and re-download any that seem doubtful. - -Some of the files might contain invalid rows. You can fix them as follows: - -``` bash -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ -mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv -mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv -``` - -Then the data must be pre-processed in PostgreSQL. This will create selections of points in the polygons (to match points on the map with the boroughs of New York City) and combine all the data into a single denormalized flat table by using a JOIN. To do this, you will need to install PostgreSQL with PostGIS support. - -Be careful when running `initialize_database.sh` and manually re-check that all the tables were created correctly. - -It takes about 20-30 minutes to process each month’s worth of data in PostgreSQL, for a total of about 48 hours. - -You can check the number of downloaded rows as follows: - -``` bash -$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" -## Count - 1298979494 -(1 row) - -real 7m9.164s -``` - -(This is slightly more than 1.1 billion rows reported by Mark Litwintschik in a series of blog posts.) - -The data in PostgreSQL uses 370 GB of space. - -Exporting the data from PostgreSQL: - -``` sql -COPY -( - SELECT trips.id, - trips.vendor_id, - trips.pickup_datetime, - trips.dropoff_datetime, - trips.store_and_fwd_flag, - trips.rate_code_id, - trips.pickup_longitude, - trips.pickup_latitude, - trips.dropoff_longitude, - trips.dropoff_latitude, - trips.passenger_count, - trips.trip_distance, - trips.fare_amount, - trips.extra, - trips.mta_tax, - trips.tip_amount, - trips.tolls_amount, - trips.ehail_fee, - trips.improvement_surcharge, - trips.total_amount, - trips.payment_type, - trips.trip_type, - trips.pickup, - trips.dropoff, - - cab_types.type cab_type, - - weather.precipitation_tenths_of_mm rain, - weather.snow_depth_mm, - weather.snowfall_mm, - weather.max_temperature_tenths_degrees_celsius max_temp, - weather.min_temperature_tenths_degrees_celsius min_temp, - weather.average_wind_speed_tenths_of_meters_per_second wind, - - pick_up.gid pickup_nyct2010_gid, - pick_up.ctlabel pickup_ctlabel, - pick_up.borocode pickup_borocode, - pick_up.boroname pickup_boroname, - pick_up.ct2010 pickup_ct2010, - pick_up.boroct2010 pickup_boroct2010, - pick_up.cdeligibil pickup_cdeligibil, - pick_up.ntacode pickup_ntacode, - pick_up.ntaname pickup_ntaname, - pick_up.puma pickup_puma, - - drop_off.gid dropoff_nyct2010_gid, - drop_off.ctlabel dropoff_ctlabel, - drop_off.borocode dropoff_borocode, - drop_off.boroname dropoff_boroname, - drop_off.ct2010 dropoff_ct2010, - drop_off.boroct2010 dropoff_boroct2010, - drop_off.cdeligibil dropoff_cdeligibil, - drop_off.ntacode dropoff_ntacode, - drop_off.ntaname dropoff_ntaname, - drop_off.puma dropoff_puma - FROM trips - LEFT JOIN cab_types - ON trips.cab_type_id = cab_types.id - LEFT JOIN central_park_weather_observations_raw weather - ON weather.date = trips.pickup_datetime::date - LEFT JOIN nyct2010 pick_up - ON pick_up.gid = trips.pickup_nyct2010_gid - LEFT JOIN nyct2010 drop_off - ON drop_off.gid = trips.dropoff_nyct2010_gid -) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; -``` - -The data snapshot is created at a speed of about 50 MB per second. While creating the snapshot, PostgreSQL reads from the disk at a speed of about 28 MB per second. -This takes about 5 hours. The resulting TSV file is 590612904969 bytes. - -Create a temporary table in ClickHouse: - -``` sql -CREATE TABLE trips -( -trip_id UInt32, -vendor_id String, -pickup_datetime DateTime, -dropoff_datetime Nullable(DateTime), -store_and_fwd_flag Nullable(FixedString(1)), -rate_code_id Nullable(UInt8), -pickup_longitude Nullable(Float64), -pickup_latitude Nullable(Float64), -dropoff_longitude Nullable(Float64), -dropoff_latitude Nullable(Float64), -passenger_count Nullable(UInt8), -trip_distance Nullable(Float64), -fare_amount Nullable(Float32), -extra Nullable(Float32), -mta_tax Nullable(Float32), -tip_amount Nullable(Float32), -tolls_amount Nullable(Float32), -ehail_fee Nullable(Float32), -improvement_surcharge Nullable(Float32), -total_amount Nullable(Float32), -payment_type Nullable(String), -trip_type Nullable(UInt8), -pickup Nullable(String), -dropoff Nullable(String), -cab_type Nullable(String), -precipitation Nullable(UInt8), -snow_depth Nullable(UInt8), -snowfall Nullable(UInt8), -max_temperature Nullable(UInt8), -min_temperature Nullable(UInt8), -average_wind_speed Nullable(UInt8), -pickup_nyct2010_gid Nullable(UInt8), -pickup_ctlabel Nullable(String), -pickup_borocode Nullable(UInt8), -pickup_boroname Nullable(String), -pickup_ct2010 Nullable(String), -pickup_boroct2010 Nullable(String), -pickup_cdeligibil Nullable(FixedString(1)), -pickup_ntacode Nullable(String), -pickup_ntaname Nullable(String), -pickup_puma Nullable(String), -dropoff_nyct2010_gid Nullable(UInt8), -dropoff_ctlabel Nullable(String), -dropoff_borocode Nullable(UInt8), -dropoff_boroname Nullable(String), -dropoff_ct2010 Nullable(String), -dropoff_boroct2010 Nullable(String), -dropoff_cdeligibil Nullable(String), -dropoff_ntacode Nullable(String), -dropoff_ntaname Nullable(String), -dropoff_puma Nullable(String) -) ENGINE = Log; -``` - -It is needed for converting fields to more correct data types and, if possible, to eliminate NULLs. - -``` bash -$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv - -real 75m56.214s -``` - -Data is read at a speed of 112-140 Mb/second. -Loading data into a Log type table in one stream took 76 minutes. -The data in this table uses 142 GB. - -(Importing data directly from Postgres is also possible using `COPY ... TO PROGRAM`.) - -Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. - -To start, we’ll create a table on a single server. Later we will make the table distributed. - -Create and populate a summary table: - -``` sql -CREATE TABLE trips_mergetree -ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -AS SELECT - -trip_id, -CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, -toDate(pickup_datetime) AS pickup_date, -ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, -toDate(dropoff_datetime) AS dropoff_date, -ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, -assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, -assumeNotNull(rate_code_id) AS rate_code_id, -assumeNotNull(pickup_longitude) AS pickup_longitude, -assumeNotNull(pickup_latitude) AS pickup_latitude, -assumeNotNull(dropoff_longitude) AS dropoff_longitude, -assumeNotNull(dropoff_latitude) AS dropoff_latitude, -assumeNotNull(passenger_count) AS passenger_count, -assumeNotNull(trip_distance) AS trip_distance, -assumeNotNull(fare_amount) AS fare_amount, -assumeNotNull(extra) AS extra, -assumeNotNull(mta_tax) AS mta_tax, -assumeNotNull(tip_amount) AS tip_amount, -assumeNotNull(tolls_amount) AS tolls_amount, -assumeNotNull(ehail_fee) AS ehail_fee, -assumeNotNull(improvement_surcharge) AS improvement_surcharge, -assumeNotNull(total_amount) AS total_amount, -CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, -assumeNotNull(trip_type) AS trip_type, -ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, -ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, -CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, - -assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, -toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, -assumeNotNull(pickup_borocode) AS pickup_borocode, -CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, -toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, -toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, -CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, -toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, - -CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, - -toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, - -assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, -toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, -assumeNotNull(dropoff_borocode) AS dropoff_borocode, -CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, -toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, -toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, -CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, -toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, - -CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, - -toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma - -FROM trips -``` - -This takes 3030 seconds at a speed of about 428,000 rows per second. -To load it faster, you can create the table with the `Log` engine instead of `MergeTree`. In this case, the download works faster than 200 seconds. - -The table uses 126 GB of disk space. - -``` sql -SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active -``` - -``` text -┌─formatReadableSize(sum(bytes))─┐ -│ 126.18 GiB │ -└────────────────────────────────┘ -``` - -Among other things, you can run the OPTIMIZE query on MergeTree. But it’s not required since everything will be fine without it. - -## Download of Prepared Partitions {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar -$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" -``` - -!!! info "Info" - If you will run the queries described below, you have to use the full table name, `datasets.trips_mergetree`. - -## Results on Single Server {#results-on-single-server} - -Q1: - -``` sql -SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type -``` - -0.490 seconds. - -Q2: - -``` sql -SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count -``` - -1.224 seconds. - -Q3: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year -``` - -2.104 seconds. - -Q4: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) -FROM trips_mergetree -GROUP BY passenger_count, year, distance -ORDER BY year, count(*) DESC -``` - -3.593 seconds. - -The following server was used: - -Two Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz, 16 physical kernels total,128 GiB RAM,8x6 TB HD on hardware RAID-5 - -Execution time is the best of three runs. But starting from the second run, queries read data from the file system cache. No further caching occurs: the data is read out and processed in each run. - -Creating a table on three servers: - -On each server: - -``` sql -CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -``` - -On the source server: - -``` sql -CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) -``` - -The following query redistributes data: - -``` sql -INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree -``` - -This takes 2454 seconds. - -On three servers: - -Q1: 0.212 seconds. -Q2: 0.438 seconds. -Q3: 0.733 seconds. -Q4: 1.241 seconds. - -No surprises here, since the queries are scaled linearly. - -We also have the results from a cluster of 140 servers: - -Q1: 0.028 sec. -Q2: 0.043 sec. -Q3: 0.051 sec. -Q4: 0.072 sec. - -In this case, the query processing time is determined above all by network latency. -We ran queries using a client located in a Yandex datacenter in Finland on a cluster in Russia, which added about 20 ms of latency. - -## Summary {#summary} - -| servers | Q1 | Q2 | Q3 | Q4 | -|-------|-----|-----|-----|-----| -| 1 | 0.490 | 1.224 | 2.104 | 3.593 | -| 3 | 0.212 | 0.438 | 0.733 | 1.241 | -| 140 | 0.028 | 0.043 | 0.051 | 0.072 | - -[Original article](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/en/getting_started/example_datasets/ontime.md b/docs/en/getting_started/example_datasets/ontime.md deleted file mode 100644 index 11c9f595eab..00000000000 --- a/docs/en/getting_started/example_datasets/ontime.md +++ /dev/null @@ -1,410 +0,0 @@ ---- -toc_priority: 15 -toc_title: OnTime ---- - -# OnTime {#ontime} - -This dataset can be obtained in two ways: - -- import from raw data -- download of prepared partitions - -## Import From Raw Data {#import-from-raw-data} - -Downloading data: - -``` bash -for s in `seq 1987 2018` -do -for m in `seq 1 12` -do -wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip -done -done -``` - -(from https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) - -Creating a table: - -``` sql -CREATE TABLE `ontime` ( - `Year` UInt16, - `Quarter` UInt8, - `Month` UInt8, - `DayofMonth` UInt8, - `DayOfWeek` UInt8, - `FlightDate` Date, - `UniqueCarrier` FixedString(7), - `AirlineID` Int32, - `Carrier` FixedString(2), - `TailNum` String, - `FlightNum` String, - `OriginAirportID` Int32, - `OriginAirportSeqID` Int32, - `OriginCityMarketID` Int32, - `Origin` FixedString(5), - `OriginCityName` String, - `OriginState` FixedString(2), - `OriginStateFips` String, - `OriginStateName` String, - `OriginWac` Int32, - `DestAirportID` Int32, - `DestAirportSeqID` Int32, - `DestCityMarketID` Int32, - `Dest` FixedString(5), - `DestCityName` String, - `DestState` FixedString(2), - `DestStateFips` String, - `DestStateName` String, - `DestWac` Int32, - `CRSDepTime` Int32, - `DepTime` Int32, - `DepDelay` Int32, - `DepDelayMinutes` Int32, - `DepDel15` Int32, - `DepartureDelayGroups` String, - `DepTimeBlk` String, - `TaxiOut` Int32, - `WheelsOff` Int32, - `WheelsOn` Int32, - `TaxiIn` Int32, - `CRSArrTime` Int32, - `ArrTime` Int32, - `ArrDelay` Int32, - `ArrDelayMinutes` Int32, - `ArrDel15` Int32, - `ArrivalDelayGroups` Int32, - `ArrTimeBlk` String, - `Cancelled` UInt8, - `CancellationCode` FixedString(1), - `Diverted` UInt8, - `CRSElapsedTime` Int32, - `ActualElapsedTime` Int32, - `AirTime` Int32, - `Flights` Int32, - `Distance` Int32, - `DistanceGroup` UInt8, - `CarrierDelay` Int32, - `WeatherDelay` Int32, - `NASDelay` Int32, - `SecurityDelay` Int32, - `LateAircraftDelay` Int32, - `FirstDepTime` String, - `TotalAddGTime` String, - `LongestAddGTime` String, - `DivAirportLandings` String, - `DivReachedDest` String, - `DivActualElapsedTime` String, - `DivArrDelay` String, - `DivDistance` String, - `Div1Airport` String, - `Div1AirportID` Int32, - `Div1AirportSeqID` Int32, - `Div1WheelsOn` String, - `Div1TotalGTime` String, - `Div1LongestGTime` String, - `Div1WheelsOff` String, - `Div1TailNum` String, - `Div2Airport` String, - `Div2AirportID` Int32, - `Div2AirportSeqID` Int32, - `Div2WheelsOn` String, - `Div2TotalGTime` String, - `Div2LongestGTime` String, - `Div2WheelsOff` String, - `Div2TailNum` String, - `Div3Airport` String, - `Div3AirportID` Int32, - `Div3AirportSeqID` Int32, - `Div3WheelsOn` String, - `Div3TotalGTime` String, - `Div3LongestGTime` String, - `Div3WheelsOff` String, - `Div3TailNum` String, - `Div4Airport` String, - `Div4AirportID` Int32, - `Div4AirportSeqID` Int32, - `Div4WheelsOn` String, - `Div4TotalGTime` String, - `Div4LongestGTime` String, - `Div4WheelsOff` String, - `Div4TailNum` String, - `Div5Airport` String, - `Div5AirportID` Int32, - `Div5AirportSeqID` Int32, - `Div5WheelsOn` String, - `Div5TotalGTime` String, - `Div5LongestGTime` String, - `Div5WheelsOff` String, - `Div5TailNum` String -) ENGINE = MergeTree -PARTITION BY Year -ORDER BY (Carrier, FlightDate) -SETTINGS index_granularity = 8192; -``` - -Loading data: - -``` bash -$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done -``` - -## Download of Prepared Partitions {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar -$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.ontime" -``` - -!!! info "Info" - If you will run the queries described below, you have to use the full table name, `datasets.ontime`. - -## Queries {#queries} - -Q0. - -``` sql -SELECT avg(c1) -FROM -( - SELECT Year, Month, count(*) AS c1 - FROM ontime - GROUP BY Year, Month -); -``` - -Q1. The number of flights per day from the year 2000 to 2008 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -Q2. The number of flights delayed by more than 10 minutes, grouped by the day of the week, for 2000-2008 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -Q3. The number of delays by the airport for 2000-2008 - -``` sql -SELECT Origin, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY Origin -ORDER BY c DESC -LIMIT 10; -``` - -Q4. The number of delays by carrier for 2007 - -``` sql -SELECT Carrier, count(*) -FROM ontime -WHERE DepDelay>10 AND Year=2007 -GROUP BY Carrier -ORDER BY count(*) DESC; -``` - -Q5. The percentage of delays by carrier for 2007 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year=2007 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year=2007 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Better version of the same query: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year=2007 -GROUP BY Carrier -ORDER BY c3 DESC -``` - -Q6. The previous request for a broader range of years, 2000-2008 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year>=2000 AND Year<=2008 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year>=2000 AND Year<=2008 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Better version of the same query: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY Carrier -ORDER BY c3 DESC; -``` - -Q7. Percentage of flights delayed for more than 10 minutes, by year - -``` sql -SELECT Year, c1/c2 -FROM -( - select - Year, - count(*)*100 as c1 - from ontime - WHERE DepDelay>10 - GROUP BY Year -) -JOIN -( - select - Year, - count(*) as c2 - from ontime - GROUP BY Year -) USING (Year) -ORDER BY Year; -``` - -Better version of the same query: - -``` sql -SELECT Year, avg(DepDelay>10)*100 -FROM ontime -GROUP BY Year -ORDER BY Year; -``` - -Q8. The most popular destinations by the number of directly connected cities for various year ranges - -``` sql -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -WHERE Year >= 2000 and Year <= 2010 -GROUP BY DestCityName -ORDER BY u DESC LIMIT 10; -``` - -Q9. - -``` sql -SELECT Year, count(*) AS c1 -FROM ontime -GROUP BY Year; -``` - -Q10. - -``` sql -SELECT - min(Year), max(Year), Carrier, count(*) AS cnt, - sum(ArrDelayMinutes>30) AS flights_delayed, - round(sum(ArrDelayMinutes>30)/count(*),2) AS rate -FROM ontime -WHERE - DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') - AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') - AND FlightDate < '2010-01-01' -GROUP by Carrier -HAVING cnt>100000 and max(Year)>1990 -ORDER by rate DESC -LIMIT 1000; -``` - -Bonus: - -``` sql -SELECT avg(cnt) -FROM -( - SELECT Year,Month,count(*) AS cnt - FROM ontime - WHERE DepDel15=1 - GROUP BY Year,Month -); - -SELECT avg(c1) FROM -( - SELECT Year,Month,count(*) AS c1 - FROM ontime - GROUP BY Year,Month -); - -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -GROUP BY DestCityName -ORDER BY u DESC -LIMIT 10; - -SELECT OriginCityName, DestCityName, count() AS c -FROM ontime -GROUP BY OriginCityName, DestCityName -ORDER BY c DESC -LIMIT 10; - -SELECT OriginCityName, count() AS c -FROM ontime -GROUP BY OriginCityName -ORDER BY c DESC -LIMIT 10; -``` - -This performance test was created by Vadim Tkachenko. See: - -- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ -- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ -- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ -- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ -- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ -- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html - -[Original article](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/en/getting_started/index.md b/docs/en/getting_started/index.md deleted file mode 100644 index 61eab2f512b..00000000000 --- a/docs/en/getting_started/index.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -toc_folder_title: Getting Started -toc_hidden: true -toc_priority: 8 -toc_title: hidden ---- - -# Getting Started {#getting-started} - -If you are new to ClickHouse and want to get a hands-on feeling of its performance, first of all, you need to go through the [installation process](install.md). After that you can: - -- [Go through detailed tutorial](tutorial.md) -- [Experiment with example datasets](example_datasets/ontime.md) - -[Original article](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/en/getting_started/install.md b/docs/en/getting_started/install.md deleted file mode 100644 index 3a9cac802fc..00000000000 --- a/docs/en/getting_started/install.md +++ /dev/null @@ -1,189 +0,0 @@ ---- -toc_priority: 11 -toc_title: Installation ---- - -# Installation {#installation} - -## System Requirements {#system-requirements} - -ClickHouse can run on any Linux, FreeBSD, or Mac OS X with x86\_64, AArch64, or PowerPC64LE CPU architecture. - -Official pre-built binaries are typically compiled for x86\_64 and leverage SSE 4.2 instruction set, so unless otherwise stated usage of CPU that supports it becomes an additional system requirement. Here’s the command to check if current CPU has support for SSE 4.2: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -To run ClickHouse on processors that do not support SSE 4.2 or have AArch64 or PowerPC64LE architecture, you should [build ClickHouse from sources](#from-sources) with proper configuration adjustments. - -## Available Installation Options {#available-installation-options} - -### From DEB Packages {#install-from-deb-packages} - -It is recommended to use official pre-compiled `deb` packages for Debian or Ubuntu. - -To install official packages add the Yandex repository in `/etc/apt/sources.list` or in a separate `/etc/apt/sources.list.d/clickhouse.list` file: - - deb http://repo.clickhouse.tech/deb/stable/ main/ - -If you want to use the most recent version, replace `stable` with `testing` (this is recommended for your testing environments). - -Then run these commands to install packages: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -You can also download and install packages manually from [here](https://repo.yandex.ru/clickhouse/deb/stable/main/). - -#### Packages {#packages} - -- `clickhouse-common-static` — Installs ClickHouse compiled binary files. -- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` and installs the default server configuration. -- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` and other client-related tools. and installs client configuration files. -- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. - -### From RPM Packages {#from-rpm-packages} - -It is recommended to use official pre-compiled `rpm` packages for CentOS, RedHat, and all other rpm-based Linux distributions. - -First, you need to add the official repository: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 -``` - -If you want to use the most recent version, replace `stable` with `testing` (this is recommended for your testing environments). The `prestable` tag is sometimes available too. - -Then run these commands to install packages: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -You can also download and install packages manually from [here](https://repo.clickhouse.tech/rpm/stable/x86_64). - -### From Tgz Archives {#from-tgz-archives} - -It is recommended to use official pre-compiled `tgz` archives for all Linux distributions, where installation of `deb` or `rpm` packages is not possible. - -The required version can be downloaded with `curl` or `wget` from repository https://repo.yandex.ru/clickhouse/tgz/. -After that downloaded archives should be unpacked and installed with installation scripts. Example for the latest version: - -``` bash -export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz - -tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz -sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz -sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-server-$LATEST_VERSION.tgz -sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh -sudo /etc/init.d/clickhouse-server start - -tar -xzvf clickhouse-client-$LATEST_VERSION.tgz -sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh -``` - -For production environments, it’s recommended to use the latest `stable`-version. You can find its number on GitHub page https://github.com/ClickHouse/ClickHouse/tags with postfix `-stable`. - -### From Docker Image {#from-docker-image} - -To run ClickHouse inside Docker follow the guide on [Docker Hub](https://hub.docker.com/r/yandex/clickhouse-server/). Those images use official `deb` packages inside. - -### From Sources {#from-sources} - -To manually compile ClickHouse, follow the instructions for [Linux](../development/build.md) or [Mac OS X](../development/build_osx.md). - -You can compile packages and install them or use programs without installing packages. Also by building manually you can disable SSE 4.2 requirement or build for AArch64 CPUs. - - Client: programs/clickhouse-client - Server: programs/clickhouse-server - -You’ll need to create a data and metadata folders and `chown` them for the desired user. Their paths can be changed in server config (src/programs/server/config.xml), by default they are: - - /opt/clickhouse/data/default/ - /opt/clickhouse/metadata/default/ - -On Gentoo, you can just use `emerge clickhouse` to install ClickHouse from sources. - -## Launch {#launch} - -To start the server as a daemon, run: - -``` bash -$ sudo service clickhouse-server start -``` - -If you don’t have `service` command, run as - -``` bash -$ sudo /etc/init.d/clickhouse-server start -``` - -See the logs in the `/var/log/clickhouse-server/` directory. - -If the server doesn’t start, check the configurations in the file `/etc/clickhouse-server/config.xml`. - -You can also manually launch the server from the console: - -``` bash -$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -In this case, the log will be printed to the console, which is convenient during development. -If the configuration file is in the current directory, you don’t need to specify the `--config-file` parameter. By default, it uses `./config.xml`. - -ClickHouse supports access restriction settings. They are located in the `users.xml` file (next to `config.xml`). -By default, access is allowed from anywhere for the `default` user, without a password. See `user/default/networks`. -For more information, see the section [“Configuration Files”](../operations/configuration_files.md). - -After launching server, you can use the command-line client to connect to it: - -``` bash -$ clickhouse-client -``` - -By default, it connects to `localhost:9000` on behalf of the user `default` without a password. It can also be used to connect to a remote server using `--host` argument. - -The terminal must use UTF-8 encoding. -For more information, see the section [“Command-line client”](../interfaces/cli.md). - -Example: - -``` bash -$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**Congratulations, the system works!** - -To continue experimenting, you can download one of the test data sets or go through [tutorial](https://clickhouse.tech/tutorial.html). - -[Original article](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/en/getting_started/tutorial.md b/docs/en/getting_started/tutorial.md deleted file mode 100644 index 9763f814d59..00000000000 --- a/docs/en/getting_started/tutorial.md +++ /dev/null @@ -1,669 +0,0 @@ ---- -toc_priority: 12 -toc_title: Tutorial ---- - -# ClickHouse Tutorial {#clickhouse-tutorial} - -## What to Expect from This Tutorial? {#what-to-expect-from-this-tutorial} - -By going through this tutorial, you’ll learn how to set up a simple ClickHouse cluster. It’ll be small, but fault-tolerant and scalable. Then we will use one of the example datasets to fill it with data and execute some demo queries. - -## Single Node Setup {#single-node-setup} - -To postpone the complexities of a distributed environment, we’ll start with deploying ClickHouse on a single server or virtual machine. ClickHouse is usually installed from [deb](index.md#install-from-deb-packages) or [rpm](index.md#from-rpm-packages) packages, but there are [alternatives](index.md#from-docker-image) for the operating systems that do no support them. - -For example, you have chosen `deb` packages and executed: - -``` bash -sudo apt-get install dirmngr -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 - -echo "deb http://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list -sudo apt-get update - -sudo apt-get install -y clickhouse-server clickhouse-client -``` - -What do we have in the packages that got installed: - -- `clickhouse-client` package contains [clickhouse-client](../interfaces/cli.md) application, interactive ClickHouse console client. -- `clickhouse-common` package contains a ClickHouse executable file. -- `clickhouse-server` package contains configuration files to run ClickHouse as a server. - -Server config files are located in `/etc/clickhouse-server/`. Before going further, please notice the `` element in `config.xml`. Path determines the location for data storage, so it should be located on volume with large disk capacity; the default value is `/var/lib/clickhouse/`. If you want to adjust the configuration, it’s not handy to directly edit `config.xml` file, considering it might get rewritten on future package updates. The recommended way to override the config elements is to create [files in config.d directory](../operations/configuration_files.md) which serve as “patches” to config.xml. - -As you might have noticed, `clickhouse-server` is not launched automatically after package installation. It won’t be automatically restarted after updates, either. The way you start the server depends on your init system, usually, it is: - -``` bash -sudo service clickhouse-server start -``` - -or - -``` bash -sudo /etc/init.d/clickhouse-server start -``` - -The default location for server logs is `/var/log/clickhouse-server/`. The server is ready to handle client connections once it logs the `Ready for connections` message. - -Once the `clickhouse-server` is up and running, we can use `clickhouse-client` to connect to the server and run some test queries like `SELECT "Hello, world!";`. - -
- -Quick tips for clickhouse-client -Interactive mode: - -``` bash -clickhouse-client -clickhouse-client --host=... --port=... --user=... --password=... -``` - -Enable multiline queries: - -``` bash -clickhouse-client -m -clickhouse-client --multiline -``` - -Run queries in batch-mode: - -``` bash -clickhouse-client --query='SELECT 1' -echo 'SELECT 1' | clickhouse-client -clickhouse-client <<< 'SELECT 1' -``` - -Insert data from a file in specified format: - -``` bash -clickhouse-client --query='INSERT INTO table VALUES' < data.txt -clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv -``` - -
- -## Import Sample Dataset {#import-sample-dataset} - -Now it’s time to fill our ClickHouse server with some sample data. In this tutorial, we’ll use the anonymized data of Yandex.Metrica, the first service that runs ClickHouse in production way before it became open-source (more on that in [history section](../introduction/history.md)). There are [multiple ways to import Yandex.Metrica dataset](example_datasets/metrica.md), and for the sake of the tutorial, we’ll go with the most realistic one. - -### Download and Extract Table Data {#download-and-extract-table-data} - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -``` - -The extracted files are about 10GB in size. - -### Create Tables {#create-tables} - -As in most databases management systems, ClickHouse logically groups tables into “databases”. There’s a `default` database, but we’ll create a new one named `tutorial`: - -``` bash -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" -``` - -Syntax for creating tables is way more complicated compared to databases (see [reference](../sql_reference/statements/create.md). In general `CREATE TABLE` statement has to specify three key things: - -1. Name of table to create. -2. Table schema, i.e. list of columns and their [data types](../sql_reference/data_types/index.md). -3. [Table engine](../engines/table_engines/index.md) and its settings, which determines all the details on how queries to this table will be physically executed. - -Yandex.Metrica is a web analytics service, and sample dataset doesn’t cover its full functionality, so there are only two tables to create: - -- `hits` is a table with each action done by all users on all websites covered by the service. -- `visits` is a table that contains pre-built sessions instead of individual actions. - -Let’s see and execute the real create table queries for these tables: - -``` sql -CREATE TABLE tutorial.hits_v1 -( - `WatchID` UInt64, - `JavaEnable` UInt8, - `Title` String, - `GoodEvent` Int16, - `EventTime` DateTime, - `EventDate` Date, - `CounterID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RegionID` UInt32, - `UserID` UInt64, - `CounterClass` Int8, - `OS` UInt8, - `UserAgent` UInt8, - `URL` String, - `Referer` String, - `URLDomain` String, - `RefererDomain` String, - `Refresh` UInt8, - `IsRobot` UInt8, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `FlashMinor2` String, - `NetMajor` UInt8, - `NetMinor` UInt8, - `UserAgentMajor` UInt16, - `UserAgentMinor` FixedString(2), - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `MobilePhone` UInt8, - `MobilePhoneModel` String, - `Params` String, - `IPNetworkID` UInt32, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `IsArtifical` UInt8, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `ClientTimeZone` Int16, - `ClientEventTime` DateTime, - `SilverlightVersion1` UInt8, - `SilverlightVersion2` UInt8, - `SilverlightVersion3` UInt32, - `SilverlightVersion4` UInt16, - `PageCharset` String, - `CodeVersion` UInt32, - `IsLink` UInt8, - `IsDownload` UInt8, - `IsNotBounce` UInt8, - `FUniqID` UInt64, - `HID` UInt32, - `IsOldCounter` UInt8, - `IsEvent` UInt8, - `IsParameter` UInt8, - `DontCountHits` UInt8, - `WithHash` UInt8, - `HitColor` FixedString(1), - `UTCEventTime` DateTime, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `WindowName` Int32, - `OpenerName` Int32, - `HistoryLength` Int16, - `BrowserLanguage` FixedString(2), - `BrowserCountry` FixedString(2), - `SocialNetwork` String, - `SocialAction` String, - `HTTPError` UInt16, - `SendTiming` Int32, - `DNSTiming` Int32, - `ConnectTiming` Int32, - `ResponseStartTiming` Int32, - `ResponseEndTiming` Int32, - `FetchTiming` Int32, - `RedirectTiming` Int32, - `DOMInteractiveTiming` Int32, - `DOMContentLoadedTiming` Int32, - `DOMCompleteTiming` Int32, - `LoadEventStartTiming` Int32, - `LoadEventEndTiming` Int32, - `NSToDOMContentLoadedTiming` Int32, - `FirstPaintTiming` Int32, - `RedirectCount` Int8, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `ParamPrice` Int64, - `ParamOrderID` String, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `GoalsReached` Array(UInt32), - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `RefererHash` UInt64, - `URLHash` UInt64, - `CLID` UInt32, - `YCLID` UInt64, - `ShareService` String, - `ShareURL` String, - `ShareTitle` String, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `IslandID` FixedString(16), - `RequestNum` UInt32, - `RequestTry` UInt8 -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -``` sql -CREATE TABLE tutorial.visits_v1 -( - `CounterID` UInt32, - `StartDate` Date, - `Sign` Int8, - `IsNew` UInt8, - `VisitID` UInt64, - `UserID` UInt64, - `StartTime` DateTime, - `Duration` UInt32, - `UTCStartTime` DateTime, - `PageViews` Int32, - `Hits` Int32, - `IsBounce` UInt8, - `Referer` String, - `StartURL` String, - `RefererDomain` String, - `StartURLDomain` String, - `EndURL` String, - `LinkURL` String, - `IsDownload` UInt8, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `PlaceID` Int32, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `IsYandex` UInt8, - `GoalReachesDepth` Int32, - `GoalReachesURL` Int32, - `GoalReachesAny` Int32, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `MobilePhoneModel` String, - `ClientEventTime` DateTime, - `RegionID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `IPNetworkID` UInt32, - `SilverlightVersion3` UInt32, - `CodeVersion` UInt32, - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `UserAgentMajor` UInt16, - `UserAgentMinor` UInt16, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `SilverlightVersion2` UInt8, - `SilverlightVersion4` UInt16, - `FlashVersion3` UInt16, - `FlashVersion4` UInt16, - `ClientTimeZone` Int16, - `OS` UInt8, - `UserAgent` UInt8, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `NetMajor` UInt8, - `NetMinor` UInt8, - `MobilePhone` UInt8, - `SilverlightVersion1` UInt8, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `JavaEnable` UInt8, - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `BrowserLanguage` UInt16, - `BrowserCountry` UInt16, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `Params` Array(String), - `Goals` Nested( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32), - `WatchIDs` Array(UInt64), - `ParamSumPrice` Int64, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `ClickLogID` UInt64, - `ClickEventID` Int32, - `ClickGoodEvent` Int32, - `ClickEventTime` DateTime, - `ClickPriorityID` Int32, - `ClickPhraseID` Int32, - `ClickPageID` Int32, - `ClickPlaceID` Int32, - `ClickTypeID` Int32, - `ClickResourceID` Int32, - `ClickCost` UInt32, - `ClickClientIP` UInt32, - `ClickDomainID` UInt32, - `ClickURL` String, - `ClickAttempt` UInt8, - `ClickOrderID` UInt32, - `ClickBannerID` UInt32, - `ClickMarketCategoryID` UInt32, - `ClickMarketPP` UInt32, - `ClickMarketCategoryName` String, - `ClickMarketPPName` String, - `ClickAWAPSCampaignName` String, - `ClickPageName` String, - `ClickTargetType` UInt16, - `ClickTargetPhraseID` UInt64, - `ClickContextType` UInt8, - `ClickSelectType` Int8, - `ClickOptions` String, - `ClickGroupBannerID` Int32, - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `FirstVisit` DateTime, - `PredLastVisit` Date, - `LastVisit` Date, - `TotalVisits` UInt32, - `TraficSource` Nested( - ID Int8, - SearchEngineID UInt16, - AdvEngineID UInt8, - PlaceID UInt16, - SocialSourceNetworkID UInt8, - Domain String, - SearchPhrase String, - SocialSourcePage String), - `Attendance` FixedString(16), - `CLID` UInt32, - `YCLID` UInt64, - `NormalizedRefererHash` UInt64, - `SearchPhraseHash` UInt64, - `RefererDomainHash` UInt64, - `NormalizedStartURLHash` UInt64, - `StartURLDomainHash` UInt64, - `NormalizedEndURLHash` UInt64, - `TopLevelDomain` UInt64, - `URLScheme` UInt64, - `OpenstatServiceNameHash` UInt64, - `OpenstatCampaignIDHash` UInt64, - `OpenstatAdIDHash` UInt64, - `OpenstatSourceIDHash` UInt64, - `UTMSourceHash` UInt64, - `UTMMediumHash` UInt64, - `UTMCampaignHash` UInt64, - `UTMContentHash` UInt64, - `UTMTermHash` UInt64, - `FromHash` UInt64, - `WebVisorEnabled` UInt8, - `WebVisorActivity` UInt32, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `Market` Nested( - Type UInt8, - GoalID UInt32, - OrderID String, - OrderPrice Int64, - PP UInt32, - DirectPlaceID UInt32, - DirectOrderID UInt32, - DirectBannerID UInt32, - GoodID String, - GoodName String, - GoodQuantity Int32, - GoodPrice Int64), - `IslandID` FixedString(16) -) -ENGINE = CollapsingMergeTree(Sign) -PARTITION BY toYYYYMM(StartDate) -ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -You can execute those queries using the interactive mode of `clickhouse-client` (just launch it in a terminal without specifying a query in advance) or try some [alternative interface](../interfaces/index.md) if you want. - -As we can see, `hits_v1` uses the [basic MergeTree engine](../engines/table_engines/mergetree_family/mergetree.md), while the `visits_v1` uses the [Collapsing](../engines/table_engines/mergetree_family/collapsingmergetree.md) variant. - -### Import Data {#import-data} - -Data import to ClickHouse is done via [INSERT INTO](../sql_reference/statements/insert_into.md) query like in many other SQL databases. However, data is usually provided in one of the [supported serialization formats](../interfaces/formats.md) instead of `VALUES` clause (which is also supported). - -The files we downloaded earlier are in tab-separated format, so here’s how to import them via console client: - -``` bash -clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv -clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv -``` - -ClickHouse has a lot of [settings to tune](../operations/settings/index.md) and one way to specify them in console client is via arguments, as we can see with `--max_insert_block_size`. The easiest way to figure out what settings are available, what do they mean and what the defaults are is to query the `system.settings` table: - -``` sql -SELECT name, value, changed, description -FROM system.settings -WHERE name LIKE '%max_insert_b%' -FORMAT TSV - -max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." -``` - -Optionally you can [OPTIMIZE](../sql_reference/statements/misc.md#misc_operations-optimize) the tables after import. Tables that are configured with an engine from MergeTree-family always do merges of data parts in the background to optimize data storage (or at least check if it makes sense). These queries force the table engine to do storage optimization right now instead of some time later: - -``` bash -clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" -clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" -``` - -These queries start an I/O and CPU intensive operation, so if the table consistently receives new data, it’s better to leave it alone and let merges run in the background. - -Now we can check if the table import was successful: - -``` bash -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" -``` - -## Example Queries {#example-queries} - -``` sql -SELECT - StartURL AS URL, - AVG(Duration) AS AvgDuration -FROM tutorial.visits_v1 -WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' -GROUP BY URL -ORDER BY AvgDuration DESC -LIMIT 10 -``` - -``` sql -SELECT - sum(Sign) AS visits, - sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, - (100. * goal_visits) / visits AS goal_percent -FROM tutorial.visits_v1 -WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') -``` - -## Cluster Deployment {#cluster-deployment} - -ClickHouse cluster is a homogenous cluster. Steps to set up: - -1. Install ClickHouse server on all machines of the cluster -2. Set up cluster configs in configuration files -3. Create local tables on each instance -4. Create a [Distributed table](../engines/table_engines/special/distributed.md) - -[Distributed table](../engines/table_engines/special/distributed.md) is actually a kind of “view” to local tables of ClickHouse cluster. SELECT query from a distributed table executes using resources of all cluster’s shards. You may specify configs for multiple clusters and create multiple distributed tables providing views to different clusters. - -Example config for a cluster with three shards, one replica each: - -``` xml - - - - - example-perftest01j.yandex.ru - 9000 - - - - - example-perftest02j.yandex.ru - 9000 - - - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -For further demonstration, let’s create a new local table with the same `CREATE TABLE` query that we used for `hits_v1`, but different table name: - -``` sql -CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... -``` - -Creating a distributed table providing a view into local tables of the cluster: - -``` sql -CREATE TABLE tutorial.hits_all AS tutorial.hits_local -ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); -``` - -A common practice is to create similar Distributed tables on all machines of the cluster. It allows running distributed queries on any machine of the cluster. Also there’s an alternative option to create temporary distributed table for a given SELECT query using [remote](../sql_reference/table_functions/remote.md) table function. - -Let’s run [INSERT SELECT](../sql_reference/statements/insert_into.md) into the Distributed table to spread the table to multiple servers. - -``` sql -INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; -``` - -!!! warning "Notice" - This approach is not suitable for the sharding of large tables. There’s a separate tool [clickhouse-copier](../operations/utilities/clickhouse-copier.md) that can re-shard arbitrary large tables. - -As you could expect, computationally heavy queries run N times faster if they utilize 3 servers instead of one. - -In this case, we have used a cluster with 3 shards, and each contains a single replica. - -To provide resilience in a production environment, we recommend that each shard should contain 2-3 replicas spread between multiple availability zones or datacenters (or at least racks). Note that ClickHouse supports an unlimited number of replicas. - -Example config for a cluster of one shard containing three replicas: - -``` xml - - ... - - - - example-perftest01j.yandex.ru - 9000 - - - example-perftest02j.yandex.ru - 9000 - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -To enable native replication [ZooKeeper](http://zookeeper.apache.org/) is required. ClickHouse takes care of data consistency on all replicas and runs restore procedure after failure automatically. It’s recommended to deploy the ZooKeeper cluster on separate servers (where no other processes including ClickHouse are running). - -!!! note "Note" - ZooKeeper is not a strict requirement: in some simple cases, you can duplicate the data by writing it into all the replicas from your application code. This approach is **not** recommended, in this case, ClickHouse won’t be able to guarantee data consistency on all replicas. Thus it becomes the responsibility of your application. - -ZooKeeper locations are specified in the configuration file: - -``` xml - - - zoo01.yandex.ru - 2181 - - - zoo02.yandex.ru - 2181 - - - zoo03.yandex.ru - 2181 - - -``` - -Also, we need to set macros for identifying each shard and replica which are used on table creation: - -``` xml - - 01 - 01 - -``` - -If there are no replicas at the moment on replicated table creation, a new first replica is instantiated. If there are already live replicas, the new replica clones data from existing ones. You have an option to create all replicated tables first, and then insert data to it. Another option is to create some replicas and add the others after or during data insertion. - -``` sql -CREATE TABLE tutorial.hits_replica (...) -ENGINE = ReplcatedMergeTree( - '/clickhouse_perftest/tables/{shard}/hits', - '{replica}' -) -... -``` - -Here we use [ReplicatedMergeTree](../engines/table_engines/mergetree_family/replication.md) table engine. In parameters we specify ZooKeeper path containing shard and replica identifiers. - -``` sql -INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; -``` - -Replication operates in multi-master mode. Data can be loaded into any replica, and the system then syncs it with other instances automatically. Replication is asynchronous so at a given moment, not all replicas may contain recently inserted data. At least one replica should be up to allow data ingestion. Others will sync up data and repair consistency once they will become active again. Note that this approach allows for the low possibility of a loss of recently inserted data. - -[Original article](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/en/guides/apply-catboost-model.md b/docs/en/guides/apply-catboost-model.md new file mode 100644 index 00000000000..835f4dda7fa --- /dev/null +++ b/docs/en/guides/apply-catboost-model.md @@ -0,0 +1,237 @@ +--- +toc_priority: 41 +toc_title: Applying CatBoost Models +--- + +# Applying a Catboost Model in ClickHouse {#applying-catboost-model-in-clickhouse} + +[CatBoost](https://catboost.ai) is a free and open-source gradient boosting library developed at [Yandex](https://yandex.com/company/) for machine learning. + +With this instruction, you will learn to apply pre-trained models in ClickHouse by running model inference from SQL. + +To apply a CatBoost model in ClickHouse: + +1. [Create a Table](#create-table). +2. [Insert the Data to the Table](#insert-data-to-table). +3. [Integrate CatBoost into ClickHouse](#integrate-catboost-into-clickhouse) (Optional step). +4. [Run the Model Inference from SQL](#run-model-inference). + +For more information about training CatBoost models, see [Training and applying models](https://catboost.ai/docs/features/training.html#training). + +## Prerequisites {#prerequisites} + +If you don’t have the [Docker](https://docs.docker.com/install/) yet, install it. + +!!! note "Note" + [Docker](https://www.docker.com) is a software platform that allows you to create containers that isolate a CatBoost and ClickHouse installation from the rest of the system. + +Before applying a CatBoost model: + +**1.** Pull the [Docker image](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) from the registry: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +This Docker image contains everything you need to run CatBoost and ClickHouse: code, runtime, libraries, environment variables, and configuration files. + +**2.** Make sure the Docker image has been successfully pulled: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** Start a Docker container based on this image: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. Create a Table {#create-table} + +To create a ClickHouse table for the training sample: + +**1.** Start ClickHouse console client in the interactive mode: + +``` bash +$ clickhouse client +``` + +!!! note "Note" + The ClickHouse server is already running inside the Docker container. + +**2.** Create the table using the command: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** Exit from ClickHouse console client: + +``` sql +:) exit +``` + +## 2. Insert the Data to the Table {#insert-data-to-table} + +To insert the data: + +**1.** Run the following command: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** Start ClickHouse console client in the interactive mode: + +``` bash +$ clickhouse client +``` + +**3.** Make sure the data has been uploaded: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++-------+ +``` + +## 3. Integrate CatBoost into ClickHouse {#integrate-catboost-into-clickhouse} + +!!! note "Note" + **Optional step.** The Docker image contains everything you need to run CatBoost and ClickHouse. + +To integrate CatBoost into ClickHouse: + +**1.** Build the evaluation library. + +The fastest way to evaluate a CatBoost model is compile `libcatboostmodel.` library. For more information about how to build the library, see [CatBoost documentation](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** Create a new directory anywhere and with any name, for example, `data` and put the created library in it. The Docker image already contains the library `data/libcatboostmodel.so`. + +**3.** Create a new directory for config model anywhere and with any name, for example, `models`. + +**4.** Create a model configuration file with any name, for example, `models/amazon_model.xml`. + +**5.** Describe the model configuration: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** Add the path to CatBoost and the model configuration to the ClickHouse configuration: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. Run the Model Inference from SQL {#run-model-inference} + +For test model run the ClickHouse client `$ clickhouse client`. + +Let’s make sure that the model is working: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Note" + Function [modelEvaluate](../sql-reference/functions/other-functions.md#function-modelevaluate) returns tuple with per-class raw predictions for multiclass models. + +Let’s predict the probability: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Note" + More info about [exp()](../sql-reference/functions/math-functions.md) function. + +Let’s calculate LogLoss on the sample: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "Note" + More info about [avg()](../sql-reference/aggregate-functions/reference.md#agg_function-avg) and [log()](../sql-reference/functions/math-functions.md) functions. + +[Original article](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/en/guides/apply_catboost_model.md b/docs/en/guides/apply_catboost_model.md deleted file mode 100644 index 89942a00359..00000000000 --- a/docs/en/guides/apply_catboost_model.md +++ /dev/null @@ -1,237 +0,0 @@ ---- -toc_priority: 41 -toc_title: Applying CatBoost Models ---- - -# Applying a Catboost Model in ClickHouse {#applying-catboost-model-in-clickhouse} - -[CatBoost](https://catboost.ai) is a free and open-source gradient boosting library developed at [Yandex](https://yandex.com/company/) for machine learning. - -With this instruction, you will learn to apply pre-trained models in ClickHouse by running model inference from SQL. - -To apply a CatBoost model in ClickHouse: - -1. [Create a Table](#create-table). -2. [Insert the Data to the Table](#insert-data-to-table). -3. [Integrate CatBoost into ClickHouse](#integrate-catboost-into-clickhouse) (Optional step). -4. [Run the Model Inference from SQL](#run-model-inference). - -For more information about training CatBoost models, see [Training and applying models](https://catboost.ai/docs/features/training.html#training). - -## Prerequisites {#prerequisites} - -If you don’t have the [Docker](https://docs.docker.com/install/) yet, install it. - -!!! note "Note" - [Docker](https://www.docker.com) is a software platform that allows you to create containers that isolate a CatBoost and ClickHouse installation from the rest of the system. - -Before applying a CatBoost model: - -**1.** Pull the [Docker image](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) from the registry: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -This Docker image contains everything you need to run CatBoost and ClickHouse: code, runtime, libraries, environment variables, and configuration files. - -**2.** Make sure the Docker image has been successfully pulled: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** Start a Docker container based on this image: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. Create a Table {#create-table} - -To create a ClickHouse table for the training sample: - -**1.** Start ClickHouse console client in the interactive mode: - -``` bash -$ clickhouse client -``` - -!!! note "Note" - The ClickHouse server is already running inside the Docker container. - -**2.** Create the table using the command: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** Exit from ClickHouse console client: - -``` sql -:) exit -``` - -## 2. Insert the Data to the Table {#insert-data-to-table} - -To insert the data: - -**1.** Run the following command: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** Start ClickHouse console client in the interactive mode: - -``` bash -$ clickhouse client -``` - -**3.** Make sure the data has been uploaded: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+-------+ -``` - -## 3. Integrate CatBoost into ClickHouse {#integrate-catboost-into-clickhouse} - -!!! note "Note" - **Optional step.** The Docker image contains everything you need to run CatBoost and ClickHouse. - -To integrate CatBoost into ClickHouse: - -**1.** Build the evaluation library. - -The fastest way to evaluate a CatBoost model is compile `libcatboostmodel.` library. For more information about how to build the library, see [CatBoost documentation](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** Create a new directory anywhere and with any name, for example, `data` and put the created library in it. The Docker image already contains the library `data/libcatboostmodel.so`. - -**3.** Create a new directory for config model anywhere and with any name, for example, `models`. - -**4.** Create a model configuration file with any name, for example, `models/amazon_model.xml`. - -**5.** Describe the model configuration: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** Add the path to CatBoost and the model configuration to the ClickHouse configuration: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. Run the Model Inference from SQL {#run-model-inference} - -For test model run the ClickHouse client `$ clickhouse client`. - -Let’s make sure that the model is working: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Note" - Function [modelEvaluate](../sql_reference/functions/other_functions.md#function-modelevaluate) returns tuple with per-class raw predictions for multiclass models. - -Let’s predict the probability: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Note" - More info about [exp()](../sql_reference/functions/math_functions.md) function. - -Let’s calculate LogLoss on the sample: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "Note" - More info about [avg()](../sql_reference/aggregate_functions/reference.md#agg_function-avg) and [log()](../sql_reference/functions/math_functions.md) functions. - -[Original article](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/en/guides/index.md b/docs/en/guides/index.md index e18c5fac223..ea20a606cac 100644 --- a/docs/en/guides/index.md +++ b/docs/en/guides/index.md @@ -8,7 +8,7 @@ toc_title: Overview List of detailed step-by-step instructions that help to solve various tasks using ClickHouse: -- [Tutorial on simple cluster set-up](../getting_started/tutorial.md) -- [Applying a CatBoost model in ClickHouse](apply_catboost_model.md) +- [Tutorial on simple cluster set-up](../getting-started/tutorial.md) +- [Applying a CatBoost model in ClickHouse](apply-catboost-model.md) [Original article](https://clickhouse.tech/docs/en/guides/) diff --git a/docs/en/images/column_oriented.gif b/docs/en/images/column-oriented.gif similarity index 100% rename from docs/en/images/column_oriented.gif rename to docs/en/images/column-oriented.gif diff --git a/docs/en/images/logo.svg b/docs/en/images/logo.svg index 865b96d98c7..17da9417e2d 100644 --- a/docs/en/images/logo.svg +++ b/docs/en/images/logo.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/docs/en/images/row_oriented.gif b/docs/en/images/row-oriented.gif similarity index 100% rename from docs/en/images/row_oriented.gif rename to docs/en/images/row-oriented.gif diff --git a/docs/en/index.md b/docs/en/index.md index 67c4ca4d53b..fb7e1eb67d9 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -3,14 +3,14 @@ toc_priority: 0 toc_title: Overview --- -# What is ClickHouse? {#what-is-clickhouse} +# What Is ClickHouse? {#what-is-clickhouse} ClickHouse is a column-oriented database management system (DBMS) for online analytical processing of queries (OLAP). In a “normal” row-oriented DBMS, data is stored in this order: | 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 | @@ -23,7 +23,7 @@ Examples of a row-oriented DBMS are MySQL, Postgres, and MS SQL Server. In a column-oriented DBMS, data is stored like this: | Row: | \#0 | \#1 | \#2 | \#N | -|---------|-------------|-------------|-------------|---| +|-------------|---------------------|---------------------|---------------------|-----| | WatchID: | 89354350662 | 90329509958 | 89953706054 | … | | JavaEnable: | 1 | 0 | 1 | … | | Title: | Investor Relations | Contact us | Mission | … | @@ -62,11 +62,11 @@ Column-oriented databases are better suited to OLAP scenarios: they are at least **Row-oriented DBMS** -![Row-oriented](images/row_oriented.gif#) +![Row-oriented](images/row-oriented.gif#) **Column-oriented DBMS** -![Column-oriented](images/column_oriented.gif#) +![Column-oriented](images/column-oriented.gif#) See the difference? diff --git a/docs/en/interfaces/cli.md b/docs/en/interfaces/cli.md index 5bad73008a6..07ed3e5c884 100644 --- a/docs/en/interfaces/cli.md +++ b/docs/en/interfaces/cli.md @@ -7,7 +7,7 @@ toc_title: Command-Line Client ClickHouse provides a native command-line client: `clickhouse-client`. The client supports command-line options and configuration files. For more information, see [Configuring](#interfaces_cli_configuration). -[Install](../getting_started/index.md) it from the `clickhouse-client` package and run it with the command `clickhouse-client`. +[Install](../getting-started/index.md) it from the `clickhouse-client` package and run it with the command `clickhouse-client`. ``` bash $ clickhouse-client @@ -87,7 +87,7 @@ Format a query as usual, then place the values that you want to pass from the ap ``` - `name` — Placeholder identifier. In the console client it should be used in app parameters as `--param_ = value`. -- `data type` — [Data type](../sql_reference/data_types/index.md) of the app parameter value. For example, a data structure like `(integer, ('string', integer))` can have the `Tuple(UInt8, Tuple(String, UInt8))` data type (you can also use another [integer](../sql_reference/data_types/int_uint.md) types). +- `data type` — [Data type](../sql-reference/data-types/index.md) of the app parameter value. For example, a data structure like `(integer, ('string', integer))` can have the `Tuple(UInt8, Tuple(String, UInt8))` data type (you can also use another [integer](../sql-reference/data-types/int-uint.md) types). #### Example {#example} diff --git a/docs/en/interfaces/formats.md b/docs/en/interfaces/formats.md index 51985ba89e1..4697fbca7e1 100644 --- a/docs/en/interfaces/formats.md +++ b/docs/en/interfaces/formats.md @@ -108,9 +108,9 @@ Only a small set of symbols are escaped. You can easily stumble onto a string va Arrays are written as a list of comma-separated values in square brackets. Number items in the array are formatted as normally. `Date` and `DateTime` types are written in single quotes. Strings are written in single quotes with the same escaping rules as above. -[NULL](../sql_reference/syntax.md) is formatted as `\N`. +[NULL](../sql-reference/syntax.md) is formatted as `\N`. -Each element of [Nested](../sql_reference/data_types/nested_data_structures/nested.md) structures is represented as array. +Each element of [Nested](../sql-reference/data-types/nested-data-structures/nested.md) structures is represented as array. For example: @@ -330,7 +330,7 @@ SearchPhrase=curtain designs count()=1064 SearchPhrase=baku count()=1000 ``` -[NULL](../sql_reference/syntax.md) is formatted as `\N`. +[NULL](../sql-reference/syntax.md) is formatted as `\N`. ``` sql SELECT * FROM t_null FORMAT TSKV @@ -462,7 +462,7 @@ If the query contains GROUP BY, rows\_before\_limit\_at\_least is the exact numb This format is only appropriate for outputting a query result, but not for parsing (retrieving data to insert in a table). -ClickHouse supports [NULL](../sql_reference/syntax.md), which is displayed as `null` in the JSON output. +ClickHouse supports [NULL](../sql-reference/syntax.md), which is displayed as `null` in the JSON output. See also the [JSONEachRow](#jsoneachrow) format. @@ -539,7 +539,7 @@ ClickHouse ignores spaces between elements and commas after the objects. You can **Omitted values processing** -ClickHouse substitutes omitted values with the default values for the corresponding [data types](../sql_reference/data_types/index.md). +ClickHouse substitutes omitted values with the default values for the corresponding [data types](../sql-reference/data-types/index.md). If `DEFAULT expr` is specified, ClickHouse uses different substitution rules depending on the [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) setting. @@ -584,7 +584,7 @@ Unlike the [JSON](#json) format, there is no substitution of invalid UTF-8 seque ### Usage of Nested Structures {#jsoneachrow-nested} -If you have a table with [Nested](../sql_reference/data_types/nested_data_structures/nested.md) data type columns, you can insert JSON data with the same structure. Enable this feature with the [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) setting. +If you have a table with [Nested](../sql-reference/data-types/nested-data-structures/nested.md) data type columns, you can insert JSON data with the same structure. Enable this feature with the [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) setting. For example, consider the following table: @@ -658,7 +658,7 @@ Outputs data as Unicode-art tables, also using ANSI-escape sequences for setting A full grid of the table is drawn, and each row occupies two lines in the terminal. Each result block is output as a separate table. This is necessary so that blocks can be output without buffering results (buffering would be necessary in order to pre-calculate the visible width of all the values). -[NULL](../sql_reference/syntax.md) is output as `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) is output as `ᴺᵁᴸᴸ`. Example (shown for the [PrettyCompact](#prettycompact) format): @@ -762,7 +762,7 @@ FixedString is represented simply as a sequence of bytes. Array is represented as a varint length (unsigned [LEB128](https://en.wikipedia.org/wiki/LEB128)), followed by successive elements of the array. -For [NULL](../sql_reference/syntax.md#null-literal) support, an additional byte containing 1 or 0 is added before each [Nullable](../sql_reference/data_types/nullable.md) value. If 1, then the value is `NULL` and this byte is interpreted as a separate value. If 0, the value after the byte is not `NULL`. +For [NULL](../sql-reference/syntax.md#null-literal) support, an additional byte containing 1 or 0 is added before each [Nullable](../sql-reference/data-types/nullable.md) value. If 1, then the value is `NULL` and this byte is interpreted as a separate value. If 0, the value after the byte is not `NULL`. ## RowBinaryWithNamesAndTypes {#rowbinarywithnamesandtypes} @@ -774,7 +774,7 @@ Similar to [RowBinary](#rowbinary), but with added header: ## Values {#data-format-values} -Prints every row in brackets. Rows are separated by commas. There is no comma after the last row. The values inside the brackets are also comma-separated. Numbers are output in a decimal format without quotes. Arrays are output in square brackets. Strings, dates, and dates with times are output in quotes. Escaping rules and parsing are similar to the [TabSeparated](#tabseparated) format. During formatting, extra spaces aren’t inserted, but during parsing, they are allowed and skipped (except for spaces inside array values, which are not allowed). [NULL](../sql_reference/syntax.md) is represented as `NULL`. +Prints every row in brackets. Rows are separated by commas. There is no comma after the last row. The values inside the brackets are also comma-separated. Numbers are output in a decimal format without quotes. Arrays are output in square brackets. Strings, dates, and dates with times are output in quotes. Escaping rules and parsing are similar to the [TabSeparated](#tabseparated) format. During formatting, extra spaces aren’t inserted, but during parsing, they are allowed and skipped (except for spaces inside array values, which are not allowed). [NULL](../sql-reference/syntax.md) is represented as `NULL`. The minimum set of characters that you need to escape when passing data in Values ​​format: single quotes and backslashes. @@ -786,7 +786,7 @@ See also: [input\_format\_values\_interpret\_expressions](../operations/settings Prints each value on a separate line with the column name specified. This format is convenient for printing just one or a few rows if each row consists of a large number of columns. -[NULL](../sql_reference/syntax.md) is output as `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) is output as `ᴺᵁᴸᴸ`. Example: @@ -965,7 +965,7 @@ message MessageType { ``` ClickHouse tries to find a column named `x.y.z` (or `x_y_z` or `X.y_Z` and so on). -Nested messages are suitable to input or output a [nested data structures](../sql_reference/data_types/nested_data_structures/nested.md). +Nested messages are suitable to input or output a [nested data structures](../sql-reference/data-types/nested-data-structures/nested.md). Default values defined in a protobuf schema like this @@ -977,7 +977,7 @@ message MessageType { } ``` -are not applied; the [table defaults](../sql_reference/statements/create.md#create-default-values) are used instead of them. +are not applied; the [table defaults](../sql-reference/statements/create.md#create-default-values) are used instead of them. ClickHouse inputs and outputs protobuf messages in the `length-delimited` format. It means before every message should be written its length as a [varint](https://developers.google.com/protocol-buffers/docs/encoding#varints). @@ -991,23 +991,23 @@ ClickHouse Avro format supports reading and writing [Avro data files](http://avr ### Data Types Matching {#data_types-matching} -The table below shows supported data types and how they match ClickHouse [data types](../sql_reference/data_types/index.md) in `INSERT` and `SELECT` queries. +The table below shows supported data types and how they match ClickHouse [data types](../sql-reference/data-types/index.md) in `INSERT` and `SELECT` queries. | Avro data type `INSERT` | ClickHouse data type | Avro data type `SELECT` | |---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|------------------------------| -| `boolean`, `int`, `long`, `float`, `double` | [Int(8\|16\|32)](../sql_reference/data_types/int_uint.md), [UInt(8\|16\|32)](../sql_reference/data_types/int_uint.md) | `int` | -| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql_reference/data_types/int_uint.md), [UInt64](../sql_reference/data_types/int_uint.md) | `long` | -| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql_reference/data_types/float.md) | `float` | -| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql_reference/data_types/float.md) | `double` | -| `bytes`, `string`, `fixed`, `enum` | [String](../sql_reference/data_types/string.md) | `bytes` | -| `bytes`, `string`, `fixed` | [FixedString(N)](../sql_reference/data_types/fixedstring.md) | `fixed(N)` | -| `enum` | [Enum(8\|16)](../sql_reference/data_types/enum.md) | `enum` | -| `array(T)` | [Array(T)](../sql_reference/data_types/array.md) | `array(T)` | -| `union(null, T)`, `union(T, null)` | [Nullable(T)](../sql_reference/data_types/date.md) | `union(null, T)` | -| `null` | [Nullable(Nothing)](../sql_reference/data_types/special_data_types/nothing.md) | `null` | -| `int (date)` \* | [Date](../sql_reference/data_types/date.md) | `int (date)` \* | -| `long (timestamp-millis)` \* | [DateTime64(3)](../sql_reference/data_types/datetime.md) | `long (timestamp-millis)` \* | -| `long (timestamp-micros)` \* | [DateTime64(6)](../sql_reference/data_types/datetime.md) | `long (timestamp-micros)` \* | +| `boolean`, `int`, `long`, `float`, `double` | [Int(8\|16\|32)](../sql-reference/data-types/int-uint.md), [UInt(8\|16\|32)](../sql-reference/data-types/int-uint.md) | `int` | +| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql-reference/data-types/int-uint.md), [UInt64](../sql-reference/data-types/int-uint.md) | `long` | +| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql-reference/data-types/float.md) | `float` | +| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql-reference/data-types/float.md) | `double` | +| `bytes`, `string`, `fixed`, `enum` | [String](../sql-reference/data-types/string.md) | `bytes` | +| `bytes`, `string`, `fixed` | [FixedString(N)](../sql-reference/data-types/fixedstring.md) | `fixed(N)` | +| `enum` | [Enum(8\|16)](../sql-reference/data-types/enum.md) | `enum` | +| `array(T)` | [Array(T)](../sql-reference/data-types/array.md) | `array(T)` | +| `union(null, T)`, `union(T, null)` | [Nullable(T)](../sql-reference/data-types/date.md) | `union(null, T)` | +| `null` | [Nullable(Nothing)](../sql-reference/data-types/special-data-types/nothing.md) | `null` | +| `int (date)` \* | [Date](../sql-reference/data-types/date.md) | `int (date)` \* | +| `long (timestamp-millis)` \* | [DateTime64(3)](../sql-reference/data-types/datetime.md) | `long (timestamp-millis)` \* | +| `long (timestamp-micros)` \* | [DateTime64(6)](../sql-reference/data-types/datetime.md) | `long (timestamp-micros)` \* | \* [Avro logical types](http://avro.apache.org/docs/current/spec.html#Logical+Types) @@ -1028,7 +1028,7 @@ The root schema of input Avro file must be of `record` type. To find the correspondence between table columns and fields of Avro schema ClickHouse compares their names. This comparison is case-sensitive. Unused fields are skipped. -Data types of ClickHouse table columns can differ from the corresponding fields of the Avro data inserted. When inserting data, ClickHouse interprets data types according to the table above and then [casts](../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) the data to corresponding column type. +Data types of ClickHouse table columns can differ from the corresponding fields of the Avro data inserted. When inserting data, ClickHouse interprets data types according to the table above and then [casts](../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) the data to corresponding column type. ### Selecting Data {#selecting-data-1} @@ -1070,7 +1070,7 @@ $ kafkacat -b kafka-broker -C -t topic1 -o beginning -f '%s' -c 3 | clickhouse- 3 c ``` -To use `AvroConfluent` with [Kafka](../engines/table_engines/integrations/kafka.md): +To use `AvroConfluent` with [Kafka](../engines/table-engines/integrations/kafka.md): ``` sql CREATE TABLE topic1_stream @@ -1099,25 +1099,25 @@ SELECT * FROM topic1_stream; ### Data Types Matching {#data_types-matching-2} -The table below shows supported data types and how they match ClickHouse [data types](../sql_reference/data_types/index.md) in `INSERT` and `SELECT` queries. +The table below shows supported data types and how they match ClickHouse [data types](../sql-reference/data-types/index.md) in `INSERT` and `SELECT` queries. | Parquet data type (`INSERT`) | ClickHouse data type | Parquet data type (`SELECT`) | |------------------------------|-----------------------------------------------------------|------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | `UINT8` | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | `INT8` | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | `UINT16` | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | `INT16` | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | `UINT32` | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | `INT32` | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | `UINT64` | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | `INT64` | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | `FLOAT` | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | `DOUBLE` | -| `DATE32` | [Date](../sql_reference/data_types/date.md) | `UINT16` | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | `UINT32` | -| `STRING`, `BINARY` | [String](../sql_reference/data_types/string.md) | `STRING` | -| — | [FixedString](../sql_reference/data_types/fixedstring.md) | `STRING` | -| `DECIMAL` | [Decimal](../sql_reference/data_types/decimal.md) | `DECIMAL` | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | `UINT8` | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | `INT8` | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | `UINT16` | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | `INT16` | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | `UINT32` | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | `INT32` | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | `UINT64` | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | `INT64` | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | `FLOAT` | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | `DOUBLE` | +| `DATE32` | [Date](../sql-reference/data-types/date.md) | `UINT16` | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | `UINT32` | +| `STRING`, `BINARY` | [String](../sql-reference/data-types/string.md) | `STRING` | +| — | [FixedString](../sql-reference/data-types/fixedstring.md) | `STRING` | +| `DECIMAL` | [Decimal](../sql-reference/data-types/decimal.md) | `DECIMAL` | ClickHouse supports configurable precision of `Decimal` type. The `INSERT` query treats the Parquet `DECIMAL` type as the ClickHouse `Decimal128` type. @@ -1139,7 +1139,7 @@ You can select data from a ClickHouse table and save them into some file in the $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_file.pq} ``` -To exchange data with Hadoop, you can use [HDFS table engine](../engines/table_engines/integrations/hdfs.md). +To exchange data with Hadoop, you can use [HDFS table engine](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} @@ -1147,30 +1147,30 @@ To exchange data with Hadoop, you can use [HDFS table engine](../engines/table_e ### Data Types Matching {#data_types-matching-3} -The table below shows supported data types and how they match ClickHouse [data types](../sql_reference/data_types/index.md) in `INSERT` queries. +The table below shows supported data types and how they match ClickHouse [data types](../sql-reference/data-types/index.md) in `INSERT` queries. | ORC data type (`INSERT`) | ClickHouse data type | |--------------------------|-----------------------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | -| `DATE32` | [Date](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [String](../sql_reference/data_types/string.md) | -| `DECIMAL` | [Decimal](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | +| `DATE32` | [Date](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [String](../sql-reference/data-types/string.md) | +| `DECIMAL` | [Decimal](../sql-reference/data-types/decimal.md) | ClickHouse supports configurable precision of the `Decimal` type. The `INSERT` query treats the ORC `DECIMAL` type as the ClickHouse `Decimal128` type. Unsupported ORC data types: `DATE32`, `TIME32`, `FIXED_SIZE_BINARY`, `JSON`, `UUID`, `ENUM`. -The data types of ClickHouse table columns don’t have to match the corresponding ORC data fields. When inserting data, ClickHouse interprets data types according to the table above and then [casts](../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) the data to the data type set for the ClickHouse table column. +The data types of ClickHouse table columns don’t have to match the corresponding ORC data fields. When inserting data, ClickHouse interprets data types according to the table above and then [casts](../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) the data to the data type set for the ClickHouse table column. ### Inserting Data {#inserting-data-2} @@ -1180,7 +1180,7 @@ You can insert ORC data from a file into ClickHouse table by the following comma $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -To exchange data with Hadoop, you can use [HDFS table engine](../engines/table_engines/integrations/hdfs.md). +To exchange data with Hadoop, you can use [HDFS table engine](../engines/table-engines/integrations/hdfs.md). ## Format Schema {#formatschema} @@ -1196,7 +1196,7 @@ can contain an absolute path or a path relative to the current directory on the If you use the client in the [batch mode](../interfaces/cli.md#cli_usage), the path to the schema must be relative due to security reasons. If you input or output data via the [HTTP interface](../interfaces/http.md) the file name specified in the format schema -should be located in the directory specified in [format\_schema\_path](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) +should be located in the directory specified in [format\_schema\_path](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) in the server configuration. ## Skipping Errors {#skippingerrors} diff --git a/docs/en/interfaces/http.md b/docs/en/interfaces/http.md index 0e18e00bb0d..32e919af09d 100644 --- a/docs/en/interfaces/http.md +++ b/docs/en/interfaces/http.md @@ -9,7 +9,7 @@ The HTTP interface lets you use ClickHouse on any platform from any programming By default, clickhouse-server listens for HTTP on port 8123 (this can be changed in the config). -If you make a GET / request without parameters, it returns 200 response code and the string which defined in [http\_server\_default\_response](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-http_server_default_response) default value “Ok.” (with a line feed at the end) +If you make a GET / request without parameters, it returns 200 response code and the string which defined in [http\_server\_default\_response](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-http_server_default_response) default value “Ok.” (with a line feed at the end) ``` bash $ curl 'http://localhost:8123/' @@ -301,13 +301,16 @@ Example: ``` xml - - /metrics - GET - + + /predefined_query + POST,GET + + predefined_query_handler SELECT * FROM system.metrics LIMIT 5 FORMAT Template SETTINGS format_template_resultset = 'prometheus_template_output_format_resultset', format_template_row = 'prometheus_template_output_format_row', format_template_rows_between_delimiter = '\n' - - + + + ... + ... ``` @@ -316,21 +319,23 @@ Example: ``` bash -curl -vvv 'http://localhost:8123/metrics' +$ curl -v 'http://localhost:8123/predefined_query' * Trying ::1... * Connected to localhost (::1) port 8123 (#0) -> GET /metrics HTTP/1.1 +> GET /predefined_query HTTP/1.1 > Host: localhost:8123 > User-Agent: curl/7.47.0 > Accept: */* > < HTTP/1.1 200 OK -< Date: Wed, 27 Nov 2019 08:54:25 GMT +< Date: Tue, 28 Apr 2020 08:52:56 GMT < Connection: Keep-Alive < Content-Type: text/plain; charset=UTF-8 -< X-ClickHouse-Server-Display-Name: i-tl62qd0o +< X-ClickHouse-Server-Display-Name: i-mloy5trc < Transfer-Encoding: chunked -< X-ClickHouse-Query-Id: f39235f6-6ed7-488c-ae07-c7ceafb960f6 +< X-ClickHouse-Query-Id: 96fe0052-01e6-43ce-b12a-6b7370de6e8a +< X-ClickHouse-Format: Template +< X-ClickHouse-Timezone: Asia/Shanghai < Keep-Alive: timeout=3 < X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"} < @@ -354,117 +359,62 @@ curl -vvv 'http://localhost:8123/metrics' # TYPE "ReplicatedSend" counter "ReplicatedSend" 0 +* Connection #0 to host localhost left intact + + * Connection #0 to host localhost left intact ``` -As you can see from the example, if `` is configured in the config.xml file, ClickHouse will match the HTTP requests received to the predefined type in ``, then ClickHouse will execute the corresponding predefined query if the match is successful. +As you can see from the example, if `` is configured in the config.xml file and `` can contain many `s`. ClickHouse will match the HTTP requests received to the predefined type in `` and the first matched runs the handler. Then ClickHouse will execute the corresponding predefined query if the match is successful. -Now `` can configure ``, ``, ``, `` and `` . +> Now `` can configure ``, ``, ``,``: +> `` is responsible for matching the method part of the HTTP request. `` fully conforms to the definition of [method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) in the HTTP protocol. It is an optional configuration. If it is not defined in the configuration file, it does not match the method portion of the HTTP request. +> +> `` is responsible for matching the url part of the HTTP request. It is compatible with [RE2](https://github.com/google/re2)’s regular expressions. It is an optional configuration. If it is not defined in the configuration file, it does not match the url portion of the HTTP request. +> +> `` is responsible for matching the header part of the HTTP request. It is compatible with RE2’s regular expressions. It is an optional configuration. If it is not defined in the configuration file, it does not match the header portion of the HTTP request. +> +> `` contains the main processing part. Now `` can configure ``, ``, ``, ``, ``, ``. +> \> `` currently supports three types: **predefined\_query\_handler**, **dynamic\_query\_handler**, **static**. +> \> +> \> `` - use with predefined\_query\_handler type, executes query when the handler is called. +> \> +> \> `` - use with dynamic\_query\_handler type, extracts and executes the value corresponding to the value in HTTP request params. +> \> +> \> `` - use with static type, response status code. +> \> +> \> `` - use with static type, response [content-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type). +> \> +> \> `` - use with static type, Response content sent to client, when using the prefix ‘file://’ or ‘config://’, find the content from the file or configuration send to client. -## root\_handler {#root_handler} - -`` returns the specified content for the root path request. The specific return content is configured by `http_server_default_response` in config.xml. if not specified, return **Ok.** - -`http_server_default_response` is not defined and an HTTP request is sent to ClickHouse. The result is as follows: - -``` xml - - - -``` - - $ curl 'http://localhost:8123' - Ok. - -`http_server_default_response` is defined and an HTTP request is sent to ClickHouse. The result is as follows: - -``` xml -
]]>
- - - - -``` - - $ curl 'http://localhost:8123' -
% - -## ping\_handler {#ping_handler} - -`` can be used to probe the health of the current ClickHouse Server. When the ClickHouse HTTP Server is normal, accessing ClickHouse through `` will return **Ok.**. - -Example: - -``` xml - - /ping - -``` - -``` bash -$ curl 'http://localhost:8123/ping' -Ok. -``` - -## replicas\_status\_handler {#replicas_status_handler} - -`` is used to detect the state of the replica node and return **Ok.** if the replica node has no delay. If there is a delay, return the specific delay. The value of `` supports customization. If you do not specify ``, ClickHouse default setting `` is **/replicas\_status**. - -Example: - -``` xml - - /replicas_status - -``` - -No delay case: - -``` bash -$ curl 'http://localhost:8123/replicas_status' -Ok. -``` - -Delayed case: - -``` bash -$ curl 'http://localhost:8123/replicas_status' -db.stats: Absolute delay: 22. Relative delay: 22. -``` +Next are the configuration methods for the different ``. ## predefined\_query\_handler {#predefined_query_handler} -You can configure ``, ``, `` and `` in ``. +`` supports setting Settings and query\_params values. You can configure `` in the type of ``. -`` is responsible for matching the method part of the HTTP request. `` fully conforms to the definition of [method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) in the HTTP protocol. It is an optional configuration. If it is not defined in the configuration file, it does not match the method portion of the HTTP request - -`` is responsible for matching the url part of the HTTP request. It is compatible with [RE2](https://github.com/google/re2)’s regular expressions. It is an optional configuration. If it is not defined in the configuration file, it does not match the url portion of the HTTP request - -`` is responsible for matching the header part of the HTTP request. It is compatible with RE2’s regular expressions. It is an optional configuration. If it is not defined in the configuration file, it does not match the header portion of the HTTP request - -`` value is a predefined query of ``, which is executed by ClickHouse when an HTTP request is matched and the result of the query is returned. It is a must configuration. - -`` supports setting Settings and query\_params values. +`` value is a predefined query of ``, which is executed by ClickHouse when an HTTP request is matched and the result of the query is returned. It is a must configuration. The following example defines the values of `max_threads` and `max_alter_threads` settings, then queries the system table to check whether these settings were set successfully. Example: ``` xml - - + + + [^/]+)(/(?P[^/]+))?]]> GET TEST_HEADER_VALUE [^/]+)(/(?P[^/]+))?]]> - [^/]+)(/(?P[^/]+))?]]> - + + predefined_query_handler SELECT value FROM system.settings WHERE name = {name_1:String} SELECT name, value FROM system.settings WHERE name = {name_2:String} - - - +
+
+
``` ``` bash @@ -473,37 +423,193 @@ $ curl -H 'XXX:TEST_HEADER_VALUE' -H 'PARAMS_XXX:max_threads' 'http://localhost: max_alter_threads 2 ``` -!!! note "Note" - In one ``, one `` only supports one `` of an insert type. +!!! note "caution" + In one `` only supports one `` of an insert type. ## dynamic\_query\_handler {#dynamic_query_handler} -`` than `` increased `` . +In ``, query is written in the form of param of the HTTP request. The difference is that in ``, query is wrote in the configuration file. You can configure `` in ``. -ClickHouse extracts and executes the value corresponding to the `` value in the url of the HTTP request. -ClickHouse default setting `` is `/query` . It is an optional configuration. If there is no definition in the configuration file, the param is not passed in. +ClickHouse extracts and executes the value corresponding to the `` value in the url of the HTTP request. The default value of `` is `/query` . It is an optional configuration. If there is no definition in the configuration file, the param is not passed in. To experiment with this functionality, the example defines the values of max\_threads and max\_alter\_threads and queries whether the Settings were set successfully. -The difference is that in ``, query is wrote in the configuration file. But in ``, query is written in the form of param of the HTTP request. Example: ``` xml - - - - TEST_HEADER_VALUE_DYNAMIC - [^/]+)(/(?P[^/]+))?]]> - + + + + TEST_HEADER_VALUE_DYNAMIC + + dynamic_query_handler query_param - - + +
+
``` ``` bash -$ curl -H 'XXX:TEST_HEADER_VALUE_DYNAMIC' -H 'PARAMS_XXX:max_threads' 'http://localhost:8123/?query_param=SELECT%20value%20FROM%20system.settings%20where%20name%20=%20%7Bname_1:String%7D%20OR%20name%20=%20%7Bname_2:String%7D&max_threads=1&max_alter_threads=2¶m_name_2=max_alter_threads' -1 -2 +$ curl -H 'XXX:TEST_HEADER_VALUE_DYNAMIC' 'http://localhost:8123/own?max_threads=1&max_alter_threads=2¶m_name_1=max_threads¶m_name_2=max_alter_threads&query_param=SELECT%20name,value%20FROM%20system.settings%20where%20name%20=%20%7Bname_1:String%7D%20OR%20name%20=%20%7Bname_2:String%7D' +max_threads 1 +max_alter_threads 2 +``` + +## static {#static} + +`` can return [content\_type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type), [status](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) and response\_content. response\_content can return the specified content + +Example: + +Return a message. + +``` xml + + + GET + xxx + /hi + + static + 402 + text/html; charset=UTF-8 + Say Hi! + + + +``` + +``` bash +$ curl -vv -H 'XXX:xxx' 'http://localhost:8123/hi' +* Trying ::1... +* Connected to localhost (::1) port 8123 (#0) +> GET /hi HTTP/1.1 +> Host: localhost:8123 +> User-Agent: curl/7.47.0 +> Accept: */* +> XXX:xxx +> +< HTTP/1.1 402 Payment Required +< Date: Wed, 29 Apr 2020 03:51:26 GMT +< Connection: Keep-Alive +< Content-Type: text/html; charset=UTF-8 +< Transfer-Encoding: chunked +< Keep-Alive: timeout=3 +< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"} +< +* Connection #0 to host localhost left intact +Say Hi!% +``` + +Find the content from the configuration send to client. + +``` xml +
]]>
+ + + + GET + xxx + /get_config_static_handler + + static + config://get_config_static_handler + + + +``` + +``` bash +$ curl -v -H 'XXX:xxx' 'http://localhost:8123/get_config_static_handler' +* Trying ::1... +* Connected to localhost (::1) port 8123 (#0) +> GET /get_config_static_handler HTTP/1.1 +> Host: localhost:8123 +> User-Agent: curl/7.47.0 +> Accept: */* +> XXX:xxx +> +< HTTP/1.1 200 OK +< Date: Wed, 29 Apr 2020 04:01:24 GMT +< Connection: Keep-Alive +< Content-Type: text/plain; charset=UTF-8 +< Transfer-Encoding: chunked +< Keep-Alive: timeout=3 +< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"} +< +* Connection #0 to host localhost left intact +
% +``` + +Find the content from the file send to client. + +``` xml + + + GET + xxx + /get_absolute_path_static_handler + + static + text/html; charset=UTF-8 + file:///absolute_path_file.html + + + + GET + xxx + /get_relative_path_static_handler + + static + text/html; charset=UTF-8 + file://./relative_path_file.html + + + +``` + +``` bash +$ user_files_path='/var/lib/clickhouse/user_files' +$ sudo echo "Relative Path File" > $user_files_path/relative_path_file.html +$ sudo echo "Absolute Path File" > $user_files_path/absolute_path_file.html +$ curl -vv -H 'XXX:xxx' 'http://localhost:8123/get_absolute_path_static_handler' +* Trying ::1... +* Connected to localhost (::1) port 8123 (#0) +> GET /get_absolute_path_static_handler HTTP/1.1 +> Host: localhost:8123 +> User-Agent: curl/7.47.0 +> Accept: */* +> XXX:xxx +> +< HTTP/1.1 200 OK +< Date: Wed, 29 Apr 2020 04:18:16 GMT +< Connection: Keep-Alive +< Content-Type: text/html; charset=UTF-8 +< Transfer-Encoding: chunked +< Keep-Alive: timeout=3 +< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"} +< +Absolute Path File +* Connection #0 to host localhost left intact +$ curl -vv -H 'XXX:xxx' 'http://localhost:8123/get_relative_path_static_handler' +* Trying ::1... +* Connected to localhost (::1) port 8123 (#0) +> GET /get_relative_path_static_handler HTTP/1.1 +> Host: localhost:8123 +> User-Agent: curl/7.47.0 +> Accept: */* +> XXX:xxx +> +< HTTP/1.1 200 OK +< Date: Wed, 29 Apr 2020 04:18:31 GMT +< Connection: Keep-Alive +< Content-Type: text/html; charset=UTF-8 +< Transfer-Encoding: chunked +< Keep-Alive: timeout=3 +< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"} +< +Relative Path File +* Connection #0 to host localhost left intact ``` [Original article](https://clickhouse.tech/docs/en/interfaces/http_interface/) diff --git a/docs/en/interfaces/index.md b/docs/en/interfaces/index.md index 938f276fe0b..e1b8a639db2 100644 --- a/docs/en/interfaces/index.md +++ b/docs/en/interfaces/index.md @@ -20,7 +20,7 @@ In most cases it is recommended to use appropriate tool or library instead of in There are also a wide range of third-party libraries for working with ClickHouse: -- [Client libraries](third-party/client_libraries.md) +- [Client libraries](third-party/client-libraries.md) - [Integrations](third-party/integrations.md) - [Visual interfaces](third-party/gui.md) diff --git a/docs/en/interfaces/mysql.md b/docs/en/interfaces/mysql.md index 9f9d7f89a87..d4f19630c10 100644 --- a/docs/en/interfaces/mysql.md +++ b/docs/en/interfaces/mysql.md @@ -5,7 +5,7 @@ toc_title: MySQL Interface # MySQL Interface {#mysql-interface} -ClickHouse supports MySQL wire protocol. It can be enabled by [mysql\_port](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) setting in configuration file: +ClickHouse supports MySQL wire protocol. It can be enabled by [mysql\_port](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) setting in configuration file: ``` xml 9004 @@ -35,8 +35,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -For compatibility with all MySQL clients, it is recommended to specify user password with [double SHA1](../operations/settings/settings_users.md#password_double_sha1_hex) in configuration file. -If user password is specified using [SHA256](../operations/settings/settings_users.md#password_sha256_hex), some clients won’t be able to authenticate (mysqljs and old versions of command-line tool mysql). +For compatibility with all MySQL clients, it is recommended to specify user password with [double SHA1](../operations/settings/settings-users.md#password_double_sha1_hex) in configuration file. +If user password is specified using [SHA256](../operations/settings/settings-users.md#password_sha256_hex), some clients won’t be able to authenticate (mysqljs and old versions of command-line tool mysql). Restrictions: diff --git a/docs/en/interfaces/third-party/client_libraries.md b/docs/en/interfaces/third-party/client-libraries.md similarity index 100% rename from docs/en/interfaces/third-party/client_libraries.md rename to docs/en/interfaces/third-party/client-libraries.md diff --git a/docs/en/interfaces/third-party/gui.md b/docs/en/interfaces/third-party/gui.md index 9b380a0f92e..2009312a917 100644 --- a/docs/en/interfaces/third-party/gui.md +++ b/docs/en/interfaces/third-party/gui.md @@ -92,7 +92,8 @@ Features: [clickhouse-flamegraph](https://github.com/Slach/clickhouse-flamegraph) is a specialized tool to visualize the `system.trace_log` as [flamegraph](http://www.brendangregg.com/flamegraphs.html). ### clickhouse-plantuml {#clickhouse-plantuml} -[cickhouse-plantuml](https://pypi.org/project/clickhouse-plantuml/) is a script to generate [PlantUML](https://plantuml.com/) diagram of tables' schemes. + +[cickhouse-plantuml](https://pypi.org/project/clickhouse-plantuml/) is a script to generate [PlantUML](https://plantuml.com/) diagram of tables’ schemes. ## Commercial {#commercial} diff --git a/docs/en/interfaces/third-party/index.md b/docs/en/interfaces/third-party/index.md index 16d315d059c..84291a199eb 100644 --- a/docs/en/interfaces/third-party/index.md +++ b/docs/en/interfaces/third-party/index.md @@ -3,3 +3,4 @@ toc_folder_title: Third-Party toc_priority: 24 --- + diff --git a/docs/en/interfaces/third-party/integrations.md b/docs/en/interfaces/third-party/integrations.md index 9f4b0f2fa65..5e9e8f841bf 100644 --- a/docs/en/interfaces/third-party/integrations.md +++ b/docs/en/interfaces/third-party/integrations.md @@ -43,7 +43,7 @@ toc_title: Integrations - [graphouse](https://github.com/yandex/graphouse) - [carbon-clickhouse](https://github.com/lomik/carbon-clickhouse) + - [graphite-clickhouse](https://github.com/lomik/graphite-clickhouse) - - [graphite-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) - optimizes staled partitions in [\*GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) if rules from [rollup configuration](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) could be applied + - [graphite-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) - optimizes staled partitions in [\*GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) if rules from [rollup configuration](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) could be applied - [Grafana](https://grafana.com/) - [clickhouse-grafana](https://github.com/Vertamedia/clickhouse-grafana) - [Prometheus](https://prometheus.io/) @@ -75,7 +75,7 @@ toc_title: Integrations - [sqlalchemy-clickhouse](https://github.com/cloudflare/sqlalchemy-clickhouse) (uses [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm)) - [pandas](https://pandas.pydata.org) - [pandahouse](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -83,7 +83,7 @@ toc_title: Integrations - [RClickHouse](https://github.com/IMSMWU/RClickHouse) (uses [clickhouse-cpp](https://github.com/artpaul/clickhouse-cpp)) - Java - [Hadoop](http://hadoop.apache.org) - - [clickhouse-hdfs-loader](https://github.com/jaykelin/clickhouse-hdfs-loader) (uses [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [clickhouse-hdfs-loader](https://github.com/jaykelin/clickhouse-hdfs-loader) (uses [JDBC](../../sql-reference/table-functions/jdbc.md)) - Scala - [Akka](https://akka.io) - [clickhouse-scala-client](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/en/introduction/adopters.md b/docs/en/introduction/adopters.md index d2fcb112e67..83af93122ad 100644 --- a/docs/en/introduction/adopters.md +++ b/docs/en/introduction/adopters.md @@ -8,78 +8,77 @@ toc_title: Adopters !!! warning "Disclaimer" The following list of companies using ClickHouse and their success stories is assembled from public sources, thus might differ from current reality. We’d appreciate it if you share the story of adopting ClickHouse in your company and [add it to the list](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/introduction/adopters.md), but please make sure you won’t have any NDA issues by doing so. Providing updates with publications from other companies is also useful. -| Company | Industry | Usecase | Cluster Size | (Un)Compressed Data Size\* | Reference | -|-----------------------------------------------------------------------------|---------------------------------|-----------------------|------------------------------------------------------------|------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [2gis](https://2gis.ru) | Maps | Monitoring | — | — | [Talk in Russian, July 2019](https://youtu.be/58sPkXfq6nw) | -| [Aloha Browser](https://alohabrowser.com/) | Mobile App | Browser backend | — | — | [Slides in Russian, May 2019](https://github.com/yandex/clickhouse-presentations/blob/master/meetup22/aloha.pdf) | -| [Amadeus](https://amadeus.com/) | Travel | Analytics | — | — | [Press Release, April 2018](https://www.altinity.com/blog/2018/4/5/amadeus-technologies-launches-investment-and-insights-tool-based-on-machine-learning-and-strategy-algorithms) | -| [Appsflyer](https://www.appsflyer.com) | Mobile analytics | Main product | — | — | [Talk in Russian, July 2019](https://www.youtube.com/watch?v=M3wbRlcpBbY) | -| [ArenaData](https://arenadata.tech/) | Data Platform | Main product | — | — | [Slides in Russian, December 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup38/indexes.pdf) | -| [Badoo](https://badoo.com) | Dating | Timeseries | — | — | [Slides in Russian, December 2019](https://presentations.clickhouse.tech/meetup38/forecast.pdf) | -| [Benocs](https://www.benocs.com/) | Network Telemetry and Analytics | Main Product | — | — | [Slides in English, October 2017](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup9/lpm.pdf) | -| [Bloomberg](https://www.bloomberg.com/) | Finance, Media | Monitoring | 102 servers | — | [Slides, May 2018](https://www.slideshare.net/Altinity/http-analytics-for-6m-requests-per-second-using-clickhouse-by-alexander-bocharov) | -| [Bloxy](https://bloxy.info) | Blockchain | Analytics | — | — | [Slides in Russian, August 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/4_bloxy.pptx) | -| `Dataliance/UltraPower` | Telecom | Analytics | — | — | [Slides in Chinese, January 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/telecom.pdf) | -| [CARTO](https://carto.com/) | Business Intelligence | Geo analytics | — | — | [Geospatial processing with ClickHouse](https://carto.com/blog/geospatial-processing-with-clickhouse/) | -| [CERN](http://public.web.cern.ch/public/) | Research | Experiment | — | — | [Press release, April 2012](https://www.yandex.com/company/press_center/press_releases/2012/2012-04-10/) | -| [Cisco](http://cisco.com/) | Networking | Traffic analysis | — | — | [Lightning talk, October 2019](https://youtu.be/-hI1vDR2oPY?t=5057) | -| [Citadel Securities](https://www.citadelsecurities.com/) | Finance | — | — | — | [Contribution, March 2019](https://github.com/ClickHouse/ClickHouse/pull/4774) | -| [Citymobil](https://city-mobil.ru) | Taxi | Analytics | — | — | [Blog Post in Russian, March 2020](https://habr.com/en/company/citymobil/blog/490660/) | -| [ContentSquare](https://contentsquare.com) | Web analytics | Main product | — | — | [Blog post in French, November 2018](http://souslecapot.net/2018/11/21/patrick-chatain-vp-engineering-chez-contentsquare-penser-davantage-amelioration-continue-que-revolution-constante/) | -| [Cloudflare](https://cloudflare.com) | CDN | Traffic analysis | 36 servers | — | [Blog post, May 2017](https://blog.cloudflare.com/how-cloudflare-analyzes-1m-dns-queries-per-second/), [Blog post, March 2018](https://blog.cloudflare.com/http-analytics-for-6m-requests-per-second-using-clickhouse/) | -| [Corunet](https://coru.net/) | Analytics | Main product | — | — | [Slides in English, April 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup21/predictive_models.pdf) | -| [CraiditX 氪信](https://www.creditx.com) | Finance AI | Analysis | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/udf.pptx) | -| [Criteo/Storetail](https://www.criteo.com/) | Retail | Main product | — | — | [Slides in English, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/3_storetail.pptx) | -| [Deutsche Bank](https://db.com) | Finance | BI Analytics | — | — | [Slides in English, October 2019](https://bigdatadays.ru/wp-content/uploads/2019/10/D2-H3-3_Yakunin-Goihburg.pdf) | -| [Diva-e](https://www.diva-e.com) | Digital consulting | Main Product | — | — | [Slides in English, September 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup29/ClickHouse-MeetUp-Unusual-Applications-sd-2019-09-17.pdf) | -| [Exness](https://www.exness.com) | Trading | Metrics, Logging | — | — | [Talk in Russian, May 2019](https://youtu.be/_rpU-TvSfZ8?t=3215) | -| [Geniee](https://geniee.co.jp) | Ad network | Main product | — | — | [Blog post in Japanese, July 2017](https://tech.geniee.co.jp/entry/2017/07/20/160100) | -| [HUYA](https://www.huya.com/) | Video Streaming | Analytics | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/7.%20ClickHouse万亿数据分析实践%20李本旺(sundy-li)%20虎牙.pdf) | -| [Idealista](https://www.idealista.com) | Real Estate | Analytics | — | — | [Blog Post in English, April 2019](https://clickhouse.yandex/blog/en/clickhouse-meetup-in-madrid-on-april-2-2019) | -| [Infovista](https://www.infovista.com/) | Networks | Analytics | — | — | [Slides in English, October 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup30/infovista.pdf) | -| [InnoGames](https://www.innogames.com) | Games | Metrics, Logging | — | — | [Slides in Russian, September 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/graphite_and_clickHouse.pdf) | -| [Integros](https://integros.com) | Platform for video services | Analytics | — | — | [Slides in Russian, May 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | -| [Kodiak Data](https://www.kodiakdata.com/) | Clouds | Main product | — | — | [Slides in Engish, April 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup13/kodiak_data.pdf) | -| [Kontur](https://kontur.ru) | Software Development | Metrics | — | — | [Talk in Russian, November 2018](https://www.youtube.com/watch?v=U4u4Bd0FtrY) | -| [LifeStreet](https://lifestreet.com/) | Ad network | Main product | 75 servers (3 replicas) | 5.27 PiB | [Blog post in Russian, February 2017](https://habr.com/en/post/322620/) | -| [Mail.ru Cloud Solutions](https://mcs.mail.ru/) | Cloud services | Main product | — | — | [Running ClickHouse Instance, in Russian](https://mcs.mail.ru/help/db-create/clickhouse#) | -| [MessageBird](https://www.messagebird.com) | Telecommunications | Statistics | — | — | [Slides in English, November 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup20/messagebird.pdf) | -| [MGID](https://www.mgid.com/) | Ad network | Web-analytics | — | — | [Our experience in implementing analytical DBMS ClickHouse, in Russian](http://gs-studio.com/news-about-it/32777----clickhouse---c) | -| [OneAPM](https://www.oneapm.com/) | Monitorings and Data Analysis | Main product | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/8.%20clickhouse在OneAPM的应用%20杜龙.pdf) | -| [Pragma Innovation](http://www.pragma-innovation.fr/) | Telemetry and Big Data Analysis | Main product | — | — | [Slides in English, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/4_pragma_innovation.pdf) | -| [QINGCLOUD](https://www.qingcloud.com/) | Cloud services | Main product | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/4.%20Cloud%20%2B%20TSDB%20for%20ClickHouse%20张健%20QingCloud.pdf) | -| [Qrator](https://qrator.net) | DDoS protection | Main product | — | — | [Blog Post, March 2019](https://blog.qrator.net/en/clickhouse-ddos-mitigation_37/) | -| [Percent 百分点](https://www.percent.cn/) | Analytics | Main Product | — | — | [Slides in Chinese, June 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/4.%20ClickHouse万亿数据双中心的设计与实践%20.pdf) | -| [Rambler](https://rambler.ru) | Internet services | Analytics | — | — | [Talk in Russian, April 2018](https://medium.com/@ramblertop/разработка-api-clickhouse-для-рамблер-топ-100-f4c7e56f3141) | -| [Tencent](https://www.tencent.com) | Messaging | Logging | — | — | [Talk in Chinese, November 2019](https://youtu.be/T-iVQRuw-QY?t=5050) | -| [Traffic Stars](https://trafficstars.com/) | AD network | — | — | — | [Slides in Russian, May 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup15/lightning/ninja.pdf) | -| [S7 Airlines](https://www.s7.ru) | Airlines | Metrics, Logging | — | — | [Talk in Russian, March 2019](https://www.youtube.com/watch?v=nwG68klRpPg&t=15s) | -| [SEMrush](https://www.semrush.com/) | Marketing | Main product | — | — | [Slides in Russian, August 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/5_semrush.pdf) | -| [scireum GmbH](https://www.scireum.de/) | e-Commerce | Main product | — | — | [Talk in German, February 2020](https://www.youtube.com/watch?v=7QWAn5RbyR4) | -| [Sentry](https://sentry.io/) | Software developer | Backend for product | — | — | [Blog Post in English, May 2019](https://blog.sentry.io/2019/05/16/introducing-snuba-sentrys-new-search-infrastructure) | -| [SGK](http://www.sgk.gov.tr/wps/portal/sgk/tr) | Goverment Social Security | Analytics | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/ClickHouse%20Meetup-Ramazan%20POLAT.pdf) | -| [seo.do](https://seo.do/) | Analytics | Main product | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/CH%20Presentation-%20Metehan%20Çetinkaya.pdf) | -| [Sina](http://english.sina.com/index.html) | News | — | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/6.%20ClickHouse最佳实践%20高鹏_新浪.pdf) | -| [SMI2](https://smi2.ru/) | News | Analytics | — | — | [Blog Post in Russian, November 2017](https://habr.com/ru/company/smi2/blog/314558/) | -| [Splunk](https://www.splunk.com/) | Business Analytics | Main product | — | — | [Slides in English, January 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/splunk.pdf) | -| [Spotify](https://www.spotify.com) | Music | Experimentation | — | — | [Slides, July 2018](https://www.slideshare.net/glebus/using-clickhouse-for-experimentation-104247173) | -| [Tencent](https://www.tencent.com) | Big Data | Data processing | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/5.%20ClickHouse大数据集群应用_李俊飞腾讯网媒事业部.pdf) | -| [Uber](https://www.uber.com) | Taxi | Logging | — | — | [Slides, February 2020](https://presentations.clickhouse.tech/meetup40/uber.pdf) | -| [VKontakte](https://vk.com) | Social Network | Statistics, Logging | — | — | [Slides in Russian, August 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/3_vk.pdf) | -| [Wisebits](https://wisebits.com/) | IT Solutions | Analytics | — | — | [Slides in Russian, May 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | -| [Xiaoxin Tech](http://www.xiaoxintech.cn/) | Education | Common purpose | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/sync-clickhouse-with-mysql-mongodb.pptx) | -| [Ximalaya](https://www.ximalaya.com/) | Audio sharing | OLAP | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/ximalaya.pdf) | -| [Yandex Cloud](https://cloud.yandex.ru/services/managed-clickhouse) | Public Cloud | Main product | — | — | [Talk in Russian, December 2019](https://www.youtube.com/watch?v=pgnak9e_E0o) | -| [Yandex DataLens](https://cloud.yandex.ru/services/datalens) | Business Intelligence | Main product | — | — | [Slides in Russian, December 2019](https://presentations.clickhouse.tech/meetup38/datalens.pdf) | -| [Yandex Market](https://market.yandex.ru/) | e-Commerce | Metrics, Logging | — | — | [Talk in Russian, January 2019](https://youtu.be/_l1qP0DyBcA?t=478) | -| [Yandex Metrica](https://metrica.yandex.com) | Web analytics | Main product | 360 servers in one cluster, 1862 servers in one department | 66.41 PiB / 5.68 PiB | [Slides, February 2020](https://presentations.clickhouse.tech/meetup40/introduction/#13) | -| [ЦВТ](https://htc-cs.ru/) | Software Development | Metrics, Logging | — | — | [Blog Post, March 2019, in Russian](https://vc.ru/dev/62715-kak-my-stroili-monitoring-na-prometheus-clickhouse-i-elk) | -| [МКБ](https://mkb.ru/) | Bank | Web-system monitoring | — | — | [Slides in Russian, September 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/mkb.pdf) | -| [Jinshuju 金数据](https://jinshuju.net) | BI Analytics | Main product | — | — | [Slides in Chinese, October 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/3.%20金数据数据架构调整方案Public.pdf) | -| [Instana](https://www.instana.com) | APM Platform | Main product | — | — | [Twitter post](https://twitter.com/mieldonkers/status/1248884119158882304) | -| [Wargaming](https://wargaming.com/en/) | Games | | — | — | [Interview](https://habr.com/en/post/496954/) | -| [Crazypanda](https://crazypanda.ru/en/) | Games | | — | — | Live session on ClickHouse meetup | -| [FunCorp](https://fun.co/rp) | Games | | — | — | [Article](https://www.altinity.com/blog/migrating-from-redshift-to-clickhouse) | - +| Company | Industry | Usecase | Cluster Size | (Un)Compressed Data Size\* | Reference | +|---------------------------------------------------------------------|---------------------------------|-----------------------|------------------------------------------------------------|------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [2gis](https://2gis.ru) | Maps | Monitoring | — | — | [Talk in Russian, July 2019](https://youtu.be/58sPkXfq6nw) | +| [Aloha Browser](https://alohabrowser.com/) | Mobile App | Browser backend | — | — | [Slides in Russian, May 2019](https://github.com/yandex/clickhouse-presentations/blob/master/meetup22/aloha.pdf) | +| [Amadeus](https://amadeus.com/) | Travel | Analytics | — | — | [Press Release, April 2018](https://www.altinity.com/blog/2018/4/5/amadeus-technologies-launches-investment-and-insights-tool-based-on-machine-learning-and-strategy-algorithms) | +| [Appsflyer](https://www.appsflyer.com) | Mobile analytics | Main product | — | — | [Talk in Russian, July 2019](https://www.youtube.com/watch?v=M3wbRlcpBbY) | +| [ArenaData](https://arenadata.tech/) | Data Platform | Main product | — | — | [Slides in Russian, December 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup38/indexes.pdf) | +| [Badoo](https://badoo.com) | Dating | Timeseries | — | — | [Slides in Russian, December 2019](https://presentations.clickhouse.tech/meetup38/forecast.pdf) | +| [Benocs](https://www.benocs.com/) | Network Telemetry and Analytics | Main Product | — | — | [Slides in English, October 2017](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup9/lpm.pdf) | +| [Bloomberg](https://www.bloomberg.com/) | Finance, Media | Monitoring | 102 servers | — | [Slides, May 2018](https://www.slideshare.net/Altinity/http-analytics-for-6m-requests-per-second-using-clickhouse-by-alexander-bocharov) | +| [Bloxy](https://bloxy.info) | Blockchain | Analytics | — | — | [Slides in Russian, August 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/4_bloxy.pptx) | +| `Dataliance/UltraPower` | Telecom | Analytics | — | — | [Slides in Chinese, January 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/telecom.pdf) | +| [CARTO](https://carto.com/) | Business Intelligence | Geo analytics | — | — | [Geospatial processing with ClickHouse](https://carto.com/blog/geospatial-processing-with-clickhouse/) | +| [CERN](http://public.web.cern.ch/public/) | Research | Experiment | — | — | [Press release, April 2012](https://www.yandex.com/company/press_center/press_releases/2012/2012-04-10/) | +| [Cisco](http://cisco.com/) | Networking | Traffic analysis | — | — | [Lightning talk, October 2019](https://youtu.be/-hI1vDR2oPY?t=5057) | +| [Citadel Securities](https://www.citadelsecurities.com/) | Finance | — | — | — | [Contribution, March 2019](https://github.com/ClickHouse/ClickHouse/pull/4774) | +| [Citymobil](https://city-mobil.ru) | Taxi | Analytics | — | — | [Blog Post in Russian, March 2020](https://habr.com/en/company/citymobil/blog/490660/) | +| [ContentSquare](https://contentsquare.com) | Web analytics | Main product | — | — | [Blog post in French, November 2018](http://souslecapot.net/2018/11/21/patrick-chatain-vp-engineering-chez-contentsquare-penser-davantage-amelioration-continue-que-revolution-constante/) | +| [Cloudflare](https://cloudflare.com) | CDN | Traffic analysis | 36 servers | — | [Blog post, May 2017](https://blog.cloudflare.com/how-cloudflare-analyzes-1m-dns-queries-per-second/), [Blog post, March 2018](https://blog.cloudflare.com/http-analytics-for-6m-requests-per-second-using-clickhouse/) | +| [Corunet](https://coru.net/) | Analytics | Main product | — | — | [Slides in English, April 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup21/predictive_models.pdf) | +| [CraiditX 氪信](https://www.creditx.com) | Finance AI | Analysis | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/udf.pptx) | +| [Criteo/Storetail](https://www.criteo.com/) | Retail | Main product | — | — | [Slides in English, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/3_storetail.pptx) | +| [Deutsche Bank](https://db.com) | Finance | BI Analytics | — | — | [Slides in English, October 2019](https://bigdatadays.ru/wp-content/uploads/2019/10/D2-H3-3_Yakunin-Goihburg.pdf) | +| [Diva-e](https://www.diva-e.com) | Digital consulting | Main Product | — | — | [Slides in English, September 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup29/ClickHouse-MeetUp-Unusual-Applications-sd-2019-09-17.pdf) | +| [Exness](https://www.exness.com) | Trading | Metrics, Logging | — | — | [Talk in Russian, May 2019](https://youtu.be/_rpU-TvSfZ8?t=3215) | +| [Geniee](https://geniee.co.jp) | Ad network | Main product | — | — | [Blog post in Japanese, July 2017](https://tech.geniee.co.jp/entry/2017/07/20/160100) | +| [HUYA](https://www.huya.com/) | Video Streaming | Analytics | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/7.%20ClickHouse万亿数据分析实践%20李本旺(sundy-li)%20虎牙.pdf) | +| [Idealista](https://www.idealista.com) | Real Estate | Analytics | — | — | [Blog Post in English, April 2019](https://clickhouse.yandex/blog/en/clickhouse-meetup-in-madrid-on-april-2-2019) | +| [Infovista](https://www.infovista.com/) | Networks | Analytics | — | — | [Slides in English, October 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup30/infovista.pdf) | +| [InnoGames](https://www.innogames.com) | Games | Metrics, Logging | — | — | [Slides in Russian, September 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/graphite_and_clickHouse.pdf) | +| [Integros](https://integros.com) | Platform for video services | Analytics | — | — | [Slides in Russian, May 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | +| [Kodiak Data](https://www.kodiakdata.com/) | Clouds | Main product | — | — | [Slides in Engish, April 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup13/kodiak_data.pdf) | +| [Kontur](https://kontur.ru) | Software Development | Metrics | — | — | [Talk in Russian, November 2018](https://www.youtube.com/watch?v=U4u4Bd0FtrY) | +| [LifeStreet](https://lifestreet.com/) | Ad network | Main product | 75 servers (3 replicas) | 5.27 PiB | [Blog post in Russian, February 2017](https://habr.com/en/post/322620/) | +| [Mail.ru Cloud Solutions](https://mcs.mail.ru/) | Cloud services | Main product | — | — | [Running ClickHouse Instance, in Russian](https://mcs.mail.ru/help/db-create/clickhouse#) | +| [MessageBird](https://www.messagebird.com) | Telecommunications | Statistics | — | — | [Slides in English, November 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup20/messagebird.pdf) | +| [MGID](https://www.mgid.com/) | Ad network | Web-analytics | — | — | [Our experience in implementing analytical DBMS ClickHouse, in Russian](http://gs-studio.com/news-about-it/32777----clickhouse---c) | +| [OneAPM](https://www.oneapm.com/) | Monitorings and Data Analysis | Main product | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/8.%20clickhouse在OneAPM的应用%20杜龙.pdf) | +| [Pragma Innovation](http://www.pragma-innovation.fr/) | Telemetry and Big Data Analysis | Main product | — | — | [Slides in English, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/4_pragma_innovation.pdf) | +| [QINGCLOUD](https://www.qingcloud.com/) | Cloud services | Main product | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/4.%20Cloud%20%2B%20TSDB%20for%20ClickHouse%20张健%20QingCloud.pdf) | +| [Qrator](https://qrator.net) | DDoS protection | Main product | — | — | [Blog Post, March 2019](https://blog.qrator.net/en/clickhouse-ddos-mitigation_37/) | +| [Percent 百分点](https://www.percent.cn/) | Analytics | Main Product | — | — | [Slides in Chinese, June 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/4.%20ClickHouse万亿数据双中心的设计与实践%20.pdf) | +| [Rambler](https://rambler.ru) | Internet services | Analytics | — | — | [Talk in Russian, April 2018](https://medium.com/@ramblertop/разработка-api-clickhouse-для-рамблер-топ-100-f4c7e56f3141) | +| [Tencent](https://www.tencent.com) | Messaging | Logging | — | — | [Talk in Chinese, November 2019](https://youtu.be/T-iVQRuw-QY?t=5050) | +| [Traffic Stars](https://trafficstars.com/) | AD network | — | — | — | [Slides in Russian, May 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup15/lightning/ninja.pdf) | +| [S7 Airlines](https://www.s7.ru) | Airlines | Metrics, Logging | — | — | [Talk in Russian, March 2019](https://www.youtube.com/watch?v=nwG68klRpPg&t=15s) | +| [SEMrush](https://www.semrush.com/) | Marketing | Main product | — | — | [Slides in Russian, August 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/5_semrush.pdf) | +| [scireum GmbH](https://www.scireum.de/) | e-Commerce | Main product | — | — | [Talk in German, February 2020](https://www.youtube.com/watch?v=7QWAn5RbyR4) | +| [Sentry](https://sentry.io/) | Software developer | Backend for product | — | — | [Blog Post in English, May 2019](https://blog.sentry.io/2019/05/16/introducing-snuba-sentrys-new-search-infrastructure) | +| [SGK](http://www.sgk.gov.tr/wps/portal/sgk/tr) | Goverment Social Security | Analytics | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/ClickHouse%20Meetup-Ramazan%20POLAT.pdf) | +| [seo.do](https://seo.do/) | Analytics | Main product | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/CH%20Presentation-%20Metehan%20Çetinkaya.pdf) | +| [Sina](http://english.sina.com/index.html) | News | — | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/6.%20ClickHouse最佳实践%20高鹏_新浪.pdf) | +| [SMI2](https://smi2.ru/) | News | Analytics | — | — | [Blog Post in Russian, November 2017](https://habr.com/ru/company/smi2/blog/314558/) | +| [Splunk](https://www.splunk.com/) | Business Analytics | Main product | — | — | [Slides in English, January 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/splunk.pdf) | +| [Spotify](https://www.spotify.com) | Music | Experimentation | — | — | [Slides, July 2018](https://www.slideshare.net/glebus/using-clickhouse-for-experimentation-104247173) | +| [Tencent](https://www.tencent.com) | Big Data | Data processing | — | — | [Slides in Chinese, October 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/5.%20ClickHouse大数据集群应用_李俊飞腾讯网媒事业部.pdf) | +| [Uber](https://www.uber.com) | Taxi | Logging | — | — | [Slides, February 2020](https://presentations.clickhouse.tech/meetup40/uber.pdf) | +| [VKontakte](https://vk.com) | Social Network | Statistics, Logging | — | — | [Slides in Russian, August 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/3_vk.pdf) | +| [Wisebits](https://wisebits.com/) | IT Solutions | Analytics | — | — | [Slides in Russian, May 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | +| [Xiaoxin Tech](http://www.xiaoxintech.cn/) | Education | Common purpose | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/sync-clickhouse-with-mysql-mongodb.pptx) | +| [Ximalaya](https://www.ximalaya.com/) | Audio sharing | OLAP | — | — | [Slides in English, November 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/ximalaya.pdf) | +| [Yandex Cloud](https://cloud.yandex.ru/services/managed-clickhouse) | Public Cloud | Main product | — | — | [Talk in Russian, December 2019](https://www.youtube.com/watch?v=pgnak9e_E0o) | +| [Yandex DataLens](https://cloud.yandex.ru/services/datalens) | Business Intelligence | Main product | — | — | [Slides in Russian, December 2019](https://presentations.clickhouse.tech/meetup38/datalens.pdf) | +| [Yandex Market](https://market.yandex.ru/) | e-Commerce | Metrics, Logging | — | — | [Talk in Russian, January 2019](https://youtu.be/_l1qP0DyBcA?t=478) | +| [Yandex Metrica](https://metrica.yandex.com) | Web analytics | Main product | 360 servers in one cluster, 1862 servers in one department | 66.41 PiB / 5.68 PiB | [Slides, February 2020](https://presentations.clickhouse.tech/meetup40/introduction/#13) | +| [ЦВТ](https://htc-cs.ru/) | Software Development | Metrics, Logging | — | — | [Blog Post, March 2019, in Russian](https://vc.ru/dev/62715-kak-my-stroili-monitoring-na-prometheus-clickhouse-i-elk) | +| [МКБ](https://mkb.ru/) | Bank | Web-system monitoring | — | — | [Slides in Russian, September 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/mkb.pdf) | +| [Jinshuju 金数据](https://jinshuju.net) | BI Analytics | Main product | — | — | [Slides in Chinese, October 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/3.%20金数据数据架构调整方案Public.pdf) | +| [Instana](https://www.instana.com) | APM Platform | Main product | — | — | [Twitter post](https://twitter.com/mieldonkers/status/1248884119158882304) | +| [Wargaming](https://wargaming.com/en/) | Games | | — | — | [Interview](https://habr.com/en/post/496954/) | +| [Crazypanda](https://crazypanda.ru/en/) | Games | | — | — | Live session on ClickHouse meetup | +| [FunCorp](https://fun.co/rp) | Games | | — | — | [Article](https://www.altinity.com/blog/migrating-from-redshift-to-clickhouse) | [Original article](https://clickhouse.tech/docs/en/introduction/adopters/) diff --git a/docs/en/introduction/distinctive-features.md b/docs/en/introduction/distinctive-features.md new file mode 100644 index 00000000000..c1c44194a5f --- /dev/null +++ b/docs/en/introduction/distinctive-features.md @@ -0,0 +1,75 @@ +--- +toc_priority: 4 +toc_title: Distinctive Features +--- + +# Distinctive Features of ClickHouse {#distinctive-features-of-clickhouse} + +## True Column-Oriented DBMS {#true-column-oriented-dbms} + +In a true column-oriented DBMS, no extra data is stored with the values. Among other things, this means that constant-length values must be supported, to avoid storing their length “number” next to the values. As an example, a billion UInt8-type values should consume around 1 GB uncompressed, or this strongly affects the CPU use. It is essential to store data compactly (without any “garbage”) even when uncompressed, since the speed of decompression (CPU usage) depends mainly on the volume of uncompressed data. + +It is worth noting because there are systems that can store values of different columns separately, but that can’t effectively process analytical queries due to their optimization for other scenarios. Examples are HBase, BigTable, Cassandra, and HyperTable. In these systems, you would get throughput around a hundred thousand rows per second, but not hundreds of millions of rows per second. + +It’s also worth noting that ClickHouse is a database management system, not a single database. ClickHouse allows creating tables and databases in runtime, loading data, and running queries without reconfiguring and restarting the server. + +## Data Compression {#data-compression} + +Some column-oriented DBMSs (InfiniDB CE and MonetDB) do not use data compression. However, data compression does play a key role in achieving excellent performance. + +## Disk Storage of Data {#disk-storage-of-data} + +Keeping data physically sorted by primary key makes it possible to extract data for its specific values or value ranges with low latency, less than a few dozen milliseconds. Some column-oriented DBMSs (such as SAP HANA and Google PowerDrill) can only work in RAM. This approach encourages the allocation of a larger hardware budget than is necessary for real-time analysis. ClickHouse is designed to work on regular hard drives, which means the cost per GB of data storage is low, but SSD and additional RAM are also fully used if available. + +## Parallel Processing on Multiple Cores {#parallel-processing-on-multiple-cores} + +Large queries are parallelized naturally, taking all the necessary resources available on the current server. + +## Distributed Processing on Multiple Servers {#distributed-processing-on-multiple-servers} + +Almost none of the columnar DBMSs mentioned above have support for distributed query processing. +In ClickHouse, data can reside on different shards. Each shard can be a group of replicas used for fault tolerance. All shards are used to run a query in parallel, transparently for the user. + +## SQL Support {#sql-support} + +ClickHouse supports a declarative query language based on SQL that is identical to the SQL standard in many cases. +Supported queries include GROUP BY, ORDER BY, subqueries in FROM, IN, and JOIN clauses, and scalar subqueries. +Dependent subqueries and window functions are not supported. + +## Vector Engine {#vector-engine} + +Data is not only stored by columns but is processed by vectors (parts of columns), which allows achieving high CPU efficiency. + +## Real-time Data Updates {#real-time-data-updates} + +ClickHouse supports tables with a primary key. To quickly perform queries on the range of the primary key, the data is sorted incrementally using the merge tree. Due to this, data can continually be added to the table. No locks are taken when new data is ingested. + +## Index {#index} + +Having a data physically sorted by primary key makes it possible to extract data for its specific values or value ranges with low latency, less than a few dozen milliseconds. + +## Suitable for Online Queries {#suitable-for-online-queries} + +Low latency means that queries can be processed without delay and without trying to prepare an answer in advance, right at the same moment while the user interface page is loading. In other words, online. + +## Support for Approximated Calculations {#support-for-approximated-calculations} + +ClickHouse provides various ways to trade accuracy for performance: + +1. Aggregate functions for approximated calculation of the number of distinct values, medians, and quantiles. +2. Running a query based on a part (sample) of data and getting an approximated result. In this case, proportionally less data is retrieved from the disk. +3. Running an aggregation for a limited number of random keys, instead of for all keys. Under certain conditions for key distribution in the data, this provides a reasonably accurate result while using fewer resources. + +## Data Replication and Data Integrity Support {#data-replication-and-data-integrity-support} + +ClickHouse uses asynchronous multi-master replication. After being written to any available replica, all the remaining replicas retrieve their copy in the background. The system maintains identical data on different replicas. Recovery after most failures is performed automatically, or semi-automatically in complex cases. + +For more information, see the section [Data replication](../engines/table-engines/mergetree-family/replication.md). + +## Features that Can Be Considered Disadvantages {#clickhouse-features-that-can-be-considered-disadvantages} + +1. No full-fledged transactions. +2. Lack of ability to modify or delete already inserted data with high rate and low latency. There are batch deletes and updates available to clean up or modify data, for example to comply with [GDPR](https://gdpr-info.eu). +3. The sparse index makes ClickHouse not so suitable for point queries retrieving single rows by their keys. + +[Original article](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/en/introduction/distinctive_features.md b/docs/en/introduction/distinctive_features.md deleted file mode 100644 index 1244e80a253..00000000000 --- a/docs/en/introduction/distinctive_features.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -toc_priority: 4 -toc_title: Distinctive Features ---- - -# Distinctive Features of ClickHouse {#distinctive-features-of-clickhouse} - -## True Column-Oriented DBMS {#true-column-oriented-dbms} - -In a true column-oriented DBMS, no extra data is stored with the values. Among other things, this means that constant-length values must be supported, to avoid storing their length “number” next to the values. As an example, a billion UInt8-type values should consume around 1 GB uncompressed, or this strongly affects the CPU use. It is essential to store data compactly (without any “garbage”) even when uncompressed, since the speed of decompression (CPU usage) depends mainly on the volume of uncompressed data. - -It is worth noting because there are systems that can store values of different columns separately, but that can’t effectively process analytical queries due to their optimization for other scenarios. Examples are HBase, BigTable, Cassandra, and HyperTable. In these systems, you would get throughput around a hundred thousand rows per second, but not hundreds of millions of rows per second. - -It’s also worth noting that ClickHouse is a database management system, not a single database. ClickHouse allows creating tables and databases in runtime, loading data, and running queries without reconfiguring and restarting the server. - -## Data Compression {#data-compression} - -Some column-oriented DBMSs (InfiniDB CE and MonetDB) do not use data compression. However, data compression does play a key role in achieving excellent performance. - -## Disk Storage of Data {#disk-storage-of-data} - -Keeping data physically sorted by primary key makes it possible to extract data for its specific values or value ranges with low latency, less than a few dozen milliseconds. Some column-oriented DBMSs (such as SAP HANA and Google PowerDrill) can only work in RAM. This approach encourages the allocation of a larger hardware budget than is necessary for real-time analysis. ClickHouse is designed to work on regular hard drives, which means the cost per GB of data storage is low, but SSD and additional RAM are also fully used if available. - -## Parallel Processing on Multiple Cores {#parallel-processing-on-multiple-cores} - -Large queries are parallelized naturally, taking all the necessary resources available on the current server. - -## Distributed Processing on Multiple Servers {#distributed-processing-on-multiple-servers} - -Almost none of the columnar DBMSs mentioned above have support for distributed query processing. -In ClickHouse, data can reside on different shards. Each shard can be a group of replicas used for fault tolerance. All shards are used to run a query in parallel, transparently for the user. - -## SQL Support {#sql-support} - -ClickHouse supports a declarative query language based on SQL that is identical to the SQL standard in many cases. -Supported queries include GROUP BY, ORDER BY, subqueries in FROM, IN, and JOIN clauses, and scalar subqueries. -Dependent subqueries and window functions are not supported. - -## Vector Engine {#vector-engine} - -Data is not only stored by columns but is processed by vectors (parts of columns), which allows achieving high CPU efficiency. - -## Real-time Data Updates {#real-time-data-updates} - -ClickHouse supports tables with a primary key. To quickly perform queries on the range of the primary key, the data is sorted incrementally using the merge tree. Due to this, data can continually be added to the table. No locks are taken when new data is ingested. - -## Index {#index} - -Having a data physically sorted by primary key makes it possible to extract data for its specific values or value ranges with low latency, less than a few dozen milliseconds. - -## Suitable for Online Queries {#suitable-for-online-queries} - -Low latency means that queries can be processed without delay and without trying to prepare an answer in advance, right at the same moment while the user interface page is loading. In other words, online. - -## Support for Approximated Calculations {#support-for-approximated-calculations} - -ClickHouse provides various ways to trade accuracy for performance: - -1. Aggregate functions for approximated calculation of the number of distinct values, medians, and quantiles. -2. Running a query based on a part (sample) of data and getting an approximated result. In this case, proportionally less data is retrieved from the disk. -3. Running an aggregation for a limited number of random keys, instead of for all keys. Under certain conditions for key distribution in the data, this provides a reasonably accurate result while using fewer resources. - -## Data Replication and Data Integrity Support {#data-replication-and-data-integrity-support} - -ClickHouse uses asynchronous multi-master replication. After being written to any available replica, all the remaining replicas retrieve their copy in the background. The system maintains identical data on different replicas. Recovery after most failures is performed automatically, or semi-automatically in complex cases. - -For more information, see the section [Data replication](../engines/table_engines/mergetree_family/replication.md). - -## Features that Can Be Considered Disadvantages {#clickhouse-features-that-can-be-considered-disadvantages} - -1. No full-fledged transactions. -2. Lack of ability to modify or delete already inserted data with high rate and low latency. There are batch deletes and updates available to clean up or modify data, for example to comply with [GDPR](https://gdpr-info.eu). -3. The sparse index makes ClickHouse not so suitable for point queries retrieving single rows by their keys. - -[Original article](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/en/operations/access-rights.md b/docs/en/operations/access-rights.md new file mode 100644 index 00000000000..853b05737b7 --- /dev/null +++ b/docs/en/operations/access-rights.md @@ -0,0 +1,111 @@ +--- +toc_priority: 48 +toc_title: Access Rights +--- + +# Access Rights {#access-rights} + +Users and access rights are set up in the user config. This is usually `users.xml`. + +Users are recorded in the `users` section. Here is a fragment of the `users.xml` file: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + + test + + + +``` + +You can see a declaration from two users: `default`and`web`. We added the `web` user separately. + +The `default` user is chosen in cases when the username is not passed. The `default` user is also used for distributed query processing, if the configuration of the server or cluster doesn’t specify the `user` and `password` (see the section on the [Distributed](../engines/table-engines/special/distributed.md) engine). + +The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. + +The password is specified in clear text (not recommended) or in SHA-256. The hash isn’t salted. In this regard, you should not consider these passwords as providing security against potential malicious attacks. Rather, they are necessary for protection from employees. + +A list of networks is specified that access is allowed from. In this example, the list of networks for both users is loaded from a separate file (`/etc/metrika.xml`) containing the `networks` substitution. Here is a fragment of it: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +You could define this list of networks directly in `users.xml`, or in a file in the `users.d` directory (for more information, see the section “[Configuration files](configuration-files.md#configuration_files)”). + +The config includes comments explaining how to open access from everywhere. + +For use in production, only specify `ip` elements (IP addresses and their masks), since using `host` and `hoost_regexp` might cause extra latency. + +Next the user settings profile is specified (see the section “[Settings profiles](settings/settings-profiles.md)”. You can specify the default profile, `default'`. The profile can have any name. You can specify the same profile for different users. The most important thing you can write in the settings profile is `readonly=1`, which ensures read-only access. Then specify the quota to be used (see the section “[Quotas](quotas.md#quotas)”). You can specify the default quota: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. + +In the optional `` section, you can also specify a list of databases that the user can access. By default, all databases are available to the user. You can specify the `default` database. In this case, the user will receive access to the database by default. + +In the optional `` section, you can also specify a list of dictionaries that the user can access. By default, all dictionaries are available to the user. + +Access to the `system` database is always allowed (since this database is used for processing queries). + +The user can get a list of all databases and tables in them by using `SHOW` queries or system tables, even if access to individual databases isn’t allowed. + +Database access is not related to the [readonly](settings/permissions-for-queries.md#settings_readonly) setting. You can’t grant full access to one database and `readonly` access to another one. + +[Original article](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/en/operations/access_rights.md b/docs/en/operations/access_rights.md deleted file mode 100644 index fcef4995c4b..00000000000 --- a/docs/en/operations/access_rights.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -toc_priority: 48 -toc_title: Access Rights ---- - -# Access Rights {#access-rights} - -Users and access rights are set up in the user config. This is usually `users.xml`. - -Users are recorded in the `users` section. Here is a fragment of the `users.xml` file: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - - test - - - -``` - -You can see a declaration from two users: `default`and`web`. We added the `web` user separately. - -The `default` user is chosen in cases when the username is not passed. The `default` user is also used for distributed query processing, if the configuration of the server or cluster doesn’t specify the `user` and `password` (see the section on the [Distributed](../engines/table_engines/special/distributed.md) engine). - -The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. - -The password is specified in clear text (not recommended) or in SHA-256. The hash isn’t salted. In this regard, you should not consider these passwords as providing security against potential malicious attacks. Rather, they are necessary for protection from employees. - -A list of networks is specified that access is allowed from. In this example, the list of networks for both users is loaded from a separate file (`/etc/metrika.xml`) containing the `networks` substitution. Here is a fragment of it: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -You could define this list of networks directly in `users.xml`, or in a file in the `users.d` directory (for more information, see the section “[Configuration files](configuration_files.md#configuration_files)”). - -The config includes comments explaining how to open access from everywhere. - -For use in production, only specify `ip` elements (IP addresses and their masks), since using `host` and `hoost_regexp` might cause extra latency. - -Next the user settings profile is specified (see the section “[Settings profiles](settings/settings_profiles.md)”. You can specify the default profile, `default'`. The profile can have any name. You can specify the same profile for different users. The most important thing you can write in the settings profile is `readonly=1`, which ensures read-only access. Then specify the quota to be used (see the section “[Quotas](quotas.md#quotas)”). You can specify the default quota: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. - -In the optional `` section, you can also specify a list of databases that the user can access. By default, all databases are available to the user. You can specify the `default` database. In this case, the user will receive access to the database by default. - -In the optional `` section, you can also specify a list of dictionaries that the user can access. By default, all dictionaries are available to the user. - -Access to the `system` database is always allowed (since this database is used for processing queries). - -The user can get a list of all databases and tables in them by using `SHOW` queries or system tables, even if access to individual databases isn’t allowed. - -Database access is not related to the [readonly](settings/permissions_for_queries.md#settings_readonly) setting. You can’t grant full access to one database and `readonly` access to another one. - -[Original article](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/en/operations/backup.md b/docs/en/operations/backup.md index 27418dff884..423f7d1ef33 100644 --- a/docs/en/operations/backup.md +++ b/docs/en/operations/backup.md @@ -5,7 +5,7 @@ toc_title: Data Backup # Data Backup {#data-backup} -While [replication](../engines/table_engines/mergetree_family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [you can’t just drop tables with a MergeTree-like engine containing more than 50 Gb of data](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). However, these safeguards don’t cover all possible cases and can be circumvented. +While [replication](../engines/table-engines/mergetree-family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [you can’t just drop tables with a MergeTree-like engine containing more than 50 Gb of data](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). However, these safeguards don’t cover all possible cases and can be circumvented. In order to effectively mitigate possible human errors, you should carefully prepare a strategy for backing up and restoring your data **in advance**. @@ -20,7 +20,7 @@ Often data that is ingested into ClickHouse is delivered through some sort of pe ## Filesystem Snapshots {#filesystem-snapshots} -Some local filesystems provide snapshot functionality (for example, [ZFS](https://en.wikipedia.org/wiki/ZFS)), but they might not be the best choice for serving live queries. A possible solution is to create additional replicas with this kind of filesystem and exclude them from the [Distributed](../engines/table_engines/special/distributed.md) tables that are used for `SELECT` queries. Snapshots on such replicas will be out of reach of any queries that modify data. As a bonus, these replicas might have special hardware configurations with more disks attached per server, which would be cost-effective. +Some local filesystems provide snapshot functionality (for example, [ZFS](https://en.wikipedia.org/wiki/ZFS)), but they might not be the best choice for serving live queries. A possible solution is to create additional replicas with this kind of filesystem and exclude them from the [Distributed](../engines/table-engines/special/distributed.md) tables that are used for `SELECT` queries. Snapshots on such replicas will be out of reach of any queries that modify data. As a bonus, these replicas might have special hardware configurations with more disks attached per server, which would be cost-effective. ## clickhouse-copier {#clickhouse-copier} @@ -32,7 +32,7 @@ For smaller volumes of data, a simple `INSERT INTO ... SELECT ...` to remote tab ClickHouse allows using the `ALTER TABLE ... FREEZE PARTITION ...` query to create a local copy of table partitions. This is implemented using hardlinks to the `/var/lib/clickhouse/shadow/` folder, so it usually does not consume extra disk space for old data. The created copies of files are not handled by ClickHouse server, so you can just leave them there: you will have a simple backup that doesn’t require any additional external system, but it will still be prone to hardware issues. For this reason, it’s better to remotely copy them to another location and then remove the local copies. Distributed filesystems and object stores are still a good options for this, but normal attached file servers with a large enough capacity might work as well (in this case the transfer will occur via the network filesystem or maybe [rsync](https://en.wikipedia.org/wiki/Rsync)). -For more information about queries related to partition manipulations, see the [ALTER documentation](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +For more information about queries related to partition manipulations, see the [ALTER documentation](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). A third-party tool is available to automate this approach: [clickhouse-backup](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/en/operations/configuration-files.md b/docs/en/operations/configuration-files.md new file mode 100644 index 00000000000..30ea1f2e562 --- /dev/null +++ b/docs/en/operations/configuration-files.md @@ -0,0 +1,55 @@ +--- +toc_priority: 50 +toc_title: Configuration Files +--- + +# Configuration Files {#configuration_files} + +ClickHouse supports multi-file configuration management. The main server configuration file is `/etc/clickhouse-server/config.xml`. Other files must be in the `/etc/clickhouse-server/config.d` directory. + +!!! note "Note" + All the configuration files should be in XML format. Also, they should have the same root element, usually ``. + +Some settings specified in the main configuration file can be overridden in other configuration files. The `replace` or `remove` attributes can be specified for the elements of these configuration files. + +If neither is specified, it combines the contents of elements recursively, replacing values of duplicate children. + +If `replace` is specified, it replaces the entire element with the specified one. + +If `remove` is specified, it deletes the element. + +The config can also define “substitutions”. If an element has the `incl` attribute, the corresponding substitution from the file will be used as the value. By default, the path to the file with substitutions is `/etc/metrika.xml`. This can be changed in the [include\_from](server-configuration-parameters/settings.md#server_configuration_parameters-include_from) element in the server config. The substitution values are specified in `/yandex/substitution_name` elements in this file. If a substitution specified in `incl` does not exist, it is recorded in the log. To prevent ClickHouse from logging missing substitutions, specify the `optional="true"` attribute (for example, settings for [macros](server-configuration-parameters/settings.md)). + +Substitutions can also be performed from ZooKeeper. To do this, specify the attribute `from_zk = "/path/to/node"`. The element value is replaced with the contents of the node at `/path/to/node` in ZooKeeper. You can also put an entire XML subtree on the ZooKeeper node and it will be fully inserted into the source element. + +The `config.xml` file can specify a separate config with user settings, profiles, and quotas. The relative path to this config is set in the `users_config` element. By default, it is `users.xml`. If `users_config` is omitted, the user settings, profiles, and quotas are specified directly in `config.xml`. + +Users configuration can be splitted into separate files similar to `config.xml` and `config.d/`. +Directory name is defined as `users_config` setting without `.xml` postfix concatenated with `.d`. +Directory `users.d` is used by default, as `users_config` defaults to `users.xml`. +For example, you can have separate config file for each user like this: + +``` bash +$ cat /etc/clickhouse-server/users.d/alice.xml +``` + +``` xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +For each config file, the server also generates `file-preprocessed.xml` files when starting. These files contain all the completed substitutions and overrides, and they are intended for informational use. If ZooKeeper substitutions were used in the config files but ZooKeeper is not available on the server start, the server loads the configuration from the preprocessed file. + +The server tracks changes in config files, as well as files and ZooKeeper nodes that were used when performing substitutions and overrides, and reloads the settings for users and clusters on the fly. This means that you can modify the cluster, users, and their settings without restarting the server. + +[Original article](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/en/operations/configuration_files.md b/docs/en/operations/configuration_files.md deleted file mode 100644 index 2d6a1a163f5..00000000000 --- a/docs/en/operations/configuration_files.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -toc_priority: 50 -toc_title: Configuration Files ---- - -# Configuration Files {#configuration_files} - -ClickHouse supports multi-file configuration management. The main server configuration file is `/etc/clickhouse-server/config.xml`. Other files must be in the `/etc/clickhouse-server/config.d` directory. - -!!! note "Note" - All the configuration files should be in XML format. Also, they should have the same root element, usually ``. - -Some settings specified in the main configuration file can be overridden in other configuration files. The `replace` or `remove` attributes can be specified for the elements of these configuration files. - -If neither is specified, it combines the contents of elements recursively, replacing values of duplicate children. - -If `replace` is specified, it replaces the entire element with the specified one. - -If `remove` is specified, it deletes the element. - -The config can also define “substitutions”. If an element has the `incl` attribute, the corresponding substitution from the file will be used as the value. By default, the path to the file with substitutions is `/etc/metrika.xml`. This can be changed in the [include\_from](server_configuration_parameters/settings.md#server_configuration_parameters-include_from) element in the server config. The substitution values are specified in `/yandex/substitution_name` elements in this file. If a substitution specified in `incl` does not exist, it is recorded in the log. To prevent ClickHouse from logging missing substitutions, specify the `optional="true"` attribute (for example, settings for [macros](server_configuration_parameters/settings.md)). - -Substitutions can also be performed from ZooKeeper. To do this, specify the attribute `from_zk = "/path/to/node"`. The element value is replaced with the contents of the node at `/path/to/node` in ZooKeeper. You can also put an entire XML subtree on the ZooKeeper node and it will be fully inserted into the source element. - -The `config.xml` file can specify a separate config with user settings, profiles, and quotas. The relative path to this config is set in the `users_config` element. By default, it is `users.xml`. If `users_config` is omitted, the user settings, profiles, and quotas are specified directly in `config.xml`. - -Users configuration can be splitted into separate files similar to `config.xml` and `config.d/`. -Directory name is defined as `users_config` setting without `.xml` postfix concatenated with `.d`. -Directory `users.d` is used by default, as `users_config` defaults to `users.xml`. -For example, you can have separate config file for each user like this: - -``` bash -$ cat /etc/clickhouse-server/users.d/alice.xml -``` - -``` xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -For each config file, the server also generates `file-preprocessed.xml` files when starting. These files contain all the completed substitutions and overrides, and they are intended for informational use. If ZooKeeper substitutions were used in the config files but ZooKeeper is not available on the server start, the server loads the configuration from the preprocessed file. - -The server tracks changes in config files, as well as files and ZooKeeper nodes that were used when performing substitutions and overrides, and reloads the settings for users and clusters on the fly. This means that you can modify the cluster, users, and their settings without restarting the server. - -[Original article](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/en/operations/index.md b/docs/en/operations/index.md index a23c6f3d16a..f575477765c 100644 --- a/docs/en/operations/index.md +++ b/docs/en/operations/index.md @@ -13,13 +13,13 @@ ClickHouse operations manual consists of the following major sections: - [Troubleshooting](troubleshooting.md) - [Usage Recommendations](tips.md) - [Update Procedure](update.md) -- [Access Rights](access_rights.md) +- [Access Rights](access-rights.md) - [Data Backup](backup.md) -- [Configuration Files](configuration_files.md) +- [Configuration Files](configuration-files.md) - [Quotas](quotas.md) -- [System Tables](system_tables.md) -- [Server Configuration Parameters](server_configuration_parameters/index.md) -- [How To Test Your Hardware With ClickHouse](performance_test.md) +- [System Tables](system-tables.md) +- [Server Configuration Parameters](server-configuration-parameters/index.md) +- [How To Test Your Hardware With ClickHouse](performance-test.md) - [Settings](settings/index.md) - [Utilities](utilities/index.md) diff --git a/docs/en/operations/monitoring.md b/docs/en/operations/monitoring.md index dee1255569b..25e29197646 100644 --- a/docs/en/operations/monitoring.md +++ b/docs/en/operations/monitoring.md @@ -26,18 +26,18 @@ It is highly recommended to set up monitoring for: ClickHouse server has embedded instruments for self-state monitoring. -To track server events use server logs. See the [logger](server_configuration_parameters/settings.md#server_configuration_parameters-logger) section of the configuration file. +To track server events use server logs. See the [logger](server-configuration-parameters/settings.md#server_configuration_parameters-logger) section of the configuration file. ClickHouse collects: - Different metrics of how the server uses computational resources. - Common statistics on query processing. -You can find metrics in the [system.metrics](../operations/system_tables.md#system_tables-metrics), [system.events](../operations/system_tables.md#system_tables-events), and [system.asynchronous\_metrics](../operations/system_tables.md#system_tables-asynchronous_metrics) tables. +You can find metrics in the [system.metrics](../operations/system-tables.md#system_tables-metrics), [system.events](../operations/system-tables.md#system_tables-events), and [system.asynchronous\_metrics](../operations/system-tables.md#system_tables-asynchronous_metrics) tables. -You can configure ClickHouse to export metrics to [Graphite](https://github.com/graphite-project). See the [Graphite section](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) in the ClickHouse server configuration file. Before configuring export of metrics, you should set up Graphite by following their official [guide](https://graphite.readthedocs.io/en/latest/install.html). +You can configure ClickHouse to export metrics to [Graphite](https://github.com/graphite-project). See the [Graphite section](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) in the ClickHouse server configuration file. Before configuring export of metrics, you should set up Graphite by following their official [guide](https://graphite.readthedocs.io/en/latest/install.html). -You can configure ClickHouse to export metrics to [Prometheus](https://prometheus.io). See the [Prometheus section](server_configuration_parameters/settings.md#server_configuration_parameters-prometheus) in the ClickHouse server configuration file. Before configuring export of metrics, you should set up Prometheus by following their official [guide](https://prometheus.io/docs/prometheus/latest/installation/). +You can configure ClickHouse to export metrics to [Prometheus](https://prometheus.io). See the [Prometheus section](server-configuration-parameters/settings.md#server_configuration_parameters-prometheus) in the ClickHouse server configuration file. Before configuring export of metrics, you should set up Prometheus by following their official [guide](https://prometheus.io/docs/prometheus/latest/installation/). Additionally, you can monitor server availability through the HTTP API. Send the `HTTP GET` request to `/ping`. If the server is available, it responds with `200 OK`. diff --git a/docs/en/operations/optimizing-performance/index.md b/docs/en/operations/optimizing-performance/index.md new file mode 100644 index 00000000000..6e6cef109c1 --- /dev/null +++ b/docs/en/operations/optimizing-performance/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Optimizing Performance +toc_priority: 52 +--- + + diff --git a/docs/en/operations/optimizing-performance/sampling-query-profiler.md b/docs/en/operations/optimizing-performance/sampling-query-profiler.md new file mode 100644 index 00000000000..3e9365c281a --- /dev/null +++ b/docs/en/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1,62 @@ +--- +toc_priority: 54 +toc_title: Query Profiling +--- + +# Sampling Query Profiler {#sampling-query-profiler} + +ClickHouse runs sampling profiler that allows analyzing query execution. Using profiler you can find source code routines that used the most frequently during query execution. You can trace CPU time and wall-clock time spent including idle time. + +To use profiler: + +- Setup the [trace\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) section of the server configuration. + + This section configures the [trace\_log](../../operations/system-tables.md#system_tables-trace_log) system table containing the results of the profiler functioning. It is configured by default. Remember that data in this table is valid only for a running server. After the server restart, ClickHouse doesn’t clean up the table and all the stored virtual memory address may become invalid. + +- Setup the [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) or [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) settings. Both settings can be used simultaneously. + + These settings allow you to configure profiler timers. As these are the session settings, you can get different sampling frequency for the whole server, individual users or user profiles, for your interactive session, and for each individual query. + +The default sampling frequency is one sample per second and both CPU and real timers are enabled. This frequency allows collecting enough information about ClickHouse cluster. At the same time, working with this frequency, profiler doesn’t affect ClickHouse server’s performance. If you need to profile each individual query try to use higher sampling frequency. + +To analyze the `trace_log` system table: + +- Install the `clickhouse-common-static-dbg` package. See [Install from DEB Packages](../../getting-started/install.md#install-from-deb-packages). + +- Allow introspection functions by the [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) setting. + + For security reasons, introspection functions are disabled by default. + +- Use the `addressToLine`, `addressToSymbol` and `demangle` [introspection functions](../../sql-reference/functions/introspection.md) to get function names and their positions in ClickHouse code. To get a profile for some query, you need to aggregate data from the `trace_log` table. You can aggregate data by individual functions or by the whole stack traces. + +If you need to visualize `trace_log` info, try [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) and [speedscope](https://github.com/laplab/clickhouse-speedscope). + +## Example {#example} + +In this example we: + +- Filtering `trace_log` data by a query identifier and the current date. + +- Aggregating by stack trace. + +- Using introspection functions, we will get a report of: + + - Names of symbols and corresponding source code functions. + - Source code locations of these functions. + + + +``` sql +SELECT + count(), + arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym +FROM system.trace_log +WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) +GROUP BY trace +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +{% include "examples/sampling_query_profiler_result.txt" %} +``` diff --git a/docs/en/operations/optimizing_performance/index.md b/docs/en/operations/optimizing_performance/index.md deleted file mode 100644 index 4f4cbb66d24..00000000000 --- a/docs/en/operations/optimizing_performance/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Optimizing Performance -toc_priority: 52 ---- - diff --git a/docs/en/operations/optimizing_performance/sampling_query_profiler.md b/docs/en/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 100644 index dbb70c92b2f..00000000000 --- a/docs/en/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -toc_priority: 54 -toc_title: Query Profiling ---- - -# Sampling Query Profiler {#sampling-query-profiler} - -ClickHouse runs sampling profiler that allows analyzing query execution. Using profiler you can find source code routines that used the most frequently during query execution. You can trace CPU time and wall-clock time spent including idle time. - -To use profiler: - -- Setup the [trace\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) section of the server configuration. - - This section configures the [trace\_log](../../operations/system_tables.md#system_tables-trace_log) system table containing the results of the profiler functioning. It is configured by default. Remember that data in this table is valid only for a running server. After the server restart, ClickHouse doesn’t clean up the table and all the stored virtual memory address may become invalid. - -- Setup the [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) or [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) settings. Both settings can be used simultaneously. - - These settings allow you to configure profiler timers. As these are the session settings, you can get different sampling frequency for the whole server, individual users or user profiles, for your interactive session, and for each individual query. - -The default sampling frequency is one sample per second and both CPU and real timers are enabled. This frequency allows collecting enough information about ClickHouse cluster. At the same time, working with this frequency, profiler doesn’t affect ClickHouse server’s performance. If you need to profile each individual query try to use higher sampling frequency. - -To analyze the `trace_log` system table: - -- Install the `clickhouse-common-static-dbg` package. See [Install from DEB Packages](../../getting_started/install.md#install-from-deb-packages). - -- Allow introspection functions by the [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) setting. - - For security reasons, introspection functions are disabled by default. - -- Use the `addressToLine`, `addressToSymbol` and `demangle` [introspection functions](../../sql_reference/functions/introspection.md) to get function names and their positions in ClickHouse code. To get a profile for some query, you need to aggregate data from the `trace_log` table. You can aggregate data by individual functions or by the whole stack traces. - -If you need to visualize `trace_log` info, try [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) and [speedscope](https://github.com/laplab/clickhouse-speedscope). - -## Example {#example} - -In this example we: - -- Filtering `trace_log` data by a query identifier and the current date. - -- Aggregating by stack trace. - -- Using introspection functions, we will get a report of: - - - Names of symbols and corresponding source code functions. - - Source code locations of these functions. - - - -``` sql -SELECT - count(), - arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym -FROM system.trace_log -WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) -GROUP BY trace -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -{% include "examples/sampling_query_profiler_result.txt" %} -``` diff --git a/docs/en/operations/performance-test.md b/docs/en/operations/performance-test.md new file mode 100644 index 00000000000..a3beccdaab5 --- /dev/null +++ b/docs/en/operations/performance-test.md @@ -0,0 +1,80 @@ +--- +toc_priority: 54 +toc_title: Testing Hardware +--- + +# How to Test Your Hardware with ClickHouse {#how-to-test-your-hardware-with-clickhouse} + +With this instruction you can run basic ClickHouse performance test on any server without installation of ClickHouse packages. + +1. Go to “commits” page: https://github.com/ClickHouse/ClickHouse/commits/master + +2. Click on the first green check mark or red cross with green “ClickHouse Build Check” and click on the “Details” link near “ClickHouse Build Check”. There is no such link in some commits, for example commits with documentation. In this case, choose the nearest commit having this link. + +3. Copy the link to “clickhouse” binary for amd64 or aarch64. + +4. ssh to the server and download it with wget: + + + + # For amd64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse + # For aarch64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse + # Then do: + chmod a+x clickhouse + +5. Download configs: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml + mkdir config.d + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml + +6. Download benchmark files: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh + chmod a+x benchmark-new.sh + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql + +7. Download test data according to the [Yandex.Metrica dataset](../getting-started/example-datasets/metrica.md) instruction (“hits” table containing 100 million rows). + + + + wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz + tar xvf hits_100m_obfuscated_v1.tar.xz -C . + mv hits_100m_obfuscated_v1/* . + +8. Run the server: + + + + ./clickhouse server + +9. Check the data: ssh to the server in another terminal + + + + ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" + 100000000 + +10. Edit the benchmark-new.sh, change `clickhouse-client` to `./clickhouse client` and add `–-max_memory_usage 100000000000` parameter. + + + + mcedit benchmark-new.sh + +11. Run the benchmark: + + + + ./benchmark-new.sh hits_100m_obfuscated + +12. Send the numbers and the info about your hardware configuration to clickhouse-feedback@yandex-team.com + +All the results are published here: https://clickhouse.tech/benchmark/hardware/ diff --git a/docs/en/operations/performance_test.md b/docs/en/operations/performance_test.md deleted file mode 100644 index 9114cbde71a..00000000000 --- a/docs/en/operations/performance_test.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -toc_priority: 54 -toc_title: Testing Hardware ---- - -# How to Test Your Hardware with ClickHouse {#how-to-test-your-hardware-with-clickhouse} - -With this instruction you can run basic ClickHouse performance test on any server without installation of ClickHouse packages. - -1. Go to “commits” page: https://github.com/ClickHouse/ClickHouse/commits/master - -2. Click on the first green check mark or red cross with green “ClickHouse Build Check” and click on the “Details” link near “ClickHouse Build Check”. There is no such link in some commits, for example commits with documentation. In this case, choose the nearest commit having this link. - -3. Copy the link to “clickhouse” binary for amd64 or aarch64. - -4. ssh to the server and download it with wget: - - - - # For amd64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse - # For aarch64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse - # Then do: - chmod a+x clickhouse - -5. Download configs: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml - mkdir config.d - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml - -6. Download benchmark files: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh - chmod a+x benchmark-new.sh - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql - -7. Download test data according to the [Yandex.Metrica dataset](../getting_started/example_datasets/metrica.md) instruction (“hits” table containing 100 million rows). - - - - wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz - tar xvf hits_100m_obfuscated_v1.tar.xz -C . - mv hits_100m_obfuscated_v1/* . - -8. Run the server: - - - - ./clickhouse server - -9. Check the data: ssh to the server in another terminal - - - - ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" - 100000000 - -10. Edit the benchmark-new.sh, change `clickhouse-client` to `./clickhouse client` and add `–-max_memory_usage 100000000000` parameter. - - - - mcedit benchmark-new.sh - -11. Run the benchmark: - - - - ./benchmark-new.sh hits_100m_obfuscated - -12. Send the numbers and the info about your hardware configuration to clickhouse-feedback@yandex-team.com - -All the results are published here: https://clickhouse.tech/benchmark/hardware/ diff --git a/docs/en/operations/requirements.md b/docs/en/operations/requirements.md index ce32a46a3e3..5f2d2de3535 100644 --- a/docs/en/operations/requirements.md +++ b/docs/en/operations/requirements.md @@ -22,9 +22,9 @@ The required volume of RAM depends on: - The complexity of queries. - The amount of data that is processed in queries. -To calculate the required volume of RAM, you should estimate the size of temporary data for [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) and other operations you use. +To calculate the required volume of RAM, you should estimate the size of temporary data for [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) and other operations you use. -ClickHouse can use external memory for temporary data. See [GROUP BY in External Memory](../sql_reference/statements/select.md#select-group-by-in-external-memory) for details. +ClickHouse can use external memory for temporary data. See [GROUP BY in External Memory](../sql-reference/statements/select.md#select-group-by-in-external-memory) for details. ## Swap File {#swap-file} @@ -56,4 +56,4 @@ The network bandwidth is critical for processing distributed queries with a larg ClickHouse is developed primarily for the Linux family of operating systems. The recommended Linux distribution is Ubuntu. The `tzdata` package should be installed in the system. -ClickHouse can also work in other operating system families. See details in the [Getting started](../getting_started/index.md) section of the documentation. +ClickHouse can also work in other operating system families. See details in the [Getting started](../getting-started/index.md) section of the documentation. diff --git a/docs/en/operations/server-configuration-parameters/index.md b/docs/en/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..961d79b3b4d --- /dev/null +++ b/docs/en/operations/server-configuration-parameters/index.md @@ -0,0 +1,17 @@ +--- +toc_folder_title: Server Configuration Parameters +toc_priority: 54 +toc_title: Introduction +--- + +# Server Configuration Parameters {#server-settings} + +This section contains descriptions of server settings that cannot be changed at the session or query level. + +These settings are stored in the `config.xml` file on the ClickHouse server. + +Other settings are described in the “[Settings](../settings/index.md#settings)” section. + +Before studying the settings, read the [Configuration files](../configuration-files.md#configuration_files) section and note the use of substitutions (the `incl` and `optional` attributes). + +[Original article](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/en/operations/server-configuration-parameters/settings.md b/docs/en/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..12663648950 --- /dev/null +++ b/docs/en/operations/server-configuration-parameters/settings.md @@ -0,0 +1,894 @@ +--- +toc_priority: 57 +toc_title: Server Settings +--- + +# Server Settings {#server-settings} + +## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} + +The interval in seconds before reloading built-in dictionaries. + +ClickHouse reloads built-in dictionaries every x seconds. This makes it possible to edit dictionaries “on the fly” without restarting the server. + +Default value: 3600. + +**Example** + +``` xml +3600 +``` + +## compression {#server-settings-compression} + +Data compression settings for [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-engine tables. + +!!! warning "Warning" + Don’t use it if you have just started using ClickHouse. + +Configuration template: + +``` xml + + + ... + ... + ... + + ... + +``` + +`` fields: + +- `min_part_size` – The minimum size of a data part. +- `min_part_size_ratio` – The ratio of the data part size to the table size. +- `method` – Compression method. Acceptable values: `lz4` or `zstd`. + +You can configure multiple `` sections. + +Actions when conditions are met: + +- If a data part matches a condition set, ClickHouse uses the specified compression method. +- If a data part matches multiple condition sets, ClickHouse uses the first matched condition set. + +If no conditions met for a data part, ClickHouse uses the `lz4` compression. + +**Example** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## default\_database {#default-database} + +The default database. + +To get a list of databases, use the [SHOW DATABASES](../../sql-reference/statements/show.md#show-databases) query. + +**Example** + +``` xml +default +``` + +## default\_profile {#default-profile} + +Default settings profile. + +Settings profiles are located in the file specified in the parameter `user_config`. + +**Example** + +``` xml +default +``` + +## dictionaries\_config {#server_configuration_parameters-dictionaries_config} + +The path to the config file for external dictionaries. + +Path: + +- Specify the absolute path or the path relative to the server config file. +- The path can contain wildcards \* and ?. + +See also “[External dictionaries](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)”. + +**Example** + +``` xml +*_dictionary.xml +``` + +## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} + +Lazy loading of dictionaries. + +If `true`, then each dictionary is created on first use. If dictionary creation failed, the function that was using the dictionary throws an exception. + +If `false`, all dictionaries are created when the server starts, and if there is an error, the server shuts down. + +The default is `true`. + +**Example** + +``` xml +true +``` + +## format\_schema\_path {#server_configuration_parameters-format_schema_path} + +The path to the directory with the schemes for the input data, such as schemas for the [CapnProto](../../interfaces/formats.md#capnproto) format. + +**Example** + +``` xml + + format_schemas/ +``` + +## graphite {#server_configuration_parameters-graphite} + +Sending data to [Graphite](https://github.com/graphite-project). + +Settings: + +- host – The Graphite server. +- port – The port on the Graphite server. +- interval – The interval for sending, in seconds. +- timeout – The timeout for sending data, in seconds. +- root\_path – Prefix for keys. +- metrics – Sending data from the [system.metrics](../../operations/system-tables.md#system_tables-metrics) table. +- events – Sending deltas data accumulated for the time period from the [system.events](../../operations/system-tables.md#system_tables-events) table. +- events\_cumulative – Sending cumulative data from the [system.events](../../operations/system-tables.md#system_tables-events) table. +- asynchronous\_metrics – Sending data from the [system.asynchronous\_metrics](../../operations/system-tables.md#system_tables-asynchronous_metrics) table. + +You can configure multiple `` clauses. For instance, you can use this for sending different data at different intervals. + +**Example** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## graphite\_rollup {#server_configuration_parameters-graphite-rollup} + +Settings for thinning data for Graphite. + +For more details, see [GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md). + +**Example** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## http\_port/https\_port {#http-porthttps-port} + +The port for connecting to the server over HTTP(s). + +If `https_port` is specified, [openSSL](#server_configuration_parameters-openssl) must be configured. + +If `http_port` is specified, the OpenSSL configuration is ignored even if it is set. + +**Example** + +``` xml +0000 +``` + +## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} + +The page that is shown by default when you access the ClickHouse HTTP(s) server. +The default value is “Ok.” (with a line feed at the end) + +**Example** + +Opens `https://tabix.io/` when accessing `http://localhost: http_port`. + +``` xml + +
]]> +
+``` + +## include\_from {#server_configuration_parameters-include_from} + +The path to the file with substitutions. + +For more information, see the section “[Configuration files](../configuration-files.md#configuration_files)”. + +**Example** + +``` xml +/etc/metrica.xml +``` + +## interserver\_http\_port {#interserver-http-port} + +Port for exchanging data between ClickHouse servers. + +**Example** + +``` xml +9009 +``` + +## interserver\_http\_host {#interserver-http-host} + +The hostname that can be used by other servers to access this server. + +If omitted, it is defined in the same way as the `hostname-f` command. + +Useful for breaking away from a specific network interface. + +**Example** + +``` xml +example.yandex.ru +``` + +## interserver\_http\_credentials {#server-settings-interserver-http-credentials} + +The username and password used to authenticate during [replication](../../engines/table-engines/mergetree-family/replication.md) with the Replicated\* engines. These credentials are used only for communication between replicas and are unrelated to credentials for ClickHouse clients. The server is checking these credentials for connecting replicas and use the same credentials when connecting to other replicas. So, these credentials should be set the same for all replicas in a cluster. +By default, the authentication is not used. + +This section contains the following parameters: + +- `user` — username. +- `password` — password. + +**Example** + +``` xml + + admin + 222 + +``` + +## keep\_alive\_timeout {#keep-alive-timeout} + +The number of seconds that ClickHouse waits for incoming requests before closing the connection. Defaults to 3 seconds. + +**Example** + +``` xml +3 +``` + +## listen\_host {#server_configuration_parameters-listen_host} + +Restriction on hosts that requests can come from. If you want the server to answer all of them, specify `::`. + +Examples: + +``` xml +::1 +127.0.0.1 +``` + +## logger {#server_configuration_parameters-logger} + +Logging settings. + +Keys: + +- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. +- log – The log file. Contains all the entries according to `level`. +- errorlog – Error log file. +- size – Size of the file. Applies to `log`and`errorlog`. Once the file reaches `size`, ClickHouse archives and renames it, and creates a new log file in its place. +- count – The number of archived log files that ClickHouse stores. + +**Example** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +Writing to the syslog is also supported. Config example: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +Keys: + +- use\_syslog — Required setting if you want to write to the syslog. +- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. +- hostname — Optional. The name of the host that logs are sent from. +- facility — [The syslog facility keyword](https://en.wikipedia.org/wiki/Syslog#Facility) in uppercase letters with the “LOG\_” prefix: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`, and so on). + Default value: `LOG_USER` if `address` is specified, `LOG_DAEMON otherwise.` +- format – Message format. Possible values: `bsd` and `syslog.` + +## macros {#macros} + +Parameter substitutions for replicated tables. + +Can be omitted if replicated tables are not used. + +For more information, see the section “[Creating replicated tables](../../engines/table-engines/mergetree-family/replication.md)”. + +**Example** + +``` xml + +``` + +## mark\_cache\_size {#server-mark-cache-size} + +Approximate size (in bytes) of the cache of marks used by table engines of the [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) family. + +The cache is shared for the server and memory is allocated as needed. The cache size must be at least 5368709120. + +**Example** + +``` xml +5368709120 +``` + +## max\_concurrent\_queries {#max-concurrent-queries} + +The maximum number of simultaneously processed requests. + +**Example** + +``` xml +100 +``` + +## max\_connections {#max-connections} + +The maximum number of inbound connections. + +**Example** + +``` xml +4096 +``` + +## max\_open\_files {#max-open-files} + +The maximum number of open files. + +By default: `maximum`. + +We recommend using this option in Mac OS X since the `getrlimit()` function returns an incorrect value. + +**Example** + +``` xml +262144 +``` + +## max\_table\_size\_to\_drop {#max-table-size-to-drop} + +Restriction on deleting tables. + +If the size of a [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) table exceeds `max_table_size_to_drop` (in bytes), you can’t delete it using a DROP query. + +If you still need to delete the table without restarting the ClickHouse server, create the `/flags/force_drop_table` file and run the DROP query. + +Default value: 50 GB. + +The value 0 means that you can delete all tables without any restrictions. + +**Example** + +``` xml +0 +``` + +## merge\_tree {#server_configuration_parameters-merge_tree} + +Fine tuning for tables in the [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +For more information, see the MergeTreeSettings.h header file. + +**Example** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +SSL client/server configuration. + +Support for SSL is provided by the `libpoco` library. The interface is described in the file [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +Keys for server/client settings: + +- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. +- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` contains the certificate. +- caConfig – The path to the file or directory that contains trusted root certificates. +- verificationMode – The method for checking the node’s certificates. Details are in the description of the [Context](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) class. Possible values: `none`, `relaxed`, `strict`, `once`. +- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. +- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| +- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Acceptable values: `true`, `false`. +- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. This parameter is always recommended since it helps avoid problems both if the server caches the session and if the client requested caching. Default value: `${application.name}`. +- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. +- sessionTimeout – Time for caching the session on the server. +- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. +- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. +- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. +- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . +- disableProtocols – Protocols that are not allowed to use. +- preferServerCiphers – Preferred server ciphers on the client. + +**Example of settings:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## part\_log {#server_configuration_parameters-part-log} + +Logging events that are associated with [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). For instance, adding or merging data. You can use the log to simulate merge algorithms and compare their characteristics. You can visualize the merge process. + +Queries are logged in the [system.part\_log](../../operations/system-tables.md#system_tables-part-log) table, not in a separate file. You can configure the name of this table in the `table` parameter (see below). + +Use the following parameters to configure logging: + +- `database` – Name of the database. +- `table` – Name of the system table. +- `partition_by` – Sets a [custom partitioning key](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +**Example** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## path {#server_configuration_parameters-path} + +The path to the directory containing data. + +!!! note "Note" + The trailing slash is mandatory. + +**Example** + +``` xml +/var/lib/clickhouse/ +``` + +## prometheus {#server_configuration_parameters-prometheus} + +Exposing metrics data for scraping from [Prometheus](https://prometheus.io). + +Settings: + +- `endpoint` – HTTP endpoint for scraping metrics by prometheus server. Start from ‘/’. +- `port` – Port for `endpoint`. +- `metrics` – Flag that sets to expose metrics from the [system.metrics](../system-tables.md#system_tables-metrics) table. +- `events` – Flag that sets to expose metrics from the [system.events](../system-tables.md#system_tables-events) table. +- `asynchronous_metrics` – Flag that sets to expose current metrics values from the [system.asynchronous\_metrics](../system-tables.md#system_tables-asynchronous_metrics) table. + +**Example** + +``` xml + + /metrics + 8001 + true + true + true + +``` + +## query\_log {#server_configuration_parameters-query-log} + +Setting for logging queries received with the [log\_queries=1](../settings/settings.md) setting. + +Queries are logged in the [system.query\_log](../../operations/system-tables.md#system_tables-query_log) table, not in a separate file. You can change the name of the table in the `table` parameter (see below). + +Use the following parameters to configure logging: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [custom partitioning key](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) for a table. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +If the table doesn’t exist, ClickHouse will create it. If the structure of the query log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically. + +**Example** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## query\_thread\_log {#server_configuration_parameters-query-thread-log} + +Setting for logging threads of queries received with the [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) setting. + +Queries are logged in the [system.query\_thread\_log](../../operations/system-tables.md#system_tables-query-thread-log) table, not in a separate file. You can change the name of the table in the `table` parameter (see below). + +Use the following parameters to configure logging: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [custom partitioning key](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) for a system table. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +If the table doesn’t exist, ClickHouse will create it. If the structure of the query thread log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically. + +**Example** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## trace\_log {#server_configuration_parameters-trace_log} + +Settings for the [trace\_log](../../operations/system-tables.md#system_tables-trace_log) system table operation. + +Parameters: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [Custom partitioning key](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) for a system table. +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +The default server configuration file `config.xml` contains the following settings section: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## query\_masking\_rules {#query-masking-rules} + +Regexp-based rules, which will be applied to queries as well as all log messages before storing them in server logs, +`system.query_log`, `system.text_log`, `system.processes` table, and in logs sent to the client. That allows preventing +sensitive data leakage from SQL queries (like names, emails, personal +identifiers or credit card numbers) to logs. + +**Example** + +``` xml + + + hide SSN + (^|\D)\d{3}-\d{2}-\d{4}($|\D) + 000-00-0000 + + +``` + +Config fields: +- `name` - name for the rule (optional) +- `regexp` - RE2 compatible regular expression (mandatory) +- `replace` - substitution string for sensitive data (optional, by default - six asterisks) + +The masking rules are applied to the whole query (to prevent leaks of sensitive data from malformed / non-parsable queries). + +`system.events` table have counter `QueryMaskingRulesMatch` which have an overall number of query masking rules matches. + +For distributed queries each server have to be configured separately, otherwise, subqueries passed to other +nodes will be stored without masking. + +## remote\_servers {#server-settings-remote-servers} + +Configuration of clusters used by the [Distributed](../../engines/table-engines/special/distributed.md) table engine and by the `cluster` table function. + +**Example** + +``` xml + +``` + +For the value of the `incl` attribute, see the section “[Configuration files](../configuration-files.md#configuration_files)”. + +**See Also** + +- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) + +## timezone {#server_configuration_parameters-timezone} + +The server’s time zone. + +Specified as an IANA identifier for the UTC timezone or geographic location (for example, Africa/Abidjan). + +The time zone is necessary for conversions between String and DateTime formats when DateTime fields are output to text format (printed on the screen or in a file), and when getting DateTime from a string. Besides, the time zone is used in functions that work with the time and date if they didn’t receive the time zone in the input parameters. + +**Example** + +``` xml +Europe/Moscow +``` + +## tcp\_port {#server_configuration_parameters-tcp_port} + +Port for communicating with clients over the TCP protocol. + +**Example** + +``` xml +9000 +``` + +## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} + +TCP port for secure communication with clients. Use it with [OpenSSL](#server_configuration_parameters-openssl) settings. + +**Possible values** + +Positive integer. + +**Default value** + +``` xml +9440 +``` + +## mysql\_port {#server_configuration_parameters-mysql_port} + +Port for communicating with clients over MySQL protocol. + +**Possible values** + +Positive integer. + +Example + +``` xml +9004 +``` + +## tmp\_path {#server-settings-tmp_path} + +Path to temporary data for processing large queries. + +!!! note "Note" + The trailing slash is mandatory. + +**Example** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## tmp\_policy {#server-settings-tmp-policy} + +Policy from [`storage_configuration`](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) to store temporary files. +If not set [`tmp_path`](#server-settings-tmp_path) is used, otherwise it is ignored. + +!!! note "Note" + - `move_factor` is ignored +- `keep_free_space_bytes` is ignored +- `max_data_part_size_bytes` is ignored +- you must have exactly one volume in that policy + +## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} + +Cache size (in bytes) for uncompressed data used by table engines from the [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +There is one shared cache for the server. Memory is allocated on demand. The cache is used if the option [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) is enabled. + +The uncompressed cache is advantageous for very short queries in individual cases. + +**Example** + +``` xml +8589934592 +``` + +## user\_files\_path {#server_configuration_parameters-user_files_path} + +The directory with user files. Used in the table function [file()](../../sql-reference/table-functions/file.md). + +**Example** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## users\_config {#users-config} + +Path to the file that contains: + +- User configurations. +- Access rights. +- Settings profiles. +- Quota settings. + +**Example** + +``` xml +users.xml +``` + +## zookeeper {#server-settings_zookeeper} + +Contains settings that allow ClickHouse to interact with a [ZooKeeper](http://zookeeper.apache.org/) cluster. + +ClickHouse uses ZooKeeper for storing metadata of replicas when using replicated tables. If replicated tables are not used, this section of parameters can be omitted. + +This section contains the following parameters: + +- `node` — ZooKeeper endpoint. You can set multiple endpoints. + + For example: + + + +``` xml + + example_host + 2181 + +``` + + The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. + +- `session_timeout` — Maximum timeout for the client session in milliseconds. +- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) that is used as the root for znodes used by the ClickHouse server. Optional. +- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. + +**Example configuration** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + 10000 + + /path/to/zookeeper/node + + user:password + +``` + +**See Also** + +- [Replication](../../engines/table-engines/mergetree-family/replication.md) +- [ZooKeeper Programmer’s Guide](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} + +Storage method for data part headers in ZooKeeper. + +This setting only applies to the `MergeTree` family. It can be specified: + +- Globally in the [merge\_tree](#server_configuration_parameters-merge_tree) section of the `config.xml` file. + + ClickHouse uses the setting for all the tables on the server. You can change the setting at any time. Existing tables change their behaviour when the setting changes. + +- For each table. + + When creating a table, specify the corresponding [engine setting](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). The behaviour of an existing table with this setting does not change, even if the global setting changes. + +**Possible values** + +- 0 — Functionality is turned off. +- 1 — Functionality is turned on. + +If `use_minimalistic_part_header_in_zookeeper = 1`, then [replicated](../../engines/table-engines/mergetree-family/replication.md) tables store the headers of the data parts compactly using a single `znode`. If the table contains many columns, this storage method significantly reduces the volume of the data stored in Zookeeper. + +!!! attention "Attention" + After applying `use_minimalistic_part_header_in_zookeeper = 1`, you can’t downgrade the ClickHouse server to a version that doesn’t support this setting. Be careful when upgrading ClickHouse on servers in a cluster. Don’t upgrade all the servers at once. It is safer to test new versions of ClickHouse in a test environment, or on just a few servers of a cluster. + + Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. + +**Default value:** 0. + +## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} + +Disables the internal DNS cache. Recommended for operating ClickHouse in systems +with frequently changing infrastructure such as Kubernetes. + +**Default value:** 0. + +## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} + +The period of updating IP addresses stored in the ClickHouse internal DNS cache (in seconds). +The update is performed asynchronously, in a separate system thread. + +**Default value**: 15. + +[Original article](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/en/operations/server_configuration_parameters/index.md b/docs/en/operations/server_configuration_parameters/index.md deleted file mode 100644 index 748f4d25345..00000000000 --- a/docs/en/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -toc_folder_title: Server Configuration Parameters -toc_priority: 54 -toc_title: Introduction ---- - -# Server configuration parameters {#server-settings} - -This section contains descriptions of server settings that cannot be changed at the session or query level. - -These settings are stored in the `config.xml` file on the ClickHouse server. - -Other settings are described in the “[Settings](../settings/index.md#settings)” section. - -Before studying the settings, read the [Configuration files](../configuration_files.md#configuration_files) section and note the use of substitutions (the `incl` and `optional` attributes). - -[Original article](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/en/operations/server_configuration_parameters/settings.md b/docs/en/operations/server_configuration_parameters/settings.md deleted file mode 100644 index 02c00fababf..00000000000 --- a/docs/en/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,894 +0,0 @@ ---- -toc_priority: 57 -toc_title: Server Settings ---- - -# Server Settings {#server-settings} - -## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} - -The interval in seconds before reloading built-in dictionaries. - -ClickHouse reloads built-in dictionaries every x seconds. This makes it possible to edit dictionaries “on the fly” without restarting the server. - -Default value: 3600. - -**Example** - -``` xml -3600 -``` - -## compression {#server-settings-compression} - -Data compression settings for [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-engine tables. - -!!! warning "Warning" - Don’t use it if you have just started using ClickHouse. - -Configuration template: - -``` xml - - - ... - ... - ... - - ... - -``` - -`` fields: - -- `min_part_size` – The minimum size of a data part. -- `min_part_size_ratio` – The ratio of the data part size to the table size. -- `method` – Compression method. Acceptable values: `lz4` or `zstd`. - -You can configure multiple `` sections. - -Actions when conditions are met: - -- If a data part matches a condition set, ClickHouse uses the specified compression method. -- If a data part matches multiple condition sets, ClickHouse uses the first matched condition set. - -If no conditions met for a data part, ClickHouse uses the `lz4` compression. - -**Example** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## default\_database {#default-database} - -The default database. - -To get a list of databases, use the [SHOW DATABASES](../../sql_reference/statements/show.md#show-databases) query. - -**Example** - -``` xml -default -``` - -## default\_profile {#default-profile} - -Default settings profile. - -Settings profiles are located in the file specified in the parameter `user_config`. - -**Example** - -``` xml -default -``` - -## dictionaries\_config {#server_configuration_parameters-dictionaries_config} - -The path to the config file for external dictionaries. - -Path: - -- Specify the absolute path or the path relative to the server config file. -- The path can contain wildcards \* and ?. - -See also “[External dictionaries](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)”. - -**Example** - -``` xml -*_dictionary.xml -``` - -## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} - -Lazy loading of dictionaries. - -If `true`, then each dictionary is created on first use. If dictionary creation failed, the function that was using the dictionary throws an exception. - -If `false`, all dictionaries are created when the server starts, and if there is an error, the server shuts down. - -The default is `true`. - -**Example** - -``` xml -true -``` - -## format\_schema\_path {#server_configuration_parameters-format_schema_path} - -The path to the directory with the schemes for the input data, such as schemas for the [CapnProto](../../interfaces/formats.md#capnproto) format. - -**Example** - -``` xml - - format_schemas/ -``` - -## graphite {#server_configuration_parameters-graphite} - -Sending data to [Graphite](https://github.com/graphite-project). - -Settings: - -- host – The Graphite server. -- port – The port on the Graphite server. -- interval – The interval for sending, in seconds. -- timeout – The timeout for sending data, in seconds. -- root\_path – Prefix for keys. -- metrics – Sending data from the [system.metrics](../../operations/system_tables.md#system_tables-metrics) table. -- events – Sending deltas data accumulated for the time period from the [system.events](../../operations/system_tables.md#system_tables-events) table. -- events\_cumulative – Sending cumulative data from the [system.events](../../operations/system_tables.md#system_tables-events) table. -- asynchronous\_metrics – Sending data from the [system.asynchronous\_metrics](../../operations/system_tables.md#system_tables-asynchronous_metrics) table. - -You can configure multiple `` clauses. For instance, you can use this for sending different data at different intervals. - -**Example** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## graphite\_rollup {#server_configuration_parameters-graphite-rollup} - -Settings for thinning data for Graphite. - -For more details, see [GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md). - -**Example** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## http\_port/https\_port {#http-porthttps-port} - -The port for connecting to the server over HTTP(s). - -If `https_port` is specified, [openSSL](#server_configuration_parameters-openssl) must be configured. - -If `http_port` is specified, the OpenSSL configuration is ignored even if it is set. - -**Example** - -``` xml -0000 -``` - -## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} - -The page that is shown by default when you access the ClickHouse HTTP(s) server. -The default value is “Ok.” (with a line feed at the end) - -**Example** - -Opens `https://tabix.io/` when accessing `http://localhost: http_port`. - -``` xml - -
]]> -
-``` - -## include\_from {#server_configuration_parameters-include_from} - -The path to the file with substitutions. - -For more information, see the section “[Configuration files](../configuration_files.md#configuration_files)”. - -**Example** - -``` xml -/etc/metrica.xml -``` - -## interserver\_http\_port {#interserver-http-port} - -Port for exchanging data between ClickHouse servers. - -**Example** - -``` xml -9009 -``` - -## interserver\_http\_host {#interserver-http-host} - -The hostname that can be used by other servers to access this server. - -If omitted, it is defined in the same way as the `hostname-f` command. - -Useful for breaking away from a specific network interface. - -**Example** - -``` xml -example.yandex.ru -``` - -## interserver\_http\_credentials {#server-settings-interserver-http-credentials} - -The username and password used to authenticate during [replication](../../engines/table_engines/mergetree_family/replication.md) with the Replicated\* engines. These credentials are used only for communication between replicas and are unrelated to credentials for ClickHouse clients. The server is checking these credentials for connecting replicas and use the same credentials when connecting to other replicas. So, these credentials should be set the same for all replicas in a cluster. -By default, the authentication is not used. - -This section contains the following parameters: - -- `user` — username. -- `password` — password. - -**Example** - -``` xml - - admin - 222 - -``` - -## keep\_alive\_timeout {#keep-alive-timeout} - -The number of seconds that ClickHouse waits for incoming requests before closing the connection. Defaults to 3 seconds. - -**Example** - -``` xml -3 -``` - -## listen\_host {#server_configuration_parameters-listen_host} - -Restriction on hosts that requests can come from. If you want the server to answer all of them, specify `::`. - -Examples: - -``` xml -::1 -127.0.0.1 -``` - -## logger {#server_configuration_parameters-logger} - -Logging settings. - -Keys: - -- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. -- log – The log file. Contains all the entries according to `level`. -- errorlog – Error log file. -- size – Size of the file. Applies to `log`and`errorlog`. Once the file reaches `size`, ClickHouse archives and renames it, and creates a new log file in its place. -- count – The number of archived log files that ClickHouse stores. - -**Example** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -Writing to the syslog is also supported. Config example: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -Keys: - -- use\_syslog — Required setting if you want to write to the syslog. -- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. -- hostname — Optional. The name of the host that logs are sent from. -- facility — [The syslog facility keyword](https://en.wikipedia.org/wiki/Syslog#Facility) in uppercase letters with the “LOG\_” prefix: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`, and so on). - Default value: `LOG_USER` if `address` is specified, `LOG_DAEMON otherwise.` -- format – Message format. Possible values: `bsd` and `syslog.` - -## macros {#macros} - -Parameter substitutions for replicated tables. - -Can be omitted if replicated tables are not used. - -For more information, see the section “[Creating replicated tables](../../engines/table_engines/mergetree_family/replication.md)”. - -**Example** - -``` xml - -``` - -## mark\_cache\_size {#server-mark-cache-size} - -Approximate size (in bytes) of the cache of marks used by table engines of the [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) family. - -The cache is shared for the server and memory is allocated as needed. The cache size must be at least 5368709120. - -**Example** - -``` xml -5368709120 -``` - -## max\_concurrent\_queries {#max-concurrent-queries} - -The maximum number of simultaneously processed requests. - -**Example** - -``` xml -100 -``` - -## max\_connections {#max-connections} - -The maximum number of inbound connections. - -**Example** - -``` xml -4096 -``` - -## max\_open\_files {#max-open-files} - -The maximum number of open files. - -By default: `maximum`. - -We recommend using this option in Mac OS X since the `getrlimit()` function returns an incorrect value. - -**Example** - -``` xml -262144 -``` - -## max\_table\_size\_to\_drop {#max-table-size-to-drop} - -Restriction on deleting tables. - -If the size of a [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) table exceeds `max_table_size_to_drop` (in bytes), you can’t delete it using a DROP query. - -If you still need to delete the table without restarting the ClickHouse server, create the `/flags/force_drop_table` file and run the DROP query. - -Default value: 50 GB. - -The value 0 means that you can delete all tables without any restrictions. - -**Example** - -``` xml -0 -``` - -## merge\_tree {#server_configuration_parameters-merge_tree} - -Fine tuning for tables in the [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -For more information, see the MergeTreeSettings.h header file. - -**Example** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -SSL client/server configuration. - -Support for SSL is provided by the `libpoco` library. The interface is described in the file [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -Keys for server/client settings: - -- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. -- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` contains the certificate. -- caConfig – The path to the file or directory that contains trusted root certificates. -- verificationMode – The method for checking the node’s certificates. Details are in the description of the [Context](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) class. Possible values: `none`, `relaxed`, `strict`, `once`. -- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. -- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| -- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Acceptable values: `true`, `false`. -- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. This parameter is always recommended since it helps avoid problems both if the server caches the session and if the client requested caching. Default value: `${application.name}`. -- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. -- sessionTimeout – Time for caching the session on the server. -- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. -- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. -- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. -- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . -- disableProtocols – Protocols that are not allowed to use. -- preferServerCiphers – Preferred server ciphers on the client. - -**Example of settings:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## part\_log {#server_configuration_parameters-part-log} - -Logging events that are associated with [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). For instance, adding or merging data. You can use the log to simulate merge algorithms and compare their characteristics. You can visualize the merge process. - -Queries are logged in the [system.part\_log](../../operations/system_tables.md#system_tables-part-log) table, not in a separate file. You can configure the name of this table in the `table` parameter (see below). - -Use the following parameters to configure logging: - -- `database` – Name of the database. -- `table` – Name of the system table. -- `partition_by` – Sets a [custom partitioning key](../../engines/table_engines/mergetree_family/custom_partitioning_key.md). -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -**Example** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## path {#server_configuration_parameters-path} - -The path to the directory containing data. - -!!! note "Note" - The trailing slash is mandatory. - -**Example** - -``` xml -/var/lib/clickhouse/ -``` - -## prometheus {#server_configuration_parameters-prometheus} - -Exposing metrics data for scraping from [Prometheus](https://prometheus.io). - -Settings: - -- `endpoint` – HTTP endpoint for scraping metrics by prometheus server. Start from '/'. -- `port` – Port for `endpoint`. -- `metrics` – Flag that sets to expose metrics from the [system.metrics](../system_tables.md#system_tables-metrics) table. -- `events` – Flag that sets to expose metrics from the [system.events](../system_tables.md#system_tables-events) table. -- `asynchronous_metrics` – Flag that sets to expose current metrics values from the [system.asynchronous\_metrics](../system_tables.md#system_tables-asynchronous_metrics) table. - -**Example** - -``` xml - - /metrics - 8001 - true - true - true - -``` - -## query\_log {#server_configuration_parameters-query-log} - -Setting for logging queries received with the [log\_queries=1](../settings/settings.md) setting. - -Queries are logged in the [system.query\_log](../../operations/system_tables.md#system_tables-query_log) table, not in a separate file. You can change the name of the table in the `table` parameter (see below). - -Use the following parameters to configure logging: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [custom partitioning key](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) for a table. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -If the table doesn’t exist, ClickHouse will create it. If the structure of the query log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically. - -**Example** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## query\_thread\_log {#server_configuration_parameters-query-thread-log} - -Setting for logging threads of queries received with the [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) setting. - -Queries are logged in the [system.query\_thread\_log](../../operations/system_tables.md#system_tables-query-thread-log) table, not in a separate file. You can change the name of the table in the `table` parameter (see below). - -Use the following parameters to configure logging: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [custom partitioning key](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) for a system table. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -If the table doesn’t exist, ClickHouse will create it. If the structure of the query thread log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically. - -**Example** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## trace\_log {#server_configuration_parameters-trace_log} - -Settings for the [trace\_log](../../operations/system_tables.md#system_tables-trace_log) system table operation. - -Parameters: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [Custom partitioning key](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) for a system table. -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -The default server configuration file `config.xml` contains the following settings section: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## query\_masking\_rules {#query-masking-rules} - -Regexp-based rules, which will be applied to queries as well as all log messages before storing them in server logs, -`system.query_log`, `system.text_log`, `system.processes` table, and in logs sent to the client. That allows preventing -sensitive data leakage from SQL queries (like names, emails, personal -identifiers or credit card numbers) to logs. - -**Example** - -``` xml - - - hide SSN - (^|\D)\d{3}-\d{2}-\d{4}($|\D) - 000-00-0000 - - -``` - -Config fields: -- `name` - name for the rule (optional) -- `regexp` - RE2 compatible regular expression (mandatory) -- `replace` - substitution string for sensitive data (optional, by default - six asterisks) - -The masking rules are applied to the whole query (to prevent leaks of sensitive data from malformed / non-parsable queries). - -`system.events` table have counter `QueryMaskingRulesMatch` which have an overall number of query masking rules matches. - -For distributed queries each server have to be configured separately, otherwise, subqueries passed to other -nodes will be stored without masking. - -## remote\_servers {#server-settings-remote-servers} - -Configuration of clusters used by the [Distributed](../../engines/table_engines/special/distributed.md) table engine and by the `cluster` table function. - -**Example** - -``` xml - -``` - -For the value of the `incl` attribute, see the section “[Configuration files](../configuration_files.md#configuration_files)”. - -**See Also** - -- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) - -## timezone {#server_configuration_parameters-timezone} - -The server’s time zone. - -Specified as an IANA identifier for the UTC timezone or geographic location (for example, Africa/Abidjan). - -The time zone is necessary for conversions between String and DateTime formats when DateTime fields are output to text format (printed on the screen or in a file), and when getting DateTime from a string. Besides, the time zone is used in functions that work with the time and date if they didn’t receive the time zone in the input parameters. - -**Example** - -``` xml -Europe/Moscow -``` - -## tcp\_port {#server_configuration_parameters-tcp_port} - -Port for communicating with clients over the TCP protocol. - -**Example** - -``` xml -9000 -``` - -## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} - -TCP port for secure communication with clients. Use it with [OpenSSL](#server_configuration_parameters-openssl) settings. - -**Possible values** - -Positive integer. - -**Default value** - -``` xml -9440 -``` - -## mysql\_port {#server_configuration_parameters-mysql_port} - -Port for communicating with clients over MySQL protocol. - -**Possible values** - -Positive integer. - -Example - -``` xml -9004 -``` - -## tmp\_path {#server-settings-tmp_path} - -Path to temporary data for processing large queries. - -!!! note "Note" - The trailing slash is mandatory. - -**Example** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## tmp\_policy {#server-settings-tmp-policy} - -Policy from [`storage_configuration`](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) to store temporary files. -If not set [`tmp_path`](#server-settings-tmp_path) is used, otherwise it is ignored. - -!!! note "Note" - - `move_factor` is ignored -- `keep_free_space_bytes` is ignored -- `max_data_part_size_bytes` is ignored -- you must have exactly one volume in that policy - -## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} - -Cache size (in bytes) for uncompressed data used by table engines from the [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -There is one shared cache for the server. Memory is allocated on demand. The cache is used if the option [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) is enabled. - -The uncompressed cache is advantageous for very short queries in individual cases. - -**Example** - -``` xml -8589934592 -``` - -## user\_files\_path {#server_configuration_parameters-user_files_path} - -The directory with user files. Used in the table function [file()](../../sql_reference/table_functions/file.md). - -**Example** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## users\_config {#users-config} - -Path to the file that contains: - -- User configurations. -- Access rights. -- Settings profiles. -- Quota settings. - -**Example** - -``` xml -users.xml -``` - -## zookeeper {#server-settings_zookeeper} - -Contains settings that allow ClickHouse to interact with a [ZooKeeper](http://zookeeper.apache.org/) cluster. - -ClickHouse uses ZooKeeper for storing metadata of replicas when using replicated tables. If replicated tables are not used, this section of parameters can be omitted. - -This section contains the following parameters: - -- `node` — ZooKeeper endpoint. You can set multiple endpoints. - - For example: - - - -``` xml - - example_host - 2181 - -``` - - The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. - -- `session_timeout` — Maximum timeout for the client session in milliseconds. -- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) that is used as the root for znodes used by the ClickHouse server. Optional. -- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. - -**Example configuration** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - 10000 - - /path/to/zookeeper/node - - user:password - -``` - -**See Also** - -- [Replication](../../engines/table_engines/mergetree_family/replication.md) -- [ZooKeeper Programmer’s Guide](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} - -Storage method for data part headers in ZooKeeper. - -This setting only applies to the `MergeTree` family. It can be specified: - -- Globally in the [merge\_tree](#server_configuration_parameters-merge_tree) section of the `config.xml` file. - - ClickHouse uses the setting for all the tables on the server. You can change the setting at any time. Existing tables change their behaviour when the setting changes. - -- For each table. - - When creating a table, specify the corresponding [engine setting](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). The behaviour of an existing table with this setting does not change, even if the global setting changes. - -**Possible values** - -- 0 — Functionality is turned off. -- 1 — Functionality is turned on. - -If `use_minimalistic_part_header_in_zookeeper = 1`, then [replicated](../../engines/table_engines/mergetree_family/replication.md) tables store the headers of the data parts compactly using a single `znode`. If the table contains many columns, this storage method significantly reduces the volume of the data stored in Zookeeper. - -!!! attention "Attention" - After applying `use_minimalistic_part_header_in_zookeeper = 1`, you can’t downgrade the ClickHouse server to a version that doesn’t support this setting. Be careful when upgrading ClickHouse on servers in a cluster. Don’t upgrade all the servers at once. It is safer to test new versions of ClickHouse in a test environment, or on just a few servers of a cluster. - - Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. - -**Default value:** 0. - -## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} - -Disables the internal DNS cache. Recommended for operating ClickHouse in systems -with frequently changing infrastructure such as Kubernetes. - -**Default value:** 0. - -## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} - -The period of updating IP addresses stored in the ClickHouse internal DNS cache (in seconds). -The update is performed asynchronously, in a separate system thread. - -**Default value**: 15. - -[Original article](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/en/operations/settings/constraints_on_settings.md b/docs/en/operations/settings/constraints-on-settings.md similarity index 100% rename from docs/en/operations/settings/constraints_on_settings.md rename to docs/en/operations/settings/constraints-on-settings.md diff --git a/docs/en/operations/settings/permissions-for-queries.md b/docs/en/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..1f697989f5d --- /dev/null +++ b/docs/en/operations/settings/permissions-for-queries.md @@ -0,0 +1,59 @@ +--- +toc_priority: 58 +toc_title: Permissions for Queries +--- + +# Permissions for Queries {#permissions_for_queries} + +Queries in ClickHouse can be divided into several types: + +1. Read data queries: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. Write data queries: `INSERT`, `OPTIMIZE`. +3. Change settings query: `SET`, `USE`. +4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) queries: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +The following settings regulate user permissions by the type of query: + +- [readonly](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. +- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. + +`KILL QUERY` can be performed with any settings. + +## readonly {#settings_readonly} + +Restricts permissions for reading data, write data and change settings queries. + +See how the queries are divided into types [above](#permissions_for_queries). + +Possible values: + +- 0 — All queries are allowed. +- 1 — Only read data queries are allowed. +- 2 — Read data and change settings queries are allowed. + +After setting `readonly = 1`, the user can’t change `readonly` and `allow_ddl` settings in the current session. + +When using the `GET` method in the [HTTP interface](../../interfaces/http.md), `readonly = 1` is set automatically. To modify data, use the `POST` method. + +Setting `readonly = 1` prohibit the user from changing all the settings. There is a way to prohibit the user +from changing only specific settings, for details see [constraints on settings](constraints-on-settings.md). + +Default value: 0 + +## allow\_ddl {#settings_allow_ddl} + +Allows or denies [DDL](https://en.wikipedia.org/wiki/Data_definition_language) queries. + +See how the queries are divided into types [above](#permissions_for_queries). + +Possible values: + +- 0 — DDL queries are not allowed. +- 1 — DDL queries are allowed. + +You can’t execute `SET allow_ddl = 1` if `allow_ddl = 0` for the current session. + +Default value: 1 + +[Original article](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/en/operations/settings/permissions_for_queries.md b/docs/en/operations/settings/permissions_for_queries.md deleted file mode 100644 index 4bcc065e3f1..00000000000 --- a/docs/en/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -toc_priority: 58 -toc_title: Permissions for Queries ---- - -# Permissions for Queries {#permissions_for_queries} - -Queries in ClickHouse can be divided into several types: - -1. Read data queries: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. Write data queries: `INSERT`, `OPTIMIZE`. -3. Change settings query: `SET`, `USE`. -4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) queries: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -The following settings regulate user permissions by the type of query: - -- [readonly](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. -- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. - -`KILL QUERY` can be performed with any settings. - -## readonly {#settings_readonly} - -Restricts permissions for reading data, write data and change settings queries. - -See how the queries are divided into types [above](#permissions_for_queries). - -Possible values: - -- 0 — All queries are allowed. -- 1 — Only read data queries are allowed. -- 2 — Read data and change settings queries are allowed. - -After setting `readonly = 1`, the user can’t change `readonly` and `allow_ddl` settings in the current session. - -When using the `GET` method in the [HTTP interface](../../interfaces/http.md), `readonly = 1` is set automatically. To modify data, use the `POST` method. - -Setting `readonly = 1` prohibit the user from changing all the settings. There is a way to prohibit the user -from changing only specific settings, for details see [constraints on settings](constraints_on_settings.md). - -Default value: 0 - -## allow\_ddl {#settings_allow_ddl} - -Allows or denies [DDL](https://en.wikipedia.org/wiki/Data_definition_language) queries. - -See how the queries are divided into types [above](#permissions_for_queries). - -Possible values: - -- 0 — DDL queries are not allowed. -- 1 — DDL queries are allowed. - -You can’t execute `SET allow_ddl = 1` if `allow_ddl = 0` for the current session. - -Default value: 1 - -[Original article](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/en/operations/settings/query-complexity.md b/docs/en/operations/settings/query-complexity.md new file mode 100644 index 00000000000..ac090606c32 --- /dev/null +++ b/docs/en/operations/settings/query-complexity.md @@ -0,0 +1,299 @@ +--- +toc_priority: 59 +toc_title: Restrictions on Query Complexity +--- + +# Restrictions on Query Complexity {#restrictions-on-query-complexity} + +Restrictions on query complexity are part of the settings. +They are used to provide safer execution from the user interface. +Almost all the restrictions only apply to `SELECT`. For distributed query processing, restrictions are applied on each server separately. + +ClickHouse checks the restrictions for data parts, not for each row. It means that you can exceed the value of restriction with the size of the data part. + +Restrictions on the “maximum amount of something” can take the value 0, which means “unrestricted”. +Most restrictions also have an ‘overflow\_mode’ setting, meaning what to do when the limit is exceeded. +It can take one of two values: `throw` or `break`. Restrictions on aggregation (group\_by\_overflow\_mode) also have the value `any`. + +`throw` – Throw an exception (default). + +`break` – Stop executing the query and return the partial result, as if the source data ran out. + +`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. + +## max\_memory\_usage {#settings_max_memory_usage} + +The maximum amount of RAM to use for running a query on a single server. + +In the default configuration file, the maximum is 10 GB. + +The setting doesn’t consider the volume of available memory or the total volume of memory on the machine. +The restriction applies to a single query within a single server. +You can use `SHOW PROCESSLIST` to see the current memory consumption for each query. +Besides, the peak memory consumption is tracked for each query and written to the log. + +Memory usage is not monitored for the states of certain aggregate functions. + +Memory usage is not fully tracked for states of the aggregate functions `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` from `String` and `Array` arguments. + +Memory consumption is also restricted by the parameters `max_memory_usage_for_user` and `max_memory_usage_for_all_queries`. + +## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} + +The maximum amount of RAM to use for running a user’s queries on a single server. + +Default values are defined in [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). By default, the amount is not restricted (`max_memory_usage_for_user = 0`). + +See also the description of [max\_memory\_usage](#settings_max_memory_usage). + +## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} + +The maximum amount of RAM to use for running all queries on a single server. + +Default values are defined in [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). By default, the amount is not restricted (`max_memory_usage_for_all_queries = 0`). + +See also the description of [max\_memory\_usage](#settings_max_memory_usage). + +## max\_rows\_to\_read {#max-rows-to-read} + +The following restrictions can be checked on each block (instead of on each row). That is, the restrictions can be broken a little. +When running a query in multiple threads, the following restrictions apply to each thread separately. + +A maximum number of rows that can be read from a table when running a query. + +## max\_bytes\_to\_read {#max-bytes-to-read} + +A maximum number of bytes (uncompressed data) that can be read from a table when running a query. + +## read\_overflow\_mode {#read-overflow-mode} + +What to do when the volume of data read exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. + +## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} + +A maximum number of unique keys received from aggregation. This setting lets you limit memory consumption when aggregating. + +## group\_by\_overflow\_mode {#group-by-overflow-mode} + +What to do when the number of unique keys for aggregation exceeds the limit: ‘throw’, ‘break’, or ‘any’. By default, throw. +Using the ‘any’ value lets you run an approximation of GROUP BY. The quality of this approximation depends on the statistical nature of the data. + +## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} + +Enables or disables execution of `GROUP BY` clauses in external memory. See [GROUP BY in external memory](../../sql-reference/statements/select.md#select-group-by-in-external-memory). + +Possible values: + +- Maximum volume of RAM (in bytes) that can be used by the single [GROUP BY](../../sql-reference/statements/select.md#select-group-by-clause) operation. +- 0 — `GROUP BY` in external memory disabled. + +Default value: 0. + +## max\_rows\_to\_sort {#max-rows-to-sort} + +A maximum number of rows before sorting. This allows you to limit memory consumption when sorting. + +## max\_bytes\_to\_sort {#max-bytes-to-sort} + +A maximum number of bytes before sorting. + +## sort\_overflow\_mode {#sort-overflow-mode} + +What to do if the number of rows received before sorting exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. + +## max\_result\_rows {#setting-max_result_rows} + +Limit on the number of rows in the result. Also checked for subqueries, and on remote servers when running parts of a distributed query. + +## max\_result\_bytes {#max-result-bytes} + +Limit on the number of bytes in the result. The same as the previous setting. + +## result\_overflow\_mode {#result-overflow-mode} + +What to do if the volume of the result exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. + +Using ‘break’ is similar to using LIMIT. `Break` interrupts execution only at the block level. This means that amount of returned rows is greater than [max\_result\_rows](#setting-max_result_rows), multiple of [max\_block\_size](settings.md#setting-max_block_size) and depends on [max\_threads](settings.md#settings-max_threads). + +Example: + +``` sql +SET max_threads = 3, max_block_size = 3333; +SET max_result_rows = 3334, result_overflow_mode = 'break'; + +SELECT * +FROM numbers_mt(100000) +FORMAT Null; +``` + +Result: + +``` text +6666 rows in set. ... +``` + +## max\_execution\_time {#max-execution-time} + +Maximum query execution time in seconds. +At this time, it is not checked for one of the sorting stages, or when merging and finalizing aggregate functions. + +## timeout\_overflow\_mode {#timeout-overflow-mode} + +What to do if the query is run longer than ‘max\_execution\_time’: ‘throw’ or ‘break’. By default, throw. + +## min\_execution\_speed {#min-execution-speed} + +Minimal execution speed in rows per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is lower, an exception is thrown. + +## min\_execution\_speed\_bytes {#min-execution-speed-bytes} + +A minimum number of execution bytes per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is lower, an exception is thrown. + +## max\_execution\_speed {#max-execution-speed} + +A maximum number of execution rows per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is high, the execution speed will be reduced. + +## max\_execution\_speed\_bytes {#max-execution-speed-bytes} + +A maximum number of execution bytes per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is high, the execution speed will be reduced. + +## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} + +Checks that execution speed is not too slow (no less than ‘min\_execution\_speed’), after the specified time in seconds has expired. + +## max\_columns\_to\_read {#max-columns-to-read} + +A maximum number of columns that can be read from a table in a single query. If a query requires reading a greater number of columns, it throws an exception. + +## max\_temporary\_columns {#max-temporary-columns} + +A maximum number of temporary columns that must be kept in RAM at the same time when running a query, including constant columns. If there are more temporary columns than this, it throws an exception. + +## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} + +The same thing as ‘max\_temporary\_columns’, but without counting constant columns. +Note that constant columns are formed fairly often when running a query, but they require approximately zero computing resources. + +## max\_subquery\_depth {#max-subquery-depth} + +Maximum nesting depth of subqueries. If subqueries are deeper, an exception is thrown. By default, 100. + +## max\_pipeline\_depth {#max-pipeline-depth} + +Maximum pipeline depth. Corresponds to the number of transformations that each data block goes through during query processing. Counted within the limits of a single server. If the pipeline depth is greater, an exception is thrown. By default, 1000. + +## max\_ast\_depth {#max-ast-depth} + +Maximum nesting depth of a query syntactic tree. If exceeded, an exception is thrown. +At this time, it isn’t checked during parsing, but only after parsing the query. That is, a syntactic tree that is too deep can be created during parsing, but the query will fail. By default, 1000. + +## max\_ast\_elements {#max-ast-elements} + +A maximum number of elements in a query syntactic tree. If exceeded, an exception is thrown. +In the same way as the previous setting, it is checked only after parsing the query. By default, 50,000. + +## max\_rows\_in\_set {#max-rows-in-set} + +A maximum number of rows for a data set in the IN clause created from a subquery. + +## max\_bytes\_in\_set {#max-bytes-in-set} + +A maximum number of bytes (uncompressed data) used by a set in the IN clause created from a subquery. + +## set\_overflow\_mode {#set-overflow-mode} + +What to do when the amount of data exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. + +## max\_rows\_in\_distinct {#max-rows-in-distinct} + +A maximum number of different rows when using DISTINCT. + +## max\_bytes\_in\_distinct {#max-bytes-in-distinct} + +A maximum number of bytes used by a hash table when using DISTINCT. + +## distinct\_overflow\_mode {#distinct-overflow-mode} + +What to do when the amount of data exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. + +## max\_rows\_to\_transfer {#max-rows-to-transfer} + +A maximum number of rows that can be passed to a remote server or saved in a temporary table when using GLOBAL IN. + +## max\_bytes\_to\_transfer {#max-bytes-to-transfer} + +A maximum number of bytes (uncompressed data) that can be passed to a remote server or saved in a temporary table when using GLOBAL IN. + +## transfer\_overflow\_mode {#transfer-overflow-mode} + +What to do when the amount of data exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. + +## max\_rows\_in\_join {#settings-max_rows_in_join} + +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.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. + +ClickHouse can proceed with different actions when the limit is reached. Use the [join\_overflow\_mode](#settings-join_overflow_mode) setting to choose the action. + +Possible values: + +- Positive integer. +- 0 — Unlimited number of rows. + +Default value: 0. + +## max\_bytes\_in\_join {#settings-max_bytes_in_join} + +Limits the size in bytes of the hash table used when joining tables. + +This settings applies to [SELECT … JOIN](../../sql-reference/statements/select.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. + +ClickHouse can proceed with different actions when the limit is reached. Use [join\_overflow\_mode](#settings-join_overflow_mode) settings to choose the action. + +Possible values: + +- Positive integer. +- 0 — Memory control is disabled. + +Default value: 0. + +## join\_overflow\_mode {#settings-join_overflow_mode} + +Defines what action ClickHouse performs when any of the following join limits is reached: + +- [max\_bytes\_in\_join](#settings-max_bytes_in_join) +- [max\_rows\_in\_join](#settings-max_rows_in_join) + +Possible values: + +- `THROW` — ClickHouse throws an exception and breaks operation. +- `BREAK` — ClickHouse breaks operation and doesn’t throw an exception. + +Default value: `THROW`. + +**See Also** + +- [JOIN clause](../../sql-reference/statements/select.md#select-join) +- [Join table engine](../../engines/table-engines/special/join.md) + +## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} + +Limits the maximum number of partitions in a single inserted block. + +- Positive integer. +- 0 — Unlimited number of partitions. + +Default value: 100. + +**Details** + +When inserting data, ClickHouse calculates the number of partitions in the inserted block. If the number of partitions is more than `max_partitions_per_insert_block`, ClickHouse throws an exception with the following text: + +> “Too many partitions for single INSERT block (more than” + toString(max\_parts) + “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” + +[Original article](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/en/operations/settings/query_complexity.md b/docs/en/operations/settings/query_complexity.md deleted file mode 100644 index 034284d1d0b..00000000000 --- a/docs/en/operations/settings/query_complexity.md +++ /dev/null @@ -1,299 +0,0 @@ ---- -toc_priority: 59 -toc_title: Restrictions on Query Complexity ---- - -# Restrictions On Query Complexity {#restrictions-on-query-complexity} - -Restrictions on query complexity are part of the settings. -They are used to provide safer execution from the user interface. -Almost all the restrictions only apply to `SELECT`. For distributed query processing, restrictions are applied on each server separately. - -ClickHouse checks the restrictions for data parts, not for each row. It means that you can exceed the value of restriction with the size of the data part. - -Restrictions on the “maximum amount of something” can take the value 0, which means “unrestricted”. -Most restrictions also have an ‘overflow\_mode’ setting, meaning what to do when the limit is exceeded. -It can take one of two values: `throw` or `break`. Restrictions on aggregation (group\_by\_overflow\_mode) also have the value `any`. - -`throw` – Throw an exception (default). - -`break` – Stop executing the query and return the partial result, as if the source data ran out. - -`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. - -## max\_memory\_usage {#settings_max_memory_usage} - -The maximum amount of RAM to use for running a query on a single server. - -In the default configuration file, the maximum is 10 GB. - -The setting doesn’t consider the volume of available memory or the total volume of memory on the machine. -The restriction applies to a single query within a single server. -You can use `SHOW PROCESSLIST` to see the current memory consumption for each query. -Besides, the peak memory consumption is tracked for each query and written to the log. - -Memory usage is not monitored for the states of certain aggregate functions. - -Memory usage is not fully tracked for states of the aggregate functions `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` from `String` and `Array` arguments. - -Memory consumption is also restricted by the parameters `max_memory_usage_for_user` and `max_memory_usage_for_all_queries`. - -## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} - -The maximum amount of RAM to use for running a user’s queries on a single server. - -Default values are defined in [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). By default, the amount is not restricted (`max_memory_usage_for_user = 0`). - -See also the description of [max\_memory\_usage](#settings_max_memory_usage). - -## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} - -The maximum amount of RAM to use for running all queries on a single server. - -Default values are defined in [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). By default, the amount is not restricted (`max_memory_usage_for_all_queries = 0`). - -See also the description of [max\_memory\_usage](#settings_max_memory_usage). - -## max\_rows\_to\_read {#max-rows-to-read} - -The following restrictions can be checked on each block (instead of on each row). That is, the restrictions can be broken a little. -When running a query in multiple threads, the following restrictions apply to each thread separately. - -A maximum number of rows that can be read from a table when running a query. - -## max\_bytes\_to\_read {#max-bytes-to-read} - -A maximum number of bytes (uncompressed data) that can be read from a table when running a query. - -## read\_overflow\_mode {#read-overflow-mode} - -What to do when the volume of data read exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. - -## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} - -A maximum number of unique keys received from aggregation. This setting lets you limit memory consumption when aggregating. - -## group\_by\_overflow\_mode {#group-by-overflow-mode} - -What to do when the number of unique keys for aggregation exceeds the limit: ‘throw’, ‘break’, or ‘any’. By default, throw. -Using the ‘any’ value lets you run an approximation of GROUP BY. The quality of this approximation depends on the statistical nature of the data. - -## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} - -Enables or disables execution of `GROUP BY` clauses in external memory. See [GROUP BY in external memory](../../sql_reference/statements/select.md#select-group-by-in-external-memory). - -Possible values: - -- Maximum volume of RAM (in bytes) that can be used by the single [GROUP BY](../../sql_reference/statements/select.md#select-group-by-clause) operation. -- 0 — `GROUP BY` in external memory disabled. - -Default value: 0. - -## max\_rows\_to\_sort {#max-rows-to-sort} - -A maximum number of rows before sorting. This allows you to limit memory consumption when sorting. - -## max\_bytes\_to\_sort {#max-bytes-to-sort} - -A maximum number of bytes before sorting. - -## sort\_overflow\_mode {#sort-overflow-mode} - -What to do if the number of rows received before sorting exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. - -## max\_result\_rows {#setting-max_result_rows} - -Limit on the number of rows in the result. Also checked for subqueries, and on remote servers when running parts of a distributed query. - -## max\_result\_bytes {#max-result-bytes} - -Limit on the number of bytes in the result. The same as the previous setting. - -## result\_overflow\_mode {#result-overflow-mode} - -What to do if the volume of the result exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. - -Using ‘break’ is similar to using LIMIT. `Break` interrupts execution only at the block level. This means that amount of returned rows is greater than [max\_result\_rows](#setting-max_result_rows), multiple of [max\_block\_size](settings.md#setting-max_block_size) and depends on [max\_threads](settings.md#settings-max_threads). - -Example: - -``` sql -SET max_threads = 3, max_block_size = 3333; -SET max_result_rows = 3334, result_overflow_mode = 'break'; - -SELECT * -FROM numbers_mt(100000) -FORMAT Null; -``` - -Result: - -``` text -6666 rows in set. ... -``` - -## max\_execution\_time {#max-execution-time} - -Maximum query execution time in seconds. -At this time, it is not checked for one of the sorting stages, or when merging and finalizing aggregate functions. - -## timeout\_overflow\_mode {#timeout-overflow-mode} - -What to do if the query is run longer than ‘max\_execution\_time’: ‘throw’ or ‘break’. By default, throw. - -## min\_execution\_speed {#min-execution-speed} - -Minimal execution speed in rows per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is lower, an exception is thrown. - -## min\_execution\_speed\_bytes {#min-execution-speed-bytes} - -A minimum number of execution bytes per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is lower, an exception is thrown. - -## max\_execution\_speed {#max-execution-speed} - -A maximum number of execution rows per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is high, the execution speed will be reduced. - -## max\_execution\_speed\_bytes {#max-execution-speed-bytes} - -A maximum number of execution bytes per second. Checked on every data block when ‘timeout\_before\_checking\_execution\_speed’ expires. If the execution speed is high, the execution speed will be reduced. - -## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} - -Checks that execution speed is not too slow (no less than ‘min\_execution\_speed’), after the specified time in seconds has expired. - -## max\_columns\_to\_read {#max-columns-to-read} - -A maximum number of columns that can be read from a table in a single query. If a query requires reading a greater number of columns, it throws an exception. - -## max\_temporary\_columns {#max-temporary-columns} - -A maximum number of temporary columns that must be kept in RAM at the same time when running a query, including constant columns. If there are more temporary columns than this, it throws an exception. - -## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} - -The same thing as ‘max\_temporary\_columns’, but without counting constant columns. -Note that constant columns are formed fairly often when running a query, but they require approximately zero computing resources. - -## max\_subquery\_depth {#max-subquery-depth} - -Maximum nesting depth of subqueries. If subqueries are deeper, an exception is thrown. By default, 100. - -## max\_pipeline\_depth {#max-pipeline-depth} - -Maximum pipeline depth. Corresponds to the number of transformations that each data block goes through during query processing. Counted within the limits of a single server. If the pipeline depth is greater, an exception is thrown. By default, 1000. - -## max\_ast\_depth {#max-ast-depth} - -Maximum nesting depth of a query syntactic tree. If exceeded, an exception is thrown. -At this time, it isn’t checked during parsing, but only after parsing the query. That is, a syntactic tree that is too deep can be created during parsing, but the query will fail. By default, 1000. - -## max\_ast\_elements {#max-ast-elements} - -A maximum number of elements in a query syntactic tree. If exceeded, an exception is thrown. -In the same way as the previous setting, it is checked only after parsing the query. By default, 50,000. - -## max\_rows\_in\_set {#max-rows-in-set} - -A maximum number of rows for a data set in the IN clause created from a subquery. - -## max\_bytes\_in\_set {#max-bytes-in-set} - -A maximum number of bytes (uncompressed data) used by a set in the IN clause created from a subquery. - -## set\_overflow\_mode {#set-overflow-mode} - -What to do when the amount of data exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. - -## max\_rows\_in\_distinct {#max-rows-in-distinct} - -A maximum number of different rows when using DISTINCT. - -## max\_bytes\_in\_distinct {#max-bytes-in-distinct} - -A maximum number of bytes used by a hash table when using DISTINCT. - -## distinct\_overflow\_mode {#distinct-overflow-mode} - -What to do when the amount of data exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. - -## max\_rows\_to\_transfer {#max-rows-to-transfer} - -A maximum number of rows that can be passed to a remote server or saved in a temporary table when using GLOBAL IN. - -## max\_bytes\_to\_transfer {#max-bytes-to-transfer} - -A maximum number of bytes (uncompressed data) that can be passed to a remote server or saved in a temporary table when using GLOBAL IN. - -## transfer\_overflow\_mode {#transfer-overflow-mode} - -What to do when the amount of data exceeds one of the limits: ‘throw’ or ‘break’. By default, throw. - -## max\_rows\_in\_join {#settings-max_rows_in_join} - -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.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. - -ClickHouse can proceed with different actions when the limit is reached. Use the [join\_overflow\_mode](#settings-join_overflow_mode) setting to choose the action. - -Possible values: - -- Positive integer. -- 0 — Unlimited number of rows. - -Default value: 0. - -## max\_bytes\_in\_join {#settings-max_bytes_in_join} - -Limits the size in bytes of the hash table used when joining tables. - -This settings applies to [SELECT … JOIN](../../sql_reference/statements/select.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. - -ClickHouse can proceed with different actions when the limit is reached. Use [join\_overflow\_mode](#settings-join_overflow_mode) settings to choose the action. - -Possible values: - -- Positive integer. -- 0 — Memory control is disabled. - -Default value: 0. - -## join\_overflow\_mode {#settings-join_overflow_mode} - -Defines what action ClickHouse performs when any of the following join limits is reached: - -- [max\_bytes\_in\_join](#settings-max_bytes_in_join) -- [max\_rows\_in\_join](#settings-max_rows_in_join) - -Possible values: - -- `THROW` — ClickHouse throws an exception and breaks operation. -- `BREAK` — ClickHouse breaks operation and doesn’t throw an exception. - -Default value: `THROW`. - -**See Also** - -- [JOIN clause](../../sql_reference/statements/select.md#select-join) -- [Join table engine](../../engines/table_engines/special/join.md) - -## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} - -Limits the maximum number of partitions in a single inserted block. - -- Positive integer. -- 0 — Unlimited number of partitions. - -Default value: 100. - -**Details** - -When inserting data, ClickHouse calculates the number of partitions in the inserted block. If the number of partitions is more than `max_partitions_per_insert_block`, ClickHouse throws an exception with the following text: - -> “Too many partitions for single INSERT block (more than” + toString(max\_parts) + “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” - -[Original article](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/en/operations/settings/settings_profiles.md b/docs/en/operations/settings/settings-profiles.md similarity index 100% rename from docs/en/operations/settings/settings_profiles.md rename to docs/en/operations/settings/settings-profiles.md diff --git a/docs/en/operations/settings/settings-users.md b/docs/en/operations/settings/settings-users.md new file mode 100644 index 00000000000..bbeb3035c40 --- /dev/null +++ b/docs/en/operations/settings/settings-users.md @@ -0,0 +1,146 @@ +--- +toc_priority: 63 +toc_title: User Settings +--- + +# User Settings {#user-settings} + +The `users` section of the `user.xml` configuration file contains user settings. + +Structure of the `users` section: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### user\_name/password {#user-namepassword} + +Password can be specified in plaintext or in SHA256 (hex format). + +- To assign a password in plaintext (**not recommended**), place it in a `password` element. + + For example, `qwerty`. The password can be left blank. + + + +- To assign a password using its SHA256 hash, place it in a `password_sha256_hex` element. + + For example, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + Example of how to generate a password from shell: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + + The first line of the result is the password. The second line is the corresponding SHA256 hash. + + + +- For compatibility with MySQL clients, password can be specified in double SHA1 hash. Place it in `password_double_sha1_hex` element. + + For example, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + Example of how to generate a password from shell: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + + The first line of the result is the password. The second line is the corresponding double SHA1 hash. + +### user\_name/networks {#user-namenetworks} + +List of networks from which the user can connect to the ClickHouse server. + +Each element of the list can have one of the following forms: + +- `` — IP address or network mask. + + Examples: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Hostname. + + Example: `example01.host.ru`. + + To check access, a DNS query is performed, and all returned IP addresses are compared to the peer address. + +- `` — Regular expression for hostnames. + + Example, `^example\d\d-\d\d-\d\.host\.ru$` + + To check access, a [DNS PTR query](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) is performed for the peer address and then the specified regexp is applied. Then, another DNS query is performed for the results of the PTR query and all the received addresses are compared to the peer address. We strongly recommend that regexp ends with $. + +All results of DNS requests are cached until the server restarts. + +**Examples** + +To open access for user from any network, specify: + +``` xml +::/0 +``` + +!!! warning "Warning" + It’s insecure to open access from any network unless you have a firewall properly configured or the server is not directly connected to Internet. + +To open access only from localhost, specify: + +``` xml +::1 +127.0.0.1 +``` + +### user\_name/profile {#user-nameprofile} + +You can assign a settings profile for the user. Settings profiles are configured in a separate section of the `users.xml` file. For more information, see [Profiles of Settings](settings-profiles.md). + +### user\_name/quota {#user-namequota} + +Quotas allow you to track or limit resource usage over a period of time. Quotas are configured in the `quotas` +section of the `users.xml` configuration file. + +You can assign a quotas set for the user. For a detailed description of quotas configuration, see [Quotas](../quotas.md#quotas). + +### user\_name/databases {#user-namedatabases} + +In this section, you can you can limit rows that are returned by ClickHouse for `SELECT` queries made by the current user, thus implementing basic row-level security. + +**Example** + +The following configuration forces that user `user1` can only see the rows of `table1` as the result of `SELECT` queries, where the value of the `id` field is 1000. + +``` xml + + + + + id = 1000 + + + + +``` + +The `filter` can be any expression resulting in a [UInt8](../../sql-reference/data-types/int-uint.md)-type value. It usually contains comparisons and logical operators. Rows from `database_name.table1` where filter results to 0 are not returned for this user. The filtering is incompatible with `PREWHERE` operations and disables `WHERE→PREWHERE` optimization. + +[Original article](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 46cd00cb661..a7b58e1b349 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -7,7 +7,7 @@ toc_title: Settings ## distributed\_product\_mode {#distributed-product-mode} -Changes the behavior of [distributed subqueries](../../sql_reference/statements/select.md). +Changes the behavior of [distributed subqueries](../../sql-reference/statements/select.md). ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table. @@ -16,7 +16,7 @@ Restrictions: - Only applied for IN and JOIN subqueries. - Only if the FROM section uses a distributed table containing more than one shard. - If the subquery concerns a distributed table containing more than one shard. -- Not used for a table-valued [remote](../../sql_reference/table_functions/remote.md) function. +- Not used for a table-valued [remote](../../sql-reference/table-functions/remote.md) function. Possible values: @@ -51,7 +51,7 @@ If `enable_optimize_predicate_expression = 0`, then the execution time of the se ## fallback\_to\_stale\_replicas\_for\_distributed\_queries {#settings-fallback_to_stale_replicas_for_distributed_queries} -Forces a query to an out-of-date replica if updated data is not available. See [Replication](../../engines/table_engines/mergetree_family/replication.md). +Forces a query to an out-of-date replica if updated data is not available. See [Replication](../../engines/table-engines/mergetree-family/replication.md). ClickHouse selects the most relevant from the outdated replicas of the table. @@ -65,7 +65,7 @@ Disables query execution if the index can’t be used by date. Works with tables in the MergeTree family. -If `force_index_by_date=1`, ClickHouse checks whether the query has a date key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition reduces the amount of data to read. For example, the condition `Date != ' 2000-01-01 '` is acceptable even when it matches all the data in the table (i.e., running the query requires a full scan). For more information about ranges of data in MergeTree tables, see [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +If `force_index_by_date=1`, ClickHouse checks whether the query has a date key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition reduces the amount of data to read. For example, the condition `Date != ' 2000-01-01 '` is acceptable even when it matches all the data in the table (i.e., running the query requires a full scan). For more information about ranges of data in MergeTree tables, see [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## force\_primary\_key {#force-primary-key} @@ -73,7 +73,7 @@ Disables query execution if indexing by the primary key is not possible. Works with tables in the MergeTree family. -If `force_primary_key=1`, ClickHouse checks to see if the query has a primary key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition reduces the amount of data to read. For more information about data ranges in MergeTree tables, see [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +If `force_primary_key=1`, ClickHouse checks to see if the query has a primary key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition reduces the amount of data to read. For more information about data ranges in MergeTree tables, see [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## format\_schema {#format-schema} @@ -134,7 +134,7 @@ Default value: 0. ## max\_http\_get\_redirects {#setting-max_http_get_redirects} -Limits the maximum number of HTTP GET redirect hops for [URL](../../engines/table_engines/special/url.md)-engine tables. The setting applies to both types of tables: those created by the [CREATE TABLE](../../sql_reference/statements/create.md#create-table-query) query and by the [url](../../sql_reference/table_functions/url.md) table function. +Limits the maximum number of HTTP GET redirect hops for [URL](../../engines/table-engines/special/url.md)-engine tables. The setting applies to both types of tables: those created by the [CREATE TABLE](../../sql-reference/statements/create.md#create-table-query) query and by the [url](../../sql-reference/table-functions/url.md) table function. Possible values: @@ -170,7 +170,7 @@ If both `input_format_allow_errors_num` and `input_format_allow_errors_ratio` ar ## input\_format\_values\_interpret\_expressions {#settings-input_format_values_interpret_expressions} -Enables or disables the full SQL parser if the fast stream parser can’t parse the data. This setting is used only for the [Values](../../interfaces/formats.md#data-format-values) format at the data insertion. For more information about syntax parsing, see the [Syntax](../../sql_reference/syntax.md) section. +Enables or disables the full SQL parser if the fast stream parser can’t parse the data. This setting is used only for the [Values](../../interfaces/formats.md#data-format-values) format at the data insertion. For more information about syntax parsing, see the [Syntax](../../sql-reference/syntax.md) section. Possible values: @@ -186,7 +186,7 @@ Default value: 1. Example of Use -Insert the [DateTime](../../sql_reference/data_types/datetime.md) type value with the different settings. +Insert the [DateTime](../../sql-reference/data-types/datetime.md) type value with the different settings. ``` sql SET input_format_values_interpret_expressions = 0; @@ -220,7 +220,7 @@ Ok. ## input\_format\_values\_deduce\_templates\_of\_expressions {#settings-input_format_values_deduce_templates_of_expressions} -Enables or disables template deduction for SQL expressions in [Values](../../interfaces/formats.md#data-format-values) format. It allows parsing and interpreting expressions in `Values` much faster if expressions in consecutive rows have the same structure. ClickHouse tries to deduce template of an expression, parse the following rows using this template and evaluate the expression on a batch of successfully parsed rows. +Enables or disables template deduction for SQL expressions in [Values](../../interfaces/formats.md#data-format-values) format. It allows parsing and interpreting expressions in `Values` much faster if expressions in consecutive rows have the same structure. ClickHouse tries to deduce template of an expression, parse the following rows using this template and evaluate the expression on a batch of successfully parsed rows. Possible values: @@ -346,7 +346,7 @@ Default value: 1. Allows choosing a parser of the text representation of date and time. -The setting doesn’t apply to [date and time functions](../../sql_reference/functions/date_time_functions.md). +The setting doesn’t apply to [date and time functions](../../sql-reference/functions/date-time-functions.md). Possible values: @@ -362,12 +362,12 @@ Default value: `'basic'`. See also: -- [DateTime data type.](../../sql_reference/data_types/datetime.md) -- [Functions for working with dates and times.](../../sql_reference/functions/date_time_functions.md) +- [DateTime data type.](../../sql-reference/data-types/datetime.md) +- [Functions for working with dates and times.](../../sql-reference/functions/date-time-functions.md) ## join\_default\_strictness {#settings-join_default_strictness} -Sets default strictness for [JOIN clauses](../../sql_reference/statements/select.md#select-join). +Sets default strictness for [JOIN clauses](../../sql-reference/statements/select.md#select-join). Possible values: @@ -383,7 +383,7 @@ Default value: `ALL`. Changes behaviour of join operations with `ANY` strictness. !!! warning "Attention" - This setting applies only for `JOIN` operations with [Join](../../engines/table_engines/special/join.md) engine tables. + This setting applies only for `JOIN` operations with [Join](../../engines/table-engines/special/join.md) engine tables. Possible values: @@ -394,18 +394,18 @@ Default value: 0. See also: -- [JOIN clause](../../sql_reference/statements/select.md#select-join) -- [Join table engine](../../engines/table_engines/special/join.md) +- [JOIN clause](../../sql-reference/statements/select.md#select-join) +- [Join table engine](../../engines/table-engines/special/join.md) - [join\_default\_strictness](#settings-join_default_strictness) ## join\_use\_nulls {#join_use_nulls} -Sets the type of [JOIN](../../sql_reference/statements/select.md) behavior. When merging tables, empty cells may appear. ClickHouse fills them differently based on this setting. +Sets the type of [JOIN](../../sql-reference/statements/select.md) behavior. When merging tables, empty cells may appear. ClickHouse fills them differently based on this setting. Possible values: - 0 — The empty cells are filled with the default value of the corresponding field type. -- 1 — `JOIN` behaves the same way as in standard SQL. The type of the corresponding field is converted to [Nullable](../../sql_reference/data_types/nullable.md#data_type-nullable), and empty cells are filled with [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` behaves the same way as in standard SQL. The type of the corresponding field is converted to [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable), and empty cells are filled with [NULL](../../sql-reference/syntax.md). Default value: 0. @@ -425,7 +425,7 @@ By default: 1,000,000. It only works when reading from MergeTree engines. ## merge\_tree\_min\_rows\_for\_concurrent\_read {#setting-merge-tree-min-rows-for-concurrent-read} -If the number of rows to be read from a file of a [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) table exceeds `merge_tree_min_rows_for_concurrent_read` then ClickHouse tries to perform a concurrent reading from this file on several threads. +If the number of rows to be read from a file of a [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) table exceeds `merge_tree_min_rows_for_concurrent_read` then ClickHouse tries to perform a concurrent reading from this file on several threads. Possible values: @@ -435,7 +435,7 @@ Default value: 163840. ## merge\_tree\_min\_bytes\_for\_concurrent\_read {#setting-merge-tree-min-bytes-for-concurrent-read} -If the number of bytes to read from one file of a [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-engine table exceeds `merge_tree_min_bytes_for_concurrent_read`, then ClickHouse tries to concurrently read from this file in several threads. +If the number of bytes to read from one file of a [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-engine table exceeds `merge_tree_min_bytes_for_concurrent_read`, then ClickHouse tries to concurrently read from this file in several threads. Possible value: @@ -477,7 +477,7 @@ Default value: 8. If ClickHouse should read more than `merge_tree_max_rows_to_use_cache` rows in one query, it doesn’t use the cache of uncompressed blocks. -The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks. +The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks. Possible values: @@ -489,7 +489,7 @@ Default value: 128 ✕ 8192. If ClickHouse should read more than `merge_tree_max_bytes_to_use_cache` bytes in one query, it doesn’t use the cache of uncompressed blocks. -The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks. +The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks. Possible value: @@ -514,7 +514,7 @@ Default value: 0. Setting up query logging. -Queries sent to ClickHouse with this setup are logged according to the rules in the [query\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-log) server configuration parameter. +Queries sent to ClickHouse with this setup are logged according to the rules in the [query\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-log) server configuration parameter. Example: @@ -544,7 +544,7 @@ log_queries_min_type='EXCEPTION_WHILE_PROCESSING' Setting up query threads logging. -Queries’ threads runned by ClickHouse with this setup are logged according to the rules in the [query\_thread\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) server configuration parameter. +Queries’ threads runned by ClickHouse with this setup are logged according to the rules in the [query\_thread\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) server configuration parameter. Example: @@ -564,31 +564,31 @@ Default value: 1,048,576. The default is slightly more than `max_block_size`. The reason for this is because certain table engines (`*MergeTree`) form a data part on the disk for each inserted block, which is a fairly large entity. Similarly, `*MergeTree` tables sort data during insertion and a large enough block size allow sorting more data in RAM. -## min_insert_block_size_rows {#min-insert-block-size-rows} +## min\_insert\_block\_size\_rows {#min-insert-block-size-rows} Sets minimum number of rows in block which can be inserted into a table by an `INSERT` query. Smaller-sized blocks are squashed into bigger ones. Possible values: -- Positive integer. -- 0 — Squashing disabled. +- Positive integer. +- 0 — Squashing disabled. Default value: 1048576. -## min_insert_block_size_bytes {#min-insert-block-size-bytes} +## min\_insert\_block\_size\_bytes {#min-insert-block-size-bytes} Sets minimum number of bytes in block which can be inserted into a table by an `INSERT` query. Smaller-sized blocks are squashed into bigger ones. Possible values: -- Positive integer. -- 0 — Squashing disabled. +- Positive integer. +- 0 — Squashing disabled. Default value: 268435456. ## max\_replica\_delay\_for\_distributed\_queries {#settings-max_replica_delay_for_distributed_queries} -Disables lagging replicas for distributed queries. See [Replication](../../engines/table_engines/mergetree_family/replication.md). +Disables lagging replicas for distributed queries. See [Replication](../../engines/table-engines/mergetree-family/replication.md). Sets the time in seconds. If a replica lags more than the set value, this replica is not used. @@ -633,7 +633,7 @@ Don’t confuse blocks for compression (a chunk of memory consisting of bytes) w ## min\_compress\_block\_size {#min-compress-block-size} -For [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)" tables. In order to reduce latency when processing queries, a block is compressed when writing the next mark if its size is at least ‘min\_compress\_block\_size’. By default, 65,536. +For [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)" tables. In order to reduce latency when processing queries, a block is compressed when writing the next mark if its size is at least ‘min\_compress\_block\_size’. By default, 65,536. The actual size of the block, if the uncompressed data is less than ‘max\_compress\_block\_size’, is no less than this value and no less than the volume of data for one mark. @@ -711,7 +711,7 @@ For more information, see the section “Extreme values”. ## use\_uncompressed\_cache {#setting-use_uncompressed_cache} Whether to use a cache of uncompressed blocks. Accepts 0 or 1. By default, 0 (disabled). -Using the uncompressed cache (only for tables in the MergeTree family) can significantly reduce latency and increase throughput when working with a large number of short queries. Enable this setting for users who send frequent short requests. Also pay attention to the [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. +Using the uncompressed cache (only for tables in the MergeTree family) can significantly reduce latency and increase throughput when working with a large number of short queries. Enable this setting for users who send frequent short requests. Also pay attention to the [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. For queries that read at least a somewhat large volume of data (one million rows or more), the uncompressed cache is disabled automatically to save space for truly small queries. This means that you can keep the ‘use\_uncompressed\_cache’ setting always set to 1. @@ -922,7 +922,7 @@ Possible values: Default value: 1. -By default, blocks inserted into replicated tables by the `INSERT` statement are deduplicated (see \[Data Replication\] (../engines/table\_engines/mergetree_family/replication.md). +By default, blocks inserted into replicated tables by the `INSERT` statement are deduplicated (see \[Data Replication\] (../engines/table\_engines/mergetree\_family/replication.md). ## deduplicate\_blocks\_in\_dependent\_materialized\_views {#settings-deduplicate-blocks-in-dependent-materialized-views} @@ -988,15 +988,15 @@ Default value: 0. ## count\_distinct\_implementation {#settings-count_distinct_implementation} -Specifies which of the `uniq*` functions should be used to perform the [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count) construction. +Specifies which of the `uniq*` functions should be used to perform the [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count) construction. Possible values: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqCombined](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [uniqCombined64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [uniqHLL12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [uniqExact](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqCombined](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [uniqCombined64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [uniqHLL12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [uniqExact](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) Default value: `uniqExact`. @@ -1061,7 +1061,7 @@ Default value: 0. ## optimize\_throw\_if\_noop {#setting-optimize_throw_if_noop} -Enables or disables throwing an exception if an [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) query didn’t perform a merge. +Enables or disables throwing an exception if an [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) query didn’t perform a merge. By default, `OPTIMIZE` returns successfully even if it didn’t do anything. This setting lets you differentiate these situations and get the reason in an exception message. @@ -1081,7 +1081,7 @@ Controls how fast errors in distributed tables are zeroed. If a replica is unava See also: -- [Table engine Distributed](../../engines/table_engines/special/distributed.md) +- [Table engine Distributed](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_cap](#settings-distributed_replica_error_cap) ## distributed\_replica\_error\_cap {#settings-distributed_replica_error_cap} @@ -1093,12 +1093,12 @@ Error count of each replica is capped at this value, preventing a single replica See also: -- [Table engine Distributed](../../engines/table_engines/special/distributed.md) +- [Table engine Distributed](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_half\_life](#settings-distributed_replica_error_half_life) ## distributed\_directory\_monitor\_sleep\_time\_ms {#distributed_directory_monitor_sleep_time_ms} -Base interval for the [Distributed](../../engines/table_engines/special/distributed.md) table engine to send data. The actual interval grows exponentially in the event of errors. +Base interval for the [Distributed](../../engines/table-engines/special/distributed.md) table engine to send data. The actual interval grows exponentially in the event of errors. Possible values: @@ -1108,7 +1108,7 @@ Default value: 100 milliseconds. ## distributed\_directory\_monitor\_max\_sleep\_time\_ms {#distributed_directory_monitor_max_sleep_time_ms} -Maximum interval for the [Distributed](../../engines/table_engines/special/distributed.md) table engine to send data. Limits exponential growth of the interval set in the [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) setting. +Maximum interval for the [Distributed](../../engines/table-engines/special/distributed.md) table engine to send data. Limits exponential growth of the interval set in the [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) setting. Possible values: @@ -1120,7 +1120,7 @@ Default value: 30000 milliseconds (30 seconds). Enables/disables sending of inserted data in batches. -When batch sending is enabled, the [Distributed](../../engines/table_engines/special/distributed.md) table engine tries to send multiple files of inserted data in one operation instead of sending them separately. Batch sending improves cluster performance by better-utilizing server and network resources. +When batch sending is enabled, the [Distributed](../../engines/table-engines/special/distributed.md) table engine tries to send multiple files of inserted data in one operation instead of sending them separately. Batch sending improves cluster performance by better-utilizing server and network resources. Possible values: @@ -1146,7 +1146,7 @@ Default value: 0. ## query\_profiler\_real\_time\_period\_ns {#query_profiler_real_time_period_ns} -Sets the period for a real clock timer of the [query profiler](../../operations/optimizing_performance/sampling_query_profiler.md). Real clock timer counts wall-clock time. +Sets the period for a real clock timer of the [query profiler](../../operations/optimizing-performance/sampling-query-profiler.md). Real clock timer counts wall-clock time. Possible values: @@ -1159,17 +1159,17 @@ Possible values: - 0 for turning off the timer. -Type: [UInt64](../../sql_reference/data_types/int_uint.md). +Type: [UInt64](../../sql-reference/data-types/int-uint.md). Default value: 1000000000 nanoseconds (once a second). See also: -- System table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- System table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## query\_profiler\_cpu\_time\_period\_ns {#query_profiler_cpu_time_period_ns} -Sets the period for a CPU clock timer of the [query profiler](../../operations/optimizing_performance/sampling_query_profiler.md). This timer counts only CPU time. +Sets the period for a CPU clock timer of the [query profiler](../../operations/optimizing-performance/sampling-query-profiler.md). This timer counts only CPU time. Possible values: @@ -1182,17 +1182,17 @@ Possible values: - 0 for turning off the timer. -Type: [UInt64](../../sql_reference/data_types/int_uint.md). +Type: [UInt64](../../sql-reference/data-types/int-uint.md). Default value: 1000000000 nanoseconds. See also: -- System table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- System table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## allow\_introspection\_functions {#settings-allow_introspection_functions} -Enables of disables [introspections functions](../../sql_reference/functions/introspection.md) for query profiling. +Enables of disables [introspections functions](../../sql-reference/functions/introspection.md) for query profiling. Possible values: @@ -1203,8 +1203,8 @@ Default value: 0. **See Also** -- [Sampling Query Profiler](../optimizing_performance/sampling_query_profiler.md) -- System table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- [Sampling Query Profiler](../optimizing-performance/sampling-query-profiler.md) +- System table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## input\_format\_parallel\_parsing {#input-format-parallel-parsing} @@ -1252,4 +1252,14 @@ Type: URL Default value: Empty +## background\_pool\_size {#background_pool_size} + +Sets the number of threads performing background operations in table engines (for example, merges in [MergeTree engine](../../engines/table-engines/mergetree-family/index.md) tables). This setting is applied at ClickHouse server start and can’t be changed in a user session. By adjusting this setting, you manage CPU and disk load. Smaller pool size utilizes less CPU and disk resources, but background processes advance slower which might eventually impact query performance. + +Possible values: + +- Any positive integer. + +Default value: 16. + [Original article](https://clickhouse.tech/docs/en/operations/settings/settings/) diff --git a/docs/en/operations/settings/settings_users.md b/docs/en/operations/settings/settings_users.md deleted file mode 100644 index 4b398796ea8..00000000000 --- a/docs/en/operations/settings/settings_users.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -toc_priority: 63 -toc_title: User Settings ---- - -# User Settings {#user-settings} - -The `users` section of the `user.xml` configuration file contains user settings. - -Structure of the `users` section: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### user\_name/password {#user-namepassword} - -Password can be specified in plaintext or in SHA256 (hex format). - -- To assign a password in plaintext (**not recommended**), place it in a `password` element. - - For example, `qwerty`. The password can be left blank. - - - -- To assign a password using its SHA256 hash, place it in a `password_sha256_hex` element. - - For example, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - Example of how to generate a password from shell: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - - The first line of the result is the password. The second line is the corresponding SHA256 hash. - - - -- For compatibility with MySQL clients, password can be specified in double SHA1 hash. Place it in `password_double_sha1_hex` element. - - For example, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - Example of how to generate a password from shell: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - - The first line of the result is the password. The second line is the corresponding double SHA1 hash. - -### user\_name/networks {#user-namenetworks} - -List of networks from which the user can connect to the ClickHouse server. - -Each element of the list can have one of the following forms: - -- `` — IP address or network mask. - - Examples: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Hostname. - - Example: `example01.host.ru`. - - To check access, a DNS query is performed, and all returned IP addresses are compared to the peer address. - -- `` — Regular expression for hostnames. - - Example, `^example\d\d-\d\d-\d\.host\.ru$` - - To check access, a [DNS PTR query](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) is performed for the peer address and then the specified regexp is applied. Then, another DNS query is performed for the results of the PTR query and all the received addresses are compared to the peer address. We strongly recommend that regexp ends with $. - -All results of DNS requests are cached until the server restarts. - -**Examples** - -To open access for user from any network, specify: - -``` xml -::/0 -``` - -!!! warning "Warning" - It’s insecure to open access from any network unless you have a firewall properly configured or the server is not directly connected to Internet. - -To open access only from localhost, specify: - -``` xml -::1 -127.0.0.1 -``` - -### user\_name/profile {#user-nameprofile} - -You can assign a settings profile for the user. Settings profiles are configured in a separate section of the `users.xml` file. For more information, see [Profiles of Settings](settings_profiles.md). - -### user\_name/quota {#user-namequota} - -Quotas allow you to track or limit resource usage over a period of time. Quotas are configured in the `quotas` -section of the `users.xml` configuration file. - -You can assign a quotas set for the user. For a detailed description of quotas configuration, see [Quotas](../quotas.md#quotas). - -### user\_name/databases {#user-namedatabases} - -In this section, you can you can limit rows that are returned by ClickHouse for `SELECT` queries made by the current user, thus implementing basic row-level security. - -**Example** - -The following configuration forces that user `user1` can only see the rows of `table1` as the result of `SELECT` queries, where the value of the `id` field is 1000. - -``` xml - - - - - id = 1000 - - - - -``` - -The `filter` can be any expression resulting in a [UInt8](../../sql_reference/data_types/int_uint.md)-type value. It usually contains comparisons and logical operators. Rows from `database_name.table1` where filter results to 0 are not returned for this user. The filtering is incompatible with `PREWHERE` operations and disables `WHERE→PREWHERE` optimization. - -[Original article](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/en/operations/system-tables.md b/docs/en/operations/system-tables.md new file mode 100644 index 00000000000..ac3abdcabaf --- /dev/null +++ b/docs/en/operations/system-tables.md @@ -0,0 +1,1166 @@ +--- +toc_priority: 52 +toc_title: System Tables +--- + +# System Tables {#system-tables} + +System tables are used for implementing part of the system’s functionality, and for providing access to information about how the system is working. +You can’t delete a system table (but you can perform DETACH). +System tables don’t have files with data on the disk or files with metadata. The server creates all the system tables when it starts. +System tables are read-only. +They are located in the ‘system’ database. + +## system.asynchronous\_metrics {#system_tables-asynchronous_metrics} + +Contains metrics that are calculated periodically in the background. For example, the amount of RAM in use. + +Columns: + +- `metric` ([String](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Float64](../sql-reference/data-types/float.md)) — Metric value. + +**Example** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**See Also** + +- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. +- [system.metrics](#system_tables-metrics) — Contains instantly calculated metrics. +- [system.events](#system_tables-events) — Contains a number of events that have occurred. +- [system.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. + +## system.clusters {#system-clusters} + +Contains information about clusters available in the config file and the servers in them. + +Columns: + +- `cluster` (String) — The cluster name. +- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. +- `shard_weight` (UInt32) — The relative weight of the shard when writing data. +- `replica_num` (UInt32) — The replica number in the shard, starting from 1. +- `host_name` (String) — The host name, as specified in the config. +- `host_address` (String) — The host IP address obtained from DNS. +- `port` (UInt16) — The port to use for connecting to the server. +- `user` (String) — The name of the user for connecting to the server. +- `errors_count` (UInt32) - number of times this host failed to reach replica. +- `estimated_recovery_time` (UInt32) - seconds left until replica error count is zeroed and it is considered to be back to normal. + +Please note that `errors_count` is updated once per query to the cluster, but `estimated_recovery_time` is recalculated on-demand. So there could be a case of non-zero `errors_count` and zero `estimated_recovery_time`, that next query will zero `errors_count` and try to use replica as if it has no errors. + +**See also** + +- [Table engine Distributed](../engines/table-engines/special/distributed.md) +- [distributed\_replica\_error\_cap setting](settings/settings.md#settings-distributed_replica_error_cap) +- [distributed\_replica\_error\_half\_life setting](settings/settings.md#settings-distributed_replica_error_half_life) + +## system.columns {#system-columns} + +Contains information about columns in all the tables. + +You can use this table to get information similar to the [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table) query, but for multiple tables at once. + +The `system.columns` table contains the following columns (the column type is shown in brackets): + +- `database` (String) — Database name. +- `table` (String) — Table name. +- `name` (String) — Column name. +- `type` (String) — Column type. +- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) for the default value, or an empty string if it is not defined. +- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. +- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. +- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. +- `marks_bytes` (UInt64) — The size of marks, in bytes. +- `comment` (String) — Comment on the column, or an empty string if it is not defined. +- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. +- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. +- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. +- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. + +## system.contributors {#system-contributors} + +Contains information about contributors. All constributors in random order. The order is random at query execution time. + +Columns: + +- `name` (String) — Contributor (author) name from git log. + +**Example** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +To find out yourself in the table, use a query: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## system.databases {#system-databases} + +This table contains a single String column called ‘name’ – the name of a database. +Each database that the server knows about has a corresponding entry in the table. +This system table is used for implementing the `SHOW DATABASES` query. + +## system.detached\_parts {#system_tables-detached_parts} + +Contains information about detached parts of [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) tables. The `reason` column specifies why the part was detached. For user-detached parts, the reason is empty. Such parts can be attached with [ALTER TABLE ATTACH PARTITION\|PART](../sql-reference/statements/alter.md#alter_attach-partition) command. For the description of other columns, see [system.parts](#system_tables-parts). If part name is invalid, values of some columns may be `NULL`. Such parts can be deleted with [ALTER TABLE DROP DETACHED PART](../sql-reference/statements/alter.md#alter_drop-detached). + +## system.dictionaries {#system_tables-dictionaries} + +Contains information about [external dictionaries](../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +Columns: + +- `database` ([String](../sql-reference/data-types/string.md)) — Name of the database containing the dictionary created by DDL query. Empty string for other dictionaries. +- `name` ([String](../sql-reference/data-types/string.md)) — [Dictionary name](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md). +- `status` ([Enum8](../sql-reference/data-types/enum.md)) — Dictionary status. Possible values: + - `NOT_LOADED` — Dictionary was not loaded because it was not used. + - `LOADED` — Dictionary loaded successfully. + - `FAILED` — Unable to load the dictionary as a result of an error. + - `LOADING` — Dictionary is loading now. + - `LOADED_AND_RELOADING` — Dictionary is loaded successfully, and is being reloaded right now (frequent reasons: [SYSTEM RELOAD DICTIONARY](../sql-reference/statements/system.md#query_language-system-reload-dictionary) query, timeout, dictionary config has changed). + - `FAILED_AND_RELOADING` — Could not load the dictionary as a result of an error and is loading now. +- `origin` ([String](../sql-reference/data-types/string.md)) — Path to the configuration file that describes the dictionary. +- `type` ([String](../sql-reference/data-types/string.md)) — Type of a dictionary allocation. [Storing Dictionaries in Memory](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md). +- `key` — [Key type](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-key): Numeric Key ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) or Сomposite key ([String](../sql-reference/data-types/string.md)) — form “(type 1, type 2, …, type n)”. +- `attribute.names` ([Array](../sql-reference/data-types/array.md)([String](../sql-reference/data-types/string.md))) — Array of [attribute names](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes) provided by the dictionary. +- `attribute.types` ([Array](../sql-reference/data-types/array.md)([String](../sql-reference/data-types/string.md))) — Corresponding array of [attribute types](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes) that are provided by the dictionary. +- `bytes_allocated` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Amount of RAM allocated for the dictionary. +- `query_count` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Number of queries since the dictionary was loaded or since the last successful reboot. +- `hit_rate` ([Float64](../sql-reference/data-types/float.md)) — For cache dictionaries, the percentage of uses for which the value was in the cache. +- `element_count` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Number of items stored in the dictionary. +- `load_factor` ([Float64](../sql-reference/data-types/float.md)) — Percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). +- `source` ([String](../sql-reference/data-types/string.md)) — Text describing the [data source](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md) for the dictionary. +- `lifetime_min` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Minimum [lifetime](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md) of the dictionary in memory, after which ClickHouse tries to reload the dictionary (if `invalidate_query` is set, then only if it has changed). Set in seconds. +- `lifetime_max` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Maximum [lifetime](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md) of the dictionary in memory, after which ClickHouse tries to reload the dictionary (if `invalidate_query` is set, then only if it has changed). Set in seconds. +- `loading_start_time` ([DateTime](../sql-reference/data-types/datetime.md)) — Start time for loading the dictionary. +- `last_successful_update_time` ([DateTime](../sql-reference/data-types/datetime.md)) — End time for loading or updating the dictionary. Helps to monitor some troubles with external sources and investigate causes. +- `loading_duration` ([Float32](../sql-reference/data-types/float.md)) — Duration of a dictionary loading. +- `last_exception` ([String](../sql-reference/data-types/string.md)) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn’t be created. + +**Example** + +Configure the dictionary. + +``` sql +CREATE DICTIONARY dictdb.dict +( + `key` Int64 DEFAULT -1, + `value_default` String DEFAULT 'world', + `value_expression` String DEFAULT 'xxx' EXPRESSION 'toString(127 * 172)' +) +PRIMARY KEY key +SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dicttbl' DB 'dictdb')) +LIFETIME(MIN 0 MAX 1) +LAYOUT(FLAT()) +``` + +Make sure that the dictionary is loaded. + +``` sql +SELECT * FROM system.dictionaries +``` + +``` text +┌─database─┬─name─┬─status─┬─origin──────┬─type─┬─key────┬─attribute.names──────────────────────┬─attribute.types─────┬─bytes_allocated─┬─query_count─┬─hit_rate─┬─element_count─┬───────────load_factor─┬─source─────────────────────┬─lifetime_min─┬─lifetime_max─┬──loading_start_time─┌──last_successful_update_time─┬──────loading_duration─┬─last_exception─┐ +│ dictdb │ dict │ LOADED │ dictdb.dict │ Flat │ UInt64 │ ['value_default','value_expression'] │ ['String','String'] │ 74032 │ 0 │ 1 │ 1 │ 0.0004887585532746823 │ ClickHouse: dictdb.dicttbl │ 0 │ 1 │ 2020-03-04 04:17:34 │ 2020-03-04 04:30:34 │ 0.002 │ │ +└──────────┴──────┴────────┴─────────────┴──────┴────────┴──────────────────────────────────────┴─────────────────────┴─────────────────┴─────────────┴──────────┴───────────────┴───────────────────────┴────────────────────────────┴──────────────┴──────────────┴─────────────────────┴──────────────────────────────┘───────────────────────┴────────────────┘ +``` + +## system.events {#system_tables-events} + +Contains information about the number of events that have occurred in the system. For example, in the table, you can find how many `SELECT` queries were processed since the ClickHouse server started. + +Columns: + +- `event` ([String](../sql-reference/data-types/string.md)) — Event name. +- `value` ([UInt64](../sql-reference/data-types/int-uint.md)) — Number of events occurred. +- `description` ([String](../sql-reference/data-types/string.md)) — Event description. + +**Example** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**See Also** + +- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [system.metrics](#system_tables-metrics) — Contains instantly calculated metrics. +- [system.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. + +## system.functions {#system-functions} + +Contains information about normal and aggregate functions. + +Columns: + +- `name`(`String`) – The name of the function. +- `is_aggregate`(`UInt8`) — Whether the function is aggregate. + +## system.graphite\_retentions {#system-graphite-retentions} + +Contains information about parameters [graphite\_rollup](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) which are used in tables with [\*GraphiteMergeTree](../engines/table-engines/mergetree-family/graphitemergetree.md) engines. + +Columns: + +- `config_name` (String) - `graphite_rollup` parameter name. +- `regexp` (String) - A pattern for the metric name. +- `function` (String) - The name of the aggregating function. +- `age` (UInt64) - The minimum age of the data in seconds. +- `precision` (UInt64) - How precisely to define the age of the data in seconds. +- `priority` (UInt16) - Pattern priority. +- `is_default` (UInt8) - Whether the pattern is the default. +- `Tables.database` (Array(String)) - Array of names of database tables that use the `config_name` parameter. +- `Tables.table` (Array(String)) - Array of table names that use the `config_name` parameter. + +## system.merges {#system-merges} + +Contains information about merges and part mutations currently in process for tables in the MergeTree family. + +Columns: + +- `database` (String) — The name of the database the table is in. +- `table` (String) — Table name. +- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. +- `progress` (Float64) — The percentage of completed work from 0 to 1. +- `num_parts` (UInt64) — The number of pieces to be merged. +- `result_part_name` (String) — The name of the part that will be formed as the result of merging. +- `is_mutation` (UInt8) - 1 if this process is a part mutation. +- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. +- `total_size_marks` (UInt64) — The total number of marks in the merged parts. +- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. +- `rows_read` (UInt64) — Number of rows read. +- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. +- `rows_written` (UInt64) — Number of rows written. + +## system.metrics {#system_tables-metrics} + +Contains metrics which can be calculated instantly, or have a current value. For example, the number of simultaneously processed queries or the current replica delay. This table is always up to date. + +Columns: + +- `metric` ([String](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — Metric value. +- `description` ([String](../sql-reference/data-types/string.md)) — Metric description. + +The list of supported metrics you can find in the [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) source file of ClickHouse. + +**Example** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**See Also** + +- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [system.events](#system_tables-events) — Contains a number of events that occurred. +- [system.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. + +## system.metric\_log {#system_tables-metric_log} + +Contains history of metrics values from tables `system.metrics` and `system.events`, periodically flushed to disk. +To turn on metrics history collection on `system.metric_log`, create `/etc/clickhouse-server/config.d/metric_log.xml` with following content: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**Example** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**See also** + +- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [system.events](#system_tables-events) — Contains a number of events that occurred. +- [system.metrics](#system_tables-metrics) — Contains instantly calculated metrics. +- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. + +## system.numbers {#system-numbers} + +This table contains a single UInt64 column named ‘number’ that contains almost all the natural numbers starting from zero. +You can use this table for tests, or if you need to do a brute force search. +Reads from this table are not parallelized. + +## system.numbers\_mt {#system-numbers-mt} + +The same as ‘system.numbers’ but reads are parallelized. The numbers can be returned in any order. +Used for tests. + +## system.one {#system-one} + +This table contains a single row with a single ‘dummy’ UInt8 column containing the value 0. +This table is used if a SELECT query doesn’t specify the FROM clause. +This is similar to the DUAL table found in other DBMSs. + +## system.parts {#system_tables-parts} + +Contains information about parts of [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) tables. + +Each row describes one data part. + +Columns: + +- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql-reference/statements/alter.md#query_language_queries_alter) query. + + Formats: + + - `YYYYMM` for automatic partitioning by month. + - `any_string` when partitioning manually. + +- `name` (`String`) – Name of the data part. + +- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. + +- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` by the index granularity (usually 8192) (this hint doesn’t work for adaptive granularity). + +- `rows` (`UInt64`) – The number of rows. + +- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. + +- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `marks_bytes` (`UInt64`) – The size of the file with marks. + +- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| + +- `remove_time` (`DateTime`) – The time when the data part became inactive. + +- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. + +- `min_date` (`Date`) – The minimum value of the date key in the data part. + +- `max_date` (`Date`) – The maximum value of the date key in the data part. + +- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. + +- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. + +- `partition_id` (`String`) – ID of the partition. + +- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. + +- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. + +- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. + +- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. + +- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition) + +- `database` (`String`) – Name of the database. + +- `table` (`String`) – Name of the table. + +- `engine` (`String`) – Name of the table engine without parameters. + +- `path` (`String`) – Absolute path to the folder with data part files. + +- `disk` (`String`) – Name of a disk that stores the data part. + +- `hash_of_all_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) of compressed files. + +- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) of uncompressed files (files with marks, index file etc.). + +- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) of data in the compressed files as if they were uncompressed. + +- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. + +- `marks_size` (`UInt64`) – Alias for `marks_bytes`. + +## system.part\_log {#system_tables-part-log} + +The `system.part_log` table is created only if the [part\_log](server-configuration-parameters/settings.md#server_configuration_parameters-part-log) server setting is specified. + +This table contains information about events that occurred with [data parts](../engines/table-engines/mergetree-family/custom-partitioning-key.md) in the [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) family tables, such as adding or merging data. + +The `system.part_log` table contains the following columns: + +- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: + - `NEW_PART` — Inserting of a new data part. + - `MERGE_PARTS` — Merging of data parts. + - `DOWNLOAD_PART` — Downloading a data part. + - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — Mutating of a data part. + - `MOVE_PART` — Moving the data part from the one disk to another one. +- `event_date` (Date) — Event date. +- `event_time` (DateTime) — Event time. +- `duration_ms` (UInt64) — Duration. +- `database` (String) — Name of the database the data part is in. +- `table` (String) — Name of the table the data part is in. +- `part_name` (String) — Name of the data part. +- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ value if the partitioning is by `tuple()`. +- `rows` (UInt64) — The number of rows in the data part. +- `size_in_bytes` (UInt64) — Size of the data part in bytes. +- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). +- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. +- `read_rows` (UInt64) — The number of rows was read during the merge. +- `read_bytes` (UInt64) — The number of bytes was read during the merge. +- `error` (UInt16) — The code number of the occurred error. +- `exception` (String) — Text message of the occurred error. + +The `system.part_log` table is created after the first inserting data to the `MergeTree` table. + +## system.processes {#system_tables-processes} + +This system table is used for implementing the `SHOW PROCESSLIST` query. + +Columns: + +- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` user. The field contains the username for a specific query, not for a query that this query initiated. +- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` on the query requestor server. +- `elapsed` (Float64) – The time in seconds since request execution started. +- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. +- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query-complexity.md#settings_max_memory_usage) setting. +- `query` (String) – The query text. For `INSERT`, it doesn’t include the data to insert. +- `query_id` (String) – Query ID, if defined. + +## system.text\_log {#system-tables-text-log} + +Contains logging entries. Logging level which goes to this table can be limited with `text_log.level` server setting. + +Columns: + +- `event_date` (`Date`) - Date of the entry. +- `event_time` (`DateTime`) - Time of the entry. +- `microseconds` (`UInt32`) - Microseconds of the entry. +- `thread_name` (String) — Name of the thread from which the logging was done. +- `thread_id` (UInt64) — OS thread ID. +- `level` (`Enum8`) - Entry level. + - `'Fatal' = 1` + - `'Critical' = 2` + - `'Error' = 3` + - `'Warning' = 4` + - `'Notice' = 5` + - `'Information' = 6` + - `'Debug' = 7` + - `'Trace' = 8` +- `query_id` (`String`) - ID of the query. +- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) +- `message` (`String`) - The message itself. +- `revision` (`UInt32`) - ClickHouse revision. +- `source_file` (`LowCardinality(String)`) - Source file from which the logging was done. +- `source_line` (`UInt64`) - Source line from which the logging was done. + +## system.query\_log {#system_tables-query_log} + +Contains information about execution of queries. For each query, you can see processing start time, duration of processing, error messages and other information. + +!!! note "Note" + The table doesn’t contain input data for `INSERT` queries. + +ClickHouse creates this table only if the [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) server parameter is specified. This parameter sets the logging rules, such as the logging interval or the name of the table the queries will be logged in. + +To enable query logging, set the [log\_queries](settings/settings.md#settings-log-queries) parameter to 1. For details, see the [Settings](settings/settings.md) section. + +The `system.query_log` table registers two kinds of queries: + +1. Initial queries that were run directly by the client. +2. Child queries that were initiated by other queries (for distributed query execution). For these types of queries, information about the parent queries is shown in the `initial_*` columns. + +Columns: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` queries, the number of written rows. For other queries, the column value is 0. +- `written_bytes` (UInt64) — For `INSERT` queries, the number of written bytes. For other queries, the column value is 0. +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) or another TCP client is run. +- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) or another TCP client name. +- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) or another TCP client version. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` method was used. + - 2 — `POST` method was used. +- `http_user_agent` (String) — The `UserAgent` header passed in the HTTP request. +- `quota_key` (String) — The “quota key” specified in the [quotas](quotas.md) setting (see `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [system.events](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` column. +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parameter to 1. +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` column. + +Each query creates one or two rows in the `query_log` table, depending on the status of the query: + +1. If the query execution is successful, two events with types 1 and 2 are created (see the `type` column). +2. If an error occurred during query processing, two events with types 1 and 4 are created. +3. If an error occurred before launching the query, a single event with type 3 is created. + +By default, logs are added to the table at intervals of 7.5 seconds. You can set this interval in the [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `flush_interval_milliseconds` parameter). To flush the logs forcibly from the memory buffer into the table, use the `SYSTEM FLUSH LOGS` query. + +When the table is deleted manually, it will be automatically created on the fly. Note that all the previous logs will be deleted. + +!!! note "Note" + The storage period for logs is unlimited. Logs aren’t automatically deleted from the table. You need to organize the removal of outdated logs yourself. + +You can specify an arbitrary partitioning key for the `system.query_log` table in the [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `partition_by` parameter). + +## system.query\_thread\_log {#system_tables-query-thread-log} + +The table contains information about each query execution thread. + +ClickHouse creates this table only if the [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) server parameter is specified. This parameter sets the logging rules, such as the logging interval or the name of the table the queries will be logged in. + +To enable query logging, set the [log\_query\_threads](settings/settings.md#settings-log-query-threads) parameter to 1. For details, see the [Settings](settings/settings.md) section. + +Columns: + +- `event_date` (Date) — the date when the thread has finished execution of the query. +- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` queries, the number of written rows. For other queries, the column value is 0. +- `written_bytes` (UInt64) — For `INSERT` queries, the number of written bytes. For other queries, the column value is 0. +- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. +- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. +- `thread_name` (String) — Name of the thread. +- `thread_number` (UInt32) — Internal thread ID. +- `os_thread_id` (Int32) — OS thread ID. +- `master_thread_id` (UInt64) — OS initial ID of initial thread. +- `query` (String) — Query string. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) or another TCP client is run. +- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) or another TCP client name. +- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) or another TCP client version. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` method was used. + - 2 — `POST` method was used. +- `http_user_agent` (String) — The `UserAgent` header passed in the HTTP request. +- `quota_key` (String) — The “quota key” specified in the [quotas](quotas.md) setting (see `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [system.events](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` column. + +By default, logs are added to the table at intervals of 7.5 seconds. You can set this interval in the [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) server setting (see the `flush_interval_milliseconds` parameter). To flush the logs forcibly from the memory buffer into the table, use the `SYSTEM FLUSH LOGS` query. + +When the table is deleted manually, it will be automatically created on the fly. Note that all the previous logs will be deleted. + +!!! note "Note" + The storage period for logs is unlimited. Logs aren’t automatically deleted from the table. You need to organize the removal of outdated logs yourself. + +You can specify an arbitrary partitioning key for the `system.query_thread_log` table in the [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) server setting (see the `partition_by` parameter). + +## system.trace\_log {#system_tables-trace_log} + +Contains stack traces collected by the sampling query profiler. + +ClickHouse creates this table when the [trace\_log](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) server configuration section is set. Also the [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) and [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) settings should be set. + +To analyze logs, use the `addressToLine`, `addressToSymbol` and `demangle` introspection functions. + +Columns: + +- `event_date` ([Date](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time` ([DateTime](../sql-reference/data-types/datetime.md)) — Timestamp of the sampling moment. + +- `timestamp_ns` ([UInt64](../sql-reference/data-types/int-uint.md)) — Timestamp of the sampling moment in nanoseconds. + +- `revision` ([UInt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + When connecting to server by `clickhouse-client`, you see the string similar to `Connected to ClickHouse server version 19.18.1 revision 54429.`. This field contains the `revision`, but not the `version` of a server. + +- `timer_type` ([Enum8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` represents wall-clock time. + - `CPU` represents CPU time. + +- `thread_number` ([UInt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id` ([String](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) system table. + +- `trace` ([Array(UInt64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**Example** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## system.replicas {#system_tables-replicas} + +Contains information and status for replicated tables residing on the local server. +This table can be used for monitoring. The table contains a row for every Replicated\* table. + +Example: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +Columns: + +- `database` (`String`) - Database name +- `table` (`String`) - Table name +- `engine` (`String`) - Table engine name +- `is_leader` (`UInt8`) - Whether the replica is the leader. + Only one replica at a time can be the leader. The leader is responsible for selecting background merges to perform. + Note that writes can be performed to any replica that is available and has a session in ZK, regardless of whether it is a leader. +- `can_become_leader` (`UInt8`) - Whether the replica can be elected as a leader. +- `is_readonly` (`UInt8`) - Whether the replica is in read-only mode. + This mode is turned on if the config doesn’t have sections with ZooKeeper, if an unknown error occurred when reinitializing sessions in ZooKeeper, and during session reinitialization in ZooKeeper. +- `is_session_expired` (`UInt8`) - the session with ZooKeeper has expired. Basically the same as `is_readonly`. +- `future_parts` (`UInt32`) - The number of data parts that will appear as the result of INSERTs or merges that haven’t been done yet. +- `parts_to_check` (`UInt32`) - The number of data parts in the queue for verification. A part is put in the verification queue if there is suspicion that it might be damaged. +- `zookeeper_path` (`String`) - Path to table data in ZooKeeper. +- `replica_name` (`String`) - Replica name in ZooKeeper. Different replicas of the same table have different names. +- `replica_path` (`String`) - Path to replica data in ZooKeeper. The same as concatenating ‘zookeeper\_path/replicas/replica\_path’. +- `columns_version` (`Int32`) - Version number of the table structure. Indicates how many times ALTER was performed. If replicas have different versions, it means some replicas haven’t made all of the ALTERs yet. +- `queue_size` (`UInt32`) - Size of the queue for operations waiting to be performed. Operations include inserting blocks of data, merges, and certain other actions. It usually coincides with `future_parts`. +- `inserts_in_queue` (`UInt32`) - Number of inserts of blocks of data that need to be made. Insertions are usually replicated fairly quickly. If this number is large, it means something is wrong. +- `merges_in_queue` (`UInt32`) - The number of merges waiting to be made. Sometimes merges are lengthy, so this value may be greater than zero for a long time. +- `part_mutations_in_queue` (`UInt32`) - The number of mutations waiting to be made. +- `queue_oldest_time` (`DateTime`) - If `queue_size` greater than 0, shows when the oldest operation was added to the queue. +- `inserts_oldest_time` (`DateTime`) - See `queue_oldest_time` +- `merges_oldest_time` (`DateTime`) - See `queue_oldest_time` +- `part_mutations_oldest_time` (`DateTime`) - See `queue_oldest_time` + +The next 4 columns have a non-zero value only where there is an active session with ZK. + +- `log_max_index` (`UInt64`) - Maximum entry number in the log of general activity. +- `log_pointer` (`UInt64`) - Maximum entry number in the log of general activity that the replica copied to its execution queue, plus one. If `log_pointer` is much smaller than `log_max_index`, something is wrong. +- `last_queue_update` (`DateTime`) - When the queue was updated last time. +- `absolute_delay` (`UInt64`) - How big lag in seconds the current replica has. +- `total_replicas` (`UInt8`) - The total number of known replicas of this table. +- `active_replicas` (`UInt8`) - The number of replicas of this table that have a session in ZooKeeper (i.e., the number of functioning replicas). + +If you request all the columns, the table may work a bit slowly, since several reads from ZooKeeper are made for each row. +If you don’t request the last 4 columns (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), the table works quickly. + +For example, you can check that everything is working correctly like this: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +If this query doesn’t return anything, it means that everything is fine. + +## system.settings {#system-tables-system-settings} + +Contains information about session settings for current user. + +Columns: + +- `name` ([String](../sql-reference/data-types/string.md)) — Setting name. +- `value` ([String](../sql-reference/data-types/string.md)) — Setting value. +- `changed` ([UInt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — Shows whether a setting is changed from its default value. +- `description` ([String](../sql-reference/data-types/string.md)) — Short setting description. +- `min` ([Nullable](../sql-reference/data-types/nullable.md)([String](../sql-reference/data-types/string.md))) — Minimum value of the setting, if any is set via [constraints](settings/constraints-on-settings.md#constraints-on-settings). If the setting has no minimum value, contains [NULL](../sql-reference/syntax.md#null-literal). +- `max` ([Nullable](../sql-reference/data-types/nullable.md)([String](../sql-reference/data-types/string.md))) — Maximum value of the setting, if any is set via [constraints](settings/constraints-on-settings.md#constraints-on-settings). If the setting has no maximum value, contains [NULL](../sql-reference/syntax.md#null-literal). +- `readonly` ([UInt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — Shows whether the current user can change the setting: + - `0` — Current user can change the setting. + - `1` — Current user can’t change the setting. + +**Example** + +The following example shows how to get information about settings which name contains `min_i`. + +``` sql +SELECT * +FROM system.settings +WHERE name LIKE '%min_i%' +``` + +``` text +┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ +│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ +``` + +Using of `WHERE changed` can be useful, for example, when you want to check: + +- Whether settings in configuration files are loaded correctly and are in use. +- Settings that changed in the current session. + + + +``` sql +SELECT * FROM system.settings WHERE changed AND name='load_balancing' +``` + +**See also** + +- [Settings](settings/index.md#settings) +- [Permissions for Queries](settings/permissions-for-queries.md#settings_readonly) +- [Constraints on Settings](settings/constraints-on-settings.md) + +## system.table\_engines {#system.table_engines} + +``` text +┌─name───────────────────┬─value───────┐ +│ max_threads │ 8 │ +│ use_uncompressed_cache │ 0 │ +│ load_balancing │ random │ +│ max_memory_usage │ 10000000000 │ +└────────────────────────┴─────────────┘ +``` + +## system.merge\_tree\_settings {#system-merge_tree_settings} + +Contains information about settings for `MergeTree` tables. + +Columns: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. + +## system.table\_engines {#system-table-engines} + +Contains description of table engines supported by server and their feature support information. + +This table contains the following columns (the column type is shown in brackets): + +- `name` (String) — The name of table engine. +- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` clause. +- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [skipping indices](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` and `SAMPLE_BY`. +- `supports_replication` (UInt8) — Flag that indicates if table engine supports [data replication](../engines/table-engines/mergetree-family/replication.md). +- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. + +Example: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**See also** + +- MergeTree family [query clauses](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) +- Kafka [settings](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) +- Join [settings](../engines/table-engines/special/join.md#join-limitations-and-settings) + +## system.tables {#system-tables} + +Contains metadata of each table that the server knows about. Detached tables are not shown in `system.tables`. + +This table contains the following columns (the column type is shown in brackets): + +- `database` (String) — The name of the database the table is in. + +- `name` (String) — Table name. + +- `engine` (String) — Table engine name (without parameters). + +- `is_temporary` (UInt8) - Flag that indicates whether the table is temporary. + +- `data_path` (String) - Path to the table data in the file system. + +- `metadata_path` (String) - Path to the table metadata in the file system. + +- `metadata_modification_time` (DateTime) - Time of latest modification of the table metadata. + +- `dependencies_database` (Array(String)) - Database dependencies. + +- `dependencies_table` (Array(String)) - Table dependencies ([MaterializedView](../engines/table-engines/special/materializedview.md) tables based on the current table). + +- `create_table_query` (String) - The query that was used to create the table. + +- `engine_full` (String) - Parameters of the table engine. + +- `partition_key` (String) - The partition key expression specified in the table. + +- `sorting_key` (String) - The sorting key expression specified in the table. + +- `primary_key` (String) - The primary key expression specified in the table. + +- `sampling_key` (String) - The sampling key expression specified in the table. + +- `storage_policy` (String) - The storage policy: + + - [MergeTree](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) + - [Distributed](../engines/table-engines/special/distributed.md#distributed) + +- `total_rows` (Nullable(UInt64)) - Total number of rows, if it is possible to quickly determine exact number of rows in the table, otherwise `Null` (including underying `Buffer` table). + +- `total_bytes` (Nullable(UInt64)) - Total number of bytes, if it is possible to quickly determine exact number of bytes for the table on storage, otherwise `Null` (**does not** includes any underlying storage). + + - If the table stores data on disk, returns used space on disk (i.e. compressed). + - If the table stores data in memory, returns approximated number of used bytes in memory. + +The `system.tables` table is used in `SHOW TABLES` query implementation. + +## system.zookeeper {#system-zookeeper} + +The table does not exist if ZooKeeper is not configured. Allows reading data from the ZooKeeper cluster defined in the config. +The query must have a ‘path’ equality condition in the WHERE clause. This is the path in ZooKeeper for the children that you want to get data for. + +The query `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` outputs data for all children on the `/clickhouse` node. +To output data for all root nodes, write path = ‘/’. +If the path specified in ‘path’ doesn’t exist, an exception will be thrown. + +Columns: + +- `name` (String) — The name of the node. +- `path` (String) — The path to the node. +- `value` (String) — Node value. +- `dataLength` (Int32) — Size of the value. +- `numChildren` (Int32) — Number of descendants. +- `czxid` (Int64) — ID of the transaction that created the node. +- `mzxid` (Int64) — ID of the transaction that last changed the node. +- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. +- `ctime` (DateTime) — Time of node creation. +- `mtime` (DateTime) — Time of the last modification of the node. +- `version` (Int32) — Node version: the number of times the node was changed. +- `cversion` (Int32) — Number of added or removed descendants. +- `aversion` (Int32) — Number of changes to the ACL. +- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. + +Example: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## system.mutations {#system_tables-mutations} + +The table contains information about [mutations](../sql-reference/statements/alter.md#alter-mutations) of MergeTree tables and their progress. Each mutation command is represented by a single row. The table has the following columns: + +**database**, **table** - The name of the database and table to which the mutation was applied. + +**mutation\_id** - The ID of the mutation. For replicated tables these IDs correspond to znode names in the `/mutations/` directory in ZooKeeper. For unreplicated tables the IDs correspond to file names in the data directory of the table. + +**command** - The mutation command string (the part of the query after `ALTER TABLE [db.]table`). + +**create\_time** - When this mutation command was submitted for execution. + +**block\_numbers.partition\_id**, **block\_numbers.number** - A nested column. For mutations of replicated tables, it contains one record for each partition: the partition ID and the block number that was acquired by the mutation (in each partition, only parts that contain blocks with numbers less than the block number acquired by the mutation in that partition will be mutated). In non-replicated tables, block numbers in all partitions form a single sequence. This means that for mutations of non-replicated tables, the column will contain one record with a single block number acquired by the mutation. + +**parts\_to\_do** - The number of data parts that need to be mutated for the mutation to finish. + +**is\_done** - Is the mutation done? Note that even if `parts_to_do = 0` it is possible that a mutation of a replicated table is not done yet because of a long-running INSERT that will create a new data part that will need to be mutated. + +If there were problems with mutating some parts, the following columns contain additional information: + +**latest\_failed\_part** - The name of the most recent part that could not be mutated. + +**latest\_fail\_time** - The time of the most recent part mutation failure. + +**latest\_fail\_reason** - The exception message that caused the most recent part mutation failure. + +## system.disks {#system_tables-disks} + +Contains information about disks defined in the [server configuration](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Columns: + +- `name` ([String](../sql-reference/data-types/string.md)) — Name of a disk in the server configuration. +- `path` ([String](../sql-reference/data-types/string.md)) — Path to the mount point in the file system. +- `free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Free space on disk in bytes. +- `total_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Disk volume in bytes. +- `keep_free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` parameter of disk configuration. + +## system.storage\_policies {#system_tables-storage_policies} + +Contains information about storage policies and volumes defined in the [server configuration](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Columns: + +- `policy_name` ([String](../sql-reference/data-types/string.md)) — Name of the storage policy. +- `volume_name` ([String](../sql-reference/data-types/string.md)) — Volume name defined in the storage policy. +- `volume_priority` ([UInt64](../sql-reference/data-types/int-uint.md)) — Volume order number in the configuration. +- `disks` ([Array(String)](../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. +- `max_data_part_size` ([UInt64](../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). +- `move_factor` ([Float64](../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. + +If the storage policy contains more then one volume, then information for each volume is stored in the individual row of the table. + +[Original article](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/en/operations/system_tables.md b/docs/en/operations/system_tables.md deleted file mode 100644 index 22e688c59cd..00000000000 --- a/docs/en/operations/system_tables.md +++ /dev/null @@ -1,1167 +0,0 @@ ---- -toc_priority: 52 -toc_title: System Tables ---- - -# System Tables {#system-tables} - -System tables are used for implementing part of the system’s functionality, and for providing access to information about how the system is working. -You can’t delete a system table (but you can perform DETACH). -System tables don’t have files with data on the disk or files with metadata. The server creates all the system tables when it starts. -System tables are read-only. -They are located in the ‘system’ database. - -## system.asynchronous\_metrics {#system_tables-asynchronous_metrics} - -Contains metrics that are calculated periodically in the background. For example, the amount of RAM in use. - -Columns: - -- `metric` ([String](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Float64](../sql_reference/data_types/float.md)) — Metric value. - -**Example** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**See Also** - -- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. -- [system.metrics](#system_tables-metrics) — Contains instantly calculated metrics. -- [system.events](#system_tables-events) — Contains a number of events that have occurred. -- [system.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. - -## system.clusters {#system-clusters} - -Contains information about clusters available in the config file and the servers in them. - -Columns: - -- `cluster` (String) — The cluster name. -- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. -- `shard_weight` (UInt32) — The relative weight of the shard when writing data. -- `replica_num` (UInt32) — The replica number in the shard, starting from 1. -- `host_name` (String) — The host name, as specified in the config. -- `host_address` (String) — The host IP address obtained from DNS. -- `port` (UInt16) — The port to use for connecting to the server. -- `user` (String) — The name of the user for connecting to the server. -- `errors_count` (UInt32) - number of times this host failed to reach replica. -- `estimated_recovery_time` (UInt32) - seconds left until replica error count is zeroed and it is considered to be back to normal. - -Please note that `errors_count` is updated once per query to the cluster, but `estimated_recovery_time` is recalculated on-demand. So there could be a case of non-zero `errors_count` and zero `estimated_recovery_time`, that next query will zero `errors_count` and try to use replica as if it has no errors. - -**See also** - -- [Table engine Distributed](../engines/table_engines/special/distributed.md) -- [distributed\_replica\_error\_cap setting](settings/settings.md#settings-distributed_replica_error_cap) -- [distributed\_replica\_error\_half\_life setting](settings/settings.md#settings-distributed_replica_error_half_life) - -## system.columns {#system-columns} - -Contains information about columns in all the tables. - -You can use this table to get information similar to the [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table) query, but for multiple tables at once. - -The `system.columns` table contains the following columns (the column type is shown in brackets): - -- `database` (String) — Database name. -- `table` (String) — Table name. -- `name` (String) — Column name. -- `type` (String) — Column type. -- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) for the default value, or an empty string if it is not defined. -- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. -- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. -- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. -- `marks_bytes` (UInt64) — The size of marks, in bytes. -- `comment` (String) — Comment on the column, or an empty string if it is not defined. -- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. -- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. -- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. -- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. - -## system.contributors {#system-contributors} - -Contains information about contributors. All constributors in random order. The order is random at query execution time. - -Columns: - -- `name` (String) — Contributor (author) name from git log. - -**Example** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -To find out yourself in the table, use a query: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## system.databases {#system-databases} - -This table contains a single String column called ‘name’ – the name of a database. -Each database that the server knows about has a corresponding entry in the table. -This system table is used for implementing the `SHOW DATABASES` query. - -## system.detached\_parts {#system_tables-detached_parts} - -Contains information about detached parts of [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) tables. The `reason` column specifies why the part was detached. For user-detached parts, the reason is empty. Such parts can be attached with [ALTER TABLE ATTACH PARTITION\|PART](../sql_reference/statements/alter.md#alter_attach-partition) command. For the description of other columns, see [system.parts](#system_tables-parts). If part name is invalid, values of some columns may be `NULL`. Such parts can be deleted with [ALTER TABLE DROP DETACHED PART](../sql_reference/statements/alter.md#alter_drop-detached). - -## system.dictionaries {#system_tables-dictionaries} - -Contains information about [external dictionaries](../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -Columns: - -- `database` ([String](../sql_reference/data_types/string.md)) — Name of the database containing the dictionary created by DDL query. Empty string for other dictionaries. -- `name` ([String](../sql_reference/data_types/string.md)) — [Dictionary name](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md). -- `status` ([Enum8](../sql_reference/data_types/enum.md)) — Dictionary status. Possible values: - - `NOT_LOADED` — Dictionary was not loaded because it was not used. - - `LOADED` — Dictionary loaded successfully. - - `FAILED` — Unable to load the dictionary as a result of an error. - - `LOADING` — Dictionary is loading now. - - `LOADED_AND_RELOADING` — Dictionary is loaded successfully, and is being reloaded right now (frequent reasons: [SYSTEM RELOAD DICTIONARY](../sql_reference/statements/system.md#query_language-system-reload-dictionary) query, timeout, dictionary config has changed). - - `FAILED_AND_RELOADING` — Could not load the dictionary as a result of an error and is loading now. -- `origin` ([String](../sql_reference/data_types/string.md)) — Path to the configuration file that describes the dictionary. -- `type` ([String](../sql_reference/data_types/string.md)) — Type of a dictionary allocation. [Storing Dictionaries in Memory](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md). -- `key` — [Key type](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-key): Numeric Key ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) or Сomposite key ([String](../sql_reference/data_types/string.md)) — form "(type 1, type 2, ..., type n)". -- `attribute.names` ([Array](../sql_reference/data_types/array.md)([String](../sql_reference/data_types/string.md))) — Array of [attribute names](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes) provided by the dictionary. -- `attribute.types` ([Array](../sql_reference/data_types/array.md)([String](../sql_reference/data_types/string.md))) — Corresponding array of [attribute types](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes) that are provided by the dictionary. -- `bytes_allocated` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Amount of RAM allocated for the dictionary. -- `query_count` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Number of queries since the dictionary was loaded or since the last successful reboot. -- `hit_rate` ([Float64](../sql_reference/data_types/float.md)) — For cache dictionaries, the percentage of uses for which the value was in the cache. -- `element_count` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Number of items stored in the dictionary. -- `load_factor` ([Float64](../sql_reference/data_types/float.md)) — Percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). -- `source` ([String](../sql_reference/data_types/string.md)) — Text describing the [data source](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md) for the dictionary. -- `lifetime_min` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Minimum [lifetime](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md) of the dictionary in memory, after which ClickHouse tries to reload the dictionary (if `invalidate_query` is set, then only if it has changed). Set in seconds. -- `lifetime_max` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Maximum [lifetime](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md) of the dictionary in memory, after which ClickHouse tries to reload the dictionary (if `invalidate_query` is set, then only if it has changed). Set in seconds. -- `loading_start_time` ([DateTime](../sql_reference/data_types/datetime.md)) — Start time for loading the dictionary. -- `last_successful_update_time` ([DateTime](../sql_reference/data_types/datetime.md)) — End time for loading or updating the dictionary. Helps to monitor some troubles with external sources and investigate causes. -- `loading_duration` ([Float32](../sql_reference/data_types/float.md)) — Duration of a dictionary loading. -- `last_exception` ([String](../sql_reference/data_types/string.md)) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn't be created. - - -**Example** - -Configure the dictionary. - -```sql -CREATE DICTIONARY dictdb.dict -( - `key` Int64 DEFAULT -1, - `value_default` String DEFAULT 'world', - `value_expression` String DEFAULT 'xxx' EXPRESSION 'toString(127 * 172)' -) -PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dicttbl' DB 'dictdb')) -LIFETIME(MIN 0 MAX 1) -LAYOUT(FLAT()) -``` - -Make sure that the dictionary is loaded. - -```sql -SELECT * FROM system.dictionaries -``` - -```text -┌─database─┬─name─┬─status─┬─origin──────┬─type─┬─key────┬─attribute.names──────────────────────┬─attribute.types─────┬─bytes_allocated─┬─query_count─┬─hit_rate─┬─element_count─┬───────────load_factor─┬─source─────────────────────┬─lifetime_min─┬─lifetime_max─┬──loading_start_time─┌──last_successful_update_time─┬──────loading_duration─┬─last_exception─┐ -│ dictdb │ dict │ LOADED │ dictdb.dict │ Flat │ UInt64 │ ['value_default','value_expression'] │ ['String','String'] │ 74032 │ 0 │ 1 │ 1 │ 0.0004887585532746823 │ ClickHouse: dictdb.dicttbl │ 0 │ 1 │ 2020-03-04 04:17:34 │ 2020-03-04 04:30:34 │ 0.002 │ │ -└──────────┴──────┴────────┴─────────────┴──────┴────────┴──────────────────────────────────────┴─────────────────────┴─────────────────┴─────────────┴──────────┴───────────────┴───────────────────────┴────────────────────────────┴──────────────┴──────────────┴─────────────────────┴──────────────────────────────┘───────────────────────┴────────────────┘ -``` - -## system.events {#system_tables-events} - -Contains information about the number of events that have occurred in the system. For example, in the table, you can find how many `SELECT` queries were processed since the ClickHouse server started. - -Columns: - -- `event` ([String](../sql_reference/data_types/string.md)) — Event name. -- `value` ([UInt64](../sql_reference/data_types/int_uint.md)) — Number of events occurred. -- `description` ([String](../sql_reference/data_types/string.md)) — Event description. - -**Example** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**See Also** - -- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [system.metrics](#system_tables-metrics) — Contains instantly calculated metrics. -- [system.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. - -## system.functions {#system-functions} - -Contains information about normal and aggregate functions. - -Columns: - -- `name`(`String`) – The name of the function. -- `is_aggregate`(`UInt8`) — Whether the function is aggregate. - -## system.graphite\_retentions {#system-graphite-retentions} - -Contains information about parameters [graphite\_rollup](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) which are used in tables with [\*GraphiteMergeTree](../engines/table_engines/mergetree_family/graphitemergetree.md) engines. - -Columns: - -- `config_name` (String) - `graphite_rollup` parameter name. -- `regexp` (String) - A pattern for the metric name. -- `function` (String) - The name of the aggregating function. -- `age` (UInt64) - The minimum age of the data in seconds. -- `precision` (UInt64) - How precisely to define the age of the data in seconds. -- `priority` (UInt16) - Pattern priority. -- `is_default` (UInt8) - Whether the pattern is the default. -- `Tables.database` (Array(String)) - Array of names of database tables that use the `config_name` parameter. -- `Tables.table` (Array(String)) - Array of table names that use the `config_name` parameter. - -## system.merges {#system-merges} - -Contains information about merges and part mutations currently in process for tables in the MergeTree family. - -Columns: - -- `database` (String) — The name of the database the table is in. -- `table` (String) — Table name. -- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. -- `progress` (Float64) — The percentage of completed work from 0 to 1. -- `num_parts` (UInt64) — The number of pieces to be merged. -- `result_part_name` (String) — The name of the part that will be formed as the result of merging. -- `is_mutation` (UInt8) - 1 if this process is a part mutation. -- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. -- `total_size_marks` (UInt64) — The total number of marks in the merged parts. -- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. -- `rows_read` (UInt64) — Number of rows read. -- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. -- `rows_written` (UInt64) — Number of rows written. - -## system.metrics {#system_tables-metrics} - -Contains metrics which can be calculated instantly, or have a current value. For example, the number of simultaneously processed queries or the current replica delay. This table is always up to date. - -Columns: - -- `metric` ([String](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — Metric value. -- `description` ([String](../sql_reference/data_types/string.md)) — Metric description. - -The list of supported metrics you can find in the [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) source file of ClickHouse. - -**Example** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**See Also** - -- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [system.events](#system_tables-events) — Contains a number of events that occurred. -- [system.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. - -## system.metric\_log {#system_tables-metric_log} - -Contains history of metrics values from tables `system.metrics` and `system.events`, periodically flushed to disk. -To turn on metrics history collection on `system.metric_log`, create `/etc/clickhouse-server/config.d/metric_log.xml` with following content: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**Example** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**See also** - -- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [system.events](#system_tables-events) — Contains a number of events that occurred. -- [system.metrics](#system_tables-metrics) — Contains instantly calculated metrics. -- [Monitoring](monitoring.md) — Base concepts of ClickHouse monitoring. - -## system.numbers {#system-numbers} - -This table contains a single UInt64 column named ‘number’ that contains almost all the natural numbers starting from zero. -You can use this table for tests, or if you need to do a brute force search. -Reads from this table are not parallelized. - -## system.numbers\_mt {#system-numbers-mt} - -The same as ‘system.numbers’ but reads are parallelized. The numbers can be returned in any order. -Used for tests. - -## system.one {#system-one} - -This table contains a single row with a single ‘dummy’ UInt8 column containing the value 0. -This table is used if a SELECT query doesn’t specify the FROM clause. -This is similar to the DUAL table found in other DBMSs. - -## system.parts {#system_tables-parts} - -Contains information about parts of [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) tables. - -Each row describes one data part. - -Columns: - -- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql_reference/statements/alter.md#query_language_queries_alter) query. - - Formats: - - - `YYYYMM` for automatic partitioning by month. - - `any_string` when partitioning manually. - -- `name` (`String`) – Name of the data part. - -- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. - -- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` by the index granularity (usually 8192) (this hint doesn’t work for adaptive granularity). - -- `rows` (`UInt64`) – The number of rows. - -- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. - -- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `marks_bytes` (`UInt64`) – The size of the file with marks. - -- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| - -- `remove_time` (`DateTime`) – The time when the data part became inactive. - -- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. - -- `min_date` (`Date`) – The minimum value of the date key in the data part. - -- `max_date` (`Date`) – The maximum value of the date key in the data part. - -- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. - -- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. - -- `partition_id` (`String`) – ID of the partition. - -- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. - -- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. - -- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. - -- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. - -- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition) - -- `database` (`String`) – Name of the database. - -- `table` (`String`) – Name of the table. - -- `engine` (`String`) – Name of the table engine without parameters. - -- `path` (`String`) – Absolute path to the folder with data part files. - -- `disk` (`String`) – Name of a disk that stores the data part. - -- `hash_of_all_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) of compressed files. - -- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) of uncompressed files (files with marks, index file etc.). - -- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) of data in the compressed files as if they were uncompressed. - -- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. - -- `marks_size` (`UInt64`) – Alias for `marks_bytes`. - -## system.part\_log {#system_tables-part-log} - -The `system.part_log` table is created only if the [part\_log](server_configuration_parameters/settings.md#server_configuration_parameters-part-log) server setting is specified. - -This table contains information about events that occurred with [data parts](../engines/table_engines/mergetree_family/custom_partitioning_key.md) in the [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) family tables, such as adding or merging data. - -The `system.part_log` table contains the following columns: - -- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: - - `NEW_PART` — Inserting of a new data part. - - `MERGE_PARTS` — Merging of data parts. - - `DOWNLOAD_PART` — Downloading a data part. - - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — Mutating of a data part. - - `MOVE_PART` — Moving the data part from the one disk to another one. -- `event_date` (Date) — Event date. -- `event_time` (DateTime) — Event time. -- `duration_ms` (UInt64) — Duration. -- `database` (String) — Name of the database the data part is in. -- `table` (String) — Name of the table the data part is in. -- `part_name` (String) — Name of the data part. -- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ value if the partitioning is by `tuple()`. -- `rows` (UInt64) — The number of rows in the data part. -- `size_in_bytes` (UInt64) — Size of the data part in bytes. -- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). -- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. -- `read_rows` (UInt64) — The number of rows was read during the merge. -- `read_bytes` (UInt64) — The number of bytes was read during the merge. -- `error` (UInt16) — The code number of the occurred error. -- `exception` (String) — Text message of the occurred error. - -The `system.part_log` table is created after the first inserting data to the `MergeTree` table. - -## system.processes {#system_tables-processes} - -This system table is used for implementing the `SHOW PROCESSLIST` query. - -Columns: - -- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` user. The field contains the username for a specific query, not for a query that this query initiated. -- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` on the query requestor server. -- `elapsed` (Float64) – The time in seconds since request execution started. -- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. -- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query_complexity.md#settings_max_memory_usage) setting. -- `query` (String) – The query text. For `INSERT`, it doesn’t include the data to insert. -- `query_id` (String) – Query ID, if defined. - -## system.text\_log {#system-tables-text-log} - -Contains logging entries. Logging level which goes to this table can be limited with `text_log.level` server setting. - -Columns: - -- `event_date` (`Date`) - Date of the entry. -- `event_time` (`DateTime`) - Time of the entry. -- `microseconds` (`UInt32`) - Microseconds of the entry. -- `thread_name` (String) — Name of the thread from which the logging was done. -- `thread_id` (UInt64) — OS thread ID. -- `level` (`Enum8`) - Entry level. - - `'Fatal' = 1` - - `'Critical' = 2` - - `'Error' = 3` - - `'Warning' = 4` - - `'Notice' = 5` - - `'Information' = 6` - - `'Debug' = 7` - - `'Trace' = 8` -- `query_id` (`String`) - ID of the query. -- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) -- `message` (`String`) - The message itself. -- `revision` (`UInt32`) - ClickHouse revision. -- `source_file` (`LowCardinality(String)`) - Source file from which the logging was done. -- `source_line` (`UInt64`) - Source line from which the logging was done. - -## system.query\_log {#system_tables-query_log} - -Contains information about execution of queries. For each query, you can see processing start time, duration of processing, error messages and other information. - -!!! note "Note" - The table doesn’t contain input data for `INSERT` queries. - -ClickHouse creates this table only if the [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) server parameter is specified. This parameter sets the logging rules, such as the logging interval or the name of the table the queries will be logged in. - -To enable query logging, set the [log\_queries](settings/settings.md#settings-log-queries) parameter to 1. For details, see the [Settings](settings/settings.md) section. - -The `system.query_log` table registers two kinds of queries: - -1. Initial queries that were run directly by the client. -2. Child queries that were initiated by other queries (for distributed query execution). For these types of queries, information about the parent queries is shown in the `initial_*` columns. - -Columns: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` queries, the number of written rows. For other queries, the column value is 0. -- `written_bytes` (UInt64) — For `INSERT` queries, the number of written bytes. For other queries, the column value is 0. -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) or another TCP client is run. -- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) or another TCP client name. -- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) or another TCP client version. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` method was used. - - 2 — `POST` method was used. -- `http_user_agent` (String) — The `UserAgent` header passed in the HTTP request. -- `quota_key` (String) — The “quota key” specified in the [quotas](quotas.md) setting (see `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [system.events](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` column. -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parameter to 1. -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` column. - -Each query creates one or two rows in the `query_log` table, depending on the status of the query: - -1. If the query execution is successful, two events with types 1 and 2 are created (see the `type` column). -2. If an error occurred during query processing, two events with types 1 and 4 are created. -3. If an error occurred before launching the query, a single event with type 3 is created. - -By default, logs are added to the table at intervals of 7.5 seconds. You can set this interval in the [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `flush_interval_milliseconds` parameter). To flush the logs forcibly from the memory buffer into the table, use the `SYSTEM FLUSH LOGS` query. - -When the table is deleted manually, it will be automatically created on the fly. Note that all the previous logs will be deleted. - -!!! note "Note" - The storage period for logs is unlimited. Logs aren’t automatically deleted from the table. You need to organize the removal of outdated logs yourself. - -You can specify an arbitrary partitioning key for the `system.query_log` table in the [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `partition_by` parameter). - -## system.query\_thread\_log {#system_tables-query-thread-log} - -The table contains information about each query execution thread. - -ClickHouse creates this table only if the [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) server parameter is specified. This parameter sets the logging rules, such as the logging interval or the name of the table the queries will be logged in. - -To enable query logging, set the [log\_query\_threads](settings/settings.md#settings-log-query-threads) parameter to 1. For details, see the [Settings](settings/settings.md) section. - -Columns: - -- `event_date` (Date) — the date when the thread has finished execution of the query. -- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` queries, the number of written rows. For other queries, the column value is 0. -- `written_bytes` (UInt64) — For `INSERT` queries, the number of written bytes. For other queries, the column value is 0. -- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. -- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. -- `thread_name` (String) — Name of the thread. -- `thread_number` (UInt32) — Internal thread ID. -- `os_thread_id` (Int32) — OS thread ID. -- `master_thread_id` (UInt64) — OS initial ID of initial thread. -- `query` (String) — Query string. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) or another TCP client is run. -- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) or another TCP client name. -- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) or another TCP client version. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` method was used. - - 2 — `POST` method was used. -- `http_user_agent` (String) — The `UserAgent` header passed in the HTTP request. -- `quota_key` (String) — The “quota key” specified in the [quotas](quotas.md) setting (see `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [system.events](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` column. - -By default, logs are added to the table at intervals of 7.5 seconds. You can set this interval in the [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) server setting (see the `flush_interval_milliseconds` parameter). To flush the logs forcibly from the memory buffer into the table, use the `SYSTEM FLUSH LOGS` query. - -When the table is deleted manually, it will be automatically created on the fly. Note that all the previous logs will be deleted. - -!!! note "Note" - The storage period for logs is unlimited. Logs aren’t automatically deleted from the table. You need to organize the removal of outdated logs yourself. - -You can specify an arbitrary partitioning key for the `system.query_thread_log` table in the [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) server setting (see the `partition_by` parameter). - -## system.trace_log {#system_tables-trace_log} - -Contains stack traces collected by the sampling query profiler. - -ClickHouse creates this table when the [trace\_log](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) server configuration section is set. Also the [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) and [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) settings should be set. - -To analyze logs, use the `addressToLine`, `addressToSymbol` and `demangle` introspection functions. - -Columns: - -- `event_date` ([Date](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time` ([DateTime](../sql_reference/data_types/datetime.md)) — Timestamp of the sampling moment. - -- `timestamp_ns` ([UInt64](../sql_reference/data_types/int_uint.md)) — Timestamp of the sampling moment in nanoseconds. - -- `revision` ([UInt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - When connecting to server by `clickhouse-client`, you see the string similar to `Connected to ClickHouse server version 19.18.1 revision 54429.`. This field contains the `revision`, but not the `version` of a server. - -- `timer_type` ([Enum8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` represents wall-clock time. - - `CPU` represents CPU time. - -- `thread_number` ([UInt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id` ([String](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) system table. - -- `trace` ([Array(UInt64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**Example** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## system.replicas {#system_tables-replicas} - -Contains information and status for replicated tables residing on the local server. -This table can be used for monitoring. The table contains a row for every Replicated\* table. - -Example: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -Columns: - -- `database` (`String`) - Database name -- `table` (`String`) - Table name -- `engine` (`String`) - Table engine name -- `is_leader` (`UInt8`) - Whether the replica is the leader. - Only one replica at a time can be the leader. The leader is responsible for selecting background merges to perform. - Note that writes can be performed to any replica that is available and has a session in ZK, regardless of whether it is a leader. -- `can_become_leader` (`UInt8`) - Whether the replica can be elected as a leader. -- `is_readonly` (`UInt8`) - Whether the replica is in read-only mode. - This mode is turned on if the config doesn’t have sections with ZooKeeper, if an unknown error occurred when reinitializing sessions in ZooKeeper, and during session reinitialization in ZooKeeper. -- `is_session_expired` (`UInt8`) - the session with ZooKeeper has expired. Basically the same as `is_readonly`. -- `future_parts` (`UInt32`) - The number of data parts that will appear as the result of INSERTs or merges that haven’t been done yet. -- `parts_to_check` (`UInt32`) - The number of data parts in the queue for verification. A part is put in the verification queue if there is suspicion that it might be damaged. -- `zookeeper_path` (`String`) - Path to table data in ZooKeeper. -- `replica_name` (`String`) - Replica name in ZooKeeper. Different replicas of the same table have different names. -- `replica_path` (`String`) - Path to replica data in ZooKeeper. The same as concatenating ‘zookeeper\_path/replicas/replica\_path’. -- `columns_version` (`Int32`) - Version number of the table structure. Indicates how many times ALTER was performed. If replicas have different versions, it means some replicas haven’t made all of the ALTERs yet. -- `queue_size` (`UInt32`) - Size of the queue for operations waiting to be performed. Operations include inserting blocks of data, merges, and certain other actions. It usually coincides with `future_parts`. -- `inserts_in_queue` (`UInt32`) - Number of inserts of blocks of data that need to be made. Insertions are usually replicated fairly quickly. If this number is large, it means something is wrong. -- `merges_in_queue` (`UInt32`) - The number of merges waiting to be made. Sometimes merges are lengthy, so this value may be greater than zero for a long time. -- `part_mutations_in_queue` (`UInt32`) - The number of mutations waiting to be made. -- `queue_oldest_time` (`DateTime`) - If `queue_size` greater than 0, shows when the oldest operation was added to the queue. -- `inserts_oldest_time` (`DateTime`) - See `queue_oldest_time` -- `merges_oldest_time` (`DateTime`) - See `queue_oldest_time` -- `part_mutations_oldest_time` (`DateTime`) - See `queue_oldest_time` - -The next 4 columns have a non-zero value only where there is an active session with ZK. - -- `log_max_index` (`UInt64`) - Maximum entry number in the log of general activity. -- `log_pointer` (`UInt64`) - Maximum entry number in the log of general activity that the replica copied to its execution queue, plus one. If `log_pointer` is much smaller than `log_max_index`, something is wrong. -- `last_queue_update` (`DateTime`) - When the queue was updated last time. -- `absolute_delay` (`UInt64`) - How big lag in seconds the current replica has. -- `total_replicas` (`UInt8`) - The total number of known replicas of this table. -- `active_replicas` (`UInt8`) - The number of replicas of this table that have a session in ZooKeeper (i.e., the number of functioning replicas). - -If you request all the columns, the table may work a bit slowly, since several reads from ZooKeeper are made for each row. -If you don’t request the last 4 columns (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), the table works quickly. - -For example, you can check that everything is working correctly like this: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -If this query doesn’t return anything, it means that everything is fine. - -## system.settings {#system-tables-system-settings} - -Contains information about session settings for current user. - -Columns: - -- `name` ([String](../sql_reference/data_types/string.md)) — Setting name. -- `value` ([String](../sql_reference/data_types/string.md)) — Setting value. -- `changed` ([UInt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — Shows whether a setting is changed from its default value. -- `description` ([String](../sql_reference/data_types/string.md)) — Short setting description. -- `min` ([Nullable](../sql_reference/data_types/nullable.md)([String](../sql_reference/data_types/string.md))) — Minimum value of the setting, if any is set via [constraints](settings/constraints_on_settings.md#constraints-on-settings). If the setting has no minimum value, contains [NULL](../sql_reference/syntax.md#null-literal). -- `max` ([Nullable](../sql_reference/data_types/nullable.md)([String](../sql_reference/data_types/string.md))) — Maximum value of the setting, if any is set via [constraints](settings/constraints_on_settings.md#constraints-on-settings). If the setting has no maximum value, contains [NULL](../sql_reference/syntax.md#null-literal). -- `readonly` ([UInt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — Shows whether the current user can change the setting: - - `0` — Current user can change the setting. - - `1` — Current user can’t change the setting. - -**Example** - -The following example shows how to get information about settings which name contains `min_i`. - -``` sql -SELECT * -FROM system.settings -WHERE name LIKE '%min_i%' -``` - -``` text -┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ -│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ -``` - -Using of `WHERE changed` can be useful, for example, when you want to check: - -- Whether settings in configuration files are loaded correctly and are in use. -- Settings that changed in the current session. - - - -``` sql -SELECT * FROM system.settings WHERE changed AND name='load_balancing' -``` - -**See also** - -- [Settings](settings/index.md#settings) -- [Permissions for Queries](settings/permissions_for_queries.md#settings_readonly) -- [Constraints on Settings](settings/constraints_on_settings.md) - -## system.table\_engines {#system.table_engines} - -``` text -┌─name───────────────────┬─value───────┐ -│ max_threads │ 8 │ -│ use_uncompressed_cache │ 0 │ -│ load_balancing │ random │ -│ max_memory_usage │ 10000000000 │ -└────────────────────────┴─────────────┘ -``` - -## system.merge\_tree\_settings {#system-merge_tree_settings} - -Contains information about settings for `MergeTree` tables. - -Columns: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. - -## system.table\_engines {#system-table-engines} - -Contains description of table engines supported by server and their feature support information. - -This table contains the following columns (the column type is shown in brackets): - -- `name` (String) — The name of table engine. -- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` clause. -- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [skipping indices](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` and `SAMPLE_BY`. -- `supports_replication` (UInt8) — Flag that indicates if table engine supports [data replication](../engines/table_engines/mergetree_family/replication.md). -- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. - -Example: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**See also** - -- MergeTree family [query clauses](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) -- Kafka [settings](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) -- Join [settings](../engines/table_engines/special/join.md#join-limitations-and-settings) - -## system.tables {#system-tables} - -Contains metadata of each table that the server knows about. Detached tables are not shown in `system.tables`. - -This table contains the following columns (the column type is shown in brackets): - -- `database` (String) — The name of the database the table is in. - -- `name` (String) — Table name. - -- `engine` (String) — Table engine name (without parameters). - -- `is_temporary` (UInt8) - Flag that indicates whether the table is temporary. - -- `data_path` (String) - Path to the table data in the file system. - -- `metadata_path` (String) - Path to the table metadata in the file system. - -- `metadata_modification_time` (DateTime) - Time of latest modification of the table metadata. - -- `dependencies_database` (Array(String)) - Database dependencies. - -- `dependencies_table` (Array(String)) - Table dependencies ([MaterializedView](../engines/table_engines/special/materializedview.md) tables based on the current table). - -- `create_table_query` (String) - The query that was used to create the table. - -- `engine_full` (String) - Parameters of the table engine. - -- `partition_key` (String) - The partition key expression specified in the table. - -- `sorting_key` (String) - The sorting key expression specified in the table. - -- `primary_key` (String) - The primary key expression specified in the table. - -- `sampling_key` (String) - The sampling key expression specified in the table. - -- `storage_policy` (String) - The storage policy: - - - [MergeTree](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) - - [Distributed](../engines/table_engines/special/distributed.md#distributed) - -- `total_rows` (Nullable(UInt64)) - Total number of rows, if it is possible to quickly determine exact number of rows in the table, otherwise `Null` (including underying `Buffer` table). - -- `total_bytes` (Nullable(UInt64)) - Total number of bytes, if it is possible to quickly determine exact number of bytes for the table on storage, otherwise `Null` (**does not** includes any underlying storage). - - - If the table stores data on disk, returns used space on disk (i.e. compressed). - - If the table stores data in memory, returns approximated number of used bytes in memory. - -The `system.tables` table is used in `SHOW TABLES` query implementation. - -## system.zookeeper {#system-zookeeper} - -The table does not exist if ZooKeeper is not configured. Allows reading data from the ZooKeeper cluster defined in the config. -The query must have a ‘path’ equality condition in the WHERE clause. This is the path in ZooKeeper for the children that you want to get data for. - -The query `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` outputs data for all children on the `/clickhouse` node. -To output data for all root nodes, write path = ‘/’. -If the path specified in ‘path’ doesn’t exist, an exception will be thrown. - -Columns: - -- `name` (String) — The name of the node. -- `path` (String) — The path to the node. -- `value` (String) — Node value. -- `dataLength` (Int32) — Size of the value. -- `numChildren` (Int32) — Number of descendants. -- `czxid` (Int64) — ID of the transaction that created the node. -- `mzxid` (Int64) — ID of the transaction that last changed the node. -- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. -- `ctime` (DateTime) — Time of node creation. -- `mtime` (DateTime) — Time of the last modification of the node. -- `version` (Int32) — Node version: the number of times the node was changed. -- `cversion` (Int32) — Number of added or removed descendants. -- `aversion` (Int32) — Number of changes to the ACL. -- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. - -Example: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## system.mutations {#system_tables-mutations} - -The table contains information about [mutations](../sql_reference/statements/alter.md#alter-mutations) of MergeTree tables and their progress. Each mutation command is represented by a single row. The table has the following columns: - -**database**, **table** - The name of the database and table to which the mutation was applied. - -**mutation\_id** - The ID of the mutation. For replicated tables these IDs correspond to znode names in the `/mutations/` directory in ZooKeeper. For unreplicated tables the IDs correspond to file names in the data directory of the table. - -**command** - The mutation command string (the part of the query after `ALTER TABLE [db.]table`). - -**create\_time** - When this mutation command was submitted for execution. - -**block\_numbers.partition\_id**, **block\_numbers.number** - A nested column. For mutations of replicated tables, it contains one record for each partition: the partition ID and the block number that was acquired by the mutation (in each partition, only parts that contain blocks with numbers less than the block number acquired by the mutation in that partition will be mutated). In non-replicated tables, block numbers in all partitions form a single sequence. This means that for mutations of non-replicated tables, the column will contain one record with a single block number acquired by the mutation. - -**parts\_to\_do** - The number of data parts that need to be mutated for the mutation to finish. - -**is\_done** - Is the mutation done? Note that even if `parts_to_do = 0` it is possible that a mutation of a replicated table is not done yet because of a long-running INSERT that will create a new data part that will need to be mutated. - -If there were problems with mutating some parts, the following columns contain additional information: - -**latest\_failed\_part** - The name of the most recent part that could not be mutated. - -**latest\_fail\_time** - The time of the most recent part mutation failure. - -**latest\_fail\_reason** - The exception message that caused the most recent part mutation failure. - -## system.disks {#system_tables-disks} - -Contains information about disks defined in the [server configuration](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Columns: - -- `name` ([String](../sql_reference/data_types/string.md)) — Name of a disk in the server configuration. -- `path` ([String](../sql_reference/data_types/string.md)) — Path to the mount point in the file system. -- `free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Free space on disk in bytes. -- `total_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Disk volume in bytes. -- `keep_free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` parameter of disk configuration. - -## system.storage\_policies {#system_tables-storage_policies} - -Contains information about storage policies and volumes defined in the [server configuration](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Columns: - -- `policy_name` ([String](../sql_reference/data_types/string.md)) — Name of the storage policy. -- `volume_name` ([String](../sql_reference/data_types/string.md)) — Volume name defined in the storage policy. -- `volume_priority` ([UInt64](../sql_reference/data_types/int_uint.md)) — Volume order number in the configuration. -- `disks` ([Array(String)](../sql_reference/data_types/array.md)) — Disk names, defined in the storage policy. -- `max_data_part_size` ([UInt64](../sql_reference/data_types/int_uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). -- `move_factor` ([Float64](../sql_reference/data_types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. - -If the storage policy contains more then one volume, then information for each volume is stored in the individual row of the table. - -[Original article](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/en/operations/troubleshooting.md b/docs/en/operations/troubleshooting.md index b6afedfca7e..cb7c81fffa8 100644 --- a/docs/en/operations/troubleshooting.md +++ b/docs/en/operations/troubleshooting.md @@ -15,7 +15,7 @@ toc_title: Troubleshooting ### You Cannot Get Deb Packages from ClickHouse Repository with Apt-get {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} - Check firewall settings. -- If you cannot access the repository for any reason, download packages as described in the [Getting started](../getting_started/index.md) article and install them manually using the `sudo dpkg -i ` command. You will also need the `tzdata` package. +- If you cannot access the repository for any reason, download packages as described in the [Getting started](../getting-started/index.md) article and install them manually using the `sudo dpkg -i ` command. You will also need the `tzdata` package. ## Connecting to the Server {#troubleshooting-accepts-no-connections} @@ -103,7 +103,7 @@ Check: - Endpoint settings. - Check [listen\_host](server_configuration_parameters/settings.md#server_configuration_parameters-listen_host) and [tcp\_port](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port) settings. + Check [listen\_host](server-configuration-parameters/settings.md#server_configuration_parameters-listen_host) and [tcp\_port](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port) settings. ClickHouse server accepts localhost connections only by default. @@ -115,8 +115,8 @@ Check: Check: - - The [tcp\_port\_secure](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) setting. - - Settings for [SSL sertificates](server_configuration_parameters/settings.md#server_configuration_parameters-openssl). + - The [tcp\_port\_secure](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) setting. + - Settings for [SSL sertificates](server-configuration-parameters/settings.md#server_configuration_parameters-openssl). Use proper parameters while connecting. For example, use the `port_secure` parameter with `clickhouse_client`. diff --git a/docs/en/operations/utilities/clickhouse-benchmark.md b/docs/en/operations/utilities/clickhouse-benchmark.md index 8435e37b4b5..ab67ca197dd 100644 --- a/docs/en/operations/utilities/clickhouse-benchmark.md +++ b/docs/en/operations/utilities/clickhouse-benchmark.md @@ -97,7 +97,7 @@ In the report you can find: - Percentiles of queries execution time. -## Comparison mode {#clickhouse-benchmark-comparison-mode} +## Comparison Mode {#clickhouse-benchmark-comparison-mode} `clickhouse-benchmark` can compare performances for two running ClickHouse servers. diff --git a/docs/en/operations/utilities/clickhouse-copier.md b/docs/en/operations/utilities/clickhouse-copier.md index d519940b8d9..ab3b49523d2 100644 --- a/docs/en/operations/utilities/clickhouse-copier.md +++ b/docs/en/operations/utilities/clickhouse-copier.md @@ -24,7 +24,7 @@ After starting, `clickhouse-copier`: To reduce network traffic, we recommend running `clickhouse-copier` on the same server where the source data is located. -## Running clickhouse-copier {#running-clickhouse-copier} +## Running Clickhouse-copier {#running-clickhouse-copier} The utility should be run manually: @@ -41,7 +41,7 @@ Parameters: - `task-upload-force` — Force upload `task-file` even if node already exists. - `base-dir` — The path to logs and auxiliary files. When it starts, `clickhouse-copier` creates `clickhouse-copier_YYYYMMHHSS_` subdirectories in `$base-dir`. If this parameter is omitted, the directories are created in the directory where `clickhouse-copier` was launched. -## Format of zookeeper.xml {#format-of-zookeeper-xml} +## Format of Zookeeper.xml {#format-of-zookeeper-xml} ``` xml @@ -60,7 +60,7 @@ Parameters: ``` -## Configuration of copying tasks {#configuration-of-copying-tasks} +## Configuration of Copying Tasks {#configuration-of-copying-tasks} ``` xml diff --git a/docs/en/operations/utilities/clickhouse-local.md b/docs/en/operations/utilities/clickhouse-local.md index 38f28b432a3..8aa0560f5d1 100644 --- a/docs/en/operations/utilities/clickhouse-local.md +++ b/docs/en/operations/utilities/clickhouse-local.md @@ -7,7 +7,7 @@ toc_title: clickhouse-local The `clickhouse-local` program enables you to perform fast processing on local files, without having to deploy and configure the ClickHouse server. -Accepts data that represent tables and queries them using [ClickHouse SQL dialect](../../sql_reference/index.md). +Accepts data that represent tables and queries them using [ClickHouse SQL dialect](../../sql-reference/index.md). `clickhouse-local` uses the same core as ClickHouse server, so it supports most of the features and the same set of formats and table engines. diff --git a/docs/en/sql-reference/aggregate-functions/combinators.md b/docs/en/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..785eafb8e96 --- /dev/null +++ b/docs/en/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,164 @@ +--- +toc_priority: 37 +toc_title: Aggregate function combinators +--- + +# Aggregate Function Combinators {#aggregate_functions_combinators} + +The name of an aggregate function can have a suffix appended to it. This changes the way the aggregate function works. + +## -If {#agg-functions-combinator-if} + +The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). + +Examples: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` and so on. + +With conditional aggregate functions, you can calculate aggregates for several conditions at once, without using subqueries and `JOIN`s. For example, in Yandex.Metrica, conditional aggregate functions are used to implement the segment comparison functionality. + +## -Array {#agg-functions-combinator-array} + +The -Array suffix can be appended to any aggregate function. In this case, the aggregate function takes arguments of the ‘Array(T)’ type (arrays) instead of ‘T’ type arguments. If the aggregate function accepts multiple arguments, this must be arrays of equal lengths. When processing arrays, the aggregate function works like the original aggregate function across all array elements. + +Example 1: `sumArray(arr)` - Totals all the elements of all ‘arr’ arrays. In this example, it could have been written more simply: `sum(arraySum(arr))`. + +Example 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ arrays. This could be done an easier way: `uniq(arrayJoin(arr))`, but it’s not always possible to add ‘arrayJoin’ to a query. + +-If and -Array can be combined. However, ‘Array’ must come first, then ‘If’. Examples: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. Due to this order, the ‘cond’ argument won’t be an array. + +## -State {#agg-functions-combinator-state} + +If you apply this combinator, the aggregate function doesn’t return the resulting value (such as the number of unique values for the [uniq](reference.md#agg_function-uniq) function), but an intermediate state of the aggregation (for `uniq`, this is the hash table for calculating the number of unique values). This is an `AggregateFunction(...)` that can be used for further processing or stored in a table to finish aggregating later. + +To work with these states, use: + +- [AggregatingMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) table engine. +- [finalizeAggregation](../../sql-reference/functions/other-functions.md#function-finalizeaggregation) function. +- [runningAccumulate](../../sql-reference/functions/other-functions.md#function-runningaccumulate) function. +- [-Merge](#aggregate_functions_combinators_merge) combinator. +- [-MergeState](#aggregate_functions_combinators_mergestate) combinator. + +## -Merge {#aggregate_functions_combinators-merge} + +If you apply this combinator, the aggregate function takes the intermediate aggregation state as an argument, combines the states to finish aggregation, and returns the resulting value. + +## -MergeState {#aggregate_functions_combinators-mergestate} + +Merges the intermediate aggregation states in the same way as the -Merge combinator. However, it doesn’t return the resulting value, but an intermediate aggregation state, similar to the -State combinator. + +## -ForEach {#agg-functions-combinator-foreach} + +Converts an aggregate function for tables into an aggregate function for arrays that aggregates the corresponding array items and returns an array of results. For example, `sumForEach` for the arrays `[1, 2]`, `[3, 4, 5]`and`[6, 7]`returns the result `[10, 13, 5]` after adding together the corresponding array items. + +## -OrDefault {#agg-functions-combinator-ordefault} + +Fills the default value of the aggregate function’s return type if there is nothing to aggregate. + +``` sql +SELECT avg(number), avgOrDefault(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrDefault(number)─┐ +│ nan │ 0 │ +└─────────────┴──────────────────────┘ +``` + +## -OrNull {#agg-functions-combinator-ornull} + +Fills `null` if there is nothing to aggregate. The return column will be nullable. + +``` sql +SELECT avg(number), avgOrNull(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrNull(number)─┐ +│ nan │ ᴺᵁᴸᴸ │ +└─────────────┴───────────────────┘ +``` + +-OrDefault and -OrNull can be combined with other combinators. It is useful when the aggregate function does not accept the empty input. + +``` sql +SELECT avgOrNullIf(x, x > 10) +FROM +( + SELECT toDecimal32(1.23, 2) AS x +) +``` + +``` text +┌─avgOrNullIf(x, greater(x, 10))─┐ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────┘ +``` + +## -Resample {#agg-functions-combinator-resample} + +Lets you divide data into groups, and then separately aggregates the data in those groups. Groups are created by splitting the values from one column into intervals. + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**Parameters** + +- `start` — Starting value of the whole required interval for `resampling_key` values. +- `stop` — Ending value of the whole required interval for `resampling_key` values. The whole interval doesn’t include the `stop` value `[start, stop)`. +- `step` — Step for separating the whole interval into subintervals. The `aggFunction` is executed over each of those subintervals independently. +- `resampling_key` — Column whose values are used for separating data into intervals. +- `aggFunction_params` — `aggFunction` parameters. + +**Returned values** + +- Array of `aggFunction` results for each subinterval. + +**Example** + +Consider the `people` table with the following data: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +Let’s get the names of the people whose age lies in the intervals of `[30,60)` and `[60,75)`. Since we use integer representation for age, we get ages in the `[30, 59]` and `[60,74]` intervals. + +To aggregate names in an array, we use the [groupArray](reference.md#agg_function-grouparray) aggregate function. It takes one argument. In our case, it’s the `name` column. The `groupArrayResample` function should use the `age` column to aggregate names by age. To define the required intervals, we pass the `30, 75, 30` arguments into the `groupArrayResample` function. + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) FROM people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +Consider the results. + +`Jonh` is out of the sample because he’s too young. Other people are distributed according to the specified age intervals. + +Now let’s count the total number of people and their average wage in the specified age intervals. + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[Original article](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/en/sql-reference/aggregate-functions/index.md b/docs/en/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..aa1045b123c --- /dev/null +++ b/docs/en/sql-reference/aggregate-functions/index.md @@ -0,0 +1,60 @@ +--- +toc_folder_title: Aggregate Functions +toc_priority: 33 +toc_title: Introduction +--- + +# Aggregate Functions {#aggregate-functions} + +Aggregate functions work in the [normal](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) way as expected by database experts. + +ClickHouse also supports: + +- [Parametric aggregate functions](parametric-functions.md#aggregate_functions_parametric), which accept other parameters in addition to columns. +- [Combinators](combinators.md#aggregate_functions_combinators), which change the behavior of aggregate functions. + +## NULL Processing {#null-processing} + +During aggregation, all `NULL`s are skipped. + +**Examples:** + +Consider this table: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +Let’s say you need to total the values in the `y` column: + +``` sql +SELECT sum(y) FROM t_null_big +``` + + ┌─sum(y)─┐ + │ 7 │ + └────────┘ + +The `sum` function interprets `NULL` as `0`. In particular, this means that if the function receives input of a selection where all the values are `NULL`, then the result will be `0`, not `NULL`. + +Now you can use the `groupArray` function to create an array from the `y` column: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` does not include `NULL` in the resulting array. + +[Original article](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/en/sql-reference/aggregate-functions/parametric-functions.md b/docs/en/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..01516a4bf51 --- /dev/null +++ b/docs/en/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,497 @@ +--- +toc_priority: 38 +toc_title: Parametric aggregate functions +--- + +# Parametric Aggregate Functions {#aggregate_functions_parametric} + +Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. + +## histogram {#histogram} + +Calculates an adaptive histogram. It doesn’t guarantee precise results. + +``` sql +histogram(number_of_bins)(values) +``` + +The functions uses [A Streaming Parallel Decision Tree Algorithm](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). The borders of histogram bins are adjusted as new data enters a function. In common case, the widths of bins are not equal. + +**Parameters** + +`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. +`values` — [Expression](../syntax.md#syntax-expressions) resulting in input values. + +**Returned values** + +- [Array](../../sql-reference/data-types/array.md) of [Tuples](../../sql-reference/data-types/tuple.md) of the following format: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — Lower bound of the bin. + - `upper` — Upper bound of the bin. + - `height` — Calculated height of the bin. + +**Example** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +You can visualize a histogram with the [bar](../../sql-reference/functions/other-functions.md#function-bar) function, for example: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +In this case, you should remember that you don’t know the histogram bin borders. + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +Checks whether the sequence contains an event chain that matches the pattern. + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "Warning" + Events that occur at the same second may lay in the sequence in an undefined order affecting the result. + +**Parameters** + +- `pattern` — Pattern string. See [Pattern syntax](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` and `DateTime`. You can also use any of the supported [UInt](../../sql-reference/data-types/int-uint.md) data types. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. You can pass up to 32 condition arguments. The function takes only the events described in these conditions into account. If the sequence contains data that isn’t described in a condition, the function skips them. + +**Returned values** + +- 1, if the pattern is matched. +- 0, if the pattern isn’t matched. + +Type: `UInt8`. + + +**Pattern syntax** + +- `(?N)` — Matches the condition argument at position `N`. Conditions are numbered in the `[1, 32]` range. For example, `(?1)` matches the argument passed to the `cond1` parameter. + +- `.*` — Matches any number of events. You don’t need conditional arguments to match this element of the pattern. + +- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` matches events that occur more than 1800 seconds from each other. An arbitrary number of any events can lay between these events. You can use the `>=`, `>`, `<`, `<=` operators. + +**Examples** + +Consider data in the `t` table: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +Perform the query: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +The function found the event chain where number 2 follows number 1. It skipped number 3 between them, because the number is not described as an event. If we want to take this number into account when searching for the event chain given in the example, we should make a condition for it. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +In this case, the function couldn’t find the event chain matching the pattern, because the event for number 3 occured between 1 and 2. If in the same case we checked the condition for number 4, the sequence would match the pattern. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**See Also** + +- [sequenceCount](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +Counts the number of event chains that matched the pattern. The function searches event chains that don’t overlap. It starts to search for the next chain after the current chain is matched. + +!!! warning "Warning" + Events that occur at the same second may lay in the sequence in an undefined order affecting the result. + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**Parameters** + +- `pattern` — Pattern string. See [Pattern syntax](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` and `DateTime`. You can also use any of the supported [UInt](../../sql-reference/data-types/int-uint.md) data types. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. You can pass up to 32 condition arguments. The function takes only the events described in these conditions into account. If the sequence contains data that isn’t described in a condition, the function skips them. + +**Returned values** + +- Number of non-overlapping event chains that are matched. + +Type: `UInt64`. + +**Example** + +Consider data in the `t` table: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +Count how many times the number 2 occurs after the number 1 with any amount of other numbers between them: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**See Also** + +- [sequenceMatch](#function-sequencematch) + +## windowFunnel {#windowfunnel} + +Searches for event chains in a sliding time window and calculates the maximum number of events that occurred from the chain. + +The function works according to the algorithm: + +- The function searches for data that triggers the first condition in the chain and sets the event counter to 1. This is the moment when the sliding window starts. + +- If events from the chain occur sequentially within the window, the counter is incremented. If the sequence of events is disrupted, the counter isn’t incremented. + +- If the data has multiple event chains at varying points of completion, the function will only output the size of the longest chain. + +**Syntax** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**Parameters** + +- `window` — Length of the sliding window in seconds. +- `mode` - It is an optional argument. + - `'strict'` - When the `'strict'` is set, the windowFunnel() applies conditions only for the unique values. +- `timestamp` — Name of the column containing the timestamp. Data types supported: [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) and other unsigned integer types (note that even though timestamp supports the `UInt64` type, it’s value can’t exceed the Int64 maximum, which is 2^63 - 1). +- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql-reference/data-types/int-uint.md). + +**Returned value** + +The maximum number of consecutive triggered conditions from the chain within the sliding time window. +All the chains in the selection are analyzed. + +Type: `Integer`. + +**Example** + +Determine if a set period of time is enough for the user to select a phone and purchase it twice in the online store. + +Set the following chain of events: + +1. The user logged in to their account on the store (`eventID = 1003`). +2. The user searches for a phone (`eventID = 1007, product = 'phone'`). +3. The user placed an order (`eventID = 1009`). +4. The user made the order again (`eventID = 1010`). + +Input table: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +Find out how far the user `user_id` could get through the chain in a period in January-February of 2019. + +Query: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +Result: + +``` text +┌─level─┬─c─┐ +│ 4 │ 1 │ +└───────┴───┘ +``` + +## retention {#retention} + +The function takes as arguments a set of conditions from 1 to 32 arguments of type `UInt8` that indicate whether a certain condition was met for the event. +Any condition can be specified as an argument (as in [WHERE](../../sql-reference/statements/select.md#select-where)). + +The conditions, except the first, apply in pairs: the result of the second will be true if the first and second are true, of the third if the first and fird are true, etc. + +**Syntax** + +``` sql +retention(cond1, cond2, ..., cond32); +``` + +**Parameters** + +- `cond` — an expression that returns a `UInt8` result (1 or 0). + +**Returned value** + +The array of 1 or 0. + +- 1 — condition was met for the event. +- 0 — condition wasn’t met for the event. + +Type: `UInt8`. + +**Example** + +Let’s consider an example of calculating the `retention` function to determine site traffic. + +**1.** Сreate a table to illustrate an example. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +Input table: + +Query: + +``` sql +SELECT * FROM retention_test +``` + +Result: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** Group users by unique ID `uid` using the `retention` function. + +Query: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +Result: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** Calculate the total number of site visits per day. + +Query: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +Result: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +Where: + +- `r1`- the number of unique visitors who visited the site during 2020-01-01 (the `cond1` condition). +- `r2`- the number of unique visitors who visited the site during a specific time period between 2020-01-01 and 2020-01-02 (`cond1` and `cond2` conditions). +- `r3`- the number of unique visitors who visited the site during a specific time period between 2020-01-01 and 2020-01-03 (`cond1` and `cond3` conditions). + +## uniqUpTo(N)(x) {#uniquptonx} + +Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. + +Recommended for use with small Ns, up to 10. The maximum value of N is 100. + +For the state of an aggregate function, it uses the amount of memory equal to 1 + N \* the size of one value of bytes. +For strings, it stores a non-cryptographic hash of 8 bytes. That is, the calculation is approximated for strings. + +The function also works for several arguments. + +It works as fast as possible, except for cases when a large N value is used and the number of unique values is slightly less than N. + +Usage example: + +``` text +Problem: Generate a report that shows only keywords that produced at least 5 unique users. +Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[Original article](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) + +## sumMapFiltered(keys\_to\_keep)(keys, values) {#summapfilteredkeys-to-keepkeys-values} + +Same behavior as [sumMap](reference.md#agg_functions-summap) except that an array of keys is passed as a parameter. This can be especially useful when working with a high cardinality of keys. diff --git a/docs/en/sql-reference/aggregate-functions/reference.md b/docs/en/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..9c8b5917e51 --- /dev/null +++ b/docs/en/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1880 @@ +--- +toc_priority: 36 +toc_title: Reference +--- + +# Function Reference {#function-reference} + +## count {#agg_function-count} + +Counts the number of rows or not-NULL values. + +ClickHouse supports the following syntaxes for `count`: +- `count(expr)` or `COUNT(DISTINCT expr)`. +- `count()` or `COUNT(*)`. The `count()` syntax is ClickHouse-specific. + +**Parameters** + +The function can take: + +- Zero parameters. +- One [expression](../syntax.md#syntax-expressions). + +**Returned value** + +- If the function is called without parameters it counts the number of rows. +- If the [expression](../syntax.md#syntax-expressions) is passed, then the function counts how many times this expression returned not null. If the expression returns a [Nullable](../../sql-reference/data-types/nullable.md)-type value, then the result of `count` stays not `Nullable`. The function returns 0 if the expression returned `NULL` for all the rows. + +In both cases the type of the returned value is [UInt64](../../sql-reference/data-types/int-uint.md). + +**Details** + +ClickHouse supports the `COUNT(DISTINCT ...)` syntax. The behavior of this construction depends on the [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) setting. It defines which of the [uniq\*](#agg_function-uniq) functions is used to perform the operation. The default is the [uniqExact](#agg_function-uniqexact) function. + +The `SELECT count() FROM table` query is not optimized, because the number of entries in the table is not stored separately. It chooses a small column from the table and counts the number of values in it. + +**Examples** + +Example 1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +Example 2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +This example shows that `count(DISTINCT num)` is performed by the `uniqExact` function according to the `count_distinct_implementation` setting value. + +## any(x) {#agg_function-any} + +Selects the first encountered value. +The query can be executed in any order and even in a different order each time, so the result of this function is indeterminate. +To get a determinate result, you can use the ‘min’ or ‘max’ function instead of ‘any’. + +In some cases, you can rely on the order of execution. This applies to cases when SELECT comes from a subquery that uses ORDER BY. + +When a `SELECT` query has the `GROUP BY` clause or at least one aggregate function, ClickHouse (in contrast to MySQL) requires that all expressions in the `SELECT`, `HAVING`, and `ORDER BY` clauses be calculated from keys or from aggregate functions. In other words, each column selected from the table must be used either in keys or inside aggregate functions. To get behavior like in MySQL, you can put the other columns in the `any` aggregate function. + +## anyHeavy(x) {#anyheavyx} + +Selects a frequently occurring value using the [heavy hitters](http://www.cs.umd.edu/~samir/498/karp.pdf) algorithm. If there is a value that occurs more than in half the cases in each of the query’s execution threads, this value is returned. Normally, the result is nondeterministic. + +``` sql +anyHeavy(column) +``` + +**Arguments** + +- `column` – The column name. + +**Example** + +Take the [OnTime](../../getting-started/example-datasets/ontime.md) data set and select any frequently occurring value in the `AirlineID` column. + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## anyLast(x) {#anylastx} + +Selects the last value encountered. +The result is just as indeterminate as for the `any` function. + +## groupBitAnd {#groupbitand} + +Applies bitwise `AND` for series of numbers. + +``` sql +groupBitAnd(expr) +``` + +**Parameters** + +`expr` – An expression that results in `UInt*` type. + +**Return value** + +Value of the `UInt*` type. + +**Example** + +Test data: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Query: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +Where `num` is the column with the test data. + +Result: + +``` text +binary decimal +00000100 = 4 +``` + +## groupBitOr {#groupbitor} + +Applies bitwise `OR` for series of numbers. + +``` sql +groupBitOr(expr) +``` + +**Parameters** + +`expr` – An expression that results in `UInt*` type. + +**Return value** + +Value of the `UInt*` type. + +**Example** + +Test data: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Query: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +Where `num` is the column with the test data. + +Result: + +``` text +binary decimal +01111101 = 125 +``` + +## groupBitXor {#groupbitxor} + +Applies bitwise `XOR` for series of numbers. + +``` sql +groupBitXor(expr) +``` + +**Parameters** + +`expr` – An expression that results in `UInt*` type. + +**Return value** + +Value of the `UInt*` type. + +**Example** + +Test data: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Query: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +Where `num` is the column with the test data. + +Result: + +``` text +binary decimal +01101000 = 104 +``` + +## groupBitmap {#groupbitmap} + +Bitmap or Aggregate calculations from a unsigned integer column, return cardinality of type UInt64, if add suffix -State, then return [bitmap object](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmap(expr) +``` + +**Parameters** + +`expr` – An expression that results in `UInt*` type. + +**Return value** + +Value of the `UInt64` type. + +**Example** + +Test data: + +``` text +UserID +1 +1 +2 +3 +``` + +Query: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +Result: + +``` text +num +3 +``` + +## min(x) {#agg_function-min} + +Calculates the minimum. + +## max(x) {#agg_function-max} + +Calculates the maximum. + +## argMin(arg, val) {#agg-function-argmin} + +Calculates the ‘arg’ value for a minimal ‘val’ value. If there are several different values of ‘arg’ for minimal values of ‘val’, the first of these values encountered is output. + +**Example:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## argMax(arg, val) {#agg-function-argmax} + +Calculates the ‘arg’ value for a maximum ‘val’ value. If there are several different values of ‘arg’ for maximum values of ‘val’, the first of these values encountered is output. + +## sum(x) {#agg_function-sum} + +Calculates the sum. +Only works for numbers. + +## sumWithOverflow(x) {#sumwithoverflowx} + +Computes the sum of the numbers, using the same data type for the result as for the input parameters. If the sum exceeds the maximum value for this data type, the function returns an error. + +Only works for numbers. + +## sumMap(key, value), sumMap(Tuple(key, value)) {#agg_functions-summap} + +Totals the ‘value’ array according to the keys specified in the ‘key’ array. +Passing tuple of keys and values arrays is synonymical to passing two arrays of keys and values. +The number of elements in ‘key’ and ‘value’ must be the same for each row that is totaled. +Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. + +Example: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ), + statusMapTuple Tuple(Array(Int32), Array(Int32)) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10], ([1, 2, 3], [10, 10, 10])), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10], ([3, 4, 5], [10, 10, 10])), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10], ([4, 5, 6], [10, 10, 10])), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10], ([6, 7, 8], [10, 10, 10])); + +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests), + sumMap(statusMapTuple) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┬─sumMap(statusMapTuple)─────────┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┴────────────────────────────────┘ +``` + +## skewPop {#skewpop} + +Computes the [skewness](https://en.wikipedia.org/wiki/Skewness) of a sequence. + +``` sql +skewPop(expr) +``` + +**Parameters** + +`expr` — [Expression](../syntax.md#syntax-expressions) returning a number. + +**Returned value** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Example** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## skewSamp {#skewsamp} + +Computes the [sample skewness](https://en.wikipedia.org/wiki/Skewness) of a sequence. + +It represents an unbiased estimate of the skewness of a random variable if passed values form its sample. + +``` sql +skewSamp(expr) +``` + +**Parameters** + +`expr` — [Expression](../syntax.md#syntax-expressions) returning a number. + +**Returned value** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). If `n <= 1` (`n` is the size of the sample), then the function returns `nan`. + +**Example** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## kurtPop {#kurtpop} + +Computes the [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) of a sequence. + +``` sql +kurtPop(expr) +``` + +**Parameters** + +`expr` — [Expression](../syntax.md#syntax-expressions) returning a number. + +**Returned value** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Example** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## kurtSamp {#kurtsamp} + +Computes the [sample kurtosis](https://en.wikipedia.org/wiki/Kurtosis) of a sequence. + +It represents an unbiased estimate of the kurtosis of a random variable if passed values form its sample. + +``` sql +kurtSamp(expr) +``` + +**Parameters** + +`expr` — [Expression](../syntax.md#syntax-expressions) returning a number. + +**Returned value** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). If `n <= 1` (`n` is a size of the sample), then the function returns `nan`. + +**Example** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## timeSeriesGroupSum(uid, timestamp, value) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` can aggregate different time series that sample timestamp not alignment. +It will use linear interpolation between two sample timestamp and then sum time-series together. + +- `uid` is the time series unique id, `UInt64`. +- `timestamp` is Int64 type in order to support millisecond or microsecond. +- `value` is the metric. + +The function returns array of tuples with `(timestamp, aggregated_value)` pairs. + +Before using this function make sure `timestamp` is in ascending order. + +Example: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +And the result will be: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## timeSeriesGroupRateSum(uid, ts, val) {#agg-function-timeseriesgroupratesum} + +Similarly timeSeriesGroupRateSum, timeSeriesGroupRateSum will Calculate the rate of time-series and then sum rates together. +Also, timestamp should be in ascend order before use this function. + +Use this function, the result above case will be: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## avg(x) {#agg_function-avg} + +Calculates the average. +Only works for numbers. +The result is always Float64. + +## avgWeighted {#avgweighted} + +Calculates the [weighted arithmetic mean](https://en.wikipedia.org/wiki/Weighted_arithmetic_mean). + +**Syntax** + +``` sql +avgWeighted(x, weight) +``` + +**Parameters** + +- `x` — Values. [Integer](../data-types/int-uint.md) or [floating-point](../data-types/float.md). +- `weight` — Weights of the values. [Integer](../data-types/int-uint.md) or [floating-point](../data-types/float.md). + +Type of `x` and `weight` must be the same. + +**Returned value** + +- Weighted mean. +- `NaN`. If all the weights are equal to 0. + +Type: [Float64](../data-types/float.md). + +**Example** + +Query: + +``` sql +SELECT avgWeighted(x, w) +FROM values('x Int8, w Int8', (4, 1), (1, 0), (10, 2)) +``` + +Result: + +``` text +┌─avgWeighted(x, weight)─┐ +│ 8 │ +└────────────────────────┘ +``` + +## uniq {#agg_function-uniq} + +Calculates the approximate number of different values of the argument. + +``` sql +uniq(x[, ...]) +``` + +**Parameters** + +The function takes a variable number of parameters. Parameters can be `Tuple`, `Array`, `Date`, `DateTime`, `String`, or numeric types. + +**Returned value** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-type number. + +**Implementation details** + +Function: + +- Calculates a hash for all parameters in the aggregate, then uses it in calculations. + +- Uses an adaptive sampling algorithm. For the calculation state, the function uses a sample of element hash values up to 65536. + + This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. + +- Provides the result deterministically (it doesn’t depend on the query processing order). + +We recommend using this function in almost all scenarios. + +**See Also** + +- [uniqCombined](#agg_function-uniqcombined) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined {#agg_function-uniqcombined} + +Calculates the approximate number of different argument values. + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +The `uniqCombined` function is a good choice for calculating the number of different values. + +**Parameters** + +The function takes a variable number of parameters. Parameters can be `Tuple`, `Array`, `Date`, `DateTime`, `String`, or numeric types. + +`HLL_precision` is the base-2 logarithm of the number of cells in [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). Optional, you can use the function as `uniqCombined(x[, ...])`. The default value for `HLL_precision` is 17, which is effectively 96 KiB of space (2^17 cells, 6 bits each). + +**Returned value** + +- A number [UInt64](../../sql-reference/data-types/int-uint.md)-type number. + +**Implementation details** + +Function: + +- Calculates a hash (64-bit hash for `String` and 32-bit otherwise) for all parameters in the aggregate, then uses it in calculations. + +- Uses a combination of three algorithms: array, hash table, and HyperLogLog with an error correction table. + + For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. + +- Provides the result deterministically (it doesn’t depend on the query processing order). + +!!! note "Note" + Since it uses 32-bit hash for non-`String` type, the result will have very high error for cardinalities significantly larger than `UINT_MAX` (error will raise quickly after a few tens of billions of distinct values), hence in this case you should use [uniqCombined64](#agg_function-uniqcombined64) + +Compared to the [uniq](#agg_function-uniq) function, the `uniqCombined`: + +- Consumes several times less memory. +- Calculates with several times higher accuracy. +- Usually has slightly lower performance. In some scenarios, `uniqCombined` can perform better than `uniq`, for example, with distributed queries that transmit a large number of aggregation states over the network. + +**See Also** + +- [uniq](#agg_function-uniq) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined64 {#agg_function-uniqcombined64} + +Same as [uniqCombined](#agg_function-uniqcombined), but uses 64-bit hash for all data types. + +## uniqHLL12 {#agg_function-uniqhll12} + +Calculates the approximate number of different argument values, using the [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) algorithm. + +``` sql +uniqHLL12(x[, ...]) +``` + +**Parameters** + +The function takes a variable number of parameters. Parameters can be `Tuple`, `Array`, `Date`, `DateTime`, `String`, or numeric types. + +**Returned value** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-type number. + +**Implementation details** + +Function: + +- Calculates a hash for all parameters in the aggregate, then uses it in calculations. + +- Uses the HyperLogLog algorithm to approximate the number of different argument values. + + 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). + +- Provides the determinate result (it doesn’t depend on the query processing order). + +We don’t recommend using this function. In most cases, use the [uniq](#agg_function-uniq) or [uniqCombined](#agg_function-uniqcombined) function. + +**See Also** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqExact](#agg_function-uniqexact) + +## uniqExact {#agg_function-uniqexact} + +Calculates the exact number of different argument values. + +``` sql +uniqExact(x[, ...]) +``` + +Use the `uniqExact` function if you absolutely need an exact result. Otherwise use the [uniq](#agg_function-uniq) function. + +The `uniqExact` function uses more memory than `uniq`, because the size of the state has unbounded growth as the number of different values increases. + +**Parameters** + +The function takes a variable number of parameters. Parameters can be `Tuple`, `Array`, `Date`, `DateTime`, `String`, or numeric types. + +**See Also** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqHLL12](#agg_function-uniqhll12) + +## groupArray(x), groupArray(max\_size)(x) {#agg_function-grouparray} + +Creates an array of argument values. +Values can be added to the array in any (indeterminate) order. + +The second version (with the `max_size` parameter) limits the size of the resulting array to `max_size` elements. +For example, `groupArray (1) (x)` is equivalent to `[any (x)]`. + +In some cases, you can still rely on the order of execution. This applies to cases when `SELECT` comes from a subquery that uses `ORDER BY`. + +## groupArrayInsertAt(value, position) {#grouparrayinsertatvalue-position} + +Inserts a value into the array in the specified position. + +!!! note "Note" + This function uses zero-based positions, contrary to the conventional one-based positions for SQL arrays. + +Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. + +Optional parameters: + +- The default value for substituting in empty positions. +- The length of the resulting array. This allows you to receive arrays of the same size for all the aggregate keys. When using this parameter, the default value must be specified. + +## groupArrayMovingSum {#agg_function-grouparraymovingsum} + +Calculates the moving sum of input values. + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +The function can take the window size as a parameter. If left unspecified, the function takes the window size equal to the number of rows in the column. + +**Parameters** + +- `numbers_for_summing` — [Expression](../syntax.md#syntax-expressions) resulting in a numeric data type value. +- `window_size` — Size of the calculation window. + +**Returned values** + +- Array of the same size and type as the input data. + +**Example** + +The sample table: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +The queries: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## groupArrayMovingAvg {#agg_function-grouparraymovingavg} + +Calculates the moving average of input values. + +``` sql +groupArrayMovingAvg(numbers_for_summing) +groupArrayMovingAvg(window_size)(numbers_for_summing) +``` + +The function can take the window size as a parameter. If left unspecified, the function takes the window size equal to the number of rows in the column. + +**Parameters** + +- `numbers_for_summing` — [Expression](../syntax.md#syntax-expressions) resulting in a numeric data type value. +- `window_size` — Size of the calculation window. + +**Returned values** + +- Array of the same size and type as the input data. + +The function uses [rounding towards zero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). It truncates the decimal places insignificant for the resulting data type. + +**Example** + +The sample table `b`: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +The queries: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## groupUniqArray(x), groupUniqArray(max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} + +Creates an array from different argument values. Memory consumption is the same as for the `uniqExact` function. + +The second version (with the `max_size` parameter) limits the size of the resulting array to `max_size` elements. +For example, `groupUniqArray(1)(x)` is equivalent to `[any(x)]`. + +## quantile {#quantile} + +Computes an approximate [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence. + +This function applies [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) with a reservoir size up to 8192 and a random number generator for sampling. The result is non-deterministic. To get an exact quantile, use the [quantileExact](#quantileexact) function. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantile(level)(expr) +``` + +Alias: `median`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [data types](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) or [DateTime](../../sql-reference/data-types/datetime.md). + +**Returned value** + +- Approximate quantile of the specified level. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) for numeric data type input. +- [Date](../../sql-reference/data-types/date.md) if input values have the `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) if input values have the `DateTime` type. + +**Example** + +Input table: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Query: + +``` sql +SELECT quantile(val) FROM t +``` + +Result: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileDeterministic {#quantiledeterministic} + +Computes an approximate [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence. + +This function applies [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) with a reservoir size up to 8192 and deterministic algorithm of sampling. The result is deterministic. To get an exact quantile, use the [quantileExact](#quantileexact) function. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +Alias: `medianDeterministic`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [data types](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) or [DateTime](../../sql-reference/data-types/datetime.md). +- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. + +**Returned value** + +- Approximate quantile of the specified level. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) for numeric data type input. +- [Date](../../sql-reference/data-types/date.md) if input values have the `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) if input values have the `DateTime` type. + +**Example** + +Input table: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Query: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +Result: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileExact {#quantileexact} + +Exactly computes the [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` memory, where `n` is a number of values that were passed. However, for a small number of values, the function is very effective. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantileExact(level)(expr) +``` + +Alias: `medianExact`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [data types](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) or [DateTime](../../sql-reference/data-types/datetime.md). + +**Returned value** + +- Quantile of the specified level. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) for numeric data type input. +- [Date](../../sql-reference/data-types/date.md) if input values have the `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) if input values have the `DateTime` type. + +**Example** + +Query: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +Result: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileExactWeighted {#quantileexactweighted} + +Exactly computes the [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence, taking into account the weight of each element. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). You can use this function instead of `quantileExact` and specify the weight 1. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +Alias: `medianExactWeighted`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [data types](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) or [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. + +**Returned value** + +- Quantile of the specified level. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) for numeric data type input. +- [Date](../../sql-reference/data-types/date.md) if input values have the `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) if input values have the `DateTime` type. + +**Example** + +Input table: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +Query: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +Result: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTiming {#quantiletiming} + +With the determined precision computes the [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence. + +The result is deterministic (it doesn’t depend on the query processing order). The function is optimized for working with sequences which describe distributions like loading web pages times or backend response times. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantileTiming(level)(expr) +``` + +Alias: `medianTiming`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). + +- `expr` — [Expression](../syntax.md#syntax-expressions) over a column values returning a [Float\*](../../sql-reference/data-types/float.md)-type number. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +**Accuracy** + +The calculation is accurate if: + +- Total number of values doesn’t exceed 5670. +- Total number of values exceeds 5670, but the page loading time is less than 1024ms. + +Otherwise, the result of the calculation is rounded to the nearest multiple of 16 ms. + +!!! note "Note" + For calculating page loading time quantiles, this function is more effective and accurate than [quantile](#quantile). + +**Returned value** + +- Quantile of the specified level. + +Type: `Float32`. + +!!! note "Note" + If no values are passed to the function (when using `quantileTimingIf`), [NaN](../../sql-reference/data-types/float.md#data_type-float-nan-inf) is returned. The purpose of this is to differentiate these cases from cases that result in zero. See [ORDER BY clause](../statements/select.md#select-order-by) for notes on sorting `NaN` values. + +**Example** + +Input table: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +Query: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +Result: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTimingWeighted {#quantiletimingweighted} + +With the determined precision computes the [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence according to the weight of each sequence member. + +The result is deterministic (it doesn’t depend on the query processing order). The function is optimized for working with sequences which describe distributions like loading web pages times or backend response times. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +Alias: `medianTimingWeighted`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). + +- `expr` — [Expression](../syntax.md#syntax-expressions) over a column values returning a [Float\*](../../sql-reference/data-types/float.md)-type number. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Accuracy** + +The calculation is accurate if: + +- Total number of values doesn’t exceed 5670. +- Total number of values exceeds 5670, but the page loading time is less than 1024ms. + +Otherwise, the result of the calculation is rounded to the nearest multiple of 16 ms. + +!!! note "Note" + For calculating page loading time quantiles, this function is more effective and accurate than [quantile](#quantile). + +**Returned value** + +- Quantile of the specified level. + +Type: `Float32`. + +!!! note "Note" + If no values are passed to the function (when using `quantileTimingIf`), [NaN](../../sql-reference/data-types/float.md#data_type-float-nan-inf) is returned. The purpose of this is to differentiate these cases from cases that result in zero. See [ORDER BY clause](../statements/select.md#select-order-by) for notes on sorting `NaN` values. + +**Example** + +Input table: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +Query: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +Result: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTDigest {#quantiletdigest} + +Computes an approximate [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence using the [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algorithm. + +The maximum error is 1%. Memory consumption is `log(n)`, where `n` is a number of values. The result depends on the order of running the query, and is nondeterministic. + +The performance of the function is lower than performance of [quantile](#quantile) or [quantileTiming](#quantiletiming). In terms of the ratio of State size to precision, this function is much better than `quantile`. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantileTDigest(level)(expr) +``` + +Alias: `medianTDigest`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [data types](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) or [DateTime](../../sql-reference/data-types/datetime.md). + +**Returned value** + +- Approximate quantile of the specified level. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) for numeric data type input. +- [Date](../../sql-reference/data-types/date.md) if input values have the `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) if input values have the `DateTime` type. + +**Example** + +Query: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +Result: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTDigestWeighted {#quantiletdigestweighted} + +Computes an approximate [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence using the [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algorithm. The function takes into account the weight of each sequence member. The maximum error is 1%. Memory consumption is `log(n)`, where `n` is a number of values. + +The performance of the function is lower than performance of [quantile](#quantile) or [quantileTiming](#quantiletiming). In terms of the ratio of State size to precision, this function is much better than `quantile`. + +The result depends on the order of running the query, and is nondeterministic. + +When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could). In this case, use the [quantiles](#quantiles) function. + +**Syntax** + +``` sql +quantileTDigest(level)(expr) +``` + +Alias: `medianTDigest`. + +**Parameters** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates [median](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [data types](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) or [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Returned value** + +- Approximate quantile of the specified level. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) for numeric data type input. +- [Date](../../sql-reference/data-types/date.md) if input values have the `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) if input values have the `DateTime` type. + +**Example** + +Query: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +Result: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**See Also** + +- [median](#median) +- [quantiles](#quantiles) + +## median {#median} + +The `median*` functions are the aliases for the corresponding `quantile*` functions. They calculate median of a numeric data sample. + +Functions: + +- `median` — Alias for [quantile](#quantile). +- `medianDeterministic` — Alias for [quantileDeterministic](#quantiledeterministic). +- `medianExact` — Alias for [quantileExact](#quantileexact). +- `medianExactWeighted` — Alias for [quantileExactWeighted](#quantileexactweighted). +- `medianTiming` — Alias for [quantileTiming](#quantiletiming). +- `medianTimingWeighted` — Alias for [quantileTimingWeighted](#quantiletimingweighted). +- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). +- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). + +**Example** + +Input table: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Query: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +Result: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +All the quantile functions also have corresponding quantiles functions: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. These functions calculate all the quantiles of the listed levels in one pass, and return an array of the resulting values. + +## varSamp(x) {#varsampx} + +Calculates the amount `Σ((x - x̅)^2) / (n - 1)`, where `n` is the sample size and `x̅`is the average value of `x`. + +It represents an unbiased estimate of the variance of a random variable if passed values form its sample. + +Returns `Float64`. When `n <= 1`, returns `+∞`. + +## varPop(x) {#varpopx} + +Calculates the amount `Σ((x - x̅)^2) / n`, where `n` is the sample size and `x̅`is the average value of `x`. + +In other words, dispersion for a set of values. Returns `Float64`. + +## stddevSamp(x) {#stddevsampx} + +The result is equal to the square root of `varSamp(x)`. + +## stddevPop(x) {#stddevpopx} + +The result is equal to the square root of `varPop(x)`. + +## topK(N)(x) {#topknx} + +Returns an array of the approximately most frequent values in the specified column. The resulting array is sorted in descending order of approximate frequency of values (not by the values themselves). + +Implements the [Filtered Space-Saving](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) algorithm for analyzing TopK, based on the reduce-and-combine algorithm from [Parallel Space Saving](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +This function doesn’t provide a guaranteed result. In certain situations, errors might occur and it might return frequent values that aren’t the most frequent values. + +We recommend using the `N < 10` value; performance is reduced with large `N` values. Maximum value of `N = 65536`. + +**Parameters** + +- ‘N’ is the number of elements to return. + +If the parameter is omitted, default value 10 is used. + +**Arguments** + +- ’ x ’ – The value to calculate frequency. + +**Example** + +Take the [OnTime](../../getting-started/example-datasets/ontime.md) data set and select the three most frequently occurring values in the `AirlineID` column. + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## topKWeighted {#topkweighted} + +Similar to `topK` but takes one additional argument of integer type - `weight`. Every value is accounted `weight` times for frequency calculation. + +**Syntax** + +``` sql +topKWeighted(N)(x, weight) +``` + +**Parameters** + +- `N` — The number of elements to return. + +**Arguments** + +- `x` – The value. +- `weight` — The weight. [UInt8](../../sql-reference/data-types/int-uint.md). + +**Returned value** + +Returns an array of the values with maximum approximate sum of weights. + +**Example** + +Query: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +Result: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## covarSamp(x, y) {#covarsampx-y} + +Calculates the value of `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +Returns Float64. When `n <= 1`, returns +∞. + +## covarPop(x, y) {#covarpopx-y} + +Calculates the value of `Σ((x - x̅)(y - y̅)) / n`. + +## corr(x, y) {#corrx-y} + +Calculates the Pearson correlation coefficient: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## categoricalInformationValue {#categoricalinformationvalue} + +Calculates the value of `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` for each category. + +``` sql +categoricalInformationValue(category1, category2, ..., tag) +``` + +The result indicates how a discrete (categorical) feature `[category1, category2, ...]` contribute to a learning model which predicting the value of `tag`. + +## simpleLinearRegression {#simplelinearregression} + +Performs simple (unidimensional) linear regression. + +``` sql +simpleLinearRegression(x, y) +``` + +Parameters: + +- `x` — Column with dependent variable values. +- `y` — Column with explanatory variable values. + +Returned values: + +Constants `(a, b)` of the resulting line `y = a*x + b`. + +**Examples** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## stochasticLinearRegression {#agg_functions-stochasticlinearregression} + +This function implements stochastic linear regression. It supports custom parameters for learning rate, L2 regularization coefficient, mini-batch size and has few methods for updating weights ([Adam](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (used by default), [simple SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Momentum](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### Parameters {#agg_functions-stochasticlinearregression-parameters} + +There are 4 customizable parameters. They are passed to the function sequentially, but there is no need to pass all four - default values will be used, however good model required some parameter tuning. + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. `learning rate` is the coefficient on step length, when gradient descent step is performed. Too big learning rate may cause infinite weights of the model. Default is `0.00001`. +2. `l2 regularization coefficient` which may help to prevent overfitting. Default is `0.1`. +3. `mini-batch size` sets the number of elements, which gradients will be computed and summed to perform one step of gradient descent. Pure stochastic descent uses one element, however having small batches(about 10 elements) make gradient steps more stable. Default is `15`. +4. `method for updating weights`, they are: `Adam` (by default), `SGD`, `Momentum`, `Nesterov`. `Momentum` and `Nesterov` require little bit more computations and memory, however they happen to be useful in terms of speed of convergance and stability of stochastic gradient methods. + +### Usage {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` is used in two steps: fitting the model and predicting on new data. In order to fit the model and save its state for later usage we use `-State` combinator, which basically saves the state (model weights, etc). +To predict we use function [evalMLMethod](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod), which takes a state as an argument as well as features to predict on. + + + +**1.** Fitting + +Such query may be used. + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +Here we also need to insert data into `train_data` table. The number of parameters is not fixed, it depends only on number of arguments, passed into `linearRegressionState`. They all must be numeric values. +Note that the column with target value(which we would like to learn to predict) is inserted as the first argument. + +**2.** Predicting + +After saving a state into the table, we may use it multiple times for prediction, or even merge with other states and create new even better models. + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +The query will return a column of predicted values. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + +`test_data` is a table like `train_data` but may not contain target value. + +### Notes {#agg_functions-stochasticlinearregression-notes} + +1. To merge two models user may create such query: + `sql SELECT state1 + state2 FROM your_models` + where `your_models` table contains both models. This query will return new `AggregateFunctionState` object. + +2. User may fetch weights of the created model for its own purposes without saving the model if no `-State` combinator is used. + `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` + Such query will fit the model and return its weights - first are weights, which correspond to the parameters of the model, the last one is bias. So in the example above the query will return a column with 3 values. + +**See Also** + +- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) +- [Difference between linear and logistic regressions](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} + +This function implements stochastic logistic regression. It can be used for binary classification problem, supports the same custom parameters as stochasticLinearRegression and works the same way. + +### Parameters {#agg_functions-stochasticlogisticregression-parameters} + +Parameters are exactly the same as in stochasticLinearRegression: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +For more information see [parameters](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. Fitting + + + + See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. + + Predicted labels have to be in \[-1, 1\]. + +1. Predicting + + + + Using saved state we can predict probability of object having label `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + + The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + + We can also set a bound of probability, which assigns elements to different labels. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + + Then the result will be labels. + + `test_data` is a table like `train_data` but may not contain target value. + +**See Also** + +- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) +- [Difference between linear and logistic regressions.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## groupBitmapAnd {#groupbitmapand} + +Calculations the AND of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return [bitmap object](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapAnd(expr) +``` + +**Parameters** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. + +**Return value** + +Value of the `UInt64` type. + +**Example** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapAnd(z)─┐ +│ 3 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ +│ [6,8,10] │ +└──────────────────────────────────────────────────┘ +``` + +## groupBitmapOr {#groupbitmapor} + +Calculations the OR of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return [bitmap object](../../sql-reference/functions/bitmap-functions.md). This is equivalent to `groupBitmapMerge`. + +``` sql +groupBitmapOr(expr) +``` + +**Parameters** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. + +**Return value** + +Value of the `UInt64` type. + +**Example** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapOr(z)─┐ +│ 15 │ +└──────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ +│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ +└─────────────────────────────────────────────────┘ +``` + +## groupBitmapXor {#groupbitmapxor} + +Calculations the XOR of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return [bitmap object](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapOr(expr) +``` + +**Parameters** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. + +**Return value** + +Value of the `UInt64` type. + +**Example** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapXor(z)─┐ +│ 10 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ +│ [1,3,5,6,8,10,11,13,14,15] │ +└──────────────────────────────────────────────────┘ +``` + +[Original article](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/en/sql-reference/ansi.md b/docs/en/sql-reference/ansi.md new file mode 100644 index 00000000000..805741ba9d5 --- /dev/null +++ b/docs/en/sql-reference/ansi.md @@ -0,0 +1,178 @@ +--- +toc_priority: 40 +toc_title: ANSI Compatibility +--- + +# ANSI SQL Compatibility of ClickHouse SQL Dialect {#ansi-sql-compatibility-of-clickhouse-sql-dialect} + +!!! note "Note" + This article relies on Table 38, “Feature taxonomy and definition for mandatory features”, Annex F of ISO/IEC CD 9075-2:2013. + +## Differences in Behaviour {#differences-in-behaviour} + +The following table lists cases when query feature works in ClickHouse, but behaves not as specified in ANSI SQL. + +| Feature ID | Feature Name | Difference | +|------------|-----------------------------|-----------------------------------------------------------------------------------------------------------| +| E011 | Numeric data types | Numeric literal with period is interpreted as approximate (`Float64`) instead of exact (`Decimal`) | +| E051-05 | Select items can be renamed | Item renames have a wider visibility scope than just the SELECT result | +| E141-01 | NOT NULL constraints | `NOT NULL` is implied for table columns by default | +| E011-04 | Arithmetic operators | ClickHouse overflows instead of checked arithmetic and changes the result data type based on custom rules | + +## Feature Status {#feature-status} + +| Feature ID | Feature Name | Status | Comment | +|------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **E011** | **Numeric data types** | **Partial**{.text-warning} | | +| E011-01 | INTEGER and SMALLINT data types | Yes{.text-success} | | +| E011-02 | REAL, DOUBLE PRECISION and FLOAT data types data types | Partial{.text-warning} | `FLOAT()`, `REAL` and `DOUBLE PRECISION` are not supported | +| E011-03 | DECIMAL and NUMERIC data types | Partial{.text-warning} | Only `DECIMAL(p,s)` is supported, not `NUMERIC` | +| E011-04 | Arithmetic operators | Yes{.text-success} | | +| E011-05 | Numeric comparison | Yes{.text-success} | | +| E011-06 | Implicit casting among the numeric data types | No{.text-danger} | ANSI SQL allows arbitrary implicit cast between numeric types, while ClickHouse relies on functions having multiple overloads instead of implicit cast | +| **E021** | **Character string types** | **Partial**{.text-warning} | | +| E021-01 | CHARACTER data type | No{.text-danger} | | +| E021-02 | CHARACTER VARYING data type | No{.text-danger} | `String` behaves similarly, but without length limit in parentheses | +| E021-03 | Character literals | Partial{.text-warning} | No automatic concatenation of consecutive literals and character set support | +| E021-04 | CHARACTER\_LENGTH function | Partial{.text-warning} | No `USING` clause | +| E021-05 | OCTET\_LENGTH function | No{.text-danger} | `LENGTH` behaves similarly | +| E021-06 | SUBSTRING | Partial{.text-warning} | No support for `SIMILAR` and `ESCAPE` clauses, no `SUBSTRING_REGEX` variant | +| E021-07 | Character concatenation | Partial{.text-warning} | No `COLLATE` clause | +| E021-08 | UPPER and LOWER functions | Yes{.text-success} | | +| E021-09 | TRIM function | Yes{.text-success} | | +| E021-10 | Implicit casting among the fixed-length and variable-length character string types | No{.text-danger} | ANSI SQL allows arbitrary implicit cast between string types, while ClickHouse relies on functions having multiple overloads instead of implicit cast | +| E021-11 | POSITION function | Partial{.text-warning} | No support for `IN` and `USING` clauses, no `POSITION_REGEX` variant | +| E021-12 | Character comparison | Yes{.text-success} | | +| **E031** | **Identifiers** | **Partial**{.text-warning} | | +| E031-01 | Delimited identifiers | Partial{.text-warning} | Unicode literal support is limited | +| E031-02 | Lower case identifiers | Yes{.text-success} | | +| E031-03 | Trailing underscore | Yes{.text-success} | | +| **E051** | **Basic query specification** | **Partial**{.text-warning} | | +| E051-01 | SELECT DISTINCT | Yes{.text-success} | | +| E051-02 | GROUP BY clause | Yes{.text-success} | | +| E051-04 | GROUP BY can contain columns not in `` | Yes{.text-success} | | -| E051-05 | Select items can be renamed | Yes{.text-success} | | -| E051-06 | HAVING clause | Yes{.text-success} | | -| E051-07 | Qualified \* in select list | Yes{.text-success} | | -| E051-08 | Correlation name in the FROM clause | Yes{.text-success} | | -| E051-09 | Rename columns in the FROM clause | No{.text-danger} | | -| **E061** | **Basic predicates and search conditions** | **Partial**{.text-warning} | | -| E061-01 | Comparison predicate | Yes{.text-success} | | -| E061-02 | BETWEEN predicate | Partial{.text-warning} | No `SYMMETRIC` and `ASYMMETRIC` clause | -| E061-03 | IN predicate with list of values | Yes{.text-success} | | -| E061-04 | LIKE predicate | Yes{.text-success} | | -| E061-05 | LIKE predicate: ESCAPE clause | No{.text-danger} | | -| E061-06 | NULL predicate | Yes{.text-success} | | -| E061-07 | Quantified comparison predicate | No{.text-danger} | | -| E061-08 | EXISTS predicate | No{.text-danger} | | -| E061-09 | Subqueries in comparison predicate | Yes{.text-success} | | -| E061-11 | Subqueries in IN predicate | Yes{.text-success} | | -| E061-12 | Subqueries in quantified comparison predicate | No{.text-danger} | | -| E061-13 | Correlated subqueries | No{.text-danger} | | -| E061-14 | Search condition | Yes{.text-success} | | -| **E071** | **Basic query expressions** | **Partial**{.text-warning} | | -| E071-01 | UNION DISTINCT table operator | No{.text-danger} | | -| E071-02 | UNION ALL table operator | Yes{.text-success} | | -| E071-03 | EXCEPT DISTINCT table operator | No{.text-danger} | | -| E071-05 | Columns combined via table operators need not have exactly the same data type | Yes{.text-success} | | -| E071-06 | Table operators in subqueries | Yes{.text-success} | | -| **E081** | **Basic privileges** | **Partial**{.text-warning} | Work in progress | -| **E091** | **Set functions** | **Yes**{.text-success} | | -| E091-01 | AVG | Yes{.text-success} | | -| E091-02 | COUNT | Yes{.text-success} | | -| E091-03 | MAX | Yes{.text-success} | | -| E091-04 | MIN | Yes{.text-success} | | -| E091-05 | SUM | Yes{.text-success} | | -| E091-06 | ALL quantifier | No{.text-danger} | | -| E091-07 | DISTINCT quantifier | Partial{.text-warning} | Not all aggregate functions supported | -| **E101** | **Basic data manipulation** | **Partial**{.text-warning} | | -| E101-01 | INSERT statement | Yes{.text-success} | Note: primary key in ClickHouse does not imply the `UNIQUE` constraint | -| E101-03 | Searched UPDATE statement | No{.text-danger} | There’s an `ALTER UPDATE` statement for batch data modification | -| E101-04 | Searched DELETE statement | No{.text-danger} | There’s an `ALTER DELETE` statement for batch data removal | -| **E111** | **Single row SELECT statement** | **No**{.text-danger} | | -| **E121** | **Basic cursor support** | **No**{.text-danger} | | -| E121-01 | DECLARE CURSOR | No{.text-danger} | | -| E121-02 | ORDER BY columns need not be in select list | No{.text-danger} | | -| E121-03 | Value expressions in ORDER BY clause | No{.text-danger} | | -| E121-04 | OPEN statement | No{.text-danger} | | -| E121-06 | Positioned UPDATE statement | No{.text-danger} | | -| E121-07 | Positioned DELETE statement | No{.text-danger} | | -| E121-08 | CLOSE statement | No{.text-danger} | | -| E121-10 | FETCH statement: implicit NEXT | No{.text-danger} | | -| E121-17 | WITH HOLD cursors | No{.text-danger} | | -| **E131** | **Null value support (nulls in lieu of values)** | **Partial**{.text-warning} | Some restrictions apply | -| **E141** | **Basic integrity constraints** | **Partial**{.text-warning} | | -| E141-01 | NOT NULL constraints | Yes{.text-success} | Note: `NOT NULL` is implied for table columns by default | -| E141-02 | UNIQUE constraint of NOT NULL columns | No{.text-danger} | | -| E141-03 | PRIMARY KEY constraints | No{.text-danger} | | -| E141-04 | Basic FOREIGN KEY constraint with the NO ACTION default for both referential delete action and referential update action | No{.text-danger} | | -| E141-06 | CHECK constraint | Yes{.text-success} | | -| E141-07 | Column defaults | Yes{.text-success} | | -| E141-08 | NOT NULL inferred on PRIMARY KEY | Yes{.text-success} | | -| E141-10 | Names in a foreign key can be specified in any order | No{.text-danger} | | -| **E151** | **Transaction support** | **No**{.text-danger} | | -| E151-01 | COMMIT statement | No{.text-danger} | | -| E151-02 | ROLLBACK statement | No{.text-danger} | | -| **E152** | **Basic SET TRANSACTION statement** | **No**{.text-danger} | | -| E152-01 | SET TRANSACTION statement: ISOLATION LEVEL SERIALIZABLE clause | No{.text-danger} | | -| E152-02 | SET TRANSACTION statement: READ ONLY and READ WRITE clauses | No{.text-danger} | | -| **E153** | **Updatable queries with subqueries** | **No**{.text-danger} | | -| **E161** | **SQL comments using leading double minus** | **Yes**{.text-success} | | -| **E171** | **SQLSTATE support** | **No**{.text-danger} | | -| **E182** | **Host language binding** | **No**{.text-danger} | | -| **F031** | **Basic schema manipulation** | **Partial**{.text-warning} | | -| F031-01 | CREATE TABLE statement to create persistent base tables | Partial{.text-warning} | No `SYSTEM VERSIONING`, `ON COMMIT`, `GLOBAL`, `LOCAL`, `PRESERVE`, `DELETE`, `REF IS`, `WITH OPTIONS`, `UNDER`, `LIKE`, `PERIOD FOR` clauses and no support for user resolved data types | -| F031-02 | CREATE VIEW statement | Partial{.text-warning} | No `RECURSIVE`, `CHECK`, `UNDER`, `WITH OPTIONS` clauses and no support for user resolved data types | -| F031-03 | GRANT statement | Yes{.text-success} | | -| F031-04 | ALTER TABLE statement: ADD COLUMN clause | Partial{.text-warning} | No support for `GENERATED` clause and system time period | -| F031-13 | DROP TABLE statement: RESTRICT clause | No{.text-danger} | | -| F031-16 | DROP VIEW statement: RESTRICT clause | No{.text-danger} | | -| F031-19 | REVOKE statement: RESTRICT clause | No{.text-danger} | | -| **F041** | **Basic joined table** | **Partial**{.text-warning} | | -| F041-01 | Inner join (but not necessarily the INNER keyword) | Yes{.text-success} | | -| F041-02 | INNER keyword | Yes{.text-success} | | -| F041-03 | LEFT OUTER JOIN | Yes{.text-success} | | -| F041-04 | RIGHT OUTER JOIN | Yes{.text-success} | | -| F041-05 | Outer joins can be nested | Yes{.text-success} | | -| F041-07 | The inner table in a left or right outer join can also be used in an inner join | Yes{.text-success} | | -| F041-08 | All comparison operators are supported (rather than just =) | No{.text-danger} | | -| **F051** | **Basic date and time** | **Partial**{.text-warning} | | -| F051-01 | DATE data type (including support of DATE literal) | Partial{.text-warning} | No literal | -| F051-02 | TIME data type (including support of TIME literal) with fractional seconds precision of at least 0 | No{.text-danger} | | -| F051-03 | TIMESTAMP data type (including support of TIMESTAMP literal) with fractional seconds precision of at least 0 and 6 | No{.text-danger} | `DateTime64` time provides similar functionality | -| F051-04 | Comparison predicate on DATE, TIME, and TIMESTAMP data types | Partial{.text-warning} | Only one data type available | -| F051-05 | Explicit CAST between datetime types and character string types | Yes{.text-success} | | -| F051-06 | CURRENT\_DATE | No{.text-danger} | `today()` is similar | -| F051-07 | LOCALTIME | No{.text-danger} | `now()` is similar | -| F051-08 | LOCALTIMESTAMP | No{.text-danger} | | -| **F081** | **UNION and EXCEPT in views** | **Partial**{.text-warning} | | -| **F131** | **Grouped operations** | **Partial**{.text-warning} | | -| F131-01 | WHERE, GROUP BY, and HAVING clauses supported in queries with grouped views | Yes{.text-success} | | -| F131-02 | Multiple tables supported in queries with grouped views | Yes{.text-success} | | -| F131-03 | Set functions supported in queries with grouped views | Yes{.text-success} | | -| F131-04 | Subqueries with GROUP BY and HAVING clauses and grouped views | Yes{.text-success} | | -| F131-05 | Single row SELECT with GROUP BY and HAVING clauses and grouped views | No{.text-danger} | | -| **F181** | **Multiple module support** | **No**{.text-danger} | | -| **F201** | **CAST function** | **Yes**{.text-success} | | -| **F221** | **Explicit defaults** | **No**{.text-danger} | | -| **F261** | **CASE expression** | **Yes**{.text-success} | | -| F261-01 | Simple CASE | Yes{.text-success} | | -| F261-02 | Searched CASE | Yes{.text-success} | | -| F261-03 | NULLIF | Yes{.text-success} | | -| F261-04 | COALESCE | Yes{.text-success} | | -| **F311** | **Schema definition statement** | **Partial**{.text-warning} | | -| F311-01 | CREATE SCHEMA | No{.text-danger} | | -| F311-02 | CREATE TABLE for persistent base tables | Yes{.text-success} | | -| F311-03 | CREATE VIEW | Yes{.text-success} | | -| F311-04 | CREATE VIEW: WITH CHECK OPTION | No{.text-danger} | | -| F311-05 | GRANT statement | Yes{.text-success} | | -| **F471** | **Scalar subquery values** | **Yes**{.text-success} | | -| **F481** | **Expanded NULL predicate** | **Yes**{.text-success} | | -| **F812** | **Basic flagging** | **No**{.text-danger} | | -| **T321** | **Basic SQL-invoked routines** | **No**{.text-danger} | | -| T321-01 | User-defined functions with no overloading | No{.text-danger} | | -| T321-02 | User-defined stored procedures with no overloading | No{.text-danger} | | -| T321-03 | Function invocation | No{.text-danger} | | -| T321-04 | CALL statement | No{.text-danger} | | -| T321-05 | RETURN statement | No{.text-danger} | | -| **T631** | **IN predicate with one list element** | **Yes**{.text-success} | | diff --git a/docs/en/sql_reference/data_types/aggregatefunction.md b/docs/en/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index 57935557ba9..00000000000 --- a/docs/en/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -toc_priority: 52 -toc_title: AggregateFunction(name, types_of_arguments...) ---- - -# AggregateFunction(name, types\_of\_arguments…) {#data-type-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/select.md#create-view). 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` — parametric data type. - -**Parameters** - -- Name of the aggregate function. - - If the function is parametric, specify its parameters too. - -- Types of the aggregate function arguments. - -**Example** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -[uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq), anyIf ([any](../../sql_reference/aggregate_functions/reference.md#agg_function-any)+[If](../../sql_reference/aggregate_functions/combinators.md#agg-functions-combinator-if)) and [quantiles](../../sql_reference/aggregate_functions/reference.md) are the aggregate functions supported in ClickHouse. - -## Usage {#usage} - -### Data Insertion {#data-insertion} - -To insert data, use `INSERT SELECT` with aggregate `-State`- functions. - -**Function examples** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -In contrast to the corresponding functions `uniq` and `quantiles`, `-State`- functions return the state, instead of the final value. In other words, they return a value of `AggregateFunction` type. - -In the results of `SELECT` query, the values of `AggregateFunction` type have implementation-specific binary representation for all of the ClickHouse output formats. If dump data into, for example, `TabSeparated` format with `SELECT` query, then this dump can be loaded back using `INSERT` query. - -### Data Selection {#data-selection} - -When selecting data from `AggregatingMergeTree` table, use `GROUP BY` clause and the same aggregate functions as when inserting data, but using `-Merge`suffix. - -An aggregate function with `-Merge` suffix takes a set of states, combines them, and returns the result of complete data aggregation. - -For example, the following two queries return the same result: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## Usage Example {#usage-example} - -See [AggregatingMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) engine description. - -[Original article](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/en/sql_reference/data_types/array.md b/docs/en/sql_reference/data_types/array.md deleted file mode 100644 index 58b1d25df04..00000000000 --- a/docs/en/sql_reference/data_types/array.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -toc_priority: 51 -toc_title: Array(T) ---- - -# Array(t) {#data-type-array} - -An array of `T`-type items. `T` can be any data type, including an array. - -## Creating an Array {#creating-an-array} - -You can use a function to create an array: - -``` sql -array(T) -``` - -You can also use square brackets. - -``` sql -[] -``` - -Example of creating an array: - -``` sql -SELECT array(1, 2) AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName(array(1, 2))─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴─────────────────────────┘ -``` - -``` sql -SELECT [1, 2] AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName([1, 2])─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴────────────────────┘ -``` - -## Working With Data Types {#working-with-data-types} - -When creating an array on the fly, ClickHouse automatically defines the argument type as the narrowest data type that can store all the listed arguments. If there are any [Nullable](nullable.md#data_type-nullable) or literal [NULL](../../sql_reference/syntax.md#null-literal) values, the type of an array element also becomes [Nullable](nullable.md). - -If ClickHouse couldn’t determine the data type, it generates an exception. For instance, this happens when trying to create an array with strings and numbers simultaneously (`SELECT array(1, 'a')`). - -Examples of automatic data type detection: - -``` sql -SELECT array(1, 2, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ -│ [1,2,NULL] │ Array(Nullable(UInt8)) │ -└────────────┴───────────────────────────────┘ -``` - -If you try to create an array of incompatible data types, ClickHouse throws an exception: - -``` sql -SELECT array(1, 'a') -``` - -``` text -Received exception from server (version 1.1.54388): -Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. -``` - -[Original article](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/en/sql_reference/data_types/datetime.md b/docs/en/sql_reference/data_types/datetime.md deleted file mode 100644 index ee108dfe078..00000000000 --- a/docs/en/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -toc_priority: 48 -toc_title: DateTime ---- - -# Datetime {#data_type-datetime} - -Allows to store an instant in time, that can be expressed as a calendar date and a time of a day. - -Syntax: - -``` sql -DateTime([timezone]) -``` - -Supported range of values: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. - -Resolution: 1 second. - -## Usage Remarks {#usage-remarks} - -The point in time is saved as a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time), regardless of the time zone or daylight saving time. Additionally, the `DateTime` type can store time zone that is the same for the entire column, that affects how the values of the `DateTime` type values are displayed in text format and how the values specified as strings are parsed (‘2020-01-01 05:00:01’). The time zone is not stored in the rows of the table (or in resultset), but is stored in the column metadata. -A list of supported time zones can be found in the [IANA Time Zone Database](https://www.iana.org/time-zones). -The `tzdata` package, containing [IANA Time Zone Database](https://www.iana.org/time-zones), should be installed in the system. Use the `timedatectl list-timezones` command to list timezones known by a local system. - -You can explicitly set a time zone for `DateTime`-type columns when creating a table. If the time zone isn’t set, ClickHouse uses the value of the [timezone](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) parameter in the server settings or the operating system settings at the moment of the ClickHouse server start. - -The [clickhouse-client](../../interfaces/cli.md) applies the server time zone by default if a time zone isn’t explicitly set when initializing the data type. To use the client time zone, run `clickhouse-client` with the `--use_client_time_zone` parameter. - -ClickHouse outputs values in `YYYY-MM-DD hh:mm:ss` text format by default. You can change the output with the [formatDateTime](../../sql_reference/functions/date_time_functions.md#formatdatetime) function. - -When inserting data into ClickHouse, you can use different formats of date and time strings, depending on the value of the [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) setting. - -## Examples {#examples} - -**1.** Creating a table with a `DateTime`-type column and inserting data into it: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime('Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog; -``` - -``` sql -INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); -``` - -``` sql -SELECT * FROM dt; -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -- When inserting datetime as an integer, it is treated as Unix Timestamp (UTC). `1546300800` represents `'2019-01-01 00:00:00'` UTC. However, as `timestamp` column has `Europe/Moscow` (UTC+3) timezone specified, when outputting as string the value will be shown as `'2019-01-01 03:00:00'` -- When inserting string value as datetime, it is treated as being in column timezone. `'2019-01-01 00:00:00'` will be treated as being in `Europe/Moscow` timezone and saved as `1546290000`. - -**2.** Filtering on `DateTime` values - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -`DateTime` column values can be filtered using a string value in `WHERE` predicate. It will be converted to `DateTime` automatically: - -``` sql -SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -└─────────────────────┴──────────┘ -``` - -**3.** Getting a time zone for a `DateTime`-type column: - -``` sql -SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────column─┬─x─────────────────────────┐ -│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ -└─────────────────────┴───────────────────────────┘ -``` - -**4.** Timezone conversion - -``` sql -SELECT -toDateTime(timestamp, 'Europe/London') as lon_time, -toDateTime(timestamp, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────lon_time──┬────────────mos_time─┐ -│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ -│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ -└─────────────────────┴─────────────────────┘ -``` - -## See Also {#see-also} - -- [Type conversion functions](../../sql_reference/functions/type_conversion_functions.md) -- [Functions for working with dates and times](../../sql_reference/functions/date_time_functions.md) -- [Functions for working with arrays](../../sql_reference/functions/array_functions.md) -- [The `date_time_input_format` setting](../../operations/settings/settings.md#settings-date_time_input_format) -- [The `timezone` server configuration parameter](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Operators for working with dates and times](../../sql_reference/operators.md#operators-datetime) -- [The `Date` data type](date.md) - -[Original article](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/en/sql_reference/data_types/datetime64.md b/docs/en/sql_reference/data_types/datetime64.md deleted file mode 100644 index f946c7aff6b..00000000000 --- a/docs/en/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -toc_priority: 49 -toc_title: DateTime64 ---- - -# Datetime64 {#data_type-datetime64} - -Allows to store an instant in time, that can be expressed as a calendar date and a time of a day, with defined sub-second precision - -Tick size (precision): 10-precision seconds - -Syntax: - -``` sql -DateTime64(precision, [timezone]) -``` - -Internally, stores data as a number of ‘ticks’ since epoch start (1970-01-01 00:00:00 UTC) as Int64. The tick resolution is determined by the precision parameter. Additionally, the `DateTime64` type can store time zone that is the same for the entire column, that affects how the values of the `DateTime64` type values are displayed in text format and how the values specified as strings are parsed (‘2020-01-01 05:00:01.000’). The time zone is not stored in the rows of the table (or in resultset), but is stored in the column metadata. See details in [DateTime](datetime.md). - -## Examples {#examples} - -**1.** Creating a table with `DateTime64`-type column and inserting data into it: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- When inserting datetime as an integer, it is treated as an appropriately scaled Unix Timestamp (UTC). `1546300800000` (with precision 3) represents `'2019-01-01 00:00:00'` UTC. However, as `timestamp` column has `Europe/Moscow` (UTC+3) timezone specified, when outputting as a string the value will be shown as `'2019-01-01 03:00:00'` -- When inserting string value as datetime, it is treated as being in column timezone. `'2019-01-01 00:00:00'` will be treated as being in `Europe/Moscow` timezone and stored as `1546290000000`. - -**2.** Filtering on `DateTime64` values - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -Unlike `DateTime`, `DateTime64` values are not converted from `String` automatically - -**3.** Getting a time zone for a `DateTime64`-type value: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** Timezone conversion - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## See Also {#see-also} - -- [Type conversion functions](../../sql_reference/functions/type_conversion_functions.md) -- [Functions for working with dates and times](../../sql_reference/functions/date_time_functions.md) -- [Functions for working with arrays](../../sql_reference/functions/array_functions.md) -- [The `date_time_input_format` setting](../../operations/settings/settings.md#settings-date_time_input_format) -- [The `timezone` server configuration parameter](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Operators for working with dates and times](../../sql_reference/operators.md#operators-datetime) -- [`Date` data type](date.md) -- [`DateTime` data type](datetime.md) diff --git a/docs/en/sql_reference/data_types/decimal.md b/docs/en/sql_reference/data_types/decimal.md deleted file mode 100644 index c689cf60310..00000000000 --- a/docs/en/sql_reference/data_types/decimal.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -toc_priority: 42 -toc_title: Decimal ---- - -# Decimal(P, S), Decimal32(S), Decimal64(S), Decimal128(S) {#decimalp-s-decimal32s-decimal64s-decimal128s} - -Signed fixed-point numbers that keep precision during add, subtract and multiply operations. For division least significant digits are discarded (not rounded). - -## Parameters {#parameters} - -- P - precision. Valid range: \[ 1 : 38 \]. Determines how many decimal digits number can have (including fraction). -- S - scale. Valid range: \[ 0 : P \]. Determines how many decimal digits fraction can have. - -Depending on P parameter value Decimal(P, S) is a synonym for: -- P from \[ 1 : 9 \] - for Decimal32(S) -- P from \[ 10 : 18 \] - for Decimal64(S) -- P from \[ 19 : 38 \] - for Decimal128(S) - -## Decimal value ranges {#decimal-value-ranges} - -- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9 - S) ) -- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18 - S) ) -- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38 - S) ) - -For example, Decimal32(4) can contain numbers from -99999.9999 to 99999.9999 with 0.0001 step. - -## Internal representation {#internal-representation} - -Internally data is represented as normal signed integers with respective bit width. Real value ranges that can be stored in memory are a bit larger than specified above, which are checked only on conversion from a string. - -Because modern CPU’s do not support 128-bit integers natively, operations on Decimal128 are emulated. Because of this Decimal128 works significantly slower than Decimal32/Decimal64. - -## Operations and result type {#operations-and-result-type} - -Binary operations on Decimal result in wider result type (with any order of arguments). - -- Decimal64(S1) Decimal32(S2) -\> Decimal64(S) -- Decimal128(S1) Decimal32(S2) -\> Decimal128(S) -- Decimal128(S1) Decimal64(S2) -\> Decimal128(S) - -Rules for scale: - -- add, subtract: S = max(S1, S2). -- multuply: S = S1 + S2. -- divide: S = S1. - -For similar operations between Decimal and integers, the result is Decimal of the same size as an argument. - -Operations between Decimal and Float32/Float64 are not defined. If you need them, you can explicitly cast one of argument using toDecimal32, toDecimal64, toDecimal128 or toFloat32, toFloat64 builtins. Keep in mind that the result will lose precision and type conversion is a computationally expensive operation. - -Some functions on Decimal return result as Float64 (for example, var or stddev). Intermediate calculations might still be performed in Decimal, which might lead to different results between Float64 and Decimal inputs with the same values. - -## Overflow checks {#overflow-checks} - -During calculations on Decimal, integer overflows might happen. Excessive digits in a fraction are discarded (not rounded). Excessive digits in integer part will lead to an exception. - -``` sql -SELECT toDecimal32(2, 4) AS x, x / 3 -``` - -``` text -┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ -│ 2.0000 │ 0.6666 │ -└────────┴──────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, x * x -``` - -``` text -DB::Exception: Scale is out of bounds. -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -DB::Exception: Decimal math overflow. -``` - -Overflow checks lead to operations slowdown. If it is known that overflows are not possible, it makes sense to disable checks using `decimal_check_overflow` setting. When checks are disabled and overflow happens, the result will be incorrect: - -``` sql -SET decimal_check_overflow = 0; -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ -│ 4.20000000 │ -17.74967296 │ -└────────────┴──────────────────────────────────┘ -``` - -Overflow checks happen not only on arithmetic operations but also on value comparison: - -``` sql -SELECT toDecimal32(1, 8) < 100 -``` - -``` text -DB::Exception: Can't compare. -``` - -[Original article](https://clickhouse.tech/docs/en/data_types/decimal/) diff --git a/docs/en/sql_reference/data_types/domains/index.md b/docs/en/sql_reference/data_types/domains/index.md deleted file mode 100644 index d4496cf8d5b..00000000000 --- a/docs/en/sql_reference/data_types/domains/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Domains -toc_priority: 56 ---- - diff --git a/docs/en/sql_reference/data_types/enum.md b/docs/en/sql_reference/data_types/enum.md deleted file mode 100644 index e31bbed3426..00000000000 --- a/docs/en/sql_reference/data_types/enum.md +++ /dev/null @@ -1,130 +0,0 @@ ---- -toc_priority: 50 -toc_title: Enum ---- - -# Enum {#enum} - -Enumerated type consisting of named values. - -Named values must be declared as `'string' = integer` pairs. ClickHouse stores only numbers, but supports operations with the values through their names. - -ClickHouse supports: - -- 8-bit `Enum`. It can contain up to 256 values enumerated in the `[-128, 127]` range. -- 16-bit `Enum`. It can contain up to 65536 values enumerated in the `[-32768, 32767]` range. - -ClickHouse automatically chooses the type of `Enum` when data is inserted. You can also use `Enum8` or `Enum16` types to be sure in the size of storage. - -## Usage Examples {#usage-examples} - -Here we create a table with an `Enum8('hello' = 1, 'world' = 2)` type column: - -``` sql -CREATE TABLE t_enum -( - x Enum('hello' = 1, 'world' = 2) -) -ENGINE = TinyLog -``` - -Column `x` can only store values that are listed in the type definition: `'hello'` or `'world'`. If you try to save any other value, ClickHouse will raise an exception. 8-bit size for this `Enum` is chosen automatically. - -``` sql -INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') -``` - -``` text -Ok. -``` - -``` sql -INSERT INTO t_enum values('a') -``` - -``` text -Exception on client: -Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) -``` - -When you query data from the table, ClickHouse outputs the string values from `Enum`. - -``` sql -SELECT * FROM t_enum -``` - -``` text -┌─x─────┐ -│ hello │ -│ world │ -│ hello │ -└───────┘ -``` - -If you need to see the numeric equivalents of the rows, you must cast the `Enum` value to integer type. - -``` sql -SELECT CAST(x, 'Int8') FROM t_enum -``` - -``` text -┌─CAST(x, 'Int8')─┐ -│ 1 │ -│ 2 │ -│ 1 │ -└─────────────────┘ -``` - -To create an Enum value in a query, you also need to use `CAST`. - -``` sql -SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) -``` - -``` text -┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ -│ Enum8('a' = 1, 'b' = 2) │ -└─────────────────────────────────────────────────────┘ -``` - -## General Rules and Usage {#general-rules-and-usage} - -Each of the values is assigned a number in the range `-128 ... 127` for `Enum8` or in the range `-32768 ... 32767` for `Enum16`. All the strings and numbers must be different. An empty string is allowed. If this type is specified (in a table definition), numbers can be in an arbitrary order. However, the order does not matter. - -Neither the string nor the numeric value in an `Enum` can be [NULL](../../sql_reference/syntax.md). - -An `Enum` can be contained in [Nullable](nullable.md) type. So if you create a table using the query - -``` sql -CREATE TABLE t_enum_nullable -( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) -) -ENGINE = TinyLog -``` - -it can store not only `'hello'` and `'world'`, but `NULL`, as well. - -``` sql -INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) -``` - -In RAM, an `Enum` column is stored in the same way as `Int8` or `Int16` of the corresponding numerical values. - -When reading in text form, ClickHouse parses the value as a string and searches for the corresponding string from the set of Enum values. If it is not found, an exception is thrown. When reading in text format, the string is read and the corresponding numeric value is looked up. An exception will be thrown if it is not found. -When writing in text form, it writes the value as the corresponding string. If column data contains garbage (numbers that are not from the valid set), an exception is thrown. When reading and writing in binary form, it works the same way as for Int8 and Int16 data types. -The implicit default value is the value with the lowest number. - -During `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` and so on, Enums behave the same way as the corresponding numbers. For example, ORDER BY sorts them numerically. Equality and comparison operators work the same way on Enums as they do on the underlying numeric values. - -Enum values cannot be compared with numbers. Enums can be compared to a constant string. If the string compared to is not a valid value for the Enum, an exception will be thrown. The IN operator is supported with the Enum on the left-hand side and a set of strings on the right-hand side. The strings are the values of the corresponding Enum. - -Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. -However, the Enum has a natural `toString` function that returns its string value. - -Enum values are also convertible to numeric types using the `toT` function, where T is a numeric type. When T corresponds to the enum’s underlying numeric type, this conversion is zero-cost. -The Enum type can be changed without cost using ALTER, if only the set of values is changed. It is possible to both add and remove members of the Enum using ALTER (removing is safe only if the removed value has never been used in the table). As a safeguard, changing the numeric value of a previously defined Enum member will throw an exception. - -Using ALTER, it is possible to change an Enum8 to an Enum16 or vice versa, just like changing an Int8 to Int16. - -[Original article](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/en/sql_reference/data_types/fixedstring.md b/docs/en/sql_reference/data_types/fixedstring.md deleted file mode 100644 index 4c8ea65b278..00000000000 --- a/docs/en/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -toc_priority: 45 -toc_title: FixedString(N) ---- - -# Fixedstring {#fixedstring} - -A fixed-length string of `N` bytes (neither characters nor code points). - -To declare a column of `FixedString` type, use the following syntax: - -``` sql - FixedString(N) -``` - -Where `N` is a natural number. - -The `FixedString` type is efficient when data has the length of precisely `N` bytes. In all other cases, it is likely to reduce efficiency. - -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 … ). -- Binary representation of hashes (`FixedString(16)` for MD5, `FixedString(32)` for SHA256). - -To store UUID values, use the [UUID](uuid.md) data type. - -When inserting the data, ClickHouse: - -- Complements a string with null bytes if the string contains fewer than `N` bytes. -- Throws the `Too large value for FixedString(N)` exception if the string contains more than `N` bytes. - -When selecting the data, ClickHouse does not remove the null bytes at the end of the string. If you use the `WHERE` clause, you should add null bytes manually to match the `FixedString` value. The following example illustrates how to use the `WHERE` clause with `FixedString`. - -Let’s consider the following table with the single `FixedString(2)` column: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -The query `SELECT * FROM FixedStringTable WHERE a = 'b'` does not return any data as a result. We should complement the filter pattern with null bytes. - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -This behaviour differs from MySQL for the `CHAR` type (where strings are padded with spaces, and the spaces are removed for output). - -Note that the length of the `FixedString(N)` value is constant. The [length](../../sql_reference/functions/array_functions.md#array_functions-length) function returns `N` even if the `FixedString(N)` value is filled only with null bytes, but the [empty](../../sql_reference/functions/string_functions.md#empty) function returns `1` in this case. - -[Original article](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/en/sql_reference/data_types/nested_data_structures/nested.md b/docs/en/sql_reference/data_types/nested_data_structures/nested.md deleted file mode 100644 index 4c95f1fd2fc..00000000000 --- a/docs/en/sql_reference/data_types/nested_data_structures/nested.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -toc_priority: 57 -toc_title: Nested(Name1 Type1, Name2 Type2, ...) ---- - -# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) query. Each table row can correspond to any number of rows in a nested data structure. - -Example: - -``` sql -CREATE TABLE test.visits -( - CounterID UInt32, - StartDate Date, - Sign Int8, - IsNew UInt8, - VisitID UInt64, - UserID UInt64, - ... - Goals Nested - ( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32 - ), - ... -) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) -``` - -This example declares the `Goals` nested data structure, which contains data about conversions (goals reached). Each row in the ‘visits’ table can correspond to zero or any number of conversions. - -Only a single nesting level is supported. Columns of nested structures containing arrays are equivalent to multidimensional arrays, so they have limited support (there is no support for storing these columns in tables with the MergeTree engine). - -In most cases, when working with a nested data structure, its columns are specified with column names separated by a dot. These columns make up an array of matching types. All the column arrays of a single nested data structure have the same length. - -Example: - -``` sql -SELECT - Goals.ID, - Goals.EventTime -FROM test.visits -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ -│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ -│ [1073752] │ ['2014-03-17 00:28:25'] │ -│ [1073752] │ ['2014-03-17 10:46:20'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ -│ [] │ [] │ -│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ -│ [] │ [] │ -│ [] │ [] │ -│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ -└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -It is easiest to think of a nested data structure as a set of multiple column arrays of the same length. - -The only place where a SELECT query can specify the name of an entire nested data structure instead of individual columns is the ARRAY JOIN clause. For more information, see “ARRAY JOIN clause”. Example: - -``` sql -SELECT - Goal.ID, - Goal.EventTime -FROM test.visits -ARRAY JOIN Goals AS Goal -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goal.ID─┬──────Goal.EventTime─┐ -│ 1073752 │ 2014-03-17 16:38:10 │ -│ 591325 │ 2014-03-17 16:38:48 │ -│ 591325 │ 2014-03-17 16:42:27 │ -│ 1073752 │ 2014-03-17 00:28:25 │ -│ 1073752 │ 2014-03-17 10:46:20 │ -│ 1073752 │ 2014-03-17 13:59:20 │ -│ 591325 │ 2014-03-17 22:17:55 │ -│ 591325 │ 2014-03-17 22:18:07 │ -│ 591325 │ 2014-03-17 22:18:51 │ -│ 1073752 │ 2014-03-17 11:37:06 │ -└─────────┴─────────────────────┘ -``` - -You can’t perform SELECT for an entire nested data structure. You can only explicitly list individual columns that are part of it. - -For an INSERT query, you should pass all the component column arrays of a nested data structure separately (as if they were individual column arrays). During insertion, the system checks that they have the same length. - -For a DESCRIBE query, the columns in a nested data structure are listed separately in the same way. - -The ALTER query for elements in a nested data structure has limitations. - -[Original article](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/en/sql_reference/data_types/nullable.md b/docs/en/sql_reference/data_types/nullable.md deleted file mode 100644 index 7fd68592c4a..00000000000 --- a/docs/en/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -toc_priority: 54 -toc_title: Nullable ---- - -# Nullable(typename) {#data_type-nullable} - -Allows to store special marker ([NULL](../../sql_reference/syntax.md)) that denotes “missing value” alongside normal values allowed by `TypeName`. For example, a `Nullable(Int8)` type column can store `Int8` type values, and the rows that don’t have a value will store `NULL`. - -For a `TypeName`, you can’t use composite data types [Array](array.md) and [Tuple](tuple.md). Composite data types can contain `Nullable` type values, such as `Array(Nullable(Int8))`. - -A `Nullable` type field can’t be included in table indexes. - -`NULL` is the default value for any `Nullable` type, unless specified otherwise in the ClickHouse server configuration. - -## Storage Features {#storage-features} - -To store `Nullable` type values in a table column, ClickHouse uses a separate file with `NULL` masks in addition to normal file with values. Entries in masks file allow ClickHouse to distinguish between `NULL` and a default value of corresponding data type for each table row. Because of an additional file, `Nullable` column consumes additional storage space compared to a similar normal one. - -!!! info "Note" - Using `Nullable` almost always negatively affects performance, keep this in mind when designing your databases. - -## Usage Example {#usage-example} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y FROM t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/en/sql_reference/data_types/simpleaggregatefunction.md b/docs/en/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 100644 index 81036aec4c8..00000000000 --- a/docs/en/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1,34 +0,0 @@ -# SimpleAggregateFunction(name, types\_of\_arguments…) {#data-type-simpleaggregatefunction} - -`SimpleAggregateFunction` data type stores current value of the aggregate function, and does not store its full state as [`AggregateFunction`](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 don't have to store and process any extra data. - -The following aggregate functions are supported: - -- [`any`](../../sql_reference/aggregate_functions/reference.md#agg_function-any) -- [`anyLast`](../../sql_reference/aggregate_functions/reference.md#anylastx) -- [`min`](../../sql_reference/aggregate_functions/reference.md#agg_function-min) -- [`max`](../../sql_reference/aggregate_functions/reference.md#agg_function-max) -- [`sum`](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) -- [`groupBitAnd`](../../sql_reference/aggregate_functions/reference.md#groupbitand) -- [`groupBitOr`](../../sql_reference/aggregate_functions/reference.md#groupbitor) -- [`groupBitXor`](../../sql_reference/aggregate_functions/reference.md#groupbitxor) - - -Values of the `SimpleAggregateFunction(func, Type)` look and stored the same way as `Type`, so you do not need to apply functions with `-Merge`/`-State` suffixes. `SimpleAggregateFunction` has better performance than `AggregateFunction` with same aggregation function. - -**Parameters** - -- Name of the aggregate function. -- Types of the aggregate function arguments. - -**Example** - -``` sql -CREATE TABLE t -( - column1 SimpleAggregateFunction(sum, UInt64), - column2 SimpleAggregateFunction(any, String) -) ENGINE = ... -``` - -[Original article](https://clickhouse.tech/docs/en/data_types/simpleaggregatefunction/) diff --git a/docs/en/sql_reference/data_types/special_data_types/interval.md b/docs/en/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index 8b71e1301a6..00000000000 --- a/docs/en/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -toc_priority: 61 -toc_title: Interval ---- - -# Interval {#data-type-interval} - -The family of data types representing time and date intervals. The resulting types of the [INTERVAL](../../../sql_reference/operators.md#operator-interval) operator. - -!!! warning "Warning" - `Interval` data type values can’t be stored in tables. - -Structure: - -- Time interval as an unsigned integer value. -- Type of an interval. - -Supported interval types: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -For each interval type, there is a separate data type. For example, the `DAY` interval corresponds to the `IntervalDay` data type: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## Usage Remarks {#data-type-interval-usage-remarks} - -You can use `Interval`-type values in arithmetical operations with [Date](../../../sql_reference/data_types/date.md) and [DateTime](../../../sql_reference/data_types/datetime.md)-type values. For example, you can add 4 days to the current time: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -Intervals with different types can’t be combined. You can’t use intervals like `4 DAY 1 HOUR`. Specify intervals in units that are smaller or equal to the smallest unit of the interval, for example, the interval `1 day and an hour` interval can be expressed as `25 HOUR` or `90000 SECOND`. - -You can’t perform arithmetical operations with `Interval`-type values, but you can add intervals of different types consequently to values in `Date` or `DateTime` data types. For example: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -The following query causes an exception: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## See Also {#see-also} - -- [INTERVAL](../../../sql_reference/operators.md#operator-interval) operator -- [toInterval](../../../sql_reference/functions/type_conversion_functions.md#function-tointerval) type convertion functions diff --git a/docs/en/sql_reference/data_types/special_data_types/nothing.md b/docs/en/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index 054f7e2c5a8..00000000000 --- a/docs/en/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -toc_priority: 60 -toc_title: Nothing ---- - -# Nothing {#nothing} - -The only purpose of this data type is to represent cases where a value is not expected. So you can’t create a `Nothing` type value. - -For example, literal [NULL](../../../sql_reference/syntax.md#null-literal) has type of `Nullable(Nothing)`. See more about [Nullable](../../../sql_reference/data_types/nullable.md). - -The `Nothing` type can also used to denote empty arrays: - -``` sql -SELECT toTypeName(array()) -``` - -``` text -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/en/sql_reference/data_types/tuple.md b/docs/en/sql_reference/data_types/tuple.md deleted file mode 100644 index 4e73f85df63..00000000000 --- a/docs/en/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -toc_priority: 53 -toc_title: Tuple(T1, T2, ...) ---- - -# Tuple(t1, T2, …) {#tuplet1-t2} - -A tuple of elements, each having an individual [type](index.md#data_types). - -Tuples are used for temporary column grouping. Columns can be grouped when an IN expression is used in a query, and for specifying certain formal parameters of lambda functions. For more information, see the sections [IN operators](../../sql_reference/statements/select.md) and [Higher order functions](../../sql_reference/functions/higher_order_functions.md). - -Tuples can be the result of a query. In this case, for text formats other than JSON, values are comma-separated in brackets. In JSON formats, tuples are output as arrays (in square brackets). - -## Creating a Tuple {#creating-a-tuple} - -You can use a function to create a tuple: - -``` sql -tuple(T1, T2, ...) -``` - -Example of creating a tuple: - -``` sql -SELECT tuple(1,'a') AS x, toTypeName(x) -``` - -``` text -┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ -│ (1,'a') │ Tuple(UInt8, String) │ -└─────────┴───────────────────────────┘ -``` - -## Working With Data Types {#working-with-data-types} - -When creating a tuple on the fly, ClickHouse automatically detects the type of each argument as the minimum of the types which can store the argument value. If the argument is [NULL](../../sql_reference/syntax.md#null-literal), the type of the tuple element is [Nullable](nullable.md). - -Example of automatic data type detection: - -``` sql -SELECT tuple(1, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ -│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ -└──────────┴─────────────────────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/en/sql_reference/data_types/uuid.md b/docs/en/sql_reference/data_types/uuid.md deleted file mode 100644 index 140f86ac464..00000000000 --- a/docs/en/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -toc_priority: 46 -toc_title: UUID ---- - -# UUID {#uuid-data-type} - -A universally unique identifier (UUID) is a 16-byte number used to identify records. For detailed information about the UUID, see [Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -The example of UUID type value is represented below: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -If you do not specify the UUID column value when inserting a new record, the UUID value is filled with zero: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## How To Generate {#how-to-generate} - -To generate the UUID value, ClickHouse provides the [generateUUIDv4](../../sql_reference/functions/uuid_functions.md) function. - -## Usage Example {#usage-example} - -**Example 1** - -This example demonstrates creating a table with the UUID type column and inserting a value into the table. - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**Example 2** - -In this example, the UUID column value is not specified when inserting a new record. - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## Restrictions {#restrictions} - -The UUID data type only supports functions which [String](string.md) data type also supports (for example, [min](../../sql_reference/aggregate_functions/reference.md#agg_function-min), [max](../../sql_reference/aggregate_functions/reference.md#agg_function-max), and [count](../../sql_reference/aggregate_functions/reference.md#agg_function-count)). - -The UUID data type is not supported by arithmetic operations (for example, [abs](../../sql_reference/functions/arithmetic_functions.md#arithm_func-abs)) or aggregate functions, such as [sum](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) and [avg](../../sql_reference/aggregate_functions/reference.md#agg_function-avg). - -[Original article](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index 446946e927e..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -toc_priority: 39 -toc_title: General Description ---- - -# External Dictionaries {#dicts-external-dicts} - -You can add your own dictionaries from various data sources. The data source for a dictionary can be a local text or executable file, an HTTP(s) resource, or another DBMS. For more information, see “[Sources for external dictionaries](external_dicts_dict_sources.md)”. - -ClickHouse: - -- Fully or partially stores dictionaries in RAM. -- Periodically updates dictionaries and dynamically loads missing values. In other words, dictionaries can be loaded dynamically. -- Allows to create external dictionaries with xml files or [DDL queries](../../statements/create.md#create-dictionary-query). - -The configuration of external dictionaries can be located in one or more xml-files. The path to the configuration is specified in the [dictionaries\_config](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_config) parameter. - -Dictionaries can be loaded at server startup or at first use, depending on the [dictionaries\_lazy\_load](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) setting. - -The dictionary configuration file has the following format: - -``` xml - - An optional element with any content. Ignored by the ClickHouse server. - - - /etc/metrika.xml - - - - - - - - -``` - -You can [configure](external_dicts_dict.md) any number of dictionaries in the same file. - -[DDL queries for dictionaries](../../statements/create.md#create-dictionary-query) doesn’t require any additional records in server configuration. They allow to work with dictionaries as first-class entities, like tables or views. - -!!! attention "Attention" - You can convert values for a small dictionary by describing it in a `SELECT` query (see the [transform](../../../sql_reference/functions/other_functions.md) function). This functionality is not related to external dictionaries. - -## See Also {#ext-dicts-see-also} - -- [Configuring an External Dictionary](external_dicts_dict.md) -- [Storing Dictionaries in Memory](external_dicts_dict_layout.md) -- [Dictionary Updates](external_dicts_dict_lifetime.md) -- [Sources of External Dictionaries](external_dicts_dict_sources.md) -- [Dictionary Key and Fields](external_dicts_dict_structure.md) -- [Functions for Working with External Dictionaries](../../../sql_reference/functions/ext_dict_functions.md) - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index 16e9a4ada39..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -toc_priority: 40 -toc_title: Configuring an External Dictionary ---- - -# Configuring an External Dictionary {#dicts-external-dicts-dict} - -If dictionary is configured using xml file, than dictionary configuration has the following structure: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -Corresponding [DDL-query](../../statements/create.md#create-dictionary-query) has the following structure: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. -- [source](external_dicts_dict_sources.md) — Source of the dictionary. -- [layout](external_dicts_dict_layout.md) — Dictionary layout in memory. -- [structure](external_dicts_dict_structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. -- [lifetime](external_dicts_dict_lifetime.md) — Frequency of dictionary updates. - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index b56245539cb..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -toc_priority: 45 -toc_title: Hierarchical dictionaries ---- - -# Hierarchical Dictionaries {#hierarchical-dictionaries} - -ClickHouse supports hierarchical dictionaries with a [numeric key](external_dicts_dict_structure.md#ext_dict-numeric-key). - -Look at the following hierarchical structure: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -This hierarchy can be expressed as the following dictionary table. - -| region\_id | parent\_region | region\_name | -|--------|----------|---------| -| 1 | 0 | Russia | -| 2 | 1 | Moscow | -| 3 | 2 | Center | -| 4 | 0 | Great Britain | -| 5 | 4 | London | - -This table contains a column `parent_region` that contains the key of the nearest parent for the element. - -ClickHouse supports the [hierarchical](external_dicts_dict_structure.md#hierarchical-dict-attr) property for [external dictionary](index.md) attributes. This property allows you to configure the hierarchical dictionary similar to described above. - -The [dictGetHierarchy](../../../sql_reference/functions/ext_dict_functions.md#dictgethierarchy) function allows you to get the parent chain of an element. - -For our example, the structure of dictionary can be the following: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index 663cde42f9b..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,371 +0,0 @@ ---- -toc_priority: 41 -toc_title: Storing Dictionaries in Memory ---- - -# Storing Dictionaries In Memory {#dicts-external-dicts-dict-layout} - -There are a variety of ways to store dictionaries in memory. - -We recommend [flat](#flat), [hashed](#dicts-external_dicts_dict_layout-hashed) and [complex\_key\_hashed](#complex-key-hashed). which provide optimal processing speed. - -Caching is not recommended because of potentially poor performance and difficulties in selecting optimal parameters. Read more in the section “[cache](#cache)”. - -There are several ways to improve dictionary performance: - -- Call the function for working with the dictionary after `GROUP BY`. -- Mark attributes to extract as injective. An attribute is called injective if different attribute values correspond to different keys. So when `GROUP BY` uses a function that fetches an attribute value by the key, this function is automatically taken out of `GROUP BY`. - -ClickHouse generates an exception for errors with dictionaries. Examples of errors: - -- The dictionary being accessed could not be loaded. -- Error querying a `cached` dictionary. - -You can view the list of external dictionaries and their statuses in the `system.dictionaries` table. - -The configuration looks like this: - -``` xml - - - ... - - - - - - ... - - -``` - -Corresponding [DDL-query](../../statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## Ways To Store Dictionaries In Memory {#ways-to-store-dictionaries-in-memory} - -- [flat](#flat) -- [hashed](#dicts-external_dicts_dict_layout-hashed) -- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) -- [cache](#cache) -- [range\_hashed](#range-hashed) -- [complex\_key\_hashed](#complex-key-hashed) -- [complex\_key\_cache](#complex-key-cache) -- [ip\_trie](#ip-trie) - -### flat {#flat} - -The dictionary is completely stored in memory in the form of flat arrays. How much memory does the dictionary use? The amount is proportional to the size of the largest key (in space used). - -The dictionary key has the `UInt64` type and the value is limited to 500,000. If a larger key is discovered when creating the dictionary, ClickHouse throws an exception and does not create the dictionary. - -All types of sources are supported. When updating, data (from a file or from a table) is read in its entirety. - -This method provides the best performance among all available methods of storing the dictionary. - -Configuration example: - -``` xml - - - -``` - -or - -``` sql -LAYOUT(FLAT()) -``` - -### hashed {#dicts-external_dicts_dict_layout-hashed} - -The dictionary is completely stored in memory in the form of a hash table. The dictionary can contain any number of elements with any identifiers In practice, the number of keys can reach tens of millions of items. - -All types of sources are supported. When updating, data (from a file or from a table) is read in its entirety. - -Configuration example: - -``` xml - - - -``` - -or - -``` sql -LAYOUT(HASHED()) -``` - -### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} - -Similar to `hashed`, but uses less memory in favor more CPU usage. - -Configuration example: - -``` xml - - - -``` - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### complex\_key\_hashed {#complex-key-hashed} - -This type of storage is for use with composite [keys](external_dicts_dict_structure.md). Similar to `hashed`. - -Configuration example: - -``` xml - - - -``` - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### range\_hashed {#range-hashed} - -The dictionary is stored in memory in the form of a hash table with an ordered array of ranges and their corresponding values. - -This storage method works the same way as hashed and allows using date/time (arbitrary numeric type) ranges in addition to the key. - -Example: The table contains discounts for each advertiser in the format: - -``` text -+---------|-------------|-------------|------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------|-------------|-------------|------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------|-------------|-------------|------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------|-------------|-------------|------+ -``` - -To use a sample for date ranges, define the `range_min` and `range_max` elements in the [structure](external_dicts_dict_structure.md). These elements must contain elements `name` and`type` (if `type` is not specified, the default type will be used - Date). `type` can be any numeric type (Date / DateTime / UInt64 / Int32 / others). - -Example: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -or - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -To work with these dictionaries, you need to pass an additional argument to the `dictGetT` function, for which a range is selected: - -``` sql -dictGetT('dict_name', 'attr_name', id, date) -``` - -This function returns the value for the specified `id`s and the date range that includes the passed date. - -Details of the algorithm: - -- If the `id` is not found or a range is not found for the `id`, it returns the default value for the dictionary. -- If there are overlapping ranges, you can use any. -- If the range delimiter is `NULL` or an invalid date (such as 1900-01-01 or 2039-01-01), the range is left open. The range can be open on both sides. - -Configuration example: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -or - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### cache {#cache} - -The dictionary is stored in a cache that has a fixed number of cells. These cells contain frequently used elements. - -When searching for a dictionary, the cache is searched first. For each block of data, all keys that are not found in the cache or are outdated are requested from the source using `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. The received data is then written to the cache. - -For cache dictionaries, the expiration [lifetime](external_dicts_dict_lifetime.md) of data in the cache can be set. If more time than `lifetime` has passed since loading the data in a cell, the cell’s value is not used, and it is re-requested the next time it needs to be used. -This is the least effective of all the ways to store dictionaries. The speed of the cache depends strongly on correct settings and the usage scenario. A cache type dictionary performs well only when the hit rates are high enough (recommended 99% and higher). You can view the average hit rate in the `system.dictionaries` table. - -To improve cache performance, use a subquery with `LIMIT`, and call the function with the dictionary externally. - -Supported [sources](external_dicts_dict_sources.md): MySQL, ClickHouse, executable, HTTP. - -Example of settings: - -``` xml - - - - 1000000000 - - -``` - -or - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -Set a large enough cache size. You need to experiment to select the number of cells: - -1. Set some value. -2. Run queries until the cache is completely full. -3. Assess memory consumption using the `system.dictionaries` table. -4. Increase or decrease the number of cells until the required memory consumption is reached. - -!!! warning "Warning" - Do not use ClickHouse as a source, because it is slow to process queries with random reads. - -### complex\_key\_cache {#complex-key-cache} - -This type of storage is for use with composite [keys](external_dicts_dict_structure.md). Similar to `cache`. - -### ip\_trie {#ip-trie} - -This type of storage is for mapping network prefixes (IP addresses) to metadata such as ASN. - -Example: The table contains network prefixes and their corresponding AS number and country code: - -``` text - +-----------|-----|------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------|-----|------+ - | 2620:0:870::/48 | 3856 | US | - +-----------|-----|------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------|-----|------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------|-----|------+ -``` - -When using this type of layout, the structure must have a composite key. - -Example: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -or - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -The key must have only one String type attribute that contains an allowed IP prefix. Other types are not supported yet. - -For queries, you must use the same functions (`dictGetT` with a tuple) as for dictionaries with composite keys: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -The function takes either `UInt32` for IPv4, or `FixedString(16)` for IPv6: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -Other types are not supported yet. The function returns the attribute for the prefix that corresponds to this IP address. If there are overlapping prefixes, the most specific one is returned. - -Data is stored in a `trie`. It must completely fit into RAM. - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index 97d5b6e4474..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -toc_priority: 42 -toc_title: Dictionary Updates ---- - -# Dictionary Updates {#dictionary-updates} - -ClickHouse periodically updates the dictionaries. The update interval for fully downloaded dictionaries and the invalidation interval for cached dictionaries are defined in the `` tag in seconds. - -Dictionary updates (other than loading for first use) do not block queries. During updates, the old version of a dictionary is used. If an error occurs during an update, the error is written to the server log, and queries continue using the old version of dictionaries. - -Example of settings: - -``` xml - - ... - 300 - ... - -``` - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -Setting `0` (`LIFETIME(0)`) prevents dictionaries from updating. - -You can set a time interval for upgrades, and ClickHouse will choose a uniformly random time within this range. This is necessary in order to distribute the load on the dictionary source when upgrading on a large number of servers. - -Example of settings: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -or - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -If `0` and `0`, ClickHouse does not reload the dictionary by timeout. -In this case, ClickHouse can reload the dictionary earlier if the dictionary configuration file was changed or the `SYSTEM RELOAD DICTIONARY` command was executed. - -When upgrading the dictionaries, the ClickHouse server applies different logic depending on the type of [source](external_dicts_dict_sources.md): - -When upgrading the dictionaries, the ClickHouse server applies different logic depending on the type of [source](external_dicts_dict_sources.md): - -- For a text file, it checks the time of modification. If the time differs from the previously recorded time, the dictionary is updated. -- For MyISAM tables, the time of modification is checked using a `SHOW TABLE STATUS` query. -- Dictionaries from other sources are updated every time by default. - -For MySQL (InnoDB), ODBC and ClickHouse sources, you can set up a query that will update the dictionaries only if they really changed, rather than each time. To do this, follow these steps: - -- The dictionary table must have a field that always changes when the source data is updated. -- The settings of the source must specify a query that retrieves the changing field. The ClickHouse server interprets the query result as a row, and if this row has changed relative to its previous state, the dictionary is updated. Specify the query in the `` field in the settings for the [source](external_dicts_dict_sources.md). - -Example of settings: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -or - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index a5c40226f85..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,627 +0,0 @@ ---- -toc_priority: 43 -toc_title: Sources of External Dictionaries ---- - -# Sources Of External Dictionaries {#dicts-external-dicts-dict-sources} - -An external dictionary can be connected from many different sources. - -If dictionary is configured using xml-file, the configuration looks like this: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -In case of [DDL-query](../../statements/create.md#create-dictionary-query), equal configuration will looks like: - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -The source is configured in the `source` section. - -For source types [Local file](#dicts-external_dicts_dict_sources-local_file), [Executable file](#dicts-external_dicts_dict_sources-executable), [HTTP(s)](#dicts-external_dicts_dict_sources-http), [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) -optional settings are available: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - - 0 - - -``` -or -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -SETTINGS(format_csv_allow_single_quotes = 0) -``` - - -Types of sources (`source_type`): - -- [Local file](#dicts-external_dicts_dict_sources-local_file) -- [Executable file](#dicts-external_dicts_dict_sources-executable) -- [HTTP(s)](#dicts-external_dicts_dict_sources-http) -- DBMS - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) - - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) - - [Redis](#dicts-external_dicts_dict_sources-redis) - -## Local File {#dicts-external_dicts_dict_sources-local_file} - -Example of settings: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -or - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Setting fields: - -- `path` – The absolute path to the file. -- `format` – The file format. All the formats described in “[Formats](../../../interfaces/formats.md#formats)” are supported. - -## Executable File {#dicts-external_dicts_dict_sources-executable} - -Working with executable files depends on [how the dictionary is stored in memory](external_dicts_dict_layout.md). If the dictionary is stored using `cache` and `complex_key_cache`, ClickHouse requests the necessary keys by sending a request to the executable file’s STDIN. Otherwise, ClickHouse starts executable file and treats its output as dictionary data. - -Example of settings: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -or - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Setting fields: - -- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). -- `format` – The file format. All the formats described in “[Formats](../../../interfaces/formats.md#formats)” are supported. - -## Http(s) {#dicts-external_dicts_dict_sources-http} - -Working with an HTTP(s) server depends on [how the dictionary is stored in memory](external_dicts_dict_layout.md). If the dictionary is stored using `cache` and `complex_key_cache`, ClickHouse requests the necessary keys by sending a request via the `POST` method. - -Example of settings: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -or - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -In order for ClickHouse to access an HTTPS resource, you must [configure openSSL](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-openssl) in the server configuration. - -Setting fields: - -- `url` – The source URL. -- `format` – The file format. All the formats described in “[Formats](../../../interfaces/formats.md#formats)” are supported. -- `credentials` – Basic HTTP authentication. Optional parameter. - - `user` – Username required for the authentication. - - `password` – Password required for the authentication. -- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. - - `header` – Single HTTP header entry. - - `name` – Identifiant name used for the header send on the request. - - `value` – Value set for a specific identifiant name. - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -You can use this method to connect any database that has an ODBC driver. - -Example of settings: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -or - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -Setting fields: - -- `db` – Name of the database. Omit it if the database name is set in the `` parameters. -- `table` – Name of the table and schema if exists. -- `connection_string` – Connection string. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Updating dictionaries](external_dicts_dict_lifetime.md). - -ClickHouse receives quoting symbols from ODBC-driver and quote all settings in queries to driver, so it’s necessary to set table name accordingly to table name case in database. - -If you have a problems with encodings when using Oracle, see the corresponding [FAQ](../../../faq/general.md#oracle-odbc-encodings) article. - -### Known Vulnerability Of the ODBC Dictionary Functionality {#known-vulnerability-of-the-odbc-dictionary-functionality} - -!!! attention "Attention" - When connecting to the database through the ODBC driver connection parameter `Servername` can be substituted. In this case values of `USERNAME` and `PASSWORD` from `odbc.ini` are sent to the remote server and can be compromised. - -**Example of insecure use** - -Let’s configure unixODBC for PostgreSQL. Content of `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -If you then make a query such as - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -ODBC driver will send values of `USERNAME` and `PASSWORD` from `odbc.ini` to `some-server.com`. - -### Example Of Connecting Postgresql {#example-of-connecting-postgresql} - -Ubuntu OS. - -Installing unixODBC and the ODBC driver for PostgreSQL: - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -Configuring `/etc/odbc.ini` (or `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -The dictionary configuration in ClickHouse: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -or - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) -``` - -You may need to edit `odbc.ini` to specify the full path to the library with the driver `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### Example Of Connecting MS SQL Server {#example-of-connecting-ms-sql-server} - -Ubuntu OS. - -Installing the driver: : - -``` bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -Configuring the driver: - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -Configuring the dictionary in ClickHouse: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -or - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## DBMS {#dbms} - -### Mysql {#dicts-external_dicts_dict_sources-mysql} - -Example of settings: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -or - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -Setting fields: - -- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). - -- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `replica` – Section of replica configurations. There can be multiple sections. - - - `replica/host` – The MySQL host. - - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. - -- `db` – Name of the database. - -- `table` – Name of the table. - -- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` clause in MySQL, for example, `id > 10 AND id < 20`. Optional parameter. - -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Updating dictionaries](external_dicts_dict_lifetime.md). - -MySQL can be connected on a local host via sockets. To do this, set `host` and `socket`. - -Example of settings: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -or - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### ClickHouse {#dicts-external_dicts_dict_sources-clickhouse} - -Example of settings: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -or - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -Setting fields: - -- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [Distributed](../../../engines/table_engines/special/distributed.md) table and enter it in subsequent configurations. -- `port` – The port on the ClickHouse server. -- `user` – Name of the ClickHouse user. -- `password` – Password of the ClickHouse user. -- `db` – Name of the database. -- `table` – Name of the table. -- `where` – The selection criteria. May be omitted. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Updating dictionaries](external_dicts_dict_lifetime.md). - -### Mongodb {#dicts-external_dicts_dict_sources-mongodb} - -Example of settings: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -or - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -Setting fields: - -- `host` – The MongoDB host. -- `port` – The port on the MongoDB server. -- `user` – Name of the MongoDB user. -- `password` – Password of the MongoDB user. -- `db` – Name of the database. -- `collection` – Name of the collection. - -### Redis {#dicts-external_dicts_dict_sources-redis} - -Example of settings: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -or - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -Setting fields: - -- `host` – The Redis host. -- `port` – The port on the Redis server. -- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` is for simple sources and for hashed single key sources, `hash_map` is for hashed sources with two keys. Ranged sources and cache sources with complex key are unsupported. May be omitted, default value is `simple`. -- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index 460320e6fa3..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -toc_priority: 44 -toc_title: Dictionary Key and Fields ---- - -# Dictionary Key and Fields {#dictionary-key-and-fields} - -The `` clause describes the dictionary key and fields available for queries. - -XML description: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -Attributes are described in the elements: - -- `` — [Key column](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [Data column](external_dicts_dict_structure.md#ext_dict_structure-attributes). There can be a multiple number of attributes. - -DDL query: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -Attributes are described in the query body: - -- `PRIMARY KEY` — [Key column](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [Data column](external_dicts_dict_structure.md#ext_dict_structure-attributes). There can be a multiple number of attributes. - -## Key {#ext_dict_structure-key} - -ClickHouse supports the following types of keys: - -- Numeric key. `UInt64`. Defined in the `` tag or using `PRIMARY KEY` keyword. -- Composite key. Set of values of different types. Defined in the tag `` or `PRIMARY KEY` keyword. - -An xml structure can contain either `` or ``. DDL-query must contain single `PRIMARY KEY`. - -!!! warning "Warning" - You must not describe key as an attribute. - -### Numeric Key {#ext_dict-numeric-key} - -Type: `UInt64`. - -Configuration example: - -``` xml - - Id - -``` - -Configuration fields: - -- `name` – The name of the column with keys. - -For DDL-query: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – The name of the column with keys. - -### Composite Key {#composite-key} - -The key can be a `tuple` from any types of fields. The [layout](external_dicts_dict_layout.md) in this case must be `complex_key_hashed` or `complex_key_cache`. - -!!! tip "Tip" - A composite key can consist of a single element. This makes it possible to use a string as the key, for instance. - -The key structure is set in the element ``. Key fields are specified in the same format as the dictionary [attributes](external_dicts_dict_structure.md). Example: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -or - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -For a query to the `dictGet*` function, a tuple is passed as the key. Example: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## Attributes {#ext_dict_structure-attributes} - -Configuration example: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -or - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -Configuration fields: - -| Tag | Description | Required | -|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------| -| `name` | Column name. | Yes | -| `type` | ClickHouse data type.
ClickHouse tries to cast value from dictionary to the specified data type. For example, for MySQL, the field might be `TEXT`, `VARCHAR`, or `BLOB` in the MySQL source table, but it can be uploaded as `String` in ClickHouse.
[Nullable](../../../sql_reference/data_types/nullable.md) is not supported. | Yes | -| `null_value` | Default value for a non-existing element.
In the example, it is an empty string. You cannot use `NULL` in this field. | Yes | -| `expression` | [Expression](../../syntax.md#syntax-expressions) that ClickHouse executes on the value.
The expression can be a column name in the remote SQL database. Thus, you can use it to create an alias for the remote column.

Default value: no expression. | No | -| `hierarchical` | If `true`, the attribute contains the value of a parent key for the current key. See [Hierarchical Dictionaries](external_dicts_dict_hierarchical.md).

Default value: `false`. | No | -| `injective` | Flag that shows whether the `id -> attribute` image is [injective](https://en.wikipedia.org/wiki/Injective_function).
If `true`, ClickHouse can automatically place after the `GROUP BY` clause the requests to dictionaries with injection. Usually it significantly reduces the amount of such requests.

Default value: `false`. | No | -| `is_object_id` | Flag that shows whether the query is executed for a MongoDB document by `ObjectID`.

Default value: `false`. | No | - -## See Also {#see-also} - -- [Functions for working with external dictionaries](../../../sql_reference/functions/ext_dict_functions.md). - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/en/sql_reference/dictionaries/external_dictionaries/index.md b/docs/en/sql_reference/dictionaries/external_dictionaries/index.md deleted file mode 100644 index 9af8b4f2f12..00000000000 --- a/docs/en/sql_reference/dictionaries/external_dictionaries/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: External Dictionaries -toc_priority: 37 ---- - diff --git a/docs/en/sql_reference/dictionaries/index.md b/docs/en/sql_reference/dictionaries/index.md deleted file mode 100644 index 9806b27ed9b..00000000000 --- a/docs/en/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -toc_folder_title: Dictionaries -toc_priority: 35 -toc_title: Introduction ---- - -# Dictionaries {#dictionaries} - -A dictionary is a mapping (`key -> attributes`) that is convenient for various types of reference lists. - -ClickHouse supports special functions for working with dictionaries that can be used in queries. It is easier and more efficient to use dictionaries with functions than a `JOIN` with reference tables. - -[NULL](../syntax.md#null) values can’t be stored in a dictionary. - -ClickHouse supports: - -- [Built-in dictionaries](internal_dicts.md#internal_dicts) with a specific [set of functions](../../sql_reference/functions/ym_dict_functions.md). -- [Plug-in (external) dictionaries](external_dictionaries/external_dicts.md) with a [net of functions](../../sql_reference/functions/ext_dict_functions.md). - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/en/sql_reference/dictionaries/internal_dicts.md b/docs/en/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index 327206c9672..00000000000 --- a/docs/en/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -toc_priority: 39 -toc_title: Internal Dictionaries ---- - -# Internal dictionaries {#internal_dicts} - -ClickHouse contains a built-in feature for working with a geobase. - -This allows you to: - -- Use a region’s ID to get its name in the desired language. -- Use a region’s ID to get the ID of a city, area, federal district, country, or continent. -- Check whether a region is part of another region. -- Get a chain of parent regions. - -All the functions support “translocality,” the ability to simultaneously use different perspectives on region ownership. For more information, see the section “Functions for working with Yandex.Metrica dictionaries”. - -The internal dictionaries are disabled in the default package. -To enable them, uncomment the parameters `path_to_regions_hierarchy_file` and `path_to_regions_names_files` in the server configuration file. - -The geobase is loaded from text files. - -Place the `regions_hierarchy*.txt` files into the `path_to_regions_hierarchy_file` directory. This configuration parameter must contain the path to the `regions_hierarchy.txt` file (the default regional hierarchy), and the other files (`regions_hierarchy_ua.txt`) must be located in the same directory. - -Put the `regions_names_*.txt` files in the `path_to_regions_names_files` directory. - -You can also create these files yourself. The file format is as follows: - -`regions_hierarchy*.txt`: TabSeparated (no header), columns: - -- region ID (`UInt32`) -- parent region ID (`UInt32`) -- region type (`UInt8`): 1 - continent, 3 - country, 4 - federal district, 5 - region, 6 - city; other types don’t have values -- population (`UInt32`) — optional column - -`regions_names_*.txt`: TabSeparated (no header), columns: - -- region ID (`UInt32`) -- region name (`String`) — Can’t contain tabs or line feeds, even escaped ones. - -A flat array is used for storing in RAM. For this reason, IDs shouldn’t be more than a million. - -Dictionaries can be updated without restarting the server. However, the set of available dictionaries is not updated. -For updates, the file modification times are checked. If a file has changed, the dictionary is updated. -The interval to check for changes is configured in the `builtin_dictionaries_reload_interval` parameter. -Dictionary updates (other than loading at first use) do not block queries. During updates, queries use the old versions of dictionaries. If an error occurs during an update, the error is written to the server log, and queries continue using the old version of dictionaries. - -We recommend periodically updating the dictionaries with the geobase. During an update, generate new files and write them to a separate location. When everything is ready, rename them to the files used by the server. - -There are also functions for working with OS identifiers and Yandex.Metrica search engines, but they shouldn’t be used. - -[Original article](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/en/sql_reference/functions/arithmetic_functions.md b/docs/en/sql_reference/functions/arithmetic_functions.md deleted file mode 100644 index 36cb6e9ada9..00000000000 --- a/docs/en/sql_reference/functions/arithmetic_functions.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -toc_priority: 35 -toc_title: Arithmetic ---- - -# Arithmetic functions {#arithmetic-functions} - -For all arithmetic functions, the result type is calculated as the smallest number type that the result fits in, if there is such a type. The minimum is taken simultaneously based on the number of bits, whether it is signed, and whether it floats. If there are not enough bits, the highest bit type is taken. - -Example: - -``` sql -SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) -``` - -``` text -┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ -│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ -└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ -``` - -Arithmetic functions work for any pair of types from UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32, or Float64. - -Overflow is produced the same way as in C++. - -## plus(a, b), a + b operator {#plusa-b-a-b-operator} - -Calculates the sum of the numbers. -You can also add integer numbers with a date or date and time. In the case of a date, adding an integer means adding the corresponding number of days. For a date with time, it means adding the corresponding number of seconds. - -## minus(a, b), a - b operator {#minusa-b-a-b-operator} - -Calculates the difference. The result is always signed. - -You can also calculate integer numbers from a date or date with time. The idea is the same – see above for ‘plus’. - -## multiply(a, b), a \* b operator {#multiplya-b-a-b-operator} - -Calculates the product of the numbers. - -## divide(a, b), a / b operator {#dividea-b-a-b-operator} - -Calculates the quotient of the numbers. The result type is always a floating-point type. -It is not integer division. For integer division, use the ‘intDiv’ function. -When dividing by zero you get ‘inf’, ‘-inf’, or ‘nan’. - -## intDiv(a, b) {#intdiva-b} - -Calculates the quotient of the numbers. Divides into integers, rounding down (by the absolute value). -An exception is thrown when dividing by zero or when dividing a minimal negative number by minus one. - -## intDivOrZero(a, b) {#intdivorzeroa-b} - -Differs from ‘intDiv’ in that it returns zero when dividing by zero or when dividing a minimal negative number by minus one. - -## modulo(a, b), a % b operator {#moduloa-b-a-b-operator} - -Calculates the remainder after division. -If arguments are floating-point numbers, they are pre-converted to integers by dropping the decimal portion. -The remainder is taken in the same sense as in C++. Truncated division is used for negative numbers. -An exception is thrown when dividing by zero or when dividing a minimal negative number by minus one. - -## moduloOrZero(a, b) {#moduloorzeroa-b} - -Differs from ‘modulo’ in that it returns zero when the divisor is zero. - -## negate(a), -a operator {#negatea-a-operator} - -Calculates a number with the reverse sign. The result is always signed. - -## abs(a) {#arithm_func-abs} - -Calculates the absolute value of the number (a). That is, if a \< 0, it returns -a. For unsigned types it doesn’t do anything. For signed integer types, it returns an unsigned number. - -## gcd(a, b) {#gcda-b} - -Returns the greatest common divisor of the numbers. -An exception is thrown when dividing by zero or when dividing a minimal negative number by minus one. - -## lcm(a, b) {#lcma-b} - -Returns the least common multiple of the numbers. -An exception is thrown when dividing by zero or when dividing a minimal negative number by minus one. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/en/sql_reference/functions/array_functions.md b/docs/en/sql_reference/functions/array_functions.md deleted file mode 100644 index 77a955fa18b..00000000000 --- a/docs/en/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,1058 +0,0 @@ ---- -toc_priority: 46 -toc_title: Working with Arrays ---- - -# Functions for working with arrays {#functions-for-working-with-arrays} - -## empty {#function-empty} - -Returns 1 for an empty array, or 0 for a non-empty array. -The result type is UInt8. -The function also works for strings. - -## notEmpty {#function-notempty} - -Returns 0 for an empty array, or 1 for a non-empty array. -The result type is UInt8. -The function also works for strings. - -## length {#array_functions-length} - -Returns the number of items in the array. -The result type is UInt64. -The function also works for strings. - -## emptyArrayUInt8, emptyArrayUInt16, emptyArrayUInt32, emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## emptyArrayInt8, emptyArrayInt16, emptyArrayInt32, emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} - -## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} - -## emptyArrayString {#emptyarraystring} - -Accepts zero arguments and returns an empty array of the appropriate type. - -## emptyArrayToSingle {#emptyarraytosingle} - -Accepts an empty array and returns a one-element array that is equal to the default value. - -## range(end), range(start, end \[, step\]) {#rangeend-rangestart-end-step} - -Returns an array of numbers from start to end-1 by step. -If the argument `start` is not specified, defaults to 0. -If the argument `step` is not specified, defaults to 1. -It behaviors almost like pythonic `range`. But the difference is that all the arguments type must be `UInt` numbers. -Just in case, an exception is thrown if arrays with a total length of more than 100,000,000 elements are created in a data block. - -## array(x1, …), operator \[x1, …\] {#arrayx1-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). -Returns an ‘Array(T)’ type result, where ‘T’ is the smallest common type out of the passed arguments. - -## arrayConcat {#arrayconcat} - -Combines arrays passed as arguments. - -``` sql -arrayConcat(arrays) -``` - -**Parameters** - -- `arrays` – Arbitrary number of arguments of [Array](../../sql_reference/data_types/array.md) type. - **Example** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,3,4,5,6] │ -└───────────────┘ -``` - -## arrayElement(arr, n), operator arr\[n\] {#arrayelementarr-n-operator-arrn} - -Get the element with the index `n` from the array `arr`. `n` must be any integer type. -Indexes in an array begin from one. -Negative indexes are supported. In this case, it selects the corresponding element numbered from the end. For example, `arr[-1]` is the last item in the array. - -If the index falls outside of the bounds of an array, it returns some default value (0 for numbers, an empty string for strings, etc.), except for the case with a non-constant array and a constant index 0 (in this case there will be an error `Array indices are 1-based`). - -## has(arr, elem) {#hasarr-elem} - -Checks whether the ‘arr’ array has the ‘elem’ element. -Returns 0 if the the element is not in the array, or 1 if it is. - -`NULL` is processed as a value. - -``` sql -SELECT has([1, 2, NULL], NULL) -``` - -``` text -┌─has([1, 2, NULL], NULL)─┐ -│ 1 │ -└─────────────────────────┘ -``` - -## hasAll {#hasall} - -Checks whether one array is a subset of another. - -``` sql -hasAll(set, subset) -``` - -**Parameters** - -- `set` – Array of any type with a set of elements. -- `subset` – Array of any type with elements that should be tested to be a subset of `set`. - -**Return values** - -- `1`, if `set` contains all of the elements from `subset`. -- `0`, otherwise. - -**Peculiar properties** - -- An empty array is a subset of any array. -- `Null` processed as a value. -- Order of values in both of arrays doesn’t matter. - -**Examples** - -`SELECT hasAll([], [])` returns 1. - -`SELECT hasAll([1, Null], [Null])` returns 1. - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` returns 1. - -`SELECT hasAll(['a', 'b'], ['a'])` returns 1. - -`SELECT hasAll([1], ['a'])` returns 0. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` returns 0. - -## hasAny {#hasany} - -Checks whether two arrays have intersection by some elements. - -``` sql -hasAny(array1, array2) -``` - -**Parameters** - -- `array1` – Array of any type with a set of elements. -- `array2` – Array of any type with a set of elements. - -**Return values** - -- `1`, if `array1` and `array2` have one similar element at least. -- `0`, otherwise. - -**Peculiar properties** - -- `Null` processed as a value. -- Order of values in both of arrays doesn’t matter. - -**Examples** - -`SELECT hasAny([1], [])` returns `0`. - -`SELECT hasAny([Null], [Null, 1])` returns `1`. - -`SELECT hasAny([-128, 1., 512], [1])` returns `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` returns `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` returns `1`. - -## indexOf(arr, x) {#indexofarr-x} - -Returns the index of the first ‘x’ element (starting from 1) if it is in the array, or 0 if it is not. - -Example: - -``` sql -SELECT indexOf([1, 3, NULL, NULL], NULL) -``` - -``` text - -┌─indexOf([1, 3, NULL, NULL], NULL)─┐ -│ 3 │ -└───────────────────────────────────┘ -``` - -Elements set to `NULL` are handled as normal values. - -## countEqual(arr, x) {#countequalarr-x} - -Returns the number of elements in the array equal to x. Equivalent to arrayCount (elem -\> elem = x, arr). - -`NULL` elements are handled as separate values. - -Example: - -``` sql -SELECT countEqual([1, 2, NULL, NULL], NULL) -``` - -``` text -┌─countEqual([1, 2, NULL, NULL], NULL)─┐ -│ 2 │ -└──────────────────────────────────────┘ -``` - -## arrayEnumerate(arr) {#array_functions-arrayenumerate} - -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: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -In this example, Reaches is the number of conversions (the strings received after applying ARRAY JOIN), and Hits is the number of pageviews (strings before ARRAY JOIN). In this particular case, you can get the same result in an easier way: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -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, …) {#arrayenumerateuniqarr} - -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\]. - -This function is useful when using ARRAY JOIN and aggregation of array elements. -Example: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - -``` text -┌──GoalID─┬─Reaches─┬─Visits─┐ -│ 53225 │ 3214 │ 1097 │ -│ 2825062 │ 3188 │ 1097 │ -│ 56600 │ 2803 │ 488 │ -│ 1989037 │ 2401 │ 365 │ -│ 2830064 │ 2396 │ 910 │ -│ 1113562 │ 2372 │ 373 │ -│ 3270895 │ 2262 │ 812 │ -│ 1084657 │ 2262 │ 345 │ -│ 56599 │ 2260 │ 799 │ -│ 3271094 │ 2256 │ 812 │ -└─────────┴─────────┴────────┘ -``` - -In this example, each goal ID has a calculation of the number of conversions (each element in the Goals nested data structure is a goal that was reached, which we refer to as a conversion) and the number of sessions. Without ARRAY JOIN, we would have counted the number of sessions as sum(Sign). But in this particular case, the rows were multiplied by the nested Goals structure, so in order to count each session one time after this, we apply a condition to the value of the arrayEnumerateUniq(Goals.ID) function. - -The arrayEnumerateUniq function can take multiple arrays of the same size as arguments. In this case, uniqueness is considered for tuples of elements in the same positions in all the arrays. - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,1,1,2,1] │ -└───────────────┘ -``` - -This is necessary when using ARRAY JOIN with a nested data structure and further aggregation across multiple elements in this structure. - -## arrayPopBack {#arraypopback} - -Removes the last item from the array. - -``` sql -arrayPopBack(array) -``` - -**Parameters** - -- `array` – Array. - -**Example** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## arrayPopFront {#arraypopfront} - -Removes the first item from the array. - -``` sql -arrayPopFront(array) -``` - -**Parameters** - -- `array` – Array. - -**Example** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [2,3] │ -└───────┘ -``` - -## arrayPushBack {#arraypushback} - -Adds one item to the end of the array. - -``` sql -arrayPushBack(array, single_value) -``` - -**Parameters** - -- `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`. - -**Example** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayPushFront {#arraypushfront} - -Adds one element to the beginning of the array. - -``` sql -arrayPushFront(array, single_value) -``` - -**Parameters** - -- `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`. - -**Example** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayResize {#arrayresize} - -Changes the length of the array. - -``` sql -arrayResize(array, size[, extender]) -``` - -**Parameters:** - -- `array` — Array. -- `size` — Required length of the array. - - If `size` is less than the original size of the array, the array is truncated from the right. -- If `size` is larger than the initial size of the array, the array is extended to the right with `extender` values or default values for the data type of the array items. -- `extender` — Value for extending an array. Can be `NULL`. - -**Returned value:** - -An array of length `size`. - -**Examples of calls** - -``` sql -SELECT arrayResize([1], 3) -``` - -``` text -┌─arrayResize([1], 3)─┐ -│ [1,0,0] │ -└─────────────────────┘ -``` - -``` sql -SELECT arrayResize([1], 3, NULL) -``` - -``` text -┌─arrayResize([1], 3, NULL)─┐ -│ [1,NULL,NULL] │ -└───────────────────────────┘ -``` - -## arraySlice {#arrayslice} - -Returns a slice of the array. - -``` sql -arraySlice(array, offset[, length]) -``` - -**Parameters** - -- `array` – Array of data. -- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. -- `length` - The length of the required slice. If you specify a negative value, the function returns an open slice `[offset, array_length - length)`. If you omit the value, the function returns the slice `[offset, the_end_of_array]`. - -**Example** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - -``` text -┌─res────────┐ -│ [2,NULL,4] │ -└────────────┘ -``` - -Array elements set to `NULL` are handled as normal values. - -## arraySort(\[func,\] arr, …) {#array_functions-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. - -Example of integer values sorting: - -``` sql -SELECT arraySort([1, 3, 3, 0]); -``` - -``` text -┌─arraySort([1, 3, 3, 0])─┐ -│ [0,1,3,3] │ -└─────────────────────────┘ -``` - -Example of string values sorting: - -``` sql -SELECT arraySort(['hello', 'world', '!']); -``` - -``` text -┌─arraySort(['hello', 'world', '!'])─┐ -│ ['!','hello','world'] │ -└────────────────────────────────────┘ -``` - -Consider the following sorting order for the `NULL`, `NaN` and `Inf` values: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - -``` text -┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ -│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────────────────────────┘ -``` - -- `-Inf` values are first in the array. -- `NULL` values are last in the array. -- `NaN` values are right before `NULL`. -- `Inf` values are right before `NaN`. - -Note that `arraySort` is a [higher-order function](higher_order_functions.md). You can pass a lambda function to it as the first argument. In this case, sorting order is determined by the result of the lambda function applied to the elements of the array. - -Let’s consider the following example: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,2,1] │ -└─────────┘ -``` - -For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` function sorts the keys in ascending order, the result is \[3, 2, 1\]. Thus, the `(x) –> -x` lambda function sets the [descending order](#array_functions-reverse-sort) in a sorting. - -The lambda function can accept multiple arguments. In this case, you need to pass the `arraySort` function several arrays of identical length that the arguments of lambda function will correspond to. The resulting array will consist of elements from the first input array; elements from the next input array(s) specify the sorting keys. For example: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Here, the elements that are passed in the second array (\[2, 1\]) define a sorting key for the corresponding element from the source array (\[‘hello’, ‘world’\]), that is, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn’t use `x`, actual values of the source array don’t affect the order in the result. So, ‘hello’ will be the second element in the result, and ‘world’ will be the first. - -Other examples are shown below. - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! note "Note" - To improve sorting efficiency, the [Schwartzian transform](https://en.wikipedia.org/wiki/Schwartzian_transform) is used. - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-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. - -Example of integer values sorting: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - -``` text -┌─arrayReverseSort([1, 3, 3, 0])─┐ -│ [3,3,1,0] │ -└────────────────────────────────┘ -``` - -Example of string values sorting: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - -``` text -┌─arrayReverseSort(['hello', 'world', '!'])─┐ -│ ['world','hello','!'] │ -└───────────────────────────────────────────┘ -``` - -Consider the following sorting order for the `NULL`, `NaN` and `Inf` values: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` text -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- `Inf` values are first in the array. -- `NULL` values are last in the array. -- `NaN` values are right before `NULL`. -- `-Inf` values are right before `NaN`. - -Note that the `arrayReverseSort` is a [higher-order function](higher_order_functions.md). You can pass a lambda function to it as the first argument. Example is shown below. - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [1,2,3] │ -└─────────┘ -``` - -The array is sorted in the following way: - -1. At first, the source array (\[1, 2, 3\]) is sorted according to the result of the lambda function applied to the elements of the array. The result is an array \[3, 2, 1\]. -2. Array that is obtained on the previous step, is reversed. So, the final result is \[1, 2, 3\]. - -The lambda function can accept multiple arguments. In this case, you need to pass the `arrayReverseSort` function several arrays of identical length that the arguments of lambda function will correspond to. The resulting array will consist of elements from the first input array; elements from the next input array(s) specify the sorting keys. For example: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -In this example, the array is sorted in the following way: - -1. At first, the source array (\[‘hello’, ‘world’\]) is sorted according to the result of the lambda function applied to the elements of the arrays. The elements that are passed in the second array (\[2, 1\]), define the sorting keys for corresponding elements from the source array. The result is an array \[‘world’, ‘hello’\]. -2. Array that was sorted on the previous step, is reversed. So, the final result is \[‘hello’, ‘world’\]. - -Other examples are shown below. - -``` sql -SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; -``` - -``` text -┌─res─────┐ -│ [5,3,4] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` text -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#arrayuniqarr} - -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. - -If you want to get a list of unique items in an array, you can use arrayReduce(‘groupUniqArray’, arr). - -## arrayJoin(arr) {#array-functions-join} - -A special function. See the section [“ArrayJoin function”](array_join.md#functions_arrayjoin). - -## arrayDifference {#arraydifference} - -Calculates the difference between adjacent array elements. Returns an array where the first element will be 0, the second is the difference between `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). - -**Syntax** - -``` sql -arrayDifference(array) -``` - -**Parameters** - -- `array` – [Array](https://clickhouse.yandex/docs/en/data_types/array/). - -**Returned values** - -Returns an array of differences between adjacent elements. - -Type: [UInt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [Float\*](https://clickhouse.yandex/docs/en/data_types/float/). - -**Example** - -Query: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - -Result: - -``` text -┌─arrayDifference([1, 2, 3, 4])─┐ -│ [0,1,1,1] │ -└───────────────────────────────┘ -``` - -Example of the overflow due to result type Int64: - -Query: - -``` sql -SELECT arrayDifference([0, 10000000000000000000]) -``` - -Result: - -``` text -┌─arrayDifference([0, 10000000000000000000])─┐ -│ [0,-8446744073709551616] │ -└────────────────────────────────────────────┘ -``` - -## arrayDistinct {#arraydistinct} - -Takes an array, returns an array containing the distinct elements only. - -**Syntax** - -``` sql -arrayDistinct(array) -``` - -**Parameters** - -- `array` – [Array](https://clickhouse.yandex/docs/en/data_types/array/). - -**Returned values** - -Returns an array containing the distinct elements. - -**Example** - -Query: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - -Result: - -``` text -┌─arrayDistinct([1, 2, 2, 3, 1])─┐ -│ [1,2,3] │ -└────────────────────────────────┘ -``` - -## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} - -Returns an array of the same size as the source array, indicating where each element first appears in the source array. - -Example: - -``` sql -SELECT arrayEnumerateDense([10, 20, 10, 30]) -``` - -``` text -┌─arrayEnumerateDense([10, 20, 10, 30])─┐ -│ [1,2,1,3] │ -└───────────────────────────────────────┘ -``` - -## arrayIntersect(arr) {#array-functions-arrayintersect} - -Takes multiple arrays, returns an array with elements that are present in all source arrays. Elements order in the resulting array is the same as in the first array. - -Example: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - -``` text -┌─no_intersect─┬─intersect─┐ -│ [] │ [1] │ -└──────────────┴───────────┘ -``` - -## arrayReduce {#arrayreduce} - -Applies an aggregate function to array elements and returns its result. The name of the aggregation function is passed as a string in single quotes `'max'`, `'sum'`. When using parametric aggregate functions, the parameter is indicated after the function name in parentheses `'uniqUpTo(6)'`. - -**Syntax** - -```sql -arrayReduce(agg_func, arr1, arr2, ..., arrN) -``` - -**Parameters** - -* `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. - -**Returned value** - -**Example** - -```sql -SELECT arrayReduce('max', [1, 2, 3]) -``` - -```text -┌─arrayReduce('max', [1, 2, 3])─┐ -│ 3 │ -└───────────────────────────────┘ -``` - -If an aggregate function takes multiple arguments, then this function must be applied to multiple arrays of the same size. - -```sql -SELECT arrayReduce('maxIf', [3, 5], [1, 0]) -``` - -```text -┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ -│ 3 │ -└──────────────────────────────────────┘ -``` - -Example with a parametric aggregate function: - -```sql -SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -``` - -```text -┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ -│ 4 │ -└─────────────────────────────────────────────────────────────┘ -``` - -## arrayReduceInRanges {#arrayreduceinranges} - -Applies an aggregate function to array elements in given ranges and returns an array containing the result corresponding to each range. The function will return the same result as multiple `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. - -**Syntax** - -```sql -arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) -``` - -**Parameters** - -* `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. - -**Returned value** - -**Example** - -```sql -SELECT arrayReduceInRanges( - 'sum', - [(1, 5), (2, 3), (3, 4), (4, 4)], - [1000000, 200000, 30000, 4000, 500, 60, 7] -) AS res -``` - -```text -┌─res─────────────────────────┐ -│ [1234500,234000,34560,4567] │ -└─────────────────────────────┘ -``` - -## arrayReverse(arr) {#arrayreverse} - -Returns an array of the same size as the original array containing the elements in reverse order. - -Example: - -``` sql -SELECT arrayReverse([1, 2, 3]) -``` - -``` text -┌─arrayReverse([1, 2, 3])─┐ -│ [3,2,1] │ -└─────────────────────────┘ -``` - -## reverse(arr) {#array-functions-reverse} - -Synonym for [“arrayReverse”](#array_functions-arrayreverse) - -## arrayFlatten {#arrayflatten} - -Converts an array of arrays to a flat array. - -Function: - -- Applies to any depth of nested arrays. -- Does not change arrays that are already flat. - -The flattened array contains all the elements from all source arrays. - -**Syntax** - -``` sql -flatten(array_of_arrays) -``` - -Alias: `flatten`. - -**Parameters** - -- `array_of_arrays` — [Array](../../sql_reference/data_types/array.md) of arrays. For example, `[[1,2,3], [4,5]]`. - -**Examples** - -``` sql -SELECT flatten([[[1]], [[2], [3]]]) -``` - -``` text -┌─flatten(array(array([1]), array([2], [3])))─┐ -│ [1,2,3] │ -└─────────────────────────────────────────────┘ -``` - -## arrayCompact {#arraycompact} - -Removes consecutive duplicate elements from an array. The order of result values is determined by the order in the source array. - -**Syntax** - -``` sql -arrayCompact(arr) -``` - -**Parameters** - -`arr` — The [array](../../sql_reference/data_types/array.md) to inspect. - -**Returned value** - -The array without duplicate. - -Type: `Array`. - -**Example** - -Query: - -``` sql -SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) -``` - -Result: - -``` text -┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ -│ [1,nan,nan,2,3] │ -└────────────────────────────────────────────┘ -``` - -## arrayZip {#arrayzip} - -Combines multiple arrays into a single array. The resulting array contains the corresponding elements of the source arrays grouped into tuples in the listed order of arguments. - -**Syntax** - -``` sql -arrayZip(arr1, arr2, ..., arrN) -``` - -**Parameters** - -- `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](../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](../data_types/array.md). - -**Example** - -Query: - -``` sql -SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]) -``` - -Result: - -``` text -┌─arrayZip(['a', 'b', 'c'], [5, 2, 1])─┐ -│ [('a',5),('b',2),('c',1)] │ -└──────────────────────────────────────┘ -``` - - -## arrayAUC {#arrayauc} -Calculate AUC (Area Under the Curve, which is a concept in machine learning, see more details: https://en.wikipedia.org/wiki/Receiver_operating_characteristic#Area_under_the_curve). - -**Syntax** -```sql -arrayAUC(arr_scores, arr_labels) -``` - -**Parameters** -- `arr_scores` — scores prediction model gives. -- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. - -**Returned value** -Returns AUC value with type Float64. - -**Example** -Query: -```sql -select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) -``` - -Result: - -```text -┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ -│ 0.75 │ -└────────────────────────────────────────---──┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/en/sql_reference/functions/bit_functions.md b/docs/en/sql_reference/functions/bit_functions.md deleted file mode 100644 index dbed3ac2230..00000000000 --- a/docs/en/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -toc_priority: 48 -toc_title: Bit ---- - -# Bit functions {#bit-functions} - -Bit functions work for any pair of types from UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32, or Float64. - -The result type is an integer with bits equal to the maximum bits of its arguments. If at least one of the arguments is signed, the result is a signed number. If an argument is a floating-point number, it is cast to Int64. - -## bitAnd(a, b) {#bitanda-b} - -## bitOr(a, b) {#bitora-b} - -## bitXor(a, b) {#bitxora-b} - -## bitNot(a) {#bitnota} - -## bitShiftLeft(a, b) {#bitshiftlefta-b} - -## bitShiftRight(a, b) {#bitshiftrighta-b} - -## bitRotateLeft(a, b) {#bitrotatelefta-b} - -## bitRotateRight(a, b) {#bitrotaterighta-b} - -## bitTest {#bittest} - -Takes any integer and converts it into [binary form](https://en.wikipedia.org/wiki/Binary_number), returns the value of a bit at specified position. The countdown starts from 0 from the right to the left. - -**Syntax** - -``` sql -SELECT bitTest(number, index) -``` - -**Parameters** - -- `number` – integer number. -- `index` – position of bit. - -**Returned values** - -Returns a value of bit at specified position. - -Type: `UInt8`. - -**Example** - -For example, the number 43 in base-2 (binary) numeral system is 101011. - -Query: - -``` sql -SELECT bitTest(43, 1) -``` - -Result: - -``` text -┌─bitTest(43, 1)─┐ -│ 1 │ -└────────────────┘ -``` - -Another example: - -Query: - -``` sql -SELECT bitTest(43, 2) -``` - -Result: - -``` text -┌─bitTest(43, 2)─┐ -│ 0 │ -└────────────────┘ -``` - -## bitTestAll {#bittestall} - -Returns result of [logical conjuction](https://en.wikipedia.org/wiki/Logical_conjunction) (AND operator) of all bits at given positions. The countdown starts from 0 from the right to the left. - -The conjuction for bitwise operations: - -0 AND 0 = 0 - -0 AND 1 = 0 - -1 AND 0 = 0 - -1 AND 1 = 1 - -**Syntax** - -``` sql -SELECT bitTestAll(number, index1, index2, index3, index4, ...) -``` - -**Parameters** - -- `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** - -Returns result of logical conjuction. - -Type: `UInt8`. - -**Example** - -For example, the number 43 in base-2 (binary) numeral system is 101011. - -Query: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5) -``` - -Result: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5)─┐ -│ 1 │ -└────────────────────────────┘ -``` - -Another example: - -Query: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5, 2) -``` - -Result: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ -│ 0 │ -└───────────────────────────────┘ -``` - -## bitTestAny {#bittestany} - -Returns result of [logical disjunction](https://en.wikipedia.org/wiki/Logical_disjunction) (OR operator) of all bits at given positions. The countdown starts from 0 from the right to the left. - -The disjunction for bitwise operations: - -0 OR 0 = 0 - -0 OR 1 = 1 - -1 OR 0 = 1 - -1 OR 1 = 1 - -**Syntax** - -``` sql -SELECT bitTestAny(number, index1, index2, index3, index4, ...) -``` - -**Parameters** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. - -**Returned values** - -Returns result of logical disjuction. - -Type: `UInt8`. - -**Example** - -For example, the number 43 in base-2 (binary) numeral system is 101011. - -Query: - -``` sql -SELECT bitTestAny(43, 0, 2) -``` - -Result: - -``` text -┌─bitTestAny(43, 0, 2)─┐ -│ 1 │ -└──────────────────────┘ -``` - -Another example: - -Query: - -``` sql -SELECT bitTestAny(43, 4, 2) -``` - -Result: - -``` text -┌─bitTestAny(43, 4, 2)─┐ -│ 0 │ -└──────────────────────┘ -``` -## bitCount {#bitcount} - -Calculates the number of bits set to one in the binary representation of a number. - -**Syntax** - -```sql -bitCount(x) -``` - -**Parameters** - -- `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. - -**Returned value** - -- Number of bits set to one in the input number. - -The function doesn't 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`. - -**Example** - -Take for example the number 333. Its binary representation: 0000000101001101. - -Query: - -```sql -SELECT bitCount(333) -``` - -Result: - -```text -┌─bitCount(333)─┐ -│ 5 │ -└───────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/en/sql_reference/functions/bitmap_functions.md b/docs/en/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index 8e47fa24034..00000000000 --- a/docs/en/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,494 +0,0 @@ ---- -toc_priority: 49 -toc_title: Bitmap ---- - -# Bitmap functions {#bitmap-functions} - -Bitmap functions work for two bitmaps Object value calculation, it is to return new bitmap or cardinality while using formula calculation, such as and, or, xor, and not, etc. - -There are 2 kinds of construction methods for Bitmap Object. One is to be constructed by aggregation function groupBitmap with -State, the other is to be constructed by Array Object. It is also to convert Bitmap Object to Array Object. - -RoaringBitmap is wrapped into a data structure while actual storage of Bitmap objects. When the cardinality is less than or equal to 32, it uses Set objet. When the cardinality is greater than 32, it uses RoaringBitmap object. That is why storage of low cardinality set is faster. - -For more information on RoaringBitmap, see: [CRoaring](https://github.com/RoaringBitmap/CRoaring). - -## bitmapBuild {#bitmap_functions-bitmapbuild} - -Build a bitmap from unsigned integer array. - -``` sql -bitmapBuild(array) -``` - -**Parameters** - -- `array` – unsigned integer array. - -**Example** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) -``` - -``` text -┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ -│  │ AggregateFunction(groupBitmap, UInt8) │ -└─────┴──────────────────────────────────────────────┘ -``` - -## bitmapToArray {#bitmaptoarray} - -Convert bitmap to integer array. - -``` sql -bitmapToArray(bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapSubsetInRange {#bitmap-functions-bitmapsubsetinrange} - -Return subset in specified range (not include the range\_end). - -``` sql -bitmapSubsetInRange(bitmap, range_start, range_end) -``` - -**Parameters** - -- `bitmap` – [Bitmap object](#bitmap_functions-bitmapbuild). -- `range_start` – range start point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `range_end` – range end point(excluded). Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Example** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -``` text -┌─res───────────────┐ -│ [30,31,32,33,100] │ -└───────────────────┘ -``` - -## bitmapSubsetLimit {#bitmapsubsetlimit} - -Creates a subset of bitmap with n elements taken between `range_start` and `cardinality_limit`. - -**Syntax** - -``` sql -bitmapSubsetLimit(bitmap, range_start, cardinality_limit) -``` - -**Parameters** - -- `bitmap` – [Bitmap object](#bitmap_functions-bitmapbuild). -- `range_start` – The subset starting point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Returned value** - -The subset. - -Type: `Bitmap object`. - -**Example** - -Query: - -``` sql -SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -Result: - -``` text -┌─res───────────────────────┐ -│ [30,31,32,33,100,200,500] │ -└───────────────────────────┘ -``` - -## bitmapContains {#bitmap_functions-bitmapcontains} - -Checks whether the bitmap contains an element. - -``` sql -bitmapContains(haystack, needle) -``` - -**Parameters** - -- `haystack` – [Bitmap object](#bitmap_functions-bitmapbuild), where the function searches. -- `needle` – Value that the function searches. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Returned values** - -- 0 — If `haystack` doesn’t contain `needle`. -- 1 — If `haystack` contains `needle`. - -Type: `UInt8`. - -**Example** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAny {#bitmaphasany} - -Checks whether two bitmaps have intersection by some elements. - -``` sql -bitmapHasAny(bitmap1, bitmap2) -``` - -If you are sure that `bitmap2` contains strictly one element, consider using the [bitmapContains](#bitmap_functions-bitmapcontains) function. It works more efficiently. - -**Parameters** - -- `bitmap*` – bitmap object. - -**Return values** - -- `1`, if `bitmap1` and `bitmap2` have one similar element at least. -- `0`, otherwise. - -**Example** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAll {#bitmaphasall} - -Analogous to `hasAll(array, array)` returns 1 if the first bitmap contains all the elements of the second one, 0 otherwise. -If the second argument is an empty bitmap then returns 1. - -``` sql -bitmapHasAll(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 0 │ -└─────┘ -``` - -## bitmapCardinality {#bitmapcardinality} - -Retrun bitmap cardinality of type UInt64. - -``` sql -bitmapCardinality(bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapMin {#bitmapmin} - -Retrun the smallest value of type UInt64 in the set, UINT32\_MAX if the set is empty. - - bitmapMin(bitmap) - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapMax {#bitmapmax} - -Retrun the greatest value of type UInt64 in the set, 0 if the set is empty. - - bitmapMax(bitmap) - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## bitmapTransform {#bitmaptransform} - -Transform an array of values in a bitmap to another array of values, the result is a new bitmap. - - bitmapTransform(bitmap, from_array, to_array) - -**Parameters** - -- `bitmap` – bitmap object. -- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. -- `to_array` – UInt32 array, its size shall be the same to from\_array. - -**Example** - -``` sql -SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res -``` - - ┌─res───────────────────┐ - │ [1,3,4,6,7,8,9,10,20] │ - └───────────────────────┘ - -## bitmapAnd {#bitmapand} - -Two bitmap and calculation, the result is a new bitmap. - -``` sql -bitmapAnd(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─┐ -│ [3] │ -└─────┘ -``` - -## bitmapOr {#bitmapor} - -Two bitmap or calculation, the result is a new bitmap. - -``` sql -bitmapOr(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapXor {#bitmapxor} - -Two bitmap xor calculation, the result is a new bitmap. - -``` sql -bitmapXor(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,4,5] │ -└───────────┘ -``` - -## bitmapAndnot {#bitmapandnot} - -Two bitmap andnot calculation, the result is a new bitmap. - -``` sql -bitmapAndnot(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## bitmapAndCardinality {#bitmapandcardinality} - -Two bitmap and calculation, return cardinality of type UInt64. - -``` sql -bitmapAndCardinality(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapOrCardinality {#bitmaporcardinality} - -Two bitmap or calculation, return cardinality of type UInt64. - -``` sql -bitmapOrCardinality(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapXorCardinality {#bitmapxorcardinality} - -Two bitmap xor calculation, return cardinality of type UInt64. - -``` sql -bitmapXorCardinality(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 4 │ -└─────┘ -``` - -## bitmapAndnotCardinality {#bitmapandnotcardinality} - -Two bitmap andnot calculation, return cardinality of type UInt64. - -``` sql -bitmapAndnotCardinality(bitmap,bitmap) -``` - -**Parameters** - -- `bitmap` – bitmap object. - -**Example** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 2 │ -└─────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/en/sql_reference/functions/comparison_functions.md b/docs/en/sql_reference/functions/comparison_functions.md deleted file mode 100644 index 368ac447dd1..00000000000 --- a/docs/en/sql_reference/functions/comparison_functions.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -toc_priority: 36 -toc_title: Comparison ---- - -# Comparison functions {#comparison-functions} - -Comparison functions always return 0 or 1 (Uint8). - -The following types can be compared: - -- numbers -- strings and fixed strings -- dates -- dates with times - -within each group, but not between different groups. - -For example, you can’t compare a date with a string. You have to use a function to convert the string to a date, or vice versa. - -Strings are compared by bytes. A shorter string is smaller than all strings that start with it and that contain at least one more character. - -## equals, a = b and a == b operator {#function-equals} - -## notEquals, a ! operator= b and a <> b {#function-notequals} - -## less, < operator {#function-less} - -## greater, > operator {#function-greater} - -## lessOrEquals, <= operator {#function-lessorequals} - -## greaterOrEquals, >= operator {#function-greaterorequals} - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) diff --git a/docs/en/sql_reference/functions/conditional_functions.md b/docs/en/sql_reference/functions/conditional_functions.md deleted file mode 100644 index 0f9f0b78ce4..00000000000 --- a/docs/en/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -toc_priority: 43 -toc_title: 'Conditional ' ---- - -# Conditional functions {#conditional-functions} - -## if {#if} - -Controls conditional branching. Unlike most systems, ClickHouse always evaluate both expressions `then` and `else`. - -**Syntax** - -``` sql -SELECT if(cond, then, else) -``` - -If the condition `cond` evaluates to a non-zero value, returns the result of the expression `then`, and the result of the expression `else`, if present, is skipped. If the `cond` is zero or `NULL`, then the result of the `then` expression is skipped and the result of the `else` expression, if present, is returned. - -**Parameters** - -- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. -- `then` - The expression to return if condition is met. -- `else` - The expression to return if condition is not met. - -**Returned values** - -The function executes `then` and `else` expressions and returns its result, depending on whether the condition `cond` ended up being zero or not. - -**Example** - -Query: - -``` sql -SELECT if(1, plus(2, 2), plus(2, 6)) -``` - -Result: - -``` text -┌─plus(2, 2)─┐ -│ 4 │ -└────────────┘ -``` - -Query: - -``` sql -SELECT if(0, plus(2, 2), plus(2, 6)) -``` - -Result: - -``` text -┌─plus(2, 6)─┐ -│ 8 │ -└────────────┘ -``` - -- `then` and `else` must have the lowest common type. - -**Example:** - -Take this `LEFT_RIGHT` table: - -``` sql -SELECT * -FROM LEFT_RIGHT - -┌─left─┬─right─┐ -│ ᴺᵁᴸᴸ │ 4 │ -│ 1 │ 3 │ -│ 2 │ 2 │ -│ 3 │ 1 │ -│ 4 │ ᴺᵁᴸᴸ │ -└──────┴───────┘ -``` - -The following query compares `left` and `right` values: - -``` sql -SELECT - left, - right, - if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller -FROM LEFT_RIGHT -WHERE isNotNull(left) AND isNotNull(right) - -┌─left─┬─right─┬─is_smaller──────────────────────────┐ -│ 1 │ 3 │ left is smaller than right │ -│ 2 │ 2 │ right is greater or equal than left │ -│ 3 │ 1 │ right is greater or equal than left │ -└──────┴───────┴─────────────────────────────────────┘ -``` - -Note: `NULL` values are not used in this example, check [NULL values in conditionals](#null-values-in-conditionals) section. - -## Ternary Operator {#ternary-operator} - -It works same as `if` function. - -Syntax: `cond ? then : else` - -Returns `then` if the `cond` evaluates to be true (greater than zero), otherwise returns `else`. - -- `cond` must be of type of `UInt8`, and `then` and `else` must have the lowest common type. - -- `then` and `else` can be `NULL` - -**See also** - -- [ifNotFinite](other_functions.md#ifnotfinite). - -## multiIf {#multiif} - -Allows you to write the [CASE](../operators.md#operator_case) operator more compactly in the query. - -Syntax: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` - -**Parameters:** - -- `cond_N` — The condition for the function to return `then_N`. -- `then_N` — The result of the function when executed. -- `else` — The result of the function if none of the conditions is met. - -The function accepts `2N+1` parameters. - -**Returned values** - -The function returns one of the values `then_N` or `else`, depending on the conditions `cond_N`. - -**Example** - -Again using `LEFT_RIGHT` table. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─result──────────┐ -│ ᴺᵁᴸᴸ │ 4 │ Null value │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ left is greater │ -│ 4 │ ᴺᵁᴸᴸ │ Null value │ -└──────┴───────┴─────────────────┘ -``` - -## Using conditional results directly {#using-conditional-results-directly} - -Conditionals always result to `0`, `1` or `NULL`. So you can use conditional results directly like this: - -``` sql -SELECT left < right AS is_small -FROM LEFT_RIGHT - -┌─is_small─┐ -│ ᴺᵁᴸᴸ │ -│ 1 │ -│ 0 │ -│ 0 │ -│ ᴺᵁᴸᴸ │ -└──────────┘ -``` - -## NULL values in conditionals {#null-values-in-conditionals} - -When `NULL` values are involved in conditionals, the result will also be `NULL`. - -``` sql -SELECT - NULL < 1, - 2 < NULL, - NULL < NULL, - NULL = NULL - -┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ -│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└───────────────┴───────────────┴──────────────────┴────────────────────┘ -``` - -So you should construct your queries carefully if the types are `Nullable`. - -The following example demonstrates this by failing to add equals condition to `multiIf`. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─faulty_result────┐ -│ ᴺᵁᴸᴸ │ 4 │ Both equal │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ right is smaller │ -│ 4 │ ᴺᵁᴸᴸ │ Both equal │ -└──────┴───────┴──────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/en/sql_reference/functions/date_time_functions.md b/docs/en/sql_reference/functions/date_time_functions.md deleted file mode 100644 index 3c477665bb7..00000000000 --- a/docs/en/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,448 +0,0 @@ ---- -toc_priority: 39 -toc_title: Working with Dates and Times ---- - -# Functions for working with dates and times {#functions-for-working-with-dates-and-times} - -Support for time zones - -All functions for working with the date and time that have a logical use for the time zone can accept a second optional time zone argument. Example: Asia/Yekaterinburg. In this case, they use the specified time zone instead of the local (default) one. - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - -``` text -┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ -└─────────────────────┴────────────┴────────────┴─────────────────────┘ -``` - -Only time zones that differ from UTC by a whole number of hours are supported. - -## toTimeZone {#totimezone} - -Convert time or date and time to the specified time zone. - -## toYear {#toyear} - -Converts a date or date with time to a UInt16 number containing the year number (AD). - -## toQuarter {#toquarter} - -Converts a date or date with time to a UInt8 number containing the quarter number. - -## toMonth {#tomonth} - -Converts a date or date with time to a UInt8 number containing the month number (1-12). - -## toDayOfYear {#todayofyear} - -Converts a date or date with time to a UInt16 number containing the number of the day of the year (1-366). - -## toDayOfMonth {#todayofmonth} - -Converts a date or date with time to a UInt8 number containing the number of the day of the month (1-31). - -## toDayOfWeek {#todayofweek} - -Converts a date or date with time to a UInt8 number containing the number of the day of the week (Monday is 1, and Sunday is 7). - -## toHour {#tohour} - -Converts a date with time to a UInt8 number containing the number of the hour in 24-hour time (0-23). -This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). - -## toMinute {#tominute} - -Converts a date with time to a UInt8 number containing the number of the minute of the hour (0-59). - -## toSecond {#tosecond} - -Converts a date with time to a UInt8 number containing the number of the second in the minute (0-59). -Leap seconds are not accounted for. - -## toUnixTimestamp {#to-unix-timestamp} - -For DateTime argument: converts value to its internal numeric representation (Unix Timestamp). -For String argument: parse datetime from string according to the timezone (optional second argument, server timezone is used by default) and returns the corresponding unix timestamp. -For Date argument: the behaviour is unspecified. - -**Syntax** - -``` sql -toUnixTimestamp(datetime) -toUnixTimestamp(str, [timezone]) -``` - -**Returned value** - -- Returns the unix timestamp. - -Type: `UInt32`. - -**Example** - -Query: - -``` sql -SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp -``` - -Result: - -``` text -┌─unix_timestamp─┐ -│ 1509836867 │ -└────────────────┘ -``` - -## toStartOfYear {#tostartofyear} - -Rounds down a date or date with time to the first day of the year. -Returns the date. - -## toStartOfISOYear {#tostartofisoyear} - -Rounds down a date or date with time to the first day of ISO year. -Returns the date. - -## toStartOfQuarter {#tostartofquarter} - -Rounds down a date or date with time to the first day of the quarter. -The first day of the quarter is either 1 January, 1 April, 1 July, or 1 October. -Returns the date. - -## toStartOfMonth {#tostartofmonth} - -Rounds down a date or date with time to the first day of the month. -Returns the date. - -!!! attention "Attention" - The behavior of parsing incorrect dates is implementation specific. ClickHouse may return zero date, throw an exception or do “natural” overflow. - -## toMonday {#tomonday} - -Rounds down a date or date with time to the nearest Monday. -Returns the date. - -## toStartOfWeek(t\[,mode\]) {#tostartofweektmode} - -Rounds down a date or date with time to the nearest Sunday or Monday by mode. -Returns the date. -The mode argument works exactly like the mode argument to toWeek(). For the single-argument syntax, a mode value of 0 is used. - -## toStartOfDay {#tostartofday} - -Rounds down a date with time to the start of the day. - -## toStartOfHour {#tostartofhour} - -Rounds down a date with time to the start of the hour. - -## toStartOfMinute {#tostartofminute} - -Rounds down a date with time to the start of the minute. - -## toStartOfFiveMinute {#tostartoffiveminute} - -Rounds down a date with time to the start of the five-minute interval. - -## toStartOfTenMinutes {#tostartoftenminutes} - -Rounds down a date with time to the start of the ten-minute interval. - -## toStartOfFifteenMinutes {#tostartoffifteenminutes} - -Rounds down the date with time to the start of the fifteen-minute interval. - -## toStartOfInterval(time\_or\_data, INTERVAL x unit \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -This is a generalization of other functions named `toStartOf*`. For example, -`toStartOfInterval(t, INTERVAL 1 year)` returns the same as `toStartOfYear(t)`, -`toStartOfInterval(t, INTERVAL 1 month)` returns the same as `toStartOfMonth(t)`, -`toStartOfInterval(t, INTERVAL 1 day)` returns the same as `toStartOfDay(t)`, -`toStartOfInterval(t, INTERVAL 15 minute)` returns the same as `toStartOfFifteenMinutes(t)` etc. - -## toTime {#totime} - -Converts a date with time to a certain fixed date, while preserving the time. - -## toRelativeYearNum {#torelativeyearnum} - -Converts a date with time or date to the number of the year, starting from a certain fixed point in the past. - -## toRelativeQuarterNum {#torelativequarternum} - -Converts a date with time or date to the number of the quarter, starting from a certain fixed point in the past. - -## toRelativeMonthNum {#torelativemonthnum} - -Converts a date with time or date to the number of the month, starting from a certain fixed point in the past. - -## toRelativeWeekNum {#torelativeweeknum} - -Converts a date with time or date to the number of the week, starting from a certain fixed point in the past. - -## toRelativeDayNum {#torelativedaynum} - -Converts a date with time or date to the number of the day, starting from a certain fixed point in the past. - -## toRelativeHourNum {#torelativehournum} - -Converts a date with time or date to the number of the hour, starting from a certain fixed point in the past. - -## toRelativeMinuteNum {#torelativeminutenum} - -Converts a date with time or date to the number of the minute, starting from a certain fixed point in the past. - -## toRelativeSecondNum {#torelativesecondnum} - -Converts a date with time or date to the number of the second, starting from a certain fixed point in the past. - -## toISOYear {#toisoyear} - -Converts a date or date with time to a UInt16 number containing the ISO Year number. - -## toISOWeek {#toisoweek} - -Converts a date or date with time to a UInt8 number containing the ISO Week number. - -## toWeek(date\[,mode\]) {#toweekdatemode} - -This function returns the week number for date or datetime. The two-argument form of toWeek() enables you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range from 0 to 53 or from 1 to 53. If the mode argument is omitted, the default mode is 0. -`toISOWeek()`is a compatibility function that is equivalent to `toWeek(date,3)`. -The following table describes how the mode argument works. - -| 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 | -| 2 | Sunday | 1-53 | with a Sunday in this year | -| 3 | Monday | 1-53 | with 4 or more days this year | -| 4 | Sunday | 0-53 | with 4 or more days this year | -| 5 | Monday | 0-53 | with a Monday in this year | -| 6 | Sunday | 1-53 | with 4 or more days this year | -| 7 | Monday | 1-53 | with a Monday in this year | -| 8 | Sunday | 1-53 | contains January 1 | -| 9 | Monday | 1-53 | contains January 1 | - -For mode values with a meaning of “with 4 or more days this year,” weeks are numbered according to ISO 8601:1988: - -- If the week containing January 1 has 4 or more days in the new year, it is week 1. - -- Otherwise, it is the last week of the previous year, and the next week is week 1. - -For mode values with a meaning of “contains January 1”, the week contains January 1 is week 1. It doesn’t matter how many days in the new year the week contained, even if it contained only one day. - -``` sql -toWeek(date, [, mode][, Timezone]) -``` - -**Parameters** - -- `date` – Date or DateTime. -- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. -- `Timezone` – Optional parameter, it behaves like any other conversion function. - -**Example** - -``` sql -SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; -``` - -``` text -┌───────date─┬─week0─┬─week1─┬─week9─┐ -│ 2016-12-27 │ 52 │ 52 │ 1 │ -└────────────┴───────┴───────┴───────┘ -``` - -## toYearWeek(date\[,mode\]) {#toyearweekdatemode} - -Returns year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year. - -The mode argument works exactly like the mode argument to toWeek(). For the single-argument syntax, a mode value of 0 is used. - -`toISOYear()`is a compatibility function that is equivalent to `intDiv(toYearWeek(date,3),100)`. - -**Example** - -``` sql -SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; -``` - -``` text -┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ -│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ -└────────────┴───────────┴───────────┴───────────┘ -``` - -## now {#now} - -Accepts zero arguments and returns the current time at one of the moments of request execution. -This function returns a constant, even if the request took a long time to complete. - -## today {#today} - -Accepts zero arguments and returns the current date at one of the moments of request execution. -The same as ‘toDate(now())’. - -## yesterday {#yesterday} - -Accepts zero arguments and returns yesterday’s date at one of the moments of request execution. -The same as ‘today() - 1’. - -## timeSlot {#timeslot} - -Rounds the time to the half hour. -This function is specific to Yandex.Metrica, since half an hour is the minimum amount of time for breaking a session into two sessions if a tracking tag shows a single user’s consecutive pageviews that differ in time by strictly more than this amount. This means that tuples (the tag ID, user ID, and time slot) can be used to search for pageviews that are included in the corresponding session. - -## toYYYYMM {#toyyyymm} - -Converts a date or date with time to a UInt32 number containing the year and month number (YYYY \* 100 + MM). - -## toYYYYMMDD {#toyyyymmdd} - -Converts a date or date with time to a UInt32 number containing the year and month number (YYYY \* 10000 + MM \* 100 + DD). - -## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} - -Converts a date or date with time to a UInt64 number containing the year and month number (YYYY \* 10000000000 + MM \* 100000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss). - -## addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} - -Function adds a Date/DateTime interval to a Date/DateTime and then return the Date/DateTime. For example: - -``` sql -WITH - toDate('2018-01-01') AS date, - toDateTime('2018-01-01 00:00:00') AS date_time -SELECT - addYears(date, 1) AS add_years_with_date, - addYears(date_time, 1) AS add_years_with_date_time -``` - -``` text -┌─add_years_with_date─┬─add_years_with_date_time─┐ -│ 2019-01-01 │ 2019-01-01 00:00:00 │ -└─────────────────────┴──────────────────────────┘ -``` - -## subtractYears, subtractMonths, subtractWeeks, subtractDays, subtractHours, subtractMinutes, subtractSeconds, subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} - -Function subtract a Date/DateTime interval to a Date/DateTime and then return the Date/DateTime. For example: - -``` sql -WITH - toDate('2019-01-01') AS date, - toDateTime('2019-01-01 00:00:00') AS date_time -SELECT - subtractYears(date, 1) AS subtract_years_with_date, - subtractYears(date_time, 1) AS subtract_years_with_date_time -``` - -``` text -┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ -│ 2018-01-01 │ 2018-01-01 00:00:00 │ -└──────────────────────────┴───────────────────────────────┘ -``` - -## dateDiff {#datediff} - -Returns the difference between two Date or DateTime values. - -**Syntax** - -``` sql -dateDiff('unit', startdate, enddate, [timezone]) -``` - -**Parameters** - -- `unit` — Time unit, in which the returned value is expressed. [String](../syntax.md#syntax-string-literal). - - Supported values: - - | unit | - | ---- | - |second | - |minute | - |hour | - |day | - |week | - |month | - |quarter | - |year | - -- `startdate` — The first time value to compare. [Date](../../sql_reference/data_types/date.md) or [DateTime](../../sql_reference/data_types/datetime.md). - -- `enddate` — The second time value to compare. [Date](../../sql_reference/data_types/date.md) or [DateTime](../../sql_reference/data_types/datetime.md). - -- `timezone` — Optional parameter. 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. - -**Returned value** - -Difference between `startdate` and `enddate` expressed in `unit`. - -Type: `int`. - -**Example** - -Query: - -``` sql -SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); -``` - -Result: - -``` text -┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ -│ 25 │ -└────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## timeSlots(StartTime, Duration,\[, Size\]) {#timeslotsstarttime-duration-size} - -For a time interval starting at ‘StartTime’ and continuing for ‘Duration’ seconds, it returns an array of moments in time, consisting of points from this interval rounded down to the ‘Size’ in seconds. ‘Size’ is an optional parameter: a constant UInt32, set to 1800 by default. -For example, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. -This is necessary for searching for pageviews in the corresponding session. - -## formatDateTime(Time, Format\[, Timezone\]) {#formatdatetime} - -Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. - -Supported modifiers for Format: -(“Example” column shows formatting result for time `2018-01-02 22:33:44`) - -| Modifier | Description | Example | -|------|-----------------------------------|--------| -| %C | year divided by 100 and truncated to integer (00-99) | 20 | -| %d | day of the month, zero-padded (01-31) | 02 | -| %D | Short MM/DD/YY date, equivalent to %m/%d/%y | 01/02/18 | -| %e | day of the month, space-padded ( 1-31) | 2 | -| %F | short YYYY-MM-DD date, equivalent to %Y-%m-%d | 2018-01-02 | -| %H | hour in 24h format (00-23) | 22 | -| %I | hour in 12h format (01-12) | 10 | -| %j | day of the year (001-366) | 002 | -| %m | month as a decimal number (01-12) | 01 | -| %M | minute (00-59) | 33 | -| %n | new-line character (‘’) | | -| %p | AM or PM designation | PM | -| %R | 24-hour HH:MM time, equivalent to %H:%M | 22:33 | -| %S | second (00-59) | 44 | -| %t | horizontal-tab character (’) | | -| %T | ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S | 22:33:44 | -| %u | ISO 8601 weekday as number with Monday as 1 (1-7) | 2 | -| %V | ISO 8601 week number (01-53) | 01 | -| %w | weekday as a decimal number with Sunday as 0 (0-6) | 2 | -| %y | Year, last two digits (00-99) | 18 | -| %Y | Year | 2018 | -| %% | a % sign | % | - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/en/sql_reference/functions/encoding_functions.md b/docs/en/sql_reference/functions/encoding_functions.md deleted file mode 100644 index 4802b2786c2..00000000000 --- a/docs/en/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -toc_priority: 52 -toc_title: Encoding ---- - -# Encoding functions {#encoding-functions} - -## char {#char} - -Returns the string with the length as the number of passed arguments and each byte has the value of corresponding argument. Accepts multiple arguments of numeric types. If the value of argument is out of range of UInt8 data type, it is converted to UInt8 with possible rounding and overflow. - -**Syntax** - -``` sql -char(number_1, [number_2, ..., number_n]); -``` - -**Parameters** - -- `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). - -**Returned value** - -- a string of given bytes. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello -``` - -Result: - -``` text -┌─hello─┐ -│ hello │ -└───────┘ -``` - -You can construct a string of arbitrary encoding by passing the corresponding bytes. Here is example for UTF-8: - -Query: - -``` sql -SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; -``` - -Result: - -``` text -┌─hello──┐ -│ привет │ -└────────┘ -``` - -Query: - -``` sql -SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; -``` - -Result: - -``` text -┌─hello─┐ -│ 你好 │ -└───────┘ -``` - -## hex {#hex} - -Returns a string containing the argument’s hexadecimal representation. - -**Syntax** - -``` sql -hex(arg) -``` - -The function is using uppercase letters `A-F` and not using any prefixes (like `0x`) or suffixes (like `h`). - -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 leading digit is zero. - -Example: - -**Example** - -Query: - -``` sql -SELECT hex(1); -``` - -Result: - -``` text -01 -``` - -Values of type `Date` and `DateTime` are formatted as corresponding integers (the number of days since Epoch for Date and the value of Unix Timestamp for DateTime). - -For `String` and `FixedString`, all bytes are simply encoded as two hexadecimal numbers. Zero bytes are not omitted. - -Values of floating point and Decimal 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. - -**Parameters** - -- `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). - -**Returned value** - -- A string with the hexadecimal representation of the argument. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); -``` - -Result: - -``` text -┌─hex_presentation─┐ -│ 00007041 │ -│ 00008041 │ -└──────────────────┘ -``` - -Query: - -``` sql -SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); -``` - -Result: - -``` text -┌─hex_presentation─┐ -│ 0000000000002E40 │ -│ 0000000000003040 │ -└──────────────────┘ -``` - -## unhex(str) {#unhexstr} - -Accepts a string containing any number of hexadecimal digits, and returns a string containing the corresponding bytes. 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). -If you want to convert the result to a number, you can use the ‘reverse’ and ‘reinterpretAsType’ functions. - -## UUIDStringToNum(str) {#uuidstringtonumstr} - -Accepts a string containing 36 characters in the format `123e4567-e89b-12d3-a456-426655440000`, and returns it as a set of bytes in a FixedString(16). - -## UUIDNumToString(str) {#uuidnumtostringstr} - -Accepts a FixedString(16) value. Returns a string containing 36 characters in text format. - -## bitmaskToList(num) {#bitmasktolistnum} - -Accepts an integer. Returns a string containing the list of powers of two that total the source number when summed. They are comma-separated without spaces in text format, in ascending order. - -## bitmaskToArray(num) {#bitmasktoarraynum} - -Accepts an integer. Returns an array of UInt64 numbers containing the list of powers of two that total the source number when summed. Numbers in the array are in ascending order. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/en/sql_reference/functions/ext_dict_functions.md b/docs/en/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index fa3b0519c37..00000000000 --- a/docs/en/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,203 +0,0 @@ ---- -toc_priority: 58 -toc_title: Working with External Dictionaries ---- - -# Functions For Working With External Dictionaries {#ext_dict_functions} - -For information on connecting and configuring external dictionaries, see [External dictionaries](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -## dictGet {#dictget} - -Retrieves a value from an external dictionary. - -``` sql -dictGet('dict_name', 'attr_name', id_expr) -dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Parameters** - -- `dict_name` — Name of the dictionary. [String literal](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [String literal](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expression](../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. -- `default_value_expr` — Value returned if the dictionary doesn’t contain a row with the `id_expr` key. [Expression](../syntax.md#syntax-expressions) returning the value in the data type configured for the `attr_name` attribute. - -**Returned value** - -- If ClickHouse parses the attribute successfully in the [attribute’s data type](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), functions return the value of the dictionary attribute that corresponds to `id_expr`. - -- If there is no the key, corresponding to `id_expr`, in the dictionary, then: - - - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouse throws an exception if it cannot parse the value of the attribute or the value doesn’t match the attribute data type. - -**Example** - -Create a text file `ext-dict-text.csv` containing the following: - -``` text -1,1 -2,2 -``` - -The first column is `id`, the second column is `c1`. - -Configure the external dictionary: - -``` xml - - - ext-dict-test - - - /path-to/ext-dict-test.csv - CSV - - - - - - - - id - - - c1 - UInt32 - - - - 0 - - -``` - -Perform the query: - -``` sql -SELECT - dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, - toTypeName(val) AS type -FROM system.numbers -LIMIT 3 -``` - -``` text -┌─val─┬─type───┐ -│ 1 │ UInt32 │ -│ 2 │ UInt32 │ -│ 20 │ UInt32 │ -└─────┴────────┘ -``` - -**See Also** - -- [External Dictionaries](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) - -## dictHas {#dicthas} - -Checks whether a key is present in a dictionary. - -``` sql -dictHas('dict_name', id_expr) -``` - -**Parameters** - -- `dict_name` — Name of the dictionary. [String literal](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) returning a [UInt64](../../sql_reference/data_types/int_uint.md)-type value. - -**Returned value** - -- 0, if there is no key. -- 1, if there is a key. - -Type: `UInt8`. - -## dictGetHierarchy {#dictgethierarchy} - -Creates an array, containing all the parents of a key in the [hierarchical dictionary](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md). - -**Syntax** - -``` sql -dictGetHierarchy('dict_name', key) -``` - -**Parameters** - -- `dict_name` — Name of the dictionary. [String literal](../syntax.md#syntax-string-literal). -- `key` — Key value. [Expression](../syntax.md#syntax-expressions) returning a [UInt64](../../sql_reference/data_types/int_uint.md)-type value. - -**Returned value** - -- Parents for the key. - -Type: [Array(UInt64)](../../sql_reference/data_types/array.md). - -## dictIsIn {#dictisin} - -Checks the ancestor of a key through the whole hierarchical chain in the dictionary. - -``` sql -dictIsIn('dict_name', child_id_expr, ancestor_id_expr) -``` - -**Parameters** - -- `dict_name` — Name of the dictionary. [String literal](../syntax.md#syntax-string-literal). -- `child_id_expr` — Key to be checked. [Expression](../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](../syntax.md#syntax-expressions) returning a [UInt64](../../sql_reference/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`. - -## Other Functions {#ext_dict_functions-other} - -ClickHouse supports specialized functions that convert dictionary attribute values to a specific data type regardless of the dictionary configuration. - -Functions: - -- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` -- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` -- `dictGetFloat32`, `dictGetFloat64` -- `dictGetDate` -- `dictGetDateTime` -- `dictGetUUID` -- `dictGetString` - -All these functions have the `OrDefault` modification. For example, `dictGetDateOrDefault`. - -Syntax: - -``` sql -dictGet[Type]('dict_name', 'attr_name', id_expr) -dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Parameters** - -- `dict_name` — Name of the dictionary. [String literal](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [String literal](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) returning a [UInt64](../../sql_reference/data_types/int_uint.md)-type value. -- `default_value_expr` — Value which is returned if the dictionary doesn’t contain a row with the `id_expr` key. [Expression](../syntax.md#syntax-expressions) returning a value in the data type configured for the `attr_name` attribute. - -**Returned value** - -- If ClickHouse parses the attribute successfully in the [attribute’s data type](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), functions return the value of the dictionary attribute that corresponds to `id_expr`. - -- If there is no requested `id_expr` in the dictionary then: - - - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouse throws an exception if it cannot parse the value of the attribute or the value doesn’t match the attribute data type. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/en/sql_reference/functions/functions_for_nulls.md b/docs/en/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 4ea67d1e0b5..00000000000 --- a/docs/en/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -toc_priority: 63 -toc_title: Working with Nullable arguments ---- - -# Functions for working with Nullable aggregates {#functions-for-working-with-nullable-aggregates} - -## isNull {#isnull} - -Checks whether the argument is [NULL](../syntax.md#null). - -``` sql -isNull(x) -``` - -**Parameters** - -- `x` — A value with a non-compound data type. - -**Returned value** - -- `1` if `x` is `NULL`. -- `0` if `x` is not `NULL`. - -**Example** - -Input table - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Query - -``` sql -SELECT x FROM t_null WHERE isNull(y) -``` - -``` text -┌─x─┐ -│ 1 │ -└───┘ -``` - -## isNotNull {#isnotnull} - -Checks whether the argument is [NULL](../syntax.md#null). - -``` sql -isNotNull(x) -``` - -**Parameters:** - -- `x` — A value with a non-compound data type. - -**Returned value** - -- `0` if `x` is `NULL`. -- `1` if `x` is not `NULL`. - -**Example** - -Input table - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Query - -``` sql -SELECT x FROM t_null WHERE isNotNull(y) -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## coalesce {#coalesce} - -Checks from left to right whether `NULL` arguments were passed and returns the first non-`NULL` argument. - -``` sql -coalesce(x,...) -``` - -**Parameters:** - -- Any number of parameters of a non-compound type. All parameters must be compatible by data type. - -**Returned values** - -- The first non-`NULL` argument. -- `NULL`, if all arguments are `NULL`. - -**Example** - -Consider a list of contacts that may specify multiple ways to contact a customer. - -``` text -┌─name─────┬─mail─┬─phone─────┬──icq─┐ -│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ -│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└──────────┴──────┴───────────┴──────┘ -``` - -The `mail` and `phone` fields are of type String, but the `icq` field is `UInt32`, so it needs to be converted to `String`. - -Get the first available contact method for the customer from the contact list: - -``` sql -SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook -``` - -``` text -┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ -│ client 1 │ 123-45-67 │ -│ client 2 │ ᴺᵁᴸᴸ │ -└──────────┴──────────────────────────────────────────────────────┘ -``` - -## ifNull {#ifnull} - -Returns an alternative value if the main argument is `NULL`. - -``` sql -ifNull(x,alt) -``` - -**Parameters:** - -- `x` — The value to check for `NULL`. -- `alt` — The value that the function returns if `x` is `NULL`. - -**Returned values** - -- The value `x`, if `x` is not `NULL`. -- The value `alt`, if `x` is `NULL`. - -**Example** - -``` sql -SELECT ifNull('a', 'b') -``` - -``` text -┌─ifNull('a', 'b')─┐ -│ a │ -└──────────────────┘ -``` - -``` sql -SELECT ifNull(NULL, 'b') -``` - -``` text -┌─ifNull(NULL, 'b')─┐ -│ b │ -└───────────────────┘ -``` - -## nullIf {#nullif} - -Returns `NULL` if the arguments are equal. - -``` sql -nullIf(x, y) -``` - -**Parameters:** - -`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. - -**Returned values** - -- `NULL`, if the arguments are equal. -- The `x` value, if the arguments are not equal. - -**Example** - -``` sql -SELECT nullIf(1, 1) -``` - -``` text -┌─nullIf(1, 1)─┐ -│ ᴺᵁᴸᴸ │ -└──────────────┘ -``` - -``` sql -SELECT nullIf(1, 2) -``` - -``` text -┌─nullIf(1, 2)─┐ -│ 1 │ -└──────────────┘ -``` - -## assumeNotNull {#assumenotnull} - -Results in a value of type [Nullable](../../sql_reference/data_types/nullable.md) for a non- `Nullable`, if the value is not `NULL`. - -``` sql -assumeNotNull(x) -``` - -**Parameters:** - -- `x` — The original value. - -**Returned values** - -- The original value from the non-`Nullable` type, if it is not `NULL`. -- The default value for the non-`Nullable` type if the original value was `NULL`. - -**Example** - -Consider the `t_null` table. - -``` sql -SHOW CREATE TABLE t_null -``` - -``` text -┌─statement─────────────────────────────────────────────────────────────────┐ -│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ -└───────────────────────────────────────────────────────────────────────────┘ -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Apply the `assumeNotNull` function to the `y` column. - -``` sql -SELECT assumeNotNull(y) FROM t_null -``` - -``` text -┌─assumeNotNull(y)─┐ -│ 0 │ -│ 3 │ -└──────────────────┘ -``` - -``` sql -SELECT toTypeName(assumeNotNull(y)) FROM t_null -``` - -``` text -┌─toTypeName(assumeNotNull(y))─┐ -│ Int8 │ -│ Int8 │ -└──────────────────────────────┘ -``` - -## toNullable {#tonullable} - -Converts the argument type to `Nullable`. - -``` sql -toNullable(x) -``` - -**Parameters:** - -- `x` — The value of any non-compound type. - -**Returned value** - -- The input value with a `Nullable` type. - -**Example** - -``` sql -SELECT toTypeName(10) -``` - -``` text -┌─toTypeName(10)─┐ -│ UInt8 │ -└────────────────┘ -``` - -``` sql -SELECT toTypeName(toNullable(10)) -``` - -``` text -┌─toTypeName(toNullable(10))─┐ -│ Nullable(UInt8) │ -└────────────────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/en/sql_reference/functions/geo.md b/docs/en/sql_reference/functions/geo.md deleted file mode 100644 index 7303821d162..00000000000 --- a/docs/en/sql_reference/functions/geo.md +++ /dev/null @@ -1,508 +0,0 @@ ---- -toc_priority: 62 -toc_title: Working with geographical coordinates ---- - -# Functions for Working with Geographical Coordinates {#functions-for-working-with-geographical-coordinates} - -## greatCircleDistance {#greatcircledistance} - -Calculate the distance between two points on the Earth’s surface using [the great-circle formula](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**Input parameters** - -- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. -- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. -- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. -- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. - -Positive values correspond to North latitude and East longitude, and negative values correspond to South latitude and West longitude. - -**Returned value** - -The distance between two points on the Earth’s surface, in meters. - -Generates an exception when the input parameter values fall outside of the range. - -**Example** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## pointInEllipses {#pointinellipses} - -Checks whether the point belongs to at least one of the ellipses. -Coordinates are geometric in the Cartesian coordinate system. - -``` sql -pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) -``` - -**Input parameters** - -- `x, y` — Coordinates of a point on the plane. -- `xᵢ, yᵢ` — Coordinates of the center of the `i`-th ellipsis. -- `aᵢ, bᵢ` — Axes of the `i`-th ellipsis in units of x, y coordinates. - -The input parameters must be `2+4⋅n`, where `n` is the number of ellipses. - -**Returned values** - -`1` if the point is inside at least one of the ellipses; `0`if it is not. - -**Example** - -``` sql -SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) -``` - -``` text -┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ -│ 1 │ -└─────────────────────────────────────────────────┘ -``` - -## pointInPolygon {#pointinpolygon} - -Checks whether the point belongs to the polygon on the plane. - -``` sql -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. -- 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** - -`1` if the point is inside the polygon, `0` if it is not. -If the point is on the polygon boundary, the function may return either 0 or 1. - -**Example** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## geohashEncode {#geohashencode} - -Encodes latitude and longitude as a geohash-string, please see (http://geohash.org/, https://en.wikipedia.org/wiki/Geohash). - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**Input values** - -- longitude - longitude part of the coordinate you want to encode. Floating in range`[-180°, 180°]` -- latitude - latitude part of the coordinate you want to encode. Floating in range `[-90°, 90°]` -- precision - Optional, length of the resulting encoded string, defaults to `12`. Integer in range `[1, 12]`. Any value less than `1` or greater than `12` is silently converted to `12`. - -**Returned values** - -- alphanumeric `String` of encoded coordinate (modified version of the base32-encoding alphabet is used). - -**Example** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## geohashDecode {#geohashdecode} - -Decodes any geohash-encoded string into longitude and latitude. - -**Input values** - -- encoded string - geohash-encoded string. - -**Returned values** - -- (longitude, latitude) - 2-tuple of `Float64` values of longitude and latitude. - -**Example** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## geoToH3 {#geotoh3} - -Returns [H3](https://uber.github.io/h3/#/documentation/overview/introduction) point index `(lon, lat)` with specified resolution. - -[H3](https://uber.github.io/h3/#/documentation/overview/introduction) is a geographical indexing system where Earth’s surface divided into even hexagonal tiles. This system is hierarchical, i. e. each hexagon on the top level can be splitted into seven even but smaller ones and so on. - -This index is used primarily for bucketing locations and other geospatial manipulations. - -**Syntax** - -``` sql -geoToH3(lon, lat, resolution) -``` - -**Parameters** - -- `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). - -**Returned values** - -- Hexagon index number. -- 0 in case of error. - -Type: `UInt64`. - -**Example** - -Query: - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -Result: - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## geohashesInBox {#geohashesinbox} - -Returns an array of geohash-encoded strings of given precision that fall inside and intersect boundaries of given box, basically a 2D grid flattened into array. - -**Input values** - -- longitude\_min - min longitude, floating value in range `[-180°, 180°]` -- latitude\_min - min latitude, floating value in range `[-90°, 90°]` -- longitude\_max - max longitude, floating value in range `[-180°, 180°]` -- latitude\_max - max latitude, floating value in range `[-90°, 90°]` -- precision - geohash precision, `UInt8` in range `[1, 12]` - -Please note that all coordinate parameters should 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. -- \[\] - empty array if *min* values of *latitude* and *longitude* aren’t less than corresponding *max* values. - -Please note that function will throw an exception if resulting array is over 10’000’000 items long. - -**Example** - -``` sql -SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos -``` - -``` text -┌─thasos──────────────────────────────────────┐ -│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ -└─────────────────────────────────────────────┘ -``` - -## h3GetBaseCell {#h3getbasecell} - -Returns the base cell number of the index. - -**Syntax** - -``` sql -h3GetBaseCell(index) -``` - -**Parameters** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Returned values** - -- Hexagon base cell number. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT h3GetBaseCell(612916788725809151) as basecell -``` - -Result: - -``` text -┌─basecell─┐ -│ 12 │ -└──────────┘ -``` - -## h3HexAreaM2 {#h3hexaream2} - -Average hexagon area in square meters at the given resolution. - -**Syntax** - -``` sql -h3HexAreaM2(resolution) -``` - -**Parameters** - -- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Returned values** - -- Area in m². Type: [Float64](../../sql_reference/data_types/float.md). - -**Example** - -Query: - -``` sql -SELECT h3HexAreaM2(13) as area -``` - -Result: - -``` text -┌─area─┐ -│ 43.9 │ -└──────┘ -``` - -## h3IndexesAreNeighbors {#h3indexesareneighbors} - -Returns whether or not the provided H3Indexes are neighbors. - -**Syntax** - -``` sql -h3IndexesAreNeighbors(index1, index2) -``` - -**Parameters** - -- `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). - -**Returned values** - -- Returns `1` if the indexes are neighbors, `0` otherwise. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n -``` - -Result: - -``` text -┌─n─┐ -│ 1 │ -└───┘ -``` - -## h3ToChildren {#h3tochildren} - -Returns an array with the child indexes of the given index. - -**Syntax** - -``` sql -h3ToChildren(index, resolution) -``` - -**Parameters** - -- `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). - -**Returned values** - -- Array with the child H3 indexes. Array of type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT h3ToChildren(599405990164561919, 6) AS children -``` - -Result: - -``` text -┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## h3ToParent {#h3toparent} - -Returns the parent (coarser) index containing the given index. - -**Syntax** - -``` sql -h3ToParent(index, resolution) -``` - -**Parameters** - -- `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). - -**Returned values** - -- Parent H3 index. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT h3ToParent(599405990164561919, 3) as parent -``` - -Result: - -``` text -┌─────────────parent─┐ -│ 590398848891879423 │ -└────────────────────┘ -``` - -## h3ToString {#h3tostring} - -Converts the H3Index representation of the index to the string representation. - -``` sql -h3ToString(index) -``` - -**Parameters** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Returned values** - -- String representation of the H3 index. Type: [String](../../sql_reference/data_types/string.md). - -**Example** - -Query: - -``` sql -SELECT h3ToString(617420388352917503) as h3_string -``` - -Result: - -``` text -┌─h3_string───────┐ -│ 89184926cdbffff │ -└─────────────────┘ -``` - -## stringToH3 {#stringtoh3} - -Converts the string representation to H3Index (UInt64) representation. - -``` sql -stringToH3(index_str) -``` - -**Parameters** - -- `index_str` — String representation of the H3 index. Type: [String](../../sql_reference/data_types/string.md). - -**Returned values** - -- Hexagon index number. Returns 0 on error. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT stringToH3('89184926cc3ffff') as index -``` - -Result: - -``` text -┌──────────────index─┐ -│ 617420388351344639 │ -└────────────────────┘ -``` - -## h3GetResolution {#h3getresolution} - -Returns the resolution of the index. - -**Syntax** - -``` sql -h3GetResolution(index) -``` - -**Parameters** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Returned values** - -- Index resolution. Range: `[0, 15]`. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT h3GetResolution(617420388352917503) as res -``` - -Result: - -``` text -┌─res─┐ -│ 9 │ -└─────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/en/sql_reference/functions/hash_functions.md b/docs/en/sql_reference/functions/hash_functions.md deleted file mode 100644 index 772c3c92d27..00000000000 --- a/docs/en/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,483 +0,0 @@ ---- -toc_priority: 50 -toc_title: Hash ---- - -# Hash functions {#hash-functions} - -Hash functions can be used for the deterministic pseudo-random shuffling of elements. - -## halfMD5 {#hash-functions-halfmd5} - -[Interprets](../../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. - -``` sql -halfMD5(par1, ...) -``` - -The function is relatively slow (5 million short strings per second per processor core). -Consider using the [sipHash64](#hash_functions-siphash64) function instead. - -**Parameters** - -The function takes a variable number of input parameters. Parameters can be any of the [supported data types](../../sql_reference/data_types/index.md). - -**Returned Value** - -A [UInt64](../../sql_reference/data_types/int_uint.md) data type hash value. - -**Example** - -``` sql -SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type -``` - -``` text -┌────────halfMD5hash─┬─type───┐ -│ 186182704141653334 │ UInt64 │ -└────────────────────┴────────┘ -``` - -## MD5 {#hash_functions-md5} - -Calculates the MD5 from a string and returns the resulting set of bytes as FixedString(16). -If you don’t need MD5 in particular, but you need a decent cryptographic 128-bit hash, use the ‘sipHash128’ function instead. -If you want to get the same result as output by the md5sum utility, use lower(hex(MD5(s))). - -## sipHash64 {#hash_functions-siphash64} - -Produces a 64-bit [SipHash](https://131002.net/siphash/) hash value. - -``` sql -sipHash64(par1,...) -``` - -This is a cryptographic hash function. It works at least three times faster than the [MD5](#hash_functions-md5) function. - -Function [interprets](../../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. Then combines hashes by the following algorithm: - -1. After hashing all the input parameters, the function gets the array of hashes. -2. Function takes the first and the second elements and calculates a hash for the array of them. -3. Then the function takes the hash value, calculated at the previous step, and the third element of the initial hash array, and calculates a hash for the array of them. -4. The previous step is repeated for all the remaining elements of the initial hash array. - -**Parameters** - -The function takes a variable number of input parameters. Parameters can be any of the [supported data types](../../sql_reference/data_types/index.md). - -**Returned Value** - -A [UInt64](../../sql_reference/data_types/int_uint.md) data type hash value. - -**Example** - -``` sql -SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type -``` - -``` text -┌──────────────SipHash─┬─type───┐ -│ 13726873534472839665 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## sipHash128 {#hash_functions-siphash128} - -Calculates SipHash from a string. -Accepts a String-type argument. Returns FixedString(16). -Differs from sipHash64 in that the final xor-folding state is only done up to 128 bits. - -## cityHash64 {#cityhash64} - -Produces a 64-bit [CityHash](https://github.com/google/cityhash) hash value. - -``` sql -cityHash64(par1,...) -``` - -This is a fast non-cryptographic hash function. It uses the CityHash algorithm for string parameters and implementation-specific fast non-cryptographic hash function for parameters with other data types. The function uses the CityHash combinator to get the final results. - -**Parameters** - -The function takes a variable number of input parameters. Parameters can be any of the [supported data types](../../sql_reference/data_types/index.md). - -**Returned Value** - -A [UInt64](../../sql_reference/data_types/int_uint.md) data type hash value. - -**Examples** - -Call example: - -``` sql -SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type -``` - -``` text -┌─────────────CityHash─┬─type───┐ -│ 12072650598913549138 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -The following example shows how to compute the checksum of the entire table with accuracy up to the row order: - -``` sql -SELECT groupBitXor(cityHash64(*)) FROM table -``` - -## intHash32 {#inthash32} - -Calculates a 32-bit hash code from any type of integer. -This is a relatively fast non-cryptographic hash function of average quality for numbers. - -## intHash64 {#inthash64} - -Calculates a 64-bit hash code from any type of integer. -It works faster than intHash32. Average quality. - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -Calculates SHA-1, SHA-224, or SHA-256 from a string and returns the resulting set of bytes as FixedString(20), FixedString(28), or FixedString(32). -The function works fairly slowly (SHA-1 processes about 5 million short strings per second per processor core, while SHA-224 and SHA-256 process about 2.2 million). -We recommend using this function only in cases when you need a specific hash function and you can’t select it. -Even in these cases, we recommend applying the function offline and pre-calculating values when inserting them into the table, instead of applying it in SELECTS. - -## URLHash(url\[, N\]) {#urlhashurl-n} - -A fast, decent-quality non-cryptographic hash function for a string obtained from a URL using some type of normalization. -`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` or `#` at the end, if present. -`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` or `#` at the end, if present. -Levels are the same as in URLHierarchy. This function is specific to Yandex.Metrica. - -## farmHash64 {#farmhash64} - -Produces a 64-bit [FarmHash](https://github.com/google/farmhash) hash value. - -``` sql -farmHash64(par1, ...) -``` - -The function uses the `Hash64` method from all [available methods](https://github.com/google/farmhash/blob/master/src/farmhash.h). - -**Parameters** - -The function takes a variable number of input parameters. Parameters can be any of the [supported data types](../../sql_reference/data_types/index.md). - -**Returned Value** - -A [UInt64](../../sql_reference/data_types/int_uint.md) data type hash value. - -**Example** - -``` sql -SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type -``` - -``` text -┌─────────────FarmHash─┬─type───┐ -│ 17790458267262532859 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## javaHash {#hash_functions-javahash} - -Calculates [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) from a string. This hash function is neither fast nor having a good quality. The only reason to use it is when this algorithm is already used in another system and you have to calculate exactly the same result. - -**Syntax** - -``` sql -SELECT javaHash(''); -``` - -**Returned value** - -A `Int32` data type hash value. - -**Example** - -Query: - -``` sql -SELECT javaHash('Hello, world!'); -``` - -Result: - -``` text -┌─javaHash('Hello, world!')─┐ -│ -1880044555 │ -└───────────────────────────┘ -``` - -## javaHashUTF16LE {#javahashutf16le} - -Calculates [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) from a string, assuming it contains bytes representing a string in UTF-16LE encoding. - -**Syntax** - -``` sql -javaHashUTF16LE(stringUtf16le) -``` - -**Parameters** - -- `stringUtf16le` — a string in UTF-16LE encoding. - -**Returned value** - -A `Int32` data type hash value. - -**Example** - -Correct query with UTF-16LE encoded string. - -Query: - -``` sql -SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) -``` - -Result: - -``` text -┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ -│ 3556498 │ -└──────────────────────────────────────────────────────────────┘ -``` - -## hiveHash {#hash-functions-hivehash} - -Calculates `HiveHash` from a string. - -``` sql -SELECT hiveHash(''); -``` - -This is just [JavaHash](#hash_functions-javahash) with zeroed out sign bit. This function is used in [Apache Hive](https://en.wikipedia.org/wiki/Apache_Hive) for versions before 3.0. This hash function is neither fast nor having a good quality. The only reason to use it is when this algorithm is already used in another system and you have to calculate exactly the same result. - -**Returned value** - -A `Int32` data type hash value. - -Type: `hiveHash`. - -**Example** - -Query: - -``` sql -SELECT hiveHash('Hello, world!'); -``` - -Result: - -``` text -┌─hiveHash('Hello, world!')─┐ -│ 267439093 │ -└───────────────────────────┘ -``` - -## metroHash64 {#metrohash64} - -Produces a 64-bit [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/) hash value. - -``` sql -metroHash64(par1, ...) -``` - -**Parameters** - -The function takes a variable number of input parameters. Parameters can be any of the [supported data types](../../sql_reference/data_types/index.md). - -**Returned Value** - -A [UInt64](../../sql_reference/data_types/int_uint.md) data type hash value. - -**Example** - -``` sql -SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type -``` - -``` text -┌────────────MetroHash─┬─type───┐ -│ 14235658766382344533 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## jumpConsistentHash {#jumpconsistenthash} - -Calculates JumpConsistentHash form a UInt64. -Accepts two arguments: a UInt64-type key and the number of buckets. Returns Int32. -For more information, see the link: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) - -## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} - -Produces a [MurmurHash2](https://github.com/aappleby/smhasher) hash value. - -``` sql -murmurHash2_32(par1, ...) -murmurHash2_64(par1, ...) -``` - -**Parameters** - -Both functions take a variable number of input parameters. Parameters can be any of the [supported data types](../../sql_reference/data_types/index.md). - -**Returned Value** - -- The `murmurHash2_32` function returns hash value having the [UInt32](../../sql_reference/data_types/int_uint.md) data type. -- The `murmurHash2_64` function returns hash value having the [UInt64](../../sql_reference/data_types/int_uint.md) data type. - -**Example** - -``` sql -SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type -``` - -``` text -┌──────────MurmurHash2─┬─type───┐ -│ 11832096901709403633 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## gccMurmurHash {#gccmurmurhash} - -Calculates a 64-bit [MurmurHash2](https://github.com/aappleby/smhasher) hash value using the same hash seed as [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191). It is portable between CLang and GCC builds. - -**Syntax** - -```sql -gccMurmurHash(par1, ...); -``` - -**Parameters** - -- `par1, ...` — A variable number of parameters that can be any of the [supported data types](../../sql_reference/data_types/index.md#data_types). - -**Returned value** - -- Calculated hash value. - -Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -```sql -SELECT - gccMurmurHash(1, 2, 3) AS res1, - gccMurmurHash(('a', [1, 2, 3], 4, (4, ['foo', 'bar'], 1, (1, 2)))) AS res2 -``` - -Result: - -``` text -┌─────────────────res1─┬────────────────res2─┐ -│ 12384823029245979431 │ 1188926775431157506 │ -└──────────────────────┴─────────────────────┘ -``` - -## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} - -Produces a [MurmurHash3](https://github.com/aappleby/smhasher) hash value. - -``` sql -murmurHash3_32(par1, ...) -murmurHash3_64(par1, ...) -``` - -**Parameters** - -Both functions take a variable number of input parameters. Parameters can be any of the [supported data types](../../sql_reference/data_types/index.md). - -**Returned Value** - -- The `murmurHash3_32` function returns a [UInt32](../../sql_reference/data_types/int_uint.md) data type hash value. -- The `murmurHash3_64` function returns a [UInt64](../../sql_reference/data_types/int_uint.md) data type hash value. - -**Example** - -``` sql -SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3─┬─type───┐ -│ 2152717 │ UInt32 │ -└─────────────┴────────┘ -``` - -## murmurHash3\_128 {#murmurhash3-128} - -Produces a 128-bit [MurmurHash3](https://github.com/aappleby/smhasher) hash value. - -``` sql -murmurHash3_128( expr ) -``` - -**Parameters** - -- `expr` — [Expressions](../syntax.md#syntax-expressions) returning a [String](../../sql_reference/data_types/string.md)-type value. - -**Returned Value** - -A [FixedString(16)](../../sql_reference/data_types/fixedstring.md) data type hash value. - -**Example** - -``` sql -SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3──────┬─type────────────┐ -│ 6�1�4"S5KT�~~q │ FixedString(16) │ -└──────────────────┴─────────────────┘ -``` - -## xxHash32, xxHash64 {#hash-functions-xxhash32} - -Calculates `xxHash` from a string. It is proposed in two flavors, 32 and 64 bits. - -``` sql -SELECT xxHash32(''); - -OR - -SELECT xxHash64(''); -``` - -**Returned value** - -A `Uint32` or `Uint64` data type hash value. - -Type: `xxHash`. - -**Example** - -Query: - -``` sql -SELECT xxHash32('Hello, world!'); -``` - -Result: - -``` text -┌─xxHash32('Hello, world!')─┐ -│ 834093149 │ -└───────────────────────────┘ -``` - -**See Also** - -- [xxHash](http://cyan4973.github.io/xxHash/). - - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/en/sql_reference/functions/higher_order_functions.md b/docs/en/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index 99d2d8ea885..00000000000 --- a/docs/en/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,262 +0,0 @@ ---- -toc_priority: 57 -toc_title: Higher-Order ---- - -# Higher-order functions {#higher-order-functions} - -## `->` operator, lambda(params, expr) function {#operator-lambdaparams-expr-function} - -Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. - -Examples: `x -> 2 * x, str -> str != Referer.` - -Higher-order functions can only accept lambda functions as their functional argument. - -A lambda function that accepts multiple arguments can be passed to a higher-order function. In this case, the higher-order function is passed several arrays of identical length that these arguments will correspond to. - -For some functions, such as [arrayCount](#higher_order_functions-array-count) or [arraySum](#higher_order_functions-array-count), the first argument (the lambda function) can be omitted. In this case, identical mapping is assumed. - -A lambda function can’t be omitted for the following functions: - -- [arrayMap](#higher_order_functions-array-map) -- [arrayFilter](#higher_order_functions-array-filter) -- [arrayFill](#higher_order_functions-array-fill) -- [arrayReverseFill](#higher_order_functions-array-reverse-fill) -- [arraySplit](#higher_order_functions-array-split) -- [arrayReverseSplit](#higher_order_functions-array-reverse-split) -- [arrayFirst](#higher_order_functions-array-first) -- [arrayFirstIndex](#higher_order_functions-array-first-index) - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -Returns an array obtained from the original application of the `func` function to each element in the `arr` array. - -Examples: - -``` sql -SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,4,5] │ -└─────────┘ -``` - -The following example shows how to create a tuple of elements from different arrays: - -``` sql -SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res -``` - -``` text -┌─res─────────────────┐ -│ [(1,4),(2,5),(3,6)] │ -└─────────────────────┘ -``` - -Note that the first argument (lambda function) can’t be omitted in the `arrayMap` function. - -### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} - -Returns an array containing only the elements in `arr1` for which `func` returns something other than 0. - -Examples: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - -``` text -┌─res───────────┐ -│ ['abc World'] │ -└───────────────┘ -``` - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - -``` text -┌─res─┐ -│ [2] │ -└─────┘ -``` - -Note that the first argument (lambda function) can’t be omitted in the `arrayFilter` function. - -### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} - -Scan through `arr1` from the first element to the last element and replace `arr1[i]` by `arr1[i - 1]` if `func` returns 0. The first element of `arr1` will not be replaced. - -Examples: - -``` sql -SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res──────────────────────────────┐ -│ [1,1,3,11,12,12,12,5,6,14,14,14] │ -└──────────────────────────────────┘ -``` - -Note that the first argument (lambda function) can’t be omitted in the `arrayFill` function. - -### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} - -Scan through `arr1` from the last element to the first element and replace `arr1[i]` by `arr1[i + 1]` if `func` returns 0. The last element of `arr1` will not be replaced. - -Examples: - -``` sql -SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res────────────────────────────────┐ -│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ -└────────────────────────────────────┘ -``` - -Note that the first argument (lambda function) can’t be omitted in the `arrayReverseFill` function. - -### arraySplit(func, arr1, …) {#higher_order_functions-array-split} - -Split `arr1` into multiple arrays. When `func` 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: - -``` sql -SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res─────────────┐ -│ [[1,2,3],[4,5]] │ -└─────────────────┘ -``` - -Note that the first argument (lambda function) can’t be omitted in the `arraySplit` function. - -### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} - -Split `arr1` into multiple arrays. When `func` 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: - -``` sql -SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res───────────────┐ -│ [[1],[2,3,4],[5]] │ -└───────────────────┘ -``` - -Note that the first argument (lambda function) can’t be omitted in the `arraySplit` function. - -### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} - -Returns the number of elements in the arr array for which func returns something other than 0. If ‘func’ is not specified, it returns the number of non-zero elements in the array. - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -Returns 1 if there is at least one element in ‘arr’ for which ‘func’ returns something other than 0. Otherwise, it returns 0. - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -Returns 1 if ‘func’ returns something other than 0 for all the elements in ‘arr’. Otherwise, it returns 0. - -### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} - -Returns the sum of the ‘func’ values. If the function is omitted, it just returns the sum of the array elements. - -### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} - -Returns the first element in the ‘arr1’ array for which ‘func’ returns something other than 0. - -Note that the first argument (lambda function) can’t be omitted in the `arrayFirst` function. - -### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} - -Returns the index of the first element in the ‘arr1’ array for which ‘func’ returns something other than 0. - -Note that the first argument (lambda function) can’t be omitted in the `arrayFirstIndex` function. - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -Returns an array of partial sums of elements in the source array (a running sum). If the `func` function is specified, then the values of the array elements are converted by this function before summing. - -Example: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - -``` text -┌─res──────────┐ -│ [1, 2, 3, 4] │ -└──────────────┘ -``` - -### arrayCumSumNonNegative(arr) {#arraycumsumnonnegativearr} - -Same as `arrayCumSum`, returns an array of partial sums of elements in the source array (a running sum). Different `arrayCumSum`, when then returned value contains a value less than zero, the value is replace with zero and the subsequent calculation is performed with zero parameters. For example: - -``` sql -SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,0,1] │ -└───────────┘ -``` - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -Returns an array as result of sorting the elements of `arr1` in ascending order. If the `func` function is specified, sorting order is determined by the result of the function `func` applied to the elements of array (arrays) - -The [Schwartzian transform](https://en.wikipedia.org/wiki/Schwartzian_transform) is used to improve sorting efficiency. - -Example: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -For more information about the `arraySort` method, see the [Functions for Working With Arrays](array_functions.md#array_functions-sort) section. - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -Returns an array as result of sorting the elements of `arr1` in descending order. If the `func` function is specified, sorting order is determined by the result of the function `func` applied to the elements of array (arrays). - -Example: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -For more information about the `arrayReverseSort` method, see the [Functions for Working With Arrays](array_functions.md#array_functions-reverse-sort) section. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/en/sql_reference/functions/in_functions.md b/docs/en/sql_reference/functions/in_functions.md deleted file mode 100644 index b8ff809b276..00000000000 --- a/docs/en/sql_reference/functions/in_functions.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -toc_priority: 60 -toc_title: Implementing the IN Operator ---- - -# Functions For Implementing the IN Operator {#functions-for-implementing-the-in-operator} - -## in, notIn, globalIn, globalNotIn {#in-functions} - -See the section [IN operators](../statements/select.md#select-in-operators). - -## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} - -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. -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. - -## tupleElement(tuple, n), operator x.N {#tupleelementtuple-n-operator-x-n} - -A function that allows getting a column from a tuple. -‘N’ is the column index, starting from 1. N must be a constant. ‘N’ must be a constant. ‘N’ must be a strict postive integer no greater than the size of the tuple. -There is no cost to execute the function. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/en/sql_reference/functions/index.md b/docs/en/sql_reference/functions/index.md deleted file mode 100644 index a69c1ec1848..00000000000 --- a/docs/en/sql_reference/functions/index.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -toc_folder_title: Functions -toc_priority: 32 -toc_title: Introduction ---- - -# Functions {#functions} - -There are at least\* two types of functions - regular functions (they are just called “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn’t depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). - -In this section we discuss regular functions. For aggregate functions, see the section “Aggregate functions”. - -\* - There is a third type of function that the ‘arrayJoin’ function belongs to; table functions can also be mentioned separately.\* - -## Strong typing {#strong-typing} - -In contrast to standard SQL, ClickHouse has strong typing. In other words, it doesn’t make implicit conversions between types. Each function works for a specific set of types. This means that sometimes you need to use type conversion functions. - -## Common subexpression elimination {#common-subexpression-elimination} - -All expressions in a query that have the same AST (the same record or same result of syntactic parsing) are considered to have identical values. Such expressions are concatenated and executed once. Identical subqueries are also eliminated this way. - -## Types of results {#types-of-results} - -All functions return a single return as the result (not several values, and not zero values). The type of result is usually defined only by the types of arguments, not by the values. Exceptions are the tupleElement function (the a.N operator), and the toFixedString function. - -## Constants {#constants} - -For simplicity, certain functions can only work with constants for some arguments. For example, the right argument of the LIKE operator must be a constant. -Almost all functions return a constant for constant arguments. The exception is functions that generate random numbers. -The ‘now’ function returns different values for queries that were run at different times, but the result is considered a constant, since constancy is only important within a single query. -A constant expression is also considered a constant (for example, the right half of the LIKE operator can be constructed from multiple constants). - -Functions can be implemented in different ways for constant and non-constant arguments (different code is executed). But the results for a constant and for a true column containing only the same value should match each other. - -## NULL processing {#null-processing} - -Functions have the following behaviors: - -- If at least one of the arguments of the function is `NULL`, the function result is also `NULL`. -- Special behavior that is specified individually in the description of each function. In the ClickHouse source code, these functions have `UseDefaultImplementationForNulls=false`. - -## Constancy {#constancy} - -Functions can’t change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. - -## Error handling {#error-handling} - -Some functions might throw an exception if the data is invalid. In this case, the query is canceled and an error text is returned to the client. For distributed processing, when an exception occurs on one of the servers, the other servers also attempt to abort the query. - -## Evaluation of argument expressions {#evaluation-of-argument-expressions} - -In almost all programming languages, one of the arguments might not be evaluated for certain operators. This is usually the operators `&&`, `||`, and `?:`. -But in ClickHouse, arguments of functions (operators) are always evaluated. This is because entire parts of columns are evaluated at once, instead of calculating each row separately. - -## Performing functions for distributed query processing {#performing-functions-for-distributed-query-processing} - -For distributed query processing, as many stages of query processing as possible are performed on remote servers, and the rest of the stages (merging intermediate results and everything after that) are performed on the requestor server. - -This means that functions can be performed on different servers. -For example, in the query `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` - -- if a `distributed_table` has at least two shards, the functions ‘g’ and ‘h’ are performed on remote servers, and the function ‘f’ is performed on the requestor server. -- if a `distributed_table` has only one shard, all the ‘f’, ‘g’, and ‘h’ functions are performed on this shard’s server. - -The result of a function usually doesn’t depend on which server it is performed on. However, sometimes this is important. -For example, functions that work with dictionaries use the dictionary that exists on the server they are running on. -Another example is the `hostName` function, which returns the name of the server it is running on in order to make `GROUP BY` by servers in a `SELECT` query. - -If a function in a query is performed on the requestor server, but you need to perform it on remote servers, you can wrap it in an ‘any’ aggregate function or add it to a key in `GROUP BY`. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/en/sql_reference/functions/introspection.md b/docs/en/sql_reference/functions/introspection.md deleted file mode 100644 index ae237fa8e11..00000000000 --- a/docs/en/sql_reference/functions/introspection.md +++ /dev/null @@ -1,308 +0,0 @@ ---- -toc_priority: 65 -toc_title: Introspection ---- - -# Introspection Functions {#introspection-functions} - -You can use functions described in this chapter to introspect [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) and [DWARF](https://en.wikipedia.org/wiki/DWARF) for query profiling. - -!!! warning "Warning" - These functions are slow and may impose security considerations. - -For proper operation of introspection functions: - -- Install the `clickhouse-common-static-dbg` package. - -- Set the [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) setting to 1. - - For security reasons introspection functions are disabled by default. - -ClickHouse saves profiler reports to the [trace\_log](../../operations/system_tables.md#system_tables-trace_log) system table. Make sure the table and profiler are configured properly. - -## addressToLine {#addresstoline} - -Converts virtual memory address inside ClickHouse server process to the filename and the line number in ClickHouse source code. - -If you use official ClickHouse packages, you need to install the `clickhouse-common-static-dbg` package. - -**Syntax** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**Parameters** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/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). - -**Example** - -Enabling introspection functions: - -``` sql -SET allow_introspection_functions=1 -``` - -Selecting the first string from the `trace_log` system table: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -The `trace` field contains the stack trace at the moment of sampling. - -Getting the source code filename and the line number for a single address: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -``` - -Applying the function to the whole stack trace: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -The [arrayMap](higher_order_functions.md#higher_order_functions-array-map) function allows to process each individual element of the `trace` array by the `addressToLine` function. The result of this processing you see in the `trace_source_code_lines` column of output. - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## addressToSymbol {#addresstosymbol} - -Converts virtual memory address inside ClickHouse server process to the symbol from ClickHouse object files. - -**Syntax** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**Parameters** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/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). - -**Example** - -Enabling introspection functions: - -``` sql -SET allow_introspection_functions=1 -``` - -Selecting the first string from the `trace_log` system table: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -The `trace` field contains the stack trace at the moment of sampling. - -Getting a symbol for a single address: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -Applying the function to the whole stack trace: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -The [arrayMap](higher_order_functions.md#higher_order_functions-array-map) function allows to process each individual element of the `trace` array by the `addressToSymbols` function. The result of this processing you see in the `trace_symbols` column of output. - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## demangle {#demangle} - -Converts a symbol that you can get using the [addressToSymbol](#addresstosymbol) function to the C++ function name. - -**Syntax** - -``` sql -demangle(symbol) -``` - -**Parameters** - -- `symbol` ([String](../../sql_reference/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). - -**Example** - -Enabling introspection functions: - -``` sql -SET allow_introspection_functions=1 -``` - -Selecting the first string from the `trace_log` system table: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -The `trace` field contains the stack trace at the moment of sampling. - -Getting a function name for a single address: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -Applying the function to the whole stack trace: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -The [arrayMap](higher_order_functions.md#higher_order_functions-array-map) function allows to process each individual element of the `trace` array by the `demangle` function. The result of this processing you see in the `trace_functions` column of output. - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/en/sql_reference/functions/ip_address_functions.md b/docs/en/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index e412197d9ac..00000000000 --- a/docs/en/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,246 +0,0 @@ ---- -toc_priority: 55 -toc_title: Working with IP Addresses ---- - -# Functions for working with IP addresses {#functions-for-working-with-ip-addresses} - -## IPv4NumToString(num) {#ipv4numtostringnum} - -Takes a UInt32 number. Interprets it as an IPv4 address in big endian. Returns a string containing the corresponding IPv4 address in the format A.B.C.d (dot-separated numbers in decimal form). - -## IPv4StringToNum(s) {#ipv4stringtonums} - -The reverse function of IPv4NumToString. If the IPv4 address has an invalid format, it returns 0. - -## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} - -Similar to IPv4NumToString, but using xxx instead of the last octet. - -Example: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─k──────────────┬─────c─┐ -│ 83.149.9.xxx │ 26238 │ -│ 217.118.81.xxx │ 26074 │ -│ 213.87.129.xxx │ 25481 │ -│ 83.149.8.xxx │ 24984 │ -│ 217.118.83.xxx │ 22797 │ -│ 78.25.120.xxx │ 22354 │ -│ 213.87.131.xxx │ 21285 │ -│ 78.25.121.xxx │ 20887 │ -│ 188.162.65.xxx │ 19694 │ -│ 83.149.48.xxx │ 17406 │ -└────────────────┴───────┘ -``` - -Since using ‘xxx’ is highly unusual, this may be changed in the future. We recommend that you don’t rely on the exact format of this fragment. - -### IPv6NumToString(x) {#ipv6numtostringx} - -Accepts a FixedString(16) value containing the IPv6 address in binary format. Returns a string containing this address in text format. -IPv6-mapped IPv4 addresses are output in the format ::ffff:111.222.33.44. Examples: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - -``` text -┌─addr─────────┐ -│ 2a02:6b8::11 │ -└──────────────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ -│ 2a02:2168:aaa:bbbb::2 │ 24695 │ -│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ -│ 2a02:6b8:0:fff::ff │ 16389 │ -│ 2a01:4f8:111:6666::2 │ 16016 │ -│ 2a02:2168:888:222::1 │ 15896 │ -│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ -│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ -│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ -│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ -│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ -└─────────────────────────────────────────┴───────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)─┬──────c─┐ -│ ::ffff:94.26.111.111 │ 747440 │ -│ ::ffff:37.143.222.4 │ 529483 │ -│ ::ffff:5.166.111.99 │ 317707 │ -│ ::ffff:46.38.11.77 │ 263086 │ -│ ::ffff:79.105.111.111 │ 186611 │ -│ ::ffff:93.92.111.88 │ 176773 │ -│ ::ffff:84.53.111.33 │ 158709 │ -│ ::ffff:217.118.11.22 │ 154004 │ -│ ::ffff:217.118.11.33 │ 148449 │ -│ ::ffff:217.118.11.44 │ 148243 │ -└────────────────────────────┴────────┘ -``` - -## IPv6StringToNum(s) {#ipv6stringtonums} - -The reverse function of IPv6NumToString. If the IPv6 address has an invalid format, it returns a string of null bytes. -HEX can be uppercase or lowercase. - -## IPv4ToIPv6(x) {#ipv4toipv6x} - -Takes a `UInt32` number. Interprets it as an IPv4 address in [big endian](https://en.wikipedia.org/wiki/Endianness). Returns a `FixedString(16)` value containing the IPv6 address in binary format. Examples: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - -``` text -┌─addr───────────────┐ -│ ::ffff:192.168.0.1 │ -└────────────────────┘ -``` - -## cutIPv6(x, bytesToCutForIPv6, bytesToCutForIPv4) {#cutipv6x-bytestocutforipv6-bytestocutforipv4} - -Accepts a FixedString(16) value containing the IPv6 address in binary format. Returns a string containing the address of the specified number of bytes removed in text format. For example: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - -``` text -┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ -│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ -└─────────────────────────────────────┴─────────────────────┘ -``` - -## IPv4CIDRToRange(ipv4, cidr), {#ipv4cidrtorangeipv4-cidr} - -Accepts an IPv4 and an UInt8 value containing the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Return a tuple with two IPv4 containing the lower range and the higher range of the subnet. - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - -``` text -┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ -│ ('192.168.0.0','192.168.255.255') │ -└────────────────────────────────────────────┘ -``` - -## IPv6CIDRToRange(ipv6, cidr), {#ipv6cidrtorangeipv6-cidr} - -Accepts an IPv6 and an UInt8 value containing the CIDR. Return a tuple with two IPv6 containing the lower range and the higher range of the subnet. - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); -``` - -``` text -┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ -│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -## toIPv4(string) {#toipv4string} - -An alias to `IPv4StringToNum()` that takes a string form of IPv4 address and returns value of [IPv4](../../sql_reference/data_types/domains/ipv4.md) type, which is binary equal to value returned by `IPv4StringToNum()`. - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - -``` text -┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ -│ UInt32 │ IPv4 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - -``` text -┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ -│ ABE1822D │ ABE1822D │ -└───────────────────────────────────┴──────────────────────────┘ -``` - -## toIPv6(string) {#toipv6string} - -An alias to `IPv6StringToNum()` that takes a string form of IPv6 address and returns value of [IPv6](../../sql_reference/data_types/domains/ipv6.md) type, which is binary equal to value returned by `IPv6StringToNum()`. - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - -``` text -┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ -│ FixedString(16) │ IPv6 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - -``` text -┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ -│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ -└───────────────────────────────────┴──────────────────────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/en/sql_reference/functions/json_functions.md b/docs/en/sql_reference/functions/json_functions.md deleted file mode 100644 index ca1690130e6..00000000000 --- a/docs/en/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -toc_priority: 56 -toc_title: Working with JSON. ---- - -# Functions for working with JSON {#functions-for-working-with-json} - -In Yandex.Metrica, JSON is transmitted by users as session parameters. There are some special functions for working with this JSON. (Although in most of the cases, the JSONs are additionally pre-processed, and the resulting values are put in separate columns in their processed format.) All these functions are based on strong assumptions about what the JSON can be, but they try to do as little as possible to get the job done. - -The following assumptions are made: - -1. The field name (function argument) must be a constant. -2. The field name is somehow canonically encoded in JSON. For example: `visitParamHas('{"abc":"def"}', 'abc') = 1`, but `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. Fields are searched for on any nesting level, indiscriminately. If there are multiple matching fields, the first occurrence is used. -4. The JSON doesn’t have space characters outside of string literals. - -## visitParamHas(params, name) {#visitparamhasparams-name} - -Checks whether there is a field with the ‘name’ name. - -## visitParamExtractUInt(params, name) {#visitparamextractuintparams-name} - -Parses UInt64 from the value of the field named ‘name’. If this is a string field, it tries to parse a number from the beginning of the string. If the field doesn’t exist, or it exists but doesn’t contain a number, it returns 0. - -## visitParamExtractInt(params, name) {#visitparamextractintparams-name} - -The same as for Int64. - -## visitParamExtractFloat(params, name) {#visitparamextractfloatparams-name} - -The same as for Float64. - -## visitParamExtractBool(params, name) {#visitparamextractboolparams-name} - -Parses a true/false value. The result is UInt8. - -## visitParamExtractRaw(params, name) {#visitparamextractrawparams-name} - -Returns the value of a field, including separators. - -Examples: - -``` sql -visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' -visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' -``` - -## visitParamExtractString(params, name) {#visitparamextractstringparams-name} - -Parses the string in double quotes. The value is unescaped. If unescaping failed, it returns an empty string. - -Examples: - -``` sql -visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' -visitParamExtractString('{"abc":"hello}', 'abc') = '' -``` - -There is currently no support for code points in the format `\uXXXX\uYYYY` that are not from the basic multilingual plane (they are converted to CESU-8 instead of UTF-8). - -The following functions are based on [simdjson](https://github.com/lemire/simdjson) designed for more complex JSON parsing requirements. The assumption 2 mentioned above still applies. - -## isValidJSON(json) {#isvalidjsonjson} - -Checks that passed string is a valid json. - -Examples: - -``` sql -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} - -If the value exists in the JSON document, `1` will be returned. - -If the value does not exist, `0` will be returned. - -Examples: - -``` sql -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 -``` - -`indices_or_keys` is a list of zero or more arguments each of them can be either string or integer. - -- String = access object member by key. -- Positive integer = access the n-th member/key from the beginning. -- Negative integer = access the n-th member/key from the end. - -Minimum index of the element is 1. Thus the element 0 doesn’t exist. - -You may use integers to access both JSON arrays and JSON objects. - -So, for example: - -``` sql -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' -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} - -Return the length of a JSON array or a JSON object. - -If the value does not exist or has a wrong type, `0` will be returned. - -Examples: - -``` sql -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} - -Return the type of a JSON value. - -If the value does not exist, `Null` will be returned. - -Examples: - -``` sql -SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' -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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -Parses a JSON and extract a value. These functions are similar to `visitParam` functions. - -If the value does not exist or has a wrong type, `0` will be returned. - -Examples: - -``` sql -SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 -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} - -Parses a JSON and extract a string. This function is similar to `visitParamExtractString` functions. - -If the value does not exist or has a wrong type, an empty string will be returned. - -The value is unescaped. If unescaping failed, it returns an empty string. - -Examples: - -``` sql -SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' -SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' -SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' -``` - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -Parses a JSON and extract a value of the given ClickHouse data type. - -This is a generalization of the previous `JSONExtract` functions. -This means -`JSONExtract(..., 'String')` returns exactly the same as `JSONExtractString()`, -`JSONExtract(..., 'Float64')` returns exactly the same as `JSONExtractFloat()`. - -Examples: - -``` sql -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL -SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 -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} - -Parses key-value pairs from a JSON where the values are of the given ClickHouse data type. - -Example: - -``` sql -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} - -Returns a part of JSON as unparsed string. - -If the part does not exist or has a wrong type, an empty string will be returned. - -Example: - -``` sql -SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' -``` - -## JSONExtractArrayRaw(json\[, indices\_or\_keys…\]) {#jsonextractarrayrawjson-indices-or-keys} - -Returns an array with elements of JSON array, each represented as unparsed string. - -If the part does not exist or isn’t array, an empty array will be returned. - -Example: - -``` sql -SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) - -## JSONExtractKeysAndValuesRaw(json\[, indices\_or\_keys…\]) {#jsonextractkeysandvaluesrawjson-indices-or-keys} - -Parses key-value pairs from a JSON and returns an array of such pairs, each value represented as unparsed string. - -Example: - -``` sql -SELECT JSONExtractKeysAndValuesRaw('{"a": "hello", "b": [-100, 200.0, 300]}') = [('a','"hello"'),('b','[-100,200,300]')] -``` diff --git a/docs/en/sql_reference/functions/logical_functions.md b/docs/en/sql_reference/functions/logical_functions.md deleted file mode 100644 index c1aa30775c3..00000000000 --- a/docs/en/sql_reference/functions/logical_functions.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -toc_priority: 37 -toc_title: Logical ---- - -# Logical functions {#logical-functions} - -Logical functions accept any numeric types, but return a UInt8 number equal to 0 or 1. - -Zero as an argument is considered “false,” while any non-zero value is considered “true”. - -## and, AND operator {#and-and-operator} - -## or, OR operator {#or-or-operator} - -## not, NOT operator {#not-not-operator} - -## xor {#xor} - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) diff --git a/docs/en/sql_reference/functions/machine_learning_functions.md b/docs/en/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index 4ff4e592e7b..00000000000 --- a/docs/en/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -toc_priority: 64 -toc_title: Machine Learning Functions ---- - -# Machine Learning Functions {#machine-learning-functions} - -## evalMLMethod (prediction) {#machine_learning_methods-evalmlmethod} - -Prediction using fitted regression models uses `evalMLMethod` function. See link in `linearRegression`. - -### Stochastic Linear Regression {#stochastic-linear-regression} - -The [stochasticLinearRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlinearregression) aggregate function implements stochastic gradient descent method using linear model and MSE loss function. Uses `evalMLMethod` to predict on new data. - -### Stochastic Logistic Regression {#stochastic-logistic-regression} - -The [stochasticLogisticRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlogisticregression) aggregate function implements stochastic gradient descent method for binary classification problem. Uses `evalMLMethod` to predict on new data. diff --git a/docs/en/sql_reference/functions/math_functions.md b/docs/en/sql_reference/functions/math_functions.md deleted file mode 100644 index 3f0f8623840..00000000000 --- a/docs/en/sql_reference/functions/math_functions.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -toc_priority: 44 -toc_title: Mathematical ---- - -# Mathematical functions {#mathematical-functions} - -All the functions return a Float64 number. The accuracy of the result is close to the maximum precision possible, but the result might not coincide with the machine representable number nearest to the corresponding real number. - -## e() {#e} - -Returns a Float64 number that is close to the number e. - -## pi() {#pi} - -Returns a Float64 number that is close to the number π. - -## exp(x) {#expx} - -Accepts a numeric argument and returns a Float64 number close to the exponent of the argument. - -## log(x), ln(x) {#logx-lnx} - -Accepts a numeric argument and returns a Float64 number close to the natural logarithm of the argument. - -## exp2(x) {#exp2x} - -Accepts a numeric argument and returns a Float64 number close to 2 to the power of x. - -## log2(x) {#log2x} - -Accepts a numeric argument and returns a Float64 number close to the binary logarithm of the argument. - -## exp10(x) {#exp10x} - -Accepts a numeric argument and returns a Float64 number close to 10 to the power of x. - -## log10(x) {#log10x} - -Accepts a numeric argument and returns a Float64 number close to the decimal logarithm of the argument. - -## sqrt(x) {#sqrtx} - -Accepts a numeric argument and returns a Float64 number close to the square root of the argument. - -## cbrt(x) {#cbrtx} - -Accepts a numeric argument and returns a Float64 number close to the cubic root of the argument. - -## erf(x) {#erfx} - -If ‘x’ is non-negative, then erf(x / σ√2) is the probability that a random variable having a normal distribution with standard deviation ‘σ’ takes the value that is separated from the expected value by more than ‘x’. - -Example (three sigma rule): - -``` sql -SELECT erf(3 / sqrt(2)) -``` - -``` text -┌─erf(divide(3, sqrt(2)))─┐ -│ 0.9973002039367398 │ -└─────────────────────────┘ -``` - -## erfc(x) {#erfcx} - -Accepts a numeric argument and returns a Float64 number close to 1 - erf(x), but without loss of precision for large ‘x’ values. - -## lgamma(x) {#lgammax} - -The logarithm of the gamma function. - -## tgamma(x) {#tgammax} - -Gamma function. - -## sin(x) {#sinx} - -The sine. - -## cos(x) {#cosx} - -The cosine. - -## tan(x) {#tanx} - -The tangent. - -## asin(x) {#asinx} - -The arc sine. - -## acos(x) {#acosx} - -The arc cosine. - -## atan(x) {#atanx} - -The arc tangent. - -## pow(x, y), power(x, y) {#powx-y-powerx-y} - -Takes two numeric arguments x and y. Returns a Float64 number close to x to the power of y. - -## intExp2 {#intexp2} - -Accepts a numeric argument and returns a UInt64 number close to 2 to the power of x. - -## intExp10 {#intexp10} - -Accepts a numeric argument and returns a UInt64 number close to 10 to the power of x. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/en/sql_reference/functions/other_functions.md b/docs/en/sql_reference/functions/other_functions.md deleted file mode 100644 index 843897c21b2..00000000000 --- a/docs/en/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,1077 +0,0 @@ ---- -toc_priority: 66 -toc_title: Other ---- - -# Other functions {#other-functions} - -## hostName() {#hostname} - -Returns a string with the name of the host that this function was performed on. For distributed processing, this is the name of the remote server host, if the function is performed on a remote server. - -## FQDN {#fqdn} - -Returns the fully qualified domain name. - -**Syntax** - -``` sql -fqdn(); -``` - -This function is case-insensitive. - -**Returned value** - -- String with the fully qualified domain name. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT FQDN(); -``` - -Result: - -``` text -┌─FQDN()──────────────────────────┐ -│ clickhouse.ru-central1.internal │ -└─────────────────────────────────┘ -``` - -## basename {#basename} - -Extracts the trailing part of a string after the last slash or backslash. This function if often used to extract the filename from a path. - -``` sql -basename( expr ) -``` - -**Parameters** - -- `expr` — Expression resulting in a [String](../../sql_reference/data_types/string.md) type value. All the backslashes must be escaped in the resulting value. - -**Returned Value** - -A string that contains: - -- The trailing part of a string after the last slash or backslash. - - If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. - -- The original string if there are no slashes or backslashes. - -**Example** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## visibleWidth(x) {#visiblewidthx} - -Calculates the approximate width when outputting values to the console in text format (tab-separated). -This function is used by the system for implementing Pretty formats. - -`NULL` is represented as a string corresponding to `NULL` in `Pretty` formats. - -``` sql -SELECT visibleWidth(NULL) -``` - -``` text -┌─visibleWidth(NULL)─┐ -│ 4 │ -└────────────────────┘ -``` - -## toTypeName(x) {#totypenamex} - -Returns a string containing the type name of the passed argument. - -If `NULL` is passed to the function as input, then it returns the `Nullable(Nothing)` type, which corresponds to an internal `NULL` representation in ClickHouse. - -## blockSize() {#function-blocksize} - -Gets the size of the block. -In ClickHouse, queries are always run on blocks (sets of column parts). This function allows getting the size of the block that you called it for. - -## materialize(x) {#materializex} - -Turns a constant into a full column containing just one value. -In ClickHouse, full columns and constants are represented differently in memory. Functions work differently for constant arguments and normal arguments (different code is executed), although the result is almost always the same. This function is for debugging this behavior. - -## ignore(…) {#ignore} - -Accepts any arguments, including `NULL`. Always returns 0. -However, the argument is still evaluated. This can be used for benchmarks. - -## sleep(seconds) {#sleepseconds} - -Sleeps ‘seconds’ seconds on each data block. You can specify an integer or a floating-point number. - -## sleepEachRow(seconds) {#sleepeachrowseconds} - -Sleeps ‘seconds’ seconds on each row. You can specify an integer or a floating-point number. - -## currentDatabase() {#currentdatabase} - -Returns the name of the current database. -You can use this function in table engine parameters in a CREATE TABLE query where you need to specify the database. - -## currentUser() {#other-function-currentuser} - -Returns the login of current user. Login of user, that initiated query, will be returned in case distibuted query. - -``` sql -SELECT currentUser(); -``` - -Alias: `user()`, `USER()`. - -**Returned values** - -- Login of current user. -- Login of user that initiated query in case of disributed query. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT currentUser(); -``` - -Result: - -``` text -┌─currentUser()─┐ -│ default │ -└───────────────┘ -``` - -## isFinite(x) {#isfinitex} - -Accepts Float32 and Float64 and returns UInt8 equal to 1 if the argument is not infinite and not a NaN, otherwise 0. - -## isInfinite(x) {#isinfinitex} - -Accepts Float32 and Float64 and returns UInt8 equal to 1 if the argument is infinite, otherwise 0. Note that 0 is returned for a NaN. - -## ifNotFinite {#ifnotfinite} - -Checks whether floating point value is finite. - -**Syntax** - - ifNotFinite(x,y) - -**Parameters** - -- `x` — Value to be checked 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 [ternary operator](conditional_functions.md#ternary-operator): `isFinite(x) ? x : y`. - -## isNaN(x) {#isnanx} - -Accepts Float32 and Float64 and returns UInt8 equal to 1 if the argument is a NaN, otherwise 0. - -## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -Accepts constant strings: database name, table name, and column name. Returns a UInt8 constant expression equal to 1 if there is a column, otherwise 0. If the hostname parameter is set, the test will run on a remote server. -The function throws an exception if the table does not exist. -For elements in a nested data structure, the function checks for the existence of a column. For the nested data structure itself, the function returns 0. - -## bar {#function-bar} - -Allows building a unicode-art diagram. - -`bar(x, min, max, width)` draws a band with a width proportional to `(x - min)` and equal to `width` characters when `x = max`. - -Parameters: - -- `x` — Size to display. -- `min, max` — Integer constants. The value must fit in `Int64`. -- `width` — Constant, positive integer, can be fractional. - -The band is drawn with accuracy to one eighth of a symbol. - -Example: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - -``` text -┌──h─┬──────c─┬─bar────────────────┐ -│ 0 │ 292907 │ █████████▋ │ -│ 1 │ 180563 │ ██████ │ -│ 2 │ 114861 │ ███▋ │ -│ 3 │ 85069 │ ██▋ │ -│ 4 │ 68543 │ ██▎ │ -│ 5 │ 78116 │ ██▌ │ -│ 6 │ 113474 │ ███▋ │ -│ 7 │ 170678 │ █████▋ │ -│ 8 │ 278380 │ █████████▎ │ -│ 9 │ 391053 │ █████████████ │ -│ 10 │ 457681 │ ███████████████▎ │ -│ 11 │ 493667 │ ████████████████▍ │ -│ 12 │ 509641 │ ████████████████▊ │ -│ 13 │ 522947 │ █████████████████▍ │ -│ 14 │ 539954 │ █████████████████▊ │ -│ 15 │ 528460 │ █████████████████▌ │ -│ 16 │ 539201 │ █████████████████▊ │ -│ 17 │ 523539 │ █████████████████▍ │ -│ 18 │ 506467 │ ████████████████▊ │ -│ 19 │ 520915 │ █████████████████▎ │ -│ 20 │ 521665 │ █████████████████▍ │ -│ 21 │ 542078 │ ██████████████████ │ -│ 22 │ 493642 │ ████████████████▍ │ -│ 23 │ 400397 │ █████████████▎ │ -└────┴────────┴────────────────────┘ -``` - -## transform {#transform} - -Transforms a value according to the explicitly defined mapping of some elements to other ones. -There are two variations of this function: - -### transform(x, array\_from, array\_to, default) {#transformx-array-from-array-to-default} - -`x` – What to transform. - -`array_from` – Constant array of values for converting. - -`array_to` – Constant array of values to convert the values in ‘from’ to. - -`default` – Which value to use if ‘x’ is not equal to any of the values in ‘from’. - -`array_from` and `array_to` – Arrays of the same size. - -Types: - -`transform(T, Array(T), Array(U), U) -> U` - -`T` and `U` can be numeric, string, or Date or DateTime types. -Where the same letter is indicated (T or U), for numeric types these might not be matching types, but types that have a common type. -For example, the first argument can have the Int64 type, while the second has the Array(UInt16) type. - -If the ‘x’ value is equal to one of the elements in the ‘array\_from’ array, it returns the existing element (that is numbered the same) from the ‘array\_to’ array. Otherwise, it returns ‘default’. If there are multiple matching elements in ‘array\_from’, it returns one of the matches. - -Example: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - -``` text -┌─title─────┬──────c─┐ -│ Yandex │ 498635 │ -│ Google │ 229872 │ -│ Other │ 104472 │ -└───────────┴────────┘ -``` - -### transform(x, array\_from, array\_to) {#transformx-array-from-array-to} - -Differs from the first variation in that the ‘default’ argument is omitted. -If the ‘x’ value is equal to one of the elements in the ‘array\_from’ array, it returns the matching element (that is numbered the same) from the ‘array\_to’ array. Otherwise, it returns ‘x’. - -Types: - -`transform(T, Array(T), Array(T)) -> T` - -Example: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -┌─s──────────────┬───────c─┐ -│ │ 2906259 │ -│ www.yandex │ 867767 │ -│ ███████.ru │ 313599 │ -│ mail.yandex.ru │ 107147 │ -│ ██████.ru │ 100355 │ -│ █████████.ru │ 65040 │ -│ news.yandex.ru │ 64515 │ -│ ██████.net │ 59141 │ -│ example.com │ 57316 │ -└────────────────┴─────────┘ -``` - -## formatReadableSize(x) {#formatreadablesizex} - -Accepts the size (number of bytes). Returns a rounded size with a suffix (KiB, MiB, etc.) as a string. - -Example: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - -``` text -┌─filesize_bytes─┬─filesize───┐ -│ 1 │ 1.00 B │ -│ 1024 │ 1.00 KiB │ -│ 1048576 │ 1.00 MiB │ -│ 192851925 │ 183.92 MiB │ -└────────────────┴────────────┘ -``` - -## least(a, b) {#leasta-b} - -Returns the smallest value from a and b. - -## greatest(a, b) {#greatesta-b} - -Returns the largest value of a and b. - -## uptime() {#uptime} - -Returns the server’s uptime in seconds. - -## version() {#version} - -Returns the version of the server as a string. - -## timezone() {#timezone} - -Returns the timezone of the server. - -## blockNumber {#blocknumber} - -Returns the sequence number of the data block where the row is located. - -## rowNumberInBlock {#function-rownumberinblock} - -Returns the ordinal number of the row in the data block. Different data blocks are always recalculated. - -## rowNumberInAllBlocks() {#rownumberinallblocks} - -Returns the ordinal number of the row in the data block. This function only considers the affected data blocks. - -## neighbor {#neighbor} - -The window function that provides access to a row at a specified offset which comes before or after the current row of a given column. - -**Syntax** - -``` sql -neighbor(column, offset[, default_value]) -``` - -The result of the function depends on the affected data blocks and the order of data in the block. -If you make a subquery with ORDER BY and call the function from outside the subquery, you can get the expected result. - -**Parameters** - -- `column` — A column name or scalar expression. -- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql_reference/data_types/int_uint.md). -- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. - -**Returned values** - -- Value for `column` in `offset` distance from current row if `offset` value is not outside block bounds. -- Default value for `column` if `offset` value is outside block bounds. If `default_value` is given, then it will be used. - -Type: type of data blocks affected or default value type. - -**Example** - -Query: - -``` sql -SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; -``` - -Result: - -``` text -┌─number─┬─neighbor(number, 2)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 0 │ -│ 9 │ 0 │ -└────────┴─────────────────────┘ -``` - -Query: - -``` sql -SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; -``` - -Result: - -``` text -┌─number─┬─neighbor(number, 2, 999)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 999 │ -│ 9 │ 999 │ -└────────┴──────────────────────────┘ -``` - -This function can be used to compute year-over-year metric value: - -Query: - -``` sql -WITH toDate('2018-01-01') AS start_date -SELECT - toStartOfMonth(start_date + (number * 32)) AS month, - toInt32(month) % 100 AS money, - neighbor(money, -12) AS prev_year, - round(prev_year / money, 2) AS year_over_year -FROM numbers(16) -``` - -Result: - -``` text -┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ -│ 2018-01-01 │ 32 │ 0 │ 0 │ -│ 2018-02-01 │ 63 │ 0 │ 0 │ -│ 2018-03-01 │ 91 │ 0 │ 0 │ -│ 2018-04-01 │ 22 │ 0 │ 0 │ -│ 2018-05-01 │ 52 │ 0 │ 0 │ -│ 2018-06-01 │ 83 │ 0 │ 0 │ -│ 2018-07-01 │ 13 │ 0 │ 0 │ -│ 2018-08-01 │ 44 │ 0 │ 0 │ -│ 2018-09-01 │ 75 │ 0 │ 0 │ -│ 2018-10-01 │ 5 │ 0 │ 0 │ -│ 2018-11-01 │ 36 │ 0 │ 0 │ -│ 2018-12-01 │ 66 │ 0 │ 0 │ -│ 2019-01-01 │ 97 │ 32 │ 0.33 │ -│ 2019-02-01 │ 28 │ 63 │ 2.25 │ -│ 2019-03-01 │ 56 │ 91 │ 1.62 │ -│ 2019-04-01 │ 87 │ 22 │ 0.25 │ -└────────────┴───────┴───────────┴────────────────┘ -``` - -## runningDifference(x) {#other_functions-runningdifference} - -Calculates the difference between successive row values ​​in the data block. -Returns 0 for the first row and the difference from the previous row for each subsequent row. - -The result of the function depends on the affected data blocks and the order of data in the block. -If you make a subquery with ORDER BY and call the function from outside the subquery, you can get the expected result. - -Example: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - -``` text -┌─EventID─┬───────────EventTime─┬─delta─┐ -│ 1106 │ 2016-11-24 00:00:04 │ 0 │ -│ 1107 │ 2016-11-24 00:00:05 │ 1 │ -│ 1108 │ 2016-11-24 00:00:05 │ 0 │ -│ 1109 │ 2016-11-24 00:00:09 │ 4 │ -│ 1110 │ 2016-11-24 00:00:10 │ 1 │ -└─────────┴─────────────────────┴───────┘ -``` - -Please note - block size affects the result. With each new block, the `runningDifference` state is reset. - -``` sql -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -┌─number─┬─diff─┐ -│ 65536 │ 0 │ -└────────┴──────┘ -``` - -``` sql -set max_block_size=100000 -- default value is 65536! - -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -``` - -## runningDifferenceStartingWithFirstValue {#runningdifferencestartingwithfirstvalue} - -Same as for [runningDifference](./other_functions.md#other_functions-runningdifference), the difference is the value of the first row, returned the value of the first row, and each subsequent row returns the difference from the previous row. - -## MACNumToString(num) {#macnumtostringnum} - -Accepts a UInt64 number. Interprets it as a MAC address in big endian. Returns a string containing the corresponding MAC address in the format AA:BB:CC:DD:EE:FF (colon-separated numbers in hexadecimal form). - -## MACStringToNum(s) {#macstringtonums} - -The inverse function of MACNumToString. If the MAC address has an invalid format, it returns 0. - -## MACStringToOUI(s) {#macstringtoouis} - -Accepts a MAC address in the 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. - -## getSizeOfEnumType {#getsizeofenumtype} - -Returns the number of fields in [Enum](../../sql_reference/data_types/enum.md). - -``` sql -getSizeOfEnumType(value) -``` - -**Parameters:** - -- `value` — Value of type `Enum`. - -**Returned values** - -- The number of fields with `Enum` input values. -- An exception is thrown if the type is not `Enum`. - -**Example** - -``` sql -SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## blockSerializedSize {#blockserializedsize} - -Returns size on disk (without taking into account compression). - -``` sql -blockSerializedSize(value[, value[, ...]]) -``` - -**Parameters:** - -- `value` — Any value. - -**Returned values** - -- The number of bytes that will be written to disk for block of values (without compression). - -**Example** - -``` sql -SELECT blockSerializedSize(maxState(1)) as x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## toColumnTypeName {#tocolumntypename} - -Returns the name of the class that represents the data type of the column in RAM. - -``` sql -toColumnTypeName(value) -``` - -**Parameters:** - -- `value` — Any type of value. - -**Returned values** - -- A string with the name of the class that is used for representing the `value` data type in RAM. - -**Example of the difference between`toTypeName ' and ' toColumnTypeName`** - -``` sql -SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime │ -└─────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ Const(UInt32) │ -└───────────────────────────────────────────────────────────┘ -``` - -The example shows that the `DateTime` data type is stored in memory as `Const(UInt32)`. - -## dumpColumnStructure {#dumpcolumnstructure} - -Outputs a detailed description of data structures in RAM - -``` sql -dumpColumnStructure(value) -``` - -**Parameters:** - -- `value` — Any type of value. - -**Returned values** - -- A string describing the structure that is used for representing the `value` data type in RAM. - -**Example** - -``` sql -SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) -``` - -``` text -┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime, Const(size = 1, UInt32(size = 1)) │ -└──────────────────────────────────────────────────────────────┘ -``` - -## defaultValueOfArgumentType {#defaultvalueofargumenttype} - -Outputs the default value for the data type. - -Does not include default values for custom columns set by the user. - -``` sql -defaultValueOfArgumentType(expression) -``` - -**Parameters:** - -- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. - -**Returned values** - -- `0` for numbers. -- Empty string for strings. -- `ᴺᵁᴸᴸ` for [Nullable](../../sql_reference/data_types/nullable.md). - -**Example** - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ -│ 0 │ -└─────────────────────────────────────────────┘ -``` - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ -│ ᴺᵁᴸᴸ │ -└───────────────────────────────────────────────────────┘ -``` - -## replicate {#other-functions-replicate} - -Creates an array with a single value. - -Used for internal implementation of [arrayJoin](array_join.md#functions_arrayjoin). - -``` sql -SELECT replicate(x, arr); -``` - -**Parameters:** - -- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. -- `x` — The value that the resulting array will be filled with. - -**Returned value** - -An array filled with the value `x`. - -Type: `Array`. - -**Example** - -Query: - -``` sql -SELECT replicate(1, ['a', 'b', 'c']) -``` - -Result: - -``` text -┌─replicate(1, ['a', 'b', 'c'])─┐ -│ [1,1,1] │ -└───────────────────────────────┘ -``` - -## filesystemAvailable {#filesystemavailable} - -Returns amount of remaining space on the filesystem where the files of the databases located. It is always smaller than total free space ([filesystemFree](#filesystemfree)) because some space is reserved for OS. - -**Syntax** - -``` sql -filesystemAvailable() -``` - -**Returned value** - -- The amount of remaining space available in bytes. - -Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; -``` - -Result: - -``` text -┌─Available space─┬─Type───┐ -│ 30.75 GiB │ UInt64 │ -└─────────────────┴────────┘ -``` - -## filesystemFree {#filesystemfree} - -Returns total amount of the free space on the filesystem where the files of the databases located. See also `filesystemAvailable` - -**Syntax** - -``` sql -filesystemFree() -``` - -**Returned value** - -- Amount of free space in bytes. - -Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; -``` - -Result: - -``` text -┌─Free space─┬─Type───┐ -│ 32.39 GiB │ UInt64 │ -└────────────┴────────┘ -``` - -## filesystemCapacity {#filesystemcapacity} - -Returns the capacity of the filesystem in bytes. For evaluation, the [path](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) to the data directory must be configured. - -**Syntax** - -``` sql -filesystemCapacity() -``` - -**Returned value** - -- Capacity information of the filesystem in bytes. - -Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Example** - -Query: - -``` sql -SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" -``` - -Result: - -``` text -┌─Capacity──┬─Type───┐ -│ 39.32 GiB │ UInt64 │ -└───────────┴────────┘ -``` - -## finalizeAggregation {#function-finalizeaggregation} - -Takes state of aggregate function. Returns result of aggregation (finalized state). - -## runningAccumulate {#function-runningaccumulate} - -Takes the states of the aggregate function and returns a column with values, are the result of the accumulation of these states for a set of block lines, from the first to the current line. -For example, takes state of aggregate function (example runningAccumulate(uniqState(UserID))), and for each row of block, return result of aggregate function on merge of states of all previous rows and current row. -So, result of function depends on partition of data to blocks and on order of data in block. - -## joinGet {#joinget} - -The function lets you extract data from the table the same way as from a [dictionary](../../sql_reference/dictionaries/index.md). - -Gets data from [Join](../../engines/table_engines/special/join.md#creating-a-table) tables using the specified join key. - -Only supports tables created with the `ENGINE = Join(ANY, LEFT, )` statement. - -**Syntax** - -``` sql -joinGet(join_storage_table_name, `value_column`, join_keys) -``` - -**Parameters** - -- `join_storage_table_name` — an [identifier](../syntax.md#syntax-identifiers) indicates where search is performed. The identifier is searched in the default database (see parameter `default_database` in the config file). To override the default database, use the `USE db_name` or specify the database and the table through the separator `db_name.db_table`, see the example. -- `value_column` — name of the column of the table that contains required data. -- `join_keys` — list of keys. - -**Returned value** - -Returns list of values corresponded to list of keys. - -If certain doesn’t exist in source table then `0` or `null` will be returned based on [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) setting. - -More info about `join_use_nulls` in [Join operation](../../engines/table_engines/special/join.md). - -**Example** - -Input table: - -``` sql -CREATE DATABASE db_test -CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 -INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) -``` - -``` text -┌─id─┬─val─┐ -│ 4 │ 13 │ -│ 2 │ 12 │ -│ 1 │ 11 │ -└────┴─────┘ -``` - -Query: - -``` sql -SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 -``` - -Result: - -``` text -┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ -│ 0 │ -│ 11 │ -│ 12 │ -│ 0 │ -└──────────────────────────────────────────────────┘ -``` - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -Evaluate external model. -Accepts a model name and model arguments. Returns Float64. - -## throwIf(x\[, custom\_message\]) {#throwifx-custom-message} - -Throw an exception if the argument is non zero. -custom\_message - is an optional parameter: a constant string, provides an error message - -``` sql -SELECT throwIf(number = 3, 'Too many') FROM numbers(10); -``` - -``` text -↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): -Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. -``` - -## identity {#identity} - -Returns the same value that was used as its argument. Used for debugging and testing, allows to cancel using index, and get the query performance of a full scan. When query is analyzed for possible use of index, the analyzer doesn’t look inside `identity` functions. - -**Syntax** - -``` sql -identity(x) -``` - -**Example** - -Query: - -``` sql -SELECT identity(42) -``` - -Result: - -``` text -┌─identity(42)─┐ -│ 42 │ -└──────────────┘ -``` - -## randomPrintableASCII {#randomascii} - -Generates a string with a random set of [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) printable characters. - -**Syntax** - -``` sql -randomPrintableASCII(length) -``` - -**Parameters** - -- `length` — Resulting string length. Positive integer. - - If you pass `length < 0`, behavior of the function is undefined. - -**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) - -**Example** - -``` sql -SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 -``` - -``` text -┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ -│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ -│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ -│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ -└────────┴────────────────────────────────┴──────────────────────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/en/sql_reference/functions/random_functions.md b/docs/en/sql_reference/functions/random_functions.md deleted file mode 100644 index 7990d3b6cc7..00000000000 --- a/docs/en/sql_reference/functions/random_functions.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -toc_priority: 51 -toc_title: Generating Pseudo-Random Numbers ---- - -# Functions for generating pseudo-random numbers {#functions-for-generating-pseudo-random-numbers} - -Non-cryptographic generators of pseudo-random numbers are used. - -All the functions accept zero arguments or one argument. -If an argument is passed, it can be any type, and its value is not used for anything. -The only purpose of this argument is to prevent common subexpression elimination, so that two different instances of the same function return different columns with different random numbers. - -## rand {#rand} - -Returns a pseudo-random UInt32 number, evenly distributed among all UInt32-type numbers. -Uses a linear congruential generator. - -## rand64 {#rand64} - -Returns a pseudo-random UInt64 number, evenly distributed among all UInt64-type numbers. -Uses a linear congruential generator. - -## randConstant {#randconstant} - -Returns a pseudo-random UInt32 number, The value is one for different blocks. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/en/sql_reference/functions/rounding_functions.md b/docs/en/sql_reference/functions/rounding_functions.md deleted file mode 100644 index ce3c592acc6..00000000000 --- a/docs/en/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -toc_priority: 45 -toc_title: Rounding ---- - -# Rounding functions {#rounding-functions} - -## floor(x\[, N\]) {#floorx-n} - -Returns the largest round number that is less than or equal to `x`. A round number is a multiple of 1/10N, or the nearest number of the appropriate data type if 1 / 10N isn’t exact. -‘N’ is an integer constant, optional parameter. By default it is zero, which means to round to an integer. -‘N’ may be negative. - -Examples: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x` is any numeric type. The result is a number of the same type. -For integer arguments, it makes sense to round with a negative `N` value (for non-negative `N`, the function doesn’t do anything). -If rounding causes overflow (for example, floor(-128, -1)), an implementation-specific result is returned. - -## ceil(x\[, N\]), ceiling(x\[, N\]) {#ceilx-n-ceilingx-n} - -Returns the smallest round number that is greater than or equal to `x`. In every other way, it is the same as the `floor` function (see above). - -## trunc(x\[, N\]), truncate(x\[, N\]) {#truncx-n-truncatex-n} - -Returns the round number with largest absolute value that has an absolute value less than or equal to `x`‘s. In every other way, it is the same as the ’floor’ function (see above). - -## round(x\[, N\]) {#rounding_functions-round} - -Rounds a value to a specified number of decimal places. - -The function returns the nearest number of the specified order. In case when given number has equal distance to surrounding numbers, the function uses banker’s rounding for float number types and rounds away from zero for the other number types. - -``` sql -round(expression [, decimal_places]) -``` - -**Parameters:** - -- `expression` — A number to be rounded. Can be any [expression](../syntax.md#syntax-expressions) returning the numeric [data type](../../sql_reference/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. - - If `decimal-places = 0` then the function rounds the value to integer. In this case the argument can be omitted. - -**Returned value:** - -The rounded number of the same type as the input number. - -### Examples {#examples} - -**Example of use** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - -``` text -┌───x─┬─round(divide(number, 2))─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -└─────┴──────────────────────────┘ -``` - -**Examples of rounding** - -Rounding to the nearest number. - -``` text -round(3.2, 0) = 3 -round(4.1267, 2) = 4.13 -round(22,-1) = 20 -round(467,-2) = 500 -round(-467,-2) = -500 -``` - -Banker’s rounding. - -``` text -round(3.5) = 4 -round(4.5) = 4 -round(3.55, 1) = 3.6 -round(3.65, 1) = 3.6 -``` - -**See Also** - -- [roundBankers](#roundbankers) - -## roundBankers {#roundbankers} - -Rounds a number to a specified decimal position. - -- If the rounding number is halfway between two numbers, the function uses banker’s rounding. - - Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. - - It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. - -- In other cases, the function rounds numbers to the nearest integer. - -Using banker’s rounding, you can reduce the effect that rounding numbers has on the results of summing or subtracting these numbers. - -For example, sum numbers 1.5, 2.5, 3.5, 4.5 with different rounding: - -- No rounding: 1.5 + 2.5 + 3.5 + 4.5 = 12. -- Banker’s rounding: 2 + 2 + 4 + 4 = 12. -- Rounding to the nearest integer: 2 + 3 + 4 + 5 = 14. - -**Syntax** - -``` sql -roundBankers(expression [, decimal_places]) -``` - -**Parameters** - -- `expression` — A number to be rounded. Can be any [expression](../syntax.md#syntax-expressions) returning the numeric [data type](../../sql_reference/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`. - - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. - -**Returned value** - -A value rounded by the banker’s rounding method. - -### Examples {#examples-1} - -**Example of use** - -Query: - -``` sql - SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 -``` - -Result: - -``` text -┌───x─┬─b─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -│ 1.5 │ 2 │ -│ 2 │ 2 │ -│ 2.5 │ 2 │ -│ 3 │ 3 │ -│ 3.5 │ 4 │ -│ 4 │ 4 │ -│ 4.5 │ 4 │ -└─────┴───┘ -``` - -**Examples of Banker’s rounding** - -``` text -roundBankers(0.4) = 0 -roundBankers(-3.5) = -4 -roundBankers(4.5) = 4 -roundBankers(3.55, 1) = 3.6 -roundBankers(3.65, 1) = 3.6 -roundBankers(10.35, 1) = 10.4 -roundBankers(10.755, 2) = 11,76 -``` - -**See Also** - -- [round](#rounding_functions-round) - -## roundToExp2(num) {#roundtoexp2num} - -Accepts a number. If the number is less than one, it returns 0. Otherwise, it rounds the number down to the nearest (whole non-negative) degree of two. - -## roundDuration(num) {#rounddurationnum} - -Accepts a number. If the number is less than one, it returns 0. Otherwise, it rounds the number down to numbers from the set: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. This function is specific to Yandex.Metrica and used for implementing the report on session length. - -## roundAge(num) {#roundagenum} - -Accepts a number. If the number is less than 18, it returns 0. Otherwise, it rounds the number down to a number from the set: 18, 25, 35, 45, 55. This function is specific to Yandex.Metrica and used for implementing the report on user age. - -## roundDown(num, arr) {#rounddownnum-arr} - -Accepts a number and rounds it down to an element in the specified array. If the value is less than the lowest bound, the lowest bound is returned. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/en/sql_reference/functions/splitting_merging_functions.md b/docs/en/sql_reference/functions/splitting_merging_functions.md deleted file mode 100644 index 9e455440293..00000000000 --- a/docs/en/sql_reference/functions/splitting_merging_functions.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -toc_priority: 47 -toc_title: Splitting and Merging Strings and Arrays ---- - -# Functions for splitting and merging strings and arrays {#functions-for-splitting-and-merging-strings-and-arrays} - -## splitByChar(separator, s) {#splitbycharseparator-s} - -Splits a string into substrings separated by a specified character. It uses a constant string `separator` which consisting of exactly one character. -Returns an array of selected substrings. Empty substrings may be selected if the separator occurs at the beginning or end of the string, or if there are multiple consecutive separators. - -**Syntax** - -```sql -splitByChar(, ) -``` - -**Parameters** - -- `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). - -**Returned value(s)** - -Returns an array of selected substrings. 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) of [String](../../sql_reference/data_types/string.md). - -**Example** - -``` sql -SELECT splitByChar(',', '1,2,3,abcde') -``` - -``` text -┌─splitByChar(',', '1,2,3,abcde')─┐ -│ ['1','2','3','abcde'] │ -└─────────────────────────────────┘ -``` - -## splitByString(separator, s) {#splitbystringseparator-s} - -Splits a string into substrings separated by a string. It uses a constant string `separator` of multiple characters as the separator. If the string `separator` is empty, it will split the string `s` into an array of single characters. - -**Syntax** - -```sql -splitByString(, ) -``` - -**Parameters** - -- `separator` — The separator. [String](../../sql_reference/data_types/string.md). -- `s` — The string to split. [String](../../sql_reference/data_types/string.md). - -**Returned value(s)** - -Returns an array of selected substrings. Empty substrings may be selected when: - -Type: [Array](../../sql_reference/data_types/array.md) of [String](../../sql_reference/data_types/string.md). - -* 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. - -**Example** - -``` sql -SELECT splitByString(', ', '1, 2 3, 4,5, abcde') -``` - -``` text -┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ -│ ['1','2 3','4,5','abcde'] │ -└───────────────────────────────────────────┘ -``` - -``` sql -SELECT splitByString('', 'abcde') -``` - -``` text -┌─splitByString('', 'abcde')─┐ -│ ['a','b','c','d','e'] │ -└────────────────────────────┘ -``` - -## arrayStringConcat(arr\[, separator\]) {#arraystringconcatarr-separator} - -Concatenates the strings listed in the array with the separator.’separator’ is an optional parameter: a constant string, set to an empty string by default. -Returns the string. - -## alphaTokens(s) {#alphatokenss} - -Selects substrings of consecutive bytes from the ranges a-z and A-Z.Returns an array of substrings. - -**Example** - -``` sql -SELECT alphaTokens('abca1abc') -``` - -``` text -┌─alphaTokens('abca1abc')─┐ -│ ['abca','abc'] │ -└─────────────────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/en/sql_reference/functions/string_functions.md b/docs/en/sql_reference/functions/string_functions.md deleted file mode 100644 index 5619f036d52..00000000000 --- a/docs/en/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,487 +0,0 @@ ---- -toc_priority: 40 -toc_title: Working with strings ---- - -# Functions for working with strings {#functions-for-working-with-strings} - -## empty {#empty} - -Returns 1 for an empty string or 0 for a non-empty string. -The result type is UInt8. -A string is considered non-empty if it contains at least one byte, even if this is a space or a null byte. -The function also works for arrays. - -## notEmpty {#notempty} - -Returns 0 for an empty string or 1 for a non-empty string. -The result type is UInt8. -The function also works for arrays. - -## length {#length} - -Returns the length of a string in bytes (not in characters, and not in code points). -The result type is UInt64. -The function also works for arrays. - -## lengthUTF8 {#lengthutf8} - -Returns the length of a string in Unicode code points (not in characters), assuming that the string contains a set of bytes that make up UTF-8 encoded text. If this assumption is not met, it returns some result (it doesn’t throw an exception). -The result type is UInt64. - -## char\_length, CHAR\_LENGTH {#char-length} - -Returns the length of a string in Unicode code points (not in characters), assuming that the string contains a set of bytes that make up UTF-8 encoded text. If this assumption is not met, it returns some result (it doesn’t throw an exception). -The result type is UInt64. - -## character\_length, CHARACTER\_LENGTH {#character-length} - -Returns the length of a string in Unicode code points (not in characters), assuming that the string contains a set of bytes that make up UTF-8 encoded text. If this assumption is not met, it returns some result (it doesn’t throw an exception). -The result type is UInt64. - -## lower, lcase {#lower} - -Converts ASCII Latin symbols in a string to lowercase. - -## upper, ucase {#upper} - -Converts ASCII Latin symbols in a string to uppercase. - -## lowerUTF8 {#lowerutf8} - -Converts a string to lowercase, assuming the string contains a set of bytes that make up a UTF-8 encoded text. -It doesn’t detect the language. So for Turkish the result might not be exactly correct. -If the length of the UTF-8 byte sequence is different for upper and lower case of a code point, the result may be incorrect for this code point. -If the string contains a set of bytes that is not UTF-8, then the behavior is undefined. - -## upperUTF8 {#upperutf8} - -Converts a string to uppercase, assuming the string contains a set of bytes that make up a UTF-8 encoded text. -It doesn’t detect the language. So for Turkish the result might not be exactly correct. -If the length of the UTF-8 byte sequence is different for upper and lower case of a code point, the result may be incorrect for this code point. -If the string contains a set of bytes that is not UTF-8, then the behavior is undefined. - -## isValidUTF8 {#isvalidutf8} - -Returns 1, if the set of bytes is valid UTF-8 encoded, otherwise 0. - -## toValidUTF8 {#tovalidutf8} - -Replaces invalid UTF-8 characters by the `�` (U+FFFD) character. All running in a row invalid characters are collapsed into the one replacement character. - -``` sql -toValidUTF8( input_string ) -``` - -Parameters: - -- input\_string — Any set of bytes represented as the [String](../../sql_reference/data_types/string.md) data type object. - -Returned value: Valid UTF-8 string. - -**Example** - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## repeat {#repeat} - -Repeats a string as many times as specified and concatenates the replicated values as a single string. - -**Syntax** - -``` sql -repeat(s, n) -``` - -**Parameters** - -- `s` — The string to repeat. [String](../../sql_reference/data_types/string.md). -- `n` — The number of times to repeat the string. [UInt](../../sql_reference/data_types/int_uint.md). - -**Returned value** - -The single string, which contains the string `s` repeated `n` times. If `n` \< 1, the function returns empty string. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT repeat('abc', 10) -``` - -Result: - -``` text -┌─repeat('abc', 10)──────────────┐ -│ abcabcabcabcabcabcabcabcabcabc │ -└────────────────────────────────┘ -``` - -## reverse {#reverse} - -Reverses the string (as a sequence of bytes). - -## reverseUTF8 {#reverseutf8} - -Reverses a sequence of Unicode code points, assuming that the string contains a set of bytes representing a UTF-8 text. Otherwise, it does something else (it doesn’t throw an exception). - -## format(pattern, s0, s1, …) {#format} - -Formatting constant pattern with the string listed in the arguments. `pattern` is a simplified Python format pattern. Format string contains “replacement fields” surrounded by curly braces `{}`. Anything that is not contained in braces is considered literal text, which is copied unchanged to the output. If you need to include a brace character in the literal text, it can be escaped by doubling: `{{ '{{' }}` and `{{ '}}' }}`. Field names can be numbers (starting from zero) or empty (then they are treated as consequence numbers). - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') -``` - -``` text -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ -``` - -``` sql -SELECT format('{} {}', 'Hello', 'World') -``` - -``` text -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## concat {#concat} - -Concatenates the strings listed in the arguments, without a separator. - -**Syntax** - -``` sql -concat(s1, s2, ...) -``` - -**Parameters** - -Values of type String or FixedString. - -**Returned values** - -Returns the String that results from concatenating the arguments. - -If any of argument values is `NULL`, `concat` returns `NULL`. - -**Example** - -Query: - -``` sql -SELECT concat('Hello, ', 'World!') -``` - -Result: - -``` text -┌─concat('Hello, ', 'World!')─┐ -│ Hello, World! │ -└─────────────────────────────┘ -``` - -## concatAssumeInjective {#concatassumeinjective} - -Same as [concat](#concat), the difference is that you need to ensure that `concat(s1, s2, ...) → sn` is injective, it will be used for optimization of GROUP BY. - -The function is named “injective” if it always returns different result for different values of arguments. In other words: different arguments never yield identical result. - -**Syntax** - -``` sql -concatAssumeInjective(s1, s2, ...) -``` - -**Parameters** - -Values of type String or FixedString. - -**Returned values** - -Returns the String that results from concatenating the arguments. - -If any of argument values is `NULL`, `concatAssumeInjective` returns `NULL`. - -**Example** - -Input table: - -``` sql -CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; -INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); -SELECT * from key_val; -``` - -``` text -┌─key1────┬─key2─────┬─value─┐ -│ Hello, │ World │ 1 │ -│ Hello, │ World │ 2 │ -│ Hello, │ World! │ 3 │ -│ Hello │ , World! │ 2 │ -└─────────┴──────────┴───────┘ -``` - -Query: - -``` sql -SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) -``` - -Result: - -``` text -┌─concat(key1, key2)─┬─sum(value)─┐ -│ Hello, World! │ 3 │ -│ Hello, World! │ 2 │ -│ Hello, World │ 3 │ -└────────────────────┴────────────┘ -``` - -## substring(s, offset, length), mid(s, offset, length), substr(s, offset, length) {#substring} - -Returns a substring starting with the byte from the ‘offset’ index that is ‘length’ bytes long. Character indexing starts from one (as in standard SQL). The ‘offset’ and ‘length’ arguments must be constants. - -## substringUTF8(s, offset, length) {#substringutf8} - -The same as ‘substring’, but for Unicode code points. Works under the assumption that the string contains a set of bytes representing a UTF-8 encoded text. If this assumption is not met, it returns some result (it doesn’t throw an exception). - -## appendTrailingCharIfAbsent(s, c) {#appendtrailingcharifabsent} - -If the ‘s’ string is non-empty and does not contain the ‘c’ character at the end, it appends the ‘c’ character to the end. - -## convertCharset(s, from, to) {#convertcharset} - -Returns the string ‘s’ that was converted from the encoding in ‘from’ to the encoding in ‘to’. - -## base64Encode(s) {#base64encode} - -Encodes ‘s’ string into base64 - -## base64Decode(s) {#base64decode} - -Decode base64-encoded string ‘s’ into original string. In case of failure raises an exception. - -## tryBase64Decode(s) {#trybase64decode} - -Similar to base64Decode, but in case of error an empty string would be returned. - -## endsWith(s, suffix) {#endswith} - -Returns whether to end with the specified suffix. Returns 1 if the string ends with the specified suffix, otherwise it returns 0. - -## startsWith(str, prefix) {#startswith} - -Returns 1 whether string starts with the specified prefix, otherwise it returns 0. - -``` sql -SELECT startsWith('Spider-Man', 'Spi'); -``` - -**Returned values** - -- 1, if the string starts with the specified prefix. -- 0, if the string doesn’t start with the specified prefix. - -**Example** - -Query: - -``` sql -SELECT startsWith('Hello, world!', 'He'); -``` - -Result: - -``` text -┌─startsWith('Hello, world!', 'He')─┐ -│ 1 │ -└───────────────────────────────────┘ -``` - -## trim {#trim} - -Removes all specified characters from the start or end of a string. -By default removes all consecutive occurrences of common whitespace (ASCII character 32) from both ends of a string. - -**Syntax** - -``` sql -trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) -``` - -**Parameters** - -- `trim_character` — specified characters for trim. [String](../../sql_reference/data_types/string.md). -- `input_string` — string for trim. [String](../../sql_reference/data_types/string.md). - -**Returned value** - -A string without leading and (or) trailing specified characters. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT trim(BOTH ' ()' FROM '( Hello, world! )') -``` - -Result: - -``` text -┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ -│ Hello, world! │ -└───────────────────────────────────────────────┘ -``` - -## trimLeft {#trimleft} - -Removes all consecutive occurrences of common whitespace (ASCII character 32) from the beginning of a string. It doesn’t remove other kinds of whitespace characters (tab, no-break space, etc.). - -**Syntax** - -``` sql -trimLeft(input_string) -``` - -Alias: `ltrim(input_string)`. - -**Parameters** - -- `input_string` — string to trim. [String](../../sql_reference/data_types/string.md). - -**Returned value** - -A string without leading common whitespaces. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT trimLeft(' Hello, world! ') -``` - -Result: - -``` text -┌─trimLeft(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## trimRight {#trimright} - -Removes all consecutive occurrences of common whitespace (ASCII character 32) from the end of a string. It doesn’t remove other kinds of whitespace characters (tab, no-break space, etc.). - -**Syntax** - -``` sql -trimRight(input_string) -``` - -Alias: `rtrim(input_string)`. - -**Parameters** - -- `input_string` — string to trim. [String](../../sql_reference/data_types/string.md). - -**Returned value** - -A string without trailing common whitespaces. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT trimRight(' Hello, world! ') -``` - -Result: - -``` text -┌─trimRight(' Hello, world! ')─┐ -│ Hello, world! │ -└──────────────────────────────────────┘ -``` - -## trimBoth {#trimboth} - -Removes all consecutive occurrences of common whitespace (ASCII character 32) from both ends of a string. It doesn’t remove other kinds of whitespace characters (tab, no-break space, etc.). - -**Syntax** - -``` sql -trimBoth(input_string) -``` - -Alias: `trim(input_string)`. - -**Parameters** - -- `input_string` — string to trim. [String](../../sql_reference/data_types/string.md). - -**Returned value** - -A string without leading and trailing common whitespaces. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT trimBoth(' Hello, world! ') -``` - -Result: - -``` text -┌─trimBoth(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## CRC32(s) {#crc32} - -Returns the CRC32 checksum of a string, using CRC-32-IEEE 802.3 polynomial and initial value `0xffffffff` (zlib implementation). - -The result type is UInt32. - -## CRC32IEEE(s) {#crc32ieee} - -Returns the CRC32 checksum of a string, using CRC-32-IEEE 802.3 polynomial. - -The result type is UInt32. - -## CRC64(s) {#crc64} - -Returns the CRC64 checksum of a string, using CRC-64-ECMA polynomial. - -The result type is UInt64. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/en/sql_reference/functions/string_replace_functions.md b/docs/en/sql_reference/functions/string_replace_functions.md deleted file mode 100644 index 1238937d7c0..00000000000 --- a/docs/en/sql_reference/functions/string_replace_functions.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -toc_priority: 42 -toc_title: For Replacing in Strings ---- - -# Functions for searching and replacing in strings {#functions-for-searching-and-replacing-in-strings} - -## replaceOne(haystack, pattern, replacement) {#replaceonehaystack-pattern-replacement} - -Replaces the first occurrence, if it exists, of the ‘pattern’ substring in ‘haystack’ with the ‘replacement’ substring. -Hereafter, ‘pattern’ and ‘replacement’ must be constants. - -## replaceAll(haystack, pattern, replacement), replace(haystack, pattern, replacement) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} - -Replaces all occurrences of the ‘pattern’ substring in ‘haystack’ with the ‘replacement’ substring. - -## replaceRegexpOne(haystack, pattern, replacement) {#replaceregexponehaystack-pattern-replacement} - -Replacement using the ‘pattern’ regular expression. A re2 regular expression. -Replaces only the first occurrence, if it exists. -A pattern can be specified as ‘replacement’. This pattern can include substitutions `\0-\9`. -The substitution `\0` includes the entire regular expression. Substitutions `\1-\9` correspond to the subpattern numbers.To use the `\` character in a template, escape it using `\`. -Also keep in mind that a string literal requires an extra escape. - -Example 1. Converting the date to American format: - -``` sql -SELECT DISTINCT - EventDate, - replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res -FROM test.hits -LIMIT 7 -FORMAT TabSeparated -``` - -``` text -2014-03-17 03/17/2014 -2014-03-18 03/18/2014 -2014-03-19 03/19/2014 -2014-03-20 03/20/2014 -2014-03-21 03/21/2014 -2014-03-22 03/22/2014 -2014-03-23 03/23/2014 -``` - -Example 2. Copying a string ten times: - -``` sql -SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res -``` - -``` text -┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## replaceRegexpAll(haystack, pattern, replacement) {#replaceregexpallhaystack-pattern-replacement} - -This does the same thing, but replaces all the occurrences. Example: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res -``` - -``` text -┌─res────────────────────────┐ -│ HHeelllloo,, WWoorrlldd!! │ -└────────────────────────────┘ -``` - -As an exception, if a regular expression worked on an empty substring, the replacement is not made more than once. -Example: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res -``` - -``` text -┌─res─────────────────┐ -│ here: Hello, World! │ -└─────────────────────┘ -``` - -## regexpQuoteMeta(s) {#regexpquotemetas} - -The function adds a backslash before some predefined characters in the string. -Predefined characters: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, ’\]’, ‘?’, ’\*‘,’+‘,’{‘,’:‘,’-’. -This implementation slightly differs from re2::RE2::QuoteMeta. It escapes zero byte as \\0 instead of 00 and it escapes only required characters. -For more information, see the link: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/en/sql_reference/functions/string_search_functions.md b/docs/en/sql_reference/functions/string_search_functions.md deleted file mode 100644 index 180830c0842..00000000000 --- a/docs/en/sql_reference/functions/string_search_functions.md +++ /dev/null @@ -1,377 +0,0 @@ ---- -toc_priority: 41 -toc_title: For Searching Strings ---- - -# Functions for Searching Strings {#functions-for-searching-strings} - -The search is case-sensitive by default in all these functions. There are separate variants for case insensitive search. - -## position(haystack, needle), locate(haystack, needle) {#position} - -Returns the position (in bytes) of the found substring in the string, starting from 1. - -Works under the assumption that the string contains a set of bytes representing a single-byte encoded text. If this assumption is not met and a character can’t be represented using a single byte, the function doesn’t throw an exception and returns some unexpected result. If character can be represented using two bytes, it will use two bytes and so on. - -For a case-insensitive search, use the function [positionCaseInsensitive](#positioncaseinsensitive). - -**Syntax** - -``` sql -position(haystack, needle) -``` - -Alias: `locate(haystack, needle)`. - -**Parameters** - -- `haystack` — string, in which substring will to be searched. [String](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [String](../syntax.md#syntax-string-literal). - -**Returned values** - -- Starting position in bytes (counting from 1), if substring was found. -- 0, if the substring was not found. - -Type: `Integer`. - -**Examples** - -The phrase “Hello, world!” contains a set of bytes representing a single-byte encoded text. The function returns some expected result: - -Query: - -``` sql -SELECT position('Hello, world!', '!') -``` - -Result: - -``` text -┌─position('Hello, world!', '!')─┐ -│ 13 │ -└────────────────────────────────┘ -``` - -The same phrase in Russian contains characters which can’t be represented using a single byte. The function returns some unexpected result (use [positionUTF8](#positionutf8) function for multi-byte encoded text): - -Query: - -``` sql -SELECT position('Привет, мир!', '!') -``` - -Result: - -``` text -┌─position('Привет, мир!', '!')─┐ -│ 21 │ -└───────────────────────────────┘ -``` - -## positionCaseInsensitive {#positioncaseinsensitive} - -The same as [position](#position) returns the position (in bytes) of the found substring in the string, starting from 1. Use the function for a case-insensitive search. - -Works under the assumption that the string contains a set of bytes representing a single-byte encoded text. If this assumption is not met and a character can’t be represented using a single byte, the function doesn’t throw an exception and returns some unexpected result. If character can be represented using two bytes, it will use two bytes and so on. - -**Syntax** - -``` sql -positionCaseInsensitive(haystack, needle) -``` - -**Parameters** - -- `haystack` — string, in which substring will to be searched. [String](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [String](../syntax.md#syntax-string-literal). - -**Returned values** - -- Starting position in bytes (counting from 1), if substring was found. -- 0, if the substring was not found. - -Type: `Integer`. - -**Example** - -Query: - -``` sql -SELECT positionCaseInsensitive('Hello, world!', 'hello') -``` - -Result: - -``` text -┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ -│ 1 │ -└───────────────────────────────────────────────────┘ -``` - -## positionUTF8 {#positionutf8} - -Returns the position (in Unicode points) of the found substring in the string, starting from 1. - -Works under the assumption that the string contains a set of bytes representing a UTF-8 encoded text. If this assumption is not met, the function doesn’t throw an exception and returns some unexpected result. If character can be represented using two Unicode points, it will use two and so on. - -For a case-insensitive search, use the function [positionCaseInsensitiveUTF8](#positioncaseinsensitiveutf8). - -**Syntax** - -``` sql -positionUTF8(haystack, needle) -``` - -**Parameters** - -- `haystack` — string, in which substring will to be searched. [String](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [String](../syntax.md#syntax-string-literal). - -**Returned values** - -- Starting position in Unicode points (counting from 1), if substring was found. -- 0, if the substring was not found. - -Type: `Integer`. - -**Examples** - -The phrase “Hello, world!” in Russian contains a set of Unicode points representing a single-point encoded text. The function returns some expected result: - -Query: - -``` sql -SELECT positionUTF8('Привет, мир!', '!') -``` - -Result: - -``` text -┌─positionUTF8('Привет, мир!', '!')─┐ -│ 12 │ -└───────────────────────────────────┘ -``` - -The phrase “Salut, étudiante!”, where character `é` can be represented using a one point (`U+00E9`) or two points (`U+0065U+0301`) the function can be returned some unexpected result: - -Query for the letter `é`, which is represented one Unicode point `U+00E9`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Result: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 17 │ -└────────────────────────────────────────┘ -``` - -Query for the letter `é`, which is represented two Unicode points `U+0065U+0301`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Result: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 18 │ -└────────────────────────────────────────┘ -``` - -## positionCaseInsensitiveUTF8 {#positioncaseinsensitiveutf8} - -The same as [positionUTF8](#positionutf8), but is case-insensitive. Returns the position (in Unicode points) of the found substring in the string, starting from 1. - -Works under the assumption that the string contains a set of bytes representing a UTF-8 encoded text. If this assumption is not met, the function doesn’t throw an exception and returns some unexpected result. If character can be represented using two Unicode points, it will use two and so on. - -**Syntax** - -``` sql -positionCaseInsensitiveUTF8(haystack, needle) -``` - -**Parameters** - -- `haystack` — string, in which substring will to be searched. [String](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [String](../syntax.md#syntax-string-literal). - -**Returned value** - -- Starting position in Unicode points (counting from 1), if substring was found. -- 0, if the substring was not found. - -Type: `Integer`. - -**Example** - -Query: - -``` sql -SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') -``` - -Result: - -``` text -┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ -│ 9 │ -└────────────────────────────────────────────────────┘ -``` - -## multiSearchAllPositions {#multisearchallpositions} - -The same as [position](string_search_functions.md#position) but returns `Array` of positions (in bytes) of the found corresponding substrings in the string. Positions are indexed starting from 1. - -The search is performed on sequences of bytes without respect to string encoding and collation. - -- For case-insensitive ASCII search, use the function `multiSearchAllPositionsCaseInsensitive`. -- For search in UTF-8, use the function [multiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). -- For case-insensitive UTF-8 search, use the function multiSearchAllPositionsCaseInsensitiveUTF8. - -**Syntax** - -``` sql -multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) -``` - -**Parameters** - -- `haystack` — string, in which substring will to be searched. [String](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [String](../syntax.md#syntax-string-literal). - -**Returned values** - -- Array of starting positions in bytes (counting from 1), if the corresponding substring was found and 0 if not found. - -**Example** - -Query: - -``` sql -SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) -``` - -Result: - -``` text -┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ -│ [0,13,0] │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## multiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} - -See `multiSearchAllPositions`. - -## multiSearchFirstPosition(haystack, \[needle1, needle2, …, needlen\]) {#multisearchfirstposition} - -The same as `position` but returns the leftmost offset of the string `haystack` that is matched to some of the needles. - -For a case-insensitive search or/and in UTF-8 format use functions `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. - -## multiSearchFirstIndex(haystack, \[needle1, needle2, …, needlen\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} - -Returns the index `i` (starting from 1) of the leftmost found needlei in the string `haystack` and 0 otherwise. - -For a case-insensitive search or/and in UTF-8 format use functions `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. - -## multiSearchAny(haystack, \[needle1, needle2, …, needlen\]) {#function-multisearchany} - -Returns 1, if at least one string needlei matches the string `haystack` and 0 otherwise. - -For a case-insensitive search or/and in UTF-8 format use functions `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. - -!!! note "Note" - In all `multiSearch*` functions the number of needles should be less than 28 because of implementation specification. - -## match(haystack, pattern) {#matchhaystack-pattern} - -Checks whether the string matches the `pattern` regular expression. A `re2` regular expression. The [syntax](https://github.com/google/re2/wiki/Syntax) of the `re2` regular expressions is more limited than the syntax of the Perl regular expressions. - -Returns 0 if it doesn’t match, or 1 if it matches. - -Note that the backslash symbol (`\`) is used for escaping in the regular expression. The same symbol is used for escaping in string literals. So in order to escape the symbol in a regular expression, you must write two backslashes (\\) in a string literal. - -The regular expression works with the string as if it is a set of bytes. The regular expression can’t contain null bytes. -For patterns to search for substrings in a string, it is better to use LIKE or ‘position’, since they work much faster. - -## multiMatchAny(haystack, \[pattern1, pattern2, …, patternn\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} - -The same as `match`, but returns 0 if none of the regular expressions are matched and 1 if any of the patterns matches. It uses [hyperscan](https://github.com/intel/hyperscan) library. For patterns to search substrings in a string, it is better to use `multiSearchAny` since it works much faster. - -!!! note "Note" - The length of any of the `haystack` string must be less than 232 bytes otherwise the exception is thrown. This restriction takes place because of hyperscan API. - -## multiMatchAnyIndex(haystack, \[pattern1, pattern2, …, patternn\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} - -The same as `multiMatchAny`, but returns any index that matches the haystack. - -## multiMatchAllIndices(haystack, \[pattern1, pattern2, …, patternn\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} - -The same as `multiMatchAny`, but returns the array of all indicies that match the haystack in any order. - -## multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern2, …, patternn\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} - -The same as `multiMatchAny`, but returns 1 if any pattern matches the haystack within a constant [edit distance](https://en.wikipedia.org/wiki/Edit_distance). This function is also in an experimental mode and can be extremely slow. For more information see [hyperscan documentation](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). - -## multiFuzzyMatchAnyIndex(haystack, distance, \[pattern1, pattern2, …, patternn\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} - -The same as `multiFuzzyMatchAny`, but returns any index that matches the haystack within a constant edit distance. - -## multiFuzzyMatchAllIndices(haystack, distance, \[pattern1, pattern2, …, patternn\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} - -The same as `multiFuzzyMatchAny`, but returns the array of all indices in any order that match the haystack within a constant edit distance. - -!!! note "Note" - `multiFuzzyMatch*` functions do not support UTF-8 regular expressions, and such expressions are treated as bytes because of hyperscan restriction. - -!!! note "Note" - To turn off all functions that use hyperscan, use setting `SET allow_hyperscan = 0;`. - -## extract(haystack, pattern) {#extracthaystack-pattern} - -Extracts a fragment of a string using a regular expression. If ‘haystack’ doesn’t match the ‘pattern’ regex, an empty string is returned. If the regex doesn’t contain subpatterns, it takes the fragment that matches the entire regex. Otherwise, it takes the fragment that matches the first subpattern. - -## extractAll(haystack, pattern) {#extractallhaystack-pattern} - -Extracts all the fragments of a string using a regular expression. If ‘haystack’ doesn’t match the ‘pattern’ regex, an empty string is returned. Returns an array of strings consisting of all matches to the regex. In general, the behavior is the same as the ‘extract’ function (it takes the first subpattern, or the entire expression if there isn’t a subpattern). - -## like(haystack, pattern), haystack LIKE pattern operator {#function-like} - -Checks whether a string matches a simple regular expression. -The regular expression can contain the metasymbols `%` and `_`. - -`%` indicates any quantity of any bytes (including zero characters). - -`_` indicates any one byte. - -Use the backslash (`\`) for escaping metasymbols. See the note on escaping in the description of the ‘match’ function. - -For regular expressions like `%needle%`, the code is more optimal and works as fast as the `position` function. -For other regular expressions, the code is the same as for the ‘match’ function. - -## notLike(haystack, pattern), haystack NOT LIKE pattern operator {#function-notlike} - -The same thing as ‘like’, but negative. - -## ngramDistance(haystack, needle) {#ngramdistancehaystack-needle} - -Calculates the 4-gram distance between `haystack` and `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` or `haystack` is more than 32Kb, throws an exception. If some of the non-constant `haystack` or `needle` strings are more than 32Kb, the distance is always one. - -For case-insensitive search or/and in UTF-8 format use functions `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. - -## ngramSearch(haystack, needle) {#ngramsearchhaystack-needle} - -Same as `ngramDistance` but calculates the non-symmetric difference between `needle` and `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` n-grams. The closer to one, the more likely `needle` is in the `haystack`. Can be useful for fuzzy string search. - -For case-insensitive search or/and in UTF-8 format use functions `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. - -!!! note "Note" - For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/en/sql_reference/functions/type_conversion_functions.md b/docs/en/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index a61e1e692d8..00000000000 --- a/docs/en/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,534 +0,0 @@ ---- -toc_priority: 38 -toc_title: Type Conversion ---- - -# Type Conversion Functions {#type-conversion-functions} - -## Common Issues of Numeric Conversions {#numeric-conversion-issues} - -When you convert a value from one to another data type, you should remember that in common case, it is an unsafe operation that can lead to a data loss. A data loss can occur if you try to fit value from a larger data type to a smaller data type, or if you convert values between different data types. - -ClickHouse has the [same behavior as C++ programs](https://en.cppreference.com/w/cpp/language/implicit_conversion). - -## toInt(8\|16\|32\|64) {#toint8163264} - -Converts an input value to the [Int](../../sql_reference/data_types/int_uint.md) data type. This function family includes: - -- `toInt8(expr)` — Results in the `Int8` data type. -- `toInt16(expr)` — Results in the `Int16` data type. -- `toInt32(expr)` — Results in the `Int32` data type. -- `toInt64(expr)` — Results in the `Int64` data type. - -**Parameters** - -- `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** - -Integer value in the `Int8`, `Int16`, `Int32`, or `Int64` data type. - -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](../../sql_reference/data_types/float.md#data_type-float-nan-inf) arguments is undefined. Remember about [numeric convertions issues](#numeric-conversion-issues), when using the functions. - -**Example** - -``` sql -SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) -``` - -``` text -┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ -│ -9223372036854775808 │ 32 │ 16 │ 8 │ -└──────────────────────┴─────────────┴───────────────┴─────────────┘ -``` - -## toInt(8\|16\|32\|64)OrZero {#toint8163264orzero} - -It takes an argument of type String and tries to parse it into Int (8 \| 16 \| 32 \| 64). If failed, returns 0. - -**Example** - -``` sql -select toInt64OrZero('123123'), toInt8OrZero('123qwe123') -``` - -``` text -┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ -│ 123123 │ 0 │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toInt(8\|16\|32\|64)OrNull {#toint8163264ornull} - -It takes an argument of type String and tries to parse it into Int (8 \| 16 \| 32 \| 64). If failed, returns NULL. - -**Example** - -``` sql -select toInt64OrNull('123123'), toInt8OrNull('123qwe123') -``` - -``` text -┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ -│ 123123 │ ᴺᵁᴸᴸ │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toUInt(8\|16\|32\|64) {#touint8163264} - -Converts an input value to the [UInt](../../sql_reference/data_types/int_uint.md) data type. This function family includes: - -- `toUInt8(expr)` — Results in the `UInt8` data type. -- `toUInt16(expr)` — Results in the `UInt16` data type. -- `toUInt32(expr)` — Results in the `UInt32` data type. -- `toUInt64(expr)` — Results in the `UInt64` data type. - -**Parameters** - -- `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** - -Integer value in the `UInt8`, `UInt16`, `UInt32`, or `UInt64` data type. - -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 agruments and for the [NaN and Inf](../../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 convertions issues](#numeric-conversion-issues), when using the functions. - -**Example** - -``` sql -SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) -``` - -``` text -┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ -│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ -└─────────────────────┴───────────────┴────────────────┴──────────────┘ -``` - -## toUInt(8\|16\|32\|64)OrZero {#touint8163264orzero} - -## toUInt(8\|16\|32\|64)OrNull {#touint8163264ornull} - -## toFloat(32\|64) {#tofloat3264} - -## toFloat(32\|64)OrZero {#tofloat3264orzero} - -## toFloat(32\|64)OrNull {#tofloat3264ornull} - -## toDate {#todate} - -## toDateOrZero {#todateorzero} - -## toDateOrNull {#todateornull} - -## toDateTime {#todatetime} - -## toDateTimeOrZero {#todatetimeorzero} - -## toDateTimeOrNull {#todatetimeornull} - -## toDecimal(32\|64\|128) {#todecimal3264128} - -Converts `value` to the [Decimal](../../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. - -- `toDecimal32(value, S)` -- `toDecimal64(value, S)` -- `toDecimal128(value, S)` - -## toDecimal(32\|64\|128)OrNull {#todecimal3264128ornull} - -Converts an input string to a [Nullable(Decimal(P,S))](../../sql_reference/data_types/decimal.md) data type value. This family of functions include: - -- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` data type. -- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` data type. -- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` data type. - -These functions should be used instead of `toDecimal*()` functions, if you prefer to get a `NULL` value instead of an exception in the event of an input value parsing error. - -**Parameters** - -- `expr` — [Expression](../syntax.md#syntax-expressions), returns a value in the [String](../../sql_reference/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** - -A value in the `Nullable(Decimal(P,S))` data type. The value contains: - -- Number with `S` decimal places, if ClickHouse interprets the input string as a number. -- `NULL`, if ClickHouse can’t interpret the input string as a number or if the input number contains more than `S` decimal places. - -**Examples** - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ -│ -1.11100 │ Nullable(Decimal(9, 5)) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ -│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toDecimal(32\|64\|128)OrZero {#todecimal3264128orzero} - -Converts an input value to the [Decimal(P,S)](../../sql_reference/data_types/decimal.md) data type. This family of functions include: - -- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` data type. -- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` data type. -- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` data type. - -These functions should be used instead of `toDecimal*()` functions, if you prefer to get a `0` value instead of an exception in the event of an input value parsing error. - -**Parameters** - -- `expr` — [Expression](../syntax.md#syntax-expressions), returns a value in the [String](../../sql_reference/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** - -A value in the `Nullable(Decimal(P,S))` data type. The value contains: - -- Number with `S` decimal places, if ClickHouse interprets the input string as a number. -- 0 with `S` decimal places, if ClickHouse can’t interpret the input string as a number or if the input number contains more than `S` decimal places. - -**Example** - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ -│ -1.11100 │ Decimal(9, 5) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ -│ 0.00 │ Decimal(9, 2) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toString {#tostring} - -Functions for converting between numbers, strings (but not fixed strings), dates, and dates with times. -All these functions accept one argument. - -When converting to or from a string, the value is formatted or parsed using the same rules as for the TabSeparated format (and almost all other text formats). If the string can’t be parsed, an exception is thrown and the request is canceled. - -When converting dates to numbers or vice versa, the date corresponds to the number of days since the beginning of the Unix epoch. -When converting dates with times to numbers or vice versa, the date with time corresponds to the number of seconds since the beginning of the Unix epoch. - -The date and date-with-time formats for the toDate/toDateTime functions are defined as follows: - -``` text -YYYY-MM-DD -YYYY-MM-DD hh:mm:ss -``` - -As an exception, if converting from UInt32, Int32, UInt64, or Int64 numeric types to Date, and if the number is greater than or equal to 65536, the number is interpreted as a Unix timestamp (and not as the number of days) and is rounded to the date. This allows support for the common occurrence of writing ‘toDate(unix\_timestamp)’, which otherwise would be an error and would require writing the more cumbersome ‘toDate(toDateTime(unix\_timestamp))’. - -Conversion between a date and date with time is performed the natural way: by adding a null time or dropping the time. - -Conversion between numeric types uses the same rules as assignments between different numeric types in C++. - -Additionally, the toString function of the DateTime argument can take a second String argument containing the name of the time zone. Example: `Asia/Yekaterinburg` In this case, the time is formatted according to the specified time zone. - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - -``` text -┌───────────now_local─┬─now_yekat───────────┐ -│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ -└─────────────────────┴─────────────────────┘ -``` - -Also see the `toUnixTimestamp` function. - -## toFixedString(s, N) {#tofixedstrings-n} - -Converts a String type argument to a FixedString(N) type (a string with fixed length N). N must be a constant. -If the string has fewer bytes than N, it is passed with null bytes to the right. If the string has more bytes than N, an exception is thrown. - -## toStringCutToZero(s) {#tostringcuttozeros} - -Accepts a String or FixedString argument. Returns the String with the content truncated at the first zero byte found. - -Example: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s─────────────┬─s_cut─┐ -│ foo\0\0\0\0\0 │ foo │ -└───────────────┴───────┘ -``` - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s──────────┬─s_cut─┐ -│ foo\0bar\0 │ foo │ -└────────────┴───────┘ -``` - -## reinterpretAsUInt(8\|16\|32\|64) {#reinterpretasuint8163264} - -## reinterpretAsInt(8\|16\|32\|64) {#reinterpretasint8163264} - -## reinterpretAsFloat(32\|64) {#reinterpretasfloat3264} - -## reinterpretAsDate {#reinterpretasdate} - -## reinterpretAsDateTime {#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. - -## reinterpretAsString {#type_conversion_functions-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. - -## reinterpretAsFixedString {#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. - -## CAST(x, t) {#type_conversion_function-cast} - -Converts ‘x’ to the ‘t’ data type. The syntax CAST(x AS t) is also supported. - -Example: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - -``` text -┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ -└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ -``` - -Conversion to FixedString(N) only works for arguments of type String or FixedString(N). - -Type conversion to [Nullable](../../sql_reference/data_types/nullable.md) and back is supported. Example: - -``` sql -SELECT toTypeName(x) FROM t_null -``` - -``` text -┌─toTypeName(x)─┐ -│ Int8 │ -│ Int8 │ -└───────────────┘ -``` - -``` sql -SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null -``` - -``` text -┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ -│ Nullable(UInt16) │ -│ Nullable(UInt16) │ -└─────────────────────────────────────────┘ -``` - -## toInterval(Year\|Quarter\|Month\|Week\|Day\|Hour\|Minute\|Second) {#function-tointerval} - -Converts a Number type argument to an [Interval](../../sql_reference/data_types/special_data_types/interval.md) data type. - -**Syntax** - -``` sql -toIntervalSecond(number) -toIntervalMinute(number) -toIntervalHour(number) -toIntervalDay(number) -toIntervalWeek(number) -toIntervalMonth(number) -toIntervalQuarter(number) -toIntervalYear(number) -``` - -**Parameters** - -- `number` — Duration of interval. Positive integer number. - -**Returned values** - -- The value in `Interval` data type. - -**Example** - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - -``` text -┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ -│ 2019-01-08 │ 2019-01-08 │ -└───────────────────────────┴──────────────────────────────┘ -``` - -## parseDateTimeBestEffort {#parsedatetimebesteffort} - -Converts a date and time in the [String](../../sql_reference/data_types/string.md) representation to [DateTime](../../sql_reference/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. - - -**Syntax** - -```sql -parseDateTimeBestEffort(time_string [, time_zone]); -``` - -**Parameters** - -- `time_string` — String containing a date and time to convert. [String](../../sql_reference/data_types/string.md). -- `time_zone` — Time zone. The function parses `time_string` according to the time zone. [String](../../sql_reference/data_types/string.md). - - -**Supported non-standard formats** - -- A string containing 9..10 digit [unix timestamp](https://en.wikipedia.org/wiki/Unix_time). -- A string with a date and a time component: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, etc. -- A string with a date, but no time component: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` etc. -- A string with a day and time: `DD`, `DD hh`, `DD hh:mm`. In this case `YYYY-MM` are substituted as `2000-01`. -- A string that includes the date and time along with time zone offset information: `YYYY-MM-DD hh:mm:ss ±h:mm`, etc. For example, `2020-12-12 17:36:00 -5:00`. - -For all of the formats with separator the function parses months names expressed by their full name or by the first three letters of a month name. Examples: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. - -**Returned value** - -- `time_string` converted to the `DateTime` data type. - -**Examples** - -Query: - -```sql -SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') -AS parseDateTimeBestEffort; -``` - -Result: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2020-12-12 12:12:57 │ -└─────────────────────────┘ -``` - -Query: - -```sql -SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') -AS parseDateTimeBestEffort -``` - -Result: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2018-08-18 10:22:16 │ -└─────────────────────────┘ -``` - -Query: - -```sql -SELECT parseDateTimeBestEffort('1284101485') -AS parseDateTimeBestEffort -``` - -Result: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2015-07-07 12:04:41 │ -└─────────────────────────┘ -``` - -Query: - -```sql -SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') -AS parseDateTimeBestEffort -``` - -Result: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2018-12-12 10:12:12 │ -└─────────────────────────┘ -``` - -Query: - -```sql -SELECT parseDateTimeBestEffort('10 20:19') -``` - -Result: - -```text -┌─parseDateTimeBestEffort('10 20:19')─┐ -│ 2000-01-10 20:19:00 │ -└─────────────────────────────────────┘ -``` - -**See Also** - -- [ISO 8601 announcement by @xkcd](https://xkcd.com/1179/) -- [RFC 1123](https://tools.ietf.org/html/rfc1123) -- [toDate](#todate) -- [toDateTime](#todatetime) - -## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} - -Same as for [parseDateTimeBestEffort](#parsedatetimebesteffort) except that it returns null when it encounters a date format that cannot be processed. - -## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} - -Same as for [parseDateTimeBestEffort](#parsedatetimebesteffort) except that it returns zero date or zero date time when it encounters a date format that cannot be processed. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/en/sql_reference/functions/url_functions.md b/docs/en/sql_reference/functions/url_functions.md deleted file mode 100644 index 205fb4bc068..00000000000 --- a/docs/en/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,207 +0,0 @@ ---- -toc_priority: 54 -toc_title: Working with URLs ---- - -# Functions for working with URLs {#functions-for-working-with-urls} - -All these functions don’t follow the RFC. They are maximally simplified for improved performance. - -## Functions that Extract Parts of a URL {#functions-that-extract-parts-of-a-url} - -If the relevant part isn’t present in a URL, an empty string is returned. - -### protocol {#protocol} - -Extracts the protocol from a URL. - -Examples of typical returned values: http, https, ftp, mailto, tel, magnet… - -### domain {#domain} - -Extracts the hostname from a URL. - -``` sql -domain(url) -``` - -**Parameters** - -- `url` — URL. Type: [String](../../sql_reference/data_types/string.md). - -The URL can be specified with or without a scheme. Examples: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -For these examples, the `domain` function returns the following results: - -``` text -some.svn-hosting.com -some.svn-hosting.com -yandex.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`. - -**Example** - -``` sql -SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ -│ some.svn-hosting.com │ -└────────────────────────────────────────────────────────┘ -``` - -### domainWithoutWWW {#domainwithoutwww} - -Returns the domain and removes no more than one ‘www.’ from the beginning of it, if present. - -### topLevelDomain {#topleveldomain} - -Extracts the the top-level domain from a URL. - -``` sql -topLevelDomain(url) -``` - -**Parameters** - -- `url` — URL. Type: [String](../../sql_reference/data_types/string.md). - -The URL can be specified with or without a scheme. Examples: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.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`. - -**Example** - -``` sql -SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ -│ com │ -└────────────────────────────────────────────────────────────────────┘ -``` - -### firstSignificantSubdomain {#firstsignificantsubdomain} - -Returns the “first significant subdomain”. This is a non-standard concept specific to Yandex.Metrica. The first significant subdomain is a second-level domain if it is ‘com’, ‘net’, ‘org’, or ‘co’. Otherwise, it is a third-level domain. For example, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. The list of “insignificant” second-level domains and other implementation details may change in the future. - -### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} - -Returns the part of the domain that includes top-level subdomains up to the “first significant subdomain” (see the explanation above). - -For example, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### path {#path} - -Returns the path. Example: `/top/news.html` The path does not include the query string. - -### pathFull {#pathfull} - -The same as above, but including query string and fragment. Example: /top/news.html?page=2\#comments - -### queryString {#querystring} - -Returns the query string. Example: page=1&lr=213. query-string does not include the initial question mark, as well as \# and everything after \#. - -### fragment {#fragment} - -Returns the fragment identifier. fragment does not include the initial hash symbol. - -### queryStringAndFragment {#querystringandfragment} - -Returns the query string and fragment identifier. Example: page=1\#29390. - -### extractURLParameter(URL, name) {#extracturlparameterurl-name} - -Returns the value of the ‘name’ parameter in the URL, if present. Otherwise, an empty string. If there are many parameters with this name, it returns the first occurrence. This function works under the assumption that the parameter name is encoded in the URL exactly the same way as in the passed argument. - -### extractURLParameters(URL) {#extracturlparametersurl} - -Returns an array of name=value strings corresponding to the URL parameters. The values are not decoded in any way. - -### extractURLParameterNames(URL) {#extracturlparameternamesurl} - -Returns an array of name strings corresponding to the names of URL parameters. The values are not decoded in any way. - -### URLHierarchy(URL) {#urlhierarchyurl} - -Returns an array containing the URL, truncated at the end by the symbols /,? in the path and query-string. Consecutive separator characters are counted as one. The cut is made in the position after all the consecutive separator characters. - -### URLPathHierarchy(URL) {#urlpathhierarchyurl} - -The same as above, but without the protocol and host in the result. The / element (root) is not included. Example: the function is used to implement tree reports the URL in Yandex. Metric. - -``` text -URLPathHierarchy('https://example.com/browse/CONV-6788') = -[ - '/browse/', - '/browse/CONV-6788' -] -``` - -### decodeURLComponent(URL) {#decodeurlcomponenturl} - -Returns the decoded URL. -Example: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - -``` text -┌─DecodedURL─────────────────────────────┐ -│ http://127.0.0.1:8123/?query=SELECT 1; │ -└────────────────────────────────────────┘ -``` - -## Functions that remove part of a URL. {#functions-that-remove-part-of-a-url} - -If the URL doesn’t have anything similar, the URL remains unchanged. - -### cutWWW {#cutwww} - -Removes no more than one ‘www.’ from the beginning of the URL’s domain, if present. - -### cutQueryString {#cutquerystring} - -Removes query string. The question mark is also removed. - -### cutFragment {#cutfragment} - -Removes the fragment identifier. The number sign is also removed. - -### cutQueryStringAndFragment {#cutquerystringandfragment} - -Removes the query string and fragment identifier. The question mark and number sign are also removed. - -### cutURLParameter(URL, name) {#cuturlparameterurl-name} - -Removes the ‘name’ URL parameter, if present. This function works under the assumption that the parameter name is encoded in the URL exactly the same way as in the passed argument. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/en/sql_reference/functions/uuid_functions.md b/docs/en/sql_reference/functions/uuid_functions.md deleted file mode 100644 index 9cda8f44b13..00000000000 --- a/docs/en/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -toc_priority: 53 -toc_title: Working with UUID ---- - -# Functions for working with UUID {#functions-for-working-with-uuid} - -The functions for working with UUID are listed below. - -## generateUUIDv4 {#uuid-function-generate} - -Generates the [UUID](../../sql_reference/data_types/uuid.md) of [version 4](https://tools.ietf.org/html/rfc4122#section-4.4). - -``` sql -generateUUIDv4() -``` - -**Returned value** - -The UUID type value. - -**Usage example** - -This example demonstrates creating a table with the UUID type column and inserting a value into the table. - -``` sql -CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -INSERT INTO t_uuid SELECT generateUUIDv4() - -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## toUUID (x) {#touuid-x} - -Converts String type value to UUID type. - -``` sql -toUUID(String) -``` - -**Returned value** - -The UUID type value. - -**Usage example** - -``` sql -SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid -``` - -``` text -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## UUIDStringToNum {#uuidstringtonum} - -Accepts a string containing 36 characters in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, and returns it as a set of bytes in a [FixedString(16)](../../sql_reference/data_types/fixedstring.md). - -``` sql -UUIDStringToNum(String) -``` - -**Returned value** - -FixedString(16) - -**Usage examples** - -``` sql -SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes -``` - -``` text - -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## UUIDNumToString {#uuidnumtostring} - -Accepts a [FixedString(16)](../../sql_reference/data_types/fixedstring.md) value, and returns a string containing 36 characters in text format. - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**Returned value** - -String. - -**Usage example** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid -``` - -``` text -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## See also {#see-also} - -- [dictGetUUID](ext_dict_functions.md#ext_dict_functions-other) - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/en/sql_reference/functions/ym_dict_functions.md b/docs/en/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index e36d460689b..00000000000 --- a/docs/en/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -toc_priority: 59 -toc_title: Working with Yandex.Metrica Dictionaries ---- - -# Functions for working with Yandex.Metrica dictionaries {#functions-for-working-with-yandex-metrica-dictionaries} - -In order for the functions below to work, the server config must specify the paths and addresses for getting all the Yandex.Metrica dictionaries. The dictionaries are loaded at the first call of any of these functions. If the reference lists can’t be loaded, an exception is thrown. - -For information about creating reference lists, see the section “Dictionaries”. - -## Multiple geobases {#multiple-geobases} - -ClickHouse supports working with multiple alternative geobases (regional hierarchies) simultaneously, in order to support various perspectives on which countries certain regions belong to. - -The ‘clickhouse-server’ config specifies the file with the regional hierarchy::`/opt/geo/regions_hierarchy.txt` - -Besides this file, it also searches for files nearby that have the \_ symbol and any suffix appended to the name (before the file extension). -For example, it will also find the file `/opt/geo/regions_hierarchy_ua.txt`, if present. - -`ua` is called the dictionary key. For a dictionary without a suffix, the key is an empty string. - -All the dictionaries are re-loaded in runtime (once every certain number of seconds, as defined in the builtin\_dictionaries\_reload\_interval config parameter, or once an hour by default). However, the list of available dictionaries is defined one time, when the server starts. - -All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. -Example: - -``` sql -regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt -``` - -### regionToCity(id\[, geobase\]) {#regiontocityid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. - -### regionToArea(id\[, geobase\]) {#regiontoareaid-geobase} - -Converts a region to an area (type 5 in the geobase). In every other way, this function is the same as ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ -│ │ -│ Moscow and Moscow region │ -│ St. Petersburg and Leningrad region │ -│ Belgorod region │ -│ Ivanovsk region │ -│ Kaluga region │ -│ Kostroma region │ -│ Kursk region │ -│ Lipetsk region │ -│ Orlov region │ -│ Ryazan region │ -│ Smolensk region │ -│ Tambov region │ -│ Tver region │ -│ Tula region │ -└──────────────────────────────────────────────────────┘ -``` - -### regionToDistrict(id\[, geobase\]) {#regiontodistrictid-geobase} - -Converts a region to a federal district (type 4 in the geobase). In every other way, this function is the same as ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ -│ │ -│ Central federal district │ -│ Northwest federal district │ -│ South federal district │ -│ North Caucases federal district │ -│ Privolga federal district │ -│ Ural federal district │ -│ Siberian federal district │ -│ Far East federal district │ -│ Scotland │ -│ Faroe Islands │ -│ Flemish region │ -│ Brussels capital region │ -│ Wallonia │ -│ Federation of Bosnia and Herzegovina │ -└──────────────────────────────────────────────────────────┘ -``` - -### regionToCountry(id\[, geobase\]) {#regiontocountryid-geobase} - -Converts a region to a country. In every other way, this function is the same as ‘regionToCity’. -Example: `regionToCountry(toUInt32(213)) = 225` converts Moscow (213) to Russia (225). - -### regionToContinent(id\[, geobase\]) {#regiontocontinentid-geobase} - -Converts a region to a continent. In every other way, this function is the same as ‘regionToCity’. -Example: `regionToContinent(toUInt32(213)) = 10001` converts Moscow (213) to Eurasia (10001). - -### regionToTopContinent (#regiontotopcontinent) - -Finds the highest continent in the hierarchy for the region. - -**Syntax** - -```sql -regionToTopContinent(id[, geobase]); -``` - -**Parameters** - -- `id` — Region ID from the Yandex geobase. [UInt32](../../sql_reference/data_types/int_uint.md). -- `geobase` — Dictionary key. See [Multiple Geobases](#multiple-geobases). [String](../../sql_reference/data_types/string.md). Optional. - - -**Returned value** - -- Identifier of the top level continent (the latter when you climb the hierarchy of regions). -- 0, if there is none. - -Type: `UInt32`. - - -### regionToPopulation(id\[, geobase\]) {#regiontopopulationid-geobase} - -Gets the population for a region. -The population can be recorded in files with the geobase. See the section “External dictionaries”. -If the population is not recorded for the region, it returns 0. -In the Yandex geobase, the population might be recorded for child regions, but not for parent regions. - -### regionIn(lhs, rhs\[, geobase\]) {#regioninlhs-rhs-geobase} - -Checks whether a ‘lhs’ region belongs to a ‘rhs’ region. Returns a UInt8 number equal to 1 if it belongs, or 0 if it doesn’t belong. -The relationship is reflexive – any region also belongs to itself. - -### regionHierarchy(id\[, geobase\]) {#regionhierarchyid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. -Example: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### regionToName(id\[, lang\]) {#regiontonameid-lang} - -Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn’t exist, an empty string is returned. - -`ua` and `uk` both mean Ukrainian. - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/en/sql_reference/index.md b/docs/en/sql_reference/index.md deleted file mode 100644 index ae0f81336be..00000000000 --- a/docs/en/sql_reference/index.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -toc_folder_title: SQL Reference -toc_hidden: true -toc_priority: 28 -toc_title: hidden ---- - -# SQL Reference {#sql-reference} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md#query_language_queries_alter) -- [Other types of queries](statements/misc.md) - -[Original article](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/en/sql_reference/operators.md b/docs/en/sql_reference/operators.md deleted file mode 100644 index 8ae9e460d87..00000000000 --- a/docs/en/sql_reference/operators.md +++ /dev/null @@ -1,275 +0,0 @@ ---- -toc_priority: 37 -toc_title: Operators ---- - -# Operators {#operators} - -ClickHouse transforms operators to their corresponding functions at the query parsing stage according to their priority, precedence, and associativity. - -## Access Operators {#access-operators} - -`a[N]` – Access to an element of an array. The `arrayElement(a, N)` function. - -`a.N` – Access to a tuple element. The `tupleElement(a, N)` function. - -## Numeric Negation Operator {#numeric-negation-operator} - -`-a` – The `negate (a)` function. - -## Multiplication and Division Operators {#multiplication-and-division-operators} - -`a * b` – The `multiply (a, b)` function. - -`a / b` – The `divide(a, b)` function. - -`a % b` – The `modulo(a, b)` function. - -## Addition and Subtraction Operators {#addition-and-subtraction-operators} - -`a + b` – The `plus(a, b)` function. - -`a - b` – The `minus(a, b)` function. - -## Comparison Operators {#comparison-operators} - -`a = b` – The `equals(a, b)` function. - -`a == b` – The `equals(a, b)` function. - -`a != b` – The `notEquals(a, b)` function. - -`a <> b` – The `notEquals(a, b)` function. - -`a <= b` – The `lessOrEquals(a, b)` function. - -`a >= b` – The `greaterOrEquals(a, b)` function. - -`a < b` – The `less(a, b)` function. - -`a > b` – The `greater(a, b)` function. - -`a LIKE s` – The `like(a, b)` function. - -`a NOT LIKE s` – The `notLike(a, b)` function. - -`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. - -`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. - -## Operators for Working with Data Sets {#operators-for-working-with-data-sets} - -*See [IN operators](statements/select.md#select-in-operators).* - -`a IN ...` – The `in(a, b)` function. - -`a NOT IN ...` – The `notIn(a, b)` function. - -`a GLOBAL IN ...` – The `globalIn(a, b)` function. - -`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` function. - -## Operators for Working with Dates and Times {#operators-datetime} - -### EXTRACT {#operator-extract} - -``` sql -EXTRACT(part FROM date); -``` - -Extract parts from a given date. For example, you can retrieve a month from a given date, or a second from a time. - -The `part` parameter specifies which part of the date to retrieve. The following values are available: - -- `DAY` — The day of the month. Possible values: 1–31. -- `MONTH` — The number of a month. Possible values: 1–12. -- `YEAR` — The year. -- `SECOND` — The second. Possible values: 0–59. -- `MINUTE` — The minute. Possible values: 0–59. -- `HOUR` — The hour. Possible values: 0–23. - -The `part` parameter is case-insensitive. - -The `date` parameter specifies the date or the time to process. Either [Date](../sql_reference/data_types/date.md) or [DateTime](../sql_reference/data_types/datetime.md) type is supported. - -Examples: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -In the following example we create a table and insert into it a value with the `DateTime` type. - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -You can see more examples in [tests](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -Creates an [Interval](../sql_reference/data_types/special_data_types/interval.md)-type value that should be used in arithmetical operations with [Date](../sql_reference/data_types/date.md) and [DateTime](../sql_reference/data_types/datetime.md)-type values. - -Types of intervals: -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -!!! warning "Warning" - Intervals with different types can’t be combined. You can’t use expressions like `INTERVAL 4 DAY 1 HOUR`. Specify intervals in units that are smaller or equal to the smallest unit of the interval, for example, `INTERVAL 25 HOUR`. You can use consecutive operations, like in the example below. - -Example: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**See Also** - -- [Interval](../sql_reference/data_types/special_data_types/interval.md) data type -- [toInterval](../sql_reference/functions/type_conversion_functions.md#function-tointerval) type convertion functions - -## Logical Negation Operator {#logical-negation-operator} - -`NOT a` – The `not(a)` function. - -## Logical AND Operator {#logical-and-operator} - -`a AND b` – The`and(a, b)` function. - -## Logical OR Operator {#logical-or-operator} - -`a OR b` – The `or(a, b)` function. - -## Conditional Operator {#conditional-operator} - -`a ? b : c` – The `if(a, b, c)` function. - -Note: - -The conditional operator calculates the values of b and c, then checks whether condition a is met, and then returns the corresponding value. If `b` or `C` is an [arrayJoin()](../sql_reference/functions/array_join.md#functions_arrayjoin) function, each row will be replicated regardless of the “a” condition. - -## Conditional Expression {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -If `x` is specified, then `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. - -If there is no `ELSE c` clause in the expression, the default value is `NULL`. - -The `transform` function does not work with `NULL`. - -## Concatenation Operator {#concatenation-operator} - -`s1 || s2` – The `concat(s1, s2) function.` - -## Lambda Creation Operator {#lambda-creation-operator} - -`x -> expr` – The `lambda(x, expr) function.` - -The following operators do not have a priority since they are brackets: - -## Array Creation Operator {#array-creation-operator} - -`[x1, ...]` – The `array(x1, ...) function.` - -## Tuple Creation Operator {#tuple-creation-operator} - -`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` - -## Associativity {#associativity} - -All binary operators have left associativity. For example, `1 + 2 + 3` is transformed to `plus(plus(1, 2), 3)`. -Sometimes this doesn’t work the way you expect. For example, `SELECT 4 > 2 > 3` will result in 0. - -For efficiency, the `and` and `or` functions accept any number of arguments. The corresponding chains of `AND` and `OR` operators are transformed into a single call of these functions. - -## Checking for `NULL` {#checking-for-null} - -ClickHouse supports the `IS NULL` and `IS NOT NULL` operators. - -### IS NULL {#operator-is-null} - -- For [Nullable](../sql_reference/data_types/nullable.md) type values, the `IS NULL` operator returns: - - `1`, if the value is `NULL`. - - `0` otherwise. -- For other values, the `IS NULL` operator always returns `0`. - - - -``` sql -SELECT x+100 FROM t_null WHERE y IS NULL -``` - -``` text -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ -``` - -### IS NOT NULL {#is-not-null} - -- For [Nullable](../sql_reference/data_types/nullable.md) type values, the `IS NOT NULL` operator returns: - - `0`, if the value is `NULL`. - - `1` otherwise. -- For other values, the `IS NOT NULL` operator always returns `1`. - - - -``` sql -SELECT * FROM t_null WHERE y IS NOT NULL -``` - -``` text -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/en/sql_reference/statements/alter.md b/docs/en/sql_reference/statements/alter.md deleted file mode 100644 index aa04ae65514..00000000000 --- a/docs/en/sql_reference/statements/alter.md +++ /dev/null @@ -1,502 +0,0 @@ ---- -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -The `ALTER` query is only supported for `*MergeTree` tables, as well as `Merge`and`Distributed`. The query has several variations. - -### Column Manipulations {#column-manipulations} - -Changing the table structure. - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -In the query, specify a list of one or more comma-separated actions. -Each action is an operation on a column. - -The following actions are supported: - -- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. -- [DROP COLUMN](#alter_drop-column) — Deletes the column. -- [CLEAR COLUMN](#alter_clear-column) — Resets column values. -- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. -- [MODIFY COLUMN](#alter_modify-column) — Changes column’s type, default expression and TTL. - -These actions are described in detail below. - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -Adds a new column to the table with the specified `name`, `type`, [`codec`](create.md#codecs) and `default_expr` (see the section [Default expressions](create.md#create-default-values)). - -If the `IF NOT EXISTS` clause is included, the query won’t return an error if the column already exists. If you specify `AFTER name_after` (the name of another column), the column is added after the specified one in the list of table columns. Otherwise, the column is added to the end of the table. Note that there is no way to add a column to the beginning of a table. For a chain of actions, `name_after` can be the name of a column that is added in one of the previous actions. - -Adding a column just changes the table structure, without performing any actions with data. The data doesn’t appear on the disk after `ALTER`. If the data is missing for a column when reading from the table, it is filled in with default values (by performing the default expression if there is one, or using zeros or empty strings). The column appears on the disk after merging data parts (see [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)). - -This approach allows us to complete the `ALTER` query instantly, without increasing the volume of old data. - -Example: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -Deletes the column with the name `name`. If the `IF EXISTS` clause is specified, the query won’t return an error if the column doesn’t exist. - -Deletes data from the file system. Since this deletes entire files, the query is completed almost instantly. - -Example: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -Resets all data in a column for a specified partition. Read more about setting the partition name in the section [How to specify the partition expression](#alter-how-to-specify-part-expr). - -If the `IF EXISTS` clause is specified, the query won’t return an error if the column doesn’t exist. - -Example: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'comment' -``` - -Adds a comment to the column. If the `IF EXISTS` clause is specified, the query won’t return an error if the column doesn’t exist. - -Each column can have one comment. If a comment already exists for the column, a new comment overwrites the previous comment. - -Comments are stored in the `comment_expression` column returned by the [DESCRIBE TABLE](misc.md#misc-describe-table) query. - -Example: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -This query changes the `name` column properties: - -- Type - -- Default expression - -- TTL - - For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). - -If the `IF EXISTS` clause is specified, the query won’t return an error if the column doesn’t exist. - -When changing the type, values are converted as if the [toType](../../sql_reference/functions/type_conversion_functions.md) functions were applied to them. If only the default expression is changed, the query doesn’t do anything complex, and is completed almost instantly. - -Example: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. - -There are several processing stages: - -- Preparing temporary (new) files with modified data. -- Renaming old files. -- Renaming the temporary (new) files to the old names. -- Deleting the old files. - -Only the first stage takes time. If there is a failure at this stage, the data is not changed. -If there is a failure during one of the successive stages, data can be restored manually. The exception is if the old files were deleted from the file system but the data for the new files did not get written to the disk and was lost. - -The `ALTER` query for changing columns is replicated. The instructions are saved in ZooKeeper, then each replica applies them. All `ALTER` queries are run in the same order. The query waits for the appropriate actions to be completed on the other replicas. However, a query to change columns in a replicated table can be interrupted, and all actions will be performed asynchronously. - -#### ALTER Query Limitations {#alter-query-limitations} - -The `ALTER` query lets you create and delete separate elements (columns) in nested data structures, but not whole nested data structures. To add a nested data structure, you can add columns with a name like `name.nested_name` and the type `Array(T)`. A nested data structure is equivalent to multiple array columns with a name that has the same prefix before the dot. - -There is no support for deleting columns in the primary key or the sampling key (columns that are used in the `ENGINE` expression). Changing the type for columns that are included in the primary key is only possible if this change does not cause the data to be modified (for example, you are allowed to add values to an Enum or to change a type from `DateTime` to `UInt32`). - -If the `ALTER` query is not sufficient to make the table changes you need, you can create a new table, copy the data to it using the [INSERT SELECT](insert_into.md#insert_query_insert-select) query, then switch the tables using the [RENAME](misc.md#misc_operations-rename) query and delete the old table. You can use the [clickhouse-copier](../../operations/utilities/clickhouse-copier.md) as an alternative to the `INSERT SELECT` query. - -The `ALTER` query blocks all reads and writes for the table. In other words, if a long `SELECT` is running at the time of the `ALTER` query, the `ALTER` query will wait for it to complete. At the same time, all new queries to the same table will wait while this `ALTER` is running. - -For tables that don’t store data themselves (such as `Merge` and `Distributed`), `ALTER` just changes the table structure, and does not change the structure of subordinate tables. For example, when running ALTER for a `Distributed` table, you will also need to run `ALTER` for the tables on all remote servers. - -### Manipulations With Key Expressions {#manipulations-with-key-expressions} - -The following command is supported: - -``` sql -MODIFY ORDER BY new_expression -``` - -It only works for tables in the [`MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) family (including -[replicated](../../engines/table_engines/mergetree_family/replication.md) tables). The command changes the -[sorting key](../../engines/table_engines/mergetree_family/mergetree.md) of the table -to `new_expression` (an expression or a tuple of expressions). Primary key remains the same. - -The command is lightweight in a sense that it only changes metadata. To keep the property that data part -rows are ordered by the sorting key expression you cannot add expressions containing existing columns -to the sorting key (only columns added by the `ADD COLUMN` command in the same `ALTER` query). - -### Manipulations With Data Skipping Indices {#manipulations-with-data-skipping-indices} - -It only works for tables in the [`*MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) family (including -[replicated](../../engines/table_engines/mergetree_family/replication.md) tables). The following operations -are available: - -- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - Adds index description to tables metadata. - -- `ALTER TABLE [db].name DROP INDEX name` - Removes index description from tables metadata and deletes index files from disk. - -These commands are lightweight in a sense that they only change metadata or remove files. -Also, they are replicated (syncing indices metadata through ZooKeeper). - -### Manipulations With Constraints {#manipulations-with-constraints} - -See more on [constraints](create.md#constraints) - -Constraints could be added or deleted using following syntax: - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -Queries will add or remove metadata about constraints from table so they are processed immediately. - -Constraint check *will not be executed* on existing data if it was added. - -All changes on replicated tables are broadcasting to ZooKeeper so will be applied on other replicas. - -### Manipulations With Partitions and Parts {#alter_manipulations-with-partitions} - -The following operations with [partitions](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) are available: - -- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` directory and forget it. -- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. -- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` directory to the table. -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. -- [REPLACE PARTITION](#alter_replace-partition) - Copies the data partition from one table to another and replaces. -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - Move the data partition from one table to another. -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - Resets the value of a specified column in a partition. -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - Resets the specified secondary index in a partition. -- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. -- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. -- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. - - - -#### DETACH PARTITION {\#alter\_detach-partition} {#detach-partition-alter-detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -Moves all data for the specified partition to the `detached` directory. The server forgets about the detached data partition as if it does not exist. The server will not know about this data until you make the [ATTACH](#alter_attach-partition) query. - -Example: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -Read about setting the partition expression in a section [How to specify the partition expression](#alter-how-to-specify-part-expr). - -After the query is executed, you can do whatever you want with the data in the `detached` directory — delete it from the file system, or just leave it. - -This query is replicated – it moves the data to the `detached` directory on all replicas. Note that you can execute this query only on a leader replica. To find out if a replica is a leader, perform the `SELECT` query to the [system.replicas](../../operations/system_tables.md#system_tables-replicas) table. Alternatively, it is easier to make a `DETACH` query on all replicas - all the replicas throw an exception, except the leader replica. - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -Deletes the specified partition from the table. This query tags the partition as inactive and deletes data completely, approximately in 10 minutes. - -Read about setting the partition expression in a section [How to specify the partition expression](#alter-how-to-specify-part-expr). - -The query is replicated – it deletes data on all replicas. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -Removes the specified part or all parts of the specified partition from `detached`. -Read more about setting the partition expression in a section [How to specify the partition expression](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -Adds data to the table from the `detached` directory. It is possible to add data for an entire partition or for a separate part. Examples: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -Read more about setting the partition expression in a section [How to specify the partition expression](#alter-how-to-specify-part-expr). - -This query is replicated. The replica-initiator checks whether there is data in the `detached` directory. If data exists, the query checks its integrity. If everything is correct, the query adds the data to the table. All other replicas download the data from the replica-initiator. - -So you can put data to the `detached` directory on one replica, and use the `ALTER ... ATTACH` query to add it to the table on all replicas. - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -This query copies the data partition from the `table1` to `table2` adds data to exsisting in the `table2`. Note that data won’t be deleted from `table1`. - -For the query to run successfully, the following conditions must be met: - -- Both tables must have the same structure. -- Both tables must have the same partition key. - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -This query copies the data partition from the `table1` to `table2` and replaces existing partition in the `table2`. Note that data won’t be deleted from `table1`. - -For the query to run successfully, the following conditions must be met: - -- Both tables must have the same structure. -- Both tables must have the same partition key. - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -This query move the data partition from the `table_source` to `table_dest` with deleting the data from `table_source`. - -For the query to run successfully, the following conditions must be met: - -- Both tables must have the same structure. -- Both tables must have the same partition key. -- Both tables must be the same engine family. (replicated or non-replicated) -- Both tables must have the same storage policy. - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -Resets all values in the specified column in a partition. If the `DEFAULT` clause was determined when creating a table, this query sets the column value to a specified default value. - -Example: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -This query creates a local backup of a specified partition. If the `PARTITION` clause is omitted, the query creates the backup of all partitions at once. - -!!! note "Note" - The entire backup process is performed without stopping the server. - -Note that for old-styled tables you can specify the prefix of the partition name (for example, ‘2019’) - then the query creates the backup for all the corresponding partitions. Read about setting the partition expression in a section [How to specify the partition expression](#alter-how-to-specify-part-expr). - -At the time of execution, for a data snapshot, the query creates hardlinks to a table data. Hardlinks are placed in the directory `/var/lib/clickhouse/shadow/N/...`, where: - -- `/var/lib/clickhouse/` is the working ClickHouse directory specified in the config. -- `N` is the incremental number of the backup. - -!!! note "Note" - If you use [a set of disks for data storage in a table](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes), the `shadow/N` directory appears on every disk, storing data parts that matched by the `PARTITION` expression. - -The same structure of directories is created inside the backup as inside `/var/lib/clickhouse/`. The query performs ‘chmod’ for all files, forbidding writing into them. - -After creating the backup, you can copy the data from `/var/lib/clickhouse/shadow/` to the remote server and then delete it from the local server. Note that the `ALTER t FREEZE PARTITION` query is not replicated. It creates a local backup only on the local server. - -The query creates backup almost instantly (but first it waits for the current queries to the corresponding table to finish running). - -`ALTER TABLE t FREEZE PARTITION` copies only the data, not table metadata. To make a backup of table metadata, copy the file `/var/lib/clickhouse/metadata/database/table.sql` - -To restore data from a backup, do the following: - -1. Create the table if it does not exist. To view the query, use the .sql file (replace `ATTACH` in it with `CREATE`). -2. Copy the data from the `data/database/table/` directory inside the backup to the `/var/lib/clickhouse/data/database/table/detached/` directory. -3. Run `ALTER TABLE t ATTACH PARTITION` queries to add the data to a table. - -Restoring from a backup doesn’t require stopping the server. - -For more information about backups and restoring data, see the [Data Backup](../../operations/backup.md) section. - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -The query works similar to `CLEAR COLUMN`, but it resets an index instead of a column data. - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -Downloads a partition from another server. This query only works for the replicated tables. - -The query does the following: - -1. Downloads the partition from the specified shard. In ‘path-in-zookeeper’ you must specify a path to the shard in ZooKeeper. -2. Then the query puts the downloaded data to the `detached` directory of the `table_name` table. Use the [ATTACH PARTITION\|PART](#alter_attach-partition) query to add the data to the table. - -For example: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -Note that: - -- The `ALTER ... FETCH PARTITION` query isn’t replicated. It places the partition to the `detached` directory only on the local server. -- The `ALTER TABLE ... ATTACH` query is replicated. It adds the data to all replicas. The data is added to one of the replicas from the `detached` directory, and to the others - from neighboring replicas. - -Before downloading, the system checks if the partition exists and the table structure matches. The most appropriate replica is selected automatically from the healthy replicas. - -Although the query is called `ALTER TABLE`, it does not change the table structure and does not immediately change the data available in the table. - -#### MOVE PARTITION\|PART {#alter_move-partition} - -Moves partitions or data parts to another volume or disk for `MergeTree`-engine tables. See [Using Multiple Block Devices for Data Storage](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -The `ALTER TABLE t MOVE` query: - -- Not replicated, because different replicas can have different storage policies. -- Returns an error if the specified disk or volume is not configured. Query also returns an error if conditions of data moving, that specified in the storage policy, can’t be applied. -- Can return an error in the case, when data to be moved is already moved by a background process, concurrent `ALTER TABLE t MOVE` query or as a result of background data merging. A user shouldn’t perform any additional actions in this case. - -Example: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### How To Set Partition Expression {#alter-how-to-specify-part-expr} - -You can specify the partition expression in `ALTER ... PARTITION` queries in different ways: - -- As a value from the `partition` column of the `system.parts` table. For example, `ALTER TABLE visits DETACH PARTITION 201901`. -- As the expression from the table column. Constants and constant expressions are supported. For example, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- Using the partition ID. Partition ID is a string identifier of the partition (human-readable, if possible) that is used as the names of partitions in the file system and in ZooKeeper. The partition ID must be specified in the `PARTITION ID` clause, in a single quotes. For example, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- In the [ALTER ATTACH PART](#alter_attach-partition) and [DROP DETACHED PART](#alter_drop-detached) query, to specify the name of a part, use string literal with a value from the `name` column of the [system.detached\_parts](../../operations/system_tables.md#system_tables-detached_parts) table. For example, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -Usage of quotes when specifying the partition depends on the type of partition expression. For example, for the `String` type, you have to specify its name in quotes (`'`). For the `Date` and `Int*` types no quotes are needed. - -For old-style tables, you can specify the partition either as a number `201901` or a string `'201901'`. The syntax for the new-style tables is stricter with types (similar to the parser for the VALUES input format). - -All the rules above are also true for the [OPTIMIZE](misc.md#misc_operations-optimize) query. If you need to specify the only partition when optimizing a non-partitioned table, set the expression `PARTITION tuple()`. For example: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -The examples of `ALTER ... PARTITION` queries are demonstrated in the tests [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) and [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### Manipulations With Table TTL {#manipulations-with-table-ttl} - -You can change [table TTL](../../engines/table_engines/mergetree_family/mergetree.md#mergetree-table-ttl) with a request of the following form: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### Synchronicity Of ALTER Queries {#synchronicity-of-alter-queries} - -For non-replicatable tables, all `ALTER` queries are performed synchronously. For replicatable tables, the query just adds instructions for the appropriate actions to `ZooKeeper`, and the actions themselves are performed as soon as possible. However, the query can wait for these actions to be completed on all the replicas. - -For `ALTER ... ATTACH|DETACH|DROP` queries, you can use the `replication_alter_partitions_sync` setting to set up waiting. -Possible values: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. - -### Mutations {#alter-mutations} - -Mutations are an ALTER query variant that allows changing or deleting rows in a table. In contrast to standard `UPDATE` and `DELETE` queries that are intended for point data changes, mutations are intended for heavy operations that change a lot of rows in a table. Supported for the `MergeTree` family of table engines including the engines with replication support. - -Existing tables are ready for mutations as-is (no conversion necessary), but after the first mutation is applied to a table, its metadata format becomes incompatible with previous server versions and falling back to a previous version becomes impossible. - -Currently available commands: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -The `filter_expr` must be of type `UInt8`. The query deletes rows in the table for which this expression takes a non-zero value. - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -The `filter_expr` must be of type `UInt8`. This query updates values of specified columns to the values of corresponding expressions in rows for which the `filter_expr` takes a non-zero value. Values are casted to the column type using the `CAST` operator. Updating columns that are used in the calculation of the primary or the partition key is not supported. - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -The query rebuilds the secondary index `name` in the partition `partition_name`. - -One query can contain several commands separated by commas. - -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. - -Mutations are totally ordered by their creation order and are applied to each part in that order. Mutations are also partially ordered with INSERTs - data that was inserted into the table before the mutation was submitted will be mutated and data that was inserted after that will not be mutated. Note that mutations do not block INSERTs in any way. - -A mutation query returns immediately after the mutation entry is added (in case of replicated tables to ZooKeeper, for nonreplicated tables - to the filesystem). The mutation itself executes asynchronously using the system profile settings. To track the progress of mutations you can use the [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) table. A mutation that was successfully submitted will continue to execute even if ClickHouse servers are restarted. There is no way to roll back the mutation once it is submitted, but if the mutation is stuck for some reason it can be cancelled with the [`KILL MUTATION`](misc.md#kill-mutation) query. - -Entries for finished mutations are not deleted right away (the number of preserved entries is determined by the `finished_mutations_to_keep` storage engine parameter). Older mutation entries are deleted. - -[Original article](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/en/sql_reference/statements/create.md b/docs/en/sql_reference/statements/create.md deleted file mode 100644 index 430bcacbc34..00000000000 --- a/docs/en/sql_reference/statements/create.md +++ /dev/null @@ -1,301 +0,0 @@ ---- -toc_priority: 35 -toc_title: CREATE ---- - -# CREATE Queries {#create-queries} - -## CREATE DATABASE {#query-language-create-database} - -Creates database. - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] -``` - -### Clauses {#clauses} - -- `IF NOT EXISTS` - If the `db_name` database already exists, then ClickHouse doesn't create a new database and: - - Doesn't throw an exception if clause is specified. - - Throws an exception if clause isn't specified. - -- `ON CLUSTER` - ClickHouse creates the `db_name` database on all the servers of a specified cluster. - -- `ENGINE` - - [MySQL](../../engines/database_engines/mysql.md) - Allows you to retrieve data from the remote MySQL server. - By default, ClickHouse uses its own [database engine](../../engines/database_engines/index.md). - -## CREATE TABLE {#create-table-query} - -The `CREATE TABLE` query can have several forms. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], - ... -) ENGINE = engine -``` - -Creates a table named ‘name’ in the ‘db’ database or the current database if ‘db’ is not set, with the structure specified in brackets and the ‘engine’ engine. -The structure of the table is a list of column descriptions. If indexes are supported by the engine, they are indicated as parameters for the table engine. - -A column description is `name type` in the simplest case. Example: `RegionID UInt32`. -Expressions can also be defined for default values (see below). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -Creates a table with the same structure as another table. You can specify a different engine for the table. If the engine is not specified, the same engine will be used as for the `db2.name2` table. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() -``` - -Creates a table with the structure and data returned by a [table function](../table_functions/index.md). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -Creates a table with a structure like the result of the `SELECT` query, with the ‘engine’ engine, and fills it with data from SELECT. - -In all cases, if `IF NOT EXISTS` is specified, the query won’t return an error if the table already exists. In this case, the query won’t do anything. - -There can be other clauses after the `ENGINE` clause in the query. See detailed documentation on how to create tables in the descriptions of [table engines](../../engines/table_engines/index.md#table_engines). - -### Default Values {#create-default-values} - -The column description can specify an expression for a default value, in one of the following ways:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. -Example: `URLDomain String DEFAULT domain(URL)`. - -If an expression for the default value is not defined, the default values will be set to zeros for numbers, empty strings for strings, empty arrays for arrays, and `0000-00-00` for dates or `0000-00-00 00:00:00` for dates with time. NULLs are not supported. - -If the default expression is defined, the column type is optional. If there isn’t an explicitly defined type, the default expression type is used. Example: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ type will be used for the ‘EventDate’ column. - -If the data type and default expression are defined explicitly, this expression will be cast to the specified type using type casting functions. Example: `Hits UInt32 DEFAULT 0` means the same thing as `Hits UInt32 DEFAULT toUInt32(0)`. - -Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don’t contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. - -`DEFAULT expr` - -Normal default value. If the INSERT query doesn’t specify the corresponding column, it will be filled in by computing the corresponding expression. - -`MATERIALIZED expr` - -Materialized expression. Such a column can’t be specified for INSERT, because it is always calculated. -For an INSERT without a list of columns, these columns are not considered. -In addition, this column is not substituted when using an asterisk in a SELECT query. This is to preserve the invariant that the dump obtained using `SELECT *` can be inserted back into the table using INSERT without specifying the list of columns. - -`ALIAS expr` - -Synonym. Such a column isn’t stored in the table at all. -Its values can’t be inserted in a table, and it is not substituted when using an asterisk in a SELECT query. -It can be used in SELECTs if the alias is expanded during query parsing. - -When using the ALTER query to add new columns, old data for these columns is not written. Instead, when reading old data that does not have values for the new columns, expressions are computed on the fly by default. However, if running the expressions requires different columns that are not indicated in the query, these columns will additionally be read, but only for the blocks of data that need it. - -If you add a new column to a table but later change its default expression, the values used for old data will change (for data where values were not stored on the disk). Note that when running background merges, data for columns that are missing in one of the merging parts is written to the merged part. - -It is not possible to set default values for elements in nested data structures. - -### Constraints {#constraints} - -Along with columns descriptions constraints could be defined: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` could by any boolean expression. If constraints are defined for the table, each of them will be checked for every row in `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. - -Adding large amount of constraints can negatively affect performance of big `INSERT` queries. - -### TTL Expression {#ttl-expression} - -Defines storage time for values. Can be specified only for MergeTree-family tables. For the detailed description, see [TTL for columns and tables](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). - -### Column Compression Codecs {#codecs} - -By default, ClickHouse applies the `lz4` compression method. For `MergeTree`-engine family you can change the default compression method in the [compression](../../operations/server_configuration_parameters/settings.md#server-settings-compression) section of a server configuration. You can also define the compression method for each individual column in the `CREATE TABLE` query. - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -If a codec is specified, the default codec doesn’t apply. Codecs can be combined in a pipeline, for example, `CODEC(Delta, ZSTD)`. To select the best codec combination for you project, pass benchmarks similar to described in the Altinity [New Encodings to Improve ClickHouse Efficiency](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) article. - -!!! warning "Warning" - You can’t decompress ClickHouse database files with external utilities like `lz4`. Instead, use the special [clickhouse-compressor](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) utility. - -Compression is supported for the following table engines: - -- [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) family. Supports column compression codecs and selecting the default compression method by [compression](../../operations/server_configuration_parameters/settings.md#server-settings-compression) settings. -- [Log](../../engines/table_engines/log_family/log_family.md) family. Uses the `lz4` compression method by default and supports column compression codecs. -- [Set](../../engines/table_engines/special/set.md). Only supported the default compression. -- [Join](../../engines/table_engines/special/join.md). Only supported the default compression. - -ClickHouse supports common purpose codecs and specialized codecs. - -#### Specialized Codecs {#create-query-specialized-codecs} - -These codecs are designed to make compression more effective by using specific features of data. Some of these codecs don’t compress data themself. Instead, they prepare the data for a common purpose codec, which compresses it better than without this preparation. - -Specialized codecs: - -- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` are used for storing delta values, so `delta_bytes` is the maximum size of raw values. Possible `delta_bytes` values: 1, 2, 4, 8. The default value for `delta_bytes` is `sizeof(type)` if equal to 1, 2, 4, or 8. In all other cases, it’s 1. -- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla: A Fast, Scalable, In-Memory Time Series Database](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla: A Fast, Scalable, In-Memory Time Series Database](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` and `DateTime`). At each step of its algorithm, codec takes a block of 64 values, puts them into 64x64 bit matrix, transposes it, crops the unused bits of values and returns the rest as a sequence. Unused bits are the bits, that don’t differ between maximum and minimum values in the whole data part for which the compression is used. - -`DoubleDelta` and `Gorilla` codecs are used in Gorilla TSDB as the components of its compressing algorithm. Gorilla approach is effective in scenarios when there is a sequence of slowly changing values with their timestamps. Timestamps are effectively compressed by the `DoubleDelta` codec, and values are effectively compressed by the `Gorilla` codec. For example, to get an effectively stored table, you can create it in the following configuration: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### General Purpose Codecs {#create-query-general-purpose-codecs} - -Codecs: - -- `NONE` — No compression. -- `LZ4` — Lossless [data compression algorithm](https://github.com/lz4/lz4) used by default. Applies LZ4 fast compression. -- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` applies the default level. Possible levels: \[1, 12\]. Recommended level range: \[4, 9\]. -- `ZSTD[(level)]` — [ZSTD compression algorithm](https://en.wikipedia.org/wiki/Zstandard) with configurable `level`. Possible levels: \[1, 22\]. Default value: 1. - -High compression levels are useful for asymmetric scenarios, like compress once, decompress repeatedly. Higher levels mean better compression and higher CPU usage. - -## Temporary Tables {#temporary-tables} - -ClickHouse supports temporary tables which have the following characteristics: - -- Temporary tables disappear when the session ends, including if the connection is lost. -- A temporary table uses the Memory engine only. -- The DB can’t be specified for a temporary table. It is created outside of databases. -- Impossible to create a temporary table with distributed DDL query on all cluster servers (by using `ON CLUSTER`): this table exists only in the current session. -- If a temporary table has the same name as another one and a query specifies the table name without specifying the DB, the temporary table will be used. -- For distributed query processing, temporary tables used in a query are passed to remote servers. - -To create a temporary table, use the following syntax: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -In most cases, temporary tables are not created manually, but when using external data for a query, or for distributed `(GLOBAL) IN`. For more information, see the appropriate sections - -It’s possible to use tables with [ENGINE = Memory](../../engines/table_engines/special/memory.md) instead of temporary tables. - -## Distributed DDL Queries (ON CLUSTER Clause) {#distributed-ddl-queries-on-cluster-clause} - -The `CREATE`, `DROP`, `ALTER`, and `RENAME` queries support distributed execution on a cluster. -For example, the following query creates the `all_hits` `Distributed` table on each host in `cluster`: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -In order to run these queries correctly, each host must have the same cluster definition (to simplify syncing configs, you can use substitutions from ZooKeeper). They must also connect to the ZooKeeper servers. -The local version of the query will eventually be implemented on each host in the cluster, even if some hosts are currently not available. The order for executing queries within a single host is guaranteed. - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -Creates a view. There are two types of views: normal and MATERIALIZED. - -Normal views don’t store any data, but just perform a read from another table. In other words, a normal view is nothing more than a saved query. When reading from a view, this saved query is used as a subquery in the FROM clause. - -As an example, assume you’ve created a view: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -and written a query: - -``` sql -SELECT a, b, c FROM view -``` - -This query is fully equivalent to using the subquery: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -Materialized views store data transformed by the corresponding SELECT query. - -When creating a materialized view without `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. - -When creating a materialized view with `TO [db].[table]`, you must not use `POPULATE`. - -A materialized view is arranged as follows: when inserting data to the table specified in SELECT, part of the inserted data is converted by this SELECT query, and the result is inserted in the view. - -If you specify POPULATE, the existing table data is inserted in the view when creating it, as if making a `CREATE TABLE ... AS SELECT ...` . Otherwise, the query contains only the data inserted in the table after creating the view. We don’t recommend using POPULATE, since data inserted in the table during the view creation will not be inserted in it. - -A `SELECT` query can contain `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` is set, data is aggregated during insertion, but only within a single packet of inserted data. The data won’t be further aggregated. The exception is when using an ENGINE that independently performs data aggregation, such as `SummingMergeTree`. - -The execution of `ALTER` queries on materialized views has not been fully developed, so they might be inconvenient. If the materialized view uses the construction `TO [db.]name`, you can `DETACH` the view, run `ALTER` for the target table, and then `ATTACH` the previously detached (`DETACH`) view. - -Views look the same as normal tables. For example, they are listed in the result of the `SHOW TABLES` query. - -There isn’t a separate query for deleting views. To delete a view, use `DROP TABLE`. - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` - -Creates [external dictionary](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) with given [structure](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md), [source](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md), [layout](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) and [lifetime](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md). - -External dictionary structure consists of attributes. Dictionary attributes are specified similarly to table columns. The only required attribute property is its type, all other properties may have default values. - -Depending on dictionary [layout](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) one or more attributes can be specified as dictionary keys. - -For more information, see [External Dictionaries](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) section. - -[Original article](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/en/sql_reference/statements/index.md b/docs/en/sql_reference/statements/index.md deleted file mode 100644 index 507d858c14a..00000000000 --- a/docs/en/sql_reference/statements/index.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -toc_folder_title: Statements -toc_priority: 31 ---- diff --git a/docs/en/sql_reference/statements/insert_into.md b/docs/en/sql_reference/statements/insert_into.md deleted file mode 100644 index 0f26a37e2b9..00000000000 --- a/docs/en/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -toc_priority: 34 -toc_title: INSERT INTO ---- - -## INSERT {#insert} - -Adding data. - -Basic query format: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -The query can specify a list of columns to insert `[(c1, c2, c3)]`. In this case, the rest of the columns are filled with: - -- The values calculated from the `DEFAULT` expressions specified in the table definition. -- Zeros and empty strings, if `DEFAULT` expressions are not defined. - -If [strict\_insert\_defaults=1](../../operations/settings/settings.md), columns that do not have `DEFAULT` defined must be listed in the query. - -Data can be passed to the INSERT in any [format](../../interfaces/formats.md#formats) supported by ClickHouse. The format must be specified explicitly in the query: - -``` sql -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: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -ClickHouse removes all spaces and one line feed (if there is one) before the data. When forming a query, we recommend putting the data on a new line after the query operators (this is important if the data begins with spaces). - -Example: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -You can insert data separately from the query by using the command-line client or the HTTP interface. For more information, see the section “[Interfaces](../../interfaces/index.md#interfaces)”. - -### Constraints {#constraints} - -If table has [constraints](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. - -### Inserting The Results Of `SELECT` {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -Columns are mapped according to their position in the SELECT clause. However, their names in the SELECT expression and the table for INSERT may differ. If necessary, type casting is performed. - -None of the data formats except Values allow setting values to expressions such as `now()`, `1 + 2`, and so on. The Values format allows limited use of expressions, but this is not recommended, because in this case inefficient code is used for their execution. - -Other queries for modifying data parts are not supported: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. -However, you can delete old data using `ALTER TABLE ... DROP PARTITION`. - -`FORMAT` clause must be specified in the end of query if `SELECT` clause contains table function [input()](../table_functions/input.md). - -### Performance Considerations {#performance-considerations} - -`INSERT` sorts the input data by primary key and splits them into partitions by a partition key. If you insert data into several partitions at once, it can significantly reduce the performance of the `INSERT` query. To avoid this: - -- Add data in fairly large batches, such as 100,000 rows at a time. -- Group data by a partition key before uploading it to ClickHouse. - -Performance will not decrease if: - -- Data is added in real time. -- You upload data that is usually sorted by time. - -[Original article](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/en/sql_reference/statements/misc.md b/docs/en/sql_reference/statements/misc.md deleted file mode 100644 index be2c07e86b8..00000000000 --- a/docs/en/sql_reference/statements/misc.md +++ /dev/null @@ -1,250 +0,0 @@ ---- -toc_priority: 39 -toc_title: Other ---- - -# Miscellaneous Queries {#miscellaneous-queries} - -## ATTACH {#attach} - -This query is exactly the same as `CREATE`, but - -- Instead of the word `CREATE` it uses the word `ATTACH`. -- The query does not create data on the disk, but assumes that data is already in the appropriate places, and just adds information about the table to the server. - After executing an ATTACH query, the server will know about the existence of the table. - -If the table was previously detached (`DETACH`), meaning that its structure is known, you can use shorthand without defining the structure. - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -This query is used when starting the server. The server stores table metadata as files with `ATTACH` queries, which it simply runs at launch (with the exception of system tables, which are explicitly created on the server). - -## CHECK TABLE {#check-table} - -Checks if the data in the table is corrupted. - -``` sql -CHECK TABLE [db.]name -``` - -The `CHECK TABLE` query compares actual file sizes with the expected values which are stored on the server. If the file sizes do not match the stored values, it means the data is corrupted. This can be caused, for example, by a system crash during query execution. - -The query response contains the `result` column with a single row. The row has a value of -[Boolean](../../sql_reference/data_types/boolean.md) type: - -- 0 - The data in the table is corrupted. -- 1 - The data maintains integrity. - -The `CHECK TABLE` query supports the following table engines: - -- [Log](../../engines/table_engines/log_family/log.md) -- [TinyLog](../../engines/table_engines/log_family/tinylog.md) -- [StripeLog](../../engines/table_engines/log_family/stripelog.md) -- [MergeTree family](../../engines/table_engines/mergetree_family/mergetree.md) - -Performed over the tables with another table engines causes an exception. - -Engines from the `*Log` family don’t provide automatic data recovery on failure. Use the `CHECK TABLE` query to track data loss in a timely manner. - -For `MergeTree` family engines, the `CHECK TABLE` query shows a check status for every individual data part of a table on the local server. - -**If the data is corrupted** - -If the table is corrupted, you can copy the non-corrupted data to another table. To do this: - -1. Create a new table with the same structure as damaged table. To do this execute the query `CREATE TABLE AS `. -2. Set the [max\_threads](../../operations/settings/settings.md#settings-max_threads) value to 1 to process the next query in a single thread. To do this run the query `SET max_threads = 1`. -3. Execute the query `INSERT INTO SELECT * FROM `. This request copies the non-corrupted data from the damaged table to another table. Only the data before the corrupted part will be copied. -4. Restart the `clickhouse-client` to reset the `max_threads` value. - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Returns the following `String` type columns: - -- `name` — Column name. -- `type`— Column type. -- `default_type` — Clause that is used in [default expression](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` or `ALIAS`). Column contains an empty string, if the default expression isn’t specified. -- `default_expression` — Value specified in the `DEFAULT` clause. -- `comment_expression` — Comment text. - -Nested data structures are output in “expanded” format. Each column is shown separately, with the name after a dot. - -## DETACH {#detach} - -Deletes information about the ‘name’ table from the server. The server stops knowing about the table’s existence. - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -This does not delete the table’s data or metadata. On the next server launch, the server will read the metadata and find out about the table again. -Similarly, a “detached” table can be re-attached using the `ATTACH` query (with the exception of system tables, which do not have metadata stored for them). - -There is no `DETACH DATABASE` query. - -## DROP {#drop} - -This query has two types: `DROP DATABASE` and `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -Deletes all tables inside the ‘db’ database, then deletes the ‘db’ database itself. -If `IF EXISTS` is specified, it doesn’t return an error if the database doesn’t exist. - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Deletes the table. -If `IF EXISTS` is specified, it doesn’t return an error if the table doesn’t exist or the database doesn’t exist. - - DROP DICTIONARY [IF EXISTS] [db.]name - -Delets the dictionary. -If `IF EXISTS` is specified, it doesn’t return an error if the table doesn’t exist or the database doesn’t exist. - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -Returns a single `UInt8`-type column, which contains the single value `0` if the table or database doesn’t exist, or `1` if the table exists in the specified database. - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -Attempts to forcibly terminate the currently running queries. -The queries to terminate are selected from the system.processes table using the criteria defined in the `WHERE` clause of the `KILL` query. - -Examples: - -``` sql --- Forcibly terminates all queries with the specified query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Synchronously terminates all queries run by 'username': -KILL QUERY WHERE user='username' SYNC -``` - -Read-only users can only stop their own queries. - -By default, the asynchronous version of queries is used (`ASYNC`), which doesn’t wait for confirmation that queries have stopped. - -The synchronous version (`SYNC`) waits for all queries to stop and displays information about each process as it stops. -The response contains the `kill_status` column, which can take the following values: - -1. ‘finished’ – The query was terminated successfully. -2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. -3. The other values ​​explain why the query can’t be stopped. - -A test query (`TEST`) only checks the user’s rights and displays a list of queries to stop. - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -Tries to cancel and remove [mutations](alter.md#alter-mutations) that are currently executing. Mutations to cancel are selected from the [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) table using the filter specified by the `WHERE` clause of the `KILL` query. - -A test query (`TEST`) only checks the user’s rights and displays a list of queries to stop. - -Examples: - -``` sql --- Cancel and remove all mutations of the single table: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Cancel the specific mutation: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). - -Changes already made by the mutation are not rolled back. - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -This query tries to initialize an unscheduled merge of data parts for tables with a table engine from the [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) family. - -The `OPTMIZE` query is also supported for the [MaterializedView](../../engines/table_engines/special/materializedview.md) and the [Buffer](../../engines/table_engines/special/buffer.md) engines. Other table engines aren’t supported. - -When `OPTIMIZE` is used with the [ReplicatedMergeTree](../../engines/table_engines/mergetree_family/replication.md) family of table engines, ClickHouse creates a task for merging and waits for execution on all nodes (if the `replication_alter_partitions_sync` setting is enabled). - -- If `OPTIMIZE` doesn’t perform a merge for any reason, it doesn’t notify the client. To enable notifications, use the [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) setting. -- If you specify a `PARTITION`, only the specified partition is optimized. [How to set partition expression](alter.md#alter-how-to-specify-part-expr). -- If you specify `FINAL`, optimization is performed even when all the data is already in one part. -- If you specify `DEDUPLICATE`, then completely identical rows will be deduplicated (all columns are compared), it makes sense only for the MergeTree engine. - -!!! warning "Warning" - `OPTIMIZE` can’t fix the “Too many parts” error. - -## RENAME {#misc_operations-rename} - -Renames one or more tables. - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -All tables are renamed under global locking. Renaming tables is a light operation. If you indicated another database after TO, the table will be moved to this database. However, the directories with databases must reside in the same file system (otherwise, an error is returned). - -## SET {#query-set} - -``` sql -SET param = value -``` - -Assigns `value` to the `param` [setting](../../operations/settings/index.md) for the current session. You cannot change [server settings](../../operations/server_configuration_parameters/index.md) this way. - -You can also set all the values from the specified settings profile in a single query. - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -For more information, see [Settings](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Removes all data from a table. When the clause `IF EXISTS` is omitted, the query returns an error if the table does not exist. - -The `TRUNCATE` query is not supported for [View](../../engines/table_engines/special/view.md), [File](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) and [Null](../../engines/table_engines/special/null.md) table engines. - -## USE {#use} - -``` sql -USE db -``` - -Lets you set the current database for the session. -The current database is used for searching for tables if the database is not explicitly defined in the query with a dot before the table name. -This query can’t be made when using the HTTP protocol, since there is no concept of a session. - -[Original article](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/en/sql_reference/statements/select.md b/docs/en/sql_reference/statements/select.md deleted file mode 100644 index 9232011a8e2..00000000000 --- a/docs/en/sql_reference/statements/select.md +++ /dev/null @@ -1,1378 +0,0 @@ ---- -toc_priority: 33 -toc_title: SELECT ---- - -# SELECT Queries Syntax {#select-queries-syntax} - -`SELECT` performs data retrieval. - -``` sql -[WITH expr_list|(subquery)] -SELECT [DISTINCT] expr_list -[FROM [db.]table | (subquery) | table_function] [FINAL] -[SAMPLE sample_coeff] -[ARRAY JOIN ...] -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list -[PREWHERE expr] -[WHERE expr] -[GROUP BY expr_list] [WITH TOTALS] -[HAVING expr] -[ORDER BY expr_list] -[LIMIT [offset_value, ]n BY columns] -[LIMIT [n, ]m] -[UNION ALL ...] -[INTO OUTFILE filename] -[FORMAT format] -``` - -All the clauses are optional, except for the required list of expressions immediately after SELECT. -The clauses below are described in almost the same order as in the query execution conveyor. - -If the query omits the `DISTINCT`, `GROUP BY` and `ORDER BY` clauses and the `IN` and `JOIN` subqueries, the query will be completely stream processed, using O(1) amount of RAM. -Otherwise, the query might consume a lot of RAM if the appropriate restrictions are not specified: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. For more information, see the section “Settings”. It is possible to use external sorting (saving temporary tables to a disk) and external aggregation. `The system does not have "merge join"`. - -### WITH Clause {#with-clause} - -This section provides support for Common Table Expressions ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), with some limitations: -1. Recursive queries are not supported -2. When subquery is used inside WITH section, it’s result should be scalar with exactly one row -3. Expression’s results are not available in subqueries -Results of WITH clause expressions can be used inside SELECT clause. - -Example 1: Using constant expression as “variable” - -``` sql -WITH '2019-08-01 15:23:00' as ts_upper_bound -SELECT * -FROM hits -WHERE - EventDate = toDate(ts_upper_bound) AND - EventTime <= ts_upper_bound -``` - -Example 2: Evicting sum(bytes) expression result from SELECT clause column list - -``` sql -WITH sum(bytes) as s -SELECT - formatReadableSize(s), - table -FROM system.parts -GROUP BY table -ORDER BY s -``` - -Example 3: Using results of scalar subquery - -``` sql -/* this example would return TOP 10 of most huge tables */ -WITH - ( - SELECT sum(bytes) - FROM system.parts - WHERE active - ) AS total_disk_usage -SELECT - (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, - table -FROM system.parts -GROUP BY table -ORDER BY table_disk_usage DESC -LIMIT 10 -``` - -Example 4: Re-using expression in subquery -As a workaround for current limitation for expression usage in subqueries, you may duplicate it. - -``` sql -WITH ['hello'] AS hello -SELECT - hello, - * -FROM -( - WITH ['hello'] AS hello - SELECT hello -) -``` - -``` text -┌─hello─────┬─hello─────┐ -│ ['hello'] │ ['hello'] │ -└───────────┴───────────┘ -``` - -### FROM Clause {#select-from} - -If the FROM clause is omitted, data will be read from the `system.one` table. -The `system.one` table contains exactly one row (this table fulfills the same purpose as the DUAL table found in other DBMSs). - -The `FROM` clause specifies the source to read data from: - -- Table -- Subquery -- [Table function](../table_functions/index.md) - -`ARRAY JOIN` and the regular `JOIN` may also be included (see below). - -Instead of a table, the `SELECT` subquery may be specified in parenthesis. -In contrast to standard SQL, a synonym does not need to be specified after a subquery. - -To execute a query, all the columns listed in the query are extracted from the appropriate table. Any columns not needed for the external query are thrown out of the subqueries. -If a query does not list any columns (for example, `SELECT count() FROM t`), some column is extracted from the table anyway (the smallest one is preferred), in order to calculate the number of rows. - -#### FINAL Modifier {#select-from-final} - -Applicable when selecting data from tables from the [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-engine family other than `GraphiteMergeTree`. When `FINAL` is specified, ClickHouse fully merges the data before returning the result and thus performs all data transformations that happen during merges for the given table engine. - -Also supported for: -- [Replicated](../../engines/table_engines/mergetree_family/replication.md) versions of `MergeTree` engines. -- [View](../../engines/table_engines/special/view.md), [Buffer](../../engines/table_engines/special/buffer.md), [Distributed](../../engines/table_engines/special/distributed.md), and [MaterializedView](../../engines/table_engines/special/materializedview.md) engines that operate over other engines, provided they were created over `MergeTree`-engine tables. - -Queries that use `FINAL` are executed not as fast as similar queries that don’t, because: - -- Query is executed in a single thread and data is merged during query execution. -- Queries with `FINAL` read primary key columns in addition to the columns specified in the query. - -In most cases, avoid using `FINAL`. - -### SAMPLE Clause {#select-sample-clause} - -The `SAMPLE` clause allows for approximated query processing. - -When data sampling is enabled, the query is not performed on all the data, but only on a certain fraction of data (sample). For example, if you need to calculate statistics for all the visits, it is enough to execute the query on the 1/10 fraction of all the visits and then multiply the result by 10. - -Approximated query processing can be useful in the following cases: - -- When you have strict timing requirements (like \<100ms) but you can’t justify the cost of additional hardware resources to meet them. -- When your raw data is not accurate, so approximation doesn’t noticeably degrade the quality. -- Business requirements target approximate results (for cost-effectiveness, or in order to market exact results to premium users). - -!!! note "Note" - You can only use sampling with the tables in the [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) family, and only if the sampling expression was specified during table creation (see [MergeTree engine](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table)). - -The features of data sampling are listed below: - -- Data sampling is a deterministic mechanism. The result of the same `SELECT .. SAMPLE` query is always the same. -- Sampling works consistently for different tables. For tables with a single sampling key, a sample with the same coefficient always selects the same subset of possible data. For example, a sample of user IDs takes rows with the same subset of all the possible user IDs from different tables. This means that you can use the sample in subqueries in the [IN](#select-in-operators) clause. Also, you can join samples using the [JOIN](#select-join) clause. -- Sampling allows reading less data from a disk. Note that you must specify the sampling key correctly. For more information, see [Creating a MergeTree Table](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -For the `SAMPLE` clause the following syntax is supported: - -| SAMPLE Clause Syntax | Description | -|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| -| `SAMPLE k` | Here `k` is the number from 0 to 1.
The query is executed on `k` fraction of data. For example, `SAMPLE 0.1` runs the query on 10% of data. [Read more](#select-sample-k) | -| `SAMPLE n` | Here `n` is a sufficiently large integer.
The query is executed on a sample of at least `n` rows (but not significantly more than this). For example, `SAMPLE 10000000` runs the query on a minimum of 10,000,000 rows. [Read more](#select-sample-n) | -| `SAMPLE k OFFSET m` | Here `k` and `m` are the numbers from 0 to 1.
The query is executed on a sample of `k` fraction of the data. The data used for the sample is offset by `m` fraction. [Read more](#select-sample-offset) | - -#### SAMPLE K {#select-sample-k} - -Here `k` is the number from 0 to 1 (both fractional and decimal notations are supported). For example, `SAMPLE 1/2` or `SAMPLE 0.5`. - -In a `SAMPLE k` clause, the sample is taken from the `k` fraction of data. The example is shown below: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -In this example, the query is executed on a sample from 0.1 (10%) of data. Values of aggregate functions are not corrected automatically, so to get an approximate result, the value `count()` is manually multiplied by 10. - -#### SAMPLE N {#select-sample-n} - -Here `n` is a sufficiently large integer. For example, `SAMPLE 10000000`. - -In this case, the query is executed on a sample of at least `n` rows (but not significantly more than this). For example, `SAMPLE 10000000` runs the query on a minimum of 10,000,000 rows. - -Since the minimum unit for data reading is one granule (its size is set by the `index_granularity` setting), it makes sense to set a sample that is much larger than the size of the granule. - -When using the `SAMPLE n` clause, you don’t know which relative percent of data was processed. So you don’t know the coefficient the aggregate functions should be multiplied by. Use the `_sample_factor` virtual column to get the approximate result. - -The `_sample_factor` column contains relative coefficients that are calculated dynamically. This column is created automatically when you [create](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table) a table with the specified sampling key. The usage examples of the `_sample_factor` column are shown below. - -Let’s consider the table `visits`, which contains the statistics about site visits. The first example shows how to calculate the number of page views: - -``` sql -SELECT sum(PageViews * _sample_factor) -FROM visits -SAMPLE 10000000 -``` - -The next example shows how to calculate the total number of visits: - -``` sql -SELECT sum(_sample_factor) -FROM visits -SAMPLE 10000000 -``` - -The example below shows how to calculate the average session duration. Note that you don’t need to use the relative coefficient to calculate the average values. - -``` sql -SELECT avg(Duration) -FROM visits -SAMPLE 10000000 -``` - -#### SAMPLE K OFFSET M {#select-sample-offset} - -Here `k` and `m` are numbers from 0 to 1. Examples are shown below. - -**Example 1** - -``` sql -SAMPLE 1/10 -``` - -In this example, the sample is 1/10th of all data: - -`[++------------]` - -**Example 2** - -``` sql -SAMPLE 1/10 OFFSET 1/2 -``` - -Here, a sample of 10% is taken from the second half of the data. - -`[------++------]` - -### ARRAY JOIN Clause {#select-array-join-clause} - -Allows executing `JOIN` with an array or nested data structure. The intent is similar to the [arrayJoin](../functions/array_join.md#functions_arrayjoin) function, but its functionality is broader. - -``` sql -SELECT -FROM -[LEFT] ARRAY JOIN -[WHERE|PREWHERE ] -... -``` - -You can specify only a single `ARRAY JOIN` clause in a query. - -The query execution order is optimized when running `ARRAY JOIN`. Although `ARRAY JOIN` must always be specified before the `WHERE/PREWHERE` clause, it can be performed either before `WHERE/PREWHERE` (if the result is needed in this clause), or after completing it (to reduce the volume of calculations). The processing order is controlled by the query optimizer. - -Supported types of `ARRAY JOIN` are listed below: - -- `ARRAY JOIN` - In this case, empty arrays are not included in the result of `JOIN`. -- `LEFT ARRAY JOIN` - The result of `JOIN` contains rows with empty arrays. The value for an empty array is set to the default value for the array element type (usually 0, empty string or NULL). - -The examples below demonstrate the usage of the `ARRAY JOIN` and `LEFT ARRAY JOIN` clauses. Let’s create a table with an [Array](../../sql_reference/data_types/array.md) type column and insert values into it: - -``` sql -CREATE TABLE arrays_test -( - s String, - arr Array(UInt8) -) ENGINE = Memory; - -INSERT INTO arrays_test -VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); -``` - -``` text -┌─s───────────┬─arr─────┐ -│ Hello │ [1,2] │ -│ World │ [3,4,5] │ -│ Goodbye │ [] │ -└─────────────┴─────────┘ -``` - -The example below uses the `ARRAY JOIN` clause: - -``` sql -SELECT s, arr -FROM arrays_test -ARRAY JOIN arr; -``` - -``` text -┌─s─────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -└───────┴─────┘ -``` - -The next example uses the `LEFT ARRAY JOIN` clause: - -``` sql -SELECT s, arr -FROM arrays_test -LEFT ARRAY JOIN arr; -``` - -``` text -┌─s───────────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -│ Goodbye │ 0 │ -└─────────────┴─────┘ -``` - -#### Using Aliases {#using-aliases} - -An alias can be specified for an array in the `ARRAY JOIN` clause. In this case, an array item can be accessed by this alias, but the array itself is accessed by the original name. Example: - -``` sql -SELECT s, arr, a -FROM arrays_test -ARRAY JOIN arr AS a; -``` - -``` text -┌─s─────┬─arr─────┬─a─┐ -│ Hello │ [1,2] │ 1 │ -│ Hello │ [1,2] │ 2 │ -│ World │ [3,4,5] │ 3 │ -│ World │ [3,4,5] │ 4 │ -│ World │ [3,4,5] │ 5 │ -└───────┴─────────┴───┘ -``` - -Using aliases, you can perform `ARRAY JOIN` with an external array. For example: - -``` sql -SELECT s, arr_external -FROM arrays_test -ARRAY JOIN [1, 2, 3] AS arr_external; -``` - -``` text -┌─s───────────┬─arr_external─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ Hello │ 3 │ -│ World │ 1 │ -│ World │ 2 │ -│ World │ 3 │ -│ Goodbye │ 1 │ -│ Goodbye │ 2 │ -│ Goodbye │ 3 │ -└─────────────┴──────────────┘ -``` - -Multiple arrays can be comma-separated in the `ARRAY JOIN` clause. In this case, `JOIN` is performed with them simultaneously (the direct sum, not the cartesian product). Note that all the arrays must have the same size. Example: - -``` sql -SELECT s, arr, a, num, mapped -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ -│ Hello │ [1,2] │ 1 │ 1 │ 2 │ -│ Hello │ [1,2] │ 2 │ 2 │ 3 │ -│ World │ [3,4,5] │ 3 │ 1 │ 4 │ -│ World │ [3,4,5] │ 4 │ 2 │ 5 │ -│ World │ [3,4,5] │ 5 │ 3 │ 6 │ -└───────┴─────────┴───┴─────┴────────┘ -``` - -The example below uses the [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) function: - -``` sql -SELECT s, arr, a, num, arrayEnumerate(arr) -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ -│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ -│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ -│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ -│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ -│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ -└───────┴─────────┴───┴─────┴─────────────────────┘ -``` - -#### ARRAY JOIN With Nested Data Structure {#array-join-with-nested-data-structure} - -`ARRAY`JOIN\`\` also works with [nested data structures](../../sql_reference/data_types/nested_data_structures/nested.md). Example: - -``` sql -CREATE TABLE nested_test -( - s String, - nest Nested( - x UInt8, - y UInt32) -) ENGINE = Memory; - -INSERT INTO nested_test -VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); -``` - -``` text -┌─s───────┬─nest.x──┬─nest.y─────┐ -│ Hello │ [1,2] │ [10,20] │ -│ World │ [3,4,5] │ [30,40,50] │ -│ Goodbye │ [] │ [] │ -└─────────┴─────────┴────────────┘ -``` - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -When specifying names of nested data structures in `ARRAY JOIN`, the meaning is the same as `ARRAY JOIN` with all the array elements that it consists of. Examples are listed below: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`, `nest.y`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -This variation also makes sense: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─────┐ -│ Hello │ 1 │ [10,20] │ -│ Hello │ 2 │ [10,20] │ -│ World │ 3 │ [30,40,50] │ -│ World │ 4 │ [30,40,50] │ -│ World │ 5 │ [30,40,50] │ -└───────┴────────┴────────────┘ -``` - -An alias may be used for a nested data structure, in order to select either the `JOIN` result or the source array. Example: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest AS n; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ -└───────┴─────┴─────┴─────────┴────────────┘ -``` - -Example of using the [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) function: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num -FROM nested_test -ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ -└───────┴─────┴─────┴─────────┴────────────┴─────┘ -``` - -### JOIN Clause {#select-join} - -Joins the data in the normal [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) sense. - -!!! info "Note" - Not related to [ARRAY JOIN](#select-array-join-clause). - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN -(ON )|(USING ) ... -``` - -The table names can be specified instead of `` and ``. This is equivalent to the `SELECT * FROM table` subquery, except in a special case when the table has the [Join](../../engines/table_engines/special/join.md) engine – an array prepared for joining. - -#### Supported Types Of `JOIN` {#select-join-types} - -- `INNER JOIN` (or `JOIN`) -- `LEFT JOIN` (or `LEFT OUTER JOIN`) -- `RIGHT JOIN` (or `RIGHT OUTER JOIN`) -- `FULL JOIN` (or `FULL OUTER JOIN`) -- `CROSS JOIN` (or `,` ) - -See the standard [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) description. - -#### Multiple JOIN {#multiple-join} - -Performing queries, ClickHouse rewrites multi-table joins into the sequence of two-table joins. For example, if there are four tables for join ClickHouse joins the first and the second, then joins the result with the third table, and at the last step, it joins the fourth one. - -If a query contains the `WHERE` clause, ClickHouse tries to pushdown filters from this clause through the intermediate join. If it cannot apply the filter to each intermediate join, ClickHouse applies the filters after all joins are completed. - -We recommend the `JOIN ON` or `JOIN USING` syntax for creating queries. For example: - -``` sql -SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a -``` - -You can use comma-separated lists of tables in the `FROM` clause. For example: - -``` sql -SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a -``` - -Don’t mix these syntaxes. - -ClickHouse doesn’t directly support syntax with commas, so we don’t recommend using them. The algorithm tries to rewrite the query in terms of `CROSS JOIN` and `INNER JOIN` clauses and then proceeds to query processing. When rewriting the query, ClickHouse tries to optimize performance and memory consumption. By default, ClickHouse treats commas as an `INNER JOIN` clause and converts `INNER JOIN` to `CROSS JOIN` when the algorithm cannot guarantee that `INNER JOIN` returns the required data. - -#### Strictness {#select-join-strictness} - -- `ALL` — If the right table has several matching rows, ClickHouse creates a [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) from matching rows. This is the standard `JOIN` behavior in SQL. -- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` and `ALL` keywords are the same. -- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` usage is described below. - -**ASOF JOIN Usage** - -`ASOF JOIN` is useful when you need to join records that have no exact match. - -Tables for `ASOF JOIN` must have an ordered sequence column. This column cannot be alone in a table, and should be one of the data types: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`, and `DateTime`. - -Syntax `ASOF JOIN ... ON`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF LEFT JOIN table_2 -ON equi_cond AND closest_match_cond -``` - -You can use any number of equality conditions and exactly one closest match condition. For example, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. - -Conditions supported for the closest match: `>`, `>=`, `<`, `<=`. - -Syntax `ASOF JOIN ... USING`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF JOIN table_2 -USING (equi_column1, ... equi_columnN, asof_column) -``` - -`ASOF JOIN` uses `equi_columnX` for joining on equality and `asof_column` for joining on the closest match with the `table_1.asof_column >= table_2.asof_column` condition. The `asof_column` column always the last one in the `USING` clause. - -For example, consider the following tables: - - table_1 table_2 - event | ev_time | user_id event | ev_time | user_id - ----------|---------|---------- ----------|---------|---------- - ... ... - event_1_1 | 12:00 | 42 event_2_1 | 11:59 | 42 - ... event_2_2 | 12:30 | 42 - event_1_2 | 13:00 | 42 event_2_3 | 13:00 | 42 - ... ... - - -`ASOF JOIN` can take the timestamp of a user event from `table_1` and find an event in `table_2` where the timestamp is closest to the timestamp of the event from `table_1` corresponding to the closest match condition. Equal timestamp values are the closest if available. Here, the `user_id` column can be used for joining on equality and the `ev_time` column can be used for joining on the closest match. In our example, `event_1_1` can be joined with `event_2_1` and `event_1_2` can be joined with `event_2_3`, but `event_2_2` can’t be joined. - -!!! note "Note" - `ASOF` join is **not** supported in the [Join](../../engines/table_engines/special/join.md) table engine. - -To set the default strictness value, use the session configuration parameter [join\_default\_strictness](../../operations/settings/settings.md#settings-join_default_strictness). - -#### GLOBAL JOIN {#global-join} - -When using a normal `JOIN`, the query is sent to remote servers. Subqueries are run on each of them in order to make the right table, and the join is performed with this table. In other words, the right table is formed on each server separately. - -When using `GLOBAL ... JOIN`, first the requestor server runs a subquery to calculate the right table. This temporary table is passed to each remote server, and queries are run on them using the temporary data that was transmitted. - -Be careful when using `GLOBAL`. For more information, see the section [Distributed subqueries](#select-distributed-subqueries). - -#### Usage Recommendations {#usage-recommendations} - -When running a `JOIN`, there is no optimization of the order of execution in relation to other stages of the query. The join (a search in the right table) is run before filtering in `WHERE` and before aggregation. In order to explicitly set the processing order, we recommend running a `JOIN` subquery with a subquery. - -Example: - -``` sql -SELECT - CounterID, - hits, - visits -FROM -( - SELECT - CounterID, - count() AS hits - FROM test.hits - GROUP BY CounterID -) ANY LEFT JOIN -( - SELECT - CounterID, - sum(Sign) AS visits - FROM test.visits - GROUP BY CounterID -) USING CounterID -ORDER BY hits DESC -LIMIT 10 -``` - -``` text -┌─CounterID─┬───hits─┬─visits─┐ -│ 1143050 │ 523264 │ 13665 │ -│ 731962 │ 475698 │ 102716 │ -│ 722545 │ 337212 │ 108187 │ -│ 722889 │ 252197 │ 10547 │ -│ 2237260 │ 196036 │ 9522 │ -│ 23057320 │ 147211 │ 7689 │ -│ 722818 │ 90109 │ 17847 │ -│ 48221 │ 85379 │ 4652 │ -│ 19762435 │ 77807 │ 7026 │ -│ 722884 │ 77492 │ 11056 │ -└───────────┴────────┴────────┘ -``` - -Subqueries don’t allow you to set names or use them for referencing a column from a specific subquery. -The columns specified in `USING` must have the same names in both subqueries, and the other columns must be named differently. You can use aliases to change the names of columns in subqueries (the example uses the aliases `hits` and `visits`). - -The `USING` clause specifies one or more columns to join, which establishes the equality of these columns. The list of columns is set without brackets. More complex join conditions are not supported. - -The right table (the subquery result) resides in RAM. If there isn’t enough memory, you can’t run a `JOIN`. - -Each time a query is run with the same `JOIN`, the subquery is run again because the result is not cached. To avoid this, use the special [Join](../../engines/table_engines/special/join.md) table engine, which is a prepared array for joining that is always in RAM. - -In some cases, it is more efficient to use `IN` instead of `JOIN`. -Among the various types of `JOIN`, the most efficient is `ANY LEFT JOIN`, then `ANY INNER JOIN`. The least efficient are `ALL LEFT JOIN` and `ALL INNER JOIN`. - -If you need a `JOIN` for joining with dimension tables (these are relatively small tables that contain dimension properties, such as names for advertising campaigns), a `JOIN` might not be very convenient due to the fact that the right table is re-accessed for every query. For such cases, there is an “external dictionaries” feature that you should use instead of `JOIN`. For more information, see the section [External dictionaries](../dictionaries/external_dictionaries/external_dicts.md). - -**Memory Limitations** - -ClickHouse uses the [hash join](https://en.wikipedia.org/wiki/Hash_join) algorithm. ClickHouse takes the `` and creates a hash table for it in RAM. If you need to restrict join operation memory consumption use the following settings: - -- [max\_rows\_in\_join](../../operations/settings/query_complexity.md#settings-max_rows_in_join) — Limits number of rows in the hash table. -- [max\_bytes\_in\_join](../../operations/settings/query_complexity.md#settings-max_bytes_in_join) — Limits size of the hash table. - -When any of these limits is reached, ClickHouse acts as the [join\_overflow\_mode](../../operations/settings/query_complexity.md#settings-join_overflow_mode) setting instructs. - -#### Processing of Empty or NULL Cells {#processing-of-empty-or-null-cells} - -While joining tables, the empty cells may appear. The setting [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) define how ClickHouse fills these cells. - -If the `JOIN` keys are [Nullable](../data_types/nullable.md) fields, the rows where at least one of the keys has the value [NULL](../syntax.md#null-literal) are not joined. - -#### Syntax Limitations {#syntax-limitations} - -For multiple `JOIN` clauses in a single `SELECT` query: - -- Taking all the columns via `*` is available only if tables are joined, not subqueries. -- The `PREWHERE` clause is not available. - -For `ON`, `WHERE`, and `GROUP BY` clauses: - -- Arbitrary expressions cannot be used in `ON`, `WHERE`, and `GROUP BY` clauses, but you can define an expression in a `SELECT` clause and then use it in these clauses via an alias. - -### WHERE Clause {#select-where} - -If there is a WHERE clause, it must contain an expression with the UInt8 type. This is usually an expression with comparison and logical operators. -This expression will be used for filtering data before all other transformations. - -If indexes are supported by the database table engine, the expression is evaluated on the ability to use indexes. - -### PREWHERE Clause {#prewhere-clause} - -This clause has the same meaning as the WHERE clause. The difference is in which data is read from the table. -When using PREWHERE, first only the columns necessary for executing PREWHERE are read. Then the other columns are read that are needed for running the query, but only those blocks where the PREWHERE expression is true. - -It makes sense to use PREWHERE if there are filtration conditions that are used by a minority of the columns in the query, but that provide strong data filtration. This reduces the volume of data to read. - -For example, it is useful to write PREWHERE for queries that extract a large number of columns, but that only have filtration for a few columns. - -PREWHERE is only supported by tables from the `*MergeTree` family. - -A query may simultaneously specify PREWHERE and WHERE. In this case, PREWHERE precedes WHERE. - -If the ‘optimize\_move\_to\_prewhere’ setting is set to 1 and PREWHERE is omitted, the system uses heuristics to automatically move parts of expressions from WHERE to PREWHERE. - -### GROUP BY Clause {#select-group-by-clause} - -This is one of the most important parts of a column-oriented DBMS. - -If there is a GROUP BY clause, it must contain a list of expressions. Each expression will be referred to here as a “key”. -All the expressions in the SELECT, HAVING, and ORDER BY clauses must be calculated from keys or from aggregate functions. In other words, each column selected from the table must be used either in keys or inside aggregate functions. - -If a query contains only table columns inside aggregate functions, the GROUP BY clause can be omitted, and aggregation by an empty set of keys is assumed. - -Example: - -``` sql -SELECT - count(), - median(FetchTiming > 60 ? 60 : FetchTiming), - count() - sum(Refresh) -FROM hits -``` - -However, in contrast to standard SQL, if the table doesn’t have any rows (either there aren’t any at all, or there aren’t any after using WHERE to filter), an empty result is returned, and not the result from one of the rows containing the initial values of aggregate functions. - -As opposed to MySQL (and conforming to standard SQL), you can’t get some value of some column that is not in a key or aggregate function (except constant expressions). To work around this, you can use the ‘any’ aggregate function (get the first encountered value) or ‘min/max’. - -Example: - -``` sql -SELECT - domainWithoutWWW(URL) AS domain, - count(), - any(Title) AS title -- getting the first occurred page header for each domain. -FROM hits -GROUP BY domain -``` - -For every different key value encountered, GROUP BY calculates a set of aggregate function values. - -GROUP BY is not supported for array columns. - -A constant can’t be specified as arguments for aggregate functions. Example: sum(1). Instead of this, you can get rid of the constant. Example: `count()`. - -#### NULL processing {#null-processing} - -For grouping, ClickHouse interprets [NULL](../syntax.md) as a value, and `NULL=NULL`. - -Here’s an example to show what this means. - -Assume you have this table: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -The query `SELECT sum(x), y FROM t_null_big GROUP BY y` results in: - -``` text -┌─sum(x)─┬────y─┐ -│ 4 │ 2 │ -│ 3 │ 3 │ -│ 5 │ ᴺᵁᴸᴸ │ -└────────┴──────┘ -``` - -You can see that `GROUP BY` for `y = NULL` summed up `x`, as if `NULL` is this value. - -If you pass several keys to `GROUP BY`, the result will give you all the combinations of the selection, as if `NULL` were a specific value. - -#### WITH TOTALS Modifier {#with-totals-modifier} - -If the WITH TOTALS modifier is specified, another row will be calculated. This row will have key columns containing default values (zeros or empty lines), and columns of aggregate functions with the values calculated across all the rows (the “total” values). - -This extra row is output in JSON\*, TabSeparated\*, and Pretty\* formats, separately from the other rows. In the other formats, this row is not output. - -In JSON\* formats, this row is output as a separate ‘totals’ field. In TabSeparated\* formats, the row comes after the main result, preceded by an empty row (after the other data). In Pretty\* formats, the row is output as a separate table after the main result. - -`WITH TOTALS` can be run in different ways when HAVING is present. The behavior depends on the ‘totals\_mode’ setting. -By default, `totals_mode = 'before_having'`. In this case, ‘totals’ is calculated across all rows, including the ones that don’t pass through HAVING and ‘max\_rows\_to\_group\_by’. - -The other alternatives include only the rows that pass through HAVING in ‘totals’, and behave differently with the setting `max_rows_to_group_by` and `group_by_overflow_mode = 'any'`. - -`after_having_exclusive` – Don’t include rows that didn’t pass through `max_rows_to_group_by`. In other words, ‘totals’ will have less than or the same number of rows as it would if `max_rows_to_group_by` were omitted. - -`after_having_inclusive` – Include all the rows that didn’t pass through ‘max\_rows\_to\_group\_by’ in ‘totals’. In other words, ‘totals’ will have more than or the same number of rows as it would if `max_rows_to_group_by` were omitted. - -`after_having_auto` – Count the number of rows that passed through HAVING. If it is more than a certain amount (by default, 50%), include all the rows that didn’t pass through ‘max\_rows\_to\_group\_by’ in ‘totals’. Otherwise, do not include them. - -`totals_auto_threshold` – By default, 0.5. The coefficient for `after_having_auto`. - -If `max_rows_to_group_by` and `group_by_overflow_mode = 'any'` are not used, all variations of `after_having` are the same, and you can use any of them (for example, `after_having_auto`). - -You can use WITH TOTALS in subqueries, including subqueries in the JOIN clause (in this case, the respective total values are combined). - -#### GROUP BY in External Memory {#select-group-by-in-external-memory} - -You can enable dumping temporary data to the disk to restrict memory usage during `GROUP BY`. -The [max\_bytes\_before\_external\_group\_by](../../operations/settings/settings.md#settings-max_bytes_before_external_group_by) setting determines the threshold RAM consumption for dumping `GROUP BY` temporary data to the file system. If set to 0 (the default), it is disabled. - -When using `max_bytes_before_external_group_by`, we recommend that you set `max_memory_usage` about twice as high. This is necessary because there are two stages to aggregation: reading the date and forming intermediate data (1) and merging the intermediate data (2). Dumping data to the file system can only occur during stage 1. If the temporary data wasn’t dumped, then stage 2 might require up to the same amount of memory as in stage 1. - -For example, if [max\_memory\_usage](../../operations/settings/settings.md#settings_max_memory_usage) was set to 10000000000 and you want to use external aggregation, it makes sense to set `max_bytes_before_external_group_by` to 10000000000, and max\_memory\_usage to 20000000000. When external aggregation is triggered (if there was at least one dump of temporary data), maximum consumption of RAM is only slightly more than `max_bytes_before_external_group_by`. - -With distributed query processing, external aggregation is performed on remote servers. In order for the requester server to use only a small amount of RAM, set `distributed_aggregation_memory_efficient` to 1. - -When merging data flushed to the disk, as well as when merging results from remote servers when the `distributed_aggregation_memory_efficient` setting is enabled, consumes up to `1/256 * the_number_of_threads` from the total amount of RAM. - -When external aggregation is enabled, if there was less than `max_bytes_before_external_group_by` of data (i.e. data was not flushed), the query runs just as fast as without external aggregation. If any temporary data was flushed, the run time will be several times longer (approximately three times). - -If you have an `ORDER BY` with a `LIMIT` after `GROUP BY`, then the amount of used RAM depends on the amount of data in `LIMIT`, not in the whole table. But if the `ORDER BY` doesn’t have `LIMIT`, don’t forget to enable external sorting (`max_bytes_before_external_sort`). - -### LIMIT BY Clause {#limit-by-clause} - -A query with the `LIMIT n BY expressions` clause selects the first `n` rows for each distinct value of `expressions`. The key for `LIMIT BY` can contain any number of [expressions](../syntax.md#syntax-expressions). - -ClickHouse supports the following syntax: - -- `LIMIT [offset_value, ]n BY expressions` -- `LIMIT n OFFSET offset_value BY expressions` - -During query processing, ClickHouse selects data ordered by sorting key. The sorting key is set explicitly using an [ORDER BY](#select-order-by) clause or implicitly as a property of the table engine. Then ClickHouse applies `LIMIT n BY expressions` and returns the first `n` rows for each distinct combination of `expressions`. If `OFFSET` is specified, then for each data block that belongs to a distinct combination of `expressions`, ClickHouse skips `offset_value` number of rows from the beginning of the block and returns a maximum of `n` rows as a result. If `offset_value` is bigger than the number of rows in the data block, ClickHouse returns zero rows from the block. - -`LIMIT BY` is not related to `LIMIT`. They can both be used in the same query. - -**Examples** - -Sample table: - -``` sql -CREATE TABLE limit_by(id Int, val Int) ENGINE = Memory; -INSERT INTO limit_by values(1, 10), (1, 11), (1, 12), (2, 20), (2, 21); -``` - -Queries: - -``` sql -SELECT * FROM limit_by ORDER BY id, val LIMIT 2 BY id -``` - -``` text -┌─id─┬─val─┐ -│ 1 │ 10 │ -│ 1 │ 11 │ -│ 2 │ 20 │ -│ 2 │ 21 │ -└────┴─────┘ -``` - -``` sql -SELECT * FROM limit_by ORDER BY id, val LIMIT 1, 2 BY id -``` - -``` text -┌─id─┬─val─┐ -│ 1 │ 11 │ -│ 1 │ 12 │ -│ 2 │ 21 │ -└────┴─────┘ -``` - -The `SELECT * FROM limit_by ORDER BY id, val LIMIT 2 OFFSET 1 BY id` query returns the same result. - -The following query returns the top 5 referrers for each `domain, device_type` pair with a maximum of 100 rows in total (`LIMIT n BY + LIMIT`). - -``` sql -SELECT - domainWithoutWWW(URL) AS domain, - domainWithoutWWW(REFERRER_URL) AS referrer, - device_type, - count() cnt -FROM hits -GROUP BY domain, referrer, device_type -ORDER BY cnt DESC -LIMIT 5 BY domain, device_type -LIMIT 100 -``` - -### HAVING Clause {#having-clause} - -Allows filtering the result received after GROUP BY, similar to the WHERE clause. -WHERE and HAVING differ in that WHERE is performed before aggregation (GROUP BY), while HAVING is performed after it. -If aggregation is not performed, HAVING can’t be used. - -### ORDER BY Clause {#select-order-by} - -The ORDER BY clause contains a list of expressions, which can each be assigned DESC or ASC (the sorting direction). If the direction is not specified, ASC is assumed. ASC is sorted in ascending order, and DESC in descending order. The sorting direction applies to a single expression, not to the entire list. Example: `ORDER BY Visits DESC, SearchPhrase` - -For sorting by String values, you can specify collation (comparison). Example: `ORDER BY SearchPhrase COLLATE 'tr'` - for sorting by keyword in ascending order, using the Turkish alphabet, case insensitive, assuming that strings are UTF-8 encoded. COLLATE can be specified or not for each expression in ORDER BY independently. If ASC or DESC is specified, COLLATE is specified after it. When using COLLATE, sorting is always case-insensitive. - -We only recommend using COLLATE for final sorting of a small number of rows, since sorting with COLLATE is less efficient than normal sorting by bytes. - -Rows that have identical values for the list of sorting expressions are output in an arbitrary order, which can also be nondeterministic (different each time). -If the ORDER BY clause is omitted, the order of the rows is also undefined, and may be nondeterministic as well. - -`NaN` and `NULL` sorting order: - -- With the modifier `NULLS FIRST` — First `NULL`, then `NaN`, then other values. -- With the modifier `NULLS LAST` — First the values, then `NaN`, then `NULL`. -- Default — The same as with the `NULLS LAST` modifier. - -Example: - -For the table - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 2 │ -│ 1 │ nan │ -│ 2 │ 2 │ -│ 3 │ 4 │ -│ 5 │ 6 │ -│ 6 │ nan │ -│ 7 │ ᴺᵁᴸᴸ │ -│ 6 │ 7 │ -│ 8 │ 9 │ -└───┴──────┘ -``` - -Run the query `SELECT * FROM t_null_nan ORDER BY y NULLS FIRST` to get: - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 7 │ ᴺᵁᴸᴸ │ -│ 1 │ nan │ -│ 6 │ nan │ -│ 2 │ 2 │ -│ 2 │ 2 │ -│ 3 │ 4 │ -│ 5 │ 6 │ -│ 6 │ 7 │ -│ 8 │ 9 │ -└───┴──────┘ -``` - -When floating point numbers are sorted, NaNs are separate from the other values. Regardless of the sorting order, NaNs come at the end. In other words, for ascending sorting they are placed as if they are larger than all the other numbers, while for descending sorting they are placed as if they are smaller than the rest. - -Less RAM is used if a small enough LIMIT is specified in addition to ORDER BY. Otherwise, the amount of memory spent is proportional to the volume of data for sorting. For distributed query processing, if GROUP BY is omitted, sorting is partially done on remote servers, and the results are merged on the requestor server. This means that for distributed sorting, the volume of data to sort can be greater than the amount of memory on a single server. - -If there is not enough RAM, it is possible to perform sorting in external memory (creating temporary files on a disk). Use the setting `max_bytes_before_external_sort` for this purpose. If it is set to 0 (the default), external sorting is disabled. If it is enabled, when the volume of data to sort reaches the specified number of bytes, the collected data is sorted and dumped into a temporary file. After all data is read, all the sorted files are merged and the results are output. Files are written to the /var/lib/clickhouse/tmp/ directory in the config (by default, but you can use the ‘tmp\_path’ parameter to change this setting). - -Running a query may use more memory than ‘max\_bytes\_before\_external\_sort’. For this reason, this setting must have a value significantly smaller than ‘max\_memory\_usage’. As an example, if your server has 128 GB of RAM and you need to run a single query, set ‘max\_memory\_usage’ to 100 GB, and ‘max\_bytes\_before\_external\_sort’ to 80 GB. - -External sorting works much less effectively than sorting in RAM. - -### SELECT Clause {#select-select} - -[Expressions](../syntax.md#syntax-expressions) specified in the `SELECT` clause are calculated after all the operations in the clauses described above are finished. These expressions work as if they apply to separate rows in the result. If expressions in the `SELECT` clause contain aggregate functions, then ClickHouse processes aggregate functions and expressions used as their arguments during the [GROUP BY](#select-group-by-clause) aggregation. - -If you want to include all columns in the result, use the asterisk (`*`) symbol. For example, `SELECT * FROM ...`. - -To match some columns in the result with a [re2](https://en.wikipedia.org/wiki/RE2_(software)) regular expression, you can use the `COLUMNS` expression. - -``` sql -COLUMNS('regexp') -``` - -For example, consider the table: - -``` sql -CREATE TABLE default.col_names (aa Int8, ab Int8, bc Int8) ENGINE = TinyLog -``` - -The following query selects data from all the columns containing the `a` symbol in their name. - -``` sql -SELECT COLUMNS('a') FROM col_names -``` - -``` text -┌─aa─┬─ab─┐ -│ 1 │ 1 │ -└────┴────┘ -``` - -The selected columns are returned not in the alphabetical order. - -You can use multiple `COLUMNS` expressions in a query and apply functions to them. - -For example: - -``` sql -SELECT COLUMNS('a'), COLUMNS('c'), toTypeName(COLUMNS('c')) FROM col_names -``` - -``` text -┌─aa─┬─ab─┬─bc─┬─toTypeName(bc)─┐ -│ 1 │ 1 │ 1 │ Int8 │ -└────┴────┴────┴────────────────┘ -``` - -Each column returned by the `COLUMNS` expression is passed to the function as a separate argument. Also you can pass other arguments to the function if it supports them. Be careful when using functions. If a function doesn’t support the number of arguments you have passed to it, ClickHouse throws an exception. - -For example: - -``` sql -SELECT COLUMNS('a') + COLUMNS('c') FROM col_names -``` - -``` text -Received exception from server (version 19.14.1): -Code: 42. DB::Exception: Received from localhost:9000. DB::Exception: Number of arguments for function plus doesn't match: passed 3, should be 2. -``` - -In this example, `COLUMNS('a')` returns two columns: `aa` and `ab`. `COLUMNS('c')` returns the `bc` column. The `+` operator can’t apply to 3 arguments, so ClickHouse throws an exception with the relevant message. - -Columns that matched the `COLUMNS` expression can have different data types. If `COLUMNS` doesn’t match any columns and is the only expression in `SELECT`, ClickHouse throws an exception. - -### DISTINCT Clause {#select-distinct} - -If DISTINCT is specified, only a single row will remain out of all the sets of fully matching rows in the result. -The result will be the same as if GROUP BY were specified across all the fields specified in SELECT without aggregate functions. But there are several differences from GROUP BY: - -- DISTINCT can be applied together with GROUP BY. -- When ORDER BY is omitted and LIMIT is defined, the query stops running immediately after the required number of different rows has been read. -- Data blocks are output as they are processed, without waiting for the entire query to finish running. - -DISTINCT is not supported if SELECT has at least one array column. - -`DISTINCT` works with [NULL](../syntax.md) as if `NULL` were a specific value, and `NULL=NULL`. In other words, in the `DISTINCT` results, different combinations with `NULL` only occur once. - -ClickHouse supports using the `DISTINCT` and `ORDER BY` clauses for different columns in one query. The `DISTINCT` clause is executed before the `ORDER BY` clause. - -Example table: - -``` text -┌─a─┬─b─┐ -│ 2 │ 1 │ -│ 1 │ 2 │ -│ 3 │ 3 │ -│ 2 │ 4 │ -└───┴───┘ -``` - -When selecting data with the `SELECT DISTINCT a FROM t1 ORDER BY b ASC` query, we get the following result: - -``` text -┌─a─┐ -│ 2 │ -│ 1 │ -│ 3 │ -└───┘ -``` - -If we change the sorting direction `SELECT DISTINCT a FROM t1 ORDER BY b DESC`, we get the following result: - -``` text -┌─a─┐ -│ 3 │ -│ 1 │ -│ 2 │ -└───┘ -``` - -Row `2, 4` was cut before sorting. - -Take this implementation specificity into account when programming queries. - -### LIMIT Clause {#limit-clause} - -`LIMIT m` allows you to select the first `m` rows from the result. - -`LIMIT n, m` allows you to select the first `m` rows from the result after skipping the first `n` rows. The `LIMIT m OFFSET n` syntax is also supported. - -`n` and `m` must be non-negative integers. - -If there isn’t an `ORDER BY` clause that explicitly sorts results, the result may be arbitrary and nondeterministic. - -### UNION ALL Clause {#union-all-clause} - -You can use UNION ALL to combine any number of queries. Example: - -``` sql -SELECT CounterID, 1 AS table, toInt64(count()) AS c - FROM test.hits - GROUP BY CounterID - -UNION ALL - -SELECT CounterID, 2 AS table, sum(Sign) AS c - FROM test.visits - GROUP BY CounterID - HAVING c > 0 -``` - -Only UNION ALL is supported. The regular UNION (UNION DISTINCT) is not supported. If you need UNION DISTINCT, you can write SELECT DISTINCT from a subquery containing UNION ALL. - -Queries that are parts of UNION ALL can be run simultaneously, and their results can be mixed together. - -The structure of results (the number and type of columns) must match for the queries. But the column names can differ. In this case, the column names for the final result will be taken from the first query. Type casting is performed for unions. For example, if two queries being combined have the same field with non-`Nullable` and `Nullable` types from a compatible type, the resulting `UNION ALL` has a `Nullable` type field. - -Queries that are parts of UNION ALL can’t be enclosed in brackets. ORDER BY and LIMIT are applied to separate queries, not to the final result. If you need to apply a conversion to the final result, you can put all the queries with UNION ALL in a subquery in the FROM clause. - -### INTO OUTFILE Clause {#into-outfile-clause} - -Add the `INTO OUTFILE filename` clause (where filename is a string literal) to redirect query output to the specified file. -In contrast to MySQL, the file is created on the client side. The query will fail if a file with the same filename already exists. -This functionality is available in the command-line client and clickhouse-local (a query sent via HTTP interface will fail). - -The default output format is TabSeparated (the same as in the command-line client batch mode). - -### FORMAT Clause {#format-clause} - -Specify ‘FORMAT format’ to get data in any specified format. -You can use this for convenience, or for creating dumps. -For more information, see the section “Formats”. -If the FORMAT clause is omitted, the default format is used, which depends on both the settings and the interface used for accessing the DB. For the HTTP interface and the command-line client in batch mode, the default format is TabSeparated. For the command-line client in interactive mode, the default format is PrettyCompact (it has attractive and compact tables). - -When using the command-line client, data is passed to the client in an internal efficient format. The client independently interprets the FORMAT clause of the query and formats the data itself (thus relieving the network and the server from the load). - -### IN Operators {#select-in-operators} - -The `IN`, `NOT IN`, `GLOBAL IN`, and `GLOBAL NOT IN` operators are covered separately, since their functionality is quite rich. - -The left side of the operator is either a single column or a tuple. - -Examples: - -``` sql -SELECT UserID IN (123, 456) FROM ... -SELECT (CounterID, UserID) IN ((34, 123), (101500, 456)) FROM ... -``` - -If the left side is a single column that is in the index, and the right side is a set of constants, the system uses the index for processing the query. - -Don’t list too many values explicitly (i.e. millions). If a data set is large, put it in a temporary table (for example, see the section “External data for query processing”), then use a subquery. - -The right side of the operator can be a set of constant expressions, a set of tuples with constant expressions (shown in the examples above), or the name of a database table or SELECT subquery in brackets. - -If the right side of the operator is the name of a table (for example, `UserID IN users`), this is equivalent to the subquery `UserID IN (SELECT * FROM users)`. Use this when working with external data that is sent along with the query. For example, the query can be sent together with a set of user IDs loaded to the ‘users’ temporary table, which should be filtered. - -If the right side of the operator is a table name that has the Set engine (a prepared data set that is always in RAM), the data set will not be created over again for each query. - -The subquery may specify more than one column for filtering tuples. -Example: - -``` sql -SELECT (CounterID, UserID) IN (SELECT CounterID, UserID FROM ...) FROM ... -``` - -The columns to the left and right of the IN operator should have the same type. - -The IN operator and subquery may occur in any part of the query, including in aggregate functions and lambda functions. -Example: - -``` sql -SELECT - EventDate, - avg(UserID IN - ( - SELECT UserID - FROM test.hits - WHERE EventDate = toDate('2014-03-17') - )) AS ratio -FROM test.hits -GROUP BY EventDate -ORDER BY EventDate ASC -``` - -``` text -┌──EventDate─┬────ratio─┐ -│ 2014-03-17 │ 1 │ -│ 2014-03-18 │ 0.807696 │ -│ 2014-03-19 │ 0.755406 │ -│ 2014-03-20 │ 0.723218 │ -│ 2014-03-21 │ 0.697021 │ -│ 2014-03-22 │ 0.647851 │ -│ 2014-03-23 │ 0.648416 │ -└────────────┴──────────┘ -``` - -For each day after March 17th, count the percentage of pageviews made by users who visited the site on March 17th. -A subquery in the IN clause is always run just one time on a single server. There are no dependent subqueries. - -#### NULL processing {#null-processing-1} - -During request processing, the IN operator assumes that the result of an operation with [NULL](../syntax.md) is always equal to `0`, regardless of whether `NULL` is on the right or left side of the operator. `NULL` values are not included in any dataset, do not correspond to each other and cannot be compared. - -Here is an example with the `t_null` table: - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Running the query `SELECT x FROM t_null WHERE y IN (NULL,3)` gives you the following result: - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -You can see that the row in which `y = NULL` is thrown out of the query results. This is because ClickHouse can’t decide whether `NULL` is included in the `(NULL,3)` set, returns `0` as the result of the operation, and `SELECT` excludes this row from the final output. - -``` sql -SELECT y IN (NULL, 3) -FROM t_null -``` - -``` text -┌─in(y, tuple(NULL, 3))─┐ -│ 0 │ -│ 1 │ -└───────────────────────┘ -``` - -#### Distributed Subqueries {#select-distributed-subqueries} - -There are two options for IN-s with subqueries (similar to JOINs): normal `IN` / `JOIN` and `GLOBAL IN` / `GLOBAL JOIN`. They differ in how they are run for distributed query processing. - -!!! attention "Attention" - Remember that the algorithms described below may work differently depending on the [settings](../../operations/settings/settings.md) `distributed_product_mode` setting. - -When using the regular IN, the query is sent to remote servers, and each of them runs the subqueries in the `IN` or `JOIN` clause. - -When using `GLOBAL IN` / `GLOBAL JOINs`, first all the subqueries are run for `GLOBAL IN` / `GLOBAL JOINs`, and the results are collected in temporary tables. Then the temporary tables are sent to each remote server, where the queries are run using this temporary data. - -For a non-distributed query, use the regular `IN` / `JOIN`. - -Be careful when using subqueries in the `IN` / `JOIN` clauses for distributed query processing. - -Let’s look at some examples. Assume that each server in the cluster has a normal **local\_table**. Each server also has a **distributed\_table** table with the **Distributed** type, which looks at all the servers in the cluster. - -For a query to the **distributed\_table**, the query will be sent to all the remote servers and run on them using the **local\_table**. - -For example, the query - -``` sql -SELECT uniq(UserID) FROM distributed_table -``` - -will be sent to all remote servers as - -``` sql -SELECT uniq(UserID) FROM local_table -``` - -and run on each of them in parallel, until it reaches the stage where intermediate results can be combined. Then the intermediate results will be returned to the requestor server and merged on it, and the final result will be sent to the client. - -Now let’s examine a query with IN: - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) -``` - -- Calculation of the intersection of audiences of two sites. - -This query will be sent to all remote servers as - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) -``` - -In other words, the data set in the IN clause will be collected on each server independently, only across the data that is stored locally on each of the servers. - -This will work correctly and optimally if you are prepared for this case and have spread data across the cluster servers such that the data for a single UserID resides entirely on a single server. In this case, all the necessary data will be available locally on each server. Otherwise, the result will be inaccurate. We refer to this variation of the query as “local IN”. - -To correct how the query works when data is spread randomly across the cluster servers, you could specify **distributed\_table** inside a subquery. The query would look like this: - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -This query will be sent to all remote servers as - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -The subquery will begin running on each remote server. Since the subquery uses a distributed table, the subquery that is on each remote server will be resent to every remote server as - -``` sql -SELECT UserID FROM local_table WHERE CounterID = 34 -``` - -For example, if you have a cluster of 100 servers, executing the entire query will require 10,000 elementary requests, which is generally considered unacceptable. - -In such cases, you should always use GLOBAL IN instead of IN. Let’s look at how it works for the query - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID GLOBAL IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -The requestor server will run the subquery - -``` sql -SELECT UserID FROM distributed_table WHERE CounterID = 34 -``` - -and the result will be put in a temporary table in RAM. Then the request will be sent to each remote server as - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID GLOBAL IN _data1 -``` - -and the temporary table `_data1` will be sent to every remote server with the query (the name of the temporary table is implementation-defined). - -This is more optimal than using the normal IN. However, keep the following points in mind: - -1. When creating a temporary table, data is not made unique. To reduce the volume of data transmitted over the network, specify DISTINCT in the subquery. (You don’t need to do this for a normal IN.) -2. The temporary table will be sent to all the remote servers. Transmission does not account for network topology. For example, if 10 remote servers reside in a datacenter that is very remote in relation to the requestor server, the data will be sent 10 times over the channel to the remote datacenter. Try to avoid large data sets when using GLOBAL IN. -3. When transmitting data to remote servers, restrictions on network bandwidth are not configurable. You might overload the network. -4. Try to distribute data across servers so that you don’t need to use GLOBAL IN on a regular basis. -5. If you need to use GLOBAL IN often, plan the location of the ClickHouse cluster so that a single group of replicas resides in no more than one data center with a fast network between them, so that a query can be processed entirely within a single data center. - -It also makes sense to specify a local table in the `GLOBAL IN` clause, in case this local table is only available on the requestor server and you want to use data from it on remote servers. - -### Extreme Values {#extreme-values} - -In addition to results, you can also get minimum and maximum values for the results columns. To do this, set the **extremes** setting to 1. Minimums and maximums are calculated for numeric types, dates, and dates with times. For other columns, the default values are output. - -An extra two rows are calculated – the minimums and maximums, respectively. These extra two rows are output in `JSON*`, `TabSeparated*`, and `Pretty*` [formats](../../interfaces/formats.md), separate from the other rows. They are not output for other formats. - -In `JSON*` formats, the extreme values are output in a separate ‘extremes’ field. In `TabSeparated*` formats, the row comes after the main result, and after ‘totals’ if present. It is preceded by an empty row (after the other data). In `Pretty*` formats, the row is output as a separate table after the main result, and after `totals` if present. - -Extreme values are calculated for rows before `LIMIT`, but after `LIMIT BY`. However, when using `LIMIT offset, size`, the rows before `offset` are included in `extremes`. In stream requests, the result may also include a small number of rows that passed through `LIMIT`. - -### Notes {#notes} - -The `GROUP BY` and `ORDER BY` clauses do not support positional arguments. This contradicts MySQL, but conforms to standard SQL. -For example, `GROUP BY 1, 2` will be interpreted as grouping by constants (i.e. aggregation of all rows into one). - -You can use synonyms (`AS` aliases) in any part of a query. - -You can put an asterisk in any part of a query instead of an expression. When the query is analyzed, the asterisk is expanded to a list of all table columns (excluding the `MATERIALIZED` and `ALIAS` columns). There are only a few cases when using an asterisk is justified: - -- When creating a table dump. -- For tables containing just a few columns, such as system tables. -- For getting information about what columns are in a table. In this case, set `LIMIT 1`. But it is better to use the `DESC TABLE` query. -- When there is strong filtration on a small number of columns using `PREWHERE`. -- In subqueries (since columns that aren’t needed for the external query are excluded from subqueries). - -In all other cases, we don’t recommend using the asterisk, since it only gives you the drawbacks of a columnar DBMS instead of the advantages. In other words using the asterisk is not recommended. - -[Original article](https://clickhouse.tech/docs/en/query_language/select/) diff --git a/docs/en/sql_reference/statements/show.md b/docs/en/sql_reference/statements/show.md deleted file mode 100644 index 89572fc7118..00000000000 --- a/docs/en/sql_reference/statements/show.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -toc_priority: 38 -toc_title: SHOW ---- - -# SHOW Queries {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Returns a single `String`-type ‘statement’ column, which contains a single value – the `CREATE` query used for creating the specified object. - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -Prints a list of all databases. -This query is identical to `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -Outputs the content of the [system.processes](../../operations/system_tables.md#system_tables-processes) table, that contains a list of queries that is being processed at the moment, excepting `SHOW PROCESSLIST` queries. - -The `SELECT * FROM system.processes` query returns data about all the current queries. - -Tip (execute in the console): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -Displays a list of tables. - -``` sql -SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -If the `FROM` clause is not specified, the query returns the list of tables from the current database. - -You can get the same results as the `SHOW TABLES` query in the following way: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Example** - -The following query selects the first two rows from the list of tables in the `system` database, whose names contain `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -Displays a list of [external dictionaries](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -If the `FROM` clause is not specified, the query returns the list of dictionaries from the current database. - -You can get the same results as the `SHOW DICTIONARIES` query in the following way: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Example** - -The following query selects the first two rows from the list of tables in the `system` database, whose names contain `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/en/sql_reference/statements/system.md b/docs/en/sql_reference/statements/system.md deleted file mode 100644 index ebd945f850e..00000000000 --- a/docs/en/sql_reference/statements/system.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -toc_priority: 37 -toc_title: SYSTEM ---- - -# SYSTEM Queries {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -Reloads all dictionaries that have been successfully loaded before. -By default, dictionaries are loaded lazily (see [dictionaries\_lazy\_load](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), so instead of being loaded automatically at startup, they are initialized on first access through dictGet function or SELECT from tables with ENGINE = Dictionary. The `SYSTEM RELOAD DICTIONARIES` query reloads such dictionaries (LOADED). -Always returns `Ok.` regardless of the result of the dictionary update. - -## RELOAD DICTIONARY Dictionary\_name {#query_language-system-reload-dictionary} - -Completely reloads a dictionary `dictionary_name`, regardless of the state of the dictionary (LOADED / NOT\_LOADED / FAILED). -Always returns `Ok.` regardless of the result of updating the dictionary. -The status of the dictionary can be checked by querying the `system.dictionaries` table. - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -Resets ClickHouse’s internal DNS cache. Sometimes (for old ClickHouse versions) it is necessary to use this command when changing the infrastructure (changing the IP address of another ClickHouse server or the server used by dictionaries). - -For more convenient (automatic) cache management, see disable\_internal\_dns\_cache, dns\_cache\_update\_period parameters. - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -Resets the mark cache. Used in development of ClickHouse and performance tests. - -## FLUSH LOGS {#query_language-system-flush_logs} - -Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. - -## RELOAD CONFIG {#query_language-system-reload-config} - -Reloads ClickHouse configuration. Used when configuration is stored in ZooKeeeper. - -## SHUTDOWN {#query_language-system-shutdown} - -Normally shuts down ClickHouse (like `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -Aborts ClickHouse process (like `kill -9 {$ pid_clickhouse-server}`) - -## Managing Distributed Tables {#query-language-system-distributed} - -ClickHouse can manage [distributed](../../engines/table_engines/special/distributed.md) tables. When a user inserts data into these tables, ClickHouse first creates a queue of the data that should be sent to cluster nodes, then asynchronously sends it. You can manage queue processing with the [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed), and [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) queries. You can also synchronously insert distributed data with the `insert_distributed_sync` setting. - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -Disables background data distribution when inserting data into distributed tables. - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -Forces ClickHouse to send data to cluster nodes synchronously. If any nodes are unavailable, ClickHouse throws an exception and stops query execution. You can retry the query until it succeeds, which will happen when all nodes are back online. - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -Enables background data distribution when inserting data into distributed tables. - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -Provides possibility to stop background merges for tables in the MergeTree family: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "Note" - `DETACH / ATTACH` table will start background merges for the table even in case when merges have been stopped for all MergeTree tables before. - -### START MERGES {#query_language-system-start-merges} - -Provides possibility to start background merges for tables in the MergeTree family: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[Original article](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/en/sql_reference/syntax.md b/docs/en/sql_reference/syntax.md deleted file mode 100644 index 10e8c421f6d..00000000000 --- a/docs/en/sql_reference/syntax.md +++ /dev/null @@ -1,185 +0,0 @@ ---- -toc_priority: 31 -toc_title: Syntax ---- - -# Syntax {#syntax} - -There are two types of parsers in the system: the full SQL parser (a recursive descent parser), and the data format parser (a fast stream parser). -In all cases except the `INSERT` query, only the full SQL parser is used. -The `INSERT` query uses both parsers: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -The `INSERT INTO t VALUES` fragment is parsed by the full parser, and the data `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` is parsed by the fast stream parser. You can also turn on the full parser for the data by using the [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) setting. When `input_format_values_interpret_expressions = 1`, ClickHouse first tries to parse values with the fast stream parser. If it fails, ClickHouse tries to use the full parser for the data, treating it like an SQL [expression](#syntax-expressions). - -Data can have any format. When a query is received, the server calculates no more than [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) bytes of the request in RAM (by default, 1 MB), and the rest is stream parsed. -It allows for avoiding issues with large `INSERT` queries. - -When using the `Values` format in an `INSERT` query, it may seem that data is parsed the same as expressions in a `SELECT` query, but this is not true. The `Values` format is much more limited. - -The rest of this article covers the full parser. For more information about format parsers, see the [Formats](../interfaces/formats.md) section. - -## Spaces {#spaces} - -There may be any number of space symbols between syntactical constructions (including the beginning and end of a query). Space symbols include the space, tab, line feed, CR, and form feed. - -## Comments {#comments} - -ClickHouse supports either SQL-style and C-style comments. -SQL-style comments start with `--` and continue to the end of the line, a space after `--` can be omitted. -C-style are from `/*` to `*/`and can be multiline, spaces are not required either. - -## Keywords {#syntax-keywords} - -Keywords are case-insensitive when they correspond to: - -- SQL standard. For example, `SELECT`, `select` and `SeLeCt` are all valid. -- Implementation in some popular DBMS (MySQL or Postgres). For example, `DateTime` is the same as `datetime`. - -Whether data type name is case-sensitive can be checked in the `system.data_type_families` table. - -In contrast to standard SQL, all other keywords (including functions names) are **case-sensitive**. - -Keywords are not reserved; they are treated as such only in the corresponding context. If you use [identifiers](#syntax-identifiers) with the same name as the keywords, enclose them into double-quotes or backticks. For example, the query `SELECT "FROM" FROM table_name` is valid if the table `table_name` has column with the name `"FROM"`. - -## Identifiers {#syntax-identifiers} - -Identifiers are: - -- Cluster, database, table, partition, and column names. -- Functions. -- Data types. -- [Expression aliases](#syntax-expression_aliases). - -Identifiers can be quoted or non-quoted. The latter is preferred. - -Non-quoted identifiers must match the regex `^[a-zA-Z_][0-9a-zA-Z_]*$` and can not be equal to [keywords](#syntax-keywords). Examples: `x, _1, X_y__Z123_.` - -If you want to use identifiers the same as keywords or you want to use other symbols in identifiers, quote it using double quotes or backticks, for example, `"id"`, `` `id` ``. - -## Literals {#literals} - -There are numeric, string, compound, and `NULL` literals. - -### Numeric {#numeric} - -Numeric literal tries to be parsed: - -- First, as a 64-bit signed number, using the [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) function. -- If unsuccessful, as a 64-bit unsigned number, using the [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) function. -- If unsuccessful, as a floating-point number using the [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) function. -- Otherwise, it returns an error. - -Literal value has the smallest type that the value fits in. -For example, 1 is parsed as `UInt8`, but 256 is parsed as `UInt16`. For more information, see [Data types](../sql_reference/data_types/index.md). - -Examples: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### String {#syntax-string-literal} - -Only string literals in single quotes are supported. The enclosed characters can be backslash-escaped. The following escape sequences have a corresponding special value: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. In all other cases, escape sequences in the format `\c`, where `c` is any character, are converted to `c`. It means that you can use the sequences `\'`and`\\`. The value will have the [String](../sql_reference/data_types/string.md) type. - -In string literals, you need to escape at least `'` and `\`. Single quotes can be escaped with the single quote, literals `'It\'s'` and `'It''s'` are equal. - -### Compound {#compound} - -Arrays are constructed with square brackets `[1, 2, 3]`. Nuples are constructed with round brackets `(1, 'Hello, world!', 2)`. -Technically these are not literals, but expressions with the array creation operator and the tuple creation operator, respectively. -An array must consist of at least one item, and a tuple must have at least two items. -There's a separate case when tuples appear in the `IN` clause of a `SELECT` query. Query results can include tuples, but tuples can’t be saved to a database (except of tables with [Memory](../engines/table_engines/special/memory.md) engine). - -### NULL {#null-literal} - -Indicates that the value is missing. - -In order to store `NULL` in a table field, it must be of the [Nullable](../sql_reference/data_types/nullable.md) type. - -Depending on the data format (input or output), `NULL` may have a different representation. For more information, see the documentation for [data formats](../interfaces/formats.md#formats). - -There are many nuances to processing `NULL`. For example, if at least one of the arguments of a comparison operation is `NULL`, the result of this operation is also `NULL`. The same is true for multiplication, addition, and other operations. For more information, read the documentation for each operation. - -In queries, you can check `NULL` using the [IS NULL](operators.md#operator-is-null) and [IS NOT NULL](operators.md) operators and the related functions `isNull` and `isNotNull`. - -## Functions {#functions} - -Function calls are written like an identifier with a list of arguments (possibly empty) in round brackets. In contrast to standard SQL, the brackets are required, even for an empty argument list. Example: `now()`. -There are regular and aggregate functions (see the section “Aggregate functions”). Some aggregate functions can contain two lists of arguments in brackets. Example: `quantile (0.9) (x)`. These aggregate functions are called “parametric” functions, and the arguments in the first list are called “parameters”. The syntax of aggregate functions without parameters is the same as for regular functions. - -## Operators {#operators} - -Operators are converted to their corresponding functions during query parsing, taking their priority and associativity into account. -For example, the expression `1 + 2 * 3 + 4` is transformed to `plus(plus(1, multiply(2, 3)), 4)`. - -## Data Types and Database Table Engines {#data_types-and-database-table-engines} - -Data types and table engines in the `CREATE` query are written the same way as identifiers or functions. In other words, they may or may not contain an argument list in brackets. For more information, see the sections “Data types,” “Table engines,” and “CREATE”. - -## Expression Aliases {#syntax-expression_aliases} - -An alias is a user-defined name for expression in a query. - -``` sql -expr AS alias -``` - -- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` clause without using the `AS` keyword. - - For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. - -- `expr` — Any expression supported by ClickHouse. - - For example, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — Name for `expr`. Aliases should comply with the [identifiers](#syntax-identifiers) syntax. - - For example, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### Notes on Usage {#notes-on-usage} - -Aliases are global for a query or subquery, and you can define an alias in any part of a query for any expression. For example, `SELECT (1 AS n) + 2, n`. - -Aliases are not visible in subqueries and between subqueries. For example, while executing the query `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse generates the exception `Unknown identifier: num`. - -If an alias is defined for the result columns in the `SELECT` clause of a subquery, these columns are visible in the outer query. For example, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -Be careful with aliases that are the same as column or table names. Let’s consider the following example: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -In this example, we declared table `t` with column `b`. Then, when selecting data, we defined the `sum(b) AS b` alias. As aliases are global, ClickHouse substituted the literal `b` in the expression `argMax(a, b)` with the expression `sum(b)`. This substitution caused the exception. - -## Asterisk {#asterisk} - -In a `SELECT` query, an asterisk can replace the expression. For more information, see the section “SELECT”. - -## Expressions {#syntax-expressions} - -An expression is a function, identifier, literal, application of an operator, expression in brackets, subquery, or asterisk. It can also contain an alias. -A list of expressions is one or more expressions separated by commas. -Functions and operators, in turn, can have expressions as arguments. - -[Original article](https://clickhouse.tech/docs/en/sql_reference/syntax/) diff --git a/docs/en/sql_reference/table_functions/file.md b/docs/en/sql_reference/table_functions/file.md deleted file mode 100644 index 6ae7eb034f9..00000000000 --- a/docs/en/sql_reference/table_functions/file.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -toc_priority: 37 -toc_title: file ---- - -# file {#file} - -Creates a table from a file. This table function is similar to [url](url.md) and [hdfs](hdfs.md) ones. - -``` sql -file(path, format, structure) -``` - -**Input parameters** - -- `path` — The relative path to the file from [user\_files\_path](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-user_files_path). Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` and `{N..M}` where `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [format](../../interfaces/formats.md#formats) of the file. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Returned value** - -A table with the specified structure for reading or writing data in the specified file. - -**Example** - -Setting `user_files_path` and the contents of the file `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -Table from`test.csv` and selection of the first two rows from it: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -``` sql --- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file -SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 -``` - -**Globs in path** - -Multiple path components can have globs. For being processed file should exists and matches to the whole path pattern (not only suffix or prefix). - -- `*` — Substitutes any number of any characters except `/` including empty string. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Constructions with `{}` are similar to the [remote table function](../../sql_reference/table_functions/remote.md)). - -**Example** - -1. Suppose we have several files with the following relative paths: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. Query the amount of rows in these files: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Query the amount of rows in all files of these two directories: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Warning" - If your listing of files contains number ranges with leading zeros, use the construction with braces for each digit separately or use `?`. - -**Example** - -Query the data from files named `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Virtual Columns {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**See Also** - -- [Virtual columns](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/en/sql_reference/table_functions/hdfs.md b/docs/en/sql_reference/table_functions/hdfs.md deleted file mode 100644 index 730bd96758f..00000000000 --- a/docs/en/sql_reference/table_functions/hdfs.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -toc_priority: 45 -toc_title: hdfs ---- - -# hdfs {#hdfs} - -Creates a table from files in HDFS. This table function is similar to [url](url.md) and [file](file.md) ones. - -``` sql -hdfs(URI, format, structure) -``` - -**Input parameters** - -- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` and `{N..M}` where `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [format](../../interfaces/formats.md#formats) of the file. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Returned value** - -A table with the specified structure for reading or writing data in the specified file. - -**Example** - -Table from `hdfs://hdfs1:9000/test` and selection of the first two rows from it: - -``` sql -SELECT * -FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -**Globs in path** - -Multiple path components can have globs. For being processed file should exists and matches to the whole path pattern (not only suffix or prefix). - -- `*` — Substitutes any number of any characters except `/` including empty string. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Constructions with `{}` are similar to the [remote table function](../../sql_reference/table_functions/remote.md)). - -**Example** - -1. Suppose that we have several files with following URIs on HDFS: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Query the amount of rows in these files: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Query the amount of rows in all files of these two directories: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Warning" - If your listing of files contains number ranges with leading zeros, use the construction with braces for each digit separately or use `?`. - -**Example** - -Query the data from files named `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Virtual Columns {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**See Also** - -- [Virtual columns](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/en/sql_reference/table_functions/index.md b/docs/en/sql_reference/table_functions/index.md deleted file mode 100644 index 18a17ce2f6f..00000000000 --- a/docs/en/sql_reference/table_functions/index.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -toc_folder_title: Table Functions -toc_priority: 34 -toc_title: Introduction ---- - -# Table Functions {#table-functions} - -Table functions are methods for constructing tables. - -You can use table functions in: - -- [FROM](../statements/select.md#select-from) clause of the `SELECT` query. - - The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. - -- [CREATE TABLE AS \](../statements/create.md#create-table-query) query. - - It's one of the methods of creating a table. - -!!! warning "Warning" - You can’t use table functions if the [allow\_ddl](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) setting is disabled. - -| Function | Description | -|---------------|----------------------------------------------------------------------------------| -| [file](file.md) | Creates a [File](../../engines/table_engines/special/file.md)-engine table. | -| [merge](merge.md) | Creates a [Merge](../../engines/table_engines/special/merge.md)-engine table. | -| [numbers](numbers.md) | Creates a table with a single column filled with integer numbers. | -| [remote](remote.md) | Allows you to access remote servers without creating a [Distributed](../../engines/table_engines/special/distributed.md)-engine table. | -| [url](url.md) | Creates a [Url](../../engines/table_engines/special/url.md)-engine table. | -| [mysql](mysql.md) | Creates a [MySQL](../../engines/table_engines/integrations/mysql.md)-engine table. | -| [jdbc](jdbc.md) | Creates a [JDBC](../../engines/table_engines/integrations/jdbc.md)-engine table. | -| [odbc](odbc.md) | Creates a [ODBC](../../engines/table_engines/integrations/odbc.md)-engine table. | -| [hdfs](hdfs.md) | Creates a [HDFS](../../engines/table_engines/integrations/hdfs.md)-engine table. | - -[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/en/sql_reference/table_functions/mysql.md b/docs/en/sql_reference/table_functions/mysql.md deleted file mode 100644 index b4029c945d3..00000000000 --- a/docs/en/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -toc_priority: 42 -toc_title: mysql ---- - -# mysql {#mysql} - -Allows `SELECT` queries to be performed on data that is stored on a remote MySQL server. - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**Parameters** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` queries to `REPLACE INTO`. If `replace_query=1`, the query is replaced. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expression that is added to the `INSERT` query. - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -Simple `WHERE` clauses such as `=, !=, >, >=, <, <=` are currently executed on the MySQL server. - -The rest of the conditions and the `LIMIT` sampling constraint are executed in ClickHouse only after the query to MySQL finishes. - -**Returned Value** - -A table object with the same columns as the original MySQL table. - -## Usage Example {#usage-example} - -Table in MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Selecting data from ClickHouse: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## See Also {#see-also} - -- [The ‘MySQL’ table engine](../../engines/table_engines/integrations/mysql.md) -- [Using MySQL as a source of external dictionary](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/en/sql_reference/table_functions/odbc.md b/docs/en/sql_reference/table_functions/odbc.md deleted file mode 100644 index f14e7808f79..00000000000 --- a/docs/en/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -toc_priority: 44 -toc_title: odbc ---- - -# odbc {#table-functions-odbc} - -Returns table that is connected via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -Parameters: - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` file. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -To safely implement ODBC connections, ClickHouse uses a separate program `clickhouse-odbc-bridge`. If the ODBC driver is loaded directly from `clickhouse-server`, driver problems can crash the ClickHouse server. ClickHouse automatically starts `clickhouse-odbc-bridge` when it is required. The ODBC bridge program is installed from the same package as the `clickhouse-server`. - -The fields with the `NULL` values from the external table are converted into the default values for the base data type. For example, if a remote MySQL table field has the `INT NULL` type it is converted to 0 (the default value for ClickHouse `Int32` data type). - -## Usage example {#usage-example} - -**Getting data from the local MySQL installation via ODBC** - -This example is checked for Ubuntu Linux 18.04 and MySQL server 5.7. - -Ensure that unixODBC and MySQL Connector are installed. - -By default (if installed from packages), ClickHouse starts as user `clickhouse`. Thus you need to create and configure this user in the MySQL server. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Then configure the connection in `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -You can check the connection using the `isql` utility from the unixODBC installation. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -Table in MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Retrieving data from the MySQL table in ClickHouse: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## See Also {#see-also} - -- [ODBC external dictionaries](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBC table engine](../../engines/table_engines/integrations/odbc.md). - -[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/en/sql_reference/table_functions/remote.md b/docs/en/sql_reference/table_functions/remote.md deleted file mode 100644 index 62ead0674b5..00000000000 --- a/docs/en/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -toc_priority: 40 -toc_title: remote ---- - -# remote, remoteSecure {#remote-remotesecure} - -Allows you to access remote servers without creating a `Distributed` table. - -Signatures: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port`, or just `host`. The host can be specified as the server name, or as the IPv4 or IPv6 address. An IPv6 address is specified in square brackets. The port is the TCP port on the remote server. If the port is omitted, it uses `tcp_port` from the server’s config file (by default, 9000). - -!!! important "Important" - The port is required for an IPv6 address. - -Examples: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -Multiple addresses can be comma-separated. In this case, ClickHouse will use distributed processing, so it will send the query to all specified addresses (like to shards with different data). - -Example: - -``` text -example01-01-1,example01-02-1 -``` - -Part of the expression can be specified in curly brackets. The previous example can be written as follows: - -``` text -example01-0{1,2}-1 -``` - -Curly brackets can contain a range of numbers separated by two dots (non-negative integers). In this case, the range is expanded to a set of values that generate shard addresses. If the first number starts with zero, the values are formed with the same zero alignment. The previous example can be written as follows: - -``` text -example01-{01..02}-1 -``` - -If you have multiple pairs of curly brackets, it generates the direct product of the corresponding sets. - -Addresses and parts of addresses in curly brackets can be separated by the pipe symbol (\|). In this case, the corresponding sets of addresses are interpreted as replicas, and the query will be sent to the first healthy replica. However, the replicas are iterated in the order currently set in the [load\_balancing](../../operations/settings/settings.md) setting. - -Example: - -``` text -example01-{01..02}-{1|2} -``` - -This example specifies two shards that each have two replicas. - -The number of addresses generated is limited by a constant. Right now this is 1000 addresses. - -Using the `remote` table function is less optimal than creating a `Distributed` table, because in this case, the server connection is re-established for every request. In addition, if host names are set, the names are resolved, and errors are not counted when working with various replicas. When processing a large number of queries, always create the `Distributed` table ahead of time, and don’t use the `remote` table function. - -The `remote` table function can be useful in the following cases: - -- Accessing a specific server for data comparison, debugging, and testing. -- Queries between various ClickHouse clusters for research purposes. -- Infrequent distributed requests that are made manually. -- Distributed requests where the set of servers is re-defined each time. - -If the user is not specified, `default` is used. -If the password is not specified, an empty password is used. - -`remoteSecure` - same as `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) from config or 9440. - -[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/en/whats-new/changelog/2017.md b/docs/en/whats-new/changelog/2017.md new file mode 100644 index 00000000000..637d3cb2ecd --- /dev/null +++ b/docs/en/whats-new/changelog/2017.md @@ -0,0 +1,266 @@ +--- +toc_priority: 79 +toc_title: '2017' +--- + +### ClickHouse Release 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} + +This release contains bug fixes for the previous release 1.1.54318: + +- Fixed bug with possible race condition in replication that could lead to data loss. This issue affects versions 1.1.54310 and 1.1.54318. If you use one of these versions with Replicated tables, the update is strongly recommended. This issue shows in logs in Warning messages like `Part ... from own log doesn't exist.` The issue is relevant even if you don’t see these messages in logs. + +### ClickHouse Release 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} + +This release contains bug fixes for the previous release 1.1.54310: + +- Fixed incorrect row deletions during merges in the SummingMergeTree engine +- Fixed a memory leak in unreplicated MergeTree engines +- Fixed performance degradation with frequent inserts in MergeTree engines +- Fixed an issue that was causing the replication queue to stop running +- Fixed rotation and archiving of server logs + +### ClickHouse Release 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} + +#### New Features: {#new-features} + +- Custom partitioning key for the MergeTree family of table engines. +- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) table engine. +- Added support for loading [CatBoost](https://catboost.yandex/) models and applying them to data stored in ClickHouse. +- Added support for time zones with non-integer offsets from UTC. +- Added support for arithmetic operations with time intervals. +- The range of values for the Date and DateTime types is extended to the year 2105. +- Added the `CREATE MATERIALIZED VIEW x TO y` query (specifies an existing table for storing the data of a materialized view). +- Added the `ATTACH TABLE` query without arguments. +- The processing logic for Nested columns with names ending in -Map in a SummingMergeTree table was extracted to the sumMap aggregate function. You can now specify such columns explicitly. +- Max size of the IP trie dictionary is increased to 128M entries. +- Added the getSizeOfEnumType function. +- Added the sumWithOverflow aggregate function. +- Added support for the Cap’n Proto input format. +- You can now customize compression level when using the zstd algorithm. + +#### Backward Incompatible Changes: {#backward-incompatible-changes} + +- Creation of temporary tables with an engine other than Memory is not allowed. +- Explicit creation of tables with the View or MaterializedView engine is not allowed. +- During table creation, a new check verifies that the sampling key expression is included in the primary key. + +#### Bug Fixes: {#bug-fixes} + +- Fixed hangups when synchronously inserting into a Distributed table. +- Fixed nonatomic adding and removing of parts in Replicated tables. +- Data inserted into a materialized view is not subjected to unnecessary deduplication. +- Executing a query to a Distributed table for which the local replica is lagging and remote replicas are unavailable does not result in an error anymore. +- Users don’t need access permissions to the `default` database to create temporary tables anymore. +- Fixed crashing when specifying the Array type without arguments. +- Fixed hangups when the disk volume containing server logs is full. +- Fixed an overflow in the toRelativeWeekNum function for the first week of the Unix epoch. + +#### Build Improvements: {#build-improvements} + +- Several third-party libraries (notably Poco) were updated and converted to git submodules. + +### ClickHouse Release 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} + +#### New Features: {#new-features-1} + +- TLS support in the native protocol (to enable, set `tcp_ssl_port` in `config.xml` ). + +#### Bug Fixes: {#bug-fixes-1} + +- `ALTER` for replicated tables now tries to start running as soon as possible. +- Fixed crashing when reading data with the setting `preferred_block_size_bytes=0.` +- Fixed crashes of `clickhouse-client` when pressing `Page Down` +- Correct interpretation of certain complex queries with `GLOBAL IN` and `UNION ALL` +- `FREEZE PARTITION` always works atomically now. +- Empty POST requests now return a response with code 411. +- Fixed interpretation errors for expressions like `CAST(1 AS Nullable(UInt8)).` +- Fixed an error when reading `Array(Nullable(String))` columns from `MergeTree` tables. +- Fixed crashing when parsing queries like `SELECT dummy AS dummy, dummy AS b` +- Users are updated correctly with invalid `users.xml` +- Correct handling when an executable dictionary returns a non-zero response code. + +### ClickHouse Release 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} + +#### New Features: {#new-features-2} + +- Added the `pointInPolygon` function for working with coordinates on a coordinate plane. +- Added the `sumMap` aggregate function for calculating the sum of arrays, similar to `SummingMergeTree`. +- Added the `trunc` function. Improved performance of the rounding functions (`round`, `floor`, `ceil`, `roundToExp2`) and corrected the logic of how they work. Changed the logic of the `roundToExp2` function for fractions and negative numbers. +- The ClickHouse executable file is now less dependent on the libc version. The same ClickHouse executable file can run on a wide variety of Linux systems. There is still a dependency when using compiled queries (with the setting `compile = 1` , which is not used by default). +- Reduced the time needed for dynamic compilation of queries. + +#### Bug Fixes: {#bug-fixes-2} + +- Fixed an error that sometimes produced `part ... intersects previous part` messages and weakened replica consistency. +- Fixed an error that caused the server to lock up if ZooKeeper was unavailable during shutdown. +- Removed excessive logging when restoring replicas. +- Fixed an error in the UNION ALL implementation. +- Fixed an error in the concat function that occurred if the first column in a block has the Array type. +- Progress is now displayed correctly in the system.merges table. + +### ClickHouse Release 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} + +#### New Features: {#new-features-3} + +- `SYSTEM` queries for server administration: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. +- Added functions for working with arrays: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. +- Added `root` and `identity` parameters for the ZooKeeper configuration. This allows you to isolate individual users on the same ZooKeeper cluster. +- Added aggregate functions `groupBitAnd`, `groupBitOr`, and `groupBitXor` (for compatibility, they are also available under the names `BIT_AND`, `BIT_OR`, and `BIT_XOR`). +- External dictionaries can be loaded from MySQL by specifying a socket in the filesystem. +- External dictionaries can be loaded from MySQL over SSL (`ssl_cert`, `ssl_key`, `ssl_ca` parameters). +- Added the `max_network_bandwidth_for_user` setting to restrict the overall bandwidth use for queries per user. +- Support for `DROP TABLE` for temporary tables. +- Support for reading `DateTime` values in Unix timestamp format from the `CSV` and `JSONEachRow` formats. +- Lagging replicas in distributed queries are now excluded by default (the default threshold is 5 minutes). +- FIFO locking is used during ALTER: an ALTER query isn’t blocked indefinitely for continuously running queries. +- Option to set `umask` in the config file. +- Improved performance for queries with `DISTINCT` . + +#### Bug Fixes: {#bug-fixes-3} + +- Improved the process for deleting old nodes in ZooKeeper. Previously, old nodes sometimes didn’t get deleted if there were very frequent inserts, which caused the server to be slow to shut down, among other things. +- Fixed randomization when choosing hosts for the connection to ZooKeeper. +- Fixed the exclusion of lagging replicas in distributed queries if the replica is localhost. +- Fixed an error where a data part in a `ReplicatedMergeTree` table could be broken after running `ALTER MODIFY` on an element in a `Nested` structure. +- Fixed an error that could cause SELECT queries to “hang”. +- Improvements to distributed DDL queries. +- Fixed the query `CREATE TABLE ... AS `. +- Resolved the deadlock in the `ALTER ... CLEAR COLUMN IN PARTITION` query for `Buffer` tables. +- Fixed the invalid default value for `Enum` s (0 instead of the minimum) when using the `JSONEachRow` and `TSKV` formats. +- Resolved the appearance of zombie processes when using a dictionary with an `executable` source. +- Fixed segfault for the HEAD query. + +#### Improved Workflow for Developing and Assembling ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse} + +- You can use `pbuilder` to build ClickHouse. +- You can use `libc++` instead of `libstdc++` for builds on Linux. +- Added instructions for using static code analysis tools: `Coverage`, `clang-tidy`, `cppcheck`. + +#### Please Note When Upgrading: {#please-note-when-upgrading} + +- There is now a higher default value for the MergeTree setting `max_bytes_to_merge_at_max_space_in_pool` (the maximum total size of data parts to merge, in bytes): it has increased from 100 GiB to 150 GiB. This might result in large merges running after the server upgrade, which could cause an increased load on the disk subsystem. If the free space available on the server is less than twice the total amount of the merges that are running, this will cause all other merges to stop running, including merges of small data parts. As a result, INSERT queries will fail with the message “Merges are processing significantly slower than inserts.” Use the `SELECT * FROM system.merges` query to monitor the situation. You can also check the `DiskSpaceReservedForMerge` metric in the `system.metrics` table, or in Graphite. You don’t need to do anything to fix this, since the issue will resolve itself once the large merges finish. If you find this unacceptable, you can restore the previous value for the `max_bytes_to_merge_at_max_space_in_pool` setting. To do this, go to the section in config.xml, set ``` ``107374182400 ``` and restart the server. + +### ClickHouse Release 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} + +- This is a bugfix release for the previous 1.1.54282 release. It fixes leaks in the parts directory in ZooKeeper. + +### ClickHouse Release 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} + +This release contains bug fixes for the previous release 1.1.54276: + +- Fixed `DB::Exception: Assertion violation: !_path.empty()` when inserting into a Distributed table. +- Fixed parsing when inserting in RowBinary format if input data starts with’;’. +- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). + +### ClickHouse Release 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} + +#### New Features: {#new-features-4} + +- Added an optional WITH section for a SELECT query. Example query: `WITH 1+1 AS a SELECT a, a*a` +- INSERT can be performed synchronously in a Distributed table: OK is returned only after all the data is saved on all the shards. This is activated by the setting insert\_distributed\_sync=1. +- Added the UUID data type for working with 16-byte identifiers. +- Added aliases of CHAR, FLOAT and other types for compatibility with the Tableau. +- Added the functions toYYYYMM, toYYYYMMDD, and toYYYYMMDDhhmmss for converting time into numbers. +- You can use IP addresses (together with the hostname) to identify servers for clustered DDL queries. +- Added support for non-constant arguments and negative offsets in the function `substring(str, pos, len).` +- Added the max\_size parameter for the `groupArray(max_size)(column)` aggregate function, and optimized its performance. + +#### Main Changes: {#main-changes} + +- Security improvements: all server files are created with 0640 permissions (can be changed via config parameter). +- Improved error messages for queries with invalid syntax. +- Significantly reduced memory consumption and improved performance when merging large sections of MergeTree data. +- Significantly increased the performance of data merges for the ReplacingMergeTree engine. +- Improved performance for asynchronous inserts from a Distributed table by combining multiple source inserts. To enable this functionality, use the setting distributed\_directory\_monitor\_batch\_inserts=1. + +#### Backward Incompatible Changes: {#backward-incompatible-changes-1} + +- Changed the binary format of aggregate states of `groupArray(array_column)` functions for arrays. + +#### Complete List of Changes: {#complete-list-of-changes} + +- Added the `output_format_json_quote_denormals` setting, which enables outputting nan and inf values in JSON format. +- Optimized stream allocation when reading from a Distributed table. +- Settings can be configured in readonly mode if the value doesn’t change. +- Added the ability to retrieve non-integer granules of the MergeTree engine in order to meet restrictions on the block size specified in the preferred\_block\_size\_bytes setting. The purpose is to reduce the consumption of RAM and increase cache locality when processing queries from tables with large columns. +- Efficient use of indexes that contain expressions like `toStartOfHour(x)` for conditions like `toStartOfHour(x) op сonstexpr.` +- Added new settings for MergeTree engines (the merge\_tree section in config.xml): + - replicated\_deduplication\_window\_seconds sets the number of seconds allowed for deduplicating inserts in Replicated tables. + - cleanup\_delay\_period sets how often to start cleanup to remove outdated data. + - replicated\_can\_become\_leader can prevent a replica from becoming the leader (and assigning merges). +- Accelerated cleanup to remove outdated data from ZooKeeper. +- Multiple improvements and fixes for clustered DDL queries. Of particular interest is the new setting distributed\_ddl\_task\_timeout, which limits the time to wait for a response from the servers in the cluster. If a ddl request has not been performed on all hosts, a response will contain a timeout error and a request will be executed in an async mode. +- Improved display of stack traces in the server logs. +- Added the “none” value for the compression method. +- You can use multiple dictionaries\_config sections in config.xml. +- It is possible to connect to MySQL through a socket in the file system. +- The system.parts table has a new column with information about the size of marks, in bytes. + +#### Bug Fixes: {#bug-fixes-4} + +- Distributed tables using a Merge table now work correctly for a SELECT query with a condition on the `_table` field. +- Fixed a rare race condition in ReplicatedMergeTree when checking data parts. +- Fixed possible freezing on “leader election” when starting a server. +- The max\_replica\_delay\_for\_distributed\_queries setting was ignored when using a local replica of the data source. This has been fixed. +- Fixed incorrect behavior of `ALTER TABLE CLEAR COLUMN IN PARTITION` when attempting to clean a non-existing column. +- Fixed an exception in the multiIf function when using empty arrays or strings. +- Fixed excessive memory allocations when deserializing Native format. +- Fixed incorrect auto-update of Trie dictionaries. +- Fixed an exception when running queries with a GROUP BY clause from a Merge table when using SAMPLE. +- Fixed a crash of GROUP BY when using distributed\_aggregation\_memory\_efficient=1. +- Now you can specify the database.table in the right side of IN and JOIN. +- Too many threads were used for parallel aggregation. This has been fixed. +- Fixed how the “if” function works with FixedString arguments. +- SELECT worked incorrectly from a Distributed table for shards with a weight of 0. This has been fixed. +- Running `CREATE VIEW IF EXISTS no longer causes crashes.` +- Fixed incorrect behavior when input\_format\_skip\_unknown\_fields=1 is set and there are negative numbers. +- Fixed an infinite loop in the `dictGetHierarchy()` function if there is some invalid data in the dictionary. +- Fixed `Syntax error: unexpected (...)` errors when running distributed queries with subqueries in an IN or JOIN clause and Merge tables. +- Fixed an incorrect interpretation of a SELECT query from Dictionary tables. +- Fixed the “Cannot mremap” error when using arrays in IN and JOIN clauses with more than 2 billion elements. +- Fixed the failover for dictionaries with MySQL as the source. + +#### Improved Workflow for Developing and Assembling ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} + +- Builds can be assembled in Arcadia. +- You can use gcc 7 to compile ClickHouse. +- Parallel builds using ccache+distcc are faster now. + +### ClickHouse Release 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} + +#### New Features: {#new-features-5} + +- Distributed DDL (for example, `CREATE TABLE ON CLUSTER`) +- The replicated query `ALTER TABLE CLEAR COLUMN IN PARTITION.` +- The engine for Dictionary tables (access to dictionary data in the form of a table). +- Dictionary database engine (this type of database automatically has Dictionary tables available for all the connected external dictionaries). +- You can check for updates to the dictionary by sending a request to the source. +- Qualified column names +- Quoting identifiers using double quotation marks. +- Sessions in the HTTP interface. +- The OPTIMIZE query for a Replicated table can can run not only on the leader. + +#### Backward Incompatible Changes: {#backward-incompatible-changes-2} + +- Removed SET GLOBAL. + +#### Minor Changes: {#minor-changes} + +- Now after an alert is triggered, the log prints the full stack trace. +- Relaxed the verification of the number of damaged/extra data parts at startup (there were too many false positives). + +#### Bug Fixes: {#bug-fixes-5} + +- Fixed a bad connection “sticking” when inserting into a Distributed table. +- GLOBAL IN now works for a query from a Merge table that looks at a Distributed table. +- The incorrect number of cores was detected on a Google Compute Engine virtual machine. This has been fixed. +- Changes in how an executable source of cached external dictionaries works. +- Fixed the comparison of strings containing null characters. +- Fixed the comparison of Float32 primary key fields with constants. +- Previously, an incorrect estimate of the size of a field could lead to overly large allocations. +- Fixed a crash when querying a Nullable column added to a table using ALTER. +- Fixed a crash when sorting by a Nullable column, if the number of rows is less than LIMIT. +- Fixed an ORDER BY subquery consisting of only constant values. +- Previously, a Replicated table could remain in the invalid state after a failed DROP TABLE. +- Aliases for scalar subqueries with empty results are no longer lost. +- Now a query that used compilation does not fail with an error if the .so file gets damaged. diff --git a/docs/en/whats-new/changelog/2018.md b/docs/en/whats-new/changelog/2018.md new file mode 100644 index 00000000000..13303a9097e --- /dev/null +++ b/docs/en/whats-new/changelog/2018.md @@ -0,0 +1,1061 @@ +--- +toc_priority: 78 +toc_title: '2018' +--- + +## ClickHouse Release 18.16 {#clickhouse-release-18-16} + +### ClickHouse Release 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} + +#### Bug Fixes: {#bug-fixes} + +- Fixed an error that led to problems with updating dictionaries with the ODBC source. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- JIT compilation of aggregate functions now works with LowCardinality columns. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) + +#### Improvements: {#improvements} + +- Added the `low_cardinality_allow_in_native_format` setting (enabled by default). When disabled, LowCardinality columns will be converted to ordinary columns for SELECT queries and ordinary columns will be expected for INSERT queries. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) + +#### Build Improvements: {#build-improvements} + +- Fixes for builds on macOS and ARM. + +### ClickHouse Release 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} + +#### New Features: {#new-features} + +- `DEFAULT` expressions are evaluated for missing fields when loading data in semi-structured input formats (`JSONEachRow`, `TSKV`). The feature is enabled with the `insert_sample_with_metadata` setting. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) +- The `ALTER TABLE` query now has the `MODIFY ORDER BY` action for changing the sorting key when adding or removing a table column. This is useful for tables in the `MergeTree` family that perform additional tasks when merging based on this sorting key, such as `SummingMergeTree`, `AggregatingMergeTree`, and so on. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) +- For tables in the `MergeTree` family, now you can specify a different sorting key (`ORDER BY`) and index (`PRIMARY KEY`). The sorting key can be longer than the index. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) +- Added the `hdfs` table function and the `HDFS` table engine for importing and exporting data to HDFS. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) +- Added functions for working with base64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) +- Now you can use a parameter to configure the precision of the `uniqCombined` aggregate function (select the number of HyperLogLog cells). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) +- Added the `system.contributors` table that contains the names of everyone who made commits in ClickHouse. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) +- Added the ability to omit the partition for the `ALTER TABLE ... FREEZE` query in order to back up all partitions at once. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) +- Added `dictGet` and `dictGetOrDefault` functions that don’t require specifying the type of return value. The type is determined automatically from the dictionary description. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3564) +- Now you can specify comments for a column in the table description and change it using `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) +- Reading is supported for `Join` type tables with simple keys. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Now you can specify the options `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, and `join_overflow_mode` when creating a `Join` type table. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Added the `joinGet` function that allows you to use a `Join` type table like a dictionary. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Added the `partition_key`, `sorting_key`, `primary_key`, and `sampling_key` columns to the `system.tables` table in order to provide information about table keys. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Added the `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, and `is_in_sampling_key` columns to the `system.columns` table. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Added the `min_time` and `max_time` columns to the `system.parts` table. These columns are populated when the partitioning key is an expression consisting of `DateTime` columns. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) + +#### Bug Fixes: {#bug-fixes-1} + +- Fixes and performance improvements for the `LowCardinality` data type. `GROUP BY` using `LowCardinality(Nullable(...))`. Getting the values of `extremes`. Processing high-order functions. `LEFT ARRAY JOIN`. Distributed `GROUP BY`. Functions that return `Array`. Execution of `ORDER BY`. Writing to `Distributed` tables (nicelulu). Backward compatibility for `INSERT` queries from old clients that implement the `Native` protocol. Support for `LowCardinality` for `JOIN`. Improved performance when working in a single stream. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) +- Fixed how the `select_sequential_consistency` option works. Previously, when this setting was enabled, an incomplete result was sometimes returned after beginning to write to a new partition. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) +- Databases are correctly specified when executing DDL `ON CLUSTER` queries and `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Databases are correctly specified for subqueries inside a VIEW. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Fixed a bug in `PREWHERE` with `FINAL` for `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) +- Now you can use `KILL QUERY` to cancel queries that have not started yet because they are waiting for the table to be locked. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) +- Corrected date and time calculations if the clocks were moved back at midnight (this happens in Iran, and happened in Moscow from 1981 to 1983). Previously, this led to the time being reset a day earlier than necessary, and also caused incorrect formatting of the date and time in text format. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) +- Fixed bugs in some cases of `VIEW` and subqueries that omit the database. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Fixed a race condition when simultaneously reading from a `MATERIALIZED VIEW` and deleting a `MATERIALIZED VIEW` due to not locking the internal `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) +- Fixed the error `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) +- Fixed query processing when the `compile_expressions` option is enabled (it’s enabled by default). Nondeterministic constant expressions like the `now` function are no longer unfolded. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) +- Fixed a crash when specifying a non-constant scale argument in `toDecimal32/64/128` functions. +- Fixed an error when trying to insert an array with `NULL` elements in the `Values` format into a column of type `Array` without `Nullable` (if `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) +- Fixed continuous error logging in `DDLWorker` if ZooKeeper is not available. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) +- Fixed the return type for `quantile*` functions from `Date` and `DateTime` types of arguments. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) +- Fixed the `WITH` clause if it specifies a simple alias without expressions. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) +- Fixed processing of queries with named sub-queries and qualified column names when `enable_optimize_predicate_expression` is enabled. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) +- Fixed the error `Attempt to attach to nullptr thread group` when working with materialized views. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) +- Fixed a crash when passing certain incorrect arguments to the `arrayReverse` function. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- Fixed the buffer overflow in the `extractURLParameter` function. Improved performance. Added correct processing of strings containing zero bytes. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) +- Fixed buffer overflow in the `lowerUTF8` and `upperUTF8` functions. Removed the ability to execute these functions over `FixedString` type arguments. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) +- Fixed a rare race condition when deleting `MergeTree` tables. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) +- Fixed a race condition when reading from `Buffer` tables and simultaneously performing `ALTER` or `DROP` on the target tables. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) +- Fixed a segfault if the `max_temporary_non_const_columns` limit was exceeded. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### Improvements: {#improvements-1} + +- The server does not write the processed configuration files to the `/etc/clickhouse-server/` directory. Instead, it saves them in the `preprocessed_configs` directory inside `path`. This means that the `/etc/clickhouse-server/` directory doesn’t have write access for the `clickhouse` user, which improves security. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) +- The `min_merge_bytes_to_use_direct_io` option is set to 10 GiB by default. A merge that forms large parts of tables from the MergeTree family will be performed in `O_DIRECT` mode, which prevents excessive page cache eviction. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) +- Accelerated server start when there is a very large number of tables. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) +- Added a connection pool and HTTP `Keep-Alive` for connections between replicas. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) +- If the query syntax is invalid, the `400 Bad Request` code is returned in the `HTTP` interface (500 was returned previously). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) +- The `join_default_strictness` option is set to `ALL` by default for compatibility. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) +- Removed logging to `stderr` from the `re2` library for invalid or complex regular expressions. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) +- Added for the `Kafka` table engine: checks for subscriptions before beginning to read from Kafka; the kafka\_max\_block\_size setting for the table. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) +- The `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, and `murmurHash3_64` functions now work for any number of arguments and for arguments in the form of tuples. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) +- The `arrayReverse` function now works with any types of arrays. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- Added an optional parameter: the slot size for the `timeSlots` function. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) +- For `FULL` and `RIGHT JOIN`, the `max_block_size` setting is used for a stream of non-joined data from the right table. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3699) +- Added the `--secure` command line parameter in `clickhouse-benchmark` and `clickhouse-performance-test` to enable TLS. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) +- Type conversion when the structure of a `Buffer` type table does not match the structure of the destination table. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) +- Added the `tcp_keep_alive_timeout` option to enable keep-alive packets after inactivity for the specified time interval. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) +- Removed unnecessary quoting of values for the partition key in the `system.parts` table if it consists of a single column. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) +- The modulo function works for `Date` and `DateTime` data types. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) +- Added synonyms for the `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, and `MID` functions. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Some function names are case-insensitive for compatibility with the SQL standard. Added syntactic sugar `SUBSTRING(expr FROM start FOR length)` for compatibility with SQL. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) +- Added the ability to `mlock` memory pages corresponding to `clickhouse-server` executable code to prevent it from being forced out of memory. This feature is disabled by default. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) +- Improved performance when reading from `O_DIRECT` (with the `min_bytes_to_use_direct_io` option enabled). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) +- Improved performance of the `dictGet...OrDefault` function for a constant key argument and a non-constant default argument. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3563) +- The `firstSignificantSubdomain` function now processes the domains `gov`, `mil`, and `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Improved performance. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) +- Ability to specify custom environment variables for starting `clickhouse-server` using the `SYS-V init.d` script by defining `CLICKHOUSE_PROGRAM_ENV` in `/etc/default/clickhouse`. + [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) +- Correct return code for the clickhouse-server init script. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) +- The `system.metrics` table now has the `VersionInteger` metric, and `system.build_options` has the added line `VERSION_INTEGER`, which contains the numeric form of the ClickHouse version, such as `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) +- Removed the ability to compare the `Date` type with a number to avoid potential errors like `date = 2018-12-17`, where quotes around the date are omitted by mistake. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) +- Fixed the behavior of stateful functions like `rowNumberInAllBlocks`. They previously output a result that was one number larger due to starting during query analysis. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3729) +- If the `force_restore_data` file can’t be deleted, an error message is displayed. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3794) + +#### Build Improvements: {#build-improvements-1} + +- Updated the `jemalloc` library, which fixes a potential memory leak. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3557) +- Profiling with `jemalloc` is enabled by default in order to debug builds. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) +- Added the ability to run integration tests when only `Docker` is installed on the system. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) +- Added the fuzz expression test in SELECT queries. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) +- Added a stress test for commits, which performs functional tests in parallel and in random order to detect more race conditions. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) +- Improved the method for starting clickhouse-server in a Docker image. [Elghazal Ahmed](https://github.com/ClickHouse/ClickHouse/pull/3663) +- For a Docker image, added support for initializing databases using files in the `/docker-entrypoint-initdb.d` directory. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) +- Fixes for builds on ARM. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) + +#### Backward Incompatible Changes: {#backward-incompatible-changes} + +- Removed the ability to compare the `Date` type with a number. Instead of `toDate('2018-12-18') = 17883`, you must use explicit type conversion `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) + +## ClickHouse Release 18.14 {#clickhouse-release-18-14} + +### ClickHouse Release 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} + +#### Bug Fixes: {#bug-fixes-2} + +- Fixed an error that led to problems with updating dictionaries with the ODBC source. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- Databases are correctly specified when executing DDL `ON CLUSTER` queries. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Fixed a segfault if the `max_temporary_non_const_columns` limit was exceeded. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### Build Improvements: {#build-improvements-2} + +- Fixes for builds on ARM. + +### ClickHouse Release 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} + +#### Bug Fixes: {#bug-fixes-3} + +- Fixed error in `dictGet...` function for dictionaries of type `range`, if one of the arguments is constant and other is not. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) +- Fixed error that caused messages `netlink: '...': attribute type 1 has an invalid length` to be printed in Linux kernel log, that was happening only on fresh enough versions of Linux kernel. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) +- Fixed segfault in function `empty` for argument of `FixedString` type. [Daniel, Dao Quang Minh](https://github.com/ClickHouse/ClickHouse/pull/3703) +- Fixed excessive memory allocation when using large value of `max_query_size` setting (a memory chunk of `max_query_size` bytes was preallocated at once). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) + +#### Build Changes: {#build-changes} + +- Fixed build with LLVM/Clang libraries of version 7 from the OS packages (these libraries are used for runtime query compilation). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### ClickHouse Release 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} + +#### Bug Fixes: {#bug-fixes-4} + +- Fixed cases when the ODBC bridge process did not terminate with the main server process. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) +- Fixed synchronous insertion into the `Distributed` table with a columns list that differs from the column list of the remote table. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) +- Fixed a rare race condition that can lead to a crash when dropping a MergeTree table. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Fixed a query deadlock in case when query thread creation fails with the `Resource temporarily unavailable` error. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Fixed parsing of the `ENGINE` clause when the `CREATE AS table` syntax was used and the `ENGINE` clause was specified before the `AS table` (the error resulted in ignoring the specified engine). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) + +### ClickHouse Release 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} + +#### Bug Fixes: {#bug-fixes-5} + +- The size of memory chunk was overestimated while deserializing the column of type `Array(String)` that leads to “Memory limit exceeded” errors. The issue appeared in version 18.12.13. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) + +### ClickHouse Release 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} + +#### Bug Fixes: {#bug-fixes-6} + +- Fixed `ON CLUSTER` queries when cluster configured as secure (flag ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) + +#### Build Changes: {#build-changes-1} + +- Fixed problems (llvm-7 from system, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### ClickHouse Release 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} + +#### Bug Fixes: {#bug-fixes-7} + +- Fixed the `Block structure mismatch in MergingSorted stream` error. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) +- Fixed `ON CLUSTER` queries in case when secure connections were turned on in the cluster config (the `` flag). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) +- Fixed an error in queries that used `SAMPLE`, `PREWHERE` and alias columns. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) +- Fixed a rare `unknown compression method` error when the `min_bytes_to_use_direct_io` setting was enabled. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) + +#### Performance Improvements: {#performance-improvements} + +- Fixed performance regression of queries with `GROUP BY` of columns of UInt16 or Date type when executing on AMD EPYC processors. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) +- Fixed performance regression of queries that process long strings. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) + +#### Build Improvements: {#build-improvements-3} + +- Improvements for simplifying the Arcadia build. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) + +### ClickHouse Release 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} + +#### Bug Fixes: {#bug-fixes-8} + +- Fixed a crash on joining two unnamed subqueries. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) +- Fixed generating incorrect queries (with an empty `WHERE` clause) when querying external databases. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) +- Fixed using an incorrect timeout value in ODBC dictionaries. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) + +### ClickHouse Release 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} + +#### Bug Fixes: {#bug-fixes-9} + +- Fixed the error `Block structure mismatch in UNION stream: different number of columns` in LIMIT queries. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) +- Fixed errors when merging data in tables containing arrays inside Nested structures. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) +- Fixed incorrect query results if the `merge_tree_uniform_read_distribution` setting is disabled (it is enabled by default). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) +- Fixed an error on inserts to a Distributed table in Native format. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) + +### ClickHouse Release 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} + +- The `compile_expressions` setting (JIT compilation of expressions) is disabled by default. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) +- The `enable_optimize_predicate_expression` setting is disabled by default. + +### ClickHouse Release 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} + +#### New Features: {#new-features-1} + +- The `WITH CUBE` modifier for `GROUP BY` (the alternative syntax `GROUP BY CUBE(...)` is also available). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) +- Added the `formatDateTime` function. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) +- Added the `JDBC` table engine and `jdbc` table function (requires installing clickhouse-jdbc-bridge). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- Added functions for working with the ISO week number: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, and `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) +- Now you can use `Nullable` columns for `MySQL` and `ODBC` tables. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- Nested data structures can be read as nested objects in `JSONEachRow` format. Added the `input_format_import_nested_json` setting. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) +- Parallel processing is available for many `MATERIALIZED VIEW`s when inserting data. See the `parallel_view_processing` setting. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) +- Added the `SYSTEM FLUSH LOGS` query (forced log flushes to system tables such as `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) +- Now you can use pre-defined `database` and `table` macros when declaring `Replicated` tables. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) +- Added the ability to read `Decimal` type values in engineering notation (indicating powers of ten). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) + +#### Experimental Features: {#experimental-features} + +- Optimization of the GROUP BY clause for `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) +- Optimized calculation of expressions for `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) + +#### Improvements: {#improvements-2} + +- Significantly reduced memory consumption for queries with `ORDER BY` and `LIMIT`. See the `max_bytes_before_remerge_sort` setting. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- In the absence of `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` is assumed. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) +- Qualified asterisks work correctly in queries with `JOIN`. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) +- The `ODBC` table engine correctly chooses the method for quoting identifiers in the SQL dialect of a remote database. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- The `compile_expressions` setting (JIT compilation of expressions) is enabled by default. +- Fixed behavior for simultaneous DROP DATABASE/TABLE IF EXISTS and CREATE DATABASE/TABLE IF NOT EXISTS. Previously, a `CREATE DATABASE ... IF NOT EXISTS` query could return the error message “File … already exists”, and the `CREATE TABLE ... IF NOT EXISTS` and `DROP TABLE IF EXISTS` queries could return `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) +- LIKE and IN expressions with a constant right half are passed to the remote server when querying from MySQL or ODBC tables. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- Comparisons with constant expressions in a WHERE clause are passed to the remote server when querying from MySQL and ODBC tables. Previously, only comparisons with constants were passed. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- Correct calculation of row width in the terminal for `Pretty` formats, including strings with hieroglyphs. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3257). +- `ON CLUSTER` can be specified for `ALTER UPDATE` queries. +- Improved performance for reading data in `JSONEachRow` format. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) +- Added synonyms for the `LENGTH` and `CHARACTER_LENGTH` functions for compatibility. The `CONCAT` function is no longer case-sensitive. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) +- Added the `TIMESTAMP` synonym for the `DateTime` type. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) +- There is always space reserved for query\_id in the server logs, even if the log line is not related to a query. This makes it easier to parse server text logs with third-party tools. +- Memory consumption by a query is logged when it exceeds the next level of an integer number of gigabytes. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- Added compatibility mode for the case when the client library that uses the Native protocol sends fewer columns by mistake than the server expects for the INSERT query. This scenario was possible when using the clickhouse-cpp library. Previously, this scenario caused the server to crash. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) +- In a user-defined WHERE expression in `clickhouse-copier`, you can now use a `partition_key` alias (for additional filtering by source table partition). This is useful if the partitioning scheme changes during copying, but only changes slightly. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) +- The workflow of the `Kafka` engine has been moved to a background thread pool in order to automatically reduce the speed of data reading at high loads. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- Support for reading `Tuple` and `Nested` values of structures like `struct` in the `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) +- The list of top-level domains for the `firstSignificantSubdomain` function now includes the domain `biz`. [decaseal](https://github.com/ClickHouse/ClickHouse/pull/3219) +- In the configuration of external dictionaries, `null_value` is interpreted as the value of the default data type. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) +- Support for the `intDiv` and `intDivOrZero` functions for `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) +- Support for the `Date`, `DateTime`, `UUID`, and `Decimal` types as a key for the `sumMap` aggregate function. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) +- Support for the `Decimal` data type in external dictionaries. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) +- Support for the `Decimal` data type in `SummingMergeTree` tables. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) +- Added specializations for `UUID` in `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) +- Reduced the number of `open` and `close` system calls when reading from a `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) +- A `TRUNCATE TABLE` query can be executed on any replica (the query is passed to the leader replica). [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) + +#### Bug Fixes: {#bug-fixes-10} + +- Fixed an issue with `Dictionary` tables for `range_hashed` dictionaries. This error occurred in version 18.12.17. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) +- Fixed an error when loading `range_hashed` dictionaries (the message `Unsupported type Nullable (...)`). This error occurred in version 18.12.17. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- Fixed errors in the `pointInPolygon` function due to the accumulation of inaccurate calculations for polygons with a large number of vertices located close to each other. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) +- If after merging data parts, the checksum for the resulting part differs from the result of the same merge in another replica, the result of the merge is deleted and the data part is downloaded from the other replica (this is the correct behavior). But after downloading the data part, it couldn’t be added to the working set because of an error that the part already exists (because the data part was deleted with some delay after the merge). This led to cyclical attempts to download the same data. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) +- Fixed incorrect calculation of total memory consumption by queries (because of incorrect calculation, the `max_memory_usage_for_all_queries` setting worked incorrectly and the `MemoryTracking` metric had an incorrect value). This error occurred in version 18.12.13. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) +- Fixed the functionality of `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` This error occurred in version 18.12.13. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) +- Fixed unnecessary preparation of data structures for `JOIN`s on the server that initiates the query if the `JOIN` is only performed on remote servers. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) +- Fixed bugs in the `Kafka` engine: deadlocks after exceptions when starting to read data, and locks upon completion [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- For `Kafka` tables, the optional `schema` parameter was not passed (the schema of the `Cap'n'Proto` format). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) +- If the ensemble of ZooKeeper servers has servers that accept the connection but then immediately close it instead of responding to the handshake, ClickHouse chooses to connect another server. Previously, this produced the error `Cannot read all data. Bytes read: 0. Bytes expected: 4.` and the server couldn’t start. [8218cf3a](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) +- If the ensemble of ZooKeeper servers contains servers for which the DNS query returns an error, these servers are ignored. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) +- Fixed type conversion between `Date` and `DateTime` when inserting data in the `VALUES` format (if `input_format_values_interpret_expressions = 1`). Previously, the conversion was performed between the numerical value of the number of days in Unix Epoch time and the Unix timestamp, which led to unexpected results. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) +- Corrected type conversion between `Decimal` and integer numbers. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) +- Fixed errors in the `enable_optimize_predicate_expression` setting. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) +- Fixed a parsing error in CSV format with floating-point numbers if a non-default CSV separator is used, such as `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) +- Fixed the `arrayCumSumNonNegative` function (it does not accumulate negative values if the accumulator is less than zero). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) +- Fixed how `Merge` tables work on top of `Distributed` tables when using `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) +- Bug fixes in the `ALTER UPDATE` query. +- Fixed bugs in the `odbc` table function that appeared in version 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) +- Fixed the operation of aggregate functions with `StateArray` combinators. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) +- Fixed a crash when dividing a `Decimal` value by zero. [69dd6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) +- Fixed output of types for operations using `Decimal` and integer arguments. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) +- Fixed the segfault during `GROUP BY` on `Decimal128`. [3359ba06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) +- The `log_query_threads` setting (logging information about each thread of query execution) now takes effect only if the `log_queries` option (logging information about queries) is set to 1. Since the `log_query_threads` option is enabled by default, information about threads was previously logged even if query logging was disabled. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) +- Fixed an error in the distributed operation of the quantiles aggregate function (the error message `Not found column quantile...`). [292a8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) +- Fixed the compatibility problem when working on a cluster of version 18.12.17 servers and older servers at the same time. For distributed queries with GROUP BY keys of both fixed and non-fixed length, if there was a large amount of data to aggregate, the returned data was not always fully aggregated (two different rows contained the same aggregation keys). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) +- Fixed handling of substitutions in `clickhouse-performance-test`, if the query contains only part of the substitutions declared in the test. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) +- Fixed an error when using `FINAL` with `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Fixed an error when using `PREWHERE` over columns that were added during `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Added a check for the absence of `arrayJoin` for `DEFAULT` and `MATERIALIZED` expressions. Previously, `arrayJoin` led to an error when inserting data. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) +- Added a check for the absence of `arrayJoin` in a `PREWHERE` clause. Previously, this led to messages like `Size ... doesn't match` or `Unknown compression method` when executing queries. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) +- Fixed segfault that could occur in rare cases after optimization that replaced AND chains from equality evaluations with the corresponding IN expression. [liuyimin-bytedance](https://github.com/ClickHouse/ClickHouse/pull/3339) +- Minor corrections to `clickhouse-benchmark`: previously, client information was not sent to the server; now the number of queries executed is calculated more accurately when shutting down and for limiting the number of iterations. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) + +#### Backward Incompatible Changes: {#backward-incompatible-changes-1} + +- Removed the `allow_experimental_decimal_type` option. The `Decimal` data type is available for default use. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) + +## ClickHouse Release 18.12 {#clickhouse-release-18-12} + +### ClickHouse Release 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} + +#### New Features: {#new-features-2} + +- `invalidate_query` (the ability to specify a query to check whether an external dictionary needs to be updated) is implemented for the `clickhouse` source. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) +- Added the ability to use `UInt*`, `Int*`, and `DateTime` data types (along with the `Date` type) as a `range_hashed` external dictionary key that defines the boundaries of ranges. Now `NULL` can be used to designate an open range. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) +- The `Decimal` type now supports `var*` and `stddev*` aggregate functions. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- The `Decimal` type now supports mathematical functions (`exp`, `sin` and so on.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- The `system.part_log` table now has the `partition_id` column. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Bug Fixes: {#bug-fixes-11} + +- `Merge` now works correctly on `Distributed` tables. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) +- Fixed incompatibility (unnecessary dependency on the `glibc` version) that made it impossible to run ClickHouse on `Ubuntu Precise` and older versions. The incompatibility arose in version 18.12.13. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) +- Fixed errors in the `enable_optimize_predicate_expression` setting. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) +- Fixed a minor issue with backwards compatibility that appeared when working with a cluster of replicas on versions earlier than 18.12.13 and simultaneously creating a new replica of a table on a server with a newer version (shown in the message `Can not clone replica, because the ... updated to new ClickHouse version`, which is logical, but shouldn’t happen). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) + +#### Backward Incompatible Changes: {#backward-incompatible-changes-2} + +- The `enable_optimize_predicate_expression` option is enabled by default (which is rather optimistic). If query analysis errors occur that are related to searching for the column names, set `enable_optimize_predicate_expression` to 0. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) + +### ClickHouse Release 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} + +#### New Features: {#new-features-3} + +- Added support for `ALTER UPDATE` queries. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) +- Added the `allow_ddl` option, which restricts the user’s access to DDL queries. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) +- Added the `min_merge_bytes_to_use_direct_io` option for `MergeTree` engines, which allows you to set a threshold for the total size of the merge (when above the threshold, data part files will be handled using O\_DIRECT). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) +- The `system.merges` system table now contains the `partition_id` column. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) + +#### Improvements {#improvements-3} + +- If a data part remains unchanged during mutation, it isn’t downloaded by replicas. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) +- Autocomplete is available for names of settings when working with `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) + +#### Bug Fixes: {#bug-fixes-12} + +- Added a check for the sizes of arrays that are elements of `Nested` type fields when inserting. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) +- Fixed an error updating external dictionaries with the `ODBC` source and `hashed` storage. This error occurred in version 18.12.13. +- Fixed a crash when creating a temporary table from a query with an `IN` condition. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) +- Fixed an error in aggregate functions for arrays that can have `NULL` elements. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) + +### ClickHouse Release 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} + +#### New Features: {#new-features-4} + +- Added the `DECIMAL(digits, scale)` data type (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). To enable it, use the setting `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) +- New `WITH ROLLUP` modifier for `GROUP BY` (alternative syntax: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) +- In queries with JOIN, the star character expands to a list of columns in all tables, in compliance with the SQL standard. You can restore the old behavior by setting `asterisk_left_columns_only` to 1 on the user configuration level. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) +- Added support for JOIN with table functions. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- Autocomplete by pressing Tab in clickhouse-client. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) +- Ctrl+C in clickhouse-client clears a query that was entered. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) +- Added the `join_default_strictness` setting (values: `"`, `'any'`, `'all'`). This allows you to not specify `ANY` or `ALL` for `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) +- Each line of the server log related to query processing shows the query ID. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Now you can get query execution logs in clickhouse-client (use the `send_logs_level` setting). With distributed query processing, logs are cascaded from all the servers. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- The `system.query_log` and `system.processes` (`SHOW PROCESSLIST`) tables now have information about all changed settings when you run a query (the nested structure of the `Settings` data). Added the `log_query_settings` setting. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- The `system.query_log` and `system.processes` tables now show information about the number of threads that are participating in query execution (see the `thread_numbers` column). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Added `ProfileEvents` counters that measure the time spent on reading and writing over the network and reading and writing to disk, the number of network errors, and the time spent waiting when network bandwidth is limited. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Added `ProfileEvents`counters that contain the system metrics from rusage (you can use them to get information about CPU usage in userspace and the kernel, page faults, and context switches), as well as taskstats metrics (use these to obtain information about I/O wait time, CPU wait time, and the amount of data read and recorded, both with and without page cache). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- The `ProfileEvents` counters are applied globally and for each query, as well as for each query execution thread, which allows you to profile resource consumption by query in detail. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Added the `system.query_thread_log` table, which contains information about each query execution thread. Added the `log_query_threads` setting. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- The `system.metrics` and `system.events` tables now have built-in documentation. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) +- Added the `arrayEnumerateDense` function. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2975) +- Added the `arrayCumSumNonNegative` and `arrayDifference` functions. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) +- Added the `retention` aggregate function. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) +- Now you can add (merge) states of aggregate functions by using the plus operator, and multiply the states of aggregate functions by a nonnegative constant. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) +- Tables in the MergeTree family now have the virtual column `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Experimental Features: {#experimental-features-1} + +- Added the `LowCardinality(T)` data type. This data type automatically creates a local dictionary of values and allows data processing without unpacking the dictionary. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) +- Added a cache of JIT-compiled functions and a counter for the number of uses before compiling. To JIT compile expressions, enable the `compile_expressions` setting. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) + +#### Improvements: {#improvements-4} + +- Fixed the problem with unlimited accumulation of the replication log when there are abandoned replicas. Added an effective recovery mode for replicas with a long lag. +- Improved performance of `GROUP BY` with multiple aggregation fields when one of them is string and the others are fixed length. +- Improved performance when using `PREWHERE` and with implicit transfer of expressions in `PREWHERE`. +- Improved parsing performance for text formats (`CSV`, `TSV`). [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) +- Improved performance of reading strings and arrays in binary formats. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2955) +- Increased performance and reduced memory consumption for queries to `system.tables` and `system.columns` when there is a very large number of tables on a single server. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) +- Fixed a performance problem in the case of a large stream of queries that result in an error (the `_dl_addr` function is visible in `perf top`, but the server isn’t using much CPU). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) +- Conditions are cast into the View (when `enable_optimize_predicate_expression` is enabled). [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- Improvements to the functionality for the `UUID` data type. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) +- The `UUID` data type is supported in The-Alchemist dictionaries. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) +- The `visitParamExtractRaw` function works correctly with nested structures. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) +- When the `input_format_skip_unknown_fields` setting is enabled, object fields in `JSONEachRow` format are skipped correctly. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) +- For a `CASE` expression with conditions, you can now omit `ELSE`, which is equivalent to `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) +- The operation timeout can now be configured when working with ZooKeeper. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) +- You can specify an offset for `LIMIT n, m` as `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- You can use the `SELECT TOP n` syntax as an alternative for `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- Increased the size of the queue to write to system tables, so the `SystemLog parameter queue is full` error doesn’t happen as often. +- The `windowFunnel` aggregate function now supports events that meet multiple conditions. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2801) +- Duplicate columns can be used in a `USING` clause for `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) +- `Pretty` formats now have a limit on column alignment by width. Use the `output_format_pretty_max_column_pad_width` setting. If a value is wider, it will still be displayed in its entirety, but the other cells in the table will not be too wide. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) +- The `odbc` table function now allows you to specify the database/schema name. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2885) +- Added the ability to use a username specified in the `clickhouse-client` config file. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) +- The `ZooKeeperExceptions` counter has been split into three counters: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, and `ZooKeeperOtherExceptions`. +- `ALTER DELETE` queries work for materialized views. +- Added randomization when running the cleanup thread periodically for `ReplicatedMergeTree` tables in order to avoid periodic load spikes when there are a very large number of `ReplicatedMergeTree` tables. +- Support for `ATTACH TABLE ... ON CLUSTER` queries. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) + +#### Bug Fixes: {#bug-fixes-13} + +- Fixed an issue with `Dictionary` tables (throws the `Size of offsets doesn't match size of column` or `Unknown compression method` exception). This bug appeared in version 18.10.3. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) +- Fixed a bug when merging `CollapsingMergeTree` tables if one of the data parts is empty (these parts are formed during merge or `ALTER DELETE` if all data was deleted), and the `vertical` algorithm was used for the merge. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) +- Fixed a race condition during `DROP` or `TRUNCATE` for `Memory` tables with a simultaneous `SELECT`, which could lead to server crashes. This bug appeared in version 1.1.54388. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) +- Fixed the possibility of data loss when inserting in `Replicated` tables if the `Session is expired` error is returned (data loss can be detected by the `ReplicatedDataLoss` metric). This error occurred in version 1.1.54378. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) +- Fixed a segfault during `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) +- Fixed the error searching column names when the `WHERE` expression consists entirely of a qualified column name, such as `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) +- Fixed the “Not found column” error that occurred when executing distributed queries if a single column consisting of an IN expression with a subquery is requested from a remote server. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) +- Fixed the `Block structure mismatch in UNION stream: different number of columns` error that occurred for distributed queries if one of the shards is local and the other is not, and optimization of the move to `PREWHERE` is triggered. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) +- Fixed the `pointInPolygon` function for certain cases of non-convex polygons. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) +- Fixed the incorrect result when comparing `nan` with integers. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) +- Fixed an error in the `zlib-ng` library that could lead to segfault in rare cases. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) +- Fixed a memory leak when inserting into a table with `AggregateFunction` columns, if the state of the aggregate function is not simple (allocates memory separately), and if a single insertion request results in multiple small blocks. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) +- Fixed a race condition when creating and deleting the same `Buffer` or `MergeTree` table simultaneously. +- Fixed the possibility of a segfault when comparing tuples made up of certain non-trivial types, such as tuples. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) +- Fixed the possibility of a segfault when running certain `ON CLUSTER` queries. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) +- Fixed an error in the `arrayDistinct` function for `Nullable` array elements. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) +- The `enable_optimize_predicate_expression` option now correctly supports cases with `SELECT *`. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) +- Fixed the segfault when re-initializing the ZooKeeper session. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) +- Fixed potential blocking when working with ZooKeeper. +- Fixed incorrect code for adding nested data structures in a `SummingMergeTree`. +- When allocating memory for states of aggregate functions, alignment is correctly taken into account, which makes it possible to use operations that require alignment when implementing states of aggregate functions. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) + +#### Security Fix: {#security-fix} + +- Safe use of ODBC data sources. Interaction with ODBC drivers uses a separate `clickhouse-odbc-bridge` process. Errors in third-party ODBC drivers no longer cause problems with server stability or vulnerabilities. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) +- Fixed incorrect validation of the file path in the `catBoostPool` table function. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) +- The contents of system tables (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, and `replication_queue`) are filtered according to the user’s configured access to databases (`allow_databases`). [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) + +#### Backward Incompatible Changes: {#backward-incompatible-changes-3} + +- In queries with JOIN, the star character expands to a list of columns in all tables, in compliance with the SQL standard. You can restore the old behavior by setting `asterisk_left_columns_only` to 1 on the user configuration level. + +#### Build Changes: {#build-changes-2} + +- Most integration tests can now be run by commit. +- Code style checks can also be run by commit. +- The `memcpy` implementation is chosen correctly when building on CentOS7/Fedora. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) +- When using clang to build, some warnings from `-Weverything` have been added, in addition to the regular `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) +- Debugging the build uses the `jemalloc` debug option. +- The interface of the library for interacting with ZooKeeper is declared abstract. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) + +## ClickHouse Release 18.10 {#clickhouse-release-18-10} + +### ClickHouse Release 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} + +#### New Features: {#new-features-5} + +- HTTPS can be used for replication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) +- Added the functions `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, and `murmurHash3_128` in addition to the existing `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) +- Support for Nullable types in the ClickHouse ODBC driver (`ODBCDriver2` output format). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) +- Support for `UUID` in the key columns. + +#### Improvements: {#improvements-5} + +- Clusters can be removed without restarting the server when they are deleted from the config files. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) +- External dictionaries can be removed without restarting the server when they are removed from config files. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) +- Added `SETTINGS` support for the `Kafka` table engine. [Alexander Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) +- Improvements for the `UUID` data type (not yet complete). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) +- Support for empty parts after merges in the `SummingMergeTree`, `CollapsingMergeTree` and `VersionedCollapsingMergeTree` engines. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) +- Old records of completed mutations are deleted (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) +- Added the `system.merge_tree_settings` table. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) +- The `system.tables` table now has dependency columns: `dependencies_database` and `dependencies_table`. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) +- Added the `max_partition_size_to_drop` config option. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) +- Added the `output_format_json_escape_forward_slashes` option. [Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2812) +- Added the `max_fetch_partition_retries_count` setting. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) +- Added the `prefer_localhost_replica` setting for disabling the preference for a local replica and going to a local replica without inter-process interaction. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) +- The `quantileExact` aggregate function returns `nan` in the case of aggregation on an empty `Float32` or `Float64` set. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) + +#### Bug Fixes: {#bug-fixes-14} + +- Removed unnecessary escaping of the connection string parameters for ODBC, which made it impossible to establish a connection. This error occurred in version 18.6.0. +- Fixed the logic for processing `REPLACE PARTITION` commands in the replication queue. If there are two `REPLACE` commands for the same partition, the incorrect logic could cause one of them to remain in the replication queue and not be executed. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) +- Fixed a merge bug when all data parts were empty (parts that were formed from a merge or from `ALTER DELETE` if all data was deleted). This bug appeared in version 18.1.0. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) +- Fixed an error for concurrent `Set` or `Join`. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2823) +- Fixed the `Block structure mismatch in UNION stream: different number of columns` error that occurred for `UNION ALL` queries inside a sub-query if one of the `SELECT` queries contains duplicate column names. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) +- Fixed a memory leak if an exception occurred when connecting to a MySQL server. +- Fixed incorrect clickhouse-client response code in case of a query error. +- Fixed incorrect behavior of materialized views containing DISTINCT. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) + +#### Backward Incompatible Changes {#backward-incompatible-changes-4} + +- Removed support for CHECK TABLE queries for Distributed tables. + +#### Build Changes: {#build-changes-3} + +- The allocator has been replaced: `jemalloc` is now used instead of `tcmalloc`. In some scenarios, this increases speed up to 20%. However, there are queries that have slowed by up to 20%. Memory consumption has been reduced by approximately 10% in some scenarios, with improved stability. With highly competitive loads, CPU usage in userspace and in system shows just a slight increase. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) +- Use of libressl from a submodule. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) +- Use of unixodbc from a submodule. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) +- Use of mariadb-connector-c from a submodule. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) +- Added functional test files to the repository that depend on the availability of test data (for the time being, without the test data itself). + +## ClickHouse Release 18.6 {#clickhouse-release-18-6} + +### ClickHouse Release 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} + +#### New Features: {#new-features-6} + +- Added support for ON expressions for the JOIN ON syntax: + `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` + The expression must be a chain of equalities joined by the AND operator. Each side of the equality can be an arbitrary expression over the columns of one of the tables. The use of fully qualified column names is supported (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) for the right table. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) +- HTTPS can be enabled for replication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) + +#### Improvements: {#improvements-6} + +- The server passes the patch component of its version to the client. Data about the patch version component is in `system.processes` and `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) + +## ClickHouse Release 18.5 {#clickhouse-release-18-5} + +### ClickHouse Release 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} + +#### New Features: {#new-features-7} + +- Added the hash function `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). + +#### Improvements: {#improvements-7} + +- Now you can use the `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) attribute to set values in config files from environment variables. +- Added case-insensitive versions of the `coalesce`, `ifNull`, and `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). + +#### Bug Fixes: {#bug-fixes-15} + +- Fixed a possible bug when starting a replica [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). + +## ClickHouse Release 18.4 {#clickhouse-release-18-4} + +### ClickHouse Release 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} + +#### New Features: {#new-features-8} + +- Added system tables: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). +- Added the ability to use a table function instead of a table as an argument of a `remote` or `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). +- Support for `HTTP Basic` authentication in the replication protocol [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). +- The `has` function now allows searching for a numeric value in an array of `Enum` values [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). +- Support for adding arbitrary message separators when reading from `Kafka` [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2701). + +#### Improvements: {#improvements-8} + +- The `ALTER TABLE t DELETE WHERE` query does not rewrite data parts that were not affected by the WHERE condition [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). +- The `use_minimalistic_checksums_in_zookeeper` option for `ReplicatedMergeTree` tables is enabled by default. This setting was added in version 1.1.54378, 2018-04-16. Versions that are older than 1.1.54378 can no longer be installed. +- Support for running `KILL` and `OPTIMIZE` queries that specify `ON CLUSTER` [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). + +#### Bug Fixes: {#bug-fixes-16} + +- Fixed the error `Column ... is not under an aggregate function and not in GROUP BY` for aggregation with an IN expression. This bug appeared in version 18.1.0. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) +- Fixed a bug in the `windowFunnel aggregate function` [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). +- Fixed a bug in the `anyHeavy` aggregate function ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) +- Fixed server crash when using the `countArray()` aggregate function. + +#### Backward Incompatible Changes: {#backward-incompatible-changes-5} + +- Parameters for `Kafka` engine was changed from `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` to `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. If your tables use `kafka_schema` or `kafka_num_consumers` parameters, you have to manually edit the metadata files `path/metadata/database/table.sql` and add `kafka_row_delimiter` parameter with `''` value. + +## ClickHouse Release 18.1 {#clickhouse-release-18-1} + +### ClickHouse Release 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} + +#### New Features: {#new-features-9} + +- Support for the `ALTER TABLE t DELETE WHERE` query for non-replicated MergeTree tables ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). +- Support for arbitrary types for the `uniq*` family of aggregate functions ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). +- Support for arbitrary types in comparison operators ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). +- The `users.xml` file allows setting a subnet mask in the format `10.0.0.1/255.255.255.0`. This is necessary for using masks for IPv6 networks with zeros in the middle ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). +- Added the `arrayDistinct` function ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). +- The SummingMergeTree engine can now work with AggregateFunction type columns ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). + +#### Improvements: {#improvements-9} + +- Changed the numbering scheme for release versions. Now the first part contains the year of release (A.D., Moscow timezone, minus 2000), the second part contains the number for major changes (increases for most releases), and the third part is the patch version. Releases are still backward compatible, unless otherwise stated in the changelog. +- Faster conversions of floating-point numbers to a string ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2664)). +- If some rows were skipped during an insert due to parsing errors (this is possible with the `input_allow_errors_num` and `input_allow_errors_ratio` settings enabled), the number of skipped rows is now written to the server log ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). + +#### Bug Fixes: {#bug-fixes-17} + +- Fixed the TRUNCATE command for temporary tables ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2624)). +- Fixed a rare deadlock in the ZooKeeper client library that occurred when there was a network error while reading the response ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). +- Fixed an error during a CAST to Nullable types ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). +- Fixed the incorrect result of the `maxIntersection()` function when the boundaries of intervals coincided ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). +- Fixed incorrect transformation of the OR expression chain in a function argument ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). +- Fixed performance degradation for queries containing `IN (subquery)` expressions inside another subquery ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). +- Fixed incompatibility between servers with different versions in distributed queries that use a `CAST` function that isn’t in uppercase letters ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). +- Added missing quoting of identifiers for queries to an external DBMS ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). + +#### Backward Incompatible Changes: {#backward-incompatible-changes-6} + +- Converting a string containing the number zero to DateTime does not work. Example: `SELECT toDateTime('0')`. This is also the reason that `DateTime DEFAULT '0'` does not work in tables, as well as `0` in dictionaries. Solution: replace `0` with `0000-00-00 00:00:00`. + +## ClickHouse Release 1.1 {#clickhouse-release-1-1} + +### ClickHouse Release 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} + +#### New Features: {#new-features-10} + +- Added the `histogram` aggregate function ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). +- Now `OPTIMIZE TABLE ... FINAL` can be used without specifying partitions for `ReplicatedMergeTree` ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2600)). + +#### Bug Fixes: {#bug-fixes-18} + +- Fixed a problem with a very small timeout for sockets (one second) for reading and writing when sending and downloading replicated data, which made it impossible to download larger parts if there is a load on the network or disk (it resulted in cyclical attempts to download parts). This error occurred in version 1.1.54388. +- Fixed issues when using chroot in ZooKeeper if you inserted duplicate data blocks in the table. +- The `has` function now works correctly for an array with Nullable elements ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). +- The `system.tables` table now works correctly when used in distributed queries. The `metadata_modification_time` and `engine_full` columns are now non-virtual. Fixed an error that occurred if only these columns were queried from the table. +- Fixed how an empty `TinyLog` table works after inserting an empty data block ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). +- The `system.zookeeper` table works if the value of the node in ZooKeeper is NULL. + +### ClickHouse Release 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} + +#### New Features: {#new-features-11} + +- Queries can be sent in `multipart/form-data` format (in the `query` field), which is useful if external data is also sent for query processing ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). +- Added the ability to enable or disable processing single or double quotes when reading data in CSV format. You can configure this in the `format_csv_allow_single_quotes` and `format_csv_allow_double_quotes` settings ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2574)). +- Now `OPTIMIZE TABLE ... FINAL` can be used without specifying the partition for non-replicated variants of `MergeTree` ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2599)). + +#### Improvements: {#improvements-10} + +- Improved performance, reduced memory consumption, and correct memory consumption tracking with use of the IN operator when a table index could be used ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). +- Removed redundant checking of checksums when adding a data part. This is important when there are a large number of replicas, because in these cases the total number of checks was equal to N^2. +- Added support for `Array(Tuple(...))` arguments for the `arrayEnumerateUniq` function ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). +- Added `Nullable` support for the `runningDifference` function ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). +- Improved query analysis performance when there is a very large number of expressions ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). +- Faster selection of data parts for merging in `ReplicatedMergeTree` tables. Faster recovery of the ZooKeeper session ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). +- The `format_version.txt` file for `MergeTree` tables is re-created if it is missing, which makes sense if ClickHouse is launched after copying the directory structure without files ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). + +#### Bug Fixes: {#bug-fixes-19} + +- Fixed a bug when working with ZooKeeper that could make it impossible to recover the session and readonly states of tables before restarting the server. +- Fixed a bug when working with ZooKeeper that could result in old nodes not being deleted if the session is interrupted. +- Fixed an error in the `quantileTDigest` function for Float arguments (this bug was introduced in version 1.1.54388) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). +- Fixed a bug in the index for MergeTree tables if the primary key column is located inside the function for converting types between signed and unsigned integers of the same size ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). +- Fixed segfault if `macros` are used but they aren’t in the config file ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). +- Fixed switching to the default database when reconnecting the client ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). +- Fixed a bug that occurred when the `use_index_for_in_with_subqueries` setting was disabled. + +#### Security Fix: {#security-fix-1} + +- Sending files is no longer possible when connected to MySQL (`LOAD DATA LOCAL INFILE`). + +### ClickHouse Release 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} + +#### New Features: {#new-features-12} + +- Support for the `ALTER TABLE t DELETE WHERE` query for replicated tables. Added the `system.mutations` table to track progress of this type of queries. +- Support for the `ALTER TABLE t [REPLACE|ATTACH] PARTITION` query for \*MergeTree tables. +- Support for the `TRUNCATE TABLE` query ([Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) +- Several new `SYSTEM` queries for replicated tables (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). +- Added the ability to write to a table with the MySQL engine and the corresponding table function ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). +- Added the `url()` table function and the `URL` table engine ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). +- Added the `windowFunnel` aggregate function ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). +- New `startsWith` and `endsWith` functions for strings ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). +- The `numbers()` table function now allows you to specify the offset ([Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). +- The password to `clickhouse-client` can be entered interactively. +- Server logs can now be sent to syslog ([Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). +- Support for logging in dictionaries with a shared library source ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). +- Support for custom CSV delimiters ([Ivan Zhukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) +- Added the `date_time_input_format` setting. If you switch this setting to `'best_effort'`, DateTime values will be read in a wide range of formats. +- Added the `clickhouse-obfuscator` utility for data obfuscation. Usage example: publishing data used in performance tests. + +#### Experimental Features: {#experimental-features-2} + +- Added the ability to calculate `and` arguments only where they are needed ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) +- JIT compilation to native code is now available for some expressions ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). + +#### Bug Fixes: {#bug-fixes-20} + +- Duplicates no longer appear for a query with `DISTINCT` and `ORDER BY`. +- Queries with `ARRAY JOIN` and `arrayFilter` no longer return an incorrect result. +- Fixed an error when reading an array column from a Nested structure ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). +- Fixed an error when analyzing queries with a HAVING clause like `HAVING tuple IN (...)`. +- Fixed an error when analyzing queries with recursive aliases. +- Fixed an error when reading from ReplacingMergeTree with a condition in PREWHERE that filters all rows ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). +- User profile settings were not applied when using sessions in the HTTP interface. +- Fixed how settings are applied from the command line parameters in clickhouse-local. +- The ZooKeeper client library now uses the session timeout received from the server. +- Fixed a bug in the ZooKeeper client library when the client waited for the server response longer than the timeout. +- Fixed pruning of parts for queries with conditions on partition key columns ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). +- Merges are now possible after `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). +- Type mapping in the ODBC table function has been fixed ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). +- Type comparisons have been fixed for `DateTime` with and without the time zone ([Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). +- Fixed syntactic parsing and formatting of the `CAST` operator. +- Fixed insertion into a materialized view for the Distributed table engine ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). +- Fixed a race condition when writing data from the `Kafka` engine to materialized views ([Yangkuan Liu](https://github.com/ClickHouse/ClickHouse/pull/2448)). +- Fixed SSRF in the remote() table function. +- Fixed exit behavior of `clickhouse-client` in multiline mode ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). + +#### Improvements: {#improvements-11} + +- Background tasks in replicated tables are now performed in a thread pool instead of in separate threads ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). +- Improved LZ4 compression performance. +- Faster analysis for queries with a large number of JOINs and sub-queries. +- The DNS cache is now updated automatically when there are too many network errors. +- Table inserts no longer occur if the insert into one of the materialized views is not possible because it has too many parts. +- Corrected the discrepancy in the event counters `Query`, `SelectQuery`, and `InsertQuery`. +- Expressions like `tuple IN (SELECT tuple)` are allowed if the tuple types match. +- A server with replicated tables can start even if you haven’t configured ZooKeeper. +- When calculating the number of available CPU cores, limits on cgroups are now taken into account ([Atri Sharma](https://github.com/ClickHouse/ClickHouse/pull/2325)). +- Added chown for config directories in the systemd config file ([Mikhail Shiryaev](https://github.com/ClickHouse/ClickHouse/pull/2421)). + +#### Build Changes: {#build-changes-4} + +- The gcc8 compiler can be used for builds. +- Added the ability to build llvm from submodule. +- The version of the librdkafka library has been updated to v0.11.4. +- Added the ability to use the system libcpuid library. The library version has been updated to 0.4.0. +- Fixed the build using the vectorclass library ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). +- Cmake now generates files for ninja by default (like when using `-G Ninja`). +- Added the ability to use the libtinfo library instead of libtermcap ([Georgy Kondratiev](https://github.com/ClickHouse/ClickHouse/pull/2519)). +- Fixed a header file conflict in Fedora Rawhide ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). + +#### Backward Incompatible Changes: {#backward-incompatible-changes-7} + +- Removed escaping in `Vertical` and `Pretty*` formats and deleted the `VerticalRaw` format. +- If servers with version 1.1.54388 (or newer) and servers with an older version are used simultaneously in a distributed query and the query has the `cast(x, 'Type')` expression without the `AS` keyword and doesn’t have the word `cast` in uppercase, an exception will be thrown with a message like `Not found column cast(0, 'UInt8') in block`. Solution: Update the server on the entire cluster. + +### ClickHouse Release 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} + +#### Bug Fixes: {#bug-fixes-21} + +- Fixed an error that in some cases caused ZooKeeper operations to block. + +### ClickHouse Release 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} + +#### Bug Fixes: {#bug-fixes-22} + +- Fixed a slowdown of replication queue if a table has many replicas. + +### ClickHouse Release 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} + +#### Bug Fixes: {#bug-fixes-23} + +- Fixed a nodes leak in ZooKeeper when ClickHouse loses connection to ZooKeeper server. + +### ClickHouse Release 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} + +#### New Features: {#new-features-13} + +- Added the table function `file(path, format, structure)`. An example reading bytes from `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. + +#### Improvements: {#improvements-12} + +- Subqueries can be wrapped in `()` brackets to enhance query readability. For example: `(SELECT 1) UNION ALL (SELECT 1)`. +- Simple `SELECT` queries from the `system.processes` table are not included in the `max_concurrent_queries` limit. + +#### Bug Fixes: {#bug-fixes-24} + +- Fixed incorrect behavior of the `IN` operator when select from `MATERIALIZED VIEW`. +- Fixed incorrect filtering by partition index in expressions like `partition_key_column IN (...)`. +- Fixed inability to execute `OPTIMIZE` query on non-leader replica if `REANAME` was performed on the table. +- Fixed the authorization error when executing `OPTIMIZE` or `ALTER` queries on a non-leader replica. +- Fixed freezing of `KILL QUERY`. +- Fixed an error in ZooKeeper client library which led to loss of watches, freezing of distributed DDL queue, and slowdowns in the replication queue if a non-empty `chroot` prefix is used in the ZooKeeper configuration. + +#### Backward Incompatible Changes: {#backward-incompatible-changes-8} + +- Removed support for expressions like `(a, b) IN (SELECT (a, b))` (you can use the equivalent expression `(a, b) IN (SELECT a, b)`). In previous releases, these expressions led to undetermined `WHERE` filtering or caused errors. + +### ClickHouse Release 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} + +#### New Features: {#new-features-14} + +- Logging level can be changed without restarting the server. +- Added the `SHOW CREATE DATABASE` query. +- The `query_id` can be passed to `clickhouse-client` (elBroom). +- New setting: `max_network_bandwidth_for_all_users`. +- Added support for `ALTER TABLE ... PARTITION ...` for `MATERIALIZED VIEW`. +- Added information about the size of data parts in uncompressed form in the system table. +- Server-to-server encryption support for distributed tables (`1` in the replica config in ``). +- Configuration of the table level for the `ReplicatedMergeTree` family in order to minimize the amount of data stored in Zookeeper: : `use_minimalistic_checksums_in_zookeeper = 1` +- Configuration of the `clickhouse-client` prompt. By default, server names are now output to the prompt. The server’s display name can be changed. It’s also sent in the `X-ClickHouse-Display-Name` HTTP header (Kirill Shvakov). +- Multiple comma-separated `topics` can be specified for the `Kafka` engine (Tobias Adamson) +- When a query is stopped by `KILL QUERY` or `replace_running_query`, the client receives the `Query was canceled` exception instead of an incomplete result. + +#### Improvements: {#improvements-13} + +- `ALTER TABLE ... DROP/DETACH PARTITION` queries are run at the front of the replication queue. +- `SELECT ... FINAL` and `OPTIMIZE ... FINAL` can be used even when the table has a single data part. +- A `query_log` table is recreated on the fly if it was deleted manually (Kirill Shvakov). +- The `lengthUTF8` function runs faster (zhang2014). +- Improved performance of synchronous inserts in `Distributed` tables (`insert_distributed_sync = 1`) when there is a very large number of shards. +- The server accepts the `send_timeout` and `receive_timeout` settings from the client and applies them when connecting to the client (they are applied in reverse order: the server socket’s `send_timeout` is set to the `receive_timeout` value received from the client, and vice versa). +- More robust crash recovery for asynchronous insertion into `Distributed` tables. +- The return type of the `countEqual` function changed from `UInt32` to `UInt64` (谢磊). + +#### Bug Fixes: {#bug-fixes-25} + +- Fixed an error with `IN` when the left side of the expression is `Nullable`. +- Correct results are now returned when using tuples with `IN` when some of the tuple components are in the table index. +- The `max_execution_time` limit now works correctly with distributed queries. +- Fixed errors when calculating the size of composite columns in the `system.columns` table. +- Fixed an error when creating a temporary table `CREATE TEMPORARY TABLE IF NOT EXISTS.` +- Fixed errors in `StorageKafka` (\#\#2075) +- Fixed server crashes from invalid arguments of certain aggregate functions. +- Fixed the error that prevented the `DETACH DATABASE` query from stopping background tasks for `ReplicatedMergeTree` tables. +- `Too many parts` state is less likely to happen when inserting into aggregated materialized views (\#\#2084). +- Corrected recursive handling of substitutions in the config if a substitution must be followed by another substitution on the same level. +- Corrected the syntax in the metadata file when creating a `VIEW` that uses a query with `UNION ALL`. +- `SummingMergeTree` now works correctly for summation of nested data structures with a composite key. +- Fixed the possibility of a race condition when choosing the leader for `ReplicatedMergeTree` tables. + +#### Build Changes: {#build-changes-5} + +- The build supports `ninja` instead of `make` and uses `ninja` by default for building releases. +- Renamed packages: `clickhouse-server-base` in `clickhouse-common-static`; `clickhouse-server-common` in `clickhouse-server`; `clickhouse-common-dbg` in `clickhouse-common-static-dbg`. To install, use `clickhouse-server clickhouse-client`. Packages with the old names will still load in the repositories for backward compatibility. + +#### Backward Incompatible Changes: {#backward-incompatible-changes-9} + +- Removed the special interpretation of an IN expression if an array is specified on the left side. Previously, the expression `arr IN (set)` was interpreted as “at least one `arr` element belongs to the `set`”. To get the same behavior in the new version, write `arrayExists(x -> x IN (set), arr)`. +- Disabled the incorrect use of the socket option `SO_REUSEPORT`, which was incorrectly enabled by default in the Poco library. Note that on Linux there is no longer any reason to simultaneously specify the addresses `::` and `0.0.0.0` for listen – use just `::`, which allows listening to the connection both over IPv4 and IPv6 (with the default kernel config settings). You can also revert to the behavior from previous versions by specifying `1` in the config. + +### ClickHouse Release 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} + +#### New Features: {#new-features-15} + +- Added the `system.macros` table and auto updating of macros when the config file is changed. +- Added the `SYSTEM RELOAD CONFIG` query. +- Added the `maxIntersections(left_col, right_col)` aggregate function, which returns the maximum number of simultaneously intersecting intervals `[left; right]`. The `maxIntersectionsPosition(left, right)` function returns the beginning of the “maximum” interval. ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). + +#### Improvements: {#improvements-14} + +- When inserting data in a `Replicated` table, fewer requests are made to `ZooKeeper` (and most of the user-level errors have disappeared from the `ZooKeeper` log). +- Added the ability to create aliases for data sets. Example: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. + +#### Bug Fixes: {#bug-fixes-26} + +- Fixed the `Illegal PREWHERE` error when reading from Merge tables for `Distributed`tables. +- Added fixes that allow you to start clickhouse-server in IPv4-only Docker containers. +- Fixed a race condition when reading from system `system.parts_columns tables.` +- Removed double buffering during a synchronous insert to a `Distributed` table, which could have caused the connection to timeout. +- Fixed a bug that caused excessively long waits for an unavailable replica before beginning a `SELECT` query. +- Fixed incorrect dates in the `system.parts` table. +- Fixed a bug that made it impossible to insert data in a `Replicated` table if `chroot` was non-empty in the configuration of the `ZooKeeper` cluster. +- Fixed the vertical merging algorithm for an empty `ORDER BY` table. +- Restored the ability to use dictionaries in queries to remote tables, even if these dictionaries are not present on the requestor server. This functionality was lost in release 1.1.54362. +- Restored the behavior for queries like `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` when the right side of the `IN` should use a remote `default.table` instead of a local one. This behavior was broken in version 1.1.54358. +- Removed extraneous error-level logging of `Not found column ... in block`. + +### ClickHouse Release 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} + +#### New Features: {#new-features-16} + +- Aggregation without `GROUP BY` for an empty set (such as `SELECT count(*) FROM table WHERE 0`) now returns a result with one row with null values for aggregate functions, in compliance with the SQL standard. To restore the old behavior (return an empty result), set `empty_result_for_aggregation_by_empty_set` to 1. +- Added type conversion for `UNION ALL`. Different alias names are allowed in `SELECT` positions in `UNION ALL`, in compliance with the SQL standard. +- Arbitrary expressions are supported in `LIMIT BY` clauses. Previously, it was only possible to use columns resulting from `SELECT`. +- An index of `MergeTree` tables is used when `IN` is applied to a tuple of expressions from the columns of the primary key. Example: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). +- Added the `clickhouse-copier` tool for copying between clusters and resharding data (beta). +- Added consistent hashing functions: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. They can be used as a sharding key in order to reduce the amount of network traffic during subsequent reshardings. +- Added functions: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. +- Added the `arrayCumSum` function (Javi Santana). +- Added the `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, and `parseDateTimeBestEffortOrNull` functions to read the DateTime from a string containing text in a wide variety of possible formats. +- Data can be partially reloaded from external dictionaries during updating (load just the records in which the value of the specified field greater than in the previous download) (Arsen Hakobyan). +- Added the `cluster` table function. Example: `cluster(cluster_name, db, table)`. The `remote` table function can accept the cluster name as the first argument, if it is specified as an identifier. +- The `remote` and `cluster` table functions can be used in `INSERT` queries. +- Added the `create_table_query` and `engine_full` virtual columns to the `system.tables`table . The `metadata_modification_time` column is virtual. +- Added the `data_path` and `metadata_path` columns to `system.tables`and`system.databases` tables, and added the `path` column to the `system.parts` and `system.parts_columns` tables. +- Added additional information about merges in the `system.part_log` table. +- An arbitrary partitioning key can be used for the `system.query_log` table (Kirill Shvakov). +- The `SHOW TABLES` query now also shows temporary tables. Added temporary tables and the `is_temporary` column to `system.tables` (zhang2014). +- Added `DROP TEMPORARY TABLE` and `EXISTS TEMPORARY TABLE` queries (zhang2014). +- Support for `SHOW CREATE TABLE` for temporary tables (zhang2014). +- Added the `system_profile` configuration parameter for the settings used by internal processes. +- Support for loading `object_id` as an attribute in `MongoDB` dictionaries (Pavel Litvinenko). +- Reading `null` as the default value when loading data for an external dictionary with the `MongoDB` source (Pavel Litvinenko). +- Reading `DateTime` values in the `Values` format from a Unix timestamp without single quotes. +- Failover is supported in `remote` table functions for cases when some of the replicas are missing the requested table. +- Configuration settings can be overridden in the command line when you run `clickhouse-server`. Example: `clickhouse-server -- --logger.level=information`. +- Implemented the `empty` function from a `FixedString` argument: the function returns 1 if the string consists entirely of null bytes (zhang2014). +- Added the `listen_try`configuration parameter for listening to at least one of the listen addresses without quitting, if some of the addresses can’t be listened to (useful for systems with disabled support for IPv4 or IPv6). +- Added the `VersionedCollapsingMergeTree` table engine. +- Support for rows and arbitrary numeric types for the `library` dictionary source. +- `MergeTree` tables can be used without a primary key (you need to specify `ORDER BY tuple()`). +- A `Nullable` type can be `CAST` to a non-`Nullable` type if the argument is not `NULL`. +- `RENAME TABLE` can be performed for `VIEW`. +- Added the `throwIf` function. +- Added the `odbc_default_field_size` option, which allows you to extend the maximum size of the value loaded from an ODBC source (by default, it is 1024). +- The `system.processes` table and `SHOW PROCESSLIST` now have the `is_cancelled` and `peak_memory_usage` columns. + +#### Improvements: {#improvements-15} + +- Limits and quotas on the result are no longer applied to intermediate data for `INSERT SELECT` queries or for `SELECT` subqueries. +- Fewer false triggers of `force_restore_data` when checking the status of `Replicated` tables when the server starts. +- Added the `allow_distributed_ddl` option. +- Nondeterministic functions are not allowed in expressions for `MergeTree` table keys. +- Files with substitutions from `config.d` directories are loaded in alphabetical order. +- Improved performance of the `arrayElement` function in the case of a constant multidimensional array with an empty array as one of the elements. Example: `[[1], []][x]`. +- The server starts faster now when using configuration files with very large substitutions (for instance, very large lists of IP networks). +- When running a query, table valued functions run once. Previously, `remote` and `mysql` table valued functions performed the same query twice to retrieve the table structure from a remote server. +- The `MkDocs` documentation generator is used. +- When you try to delete a table column that `DEFAULT`/`MATERIALIZED` expressions of other columns depend on, an exception is thrown (zhang2014). +- Added the ability to parse an empty line in text formats as the number 0 for `Float` data types. This feature was previously available but was lost in release 1.1.54342. +- `Enum` values can be used in `min`, `max`, `sum` and some other functions. In these cases, it uses the corresponding numeric values. This feature was previously available but was lost in the release 1.1.54337. +- Added `max_expanded_ast_elements` to restrict the size of the AST after recursively expanding aliases. + +#### Bug Fixes: {#bug-fixes-27} + +- Fixed cases when unnecessary columns were removed from subqueries in error, or not removed from subqueries containing `UNION ALL`. +- Fixed a bug in merges for `ReplacingMergeTree` tables. +- Fixed synchronous insertions in `Distributed` tables (`insert_distributed_sync = 1`). +- Fixed segfault for certain uses of `FULL` and `RIGHT JOIN` with duplicate columns in subqueries. +- Fixed segfault for certain uses of `replace_running_query` and `KILL QUERY`. +- Fixed the order of the `source` and `last_exception` columns in the `system.dictionaries` table. +- Fixed a bug when the `DROP DATABASE` query did not delete the file with metadata. +- Fixed the `DROP DATABASE` query for `Dictionary` databases. +- Fixed the low precision of `uniqHLL12` and `uniqCombined` functions for cardinalities greater than 100 million items (Alex Bocharov). +- Fixed the calculation of implicit default values when necessary to simultaneously calculate default explicit expressions in `INSERT` queries (zhang2014). +- Fixed a rare case when a query to a `MergeTree` table couldn’t finish (chenxing-xc). +- Fixed a crash that occurred when running a `CHECK` query for `Distributed` tables if all shards are local (chenxing.xc). +- Fixed a slight performance regression with functions that use regular expressions. +- Fixed a performance regression when creating multidimensional arrays from complex expressions. +- Fixed a bug that could cause an extra `FORMAT` section to appear in an `.sql` file with metadata. +- Fixed a bug that caused the `max_table_size_to_drop` limit to apply when trying to delete a `MATERIALIZED VIEW` looking at an explicitly specified table. +- Fixed incompatibility with old clients (old clients were sometimes sent data with the `DateTime('timezone')` type, which they do not understand). +- Fixed a bug when reading `Nested` column elements of structures that were added using `ALTER` but that are empty for the old partitions, when the conditions for these columns moved to `PREWHERE`. +- Fixed a bug when filtering tables by virtual `_table` columns in queries to `Merge` tables. +- Fixed a bug when using `ALIAS` columns in `Distributed` tables. +- Fixed a bug that made dynamic compilation impossible for queries with aggregate functions from the `quantile` family. +- Fixed a race condition in the query execution pipeline that occurred in very rare cases when using `Merge` tables with a large number of tables, and when using `GLOBAL` subqueries. +- Fixed a crash when passing arrays of different sizes to an `arrayReduce` function when using aggregate functions from multiple arguments. +- Prohibited the use of queries with `UNION ALL` in a `MATERIALIZED VIEW`. +- Fixed an error during initialization of the `part_log` system table when the server starts (by default, `part_log` is disabled). + +#### Backward Incompatible Changes: {#backward-incompatible-changes-10} + +- Removed the `distributed_ddl_allow_replicated_alter` option. This behavior is enabled by default. +- Removed the `strict_insert_defaults` setting. If you were using this functionality, write to `clickhouse-feedback@yandex-team.com`. +- Removed the `UnsortedMergeTree` engine. + +### ClickHouse Release 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} + +- Added macros support for defining cluster names in distributed DDL queries and constructors of Distributed tables: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. +- Now queries like `SELECT ... FROM table WHERE expr IN (subquery)` are processed using the `table` index. +- Improved processing of duplicates when inserting to Replicated tables, so they no longer slow down execution of the replication queue. + +### ClickHouse Release 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} + +This release contains bug fixes for the previous release 1.1.54337: + +- Fixed a regression in 1.1.54337: if the default user has readonly access, then the server refuses to start up with the message `Cannot create database in readonly mode`. +- Fixed a regression in 1.1.54337: on systems with systemd, logs are always written to syslog regardless of the configuration; the watchdog script still uses init.d. +- Fixed a regression in 1.1.54337: wrong default configuration in the Docker image. +- Fixed nondeterministic behavior of GraphiteMergeTree (you can see it in log messages `Data after merge is not byte-identical to the data on another replicas`). +- Fixed a bug that may lead to inconsistent merges after OPTIMIZE query to Replicated tables (you may see it in log messages `Part ... intersects the previous part`). +- Buffer tables now work correctly when MATERIALIZED columns are present in the destination table (by zhang2014). +- Fixed a bug in implementation of NULL. + +### ClickHouse Release 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} + +#### New Features: {#new-features-17} + +- Added support for storage of multi-dimensional arrays and tuples (`Tuple` data type) in tables. +- Support for table functions for `DESCRIBE` and `INSERT` queries. Added support for subqueries in `DESCRIBE`. Examples: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. Support for `INSERT INTO TABLE` in addition to `INSERT INTO`. +- Improved support for time zones. The `DateTime` data type can be annotated with the timezone that is used for parsing and formatting in text formats. Example: `DateTime('Europe/Moscow')`. When timezones are specified in functions for `DateTime` arguments, the return type will track the timezone, and the value will be displayed as expected. +- Added the functions `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. The `toRelativeHour`/`Minute`/`Second` functions can take a value of type `Date` as an argument. The `now` function name is case-sensitive. +- Added the `toStartOfFifteenMinutes` function (Kirill Shvakov). +- Added the `clickhouse format` tool for formatting queries. +- Added the `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` format. Schema files can be located only in the specified directory. +- Added support for config substitutions (`incl` and `conf.d`) for configuration of external dictionaries and models (Pavel Yakunin). +- Added a column with documentation for the `system.settings` table (Kirill Shvakov). +- Added the `system.parts_columns` table with information about column sizes in each data part of `MergeTree` tables. +- Added the `system.models` table with information about loaded `CatBoost` machine learning models. +- Added the `mysql` and `odbc` table function and corresponding `MySQL` and `ODBC` table engines for accessing remote databases. This functionality is in the beta stage. +- Added the possibility to pass an argument of type `AggregateFunction` for the `groupArray` aggregate function (so you can create an array of states of some aggregate function). +- Removed restrictions on various combinations of aggregate function combinators. For example, you can use `avgForEachIf` as well as `avgIfForEach` aggregate functions, which have different behaviors. +- The `-ForEach` aggregate function combinator is extended for the case of aggregate functions of multiple arguments. +- Added support for aggregate functions of `Nullable` arguments even for cases when the function returns a non-`Nullable` result (added with the contribution of Silviu Caragea). Example: `groupArray`, `groupUniqArray`, `topK`. +- Added the `max_client_network_bandwidth` for `clickhouse-client` (Kirill Shvakov). +- Users with the `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). +- Added support for using multiple consumers with the `Kafka` engine. Extended configuration options for `Kafka` (Marek Vavruša). +- Added the `intExp3` and `intExp4` functions. +- Added the `sumKahan` aggregate function. +- Added the to \* Number\* OrNull functions, where \* Number\* is a numeric type. +- Added support for `WITH` clauses for an `INSERT SELECT` query (author: zhang2014). +- Added settings: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. In particular, these settings are used for downloading data parts for replication. Changing these settings allows for faster failover if the network is overloaded. +- Added support for `ALTER` for tables of type `Null` (Anastasiya Tsarkova). +- The `reinterpretAsString` function is extended for all data types that are stored contiguously in memory. +- Added the `--silent` option for the `clickhouse-local` tool. It suppresses printing query execution info in stderr. +- Added support for reading values of type `Date` from text in a format where the month and/or day of the month is specified using a single digit instead of two digits (Amos Bird). + +#### Performance Optimizations: {#performance-optimizations} + +- Improved performance of aggregate functions `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` from string arguments. +- Improved performance of the functions `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. +- Improved performance of parsing and formatting `Date` and `DateTime` type values in text format. +- Improved performance and precision of parsing floating point numbers. +- Lowered memory usage for `JOIN` in the case when the left and right parts have columns with identical names that are not contained in `USING` . +- Improved performance of aggregate functions `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` by reducing computational stability. The old functions are available under the names `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. + +#### Bug Fixes: {#bug-fixes-28} + +- Fixed data deduplication after running a `DROP` or `DETACH PARTITION` query. In the previous version, dropping a partition and inserting the same data again was not working because inserted blocks were considered duplicates. +- Fixed a bug that could lead to incorrect interpretation of the `WHERE` clause for `CREATE MATERIALIZED VIEW` queries with `POPULATE` . +- Fixed a bug in using the `root_path` parameter in the `zookeeper_servers` configuration. +- Fixed unexpected results of passing the `Date` argument to `toStartOfDay` . +- Fixed the `addMonths` and `subtractMonths` functions and the arithmetic for `INTERVAL n MONTH` in cases when the result has the previous year. +- Added missing support for the `UUID` data type for `DISTINCT` , `JOIN` , and `uniq` aggregate functions and external dictionaries (Evgeniy Ivanov). Support for `UUID` is still incomplete. +- Fixed `SummingMergeTree` behavior in cases when the rows summed to zero. +- Various fixes for the `Kafka` engine (Marek Vavruša). +- Fixed incorrect behavior of the `Join` table engine (Amos Bird). +- Fixed incorrect allocator behavior under FreeBSD and OS X. +- The `extractAll` function now supports empty matches. +- Fixed an error that blocked usage of `libressl` instead of `openssl` . +- Fixed the `CREATE TABLE AS SELECT` query from temporary tables. +- Fixed non-atomicity of updating the replication queue. This could lead to replicas being out of sync until the server restarts. +- Fixed possible overflow in `gcd` , `lcm` and `modulo` (`%` operator) (Maks Skorokhod). +- `-preprocessed` files are now created after changing `umask` (`umask` can be changed in the config). +- Fixed a bug in the background check of parts (`MergeTreePartChecker` ) when using a custom partition key. +- Fixed parsing of tuples (values of the `Tuple` data type) in text formats. +- Improved error messages about incompatible types passed to `multiIf` , `array` and some other functions. +- Redesigned support for `Nullable` types. Fixed bugs that may lead to a server crash. Fixed almost all other bugs related to `NULL` support: incorrect type conversions in INSERT SELECT, insufficient support for Nullable in HAVING and PREWHERE, `join_use_nulls` mode, Nullable types as arguments of `OR` operator, etc. +- Fixed various bugs related to internal semantics of data types. Examples: unnecessary summing of `Enum` type fields in `SummingMergeTree` ; alignment of `Enum` types in `Pretty` formats, etc. +- Stricter checks for allowed combinations of composite columns. +- Fixed the overflow when specifying a very large parameter for the `FixedString` data type. +- Fixed a bug in the `topK` aggregate function in a generic case. +- Added the missing check for equality of array sizes in arguments of n-ary variants of aggregate functions with an `-Array` combinator. +- Fixed a bug in `--pager` for `clickhouse-client` (author: ks1322). +- Fixed the precision of the `exp10` function. +- Fixed the behavior of the `visitParamExtract` function for better compliance with documentation. +- Fixed the crash when incorrect data types are specified. +- Fixed the behavior of `DISTINCT` in the case when all columns are constants. +- Fixed query formatting in the case of using the `tupleElement` function with a complex constant expression as the tuple element index. +- Fixed a bug in `Dictionary` tables for `range_hashed` dictionaries. +- Fixed a bug that leads to excessive rows in the result of `FULL` and `RIGHT JOIN` (Amos Bird). +- Fixed a server crash when creating and removing temporary files in `config.d` directories during config reload. +- Fixed the `SYSTEM DROP DNS CACHE` query: the cache was flushed but addresses of cluster nodes were not updated. +- Fixed the behavior of `MATERIALIZED VIEW` after executing `DETACH TABLE` for the table under the view (Marek Vavruša). + +#### Build Improvements: {#build-improvements-4} + +- The `pbuilder` tool is used for builds. The build process is almost completely independent of the build host environment. +- A single build is used for different OS versions. Packages and binaries have been made compatible with a wide range of Linux systems. +- Added the `clickhouse-test` package. It can be used to run functional tests. +- The source tarball can now be published to the repository. It can be used to reproduce the build without using GitHub. +- Added limited integration with Travis CI. Due to limits on build time in Travis, only the debug build is tested and a limited subset of tests are run. +- Added support for `Cap'n'Proto` in the default build. +- Changed the format of documentation sources from `Restricted Text` to `Markdown`. +- Added support for `systemd` (Vladimir Smirnov). It is disabled by default due to incompatibility with some OS images and can be enabled manually. +- For dynamic code generation, `clang` and `lld` are embedded into the `clickhouse` binary. They can also be invoked as `clickhouse clang` and `clickhouse lld` . +- Removed usage of GNU extensions from the code. Enabled the `-Wextra` option. When building with `clang` the default is `libc++` instead of `libstdc++`. +- Extracted `clickhouse_parsers` and `clickhouse_common_io` libraries to speed up builds of various tools. + +#### Backward Incompatible Changes: {#backward-incompatible-changes-11} + +- The format for marks in `Log` type tables that contain `Nullable` columns was changed in a backward incompatible way. If you have these tables, you should convert them to the `TinyLog` type before starting up the new server version. To do this, replace `ENGINE = Log` with `ENGINE = TinyLog` in the corresponding `.sql` file in the `metadata` directory. If your table doesn’t have `Nullable` columns or if the type of your table is not `Log`, then you don’t need to do anything. +- Removed the `experimental_allow_extended_storage_definition_syntax` setting. Now this feature is enabled by default. +- The `runningIncome` function was renamed to `runningDifferenceStartingWithFirstvalue` to avoid confusion. +- Removed the `FROM ARRAY JOIN arr` syntax when ARRAY JOIN is specified directly after FROM with no table (Amos Bird). +- Removed the `BlockTabSeparated` format that was used solely for demonstration purposes. +- Changed the state format for aggregate functions `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. If you have stored states of these aggregate functions in tables (using the `AggregateFunction` data type or materialized views with corresponding states), please write to clickhouse-feedback@yandex-team.com. +- In previous server versions there was an undocumented feature: if an aggregate function depends on parameters, you can still specify it without parameters in the AggregateFunction data type. Example: `AggregateFunction(quantiles, UInt64)` instead of `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. This feature was lost. Although it was undocumented, we plan to support it again in future releases. +- Enum data types cannot be used in min/max aggregate functions. This ability will be returned in the next release. + +#### Please Note When Upgrading: {#please-note-when-upgrading} + +- When doing a rolling update on a cluster, at the point when some of the replicas are running the old version of ClickHouse and some are running the new version, replication is temporarily stopped and the message `unknown parameter 'shard'` appears in the log. Replication will continue after all replicas of the cluster are updated. +- If different versions of ClickHouse are running on the cluster servers, it is possible that distributed queries using the following functions will have incorrect results: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. You should update all cluster nodes. + +## [Changelog for 2017](./2017.md) {#changelog-for-2017} diff --git a/docs/en/whats-new/changelog/2019.md b/docs/en/whats-new/changelog/2019.md new file mode 100644 index 00000000000..553c9933e2d --- /dev/null +++ b/docs/en/whats-new/changelog/2019.md @@ -0,0 +1,2072 @@ +--- +toc_priority: 77 +toc_title: '2019' +--- + +## ClickHouse Release V19.17 {#clickhouse-release-v19-17} + +### ClickHouse Release V19.17.6.36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} + +#### Bug Fix {#bug-fix} + +- Fixed potential buffer overflow in decompress. Malicious user can pass fabricated compressed data that could cause read after buffer. This issue was found by Eldar Zaitov from Yandex information security team. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed possible server crash (`std::terminate`) when the server cannot send or write data in JSON or XML format with values of String data type (that require UTF-8 validation) or when compressing result data with Brotli algorithm or in some other rare cases. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed dictionaries with source from a clickhouse `VIEW`, now reading such dictionaries doesn’t cause the error `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed checking if a client host is allowed by host\_regexp specified in users.xml. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- `RENAME TABLE` for a distributed table now renames the folder containing inserted data before sending to shards. This fixes an issue with successive renames `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- `range_hashed` external dictionaries created by DDL queries now allow ranges of arbitrary numeric types. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- Fixed `INSERT INTO table SELECT ... FROM mysql(...)` table function. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- Fixed segfault in `INSERT INTO TABLE FUNCTION file()` while inserting into a file which doesn’t exist. Now in this case file would be created and then insert would be processed. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fixed bitmapAnd error when intersecting an aggregated bitmap and a scalar bitmap. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Fixed segfault when `EXISTS` query was used without `TABLE` or `DICTIONARY` qualifier, just like `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed return type for functions `rand` and `randConstant` in case of nullable argument. Now functions always return `UInt32` and never `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed `DROP DICTIONARY IF EXISTS db.dict`, now it doesn’t throw exception if `db` doesn’t exist. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- If a table wasn’t completely dropped because of server crash, the server will try to restore and load it [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- Fixed a trivial count query for a distributed table if there are more than two shard local table. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Fixed bug that lead to a data race in DB::BlockStreamProfileInfo::calculateRowsBeforeLimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- Fixed `ALTER table MOVE part` executed immediately after merging the specified part, which could cause moving a part which the specified part merged into. Now it correctly moves the specified part. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Expressions for dictionaries can be specified as strings now. This is useful for calculation of attributes while extracting data from non-ClickHouse sources because it allows to use non-ClickHouse syntax for those expressions. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- Fixed a very rare race in `clickhouse-copier` because of an overflow in ZXid. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Fixed the bug when after the query failed (due to “Too many simultaneous queries” for example) it would not read external tables info, and the + next request would interpret this info as the beginning of the next query causing an error like `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Avoid null dereference after “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Restore support of all ICU locales, add the ability to apply collations for constant expressions and add language name to system.collations table. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- Number of streams for read from `StorageFile` and `StorageHDFS` is now limited, to avoid exceeding the memory limit. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- Fixed `CHECK TABLE` query for `*MergeTree` tables without key. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- Removed the mutation number from a part name in case there were no mutations. This removing improved the compatibility with older versions. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- Fixed the bug that mutations are skipped for some attached parts due to their data\_version are larger than the table mutation version. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) +- Allow starting the server with redundant copies of parts after moving them to another device. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixed the error “Sizes of columns doesn’t match” that might appear when using aggregate function columns. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Now an exception will be thrown in case of using WITH TIES alongside LIMIT BY. And now it’s possible to use TOP with LIMIT BY. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix dictionary reload if it has `invalidate_query`, which stopped updates and some exception on previous update tries. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) + +### ClickHouse Release V19.17.4.11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} + +#### Backward Incompatible Change {#backward-incompatible-change} + +- Using column instead of AST to store scalar subquery results for better performance. Setting `enable_scalar_subquery_optimization` was added in 19.17 and it was enabled by default. It leads to errors like [this](https://github.com/ClickHouse/ClickHouse/issues/7851) during upgrade to 19.17.2 or 19.17.3 from previous versions. This setting was disabled by default in 19.17.4, to make possible upgrading from 19.16 and older versions without errors. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos Bird](https://github.com/amosbird)) + +#### New Feature {#new-feature} + +- Add the ability to create dictionaries with DDL queries. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) +- Make `bloom_filter` type of index supporting `LowCardinality` and `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Add function `isValidJSON` to check that passed string is a valid json. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) +- Implement `arrayCompact` function [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Memo](https://github.com/Joeywzr)) +- Created function `hex` for Decimal numbers. It works like `hex(reinterpretAsString())`, but doesn’t delete last zero bytes. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) +- Add `arrayFill` and `arrayReverseFill` functions, which replace elements by other elements in front/back of them in the array. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) +- Add `CRC32IEEE()`/`CRC64()` support [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) +- Implement `char` function similar to one in [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) +- Add `bitmapTransform` function. It transforms an array of values in a bitmap to another array of values, the result is a new bitmap [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) +- Implemented `javaHashUTF16LE()` function [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) +- Add `_shard_num` virtual column for the Distributed engine [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) + +#### Experimental Feature {#experimental-feature} + +- Support for processors (new query execution pipeline) in `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Bug Fix {#bug-fix-1} + +- Fix incorrect float parsing in `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- Fix rare deadlock which can happen when trace\_log is enabled. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Prevent message duplication when producing Kafka table has any MVs selecting from it [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) +- Support for `Array(LowCardinality(Nullable(String)))` in `IN`. Resolves [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) +- Add handling of `SQL_TINYINT` and `SQL_BIGINT`, and fix handling of `SQL_FLOAT` data source types in ODBC Bridge. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Fix aggregation (`avg` and quantiles) over empty decimal columns [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Fix `INSERT` into Distributed with `MATERIALIZED` columns [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Make `MOVE PARTITION` work if some parts of partition are already on destination disk or volume [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixed bug with hardlinks failing to be created during mutations in `ReplicatedMergeTree` in multi-disk configurations. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixed a bug with a mutation on a MergeTree when whole part remains unchanged and best space is being found on another disk [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixed bug with `keep_free_space_ratio` not being read from disks configuration [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix bug with table contains only `Tuple` columns or columns with complex paths. Fixes [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) +- Do not account memory for Buffer engine in max\_memory\_usage limit [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) +- Fix final mark usage in `MergeTree` tables ordered by `tuple()`. In rare cases it could lead to `Can't adjust last granule` error while select. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) +- Fix bug in mutations that have predicate with actions that require context (for example functions for json), which may lead to crashes or strange exceptions. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) +- Fix mismatch of database and table names escaping in `data/` and `shadow/` directories [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Fix crash in this case. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix `Not found column in block` when joining on expression with RIGHT or FULL JOIN. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) +- One more attempt to fix infinite loop in `PrettySpace` format [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fix bug in `concat` function when all arguments were `FixedString` of the same size. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) +- Fixed exception in case of using 1 argument while defining S3, URL and HDFS storages. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix scope of the InterpreterSelectQuery for views with query [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) + +#### Improvement {#improvement} + +- `Nullable` columns recognized and NULL-values handled correctly by ODBC-bridge [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- Write current batch for distributed send atomically [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) +- Throw an exception if we cannot detect table for column name in query. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) +- Add `merge_max_block_size` setting to `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) +- Queries with `HAVING` and without `GROUP BY` assume group by constant. So, `SELECT 1 HAVING 1` now returns a result. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos Bird](https://github.com/amosbird)) +- Support parsing `(X,)` as tuple similar to python. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos Bird](https://github.com/amosbird)) +- Make `range` function behaviors almost like pythonic one. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) +- Add `constraints` columns to table `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) +- Better Null format for tcp handler, so that it’s possible to use `select ignore() from table format Null` for perf measure via clickhouse-client [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos Bird](https://github.com/amosbird)) +- Queries like `CREATE TABLE ... AS (SELECT (1, 2))` are parsed correctly [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) + +#### Performance Improvement {#performance-improvement} + +- The performance of aggregation over short string keys is improved. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [Amos Bird](https://github.com/amosbird)) +- Run another pass of syntax/expression analysis to get potential optimizations after constant predicates are folded. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos Bird](https://github.com/amosbird)) +- Use storage meta info to evaluate trivial `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos Bird](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) +- Vectorize processing `arrayReduce` similar to Aggregator `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Bird](https://github.com/amosbird)) +- Minor improvements in performance of `Kafka` consumption [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([Ivan](https://github.com/abyss7)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement} + +- Add support for cross-compiling to the CPU architecture AARCH64. Refactor packager script. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([Ivan](https://github.com/abyss7)) +- Unpack darwin-x86\_64 and linux-aarch64 toolchains into mounted Docker volume when building packages [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([Ivan](https://github.com/abyss7)) +- Update Docker Image for Binary Packager [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([Ivan](https://github.com/abyss7)) +- Fixed compile errors on MacOS Catalina [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) +- Some refactoring in query analysis logic: split complex class into several simple ones. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix build without submodules [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) +- Better `add_globs` in CMake files [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos Bird](https://github.com/amosbird)) +- Remove hardcoded paths in `unwind` target [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) +- Allow to use mysql format without ssl [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) + +#### Other {#other} + +- Added ANTLR4 grammar for ClickHouse SQL dialect [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouse Release V19.16 {#clickhouse-release-v19-16} + +#### ClickHouse Release V19.16.14.65, 2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} + +- Fixed up a bug in batched calculations of ternary logical OPs on multiple arguments (more than 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) This bugfix was backported to version 19.16 by a special request from Altinity. + +#### ClickHouse Release V19.16.14.65, 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} + +- Fix distributed subqueries incompatibility with older CH versions. Fixes [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) + [(tabplubix)](https://github.com/tavplubix) +- When executing `CREATE` query, fold constant expressions in storage engine arguments. Replace empty database name with current database. Fixes [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Also fix check for local address in `ClickHouseDictionarySource`. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Now background merges in `*MergeTree` table engines family preserve storage policy volume order more accurately. + [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Prevent losing data in `Kafka` in rare cases when exception happens after reading suffix but before commit. Fixes [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Related: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Fix bug leading to server termination when trying to use / drop `Kafka` table created with wrong parameters. Fixes [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporates [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) +- Allow using `MaterializedView` with subqueries above `Kafka` tables. + [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) + +#### New Feature {#new-feature-1} + +- Add `deduplicate_blocks_in_dependent_materialized_views` option to control the behaviour of idempotent inserts into tables with materialized views. This new feature was added to the bugfix release by a special request from Altinity. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### ClickHouse Release V19.16.2.2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} + +#### Backward Incompatible Change {#backward-incompatible-change-1} + +- Add missing arity validation for count/counIf. + [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) + [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) +- Remove legacy `asterisk_left_columns_only` setting (it was disabled by default). + [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem + Zuikov](https://github.com/4ertus2)) +- Format strings for Template data format are now specified in files. + [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) + +#### New Feature {#new-feature-2} + +- Introduce uniqCombined64() to calculate cardinality greater than UINT\_MAX. + [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), + [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat + Khuzhin](https://github.com/azat)) +- Support Bloom filter indexes on Array columns. + [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) + ([achimbab](https://github.com/achimbab)) +- Add a function `getMacro(name)` that returns String with the value of corresponding `` + from server configuration. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Set two configuration options for a dictionary based on an HTTP source: `credentials` and + `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- Add a new ProfileEvent `Merge` that counts the number of launched background merges. + [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mikhail + Korotov](https://github.com/millb)) +- Add fullHostName function that returns a fully qualified domain name. + [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) + [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) +- Add function `arraySplit` and `arrayReverseSplit` which split an array by “cut off” + conditions. They are useful in time sequence handling. + [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) +- Add new functions that return the Array of all matched indices in multiMatch family of functions. + [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila + Kutenin](https://github.com/danlark1)) +- Add a new database engine `Lazy` that is optimized for storing a large number of small -Log + tables. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nikita + Vasilev](https://github.com/nikvas0)) +- Add aggregate functions groupBitmapAnd, -Or, -Xor for bitmap columns. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang + Yu](https://github.com/yuzhichang)) +- Add aggregate function combinators -OrNull and -OrDefault, which return null + or default values when there is nothing to aggregate. + [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) + ([hcz](https://github.com/hczhcz)) +- Introduce CustomSeparated data format that supports custom escaping and + delimiter rules. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) +- Support Redis as source of external dictionary. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton + Popov](https://github.com/CurtizJ)) + +#### Bug Fix {#bug-fix-2} + +- Fix wrong query result if it has `WHERE IN (SELECT ...)` section and `optimize_read_in_order` is + used. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton + Popov](https://github.com/CurtizJ)) +- Disabled MariaDB authentication plugin, which depends on files outside of project. + [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Yuriy + Baranov](https://github.com/yurriy)) +- Fix exception `Cannot convert column ... because it is constant but values of constants are different in source and result` which could rarely happen when functions `now()`, `today()`, + `yesterday()`, `randConstant()` are used. + [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolai + Kochetov](https://github.com/KochetovNicolai)) +- Fixed issue of using HTTP keep alive timeout instead of TCP keep alive timeout. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily + Nemkov](https://github.com/Enmk)) +- Fixed a segmentation fault in groupBitmapOr (issue [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). + [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang + Yu](https://github.com/yuzhichang)) +- For materialized views the commit for Kafka is called after all data were written. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) +- Fixed wrong `duration_ms` value in `system.part_log` table. It was ten times off. + [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- A quick fix to resolve crash in LIVE VIEW table and re-enabling all LIVE VIEW tests. + [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Serialize NULL values correctly in min/max indexes of MergeTree parts. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Don’t put virtual columns to .sql metadata when table is created as `CREATE TABLE AS`. + [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([Ivan](https://github.com/abyss7)) +- Fix segmentation fault in `ATTACH PART` query. + [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) + ([alesapin](https://github.com/alesapin)) +- Fix wrong result for some queries given by the optimization of empty IN subqueries and empty + INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolai + Kochetov](https://github.com/KochetovNicolai)) +- Fixing AddressSanitizer error in the LIVE VIEW getHeader() method. + [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) + ([vzakaznikov](https://github.com/vzakaznikov)) + +#### Improvement {#improvement-1} + +- Add a message in case of queue\_wait\_max\_ms wait takes place. + [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat + Khuzhin](https://github.com/azat)) +- Made setting `s3_min_upload_part_size` table-level. + [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Check TTL in StorageFactory. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) + ([sundyli](https://github.com/sundy-li)) +- Squash left-hand blocks in partial merge join (optimization). + [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem + Zuikov](https://github.com/4ertus2)) +- Do not allow non-deterministic functions in mutations of Replicated table engines, because this + can introduce inconsistencies between replicas. + [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alexander + Kazakov](https://github.com/Akazz)) +- Disable memory tracker while converting exception stack trace to string. It can prevent the loss + of error messages of type `Memory limit exceeded` on server, which caused the `Attempt to read after eof` exception on client. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) + ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Miscellaneous format improvements. Resolves + [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), + [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), + [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), + [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) + [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) + ([tavplubix](https://github.com/tavplubix)) +- ClickHouse ignores values on the right side of IN operator that are not convertible to the left + side type. Make it work properly for compound types – Array and Tuple. + [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Support missing inequalities for ASOF JOIN. It’s possible to join less-or-equal variant and strict + greater and less variants for ASOF column in ON syntax. + [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem + Zuikov](https://github.com/4ertus2)) +- Optimize partial merge join. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) + ([Artem Zuikov](https://github.com/4ertus2)) +- Do not use more than 98K of memory in uniqCombined functions. + [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), + [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat + Khuzhin](https://github.com/azat)) +- Flush parts of right-hand joining table on disk in PartialMergeJoin (if there is not enough + memory). Load data back when needed. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) + ([Artem Zuikov](https://github.com/4ertus2)) + +#### Performance Improvement {#performance-improvement-1} + +- Speed up joinGet with const arguments by avoiding data duplication. + [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos + Bird](https://github.com/amosbird)) +- Return early if the subquery is empty. + [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) +- Optimize parsing of SQL expression in Values. + [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) + ([tavplubix](https://github.com/tavplubix)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-1} + +- Disable some contribs for cross-compilation to Mac OS. + [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([Ivan](https://github.com/abyss7)) +- Add missing linking with PocoXML for clickhouse\_common\_io. + [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat + Khuzhin](https://github.com/azat)) +- Accept multiple test filter arguments in clickhouse-test. + [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Enable musl and jemalloc for ARM. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) + ([Amos Bird](https://github.com/amosbird)) +- Added `--client-option` parameter to `clickhouse-test` to pass additional parameters to client. + [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolai + Kochetov](https://github.com/KochetovNicolai)) +- Preserve existing configs on rpm package upgrade. + [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) + ([filimonov](https://github.com/filimonov)) +- Fix errors detected by PVS. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem + Zuikov](https://github.com/4ertus2)) +- Fix build for Darwin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) + ([Ivan](https://github.com/abyss7)) +- glibc 2.29 compatibility. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos + Bird](https://github.com/amosbird)) +- Make sure dh\_clean does not touch potential source files. + [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos + Bird](https://github.com/amosbird)) +- Attempt to avoid conflict when updating from altinity rpm - it has config file packaged separately + in clickhouse-server-common. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) + ([filimonov](https://github.com/filimonov)) +- Optimize some header files for faster rebuilds. + [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), + [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Add performance tests for Date and DateTime. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vasily + Nemkov](https://github.com/Enmk)) +- Fix some tests that contained non-deterministic mutations. + [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alexander + Kazakov](https://github.com/Akazz)) +- Add build with MemorySanitizer to CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) + ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Avoid use of uninitialized values in MetricsTransmitter. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat + Khuzhin](https://github.com/azat)) +- Fix some issues in Fields found by MemorySanitizer. + [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), + [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alexander + Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) + ([Amos Bird](https://github.com/amosbird)) +- Fix undefined behavior in murmurhash32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos + Bird](https://github.com/amosbird)) +- Fix undefined behavior in StoragesInfoStream. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) + ([tavplubix](https://github.com/tavplubix)) +- Fixed constant expressions folding for external database engines (MySQL, ODBC, JDBC). In previous + versions it wasn’t working for multiple constant expressions and was not working at all for Date, + DateTime and UUID. This fixes [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixing ThreadSanitizer data race error in the LIVE VIEW when accessing no\_users\_thread variable. + [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Get rid of malloc symbols in libcommon + [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), + [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos + Bird](https://github.com/amosbird)) +- Add global flag ENABLE\_LIBRARIES for disabling all libraries. + [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) + ([proller](https://github.com/proller)) + +#### Code Cleanup {#code-cleanup} + +- Generalize configuration repository to prepare for DDL for Dictionaries. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) + ([alesapin](https://github.com/alesapin)) +- Parser for dictionaries DDL without any semantic. + [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) + ([alesapin](https://github.com/alesapin)) +- Split ParserCreateQuery into different smaller parsers. + [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) + ([alesapin](https://github.com/alesapin)) +- Small refactoring and renaming near external dictionaries. + [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) + ([alesapin](https://github.com/alesapin)) +- Refactor some code to prepare for role-based access control. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly + Baranov](https://github.com/vitlibar)) +- Some improvements in DatabaseOrdinary code. + [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nikita + Vasilev](https://github.com/nikvas0)) +- Do not use iterators in find() and emplace() methods of hash tables. + [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Fix getMultipleValuesFromConfig in case when parameter root is not empty. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) + ([Mikhail Korotov](https://github.com/millb)) +- Remove some copy-paste (TemporaryFile and TemporaryFileStream) + [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem + Zuikov](https://github.com/4ertus2)) +- Improved code readability a little bit (`MergeTreeData::getActiveContainingPart`). + [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Wait for all scheduled jobs, which are using local objects, if `ThreadPool::schedule(...)` throws + an exception. Rename `ThreadPool::schedule(...)` to `ThreadPool::scheduleOrThrowOnError(...)` and + fix comments to make obvious that it may throw. + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) + ([tavplubix](https://github.com/tavplubix)) + +## ClickHouse Release 19.15 {#clickhouse-release-19-15} + +### ClickHouse Release 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} + +#### Bug Fix {#bug-fix-3} + +- Added handling of SQL\_TINYINT and SQL\_BIGINT, and fix handling of SQL\_FLOAT data source types in ODBC Bridge. + [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Allowed to have some parts on destination disk or volume in MOVE PARTITION. + [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixed NULL-values in nullable columns through ODBC-bridge. + [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- Fixed INSERT into Distributed non local node with MATERIALIZED columns. + [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Fixed function getMultipleValuesFromConfig. + [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) +- Fixed issue of using HTTP keep alive timeout instead of TCP keep alive timeout. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) +- Wait for all jobs to finish on exception (fixes rare segfaults). + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) +- Don’t push to MVs when inserting into Kafka table. + [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) +- Disable memory tracker for exception stack. + [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed bad code in transforming query for external database. + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid use of uninitialized values in MetricsTransmitter. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) +- Added example config with macros for tests ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} + +#### Bug Fix {#bug-fix-4} + +- Fixed bad\_variant in hashed dictionary. + ([alesapin](https://github.com/alesapin)) +- Fixed up bug with segmentation fault in ATTACH PART query. + ([alesapin](https://github.com/alesapin)) +- Fixed time calculation in `MergeTreeData`. + ([Vladimir Chebotarev](https://github.com/excitoon)) +- Commit to Kafka explicitly after the writing is finalized. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) +- Serialize NULL values correctly in min/max indexes of MergeTree parts. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +### ClickHouse Release 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} + +#### New Feature {#new-feature-3} + +- Tiered storage: support to use multiple storage volumes for tables with MergeTree engine. It’s possible to store fresh data on SSD and automatically move old data to HDD. ([example](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) +- Add table function `input` for reading incoming data in `INSERT SELECT` query. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) +- Add a `sparse_hashed` dictionary layout, that is functionally equivalent to the `hashed` layout, but is more memory efficient. It uses about twice as less memory at the cost of slower value retrieval. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) +- Implement ability to define list of users for access to dictionaries. Only current connected database using. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Add `LIMIT` option to `SHOW` query. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- Add `bitmapSubsetLimit(bitmap, range_start, limit)` function, that returns subset of the smallest `limit` values in set that is no smaller than `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) +- Add `bitmapMin` and `bitmapMax` functions. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) +- Add function `repeat` related to [issue-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL)) + +#### Experimental Feature {#experimental-feature-1} + +- Implement (in memory) Merge Join variant that does not change current pipeline. Result is partially sorted by merge key. Set `partial_merge_join = 1` to use this feature. The Merge Join is still in development. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) +- Add `S3` engine and table function. It is still in development (no authentication support yet). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) + +#### Improvement {#improvement-2} + +- Every message read from Kafka is inserted atomically. This resolves almost all known issues with Kafka engine. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([Ivan](https://github.com/abyss7)) +- Improvements for failover of Distributed queries. Shorten recovery time, also it is now configurable and can be seen in `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) +- Support numeric values for Enums directly in `IN` section. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) +- Support (optional, disabled by default) redirects on URL storage. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) +- Add information message when client with an older version connects to a server. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- Remove maximum backoff sleep time limit for sending data in Distributed tables [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) +- Add ability to send profile events (counters) with cumulative values to graphite. It can be enabled under `` in server `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) +- Add automatically cast type `T` to `LowCardinality(T)` while inserting data in column of type `LowCardinality(T)` in Native format via HTTP. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Add ability to use function `hex` without using `reinterpretAsString` for `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-2} + +- Add gdb-index to clickhouse binary with debug info. It will speed up startup time of `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) +- Speed up deb packaging with patched dpkg-deb which uses `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) +- Set `enable_fuzzing = 1` to enable libfuzzer instrumentation of all the project code. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) +- Add split build smoke test in CI. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) +- Add build with MemorySanitizer to CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Replace `libsparsehash` with `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) + +#### Bug Fix {#bug-fix-5} + +- Fixed performance degradation of index analysis on complex keys on large tables. This fixes \#6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix logical error causing segfaults when selecting from Kafka empty topic. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) +- Fix too early MySQL connection close in `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Returned support for very old Linux kernels (fix [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix possible data loss in `insert select` query in case of empty block in input stream. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix for function `АrrayEnumerateUniqRanked` with empty arrays in params [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- Fix complex queries with array joins and global subqueries. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) +- Fix `Unknown identifier` error in ORDER BY and GROUP BY with multiple JOINs [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed `MSan` warning while executing function with `LowCardinality` argument. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Backward Incompatible Change {#backward-incompatible-change-2} + +- Changed serialization format of bitmap\* aggregate function states to improve performance. Serialized states of bitmap\* from previous versions cannot be read. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) + +## ClickHouse Release 19.14 {#clickhouse-release-19-14} + +### ClickHouse Release 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} + +#### Bug Fix {#bug-fix-6} + +- This release also contains all bug fixes from 19.11.12.69. +- Fixed compatibility for distributed queries between 19.14 and earlier versions. This fixes [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} + +#### Bug Fix {#bug-fix-7} + +- Fix for function `АrrayEnumerateUniqRanked` with empty arrays in params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- Fixed subquery name in queries with `ARRAY JOIN` and `GLOBAL IN subquery` with alias. Use subquery alias for external table name if it is specified. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-3} + +- Fix [flapping](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) test `00715_fetch_merged_or_mutated_part_zookeeper` by rewriting it to a shell scripts because it needs to wait for mutations to apply. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) +- Fixed UBSan and MemSan failure in function `groupUniqArray` with emtpy array argument. It was caused by placing of empty `PaddedPODArray` into hash table zero cell because constructor for zero cell value was not called. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos Bird](https://github.com/amosbird)) + +### ClickHouse Release 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} + +#### New Feature {#new-feature-4} + +- `WITH FILL` modifier for `ORDER BY`. (continuation of [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- `WITH TIES` modifier for `LIMIT`. (continuation of [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- Parse unquoted `NULL` literal as NULL (if setting `format_csv_unquoted_null_literal_as_null=1`). Initialize null fields with default values if data type of this field is not nullable (if setting `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) +- Support for wildcards in paths of table functions `file` and `hdfs`. If the path contains wildcards, the table will be readonly. Example of usage: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` and `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) +- New `system.metric_log` table which stores values of `system.events` and `system.metrics` with specified time interval. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Allow to write ClickHouse text logs to `system.text_log` table. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Show private symbols in stack traces (this is done via parsing symbol tables of ELF files). Added information about file and line number in stack traces if debug info is present. Speedup symbol name lookup with indexing symbols present in program. Added new SQL functions for introspection: `demangle` and `addressToLine`. Renamed function `symbolizeAddress` to `addressToSymbol` for consistency. Function `addressToSymbol` will return mangled name for performance reasons and you have to apply `demangle`. Added setting `allow_introspection_functions` which is turned off by default. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Table function `values` (the name is case-insensitive). It allows to read from `VALUES` list proposed in [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Example: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) +- Added an ability to alter storage settings. Syntax: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) +- Support for removing of detached parts. Syntax: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) +- Table constraints. Allows to add constraint to table definition which will be checked at insert. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Suppport for cascaded materialized views. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos Bird](https://github.com/amosbird)) +- Turn on query profiler by default to sample every query execution thread once a second. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Input format `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) +- Added two new functions: `sigmoid` and `tanh` (that are useful for machine learning applications). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Function `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` to check if given token is in haystack. Token is a maximal length substring between two non alphanumeric ASCII characters (or boundaries of haystack). Token must be a constant string. Supported by tokenbf\_v1 index specialization. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) +- New function `neighbor(value, offset[, default_value])`. Allows to reach prev/next value within column in a block of data. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) +- Created a function `currentUser()`, returning login of authorized user. Added alias `user()` for compatibility with MySQL. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) +- New aggregate functions `quantilesExactInclusive` and `quantilesExactExclusive` which were proposed in [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) +- Function `bitmapRange(bitmap, range_begin, range_end)` which returns new set with specified range (not include the `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) +- Function `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` which creates array of precision-long strings of geohash-boxes covering provided area. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) +- Implement support for INSERT query with `Kafka` tables. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([Ivan](https://github.com/abyss7)) +- Added support for `_partition` and `_timestamp` virtual columns to Kafka engine. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([Ivan](https://github.com/abyss7)) +- Possibility to remove sensitive data from `query_log`, server logs, process list with regexp-based rules. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) + +#### Experimental Feature {#experimental-feature-2} + +- Input and output data format `Template`. It allows to specify custom format string for input and output. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) +- Implementation of `LIVE VIEW` tables that were originally proposed in [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898), prepared in [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), and then updated in [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). See [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) for detailed description. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) Note that `LIVE VIEW` feature may be removed in next versions. + +#### Bug Fix {#bug-fix-8} + +- This release also contains all bug fixes from 19.13 and 19.11. +- Fix segmentation fault when the table has skip indices and vertical merge happens. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) +- Fix per-column TTL with non-trivial column defaults. Previously in case of force TTL merge with `OPTIMIZE ... FINAL` query, expired values was replaced by type defaults instead of user-specified column defaults. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) +- Fix Kafka messages duplication problem on normal server restart. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) +- Fixed infinite loop when reading Kafka messages. Do not pause/resume consumer on subscription at all - otherwise it may get paused indefinitely in some scenarios. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([Ivan](https://github.com/abyss7)) +- Fix `Key expression contains comparison between inconvertible types` exception in `bitmapContains` function. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) +- Fix segfault with enabled `optimize_skip_unused_shards` and missing sharding key. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Removed extra verbose logging in MySQL interface [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Return the ability to parse boolean settings from ‘true’ and ‘false’ in the configuration file. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- Fix crash in `quantile` and `median` function over `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed possible incomplete result returned by `SELECT` query with `WHERE` condition on primary key contained conversion to Float type. It was caused by incorrect checking of monotonicity in `toFloat` function. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- Check `max_expanded_ast_elements` setting for mutations. Clear mutations after `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([Winter Zhang](https://github.com/zhang2014)) +- Fix JOIN results for key columns when used with `join_use_nulls`. Attach Nulls instead of columns defaults. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix for skip indices with vertical merge and alter. Fix for `Bad size of marks file` exception. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) +- Fix rare crash in `ALTER MODIFY COLUMN` and vertical merge when one of merged/altered parts is empty (0 rows) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- Fixed bug in conversion of `LowCardinality` types in `AggregateFunctionFactory`. This fixes [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix wrong behavior and possible segfaults in `topK` and `topKWeighted` aggregated functions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed unsafe code around `getIdentifier` function. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed bug in MySQL wire protocol (is used while connecting to ClickHouse form MySQL client). Caused by heap buffer overflow in `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) +- Fixed memory leak in `bitmapSubsetInRange` function. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fix rare bug when mutation executed after granularity change. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) +- Allow protobuf message with all fields by default. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) +- Resolve a bug with `nullIf` function when we send a `NULL` argument on the second argument. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Fix rare bug with wrong memory allocation/deallocation in complex key cache dictionaries with string fields which leads to infinite memory consumption (looks like memory leak). Bug reproduces when string size was a power of two starting from eight (8, 16, 32, etc). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- Fixed Gorilla encoding on small sequences which caused exception `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) +- Allow to use not nullable types in JOINs with `join_use_nulls` enabled. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) +- Disable `Poco::AbstractConfiguration` substitutions in query in `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid deadlock in `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Using `arrayReduce` for constant arguments may lead to segfault. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix inconsistent parts which can appear if replica was restored after `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- Fixed hang in `JSONExtractRaw` function. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix bug with incorrect skip indices serialization and aggregation with adaptive granularity. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) +- Fix `WITH ROLLUP` and `WITH CUBE` modifiers of `GROUP BY` with two-level aggregation. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Fix bug with writing secondary indices marks with adaptive granularity. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- Fix initialization order while server startup. Since `StorageMergeTree::background_task_handle` is initialized in `startup()` the `MergeTreeBlockOutputStream::write()` may try to use it before initialization. Just check if it is initialized. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) +- Clearing the data buffer from the previous read operation that was completed with an error. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) +- Fix bug with enabling adaptive granularity when creating a new replica for Replicated\*MergeTree table. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- Fixed possible crash during server startup in case of exception happened in `libunwind` during exception at access to uninitialized `ThreadStatus` structure. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix crash in `yandexConsistentHash` function. Found by fuzz test. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed the possibility of hanging queries when server is overloaded and global thread pool becomes near full. This have higher chance to happen on clusters with large number of shards (hundreds), because distributed queries allocate a thread per connection to each shard. For example, this issue may reproduce if a cluster of 330 shards is processing 30 concurrent distributed queries. This issue affects all versions starting from 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed logic of `arrayEnumerateUniqRanked` function. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix segfault when decoding symbol table. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos Bird](https://github.com/amosbird)) +- Fixed irrelevant exception in cast of `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Removed extra quoting of description in `system.settings` table. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid possible deadlock in `TRUNCATE` of Replicated table. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix reading in order of sorting key. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) +- Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Fix bug opened by [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (since 19.4.0). Reproduces in queries to Distributed tables over MergeTree tables when we doesn’t query any columns (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- Fixed overflow in integer division of signed type to unsigned type. The behaviour was exactly as in C or C++ language (integer promotion rules) that may be surprising. Please note that the overflow is still possible when dividing large signed number to large unsigned number or vice-versa (but that case is less usual). The issue existed in all server versions. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Limit maximum sleep time for throttling when `max_execution_speed` or `max_execution_speed_bytes` is set. Fixed false errors like `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed issues about using `MATERIALIZED` columns and aliases in `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos Bird](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix `FormatFactory` behaviour for input streams which are not implemented as processor. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed typo. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) +- Typo in the error message ( is -\> are ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) +- Fixed error while parsing of columns list from string if type contained a comma (this issue was relevant for `File`, `URL`, `HDFS` storages) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) + +#### Security Fix {#security-fix} + +- This release also contains all bug security fixes from 19.13 and 19.11. +- Fixed the possibility of a fabricated query to cause server crash due to stack overflow in SQL parser. Fixed the possibility of stack overflow in Merge and Distributed tables, materialized views and conditions for row-level security that involve subqueries. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Improvement {#improvement-3} + +- Correct implementation of ternary logic for `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) +- Now values and rows with expired TTL will be removed after `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` query. Added queries `SYSTEM STOP/START TTL MERGES` to disallow/allow assign merges with TTL and filter expired values in all merges. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) +- Possibility to change the location of ClickHouse history file for client using `CLICKHOUSE_HISTORY_FILE` env. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) +- Remove `dry_run` flag from `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Support `ASOF JOIN` with `ON` section. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) +- Better support of skip indexes for mutations and replication. Support for `MATERIALIZE/CLEAR INDEX ... IN PARTITION` query. `UPDATE x = x` recalculates all indices that use column `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) +- Allow to `ATTACH` live views (for example, at the server startup) regardless to `allow_experimental_live_view` setting. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- For stack traces gathered by query profiler, do not include stack frames generated by the query profiler itself. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now table functions `values`, `file`, `url`, `hdfs` have support for ALIAS columns. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Throw an exception if `config.d` file doesn’t have the corresponding root element as the config file. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) +- Print extra info in exception message for `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) +- When determining shards of a `Distributed` table to be covered by a read query (for `optimize_skip_unused_shards` = 1) ClickHouse now checks conditions from both `prewhere` and `where` clauses of select statement. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) +- Enabled `SIMDJSON` for machines without AVX2 but with SSE 4.2 and PCLMUL instruction set. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse can work on filesystems without `O_DIRECT` support (such as ZFS and BtrFS) without additional tuning. [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Support push down predicate for final subquery. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Better `JOIN ON` keys extraction [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) +- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Optimize selecting of smallest column for `SELECT count()` query. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos Bird](https://github.com/amosbird)) +- Added `strict` parameter in `windowFunnel()`. When the `strict` is set, the `windowFunnel()` applies conditions only for the unique values. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) +- Safer interface of `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) +- Options line size when executing with `--help` option now corresponds with terminal size. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) +- Disable “read in order” optimization for aggregation without keys. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) +- HTTP status code for `INCORRECT_DATA` and `TYPE_MISMATCH` error codes was changed from default `500 Internal Server Error` to `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) +- Move Join object from `ExpressionAction` into `AnalyzedJoin`. `ExpressionAnalyzer` and `ExpressionAction` do not know about `Join` class anymore. Its logic is hidden by `AnalyzedJoin` iface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed possible deadlock of distributed queries when one of shards is localhost but the query is sent via network connection. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Changed semantic of multiple tables `RENAME` to avoid possible deadlocks. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Rewritten MySQL compatibility server to prevent loading full packet payload in memory. Decreased memory consumption for each connection to approximately `2 * DBMS_DEFAULT_BUFFER_SIZE` (read/write buffers). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) +- Move AST alias interpreting logic out of parser that doesn’t have to know anything about query semantics. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) +- Slightly more safe parsing of `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-copier`: Allow use `where_condition` from config with `partition_key` alias in query for checking partition existence (Earlier it was used only in reading data queries). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) +- Added optional message argument in `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) +- Server exception got while sending insertion data is now being processed in client as well. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) +- Added a metric `DistributedFilesToInsert` that shows the total number of files in filesystem that are selected to send to remote servers by Distributed tables. The number is summed across all shards. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Move most of JOINs prepare logic from `ExpressionAction/ExpressionAnalyzer` to `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix TSan [warning](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) +- Better information messages about lack of Linux capabilities. Logging fatal errors with “fatal” level, that will make it easier to find in `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- When enable dumping temporary data to the disk to restrict memory usage during `GROUP BY`, `ORDER BY`, it didn’t check the free disk space. The fix add a new setting `min_free_disk_space`, when the free disk space it smaller then the threshold, the query will stop and throw `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Removed recursive rwlock by thread. It makes no sense, because threads are reused between queries. `SELECT` query may acquire a lock in one thread, hold a lock from another thread and exit from first thread. In the same time, first thread can be reused by `DROP` query. This will lead to false “Attempt to acquire exclusive lock recursively” messages. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Split `ExpressionAnalyzer.appendJoin()`. Prepare a place in `ExpressionAnalyzer` for `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) +- Added `mysql_native_password` authentication plugin to MySQL compatibility server. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) +- Less number of `clock_gettime` calls; fixed ABI compatibility between debug/release in `Allocator` (insignificant issue). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Move `collectUsedColumns` from `ExpressionAnalyzer` to `SyntaxAnalyzer`. `SyntaxAnalyzer` makes `required_source_columns` itself now. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) +- Add setting `joined_subquery_requires_alias` to require aliases for subselects and table functions in `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) +- Extract `GetAggregatesVisitor` class from `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) +- `system.query_log`: change data type of `type` column to `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Static linking of `sha256_password` authentication plugin. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) +- Avoid extra dependency for the setting `compile` to work. In previous versions, the user may get error like `cannot open crti.o`, `unable to find library -lc` etc. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- More validation of the input that may come from malicious replica. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now `clickhouse-obfuscator` file is available in `clickhouse-client` package. In previous versions it was available as `clickhouse obfuscator` (with whitespace). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) +- Fixed deadlock when we have at least two queries that read at least two tables in different order and another query that performs DDL operation on one of tables. Fixed another very rare deadlock. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added `os_thread_ids` column to `system.processes` and `system.query_log` for better debugging possibilities. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- A workaround for PHP mysqlnd extension bugs which occur when `sha256_password` is used as a default authentication plugin (described in [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) +- Remove unneeded place with changed nullability columns. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) +- Set default value of `queue_max_wait_ms` to zero, because current value (five seconds) makes no sense. There are rare circumstances when this settings has any use. Added settings `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` and `connection_pool_max_wait_ms` for disambiguation. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Extract `SelectQueryExpressionAnalyzer` from `ExpressionAnalyzer`. Keep the last one for non-select queries. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) +- Removed duplicating input and output formats. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Allow user to override `poll_interval` and `idle_connection_timeout` settings on connection. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `MergeTree` now has an additional option `ttl_only_drop_parts` (disabled by default) to avoid partial pruning of parts, so that they dropped completely when all the rows in a part are expired. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) +- Type checks for set index functions. Throw exception if function got a wrong type. This fixes fuzz test with UBSan. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Performance Improvement {#performance-improvement-2} + +- Optimize queries with `ORDER BY expressions` clause, where `expressions` have coinciding prefix with sorting key in `MergeTree` tables. This optimization is controlled by `optimize_read_in_order` setting. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) +- Allow to use multiple threads during parts loading and removal. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Implemented batch variant of updating aggregate function states. It may lead to performance benefits. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Using `FastOps` library for functions `exp`, `log`, `sigmoid`, `tanh`. FastOps is a fast vector math library from Michael Parakhin (Yandex CTO). Improved performance of `exp` and `log` functions more than 6 times. The functions `exp` and `log` from `Float32` argument will return `Float32` (in previous versions they always return `Float64`). Now `exp(nan)` may return `inf`. The result of `exp` and `log` functions may be not the nearest machine representable number to the true answer. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) Using Danila Kutenin variant to make fastops working [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Disable consecutive key optimization for `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) +- Improved performance of `simdjson` library by getting rid of dynamic allocation in `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) +- Pre-fault pages when allocating memory with `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) +- Fix performance bug in `Decimal` comparison. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-4} + +- Remove Compiler (runtime template instantiation) because we’ve win over it’s performance. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added performance test to show degradation of performance in gcc-9 in more isolated way. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added table function `numbers_mt`, which is multithreaded version of `numbers`. Updated performance tests with hash functions. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Comparison mode in `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) +- Best effort for printing stack traces. Also added `SIGPROF` as a debugging signal to print stack trace of a running thread. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Every function in its own file, part 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Remove doubled const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) +- Formatting changes for `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) +- Better subquery for join creation in `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) +- Remove a redundant condition (found by PVS Studio). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) +- Separate the hash table interface for `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) +- Refactoring of settings. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) +- Add comments for `set` index functions. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) +- Increase OOM score in debug version on Linux. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) +- HDFS HA now work in debug build. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) +- Added a test to `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add test for multiple materialized views for Kafka table. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([Ivan](https://github.com/abyss7)) +- Make a better build scheme. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([Ivan](https://github.com/abyss7)) +- Fixed `test_external_dictionaries` integration in case it was executed under non root user. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- The bug reproduces when total size of written packets exceeds `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) +- Added a test for `RENAME` table race condition [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid data race on Settings in `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add integration test for handling errors by a cache dictionary. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) +- Disable parsing of ELF object files on Mac OS, because it makes no sense. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Attempt to make changelog generator better. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Adding `-Wshadow` switch to the GCC. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Removed obsolete code for `mimalloc` support. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `zlib-ng` determines x86 capabilities and saves this info to global variables. This is done in defalteInit call, which may be made by different threads simultaneously. To avoid multithreaded writes, do it on library startup. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) +- Regression test for a bug which in join which was fixed in [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) +- Fixed MSan report. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix flapping TTL test. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed false data race in `MergeTreeDataPart::is_frozen` field. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed timeouts in fuzz test. In previous version, it managed to find false hangup in query `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added debug checks to `static_cast` of columns. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Support for Oracle Linux in official RPM packages. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Changed json perftests from `once` to `loop` type. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `odbc-bridge.cpp` defines `main()` so it should not be included in `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) +- Test for crash in `FULL|RIGHT JOIN` with nulls in right table’s keys. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) +- Added a test for the limit on expansion of aliases just in case. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Switched from `boost::filesystem` to `std::filesystem` where appropriate. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added RPM packages to website. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add a test for fixed `Unknown identifier` exception in `IN` section. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) +- Simplify `shared_ptr_helper` because people facing difficulties understanding it. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added performance tests for fixed Gorilla and DoubleDelta codec. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) +- Split the integration test `test_dictionaries` into 4 separate tests. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix PVS-Studio warning in `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Allow to use `library` dictionary source with ASan. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added option to generate changelog from a list of PRs. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Lock the `TinyLog` storage when reading. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) +- Check for broken symlinks in CI. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Increase timeout for “stack overflow” test because it may take a long time in debug build. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added a check for double whitespaces. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix `new/delete` memory tracking when build with sanitizers. Tracking is not clear. It only prevents memory limit exceptions in tests. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) +- Enable back the check of undefined symbols while linking. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([Ivan](https://github.com/abyss7)) +- Avoid rebuilding `hyperscan` every day. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed UBSan report in `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Don’t allow to use query profiler with sanitizers because it is not compatible. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add test for reloading a dictionary after fail by timer. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix inconsistency in `PipelineExecutor::prepareProcessor` argument type. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Added a test for bad URIs. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added more checks to `CAST` function. This should get more information about segmentation fault in fuzzy test. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Added `gcc-9` support to `docker/builder` container that builds image locally. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Test for primary key with `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) +- Fixed tests affected by slow stack traces printing. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add a test case for crash in `groupUniqArray` fixed in [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) +- Fixed indices mutations tests. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) +- In performance test, do not read query log for queries we didn’t run. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) +- Materialized view now could be created with any low cardinality types regardless to the setting about suspicious low cardinality types. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) +- Updated tests for `send_logs_level` setting. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix build under gcc-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) +- Fix build with internal libc++. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([Ivan](https://github.com/abyss7)) +- Fix shared build with `rdkafka` library [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) +- Fixes for Mac OS build (incomplete). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) +- Fix “splitted” build. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Other build fixes: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos Bird](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([Ivan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) + +#### Backward Incompatible Change {#backward-incompatible-change-3} + +- Removed rarely used table function `catBoostPool` and storage `CatBoostPool`. If you have used this table function, please write email to `clickhouse-feedback@yandex-team.com`. Note that CatBoost integration remains and will be supported. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Disable `ANY RIGHT JOIN` and `ANY FULL JOIN` by default. Set `any_join_distinct_right_table_keys` setting to enable them. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) + +## ClickHouse Release 19.13 {#clickhouse-release-19-13} + +### ClickHouse Release 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} + +#### Bug Fix {#bug-fix-9} + +- This release also contains all bug fixes from 19.11.12.69. + +### ClickHouse Release 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} + +#### Bug Fix {#bug-fix-10} + +- This release also contains all bug fixes from 19.14.6.12. +- Fixed possible inconsistent state of table while executing `DROP` query for replicated table while zookeeper is not accessible. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix for data race in StorageMerge [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix bug introduced in query profiler which leads to endless recv from socket. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) +- Fix excessive CPU usage while executing `JSONExtractRaw` function over a boolean value. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fixes the regression while pushing to materialized view. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([Ivan](https://github.com/abyss7)) +- Table function `url` had the vulnerability allowed the attacker to inject arbitrary HTTP headers in the request. This issue was found by [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix useless `AST` check in Set index. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) +- Fixed parsing of `AggregateFunction` values embedded in query. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fixed wrong behaviour of `trim` functions family. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} + +#### Bug Fix {#bug-fix-11} + +- This release also contains all bug security fixes from 19.11.9.52 and 19.11.10.54. +- Fixed data race in `system.parts` table and `ALTER` query. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed mismatched header in streams happened in case of reading from empty distributed table with sample and prewhere. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed crash when using `IN` clause with a subquery with a tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Fix case with same column names in `GLOBAL JOIN ON` section. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix crash when casting types to `Decimal` that do not support it. Throw exception instead. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed crash in `extractAll()` function. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) +- Query transformation for `MySQL`, `ODBC`, `JDBC` table functions now works properly for `SELECT WHERE` queries with multiple `AND` expressions. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) +- Added previous declaration checks for MySQL 8 integration. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) + +#### Security Fix {#security-fix-1} + +- Fix two vulnerabilities in codecs in decompression phase (malicious user can fabricate compressed data that will lead to buffer overflow in decompression). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouse Release 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} + +#### Bug Fix {#bug-fix-12} + +- Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Fix NPE when using IN clause with a subquery with a tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Fixed an issue that if a stale replica becomes alive, it may still have data parts that were removed by DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- Fixed issue with parsing CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- Fixed data race in system.parts table and ALTER query. This fixes [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed possible data loss after `ALTER DELETE` query on table with skipping index. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Security Fix {#security-fix-2} + +- If the attacker has write access to ZooKeeper and is able to run custom server available from the network where ClickHouse run, it can create custom-built malicious server that will act as ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. Found by Eldar Zaitov, information security team at Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} + +#### New Feature {#new-feature-5} + +- Sampling profiler on query level. [Example](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) +- Allow to specify a list of columns with `COLUMNS('regexp')` expression that works like a more sophisticated variant of `*` asterisk. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CREATE TABLE AS table_function()` is now possible [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) +- Adam optimizer for stochastic gradient descent is used by default in `stochasticLinearRegression()` and `stochasticLogisticRegression()` aggregate functions, because it shows good quality without almost any tuning. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) +- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Andy Yang](https://github.com/andyyzh)) +- `RENAME` queries now work with all storages. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([Ivan](https://github.com/abyss7)) +- Now client receive logs from server with any desired level by setting `send_logs_level` regardless to the log level specified in server settings. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) + +#### Backward Incompatible Change {#backward-incompatible-change-4} + +- The setting `input_format_defaults_for_omitted_fields` is enabled by default. Inserts in Distributed tables need this setting to be the same on cluster (you need to set it before rolling update). It enables calculation of complex default expressions for omitted fields in `JSONEachRow` and `CSV*` formats. It should be the expected behavior but may lead to negligible performance difference. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) + +#### Experimental Features {#experimental-features} + +- New query processing pipeline. Use `experimental_use_processors=1` option to enable it. Use for your own trouble. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Bug Fix {#bug-fix-13} + +- Kafka integration has been fixed in this version. +- Fixed `DoubleDelta` encoding of `Int64` for large `DoubleDelta` values, improved `DoubleDelta` encoding for random data for `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) +- Fixed overestimation of `max_rows_to_read` if the setting `merge_tree_uniform_read_distribution` is set to 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Improvement {#improvement-4} + +- Throws an exception if `config.d` file doesn’t have the corresponding root element as the config file [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) + +#### Performance Improvement {#performance-improvement-3} + +- Optimize `count()`. Now it uses the smallest column (if possible). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos Bird](https://github.com/amosbird)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-5} + +- Report memory usage in performance tests. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) +- Fix build with external `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([Ivan](https://github.com/abyss7)) +- Fix shared build with `rdkafka` library [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) + +## ClickHouse Release 19.11 {#clickhouse-release-19-11} + +### ClickHouse Release 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} + +#### Bug Fix {#bug-fix-14} + +- Fixed rare crash in `ALTER MODIFY COLUMN` and vertical merge when one of merged/altered parts is empty (0 rows). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- Manual update of `SIMDJSON`. This fixes possible flooding of stderr files with bogus json diagnostic messages. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) +- Fixed bug with `mrk` file extension for mutations ([alesapin](https://github.com/alesapin)) + +### ClickHouse Release 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} + +#### Bug Fix {#bug-fix-15} + +- Fixed performance degradation of index analysis on complex keys on large tables. This fixes [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid rare SIGSEGV while sending data in tables with Distributed engine (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) +- Fix `Unknown identifier` with multiple joins. This fixes [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouse Release 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} + +- Fix logical error causing segfaults when selecting from Kafka empty topic. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) +- Fix for function `АrrayEnumerateUniqRanked` with empty arrays in params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) + +### ClickHouse Release 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} + +#### Bug Fix {#bug-fix-16} + +- Do store offsets for Kafka messages manually to be able to commit them all at once for all partitions. Fixes potential duplication in “one consumer - many partitions” scenario. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([Ivan](https://github.com/abyss7)) + +### ClickHouse Release 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} + +- Improve error handling in cache dictionaries. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fixed bug in function `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) +- Fix `JSONExtract` function while extracting a `Tuple` from JSON. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fixed possible data loss after `ALTER DELETE` query on table with skipping index. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) +- Fixed performance test. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Parquet: Fix reading boolean columns. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed wrong behaviour of `nullIf` function for constant arguments. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix Kafka messages duplication problem on normal server restart. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) +- Fixed an issue when long `ALTER UPDATE` or `ALTER DELETE` may prevent regular merges to run. Prevent mutations from executing if there is no enough free threads available. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) +- Fixed error with processing “timezone” in server configuration file. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix kafka tests. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([Ivan](https://github.com/abyss7)) + +#### Security Fix {#security-fix-3} + +- If the attacker has write access to ZooKeeper and is able to run custom server available from the network where ClickHouse runs, it can create custom-built malicious server that will act as ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. Found by Eldar Zaitov, information security team at Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} + +#### Bug Fix {#bug-fix-17} + +- Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Fix NPE when using IN clause with a subquery with a tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Fixed an issue that if a stale replica becomes alive, it may still have data parts that were removed by DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- Fixed issue with parsing CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- Fixed data race in system.parts table and ALTER query. This fixes [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} + +#### Bug Fix {#bug-fix-18} + +- Kafka integration has been fixed in this version. +- Fix segfault when using `arrayReduce` for constant arguments. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed `toFloat()` monotonicity. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- Fix segfault with enabled `optimize_skip_unused_shards` and missing sharding key. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) +- Fixed logic of `arrayEnumerateUniqRanked` function. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Removed extra verbose logging from MySQL handler. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix wrong behavior and possible segfaults in `topK` and `topKWeighted` aggregated functions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) +- Do not expose virtual columns in `system.columns` table. This is required for backward compatibility. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix bug with memory allocation for string fields in complex key cache dictionary. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- Fix bug with enabling adaptive granularity when creating new replica for `Replicated*MergeTree` table. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- Fix infinite loop when reading Kafka messages. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) +- Fixed the possibility of a fabricated query to cause server crash due to stack overflow in SQL parser and possibility of stack overflow in `Merge` and `Distributed` tables [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed Gorilla encoding error on small sequences. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) + +#### Improvement {#improvement-5} + +- Allow user to override `poll_interval` and `idle_connection_timeout` settings on connection. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} + +#### Bug Fix {#bug-fix-19} + +- Fixed the possibility of hanging queries when server is overloaded. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix FPE in yandexConsistentHash function. This fixes [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed bug in conversion of `LowCardinality` types in `AggregateFunctionFactory`. This fixes [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix parsing of `bool` settings from `true` and `false` strings in configuration files. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- Fix rare bug with incompatible stream headers in queries to `Distributed` table over `MergeTree` table when part of `WHERE` moves to `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- Fixed overflow in integer division of signed type to unsigned type. This fixes [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Backward Incompatible Change {#backward-incompatible-change-5} + +- `Kafka` still broken. + +### ClickHouse Release 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} + +#### Bug Fix {#bug-fix-20} + +- Fix bug with writing secondary indices marks with adaptive granularity. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- Fix `WITH ROLLUP` and `WITH CUBE` modifiers of `GROUP BY` with two-level aggregation. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed hang in `JSONExtractRaw` function. Fixed [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix segfault in ExternalLoader::reloadOutdated(). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fixed the case when server may close listening sockets but not shutdown and continue serving remaining queries. You may end up with two running clickhouse-server processes. Sometimes, the server may return an error `bad_function_call` for remaining queries. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed useless and incorrect condition on update field for initial loading of external dictionaries via ODBC, MySQL, ClickHouse and HTTP. This fixes [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed irrelevant exception in cast of `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix non-deterministic result of “uniq” aggregate function in extreme rare cases. The bug was present in all ClickHouse versions. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Segfault when we set a little bit too high CIDR on the function `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Fixed small memory leak when server throw many exceptions from many different contexts. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix the situation when consumer got paused before subscription and not resumed afterwards. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([Ivan](https://github.com/abyss7)) Note that Kafka is broken in this version. +- Clearing the Kafka data buffer from the previous read operation that was completed with an error [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Note that Kafka is broken in this version. +- Since `StorageMergeTree::background_task_handle` is initialized in `startup()` the `MergeTreeBlockOutputStream::write()` may try to use it before initialization. Just check if it is initialized. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-6} + +- Added official `rpm` packages. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) +- Add an ability to build `.rpm` and `.tgz` packages with `packager` script. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) +- Fixes for “Arcadia” build system. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) + +#### Backward Incompatible Change {#backward-incompatible-change-6} + +- `Kafka` is broken in this version. + +### ClickHouse Release 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} + +#### New Feature {#new-feature-6} + +- Added support for prepared statements. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alexander](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `DoubleDelta` and `Gorilla` column codecs [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) +- Added `os_thread_priority` setting that allows to control the “nice” value of query processing threads that is used by OS to adjust dynamic scheduling priority. It requires `CAP_SYS_NICE` capabilities to work. This implements [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Implement `_topic`, `_offset`, `_key` columns for Kafka engine [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([Ivan](https://github.com/abyss7)) Note that Kafka is broken in this version. +- Add aggregate function combinator `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) +- Aggregate functions `groupArrayMovingSum(win_size)(x)` and `groupArrayMovingAvg(win_size)(x)`, which calculate moving sum/avg with or without window-size limitation. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) +- Add synonim `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) +- Intergate H3 function `geoToH3` from Uber. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Bug Fix {#bug-fix-21} + +- Implement DNS cache with asynchronous update. Separate thread resolves all hosts and updates DNS cache with period (setting `dns_cache_update_period`). It should help, when ip of hosts changes frequently. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) +- Fix segfault in `Delta` codec which affects columns with values less than 32 bits size. The bug led to random memory corruption. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- Fix segfault in TTL merge with non-physical columns in block. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Fix rare bug in checking of part with `LowCardinality` column. Previously `checkDataPart` always fails for part with `LowCardinality` column. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- Avoid hanging connections when server thread pool is full. It is important for connections from `remote` table function or connections to a shard without replicas when there is long connection timeout. This fixes [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Support for constant arguments to `evalMLModel` function. This fixes [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed the issue when ClickHouse determines default time zone as `UCT` instead of `UTC`. This fixes [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed buffer underflow in `visitParamExtractRaw`. This fixes [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now distributed `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` queries will be executed directly on leader replica. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- Fix `coalesce` for `ColumnConst` with `ColumnNullable` + related changes. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix the `ReadBufferFromKafkaConsumer` so that it keeps reading new messages after `commit()` even if it was stalled before [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([Ivan](https://github.com/abyss7)) +- Fix `FULL` and `RIGHT` JOIN results when joining on `Nullable` keys in right table. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) +- Possible fix of infinite sleeping of low-priority queries. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix race condition, which cause that some queries may not appear in query\_log after `SYSTEM FLUSH LOGS` query. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed `heap-use-after-free` ASan warning in ClusterCopier caused by watch which try to use already removed copier object. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed wrong `StringRef` pointer returned by some implementations of `IColumn::deserializeAndInsertFromArena`. This bug affected only unit-tests. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Prevent source and intermediate array join columns of masking same name columns. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix insert and select query to MySQL engine with MySQL style identifier quoting. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([Winter Zhang](https://github.com/zhang2014)) +- Now `CHECK TABLE` query can work with MergeTree engine family. It returns check status and message if any for each part (or file in case of simplier engines). Also, fix bug in fetch of a broken part. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) +- Fix SPLIT\_SHARED\_LIBRARIES runtime [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) +- Fixed time zone initialization when `/etc/localtime` is a relative symlink like `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- clickhouse-copier: Fix use-after free on shutdown [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) +- Updated `simdjson`. Fixed the issue that some invalid JSONs with zero bytes successfully parse. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix shutdown of SystemLogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) +- Fix hanging when condition in invalidate\_query depends on a dictionary. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Improvement {#improvement-6} + +- Allow unresolvable addresses in cluster configuration. They will be considered unavailable and tried to resolve at every connection attempt. This is especially useful for Kubernetes. This fixes [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Close idle TCP connections (with one hour timeout by default). This is especially important for large clusters with multiple distributed tables on every server, because every server can possibly keep a connection pool to every other server, and after peak query concurrency, connections will stall. This fixes [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Better quality of `topK` function. Changed the SavingSpace set behavior to remove the last element if the new element have a bigger weight. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) +- URL functions to work with domains now can work for incomplete URLs without scheme [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) +- Checksums added to the `system.parts_columns` table. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Added `Enum` data type as a synonim for `Enum8` or `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) +- Full bit transpose variant for `T64` codec. Could lead to better compression with `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) +- Condition on `startsWith` function now can uses primary key. This fixes [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) and [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) +- Allow to use `clickhouse-copier` with cross-replication cluster topology by permitting empty database name. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) +- Use `UTC` as default timezone on a system without `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` was printed and server or client refused to start. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Returned back support for floating point argument in function `quantileTiming` for backward compatibility. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Show which table is missing column in error messages. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([Ivan](https://github.com/abyss7)) +- Disallow run query with same query\_id by various users [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) +- More robust code for sending metrics to Graphite. It will work even during long multiple `RENAME TABLE` operation. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- More informative error messages will be displayed when ThreadPool cannot schedule a task for execution. This fixes [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Inverting ngramSearch to be more intuitive [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) +- Add user parsing in HDFS engine builder [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) +- Update default value of `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) +- Added a notion of obsolete settings. The obsolete setting `allow_experimental_low_cardinality_type` can be used with no effect. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) + +#### Performance Improvement {#performance-improvement-4} + +- Increase number of streams to SELECT from Merge table for more uniform distribution of threads. Added setting `max_streams_multiplier_for_merge_tables`. This fixes [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-7} + +- Add a backward compatibility test for client-server interaction with different versions of clickhouse. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) +- Test coverage information in every commit and pull request. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) +- Cooperate with address sanitizer to support our custom allocators (`Arena` and `ArenaWithFreeLists`) for better debugging of “use-after-free” errors. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) +- Switch to [LLVM libunwind implementation](https://github.com/llvm-mirror/libunwind) for C++ exception handling and for stack traces printing [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) +- Add two more warnings from -Weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Allow to build ClickHouse with Memory Sanitizer. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed ubsan report about `bitTest` function in fuzz test. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Docker: added possibility to init a ClickHouse instance which requires authentication. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) +- Update librdkafka to version 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([Ivan](https://github.com/abyss7)) +- Add global timeout for integration tests and disable some of them in tests code. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) +- Fix some ThreadSanitizer failures. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) +- The `--no-undefined` option forces the linker to check all external names for existence while linking. It’s very useful to track real dependencies between libraries in the split build mode. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([Ivan](https://github.com/abyss7)) +- Added performance test for [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed compatibility with gcc-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added support for gcc-9. This fixes [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed error when libunwind can be linked incorrectly. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed a few warnings found by PVS-Studio. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added initial support for `clang-tidy` static analyzer. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Convert BSD/Linux endian macros( ‘be64toh’ and ‘htobe64’) to the Mac OS X equivalents [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fu Chen](https://github.com/fredchenbj)) +- Improved integration tests guide. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixing build at macosx + gcc9 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) +- Fix a hard-to-spot typo: aggreAGte -\> aggregate. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) +- Fix freebsd build [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) +- Add link to experimental YouTube channel to website [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) +- CMake: add option for coverage flags: WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) +- Fix initial size of some inline PODArray’s. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) +- clickhouse-server.postinst: fix os detection for centos 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) +- Added Arch linux package generation. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Split Common/config.h by libs (dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) +- Fixes for “Arcadia” build platform [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) +- Fixes for unconventional build (gcc9, no submodules) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) +- Require explicit type in unalignedStore because it was proven to be bug-prone [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) +- Fixes MacOS build [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) +- Performance test concerning the new JIT feature with bigger dataset, as requested here [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Run stateful tests in stress test [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) + +#### Backward Incompatible Change {#backward-incompatible-change-7} + +- `Kafka` is broken in this version. +- Enable `adaptive_index_granularity` = 10MB by default for new `MergeTree` tables. If you created new MergeTree tables on version 19.11+, downgrade to versions prior to 19.6 will be impossible. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) +- Removed obsolete undocumented embedded dictionaries that were used by Yandex.Metrica. The functions `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` are no longer available. If you are using these functions, write email to clickhouse-feedback@yandex-team.com. Note: at the last moment we decided to keep these functions for a while. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouse Release 19.10 {#clickhouse-release-19-10} + +### ClickHouse Release 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} + +#### New Feature {#new-feature-7} + +- Add new column codec: `T64`. Made for (U)IntX/EnumX/Data(Time)/DecimalX columns. It should be good for columns with constant or small range values. Codec itself allows enlarge or shrink data type without re-compression. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) +- Add database engine `MySQL` that allow to view all the tables in remote MySQL server [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([Winter Zhang](https://github.com/zhang2014)) +- `bitmapContains` implementation. It’s 2x faster than `bitmapHasAny` if the second bitmap contains one element. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) +- Support for `crc32` function (with behaviour exactly as in MySQL or PHP). Do not use it if you need a hash function. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) +- Implemented `SYSTEM START/STOP DISTRIBUTED SENDS` queries to control asynchronous inserts into `Distributed` tables. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([Winter Zhang](https://github.com/zhang2014)) + +#### Bug Fix {#bug-fix-22} + +- Ignore query execution limits and max parts size for merge limits while executing mutations. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) +- Fix bug which may lead to deduplication of normal blocks (extremely rare) and insertion of duplicate blocks (more often). [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) +- Fix of function `arrayEnumerateUniqRanked` for arguments with empty arrays [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) +- Don’t subscribe to Kafka topics without intent to poll any messages. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([Ivan](https://github.com/abyss7)) +- Make setting `join_use_nulls` get no effect for types that cannot be inside Nullable [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fixed `Incorrect size of index granularity` errors [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) +- Fix Float to Decimal convert overflow [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) +- Flush buffer when `WriteBufferFromHDFS`’s destructor is called. This fixes writing into `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) + +#### Improvement {#improvement-7} + +- Treat empty cells in `CSV` as default values when the setting `input_format_defaults_for_omitted_fields` is enabled. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) +- Non-blocking loading of external dictionaries. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) +- Network timeouts can be dynamically changed for already established connections according to the settings. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) +- Using “public\_suffix\_list” for functions `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. It’s using a perfect hash table generated by `gperf` with a list generated from the file: https://publicsuffix.org/list/public\_suffix\_list.dat. (for example, now we recognize the domain `ac.uk` as non-significant). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Adopted `IPv6` data type in system tables; unified client info columns in `system.processes` and `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Using sessions for connections with MySQL compatibility protocol. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) +- Support more `ALTER` queries `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) +- Support `` section in `clickhouse-local` config file. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) +- Allow run query with `remote` table function in `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) + +#### Performance Improvement {#performance-improvement-5} + +- Add the possibility to write the final mark at the end of MergeTree columns. It allows to avoid useless reads for keys that are out of table data range. It is enabled only if adaptive index granularity is in use. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) +- Improved performance of MergeTree tables on very slow filesystems by reducing number of `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed performance degradation in reading from MergeTree tables that was introduced in version 19.6. Fixes \#5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-8} + +- Implemented `TestKeeper` as an implementation of ZooKeeper interface used for testing [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) +- From now on `.sql` tests can be run isolated by server, in parallel, with random database. It allows to run them faster, add new tests with custom server configurations, and be sure that different tests doesn’t affect each other. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([Ivan](https://github.com/abyss7)) +- Remove `` and `` from performance tests [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fixed “select\_format” performance test for `Pretty` formats [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouse Release 19.9 {#clickhouse-release-19-9} + +### ClickHouse Release 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} + +#### Bug Fix {#bug-fix-23} + +- Fix segfault in Delta codec which affects columns with values less than 32 bits size. The bug led to random memory corruption. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- Fix rare bug in checking of part with LowCardinality column. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- Fix segfault in TTL merge with non-physical columns in block. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Fix potential infinite sleeping of low-priority queries. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix how ClickHouse determines default time zone as UCT instead of UTC. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix bug about executing distributed DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER queries on follower replica before leader replica. Now they will be executed directly on leader replica. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- Fix race condition, which cause that some queries may not appear in query\_log instantly after SYSTEM FLUSH LOGS query. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Added missing support for constant arguments to `evalMLModel` function. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} + +#### New Feature {#new-feature-8} + +- Print information about frozen parts in `system.parts` table. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) +- Ask client password on clickhouse-client start on tty if not set in arguments [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) +- Implement `dictGet` and `dictGetOrDefault` functions for Decimal types. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Improvement {#improvement-8} + +- Debian init: Add service stop timeout [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) +- Add setting forbidden by default to create table with suspicious types for LowCardinality [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) +- Regression functions return model weights when not used as State in function `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) +- Rename and improve regression methods. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) +- Clearer interfaces of string searchers. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) + +#### Bug Fix {#bug-fix-24} + +- Fix potential data loss in Kafka [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([Ivan](https://github.com/abyss7)) +- Fix potential infinite loop in `PrettySpace` format when called with zero columns [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fixed UInt32 overflow bug in linear models. Allow eval ML model for non-const model argument. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `ALTER TABLE ... DROP INDEX IF EXISTS ...` should not raise an exception if provided index does not exist [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Fix segfault with `bitmapHasAny` in scalar subquery [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fixed error when replication connection pool doesn’t retry to resolve host, even when DNS cache was dropped. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- Fixed `ALTER ... MODIFY TTL` on ReplicatedMergeTree. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) +- Fix INSERT into Distributed table with MATERIALIZED column [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) +- Fix bad alloc when truncate Join storage [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) +- In recent versions of package tzdata some of files are symlinks now. The current mechanism for detecting default timezone gets broken and gives wrong names for some timezones. Now at least we force the timezone name to the contents of TZ if provided. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) +- Fix some extremely rare cases with MultiVolnitsky searcher when the constant needles in sum are at least 16KB long. The algorithm missed or overwrote the previous results which can lead to the incorrect result of `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) +- Fix the issue when settings for ExternalData requests couldn’t use ClickHouse settings. Also, for now, settings `date_time_input_format` and `low_cardinality_allow_in_native_format` cannot be used because of the ambiguity of names (in external data it can be interpreted as table format and in the query it can be a setting). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) +- Fix bug when parts were removed only from FS without dropping them from Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- Remove debug logging from MySQL protocol [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Skip ZNONODE during DDL query processing [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Fix mix `UNION ALL` result column type. There were cases with inconsistent data and column types of resulting columns. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- Throw an exception on wrong integers in `dictGetT` functions instead of crash. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix wrong element\_count and load\_factor for hashed dictionary in `system.dictionaries` table. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-9} + +- Fixed build without `Brotli` HTTP compression support (`ENABLE_BROTLI=OFF` cmake variable). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) +- Include roaring.h as roaring/roaring.h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) +- Fix gcc9 warnings in hyperscan (\#line directive is evil!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) +- Fix all warnings when compiling with gcc-9. Fix some contrib issues. Fix gcc9 ICE and submit it to bugzilla. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) +- Fixed linking with lld [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Remove unused specializations in dictionaries [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) +- Improvement performance tests for formatting and parsing tables for different types of files [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fixes for parallel test run [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) +- Docker: use configs from clickhouse-test [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) +- Fix compile for FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) +- Upgrade boost to 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) +- Fix build clickhouse as submodule [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) +- Improve JSONExtract performance tests [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) + +## ClickHouse Release 19.8 {#clickhouse-release-19-8} + +### ClickHouse Release 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} + +#### New Features {#new-features} + +- Added functions to work with JSON [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) +- Add a function basename, with a similar behaviour to a basename function, which exists in a lot of languages (`os.path.basename` in python, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Added `LIMIT n, m BY` or `LIMIT m OFFSET n BY` syntax to set offset of n for LIMIT BY clause. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) +- Added new data type `SimpleAggregateFunction`, which allows to have columns with light aggregation in an `AggregatingMergeTree`. This can only be used with simple functions like `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) +- Added support for non-constant arguments in function `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) +- Added functions `skewPop`, `skewSamp`, `kurtPop` and `kurtSamp` to compute for sequence skewness, sample skewness, kurtosis and sample kurtosis respectively. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) +- Support rename operation for `MaterializeView` storage. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Added server which allows connecting to ClickHouse using MySQL client. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) +- Add `toDecimal*OrZero` and `toDecimal*OrNull` functions. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) +- Support Decimal types in functions: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) +- Added `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) +- Added `format` function. Formatting constant pattern (simplified Python format pattern) with the strings listed in the arguments. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) +- Added `system.detached_parts` table containing information about detached parts of `MergeTree` tables. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) +- Added `ngramSearch` function to calculate the non-symmetric difference between needle and haystack. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) +- Implementation of basic machine learning methods (stochastic linear regression and logistic regression) using aggregate functions interface. Has different strategies for updating model weights (simple gradient descent, momentum method, Nesterov method). Also supports mini-batches of custom size. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) +- Implementation of `geohashEncode` and `geohashDecode` functions. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) +- Added aggregate function `timeSeriesGroupSum`, which can aggregate different time series that sample timestamp not alignment. It will use linear interpolation between two sample timestamp and then sum time-series together. Added aggregate function `timeSeriesGroupRateSum`, which calculates the rate of time-series and then sum rates together. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Yangkuan Liu](https://github.com/LiuYangkuan)) +- Added functions `IPv4CIDRtoIPv4Range` and `IPv6CIDRtoIPv6Range` to calculate the lower and higher bounds for an IP in the subnet using a CIDR. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Add a X-ClickHouse-Summary header when we send a query using HTTP with enabled setting `send_progress_in_http_headers`. Return the usual information of X-ClickHouse-Progress, with additional information like how many rows and bytes were inserted in the query. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Improvements {#improvements} + +- Added `max_parts_in_total` setting for MergeTree family of tables (default: 100 000) that prevents unsafe specification of partition key \#5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-obfuscator`: derive seed for individual columns by combining initial seed with column name, not column position. This is intended to transform datasets with multiple related tables, so that tables will remain JOINable after transformation. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added functions `JSONExtractRaw`, `JSONExtractKeyAndValues`. Renamed functions `jsonExtract` to `JSONExtract`. When something goes wrong these functions return the correspondent values, not `NULL`. Modified function `JSONExtract`, now it gets the return type from its last parameter and doesn’t inject nullables. Implemented fallback to RapidJSON in case AVX2 instructions are not available. Simdjson library updated to a new version. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) +- Now `if` and `multiIf` functions don’t rely on the condition’s `Nullable`, but rely on the branches for sql compatibility. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu](https://github.com/janplus)) +- `In` predicate now generates `Null` result from `Null` input like the `Equal` function. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu](https://github.com/janplus)) +- Check the time limit every (flush\_interval / poll\_timeout) number of rows from Kafka. This allows to break the reading from Kafka consumer more frequently and to check the time limits for the top-level streams [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([Ivan](https://github.com/abyss7)) +- Link rdkafka with bundled SASL. It should allow to use SASL SCRAM authentication [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([Ivan](https://github.com/abyss7)) +- Batched version of RowRefList for ALL JOINS. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) +- clickhouse-server: more informative listen error messages. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) +- Support dictionaries in clickhouse-copier for functions in `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) +- Add new setting `kafka_commit_every_batch` to regulate Kafka committing policy. + It allows to set commit mode: after every batch of messages is handled, or after the whole block is written to the storage. It’s a trade-off between losing some messages or reading them twice in some extreme situations. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([Ivan](https://github.com/abyss7)) +- Make `windowFunnel` support other Unsigned Integer Types. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) +- Allow to shadow virtual column `_table` in Merge engine. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([Ivan](https://github.com/abyss7)) +- Make `sequenceMatch` aggregate functions support other unsigned Integer types [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) +- Better error messages if checksum mismatch is most likely caused by hardware failures. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Check that underlying tables support sampling for `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([Ivan](https://github.com/abyss7)) +- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Improvements of MySQL Wire Protocol. Changed name of format to MySQLWire. Using RAII for calling RSA\_free. Disabling SSL if context cannot be created. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) +- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) +- Respect query settings in asynchronous INSERTs into Distributed tables. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) +- Renamed functions `leastSqr` to `simpleLinearRegression`, `LinearRegression` to `linearRegression`, `LogisticRegression` to `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Performance Improvements {#performance-improvements} + +- Parallelize processing of parts of non-replicated MergeTree tables in ALTER MODIFY query. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) +- Optimizations in regular expressions extraction. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) +- Do not add right join key column to join result if it’s used only in join on section. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) +- Freeze the Kafka buffer after first empty response. It avoids multiple invokations of `ReadBuffer::next()` for empty result in some row-parsing streams. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([Ivan](https://github.com/abyss7)) +- `concat` function optimization for multiple arguments. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) +- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) +- Upgrade our LZ4 implementation with reference one to have faster decompression. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) +- Implemented MSD radix sort (based on kxsort), and partial sorting. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) + +#### Bug Fixes {#bug-fixes} + +- Fix push require columns with join [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Winter Zhang](https://github.com/zhang2014)) +- Fixed bug, when ClickHouse is run by systemd, the command `sudo service clickhouse-server forcerestart` was not working as expected. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) +- Fix http error codes in DataPartsExchange (interserver http server on 9009 port always returned code 200, even on errors). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) +- Fix SimpleAggregateFunction for String longer than MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) +- Fix error for `Decimal` to `Nullable(Decimal)` conversion in IN. Support other Decimal to Decimal conversions (including different scales). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed FPU clobbering in simdjson library that lead to wrong calculation of `uniqHLL` and `uniqCombined` aggregate function and math functions such as `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed handling mixed const/nonconst cases in JSON functions. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix `retention` function. Now all conditions that satisfy in a row of data are added to the data state. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) +- Fix result type for `quantileExact` with Decimals. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Documentation {#documentation} + +- Translate documentation for `CollapsingMergeTree` to chinese. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) +- Translate some documentation about table engines to chinese. + [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) + [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) + ([never lee](https://github.com/neverlee)) + +#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements} + +- Fix some sanitizer reports that show probable use-after-free.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([Ivan](https://github.com/abyss7)) +- Move performance tests out of separate directories for convenience. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix incorrect performance tests. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) +- Added a tool to calculate checksums caused by bit flips to debug hardware issues. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Make runner script more usable. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) +- Add small instruction how to write performance tests. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) +- Add ability to make substitutions in create, fill and drop query in performance tests [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) + +## ClickHouse Release 19.7 {#clickhouse-release-19-7} + +### ClickHouse Release 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} + +#### Bug Fix {#bug-fix-25} + +- Fix performance regression in some queries with JOIN. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Winter Zhang](https://github.com/zhang2014)) + +### ClickHouse Release 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} + +#### New Features {#new-features-1} + +- Added bitmap related functions `bitmapHasAny` and `bitmapHasAll` analogous to `hasAny` and `hasAll` functions for arrays. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) + +#### Bug Fixes {#bug-fixes-1} + +- Fix segfault on `minmax` INDEX with Null value. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) +- Mark all input columns in LIMIT BY as required output. It fixes ‘Not found column’ error in some distributed queries. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) +- Fix “Column ‘0’ already exists” error in `SELECT .. PREWHERE` on column with DEFAULT [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) +- Fix `ALTER MODIFY TTL` query on `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) +- Don’t crash the server when Kafka consumers have failed to start. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([Ivan](https://github.com/abyss7)) +- Fixed bitmap functions produce wrong result. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Andy Yang](https://github.com/andyyzh)) +- Fix element\_count for hashed dictionary (do not include duplicates) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) +- Use contents of environment variable TZ as the name for timezone. It helps to correctly detect default timezone in some cases.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) +- Do not try to convert integers in `dictGetT` functions, because it doesn’t work correctly. Throw an exception instead. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix settings in ExternalData HTTP request. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila + Kutenin](https://github.com/danlark1)) +- Fix bug when parts were removed only from FS without dropping them from Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- Fix segmentation fault in `bitmapHasAny` function. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fixed error when replication connection pool doesn’t retry to resolve host, even when DNS cache was dropped. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- Fixed `DROP INDEX IF EXISTS` query. Now `ALTER TABLE ... DROP INDEX IF EXISTS ...` query doesn’t raise an exception if provided index does not exist. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Fix union all supertype column. There were cases with inconsistent data and column types of resulting columns. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- Skip ZNONODE during DDL query processing. Before if another node removes the znode in task queue, the one that + did not process it, but already get list of children, will terminate the DDLWorker thread. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Fix INSERT into Distributed() table with MATERIALIZED column. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) + +### ClickHouse Release 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} + +#### New Features {#new-features-2} + +- Allow to limit the range of a setting that can be specified by user. + These constraints can be set up in user settings profile. + [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly + Baranov](https://github.com/vitlibar)) +- Add a second version of the function `groupUniqArray` with an optional + `max_size` parameter that limits the size of the resulting array. This + behavior is similar to `groupArray(max_size)(x)` function. + [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- For TSVWithNames/CSVWithNames input file formats, column order can now be + determined from file header. This is controlled by + `input_format_with_names_use_header` parameter. + [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) + ([Alexander](https://github.com/Akazz)) + +#### Bug Fixes {#bug-fixes-2} + +- Crash with uncompressed\_cache + JOIN during merge (\#5197) + [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila + Kutenin](https://github.com/danlark1)) +- Segmentation fault on a clickhouse-client query to system tables. \#5066 + [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) + ([Ivan](https://github.com/abyss7)) +- Data loss on heavy load via KafkaEngine (\#4736) + [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) + ([Ivan](https://github.com/abyss7)) +- Fixed very rare data race condition that could happen when executing a query with UNION ALL involving at least two SELECTs from system.columns, system.tables, system.parts, system.parts\_tables or tables of Merge family and performing ALTER of columns of the related tables concurrently. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Performance Improvements {#performance-improvements-1} + +- Use radix sort for sorting by single numeric column in `ORDER BY` without + `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), + [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) + ([Evgenii Pravda](https://github.com/kvinty), + [alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Documentation {#documentation-1} + +- Translate documentation for some table engines to Chinese. + [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), + [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), + [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) + ([张风啸](https://github.com/AlexZFX)), + [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([never + lee](https://github.com/neverlee)) + +#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-1} + +- Print UTF-8 characters properly in `clickhouse-test`. + [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add command line parameter for clickhouse-client to always load suggestion + data. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Resolve some of PVS-Studio warnings. + [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Update LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila + Kutenin](https://github.com/danlark1)) +- Add gperf to build requirements for upcoming pull request \#5030. + [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) + ([proller](https://github.com/proller)) + +## ClickHouse Release 19.6 {#clickhouse-release-19-6} + +### ClickHouse Release 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} + +#### Bug Fixes {#bug-fixes-3} + +- Fixed IN condition pushdown for queries from table functions `mysql` and `odbc` and corresponding table engines. This fixes \#3540 and \#2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix deadlock in Zookeeper. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) +- Allow quoted decimals in CSV. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) +- Disallow conversion from float Inf/NaN into Decimals (throw exception). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix data race in rename query. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([Winter Zhang](https://github.com/zhang2014)) +- Temporarily disable LFAlloc. Usage of LFAlloc might lead to a lot of MAP\_FAILED in allocating UncompressedCache and in a result to crashes of queries at high loaded servers. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) + +### ClickHouse Release 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} + +#### New Features {#new-features-3} + +- TTL expressions for columns and tables. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) +- Added support for `brotli` compression for HTTP responses (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mikhail](https://github.com/fandyushin)) +- Added new function `isValidUTF8` for checking whether a set of bytes is correctly utf-8 encoded. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) +- Add new load balancing policy `first_or_random` which sends queries to the first specified host and if it’s inaccessible send queries to random hosts of shard. Useful for cross-replication topology setups. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) + +#### Experimental Features {#experimental-features-1} + +- Add setting `index_granularity_bytes` (adaptive index granularity) for MergeTree\* tables family. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) + +#### Improvements {#improvements-1} + +- Added support for non-constant and negative size and length arguments for function `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Disable push-down to right table in left join, left table in right join, and both tables in full join. This fixes wrong JOIN results in some cases. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([Ivan](https://github.com/abyss7)) +- `clickhouse-copier`: auto upload task configuration from `--task-file` option [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) +- Added typos handler for storage factory and table functions factory. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) +- Support asterisks and qualified asterisks for multiple joins without subqueries [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) +- Make missing column error message more user friendly. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Performance Improvements {#performance-improvements-2} + +- Significant speedup of ASOF JOIN [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) + +#### Backward Incompatible Changes {#backward-incompatible-changes} + +- HTTP header `Query-Id` was renamed to `X-ClickHouse-Query-Id` for consistency. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mikhail](https://github.com/fandyushin)) + +#### Bug Fixes {#bug-fixes-4} + +- Fixed potential null pointer dereference in `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) +- Fixed error on query with JOIN + ARRAY JOIN [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed hanging on start of the server when a dictionary depends on another dictionary via a database with engine=Dictionary. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) +- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix potentially wrong result for `SELECT DISTINCT` with `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed very rare data race condition that could happen when executing a query with UNION ALL involving at least two SELECTs from system.columns, system.tables, system.parts, system.parts\_tables or tables of Merge family and performing ALTER of columns of the related tables concurrently. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-2} + +- Fixed test failures when running clickhouse-server on different host [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) +- clickhouse-test: Disable color control sequences in non tty environment. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) +- clickhouse-test: Allow use any test database (remove `test.` qualification where it possible) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) +- Fix ubsan errors [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Yandex LFAlloc was added to ClickHouse to allocate MarkCache and UncompressedCache data in different ways to catch segfaults more reliable [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) +- Python util to help with backports and changelogs. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([Ivan](https://github.com/abyss7)) + +## ClickHouse Release 19.5 {#clickhouse-release-19-5} + +### ClickHouse Release 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} + +#### Bug Fixes {#bug-fixes-5} + +- Fixed possible crash in bitmap\* functions [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Andy Yang](https://github.com/andyyzh)) +- Fixed very rare data race condition that could happen when executing a query with UNION ALL involving at least two SELECTs from system.columns, system.tables, system.parts, system.parts\_tables or tables of Merge family and performing ALTER of columns of the related tables concurrently. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed error `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. This error happened if LowCardinality column was the part of primary key. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Modification of retention function: If a row satisfies both the first and NTH condition, only the first satisfied condition is added to the data state. Now all conditions that satisfy in a row of data are added to the data state. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) + +### ClickHouse Release 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} + +#### Bug Fixes {#bug-fixes-6} + +- Fixed type of setting `max_partitions_per_insert_block` from boolean to UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Mohammad Hossein Sekhavat](https://github.com/mhsekhavat)) + +### ClickHouse Release 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} + +#### New Features {#new-features-4} + +- [Hyperscan](https://github.com/intel/hyperscan) multiple regular expression matching was added (functions `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) +- `multiSearchFirstPosition` function was added. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) +- Implement the predefined expression filter per row for tables. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([Ivan](https://github.com/abyss7)) +- A new type of data skipping indices based on bloom filters (can be used for `equal`, `in` and `like` functions). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) +- Added `ASOF JOIN` which allows to run queries that join to the most recent value known. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) +- Rewrite multiple `COMMA JOIN` to `CROSS JOIN`. Then rewrite them to `INNER JOIN` if possible. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Improvement {#improvement-9} + +- `topK` and `topKWeighted` now supports custom `loadFactor` (fixes issue [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) +- Allow to use `parallel_replicas_count > 1` even for tables without sampling (the setting is simply ignored for them). In previous versions it was lead to exception. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) +- Support for `CREATE OR REPLACE VIEW`. Allow to create a view or set a new definition in a single statement. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) +- `Buffer` table engine now supports `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Yangkuan Liu](https://github.com/LiuYangkuan)) +- Add ability to start replicated table without metadata in zookeeper in `readonly` mode. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) +- Fixed flicker of progress bar in clickhouse-client. The issue was most noticeable when using `FORMAT Null` with streaming queries. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Allow to disable functions with `hyperscan` library on per user basis to limit potentially excessive and uncontrolled resource usage. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add version number logging in all errors. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) +- Added restriction to the `multiMatch` functions which requires string size to fit into `unsigned int`. Also added the number of arguments limit to the `multiSearch` functions. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) +- Improved usage of scratch space and error handling in Hyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) +- Fill `system.graphite_detentions` from a table config of `*GraphiteMergeTree` engine tables. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Rename `trigramDistance` function to `ngramDistance` and add more functions with `CaseInsensitive` and `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) +- Improved data skipping indices calculation. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) +- Keep ordinary, `DEFAULT`, `MATERIALIZED` and `ALIAS` columns in a single list (fixes issue [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +#### Bug Fix {#bug-fix-26} + +- Avoid `std::terminate` in case of memory allocation failure. Now `std::bad_alloc` exception is thrown as expected. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixes capnproto reading from buffer. Sometimes files wasn’t loaded successfully by HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Fix error `Unknown log entry type: 0` after `OPTIMIZE TABLE FINAL` query. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Bird](https://github.com/amosbird)) +- Wrong arguments to `hasAny` or `hasAll` functions may lead to segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Deadlock may happen while executing `DROP DATABASE dictionary` query. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix undefined behavior in `median` and `quantile` functions. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- Fix compression level detection when `network_compression_method` in lowercase. Broken in v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- Fixed ignorance of `UTC` setting (fixes issue [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- Fix `histogram` function behaviour with `Distributed` tables. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- Fixed tsan report `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed TSan report on shutdown due to race condition in system logs usage. Fixed potential use-after-free on shutdown when part\_log is enabled. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix recheck parts in `ReplicatedMergeTreeAlterThread` in case of error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Arithmetic operations on intermediate aggregate function states were not working for constant arguments (such as subquery results). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Always backquote column names in metadata. Otherwise it’s impossible to create a table with column named `index` (server won’t restart due to malformed `ATTACH` query in metadata). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix crash in `ALTER ... MODIFY ORDER BY` on `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- Fix segfault in `JOIN ON` with enabled `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Winter Zhang](https://github.com/zhang2014)) +- Fix bug with adding an extraneous row after consuming a protobuf message from Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix crash of `JOIN` on not-nullable vs nullable column. Fix `NULLs` in right keys in `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Fixed race condition in `SELECT` from `system.tables` if the table is renamed or altered concurrently. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed data race when fetching data part that is already obsolete. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed rare data race that can happen during `RENAME` table of MergeTree family. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed segmentation fault in function `arrayIntersect`. Segmentation fault could happen if function was called with mixed constant and ordinary arguments. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix crash in `FULL/RIGHT JOIN` when we joining on nullable vs not nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix `No message received` exception while fetching parts between replicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- Fixed `arrayIntersect` function wrong result in case of several repeated values in single array. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix a race condition during concurrent `ALTER COLUMN` queries that could lead to a server crash (fixes issue [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fix incorrect result in `FULL/RIGHT JOIN` with const column. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix duplicates in `GLOBAL JOIN` with asterisk. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix parameter deduction in `ALTER MODIFY` of column `CODEC` when column type is not specified. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- Functions `cutQueryStringAndFragment()` and `queryStringAndFragment()` now works correctly when `URL` contains a fragment and no query. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix rare bug when setting `min_bytes_to_use_direct_io` is greater than zero, which occures when thread have to seek backward in column file. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- Fix wrong argument types for aggregate functions with `LowCardinality` arguments (fixes issue [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix wrong name qualification in `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix function `toISOWeek` result for year 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix `DROP`, `TRUNCATE` and `OPTIMIZE` queries duplication, when executed on `ON CLUSTER` for `ReplicatedMergeTree*` tables family. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### Backward Incompatible Change {#backward-incompatible-change-8} + +- Rename setting `insert_sample_with_metadata` to setting `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) +- Added setting `max_partitions_per_insert_block` (with value 100 by default). If inserted block contains larger number of partitions, an exception is thrown. Set it to 0 if you want to remove the limit (not recommended). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Multi-search functions were renamed (`multiPosition` to `multiSearchAllPositions`, `multiSearch` to `multiSearchAny`, `firstMatch` to `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) + +#### Performance Improvement {#performance-improvement-6} + +- Optimize Volnitsky searcher by inlining, giving about 5-10% search improvement for queries with many needles or many similar bigrams. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) +- Fix performance issue when setting `use_uncompressed_cache` is greater than zero, which appeared when all read data contained in cache. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-10} + +- Hardening debug build: more granular memory mappings and ASLR; add memory protection for mark cache and index. This allows to find more memory stomping bugs in case when ASan and MSan cannot do it. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add support for cmake variables `ENABLE_PROTOBUF`, `ENABLE_PARQUET` and `ENABLE_BROTLI` which allows to enable/disable the above features (same as we can do for librdkafka, mysql, etc). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) +- Add ability to print process list and stacktraces of all threads if some queries are hung after test run. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) +- Add retries on `Connection loss` error in `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) +- Add freebsd build with vagrant and build with thread sanitizer to packager script. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) +- Now user asked for password for user `'default'` during installation. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) +- Suppress warning in `rdkafka` library. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Allow ability to build without ssl. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) +- Add a way to launch clickhouse-server image from a custom user. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Upgrade contrib boost to 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) +- Disable usage of `mremap` when compiled with Thread Sanitizer. Surprisingly enough, TSan does not intercept `mremap` (though it does intercept `mmap`, `munmap`) that leads to false positives. Fixed TSan report in stateful tests. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add test checking using format schema via HTTP interface. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) + +## ClickHouse Release 19.4 {#clickhouse-release-19-4} + +### ClickHouse Release 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} + +#### Bug Fixes {#bug-fixes-7} + +- Avoid `std::terminate` in case of memory allocation failure. Now `std::bad_alloc` exception is thrown as expected. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixes capnproto reading from buffer. Sometimes files wasn’t loaded successfully by HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Fix error `Unknown log entry type: 0` after `OPTIMIZE TABLE FINAL` query. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Bird](https://github.com/amosbird)) +- Wrong arguments to `hasAny` or `hasAll` functions may lead to segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Deadlock may happen while executing `DROP DATABASE dictionary` query. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix undefined behavior in `median` and `quantile` functions. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- Fix compression level detection when `network_compression_method` in lowercase. Broken in v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- Fixed ignorance of `UTC` setting (fixes issue [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- Fix `histogram` function behaviour with `Distributed` tables. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- Fixed tsan report `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed TSan report on shutdown due to race condition in system logs usage. Fixed potential use-after-free on shutdown when part\_log is enabled. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix recheck parts in `ReplicatedMergeTreeAlterThread` in case of error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Arithmetic operations on intermediate aggregate function states were not working for constant arguments (such as subquery results). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Always backquote column names in metadata. Otherwise it’s impossible to create a table with column named `index` (server won’t restart due to malformed `ATTACH` query in metadata). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix crash in `ALTER ... MODIFY ORDER BY` on `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- Fix segfault in `JOIN ON` with enabled `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Winter Zhang](https://github.com/zhang2014)) +- Fix bug with adding an extraneous row after consuming a protobuf message from Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Fixed race condition in `SELECT` from `system.tables` if the table is renamed or altered concurrently. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed data race when fetching data part that is already obsolete. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed rare data race that can happen during `RENAME` table of MergeTree family. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed segmentation fault in function `arrayIntersect`. Segmentation fault could happen if function was called with mixed constant and ordinary arguments. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix `No message received` exception while fetching parts between replicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- Fixed `arrayIntersect` function wrong result in case of several repeated values in single array. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix a race condition during concurrent `ALTER COLUMN` queries that could lead to a server crash (fixes issue [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fix parameter deduction in `ALTER MODIFY` of column `CODEC` when column type is not specified. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- Functions `cutQueryStringAndFragment()` and `queryStringAndFragment()` now works correctly when `URL` contains a fragment and no query. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix rare bug when setting `min_bytes_to_use_direct_io` is greater than zero, which occures when thread have to seek backward in column file. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- Fix wrong argument types for aggregate functions with `LowCardinality` arguments (fixes issue [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix function `toISOWeek` result for year 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix `DROP`, `TRUNCATE` and `OPTIMIZE` queries duplication, when executed on `ON CLUSTER` for `ReplicatedMergeTree*` tables family. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### Improvements {#improvements-2} + +- Keep ordinary, `DEFAULT`, `MATERIALIZED` and `ALIAS` columns in a single list (fixes issue [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +### ClickHouse Release 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} + +#### Bug Fixes {#bug-fixes-8} + +- Fix crash in `FULL/RIGHT JOIN` when we joining on nullable vs not nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-11} + +- Add a way to launch clickhouse-server image from a custom user. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### ClickHouse Release 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} + +#### Bug Fixes {#bug-fixes-9} + +- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### ClickHouse Release 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} + +#### Bug Fixes {#bug-fixes-10} + +- Fixed remote queries which contain both `LIMIT BY` and `LIMIT`. Previously, if `LIMIT BY` and `LIMIT` were used for remote query, `LIMIT` could happen before `LIMIT BY`, which led to too filtered result. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) + +### ClickHouse Release 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} + +#### New Features {#new-features-5} + +- Added full support for `Protobuf` format (input and output, nested data structures). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) +- Added bitmap functions with Roaring Bitmaps. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Andy Yang](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) +- Parquet format support. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) +- N-gram distance was added for fuzzy string comparison. It is similar to q-gram metrics in R language. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) +- Combine rules for graphite rollup from dedicated aggregation and retention patterns. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Added `max_execution_speed` and `max_execution_speed_bytes` to limit resource usage. Added `min_execution_speed_bytes` setting to complement the `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([Winter Zhang](https://github.com/zhang2014)) +- Implemented function `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) +- Added functions `arrayEnumerateDenseRanked` and `arrayEnumerateUniqRanked` (it’s like `arrayEnumerateUniq` but allows to fine tune array depth to look inside multidimensional arrays). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Bug Fixes {#bug-fixes-11} + +- This release also contains all bug fixes from 19.3 and 19.1. +- Fixed bug in data skipping indices: order of granules after INSERT was incorrect. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) +- Fixed `set` index for `Nullable` and `LowCardinality` columns. Before it, `set` index with `Nullable` or `LowCardinality` column led to error `Data type must be deserialized with multiple streams` while selecting. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correctly set update\_time on full `executable` dictionary update. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) +- Fix broken progress bar in 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) +- Fixed inconsistent values of MemoryTracker when memory region was shrinked, in certain cases. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed undefined behaviour in ThreadPool. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed a very rare crash with the message `mutex lock failed: Invalid argument` that could happen when a MergeTree table was dropped concurrently with a SELECT. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) +- ODBC driver compatibility with `LowCardinality` data type. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) +- FreeBSD: Fixup for `AIOcontextPool: Found io_event with unknown id 0` error. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `system.part_log` table was created regardless to configuration. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix undefined behaviour in `dictIsIn` function for cache dictionaries. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) +- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) +- Disable compile\_expressions by default until we get own `llvm` contrib and can test it with `clang` and `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) +- Prevent `std::terminate` when `invalidate_query` for `clickhouse` external dictionary source has returned wrong resultset (empty or more than one row or more than one column). Fixed issue when the `invalidate_query` was performed every five seconds regardless to the `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid deadlock when the `invalidate_query` for a dictionary with `clickhouse` source was involving `system.dictionaries` table or `Dictionaries` database (rare case). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixes for CROSS JOIN with empty WHERE. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed segfault in function “replicate” when constant argument is passed. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix lambda function with predicate optimizer. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([Winter Zhang](https://github.com/zhang2014)) +- Multiple JOINs multiple fixes. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Improvements {#improvements-3} + +- Support aliases in JOIN ON section for right table columns. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) +- Result of multiple JOINs need correct result names to be used in subselects. Replace flat aliases with source names in result. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) +- Improve push-down logic for joined statements. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([Ivan](https://github.com/abyss7)) + +#### Performance Improvements {#performance-improvements-3} + +- Improved heuristics of “move to PREWHERE” optimization. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Use proper lookup tables that uses HashTable’s API for 8-bit and 16-bit keys. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos Bird](https://github.com/amosbird)) +- Improved performance of string comparison. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cleanup distributed DDL queue in a separate thread so that it doesn’t slow down the main loop that processes distributed DDL tasks. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) +- When `min_bytes_to_use_direct_io` is set to 1, not every file was opened with O\_DIRECT mode because the data size to read was sometimes underestimated by the size of one compressed block. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-12} + +- Added support for clang-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix wrong `__asm__` instructions (again) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) +- Add ability to specify settings for `clickhouse-performance-test` from command line. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) +- Add dictionaries tests to integration tests. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) +- Added queries from the benchmark on the website to automated performance tests. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `xxhash.h` does not exist in external lz4 because it is an implementation detail and its symbols are namespaced with `XXH_NAMESPACE` macro. When lz4 is external, xxHash has to be external too, and the dependents have to link to it. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) +- Fixed a case when `quantileTiming` aggregate function can be called with negative or floating point argument (this fixes fuzz test with undefined behaviour sanitizer). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Spelling error correction. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) +- Fix compilation on Mac. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) +- Build fixes for FreeBSD and various unusual build configurations. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) + +## ClickHouse Release 19.3 {#clickhouse-release-19-3} + +### ClickHouse Release 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} + +#### Bug Fixes {#bug-fixes-12} + +- Fix crash in `FULL/RIGHT JOIN` when we joining on nullable vs not nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-13} + +- Add a way to launch clickhouse-server image from a custom user [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### ClickHouse Release 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} + +#### Bug Fixes {#bug-fixes-13} + +- Fixed error in \#3920. This error manifests itself as random cache corruption (messages `Unknown codec family code`, `Cannot seek through file`) and segfaults. This bug first appeared in version 19.1 and is present in versions up to 19.1.10 and 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} + +#### Bug Fixes {#bug-fixes-14} + +- When there are more than 1000 threads in a thread pool, `std::terminate` may happen on thread exit. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now it’s possible to create `ReplicatedMergeTree*` tables with comments on columns without defaults and tables with columns codecs without comments and defaults. Also fix comparison of codecs. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) +- Fixed crash on JOIN with array or tuple. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed crash in clickhouse-copier with the message `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed hangup on server shutdown if distributed DDLs were used. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) +- Incorrect column numbers were printed in error message about text format parsing for columns with number greater than 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-3} + +- Fixed build with AVX enabled. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Enable extended accounting and IO accounting based on good known version instead of kernel under which it is compiled. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) +- Allow to skip setting of core\_dump.size\_limit, warning instead of throw if limit set fail. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) +- Removed the `inline` tags of `void readBinary(...)` in `Field.cpp`. Also merged redundant `namespace DB` blocks. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) + +### ClickHouse Release 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} + +#### Bug Fixes {#bug-fixes-15} + +- Fixed bug with large http insert queries processing. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) +- Fixed backward incompatibility with old versions due to wrong implementation of `send_logs_level` setting. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed backward incompatibility of table function `remote` introduced with column comments. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} + +#### Improvements {#improvements-4} + +- Table index size is not accounted for memory limits when doing `ATTACH TABLE` query. Avoided the possibility that a table cannot be attached after being detached. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Slightly raised up the limit on max string and array size received from ZooKeeper. It allows to continue to work with increased size of `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` on ZooKeeper. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Allow to repair abandoned replica even if it already has huge number of nodes in its queue. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add one required argument to `SET` index (max stored rows number). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Bug Fixes {#bug-fixes-16} + +- Fixed `WITH ROLLUP` result for group by single `LowCardinality` key. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed bug in the set index (dropping a granule if it contains more than `max_rows` rows). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) +- A lot of FreeBSD build fixes. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) +- Fixed aliases substitution in queries with subquery containing same alias (issue [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-4} + +- Add ability to run `clickhouse-server` for stateless tests in docker image. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) + +### ClickHouse Release 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} + +#### New Features {#new-features-6} + +- Added the `KILL MUTATION` statement that allows removing mutations that are for some reasons stuck. Added `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` fields to the `system.mutations` table for easier troubleshooting. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) +- Added aggregate function `entropy` which computes Shannon entropy. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) +- Added ability to send queries `INSERT INTO tbl VALUES (....` to server without splitting on `query` and `data` parts. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) +- Generic implementation of `arrayWithConstant` function was added. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Implemented `NOT BETWEEN` comparison operator. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) +- Implement `sumMapFiltered` in order to be able to limit the number of keys for which values will be summed by `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Added support of `Nullable` types in `mysql` table function. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) +- Support for arbitrary constant expressions in `LIMIT` clause. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) +- Added `topKWeighted` aggregate function that takes additional argument with (unsigned integer) weight. [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Andrew Golman](https://github.com/andrewgolman)) +- `StorageJoin` now supports `join_any_take_last_row` setting that allows overwriting existing values of the same key. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos Bird](https://github.com/amosbird) +- Added function `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) +- Added `RowBinaryWithNamesAndTypes` format. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) +- Added `IPv4` and `IPv6` data types. More effective implementations of `IPv*` functions. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) +- Added function `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) +- Added `Protobuf` output format. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) +- Added brotli support for HTTP interface for data import (INSERTs). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mikhail](https://github.com/fandyushin)) +- Added hints while user make typo in function name or type in command line client. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) +- Added `Query-Id` to Server’s HTTP Response header. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mikhail](https://github.com/fandyushin)) + +#### Experimental Features {#experimental-features-2} + +- Added `minmax` and `set` data skipping indices for MergeTree table engines family. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- Added conversion of `CROSS JOIN` to `INNER JOIN` if possible. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Bug Fixes {#bug-fixes-17} + +- Fixed `Not found column` for duplicate columns in `JOIN ON` section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Make `START REPLICATED SENDS` command start replicated sends. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- Fixed aggregate functions execution with `Array(LowCardinality)` arguments. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fixed wrong behaviour when doing `INSERT ... SELECT ... FROM file(...)` query and file has `CSVWithNames` or `TSVWIthNames` format and the first data row is missing. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed crash on dictionary reload if dictionary not available. This bug was appeared in 19.1.6. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- Fixed `ALL JOIN` with duplicates in right table. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed segmentation fault with `use_uncompressed_cache=1` and exception with wrong uncompressed size. This bug was appeared in 19.1.6. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- Fixed `compile_expressions` bug with comparison of big (more than int16) dates. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- Fixed infinite loop when selecting from table function `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Temporarily disable predicate optimization for `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Winter Zhang](https://github.com/zhang2014)) +- Fixed `Illegal instruction` error when using base64 functions on old CPUs. This error has been reproduced only when ClickHouse was compiled with gcc-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed `No message received` error when interacting with PostgreSQL ODBC Driver through TLS connection. Also fixes segfault when using MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed incorrect result when `Date` and `DateTime` arguments are used in branches of conditional operator (function `if`). Added generic case for function `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse dictionaries now load within `clickhouse` process. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed deadlock when `SELECT` from a table with `File` engine was retried after `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed race condition when selecting from `system.tables` may give `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-client` can segfault on exit while loading data for command line suggestions if it was run in interactive mode. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed a bug when the execution of mutations containing `IN` operators was producing incorrect results. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fixed error: if there is a database with `Dictionary` engine, all dictionaries forced to load at server startup, and if there is a dictionary with ClickHouse source from localhost, the dictionary cannot load. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed error when system logs are tried to create again at server shutdown. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Correctly return the right type and properly handle locks in `joinGet` function. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Bird](https://github.com/amosbird)) +- Added `sumMapWithOverflow` function. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Fixed segfault with `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed bug with incorrect `Date` and `DateTime` comparison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- Fixed fuzz test under undefined behavior sanitizer: added parameter type check for `quantile*Weighted` family of functions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed rare race condition when removing of old data parts can fail with `File not found` error. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix install package with missing /etc/clickhouse-server/config.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-5} + +- Debian package: correct /etc/clickhouse-server/preprocessed link according to config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- Various build fixes for FreeBSD. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) +- Added ability to create, fill and drop tables in perftest. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) +- Added a script to check for duplicate includes. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added ability to run queries by index in performance test. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) +- Package with debug symbols is suggested to be installed. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Refactoring of performance-test. Better logging and signals handling. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) +- Added docs to anonymized Yandex.Metrika datasets. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) +- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) +- Added docs about two datasets in s3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) +- Added script which creates changelog from pull requests description. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Added puppet module for ClickHouse. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- Added docs for a group of undocumented functions. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([Winter Zhang](https://github.com/zhang2014)) +- ARM build fixes. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) +- Dictionary tests now able to run from `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) +- Now `/etc/ssl` is used as default directory with SSL certificates. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added checking SSE and AVX instruction at start. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) +- Init script will wait server until start. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) + +#### Backward Incompatible Changes {#backward-incompatible-changes-1} + +- Removed `allow_experimental_low_cardinality_type` setting. `LowCardinality` data types are production ready. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reduce mark cache size and uncompressed cache size accordingly to available memory amount. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) +- Added keyword `INDEX` in `CREATE TABLE` query. A column with name `index` must be quoted with backticks or double quotes: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- `sumMap` now promote result type instead of overflow. The old `sumMap` behavior can be obtained by using `sumMapWithOverflow` function. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) + +#### Performance Improvements {#performance-improvements-4} + +- `std::sort` replaced by `pdqsort` for queries without `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) +- Now server reuse threads from global thread pool. This affects performance in some corner cases. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Improvements {#improvements-5} + +- Implemented AIO support for FreeBSD. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `SELECT * FROM a JOIN b USING a, b` now return `a` and `b` columns only from the left table. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) +- Allow `-C` option of client to work as `-c` option. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) +- Now option `--password` used without value requires password from stdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) +- Added highlighting of unescaped metacharacters in string literals that contain `LIKE` expressions or regexps. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added cancelling of HTTP read only queries if client socket goes away. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) +- Now server reports progress to keep client connections alive. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([Ivan](https://github.com/abyss7)) +- Slightly better message with reason for OPTIMIZE query with `optimize_throw_if_noop` setting enabled. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added support of `--version` option for clickhouse server. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) +- Added `--help/-h` option to `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) +- Added support for scalar subqueries with aggregate function state result. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Improved server shutdown time and ALTERs waiting time. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added info about the replicated\_can\_become\_leader setting to system.replicas and add logging if the replica won’t try to become leader. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) + +## ClickHouse Release 19.1 {#clickhouse-release-19-1} + +### ClickHouse Release 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} + +- Fixed error `Column ... queried more than once` that may happen if the setting `asterisk_left_columns_only` is set to 1 in case of using `GLOBAL JOIN` with `SELECT *` (rare case). The issue does not exist in 19.3 and newer. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouse Release 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} + +This release contains exactly the same set of patches as 19.3.7. + +### ClickHouse Release 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} + +This release contains exactly the same set of patches as 19.3.6. + +## ClickHouse Release 19.1 {#clickhouse-release-19-1-1} + +### ClickHouse Release 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} + +#### Bug Fixes {#bug-fixes-18} + +- Fixed backward incompatibility with old versions due to wrong implementation of `send_logs_level` setting. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed backward incompatibility of table function `remote` introduced with column comments. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} + +#### Bug Fixes {#bug-fixes-19} + +- Fix install package with missing /etc/clickhouse-server/config.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +## ClickHouse Release 19.1 {#clickhouse-release-19-1-2} + +### ClickHouse Release 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} + +#### Bug Fixes {#bug-fixes-20} + +- Correctly return the right type and properly handle locks in `joinGet` function. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Bird](https://github.com/amosbird)) +- Fixed error when system logs are tried to create again at server shutdown. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed error: if there is a database with `Dictionary` engine, all dictionaries forced to load at server startup, and if there is a dictionary with ClickHouse source from localhost, the dictionary cannot load. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed a bug when the execution of mutations containing `IN` operators was producing incorrect results. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- `clickhouse-client` can segfault on exit while loading data for command line suggestions if it was run in interactive mode. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed race condition when selecting from `system.tables` may give `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed deadlock when `SELECT` from a table with `File` engine was retried after `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed an issue: local ClickHouse dictionaries are loaded via TCP, but should load within process. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed `No message received` error when interacting with PostgreSQL ODBC Driver through TLS connection. Also fixes segfault when using MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Temporarily disable predicate optimization for `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Winter Zhang](https://github.com/zhang2014)) +- Fixed infinite loop when selecting from table function `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed `compile_expressions` bug with comparison of big (more than int16) dates. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- Fixed segmentation fault with `uncompressed_cache=1` and exception with wrong uncompressed size. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- Fixed `ALL JOIN` with duplicates in right table. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed wrong behaviour when doing `INSERT ... SELECT ... FROM file(...)` query and file has `CSVWithNames` or `TSVWIthNames` format and the first data row is missing. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed aggregate functions execution with `Array(LowCardinality)` arguments. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Debian package: correct /etc/clickhouse-server/preprocessed link according to config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- Fixed fuzz test under undefined behavior sanitizer: added parameter type check for `quantile*Weighted` family of functions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Make `START REPLICATED SENDS` command start replicated sends. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- Fixed `Not found column` for duplicate columns in JOIN ON section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Now `/etc/ssl` is used as default directory with SSL certificates. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed crash on dictionary reload if dictionary not available. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- Fixed bug with incorrect `Date` and `DateTime` comparison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- Fixed incorrect result when `Date` and `DateTime` arguments are used in branches of conditional operator (function `if`). Added generic case for function `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse Release 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} + +#### New Features {#new-features-7} + +- Custom per column compression codecs for tables. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [Winter Zhang](https://github.com/zhang2014), [Anatoly](https://github.com/Sindbag)) +- Added compression codec `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) +- Allow to `ALTER` compression codecs. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) +- Added functions `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` for SQL standard compatibility. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) +- Support for write in `HDFS` tables and `hdfs` table function. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) +- Added functions to search for multiple constant strings from big haystack: `multiPosition`, `multiSearch` ,`firstMatch` also with `-UTF8`, `-CaseInsensitive`, and `-CaseInsensitiveUTF8` variants. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) +- Pruning of unused shards if `SELECT` query filters by sharding key (setting `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [Ivan](https://github.com/abyss7)) +- Allow `Kafka` engine to ignore some number of parsing errors per block. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([Ivan](https://github.com/abyss7)) +- Added support for `CatBoost` multiclass models evaluation. Function `modelEvaluate` returns tuple with per-class raw predictions for multiclass models. `libcatboostmodel.so` should be built with [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Added functions `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) +- Added hashing functions `xxHash64` and `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) +- Added `gccMurmurHash` hashing function (GCC flavoured Murmur hash) which uses the same hash seed as [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) +- Added hashing functions `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) +- Added table function `remoteSecure`. Function works as `remote`, but uses secure connection. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) + +#### Experimental Features {#experimental-features-3} + +- Added multiple JOINs emulation (`allow_experimental_multiple_joins_emulation` setting). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Bug Fixes {#bug-fixes-21} + +- Make `compiled_expression_cache_size` setting limited by default to lower memory consumption. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) +- Fix a bug that led to hangups in threads that perform ALTERs of Replicated tables and in the thread that updates configuration from ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fixed a race condition when executing a distributed ALTER task. The race condition led to more than one replica trying to execute the task and all replicas except one failing with a ZooKeeper error. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fix a bug when `from_zk` config elements weren’t refreshed after a request to ZooKeeper timed out. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fix bug with wrong prefix for IPv4 subnet masks. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) +- Fixed crash (`std::terminate`) in rare cases when a new thread cannot be created due to exhausted resources. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix bug when in `remote` table function execution when wrong restrictions were used for in `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) +- Fix a leak of netlink sockets. They were placed in a pool where they were never deleted and new sockets were created at the start of a new thread when all current sockets were in use. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fix bug with closing `/proc/self/fd` directory earlier than all fds were read from `/proc` after forking `odbc-bridge` subprocess. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) +- Fixed String to UInt monotonic conversion in case of usage String in primary key. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([Winter Zhang](https://github.com/zhang2014)) +- Fixed error in calculation of integer conversion function monotonicity. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed segfault in `arrayEnumerateUniq`, `arrayEnumerateDense` functions in case of some invalid arguments. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix UB in StorageMerge. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos Bird](https://github.com/amosbird)) +- Fixed segfault in functions `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed error: functions `round`, `floor`, `trunc`, `ceil` may return bogus result when executed on integer argument and large negative scale. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed a bug induced by ‘kill query sync’ which leads to a core dump. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) +- Fix bug with long delay after empty replication queue. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) +- Fixed excessive memory usage in case of inserting into table with `LowCardinality` primary key. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fixed `LowCardinality` serialization for `Native` format in case of empty arrays. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fixed incorrect result while using distinct by single LowCardinality numeric column. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fixed specialized aggregation with LowCardinality key (in case when `compile` setting is enabled). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fix user and password forwarding for replicated tables queries. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) +- Fixed very rare race condition that can happen when listing tables in Dictionary database while reloading dictionaries. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed incorrect result when HAVING was used with ROLLUP or CUBE. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Sam Chou](https://github.com/reflection)) +- Fixed column aliases for query with `JOIN ON` syntax and distributed tables. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([Winter Zhang](https://github.com/zhang2014)) +- Fixed error in internal implementation of `quantileTDigest` (found by Artem Vakhrushev). This error never happens in ClickHouse and was relevant only for those who use ClickHouse codebase as a library directly. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Improvements {#improvements-6} + +- Support for `IF NOT EXISTS` in `ALTER TABLE ADD COLUMN` statements along with `IF EXISTS` in `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) +- Function `parseDateTimeBestEffort`: support for formats `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` and similar. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CapnProtoInputStream` now support jagged structures. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) +- Usability improvement: added a check that server process is started from the data directory’s owner. Do not allow to start server from root if the data belongs to non-root user. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-v-galtsev](https://github.com/sergey-v-galtsev)) +- Better logic of checking required columns during analysis of queries with JOINs. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) +- Decreased the number of connections in case of large number of Distributed tables in a single server. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([Winter Zhang](https://github.com/zhang2014)) +- Supported totals row for `WITH TOTALS` query for ODBC driver. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) +- Allowed to use `Enum`s as integers inside if function. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([Ivan](https://github.com/abyss7)) +- Added `low_cardinality_allow_in_native_format` setting. If disabled, do not use `LowCadrinality` type in `Native` format. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Removed some redundant objects from compiled expressions cache to lower memory usage. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) +- Add check that `SET send_logs_level = 'value'` query accept appropriate value. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) +- Fixed data type check in type conversion functions. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([Winter Zhang](https://github.com/zhang2014)) + +#### Performance Improvements {#performance-improvements-5} + +- Add a MergeTree setting `use_minimalistic_part_header_in_zookeeper`. If enabled, Replicated tables will store compact part metadata in a single part znode. This can dramatically reduce ZooKeeper snapshot size (especially if the tables have a lot of columns). Note that after enabling this setting you will not be able to downgrade to a version that doesn’t support it. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) +- Add an DFA-based implementation for functions `sequenceMatch` and `sequenceCount` in case pattern doesn’t contain time. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Performance improvement for integer numbers serialization. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos Bird](https://github.com/amosbird)) +- Zero left padding PODArray so that -1 element is always valid and zeroed. It’s used for branchless calculation of offsets. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos Bird](https://github.com/amosbird)) +- Reverted `jemalloc` version which lead to performance degradation. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Backward Incompatible Changes {#backward-incompatible-changes-2} + +- Removed undocumented feature `ALTER MODIFY PRIMARY KEY` because it was superseded by the `ALTER MODIFY ORDER BY` command. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) +- Removed function `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Forbid using scalar subqueries with result of type `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([Ivan](https://github.com/abyss7)) + +#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-6} + +- Added support for PowerPC (`ppc64le`) build. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) +- Stateful functional tests are run on public available dataset. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed error when the server cannot start with the `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` message within Docker or systemd-nspawn. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Updated `rdkafka` library to v1.0.0-RC5. Used cppkafka instead of raw C interface. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([Ivan](https://github.com/abyss7)) +- Updated `mariadb-client` library. Fixed one of issues found by UBSan. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Some fixes for UBSan builds. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added per-commit runs of tests with UBSan build. +- Added per-commit runs of PVS-Studio static analyzer. +- Fixed bugs found by PVS-Studio. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed glibc compatibility issues. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Move Docker images to 18.10 and add compatibility file for glibc \>= 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) +- Add env variable if user don’t want to chown directories in server Docker image. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) +- Enabled most of the warnings from `-Weverything` in clang. Enabled `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added a few more warnings that are available only in clang 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Link to `libLLVM` rather than to individual LLVM libs when using shared linking. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) +- Added sanitizer variables for test images. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) +- `clickhouse-server` debian package will recommend `libcap2-bin` package to use `setcap` tool for setting capabilities. This is optional. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Improved compilation time, fixed includes. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) +- Added performance tests for hash functions. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) +- Fixed cyclic library dependences. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) +- Improved compilation with low available memory. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) +- Added test script to reproduce performance degradation in `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed misspells in comments and string literals under `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) +- Fixed typos in comments. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) + +## [Changelog for 2018](./2018.md) {#changelog-for-2018} diff --git a/docs/en/whats-new/changelog/index.md b/docs/en/whats-new/changelog/index.md new file mode 100644 index 00000000000..c13441a8bd5 --- /dev/null +++ b/docs/en/whats-new/changelog/index.md @@ -0,0 +1,7 @@ +--- +toc_folder_title: Changelog +toc_priority: 74 +toc_title: '2020' +--- + +{% include "content/changelog.md" %} diff --git a/docs/en/whats_new/index.md b/docs/en/whats-new/index.md similarity index 100% rename from docs/en/whats_new/index.md rename to docs/en/whats-new/index.md diff --git a/docs/en/whats_new/roadmap.md b/docs/en/whats-new/roadmap.md similarity index 100% rename from docs/en/whats_new/roadmap.md rename to docs/en/whats-new/roadmap.md diff --git a/docs/en/whats_new/security_changelog.md b/docs/en/whats-new/security-changelog.md similarity index 100% rename from docs/en/whats_new/security_changelog.md rename to docs/en/whats-new/security-changelog.md diff --git a/docs/en/whats_new/changelog/2017.md b/docs/en/whats_new/changelog/2017.md deleted file mode 100644 index df632d72d83..00000000000 --- a/docs/en/whats_new/changelog/2017.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -toc_priority: 79 -toc_title: '2017' ---- - -### ClickHouse release 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} - -This release contains bug fixes for the previous release 1.1.54318: - -- Fixed bug with possible race condition in replication that could lead to data loss. This issue affects versions 1.1.54310 and 1.1.54318. If you use one of these versions with Replicated tables, the update is strongly recommended. This issue shows in logs in Warning messages like `Part ... from own log doesn't exist.` The issue is relevant even if you don’t see these messages in logs. - -### ClickHouse release 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} - -This release contains bug fixes for the previous release 1.1.54310: - -- Fixed incorrect row deletions during merges in the SummingMergeTree engine -- Fixed a memory leak in unreplicated MergeTree engines -- Fixed performance degradation with frequent inserts in MergeTree engines -- Fixed an issue that was causing the replication queue to stop running -- Fixed rotation and archiving of server logs - -### ClickHouse release 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} - -#### New features: {#new-features} - -- Custom partitioning key for the MergeTree family of table engines. -- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) table engine. -- Added support for loading [CatBoost](https://catboost.yandex/) models and applying them to data stored in ClickHouse. -- Added support for time zones with non-integer offsets from UTC. -- Added support for arithmetic operations with time intervals. -- The range of values for the Date and DateTime types is extended to the year 2105. -- Added the `CREATE MATERIALIZED VIEW x TO y` query (specifies an existing table for storing the data of a materialized view). -- Added the `ATTACH TABLE` query without arguments. -- The processing logic for Nested columns with names ending in -Map in a SummingMergeTree table was extracted to the sumMap aggregate function. You can now specify such columns explicitly. -- Max size of the IP trie dictionary is increased to 128M entries. -- Added the getSizeOfEnumType function. -- Added the sumWithOverflow aggregate function. -- Added support for the Cap’n Proto input format. -- You can now customize compression level when using the zstd algorithm. - -#### Backward incompatible changes: {#backward-incompatible-changes} - -- Creation of temporary tables with an engine other than Memory is not allowed. -- Explicit creation of tables with the View or MaterializedView engine is not allowed. -- During table creation, a new check verifies that the sampling key expression is included in the primary key. - -#### Bug fixes: {#bug-fixes} - -- Fixed hangups when synchronously inserting into a Distributed table. -- Fixed nonatomic adding and removing of parts in Replicated tables. -- Data inserted into a materialized view is not subjected to unnecessary deduplication. -- Executing a query to a Distributed table for which the local replica is lagging and remote replicas are unavailable does not result in an error anymore. -- Users don’t need access permissions to the `default` database to create temporary tables anymore. -- Fixed crashing when specifying the Array type without arguments. -- Fixed hangups when the disk volume containing server logs is full. -- Fixed an overflow in the toRelativeWeekNum function for the first week of the Unix epoch. - -#### Build improvements: {#build-improvements} - -- Several third-party libraries (notably Poco) were updated and converted to git submodules. - -### ClickHouse release 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} - -#### New features: {#new-features-1} - -- TLS support in the native protocol (to enable, set `tcp_ssl_port` in `config.xml` ). - -#### Bug fixes: {#bug-fixes-1} - -- `ALTER` for replicated tables now tries to start running as soon as possible. -- Fixed crashing when reading data with the setting `preferred_block_size_bytes=0.` -- Fixed crashes of `clickhouse-client` when pressing `Page Down` -- Correct interpretation of certain complex queries with `GLOBAL IN` and `UNION ALL` -- `FREEZE PARTITION` always works atomically now. -- Empty POST requests now return a response with code 411. -- Fixed interpretation errors for expressions like `CAST(1 AS Nullable(UInt8)).` -- Fixed an error when reading `Array(Nullable(String))` columns from `MergeTree` tables. -- Fixed crashing when parsing queries like `SELECT dummy AS dummy, dummy AS b` -- Users are updated correctly with invalid `users.xml` -- Correct handling when an executable dictionary returns a non-zero response code. - -### ClickHouse release 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} - -#### New features: {#new-features-2} - -- Added the `pointInPolygon` function for working with coordinates on a coordinate plane. -- Added the `sumMap` aggregate function for calculating the sum of arrays, similar to `SummingMergeTree`. -- Added the `trunc` function. Improved performance of the rounding functions (`round`, `floor`, `ceil`, `roundToExp2`) and corrected the logic of how they work. Changed the logic of the `roundToExp2` function for fractions and negative numbers. -- The ClickHouse executable file is now less dependent on the libc version. The same ClickHouse executable file can run on a wide variety of Linux systems. There is still a dependency when using compiled queries (with the setting `compile = 1` , which is not used by default). -- Reduced the time needed for dynamic compilation of queries. - -#### Bug fixes: {#bug-fixes-2} - -- Fixed an error that sometimes produced `part ... intersects previous part` messages and weakened replica consistency. -- Fixed an error that caused the server to lock up if ZooKeeper was unavailable during shutdown. -- Removed excessive logging when restoring replicas. -- Fixed an error in the UNION ALL implementation. -- Fixed an error in the concat function that occurred if the first column in a block has the Array type. -- Progress is now displayed correctly in the system.merges table. - -### ClickHouse release 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} - -#### New features: {#new-features-3} - -- `SYSTEM` queries for server administration: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. -- Added functions for working with arrays: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. -- Added `root` and `identity` parameters for the ZooKeeper configuration. This allows you to isolate individual users on the same ZooKeeper cluster. -- Added aggregate functions `groupBitAnd`, `groupBitOr`, and `groupBitXor` (for compatibility, they are also available under the names `BIT_AND`, `BIT_OR`, and `BIT_XOR`). -- External dictionaries can be loaded from MySQL by specifying a socket in the filesystem. -- External dictionaries can be loaded from MySQL over SSL (`ssl_cert`, `ssl_key`, `ssl_ca` parameters). -- Added the `max_network_bandwidth_for_user` setting to restrict the overall bandwidth use for queries per user. -- Support for `DROP TABLE` for temporary tables. -- Support for reading `DateTime` values in Unix timestamp format from the `CSV` and `JSONEachRow` formats. -- Lagging replicas in distributed queries are now excluded by default (the default threshold is 5 minutes). -- FIFO locking is used during ALTER: an ALTER query isn’t blocked indefinitely for continuously running queries. -- Option to set `umask` in the config file. -- Improved performance for queries with `DISTINCT` . - -#### Bug fixes: {#bug-fixes-3} - -- Improved the process for deleting old nodes in ZooKeeper. Previously, old nodes sometimes didn’t get deleted if there were very frequent inserts, which caused the server to be slow to shut down, among other things. -- Fixed randomization when choosing hosts for the connection to ZooKeeper. -- Fixed the exclusion of lagging replicas in distributed queries if the replica is localhost. -- Fixed an error where a data part in a `ReplicatedMergeTree` table could be broken after running `ALTER MODIFY` on an element in a `Nested` structure. -- Fixed an error that could cause SELECT queries to “hang”. -- Improvements to distributed DDL queries. -- Fixed the query `CREATE TABLE ... AS `. -- Resolved the deadlock in the `ALTER ... CLEAR COLUMN IN PARTITION` query for `Buffer` tables. -- Fixed the invalid default value for `Enum` s (0 instead of the minimum) when using the `JSONEachRow` and `TSKV` formats. -- Resolved the appearance of zombie processes when using a dictionary with an `executable` source. -- Fixed segfault for the HEAD query. - -#### Improved workflow for developing and assembling ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse} - -- You can use `pbuilder` to build ClickHouse. -- You can use `libc++` instead of `libstdc++` for builds on Linux. -- Added instructions for using static code analysis tools: `Coverage`, `clang-tidy`, `cppcheck`. - -#### Please note when upgrading: {#please-note-when-upgrading} - -- There is now a higher default value for the MergeTree setting `max_bytes_to_merge_at_max_space_in_pool` (the maximum total size of data parts to merge, in bytes): it has increased from 100 GiB to 150 GiB. This might result in large merges running after the server upgrade, which could cause an increased load on the disk subsystem. If the free space available on the server is less than twice the total amount of the merges that are running, this will cause all other merges to stop running, including merges of small data parts. As a result, INSERT queries will fail with the message “Merges are processing significantly slower than inserts.” Use the `SELECT * FROM system.merges` query to monitor the situation. You can also check the `DiskSpaceReservedForMerge` metric in the `system.metrics` table, or in Graphite. You don’t need to do anything to fix this, since the issue will resolve itself once the large merges finish. If you find this unacceptable, you can restore the previous value for the `max_bytes_to_merge_at_max_space_in_pool` setting. To do this, go to the section in config.xml, set ``` ``107374182400 ``` and restart the server. - -### ClickHouse release 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} - -- This is a bugfix release for the previous 1.1.54282 release. It fixes leaks in the parts directory in ZooKeeper. - -### ClickHouse release 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} - -This release contains bug fixes for the previous release 1.1.54276: - -- Fixed `DB::Exception: Assertion violation: !_path.empty()` when inserting into a Distributed table. -- Fixed parsing when inserting in RowBinary format if input data starts with’;’. -- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). - -### ClickHouse Release 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} - -#### New features: {#new-features-4} - -- Added an optional WITH section for a SELECT query. Example query: `WITH 1+1 AS a SELECT a, a*a` -- INSERT can be performed synchronously in a Distributed table: OK is returned only after all the data is saved on all the shards. This is activated by the setting insert\_distributed\_sync=1. -- Added the UUID data type for working with 16-byte identifiers. -- Added aliases of CHAR, FLOAT and other types for compatibility with the Tableau. -- Added the functions toYYYYMM, toYYYYMMDD, and toYYYYMMDDhhmmss for converting time into numbers. -- You can use IP addresses (together with the hostname) to identify servers for clustered DDL queries. -- Added support for non-constant arguments and negative offsets in the function `substring(str, pos, len).` -- Added the max\_size parameter for the `groupArray(max_size)(column)` aggregate function, and optimized its performance. - -#### Main changes: {#main-changes} - -- Security improvements: all server files are created with 0640 permissions (can be changed via config parameter). -- Improved error messages for queries with invalid syntax. -- Significantly reduced memory consumption and improved performance when merging large sections of MergeTree data. -- Significantly increased the performance of data merges for the ReplacingMergeTree engine. -- Improved performance for asynchronous inserts from a Distributed table by combining multiple source inserts. To enable this functionality, use the setting distributed\_directory\_monitor\_batch\_inserts=1. - -#### Backward incompatible changes: {#backward-incompatible-changes-1} - -- Changed the binary format of aggregate states of `groupArray(array_column)` functions for arrays. - -#### Complete list of changes: {#complete-list-of-changes} - -- Added the `output_format_json_quote_denormals` setting, which enables outputting nan and inf values in JSON format. -- Optimized stream allocation when reading from a Distributed table. -- Settings can be configured in readonly mode if the value doesn’t change. -- Added the ability to retrieve non-integer granules of the MergeTree engine in order to meet restrictions on the block size specified in the preferred\_block\_size\_bytes setting. The purpose is to reduce the consumption of RAM and increase cache locality when processing queries from tables with large columns. -- Efficient use of indexes that contain expressions like `toStartOfHour(x)` for conditions like `toStartOfHour(x) op сonstexpr.` -- Added new settings for MergeTree engines (the merge\_tree section in config.xml): - - replicated\_deduplication\_window\_seconds sets the number of seconds allowed for deduplicating inserts in Replicated tables. - - cleanup\_delay\_period sets how often to start cleanup to remove outdated data. - - replicated\_can\_become\_leader can prevent a replica from becoming the leader (and assigning merges). -- Accelerated cleanup to remove outdated data from ZooKeeper. -- Multiple improvements and fixes for clustered DDL queries. Of particular interest is the new setting distributed\_ddl\_task\_timeout, which limits the time to wait for a response from the servers in the cluster. If a ddl request has not been performed on all hosts, a response will contain a timeout error and a request will be executed in an async mode. -- Improved display of stack traces in the server logs. -- Added the “none” value for the compression method. -- You can use multiple dictionaries\_config sections in config.xml. -- It is possible to connect to MySQL through a socket in the file system. -- The system.parts table has a new column with information about the size of marks, in bytes. - -#### Bug fixes: {#bug-fixes-4} - -- Distributed tables using a Merge table now work correctly for a SELECT query with a condition on the `_table` field. -- Fixed a rare race condition in ReplicatedMergeTree when checking data parts. -- Fixed possible freezing on “leader election” when starting a server. -- The max\_replica\_delay\_for\_distributed\_queries setting was ignored when using a local replica of the data source. This has been fixed. -- Fixed incorrect behavior of `ALTER TABLE CLEAR COLUMN IN PARTITION` when attempting to clean a non-existing column. -- Fixed an exception in the multiIf function when using empty arrays or strings. -- Fixed excessive memory allocations when deserializing Native format. -- Fixed incorrect auto-update of Trie dictionaries. -- Fixed an exception when running queries with a GROUP BY clause from a Merge table when using SAMPLE. -- Fixed a crash of GROUP BY when using distributed\_aggregation\_memory\_efficient=1. -- Now you can specify the database.table in the right side of IN and JOIN. -- Too many threads were used for parallel aggregation. This has been fixed. -- Fixed how the “if” function works with FixedString arguments. -- SELECT worked incorrectly from a Distributed table for shards with a weight of 0. This has been fixed. -- Running `CREATE VIEW IF EXISTS no longer causes crashes.` -- Fixed incorrect behavior when input\_format\_skip\_unknown\_fields=1 is set and there are negative numbers. -- Fixed an infinite loop in the `dictGetHierarchy()` function if there is some invalid data in the dictionary. -- Fixed `Syntax error: unexpected (...)` errors when running distributed queries with subqueries in an IN or JOIN clause and Merge tables. -- Fixed an incorrect interpretation of a SELECT query from Dictionary tables. -- Fixed the “Cannot mremap” error when using arrays in IN and JOIN clauses with more than 2 billion elements. -- Fixed the failover for dictionaries with MySQL as the source. - -#### Improved workflow for developing and assembling ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} - -- Builds can be assembled in Arcadia. -- You can use gcc 7 to compile ClickHouse. -- Parallel builds using ccache+distcc are faster now. - -### ClickHouse release 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} - -#### New features: {#new-features-5} - -- Distributed DDL (for example, `CREATE TABLE ON CLUSTER`) -- The replicated query `ALTER TABLE CLEAR COLUMN IN PARTITION.` -- The engine for Dictionary tables (access to dictionary data in the form of a table). -- Dictionary database engine (this type of database automatically has Dictionary tables available for all the connected external dictionaries). -- You can check for updates to the dictionary by sending a request to the source. -- Qualified column names -- Quoting identifiers using double quotation marks. -- Sessions in the HTTP interface. -- The OPTIMIZE query for a Replicated table can can run not only on the leader. - -#### Backward incompatible changes: {#backward-incompatible-changes-2} - -- Removed SET GLOBAL. - -#### Minor changes: {#minor-changes} - -- Now after an alert is triggered, the log prints the full stack trace. -- Relaxed the verification of the number of damaged/extra data parts at startup (there were too many false positives). - -#### Bug fixes: {#bug-fixes-5} - -- Fixed a bad connection “sticking” when inserting into a Distributed table. -- GLOBAL IN now works for a query from a Merge table that looks at a Distributed table. -- The incorrect number of cores was detected on a Google Compute Engine virtual machine. This has been fixed. -- Changes in how an executable source of cached external dictionaries works. -- Fixed the comparison of strings containing null characters. -- Fixed the comparison of Float32 primary key fields with constants. -- Previously, an incorrect estimate of the size of a field could lead to overly large allocations. -- Fixed a crash when querying a Nullable column added to a table using ALTER. -- Fixed a crash when sorting by a Nullable column, if the number of rows is less than LIMIT. -- Fixed an ORDER BY subquery consisting of only constant values. -- Previously, a Replicated table could remain in the invalid state after a failed DROP TABLE. -- Aliases for scalar subqueries with empty results are no longer lost. -- Now a query that used compilation does not fail with an error if the .so file gets damaged. diff --git a/docs/en/whats_new/changelog/2018.md b/docs/en/whats_new/changelog/2018.md deleted file mode 100644 index 346c8d6b639..00000000000 --- a/docs/en/whats_new/changelog/2018.md +++ /dev/null @@ -1,1061 +0,0 @@ ---- -toc_priority: 78 -toc_title: '2018' ---- - -## ClickHouse release 18.16 {#clickhouse-release-18-16} - -### ClickHouse release 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} - -#### Bug fixes: {#bug-fixes} - -- Fixed an error that led to problems with updating dictionaries with the ODBC source. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- JIT compilation of aggregate functions now works with LowCardinality columns. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) - -#### Improvements: {#improvements} - -- Added the `low_cardinality_allow_in_native_format` setting (enabled by default). When disabled, LowCardinality columns will be converted to ordinary columns for SELECT queries and ordinary columns will be expected for INSERT queries. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) - -#### Build improvements: {#build-improvements} - -- Fixes for builds on macOS and ARM. - -### ClickHouse release 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} - -#### New features: {#new-features} - -- `DEFAULT` expressions are evaluated for missing fields when loading data in semi-structured input formats (`JSONEachRow`, `TSKV`). The feature is enabled with the `insert_sample_with_metadata` setting. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) -- The `ALTER TABLE` query now has the `MODIFY ORDER BY` action for changing the sorting key when adding or removing a table column. This is useful for tables in the `MergeTree` family that perform additional tasks when merging based on this sorting key, such as `SummingMergeTree`, `AggregatingMergeTree`, and so on. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) -- For tables in the `MergeTree` family, now you can specify a different sorting key (`ORDER BY`) and index (`PRIMARY KEY`). The sorting key can be longer than the index. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) -- Added the `hdfs` table function and the `HDFS` table engine for importing and exporting data to HDFS. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) -- Added functions for working with base64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) -- Now you can use a parameter to configure the precision of the `uniqCombined` aggregate function (select the number of HyperLogLog cells). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) -- Added the `system.contributors` table that contains the names of everyone who made commits in ClickHouse. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) -- Added the ability to omit the partition for the `ALTER TABLE ... FREEZE` query in order to back up all partitions at once. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) -- Added `dictGet` and `dictGetOrDefault` functions that don’t require specifying the type of return value. The type is determined automatically from the dictionary description. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3564) -- Now you can specify comments for a column in the table description and change it using `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) -- Reading is supported for `Join` type tables with simple keys. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Now you can specify the options `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, and `join_overflow_mode` when creating a `Join` type table. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Added the `joinGet` function that allows you to use a `Join` type table like a dictionary. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Added the `partition_key`, `sorting_key`, `primary_key`, and `sampling_key` columns to the `system.tables` table in order to provide information about table keys. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Added the `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, and `is_in_sampling_key` columns to the `system.columns` table. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Added the `min_time` and `max_time` columns to the `system.parts` table. These columns are populated when the partitioning key is an expression consisting of `DateTime` columns. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) - -#### Bug fixes: {#bug-fixes-1} - -- Fixes and performance improvements for the `LowCardinality` data type. `GROUP BY` using `LowCardinality(Nullable(...))`. Getting the values of `extremes`. Processing high-order functions. `LEFT ARRAY JOIN`. Distributed `GROUP BY`. Functions that return `Array`. Execution of `ORDER BY`. Writing to `Distributed` tables (nicelulu). Backward compatibility for `INSERT` queries from old clients that implement the `Native` protocol. Support for `LowCardinality` for `JOIN`. Improved performance when working in a single stream. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) -- Fixed how the `select_sequential_consistency` option works. Previously, when this setting was enabled, an incomplete result was sometimes returned after beginning to write to a new partition. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) -- Databases are correctly specified when executing DDL `ON CLUSTER` queries and `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Databases are correctly specified for subqueries inside a VIEW. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Fixed a bug in `PREWHERE` with `FINAL` for `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) -- Now you can use `KILL QUERY` to cancel queries that have not started yet because they are waiting for the table to be locked. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) -- Corrected date and time calculations if the clocks were moved back at midnight (this happens in Iran, and happened in Moscow from 1981 to 1983). Previously, this led to the time being reset a day earlier than necessary, and also caused incorrect formatting of the date and time in text format. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) -- Fixed bugs in some cases of `VIEW` and subqueries that omit the database. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Fixed a race condition when simultaneously reading from a `MATERIALIZED VIEW` and deleting a `MATERIALIZED VIEW` due to not locking the internal `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) -- Fixed the error `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) -- Fixed query processing when the `compile_expressions` option is enabled (it’s enabled by default). Nondeterministic constant expressions like the `now` function are no longer unfolded. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) -- Fixed a crash when specifying a non-constant scale argument in `toDecimal32/64/128` functions. -- Fixed an error when trying to insert an array with `NULL` elements in the `Values` format into a column of type `Array` without `Nullable` (if `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) -- Fixed continuous error logging in `DDLWorker` if ZooKeeper is not available. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) -- Fixed the return type for `quantile*` functions from `Date` and `DateTime` types of arguments. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) -- Fixed the `WITH` clause if it specifies a simple alias without expressions. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) -- Fixed processing of queries with named sub-queries and qualified column names when `enable_optimize_predicate_expression` is enabled. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) -- Fixed the error `Attempt to attach to nullptr thread group` when working with materialized views. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) -- Fixed a crash when passing certain incorrect arguments to the `arrayReverse` function. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- Fixed the buffer overflow in the `extractURLParameter` function. Improved performance. Added correct processing of strings containing zero bytes. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) -- Fixed buffer overflow in the `lowerUTF8` and `upperUTF8` functions. Removed the ability to execute these functions over `FixedString` type arguments. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) -- Fixed a rare race condition when deleting `MergeTree` tables. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) -- Fixed a race condition when reading from `Buffer` tables and simultaneously performing `ALTER` or `DROP` on the target tables. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) -- Fixed a segfault if the `max_temporary_non_const_columns` limit was exceeded. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### Improvements: {#improvements-1} - -- The server does not write the processed configuration files to the `/etc/clickhouse-server/` directory. Instead, it saves them in the `preprocessed_configs` directory inside `path`. This means that the `/etc/clickhouse-server/` directory doesn’t have write access for the `clickhouse` user, which improves security. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) -- The `min_merge_bytes_to_use_direct_io` option is set to 10 GiB by default. A merge that forms large parts of tables from the MergeTree family will be performed in `O_DIRECT` mode, which prevents excessive page cache eviction. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) -- Accelerated server start when there is a very large number of tables. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) -- Added a connection pool and HTTP `Keep-Alive` for connections between replicas. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) -- If the query syntax is invalid, the `400 Bad Request` code is returned in the `HTTP` interface (500 was returned previously). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) -- The `join_default_strictness` option is set to `ALL` by default for compatibility. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) -- Removed logging to `stderr` from the `re2` library for invalid or complex regular expressions. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) -- Added for the `Kafka` table engine: checks for subscriptions before beginning to read from Kafka; the kafka\_max\_block\_size setting for the table. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) -- The `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, and `murmurHash3_64` functions now work for any number of arguments and for arguments in the form of tuples. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) -- The `arrayReverse` function now works with any types of arrays. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- Added an optional parameter: the slot size for the `timeSlots` function. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) -- For `FULL` and `RIGHT JOIN`, the `max_block_size` setting is used for a stream of non-joined data from the right table. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3699) -- Added the `--secure` command line parameter in `clickhouse-benchmark` and `clickhouse-performance-test` to enable TLS. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) -- Type conversion when the structure of a `Buffer` type table does not match the structure of the destination table. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) -- Added the `tcp_keep_alive_timeout` option to enable keep-alive packets after inactivity for the specified time interval. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) -- Removed unnecessary quoting of values for the partition key in the `system.parts` table if it consists of a single column. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) -- The modulo function works for `Date` and `DateTime` data types. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) -- Added synonyms for the `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, and `MID` functions. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Some function names are case-insensitive for compatibility with the SQL standard. Added syntactic sugar `SUBSTRING(expr FROM start FOR length)` for compatibility with SQL. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) -- Added the ability to `mlock` memory pages corresponding to `clickhouse-server` executable code to prevent it from being forced out of memory. This feature is disabled by default. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) -- Improved performance when reading from `O_DIRECT` (with the `min_bytes_to_use_direct_io` option enabled). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) -- Improved performance of the `dictGet...OrDefault` function for a constant key argument and a non-constant default argument. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3563) -- The `firstSignificantSubdomain` function now processes the domains `gov`, `mil`, and `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Improved performance. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) -- Ability to specify custom environment variables for starting `clickhouse-server` using the `SYS-V init.d` script by defining `CLICKHOUSE_PROGRAM_ENV` in `/etc/default/clickhouse`. - [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) -- Correct return code for the clickhouse-server init script. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) -- The `system.metrics` table now has the `VersionInteger` metric, and `system.build_options` has the added line `VERSION_INTEGER`, which contains the numeric form of the ClickHouse version, such as `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) -- Removed the ability to compare the `Date` type with a number to avoid potential errors like `date = 2018-12-17`, where quotes around the date are omitted by mistake. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) -- Fixed the behavior of stateful functions like `rowNumberInAllBlocks`. They previously output a result that was one number larger due to starting during query analysis. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3729) -- If the `force_restore_data` file can’t be deleted, an error message is displayed. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3794) - -#### Build improvements: {#build-improvements-1} - -- Updated the `jemalloc` library, which fixes a potential memory leak. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3557) -- Profiling with `jemalloc` is enabled by default in order to debug builds. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) -- Added the ability to run integration tests when only `Docker` is installed on the system. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) -- Added the fuzz expression test in SELECT queries. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) -- Added a stress test for commits, which performs functional tests in parallel and in random order to detect more race conditions. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) -- Improved the method for starting clickhouse-server in a Docker image. [Elghazal Ahmed](https://github.com/ClickHouse/ClickHouse/pull/3663) -- For a Docker image, added support for initializing databases using files in the `/docker-entrypoint-initdb.d` directory. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) -- Fixes for builds on ARM. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) - -#### Backward incompatible changes: {#backward-incompatible-changes} - -- Removed the ability to compare the `Date` type with a number. Instead of `toDate('2018-12-18') = 17883`, you must use explicit type conversion `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) - -## ClickHouse release 18.14 {#clickhouse-release-18-14} - -### ClickHouse release 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} - -#### Bug fixes: {#bug-fixes-2} - -- Fixed an error that led to problems with updating dictionaries with the ODBC source. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- Databases are correctly specified when executing DDL `ON CLUSTER` queries. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Fixed a segfault if the `max_temporary_non_const_columns` limit was exceeded. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### Build improvements: {#build-improvements-2} - -- Fixes for builds on ARM. - -### ClickHouse release 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} - -#### Bug fixes: {#bug-fixes-3} - -- Fixed error in `dictGet...` function for dictionaries of type `range`, if one of the arguments is constant and other is not. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) -- Fixed error that caused messages `netlink: '...': attribute type 1 has an invalid length` to be printed in Linux kernel log, that was happening only on fresh enough versions of Linux kernel. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) -- Fixed segfault in function `empty` for argument of `FixedString` type. [Daniel, Dao Quang Minh](https://github.com/ClickHouse/ClickHouse/pull/3703) -- Fixed excessive memory allocation when using large value of `max_query_size` setting (a memory chunk of `max_query_size` bytes was preallocated at once). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) - -#### Build changes: {#build-changes} - -- Fixed build with LLVM/Clang libraries of version 7 from the OS packages (these libraries are used for runtime query compilation). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### ClickHouse release 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} - -#### Bug fixes: {#bug-fixes-4} - -- Fixed cases when the ODBC bridge process did not terminate with the main server process. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) -- Fixed synchronous insertion into the `Distributed` table with a columns list that differs from the column list of the remote table. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) -- Fixed a rare race condition that can lead to a crash when dropping a MergeTree table. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Fixed a query deadlock in case when query thread creation fails with the `Resource temporarily unavailable` error. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Fixed parsing of the `ENGINE` clause when the `CREATE AS table` syntax was used and the `ENGINE` clause was specified before the `AS table` (the error resulted in ignoring the specified engine). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) - -### ClickHouse release 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} - -#### Bug fixes: {#bug-fixes-5} - -- The size of memory chunk was overestimated while deserializing the column of type `Array(String)` that leads to “Memory limit exceeded” errors. The issue appeared in version 18.12.13. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) - -### ClickHouse release 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} - -#### Bug fixes: {#bug-fixes-6} - -- Fixed `ON CLUSTER` queries when cluster configured as secure (flag ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) - -#### Build changes: {#build-changes-1} - -- Fixed problems (llvm-7 from system, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### ClickHouse release 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} - -#### Bug fixes: {#bug-fixes-7} - -- Fixed the `Block structure mismatch in MergingSorted stream` error. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) -- Fixed `ON CLUSTER` queries in case when secure connections were turned on in the cluster config (the `` flag). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) -- Fixed an error in queries that used `SAMPLE`, `PREWHERE` and alias columns. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) -- Fixed a rare `unknown compression method` error when the `min_bytes_to_use_direct_io` setting was enabled. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) - -#### Performance improvements: {#performance-improvements} - -- Fixed performance regression of queries with `GROUP BY` of columns of UInt16 or Date type when executing on AMD EPYC processors. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) -- Fixed performance regression of queries that process long strings. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) - -#### Build improvements: {#build-improvements-3} - -- Improvements for simplifying the Arcadia build. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) - -### ClickHouse release 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} - -#### Bug fixes: {#bug-fixes-8} - -- Fixed a crash on joining two unnamed subqueries. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) -- Fixed generating incorrect queries (with an empty `WHERE` clause) when querying external databases. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) -- Fixed using an incorrect timeout value in ODBC dictionaries. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) - -### ClickHouse release 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} - -#### Bug fixes: {#bug-fixes-9} - -- Fixed the error `Block structure mismatch in UNION stream: different number of columns` in LIMIT queries. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) -- Fixed errors when merging data in tables containing arrays inside Nested structures. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) -- Fixed incorrect query results if the `merge_tree_uniform_read_distribution` setting is disabled (it is enabled by default). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) -- Fixed an error on inserts to a Distributed table in Native format. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) - -### ClickHouse release 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} - -- The `compile_expressions` setting (JIT compilation of expressions) is disabled by default. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) -- The `enable_optimize_predicate_expression` setting is disabled by default. - -### ClickHouse release 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} - -#### New features: {#new-features-1} - -- The `WITH CUBE` modifier for `GROUP BY` (the alternative syntax `GROUP BY CUBE(...)` is also available). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) -- Added the `formatDateTime` function. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) -- Added the `JDBC` table engine and `jdbc` table function (requires installing clickhouse-jdbc-bridge). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- Added functions for working with the ISO week number: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, and `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) -- Now you can use `Nullable` columns for `MySQL` and `ODBC` tables. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- Nested data structures can be read as nested objects in `JSONEachRow` format. Added the `input_format_import_nested_json` setting. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) -- Parallel processing is available for many `MATERIALIZED VIEW`s when inserting data. See the `parallel_view_processing` setting. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) -- Added the `SYSTEM FLUSH LOGS` query (forced log flushes to system tables such as `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) -- Now you can use pre-defined `database` and `table` macros when declaring `Replicated` tables. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) -- Added the ability to read `Decimal` type values in engineering notation (indicating powers of ten). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) - -#### Experimental features: {#experimental-features} - -- Optimization of the GROUP BY clause for `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) -- Optimized calculation of expressions for `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) - -#### Improvements: {#improvements-2} - -- Significantly reduced memory consumption for queries with `ORDER BY` and `LIMIT`. See the `max_bytes_before_remerge_sort` setting. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- In the absence of `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` is assumed. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) -- Qualified asterisks work correctly in queries with `JOIN`. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) -- The `ODBC` table engine correctly chooses the method for quoting identifiers in the SQL dialect of a remote database. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- The `compile_expressions` setting (JIT compilation of expressions) is enabled by default. -- Fixed behavior for simultaneous DROP DATABASE/TABLE IF EXISTS and CREATE DATABASE/TABLE IF NOT EXISTS. Previously, a `CREATE DATABASE ... IF NOT EXISTS` query could return the error message “File … already exists”, and the `CREATE TABLE ... IF NOT EXISTS` and `DROP TABLE IF EXISTS` queries could return `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) -- LIKE and IN expressions with a constant right half are passed to the remote server when querying from MySQL or ODBC tables. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- Comparisons with constant expressions in a WHERE clause are passed to the remote server when querying from MySQL and ODBC tables. Previously, only comparisons with constants were passed. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- Correct calculation of row width in the terminal for `Pretty` formats, including strings with hieroglyphs. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/3257). -- `ON CLUSTER` can be specified for `ALTER UPDATE` queries. -- Improved performance for reading data in `JSONEachRow` format. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) -- Added synonyms for the `LENGTH` and `CHARACTER_LENGTH` functions for compatibility. The `CONCAT` function is no longer case-sensitive. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) -- Added the `TIMESTAMP` synonym for the `DateTime` type. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) -- There is always space reserved for query\_id in the server logs, even if the log line is not related to a query. This makes it easier to parse server text logs with third-party tools. -- Memory consumption by a query is logged when it exceeds the next level of an integer number of gigabytes. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- Added compatibility mode for the case when the client library that uses the Native protocol sends fewer columns by mistake than the server expects for the INSERT query. This scenario was possible when using the clickhouse-cpp library. Previously, this scenario caused the server to crash. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) -- In a user-defined WHERE expression in `clickhouse-copier`, you can now use a `partition_key` alias (for additional filtering by source table partition). This is useful if the partitioning scheme changes during copying, but only changes slightly. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) -- The workflow of the `Kafka` engine has been moved to a background thread pool in order to automatically reduce the speed of data reading at high loads. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- Support for reading `Tuple` and `Nested` values of structures like `struct` in the `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) -- The list of top-level domains for the `firstSignificantSubdomain` function now includes the domain `biz`. [decaseal](https://github.com/ClickHouse/ClickHouse/pull/3219) -- In the configuration of external dictionaries, `null_value` is interpreted as the value of the default data type. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) -- Support for the `intDiv` and `intDivOrZero` functions for `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) -- Support for the `Date`, `DateTime`, `UUID`, and `Decimal` types as a key for the `sumMap` aggregate function. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) -- Support for the `Decimal` data type in external dictionaries. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) -- Support for the `Decimal` data type in `SummingMergeTree` tables. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) -- Added specializations for `UUID` in `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) -- Reduced the number of `open` and `close` system calls when reading from a `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) -- A `TRUNCATE TABLE` query can be executed on any replica (the query is passed to the leader replica). [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) - -#### Bug fixes: {#bug-fixes-10} - -- Fixed an issue with `Dictionary` tables for `range_hashed` dictionaries. This error occurred in version 18.12.17. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) -- Fixed an error when loading `range_hashed` dictionaries (the message `Unsupported type Nullable (...)`). This error occurred in version 18.12.17. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- Fixed errors in the `pointInPolygon` function due to the accumulation of inaccurate calculations for polygons with a large number of vertices located close to each other. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) -- If after merging data parts, the checksum for the resulting part differs from the result of the same merge in another replica, the result of the merge is deleted and the data part is downloaded from the other replica (this is the correct behavior). But after downloading the data part, it couldn’t be added to the working set because of an error that the part already exists (because the data part was deleted with some delay after the merge). This led to cyclical attempts to download the same data. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) -- Fixed incorrect calculation of total memory consumption by queries (because of incorrect calculation, the `max_memory_usage_for_all_queries` setting worked incorrectly and the `MemoryTracking` metric had an incorrect value). This error occurred in version 18.12.13. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) -- Fixed the functionality of `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` This error occurred in version 18.12.13. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) -- Fixed unnecessary preparation of data structures for `JOIN`s on the server that initiates the query if the `JOIN` is only performed on remote servers. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) -- Fixed bugs in the `Kafka` engine: deadlocks after exceptions when starting to read data, and locks upon completion [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- For `Kafka` tables, the optional `schema` parameter was not passed (the schema of the `Cap'n'Proto` format). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) -- If the ensemble of ZooKeeper servers has servers that accept the connection but then immediately close it instead of responding to the handshake, ClickHouse chooses to connect another server. Previously, this produced the error `Cannot read all data. Bytes read: 0. Bytes expected: 4.` and the server couldn’t start. [8218cf3a](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) -- If the ensemble of ZooKeeper servers contains servers for which the DNS query returns an error, these servers are ignored. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) -- Fixed type conversion between `Date` and `DateTime` when inserting data in the `VALUES` format (if `input_format_values_interpret_expressions = 1`). Previously, the conversion was performed between the numerical value of the number of days in Unix Epoch time and the Unix timestamp, which led to unexpected results. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) -- Corrected type conversion between `Decimal` and integer numbers. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) -- Fixed errors in the `enable_optimize_predicate_expression` setting. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) -- Fixed a parsing error in CSV format with floating-point numbers if a non-default CSV separator is used, such as `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) -- Fixed the `arrayCumSumNonNegative` function (it does not accumulate negative values if the accumulator is less than zero). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) -- Fixed how `Merge` tables work on top of `Distributed` tables when using `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) -- Bug fixes in the `ALTER UPDATE` query. -- Fixed bugs in the `odbc` table function that appeared in version 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) -- Fixed the operation of aggregate functions with `StateArray` combinators. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) -- Fixed a crash when dividing a `Decimal` value by zero. [69dd6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) -- Fixed output of types for operations using `Decimal` and integer arguments. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) -- Fixed the segfault during `GROUP BY` on `Decimal128`. [3359ba06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) -- The `log_query_threads` setting (logging information about each thread of query execution) now takes effect only if the `log_queries` option (logging information about queries) is set to 1. Since the `log_query_threads` option is enabled by default, information about threads was previously logged even if query logging was disabled. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) -- Fixed an error in the distributed operation of the quantiles aggregate function (the error message `Not found column quantile...`). [292a8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) -- Fixed the compatibility problem when working on a cluster of version 18.12.17 servers and older servers at the same time. For distributed queries with GROUP BY keys of both fixed and non-fixed length, if there was a large amount of data to aggregate, the returned data was not always fully aggregated (two different rows contained the same aggregation keys). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) -- Fixed handling of substitutions in `clickhouse-performance-test`, if the query contains only part of the substitutions declared in the test. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) -- Fixed an error when using `FINAL` with `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Fixed an error when using `PREWHERE` over columns that were added during `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Added a check for the absence of `arrayJoin` for `DEFAULT` and `MATERIALIZED` expressions. Previously, `arrayJoin` led to an error when inserting data. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) -- Added a check for the absence of `arrayJoin` in a `PREWHERE` clause. Previously, this led to messages like `Size ... doesn't match` or `Unknown compression method` when executing queries. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) -- Fixed segfault that could occur in rare cases after optimization that replaced AND chains from equality evaluations with the corresponding IN expression. [liuyimin-bytedance](https://github.com/ClickHouse/ClickHouse/pull/3339) -- Minor corrections to `clickhouse-benchmark`: previously, client information was not sent to the server; now the number of queries executed is calculated more accurately when shutting down and for limiting the number of iterations. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) - -#### Backward incompatible changes: {#backward-incompatible-changes-1} - -- Removed the `allow_experimental_decimal_type` option. The `Decimal` data type is available for default use. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) - -## ClickHouse release 18.12 {#clickhouse-release-18-12} - -### ClickHouse release 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} - -#### New features: {#new-features-2} - -- `invalidate_query` (the ability to specify a query to check whether an external dictionary needs to be updated) is implemented for the `clickhouse` source. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) -- Added the ability to use `UInt*`, `Int*`, and `DateTime` data types (along with the `Date` type) as a `range_hashed` external dictionary key that defines the boundaries of ranges. Now `NULL` can be used to designate an open range. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) -- The `Decimal` type now supports `var*` and `stddev*` aggregate functions. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- The `Decimal` type now supports mathematical functions (`exp`, `sin` and so on.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- The `system.part_log` table now has the `partition_id` column. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Bug fixes: {#bug-fixes-11} - -- `Merge` now works correctly on `Distributed` tables. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) -- Fixed incompatibility (unnecessary dependency on the `glibc` version) that made it impossible to run ClickHouse on `Ubuntu Precise` and older versions. The incompatibility arose in version 18.12.13. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) -- Fixed errors in the `enable_optimize_predicate_expression` setting. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) -- Fixed a minor issue with backwards compatibility that appeared when working with a cluster of replicas on versions earlier than 18.12.13 and simultaneously creating a new replica of a table on a server with a newer version (shown in the message `Can not clone replica, because the ... updated to new ClickHouse version`, which is logical, but shouldn’t happen). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) - -#### Backward incompatible changes: {#backward-incompatible-changes-2} - -- The `enable_optimize_predicate_expression` option is enabled by default (which is rather optimistic). If query analysis errors occur that are related to searching for the column names, set `enable_optimize_predicate_expression` to 0. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) - -### ClickHouse release 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} - -#### New features: {#new-features-3} - -- Added support for `ALTER UPDATE` queries. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) -- Added the `allow_ddl` option, which restricts the user’s access to DDL queries. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) -- Added the `min_merge_bytes_to_use_direct_io` option for `MergeTree` engines, which allows you to set a threshold for the total size of the merge (when above the threshold, data part files will be handled using O\_DIRECT). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) -- The `system.merges` system table now contains the `partition_id` column. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) - -#### Improvements {#improvements-3} - -- If a data part remains unchanged during mutation, it isn’t downloaded by replicas. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) -- Autocomplete is available for names of settings when working with `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) - -#### Bug fixes: {#bug-fixes-12} - -- Added a check for the sizes of arrays that are elements of `Nested` type fields when inserting. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) -- Fixed an error updating external dictionaries with the `ODBC` source and `hashed` storage. This error occurred in version 18.12.13. -- Fixed a crash when creating a temporary table from a query with an `IN` condition. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) -- Fixed an error in aggregate functions for arrays that can have `NULL` elements. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) - -### ClickHouse release 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} - -#### New features: {#new-features-4} - -- Added the `DECIMAL(digits, scale)` data type (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). To enable it, use the setting `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) -- New `WITH ROLLUP` modifier for `GROUP BY` (alternative syntax: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) -- In queries with JOIN, the star character expands to a list of columns in all tables, in compliance with the SQL standard. You can restore the old behavior by setting `asterisk_left_columns_only` to 1 on the user configuration level. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) -- Added support for JOIN with table functions. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- Autocomplete by pressing Tab in clickhouse-client. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) -- Ctrl+C in clickhouse-client clears a query that was entered. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) -- Added the `join_default_strictness` setting (values: `"`, `'any'`, `'all'`). This allows you to not specify `ANY` or `ALL` for `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) -- Each line of the server log related to query processing shows the query ID. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Now you can get query execution logs in clickhouse-client (use the `send_logs_level` setting). With distributed query processing, logs are cascaded from all the servers. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- The `system.query_log` and `system.processes` (`SHOW PROCESSLIST`) tables now have information about all changed settings when you run a query (the nested structure of the `Settings` data). Added the `log_query_settings` setting. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- The `system.query_log` and `system.processes` tables now show information about the number of threads that are participating in query execution (see the `thread_numbers` column). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Added `ProfileEvents` counters that measure the time spent on reading and writing over the network and reading and writing to disk, the number of network errors, and the time spent waiting when network bandwidth is limited. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Added `ProfileEvents`counters that contain the system metrics from rusage (you can use them to get information about CPU usage in userspace and the kernel, page faults, and context switches), as well as taskstats metrics (use these to obtain information about I/O wait time, CPU wait time, and the amount of data read and recorded, both with and without page cache). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- The `ProfileEvents` counters are applied globally and for each query, as well as for each query execution thread, which allows you to profile resource consumption by query in detail. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Added the `system.query_thread_log` table, which contains information about each query execution thread. Added the `log_query_threads` setting. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- The `system.metrics` and `system.events` tables now have built-in documentation. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) -- Added the `arrayEnumerateDense` function. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2975) -- Added the `arrayCumSumNonNegative` and `arrayDifference` functions. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) -- Added the `retention` aggregate function. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) -- Now you can add (merge) states of aggregate functions by using the plus operator, and multiply the states of aggregate functions by a nonnegative constant. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) -- Tables in the MergeTree family now have the virtual column `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Experimental features: {#experimental-features-1} - -- Added the `LowCardinality(T)` data type. This data type automatically creates a local dictionary of values and allows data processing without unpacking the dictionary. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) -- Added a cache of JIT-compiled functions and a counter for the number of uses before compiling. To JIT compile expressions, enable the `compile_expressions` setting. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) - -#### Improvements: {#improvements-4} - -- Fixed the problem with unlimited accumulation of the replication log when there are abandoned replicas. Added an effective recovery mode for replicas with a long lag. -- Improved performance of `GROUP BY` with multiple aggregation fields when one of them is string and the others are fixed length. -- Improved performance when using `PREWHERE` and with implicit transfer of expressions in `PREWHERE`. -- Improved parsing performance for text formats (`CSV`, `TSV`). [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) -- Improved performance of reading strings and arrays in binary formats. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2955) -- Increased performance and reduced memory consumption for queries to `system.tables` and `system.columns` when there is a very large number of tables on a single server. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) -- Fixed a performance problem in the case of a large stream of queries that result in an error (the `_dl_addr` function is visible in `perf top`, but the server isn’t using much CPU). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) -- Conditions are cast into the View (when `enable_optimize_predicate_expression` is enabled). [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- Improvements to the functionality for the `UUID` data type. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) -- The `UUID` data type is supported in The-Alchemist dictionaries. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) -- The `visitParamExtractRaw` function works correctly with nested structures. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) -- When the `input_format_skip_unknown_fields` setting is enabled, object fields in `JSONEachRow` format are skipped correctly. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) -- For a `CASE` expression with conditions, you can now omit `ELSE`, which is equivalent to `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) -- The operation timeout can now be configured when working with ZooKeeper. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) -- You can specify an offset for `LIMIT n, m` as `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- You can use the `SELECT TOP n` syntax as an alternative for `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- Increased the size of the queue to write to system tables, so the `SystemLog parameter queue is full` error doesn’t happen as often. -- The `windowFunnel` aggregate function now supports events that meet multiple conditions. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2801) -- Duplicate columns can be used in a `USING` clause for `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) -- `Pretty` formats now have a limit on column alignment by width. Use the `output_format_pretty_max_column_pad_width` setting. If a value is wider, it will still be displayed in its entirety, but the other cells in the table will not be too wide. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) -- The `odbc` table function now allows you to specify the database/schema name. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2885) -- Added the ability to use a username specified in the `clickhouse-client` config file. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) -- The `ZooKeeperExceptions` counter has been split into three counters: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, and `ZooKeeperOtherExceptions`. -- `ALTER DELETE` queries work for materialized views. -- Added randomization when running the cleanup thread periodically for `ReplicatedMergeTree` tables in order to avoid periodic load spikes when there are a very large number of `ReplicatedMergeTree` tables. -- Support for `ATTACH TABLE ... ON CLUSTER` queries. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) - -#### Bug fixes: {#bug-fixes-13} - -- Fixed an issue with `Dictionary` tables (throws the `Size of offsets doesn't match size of column` or `Unknown compression method` exception). This bug appeared in version 18.10.3. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) -- Fixed a bug when merging `CollapsingMergeTree` tables if one of the data parts is empty (these parts are formed during merge or `ALTER DELETE` if all data was deleted), and the `vertical` algorithm was used for the merge. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) -- Fixed a race condition during `DROP` or `TRUNCATE` for `Memory` tables with a simultaneous `SELECT`, which could lead to server crashes. This bug appeared in version 1.1.54388. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) -- Fixed the possibility of data loss when inserting in `Replicated` tables if the `Session is expired` error is returned (data loss can be detected by the `ReplicatedDataLoss` metric). This error occurred in version 1.1.54378. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) -- Fixed a segfault during `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) -- Fixed the error searching column names when the `WHERE` expression consists entirely of a qualified column name, such as `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) -- Fixed the “Not found column” error that occurred when executing distributed queries if a single column consisting of an IN expression with a subquery is requested from a remote server. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) -- Fixed the `Block structure mismatch in UNION stream: different number of columns` error that occurred for distributed queries if one of the shards is local and the other is not, and optimization of the move to `PREWHERE` is triggered. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) -- Fixed the `pointInPolygon` function for certain cases of non-convex polygons. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) -- Fixed the incorrect result when comparing `nan` with integers. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) -- Fixed an error in the `zlib-ng` library that could lead to segfault in rare cases. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) -- Fixed a memory leak when inserting into a table with `AggregateFunction` columns, if the state of the aggregate function is not simple (allocates memory separately), and if a single insertion request results in multiple small blocks. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) -- Fixed a race condition when creating and deleting the same `Buffer` or `MergeTree` table simultaneously. -- Fixed the possibility of a segfault when comparing tuples made up of certain non-trivial types, such as tuples. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) -- Fixed the possibility of a segfault when running certain `ON CLUSTER` queries. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) -- Fixed an error in the `arrayDistinct` function for `Nullable` array elements. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) -- The `enable_optimize_predicate_expression` option now correctly supports cases with `SELECT *`. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) -- Fixed the segfault when re-initializing the ZooKeeper session. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) -- Fixed potential blocking when working with ZooKeeper. -- Fixed incorrect code for adding nested data structures in a `SummingMergeTree`. -- When allocating memory for states of aggregate functions, alignment is correctly taken into account, which makes it possible to use operations that require alignment when implementing states of aggregate functions. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) - -#### Security fix: {#security-fix} - -- Safe use of ODBC data sources. Interaction with ODBC drivers uses a separate `clickhouse-odbc-bridge` process. Errors in third-party ODBC drivers no longer cause problems with server stability or vulnerabilities. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) -- Fixed incorrect validation of the file path in the `catBoostPool` table function. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) -- The contents of system tables (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, and `replication_queue`) are filtered according to the user’s configured access to databases (`allow_databases`). [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) - -#### Backward incompatible changes: {#backward-incompatible-changes-3} - -- In queries with JOIN, the star character expands to a list of columns in all tables, in compliance with the SQL standard. You can restore the old behavior by setting `asterisk_left_columns_only` to 1 on the user configuration level. - -#### Build changes: {#build-changes-2} - -- Most integration tests can now be run by commit. -- Code style checks can also be run by commit. -- The `memcpy` implementation is chosen correctly when building on CentOS7/Fedora. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) -- When using clang to build, some warnings from `-Weverything` have been added, in addition to the regular `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) -- Debugging the build uses the `jemalloc` debug option. -- The interface of the library for interacting with ZooKeeper is declared abstract. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) - -## ClickHouse release 18.10 {#clickhouse-release-18-10} - -### ClickHouse release 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} - -#### New features: {#new-features-5} - -- HTTPS can be used for replication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) -- Added the functions `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, and `murmurHash3_128` in addition to the existing `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) -- Support for Nullable types in the ClickHouse ODBC driver (`ODBCDriver2` output format). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) -- Support for `UUID` in the key columns. - -#### Improvements: {#improvements-5} - -- Clusters can be removed without restarting the server when they are deleted from the config files. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) -- External dictionaries can be removed without restarting the server when they are removed from config files. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) -- Added `SETTINGS` support for the `Kafka` table engine. [Alexander Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) -- Improvements for the `UUID` data type (not yet complete). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) -- Support for empty parts after merges in the `SummingMergeTree`, `CollapsingMergeTree` and `VersionedCollapsingMergeTree` engines. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) -- Old records of completed mutations are deleted (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) -- Added the `system.merge_tree_settings` table. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) -- The `system.tables` table now has dependency columns: `dependencies_database` and `dependencies_table`. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) -- Added the `max_partition_size_to_drop` config option. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) -- Added the `output_format_json_escape_forward_slashes` option. [Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2812) -- Added the `max_fetch_partition_retries_count` setting. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) -- Added the `prefer_localhost_replica` setting for disabling the preference for a local replica and going to a local replica without inter-process interaction. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) -- The `quantileExact` aggregate function returns `nan` in the case of aggregation on an empty `Float32` or `Float64` set. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) - -#### Bug fixes: {#bug-fixes-14} - -- Removed unnecessary escaping of the connection string parameters for ODBC, which made it impossible to establish a connection. This error occurred in version 18.6.0. -- Fixed the logic for processing `REPLACE PARTITION` commands in the replication queue. If there are two `REPLACE` commands for the same partition, the incorrect logic could cause one of them to remain in the replication queue and not be executed. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) -- Fixed a merge bug when all data parts were empty (parts that were formed from a merge or from `ALTER DELETE` if all data was deleted). This bug appeared in version 18.1.0. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) -- Fixed an error for concurrent `Set` or `Join`. [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2823) -- Fixed the `Block structure mismatch in UNION stream: different number of columns` error that occurred for `UNION ALL` queries inside a sub-query if one of the `SELECT` queries contains duplicate column names. [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) -- Fixed a memory leak if an exception occurred when connecting to a MySQL server. -- Fixed incorrect clickhouse-client response code in case of a query error. -- Fixed incorrect behavior of materialized views containing DISTINCT. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) - -#### Backward incompatible changes {#backward-incompatible-changes-4} - -- Removed support for CHECK TABLE queries for Distributed tables. - -#### Build changes: {#build-changes-3} - -- The allocator has been replaced: `jemalloc` is now used instead of `tcmalloc`. In some scenarios, this increases speed up to 20%. However, there are queries that have slowed by up to 20%. Memory consumption has been reduced by approximately 10% in some scenarios, with improved stability. With highly competitive loads, CPU usage in userspace and in system shows just a slight increase. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) -- Use of libressl from a submodule. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) -- Use of unixodbc from a submodule. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) -- Use of mariadb-connector-c from a submodule. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) -- Added functional test files to the repository that depend on the availability of test data (for the time being, without the test data itself). - -## ClickHouse release 18.6 {#clickhouse-release-18-6} - -### ClickHouse release 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} - -#### New features: {#new-features-6} - -- Added support for ON expressions for the JOIN ON syntax: - `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` - The expression must be a chain of equalities joined by the AND operator. Each side of the equality can be an arbitrary expression over the columns of one of the tables. The use of fully qualified column names is supported (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) for the right table. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) -- HTTPS can be enabled for replication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) - -#### Improvements: {#improvements-6} - -- The server passes the patch component of its version to the client. Data about the patch version component is in `system.processes` and `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) - -## ClickHouse release 18.5 {#clickhouse-release-18-5} - -### ClickHouse release 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} - -#### New features: {#new-features-7} - -- Added the hash function `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). - -#### Improvements: {#improvements-7} - -- Now you can use the `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) attribute to set values in config files from environment variables. -- Added case-insensitive versions of the `coalesce`, `ifNull`, and `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). - -#### Bug fixes: {#bug-fixes-15} - -- Fixed a possible bug when starting a replica [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). - -## ClickHouse release 18.4 {#clickhouse-release-18-4} - -### ClickHouse release 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} - -#### New features: {#new-features-8} - -- Added system tables: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). -- Added the ability to use a table function instead of a table as an argument of a `remote` or `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). -- Support for `HTTP Basic` authentication in the replication protocol [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). -- The `has` function now allows searching for a numeric value in an array of `Enum` values [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). -- Support for adding arbitrary message separators when reading from `Kafka` [Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2701). - -#### Improvements: {#improvements-8} - -- The `ALTER TABLE t DELETE WHERE` query does not rewrite data parts that were not affected by the WHERE condition [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). -- The `use_minimalistic_checksums_in_zookeeper` option for `ReplicatedMergeTree` tables is enabled by default. This setting was added in version 1.1.54378, 2018-04-16. Versions that are older than 1.1.54378 can no longer be installed. -- Support for running `KILL` and `OPTIMIZE` queries that specify `ON CLUSTER` [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). - -#### Bug fixes: {#bug-fixes-16} - -- Fixed the error `Column ... is not under an aggregate function and not in GROUP BY` for aggregation with an IN expression. This bug appeared in version 18.1.0. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) -- Fixed a bug in the `windowFunnel aggregate function` [Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). -- Fixed a bug in the `anyHeavy` aggregate function ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) -- Fixed server crash when using the `countArray()` aggregate function. - -#### Backward incompatible changes: {#backward-incompatible-changes-5} - -- Parameters for `Kafka` engine was changed from `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` to `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. If your tables use `kafka_schema` or `kafka_num_consumers` parameters, you have to manually edit the metadata files `path/metadata/database/table.sql` and add `kafka_row_delimiter` parameter with `''` value. - -## ClickHouse release 18.1 {#clickhouse-release-18-1} - -### ClickHouse release 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} - -#### New features: {#new-features-9} - -- Support for the `ALTER TABLE t DELETE WHERE` query for non-replicated MergeTree tables ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). -- Support for arbitrary types for the `uniq*` family of aggregate functions ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). -- Support for arbitrary types in comparison operators ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). -- The `users.xml` file allows setting a subnet mask in the format `10.0.0.1/255.255.255.0`. This is necessary for using masks for IPv6 networks with zeros in the middle ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). -- Added the `arrayDistinct` function ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). -- The SummingMergeTree engine can now work with AggregateFunction type columns ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). - -#### Improvements: {#improvements-9} - -- Changed the numbering scheme for release versions. Now the first part contains the year of release (A.D., Moscow timezone, minus 2000), the second part contains the number for major changes (increases for most releases), and the third part is the patch version. Releases are still backward compatible, unless otherwise stated in the changelog. -- Faster conversions of floating-point numbers to a string ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2664)). -- If some rows were skipped during an insert due to parsing errors (this is possible with the `input_allow_errors_num` and `input_allow_errors_ratio` settings enabled), the number of skipped rows is now written to the server log ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). - -#### Bug fixes: {#bug-fixes-17} - -- Fixed the TRUNCATE command for temporary tables ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2624)). -- Fixed a rare deadlock in the ZooKeeper client library that occurred when there was a network error while reading the response ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). -- Fixed an error during a CAST to Nullable types ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). -- Fixed the incorrect result of the `maxIntersection()` function when the boundaries of intervals coincided ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). -- Fixed incorrect transformation of the OR expression chain in a function argument ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). -- Fixed performance degradation for queries containing `IN (subquery)` expressions inside another subquery ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). -- Fixed incompatibility between servers with different versions in distributed queries that use a `CAST` function that isn’t in uppercase letters ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). -- Added missing quoting of identifiers for queries to an external DBMS ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). - -#### Backward incompatible changes: {#backward-incompatible-changes-6} - -- Converting a string containing the number zero to DateTime does not work. Example: `SELECT toDateTime('0')`. This is also the reason that `DateTime DEFAULT '0'` does not work in tables, as well as `0` in dictionaries. Solution: replace `0` with `0000-00-00 00:00:00`. - -## ClickHouse release 1.1 {#clickhouse-release-1-1} - -### ClickHouse release 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} - -#### New features: {#new-features-10} - -- Added the `histogram` aggregate function ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). -- Now `OPTIMIZE TABLE ... FINAL` can be used without specifying partitions for `ReplicatedMergeTree` ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2600)). - -#### Bug fixes: {#bug-fixes-18} - -- Fixed a problem with a very small timeout for sockets (one second) for reading and writing when sending and downloading replicated data, which made it impossible to download larger parts if there is a load on the network or disk (it resulted in cyclical attempts to download parts). This error occurred in version 1.1.54388. -- Fixed issues when using chroot in ZooKeeper if you inserted duplicate data blocks in the table. -- The `has` function now works correctly for an array with Nullable elements ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). -- The `system.tables` table now works correctly when used in distributed queries. The `metadata_modification_time` and `engine_full` columns are now non-virtual. Fixed an error that occurred if only these columns were queried from the table. -- Fixed how an empty `TinyLog` table works after inserting an empty data block ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). -- The `system.zookeeper` table works if the value of the node in ZooKeeper is NULL. - -### ClickHouse release 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} - -#### New features: {#new-features-11} - -- Queries can be sent in `multipart/form-data` format (in the `query` field), which is useful if external data is also sent for query processing ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). -- Added the ability to enable or disable processing single or double quotes when reading data in CSV format. You can configure this in the `format_csv_allow_single_quotes` and `format_csv_allow_double_quotes` settings ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2574)). -- Now `OPTIMIZE TABLE ... FINAL` can be used without specifying the partition for non-replicated variants of `MergeTree` ([Amos Bird](https://github.com/ClickHouse/ClickHouse/pull/2599)). - -#### Improvements: {#improvements-10} - -- Improved performance, reduced memory consumption, and correct memory consumption tracking with use of the IN operator when a table index could be used ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). -- Removed redundant checking of checksums when adding a data part. This is important when there are a large number of replicas, because in these cases the total number of checks was equal to N^2. -- Added support for `Array(Tuple(...))` arguments for the `arrayEnumerateUniq` function ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). -- Added `Nullable` support for the `runningDifference` function ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). -- Improved query analysis performance when there is a very large number of expressions ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). -- Faster selection of data parts for merging in `ReplicatedMergeTree` tables. Faster recovery of the ZooKeeper session ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). -- The `format_version.txt` file for `MergeTree` tables is re-created if it is missing, which makes sense if ClickHouse is launched after copying the directory structure without files ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). - -#### Bug fixes: {#bug-fixes-19} - -- Fixed a bug when working with ZooKeeper that could make it impossible to recover the session and readonly states of tables before restarting the server. -- Fixed a bug when working with ZooKeeper that could result in old nodes not being deleted if the session is interrupted. -- Fixed an error in the `quantileTDigest` function for Float arguments (this bug was introduced in version 1.1.54388) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). -- Fixed a bug in the index for MergeTree tables if the primary key column is located inside the function for converting types between signed and unsigned integers of the same size ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). -- Fixed segfault if `macros` are used but they aren’t in the config file ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). -- Fixed switching to the default database when reconnecting the client ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). -- Fixed a bug that occurred when the `use_index_for_in_with_subqueries` setting was disabled. - -#### Security fix: {#security-fix-1} - -- Sending files is no longer possible when connected to MySQL (`LOAD DATA LOCAL INFILE`). - -### ClickHouse release 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} - -#### New features: {#new-features-12} - -- Support for the `ALTER TABLE t DELETE WHERE` query for replicated tables. Added the `system.mutations` table to track progress of this type of queries. -- Support for the `ALTER TABLE t [REPLACE|ATTACH] PARTITION` query for \*MergeTree tables. -- Support for the `TRUNCATE TABLE` query ([Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) -- Several new `SYSTEM` queries for replicated tables (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). -- Added the ability to write to a table with the MySQL engine and the corresponding table function ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). -- Added the `url()` table function and the `URL` table engine ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). -- Added the `windowFunnel` aggregate function ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). -- New `startsWith` and `endsWith` functions for strings ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). -- The `numbers()` table function now allows you to specify the offset ([Winter Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). -- The password to `clickhouse-client` can be entered interactively. -- Server logs can now be sent to syslog ([Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). -- Support for logging in dictionaries with a shared library source ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). -- Support for custom CSV delimiters ([Ivan Zhukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) -- Added the `date_time_input_format` setting. If you switch this setting to `'best_effort'`, DateTime values will be read in a wide range of formats. -- Added the `clickhouse-obfuscator` utility for data obfuscation. Usage example: publishing data used in performance tests. - -#### Experimental features: {#experimental-features-2} - -- Added the ability to calculate `and` arguments only where they are needed ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) -- JIT compilation to native code is now available for some expressions ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). - -#### Bug fixes: {#bug-fixes-20} - -- Duplicates no longer appear for a query with `DISTINCT` and `ORDER BY`. -- Queries with `ARRAY JOIN` and `arrayFilter` no longer return an incorrect result. -- Fixed an error when reading an array column from a Nested structure ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). -- Fixed an error when analyzing queries with a HAVING clause like `HAVING tuple IN (...)`. -- Fixed an error when analyzing queries with recursive aliases. -- Fixed an error when reading from ReplacingMergeTree with a condition in PREWHERE that filters all rows ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). -- User profile settings were not applied when using sessions in the HTTP interface. -- Fixed how settings are applied from the command line parameters in clickhouse-local. -- The ZooKeeper client library now uses the session timeout received from the server. -- Fixed a bug in the ZooKeeper client library when the client waited for the server response longer than the timeout. -- Fixed pruning of parts for queries with conditions on partition key columns ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). -- Merges are now possible after `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). -- Type mapping in the ODBC table function has been fixed ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). -- Type comparisons have been fixed for `DateTime` with and without the time zone ([Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). -- Fixed syntactic parsing and formatting of the `CAST` operator. -- Fixed insertion into a materialized view for the Distributed table engine ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). -- Fixed a race condition when writing data from the `Kafka` engine to materialized views ([Yangkuan Liu](https://github.com/ClickHouse/ClickHouse/pull/2448)). -- Fixed SSRF in the remote() table function. -- Fixed exit behavior of `clickhouse-client` in multiline mode ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). - -#### Improvements: {#improvements-11} - -- Background tasks in replicated tables are now performed in a thread pool instead of in separate threads ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). -- Improved LZ4 compression performance. -- Faster analysis for queries with a large number of JOINs and sub-queries. -- The DNS cache is now updated automatically when there are too many network errors. -- Table inserts no longer occur if the insert into one of the materialized views is not possible because it has too many parts. -- Corrected the discrepancy in the event counters `Query`, `SelectQuery`, and `InsertQuery`. -- Expressions like `tuple IN (SELECT tuple)` are allowed if the tuple types match. -- A server with replicated tables can start even if you haven’t configured ZooKeeper. -- When calculating the number of available CPU cores, limits on cgroups are now taken into account ([Atri Sharma](https://github.com/ClickHouse/ClickHouse/pull/2325)). -- Added chown for config directories in the systemd config file ([Mikhail Shiryaev](https://github.com/ClickHouse/ClickHouse/pull/2421)). - -#### Build changes: {#build-changes-4} - -- The gcc8 compiler can be used for builds. -- Added the ability to build llvm from submodule. -- The version of the librdkafka library has been updated to v0.11.4. -- Added the ability to use the system libcpuid library. The library version has been updated to 0.4.0. -- Fixed the build using the vectorclass library ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). -- Cmake now generates files for ninja by default (like when using `-G Ninja`). -- Added the ability to use the libtinfo library instead of libtermcap ([Georgy Kondratiev](https://github.com/ClickHouse/ClickHouse/pull/2519)). -- Fixed a header file conflict in Fedora Rawhide ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). - -#### Backward incompatible changes: {#backward-incompatible-changes-7} - -- Removed escaping in `Vertical` and `Pretty*` formats and deleted the `VerticalRaw` format. -- If servers with version 1.1.54388 (or newer) and servers with an older version are used simultaneously in a distributed query and the query has the `cast(x, 'Type')` expression without the `AS` keyword and doesn’t have the word `cast` in uppercase, an exception will be thrown with a message like `Not found column cast(0, 'UInt8') in block`. Solution: Update the server on the entire cluster. - -### ClickHouse release 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} - -#### Bug fixes: {#bug-fixes-21} - -- Fixed an error that in some cases caused ZooKeeper operations to block. - -### ClickHouse release 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} - -#### Bug fixes: {#bug-fixes-22} - -- Fixed a slowdown of replication queue if a table has many replicas. - -### ClickHouse release 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} - -#### Bug fixes: {#bug-fixes-23} - -- Fixed a nodes leak in ZooKeeper when ClickHouse loses connection to ZooKeeper server. - -### ClickHouse release 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} - -#### New features: {#new-features-13} - -- Added the table function `file(path, format, structure)`. An example reading bytes from `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. - -#### Improvements: {#improvements-12} - -- Subqueries can be wrapped in `()` brackets to enhance query readability. For example: `(SELECT 1) UNION ALL (SELECT 1)`. -- Simple `SELECT` queries from the `system.processes` table are not included in the `max_concurrent_queries` limit. - -#### Bug fixes: {#bug-fixes-24} - -- Fixed incorrect behavior of the `IN` operator when select from `MATERIALIZED VIEW`. -- Fixed incorrect filtering by partition index in expressions like `partition_key_column IN (...)`. -- Fixed inability to execute `OPTIMIZE` query on non-leader replica if `REANAME` was performed on the table. -- Fixed the authorization error when executing `OPTIMIZE` or `ALTER` queries on a non-leader replica. -- Fixed freezing of `KILL QUERY`. -- Fixed an error in ZooKeeper client library which led to loss of watches, freezing of distributed DDL queue, and slowdowns in the replication queue if a non-empty `chroot` prefix is used in the ZooKeeper configuration. - -#### Backward incompatible changes: {#backward-incompatible-changes-8} - -- Removed support for expressions like `(a, b) IN (SELECT (a, b))` (you can use the equivalent expression `(a, b) IN (SELECT a, b)`). In previous releases, these expressions led to undetermined `WHERE` filtering or caused errors. - -### ClickHouse release 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} - -#### New features: {#new-features-14} - -- Logging level can be changed without restarting the server. -- Added the `SHOW CREATE DATABASE` query. -- The `query_id` can be passed to `clickhouse-client` (elBroom). -- New setting: `max_network_bandwidth_for_all_users`. -- Added support for `ALTER TABLE ... PARTITION ...` for `MATERIALIZED VIEW`. -- Added information about the size of data parts in uncompressed form in the system table. -- Server-to-server encryption support for distributed tables (`1` in the replica config in ``). -- Configuration of the table level for the `ReplicatedMergeTree` family in order to minimize the amount of data stored in Zookeeper: : `use_minimalistic_checksums_in_zookeeper = 1` -- Configuration of the `clickhouse-client` prompt. By default, server names are now output to the prompt. The server’s display name can be changed. It’s also sent in the `X-ClickHouse-Display-Name` HTTP header (Kirill Shvakov). -- Multiple comma-separated `topics` can be specified for the `Kafka` engine (Tobias Adamson) -- When a query is stopped by `KILL QUERY` or `replace_running_query`, the client receives the `Query was canceled` exception instead of an incomplete result. - -#### Improvements: {#improvements-13} - -- `ALTER TABLE ... DROP/DETACH PARTITION` queries are run at the front of the replication queue. -- `SELECT ... FINAL` and `OPTIMIZE ... FINAL` can be used even when the table has a single data part. -- A `query_log` table is recreated on the fly if it was deleted manually (Kirill Shvakov). -- The `lengthUTF8` function runs faster (zhang2014). -- Improved performance of synchronous inserts in `Distributed` tables (`insert_distributed_sync = 1`) when there is a very large number of shards. -- The server accepts the `send_timeout` and `receive_timeout` settings from the client and applies them when connecting to the client (they are applied in reverse order: the server socket’s `send_timeout` is set to the `receive_timeout` value received from the client, and vice versa). -- More robust crash recovery for asynchronous insertion into `Distributed` tables. -- The return type of the `countEqual` function changed from `UInt32` to `UInt64` (谢磊). - -#### Bug fixes: {#bug-fixes-25} - -- Fixed an error with `IN` when the left side of the expression is `Nullable`. -- Correct results are now returned when using tuples with `IN` when some of the tuple components are in the table index. -- The `max_execution_time` limit now works correctly with distributed queries. -- Fixed errors when calculating the size of composite columns in the `system.columns` table. -- Fixed an error when creating a temporary table `CREATE TEMPORARY TABLE IF NOT EXISTS.` -- Fixed errors in `StorageKafka` (\#\#2075) -- Fixed server crashes from invalid arguments of certain aggregate functions. -- Fixed the error that prevented the `DETACH DATABASE` query from stopping background tasks for `ReplicatedMergeTree` tables. -- `Too many parts` state is less likely to happen when inserting into aggregated materialized views (\#\#2084). -- Corrected recursive handling of substitutions in the config if a substitution must be followed by another substitution on the same level. -- Corrected the syntax in the metadata file when creating a `VIEW` that uses a query with `UNION ALL`. -- `SummingMergeTree` now works correctly for summation of nested data structures with a composite key. -- Fixed the possibility of a race condition when choosing the leader for `ReplicatedMergeTree` tables. - -#### Build changes: {#build-changes-5} - -- The build supports `ninja` instead of `make` and uses `ninja` by default for building releases. -- Renamed packages: `clickhouse-server-base` in `clickhouse-common-static`; `clickhouse-server-common` in `clickhouse-server`; `clickhouse-common-dbg` in `clickhouse-common-static-dbg`. To install, use `clickhouse-server clickhouse-client`. Packages with the old names will still load in the repositories for backward compatibility. - -#### Backward incompatible changes: {#backward-incompatible-changes-9} - -- Removed the special interpretation of an IN expression if an array is specified on the left side. Previously, the expression `arr IN (set)` was interpreted as “at least one `arr` element belongs to the `set`”. To get the same behavior in the new version, write `arrayExists(x -> x IN (set), arr)`. -- Disabled the incorrect use of the socket option `SO_REUSEPORT`, which was incorrectly enabled by default in the Poco library. Note that on Linux there is no longer any reason to simultaneously specify the addresses `::` and `0.0.0.0` for listen – use just `::`, which allows listening to the connection both over IPv4 and IPv6 (with the default kernel config settings). You can also revert to the behavior from previous versions by specifying `1` in the config. - -### ClickHouse release 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} - -#### New features: {#new-features-15} - -- Added the `system.macros` table and auto updating of macros when the config file is changed. -- Added the `SYSTEM RELOAD CONFIG` query. -- Added the `maxIntersections(left_col, right_col)` aggregate function, which returns the maximum number of simultaneously intersecting intervals `[left; right]`. The `maxIntersectionsPosition(left, right)` function returns the beginning of the “maximum” interval. ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). - -#### Improvements: {#improvements-14} - -- When inserting data in a `Replicated` table, fewer requests are made to `ZooKeeper` (and most of the user-level errors have disappeared from the `ZooKeeper` log). -- Added the ability to create aliases for data sets. Example: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. - -#### Bug fixes: {#bug-fixes-26} - -- Fixed the `Illegal PREWHERE` error when reading from Merge tables for `Distributed`tables. -- Added fixes that allow you to start clickhouse-server in IPv4-only Docker containers. -- Fixed a race condition when reading from system `system.parts_columns tables.` -- Removed double buffering during a synchronous insert to a `Distributed` table, which could have caused the connection to timeout. -- Fixed a bug that caused excessively long waits for an unavailable replica before beginning a `SELECT` query. -- Fixed incorrect dates in the `system.parts` table. -- Fixed a bug that made it impossible to insert data in a `Replicated` table if `chroot` was non-empty in the configuration of the `ZooKeeper` cluster. -- Fixed the vertical merging algorithm for an empty `ORDER BY` table. -- Restored the ability to use dictionaries in queries to remote tables, even if these dictionaries are not present on the requestor server. This functionality was lost in release 1.1.54362. -- Restored the behavior for queries like `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` when the right side of the `IN` should use a remote `default.table` instead of a local one. This behavior was broken in version 1.1.54358. -- Removed extraneous error-level logging of `Not found column ... in block`. - -### ClickHouse Release 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} - -#### New features: {#new-features-16} - -- Aggregation without `GROUP BY` for an empty set (such as `SELECT count(*) FROM table WHERE 0`) now returns a result with one row with null values for aggregate functions, in compliance with the SQL standard. To restore the old behavior (return an empty result), set `empty_result_for_aggregation_by_empty_set` to 1. -- Added type conversion for `UNION ALL`. Different alias names are allowed in `SELECT` positions in `UNION ALL`, in compliance with the SQL standard. -- Arbitrary expressions are supported in `LIMIT BY` clauses. Previously, it was only possible to use columns resulting from `SELECT`. -- An index of `MergeTree` tables is used when `IN` is applied to a tuple of expressions from the columns of the primary key. Example: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). -- Added the `clickhouse-copier` tool for copying between clusters and resharding data (beta). -- Added consistent hashing functions: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. They can be used as a sharding key in order to reduce the amount of network traffic during subsequent reshardings. -- Added functions: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. -- Added the `arrayCumSum` function (Javi Santana). -- Added the `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, and `parseDateTimeBestEffortOrNull` functions to read the DateTime from a string containing text in a wide variety of possible formats. -- Data can be partially reloaded from external dictionaries during updating (load just the records in which the value of the specified field greater than in the previous download) (Arsen Hakobyan). -- Added the `cluster` table function. Example: `cluster(cluster_name, db, table)`. The `remote` table function can accept the cluster name as the first argument, if it is specified as an identifier. -- The `remote` and `cluster` table functions can be used in `INSERT` queries. -- Added the `create_table_query` and `engine_full` virtual columns to the `system.tables`table . The `metadata_modification_time` column is virtual. -- Added the `data_path` and `metadata_path` columns to `system.tables`and`system.databases` tables, and added the `path` column to the `system.parts` and `system.parts_columns` tables. -- Added additional information about merges in the `system.part_log` table. -- An arbitrary partitioning key can be used for the `system.query_log` table (Kirill Shvakov). -- The `SHOW TABLES` query now also shows temporary tables. Added temporary tables and the `is_temporary` column to `system.tables` (zhang2014). -- Added `DROP TEMPORARY TABLE` and `EXISTS TEMPORARY TABLE` queries (zhang2014). -- Support for `SHOW CREATE TABLE` for temporary tables (zhang2014). -- Added the `system_profile` configuration parameter for the settings used by internal processes. -- Support for loading `object_id` as an attribute in `MongoDB` dictionaries (Pavel Litvinenko). -- Reading `null` as the default value when loading data for an external dictionary with the `MongoDB` source (Pavel Litvinenko). -- Reading `DateTime` values in the `Values` format from a Unix timestamp without single quotes. -- Failover is supported in `remote` table functions for cases when some of the replicas are missing the requested table. -- Configuration settings can be overridden in the command line when you run `clickhouse-server`. Example: `clickhouse-server -- --logger.level=information`. -- Implemented the `empty` function from a `FixedString` argument: the function returns 1 if the string consists entirely of null bytes (zhang2014). -- Added the `listen_try`configuration parameter for listening to at least one of the listen addresses without quitting, if some of the addresses can’t be listened to (useful for systems with disabled support for IPv4 or IPv6). -- Added the `VersionedCollapsingMergeTree` table engine. -- Support for rows and arbitrary numeric types for the `library` dictionary source. -- `MergeTree` tables can be used without a primary key (you need to specify `ORDER BY tuple()`). -- A `Nullable` type can be `CAST` to a non-`Nullable` type if the argument is not `NULL`. -- `RENAME TABLE` can be performed for `VIEW`. -- Added the `throwIf` function. -- Added the `odbc_default_field_size` option, which allows you to extend the maximum size of the value loaded from an ODBC source (by default, it is 1024). -- The `system.processes` table and `SHOW PROCESSLIST` now have the `is_cancelled` and `peak_memory_usage` columns. - -#### Improvements: {#improvements-15} - -- Limits and quotas on the result are no longer applied to intermediate data for `INSERT SELECT` queries or for `SELECT` subqueries. -- Fewer false triggers of `force_restore_data` when checking the status of `Replicated` tables when the server starts. -- Added the `allow_distributed_ddl` option. -- Nondeterministic functions are not allowed in expressions for `MergeTree` table keys. -- Files with substitutions from `config.d` directories are loaded in alphabetical order. -- Improved performance of the `arrayElement` function in the case of a constant multidimensional array with an empty array as one of the elements. Example: `[[1], []][x]`. -- The server starts faster now when using configuration files with very large substitutions (for instance, very large lists of IP networks). -- When running a query, table valued functions run once. Previously, `remote` and `mysql` table valued functions performed the same query twice to retrieve the table structure from a remote server. -- The `MkDocs` documentation generator is used. -- When you try to delete a table column that `DEFAULT`/`MATERIALIZED` expressions of other columns depend on, an exception is thrown (zhang2014). -- Added the ability to parse an empty line in text formats as the number 0 for `Float` data types. This feature was previously available but was lost in release 1.1.54342. -- `Enum` values can be used in `min`, `max`, `sum` and some other functions. In these cases, it uses the corresponding numeric values. This feature was previously available but was lost in the release 1.1.54337. -- Added `max_expanded_ast_elements` to restrict the size of the AST after recursively expanding aliases. - -#### Bug fixes: {#bug-fixes-27} - -- Fixed cases when unnecessary columns were removed from subqueries in error, or not removed from subqueries containing `UNION ALL`. -- Fixed a bug in merges for `ReplacingMergeTree` tables. -- Fixed synchronous insertions in `Distributed` tables (`insert_distributed_sync = 1`). -- Fixed segfault for certain uses of `FULL` and `RIGHT JOIN` with duplicate columns in subqueries. -- Fixed segfault for certain uses of `replace_running_query` and `KILL QUERY`. -- Fixed the order of the `source` and `last_exception` columns in the `system.dictionaries` table. -- Fixed a bug when the `DROP DATABASE` query did not delete the file with metadata. -- Fixed the `DROP DATABASE` query for `Dictionary` databases. -- Fixed the low precision of `uniqHLL12` and `uniqCombined` functions for cardinalities greater than 100 million items (Alex Bocharov). -- Fixed the calculation of implicit default values when necessary to simultaneously calculate default explicit expressions in `INSERT` queries (zhang2014). -- Fixed a rare case when a query to a `MergeTree` table couldn’t finish (chenxing-xc). -- Fixed a crash that occurred when running a `CHECK` query for `Distributed` tables if all shards are local (chenxing.xc). -- Fixed a slight performance regression with functions that use regular expressions. -- Fixed a performance regression when creating multidimensional arrays from complex expressions. -- Fixed a bug that could cause an extra `FORMAT` section to appear in an `.sql` file with metadata. -- Fixed a bug that caused the `max_table_size_to_drop` limit to apply when trying to delete a `MATERIALIZED VIEW` looking at an explicitly specified table. -- Fixed incompatibility with old clients (old clients were sometimes sent data with the `DateTime('timezone')` type, which they do not understand). -- Fixed a bug when reading `Nested` column elements of structures that were added using `ALTER` but that are empty for the old partitions, when the conditions for these columns moved to `PREWHERE`. -- Fixed a bug when filtering tables by virtual `_table` columns in queries to `Merge` tables. -- Fixed a bug when using `ALIAS` columns in `Distributed` tables. -- Fixed a bug that made dynamic compilation impossible for queries with aggregate functions from the `quantile` family. -- Fixed a race condition in the query execution pipeline that occurred in very rare cases when using `Merge` tables with a large number of tables, and when using `GLOBAL` subqueries. -- Fixed a crash when passing arrays of different sizes to an `arrayReduce` function when using aggregate functions from multiple arguments. -- Prohibited the use of queries with `UNION ALL` in a `MATERIALIZED VIEW`. -- Fixed an error during initialization of the `part_log` system table when the server starts (by default, `part_log` is disabled). - -#### Backward incompatible changes: {#backward-incompatible-changes-10} - -- Removed the `distributed_ddl_allow_replicated_alter` option. This behavior is enabled by default. -- Removed the `strict_insert_defaults` setting. If you were using this functionality, write to `clickhouse-feedback@yandex-team.com`. -- Removed the `UnsortedMergeTree` engine. - -### ClickHouse Release 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} - -- Added macros support for defining cluster names in distributed DDL queries and constructors of Distributed tables: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. -- Now queries like `SELECT ... FROM table WHERE expr IN (subquery)` are processed using the `table` index. -- Improved processing of duplicates when inserting to Replicated tables, so they no longer slow down execution of the replication queue. - -### ClickHouse Release 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} - -This release contains bug fixes for the previous release 1.1.54337: - -- Fixed a regression in 1.1.54337: if the default user has readonly access, then the server refuses to start up with the message `Cannot create database in readonly mode`. -- Fixed a regression in 1.1.54337: on systems with systemd, logs are always written to syslog regardless of the configuration; the watchdog script still uses init.d. -- Fixed a regression in 1.1.54337: wrong default configuration in the Docker image. -- Fixed nondeterministic behavior of GraphiteMergeTree (you can see it in log messages `Data after merge is not byte-identical to the data on another replicas`). -- Fixed a bug that may lead to inconsistent merges after OPTIMIZE query to Replicated tables (you may see it in log messages `Part ... intersects the previous part`). -- Buffer tables now work correctly when MATERIALIZED columns are present in the destination table (by zhang2014). -- Fixed a bug in implementation of NULL. - -### ClickHouse Release 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} - -#### New features: {#new-features-17} - -- Added support for storage of multi-dimensional arrays and tuples (`Tuple` data type) in tables. -- Support for table functions for `DESCRIBE` and `INSERT` queries. Added support for subqueries in `DESCRIBE`. Examples: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. Support for `INSERT INTO TABLE` in addition to `INSERT INTO`. -- Improved support for time zones. The `DateTime` data type can be annotated with the timezone that is used for parsing and formatting in text formats. Example: `DateTime('Europe/Moscow')`. When timezones are specified in functions for `DateTime` arguments, the return type will track the timezone, and the value will be displayed as expected. -- Added the functions `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. The `toRelativeHour`/`Minute`/`Second` functions can take a value of type `Date` as an argument. The `now` function name is case-sensitive. -- Added the `toStartOfFifteenMinutes` function (Kirill Shvakov). -- Added the `clickhouse format` tool for formatting queries. -- Added the `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` format. Schema files can be located only in the specified directory. -- Added support for config substitutions (`incl` and `conf.d`) for configuration of external dictionaries and models (Pavel Yakunin). -- Added a column with documentation for the `system.settings` table (Kirill Shvakov). -- Added the `system.parts_columns` table with information about column sizes in each data part of `MergeTree` tables. -- Added the `system.models` table with information about loaded `CatBoost` machine learning models. -- Added the `mysql` and `odbc` table function and corresponding `MySQL` and `ODBC` table engines for accessing remote databases. This functionality is in the beta stage. -- Added the possibility to pass an argument of type `AggregateFunction` for the `groupArray` aggregate function (so you can create an array of states of some aggregate function). -- Removed restrictions on various combinations of aggregate function combinators. For example, you can use `avgForEachIf` as well as `avgIfForEach` aggregate functions, which have different behaviors. -- The `-ForEach` aggregate function combinator is extended for the case of aggregate functions of multiple arguments. -- Added support for aggregate functions of `Nullable` arguments even for cases when the function returns a non-`Nullable` result (added with the contribution of Silviu Caragea). Example: `groupArray`, `groupUniqArray`, `topK`. -- Added the `max_client_network_bandwidth` for `clickhouse-client` (Kirill Shvakov). -- Users with the `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). -- Added support for using multiple consumers with the `Kafka` engine. Extended configuration options for `Kafka` (Marek Vavruša). -- Added the `intExp3` and `intExp4` functions. -- Added the `sumKahan` aggregate function. -- Added the to \* Number\* OrNull functions, where \* Number\* is a numeric type. -- Added support for `WITH` clauses for an `INSERT SELECT` query (author: zhang2014). -- Added settings: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. In particular, these settings are used for downloading data parts for replication. Changing these settings allows for faster failover if the network is overloaded. -- Added support for `ALTER` for tables of type `Null` (Anastasiya Tsarkova). -- The `reinterpretAsString` function is extended for all data types that are stored contiguously in memory. -- Added the `--silent` option for the `clickhouse-local` tool. It suppresses printing query execution info in stderr. -- Added support for reading values of type `Date` from text in a format where the month and/or day of the month is specified using a single digit instead of two digits (Amos Bird). - -#### Performance optimizations: {#performance-optimizations} - -- Improved performance of aggregate functions `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` from string arguments. -- Improved performance of the functions `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. -- Improved performance of parsing and formatting `Date` and `DateTime` type values in text format. -- Improved performance and precision of parsing floating point numbers. -- Lowered memory usage for `JOIN` in the case when the left and right parts have columns with identical names that are not contained in `USING` . -- Improved performance of aggregate functions `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` by reducing computational stability. The old functions are available under the names `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. - -#### Bug fixes: {#bug-fixes-28} - -- Fixed data deduplication after running a `DROP` or `DETACH PARTITION` query. In the previous version, dropping a partition and inserting the same data again was not working because inserted blocks were considered duplicates. -- Fixed a bug that could lead to incorrect interpretation of the `WHERE` clause for `CREATE MATERIALIZED VIEW` queries with `POPULATE` . -- Fixed a bug in using the `root_path` parameter in the `zookeeper_servers` configuration. -- Fixed unexpected results of passing the `Date` argument to `toStartOfDay` . -- Fixed the `addMonths` and `subtractMonths` functions and the arithmetic for `INTERVAL n MONTH` in cases when the result has the previous year. -- Added missing support for the `UUID` data type for `DISTINCT` , `JOIN` , and `uniq` aggregate functions and external dictionaries (Evgeniy Ivanov). Support for `UUID` is still incomplete. -- Fixed `SummingMergeTree` behavior in cases when the rows summed to zero. -- Various fixes for the `Kafka` engine (Marek Vavruša). -- Fixed incorrect behavior of the `Join` table engine (Amos Bird). -- Fixed incorrect allocator behavior under FreeBSD and OS X. -- The `extractAll` function now supports empty matches. -- Fixed an error that blocked usage of `libressl` instead of `openssl` . -- Fixed the `CREATE TABLE AS SELECT` query from temporary tables. -- Fixed non-atomicity of updating the replication queue. This could lead to replicas being out of sync until the server restarts. -- Fixed possible overflow in `gcd` , `lcm` and `modulo` (`%` operator) (Maks Skorokhod). -- `-preprocessed` files are now created after changing `umask` (`umask` can be changed in the config). -- Fixed a bug in the background check of parts (`MergeTreePartChecker` ) when using a custom partition key. -- Fixed parsing of tuples (values of the `Tuple` data type) in text formats. -- Improved error messages about incompatible types passed to `multiIf` , `array` and some other functions. -- Redesigned support for `Nullable` types. Fixed bugs that may lead to a server crash. Fixed almost all other bugs related to `NULL` support: incorrect type conversions in INSERT SELECT, insufficient support for Nullable in HAVING and PREWHERE, `join_use_nulls` mode, Nullable types as arguments of `OR` operator, etc. -- Fixed various bugs related to internal semantics of data types. Examples: unnecessary summing of `Enum` type fields in `SummingMergeTree` ; alignment of `Enum` types in `Pretty` formats, etc. -- Stricter checks for allowed combinations of composite columns. -- Fixed the overflow when specifying a very large parameter for the `FixedString` data type. -- Fixed a bug in the `topK` aggregate function in a generic case. -- Added the missing check for equality of array sizes in arguments of n-ary variants of aggregate functions with an `-Array` combinator. -- Fixed a bug in `--pager` for `clickhouse-client` (author: ks1322). -- Fixed the precision of the `exp10` function. -- Fixed the behavior of the `visitParamExtract` function for better compliance with documentation. -- Fixed the crash when incorrect data types are specified. -- Fixed the behavior of `DISTINCT` in the case when all columns are constants. -- Fixed query formatting in the case of using the `tupleElement` function with a complex constant expression as the tuple element index. -- Fixed a bug in `Dictionary` tables for `range_hashed` dictionaries. -- Fixed a bug that leads to excessive rows in the result of `FULL` and `RIGHT JOIN` (Amos Bird). -- Fixed a server crash when creating and removing temporary files in `config.d` directories during config reload. -- Fixed the `SYSTEM DROP DNS CACHE` query: the cache was flushed but addresses of cluster nodes were not updated. -- Fixed the behavior of `MATERIALIZED VIEW` after executing `DETACH TABLE` for the table under the view (Marek Vavruša). - -#### Build improvements: {#build-improvements-4} - -- The `pbuilder` tool is used for builds. The build process is almost completely independent of the build host environment. -- A single build is used for different OS versions. Packages and binaries have been made compatible with a wide range of Linux systems. -- Added the `clickhouse-test` package. It can be used to run functional tests. -- The source tarball can now be published to the repository. It can be used to reproduce the build without using GitHub. -- Added limited integration with Travis CI. Due to limits on build time in Travis, only the debug build is tested and a limited subset of tests are run. -- Added support for `Cap'n'Proto` in the default build. -- Changed the format of documentation sources from `Restricted Text` to `Markdown`. -- Added support for `systemd` (Vladimir Smirnov). It is disabled by default due to incompatibility with some OS images and can be enabled manually. -- For dynamic code generation, `clang` and `lld` are embedded into the `clickhouse` binary. They can also be invoked as `clickhouse clang` and `clickhouse lld` . -- Removed usage of GNU extensions from the code. Enabled the `-Wextra` option. When building with `clang` the default is `libc++` instead of `libstdc++`. -- Extracted `clickhouse_parsers` and `clickhouse_common_io` libraries to speed up builds of various tools. - -#### Backward incompatible changes: {#backward-incompatible-changes-11} - -- The format for marks in `Log` type tables that contain `Nullable` columns was changed in a backward incompatible way. If you have these tables, you should convert them to the `TinyLog` type before starting up the new server version. To do this, replace `ENGINE = Log` with `ENGINE = TinyLog` in the corresponding `.sql` file in the `metadata` directory. If your table doesn’t have `Nullable` columns or if the type of your table is not `Log`, then you don’t need to do anything. -- Removed the `experimental_allow_extended_storage_definition_syntax` setting. Now this feature is enabled by default. -- The `runningIncome` function was renamed to `runningDifferenceStartingWithFirstvalue` to avoid confusion. -- Removed the `FROM ARRAY JOIN arr` syntax when ARRAY JOIN is specified directly after FROM with no table (Amos Bird). -- Removed the `BlockTabSeparated` format that was used solely for demonstration purposes. -- Changed the state format for aggregate functions `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. If you have stored states of these aggregate functions in tables (using the `AggregateFunction` data type or materialized views with corresponding states), please write to clickhouse-feedback@yandex-team.com. -- In previous server versions there was an undocumented feature: if an aggregate function depends on parameters, you can still specify it without parameters in the AggregateFunction data type. Example: `AggregateFunction(quantiles, UInt64)` instead of `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. This feature was lost. Although it was undocumented, we plan to support it again in future releases. -- Enum data types cannot be used in min/max aggregate functions. This ability will be returned in the next release. - -#### Please note when upgrading: {#please-note-when-upgrading} - -- When doing a rolling update on a cluster, at the point when some of the replicas are running the old version of ClickHouse and some are running the new version, replication is temporarily stopped and the message `unknown parameter 'shard'` appears in the log. Replication will continue after all replicas of the cluster are updated. -- If different versions of ClickHouse are running on the cluster servers, it is possible that distributed queries using the following functions will have incorrect results: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. You should update all cluster nodes. - -## [Changelog for 2017](./2017.md) diff --git a/docs/en/whats_new/changelog/2019.md b/docs/en/whats_new/changelog/2019.md deleted file mode 100644 index b510c68ba87..00000000000 --- a/docs/en/whats_new/changelog/2019.md +++ /dev/null @@ -1,2072 +0,0 @@ ---- -toc_priority: 77 -toc_title: '2019' ---- - -## ClickHouse release v19.17 {#clickhouse-release-v19-17} - -### ClickHouse release v19.17.6.36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} - -#### Bug Fix {#bug-fix} - -- Fixed potential buffer overflow in decompress. Malicious user can pass fabricated compressed data that could cause read after buffer. This issue was found by Eldar Zaitov from Yandex information security team. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed possible server crash (`std::terminate`) when the server cannot send or write data in JSON or XML format with values of String data type (that require UTF-8 validation) or when compressing result data with Brotli algorithm or in some other rare cases. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed dictionaries with source from a clickhouse `VIEW`, now reading such dictionaries doesn’t cause the error `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixed checking if a client host is allowed by host\_regexp specified in users.xml. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- `RENAME TABLE` for a distributed table now renames the folder containing inserted data before sending to shards. This fixes an issue with successive renames `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- `range_hashed` external dictionaries created by DDL queries now allow ranges of arbitrary numeric types. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -- Fixed `INSERT INTO table SELECT ... FROM mysql(...)` table function. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- Fixed segfault in `INSERT INTO TABLE FUNCTION file()` while inserting into a file which doesn’t exist. Now in this case file would be created and then insert would be processed. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fixed bitmapAnd error when intersecting an aggregated bitmap and a scalar bitmap. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -- Fixed segfault when `EXISTS` query was used without `TABLE` or `DICTIONARY` qualifier, just like `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed return type for functions `rand` and `randConstant` in case of nullable argument. Now functions always return `UInt32` and never `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixed `DROP DICTIONARY IF EXISTS db.dict`, now it doesn’t throw exception if `db` doesn’t exist. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- If a table wasn’t completely dropped because of server crash, the server will try to restore and load it [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- Fixed a trivial count query for a distributed table if there are more than two shard local table. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- Fixed bug that lead to a data race in DB::BlockStreamProfileInfo::calculateRowsBeforeLimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -- Fixed `ALTER table MOVE part` executed immediately after merging the specified part, which could cause moving a part which the specified part merged into. Now it correctly moves the specified part. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Expressions for dictionaries can be specified as strings now. This is useful for calculation of attributes while extracting data from non-ClickHouse sources because it allows to use non-ClickHouse syntax for those expressions. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -- Fixed a very rare race in `clickhouse-copier` because of an overflow in ZXid. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- Fixed the bug when after the query failed (due to “Too many simultaneous queries” for example) it would not read external tables info, and the - next request would interpret this info as the beginning of the next query causing an error like `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- Avoid null dereference after “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- Restore support of all ICU locales, add the ability to apply collations for constant expressions and add language name to system.collations table. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -- Number of streams for read from `StorageFile` and `StorageHDFS` is now limited, to avoid exceeding the memory limit. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -- Fixed `CHECK TABLE` query for `*MergeTree` tables without key. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -- Removed the mutation number from a part name in case there were no mutations. This removing improved the compatibility with older versions. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -- Fixed the bug that mutations are skipped for some attached parts due to their data\_version are larger than the table mutation version. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) -- Allow starting the server with redundant copies of parts after moving them to another device. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixed the error “Sizes of columns doesn’t match” that might appear when using aggregate function columns. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- Now an exception will be thrown in case of using WITH TIES alongside LIMIT BY. And now it’s possible to use TOP with LIMIT BY. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Fix dictionary reload if it has `invalidate_query`, which stopped updates and some exception on previous update tries. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) - -### ClickHouse release v19.17.4.11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} - -#### Backward Incompatible Change {#backward-incompatible-change} - -- Using column instead of AST to store scalar subquery results for better performance. Setting `enable_scalar_subquery_optimization` was added in 19.17 and it was enabled by default. It leads to errors like [this](https://github.com/ClickHouse/ClickHouse/issues/7851) during upgrade to 19.17.2 or 19.17.3 from previous versions. This setting was disabled by default in 19.17.4, to make possible upgrading from 19.16 and older versions without errors. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos Bird](https://github.com/amosbird)) - -#### New Feature {#new-feature} - -- Add the ability to create dictionaries with DDL queries. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) -- Make `bloom_filter` type of index supporting `LowCardinality` and `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Add function `isValidJSON` to check that passed string is a valid json. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) -- Implement `arrayCompact` function [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Memo](https://github.com/Joeywzr)) -- Created function `hex` for Decimal numbers. It works like `hex(reinterpretAsString())`, but doesn’t delete last zero bytes. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) -- Add `arrayFill` and `arrayReverseFill` functions, which replace elements by other elements in front/back of them in the array. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) -- Add `CRC32IEEE()`/`CRC64()` support [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) -- Implement `char` function similar to one in [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) -- Add `bitmapTransform` function. It transforms an array of values in a bitmap to another array of values, the result is a new bitmap [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) -- Implemented `javaHashUTF16LE()` function [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) -- Add `_shard_num` virtual column for the Distributed engine [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) - -#### Experimental Feature {#experimental-feature} - -- Support for processors (new query execution pipeline) in `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Bug Fix {#bug-fix-1} - -- Fix incorrect float parsing in `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- Fix rare deadlock which can happen when trace\_log is enabled. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- Prevent message duplication when producing Kafka table has any MVs selecting from it [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) -- Support for `Array(LowCardinality(Nullable(String)))` in `IN`. Resolves [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) -- Add handling of `SQL_TINYINT` and `SQL_BIGINT`, and fix handling of `SQL_FLOAT` data source types in ODBC Bridge. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Fix aggregation (`avg` and quantiles) over empty decimal columns [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) -- Fix `INSERT` into Distributed with `MATERIALIZED` columns [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Make `MOVE PARTITION` work if some parts of partition are already on destination disk or volume [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixed bug with hardlinks failing to be created during mutations in `ReplicatedMergeTree` in multi-disk configurations. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixed a bug with a mutation on a MergeTree when whole part remains unchanged and best space is being found on another disk [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixed bug with `keep_free_space_ratio` not being read from disks configuration [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fix bug with table contains only `Tuple` columns or columns with complex paths. Fixes [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) -- Do not account memory for Buffer engine in max\_memory\_usage limit [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) -- Fix final mark usage in `MergeTree` tables ordered by `tuple()`. In rare cases it could lead to `Can't adjust last granule` error while select. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) -- Fix bug in mutations that have predicate with actions that require context (for example functions for json), which may lead to crashes or strange exceptions. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) -- Fix mismatch of database and table names escaping in `data/` and `shadow/` directories [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Fix crash in this case. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix `Not found column in block` when joining on expression with RIGHT or FULL JOIN. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) -- One more attempt to fix infinite loop in `PrettySpace` format [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fix bug in `concat` function when all arguments were `FixedString` of the same size. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) -- Fixed exception in case of using 1 argument while defining S3, URL and HDFS storages. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fix scope of the InterpreterSelectQuery for views with query [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) - -#### Improvement {#improvement} - -- `Nullable` columns recognized and NULL-values handled correctly by ODBC-bridge [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- Write current batch for distributed send atomically [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) -- Throw an exception if we cannot detect table for column name in query. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) -- Add `merge_max_block_size` setting to `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) -- Queries with `HAVING` and without `GROUP BY` assume group by constant. So, `SELECT 1 HAVING 1` now returns a result. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos Bird](https://github.com/amosbird)) -- Support parsing `(X,)` as tuple similar to python. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos Bird](https://github.com/amosbird)) -- Make `range` function behaviors almost like pythonic one. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) -- Add `constraints` columns to table `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) -- Better Null format for tcp handler, so that it’s possible to use `select ignore() from table format Null` for perf measure via clickhouse-client [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos Bird](https://github.com/amosbird)) -- Queries like `CREATE TABLE ... AS (SELECT (1, 2))` are parsed correctly [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) - -#### Performance Improvement {#performance-improvement} - -- The performance of aggregation over short string keys is improved. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [Amos Bird](https://github.com/amosbird)) -- Run another pass of syntax/expression analysis to get potential optimizations after constant predicates are folded. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos Bird](https://github.com/amosbird)) -- Use storage meta info to evaluate trivial `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos Bird](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) -- Vectorize processing `arrayReduce` similar to Aggregator `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Bird](https://github.com/amosbird)) -- Minor improvements in performance of `Kafka` consumption [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([Ivan](https://github.com/abyss7)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement} - -- Add support for cross-compiling to the CPU architecture AARCH64. Refactor packager script. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([Ivan](https://github.com/abyss7)) -- Unpack darwin-x86\_64 and linux-aarch64 toolchains into mounted Docker volume when building packages [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([Ivan](https://github.com/abyss7)) -- Update Docker Image for Binary Packager [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([Ivan](https://github.com/abyss7)) -- Fixed compile errors on MacOS Catalina [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) -- Some refactoring in query analysis logic: split complex class into several simple ones. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix build without submodules [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) -- Better `add_globs` in CMake files [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos Bird](https://github.com/amosbird)) -- Remove hardcoded paths in `unwind` target [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) -- Allow to use mysql format without ssl [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) - -#### Other {#other} - -- Added ANTLR4 grammar for ClickHouse SQL dialect [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouse release v19.16 {#clickhouse-release-v19-16} - -#### ClickHouse release v19.16.14.65, 2020-03-25 - -* Fixed up a bug in batched calculations of ternary logical OPs on multiple arguments (more than 10). [#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) This bugfix was backported to version 19.16 by a special request from Altinity. - -#### ClickHouse release v19.16.14.65, 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} - -- Fix distributed subqueries incompatibility with older CH versions. Fixes [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) - [(tabplubix)](https://github.com/tavplubix) -- When executing `CREATE` query, fold constant expressions in storage engine arguments. Replace empty database name with current database. Fixes [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Also fix check for local address in `ClickHouseDictionarySource`. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Now background merges in `*MergeTree` table engines family preserve storage policy volume order more accurately. - [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Prevent losing data in `Kafka` in rare cases when exception happens after reading suffix but before commit. Fixes [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Related: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -- Fix bug leading to server termination when trying to use / drop `Kafka` table created with wrong parameters. Fixes [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporates [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) -- Allow using `MaterializedView` with subqueries above `Kafka` tables. - [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) - -#### New Feature {#new-feature-1} - -- Add `deduplicate_blocks_in_dependent_materialized_views` option to control the behaviour of idempotent inserts into tables with materialized views. This new feature was added to the bugfix release by a special request from Altinity. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### ClickHouse release v19.16.2.2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} - -#### Backward Incompatible Change {#backward-incompatible-change-1} - -- Add missing arity validation for count/counIf. - [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) - [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) -- Remove legacy `asterisk_left_columns_only` setting (it was disabled by default). - [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem - Zuikov](https://github.com/4ertus2)) -- Format strings for Template data format are now specified in files. - [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) - -#### New Feature {#new-feature-2} - -- Introduce uniqCombined64() to calculate cardinality greater than UINT\_MAX. - [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), - [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat - Khuzhin](https://github.com/azat)) -- Support Bloom filter indexes on Array columns. - [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) - ([achimbab](https://github.com/achimbab)) -- Add a function `getMacro(name)` that returns String with the value of corresponding `` - from server configuration. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Set two configuration options for a dictionary based on an HTTP source: `credentials` and - `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- Add a new ProfileEvent `Merge` that counts the number of launched background merges. - [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mikhail - Korotov](https://github.com/millb)) -- Add fullHostName function that returns a fully qualified domain name. - [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) - [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) -- Add function `arraySplit` and `arrayReverseSplit` which split an array by “cut off” - conditions. They are useful in time sequence handling. - [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) -- Add new functions that return the Array of all matched indices in multiMatch family of functions. - [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila - Kutenin](https://github.com/danlark1)) -- Add a new database engine `Lazy` that is optimized for storing a large number of small -Log - tables. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nikita - Vasilev](https://github.com/nikvas0)) -- Add aggregate functions groupBitmapAnd, -Or, -Xor for bitmap columns. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang - Yu](https://github.com/yuzhichang)) -- Add aggregate function combinators -OrNull and -OrDefault, which return null - or default values when there is nothing to aggregate. - [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) - ([hcz](https://github.com/hczhcz)) -- Introduce CustomSeparated data format that supports custom escaping and - delimiter rules. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) -- Support Redis as source of external dictionary. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton - Popov](https://github.com/CurtizJ)) - -#### Bug Fix {#bug-fix-2} - -- Fix wrong query result if it has `WHERE IN (SELECT ...)` section and `optimize_read_in_order` is - used. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton - Popov](https://github.com/CurtizJ)) -- Disabled MariaDB authentication plugin, which depends on files outside of project. - [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Yuriy - Baranov](https://github.com/yurriy)) -- Fix exception `Cannot convert column ... because it is constant but values of constants are different in source and result` which could rarely happen when functions `now()`, `today()`, - `yesterday()`, `randConstant()` are used. - [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolai - Kochetov](https://github.com/KochetovNicolai)) -- Fixed issue of using HTTP keep alive timeout instead of TCP keep alive timeout. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily - Nemkov](https://github.com/Enmk)) -- Fixed a segmentation fault in groupBitmapOr (issue [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). - [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang - Yu](https://github.com/yuzhichang)) -- For materialized views the commit for Kafka is called after all data were written. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) -- Fixed wrong `duration_ms` value in `system.part_log` table. It was ten times off. - [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- A quick fix to resolve crash in LIVE VIEW table and re-enabling all LIVE VIEW tests. - [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Serialize NULL values correctly in min/max indexes of MergeTree parts. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Don’t put virtual columns to .sql metadata when table is created as `CREATE TABLE AS`. - [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([Ivan](https://github.com/abyss7)) -- Fix segmentation fault in `ATTACH PART` query. - [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) - ([alesapin](https://github.com/alesapin)) -- Fix wrong result for some queries given by the optimization of empty IN subqueries and empty - INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolai - Kochetov](https://github.com/KochetovNicolai)) -- Fixing AddressSanitizer error in the LIVE VIEW getHeader() method. - [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) - ([vzakaznikov](https://github.com/vzakaznikov)) - -#### Improvement {#improvement-1} - -- Add a message in case of queue\_wait\_max\_ms wait takes place. - [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat - Khuzhin](https://github.com/azat)) -- Made setting `s3_min_upload_part_size` table-level. - [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Check TTL in StorageFactory. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) - ([sundyli](https://github.com/sundy-li)) -- Squash left-hand blocks in partial merge join (optimization). - [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem - Zuikov](https://github.com/4ertus2)) -- Do not allow non-deterministic functions in mutations of Replicated table engines, because this - can introduce inconsistencies between replicas. - [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alexander - Kazakov](https://github.com/Akazz)) -- Disable memory tracker while converting exception stack trace to string. It can prevent the loss - of error messages of type `Memory limit exceeded` on server, which caused the `Attempt to read after eof` exception on client. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) - ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Miscellaneous format improvements. Resolves - [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), - [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), - [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), - [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) - [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) - ([tavplubix](https://github.com/tavplubix)) -- ClickHouse ignores values on the right side of IN operator that are not convertible to the left - side type. Make it work properly for compound types – Array and Tuple. - [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Support missing inequalities for ASOF JOIN. It’s possible to join less-or-equal variant and strict - greater and less variants for ASOF column in ON syntax. - [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem - Zuikov](https://github.com/4ertus2)) -- Optimize partial merge join. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) - ([Artem Zuikov](https://github.com/4ertus2)) -- Do not use more than 98K of memory in uniqCombined functions. - [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), - [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat - Khuzhin](https://github.com/azat)) -- Flush parts of right-hand joining table on disk in PartialMergeJoin (if there is not enough - memory). Load data back when needed. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) - ([Artem Zuikov](https://github.com/4ertus2)) - -#### Performance Improvement {#performance-improvement-1} - -- Speed up joinGet with const arguments by avoiding data duplication. - [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos - Bird](https://github.com/amosbird)) -- Return early if the subquery is empty. - [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) -- Optimize parsing of SQL expression in Values. - [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) - ([tavplubix](https://github.com/tavplubix)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-1} - -- Disable some contribs for cross-compilation to Mac OS. - [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([Ivan](https://github.com/abyss7)) -- Add missing linking with PocoXML for clickhouse\_common\_io. - [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat - Khuzhin](https://github.com/azat)) -- Accept multiple test filter arguments in clickhouse-test. - [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Enable musl and jemalloc for ARM. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) - ([Amos Bird](https://github.com/amosbird)) -- Added `--client-option` parameter to `clickhouse-test` to pass additional parameters to client. - [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolai - Kochetov](https://github.com/KochetovNicolai)) -- Preserve existing configs on rpm package upgrade. - [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) - ([filimonov](https://github.com/filimonov)) -- Fix errors detected by PVS. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem - Zuikov](https://github.com/4ertus2)) -- Fix build for Darwin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) - ([Ivan](https://github.com/abyss7)) -- glibc 2.29 compatibility. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos - Bird](https://github.com/amosbird)) -- Make sure dh\_clean does not touch potential source files. - [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos - Bird](https://github.com/amosbird)) -- Attempt to avoid conflict when updating from altinity rpm - it has config file packaged separately - in clickhouse-server-common. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) - ([filimonov](https://github.com/filimonov)) -- Optimize some header files for faster rebuilds. - [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), - [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Add performance tests for Date and DateTime. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vasily - Nemkov](https://github.com/Enmk)) -- Fix some tests that contained non-deterministic mutations. - [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alexander - Kazakov](https://github.com/Akazz)) -- Add build with MemorySanitizer to CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) - ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Avoid use of uninitialized values in MetricsTransmitter. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat - Khuzhin](https://github.com/azat)) -- Fix some issues in Fields found by MemorySanitizer. - [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), - [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alexander - Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) - ([Amos Bird](https://github.com/amosbird)) -- Fix undefined behavior in murmurhash32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos - Bird](https://github.com/amosbird)) -- Fix undefined behavior in StoragesInfoStream. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) - ([tavplubix](https://github.com/tavplubix)) -- Fixed constant expressions folding for external database engines (MySQL, ODBC, JDBC). In previous - versions it wasn’t working for multiple constant expressions and was not working at all for Date, - DateTime and UUID. This fixes [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixing ThreadSanitizer data race error in the LIVE VIEW when accessing no\_users\_thread variable. - [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Get rid of malloc symbols in libcommon - [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), - [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos - Bird](https://github.com/amosbird)) -- Add global flag ENABLE\_LIBRARIES for disabling all libraries. - [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) - ([proller](https://github.com/proller)) - -#### Code cleanup {#code-cleanup} - -- Generalize configuration repository to prepare for DDL for Dictionaries. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) - ([alesapin](https://github.com/alesapin)) -- Parser for dictionaries DDL without any semantic. - [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) - ([alesapin](https://github.com/alesapin)) -- Split ParserCreateQuery into different smaller parsers. - [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) - ([alesapin](https://github.com/alesapin)) -- Small refactoring and renaming near external dictionaries. - [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) - ([alesapin](https://github.com/alesapin)) -- Refactor some code to prepare for role-based access control. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly - Baranov](https://github.com/vitlibar)) -- Some improvements in DatabaseOrdinary code. - [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nikita - Vasilev](https://github.com/nikvas0)) -- Do not use iterators in find() and emplace() methods of hash tables. - [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Fix getMultipleValuesFromConfig in case when parameter root is not empty. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) - ([Mikhail Korotov](https://github.com/millb)) -- Remove some copy-paste (TemporaryFile and TemporaryFileStream) - [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem - Zuikov](https://github.com/4ertus2)) -- Improved code readability a little bit (`MergeTreeData::getActiveContainingPart`). - [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Wait for all scheduled jobs, which are using local objects, if `ThreadPool::schedule(...)` throws - an exception. Rename `ThreadPool::schedule(...)` to `ThreadPool::scheduleOrThrowOnError(...)` and - fix comments to make obvious that it may throw. - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) - ([tavplubix](https://github.com/tavplubix)) - -## ClickHouse release 19.15 {#clickhouse-release-19-15} - -### ClickHouse release 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} - -#### Bug Fix {#bug-fix-3} - -- Added handling of SQL\_TINYINT and SQL\_BIGINT, and fix handling of SQL\_FLOAT data source types in ODBC Bridge. - [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Allowed to have some parts on destination disk or volume in MOVE PARTITION. - [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixed NULL-values in nullable columns through ODBC-bridge. - [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- Fixed INSERT into Distributed non local node with MATERIALIZED columns. - [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Fixed function getMultipleValuesFromConfig. - [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) -- Fixed issue of using HTTP keep alive timeout instead of TCP keep alive timeout. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) -- Wait for all jobs to finish on exception (fixes rare segfaults). - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) -- Don’t push to MVs when inserting into Kafka table. - [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) -- Disable memory tracker for exception stack. - [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixed bad code in transforming query for external database. - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Avoid use of uninitialized values in MetricsTransmitter. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) -- Added example config with macros for tests ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} - -#### Bug Fix {#bug-fix-4} - -- Fixed bad\_variant in hashed dictionary. - ([alesapin](https://github.com/alesapin)) -- Fixed up bug with segmentation fault in ATTACH PART query. - ([alesapin](https://github.com/alesapin)) -- Fixed time calculation in `MergeTreeData`. - ([Vladimir Chebotarev](https://github.com/excitoon)) -- Commit to Kafka explicitly after the writing is finalized. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) -- Serialize NULL values correctly in min/max indexes of MergeTree parts. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -### ClickHouse release 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} - -#### New Feature {#new-feature-3} - -- Tiered storage: support to use multiple storage volumes for tables with MergeTree engine. It’s possible to store fresh data on SSD and automatically move old data to HDD. ([example](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) -- Add table function `input` for reading incoming data in `INSERT SELECT` query. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) -- Add a `sparse_hashed` dictionary layout, that is functionally equivalent to the `hashed` layout, but is more memory efficient. It uses about twice as less memory at the cost of slower value retrieval. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) -- Implement ability to define list of users for access to dictionaries. Only current connected database using. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Add `LIMIT` option to `SHOW` query. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- Add `bitmapSubsetLimit(bitmap, range_start, limit)` function, that returns subset of the smallest `limit` values in set that is no smaller than `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) -- Add `bitmapMin` and `bitmapMax` functions. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) -- Add function `repeat` related to [issue-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL)) - -#### Experimental Feature {#experimental-feature-1} - -- Implement (in memory) Merge Join variant that does not change current pipeline. Result is partially sorted by merge key. Set `partial_merge_join = 1` to use this feature. The Merge Join is still in development. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) -- Add `S3` engine and table function. It is still in development (no authentication support yet). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) - -#### Improvement {#improvement-2} - -- Every message read from Kafka is inserted atomically. This resolves almost all known issues with Kafka engine. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([Ivan](https://github.com/abyss7)) -- Improvements for failover of Distributed queries. Shorten recovery time, also it is now configurable and can be seen in `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) -- Support numeric values for Enums directly in `IN` section. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) -- Support (optional, disabled by default) redirects on URL storage. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) -- Add information message when client with an older version connects to a server. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- Remove maximum backoff sleep time limit for sending data in Distributed tables [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) -- Add ability to send profile events (counters) with cumulative values to graphite. It can be enabled under `` in server `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) -- Add automatically cast type `T` to `LowCardinality(T)` while inserting data in column of type `LowCardinality(T)` in Native format via HTTP. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Add ability to use function `hex` without using `reinterpretAsString` for `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-2} - -- Add gdb-index to clickhouse binary with debug info. It will speed up startup time of `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) -- Speed up deb packaging with patched dpkg-deb which uses `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) -- Set `enable_fuzzing = 1` to enable libfuzzer instrumentation of all the project code. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) -- Add split build smoke test in CI. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) -- Add build with MemorySanitizer to CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Replace `libsparsehash` with `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) - -#### Bug Fix {#bug-fix-5} - -- Fixed performance degradation of index analysis on complex keys on large tables. This fixes \#6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix logical error causing segfaults when selecting from Kafka empty topic. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) -- Fix too early MySQL connection close in `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Returned support for very old Linux kernels (fix [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix possible data loss in `insert select` query in case of empty block in input stream. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix for function `АrrayEnumerateUniqRanked` with empty arrays in params [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- Fix complex queries with array joins and global subqueries. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) -- Fix `Unknown identifier` error in ORDER BY and GROUP BY with multiple JOINs [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed `MSan` warning while executing function with `LowCardinality` argument. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Backward Incompatible Change {#backward-incompatible-change-2} - -- Changed serialization format of bitmap\* aggregate function states to improve performance. Serialized states of bitmap\* from previous versions cannot be read. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) - -## ClickHouse release 19.14 {#clickhouse-release-19-14} - -### ClickHouse release 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} - -#### Bug Fix {#bug-fix-6} - -- This release also contains all bug fixes from 19.11.12.69. -- Fixed compatibility for distributed queries between 19.14 and earlier versions. This fixes [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} - -#### Bug Fix {#bug-fix-7} - -- Fix for function `АrrayEnumerateUniqRanked` with empty arrays in params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- Fixed subquery name in queries with `ARRAY JOIN` and `GLOBAL IN subquery` with alias. Use subquery alias for external table name if it is specified. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-3} - -- Fix [flapping](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) test `00715_fetch_merged_or_mutated_part_zookeeper` by rewriting it to a shell scripts because it needs to wait for mutations to apply. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) -- Fixed UBSan and MemSan failure in function `groupUniqArray` with emtpy array argument. It was caused by placing of empty `PaddedPODArray` into hash table zero cell because constructor for zero cell value was not called. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos Bird](https://github.com/amosbird)) - -### ClickHouse release 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} - -#### New Feature {#new-feature-4} - -- `WITH FILL` modifier for `ORDER BY`. (continuation of [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- `WITH TIES` modifier for `LIMIT`. (continuation of [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- Parse unquoted `NULL` literal as NULL (if setting `format_csv_unquoted_null_literal_as_null=1`). Initialize null fields with default values if data type of this field is not nullable (if setting `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) -- Support for wildcards in paths of table functions `file` and `hdfs`. If the path contains wildcards, the table will be readonly. Example of usage: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` and `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) -- New `system.metric_log` table which stores values of `system.events` and `system.metrics` with specified time interval. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Allow to write ClickHouse text logs to `system.text_log` table. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Show private symbols in stack traces (this is done via parsing symbol tables of ELF files). Added information about file and line number in stack traces if debug info is present. Speedup symbol name lookup with indexing symbols present in program. Added new SQL functions for introspection: `demangle` and `addressToLine`. Renamed function `symbolizeAddress` to `addressToSymbol` for consistency. Function `addressToSymbol` will return mangled name for performance reasons and you have to apply `demangle`. Added setting `allow_introspection_functions` which is turned off by default. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Table function `values` (the name is case-insensitive). It allows to read from `VALUES` list proposed in [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Example: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) -- Added an ability to alter storage settings. Syntax: `ALTER TABLE
MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) -- Support for removing of detached parts. Syntax: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) -- Table constraints. Allows to add constraint to table definition which will be checked at insert. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Suppport for cascaded materialized views. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos Bird](https://github.com/amosbird)) -- Turn on query profiler by default to sample every query execution thread once a second. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Input format `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) -- Added two new functions: `sigmoid` and `tanh` (that are useful for machine learning applications). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Function `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` to check if given token is in haystack. Token is a maximal length substring between two non alphanumeric ASCII characters (or boundaries of haystack). Token must be a constant string. Supported by tokenbf\_v1 index specialization. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) -- New function `neighbor(value, offset[, default_value])`. Allows to reach prev/next value within column in a block of data. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) -- Created a function `currentUser()`, returning login of authorized user. Added alias `user()` for compatibility with MySQL. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) -- New aggregate functions `quantilesExactInclusive` and `quantilesExactExclusive` which were proposed in [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) -- Function `bitmapRange(bitmap, range_begin, range_end)` which returns new set with specified range (not include the `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) -- Function `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` which creates array of precision-long strings of geohash-boxes covering provided area. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) -- Implement support for INSERT query with `Kafka` tables. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([Ivan](https://github.com/abyss7)) -- Added support for `_partition` and `_timestamp` virtual columns to Kafka engine. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([Ivan](https://github.com/abyss7)) -- Possibility to remove sensitive data from `query_log`, server logs, process list with regexp-based rules. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) - -#### Experimental Feature {#experimental-feature-2} - -- Input and output data format `Template`. It allows to specify custom format string for input and output. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) -- Implementation of `LIVE VIEW` tables that were originally proposed in [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898), prepared in [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), and then updated in [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). See [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) for detailed description. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) Note that `LIVE VIEW` feature may be removed in next versions. - -#### Bug Fix {#bug-fix-8} - -- This release also contains all bug fixes from 19.13 and 19.11. -- Fix segmentation fault when the table has skip indices and vertical merge happens. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) -- Fix per-column TTL with non-trivial column defaults. Previously in case of force TTL merge with `OPTIMIZE ... FINAL` query, expired values was replaced by type defaults instead of user-specified column defaults. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) -- Fix Kafka messages duplication problem on normal server restart. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) -- Fixed infinite loop when reading Kafka messages. Do not pause/resume consumer on subscription at all - otherwise it may get paused indefinitely in some scenarios. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([Ivan](https://github.com/abyss7)) -- Fix `Key expression contains comparison between inconvertible types` exception in `bitmapContains` function. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) -- Fix segfault with enabled `optimize_skip_unused_shards` and missing sharding key. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) -- Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Removed extra verbose logging in MySQL interface [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Return the ability to parse boolean settings from ‘true’ and ‘false’ in the configuration file. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- Fix crash in `quantile` and `median` function over `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed possible incomplete result returned by `SELECT` query with `WHERE` condition on primary key contained conversion to Float type. It was caused by incorrect checking of monotonicity in `toFloat` function. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- Check `max_expanded_ast_elements` setting for mutations. Clear mutations after `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([Winter Zhang](https://github.com/zhang2014)) -- Fix JOIN results for key columns when used with `join_use_nulls`. Attach Nulls instead of columns defaults. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix for skip indices with vertical merge and alter. Fix for `Bad size of marks file` exception. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) -- Fix rare crash in `ALTER MODIFY COLUMN` and vertical merge when one of merged/altered parts is empty (0 rows) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- Fixed bug in conversion of `LowCardinality` types in `AggregateFunctionFactory`. This fixes [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix wrong behavior and possible segfaults in `topK` and `topKWeighted` aggregated functions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) -- Fixed unsafe code around `getIdentifier` function. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed bug in MySQL wire protocol (is used while connecting to ClickHouse form MySQL client). Caused by heap buffer overflow in `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) -- Fixed memory leak in `bitmapSubsetInRange` function. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) -- Fix rare bug when mutation executed after granularity change. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) -- Allow protobuf message with all fields by default. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) -- Resolve a bug with `nullIf` function when we send a `NULL` argument on the second argument. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Fix rare bug with wrong memory allocation/deallocation in complex key cache dictionaries with string fields which leads to infinite memory consumption (looks like memory leak). Bug reproduces when string size was a power of two starting from eight (8, 16, 32, etc). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- Fixed Gorilla encoding on small sequences which caused exception `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) -- Allow to use not nullable types in JOINs with `join_use_nulls` enabled. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) -- Disable `Poco::AbstractConfiguration` substitutions in query in `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Avoid deadlock in `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Using `arrayReduce` for constant arguments may lead to segfault. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix inconsistent parts which can appear if replica was restored after `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- Fixed hang in `JSONExtractRaw` function. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix bug with incorrect skip indices serialization and aggregation with adaptive granularity. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) -- Fix `WITH ROLLUP` and `WITH CUBE` modifiers of `GROUP BY` with two-level aggregation. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Fix bug with writing secondary indices marks with adaptive granularity. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- Fix initialization order while server startup. Since `StorageMergeTree::background_task_handle` is initialized in `startup()` the `MergeTreeBlockOutputStream::write()` may try to use it before initialization. Just check if it is initialized. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) -- Clearing the data buffer from the previous read operation that was completed with an error. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) -- Fix bug with enabling adaptive granularity when creating a new replica for Replicated\*MergeTree table. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- Fixed possible crash during server startup in case of exception happened in `libunwind` during exception at access to uninitialized `ThreadStatus` structure. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Fix crash in `yandexConsistentHash` function. Found by fuzz test. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed the possibility of hanging queries when server is overloaded and global thread pool becomes near full. This have higher chance to happen on clusters with large number of shards (hundreds), because distributed queries allocate a thread per connection to each shard. For example, this issue may reproduce if a cluster of 330 shards is processing 30 concurrent distributed queries. This issue affects all versions starting from 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed logic of `arrayEnumerateUniqRanked` function. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix segfault when decoding symbol table. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos Bird](https://github.com/amosbird)) -- Fixed irrelevant exception in cast of `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Removed extra quoting of description in `system.settings` table. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Avoid possible deadlock in `TRUNCATE` of Replicated table. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix reading in order of sorting key. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) -- Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Fix bug opened by [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (since 19.4.0). Reproduces in queries to Distributed tables over MergeTree tables when we doesn’t query any columns (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- Fixed overflow in integer division of signed type to unsigned type. The behaviour was exactly as in C or C++ language (integer promotion rules) that may be surprising. Please note that the overflow is still possible when dividing large signed number to large unsigned number or vice-versa (but that case is less usual). The issue existed in all server versions. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Limit maximum sleep time for throttling when `max_execution_speed` or `max_execution_speed_bytes` is set. Fixed false errors like `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed issues about using `MATERIALIZED` columns and aliases in `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos Bird](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix `FormatFactory` behaviour for input streams which are not implemented as processor. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixed typo. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) -- Typo in the error message ( is -\> are ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) -- Fixed error while parsing of columns list from string if type contained a comma (this issue was relevant for `File`, `URL`, `HDFS` storages) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) - -#### Security Fix {#security-fix} - -- This release also contains all bug security fixes from 19.13 and 19.11. -- Fixed the possibility of a fabricated query to cause server crash due to stack overflow in SQL parser. Fixed the possibility of stack overflow in Merge and Distributed tables, materialized views and conditions for row-level security that involve subqueries. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Improvement {#improvement-3} - -- Correct implementation of ternary logic for `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) -- Now values and rows with expired TTL will be removed after `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` query. Added queries `SYSTEM STOP/START TTL MERGES` to disallow/allow assign merges with TTL and filter expired values in all merges. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) -- Possibility to change the location of ClickHouse history file for client using `CLICKHOUSE_HISTORY_FILE` env. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) -- Remove `dry_run` flag from `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Support `ASOF JOIN` with `ON` section. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) -- Better support of skip indexes for mutations and replication. Support for `MATERIALIZE/CLEAR INDEX ... IN PARTITION` query. `UPDATE x = x` recalculates all indices that use column `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) -- Allow to `ATTACH` live views (for example, at the server startup) regardless to `allow_experimental_live_view` setting. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- For stack traces gathered by query profiler, do not include stack frames generated by the query profiler itself. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Now table functions `values`, `file`, `url`, `hdfs` have support for ALIAS columns. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Throw an exception if `config.d` file doesn’t have the corresponding root element as the config file. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) -- Print extra info in exception message for `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) -- When determining shards of a `Distributed` table to be covered by a read query (for `optimize_skip_unused_shards` = 1) ClickHouse now checks conditions from both `prewhere` and `where` clauses of select statement. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) -- Enabled `SIMDJSON` for machines without AVX2 but with SSE 4.2 and PCLMUL instruction set. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse can work on filesystems without `O_DIRECT` support (such as ZFS and BtrFS) without additional tuning. [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Support push down predicate for final subquery. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Better `JOIN ON` keys extraction [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) -- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Optimize selecting of smallest column for `SELECT count()` query. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos Bird](https://github.com/amosbird)) -- Added `strict` parameter in `windowFunnel()`. When the `strict` is set, the `windowFunnel()` applies conditions only for the unique values. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) -- Safer interface of `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) -- Options line size when executing with `--help` option now corresponds with terminal size. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) -- Disable “read in order” optimization for aggregation without keys. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) -- HTTP status code for `INCORRECT_DATA` and `TYPE_MISMATCH` error codes was changed from default `500 Internal Server Error` to `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) -- Move Join object from `ExpressionAction` into `AnalyzedJoin`. `ExpressionAnalyzer` and `ExpressionAction` do not know about `Join` class anymore. Its logic is hidden by `AnalyzedJoin` iface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed possible deadlock of distributed queries when one of shards is localhost but the query is sent via network connection. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Changed semantic of multiple tables `RENAME` to avoid possible deadlocks. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Rewritten MySQL compatibility server to prevent loading full packet payload in memory. Decreased memory consumption for each connection to approximately `2 * DBMS_DEFAULT_BUFFER_SIZE` (read/write buffers). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) -- Move AST alias interpreting logic out of parser that doesn’t have to know anything about query semantics. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) -- Slightly more safe parsing of `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-copier`: Allow use `where_condition` from config with `partition_key` alias in query for checking partition existence (Earlier it was used only in reading data queries). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) -- Added optional message argument in `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) -- Server exception got while sending insertion data is now being processed in client as well. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) -- Added a metric `DistributedFilesToInsert` that shows the total number of files in filesystem that are selected to send to remote servers by Distributed tables. The number is summed across all shards. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Move most of JOINs prepare logic from `ExpressionAction/ExpressionAnalyzer` to `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix TSan [warning](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) -- Better information messages about lack of Linux capabilities. Logging fatal errors with “fatal” level, that will make it easier to find in `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- When enable dumping temporary data to the disk to restrict memory usage during `GROUP BY`, `ORDER BY`, it didn’t check the free disk space. The fix add a new setting `min_free_disk_space`, when the free disk space it smaller then the threshold, the query will stop and throw `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Removed recursive rwlock by thread. It makes no sense, because threads are reused between queries. `SELECT` query may acquire a lock in one thread, hold a lock from another thread and exit from first thread. In the same time, first thread can be reused by `DROP` query. This will lead to false “Attempt to acquire exclusive lock recursively” messages. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Split `ExpressionAnalyzer.appendJoin()`. Prepare a place in `ExpressionAnalyzer` for `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) -- Added `mysql_native_password` authentication plugin to MySQL compatibility server. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) -- Less number of `clock_gettime` calls; fixed ABI compatibility between debug/release in `Allocator` (insignificant issue). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Move `collectUsedColumns` from `ExpressionAnalyzer` to `SyntaxAnalyzer`. `SyntaxAnalyzer` makes `required_source_columns` itself now. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) -- Add setting `joined_subquery_requires_alias` to require aliases for subselects and table functions in `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) -- Extract `GetAggregatesVisitor` class from `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) -- `system.query_log`: change data type of `type` column to `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Static linking of `sha256_password` authentication plugin. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) -- Avoid extra dependency for the setting `compile` to work. In previous versions, the user may get error like `cannot open crti.o`, `unable to find library -lc` etc. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- More validation of the input that may come from malicious replica. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Now `clickhouse-obfuscator` file is available in `clickhouse-client` package. In previous versions it was available as `clickhouse obfuscator` (with whitespace). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) -- Fixed deadlock when we have at least two queries that read at least two tables in different order and another query that performs DDL operation on one of tables. Fixed another very rare deadlock. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added `os_thread_ids` column to `system.processes` and `system.query_log` for better debugging possibilities. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- A workaround for PHP mysqlnd extension bugs which occur when `sha256_password` is used as a default authentication plugin (described in [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) -- Remove unneeded place with changed nullability columns. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) -- Set default value of `queue_max_wait_ms` to zero, because current value (five seconds) makes no sense. There are rare circumstances when this settings has any use. Added settings `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` and `connection_pool_max_wait_ms` for disambiguation. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Extract `SelectQueryExpressionAnalyzer` from `ExpressionAnalyzer`. Keep the last one for non-select queries. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) -- Removed duplicating input and output formats. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Allow user to override `poll_interval` and `idle_connection_timeout` settings on connection. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `MergeTree` now has an additional option `ttl_only_drop_parts` (disabled by default) to avoid partial pruning of parts, so that they dropped completely when all the rows in a part are expired. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) -- Type checks for set index functions. Throw exception if function got a wrong type. This fixes fuzz test with UBSan. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Performance Improvement {#performance-improvement-2} - -- Optimize queries with `ORDER BY expressions` clause, where `expressions` have coinciding prefix with sorting key in `MergeTree` tables. This optimization is controlled by `optimize_read_in_order` setting. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) -- Allow to use multiple threads during parts loading and removal. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Implemented batch variant of updating aggregate function states. It may lead to performance benefits. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Using `FastOps` library for functions `exp`, `log`, `sigmoid`, `tanh`. FastOps is a fast vector math library from Michael Parakhin (Yandex CTO). Improved performance of `exp` and `log` functions more than 6 times. The functions `exp` and `log` from `Float32` argument will return `Float32` (in previous versions they always return `Float64`). Now `exp(nan)` may return `inf`. The result of `exp` and `log` functions may be not the nearest machine representable number to the true answer. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) Using Danila Kutenin variant to make fastops working [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Disable consecutive key optimization for `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) -- Improved performance of `simdjson` library by getting rid of dynamic allocation in `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) -- Pre-fault pages when allocating memory with `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) -- Fix performance bug in `Decimal` comparison. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-4} - -- Remove Compiler (runtime template instantiation) because we’ve win over it’s performance. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added performance test to show degradation of performance in gcc-9 in more isolated way. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added table function `numbers_mt`, which is multithreaded version of `numbers`. Updated performance tests with hash functions. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Comparison mode in `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) -- Best effort for printing stack traces. Also added `SIGPROF` as a debugging signal to print stack trace of a running thread. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Every function in its own file, part 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Remove doubled const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) -- Formatting changes for `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) -- Better subquery for join creation in `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) -- Remove a redundant condition (found by PVS Studio). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) -- Separate the hash table interface for `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) -- Refactoring of settings. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) -- Add comments for `set` index functions. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) -- Increase OOM score in debug version on Linux. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) -- HDFS HA now work in debug build. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) -- Added a test to `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add test for multiple materialized views for Kafka table. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([Ivan](https://github.com/abyss7)) -- Make a better build scheme. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([Ivan](https://github.com/abyss7)) -- Fixed `test_external_dictionaries` integration in case it was executed under non root user. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- The bug reproduces when total size of written packets exceeds `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) -- Added a test for `RENAME` table race condition [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Avoid data race on Settings in `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add integration test for handling errors by a cache dictionary. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) -- Disable parsing of ELF object files on Mac OS, because it makes no sense. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Attempt to make changelog generator better. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Adding `-Wshadow` switch to the GCC. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Removed obsolete code for `mimalloc` support. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `zlib-ng` determines x86 capabilities and saves this info to global variables. This is done in defalteInit call, which may be made by different threads simultaneously. To avoid multithreaded writes, do it on library startup. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) -- Regression test for a bug which in join which was fixed in [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) -- Fixed MSan report. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix flapping TTL test. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) -- Fixed false data race in `MergeTreeDataPart::is_frozen` field. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed timeouts in fuzz test. In previous version, it managed to find false hangup in query `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added debug checks to `static_cast` of columns. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Support for Oracle Linux in official RPM packages. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Changed json perftests from `once` to `loop` type. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `odbc-bridge.cpp` defines `main()` so it should not be included in `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) -- Test for crash in `FULL|RIGHT JOIN` with nulls in right table’s keys. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) -- Added a test for the limit on expansion of aliases just in case. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Switched from `boost::filesystem` to `std::filesystem` where appropriate. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added RPM packages to website. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add a test for fixed `Unknown identifier` exception in `IN` section. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) -- Simplify `shared_ptr_helper` because people facing difficulties understanding it. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added performance tests for fixed Gorilla and DoubleDelta codec. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) -- Split the integration test `test_dictionaries` into 4 separate tests. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fix PVS-Studio warning in `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Allow to use `library` dictionary source with ASan. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added option to generate changelog from a list of PRs. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Lock the `TinyLog` storage when reading. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) -- Check for broken symlinks in CI. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Increase timeout for “stack overflow” test because it may take a long time in debug build. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added a check for double whitespaces. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix `new/delete` memory tracking when build with sanitizers. Tracking is not clear. It only prevents memory limit exceptions in tests. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) -- Enable back the check of undefined symbols while linking. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([Ivan](https://github.com/abyss7)) -- Avoid rebuilding `hyperscan` every day. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed UBSan report in `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Don’t allow to use query profiler with sanitizers because it is not compatible. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add test for reloading a dictionary after fail by timer. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fix inconsistency in `PipelineExecutor::prepareProcessor` argument type. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Added a test for bad URIs. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added more checks to `CAST` function. This should get more information about segmentation fault in fuzzy test. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Added `gcc-9` support to `docker/builder` container that builds image locally. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Test for primary key with `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) -- Fixed tests affected by slow stack traces printing. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add a test case for crash in `groupUniqArray` fixed in [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) -- Fixed indices mutations tests. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) -- In performance test, do not read query log for queries we didn’t run. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) -- Materialized view now could be created with any low cardinality types regardless to the setting about suspicious low cardinality types. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) -- Updated tests for `send_logs_level` setting. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix build under gcc-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) -- Fix build with internal libc++. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([Ivan](https://github.com/abyss7)) -- Fix shared build with `rdkafka` library [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) -- Fixes for Mac OS build (incomplete). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) -- Fix “splitted” build. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Other build fixes: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos Bird](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([Ivan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) - -#### Backward Incompatible Change {#backward-incompatible-change-3} - -- Removed rarely used table function `catBoostPool` and storage `CatBoostPool`. If you have used this table function, please write email to `clickhouse-feedback@yandex-team.com`. Note that CatBoost integration remains and will be supported. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Disable `ANY RIGHT JOIN` and `ANY FULL JOIN` by default. Set `any_join_distinct_right_table_keys` setting to enable them. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) - -## ClickHouse release 19.13 {#clickhouse-release-19-13} - -### ClickHouse release 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} - -#### Bug Fix {#bug-fix-9} - -- This release also contains all bug fixes from 19.11.12.69. - -### ClickHouse release 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} - -#### Bug Fix {#bug-fix-10} - -- This release also contains all bug fixes from 19.14.6.12. -- Fixed possible inconsistent state of table while executing `DROP` query for replicated table while zookeeper is not accessible. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Fix for data race in StorageMerge [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix bug introduced in query profiler which leads to endless recv from socket. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) -- Fix excessive CPU usage while executing `JSONExtractRaw` function over a boolean value. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fixes the regression while pushing to materialized view. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([Ivan](https://github.com/abyss7)) -- Table function `url` had the vulnerability allowed the attacker to inject arbitrary HTTP headers in the request. This issue was found by [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix useless `AST` check in Set index. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) -- Fixed parsing of `AggregateFunction` values embedded in query. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) -- Fixed wrong behaviour of `trim` functions family. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} - -#### Bug Fix {#bug-fix-11} - -- This release also contains all bug security fixes from 19.11.9.52 and 19.11.10.54. -- Fixed data race in `system.parts` table and `ALTER` query. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed mismatched header in streams happened in case of reading from empty distributed table with sample and prewhere. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixed crash when using `IN` clause with a subquery with a tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Fix case with same column names in `GLOBAL JOIN ON` section. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix crash when casting types to `Decimal` that do not support it. Throw exception instead. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed crash in `extractAll()` function. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) -- Query transformation for `MySQL`, `ODBC`, `JDBC` table functions now works properly for `SELECT WHERE` queries with multiple `AND` expressions. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) -- Added previous declaration checks for MySQL 8 integration. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) - -#### Security Fix {#security-fix-1} - -- Fix two vulnerabilities in codecs in decompression phase (malicious user can fabricate compressed data that will lead to buffer overflow in decompression). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouse release 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} - -#### Bug Fix {#bug-fix-12} - -- Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Fix NPE when using IN clause with a subquery with a tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Fixed an issue that if a stale replica becomes alive, it may still have data parts that were removed by DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- Fixed issue with parsing CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- Fixed data race in system.parts table and ALTER query. This fixes [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed possible data loss after `ALTER DELETE` query on table with skipping index. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Security Fix {#security-fix-2} - -- If the attacker has write access to ZooKeeper and is able to run custom server available from the network where ClickHouse run, it can create custom-built malicious server that will act as ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. Found by Eldar Zaitov, information security team at Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} - -#### New Feature {#new-feature-5} - -- Sampling profiler on query level. [Example](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) -- Allow to specify a list of columns with `COLUMNS('regexp')` expression that works like a more sophisticated variant of `*` asterisk. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CREATE TABLE AS table_function()` is now possible [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) -- Adam optimizer for stochastic gradient descent is used by default in `stochasticLinearRegression()` and `stochasticLogisticRegression()` aggregate functions, because it shows good quality without almost any tuning. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) -- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Andy Yang](https://github.com/andyyzh)) -- `RENAME` queries now work with all storages. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([Ivan](https://github.com/abyss7)) -- Now client receive logs from server with any desired level by setting `send_logs_level` regardless to the log level specified in server settings. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) - -#### Backward Incompatible Change {#backward-incompatible-change-4} - -- The setting `input_format_defaults_for_omitted_fields` is enabled by default. Inserts in Distributed tables need this setting to be the same on cluster (you need to set it before rolling update). It enables calculation of complex default expressions for omitted fields in `JSONEachRow` and `CSV*` formats. It should be the expected behavior but may lead to negligible performance difference. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) - -#### Experimental features {#experimental-features} - -- New query processing pipeline. Use `experimental_use_processors=1` option to enable it. Use for your own trouble. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Bug Fix {#bug-fix-13} - -- Kafka integration has been fixed in this version. -- Fixed `DoubleDelta` encoding of `Int64` for large `DoubleDelta` values, improved `DoubleDelta` encoding for random data for `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) -- Fixed overestimation of `max_rows_to_read` if the setting `merge_tree_uniform_read_distribution` is set to 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Improvement {#improvement-4} - -- Throws an exception if `config.d` file doesn’t have the corresponding root element as the config file [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) - -#### Performance Improvement {#performance-improvement-3} - -- Optimize `count()`. Now it uses the smallest column (if possible). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos Bird](https://github.com/amosbird)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-5} - -- Report memory usage in performance tests. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) -- Fix build with external `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([Ivan](https://github.com/abyss7)) -- Fix shared build with `rdkafka` library [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) - -## ClickHouse release 19.11 {#clickhouse-release-19-11} - -### ClickHouse release 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} - -#### Bug Fix {#bug-fix-14} - -- Fixed rare crash in `ALTER MODIFY COLUMN` and vertical merge when one of merged/altered parts is empty (0 rows). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- Manual update of `SIMDJSON`. This fixes possible flooding of stderr files with bogus json diagnostic messages. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) -- Fixed bug with `mrk` file extension for mutations ([alesapin](https://github.com/alesapin)) - -### ClickHouse release 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} - -#### Bug Fix {#bug-fix-15} - -- Fixed performance degradation of index analysis on complex keys on large tables. This fixes [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Avoid rare SIGSEGV while sending data in tables with Distributed engine (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) -- Fix `Unknown identifier` with multiple joins. This fixes [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouse release 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} - -- Fix logical error causing segfaults when selecting from Kafka empty topic. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) -- Fix for function `АrrayEnumerateUniqRanked` with empty arrays in params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) - -### ClickHouse release 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} - -#### Bug Fix {#bug-fix-16} - -- Do store offsets for Kafka messages manually to be able to commit them all at once for all partitions. Fixes potential duplication in “one consumer - many partitions” scenario. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([Ivan](https://github.com/abyss7)) - -### ClickHouse release 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} - -- Improve error handling in cache dictionaries. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fixed bug in function `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) -- Fix `JSONExtract` function while extracting a `Tuple` from JSON. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fixed possible data loss after `ALTER DELETE` query on table with skipping index. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) -- Fixed performance test. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Parquet: Fix reading boolean columns. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed wrong behaviour of `nullIf` function for constant arguments. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix Kafka messages duplication problem on normal server restart. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) -- Fixed an issue when long `ALTER UPDATE` or `ALTER DELETE` may prevent regular merges to run. Prevent mutations from executing if there is no enough free threads available. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) -- Fixed error with processing “timezone” in server configuration file. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix kafka tests. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([Ivan](https://github.com/abyss7)) - -#### Security Fix {#security-fix-3} - -- If the attacker has write access to ZooKeeper and is able to run custom server available from the network where ClickHouse runs, it can create custom-built malicious server that will act as ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. Found by Eldar Zaitov, information security team at Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} - -#### Bug Fix {#bug-fix-17} - -- Fix `ALTER TABLE ... UPDATE` query for tables with `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Fix NPE when using IN clause with a subquery with a tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Fixed an issue that if a stale replica becomes alive, it may still have data parts that were removed by DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- Fixed issue with parsing CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- Fixed data race in system.parts table and ALTER query. This fixes [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed wrong code in mutations that may lead to memory corruption. Fixed segfault with read of address `0x14c0` that may happed due to concurrent `DROP TABLE` and `SELECT` from `system.parts` or `system.parts_columns`. Fixed race condition in preparation of mutation queries. Fixed deadlock caused by `OPTIMIZE` of Replicated tables and concurrent modification operations like ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} - -#### Bug fix {#bug-fix-18} - -- Kafka integration has been fixed in this version. -- Fix segfault when using `arrayReduce` for constant arguments. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed `toFloat()` monotonicity. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- Fix segfault with enabled `optimize_skip_unused_shards` and missing sharding key. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) -- Fixed logic of `arrayEnumerateUniqRanked` function. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Removed extra verbose logging from MySQL handler. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix wrong behavior and possible segfaults in `topK` and `topKWeighted` aggregated functions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) -- Do not expose virtual columns in `system.columns` table. This is required for backward compatibility. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix bug with memory allocation for string fields in complex key cache dictionary. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- Fix bug with enabling adaptive granularity when creating new replica for `Replicated*MergeTree` table. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- Fix infinite loop when reading Kafka messages. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) -- Fixed the possibility of a fabricated query to cause server crash due to stack overflow in SQL parser and possibility of stack overflow in `Merge` and `Distributed` tables [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed Gorilla encoding error on small sequences. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) - -#### Improvement {#improvement-5} - -- Allow user to override `poll_interval` and `idle_connection_timeout` settings on connection. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} - -#### Bug fix {#bug-fix-19} - -- Fixed the possibility of hanging queries when server is overloaded. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix FPE in yandexConsistentHash function. This fixes [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed bug in conversion of `LowCardinality` types in `AggregateFunctionFactory`. This fixes [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix parsing of `bool` settings from `true` and `false` strings in configuration files. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- Fix rare bug with incompatible stream headers in queries to `Distributed` table over `MergeTree` table when part of `WHERE` moves to `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- Fixed overflow in integer division of signed type to unsigned type. This fixes [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Backward Incompatible Change {#backward-incompatible-change-5} - -- `Kafka` still broken. - -### ClickHouse release 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} - -#### Bug Fix {#bug-fix-20} - -- Fix bug with writing secondary indices marks with adaptive granularity. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- Fix `WITH ROLLUP` and `WITH CUBE` modifiers of `GROUP BY` with two-level aggregation. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Fixed hang in `JSONExtractRaw` function. Fixed [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix segfault in ExternalLoader::reloadOutdated(). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fixed the case when server may close listening sockets but not shutdown and continue serving remaining queries. You may end up with two running clickhouse-server processes. Sometimes, the server may return an error `bad_function_call` for remaining queries. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed useless and incorrect condition on update field for initial loading of external dictionaries via ODBC, MySQL, ClickHouse and HTTP. This fixes [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed irrelevant exception in cast of `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix non-deterministic result of “uniq” aggregate function in extreme rare cases. The bug was present in all ClickHouse versions. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Segfault when we set a little bit too high CIDR on the function `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Fixed small memory leak when server throw many exceptions from many different contexts. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix the situation when consumer got paused before subscription and not resumed afterwards. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([Ivan](https://github.com/abyss7)) Note that Kafka is broken in this version. -- Clearing the Kafka data buffer from the previous read operation that was completed with an error [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Note that Kafka is broken in this version. -- Since `StorageMergeTree::background_task_handle` is initialized in `startup()` the `MergeTreeBlockOutputStream::write()` may try to use it before initialization. Just check if it is initialized. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-6} - -- Added official `rpm` packages. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) -- Add an ability to build `.rpm` and `.tgz` packages with `packager` script. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) -- Fixes for “Arcadia” build system. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) - -#### Backward Incompatible Change {#backward-incompatible-change-6} - -- `Kafka` is broken in this version. - -### ClickHouse release 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} - -#### New Feature {#new-feature-6} - -- Added support for prepared statements. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alexander](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `DoubleDelta` and `Gorilla` column codecs [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) -- Added `os_thread_priority` setting that allows to control the “nice” value of query processing threads that is used by OS to adjust dynamic scheduling priority. It requires `CAP_SYS_NICE` capabilities to work. This implements [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Implement `_topic`, `_offset`, `_key` columns for Kafka engine [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([Ivan](https://github.com/abyss7)) Note that Kafka is broken in this version. -- Add aggregate function combinator `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) -- Aggregate functions `groupArrayMovingSum(win_size)(x)` and `groupArrayMovingAvg(win_size)(x)`, which calculate moving sum/avg with or without window-size limitation. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) -- Add synonim `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) -- Intergate H3 function `geoToH3` from Uber. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Bug Fix {#bug-fix-21} - -- Implement DNS cache with asynchronous update. Separate thread resolves all hosts and updates DNS cache with period (setting `dns_cache_update_period`). It should help, when ip of hosts changes frequently. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) -- Fix segfault in `Delta` codec which affects columns with values less than 32 bits size. The bug led to random memory corruption. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- Fix segfault in TTL merge with non-physical columns in block. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Fix rare bug in checking of part with `LowCardinality` column. Previously `checkDataPart` always fails for part with `LowCardinality` column. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- Avoid hanging connections when server thread pool is full. It is important for connections from `remote` table function or connections to a shard without replicas when there is long connection timeout. This fixes [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Support for constant arguments to `evalMLModel` function. This fixes [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed the issue when ClickHouse determines default time zone as `UCT` instead of `UTC`. This fixes [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed buffer underflow in `visitParamExtractRaw`. This fixes [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Now distributed `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` queries will be executed directly on leader replica. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- Fix `coalesce` for `ColumnConst` with `ColumnNullable` + related changes. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix the `ReadBufferFromKafkaConsumer` so that it keeps reading new messages after `commit()` even if it was stalled before [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([Ivan](https://github.com/abyss7)) -- Fix `FULL` and `RIGHT` JOIN results when joining on `Nullable` keys in right table. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) -- Possible fix of infinite sleeping of low-priority queries. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix race condition, which cause that some queries may not appear in query\_log after `SYSTEM FLUSH LOGS` query. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Fixed `heap-use-after-free` ASan warning in ClusterCopier caused by watch which try to use already removed copier object. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixed wrong `StringRef` pointer returned by some implementations of `IColumn::deserializeAndInsertFromArena`. This bug affected only unit-tests. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Prevent source and intermediate array join columns of masking same name columns. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix insert and select query to MySQL engine with MySQL style identifier quoting. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([Winter Zhang](https://github.com/zhang2014)) -- Now `CHECK TABLE` query can work with MergeTree engine family. It returns check status and message if any for each part (or file in case of simplier engines). Also, fix bug in fetch of a broken part. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) -- Fix SPLIT\_SHARED\_LIBRARIES runtime [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) -- Fixed time zone initialization when `/etc/localtime` is a relative symlink like `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- clickhouse-copier: Fix use-after free on shutdown [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) -- Updated `simdjson`. Fixed the issue that some invalid JSONs with zero bytes successfully parse. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix shutdown of SystemLogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) -- Fix hanging when condition in invalidate\_query depends on a dictionary. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Improvement {#improvement-6} - -- Allow unresolvable addresses in cluster configuration. They will be considered unavailable and tried to resolve at every connection attempt. This is especially useful for Kubernetes. This fixes [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Close idle TCP connections (with one hour timeout by default). This is especially important for large clusters with multiple distributed tables on every server, because every server can possibly keep a connection pool to every other server, and after peak query concurrency, connections will stall. This fixes [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Better quality of `topK` function. Changed the SavingSpace set behavior to remove the last element if the new element have a bigger weight. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) -- URL functions to work with domains now can work for incomplete URLs without scheme [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) -- Checksums added to the `system.parts_columns` table. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Added `Enum` data type as a synonim for `Enum8` or `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) -- Full bit transpose variant for `T64` codec. Could lead to better compression with `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) -- Condition on `startsWith` function now can uses primary key. This fixes [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) and [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) -- Allow to use `clickhouse-copier` with cross-replication cluster topology by permitting empty database name. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) -- Use `UTC` as default timezone on a system without `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` was printed and server or client refused to start. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Returned back support for floating point argument in function `quantileTiming` for backward compatibility. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Show which table is missing column in error messages. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([Ivan](https://github.com/abyss7)) -- Disallow run query with same query\_id by various users [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) -- More robust code for sending metrics to Graphite. It will work even during long multiple `RENAME TABLE` operation. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- More informative error messages will be displayed when ThreadPool cannot schedule a task for execution. This fixes [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Inverting ngramSearch to be more intuitive [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) -- Add user parsing in HDFS engine builder [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) -- Update default value of `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) -- Added a notion of obsolete settings. The obsolete setting `allow_experimental_low_cardinality_type` can be used with no effect. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) - -#### Performance Improvement {#performance-improvement-4} - -- Increase number of streams to SELECT from Merge table for more uniform distribution of threads. Added setting `max_streams_multiplier_for_merge_tables`. This fixes [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-7} - -- Add a backward compatibility test for client-server interaction with different versions of clickhouse. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) -- Test coverage information in every commit and pull request. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) -- Cooperate with address sanitizer to support our custom allocators (`Arena` and `ArenaWithFreeLists`) for better debugging of “use-after-free” errors. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) -- Switch to [LLVM libunwind implementation](https://github.com/llvm-mirror/libunwind) for C++ exception handling and for stack traces printing [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) -- Add two more warnings from -Weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Allow to build ClickHouse with Memory Sanitizer. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed ubsan report about `bitTest` function in fuzz test. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Docker: added possibility to init a ClickHouse instance which requires authentication. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) -- Update librdkafka to version 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([Ivan](https://github.com/abyss7)) -- Add global timeout for integration tests and disable some of them in tests code. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) -- Fix some ThreadSanitizer failures. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) -- The `--no-undefined` option forces the linker to check all external names for existence while linking. It’s very useful to track real dependencies between libraries in the split build mode. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([Ivan](https://github.com/abyss7)) -- Added performance test for [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed compatibility with gcc-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added support for gcc-9. This fixes [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed error when libunwind can be linked incorrectly. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed a few warnings found by PVS-Studio. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added initial support for `clang-tidy` static analyzer. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Convert BSD/Linux endian macros( ‘be64toh’ and ‘htobe64’) to the Mac OS X equivalents [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fu Chen](https://github.com/fredchenbj)) -- Improved integration tests guide. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixing build at macosx + gcc9 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) -- Fix a hard-to-spot typo: aggreAGte -\> aggregate. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) -- Fix freebsd build [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) -- Add link to experimental YouTube channel to website [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) -- CMake: add option for coverage flags: WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) -- Fix initial size of some inline PODArray’s. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) -- clickhouse-server.postinst: fix os detection for centos 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) -- Added Arch linux package generation. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Split Common/config.h by libs (dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) -- Fixes for “Arcadia” build platform [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) -- Fixes for unconventional build (gcc9, no submodules) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) -- Require explicit type in unalignedStore because it was proven to be bug-prone [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) -- Fixes MacOS build [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) -- Performance test concerning the new JIT feature with bigger dataset, as requested here [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Run stateful tests in stress test [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) - -#### Backward Incompatible Change {#backward-incompatible-change-7} - -- `Kafka` is broken in this version. -- Enable `adaptive_index_granularity` = 10MB by default for new `MergeTree` tables. If you created new MergeTree tables on version 19.11+, downgrade to versions prior to 19.6 will be impossible. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) -- Removed obsolete undocumented embedded dictionaries that were used by Yandex.Metrica. The functions `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` are no longer available. If you are using these functions, write email to clickhouse-feedback@yandex-team.com. Note: at the last moment we decided to keep these functions for a while. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouse release 19.10 {#clickhouse-release-19-10} - -### ClickHouse release 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} - -#### New Feature {#new-feature-7} - -- Add new column codec: `T64`. Made for (U)IntX/EnumX/Data(Time)/DecimalX columns. It should be good for columns with constant or small range values. Codec itself allows enlarge or shrink data type without re-compression. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) -- Add database engine `MySQL` that allow to view all the tables in remote MySQL server [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([Winter Zhang](https://github.com/zhang2014)) -- `bitmapContains` implementation. It’s 2x faster than `bitmapHasAny` if the second bitmap contains one element. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) -- Support for `crc32` function (with behaviour exactly as in MySQL or PHP). Do not use it if you need a hash function. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) -- Implemented `SYSTEM START/STOP DISTRIBUTED SENDS` queries to control asynchronous inserts into `Distributed` tables. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([Winter Zhang](https://github.com/zhang2014)) - -#### Bug Fix {#bug-fix-22} - -- Ignore query execution limits and max parts size for merge limits while executing mutations. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) -- Fix bug which may lead to deduplication of normal blocks (extremely rare) and insertion of duplicate blocks (more often). [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) -- Fix of function `arrayEnumerateUniqRanked` for arguments with empty arrays [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) -- Don’t subscribe to Kafka topics without intent to poll any messages. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([Ivan](https://github.com/abyss7)) -- Make setting `join_use_nulls` get no effect for types that cannot be inside Nullable [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fixed `Incorrect size of index granularity` errors [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) -- Fix Float to Decimal convert overflow [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) -- Flush buffer when `WriteBufferFromHDFS`’s destructor is called. This fixes writing into `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) - -#### Improvement {#improvement-7} - -- Treat empty cells in `CSV` as default values when the setting `input_format_defaults_for_omitted_fields` is enabled. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) -- Non-blocking loading of external dictionaries. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) -- Network timeouts can be dynamically changed for already established connections according to the settings. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) -- Using “public\_suffix\_list” for functions `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. It’s using a perfect hash table generated by `gperf` with a list generated from the file: https://publicsuffix.org/list/public\_suffix\_list.dat. (for example, now we recognize the domain `ac.uk` as non-significant). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Adopted `IPv6` data type in system tables; unified client info columns in `system.processes` and `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Using sessions for connections with MySQL compatibility protocol. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) -- Support more `ALTER` queries `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) -- Support `` section in `clickhouse-local` config file. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) -- Allow run query with `remote` table function in `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) - -#### Performance Improvement {#performance-improvement-5} - -- Add the possibility to write the final mark at the end of MergeTree columns. It allows to avoid useless reads for keys that are out of table data range. It is enabled only if adaptive index granularity is in use. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) -- Improved performance of MergeTree tables on very slow filesystems by reducing number of `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed performance degradation in reading from MergeTree tables that was introduced in version 19.6. Fixes \#5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-8} - -- Implemented `TestKeeper` as an implementation of ZooKeeper interface used for testing [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) -- From now on `.sql` tests can be run isolated by server, in parallel, with random database. It allows to run them faster, add new tests with custom server configurations, and be sure that different tests doesn’t affect each other. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([Ivan](https://github.com/abyss7)) -- Remove `` and `` from performance tests [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fixed “select\_format” performance test for `Pretty` formats [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouse release 19.9 {#clickhouse-release-19-9} - -### ClickHouse release 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} - -#### Bug Fix {#bug-fix-23} - -- Fix segfault in Delta codec which affects columns with values less than 32 bits size. The bug led to random memory corruption. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- Fix rare bug in checking of part with LowCardinality column. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- Fix segfault in TTL merge with non-physical columns in block. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Fix potential infinite sleeping of low-priority queries. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix how ClickHouse determines default time zone as UCT instead of UTC. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix bug about executing distributed DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER queries on follower replica before leader replica. Now they will be executed directly on leader replica. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- Fix race condition, which cause that some queries may not appear in query\_log instantly after SYSTEM FLUSH LOGS query. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Added missing support for constant arguments to `evalMLModel` function. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} - -#### New Feature {#new-feature-8} - -- Print information about frozen parts in `system.parts` table. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) -- Ask client password on clickhouse-client start on tty if not set in arguments [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) -- Implement `dictGet` and `dictGetOrDefault` functions for Decimal types. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Improvement {#improvement-8} - -- Debian init: Add service stop timeout [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) -- Add setting forbidden by default to create table with suspicious types for LowCardinality [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) -- Regression functions return model weights when not used as State in function `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) -- Rename and improve regression methods. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) -- Clearer interfaces of string searchers. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) - -#### Bug Fix {#bug-fix-24} - -- Fix potential data loss in Kafka [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([Ivan](https://github.com/abyss7)) -- Fix potential infinite loop in `PrettySpace` format when called with zero columns [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fixed UInt32 overflow bug in linear models. Allow eval ML model for non-const model argument. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `ALTER TABLE ... DROP INDEX IF EXISTS ...` should not raise an exception if provided index does not exist [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Fix segfault with `bitmapHasAny` in scalar subquery [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Fixed error when replication connection pool doesn’t retry to resolve host, even when DNS cache was dropped. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- Fixed `ALTER ... MODIFY TTL` on ReplicatedMergeTree. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) -- Fix INSERT into Distributed table with MATERIALIZED column [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) -- Fix bad alloc when truncate Join storage [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) -- In recent versions of package tzdata some of files are symlinks now. The current mechanism for detecting default timezone gets broken and gives wrong names for some timezones. Now at least we force the timezone name to the contents of TZ if provided. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) -- Fix some extremely rare cases with MultiVolnitsky searcher when the constant needles in sum are at least 16KB long. The algorithm missed or overwrote the previous results which can lead to the incorrect result of `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) -- Fix the issue when settings for ExternalData requests couldn’t use ClickHouse settings. Also, for now, settings `date_time_input_format` and `low_cardinality_allow_in_native_format` cannot be used because of the ambiguity of names (in external data it can be interpreted as table format and in the query it can be a setting). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) -- Fix bug when parts were removed only from FS without dropping them from Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- Remove debug logging from MySQL protocol [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Skip ZNONODE during DDL query processing [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Fix mix `UNION ALL` result column type. There were cases with inconsistent data and column types of resulting columns. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- Throw an exception on wrong integers in `dictGetT` functions instead of crash. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix wrong element\_count and load\_factor for hashed dictionary in `system.dictionaries` table. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-9} - -- Fixed build without `Brotli` HTTP compression support (`ENABLE_BROTLI=OFF` cmake variable). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) -- Include roaring.h as roaring/roaring.h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) -- Fix gcc9 warnings in hyperscan (\#line directive is evil!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) -- Fix all warnings when compiling with gcc-9. Fix some contrib issues. Fix gcc9 ICE and submit it to bugzilla. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) -- Fixed linking with lld [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Remove unused specializations in dictionaries [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) -- Improvement performance tests for formatting and parsing tables for different types of files [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fixes for parallel test run [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) -- Docker: use configs from clickhouse-test [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) -- Fix compile for FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) -- Upgrade boost to 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) -- Fix build clickhouse as submodule [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) -- Improve JSONExtract performance tests [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) - -## ClickHouse release 19.8 {#clickhouse-release-19-8} - -### ClickHouse release 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} - -#### New Features {#new-features} - -- Added functions to work with JSON [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) -- Add a function basename, with a similar behaviour to a basename function, which exists in a lot of languages (`os.path.basename` in python, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Added `LIMIT n, m BY` or `LIMIT m OFFSET n BY` syntax to set offset of n for LIMIT BY clause. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) -- Added new data type `SimpleAggregateFunction`, which allows to have columns with light aggregation in an `AggregatingMergeTree`. This can only be used with simple functions like `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) -- Added support for non-constant arguments in function `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) -- Added functions `skewPop`, `skewSamp`, `kurtPop` and `kurtSamp` to compute for sequence skewness, sample skewness, kurtosis and sample kurtosis respectively. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) -- Support rename operation for `MaterializeView` storage. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Added server which allows connecting to ClickHouse using MySQL client. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) -- Add `toDecimal*OrZero` and `toDecimal*OrNull` functions. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) -- Support Decimal types in functions: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) -- Added `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) -- Added `format` function. Formatting constant pattern (simplified Python format pattern) with the strings listed in the arguments. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) -- Added `system.detached_parts` table containing information about detached parts of `MergeTree` tables. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) -- Added `ngramSearch` function to calculate the non-symmetric difference between needle and haystack. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) -- Implementation of basic machine learning methods (stochastic linear regression and logistic regression) using aggregate functions interface. Has different strategies for updating model weights (simple gradient descent, momentum method, Nesterov method). Also supports mini-batches of custom size. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) -- Implementation of `geohashEncode` and `geohashDecode` functions. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) -- Added aggregate function `timeSeriesGroupSum`, which can aggregate different time series that sample timestamp not alignment. It will use linear interpolation between two sample timestamp and then sum time-series together. Added aggregate function `timeSeriesGroupRateSum`, which calculates the rate of time-series and then sum rates together. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Yangkuan Liu](https://github.com/LiuYangkuan)) -- Added functions `IPv4CIDRtoIPv4Range` and `IPv6CIDRtoIPv6Range` to calculate the lower and higher bounds for an IP in the subnet using a CIDR. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Add a X-ClickHouse-Summary header when we send a query using HTTP with enabled setting `send_progress_in_http_headers`. Return the usual information of X-ClickHouse-Progress, with additional information like how many rows and bytes were inserted in the query. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Improvements {#improvements} - -- Added `max_parts_in_total` setting for MergeTree family of tables (default: 100 000) that prevents unsafe specification of partition key \#5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-obfuscator`: derive seed for individual columns by combining initial seed with column name, not column position. This is intended to transform datasets with multiple related tables, so that tables will remain JOINable after transformation. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added functions `JSONExtractRaw`, `JSONExtractKeyAndValues`. Renamed functions `jsonExtract` to `JSONExtract`. When something goes wrong these functions return the correspondent values, not `NULL`. Modified function `JSONExtract`, now it gets the return type from its last parameter and doesn’t inject nullables. Implemented fallback to RapidJSON in case AVX2 instructions are not available. Simdjson library updated to a new version. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) -- Now `if` and `multiIf` functions don’t rely on the condition’s `Nullable`, but rely on the branches for sql compatibility. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu](https://github.com/janplus)) -- `In` predicate now generates `Null` result from `Null` input like the `Equal` function. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu](https://github.com/janplus)) -- Check the time limit every (flush\_interval / poll\_timeout) number of rows from Kafka. This allows to break the reading from Kafka consumer more frequently and to check the time limits for the top-level streams [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([Ivan](https://github.com/abyss7)) -- Link rdkafka with bundled SASL. It should allow to use SASL SCRAM authentication [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([Ivan](https://github.com/abyss7)) -- Batched version of RowRefList for ALL JOINS. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) -- clickhouse-server: more informative listen error messages. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) -- Support dictionaries in clickhouse-copier for functions in `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) -- Add new setting `kafka_commit_every_batch` to regulate Kafka committing policy. - It allows to set commit mode: after every batch of messages is handled, or after the whole block is written to the storage. It’s a trade-off between losing some messages or reading them twice in some extreme situations. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([Ivan](https://github.com/abyss7)) -- Make `windowFunnel` support other Unsigned Integer Types. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) -- Allow to shadow virtual column `_table` in Merge engine. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([Ivan](https://github.com/abyss7)) -- Make `sequenceMatch` aggregate functions support other unsigned Integer types [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) -- Better error messages if checksum mismatch is most likely caused by hardware failures. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Check that underlying tables support sampling for `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([Ivan](https://github.com/abyss7)) -- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Improvements of MySQL Wire Protocol. Changed name of format to MySQLWire. Using RAII for calling RSA\_free. Disabling SSL if context cannot be created. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) -- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) -- Respect query settings in asynchronous INSERTs into Distributed tables. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) -- Renamed functions `leastSqr` to `simpleLinearRegression`, `LinearRegression` to `linearRegression`, `LogisticRegression` to `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Performance Improvements {#performance-improvements} - -- Parallelize processing of parts of non-replicated MergeTree tables in ALTER MODIFY query. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) -- Optimizations in regular expressions extraction. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) -- Do not add right join key column to join result if it’s used only in join on section. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) -- Freeze the Kafka buffer after first empty response. It avoids multiple invokations of `ReadBuffer::next()` for empty result in some row-parsing streams. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([Ivan](https://github.com/abyss7)) -- `concat` function optimization for multiple arguments. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) -- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) -- Upgrade our LZ4 implementation with reference one to have faster decompression. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) -- Implemented MSD radix sort (based on kxsort), and partial sorting. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) - -#### Bug Fixes {#bug-fixes} - -- Fix push require columns with join [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Winter Zhang](https://github.com/zhang2014)) -- Fixed bug, when ClickHouse is run by systemd, the command `sudo service clickhouse-server forcerestart` was not working as expected. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) -- Fix http error codes in DataPartsExchange (interserver http server on 9009 port always returned code 200, even on errors). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) -- Fix SimpleAggregateFunction for String longer than MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) -- Fix error for `Decimal` to `Nullable(Decimal)` conversion in IN. Support other Decimal to Decimal conversions (including different scales). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed FPU clobbering in simdjson library that lead to wrong calculation of `uniqHLL` and `uniqCombined` aggregate function and math functions such as `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed handling mixed const/nonconst cases in JSON functions. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fix `retention` function. Now all conditions that satisfy in a row of data are added to the data state. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) -- Fix result type for `quantileExact` with Decimals. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Documentation {#documentation} - -- Translate documentation for `CollapsingMergeTree` to chinese. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) -- Translate some documentation about table engines to chinese. - [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) - [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) - ([never lee](https://github.com/neverlee)) - -#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements} - -- Fix some sanitizer reports that show probable use-after-free.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([Ivan](https://github.com/abyss7)) -- Move performance tests out of separate directories for convenience. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix incorrect performance tests. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) -- Added a tool to calculate checksums caused by bit flips to debug hardware issues. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Make runner script more usable. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) -- Add small instruction how to write performance tests. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) -- Add ability to make substitutions in create, fill and drop query in performance tests [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) - -## ClickHouse release 19.7 {#clickhouse-release-19-7} - -### ClickHouse release 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} - -#### Bug Fix {#bug-fix-25} - -- Fix performance regression in some queries with JOIN. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Winter Zhang](https://github.com/zhang2014)) - -### ClickHouse release 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} - -#### New features {#new-features-1} - -- Added bitmap related functions `bitmapHasAny` and `bitmapHasAll` analogous to `hasAny` and `hasAll` functions for arrays. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) - -#### Bug Fixes {#bug-fixes-1} - -- Fix segfault on `minmax` INDEX with Null value. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) -- Mark all input columns in LIMIT BY as required output. It fixes ‘Not found column’ error in some distributed queries. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) -- Fix “Column ‘0’ already exists” error in `SELECT .. PREWHERE` on column with DEFAULT [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) -- Fix `ALTER MODIFY TTL` query on `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) -- Don’t crash the server when Kafka consumers have failed to start. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([Ivan](https://github.com/abyss7)) -- Fixed bitmap functions produce wrong result. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Andy Yang](https://github.com/andyyzh)) -- Fix element\_count for hashed dictionary (do not include duplicates) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) -- Use contents of environment variable TZ as the name for timezone. It helps to correctly detect default timezone in some cases.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) -- Do not try to convert integers in `dictGetT` functions, because it doesn’t work correctly. Throw an exception instead. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix settings in ExternalData HTTP request. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila - Kutenin](https://github.com/danlark1)) -- Fix bug when parts were removed only from FS without dropping them from Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- Fix segmentation fault in `bitmapHasAny` function. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Fixed error when replication connection pool doesn’t retry to resolve host, even when DNS cache was dropped. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- Fixed `DROP INDEX IF EXISTS` query. Now `ALTER TABLE ... DROP INDEX IF EXISTS ...` query doesn’t raise an exception if provided index does not exist. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Fix union all supertype column. There were cases with inconsistent data and column types of resulting columns. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- Skip ZNONODE during DDL query processing. Before if another node removes the znode in task queue, the one that - did not process it, but already get list of children, will terminate the DDLWorker thread. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Fix INSERT into Distributed() table with MATERIALIZED column. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) - -### ClickHouse release 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} - -#### New Features {#new-features-2} - -- Allow to limit the range of a setting that can be specified by user. - These constraints can be set up in user settings profile. - [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly - Baranov](https://github.com/vitlibar)) -- Add a second version of the function `groupUniqArray` with an optional - `max_size` parameter that limits the size of the resulting array. This - behavior is similar to `groupArray(max_size)(x)` function. - [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- For TSVWithNames/CSVWithNames input file formats, column order can now be - determined from file header. This is controlled by - `input_format_with_names_use_header` parameter. - [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) - ([Alexander](https://github.com/Akazz)) - -#### Bug Fixes {#bug-fixes-2} - -- Crash with uncompressed\_cache + JOIN during merge (\#5197) - [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila - Kutenin](https://github.com/danlark1)) -- Segmentation fault on a clickhouse-client query to system tables. \#5066 - [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) - ([Ivan](https://github.com/abyss7)) -- Data loss on heavy load via KafkaEngine (\#4736) - [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) - ([Ivan](https://github.com/abyss7)) -- Fixed very rare data race condition that could happen when executing a query with UNION ALL involving at least two SELECTs from system.columns, system.tables, system.parts, system.parts\_tables or tables of Merge family and performing ALTER of columns of the related tables concurrently. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Performance Improvements {#performance-improvements-1} - -- Use radix sort for sorting by single numeric column in `ORDER BY` without - `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), - [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) - ([Evgenii Pravda](https://github.com/kvinty), - [alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Documentation {#documentation-1} - -- Translate documentation for some table engines to Chinese. - [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), - [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), - [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) - ([张风啸](https://github.com/AlexZFX)), - [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([never - lee](https://github.com/neverlee)) - -#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-1} - -- Print UTF-8 characters properly in `clickhouse-test`. - [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add command line parameter for clickhouse-client to always load suggestion - data. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Resolve some of PVS-Studio warnings. - [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Update LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila - Kutenin](https://github.com/danlark1)) -- Add gperf to build requirements for upcoming pull request \#5030. - [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) - ([proller](https://github.com/proller)) - -## ClickHouse release 19.6 {#clickhouse-release-19-6} - -### ClickHouse release 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} - -#### Bug Fixes {#bug-fixes-3} - -- Fixed IN condition pushdown for queries from table functions `mysql` and `odbc` and corresponding table engines. This fixes \#3540 and \#2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix deadlock in Zookeeper. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) -- Allow quoted decimals in CSV. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) -- Disallow conversion from float Inf/NaN into Decimals (throw exception). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix data race in rename query. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([Winter Zhang](https://github.com/zhang2014)) -- Temporarily disable LFAlloc. Usage of LFAlloc might lead to a lot of MAP\_FAILED in allocating UncompressedCache and in a result to crashes of queries at high loaded servers. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) - -### ClickHouse release 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} - -#### New Features {#new-features-3} - -- TTL expressions for columns and tables. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) -- Added support for `brotli` compression for HTTP responses (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mikhail](https://github.com/fandyushin)) -- Added new function `isValidUTF8` for checking whether a set of bytes is correctly utf-8 encoded. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) -- Add new load balancing policy `first_or_random` which sends queries to the first specified host and if it’s inaccessible send queries to random hosts of shard. Useful for cross-replication topology setups. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) - -#### Experimental Features {#experimental-features-1} - -- Add setting `index_granularity_bytes` (adaptive index granularity) for MergeTree\* tables family. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) - -#### Improvements {#improvements-1} - -- Added support for non-constant and negative size and length arguments for function `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Disable push-down to right table in left join, left table in right join, and both tables in full join. This fixes wrong JOIN results in some cases. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([Ivan](https://github.com/abyss7)) -- `clickhouse-copier`: auto upload task configuration from `--task-file` option [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) -- Added typos handler for storage factory and table functions factory. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) -- Support asterisks and qualified asterisks for multiple joins without subqueries [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) -- Make missing column error message more user friendly. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Performance Improvements {#performance-improvements-2} - -- Significant speedup of ASOF JOIN [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) - -#### Backward Incompatible Changes {#backward-incompatible-changes} - -- HTTP header `Query-Id` was renamed to `X-ClickHouse-Query-Id` for consistency. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mikhail](https://github.com/fandyushin)) - -#### Bug Fixes {#bug-fixes-4} - -- Fixed potential null pointer dereference in `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) -- Fixed error on query with JOIN + ARRAY JOIN [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed hanging on start of the server when a dictionary depends on another dictionary via a database with engine=Dictionary. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) -- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix potentially wrong result for `SELECT DISTINCT` with `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed very rare data race condition that could happen when executing a query with UNION ALL involving at least two SELECTs from system.columns, system.tables, system.parts, system.parts\_tables or tables of Merge family and performing ALTER of columns of the related tables concurrently. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-2} - -- Fixed test failures when running clickhouse-server on different host [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) -- clickhouse-test: Disable color control sequences in non tty environment. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) -- clickhouse-test: Allow use any test database (remove `test.` qualification where it possible) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) -- Fix ubsan errors [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Yandex LFAlloc was added to ClickHouse to allocate MarkCache and UncompressedCache data in different ways to catch segfaults more reliable [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) -- Python util to help with backports and changelogs. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([Ivan](https://github.com/abyss7)) - -## ClickHouse release 19.5 {#clickhouse-release-19-5} - -### ClickHouse release 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} - -#### Bug fixes {#bug-fixes-5} - -- Fixed possible crash in bitmap\* functions [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Andy Yang](https://github.com/andyyzh)) -- Fixed very rare data race condition that could happen when executing a query with UNION ALL involving at least two SELECTs from system.columns, system.tables, system.parts, system.parts\_tables or tables of Merge family and performing ALTER of columns of the related tables concurrently. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed error `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. This error happened if LowCardinality column was the part of primary key. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Modification of retention function: If a row satisfies both the first and NTH condition, only the first satisfied condition is added to the data state. Now all conditions that satisfy in a row of data are added to the data state. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) - -### ClickHouse release 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} - -#### Bug fixes {#bug-fixes-6} - -- Fixed type of setting `max_partitions_per_insert_block` from boolean to UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Mohammad Hossein Sekhavat](https://github.com/mhsekhavat)) - -### ClickHouse release 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} - -#### New Features {#new-features-4} - -- [Hyperscan](https://github.com/intel/hyperscan) multiple regular expression matching was added (functions `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) -- `multiSearchFirstPosition` function was added. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) -- Implement the predefined expression filter per row for tables. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([Ivan](https://github.com/abyss7)) -- A new type of data skipping indices based on bloom filters (can be used for `equal`, `in` and `like` functions). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) -- Added `ASOF JOIN` which allows to run queries that join to the most recent value known. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) -- Rewrite multiple `COMMA JOIN` to `CROSS JOIN`. Then rewrite them to `INNER JOIN` if possible. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Improvement {#improvement-9} - -- `topK` and `topKWeighted` now supports custom `loadFactor` (fixes issue [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) -- Allow to use `parallel_replicas_count > 1` even for tables without sampling (the setting is simply ignored for them). In previous versions it was lead to exception. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) -- Support for `CREATE OR REPLACE VIEW`. Allow to create a view or set a new definition in a single statement. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) -- `Buffer` table engine now supports `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Yangkuan Liu](https://github.com/LiuYangkuan)) -- Add ability to start replicated table without metadata in zookeeper in `readonly` mode. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) -- Fixed flicker of progress bar in clickhouse-client. The issue was most noticeable when using `FORMAT Null` with streaming queries. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Allow to disable functions with `hyperscan` library on per user basis to limit potentially excessive and uncontrolled resource usage. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add version number logging in all errors. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) -- Added restriction to the `multiMatch` functions which requires string size to fit into `unsigned int`. Also added the number of arguments limit to the `multiSearch` functions. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) -- Improved usage of scratch space and error handling in Hyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) -- Fill `system.graphite_detentions` from a table config of `*GraphiteMergeTree` engine tables. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Rename `trigramDistance` function to `ngramDistance` and add more functions with `CaseInsensitive` and `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) -- Improved data skipping indices calculation. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) -- Keep ordinary, `DEFAULT`, `MATERIALIZED` and `ALIAS` columns in a single list (fixes issue [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -#### Bug Fix {#bug-fix-26} - -- Avoid `std::terminate` in case of memory allocation failure. Now `std::bad_alloc` exception is thrown as expected. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixes capnproto reading from buffer. Sometimes files wasn’t loaded successfully by HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Fix error `Unknown log entry type: 0` after `OPTIMIZE TABLE FINAL` query. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Bird](https://github.com/amosbird)) -- Wrong arguments to `hasAny` or `hasAll` functions may lead to segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Deadlock may happen while executing `DROP DATABASE dictionary` query. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix undefined behavior in `median` and `quantile` functions. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- Fix compression level detection when `network_compression_method` in lowercase. Broken in v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- Fixed ignorance of `UTC` setting (fixes issue [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- Fix `histogram` function behaviour with `Distributed` tables. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- Fixed tsan report `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed TSan report on shutdown due to race condition in system logs usage. Fixed potential use-after-free on shutdown when part\_log is enabled. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix recheck parts in `ReplicatedMergeTreeAlterThread` in case of error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Arithmetic operations on intermediate aggregate function states were not working for constant arguments (such as subquery results). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Always backquote column names in metadata. Otherwise it’s impossible to create a table with column named `index` (server won’t restart due to malformed `ATTACH` query in metadata). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix crash in `ALTER ... MODIFY ORDER BY` on `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- Fix segfault in `JOIN ON` with enabled `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Winter Zhang](https://github.com/zhang2014)) -- Fix bug with adding an extraneous row after consuming a protobuf message from Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fix crash of `JOIN` on not-nullable vs nullable column. Fix `NULLs` in right keys in `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Fixed race condition in `SELECT` from `system.tables` if the table is renamed or altered concurrently. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed data race when fetching data part that is already obsolete. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed rare data race that can happen during `RENAME` table of MergeTree family. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed segmentation fault in function `arrayIntersect`. Segmentation fault could happen if function was called with mixed constant and ordinary arguments. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix crash in `FULL/RIGHT JOIN` when we joining on nullable vs not nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix `No message received` exception while fetching parts between replicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- Fixed `arrayIntersect` function wrong result in case of several repeated values in single array. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix a race condition during concurrent `ALTER COLUMN` queries that could lead to a server crash (fixes issue [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fix incorrect result in `FULL/RIGHT JOIN` with const column. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix duplicates in `GLOBAL JOIN` with asterisk. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix parameter deduction in `ALTER MODIFY` of column `CODEC` when column type is not specified. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- Functions `cutQueryStringAndFragment()` and `queryStringAndFragment()` now works correctly when `URL` contains a fragment and no query. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fix rare bug when setting `min_bytes_to_use_direct_io` is greater than zero, which occures when thread have to seek backward in column file. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- Fix wrong argument types for aggregate functions with `LowCardinality` arguments (fixes issue [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix wrong name qualification in `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix function `toISOWeek` result for year 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix `DROP`, `TRUNCATE` and `OPTIMIZE` queries duplication, when executed on `ON CLUSTER` for `ReplicatedMergeTree*` tables family. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### Backward Incompatible Change {#backward-incompatible-change-8} - -- Rename setting `insert_sample_with_metadata` to setting `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) -- Added setting `max_partitions_per_insert_block` (with value 100 by default). If inserted block contains larger number of partitions, an exception is thrown. Set it to 0 if you want to remove the limit (not recommended). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Multi-search functions were renamed (`multiPosition` to `multiSearchAllPositions`, `multiSearch` to `multiSearchAny`, `firstMatch` to `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) - -#### Performance Improvement {#performance-improvement-6} - -- Optimize Volnitsky searcher by inlining, giving about 5-10% search improvement for queries with many needles or many similar bigrams. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) -- Fix performance issue when setting `use_uncompressed_cache` is greater than zero, which appeared when all read data contained in cache. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-10} - -- Hardening debug build: more granular memory mappings and ASLR; add memory protection for mark cache and index. This allows to find more memory stomping bugs in case when ASan and MSan cannot do it. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add support for cmake variables `ENABLE_PROTOBUF`, `ENABLE_PARQUET` and `ENABLE_BROTLI` which allows to enable/disable the above features (same as we can do for librdkafka, mysql, etc). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) -- Add ability to print process list and stacktraces of all threads if some queries are hung after test run. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) -- Add retries on `Connection loss` error in `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) -- Add freebsd build with vagrant and build with thread sanitizer to packager script. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) -- Now user asked for password for user `'default'` during installation. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) -- Suppress warning in `rdkafka` library. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Allow ability to build without ssl. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) -- Add a way to launch clickhouse-server image from a custom user. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Upgrade contrib boost to 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) -- Disable usage of `mremap` when compiled with Thread Sanitizer. Surprisingly enough, TSan does not intercept `mremap` (though it does intercept `mmap`, `munmap`) that leads to false positives. Fixed TSan report in stateful tests. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add test checking using format schema via HTTP interface. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) - -## ClickHouse release 19.4 {#clickhouse-release-19-4} - -### ClickHouse release 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} - -#### Bug Fixes {#bug-fixes-7} - -- Avoid `std::terminate` in case of memory allocation failure. Now `std::bad_alloc` exception is thrown as expected. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixes capnproto reading from buffer. Sometimes files wasn’t loaded successfully by HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Fix error `Unknown log entry type: 0` after `OPTIMIZE TABLE FINAL` query. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Bird](https://github.com/amosbird)) -- Wrong arguments to `hasAny` or `hasAll` functions may lead to segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Deadlock may happen while executing `DROP DATABASE dictionary` query. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix undefined behavior in `median` and `quantile` functions. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- Fix compression level detection when `network_compression_method` in lowercase. Broken in v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- Fixed ignorance of `UTC` setting (fixes issue [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- Fix `histogram` function behaviour with `Distributed` tables. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- Fixed tsan report `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed TSan report on shutdown due to race condition in system logs usage. Fixed potential use-after-free on shutdown when part\_log is enabled. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix recheck parts in `ReplicatedMergeTreeAlterThread` in case of error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Arithmetic operations on intermediate aggregate function states were not working for constant arguments (such as subquery results). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Always backquote column names in metadata. Otherwise it’s impossible to create a table with column named `index` (server won’t restart due to malformed `ATTACH` query in metadata). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix crash in `ALTER ... MODIFY ORDER BY` on `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- Fix segfault in `JOIN ON` with enabled `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Winter Zhang](https://github.com/zhang2014)) -- Fix bug with adding an extraneous row after consuming a protobuf message from Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Fixed race condition in `SELECT` from `system.tables` if the table is renamed or altered concurrently. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed data race when fetching data part that is already obsolete. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed rare data race that can happen during `RENAME` table of MergeTree family. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed segmentation fault in function `arrayIntersect`. Segmentation fault could happen if function was called with mixed constant and ordinary arguments. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix `No message received` exception while fetching parts between replicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- Fixed `arrayIntersect` function wrong result in case of several repeated values in single array. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix a race condition during concurrent `ALTER COLUMN` queries that could lead to a server crash (fixes issue [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fix parameter deduction in `ALTER MODIFY` of column `CODEC` when column type is not specified. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- Functions `cutQueryStringAndFragment()` and `queryStringAndFragment()` now works correctly when `URL` contains a fragment and no query. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fix rare bug when setting `min_bytes_to_use_direct_io` is greater than zero, which occures when thread have to seek backward in column file. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- Fix wrong argument types for aggregate functions with `LowCardinality` arguments (fixes issue [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix function `toISOWeek` result for year 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix `DROP`, `TRUNCATE` and `OPTIMIZE` queries duplication, when executed on `ON CLUSTER` for `ReplicatedMergeTree*` tables family. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### Improvements {#improvements-2} - -- Keep ordinary, `DEFAULT`, `MATERIALIZED` and `ALIAS` columns in a single list (fixes issue [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -### ClickHouse release 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} - -#### Bug Fixes {#bug-fixes-8} - -- Fix crash in `FULL/RIGHT JOIN` when we joining on nullable vs not nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-11} - -- Add a way to launch clickhouse-server image from a custom user. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### ClickHouse release 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} - -#### Bug Fixes {#bug-fixes-9} - -- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### ClickHouse release 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} - -#### Bug Fixes {#bug-fixes-10} - -- Fixed remote queries which contain both `LIMIT BY` and `LIMIT`. Previously, if `LIMIT BY` and `LIMIT` were used for remote query, `LIMIT` could happen before `LIMIT BY`, which led to too filtered result. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) - -### ClickHouse release 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} - -#### New Features {#new-features-5} - -- Added full support for `Protobuf` format (input and output, nested data structures). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) -- Added bitmap functions with Roaring Bitmaps. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Andy Yang](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) -- Parquet format support. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) -- N-gram distance was added for fuzzy string comparison. It is similar to q-gram metrics in R language. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) -- Combine rules for graphite rollup from dedicated aggregation and retention patterns. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Added `max_execution_speed` and `max_execution_speed_bytes` to limit resource usage. Added `min_execution_speed_bytes` setting to complement the `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([Winter Zhang](https://github.com/zhang2014)) -- Implemented function `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) -- Added functions `arrayEnumerateDenseRanked` and `arrayEnumerateUniqRanked` (it’s like `arrayEnumerateUniq` but allows to fine tune array depth to look inside multidimensional arrays). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Bug Fixes {#bug-fixes-11} - -- This release also contains all bug fixes from 19.3 and 19.1. -- Fixed bug in data skipping indices: order of granules after INSERT was incorrect. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) -- Fixed `set` index for `Nullable` and `LowCardinality` columns. Before it, `set` index with `Nullable` or `LowCardinality` column led to error `Data type must be deserialized with multiple streams` while selecting. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correctly set update\_time on full `executable` dictionary update. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) -- Fix broken progress bar in 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) -- Fixed inconsistent values of MemoryTracker when memory region was shrinked, in certain cases. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed undefined behaviour in ThreadPool. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed a very rare crash with the message `mutex lock failed: Invalid argument` that could happen when a MergeTree table was dropped concurrently with a SELECT. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) -- ODBC driver compatibility with `LowCardinality` data type. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) -- FreeBSD: Fixup for `AIOcontextPool: Found io_event with unknown id 0` error. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `system.part_log` table was created regardless to configuration. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix undefined behaviour in `dictIsIn` function for cache dictionaries. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) -- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) -- Disable compile\_expressions by default until we get own `llvm` contrib and can test it with `clang` and `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) -- Prevent `std::terminate` when `invalidate_query` for `clickhouse` external dictionary source has returned wrong resultset (empty or more than one row or more than one column). Fixed issue when the `invalidate_query` was performed every five seconds regardless to the `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Avoid deadlock when the `invalidate_query` for a dictionary with `clickhouse` source was involving `system.dictionaries` table or `Dictionaries` database (rare case). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixes for CROSS JOIN with empty WHERE. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed segfault in function “replicate” when constant argument is passed. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix lambda function with predicate optimizer. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([Winter Zhang](https://github.com/zhang2014)) -- Multiple JOINs multiple fixes. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Improvements {#improvements-3} - -- Support aliases in JOIN ON section for right table columns. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) -- Result of multiple JOINs need correct result names to be used in subselects. Replace flat aliases with source names in result. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) -- Improve push-down logic for joined statements. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([Ivan](https://github.com/abyss7)) - -#### Performance Improvements {#performance-improvements-3} - -- Improved heuristics of “move to PREWHERE” optimization. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Use proper lookup tables that uses HashTable’s API for 8-bit and 16-bit keys. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos Bird](https://github.com/amosbird)) -- Improved performance of string comparison. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cleanup distributed DDL queue in a separate thread so that it doesn’t slow down the main loop that processes distributed DDL tasks. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) -- When `min_bytes_to_use_direct_io` is set to 1, not every file was opened with O\_DIRECT mode because the data size to read was sometimes underestimated by the size of one compressed block. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-12} - -- Added support for clang-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix wrong `__asm__` instructions (again) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) -- Add ability to specify settings for `clickhouse-performance-test` from command line. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) -- Add dictionaries tests to integration tests. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) -- Added queries from the benchmark on the website to automated performance tests. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `xxhash.h` does not exist in external lz4 because it is an implementation detail and its symbols are namespaced with `XXH_NAMESPACE` macro. When lz4 is external, xxHash has to be external too, and the dependents have to link to it. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) -- Fixed a case when `quantileTiming` aggregate function can be called with negative or floating point argument (this fixes fuzz test with undefined behaviour sanitizer). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Spelling error correction. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) -- Fix compilation on Mac. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) -- Build fixes for FreeBSD and various unusual build configurations. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) - -## ClickHouse release 19.3 {#clickhouse-release-19-3} - -### ClickHouse release 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} - -#### Bug Fixes {#bug-fixes-12} - -- Fix crash in `FULL/RIGHT JOIN` when we joining on nullable vs not nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix segmentation fault in `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Fixed reading from `Array(LowCardinality)` column in rare case when column contained a long sequence of empty arrays. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-13} - -- Add a way to launch clickhouse-server image from a custom user [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### ClickHouse release 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} - -#### Bug fixes {#bug-fixes-13} - -- Fixed error in \#3920. This error manifests itself as random cache corruption (messages `Unknown codec family code`, `Cannot seek through file`) and segfaults. This bug first appeared in version 19.1 and is present in versions up to 19.1.10 and 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} - -#### Bug fixes {#bug-fixes-14} - -- When there are more than 1000 threads in a thread pool, `std::terminate` may happen on thread exit. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Now it’s possible to create `ReplicatedMergeTree*` tables with comments on columns without defaults and tables with columns codecs without comments and defaults. Also fix comparison of codecs. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) -- Fixed crash on JOIN with array or tuple. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed crash in clickhouse-copier with the message `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed hangup on server shutdown if distributed DDLs were used. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) -- Incorrect column numbers were printed in error message about text format parsing for columns with number greater than 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-3} - -- Fixed build with AVX enabled. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Enable extended accounting and IO accounting based on good known version instead of kernel under which it is compiled. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) -- Allow to skip setting of core\_dump.size\_limit, warning instead of throw if limit set fail. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) -- Removed the `inline` tags of `void readBinary(...)` in `Field.cpp`. Also merged redundant `namespace DB` blocks. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) - -### ClickHouse release 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} - -#### Bug fixes {#bug-fixes-15} - -- Fixed bug with large http insert queries processing. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) -- Fixed backward incompatibility with old versions due to wrong implementation of `send_logs_level` setting. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed backward incompatibility of table function `remote` introduced with column comments. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} - -#### Improvements {#improvements-4} - -- Table index size is not accounted for memory limits when doing `ATTACH TABLE` query. Avoided the possibility that a table cannot be attached after being detached. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Slightly raised up the limit on max string and array size received from ZooKeeper. It allows to continue to work with increased size of `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` on ZooKeeper. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Allow to repair abandoned replica even if it already has huge number of nodes in its queue. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Add one required argument to `SET` index (max stored rows number). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Bug Fixes {#bug-fixes-16} - -- Fixed `WITH ROLLUP` result for group by single `LowCardinality` key. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixed bug in the set index (dropping a granule if it contains more than `max_rows` rows). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) -- A lot of FreeBSD build fixes. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) -- Fixed aliases substitution in queries with subquery containing same alias (issue [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-4} - -- Add ability to run `clickhouse-server` for stateless tests in docker image. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) - -### ClickHouse release 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} - -#### New Features {#new-features-6} - -- Added the `KILL MUTATION` statement that allows removing mutations that are for some reasons stuck. Added `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` fields to the `system.mutations` table for easier troubleshooting. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) -- Added aggregate function `entropy` which computes Shannon entropy. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) -- Added ability to send queries `INSERT INTO tbl VALUES (....` to server without splitting on `query` and `data` parts. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) -- Generic implementation of `arrayWithConstant` function was added. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Implemented `NOT BETWEEN` comparison operator. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) -- Implement `sumMapFiltered` in order to be able to limit the number of keys for which values will be summed by `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Added support of `Nullable` types in `mysql` table function. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) -- Support for arbitrary constant expressions in `LIMIT` clause. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) -- Added `topKWeighted` aggregate function that takes additional argument with (unsigned integer) weight. [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Andrew Golman](https://github.com/andrewgolman)) -- `StorageJoin` now supports `join_any_take_last_row` setting that allows overwriting existing values of the same key. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos Bird](https://github.com/amosbird) -- Added function `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) -- Added `RowBinaryWithNamesAndTypes` format. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) -- Added `IPv4` and `IPv6` data types. More effective implementations of `IPv*` functions. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) -- Added function `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) -- Added `Protobuf` output format. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) -- Added brotli support for HTTP interface for data import (INSERTs). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mikhail](https://github.com/fandyushin)) -- Added hints while user make typo in function name or type in command line client. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) -- Added `Query-Id` to Server’s HTTP Response header. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mikhail](https://github.com/fandyushin)) - -#### Experimental features {#experimental-features-2} - -- Added `minmax` and `set` data skipping indices for MergeTree table engines family. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- Added conversion of `CROSS JOIN` to `INNER JOIN` if possible. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Bug Fixes {#bug-fixes-17} - -- Fixed `Not found column` for duplicate columns in `JOIN ON` section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Make `START REPLICATED SENDS` command start replicated sends. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- Fixed aggregate functions execution with `Array(LowCardinality)` arguments. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fixed wrong behaviour when doing `INSERT ... SELECT ... FROM file(...)` query and file has `CSVWithNames` or `TSVWIthNames` format and the first data row is missing. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed crash on dictionary reload if dictionary not available. This bug was appeared in 19.1.6. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- Fixed `ALL JOIN` with duplicates in right table. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed segmentation fault with `use_uncompressed_cache=1` and exception with wrong uncompressed size. This bug was appeared in 19.1.6. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- Fixed `compile_expressions` bug with comparison of big (more than int16) dates. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- Fixed infinite loop when selecting from table function `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Temporarily disable predicate optimization for `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Winter Zhang](https://github.com/zhang2014)) -- Fixed `Illegal instruction` error when using base64 functions on old CPUs. This error has been reproduced only when ClickHouse was compiled with gcc-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed `No message received` error when interacting with PostgreSQL ODBC Driver through TLS connection. Also fixes segfault when using MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed incorrect result when `Date` and `DateTime` arguments are used in branches of conditional operator (function `if`). Added generic case for function `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse dictionaries now load within `clickhouse` process. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed deadlock when `SELECT` from a table with `File` engine was retried after `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed race condition when selecting from `system.tables` may give `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-client` can segfault on exit while loading data for command line suggestions if it was run in interactive mode. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed a bug when the execution of mutations containing `IN` operators was producing incorrect results. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fixed error: if there is a database with `Dictionary` engine, all dictionaries forced to load at server startup, and if there is a dictionary with ClickHouse source from localhost, the dictionary cannot load. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed error when system logs are tried to create again at server shutdown. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Correctly return the right type and properly handle locks in `joinGet` function. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Bird](https://github.com/amosbird)) -- Added `sumMapWithOverflow` function. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Fixed segfault with `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed bug with incorrect `Date` and `DateTime` comparison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- Fixed fuzz test under undefined behavior sanitizer: added parameter type check for `quantile*Weighted` family of functions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed rare race condition when removing of old data parts can fail with `File not found` error. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix install package with missing /etc/clickhouse-server/config.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-5} - -- Debian package: correct /etc/clickhouse-server/preprocessed link according to config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- Various build fixes for FreeBSD. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) -- Added ability to create, fill and drop tables in perftest. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) -- Added a script to check for duplicate includes. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added ability to run queries by index in performance test. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) -- Package with debug symbols is suggested to be installed. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Refactoring of performance-test. Better logging and signals handling. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) -- Added docs to anonymized Yandex.Metrika datasets. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) -- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) -- Added docs about two datasets in s3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) -- Added script which creates changelog from pull requests description. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Added puppet module for ClickHouse. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- Added docs for a group of undocumented functions. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([Winter Zhang](https://github.com/zhang2014)) -- ARM build fixes. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) -- Dictionary tests now able to run from `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) -- Now `/etc/ssl` is used as default directory with SSL certificates. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added checking SSE and AVX instruction at start. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) -- Init script will wait server until start. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) - -#### Backward Incompatible Changes {#backward-incompatible-changes-1} - -- Removed `allow_experimental_low_cardinality_type` setting. `LowCardinality` data types are production ready. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Reduce mark cache size and uncompressed cache size accordingly to available memory amount. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) -- Added keyword `INDEX` in `CREATE TABLE` query. A column with name `index` must be quoted with backticks or double quotes: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- `sumMap` now promote result type instead of overflow. The old `sumMap` behavior can be obtained by using `sumMapWithOverflow` function. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) - -#### Performance Improvements {#performance-improvements-4} - -- `std::sort` replaced by `pdqsort` for queries without `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) -- Now server reuse threads from global thread pool. This affects performance in some corner cases. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Improvements {#improvements-5} - -- Implemented AIO support for FreeBSD. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `SELECT * FROM a JOIN b USING a, b` now return `a` and `b` columns only from the left table. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) -- Allow `-C` option of client to work as `-c` option. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) -- Now option `--password` used without value requires password from stdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) -- Added highlighting of unescaped metacharacters in string literals that contain `LIKE` expressions or regexps. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added cancelling of HTTP read only queries if client socket goes away. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) -- Now server reports progress to keep client connections alive. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([Ivan](https://github.com/abyss7)) -- Slightly better message with reason for OPTIMIZE query with `optimize_throw_if_noop` setting enabled. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added support of `--version` option for clickhouse server. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) -- Added `--help/-h` option to `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) -- Added support for scalar subqueries with aggregate function state result. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Improved server shutdown time and ALTERs waiting time. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added info about the replicated\_can\_become\_leader setting to system.replicas and add logging if the replica won’t try to become leader. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) - -## ClickHouse release 19.1 {#clickhouse-release-19-1} - -### ClickHouse release 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} - -- Fixed error `Column ... queried more than once` that may happen if the setting `asterisk_left_columns_only` is set to 1 in case of using `GLOBAL JOIN` with `SELECT *` (rare case). The issue does not exist in 19.3 and newer. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouse release 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} - -This release contains exactly the same set of patches as 19.3.7. - -### ClickHouse release 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} - -This release contains exactly the same set of patches as 19.3.6. - -## ClickHouse release 19.1 {#clickhouse-release-19-1-1} - -### ClickHouse release 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} - -#### Bug fixes {#bug-fixes-18} - -- Fixed backward incompatibility with old versions due to wrong implementation of `send_logs_level` setting. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed backward incompatibility of table function `remote` introduced with column comments. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} - -#### Bug Fixes {#bug-fixes-19} - -- Fix install package with missing /etc/clickhouse-server/config.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -## ClickHouse release 19.1 {#clickhouse-release-19-1-2} - -### ClickHouse release 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} - -#### Bug Fixes {#bug-fixes-20} - -- Correctly return the right type and properly handle locks in `joinGet` function. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Bird](https://github.com/amosbird)) -- Fixed error when system logs are tried to create again at server shutdown. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed error: if there is a database with `Dictionary` engine, all dictionaries forced to load at server startup, and if there is a dictionary with ClickHouse source from localhost, the dictionary cannot load. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed a bug when the execution of mutations containing `IN` operators was producing incorrect results. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- `clickhouse-client` can segfault on exit while loading data for command line suggestions if it was run in interactive mode. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed race condition when selecting from `system.tables` may give `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed deadlock when `SELECT` from a table with `File` engine was retried after `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed an issue: local ClickHouse dictionaries are loaded via TCP, but should load within process. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed `No message received` error when interacting with PostgreSQL ODBC Driver through TLS connection. Also fixes segfault when using MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Temporarily disable predicate optimization for `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Winter Zhang](https://github.com/zhang2014)) -- Fixed infinite loop when selecting from table function `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed `compile_expressions` bug with comparison of big (more than int16) dates. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- Fixed segmentation fault with `uncompressed_cache=1` and exception with wrong uncompressed size. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- Fixed `ALL JOIN` with duplicates in right table. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixed wrong behaviour when doing `INSERT ... SELECT ... FROM file(...)` query and file has `CSVWithNames` or `TSVWIthNames` format and the first data row is missing. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed aggregate functions execution with `Array(LowCardinality)` arguments. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Debian package: correct /etc/clickhouse-server/preprocessed link according to config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- Fixed fuzz test under undefined behavior sanitizer: added parameter type check for `quantile*Weighted` family of functions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Make `START REPLICATED SENDS` command start replicated sends. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- Fixed `Not found column` for duplicate columns in JOIN ON section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Now `/etc/ssl` is used as default directory with SSL certificates. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed crash on dictionary reload if dictionary not available. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- Fixed bug with incorrect `Date` and `DateTime` comparison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- Fixed incorrect result when `Date` and `DateTime` arguments are used in branches of conditional operator (function `if`). Added generic case for function `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse release 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} - -#### New Features {#new-features-7} - -- Custom per column compression codecs for tables. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [Winter Zhang](https://github.com/zhang2014), [Anatoly](https://github.com/Sindbag)) -- Added compression codec `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) -- Allow to `ALTER` compression codecs. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) -- Added functions `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` for SQL standard compatibility. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) -- Support for write in `HDFS` tables and `hdfs` table function. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) -- Added functions to search for multiple constant strings from big haystack: `multiPosition`, `multiSearch` ,`firstMatch` also with `-UTF8`, `-CaseInsensitive`, and `-CaseInsensitiveUTF8` variants. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) -- Pruning of unused shards if `SELECT` query filters by sharding key (setting `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [Ivan](https://github.com/abyss7)) -- Allow `Kafka` engine to ignore some number of parsing errors per block. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([Ivan](https://github.com/abyss7)) -- Added support for `CatBoost` multiclass models evaluation. Function `modelEvaluate` returns tuple with per-class raw predictions for multiclass models. `libcatboostmodel.so` should be built with [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Added functions `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) -- Added hashing functions `xxHash64` and `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) -- Added `gccMurmurHash` hashing function (GCC flavoured Murmur hash) which uses the same hash seed as [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) -- Added hashing functions `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) -- Added table function `remoteSecure`. Function works as `remote`, but uses secure connection. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) - -#### Experimental features {#experimental-features-3} - -- Added multiple JOINs emulation (`allow_experimental_multiple_joins_emulation` setting). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Bug Fixes {#bug-fixes-21} - -- Make `compiled_expression_cache_size` setting limited by default to lower memory consumption. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) -- Fix a bug that led to hangups in threads that perform ALTERs of Replicated tables and in the thread that updates configuration from ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fixed a race condition when executing a distributed ALTER task. The race condition led to more than one replica trying to execute the task and all replicas except one failing with a ZooKeeper error. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fix a bug when `from_zk` config elements weren’t refreshed after a request to ZooKeeper timed out. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fix bug with wrong prefix for IPv4 subnet masks. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) -- Fixed crash (`std::terminate`) in rare cases when a new thread cannot be created due to exhausted resources. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix bug when in `remote` table function execution when wrong restrictions were used for in `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) -- Fix a leak of netlink sockets. They were placed in a pool where they were never deleted and new sockets were created at the start of a new thread when all current sockets were in use. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fix bug with closing `/proc/self/fd` directory earlier than all fds were read from `/proc` after forking `odbc-bridge` subprocess. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) -- Fixed String to UInt monotonic conversion in case of usage String in primary key. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([Winter Zhang](https://github.com/zhang2014)) -- Fixed error in calculation of integer conversion function monotonicity. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed segfault in `arrayEnumerateUniq`, `arrayEnumerateDense` functions in case of some invalid arguments. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix UB in StorageMerge. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos Bird](https://github.com/amosbird)) -- Fixed segfault in functions `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed error: functions `round`, `floor`, `trunc`, `ceil` may return bogus result when executed on integer argument and large negative scale. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed a bug induced by ‘kill query sync’ which leads to a core dump. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) -- Fix bug with long delay after empty replication queue. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) -- Fixed excessive memory usage in case of inserting into table with `LowCardinality` primary key. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fixed `LowCardinality` serialization for `Native` format in case of empty arrays. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fixed incorrect result while using distinct by single LowCardinality numeric column. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fixed specialized aggregation with LowCardinality key (in case when `compile` setting is enabled). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fix user and password forwarding for replicated tables queries. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) -- Fixed very rare race condition that can happen when listing tables in Dictionary database while reloading dictionaries. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed incorrect result when HAVING was used with ROLLUP or CUBE. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Sam Chou](https://github.com/reflection)) -- Fixed column aliases for query with `JOIN ON` syntax and distributed tables. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([Winter Zhang](https://github.com/zhang2014)) -- Fixed error in internal implementation of `quantileTDigest` (found by Artem Vakhrushev). This error never happens in ClickHouse and was relevant only for those who use ClickHouse codebase as a library directly. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Improvements {#improvements-6} - -- Support for `IF NOT EXISTS` in `ALTER TABLE ADD COLUMN` statements along with `IF EXISTS` in `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) -- Function `parseDateTimeBestEffort`: support for formats `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` and similar. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CapnProtoInputStream` now support jagged structures. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) -- Usability improvement: added a check that server process is started from the data directory’s owner. Do not allow to start server from root if the data belongs to non-root user. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-v-galtsev](https://github.com/sergey-v-galtsev)) -- Better logic of checking required columns during analysis of queries with JOINs. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) -- Decreased the number of connections in case of large number of Distributed tables in a single server. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([Winter Zhang](https://github.com/zhang2014)) -- Supported totals row for `WITH TOTALS` query for ODBC driver. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) -- Allowed to use `Enum`s as integers inside if function. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([Ivan](https://github.com/abyss7)) -- Added `low_cardinality_allow_in_native_format` setting. If disabled, do not use `LowCadrinality` type in `Native` format. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Removed some redundant objects from compiled expressions cache to lower memory usage. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) -- Add check that `SET send_logs_level = 'value'` query accept appropriate value. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) -- Fixed data type check in type conversion functions. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([Winter Zhang](https://github.com/zhang2014)) - -#### Performance Improvements {#performance-improvements-5} - -- Add a MergeTree setting `use_minimalistic_part_header_in_zookeeper`. If enabled, Replicated tables will store compact part metadata in a single part znode. This can dramatically reduce ZooKeeper snapshot size (especially if the tables have a lot of columns). Note that after enabling this setting you will not be able to downgrade to a version that doesn’t support it. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) -- Add an DFA-based implementation for functions `sequenceMatch` and `sequenceCount` in case pattern doesn’t contain time. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Performance improvement for integer numbers serialization. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos Bird](https://github.com/amosbird)) -- Zero left padding PODArray so that -1 element is always valid and zeroed. It’s used for branchless calculation of offsets. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos Bird](https://github.com/amosbird)) -- Reverted `jemalloc` version which lead to performance degradation. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Backward Incompatible Changes {#backward-incompatible-changes-2} - -- Removed undocumented feature `ALTER MODIFY PRIMARY KEY` because it was superseded by the `ALTER MODIFY ORDER BY` command. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) -- Removed function `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Forbid using scalar subqueries with result of type `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([Ivan](https://github.com/abyss7)) - -#### Build/Testing/Packaging Improvements {#buildtestingpackaging-improvements-6} - -- Added support for PowerPC (`ppc64le`) build. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) -- Stateful functional tests are run on public available dataset. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed error when the server cannot start with the `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` message within Docker or systemd-nspawn. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Updated `rdkafka` library to v1.0.0-RC5. Used cppkafka instead of raw C interface. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([Ivan](https://github.com/abyss7)) -- Updated `mariadb-client` library. Fixed one of issues found by UBSan. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Some fixes for UBSan builds. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added per-commit runs of tests with UBSan build. -- Added per-commit runs of PVS-Studio static analyzer. -- Fixed bugs found by PVS-Studio. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed glibc compatibility issues. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Move Docker images to 18.10 and add compatibility file for glibc \>= 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) -- Add env variable if user don’t want to chown directories in server Docker image. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) -- Enabled most of the warnings from `-Weverything` in clang. Enabled `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Added a few more warnings that are available only in clang 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Link to `libLLVM` rather than to individual LLVM libs when using shared linking. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) -- Added sanitizer variables for test images. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) -- `clickhouse-server` debian package will recommend `libcap2-bin` package to use `setcap` tool for setting capabilities. This is optional. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Improved compilation time, fixed includes. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) -- Added performance tests for hash functions. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) -- Fixed cyclic library dependences. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) -- Improved compilation with low available memory. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) -- Added test script to reproduce performance degradation in `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fixed misspells in comments and string literals under `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) -- Fixed typos in comments. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) - -## [Changelog for 2018](./2018.md) diff --git a/docs/en/whats_new/changelog/index.md b/docs/en/whats_new/changelog/index.md deleted file mode 100644 index 93d5f7ce960..00000000000 --- a/docs/en/whats_new/changelog/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -toc_folder_title: Changelog -toc_priority: 74 -toc_title: '2020' ---- - -{% include 'content/changelog.md' %} diff --git a/docs/es/commercial/cloud.md b/docs/es/commercial/cloud.md index d8d21359f84..e4d61390b22 100644 --- a/docs/es/commercial/cloud.md +++ b/docs/es/commercial/cloud.md @@ -3,16 +3,16 @@ machine_translated: true machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa --- -# Proveedores de servicios en la nube de ClickHouse {#clickhouse-cloud-service-providers} +# Proveedores De Servicios En La Nube De ClickHouse {#clickhouse-cloud-service-providers} !!! info "INFO" Si ha lanzado una nube pública con el servicio ClickHouse administrado, no dude en [abrir una solicitud de extracción](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/commercial/cloud.md) añadiéndolo a la siguiente lista. -## Nube de Yandex {#yandex-cloud} +## Nube De Yandex {#yandex-cloud} [Servicio administrado de Yandex para ClickHouse](https://cloud.yandex.com/services/managed-clickhouse?utm_source=referrals&utm_medium=clickhouseofficialsite&utm_campaign=link3) proporciona las siguientes características clave: -- Servicio ZooKeeper totalmente gestionado para [Replicación de ClickHouse](../engines/table_engines/mergetree_family/replication.md) +- Servicio ZooKeeper totalmente gestionado para [Replicación de ClickHouse](../engines/table-engines/mergetree-family/replication.md) - Múltiples opciones de tipo de almacenamiento - Réplicas en diferentes zonas de disponibilidad - Cifrado y aislamiento diff --git a/docs/es/development/architecture.md b/docs/es/development/architecture.md index c38dfeee9ae..384a1dddb70 100644 --- a/docs/es/development/architecture.md +++ b/docs/es/development/architecture.md @@ -5,7 +5,7 @@ toc_priority: 62 toc_title: "Descripci\xF3n general de la arquitectura ClickHouse" --- -# Descripción general de la arquitectura ClickHouse {#overview-of-clickhouse-architecture} +# Descripción General De La Arquitectura ClickHouse {#overview-of-clickhouse-architecture} ClickHouse es un verdadero DBMS orientado a columnas. Los datos se almacenan por columnas y durante la ejecución de matrices (vectores o fragmentos de columnas). Siempre que sea posible, las operaciones se envían en matrices, en lugar de en valores individuales. Se llama “vectorized query execution,” y ayuda a reducir el costo del procesamiento de datos real. @@ -25,13 +25,13 @@ Sin embargo, también es posible trabajar con valores individuales. Para represe `Field` no tiene suficiente información sobre un tipo de datos específico para una tabla. Por ejemplo, `UInt8`, `UInt16`, `UInt32`, y `UInt64` todos están representados como `UInt64` en una `Field`. -## Abstracciones con fugas {#leaky-abstractions} +## Abstracciones Con Fugas {#leaky-abstractions} `IColumn` tiene métodos para transformaciones relacionales comunes de datos, pero no satisfacen todas las necesidades. Por ejemplo, `ColumnUInt64` no tiene un método para calcular la suma de dos columnas, y `ColumnString` no tiene un método para ejecutar una búsqueda de subcadena. Estas innumerables rutinas se implementan fuera de `IColumn`. Varias funciones en columnas se pueden implementar de una manera genérica, no eficiente utilizando `IColumn` para extraer `Field` valores, o de una manera especializada utilizando el conocimiento del diseño de la memoria interna de los datos en un `IColumn` aplicación. Se implementa mediante la conversión de funciones a un `IColumn` escriba y trate con la representación interna directamente. Por ejemplo, `ColumnUInt64` tiene el `getData` método que devuelve una referencia a una matriz interna, luego una rutina separada lee o llena esa matriz directamente. Tenemos “leaky abstractions” para permitir especializaciones eficientes de varias rutinas. -## Tipos de datos {#data_types} +## Tipos De Datos {#data_types} `IDataType` es responsable de la serialización y deserialización: para leer y escribir fragmentos de columnas o valores individuales en formato binario o de texto. `IDataType` corresponde directamente a los tipos de datos en las tablas. Por ejemplo, hay `DataTypeUInt32`, `DataTypeDateTime`, `DataTypeString` y así sucesivamente. @@ -49,7 +49,7 @@ Cuando calculamos alguna función sobre columnas en un bloque, agregamos otra co Se crean bloques para cada fragmento de datos procesado. Tenga en cuenta que para el mismo tipo de cálculo, los nombres y tipos de columna siguen siendo los mismos para diferentes bloques y solo cambian los datos de columna. Es mejor dividir los datos del bloque desde el encabezado del bloque porque los tamaños de bloque pequeños tienen una gran sobrecarga de cadenas temporales para copiar shared\_ptrs y nombres de columna. -## Bloquear flujos {#block-streams} +## Bloquear Flujos {#block-streams} Los flujos de bloques son para procesar datos. Usamos flujos de bloques para leer datos de algún lugar, realizar transformaciones de datos o escribir datos en algún lugar. `IBlockInputStream` tiene el `read` método para buscar el siguiente bloque mientras esté disponible. `IBlockOutputStream` tiene el `write` método para empujar el bloque en alguna parte. @@ -120,9 +120,9 @@ Los intérpretes son responsables de crear la canalización de ejecución de con Hay funciones ordinarias y funciones agregadas. Para las funciones agregadas, consulte la siguiente sección. -Ordinary functions don't change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`de datos para implementar la ejecución de consultas vectorizadas. +Ordinary functions don’t change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`de datos para implementar la ejecución de consultas vectorizadas. -Hay algunas funciones diversas, como [BlockSize](../sql_reference/functions/other_functions.md#function-blocksize), [rowNumberInBlock](../sql_reference/functions/other_functions.md#function-rownumberinblock), y [runningAccumulate](../sql_reference/functions/other_functions.md#function-runningaccumulate), que explotan el procesamiento de bloques y violan la independencia de las filas. +Hay algunas funciones diversas, como [BlockSize](../sql-reference/functions/other-functions.md#function-blocksize), [rowNumberInBlock](../sql-reference/functions/other-functions.md#function-rownumberinblock), y [runningAccumulate](../sql-reference/functions/other-functions.md#function-runningaccumulate), que explotan el procesamiento de bloques y violan la independencia de las filas. ClickHouse tiene una tipificación fuerte, por lo que no hay conversión de tipo implícita. Si una función no admite una combinación específica de tipos, produce una excepción. Pero las funciones pueden funcionar (estar sobrecargadas) para muchas combinaciones diferentes de tipos. Por ejemplo, el `plus` función (para implementar el `+` operador) funciona para cualquier combinación de tipos numéricos: `UInt8` + `Float32`, `UInt16` + `Int8` y así sucesivamente. Además, algunas funciones variadas pueden aceptar cualquier número de argumentos, como el `concat` función. @@ -132,7 +132,7 @@ Es un excelente lugar para implementar la generación de código en tiempo de ej Debido a la ejecución de consultas vectorizadas, las funciones no se cortocircuitan. Por ejemplo, si escribe `WHERE f(x) AND g(y)`, ambos lados se calculan, incluso para las filas, cuando `f(x)` es cero (excepto cuando `f(x)` es una expresión constante cero). Pero si la selectividad del `f(x)` la condición es alta, y el cálculo de `f(x)` es mucho más barato que `g(y)`, es mejor implementar el cálculo de paso múltiple. Primero calcularía `f(x)`, a continuación, filtrar columnas por el resultado, y luego calcular `g(y)` solo para trozos de datos más pequeños y filtrados. -## Funciones agregadas {#aggregate-functions} +## Funciones Agregadas {#aggregate-functions} Las funciones agregadas son funciones con estado. Acumulan valores pasados en algún estado y le permiten obtener resultados de ese estado. Se gestionan con el `IAggregateFunction` interfaz. Los estados pueden ser bastante simples (el estado para `AggregateFunctionCount` es sólo una sola `UInt64` valor) o bastante complejo (el estado de `AggregateFunctionUniqCombined` es una combinación de una matriz lineal, una tabla hash, y un `HyperLogLog` estructura de datos probabilística). @@ -159,7 +159,7 @@ Mantenemos una compatibilidad total con versiones anteriores y posteriores para !!! note "Nota" Para la mayoría de las aplicaciones externas, recomendamos usar la interfaz HTTP porque es simple y fácil de usar. El protocolo TCP está más estrechamente vinculado a las estructuras de datos internas: utiliza un formato interno para pasar bloques de datos y utiliza marcos personalizados para datos comprimidos. No hemos lanzado una biblioteca C para ese protocolo porque requiere vincular la mayor parte de la base de código ClickHouse, lo cual no es práctico. -## Ejecución de consultas distribuidas {#distributed-query-execution} +## Ejecución De Consultas Distribuidas {#distributed-query-execution} Los servidores de una configuración de clúster son en su mayoría independientes. Puede crear un `Distributed` en uno o todos los servidores de un clúster. El `Distributed` table does not store data itself – it only provides a “view” a todas las tablas locales en varios nodos de un clúster. Cuando se SELECCIONA desde un `Distributed` tabla, reescribe esa consulta, elige nodos remotos de acuerdo con la configuración de equilibrio de carga y les envía la consulta. El `Distributed` table solicita a los servidores remotos que procesen una consulta hasta una etapa en la que se pueden fusionar resultados intermedios de diferentes servidores. Luego recibe los resultados intermedios y los fusiona. La tabla distribuida intenta distribuir tanto trabajo como sea posible a servidores remotos y no envía muchos datos intermedios a través de la red. @@ -167,7 +167,7 @@ Las cosas se vuelven más complicadas cuando tiene subconsultas en cláusulas IN No existe un plan de consulta global para la ejecución de consultas distribuidas. Cada nodo tiene su plan de consulta local para su parte del trabajo. Solo tenemos una ejecución simple de consultas distribuidas de un solo paso: enviamos consultas para nodos remotos y luego fusionamos los resultados. Pero esto no es factible para consultas complicadas con alta cardinalidad GROUP BY o con una gran cantidad de datos temporales para JOIN. En tales casos, necesitamos “reshuffle” datos entre servidores, lo que requiere una coordinación adicional. ClickHouse no admite ese tipo de ejecución de consultas, y tenemos que trabajar en ello. -## Árbol de fusión {#merge-tree} +## Árbol De fusión {#merge-tree} `MergeTree` es una familia de motores de almacenamiento que admite la indexación por clave principal. La clave principal puede ser una tupla arbitraria de columnas o expresiones. Datos en un `MergeTree` se almacena en “parts”. Cada parte almacena los datos en el orden de la clave principal, por lo que la tupla de la clave principal ordena los datos lexicográficamente. Todas las columnas de la tabla se almacenan en `column.bin` archivos en estas partes. Los archivos consisten en bloques comprimidos. Cada bloque suele ser de 64 KB a 1 MB de datos sin comprimir, dependiendo del tamaño del valor promedio. Los bloques constan de valores de columna colocados contiguamente uno tras otro. Los valores de columna están en el mismo orden para cada columna (la clave principal define el orden), por lo que cuando itera por muchas columnas, obtiene valores para las filas correspondientes. @@ -177,7 +177,7 @@ Cuando vamos a leer algo de una parte en `MergeTree` miramos `primary.idx` datos Cuando `INSERT` un montón de datos en `MergeTree`, ese grupo está ordenado por orden de clave primaria y forma una nueva parte. Hay subprocesos de fondo que seleccionan periódicamente algunas partes y las fusionan en una sola parte ordenada para mantener el número de partes relativamente bajo. Es por eso que se llama `MergeTree`. Por supuesto, la fusión conduce a “write amplification”. Todas las partes son inmutables: solo se crean y eliminan, pero no se modifican. Cuando se ejecuta SELECT, contiene una instantánea de la tabla (un conjunto de partes). Después de la fusión, también mantenemos las piezas viejas durante algún tiempo para facilitar la recuperación después de la falla, por lo que si vemos que alguna parte fusionada probablemente esté rota, podemos reemplazarla con sus partes de origen. -`MergeTree` no es un árbol de LSM porque no contiene “memtable” y “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity's sake, and because we are already inserting data in batches in our applications. +`MergeTree` no es un árbol de LSM porque no contiene “memtable” y “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity’s sake, and because we are already inserting data in batches in our applications. > Las tablas MergeTree solo pueden tener un índice (primario): no hay índices secundarios. Sería bueno permitir múltiples representaciones físicas bajo una tabla lógica, por ejemplo, para almacenar datos en más de un orden físico o incluso para permitir representaciones con datos preagregados junto con datos originales. diff --git a/docs/es/development/browse-code.md b/docs/es/development/browse-code.md new file mode 100644 index 00000000000..dfa20e016c1 --- /dev/null +++ b/docs/es/development/browse-code.md @@ -0,0 +1,14 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 63 +toc_title: "Examinar el c\xF3digo fuente de ClickHouse" +--- + +# Examinar El código Fuente De ClickHouse {#browse-clickhouse-source-code} + +Usted puede utilizar **Woboq** navegador de código en línea disponible [aqui](https://clickhouse.tech/codebrowser/html_report///ClickHouse/src/index.html). Proporciona navegación de código y resaltado semántico, búsqueda e indexación. La instantánea de código se actualiza diariamente. + +Además, puede navegar por las fuentes en [GitHub](https://github.com/ClickHouse/ClickHouse) como de costumbre. + +Si está interesado en qué IDE usar, recomendamos CLion, QT Creator, VS Code y KDevelop (con advertencias). Puedes usar cualquier IDE favorito. Vim y Emacs también cuentan. diff --git a/docs/es/development/browse_code.md b/docs/es/development/browse_code.md deleted file mode 100644 index 393577e8dca..00000000000 --- a/docs/es/development/browse_code.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 63 -toc_title: "Examinar el c\xF3digo fuente de ClickHouse" ---- - -# Examinar el código fuente de ClickHouse {#browse-clickhouse-source-code} - -Usted puede utilizar **Woboq** navegador de código en línea disponible [aqui](https://clickhouse.tech/codebrowser/html_report///ClickHouse/src/index.html). Proporciona navegación de código y resaltado semántico, búsqueda e indexación. La instantánea de código se actualiza diariamente. - -Además, puede navegar por las fuentes en [GitHub](https://github.com/ClickHouse/ClickHouse) como de costumbre. - -Si está interesado en qué IDE usar, recomendamos CLion, QT Creator, VS Code y KDevelop (con advertencias). Puedes usar cualquier IDE favorito. Vim y Emacs también cuentan. diff --git a/docs/es/development/build-cross-arm.md b/docs/es/development/build-cross-arm.md new file mode 100644 index 00000000000..7c9b6decd14 --- /dev/null +++ b/docs/es/development/build-cross-arm.md @@ -0,0 +1,43 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 67 +toc_title: "C\xF3mo construir ClickHouse en Linux para AARCH64 (ARM64)" +--- + +# Cómo Construir ClickHouse En Linux Para La Arquitectura AARCH64 (ARM64 {#how-to-build-clickhouse-on-linux-for-aarch64-arm64-architecture} + +Esto es para el caso cuando tiene una máquina Linux y desea usarla para compilar `clickhouse` binario que se ejecutará en otra máquina Linux con arquitectura de CPU AARCH64. Esto está destinado a las comprobaciones de integración continua que se ejecutan en servidores Linux. + +La compilación cruzada para AARCH64 se basa en el [Instrucciones de construcción](build.md), seguirlos primero. + +# Instalar Clang-8 {#install-clang-8} + +Siga las instrucciones de https://apt.llvm.org/ para la configuración de Ubuntu o Debian. +Por ejemplo, en Ubuntu Bionic puede usar los siguientes comandos: + +``` bash +echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" | sudo tee /etc/apt/sources.list.d/llvm.list +sudo apt-get update +sudo apt-get install clang-8 +``` + +# Instalar Conjunto De Herramientas De compilación Cruzada {#install-cross-compilation-toolset} + +``` bash +cd ClickHouse +mkdir -p build-aarch64/cmake/toolchain/linux-aarch64 +wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9&la=en' -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz +tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cmake/toolchain/linux-aarch64 --strip-components=1 +``` + +# Construir ClickHouse {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-arm64 +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake +ninja -C build-arm64 +``` + +El binario resultante se ejecutará solo en Linux con la arquitectura de CPU AARCH64. diff --git a/docs/es/development/build-cross-osx.md b/docs/es/development/build-cross-osx.md new file mode 100644 index 00000000000..a0d85fea899 --- /dev/null +++ b/docs/es/development/build-cross-osx.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 66 +toc_title: "C\xF3mo construir ClickHouse en Linux para Mac OS X" +--- + +# Cómo Construir ClickHouse En Linux Para Mac OS X {#how-to-build-clickhouse-on-linux-for-mac-os-x} + +Esto es para el caso cuando tiene una máquina Linux y desea usarla para compilar `clickhouse` Esto está destinado a las comprobaciones de integración continuas que se ejecutan en servidores Linux. Si desea crear ClickHouse directamente en Mac OS X, continúe con [otra instrucción](build-osx.md). + +La compilación cruzada para Mac OS X se basa en el [Instrucciones de construcción](build.md), seguirlos primero. + +# Instalar Clang-8 {#install-clang-8} + +Siga las instrucciones de https://apt.llvm.org/ para la configuración de Ubuntu o Debian. +Por ejemplo, los comandos para Bionic son como: + +``` bash +sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list +sudo apt-get install clang-8 +``` + +# Instalar Conjunto De Herramientas De compilación Cruzada {#install-cross-compilation-toolset} + +Recordemos la ruta donde instalamos `cctools` como ${CCTOOLS} + +``` bash +mkdir ${CCTOOLS} + +git clone https://github.com/tpoechtrager/apple-libtapi.git +cd apple-libtapi +INSTALLPREFIX=${CCTOOLS} ./build.sh +./install.sh +cd .. + +git clone https://github.com/tpoechtrager/cctools-port.git +cd cctools-port/cctools +./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin +make install +``` + +Además, necesitamos descargar macOS X SDK en el árbol de trabajo. + +``` bash +cd ClickHouse +wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' +mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 +tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 +``` + +# Construir ClickHouse {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-osx +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ + -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ + -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ + -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld +ninja -C build-osx +``` + +El binario resultante tendrá un formato ejecutable Mach-O y no se puede ejecutar en Linux. diff --git a/docs/es/development/build-osx.md b/docs/es/development/build-osx.md new file mode 100644 index 00000000000..7c3d50593ac --- /dev/null +++ b/docs/es/development/build-osx.md @@ -0,0 +1,93 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 65 +toc_title: "C\xF3mo crear ClickHouse en Mac OS X" +--- + +# Cómo Crear ClickHouse En Mac OS X {#how-to-build-clickhouse-on-mac-os-x} + +Build debería funcionar en Mac OS X 10.15 (Catalina) + +## Instalar Homebrew {#install-homebrew} + +``` bash +$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +## Instalar Compiladores, Herramientas y Bibliotecas Necesarios {#install-required-compilers-tools-and-libraries} + +``` bash +$ brew install cmake ninja libtool gettext +``` + +## Fuentes De ClickHouse De Pago {#checkout-clickhouse-sources} + +``` bash +$ git clone --recursive git@github.com:ClickHouse/ClickHouse.git +``` + +o + +``` bash +$ git clone --recursive https://github.com/ClickHouse/ClickHouse.git + +$ cd ClickHouse +``` + +## Construir ClickHouse {#build-clickhouse} + +``` bash +$ mkdir build +$ cd build +$ cmake .. -DCMAKE_CXX_COMPILER=`which clang++` -DCMAKE_C_COMPILER=`which clang` +$ ninja +$ cd .. +``` + +## Advertencia {#caveats} + +Si tiene la intención de ejecutar clickhouse-server, asegúrese de aumentar la variable maxfiles del sistema. + +!!! info "Nota" + Tendrás que usar sudo. + +Para ello, cree el siguiente archivo: + +/Library/LaunchDaemons/limit.maxfiles.lista: + +``` xml + + + + + Label + limit.maxfiles + ProgramArguments + + launchctl + limit + maxfiles + 524288 + 524288 + + RunAtLoad + + ServiceIPC + + + +``` + +Ejecute el siguiente comando: + +``` bash +$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist +``` + +Reiniciar. + +Para verificar si está funcionando, puede usar `ulimit -n` comando. + +[Artículo Original](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/es/development/build.md b/docs/es/development/build.md index e7737dfaa8d..24d20581e42 100644 --- a/docs/es/development/build.md +++ b/docs/es/development/build.md @@ -5,7 +5,7 @@ toc_priority: 64 toc_title: "C\xF3mo crear ClickHouse en Linux" --- -# Cómo construir ClickHouse para el desarrollo {#how-to-build-clickhouse-for-development} +# Cómo Construir ClickHouse Para El Desarrollo {#how-to-build-clickhouse-for-development} El siguiente tutorial se basa en el sistema Ubuntu Linux. Con los cambios apropiados, también debería funcionar en cualquier otra distribución de Linux. @@ -23,7 +23,7 @@ O cmake3 en lugar de cmake en sistemas más antiguos. Hay varias formas de hacer esto. -### Instalar desde un paquete PPA {#install-from-a-ppa-package} +### Instalar Desde Un Paquete PPA {#install-from-a-ppa-package} ``` bash $ sudo apt-get install software-properties-common @@ -32,18 +32,18 @@ $ sudo apt-get update $ sudo apt-get install gcc-9 g++-9 ``` -### Instalar desde fuentes {#install-from-sources} +### Instalar Desde Fuentes {#install-from-sources} Mira [Sistema abierto.](https://github.com/ClickHouse/ClickHouse/blob/master/utils/ci/build-gcc-from-sources.sh) -## Usar GCC 9 para compilaciones {#use-gcc-9-for-builds} +## Usar GCC 9 Para Compilaciones {#use-gcc-9-for-builds} ``` bash $ export CC=gcc-9 $ export CXX=g++-9 ``` -## Fuentes de ClickHouse de pago {#checkout-clickhouse-sources} +## Fuentes De ClickHouse De Pago {#checkout-clickhouse-sources} ``` bash $ git clone --recursive git@github.com:ClickHouse/ClickHouse.git @@ -69,7 +69,7 @@ $ cd .. Para crear un ejecutable, ejecute `ninja clickhouse`. Esto creará el `programs/clickhouse` ejecutable, que se puede usar con `client` o `server` argumento. -# Cómo construir ClickHouse en cualquier Linux {#how-to-build-clickhouse-on-any-linux} +# Cómo Construir ClickHouse En Cualquier Linux {#how-to-build-clickhouse-on-any-linux} La compilación requiere los siguientes componentes: @@ -108,7 +108,7 @@ Ejemplo de Fedora Rawhide: cmake ../ClickHouse make -j $(nproc) -# No tienes que construir ClickHouse {#you-dont-have-to-build-clickhouse} +# No Tienes Que Construir ClickHouse {#you-dont-have-to-build-clickhouse} ClickHouse está disponible en binarios y paquetes preconstruidos. Los binarios son portátiles y se pueden ejecutar en cualquier tipo de Linux. @@ -116,7 +116,7 @@ Están diseñados para lanzamientos estables, preestablecidos y de prueba, siemp Para encontrar la construcción más fresca de `master`, ir a [se compromete página](https://github.com/ClickHouse/ClickHouse/commits/master), haga clic en la primera marca de verificación verde o cruz roja cerca de confirmar, y haga clic en “Details” enlace justo después “ClickHouse Build Check”. -# Cómo construir el paquete Debian ClickHouse {#how-to-build-clickhouse-debian-package} +# Cómo Construir El Paquete Debian ClickHouse {#how-to-build-clickhouse-debian-package} ## Instalar Git y Pbuilder {#install-git-and-pbuilder} @@ -125,14 +125,14 @@ $ sudo apt-get update $ sudo apt-get install git python pbuilder debhelper lsb-release fakeroot sudo debian-archive-keyring debian-keyring ``` -## Fuentes de ClickHouse de pago {#checkout-clickhouse-sources-1} +## Fuentes De ClickHouse De Pago {#checkout-clickhouse-sources-1} ``` bash $ git clone --recursive --branch master https://github.com/ClickHouse/ClickHouse.git $ cd ClickHouse ``` -## Ejecutar secuencia de comandos de lanzamiento {#run-release-script} +## Ejecutar Secuencia De Comandos De Lanzamiento {#run-release-script} ``` bash $ ./release diff --git a/docs/es/development/build_cross_arm.md b/docs/es/development/build_cross_arm.md deleted file mode 100644 index ac325f3718c..00000000000 --- a/docs/es/development/build_cross_arm.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 67 -toc_title: "C\xF3mo construir ClickHouse en Linux para AARCH64 (ARM64)" ---- - -# Cómo construir ClickHouse en Linux para la arquitectura AARCH64 (ARM64 {#how-to-build-clickhouse-on-linux-for-aarch64-arm64-architecture} - -Esto es para el caso cuando tiene una máquina Linux y desea usarla para compilar `clickhouse` binario que se ejecutará en otra máquina Linux con arquitectura de CPU AARCH64. Esto está destinado a las comprobaciones de integración continua que se ejecutan en servidores Linux. - -La compilación cruzada para AARCH64 se basa en el [Instrucciones de construcción](build.md), seguirlos primero. - -# Instalar Clang-8 {#install-clang-8} - -Siga las instrucciones de https://apt.llvm.org/ para la configuración de Ubuntu o Debian. -Por ejemplo, en Ubuntu Bionic puede usar los siguientes comandos: - -``` bash -echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" | sudo tee /etc/apt/sources.list.d/llvm.list -sudo apt-get update -sudo apt-get install clang-8 -``` - -# Instalar conjunto de herramientas de compilación cruzada {#install-cross-compilation-toolset} - -``` bash -cd ClickHouse -mkdir -p build-aarch64/cmake/toolchain/linux-aarch64 -wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9&la=en' -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cmake/toolchain/linux-aarch64 --strip-components=1 -``` - -# Construir ClickHouse {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-arm64 -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake -ninja -C build-arm64 -``` - -El binario resultante se ejecutará solo en Linux con la arquitectura de CPU AARCH64. diff --git a/docs/es/development/build_cross_osx.md b/docs/es/development/build_cross_osx.md deleted file mode 100644 index b3679c2c794..00000000000 --- a/docs/es/development/build_cross_osx.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 66 -toc_title: "C\xF3mo construir ClickHouse en Linux para Mac OS X" ---- - -# Cómo construir ClickHouse en Linux para Mac OS X {#how-to-build-clickhouse-on-linux-for-mac-os-x} - -Esto es para el caso cuando tiene una máquina Linux y desea usarla para compilar `clickhouse` Esto está destinado a las comprobaciones de integración continuas que se ejecutan en servidores Linux. Si desea crear ClickHouse directamente en Mac OS X, continúe con [otra instrucción](build_osx.md). - -La compilación cruzada para Mac OS X se basa en el [Instrucciones de construcción](build.md), seguirlos primero. - -# Instalar Clang-8 {#install-clang-8} - -Siga las instrucciones de https://apt.llvm.org/ para la configuración de Ubuntu o Debian. -Por ejemplo, los comandos para Bionic son como: - -``` bash -sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list -sudo apt-get install clang-8 -``` - -# Instalar conjunto de herramientas de compilación cruzada {#install-cross-compilation-toolset} - -Recordemos la ruta donde instalamos `cctools` como ${CCTOOLS} - -``` bash -mkdir ${CCTOOLS} - -git clone https://github.com/tpoechtrager/apple-libtapi.git -cd apple-libtapi -INSTALLPREFIX=${CCTOOLS} ./build.sh -./install.sh -cd .. - -git clone https://github.com/tpoechtrager/cctools-port.git -cd cctools-port/cctools -./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin -make install -``` - -Además, necesitamos descargar macOS X SDK en el árbol de trabajo. - -``` bash -cd ClickHouse -wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' -mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 -tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 -``` - -# Construir ClickHouse {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-osx -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ - -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ - -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ - -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -ninja -C build-osx -``` - -El binario resultante tendrá un formato ejecutable Mach-O y no se puede ejecutar en Linux. diff --git a/docs/es/development/build_osx.md b/docs/es/development/build_osx.md deleted file mode 100644 index 1af1bbd0fac..00000000000 --- a/docs/es/development/build_osx.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 65 -toc_title: "C\xF3mo crear ClickHouse en Mac OS X" ---- - -# Cómo crear ClickHouse en Mac OS X {#how-to-build-clickhouse-on-mac-os-x} - -Build debería funcionar en Mac OS X 10.15 (Catalina) - -## Instalar Homebrew {#install-homebrew} - -``` bash -$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - -## Instalar compiladores, herramientas y bibliotecas necesarios {#install-required-compilers-tools-and-libraries} - -``` bash -$ brew install cmake ninja libtool gettext -``` - -## Fuentes de ClickHouse de pago {#checkout-clickhouse-sources} - -``` bash -$ git clone --recursive git@github.com:ClickHouse/ClickHouse.git -``` - -o - -``` bash -$ git clone --recursive https://github.com/ClickHouse/ClickHouse.git - -$ cd ClickHouse -``` - -## Construir ClickHouse {#build-clickhouse} - -``` bash -$ mkdir build -$ cd build -$ cmake .. -DCMAKE_CXX_COMPILER=`which clang++` -DCMAKE_C_COMPILER=`which clang` -$ ninja -$ cd .. -``` - -## Advertencia {#caveats} - -Si tiene la intención de ejecutar clickhouse-server, asegúrese de aumentar la variable maxfiles del sistema. - -!!! info "Nota" - Tendrás que usar sudo. - -Para ello, cree el siguiente archivo: - -/Library/LaunchDaemons/limit.maxfiles.lista: - -``` xml - - - - - Label - limit.maxfiles - ProgramArguments - - launchctl - limit - maxfiles - 524288 - 524288 - - RunAtLoad - - ServiceIPC - - - -``` - -Ejecute el siguiente comando: - -``` bash -$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist -``` - -Reiniciar. - -Para verificar si está funcionando, puede usar `ulimit -n` comando. - -[Artículo Original](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/es/development/contrib.md b/docs/es/development/contrib.md index 387dbee9120..6b8b1f6aaf0 100644 --- a/docs/es/development/contrib.md +++ b/docs/es/development/contrib.md @@ -5,7 +5,7 @@ toc_priority: 70 toc_title: Bibliotecas de terceros utilizadas --- -# Bibliotecas de terceros utilizadas {#third-party-libraries-used} +# Bibliotecas De Terceros Utilizadas {#third-party-libraries-used} | Biblioteca | Licencia | |--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| diff --git a/docs/es/development/developer-instruction.md b/docs/es/development/developer-instruction.md new file mode 100644 index 00000000000..ccdeeb0b95b --- /dev/null +++ b/docs/es/development/developer-instruction.md @@ -0,0 +1,285 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 61 +toc_title: "La instrucci\xF3n para desarrolladores de ClickHouse para principiantes" +--- + +La construcción de ClickHouse es compatible con Linux, FreeBSD y Mac OS X. + +# Si Utiliza Windows {#if-you-use-windows} + +Si usa Windows, necesita crear una máquina virtual con Ubuntu. Para comenzar a trabajar con una máquina virtual, instale VirtualBox. Puede descargar Ubuntu desde el sitio web: https://www.ubuntu.com/\#download. Por favor, cree una máquina virtual a partir de la imagen descargada (debe reservar al menos 4 GB de RAM para ello). Para ejecutar un terminal de línea de comandos en Ubuntu, busque un programa que contenga la palabra “terminal” en su nombre (gnome-terminal, konsole etc.) o simplemente presione Ctrl + Alt + T. + +# Si Utiliza Un Sistema De 32 Bits {#if-you-use-a-32-bit-system} + +ClickHouse no puede funcionar ni construir en un sistema de 32 bits. Debe adquirir acceso a un sistema de 64 bits y puede continuar leyendo. + +# Crear Un Repositorio En GitHub {#creating-a-repository-on-github} + +Para comenzar a trabajar con el repositorio de ClickHouse, necesitará una cuenta de GitHub. + +Probablemente ya tenga uno, pero si no lo hace, regístrese en https://github.com . En caso de que no tenga claves SSH, debe generarlas y luego cargarlas en GitHub. Es necesario para enviar a través de sus parches. También es posible usar las mismas claves SSH que usa con cualquier otro servidor SSH, probablemente ya las tenga. + +Cree una bifurcación del repositorio ClickHouse. Para hacerlo por favor haga clic en el “fork” botón en la esquina superior derecha en https://github.com/ClickHouse/ClickHouse . Se bifurcará su propia copia de ClickHouse/ClickHouse a su cuenta. + +El proceso de desarrollo consiste en comprometer primero los cambios previstos en su bifurcación de ClickHouse y luego crear un “pull request” para que estos cambios sean aceptados en el repositorio principal (ClickHouse / ClickHouse). + +Para trabajar con repositorios git, instale `git`. + +Para hacer eso en Ubuntu, ejecutaría en la terminal de línea de comandos: + + sudo apt update + sudo apt install git + +Puede encontrar un breve manual sobre el uso de Git aquí: https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf . +Para obtener un manual detallado sobre Git, consulte https://git-scm.com/book/en/v2 . + +# Clonación De Un Repositorio En Su máquina De Desarrollo {#cloning-a-repository-to-your-development-machine} + +A continuación, debe descargar los archivos fuente en su máquina de trabajo. Esto se llama “to clone a repository” porque crea una copia local del repositorio en su máquina de trabajo. + +En el terminal de línea de comandos, ejecute: + + git clone --recursive git@guthub.com:your_github_username/ClickHouse.git + cd ClickHouse + +Nota: por favor, sustituye *your\_github\_username* con lo que es apropiado! + +Este comando creará un directorio `ClickHouse` que contiene la copia de trabajo del proyecto. + +Es importante que la ruta al directorio de trabajo no contenga espacios en blanco, ya que puede ocasionar problemas con la ejecución del sistema de compilación. + +Tenga en cuenta que el repositorio ClickHouse utiliza `submodules`. That is what the references to additional repositories are called (i.e. external libraries on which the project depends). It means that when cloning the repository you need to specify the `--recursive` como en el ejemplo anterior. Si el repositorio se ha clonado sin submódulos, para descargarlos debe ejecutar lo siguiente: + + git submodule init + git submodule update + +Puede verificar el estado con el comando: `git submodule status`. + +Si recibe el siguiente mensaje de error: + + Permission denied (publickey). + fatal: Could not read from remote repository. + + Please make sure you have the correct access rights + and the repository exists. + +Por lo general, significa que faltan las claves SSH para conectarse a GitHub. Estas teclas se encuentran normalmente en `~/.ssh`. Para que las claves SSH sean aceptadas, debe cargarlas en la sección de configuración de la interfaz de usuario de GitHub. + +También puede clonar el repositorio a través del protocolo https: + + git clone https://github.com/ClickHouse/ClickHouse.git + +Sin embargo, esto no le permitirá enviar los cambios al servidor. Aún puede usarlo temporalmente y agregar las claves SSH más tarde reemplazando la dirección remota del repositorio con `git remote` comando. + +También puede agregar la dirección original del repositorio de ClickHouse a su repositorio local para extraer actualizaciones desde allí: + + git remote add upstream git@github.com:ClickHouse/ClickHouse.git + +Después de ejecutar con éxito este comando, podrá extraer actualizaciones del repositorio principal de ClickHouse ejecutando `git pull upstream master`. + +## Trabajar Con submódulos {#working-with-submodules} + +Trabajar con submódulos en git podría ser doloroso. Los siguientes comandos ayudarán a administrarlo: + + # ! each command accepts --recursive + # Update remote URLs for submodules. Barely rare case + git submodule sync + # Add new submodules + git submodule init + # Update existing submodules to the current state + git submodule update + # Two last commands could be merged together + git submodule update --init + +Los siguientes comandos le ayudarían a restablecer todos los submódulos al estado inicial (!¡ADVERTENCIA! - cualquier cambio en el interior será eliminado): + + # Synchronizes submodules' remote URL with .gitmodules + git submodule sync --recursive + # Update the registered submodules with initialize not yet initialized + git submodule update --init --recursive + # Reset all changes done after HEAD + git submodule foreach git reset --hard + # Clean files from .gitignore + git submodule foreach git clean -xfd + # Repeat last 4 commands for all submodule + git submodule foreach git submodule sync --recursive + git submodule foreach git submodule update --init --recursive + git submodule foreach git submodule foreach git reset --hard + git submodule foreach git submodule foreach git clean -xfd + +# Sistema De construcción {#build-system} + +ClickHouse utiliza CMake y Ninja para la construcción. + +CMake - un sistema de meta-construcción que puede generar archivos Ninja (tareas de construcción). +Ninja: un sistema de compilación más pequeño con un enfoque en la velocidad utilizada para ejecutar esas tareas generadas por cmake. + +Para instalar en Ubuntu, Debian o Mint run `sudo apt install cmake ninja-build`. + +En CentOS, RedHat se ejecuta `sudo yum install cmake ninja-build`. + +Si usa Arch o Gentoo, probablemente lo sepa usted mismo cómo instalar CMake. + +Para instalar CMake y Ninja en Mac OS X, primero instale Homebrew y luego instale todo lo demás a través de brew: + + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + brew install cmake ninja + +A continuación, verifique la versión de CMake: `cmake --version`. Si está por debajo de 3.3, debe instalar una versión más reciente desde el sitio web: https://cmake.org/download/. + +# Bibliotecas Externas Opcionales {#optional-external-libraries} + +ClickHouse utiliza varias bibliotecas externas para la construcción. Todos ellos no necesitan ser instalados por separado, ya que se construyen junto con ClickHouse a partir de las fuentes ubicadas en los submódulos. Puede consultar la lista en `contrib`. + +# Compilador De C ++ {#c-compiler} + +Los compiladores GCC a partir de la versión 9 y Clang versión 8 o superior son compatibles para construir ClickHouse. + +Las compilaciones oficiales de Yandex actualmente usan GCC porque genera código de máquina de un rendimiento ligeramente mejor (con una diferencia de hasta varios por ciento según nuestros puntos de referencia). Y Clang es más conveniente para el desarrollo generalmente. Sin embargo, nuestra plataforma de integración continua (CI) ejecuta verificaciones de aproximadamente una docena de combinaciones de compilación. + +Para instalar GCC en Ubuntu, ejecute: `sudo apt install gcc g++` + +Compruebe la versión de gcc: `gcc --version`. Si está por debajo de 9, siga las instrucciones aquí: https://clickhouse .tech/docs/en/development/build/\#install-gcc-9. + +La compilación de Mac OS X solo es compatible con Clang. Sólo tiene que ejecutar `brew install llvm` + +Si decide utilizar Clang, también puede instalar `libc++` y `lld` si usted sabe lo que es. Utilizar `ccache` también se recomienda. + +# El Proceso De construcción {#the-building-process} + +Ahora que está listo para construir ClickHouse, le recomendamos que cree un directorio separado `build` dentro `ClickHouse` que contendrá todos los de la generación de artefactos: + + mkdir build + cd build + +Puede tener varios directorios diferentes (build\_release, build\_debug, etc.) para diferentes tipos de construcción. + +Mientras que dentro de la `build` directorio, configure su compilación ejecutando CMake. Antes de la primera ejecución, debe definir variables de entorno que especifiquen el compilador (compilador gcc versión 9 en este ejemplo). + +Linux: + + export CC=gcc-9 CXX=g++-9 + cmake .. + +Mac OS X: + + export CC=clang CXX=clang++ + cmake .. + +El `CC` variable especifica el compilador para C (abreviatura de C Compiler), y `CXX` variable indica qué compilador de C ++ se usará para compilar. + +Para una construcción más rápida, puede recurrir al `debug` tipo de compilación: una compilación sin optimizaciones. Para ese suministro el siguiente parámetro `-D CMAKE_BUILD_TYPE=Debug`: + + cmake -D CMAKE_BUILD_TYPE=Debug .. + +Puede cambiar el tipo de compilación ejecutando este comando en el `build` directorio. + +Ejecutar ninja para construir: + + ninja clickhouse-server clickhouse-client + +Solo los binarios requeridos se van a construir en este ejemplo. + +Si necesita construir todos los binarios (utilidades y pruebas), debe ejecutar ninja sin parámetros: + + ninja + +La compilación completa requiere aproximadamente 30 GB de espacio libre en disco o 15 GB para construir los binarios principales. + +Cuando hay una gran cantidad de RAM disponible en la máquina de compilación, debe limitar el número de tareas de compilación que se ejecutan en paralelo con `-j` parámetro: + + ninja -j 1 clickhouse-server clickhouse-client + +En máquinas con 4GB de RAM, se recomienda especificar 1, para 8GB de RAM `-j 2` se recomienda. + +Si recibe el mensaje: `ninja: error: loading 'build.ninja': No such file or directory`, significa que la generación de una configuración de compilación ha fallado y necesita inspeccionar el mensaje anterior. + +Cuando se inicie correctamente el proceso de construcción, verá el progreso de la compilación: el número de tareas procesadas y el número total de tareas. + +Al crear mensajes sobre archivos protobuf en la biblioteca libhdfs2, como `libprotobuf WARNING` puede aparecer. Afectan a nada y son seguros para ser ignorado. + +Tras la compilación exitosa, obtienes un archivo ejecutable `ClickHouse//programs/clickhouse`: + + ls -l programs/clickhouse + +# Ejecutando El Ejecutable Construido De ClickHouse {#running-the-built-executable-of-clickhouse} + +Para ejecutar el servidor bajo el usuario actual, debe navegar hasta `ClickHouse/programs/server/` (situado fuera de `build`) y ejecutar: + + ../../../build/programs/clickhouse server + +En este caso, ClickHouse usará archivos de configuración ubicados en el directorio actual. Puede ejecutar `clickhouse server` desde cualquier directorio que especifique la ruta a un archivo de configuración como un parámetro de línea de comandos `--config-file`. + +Para conectarse a ClickHouse con clickhouse-client en otro terminal, vaya a `ClickHouse/build/programs/` y ejecutar `clickhouse client`. + +Si usted consigue `Connection refused` mensaje en Mac OS X o FreeBSD, intente especificar la dirección de host 127.0.0.1: + + clickhouse client --host 127.0.0.1 + +Puede reemplazar la versión de producción del binario ClickHouse instalado en su sistema con su binario ClickHouse personalizado. Para ello, instale ClickHouse en su máquina siguiendo las instrucciones del sitio web oficial. A continuación, ejecute lo siguiente: + + sudo service clickhouse-server stop + sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ + sudo service clickhouse-server start + +Tenga en cuenta que `clickhouse-client`, `clickhouse-server` y otros son enlaces simbólicos a los comúnmente compartidos `clickhouse` binario. + +También puede ejecutar su binario ClickHouse personalizado con el archivo de configuración del paquete ClickHouse instalado en su sistema: + + sudo service clickhouse-server stop + sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml + +# IDE (entorno De Desarrollo Integrado) {#ide-integrated-development-environment} + +Si no sabe qué IDE usar, le recomendamos que use CLion. CLion es un software comercial, pero ofrece un período de prueba gratuito de 30 días. También es gratuito para los estudiantes. CLion se puede usar tanto en Linux como en Mac OS X. + +KDevelop y QTCreator son otras excelentes alternativas de un IDE para desarrollar ClickHouse. KDevelop viene como un IDE muy útil aunque inestable. Si KDevelop se bloquea después de un tiempo al abrir el proyecto, debe hacer clic “Stop All” botón tan pronto como se ha abierto la lista de archivos del proyecto. Después de hacerlo, KDevelop debería estar bien para trabajar. + +Como editores de código simples, puede usar Sublime Text o Visual Studio Code, o Kate (todos los cuales están disponibles en Linux). + +Por si acaso, vale la pena mencionar que CLion crea `build` por sí mismo, también por sí mismo selecciona `debug` para el tipo de compilación, para la configuración usa una versión de CMake que está definida en CLion y no la instalada por usted, y finalmente, CLion usará `make` para ejecutar tareas de compilación en lugar de `ninja`. Este es un comportamiento normal, solo tenlo en cuenta para evitar confusiones. + +# Código De Escritura {#writing-code} + +La descripción de la arquitectura ClickHouse se puede encontrar aquí: https://clickhouse.tech/docs/es/desarrollo/arquitectura/ + +La Guía de estilo de código: https://clickhouse.tech/docs/en/development/style/ + +Pruebas de escritura: https://clickhouse.tech/docs/en/development/tests/ + +Lista de tareas: https://github.com/ClickHouse/ClickHouse/blob/master/testsructions/easy\_tasks\_sorted\_en.md + +# Datos De Prueba {#test-data} + +El desarrollo de ClickHouse a menudo requiere cargar conjuntos de datos realistas. Es particularmente importante para las pruebas de rendimiento. Tenemos un conjunto especialmente preparado de datos anónimos de Yandex.Métrica. Se requiere, además, unos 3 GB de espacio libre en disco. Tenga en cuenta que estos datos no son necesarios para realizar la mayoría de las tareas de desarrollo. + + sudo apt install wget xz-utils + + wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz + wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz + + xz -v -d hits_v1.tsv.xz + xz -v -d visits_v1.tsv.xz + + clickhouse-client + + CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); + + CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); + + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv + +# Creación De Solicitud De extracción {#creating-pull-request} + +Navega a tu repositorio de fork en la interfaz de usuario de GitHub. Si ha estado desarrollando en una sucursal, debe seleccionar esa sucursal. Habrá un “Pull request” botón situado en la pantalla. En esencia, esto significa “create a request for accepting my changes into the main repository”. + +Se puede crear una solicitud de extracción incluso si el trabajo aún no se ha completado. En este caso, por favor ponga la palabra “WIP” (trabajo en curso) al comienzo del título, se puede cambiar más tarde. Esto es útil para la revisión cooperativa y la discusión de los cambios, así como para ejecutar todas las pruebas disponibles. Es importante que proporcione una breve descripción de sus cambios, que más tarde se utilizará para generar registros de cambios de lanzamiento. + +Las pruebas comenzarán tan pronto como los empleados de Yandex etiqueten su PR con una etiqueta “can be tested”. The results of some first checks (e.g. code style) will come in within several minutes. Build check results will arrive within half an hour. And the main set of tests will report itself within an hour. + +El sistema preparará compilaciones binarias ClickHouse para su solicitud de extracción individualmente. Para recuperar estas compilaciones, haga clic en “Details” junto al link “ClickHouse build check” en la lista de cheques. Allí encontrará enlaces directos a la construcción.deb paquetes de ClickHouse que puede implementar incluso en sus servidores de producción (si no tiene miedo). + +Lo más probable es que algunas de las compilaciones fallen las primeras veces. Esto se debe al hecho de que verificamos las compilaciones tanto con gcc como con clang, con casi todas las advertencias existentes (siempre con el `-Werror` bandera) habilitado para sonido. En esa misma página, puede encontrar todos los registros de compilación para que no tenga que compilar ClickHouse de todas las formas posibles. diff --git a/docs/es/development/developer_instruction.md b/docs/es/development/developer_instruction.md deleted file mode 100644 index a9572ae0eef..00000000000 --- a/docs/es/development/developer_instruction.md +++ /dev/null @@ -1,285 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 61 -toc_title: "La instrucci\xF3n para desarrolladores de ClickHouse para principiantes" ---- - -La construcción de ClickHouse es compatible con Linux, FreeBSD y Mac OS X. - -# Si utiliza Windows {#if-you-use-windows} - -Si usa Windows, necesita crear una máquina virtual con Ubuntu. Para comenzar a trabajar con una máquina virtual, instale VirtualBox. Puede descargar Ubuntu desde el sitio web: https://www.ubuntu.com/\#download. Por favor, cree una máquina virtual a partir de la imagen descargada (debe reservar al menos 4 GB de RAM para ello). Para ejecutar un terminal de línea de comandos en Ubuntu, busque un programa que contenga la palabra “terminal” en su nombre (gnome-terminal, konsole etc.) o simplemente presione Ctrl + Alt + T. - -# Si utiliza un sistema de 32 bits {#if-you-use-a-32-bit-system} - -ClickHouse no puede funcionar ni construir en un sistema de 32 bits. Debe adquirir acceso a un sistema de 64 bits y puede continuar leyendo. - -# Crear un repositorio en GitHub {#creating-a-repository-on-github} - -Para comenzar a trabajar con el repositorio de ClickHouse, necesitará una cuenta de GitHub. - -Probablemente ya tenga uno, pero si no lo hace, regístrese en https://github.com . En caso de que no tenga claves SSH, debe generarlas y luego cargarlas en GitHub. Es necesario para enviar a través de sus parches. También es posible usar las mismas claves SSH que usa con cualquier otro servidor SSH, probablemente ya las tenga. - -Cree una bifurcación del repositorio ClickHouse. Para hacerlo por favor haga clic en el “fork” botón en la esquina superior derecha en https://github.com/ClickHouse/ClickHouse . Se bifurcará su propia copia de ClickHouse/ClickHouse a su cuenta. - -El proceso de desarrollo consiste en comprometer primero los cambios previstos en su bifurcación de ClickHouse y luego crear un “pull request” para que estos cambios sean aceptados en el repositorio principal (ClickHouse / ClickHouse). - -Para trabajar con repositorios git, instale `git`. - -Para hacer eso en Ubuntu, ejecutaría en la terminal de línea de comandos: - - sudo apt update - sudo apt install git - -Puede encontrar un breve manual sobre el uso de Git aquí: https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf . -Para obtener un manual detallado sobre Git, consulte https://git-scm.com/book/en/v2 . - -# Clonación de un repositorio en su máquina de desarrollo {#cloning-a-repository-to-your-development-machine} - -A continuación, debe descargar los archivos fuente en su máquina de trabajo. Esto se llama “to clone a repository” porque crea una copia local del repositorio en su máquina de trabajo. - -En el terminal de línea de comandos, ejecute: - - git clone --recursive git@guthub.com:your_github_username/ClickHouse.git - cd ClickHouse - -Nota: por favor, sustituye *your\_github\_username* con lo que es apropiado! - -Este comando creará un directorio `ClickHouse` que contiene la copia de trabajo del proyecto. - -Es importante que la ruta al directorio de trabajo no contenga espacios en blanco, ya que puede ocasionar problemas con la ejecución del sistema de compilación. - -Tenga en cuenta que el repositorio ClickHouse utiliza `submodules`. That is what the references to additional repositories are called (i.e. external libraries on which the project depends). It means that when cloning the repository you need to specify the `--recursive` como en el ejemplo anterior. Si el repositorio se ha clonado sin submódulos, para descargarlos debe ejecutar lo siguiente: - - git submodule init - git submodule update - -Puede verificar el estado con el comando: `git submodule status`. - -Si recibe el siguiente mensaje de error: - - Permission denied (publickey). - fatal: Could not read from remote repository. - - Please make sure you have the correct access rights - and the repository exists. - -Por lo general, significa que faltan las claves SSH para conectarse a GitHub. Estas teclas se encuentran normalmente en `~/.ssh`. Para que las claves SSH sean aceptadas, debe cargarlas en la sección de configuración de la interfaz de usuario de GitHub. - -También puede clonar el repositorio a través del protocolo https: - - git clone https://github.com/ClickHouse/ClickHouse.git - -Sin embargo, esto no le permitirá enviar los cambios al servidor. Aún puede usarlo temporalmente y agregar las claves SSH más tarde reemplazando la dirección remota del repositorio con `git remote` comando. - -También puede agregar la dirección original del repositorio de ClickHouse a su repositorio local para extraer actualizaciones desde allí: - - git remote add upstream git@github.com:ClickHouse/ClickHouse.git - -Después de ejecutar con éxito este comando, podrá extraer actualizaciones del repositorio principal de ClickHouse ejecutando `git pull upstream master`. - -## Trabajar con submódulos {#working-with-submodules} - -Trabajar con submódulos en git podría ser doloroso. Los siguientes comandos ayudarán a administrarlo: - - # ! each command accepts --recursive - # Update remote URLs for submodules. Barely rare case - git submodule sync - # Add new submodules - git submodule init - # Update existing submodules to the current state - git submodule update - # Two last commands could be merged together - git submodule update --init - -Los siguientes comandos le ayudarían a restablecer todos los submódulos al estado inicial (!¡ADVERTENCIA! - cualquier cambio en el interior será eliminado): - - # Synchronizes submodules' remote URL with .gitmodules - git submodule sync --recursive - # Update the registered submodules with initialize not yet initialized - git submodule update --init --recursive - # Reset all changes done after HEAD - git submodule foreach git reset --hard - # Clean files from .gitignore - git submodule foreach git clean -xfd - # Repeat last 4 commands for all submodule - git submodule foreach git submodule sync --recursive - git submodule foreach git submodule update --init --recursive - git submodule foreach git submodule foreach git reset --hard - git submodule foreach git submodule foreach git clean -xfd - -# Sistema de construcción {#build-system} - -ClickHouse utiliza CMake y Ninja para la construcción. - -CMake - un sistema de meta-construcción que puede generar archivos Ninja (tareas de construcción). -Ninja: un sistema de compilación más pequeño con un enfoque en la velocidad utilizada para ejecutar esas tareas generadas por cmake. - -Para instalar en Ubuntu, Debian o Mint run `sudo apt install cmake ninja-build`. - -En CentOS, RedHat se ejecuta `sudo yum install cmake ninja-build`. - -Si usa Arch o Gentoo, probablemente lo sepa usted mismo cómo instalar CMake. - -Para instalar CMake y Ninja en Mac OS X, primero instale Homebrew y luego instale todo lo demás a través de brew: - - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install cmake ninja - -A continuación, verifique la versión de CMake: `cmake --version`. Si está por debajo de 3.3, debe instalar una versión más reciente desde el sitio web: https://cmake.org/download/. - -# Bibliotecas externas opcionales {#optional-external-libraries} - -ClickHouse utiliza varias bibliotecas externas para la construcción. Todos ellos no necesitan ser instalados por separado, ya que se construyen junto con ClickHouse a partir de las fuentes ubicadas en los submódulos. Puede consultar la lista en `contrib`. - -# Compilador de C ++ {#c-compiler} - -Los compiladores GCC a partir de la versión 9 y Clang versión 8 o superior son compatibles para construir ClickHouse. - -Las compilaciones oficiales de Yandex actualmente usan GCC porque genera código de máquina de un rendimiento ligeramente mejor (con una diferencia de hasta varios por ciento según nuestros puntos de referencia). Y Clang es más conveniente para el desarrollo generalmente. Sin embargo, nuestra plataforma de integración continua (CI) ejecuta verificaciones de aproximadamente una docena de combinaciones de compilación. - -Para instalar GCC en Ubuntu, ejecute: `sudo apt install gcc g++` - -Compruebe la versión de gcc: `gcc --version`. Si está por debajo de 9, siga las instrucciones aquí: https://clickhouse .tech/docs/en/development/build/\#install-gcc-9. - -La compilación de Mac OS X solo es compatible con Clang. Sólo tiene que ejecutar `brew install llvm` - -Si decide utilizar Clang, también puede instalar `libc++` y `lld` si usted sabe lo que es. Utilizar `ccache` también se recomienda. - -# El proceso de construcción {#the-building-process} - -Ahora que está listo para construir ClickHouse, le recomendamos que cree un directorio separado `build` dentro `ClickHouse` que contendrá todos los de la generación de artefactos: - - mkdir build - cd build - -Puede tener varios directorios diferentes (build\_release, build\_debug, etc.) para diferentes tipos de construcción. - -Mientras que dentro de la `build` directorio, configure su compilación ejecutando CMake. Antes de la primera ejecución, debe definir variables de entorno que especifiquen el compilador (compilador gcc versión 9 en este ejemplo). - -Linux: - - export CC=gcc-9 CXX=g++-9 - cmake .. - -Mac OS X: - - export CC=clang CXX=clang++ - cmake .. - -El `CC` variable especifica el compilador para C (abreviatura de C Compiler), y `CXX` variable indica qué compilador de C ++ se usará para compilar. - -Para una construcción más rápida, puede recurrir al `debug` tipo de compilación: una compilación sin optimizaciones. Para ese suministro el siguiente parámetro `-D CMAKE_BUILD_TYPE=Debug`: - - cmake -D CMAKE_BUILD_TYPE=Debug .. - -Puede cambiar el tipo de compilación ejecutando este comando en el `build` directorio. - -Ejecutar ninja para construir: - - ninja clickhouse-server clickhouse-client - -Solo los binarios requeridos se van a construir en este ejemplo. - -Si necesita construir todos los binarios (utilidades y pruebas), debe ejecutar ninja sin parámetros: - - ninja - -La compilación completa requiere aproximadamente 30 GB de espacio libre en disco o 15 GB para construir los binarios principales. - -Cuando hay una gran cantidad de RAM disponible en la máquina de compilación, debe limitar el número de tareas de compilación que se ejecutan en paralelo con `-j` parámetro: - - ninja -j 1 clickhouse-server clickhouse-client - -En máquinas con 4GB de RAM, se recomienda especificar 1, para 8GB de RAM `-j 2` se recomienda. - -Si recibe el mensaje: `ninja: error: loading 'build.ninja': No such file or directory`, significa que la generación de una configuración de compilación ha fallado y necesita inspeccionar el mensaje anterior. - -Cuando se inicie correctamente el proceso de construcción, verá el progreso de la compilación: el número de tareas procesadas y el número total de tareas. - -Al crear mensajes sobre archivos protobuf en la biblioteca libhdfs2, como `libprotobuf WARNING` puede aparecer. Afectan a nada y son seguros para ser ignorado. - -Tras la compilación exitosa, obtienes un archivo ejecutable `ClickHouse//programs/clickhouse`: - - ls -l programs/clickhouse - -# Ejecutando el ejecutable construido de ClickHouse {#running-the-built-executable-of-clickhouse} - -Para ejecutar el servidor bajo el usuario actual, debe navegar hasta `ClickHouse/programs/server/` (situado fuera de `build`) y ejecutar: - - ../../../build/programs/clickhouse server - -En este caso, ClickHouse usará archivos de configuración ubicados en el directorio actual. Puede ejecutar `clickhouse server` desde cualquier directorio que especifique la ruta a un archivo de configuración como un parámetro de línea de comandos `--config-file`. - -Para conectarse a ClickHouse con clickhouse-client en otro terminal, vaya a `ClickHouse/build/programs/` y ejecutar `clickhouse client`. - -Si usted consigue `Connection refused` mensaje en Mac OS X o FreeBSD, intente especificar la dirección de host 127.0.0.1: - - clickhouse client --host 127.0.0.1 - -Puede reemplazar la versión de producción del binario ClickHouse instalado en su sistema con su binario ClickHouse personalizado. Para ello, instale ClickHouse en su máquina siguiendo las instrucciones del sitio web oficial. A continuación, ejecute lo siguiente: - - sudo service clickhouse-server stop - sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ - sudo service clickhouse-server start - -Tenga en cuenta que `clickhouse-client`, `clickhouse-server` y otros son enlaces simbólicos a los comúnmente compartidos `clickhouse` binario. - -También puede ejecutar su binario ClickHouse personalizado con el archivo de configuración del paquete ClickHouse instalado en su sistema: - - sudo service clickhouse-server stop - sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml - -# IDE (entorno de desarrollo integrado) {#ide-integrated-development-environment} - -Si no sabe qué IDE usar, le recomendamos que use CLion. CLion es un software comercial, pero ofrece un período de prueba gratuito de 30 días. También es gratuito para los estudiantes. CLion se puede usar tanto en Linux como en Mac OS X. - -KDevelop y QTCreator son otras excelentes alternativas de un IDE para desarrollar ClickHouse. KDevelop viene como un IDE muy útil aunque inestable. Si KDevelop se bloquea después de un tiempo al abrir el proyecto, debe hacer clic “Stop All” botón tan pronto como se ha abierto la lista de archivos del proyecto. Después de hacerlo, KDevelop debería estar bien para trabajar. - -Como editores de código simples, puede usar Sublime Text o Visual Studio Code, o Kate (todos los cuales están disponibles en Linux). - -Por si acaso, vale la pena mencionar que CLion crea `build` por sí mismo, también por sí mismo selecciona `debug` para el tipo de compilación, para la configuración usa una versión de CMake que está definida en CLion y no la instalada por usted, y finalmente, CLion usará `make` para ejecutar tareas de compilación en lugar de `ninja`. Este es un comportamiento normal, solo tenlo en cuenta para evitar confusiones. - -# Código de escritura {#writing-code} - -La descripción de la arquitectura ClickHouse se puede encontrar aquí: https://clickhouse.tech/docs/es/desarrollo/arquitectura/ - -La Guía de estilo de código: https://clickhouse.tech/docs/en/development/style/ - -Pruebas de escritura: https://clickhouse.tech/docs/en/development/tests/ - -Lista de tareas: https://github.com/ClickHouse/ClickHouse/blob/master/testsructions/easy\_tasks\_sorted\_en.md - -# Datos de prueba {#test-data} - -El desarrollo de ClickHouse a menudo requiere cargar conjuntos de datos realistas. Es particularmente importante para las pruebas de rendimiento. Tenemos un conjunto especialmente preparado de datos anónimos de Yandex.Métrica. Se requiere, además, unos 3 GB de espacio libre en disco. Tenga en cuenta que estos datos no son necesarios para realizar la mayoría de las tareas de desarrollo. - - sudo apt install wget xz-utils - - wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz - wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz - - xz -v -d hits_v1.tsv.xz - xz -v -d visits_v1.tsv.xz - - clickhouse-client - - CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); - - CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); - - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv - -# Creación de solicitud de extracción {#creating-pull-request} - -Navega a tu repositorio de fork en la interfaz de usuario de GitHub. Si ha estado desarrollando en una sucursal, debe seleccionar esa sucursal. Habrá un “Pull request” botón situado en la pantalla. En esencia, esto significa “create a request for accepting my changes into the main repository”. - -Se puede crear una solicitud de extracción incluso si el trabajo aún no se ha completado. En este caso, por favor ponga la palabra “WIP” (trabajo en curso) al comienzo del título, se puede cambiar más tarde. Esto es útil para la revisión cooperativa y la discusión de los cambios, así como para ejecutar todas las pruebas disponibles. Es importante que proporcione una breve descripción de sus cambios, que más tarde se utilizará para generar registros de cambios de lanzamiento. - -Las pruebas comenzarán tan pronto como los empleados de Yandex etiqueten su PR con una etiqueta “can be tested”. The results of some first checks (e.g. code style) will come in within several minutes. Build check results will arrive within half an hour. And the main set of tests will report itself within an hour. - -El sistema preparará compilaciones binarias ClickHouse para su solicitud de extracción individualmente. Para recuperar estas compilaciones, haga clic en “Details” junto al link “ClickHouse build check” en la lista de cheques. Allí encontrará enlaces directos a la construcción.deb paquetes de ClickHouse que puede implementar incluso en sus servidores de producción (si no tiene miedo). - -Lo más probable es que algunas de las compilaciones fallen las primeras veces. Esto se debe al hecho de que verificamos las compilaciones tanto con gcc como con clang, con casi todas las advertencias existentes (siempre con el `-Werror` bandera) habilitado para sonido. En esa misma página, puede encontrar todos los registros de compilación para que no tenga que compilar ClickHouse de todas las formas posibles. diff --git a/docs/es/development/index.md b/docs/es/development/index.md index 815a633071e..815684c8ee2 100644 --- a/docs/es/development/index.md +++ b/docs/es/development/index.md @@ -7,6 +7,6 @@ toc_priority: 58 toc_title: oculto --- -# Desarrollo de ClickHouse {#clickhouse-development} +# Desarrollo De ClickHouse {#clickhouse-development} [Artículo Original](https://clickhouse.tech/docs/en/development/) diff --git a/docs/es/development/style.md b/docs/es/development/style.md index 77815c0204d..384c7189934 100644 --- a/docs/es/development/style.md +++ b/docs/es/development/style.md @@ -5,9 +5,9 @@ toc_priority: 68 toc_title: "C\xF3mo escribir c\xF3digo C ++" --- -# Cómo escribir código C ++ {#how-to-write-c-code} +# Cómo Escribir código C ++ {#how-to-write-c-code} -## Recomendaciones generales {#general-recommendations} +## Recomendaciones Generales {#general-recommendations} **1.** Las siguientes son recomendaciones, no requisitos. @@ -422,7 +422,7 @@ También puede usar una abreviatura si el nombre completo se incluye junto a él **17.** Los nombres de archivo con código fuente de C++ deben tener `.cpp` ampliación. Los archivos de encabezado deben tener `.h` ampliación. -## Cómo escribir código {#how-to-write-code} +## Cómo Escribir código {#how-to-write-code} **1.** Gestión de la memoria. @@ -689,7 +689,7 @@ auto s = std::string{"Hello"}; **26.** Para funciones virtuales, escriba `virtual` en la clase base, pero escribe `override` en lugar de `virtual` en las clases descendientes. -## Características no utilizadas de C ++ {#unused-features-of-c} +## Características No Utilizadas De C ++ {#unused-features-of-c} **1.** La herencia virtual no se utiliza. @@ -763,7 +763,7 @@ Si ya hay una buena solución disponible, úsela, incluso si eso significa que d **5.** Siempre se da preferencia a las bibliotecas que ya están en uso. -## Recomendaciones generales {#general-recommendations-1} +## Recomendaciones Generales {#general-recommendations-1} **1.** Escribe el menor código posible. @@ -777,7 +777,7 @@ Si ya hay una buena solución disponible, úsela, incluso si eso significa que d **6.** Se fomenta la simplificación del código. Reduzca el tamaño de su código siempre que sea posible. -## Recomendaciones adicionales {#additional-recommendations} +## Recomendaciones Adicionales {#additional-recommendations} **1.** Especificar explícitamente `std::` para tipos de `stddef.h` diff --git a/docs/es/development/tests.md b/docs/es/development/tests.md index 12afbb68f2e..b889c7be6af 100644 --- a/docs/es/development/tests.md +++ b/docs/es/development/tests.md @@ -5,9 +5,9 @@ toc_priority: 69 toc_title: "C\xF3mo ejecutar pruebas de ClickHouse" --- -# Pruebas de ClickHouse {#clickhouse-testing} +# Pruebas De ClickHouse {#clickhouse-testing} -## Pruebas funcionales {#functional-tests} +## Pruebas Funcionales {#functional-tests} Las pruebas funcionales son las más simples y cómodas de usar. La mayoría de las características de ClickHouse se pueden probar con pruebas funcionales y son obligatorias para cada cambio en el código de ClickHouse que se puede probar de esa manera. @@ -34,11 +34,11 @@ significado. `long` es para pruebas que duran un poco más de un segundo. Usted deshabilitar estos grupos de pruebas utilizando `--no-zookeeper`, `--no-shard` y `--no-long` opciones, respectivamente. -## Bugs conocidos {#known-bugs} +## Bugs Conocidos {#known-bugs} Si conocemos algunos errores que se pueden reproducir fácilmente mediante pruebas funcionales, colocamos pruebas funcionales preparadas en `tests/queries/bugs` directorio. Estas pruebas se moverán a `tests/queries/0_stateless` cuando se corrigen errores. -## Pruebas de integración {#integration-tests} +## Pruebas De integración {#integration-tests} Las pruebas de integración permiten probar ClickHouse en la configuración agrupada y la interacción de ClickHouse con otros servidores como MySQL, Postgres, MongoDB. Son útiles para emular divisiones de red, caídas de paquetes, etc. Estas pruebas se ejecutan bajo Docker y crean múltiples contenedores con varios software. @@ -46,13 +46,13 @@ Ver `tests/integration/README.md` sobre cómo ejecutar estas pruebas. Tenga en cuenta que la integración de ClickHouse con controladores de terceros no se ha probado. Además, actualmente no tenemos pruebas de integración con nuestros controladores JDBC y ODBC. -## Pruebas unitarias {#unit-tests} +## Pruebas Unitarias {#unit-tests} Las pruebas unitarias son útiles cuando desea probar no ClickHouse como un todo, sino una sola biblioteca o clase aislada. Puede habilitar o deshabilitar la compilación de pruebas con `ENABLE_TESTS` Opción CMake. Las pruebas unitarias (y otros programas de prueba) se encuentran en `tests` subdirectorios en todo el código. Para ejecutar pruebas unitarias, escriba `ninja test`. Algunas pruebas usan `gtest`, pero algunos son solo programas que devuelven un código de salida distinto de cero en caso de fallo de prueba. No es necesariamente tener pruebas unitarias si el código ya está cubierto por pruebas funcionales (y las pruebas funcionales suelen ser mucho más simples de usar). -## Pruebas de rendimiento {#performance-tests} +## Pruebas De Rendimiento {#performance-tests} Las pruebas de rendimiento permiten medir y comparar el rendimiento de alguna parte aislada de ClickHouse en consultas sintéticas. Las pruebas se encuentran en `tests/performance`. Cada prueba está representada por `.xml` archivo con la descripción del caso de prueba. Las pruebas se ejecutan con `clickhouse performance-test` herramienta (que está incrustada en `clickhouse` binario). Ver `--help` para la invocación. @@ -60,7 +60,7 @@ Cada prueba ejecuta una o múltiples consultas (posiblemente con combinaciones d Si desea mejorar el rendimiento de ClickHouse en algún escenario, y si se pueden observar mejoras en consultas simples, se recomienda encarecidamente escribir una prueba de rendimiento. Siempre tiene sentido usar `perf top` u otras herramientas de perf durante sus pruebas. -## Herramientas de prueba y secuencias de comandos {#test-tools-and-scripts} +## Herramientas De Prueba y Secuencias De Comandos {#test-tools-and-scripts} Algunos programas en `tests` directorio no son pruebas preparadas, pero son herramientas de prueba. Por ejemplo, para `Lexer` hay una herramienta `dbms/Parsers/tests/lexer` que solo hacen la tokenización de stdin y escriben el resultado coloreado en stdout. Puede usar este tipo de herramientas como ejemplos de código y para exploración y pruebas manuales. @@ -74,7 +74,7 @@ Hay una prueba separada para inserciones de quórum. Esta prueba ejecuta el clú La prueba de quórum fue escrita por un equipo separado antes de que ClickHouse fuera de código abierto. Este equipo ya no trabaja con ClickHouse. La prueba fue escrita accidentalmente en Java. Por estas razones, la prueba de quórum debe reescribirse y trasladarse a pruebas de integración. -## Pruebas manuales {#manual-testing} +## Pruebas Manuales {#manual-testing} Cuando desarrolla una nueva característica, es razonable probarla también manualmente. Puede hacerlo con los siguientes pasos: @@ -109,7 +109,7 @@ Si el servidor de clickhouse del sistema ya se está ejecutando y no desea deten `clickhouse` binary casi no tiene dependencias y funciona en una amplia gama de distribuciones de Linux. Para probar rápidamente y sucio sus cambios en un servidor, simplemente puede `scp` su fresco construido `clickhouse` binario a su servidor y luego ejecútelo como en los ejemplos anteriores. -## Entorno de prueba {#testing-environment} +## Entorno De Prueba {#testing-environment} Antes de publicar la versión como estable, la implementamos en el entorno de prueba. El entorno de prueba es un clúster que procesa 1/39 parte de [El Yandex.Métrica](https://metrica.yandex.com/) datos. Compartimos nuestro entorno de pruebas con Yandex.Equipo de Metrica. ClickHouse se actualiza sin tiempo de inactividad sobre los datos existentes. Nos fijamos en un primer momento que los datos se procesan con éxito sin retraso de tiempo real, la replicación continúan trabajando y no hay problemas visibles para Yandex.Equipo de Metrica. La primera comprobación se puede hacer de la siguiente manera: @@ -119,7 +119,7 @@ SELECT hostName() AS h, any(version()), any(uptime()), max(UTCEventTime), count( En algunos casos también implementamos en el entorno de prueba de nuestros equipos de amigos en Yandex: Market, Cloud, etc. También tenemos algunos servidores de hardware que se utilizan con fines de desarrollo. -## Pruebas de carga {#load-testing} +## Pruebas De Carga {#load-testing} Después de implementar en el entorno de prueba, ejecutamos pruebas de carga con consultas del clúster de producción. Esto se hace manualmente. @@ -147,7 +147,7 @@ Usted debe comprobar que `clickhouse-server` no se bloquea, la huella de memoria Los tiempos de ejecución de consultas precisos no se registran y no se comparan debido a la alta variabilidad de las consultas y el entorno. -## Pruebas de construcción {#build-tests} +## Pruebas De construcción {#build-tests} Las pruebas de compilación permiten verificar que la compilación no esté rota en varias configuraciones alternativas y en algunos sistemas extranjeros. Las pruebas se encuentran en `ci` directorio. Ejecutan compilación desde la fuente dentro de Docker, Vagrant y, a veces, con `qemu-user-static` dentro de Docker. Estas pruebas están en desarrollo y las ejecuciones de pruebas no están automatizadas. @@ -165,11 +165,11 @@ Por ejemplo, construir con paquetes del sistema es una mala práctica, porque no Aunque no podemos ejecutar todas las pruebas en todas las variantes de compilaciones, queremos verificar al menos que varias variantes de compilación no estén rotas. Para este propósito utilizamos pruebas de construcción. -## Pruebas de compatibilidad de protocolos {#testing-for-protocol-compatibility} +## Pruebas De Compatibilidad De Protocolos {#testing-for-protocol-compatibility} Cuando ampliamos el protocolo de red ClickHouse, probamos manualmente que el antiguo clickhouse-client funciona con el nuevo clickhouse-server y el nuevo clickhouse-client funciona con el antiguo clickhouse-server (simplemente ejecutando binarios de los paquetes correspondientes). -## Ayuda del compilador {#help-from-the-compiler} +## Ayuda Del Compilador {#help-from-the-compiler} Código principal de ClickHouse (que se encuentra en `dbms` directorio) se construye con `-Wall -Wextra -Werror` y con algunas advertencias habilitadas adicionales. Aunque estas opciones no están habilitadas para bibliotecas de terceros. @@ -203,7 +203,7 @@ Usamos una prueba de fuzz simple para generar consultas SQL aleatorias y verific A partir de diciembre de 2018, todavía no usamos pruebas de fuzz aisladas del código de la biblioteca. -## Auditoría de seguridad {#security-audit} +## Auditoría De Seguridad {#security-audit} La gente del departamento de Yandex Cloud hace una visión general básica de las capacidades de ClickHouse desde el punto de vista de la seguridad. @@ -217,7 +217,7 @@ Si usted usa `CLion` como IDE, puede aprovechar algunos `clang-tidy` comprueba f `FORTIFY_SOURCE` se utiliza de forma predeterminada. Es casi inútil, pero todavía tiene sentido en casos raros y no lo desactivamos. -## Estilo de código {#code-style} +## Estilo De código {#code-style} Se describen las reglas de estilo de código [aqui](https://clickhouse.tech/docs/en/development/style/). @@ -235,11 +235,11 @@ Cada lanzamiento de ClickHouse se prueba con los motores Yandex Metrica y AppMet Estas pruebas son automatizadas por un equipo separado. Debido a la gran cantidad de piezas móviles, las pruebas fallan la mayor parte del tiempo por razones completamente no relacionadas, que son muy difíciles de descubrir. Lo más probable es que estas pruebas tengan un valor negativo para nosotros. Sin embargo, se demostró que estas pruebas son útiles en aproximadamente una o dos veces de cada cientos. -## Cobertura de prueba {#test-coverage} +## Cobertura De Prueba {#test-coverage} A partir de julio de 2018, no realizamos un seguimiento de la cobertura de las pruebas. -## Automatización de pruebas {#test-automation} +## Automatización De Pruebas {#test-automation} Realizamos pruebas con el CI interno de Yandex y el sistema de automatización de trabajos llamado “Sandbox”. diff --git a/docs/es/engines/database-engines/index.md b/docs/es/engines/database-engines/index.md new file mode 100644 index 00000000000..c524b2a2094 --- /dev/null +++ b/docs/es/engines/database-engines/index.md @@ -0,0 +1,21 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Database Engines +toc_priority: 27 +toc_title: "Implantaci\xF3n" +--- + +# Motores De Base De Datos {#database-engines} + +Los motores de bases de datos le permiten trabajar con tablas. + +De forma predeterminada, ClickHouse utiliza su motor de base de datos nativa, que proporciona [motores de mesa](../../engines/table-engines/index.md) y una [Dialecto SQL](../../sql-reference/syntax.md). + +También puede utilizar los siguientes motores de base de datos: + +- [MySQL](mysql.md) + +- [Perezoso](lazy.md) + +[Artículo Original](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/es/engines/database-engines/lazy.md b/docs/es/engines/database-engines/lazy.md new file mode 100644 index 00000000000..3622f45a00c --- /dev/null +++ b/docs/es/engines/database-engines/lazy.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 31 +toc_title: Perezoso +--- + +# Perezoso {#lazy} + +Mantiene las tablas en RAM solamente `expiration_time_in_seconds` segundos después del último acceso. Solo se puede usar con tablas \*Log. + +Está optimizado para almacenar muchas tablas pequeñas \* Log, para las cuales hay un largo intervalo de tiempo entre los accesos. + +## Creación De Una Base De Datos {#creating-a-database} + + CREATE DATABASE testlazy ENGINE = Lazy(expiration_time_in_seconds); + +[Artículo Original](https://clickhouse.tech/docs/en/database_engines/lazy/) diff --git a/docs/es/engines/database-engines/mysql.md b/docs/es/engines/database-engines/mysql.md new file mode 100644 index 00000000000..dd6855ba3f5 --- /dev/null +++ b/docs/es/engines/database-engines/mysql.md @@ -0,0 +1,135 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 30 +toc_title: MySQL +--- + +# Mysql {#mysql} + +Permite conectarse a bases de datos en un servidor MySQL remoto y realizar `INSERT` y `SELECT` consultas para intercambiar datos entre ClickHouse y MySQL. + +El `MySQL` motor de base de datos traducir consultas al servidor MySQL para que pueda realizar operaciones tales como `SHOW TABLES` o `SHOW CREATE TABLE`. + +No puede realizar las siguientes consultas: + +- `RENAME` +- `CREATE TABLE` +- `ALTER` + +## Creación De Una Base De Datos {#creating-a-database} + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] +ENGINE = MySQL('host:port', 'database', 'user', 'password') +``` + +**Parámetros del motor** + +- `host:port` — MySQL server address. +- `database` — Remote database name. +- `user` — MySQL user. +- `password` — User password. + +## Soporte De Tipos De Datos {#data_types-support} + +| MySQL | Haga clic en Casa | +|----------------------------------|--------------------------------------------------------------| +| UNSIGNED TINYINT | [UInt8](../../sql-reference/data-types/int-uint.md) | +| TINYINT | [Int8](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED SMALLINT | [UInt16](../../sql-reference/data-types/int-uint.md) | +| SMALLINT | [Int16](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql-reference/data-types/int-uint.md) | +| INT, MEDIUMINT | [Int32](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED BIGINT | [UInt64](../../sql-reference/data-types/int-uint.md) | +| BIGINT | [Int64](../../sql-reference/data-types/int-uint.md) | +| FLOAT | [Float32](../../sql-reference/data-types/float.md) | +| DOUBLE | [Float64](../../sql-reference/data-types/float.md) | +| DATE | [Fecha](../../sql-reference/data-types/date.md) | +| DATETIME, TIMESTAMP | [FechaHora](../../sql-reference/data-types/datetime.md) | +| BINARY | [Cadena fija](../../sql-reference/data-types/fixedstring.md) | + +Todos los demás tipos de datos MySQL se convierten en [Cadena](../../sql-reference/data-types/string.md). + +[NULL](../../sql-reference/data-types/nullable.md) se admite. + +## Ejemplos De Uso {#examples-of-use} + +Tabla en MySQL: + +``` text +mysql> USE test; +Database changed + +mysql> CREATE TABLE `mysql_table` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `float` FLOAT NOT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from mysql_table; ++------+-----+ +| int_id | value | ++------+-----+ +| 1 | 2 | ++------+-----+ +1 row in set (0,00 sec) +``` + +Base de datos en ClickHouse, intercambiando datos con el servidor MySQL: + +``` sql +CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') +``` + +``` sql +SHOW DATABASES +``` + +``` text +┌─name─────┐ +│ default │ +│ mysql_db │ +│ system │ +└──────────┘ +``` + +``` sql +SHOW TABLES FROM mysql_db +``` + +``` text +┌─name─────────┐ +│ mysql_table │ +└──────────────┘ +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +└────────┴───────┘ +``` + +``` sql +INSERT INTO mysql_db.mysql_table VALUES (3,4) +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +│ 3 │ 4 │ +└────────┴───────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/es/engines/database_engines/index.md b/docs/es/engines/database_engines/index.md deleted file mode 100644 index 6a06a9d6952..00000000000 --- a/docs/es/engines/database_engines/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Database Engines -toc_priority: 27 -toc_title: "Implantaci\xF3n" ---- - -# Motores de base de datos {#database-engines} - -Los motores de bases de datos le permiten trabajar con tablas. - -De forma predeterminada, ClickHouse utiliza su motor de base de datos nativa, que proporciona [motores de mesa](../../engines/table_engines/index.md) y una [Dialecto SQL](../../sql_reference/syntax.md). - -También puede utilizar los siguientes motores de base de datos: - -- [MySQL](mysql.md) - -- [Perezoso](lazy.md) - -[Artículo Original](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/es/engines/database_engines/lazy.md b/docs/es/engines/database_engines/lazy.md deleted file mode 100644 index 602a83df606..00000000000 --- a/docs/es/engines/database_engines/lazy.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 31 -toc_title: Perezoso ---- - -# Perezoso {#lazy} - -Mantiene las tablas en RAM solamente `expiration_time_in_seconds` segundos después del último acceso. Solo se puede usar con tablas \*Log. - -Está optimizado para almacenar muchas tablas pequeñas \* Log, para las cuales hay un largo intervalo de tiempo entre los accesos. - -## Creación de una base de datos {#creating-a-database} - - CREATE DATABASE testlazy ENGINE = Lazy(expiration_time_in_seconds); - -[Artículo Original](https://clickhouse.tech/docs/en/database_engines/lazy/) diff --git a/docs/es/engines/database_engines/mysql.md b/docs/es/engines/database_engines/mysql.md deleted file mode 100644 index 18e1752e4da..00000000000 --- a/docs/es/engines/database_engines/mysql.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 30 -toc_title: MySQL ---- - -# Mysql {#mysql} - -Permite conectarse a bases de datos en un servidor MySQL remoto y realizar `INSERT` y `SELECT` consultas para intercambiar datos entre ClickHouse y MySQL. - -El `MySQL` motor de base de datos traducir consultas al servidor MySQL para que pueda realizar operaciones tales como `SHOW TABLES` o `SHOW CREATE TABLE`. - -No puede realizar las siguientes consultas: - -- `RENAME` -- `CREATE TABLE` -- `ALTER` - -## Creación de una base de datos {#creating-a-database} - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] -ENGINE = MySQL('host:port', 'database', 'user', 'password') -``` - -**Parámetros del motor** - -- `host:port` — MySQL server address. -- `database` — Remote database name. -- `user` — MySQL user. -- `password` — User password. - -## Soporte de tipos de datos {#data_types-support} - -| MySQL | Haga clic en Casa | -|----------------------------------|--------------------------------------------------------------| -| UNSIGNED TINYINT | [UInt8](../../sql_reference/data_types/int_uint.md) | -| TINYINT | [Int8](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED SMALLINT | [UInt16](../../sql_reference/data_types/int_uint.md) | -| SMALLINT | [Int16](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql_reference/data_types/int_uint.md) | -| INT, MEDIUMINT | [Int32](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED BIGINT | [UInt64](../../sql_reference/data_types/int_uint.md) | -| BIGINT | [Int64](../../sql_reference/data_types/int_uint.md) | -| FLOAT | [Float32](../../sql_reference/data_types/float.md) | -| DOUBLE | [Float64](../../sql_reference/data_types/float.md) | -| DATE | [Fecha](../../sql_reference/data_types/date.md) | -| DATETIME, TIMESTAMP | [FechaHora](../../sql_reference/data_types/datetime.md) | -| BINARY | [Cadena fija](../../sql_reference/data_types/fixedstring.md) | - -Todos los demás tipos de datos MySQL se convierten en [Cadena](../../sql_reference/data_types/string.md). - -[NULL](../../sql_reference/data_types/nullable.md) se admite. - -## Ejemplos de uso {#examples-of-use} - -Tabla en MySQL: - -``` text -mysql> USE test; -Database changed - -mysql> CREATE TABLE `mysql_table` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `float` FLOAT NOT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from mysql_table; -+------+-----+ -| int_id | value | -+------+-----+ -| 1 | 2 | -+------+-----+ -1 row in set (0,00 sec) -``` - -Base de datos en ClickHouse, intercambiando datos con el servidor MySQL: - -``` sql -CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') -``` - -``` sql -SHOW DATABASES -``` - -``` text -┌─name─────┐ -│ default │ -│ mysql_db │ -│ system │ -└──────────┘ -``` - -``` sql -SHOW TABLES FROM mysql_db -``` - -``` text -┌─name─────────┐ -│ mysql_table │ -└──────────────┘ -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -└────────┴───────┘ -``` - -``` sql -INSERT INTO mysql_db.mysql_table VALUES (3,4) -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -│ 3 │ 4 │ -└────────┴───────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/es/engines/table-engines/index.md b/docs/es/engines/table-engines/index.md new file mode 100644 index 00000000000..8142f31eeb2 --- /dev/null +++ b/docs/es/engines/table-engines/index.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Table Engines +toc_priority: 26 +toc_title: "Implantaci\xF3n" +--- + +# Motores De Mesa {#table_engines} + +El motor de tabla (tipo de tabla) determina: + +- Cómo y dónde se almacenan los datos, dónde escribirlos y dónde leerlos. +- Qué consultas son compatibles y cómo. +- Acceso a datos simultáneos. +- Uso de índices, si está presente. +- Si es posible la ejecución de solicitudes multiproceso. +- Parámetros de replicación de datos. + +## Familias De Motores {#engine-families} + +### Mergetree {#mergetree} + +Los motores de mesa más universales y funcionales para tareas de alta carga. La propiedad compartida por estos motores es la inserción rápida de datos con el posterior procesamiento de datos en segundo plano. `MergeTree` Los motores familiares admiten la replicación de datos (con [Replicado\*](mergetree-family/replication.md) versiones de motores), particionamiento y otras características no admitidas en otros motores. + +Motores en la familia: + +- [Método de codificación de datos:](mergetree-family/mergetree.md) +- [ReplacingMergeTree](mergetree-family/replacingmergetree.md) +- [SummingMergeTree](mergetree-family/summingmergetree.md) +- [AgregaciónMergeTree](mergetree-family/aggregatingmergetree.md) +- [ColapsarMergeTree](mergetree-family/collapsingmergetree.md) +- [VersionedCollapsingMergeTree](mergetree-family/versionedcollapsingmergetree.md) +- [GraphiteMergeTree](mergetree-family/graphitemergetree.md) + +### Registro {#log} + +Ligero [motor](log-family/index.md) con funcionalidad mínima. Son los más efectivos cuando necesita escribir rápidamente muchas tablas pequeñas (hasta aproximadamente 1 millón de filas) y leerlas más tarde como un todo. + +Motores en la familia: + +- [TinyLog](log-family/tinylog.md) +- [StripeLog](log-family/stripelog.md) +- [Registro](log-family/log.md) + +### Motores De integración {#integration-engines} + +Motores para comunicarse con otros sistemas de almacenamiento y procesamiento de datos. + +Motores en la familia: + +- [Kafka](integrations/kafka.md) +- [MySQL](integrations/mysql.md) +- [ODBC](integrations/odbc.md) +- [JDBC](integrations/jdbc.md) +- [HDFS](integrations/hdfs.md) + +### Motores Especiales {#special-engines} + +Motores en la familia: + +- [Distribuido](special/distributed.md) +- [Método de codificación de datos:](special/materializedview.md) +- [Diccionario](special/dictionary.md) +- [Fusionar](special/merge.md) +- [File](special/file.md) +- [Nulo](special/null.md) +- [Establecer](special/set.md) +- [Unir](special/join.md) +- [URL](special/url.md) +- [Vista](special/view.md) +- [Memoria](special/memory.md) +- [Búfer](special/buffer.md) + +## Virtual Columnas {#table_engines-virtual-columns} + +La columna virtual es un atributo de motor de tabla integral que se define en el código fuente del motor. + +No debe especificar columnas virtuales en el `CREATE TABLE` consulta y no puedes verlos en `SHOW CREATE TABLE` y `DESCRIBE TABLE` resultados de la consulta. Las columnas virtuales también son de solo lectura, por lo que no puede insertar datos en columnas virtuales. + +Para seleccionar datos de una columna virtual, debe especificar su nombre en el `SELECT` consulta. `SELECT *` no devuelve valores de columnas virtuales. + +Si crea una tabla con una columna que tiene el mismo nombre que una de las columnas virtuales de la tabla, la columna virtual se vuelve inaccesible. No recomendamos hacer esto. Para ayudar a evitar conflictos, los nombres de columna virtual suelen tener el prefijo de un guión bajo. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/es/engines/table-engines/integrations/hdfs.md b/docs/es/engines/table-engines/integrations/hdfs.md new file mode 100644 index 00000000000..3642c0c48e1 --- /dev/null +++ b/docs/es/engines/table-engines/integrations/hdfs.md @@ -0,0 +1,123 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 36 +toc_title: HDFS +--- + +# HDFS {#table_engines-hdfs} + +Este motor proporciona integración con [Acerca de nosotros](https://en.wikipedia.org/wiki/Apache_Hadoop) permitiendo gestionar datos sobre [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)a través de ClickHouse. Este motor es similar +a la [File](../special/file.md) y [URL](../special/url.md) motores, pero proporciona características específicas de Hadoop. + +## Uso {#usage} + +``` sql +ENGINE = HDFS(URI, format) +``` + +El `URI` El parámetro es el URI del archivo completo en HDFS. +El `format` parámetro especifica uno de los formatos de archivo disponibles. Realizar +`SELECT` consultas, el formato debe ser compatible para la entrada, y para realizar +`INSERT` queries – for output. The available formats are listed in the +[Formato](../../../interfaces/formats.md#formats) apartado. +La parte de la ruta de `URI` puede contener globs. En este caso, la tabla sería de solo lectura. + +**Ejemplo:** + +**1.** Configurar el `hdfs_engine_table` tabla: + +``` sql +CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') +``` + +**2.** Llenar archivo: + +``` sql +INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) +``` + +**3.** Consultar los datos: + +``` sql +SELECT * FROM hdfs_engine_table LIMIT 2 +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Detalles De implementación {#implementation-details} + +- Las lecturas y escrituras pueden ser paralelas +- No soportado: + - `ALTER` y `SELECT...SAMPLE` operación. + - Índices. + - Replicación. + +**Globs en el camino** + +Múltiples componentes de ruta de acceso pueden tener globs. Para ser procesado, el archivo debe existir y coincidir con todo el patrón de ruta. Listado de archivos determina durante `SELECT` (no en `CREATE` momento). + +- `*` — Substitutes any number of any characters except `/` incluyendo cadena vacía. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +Construcciones con `{}` son similares a la [remoto](../../../sql-reference/table-functions/remote.md) función de la tabla. + +**Ejemplo** + +1. Supongamos que tenemos varios archivos en formato TSV con los siguientes URI en HDFS: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. Hay varias maneras de hacer una tabla que consta de los seis archivos: + + + +``` sql +CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') +``` + +Otra forma: + +``` sql +CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') +``` + +La tabla consta de todos los archivos en ambos directorios (todos los archivos deben satisfacer el formato y el esquema descritos en la consulta): + +``` sql +CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') +``` + +!!! warning "Advertencia" + Si la lista de archivos contiene rangos de números con ceros a la izquierda, use la construcción con llaves para cada dígito por separado o use `?`. + +**Ejemplo** + +Crear tabla con archivos llamados `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') +``` + +## Virtual Columnas {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Ver también** + +- [Virtual columnas](../index.md#table_engines-virtual_columns) + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/es/engines/table_engines/integrations/index.md b/docs/es/engines/table-engines/integrations/index.md similarity index 100% rename from docs/es/engines/table_engines/integrations/index.md rename to docs/es/engines/table-engines/integrations/index.md diff --git a/docs/es/engines/table-engines/integrations/jdbc.md b/docs/es/engines/table-engines/integrations/jdbc.md new file mode 100644 index 00000000000..dd514468bc5 --- /dev/null +++ b/docs/es/engines/table-engines/integrations/jdbc.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 34 +toc_title: JDBC +--- + +# JDBC {#table-engine-jdbc} + +Permite que ClickHouse se conecte a bases de datos externas a través de [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). + +Para implementar la conexión JDBC, ClickHouse utiliza el programa independiente [Sistema abierto.](https://github.com/alex-krash/clickhouse-jdbc-bridge) que debería ejecutarse como un demonio. + +Este motor soporta el [NULL](../../../sql-reference/data-types/nullable.md) tipo de datos. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name +( + columns list... +) +ENGINE = JDBC(dbms_uri, external_database, external_table) +``` + +**Parámetros del motor** + +- `dbms_uri` — URI of an external DBMS. + + Formato: `jdbc:://:/?user=&password=`. + Ejemplo para MySQL: `jdbc:mysql://localhost:3306/?user=root&password=root`. + +- `external_database` — Database in an external DBMS. + +- `external_table` — Name of the table in `external_database`. + +## Ejemplo De Uso {#usage-example} + +Crear una tabla en el servidor MySQL conectándose directamente con su cliente de consola: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Creación de una tabla en el servidor ClickHouse y selección de datos de ella: + +``` sql +CREATE TABLE jdbc_table +( + `int_id` Int32, + `int_nullable` Nullable(Int32), + `float` Float32, + `float_nullable` Nullable(Float32) +) +ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') +``` + +``` sql +SELECT * +FROM jdbc_table +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Ver también {#see-also} + +- [Función de la tabla de JDBC](../../../sql-reference/table-functions/jdbc.md). + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/es/engines/table-engines/integrations/kafka.md b/docs/es/engines/table-engines/integrations/kafka.md new file mode 100644 index 00000000000..3d7b82a7838 --- /dev/null +++ b/docs/es/engines/table-engines/integrations/kafka.md @@ -0,0 +1,176 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 32 +toc_title: Kafka +--- + +# Kafka {#kafka} + +Este motor funciona con [Acerca de nosotros](http://kafka.apache.org/). + +Kafka te permite: + +- Publicar o suscribirse a flujos de datos. +- Organice el almacenamiento tolerante a fallos. +- Secuencias de proceso a medida que estén disponibles. + +## Creación De Una Tabla {#table_engine-kafka-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = Kafka() +SETTINGS + kafka_broker_list = 'host:port', + kafka_topic_list = 'topic1,topic2,...', + kafka_group_name = 'group_name', + kafka_format = 'data_format'[,] + [kafka_row_delimiter = 'delimiter_symbol',] + [kafka_schema = '',] + [kafka_num_consumers = N,] + [kafka_skip_broken_messages = N] +``` + +Parámetros requeridos: + +- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). +- `kafka_topic_list` – A list of Kafka topics. +- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don’t want messages to be duplicated in the cluster, use the same group name everywhere. +- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` función, tal como `JSONEachRow`. Para obtener más información, consulte [Formato](../../../interfaces/formats.md) apartado. + +Parámetros opcionales: + +- `kafka_row_delimiter` – Delimiter character, which ends the message. +- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap’n Proto](https://capnproto.org/) requiere la ruta de acceso al archivo de esquema y el nombre de la raíz `schema.capnp:Message` objeto. +- `kafka_num_consumers` – The number of consumers per table. Default: `1`. Especifique más consumidores si el rendimiento de un consumidor es insuficiente. El número total de consumidores no debe exceder el número de particiones en el tema, ya que solo se puede asignar un consumidor por partición. +- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. Si `kafka_skip_broken_messages = N` entonces el motor salta *N* Mensajes de Kafka que no se pueden analizar (un mensaje es igual a una fila de datos). + +Ejemplos: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + SELECT * FROM queue LIMIT 5; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', + kafka_topic_list = 'topic', + kafka_group_name = 'group1', + kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') + SETTINGS kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; +``` + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No utilice este método en nuevos proyectos. Si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format + [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) +``` + +
+ +## Descripci {#description} + +Los mensajes entregados se realizan un seguimiento automático, por lo que cada mensaje de un grupo solo se cuenta una vez. Si desea obtener los datos dos veces, cree una copia de la tabla con otro nombre de grupo. + +Los grupos son flexibles y se sincronizan en el clúster. Por ejemplo, si tiene 10 temas y 5 copias de una tabla en un clúster, cada copia obtiene 2 temas. Si el número de copias cambia, los temas se redistribuyen automáticamente entre las copias. Lea más sobre esto en http://kafka.apache.org/intro . + +`SELECT` no es particularmente útil para leer mensajes (excepto para la depuración), ya que cada mensaje se puede leer solo una vez. Es más práctico crear subprocesos en tiempo real utilizando vistas materializadas. Para hacer esto: + +1. Use el motor para crear un consumidor de Kafka y considérelo como un flujo de datos. +2. Crea una tabla con la estructura deseada. +3. Cree una vista materializada que convierta los datos del motor y los coloque en una tabla creada previamente. + +Cuando el `MATERIALIZED VIEW` se une al motor, comienza a recopilar datos en segundo plano. Esto le permite recibir continuamente mensajes de Kafka y convertirlos al formato requerido usando `SELECT`. +Una tabla kafka puede tener tantas vistas materializadas como desee, no leen datos de la tabla kafka directamente, sino que reciben nuevos registros (en bloques), de esta manera puede escribir en varias tablas con diferentes niveles de detalle (con agrupación - agregación y sin). + +Ejemplo: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + CREATE TABLE daily ( + day Date, + level String, + total UInt64 + ) ENGINE = SummingMergeTree(day, (day, level), 8192); + + CREATE MATERIALIZED VIEW consumer TO daily + AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total + FROM queue GROUP BY day, level; + + SELECT level, sum(total) FROM daily GROUP BY level; +``` + +Para mejorar el rendimiento, los mensajes recibidos se agrupan en bloques del tamaño de [Max\_insert\_block\_size](../../../operations/server-configuration-parameters/settings.md#settings-max_insert_block_size). Si el bloque no se formó dentro de [Nombre de la red inalámbrica (SSID):](../../../operations/server-configuration-parameters/settings.md) milisegundos, los datos se vaciarán a la tabla independientemente de la integridad del bloque. + +Para detener la recepción de datos de tema o cambiar la lógica de conversión, desconecte la vista materializada: + +``` sql + DETACH TABLE consumer; + ATTACH TABLE consumer; +``` + +Si desea cambiar la tabla de destino utilizando `ALTER`, recomendamos deshabilitar la vista de material para evitar discrepancias entre la tabla de destino y los datos de la vista. + +## Configuración {#configuration} + +Similar a GraphiteMergeTree, el motor Kafka admite una configuración extendida utilizando el archivo de configuración ClickHouse. Hay dos claves de configuración que puede usar: global (`kafka`) y a nivel de tema (`kafka_*`). La configuración global se aplica primero y, a continuación, se aplica la configuración de nivel de tema (si existe). + +``` xml + + + cgrp + smallest + + + + + 250 + 100000 + +``` + +Para obtener una lista de posibles opciones de configuración, consulte [referencia de configuración librdkafka](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Usa el guión bajo (`_`) en lugar de un punto en la configuración de ClickHouse. Por ejemplo, `check.crcs=true` será `true`. + +## Virtual Columnas {#virtual-columns} + +- `_topic` — Kafka topic. +- `_key` — Key of the message. +- `_offset` — Offset of the message. +- `_timestamp` — Timestamp of the message. +- `_partition` — Partition of Kafka topic. + +**Ver también** + +- [Virtual columnas](../index.md#table_engines-virtual_columns) + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/es/engines/table-engines/integrations/mysql.md b/docs/es/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..64b15ff1898 --- /dev/null +++ b/docs/es/engines/table-engines/integrations/mysql.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 33 +toc_title: MySQL +--- + +# Mysql {#mysql} + +El motor MySQL le permite realizar `SELECT` consultas sobre datos almacenados en un servidor MySQL remoto. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... +) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +Vea una descripción detallada del [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) consulta. + +La estructura de la tabla puede diferir de la estructura de la tabla MySQL original: + +- Los nombres de columna deben ser los mismos que en la tabla MySQL original, pero puede usar solo algunas de estas columnas y en cualquier orden. +- Los tipos de columna pueden diferir de los de la tabla MySQL original. ClickHouse intenta [elenco](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) valores a los tipos de datos ClickHouse. + +**Parámetros del motor** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` consultas a `REPLACE INTO`. Si `replace_query=1`, la consulta se sustituye. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expresión que se añade a la `INSERT` consulta. + + Ejemplo: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, donde `on_duplicate_clause` ser `UPDATE c2 = c2 + 1`. Ver el [Documentación de MySQL](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) para encontrar qué `on_duplicate_clause` se puede utilizar con el `ON DUPLICATE KEY` clausula. + + Especificar `on_duplicate_clause` tienes que pasar `0` a la `replace_query` parámetro. Si pasa simultáneamente `replace_query = 1` y `on_duplicate_clause`, ClickHouse genera una excepción. + +Simple `WHERE` cláusulas tales como `=, !=, >, >=, <, <=` se ejecutan en el servidor MySQL. + +El resto de las condiciones y el `LIMIT` La restricción de muestreo se ejecuta en ClickHouse solo después de que finalice la consulta a MySQL. + +## Ejemplo De Uso {#usage-example} + +Tabla en MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Tabla en ClickHouse, recuperando datos de la tabla MySQL creada anteriormente: + +``` sql +CREATE TABLE mysql_table +( + `float_nullable` Nullable(Float32), + `int_id` Int32 +) +ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` sql +SELECT * FROM mysql_table +``` + +``` text +┌─float_nullable─┬─int_id─┐ +│ ᴺᵁᴸᴸ │ 1 │ +└────────────────┴────────┘ +``` + +## Ver también {#see-also} + +- [El ‘mysql’ función de la tabla](../../../sql-reference/table-functions/mysql.md) +- [Uso de MySQL como fuente de diccionario externo](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/es/engines/table-engines/integrations/odbc.md b/docs/es/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..385faac9010 --- /dev/null +++ b/docs/es/engines/table-engines/integrations/odbc.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 35 +toc_title: ODBC +--- + +# ODBC {#table-engine-odbc} + +Permite que ClickHouse se conecte a bases de datos externas a través de [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +Para implementar con seguridad conexiones ODBC, ClickHouse usa un programa separado `clickhouse-odbc-bridge`. Si el controlador ODBC se carga directamente desde `clickhouse-server`, problemas de controlador pueden bloquear el servidor ClickHouse. ClickHouse se inicia automáticamente `clickhouse-odbc-bridge` cuando se requiere. El programa de puente ODBC se instala desde el mismo paquete que el `clickhouse-server`. + +Este motor soporta el [NULL](../../../sql-reference/data-types/nullable.md) tipo de datos. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +Vea una descripción detallada del [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) consulta. + +La estructura de la tabla puede diferir de la estructura de la tabla de origen: + +- Los nombres de columna deben ser los mismos que en la tabla de origen, pero puede usar solo algunas de estas columnas y en cualquier orden. +- Los tipos de columna pueden diferir de los de la tabla de origen. ClickHouse intenta [elenco](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) valores a los tipos de datos ClickHouse. + +**Parámetros del motor** + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` file. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +## Ejemplo De Uso {#usage-example} + +**Recuperación de datos de la instalación local de MySQL a través de ODBC** + +Este ejemplo se comprueba para Ubuntu Linux 18.04 y el servidor MySQL 5.7. + +Asegúrese de que unixODBC y MySQL Connector están instalados. + +De forma predeterminada (si se instala desde paquetes), ClickHouse comienza como usuario `clickhouse`. Por lo tanto, debe crear y configurar este usuario en el servidor MySQL. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +A continuación, configure la conexión en `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Puede verificar la conexión usando el `isql` utilidad desde la instalación de unixODBC. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +Tabla en MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Tabla en ClickHouse, recuperando datos de la tabla MySQL: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## Ver también {#see-also} + +- [Diccionarios externos ODBC](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [Tabla ODBC función](../../../sql-reference/table-functions/odbc.md) + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/es/engines/table_engines/log_family/index.md b/docs/es/engines/table-engines/log-family/index.md similarity index 100% rename from docs/es/engines/table_engines/log_family/index.md rename to docs/es/engines/table-engines/log-family/index.md diff --git a/docs/es/engines/table-engines/log-family/log-family.md b/docs/es/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..f73b8cfa8db --- /dev/null +++ b/docs/es/engines/table-engines/log-family/log-family.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 31 +toc_title: "Implantaci\xF3n" +--- + +# Familia Del Motor De Registro {#log-engine-family} + +Estos motores fueron desarrollados para escenarios en los que necesita escribir rápidamente muchas tablas pequeñas (hasta aproximadamente 1 millón de filas) y leerlas más tarde en su conjunto. + +Motores de la familia: + +- [StripeLog](stripelog.md) +- [Registro](log.md) +- [TinyLog](tinylog.md) + +## Propiedades Comunes {#common-properties} + +Motor: + +- Almacenar datos en un disco. + +- Agregue datos al final del archivo al escribir. + +- Bloqueos de soporte para el acceso a datos simultáneos. + + Durante `INSERT` consultas, la tabla está bloqueada y otras consultas para leer y escribir datos esperan a que la tabla se desbloquee. Si no hay consultas de escritura de datos, se puede realizar cualquier número de consultas de lectura de datos simultáneamente. + +- No apoyo [mutación](../../../sql-reference/statements/alter.md#alter-mutations) operación. + +- No admite índices. + + Esto significa que `SELECT` las consultas para rangos de datos no son eficientes. + +- No escriba datos atómicamente. + + Puede obtener una tabla con datos dañados si algo rompe la operación de escritura, por ejemplo, un cierre anormal del servidor. + +## Diferencia {#differences} + +El `TinyLog` es el más simple de la familia y proporciona la funcionalidad más pobre y la eficiencia más baja. El `TinyLog` el motor no admite la lectura de datos paralelos por varios hilos. Lee datos más lentamente que otros motores de la familia que admiten lectura paralela y utiliza casi tantos descriptores como los `Log` motor porque almacena cada columna en un archivo separado. Úselo en escenarios simples de baja carga. + +El `Log` y `StripeLog` Los motores admiten lectura de datos paralela. Al leer datos, ClickHouse usa múltiples hilos. Cada subproceso procesa un bloque de datos separado. El `Log` utiliza un archivo separado para cada columna de la tabla. `StripeLog` almacena todos los datos en un archivo. Como resultado, el `StripeLog` el motor utiliza menos descriptores en el sistema operativo, pero el `Log` proporciona una mayor eficiencia al leer datos. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/es/engines/table-engines/log-family/log.md b/docs/es/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..d361389e8da --- /dev/null +++ b/docs/es/engines/table-engines/log-family/log.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 33 +toc_title: Registro +--- + +# Registro {#log} + +El motor pertenece a la familia de motores de registro. Consulte las propiedades comunes de los motores de registro y sus diferencias en [Familia del motor de registro](log-family.md) artículo. + +El registro difiere de [TinyLog](tinylog.md) en que un pequeño archivo de “marks” reside con los archivos de columna. Estas marcas se escriben en cada bloque de datos y contienen compensaciones que indican dónde comenzar a leer el archivo para omitir el número especificado de filas. Esto hace posible leer datos de tabla en múltiples hilos. +Para el acceso a datos simultáneos, las operaciones de lectura se pueden realizar simultáneamente, mientras que las operaciones de escritura bloquean las lecturas entre sí. +El motor de registro no admite índices. Del mismo modo, si la escritura en una tabla falla, la tabla se rompe y la lectura de ella devuelve un error. El motor de registro es adecuado para datos temporales, tablas de escritura única y para fines de prueba o demostración. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/es/engines/table-engines/log-family/stripelog.md b/docs/es/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..f96f3f73923 --- /dev/null +++ b/docs/es/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,95 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 32 +toc_title: StripeLog +--- + +# Lista De Stripelog {#stripelog} + +Este motor pertenece a la familia de motores de registro. Consulte las propiedades comunes de los motores de registro y sus diferencias en [Familia del motor de registro](log-family.md) artículo. + +Utilice este motor en escenarios en los que necesite escribir muchas tablas con una pequeña cantidad de datos (menos de 1 millón de filas). + +## Creación De Una Tabla {#table_engines-stripelog-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = StripeLog +``` + +Vea la descripción detallada del [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) consulta. + +## Escribir Los Datos {#table_engines-stripelog-writing-the-data} + +El `StripeLog` el motor almacena todas las columnas en un archivo. Para cada `INSERT` consulta, ClickHouse agrega el bloque de datos al final de un archivo de tabla, escribiendo columnas una por una. + +Para cada tabla, ClickHouse escribe los archivos: + +- `data.bin` — Data file. +- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. + +El `StripeLog` el motor no soporta el `ALTER UPDATE` y `ALTER DELETE` operación. + +## Lectura De Los Datos {#table_engines-stripelog-reading-the-data} + +El archivo con marcas permite ClickHouse paralelizar la lectura de datos. Esto significa que un `SELECT` query devuelve filas en un orden impredecible. Utilice el `ORDER BY` cláusula para ordenar filas. + +## Ejemplo De Uso {#table_engines-stripelog-example-of-use} + +Creación de una tabla: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +Insertar datos: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +Se utilizaron dos `INSERT` consultas para crear dos bloques de datos dentro del `data.bin` file. + +ClickHouse usa múltiples subprocesos al seleccionar datos. Cada subproceso lee un bloque de datos separado y devuelve las filas resultantes de forma independiente a medida que termina. Como resultado, el orden de los bloques de filas en la salida no coincide con el orden de los mismos bloques en la entrada en la mayoría de los casos. Por ejemplo: + +``` sql +SELECT * FROM stripe_log_table +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +┌───────────timestamp─┬─message_type─┬─message───────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +└─────────────────────┴──────────────┴───────────────────────────┘ +``` + +Ordenación de los resultados (orden ascendente por defecto): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/es/engines/table-engines/log-family/tinylog.md b/docs/es/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..f3a5a525925 --- /dev/null +++ b/docs/es/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 34 +toc_title: TinyLog +--- + +# TinyLog {#tinylog} + +El motor pertenece a la familia de motores de registro. Ver [Familia del motor de registro](log-family.md) para las propiedades comunes de los motores de registro y sus diferencias. + +Este motor de tablas se usa normalmente con el método write-once: escribir datos una vez, luego leerlos tantas veces como sea necesario. Por ejemplo, puede usar `TinyLog`-type tablas para datos intermedios que se procesan en pequeños lotes. Tenga en cuenta que el almacenamiento de datos en un gran número de tablas pequeñas es ineficiente. + +Las consultas se ejecutan en una sola secuencia. En otras palabras, este motor está diseñado para tablas relativamente pequeñas (hasta aproximadamente 1,000,000 filas). Tiene sentido usar este motor de tablas si tiene muchas tablas pequeñas, ya que es más simple que el [Registro](log.md) motor (menos archivos necesitan ser abiertos). + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/es/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/es/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..9be6ed08246 --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,102 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 35 +toc_title: "Agregaci\xF3nMergeTree" +--- + +# Aggregatingmergetree {#aggregatingmergetree} + +El motor hereda de [Método de codificación de datos:](mergetree.md#table_engines-mergetree), alterando la lógica para la fusión de partes de datos. ClickHouse reemplaza todas las filas con la misma clave principal (o más exactamente, con la misma [clave de clasificación](mergetree.md)) con una sola fila (dentro de una parte de datos) que almacena una combinación de estados de funciones agregadas. + +Usted puede utilizar `AggregatingMergeTree` tablas para la agregación de datos incrementales, incluidas las vistas materializadas agregadas. + +El motor procesa todas las columnas con [AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md) tipo. + +Es apropiado usar `AggregatingMergeTree` si reduce el número de filas por pedidos. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[TTL expr] +[SETTINGS name=value, ...] +``` + +Para obtener una descripción de los parámetros de solicitud, consulte [descripción de la solicitud](../../../sql-reference/statements/create.md). + +**Cláusulas de consulta** + +Al crear un `AggregatingMergeTree` mesa de la misma [clausula](mergetree.md) se requieren, como al crear un `MergeTree` tabla. + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +Todos los parámetros tienen el mismo significado que en `MergeTree`. +
+ +## SELECCIONAR e INSERTAR {#select-and-insert} + +Para insertar datos, utilice [INSERT SELECT](../../../sql-reference/statements/insert-into.md) consulta con funciones agregadas -State-. +Al seleccionar datos de `AggregatingMergeTree` mesa, uso `GROUP BY` cláusula y las mismas funciones agregadas que al insertar datos, pero usando `-Merge` sufijo. + +En los resultados de `SELECT` consulta, los valores de `AggregateFunction` tipo tiene representación binaria específica de la implementación para todos los formatos de salida de ClickHouse. Si volcar datos en, por ejemplo, `TabSeparated` formato con `SELECT` consulta entonces este volcado se puede cargar de nuevo usando `INSERT` consulta. + +## Ejemplo De Una Vista Materializada Agregada {#example-of-an-aggregated-materialized-view} + +`AggregatingMergeTree` vista materializada que mira el `test.visits` tabla: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +Insertar datos en el `test.visits` tabla. + +``` sql +INSERT INTO test.visits ... +``` + +Los datos se insertan tanto en la tabla como en la vista `test.basic` que realizará la agregación. + +Para obtener los datos agregados, necesitamos ejecutar una consulta como `SELECT ... GROUP BY ...` de la vista `test.basic`: + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/es/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/es/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..0afe9edd051 --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 36 +toc_title: ColapsarMergeTree +--- + +# Colapsarmergetree {#table_engine-collapsingmergetree} + +El motor hereda de [Método de codificación de datos:](mergetree.md) y agrega la lógica de las filas que colapsan al algoritmo de fusión de partes de datos. + +`CollapsingMergeTree` elimina de forma asincrónica (colapsa) pares de filas si todos los campos de una clave de ordenación (`ORDER BY`) son equivalentes excepto el campo particular `Sign` que puede tener `1` y `-1` valor. Las filas sin un par se mantienen. Para más detalles, consulte el [Derrumbar](#table_engine-collapsingmergetree-collapsing) sección del documento. + +El motor puede reducir significativamente el volumen de almacenamiento y aumentar la eficiencia de `SELECT` consulta como consecuencia. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Para obtener una descripción de los parámetros de consulta, consulte [descripción de la consulta](../../../sql-reference/statements/create.md). + +**CollapsingMergeTree Parámetros** + +- `sign` — Name of the column with the type of row: `1` es una “state” fila, `-1` es una “cancel” fila. + + Column data type — `Int8`. + +**Cláusulas de consulta** + +Al crear un `CollapsingMergeTree` mesa, la misma [cláusulas de consulta](mergetree.md#table_engine-mergetree-creating-a-table) se requieren, como al crear un `MergeTree` tabla. + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +Todos los parámetros excepto `sign` el mismo significado que en `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` — “state” fila, `-1` — “cancel” fila. + + Column Data Type — `Int8`. + +
+ +## Derrumbar {#table_engine-collapsingmergetree-collapsing} + +### Datos {#data} + +Considere la situación en la que necesita guardar datos que cambian continuamente para algún objeto. Parece lógico tener una fila para un objeto y actualizarla en cualquier cambio, pero la operación de actualización es costosa y lenta para DBMS porque requiere la reescritura de los datos en el almacenamiento. Si necesita escribir datos rápidamente, la actualización no es aceptable, pero puede escribir los cambios de un objeto secuencialmente de la siguiente manera. + +Utilice la columna en particular `Sign`. Si `Sign = 1` significa que la fila es un estado de un objeto, llamémoslo “state” fila. Si `Sign = -1` significa la cancelación del estado de un objeto con los mismos atributos, llamémoslo “cancel” fila. + +Por ejemplo, queremos calcular cuántas páginas revisaron los usuarios en algún sitio y cuánto tiempo estuvieron allí. En algún momento escribimos la siguiente fila con el estado de la actividad del usuario: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +En algún momento después registramos el cambio de actividad del usuario y lo escribimos con las siguientes dos filas. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +La primera fila cancela el estado anterior del objeto (usuario). Debe copiar los campos clave de ordenación del estado cancelado exceptuando `Sign`. + +La segunda fila contiene el estado actual. + +Como solo necesitamos el último estado de actividad del usuario, las filas + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +se puede eliminar colapsando el estado no válido (antiguo) de un objeto. `CollapsingMergeTree` hace esto mientras se fusionan las partes de datos. + +Por qué necesitamos 2 filas para cada cambio leído en el [Algoritmo](#table_engine-collapsingmergetree-collapsing-algorithm) apartado. + +**Propiedades peculiares de tal enfoque** + +1. El programa que escribe los datos debe recordar el estado de un objeto para poder cancelarlo. “Cancel” debe contener copias de los campos de clave de ordenación “state” y lo opuesto `Sign`. Aumenta el tamaño inicial de almacenamiento, pero permite escribir los datos rápidamente. +2. Las matrices de largo crecimiento en columnas reducen la eficiencia del motor debido a la carga para escribir. Los datos más sencillos, mayor será la eficiencia. +3. El `SELECT` Los resultados dependen en gran medida de la consistencia del historial de cambios de objetos. Sea preciso al preparar los datos para insertarlos. Puede obtener resultados impredecibles en datos incoherentes, por ejemplo, valores negativos para métricas no negativas, como la profundidad de la sesión. + +### Algoritmo {#table_engine-collapsingmergetree-collapsing-algorithm} + +Cuando ClickHouse combina partes de datos, cada grupo de filas consecutivas tiene la misma clave de ordenación (`ORDER BY`) se reduce a no más de dos filas, una con `Sign = 1` (“state” fila) y otro con `Sign = -1` (“cancel” fila). En otras palabras, las entradas colapsan. + +Para cada parte de datos resultante, ClickHouse guarda: + +1. El primero “cancel” y el último “state” si el número de “state” y “cancel” y la última fila es una “state” fila. + +2. El último “state” fila, si hay más “state” filas que “cancel” filas. + +3. El primero “cancel” fila, si hay más “cancel” filas que “state” filas. + +4. Ninguna de las filas, en todos los demás casos. + +También cuando hay al menos 2 más “state” filas que “cancel” filas, o al menos 2 más “cancel” filas entonces “state” fila, la fusión continúa, pero ClickHouse trata esta situación como un error lógico y la registra en el registro del servidor. Este error puede producirse si se insertan los mismos datos más de una vez. + +Por lo tanto, el colapso no debe cambiar los resultados del cálculo de las estadísticas. +Los cambios colapsaron gradualmente para que al final solo quedara el último estado de casi todos los objetos. + +El `Sign` se requiere porque el algoritmo de fusión no garantiza que todas las filas con la misma clave de clasificación estén en la misma parte de datos resultante e incluso en el mismo servidor físico. Proceso de ClickHouse `SELECT` consultas con múltiples hilos, y no puede predecir el orden de las filas en el resultado. La agregación es necesaria si hay una necesidad de obtener completamente “collapsed” datos de `CollapsingMergeTree` tabla. + +Para finalizar el colapso, escriba una consulta con `GROUP BY` cláusula y funciones agregadas que representan el signo. Por ejemplo, para calcular la cantidad, use `sum(Sign)` en lugar de `count()`. Para calcular la suma de algo, use `sum(Sign * x)` en lugar de `sum(x)` y así sucesivamente, y también añadir `HAVING sum(Sign) > 0`. + +Los agregados `count`, `sum` y `avg` podría calcularse de esta manera. El agregado `uniq` podría calcularse si un objeto tiene al menos un estado no colapsado. Los agregados `min` y `max` no se pudo calcular porque `CollapsingMergeTree` no guarda el historial de valores de los estados colapsados. + +Si necesita extraer datos sin agregación (por ejemplo, para comprobar si hay filas presentes cuyos valores más recientes coinciden con ciertas condiciones), puede utilizar el `FINAL` modificador para el `FROM` clausula. Este enfoque es significativamente menos eficiente. + +## Ejemplo De Uso {#example-of-use} + +Datos de ejemplo: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Creación de la tabla: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Inserción de los datos: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +Usamos dos `INSERT` consultas para crear dos partes de datos diferentes. Si insertamos los datos con una consulta, ClickHouse crea una parte de datos y nunca realizará ninguna fusión. + +Obtener los datos: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +¿qué vemos y dónde está colapsando? + +Con dos `INSERT` consultas, hemos creado 2 partes de datos. El `SELECT` la consulta se realizó en 2 hilos, y obtuvimos un orden aleatorio de filas. No se ha producido un colapso porque todavía no se había fusionado las partes de datos. ClickHouse fusiona parte de datos en un momento desconocido que no podemos predecir. + +Por lo tanto, necesitamos agregación: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +Si no necesitamos agregación y queremos forzar el colapso, podemos usar `FINAL` modificador para `FROM` clausula. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Esta forma de seleccionar los datos es muy ineficiente. No lo use para mesas grandes. + +## Ejemplo De Otro Enfoque {#example-of-another-approach} + +Datos de ejemplo: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ -5 │ -146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +La idea es que las fusiones tengan en cuenta solo los campos clave. Y en el “Cancel” línea podemos especificar valores negativos que igualan la versión anterior de la fila al sumar sin usar la columna Sign. Para este enfoque, es necesario cambiar el tipo de datos `PageViews`,`Duration` para almacenar valores negativos de UInt8 -\> Int16. + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews Int16, + Duration Int16, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Vamos a probar el enfoque: + +``` sql +insert into UAct values(4324182021466249494, 5, 146, 1); +insert into UAct values(4324182021466249494, -5, -146, -1); +insert into UAct values(4324182021466249494, 6, 185, 1); + +select * from UAct final; // avoid using final in production (just for a test or small tables) +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +``` sql +SELECT + UserID, + sum(PageViews) AS PageViews, + sum(Duration) AS Duration +FROM UAct +GROUP BY UserID +```text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +``` sqk +select count() FROM UAct +``` + +``` text +┌─count()─┐ +│ 3 │ +└─────────┘ +``` + +``` sql +optimize table UAct final; + +select * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/es/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/es/engines/table-engines/mergetree-family/custom-partitioning-key.md new file mode 100644 index 00000000000..70443831098 --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,127 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 32 +toc_title: "Clave de partici\xF3n personalizada" +--- + +# Clave De partición Personalizada {#custom-partitioning-key} + +La partición está disponible para el [Método de codificación de datos:](mergetree.md) mesas familiares (incluyendo [repetición](replication.md) tabla). [Vistas materializadas](../special/materializedview.md) basado en tablas MergeTree soporte de particionamiento, también. + +Una partición es una combinación lógica de registros en una tabla por un criterio especificado. Puede establecer una partición por un criterio arbitrario, como por mes, por día o por tipo de evento. Cada partición se almacena por separado para simplificar las manipulaciones de estos datos. Al acceder a los datos, ClickHouse utiliza el subconjunto más pequeño de particiones posible. + +La partición se especifica en el `PARTITION BY expr` cláusula cuando [creando una tabla](mergetree.md#table_engine-mergetree-creating-a-table). La clave de partición puede ser cualquier expresión de las columnas de la tabla. Por ejemplo, para especificar la partición por mes, utilice la expresión `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour; +``` + +La clave de partición también puede ser una tupla de expresiones (similar a la [clave primaria](mergetree.md#primary-keys-and-indexes-in-queries)). Por ejemplo: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +En este ejemplo, establecemos la partición por los tipos de eventos que se produjeron durante la semana actual. + +Al insertar datos nuevos en una tabla, estos datos se almacenan como una parte separada (porción) ordenada por la clave principal. En 10-15 minutos después de insertar, las partes de la misma partición se fusionan en toda la parte. + +!!! info "INFO" + Una combinación solo funciona para partes de datos que tienen el mismo valor para la expresión de partición. Esto significa **no deberías hacer particiones demasiado granulares** (más de un millar de particiones). De lo contrario, el `SELECT` consulta funciona mal debido a un número excesivamente grande de archivos en el sistema de archivos y descriptores de archivos abiertos. + +Utilice el [sistema.parte](../../../operations/system-tables.md#system_tables-parts) tabla para ver las partes y particiones de la tabla. Por ejemplo, supongamos que tenemos un `visits` tabla con partición por mes. Vamos a realizar el `SELECT` consulta para el `system.parts` tabla: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 1 │ +│ 201902 │ 201902_11_11_0 │ 1 │ +└───────────┴────────────────┴────────┘ +``` + +El `partition` columna contiene los nombres de las particiones. Hay dos particiones en este ejemplo: `201901` y `201902`. Puede utilizar este valor de columna para especificar el nombre de partición en [ALTER … PARTITION](#alter_manipulations-with-partitions) consulta. + +El `name` columna contiene los nombres de las partes de datos de partición. Puede utilizar esta columna para especificar el nombre de la pieza [ALTER ATTACH PART](#alter_attach-partition) consulta. + +Vamos a desglosar el nombre de la primera parte: `201901_1_3_1`: + +- `201901` es el nombre de la partición. +- `1` es el número mínimo del bloque de datos. +- `3` es el número máximo del bloque de datos. +- `1` es el nivel de fragmento (la profundidad del árbol de fusión del que se forma). + +!!! info "INFO" + Las partes de las tablas de tipo antiguo tienen el nombre: `20190117_20190123_2_2_0` (fecha mínima - fecha máxima - número de bloque mínimo - número de bloque máximo - nivel). + +El `active` columna muestra el estado de la pieza. `1` está activo; `0` está inactivo. Las partes inactivas son, por ejemplo, las partes de origen que quedan después de fusionarse con una parte más grande. Las partes de datos dañadas también se indican como inactivas. + +Como puede ver en el ejemplo, hay varias partes separadas de la misma partición (por ejemplo, `201901_1_3_1` y `201901_1_9_2`). Esto significa que estas partes aún no están fusionadas. ClickHouse combina las partes insertadas de datos periódicamente, aproximadamente 15 minutos después de la inserción. Además, puede realizar una fusión no programada utilizando el [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) consulta. Ejemplo: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 0 │ +│ 201902 │ 201902_4_11_2 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 0 │ +│ 201902 │ 201902_11_11_0 │ 0 │ +└───────────┴────────────────┴────────┘ +``` + +Las partes inactivas se eliminarán aproximadamente 10 minutos después de la fusión. + +Otra forma de ver un conjunto de partes y particiones es ir al directorio de la tabla: `/var/lib/clickhouse/data//
/`. Por ejemplo: + +``` bash +/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +Carpeta ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ y así sucesivamente son los directorios de las partes. Cada parte se relaciona con una partición correspondiente y contiene datos solo para un mes determinado (la tabla de este ejemplo tiene particiones por mes). + +El `detached` el directorio contiene partes que se separaron de la tabla utilizando el [DETACH](#alter_detach-partition) consulta. Las partes dañadas también se mueven a este directorio, en lugar de eliminarse. El servidor no utiliza las piezas del `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql-reference/statements/alter.md#alter_attach-partition) consulta. + +Tenga en cuenta que en el servidor operativo, no puede cambiar manualmente el conjunto de piezas o sus datos en el sistema de archivos, ya que el servidor no lo sabrá. Para tablas no replicadas, puede hacer esto cuando se detiene el servidor, pero no se recomienda. Para tablas replicadas, el conjunto de piezas no se puede cambiar en ningún caso. + +ClickHouse le permite realizar operaciones con las particiones: eliminarlas, copiar de una tabla a otra o crear una copia de seguridad. Consulte la lista de todas las operaciones en la sección [Manipulaciones con particiones y piezas](../../../sql-reference/statements/alter.md#alter_manipulations-with-partitions). + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/es/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/es/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..c5700a101ff --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,174 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 38 +toc_title: GraphiteMergeTree +--- + +# Graphitemergetree {#graphitemergetree} + +Este motor está diseñado para el adelgazamiento y la agregación / promedio (rollup) [Grafito](http://graphite.readthedocs.io/en/latest/index.html) datos. Puede ser útil para los desarrolladores que desean usar ClickHouse como almacén de datos para Graphite. + +Puede usar cualquier motor de tabla ClickHouse para almacenar los datos de Graphite si no necesita un paquete acumulativo, pero si necesita un paquete acumulativo, use `GraphiteMergeTree`. El motor reduce el volumen de almacenamiento y aumenta la eficiencia de las consultas de Graphite. + +El motor hereda propiedades de [Método de codificación de datos:](mergetree.md). + +## Creación De Una Tabla {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Vea una descripción detallada del [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) consulta. + +Una tabla para los datos de grafito debe tener las siguientes columnas para los siguientes datos: + +- Nombre métrico (sensor de grafito). Tipo de datos: `String`. + +- Tiempo de medición de la métrica. Tipo de datos: `DateTime`. + +- Valor de la métrica. Tipo de datos: cualquier numérico. + +- Versión de la métrica. Tipo de datos: cualquier numérico. + + ClickHouse guarda las filas con la versión más alta o la última escrita si las versiones son las mismas. Otras filas se eliminan durante la fusión de partes de datos. + +Los nombres de estas columnas deben establecerse en la configuración acumulativa. + +**GraphiteMergeTree parámetros** + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +**Cláusulas de consulta** + +Al crear un `GraphiteMergeTree` mesa, la misma [clausula](mergetree.md#table_engine-mergetree-creating-a-table) se requieren, como al crear un `MergeTree` tabla. + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +Todos los parámetros excepto `config_section` el mismo significado que en `MergeTree`. + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +
+ +## Configuración Acumulativa {#rollup-configuration} + +La configuración del paquete acumulativo está definida por [graphite\_rollup](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) parámetro en la configuración del servidor. El nombre del parámetro podría ser cualquiera. Puede crear varias configuraciones y usarlas para diferentes tablas. + +Estructura de configuración Rollup: + + required-columns + patterns + +### Columnas Requeridas {#required-columns} + +- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. +- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. +- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Valor predeterminado: `Value`. +- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. + +### Patrón {#patterns} + +Estructura del `patterns` apartado: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "Atención" + Los patrones deben ser estrictamente ordenados: + + 1. Patterns without `function` or `retention`. + 1. Patterns with both `function` and `retention`. + 1. Pattern `default`. + +Al procesar una fila, ClickHouse comprueba las reglas en el `pattern` apartado. Cada uno de `pattern` (incluir `default` secciones pueden contener `function` parámetro para la agregación, `retention` parámetros o ambos. Si el nombre de la métrica coincide con `regexp`, las reglas de la `pattern` sección (o secciones); de lo contrario, las reglas de la `default` sección se utilizan. + +Campos para `pattern` y `default` apartado: + +- `regexp`– A pattern for the metric name. +- `age` – The minimum age of the data in seconds. +- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). +- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. + +### Ejemplo De configuración {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/es/engines/table_engines/mergetree_family/index.md b/docs/es/engines/table-engines/mergetree-family/index.md similarity index 100% rename from docs/es/engines/table_engines/mergetree_family/index.md rename to docs/es/engines/table-engines/mergetree-family/index.md diff --git a/docs/es/engines/table-engines/mergetree-family/mergetree.md b/docs/es/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..2596b253d3e --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,654 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 30 +toc_title: "M\xE9todo de codificaci\xF3n de datos:" +--- + +# Mergetree {#table_engines-mergetree} + +El `MergeTree` motor y otros motores de esta familia (`*MergeTree`) son los motores de mesa ClickHouse más robustos. + +Motores en el `MergeTree` familia están diseñados para insertar una gran cantidad de datos en una tabla. Los datos se escriben rápidamente en la tabla parte por parte, luego se aplican reglas para fusionar las partes en segundo plano. Este método es mucho más eficiente que reescribir continuamente los datos en almacenamiento durante la inserción. + +Principales características: + +- Almacena datos ordenados por clave principal. + + Esto le permite crear un pequeño índice disperso que ayuda a encontrar datos más rápido. + +- Las particiones se pueden utilizar si [clave de partición](custom-partitioning-key.md) se especifica. + + ClickHouse admite ciertas operaciones con particiones que son más efectivas que las operaciones generales en los mismos datos con el mismo resultado. ClickHouse también corta automáticamente los datos de partición donde se especifica la clave de partición en la consulta. Esto también mejora el rendimiento de las consultas. + +- Soporte de replicación de datos. + + La familia de `ReplicatedMergeTree` proporciona la replicación de datos. Para obtener más información, consulte [Replicación de datos](replication.md). + +- Soporte de muestreo de datos. + + Si es necesario, puede establecer el método de muestreo de datos en la tabla. + +!!! info "INFO" + El [Fusionar](../special/merge.md) el motor no pertenece al `*MergeTree` familia. + +## Creación De Una Tabla {#table_engine-mergetree-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 +) ENGINE = MergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] +[SETTINGS name=value, ...] +``` + +Para obtener una descripción de los parámetros, consulte [Descripción de la consulta CREATE](../../../sql-reference/statements/create.md). + +!!! note "Nota" + `INDEX` es una característica experimental, ver [Índices de saltos de datos](#table_engine-mergetree-data_skipping-indexes). + +### Cláusulas De Consulta {#mergetree-query-clauses} + +- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. El `MergeTree` el motor no tiene parámetros. + +- `PARTITION BY` — The [clave de partición](custom-partitioning-key.md). + + Para particionar por mes, utilice el `toYYYYMM(date_column)` expresión, donde `date_column` es una columna con una fecha del tipo [Fecha](../../../sql-reference/data-types/date.md). Los nombres de partición aquí tienen el `"YYYYMM"` formato. + +- `ORDER BY` — The sorting key. + + Una tupla de columnas o expresiones arbitrarias. Ejemplo: `ORDER BY (CounterID, EventDate)`. + +- `PRIMARY KEY` — The primary key if it [difiere de la clave de clasificación](#choosing-a-primary-key-that-differs-from-the-sorting-key). + + De forma predeterminada, la clave principal es la misma que la clave de ordenación (que se especifica `ORDER BY` clausula). Por lo tanto, en la mayoría de los casos no es necesario especificar un `PRIMARY KEY` clausula. + +- `SAMPLE BY` — An expression for sampling. + + Si se utiliza una expresión de muestreo, la clave principal debe contenerla. Ejemplo: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. + +- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [entre discos y volúmenes](#table_engine-mergetree-multiple-volumes). + + La expresión debe tener una `Date` o `DateTime` columna como resultado. Ejemplo: + `TTL date + INTERVAL 1 DAY` + + Tipo de regla `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` especifica una acción que debe realizarse con la pieza si la expresión está satisfecha (alcanza la hora actual): eliminación de filas caducadas, mover una pieza (si la expresión está satisfecha para todas las filas de una pieza) al disco especificado (`TO DISK 'xxx'`) o al volumen (`TO VOLUME 'xxx'`). El tipo predeterminado de la regla es la eliminación (`DELETE`). Se puede especificar una lista de varias reglas, pero no debe haber más de una `DELETE` regla. + + Para obtener más información, consulte [TTL para columnas y tablas](#table_engine-mergetree-ttl) + +- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: + + - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Almacenamiento de datos](#mergetree-data-storage). + - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Almacenamiento de datos](#mergetree-data-storage). + - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` configuración. Antes de la versión 19.11, sólo existía el `index_granularity` ajuste para restringir el tamaño del gránulo. El `index_granularity_bytes` mejora el rendimiento de ClickHouse al seleccionar datos de tablas con filas grandes (decenas y cientos de megabytes). Si tiene tablas con filas grandes, puede habilitar esta configuración para que las tablas mejoren la eficiencia de `SELECT` consulta. + - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, entonces ZooKeeper almacena menos datos. Para obtener más información, consulte [descripción del ajuste](../../../operations/server-configuration-parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) en “Server configuration parameters”. + - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` bytes, ClickHouse lee y escribe los datos en el disco de almacenamiento utilizando la interfaz de E / S directa (`O_DIRECT` opcion). Si `min_merge_bytes_to_use_direct_io = 0`, entonces la E/S directa está deshabilitada. Valor predeterminado: `10 * 1024 * 1024 * 1024` byte. + + - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). + - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don’t turn it off. + - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. + - `storage_policy` — Storage policy. See [Uso de varios dispositivos de bloque para el almacenamiento de datos](#table_engine-mergetree-multiple-volumes). + +**Ejemplo de configuración de secciones** + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 +``` + +En el ejemplo, configuramos la partición por mes. + +También establecemos una expresión para el muestreo como un hash por el ID de usuario. Esto le permite pseudoaleatorizar los datos en la tabla para cada `CounterID` y `EventDate`. Si define un [SAMPLE](../../../sql-reference/statements/select.md#select-sample-clause) cláusula al seleccionar los datos, ClickHouse devolverá una muestra de datos pseudoaleatoria uniforme para un subconjunto de usuarios. + +El `index_granularity` se puede omitir porque 8192 es el valor predeterminado. + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No utilice este método en nuevos proyectos. Si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +**Parámetros MergeTree()** + +- `date-column` — The name of a column of the [Fecha](../../../sql-reference/data-types/date.md) tipo. ClickHouse crea automáticamente particiones por mes en función de esta columna. Los nombres de partición están en el `"YYYYMM"` formato. +- `sampling_expression` — An expression for sampling. +- `(primary, key)` — Primary key. Type: [Tupla()](../../../sql-reference/data-types/tuple.md) +- `index_granularity` — The granularity of an index. The number of data rows between the “marks” de un índice. El valor 8192 es apropiado para la mayoría de las tareas. + +**Ejemplo** + +``` sql +MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) +``` + +El `MergeTree` engine se configura de la misma manera que en el ejemplo anterior para el método de configuración del motor principal. +
+ +## Almacenamiento De Datos {#mergetree-data-storage} + +Una tabla consta de partes de datos ordenadas por clave principal. + +Cuando se insertan datos en una tabla, se crean partes de datos separadas y cada una de ellas se ordena lexicográficamente por clave principal. Por ejemplo, si la clave principal es `(CounterID, Date)`, los datos en la parte se ordenan por `CounterID`, y dentro de cada `CounterID` es ordenado por `Date`. + +Los datos que pertenecen a diferentes particiones se separan en diferentes partes. En el fondo, ClickHouse combina partes de datos para un almacenamiento más eficiente. Las piezas que pertenecen a particiones diferentes no se fusionan. El mecanismo de combinación no garantiza que todas las filas con la misma clave principal estén en la misma parte de datos. + +Cada parte de datos se divide lógicamente en gránulos. Un gránulo es el conjunto de datos indivisibles más pequeño que ClickHouse lee al seleccionar datos. ClickHouse no divide filas o valores, por lo que cada gránulo siempre contiene un número entero de filas. La primera fila de un gránulo está marcada con el valor de la clave principal de la fila. Para cada parte de datos, ClickHouse crea un archivo de índice que almacena las marcas. Para cada columna, ya sea en la clave principal o no, ClickHouse también almacena las mismas marcas. Estas marcas le permiten encontrar datos directamente en archivos de columnas. + +El tamaño del gránulo es restringido por `index_granularity` y `index_granularity_bytes` configuración del motor de tabla. El número de filas en un gránulo se encuentra en el `[1, index_granularity]` rango, dependiendo del tamaño de las filas. El tamaño de un gránulo puede exceder `index_granularity_bytes` si el tamaño de una sola fila es mayor que el valor de la configuración. En este caso, el tamaño del gránulo es igual al tamaño de la fila. + +## Claves e índices Principales En Consultas {#primary-keys-and-indexes-in-queries} + +Tome el `(CounterID, Date)` clave primaria como ejemplo. En este caso, la clasificación y el índice se pueden ilustrar de la siguiente manera: + + Whole data: [---------------------------------------------] + CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] + Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] + Marks: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 + Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 + +Si la consulta de datos especifica: + +- `CounterID in ('a', 'h')`, el servidor lee los datos en los rangos de marcas `[0, 3)` y `[6, 8)`. +- `CounterID IN ('a', 'h') AND Date = 3`, el servidor lee los datos en los rangos de marcas `[1, 3)` y `[7, 8)`. +- `Date = 3`, el servidor lee los datos en el rango de marcas `[1, 10]`. + +Los ejemplos anteriores muestran que siempre es más efectivo usar un índice que un análisis completo. + +Un índice disperso permite leer datos adicionales. Al leer un único rango de la clave primaria, hasta `index_granularity * 2` se pueden leer filas adicionales en cada bloque de datos. + +Los índices dispersos le permiten trabajar con una gran cantidad de filas de tabla, porque en la mayoría de los casos, dichos índices caben en la RAM de la computadora. + +ClickHouse no requiere una clave principal única. Puede insertar varias filas con la misma clave principal. + +### Selección De La Clave Principal {#selecting-the-primary-key} + +El número de columnas en la clave principal no está explícitamente limitado. Dependiendo de la estructura de datos, puede incluir más o menos columnas en la clave principal. Esto puede: + +- Mejorar el rendimiento de un índice. + + Si la clave principal es `(a, b)`, a continuación, añadir otra columna `c` mejorará el rendimiento si se cumplen las siguientes condiciones: + + - Hay consultas con una condición en la columna `c`. + - Rangos de datos largos (varias veces más `index_granularity`) con valores idénticos para `(a, b)` son comunes. En otras palabras, al agregar otra columna le permite omitir rangos de datos bastante largos. + +- Mejorar la compresión de datos. + + ClickHouse ordena los datos por clave principal, por lo que cuanto mayor sea la consistencia, mejor será la compresión. + +- Proporcione una lógica adicional al fusionar partes de datos en el [ColapsarMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) y [SummingMergeTree](summingmergetree.md) motor. + + En este caso tiene sentido especificar el *clave de clasificación* que es diferente de la clave principal. + +Una clave principal larga afectará negativamente al rendimiento de la inserción y al consumo de memoria, pero las columnas adicionales de la clave principal no afectarán al rendimiento de ClickHouse durante `SELECT` consulta. + +### Elegir Una Clave Principal Que Difiere De La Clave De ordenación {#choosing-a-primary-key-that-differs-from-the-sorting-key} + +Es posible especificar una clave principal (una expresión con valores que se escriben en el archivo de índice para cada marca) que es diferente de la clave de ordenación (una expresión para ordenar las filas en partes de datos). En este caso, la tupla de expresión de clave primaria debe ser un prefijo de la tupla de expresión de clave de ordenación. + +Esta característica es útil cuando se [SummingMergeTree](summingmergetree.md) y +[AgregaciónMergeTree](aggregatingmergetree.md) motores de mesa. En un caso común cuando se utilizan estos motores, la tabla tiene dos tipos de columnas: *cota* y *medida*. Las consultas típicas agregan valores de columnas de medida con `GROUP BY` y filtrado por dimensiones. Debido a que SummingMergeTree y AggregatingMergeTree agregan filas con el mismo valor de la clave de ordenación, es natural agregarle todas las dimensiones. Como resultado, la expresión de clave consta de una larga lista de columnas y esta lista debe actualizarse con frecuencia con las dimensiones recién agregadas. + +En este caso, tiene sentido dejar solo unas pocas columnas en la clave principal que proporcionarán análisis de rango eficientes y agregarán las columnas de dimensión restantes a la tupla de clave de clasificación. + +[ALTER](../../../sql-reference/statements/alter.md) de la clave de ordenación es una operación ligera porque cuando se agrega una nueva columna simultáneamente a la tabla y a la clave de ordenación, las partes de datos existentes no necesitan ser cambiadas. Dado que la clave de ordenación anterior es un prefijo de la nueva clave de ordenación y no hay datos en la columna recién agregada, los datos se ordenan tanto por las claves de ordenación antiguas como por las nuevas en el momento de la modificación de la tabla. + +### Uso De índices y Particiones En Consultas {#use-of-indexes-and-partitions-in-queries} + +Para `SELECT` consultas, ClickHouse analiza si se puede usar un índice. Se puede usar un índice si el `WHERE/PREWHERE` clause tiene una expresión (como uno de los elementos de conjunción, o enteramente) que representa una operación de comparación de igualdad o desigualdad, o si tiene `IN` o `LIKE` con un prefijo fijo en columnas o expresiones que están en la clave principal o clave de partición, o en ciertas funciones parcialmente repetitivas de estas columnas, o relaciones lógicas de estas expresiones. + +Por lo tanto, es posible ejecutar rápidamente consultas en uno o varios rangos de la clave principal. En este ejemplo, las consultas serán rápidas cuando se ejecuten para una etiqueta de seguimiento específica, para una etiqueta y un intervalo de fechas específicos, para una etiqueta y una fecha específicas, para varias etiquetas con un intervalo de fechas, etc. + +Veamos el motor configurado de la siguiente manera: + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 + +En este caso, en consultas: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +ClickHouse utilizará el índice de clave principal para recortar datos incorrectos y la clave de partición mensual para recortar particiones que están en intervalos de fechas incorrectos. + +Las consultas anteriores muestran que el índice se usa incluso para expresiones complejas. La lectura de la tabla está organizada de modo que el uso del índice no puede ser más lento que un escaneo completo. + +En el siguiente ejemplo, el índice no se puede usar. + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +Para comprobar si ClickHouse puede usar el índice al ejecutar una consulta, use la configuración [Fecha de nacimiento](../../../operations/settings/settings.md#settings-force_index_by_date) y [force\_primary\_key](../../../operations/settings/settings.md). + +La clave para particionar por mes permite leer solo aquellos bloques de datos que contienen fechas del rango adecuado. En este caso, el bloque de datos puede contener datos para muchas fechas (hasta un mes). Dentro de un bloque, los datos se ordenan por clave principal, que puede no contener la fecha como la primera columna. Debido a esto, el uso de una consulta con solo una condición de fecha que no especifica el prefijo de clave principal hará que se lean más datos que para una sola fecha. + +### Uso Del índice Para Claves Primarias Parcialmente monotónicas {#use-of-index-for-partially-monotonic-primary-keys} + +Considere, por ejemplo, los días del mes. Ellos forman un [monótona secuencia](https://en.wikipedia.org/wiki/Monotonic_function) durante un mes, pero no monótono durante períodos más prolongados. Esta es una secuencia parcialmente monotónica. Si un usuario crea la tabla con clave primaria parcialmente monótona, ClickHouse crea un índice disperso como de costumbre. Cuando un usuario selecciona datos de este tipo de tabla, ClickHouse analiza las condiciones de consulta. Si el usuario desea obtener datos entre dos marcas del índice y ambas marcas caen dentro de un mes, ClickHouse puede usar el índice en este caso particular porque puede calcular la distancia entre los parámetros de una consulta y las marcas de índice. + +ClickHouse no puede usar un índice si los valores de la clave principal en el rango de parámetros de consulta no representan una secuencia monotónica. En este caso, ClickHouse utiliza el método de análisis completo. + +ClickHouse usa esta lógica no solo para secuencias de días del mes, sino para cualquier clave principal que represente una secuencia parcialmente monotónica. + +### Índices De Saltos De Datos (experimental) {#table_engine-mergetree-data_skipping-indexes} + +La declaración de índice se encuentra en la sección de columnas del `CREATE` consulta. + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +Para tablas de la `*MergeTree` familia, se pueden especificar índices de omisión de datos. + +Estos índices agregan cierta información sobre la expresión especificada en bloques, que consisten en `granularity_value` gránulos (el tamaño del gránulo se especifica utilizando el `index_granularity` ajuste en el motor de la tabla). Entonces estos agregados se usan en `SELECT` consultas para reducir la cantidad de datos a leer desde el disco omitiendo grandes bloques de datos donde el `where` consulta no puede ser satisfecha. + +**Ejemplo** + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +ClickHouse puede utilizar los índices del ejemplo para reducir la cantidad de datos que se leen desde el disco en las siguientes consultas: + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### Tipos De índices Disponibles {#available-types-of-indices} + +- `minmax` + + Almacena los extremos de la expresión especificada (si la expresión `tuple`, entonces almacena extremos para cada elemento de `tuple`), utiliza información almacenada para omitir bloques de datos como la clave principal. + +- `set(max_rows)` + + Almacena valores únicos de la expresión especificada (no más de `max_rows` filas, `max_rows=0` medio “no limits”). Utiliza los valores para comprobar si `WHERE` expresión no es satisfactorio en un bloque de datos. + +- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + Tiendas a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) que contiene todos los ngrams de un bloque de datos. Funciona solo con cadenas. Puede ser utilizado para la optimización de `equals`, `like` y `in` expresiones. + + - `n` — ngram size, + - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). + - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. + - `random_seed` — The seed for Bloom filter hash functions. + +- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + Lo mismo que `ngrambf_v1`, pero almacena tokens en lugar de ngrams. Los tokens son secuencias separadas por caracteres no alfanuméricos. + +- `bloom_filter([false_positive])` — Stores a [Filtro de floración](https://en.wikipedia.org/wiki/Bloom_filter) para las columnas especificadas. + + Opcional `false_positive` parámetro es la probabilidad de recibir una respuesta falsa positiva del filtro. Valores posibles: (0, 1). Valor predeterminado: 0.025. + + Tipos de datos admitidos: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. + + Las siguientes funciones pueden usarlo: [igual](../../../sql-reference/functions/comparison-functions.md), [notEquals](../../../sql-reference/functions/comparison-functions.md), [en](../../../sql-reference/functions/in-functions.md), [noEn](../../../sql-reference/functions/in-functions.md), [tener](../../../sql-reference/functions/array-functions.md). + + + +``` sql +INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 +INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 +``` + +#### Funciones De Apoyo {#functions-support} + +Condiciones en el `WHERE` cláusula contiene llamadas de las funciones que operan con columnas. Si la columna forma parte de un índice, ClickHouse intenta usar este índice al realizar las funciones. ClickHouse admite diferentes subconjuntos de funciones para usar índices. + +El `set` index se puede utilizar con todas las funciones. Subconjuntos de funciones para otros índices se muestran en la siguiente tabla. + +| Función (operador) / Índice | clave primaria | minmax | Descripción | Sistema abierto. | bloom\_filter | +|----------------------------------------------------------------------------------------------------------|----------------|--------|-------------|------------------|---------------| +| [igual (=, ==)](../../../sql-reference/functions/comparison-functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notEquals(!=, \<\>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [como](../../../sql-reference/functions/string-search-functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [No como](../../../sql-reference/functions/string-search-functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [Comienza con](../../../sql-reference/functions/string-functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [Finaliza con](../../../sql-reference/functions/string-functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [multiSearchAny](../../../sql-reference/functions/string-search-functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | +| [en](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [noEn](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [menos (\<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [mayor (\>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [menosOrEquals (\<=)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [mayorOrEquals (\>=)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [vaciar](../../../sql-reference/functions/array-functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [notEmpty](../../../sql-reference/functions/array-functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | + +Las funciones con un argumento constante que es menor que el tamaño de ngram no pueden ser utilizadas por `ngrambf_v1` para la optimización de consultas. + +Los filtros Bloom pueden tener coincidencias falsas positivas, por lo que `ngrambf_v1`, `tokenbf_v1`, y `bloom_filter` los índices no se pueden usar para optimizar consultas donde se espera que el resultado de una función sea falso, por ejemplo: + +- Puede ser optimizado: + - `s LIKE '%test%'` + - `NOT s NOT LIKE '%test%'` + - `s = 1` + - `NOT s != 1` + - `startsWith(s, 'test')` +- No se puede optimizar: + - `NOT s LIKE '%test%'` + - `s NOT LIKE '%test%'` + - `NOT s = 1` + - `s != 1` + - `NOT startsWith(s, 'test')` + +## Acceso a Datos simultáneos {#concurrent-data-access} + +Para el acceso simultáneo a tablas, usamos versiones múltiples. En otras palabras, cuando una tabla se lee y actualiza simultáneamente, los datos se leen de un conjunto de partes que está actualizado en el momento de la consulta. No hay cerraduras largas. Las inserciones no se interponen en el camino de las operaciones de lectura. + +La lectura de una tabla se paralela automáticamente. + +## TTL Para Columnas y Tablas {#table_engine-mergetree-ttl} + +Determina la duración de los valores. + +El `TTL` se puede establecer para toda la tabla y para cada columna individual. TTL de nivel de tabla también puede especificar la lógica de movimiento automático de datos entre discos y volúmenes. + +Las expresiones deben evaluar [Fecha](../../../sql-reference/data-types/date.md) o [FechaHora](../../../sql-reference/data-types/datetime.md) tipo de datos. + +Ejemplo: + +``` sql +TTL time_column +TTL time_column + interval +``` + +Definir `interval`, utilizar [intervalo de tiempo](../../../sql-reference/operators.md#operators-datetime) operador. + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### Columna TTL {#mergetree-column-ttl} + +Cuando los valores de la columna caducan, ClickHouse los reemplaza con los valores predeterminados para el tipo de datos de columna. Si todos los valores de columna en la parte de datos caducan, ClickHouse elimina esta columna de la parte de datos en un sistema de archivos. + +El `TTL` cláusula no se puede utilizar para columnas clave. + +Ejemplos: + +Creación de una tabla con TTL + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +Adición de TTL a una columna de una tabla existente + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +Modificación de TTL de la columna + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### Tabla TTL {#mergetree-table-ttl} + +La tabla puede tener una expresión para la eliminación de filas caducadas y varias expresiones para el movimiento automático de partes entre [discos o volúmenes](#table_engine-mergetree-multiple-volumes). Cuando las filas de la tabla caducan, ClickHouse elimina todas las filas correspondientes. Para la entidad de movimiento de piezas, todas las filas de una pieza deben cumplir los criterios de expresión de movimiento. + +``` sql +TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... +``` + +El tipo de regla TTL puede seguir cada expresión TTL. Afecta a una acción que debe realizarse una vez que se satisface la expresión (alcanza la hora actual): + +- `DELETE` - Eliminar filas caducadas (acción predeterminada); +- `TO DISK 'aaa'` - mover parte al disco `aaa`; +- `TO VOLUME 'bbb'` - mover parte al disco `bbb`. + +Ejemplos: + +Creación de una tabla con TTL + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH [DELETE], + d + INTERVAL 1 WEEK TO VOLUME 'aaa', + d + INTERVAL 2 WEEK TO DISK 'bbb'; +``` + +Modificación de TTL de la tabla + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**Eliminación de datos** + +Los datos con un TTL caducado se eliminan cuando ClickHouse fusiona partes de datos. + +Cuando ClickHouse ve que los datos han caducado, realiza una combinación fuera de programación. Para controlar la frecuencia de tales fusiones, puede establecer [Método de codificación de datos:](#mergetree_setting-merge_with_ttl_timeout). Si el valor es demasiado bajo, realizará muchas fusiones fuera de horario que pueden consumir muchos recursos. + +Si realiza el `SELECT` consulta entre fusiones, puede obtener datos caducados. Para evitarlo, use el [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) consulta antes `SELECT`. + +## Uso De múltiples Dispositivos De Bloque Para El Almacenamiento De Datos {#table_engine-mergetree-multiple-volumes} + +### Implantación {#introduction} + +`MergeTree` Los motores de tablas familiares pueden almacenar datos en múltiples dispositivos de bloque. Por ejemplo, puede ser útil cuando los datos de una determinada tabla se dividen implícitamente en “hot” y “cold”. Los datos más recientes se solicitan regularmente, pero solo requieren una pequeña cantidad de espacio. Por el contrario, los datos históricos de cola gorda se solicitan raramente. Si hay varios discos disponibles, el “hot” los datos pueden estar ubicados en discos rápidos (por ejemplo, SSD NVMe o en memoria), mientras que “cold” datos - en los relativamente lentos (por ejemplo, HDD). + +La parte de datos es la unidad móvil mínima para `MergeTree`-mesas de motor. Los datos que pertenecen a una parte se almacenan en un disco. Las partes de datos se pueden mover entre discos en segundo plano (según la configuración del usuario) así como por medio de la [ALTER](../../../sql-reference/statements/alter.md#alter_move-partition) consulta. + +### Plazo {#terms} + +- Disk — Block device mounted to the filesystem. +- Default disk — Disk that stores the path specified in the [camino](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) configuración del servidor. +- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). +- Storage policy — Set of volumes and the rules for moving data between them. + +Los nombres dados a las entidades descritas se pueden encontrar en las tablas del sistema, [sistema.almacenamiento\_policies](../../../operations/system-tables.md#system_tables-storage_policies) y [sistema.disco](../../../operations/system-tables.md#system_tables-disks). Para aplicar una de las directivas de almacenamiento configuradas para una tabla, `storage_policy` establecimiento de `MergeTree`-motor de la familia de las tablas. + +### Configuración {#table_engine-mergetree-multiple-volumes-configure} + +Discos, volúmenes y políticas de almacenamiento deben ser declaradas dentro de la `` etiqueta ya sea en el archivo principal `config.xml` o en un archivo distinto en el `config.d` directorio. + +Configuración de la estructura: + +``` xml + + + + /mnt/fast_ssd/clickhouse/ + + + /mnt/hdd1/clickhouse/ + 10485760 + + + /mnt/hdd2/clickhouse/ + 10485760 + + + ... + + + ... + +``` + +Tags: + +- `` — Disk name. Names must be different for all disks. +- `path` — path under which a server will store data (`data` y `shadow` carpetas), debe terminarse con ‘/’. +- `keep_free_space_bytes` — the amount of free disk space to be reserved. + +El orden de la definición del disco no es importante. + +Marcado de configuración de directivas de almacenamiento: + +``` xml + + ... + + + + + disk_name_from_disks_configuration + 1073741824 + + + + + + + 0.2 + + + + + + + + ... + +``` + +Tags: + +- `policy_name_N` — Policy name. Policy names must be unique. +- `volume_name_N` — Volume name. Volume names must be unique. +- `disk` — a disk within a volume. +- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. +- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). + +Cofiguration ejemplos: + +``` xml + + ... + + + + + disk1 + disk2 + + + + + + + + fast_ssd + 1073741824 + + + disk1 + + + 0.2 + + + ... + +``` + +En un ejemplo dado, el `hdd_in_order` implementa la política de [Ronda-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) enfoque. Por lo tanto esta política define un sólo volumen (`single`), las partes de datos se almacenan en todos sus discos en orden circular. Dicha política puede ser bastante útil si hay varios discos similares montados en el sistema, pero RAID no está configurado. Tenga en cuenta que cada unidad de disco individual no es confiable y es posible que desee compensarlo con un factor de replicación de 3 o más. + +Si hay diferentes tipos de discos disponibles en el sistema, `moving_from_ssd_to_hdd` la política puede ser utilizado en su lugar. Volumen `hot` consta de un disco SSD (`fast_ssd`), y el tamaño máximo de una parte que puede ser almacenado en este volumen es de 1GB. Todas las piezas con el tamaño de más de 1GB se almacenan directamente en el `cold` volumen, que contiene un disco duro `disk1`. +Además, una vez que el disco `fast_ssd` se llena en más del 80%, los datos se transferirán al `disk1` por un proceso en segundo plano. + +El orden de enumeración de volúmenes dentro de una directiva de almacenamiento es importante. Una vez que un volumen está sobrellenado, los datos se mueven al siguiente. El orden de la enumeración del disco también es importante porque los datos se almacenan en ellos por turnos. + +Al crear una tabla, se puede aplicarle una de las directivas de almacenamiento configuradas: + +``` sql +CREATE TABLE table_with_non_default_policy ( + EventDate Date, + OrderID UInt64, + BannerID UInt64, + SearchPhrase String +) ENGINE = MergeTree +ORDER BY (OrderID, BannerID) +PARTITION BY toYYYYMM(EventDate) +SETTINGS storage_policy = 'moving_from_ssd_to_hdd' +``` + +El `default` política de almacenamiento implica el uso de un solo volumen, que consiste en un solo disco dado en ``. Una vez que se crea una tabla, no se puede cambiar su política de almacenamiento. + +### Detalles {#details} + +En el caso de `MergeTree` tablas, los datos están llegando al disco de diferentes maneras: + +- Como resultado de un inserto (`INSERT` consulta). +- Durante las fusiones de fondo y [mutación](../../../sql-reference/statements/alter.md#alter-mutations). +- Al descargar desde otra réplica. +- Como resultado de la congelación de particiones [ALTER TABLE … FREEZE PARTITION](../../../sql-reference/statements/alter.md#alter_freeze-partition). + +En todos estos casos, excepto las mutaciones y la congelación de particiones, una pieza se almacena en un volumen y un disco de acuerdo con la política de almacenamiento dada: + +1. El primer volumen (en el orden de definición) que tiene suficiente espacio en disco para almacenar una pieza (`unreserved_space > current_part_size`) y permite almacenar partes de un tamaño determinado (`max_data_part_size_bytes > current_part_size`) se elige. +2. Dentro de este volumen, se elige ese disco que sigue al que se utilizó para almacenar el fragmento de datos anterior y que tiene espacio libre más que el tamaño de la pieza (`unreserved_space - keep_free_space_bytes > current_part_size`). + +Bajo el capó, las mutaciones y la congelación de particiones hacen uso de [enlaces duros](https://en.wikipedia.org/wiki/Hard_link). Los enlaces duros entre diferentes discos no son compatibles, por lo tanto, en tales casos las partes resultantes se almacenan en los mismos discos que los iniciales. + +En el fondo, las partes se mueven entre volúmenes en función de la cantidad de espacio libre (`move_factor` parámetro) según el orden en que se declaran los volúmenes en el archivo de configuración. +Los datos nunca se transfieren desde el último y al primero. Uno puede usar tablas del sistema [sistema.part\_log](../../../operations/system-tables.md#system_tables-part-log) (campo `type = MOVE_PART`) y [sistema.parte](../../../operations/system-tables.md#system_tables-parts) (campo `path` y `disk`) para monitorear el fondo se mueve. Además, la información detallada se puede encontrar en los registros del servidor. + +El usuario puede forzar el movimiento de una pieza o una partición de un volumen a otro mediante la consulta [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql-reference/statements/alter.md#alter_move-partition), todas las restricciones para las operaciones en segundo plano se tienen en cuenta. La consulta inicia un movimiento por sí misma y no espera a que se completen las operaciones en segundo plano. El usuario recibirá un mensaje de error si no hay suficiente espacio libre disponible o si no se cumple alguna de las condiciones requeridas. + +Mover datos no interfiere con la replicación de datos. Por lo tanto, se pueden especificar diferentes directivas de almacenamiento para la misma tabla en diferentes réplicas. + +Después de la finalización de las fusiones y mutaciones de fondo, las partes viejas se eliminan solo después de un cierto período de tiempo (`old_parts_lifetime`). +Durante este tiempo, no se mueven a otros volúmenes o discos. Por lo tanto, hasta que finalmente se retira, se tomará en cuenta para la evaluación de los ocupados de espacio en disco. + +[Artículo Original](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/es/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/es/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..e93a5cffd00 --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,69 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 33 +toc_title: ReplacingMergeTree +--- + +# Replacingmergetree {#replacingmergetree} + +El motor difiere de [Método de codificación de datos:](mergetree.md#table_engines-mergetree) en que elimina las entradas duplicadas con el mismo valor de clave principal (o más exactamente, con el mismo [clave de clasificación](mergetree.md) valor). + +La desduplicación de datos solo se produce durante una fusión. La fusión ocurre en segundo plano en un momento desconocido, por lo que no puede planificarla. Algunos de los datos pueden permanecer sin procesar. Aunque puede ejecutar una fusión no programada utilizando el `OPTIMIZE` consulta, no cuente con usarlo, porque el `OPTIMIZE` consulta leerá y escribirá una gran cantidad de datos. + +Así, `ReplacingMergeTree` es adecuado para borrar datos duplicados en segundo plano para ahorrar espacio, pero no garantiza la ausencia de duplicados. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Para obtener una descripción de los parámetros de solicitud, consulte [descripción de la solicitud](../../../sql-reference/statements/create.md). + +**ReplacingMergeTree Parámetros** + +- `ver` — column with version. Type `UInt*`, `Date` o `DateTime`. Parámetro opcional. + + Al fusionar, `ReplacingMergeTree` de todas las filas con la misma clave primaria deja solo una: + + - Último en la selección, si `ver` no establecido. + - Con la versión máxima, si `ver` indicado. + +**Cláusulas de consulta** + +Al crear un `ReplacingMergeTree` mesa de la misma [clausula](mergetree.md) se requieren, como al crear un `MergeTree` tabla. + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +Todos los parámetros excepto `ver` el mismo significado que en `MergeTree`. + +- `ver` - columna con la versión. Parámetro opcional. Para una descripción, vea el texto anterior. + +
+ +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/es/engines/table-engines/mergetree-family/replication.md b/docs/es/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..a76a8f68a9a --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,218 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 31 +toc_title: "Replicaci\xF3n de datos" +--- + +# Replicación De Datos {#table_engines-replication} + +La replicación solo se admite para tablas de la familia MergeTree: + +- ReplicatedMergeTree +- ReplicatedSummingMergeTree +- ReplicatedReplacingMergeTree +- ReplicatedAggregatingMergeTree +- ReplicatedCollapsingMergeTree +- ReplicatedVersionedCollapsingMergetree +- ReplicatedGraphiteMergeTree + +La replicación funciona a nivel de una tabla individual, no de todo el servidor. Un servidor puede almacenar tablas replicadas y no replicadas al mismo tiempo. + +La replicación no depende de la fragmentación. Cada fragmento tiene su propia replicación independiente. + +Datos comprimidos para `INSERT` y `ALTER` se replica (para obtener más información, consulte la documentación para [ALTER](../../../sql-reference/statements/alter.md#query_language_queries_alter)). + +`CREATE`, `DROP`, `ATTACH`, `DETACH` y `RENAME` las consultas se ejecutan en un único servidor y no se replican: + +- El `CREATE TABLE` query crea una nueva tabla replicable en el servidor donde se ejecuta la consulta. Si esta tabla ya existe en otros servidores, agrega una nueva réplica. +- El `DROP TABLE` query elimina la réplica ubicada en el servidor donde se ejecuta la consulta. +- El `RENAME` query cambia el nombre de la tabla en una de las réplicas. En otras palabras, las tablas replicadas pueden tener diferentes nombres en diferentes réplicas. + +Uso de ClickHouse [Apache ZooKeeper](https://zookeeper.apache.org) para almacenar metainformación de réplicas. Utilice ZooKeeper versión 3.4.5 o posterior. + +Para utilizar la replicación, establezca los parámetros [Zookeeper](../../../operations/server-configuration-parameters/settings.md#server-settings_zookeeper) sección de configuración del servidor. + +!!! attention "Atención" + No descuides la configuración de seguridad. ClickHouse soporta el `digest` [Esquema de ACL](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) del subsistema de seguridad ZooKeeper. + +Ejemplo de configuración de las direcciones del clúster ZooKeeper: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +Puede especificar cualquier clúster ZooKeeper existente y el sistema utilizará un directorio en él para sus propios datos (el directorio se especifica al crear una tabla replicable). + +Si ZooKeeper no está establecido en el archivo de configuración, no puede crear tablas replicadas y las tablas replicadas existentes serán de solo lectura. + +ZooKeeper no se utiliza en `SELECT` consultas porque la replicación no afecta al rendimiento de `SELECT` y las consultas se ejecutan tan rápido como lo hacen para las tablas no replicadas. Al consultar tablas replicadas distribuidas, el comportamiento de ClickHouse se controla mediante la configuración [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) y [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). + +Para cada `INSERT` consulta, aproximadamente diez entradas se agregan a ZooKeeper a través de varias transacciones. (Para ser más precisos, esto es para cada bloque de datos insertado; una consulta INSERT contiene un bloque o un bloque por `max_insert_block_size = 1048576` filas.) Esto conduce a latencias ligeramente más largas para `INSERT` en comparación con las tablas no replicadas. Pero si sigue las recomendaciones para insertar datos en lotes de no más de uno `INSERT` por segundo, no crea ningún problema. Todo el clúster ClickHouse utilizado para coordinar un clúster ZooKeeper tiene un total de varios cientos `INSERTs` por segundo. El rendimiento en las inserciones de datos (el número de filas por segundo) es tan alto como para los datos no replicados. + +Para clústeres muy grandes, puede usar diferentes clústeres de ZooKeeper para diferentes fragmentos. Sin embargo, esto no ha demostrado ser necesario en el Yandex.Clúster Metrica (aproximadamente 300 servidores). + +La replicación es asíncrona y multi-master. `INSERT` consultas (así como `ALTER`) se puede enviar a cualquier servidor disponible. Los datos se insertan en el servidor donde se ejecuta la consulta y, a continuación, se copian a los demás servidores. Debido a que es asincrónico, los datos insertados recientemente aparecen en las otras réplicas con cierta latencia. Si parte de las réplicas no está disponible, los datos se escriben cuando estén disponibles. Si hay una réplica disponible, la latencia es la cantidad de tiempo que tarda en transferir el bloque de datos comprimidos a través de la red. + +De forma predeterminada, una consulta INSERT espera la confirmación de la escritura de los datos de una sola réplica. Si los datos fue correctamente escrito a sólo una réplica y el servidor con esta réplica deja de existir, los datos almacenados se perderán. Para habilitar la confirmación de las escrituras de datos de varias réplicas, utilice `insert_quorum` opcion. + +Cada bloque de datos se escribe atómicamente. La consulta INSERT se divide en bloques hasta `max_insert_block_size = 1048576` filas. En otras palabras, si el `INSERT` consulta tiene menos de 1048576 filas, se hace atómicamente. + +Los bloques de datos se deduplican. Para varias escrituras del mismo bloque de datos (bloques de datos del mismo tamaño que contienen las mismas filas en el mismo orden), el bloque solo se escribe una vez. La razón de esto es en caso de fallas de red cuando la aplicación cliente no sabe si los datos se escribieron en la base de datos, por lo que `INSERT` consulta simplemente se puede repetir. No importa a qué réplica se enviaron los INSERT con datos idénticos. `INSERTs` son idempotentes. Los parámetros de desduplicación son controlados por [merge\_tree](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-merge_tree) configuración del servidor. + +Durante la replicación, sólo los datos de origen que se van a insertar se transfieren a través de la red. La transformación de datos adicional (fusión) se coordina y se realiza en todas las réplicas de la misma manera. Esto minimiza el uso de la red, lo que significa que la replicación funciona bien cuando las réplicas residen en centros de datos diferentes. (Tenga en cuenta que la duplicación de datos en diferentes centros de datos es el objetivo principal de la replicación.) + +Puede tener cualquier número de réplicas de los mismos datos. El Yandex.Metrica utiliza doble replicación en producción. Cada servidor utiliza RAID-5 o RAID-6, y RAID-10 en algunos casos. Esta es una solución relativamente confiable y conveniente. + +El sistema supervisa la sincronicidad de los datos en las réplicas y puede recuperarse después de un fallo. La conmutación por error es automática (para pequeñas diferencias en los datos) o semiautomática (cuando los datos difieren demasiado, lo que puede indicar un error de configuración). + +## Creación De Tablas Replicadas {#creating-replicated-tables} + +El `Replicated` prefijo se agrega al nombre del motor de tabla. Por ejemplo:`ReplicatedMergeTree`. + +**Replicated\*MergeTree parámetros** + +- `zoo_path` — The path to the table in ZooKeeper. +- `replica_name` — The replica name in ZooKeeper. + +Ejemplo: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +
+ +Ejemplo en sintaxis obsoleta + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +
+ +Como muestra el ejemplo, estos parámetros pueden contener sustituciones entre llaves. Los valores sustituidos se toman de la ‘macros’ sección del archivo de configuración. Ejemplo: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +La ruta de acceso a la tabla en ZooKeeper debe ser única para cada tabla replicada. Las tablas en diferentes fragmentos deben tener rutas diferentes. +En este caso, la ruta consta de las siguientes partes: + +`/clickhouse/tables/` es el prefijo común. Recomendamos usar exactamente este. + +`{layer}-{shard}` es el identificador de fragmento. En este ejemplo consta de dos partes, ya que el Yandex.Metrica clúster utiliza sharding de dos niveles. Para la mayoría de las tareas, puede dejar solo la sustitución {shard}, que se expandirá al identificador de fragmento. + +`table_name` es el nombre del nodo de la tabla en ZooKeeper. Es una buena idea hacerlo igual que el nombre de la tabla. Se define explícitamente, porque a diferencia del nombre de la tabla, no cambia después de una consulta RENAME. +*HINT*: podría agregar un nombre de base de datos delante de `table_name` También. Nivel de Cifrado WEP `db_name.table_name` + +El nombre de réplica identifica diferentes réplicas de la misma tabla. Puede usar el nombre del servidor para esto, como en el ejemplo. El nombre solo tiene que ser único dentro de cada fragmento. + +Puede definir los parámetros explícitamente en lugar de utilizar sustituciones. Esto podría ser conveniente para probar y para configurar clústeres pequeños. Sin embargo, no puede usar consultas DDL distribuidas (`ON CLUSTER` en este caso. + +Cuando se trabaja con clústeres grandes, se recomienda utilizar sustituciones porque reducen la probabilidad de error. + +Ejecute el `CREATE TABLE` consulta en cada réplica. Esta consulta crea una nueva tabla replicada o agrega una nueva réplica a una existente. + +Si agrega una nueva réplica después de que la tabla ya contenga algunos datos en otras réplicas, los datos se copiarán de las otras réplicas a la nueva después de ejecutar la consulta. En otras palabras, la nueva réplica se sincroniza con las demás. + +Para eliminar una réplica, ejecute `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. + +## Recuperación después De Fallos {#recovery-after-failures} + +Si ZooKeeper no está disponible cuando se inicia un servidor, las tablas replicadas cambian al modo de solo lectura. El sistema intenta conectarse periódicamente a ZooKeeper. + +Si ZooKeeper no está disponible durante un `INSERT`, o se produce un error al interactuar con ZooKeeper, se produce una excepción. + +Después de conectarse a ZooKeeper, el sistema comprueba si el conjunto de datos en el sistema de archivos local coincide con el conjunto de datos esperado (ZooKeeper almacena esta información). Si hay incoherencias menores, el sistema las resuelve sincronizando datos con las réplicas. + +Si el sistema detecta partes de datos rotas (con un tamaño incorrecto de archivos) o partes no reconocidas (partes escritas en el sistema de archivos pero no grabadas en ZooKeeper), las mueve al `detached` subdirectorio (no se eliminan). Las piezas que faltan se copian de las réplicas. + +Tenga en cuenta que ClickHouse no realiza ninguna acción destructiva, como eliminar automáticamente una gran cantidad de datos. + +Cuando el servidor se inicia (o establece una nueva sesión con ZooKeeper), solo verifica la cantidad y el tamaño de todos los archivos. Si los tamaños de los archivos coinciden pero los bytes se han cambiado en algún punto intermedio, esto no se detecta inmediatamente, sino solo cuando se intenta leer los datos `SELECT` consulta. La consulta produce una excepción sobre una suma de comprobación no coincidente o el tamaño de un bloque comprimido. En este caso, las partes de datos se agregan a la cola de verificación y se copian de las réplicas si es necesario. + +Si el conjunto local de datos difiere demasiado del esperado, se activa un mecanismo de seguridad. El servidor ingresa esto en el registro y se niega a iniciarse. La razón de esto es que este caso puede indicar un error de configuración, como si una réplica en un fragmento se configurara accidentalmente como una réplica en un fragmento diferente. Sin embargo, los umbrales para este mecanismo se establecen bastante bajos, y esta situación puede ocurrir durante la recuperación de falla normal. En este caso, los datos se restauran semiautomáticamente, mediante “pushing a button”. + +Para iniciar la recuperación, cree el nodo `/path_to_table/replica_name/flags/force_restore_data` en ZooKeeper con cualquier contenido, o ejecute el comando para restaurar todas las tablas replicadas: + +``` bash +sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +A continuación, reinicie el servidor. Al iniciar, el servidor elimina estos indicadores e inicia la recuperación. + +## Recuperación después De La pérdida Completa De Datos {#recovery-after-complete-data-loss} + +Si todos los datos y metadatos desaparecieron de uno de los servidores, siga estos pasos para la recuperación: + +1. Instale ClickHouse en el servidor. Defina correctamente las sustituciones en el archivo de configuración que contiene el identificador de fragmento y las réplicas, si las usa. +2. Si tenía tablas no duplicadas que deben duplicarse manualmente en los servidores, copie sus datos desde una réplica (en el directorio `/var/lib/clickhouse/data/db_name/table_name/`). +3. Copiar definiciones de tablas ubicadas en `/var/lib/clickhouse/metadata/` de una réplica. Si un identificador de fragmento o réplica se define explícitamente en las definiciones de tabla, corríjalo para que corresponda a esta réplica. (Como alternativa, inicie el servidor y `ATTACH TABLE` consultas que deberían haber estado en el .sql archivos en `/var/lib/clickhouse/metadata/`.) +4. Para iniciar la recuperación, cree el nodo ZooKeeper `/path_to_table/replica_name/flags/force_restore_data` con cualquier contenido o ejecute el comando para restaurar todas las tablas replicadas: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +Luego inicie el servidor (reinicie, si ya se está ejecutando). Los datos se descargarán de las réplicas. + +Una opción de recuperación alternativa es eliminar información sobre la réplica perdida de ZooKeeper (`/path_to_table/replica_name`), luego vuelva a crear la réplica como se describe en “[Creación de tablas replicadas](#creating-replicated-tables)”. + +No hay restricción en el ancho de banda de la red durante la recuperación. Tenga esto en cuenta si está restaurando muchas réplicas a la vez. + +## La Conversión De Mergetree A Replicatedmergetree {#converting-from-mergetree-to-replicatedmergetree} + +Usamos el término `MergeTree` para referirse a todos los motores de mesa en el `MergeTree family`, lo mismo que para `ReplicatedMergeTree`. + +Si usted tenía un `MergeTree` tabla replicada manualmente, puede convertirla en una tabla replicada. Es posible que tenga que hacer esto si ya ha recopilado una gran cantidad de datos `MergeTree` y ahora desea habilitar la replicación. + +Si los datos difieren en varias réplicas, primero sincronícelos o elimínelos en todas las réplicas, excepto en una. + +Cambie el nombre de la tabla MergeTree existente y, a continuación, cree un `ReplicatedMergeTree` mesa con el antiguo nombre. +Mueva los datos de la tabla antigua a la `detached` subdirectorio dentro del directorio con los nuevos datos de la tabla (`/var/lib/clickhouse/data/db_name/table_name/`). +Luego ejecuta `ALTER TABLE ATTACH PARTITION` en una de las réplicas para agregar estas partes de datos al conjunto de trabajo. + +## La Conversión De Replicatedmergetree A Mergetree {#converting-from-replicatedmergetree-to-mergetree} + +Cree una tabla MergeTree con un nombre diferente. Mueva todos los datos del directorio con el `ReplicatedMergeTree` datos de la tabla al directorio de datos de la nueva tabla. A continuación, elimine el `ReplicatedMergeTree` y reinicie el servidor. + +Si desea deshacerse de un `ReplicatedMergeTree` sin iniciar el servidor: + +- Eliminar el correspondiente `.sql` archivo en el directorio de metadatos (`/var/lib/clickhouse/metadata/`). +- Eliminar la ruta correspondiente en ZooKeeper (`/path_to_table/replica_name`). + +Después de esto, puede iniciar el servidor, crear un `MergeTree` tabla, mueva los datos a su directorio y, a continuación, reinicie el servidor. + +## Recuperación Cuando Los Metadatos En El clúster De Zookeeper Se Pierden o Se dañan {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} + +Si los datos de ZooKeeper se perdieron o se dañaron, puede guardar los datos moviéndolos a una tabla no duplicada como se describió anteriormente. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/es/engines/table-engines/mergetree-family/summingmergetree.md b/docs/es/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..3f0acdcf4d0 --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,141 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 34 +toc_title: SummingMergeTree +--- + +# Summingmergetree {#summingmergetree} + +El motor hereda de [Método de codificación de datos:](mergetree.md#table_engines-mergetree). La diferencia es que al fusionar partes de datos para `SummingMergeTree` ClickHouse reemplaza todas las filas con la misma clave primaria (o más exactamente, con la misma [clave de clasificación](mergetree.md)) con una fila que contiene valores resumidos para las columnas con el tipo de datos numérico. Si la clave de ordenación está compuesta de manera que un solo valor de clave corresponde a un gran número de filas, esto reduce significativamente el volumen de almacenamiento y acelera la selección de datos. + +Recomendamos usar el motor junto con `MergeTree`. Almacenar datos completos en `MergeTree` mesa, y el uso `SummingMergeTree` para el almacenamiento de datos agregados, por ejemplo, al preparar informes. Tal enfoque evitará que pierda datos valiosos debido a una clave primaria compuesta incorrectamente. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = SummingMergeTree([columns]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Para obtener una descripción de los parámetros de solicitud, consulte [descripción de la solicitud](../../../sql-reference/statements/create.md). + +**Parámetros de SummingMergeTree** + +- `columns` - una tupla con los nombres de las columnas donde se resumirán los valores. Parámetro opcional. + Las columnas deben ser de tipo numérico y no deben estar en la clave principal. + + Si `columns` no especificado, ClickHouse resume los valores de todas las columnas con un tipo de datos numérico que no están en la clave principal. + +**Cláusulas de consulta** + +Al crear un `SummingMergeTree` mesa de la misma [clausula](mergetree.md) se requieren, como al crear un `MergeTree` tabla. + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) +``` + +Todos los parámetros excepto `columns` el mismo significado que en `MergeTree`. + +- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. + +
+ +## Ejemplo De Uso {#usage-example} + +Considere la siguiente tabla: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +Insertar datos: + +``` sql +INSERT INTO summtt Values(1,1),(1,2),(2,1) +``` + +ClickHouse puede sumar todas las filas no completamente ([ver abajo](#data-processing)), entonces usamos una función agregada `sum` y `GROUP BY` cláusula en la consulta. + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + +``` text +┌─key─┬─sum(value)─┐ +│ 2 │ 1 │ +│ 1 │ 3 │ +└─────┴────────────┘ +``` + +## Procesamiento De Datos {#data-processing} + +Cuando los datos se insertan en una tabla, se guardan tal cual. Clickhouse fusiona las partes insertadas de datos periódicamente y esto es cuando las filas con la misma clave principal se suman y se reemplazan con una para cada parte resultante de los datos. + +ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) una función agregada [resumir()](../../../sql-reference/aggregate-functions/reference.md#agg_function-sum) y `GROUP BY` cláusula se debe utilizar en una consulta como se describe en el ejemplo anterior. + +### Reglas Comunes Para La Suma {#common-rules-for-summation} + +Se resumen los valores de las columnas con el tipo de datos numérico. El conjunto de columnas está definido por el parámetro `columns`. + +Si los valores eran 0 en todas las columnas para la suma, se elimina la fila. + +Si la columna no está en la clave principal y no se resume, se selecciona un valor arbitrario entre los existentes. + +Los valores no se resumen para las columnas de la clave principal. + +### La Suma En Las Columnas De función Agregada {#the-summation-in-the-aggregatefunction-columns} + +Para columnas de [Tipo AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md) ClickHouse se comporta como [AgregaciónMergeTree](aggregatingmergetree.md) agregación del motor según la función. + +### Estructuras Anidadas {#nested-structures} + +La tabla puede tener estructuras de datos anidadas que se procesan de una manera especial. + +Si el nombre de una tabla anidada termina con `Map` y contiene al menos dos columnas que cumplen los siguientes criterios: + +- la primera columna es numérica `(*Int*, Date, DateTime)` o una cadena `(String, FixedString)`, vamos a llamarlo `key`, +- las otras columnas son aritméticas `(*Int*, Float32/64)`, vamos a llamarlo `(values...)`, + +entonces esta tabla anidada se interpreta como una asignación de `key => (values...)`, y al fusionar sus filas, los elementos de dos conjuntos de datos se fusionan por `key` con una suma de los correspondientes `(values...)`. + +Ejemplos: + +``` text +[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] +[(1, 100)] + [(1, 150)] -> [(1, 250)] +[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] +[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] +``` + +Al solicitar datos, utilice el [sumMap(clave, valor)](../../../sql-reference/aggregate-functions/reference.md) función para la agregación de `Map`. + +Para la estructura de datos anidados, no necesita especificar sus columnas en la tupla de columnas para la suma. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/es/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/es/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..2fbf0c0e6b7 --- /dev/null +++ b/docs/es/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,238 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 37 +toc_title: VersionedCollapsingMergeTree +--- + +# Versionedcollapsingmergetree {#versionedcollapsingmergetree} + +Este motor: + +- Permite la escritura rápida de estados de objetos que cambian continuamente. +- Elimina los estados de objetos antiguos en segundo plano. Esto reduce significativamente el volumen de almacenamiento. + +Vea la sección [Derrumbar](#table_engines_versionedcollapsingmergetree) para más detalles. + +El motor hereda de [Método de codificación de datos:](mergetree.md#table_engines-mergetree) y agrega la lógica para colapsar filas al algoritmo para fusionar partes de datos. `VersionedCollapsingMergeTree` tiene el mismo propósito que [ColapsarMergeTree](collapsingmergetree.md) pero usa un algoritmo de colapso diferente que permite insertar los datos en cualquier orden con múltiples hilos. En particular, el `Version` columna ayuda a contraer las filas correctamente, incluso si se insertan en el orden incorrecto. En contraste, `CollapsingMergeTree` sólo permite la inserción estrictamente consecutiva. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Para obtener una descripción de los parámetros de consulta, consulte [descripción de la consulta](../../../sql-reference/statements/create.md). + +**Parámetros del motor** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Name of the column with the type of row: `1` es una “state” fila, `-1` es una “cancel” fila. + + El tipo de datos de columna debe ser `Int8`. + +- `version` — Name of the column with the version of the object state. + + El tipo de datos de columna debe ser `UInt*`. + +**Cláusulas de consulta** + +Al crear un `VersionedCollapsingMergeTree` mesa, la misma [clausula](mergetree.md) se requieren como al crear un `MergeTree` tabla. + +
+ +Método obsoleto para crear una tabla + +!!! attention "Atención" + No utilice este método en nuevos proyectos. Si es posible, cambie los proyectos antiguos al método descrito anteriormente. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +Todos los parámetros excepto `sign` y `version` el mismo significado que en `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` es una “state” fila, `-1` es una “cancel” fila. + + Column Data Type — `Int8`. + +- `version` — Name of the column with the version of the object state. + + El tipo de datos de columna debe ser `UInt*`. + +
+ +## Derrumbar {#table_engines-versionedcollapsingmergetree} + +### Datos {#data} + +Considere una situación en la que necesite guardar datos que cambien continuamente para algún objeto. Es razonable tener una fila para un objeto y actualizar la fila siempre que haya cambios. Sin embargo, la operación de actualización es costosa y lenta para un DBMS porque requiere volver a escribir los datos en el almacenamiento. La actualización no es aceptable si necesita escribir datos rápidamente, pero puede escribir los cambios en un objeto secuencialmente de la siguiente manera. + +Utilice el `Sign` columna al escribir la fila. Si `Sign = 1` significa que la fila es un estado de un objeto (llamémoslo el “state” fila). Si `Sign = -1` indica la cancelación del estado de un objeto con los mismos atributos (llamémoslo el “cancel” fila). También use el `Version` columna, que debe identificar cada estado de un objeto con un número separado. + +Por ejemplo, queremos calcular cuántas páginas visitaron los usuarios en algún sitio y cuánto tiempo estuvieron allí. En algún momento escribimos la siguiente fila con el estado de la actividad del usuario: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +En algún momento después registramos el cambio de actividad del usuario y lo escribimos con las siguientes dos filas. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +La primera fila cancela el estado anterior del objeto (usuario). Debe copiar todos los campos del estado cancelado excepto `Sign`. + +La segunda fila contiene el estado actual. + +Debido a que solo necesitamos el último estado de actividad del usuario, las filas + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +se puede eliminar, colapsando el estado no válido (antiguo) del objeto. `VersionedCollapsingMergeTree` hace esto mientras fusiona las partes de datos. + +Para averiguar por qué necesitamos dos filas para cada cambio, vea [Algoritmo](#table_engines-versionedcollapsingmergetree-algorithm). + +**Notas sobre el uso** + +1. El programa que escribe los datos debe recordar el estado de un objeto para cancelarlo. El “cancel” cadena debe ser una copia de la “state” con lo opuesto `Sign`. Esto aumenta el tamaño inicial de almacenamiento, pero permite escribir los datos rápidamente. +2. Las matrices de largo crecimiento en columnas reducen la eficiencia del motor debido a la carga para escribir. Cuanto más sencillos sean los datos, mejor será la eficiencia. +3. `SELECT` Los resultados dependen en gran medida de la coherencia del historial de cambios de objetos. Sea preciso al preparar los datos para insertarlos. Puede obtener resultados impredecibles con datos incoherentes, como valores negativos para métricas no negativas, como la profundidad de la sesión. + +### Algoritmo {#table_engines-versionedcollapsingmergetree-algorithm} + +Cuando ClickHouse combina partes de datos, elimina cada par de filas que tienen la misma clave principal y versión y diferentes `Sign`. El orden de las filas no importa. + +Cuando ClickHouse inserta datos, ordena filas por la clave principal. Si el `Version` la columna no está en la clave principal, ClickHouse la agrega a la clave principal implícitamente como el último campo y la usa para ordenar. + +## Selección De Datos {#selecting-data} + +ClickHouse no garantiza que todas las filas con la misma clave principal estén en la misma parte de datos resultante o incluso en el mismo servidor físico. Esto es cierto tanto para escribir los datos como para la posterior fusión de las partes de datos. Además, ClickHouse procesa `SELECT` consultas con múltiples subprocesos, y no puede predecir el orden de las filas en el resultado. Esto significa que la agregación es necesaria si hay una necesidad de obtener completamente “collapsed” datos de un `VersionedCollapsingMergeTree` tabla. + +Para finalizar el colapso, escriba una consulta con un `GROUP BY` cláusula y funciones agregadas que representan el signo. Por ejemplo, para calcular la cantidad, use `sum(Sign)` en lugar de `count()`. Para calcular la suma de algo, use `sum(Sign * x)` en lugar de `sum(x)` y agregar `HAVING sum(Sign) > 0`. + +Los agregados `count`, `sum` y `avg` se puede calcular de esta manera. El agregado `uniq` se puede calcular si un objeto tiene al menos un estado no colapsado. Los agregados `min` y `max` no se puede calcular porque `VersionedCollapsingMergeTree` no guarda el historial de valores de estados colapsados. + +Si necesita extraer los datos con “collapsing” pero sin agregación (por ejemplo, para verificar si hay filas presentes cuyos valores más nuevos coinciden con ciertas condiciones), puede usar el `FINAL` modificador para el `FROM` clausula. Este enfoque es ineficiente y no debe usarse con tablas grandes. + +## Ejemplo De Uso {#example-of-use} + +Datos de ejemplo: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Creación de la tabla: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +Insertar los datos: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +Usamos dos `INSERT` consultas para crear dos partes de datos diferentes. Si insertamos los datos con una sola consulta, ClickHouse crea una parte de datos y nunca realizará ninguna fusión. + +Obtener los datos: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +¿qué vemos aquí y dónde están las partes colapsadas? +Creamos dos partes de datos usando dos `INSERT` consulta. El `SELECT` la consulta se realizó en dos subprocesos, y el resultado es un orden aleatorio de filas. +No se produjo el colapso porque las partes de datos aún no se han fusionado. ClickHouse fusiona partes de datos en un punto desconocido en el tiempo que no podemos predecir. + +Es por eso que necesitamos agregación: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +Si no necesitamos agregación y queremos forzar el colapso, podemos usar el `FINAL` modificador para el `FROM` clausula. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Esta es una forma muy ineficiente de seleccionar datos. No lo use para mesas grandes. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/es/engines/table_engines/special/buffer.md b/docs/es/engines/table-engines/special/buffer.md similarity index 100% rename from docs/es/engines/table_engines/special/buffer.md rename to docs/es/engines/table-engines/special/buffer.md diff --git a/docs/es/engines/table-engines/special/dictionary.md b/docs/es/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..bd1d0ce1bb5 --- /dev/null +++ b/docs/es/engines/table-engines/special/dictionary.md @@ -0,0 +1,97 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 35 +toc_title: Diccionario +--- + +# Diccionario {#dictionary} + +El `Dictionary` el motor muestra el [diccionario](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) datos como una tabla ClickHouse. + +Como ejemplo, considere un diccionario de `products` con la siguiente configuración: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +Consultar los datos del diccionario: + +``` sql +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + +``` text +┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ +│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ +└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ +``` + +Puede usar el [dictGet\*](../../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions) función para obtener los datos del diccionario en este formato. + +Esta vista no es útil cuando necesita obtener datos sin procesar o cuando `JOIN` operación. Para estos casos, puede usar el `Dictionary` motor, que muestra los datos del diccionario en una tabla. + +Sintaxis: + +``` sql +CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` +``` + +Ejemplo de uso: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); +``` + + Ok + +Echa un vistazo a lo que hay en la mesa. + +``` sql +select * from products limit 1; +``` + +``` text +┌────product_id─┬─title───────────┐ +│ 152689 │ Some item │ +└───────────────┴─────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/es/engines/table-engines/special/distributed.md b/docs/es/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..d3fe305ba42 --- /dev/null +++ b/docs/es/engines/table-engines/special/distributed.md @@ -0,0 +1,152 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 33 +toc_title: Distribuido +--- + +# Distribuido {#distributed} + +**Las tablas con motor distribuido no almacenan ningún dato por sí mismas**, pero permite el procesamiento de consultas distribuidas en varios servidores. +La lectura se paralela automáticamente. Durante una lectura, se utilizan los índices de tabla en servidores remotos, si los hay. + +El motor distribuido acepta parámetros: + +- el nombre del clúster en el archivo de configuración del servidor + +- el nombre de una base de datos remota + +- el nombre de una tabla remota + +- (opcionalmente) clave de fragmentación + +- nombre de política (opcionalmente), se usará para almacenar archivos temporales para el envío asíncrono + + Ver también: + + - `insert_distributed_sync` configuración + - [Método de codificación de datos:](../mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) para los ejemplos + +Ejemplo: + +``` sql +Distributed(logs, default, hits[, sharding_key[, policy_name]]) +``` + +Los datos se leerán desde todos los servidores ‘logs’ clúster, desde el valor predeterminado.tabla de éxitos ubicada en cada servidor del clúster. +Los datos no solo se leen sino que se procesan parcialmente en los servidores remotos (en la medida en que esto sea posible). +Por ejemplo, para una consulta con GROUP BY, los datos se agregarán en servidores remotos y los estados intermedios de las funciones agregadas se enviarán al servidor solicitante. Luego, los datos se agregarán más. + +En lugar del nombre de la base de datos, puede usar una expresión constante que devuelva una cadena. Por ejemplo: currentDatabase(). + +logs – The cluster name in the server’s config file. + +Los clústeres se establecen así: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 1 + 9440 + + + + +``` + +Aquí se define un clúster con el nombre ‘logs’ que consta de dos fragmentos, cada uno de los cuales contiene dos réplicas. +Los fragmentos se refieren a los servidores que contienen diferentes partes de los datos (para leer todos los datos, debe acceder a todos los fragmentos). +Las réplicas están duplicando servidores (para leer todos los datos, puede acceder a los datos en cualquiera de las réplicas). + +Los nombres de clúster no deben contener puntos. + +Los parámetros `host`, `port`, y opcionalmente `user`, `password`, `secure`, `compression` se especifican para cada servidor: +- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn’t start. If you change the DNS record, restart the server. +- `port` – The TCP port for messenger activity (‘tcp\_port’ en la configuración, generalmente establecido en 9000). No lo confundas con http\_port. +- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Derechos de acceso](../../../operations/access-rights.md). +- `password` – The password for connecting to a remote server (not masked). Default value: empty string. +- `secure` - Use ssl para la conexión, por lo general también debe definir `port` = 9440. El servidor debe escuchar en 9440 y tener certificados correctos. +- `compression` - Utilice la compresión de datos. Valor predeterminado: true. + +When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing) configuración. +Si no se establece la conexión con el servidor, habrá un intento de conectarse con un breve tiempo de espera. Si la conexión falla, se seleccionará la siguiente réplica, y así sucesivamente para todas las réplicas. Si el intento de conexión falló para todas las réplicas, el intento se repetirá de la misma manera, varias veces. +Esto funciona a favor de la resiliencia, pero no proporciona una tolerancia completa a errores: un servidor remoto podría aceptar la conexión, pero podría no funcionar o funcionar mal. + +Puede especificar solo uno de los fragmentos (en este caso, el procesamiento de consultas debe denominarse remoto, en lugar de distribuido) o hasta cualquier número de fragmentos. En cada fragmento, puede especificar entre una y cualquier número de réplicas. Puede especificar un número diferente de réplicas para cada fragmento. + +Puede especificar tantos clústeres como desee en la configuración. + +Para ver los clústeres, utilice el ‘system.clusters’ tabla. + +El motor distribuido permite trabajar con un clúster como un servidor local. Sin embargo, el clúster es inextensible: debe escribir su configuración en el archivo de configuración del servidor (mejor aún, para todos los servidores del clúster). + +The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don’t need to create a Distributed table – use the ‘remote’ función de tabla en su lugar. Vea la sección [Funciones de tabla](../../../sql-reference/table-functions/index.md). + +Hay dos métodos para escribir datos en un clúster: + +Primero, puede definir a qué servidores escribir en qué datos y realizar la escritura directamente en cada fragmento. En otras palabras, realice INSERT en las tablas que la tabla distribuida “looks at”. Esta es la solución más flexible, ya que puede usar cualquier esquema de fragmentación, que podría ser no trivial debido a los requisitos del área temática. Esta es también la solución más óptima ya que los datos se pueden escribir en diferentes fragmentos de forma completamente independiente. + +En segundo lugar, puede realizar INSERT en una tabla distribuida. En este caso, la tabla distribuirá los datos insertados a través de los propios servidores. Para escribir en una tabla distribuida, debe tener un conjunto de claves de fragmentación (el último parámetro). Además, si solo hay un fragmento, la operación de escritura funciona sin especificar la clave de fragmentación, ya que no significa nada en este caso. + +Cada fragmento puede tener un peso definido en el archivo de configuración. Por defecto, el peso es igual a uno. Los datos se distribuyen entre fragmentos en la cantidad proporcional al peso del fragmento. Por ejemplo, si hay dos fragmentos y el primero tiene un peso de 9 mientras que el segundo tiene un peso de 10, el primero se enviará 9 / 19 partes de las filas, y el segundo se enviará 10 / 19. + +Cada fragmento puede tener el ‘internal\_replication’ parámetro definido en el archivo de configuración. + +Si este parámetro se establece en ‘true’, la operación de escritura selecciona la primera réplica en buen estado y escribe datos en ella. Utilice esta alternativa si la tabla Distribuida “looks at” tablas replicadas. En otras palabras, si la tabla donde se escribirán los datos los replicará por sí misma. + +Si se establece en ‘false’ (el valor predeterminado), los datos se escriben en todas las réplicas. En esencia, esto significa que la tabla distribuida replica los datos en sí. Esto es peor que usar tablas replicadas, porque no se verifica la consistencia de las réplicas y, con el tiempo, contendrán datos ligeramente diferentes. + +Para seleccionar el fragmento al que se envía una fila de datos, se analiza la expresión de fragmentación y su resto se toma de dividirlo por el peso total de los fragmentos. La fila se envía al fragmento que corresponde al medio intervalo de los restos de ‘prev\_weight’ a ‘prev\_weights + weight’, donde ‘prev\_weights’ es el peso total de los fragmentos con el número más pequeño, y ‘weight’ es el peso de este fragmento. Por ejemplo, si hay dos fragmentos, y el primero tiene un peso de 9 mientras que el segundo tiene un peso de 10, la fila se enviará al primer fragmento para los restos del rango \[0, 9), y al segundo para los restos del rango \[9, 19). + +La expresión de fragmentación puede ser cualquier expresión de constantes y columnas de tabla que devuelva un entero. Por ejemplo, puede usar la expresión ‘rand()’ para la distribución aleatoria de datos, o ‘UserID’ para la distribución por el resto de dividir la ID del usuario (entonces los datos de un solo usuario residirán en un solo fragmento, lo que simplifica la ejecución de IN y JOIN por los usuarios). Si una de las columnas no se distribuye lo suficientemente uniformemente, puede envolverla en una función hash: intHash64(UserID) . + +Un simple recordatorio de la división es una solución limitada para sharding y no siempre es apropiado. Funciona para volúmenes medianos y grandes de datos (docenas de servidores), pero no para volúmenes muy grandes de datos (cientos de servidores o más). En este último caso, use el esquema de fragmentación requerido por el área asunto, en lugar de usar entradas en Tablas distribuidas. + +SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don’t have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. + +Debería preocuparse por el esquema de fragmentación en los siguientes casos: + +- Se utilizan consultas que requieren unir datos (IN o JOIN) mediante una clave específica. Si esta clave fragmenta datos, puede usar IN local o JOIN en lugar de GLOBAL IN o GLOBAL JOIN, que es mucho más eficiente. +- Se usa una gran cantidad de servidores (cientos o más) con una gran cantidad de consultas pequeñas (consultas de clientes individuales: sitios web, anunciantes o socios). Para que las pequeñas consultas no afecten a todo el clúster, tiene sentido ubicar datos para un solo cliente en un solo fragmento. Alternativamente, como lo hemos hecho en Yandex.Metrica, puede configurar sharding de dos niveles: divida todo el clúster en “layers”, donde una capa puede consistir en varios fragmentos. Los datos de un único cliente se encuentran en una sola capa, pero los fragmentos se pueden agregar a una capa según sea necesario y los datos se distribuyen aleatoriamente dentro de ellos. Las tablas distribuidas se crean para cada capa y se crea una única tabla distribuida compartida para consultas globales. + +Los datos se escriben de forma asíncrona. Cuando se inserta en la tabla, el bloque de datos se acaba de escribir en el sistema de archivos local. Los datos se envían a los servidores remotos en segundo plano tan pronto como sea posible. El período de envío de datos está gestionado por el [Distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) y [Distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) configuración. El `Distributed` el motor envía cada archivo con datos insertados por separado, pero puede habilitar el envío por lotes de archivos [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) configuración. Esta configuración mejora el rendimiento del clúster al utilizar mejor los recursos de red y servidor local. Debe comprobar si los datos se envían correctamente comprobando la lista de archivos (datos en espera de ser enviados) en el directorio de la tabla: `/var/lib/clickhouse/data/database/table/`. + +Si el servidor dejó de existir o tuvo un reinicio aproximado (por ejemplo, después de un error de dispositivo) después de un INSERT en una tabla distribuida, es posible que se pierdan los datos insertados. Si se detecta un elemento de datos dañado en el directorio de la tabla, se transfiere al ‘broken’ subdirectorio y ya no se utiliza. + +Cuando la opción max\_parallel\_replicas está habilitada, el procesamiento de consultas se paralela en todas las réplicas dentro de un solo fragmento. Para obtener más información, consulte la sección [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). + +## Virtual Columnas {#virtual-columns} + +- `_shard_num` — Contains the `shard_num` (de `system.clusters`). Tipo: [UInt32](../../../sql-reference/data-types/int-uint.md). + +!!! note "Nota" + Ya [`remote`](../../../sql-reference/table-functions/remote.md)/`cluster` funciones de tabla crean internamente instancia temporal del mismo motor distribuido, `_shard_num` está disponible allí también. + +**Ver también** + +- [Virtual columnas](index.md#table_engines-virtual_columns) + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/es/engines/table-engines/special/external-data.md b/docs/es/engines/table-engines/special/external-data.md new file mode 100644 index 00000000000..914abf6ddb5 --- /dev/null +++ b/docs/es/engines/table-engines/special/external-data.md @@ -0,0 +1,68 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 34 +toc_title: Datos externos +--- + +# Datos Externos Para El Procesamiento De Consultas {#external-data-for-query-processing} + +ClickHouse permite enviar a un servidor los datos necesarios para procesar una consulta, junto con una consulta SELECT. Estos datos se colocan en una tabla temporal (consulte la sección “Temporary tables”) y se puede utilizar en la consulta (por ejemplo, en operadores IN). + +Por ejemplo, si tiene un archivo de texto con identificadores de usuario importantes, puede cargarlo en el servidor junto con una consulta que utilice la filtración de esta lista. + +Si necesita ejecutar más de una consulta con un gran volumen de datos externos, no utilice esta función. Es mejor cargar los datos a la base de datos con anticipación. + +Los datos externos se pueden cargar mediante el cliente de línea de comandos (en modo no interactivo) o mediante la interfaz HTTP. + +En el cliente de línea de comandos, puede especificar una sección de parámetros en el formato + +``` bash +--external --file=... [--name=...] [--format=...] [--types=...|--structure=...] +``` + +Puede tener varias secciones como esta, para el número de tablas que se transmiten. + +**–external** – Marks the beginning of a clause. +**–file** – Path to the file with the table dump, or -, which refers to stdin. +Solo se puede recuperar una sola tabla de stdin. + +Los siguientes parámetros son opcionales: **–name**– Name of the table. If omitted, \_data is used. +**–format** – Data format in the file. If omitted, TabSeparated is used. + +Se requiere uno de los siguientes parámetros:**–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`. Define los nombres y tipos de columna. + +Los archivos especificados en ‘file’ se analizará mediante el formato especificado en ‘format’ utilizando los tipos de datos especificados en ‘types’ o ‘structure’. La mesa será cargado en el servidor y accesibles, como una tabla temporal con el nombre de ‘name’. + +Ejemplos: + +``` bash +$ echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 +849897 +$ cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +Cuando se utiliza la interfaz HTTP, los datos externos se pasan en el formato multipart/form-data. Cada tabla se transmite como un archivo separado. El nombre de la tabla se toma del nombre del archivo. El ‘query\_string’ se pasa los parámetros ‘name\_format’, ‘name\_types’, y ‘name\_structure’, donde ‘name’ es el nombre de la tabla a la que corresponden estos parámetros. El significado de los parámetros es el mismo que cuando se usa el cliente de línea de comandos. + +Ejemplo: + +``` bash +$ cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv + +$ curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +Para el procesamiento de consultas distribuidas, las tablas temporales se envían a todos los servidores remotos. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/external_data/) diff --git a/docs/es/engines/table-engines/special/file.md b/docs/es/engines/table-engines/special/file.md new file mode 100644 index 00000000000..b366c72a335 --- /dev/null +++ b/docs/es/engines/table-engines/special/file.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 37 +toc_title: File +--- + +# File {#table_engines-file} + +El motor de tabla de archivos mantiene los datos en un archivo en uno de los [file +formato](../../../interfaces/formats.md#formats) (TabSeparated, Native, etc.). + +Ejemplos de uso: + +- Exportación de datos de ClickHouse a archivo. +- Convertir datos de un formato a otro. +- Actualización de datos en ClickHouse mediante la edición de un archivo en un disco. + +## Uso En El Servidor De Clickhouse {#usage-in-clickhouse-server} + +``` sql +File(Format) +``` + +El `Format` parámetro especifica uno de los formatos de archivo disponibles. Realizar +`SELECT` consultas, el formato debe ser compatible para la entrada, y para realizar +`INSERT` queries – for output. The available formats are listed in the +[Formato](../../../interfaces/formats.md#formats) apartado. + +ClickHouse no permite especificar la ruta del sistema de archivos para`File`. Utilizará la carpeta definida por [camino](../../../operations/server-configuration-parameters/settings.md) configuración en la configuración del servidor. + +Al crear una tabla usando `File(Format)` crea un subdirectorio vacío en esa carpeta. Cuando los datos se escriben en esa tabla, se colocan en `data.Format` en ese subdirectorio. + +Puede crear manualmente esta subcarpeta y archivo en el sistema de archivos del servidor y luego [ATTACH](../../../sql-reference/statements/misc.md) para mostrar información con el nombre coincidente, para que pueda consultar datos desde ese archivo. + +!!! warning "Advertencia" + Tenga cuidado con esta funcionalidad, ya que ClickHouse no realiza un seguimiento de los cambios externos en dichos archivos. El resultado de las escrituras simultáneas a través de ClickHouse y fuera de ClickHouse no está definido. + +**Ejemplo:** + +**1.** Configurar el `file_engine_table` tabla: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +Por defecto, ClickHouse creará una carpeta `/var/lib/clickhouse/data/default/file_engine_table`. + +**2.** Crear manualmente `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` contener: + +``` bash +$ cat data.TabSeparated +one 1 +two 2 +``` + +**3.** Consultar los datos: + +``` sql +SELECT * FROM file_engine_table +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Uso En Clickhouse-local {#usage-in-clickhouse-local} + +En [Sistema abierto.](../../../operations/utilities/clickhouse-local.md) El motor de archivos acepta la ruta del archivo además de `Format`. Los flujos de entrada / salida predeterminados se pueden especificar utilizando nombres numéricos o legibles por humanos como `0` o `stdin`, `1` o `stdout`. +**Ejemplo:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## Detalles De La implementación {#details-of-implementation} + +- Multiple `SELECT` las consultas se pueden realizar simultáneamente, pero `INSERT` las consultas se esperarán entre sí. +- Apoyado la creación de nuevos archivos por `INSERT` consulta. +- Si el archivo existe, `INSERT` añadiría nuevos valores en él. +- No soportado: + - `ALTER` + - `SELECT ... SAMPLE` + - Indice + - Replicación + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/es/engines/table-engines/special/generate.md b/docs/es/engines/table-engines/special/generate.md new file mode 100644 index 00000000000..008acd15f7a --- /dev/null +++ b/docs/es/engines/table-engines/special/generate.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 46 +toc_title: GenerateRandom +--- + +# Generaterandom {#table_engines-generate} + +El motor de tabla GenerateRandom produce datos aleatorios para el esquema de tabla determinado. + +Ejemplos de uso: + +- Se usa en la prueba para poblar una tabla grande reproducible. +- Generar entrada aleatoria para pruebas de fuzzing. + +## Uso En El Servidor De Clickhouse {#usage-in-clickhouse-server} + +``` sql +ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) +``` + +El `max_array_length` y `max_string_length` parámetros especifican la longitud máxima de todos +columnas y cadenas de matriz correspondientemente en los datos generados. + +Generar motor de tabla sólo admite `SELECT` consulta. + +Es compatible con todos [Tipos de datos](../../../sql-reference/data-types/index.md) que se pueden almacenar en una tabla excepto `LowCardinality` y `AggregateFunction`. + +**Ejemplo:** + +**1.** Configurar el `generate_engine_table` tabla: + +``` sql +CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) +``` + +**2.** Consultar los datos: + +``` sql +SELECT * FROM generate_engine_table LIMIT 3 +``` + +``` text +┌─name─┬──────value─┐ +│ c4xJ │ 1412771199 │ +│ r │ 1791099446 │ +│ 7#$ │ 124312908 │ +└──────┴────────────┘ +``` + +## Detalles De La implementación {#details-of-implementation} + +- No soportado: + - `ALTER` + - `SELECT ... SAMPLE` + - `INSERT` + - Indice + - Replicación + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/es/engines/table_engines/special/index.md b/docs/es/engines/table-engines/special/index.md similarity index 100% rename from docs/es/engines/table_engines/special/index.md rename to docs/es/engines/table-engines/special/index.md diff --git a/docs/es/engines/table-engines/special/join.md b/docs/es/engines/table-engines/special/join.md new file mode 100644 index 00000000000..75825cfc97f --- /dev/null +++ b/docs/es/engines/table-engines/special/join.md @@ -0,0 +1,111 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 40 +toc_title: Unir +--- + +# Unir {#join} + +Estructura de datos preparada para usar en [JOIN](../../../sql-reference/statements/select.md#select-join) operación. + +## Creación De Una Tabla {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], +) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) +``` + +Vea la descripción detallada del [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) consulta. + +**Parámetros del motor** + +- `join_strictness` – [ÚNETE a la rigurosidad](../../../sql-reference/statements/select.md#select-join-strictness). +- `join_type` – [Tipo de unión](../../../sql-reference/statements/select.md#select-join-types). +- `k1[, k2, ...]` – Key columns from the `USING` cláusula que el `JOIN` operación se hace con. + +Entrar `join_strictness` y `join_type` parámetros sin comillas, por ejemplo, `Join(ANY, LEFT, col1)`. Deben coincidir con el `JOIN` operación para la que se utilizará la tabla. Si los parámetros no coinciden, ClickHouse no lanza una excepción y puede devolver datos incorrectos. + +## Uso De La Tabla {#table-usage} + +### Ejemplo {#example} + +Creación de la tabla del lado izquierdo: + +``` sql +CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog +``` + +``` sql +INSERT INTO id_val VALUES (1,11)(2,12)(3,13) +``` + +Creando el lado derecho `Join` tabla: + +``` sql +CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) +``` + +``` sql +INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) +``` + +Unirse a las tablas: + +``` sql +SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 +``` + +``` text +┌─id─┬─val─┬─id_val_join.val─┐ +│ 1 │ 11 │ 21 │ +│ 2 │ 12 │ ᴺᵁᴸᴸ │ +│ 3 │ 13 │ 23 │ +└────┴─────┴─────────────────┘ +``` + +Como alternativa, puede recuperar datos del `Join` tabla, especificando el valor de la clave de unión: + +``` sql +SELECT joinGet('id_val_join', 'val', toUInt32(1)) +``` + +``` text +┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ +│ 21 │ +└────────────────────────────────────────────┘ +``` + +### Selección e inserción De Datos {#selecting-and-inserting-data} + +Usted puede utilizar `INSERT` consultas para agregar datos al `Join`-mesas de motor. Si la tabla se creó con el `ANY` estricta, se ignoran los datos de las claves duplicadas. Con el `ALL` estricta, se agregan todas las filas. + +No se puede realizar una `SELECT` consulta directamente desde la tabla. En su lugar, use uno de los siguientes métodos: + +- Coloque la mesa hacia el lado derecho en un `JOIN` clausula. +- Llame al [joinGet](../../../sql-reference/functions/other-functions.md#joinget) función, que le permite extraer datos de la tabla de la misma manera que de un diccionario. + +### Limitaciones y Ajustes {#join-limitations-and-settings} + +Al crear una tabla, se aplican los siguientes valores: + +- [Sistema abierto.](../../../operations/settings/settings.md#join_use_nulls) +- [Método de codificación de datos:](../../../operations/settings/query-complexity.md#settings-max_rows_in_join) +- [Método de codificación de datos:](../../../operations/settings/query-complexity.md#settings-max_bytes_in_join) +- [join\_overflow\_mode](../../../operations/settings/query-complexity.md#settings-join_overflow_mode) +- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) + +El `Join`-las tablas del motor no se pueden usar en `GLOBAL JOIN` operación. + +El `Join`-motor permite el uso [Sistema abierto.](../../../operations/settings/settings.md#join_use_nulls) ajuste en el `CREATE TABLE` instrucción. Y [SELECT](../../../sql-reference/statements/select.md) consulta permite el uso `join_use_nulls` demasiado. Si tienes diferentes `join_use_nulls` configuración, puede obtener un error al unirse a la tabla. Depende del tipo de JOIN. Cuando se utiliza [joinGet](../../../sql-reference/functions/other-functions.md#joinget) función, usted tiene que utilizar el mismo `join_use_nulls` ajuste en `CRATE TABLE` y `SELECT` instrucción. + +## Almacenamiento De Datos {#data-storage} + +`Join` datos de la tabla siempre se encuentra en la memoria RAM. Al insertar filas en una tabla, ClickHouse escribe bloques de datos en el directorio del disco para que puedan restaurarse cuando se reinicie el servidor. + +Si el servidor se reinicia incorrectamente, el bloque de datos en el disco puede perderse o dañarse. En este caso, es posible que deba eliminar manualmente el archivo con datos dañados. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/es/engines/table-engines/special/materializedview.md b/docs/es/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..3da6fb5000a --- /dev/null +++ b/docs/es/engines/table-engines/special/materializedview.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 43 +toc_title: "M\xE9todo de codificaci\xF3n de datos:" +--- + +# Método De codificación De Datos: {#materializedview} + +Se utiliza para implementar vistas materializadas (para obtener más información, consulte [CREATE TABLE](../../../sql-reference/statements/create.md)). Para almacenar datos, utiliza un motor diferente que se especificó al crear la vista. Al leer desde una tabla, solo usa este motor. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/es/engines/table_engines/special/memory.md b/docs/es/engines/table-engines/special/memory.md similarity index 100% rename from docs/es/engines/table_engines/special/memory.md rename to docs/es/engines/table-engines/special/memory.md diff --git a/docs/es/engines/table-engines/special/merge.md b/docs/es/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..14d4c649471 --- /dev/null +++ b/docs/es/engines/table-engines/special/merge.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 36 +toc_title: Fusionar +--- + +# Fusionar {#merge} + +El `Merge` motor (no debe confundirse con `MergeTree`) no almacena datos en sí, pero permite leer de cualquier número de otras tablas simultáneamente. +La lectura se paralela automáticamente. No se admite la escritura en una tabla. Al leer, se usan los índices de las tablas que realmente se están leyendo, si existen. +El `Merge` engine acepta parámetros: el nombre de la base de datos y una expresión regular para las tablas. + +Ejemplo: + +``` sql +Merge(hits, '^WatchLog') +``` + +Los datos se leerán de las tablas en el `hits` base de datos que tienen nombres que coinciden con la expresión regular ‘`^WatchLog`’. + +En lugar del nombre de la base de datos, puede usar una expresión constante que devuelva una cadena. Por ejemplo, `currentDatabase()`. + +Regular expressions — [Re2](https://github.com/google/re2) (soporta un subconjunto de PCRE), sensible a mayúsculas y minúsculas. +Vea las notas sobre los símbolos de escape en expresiones regulares en el “match” apartado. + +Al seleccionar tablas para leer, el `Merge` no se seleccionará la tabla en sí, incluso si coincide con la expresión regular. Esto es para evitar bucles. +Es posible crear dos `Merge` tablas que intentarán interminablemente leer los datos de los demás, pero esta no es una buena idea. + +La forma típica de usar el `Merge` para trabajar con un gran número de `TinyLog` tablas como si con una sola tabla. + +Ejemplo 2: + +Digamos que tiene una tabla antigua (WatchLog\_old) y decidió cambiar la partición sin mover datos a una nueva tabla (WatchLog\_new) y necesita ver datos de ambas tablas. + +``` sql +CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree(date, (UserId, EventType), 8192); +INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + +CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; +INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + +CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + +SELECT * +FROM WatchLog +``` + +``` text +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-01 │ 1 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-02 │ 2 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +``` + +## Virtual Columnas {#virtual-columns} + +- `_table` — Contains the name of the table from which data was read. Type: [Cadena](../../../sql-reference/data-types/string.md). + + Puede establecer las condiciones constantes en `_table` en el `WHERE/PREWHERE` cláusula (por ejemplo, `WHERE _table='xyz'`). En este caso, la operación de lectura se realiza sólo para las tablas donde la condición en `_table` está satisfecho, por lo que el `_table` columna actúa como un índice. + +**Ver también** + +- [Virtual columnas](index.md#table_engines-virtual_columns) + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/es/engines/table_engines/special/null.md b/docs/es/engines/table-engines/special/null.md similarity index 100% rename from docs/es/engines/table_engines/special/null.md rename to docs/es/engines/table-engines/special/null.md diff --git a/docs/es/engines/table_engines/special/set.md b/docs/es/engines/table-engines/special/set.md similarity index 100% rename from docs/es/engines/table_engines/special/set.md rename to docs/es/engines/table-engines/special/set.md diff --git a/docs/es/engines/table-engines/special/url.md b/docs/es/engines/table-engines/special/url.md new file mode 100644 index 00000000000..0197b5e9a4a --- /dev/null +++ b/docs/es/engines/table-engines/special/url.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 41 +toc_title: URL +--- + +# URL(URL, Formato) {#table_engines-url} + +Administra datos en un servidor HTTP/HTTPS remoto. Este motor es similar +a la [File](file.md) motor. + +## Uso Del Motor En El Servidor De Clickhouse {#using-the-engine-in-the-clickhouse-server} + +El `format` debe ser uno que ClickHouse pueda usar en +`SELECT` consultas y, si es necesario, en `INSERTs`. Para obtener la lista completa de formatos admitidos, consulte +[Formato](../../../interfaces/formats.md#formats). + +El `URL` debe ajustarse a la estructura de un localizador uniforme de recursos. La dirección URL especificada debe apuntar a un servidor +que utiliza HTTP o HTTPS. Esto no requiere ningún +encabezados adicionales para obtener una respuesta del servidor. + +`INSERT` y `SELECT` las consultas se transforman en `POST` y `GET` peticiones, +respectivamente. Para el procesamiento `POST` solicitudes, el servidor remoto debe admitir +[Codificación de transferencia fragmentada](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). + +Puede limitar el número máximo de saltos de redirección HTTP GET utilizando el [Nombre de la red inalámbrica (SSID):](../../../operations/settings/settings.md#setting-max_http_get_redirects) configuración. + +**Ejemplo:** + +**1.** Crear un `url_engine_table` tabla en el servidor : + +``` sql +CREATE TABLE url_engine_table (word String, value UInt64) +ENGINE=URL('http://127.0.0.1:12345/', CSV) +``` + +**2.** Cree un servidor HTTP básico utilizando las herramientas estándar de Python 3 y +comenzarlo: + +``` python3 +from http.server import BaseHTTPRequestHandler, HTTPServer + +class CSVHTTPServer(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-type', 'text/csv') + self.end_headers() + + self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) + +if __name__ == "__main__": + server_address = ('127.0.0.1', 12345) + HTTPServer(server_address, CSVHTTPServer).serve_forever() +``` + +``` bash +$ python3 server.py +``` + +**3.** Solicitar datos: + +``` sql +SELECT * FROM url_engine_table +``` + +``` text +┌─word──┬─value─┐ +│ Hello │ 1 │ +│ World │ 2 │ +└───────┴───────┘ +``` + +## Detalles De La implementación {#details-of-implementation} + +- Las lecturas y escrituras pueden ser paralelas +- No soportado: + - `ALTER` y `SELECT...SAMPLE` operación. + - Índices. + - Replicación. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/es/engines/table_engines/special/view.md b/docs/es/engines/table-engines/special/view.md similarity index 100% rename from docs/es/engines/table_engines/special/view.md rename to docs/es/engines/table-engines/special/view.md diff --git a/docs/es/engines/table_engines/index.md b/docs/es/engines/table_engines/index.md deleted file mode 100644 index 46d769316ba..00000000000 --- a/docs/es/engines/table_engines/index.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Table Engines -toc_priority: 26 -toc_title: "Implantaci\xF3n" ---- - -# Motores de mesa {#table_engines} - -El motor de tabla (tipo de tabla) determina: - -- Cómo y dónde se almacenan los datos, dónde escribirlos y dónde leerlos. -- Qué consultas son compatibles y cómo. -- Acceso a datos simultáneos. -- Uso de índices, si está presente. -- Si es posible la ejecución de solicitudes multiproceso. -- Parámetros de replicación de datos. - -## Familias de motores {#engine-families} - -### Mergetree {#mergetree} - -Los motores de mesa más universales y funcionales para tareas de alta carga. La propiedad compartida por estos motores es la inserción rápida de datos con el posterior procesamiento de datos en segundo plano. `MergeTree` Los motores familiares admiten la replicación de datos (con [Replicado\*](mergetree_family/replication.md) versiones de motores), particionamiento y otras características no admitidas en otros motores. - -Motores en la familia: - -- [Método de codificación de datos:](mergetree_family/mergetree.md) -- [ReplacingMergeTree](mergetree_family/replacingmergetree.md) -- [SummingMergeTree](mergetree_family/summingmergetree.md) -- [AgregaciónMergeTree](mergetree_family/aggregatingmergetree.md) -- [ColapsarMergeTree](mergetree_family/collapsingmergetree.md) -- [VersionedCollapsingMergeTree](mergetree_family/versionedcollapsingmergetree.md) -- [GraphiteMergeTree](mergetree_family/graphitemergetree.md) - -### Registro {#log} - -Ligero [motor](log_family/index.md) con funcionalidad mínima. Son los más efectivos cuando necesita escribir rápidamente muchas tablas pequeñas (hasta aproximadamente 1 millón de filas) y leerlas más tarde como un todo. - -Motores en la familia: - -- [TinyLog](log_family/tinylog.md) -- [StripeLog](log_family/stripelog.md) -- [Registro](log_family/log.md) - -### Motores de integración {#integration-engines} - -Motores para comunicarse con otros sistemas de almacenamiento y procesamiento de datos. - -Motores en la familia: - -- [Kafka](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) -- [HDFS](integrations/hdfs.md) - -### Motores especiales {#special-engines} - -Motores en la familia: - -- [Distribuido](special/distributed.md) -- [Método de codificación de datos:](special/materializedview.md) -- [Diccionario](special/dictionary.md) -- [Fusionar](special/merge.md) -- [File](special/file.md) -- [Nulo](special/null.md) -- [Establecer](special/set.md) -- [Unir](special/join.md) -- [URL](special/url.md) -- [Vista](special/view.md) -- [Memoria](special/memory.md) -- [Búfer](special/buffer.md) - -## Virtual Columnas {#table_engines-virtual-columns} - -La columna virtual es un atributo de motor de tabla integral que se define en el código fuente del motor. - -No debe especificar columnas virtuales en el `CREATE TABLE` consulta y no puedes verlos en `SHOW CREATE TABLE` y `DESCRIBE TABLE` resultados de la consulta. Las columnas virtuales también son de solo lectura, por lo que no puede insertar datos en columnas virtuales. - -Para seleccionar datos de una columna virtual, debe especificar su nombre en el `SELECT` consulta. `SELECT *` no devuelve valores de columnas virtuales. - -Si crea una tabla con una columna que tiene el mismo nombre que una de las columnas virtuales de la tabla, la columna virtual se vuelve inaccesible. No recomendamos hacer esto. Para ayudar a evitar conflictos, los nombres de columna virtual suelen tener el prefijo de un guión bajo. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/es/engines/table_engines/integrations/hdfs.md b/docs/es/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index eb41cdbc91b..00000000000 --- a/docs/es/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 36 -toc_title: HDFS ---- - -# HDFS {#table_engines-hdfs} - -Este motor proporciona integración con [Acerca de nosotros](https://en.wikipedia.org/wiki/Apache_Hadoop) permitiendo gestionar datos sobre [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)a través de ClickHouse. Este motor es similar -a la [File](../special/file.md) y [URL](../special/url.md) motores, pero proporciona características específicas de Hadoop. - -## Uso {#usage} - -``` sql -ENGINE = HDFS(URI, format) -``` - -El `URI` El parámetro es el URI del archivo completo en HDFS. -El `format` parámetro especifica uno de los formatos de archivo disponibles. Realizar -`SELECT` consultas, el formato debe ser compatible para la entrada, y para realizar -`INSERT` queries – for output. The available formats are listed in the -[Formato](../../../interfaces/formats.md#formats) apartado. -La parte de la ruta de `URI` puede contener globs. En este caso, la tabla sería de solo lectura. - -**Ejemplo:** - -**1.** Configurar el `hdfs_engine_table` tabla: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** Llenar archivo: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** Consultar los datos: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Detalles de implementación {#implementation-details} - -- Las lecturas y escrituras pueden ser paralelas -- No soportado: - - `ALTER` y `SELECT...SAMPLE` operación. - - Índices. - - Replicación. - -**Globs en el camino** - -Múltiples componentes de ruta de acceso pueden tener globs. Para ser procesado, el archivo debe existir y coincidir con todo el patrón de ruta. Listado de archivos determina durante `SELECT` (no en `CREATE` momento). - -- `*` — Substitutes any number of any characters except `/` incluyendo cadena vacía. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Construcciones con `{}` son similares a la [remoto](../../../sql_reference/table_functions/remote.md) función de la tabla. - -**Ejemplo** - -1. Supongamos que tenemos varios archivos en formato TSV con los siguientes URI en HDFS: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Hay varias maneras de hacer una tabla que consta de los seis archivos: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -Otra forma: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -La tabla consta de todos los archivos en ambos directorios (todos los archivos deben satisfacer el formato y el esquema descritos en la consulta): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "Advertencia" - Si la lista de archivos contiene rangos de números con ceros a la izquierda, use la construcción con llaves para cada dígito por separado o use `?`. - -**Ejemplo** - -Crear tabla con archivos llamados `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') -``` - -## Virtual Columnas {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Ver también** - -- [Virtual columnas](../index.md#table_engines-virtual_columns) - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/es/engines/table_engines/integrations/jdbc.md b/docs/es/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index ad37b26f357..00000000000 --- a/docs/es/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 34 -toc_title: JDBC ---- - -# JDBC {#table-engine-jdbc} - -Permite que ClickHouse se conecte a bases de datos externas a través de [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -Para implementar la conexión JDBC, ClickHouse utiliza el programa independiente [Sistema abierto.](https://github.com/alex-krash/clickhouse-jdbc-bridge) que debería ejecutarse como un demonio. - -Este motor soporta el [NULL](../../../sql_reference/data_types/nullable.md) tipo de datos. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -( - columns list... -) -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**Parámetros del motor** - -- `dbms_uri` — URI of an external DBMS. - - Formato: `jdbc:://:/?user=&password=`. - Ejemplo para MySQL: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — Database in an external DBMS. - -- `external_table` — Name of the table in `external_database`. - -## Ejemplo de uso {#usage-example} - -Crear una tabla en el servidor MySQL conectándose directamente con su cliente de consola: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Creación de una tabla en el servidor ClickHouse y selección de datos de ella: - -``` sql -CREATE TABLE jdbc_table -( - `int_id` Int32, - `int_nullable` Nullable(Int32), - `float` Float32, - `float_nullable` Nullable(Float32) -) -ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Ver también {#see-also} - -- [Función de la tabla de JDBC](../../../sql_reference/table_functions/jdbc.md). - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/es/engines/table_engines/integrations/kafka.md b/docs/es/engines/table_engines/integrations/kafka.md deleted file mode 100644 index daedc790806..00000000000 --- a/docs/es/engines/table_engines/integrations/kafka.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 32 -toc_title: Kafka ---- - -# Kafka {#kafka} - -Este motor funciona con [Acerca de nosotros](http://kafka.apache.org/). - -Kafka te permite: - -- Publicar o suscribirse a flujos de datos. -- Organice el almacenamiento tolerante a fallos. -- Secuencias de proceso a medida que estén disponibles. - -## Creación de una tabla {#table_engine-kafka-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = Kafka() -SETTINGS - kafka_broker_list = 'host:port', - kafka_topic_list = 'topic1,topic2,...', - kafka_group_name = 'group_name', - kafka_format = 'data_format'[,] - [kafka_row_delimiter = 'delimiter_symbol',] - [kafka_schema = '',] - [kafka_num_consumers = N,] - [kafka_skip_broken_messages = N] -``` - -Parámetros requeridos: - -- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). -- `kafka_topic_list` – A list of Kafka topics. -- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don't want messages to be duplicated in the cluster, use the same group name everywhere. -- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` función, tal como `JSONEachRow`. Para obtener más información, consulte [Formato](../../../interfaces/formats.md) apartado. - -Parámetros opcionales: - -- `kafka_row_delimiter` – Delimiter character, which ends the message. -- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap'n Proto](https://capnproto.org/) requiere la ruta de acceso al archivo de esquema y el nombre de la raíz `schema.capnp:Message` objeto. -- `kafka_num_consumers` – The number of consumers per table. Default: `1`. Especifique más consumidores si el rendimiento de un consumidor es insuficiente. El número total de consumidores no debe exceder el número de particiones en el tema, ya que solo se puede asignar un consumidor por partición. -- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. Si `kafka_skip_broken_messages = N` entonces el motor salta *N* Mensajes de Kafka que no se pueden analizar (un mensaje es igual a una fila de datos). - -Ejemplos: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - SELECT * FROM queue LIMIT 5; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') - SETTINGS kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; -``` - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No utilice este método en nuevos proyectos. Si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format - [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) -``` - -
- -## Descripci {#description} - -Los mensajes entregados se realizan un seguimiento automático, por lo que cada mensaje de un grupo solo se cuenta una vez. Si desea obtener los datos dos veces, cree una copia de la tabla con otro nombre de grupo. - -Los grupos son flexibles y se sincronizan en el clúster. Por ejemplo, si tiene 10 temas y 5 copias de una tabla en un clúster, cada copia obtiene 2 temas. Si el número de copias cambia, los temas se redistribuyen automáticamente entre las copias. Lea más sobre esto en http://kafka.apache.org/intro . - -`SELECT` no es particularmente útil para leer mensajes (excepto para la depuración), ya que cada mensaje se puede leer solo una vez. Es más práctico crear subprocesos en tiempo real utilizando vistas materializadas. Para hacer esto: - -1. Use el motor para crear un consumidor de Kafka y considérelo como un flujo de datos. -2. Crea una tabla con la estructura deseada. -3. Cree una vista materializada que convierta los datos del motor y los coloque en una tabla creada previamente. - -Cuando el `MATERIALIZED VIEW` se une al motor, comienza a recopilar datos en segundo plano. Esto le permite recibir continuamente mensajes de Kafka y convertirlos al formato requerido usando `SELECT`. -Una tabla kafka puede tener tantas vistas materializadas como desee, no leen datos de la tabla kafka directamente, sino que reciben nuevos registros (en bloques), de esta manera puede escribir en varias tablas con diferentes niveles de detalle (con agrupación - agregación y sin). - -Ejemplo: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - CREATE TABLE daily ( - day Date, - level String, - total UInt64 - ) ENGINE = SummingMergeTree(day, (day, level), 8192); - - CREATE MATERIALIZED VIEW consumer TO daily - AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total - FROM queue GROUP BY day, level; - - SELECT level, sum(total) FROM daily GROUP BY level; -``` - -Para mejorar el rendimiento, los mensajes recibidos se agrupan en bloques del tamaño de [Max\_insert\_block\_size](../../../operations/server_configuration_parameters/settings.md#settings-max_insert_block_size). Si el bloque no se formó dentro de [Nombre de la red inalámbrica (SSID):](../../../operations/server_configuration_parameters/settings.md) milisegundos, los datos se vaciarán a la tabla independientemente de la integridad del bloque. - -Para detener la recepción de datos de tema o cambiar la lógica de conversión, desconecte la vista materializada: - -``` sql - DETACH TABLE consumer; - ATTACH TABLE consumer; -``` - -Si desea cambiar la tabla de destino utilizando `ALTER`, recomendamos deshabilitar la vista de material para evitar discrepancias entre la tabla de destino y los datos de la vista. - -## Configuración {#configuration} - -Similar a GraphiteMergeTree, el motor Kafka admite una configuración extendida utilizando el archivo de configuración ClickHouse. Hay dos claves de configuración que puede usar: global (`kafka`) y a nivel de tema (`kafka_*`). La configuración global se aplica primero y, a continuación, se aplica la configuración de nivel de tema (si existe). - -``` xml - - - cgrp - smallest - - - - - 250 - 100000 - -``` - -Para obtener una lista de posibles opciones de configuración, consulte [referencia de configuración librdkafka](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Usa el guión bajo (`_`) en lugar de un punto en la configuración de ClickHouse. Por ejemplo, `check.crcs=true` será `true`. - -## Virtual Columnas {#virtual-columns} - -- `_topic` — Kafka topic. -- `_key` — Key of the message. -- `_offset` — Offset of the message. -- `_timestamp` — Timestamp of the message. -- `_partition` — Partition of Kafka topic. - -**Ver también** - -- [Virtual columnas](../index.md#table_engines-virtual_columns) - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/es/engines/table_engines/integrations/mysql.md b/docs/es/engines/table_engines/integrations/mysql.md deleted file mode 100644 index 6d78036fbdc..00000000000 --- a/docs/es/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 33 -toc_title: MySQL ---- - -# Mysql {#mysql} - -El motor MySQL le permite realizar `SELECT` consultas sobre datos almacenados en un servidor MySQL remoto. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... -) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -Vea una descripción detallada del [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) consulta. - -La estructura de la tabla puede diferir de la estructura de la tabla MySQL original: - -- Los nombres de columna deben ser los mismos que en la tabla MySQL original, pero puede usar solo algunas de estas columnas y en cualquier orden. -- Los tipos de columna pueden diferir de los de la tabla MySQL original. ClickHouse intenta [elenco](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) valores a los tipos de datos ClickHouse. - -**Parámetros del motor** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` consultas a `REPLACE INTO`. Si `replace_query=1`, la consulta se sustituye. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expresión que se añade a la `INSERT` consulta. - - Ejemplo: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, donde `on_duplicate_clause` ser `UPDATE c2 = c2 + 1`. Ver el [Documentación de MySQL](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) para encontrar qué `on_duplicate_clause` se puede utilizar con el `ON DUPLICATE KEY` clausula. - - Especificar `on_duplicate_clause` tienes que pasar `0` a la `replace_query` parámetro. Si pasa simultáneamente `replace_query = 1` y `on_duplicate_clause`, ClickHouse genera una excepción. - -Simple `WHERE` cláusulas tales como `=, !=, >, >=, <, <=` se ejecutan en el servidor MySQL. - -El resto de las condiciones y el `LIMIT` La restricción de muestreo se ejecuta en ClickHouse solo después de que finalice la consulta a MySQL. - -## Ejemplo de uso {#usage-example} - -Tabla en MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Tabla en ClickHouse, recuperando datos de la tabla MySQL creada anteriormente: - -``` sql -CREATE TABLE mysql_table -( - `float_nullable` Nullable(Float32), - `int_id` Int32 -) -ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` sql -SELECT * FROM mysql_table -``` - -``` text -┌─float_nullable─┬─int_id─┐ -│ ᴺᵁᴸᴸ │ 1 │ -└────────────────┴────────┘ -``` - -## Ver también {#see-also} - -- [El ‘mysql’ función de la tabla](../../../sql_reference/table_functions/mysql.md) -- [Uso de MySQL como fuente de diccionario externo](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/es/engines/table_engines/integrations/odbc.md b/docs/es/engines/table_engines/integrations/odbc.md deleted file mode 100644 index 4b26cca9146..00000000000 --- a/docs/es/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 35 -toc_title: ODBC ---- - -# ODBC {#table-engine-odbc} - -Permite que ClickHouse se conecte a bases de datos externas a través de [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -Para implementar con seguridad conexiones ODBC, ClickHouse usa un programa separado `clickhouse-odbc-bridge`. Si el controlador ODBC se carga directamente desde `clickhouse-server`, problemas de controlador pueden bloquear el servidor ClickHouse. ClickHouse se inicia automáticamente `clickhouse-odbc-bridge` cuando se requiere. El programa de puente ODBC se instala desde el mismo paquete que el `clickhouse-server`. - -Este motor soporta el [NULL](../../../sql_reference/data_types/nullable.md) tipo de datos. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -Vea una descripción detallada del [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) consulta. - -La estructura de la tabla puede diferir de la estructura de la tabla de origen: - -- Los nombres de columna deben ser los mismos que en la tabla de origen, pero puede usar solo algunas de estas columnas y en cualquier orden. -- Los tipos de columna pueden diferir de los de la tabla de origen. ClickHouse intenta [elenco](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) valores a los tipos de datos ClickHouse. - -**Parámetros del motor** - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` file. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -## Ejemplo de uso {#usage-example} - -**Recuperación de datos de la instalación local de MySQL a través de ODBC** - -Este ejemplo se comprueba para Ubuntu Linux 18.04 y el servidor MySQL 5.7. - -Asegúrese de que unixODBC y MySQL Connector están instalados. - -De forma predeterminada (si se instala desde paquetes), ClickHouse comienza como usuario `clickhouse`. Por lo tanto, debe crear y configurar este usuario en el servidor MySQL. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -A continuación, configure la conexión en `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Puede verificar la conexión usando el `isql` utilidad desde la instalación de unixODBC. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -Tabla en MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Tabla en ClickHouse, recuperando datos de la tabla MySQL: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## Ver también {#see-also} - -- [Diccionarios externos ODBC](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [Tabla ODBC función](../../../sql_reference/table_functions/odbc.md) - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/es/engines/table_engines/log_family/log.md b/docs/es/engines/table_engines/log_family/log.md deleted file mode 100644 index 60fafda1fb8..00000000000 --- a/docs/es/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 33 -toc_title: Registro ---- - -# Registro {#log} - -El motor pertenece a la familia de motores de registro. Consulte las propiedades comunes de los motores de registro y sus diferencias en [Familia del motor de registro](log_family.md) artículo. - -El registro difiere de [TinyLog](tinylog.md) en que un pequeño archivo de “marks” reside con los archivos de columna. Estas marcas se escriben en cada bloque de datos y contienen compensaciones que indican dónde comenzar a leer el archivo para omitir el número especificado de filas. Esto hace posible leer datos de tabla en múltiples hilos. -Para el acceso a datos simultáneos, las operaciones de lectura se pueden realizar simultáneamente, mientras que las operaciones de escritura bloquean las lecturas entre sí. -El motor de registro no admite índices. Del mismo modo, si la escritura en una tabla falla, la tabla se rompe y la lectura de ella devuelve un error. El motor de registro es adecuado para datos temporales, tablas de escritura única y para fines de prueba o demostración. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/es/engines/table_engines/log_family/log_family.md b/docs/es/engines/table_engines/log_family/log_family.md deleted file mode 100644 index f55002b3c0d..00000000000 --- a/docs/es/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 31 -toc_title: "Implantaci\xF3n" ---- - -# Familia del motor de registro {#log-engine-family} - -Estos motores fueron desarrollados para escenarios en los que necesita escribir rápidamente muchas tablas pequeñas (hasta aproximadamente 1 millón de filas) y leerlas más tarde en su conjunto. - -Motores de la familia: - -- [StripeLog](stripelog.md) -- [Registro](log.md) -- [TinyLog](tinylog.md) - -## Propiedades comunes {#common-properties} - -Motor: - -- Almacenar datos en un disco. - -- Agregue datos al final del archivo al escribir. - -- Bloqueos de soporte para el acceso a datos simultáneos. - - Durante `INSERT` consultas, la tabla está bloqueada y otras consultas para leer y escribir datos esperan a que la tabla se desbloquee. Si no hay consultas de escritura de datos, se puede realizar cualquier número de consultas de lectura de datos simultáneamente. - -- No apoyo [mutación](../../../sql_reference/statements/alter.md#alter-mutations) operación. - -- No admite índices. - - Esto significa que `SELECT` las consultas para rangos de datos no son eficientes. - -- No escriba datos atómicamente. - - Puede obtener una tabla con datos dañados si algo rompe la operación de escritura, por ejemplo, un cierre anormal del servidor. - -## Diferencia {#differences} - -El `TinyLog` es el más simple de la familia y proporciona la funcionalidad más pobre y la eficiencia más baja. El `TinyLog` el motor no admite la lectura de datos paralelos por varios hilos. Lee datos más lentamente que otros motores de la familia que admiten lectura paralela y utiliza casi tantos descriptores como los `Log` motor porque almacena cada columna en un archivo separado. Úselo en escenarios simples de baja carga. - -El `Log` y `StripeLog` Los motores admiten lectura de datos paralela. Al leer datos, ClickHouse usa múltiples hilos. Cada subproceso procesa un bloque de datos separado. El `Log` utiliza un archivo separado para cada columna de la tabla. `StripeLog` almacena todos los datos en un archivo. Como resultado, el `StripeLog` el motor utiliza menos descriptores en el sistema operativo, pero el `Log` proporciona una mayor eficiencia al leer datos. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/es/engines/table_engines/log_family/stripelog.md b/docs/es/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index 7e0d84837aa..00000000000 --- a/docs/es/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 32 -toc_title: StripeLog ---- - -# Lista de Stripelog {#stripelog} - -Este motor pertenece a la familia de motores de registro. Consulte las propiedades comunes de los motores de registro y sus diferencias en [Familia del motor de registro](log_family.md) artículo. - -Utilice este motor en escenarios en los que necesite escribir muchas tablas con una pequeña cantidad de datos (menos de 1 millón de filas). - -## Creación de una tabla {#table_engines-stripelog-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = StripeLog -``` - -Vea la descripción detallada del [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) consulta. - -## Escribir los datos {#table_engines-stripelog-writing-the-data} - -El `StripeLog` el motor almacena todas las columnas en un archivo. Para cada `INSERT` consulta, ClickHouse agrega el bloque de datos al final de un archivo de tabla, escribiendo columnas una por una. - -Para cada tabla, ClickHouse escribe los archivos: - -- `data.bin` — Data file. -- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. - -El `StripeLog` el motor no soporta el `ALTER UPDATE` y `ALTER DELETE` operación. - -## Lectura de los datos {#table_engines-stripelog-reading-the-data} - -El archivo con marcas permite ClickHouse paralelizar la lectura de datos. Esto significa que un `SELECT` query devuelve filas en un orden impredecible. Utilice el `ORDER BY` cláusula para ordenar filas. - -## Ejemplo de uso {#table_engines-stripelog-example-of-use} - -Creación de una tabla: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -Insertar datos: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -Se utilizaron dos `INSERT` consultas para crear dos bloques de datos dentro del `data.bin` file. - -ClickHouse usa múltiples subprocesos al seleccionar datos. Cada subproceso lee un bloque de datos separado y devuelve las filas resultantes de forma independiente a medida que termina. Como resultado, el orden de los bloques de filas en la salida no coincide con el orden de los mismos bloques en la entrada en la mayoría de los casos. Por ejemplo: - -``` sql -SELECT * FROM stripe_log_table -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -┌───────────timestamp─┬─message_type─┬─message───────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -└─────────────────────┴──────────────┴───────────────────────────┘ -``` - -Ordenación de los resultados (orden ascendente por defecto): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/es/engines/table_engines/log_family/tinylog.md b/docs/es/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index a082d47e272..00000000000 --- a/docs/es/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 34 -toc_title: TinyLog ---- - -# TinyLog {#tinylog} - -El motor pertenece a la familia de motores de registro. Ver [Familia del motor de registro](log_family.md) para las propiedades comunes de los motores de registro y sus diferencias. - -Este motor de tablas se usa normalmente con el método write-once: escribir datos una vez, luego leerlos tantas veces como sea necesario. Por ejemplo, puede usar `TinyLog`-type tablas para datos intermedios que se procesan en pequeños lotes. Tenga en cuenta que el almacenamiento de datos en un gran número de tablas pequeñas es ineficiente. - -Las consultas se ejecutan en una sola secuencia. En otras palabras, este motor está diseñado para tablas relativamente pequeñas (hasta aproximadamente 1,000,000 filas). Tiene sentido usar este motor de tablas si tiene muchas tablas pequeñas, ya que es más simple que el [Registro](log.md) motor (menos archivos necesitan ser abiertos). - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/es/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/es/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index 5316c0d5752..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 35 -toc_title: "Agregaci\xF3nMergeTree" ---- - -# Aggregatingmergetree {#aggregatingmergetree} - -El motor hereda de [Método de codificación de datos:](mergetree.md#table_engines-mergetree), alterando la lógica para la fusión de partes de datos. ClickHouse reemplaza todas las filas con la misma clave principal (o más exactamente, con la misma [clave de clasificación](mergetree.md)) con una sola fila (dentro de una parte de datos) que almacena una combinación de estados de funciones agregadas. - -Usted puede utilizar `AggregatingMergeTree` tablas para la agregación de datos incrementales, incluidas las vistas materializadas agregadas. - -El motor procesa todas las columnas con [AggregateFunction](../../../sql_reference/data_types/aggregatefunction.md) tipo. - -Es apropiado usar `AggregatingMergeTree` si reduce el número de filas por pedidos. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[TTL expr] -[SETTINGS name=value, ...] -``` - -Para obtener una descripción de los parámetros de solicitud, consulte [descripción de la solicitud](../../../sql_reference/statements/create.md). - -**Cláusulas de consulta** - -Al crear un `AggregatingMergeTree` mesa de la misma [clausula](mergetree.md) se requieren, como al crear un `MergeTree` tabla. - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -Todos los parámetros tienen el mismo significado que en `MergeTree`. -
- -## SELECCIONAR e INSERTAR {#select-and-insert} - -Para insertar datos, utilice [INSERT SELECT](../../../sql_reference/statements/insert_into.md) consulta con funciones agregadas -State-. -Al seleccionar datos de `AggregatingMergeTree` mesa, uso `GROUP BY` cláusula y las mismas funciones agregadas que al insertar datos, pero usando `-Merge` sufijo. - -En los resultados de `SELECT` consulta, los valores de `AggregateFunction` tipo tiene representación binaria específica de la implementación para todos los formatos de salida de ClickHouse. Si volcar datos en, por ejemplo, `TabSeparated` formato con `SELECT` consulta entonces este volcado se puede cargar de nuevo usando `INSERT` consulta. - -## Ejemplo de una vista materializada agregada {#example-of-an-aggregated-materialized-view} - -`AggregatingMergeTree` vista materializada que mira el `test.visits` tabla: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -Insertar datos en el `test.visits` tabla. - -``` sql -INSERT INTO test.visits ... -``` - -Los datos se insertan tanto en la tabla como en la vista `test.basic` que realizará la agregación. - -Para obtener los datos agregados, necesitamos ejecutar una consulta como `SELECT ... GROUP BY ...` de la vista `test.basic`: - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/es/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/es/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index 7c9b87cc814..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 36 -toc_title: ColapsarMergeTree ---- - -# Colapsarmergetree {#table_engine-collapsingmergetree} - -El motor hereda de [Método de codificación de datos:](mergetree.md) y agrega la lógica de las filas que colapsan al algoritmo de fusión de partes de datos. - -`CollapsingMergeTree` elimina de forma asincrónica (colapsa) pares de filas si todos los campos de una clave de ordenación (`ORDER BY`) son equivalentes excepto el campo particular `Sign` que puede tener `1` y `-1` valor. Las filas sin un par se mantienen. Para más detalles, consulte el [Derrumbar](#table_engine-collapsingmergetree-collapsing) sección del documento. - -El motor puede reducir significativamente el volumen de almacenamiento y aumentar la eficiencia de `SELECT` consulta como consecuencia. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Para obtener una descripción de los parámetros de consulta, consulte [descripción de la consulta](../../../sql_reference/statements/create.md). - -**CollapsingMergeTree Parámetros** - -- `sign` — Name of the column with the type of row: `1` es una “state” fila, `-1` es una “cancel” fila. - - Column data type — `Int8`. - -**Cláusulas de consulta** - -Al crear un `CollapsingMergeTree` mesa, la misma [cláusulas de consulta](mergetree.md#table_engine-mergetree-creating-a-table) se requieren, como al crear un `MergeTree` tabla. - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -Todos los parámetros excepto `sign` el mismo significado que en `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` — “state” fila, `-1` — “cancel” fila. - - Column Data Type — `Int8`. - -
- -## Derrumbar {#table_engine-collapsingmergetree-collapsing} - -### Datos {#data} - -Considere la situación en la que necesita guardar datos que cambian continuamente para algún objeto. Parece lógico tener una fila para un objeto y actualizarla en cualquier cambio, pero la operación de actualización es costosa y lenta para DBMS porque requiere la reescritura de los datos en el almacenamiento. Si necesita escribir datos rápidamente, la actualización no es aceptable, pero puede escribir los cambios de un objeto secuencialmente de la siguiente manera. - -Utilice la columna en particular `Sign`. Si `Sign = 1` significa que la fila es un estado de un objeto, llamémoslo “state” fila. Si `Sign = -1` significa la cancelación del estado de un objeto con los mismos atributos, llamémoslo “cancel” fila. - -Por ejemplo, queremos calcular cuántas páginas revisaron los usuarios en algún sitio y cuánto tiempo estuvieron allí. En algún momento escribimos la siguiente fila con el estado de la actividad del usuario: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -En algún momento después registramos el cambio de actividad del usuario y lo escribimos con las siguientes dos filas. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -La primera fila cancela el estado anterior del objeto (usuario). Debe copiar los campos clave de ordenación del estado cancelado exceptuando `Sign`. - -La segunda fila contiene el estado actual. - -Como solo necesitamos el último estado de actividad del usuario, las filas - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -se puede eliminar colapsando el estado no válido (antiguo) de un objeto. `CollapsingMergeTree` hace esto mientras se fusionan las partes de datos. - -Por qué necesitamos 2 filas para cada cambio leído en el [Algoritmo](#table_engine-collapsingmergetree-collapsing-algorithm) apartado. - -**Propiedades peculiares de tal enfoque** - -1. El programa que escribe los datos debe recordar el estado de un objeto para poder cancelarlo. “Cancel” debe contener copias de los campos de clave de ordenación “state” y lo opuesto `Sign`. Aumenta el tamaño inicial de almacenamiento, pero permite escribir los datos rápidamente. -2. Las matrices de largo crecimiento en columnas reducen la eficiencia del motor debido a la carga para escribir. Los datos más sencillos, mayor será la eficiencia. -3. El `SELECT` Los resultados dependen en gran medida de la consistencia del historial de cambios de objetos. Sea preciso al preparar los datos para insertarlos. Puede obtener resultados impredecibles en datos incoherentes, por ejemplo, valores negativos para métricas no negativas, como la profundidad de la sesión. - -### Algoritmo {#table_engine-collapsingmergetree-collapsing-algorithm} - -Cuando ClickHouse combina partes de datos, cada grupo de filas consecutivas tiene la misma clave de ordenación (`ORDER BY`) se reduce a no más de dos filas, una con `Sign = 1` (“state” fila) y otro con `Sign = -1` (“cancel” fila). En otras palabras, las entradas colapsan. - -Para cada parte de datos resultante, ClickHouse guarda: - -1. El primero “cancel” y el último “state” si el número de “state” y “cancel” y la última fila es una “state” fila. - -2. El último “state” fila, si hay más “state” filas que “cancel” filas. - -3. El primero “cancel” fila, si hay más “cancel” filas que “state” filas. - -4. Ninguna de las filas, en todos los demás casos. - -También cuando hay al menos 2 más “state” filas que “cancel” filas, o al menos 2 más “cancel” filas entonces “state” fila, la fusión continúa, pero ClickHouse trata esta situación como un error lógico y la registra en el registro del servidor. Este error puede producirse si se insertan los mismos datos más de una vez. - -Por lo tanto, el colapso no debe cambiar los resultados del cálculo de las estadísticas. -Los cambios colapsaron gradualmente para que al final solo quedara el último estado de casi todos los objetos. - -El `Sign` se requiere porque el algoritmo de fusión no garantiza que todas las filas con la misma clave de clasificación estén en la misma parte de datos resultante e incluso en el mismo servidor físico. Proceso de ClickHouse `SELECT` consultas con múltiples hilos, y no puede predecir el orden de las filas en el resultado. La agregación es necesaria si hay una necesidad de obtener completamente “collapsed” datos de `CollapsingMergeTree` tabla. - -Para finalizar el colapso, escriba una consulta con `GROUP BY` cláusula y funciones agregadas que representan el signo. Por ejemplo, para calcular la cantidad, use `sum(Sign)` en lugar de `count()`. Para calcular la suma de algo, use `sum(Sign * x)` en lugar de `sum(x)` y así sucesivamente, y también añadir `HAVING sum(Sign) > 0`. - -Los agregados `count`, `sum` y `avg` podría calcularse de esta manera. El agregado `uniq` podría calcularse si un objeto tiene al menos un estado no colapsado. Los agregados `min` y `max` no se pudo calcular porque `CollapsingMergeTree` no guarda el historial de valores de los estados colapsados. - -Si necesita extraer datos sin agregación (por ejemplo, para comprobar si hay filas presentes cuyos valores más recientes coinciden con ciertas condiciones), puede utilizar el `FINAL` modificador para el `FROM` clausula. Este enfoque es significativamente menos eficiente. - -## Ejemplo de uso {#example-of-use} - -Datos de ejemplo: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Creación de la tabla: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Inserción de los datos: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -Usamos dos `INSERT` consultas para crear dos partes de datos diferentes. Si insertamos los datos con una consulta, ClickHouse crea una parte de datos y nunca realizará ninguna fusión. - -Obtener los datos: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -¿qué vemos y dónde está colapsando? - -Con dos `INSERT` consultas, hemos creado 2 partes de datos. El `SELECT` la consulta se realizó en 2 hilos, y obtuvimos un orden aleatorio de filas. No se ha producido un colapso porque todavía no se había fusionado las partes de datos. ClickHouse fusiona parte de datos en un momento desconocido que no podemos predecir. - -Por lo tanto, necesitamos agregación: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -Si no necesitamos agregación y queremos forzar el colapso, podemos usar `FINAL` modificador para `FROM` clausula. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Esta forma de seleccionar los datos es muy ineficiente. No lo use para mesas grandes. - -## Ejemplo de otro enfoque {#example-of-another-approach} - -Datos de ejemplo: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ -5 │ -146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -La idea es que las fusiones tengan en cuenta solo los campos clave. Y en el “Cancel” línea podemos especificar valores negativos que igualan la versión anterior de la fila al sumar sin usar la columna Sign. Para este enfoque, es necesario cambiar el tipo de datos `PageViews`,`Duration` para almacenar valores negativos de UInt8 -\> Int16. - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews Int16, - Duration Int16, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Vamos a probar el enfoque: - -``` sql -insert into UAct values(4324182021466249494, 5, 146, 1); -insert into UAct values(4324182021466249494, -5, -146, -1); -insert into UAct values(4324182021466249494, 6, 185, 1); - -select * from UAct final; // avoid using final in production (just for a test or small tables) -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -``` sql -SELECT - UserID, - sum(PageViews) AS PageViews, - sum(Duration) AS Duration -FROM UAct -GROUP BY UserID -```text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -``` sqk -select count() FROM UAct -``` - -``` text -┌─count()─┐ -│ 3 │ -└─────────┘ -``` - -``` sql -optimize table UAct final; - -select * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/es/engines/table_engines/mergetree_family/custom_partitioning_key.md b/docs/es/engines/table_engines/mergetree_family/custom_partitioning_key.md deleted file mode 100644 index e97e26545b9..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 32 -toc_title: "Clave de partici\xF3n personalizada" ---- - -# Clave de partición personalizada {#custom-partitioning-key} - -La partición está disponible para el [Método de codificación de datos:](mergetree.md) mesas familiares (incluyendo [repetición](replication.md) tabla). [Vistas materializadas](../special/materializedview.md) basado en tablas MergeTree soporte de particionamiento, también. - -Una partición es una combinación lógica de registros en una tabla por un criterio especificado. Puede establecer una partición por un criterio arbitrario, como por mes, por día o por tipo de evento. Cada partición se almacena por separado para simplificar las manipulaciones de estos datos. Al acceder a los datos, ClickHouse utiliza el subconjunto más pequeño de particiones posible. - -La partición se especifica en el `PARTITION BY expr` cláusula cuando [creando una tabla](mergetree.md#table_engine-mergetree-creating-a-table). La clave de partición puede ser cualquier expresión de las columnas de la tabla. Por ejemplo, para especificar la partición por mes, utilice la expresión `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour; -``` - -La clave de partición también puede ser una tupla de expresiones (similar a la [clave primaria](mergetree.md#primary-keys-and-indexes-in-queries)). Por ejemplo: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -En este ejemplo, establecemos la partición por los tipos de eventos que se produjeron durante la semana actual. - -Al insertar datos nuevos en una tabla, estos datos se almacenan como una parte separada (porción) ordenada por la clave principal. En 10-15 minutos después de insertar, las partes de la misma partición se fusionan en toda la parte. - -!!! info "INFO" - Una combinación solo funciona para partes de datos que tienen el mismo valor para la expresión de partición. Esto significa **no deberías hacer particiones demasiado granulares** (más de un millar de particiones). De lo contrario, el `SELECT` consulta funciona mal debido a un número excesivamente grande de archivos en el sistema de archivos y descriptores de archivos abiertos. - -Utilice el [sistema.parte](../../../operations/system_tables.md#system_tables-parts) tabla para ver las partes y particiones de la tabla. Por ejemplo, supongamos que tenemos un `visits` tabla con partición por mes. Vamos a realizar el `SELECT` consulta para el `system.parts` tabla: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 1 │ -│ 201902 │ 201902_11_11_0 │ 1 │ -└───────────┴────────────────┴────────┘ -``` - -El `partition` columna contiene los nombres de las particiones. Hay dos particiones en este ejemplo: `201901` y `201902`. Puede utilizar este valor de columna para especificar el nombre de partición en [ALTER … PARTITION](#alter_manipulations-with-partitions) consulta. - -El `name` columna contiene los nombres de las partes de datos de partición. Puede utilizar esta columna para especificar el nombre de la pieza [ALTER ATTACH PART](#alter_attach-partition) consulta. - -Vamos a desglosar el nombre de la primera parte: `201901_1_3_1`: - -- `201901` es el nombre de la partición. -- `1` es el número mínimo del bloque de datos. -- `3` es el número máximo del bloque de datos. -- `1` es el nivel de fragmento (la profundidad del árbol de fusión del que se forma). - -!!! info "INFO" - Las partes de las tablas de tipo antiguo tienen el nombre: `20190117_20190123_2_2_0` (fecha mínima - fecha máxima - número de bloque mínimo - número de bloque máximo - nivel). - -El `active` columna muestra el estado de la pieza. `1` está activo; `0` está inactivo. Las partes inactivas son, por ejemplo, las partes de origen que quedan después de fusionarse con una parte más grande. Las partes de datos dañadas también se indican como inactivas. - -Como puede ver en el ejemplo, hay varias partes separadas de la misma partición (por ejemplo, `201901_1_3_1` y `201901_1_9_2`). Esto significa que estas partes aún no están fusionadas. ClickHouse combina las partes insertadas de datos periódicamente, aproximadamente 15 minutos después de la inserción. Además, puede realizar una fusión no programada utilizando el [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) consulta. Ejemplo: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 0 │ -│ 201902 │ 201902_4_11_2 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 0 │ -│ 201902 │ 201902_11_11_0 │ 0 │ -└───────────┴────────────────┴────────┘ -``` - -Las partes inactivas se eliminarán aproximadamente 10 minutos después de la fusión. - -Otra forma de ver un conjunto de partes y particiones es ir al directorio de la tabla: `/var/lib/clickhouse/data///`. Por ejemplo: - -``` bash -/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -Carpeta ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ y así sucesivamente son los directorios de las partes. Cada parte se relaciona con una partición correspondiente y contiene datos solo para un mes determinado (la tabla de este ejemplo tiene particiones por mes). - -El `detached` el directorio contiene partes que se separaron de la tabla utilizando el [DETACH](#alter_detach-partition) consulta. Las partes dañadas también se mueven a este directorio, en lugar de eliminarse. El servidor no utiliza las piezas del `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql_reference/statements/alter.md#alter_attach-partition) consulta. - -Tenga en cuenta que en el servidor operativo, no puede cambiar manualmente el conjunto de piezas o sus datos en el sistema de archivos, ya que el servidor no lo sabrá. Para tablas no replicadas, puede hacer esto cuando se detiene el servidor, pero no se recomienda. Para tablas replicadas, el conjunto de piezas no se puede cambiar en ningún caso. - -ClickHouse le permite realizar operaciones con las particiones: eliminarlas, copiar de una tabla a otra o crear una copia de seguridad. Consulte la lista de todas las operaciones en la sección [Manipulaciones con particiones y piezas](../../../sql_reference/statements/alter.md#alter_manipulations-with-partitions). - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/es/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/es/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index f326b594d6a..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 38 -toc_title: GraphiteMergeTree ---- - -# Graphitemergetree {#graphitemergetree} - -Este motor está diseñado para el adelgazamiento y la agregación / promedio (rollup) [Grafito](http://graphite.readthedocs.io/en/latest/index.html) datos. Puede ser útil para los desarrolladores que desean usar ClickHouse como almacén de datos para Graphite. - -Puede usar cualquier motor de tabla ClickHouse para almacenar los datos de Graphite si no necesita un paquete acumulativo, pero si necesita un paquete acumulativo, use `GraphiteMergeTree`. El motor reduce el volumen de almacenamiento y aumenta la eficiencia de las consultas de Graphite. - -El motor hereda propiedades de [Método de codificación de datos:](mergetree.md). - -## Creación de una tabla {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Vea una descripción detallada del [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) consulta. - -Una tabla para los datos de grafito debe tener las siguientes columnas para los siguientes datos: - -- Nombre métrico (sensor de grafito). Tipo de datos: `String`. - -- Tiempo de medición de la métrica. Tipo de datos: `DateTime`. - -- Valor de la métrica. Tipo de datos: cualquier numérico. - -- Versión de la métrica. Tipo de datos: cualquier numérico. - - ClickHouse guarda las filas con la versión más alta o la última escrita si las versiones son las mismas. Otras filas se eliminan durante la fusión de partes de datos. - -Los nombres de estas columnas deben establecerse en la configuración acumulativa. - -**GraphiteMergeTree parámetros** - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -**Cláusulas de consulta** - -Al crear un `GraphiteMergeTree` mesa, la misma [clausula](mergetree.md#table_engine-mergetree-creating-a-table) se requieren, como al crear un `MergeTree` tabla. - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -Todos los parámetros excepto `config_section` el mismo significado que en `MergeTree`. - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -
- -## Configuración acumulativa {#rollup-configuration} - -La configuración del paquete acumulativo está definida por [graphite\_rollup](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) parámetro en la configuración del servidor. El nombre del parámetro podría ser cualquiera. Puede crear varias configuraciones y usarlas para diferentes tablas. - -Estructura de configuración Rollup: - - required-columns - patterns - -### Columnas requeridas {#required-columns} - -- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. -- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. -- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Valor predeterminado: `Value`. -- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. - -### Patrón {#patterns} - -Estructura del `patterns` apartado: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "Atención" - Los patrones deben ser estrictamente ordenados: - - 1. Patterns without `function` or `retention`. - 1. Patterns with both `function` and `retention`. - 1. Pattern `default`. - -Al procesar una fila, ClickHouse comprueba las reglas en el `pattern` apartado. Cada uno de `pattern` (incluir `default` secciones pueden contener `function` parámetro para la agregación, `retention` parámetros o ambos. Si el nombre de la métrica coincide con `regexp`, las reglas de la `pattern` sección (o secciones); de lo contrario, las reglas de la `default` sección se utilizan. - -Campos para `pattern` y `default` apartado: - -- `regexp`– A pattern for the metric name. -- `age` – The minimum age of the data in seconds. -- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). -- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. - -### Ejemplo de configuración {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/es/engines/table_engines/mergetree_family/mergetree.md b/docs/es/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index c7261eec0cc..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,654 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 30 -toc_title: "M\xE9todo de codificaci\xF3n de datos:" ---- - -# Mergetree {#table_engines-mergetree} - -El `MergeTree` motor y otros motores de esta familia (`*MergeTree`) son los motores de mesa ClickHouse más robustos. - -Motores en el `MergeTree` familia están diseñados para insertar una gran cantidad de datos en una tabla. Los datos se escriben rápidamente en la tabla parte por parte, luego se aplican reglas para fusionar las partes en segundo plano. Este método es mucho más eficiente que reescribir continuamente los datos en almacenamiento durante la inserción. - -Principales características: - -- Almacena datos ordenados por clave principal. - - Esto le permite crear un pequeño índice disperso que ayuda a encontrar datos más rápido. - -- Las particiones se pueden utilizar si [clave de partición](custom_partitioning_key.md) se especifica. - - ClickHouse admite ciertas operaciones con particiones que son más efectivas que las operaciones generales en los mismos datos con el mismo resultado. ClickHouse también corta automáticamente los datos de partición donde se especifica la clave de partición en la consulta. Esto también mejora el rendimiento de las consultas. - -- Soporte de replicación de datos. - - La familia de `ReplicatedMergeTree` proporciona la replicación de datos. Para obtener más información, consulte [Replicación de datos](replication.md). - -- Soporte de muestreo de datos. - - Si es necesario, puede establecer el método de muestreo de datos en la tabla. - -!!! info "INFO" - El [Fusionar](../special/merge.md) el motor no pertenece al `*MergeTree` familia. - -## Creación de una tabla {#table_engine-mergetree-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 -) ENGINE = MergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] -[SETTINGS name=value, ...] -``` - -Para obtener una descripción de los parámetros, consulte [Descripción de la consulta CREATE](../../../sql_reference/statements/create.md). - -!!! note "Nota" - `INDEX` es una característica experimental, ver [Índices de saltos de datos](#table_engine-mergetree-data_skipping-indexes). - -### Cláusulas de consulta {#mergetree-query-clauses} - -- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. El `MergeTree` el motor no tiene parámetros. - -- `PARTITION BY` — The [clave de partición](custom_partitioning_key.md). - - Para particionar por mes, utilice el `toYYYYMM(date_column)` expresión, donde `date_column` es una columna con una fecha del tipo [Fecha](../../../sql_reference/data_types/date.md). Los nombres de partición aquí tienen el `"YYYYMM"` formato. - -- `ORDER BY` — The sorting key. - - Una tupla de columnas o expresiones arbitrarias. Ejemplo: `ORDER BY (CounterID, EventDate)`. - -- `PRIMARY KEY` — The primary key if it [difiere de la clave de clasificación](#choosing-a-primary-key-that-differs-from-the-sorting-key). - - De forma predeterminada, la clave principal es la misma que la clave de ordenación (que se especifica `ORDER BY` clausula). Por lo tanto, en la mayoría de los casos no es necesario especificar un `PRIMARY KEY` clausula. - -- `SAMPLE BY` — An expression for sampling. - - Si se utiliza una expresión de muestreo, la clave principal debe contenerla. Ejemplo: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. - -- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [entre discos y volúmenes](#table_engine-mergetree-multiple-volumes). - - La expresión debe tener una `Date` o `DateTime` columna como resultado. Ejemplo: - `TTL date + INTERVAL 1 DAY` - - Tipo de regla `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` especifica una acción que debe realizarse con la pieza si la expresión está satisfecha (alcanza la hora actual): eliminación de filas caducadas, mover una pieza (si la expresión está satisfecha para todas las filas de una pieza) al disco especificado (`TO DISK 'xxx'`) o al volumen (`TO VOLUME 'xxx'`). El tipo predeterminado de la regla es la eliminación (`DELETE`). Se puede especificar una lista de varias reglas, pero no debe haber más de una `DELETE` regla. - - Para obtener más información, consulte [TTL para columnas y tablas](#table_engine-mergetree-ttl) - -- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: - - - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Almacenamiento de datos](#mergetree-data-storage). - - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Almacenamiento de datos](#mergetree-data-storage). - - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` configuración. Antes de la versión 19.11, sólo existía el `index_granularity` ajuste para restringir el tamaño del gránulo. El `index_granularity_bytes` mejora el rendimiento de ClickHouse al seleccionar datos de tablas con filas grandes (decenas y cientos de megabytes). Si tiene tablas con filas grandes, puede habilitar esta configuración para que las tablas mejoren la eficiencia de `SELECT` consulta. - - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, entonces ZooKeeper almacena menos datos. Para obtener más información, consulte [descripción del ajuste](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) en “Server configuration parameters”. - - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` bytes, ClickHouse lee y escribe los datos en el disco de almacenamiento utilizando la interfaz de E / S directa (`O_DIRECT` opcion). Si `min_merge_bytes_to_use_direct_io = 0`, entonces la E/S directa está deshabilitada. Valor predeterminado: `10 * 1024 * 1024 * 1024` byte. - - - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). - - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don't turn it off. - - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. - - `storage_policy` — Storage policy. See [Uso de varios dispositivos de bloque para el almacenamiento de datos](#table_engine-mergetree-multiple-volumes). - -**Ejemplo de configuración de secciones** - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 -``` - -En el ejemplo, configuramos la partición por mes. - -También establecemos una expresión para el muestreo como un hash por el ID de usuario. Esto le permite pseudoaleatorizar los datos en la tabla para cada `CounterID` y `EventDate`. Si define un [SAMPLE](../../../sql_reference/statements/select.md#select-sample-clause) cláusula al seleccionar los datos, ClickHouse devolverá una muestra de datos pseudoaleatoria uniforme para un subconjunto de usuarios. - -El `index_granularity` se puede omitir porque 8192 es el valor predeterminado. - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No utilice este método en nuevos proyectos. Si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -**Parámetros MergeTree()** - -- `date-column` — The name of a column of the [Fecha](../../../sql_reference/data_types/date.md) tipo. ClickHouse crea automáticamente particiones por mes en función de esta columna. Los nombres de partición están en el `"YYYYMM"` formato. -- `sampling_expression` — An expression for sampling. -- `(primary, key)` — Primary key. Type: [Tupla()](../../../sql_reference/data_types/tuple.md) -- `index_granularity` — The granularity of an index. The number of data rows between the “marks” de un índice. El valor 8192 es apropiado para la mayoría de las tareas. - -**Ejemplo** - -``` sql -MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) -``` - -El `MergeTree` engine se configura de la misma manera que en el ejemplo anterior para el método de configuración del motor principal. -
- -## Almacenamiento de datos {#mergetree-data-storage} - -Una tabla consta de partes de datos ordenadas por clave principal. - -Cuando se insertan datos en una tabla, se crean partes de datos separadas y cada una de ellas se ordena lexicográficamente por clave principal. Por ejemplo, si la clave principal es `(CounterID, Date)`, los datos en la parte se ordenan por `CounterID`, y dentro de cada `CounterID` es ordenado por `Date`. - -Los datos que pertenecen a diferentes particiones se separan en diferentes partes. En el fondo, ClickHouse combina partes de datos para un almacenamiento más eficiente. Las piezas que pertenecen a particiones diferentes no se fusionan. El mecanismo de combinación no garantiza que todas las filas con la misma clave principal estén en la misma parte de datos. - -Cada parte de datos se divide lógicamente en gránulos. Un gránulo es el conjunto de datos indivisibles más pequeño que ClickHouse lee al seleccionar datos. ClickHouse no divide filas o valores, por lo que cada gránulo siempre contiene un número entero de filas. La primera fila de un gránulo está marcada con el valor de la clave principal de la fila. Para cada parte de datos, ClickHouse crea un archivo de índice que almacena las marcas. Para cada columna, ya sea en la clave principal o no, ClickHouse también almacena las mismas marcas. Estas marcas le permiten encontrar datos directamente en archivos de columnas. - -El tamaño del gránulo es restringido por `index_granularity` y `index_granularity_bytes` configuración del motor de tabla. El número de filas en un gránulo se encuentra en el `[1, index_granularity]` rango, dependiendo del tamaño de las filas. El tamaño de un gránulo puede exceder `index_granularity_bytes` si el tamaño de una sola fila es mayor que el valor de la configuración. En este caso, el tamaño del gránulo es igual al tamaño de la fila. - -## Claves e índices principales en consultas {#primary-keys-and-indexes-in-queries} - -Tome el `(CounterID, Date)` clave primaria como ejemplo. En este caso, la clasificación y el índice se pueden ilustrar de la siguiente manera: - - Whole data: [---------------------------------------------] - CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] - Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] - Marks: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 - Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 - -Si la consulta de datos especifica: - -- `CounterID in ('a', 'h')`, el servidor lee los datos en los rangos de marcas `[0, 3)` y `[6, 8)`. -- `CounterID IN ('a', 'h') AND Date = 3`, el servidor lee los datos en los rangos de marcas `[1, 3)` y `[7, 8)`. -- `Date = 3`, el servidor lee los datos en el rango de marcas `[1, 10]`. - -Los ejemplos anteriores muestran que siempre es más efectivo usar un índice que un análisis completo. - -Un índice disperso permite leer datos adicionales. Al leer un único rango de la clave primaria, hasta `index_granularity * 2` se pueden leer filas adicionales en cada bloque de datos. - -Los índices dispersos le permiten trabajar con una gran cantidad de filas de tabla, porque en la mayoría de los casos, dichos índices caben en la RAM de la computadora. - -ClickHouse no requiere una clave principal única. Puede insertar varias filas con la misma clave principal. - -### Selección de la clave principal {#selecting-the-primary-key} - -El número de columnas en la clave principal no está explícitamente limitado. Dependiendo de la estructura de datos, puede incluir más o menos columnas en la clave principal. Esto puede: - -- Mejorar el rendimiento de un índice. - - Si la clave principal es `(a, b)`, a continuación, añadir otra columna `c` mejorará el rendimiento si se cumplen las siguientes condiciones: - - - Hay consultas con una condición en la columna `c`. - - Rangos de datos largos (varias veces más `index_granularity`) con valores idénticos para `(a, b)` son comunes. En otras palabras, al agregar otra columna le permite omitir rangos de datos bastante largos. - -- Mejorar la compresión de datos. - - ClickHouse ordena los datos por clave principal, por lo que cuanto mayor sea la consistencia, mejor será la compresión. - -- Proporcione una lógica adicional al fusionar partes de datos en el [ColapsarMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) y [SummingMergeTree](summingmergetree.md) motor. - - En este caso tiene sentido especificar el *clave de clasificación* que es diferente de la clave principal. - -Una clave principal larga afectará negativamente al rendimiento de la inserción y al consumo de memoria, pero las columnas adicionales de la clave principal no afectarán al rendimiento de ClickHouse durante `SELECT` consulta. - -### Elegir una clave principal que difiere de la clave de ordenación {#choosing-a-primary-key-that-differs-from-the-sorting-key} - -Es posible especificar una clave principal (una expresión con valores que se escriben en el archivo de índice para cada marca) que es diferente de la clave de ordenación (una expresión para ordenar las filas en partes de datos). En este caso, la tupla de expresión de clave primaria debe ser un prefijo de la tupla de expresión de clave de ordenación. - -Esta característica es útil cuando se [SummingMergeTree](summingmergetree.md) y -[AgregaciónMergeTree](aggregatingmergetree.md) motores de mesa. En un caso común cuando se utilizan estos motores, la tabla tiene dos tipos de columnas: *cota* y *medida*. Las consultas típicas agregan valores de columnas de medida con `GROUP BY` y filtrado por dimensiones. Debido a que SummingMergeTree y AggregatingMergeTree agregan filas con el mismo valor de la clave de ordenación, es natural agregarle todas las dimensiones. Como resultado, la expresión de clave consta de una larga lista de columnas y esta lista debe actualizarse con frecuencia con las dimensiones recién agregadas. - -En este caso, tiene sentido dejar solo unas pocas columnas en la clave principal que proporcionarán análisis de rango eficientes y agregarán las columnas de dimensión restantes a la tupla de clave de clasificación. - -[ALTER](../../../sql_reference/statements/alter.md) de la clave de ordenación es una operación ligera porque cuando se agrega una nueva columna simultáneamente a la tabla y a la clave de ordenación, las partes de datos existentes no necesitan ser cambiadas. Dado que la clave de ordenación anterior es un prefijo de la nueva clave de ordenación y no hay datos en la columna recién agregada, los datos se ordenan tanto por las claves de ordenación antiguas como por las nuevas en el momento de la modificación de la tabla. - -### Uso de índices y particiones en consultas {#use-of-indexes-and-partitions-in-queries} - -Para `SELECT` consultas, ClickHouse analiza si se puede usar un índice. Se puede usar un índice si el `WHERE/PREWHERE` clause tiene una expresión (como uno de los elementos de conjunción, o enteramente) que representa una operación de comparación de igualdad o desigualdad, o si tiene `IN` o `LIKE` con un prefijo fijo en columnas o expresiones que están en la clave principal o clave de partición, o en ciertas funciones parcialmente repetitivas de estas columnas, o relaciones lógicas de estas expresiones. - -Por lo tanto, es posible ejecutar rápidamente consultas en uno o varios rangos de la clave principal. En este ejemplo, las consultas serán rápidas cuando se ejecuten para una etiqueta de seguimiento específica, para una etiqueta y un intervalo de fechas específicos, para una etiqueta y una fecha específicas, para varias etiquetas con un intervalo de fechas, etc. - -Veamos el motor configurado de la siguiente manera: - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 - -En este caso, en consultas: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -ClickHouse utilizará el índice de clave principal para recortar datos incorrectos y la clave de partición mensual para recortar particiones que están en intervalos de fechas incorrectos. - -Las consultas anteriores muestran que el índice se usa incluso para expresiones complejas. La lectura de la tabla está organizada de modo que el uso del índice no puede ser más lento que un escaneo completo. - -En el siguiente ejemplo, el índice no se puede usar. - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -Para comprobar si ClickHouse puede usar el índice al ejecutar una consulta, use la configuración [Fecha de nacimiento](../../../operations/settings/settings.md#settings-force_index_by_date) y [force\_primary\_key](../../../operations/settings/settings.md). - -La clave para particionar por mes permite leer solo aquellos bloques de datos que contienen fechas del rango adecuado. En este caso, el bloque de datos puede contener datos para muchas fechas (hasta un mes). Dentro de un bloque, los datos se ordenan por clave principal, que puede no contener la fecha como la primera columna. Debido a esto, el uso de una consulta con solo una condición de fecha que no especifica el prefijo de clave principal hará que se lean más datos que para una sola fecha. - -### Uso del índice para claves primarias parcialmente monotónicas {#use-of-index-for-partially-monotonic-primary-keys} - -Considere, por ejemplo, los días del mes. Ellos forman un [monótona secuencia](https://en.wikipedia.org/wiki/Monotonic_function) durante un mes, pero no monótono durante períodos más prolongados. Esta es una secuencia parcialmente monotónica. Si un usuario crea la tabla con clave primaria parcialmente monótona, ClickHouse crea un índice disperso como de costumbre. Cuando un usuario selecciona datos de este tipo de tabla, ClickHouse analiza las condiciones de consulta. Si el usuario desea obtener datos entre dos marcas del índice y ambas marcas caen dentro de un mes, ClickHouse puede usar el índice en este caso particular porque puede calcular la distancia entre los parámetros de una consulta y las marcas de índice. - -ClickHouse no puede usar un índice si los valores de la clave principal en el rango de parámetros de consulta no representan una secuencia monotónica. En este caso, ClickHouse utiliza el método de análisis completo. - -ClickHouse usa esta lógica no solo para secuencias de días del mes, sino para cualquier clave principal que represente una secuencia parcialmente monotónica. - -### Índices de saltos de datos (experimental) {#table_engine-mergetree-data_skipping-indexes} - -La declaración de índice se encuentra en la sección de columnas del `CREATE` consulta. - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -Para tablas de la `*MergeTree` familia, se pueden especificar índices de omisión de datos. - -Estos índices agregan cierta información sobre la expresión especificada en bloques, que consisten en `granularity_value` gránulos (el tamaño del gránulo se especifica utilizando el `index_granularity` ajuste en el motor de la tabla). Entonces estos agregados se usan en `SELECT` consultas para reducir la cantidad de datos a leer desde el disco omitiendo grandes bloques de datos donde el `where` consulta no puede ser satisfecha. - -**Ejemplo** - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -ClickHouse puede utilizar los índices del ejemplo para reducir la cantidad de datos que se leen desde el disco en las siguientes consultas: - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### Tipos de índices disponibles {#available-types-of-indices} - -- `minmax` - - Almacena los extremos de la expresión especificada (si la expresión `tuple`, entonces almacena extremos para cada elemento de `tuple`), utiliza información almacenada para omitir bloques de datos como la clave principal. - -- `set(max_rows)` - - Almacena valores únicos de la expresión especificada (no más de `max_rows` filas, `max_rows=0` medio “no limits”). Utiliza los valores para comprobar si `WHERE` expresión no es satisfactorio en un bloque de datos. - -- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - Tiendas a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) que contiene todos los ngrams de un bloque de datos. Funciona solo con cadenas. Puede ser utilizado para la optimización de `equals`, `like` y `in` expresiones. - - - `n` — ngram size, - - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). - - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. - - `random_seed` — The seed for Bloom filter hash functions. - -- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - Lo mismo que `ngrambf_v1`, pero almacena tokens en lugar de ngrams. Los tokens son secuencias separadas por caracteres no alfanuméricos. - -- `bloom_filter([false_positive])` — Stores a [Filtro de floración](https://en.wikipedia.org/wiki/Bloom_filter) para las columnas especificadas. - - Opcional `false_positive` parámetro es la probabilidad de recibir una respuesta falsa positiva del filtro. Valores posibles: (0, 1). Valor predeterminado: 0.025. - - Tipos de datos admitidos: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. - - Las siguientes funciones pueden usarlo: [igual](../../../sql_reference/functions/comparison_functions.md), [notEquals](../../../sql_reference/functions/comparison_functions.md), [en](../../../sql_reference/functions/in_functions.md), [noEn](../../../sql_reference/functions/in_functions.md), [tener](../../../sql_reference/functions/array_functions.md). - - - -``` sql -INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 -INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 -``` - -#### Funciones de apoyo {#functions-support} - -Condiciones en el `WHERE` cláusula contiene llamadas de las funciones que operan con columnas. Si la columna forma parte de un índice, ClickHouse intenta usar este índice al realizar las funciones. ClickHouse admite diferentes subconjuntos de funciones para usar índices. - -El `set` index se puede utilizar con todas las funciones. Subconjuntos de funciones para otros índices se muestran en la siguiente tabla. - -| Función (operador) / Índice | clave primaria | minmax | Descripción | Sistema abierto. | bloom\_filter | -|----------------------------------------------------------------------------------------------------------|----------------|--------|-------------|------------------|---------------| -| [igual (=, ==)](../../../sql_reference/functions/comparison_functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notEquals(!=, \<\>)](../../../sql_reference/functions/comparison_functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [como](../../../sql_reference/functions/string_search_functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [No como](../../../sql_reference/functions/string_search_functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [Comienza con](../../../sql_reference/functions/string_functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [Finaliza con](../../../sql_reference/functions/string_functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [multiSearchAny](../../../sql_reference/functions/string_search_functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | -| [en](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [noEn](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [menos (\<)](../../../sql_reference/functions/comparison_functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [mayor (\>)](../../../sql_reference/functions/comparison_functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [menosOrEquals (\<=)](../../../sql_reference/functions/comparison_functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [mayorOrEquals (\>=)](../../../sql_reference/functions/comparison_functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [vaciar](../../../sql_reference/functions/array_functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [notEmpty](../../../sql_reference/functions/array_functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | - -Las funciones con un argumento constante que es menor que el tamaño de ngram no pueden ser utilizadas por `ngrambf_v1` para la optimización de consultas. - -Los filtros Bloom pueden tener coincidencias falsas positivas, por lo que `ngrambf_v1`, `tokenbf_v1`, y `bloom_filter` los índices no se pueden usar para optimizar consultas donde se espera que el resultado de una función sea falso, por ejemplo: - -- Puede ser optimizado: - - `s LIKE '%test%'` - - `NOT s NOT LIKE '%test%'` - - `s = 1` - - `NOT s != 1` - - `startsWith(s, 'test')` -- No se puede optimizar: - - `NOT s LIKE '%test%'` - - `s NOT LIKE '%test%'` - - `NOT s = 1` - - `s != 1` - - `NOT startsWith(s, 'test')` - -## Acceso a datos simultáneos {#concurrent-data-access} - -Para el acceso simultáneo a tablas, usamos versiones múltiples. En otras palabras, cuando una tabla se lee y actualiza simultáneamente, los datos se leen de un conjunto de partes que está actualizado en el momento de la consulta. No hay cerraduras largas. Las inserciones no se interponen en el camino de las operaciones de lectura. - -La lectura de una tabla se paralela automáticamente. - -## TTL para columnas y tablas {#table_engine-mergetree-ttl} - -Determina la duración de los valores. - -El `TTL` se puede establecer para toda la tabla y para cada columna individual. TTL de nivel de tabla también puede especificar la lógica de movimiento automático de datos entre discos y volúmenes. - -Las expresiones deben evaluar [Fecha](../../../sql_reference/data_types/date.md) o [FechaHora](../../../sql_reference/data_types/datetime.md) tipo de datos. - -Ejemplo: - -``` sql -TTL time_column -TTL time_column + interval -``` - -Definir `interval`, utilizar [intervalo de tiempo](../../../sql_reference/operators.md#operators-datetime) operador. - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### Columna TTL {#mergetree-column-ttl} - -Cuando los valores de la columna caducan, ClickHouse los reemplaza con los valores predeterminados para el tipo de datos de columna. Si todos los valores de columna en la parte de datos caducan, ClickHouse elimina esta columna de la parte de datos en un sistema de archivos. - -El `TTL` cláusula no se puede utilizar para columnas clave. - -Ejemplos: - -Creación de una tabla con TTL - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -Adición de TTL a una columna de una tabla existente - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -Modificación de TTL de la columna - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### Tabla TTL {#mergetree-table-ttl} - -La tabla puede tener una expresión para la eliminación de filas caducadas y varias expresiones para el movimiento automático de partes entre [discos o volúmenes](#table_engine-mergetree-multiple-volumes). Cuando las filas de la tabla caducan, ClickHouse elimina todas las filas correspondientes. Para la entidad de movimiento de piezas, todas las filas de una pieza deben cumplir los criterios de expresión de movimiento. - -``` sql -TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... -``` - -El tipo de regla TTL puede seguir cada expresión TTL. Afecta a una acción que debe realizarse una vez que se satisface la expresión (alcanza la hora actual): - -- `DELETE` - Eliminar filas caducadas (acción predeterminada); -- `TO DISK 'aaa'` - mover parte al disco `aaa`; -- `TO VOLUME 'bbb'` - mover parte al disco `bbb`. - -Ejemplos: - -Creación de una tabla con TTL - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH [DELETE], - d + INTERVAL 1 WEEK TO VOLUME 'aaa', - d + INTERVAL 2 WEEK TO DISK 'bbb'; -``` - -Modificación de TTL de la tabla - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**Eliminación de datos** - -Los datos con un TTL caducado se eliminan cuando ClickHouse fusiona partes de datos. - -Cuando ClickHouse ve que los datos han caducado, realiza una combinación fuera de programación. Para controlar la frecuencia de tales fusiones, puede establecer [Método de codificación de datos:](#mergetree_setting-merge_with_ttl_timeout). Si el valor es demasiado bajo, realizará muchas fusiones fuera de horario que pueden consumir muchos recursos. - -Si realiza el `SELECT` consulta entre fusiones, puede obtener datos caducados. Para evitarlo, use el [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) consulta antes `SELECT`. - -## Uso de múltiples dispositivos de bloque para el almacenamiento de datos {#table_engine-mergetree-multiple-volumes} - -### Implantación {#introduction} - -`MergeTree` Los motores de tablas familiares pueden almacenar datos en múltiples dispositivos de bloque. Por ejemplo, puede ser útil cuando los datos de una determinada tabla se dividen implícitamente en “hot” y “cold”. Los datos más recientes se solicitan regularmente, pero solo requieren una pequeña cantidad de espacio. Por el contrario, los datos históricos de cola gorda se solicitan raramente. Si hay varios discos disponibles, el “hot” los datos pueden estar ubicados en discos rápidos (por ejemplo, SSD NVMe o en memoria), mientras que “cold” datos - en los relativamente lentos (por ejemplo, HDD). - -La parte de datos es la unidad móvil mínima para `MergeTree`-mesas de motor. Los datos que pertenecen a una parte se almacenan en un disco. Las partes de datos se pueden mover entre discos en segundo plano (según la configuración del usuario) así como por medio de la [ALTER](../../../sql_reference/statements/alter.md#alter_move-partition) consulta. - -### Plazo {#terms} - -- Disk — Block device mounted to the filesystem. -- Default disk — Disk that stores the path specified in the [camino](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) configuración del servidor. -- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). -- Storage policy — Set of volumes and the rules for moving data between them. - -Los nombres dados a las entidades descritas se pueden encontrar en las tablas del sistema, [sistema.almacenamiento\_policies](../../../operations/system_tables.md#system_tables-storage_policies) y [sistema.disco](../../../operations/system_tables.md#system_tables-disks). Para aplicar una de las directivas de almacenamiento configuradas para una tabla, `storage_policy` establecimiento de `MergeTree`-motor de la familia de las tablas. - -### Configuración {#table_engine-mergetree-multiple-volumes-configure} - -Discos, volúmenes y políticas de almacenamiento deben ser declaradas dentro de la `` etiqueta ya sea en el archivo principal `config.xml` o en un archivo distinto en el `config.d` directorio. - -Configuración de la estructura: - -``` xml - - - - /mnt/fast_ssd/clickhouse/ - - - /mnt/hdd1/clickhouse/ - 10485760 - - - /mnt/hdd2/clickhouse/ - 10485760 - - - ... - - - ... - -``` - -Tags: - -- `` — Disk name. Names must be different for all disks. -- `path` — path under which a server will store data (`data` y `shadow` carpetas), debe terminarse con ‘/’. -- `keep_free_space_bytes` — the amount of free disk space to be reserved. - -El orden de la definición del disco no es importante. - -Marcado de configuración de directivas de almacenamiento: - -``` xml - - ... - - - - - disk_name_from_disks_configuration - 1073741824 - - - - - - - 0.2 - - - - - - - - ... - -``` - -Tags: - -- `policy_name_N` — Policy name. Policy names must be unique. -- `volume_name_N` — Volume name. Volume names must be unique. -- `disk` — a disk within a volume. -- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume's disks. -- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). - -Cofiguration ejemplos: - -``` xml - - ... - - - - - disk1 - disk2 - - - - - - - - fast_ssd - 1073741824 - - - disk1 - - - 0.2 - - - ... - -``` - -En un ejemplo dado, el `hdd_in_order` implementa la política de [Ronda-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) enfoque. Por lo tanto esta política define un sólo volumen (`single`), las partes de datos se almacenan en todos sus discos en orden circular. Dicha política puede ser bastante útil si hay varios discos similares montados en el sistema, pero RAID no está configurado. Tenga en cuenta que cada unidad de disco individual no es confiable y es posible que desee compensarlo con un factor de replicación de 3 o más. - -Si hay diferentes tipos de discos disponibles en el sistema, `moving_from_ssd_to_hdd` la política puede ser utilizado en su lugar. Volumen `hot` consta de un disco SSD (`fast_ssd`), y el tamaño máximo de una parte que puede ser almacenado en este volumen es de 1GB. Todas las piezas con el tamaño de más de 1GB se almacenan directamente en el `cold` volumen, que contiene un disco duro `disk1`. -Además, una vez que el disco `fast_ssd` se llena en más del 80%, los datos se transferirán al `disk1` por un proceso en segundo plano. - -El orden de enumeración de volúmenes dentro de una directiva de almacenamiento es importante. Una vez que un volumen está sobrellenado, los datos se mueven al siguiente. El orden de la enumeración del disco también es importante porque los datos se almacenan en ellos por turnos. - -Al crear una tabla, se puede aplicarle una de las directivas de almacenamiento configuradas: - -``` sql -CREATE TABLE table_with_non_default_policy ( - EventDate Date, - OrderID UInt64, - BannerID UInt64, - SearchPhrase String -) ENGINE = MergeTree -ORDER BY (OrderID, BannerID) -PARTITION BY toYYYYMM(EventDate) -SETTINGS storage_policy = 'moving_from_ssd_to_hdd' -``` - -El `default` política de almacenamiento implica el uso de un solo volumen, que consiste en un solo disco dado en ``. Una vez que se crea una tabla, no se puede cambiar su política de almacenamiento. - -### Detalles {#details} - -En el caso de `MergeTree` tablas, los datos están llegando al disco de diferentes maneras: - -- Como resultado de un inserto (`INSERT` consulta). -- Durante las fusiones de fondo y [mutación](../../../sql_reference/statements/alter.md#alter-mutations). -- Al descargar desde otra réplica. -- Como resultado de la congelación de particiones [ALTER TABLE … FREEZE PARTITION](../../../sql_reference/statements/alter.md#alter_freeze-partition). - -En todos estos casos, excepto las mutaciones y la congelación de particiones, una pieza se almacena en un volumen y un disco de acuerdo con la política de almacenamiento dada: - -1. El primer volumen (en el orden de definición) que tiene suficiente espacio en disco para almacenar una pieza (`unreserved_space > current_part_size`) y permite almacenar partes de un tamaño determinado (`max_data_part_size_bytes > current_part_size`) se elige. -2. Dentro de este volumen, se elige ese disco que sigue al que se utilizó para almacenar el fragmento de datos anterior y que tiene espacio libre más que el tamaño de la pieza (`unreserved_space - keep_free_space_bytes > current_part_size`). - -Bajo el capó, las mutaciones y la congelación de particiones hacen uso de [enlaces duros](https://en.wikipedia.org/wiki/Hard_link). Los enlaces duros entre diferentes discos no son compatibles, por lo tanto, en tales casos las partes resultantes se almacenan en los mismos discos que los iniciales. - -En el fondo, las partes se mueven entre volúmenes en función de la cantidad de espacio libre (`move_factor` parámetro) según el orden en que se declaran los volúmenes en el archivo de configuración. -Los datos nunca se transfieren desde el último y al primero. Uno puede usar tablas del sistema [sistema.part\_log](../../../operations/system_tables.md#system_tables-part-log) (campo `type = MOVE_PART`) y [sistema.parte](../../../operations/system_tables.md#system_tables-parts) (campo `path` y `disk`) para monitorear el fondo se mueve. Además, la información detallada se puede encontrar en los registros del servidor. - -El usuario puede forzar el movimiento de una pieza o una partición de un volumen a otro mediante la consulta [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql_reference/statements/alter.md#alter_move-partition), todas las restricciones para las operaciones en segundo plano se tienen en cuenta. La consulta inicia un movimiento por sí misma y no espera a que se completen las operaciones en segundo plano. El usuario recibirá un mensaje de error si no hay suficiente espacio libre disponible o si no se cumple alguna de las condiciones requeridas. - -Mover datos no interfiere con la replicación de datos. Por lo tanto, se pueden especificar diferentes directivas de almacenamiento para la misma tabla en diferentes réplicas. - -Después de la finalización de las fusiones y mutaciones de fondo, las partes viejas se eliminan solo después de un cierto período de tiempo (`old_parts_lifetime`). -Durante este tiempo, no se mueven a otros volúmenes o discos. Por lo tanto, hasta que finalmente se retira, se tomará en cuenta para la evaluación de los ocupados de espacio en disco. - -[Artículo Original](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/es/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/es/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index 09aa311d9c6..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 33 -toc_title: ReplacingMergeTree ---- - -# Replacingmergetree {#replacingmergetree} - -El motor difiere de [Método de codificación de datos:](mergetree.md#table_engines-mergetree) en que elimina las entradas duplicadas con el mismo valor de clave principal (o más exactamente, con el mismo [clave de clasificación](mergetree.md) valor). - -La desduplicación de datos solo se produce durante una fusión. La fusión ocurre en segundo plano en un momento desconocido, por lo que no puede planificarla. Algunos de los datos pueden permanecer sin procesar. Aunque puede ejecutar una fusión no programada utilizando el `OPTIMIZE` consulta, no cuente con usarlo, porque el `OPTIMIZE` consulta leerá y escribirá una gran cantidad de datos. - -Así, `ReplacingMergeTree` es adecuado para borrar datos duplicados en segundo plano para ahorrar espacio, pero no garantiza la ausencia de duplicados. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Para obtener una descripción de los parámetros de solicitud, consulte [descripción de la solicitud](../../../sql_reference/statements/create.md). - -**ReplacingMergeTree Parámetros** - -- `ver` — column with version. Type `UInt*`, `Date` o `DateTime`. Parámetro opcional. - - Al fusionar, `ReplacingMergeTree` de todas las filas con la misma clave primaria deja solo una: - - - Último en la selección, si `ver` no establecido. - - Con la versión máxima, si `ver` indicado. - -**Cláusulas de consulta** - -Al crear un `ReplacingMergeTree` mesa de la misma [clausula](mergetree.md) se requieren, como al crear un `MergeTree` tabla. - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -Todos los parámetros excepto `ver` el mismo significado que en `MergeTree`. - -- `ver` - columna con la versión. Parámetro opcional. Para una descripción, vea el texto anterior. - -
- -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/es/engines/table_engines/mergetree_family/replication.md b/docs/es/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index c84014225d0..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 31 -toc_title: "Replicaci\xF3n de datos" ---- - -# Replicación de datos {#table_engines-replication} - -La replicación solo se admite para tablas de la familia MergeTree: - -- ReplicatedMergeTree -- ReplicatedSummingMergeTree -- ReplicatedReplacingMergeTree -- ReplicatedAggregatingMergeTree -- ReplicatedCollapsingMergeTree -- ReplicatedVersionedCollapsingMergetree -- ReplicatedGraphiteMergeTree - -La replicación funciona a nivel de una tabla individual, no de todo el servidor. Un servidor puede almacenar tablas replicadas y no replicadas al mismo tiempo. - -La replicación no depende de la fragmentación. Cada fragmento tiene su propia replicación independiente. - -Datos comprimidos para `INSERT` y `ALTER` se replica (para obtener más información, consulte la documentación para [ALTER](../../../sql_reference/statements/alter.md#query_language_queries_alter)). - -`CREATE`, `DROP`, `ATTACH`, `DETACH` y `RENAME` las consultas se ejecutan en un único servidor y no se replican: - -- El `CREATE TABLE` query crea una nueva tabla replicable en el servidor donde se ejecuta la consulta. Si esta tabla ya existe en otros servidores, agrega una nueva réplica. -- El `DROP TABLE` query elimina la réplica ubicada en el servidor donde se ejecuta la consulta. -- El `RENAME` query cambia el nombre de la tabla en una de las réplicas. En otras palabras, las tablas replicadas pueden tener diferentes nombres en diferentes réplicas. - -Uso de ClickHouse [Apache ZooKeeper](https://zookeeper.apache.org) para almacenar metainformación de réplicas. Utilice ZooKeeper versión 3.4.5 o posterior. - -Para utilizar la replicación, establezca los parámetros [Zookeeper](../../../operations/server_configuration_parameters/settings.md#server-settings_zookeeper) sección de configuración del servidor. - -!!! attention "Atención" - No descuides la configuración de seguridad. ClickHouse soporta el `digest` [Esquema de ACL](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) del subsistema de seguridad ZooKeeper. - -Ejemplo de configuración de las direcciones del clúster ZooKeeper: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -Puede especificar cualquier clúster ZooKeeper existente y el sistema utilizará un directorio en él para sus propios datos (el directorio se especifica al crear una tabla replicable). - -Si ZooKeeper no está establecido en el archivo de configuración, no puede crear tablas replicadas y las tablas replicadas existentes serán de solo lectura. - -ZooKeeper no se utiliza en `SELECT` consultas porque la replicación no afecta al rendimiento de `SELECT` y las consultas se ejecutan tan rápido como lo hacen para las tablas no replicadas. Al consultar tablas replicadas distribuidas, el comportamiento de ClickHouse se controla mediante la configuración [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) y [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). - -Para cada `INSERT` consulta, aproximadamente diez entradas se agregan a ZooKeeper a través de varias transacciones. (Para ser más precisos, esto es para cada bloque de datos insertado; una consulta INSERT contiene un bloque o un bloque por `max_insert_block_size = 1048576` filas.) Esto conduce a latencias ligeramente más largas para `INSERT` en comparación con las tablas no replicadas. Pero si sigue las recomendaciones para insertar datos en lotes de no más de uno `INSERT` por segundo, no crea ningún problema. Todo el clúster ClickHouse utilizado para coordinar un clúster ZooKeeper tiene un total de varios cientos `INSERTs` por segundo. El rendimiento en las inserciones de datos (el número de filas por segundo) es tan alto como para los datos no replicados. - -Para clústeres muy grandes, puede usar diferentes clústeres de ZooKeeper para diferentes fragmentos. Sin embargo, esto no ha demostrado ser necesario en el Yandex.Clúster Metrica (aproximadamente 300 servidores). - -La replicación es asíncrona y multi-master. `INSERT` consultas (así como `ALTER`) se puede enviar a cualquier servidor disponible. Los datos se insertan en el servidor donde se ejecuta la consulta y, a continuación, se copian a los demás servidores. Debido a que es asincrónico, los datos insertados recientemente aparecen en las otras réplicas con cierta latencia. Si parte de las réplicas no está disponible, los datos se escriben cuando estén disponibles. Si hay una réplica disponible, la latencia es la cantidad de tiempo que tarda en transferir el bloque de datos comprimidos a través de la red. - -De forma predeterminada, una consulta INSERT espera la confirmación de la escritura de los datos de una sola réplica. Si los datos fue correctamente escrito a sólo una réplica y el servidor con esta réplica deja de existir, los datos almacenados se perderán. Para habilitar la confirmación de las escrituras de datos de varias réplicas, utilice `insert_quorum` opcion. - -Cada bloque de datos se escribe atómicamente. La consulta INSERT se divide en bloques hasta `max_insert_block_size = 1048576` filas. En otras palabras, si el `INSERT` consulta tiene menos de 1048576 filas, se hace atómicamente. - -Los bloques de datos se deduplican. Para varias escrituras del mismo bloque de datos (bloques de datos del mismo tamaño que contienen las mismas filas en el mismo orden), el bloque solo se escribe una vez. La razón de esto es en caso de fallas de red cuando la aplicación cliente no sabe si los datos se escribieron en la base de datos, por lo que `INSERT` consulta simplemente se puede repetir. No importa a qué réplica se enviaron los INSERT con datos idénticos. `INSERTs` son idempotentes. Los parámetros de desduplicación son controlados por [merge\_tree](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-merge_tree) configuración del servidor. - -Durante la replicación, sólo los datos de origen que se van a insertar se transfieren a través de la red. La transformación de datos adicional (fusión) se coordina y se realiza en todas las réplicas de la misma manera. Esto minimiza el uso de la red, lo que significa que la replicación funciona bien cuando las réplicas residen en centros de datos diferentes. (Tenga en cuenta que la duplicación de datos en diferentes centros de datos es el objetivo principal de la replicación.) - -Puede tener cualquier número de réplicas de los mismos datos. El Yandex.Metrica utiliza doble replicación en producción. Cada servidor utiliza RAID-5 o RAID-6, y RAID-10 en algunos casos. Esta es una solución relativamente confiable y conveniente. - -El sistema supervisa la sincronicidad de los datos en las réplicas y puede recuperarse después de un fallo. La conmutación por error es automática (para pequeñas diferencias en los datos) o semiautomática (cuando los datos difieren demasiado, lo que puede indicar un error de configuración). - -## Creación de tablas replicadas {#creating-replicated-tables} - -El `Replicated` prefijo se agrega al nombre del motor de tabla. Por ejemplo:`ReplicatedMergeTree`. - -**Replicated\*MergeTree parámetros** - -- `zoo_path` — The path to the table in ZooKeeper. -- `replica_name` — The replica name in ZooKeeper. - -Ejemplo: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -
- -Ejemplo en sintaxis obsoleta - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -
- -Como muestra el ejemplo, estos parámetros pueden contener sustituciones entre llaves. Los valores sustituidos se toman de la ‘macros’ sección del archivo de configuración. Ejemplo: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -La ruta de acceso a la tabla en ZooKeeper debe ser única para cada tabla replicada. Las tablas en diferentes fragmentos deben tener rutas diferentes. -En este caso, la ruta consta de las siguientes partes: - -`/clickhouse/tables/` es el prefijo común. Recomendamos usar exactamente este. - -`{layer}-{shard}` es el identificador de fragmento. En este ejemplo consta de dos partes, ya que el Yandex.Metrica clúster utiliza sharding de dos niveles. Para la mayoría de las tareas, puede dejar solo la sustitución {shard}, que se expandirá al identificador de fragmento. - -`table_name` es el nombre del nodo de la tabla en ZooKeeper. Es una buena idea hacerlo igual que el nombre de la tabla. Se define explícitamente, porque a diferencia del nombre de la tabla, no cambia después de una consulta RENAME. -*HINT*: podría agregar un nombre de base de datos delante de `table_name` También. Nivel de Cifrado WEP `db_name.table_name` - -El nombre de réplica identifica diferentes réplicas de la misma tabla. Puede usar el nombre del servidor para esto, como en el ejemplo. El nombre solo tiene que ser único dentro de cada fragmento. - -Puede definir los parámetros explícitamente en lugar de utilizar sustituciones. Esto podría ser conveniente para probar y para configurar clústeres pequeños. Sin embargo, no puede usar consultas DDL distribuidas (`ON CLUSTER` en este caso. - -Cuando se trabaja con clústeres grandes, se recomienda utilizar sustituciones porque reducen la probabilidad de error. - -Ejecute el `CREATE TABLE` consulta en cada réplica. Esta consulta crea una nueva tabla replicada o agrega una nueva réplica a una existente. - -Si agrega una nueva réplica después de que la tabla ya contenga algunos datos en otras réplicas, los datos se copiarán de las otras réplicas a la nueva después de ejecutar la consulta. En otras palabras, la nueva réplica se sincroniza con las demás. - -Para eliminar una réplica, ejecute `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. - -## Recuperación después de fallos {#recovery-after-failures} - -Si ZooKeeper no está disponible cuando se inicia un servidor, las tablas replicadas cambian al modo de solo lectura. El sistema intenta conectarse periódicamente a ZooKeeper. - -Si ZooKeeper no está disponible durante un `INSERT`, o se produce un error al interactuar con ZooKeeper, se produce una excepción. - -Después de conectarse a ZooKeeper, el sistema comprueba si el conjunto de datos en el sistema de archivos local coincide con el conjunto de datos esperado (ZooKeeper almacena esta información). Si hay incoherencias menores, el sistema las resuelve sincronizando datos con las réplicas. - -Si el sistema detecta partes de datos rotas (con un tamaño incorrecto de archivos) o partes no reconocidas (partes escritas en el sistema de archivos pero no grabadas en ZooKeeper), las mueve al `detached` subdirectorio (no se eliminan). Las piezas que faltan se copian de las réplicas. - -Tenga en cuenta que ClickHouse no realiza ninguna acción destructiva, como eliminar automáticamente una gran cantidad de datos. - -Cuando el servidor se inicia (o establece una nueva sesión con ZooKeeper), solo verifica la cantidad y el tamaño de todos los archivos. Si los tamaños de los archivos coinciden pero los bytes se han cambiado en algún punto intermedio, esto no se detecta inmediatamente, sino solo cuando se intenta leer los datos `SELECT` consulta. La consulta produce una excepción sobre una suma de comprobación no coincidente o el tamaño de un bloque comprimido. En este caso, las partes de datos se agregan a la cola de verificación y se copian de las réplicas si es necesario. - -Si el conjunto local de datos difiere demasiado del esperado, se activa un mecanismo de seguridad. El servidor ingresa esto en el registro y se niega a iniciarse. La razón de esto es que este caso puede indicar un error de configuración, como si una réplica en un fragmento se configurara accidentalmente como una réplica en un fragmento diferente. Sin embargo, los umbrales para este mecanismo se establecen bastante bajos, y esta situación puede ocurrir durante la recuperación de falla normal. En este caso, los datos se restauran semiautomáticamente, mediante “pushing a button”. - -Para iniciar la recuperación, cree el nodo `/path_to_table/replica_name/flags/force_restore_data` en ZooKeeper con cualquier contenido, o ejecute el comando para restaurar todas las tablas replicadas: - -``` bash -sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -A continuación, reinicie el servidor. Al iniciar, el servidor elimina estos indicadores e inicia la recuperación. - -## Recuperación después de la pérdida completa de datos {#recovery-after-complete-data-loss} - -Si todos los datos y metadatos desaparecieron de uno de los servidores, siga estos pasos para la recuperación: - -1. Instale ClickHouse en el servidor. Defina correctamente las sustituciones en el archivo de configuración que contiene el identificador de fragmento y las réplicas, si las usa. -2. Si tenía tablas no duplicadas que deben duplicarse manualmente en los servidores, copie sus datos desde una réplica (en el directorio `/var/lib/clickhouse/data/db_name/table_name/`). -3. Copiar definiciones de tablas ubicadas en `/var/lib/clickhouse/metadata/` de una réplica. Si un identificador de fragmento o réplica se define explícitamente en las definiciones de tabla, corríjalo para que corresponda a esta réplica. (Como alternativa, inicie el servidor y `ATTACH TABLE` consultas que deberían haber estado en el .sql archivos en `/var/lib/clickhouse/metadata/`.) -4. Para iniciar la recuperación, cree el nodo ZooKeeper `/path_to_table/replica_name/flags/force_restore_data` con cualquier contenido o ejecute el comando para restaurar todas las tablas replicadas: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -Luego inicie el servidor (reinicie, si ya se está ejecutando). Los datos se descargarán de las réplicas. - -Una opción de recuperación alternativa es eliminar información sobre la réplica perdida de ZooKeeper (`/path_to_table/replica_name`), luego vuelva a crear la réplica como se describe en “[Creación de tablas replicadas](#creating-replicated-tables)”. - -No hay restricción en el ancho de banda de la red durante la recuperación. Tenga esto en cuenta si está restaurando muchas réplicas a la vez. - -## La Conversión De Mergetree A Replicatedmergetree {#converting-from-mergetree-to-replicatedmergetree} - -Usamos el término `MergeTree` para referirse a todos los motores de mesa en el `MergeTree family`, lo mismo que para `ReplicatedMergeTree`. - -Si usted tenía un `MergeTree` tabla replicada manualmente, puede convertirla en una tabla replicada. Es posible que tenga que hacer esto si ya ha recopilado una gran cantidad de datos `MergeTree` y ahora desea habilitar la replicación. - -Si los datos difieren en varias réplicas, primero sincronícelos o elimínelos en todas las réplicas, excepto en una. - -Cambie el nombre de la tabla MergeTree existente y, a continuación, cree un `ReplicatedMergeTree` mesa con el antiguo nombre. -Mueva los datos de la tabla antigua a la `detached` subdirectorio dentro del directorio con los nuevos datos de la tabla (`/var/lib/clickhouse/data/db_name/table_name/`). -Luego ejecuta `ALTER TABLE ATTACH PARTITION` en una de las réplicas para agregar estas partes de datos al conjunto de trabajo. - -## La Conversión De Replicatedmergetree A Mergetree {#converting-from-replicatedmergetree-to-mergetree} - -Cree una tabla MergeTree con un nombre diferente. Mueva todos los datos del directorio con el `ReplicatedMergeTree` datos de la tabla al directorio de datos de la nueva tabla. A continuación, elimine el `ReplicatedMergeTree` y reinicie el servidor. - -Si desea deshacerse de un `ReplicatedMergeTree` sin iniciar el servidor: - -- Eliminar el correspondiente `.sql` archivo en el directorio de metadatos (`/var/lib/clickhouse/metadata/`). -- Eliminar la ruta correspondiente en ZooKeeper (`/path_to_table/replica_name`). - -Después de esto, puede iniciar el servidor, crear un `MergeTree` tabla, mueva los datos a su directorio y, a continuación, reinicie el servidor. - -## Recuperación cuando los metadatos en el clúster de Zookeeper se pierden o se dañan {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} - -Si los datos de ZooKeeper se perdieron o se dañaron, puede guardar los datos moviéndolos a una tabla no duplicada como se describió anteriormente. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/es/engines/table_engines/mergetree_family/summingmergetree.md b/docs/es/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index 1e3241938f3..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 34 -toc_title: SummingMergeTree ---- - -# Summingmergetree {#summingmergetree} - -El motor hereda de [Método de codificación de datos:](mergetree.md#table_engines-mergetree). La diferencia es que al fusionar partes de datos para `SummingMergeTree` ClickHouse reemplaza todas las filas con la misma clave primaria (o más exactamente, con la misma [clave de clasificación](mergetree.md)) con una fila que contiene valores resumidos para las columnas con el tipo de datos numérico. Si la clave de ordenación está compuesta de manera que un solo valor de clave corresponde a un gran número de filas, esto reduce significativamente el volumen de almacenamiento y acelera la selección de datos. - -Recomendamos usar el motor junto con `MergeTree`. Almacenar datos completos en `MergeTree` mesa, y el uso `SummingMergeTree` para el almacenamiento de datos agregados, por ejemplo, al preparar informes. Tal enfoque evitará que pierda datos valiosos debido a una clave primaria compuesta incorrectamente. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = SummingMergeTree([columns]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Para obtener una descripción de los parámetros de solicitud, consulte [descripción de la solicitud](../../../sql_reference/statements/create.md). - -**Parámetros de SummingMergeTree** - -- `columns` - una tupla con los nombres de las columnas donde se resumirán los valores. Parámetro opcional. - Las columnas deben ser de tipo numérico y no deben estar en la clave principal. - - Si `columns` no especificado, ClickHouse resume los valores de todas las columnas con un tipo de datos numérico que no están en la clave principal. - -**Cláusulas de consulta** - -Al crear un `SummingMergeTree` mesa de la misma [clausula](mergetree.md) se requieren, como al crear un `MergeTree` tabla. - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No use este método en proyectos nuevos y, si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) -``` - -Todos los parámetros excepto `columns` el mismo significado que en `MergeTree`. - -- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. - -
- -## Ejemplo de uso {#usage-example} - -Considere la siguiente tabla: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -Insertar datos: - -``` sql -INSERT INTO summtt Values(1,1),(1,2),(2,1) -``` - -ClickHouse puede sumar todas las filas no completamente ([ver abajo](#data-processing)), entonces usamos una función agregada `sum` y `GROUP BY` cláusula en la consulta. - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - -``` text -┌─key─┬─sum(value)─┐ -│ 2 │ 1 │ -│ 1 │ 3 │ -└─────┴────────────┘ -``` - -## Procesamiento de datos {#data-processing} - -Cuando los datos se insertan en una tabla, se guardan tal cual. Clickhouse fusiona las partes insertadas de datos periódicamente y esto es cuando las filas con la misma clave principal se suman y se reemplazan con una para cada parte resultante de los datos. - -ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) una función agregada [resumir()](../../../sql_reference/aggregate_functions/reference.md#agg_function-sum) y `GROUP BY` cláusula se debe utilizar en una consulta como se describe en el ejemplo anterior. - -### Reglas comunes para la suma {#common-rules-for-summation} - -Se resumen los valores de las columnas con el tipo de datos numérico. El conjunto de columnas está definido por el parámetro `columns`. - -Si los valores eran 0 en todas las columnas para la suma, se elimina la fila. - -Si la columna no está en la clave principal y no se resume, se selecciona un valor arbitrario entre los existentes. - -Los valores no se resumen para las columnas de la clave principal. - -### La suma en las columnas de función agregada {#the-summation-in-the-aggregatefunction-columns} - -Para columnas de [Tipo AggregateFunction](../../../sql_reference/data_types/aggregatefunction.md) ClickHouse se comporta como [AgregaciónMergeTree](aggregatingmergetree.md) agregación del motor según la función. - -### Estructuras anidadas {#nested-structures} - -La tabla puede tener estructuras de datos anidadas que se procesan de una manera especial. - -Si el nombre de una tabla anidada termina con `Map` y contiene al menos dos columnas que cumplen los siguientes criterios: - -- la primera columna es numérica `(*Int*, Date, DateTime)` o una cadena `(String, FixedString)`, vamos a llamarlo `key`, -- las otras columnas son aritméticas `(*Int*, Float32/64)`, vamos a llamarlo `(values...)`, - -entonces esta tabla anidada se interpreta como una asignación de `key => (values...)`, y al fusionar sus filas, los elementos de dos conjuntos de datos se fusionan por `key` con una suma de los correspondientes `(values...)`. - -Ejemplos: - -``` text -[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] -[(1, 100)] + [(1, 150)] -> [(1, 250)] -[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] -[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] -``` - -Al solicitar datos, utilice el [sumMap(clave, valor)](../../../sql_reference/aggregate_functions/reference.md) función para la agregación de `Map`. - -Para la estructura de datos anidados, no necesita especificar sus columnas en la tupla de columnas para la suma. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/es/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/es/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index e21ccc842f3..00000000000 --- a/docs/es/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 37 -toc_title: VersionedCollapsingMergeTree ---- - -# Versionedcollapsingmergetree {#versionedcollapsingmergetree} - -Este motor: - -- Permite la escritura rápida de estados de objetos que cambian continuamente. -- Elimina los estados de objetos antiguos en segundo plano. Esto reduce significativamente el volumen de almacenamiento. - -Vea la sección [Derrumbar](#table_engines_versionedcollapsingmergetree) para más detalles. - -El motor hereda de [Método de codificación de datos:](mergetree.md#table_engines-mergetree) y agrega la lógica para colapsar filas al algoritmo para fusionar partes de datos. `VersionedCollapsingMergeTree` tiene el mismo propósito que [ColapsarMergeTree](collapsingmergetree.md) pero usa un algoritmo de colapso diferente que permite insertar los datos en cualquier orden con múltiples hilos. En particular, el `Version` columna ayuda a contraer las filas correctamente, incluso si se insertan en el orden incorrecto. En contraste, `CollapsingMergeTree` sólo permite la inserción estrictamente consecutiva. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Para obtener una descripción de los parámetros de consulta, consulte [descripción de la consulta](../../../sql_reference/statements/create.md). - -**Parámetros del motor** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Name of the column with the type of row: `1` es una “state” fila, `-1` es una “cancel” fila. - - El tipo de datos de columna debe ser `Int8`. - -- `version` — Name of the column with the version of the object state. - - El tipo de datos de columna debe ser `UInt*`. - -**Cláusulas de consulta** - -Al crear un `VersionedCollapsingMergeTree` mesa, la misma [clausula](mergetree.md) se requieren como al crear un `MergeTree` tabla. - -
- -Método obsoleto para crear una tabla - -!!! attention "Atención" - No utilice este método en nuevos proyectos. Si es posible, cambie los proyectos antiguos al método descrito anteriormente. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -Todos los parámetros excepto `sign` y `version` el mismo significado que en `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` es una “state” fila, `-1` es una “cancel” fila. - - Column Data Type — `Int8`. - -- `version` — Name of the column with the version of the object state. - - El tipo de datos de columna debe ser `UInt*`. - -
- -## Derrumbar {#table_engines-versionedcollapsingmergetree} - -### Datos {#data} - -Considere una situación en la que necesite guardar datos que cambien continuamente para algún objeto. Es razonable tener una fila para un objeto y actualizar la fila siempre que haya cambios. Sin embargo, la operación de actualización es costosa y lenta para un DBMS porque requiere volver a escribir los datos en el almacenamiento. La actualización no es aceptable si necesita escribir datos rápidamente, pero puede escribir los cambios en un objeto secuencialmente de la siguiente manera. - -Utilice el `Sign` columna al escribir la fila. Si `Sign = 1` significa que la fila es un estado de un objeto (llamémoslo el “state” fila). Si `Sign = -1` indica la cancelación del estado de un objeto con los mismos atributos (llamémoslo el “cancel” fila). También use el `Version` columna, que debe identificar cada estado de un objeto con un número separado. - -Por ejemplo, queremos calcular cuántas páginas visitaron los usuarios en algún sitio y cuánto tiempo estuvieron allí. En algún momento escribimos la siguiente fila con el estado de la actividad del usuario: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -En algún momento después registramos el cambio de actividad del usuario y lo escribimos con las siguientes dos filas. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -La primera fila cancela el estado anterior del objeto (usuario). Debe copiar todos los campos del estado cancelado excepto `Sign`. - -La segunda fila contiene el estado actual. - -Debido a que solo necesitamos el último estado de actividad del usuario, las filas - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -se puede eliminar, colapsando el estado no válido (antiguo) del objeto. `VersionedCollapsingMergeTree` hace esto mientras fusiona las partes de datos. - -Para averiguar por qué necesitamos dos filas para cada cambio, vea [Algoritmo](#table_engines-versionedcollapsingmergetree-algorithm). - -**Notas sobre el uso** - -1. El programa que escribe los datos debe recordar el estado de un objeto para cancelarlo. El “cancel” cadena debe ser una copia de la “state” con lo opuesto `Sign`. Esto aumenta el tamaño inicial de almacenamiento, pero permite escribir los datos rápidamente. -2. Las matrices de largo crecimiento en columnas reducen la eficiencia del motor debido a la carga para escribir. Cuanto más sencillos sean los datos, mejor será la eficiencia. -3. `SELECT` Los resultados dependen en gran medida de la coherencia del historial de cambios de objetos. Sea preciso al preparar los datos para insertarlos. Puede obtener resultados impredecibles con datos incoherentes, como valores negativos para métricas no negativas, como la profundidad de la sesión. - -### Algoritmo {#table_engines-versionedcollapsingmergetree-algorithm} - -Cuando ClickHouse combina partes de datos, elimina cada par de filas que tienen la misma clave principal y versión y diferentes `Sign`. El orden de las filas no importa. - -Cuando ClickHouse inserta datos, ordena filas por la clave principal. Si el `Version` la columna no está en la clave principal, ClickHouse la agrega a la clave principal implícitamente como el último campo y la usa para ordenar. - -## Selección de datos {#selecting-data} - -ClickHouse no garantiza que todas las filas con la misma clave principal estén en la misma parte de datos resultante o incluso en el mismo servidor físico. Esto es cierto tanto para escribir los datos como para la posterior fusión de las partes de datos. Además, ClickHouse procesa `SELECT` consultas con múltiples subprocesos, y no puede predecir el orden de las filas en el resultado. Esto significa que la agregación es necesaria si hay una necesidad de obtener completamente “collapsed” datos de un `VersionedCollapsingMergeTree` tabla. - -Para finalizar el colapso, escriba una consulta con un `GROUP BY` cláusula y funciones agregadas que representan el signo. Por ejemplo, para calcular la cantidad, use `sum(Sign)` en lugar de `count()`. Para calcular la suma de algo, use `sum(Sign * x)` en lugar de `sum(x)` y agregar `HAVING sum(Sign) > 0`. - -Los agregados `count`, `sum` y `avg` se puede calcular de esta manera. El agregado `uniq` se puede calcular si un objeto tiene al menos un estado no colapsado. Los agregados `min` y `max` no se puede calcular porque `VersionedCollapsingMergeTree` no guarda el historial de valores de estados colapsados. - -Si necesita extraer los datos con “collapsing” pero sin agregación (por ejemplo, para verificar si hay filas presentes cuyos valores más nuevos coinciden con ciertas condiciones), puede usar el `FINAL` modificador para el `FROM` clausula. Este enfoque es ineficiente y no debe usarse con tablas grandes. - -## Ejemplo de uso {#example-of-use} - -Datos de ejemplo: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Creación de la tabla: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -Insertar los datos: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -Usamos dos `INSERT` consultas para crear dos partes de datos diferentes. Si insertamos los datos con una sola consulta, ClickHouse crea una parte de datos y nunca realizará ninguna fusión. - -Obtener los datos: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -¿qué vemos aquí y dónde están las partes colapsadas? -Creamos dos partes de datos usando dos `INSERT` consulta. El `SELECT` la consulta se realizó en dos subprocesos, y el resultado es un orden aleatorio de filas. -No se produjo el colapso porque las partes de datos aún no se han fusionado. ClickHouse fusiona partes de datos en un punto desconocido en el tiempo que no podemos predecir. - -Es por eso que necesitamos agregación: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -Si no necesitamos agregación y queremos forzar el colapso, podemos usar el `FINAL` modificador para el `FROM` clausula. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Esta es una forma muy ineficiente de seleccionar datos. No lo use para mesas grandes. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/es/engines/table_engines/special/dictionary.md b/docs/es/engines/table_engines/special/dictionary.md deleted file mode 100644 index 13e091be699..00000000000 --- a/docs/es/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 35 -toc_title: Diccionario ---- - -# Diccionario {#dictionary} - -El `Dictionary` el motor muestra el [diccionario](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) datos como una tabla ClickHouse. - -Como ejemplo, considere un diccionario de `products` con la siguiente configuración: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -Consultar los datos del diccionario: - -``` sql -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - -``` text -┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ -│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ -└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ -``` - -Puede usar el [dictGet\*](../../../sql_reference/functions/ext_dict_functions.md#ext_dict_functions) función para obtener los datos del diccionario en este formato. - -Esta vista no es útil cuando necesita obtener datos sin procesar o cuando `JOIN` operación. Para estos casos, puede usar el `Dictionary` motor, que muestra los datos del diccionario en una tabla. - -Sintaxis: - -``` sql -CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` -``` - -Ejemplo de uso: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); -``` - - Ok - -Echa un vistazo a lo que hay en la mesa. - -``` sql -select * from products limit 1; -``` - -``` text -┌────product_id─┬─title───────────┐ -│ 152689 │ Some item │ -└───────────────┴─────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/es/engines/table_engines/special/distributed.md b/docs/es/engines/table_engines/special/distributed.md deleted file mode 100644 index ae3ee5991d8..00000000000 --- a/docs/es/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 33 -toc_title: Distribuido ---- - -# Distribuido {#distributed} - -**Las tablas con motor distribuido no almacenan ningún dato por sí mismas**, pero permite el procesamiento de consultas distribuidas en varios servidores. -La lectura se paralela automáticamente. Durante una lectura, se utilizan los índices de tabla en servidores remotos, si los hay. - -El motor distribuido acepta parámetros: - -- el nombre del clúster en el archivo de configuración del servidor - -- el nombre de una base de datos remota - -- el nombre de una tabla remota - -- (opcionalmente) clave de fragmentación - -- nombre de política (opcionalmente), se usará para almacenar archivos temporales para el envío asíncrono - - Ver también: - - - `insert_distributed_sync` configuración - - [Método de codificación de datos:](../mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) para los ejemplos - -Ejemplo: - -``` sql -Distributed(logs, default, hits[, sharding_key[, policy_name]]) -``` - -Los datos se leerán desde todos los servidores ‘logs’ clúster, desde el valor predeterminado.tabla de éxitos ubicada en cada servidor del clúster. -Los datos no solo se leen sino que se procesan parcialmente en los servidores remotos (en la medida en que esto sea posible). -Por ejemplo, para una consulta con GROUP BY, los datos se agregarán en servidores remotos y los estados intermedios de las funciones agregadas se enviarán al servidor solicitante. Luego, los datos se agregarán más. - -En lugar del nombre de la base de datos, puede usar una expresión constante que devuelva una cadena. Por ejemplo: currentDatabase(). - -logs – The cluster name in the server's config file. - -Los clústeres se establecen así: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 1 - 9440 - - - - -``` - -Aquí se define un clúster con el nombre ‘logs’ que consta de dos fragmentos, cada uno de los cuales contiene dos réplicas. -Los fragmentos se refieren a los servidores que contienen diferentes partes de los datos (para leer todos los datos, debe acceder a todos los fragmentos). -Las réplicas están duplicando servidores (para leer todos los datos, puede acceder a los datos en cualquiera de las réplicas). - -Los nombres de clúster no deben contener puntos. - -Los parámetros `host`, `port`, y opcionalmente `user`, `password`, `secure`, `compression` se especifican para cada servidor: -- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn't start. If you change the DNS record, restart the server. -- `port` – The TCP port for messenger activity (‘tcp\_port’ en la configuración, generalmente establecido en 9000). No lo confundas con http\_port. -- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Derechos de acceso](../../../operations/access_rights.md). -- `password` – The password for connecting to a remote server (not masked). Default value: empty string. -- `secure` - Use ssl para la conexión, por lo general también debe definir `port` = 9440. El servidor debe escuchar en 9440 y tener certificados correctos. -- `compression` - Utilice la compresión de datos. Valor predeterminado: true. - -When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing) configuración. -Si no se establece la conexión con el servidor, habrá un intento de conectarse con un breve tiempo de espera. Si la conexión falla, se seleccionará la siguiente réplica, y así sucesivamente para todas las réplicas. Si el intento de conexión falló para todas las réplicas, el intento se repetirá de la misma manera, varias veces. -Esto funciona a favor de la resiliencia, pero no proporciona una tolerancia completa a errores: un servidor remoto podría aceptar la conexión, pero podría no funcionar o funcionar mal. - -Puede especificar solo uno de los fragmentos (en este caso, el procesamiento de consultas debe denominarse remoto, en lugar de distribuido) o hasta cualquier número de fragmentos. En cada fragmento, puede especificar entre una y cualquier número de réplicas. Puede especificar un número diferente de réplicas para cada fragmento. - -Puede especificar tantos clústeres como desee en la configuración. - -Para ver los clústeres, utilice el ‘system.clusters’ tabla. - -El motor distribuido permite trabajar con un clúster como un servidor local. Sin embargo, el clúster es inextensible: debe escribir su configuración en el archivo de configuración del servidor (mejor aún, para todos los servidores del clúster). - -The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don't need to create a Distributed table – use the ‘remote’ función de tabla en su lugar. Vea la sección [Funciones de tabla](../../../sql_reference/table_functions/index.md). - -Hay dos métodos para escribir datos en un clúster: - -Primero, puede definir a qué servidores escribir en qué datos y realizar la escritura directamente en cada fragmento. En otras palabras, realice INSERT en las tablas que la tabla distribuida “looks at”. Esta es la solución más flexible, ya que puede usar cualquier esquema de fragmentación, que podría ser no trivial debido a los requisitos del área temática. Esta es también la solución más óptima ya que los datos se pueden escribir en diferentes fragmentos de forma completamente independiente. - -En segundo lugar, puede realizar INSERT en una tabla distribuida. En este caso, la tabla distribuirá los datos insertados a través de los propios servidores. Para escribir en una tabla distribuida, debe tener un conjunto de claves de fragmentación (el último parámetro). Además, si solo hay un fragmento, la operación de escritura funciona sin especificar la clave de fragmentación, ya que no significa nada en este caso. - -Cada fragmento puede tener un peso definido en el archivo de configuración. Por defecto, el peso es igual a uno. Los datos se distribuyen entre fragmentos en la cantidad proporcional al peso del fragmento. Por ejemplo, si hay dos fragmentos y el primero tiene un peso de 9 mientras que el segundo tiene un peso de 10, el primero se enviará 9 / 19 partes de las filas, y el segundo se enviará 10 / 19. - -Cada fragmento puede tener el ‘internal\_replication’ parámetro definido en el archivo de configuración. - -Si este parámetro se establece en ‘true’, la operación de escritura selecciona la primera réplica en buen estado y escribe datos en ella. Utilice esta alternativa si la tabla Distribuida “looks at” tablas replicadas. En otras palabras, si la tabla donde se escribirán los datos los replicará por sí misma. - -Si se establece en ‘false’ (el valor predeterminado), los datos se escriben en todas las réplicas. En esencia, esto significa que la tabla distribuida replica los datos en sí. Esto es peor que usar tablas replicadas, porque no se verifica la consistencia de las réplicas y, con el tiempo, contendrán datos ligeramente diferentes. - -Para seleccionar el fragmento al que se envía una fila de datos, se analiza la expresión de fragmentación y su resto se toma de dividirlo por el peso total de los fragmentos. La fila se envía al fragmento que corresponde al medio intervalo de los restos de ‘prev\_weight’ a ‘prev\_weights + weight’, donde ‘prev\_weights’ es el peso total de los fragmentos con el número más pequeño, y ‘weight’ es el peso de este fragmento. Por ejemplo, si hay dos fragmentos, y el primero tiene un peso de 9 mientras que el segundo tiene un peso de 10, la fila se enviará al primer fragmento para los restos del rango \[0, 9), y al segundo para los restos del rango \[9, 19). - -La expresión de fragmentación puede ser cualquier expresión de constantes y columnas de tabla que devuelva un entero. Por ejemplo, puede usar la expresión ‘rand()’ para la distribución aleatoria de datos, o ‘UserID’ para la distribución por el resto de dividir la ID del usuario (entonces los datos de un solo usuario residirán en un solo fragmento, lo que simplifica la ejecución de IN y JOIN por los usuarios). Si una de las columnas no se distribuye lo suficientemente uniformemente, puede envolverla en una función hash: intHash64(UserID) . - -Un simple recordatorio de la división es una solución limitada para sharding y no siempre es apropiado. Funciona para volúmenes medianos y grandes de datos (docenas de servidores), pero no para volúmenes muy grandes de datos (cientos de servidores o más). En este último caso, use el esquema de fragmentación requerido por el área asunto, en lugar de usar entradas en Tablas distribuidas. - -SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don't have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. - -Debería preocuparse por el esquema de fragmentación en los siguientes casos: - -- Se utilizan consultas que requieren unir datos (IN o JOIN) mediante una clave específica. Si esta clave fragmenta datos, puede usar IN local o JOIN en lugar de GLOBAL IN o GLOBAL JOIN, que es mucho más eficiente. -- Se usa una gran cantidad de servidores (cientos o más) con una gran cantidad de consultas pequeñas (consultas de clientes individuales: sitios web, anunciantes o socios). Para que las pequeñas consultas no afecten a todo el clúster, tiene sentido ubicar datos para un solo cliente en un solo fragmento. Alternativamente, como lo hemos hecho en Yandex.Metrica, puede configurar sharding de dos niveles: divida todo el clúster en “layers”, donde una capa puede consistir en varios fragmentos. Los datos de un único cliente se encuentran en una sola capa, pero los fragmentos se pueden agregar a una capa según sea necesario y los datos se distribuyen aleatoriamente dentro de ellos. Las tablas distribuidas se crean para cada capa y se crea una única tabla distribuida compartida para consultas globales. - -Los datos se escriben de forma asíncrona. Cuando se inserta en la tabla, el bloque de datos se acaba de escribir en el sistema de archivos local. Los datos se envían a los servidores remotos en segundo plano tan pronto como sea posible. El período de envío de datos está gestionado por el [Distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) y [Distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) configuración. El `Distributed` el motor envía cada archivo con datos insertados por separado, pero puede habilitar el envío por lotes de archivos [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) configuración. Esta configuración mejora el rendimiento del clúster al utilizar mejor los recursos de red y servidor local. Debe comprobar si los datos se envían correctamente comprobando la lista de archivos (datos en espera de ser enviados) en el directorio de la tabla: `/var/lib/clickhouse/data/database/table/`. - -Si el servidor dejó de existir o tuvo un reinicio aproximado (por ejemplo, después de un error de dispositivo) después de un INSERT en una tabla distribuida, es posible que se pierdan los datos insertados. Si se detecta un elemento de datos dañado en el directorio de la tabla, se transfiere al ‘broken’ subdirectorio y ya no se utiliza. - -Cuando la opción max\_parallel\_replicas está habilitada, el procesamiento de consultas se paralela en todas las réplicas dentro de un solo fragmento. Para obtener más información, consulte la sección [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). - -## Virtual Columnas {#virtual-columns} - -- `_shard_num` — Contains the `shard_num` (de `system.clusters`). Tipo: [UInt32](../../../sql_reference/data_types/int_uint.md). - -!!! note "Nota" - Ya [`remote`](../../../sql_reference/table_functions/remote.md)/`cluster` funciones de tabla crean internamente instancia temporal del mismo motor distribuido, `_shard_num` está disponible allí también. - -**Ver también** - -- [Virtual columnas](index.md#table_engines-virtual_columns) - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/es/engines/table_engines/special/external_data.md b/docs/es/engines/table_engines/special/external_data.md deleted file mode 100644 index ad15cf4e7d4..00000000000 --- a/docs/es/engines/table_engines/special/external_data.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 34 -toc_title: Datos externos ---- - -# Datos externos para el procesamiento de consultas {#external-data-for-query-processing} - -ClickHouse permite enviar a un servidor los datos necesarios para procesar una consulta, junto con una consulta SELECT. Estos datos se colocan en una tabla temporal (consulte la sección “Temporary tables”) y se puede utilizar en la consulta (por ejemplo, en operadores IN). - -Por ejemplo, si tiene un archivo de texto con identificadores de usuario importantes, puede cargarlo en el servidor junto con una consulta que utilice la filtración de esta lista. - -Si necesita ejecutar más de una consulta con un gran volumen de datos externos, no utilice esta función. Es mejor cargar los datos a la base de datos con anticipación. - -Los datos externos se pueden cargar mediante el cliente de línea de comandos (en modo no interactivo) o mediante la interfaz HTTP. - -En el cliente de línea de comandos, puede especificar una sección de parámetros en el formato - -``` bash ---external --file=... [--name=...] [--format=...] [--types=...|--structure=...] -``` - -Puede tener varias secciones como esta, para el número de tablas que se transmiten. - -**–external** – Marks the beginning of a clause. -**–file** – Path to the file with the table dump, or -, which refers to stdin. -Solo se puede recuperar una sola tabla de stdin. - -Los siguientes parámetros son opcionales: **–name**– Name of the table. If omitted, \_data is used. -**–format** – Data format in the file. If omitted, TabSeparated is used. - -Se requiere uno de los siguientes parámetros:**–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`. Define los nombres y tipos de columna. - -Los archivos especificados en ‘file’ se analizará mediante el formato especificado en ‘format’ utilizando los tipos de datos especificados en ‘types’ o ‘structure’. La mesa será cargado en el servidor y accesibles, como una tabla temporal con el nombre de ‘name’. - -Ejemplos: - -``` bash -$ echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 -849897 -$ cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -Cuando se utiliza la interfaz HTTP, los datos externos se pasan en el formato multipart/form-data. Cada tabla se transmite como un archivo separado. El nombre de la tabla se toma del nombre del archivo. El ‘query\_string’ se pasa los parámetros ‘name\_format’, ‘name\_types’, y ‘name\_structure’, donde ‘name’ es el nombre de la tabla a la que corresponden estos parámetros. El significado de los parámetros es el mismo que cuando se usa el cliente de línea de comandos. - -Ejemplo: - -``` bash -$ cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv - -$ curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -Para el procesamiento de consultas distribuidas, las tablas temporales se envían a todos los servidores remotos. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/external_data/) diff --git a/docs/es/engines/table_engines/special/file.md b/docs/es/engines/table_engines/special/file.md deleted file mode 100644 index 460e5ae40f5..00000000000 --- a/docs/es/engines/table_engines/special/file.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 37 -toc_title: File ---- - -# File {#table_engines-file} - -El motor de tabla de archivos mantiene los datos en un archivo en uno de los [file -formato](../../../interfaces/formats.md#formats) (TabSeparated, Native, etc.). - -Ejemplos de uso: - -- Exportación de datos de ClickHouse a archivo. -- Convertir datos de un formato a otro. -- Actualización de datos en ClickHouse mediante la edición de un archivo en un disco. - -## Uso en el servidor de Clickhouse {#usage-in-clickhouse-server} - -``` sql -File(Format) -``` - -El `Format` parámetro especifica uno de los formatos de archivo disponibles. Realizar -`SELECT` consultas, el formato debe ser compatible para la entrada, y para realizar -`INSERT` queries – for output. The available formats are listed in the -[Formato](../../../interfaces/formats.md#formats) apartado. - -ClickHouse no permite especificar la ruta del sistema de archivos para`File`. Utilizará la carpeta definida por [camino](../../../operations/server_configuration_parameters/settings.md) configuración en la configuración del servidor. - -Al crear una tabla usando `File(Format)` crea un subdirectorio vacío en esa carpeta. Cuando los datos se escriben en esa tabla, se colocan en `data.Format` en ese subdirectorio. - -Puede crear manualmente esta subcarpeta y archivo en el sistema de archivos del servidor y luego [ATTACH](../../../sql_reference/statements/misc.md) para mostrar información con el nombre coincidente, para que pueda consultar datos desde ese archivo. - -!!! warning "Advertencia" - Tenga cuidado con esta funcionalidad, ya que ClickHouse no realiza un seguimiento de los cambios externos en dichos archivos. El resultado de las escrituras simultáneas a través de ClickHouse y fuera de ClickHouse no está definido. - -**Ejemplo:** - -**1.** Configurar el `file_engine_table` tabla: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -Por defecto, ClickHouse creará una carpeta `/var/lib/clickhouse/data/default/file_engine_table`. - -**2.** Crear manualmente `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` contener: - -``` bash -$ cat data.TabSeparated -one 1 -two 2 -``` - -**3.** Consultar los datos: - -``` sql -SELECT * FROM file_engine_table -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Uso en Clickhouse-local {#usage-in-clickhouse-local} - -En [Sistema abierto.](../../../operations/utilities/clickhouse-local.md) El motor de archivos acepta la ruta del archivo además de `Format`. Los flujos de entrada / salida predeterminados se pueden especificar utilizando nombres numéricos o legibles por humanos como `0` o `stdin`, `1` o `stdout`. -**Ejemplo:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## Detalles de la implementación {#details-of-implementation} - -- Multiple `SELECT` las consultas se pueden realizar simultáneamente, pero `INSERT` las consultas se esperarán entre sí. -- Apoyado la creación de nuevos archivos por `INSERT` consulta. -- Si el archivo existe, `INSERT` añadiría nuevos valores en él. -- No soportado: - - `ALTER` - - `SELECT ... SAMPLE` - - Indice - - Replicación - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/es/engines/table_engines/special/generate.md b/docs/es/engines/table_engines/special/generate.md deleted file mode 100644 index 662eada5f86..00000000000 --- a/docs/es/engines/table_engines/special/generate.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 46 -toc_title: GenerateRandom ---- - -# Generaterandom {#table_engines-generate} - -El motor de tabla GenerateRandom produce datos aleatorios para el esquema de tabla determinado. - -Ejemplos de uso: - -- Se usa en la prueba para poblar una tabla grande reproducible. -- Generar entrada aleatoria para pruebas de fuzzing. - -## Uso en el servidor de Clickhouse {#usage-in-clickhouse-server} - -``` sql -ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) -``` - -El `max_array_length` y `max_string_length` parámetros especifican la longitud máxima de todos -columnas y cadenas de matriz correspondientemente en los datos generados. - -Generar motor de tabla sólo admite `SELECT` consulta. - -Es compatible con todos [Tipos de datos](../../../sql_reference/data_types/index.md) que se pueden almacenar en una tabla excepto `LowCardinality` y `AggregateFunction`. - -**Ejemplo:** - -**1.** Configurar el `generate_engine_table` tabla: - -``` sql -CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) -``` - -**2.** Consultar los datos: - -``` sql -SELECT * FROM generate_engine_table LIMIT 3 -``` - -``` text -┌─name─┬──────value─┐ -│ c4xJ │ 1412771199 │ -│ r │ 1791099446 │ -│ 7#$ │ 124312908 │ -└──────┴────────────┘ -``` - -## Detalles de la implementación {#details-of-implementation} - -- No soportado: - - `ALTER` - - `SELECT ... SAMPLE` - - `INSERT` - - Indice - - Replicación - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/es/engines/table_engines/special/join.md b/docs/es/engines/table_engines/special/join.md deleted file mode 100644 index 031305fc8ef..00000000000 --- a/docs/es/engines/table_engines/special/join.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 40 -toc_title: Unir ---- - -# Unir {#join} - -Estructura de datos preparada para usar en [JOIN](../../../sql_reference/statements/select.md#select-join) operación. - -## Creación de una tabla {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], -) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) -``` - -Vea la descripción detallada del [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) consulta. - -**Parámetros del motor** - -- `join_strictness` – [ÚNETE a la rigurosidad](../../../sql_reference/statements/select.md#select-join-strictness). -- `join_type` – [Tipo de unión](../../../sql_reference/statements/select.md#select-join-types). -- `k1[, k2, ...]` – Key columns from the `USING` cláusula que el `JOIN` operación se hace con. - -Entrar `join_strictness` y `join_type` parámetros sin comillas, por ejemplo, `Join(ANY, LEFT, col1)`. Deben coincidir con el `JOIN` operación para la que se utilizará la tabla. Si los parámetros no coinciden, ClickHouse no lanza una excepción y puede devolver datos incorrectos. - -## Uso de la tabla {#table-usage} - -### Ejemplo {#example} - -Creación de la tabla del lado izquierdo: - -``` sql -CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog -``` - -``` sql -INSERT INTO id_val VALUES (1,11)(2,12)(3,13) -``` - -Creando el lado derecho `Join` tabla: - -``` sql -CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) -``` - -``` sql -INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) -``` - -Unirse a las tablas: - -``` sql -SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 -``` - -``` text -┌─id─┬─val─┬─id_val_join.val─┐ -│ 1 │ 11 │ 21 │ -│ 2 │ 12 │ ᴺᵁᴸᴸ │ -│ 3 │ 13 │ 23 │ -└────┴─────┴─────────────────┘ -``` - -Como alternativa, puede recuperar datos del `Join` tabla, especificando el valor de la clave de unión: - -``` sql -SELECT joinGet('id_val_join', 'val', toUInt32(1)) -``` - -``` text -┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ -│ 21 │ -└────────────────────────────────────────────┘ -``` - -### Selección e inserción de datos {#selecting-and-inserting-data} - -Usted puede utilizar `INSERT` consultas para agregar datos al `Join`-mesas de motor. Si la tabla se creó con el `ANY` estricta, se ignoran los datos de las claves duplicadas. Con el `ALL` estricta, se agregan todas las filas. - -No se puede realizar una `SELECT` consulta directamente desde la tabla. En su lugar, use uno de los siguientes métodos: - -- Coloque la mesa hacia el lado derecho en un `JOIN` clausula. -- Llame al [joinGet](../../../sql_reference/functions/other_functions.md#joinget) función, que le permite extraer datos de la tabla de la misma manera que de un diccionario. - -### Limitaciones y ajustes {#join-limitations-and-settings} - -Al crear una tabla, se aplican los siguientes valores: - -- [Sistema abierto.](../../../operations/settings/settings.md#join_use_nulls) -- [Método de codificación de datos:](../../../operations/settings/query_complexity.md#settings-max_rows_in_join) -- [Método de codificación de datos:](../../../operations/settings/query_complexity.md#settings-max_bytes_in_join) -- [join\_overflow\_mode](../../../operations/settings/query_complexity.md#settings-join_overflow_mode) -- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) - -El `Join`-las tablas del motor no se pueden usar en `GLOBAL JOIN` operación. - -El `Join`-motor permite el uso [Sistema abierto.](../../../operations/settings/settings.md#join_use_nulls) ajuste en el `CREATE TABLE` instrucción. Y [SELECT](../../../sql_reference/statements/select.md) consulta permite el uso `join_use_nulls` demasiado. Si tienes diferentes `join_use_nulls` configuración, puede obtener un error al unirse a la tabla. Depende del tipo de JOIN. Cuando se utiliza [joinGet](../../../sql_reference/functions/other_functions.md#joinget) función, usted tiene que utilizar el mismo `join_use_nulls` ajuste en `CRATE TABLE` y `SELECT` instrucción. - -## Almacenamiento de datos {#data-storage} - -`Join` datos de la tabla siempre se encuentra en la memoria RAM. Al insertar filas en una tabla, ClickHouse escribe bloques de datos en el directorio del disco para que puedan restaurarse cuando se reinicie el servidor. - -Si el servidor se reinicia incorrectamente, el bloque de datos en el disco puede perderse o dañarse. En este caso, es posible que deba eliminar manualmente el archivo con datos dañados. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/es/engines/table_engines/special/materializedview.md b/docs/es/engines/table_engines/special/materializedview.md deleted file mode 100644 index 4960ce2cd80..00000000000 --- a/docs/es/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 43 -toc_title: "M\xE9todo de codificaci\xF3n de datos:" ---- - -# Método de codificación de datos: {#materializedview} - -Se utiliza para implementar vistas materializadas (para obtener más información, consulte [CREATE TABLE](../../../sql_reference/statements/create.md)). Para almacenar datos, utiliza un motor diferente que se especificó al crear la vista. Al leer desde una tabla, solo usa este motor. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/es/engines/table_engines/special/merge.md b/docs/es/engines/table_engines/special/merge.md deleted file mode 100644 index 15b67d2f721..00000000000 --- a/docs/es/engines/table_engines/special/merge.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 36 -toc_title: Fusionar ---- - -# Fusionar {#merge} - -El `Merge` motor (no debe confundirse con `MergeTree`) no almacena datos en sí, pero permite leer de cualquier número de otras tablas simultáneamente. -La lectura se paralela automáticamente. No se admite la escritura en una tabla. Al leer, se usan los índices de las tablas que realmente se están leyendo, si existen. -El `Merge` engine acepta parámetros: el nombre de la base de datos y una expresión regular para las tablas. - -Ejemplo: - -``` sql -Merge(hits, '^WatchLog') -``` - -Los datos se leerán de las tablas en el `hits` base de datos que tienen nombres que coinciden con la expresión regular ‘`^WatchLog`’. - -En lugar del nombre de la base de datos, puede usar una expresión constante que devuelva una cadena. Por ejemplo, `currentDatabase()`. - -Regular expressions — [Re2](https://github.com/google/re2) (soporta un subconjunto de PCRE), sensible a mayúsculas y minúsculas. -Vea las notas sobre los símbolos de escape en expresiones regulares en el “match” apartado. - -Al seleccionar tablas para leer, el `Merge` no se seleccionará la tabla en sí, incluso si coincide con la expresión regular. Esto es para evitar bucles. -Es posible crear dos `Merge` tablas que intentarán interminablemente leer los datos de los demás, pero esta no es una buena idea. - -La forma típica de usar el `Merge` para trabajar con un gran número de `TinyLog` tablas como si con una sola tabla. - -Ejemplo 2: - -Digamos que tiene una tabla antigua (WatchLog\_old) y decidió cambiar la partición sin mover datos a una nueva tabla (WatchLog\_new) y necesita ver datos de ambas tablas. - -``` sql -CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree(date, (UserId, EventType), 8192); -INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - -CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; -INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - -CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - -SELECT * -FROM WatchLog -``` - -``` text -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-01 │ 1 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-02 │ 2 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -``` - -## Virtual Columnas {#virtual-columns} - -- `_table` — Contains the name of the table from which data was read. Type: [Cadena](../../../sql_reference/data_types/string.md). - - Puede establecer las condiciones constantes en `_table` en el `WHERE/PREWHERE` cláusula (por ejemplo, `WHERE _table='xyz'`). En este caso, la operación de lectura se realiza sólo para las tablas donde la condición en `_table` está satisfecho, por lo que el `_table` columna actúa como un índice. - -**Ver también** - -- [Virtual columnas](index.md#table_engines-virtual_columns) - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/es/engines/table_engines/special/url.md b/docs/es/engines/table_engines/special/url.md deleted file mode 100644 index 37c796b15b8..00000000000 --- a/docs/es/engines/table_engines/special/url.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 41 -toc_title: URL ---- - -# URL(URL, Formato) {#table_engines-url} - -Administra datos en un servidor HTTP/HTTPS remoto. Este motor es similar -a la [File](file.md) motor. - -## Uso del motor en el servidor de Clickhouse {#using-the-engine-in-the-clickhouse-server} - -El `format` debe ser uno que ClickHouse pueda usar en -`SELECT` consultas y, si es necesario, en `INSERTs`. Para obtener la lista completa de formatos admitidos, consulte -[Formato](../../../interfaces/formats.md#formats). - -El `URL` debe ajustarse a la estructura de un localizador uniforme de recursos. La dirección URL especificada debe apuntar a un servidor -que utiliza HTTP o HTTPS. Esto no requiere ningún -encabezados adicionales para obtener una respuesta del servidor. - -`INSERT` y `SELECT` las consultas se transforman en `POST` y `GET` peticiones, -respectivamente. Para el procesamiento `POST` solicitudes, el servidor remoto debe admitir -[Codificación de transferencia fragmentada](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). - -Puede limitar el número máximo de saltos de redirección HTTP GET utilizando el [Nombre de la red inalámbrica (SSID):](../../../operations/settings/settings.md#setting-max_http_get_redirects) configuración. - -**Ejemplo:** - -**1.** Crear un `url_engine_table` tabla en el servidor : - -``` sql -CREATE TABLE url_engine_table (word String, value UInt64) -ENGINE=URL('http://127.0.0.1:12345/', CSV) -``` - -**2.** Cree un servidor HTTP básico utilizando las herramientas estándar de Python 3 y -comenzarlo: - -``` python3 -from http.server import BaseHTTPRequestHandler, HTTPServer - -class CSVHTTPServer(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type', 'text/csv') - self.end_headers() - - self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) - -if __name__ == "__main__": - server_address = ('127.0.0.1', 12345) - HTTPServer(server_address, CSVHTTPServer).serve_forever() -``` - -``` bash -$ python3 server.py -``` - -**3.** Solicitar datos: - -``` sql -SELECT * FROM url_engine_table -``` - -``` text -┌─word──┬─value─┐ -│ Hello │ 1 │ -│ World │ 2 │ -└───────┴───────┘ -``` - -## Detalles de la implementación {#details-of-implementation} - -- Las lecturas y escrituras pueden ser paralelas -- No soportado: - - `ALTER` y `SELECT...SAMPLE` operación. - - Índices. - - Replicación. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/es/faq/general.md b/docs/es/faq/general.md index 09c5a476af8..c94babf1b94 100644 --- a/docs/es/faq/general.md +++ b/docs/es/faq/general.md @@ -5,7 +5,7 @@ toc_priority: 78 toc_title: Preguntas generales --- -# Preguntas generales {#general-questions} +# Preguntas Generales {#general-questions} ## ¿por qué no usar algo como mapreduce? {#why-not-use-something-like-mapreduce} @@ -25,9 +25,9 @@ Si utiliza Oracle a través del controlador ODBC como fuente de diccionarios ext NLS_LANG=RUSSIAN_RUSSIA.UTF8 ``` -## Cómo exporto datos de ClickHouse a un archivo? {#how-to-export-to-file} +## Cómo Exporto Datos De ClickHouse a Un Archivo? {#how-to-export-to-file} -### Uso de la cláusula INTO OUTFILE {#using-into-outfile-clause} +### Uso De La cláusula INTO OUTFILE {#using-into-outfile-clause} Añadir un [INTO OUTFILE](../query_language/select/#into-outfile-clause) cláusula a su consulta. @@ -45,11 +45,11 @@ Por ejemplo: SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV ``` -### Uso de una tabla de motor de archivo {#using-a-file-engine-table} +### Uso De Una Tabla De Motor De Archivo {#using-a-file-engine-table} -Ver [File](../engines/table_engines/special/file.md). +Ver [File](../engines/table-engines/special/file.md). -### Uso de la redirección de línea de comandos {#using-command-line-redirection} +### Uso De La redirección De línea De Comandos {#using-command-line-redirection} ``` sql $ clickhouse-client --query "SELECT * from table" --format FormatName > result.txt diff --git a/docs/es/getting-started/example-datasets/amplab-benchmark.md b/docs/es/getting-started/example-datasets/amplab-benchmark.md new file mode 100644 index 00000000000..3f9ec5bef61 --- /dev/null +++ b/docs/es/getting-started/example-datasets/amplab-benchmark.md @@ -0,0 +1,129 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 17 +toc_title: Referencia de Big Data de AMPLab +--- + +# Referencia De Big Data De AMPLab {#amplab-big-data-benchmark} + +Ver https://amplab.cs.berkeley.edu/benchmark/ + +Regístrese para obtener una cuenta gratuita en https://aws.amazon.com. Requiere una tarjeta de crédito, correo electrónico y número de teléfono. Obtenga una nueva clave de acceso en https://console.aws.amazon.com/iam/home?nc2=h\_m\_sc\#security\_credential + +Ejecute lo siguiente en la consola: + +``` bash +$ sudo apt-get install s3cmd +$ mkdir tiny; cd tiny; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/tiny/ . +$ cd .. +$ mkdir 1node; cd 1node; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/1node/ . +$ cd .. +$ mkdir 5nodes; cd 5nodes; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/5nodes/ . +$ cd .. +``` + +Ejecute las siguientes consultas de ClickHouse: + +``` sql +CREATE TABLE rankings_tiny +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_tiny +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); + +CREATE TABLE rankings_1node +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_1node +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); + +CREATE TABLE rankings_5nodes_on_single +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_5nodes_on_single +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); +``` + +Volver a la consola: + +``` bash +$ for i in tiny/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_tiny FORMAT CSV"; done +$ for i in tiny/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_tiny FORMAT CSV"; done +$ for i in 1node/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_1node FORMAT CSV"; done +$ for i in 1node/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_1node FORMAT CSV"; done +$ for i in 5nodes/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_5nodes_on_single FORMAT CSV"; done +$ for i in 5nodes/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_5nodes_on_single FORMAT CSV"; done +``` + +Consultas para obtener muestras de datos: + +``` sql +SELECT pageURL, pageRank FROM rankings_1node WHERE pageRank > 1000 + +SELECT substring(sourceIP, 1, 8), sum(adRevenue) FROM uservisits_1node GROUP BY substring(sourceIP, 1, 8) + +SELECT + sourceIP, + sum(adRevenue) AS totalRevenue, + avg(pageRank) AS pageRank +FROM rankings_1node ALL INNER JOIN +( + SELECT + sourceIP, + destinationURL AS pageURL, + adRevenue + FROM uservisits_1node + WHERE (visitDate > '1980-01-01') AND (visitDate < '1980-04-01') +) USING pageURL +GROUP BY sourceIP +ORDER BY totalRevenue DESC +LIMIT 1 +``` + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/amplab_benchmark/) diff --git a/docs/es/getting-started/example-datasets/criteo.md b/docs/es/getting-started/example-datasets/criteo.md new file mode 100644 index 00000000000..d95ea234962 --- /dev/null +++ b/docs/es/getting-started/example-datasets/criteo.md @@ -0,0 +1,81 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 19 +toc_title: Registros de clics de Terabyte de Criteo +--- + +# Terabyte De Registros De Clics De Criteo {#terabyte-of-click-logs-from-criteo} + +Descargue los datos de http://labs.criteo.com/downloads/download-terabyte-click-logs/ + +Cree una tabla para importar el registro: + +``` sql +CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log +``` + +Descargar los datos: + +``` bash +$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done +``` + +Crear una tabla para los datos convertidos: + +``` sql +CREATE TABLE criteo +( + date Date, + clicked UInt8, + int1 Int32, + int2 Int32, + int3 Int32, + int4 Int32, + int5 Int32, + int6 Int32, + int7 Int32, + int8 Int32, + int9 Int32, + int10 Int32, + int11 Int32, + int12 Int32, + int13 Int32, + icat1 UInt32, + icat2 UInt32, + icat3 UInt32, + icat4 UInt32, + icat5 UInt32, + icat6 UInt32, + icat7 UInt32, + icat8 UInt32, + icat9 UInt32, + icat10 UInt32, + icat11 UInt32, + icat12 UInt32, + icat13 UInt32, + icat14 UInt32, + icat15 UInt32, + icat16 UInt32, + icat17 UInt32, + icat18 UInt32, + icat19 UInt32, + icat20 UInt32, + icat21 UInt32, + icat22 UInt32, + icat23 UInt32, + icat24 UInt32, + icat25 UInt32, + icat26 UInt32 +) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) +``` + +Transforme los datos del registro sin procesar y colóquelos en la segunda tabla: + +``` sql +INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; + +DROP TABLE criteo_log; +``` + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/es/getting-started/example-datasets/index.md b/docs/es/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..5877a749ec4 --- /dev/null +++ b/docs/es/getting-started/example-datasets/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Example Datasets +toc_priority: 12 +toc_title: "Implantaci\xF3n" +--- + +# Datos De Ejemplo {#example-datasets} + +En esta sección se describe cómo obtener conjuntos de datos de ejemplo e importarlos a ClickHouse. +Para algunos conjuntos de datos también están disponibles consultas de ejemplo. + +- [Yandex anonimizado.Conjunto de datos de Metrica](metrica.md) +- [Estrella Schema Benchmark](star-schema.md) +- [Nombre de la red inalámbrica (SSID):](wikistat.md) +- [Terabyte de registros de clics de Criteo](criteo.md) +- [Referencia de Big Data de AMPLab](amplab-benchmark.md) +- [Datos de taxis de Nueva York](nyc-taxi.md) +- [A tiempo](ontime.md) + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/es/getting-started/example-datasets/metrica.md b/docs/es/getting-started/example-datasets/metrica.md new file mode 100644 index 00000000000..39c4bd17a68 --- /dev/null +++ b/docs/es/getting-started/example-datasets/metrica.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 21 +toc_title: El Yandex.Metrica Datos +--- + +# Yandex Anonimizado.Metrica Datos {#anonymized-yandex-metrica-data} + +El conjunto de datos consta de dos tablas que contienen datos anónimos sobre los hits (`hits_v1`) y visitas (`visits_v1`) el Yandex.Métrica. Puedes leer más sobre Yandex.Metrica en [Historial de ClickHouse](../../introduction/history.md) apartado. + +El conjunto de datos consta de dos tablas, cualquiera de ellas se puede descargar como `tsv.xz` o como particiones preparadas. Además, una versión extendida de la `hits` La tabla que contiene 100 millones de filas está disponible como TSV en https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz y como particiones preparadas en https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. + +## Obtención De Tablas a Partir De Particiones Preparadas {#obtaining-tables-from-prepared-partitions} + +Descargar e importar tabla de hits: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar +tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +Descargar e importar visitas: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar +tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Obtención De Tablas a Partir De Un Archivo TSV Comprimido {#obtaining-tables-from-compressed-tsv-file} + +Descargar e importar hits desde un archivo TSV comprimido: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +Descargue e importe visitas desde un archivo tsv comprimido: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Consultas De Ejemplo {#example-queries} + +[Tutorial de ClickHouse](../../getting-started/tutorial.md) se basa en Yandex.El conjunto de datos de Metrica y la forma recomendada de comenzar con este conjunto de datos es simplemente pasar por el tutorial. + +Se pueden encontrar ejemplos adicionales de consultas a estas tablas entre [pruebas estatales](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) de ClickHouse (se nombran `test.hists` y `test.visits` alli). diff --git a/docs/es/getting-started/example-datasets/nyc-taxi.md b/docs/es/getting-started/example-datasets/nyc-taxi.md new file mode 100644 index 00000000000..067e9de337f --- /dev/null +++ b/docs/es/getting-started/example-datasets/nyc-taxi.md @@ -0,0 +1,390 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 16 +toc_title: Datos de taxis de Nueva York +--- + +# Datos De Taxis De Nueva York {#new-york-taxi-data} + +Este conjunto de datos se puede obtener de dos maneras: + +- importación de datos sin procesar +- descarga de particiones preparadas + +## Cómo Importar Los Datos Sin Procesar {#how-to-import-the-raw-data} + +Consulte https://github.com/toddwschneider/nyc-taxi-data y http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html para obtener la descripción de un conjunto de datos e instrucciones para descargar. + +La descarga dará como resultado aproximadamente 227 GB de datos sin comprimir en archivos CSV. La descarga tarda aproximadamente una hora en una conexión de 1 Gbit (la descarga paralela de s3.amazonaws.com recupera al menos la mitad de un canal de 1 Gbit). +Es posible que algunos de los archivos no se descarguen por completo. Verifique los tamaños de archivo y vuelva a descargar cualquiera que parezca dudoso. + +Algunos de los archivos pueden contener filas no válidas. Puede arreglarlos de la siguiente manera: + +``` bash +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ +mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv +mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv +``` + +Entonces los datos deben ser preprocesados en PostgreSQL. Esto creará selecciones de puntos en los polígonos (para hacer coincidir los puntos en el mapa con los distritos de la ciudad de Nueva York) y combinará todos los datos en una única tabla plana desnormalizada mediante el uso de una unión. Para hacer esto, deberá instalar PostgreSQL con soporte PostGIS. + +Tenga cuidado al correr `initialize_database.sh` y volver a verificar manualmente que todas las tablas se crearon correctamente. + +Se tarda entre 20 y 30 minutos en procesar los datos de cada mes en PostgreSQL, por un total de aproximadamente 48 horas. + +Puede comprobar el número de filas descargadas de la siguiente manera: + +``` bash +$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" +## Count + 1298979494 +(1 row) + +real 7m9.164s +``` + +(Esto es un poco más de 1.1 mil millones de filas reportadas por Mark Litwintschik en una serie de publicaciones de blog.) + +Los datos en PostgreSQL utilizan 370 GB de espacio. + +Exportación de los datos de PostgreSQL: + +``` sql +COPY +( + SELECT trips.id, + trips.vendor_id, + trips.pickup_datetime, + trips.dropoff_datetime, + trips.store_and_fwd_flag, + trips.rate_code_id, + trips.pickup_longitude, + trips.pickup_latitude, + trips.dropoff_longitude, + trips.dropoff_latitude, + trips.passenger_count, + trips.trip_distance, + trips.fare_amount, + trips.extra, + trips.mta_tax, + trips.tip_amount, + trips.tolls_amount, + trips.ehail_fee, + trips.improvement_surcharge, + trips.total_amount, + trips.payment_type, + trips.trip_type, + trips.pickup, + trips.dropoff, + + cab_types.type cab_type, + + weather.precipitation_tenths_of_mm rain, + weather.snow_depth_mm, + weather.snowfall_mm, + weather.max_temperature_tenths_degrees_celsius max_temp, + weather.min_temperature_tenths_degrees_celsius min_temp, + weather.average_wind_speed_tenths_of_meters_per_second wind, + + pick_up.gid pickup_nyct2010_gid, + pick_up.ctlabel pickup_ctlabel, + pick_up.borocode pickup_borocode, + pick_up.boroname pickup_boroname, + pick_up.ct2010 pickup_ct2010, + pick_up.boroct2010 pickup_boroct2010, + pick_up.cdeligibil pickup_cdeligibil, + pick_up.ntacode pickup_ntacode, + pick_up.ntaname pickup_ntaname, + pick_up.puma pickup_puma, + + drop_off.gid dropoff_nyct2010_gid, + drop_off.ctlabel dropoff_ctlabel, + drop_off.borocode dropoff_borocode, + drop_off.boroname dropoff_boroname, + drop_off.ct2010 dropoff_ct2010, + drop_off.boroct2010 dropoff_boroct2010, + drop_off.cdeligibil dropoff_cdeligibil, + drop_off.ntacode dropoff_ntacode, + drop_off.ntaname dropoff_ntaname, + drop_off.puma dropoff_puma + FROM trips + LEFT JOIN cab_types + ON trips.cab_type_id = cab_types.id + LEFT JOIN central_park_weather_observations_raw weather + ON weather.date = trips.pickup_datetime::date + LEFT JOIN nyct2010 pick_up + ON pick_up.gid = trips.pickup_nyct2010_gid + LEFT JOIN nyct2010 drop_off + ON drop_off.gid = trips.dropoff_nyct2010_gid +) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; +``` + +La instantánea de datos se crea a una velocidad de aproximadamente 50 MB por segundo. Al crear la instantánea, PostgreSQL lee desde el disco a una velocidad de aproximadamente 28 MB por segundo. +Esto toma alrededor de 5 horas. El archivo TSV resultante es 590612904969 bytes. + +Crear una tabla temporal en ClickHouse: + +``` sql +CREATE TABLE trips +( +trip_id UInt32, +vendor_id String, +pickup_datetime DateTime, +dropoff_datetime Nullable(DateTime), +store_and_fwd_flag Nullable(FixedString(1)), +rate_code_id Nullable(UInt8), +pickup_longitude Nullable(Float64), +pickup_latitude Nullable(Float64), +dropoff_longitude Nullable(Float64), +dropoff_latitude Nullable(Float64), +passenger_count Nullable(UInt8), +trip_distance Nullable(Float64), +fare_amount Nullable(Float32), +extra Nullable(Float32), +mta_tax Nullable(Float32), +tip_amount Nullable(Float32), +tolls_amount Nullable(Float32), +ehail_fee Nullable(Float32), +improvement_surcharge Nullable(Float32), +total_amount Nullable(Float32), +payment_type Nullable(String), +trip_type Nullable(UInt8), +pickup Nullable(String), +dropoff Nullable(String), +cab_type Nullable(String), +precipitation Nullable(UInt8), +snow_depth Nullable(UInt8), +snowfall Nullable(UInt8), +max_temperature Nullable(UInt8), +min_temperature Nullable(UInt8), +average_wind_speed Nullable(UInt8), +pickup_nyct2010_gid Nullable(UInt8), +pickup_ctlabel Nullable(String), +pickup_borocode Nullable(UInt8), +pickup_boroname Nullable(String), +pickup_ct2010 Nullable(String), +pickup_boroct2010 Nullable(String), +pickup_cdeligibil Nullable(FixedString(1)), +pickup_ntacode Nullable(String), +pickup_ntaname Nullable(String), +pickup_puma Nullable(String), +dropoff_nyct2010_gid Nullable(UInt8), +dropoff_ctlabel Nullable(String), +dropoff_borocode Nullable(UInt8), +dropoff_boroname Nullable(String), +dropoff_ct2010 Nullable(String), +dropoff_boroct2010 Nullable(String), +dropoff_cdeligibil Nullable(String), +dropoff_ntacode Nullable(String), +dropoff_ntaname Nullable(String), +dropoff_puma Nullable(String) +) ENGINE = Log; +``` + +Es necesario para convertir campos a tipos de datos más correctos y, si es posible, para eliminar NULL. + +``` bash +$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv + +real 75m56.214s +``` + +Los datos se leen a una velocidad de 112-140 Mb / segundo. +La carga de datos en una tabla de tipos de registro en una secuencia tardó 76 minutos. +Los datos de esta tabla utilizan 142 GB. + +(Importar datos directamente desde Postgres también es posible usando `COPY ... TO PROGRAM`.) + +Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. + +Para empezar, crearemos una tabla en un único servidor. Posteriormente haremos la mesa distribuida. + +Crear y rellenar una tabla de resumen: + +``` sql +CREATE TABLE trips_mergetree +ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +AS SELECT + +trip_id, +CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, +toDate(pickup_datetime) AS pickup_date, +ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, +toDate(dropoff_datetime) AS dropoff_date, +ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, +assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, +assumeNotNull(rate_code_id) AS rate_code_id, +assumeNotNull(pickup_longitude) AS pickup_longitude, +assumeNotNull(pickup_latitude) AS pickup_latitude, +assumeNotNull(dropoff_longitude) AS dropoff_longitude, +assumeNotNull(dropoff_latitude) AS dropoff_latitude, +assumeNotNull(passenger_count) AS passenger_count, +assumeNotNull(trip_distance) AS trip_distance, +assumeNotNull(fare_amount) AS fare_amount, +assumeNotNull(extra) AS extra, +assumeNotNull(mta_tax) AS mta_tax, +assumeNotNull(tip_amount) AS tip_amount, +assumeNotNull(tolls_amount) AS tolls_amount, +assumeNotNull(ehail_fee) AS ehail_fee, +assumeNotNull(improvement_surcharge) AS improvement_surcharge, +assumeNotNull(total_amount) AS total_amount, +CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, +assumeNotNull(trip_type) AS trip_type, +ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, +ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, +CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, + +assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, +toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, +assumeNotNull(pickup_borocode) AS pickup_borocode, +CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, +toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, +toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, +CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, +toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, + +CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, + +toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, + +assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, +toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, +assumeNotNull(dropoff_borocode) AS dropoff_borocode, +CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, +toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, +toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, +CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, +toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, + +CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, + +toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma + +FROM trips +``` + +Esto toma 3030 segundos a una velocidad de aproximadamente 428,000 filas por segundo. +Para cargarlo más rápido, puede crear la tabla con el `Log` motor en lugar de `MergeTree`. En este caso, la descarga funciona más rápido que 200 segundos. + +La tabla utiliza 126 GB de espacio en disco. + +``` sql +SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active +``` + +``` text +┌─formatReadableSize(sum(bytes))─┐ +│ 126.18 GiB │ +└────────────────────────────────┘ +``` + +Entre otras cosas, puede ejecutar la consulta OPTIMIZE en MergeTree. Pero no es necesario ya que todo estará bien sin él. + +## Descarga De Prepared Partitions {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar +$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" +``` + +!!! info "INFO" + Si va a ejecutar las consultas que se describen a continuación, debe usar el nombre completo de la tabla, `datasets.trips_mergetree`. + +## Resultados En Un Solo Servidor {#results-on-single-server} + +Q1: + +``` sql +SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type +``` + +0.490 segundos. + +Q2: + +``` sql +SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count +``` + +1.224 segundos. + +Q3: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year +``` + +2.104 segundos. + +Q4: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) +FROM trips_mergetree +GROUP BY passenger_count, year, distance +ORDER BY year, count(*) DESC +``` + +3.593 segundos. + +Se utilizó el siguiente servidor: + +Dos CPU Intel (R) Xeon (R) E5-2650 v2 @ 2.60GHz, 16 núcleos físicos en total, 128 GiB RAM, 8x6 TB HD en hardware RAID-5 + +El tiempo de ejecución es el mejor de tres carreras. Pero a partir de la segunda ejecución, las consultas leen datos de la memoria caché del sistema de archivos. No se produce más almacenamiento en caché: los datos se leen y procesan en cada ejecución. + +Creación de una tabla en tres servidores: + +En cada servidor: + +``` sql +CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +``` + +En el servidor de origen: + +``` sql +CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) +``` + +La siguiente consulta redistribuye los datos: + +``` sql +INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree +``` + +Esto tarda 2454 segundos. + +En tres servidores: + +Q1: 0.212 segundos. +Q2: 0.438 segundos. +Q3: 0.733 segundos. +Q4: 1.241 segundos. + +No hay sorpresas aquí, ya que las consultas se escalan linealmente. + +También tenemos los resultados de un clúster de 140 servidores: + +Q1: 0,028 seg. +Q2: 0,043 seg. +Q3: 0,051 seg. +Q4: 0,072 seg. + +En este caso, el tiempo de procesamiento de la consulta está determinado sobre todo por la latencia de la red. +Ejecutamos consultas utilizando un cliente ubicado en un centro de datos de Yandex en Finlandia en un clúster en Rusia, que agregó aproximadamente 20 ms de latencia. + +## Resumen {#summary} + +| servidor | Q1 | Q2 | Q3 | Q4 | +|----------|-------|-------|-------|-------| +| 1 | 0.490 | 1.224 | 2.104 | 3.593 | +| 3 | 0.212 | 0.438 | 0.733 | 1.241 | +| 140 | 0.028 | 0.043 | 0.051 | 0.072 | + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/es/getting-started/example-datasets/ontime.md b/docs/es/getting-started/example-datasets/ontime.md new file mode 100644 index 00000000000..78403fce0f7 --- /dev/null +++ b/docs/es/getting-started/example-datasets/ontime.md @@ -0,0 +1,412 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 15 +toc_title: A tiempo +--- + +# A Tiempo {#ontime} + +Este conjunto de datos se puede obtener de dos maneras: + +- importación de datos sin procesar +- descarga de particiones preparadas + +## Importar Desde Datos Sin Procesar {#import-from-raw-data} + +Descarga de datos: + +``` bash +for s in `seq 1987 2018` +do +for m in `seq 1 12` +do +wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip +done +done +``` + +(a partir de https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) + +Creación de una tabla: + +``` sql +CREATE TABLE `ontime` ( + `Year` UInt16, + `Quarter` UInt8, + `Month` UInt8, + `DayofMonth` UInt8, + `DayOfWeek` UInt8, + `FlightDate` Date, + `UniqueCarrier` FixedString(7), + `AirlineID` Int32, + `Carrier` FixedString(2), + `TailNum` String, + `FlightNum` String, + `OriginAirportID` Int32, + `OriginAirportSeqID` Int32, + `OriginCityMarketID` Int32, + `Origin` FixedString(5), + `OriginCityName` String, + `OriginState` FixedString(2), + `OriginStateFips` String, + `OriginStateName` String, + `OriginWac` Int32, + `DestAirportID` Int32, + `DestAirportSeqID` Int32, + `DestCityMarketID` Int32, + `Dest` FixedString(5), + `DestCityName` String, + `DestState` FixedString(2), + `DestStateFips` String, + `DestStateName` String, + `DestWac` Int32, + `CRSDepTime` Int32, + `DepTime` Int32, + `DepDelay` Int32, + `DepDelayMinutes` Int32, + `DepDel15` Int32, + `DepartureDelayGroups` String, + `DepTimeBlk` String, + `TaxiOut` Int32, + `WheelsOff` Int32, + `WheelsOn` Int32, + `TaxiIn` Int32, + `CRSArrTime` Int32, + `ArrTime` Int32, + `ArrDelay` Int32, + `ArrDelayMinutes` Int32, + `ArrDel15` Int32, + `ArrivalDelayGroups` Int32, + `ArrTimeBlk` String, + `Cancelled` UInt8, + `CancellationCode` FixedString(1), + `Diverted` UInt8, + `CRSElapsedTime` Int32, + `ActualElapsedTime` Int32, + `AirTime` Int32, + `Flights` Int32, + `Distance` Int32, + `DistanceGroup` UInt8, + `CarrierDelay` Int32, + `WeatherDelay` Int32, + `NASDelay` Int32, + `SecurityDelay` Int32, + `LateAircraftDelay` Int32, + `FirstDepTime` String, + `TotalAddGTime` String, + `LongestAddGTime` String, + `DivAirportLandings` String, + `DivReachedDest` String, + `DivActualElapsedTime` String, + `DivArrDelay` String, + `DivDistance` String, + `Div1Airport` String, + `Div1AirportID` Int32, + `Div1AirportSeqID` Int32, + `Div1WheelsOn` String, + `Div1TotalGTime` String, + `Div1LongestGTime` String, + `Div1WheelsOff` String, + `Div1TailNum` String, + `Div2Airport` String, + `Div2AirportID` Int32, + `Div2AirportSeqID` Int32, + `Div2WheelsOn` String, + `Div2TotalGTime` String, + `Div2LongestGTime` String, + `Div2WheelsOff` String, + `Div2TailNum` String, + `Div3Airport` String, + `Div3AirportID` Int32, + `Div3AirportSeqID` Int32, + `Div3WheelsOn` String, + `Div3TotalGTime` String, + `Div3LongestGTime` String, + `Div3WheelsOff` String, + `Div3TailNum` String, + `Div4Airport` String, + `Div4AirportID` Int32, + `Div4AirportSeqID` Int32, + `Div4WheelsOn` String, + `Div4TotalGTime` String, + `Div4LongestGTime` String, + `Div4WheelsOff` String, + `Div4TailNum` String, + `Div5Airport` String, + `Div5AirportID` Int32, + `Div5AirportSeqID` Int32, + `Div5WheelsOn` String, + `Div5TotalGTime` String, + `Div5LongestGTime` String, + `Div5WheelsOff` String, + `Div5TailNum` String +) ENGINE = MergeTree +PARTITION BY Year +ORDER BY (Carrier, FlightDate) +SETTINGS index_granularity = 8192; +``` + +Carga de datos: + +``` bash +$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done +``` + +## Descarga De Prepared Partitions {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar +$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.ontime" +``` + +!!! info "INFO" + Si va a ejecutar las consultas que se describen a continuación, debe usar el nombre completo de la tabla, `datasets.ontime`. + +## Consulta {#queries} + +Q0. + +``` sql +SELECT avg(c1) +FROM +( + SELECT Year, Month, count(*) AS c1 + FROM ontime + GROUP BY Year, Month +); +``` + +Q1. El número de vuelos por día desde el año 2000 hasta 2008 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +Preguntas frecuentes El número de vuelos retrasados por más de 10 minutos, agrupados por el día de la semana, para 2000-2008 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +Q3. El número de retrasos por parte del aeropuerto para 2000-2008 + +``` sql +SELECT Origin, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY Origin +ORDER BY c DESC +LIMIT 10; +``` + +Preguntas más frecuentes Número de retrasos por transportista para 2007 + +``` sql +SELECT Carrier, count(*) +FROM ontime +WHERE DepDelay>10 AND Year=2007 +GROUP BY Carrier +ORDER BY count(*) DESC; +``` + +Q5. El porcentaje de retrasos por transportista para 2007 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year=2007 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year=2007 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Mejor versión de la misma consulta: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year=2007 +GROUP BY Carrier +ORDER BY c3 DESC +``` + +¿por qué? la solicitud anterior de una gama más amplia de años, 2000-2008 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year>=2000 AND Year<=2008 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year>=2000 AND Year<=2008 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Mejor versión de la misma consulta: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY Carrier +ORDER BY c3 DESC; +``` + +Preguntas frecuentes Porcentaje de vuelos retrasados por más de 10 minutos, por año + +``` sql +SELECT Year, c1/c2 +FROM +( + select + Year, + count(*)*100 as c1 + from ontime + WHERE DepDelay>10 + GROUP BY Year +) +JOIN +( + select + Year, + count(*) as c2 + from ontime + GROUP BY Year +) USING (Year) +ORDER BY Year; +``` + +Mejor versión de la misma consulta: + +``` sql +SELECT Year, avg(DepDelay>10)*100 +FROM ontime +GROUP BY Year +ORDER BY Year; +``` + +¿por qué? los destinos más populares por el número de ciudades conectadas directamente para varios rangos de año + +``` sql +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +WHERE Year >= 2000 and Year <= 2010 +GROUP BY DestCityName +ORDER BY u DESC LIMIT 10; +``` + +Q9. + +``` sql +SELECT Year, count(*) AS c1 +FROM ontime +GROUP BY Year; +``` + +Q10. + +``` sql +SELECT + min(Year), max(Year), Carrier, count(*) AS cnt, + sum(ArrDelayMinutes>30) AS flights_delayed, + round(sum(ArrDelayMinutes>30)/count(*),2) AS rate +FROM ontime +WHERE + DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') + AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') + AND FlightDate < '2010-01-01' +GROUP by Carrier +HAVING cnt>100000 and max(Year)>1990 +ORDER by rate DESC +LIMIT 1000; +``` + +Bono: + +``` sql +SELECT avg(cnt) +FROM +( + SELECT Year,Month,count(*) AS cnt + FROM ontime + WHERE DepDel15=1 + GROUP BY Year,Month +); + +SELECT avg(c1) FROM +( + SELECT Year,Month,count(*) AS c1 + FROM ontime + GROUP BY Year,Month +); + +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +GROUP BY DestCityName +ORDER BY u DESC +LIMIT 10; + +SELECT OriginCityName, DestCityName, count() AS c +FROM ontime +GROUP BY OriginCityName, DestCityName +ORDER BY c DESC +LIMIT 10; + +SELECT OriginCityName, count() AS c +FROM ontime +GROUP BY OriginCityName +ORDER BY c DESC +LIMIT 10; +``` + +Esta prueba de rendimiento fue creada por Vadim Tkachenko. Ver: + +- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ +- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ +- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ +- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ +- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ +- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/es/getting_started/example_datasets/star_schema.md b/docs/es/getting-started/example-datasets/star-schema.md similarity index 100% rename from docs/es/getting_started/example_datasets/star_schema.md rename to docs/es/getting-started/example-datasets/star-schema.md diff --git a/docs/es/getting-started/example-datasets/wikistat.md b/docs/es/getting-started/example-datasets/wikistat.md new file mode 100644 index 00000000000..938ed0c25d4 --- /dev/null +++ b/docs/es/getting-started/example-datasets/wikistat.md @@ -0,0 +1,35 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 18 +toc_title: "Nombre de la red inal\xE1mbrica (SSID):" +--- + +# Nombre De La Red inalámbrica (SSID): {#wikistat} + +Ver: http://dumps.wikimedia.org/other/pagecounts-raw/ + +Creación de una tabla: + +``` sql +CREATE TABLE wikistat +( + date Date, + time DateTime, + project String, + subproject String, + path String, + hits UInt64, + size UInt64 +) ENGINE = MergeTree(date, (path, time), 8192); +``` + +Carga de datos: + +``` bash +$ for i in {2007..2016}; do for j in {01..12}; do echo $i-$j >&2; curl -sSL "http://dumps.wikimedia.org/other/pagecounts-raw/$i/$i-$j/" | grep -oE 'pagecounts-[0-9]+-[0-9]+\.gz'; done; done | sort | uniq | tee links.txt +$ cat links.txt | while read link; do wget http://dumps.wikimedia.org/other/pagecounts-raw/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1/')/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1-\2/')/$link; done +$ ls -1 /opt/wikistat/ | grep gz | while read i; do echo $i; gzip -cd /opt/wikistat/$i | ./wikistat-loader --time="$(echo -n $i | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2})\.gz/\1-\2-\3 \4-00-00/')" | clickhouse-client --query="INSERT INTO wikistat FORMAT TabSeparated"; done +``` + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/wikistat/) diff --git a/docs/es/getting-started/index.md b/docs/es/getting-started/index.md new file mode 100644 index 00000000000..10964e22817 --- /dev/null +++ b/docs/es/getting-started/index.md @@ -0,0 +1,17 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Getting Started +toc_hidden: true +toc_priority: 8 +toc_title: oculto +--- + +# Primeros Pasos {#getting-started} + +Si eres nuevo en ClickHouse y quieres tener una sensación práctica de su rendimiento, antes que nada, debes pasar por el [proceso de instalación](install.md). Después de eso puedes: + +- [Ir a través de tutorial detallado](tutorial.md) +- [Experimente con conjuntos de datos de ejemplo](example-datasets/ontime.md) + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/es/getting-started/install.md b/docs/es/getting-started/install.md new file mode 100644 index 00000000000..6e6feee8464 --- /dev/null +++ b/docs/es/getting-started/install.md @@ -0,0 +1,182 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 11 +toc_title: "Instalaci\xF3n" +--- + +# Instalación {#installation} + +## Requisitos Del Sistema {#system-requirements} + +ClickHouse puede ejecutarse en cualquier Linux, FreeBSD o Mac OS X con arquitectura de CPU x86\_64, AArch64 o PowerPC64LE. + +Los binarios oficiales preconstruidos generalmente se compilan para x86\_64 y aprovechan el conjunto de instrucciones SSE 4.2, por lo que, a menos que se indique lo contrario, el uso de la CPU que lo admite se convierte en un requisito adicional del sistema. Aquí está el comando para verificar si la CPU actual tiene soporte para SSE 4.2: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +Para ejecutar ClickHouse en procesadores que no admiten SSE 4.2 o tienen arquitectura AArch64 o PowerPC64LE, debe [construir ClickHouse a partir de fuentes](#from-sources) con los ajustes de configuración adecuados. + +## Opciones De instalación Disponibles {#available-installation-options} + +### De Paquetes DEB {#install-from-deb-packages} + +Se recomienda utilizar pre-compilado oficial `deb` Paquetes para Debian o Ubuntu. Ejecute estos comandos para instalar paquetes: + +``` bash +{% include 'install/deb.sh' %} +``` + +Si desea utilizar la versión más reciente, reemplace `stable` con `testing` (esto se recomienda para sus entornos de prueba). + +También puede descargar e instalar paquetes manualmente desde aquí: https://repo.clickhouse.tech/deb/stable/main/. + +#### Paquete {#packages} + +- `clickhouse-common-static` — Installs ClickHouse compiled binary files. +- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` e instala la configuración predeterminada del servidor. +- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` y otras herramientas relacionadas con el cliente. e instala los archivos de configuración del cliente. +- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. + +### De Paquetes RPM {#from-rpm-packages} + +Se recomienda utilizar pre-compilado oficial `rpm` También puede utilizar los paquetes para CentOS, RedHat y todas las demás distribuciones de Linux basadas en rpm. + +Primero, necesitas agregar el repositorio oficial: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 +``` + +Si desea utilizar la versión más reciente, reemplace `stable` con `testing` (esto se recomienda para sus entornos de prueba). El `prestable` etiqueta a veces está disponible también. + +A continuación, ejecute estos comandos para instalar paquetes: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +También puede descargar e instalar paquetes manualmente desde aquí: https://repo.casa de clic.tecnología / rpm / estable / x86\_64. + +### De Archivos Tgz {#from-tgz-archives} + +Se recomienda utilizar pre-compilado oficial `tgz` para todas las distribuciones de Linux, donde la instalación de `deb` o `rpm` paquetes no es posible. + +La versión requerida se puede descargar con `curl` o `wget` desde el repositorio https://repo.yandex.ru/clickhouse/tgz/. +Después de eso, los archivos descargados deben desempaquetarse e instalarse con scripts de instalación. Ejemplo para la última versión: + +``` bash +export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz + +tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz +sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz +sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-server-$LATEST_VERSION.tgz +sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh +sudo /etc/init.d/clickhouse-server start + +tar -xzvf clickhouse-client-$LATEST_VERSION.tgz +sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh +``` + +Para los entornos de producción, se recomienda utilizar las últimas `stable`-versión. Puede encontrar su número en la página de GitHub https://github.com/ClickHouse/ClickHouse/tags con postfix `-stable`. + +### Desde Docker Image {#from-docker-image} + +Para ejecutar ClickHouse dentro de Docker, siga la guía en [Eje de acoplador](https://hub.docker.com/r/yandex/clickhouse-server/). Esas imágenes usan oficial `deb` paquetes dentro. + +### De Fuentes {#from-sources} + +Para compilar manualmente ClickHouse, siga las instrucciones para [Linux](../development/build.md) o [Mac OS X](../development/build-osx.md). + +Puede compilar paquetes e instalarlos o usar programas sin instalar paquetes. Además, al construir manualmente, puede deshabilitar el requisito de SSE 4.2 o compilar para CPU AArch64. + + Client: programs/clickhouse-client + Server: programs/clickhouse-server + +Tendrá que crear carpetas de datos y metadatos y `chown` para el usuario deseado. Sus rutas se pueden cambiar en la configuración del servidor (src/programs/server/config.xml), por defecto son: + + /opt/clickhouse/data/default/ + /opt/clickhouse/metadata/default/ + +En Gentoo, puedes usar `emerge clickhouse` para instalar ClickHouse desde fuentes. + +## Lanzar {#launch} + +Para iniciar el servidor como demonio, ejecute: + +``` bash +$ sudo service clickhouse-server start +``` + +Si no tienes `service` comando ejecutar como + +``` bash +$ sudo /etc/init.d/clickhouse-server start +``` + +Vea los registros en el `/var/log/clickhouse-server/` directorio. + +Si el servidor no se inicia, compruebe las configuraciones en el archivo `/etc/clickhouse-server/config.xml`. + +También puede iniciar manualmente el servidor desde la consola: + +``` bash +$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +En este caso, el registro se imprimirá en la consola, lo cual es conveniente durante el desarrollo. +Si el archivo de configuración está en el directorio actual, no es necesario `--config-file` parámetro. De forma predeterminada, utiliza `./config.xml`. + +ClickHouse admite la configuración de restricción de acceso. Están ubicados en el `users.xml` archivo (junto a `config.xml`). +De forma predeterminada, se permite el acceso desde cualquier lugar `default` usuario, sin una contraseña. Ver `user/default/networks`. +Para obtener más información, consulte la sección [“Configuration Files”](../operations/configuration-files.md). + +Después de iniciar el servidor, puede usar el cliente de línea de comandos para conectarse a él: + +``` bash +$ clickhouse-client +``` + +Por defecto, se conecta a `localhost:9000` en nombre del usuario `default` sin una contraseña. También se puede usar para conectarse a un servidor remoto usando `--host` argumento. + +El terminal debe usar codificación UTF-8. +Para obtener más información, consulte la sección [“Command-line client”](../interfaces/cli.md). + +Ejemplo: + +``` bash +$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**Felicidades, el sistema funciona!** + +Para continuar experimentando, puede descargar uno de los conjuntos de datos de prueba o pasar por [tutorial](https://clickhouse.tech/tutorial.html). + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/es/getting-started/playground.md b/docs/es/getting-started/playground.md new file mode 100644 index 00000000000..f71ae4672ed --- /dev/null +++ b/docs/es/getting-started/playground.md @@ -0,0 +1,48 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 14 +toc_title: Infantil +--- + +# Zona De Juegos ClickHouse {#clickhouse-playground} + +[Zona de juegos ClickHouse](https://play.clickhouse.tech?file=welcome) permite a las personas experimentar con ClickHouse ejecutando consultas al instante, sin configurar su servidor o clúster. +Varios conjuntos de datos de ejemplo están disponibles en Playground, así como consultas de ejemplo que muestran las características de ClickHouse. + +Las consultas se ejecutan como un usuario de sólo lectura. Implica algunas limitaciones: + +- No se permiten consultas DDL +- Las consultas INSERT no están permitidas + +También se aplican los siguientes valores: +- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) +- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) +- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) +- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) + +ClickHouse Playground da la experiencia de m2.pequeño +[Servicio administrado para ClickHouse](https://cloud.yandex.com/services/managed-clickhouse) +instancia alojada en [El Yandex.Nube](https://cloud.yandex.com/). +Más información sobre [proveedores de la nube](../commercial/cloud.md). + +La interfaz web de ClickHouse Playground realiza solicitudes a través de ClickHouse [HTTP API](../interfaces/http.md). +El backend Playground es solo un clúster ClickHouse sin ninguna aplicación adicional del lado del servidor. +El punto final HTTPS de ClickHouse también está disponible como parte de Playground. + +Puede realizar consultas al patio de recreo utilizando cualquier cliente HTTP, por ejemplo [rizo](https://curl.haxx.se) o [wget](https://www.gnu.org/software/wget/), o configurar una conexión usando [JDBC](../interfaces/jdbc.md) o [ODBC](../interfaces/odbc.md) controlador. +Más información sobre los productos de software compatibles con ClickHouse está disponible [aqui](../interfaces/index.md). + +| Parámetro | Valor | +|:------------|:----------------------------------------------| +| Punto final | https://play-api.casa de clic.tecnología:8443 | +| Usuario | `playground` | +| Contraseña | `clickhouse` | + +Tenga en cuenta que este extremo requiere una conexión segura. + +Ejemplo: + +``` bash +curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" +``` diff --git a/docs/es/getting-started/tutorial.md b/docs/es/getting-started/tutorial.md new file mode 100644 index 00000000000..43e2a88f0fd --- /dev/null +++ b/docs/es/getting-started/tutorial.md @@ -0,0 +1,665 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 12 +toc_title: Tutorial +--- + +# Tutorial De ClickHouse {#clickhouse-tutorial} + +## Qué Esperar De Este Tutorial? {#what-to-expect-from-this-tutorial} + +Al pasar por este tutorial, aprenderá cómo configurar un clúster de ClickHouse simple. Será pequeño, pero tolerante a fallos y escalable. Luego usaremos uno de los conjuntos de datos de ejemplo para llenarlo con datos y ejecutar algunas consultas de demostración. + +## Configuración De Nodo único {#single-node-setup} + +Para posponer las complejidades de un entorno distribuido, comenzaremos con la implementación de ClickHouse en un único servidor o máquina virtual. ClickHouse generalmente se instala desde [deb](install.md#install-from-deb-packages) o [RPM](install.md#from-rpm-packages) paquetes, pero hay [alternativa](install.md#from-docker-image) para los sistemas operativos que no los admiten. + +Por ejemplo, ha elegido `deb` paquetes y ejecutado: + +``` bash +{% include 'install/deb.sh' %} +``` + +¿qué tenemos en los paquetes que tengo instalados: + +- `clickhouse-client` el paquete contiene [Casa de clics-cliente](../interfaces/cli.md) aplicación, cliente interactivo de la consola ClickHouse. +- `clickhouse-common` El paquete contiene un archivo ejecutable ClickHouse. +- `clickhouse-server` El paquete contiene archivos de configuración para ejecutar ClickHouse como servidor. + +Los archivos de configuración del servidor se encuentran en `/etc/clickhouse-server/`. Antes de ir más lejos, tenga en cuenta el `` elemento en `config.xml`. La ruta determina la ubicación para el almacenamiento de datos, por lo que debe ubicarse en un volumen con gran capacidad de disco; el valor predeterminado es `/var/lib/clickhouse/`. Si desea ajustar la configuración, no es útil editar directamente `config.xml` archivo, teniendo en cuenta que podría ser reescrito en futuras actualizaciones de paquetes. La forma recomendada de anular los elementos de configuración es crear [archivos en config.directorio d](../operations/configuration-files.md) que sirven como “patches” de configuración.XML. + +Como habrás notado, `clickhouse-server` no se inicia automáticamente después de la instalación del paquete. Tampoco se reiniciará automáticamente después de las actualizaciones. La forma en que inicia el servidor depende de su sistema de inicio, por lo general, es: + +``` bash +sudo service clickhouse-server start +``` + +o + +``` bash +sudo /etc/init.d/clickhouse-server start +``` + +La ubicación predeterminada para los registros del servidor es `/var/log/clickhouse-server/`. El servidor está listo para manejar las conexiones de cliente una vez que registra el `Ready for connections` mensaje. + +Una vez que el `clickhouse-server` está en funcionamiento, podemos usar `clickhouse-client` para conectarse al servidor y ejecutar algunas consultas de prueba como `SELECT "Hello, world!";`. + +
+ +Consejos rápidos para clickhouse-cliente +Modo interactivo: + +``` bash +clickhouse-client +clickhouse-client --host=... --port=... --user=... --password=... +``` + +Habilitar consultas multilínea: + +``` bash +clickhouse-client -m +clickhouse-client --multiline +``` + +Ejecutar consultas en modo por lotes: + +``` bash +clickhouse-client --query='SELECT 1' +echo 'SELECT 1' | clickhouse-client +clickhouse-client <<< 'SELECT 1' +``` + +Insertar datos de un archivo en el formato especificado: + +``` bash +clickhouse-client --query='INSERT INTO table VALUES' < data.txt +clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv +``` + +
+ +## Importar Conjunto De Datos De Muestra {#import-sample-dataset} + +Ahora es el momento de llenar nuestro servidor ClickHouse con algunos datos de muestra. En este tutorial, usaremos los datos anónimos de Yandex.Metrica, el primer servicio que ejecuta ClickHouse en forma de producción antes de que se convirtiera en código abierto (más sobre eso en [sección de historia](../introduction/history.md)). Hay [múltiples formas de importar Yandex.Conjunto de datos de Metrica](example-datasets/metrica.md), y por el bien del tutorial, iremos con el más realista. + +### Descargar y Extraer Datos De Tabla {#download-and-extract-table-data} + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +``` + +Los archivos extraídos tienen un tamaño de aproximadamente 10 GB. + +### Crear Tablas {#create-tables} + +Como en la mayoría de los sistemas de gestión de bases de datos, ClickHouse agrupa lógicamente las tablas en “databases”. Hay un `default` base de datos, pero crearemos una nueva llamada `tutorial`: + +``` bash +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" +``` + +La sintaxis para crear tablas es mucho más complicada en comparación con las bases de datos (ver [referencia](../sql-reference/statements/create.md). En general `CREATE TABLE` declaración tiene que especificar tres cosas clave: + +1. Nombre de la tabla que se va a crear. +2. Table schema, i.e. list of columns and their [tipos de datos](../sql-reference/data-types/index.md). +3. [Motor de tabla](../engines/table-engines/index.md) y su configuración, que determina todos los detalles sobre cómo se ejecutarán físicamente las consultas a esta tabla. + +El Yandex.Metrica es un servicio de análisis web, y el conjunto de datos de muestra no cubre toda su funcionalidad, por lo que solo hay dos tablas para crear: + +- `hits` es una tabla con cada acción realizada por todos los usuarios en todos los sitios web cubiertos por el servicio. +- `visits` es una tabla que contiene sesiones precompiladas en lugar de acciones individuales. + +Veamos y ejecutemos las consultas de tabla de creación real para estas tablas: + +``` sql +CREATE TABLE tutorial.hits_v1 +( + `WatchID` UInt64, + `JavaEnable` UInt8, + `Title` String, + `GoodEvent` Int16, + `EventTime` DateTime, + `EventDate` Date, + `CounterID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RegionID` UInt32, + `UserID` UInt64, + `CounterClass` Int8, + `OS` UInt8, + `UserAgent` UInt8, + `URL` String, + `Referer` String, + `URLDomain` String, + `RefererDomain` String, + `Refresh` UInt8, + `IsRobot` UInt8, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `FlashMinor2` String, + `NetMajor` UInt8, + `NetMinor` UInt8, + `UserAgentMajor` UInt16, + `UserAgentMinor` FixedString(2), + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `MobilePhone` UInt8, + `MobilePhoneModel` String, + `Params` String, + `IPNetworkID` UInt32, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `IsArtifical` UInt8, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `ClientTimeZone` Int16, + `ClientEventTime` DateTime, + `SilverlightVersion1` UInt8, + `SilverlightVersion2` UInt8, + `SilverlightVersion3` UInt32, + `SilverlightVersion4` UInt16, + `PageCharset` String, + `CodeVersion` UInt32, + `IsLink` UInt8, + `IsDownload` UInt8, + `IsNotBounce` UInt8, + `FUniqID` UInt64, + `HID` UInt32, + `IsOldCounter` UInt8, + `IsEvent` UInt8, + `IsParameter` UInt8, + `DontCountHits` UInt8, + `WithHash` UInt8, + `HitColor` FixedString(1), + `UTCEventTime` DateTime, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `WindowName` Int32, + `OpenerName` Int32, + `HistoryLength` Int16, + `BrowserLanguage` FixedString(2), + `BrowserCountry` FixedString(2), + `SocialNetwork` String, + `SocialAction` String, + `HTTPError` UInt16, + `SendTiming` Int32, + `DNSTiming` Int32, + `ConnectTiming` Int32, + `ResponseStartTiming` Int32, + `ResponseEndTiming` Int32, + `FetchTiming` Int32, + `RedirectTiming` Int32, + `DOMInteractiveTiming` Int32, + `DOMContentLoadedTiming` Int32, + `DOMCompleteTiming` Int32, + `LoadEventStartTiming` Int32, + `LoadEventEndTiming` Int32, + `NSToDOMContentLoadedTiming` Int32, + `FirstPaintTiming` Int32, + `RedirectCount` Int8, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `ParamPrice` Int64, + `ParamOrderID` String, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `GoalsReached` Array(UInt32), + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `RefererHash` UInt64, + `URLHash` UInt64, + `CLID` UInt32, + `YCLID` UInt64, + `ShareService` String, + `ShareURL` String, + `ShareTitle` String, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `IslandID` FixedString(16), + `RequestNum` UInt32, + `RequestTry` UInt8 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +``` sql +CREATE TABLE tutorial.visits_v1 +( + `CounterID` UInt32, + `StartDate` Date, + `Sign` Int8, + `IsNew` UInt8, + `VisitID` UInt64, + `UserID` UInt64, + `StartTime` DateTime, + `Duration` UInt32, + `UTCStartTime` DateTime, + `PageViews` Int32, + `Hits` Int32, + `IsBounce` UInt8, + `Referer` String, + `StartURL` String, + `RefererDomain` String, + `StartURLDomain` String, + `EndURL` String, + `LinkURL` String, + `IsDownload` UInt8, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `PlaceID` Int32, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `IsYandex` UInt8, + `GoalReachesDepth` Int32, + `GoalReachesURL` Int32, + `GoalReachesAny` Int32, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `MobilePhoneModel` String, + `ClientEventTime` DateTime, + `RegionID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `IPNetworkID` UInt32, + `SilverlightVersion3` UInt32, + `CodeVersion` UInt32, + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `UserAgentMajor` UInt16, + `UserAgentMinor` UInt16, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `SilverlightVersion2` UInt8, + `SilverlightVersion4` UInt16, + `FlashVersion3` UInt16, + `FlashVersion4` UInt16, + `ClientTimeZone` Int16, + `OS` UInt8, + `UserAgent` UInt8, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `NetMajor` UInt8, + `NetMinor` UInt8, + `MobilePhone` UInt8, + `SilverlightVersion1` UInt8, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `JavaEnable` UInt8, + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `BrowserLanguage` UInt16, + `BrowserCountry` UInt16, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `Params` Array(String), + `Goals` Nested( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32), + `WatchIDs` Array(UInt64), + `ParamSumPrice` Int64, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `ClickLogID` UInt64, + `ClickEventID` Int32, + `ClickGoodEvent` Int32, + `ClickEventTime` DateTime, + `ClickPriorityID` Int32, + `ClickPhraseID` Int32, + `ClickPageID` Int32, + `ClickPlaceID` Int32, + `ClickTypeID` Int32, + `ClickResourceID` Int32, + `ClickCost` UInt32, + `ClickClientIP` UInt32, + `ClickDomainID` UInt32, + `ClickURL` String, + `ClickAttempt` UInt8, + `ClickOrderID` UInt32, + `ClickBannerID` UInt32, + `ClickMarketCategoryID` UInt32, + `ClickMarketPP` UInt32, + `ClickMarketCategoryName` String, + `ClickMarketPPName` String, + `ClickAWAPSCampaignName` String, + `ClickPageName` String, + `ClickTargetType` UInt16, + `ClickTargetPhraseID` UInt64, + `ClickContextType` UInt8, + `ClickSelectType` Int8, + `ClickOptions` String, + `ClickGroupBannerID` Int32, + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `FirstVisit` DateTime, + `PredLastVisit` Date, + `LastVisit` Date, + `TotalVisits` UInt32, + `TraficSource` Nested( + ID Int8, + SearchEngineID UInt16, + AdvEngineID UInt8, + PlaceID UInt16, + SocialSourceNetworkID UInt8, + Domain String, + SearchPhrase String, + SocialSourcePage String), + `Attendance` FixedString(16), + `CLID` UInt32, + `YCLID` UInt64, + `NormalizedRefererHash` UInt64, + `SearchPhraseHash` UInt64, + `RefererDomainHash` UInt64, + `NormalizedStartURLHash` UInt64, + `StartURLDomainHash` UInt64, + `NormalizedEndURLHash` UInt64, + `TopLevelDomain` UInt64, + `URLScheme` UInt64, + `OpenstatServiceNameHash` UInt64, + `OpenstatCampaignIDHash` UInt64, + `OpenstatAdIDHash` UInt64, + `OpenstatSourceIDHash` UInt64, + `UTMSourceHash` UInt64, + `UTMMediumHash` UInt64, + `UTMCampaignHash` UInt64, + `UTMContentHash` UInt64, + `UTMTermHash` UInt64, + `FromHash` UInt64, + `WebVisorEnabled` UInt8, + `WebVisorActivity` UInt32, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `Market` Nested( + Type UInt8, + GoalID UInt32, + OrderID String, + OrderPrice Int64, + PP UInt32, + DirectPlaceID UInt32, + DirectOrderID UInt32, + DirectBannerID UInt32, + GoodID String, + GoodName String, + GoodQuantity Int32, + GoodPrice Int64), + `IslandID` FixedString(16) +) +ENGINE = CollapsingMergeTree(Sign) +PARTITION BY toYYYYMM(StartDate) +ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +Puede ejecutar esas consultas utilizando el modo interactivo de `clickhouse-client` (simplemente ejecútelo en un terminal sin especificar una consulta por adelantado) o pruebe algunos [interfaz alternativa](../interfaces/index.md) Si quieres. + +Como podemos ver, `hits_v1` utiliza el [motor básico MergeTree](../engines/table-engines/mergetree-family/mergetree.md), mientras que el `visits_v1` utiliza el [Derrumbar](../engines/table-engines/mergetree-family/collapsingmergetree.md) variante. + +### Importar Datos {#import-data} + +La importación de datos a ClickHouse se realiza a través de [INSERT INTO](../sql-reference/statements/insert-into.md) consulta como en muchas otras bases de datos SQL. Sin embargo, los datos generalmente se proporcionan en uno de los [Formatos de serialización compatibles](../interfaces/formats.md) en lugar de `VALUES` cláusula (que también es compatible). + +Los archivos que descargamos anteriormente están en formato separado por tabuladores, así que aquí le mostramos cómo importarlos a través del cliente de la consola: + +``` bash +clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv +clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv +``` + +ClickHouse tiene un montón de [ajustes para sintonizar](../operations/settings/index.md) y una forma de especificarlos en el cliente de la consola es a través de argumentos, como podemos ver con `--max_insert_block_size`. La forma más fácil de averiguar qué configuraciones están disponibles, qué significan y cuáles son los valores predeterminados es consultar el `system.settings` tabla: + +``` sql +SELECT name, value, changed, description +FROM system.settings +WHERE name LIKE '%max_insert_b%' +FORMAT TSV + +max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." +``` + +Opcionalmente se puede [OPTIMIZE](../query_language/misc/#misc_operations-optimize) las tablas después de la importación. Las tablas que están configuradas con un motor de la familia MergeTree siempre fusionan partes de datos en segundo plano para optimizar el almacenamiento de datos (o al menos verificar si tiene sentido). Estas consultas obligan al motor de tablas a realizar la optimización del almacenamiento en este momento en lugar de algún tiempo después: + +``` bash +clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" +clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" +``` + +Estas consultas inician una operación intensiva de E / S y CPU, por lo que si la tabla recibe datos nuevos de manera consistente, es mejor dejarlos solos y dejar que las fusiones se ejecuten en segundo plano. + +Ahora podemos comprobar si la importación de la tabla fue exitosa: + +``` bash +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" +``` + +## Consultas De Ejemplo {#example-queries} + +``` sql +SELECT + StartURL AS URL, + AVG(Duration) AS AvgDuration +FROM tutorial.visits_v1 +WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' +GROUP BY URL +ORDER BY AvgDuration DESC +LIMIT 10 +``` + +``` sql +SELECT + sum(Sign) AS visits, + sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, + (100. * goal_visits) / visits AS goal_percent +FROM tutorial.visits_v1 +WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') +``` + +## Implementación De clúster {#cluster-deployment} + +El clúster ClickHouse es un clúster homogéneo. Pasos para configurar: + +1. Instale el servidor ClickHouse en todas las máquinas del clúster +2. Configurar configuraciones de clúster en archivos de configuración +3. Crear tablas locales en cada instancia +4. Crear un [Tabla distribuida](../engines/table-engines/special/distributed.md) + +[Tabla distribuida](../engines/table-engines/special/distributed.md) es en realidad una especie de “view” a las tablas locales del clúster ClickHouse. La consulta SELECT de una tabla distribuida se ejecuta utilizando recursos de todos los fragmentos del clúster. Puede especificar configuraciones para varios clústeres y crear varias tablas distribuidas que proporcionen vistas a diferentes clústeres. + +Ejemplo de configuración para un clúster con tres fragmentos, una réplica cada uno: + +``` xml + + + + + example-perftest01j.yandex.ru + 9000 + + + + + example-perftest02j.yandex.ru + 9000 + + + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +Para más demostraciones, vamos a crear una nueva tabla local con la misma `CREATE TABLE` consulta que utilizamos para `hits_v1`, pero nombre de tabla diferente: + +``` sql +CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... +``` + +Creación de una tabla distribuida que proporcione una vista en las tablas locales del clúster: + +``` sql +CREATE TABLE tutorial.hits_all AS tutorial.hits_local +ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); +``` + +Una práctica común es crear tablas distribuidas similares en todas las máquinas del clúster. Permite ejecutar consultas distribuidas en cualquier máquina del clúster. También hay una opción alternativa para crear una tabla distribuida temporal para una consulta SELECT determinada usando [remoto](../sql-reference/table-functions/remote.md) función de la tabla. + +Vamos a correr [INSERT SELECT](../sql-reference/statements/insert-into.md) en la tabla Distributed para extender la tabla a varios servidores. + +``` sql +INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; +``` + +!!! warning "Aviso" + Este enfoque no es adecuado para la fragmentación de tablas grandes. Hay una herramienta separada [Método de codificación de datos:](../operations/utilities/clickhouse-copier.md) que puede volver a fragmentar tablas grandes arbitrarias. + +Como era de esperar, las consultas computacionalmente pesadas se ejecutan N veces más rápido si utilizan 3 servidores en lugar de uno. + +En este caso, hemos utilizado un clúster con 3 fragmentos, y cada uno contiene una sola réplica. + +Para proporcionar resiliencia en un entorno de producción, se recomienda que cada fragmento contenga 2-3 réplicas distribuidas entre varias zonas de disponibilidad o centros de datos (o al menos racks). Tenga en cuenta que ClickHouse admite un número ilimitado de réplicas. + +Ejemplo de configuración para un clúster de un fragmento que contiene tres réplicas: + +``` xml + + ... + + + + example-perftest01j.yandex.ru + 9000 + + + example-perftest02j.yandex.ru + 9000 + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +Para habilitar la replicación nativa [ZooKeeper](http://zookeeper.apache.org/) se requiere. ClickHouse se encarga de la coherencia de los datos en todas las réplicas y ejecuta el procedimiento de restauración después de la falla automáticamente. Se recomienda implementar el clúster ZooKeeper en servidores independientes (donde no se están ejecutando otros procesos, incluido ClickHouse). + +!!! note "Nota" + ZooKeeper no es un requisito estricto: en algunos casos simples, puede duplicar los datos escribiéndolos en todas las réplicas de su código de aplicación. Este enfoque es **ni** recomendado, en este caso, ClickHouse no podrá garantizar la coherencia de los datos en todas las réplicas. Por lo tanto, se convierte en responsabilidad de su aplicación. + +Las ubicaciones de ZooKeeper se especifican en el archivo de configuración: + +``` xml + + + zoo01.yandex.ru + 2181 + + + zoo02.yandex.ru + 2181 + + + zoo03.yandex.ru + 2181 + + +``` + +Además, necesitamos establecer macros para identificar cada fragmento y réplica que se utilizan en la creación de tablas: + +``` xml + + 01 + 01 + +``` + +Si no hay réplicas en este momento en la creación de la tabla replicada, se crea una instancia de una nueva primera réplica. Si ya hay réplicas activas, la nueva réplica clona los datos de las existentes. Tiene la opción de crear primero todas las tablas replicadas y, a continuación, insertar datos en ella. Otra opción es crear algunas réplicas y agregar las otras después o durante la inserción de datos. + +``` sql +CREATE TABLE tutorial.hits_replica (...) +ENGINE = ReplcatedMergeTree( + '/clickhouse_perftest/tables/{shard}/hits', + '{replica}' +) +... +``` + +Aquí usamos [ReplicatedMergeTree](../engines/table-engines/mergetree-family/replication.md) motor de mesa. En los parámetros, especificamos la ruta ZooKeeper que contiene identificadores de fragmentos y réplicas. + +``` sql +INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; +``` + +La replicación funciona en modo multi-master. Los datos se pueden cargar en cualquier réplica y el sistema los sincroniza automáticamente con otras instancias. La replicación es asíncrona, por lo que en un momento dado, no todas las réplicas pueden contener datos insertados recientemente. Al menos una réplica debe estar disponible para permitir la ingestión de datos. Otros sincronizarán los datos y repararán la coherencia una vez que vuelvan a activarse. Tenga en cuenta que este enfoque permite la baja posibilidad de una pérdida de datos recientemente insertados. + +[Artículo Original](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/es/getting_started/example_datasets/amplab_benchmark.md b/docs/es/getting_started/example_datasets/amplab_benchmark.md deleted file mode 100644 index 79c2c6aea23..00000000000 --- a/docs/es/getting_started/example_datasets/amplab_benchmark.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 17 -toc_title: Referencia de Big Data de AMPLab ---- - -# Referencia de Big Data de AMPLab {#amplab-big-data-benchmark} - -Ver https://amplab.cs.berkeley.edu/benchmark/ - -Regístrese para obtener una cuenta gratuita en https://aws.amazon.com. Requiere una tarjeta de crédito, correo electrónico y número de teléfono. Obtenga una nueva clave de acceso en https://console.aws.amazon.com/iam/home?nc2=h\_m\_sc\#security\_credential - -Ejecute lo siguiente en la consola: - -``` bash -$ sudo apt-get install s3cmd -$ mkdir tiny; cd tiny; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/tiny/ . -$ cd .. -$ mkdir 1node; cd 1node; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/1node/ . -$ cd .. -$ mkdir 5nodes; cd 5nodes; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/5nodes/ . -$ cd .. -``` - -Ejecute las siguientes consultas de ClickHouse: - -``` sql -CREATE TABLE rankings_tiny -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_tiny -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); - -CREATE TABLE rankings_1node -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_1node -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); - -CREATE TABLE rankings_5nodes_on_single -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_5nodes_on_single -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); -``` - -Volver a la consola: - -``` bash -$ for i in tiny/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_tiny FORMAT CSV"; done -$ for i in tiny/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_tiny FORMAT CSV"; done -$ for i in 1node/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_1node FORMAT CSV"; done -$ for i in 1node/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_1node FORMAT CSV"; done -$ for i in 5nodes/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_5nodes_on_single FORMAT CSV"; done -$ for i in 5nodes/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_5nodes_on_single FORMAT CSV"; done -``` - -Consultas para obtener muestras de datos: - -``` sql -SELECT pageURL, pageRank FROM rankings_1node WHERE pageRank > 1000 - -SELECT substring(sourceIP, 1, 8), sum(adRevenue) FROM uservisits_1node GROUP BY substring(sourceIP, 1, 8) - -SELECT - sourceIP, - sum(adRevenue) AS totalRevenue, - avg(pageRank) AS pageRank -FROM rankings_1node ALL INNER JOIN -( - SELECT - sourceIP, - destinationURL AS pageURL, - adRevenue - FROM uservisits_1node - WHERE (visitDate > '1980-01-01') AND (visitDate < '1980-04-01') -) USING pageURL -GROUP BY sourceIP -ORDER BY totalRevenue DESC -LIMIT 1 -``` - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/amplab_benchmark/) diff --git a/docs/es/getting_started/example_datasets/criteo.md b/docs/es/getting_started/example_datasets/criteo.md deleted file mode 100644 index c501599bcc0..00000000000 --- a/docs/es/getting_started/example_datasets/criteo.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 19 -toc_title: Registros de clics de Terabyte de Criteo ---- - -# Terabyte de registros de clics de Criteo {#terabyte-of-click-logs-from-criteo} - -Descargue los datos de http://labs.criteo.com/downloads/download-terabyte-click-logs/ - -Cree una tabla para importar el registro: - -``` sql -CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log -``` - -Descargar los datos: - -``` bash -$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done -``` - -Crear una tabla para los datos convertidos: - -``` sql -CREATE TABLE criteo -( - date Date, - clicked UInt8, - int1 Int32, - int2 Int32, - int3 Int32, - int4 Int32, - int5 Int32, - int6 Int32, - int7 Int32, - int8 Int32, - int9 Int32, - int10 Int32, - int11 Int32, - int12 Int32, - int13 Int32, - icat1 UInt32, - icat2 UInt32, - icat3 UInt32, - icat4 UInt32, - icat5 UInt32, - icat6 UInt32, - icat7 UInt32, - icat8 UInt32, - icat9 UInt32, - icat10 UInt32, - icat11 UInt32, - icat12 UInt32, - icat13 UInt32, - icat14 UInt32, - icat15 UInt32, - icat16 UInt32, - icat17 UInt32, - icat18 UInt32, - icat19 UInt32, - icat20 UInt32, - icat21 UInt32, - icat22 UInt32, - icat23 UInt32, - icat24 UInt32, - icat25 UInt32, - icat26 UInt32 -) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) -``` - -Transforme los datos del registro sin procesar y colóquelos en la segunda tabla: - -``` sql -INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; - -DROP TABLE criteo_log; -``` - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/es/getting_started/example_datasets/index.md b/docs/es/getting_started/example_datasets/index.md deleted file mode 100644 index 7234cbbff39..00000000000 --- a/docs/es/getting_started/example_datasets/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Example Datasets -toc_priority: 12 -toc_title: "Implantaci\xF3n" ---- - -# Datos De Ejemplo {#example-datasets} - -En esta sección se describe cómo obtener conjuntos de datos de ejemplo e importarlos a ClickHouse. -Para algunos conjuntos de datos también están disponibles consultas de ejemplo. - -- [Yandex anonimizado.Conjunto de datos de Metrica](metrica.md) -- [Estrella Schema Benchmark](star_schema.md) -- [Nombre de la red inalámbrica (SSID):](wikistat.md) -- [Terabyte de registros de clics de Criteo](criteo.md) -- [Referencia de Big Data de AMPLab](amplab_benchmark.md) -- [Datos de taxis de Nueva York](nyc_taxi.md) -- [A tiempo](ontime.md) - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/es/getting_started/example_datasets/metrica.md b/docs/es/getting_started/example_datasets/metrica.md deleted file mode 100644 index de0e8f41489..00000000000 --- a/docs/es/getting_started/example_datasets/metrica.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 21 -toc_title: El Yandex.Metrica Datos ---- - -# Yandex anonimizado.Metrica Datos {#anonymized-yandex-metrica-data} - -El conjunto de datos consta de dos tablas que contienen datos anónimos sobre los hits (`hits_v1`) y visitas (`visits_v1`) el Yandex.Métrica. Puedes leer más sobre Yandex.Metrica en [Historial de ClickHouse](../../introduction/history.md) apartado. - -El conjunto de datos consta de dos tablas, cualquiera de ellas se puede descargar como `tsv.xz` o como particiones preparadas. Además, una versión extendida de la `hits` La tabla que contiene 100 millones de filas está disponible como TSV en https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz y como particiones preparadas en https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. - -## Obtención de tablas a partir de particiones preparadas {#obtaining-tables-from-prepared-partitions} - -Descargar e importar tabla de hits: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar -tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -Descargar e importar visitas: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar -tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Obtención de tablas a partir de un archivo TSV comprimido {#obtaining-tables-from-compressed-tsv-file} - -Descargar e importar hits desde un archivo TSV comprimido: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -Descargue e importe visitas desde un archivo tsv comprimido: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Consultas de ejemplo {#example-queries} - -[Tutorial de ClickHouse](../../getting_started/tutorial.md) se basa en Yandex.El conjunto de datos de Metrica y la forma recomendada de comenzar con este conjunto de datos es simplemente pasar por el tutorial. - -Se pueden encontrar ejemplos adicionales de consultas a estas tablas entre [pruebas estatales](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) de ClickHouse (se nombran `test.hists` y `test.visits` alli). diff --git a/docs/es/getting_started/example_datasets/nyc_taxi.md b/docs/es/getting_started/example_datasets/nyc_taxi.md deleted file mode 100644 index 47d54519da6..00000000000 --- a/docs/es/getting_started/example_datasets/nyc_taxi.md +++ /dev/null @@ -1,390 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 16 -toc_title: Datos de taxis de Nueva York ---- - -# Datos de taxis de Nueva York {#new-york-taxi-data} - -Este conjunto de datos se puede obtener de dos maneras: - -- importación de datos sin procesar -- descarga de particiones preparadas - -## Cómo importar los datos sin procesar {#how-to-import-the-raw-data} - -Consulte https://github.com/toddwschneider/nyc-taxi-data y http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html para obtener la descripción de un conjunto de datos e instrucciones para descargar. - -La descarga dará como resultado aproximadamente 227 GB de datos sin comprimir en archivos CSV. La descarga tarda aproximadamente una hora en una conexión de 1 Gbit (la descarga paralela de s3.amazonaws.com recupera al menos la mitad de un canal de 1 Gbit). -Es posible que algunos de los archivos no se descarguen por completo. Verifique los tamaños de archivo y vuelva a descargar cualquiera que parezca dudoso. - -Algunos de los archivos pueden contener filas no válidas. Puede arreglarlos de la siguiente manera: - -``` bash -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ -mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv -mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv -``` - -Entonces los datos deben ser preprocesados en PostgreSQL. Esto creará selecciones de puntos en los polígonos (para hacer coincidir los puntos en el mapa con los distritos de la ciudad de Nueva York) y combinará todos los datos en una única tabla plana desnormalizada mediante el uso de una unión. Para hacer esto, deberá instalar PostgreSQL con soporte PostGIS. - -Tenga cuidado al correr `initialize_database.sh` y volver a verificar manualmente que todas las tablas se crearon correctamente. - -Se tarda entre 20 y 30 minutos en procesar los datos de cada mes en PostgreSQL, por un total de aproximadamente 48 horas. - -Puede comprobar el número de filas descargadas de la siguiente manera: - -``` bash -$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" -## Count - 1298979494 -(1 row) - -real 7m9.164s -``` - -(Esto es un poco más de 1.1 mil millones de filas reportadas por Mark Litwintschik en una serie de publicaciones de blog.) - -Los datos en PostgreSQL utilizan 370 GB de espacio. - -Exportación de los datos de PostgreSQL: - -``` sql -COPY -( - SELECT trips.id, - trips.vendor_id, - trips.pickup_datetime, - trips.dropoff_datetime, - trips.store_and_fwd_flag, - trips.rate_code_id, - trips.pickup_longitude, - trips.pickup_latitude, - trips.dropoff_longitude, - trips.dropoff_latitude, - trips.passenger_count, - trips.trip_distance, - trips.fare_amount, - trips.extra, - trips.mta_tax, - trips.tip_amount, - trips.tolls_amount, - trips.ehail_fee, - trips.improvement_surcharge, - trips.total_amount, - trips.payment_type, - trips.trip_type, - trips.pickup, - trips.dropoff, - - cab_types.type cab_type, - - weather.precipitation_tenths_of_mm rain, - weather.snow_depth_mm, - weather.snowfall_mm, - weather.max_temperature_tenths_degrees_celsius max_temp, - weather.min_temperature_tenths_degrees_celsius min_temp, - weather.average_wind_speed_tenths_of_meters_per_second wind, - - pick_up.gid pickup_nyct2010_gid, - pick_up.ctlabel pickup_ctlabel, - pick_up.borocode pickup_borocode, - pick_up.boroname pickup_boroname, - pick_up.ct2010 pickup_ct2010, - pick_up.boroct2010 pickup_boroct2010, - pick_up.cdeligibil pickup_cdeligibil, - pick_up.ntacode pickup_ntacode, - pick_up.ntaname pickup_ntaname, - pick_up.puma pickup_puma, - - drop_off.gid dropoff_nyct2010_gid, - drop_off.ctlabel dropoff_ctlabel, - drop_off.borocode dropoff_borocode, - drop_off.boroname dropoff_boroname, - drop_off.ct2010 dropoff_ct2010, - drop_off.boroct2010 dropoff_boroct2010, - drop_off.cdeligibil dropoff_cdeligibil, - drop_off.ntacode dropoff_ntacode, - drop_off.ntaname dropoff_ntaname, - drop_off.puma dropoff_puma - FROM trips - LEFT JOIN cab_types - ON trips.cab_type_id = cab_types.id - LEFT JOIN central_park_weather_observations_raw weather - ON weather.date = trips.pickup_datetime::date - LEFT JOIN nyct2010 pick_up - ON pick_up.gid = trips.pickup_nyct2010_gid - LEFT JOIN nyct2010 drop_off - ON drop_off.gid = trips.dropoff_nyct2010_gid -) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; -``` - -La instantánea de datos se crea a una velocidad de aproximadamente 50 MB por segundo. Al crear la instantánea, PostgreSQL lee desde el disco a una velocidad de aproximadamente 28 MB por segundo. -Esto toma alrededor de 5 horas. El archivo TSV resultante es 590612904969 bytes. - -Crear una tabla temporal en ClickHouse: - -``` sql -CREATE TABLE trips -( -trip_id UInt32, -vendor_id String, -pickup_datetime DateTime, -dropoff_datetime Nullable(DateTime), -store_and_fwd_flag Nullable(FixedString(1)), -rate_code_id Nullable(UInt8), -pickup_longitude Nullable(Float64), -pickup_latitude Nullable(Float64), -dropoff_longitude Nullable(Float64), -dropoff_latitude Nullable(Float64), -passenger_count Nullable(UInt8), -trip_distance Nullable(Float64), -fare_amount Nullable(Float32), -extra Nullable(Float32), -mta_tax Nullable(Float32), -tip_amount Nullable(Float32), -tolls_amount Nullable(Float32), -ehail_fee Nullable(Float32), -improvement_surcharge Nullable(Float32), -total_amount Nullable(Float32), -payment_type Nullable(String), -trip_type Nullable(UInt8), -pickup Nullable(String), -dropoff Nullable(String), -cab_type Nullable(String), -precipitation Nullable(UInt8), -snow_depth Nullable(UInt8), -snowfall Nullable(UInt8), -max_temperature Nullable(UInt8), -min_temperature Nullable(UInt8), -average_wind_speed Nullable(UInt8), -pickup_nyct2010_gid Nullable(UInt8), -pickup_ctlabel Nullable(String), -pickup_borocode Nullable(UInt8), -pickup_boroname Nullable(String), -pickup_ct2010 Nullable(String), -pickup_boroct2010 Nullable(String), -pickup_cdeligibil Nullable(FixedString(1)), -pickup_ntacode Nullable(String), -pickup_ntaname Nullable(String), -pickup_puma Nullable(String), -dropoff_nyct2010_gid Nullable(UInt8), -dropoff_ctlabel Nullable(String), -dropoff_borocode Nullable(UInt8), -dropoff_boroname Nullable(String), -dropoff_ct2010 Nullable(String), -dropoff_boroct2010 Nullable(String), -dropoff_cdeligibil Nullable(String), -dropoff_ntacode Nullable(String), -dropoff_ntaname Nullable(String), -dropoff_puma Nullable(String) -) ENGINE = Log; -``` - -Es necesario para convertir campos a tipos de datos más correctos y, si es posible, para eliminar NULL. - -``` bash -$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv - -real 75m56.214s -``` - -Los datos se leen a una velocidad de 112-140 Mb / segundo. -La carga de datos en una tabla de tipos de registro en una secuencia tardó 76 minutos. -Los datos de esta tabla utilizan 142 GB. - -(Importar datos directamente desde Postgres también es posible usando `COPY ... TO PROGRAM`.) - -Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. - -Para empezar, crearemos una tabla en un único servidor. Posteriormente haremos la mesa distribuida. - -Crear y rellenar una tabla de resumen: - -``` sql -CREATE TABLE trips_mergetree -ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -AS SELECT - -trip_id, -CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, -toDate(pickup_datetime) AS pickup_date, -ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, -toDate(dropoff_datetime) AS dropoff_date, -ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, -assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, -assumeNotNull(rate_code_id) AS rate_code_id, -assumeNotNull(pickup_longitude) AS pickup_longitude, -assumeNotNull(pickup_latitude) AS pickup_latitude, -assumeNotNull(dropoff_longitude) AS dropoff_longitude, -assumeNotNull(dropoff_latitude) AS dropoff_latitude, -assumeNotNull(passenger_count) AS passenger_count, -assumeNotNull(trip_distance) AS trip_distance, -assumeNotNull(fare_amount) AS fare_amount, -assumeNotNull(extra) AS extra, -assumeNotNull(mta_tax) AS mta_tax, -assumeNotNull(tip_amount) AS tip_amount, -assumeNotNull(tolls_amount) AS tolls_amount, -assumeNotNull(ehail_fee) AS ehail_fee, -assumeNotNull(improvement_surcharge) AS improvement_surcharge, -assumeNotNull(total_amount) AS total_amount, -CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, -assumeNotNull(trip_type) AS trip_type, -ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, -ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, -CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, - -assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, -toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, -assumeNotNull(pickup_borocode) AS pickup_borocode, -CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, -toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, -toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, -CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, -toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, - -CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, - -toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, - -assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, -toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, -assumeNotNull(dropoff_borocode) AS dropoff_borocode, -CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, -toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, -toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, -CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, -toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, - -CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, - -toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma - -FROM trips -``` - -Esto toma 3030 segundos a una velocidad de aproximadamente 428,000 filas por segundo. -Para cargarlo más rápido, puede crear la tabla con el `Log` motor en lugar de `MergeTree`. En este caso, la descarga funciona más rápido que 200 segundos. - -La tabla utiliza 126 GB de espacio en disco. - -``` sql -SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active -``` - -``` text -┌─formatReadableSize(sum(bytes))─┐ -│ 126.18 GiB │ -└────────────────────────────────┘ -``` - -Entre otras cosas, puede ejecutar la consulta OPTIMIZE en MergeTree. Pero no es necesario ya que todo estará bien sin él. - -## Descarga de Prepared Partitions {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar -$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" -``` - -!!! info "INFO" - Si va a ejecutar las consultas que se describen a continuación, debe usar el nombre completo de la tabla, `datasets.trips_mergetree`. - -## Resultados en un solo servidor {#results-on-single-server} - -Q1: - -``` sql -SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type -``` - -0.490 segundos. - -Q2: - -``` sql -SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count -``` - -1.224 segundos. - -Q3: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year -``` - -2.104 segundos. - -Q4: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) -FROM trips_mergetree -GROUP BY passenger_count, year, distance -ORDER BY year, count(*) DESC -``` - -3.593 segundos. - -Se utilizó el siguiente servidor: - -Dos CPU Intel (R) Xeon (R) E5-2650 v2 @ 2.60GHz, 16 núcleos físicos en total, 128 GiB RAM, 8x6 TB HD en hardware RAID-5 - -El tiempo de ejecución es el mejor de tres carreras. Pero a partir de la segunda ejecución, las consultas leen datos de la memoria caché del sistema de archivos. No se produce más almacenamiento en caché: los datos se leen y procesan en cada ejecución. - -Creación de una tabla en tres servidores: - -En cada servidor: - -``` sql -CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -``` - -En el servidor de origen: - -``` sql -CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) -``` - -La siguiente consulta redistribuye los datos: - -``` sql -INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree -``` - -Esto tarda 2454 segundos. - -En tres servidores: - -Q1: 0.212 segundos. -Q2: 0.438 segundos. -Q3: 0.733 segundos. -Q4: 1.241 segundos. - -No hay sorpresas aquí, ya que las consultas se escalan linealmente. - -También tenemos los resultados de un clúster de 140 servidores: - -Q1: 0,028 seg. -Q2: 0,043 seg. -Q3: 0,051 seg. -Q4: 0,072 seg. - -En este caso, el tiempo de procesamiento de la consulta está determinado sobre todo por la latencia de la red. -Ejecutamos consultas utilizando un cliente ubicado en un centro de datos de Yandex en Finlandia en un clúster en Rusia, que agregó aproximadamente 20 ms de latencia. - -## Resumen {#summary} - -| servidor | Q1 | Q2 | Q3 | Q4 | -|----------|-------|-------|-------|-------| -| 1 | 0.490 | 1.224 | 2.104 | 3.593 | -| 3 | 0.212 | 0.438 | 0.733 | 1.241 | -| 140 | 0.028 | 0.043 | 0.051 | 0.072 | - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/es/getting_started/example_datasets/ontime.md b/docs/es/getting_started/example_datasets/ontime.md deleted file mode 100644 index b471d784138..00000000000 --- a/docs/es/getting_started/example_datasets/ontime.md +++ /dev/null @@ -1,412 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 15 -toc_title: A tiempo ---- - -# A tiempo {#ontime} - -Este conjunto de datos se puede obtener de dos maneras: - -- importación de datos sin procesar -- descarga de particiones preparadas - -## Importar desde datos sin procesar {#import-from-raw-data} - -Descarga de datos: - -``` bash -for s in `seq 1987 2018` -do -for m in `seq 1 12` -do -wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip -done -done -``` - -(a partir de https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) - -Creación de una tabla: - -``` sql -CREATE TABLE `ontime` ( - `Year` UInt16, - `Quarter` UInt8, - `Month` UInt8, - `DayofMonth` UInt8, - `DayOfWeek` UInt8, - `FlightDate` Date, - `UniqueCarrier` FixedString(7), - `AirlineID` Int32, - `Carrier` FixedString(2), - `TailNum` String, - `FlightNum` String, - `OriginAirportID` Int32, - `OriginAirportSeqID` Int32, - `OriginCityMarketID` Int32, - `Origin` FixedString(5), - `OriginCityName` String, - `OriginState` FixedString(2), - `OriginStateFips` String, - `OriginStateName` String, - `OriginWac` Int32, - `DestAirportID` Int32, - `DestAirportSeqID` Int32, - `DestCityMarketID` Int32, - `Dest` FixedString(5), - `DestCityName` String, - `DestState` FixedString(2), - `DestStateFips` String, - `DestStateName` String, - `DestWac` Int32, - `CRSDepTime` Int32, - `DepTime` Int32, - `DepDelay` Int32, - `DepDelayMinutes` Int32, - `DepDel15` Int32, - `DepartureDelayGroups` String, - `DepTimeBlk` String, - `TaxiOut` Int32, - `WheelsOff` Int32, - `WheelsOn` Int32, - `TaxiIn` Int32, - `CRSArrTime` Int32, - `ArrTime` Int32, - `ArrDelay` Int32, - `ArrDelayMinutes` Int32, - `ArrDel15` Int32, - `ArrivalDelayGroups` Int32, - `ArrTimeBlk` String, - `Cancelled` UInt8, - `CancellationCode` FixedString(1), - `Diverted` UInt8, - `CRSElapsedTime` Int32, - `ActualElapsedTime` Int32, - `AirTime` Int32, - `Flights` Int32, - `Distance` Int32, - `DistanceGroup` UInt8, - `CarrierDelay` Int32, - `WeatherDelay` Int32, - `NASDelay` Int32, - `SecurityDelay` Int32, - `LateAircraftDelay` Int32, - `FirstDepTime` String, - `TotalAddGTime` String, - `LongestAddGTime` String, - `DivAirportLandings` String, - `DivReachedDest` String, - `DivActualElapsedTime` String, - `DivArrDelay` String, - `DivDistance` String, - `Div1Airport` String, - `Div1AirportID` Int32, - `Div1AirportSeqID` Int32, - `Div1WheelsOn` String, - `Div1TotalGTime` String, - `Div1LongestGTime` String, - `Div1WheelsOff` String, - `Div1TailNum` String, - `Div2Airport` String, - `Div2AirportID` Int32, - `Div2AirportSeqID` Int32, - `Div2WheelsOn` String, - `Div2TotalGTime` String, - `Div2LongestGTime` String, - `Div2WheelsOff` String, - `Div2TailNum` String, - `Div3Airport` String, - `Div3AirportID` Int32, - `Div3AirportSeqID` Int32, - `Div3WheelsOn` String, - `Div3TotalGTime` String, - `Div3LongestGTime` String, - `Div3WheelsOff` String, - `Div3TailNum` String, - `Div4Airport` String, - `Div4AirportID` Int32, - `Div4AirportSeqID` Int32, - `Div4WheelsOn` String, - `Div4TotalGTime` String, - `Div4LongestGTime` String, - `Div4WheelsOff` String, - `Div4TailNum` String, - `Div5Airport` String, - `Div5AirportID` Int32, - `Div5AirportSeqID` Int32, - `Div5WheelsOn` String, - `Div5TotalGTime` String, - `Div5LongestGTime` String, - `Div5WheelsOff` String, - `Div5TailNum` String -) ENGINE = MergeTree -PARTITION BY Year -ORDER BY (Carrier, FlightDate) -SETTINGS index_granularity = 8192; -``` - -Carga de datos: - -``` bash -$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done -``` - -## Descarga de Prepared Partitions {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar -$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.ontime" -``` - -!!! info "INFO" - Si va a ejecutar las consultas que se describen a continuación, debe usar el nombre completo de la tabla, `datasets.ontime`. - -## Consulta {#queries} - -Q0. - -``` sql -SELECT avg(c1) -FROM -( - SELECT Year, Month, count(*) AS c1 - FROM ontime - GROUP BY Year, Month -); -``` - -Q1. El número de vuelos por día desde el año 2000 hasta 2008 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -Preguntas frecuentes El número de vuelos retrasados por más de 10 minutos, agrupados por el día de la semana, para 2000-2008 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -Q3. El número de retrasos por parte del aeropuerto para 2000-2008 - -``` sql -SELECT Origin, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY Origin -ORDER BY c DESC -LIMIT 10; -``` - -Preguntas más frecuentes Número de retrasos por transportista para 2007 - -``` sql -SELECT Carrier, count(*) -FROM ontime -WHERE DepDelay>10 AND Year=2007 -GROUP BY Carrier -ORDER BY count(*) DESC; -``` - -Q5. El porcentaje de retrasos por transportista para 2007 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year=2007 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year=2007 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Mejor versión de la misma consulta: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year=2007 -GROUP BY Carrier -ORDER BY c3 DESC -``` - -¿por qué? la solicitud anterior de una gama más amplia de años, 2000-2008 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year>=2000 AND Year<=2008 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year>=2000 AND Year<=2008 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Mejor versión de la misma consulta: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY Carrier -ORDER BY c3 DESC; -``` - -Preguntas frecuentes Porcentaje de vuelos retrasados por más de 10 minutos, por año - -``` sql -SELECT Year, c1/c2 -FROM -( - select - Year, - count(*)*100 as c1 - from ontime - WHERE DepDelay>10 - GROUP BY Year -) -JOIN -( - select - Year, - count(*) as c2 - from ontime - GROUP BY Year -) USING (Year) -ORDER BY Year; -``` - -Mejor versión de la misma consulta: - -``` sql -SELECT Year, avg(DepDelay>10)*100 -FROM ontime -GROUP BY Year -ORDER BY Year; -``` - -¿por qué? los destinos más populares por el número de ciudades conectadas directamente para varios rangos de año - -``` sql -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -WHERE Year >= 2000 and Year <= 2010 -GROUP BY DestCityName -ORDER BY u DESC LIMIT 10; -``` - -Q9. - -``` sql -SELECT Year, count(*) AS c1 -FROM ontime -GROUP BY Year; -``` - -Q10. - -``` sql -SELECT - min(Year), max(Year), Carrier, count(*) AS cnt, - sum(ArrDelayMinutes>30) AS flights_delayed, - round(sum(ArrDelayMinutes>30)/count(*),2) AS rate -FROM ontime -WHERE - DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') - AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') - AND FlightDate < '2010-01-01' -GROUP by Carrier -HAVING cnt>100000 and max(Year)>1990 -ORDER by rate DESC -LIMIT 1000; -``` - -Bono: - -``` sql -SELECT avg(cnt) -FROM -( - SELECT Year,Month,count(*) AS cnt - FROM ontime - WHERE DepDel15=1 - GROUP BY Year,Month -); - -SELECT avg(c1) FROM -( - SELECT Year,Month,count(*) AS c1 - FROM ontime - GROUP BY Year,Month -); - -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -GROUP BY DestCityName -ORDER BY u DESC -LIMIT 10; - -SELECT OriginCityName, DestCityName, count() AS c -FROM ontime -GROUP BY OriginCityName, DestCityName -ORDER BY c DESC -LIMIT 10; - -SELECT OriginCityName, count() AS c -FROM ontime -GROUP BY OriginCityName -ORDER BY c DESC -LIMIT 10; -``` - -Esta prueba de rendimiento fue creada por Vadim Tkachenko. Ver: - -- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ -- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ -- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ -- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ -- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ -- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/es/getting_started/example_datasets/wikistat.md b/docs/es/getting_started/example_datasets/wikistat.md deleted file mode 100644 index 064656320f6..00000000000 --- a/docs/es/getting_started/example_datasets/wikistat.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 18 -toc_title: "Nombre de la red inal\xE1mbrica (SSID):" ---- - -# Nombre de la red inalámbrica (SSID): {#wikistat} - -Ver: http://dumps.wikimedia.org/other/pagecounts-raw/ - -Creación de una tabla: - -``` sql -CREATE TABLE wikistat -( - date Date, - time DateTime, - project String, - subproject String, - path String, - hits UInt64, - size UInt64 -) ENGINE = MergeTree(date, (path, time), 8192); -``` - -Carga de datos: - -``` bash -$ for i in {2007..2016}; do for j in {01..12}; do echo $i-$j >&2; curl -sSL "http://dumps.wikimedia.org/other/pagecounts-raw/$i/$i-$j/" | grep -oE 'pagecounts-[0-9]+-[0-9]+\.gz'; done; done | sort | uniq | tee links.txt -$ cat links.txt | while read link; do wget http://dumps.wikimedia.org/other/pagecounts-raw/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1/')/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1-\2/')/$link; done -$ ls -1 /opt/wikistat/ | grep gz | while read i; do echo $i; gzip -cd /opt/wikistat/$i | ./wikistat-loader --time="$(echo -n $i | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2})\.gz/\1-\2-\3 \4-00-00/')" | clickhouse-client --query="INSERT INTO wikistat FORMAT TabSeparated"; done -``` - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/wikistat/) diff --git a/docs/es/getting_started/index.md b/docs/es/getting_started/index.md deleted file mode 100644 index c1d7973a39c..00000000000 --- a/docs/es/getting_started/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Getting Started -toc_hidden: true -toc_priority: 8 -toc_title: oculto ---- - -# Primeros pasos {#getting-started} - -Si eres nuevo en ClickHouse y quieres tener una sensación práctica de su rendimiento, antes que nada, debes pasar por el [proceso de instalación](install.md). Después de eso puedes: - -- [Ir a través de tutorial detallado](tutorial.md) -- [Experimente con conjuntos de datos de ejemplo](example_datasets/ontime.md) - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/es/getting_started/install.md b/docs/es/getting_started/install.md deleted file mode 100644 index 30c9fd41407..00000000000 --- a/docs/es/getting_started/install.md +++ /dev/null @@ -1,191 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 11 -toc_title: "Instalaci\xF3n" ---- - -# Instalación {#installation} - -## Requisitos del sistema {#system-requirements} - -ClickHouse puede ejecutarse en cualquier Linux, FreeBSD o Mac OS X con arquitectura de CPU x86\_64, AArch64 o PowerPC64LE. - -Los binarios oficiales preconstruidos generalmente se compilan para x86\_64 y aprovechan el conjunto de instrucciones SSE 4.2, por lo que, a menos que se indique lo contrario, el uso de la CPU que lo admite se convierte en un requisito adicional del sistema. Aquí está el comando para verificar si la CPU actual tiene soporte para SSE 4.2: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -Para ejecutar ClickHouse en procesadores que no admiten SSE 4.2 o tienen arquitectura AArch64 o PowerPC64LE, debe [construir ClickHouse a partir de fuentes](#from-sources) con los ajustes de configuración adecuados. - -## Opciones de instalación disponibles {#available-installation-options} - -### De paquetes DEB {#install-from-deb-packages} - -Se recomienda utilizar pre-compilado oficial `deb` Paquetes para Debian o Ubuntu. - -Para instalar paquetes oficiales, agregue el repositorio de Yandex en `/etc/apt/sources.list` o en otra `/etc/apt/sources.list.d/clickhouse.list` file: - - deb http://repo.clickhouse.tech/deb/stable/ main/ - -Si desea utilizar la versión más reciente, reemplace `stable` con `testing` (esto se recomienda para sus entornos de prueba). - -A continuación, ejecute estos comandos para instalar paquetes: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -También puede descargar e instalar paquetes manualmente desde aquí: https://repo.yandex.ru/clickhouse/deb/stable/main/. - -#### Paquete {#packages} - -- `clickhouse-common-static` — Installs ClickHouse compiled binary files. -- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` e instala la configuración predeterminada del servidor. -- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` y otras herramientas relacionadas con el cliente. e instala los archivos de configuración del cliente. -- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. - -### De paquetes RPM {#from-rpm-packages} - -Se recomienda utilizar pre-compilado oficial `rpm` También puede utilizar los paquetes para CentOS, RedHat y todas las demás distribuciones de Linux basadas en rpm. - -Primero, necesitas agregar el repositorio oficial: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 -``` - -Si desea utilizar la versión más reciente, reemplace `stable` con `testing` (esto se recomienda para sus entornos de prueba). El `prestable` etiqueta a veces está disponible también. - -A continuación, ejecute estos comandos para instalar paquetes: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -También puede descargar e instalar paquetes manualmente desde aquí: https://repo.casa de clic.tecnología / rpm / estable / x86\_64. - -### De archivos tgz {#from-tgz-archives} - -Se recomienda utilizar pre-compilado oficial `tgz` para todas las distribuciones de Linux, donde la instalación de `deb` o `rpm` paquetes no es posible. - -La versión requerida se puede descargar con `curl` o `wget` desde el repositorio https://repo.yandex.ru/clickhouse/tgz/. -Después de eso, los archivos descargados deben desempaquetarse e instalarse con scripts de instalación. Ejemplo para la última versión: - -``` bash -export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz - -tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz -sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz -sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-server-$LATEST_VERSION.tgz -sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh -sudo /etc/init.d/clickhouse-server start - -tar -xzvf clickhouse-client-$LATEST_VERSION.tgz -sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh -``` - -Para los entornos de producción, se recomienda utilizar las últimas `stable`-versión. Puede encontrar su número en la página de GitHub https://github.com/ClickHouse/ClickHouse/tags con postfix `-stable`. - -### Desde Docker Image {#from-docker-image} - -Para ejecutar ClickHouse dentro de Docker, siga la guía en [Eje de acoplador](https://hub.docker.com/r/yandex/clickhouse-server/). Esas imágenes usan oficial `deb` paquetes dentro. - -### De fuentes {#from-sources} - -Para compilar manualmente ClickHouse, siga las instrucciones para [Linux](../development/build.md) o [Mac OS X](../development/build_osx.md). - -Puede compilar paquetes e instalarlos o usar programas sin instalar paquetes. Además, al construir manualmente, puede deshabilitar el requisito de SSE 4.2 o compilar para CPU AArch64. - - Client: programs/clickhouse-client - Server: programs/clickhouse-server - -Tendrá que crear carpetas de datos y metadatos y `chown` para el usuario deseado. Sus rutas se pueden cambiar en la configuración del servidor (src/programs/server/config.xml), por defecto son: - - /opt/clickhouse/data/default/ - /opt/clickhouse/metadata/default/ - -En Gentoo, puedes usar `emerge clickhouse` para instalar ClickHouse desde fuentes. - -## Lanzar {#launch} - -Para iniciar el servidor como demonio, ejecute: - -``` bash -$ sudo service clickhouse-server start -``` - -Si no tienes `service` comando ejecutar como - -``` bash -$ sudo /etc/init.d/clickhouse-server start -``` - -Vea los registros en el `/var/log/clickhouse-server/` directorio. - -Si el servidor no se inicia, compruebe las configuraciones en el archivo `/etc/clickhouse-server/config.xml`. - -También puede iniciar manualmente el servidor desde la consola: - -``` bash -$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -En este caso, el registro se imprimirá en la consola, lo cual es conveniente durante el desarrollo. -Si el archivo de configuración está en el directorio actual, no es necesario `--config-file` parámetro. De forma predeterminada, utiliza `./config.xml`. - -ClickHouse admite la configuración de restricción de acceso. Están ubicados en el `users.xml` archivo (junto a `config.xml`). -De forma predeterminada, se permite el acceso desde cualquier lugar `default` usuario, sin una contraseña. Ver `user/default/networks`. -Para obtener más información, consulte la sección [“Configuration Files”](../operations/configuration_files.md). - -Después de iniciar el servidor, puede usar el cliente de línea de comandos para conectarse a él: - -``` bash -$ clickhouse-client -``` - -Por defecto, se conecta a `localhost:9000` en nombre del usuario `default` sin una contraseña. También se puede usar para conectarse a un servidor remoto usando `--host` argumento. - -El terminal debe usar codificación UTF-8. -Para obtener más información, consulte la sección [“Command-line client”](../interfaces/cli.md). - -Ejemplo: - -``` bash -$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**Felicidades, el sistema funciona!** - -Para continuar experimentando, puede descargar uno de los conjuntos de datos de prueba o pasar por [tutorial](https://clickhouse.tech/tutorial.html). - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/es/getting_started/playground.md b/docs/es/getting_started/playground.md deleted file mode 100644 index 1314ca679b5..00000000000 --- a/docs/es/getting_started/playground.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 14 -toc_title: Infantil ---- - -# Zona de juegos ClickHouse {#clickhouse-playground} - -[Zona de juegos ClickHouse](https://play.clickhouse.tech?file=welcome) permite a las personas experimentar con ClickHouse ejecutando consultas al instante, sin configurar su servidor o clúster. -Varios conjuntos de datos de ejemplo están disponibles en Playground, así como consultas de ejemplo que muestran las características de ClickHouse. - -Las consultas se ejecutan como un usuario de sólo lectura. Implica algunas limitaciones: - -- No se permiten consultas DDL -- Las consultas INSERT no están permitidas - -También se aplican los siguientes valores: -- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) -- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) -- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) -- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) - -ClickHouse Playground da la experiencia de m2.pequeño -[Servicio administrado para ClickHouse](https://cloud.yandex.com/services/managed-clickhouse) -instancia alojada en [El Yandex.Nube](https://cloud.yandex.com/). -Más información sobre [proveedores de la nube](../commercial/cloud.md). - -La interfaz web de ClickHouse Playground realiza solicitudes a través de ClickHouse [HTTP API](../interfaces/http.md). -El backend Playground es solo un clúster ClickHouse sin ninguna aplicación adicional del lado del servidor. -El punto final HTTPS de ClickHouse también está disponible como parte de Playground. - -Puede realizar consultas al patio de recreo utilizando cualquier cliente HTTP, por ejemplo [rizo](https://curl.haxx.se) o [wget](https://www.gnu.org/software/wget/), o configurar una conexión usando [JDBC](../interfaces/jdbc.md) o [ODBC](../interfaces/odbc.md) controlador. -Más información sobre los productos de software compatibles con ClickHouse está disponible [aqui](../interfaces/index.md). - -| Parámetro | Valor | -|:------------|:----------------------------------------------| -| Punto final | https://play-api.casa de clic.tecnología:8443 | -| Usuario | `playground` | -| Contraseña | `clickhouse` | - -Tenga en cuenta que este extremo requiere una conexión segura. - -Ejemplo: - -``` bash -curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" -``` diff --git a/docs/es/getting_started/tutorial.md b/docs/es/getting_started/tutorial.md deleted file mode 100644 index c9580e4d245..00000000000 --- a/docs/es/getting_started/tutorial.md +++ /dev/null @@ -1,671 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 12 -toc_title: Tutorial ---- - -# Tutorial de ClickHouse {#clickhouse-tutorial} - -## Qué Esperar de Este Tutorial? {#what-to-expect-from-this-tutorial} - -Al pasar por este tutorial, aprenderá cómo configurar un clúster de ClickHouse simple. Será pequeño, pero tolerante a fallos y escalable. Luego usaremos uno de los conjuntos de datos de ejemplo para llenarlo con datos y ejecutar algunas consultas de demostración. - -## Configuración de nodo único {#single-node-setup} - -Para posponer las complejidades de un entorno distribuido, comenzaremos con la implementación de ClickHouse en un único servidor o máquina virtual. ClickHouse generalmente se instala desde [deb](index.md#install-from-deb-packages) o [RPM](index.md#from-rpm-packages) paquetes, pero hay [alternativa](index.md#from-docker-image) para los sistemas operativos que no los admiten. - -Por ejemplo, ha elegido `deb` paquetes y ejecutado: - -``` bash -sudo apt-get install dirmngr -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 - -echo "deb http://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list -sudo apt-get update - -sudo apt-get install -y clickhouse-server clickhouse-client -``` - -¿qué tenemos en los paquetes que tengo instalados: - -- `clickhouse-client` el paquete contiene [Casa de clics-cliente](../interfaces/cli.md) aplicación, cliente interactivo de la consola ClickHouse. -- `clickhouse-common` El paquete contiene un archivo ejecutable ClickHouse. -- `clickhouse-server` El paquete contiene archivos de configuración para ejecutar ClickHouse como servidor. - -Los archivos de configuración del servidor se encuentran en `/etc/clickhouse-server/`. Antes de ir más lejos, tenga en cuenta el `` elemento en `config.xml`. La ruta determina la ubicación para el almacenamiento de datos, por lo que debe ubicarse en un volumen con gran capacidad de disco; el valor predeterminado es `/var/lib/clickhouse/`. Si desea ajustar la configuración, no es útil editar directamente `config.xml` archivo, teniendo en cuenta que podría ser reescrito en futuras actualizaciones de paquetes. La forma recomendada de anular los elementos de configuración es crear [archivos en config.directorio d](../operations/configuration_files.md) que sirven como “patches” de configuración.XML. - -Como habrás notado, `clickhouse-server` no se inicia automáticamente después de la instalación del paquete. Tampoco se reiniciará automáticamente después de las actualizaciones. La forma en que inicia el servidor depende de su sistema de inicio, por lo general, es: - -``` bash -sudo service clickhouse-server start -``` - -o - -``` bash -sudo /etc/init.d/clickhouse-server start -``` - -La ubicación predeterminada para los registros del servidor es `/var/log/clickhouse-server/`. El servidor está listo para manejar las conexiones de cliente una vez que registra el `Ready for connections` mensaje. - -Una vez que el `clickhouse-server` está en funcionamiento, podemos usar `clickhouse-client` para conectarse al servidor y ejecutar algunas consultas de prueba como `SELECT "Hello, world!";`. - -
- -Consejos rápidos para clickhouse-cliente -Modo interactivo: - -``` bash -clickhouse-client -clickhouse-client --host=... --port=... --user=... --password=... -``` - -Habilitar consultas multilínea: - -``` bash -clickhouse-client -m -clickhouse-client --multiline -``` - -Ejecutar consultas en modo por lotes: - -``` bash -clickhouse-client --query='SELECT 1' -echo 'SELECT 1' | clickhouse-client -clickhouse-client <<< 'SELECT 1' -``` - -Insertar datos de un archivo en el formato especificado: - -``` bash -clickhouse-client --query='INSERT INTO table VALUES' < data.txt -clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv -``` - -
- -## Importar conjunto de datos de muestra {#import-sample-dataset} - -Ahora es el momento de llenar nuestro servidor ClickHouse con algunos datos de muestra. En este tutorial, usaremos los datos anónimos de Yandex.Metrica, el primer servicio que ejecuta ClickHouse en forma de producción antes de que se convirtiera en código abierto (más sobre eso en [sección de historia](../introduction/history.md)). Hay [múltiples formas de importar Yandex.Conjunto de datos de Metrica](example_datasets/metrica.md), y por el bien del tutorial, iremos con el más realista. - -### Descargar y extraer datos de tabla {#download-and-extract-table-data} - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -``` - -Los archivos extraídos tienen un tamaño de aproximadamente 10 GB. - -### Crear tablas {#create-tables} - -Como en la mayoría de los sistemas de gestión de bases de datos, ClickHouse agrupa lógicamente las tablas en “databases”. Hay un `default` base de datos, pero crearemos una nueva llamada `tutorial`: - -``` bash -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" -``` - -La sintaxis para crear tablas es mucho más complicada en comparación con las bases de datos (ver [referencia](../sql_reference/statements/create.md). En general `CREATE TABLE` declaración tiene que especificar tres cosas clave: - -1. Nombre de la tabla que se va a crear. -2. Table schema, i.e. list of columns and their [tipos de datos](../sql_reference/data_types/index.md). -3. [Motor de tabla](../engines/table_engines/index.md) y su configuración, que determina todos los detalles sobre cómo se ejecutarán físicamente las consultas a esta tabla. - -El Yandex.Metrica es un servicio de análisis web, y el conjunto de datos de muestra no cubre toda su funcionalidad, por lo que solo hay dos tablas para crear: - -- `hits` es una tabla con cada acción realizada por todos los usuarios en todos los sitios web cubiertos por el servicio. -- `visits` es una tabla que contiene sesiones precompiladas en lugar de acciones individuales. - -Veamos y ejecutemos las consultas de tabla de creación real para estas tablas: - -``` sql -CREATE TABLE tutorial.hits_v1 -( - `WatchID` UInt64, - `JavaEnable` UInt8, - `Title` String, - `GoodEvent` Int16, - `EventTime` DateTime, - `EventDate` Date, - `CounterID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RegionID` UInt32, - `UserID` UInt64, - `CounterClass` Int8, - `OS` UInt8, - `UserAgent` UInt8, - `URL` String, - `Referer` String, - `URLDomain` String, - `RefererDomain` String, - `Refresh` UInt8, - `IsRobot` UInt8, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `FlashMinor2` String, - `NetMajor` UInt8, - `NetMinor` UInt8, - `UserAgentMajor` UInt16, - `UserAgentMinor` FixedString(2), - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `MobilePhone` UInt8, - `MobilePhoneModel` String, - `Params` String, - `IPNetworkID` UInt32, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `IsArtifical` UInt8, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `ClientTimeZone` Int16, - `ClientEventTime` DateTime, - `SilverlightVersion1` UInt8, - `SilverlightVersion2` UInt8, - `SilverlightVersion3` UInt32, - `SilverlightVersion4` UInt16, - `PageCharset` String, - `CodeVersion` UInt32, - `IsLink` UInt8, - `IsDownload` UInt8, - `IsNotBounce` UInt8, - `FUniqID` UInt64, - `HID` UInt32, - `IsOldCounter` UInt8, - `IsEvent` UInt8, - `IsParameter` UInt8, - `DontCountHits` UInt8, - `WithHash` UInt8, - `HitColor` FixedString(1), - `UTCEventTime` DateTime, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `WindowName` Int32, - `OpenerName` Int32, - `HistoryLength` Int16, - `BrowserLanguage` FixedString(2), - `BrowserCountry` FixedString(2), - `SocialNetwork` String, - `SocialAction` String, - `HTTPError` UInt16, - `SendTiming` Int32, - `DNSTiming` Int32, - `ConnectTiming` Int32, - `ResponseStartTiming` Int32, - `ResponseEndTiming` Int32, - `FetchTiming` Int32, - `RedirectTiming` Int32, - `DOMInteractiveTiming` Int32, - `DOMContentLoadedTiming` Int32, - `DOMCompleteTiming` Int32, - `LoadEventStartTiming` Int32, - `LoadEventEndTiming` Int32, - `NSToDOMContentLoadedTiming` Int32, - `FirstPaintTiming` Int32, - `RedirectCount` Int8, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `ParamPrice` Int64, - `ParamOrderID` String, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `GoalsReached` Array(UInt32), - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `RefererHash` UInt64, - `URLHash` UInt64, - `CLID` UInt32, - `YCLID` UInt64, - `ShareService` String, - `ShareURL` String, - `ShareTitle` String, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `IslandID` FixedString(16), - `RequestNum` UInt32, - `RequestTry` UInt8 -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -``` sql -CREATE TABLE tutorial.visits_v1 -( - `CounterID` UInt32, - `StartDate` Date, - `Sign` Int8, - `IsNew` UInt8, - `VisitID` UInt64, - `UserID` UInt64, - `StartTime` DateTime, - `Duration` UInt32, - `UTCStartTime` DateTime, - `PageViews` Int32, - `Hits` Int32, - `IsBounce` UInt8, - `Referer` String, - `StartURL` String, - `RefererDomain` String, - `StartURLDomain` String, - `EndURL` String, - `LinkURL` String, - `IsDownload` UInt8, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `PlaceID` Int32, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `IsYandex` UInt8, - `GoalReachesDepth` Int32, - `GoalReachesURL` Int32, - `GoalReachesAny` Int32, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `MobilePhoneModel` String, - `ClientEventTime` DateTime, - `RegionID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `IPNetworkID` UInt32, - `SilverlightVersion3` UInt32, - `CodeVersion` UInt32, - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `UserAgentMajor` UInt16, - `UserAgentMinor` UInt16, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `SilverlightVersion2` UInt8, - `SilverlightVersion4` UInt16, - `FlashVersion3` UInt16, - `FlashVersion4` UInt16, - `ClientTimeZone` Int16, - `OS` UInt8, - `UserAgent` UInt8, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `NetMajor` UInt8, - `NetMinor` UInt8, - `MobilePhone` UInt8, - `SilverlightVersion1` UInt8, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `JavaEnable` UInt8, - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `BrowserLanguage` UInt16, - `BrowserCountry` UInt16, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `Params` Array(String), - `Goals` Nested( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32), - `WatchIDs` Array(UInt64), - `ParamSumPrice` Int64, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `ClickLogID` UInt64, - `ClickEventID` Int32, - `ClickGoodEvent` Int32, - `ClickEventTime` DateTime, - `ClickPriorityID` Int32, - `ClickPhraseID` Int32, - `ClickPageID` Int32, - `ClickPlaceID` Int32, - `ClickTypeID` Int32, - `ClickResourceID` Int32, - `ClickCost` UInt32, - `ClickClientIP` UInt32, - `ClickDomainID` UInt32, - `ClickURL` String, - `ClickAttempt` UInt8, - `ClickOrderID` UInt32, - `ClickBannerID` UInt32, - `ClickMarketCategoryID` UInt32, - `ClickMarketPP` UInt32, - `ClickMarketCategoryName` String, - `ClickMarketPPName` String, - `ClickAWAPSCampaignName` String, - `ClickPageName` String, - `ClickTargetType` UInt16, - `ClickTargetPhraseID` UInt64, - `ClickContextType` UInt8, - `ClickSelectType` Int8, - `ClickOptions` String, - `ClickGroupBannerID` Int32, - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `FirstVisit` DateTime, - `PredLastVisit` Date, - `LastVisit` Date, - `TotalVisits` UInt32, - `TraficSource` Nested( - ID Int8, - SearchEngineID UInt16, - AdvEngineID UInt8, - PlaceID UInt16, - SocialSourceNetworkID UInt8, - Domain String, - SearchPhrase String, - SocialSourcePage String), - `Attendance` FixedString(16), - `CLID` UInt32, - `YCLID` UInt64, - `NormalizedRefererHash` UInt64, - `SearchPhraseHash` UInt64, - `RefererDomainHash` UInt64, - `NormalizedStartURLHash` UInt64, - `StartURLDomainHash` UInt64, - `NormalizedEndURLHash` UInt64, - `TopLevelDomain` UInt64, - `URLScheme` UInt64, - `OpenstatServiceNameHash` UInt64, - `OpenstatCampaignIDHash` UInt64, - `OpenstatAdIDHash` UInt64, - `OpenstatSourceIDHash` UInt64, - `UTMSourceHash` UInt64, - `UTMMediumHash` UInt64, - `UTMCampaignHash` UInt64, - `UTMContentHash` UInt64, - `UTMTermHash` UInt64, - `FromHash` UInt64, - `WebVisorEnabled` UInt8, - `WebVisorActivity` UInt32, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `Market` Nested( - Type UInt8, - GoalID UInt32, - OrderID String, - OrderPrice Int64, - PP UInt32, - DirectPlaceID UInt32, - DirectOrderID UInt32, - DirectBannerID UInt32, - GoodID String, - GoodName String, - GoodQuantity Int32, - GoodPrice Int64), - `IslandID` FixedString(16) -) -ENGINE = CollapsingMergeTree(Sign) -PARTITION BY toYYYYMM(StartDate) -ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -Puede ejecutar esas consultas utilizando el modo interactivo de `clickhouse-client` (simplemente ejecútelo en un terminal sin especificar una consulta por adelantado) o pruebe algunos [interfaz alternativa](../interfaces/index.md) Si quieres. - -Como podemos ver, `hits_v1` utiliza el [motor básico MergeTree](../engines/table_engines/mergetree_family/mergetree.md), mientras que el `visits_v1` utiliza el [Derrumbar](../engines/table_engines/mergetree_family/collapsingmergetree.md) variante. - -### Importar datos {#import-data} - -La importación de datos a ClickHouse se realiza a través de [INSERT INTO](../sql_reference/statements/insert_into.md) consulta como en muchas otras bases de datos SQL. Sin embargo, los datos generalmente se proporcionan en uno de los [Formatos de serialización compatibles](../interfaces/formats.md) en lugar de `VALUES` cláusula (que también es compatible). - -Los archivos que descargamos anteriormente están en formato separado por tabuladores, así que aquí le mostramos cómo importarlos a través del cliente de la consola: - -``` bash -clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv -clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv -``` - -ClickHouse tiene un montón de [ajustes para sintonizar](../operations/settings/index.md) y una forma de especificarlos en el cliente de la consola es a través de argumentos, como podemos ver con `--max_insert_block_size`. La forma más fácil de averiguar qué configuraciones están disponibles, qué significan y cuáles son los valores predeterminados es consultar el `system.settings` tabla: - -``` sql -SELECT name, value, changed, description -FROM system.settings -WHERE name LIKE '%max_insert_b%' -FORMAT TSV - -max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." -``` - -Opcionalmente se puede [OPTIMIZE](../query_language/misc/#misc_operations-optimize) las tablas después de la importación. Las tablas que están configuradas con un motor de la familia MergeTree siempre fusionan partes de datos en segundo plano para optimizar el almacenamiento de datos (o al menos verificar si tiene sentido). Estas consultas obligan al motor de tablas a realizar la optimización del almacenamiento en este momento en lugar de algún tiempo después: - -``` bash -clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" -clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" -``` - -Estas consultas inician una operación intensiva de E / S y CPU, por lo que si la tabla recibe datos nuevos de manera consistente, es mejor dejarlos solos y dejar que las fusiones se ejecuten en segundo plano. - -Ahora podemos comprobar si la importación de la tabla fue exitosa: - -``` bash -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" -``` - -## Consultas de ejemplo {#example-queries} - -``` sql -SELECT - StartURL AS URL, - AVG(Duration) AS AvgDuration -FROM tutorial.visits_v1 -WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' -GROUP BY URL -ORDER BY AvgDuration DESC -LIMIT 10 -``` - -``` sql -SELECT - sum(Sign) AS visits, - sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, - (100. * goal_visits) / visits AS goal_percent -FROM tutorial.visits_v1 -WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') -``` - -## Implementación de clúster {#cluster-deployment} - -El clúster ClickHouse es un clúster homogéneo. Pasos para configurar: - -1. Instale el servidor ClickHouse en todas las máquinas del clúster -2. Configurar configuraciones de clúster en archivos de configuración -3. Crear tablas locales en cada instancia -4. Crear un [Tabla distribuida](../engines/table_engines/special/distributed.md) - -[Tabla distribuida](../engines/table_engines/special/distributed.md) es en realidad una especie de “view” a las tablas locales del clúster ClickHouse. La consulta SELECT de una tabla distribuida se ejecuta utilizando recursos de todos los fragmentos del clúster. Puede especificar configuraciones para varios clústeres y crear varias tablas distribuidas que proporcionen vistas a diferentes clústeres. - -Ejemplo de configuración para un clúster con tres fragmentos, una réplica cada uno: - -``` xml - - - - - example-perftest01j.yandex.ru - 9000 - - - - - example-perftest02j.yandex.ru - 9000 - - - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -Para más demostraciones, vamos a crear una nueva tabla local con la misma `CREATE TABLE` consulta que utilizamos para `hits_v1`, pero nombre de tabla diferente: - -``` sql -CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... -``` - -Creación de una tabla distribuida que proporcione una vista en las tablas locales del clúster: - -``` sql -CREATE TABLE tutorial.hits_all AS tutorial.hits_local -ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); -``` - -Una práctica común es crear tablas distribuidas similares en todas las máquinas del clúster. Permite ejecutar consultas distribuidas en cualquier máquina del clúster. También hay una opción alternativa para crear una tabla distribuida temporal para una consulta SELECT determinada usando [remoto](../sql_reference/table_functions/remote.md) función de la tabla. - -Vamos a correr [INSERT SELECT](../sql_reference/statements/insert_into.md) en la tabla Distributed para extender la tabla a varios servidores. - -``` sql -INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; -``` - -!!! warning "Aviso" - Este enfoque no es adecuado para la fragmentación de tablas grandes. Hay una herramienta separada [Método de codificación de datos:](../operations/utilities/clickhouse-copier.md) que puede volver a fragmentar tablas grandes arbitrarias. - -Como era de esperar, las consultas computacionalmente pesadas se ejecutan N veces más rápido si utilizan 3 servidores en lugar de uno. - -En este caso, hemos utilizado un clúster con 3 fragmentos, y cada uno contiene una sola réplica. - -Para proporcionar resiliencia en un entorno de producción, se recomienda que cada fragmento contenga 2-3 réplicas distribuidas entre varias zonas de disponibilidad o centros de datos (o al menos racks). Tenga en cuenta que ClickHouse admite un número ilimitado de réplicas. - -Ejemplo de configuración para un clúster de un fragmento que contiene tres réplicas: - -``` xml - - ... - - - - example-perftest01j.yandex.ru - 9000 - - - example-perftest02j.yandex.ru - 9000 - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -Para habilitar la replicación nativa [ZooKeeper](http://zookeeper.apache.org/) se requiere. ClickHouse se encarga de la coherencia de los datos en todas las réplicas y ejecuta el procedimiento de restauración después de la falla automáticamente. Se recomienda implementar el clúster ZooKeeper en servidores independientes (donde no se están ejecutando otros procesos, incluido ClickHouse). - -!!! note "Nota" - ZooKeeper no es un requisito estricto: en algunos casos simples, puede duplicar los datos escribiéndolos en todas las réplicas de su código de aplicación. Este enfoque es **ni** recomendado, en este caso, ClickHouse no podrá garantizar la coherencia de los datos en todas las réplicas. Por lo tanto, se convierte en responsabilidad de su aplicación. - -Las ubicaciones de ZooKeeper se especifican en el archivo de configuración: - -``` xml - - - zoo01.yandex.ru - 2181 - - - zoo02.yandex.ru - 2181 - - - zoo03.yandex.ru - 2181 - - -``` - -Además, necesitamos establecer macros para identificar cada fragmento y réplica que se utilizan en la creación de tablas: - -``` xml - - 01 - 01 - -``` - -Si no hay réplicas en este momento en la creación de la tabla replicada, se crea una instancia de una nueva primera réplica. Si ya hay réplicas activas, la nueva réplica clona los datos de las existentes. Tiene la opción de crear primero todas las tablas replicadas y, a continuación, insertar datos en ella. Otra opción es crear algunas réplicas y agregar las otras después o durante la inserción de datos. - -``` sql -CREATE TABLE tutorial.hits_replica (...) -ENGINE = ReplcatedMergeTree( - '/clickhouse_perftest/tables/{shard}/hits', - '{replica}' -) -... -``` - -Aquí usamos [ReplicatedMergeTree](../engines/table_engines/mergetree_family/replication.md) motor de mesa. En los parámetros, especificamos la ruta ZooKeeper que contiene identificadores de fragmentos y réplicas. - -``` sql -INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; -``` - -La replicación funciona en modo multi-master. Los datos se pueden cargar en cualquier réplica y el sistema los sincroniza automáticamente con otras instancias. La replicación es asíncrona, por lo que en un momento dado, no todas las réplicas pueden contener datos insertados recientemente. Al menos una réplica debe estar disponible para permitir la ingestión de datos. Otros sincronizarán los datos y repararán la coherencia una vez que vuelvan a activarse. Tenga en cuenta que este enfoque permite la baja posibilidad de una pérdida de datos recientemente insertados. - -[Artículo Original](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/es/guides/apply-catboost-model.md b/docs/es/guides/apply-catboost-model.md new file mode 100644 index 00000000000..3f9039f68fd --- /dev/null +++ b/docs/es/guides/apply-catboost-model.md @@ -0,0 +1,239 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 41 +toc_title: "Aplicaci\xF3n de modelos CatBoost" +--- + +# Aplicación De Un Modelo Catboost En ClickHouse {#applying-catboost-model-in-clickhouse} + +[CatBoost](https://catboost.ai) es una biblioteca de impulso de gradiente libre y de código abierto desarrollada en [Yandex](https://yandex.com/company/) para el aprendizaje automático. + +Con esta instrucción, aprenderá a aplicar modelos preentrenados en ClickHouse ejecutando la inferencia de modelos desde SQL. + +Para aplicar un modelo CatBoost en ClickHouse: + +1. [Crear una tabla](#create-table). +2. [Insertar los datos en la tabla](#insert-data-to-table). +3. [Integrar CatBoost en ClickHouse](#integrate-catboost-into-clickhouse) (Paso opcional). +4. [Ejecute la inferencia del modelo desde SQL](#run-model-inference). + +Para obtener más información sobre la formación de modelos CatBoost, consulte [Entrenamiento y aplicación de modelos](https://catboost.ai/docs/features/training.html#training). + +## Requisito {#prerequisites} + +Si no tienes el [Acoplador](https://docs.docker.com/install/) sin embargo, instalarlo. + +!!! note "Nota" + [Acoplador](https://www.docker.com) es una plataforma de software que le permite crear contenedores que aíslan una instalación de CatBoost y ClickHouse del resto del sistema. + +Antes de aplicar un modelo CatBoost: + +**1.** Tire de la [Imagen de acoplador](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) del registro: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +Esta imagen de Docker contiene todo lo que necesita para ejecutar CatBoost y ClickHouse: código, tiempo de ejecución, bibliotecas, variables de entorno y archivos de configuración. + +**2.** Asegúrese de que la imagen de Docker se haya extraído correctamente: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** Inicie un contenedor Docker basado en esta imagen: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. Crear una tabla {#create-table} + +Para crear una tabla ClickHouse para el ejemplo de capacitación: + +**1.** Inicie el cliente de consola ClickHouse en el modo interactivo: + +``` bash +$ clickhouse client +``` + +!!! note "Nota" + El servidor ClickHouse ya se está ejecutando dentro del contenedor Docker. + +**2.** Cree la tabla usando el comando: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** Salir del cliente de la consola ClickHouse: + +``` sql +:) exit +``` + +## 2. Insertar los datos en la tabla {#insert-data-to-table} + +Para insertar los datos: + +**1.** Ejecute el siguiente comando: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** Inicie el cliente de consola ClickHouse en el modo interactivo: + +``` bash +$ clickhouse client +``` + +**3.** Asegúrese de que los datos se hayan cargado: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++-------+ +``` + +## 3. Integrar CatBoost en ClickHouse {#integrate-catboost-into-clickhouse} + +!!! note "Nota" + **Paso opcional.** La imagen de Docker contiene todo lo que necesita para ejecutar CatBoost y ClickHouse. + +Para integrar CatBoost en ClickHouse: + +**1.** Construir la biblioteca de evaluación. + +La forma más rápida de evaluar un modelo CatBoost es compilar `libcatboostmodel.` biblioteca. Para obtener más información acerca de cómo construir la biblioteca, vea [Documentación de CatBoost](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** Cree un nuevo directorio en cualquier lugar y con cualquier nombre, por ejemplo, `data` y poner la biblioteca creada en ella. La imagen de Docker ya contiene la biblioteca `data/libcatboostmodel.so`. + +**3.** Cree un nuevo directorio para el modelo de configuración en cualquier lugar y con cualquier nombre, por ejemplo, `models`. + +**4.** Cree un archivo de configuración de modelo con cualquier nombre, por ejemplo, `models/amazon_model.xml`. + +**5.** Describir la configuración del modelo: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** Agregue la ruta de acceso a CatBoost y la configuración del modelo a la configuración de ClickHouse: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. Ejecute la inferencia del modelo desde SQL {#run-model-inference} + +Para el modelo de prueba, ejecute el cliente ClickHouse `$ clickhouse client`. + +Asegurémonos de que el modelo esté funcionando: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Nota" + Función [modelEvaluar](../sql-reference/functions/other-functions.md#function-modelevaluate) devuelve tupla con predicciones sin procesar por clase para modelos multiclase. + +Vamos a predecir la probabilidad: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Nota" + Más información sobre [exp()](../sql-reference/functions/math-functions.md) función. + +Vamos a calcular LogLoss en la muestra: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "Nota" + Más información sobre [avg()](../sql-reference/aggregate-functions/reference.md#agg_function-avg) y [registro()](../sql-reference/functions/math-functions.md) función. + +[Artículo Original](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/es/guides/apply_catboost_model.md b/docs/es/guides/apply_catboost_model.md deleted file mode 100644 index 416ad448da5..00000000000 --- a/docs/es/guides/apply_catboost_model.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 41 -toc_title: "Aplicaci\xF3n de modelos CatBoost" ---- - -# Aplicación de un modelo Catboost en ClickHouse {#applying-catboost-model-in-clickhouse} - -[CatBoost](https://catboost.ai) es una biblioteca de impulso de gradiente libre y de código abierto desarrollada en [Yandex](https://yandex.com/company/) para el aprendizaje automático. - -Con esta instrucción, aprenderá a aplicar modelos preentrenados en ClickHouse ejecutando la inferencia de modelos desde SQL. - -Para aplicar un modelo CatBoost en ClickHouse: - -1. [Crear una tabla](#create-table). -2. [Insertar los datos en la tabla](#insert-data-to-table). -3. [Integrar CatBoost en ClickHouse](#integrate-catboost-into-clickhouse) (Paso opcional). -4. [Ejecute la inferencia del modelo desde SQL](#run-model-inference). - -Para obtener más información sobre la formación de modelos CatBoost, consulte [Entrenamiento y aplicación de modelos](https://catboost.ai/docs/features/training.html#training). - -## Requisito {#prerequisites} - -Si no tienes el [Acoplador](https://docs.docker.com/install/) sin embargo, instalarlo. - -!!! note "Nota" - [Acoplador](https://www.docker.com) es una plataforma de software que le permite crear contenedores que aíslan una instalación de CatBoost y ClickHouse del resto del sistema. - -Antes de aplicar un modelo CatBoost: - -**1.** Tire de la [Imagen de acoplador](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) del registro: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -Esta imagen de Docker contiene todo lo que necesita para ejecutar CatBoost y ClickHouse: código, tiempo de ejecución, bibliotecas, variables de entorno y archivos de configuración. - -**2.** Asegúrese de que la imagen de Docker se haya extraído correctamente: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** Inicie un contenedor Docker basado en esta imagen: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. Crear una tabla {#create-table} - -Para crear una tabla ClickHouse para el ejemplo de capacitación: - -**1.** Inicie el cliente de consola ClickHouse en el modo interactivo: - -``` bash -$ clickhouse client -``` - -!!! note "Nota" - El servidor ClickHouse ya se está ejecutando dentro del contenedor Docker. - -**2.** Cree la tabla usando el comando: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** Salir del cliente de la consola ClickHouse: - -``` sql -:) exit -``` - -## 2. Insertar los datos en la tabla {#insert-data-to-table} - -Para insertar los datos: - -**1.** Ejecute el siguiente comando: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** Inicie el cliente de consola ClickHouse en el modo interactivo: - -``` bash -$ clickhouse client -``` - -**3.** Asegúrese de que los datos se hayan cargado: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+-------+ -``` - -## 3. Integrar CatBoost en ClickHouse {#integrate-catboost-into-clickhouse} - -!!! note "Nota" - **Paso opcional.** La imagen de Docker contiene todo lo que necesita para ejecutar CatBoost y ClickHouse. - -Para integrar CatBoost en ClickHouse: - -**1.** Construir la biblioteca de evaluación. - -La forma más rápida de evaluar un modelo CatBoost es compilar `libcatboostmodel.` biblioteca. Para obtener más información acerca de cómo construir la biblioteca, vea [Documentación de CatBoost](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** Cree un nuevo directorio en cualquier lugar y con cualquier nombre, por ejemplo, `data` y poner la biblioteca creada en ella. La imagen de Docker ya contiene la biblioteca `data/libcatboostmodel.so`. - -**3.** Cree un nuevo directorio para el modelo de configuración en cualquier lugar y con cualquier nombre, por ejemplo, `models`. - -**4.** Cree un archivo de configuración de modelo con cualquier nombre, por ejemplo, `models/amazon_model.xml`. - -**5.** Describir la configuración del modelo: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** Agregue la ruta de acceso a CatBoost y la configuración del modelo a la configuración de ClickHouse: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. Ejecute la inferencia del modelo desde SQL {#run-model-inference} - -Para el modelo de prueba, ejecute el cliente ClickHouse `$ clickhouse client`. - -Asegurémonos de que el modelo esté funcionando: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Nota" - Función [modelEvaluar](../sql_reference/functions/other_functions.md#function-modelevaluate) devuelve tupla con predicciones sin procesar por clase para modelos multiclase. - -Vamos a predecir la probabilidad: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Nota" - Más información sobre [exp()](../sql_reference/functions/math_functions.md) función. - -Vamos a calcular LogLoss en la muestra: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "Nota" - Más información sobre [avg()](../sql_reference/aggregate_functions/reference.md#agg_function-avg) y [registro()](../sql_reference/functions/math_functions.md) función. - -[Artículo Original](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/es/guides/index.md b/docs/es/guides/index.md index 2b410f6db01..e23b26d09ce 100644 --- a/docs/es/guides/index.md +++ b/docs/es/guides/index.md @@ -6,11 +6,11 @@ toc_priority: 38 toc_title: "Descripci\xF3n" --- -# Guías de ClickHouse {#clickhouse-guides} +# Guías De ClickHouse {#clickhouse-guides} Lista de instrucciones detalladas paso a paso que ayudan a resolver varias tareas usando ClickHouse: -- [Tutorial sobre la configuración simple del clúster](../getting_started/tutorial.md) -- [Aplicación de un modelo CatBoost en ClickHouse](apply_catboost_model.md) +- [Tutorial sobre la configuración simple del clúster](../getting-started/tutorial.md) +- [Aplicación de un modelo CatBoost en ClickHouse](apply-catboost-model.md) [Artículo Original](https://clickhouse.tech/docs/en/guides/) diff --git a/docs/es/images/column_oriented.gif b/docs/es/images/column-oriented.gif similarity index 100% rename from docs/es/images/column_oriented.gif rename to docs/es/images/column-oriented.gif diff --git a/docs/es/images/logo.svg b/docs/es/images/logo.svg index 865b96d98c7..17da9417e2d 100644 --- a/docs/es/images/logo.svg +++ b/docs/es/images/logo.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/docs/es/images/row_oriented.gif b/docs/es/images/row-oriented.gif similarity index 100% rename from docs/es/images/row_oriented.gif rename to docs/es/images/row-oriented.gif diff --git a/docs/es/index.md b/docs/es/index.md index 1348ef7013d..73432517622 100644 --- a/docs/es/index.md +++ b/docs/es/index.md @@ -40,7 +40,7 @@ Different orders for storing data are better suited to different scenarios. The Cuanto mayor sea la carga en el sistema, más importante es personalizar el sistema configurado para que coincida con los requisitos del escenario de uso, y más fino será esta personalización. No existe un sistema que sea igualmente adecuado para escenarios significativamente diferentes. Si un sistema es adaptable a un amplio conjunto de escenarios, bajo una carga alta, el sistema manejará todos los escenarios igualmente mal, o funcionará bien para solo uno o algunos de los escenarios posibles. -## Propiedades clave del escenario OLAP {#key-properties-of-olap-scenario} +## Propiedades Clave Del Escenario OLAP {#key-properties-of-olap-scenario} - La gran mayoría de las solicitudes son para acceso de lectura. - Los datos se actualizan en lotes bastante grandes (\> 1000 filas), no por filas individuales; o no se actualiza en absoluto. @@ -58,17 +58,17 @@ Cuanto mayor sea la carga en el sistema, más importante es personalizar el sist Es fácil ver que el escenario OLAP es muy diferente de otros escenarios populares (como el acceso OLTP o Key-Value). Por lo tanto, no tiene sentido intentar usar OLTP o una base de datos de valor clave para procesar consultas analíticas si desea obtener un rendimiento decente. Por ejemplo, si intenta usar MongoDB o Redis para análisis, obtendrá un rendimiento muy bajo en comparación con las bases de datos OLAP. -## Por qué las bases de datos orientadas a columnas funcionan mejor en el escenario OLAP {#why-column-oriented-databases-work-better-in-the-olap-scenario} +## Por qué Las Bases De Datos Orientadas a Columnas Funcionan Mejor En El Escenario OLAP {#why-column-oriented-databases-work-better-in-the-olap-scenario} Las bases de datos orientadas a columnas son más adecuadas para los escenarios OLAP: son al menos 100 veces más rápidas en el procesamiento de la mayoría de las consultas. Las razones se explican en detalle a continuación, pero el hecho es más fácil de demostrar visualmente: **DBMS orientado a filas** -![Row-oriented](images/row_oriented.gif#) +![Row-oriented](images/row-oriented.gif#) **DBMS orientado a columnas** -![Column-oriented](images/column_oriented.gif#) +![Column-oriented](images/column-oriented.gif#) Ver la diferencia? diff --git a/docs/es/interfaces/cli.md b/docs/es/interfaces/cli.md index 058985194e1..625827df333 100644 --- a/docs/es/interfaces/cli.md +++ b/docs/es/interfaces/cli.md @@ -5,11 +5,11 @@ toc_priority: 17 toc_title: "Cliente de l\xEDnea de comandos" --- -# Cliente de línea de comandos {#command-line-client} +# Cliente De línea De Comandos {#command-line-client} ClickHouse proporciona un cliente de línea de comandos nativo: `clickhouse-client`. El cliente admite opciones de línea de comandos y archivos de configuración. Para obtener más información, consulte [Configuración](#interfaces_cli_configuration). -[Instalar](../getting_started/index.md) desde el `clickhouse-client` paquete y ejecútelo con el comando `clickhouse-client`. +[Instalar](../getting-started/index.md) desde el `clickhouse-client` paquete y ejecútelo con el comando `clickhouse-client`. ``` bash $ clickhouse-client @@ -72,7 +72,7 @@ Puede cancelar una consulta larga presionando Ctrl + C. Sin embargo, aún tendr El cliente de línea de comandos permite pasar datos externos (tablas temporales externas) para consultar. Para obtener más información, consulte la sección “External data for query processing”. -### Consultas con parámetros {#cli-queries-with-parameters} +### Consultas Con parámetros {#cli-queries-with-parameters} Puede crear una consulta con parámetros y pasarles valores desde la aplicación cliente. Esto permite evitar formatear consultas con valores dinámicos específicos en el lado del cliente. Por ejemplo: @@ -80,7 +80,7 @@ Puede crear una consulta con parámetros y pasarles valores desde la aplicación $ clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = {parName:Array(UInt16)}" ``` -#### Sintaxis de consulta {#cli-queries-with-parameters-syntax} +#### Sintaxis De Consulta {#cli-queries-with-parameters-syntax} Formatee una consulta como de costumbre, luego coloque los valores que desea pasar de los parámetros de la aplicación a la consulta entre llaves en el siguiente formato: @@ -89,7 +89,7 @@ Formatee una consulta como de costumbre, luego coloque los valores que desea pas ``` - `name` — Placeholder identifier. In the console client it should be used in app parameters as `--param_ = value`. -- `data type` — [Tipo de datos](../sql_reference/data_types/index.md) del valor del parámetro de la aplicación. Por ejemplo, una estructura de datos como `(integer, ('string', integer))` puede tener el `Tuple(UInt8, Tuple(String, UInt8))` tipo de datos (también puede usar otro [entero](../sql_reference/data_types/int_uint.md) tipo). +- `data type` — [Tipo de datos](../sql-reference/data-types/index.md) del valor del parámetro de la aplicación. Por ejemplo, una estructura de datos como `(integer, ('string', integer))` puede tener el `Tuple(UInt8, Tuple(String, UInt8))` tipo de datos (también puede usar otro [entero](../sql-reference/data-types/int-uint.md) tipo). #### Ejemplo {#example} @@ -109,7 +109,7 @@ Puede pasar parámetros a `clickhouse-client` (todos los parámetros tienen un v Los valores de los archivos de configuración anulan los valores predeterminados. -### Opciones de línea de comandos {#command-line-options} +### Opciones De línea De Comandos {#command-line-options} - `--host, -h` -– The server name, ‘localhost’ predeterminada. Puede utilizar el nombre o la dirección IPv4 o IPv6. - `--port` – The port to connect to. Default value: 9000. Note that the HTTP interface and the native interface use different ports. @@ -127,7 +127,7 @@ Puede pasar parámetros a `clickhouse-client` (todos los parámetros tienen un v - `--secure` – If specified, will connect to server over secure connection. - `--param_` — Value for a [consulta con parámetros](#cli-queries-with-parameters). -### Archivos de configuración {#configuration_files} +### Archivos De configuración {#configuration_files} `clickhouse-client` utiliza el primer archivo existente de los siguientes: diff --git a/docs/es/interfaces/cpp.md b/docs/es/interfaces/cpp.md index c854513568a..91630ea95af 100644 --- a/docs/es/interfaces/cpp.md +++ b/docs/es/interfaces/cpp.md @@ -5,7 +5,7 @@ toc_priority: 24 toc_title: Biblioteca de clientes de C++ --- -# Biblioteca de clientes de C++ {#c-client-library} +# Biblioteca De Clientes De C++ {#c-client-library} Ver README en [Bienvenidos](https://github.com/ClickHouse/clickhouse-cpp) repositorio. diff --git a/docs/es/interfaces/formats.md b/docs/es/interfaces/formats.md index fcb700a8968..c6a7a93f0f7 100644 --- a/docs/es/interfaces/formats.md +++ b/docs/es/interfaces/formats.md @@ -5,7 +5,7 @@ toc_priority: 21 toc_title: Formatos de entrada y salida --- -# Formatos para datos de entrada y salida {#formats} +# Formatos Para Datos De Entrada y Salida {#formats} ClickHouse puede aceptar y devolver datos en varios formatos. Se puede utilizar un formato admitido para la entrada para analizar los datos proporcionados a `INSERT`s, para llevar a cabo `SELECT`s de una tabla respaldada por archivos como File, URL o HDFS, o para leer un diccionario externo. Se puede utilizar un formato compatible con la salida para organizar el resultados de un `SELECT`, y realizar `INSERT`s en una tabla respaldada por archivos. @@ -78,7 +78,7 @@ SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORD 2014-03-23 1406958 ``` -### Formato de datos {#data-formatting} +### Formato De Datos {#data-formatting} Los números enteros se escriben en forma decimal. Los números pueden contener un extra “+” carácter al principio (ignorado al analizar y no grabado al formatear). Los números no negativos no pueden contener el signo negativo. Al leer, se permite analizar una cadena vacía como cero, o (para tipos con signo) una cadena que consiste en solo un signo menos como cero. Los números que no encajan en el tipo de datos correspondiente se pueden analizar como un número diferente, sin un mensaje de error. @@ -110,9 +110,9 @@ Solo se escapa un pequeño conjunto de símbolos. Puede tropezar fácilmente con Las matrices se escriben como una lista de valores separados por comas entre corchetes. Los elementos numéricos de la matriz tienen el formato normal. `Date` y `DateTime` están escritos entre comillas simples. Las cadenas se escriben entre comillas simples con las mismas reglas de escape que las anteriores. -[NULL](../sql_reference/syntax.md) se formatea como `\N`. +[NULL](../sql-reference/syntax.md) se formatea como `\N`. -Cada elemento de [Anidar](../sql_reference/data_types/nested_data_structures/nested.md) estructuras se representa como una matriz. +Cada elemento de [Anidar](../sql-reference/data-types/nested-data-structures/nested.md) estructuras se representa como una matriz. Por ejemplo: @@ -332,7 +332,7 @@ SearchPhrase=curtain designs count()=1064 SearchPhrase=baku count()=1000 ``` -[NULL](../sql_reference/syntax.md) se formatea como `\N`. +[NULL](../sql-reference/syntax.md) se formatea como `\N`. ``` sql SELECT * FROM t_null FORMAT TSKV @@ -464,7 +464,7 @@ Si la consulta contiene GROUP BY, rows\_before\_limit\_at\_least es el número e Este formato solo es apropiado para generar un resultado de consulta, pero no para analizar (recuperar datos para insertar en una tabla). -Soporta ClickHouse [NULL](../sql_reference/syntax.md), que se muestra como `null` en la salida JSON. +Soporta ClickHouse [NULL](../sql-reference/syntax.md), que se muestra como `null` en la salida JSON. Ver también el [JSONEachRow](#jsoneachrow) formato. @@ -526,7 +526,7 @@ Al usar este formato, ClickHouse genera filas como objetos JSON separados, delim Al insertar los datos, debe proporcionar un objeto JSON independiente para cada fila. -### Insertar datos {#inserting-data} +### Insertar Datos {#inserting-data} ``` sql INSERT INTO UserActivity FORMAT JSONEachRow {"PageViews":5, "UserID":"4324182021466249494", "Duration":146,"Sign":-1} {"UserID":"4324182021466249494","PageViews":6,"Duration":185,"Sign":1} @@ -541,7 +541,7 @@ ClickHouse ignora los espacios entre los elementos y las comas después de los o **Procesamiento de valores omitidos** -ClickHouse sustituye los valores omitidos por los valores predeterminados para el [tipos de datos](../sql_reference/data_types/index.md). +ClickHouse sustituye los valores omitidos por los valores predeterminados para el [tipos de datos](../sql-reference/data-types/index.md). Si `DEFAULT expr` se especifica, ClickHouse utiliza diferentes reglas de sustitución dependiendo de la [Entrada\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) configuración. @@ -561,7 +561,7 @@ CREATE TABLE IF NOT EXISTS example_table !!! note "Advertencia" Al insertar datos con `insert_sample_with_metadata = 1`, ClickHouse consume más recursos computacionales, en comparación con la inserción con `insert_sample_with_metadata = 0`. -### Selección de datos {#selecting-data} +### Selección De Datos {#selecting-data} Considere el `UserActivity` tabla como un ejemplo: @@ -584,9 +584,9 @@ A diferencia de la [JSON](#json) formato, no hay sustitución de secuencias UTF- !!! note "Nota" Cualquier conjunto de bytes se puede generar en las cadenas. Utilice el `JSONEachRow` si está seguro de que los datos de la tabla se pueden formatear como JSON sin perder ninguna información. -### Uso de estructuras anidadas {#jsoneachrow-nested} +### Uso De Estructuras Anidadas {#jsoneachrow-nested} -Si tienes una mesa con [Anidar](../sql_reference/data_types/nested_data_structures/nested.md) columnas de tipo de datos, puede insertar datos JSON con la misma estructura. Habilite esta función con el [Entrada\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) configuración. +Si tienes una mesa con [Anidar](../sql-reference/data-types/nested-data-structures/nested.md) columnas de tipo de datos, puede insertar datos JSON con la misma estructura. Habilite esta función con el [Entrada\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) configuración. Por ejemplo, considere la siguiente tabla: @@ -645,7 +645,7 @@ SELECT * FROM json_each_row_nested ## Nativo {#native} -El formato más eficiente. Los datos son escritos y leídos por bloques en formato binario. Para cada bloque, el número de filas, número de columnas, nombres y tipos de columnas y partes de columnas de este bloque se registran una tras otra. En otras palabras, este formato es “columnar” – it doesn't convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. +El formato más eficiente. Los datos son escritos y leídos por bloques en formato binario. Para cada bloque, el número de filas, número de columnas, nombres y tipos de columnas y partes de columnas de este bloque se registran una tras otra. En otras palabras, este formato es “columnar” – it doesn’t convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. Puede utilizar este formato para generar rápidamente volcados que sólo pueden ser leídos por el DBMS de ClickHouse. No tiene sentido trabajar con este formato usted mismo. @@ -660,7 +660,7 @@ Salidas de datos como tablas de arte Unicode, también utilizando secuencias de Se dibuja una cuadrícula completa de la tabla, y cada fila ocupa dos líneas en la terminal. Cada bloque de resultados se muestra como una tabla separada. Esto es necesario para que los bloques se puedan generar sin resultados de almacenamiento en búfer (el almacenamiento en búfer sería necesario para calcular previamente el ancho visible de todos los valores). -[NULL](../sql_reference/syntax.md) se emite como `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) se emite como `ᴺᵁᴸᴸ`. Ejemplo (mostrado para el [PrettyCompact](#prettycompact) formato): @@ -747,7 +747,7 @@ Lo mismo que el ajuste anterior. Lo mismo que el ajuste anterior. -## Bienvenido a WordPress. {#prettyspace} +## Bienvenido a WordPress {#prettyspace} Difiere de [PrettyCompact](#prettycompact) en ese espacio en blanco (caracteres de espacio) se usa en lugar de la cuadrícula. @@ -764,7 +764,7 @@ FixedString se representa simplemente como una secuencia de bytes. La matriz se representa como una longitud varint (sin signo [LEB128](https://en.wikipedia.org/wiki/LEB128)), seguido de elementos sucesivos de la matriz. -Para [NULL](../sql_reference/syntax.md#null-literal) soporte, se añade un byte adicional que contiene 1 o 0 antes de cada [NULL](../sql_reference/data_types/nullable.md) valor. Si 1, entonces el valor es `NULL` y este byte se interpreta como un valor separado. Si es 0, el valor después del byte no es `NULL`. +Para [NULL](../sql-reference/syntax.md#null-literal) soporte, se añade un byte adicional que contiene 1 o 0 antes de cada [NULL](../sql-reference/data-types/nullable.md) valor. Si 1, entonces el valor es `NULL` y este byte se interpreta como un valor separado. Si es 0, el valor después del byte no es `NULL`. ## RowBinaryWithNamesAndTypes {#rowbinarywithnamesandtypes} @@ -776,7 +776,7 @@ Similar a [RowBinary](#rowbinary), pero con encabezado añadido: ## Valor {#data-format-values} -Imprime cada fila entre paréntesis. Las filas están separadas por comas. No hay coma después de la última fila. Los valores dentro de los corchetes también están separados por comas. Los números se emiten en formato decimal sin comillas. Las matrices se emiten entre corchetes. Las cadenas, fechas y fechas con horas se generan entre comillas. Las reglas de escape y el análisis son similares a las [TabSeparated](#tabseparated) formato. Durante el formateo, los espacios adicionales no se insertan, pero durante el análisis, se permiten y omiten (excepto los espacios dentro de los valores de la matriz, que no están permitidos). [NULL](../sql_reference/syntax.md) se representa como `NULL`. +Imprime cada fila entre paréntesis. Las filas están separadas por comas. No hay coma después de la última fila. Los valores dentro de los corchetes también están separados por comas. Los números se emiten en formato decimal sin comillas. Las matrices se emiten entre corchetes. Las cadenas, fechas y fechas con horas se generan entre comillas. Las reglas de escape y el análisis son similares a las [TabSeparated](#tabseparated) formato. Durante el formateo, los espacios adicionales no se insertan, pero durante el análisis, se permiten y omiten (excepto los espacios dentro de los valores de la matriz, que no están permitidos). [NULL](../sql-reference/syntax.md) se representa como `NULL`. The minimum set of characters that you need to escape when passing data in Values ​​format: single quotes and backslashes. @@ -788,7 +788,7 @@ Ver también: [input\_format\_values\_interpret\_expressions](../operations/sett Imprime cada valor en una línea independiente con el nombre de la columna especificada. Este formato es conveniente para imprimir solo una o varias filas si cada fila consta de un gran número de columnas. -[NULL](../sql_reference/syntax.md) se emite como `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) se emite como `ᴺᵁᴸᴸ`. Ejemplo: @@ -897,9 +897,9 @@ Las matrices se emiten como `HelloWorld... {some_file.pq} ``` -Para intercambiar datos con Hadoop, puede usar [Motor de mesa HDFS](../engines/table_engines/integrations/hdfs.md). +Para intercambiar datos con Hadoop, puede usar [Motor de mesa HDFS](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} [Apache ORC](https://orc.apache.org/) es un formato de almacenamiento columnar generalizado en el ecosistema Hadoop. Solo puede insertar datos en este formato en ClickHouse. -### Coincidencia de tipos de datos {#data_types-matching-3} +### Coincidencia De Tipos De Datos {#data_types-matching-3} -La siguiente tabla muestra los tipos de datos admitidos y cómo coinciden con ClickHouse [tipos de datos](../sql_reference/data_types/index.md) en `INSERT` consulta. +La siguiente tabla muestra los tipos de datos admitidos y cómo coinciden con ClickHouse [tipos de datos](../sql-reference/data-types/index.md) en `INSERT` consulta. | Tipo de datos ORC (`INSERT`) | Tipo de datos ClickHouse | |------------------------------|------------------------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | -| `DATE32` | [Fecha](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [FechaHora](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [Cadena](../sql_reference/data_types/string.md) | -| `DECIMAL` | [Decimal](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | +| `DATE32` | [Fecha](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [FechaHora](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [Cadena](../sql-reference/data-types/string.md) | +| `DECIMAL` | [Decimal](../sql-reference/data-types/decimal.md) | ClickHouse soporta la precisión configurable de la `Decimal` tipo. El `INSERT` consulta trata el ORC `DECIMAL` tipo como el ClickHouse `Decimal128` tipo. @@ -1174,7 +1174,7 @@ Tipos de datos ORC no admitidos: `DATE32`, `TIME32`, `FIXED_SIZE_BINARY`, `JSON` Los tipos de datos de las columnas de tabla ClickHouse no tienen que coincidir con los campos de datos ORC correspondientes. Al insertar datos, ClickHouse interpreta los tipos de datos de acuerdo con la tabla anterior y luego [elenco](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) los datos al tipo de datos establecido para la columna de tabla ClickHouse. -### Insertar datos {#inserting-data-2} +### Insertar Datos {#inserting-data-2} Puede insertar datos ORC de un archivo en la tabla ClickHouse mediante el siguiente comando: @@ -1182,9 +1182,9 @@ Puede insertar datos ORC de un archivo en la tabla ClickHouse mediante el siguie $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -Para intercambiar datos con Hadoop, puede usar [Motor de mesa HDFS](../engines/table_engines/integrations/hdfs.md). +Para intercambiar datos con Hadoop, puede usar [Motor de mesa HDFS](../engines/table-engines/integrations/hdfs.md). -## Esquema de formato {#formatschema} +## Esquema De Formato {#formatschema} El valor establece el nombre de archivo que contiene el esquema de formato `format_schema`. Es necesario establecer esta configuración cuando se utiliza uno de los formatos `Cap'n Proto` y `Protobuf`. @@ -1198,10 +1198,10 @@ puede contener una ruta de acceso absoluta o una ruta relativa al directorio act Si utiliza el cliente en el [modo por lotes](../interfaces/cli.md#cli_usage), la ruta de acceso al esquema debe ser relativa por razones de seguridad. Si introduce o emite datos a través del [Interfaz HTTP](../interfaces/http.md) el nombre de archivo especificado en el esquema de formato -debe estar ubicado en el directorio especificado en [format\_schema\_path](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) +debe estar ubicado en el directorio especificado en [format\_schema\_path](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) en la configuración del servidor. -## Salto de errores {#skippingerrors} +## Salto De Errores {#skippingerrors} Algunos formatos como `CSV`, `TabSeparated`, `TSKV`, `JSONEachRow`, `Template`, `CustomSeparated` y `Protobuf` puede omitir la fila rota si se produjo un error de análisis y continuar el análisis desde el comienzo de la siguiente fila. Ver [Entrada\_format\_allow\_errors\_num](../operations/settings/settings.md#settings-input_format_allow_errors_num) y [Entrada\_format\_allow\_errors\_ratio](../operations/settings/settings.md#settings-input_format_allow_errors_ratio) configuración. diff --git a/docs/es/interfaces/http.md b/docs/es/interfaces/http.md index a2d32d30acc..f5169b06c47 100644 --- a/docs/es/interfaces/http.md +++ b/docs/es/interfaces/http.md @@ -11,7 +11,7 @@ La interfaz HTTP le permite usar ClickHouse en cualquier plataforma desde cualqu De forma predeterminada, clickhouse-server escucha HTTP en el puerto 8123 (esto se puede cambiar en la configuración). -Si realiza una solicitud GET / sin parámetros, devuelve 200 códigos de respuesta y la cadena que definió en [http\_server\_default\_response](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-http_server_default_response) valor predeterminado “Ok.” (con un avance de línea al final) +Si realiza una solicitud GET / sin parámetros, devuelve 200 códigos de respuesta y la cadena que definió en [http\_server\_default\_response](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-http_server_default_response) valor predeterminado “Ok.” (con un avance de línea al final) ``` bash $ curl 'http://localhost:8123/' @@ -259,7 +259,7 @@ Opcional ‘quota\_key’ parámetro se puede pasar como la clave de cuota (cual La interfaz HTTP permite pasar datos externos (tablas temporales externas) para consultar. Para obtener más información, consulte la sección “External data for query processing”. -## Almacenamiento en búfer de respuesta {#response-buffering} +## Almacenamiento En búfer De Respuesta {#response-buffering} Puede habilitar el almacenamiento en búfer de respuestas en el lado del servidor. El `buffer_size` y `wait_end_of_query` Los parámetros URL se proporcionan para este propósito. @@ -275,7 +275,7 @@ $ curl -sS 'http://localhost:8123/?max_result_bytes=4000000&buffer_size=3000000& Utilice el almacenamiento en búfer para evitar situaciones en las que se produjo un error de procesamiento de consultas después de enviar al cliente el código de respuesta y los encabezados HTTP. En esta situación, se escribe un mensaje de error al final del cuerpo de la respuesta y, en el lado del cliente, el error solo se puede detectar en la etapa de análisis. -### Consultas con parámetros {#cli-queries-with-parameters} +### Consultas Con parámetros {#cli-queries-with-parameters} Puede crear una consulta con parámetros y pasar valores para ellos desde los parámetros de solicitud HTTP correspondientes. Para obtener más información, consulte [Consultas con parámetros para CLI](cli.md#cli-queries-with-parameters). @@ -285,7 +285,7 @@ Puede crear una consulta con parámetros y pasar valores para ellos desde los pa $ curl -sS "
?param_id=2¶m_phrase=test" -d "SELECT * FROM table WHERE int_column = {id:UInt8} and string_column = {phrase:String}" ``` -## Interfaz HTTP predefinida {#predefined_http_interface} +## Interfaz HTTP Predefinida {#predefined_http_interface} ClickHouse admite consultas específicas a través de la interfaz HTTP. Por ejemplo, puede escribir datos en una tabla de la siguiente manera: @@ -391,7 +391,7 @@ Ahora `` puede configurar ``, ``, `
% -## Método de codificación de datos: {#ping_handler} +## Método De codificación De Datos: {#ping_handler} `` se puede utilizar para sondear el estado del servidor ClickHouse actual. Cuando el servidor HTTP ClickHouse es normal, acceder a ClickHouse a través de `` volverá **Ok.**. @@ -408,7 +408,7 @@ $ curl 'http://localhost:8123/ping' Ok. ``` -## Sistema abierto. {#replicas_status_handler} +## Sistema Abierto {#replicas_status_handler} `` se utiliza para detectar el estado de la réplica y el nodo de retorno **Ok.** si el nodo de réplica no tiene retraso. Si hay un retraso, devuelva el retraso específico. El valor de `` admite personalización. Si no especifica ``, Configuración predeterminada de ClickHouse `` ser **/replicas\_status**. @@ -434,7 +434,7 @@ $ curl 'http://localhost:8123/replicas_status' db.stats: Absolute delay: 22. Relative delay: 22. ``` -## Dirección de correo electrónico {#predefined_query_handler} +## Dirección De Correo electrónico {#predefined_query_handler} Puede configurar ``, ``, `` y `` en ``. @@ -478,7 +478,7 @@ max_alter_threads 2 !!! note "Nota" En uno ``, una `` sólo es compatible con uno `` de un tipo de plaquita. -## Nombre de la red inalámbrica (SSID): {#dynamic_query_handler} +## Nombre De La Red inalámbrica (SSID): {#dynamic_query_handler} `` que `` aumentar `` . diff --git a/docs/es/interfaces/index.md b/docs/es/interfaces/index.md index 8a15889ab81..5b65e44e46e 100644 --- a/docs/es/interfaces/index.md +++ b/docs/es/interfaces/index.md @@ -22,7 +22,7 @@ En la mayoría de los casos, se recomienda utilizar la herramienta o biblioteca También hay una amplia gama de bibliotecas de terceros para trabajar con ClickHouse: -- [Bibliotecas de clientes](third-party/client_libraries.md) +- [Bibliotecas de clientes](third-party/client-libraries.md) - [Integración](third-party/integrations.md) - [Interfaces visuales](third-party/gui.md) diff --git a/docs/es/interfaces/mysql.md b/docs/es/interfaces/mysql.md index bd4545b46f8..f47b75dadb0 100644 --- a/docs/es/interfaces/mysql.md +++ b/docs/es/interfaces/mysql.md @@ -5,9 +5,9 @@ toc_priority: 20 toc_title: Interfaz MySQL --- -# Interfaz de MySQL {#mysql-interface} +# Interfaz De MySQL {#mysql-interface} -ClickHouse soporta el protocolo de cable MySQL. Puede ser habilitado por [mysql\_port](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) configuración en el archivo de configuración: +ClickHouse soporta el protocolo de cable MySQL. Puede ser habilitado por [mysql\_port](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) configuración en el archivo de configuración: ``` xml 9004 @@ -37,8 +37,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -Para la compatibilidad con todos los clientes MySQL, se recomienda especificar la contraseña de usuario con [doble SHA1](../operations/settings/settings_users.md#password_double_sha1_hex) en el archivo de configuración. -Si la contraseña de usuario se especifica usando [SHA256](../operations/settings/settings_users.md#password_sha256_hex), algunos clientes no podrán autenticarse (mysqljs y versiones antiguas de la herramienta de línea de comandos mysql). +Para la compatibilidad con todos los clientes MySQL, se recomienda especificar la contraseña de usuario con [doble SHA1](../operations/settings/settings-users.md#password_double_sha1_hex) en el archivo de configuración. +Si la contraseña de usuario se especifica usando [SHA256](../operations/settings/settings-users.md#password_sha256_hex), algunos clientes no podrán autenticarse (mysqljs y versiones antiguas de la herramienta de línea de comandos mysql). Restricción: diff --git a/docs/es/interfaces/tcp.md b/docs/es/interfaces/tcp.md index fb304f739da..47395124b13 100644 --- a/docs/es/interfaces/tcp.md +++ b/docs/es/interfaces/tcp.md @@ -5,7 +5,7 @@ toc_priority: 18 toc_title: Interfaz nativa (TCP) --- -# Interfaz nativa (TCP) {#native-interface-tcp} +# Interfaz Nativa (TCP) {#native-interface-tcp} El protocolo nativo se utiliza en el [cliente de línea de comandos](cli.md), para la comunicación entre servidores durante el procesamiento de consultas distribuidas, y también en otros programas de C, Desafortunadamente, el protocolo nativo de ClickHouse aún no tiene especificaciones formales, pero puede ser diseñado de manera inversa desde el código fuente de ClickHouse (comenzando [por aquí](https://github.com/ClickHouse/ClickHouse/tree/master/src/Client)) y/o mediante la interceptación y el análisis del tráfico TCP. diff --git a/docs/es/interfaces/third-party/client-libraries.md b/docs/es/interfaces/third-party/client-libraries.md new file mode 100644 index 00000000000..ad7faab8b96 --- /dev/null +++ b/docs/es/interfaces/third-party/client-libraries.md @@ -0,0 +1,59 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 26 +toc_title: Bibliotecas de clientes +--- + +# Bibliotecas De Clientes De Desarrolladores De Terceros {#client-libraries-from-third-party-developers} + +!!! warning "Descargo" + Yandex hace **ni** mantenga las bibliotecas enumeradas a continuación y no haya realizado ninguna prueba extensa para garantizar su calidad. + +- Película + - [InformaciónSistema abierto.](https://github.com/Infinidat/infi.clickhouse_orm) + - [Casa de clics-conductor](https://github.com/mymarilyn/clickhouse-driver) + - [Casa de clics-cliente](https://github.com/yurial/clickhouse-client) + - [Aiochclient](https://github.com/maximdanilchenko/aiochclient) +- PHP + - [Método de codificación de datos:](https://packagist.org/packages/smi2/phpClickHouse) + - [Sistema abierto.](https://packagist.org/packages/8bitov/clickhouse-php-client) + - [Sistema abierto.](https://packagist.org/packages/bozerkins/clickhouse-client) + - [Sistema abierto.](https://packagist.org/packages/simpod/clickhouse-client) + - [Seva-code/php-click-house-cliente](https://packagist.org/packages/seva-code/php-click-house-client) + - [Cliente de SeasClick C++](https://github.com/SeasX/SeasClick) +- Ve + - [Casa de clics](https://github.com/kshvakov/clickhouse/) + - [Sistema abierto.](https://github.com/roistat/go-clickhouse) + - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/mailru/go-clickhouse) + - [Golang-clickhouse](https://github.com/leprosus/golang-clickhouse) +- NodeJs + - [Casa de clic (NodeJs)](https://github.com/TimonKK/clickhouse) + - [Inicio](https://github.com/apla/node-clickhouse) +- Perl + - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/elcamlost/perl-DBD-ClickHouse) + - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://metacpan.org/release/HTTP-ClickHouse) + - [Cualquier evento-ClickHouse](https://metacpan.org/release/AnyEvent-ClickHouse) +- Rubí + - [Haga clic en Casa (Ruby)](https://github.com/shlima/click_house) + - [clickhouse-activerecord](https://github.com/PNixx/clickhouse-activerecord) +- R + - [Sistema abierto.](https://github.com/hannesmuehleisen/clickhouse-r) + - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/IMSMWU/RClickhouse) +- Java + - [Casa de clic-cliente-java](https://github.com/VirtusAI/clickhouse-client-java) + - [Casa de clics-cliente](https://github.com/Ecwid/clickhouse-client) +- Ciudad + - [Sistema abierto.](https://github.com/crobox/clickhouse-scala-client) +- Bienvenido + - [AORM](https://github.com/TanVD/AORM) +- C\# + - [Sistema abierto.Ado](https://github.com/killwort/ClickHouse-Net) + - [Sistema abierto.Cliente](https://github.com/DarkWanderer/ClickHouse.Client) + - [Sistema abierto.](https://github.com/ilyabreev/ClickHouse.Net) +- Elixir + - [clickhousex](https://github.com/appodeal/clickhousex/) +- Nim + - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/leonardoce/nim-clickhouse) + +[Artículo Original](https://clickhouse.tech/docs/en/interfaces/third-party/client_libraries/) diff --git a/docs/es/interfaces/third-party/client_libraries.md b/docs/es/interfaces/third-party/client_libraries.md deleted file mode 100644 index 31e9afcac91..00000000000 --- a/docs/es/interfaces/third-party/client_libraries.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 26 -toc_title: Bibliotecas de clientes ---- - -# Bibliotecas de clientes de desarrolladores de terceros {#client-libraries-from-third-party-developers} - -!!! warning "Descargo" - Yandex hace **ni** mantenga las bibliotecas enumeradas a continuación y no haya realizado ninguna prueba extensa para garantizar su calidad. - -- Película - - [InformaciónSistema abierto.](https://github.com/Infinidat/infi.clickhouse_orm) - - [Casa de clics-conductor](https://github.com/mymarilyn/clickhouse-driver) - - [Casa de clics-cliente](https://github.com/yurial/clickhouse-client) - - [Aiochclient](https://github.com/maximdanilchenko/aiochclient) -- PHP - - [Método de codificación de datos:](https://packagist.org/packages/smi2/phpClickHouse) - - [Sistema abierto.](https://packagist.org/packages/8bitov/clickhouse-php-client) - - [Sistema abierto.](https://packagist.org/packages/bozerkins/clickhouse-client) - - [Sistema abierto.](https://packagist.org/packages/simpod/clickhouse-client) - - [Seva-code/php-click-house-cliente](https://packagist.org/packages/seva-code/php-click-house-client) - - [Cliente de SeasClick C++](https://github.com/SeasX/SeasClick) -- Ve - - [Casa de clics](https://github.com/kshvakov/clickhouse/) - - [Sistema abierto.](https://github.com/roistat/go-clickhouse) - - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/mailru/go-clickhouse) - - [Golang-clickhouse](https://github.com/leprosus/golang-clickhouse) -- NodeJs - - [Casa de clic (NodeJs)](https://github.com/TimonKK/clickhouse) - - [Inicio](https://github.com/apla/node-clickhouse) -- Perl - - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/elcamlost/perl-DBD-ClickHouse) - - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://metacpan.org/release/HTTP-ClickHouse) - - [Cualquier evento-ClickHouse](https://metacpan.org/release/AnyEvent-ClickHouse) -- Rubí - - [Haga clic en Casa (Ruby)](https://github.com/shlima/click_house) - - [clickhouse-activerecord](https://github.com/PNixx/clickhouse-activerecord) -- R - - [Sistema abierto.](https://github.com/hannesmuehleisen/clickhouse-r) - - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/IMSMWU/RClickhouse) -- Java - - [Casa de clic-cliente-java](https://github.com/VirtusAI/clickhouse-client-java) - - [Casa de clics-cliente](https://github.com/Ecwid/clickhouse-client) -- Ciudad - - [Sistema abierto.](https://github.com/crobox/clickhouse-scala-client) -- Bienvenido - - [AORM](https://github.com/TanVD/AORM) -- C\# - - [Sistema abierto.Ado](https://github.com/killwort/ClickHouse-Net) - - [Sistema abierto.Cliente](https://github.com/DarkWanderer/ClickHouse.Client) - - [Sistema abierto.](https://github.com/ilyabreev/ClickHouse.Net) -- Elixir - - [clickhousex](https://github.com/appodeal/clickhousex/) -- Nim - - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/leonardoce/nim-clickhouse) - -[Artículo Original](https://clickhouse.tech/docs/en/interfaces/third-party/client_libraries/) diff --git a/docs/es/interfaces/third-party/gui.md b/docs/es/interfaces/third-party/gui.md index 9ad60291016..c76a8adba5e 100644 --- a/docs/es/interfaces/third-party/gui.md +++ b/docs/es/interfaces/third-party/gui.md @@ -5,9 +5,9 @@ toc_priority: 28 toc_title: Interfaces Visuales --- -# Interfaces visuales de desarrolladores de terceros {#visual-interfaces-from-third-party-developers} +# Interfaces Visuales De Desarrolladores De Terceros {#visual-interfaces-from-third-party-developers} -## De código abierto {#open-source} +## De código Abierto {#open-source} ### Tabix {#tabix} @@ -23,7 +23,7 @@ Función: [Documentación de Tabix](https://tabix.io/doc/). -### Sistema abierto. {#houseops} +### Sistema Abierto {#houseops} [Sistema abierto.](https://github.com/HouseOps/HouseOps) Es una interfaz de usuario / IDE para OSX, Linux y Windows. @@ -78,7 +78,7 @@ Función: - Vista previa de datos de tabla. - Búsqueda de texto completo. -### Sistema abierto. {#clickhouse-cli} +### Sistema Abierto {#clickhouse-cli} [Sistema abierto.](https://github.com/hatarist/clickhouse-cli) es un cliente de línea de comandos alternativo para ClickHouse, escrito en Python 3. @@ -89,7 +89,7 @@ Función: - Soporte de buscapersonas para la salida de datos. - Comandos similares a PostgreSQL personalizados. -### Sistema abierto. {#clickhouse-flamegraph} +### Sistema Abierto {#clickhouse-flamegraph} [Sistema abierto.](https://github.com/Slach/clickhouse-flamegraph) es una herramienta especializada para visualizar el `system.trace_log` como [Flamegraph](http://www.brendangregg.com/flamegraphs.html). @@ -124,7 +124,7 @@ Nivel de Cifrado WEP [disponible de forma gratuita](https://cloud.yandex.com/doc - [Documentación de DataLens](https://cloud.yandex.com/docs/datalens/). - [Tutorial](https://cloud.yandex.com/docs/solutions/datalens/data-from-ch-visualization) en la visualización de datos de una base de datos ClickHouse. -### Software de Holística {#holistics-software} +### Software De Holística {#holistics-software} [Holística](https://www.holistics.io/) es una plataforma de datos de pila completa y una herramienta de inteligencia de negocios. @@ -145,7 +145,7 @@ Función: - Desarrollo fácil y ágil utilizando LookML, un lenguaje que soporta curado [Modelado de datos](https://looker.com/platform/data-modeling) para apoyar a los redactores de informes y a los usuarios finales. -- Potente integración de flujo de trabajo a través de Looker's [Acciones de datos](https://looker.com/platform/actions). +- Potente integración de flujo de trabajo a través de Looker’s [Acciones de datos](https://looker.com/platform/actions). [Cómo configurar ClickHouse en Looker.](https://docs.looker.com/setup-and-management/database-config/clickhouse) diff --git a/docs/es/interfaces/third-party/integrations.md b/docs/es/interfaces/third-party/integrations.md index d706278a280..83c3204c596 100644 --- a/docs/es/interfaces/third-party/integrations.md +++ b/docs/es/interfaces/third-party/integrations.md @@ -5,12 +5,12 @@ toc_priority: 27 toc_title: "Integraci\xF3n" --- -# Bibliotecas de integración de desarrolladores externos {#integration-libraries-from-third-party-developers} +# Bibliotecas De integración De Desarrolladores Externos {#integration-libraries-from-third-party-developers} !!! warning "Descargo" Yandex hace **ni** mantenga las herramientas y bibliotecas que se enumeran a continuación y no haya realizado ninguna prueba extensa para garantizar su calidad. -## Productos de infraestructura {#infrastructure-products} +## Productos De Infraestructura {#infrastructure-products} - Sistemas de gestión de bases de datos relacionales - [MySQL](https://www.mysql.com) @@ -45,7 +45,7 @@ toc_title: "Integraci\xF3n" - [graphouse](https://github.com/yandex/graphouse) - [de carbono-clickhouse](https://github.com/lomik/carbon-clickhouse) + - [Sistema abierto.](https://github.com/lomik/graphite-clickhouse) - - [Grafito-ch-optimizador](https://github.com/innogames/graphite-ch-optimizer) - optimiza las particiones [\*GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) reglas de [Configuración de rollup](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) podría ser aplicado + - [Grafito-ch-optimizador](https://github.com/innogames/graphite-ch-optimizer) - optimiza las particiones [\*GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) reglas de [Configuración de rollup](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) podría ser aplicado - [Grafana](https://grafana.com/) - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/Vertamedia/clickhouse-grafana) - [Prometeo](https://prometheus.io/) @@ -70,14 +70,14 @@ toc_title: "Integraci\xF3n" - [MaxMind](https://dev.maxmind.com/geoip/) - [Para que usted pueda encontrar](https://github.com/AlexeyKupershtokh/clickhouse-maxmind-geoip) -## Programación de ecosistemas de lenguaje {#programming-language-ecosystems} +## Programación De Ecosistemas De Lenguaje {#programming-language-ecosystems} - Película - [SQLAlchemy](https://www.sqlalchemy.org) - [sqlalchemy-clickhouse](https://github.com/cloudflare/sqlalchemy-clickhouse) (utilizar [InformaciónSistema abierto.](https://github.com/Infinidat/infi.clickhouse_orm)) - [pandas](https://pandas.pydata.org) - [Pandahouse](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -85,7 +85,7 @@ toc_title: "Integraci\xF3n" - [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/IMSMWU/RClickhouse) (utilizar [Bienvenidos](https://github.com/artpaul/clickhouse-cpp)) - Java - [Hadoop](http://hadoop.apache.org) - - [Sistema abierto.](https://github.com/jaykelin/clickhouse-hdfs-loader) (utilizar [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [Sistema abierto.](https://github.com/jaykelin/clickhouse-hdfs-loader) (utilizar [JDBC](../../sql-reference/table-functions/jdbc.md)) - Ciudad - [Akka](https://akka.io) - [Sistema abierto.](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/es/interfaces/third-party/proxy.md b/docs/es/interfaces/third-party/proxy.md index 6c83d97a747..c4b1c02b83a 100644 --- a/docs/es/interfaces/third-party/proxy.md +++ b/docs/es/interfaces/third-party/proxy.md @@ -5,7 +5,7 @@ toc_priority: 29 toc_title: Proxy --- -# Servidores proxy de desarrolladores de terceros {#proxy-servers-from-third-party-developers} +# Servidores Proxy De Desarrolladores De Terceros {#proxy-servers-from-third-party-developers} ## chproxy {#chproxy} @@ -19,7 +19,7 @@ Función: Implementado en Go. -## Bienvenido a WordPress. {#kittenhouse} +## Bienvenido a WordPress {#kittenhouse} [Bienvenido a WordPress.](https://github.com/VKCOM/kittenhouse) está diseñado para ser un proxy local entre ClickHouse y el servidor de aplicaciones en caso de que sea imposible o inconveniente almacenar los datos INSERT en el lado de su aplicación. @@ -31,7 +31,7 @@ Función: Implementado en Go. -## Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica {#clickhouse-bulk} +## Bienvenidos Al Portal De Licitación Electrónica De Licitación Electrónica {#clickhouse-bulk} [Bienvenidos al Portal de Licitación Electrónica de Licitación Electrónica](https://github.com/nikepan/clickhouse-bulk) es un simple colector de insertos ClickHouse. diff --git a/docs/es/introduction/adopters.md b/docs/es/introduction/adopters.md index 822946a421b..4f87a8db46c 100644 --- a/docs/es/introduction/adopters.md +++ b/docs/es/introduction/adopters.md @@ -5,7 +5,7 @@ toc_priority: 8 toc_title: Adoptante --- -# Adoptadores de ClickHouse {#clickhouse-adopters} +# Adoptadores De ClickHouse {#clickhouse-adopters} !!! warning "Descargo" La siguiente lista de empresas que utilizan ClickHouse y sus historias de éxito se recopila a partir de fuentes públicas, por lo que podría diferir de la realidad actual. Le agradeceríamos que compartiera la historia de adoptar ClickHouse en su empresa y [agregarlo a la lista](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/introduction/adopters.md), pero por favor asegúrese de que usted no tendrá ningunos problemas de NDA haciendo así. Proporcionar actualizaciones con publicaciones de otras compañías también es útil. diff --git a/docs/es/introduction/distinctive-features.md b/docs/es/introduction/distinctive-features.md new file mode 100644 index 00000000000..370d85e7c1b --- /dev/null +++ b/docs/es/introduction/distinctive-features.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 4 +toc_title: "Caracter\xEDsticas distintivas" +--- + +# Características Distintivas De ClickHouse {#distinctive-features-of-clickhouse} + +## DBMS Orientado a Columnas Verdaderas {#true-column-oriented-dbms} + +En un verdadero DBMS orientado a columnas, no se almacenan datos adicionales con los valores. Entre otras cosas, esto significa que los valores de longitud constante deben ser compatibles, para evitar almacenar su longitud “number” al lado de los valores. Como ejemplo, mil millones de valores de tipo UInt8 deberían consumir alrededor de 1 GB sin comprimir, o esto afecta fuertemente el uso de la CPU. Es esencial almacenar los datos de forma compacta (sin “garbage”) incluso sin comprimir, ya que la velocidad de descompresión (uso de CPU) depende principalmente del volumen de datos sin comprimir. + +Vale la pena señalar porque hay sistemas que pueden almacenar valores de diferentes columnas por separado, pero que no pueden procesar efectivamente las consultas analíticas debido a su optimización para otros escenarios. Los ejemplos son HBase, BigTable, Cassandra e HyperTable. En estos sistemas, obtendría un rendimiento de alrededor de cien mil filas por segundo, pero no cientos de millones de filas por segundo. + +También vale la pena señalar que ClickHouse es un sistema de administración de bases de datos, no una sola base de datos. ClickHouse permite crear tablas y bases de datos en tiempo de ejecución, cargar datos y ejecutar consultas sin volver a configurar y reiniciar el servidor. + +## Compresión De Datos {#data-compression} + +Algunos DBMS orientados a columnas (InfiniDB CE y MonetDB) no utilizan la compresión de datos. Sin embargo, la compresión de datos juega un papel clave para lograr un rendimiento excelente. + +## Almacenamiento En Disco De Datos {#disk-storage-of-data} + +Mantener los datos físicamente ordenados por clave principal permite extraer datos para sus valores específicos o rangos de valores con baja latencia, menos de unas pocas docenas de milisegundos. Algunos DBMS orientados a columnas (como SAP HANA y Google PowerDrill) solo pueden funcionar en RAM. Este enfoque fomenta la asignación de un presupuesto de hardware más grande que el necesario para el análisis en tiempo real. ClickHouse está diseñado para funcionar en discos duros normales, lo que significa que el costo por GB de almacenamiento de datos es bajo, pero SSD y RAM adicional también se utilizan completamente si están disponibles. + +## Procesamiento Paralelo En Varios núcleos {#parallel-processing-on-multiple-cores} + +Las consultas grandes se paralelizan naturalmente, tomando todos los recursos necesarios disponibles en el servidor actual. + +## Procesamiento Distribuido En Varios Servidores {#distributed-processing-on-multiple-servers} + +Casi ninguno de los DBMS columnar mencionados anteriormente tiene soporte para el procesamiento de consultas distribuidas. +En ClickHouse, los datos pueden residir en diferentes fragmentos. Cada fragmento puede ser un grupo de réplicas utilizadas para la tolerancia a errores. Todos los fragmentos se utilizan para ejecutar una consulta en paralelo, de forma transparente para el usuario. + +## Soporte SQL {#sql-support} + +ClickHouse admite un lenguaje de consulta declarativo basado en SQL que es idéntico al estándar SQL en muchos casos. +Las consultas admitidas incluyen GROUP BY, ORDER BY, subconsultas en cláusulas FROM, IN y JOIN y subconsultas escalares. +No se admiten subconsultas y funciones de ventana dependientes. + +## Motor Del Vector {#vector-engine} + +Los datos no solo se almacenan mediante columnas, sino que se procesan mediante vectores (partes de columnas), lo que permite lograr una alta eficiencia de CPU. + +## Actualizaciones De Datos En Tiempo Real {#real-time-data-updates} + +ClickHouse admite tablas con una clave principal. Para realizar consultas rápidamente en el rango de la clave principal, los datos se ordenan de forma incremental utilizando el árbol de combinación. Debido a esto, los datos se pueden agregar continuamente a la tabla. No se toman bloqueos cuando se ingieren nuevos datos. + +## Indice {#index} + +Tener un dato ordenado físicamente por clave principal permite extraer datos para sus valores específicos o rangos de valores con baja latencia, menos de unas pocas docenas de milisegundos. + +## Adecuado Para Consultas En línea {#suitable-for-online-queries} + +La baja latencia significa que las consultas se pueden procesar sin demora y sin intentar preparar una respuesta por adelantado, justo en el mismo momento mientras se carga la página de la interfaz de usuario. En otras palabras, en línea. + +## Soporte Para cálculos Aproximados {#support-for-approximated-calculations} + +ClickHouse proporciona varias formas de intercambiar precisión por rendimiento: + +1. Funciones agregadas para el cálculo aproximado del número de valores distintos, medianas y cuantiles. +2. Ejecutar una consulta basada en una parte (muestra) de datos y obtener un resultado aproximado. En este caso, se recuperan proporcionalmente menos datos del disco. +3. Ejecutar una agregación para un número limitado de claves aleatorias, en lugar de para todas las claves. Bajo ciertas condiciones para la distribución de claves en los datos, esto proporciona un resultado razonablemente preciso mientras se utilizan menos recursos. + +## Replicación De Datos y Soporte De Integridad De Datos {#data-replication-and-data-integrity-support} + +ClickHouse utiliza la replicación multi-maestro asincrónica. Después de escribir en cualquier réplica disponible, todas las réplicas restantes recuperan su copia en segundo plano. El sistema mantiene datos idénticos en diferentes réplicas. La recuperación después de la mayoría de las fallas se realiza automáticamente, o semiautomáticamente en casos complejos. + +Para obtener más información, consulte la sección [Replicación de datos](../engines/table-engines/mergetree-family/replication.md). + +## Características Que Pueden Considerarse Desventajas {#clickhouse-features-that-can-be-considered-disadvantages} + +1. No hay transacciones completas. +2. Falta de capacidad para modificar o eliminar datos ya insertados con alta tasa y baja latencia. Hay eliminaciones y actualizaciones por lotes disponibles para limpiar o modificar datos, por ejemplo, para cumplir con [GDPR](https://gdpr-info.eu). +3. El índice disperso hace que ClickHouse no sea tan adecuado para consultas de puntos que recuperan filas individuales por sus claves. + +[Artículo Original](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/es/introduction/distinctive_features.md b/docs/es/introduction/distinctive_features.md deleted file mode 100644 index 82b757341be..00000000000 --- a/docs/es/introduction/distinctive_features.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 4 -toc_title: "Caracter\xEDsticas distintivas" ---- - -# Características distintivas de ClickHouse {#distinctive-features-of-clickhouse} - -## DBMS orientado a columnas verdaderas {#true-column-oriented-dbms} - -En un verdadero DBMS orientado a columnas, no se almacenan datos adicionales con los valores. Entre otras cosas, esto significa que los valores de longitud constante deben ser compatibles, para evitar almacenar su longitud “number” al lado de los valores. Como ejemplo, mil millones de valores de tipo UInt8 deberían consumir alrededor de 1 GB sin comprimir, o esto afecta fuertemente el uso de la CPU. Es esencial almacenar los datos de forma compacta (sin “garbage”) incluso sin comprimir, ya que la velocidad de descompresión (uso de CPU) depende principalmente del volumen de datos sin comprimir. - -Vale la pena señalar porque hay sistemas que pueden almacenar valores de diferentes columnas por separado, pero que no pueden procesar efectivamente las consultas analíticas debido a su optimización para otros escenarios. Los ejemplos son HBase, BigTable, Cassandra e HyperTable. En estos sistemas, obtendría un rendimiento de alrededor de cien mil filas por segundo, pero no cientos de millones de filas por segundo. - -También vale la pena señalar que ClickHouse es un sistema de administración de bases de datos, no una sola base de datos. ClickHouse permite crear tablas y bases de datos en tiempo de ejecución, cargar datos y ejecutar consultas sin volver a configurar y reiniciar el servidor. - -## Compresión de datos {#data-compression} - -Algunos DBMS orientados a columnas (InfiniDB CE y MonetDB) no utilizan la compresión de datos. Sin embargo, la compresión de datos juega un papel clave para lograr un rendimiento excelente. - -## Almacenamiento en disco de datos {#disk-storage-of-data} - -Mantener los datos físicamente ordenados por clave principal permite extraer datos para sus valores específicos o rangos de valores con baja latencia, menos de unas pocas docenas de milisegundos. Algunos DBMS orientados a columnas (como SAP HANA y Google PowerDrill) solo pueden funcionar en RAM. Este enfoque fomenta la asignación de un presupuesto de hardware más grande que el necesario para el análisis en tiempo real. ClickHouse está diseñado para funcionar en discos duros normales, lo que significa que el costo por GB de almacenamiento de datos es bajo, pero SSD y RAM adicional también se utilizan completamente si están disponibles. - -## Procesamiento paralelo en varios núcleos {#parallel-processing-on-multiple-cores} - -Las consultas grandes se paralelizan naturalmente, tomando todos los recursos necesarios disponibles en el servidor actual. - -## Procesamiento distribuido en varios servidores {#distributed-processing-on-multiple-servers} - -Casi ninguno de los DBMS columnar mencionados anteriormente tiene soporte para el procesamiento de consultas distribuidas. -En ClickHouse, los datos pueden residir en diferentes fragmentos. Cada fragmento puede ser un grupo de réplicas utilizadas para la tolerancia a errores. Todos los fragmentos se utilizan para ejecutar una consulta en paralelo, de forma transparente para el usuario. - -## Soporte SQL {#sql-support} - -ClickHouse admite un lenguaje de consulta declarativo basado en SQL que es idéntico al estándar SQL en muchos casos. -Las consultas admitidas incluyen GROUP BY, ORDER BY, subconsultas en cláusulas FROM, IN y JOIN y subconsultas escalares. -No se admiten subconsultas y funciones de ventana dependientes. - -## Motor del vector {#vector-engine} - -Los datos no solo se almacenan mediante columnas, sino que se procesan mediante vectores (partes de columnas), lo que permite lograr una alta eficiencia de CPU. - -## Actualizaciones de datos en tiempo real {#real-time-data-updates} - -ClickHouse admite tablas con una clave principal. Para realizar consultas rápidamente en el rango de la clave principal, los datos se ordenan de forma incremental utilizando el árbol de combinación. Debido a esto, los datos se pueden agregar continuamente a la tabla. No se toman bloqueos cuando se ingieren nuevos datos. - -## Indice {#index} - -Tener un dato ordenado físicamente por clave principal permite extraer datos para sus valores específicos o rangos de valores con baja latencia, menos de unas pocas docenas de milisegundos. - -## Adecuado para consultas en línea {#suitable-for-online-queries} - -La baja latencia significa que las consultas se pueden procesar sin demora y sin intentar preparar una respuesta por adelantado, justo en el mismo momento mientras se carga la página de la interfaz de usuario. En otras palabras, en línea. - -## Soporte para cálculos aproximados {#support-for-approximated-calculations} - -ClickHouse proporciona varias formas de intercambiar precisión por rendimiento: - -1. Funciones agregadas para el cálculo aproximado del número de valores distintos, medianas y cuantiles. -2. Ejecutar una consulta basada en una parte (muestra) de datos y obtener un resultado aproximado. En este caso, se recuperan proporcionalmente menos datos del disco. -3. Ejecutar una agregación para un número limitado de claves aleatorias, en lugar de para todas las claves. Bajo ciertas condiciones para la distribución de claves en los datos, esto proporciona un resultado razonablemente preciso mientras se utilizan menos recursos. - -## Replicación de datos y soporte de integridad de datos {#data-replication-and-data-integrity-support} - -ClickHouse utiliza la replicación multi-maestro asincrónica. Después de escribir en cualquier réplica disponible, todas las réplicas restantes recuperan su copia en segundo plano. El sistema mantiene datos idénticos en diferentes réplicas. La recuperación después de la mayoría de las fallas se realiza automáticamente, o semiautomáticamente en casos complejos. - -Para obtener más información, consulte la sección [Replicación de datos](../engines/table_engines/mergetree_family/replication.md). - -## Características que pueden considerarse desventajas {#clickhouse-features-that-can-be-considered-disadvantages} - -1. No hay transacciones completas. -2. Falta de capacidad para modificar o eliminar datos ya insertados con alta tasa y baja latencia. Hay eliminaciones y actualizaciones por lotes disponibles para limpiar o modificar datos, por ejemplo, para cumplir con [GDPR](https://gdpr-info.eu). -3. El índice disperso hace que ClickHouse no sea tan adecuado para consultas de puntos que recuperan filas individuales por sus claves. - -[Artículo Original](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/es/introduction/history.md b/docs/es/introduction/history.md index d4a6b826822..5c24bac9405 100644 --- a/docs/es/introduction/history.md +++ b/docs/es/introduction/history.md @@ -5,7 +5,7 @@ toc_priority: 7 toc_title: Historia --- -# Historial de ClickHouse {#clickhouse-history} +# Historial De ClickHouse {#clickhouse-history} ClickHouse se ha desarrollado inicialmente para alimentar [El Yandex.Métrica](https://metrica.yandex.com/), [la segunda plataforma de análisis web más grande del mundo](http://w3techs.com/technologies/overview/traffic_analysis/all), y sigue siendo el componente central de este sistema. Con más de 13 billones de registros en la base de datos y más de 20 mil millones de eventos diarios, ClickHouse permite generar informes personalizados sobre la marcha directamente a partir de datos no agregados. Este artículo cubre brevemente los objetivos de ClickHouse en las primeras etapas de su desarrollo. @@ -13,7 +13,7 @@ El Yandex.Metrica construye informes personalizados sobre la marcha basados en h A partir de abril de 2014, Yandex.Metrica estaba rastreando alrededor de 12 mil millones de eventos (vistas de páginas y clics) diariamente. Todos estos eventos deben almacenarse para crear informes personalizados. Una sola consulta puede requerir escanear millones de filas en unos pocos cientos de milisegundos, o cientos de millones de filas en solo unos segundos. -## Uso en Yandex.Metrica y otros servicios de Yandex {#usage-in-yandex-metrica-and-other-yandex-services} +## Uso En Yandex.Metrica y Otros Servicios De Yandex {#usage-in-yandex-metrica-and-other-yandex-services} ClickHouse sirve para múltiples propósitos en Yandex.Métrica. Su tarea principal es crear informes en modo en línea utilizando datos no agregados. Utiliza un clúster de 374 servidores, que almacenan más de 20,3 billones de filas en la base de datos. El volumen de datos comprimidos es de aproximadamente 2 PB, sin tener en cuenta duplicados y réplicas. El volumen de datos sin comprimir (en formato TSV) sería de aproximadamente 17 PB. @@ -28,7 +28,7 @@ ClickHouse también juega un papel clave en los siguientes procesos: Hoy en día, hay varias docenas de instalaciones de ClickHouse en otros servicios y departamentos de Yandex: verticales de búsqueda, comercio electrónico, publicidad, análisis de negocios, desarrollo móvil, servicios personales y otros. -## Datos agregados y no agregados {#aggregated-and-non-aggregated-data} +## Datos Agregados y No Agregados {#aggregated-and-non-aggregated-data} Existe una opinión generalizada de que para calcular las estadísticas de manera efectiva, debe agregar datos ya que esto reduce el volumen de datos. diff --git a/docs/es/introduction/performance.md b/docs/es/introduction/performance.md index ad992dd13d6..00fe622cf46 100644 --- a/docs/es/introduction/performance.md +++ b/docs/es/introduction/performance.md @@ -11,21 +11,21 @@ De acuerdo con los resultados de las pruebas internas en Yandex, ClickHouse mues Numerosos puntos de referencia independientes llegaron a conclusiones similares. No son difíciles de encontrar mediante una búsqueda en Internet, o se puede ver [nuestra pequeña colección de enlaces relacionados](https://clickhouse.tech/#independent-benchmarks). -## Rendimiento para una única consulta grande {#throughput-for-a-single-large-query} +## Rendimiento Para Una única Consulta Grande {#throughput-for-a-single-large-query} El rendimiento se puede medir en filas por segundo o megabytes por segundo. Si los datos se colocan en la caché de la página, una consulta que no es demasiado compleja se procesa en hardware moderno a una velocidad de aproximadamente 2-10 GB / s de datos sin comprimir en un solo servidor (para los casos más sencillos, la velocidad puede alcanzar 30 GB / s). Si los datos no se colocan en la memoria caché de la página, la velocidad depende del subsistema de disco y la velocidad de compresión de datos. Por ejemplo, si el subsistema de disco permite leer datos a 400 MB/s y la tasa de compresión de datos es 3, se espera que la velocidad sea de alrededor de 1,2 GB/s. Para obtener la velocidad en filas por segundo, divida la velocidad en bytes por segundo por el tamaño total de las columnas utilizadas en la consulta. Por ejemplo, si se extraen 10 bytes de columnas, se espera que la velocidad sea de alrededor de 100-200 millones de filas por segundo. La velocidad de procesamiento aumenta casi linealmente para el procesamiento distribuido, pero solo si el número de filas resultantes de la agregación o la clasificación no es demasiado grande. -## Latencia al procesar consultas cortas {#latency-when-processing-short-queries} +## Latencia Al Procesar Consultas Cortas {#latency-when-processing-short-queries} Si una consulta usa una clave principal y no selecciona demasiadas columnas y filas para procesar (cientos de miles), puede esperar menos de 50 milisegundos de latencia (dígitos individuales de milisegundos en el mejor de los casos) si los datos se colocan en la memoria caché de la página. De lo contrario, la latencia está dominada principalmente por el número de búsquedas. Si utiliza unidades de disco giratorias, para un sistema que no está sobrecargado, la latencia se puede estimar con esta fórmula: `seek time (10 ms) * count of columns queried * count of data parts`. -## Rendimiento al procesar una gran cantidad de consultas cortas {#throughput-when-processing-a-large-quantity-of-short-queries} +## Rendimiento Al Procesar Una Gran Cantidad De Consultas Cortas {#throughput-when-processing-a-large-quantity-of-short-queries} En las mismas condiciones, ClickHouse puede manejar varios cientos de consultas por segundo en un solo servidor (hasta varios miles en el mejor de los casos). Dado que este escenario no es típico para DBMS analíticos, se recomienda esperar un máximo de 100 consultas por segundo. -## Rendimiento al insertar datos {#performance-when-inserting-data} +## Rendimiento Al Insertar Datos {#performance-when-inserting-data} Recomendamos insertar datos en paquetes de al menos 1000 filas o no más de una sola solicitud por segundo. Al insertar en una tabla MergeTree desde un volcado separado por tabuladores, la velocidad de inserción puede ser de 50 a 200 MB/s. Si las filas insertadas tienen alrededor de 1 Kb de tamaño, la velocidad será de 50,000 a 200,000 filas por segundo. Si las filas son pequeñas, el rendimiento puede ser mayor en filas por segundo (en los datos del sistema Banner -`>` 500.000 filas por segundo; en datos de grafito -`>` 1.000.000 de filas por segundo). Para mejorar el rendimiento, puede realizar varias consultas INSERT en paralelo, que se escala linealmente. diff --git a/docs/es/operations/access-rights.md b/docs/es/operations/access-rights.md new file mode 100644 index 00000000000..a0c8540d310 --- /dev/null +++ b/docs/es/operations/access-rights.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 48 +toc_title: Derechos de acceso +--- + +# Derechos De Acceso {#access-rights} + +Los usuarios y los derechos de acceso se configuran en la configuración del usuario. Esto suele ser `users.xml`. + +Los usuarios se registran en el `users` apartado. Aquí hay un fragmento de la `users.xml` file: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + + test + + + +``` + +Puede ver una declaración de dos usuarios: `default`y`web`. Hemos añadido el `web` usuario por separado. + +El `default` usuario se elige en los casos en que no se pasa el nombre de usuario. El `default` usuario también se utiliza para el procesamiento de consultas distribuidas, si la configuración del servidor o clúster no `user` y `password` (véase la sección sobre el [Distribuido](../engines/table-engines/special/distributed.md) motor). + +The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. + +La contraseña se especifica en texto sin cifrar (no recomendado) o en SHA-256. El hash no está salado. En este sentido, no debe considerar estas contraseñas como proporcionar seguridad contra posibles ataques maliciosos. Más bien, son necesarios para la protección de los empleados. + +Se especifica una lista de redes desde las que se permite el acceso. En este ejemplo, la lista de redes para ambos usuarios se carga desde un archivo independiente (`/etc/metrika.xml`) que contiene el `networks` sustitución. Aquí hay un fragmento de eso: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +Puede definir esta lista de redes directamente en `users.xml` o en un archivo en el `users.d` (para obtener más información, consulte la sección “[Archivos de configuración](configuration-files.md#configuration_files)”). + +La configuración incluye comentarios que explican cómo abrir el acceso desde todas partes. + +Para su uso en producción, sólo especifique `ip` elementos (direcciones IP y sus máscaras), ya que usan `host` y `hoost_regexp` podría causar latencia adicional. + +A continuación se especifica el perfil de configuración de usuario (consulte la sección “[Perfiles de configuración](settings/settings-profiles.md)”. Puede especificar el perfil predeterminado, `default'`. El perfil puede tener cualquier nombre. Puede especificar el mismo perfil para diferentes usuarios. Lo más importante que puede escribir en el perfil de configuración es `readonly=1`, que asegura el acceso de sólo lectura. A continuación, especifique la cuota que se utilizará (consulte la sección “[Cuota](quotas.md#quotas)”). Puede especificar la cuota predeterminada: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. + +En el opcional `` sección, también puede especificar una lista de bases de datos a las que el usuario puede acceder. De forma predeterminada, todas las bases de datos están disponibles para el usuario. Puede especificar el `default` base. En este caso, el usuario recibirá acceso a la base de datos de forma predeterminada. + +En el opcional `` sección, también puede especificar una lista de diccionarios a los que el usuario puede acceder. De forma predeterminada, todos los diccionarios están disponibles para el usuario. + +Acceso a la `system` base de datos siempre está permitida (ya que esta base de datos se utiliza para procesar consultas). + +El usuario puede obtener una lista de todas las bases de datos y tablas en ellos mediante el uso de `SHOW` consultas o tablas del sistema, incluso si no se permite el acceso a bases de datos individuales. + +El acceso a la base de datos no está [sólo lectura](settings/permissions-for-queries.md#settings_readonly) configuración. No puede conceder acceso completo a una base de datos y `readonly` acceso a otro. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/es/operations/access_rights.md b/docs/es/operations/access_rights.md deleted file mode 100644 index 2d909fdc750..00000000000 --- a/docs/es/operations/access_rights.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 48 -toc_title: Derechos de acceso ---- - -# Derechos de acceso {#access-rights} - -Los usuarios y los derechos de acceso se configuran en la configuración del usuario. Esto suele ser `users.xml`. - -Los usuarios se registran en el `users` apartado. Aquí hay un fragmento de la `users.xml` file: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - - test - - - -``` - -Puede ver una declaración de dos usuarios: `default`y`web`. Hemos añadido el `web` usuario por separado. - -El `default` usuario se elige en los casos en que no se pasa el nombre de usuario. El `default` usuario también se utiliza para el procesamiento de consultas distribuidas, si la configuración del servidor o clúster no `user` y `password` (véase la sección sobre el [Distribuido](../engines/table_engines/special/distributed.md) motor). - -The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. - -La contraseña se especifica en texto sin cifrar (no recomendado) o en SHA-256. El hash no está salado. En este sentido, no debe considerar estas contraseñas como proporcionar seguridad contra posibles ataques maliciosos. Más bien, son necesarios para la protección de los empleados. - -Se especifica una lista de redes desde las que se permite el acceso. En este ejemplo, la lista de redes para ambos usuarios se carga desde un archivo independiente (`/etc/metrika.xml`) que contiene el `networks` sustitución. Aquí hay un fragmento de eso: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -Puede definir esta lista de redes directamente en `users.xml` o en un archivo en el `users.d` (para obtener más información, consulte la sección “[Archivos de configuración](configuration_files.md#configuration_files)”). - -La configuración incluye comentarios que explican cómo abrir el acceso desde todas partes. - -Para su uso en producción, sólo especifique `ip` elementos (direcciones IP y sus máscaras), ya que usan `host` y `hoost_regexp` podría causar latencia adicional. - -A continuación se especifica el perfil de configuración de usuario (consulte la sección “[Perfiles de configuración](settings/settings_profiles.md)”. Puede especificar el perfil predeterminado, `default'`. El perfil puede tener cualquier nombre. Puede especificar el mismo perfil para diferentes usuarios. Lo más importante que puede escribir en el perfil de configuración es `readonly=1`, que asegura el acceso de sólo lectura. A continuación, especifique la cuota que se utilizará (consulte la sección “[Cuota](quotas.md#quotas)”). Puede especificar la cuota predeterminada: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. - -En el opcional `` sección, también puede especificar una lista de bases de datos a las que el usuario puede acceder. De forma predeterminada, todas las bases de datos están disponibles para el usuario. Puede especificar el `default` base. En este caso, el usuario recibirá acceso a la base de datos de forma predeterminada. - -En el opcional `` sección, también puede especificar una lista de diccionarios a los que el usuario puede acceder. De forma predeterminada, todos los diccionarios están disponibles para el usuario. - -Acceso a la `system` base de datos siempre está permitida (ya que esta base de datos se utiliza para procesar consultas). - -El usuario puede obtener una lista de todas las bases de datos y tablas en ellos mediante el uso de `SHOW` consultas o tablas del sistema, incluso si no se permite el acceso a bases de datos individuales. - -El acceso a la base de datos no está [sólo lectura](settings/permissions_for_queries.md#settings_readonly) configuración. No puede conceder acceso completo a una base de datos y `readonly` acceso a otro. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/es/operations/backup.md b/docs/es/operations/backup.md index b3e7aba307d..8f47ef3f9bd 100644 --- a/docs/es/operations/backup.md +++ b/docs/es/operations/backup.md @@ -5,9 +5,9 @@ toc_priority: 49 toc_title: Copia de seguridad de datos --- -# Copia de seguridad de datos {#data-backup} +# Copia De Seguridad De Datos {#data-backup} -Mientras [replicación](../engines/table_engines/mergetree_family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [no puede simplemente eliminar tablas con un motor similar a MergeTree que contenga más de 50 Gb de datos](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Sin embargo, estas garantías no cubren todos los casos posibles y pueden eludirse. +Mientras [replicación](../engines/table-engines/mergetree-family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [no puede simplemente eliminar tablas con un motor similar a MergeTree que contenga más de 50 Gb de datos](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Sin embargo, estas garantías no cubren todos los casos posibles y pueden eludirse. Para mitigar eficazmente los posibles errores humanos, debe preparar cuidadosamente una estrategia para realizar copias de seguridad y restaurar sus datos **previamente**. @@ -16,25 +16,25 @@ Cada empresa tiene diferentes recursos disponibles y requisitos comerciales, por !!! note "Nota" Tenga en cuenta que si realizó una copia de seguridad de algo y nunca intentó restaurarlo, es probable que la restauración no funcione correctamente cuando realmente la necesite (o al menos tomará más tiempo de lo que las empresas pueden tolerar). Por lo tanto, cualquiera que sea el enfoque de copia de seguridad que elija, asegúrese de automatizar el proceso de restauración también y practicarlo en un clúster de ClickHouse de repuesto regularmente. -## Duplicar datos de origen en otro lugar {#duplicating-source-data-somewhere-else} +## Duplicar Datos De Origen En Otro Lugar {#duplicating-source-data-somewhere-else} A menudo, los datos que se ingieren en ClickHouse se entregan a través de algún tipo de cola persistente, como [Acerca de nosotros](https://kafka.apache.org). En este caso, es posible configurar un conjunto adicional de suscriptores que leerá el mismo flujo de datos mientras se escribe en ClickHouse y lo almacenará en almacenamiento en frío en algún lugar. La mayoría de las empresas ya tienen algún almacenamiento en frío recomendado por defecto, que podría ser un almacén de objetos o un sistema de archivos distribuido como [HDFS](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html). -## Instantáneas del sistema de archivos {#filesystem-snapshots} +## Instantáneas Del Sistema De Archivos {#filesystem-snapshots} -Algunos sistemas de archivos locales proporcionan funcionalidad de instantánea (por ejemplo, [ZFS](https://en.wikipedia.org/wiki/ZFS)), pero podrían no ser la mejor opción para servir consultas en vivo. Una posible solución es crear réplicas adicionales con este tipo de sistema de archivos y excluirlas del [Distribuido](../engines/table_engines/special/distributed.md) tablas que se utilizan para `SELECT` consulta. Las instantáneas en tales réplicas estarán fuera del alcance de cualquier consulta que modifique los datos. Como beneficio adicional, estas réplicas podrían tener configuraciones de hardware especiales con más discos conectados por servidor, lo que sería rentable. +Algunos sistemas de archivos locales proporcionan funcionalidad de instantánea (por ejemplo, [ZFS](https://en.wikipedia.org/wiki/ZFS)), pero podrían no ser la mejor opción para servir consultas en vivo. Una posible solución es crear réplicas adicionales con este tipo de sistema de archivos y excluirlas del [Distribuido](../engines/table-engines/special/distributed.md) tablas que se utilizan para `SELECT` consulta. Las instantáneas en tales réplicas estarán fuera del alcance de cualquier consulta que modifique los datos. Como beneficio adicional, estas réplicas podrían tener configuraciones de hardware especiales con más discos conectados por servidor, lo que sería rentable. -## Método de codificación de datos: {#clickhouse-copier} +## Método De codificación De Datos: {#clickhouse-copier} [Método de codificación de datos:](utilities/clickhouse-copier.md) es una herramienta versátil que se creó inicialmente para volver a dividir tablas de tamaño petabyte. También se puede usar con fines de copia de seguridad y restauración porque copia datos de forma fiable entre tablas y clústeres de ClickHouse. Para volúmenes de datos más pequeños, un simple `INSERT INTO ... SELECT ...` a tablas remotas podría funcionar también. -## Manipulaciones con piezas {#manipulations-with-parts} +## Manipulaciones Con Piezas {#manipulations-with-parts} ClickHouse permite usar el `ALTER TABLE ... FREEZE PARTITION ...` consulta para crear una copia local de particiones de tabla. Esto se implementa utilizando enlaces duros al `/var/lib/clickhouse/shadow/` carpeta, por lo que generalmente no consume espacio adicional en disco para datos antiguos. Las copias creadas de archivos no son manejadas por el servidor ClickHouse, por lo que puede dejarlas allí: tendrá una copia de seguridad simple que no requiere ningún sistema externo adicional, pero seguirá siendo propenso a problemas de hardware. Por esta razón, es mejor copiarlos de forma remota en otra ubicación y luego eliminar las copias locales. Los sistemas de archivos distribuidos y los almacenes de objetos siguen siendo una buena opción para esto, pero los servidores de archivos conectados normales con una capacidad lo suficientemente grande podrían funcionar también (en este caso, la transferencia ocurrirá a través del sistema de archivos de red o tal vez [rsync](https://en.wikipedia.org/wiki/Rsync)). -Para obtener más información sobre las consultas relacionadas con las manipulaciones de particiones, consulte [Documentación de ALTER](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +Para obtener más información sobre las consultas relacionadas con las manipulaciones de particiones, consulte [Documentación de ALTER](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). Una herramienta de terceros está disponible para automatizar este enfoque: [Haga clic en el botón de copia de seguridad](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/es/operations/configuration-files.md b/docs/es/operations/configuration-files.md new file mode 100644 index 00000000000..fa5e30af42e --- /dev/null +++ b/docs/es/operations/configuration-files.md @@ -0,0 +1,57 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 50 +toc_title: "Archivos de configuraci\xF3n" +--- + +# Archivos De configuración {#configuration_files} + +ClickHouse admite la administración de configuración de varios archivos. El archivo de configuración del servidor principal es `/etc/clickhouse-server/config.xml`. Otros archivos deben estar en el `/etc/clickhouse-server/config.d` directorio. + +!!! note "Nota" + Todos los archivos de configuración deben estar en formato XML. Además, deben tener el mismo elemento raíz, generalmente ``. + +Algunos valores especificados en el archivo de configuración principal se pueden anular en otros archivos de configuración. El `replace` o `remove` los atributos pueden ser especificada para los elementos de estos archivos de configuración. + +Si no se especifica ninguno, combina el contenido de los elementos de forma recursiva, reemplazando los valores de los elementos secundarios duplicados. + +Si `replace` se especifica, reemplaza todo el elemento por el especificado. + +Si `remove` se especifica, elimina el elemento. + +La configuración también puede definir “substitutions”. Si un elemento tiene el `incl` atributo, la sustitución correspondiente del archivo se utilizará como el valor. De forma predeterminada, la ruta al archivo con sustituciones es `/etc/metrika.xml`. Esto se puede cambiar en el [include\_from](server-configuration-parameters/settings.md#server_configuration_parameters-include_from) elemento en la configuración del servidor. Los valores de sustitución se especifican en `/yandex/substitution_name` elementos en este archivo. Si una sustitución especificada en `incl` no existe, se registra en el registro. Para evitar que ClickHouse registre las sustituciones que faltan, especifique `optional="true"` atributo (por ejemplo, ajustes para [macro](server-configuration-parameters/settings.md)). + +Las sustituciones pueden también ser realizada a partir de Cuidador. Para ello, especifique el atributo `from_zk = "/path/to/node"`. El valor del elemento se sustituye por el contenido del nodo en `/path/to/node` en ZooKeeper. También puede colocar un subárbol XML completo en el nodo ZooKeeper y se insertará completamente en el elemento de origen. + +El `config.xml` file puede especificar una configuración separada con configuraciones de usuario, perfiles y cuotas. La ruta relativa a esta configuración se establece en el `users_config` elemento. Por defecto, es `users.xml`. Si `users_config` se omite, la configuración de usuario, los perfiles y las cuotas se especifican directamente en `config.xml`. + +Configuración de usuarios puede ser dividido en archivos separados similar a `config.xml` y `config.d/`. +El nombre del directorio se define como `users_config` sin `.xml` postfix concatenado con `.d`. +Directorio `users.d` se utiliza por defecto, como `users_config` por defecto `users.xml`. +Por ejemplo, puede tener un archivo de configuración separado para cada usuario como este: + +``` bash +$ cat /etc/clickhouse-server/users.d/alice.xml +``` + +``` xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +Para cada archivo de configuración, el servidor también genera `file-preprocessed.xml` archivos al iniciar. Estos archivos contienen todas las sustituciones y anulaciones completadas, y están destinados para uso informativo. Si se utilizaron sustituciones de ZooKeeper en los archivos de configuración pero ZooKeeper no está disponible en el inicio del servidor, el servidor carga la configuración desde el archivo preprocesado. + +El servidor realiza un seguimiento de los cambios en los archivos de configuración, así como archivos y nodos ZooKeeper que se utilizaron al realizar sustituciones y anulaciones, y vuelve a cargar la configuración de los usuarios y clústeres sobre la marcha. Esto significa que puede modificar el clúster, los usuarios y su configuración sin reiniciar el servidor. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/es/operations/configuration_files.md b/docs/es/operations/configuration_files.md deleted file mode 100644 index 657fd61eb96..00000000000 --- a/docs/es/operations/configuration_files.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 50 -toc_title: "Archivos de configuraci\xF3n" ---- - -# Archivos de configuración {#configuration_files} - -ClickHouse admite la administración de configuración de varios archivos. El archivo de configuración del servidor principal es `/etc/clickhouse-server/config.xml`. Otros archivos deben estar en el `/etc/clickhouse-server/config.d` directorio. - -!!! note "Nota" - Todos los archivos de configuración deben estar en formato XML. Además, deben tener el mismo elemento raíz, generalmente ``. - -Algunos valores especificados en el archivo de configuración principal se pueden anular en otros archivos de configuración. El `replace` o `remove` los atributos pueden ser especificada para los elementos de estos archivos de configuración. - -Si no se especifica ninguno, combina el contenido de los elementos de forma recursiva, reemplazando los valores de los elementos secundarios duplicados. - -Si `replace` se especifica, reemplaza todo el elemento por el especificado. - -Si `remove` se especifica, elimina el elemento. - -La configuración también puede definir “substitutions”. Si un elemento tiene el `incl` atributo, la sustitución correspondiente del archivo se utilizará como el valor. De forma predeterminada, la ruta al archivo con sustituciones es `/etc/metrika.xml`. Esto se puede cambiar en el [include\_from](server_configuration_parameters/settings.md#server_configuration_parameters-include_from) elemento en la configuración del servidor. Los valores de sustitución se especifican en `/yandex/substitution_name` elementos en este archivo. Si una sustitución especificada en `incl` no existe, se registra en el registro. Para evitar que ClickHouse registre las sustituciones que faltan, especifique `optional="true"` atributo (por ejemplo, ajustes para [macro](server_configuration_parameters/settings.md)). - -Las sustituciones pueden también ser realizada a partir de Cuidador. Para ello, especifique el atributo `from_zk = "/path/to/node"`. El valor del elemento se sustituye por el contenido del nodo en `/path/to/node` en ZooKeeper. También puede colocar un subárbol XML completo en el nodo ZooKeeper y se insertará completamente en el elemento de origen. - -El `config.xml` file puede especificar una configuración separada con configuraciones de usuario, perfiles y cuotas. La ruta relativa a esta configuración se establece en el `users_config` elemento. Por defecto, es `users.xml`. Si `users_config` se omite, la configuración de usuario, los perfiles y las cuotas se especifican directamente en `config.xml`. - -Configuración de usuarios puede ser dividido en archivos separados similar a `config.xml` y `config.d/`. -El nombre del directorio se define como `users_config` sin `.xml` postfix concatenado con `.d`. -Directorio `users.d` se utiliza por defecto, como `users_config` por defecto `users.xml`. -Por ejemplo, puede tener un archivo de configuración separado para cada usuario como este: - -``` bash -$ cat /etc/clickhouse-server/users.d/alice.xml -``` - -``` xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -Para cada archivo de configuración, el servidor también genera `file-preprocessed.xml` archivos al iniciar. Estos archivos contienen todas las sustituciones y anulaciones completadas, y están destinados para uso informativo. Si se utilizaron sustituciones de ZooKeeper en los archivos de configuración pero ZooKeeper no está disponible en el inicio del servidor, el servidor carga la configuración desde el archivo preprocesado. - -El servidor realiza un seguimiento de los cambios en los archivos de configuración, así como archivos y nodos ZooKeeper que se utilizaron al realizar sustituciones y anulaciones, y vuelve a cargar la configuración de los usuarios y clústeres sobre la marcha. Esto significa que puede modificar el clúster, los usuarios y su configuración sin reiniciar el servidor. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/es/operations/index.md b/docs/es/operations/index.md index 98bd68c4d0b..ba1e0717d0c 100644 --- a/docs/es/operations/index.md +++ b/docs/es/operations/index.md @@ -15,13 +15,13 @@ El manual de operaciones de ClickHouse consta de las siguientes secciones princi - [Solución de problemas](troubleshooting.md) - [Recomendaciones de uso](tips.md) - [Procedimiento de actualización](update.md) -- [Derechos de acceso](access_rights.md) +- [Derechos de acceso](access-rights.md) - [Copia de seguridad de datos](backup.md) -- [Archivos de configuración](configuration_files.md) +- [Archivos de configuración](configuration-files.md) - [Cuota](quotas.md) -- [Tablas del sistema](system_tables.md) -- [Parámetros de configuración del servidor](server_configuration_parameters/index.md) -- [Cómo probar su hardware con ClickHouse](performance_test.md) +- [Tablas del sistema](system-tables.md) +- [Parámetros de configuración del servidor](server-configuration-parameters/index.md) +- [Cómo probar su hardware con ClickHouse](performance-test.md) - [Configuración](settings/index.md) - [Utilidad](utilities/index.md) diff --git a/docs/es/operations/monitoring.md b/docs/es/operations/monitoring.md index eb8ddf816d9..91eddb7fbff 100644 --- a/docs/es/operations/monitoring.md +++ b/docs/es/operations/monitoring.md @@ -12,7 +12,7 @@ Usted puede monitorear: - Utilización de recursos de hardware. - Métricas del servidor ClickHouse. -## Utilización de recursos {#resource-utilization} +## Utilización De Recursos {#resource-utilization} ClickHouse no supervisa el estado de los recursos de hardware por sí mismo. @@ -24,20 +24,20 @@ Se recomienda encarecidamente configurar la supervisión para: - Utilización del sistema de almacenamiento, RAM y red. -## Métricas del servidor de Clickhouse {#clickhouse-server-metrics} +## Métricas Del Servidor De Clickhouse {#clickhouse-server-metrics} El servidor ClickHouse tiene instrumentos integrados para el monitoreo de estado propio. -Para realizar un seguimiento de los eventos del servidor, use los registros del servidor. Ver el [registrador](server_configuration_parameters/settings.md#server_configuration_parameters-logger) sección del archivo de configuración. +Para realizar un seguimiento de los eventos del servidor, use los registros del servidor. Ver el [registrador](server-configuration-parameters/settings.md#server_configuration_parameters-logger) sección del archivo de configuración. ClickHouse recoge: - Diferentes métricas de cómo el servidor utiliza recursos computacionales. - Común de la estadística en el procesamiento de la consulta. -Puede encontrar métricas en el [sistema.métricas](../operations/system_tables.md#system_tables-metrics), [sistema.evento](../operations/system_tables.md#system_tables-events), y [sistema.asynchronous\_metrics](../operations/system_tables.md#system_tables-asynchronous_metrics) tabla. +Puede encontrar métricas en el [sistema.métricas](../operations/system-tables.md#system_tables-metrics), [sistema.evento](../operations/system-tables.md#system_tables-events), y [sistema.asynchronous\_metrics](../operations/system-tables.md#system_tables-asynchronous_metrics) tabla. -Puede configurar ClickHouse para exportar métricas a [Grafito](https://github.com/graphite-project). Ver el [Sección de grafito](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) en el archivo de configuración del servidor ClickHouse. Antes de configurar la exportación de métricas, debe configurar Graphite siguiendo sus [guiar](https://graphite.readthedocs.io/en/latest/install.html). +Puede configurar ClickHouse para exportar métricas a [Grafito](https://github.com/graphite-project). Ver el [Sección de grafito](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) en el archivo de configuración del servidor ClickHouse. Antes de configurar la exportación de métricas, debe configurar Graphite siguiendo sus [guiar](https://graphite.readthedocs.io/en/latest/install.html). Además, puede supervisar la disponibilidad del servidor a través de la API HTTP. Enviar el `HTTP GET` solicitud de `/ping`. Si el servidor está disponible, responde con `200 OK`. diff --git a/docs/es/operations/optimizing_performance/index.md b/docs/es/operations/optimizing-performance/index.md similarity index 100% rename from docs/es/operations/optimizing_performance/index.md rename to docs/es/operations/optimizing-performance/index.md diff --git a/docs/es/operations/optimizing-performance/sampling-query-profiler.md b/docs/es/operations/optimizing-performance/sampling-query-profiler.md new file mode 100644 index 00000000000..98434f582b9 --- /dev/null +++ b/docs/es/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 54 +toc_title: "Generaci\xF3n de perfiles de consultas" +--- + +# Analizador De Consultas De Muestreo {#sampling-query-profiler} + +ClickHouse ejecuta el generador de perfiles de muestreo que permite analizar la ejecución de consultas. Utilizando el generador de perfiles puede encontrar rutinas de código fuente que se utilizan con más frecuencia durante la ejecución de la consulta. Puede rastrear el tiempo de CPU y el tiempo de reloj de pared invertido, incluido el tiempo de inactividad. + +Para usar el generador de perfiles: + +- Configurar el [trace\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) sección de la configuración del servidor. + + Esta sección configura la [trace\_log](../../operations/system-tables.md#system_tables-trace_log) tabla del sistema que contiene los resultados del funcionamiento del generador de perfiles. Está configurado de forma predeterminada. Recuerde que los datos de esta tabla solo son válidos para un servidor en ejecución. Después de reiniciar el servidor, ClickHouse no limpia la tabla y toda la dirección de memoria virtual almacenada puede dejar de ser válida. + +- Configurar el [Los resultados de la prueba](../settings/settings.md#query_profiler_cpu_time_period_ns) o [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) configuración. Ambos ajustes se pueden utilizar simultáneamente. + + Estas opciones le permiten configurar temporizadores del generador de perfiles. Como estos son los ajustes de sesión, puede obtener diferentes frecuencias de muestreo para todo el servidor, usuarios individuales o perfiles de usuario, para su sesión interactiva y para cada consulta individual. + +La frecuencia de muestreo predeterminada es una muestra por segundo y tanto la CPU como los temporizadores reales están habilitados. Esta frecuencia permite recopilar suficiente información sobre el clúster ClickHouse. Al mismo tiempo, al trabajar con esta frecuencia, el generador de perfiles no afecta el rendimiento del servidor ClickHouse. Si necesita perfilar cada consulta individual, intente usar una mayor frecuencia de muestreo. + +Para analizar el `trace_log` tabla del sistema: + +- Instale el `clickhouse-common-static-dbg` paquete. Ver [Instalar desde paquetes DEB](../../getting-started/install.md#install-from-deb-packages). + +- Permitir funciones de introspección [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) configuración. + + Por razones de seguridad, las funciones de introspección están deshabilitadas de forma predeterminada. + +- Utilice el `addressToLine`, `addressToSymbol` y `demangle` [funciones de la introspección](../../sql-reference/functions/introspection.md) para obtener nombres de funciones y sus posiciones en el código ClickHouse. Para obtener un perfil para alguna consulta, debe agregar datos del `trace_log` tabla. Puede agregar datos por funciones individuales o por los seguimientos de pila completos. + +Si necesita visualizar `trace_log` información, intente [Flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) y [Nivel de Cifrado WEP](https://github.com/laplab/clickhouse-speedscope). + +## Ejemplo {#example} + +En este ejemplo nos: + +- Filtrado `trace_log` datos por un identificador de consulta y la fecha actual. + +- Agregando por seguimiento de pila. + +- Usando funciones de introspección, obtendremos un informe de: + + - Nombres de símbolos y funciones de código fuente correspondientes. + - Ubicaciones del código fuente de estas funciones. + + + +``` sql +SELECT + count(), + arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym +FROM system.trace_log +WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) +GROUP BY trace +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +{% include "examples/sampling_query_profiler_result.txt" %} +``` diff --git a/docs/es/operations/optimizing_performance/sampling_query_profiler.md b/docs/es/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 100644 index 2bd7429b312..00000000000 --- a/docs/es/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 54 -toc_title: "Generaci\xF3n de perfiles de consultas" ---- - -# Analizador de consultas de muestreo {#sampling-query-profiler} - -ClickHouse ejecuta el generador de perfiles de muestreo que permite analizar la ejecución de consultas. Utilizando el generador de perfiles puede encontrar rutinas de código fuente que se utilizan con más frecuencia durante la ejecución de la consulta. Puede rastrear el tiempo de CPU y el tiempo de reloj de pared invertido, incluido el tiempo de inactividad. - -Para usar el generador de perfiles: - -- Configurar el [trace\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) sección de la configuración del servidor. - - Esta sección configura la [trace\_log](../../operations/system_tables.md#system_tables-trace_log) tabla del sistema que contiene los resultados del funcionamiento del generador de perfiles. Está configurado de forma predeterminada. Recuerde que los datos de esta tabla solo son válidos para un servidor en ejecución. Después de reiniciar el servidor, ClickHouse no limpia la tabla y toda la dirección de memoria virtual almacenada puede dejar de ser válida. - -- Configurar el [Los resultados de la prueba](../settings/settings.md#query_profiler_cpu_time_period_ns) o [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) configuración. Ambos ajustes se pueden utilizar simultáneamente. - - Estas opciones le permiten configurar temporizadores del generador de perfiles. Como estos son los ajustes de sesión, puede obtener diferentes frecuencias de muestreo para todo el servidor, usuarios individuales o perfiles de usuario, para su sesión interactiva y para cada consulta individual. - -La frecuencia de muestreo predeterminada es una muestra por segundo y tanto la CPU como los temporizadores reales están habilitados. Esta frecuencia permite recopilar suficiente información sobre el clúster ClickHouse. Al mismo tiempo, al trabajar con esta frecuencia, el generador de perfiles no afecta el rendimiento del servidor ClickHouse. Si necesita perfilar cada consulta individual, intente usar una mayor frecuencia de muestreo. - -Para analizar el `trace_log` tabla del sistema: - -- Instale el `clickhouse-common-static-dbg` paquete. Ver [Instalar desde paquetes DEB](../../getting_started/install.md#install-from-deb-packages). - -- Permitir funciones de introspección [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) configuración. - - Por razones de seguridad, las funciones de introspección están deshabilitadas de forma predeterminada. - -- Utilice el `addressToLine`, `addressToSymbol` y `demangle` [funciones de la introspección](../../sql_reference/functions/introspection.md) para obtener nombres de funciones y sus posiciones en el código ClickHouse. Para obtener un perfil para alguna consulta, debe agregar datos del `trace_log` tabla. Puede agregar datos por funciones individuales o por los seguimientos de pila completos. - -Si necesita visualizar `trace_log` información, intente [Flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) y [Nivel de Cifrado WEP](https://github.com/laplab/clickhouse-speedscope). - -## Ejemplo {#example} - -En este ejemplo nos: - -- Filtrado `trace_log` datos por un identificador de consulta y la fecha actual. - -- Agregando por seguimiento de pila. - -- Usando funciones de introspección, obtendremos un informe de: - - - Nombres de símbolos y funciones de código fuente correspondientes. - - Ubicaciones del código fuente de estas funciones. - - - -``` sql -SELECT - count(), - arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym -FROM system.trace_log -WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) -GROUP BY trace -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -{% include "examples/sampling_query_profiler_result.txt" %} -``` diff --git a/docs/es/operations/performance-test.md b/docs/es/operations/performance-test.md new file mode 100644 index 00000000000..a65d196509b --- /dev/null +++ b/docs/es/operations/performance-test.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 54 +toc_title: Prueba de hardware +--- + +# Cómo Probar Su Hardware Con ClickHouse {#how-to-test-your-hardware-with-clickhouse} + +Con esta instrucción, puede ejecutar una prueba de rendimiento básica de ClickHouse en cualquier servidor sin instalar paquetes de ClickHouse. + +1. Ir a “commits” página: https://github.com/ClickHouse/ClickHouse/commits/master + +2. Haga clic en la primera marca de verificación verde o cruz roja con verde “ClickHouse Build Check” y haga clic en el “Details” enlace cerca “ClickHouse Build Check”. + +3. Copie el enlace a “clickhouse” binario para amd64 o aarch64. + +4. ssh al servidor y descargarlo con wget: + + + + # For amd64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse + # For aarch64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse + # Then do: + chmod a+x clickhouse + +1. Descargar configs: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml + mkdir config.d + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml + +1. Descargar archivos de referencia: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh + chmod a+x benchmark-new.sh + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql + +1. Descargue los datos de prueba de acuerdo con el [El Yandex.Conjunto de datos de Metrica](../getting-started/example-datasets/metrica.md) instrucción (“hits” tabla que contiene 100 millones de filas). + + + + wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz + tar xvf hits_100m_obfuscated_v1.tar.xz -C . + mv hits_100m_obfuscated_v1/* . + +1. Ejecute el servidor: + + + + ./clickhouse server + +1. Verifique los datos: ssh al servidor en otro terminal + + + + ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" + 100000000 + +1. Edite el benchmark-new.sh, cambie “clickhouse-client” a “./clickhouse client” y añadir “–max\_memory\_usage 100000000000” parámetro. + + + + mcedit benchmark-new.sh + +1. Ejecute el punto de referencia: + + + + ./benchmark-new.sh hits_100m_obfuscated + +1. Envíe los números y la información sobre la configuración de su hardware a clickhouse-feedback@yandex-team.com + +Todos los resultados se publican aquí: https://clickhouse.tecnología/benchmark\_hardware.HTML diff --git a/docs/es/operations/performance_test.md b/docs/es/operations/performance_test.md deleted file mode 100644 index 3d982870c36..00000000000 --- a/docs/es/operations/performance_test.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 54 -toc_title: Prueba de hardware ---- - -# Cómo probar su hardware con ClickHouse {#how-to-test-your-hardware-with-clickhouse} - -Con esta instrucción, puede ejecutar una prueba de rendimiento básica de ClickHouse en cualquier servidor sin instalar paquetes de ClickHouse. - -1. Ir a “commits” página: https://github.com/ClickHouse/ClickHouse/commits/master - -2. Haga clic en la primera marca de verificación verde o cruz roja con verde “ClickHouse Build Check” y haga clic en el “Details” enlace cerca “ClickHouse Build Check”. - -3. Copie el enlace a “clickhouse” binario para amd64 o aarch64. - -4. ssh al servidor y descargarlo con wget: - - - - # For amd64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse - # For aarch64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse - # Then do: - chmod a+x clickhouse - -1. Descargar configs: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml - mkdir config.d - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml - -1. Descargar archivos de referencia: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh - chmod a+x benchmark-new.sh - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql - -1. Descargue los datos de prueba de acuerdo con el [El Yandex.Conjunto de datos de Metrica](../getting_started/example_datasets/metrica.md) instrucción (“hits” tabla que contiene 100 millones de filas). - - - - wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz - tar xvf hits_100m_obfuscated_v1.tar.xz -C . - mv hits_100m_obfuscated_v1/* . - -1. Ejecute el servidor: - - - - ./clickhouse server - -1. Verifique los datos: ssh al servidor en otro terminal - - - - ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" - 100000000 - -1. Edite el benchmark-new.sh, cambie “clickhouse-client” a “./clickhouse client” y añadir “–max\_memory\_usage 100000000000” parámetro. - - - - mcedit benchmark-new.sh - -1. Ejecute el punto de referencia: - - - - ./benchmark-new.sh hits_100m_obfuscated - -1. Envíe los números y la información sobre la configuración de su hardware a clickhouse-feedback@yandex-team.com - -Todos los resultados se publican aquí: https://clickhouse.tecnología/benchmark\_hardware.HTML diff --git a/docs/es/operations/requirements.md b/docs/es/operations/requirements.md index 3611cc9475d..4f8577ce717 100644 --- a/docs/es/operations/requirements.md +++ b/docs/es/operations/requirements.md @@ -24,15 +24,15 @@ El volumen requerido de RAM depende de: - La complejidad de las consultas. - La cantidad de datos que se procesan en las consultas. -Para calcular el volumen requerido de RAM, debe estimar el tamaño de los datos temporales para [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) y otras operaciones que utilice. +Para calcular el volumen requerido de RAM, debe estimar el tamaño de los datos temporales para [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) y otras operaciones que utilice. -ClickHouse puede usar memoria externa para datos temporales. Ver [GROUP BY en memoria externa](../sql_reference/statements/select.md#select-group-by-in-external-memory) para más detalles. +ClickHouse puede usar memoria externa para datos temporales. Ver [GROUP BY en memoria externa](../sql-reference/statements/select.md#select-group-by-in-external-memory) para más detalles. -## Archivo de intercambio {#swap-file} +## Archivo De Intercambio {#swap-file} Deshabilite el archivo de intercambio para entornos de producción. -## Subsistema de almacenamiento {#storage-subsystem} +## Subsistema De Almacenamiento {#storage-subsystem} Necesita tener 2 GB de espacio libre en disco para instalar ClickHouse. @@ -58,4 +58,4 @@ El ancho de banda de la red es fundamental para procesar consultas distribuidas ClickHouse está desarrollado para la familia de sistemas operativos Linux. La distribución de Linux recomendada es Ubuntu. El `tzdata` paquete debe ser instalado en el sistema. -ClickHouse también puede funcionar en otras familias de sistemas operativos. Ver detalles en el [Primeros pasos](../getting_started/index.md) sección de la documentación. +ClickHouse también puede funcionar en otras familias de sistemas operativos. Ver detalles en el [Primeros pasos](../getting-started/index.md) sección de la documentación. diff --git a/docs/es/operations/server-configuration-parameters/index.md b/docs/es/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..29a9550799c --- /dev/null +++ b/docs/es/operations/server-configuration-parameters/index.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Server Configuration Parameters +toc_priority: 54 +toc_title: "Implantaci\xF3n" +--- + +# Parámetros De configuración Del Servidor {#server-settings} + +Esta sección contiene descripciones de la configuración del servidor que no se puede cambiar en el nivel de sesión o consulta. + +Estos ajustes se almacenan en el `config.xml` archivo en el servidor ClickHouse. + +Otros ajustes se describen en el “[Configuración](../settings/index.md#settings)” apartado. + +Antes de estudiar la configuración, lea el [Archivos de configuración](../configuration-files.md#configuration_files) sección y tomar nota del uso de sustituciones (el `incl` y `optional` atributo). + +[Artículo Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/es/operations/server-configuration-parameters/settings.md b/docs/es/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..2cb8ec5c885 --- /dev/null +++ b/docs/es/operations/server-configuration-parameters/settings.md @@ -0,0 +1,872 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 57 +toc_title: "Configuraci\xF3n del servidor" +--- + +# Configuración Del Servidor {#server-settings} + +## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} + +El intervalo en segundos antes de volver a cargar los diccionarios integrados. + +ClickHouse recarga los diccionarios incorporados cada x segundos. Esto hace posible editar diccionarios “on the fly” sin reiniciar el servidor. + +Valor predeterminado: 3600. + +**Ejemplo** + +``` xml +3600 +``` + +## compresión {#server-settings-compression} + +Ajustes de compresión de datos para [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md)-mesas de motor. + +!!! warning "Advertencia" + No lo use si acaba de comenzar a usar ClickHouse. + +Plantilla de configuración: + +``` xml + + + ... + ... + ... + + ... + +``` + +`` campo: + +- `min_part_size` – The minimum size of a data part. +- `min_part_size_ratio` – The ratio of the data part size to the table size. +- `method` – Compression method. Acceptable values: `lz4` o `zstd`. + +Puede configurar múltiples `` apartado. + +Acciones cuando se cumplen las condiciones: + +- Si un elemento de datos coincide con un conjunto de condiciones, ClickHouse utiliza el método de compresión especificado. +- Si un elemento de datos coincide con varios conjuntos de condiciones, ClickHouse utiliza el primer conjunto de condiciones coincidente. + +Si no se cumplen condiciones para un elemento de datos, ClickHouse utiliza el `lz4` compresión. + +**Ejemplo** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## default\_database {#default-database} + +La base de datos predeterminada. + +Para obtener una lista de bases de datos, [SHOW DATABASES](../../sql-reference/statements/show.md#show-databases) consulta. + +**Ejemplo** + +``` xml +default +``` + +## default\_profile {#default-profile} + +Perfil de configuración predeterminado. + +Los perfiles de configuración se encuentran en el archivo especificado en el parámetro `user_config`. + +**Ejemplo** + +``` xml +default +``` + +## Diccionarios\_config {#server_configuration_parameters-dictionaries_config} + +La ruta de acceso al archivo de configuración para diccionarios externos. + +Camino: + +- Especifique la ruta absoluta o la ruta relativa al archivo de configuración del servidor. +- La ruta puede contener comodines \* y ?. + +Ver también “[Diccionarios externos](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)”. + +**Ejemplo** + +``` xml +*_dictionary.xml +``` + +## Diccionarios\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} + +La carga perezosa de los diccionarios. + +Si `true`, entonces cada diccionario es creado en el primer uso. Si se produce un error en la creación del diccionario, la función que estaba utilizando el diccionario produce una excepción. + +Si `false`, todos los diccionarios se crean cuando se inicia el servidor, y si hay un error, el servidor se apaga. + +El valor predeterminado es `true`. + +**Ejemplo** + +``` xml +true +``` + +## format\_schema\_path {#server_configuration_parameters-format_schema_path} + +La ruta de acceso al directorio con los esquemas para los datos de entrada, como los esquemas [CapnProto](../../interfaces/formats.md#capnproto) formato. + +**Ejemplo** + +``` xml + + format_schemas/ +``` + +## grafito {#server_configuration_parameters-graphite} + +Envío de datos a [Grafito](https://github.com/graphite-project). + +Configuración: + +- host – The Graphite server. +- port – The port on the Graphite server. +- interval – The interval for sending, in seconds. +- timeout – The timeout for sending data, in seconds. +- root\_path – Prefix for keys. +- metrics – Sending data from the [sistema.métricas](../../operations/system-tables.md#system_tables-metrics) tabla. +- events – Sending deltas data accumulated for the time period from the [sistema.evento](../../operations/system-tables.md#system_tables-events) tabla. +- events\_cumulative – Sending cumulative data from the [sistema.evento](../../operations/system-tables.md#system_tables-events) tabla. +- asynchronous\_metrics – Sending data from the [sistema.asynchronous\_metrics](../../operations/system-tables.md#system_tables-asynchronous_metrics) tabla. + +Puede configurar múltiples `` clausula. Por ejemplo, puede usar esto para enviar datos diferentes a intervalos diferentes. + +**Ejemplo** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## graphite\_rollup {#server_configuration_parameters-graphite-rollup} + +Ajustes para reducir los datos de grafito. + +Para obtener más información, consulte [GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md). + +**Ejemplo** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## http\_port/https\_port {#http-porthttps-port} + +El puerto para conectarse al servidor a través de HTTP(s). + +Si `https_port` se especifica, [openSSL](#server_configuration_parameters-openssl) debe ser configurado. + +Si `http_port` se especifica, la configuración de OpenSSL se ignora incluso si está establecida. + +**Ejemplo** + +``` xml +0000 +``` + +## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} + +La página que se muestra de forma predeterminada al acceder al servidor HTTP de ClickHouse. +El valor predeterminado es “Ok.” (con un avance de línea al final) + +**Ejemplo** + +Abrir `https://tabix.io/` al acceder `http://localhost: http_port`. + +``` xml + +
]]> +
+``` + +## include\_from {#server_configuration_parameters-include_from} + +La ruta al archivo con sustituciones. + +Para obtener más información, consulte la sección “[Archivos de configuración](../configuration-files.md#configuration_files)”. + +**Ejemplo** + +``` xml +/etc/metrica.xml +``` + +## Interesante {#interserver-http-port} + +Puerto para el intercambio de datos entre servidores ClickHouse. + +**Ejemplo** + +``` xml +9009 +``` + +## Sistema Abierto {#interserver-http-host} + +El nombre de host que pueden utilizar otros servidores para acceder a este servidor. + +Si se omite, se define de la misma manera que el `hostname-f` comando. + +Útil para separarse de una interfaz de red específica. + +**Ejemplo** + +``` xml +example.yandex.ru +``` + +## interserver\_http\_credentials {#server-settings-interserver-http-credentials} + +El nombre de usuario y la contraseña utilizados para [replicación](../../engines/table-engines/mergetree-family/replication.md) con los motores Replicated\*. Estas credenciales sólo se utilizan para la comunicación entre réplicas y no están relacionadas con las credenciales de los clientes de ClickHouse. El servidor está comprobando estas credenciales para conectar réplicas y utiliza las mismas credenciales cuando se conecta a otras réplicas. Por lo tanto, estas credenciales deben establecerse igual para todas las réplicas de un clúster. +De forma predeterminada, la autenticación no se utiliza. + +Esta sección contiene los siguientes parámetros: + +- `user` — username. +- `password` — password. + +**Ejemplo** + +``` xml + + admin + 222 + +``` + +## keep\_alive\_timeout {#keep-alive-timeout} + +El número de segundos que ClickHouse espera las solicitudes entrantes antes de cerrar la conexión. El valor predeterminado es de 3 segundos. + +**Ejemplo** + +``` xml +3 +``` + +## listen\_host {#server_configuration_parameters-listen_host} + +Restricción en hosts de los que pueden provenir las solicitudes. Si desea que el servidor responda a todos ellos, especifique `::`. + +Ejemplos: + +``` xml +::1 +127.0.0.1 +``` + +## registrador {#server_configuration_parameters-logger} + +Configuración de registro. + +Claves: + +- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. +- log – The log file. Contains all the entries according to `level`. +- errorlog – Error log file. +- size – Size of the file. Applies to `log`y`errorlog`. Una vez que el archivo alcanza `size`, ClickHouse archiva y cambia el nombre, y crea un nuevo archivo de registro en su lugar. +- count – The number of archived log files that ClickHouse stores. + +**Ejemplo** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +También se admite la escritura en el syslog. Config ejemplo: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +Claves: + +- use\_syslog — Required setting if you want to write to the syslog. +- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. +- hostname — Optional. The name of the host that logs are sent from. +- facility — [La palabra clave syslog facility](https://en.wikipedia.org/wiki/Syslog#Facility) en letras mayúsculas con el “LOG\_” prefijo: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` y así sucesivamente). + Valor predeterminado: `LOG_USER` si `address` se especifica, `LOG_DAEMON otherwise.` +- format – Message format. Possible values: `bsd` y `syslog.` + +## macro {#macros} + +Sustituciones de parámetros para tablas replicadas. + +Se puede omitir si no se utilizan tablas replicadas. + +Para obtener más información, consulte la sección “[Creación de tablas replicadas](../../engines/table-engines/mergetree-family/replication.md)”. + +**Ejemplo** + +``` xml + +``` + +## Método De codificación De Datos: {#server-mark-cache-size} + +Tamaño aproximado (en bytes) de la memoria caché de marcas utilizadas por los motores de [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md) familia. + +La memoria caché se comparte para el servidor y la memoria se asigna según sea necesario. El tamaño de la memoria caché debe ser al menos 5368709120. + +**Ejemplo** + +``` xml +5368709120 +``` + +## max\_concurrent\_queries {#max-concurrent-queries} + +El número máximo de solicitudes procesadas simultáneamente. + +**Ejemplo** + +``` xml +100 +``` + +## max\_connections {#max-connections} + +El número máximo de conexiones entrantes. + +**Ejemplo** + +``` xml +4096 +``` + +## max\_open\_files {#max-open-files} + +El número máximo de archivos abiertos. + +Predeterminada: `maximum`. + +Recomendamos el uso de esta opción en Mac OS X desde la `getrlimit()` la función devuelve un valor incorrecto. + +**Ejemplo** + +``` xml +262144 +``` + +## max\_table\_size\_to\_drop {#max-table-size-to-drop} + +Restricción en la eliminación de tablas. + +Si el tamaño de un [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md) tabla supera `max_table_size_to_drop` (en bytes), no puede eliminarlo usando una consulta DROP. + +Si aún necesita eliminar la tabla sin reiniciar el servidor ClickHouse, cree el `/flags/force_drop_table` y ejecute la consulta DROP. + +Valor predeterminado: 50 GB. + +El valor 0 significa que puede eliminar todas las tablas sin restricciones. + +**Ejemplo** + +``` xml +0 +``` + +## merge\_tree {#server_configuration_parameters-merge_tree} + +Ajuste fino para tablas en el [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md). + +Para obtener más información, vea MergeTreeSettings.h archivo de encabezado. + +**Ejemplo** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +Configuración cliente/servidor SSL. + +El soporte para SSL es proporcionado por el `libpoco` biblioteca. La interfaz se describe en el archivo [Nombre de la red inalámbrica (SSID):h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +Claves para la configuración del servidor/cliente: + +- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. +- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` contiene el certificado. +- caConfig – The path to the file or directory that contains trusted root certificates. +- verificationMode – The method for checking the node’s certificates. Details are in the description of the [Contexto](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) clase. Valores posibles: `none`, `relaxed`, `strict`, `once`. +- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. +- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| +- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Valores aceptables: `true`, `false`. +- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. Este parámetro siempre se recomienda ya que ayuda a evitar problemas tanto si el servidor almacena en caché la sesión como si el cliente solicita el almacenamiento en caché. Valor predeterminado: `${application.name}`. +- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. +- sessionTimeout – Time for caching the session on the server. +- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. +- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. +- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. +- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . +- disableProtocols – Protocols that are not allowed to use. +- preferServerCiphers – Preferred server ciphers on the client. + +**Ejemplo de configuración:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## part\_log {#server_configuration_parameters-part-log} + +Registro de eventos asociados con [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md). Por ejemplo, agregar o fusionar datos. Puede utilizar el registro para simular algoritmos de combinación y comparar sus características. Puede visualizar el proceso de fusión. + +Las consultas se registran en el [sistema.part\_log](../../operations/system-tables.md#system_tables-part-log) tabla, no en un archivo separado. Puede configurar el nombre de esta tabla en el `table` parámetro (ver más abajo). + +Utilice los siguientes parámetros para configurar el registro: + +- `database` – Name of the database. +- `table` – Name of the system table. +- `partition_by` – Sets a [clave de partición personalizada](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +**Ejemplo** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## camino {#server_configuration_parameters-path} + +La ruta de acceso al directorio que contiene los datos. + +!!! note "Nota" + La barra diagonal es obligatoria. + +**Ejemplo** + +``` xml +/var/lib/clickhouse/ +``` + +## query\_log {#server_configuration_parameters-query-log} + +Configuración de las consultas de registro recibidas con [log\_queries=1](../settings/settings.md) configuración. + +Las consultas se registran en el [sistema.query\_log](../../operations/system-tables.md#system_tables-query_log) tabla, no en un archivo separado. Puede cambiar el nombre de la tabla en el `table` parámetro (ver más abajo). + +Utilice los siguientes parámetros para configurar el inicio de sesión: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [clave de partición personalizada](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) para una mesa. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +Si la tabla no existe, ClickHouse la creará. Si la estructura del registro de consultas cambió cuando se actualizó el servidor ClickHouse, se cambia el nombre de la tabla con la estructura anterior y se crea una nueva tabla automáticamente. + +**Ejemplo** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## Sistema Abierto {#server_configuration_parameters-query-thread-log} + +Configuración de subprocesos de registro de consultas recibidas con [Log\_query\_threads = 1](../settings/settings.md#settings-log-query-threads) configuración. + +Las consultas se registran en el [sistema.Sistema abierto.](../../operations/system-tables.md#system_tables-query-thread-log) tabla, no en un archivo separado. Puede cambiar el nombre de la tabla en el `table` parámetro (ver más abajo). + +Utilice los siguientes parámetros para configurar el inicio de sesión: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [clave de partición personalizada](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) para una tabla del sistema. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +Si la tabla no existe, ClickHouse la creará. Si la estructura del registro de subprocesos de consulta cambió cuando se actualizó el servidor ClickHouse, se cambia el nombre de la tabla con la estructura anterior y se crea una nueva tabla automáticamente. + +**Ejemplo** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## trace\_log {#server_configuration_parameters-trace_log} + +La configuración para el [trace\_log](../../operations/system-tables.md#system_tables-trace_log) operación de la tabla del sistema. + +Parámetros: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [Clave de partición personalizada](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) para una tabla del sistema. +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +El archivo de configuración del servidor predeterminado `config.xml` contiene la siguiente sección de configuración: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## query\_masking\_rules {#query-masking-rules} + +Reglas basadas en Regexp, que se aplicarán a las consultas, así como a todos los mensajes de registro antes de almacenarlos en los registros del servidor, +`system.query_log`, `system.text_log`, `system.processes` tabla, y en los registros enviados al cliente. Eso permite prevenir +fuga de datos sensible de consultas SQL (como nombres, correos electrónicos, +identificadores o números de tarjetas de crédito) a los registros. + +**Ejemplo** + +``` xml + + + hide SSN + (^|\D)\d{3}-\d{2}-\d{4}($|\D) + 000-00-0000 + + +``` + +Campos de configuración: +- `name` - nombre de la regla (opcional) +- `regexp` - Expresión regular compatible con RE2 (obligatoria) +- `replace` - cadena de sustitución para datos confidenciales (opcional, por defecto - seis asteriscos) + +Las reglas de enmascaramiento se aplican a toda la consulta (para evitar fugas de datos confidenciales de consultas mal formadas / no analizables). + +`system.events` la tabla tiene contador `QueryMaskingRulesMatch` que tienen un número total de coincidencias de reglas de enmascaramiento de consultas. + +Para consultas distribuidas, cada servidor debe configurarse por separado; de lo contrario, las subconsultas pasan a otros +los nodos se almacenarán sin enmascarar. + +## remote\_servers {#server-settings-remote-servers} + +Configuración de los clústeres utilizados por [Distribuido](../../engines/table-engines/special/distributed.md) motor de mesa y por el `cluster` función de la tabla. + +**Ejemplo** + +``` xml + +``` + +Para el valor de la `incl` atributo, consulte la sección “[Archivos de configuración](../configuration-files.md#configuration_files)”. + +**Ver también** + +- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) + +## Zona Horaria {#server_configuration_parameters-timezone} + +La zona horaria del servidor. + +Especificado como un identificador de la IANA para la zona horaria UTC o la ubicación geográfica (por ejemplo, África/Abidjan). + +La zona horaria es necesaria para las conversiones entre los formatos String y DateTime cuando los campos DateTime se envían al formato de texto (impreso en la pantalla o en un archivo) y cuando se obtiene DateTime de una cadena. Además, la zona horaria se usa en funciones que funcionan con la hora y la fecha si no recibieron la zona horaria en los parámetros de entrada. + +**Ejemplo** + +``` xml +Europe/Moscow +``` + +## Tcp\_port {#server_configuration_parameters-tcp_port} + +Puerto para comunicarse con clientes a través del protocolo TCP. + +**Ejemplo** + +``` xml +9000 +``` + +## Tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} + +Puerto TCP para una comunicación segura con los clientes. Úselo con [OpenSSL](#server_configuration_parameters-openssl) configuración. + +**Valores posibles** + +Entero positivo. + +**Valor predeterminado** + +``` xml +9440 +``` + +## mysql\_port {#server_configuration_parameters-mysql_port} + +Puerto para comunicarse con clientes a través del protocolo MySQL. + +**Valores posibles** + +Entero positivo. + +Ejemplo + +``` xml +9004 +``` + +## tmp\_path {#server-settings-tmp_path} + +Ruta de acceso a datos temporales para procesar consultas grandes. + +!!! note "Nota" + La barra diagonal es obligatoria. + +**Ejemplo** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## tmp\_policy {#server-settings-tmp-policy} + +Política de [`storage_configuration`](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) para almacenar archivos temporales. +Si no se establece [`tmp_path`](#server-settings-tmp_path) se utiliza, de lo contrario se ignora. + +!!! note "Nota" + - `move_factor` se ignora +- `keep_free_space_bytes` se ignora +- `max_data_part_size_bytes` se ignora +- debe tener exactamente un volumen en esa política + +## Uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} + +Tamaño de la memoria caché (en bytes) para los datos sin comprimir utilizados por los motores de [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md). + +Hay una caché compartida para el servidor. La memoria se asigna a pedido. La caché se usa si la opción [Use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) está habilitado. + +La caché sin comprimir es ventajosa para consultas muy cortas en casos individuales. + +**Ejemplo** + +``` xml +8589934592 +``` + +## user\_files\_path {#server_configuration_parameters-user_files_path} + +El directorio con archivos de usuario. Utilizado en la función de tabla [file()](../../sql-reference/table-functions/file.md). + +**Ejemplo** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## users\_config {#users-config} + +Ruta de acceso al archivo que contiene: + +- Configuraciones de usuario. +- Derechos de acceso. +- Perfiles de configuración. +- Configuración de cuota. + +**Ejemplo** + +``` xml +users.xml +``` + +## Zookeeper {#server-settings_zookeeper} + +Contiene la configuración que permite a ClickHouse interactuar con [ZooKeeper](http://zookeeper.apache.org/) Cluster. + +ClickHouse utiliza ZooKeeper para almacenar metadatos de réplicas cuando se utilizan tablas replicadas. Si no se utilizan tablas replicadas, se puede omitir esta sección de parámetros. + +Esta sección contiene los siguientes parámetros: + +- `node` — ZooKeeper endpoint. You can set multiple endpoints. + + Por ejemplo: + + + +``` xml + + example_host + 2181 + +``` + + The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. + +- `session_timeout` — Maximum timeout for the client session in milliseconds. +- `root` — The [Znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) que se utiliza como la raíz de los znodes utilizados por el servidor ClickHouse. Opcional. +- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. + +**Ejemplo de configuración** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + 10000 + + /path/to/zookeeper/node + + user:password + +``` + +**Ver también** + +- [Replicación](../../engines/table-engines/mergetree-family/replication.md) +- [Guía del programador ZooKeeper](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} + +Método de almacenamiento para encabezados de parte de datos en ZooKeeper. + +Esta configuración sólo se aplica a `MergeTree` familia. Se puede especificar: + +- A nivel mundial en el [merge\_tree](#server_configuration_parameters-merge_tree) sección de la `config.xml` file. + + ClickHouse utiliza la configuración para todas las tablas del servidor. Puede cambiar la configuración en cualquier momento. Las tablas existentes cambian su comportamiento cuando cambia la configuración. + +- Para cada tabla. + + Al crear una tabla, especifique la correspondiente [ajuste del motor](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). El comportamiento de una tabla existente con esta configuración no cambia, incluso si la configuración global cambia. + +**Valores posibles** + +- 0 — Functionality is turned off. +- 1 — Functionality is turned on. + +Si `use_minimalistic_part_header_in_zookeeper = 1`, entonces [repetición](../../engines/table-engines/mergetree-family/replication.md) las tablas almacenan los encabezados de las partes de datos de forma compacta `znode`. Si la tabla contiene muchas columnas, este método de almacenamiento reduce significativamente el volumen de los datos almacenados en Zookeeper. + +!!! attention "Atención" + Después de aplicar `use_minimalistic_part_header_in_zookeeper = 1`, no puede degradar el servidor ClickHouse a una versión que no admite esta configuración. Tenga cuidado al actualizar ClickHouse en servidores de un clúster. No actualice todos los servidores a la vez. Es más seguro probar nuevas versiones de ClickHouse en un entorno de prueba o solo en unos pocos servidores de un clúster. + + Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. + +**Valor predeterminado:** 0. + +## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} + +Deshabilita la memoria caché DNS interna. Recomendado para operar ClickHouse en sistemas +con infraestructura que cambia frecuentemente como Kubernetes. + +**Valor predeterminado:** 0. + +## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} + +El período de actualización de las direcciones IP almacenadas en la caché DNS interna de ClickHouse (en segundos). +La actualización se realiza de forma asíncrona, en un subproceso del sistema separado. + +**Valor predeterminado**: 15. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/es/operations/server_configuration_parameters/index.md b/docs/es/operations/server_configuration_parameters/index.md deleted file mode 100644 index 5a323fec41f..00000000000 --- a/docs/es/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Server Configuration Parameters -toc_priority: 54 -toc_title: "Implantaci\xF3n" ---- - -# Parámetros de configuración del servidor {#server-settings} - -Esta sección contiene descripciones de la configuración del servidor que no se puede cambiar en el nivel de sesión o consulta. - -Estos ajustes se almacenan en el `config.xml` archivo en el servidor ClickHouse. - -Otros ajustes se describen en el “[Configuración](../settings/index.md#settings)” apartado. - -Antes de estudiar la configuración, lea el [Archivos de configuración](../configuration_files.md#configuration_files) sección y tomar nota del uso de sustituciones (el `incl` y `optional` atributo). - -[Artículo Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/es/operations/server_configuration_parameters/settings.md b/docs/es/operations/server_configuration_parameters/settings.md deleted file mode 100644 index 3ec541c3acd..00000000000 --- a/docs/es/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,872 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 57 -toc_title: "Configuraci\xF3n del servidor" ---- - -# Configuración del servidor {#server-settings} - -## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} - -El intervalo en segundos antes de volver a cargar los diccionarios integrados. - -ClickHouse recarga los diccionarios incorporados cada x segundos. Esto hace posible editar diccionarios “on the fly” sin reiniciar el servidor. - -Valor predeterminado: 3600. - -**Ejemplo** - -``` xml -3600 -``` - -## compresión {#server-settings-compression} - -Ajustes de compresión de datos para [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md)-mesas de motor. - -!!! warning "Advertencia" - No lo use si acaba de comenzar a usar ClickHouse. - -Plantilla de configuración: - -``` xml - - - ... - ... - ... - - ... - -``` - -`` campo: - -- `min_part_size` – The minimum size of a data part. -- `min_part_size_ratio` – The ratio of the data part size to the table size. -- `method` – Compression method. Acceptable values: `lz4` o `zstd`. - -Puede configurar múltiples `` apartado. - -Acciones cuando se cumplen las condiciones: - -- Si un elemento de datos coincide con un conjunto de condiciones, ClickHouse utiliza el método de compresión especificado. -- Si un elemento de datos coincide con varios conjuntos de condiciones, ClickHouse utiliza el primer conjunto de condiciones coincidente. - -Si no se cumplen condiciones para un elemento de datos, ClickHouse utiliza el `lz4` compresión. - -**Ejemplo** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## default\_database {#default-database} - -La base de datos predeterminada. - -Para obtener una lista de bases de datos, [SHOW DATABASES](../../sql_reference/statements/show.md#show-databases) consulta. - -**Ejemplo** - -``` xml -default -``` - -## default\_profile {#default-profile} - -Perfil de configuración predeterminado. - -Los perfiles de configuración se encuentran en el archivo especificado en el parámetro `user_config`. - -**Ejemplo** - -``` xml -default -``` - -## Diccionarios\_config {#server_configuration_parameters-dictionaries_config} - -La ruta de acceso al archivo de configuración para diccionarios externos. - -Camino: - -- Especifique la ruta absoluta o la ruta relativa al archivo de configuración del servidor. -- La ruta puede contener comodines \* y ?. - -Ver también “[Diccionarios externos](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)”. - -**Ejemplo** - -``` xml -*_dictionary.xml -``` - -## Diccionarios\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} - -La carga perezosa de los diccionarios. - -Si `true`, entonces cada diccionario es creado en el primer uso. Si se produce un error en la creación del diccionario, la función que estaba utilizando el diccionario produce una excepción. - -Si `false`, todos los diccionarios se crean cuando se inicia el servidor, y si hay un error, el servidor se apaga. - -El valor predeterminado es `true`. - -**Ejemplo** - -``` xml -true -``` - -## format\_schema\_path {#server_configuration_parameters-format_schema_path} - -La ruta de acceso al directorio con los esquemas para los datos de entrada, como los esquemas [CapnProto](../../interfaces/formats.md#capnproto) formato. - -**Ejemplo** - -``` xml - - format_schemas/ -``` - -## grafito {#server_configuration_parameters-graphite} - -Envío de datos a [Grafito](https://github.com/graphite-project). - -Configuración: - -- host – The Graphite server. -- port – The port on the Graphite server. -- interval – The interval for sending, in seconds. -- timeout – The timeout for sending data, in seconds. -- root\_path – Prefix for keys. -- metrics – Sending data from the [sistema.métricas](../../operations/system_tables.md#system_tables-metrics) tabla. -- events – Sending deltas data accumulated for the time period from the [sistema.evento](../../operations/system_tables.md#system_tables-events) tabla. -- events\_cumulative – Sending cumulative data from the [sistema.evento](../../operations/system_tables.md#system_tables-events) tabla. -- asynchronous\_metrics – Sending data from the [sistema.asynchronous\_metrics](../../operations/system_tables.md#system_tables-asynchronous_metrics) tabla. - -Puede configurar múltiples `` clausula. Por ejemplo, puede usar esto para enviar datos diferentes a intervalos diferentes. - -**Ejemplo** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## graphite\_rollup {#server_configuration_parameters-graphite-rollup} - -Ajustes para reducir los datos de grafito. - -Para obtener más información, consulte [GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md). - -**Ejemplo** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## http\_port/https\_port {#http-porthttps-port} - -El puerto para conectarse al servidor a través de HTTP(s). - -Si `https_port` se especifica, [openSSL](#server_configuration_parameters-openssl) debe ser configurado. - -Si `http_port` se especifica, la configuración de OpenSSL se ignora incluso si está establecida. - -**Ejemplo** - -``` xml -0000 -``` - -## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} - -La página que se muestra de forma predeterminada al acceder al servidor HTTP de ClickHouse. -El valor predeterminado es “Ok.” (con un avance de línea al final) - -**Ejemplo** - -Abrir `https://tabix.io/` al acceder `http://localhost: http_port`. - -``` xml - -
]]> -
-``` - -## include\_from {#server_configuration_parameters-include_from} - -La ruta al archivo con sustituciones. - -Para obtener más información, consulte la sección “[Archivos de configuración](../configuration_files.md#configuration_files)”. - -**Ejemplo** - -``` xml -/etc/metrica.xml -``` - -## Interesante {#interserver-http-port} - -Puerto para el intercambio de datos entre servidores ClickHouse. - -**Ejemplo** - -``` xml -9009 -``` - -## Sistema abierto. {#interserver-http-host} - -El nombre de host que pueden utilizar otros servidores para acceder a este servidor. - -Si se omite, se define de la misma manera que el `hostname-f` comando. - -Útil para separarse de una interfaz de red específica. - -**Ejemplo** - -``` xml -example.yandex.ru -``` - -## interserver\_http\_credentials {#server-settings-interserver-http-credentials} - -El nombre de usuario y la contraseña utilizados para [replicación](../../engines/table_engines/mergetree_family/replication.md) con los motores Replicated\*. Estas credenciales sólo se utilizan para la comunicación entre réplicas y no están relacionadas con las credenciales de los clientes de ClickHouse. El servidor está comprobando estas credenciales para conectar réplicas y utiliza las mismas credenciales cuando se conecta a otras réplicas. Por lo tanto, estas credenciales deben establecerse igual para todas las réplicas de un clúster. -De forma predeterminada, la autenticación no se utiliza. - -Esta sección contiene los siguientes parámetros: - -- `user` — username. -- `password` — password. - -**Ejemplo** - -``` xml - - admin - 222 - -``` - -## keep\_alive\_timeout {#keep-alive-timeout} - -El número de segundos que ClickHouse espera las solicitudes entrantes antes de cerrar la conexión. El valor predeterminado es de 3 segundos. - -**Ejemplo** - -``` xml -3 -``` - -## listen\_host {#server_configuration_parameters-listen_host} - -Restricción en hosts de los que pueden provenir las solicitudes. Si desea que el servidor responda a todos ellos, especifique `::`. - -Ejemplos: - -``` xml -::1 -127.0.0.1 -``` - -## registrador {#server_configuration_parameters-logger} - -Configuración de registro. - -Claves: - -- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. -- log – The log file. Contains all the entries according to `level`. -- errorlog – Error log file. -- size – Size of the file. Applies to `log`y`errorlog`. Una vez que el archivo alcanza `size`, ClickHouse archiva y cambia el nombre, y crea un nuevo archivo de registro en su lugar. -- count – The number of archived log files that ClickHouse stores. - -**Ejemplo** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -También se admite la escritura en el syslog. Config ejemplo: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -Claves: - -- use\_syslog — Required setting if you want to write to the syslog. -- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. -- hostname — Optional. The name of the host that logs are sent from. -- facility — [La palabra clave syslog facility](https://en.wikipedia.org/wiki/Syslog#Facility) en letras mayúsculas con el “LOG\_” prefijo: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` y así sucesivamente). - Valor predeterminado: `LOG_USER` si `address` se especifica, `LOG_DAEMON otherwise.` -- format – Message format. Possible values: `bsd` y `syslog.` - -## macro {#macros} - -Sustituciones de parámetros para tablas replicadas. - -Se puede omitir si no se utilizan tablas replicadas. - -Para obtener más información, consulte la sección “[Creación de tablas replicadas](../../engines/table_engines/mergetree_family/replication.md)”. - -**Ejemplo** - -``` xml - -``` - -## Método de codificación de datos: {#server-mark-cache-size} - -Tamaño aproximado (en bytes) de la memoria caché de marcas utilizadas por los motores de [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md) familia. - -La memoria caché se comparte para el servidor y la memoria se asigna según sea necesario. El tamaño de la memoria caché debe ser al menos 5368709120. - -**Ejemplo** - -``` xml -5368709120 -``` - -## max\_concurrent\_queries {#max-concurrent-queries} - -El número máximo de solicitudes procesadas simultáneamente. - -**Ejemplo** - -``` xml -100 -``` - -## max\_connections {#max-connections} - -El número máximo de conexiones entrantes. - -**Ejemplo** - -``` xml -4096 -``` - -## max\_open\_files {#max-open-files} - -El número máximo de archivos abiertos. - -Predeterminada: `maximum`. - -Recomendamos el uso de esta opción en Mac OS X desde la `getrlimit()` la función devuelve un valor incorrecto. - -**Ejemplo** - -``` xml -262144 -``` - -## max\_table\_size\_to\_drop {#max-table-size-to-drop} - -Restricción en la eliminación de tablas. - -Si el tamaño de un [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md) tabla supera `max_table_size_to_drop` (en bytes), no puede eliminarlo usando una consulta DROP. - -Si aún necesita eliminar la tabla sin reiniciar el servidor ClickHouse, cree el `/flags/force_drop_table` y ejecute la consulta DROP. - -Valor predeterminado: 50 GB. - -El valor 0 significa que puede eliminar todas las tablas sin restricciones. - -**Ejemplo** - -``` xml -0 -``` - -## merge\_tree {#server_configuration_parameters-merge_tree} - -Ajuste fino para tablas en el [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md). - -Para obtener más información, vea MergeTreeSettings.h archivo de encabezado. - -**Ejemplo** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -Configuración cliente/servidor SSL. - -El soporte para SSL es proporcionado por el `libpoco` biblioteca. La interfaz se describe en el archivo [Nombre de la red inalámbrica (SSID):h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -Claves para la configuración del servidor/cliente: - -- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. -- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` contiene el certificado. -- caConfig – The path to the file or directory that contains trusted root certificates. -- verificationMode – The method for checking the node's certificates. Details are in the description of the [Contexto](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) clase. Valores posibles: `none`, `relaxed`, `strict`, `once`. -- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. -- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| -- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Valores aceptables: `true`, `false`. -- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. Este parámetro siempre se recomienda ya que ayuda a evitar problemas tanto si el servidor almacena en caché la sesión como si el cliente solicita el almacenamiento en caché. Valor predeterminado: `${application.name}`. -- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. -- sessionTimeout – Time for caching the session on the server. -- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. -- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. -- fips – Activates OpenSSL FIPS mode. Supported if the library's OpenSSL version supports FIPS. -- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . -- disableProtocols – Protocols that are not allowed to use. -- preferServerCiphers – Preferred server ciphers on the client. - -**Ejemplo de configuración:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## part\_log {#server_configuration_parameters-part-log} - -Registro de eventos asociados con [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md). Por ejemplo, agregar o fusionar datos. Puede utilizar el registro para simular algoritmos de combinación y comparar sus características. Puede visualizar el proceso de fusión. - -Las consultas se registran en el [sistema.part\_log](../../operations/system_tables.md#system_tables-part-log) tabla, no en un archivo separado. Puede configurar el nombre de esta tabla en el `table` parámetro (ver más abajo). - -Utilice los siguientes parámetros para configurar el registro: - -- `database` – Name of the database. -- `table` – Name of the system table. -- `partition_by` – Sets a [clave de partición personalizada](../../engines/table_engines/mergetree_family/custom_partitioning_key.md). -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -**Ejemplo** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## camino {#server_configuration_parameters-path} - -La ruta de acceso al directorio que contiene los datos. - -!!! note "Nota" - La barra diagonal es obligatoria. - -**Ejemplo** - -``` xml -/var/lib/clickhouse/ -``` - -## query\_log {#server_configuration_parameters-query-log} - -Configuración de las consultas de registro recibidas con [log\_queries=1](../settings/settings.md) configuración. - -Las consultas se registran en el [sistema.query\_log](../../operations/system_tables.md#system_tables-query_log) tabla, no en un archivo separado. Puede cambiar el nombre de la tabla en el `table` parámetro (ver más abajo). - -Utilice los siguientes parámetros para configurar el inicio de sesión: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [clave de partición personalizada](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) para una mesa. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -Si la tabla no existe, ClickHouse la creará. Si la estructura del registro de consultas cambió cuando se actualizó el servidor ClickHouse, se cambia el nombre de la tabla con la estructura anterior y se crea una nueva tabla automáticamente. - -**Ejemplo** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## Sistema abierto. {#server_configuration_parameters-query-thread-log} - -Configuración de subprocesos de registro de consultas recibidas con [Log\_query\_threads = 1](../settings/settings.md#settings-log-query-threads) configuración. - -Las consultas se registran en el [sistema.Sistema abierto.](../../operations/system_tables.md#system_tables-query-thread-log) tabla, no en un archivo separado. Puede cambiar el nombre de la tabla en el `table` parámetro (ver más abajo). - -Utilice los siguientes parámetros para configurar el inicio de sesión: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [clave de partición personalizada](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) para una tabla del sistema. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -Si la tabla no existe, ClickHouse la creará. Si la estructura del registro de subprocesos de consulta cambió cuando se actualizó el servidor ClickHouse, se cambia el nombre de la tabla con la estructura anterior y se crea una nueva tabla automáticamente. - -**Ejemplo** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## trace\_log {#server_configuration_parameters-trace_log} - -La configuración para el [trace\_log](../../operations/system_tables.md#system_tables-trace_log) operación de la tabla del sistema. - -Parámetros: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [Clave de partición personalizada](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) para una tabla del sistema. -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -El archivo de configuración del servidor predeterminado `config.xml` contiene la siguiente sección de configuración: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## query\_masking\_rules {#query-masking-rules} - -Reglas basadas en Regexp, que se aplicarán a las consultas, así como a todos los mensajes de registro antes de almacenarlos en los registros del servidor, -`system.query_log`, `system.text_log`, `system.processes` tabla, y en los registros enviados al cliente. Eso permite prevenir -fuga de datos sensible de consultas SQL (como nombres, correos electrónicos, -identificadores o números de tarjetas de crédito) a los registros. - -**Ejemplo** - -``` xml - - - hide SSN - (^|\D)\d{3}-\d{2}-\d{4}($|\D) - 000-00-0000 - - -``` - -Campos de configuración: -- `name` - nombre de la regla (opcional) -- `regexp` - Expresión regular compatible con RE2 (obligatoria) -- `replace` - cadena de sustitución para datos confidenciales (opcional, por defecto - seis asteriscos) - -Las reglas de enmascaramiento se aplican a toda la consulta (para evitar fugas de datos confidenciales de consultas mal formadas / no analizables). - -`system.events` la tabla tiene contador `QueryMaskingRulesMatch` que tienen un número total de coincidencias de reglas de enmascaramiento de consultas. - -Para consultas distribuidas, cada servidor debe configurarse por separado; de lo contrario, las subconsultas pasan a otros -los nodos se almacenarán sin enmascarar. - -## remote\_servers {#server-settings-remote-servers} - -Configuración de los clústeres utilizados por [Distribuido](../../engines/table_engines/special/distributed.md) motor de mesa y por el `cluster` función de la tabla. - -**Ejemplo** - -``` xml - -``` - -Para el valor de la `incl` atributo, consulte la sección “[Archivos de configuración](../configuration_files.md#configuration_files)”. - -**Ver también** - -- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) - -## Zona horaria {#server_configuration_parameters-timezone} - -La zona horaria del servidor. - -Especificado como un identificador de la IANA para la zona horaria UTC o la ubicación geográfica (por ejemplo, África/Abidjan). - -La zona horaria es necesaria para las conversiones entre los formatos String y DateTime cuando los campos DateTime se envían al formato de texto (impreso en la pantalla o en un archivo) y cuando se obtiene DateTime de una cadena. Además, la zona horaria se usa en funciones que funcionan con la hora y la fecha si no recibieron la zona horaria en los parámetros de entrada. - -**Ejemplo** - -``` xml -Europe/Moscow -``` - -## Tcp\_port {#server_configuration_parameters-tcp_port} - -Puerto para comunicarse con clientes a través del protocolo TCP. - -**Ejemplo** - -``` xml -9000 -``` - -## Tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} - -Puerto TCP para una comunicación segura con los clientes. Úselo con [OpenSSL](#server_configuration_parameters-openssl) configuración. - -**Valores posibles** - -Entero positivo. - -**Valor predeterminado** - -``` xml -9440 -``` - -## mysql\_port {#server_configuration_parameters-mysql_port} - -Puerto para comunicarse con clientes a través del protocolo MySQL. - -**Valores posibles** - -Entero positivo. - -Ejemplo - -``` xml -9004 -``` - -## tmp\_path {#server-settings-tmp_path} - -Ruta de acceso a datos temporales para procesar consultas grandes. - -!!! note "Nota" - La barra diagonal es obligatoria. - -**Ejemplo** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## tmp\_policy {#server-settings-tmp-policy} - -Política de [`storage_configuration`](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) para almacenar archivos temporales. -Si no se establece [`tmp_path`](#server-settings-tmp_path) se utiliza, de lo contrario se ignora. - -!!! note "Nota" - - `move_factor` se ignora -- `keep_free_space_bytes` se ignora -- `max_data_part_size_bytes` se ignora -- debe tener exactamente un volumen en esa política - -## Uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} - -Tamaño de la memoria caché (en bytes) para los datos sin comprimir utilizados por los motores de [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md). - -Hay una caché compartida para el servidor. La memoria se asigna a pedido. La caché se usa si la opción [Use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) está habilitado. - -La caché sin comprimir es ventajosa para consultas muy cortas en casos individuales. - -**Ejemplo** - -``` xml -8589934592 -``` - -## user\_files\_path {#server_configuration_parameters-user_files_path} - -El directorio con archivos de usuario. Utilizado en la función de tabla [file()](../../sql_reference/table_functions/file.md). - -**Ejemplo** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## users\_config {#users-config} - -Ruta de acceso al archivo que contiene: - -- Configuraciones de usuario. -- Derechos de acceso. -- Perfiles de configuración. -- Configuración de cuota. - -**Ejemplo** - -``` xml -users.xml -``` - -## Zookeeper {#server-settings_zookeeper} - -Contiene la configuración que permite a ClickHouse interactuar con [ZooKeeper](http://zookeeper.apache.org/) Cluster. - -ClickHouse utiliza ZooKeeper para almacenar metadatos de réplicas cuando se utilizan tablas replicadas. Si no se utilizan tablas replicadas, se puede omitir esta sección de parámetros. - -Esta sección contiene los siguientes parámetros: - -- `node` — ZooKeeper endpoint. You can set multiple endpoints. - - Por ejemplo: - - - -``` xml - - example_host - 2181 - -``` - - The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. - -- `session_timeout` — Maximum timeout for the client session in milliseconds. -- `root` — The [Znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) que se utiliza como la raíz de los znodes utilizados por el servidor ClickHouse. Opcional. -- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. - -**Ejemplo de configuración** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - 10000 - - /path/to/zookeeper/node - - user:password - -``` - -**Ver también** - -- [Replicación](../../engines/table_engines/mergetree_family/replication.md) -- [Guía del programador ZooKeeper](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} - -Método de almacenamiento para encabezados de parte de datos en ZooKeeper. - -Esta configuración sólo se aplica a `MergeTree` familia. Se puede especificar: - -- A nivel mundial en el [merge\_tree](#server_configuration_parameters-merge_tree) sección de la `config.xml` file. - - ClickHouse utiliza la configuración para todas las tablas del servidor. Puede cambiar la configuración en cualquier momento. Las tablas existentes cambian su comportamiento cuando cambia la configuración. - -- Para cada tabla. - - Al crear una tabla, especifique la correspondiente [ajuste del motor](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). El comportamiento de una tabla existente con esta configuración no cambia, incluso si la configuración global cambia. - -**Valores posibles** - -- 0 — Functionality is turned off. -- 1 — Functionality is turned on. - -Si `use_minimalistic_part_header_in_zookeeper = 1`, entonces [repetición](../../engines/table_engines/mergetree_family/replication.md) las tablas almacenan los encabezados de las partes de datos de forma compacta `znode`. Si la tabla contiene muchas columnas, este método de almacenamiento reduce significativamente el volumen de los datos almacenados en Zookeeper. - -!!! attention "Atención" - Después de aplicar `use_minimalistic_part_header_in_zookeeper = 1`, no puede degradar el servidor ClickHouse a una versión que no admite esta configuración. Tenga cuidado al actualizar ClickHouse en servidores de un clúster. No actualice todos los servidores a la vez. Es más seguro probar nuevas versiones de ClickHouse en un entorno de prueba o solo en unos pocos servidores de un clúster. - - Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. - -**Valor predeterminado:** 0. - -## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} - -Deshabilita la memoria caché DNS interna. Recomendado para operar ClickHouse en sistemas -con infraestructura que cambia frecuentemente como Kubernetes. - -**Valor predeterminado:** 0. - -## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} - -El período de actualización de las direcciones IP almacenadas en la caché DNS interna de ClickHouse (en segundos). -La actualización se realiza de forma asíncrona, en un subproceso del sistema separado. - -**Valor predeterminado**: 15. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/es/operations/settings/constraints-on-settings.md b/docs/es/operations/settings/constraints-on-settings.md new file mode 100644 index 00000000000..6adc0fa9488 --- /dev/null +++ b/docs/es/operations/settings/constraints-on-settings.md @@ -0,0 +1,75 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 62 +toc_title: "Restricciones en la configuraci\xF3n" +--- + +# Restricciones En La configuración {#constraints-on-settings} + +Las restricciones en los ajustes se pueden definir en el `profiles` sección de la `user.xml` el archivo de configuración y prohíba a los usuarios cambiar algunos de los ajustes `SET` consulta. +Las restricciones se definen como las siguientes: + +``` xml + + + + + lower_boundary + + + upper_boundary + + + lower_boundary + upper_boundary + + + + + + + +``` + +Si el usuario intenta violar las restricciones, se lanza una excepción y la configuración no se cambia. +Se admiten tres tipos de restricciones: `min`, `max`, `readonly`. El `min` y `max` Las restricciones especifican los límites superior e inferior para una configuración numérica y se pueden usar en combinación. El `readonly` constraint especifica que el usuario no puede cambiar la configuración correspondiente en absoluto. + +**Ejemplo:** Dejar `users.xml` incluye líneas: + +``` xml + + + 10000000000 + 0 + ... + + + 5000000000 + 20000000000 + + + + + + + +``` + +Las siguientes consultas arrojan excepciones: + +``` sql +SET max_memory_usage=20000000001; +SET max_memory_usage=4999999999; +SET force_index_by_date=1; +``` + +``` text +Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be greater than 20000000000. +Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be less than 5000000000. +Code: 452, e.displayText() = DB::Exception: Setting force_index_by_date should not be changed. +``` + +**Nota:** el `default` perfil tiene un manejo especial: todas las restricciones definidas para el `default` profile se convierten en las restricciones predeterminadas, por lo que restringen a todos los usuarios hasta que se anulan explícitamente para estos usuarios. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/constraints_on_settings/) diff --git a/docs/es/operations/settings/constraints_on_settings.md b/docs/es/operations/settings/constraints_on_settings.md deleted file mode 100644 index 498ce115ec5..00000000000 --- a/docs/es/operations/settings/constraints_on_settings.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 62 -toc_title: "Restricciones en la configuraci\xF3n" ---- - -# Restricciones en la configuración {#constraints-on-settings} - -Las restricciones en los ajustes se pueden definir en el `profiles` sección de la `user.xml` el archivo de configuración y prohíba a los usuarios cambiar algunos de los ajustes `SET` consulta. -Las restricciones se definen como las siguientes: - -``` xml - - - - - lower_boundary - - - upper_boundary - - - lower_boundary - upper_boundary - - - - - - - -``` - -Si el usuario intenta violar las restricciones, se lanza una excepción y la configuración no se cambia. -Se admiten tres tipos de restricciones: `min`, `max`, `readonly`. El `min` y `max` Las restricciones especifican los límites superior e inferior para una configuración numérica y se pueden usar en combinación. El `readonly` constraint especifica que el usuario no puede cambiar la configuración correspondiente en absoluto. - -**Ejemplo:** Dejar `users.xml` incluye líneas: - -``` xml - - - 10000000000 - 0 - ... - - - 5000000000 - 20000000000 - - - - - - - -``` - -Las siguientes consultas arrojan excepciones: - -``` sql -SET max_memory_usage=20000000001; -SET max_memory_usage=4999999999; -SET force_index_by_date=1; -``` - -``` text -Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be greater than 20000000000. -Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be less than 5000000000. -Code: 452, e.displayText() = DB::Exception: Setting force_index_by_date should not be changed. -``` - -**Nota:** el `default` perfil tiene un manejo especial: todas las restricciones definidas para el `default` profile se convierten en las restricciones predeterminadas, por lo que restringen a todos los usuarios hasta que se anulan explícitamente para estos usuarios. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/constraints_on_settings/) diff --git a/docs/es/operations/settings/permissions-for-queries.md b/docs/es/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..2737f5d2f97 --- /dev/null +++ b/docs/es/operations/settings/permissions-for-queries.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 58 +toc_title: Permisos para consultas +--- + +# Permisos Para Consultas {#permissions_for_queries} + +Las consultas en ClickHouse se pueden dividir en varios tipos: + +1. Leer consultas de datos: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. Escribir consultas de datos: `INSERT`, `OPTIMIZE`. +3. Cambiar la consulta de configuración: `SET`, `USE`. +4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) consulta: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +La siguiente configuración regula los permisos de usuario según el tipo de consulta: + +- [sólo lectura](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. +- [Método de codificación de datos:](#settings_allow_ddl) — Restricts permissions for DDL queries. + +`KILL QUERY` se puede realizar con cualquier configuración. + +## sólo lectura {#settings_readonly} + +Restringe los permisos para leer datos, escribir datos y cambiar las consultas de configuración. + +Vea cómo las consultas se dividen en tipos [arriba](#permissions_for_queries). + +Valores posibles: + +- 0 — All queries are allowed. +- 1 — Only read data queries are allowed. +- 2 — Read data and change settings queries are allowed. + +Después de configurar `readonly = 1` el usuario no puede cambiar `readonly` y `allow_ddl` configuración en la sesión actual. + +Cuando se utiliza el `GET` método en el [Interfaz HTTP](../../interfaces/http.md), `readonly = 1` se establece automáticamente. Para modificar los datos, `POST` método. + +Configuración `readonly = 1` prohibir al usuario cambiar todas las configuraciones. Hay una manera de prohibir al usuario +de cambiar sólo ajustes específicos, para más detalles ver [restricciones en la configuración](constraints-on-settings.md). + +Valor predeterminado: 0 + +## Método De codificación De Datos: {#settings_allow_ddl} + +Permite o niega [DDL](https://en.wikipedia.org/wiki/Data_definition_language) consulta. + +Vea cómo las consultas se dividen en tipos [arriba](#permissions_for_queries). + +Valores posibles: + +- 0 — DDL queries are not allowed. +- 1 — DDL queries are allowed. + +No se puede ejecutar `SET allow_ddl = 1` si `allow_ddl = 0` para la sesión actual. + +Valor predeterminado: 1 + +[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/es/operations/settings/permissions_for_queries.md b/docs/es/operations/settings/permissions_for_queries.md deleted file mode 100644 index 8bb684bbe66..00000000000 --- a/docs/es/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 58 -toc_title: Permisos para consultas ---- - -# Permisos para consultas {#permissions_for_queries} - -Las consultas en ClickHouse se pueden dividir en varios tipos: - -1. Leer consultas de datos: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. Escribir consultas de datos: `INSERT`, `OPTIMIZE`. -3. Cambiar la consulta de configuración: `SET`, `USE`. -4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) consulta: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -La siguiente configuración regula los permisos de usuario según el tipo de consulta: - -- [sólo lectura](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. -- [Método de codificación de datos:](#settings_allow_ddl) — Restricts permissions for DDL queries. - -`KILL QUERY` se puede realizar con cualquier configuración. - -## sólo lectura {#settings_readonly} - -Restringe los permisos para leer datos, escribir datos y cambiar las consultas de configuración. - -Vea cómo las consultas se dividen en tipos [arriba](#permissions_for_queries). - -Valores posibles: - -- 0 — All queries are allowed. -- 1 — Only read data queries are allowed. -- 2 — Read data and change settings queries are allowed. - -Después de configurar `readonly = 1` el usuario no puede cambiar `readonly` y `allow_ddl` configuración en la sesión actual. - -Cuando se utiliza el `GET` método en el [Interfaz HTTP](../../interfaces/http.md), `readonly = 1` se establece automáticamente. Para modificar los datos, `POST` método. - -Configuración `readonly = 1` prohibir al usuario cambiar todas las configuraciones. Hay una manera de prohibir al usuario -de cambiar sólo ajustes específicos, para más detalles ver [restricciones en la configuración](constraints_on_settings.md). - -Valor predeterminado: 0 - -## Método de codificación de datos: {#settings_allow_ddl} - -Permite o niega [DDL](https://en.wikipedia.org/wiki/Data_definition_language) consulta. - -Vea cómo las consultas se dividen en tipos [arriba](#permissions_for_queries). - -Valores posibles: - -- 0 — DDL queries are not allowed. -- 1 — DDL queries are allowed. - -No se puede ejecutar `SET allow_ddl = 1` si `allow_ddl = 0` para la sesión actual. - -Valor predeterminado: 1 - -[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/es/operations/settings/query-complexity.md b/docs/es/operations/settings/query-complexity.md new file mode 100644 index 00000000000..fff8cf3cc15 --- /dev/null +++ b/docs/es/operations/settings/query-complexity.md @@ -0,0 +1,301 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 59 +toc_title: Restricciones en la complejidad de consultas +--- + +# Restricciones En La Complejidad De Consultas {#restrictions-on-query-complexity} + +Las restricciones en la complejidad de la consulta forman parte de la configuración. +Se utilizan para proporcionar una ejecución más segura desde la interfaz de usuario. +Casi todas las restricciones solo se aplican a `SELECT`. Para el procesamiento de consultas distribuidas, las restricciones se aplican en cada servidor por separado. + +ClickHouse comprueba las restricciones para las partes de datos, no para cada fila. Significa que puede exceder el valor de restricción con el tamaño de la parte de datos. + +Restricciones en el “maximum amount of something” puede tomar el valor 0, lo que significa “unrestricted”. +La mayoría de las restricciones también tienen un ‘overflow\_mode’ establecer, lo que significa qué hacer cuando se excede el límite. +Puede tomar uno de dos valores: `throw` o `break`. Las restricciones en la agregación (group\_by\_overflow\_mode) también tienen el valor `any`. + +`throw` – Throw an exception (default). + +`break` – Stop executing the query and return the partial result, as if the source data ran out. + +`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. + +## Método De codificación De Datos: {#settings_max_memory_usage} + +La cantidad máxima de RAM que se utiliza para ejecutar una consulta en un único servidor. + +En el archivo de configuración predeterminado, el máximo es de 10 GB. + +La configuración no tiene en cuenta el volumen de memoria disponible ni el volumen total de memoria en la máquina. +La restricción se aplica a una sola consulta dentro de un único servidor. +Usted puede utilizar `SHOW PROCESSLIST` para ver el consumo de memoria actual para cada consulta. +Además, el consumo máximo de memoria se rastrea para cada consulta y se escribe en el registro. + +El uso de memoria no se supervisa para los estados de ciertas funciones agregadas. + +El uso de memoria no se realiza un seguimiento completo de los estados de las funciones agregadas `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` de `String` y `Array` argumento. + +El consumo de memoria también está restringido por los parámetros `max_memory_usage_for_user` y `max_memory_usage_for_all_queries`. + +## Max\_memory\_usage\_for\_user {#max-memory-usage-for-user} + +La cantidad máxima de RAM que se utilizará para ejecutar las consultas de un usuario en un único servidor. + +Los valores predeterminados se definen en [Configuración.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). De forma predeterminada, el importe no está restringido (`max_memory_usage_for_user = 0`). + +Ver también la descripción de [Método de codificación de datos:](#settings_max_memory_usage). + +## Todos Los Derechos Reservados {#max-memory-usage-for-all-queries} + +La cantidad máxima de RAM que se utilizará para ejecutar todas las consultas en un único servidor. + +Los valores predeterminados se definen en [Configuración.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). De forma predeterminada, el importe no está restringido (`max_memory_usage_for_all_queries = 0`). + +Ver también la descripción de [Método de codificación de datos:](#settings_max_memory_usage). + +## ¿Qué puedes encontrar en Neodigit {#max-rows-to-read} + +Las siguientes restricciones se pueden verificar en cada bloque (en lugar de en cada fila). Es decir, las restricciones se pueden romper un poco. +Al ejecutar una consulta en varios subprocesos, las siguientes restricciones se aplican a cada subproceso por separado. + +Un número máximo de filas que se pueden leer de una tabla al ejecutar una consulta. + +## ¿Qué puedes encontrar en Neodigit {#max-bytes-to-read} + +Un número máximo de bytes (datos sin comprimir) que se pueden leer de una tabla al ejecutar una consulta. + +## Método De codificación De Datos: {#read-overflow-mode} + +Qué hacer cuando el volumen de datos leídos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. + +## Método De codificación De Datos: {#settings-max-rows-to-group-by} + +Un número máximo de claves únicas recibidas de la agregación. Esta configuración le permite limitar el consumo de memoria al agregar. + +## Grupo\_by\_overflow\_mode {#group-by-overflow-mode} + +Qué hacer cuando el número de claves únicas para la agregación excede el límite: ‘throw’, ‘break’, o ‘any’. Por defecto, throw. +Uso de la ‘any’ valor le permite ejecutar una aproximación de GROUP BY. La calidad de esta aproximación depende de la naturaleza estadística de los datos. + +## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} + +Habilita o deshabilita la ejecución de `GROUP BY` en la memoria externa. Ver [GROUP BY en memoria externa](../../sql-reference/statements/select.md#select-group-by-in-external-memory). + +Valores posibles: + +- Volumen máximo de RAM (en bytes) que puede ser utilizado por el único [GROUP BY](../../sql-reference/statements/select.md#select-group-by-clause) operación. +- 0 — `GROUP BY` en la memoria externa deshabilitada. + +Valor predeterminado: 0. + +## Método De codificación De Datos: {#max-rows-to-sort} + +Un número máximo de filas antes de ordenar. Esto le permite limitar el consumo de memoria al ordenar. + +## Método De codificación De Datos: {#max-bytes-to-sort} + +Un número máximo de bytes antes de ordenar. + +## sort\_overflow\_mode {#sort-overflow-mode} + +Qué hacer si el número de filas recibidas antes de ordenar excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. + +## max\_result\_rows {#setting-max_result_rows} + +Límite en el número de filas en el resultado. También se comprueba si hay subconsultas y en servidores remotos cuando se ejecutan partes de una consulta distribuida. + +## max\_result\_bytes {#max-result-bytes} + +Límite en el número de bytes en el resultado. Lo mismo que el ajuste anterior. + +## result\_overflow\_mode {#result-overflow-mode} + +Qué hacer si el volumen del resultado excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. + +Utilizar ‘break’ es similar a usar LIMIT. `Break` interrumpe la ejecución sólo en el nivel de bloque. Esto significa que la cantidad de filas devueltas es mayor que [max\_result\_rows](#setting-max_result_rows), múltiplo de [max\_block\_size](settings.md#setting-max_block_size) y depende de [max\_threads](settings.md#settings-max_threads). + +Ejemplo: + +``` sql +SET max_threads = 3, max_block_size = 3333; +SET max_result_rows = 3334, result_overflow_mode = 'break'; + +SELECT * +FROM numbers_mt(100000) +FORMAT Null; +``` + +Resultado: + +``` text +6666 rows in set. ... +``` + +## max\_execution\_time {#max-execution-time} + +Tiempo máximo de ejecución de la consulta en segundos. +En este momento, no se comprueba una de las etapas de clasificación, o al fusionar y finalizar funciones agregadas. + +## timeout\_overflow\_mode {#timeout-overflow-mode} + +Qué hacer si la consulta se ejecuta más de ‘max\_execution\_time’: ‘throw’ o ‘break’. Por defecto, throw. + +## Método De codificación De Datos: {#min-execution-speed} + +Velocidad de ejecución mínima en filas por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es menor, se produce una excepción. + +## Todos Los Derechos Reservados {#min-execution-speed-bytes} + +Un número mínimo de bytes de ejecución por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es menor, se produce una excepción. + +## Max\_execution\_speed {#max-execution-speed} + +Un número máximo de filas de ejecución por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es alta, la velocidad de ejecución se reducirá. + +## Max\_execution\_speed\_bytes {#max-execution-speed-bytes} + +Un número máximo de bytes de ejecución por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es alta, la velocidad de ejecución se reducirá. + +## Tiempo De Espera Antes De comprobar\_ejecución\_velocidad {#timeout-before-checking-execution-speed} + +Comprueba que la velocidad de ejecución no sea demasiado lenta (no menos de ‘min\_execution\_speed’), después de que el tiempo especificado en segundos haya expirado. + +## Max\_columns\_to\_read {#max-columns-to-read} + +Un número máximo de columnas que se pueden leer de una tabla en una sola consulta. Si una consulta requiere leer un mayor número de columnas, produce una excepción. + +## max\_temporary\_columns {#max-temporary-columns} + +Un número máximo de columnas temporales que se deben mantener en la memoria RAM al mismo tiempo cuando se ejecuta una consulta, incluidas las columnas constantes. Si hay más columnas temporales que esto, arroja una excepción. + +## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} + +Lo mismo que ‘max\_temporary\_columns’, pero sin contar columnas constantes. +Tenga en cuenta que las columnas constantes se forman con bastante frecuencia cuando se ejecuta una consulta, pero requieren aproximadamente cero recursos informáticos. + +## max\_subquery\_depth {#max-subquery-depth} + +Profundidad máxima de anidamiento de subconsultas. Si las subconsultas son más profundas, se produce una excepción. De forma predeterminada, 100. + +## max\_pipeline\_depth {#max-pipeline-depth} + +Profundidad máxima de la tubería. Corresponde al número de transformaciones que realiza cada bloque de datos durante el procesamiento de consultas. Contado dentro de los límites de un único servidor. Si la profundidad de la canalización es mayor, se produce una excepción. Por defecto, 1000. + +## max\_ast\_depth {#max-ast-depth} + +Profundidad máxima de anidamiento de un árbol sintáctico de consulta. Si se supera, se produce una excepción. +En este momento, no se verifica durante el análisis, sino solo después de analizar la consulta. Es decir, se puede crear un árbol sintáctico demasiado profundo durante el análisis, pero la consulta fallará. Por defecto, 1000. + +## max\_ast\_elements {#max-ast-elements} + +Un número máximo de elementos en un árbol sintáctico de consulta. Si se supera, se produce una excepción. +De la misma manera que la configuración anterior, se verifica solo después de analizar la consulta. De forma predeterminada, 50.000. + +## Método De codificación De Datos: {#max-rows-in-set} + +Un número máximo de filas para un conjunto de datos en la cláusula IN creada a partir de una subconsulta. + +## Método De codificación De Datos: {#max-bytes-in-set} + +Número máximo de bytes (datos sin comprimir) utilizados por un conjunto en la cláusula IN creada a partir de una subconsulta. + +## set\_overflow\_mode {#set-overflow-mode} + +Qué hacer cuando la cantidad de datos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. + +## Método De codificación De Datos: {#max-rows-in-distinct} + +Un número máximo de filas diferentes al usar DISTINCT. + +## Método De codificación De Datos: {#max-bytes-in-distinct} + +Un número máximo de bytes utilizados por una tabla hash cuando se utiliza DISTINCT. + +## distinct\_overflow\_mode {#distinct-overflow-mode} + +Qué hacer cuando la cantidad de datos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. + +## max\_rows\_to\_transfer {#max-rows-to-transfer} + +Un número máximo de filas que se pueden pasar a un servidor remoto o guardar en una tabla temporal cuando se utiliza GLOBAL IN. + +## max\_bytes\_to\_transfer {#max-bytes-to-transfer} + +Un número máximo de bytes (datos sin comprimir) que se pueden pasar a un servidor remoto o guardar en una tabla temporal cuando se utiliza GLOBAL IN. + +## transfer\_overflow\_mode {#transfer-overflow-mode} + +Qué hacer cuando la cantidad de datos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. + +## Método De codificación De Datos: {#settings-max_rows_in_join} + +Limita el número de filas de la tabla hash que se utiliza al unir tablas. + +Esta configuración se aplica a [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) operaciones y la [Unir](../../engines/table-engines/special/join.md) motor de mesa. + +Si una consulta contiene varias combinaciones, ClickHouse comprueba esta configuración para cada resultado intermedio. + +ClickHouse puede proceder con diferentes acciones cuando se alcanza el límite. Utilice el [join\_overflow\_mode](#settings-join_overflow_mode) configuración para elegir la acción. + +Valores posibles: + +- Entero positivo. +- 0 — Unlimited number of rows. + +Valor predeterminado: 0. + +## Método De codificación De Datos: {#settings-max_bytes_in_join} + +Limita el tamaño en bytes de la tabla hash utilizada al unir tablas. + +Esta configuración se aplica a [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) operaciones y [Unirse al motor de tabla](../../engines/table-engines/special/join.md). + +Si la consulta contiene combinaciones, ClickHouse comprueba esta configuración para cada resultado intermedio. + +ClickHouse puede proceder con diferentes acciones cuando se alcanza el límite. Utilizar [join\_overflow\_mode](#settings-join_overflow_mode) para elegir la acción. + +Valores posibles: + +- Entero positivo. +- 0 — Memory control is disabled. + +Valor predeterminado: 0. + +## join\_overflow\_mode {#settings-join_overflow_mode} + +Define qué acción realiza ClickHouse cuando se alcanza cualquiera de los siguientes límites de combinación: + +- [Método de codificación de datos:](#settings-max_bytes_in_join) +- [Método de codificación de datos:](#settings-max_rows_in_join) + +Valores posibles: + +- `THROW` — ClickHouse throws an exception and breaks operation. +- `BREAK` — ClickHouse breaks operation and doesn’t throw an exception. + +Valor predeterminado: `THROW`. + +**Ver también** + +- [Cláusula JOIN](../../sql-reference/statements/select.md#select-join) +- [Unirse al motor de tabla](../../engines/table-engines/special/join.md) + +## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} + +Limita el número máximo de particiones en un único bloque insertado. + +- Entero positivo. +- 0 — Unlimited number of partitions. + +Valor predeterminado: 100. + +**Detalles** + +Al insertar datos, ClickHouse calcula el número de particiones en el bloque insertado. Si el número de particiones es mayor que `max_partitions_per_insert_block`, ClickHouse lanza una excepción con el siguiente texto: + +> “Too many partitions for single INSERT block (more than” ¿Cómo puedo hacerlo? “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” + +[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/es/operations/settings/query_complexity.md b/docs/es/operations/settings/query_complexity.md deleted file mode 100644 index 243ce5a0297..00000000000 --- a/docs/es/operations/settings/query_complexity.md +++ /dev/null @@ -1,301 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 59 -toc_title: Restricciones en la complejidad de consultas ---- - -# Restricciones en la complejidad de consultas {#restrictions-on-query-complexity} - -Las restricciones en la complejidad de la consulta forman parte de la configuración. -Se utilizan para proporcionar una ejecución más segura desde la interfaz de usuario. -Casi todas las restricciones solo se aplican a `SELECT`. Para el procesamiento de consultas distribuidas, las restricciones se aplican en cada servidor por separado. - -ClickHouse comprueba las restricciones para las partes de datos, no para cada fila. Significa que puede exceder el valor de restricción con el tamaño de la parte de datos. - -Restricciones en el “maximum amount of something” puede tomar el valor 0, lo que significa “unrestricted”. -La mayoría de las restricciones también tienen un ‘overflow\_mode’ establecer, lo que significa qué hacer cuando se excede el límite. -Puede tomar uno de dos valores: `throw` o `break`. Las restricciones en la agregación (group\_by\_overflow\_mode) también tienen el valor `any`. - -`throw` – Throw an exception (default). - -`break` – Stop executing the query and return the partial result, as if the source data ran out. - -`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don't add new keys to the set. - -## Método de codificación de datos: {#settings_max_memory_usage} - -La cantidad máxima de RAM que se utiliza para ejecutar una consulta en un único servidor. - -En el archivo de configuración predeterminado, el máximo es de 10 GB. - -La configuración no tiene en cuenta el volumen de memoria disponible ni el volumen total de memoria en la máquina. -La restricción se aplica a una sola consulta dentro de un único servidor. -Usted puede utilizar `SHOW PROCESSLIST` para ver el consumo de memoria actual para cada consulta. -Además, el consumo máximo de memoria se rastrea para cada consulta y se escribe en el registro. - -El uso de memoria no se supervisa para los estados de ciertas funciones agregadas. - -El uso de memoria no se realiza un seguimiento completo de los estados de las funciones agregadas `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` de `String` y `Array` argumento. - -El consumo de memoria también está restringido por los parámetros `max_memory_usage_for_user` y `max_memory_usage_for_all_queries`. - -## Max\_memory\_usage\_for\_user {#max-memory-usage-for-user} - -La cantidad máxima de RAM que se utilizará para ejecutar las consultas de un usuario en un único servidor. - -Los valores predeterminados se definen en [Configuración.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). De forma predeterminada, el importe no está restringido (`max_memory_usage_for_user = 0`). - -Ver también la descripción de [Método de codificación de datos:](#settings_max_memory_usage). - -## Todos los derechos reservados. {#max-memory-usage-for-all-queries} - -La cantidad máxima de RAM que se utilizará para ejecutar todas las consultas en un único servidor. - -Los valores predeterminados se definen en [Configuración.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). De forma predeterminada, el importe no está restringido (`max_memory_usage_for_all_queries = 0`). - -Ver también la descripción de [Método de codificación de datos:](#settings_max_memory_usage). - -## ¿Qué puedes encontrar en Neodigit {#max-rows-to-read} - -Las siguientes restricciones se pueden verificar en cada bloque (en lugar de en cada fila). Es decir, las restricciones se pueden romper un poco. -Al ejecutar una consulta en varios subprocesos, las siguientes restricciones se aplican a cada subproceso por separado. - -Un número máximo de filas que se pueden leer de una tabla al ejecutar una consulta. - -## ¿Qué puedes encontrar en Neodigit {#max-bytes-to-read} - -Un número máximo de bytes (datos sin comprimir) que se pueden leer de una tabla al ejecutar una consulta. - -## Método de codificación de datos: {#read-overflow-mode} - -Qué hacer cuando el volumen de datos leídos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. - -## Método de codificación de datos: {#settings-max-rows-to-group-by} - -Un número máximo de claves únicas recibidas de la agregación. Esta configuración le permite limitar el consumo de memoria al agregar. - -## Grupo\_by\_overflow\_mode {#group-by-overflow-mode} - -Qué hacer cuando el número de claves únicas para la agregación excede el límite: ‘throw’, ‘break’, o ‘any’. Por defecto, throw. -Uso de la ‘any’ valor le permite ejecutar una aproximación de GROUP BY. La calidad de esta aproximación depende de la naturaleza estadística de los datos. - -## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} - -Habilita o deshabilita la ejecución de `GROUP BY` en la memoria externa. Ver [GROUP BY en memoria externa](../../sql_reference/statements/select.md#select-group-by-in-external-memory). - -Valores posibles: - -- Volumen máximo de RAM (en bytes) que puede ser utilizado por el único [GROUP BY](../../sql_reference/statements/select.md#select-group-by-clause) operación. -- 0 — `GROUP BY` en la memoria externa deshabilitada. - -Valor predeterminado: 0. - -## Método de codificación de datos: {#max-rows-to-sort} - -Un número máximo de filas antes de ordenar. Esto le permite limitar el consumo de memoria al ordenar. - -## Método de codificación de datos: {#max-bytes-to-sort} - -Un número máximo de bytes antes de ordenar. - -## sort\_overflow\_mode {#sort-overflow-mode} - -Qué hacer si el número de filas recibidas antes de ordenar excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. - -## max\_result\_rows {#setting-max_result_rows} - -Límite en el número de filas en el resultado. También se comprueba si hay subconsultas y en servidores remotos cuando se ejecutan partes de una consulta distribuida. - -## max\_result\_bytes {#max-result-bytes} - -Límite en el número de bytes en el resultado. Lo mismo que el ajuste anterior. - -## result\_overflow\_mode {#result-overflow-mode} - -Qué hacer si el volumen del resultado excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. - -Utilizar ‘break’ es similar a usar LIMIT. `Break` interrumpe la ejecución sólo en el nivel de bloque. Esto significa que la cantidad de filas devueltas es mayor que [max\_result\_rows](#setting-max_result_rows), múltiplo de [max\_block\_size](settings.md#setting-max_block_size) y depende de [max\_threads](settings.md#settings-max_threads). - -Ejemplo: - -``` sql -SET max_threads = 3, max_block_size = 3333; -SET max_result_rows = 3334, result_overflow_mode = 'break'; - -SELECT * -FROM numbers_mt(100000) -FORMAT Null; -``` - -Resultado: - -``` text -6666 rows in set. ... -``` - -## max\_execution\_time {#max-execution-time} - -Tiempo máximo de ejecución de la consulta en segundos. -En este momento, no se comprueba una de las etapas de clasificación, o al fusionar y finalizar funciones agregadas. - -## timeout\_overflow\_mode {#timeout-overflow-mode} - -Qué hacer si la consulta se ejecuta más de ‘max\_execution\_time’: ‘throw’ o ‘break’. Por defecto, throw. - -## Método de codificación de datos: {#min-execution-speed} - -Velocidad de ejecución mínima en filas por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es menor, se produce una excepción. - -## Todos los derechos reservados. {#min-execution-speed-bytes} - -Un número mínimo de bytes de ejecución por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es menor, se produce una excepción. - -## Max\_execution\_speed {#max-execution-speed} - -Un número máximo de filas de ejecución por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es alta, la velocidad de ejecución se reducirá. - -## Max\_execution\_speed\_bytes {#max-execution-speed-bytes} - -Un número máximo de bytes de ejecución por segundo. Comprobado en cada bloque de datos cuando ‘timeout\_before\_checking\_execution\_speed’ expirar. Si la velocidad de ejecución es alta, la velocidad de ejecución se reducirá. - -## Tiempo de espera antes de comprobar\_ejecución\_velocidad {#timeout-before-checking-execution-speed} - -Comprueba que la velocidad de ejecución no sea demasiado lenta (no menos de ‘min\_execution\_speed’), después de que el tiempo especificado en segundos haya expirado. - -## Max\_columns\_to\_read {#max-columns-to-read} - -Un número máximo de columnas que se pueden leer de una tabla en una sola consulta. Si una consulta requiere leer un mayor número de columnas, produce una excepción. - -## max\_temporary\_columns {#max-temporary-columns} - -Un número máximo de columnas temporales que se deben mantener en la memoria RAM al mismo tiempo cuando se ejecuta una consulta, incluidas las columnas constantes. Si hay más columnas temporales que esto, arroja una excepción. - -## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} - -Lo mismo que ‘max\_temporary\_columns’, pero sin contar columnas constantes. -Tenga en cuenta que las columnas constantes se forman con bastante frecuencia cuando se ejecuta una consulta, pero requieren aproximadamente cero recursos informáticos. - -## max\_subquery\_depth {#max-subquery-depth} - -Profundidad máxima de anidamiento de subconsultas. Si las subconsultas son más profundas, se produce una excepción. De forma predeterminada, 100. - -## max\_pipeline\_depth {#max-pipeline-depth} - -Profundidad máxima de la tubería. Corresponde al número de transformaciones que realiza cada bloque de datos durante el procesamiento de consultas. Contado dentro de los límites de un único servidor. Si la profundidad de la canalización es mayor, se produce una excepción. Por defecto, 1000. - -## max\_ast\_depth {#max-ast-depth} - -Profundidad máxima de anidamiento de un árbol sintáctico de consulta. Si se supera, se produce una excepción. -En este momento, no se verifica durante el análisis, sino solo después de analizar la consulta. Es decir, se puede crear un árbol sintáctico demasiado profundo durante el análisis, pero la consulta fallará. Por defecto, 1000. - -## max\_ast\_elements {#max-ast-elements} - -Un número máximo de elementos en un árbol sintáctico de consulta. Si se supera, se produce una excepción. -De la misma manera que la configuración anterior, se verifica solo después de analizar la consulta. De forma predeterminada, 50.000. - -## Método de codificación de datos: {#max-rows-in-set} - -Un número máximo de filas para un conjunto de datos en la cláusula IN creada a partir de una subconsulta. - -## Método de codificación de datos: {#max-bytes-in-set} - -Número máximo de bytes (datos sin comprimir) utilizados por un conjunto en la cláusula IN creada a partir de una subconsulta. - -## set\_overflow\_mode {#set-overflow-mode} - -Qué hacer cuando la cantidad de datos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. - -## Método de codificación de datos: {#max-rows-in-distinct} - -Un número máximo de filas diferentes al usar DISTINCT. - -## Método de codificación de datos: {#max-bytes-in-distinct} - -Un número máximo de bytes utilizados por una tabla hash cuando se utiliza DISTINCT. - -## distinct\_overflow\_mode {#distinct-overflow-mode} - -Qué hacer cuando la cantidad de datos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. - -## max\_rows\_to\_transfer {#max-rows-to-transfer} - -Un número máximo de filas que se pueden pasar a un servidor remoto o guardar en una tabla temporal cuando se utiliza GLOBAL IN. - -## max\_bytes\_to\_transfer {#max-bytes-to-transfer} - -Un número máximo de bytes (datos sin comprimir) que se pueden pasar a un servidor remoto o guardar en una tabla temporal cuando se utiliza GLOBAL IN. - -## transfer\_overflow\_mode {#transfer-overflow-mode} - -Qué hacer cuando la cantidad de datos excede uno de los límites: ‘throw’ o ‘break’. Por defecto, throw. - -## Método de codificación de datos: {#settings-max_rows_in_join} - -Limita el número de filas de la tabla hash que se utiliza al unir tablas. - -Esta configuración se aplica a [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) operaciones y la [Unir](../../engines/table_engines/special/join.md) motor de mesa. - -Si una consulta contiene varias combinaciones, ClickHouse comprueba esta configuración para cada resultado intermedio. - -ClickHouse puede proceder con diferentes acciones cuando se alcanza el límite. Utilice el [join\_overflow\_mode](#settings-join_overflow_mode) configuración para elegir la acción. - -Valores posibles: - -- Entero positivo. -- 0 — Unlimited number of rows. - -Valor predeterminado: 0. - -## Método de codificación de datos: {#settings-max_bytes_in_join} - -Limita el tamaño en bytes de la tabla hash utilizada al unir tablas. - -Esta configuración se aplica a [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) operaciones y [Unirse al motor de tabla](../../engines/table_engines/special/join.md). - -Si la consulta contiene combinaciones, ClickHouse comprueba esta configuración para cada resultado intermedio. - -ClickHouse puede proceder con diferentes acciones cuando se alcanza el límite. Utilizar [join\_overflow\_mode](#settings-join_overflow_mode) para elegir la acción. - -Valores posibles: - -- Entero positivo. -- 0 — Memory control is disabled. - -Valor predeterminado: 0. - -## join\_overflow\_mode {#settings-join_overflow_mode} - -Define qué acción realiza ClickHouse cuando se alcanza cualquiera de los siguientes límites de combinación: - -- [Método de codificación de datos:](#settings-max_bytes_in_join) -- [Método de codificación de datos:](#settings-max_rows_in_join) - -Valores posibles: - -- `THROW` — ClickHouse throws an exception and breaks operation. -- `BREAK` — ClickHouse breaks operation and doesn't throw an exception. - -Valor predeterminado: `THROW`. - -**Ver también** - -- [Cláusula JOIN](../../sql_reference/statements/select.md#select-join) -- [Unirse al motor de tabla](../../engines/table_engines/special/join.md) - -## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} - -Limita el número máximo de particiones en un único bloque insertado. - -- Entero positivo. -- 0 — Unlimited number of partitions. - -Valor predeterminado: 100. - -**Detalles** - -Al insertar datos, ClickHouse calcula el número de particiones en el bloque insertado. Si el número de particiones es mayor que `max_partitions_per_insert_block`, ClickHouse lanza una excepción con el siguiente texto: - -> “Too many partitions for single INSERT block (more than” ¿Cómo puedo hacerlo? “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” - -[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/es/operations/settings/settings-profiles.md b/docs/es/operations/settings/settings-profiles.md new file mode 100644 index 00000000000..fdde0976986 --- /dev/null +++ b/docs/es/operations/settings/settings-profiles.md @@ -0,0 +1,71 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 61 +toc_title: "Perfiles de configuraci\xF3n" +--- + +# Perfiles De configuración {#settings-profiles} + +Un perfil de configuración es una colección de configuraciones agrupadas con el mismo nombre. Cada usuario de ClickHouse tiene un perfil. +Para aplicar todos los ajustes de un perfil, establezca el `profile` configuración. + +Ejemplo: + +Instale el `web` perfil. + +``` sql +SET profile = 'web' +``` + +Los perfiles de configuración se declaran en el archivo de configuración del usuario. Esto suele ser `users.xml`. + +Ejemplo: + +``` xml + + + + + + 8 + + + + + 1000000000 + 100000000000 + + 1000000 + any + + 1000000 + 1000000000 + + 100000 + 100000000 + break + + 600 + 1000000 + 15 + + 25 + 100 + 50 + + 2 + 25 + 50 + 100 + + 1 + + +``` + +El ejemplo especifica dos perfiles: `default` y `web`. El `default` tiene un propósito especial: siempre debe estar presente y se aplica al iniciar el servidor. En otras palabras, el `default` perfil contiene la configuración predeterminada. El `web` profile es un perfil regular que se puede establecer utilizando el `SET` consulta o utilizando un parámetro URL en una consulta HTTP. + +Los perfiles de configuración pueden heredar unos de otros. Para usar la herencia, indique una o varias `profile` configuraciones antes de las demás configuraciones que se enumeran en el perfil. En caso de que se defina una configuración en diferentes perfiles, se utiliza la última definida. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/settings_profiles/) diff --git a/docs/es/operations/settings/settings-users.md b/docs/es/operations/settings/settings-users.md new file mode 100644 index 00000000000..86db864ff92 --- /dev/null +++ b/docs/es/operations/settings/settings-users.md @@ -0,0 +1,148 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 63 +toc_title: "Configuraci\xF3n del usuario" +--- + +# Configuración Del Usuario {#user-settings} + +El `users` sección de la `user.xml` el archivo de configuración contiene la configuración del usuario. + +Estructura del `users` apartado: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### user\_name/contraseña {#user-namepassword} + +La contraseña se puede especificar en texto sin formato o en SHA256 (formato hexagonal). + +- Para asignar una contraseña en texto sin formato (**no se recomienda**), colóquelo en un `password` elemento. + + Por ejemplo, `qwerty`. La contraseña se puede dejar en blanco. + + + +- Para asignar una contraseña utilizando su hash SHA256, colóquela en un `password_sha256_hex` elemento. + + Por ejemplo, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + Ejemplo de cómo generar una contraseña desde el shell: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + + La primera línea del resultado es la contraseña. La segunda línea es el hash SHA256 correspondiente. + + + +- Para la compatibilidad con los clientes MySQL, la contraseña se puede especificar en doble hash SHA1. Colóquelo en `password_double_sha1_hex` elemento. + + Por ejemplo, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + Ejemplo de cómo generar una contraseña desde el shell: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + + La primera línea del resultado es la contraseña. La segunda línea es el hash SHA1 doble correspondiente. + +### user\_name/redes {#user-namenetworks} + +Lista de redes desde las que el usuario puede conectarse al servidor ClickHouse. + +Cada elemento de la lista puede tener una de las siguientes formas: + +- `` — IP address or network mask. + + Ejemplos: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Hostname. + + Ejemplo: `example01.host.ru`. + + Para comprobar el acceso, se realiza una consulta DNS y todas las direcciones IP devueltas se comparan con la dirección del mismo nivel. + +- `` — Regular expression for hostnames. + + Ejemplo, `^example\d\d-\d\d-\d\.host\.ru$` + + Para comprobar el acceso, un [Consulta de DNS PTR](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) se realiza para la dirección del mismo nivel y luego se aplica la expresión regular especificada. A continuación, se realiza otra consulta DNS para los resultados de la consulta PTR y todas las direcciones recibidas se comparan con la dirección del mismo nivel. Recomendamos encarecidamente que regexp termine con $ . + +Todos los resultados de las solicitudes DNS se almacenan en caché hasta que el servidor se reinicia. + +**Ejemplos** + +Para abrir el acceso del usuario desde cualquier red, especifique: + +``` xml +::/0 +``` + +!!! warning "Advertencia" + No es seguro abrir el acceso desde cualquier red a menos que tenga un firewall configurado correctamente o el servidor no esté conectado directamente a Internet. + +Para abrir el acceso solo desde localhost, especifique: + +``` xml +::1 +127.0.0.1 +``` + +### user\_name/perfil {#user-nameprofile} + +Puede asignar un perfil de configuración para el usuario. Los perfiles de configuración se configuran en una sección separada del `users.xml` file. Para obtener más información, consulte [Perfiles de configuración](settings-profiles.md). + +### user\_name/cuota {#user-namequota} + +Las cuotas le permiten realizar un seguimiento o limitar el uso de recursos durante un período de tiempo. Las cuotas se configuran en el `quotas` +sección de la `users.xml` archivo de configuración. + +Puede asignar un conjunto de cuotas para el usuario. Para obtener una descripción detallada de la configuración de las cuotas, consulte [Cuota](../quotas.md#quotas). + +### nombre\_usuario/bases de datos {#user-namedatabases} + +En esta sección, puede limitar las filas devueltas por ClickHouse para `SELECT` consultas realizadas por el usuario actual, implementando así la seguridad básica a nivel de fila. + +**Ejemplo** + +La siguiente configuración obliga a que el usuario `user1` sólo puede ver las filas de `table1` como resultado de `SELECT` consultas, donde el valor de la `id` campo es 1000. + +``` xml + + + + + id = 1000 + + + + +``` + +El `filter` puede ser cualquier expresión que resulte en un [UInt8](../../sql-reference/data-types/int-uint.md)-tipo de valor. Por lo general, contiene comparaciones y operadores lógicos. Filas de `database_name.table1` donde los resultados del filtro a 0 no se devuelven para este usuario. El filtrado es incompatible con `PREWHERE` operaciones y desactiva `WHERE→PREWHERE` optimización. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/es/operations/settings/settings.md b/docs/es/operations/settings/settings.md index dd92922aec2..4f21ecd2219 100644 --- a/docs/es/operations/settings/settings.md +++ b/docs/es/operations/settings/settings.md @@ -9,7 +9,7 @@ toc_title: "Configuraci\xF3n" ## distributed\_product\_mode {#distributed-product-mode} -Cambia el comportamiento de [subconsultas distribuidas](../../sql_reference/statements/select.md). +Cambia el comportamiento de [subconsultas distribuidas](../../sql-reference/statements/select.md). ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table. @@ -18,7 +18,7 @@ Restricción: - Solo se aplica para las subconsultas IN y JOIN. - Solo si la sección FROM utiliza una tabla distribuida que contiene más de un fragmento. - Si la subconsulta se refiere a una tabla distribuida que contiene más de un fragmento. -- No se usa para un valor de tabla [remoto](../../sql_reference/table_functions/remote.md) función. +- No se usa para un valor de tabla [remoto](../../sql-reference/table-functions/remote.md) función. Valores posibles: @@ -53,7 +53,7 @@ Si `enable_optimize_predicate_expression = 0`, entonces el tiempo de ejecución ## fallback\_to\_stale\_replicas\_for\_distributed\_queries {#settings-fallback_to_stale_replicas_for_distributed_queries} -Fuerza una consulta a una réplica obsoleta si los datos actualizados no están disponibles. Ver [Replicación](../../engines/table_engines/mergetree_family/replication.md). +Fuerza una consulta a una réplica obsoleta si los datos actualizados no están disponibles. Ver [Replicación](../../engines/table-engines/mergetree-family/replication.md). ClickHouse selecciona la más relevante de las réplicas obsoletas de la tabla. @@ -61,13 +61,13 @@ Se utiliza al realizar `SELECT` desde una tabla distribuida que apunta a tablas De forma predeterminada, 1 (habilitado). -## Fecha de nacimiento {#settings-force_index_by_date} +## Fecha De Nacimiento {#settings-force_index_by_date} Deshabilita la ejecución de consultas si el índice no se puede usar por fecha. Funciona con tablas de la familia MergeTree. -Si `force_index_by_date=1`, ClickHouse comprueba si la consulta tiene una condición de clave de fecha que se puede usar para restringir intervalos de datos. Si no hay una condición adecuada, arroja una excepción. Sin embargo, no comprueba si la condición reduce la cantidad de datos a leer. Por ejemplo, la condición `Date != ' 2000-01-01 '` es aceptable incluso cuando coincide con todos los datos de la tabla (es decir, ejecutar la consulta requiere un escaneo completo). Para obtener más información acerca de los intervalos de datos en las tablas MergeTree, vea [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md). +Si `force_index_by_date=1`, ClickHouse comprueba si la consulta tiene una condición de clave de fecha que se puede usar para restringir intervalos de datos. Si no hay una condición adecuada, arroja una excepción. Sin embargo, no comprueba si la condición reduce la cantidad de datos a leer. Por ejemplo, la condición `Date != ' 2000-01-01 '` es aceptable incluso cuando coincide con todos los datos de la tabla (es decir, ejecutar la consulta requiere un escaneo completo). Para obtener más información acerca de los intervalos de datos en las tablas MergeTree, vea [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md). ## force\_primary\_key {#force-primary-key} @@ -75,11 +75,11 @@ Deshabilita la ejecución de consultas si no es posible la indexación mediante Funciona con tablas de la familia MergeTree. -Si `force_primary_key=1`, ClickHouse comprueba si la consulta tiene una condición de clave principal que se puede usar para restringir rangos de datos. Si no hay una condición adecuada, arroja una excepción. Sin embargo, no comprueba si la condición reduce la cantidad de datos a leer. Para obtener más información acerca de los intervalos de datos en las tablas MergeTree, consulte [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md). +Si `force_primary_key=1`, ClickHouse comprueba si la consulta tiene una condición de clave principal que se puede usar para restringir rangos de datos. Si no hay una condición adecuada, arroja una excepción. Sin embargo, no comprueba si la condición reduce la cantidad de datos a leer. Para obtener más información acerca de los intervalos de datos en las tablas MergeTree, consulte [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md). ## Formato\_esquema {#format-schema} -Este parámetro es útil cuando se utilizan formatos que requieren una definición de esquema, como [Cap'n Proto](https://capnproto.org/) o [Protobuf](https://developers.google.com/protocol-buffers/). El valor depende del formato. +Este parámetro es útil cuando se utilizan formatos que requieren una definición de esquema, como [Cap’n Proto](https://capnproto.org/) o [Protobuf](https://developers.google.com/protocol-buffers/). El valor depende del formato. ## fsync\_metadata {#fsync-metadata} @@ -134,9 +134,9 @@ Valores posibles: Valor predeterminado: 0. -## Nombre de la red inalámbrica (SSID): {#setting-max_http_get_redirects} +## Nombre De La Red inalámbrica (SSID): {#setting-max_http_get_redirects} -Limita el número máximo de saltos de redirección HTTP GET para [URL](../../engines/table_engines/special/url.md)-mesas de motor. La configuración se aplica a ambos tipos de tablas: las creadas por [CREATE TABLE](../../query_language/create/#create-table-query) consulta y por el [URL](../../sql_reference/table_functions/url.md) función de la tabla. +Limita el número máximo de saltos de redirección HTTP GET para [URL](../../engines/table-engines/special/url.md)-mesas de motor. La configuración se aplica a ambos tipos de tablas: las creadas por [CREATE TABLE](../../query_language/create/#create-table-query) consulta y por el [URL](../../sql-reference/table-functions/url.md) función de la tabla. Valores posibles: @@ -172,7 +172,7 @@ Si ambos `input_format_allow_errors_num` y `input_format_allow_errors_ratio` se ## input\_format\_values\_interpret\_expressions {#settings-input_format_values_interpret_expressions} -Habilita o deshabilita el analizador SQL completo si el analizador de secuencias rápidas no puede analizar los datos. Esta configuración sólo se utiliza para [Valor](../../interfaces/formats.md#data-format-values) formato en la inserción de datos. Para obtener más información sobre el análisis de sintaxis, consulte [Sintaxis](../../sql_reference/syntax.md) apartado. +Habilita o deshabilita el analizador SQL completo si el analizador de secuencias rápidas no puede analizar los datos. Esta configuración sólo se utiliza para [Valor](../../interfaces/formats.md#data-format-values) formato en la inserción de datos. Para obtener más información sobre el análisis de sintaxis, consulte [Sintaxis](../../sql-reference/syntax.md) apartado. Valores posibles: @@ -188,7 +188,7 @@ Valor predeterminado: 1. Ejemplo de uso -Inserte el [FechaHora](../../sql_reference/data_types/datetime.md) valor de tipo con los diferentes ajustes. +Inserte el [FechaHora](../../sql-reference/data-types/datetime.md) valor de tipo con los diferentes ajustes. ``` sql SET input_format_values_interpret_expressions = 0; @@ -333,7 +333,7 @@ Valor predeterminado: 1. Permite elegir un analizador de la representación de texto de fecha y hora. -La configuración no se aplica a [Funciones de fecha y hora](../../sql_reference/functions/date_time_functions.md). +La configuración no se aplica a [Funciones de fecha y hora](../../sql-reference/functions/date-time-functions.md). Valores posibles: @@ -349,12 +349,12 @@ Valor predeterminado: `'basic'`. Ver también: -- [Tipo de datos DateTime.](../../sql_reference/data_types/datetime.md) -- [Funciones para trabajar con fechas y horas.](../../sql_reference/functions/date_time_functions.md) +- [Tipo de datos DateTime.](../../sql-reference/data-types/datetime.md) +- [Funciones para trabajar con fechas y horas.](../../sql-reference/functions/date-time-functions.md) -## Por favor, introduzca su dirección de correo electrónico {#settings-join_default_strictness} +## Por Favor, Introduzca Su dirección De Correo electrónico {#settings-join_default_strictness} -Establece el rigor predeterminado para [Cláusulas JOIN](../../sql_reference/statements/select.md#select-join). +Establece el rigor predeterminado para [Cláusulas JOIN](../../sql-reference/statements/select.md#select-join). Valores posibles: @@ -370,7 +370,7 @@ Valor predeterminado: `ALL`. Cambia el comportamiento de las operaciones de unión con `ANY` rigor. !!! warning "Atención" - Esta configuración sólo se aplica a `JOIN` operaciones con [Unir](../../engines/table_engines/special/join.md) mesas de motores. + Esta configuración sólo se aplica a `JOIN` operaciones con [Unir](../../engines/table-engines/special/join.md) mesas de motores. Valores posibles: @@ -381,18 +381,18 @@ Valor predeterminado: 0. Ver también: -- [Cláusula JOIN](../../sql_reference/statements/select.md#select-join) -- [Unirse al motor de tabla](../../engines/table_engines/special/join.md) +- [Cláusula JOIN](../../sql-reference/statements/select.md#select-join) +- [Unirse al motor de tabla](../../engines/table-engines/special/join.md) - [Por favor, introduzca su dirección de correo electrónico](#settings-join_default_strictness) -## Sistema abierto. {#join_use_nulls} +## Sistema Abierto {#join_use_nulls} -Establece el tipo de [JOIN](../../sql_reference/statements/select.md) comportamiento. Al fusionar tablas, pueden aparecer celdas vacías. ClickHouse los rellena de manera diferente según esta configuración. +Establece el tipo de [JOIN](../../sql-reference/statements/select.md) comportamiento. Al fusionar tablas, pueden aparecer celdas vacías. ClickHouse los rellena de manera diferente según esta configuración. Valores posibles: - 0 — The empty cells are filled with the default value of the corresponding field type. -- 1 — `JOIN` se comporta de la misma manera que en SQL estándar. El tipo del campo correspondiente se convierte en [NULL](../../sql_reference/data_types/nullable.md#data_type-nullable), y las celdas vacías se llenan con [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` se comporta de la misma manera que en SQL estándar. El tipo del campo correspondiente se convierte en [NULL](../../sql-reference/data-types/nullable.md#data_type-nullable), y las celdas vacías se llenan con [NULL](../../sql-reference/syntax.md). Valor predeterminado: 0. @@ -412,7 +412,7 @@ Por defecto: 1,000,000. Solo funciona cuando se lee desde los motores MergeTree. ## merge\_tree\_min\_rows\_for\_concurrent\_read {#setting-merge-tree-min-rows-for-concurrent-read} -Si el número de filas que se leerán de un fichero [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md) tabla supera `merge_tree_min_rows_for_concurrent_read` luego ClickHouse intenta realizar una lectura simultánea de este archivo en varios hilos. +Si el número de filas que se leerán de un fichero [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md) tabla supera `merge_tree_min_rows_for_concurrent_read` luego ClickHouse intenta realizar una lectura simultánea de este archivo en varios hilos. Valores posibles: @@ -422,7 +422,7 @@ Valor predeterminado: 163840. ## merge\_tree\_min\_bytes\_for\_concurrent\_read {#setting-merge-tree-min-bytes-for-concurrent-read} -Si el número de bytes a leer de un archivo de un [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md)-La tabla del motor excede `merge_tree_min_bytes_for_concurrent_read`, entonces ClickHouse intenta leer simultáneamente este archivo en varios subprocesos. +Si el número de bytes a leer de un archivo de un [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md)-La tabla del motor excede `merge_tree_min_bytes_for_concurrent_read`, entonces ClickHouse intenta leer simultáneamente este archivo en varios subprocesos. Valor posible: @@ -430,7 +430,7 @@ Valor posible: Valor predeterminado: 251658240. -## Método de codificación de datos: {#setting-merge-tree-min-rows-for-seek} +## Método De codificación De Datos: {#setting-merge-tree-min-rows-for-seek} Si la distancia entre dos bloques de datos que se leen en un archivo es menor que `merge_tree_min_rows_for_seek` filas, luego ClickHouse no busca a través del archivo, sino que lee los datos secuencialmente. @@ -464,7 +464,7 @@ Valor predeterminado: 8. Si ClickHouse debería leer más de `merge_tree_max_rows_to_use_cache` en una consulta, no usa la memoria caché de bloques sin comprimir. -La memoria caché de bloques sin comprimir almacena datos extraídos para consultas. ClickHouse utiliza esta memoria caché para acelerar las respuestas a pequeñas consultas repetidas. Esta configuración protege la memoria caché del deterioro de las consultas que leen una gran cantidad de datos. El [Uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuración del servidor define el tamaño de la memoria caché de bloques sin comprimir. +La memoria caché de bloques sin comprimir almacena datos extraídos para consultas. ClickHouse utiliza esta memoria caché para acelerar las respuestas a pequeñas consultas repetidas. Esta configuración protege la memoria caché del deterioro de las consultas que leen una gran cantidad de datos. El [Uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuración del servidor define el tamaño de la memoria caché de bloques sin comprimir. Valores posibles: @@ -476,7 +476,7 @@ Default value: 128 ✕ 8192. Si ClickHouse debería leer más de `merge_tree_max_bytes_to_use_cache` bytes en una consulta, no usa el caché de bloques sin comprimir. -La memoria caché de bloques sin comprimir almacena datos extraídos para consultas. ClickHouse utiliza esta memoria caché para acelerar las respuestas a pequeñas consultas repetidas. Esta configuración protege la memoria caché del deterioro de las consultas que leen una gran cantidad de datos. El [Uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuración del servidor define el tamaño de la memoria caché de bloques sin comprimir. +La memoria caché de bloques sin comprimir almacena datos extraídos para consultas. ClickHouse utiliza esta memoria caché para acelerar las respuestas a pequeñas consultas repetidas. Esta configuración protege la memoria caché del deterioro de las consultas que leen una gran cantidad de datos. El [Uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuración del servidor define el tamaño de la memoria caché de bloques sin comprimir. Valor posible: @@ -484,7 +484,7 @@ Valor posible: Valor predeterminado: 2013265920. -## Todos los derechos reservados. {#settings-min-bytes-to-use-direct-io} +## Todos Los Derechos Reservados {#settings-min-bytes-to-use-direct-io} El volumen de datos mínimo necesario para utilizar el acceso directo de E/S al disco de almacenamiento. @@ -501,7 +501,7 @@ Valor predeterminado: 0. Configuración del registro de consultas. -Las consultas enviadas a ClickHouse con esta configuración se registran de acuerdo con las reglas [query\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-log) parámetro de configuración del servidor. +Las consultas enviadas a ClickHouse con esta configuración se registran de acuerdo con las reglas [query\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-log) parámetro de configuración del servidor. Ejemplo: @@ -513,7 +513,7 @@ log_queries=1 Configuración del registro de subprocesos de consulta. -Los subprocesos de consultas ejecutados por ClickHouse con esta configuración se registran de acuerdo con las reglas en el [Sistema abierto.](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) parámetro de configuración del servidor. +Los subprocesos de consultas ejecutados por ClickHouse con esta configuración se registran de acuerdo con las reglas en el [Sistema abierto.](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) parámetro de configuración del servidor. Ejemplo: @@ -535,7 +535,7 @@ El valor predeterminado es ligeramente más que `max_block_size`. La razón de e ## max\_replica\_delay\_for\_distributed\_queries {#settings-max_replica_delay_for_distributed_queries} -Deshabilita las réplicas rezagadas para consultas distribuidas. Ver [Replicación](../../engines/table_engines/mergetree_family/replication.md). +Deshabilita las réplicas rezagadas para consultas distribuidas. Ver [Replicación](../../engines/table-engines/mergetree-family/replication.md). Establece el tiempo en segundos. Si una réplica tiene un retraso superior al valor establecido, no se utiliza esta réplica. @@ -558,7 +558,7 @@ Para las consultas que se completan rápidamente debido a un LIMIT, puede establ Cuanto menor sea el `max_threads` valor, menos memoria se consume. -## Método de codificación de datos: {#settings-max-insert-threads} +## Método De codificación De Datos: {#settings-max-insert-threads} El número máximo de subprocesos para ejecutar el `INSERT SELECT` consulta. @@ -578,9 +578,9 @@ El tamaño máximo de bloques de datos sin comprimir antes de comprimir para esc No confunda bloques para la compresión (un fragmento de memoria que consta de bytes) con bloques para el procesamiento de consultas (un conjunto de filas de una tabla). -## Descripción del producto {#min-compress-block-size} +## Descripción Del Producto {#min-compress-block-size} -Para [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md)" tabla. Para reducir la latencia al procesar consultas, un bloque se comprime al escribir la siguiente marca si su tamaño es al menos ‘min\_compress\_block\_size’. De forma predeterminada, 65.536. +Para [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md)" tabla. Para reducir la latencia al procesar consultas, un bloque se comprime al escribir la siguiente marca si su tamaño es al menos ‘min\_compress\_block\_size’. De forma predeterminada, 65.536. El tamaño real del bloque, si los datos sin comprimir son menores que ‘max\_compress\_block\_size’, no es menor que este valor y no menor que el volumen de datos para una marca. @@ -658,7 +658,7 @@ Para obtener más información, consulte la sección “Extreme values”. ## Use\_uncompressed\_cache {#setting-use_uncompressed_cache} Si se debe usar una memoria caché de bloques sin comprimir. Acepta 0 o 1. De forma predeterminada, 0 (deshabilitado). -El uso de la memoria caché sin comprimir (solo para tablas de la familia MergeTree) puede reducir significativamente la latencia y aumentar el rendimiento cuando se trabaja con un gran número de consultas cortas. Habilite esta configuración para los usuarios que envían solicitudes cortas frecuentes. También preste atención al [Uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. +El uso de la memoria caché sin comprimir (solo para tablas de la familia MergeTree) puede reducir significativamente la latencia y aumentar el rendimiento cuando se trabaja con un gran número de consultas cortas. Habilite esta configuración para los usuarios que envían solicitudes cortas frecuentes. También preste atención al [Uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. Para consultas que leen al menos un volumen algo grande de datos (un millón de filas o más), la memoria caché sin comprimir se desactiva automáticamente para ahorrar espacio para consultas realmente pequeñas. Esto significa que puede mantener el ‘use\_uncompressed\_cache’ ajuste siempre establecido en 1. @@ -667,13 +667,13 @@ Para consultas que leen al menos un volumen algo grande de datos (un millón de Cuando se utiliza la interfaz HTTP, el ‘query\_id’ parámetro puede ser pasado. Se trata de cualquier cadena que sirva como identificador de consulta. Si una consulta del mismo usuario ‘query\_id’ que ya existe en este momento, el comportamiento depende de la ‘replace\_running\_query’ parámetro. -`0` (default) – Throw an exception (don't allow the query to run if a query with the same ‘query\_id’ ya se está ejecutando). +`0` (default) – Throw an exception (don’t allow the query to run if a query with the same ‘query\_id’ ya se está ejecutando). `1` – Cancel the old query and start running the new one. El Yandex.Metrica utiliza este parámetro establecido en 1 para implementar sugerencias para las condiciones de segmentación. Después de ingresar el siguiente carácter, si la consulta anterior aún no ha finalizado, debe cancelarse. -## Nombre de la red inalámbrica (SSID): {#stream-flush-interval-ms} +## Nombre De La Red inalámbrica (SSID): {#stream-flush-interval-ms} Funciona para tablas con streaming en el caso de un tiempo de espera, o cuando un subproceso genera [Max\_insert\_block\_size](#settings-max_insert_block_size) filas. @@ -692,7 +692,7 @@ ClickHouse admite los siguientes algoritmos para elegir réplicas: - [En orden](#load_balancing-in_order) - [Primero o aleatorio](#load_balancing-first_or_random) -### Aleatorio (por defecto) {#load_balancing-random} +### Aleatorio (por Defecto) {#load_balancing-random} ``` sql load_balancing = random @@ -701,13 +701,13 @@ load_balancing = random El número de errores se cuenta para cada réplica. La consulta se envía a la réplica con el menor número de errores, y si hay varios de estos, a cualquiera de ellos. Desventajas: La proximidad del servidor no se tiene en cuenta; si las réplicas tienen datos diferentes, también obtendrá datos diferentes. -### Nombre de host más cercano {#load_balancing-nearest_hostname} +### Nombre De Host más Cercano {#load_balancing-nearest_hostname} ``` sql load_balancing = nearest_hostname ``` -The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server's hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). +The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server’s hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). Por ejemplo, example01-01-1 y example01-01-2.yandex.ru son diferentes en una posición, mientras que example01-01-1 y example01-02-2 difieren en dos lugares. Este método puede parecer primitivo, pero no requiere datos externos sobre la topología de red, y no compara las direcciones IP, lo que sería complicado para nuestras direcciones IPv6. @@ -715,7 +715,7 @@ Este método puede parecer primitivo, pero no requiere datos externos sobre la t Por lo tanto, si hay réplicas equivalentes, se prefiere la más cercana por nombre. También podemos suponer que al enviar una consulta al mismo servidor, en ausencia de fallas, una consulta distribuida también irá a los mismos servidores. Por lo tanto, incluso si se colocan datos diferentes en las réplicas, la consulta devolverá principalmente los mismos resultados. -### En orden {#load_balancing-in_order} +### En Orden {#load_balancing-in_order} ``` sql load_balancing = in_order @@ -724,7 +724,7 @@ load_balancing = in_order Se accede a las réplicas con el mismo número de errores en el mismo orden en que se especifican en la configuración. Este método es apropiado cuando se sabe exactamente qué réplica es preferible. -### Primero o aleatorio {#load_balancing-first_or_random} +### Primero o Aleatorio {#load_balancing-first_or_random} ``` sql load_balancing = first_or_random @@ -778,7 +778,7 @@ For testing, the value can be set to 0: compilation runs synchronously and the q Si el valor es 1 o más, la compilación se produce de forma asíncrona en un subproceso independiente. El resultado se utilizará tan pronto como esté listo, incluidas las consultas que se están ejecutando actualmente. Se requiere código compilado para cada combinación diferente de funciones agregadas utilizadas en la consulta y el tipo de claves en la cláusula GROUP BY. -The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don't use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. +The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don’t use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. ## output\_format\_json\_quote\_64bit\_integers {#session_settings-output_format_json_quote_64bit_integers} @@ -886,10 +886,10 @@ Uso De forma predeterminada, la desduplicación no se realiza para las vistas materializadas, sino que se realiza en sentido ascendente, en la tabla de origen. Si se omite un bloque INSERTed debido a la desduplicación en la tabla de origen, no habrá inserción en las vistas materializadas adjuntas. Este comportamiento existe para permitir la inserción de datos altamente agregados en vistas materializadas, para los casos en que los bloques insertados son los mismos después de la agregación de vistas materializadas pero derivados de diferentes INSERT en la tabla de origen. -Al mismo tiempo, este comportamiento “breaks” `INSERT` idempotencia. Si una `INSERT` en la mesa principal fue exitoso y `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won't receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` permite cambiar este comportamiento. Al reintentar, una vista materializada recibirá la inserción de repetición y realizará la comprobación de desduplicación por sí misma, +Al mismo tiempo, este comportamiento “breaks” `INSERT` idempotencia. Si una `INSERT` en la mesa principal fue exitoso y `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won’t receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` permite cambiar este comportamiento. Al reintentar, una vista materializada recibirá la inserción de repetición y realizará la comprobación de desduplicación por sí misma, ignorando el resultado de la comprobación para la tabla de origen, e insertará filas perdidas debido a la primera falla. -## Método de codificación de datos: {#settings-max-network-bytes} +## Método De codificación De Datos: {#settings-max-network-bytes} Limita el volumen de datos (en bytes) que se recibe o se transmite a través de la red al ejecutar una consulta. Esta configuración se aplica a cada consulta individual. @@ -900,7 +900,7 @@ Valores posibles: Valor predeterminado: 0. -## Método de codificación de datos: {#settings-max-network-bandwidth} +## Método De codificación De Datos: {#settings-max-network-bandwidth} Limita la velocidad del intercambio de datos a través de la red en bytes por segundo. Esta configuración se aplica a todas las consultas. @@ -911,7 +911,7 @@ Valores posibles: Valor predeterminado: 0. -## Todos los derechos reservados. {#settings-max-network-bandwidth-for-user} +## Todos Los Derechos Reservados {#settings-max-network-bandwidth-for-user} Limita la velocidad del intercambio de datos a través de la red en bytes por segundo. Esta configuración se aplica a todas las consultas que se ejecutan simultáneamente realizadas por un único usuario. @@ -922,7 +922,7 @@ Valores posibles: Valor predeterminado: 0. -## Todos los derechos reservados. {#settings-max-network-bandwidth-for-all-users} +## Todos Los Derechos Reservados {#settings-max-network-bandwidth-for-all-users} Limita la velocidad a la que se intercambian datos a través de la red en bytes por segundo. Esta configuración se aplica a todas las consultas que se ejecutan simultáneamente en el servidor. @@ -935,15 +935,15 @@ Valor predeterminado: 0. ## count\_distinct\_implementation {#settings-count_distinct_implementation} -Especifica cuál de las `uniq*` se deben utilizar para realizar el [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count) construcción. +Especifica cuál de las `uniq*` se deben utilizar para realizar el [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count) construcción. Valores posibles: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqCombined](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [UniqCombined64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [uniqHLL12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [uniqExact](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqCombined](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [UniqCombined64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [uniqHLL12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [uniqExact](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) Valor predeterminado: `uniqExact`. @@ -1008,7 +1008,7 @@ Valor predeterminado: 0. ## Optize\_throw\_if\_noop {#setting-optimize_throw_if_noop} -Habilita o deshabilita el lanzamiento de una excepción [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) la consulta no realizó una fusión. +Habilita o deshabilita el lanzamiento de una excepción [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) la consulta no realizó una fusión. Predeterminada, `OPTIMIZE` devuelve con éxito incluso si no hizo nada. Esta configuración le permite diferenciar estas situaciones y obtener el motivo en un mensaje de excepción. @@ -1028,7 +1028,7 @@ Controla la rapidez con la que se ponen a cero los errores en las tablas distrib Ver también: -- [Motor de tabla distribuido](../../engines/table_engines/special/distributed.md) +- [Motor de tabla distribuido](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_cap](#settings-distributed_replica_error_cap) ## distributed\_replica\_error\_cap {#settings-distributed_replica_error_cap} @@ -1040,12 +1040,12 @@ El recuento de errores de cada réplica está limitado a este valor, lo que impi Ver también: -- [Motor de tabla distribuido](../../engines/table_engines/special/distributed.md) +- [Motor de tabla distribuido](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_half\_life](#settings-distributed_replica_error_half_life) ## Distributed\_directory\_monitor\_sleep\_time\_ms {#distributed_directory_monitor_sleep_time_ms} -Intervalo base para el [Distribuido](../../engines/table_engines/special/distributed.md) motor de tabla para enviar datos. El intervalo real crece exponencialmente en caso de errores. +Intervalo base para el [Distribuido](../../engines/table-engines/special/distributed.md) motor de tabla para enviar datos. El intervalo real crece exponencialmente en caso de errores. Valores posibles: @@ -1055,7 +1055,7 @@ Valor predeterminado: 100 milisegundos. ## Distributed\_directory\_monitor\_max\_sleep\_time\_ms {#distributed_directory_monitor_max_sleep_time_ms} -Intervalo máximo para el [Distribuido](../../engines/table_engines/special/distributed.md) motor de tabla para enviar datos. Limita el crecimiento exponencial del intervalo establecido en el [Distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) configuración. +Intervalo máximo para el [Distribuido](../../engines/table-engines/special/distributed.md) motor de tabla para enviar datos. Limita el crecimiento exponencial del intervalo establecido en el [Distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) configuración. Valores posibles: @@ -1067,7 +1067,7 @@ Valor predeterminado: 30000 milisegundos (30 segundos). Habilita/deshabilita el envío de datos insertados en lotes. -Cuando el envío por lotes está habilitado, el [Distribuido](../../engines/table_engines/special/distributed.md) El motor de tabla intenta enviar varios archivos de datos insertados en una operación en lugar de enviarlos por separado. El envío por lotes mejora el rendimiento del clúster al utilizar mejor los recursos del servidor y de la red. +Cuando el envío por lotes está habilitado, el [Distribuido](../../engines/table-engines/special/distributed.md) El motor de tabla intenta enviar varios archivos de datos insertados en una operación en lugar de enviarlos por separado. El envío por lotes mejora el rendimiento del clúster al utilizar mejor los recursos del servidor y de la red. Valores posibles: @@ -1093,7 +1093,7 @@ Valor predeterminado: 0. ## query\_profiler\_real\_time\_period\_ns {#query_profiler_real_time_period_ns} -Establece el período para un temporizador de reloj real del [perfilador de consultas](../../operations/optimizing_performance/sampling_query_profiler.md). El temporizador de reloj real cuenta el tiempo del reloj de pared. +Establece el período para un temporizador de reloj real del [perfilador de consultas](../../operations/optimizing-performance/sampling-query-profiler.md). El temporizador de reloj real cuenta el tiempo del reloj de pared. Valores posibles: @@ -1106,17 +1106,17 @@ Valores posibles: - 0 para apagar el temporizador. -Tipo: [UInt64](../../sql_reference/data_types/int_uint.md). +Tipo: [UInt64](../../sql-reference/data-types/int-uint.md). Valor predeterminado: 1000000000 nanosegundos (una vez por segundo). Ver también: -- Tabla del sistema [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- Tabla del sistema [trace\_log](../../operations/system-tables.md#system_tables-trace_log) -## Los resultados de la prueba {#query_profiler_cpu_time_period_ns} +## Los Resultados De La Prueba {#query_profiler_cpu_time_period_ns} -Establece el período para un temporizador de reloj de CPU [perfilador de consultas](../../operations/optimizing_performance/sampling_query_profiler.md). Este temporizador solo cuenta el tiempo de CPU. +Establece el período para un temporizador de reloj de CPU [perfilador de consultas](../../operations/optimizing-performance/sampling-query-profiler.md). Este temporizador solo cuenta el tiempo de CPU. Valores posibles: @@ -1129,17 +1129,17 @@ Valores posibles: - 0 para apagar el temporizador. -Tipo: [UInt64](../../sql_reference/data_types/int_uint.md). +Tipo: [UInt64](../../sql-reference/data-types/int-uint.md). Valor predeterminado: 1000000000 nanosegundos. Ver también: -- Tabla del sistema [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- Tabla del sistema [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## allow\_introspection\_functions {#settings-allow_introspection_functions} -Habilita deshabilita [funciones de introspecciones](../../sql_reference/functions/introspection.md) para la creación de perfiles de consultas. +Habilita deshabilita [funciones de introspecciones](../../sql-reference/functions/introspection.md) para la creación de perfiles de consultas. Valores posibles: @@ -1150,8 +1150,8 @@ Valor predeterminado: 0. **Ver también** -- [Analizador de consultas de muestreo](../optimizing_performance/sampling_query_profiler.md) -- Tabla del sistema [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- [Analizador de consultas de muestreo](../optimizing-performance/sampling-query-profiler.md) +- Tabla del sistema [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## input\_format\_parallel\_parsing {#input-format-parallel-parsing} @@ -1160,14 +1160,14 @@ Valor predeterminado: 0. Habilitar el análisis paralelo de los formatos de datos para preservar el orden. Solo se admite para los formatos TSV, TKSV, CSV y JSONEachRow. -## También puede utilizar los siguientes métodos de envío: {#min-chunk-bytes-for-parallel-parsing} +## También Puede Utilizar Los Siguientes métodos De envío: {#min-chunk-bytes-for-parallel-parsing} - Tipo: unsigned int - Valor predeterminado: 1 MiB El tamaño mínimo de fragmento en bytes, que cada subproceso analizará en paralelo. -## Sistema abierto. {#settings-output_format_avro_codec} +## Sistema Abierto {#settings-output_format_avro_codec} Establece el códec de compresión utilizado para el archivo Avro de salida. @@ -1181,7 +1181,7 @@ Valores posibles: Valor predeterminado: `snappy` (si está disponible) o `deflate`. -## Sistema abierto. {#settings-output_format_avro_sync_interval} +## Sistema Abierto {#settings-output_format_avro_sync_interval} Establece el tamaño mínimo de datos (en bytes) entre los marcadores de sincronización para el archivo Avro de salida. @@ -1191,7 +1191,7 @@ Valores posibles: 32 (32 bytes) - 1073741824 (1 GiB) Valor predeterminado: 32768 (32 KiB) -## Todos los derechos reservados. {#settings-format_avro_schema_registry_url} +## Todos Los Derechos Reservados {#settings-format_avro_schema_registry_url} Establece la URL del Registro de esquemas confluentes para usar con [AvroConfluent](../../interfaces/formats.md#data-format-avro-confluent) formato diff --git a/docs/es/operations/settings/settings_profiles.md b/docs/es/operations/settings/settings_profiles.md deleted file mode 100644 index 21a73d6f9e1..00000000000 --- a/docs/es/operations/settings/settings_profiles.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 61 -toc_title: "Perfiles de configuraci\xF3n" ---- - -# Perfiles de configuración {#settings-profiles} - -Un perfil de configuración es una colección de configuraciones agrupadas con el mismo nombre. Cada usuario de ClickHouse tiene un perfil. -Para aplicar todos los ajustes de un perfil, establezca el `profile` configuración. - -Ejemplo: - -Instale el `web` perfil. - -``` sql -SET profile = 'web' -``` - -Los perfiles de configuración se declaran en el archivo de configuración del usuario. Esto suele ser `users.xml`. - -Ejemplo: - -``` xml - - - - - - 8 - - - - - 1000000000 - 100000000000 - - 1000000 - any - - 1000000 - 1000000000 - - 100000 - 100000000 - break - - 600 - 1000000 - 15 - - 25 - 100 - 50 - - 2 - 25 - 50 - 100 - - 1 - - -``` - -El ejemplo especifica dos perfiles: `default` y `web`. El `default` tiene un propósito especial: siempre debe estar presente y se aplica al iniciar el servidor. En otras palabras, el `default` perfil contiene la configuración predeterminada. El `web` profile es un perfil regular que se puede establecer utilizando el `SET` consulta o utilizando un parámetro URL en una consulta HTTP. - -Los perfiles de configuración pueden heredar unos de otros. Para usar la herencia, indique una o varias `profile` configuraciones antes de las demás configuraciones que se enumeran en el perfil. En caso de que se defina una configuración en diferentes perfiles, se utiliza la última definida. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/settings_profiles/) diff --git a/docs/es/operations/settings/settings_users.md b/docs/es/operations/settings/settings_users.md deleted file mode 100644 index ec03b34ff50..00000000000 --- a/docs/es/operations/settings/settings_users.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 63 -toc_title: "Configuraci\xF3n del usuario" ---- - -# Configuración del usuario {#user-settings} - -El `users` sección de la `user.xml` el archivo de configuración contiene la configuración del usuario. - -Estructura del `users` apartado: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### user\_name/contraseña {#user-namepassword} - -La contraseña se puede especificar en texto sin formato o en SHA256 (formato hexagonal). - -- Para asignar una contraseña en texto sin formato (**no se recomienda**), colóquelo en un `password` elemento. - - Por ejemplo, `qwerty`. La contraseña se puede dejar en blanco. - - - -- Para asignar una contraseña utilizando su hash SHA256, colóquela en un `password_sha256_hex` elemento. - - Por ejemplo, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - Ejemplo de cómo generar una contraseña desde el shell: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - - La primera línea del resultado es la contraseña. La segunda línea es el hash SHA256 correspondiente. - - - -- Para la compatibilidad con los clientes MySQL, la contraseña se puede especificar en doble hash SHA1. Colóquelo en `password_double_sha1_hex` elemento. - - Por ejemplo, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - Ejemplo de cómo generar una contraseña desde el shell: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - - La primera línea del resultado es la contraseña. La segunda línea es el hash SHA1 doble correspondiente. - -### user\_name/redes {#user-namenetworks} - -Lista de redes desde las que el usuario puede conectarse al servidor ClickHouse. - -Cada elemento de la lista puede tener una de las siguientes formas: - -- `` — IP address or network mask. - - Ejemplos: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Hostname. - - Ejemplo: `example01.host.ru`. - - Para comprobar el acceso, se realiza una consulta DNS y todas las direcciones IP devueltas se comparan con la dirección del mismo nivel. - -- `` — Regular expression for hostnames. - - Ejemplo, `^example\d\d-\d\d-\d\.host\.ru$` - - Para comprobar el acceso, un [Consulta de DNS PTR](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) se realiza para la dirección del mismo nivel y luego se aplica la expresión regular especificada. A continuación, se realiza otra consulta DNS para los resultados de la consulta PTR y todas las direcciones recibidas se comparan con la dirección del mismo nivel. Recomendamos encarecidamente que regexp termine con $ . - -Todos los resultados de las solicitudes DNS se almacenan en caché hasta que el servidor se reinicia. - -**Ejemplos** - -Para abrir el acceso del usuario desde cualquier red, especifique: - -``` xml -::/0 -``` - -!!! warning "Advertencia" - No es seguro abrir el acceso desde cualquier red a menos que tenga un firewall configurado correctamente o el servidor no esté conectado directamente a Internet. - -Para abrir el acceso solo desde localhost, especifique: - -``` xml -::1 -127.0.0.1 -``` - -### user\_name/perfil {#user-nameprofile} - -Puede asignar un perfil de configuración para el usuario. Los perfiles de configuración se configuran en una sección separada del `users.xml` file. Para obtener más información, consulte [Perfiles de configuración](settings_profiles.md). - -### user\_name/cuota {#user-namequota} - -Las cuotas le permiten realizar un seguimiento o limitar el uso de recursos durante un período de tiempo. Las cuotas se configuran en el `quotas` -sección de la `users.xml` archivo de configuración. - -Puede asignar un conjunto de cuotas para el usuario. Para obtener una descripción detallada de la configuración de las cuotas, consulte [Cuota](../quotas.md#quotas). - -### nombre\_usuario/bases de datos {#user-namedatabases} - -En esta sección, puede limitar las filas devueltas por ClickHouse para `SELECT` consultas realizadas por el usuario actual, implementando así la seguridad básica a nivel de fila. - -**Ejemplo** - -La siguiente configuración obliga a que el usuario `user1` sólo puede ver las filas de `table1` como resultado de `SELECT` consultas, donde el valor de la `id` campo es 1000. - -``` xml - - - - - id = 1000 - - - - -``` - -El `filter` puede ser cualquier expresión que resulte en un [UInt8](../../sql_reference/data_types/int_uint.md)-tipo de valor. Por lo general, contiene comparaciones y operadores lógicos. Filas de `database_name.table1` donde los resultados del filtro a 0 no se devuelven para este usuario. El filtrado es incompatible con `PREWHERE` operaciones y desactiva `WHERE→PREWHERE` optimización. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/es/operations/system-tables.md b/docs/es/operations/system-tables.md new file mode 100644 index 00000000000..46d92beee81 --- /dev/null +++ b/docs/es/operations/system-tables.md @@ -0,0 +1,1097 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 52 +toc_title: Tablas del sistema +--- + +# Tablas Del Sistema {#system-tables} + +Las tablas del sistema se utilizan para implementar parte de la funcionalidad del sistema y para proporcionar acceso a información sobre cómo funciona el sistema. +No puede eliminar una tabla del sistema (pero puede realizar DETACH). +Las tablas del sistema no tienen archivos con datos en el disco o archivos con metadatos. El servidor crea todas las tablas del sistema cuando se inicia. +Las tablas del sistema son de solo lectura. +Están ubicados en el ‘system’ base. + +## sistema.asynchronous\_metrics {#system_tables-asynchronous_metrics} + +Contiene métricas que se calculan periódicamente en segundo plano. Por ejemplo, la cantidad de RAM en uso. + +Columna: + +- `metric` ([Cadena](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Float64](../sql-reference/data-types/float.md)) — Metric value. + +**Ejemplo** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**Ver también** + +- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. +- [sistema.métricas](#system_tables-metrics) — Contains instantly calculated metrics. +- [sistema.evento](#system_tables-events) — Contains a number of events that have occurred. +- [sistema.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. + +## sistema.Cluster {#system-clusters} + +Contiene información sobre los clústeres disponibles en el archivo de configuración y los servidores que contienen. + +Columna: + +- `cluster` (String) — The cluster name. +- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. +- `shard_weight` (UInt32) — The relative weight of the shard when writing data. +- `replica_num` (UInt32) — The replica number in the shard, starting from 1. +- `host_name` (String) — The host name, as specified in the config. +- `host_address` (String) — The host IP address obtained from DNS. +- `port` (UInt16) — The port to use for connecting to the server. +- `user` (String) — The name of the user for connecting to the server. +- `errors_count` (UInt32): número de veces que este host no pudo alcanzar la réplica. +- `estimated_recovery_time` (UInt32): quedan segundos hasta que el recuento de errores de réplica se ponga a cero y se considere que vuelve a la normalidad. + +Tenga en cuenta que `errors_count` se actualiza una vez por consulta al clúster, pero `estimated_recovery_time` se vuelve a calcular bajo demanda. Entonces podría haber un caso distinto de cero `errors_count` y cero `estimated_recovery_time`, esa próxima consulta será cero `errors_count` e intente usar la réplica como si no tuviera errores. + +**Ver también** + +- [Motor de tabla distribuido](../engines/table-engines/special/distributed.md) +- [distributed\_replica\_error\_cap configuración](settings/settings.md#settings-distributed_replica_error_cap) +- [distributed\_replica\_error\_half\_life configuración](settings/settings.md#settings-distributed_replica_error_half_life) + +## sistema.columna {#system-columns} + +Contiene información sobre las columnas de todas las tablas. + +Puede utilizar esta tabla para obtener información similar a la [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table) consulta, pero para varias tablas a la vez. + +El `system.columns` tabla contiene las siguientes columnas (el tipo de columna se muestra entre corchetes): + +- `database` (String) — Database name. +- `table` (String) — Table name. +- `name` (String) — Column name. +- `type` (String) — Column type. +- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) para el valor predeterminado, o una cadena vacía si no está definida. +- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. +- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. +- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. +- `marks_bytes` (UInt64) — The size of marks, in bytes. +- `comment` (String) — Comment on the column, or an empty string if it is not defined. +- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. +- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. +- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. +- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. + +## sistema.colaborador {#system-contributors} + +Contiene información sobre los colaboradores. Todos los constributores en orden aleatorio. El orden es aleatorio en el momento de la ejecución de la consulta. + +Columna: + +- `name` (String) — Contributor (author) name from git log. + +**Ejemplo** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +Para descubrirlo en la tabla, use una consulta: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## sistema.base {#system-databases} + +Esta tabla contiene una sola columna String llamada ‘name’ – the name of a database. +Cada base de datos que el servidor conoce tiene una entrada correspondiente en la tabla. +Esta tabla del sistema se utiliza para implementar el `SHOW DATABASES` consulta. + +## sistema.detached\_parts {#system_tables-detached_parts} + +Contiene información sobre piezas separadas de [Método de codificación de datos:](../engines/table-engines/mergetree-family/mergetree.md) tabla. El `reason` columna especifica por qué se separó la pieza. Para las piezas separadas por el usuario, el motivo está vacío. Tales partes se pueden unir con [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) comando. Para obtener la descripción de otras columnas, consulte [sistema.parte](#system_tables-parts). Si el nombre de la pieza no es válido, los valores de algunas columnas pueden ser `NULL`. Tales partes se pueden eliminar con [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). + +## sistema.diccionario {#system-dictionaries} + +Contiene información sobre diccionarios externos. + +Columna: + +- `name` (String) — Dictionary name. +- `type` (String) — Dictionary type: Flat, Hashed, Cache. +- `origin` (String) — Path to the configuration file that describes the dictionary. +- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. +- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. +- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. +- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. +- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. +- `element_count` (UInt64) — The number of items stored in the dictionary. +- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). +- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. +- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn’t be created. +- `source` (String) — Text describing the data source for the dictionary. + +Tenga en cuenta que la cantidad de memoria utilizada por el diccionario no es proporcional a la cantidad de elementos almacenados en él. Por lo tanto, para los diccionarios planos y en caché, todas las celdas de memoria se asignan previamente, independientemente de qué tan lleno esté realmente el diccionario. + +## sistema.evento {#system_tables-events} + +Contiene información sobre el número de eventos que se han producido en el sistema. Por ejemplo, en la tabla, puede encontrar cuántos `SELECT` las consultas se procesaron desde que se inició el servidor ClickHouse. + +Columna: + +- `event` ([Cadena](../sql-reference/data-types/string.md)) — Event name. +- `value` ([UInt64](../sql-reference/data-types/int-uint.md)) — Number of events occurred. +- `description` ([Cadena](../sql-reference/data-types/string.md)) — Event description. + +**Ejemplo** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Ver también** + +- [sistema.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [sistema.métricas](#system_tables-metrics) — Contains instantly calculated metrics. +- [sistema.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. + +## sistema.función {#system-functions} + +Contiene información sobre funciones normales y agregadas. + +Columna: + +- `name`(`String`) – The name of the function. +- `is_aggregate`(`UInt8`) — Whether the function is aggregate. + +## sistema.graphite\_retentions {#system-graphite-retentions} + +Contiene información sobre los parámetros [graphite\_rollup](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) que se utilizan en tablas con [\*GraphiteMergeTree](../engines/table-engines/mergetree-family/graphitemergetree.md) motor. + +Columna: + +- `config_name` (Cadena) - `graphite_rollup` nombre del parámetro. +- `regexp` (Cadena) - Un patrón para el nombre de la métrica. +- `function` (String) - El nombre de la función de agregación. +- `age` (UInt64) - La edad mínima de los datos en segundos. +- `precision` (UInt64) - Cómo definir con precisión la edad de los datos en segundos. +- `priority` (UInt16) - Prioridad de patrón. +- `is_default` (UInt8) - Si el patrón es el predeterminado. +- `Tables.database` (Array(String)) - Matriz de nombres de tablas de base de datos que utilizan `config_name` parámetro. +- `Tables.table` (Array(String)) - Matriz de nombres de tablas que utilizan `config_name` parámetro. + +## sistema.fusionar {#system-merges} + +Contiene información sobre fusiones y mutaciones de piezas actualmente en proceso para tablas de la familia MergeTree. + +Columna: + +- `database` (String) — The name of the database the table is in. +- `table` (String) — Table name. +- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. +- `progress` (Float64) — The percentage of completed work from 0 to 1. +- `num_parts` (UInt64) — The number of pieces to be merged. +- `result_part_name` (String) — The name of the part that will be formed as the result of merging. +- `is_mutation` (UInt8) - 1 si este proceso es una mutación parte. +- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. +- `total_size_marks` (UInt64) — The total number of marks in the merged parts. +- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. +- `rows_read` (UInt64) — Number of rows read. +- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. +- `rows_written` (UInt64) — Number of rows written. + +## sistema.métricas {#system_tables-metrics} + +Contiene métricas que pueden calcularse instantáneamente o tener un valor actual. Por ejemplo, el número de consultas procesadas simultáneamente o el retraso de réplica actual. Esta tabla está siempre actualizada. + +Columna: + +- `metric` ([Cadena](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — Metric value. +- `description` ([Cadena](../sql-reference/data-types/string.md)) — Metric description. + +La lista de métricas admitidas que puede encontrar en el [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) archivo fuente de ClickHouse. + +**Ejemplo** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Ver también** + +- [sistema.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [sistema.evento](#system_tables-events) — Contains a number of events that occurred. +- [sistema.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. + +## sistema.metric\_log {#system_tables-metric_log} + +Contiene el historial de valores de métricas de tablas `system.metrics` y `system.events`, periódicamente enjuagado al disco. +Para activar la recopilación de historial de métricas en `system.metric_log`, crear `/etc/clickhouse-server/config.d/metric_log.xml` con el siguiente contenido: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**Ejemplo** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**Ver también** + +- [sistema.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [sistema.evento](#system_tables-events) — Contains a number of events that occurred. +- [sistema.métricas](#system_tables-metrics) — Contains instantly calculated metrics. +- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. + +## sistema.numero {#system-numbers} + +Esta tabla contiene una única columna UInt64 llamada ‘number’ que contiene casi todos los números naturales a partir de cero. +Puede usar esta tabla para pruebas, o si necesita hacer una búsqueda de fuerza bruta. +Las lecturas de esta tabla no están paralelizadas. + +## sistema.Números\_mt {#system-numbers-mt} + +Lo mismo que ‘system.numbers’ pero las lecturas están paralelizadas. Los números se pueden devolver en cualquier orden. +Se utiliza para pruebas. + +## sistema.una {#system-one} + +Esta tabla contiene una sola fila con una ‘dummy’ Columna UInt8 que contiene el valor 0. +Esta tabla se utiliza si una consulta SELECT no especifica la cláusula FROM. +Esto es similar a la tabla DUAL que se encuentra en otros DBMS. + +## sistema.parte {#system_tables-parts} + +Contiene información sobre partes de [Método de codificación de datos:](../engines/table-engines/mergetree-family/mergetree.md) tabla. + +Cada fila describe una parte de los datos. + +Columna: + +- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql-reference/statements/alter.md#query_language_queries_alter) consulta. + + Formato: + + - `YYYYMM` para la partición automática por mes. + - `any_string` al particionar manualmente. + +- `name` (`String`) – Name of the data part. + +- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. + +- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` por la granularidad del índice (generalmente 8192) (esta sugerencia no funciona para la granularidad adaptativa). + +- `rows` (`UInt64`) – The number of rows. + +- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. + +- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `marks_bytes` (`UInt64`) – The size of the file with marks. + +- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| + +- `remove_time` (`DateTime`) – The time when the data part became inactive. + +- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. + +- `min_date` (`Date`) – The minimum value of the date key in the data part. + +- `max_date` (`Date`) – The maximum value of the date key in the data part. + +- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. + +- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. + +- `partition_id` (`String`) – ID of the partition. + +- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. + +- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. + +- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. + +- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. + +- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition) + +- `database` (`String`) – Name of the database. + +- `table` (`String`) – Name of the table. + +- `engine` (`String`) – Name of the table engine without parameters. + +- `path` (`String`) – Absolute path to the folder with data part files. + +- `disk` (`String`) – Name of a disk that stores the data part. + +- `hash_of_all_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) de archivos comprimidos. + +- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) de archivos sin comprimir (archivos con marcas, archivo de índice, etc.). + +- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) de datos en los archivos comprimidos como si estuvieran descomprimidos. + +- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. + +- `marks_size` (`UInt64`) – Alias for `marks_bytes`. + +## sistema.part\_log {#system_tables-part-log} + +El `system.part_log` se crea sólo si el [part\_log](server-configuration-parameters/settings.md#server_configuration_parameters-part-log) se especifica la configuración del servidor. + +Esta tabla contiene información sobre eventos que ocurrieron con [partes de datos](../engines/table-engines/mergetree-family/custom-partitioning-key.md) en el [Método de codificación de datos:](../engines/table-engines/mergetree-family/mergetree.md) tablas familiares, como agregar o fusionar datos. + +El `system.part_log` contiene las siguientes columnas: + +- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: + - `NEW_PART` — Inserting of a new data part. + - `MERGE_PARTS` — Merging of data parts. + - `DOWNLOAD_PART` — Downloading a data part. + - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — Mutating of a data part. + - `MOVE_PART` — Moving the data part from the one disk to another one. +- `event_date` (Date) — Event date. +- `event_time` (DateTime) — Event time. +- `duration_ms` (UInt64) — Duration. +- `database` (String) — Name of the database the data part is in. +- `table` (String) — Name of the table the data part is in. +- `part_name` (String) — Name of the data part. +- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ valor si la partición es por `tuple()`. +- `rows` (UInt64) — The number of rows in the data part. +- `size_in_bytes` (UInt64) — Size of the data part in bytes. +- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). +- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. +- `read_rows` (UInt64) — The number of rows was read during the merge. +- `read_bytes` (UInt64) — The number of bytes was read during the merge. +- `error` (UInt16) — The code number of the occurred error. +- `exception` (String) — Text message of the occurred error. + +El `system.part_log` se crea después de la primera inserción de datos `MergeTree` tabla. + +## sistema.procesa {#system_tables-processes} + +Esta tabla del sistema se utiliza para implementar el `SHOW PROCESSLIST` consulta. + +Columna: + +- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` usuario. El campo contiene el nombre de usuario para una consulta específica, no para una consulta que esta consulta inició. +- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` en el servidor de solicitud de consulta. +- `elapsed` (Float64) – The time in seconds since request execution started. +- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. +- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [Método de codificación de datos:](../operations/settings/query-complexity.md#settings_max_memory_usage) configuración. +- `query` (String) – The query text. For `INSERT`, no incluye los datos para insertar. +- `query_id` (String) – Query ID, if defined. + +## sistema.text\_log {#system-tables-text-log} + +Contiene entradas de registro. El nivel de registro que va a esta tabla se puede limitar con `text_log.level` configuración del servidor. + +Columna: + +- `event_date` (`Date`) - Fecha de la entrada. +- `event_time` (`DateTime`) - Tiempo de la entrada. +- `microseconds` (`UInt32`) - Microsegundos de la entrada. +- `thread_name` (String) — Name of the thread from which the logging was done. +- `thread_id` (UInt64) — OS thread ID. +- `level` (`Enum8`) - Nivel de entrada. + - `'Fatal' = 1` + - `'Critical' = 2` + - `'Error' = 3` + - `'Warning' = 4` + - `'Notice' = 5` + - `'Information' = 6` + - `'Debug' = 7` + - `'Trace' = 8` +- `query_id` (`String`) - ID de la consulta. +- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) +- `message` (`String`) - El mensaje en sí. +- `revision` (`UInt32`) - Revisión de ClickHouse. +- `source_file` (`LowCardinality(String)`) - Archivo de origen desde el que se realizó el registro. +- `source_line` (`UInt64`) - Línea de origen desde la que se realizó el registro. + +## sistema.query\_log {#system_tables-query_log} + +Contiene información sobre la ejecución de consultas. Para cada consulta, puede ver la hora de inicio del procesamiento, la duración del procesamiento, los mensajes de error y otra información. + +!!! note "Nota" + La tabla no contiene datos de entrada para `INSERT` consulta. + +ClickHouse crea esta tabla sólo si el [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) se especifica el parámetro server. Este parámetro establece las reglas de registro, como el intervalo de registro o el nombre de la tabla en la que se registrarán las consultas. + +Para habilitar el registro de consultas, [Log\_queries](settings/settings.md#settings-log-queries) parámetro a 1. Para obtener más información, consulte el [Configuración](settings/settings.md) apartado. + +El `system.query_log` tabla registra dos tipos de consultas: + +1. Consultas iniciales ejecutadas directamente por el cliente. +2. Niño consultas que fueron iniciados por otras consultas (distribuida de la ejecución de la consulta). Para estos tipos de consultas, la información sobre el padre de las consultas se muestra en la `initial_*` columna. + +Columna: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` consultas, el número de filas escritas. Para otras consultas, el valor de la columna es 0. +- `written_bytes` (UInt64) — For `INSERT` consultas, el número de bytes escritos. Para otras consultas, el valor de la columna es 0. +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [Casa de clics-cliente](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [Casa de clics-cliente](../interfaces/cli.md) o se ejecuta otro cliente TCP. +- `client_name` (String) — The [Casa de clics-cliente](../interfaces/cli.md) o otro nombre de cliente TCP. +- `client_revision` (UInt32) — Revision of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. +- `client_version_major` (UInt32) — Major version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. +- `client_version_minor` (UInt32) — Minor version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. +- `client_version_patch` (UInt32) — Patch component of the [Casa de clics-cliente](../interfaces/cli.md) o otra versión de cliente TCP. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` se utilizó el método. + - 2 — `POST` se utilizó el método. +- `http_user_agent` (String) — The `UserAgent` encabezado pasado en la solicitud HTTP. +- `quota_key` (String) — The “quota key” especificado en el [cuota](quotas.md) ajuste (ver `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [sistema.evento](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` columna. +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parámetro a 1. +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` columna. + +Cada consulta crea una o dos filas en el `query_log` tabla, dependiendo del estado de la consulta: + +1. Si la ejecución de la consulta se realiza correctamente, se crean dos eventos con los tipos 1 y 2 (consulte `type` columna). +2. Si se produjo un error durante el procesamiento de la consulta, se crean dos eventos con los tipos 1 y 4. +3. Si se produjo un error antes de iniciar la consulta, se crea un solo evento con el tipo 3. + +De forma predeterminada, los registros se agregan a la tabla a intervalos de 7,5 segundos. Puede establecer este intervalo en el [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) configuración del servidor (consulte el `flush_interval_milliseconds` parámetro). Para vaciar los registros a la fuerza desde el búfer de memoria a la tabla, utilice `SYSTEM FLUSH LOGS` consulta. + +Cuando la tabla se elimina manualmente, se creará automáticamente sobre la marcha. Tenga en cuenta que se eliminarán todos los registros anteriores. + +!!! note "Nota" + El período de almacenamiento para los registros es ilimitado. Los registros no se eliminan automáticamente de la tabla. Debe organizar la eliminación de registros obsoletos usted mismo. + +Puede especificar una clave de partición arbitraria `system.query_log` mesa en el [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) configuración del servidor (consulte el `partition_by` parámetro). + +## sistema.Sistema abierto {#system_tables-query-thread-log} + +La tabla contiene información sobre cada subproceso de ejecución de consultas. + +ClickHouse crea esta tabla sólo si el [Sistema abierto.](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) se especifica el parámetro server. Este parámetro establece las reglas de registro, como el intervalo de registro o el nombre de la tabla en la que se registrarán las consultas. + +Para habilitar el registro de consultas, [Log\_query\_threads](settings/settings.md#settings-log-query-threads) parámetro a 1. Para obtener más información, consulte el [Configuración](settings/settings.md) apartado. + +Columna: + +- `event_date` (Date) — the date when the thread has finished execution of the query. +- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` consultas, el número de filas escritas. Para otras consultas, el valor de la columna es 0. +- `written_bytes` (UInt64) — For `INSERT` consultas, el número de bytes escritos. Para otras consultas, el valor de la columna es 0. +- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. +- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. +- `thread_name` (String) — Name of the thread. +- `thread_number` (UInt32) — Internal thread ID. +- `os_thread_id` (Int32) — OS thread ID. +- `master_thread_id` (UInt64) — OS initial ID of initial thread. +- `query` (String) — Query string. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [Casa de clics-cliente](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [Casa de clics-cliente](../interfaces/cli.md) o se ejecuta otro cliente TCP. +- `client_name` (String) — The [Casa de clics-cliente](../interfaces/cli.md) o otro nombre de cliente TCP. +- `client_revision` (UInt32) — Revision of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. +- `client_version_major` (UInt32) — Major version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. +- `client_version_minor` (UInt32) — Minor version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. +- `client_version_patch` (UInt32) — Patch component of the [Casa de clics-cliente](../interfaces/cli.md) o otra versión de cliente TCP. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` se utilizó el método. + - 2 — `POST` se utilizó el método. +- `http_user_agent` (String) — The `UserAgent` encabezado pasado en la solicitud HTTP. +- `quota_key` (String) — The “quota key” especificado en el [cuota](quotas.md) ajuste (ver `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [sistema.evento](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` columna. + +De forma predeterminada, los registros se agregan a la tabla a intervalos de 7,5 segundos. Puede establecer este intervalo en el [Sistema abierto.](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) configuración del servidor (consulte el `flush_interval_milliseconds` parámetro). Para vaciar los registros a la fuerza desde el búfer de memoria a la tabla, utilice `SYSTEM FLUSH LOGS` consulta. + +Cuando la tabla se elimina manualmente, se creará automáticamente sobre la marcha. Tenga en cuenta que se eliminarán todos los registros anteriores. + +!!! note "Nota" + El período de almacenamiento para los registros es ilimitado. Los registros no se eliminan automáticamente de la tabla. Debe organizar la eliminación de registros obsoletos usted mismo. + +Puede especificar una clave de partición arbitraria `system.query_thread_log` mesa en el [Sistema abierto.](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) configuración del servidor (consulte el `partition_by` parámetro). + +## sistema.trace\_log {#system_tables-trace_log} + +Contiene seguimientos de pila recopilados por el generador de perfiles de consultas de muestreo. + +ClickHouse crea esta tabla cuando el [trace\_log](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) se establece la sección de configuración del servidor. También el [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) y [Los resultados de la prueba](settings/settings.md#query_profiler_cpu_time_period_ns) los ajustes deben establecerse. + +Para analizar los registros, utilice el `addressToLine`, `addressToSymbol` y `demangle` funciones de inspección. + +Columna: + +- `event_date`([Fecha](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time`([FechaHora](../sql-reference/data-types/datetime.md)) — Timestamp of sampling moment. + +- `revision`([UInt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + Cuando se conecta al servidor por `clickhouse-client`, ves la cadena similar a `Connected to ClickHouse server version 19.18.1 revision 54429.`. Este campo contiene el `revision`, pero no el `version` de un servidor. + +- `timer_type`([Enum8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` representa el tiempo del reloj de pared. + - `CPU` representa el tiempo de CPU. + +- `thread_number`([UInt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id`([Cadena](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) tabla del sistema. + +- `trace`([Matriz (UInt64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**Ejemplo** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## sistema.Replica {#system_tables-replicas} + +Contiene información y estado de las tablas replicadas que residen en el servidor local. +Esta tabla se puede utilizar para el monitoreo. La tabla contiene una fila para cada tabla Replicated\*. + +Ejemplo: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +Columna: + +- `database` (`String`) - Nombre de la base de datos +- `table` (`String`) - Nombre de la tabla +- `engine` (`String`) - Nombre del motor de tabla +- `is_leader` (`UInt8`) - Si la réplica es la líder. + Sólo una réplica a la vez puede ser el líder. El líder es responsable de seleccionar las fusiones de fondo para realizar. + Tenga en cuenta que las escrituras se pueden realizar en cualquier réplica que esté disponible y tenga una sesión en ZK, independientemente de si es un líder. +- `can_become_leader` (`UInt8`) - Si la réplica puede ser elegida como líder. +- `is_readonly` (`UInt8`) - Si la réplica está en modo de sólo lectura. + Este modo se activa si la configuración no tiene secciones con ZooKeeper, si se produce un error desconocido al reinicializar sesiones en ZooKeeper y durante la reinicialización de sesiones en ZooKeeper. +- `is_session_expired` (`UInt8`) - la sesión con ZooKeeper ha expirado. Básicamente lo mismo que `is_readonly`. +- `future_parts` (`UInt32`) - El número de partes de datos que aparecerán como resultado de INSERTs o fusiones que aún no se han realizado. +- `parts_to_check` (`UInt32`) - El número de partes de datos en la cola para la verificación. Una pieza se coloca en la cola de verificación si existe la sospecha de que podría estar dañada. +- `zookeeper_path` (`String`) - Ruta de acceso a los datos de la tabla en ZooKeeper. +- `replica_name` (`String`) - Nombre de réplica en ZooKeeper. Diferentes réplicas de la misma tabla tienen diferentes nombres. +- `replica_path` (`String`) - Ruta de acceso a los datos de réplica en ZooKeeper. Lo mismo que concatenar ‘zookeeper\_path/replicas/replica\_path’. +- `columns_version` (`Int32`) - Número de versión de la estructura de la tabla. Indica cuántas veces se realizó ALTER. Si las réplicas tienen versiones diferentes, significa que algunas réplicas aún no han hecho todas las ALTER. +- `queue_size` (`UInt32`) - Tamaño de la cola para las operaciones en espera de ser realizadas. Las operaciones incluyen insertar bloques de datos, fusiones y otras acciones. Por lo general, coincide con `future_parts`. +- `inserts_in_queue` (`UInt32`) - Número de inserciones de bloques de datos que deben realizarse. Las inserciones generalmente se replican con bastante rapidez. Si este número es grande, significa que algo anda mal. +- `merges_in_queue` (`UInt32`) - El número de fusiones en espera de hacerse. A veces las fusiones son largas, por lo que este valor puede ser mayor que cero durante mucho tiempo. +- `part_mutations_in_queue` (`UInt32`) - El número de mutaciones a la espera de hacerse. +- `queue_oldest_time` (`DateTime`) - Si `queue_size` mayor que 0, muestra cuándo se agregó la operación más antigua a la cola. +- `inserts_oldest_time` (`DateTime`) - Ver `queue_oldest_time` +- `merges_oldest_time` (`DateTime`) - Ver `queue_oldest_time` +- `part_mutations_oldest_time` (`DateTime`) - Ver `queue_oldest_time` + +Las siguientes 4 columnas tienen un valor distinto de cero solo cuando hay una sesión activa con ZK. + +- `log_max_index` (`UInt64`) - Número máximo de inscripción en el registro de actividad general. +- `log_pointer` (`UInt64`) - Número máximo de entrada en el registro de actividad general que la réplica copió en su cola de ejecución, más uno. Si `log_pointer` es mucho más pequeño que `log_max_index`, algo está mal. +- `last_queue_update` (`DateTime`) - Cuando la cola se actualizó la última vez. +- `absolute_delay` (`UInt64`) - ¿Qué tan grande retraso en segundos tiene la réplica actual. +- `total_replicas` (`UInt8`) - El número total de réplicas conocidas de esta tabla. +- `active_replicas` (`UInt8`) - El número de réplicas de esta tabla que tienen una sesión en ZooKeeper (es decir, el número de réplicas en funcionamiento). + +Si solicita todas las columnas, la tabla puede funcionar un poco lentamente, ya que se realizan varias lecturas de ZooKeeper para cada fila. +Si no solicita las últimas 4 columnas (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), la tabla funciona rápidamente. + +Por ejemplo, puede verificar que todo funcione correctamente de esta manera: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +Si esta consulta no devuelve nada, significa que todo está bien. + +## sistema.configuración {#system-settings} + +Contiene información sobre la configuración actualmente en uso. +Es decir, se usa para ejecutar la consulta que está utilizando para leer del sistema.tabla de configuración. + +Columna: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. +- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [limitación](settings/constraints-on-settings.md#constraints-on-settings)). +- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [limitación](settings/constraints-on-settings.md#constraints-on-settings)). +- `readonly` (UInt8) — Can user change this setting (for more info, look into [limitación](settings/constraints-on-settings.md#constraints-on-settings)). + +Ejemplo: + +``` sql +SELECT name, value +FROM system.settings +WHERE changed +``` + +``` text +┌─name───────────────────┬─value───────┐ +│ max_threads │ 8 │ +│ use_uncompressed_cache │ 0 │ +│ load_balancing │ random │ +│ max_memory_usage │ 10000000000 │ +└────────────────────────┴─────────────┘ +``` + +## sistema.merge\_tree\_settings {#system-merge_tree_settings} + +Contiene información sobre la configuración `MergeTree` tabla. + +Columna: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. + +## sistema.table\_engines {#system-table-engines} + +Contiene la descripción de los motores de tablas admitidos por el servidor y su información de soporte de características. + +Esta tabla contiene las siguientes columnas (el tipo de columna se muestra entre corchetes): + +- `name` (String) — The name of table engine. +- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` clausula. +- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [Índices de saltos](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` y `SAMPLE_BY`. +- `supports_replication` (UInt8) — Flag that indicates if table engine supports [Replicación de datos](../engines/table-engines/mergetree-family/replication.md). +- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. + +Ejemplo: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**Ver también** + +- Familia MergeTree [cláusulas de consulta](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) +- Kafka [configuración](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) +- Unir [configuración](../engines/table-engines/special/join.md#join-limitations-and-settings) + +## sistema.tabla {#system-tables} + +Contiene metadatos de cada tabla que el servidor conoce. Las tablas separadas no se muestran en `system.tables`. + +Esta tabla contiene las siguientes columnas (el tipo de columna se muestra entre corchetes): + +- `database` (String) — The name of the database the table is in. + +- `name` (String) — Table name. + +- `engine` (String) — Table engine name (without parameters). + +- `is_temporary` (UInt8): marca que indica si la tabla es temporal. + +- `data_path` (String) - Ruta de acceso a los datos de la tabla en el sistema de archivos. + +- `metadata_path` (String) - Ruta de acceso a los metadatos de la tabla en el sistema de archivos. + +- `metadata_modification_time` (DateTime) - Hora de la última modificación de los metadatos de la tabla. + +- `dependencies_database` (Array(String)) - Dependencias de base de datos. + +- `dependencies_table` (Array(String)) - Dependencias de tabla ([Método de codificación de datos:](../engines/table-engines/special/materializedview.md) tablas basadas en la tabla actual). + +- `create_table_query` (String) - La consulta que se utilizó para crear la tabla. + +- `engine_full` (String) - Parámetros del motor de tabla. + +- `partition_key` (String) - La expresión de clave de partición especificada en la tabla. + +- `sorting_key` (Cadena) - La clave de clasificación de la expresión especificada en la tabla. + +- `primary_key` (String) - La expresión de clave principal especificada en la tabla. + +- `sampling_key` (String) - La expresión de clave de muestreo especificada en la tabla. + +- `storage_policy` (String) - La política de almacenamiento: + + - [Método de codificación de datos:](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) + - [Distribuido](../engines/table-engines/special/distributed.md#distributed) + +- `total_rows` (Nullable(UInt64)) - Número total de filas, si es posible determinar rápidamente el número exacto de filas en la tabla, de lo contrario `Null` (incluyendo underying `Buffer` tabla). + +- `total_bytes` (Nullable(UInt64)) - Número total de bytes, si es posible determinar rápidamente el número exacto de bytes para la tabla en el almacenamiento, de lo contrario `Null` (**no** incluye cualquier almacenamiento subyacente). + + - If the table stores data on disk, returns used space on disk (i.e. compressed). + - Si la tabla almacena datos en la memoria, devuelve el número aproximado de bytes utilizados en la memoria. + +El `system.tables` se utiliza la tabla en `SHOW TABLES` implementación de consultas. + +## sistema.Zookeeper {#system-zookeeper} + +La tabla no existe si ZooKeeper no está configurado. Permite leer datos del clúster ZooKeeper definido en la configuración. +La consulta debe tener un ‘path’ condición de igualdad en la cláusula WHERE. Este es el camino en ZooKeeper para los niños para los que desea obtener datos. + +Consulta `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` salidas de datos para todos los niños en el `/clickhouse` nodo. +Para generar datos para todos los nodos raíz, escriba path = ‘/’. +Si la ruta especificada en ‘path’ no existe, se lanzará una excepción. + +Columna: + +- `name` (String) — The name of the node. +- `path` (String) — The path to the node. +- `value` (String) — Node value. +- `dataLength` (Int32) — Size of the value. +- `numChildren` (Int32) — Number of descendants. +- `czxid` (Int64) — ID of the transaction that created the node. +- `mzxid` (Int64) — ID of the transaction that last changed the node. +- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. +- `ctime` (DateTime) — Time of node creation. +- `mtime` (DateTime) — Time of the last modification of the node. +- `version` (Int32) — Node version: the number of times the node was changed. +- `cversion` (Int32) — Number of added or removed descendants. +- `aversion` (Int32) — Number of changes to the ACL. +- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. + +Ejemplo: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## sistema.mutación {#system_tables-mutations} + +La tabla contiene información sobre [mutación](../sql-reference/statements/alter.md#alter-mutations) de las tablas MergeTree y su progreso. Cada comando de mutación está representado por una sola fila. La tabla tiene las siguientes columnas: + +**base**, **tabla** - El nombre de la base de datos y la tabla a la que se aplicó la mutación. + +**mutation\_id** - La identificación de la mutación. Para las tablas replicadas, estos identificadores corresponden a los nombres de znode `/mutations/` directorio en ZooKeeper. Para las tablas no duplicadas, los ID corresponden a los nombres de archivo en el directorio de datos de la tabla. + +**comando** - La cadena de comandos de mutación (la parte de la consulta después de `ALTER TABLE [db.]table`). + +**create\_time** - Cuando este comando de mutación fue enviado para su ejecución. + +**block\_numbers.partition\_id**, **block\_numbers.numero** - Una columna anidada. Para las mutaciones de tablas replicadas, contiene un registro para cada partición: el ID de partición y el número de bloque que fue adquirido por la mutación (en cada partición, solo se mutarán las partes que contienen bloques con números menores que el número de bloque adquirido por la mutación en esa partición). En tablas no replicadas, los números de bloque en todas las particiones forman una sola secuencia. Esto significa que para las mutaciones de tablas no replicadas, la columna contendrá un registro con un solo número de bloque adquirido por la mutación. + +**partes\_a\_do** - El número de partes de datos que deben mutarse para que finalice la mutación. + +**is\_done** - Es la mutación hecho? Tenga en cuenta que incluso si `parts_to_do = 0` es posible que aún no se haya realizado una mutación de una tabla replicada debido a un INSERT de larga ejecución que creará una nueva parte de datos que deberá mutarse. + +Si hubo problemas con la mutación de algunas partes, las siguientes columnas contienen información adicional: + +**Método de codificación de datos:** - El nombre de la parte más reciente que no se pudo mutar. + +**Método de codificación de datos:** - El momento del fracaso de la mutación de la parte más reciente. + +**Método de codificación de datos:** - El mensaje de excepción que causó el error de mutación de parte más reciente. + +## sistema.disco {#system_tables-disks} + +Contiene información sobre los discos definidos en el [configuración del servidor](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Columna: + +- `name` ([Cadena](../sql-reference/data-types/string.md)) — Name of a disk in the server configuration. +- `path` ([Cadena](../sql-reference/data-types/string.md)) — Path to the mount point in the file system. +- `free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Free space on disk in bytes. +- `total_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Disk volume in bytes. +- `keep_free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` parámetro de configuración del disco. + +## sistema.almacenamiento\_policies {#system_tables-storage_policies} + +Contiene información sobre las directivas de almacenamiento y los volúmenes [configuración del servidor](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Columna: + +- `policy_name` ([Cadena](../sql-reference/data-types/string.md)) — Name of the storage policy. +- `volume_name` ([Cadena](../sql-reference/data-types/string.md)) — Volume name defined in the storage policy. +- `volume_priority` ([UInt64](../sql-reference/data-types/int-uint.md)) — Volume order number in the configuration. +- `disks` ([Array(Cadena)](../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. +- `max_data_part_size` ([UInt64](../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). +- `move_factor` ([Float64](../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. + +Si la directiva de almacenamiento contiene más de un volumen, la información de cada volumen se almacena en la fila individual de la tabla. + +[Artículo Original](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/es/operations/system_tables.md b/docs/es/operations/system_tables.md deleted file mode 100644 index 590ff99bc13..00000000000 --- a/docs/es/operations/system_tables.md +++ /dev/null @@ -1,1097 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 52 -toc_title: Tablas del sistema ---- - -# Tablas del sistema {#system-tables} - -Las tablas del sistema se utilizan para implementar parte de la funcionalidad del sistema y para proporcionar acceso a información sobre cómo funciona el sistema. -No puede eliminar una tabla del sistema (pero puede realizar DETACH). -Las tablas del sistema no tienen archivos con datos en el disco o archivos con metadatos. El servidor crea todas las tablas del sistema cuando se inicia. -Las tablas del sistema son de solo lectura. -Están ubicados en el ‘system’ base. - -## sistema.asynchronous\_metrics {#system_tables-asynchronous_metrics} - -Contiene métricas que se calculan periódicamente en segundo plano. Por ejemplo, la cantidad de RAM en uso. - -Columna: - -- `metric` ([Cadena](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Float64](../sql_reference/data_types/float.md)) — Metric value. - -**Ejemplo** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**Ver también** - -- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. -- [sistema.métricas](#system_tables-metrics) — Contains instantly calculated metrics. -- [sistema.evento](#system_tables-events) — Contains a number of events that have occurred. -- [sistema.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. - -## sistema.Cluster {#system-clusters} - -Contiene información sobre los clústeres disponibles en el archivo de configuración y los servidores que contienen. - -Columna: - -- `cluster` (String) — The cluster name. -- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. -- `shard_weight` (UInt32) — The relative weight of the shard when writing data. -- `replica_num` (UInt32) — The replica number in the shard, starting from 1. -- `host_name` (String) — The host name, as specified in the config. -- `host_address` (String) — The host IP address obtained from DNS. -- `port` (UInt16) — The port to use for connecting to the server. -- `user` (String) — The name of the user for connecting to the server. -- `errors_count` (UInt32): número de veces que este host no pudo alcanzar la réplica. -- `estimated_recovery_time` (UInt32): quedan segundos hasta que el recuento de errores de réplica se ponga a cero y se considere que vuelve a la normalidad. - -Tenga en cuenta que `errors_count` se actualiza una vez por consulta al clúster, pero `estimated_recovery_time` se vuelve a calcular bajo demanda. Entonces podría haber un caso distinto de cero `errors_count` y cero `estimated_recovery_time`, esa próxima consulta será cero `errors_count` e intente usar la réplica como si no tuviera errores. - -**Ver también** - -- [Motor de tabla distribuido](../engines/table_engines/special/distributed.md) -- [distributed\_replica\_error\_cap configuración](settings/settings.md#settings-distributed_replica_error_cap) -- [distributed\_replica\_error\_half\_life configuración](settings/settings.md#settings-distributed_replica_error_half_life) - -## sistema.columna {#system-columns} - -Contiene información sobre las columnas de todas las tablas. - -Puede utilizar esta tabla para obtener información similar a la [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table) consulta, pero para varias tablas a la vez. - -El `system.columns` tabla contiene las siguientes columnas (el tipo de columna se muestra entre corchetes): - -- `database` (String) — Database name. -- `table` (String) — Table name. -- `name` (String) — Column name. -- `type` (String) — Column type. -- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) para el valor predeterminado, o una cadena vacía si no está definida. -- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. -- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. -- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. -- `marks_bytes` (UInt64) — The size of marks, in bytes. -- `comment` (String) — Comment on the column, or an empty string if it is not defined. -- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. -- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. -- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. -- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. - -## sistema.colaborador {#system-contributors} - -Contiene información sobre los colaboradores. Todos los constributores en orden aleatorio. El orden es aleatorio en el momento de la ejecución de la consulta. - -Columna: - -- `name` (String) — Contributor (author) name from git log. - -**Ejemplo** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -Para descubrirlo en la tabla, use una consulta: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## sistema.base {#system-databases} - -Esta tabla contiene una sola columna String llamada ‘name’ – the name of a database. -Cada base de datos que el servidor conoce tiene una entrada correspondiente en la tabla. -Esta tabla del sistema se utiliza para implementar el `SHOW DATABASES` consulta. - -## sistema.detached\_parts {#system_tables-detached_parts} - -Contiene información sobre piezas separadas de [Método de codificación de datos:](../engines/table_engines/mergetree_family/mergetree.md) tabla. El `reason` columna especifica por qué se separó la pieza. Para las piezas separadas por el usuario, el motivo está vacío. Tales partes se pueden unir con [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) comando. Para obtener la descripción de otras columnas, consulte [sistema.parte](#system_tables-parts). Si el nombre de la pieza no es válido, los valores de algunas columnas pueden ser `NULL`. Tales partes se pueden eliminar con [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). - -## sistema.diccionario {#system-dictionaries} - -Contiene información sobre diccionarios externos. - -Columna: - -- `name` (String) — Dictionary name. -- `type` (String) — Dictionary type: Flat, Hashed, Cache. -- `origin` (String) — Path to the configuration file that describes the dictionary. -- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. -- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. -- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. -- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. -- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. -- `element_count` (UInt64) — The number of items stored in the dictionary. -- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). -- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. -- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn't be created. -- `source` (String) — Text describing the data source for the dictionary. - -Tenga en cuenta que la cantidad de memoria utilizada por el diccionario no es proporcional a la cantidad de elementos almacenados en él. Por lo tanto, para los diccionarios planos y en caché, todas las celdas de memoria se asignan previamente, independientemente de qué tan lleno esté realmente el diccionario. - -## sistema.evento {#system_tables-events} - -Contiene información sobre el número de eventos que se han producido en el sistema. Por ejemplo, en la tabla, puede encontrar cuántos `SELECT` las consultas se procesaron desde que se inició el servidor ClickHouse. - -Columna: - -- `event` ([Cadena](../sql_reference/data_types/string.md)) — Event name. -- `value` ([UInt64](../sql_reference/data_types/int_uint.md)) — Number of events occurred. -- `description` ([Cadena](../sql_reference/data_types/string.md)) — Event description. - -**Ejemplo** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Ver también** - -- [sistema.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [sistema.métricas](#system_tables-metrics) — Contains instantly calculated metrics. -- [sistema.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. - -## sistema.función {#system-functions} - -Contiene información sobre funciones normales y agregadas. - -Columna: - -- `name`(`String`) – The name of the function. -- `is_aggregate`(`UInt8`) — Whether the function is aggregate. - -## sistema.graphite\_retentions {#system-graphite-retentions} - -Contiene información sobre los parámetros [graphite\_rollup](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) que se utilizan en tablas con [\*GraphiteMergeTree](../engines/table_engines/mergetree_family/graphitemergetree.md) motor. - -Columna: - -- `config_name` (Cadena) - `graphite_rollup` nombre del parámetro. -- `regexp` (Cadena) - Un patrón para el nombre de la métrica. -- `function` (String) - El nombre de la función de agregación. -- `age` (UInt64) - La edad mínima de los datos en segundos. -- `precision` (UInt64) - Cómo definir con precisión la edad de los datos en segundos. -- `priority` (UInt16) - Prioridad de patrón. -- `is_default` (UInt8) - Si el patrón es el predeterminado. -- `Tables.database` (Array(String)) - Matriz de nombres de tablas de base de datos que utilizan `config_name` parámetro. -- `Tables.table` (Array(String)) - Matriz de nombres de tablas que utilizan `config_name` parámetro. - -## sistema.fusionar {#system-merges} - -Contiene información sobre fusiones y mutaciones de piezas actualmente en proceso para tablas de la familia MergeTree. - -Columna: - -- `database` (String) — The name of the database the table is in. -- `table` (String) — Table name. -- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. -- `progress` (Float64) — The percentage of completed work from 0 to 1. -- `num_parts` (UInt64) — The number of pieces to be merged. -- `result_part_name` (String) — The name of the part that will be formed as the result of merging. -- `is_mutation` (UInt8) - 1 si este proceso es una mutación parte. -- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. -- `total_size_marks` (UInt64) — The total number of marks in the merged parts. -- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. -- `rows_read` (UInt64) — Number of rows read. -- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. -- `rows_written` (UInt64) — Number of rows written. - -## sistema.métricas {#system_tables-metrics} - -Contiene métricas que pueden calcularse instantáneamente o tener un valor actual. Por ejemplo, el número de consultas procesadas simultáneamente o el retraso de réplica actual. Esta tabla está siempre actualizada. - -Columna: - -- `metric` ([Cadena](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — Metric value. -- `description` ([Cadena](../sql_reference/data_types/string.md)) — Metric description. - -La lista de métricas admitidas que puede encontrar en el [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) archivo fuente de ClickHouse. - -**Ejemplo** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Ver también** - -- [sistema.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [sistema.evento](#system_tables-events) — Contains a number of events that occurred. -- [sistema.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. - -## sistema.metric\_log {#system_tables-metric_log} - -Contiene el historial de valores de métricas de tablas `system.metrics` y `system.events`, periódicamente enjuagado al disco. -Para activar la recopilación de historial de métricas en `system.metric_log`, crear `/etc/clickhouse-server/config.d/metric_log.xml` con el siguiente contenido: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**Ejemplo** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**Ver también** - -- [sistema.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [sistema.evento](#system_tables-events) — Contains a number of events that occurred. -- [sistema.métricas](#system_tables-metrics) — Contains instantly calculated metrics. -- [Monitoreo](monitoring.md) — Base concepts of ClickHouse monitoring. - -## sistema.numero {#system-numbers} - -Esta tabla contiene una única columna UInt64 llamada ‘number’ que contiene casi todos los números naturales a partir de cero. -Puede usar esta tabla para pruebas, o si necesita hacer una búsqueda de fuerza bruta. -Las lecturas de esta tabla no están paralelizadas. - -## sistema.Números\_mt {#system-numbers-mt} - -Lo mismo que ‘system.numbers’ pero las lecturas están paralelizadas. Los números se pueden devolver en cualquier orden. -Se utiliza para pruebas. - -## sistema.una {#system-one} - -Esta tabla contiene una sola fila con una ‘dummy’ Columna UInt8 que contiene el valor 0. -Esta tabla se utiliza si una consulta SELECT no especifica la cláusula FROM. -Esto es similar a la tabla DUAL que se encuentra en otros DBMS. - -## sistema.parte {#system_tables-parts} - -Contiene información sobre partes de [Método de codificación de datos:](../engines/table_engines/mergetree_family/mergetree.md) tabla. - -Cada fila describe una parte de los datos. - -Columna: - -- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql_reference/statements/alter.md#query_language_queries_alter) consulta. - - Formato: - - - `YYYYMM` para la partición automática por mes. - - `any_string` al particionar manualmente. - -- `name` (`String`) – Name of the data part. - -- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it's used in a table. Otherwise, it's deleted. Inactive data parts remain after merging. - -- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` por la granularidad del índice (generalmente 8192) (esta sugerencia no funciona para la granularidad adaptativa). - -- `rows` (`UInt64`) – The number of rows. - -- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. - -- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `marks_bytes` (`UInt64`) – The size of the file with marks. - -- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| - -- `remove_time` (`DateTime`) – The time when the data part became inactive. - -- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. - -- `min_date` (`Date`) – The minimum value of the date key in the data part. - -- `max_date` (`Date`) – The maximum value of the date key in the data part. - -- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. - -- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. - -- `partition_id` (`String`) – ID of the partition. - -- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. - -- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. - -- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. - -- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. - -- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn't exist. For more details, see [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition) - -- `database` (`String`) – Name of the database. - -- `table` (`String`) – Name of the table. - -- `engine` (`String`) – Name of the table engine without parameters. - -- `path` (`String`) – Absolute path to the folder with data part files. - -- `disk` (`String`) – Name of a disk that stores the data part. - -- `hash_of_all_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) de archivos comprimidos. - -- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) de archivos sin comprimir (archivos con marcas, archivo de índice, etc.). - -- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) de datos en los archivos comprimidos como si estuvieran descomprimidos. - -- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. - -- `marks_size` (`UInt64`) – Alias for `marks_bytes`. - -## sistema.part\_log {#system_tables-part-log} - -El `system.part_log` se crea sólo si el [part\_log](server_configuration_parameters/settings.md#server_configuration_parameters-part-log) se especifica la configuración del servidor. - -Esta tabla contiene información sobre eventos que ocurrieron con [partes de datos](../engines/table_engines/mergetree_family/custom_partitioning_key.md) en el [Método de codificación de datos:](../engines/table_engines/mergetree_family/mergetree.md) tablas familiares, como agregar o fusionar datos. - -El `system.part_log` contiene las siguientes columnas: - -- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: - - `NEW_PART` — Inserting of a new data part. - - `MERGE_PARTS` — Merging of data parts. - - `DOWNLOAD_PART` — Downloading a data part. - - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — Mutating of a data part. - - `MOVE_PART` — Moving the data part from the one disk to another one. -- `event_date` (Date) — Event date. -- `event_time` (DateTime) — Event time. -- `duration_ms` (UInt64) — Duration. -- `database` (String) — Name of the database the data part is in. -- `table` (String) — Name of the table the data part is in. -- `part_name` (String) — Name of the data part. -- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ valor si la partición es por `tuple()`. -- `rows` (UInt64) — The number of rows in the data part. -- `size_in_bytes` (UInt64) — Size of the data part in bytes. -- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). -- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. -- `read_rows` (UInt64) — The number of rows was read during the merge. -- `read_bytes` (UInt64) — The number of bytes was read during the merge. -- `error` (UInt16) — The code number of the occurred error. -- `exception` (String) — Text message of the occurred error. - -El `system.part_log` se crea después de la primera inserción de datos `MergeTree` tabla. - -## sistema.procesa {#system_tables-processes} - -Esta tabla del sistema se utiliza para implementar el `SHOW PROCESSLIST` consulta. - -Columna: - -- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` usuario. El campo contiene el nombre de usuario para una consulta específica, no para una consulta que esta consulta inició. -- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` en el servidor de solicitud de consulta. -- `elapsed` (Float64) – The time in seconds since request execution started. -- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. -- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [Método de codificación de datos:](../operations/settings/query_complexity.md#settings_max_memory_usage) configuración. -- `query` (String) – The query text. For `INSERT`, no incluye los datos para insertar. -- `query_id` (String) – Query ID, if defined. - -## sistema.text\_log {#system-tables-text-log} - -Contiene entradas de registro. El nivel de registro que va a esta tabla se puede limitar con `text_log.level` configuración del servidor. - -Columna: - -- `event_date` (`Date`) - Fecha de la entrada. -- `event_time` (`DateTime`) - Tiempo de la entrada. -- `microseconds` (`UInt32`) - Microsegundos de la entrada. -- `thread_name` (String) — Name of the thread from which the logging was done. -- `thread_id` (UInt64) — OS thread ID. -- `level` (`Enum8`) - Nivel de entrada. - - `'Fatal' = 1` - - `'Critical' = 2` - - `'Error' = 3` - - `'Warning' = 4` - - `'Notice' = 5` - - `'Information' = 6` - - `'Debug' = 7` - - `'Trace' = 8` -- `query_id` (`String`) - ID de la consulta. -- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) -- `message` (`String`) - El mensaje en sí. -- `revision` (`UInt32`) - Revisión de ClickHouse. -- `source_file` (`LowCardinality(String)`) - Archivo de origen desde el que se realizó el registro. -- `source_line` (`UInt64`) - Línea de origen desde la que se realizó el registro. - -## sistema.query\_log {#system_tables-query_log} - -Contiene información sobre la ejecución de consultas. Para cada consulta, puede ver la hora de inicio del procesamiento, la duración del procesamiento, los mensajes de error y otra información. - -!!! note "Nota" - La tabla no contiene datos de entrada para `INSERT` consulta. - -ClickHouse crea esta tabla sólo si el [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) se especifica el parámetro server. Este parámetro establece las reglas de registro, como el intervalo de registro o el nombre de la tabla en la que se registrarán las consultas. - -Para habilitar el registro de consultas, [Log\_queries](settings/settings.md#settings-log-queries) parámetro a 1. Para obtener más información, consulte el [Configuración](settings/settings.md) apartado. - -El `system.query_log` tabla registra dos tipos de consultas: - -1. Consultas iniciales ejecutadas directamente por el cliente. -2. Niño consultas que fueron iniciados por otras consultas (distribuida de la ejecución de la consulta). Para estos tipos de consultas, la información sobre el padre de las consultas se muestra en la `initial_*` columna. - -Columna: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` consultas, el número de filas escritas. Para otras consultas, el valor de la columna es 0. -- `written_bytes` (UInt64) — For `INSERT` consultas, el número de bytes escritos. Para otras consultas, el valor de la columna es 0. -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [Casa de clics-cliente](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [Casa de clics-cliente](../interfaces/cli.md) o se ejecuta otro cliente TCP. -- `client_name` (String) — The [Casa de clics-cliente](../interfaces/cli.md) o otro nombre de cliente TCP. -- `client_revision` (UInt32) — Revision of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. -- `client_version_major` (UInt32) — Major version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. -- `client_version_minor` (UInt32) — Minor version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. -- `client_version_patch` (UInt32) — Patch component of the [Casa de clics-cliente](../interfaces/cli.md) o otra versión de cliente TCP. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` se utilizó el método. - - 2 — `POST` se utilizó el método. -- `http_user_agent` (String) — The `UserAgent` encabezado pasado en la solicitud HTTP. -- `quota_key` (String) — The “quota key” especificado en el [cuota](quotas.md) ajuste (ver `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [sistema.evento](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` columna. -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parámetro a 1. -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` columna. - -Cada consulta crea una o dos filas en el `query_log` tabla, dependiendo del estado de la consulta: - -1. Si la ejecución de la consulta se realiza correctamente, se crean dos eventos con los tipos 1 y 2 (consulte `type` columna). -2. Si se produjo un error durante el procesamiento de la consulta, se crean dos eventos con los tipos 1 y 4. -3. Si se produjo un error antes de iniciar la consulta, se crea un solo evento con el tipo 3. - -De forma predeterminada, los registros se agregan a la tabla a intervalos de 7,5 segundos. Puede establecer este intervalo en el [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) configuración del servidor (consulte el `flush_interval_milliseconds` parámetro). Para vaciar los registros a la fuerza desde el búfer de memoria a la tabla, utilice `SYSTEM FLUSH LOGS` consulta. - -Cuando la tabla se elimina manualmente, se creará automáticamente sobre la marcha. Tenga en cuenta que se eliminarán todos los registros anteriores. - -!!! note "Nota" - El período de almacenamiento para los registros es ilimitado. Los registros no se eliminan automáticamente de la tabla. Debe organizar la eliminación de registros obsoletos usted mismo. - -Puede especificar una clave de partición arbitraria `system.query_log` mesa en el [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) configuración del servidor (consulte el `partition_by` parámetro). - -## sistema.Sistema abierto. {#system_tables-query-thread-log} - -La tabla contiene información sobre cada subproceso de ejecución de consultas. - -ClickHouse crea esta tabla sólo si el [Sistema abierto.](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) se especifica el parámetro server. Este parámetro establece las reglas de registro, como el intervalo de registro o el nombre de la tabla en la que se registrarán las consultas. - -Para habilitar el registro de consultas, [Log\_query\_threads](settings/settings.md#settings-log-query-threads) parámetro a 1. Para obtener más información, consulte el [Configuración](settings/settings.md) apartado. - -Columna: - -- `event_date` (Date) — the date when the thread has finished execution of the query. -- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` consultas, el número de filas escritas. Para otras consultas, el valor de la columna es 0. -- `written_bytes` (UInt64) — For `INSERT` consultas, el número de bytes escritos. Para otras consultas, el valor de la columna es 0. -- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. -- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. -- `thread_name` (String) — Name of the thread. -- `thread_number` (UInt32) — Internal thread ID. -- `os_thread_id` (Int32) — OS thread ID. -- `master_thread_id` (UInt64) — OS initial ID of initial thread. -- `query` (String) — Query string. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [Casa de clics-cliente](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [Casa de clics-cliente](../interfaces/cli.md) o se ejecuta otro cliente TCP. -- `client_name` (String) — The [Casa de clics-cliente](../interfaces/cli.md) o otro nombre de cliente TCP. -- `client_revision` (UInt32) — Revision of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. -- `client_version_major` (UInt32) — Major version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. -- `client_version_minor` (UInt32) — Minor version of the [Casa de clics-cliente](../interfaces/cli.md) o otro cliente TCP. -- `client_version_patch` (UInt32) — Patch component of the [Casa de clics-cliente](../interfaces/cli.md) o otra versión de cliente TCP. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` se utilizó el método. - - 2 — `POST` se utilizó el método. -- `http_user_agent` (String) — The `UserAgent` encabezado pasado en la solicitud HTTP. -- `quota_key` (String) — The “quota key” especificado en el [cuota](quotas.md) ajuste (ver `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [sistema.evento](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` columna. - -De forma predeterminada, los registros se agregan a la tabla a intervalos de 7,5 segundos. Puede establecer este intervalo en el [Sistema abierto.](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) configuración del servidor (consulte el `flush_interval_milliseconds` parámetro). Para vaciar los registros a la fuerza desde el búfer de memoria a la tabla, utilice `SYSTEM FLUSH LOGS` consulta. - -Cuando la tabla se elimina manualmente, se creará automáticamente sobre la marcha. Tenga en cuenta que se eliminarán todos los registros anteriores. - -!!! note "Nota" - El período de almacenamiento para los registros es ilimitado. Los registros no se eliminan automáticamente de la tabla. Debe organizar la eliminación de registros obsoletos usted mismo. - -Puede especificar una clave de partición arbitraria `system.query_thread_log` mesa en el [Sistema abierto.](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) configuración del servidor (consulte el `partition_by` parámetro). - -## sistema.trace\_log {#system_tables-trace_log} - -Contiene seguimientos de pila recopilados por el generador de perfiles de consultas de muestreo. - -ClickHouse crea esta tabla cuando el [trace\_log](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) se establece la sección de configuración del servidor. También el [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) y [Los resultados de la prueba](settings/settings.md#query_profiler_cpu_time_period_ns) los ajustes deben establecerse. - -Para analizar los registros, utilice el `addressToLine`, `addressToSymbol` y `demangle` funciones de inspección. - -Columna: - -- `event_date`([Fecha](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time`([FechaHora](../sql_reference/data_types/datetime.md)) — Timestamp of sampling moment. - -- `revision`([UInt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - Cuando se conecta al servidor por `clickhouse-client`, ves la cadena similar a `Connected to ClickHouse server version 19.18.1 revision 54429.`. Este campo contiene el `revision`, pero no el `version` de un servidor. - -- `timer_type`([Enum8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` representa el tiempo del reloj de pared. - - `CPU` representa el tiempo de CPU. - -- `thread_number`([UInt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id`([Cadena](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) tabla del sistema. - -- `trace`([Matriz (UInt64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**Ejemplo** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## sistema.Replica {#system_tables-replicas} - -Contiene información y estado de las tablas replicadas que residen en el servidor local. -Esta tabla se puede utilizar para el monitoreo. La tabla contiene una fila para cada tabla Replicated\*. - -Ejemplo: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -Columna: - -- `database` (`String`) - Nombre de la base de datos -- `table` (`String`) - Nombre de la tabla -- `engine` (`String`) - Nombre del motor de tabla -- `is_leader` (`UInt8`) - Si la réplica es la líder. - Sólo una réplica a la vez puede ser el líder. El líder es responsable de seleccionar las fusiones de fondo para realizar. - Tenga en cuenta que las escrituras se pueden realizar en cualquier réplica que esté disponible y tenga una sesión en ZK, independientemente de si es un líder. -- `can_become_leader` (`UInt8`) - Si la réplica puede ser elegida como líder. -- `is_readonly` (`UInt8`) - Si la réplica está en modo de sólo lectura. - Este modo se activa si la configuración no tiene secciones con ZooKeeper, si se produce un error desconocido al reinicializar sesiones en ZooKeeper y durante la reinicialización de sesiones en ZooKeeper. -- `is_session_expired` (`UInt8`) - la sesión con ZooKeeper ha expirado. Básicamente lo mismo que `is_readonly`. -- `future_parts` (`UInt32`) - El número de partes de datos que aparecerán como resultado de INSERTs o fusiones que aún no se han realizado. -- `parts_to_check` (`UInt32`) - El número de partes de datos en la cola para la verificación. Una pieza se coloca en la cola de verificación si existe la sospecha de que podría estar dañada. -- `zookeeper_path` (`String`) - Ruta de acceso a los datos de la tabla en ZooKeeper. -- `replica_name` (`String`) - Nombre de réplica en ZooKeeper. Diferentes réplicas de la misma tabla tienen diferentes nombres. -- `replica_path` (`String`) - Ruta de acceso a los datos de réplica en ZooKeeper. Lo mismo que concatenar ‘zookeeper\_path/replicas/replica\_path’. -- `columns_version` (`Int32`) - Número de versión de la estructura de la tabla. Indica cuántas veces se realizó ALTER. Si las réplicas tienen versiones diferentes, significa que algunas réplicas aún no han hecho todas las ALTER. -- `queue_size` (`UInt32`) - Tamaño de la cola para las operaciones en espera de ser realizadas. Las operaciones incluyen insertar bloques de datos, fusiones y otras acciones. Por lo general, coincide con `future_parts`. -- `inserts_in_queue` (`UInt32`) - Número de inserciones de bloques de datos que deben realizarse. Las inserciones generalmente se replican con bastante rapidez. Si este número es grande, significa que algo anda mal. -- `merges_in_queue` (`UInt32`) - El número de fusiones en espera de hacerse. A veces las fusiones son largas, por lo que este valor puede ser mayor que cero durante mucho tiempo. -- `part_mutations_in_queue` (`UInt32`) - El número de mutaciones a la espera de hacerse. -- `queue_oldest_time` (`DateTime`) - Si `queue_size` mayor que 0, muestra cuándo se agregó la operación más antigua a la cola. -- `inserts_oldest_time` (`DateTime`) - Ver `queue_oldest_time` -- `merges_oldest_time` (`DateTime`) - Ver `queue_oldest_time` -- `part_mutations_oldest_time` (`DateTime`) - Ver `queue_oldest_time` - -Las siguientes 4 columnas tienen un valor distinto de cero solo cuando hay una sesión activa con ZK. - -- `log_max_index` (`UInt64`) - Número máximo de inscripción en el registro de actividad general. -- `log_pointer` (`UInt64`) - Número máximo de entrada en el registro de actividad general que la réplica copió en su cola de ejecución, más uno. Si `log_pointer` es mucho más pequeño que `log_max_index`, algo está mal. -- `last_queue_update` (`DateTime`) - Cuando la cola se actualizó la última vez. -- `absolute_delay` (`UInt64`) - ¿Qué tan grande retraso en segundos tiene la réplica actual. -- `total_replicas` (`UInt8`) - El número total de réplicas conocidas de esta tabla. -- `active_replicas` (`UInt8`) - El número de réplicas de esta tabla que tienen una sesión en ZooKeeper (es decir, el número de réplicas en funcionamiento). - -Si solicita todas las columnas, la tabla puede funcionar un poco lentamente, ya que se realizan varias lecturas de ZooKeeper para cada fila. -Si no solicita las últimas 4 columnas (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), la tabla funciona rápidamente. - -Por ejemplo, puede verificar que todo funcione correctamente de esta manera: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -Si esta consulta no devuelve nada, significa que todo está bien. - -## sistema.configuración {#system-settings} - -Contiene información sobre la configuración actualmente en uso. -Es decir, se usa para ejecutar la consulta que está utilizando para leer del sistema.tabla de configuración. - -Columna: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. -- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [limitación](settings/constraints_on_settings.md#constraints-on-settings)). -- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [limitación](settings/constraints_on_settings.md#constraints-on-settings)). -- `readonly` (UInt8) — Can user change this setting (for more info, look into [limitación](settings/constraints_on_settings.md#constraints-on-settings)). - -Ejemplo: - -``` sql -SELECT name, value -FROM system.settings -WHERE changed -``` - -``` text -┌─name───────────────────┬─value───────┐ -│ max_threads │ 8 │ -│ use_uncompressed_cache │ 0 │ -│ load_balancing │ random │ -│ max_memory_usage │ 10000000000 │ -└────────────────────────┴─────────────┘ -``` - -## sistema.merge\_tree\_settings {#system-merge_tree_settings} - -Contiene información sobre la configuración `MergeTree` tabla. - -Columna: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. - -## sistema.table\_engines {#system-table-engines} - -Contiene la descripción de los motores de tablas admitidos por el servidor y su información de soporte de características. - -Esta tabla contiene las siguientes columnas (el tipo de columna se muestra entre corchetes): - -- `name` (String) — The name of table engine. -- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` clausula. -- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [Índices de saltos](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` y `SAMPLE_BY`. -- `supports_replication` (UInt8) — Flag that indicates if table engine supports [Replicación de datos](../engines/table_engines/mergetree_family/replication.md). -- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. - -Ejemplo: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**Ver también** - -- Familia MergeTree [cláusulas de consulta](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) -- Kafka [configuración](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) -- Unir [configuración](../engines/table_engines/special/join.md#join-limitations-and-settings) - -## sistema.tabla {#system-tables} - -Contiene metadatos de cada tabla que el servidor conoce. Las tablas separadas no se muestran en `system.tables`. - -Esta tabla contiene las siguientes columnas (el tipo de columna se muestra entre corchetes): - -- `database` (String) — The name of the database the table is in. - -- `name` (String) — Table name. - -- `engine` (String) — Table engine name (without parameters). - -- `is_temporary` (UInt8): marca que indica si la tabla es temporal. - -- `data_path` (String) - Ruta de acceso a los datos de la tabla en el sistema de archivos. - -- `metadata_path` (String) - Ruta de acceso a los metadatos de la tabla en el sistema de archivos. - -- `metadata_modification_time` (DateTime) - Hora de la última modificación de los metadatos de la tabla. - -- `dependencies_database` (Array(String)) - Dependencias de base de datos. - -- `dependencies_table` (Array(String)) - Dependencias de tabla ([Método de codificación de datos:](../engines/table_engines/special/materializedview.md) tablas basadas en la tabla actual). - -- `create_table_query` (String) - La consulta que se utilizó para crear la tabla. - -- `engine_full` (String) - Parámetros del motor de tabla. - -- `partition_key` (String) - La expresión de clave de partición especificada en la tabla. - -- `sorting_key` (Cadena) - La clave de clasificación de la expresión especificada en la tabla. - -- `primary_key` (String) - La expresión de clave principal especificada en la tabla. - -- `sampling_key` (String) - La expresión de clave de muestreo especificada en la tabla. - -- `storage_policy` (String) - La política de almacenamiento: - - - [Método de codificación de datos:](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) - - [Distribuido](../engines/table_engines/special/distributed.md#distributed) - -- `total_rows` (Nullable(UInt64)) - Número total de filas, si es posible determinar rápidamente el número exacto de filas en la tabla, de lo contrario `Null` (incluyendo underying `Buffer` tabla). - -- `total_bytes` (Nullable(UInt64)) - Número total de bytes, si es posible determinar rápidamente el número exacto de bytes para la tabla en el almacenamiento, de lo contrario `Null` (**no** incluye cualquier almacenamiento subyacente). - - - If the table stores data on disk, returns used space on disk (i.e. compressed). - - Si la tabla almacena datos en la memoria, devuelve el número aproximado de bytes utilizados en la memoria. - -El `system.tables` se utiliza la tabla en `SHOW TABLES` implementación de consultas. - -## sistema.Zookeeper {#system-zookeeper} - -La tabla no existe si ZooKeeper no está configurado. Permite leer datos del clúster ZooKeeper definido en la configuración. -La consulta debe tener un ‘path’ condición de igualdad en la cláusula WHERE. Este es el camino en ZooKeeper para los niños para los que desea obtener datos. - -Consulta `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` salidas de datos para todos los niños en el `/clickhouse` nodo. -Para generar datos para todos los nodos raíz, escriba path = ‘/’. -Si la ruta especificada en ‘path’ no existe, se lanzará una excepción. - -Columna: - -- `name` (String) — The name of the node. -- `path` (String) — The path to the node. -- `value` (String) — Node value. -- `dataLength` (Int32) — Size of the value. -- `numChildren` (Int32) — Number of descendants. -- `czxid` (Int64) — ID of the transaction that created the node. -- `mzxid` (Int64) — ID of the transaction that last changed the node. -- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. -- `ctime` (DateTime) — Time of node creation. -- `mtime` (DateTime) — Time of the last modification of the node. -- `version` (Int32) — Node version: the number of times the node was changed. -- `cversion` (Int32) — Number of added or removed descendants. -- `aversion` (Int32) — Number of changes to the ACL. -- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. - -Ejemplo: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## sistema.mutación {#system_tables-mutations} - -La tabla contiene información sobre [mutación](../sql_reference/statements/alter.md#alter-mutations) de las tablas MergeTree y su progreso. Cada comando de mutación está representado por una sola fila. La tabla tiene las siguientes columnas: - -**base**, **tabla** - El nombre de la base de datos y la tabla a la que se aplicó la mutación. - -**mutation\_id** - La identificación de la mutación. Para las tablas replicadas, estos identificadores corresponden a los nombres de znode `/mutations/` directorio en ZooKeeper. Para las tablas no duplicadas, los ID corresponden a los nombres de archivo en el directorio de datos de la tabla. - -**comando** - La cadena de comandos de mutación (la parte de la consulta después de `ALTER TABLE [db.]table`). - -**create\_time** - Cuando este comando de mutación fue enviado para su ejecución. - -**block\_numbers.partition\_id**, **block\_numbers.numero** - Una columna anidada. Para las mutaciones de tablas replicadas, contiene un registro para cada partición: el ID de partición y el número de bloque que fue adquirido por la mutación (en cada partición, solo se mutarán las partes que contienen bloques con números menores que el número de bloque adquirido por la mutación en esa partición). En tablas no replicadas, los números de bloque en todas las particiones forman una sola secuencia. Esto significa que para las mutaciones de tablas no replicadas, la columna contendrá un registro con un solo número de bloque adquirido por la mutación. - -**partes\_a\_do** - El número de partes de datos que deben mutarse para que finalice la mutación. - -**is\_done** - Es la mutación hecho? Tenga en cuenta que incluso si `parts_to_do = 0` es posible que aún no se haya realizado una mutación de una tabla replicada debido a un INSERT de larga ejecución que creará una nueva parte de datos que deberá mutarse. - -Si hubo problemas con la mutación de algunas partes, las siguientes columnas contienen información adicional: - -**Método de codificación de datos:** - El nombre de la parte más reciente que no se pudo mutar. - -**Método de codificación de datos:** - El momento del fracaso de la mutación de la parte más reciente. - -**Método de codificación de datos:** - El mensaje de excepción que causó el error de mutación de parte más reciente. - -## sistema.disco {#system_tables-disks} - -Contiene información sobre los discos definidos en el [configuración del servidor](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Columna: - -- `name` ([Cadena](../sql_reference/data_types/string.md)) — Name of a disk in the server configuration. -- `path` ([Cadena](../sql_reference/data_types/string.md)) — Path to the mount point in the file system. -- `free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Free space on disk in bytes. -- `total_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Disk volume in bytes. -- `keep_free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` parámetro de configuración del disco. - -## sistema.almacenamiento\_policies {#system_tables-storage_policies} - -Contiene información sobre las directivas de almacenamiento y los volúmenes [configuración del servidor](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Columna: - -- `policy_name` ([Cadena](../sql_reference/data_types/string.md)) — Name of the storage policy. -- `volume_name` ([Cadena](../sql_reference/data_types/string.md)) — Volume name defined in the storage policy. -- `volume_priority` ([UInt64](../sql_reference/data_types/int_uint.md)) — Volume order number in the configuration. -- `disks` ([Array(Cadena)](../sql_reference/data_types/array.md)) — Disk names, defined in the storage policy. -- `max_data_part_size` ([UInt64](../sql_reference/data_types/int_uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). -- `move_factor` ([Float64](../sql_reference/data_types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. - -Si la directiva de almacenamiento contiene más de un volumen, la información de cada volumen se almacena en la fila individual de la tabla. - -[Artículo Original](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/es/operations/tips.md b/docs/es/operations/tips.md index 19f34f834fc..d45bc9bcda4 100644 --- a/docs/es/operations/tips.md +++ b/docs/es/operations/tips.md @@ -5,7 +5,7 @@ toc_priority: 58 toc_title: Recomendaciones de uso --- -# Recomendaciones de uso {#usage-recommendations} +# Recomendaciones De Uso {#usage-recommendations} ## CPU Scaling Governor {#cpu-scaling-governor} @@ -15,7 +15,7 @@ Utilice siempre el `performance` gobernador de escala. El `on-demand` regulador $ echo 'performance' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ``` -## Limitaciones de la CPU {#cpu-limitations} +## Limitaciones De La CPU {#cpu-limitations} Los procesadores pueden sobrecalentarse. Utilizar `dmesg` para ver si la velocidad de reloj de la CPU era limitada debido al sobrecalentamiento. La restricción también se puede establecer externamente en el nivel del centro de datos. Usted puede utilizar `turbostat` para controlarlo bajo una carga. @@ -32,7 +32,7 @@ No deshabilite el sobrecompromiso. Valor `cat /proc/sys/vm/overcommit_memory` de $ echo 0 | sudo tee /proc/sys/vm/overcommit_memory ``` -## Páginas enormes {#huge-pages} +## Páginas Enormes {#huge-pages} Siempre deshabilite las páginas enormes transparentes. Interfiere con los asignadores de memoria, lo que conduce a una degradación significativa del rendimiento. @@ -43,7 +43,7 @@ $ echo 'never' | sudo tee /sys/kernel/mm/transparent_hugepage/enabled Utilizar `perf top` para ver el tiempo pasado en el kernel para la administración de memoria. Las páginas enormes permanentes tampoco necesitan ser asignadas. -## Subsistema de almacenamiento {#storage-subsystem} +## Subsistema De Almacenamiento {#storage-subsystem} Si su presupuesto le permite usar SSD, use SSD. Si no, utilice el disco duro. Discos Duros SATA de 7200 RPM va a hacer. @@ -76,13 +76,13 @@ Independientemente del uso de RAID, utilice siempre la replicación para la segu Habilite NCQ con una cola larga. Para HDD, elija el programador CFQ, y para SSD, elija noop. No reduzca el ‘readahead’ configuración. Para HDD, habilite la memoria caché de escritura. -## Sistema de archivos {#file-system} +## Sistema De Archivos {#file-system} Ext4 es la opción más confiable. Establecer las opciones de montaje `noatime, nobarrier`. XFS también es adecuado, pero no ha sido probado tan a fondo con ClickHouse. La mayoría de los otros sistemas de archivos también deberían funcionar bien. Los sistemas de archivos con asignación retrasada funcionan mejor. -## Núcleo de Linux {#linux-kernel} +## Núcleo De Linux {#linux-kernel} No use un kernel de Linux obsoleto. @@ -97,7 +97,7 @@ Utilice al menos una red de 10 GB, si es posible. 1 Gb también funcionará, per Probablemente ya esté utilizando ZooKeeper para otros fines. Puede usar la misma instalación de ZooKeeper, si aún no está sobrecargada. -It's best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. +It’s best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. Nunca debe usar scripts escritos manualmente para transferir datos entre diferentes clústeres de ZooKeeper, ya que el resultado será incorrecto para los nodos secuenciales. Nunca utilice el “zkcopy” utilidad por la misma razón: https://github.com/ksprojects/zkcopy/issues/15 diff --git a/docs/es/operations/troubleshooting.md b/docs/es/operations/troubleshooting.md index 70467a0cca4..82cda7b9c5e 100644 --- a/docs/es/operations/troubleshooting.md +++ b/docs/es/operations/troubleshooting.md @@ -5,7 +5,7 @@ toc_priority: 46 toc_title: "Soluci\xF3n de problemas" --- -# Solución de problemas {#troubleshooting} +# Solución De Problemas {#troubleshooting} - [Instalación](#troubleshooting-installation-errors) - [Conexión al servidor](#troubleshooting-accepts-no-connections) @@ -14,19 +14,19 @@ toc_title: "Soluci\xF3n de problemas" ## Instalación {#troubleshooting-installation-errors} -### No puede obtener paquetes Deb del repositorio de Clickhouse con Apt-get {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} +### No Puede Obtener Paquetes Deb Del Repositorio De Clickhouse Con Apt-get {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} - Compruebe la configuración del firewall. -- Si no puede acceder al repositorio por cualquier motivo, descargue los paquetes como se describe en el [Primeros pasos](../getting_started/index.md) artículo e instálelos manualmente usando el `sudo dpkg -i ` comando. También necesitará el `tzdata` paquete. +- Si no puede acceder al repositorio por cualquier motivo, descargue los paquetes como se describe en el [Primeros pasos](../getting-started/index.md) artículo e instálelos manualmente usando el `sudo dpkg -i ` comando. También necesitará el `tzdata` paquete. -## Conexión al servidor {#troubleshooting-accepts-no-connections} +## Conexión Al Servidor {#troubleshooting-accepts-no-connections} Posibles problemas: - El servidor no se está ejecutando. - Parámetros de configuración inesperados o incorrectos. -### El servidor no se está ejecutando {#server-is-not-running} +### El Servidor No Se está Ejecutando {#server-is-not-running} **Compruebe si el servidor está ejecutado** @@ -95,7 +95,7 @@ $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-se Este comando inicia el servidor como una aplicación interactiva con parámetros estándar del script de inicio automático. En este modo `clickhouse-server` imprime todos los mensajes de eventos en la consola. -### Parámetros de configuración {#configuration-parameters} +### Parámetros De configuración {#configuration-parameters} Comprobar: @@ -105,7 +105,7 @@ Comprobar: - Configuración del punto final. - Comprobar [listen\_host](server_configuration_parameters/settings.md#server_configuration_parameters-listen_host) y [Tcp\_port](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port) configuración. + Comprobar [listen\_host](server-configuration-parameters/settings.md#server_configuration_parameters-listen_host) y [Tcp\_port](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port) configuración. El servidor ClickHouse acepta conexiones localhost solo de forma predeterminada. @@ -117,8 +117,8 @@ Comprobar: Comprobar: - - El [Tcp\_port\_secure](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) configuración. - - Ajustes para [Sertificados SSL](server_configuration_parameters/settings.md#server_configuration_parameters-openssl). + - El [Tcp\_port\_secure](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) configuración. + - Ajustes para [Sertificados SSL](server-configuration-parameters/settings.md#server_configuration_parameters-openssl). Utilice los parámetros adecuados mientras se conecta. Por ejemplo, utilice el `port_secure` parámetro con `clickhouse_client`. @@ -126,7 +126,7 @@ Comprobar: Es posible que esté utilizando el nombre de usuario o la contraseña incorrectos. -## Procesamiento de consultas {#troubleshooting-does-not-process-queries} +## Procesamiento De Consultas {#troubleshooting-does-not-process-queries} Si ClickHouse no puede procesar la consulta, envía una descripción de error al cliente. En el `clickhouse-client` obtienes una descripción del error en la consola. Si está utilizando la interfaz HTTP, ClickHouse envía la descripción del error en el cuerpo de la respuesta. Por ejemplo: @@ -139,7 +139,7 @@ Si empiezas `clickhouse-client` con el `stack-trace` parámetro, ClickHouse devu Es posible que vea un mensaje sobre una conexión rota. En este caso, puede repetir la consulta. Si la conexión se rompe cada vez que realiza la consulta, compruebe si hay errores en los registros del servidor. -## Eficiencia del procesamiento de consultas {#troubleshooting-too-slow} +## Eficiencia Del Procesamiento De Consultas {#troubleshooting-too-slow} Si ve que ClickHouse funciona demasiado lentamente, debe perfilar la carga en los recursos del servidor y la red para sus consultas. diff --git a/docs/es/operations/update.md b/docs/es/operations/update.md index b391af9adc3..159e94a870e 100644 --- a/docs/es/operations/update.md +++ b/docs/es/operations/update.md @@ -5,7 +5,7 @@ toc_priority: 47 toc_title: "Actualizaci\xF3n de ClickHouse" --- -# Actualización de ClickHouse {#clickhouse-update} +# Actualización De ClickHouse {#clickhouse-update} Si se instaló ClickHouse desde paquetes deb, ejecute los siguientes comandos en el servidor: diff --git a/docs/es/operations/utilities/clickhouse-benchmark.md b/docs/es/operations/utilities/clickhouse-benchmark.md index e1b59ac2255..6153add3127 100644 --- a/docs/es/operations/utilities/clickhouse-benchmark.md +++ b/docs/es/operations/utilities/clickhouse-benchmark.md @@ -5,7 +5,7 @@ toc_priority: 61 toc_title: Sistema abierto. --- -# Sistema abierto. {#clickhouse-benchmark} +# Sistema Abierto {#clickhouse-benchmark} Se conecta a un servidor ClickHouse y envía repetidamente las consultas especificadas. @@ -99,7 +99,7 @@ En el informe puedes encontrar: - Percentiles de tiempo de ejecución de consultas. -## Modo de comparación {#clickhouse-benchmark-comparison-mode} +## Modo De comparación {#clickhouse-benchmark-comparison-mode} `clickhouse-benchmark` puede comparar el rendimiento de dos servidores ClickHouse en ejecución. diff --git a/docs/es/operations/utilities/clickhouse-copier.md b/docs/es/operations/utilities/clickhouse-copier.md index 917c4d41939..0fe432336f2 100644 --- a/docs/es/operations/utilities/clickhouse-copier.md +++ b/docs/es/operations/utilities/clickhouse-copier.md @@ -5,7 +5,7 @@ toc_priority: 59 toc_title: "M\xE9todo de codificaci\xF3n de datos:" --- -# Método de codificación de datos: {#clickhouse-copier} +# Método De codificación De Datos: {#clickhouse-copier} Copia datos de las tablas de un clúster en tablas de otro (o del mismo) clúster. @@ -26,7 +26,7 @@ Después de comenzar, `clickhouse-copier`: Para reducir el tráfico de red, recomendamos ejecutar `clickhouse-copier` en el mismo servidor donde se encuentran los datos de origen. -## Ejecución de clickhouse-copiadora {#running-clickhouse-copier} +## Ejecución De Clickhouse-copiadora {#running-clickhouse-copier} La utilidad debe ejecutarse manualmente: @@ -43,7 +43,7 @@ Parámetros: - `task-upload-force` — Force upload `task-file` incluso si el nodo ya existe. - `base-dir` — The path to logs and auxiliary files. When it starts, `clickhouse-copier` crear `clickhouse-copier_YYYYMMHHSS_` subdirectorios en `$base-dir`. Si se omite este parámetro, los directorios se crean en el directorio donde `clickhouse-copier` se puso en marcha. -## Formato de zookeeper.XML {#format-of-zookeeper-xml} +## Formato De Zookeeper.XML {#format-of-zookeeper-xml} ``` xml @@ -62,7 +62,7 @@ Parámetros: ``` -## Configuración de tareas de copia {#configuration-of-copying-tasks} +## Configuración De Tareas De Copia {#configuration-of-copying-tasks} ``` xml diff --git a/docs/es/operations/utilities/clickhouse-local.md b/docs/es/operations/utilities/clickhouse-local.md index d96eda80048..f70dd41565a 100644 --- a/docs/es/operations/utilities/clickhouse-local.md +++ b/docs/es/operations/utilities/clickhouse-local.md @@ -5,11 +5,11 @@ toc_priority: 60 toc_title: Sistema abierto --- -# Sistema abierto. {#clickhouse-local} +# Sistema Abierto {#clickhouse-local} El `clickhouse-local` El programa le permite realizar un procesamiento rápido en archivos locales, sin tener que implementar y configurar el servidor ClickHouse. -Acepta datos que representan tablas y las consulta usando [Nombre de la red inalámbrica (SSID):](../../sql_reference/index.md). +Acepta datos que representan tablas y las consulta usando [Nombre de la red inalámbrica (SSID):](../../sql-reference/index.md). `clickhouse-local` utiliza el mismo núcleo que el servidor ClickHouse, por lo que es compatible con la mayoría de las características y el mismo conjunto de formatos y motores de tabla. diff --git a/docs/es/roadmap.md b/docs/es/roadmap.md index 11934c67422..60db1c608df 100644 --- a/docs/es/roadmap.md +++ b/docs/es/roadmap.md @@ -2,7 +2,7 @@ machine_translated: true --- -# Hoja de ruta {#roadmap} +# Hoja De Ruta {#roadmap} ## Q1 2020 {#q1-2020} diff --git a/docs/es/sql-reference/aggregate-functions/combinators.md b/docs/es/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..69f06a37ce1 --- /dev/null +++ b/docs/es/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,166 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 37 +toc_title: Combinadores de funciones agregadas +--- + +# Combinadores De Funciones Agregadas {#aggregate_functions_combinators} + +El nombre de una función agregada puede tener un sufijo anexado. Esto cambia la forma en que funciona la función de agregado. + +## -Si {#agg-functions-combinator-if} + +The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). + +Ejemplos: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` y así sucesivamente. + +Con las funciones de agregado condicional, puede calcular agregados para varias condiciones a la vez, sin utilizar subconsultas y `JOIN`Por ejemplo, en Yandex.Metrica, las funciones de agregado condicional se utilizan para implementar la funcionalidad de comparación de segmentos. + +## -Matriz {#agg-functions-combinator-array} + +El sufijo -Array se puede agregar a cualquier función agregada. En este caso, la función de agregado toma argumentos del ‘Array(T)’ tipo (arrays) en lugar de ‘T’ argumentos de tipo. Si la función de agregado acepta varios argumentos, deben ser matrices de igual longitud. Al procesar matrices, la función de agregado funciona como la función de agregado original en todos los elementos de la matriz. + +Ejemplo 1: `sumArray(arr)` - Totales de todos los elementos de todos ‘arr’ matriz. En este ejemplo, podría haber sido escrito más simplemente: `sum(arraySum(arr))`. + +Ejemplo 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ matriz. Esto podría hacerse de una manera más fácil: `uniq(arrayJoin(arr))`, pero no siempre es posible agregar ‘arrayJoin’ a una consulta. + +-If y -Array se pueden combinar. Obstante, ‘Array’ debe venir primero, entonces ‘If’. Ejemplos: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. Debido a este pedido, el ‘cond’ argumento no será una matriz. + +## -Estado {#agg-functions-combinator-state} + +Si aplica este combinador, la función de agregado no devuelve el valor resultante (como el número de valores únicos para el [uniq](reference.md#agg_function-uniq) función), pero un estado intermedio de la agregación (para `uniq`, esta es la tabla hash para calcular el número de valores únicos). Este es un `AggregateFunction(...)` que puede ser utilizado para su posterior procesamiento o almacenado en una tabla para terminar de agregar más tarde. + +Para trabajar con estos estados, use: + +- [AgregaciónMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) motor de mesa. +- [finalizeAggregation](../../sql-reference/functions/other-functions.md#function-finalizeaggregation) función. +- [runningAccumulate](../../sql-reference/functions/other-functions.md#function-runningaccumulate) función. +- [-Fusionar](#aggregate_functions_combinators_merge) combinador. +- [-MergeState](#aggregate_functions_combinators_mergestate) combinador. + +## -Fusionar {#aggregate_functions_combinators-merge} + +Si aplica este combinador, la función de agregado toma el estado de agregación intermedio como argumento, combina los estados para finalizar la agregación y devuelve el valor resultante. + +## -MergeState {#aggregate_functions_combinators-mergestate} + +Combina los estados de agregación intermedios de la misma manera que el combinador -Merge. Sin embargo, no devuelve el valor resultante, sino un estado de agregación intermedio, similar al combinador -State. + +## -ForEach {#agg-functions-combinator-foreach} + +Convierte una función de agregado para tablas en una función de agregado para matrices que agrega los elementos de matriz correspondientes y devuelve una matriz de resultados. Por ejemplo, `sumForEach` para las matrices `[1, 2]`, `[3, 4, 5]`y`[6, 7]`devuelve el resultado `[10, 13, 5]` después de agregar los elementos de la matriz correspondientes. + +## -OPor defecto {#agg-functions-combinator-ordefault} + +Rellena el valor predeterminado del tipo devuelto de la función de agregado si no hay nada que agregar. + +``` sql +SELECT avg(number), avgOrDefault(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrDefault(number)─┐ +│ nan │ 0 │ +└─────────────┴──────────────────────┘ +``` + +## -OrNull {#agg-functions-combinator-ornull} + +Llenar `null` si no hay nada que agregar. La columna de retorno será anulable. + +``` sql +SELECT avg(number), avgOrNull(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrNull(number)─┐ +│ nan │ ᴺᵁᴸᴸ │ +└─────────────┴───────────────────┘ +``` + +-OrDefault y -OrNull se pueden combinar con otros combinadores. Es útil cuando la función de agregado no acepta la entrada vacía. + +``` sql +SELECT avgOrNullIf(x, x > 10) +FROM +( + SELECT toDecimal32(1.23, 2) AS x +) +``` + +``` text +┌─avgOrNullIf(x, greater(x, 10))─┐ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────┘ +``` + +## -Remuestrear {#agg-functions-combinator-resample} + +Permite dividir los datos en grupos y, a continuación, agregar por separado los datos de esos grupos. Los grupos se crean dividiendo los valores de una columna en intervalos. + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**Parámetros** + +- `start` — Starting value of the whole required interval for `resampling_key` valor. +- `stop` — Ending value of the whole required interval for `resampling_key` valor. Todo el intervalo no incluye el `stop` valor `[start, stop)`. +- `step` — Step for separating the whole interval into subintervals. The `aggFunction` se ejecuta sobre cada uno de esos subintervalos de forma independiente. +- `resampling_key` — Column whose values are used for separating data into intervals. +- `aggFunction_params` — `aggFunction` parámetros. + +**Valores devueltos** + +- Matriz de `aggFunction` resultados para cada subintervalo. + +**Ejemplo** + +Considere el `people` con los siguientes datos: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +Obtengamos los nombres de las personas cuya edad se encuentra en los intervalos de `[30,60)` y `[60,75)`. Como usamos la representación entera para la edad, obtenemos edades en el `[30, 59]` y `[60,74]` intervalo. + +Para agregar nombres en una matriz, usamos el [Método de codificación de datos:](reference.md#agg_function-grouparray) función de agregado. Se necesita un argumento. En nuestro caso, es el `name` columna. El `groupArrayResample` función debe utilizar el `age` columna para agregar nombres por edad. Para definir los intervalos requeridos, pasamos el `30, 75, 30` discusiones sobre el `groupArrayResample` función. + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) FROM people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +Considera los resultados. + +`Jonh` est? fuera de la muestra porque es demasiado joven. Otras personas se distribuyen de acuerdo con los intervalos de edad especificados. + +Ahora vamos a contar el número total de personas y su salario promedio en los intervalos de edad especificados. + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/es/sql-reference/aggregate-functions/index.md b/docs/es/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..c944330e9d4 --- /dev/null +++ b/docs/es/sql-reference/aggregate-functions/index.md @@ -0,0 +1,62 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Aggregate Functions +toc_priority: 33 +toc_title: "Implantaci\xF3n" +--- + +# Funciones Agregadas {#aggregate-functions} + +Las funciones agregadas funcionan en el [normal](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) forma esperada por los expertos en bases de datos. + +ClickHouse también es compatible: + +- [Funciones agregadas paramétricas](parametric-functions.md#aggregate_functions_parametric) que aceptan otros parámetros además de las columnas. +- [Combinadores](combinators.md#aggregate_functions_combinators), que cambian el comportamiento de las funciones agregadas. + +## Procesamiento NULL {#null-processing} + +Durante la agregación, todos `NULL`s se omiten. + +**Ejemplos:** + +Considere esta tabla: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +Digamos que necesita sumar los valores en el `y` columna: + +``` sql +SELECT sum(y) FROM t_null_big +``` + + ┌─sum(y)─┐ + │ 7 │ + └────────┘ + +El `sum` función interpreta `NULL` como `0`. En particular, esto significa que si la función recibe la entrada de una selección donde todos los valores son `NULL`, entonces el resultado será `0`, ni `NULL`. + +Ahora puedes usar el `groupArray` función para crear una matriz a partir de la `y` columna: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` no incluye `NULL` en la matriz resultante. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/es/sql-reference/aggregate-functions/parametric-functions.md b/docs/es/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..4b9a695f119 --- /dev/null +++ b/docs/es/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,499 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 38 +toc_title: "Funciones agregadas param\xE9tricas" +--- + +# Funciones Agregadas paramétricas {#aggregate_functions_parametric} + +Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. + +## histograma {#histogram} + +Calcula un histograma adaptativo. No garantiza resultados precisos. + +``` sql +histogram(number_of_bins)(values) +``` + +Las funciones utiliza [Un algoritmo de árbol de decisión paralelo de transmisión](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Los bordes de los contenedores de histograma se ajustan a medida que los nuevos datos entran en una función. En caso común, los anchos de los contenedores no son iguales. + +**Parámetros** + +`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. +`values` — [Expresion](../syntax.md#syntax-expressions) resultando en valores de entrada. + +**Valores devueltos** + +- [Matriz](../../sql-reference/data-types/array.md) de [Tuples](../../sql-reference/data-types/tuple.md) del siguiente formato: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — Lower bound of the bin. + - `upper` — Upper bound of the bin. + - `height` — Calculated height of the bin. + +**Ejemplo** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +Puede visualizar un histograma con el [Bar](../../sql-reference/functions/other-functions.md#function-bar) función, por ejemplo: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +En este caso, debe recordar que no conoce los bordes del contenedor del histograma. + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +Comprueba si la secuencia contiene una cadena de eventos que coincida con el patrón. + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "Advertencia" + Los eventos que ocurren en el mismo segundo pueden estar en la secuencia en un orden indefinido que afecta el resultado. + +**Parámetros** + +- `pattern` — Pattern string. See [Sintaxis de patrón](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` y `DateTime`. También puede utilizar cualquiera de los [UInt](../../sql-reference/data-types/int-uint.md) tipos de datos. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Puede pasar hasta 32 argumentos de condición. La función sólo tiene en cuenta los eventos descritos en estas condiciones. Si la secuencia contiene datos que no se describen en una condición, la función los omite. + +**Valores devueltos** + +- 1, si el patrón coincide. +- 0, si el patrón no coincide. + +Tipo: `UInt8`. + + +**Sintaxis de patrón** + +- `(?N)` — Matches the condition argument at position `N`. Las condiciones están numeradas en el `[1, 32]` gama. Por ejemplo, `(?1)` coincide con el argumento pasado al `cond1` parámetro. + +- `.*` — Matches any number of events. You don’t need conditional arguments to match this element of the pattern. + +- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` coincide con los eventos que ocurren a más de 1800 segundos el uno del otro. Un número arbitrario de cualquier evento puede estar entre estos eventos. Puede usar el `>=`, `>`, `<`, `<=` operador. + +**Ejemplos** + +Considere los datos en el `t` tabla: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +Realizar la consulta: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +La función encontró la cadena de eventos donde el número 2 sigue al número 1. Se saltó el número 3 entre ellos, porque el número no se describe como un evento. Si queremos tener en cuenta este número al buscar la cadena de eventos dada en el ejemplo, debemos establecer una condición para ello. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +En este caso, la función no pudo encontrar la cadena de eventos que coincida con el patrón, porque el evento para el número 3 ocurrió entre 1 y 2. Si en el mismo caso comprobamos la condición para el número 4, la secuencia coincidiría con el patrón. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Ver también** + +- [sequenceCount](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +Cuenta el número de cadenas de eventos que coinciden con el patrón. La función busca cadenas de eventos que no se superponen. Comienza a buscar la siguiente cadena después de que se haga coincidir la cadena actual. + +!!! warning "Advertencia" + Los eventos que ocurren en el mismo segundo pueden estar en la secuencia en un orden indefinido que afecta el resultado. + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**Parámetros** + +- `pattern` — Pattern string. See [Sintaxis de patrón](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` y `DateTime`. También puede utilizar cualquiera de los [UInt](../../sql-reference/data-types/int-uint.md) tipos de datos. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Puede pasar hasta 32 argumentos de condición. La función sólo tiene en cuenta los eventos descritos en estas condiciones. Si la secuencia contiene datos que no se describen en una condición, la función los omite. + +**Valores devueltos** + +- Número de cadenas de eventos no superpuestas que coinciden. + +Tipo: `UInt64`. + +**Ejemplo** + +Considere los datos en el `t` tabla: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +Cuente cuántas veces ocurre el número 2 después del número 1 con cualquier cantidad de otros números entre ellos: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**Ver también** + +- [sequenceMatch](#function-sequencematch) + +## ventanaEmbudo {#windowfunnel} + +Busca cadenas de eventos en una ventana de tiempo deslizante y calcula el número máximo de eventos que ocurrieron desde la cadena. + +La función funciona de acuerdo con el algoritmo: + +- La función busca datos que desencadenan la primera condición en la cadena y establece el contador de eventos en 1. Este es el momento en que comienza la ventana deslizante. + +- Si los eventos de la cadena ocurren secuencialmente dentro de la ventana, el contador se incrementa. Si se interrumpe la secuencia de eventos, el contador no se incrementa. + +- Si los datos tienen varias cadenas de eventos en diferentes puntos de finalización, la función solo generará el tamaño de la cadena más larga. + +**Sintaxis** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**Parámetros** + +- `window` — Length of the sliding window in seconds. +- `mode` - Es un argumento opcional. + - `'strict'` - Cuando el `'strict'` se establece, windowFunnel() aplica condiciones solo para los valores únicos. +- `timestamp` — Name of the column containing the timestamp. Data types supported: [Fecha](../../sql-reference/data-types/date.md), [FechaHora](../../sql-reference/data-types/datetime.md#data_type-datetime) y otros tipos de enteros sin signo (tenga en cuenta que aunque timestamp admite el `UInt64` tipo, su valor no puede exceder el máximo de Int64, que es 2 ^ 63 - 1). +- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valor devuelto** + +El número máximo de condiciones desencadenadas consecutivas de la cadena dentro de la ventana de tiempo deslizante. +Se analizan todas las cadenas en la selección. + +Tipo: `Integer`. + +**Ejemplo** + +Determine si un período de tiempo establecido es suficiente para que el usuario seleccione un teléfono y lo compre dos veces en la tienda en línea. + +Establezca la siguiente cadena de eventos: + +1. El usuario inició sesión en su cuenta en la tienda (`eventID = 1003`). +2. El usuario busca un teléfono (`eventID = 1007, product = 'phone'`). +3. El usuario realizó un pedido (`eventID = 1009`). +4. El usuario volvió a realizar el pedido (`eventID = 1010`). + +Tabla de entrada: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +Averigüe hasta qué punto el usuario `user_id` podría atravesar la cadena en un período de enero a febrero de 2019. + +Consulta: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +Resultado: + +``` text +┌─level─┬─c─┐ +│ 4 │ 1 │ +└───────┴───┘ +``` + +## retención {#retention} + +La función toma como argumentos un conjunto de condiciones de 1 a 32 argumentos de tipo `UInt8` que indican si se cumplió una determinada condición para el evento. +Cualquier condición se puede especificar como un argumento (como en [WHERE](../../sql-reference/statements/select.md#select-where)). + +Las condiciones, excepto la primera, se aplican en pares: el resultado del segundo será verdadero si el primero y el segundo son verdaderos, del tercero si el primero y el fird son verdaderos, etc. + +**Sintaxis** + +``` sql +retention(cond1, cond2, ..., cond32); +``` + +**Parámetros** + +- `cond` — an expression that returns a `UInt8` resultado (1 o 0). + +**Valor devuelto** + +La matriz de 1 o 0. + +- 1 — condition was met for the event. +- 0 — condition wasn’t met for the event. + +Tipo: `UInt8`. + +**Ejemplo** + +Consideremos un ejemplo de cálculo del `retention` función para determinar el tráfico del sitio. + +**1.** Сreate a table to illustrate an example. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +Tabla de entrada: + +Consulta: + +``` sql +SELECT * FROM retention_test +``` + +Resultado: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** Agrupar usuarios por ID único `uid` utilizando el `retention` función. + +Consulta: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +Resultado: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** Calcule el número total de visitas al sitio por día. + +Consulta: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +Resultado: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +Donde: + +- `r1`- el número de visitantes únicos que visitaron el sitio durante 2020-01-01 (la `cond1` condición). +- `r2`- el número de visitantes únicos que visitaron el sitio durante un período de tiempo específico entre 2020-01-01 y 2020-01-02 (`cond1` y `cond2` condición). +- `r3`- el número de visitantes únicos que visitaron el sitio durante un período de tiempo específico entre 2020-01-01 y 2020-01-03 (`cond1` y `cond3` condición). + +## UniqUpTo(N)(x) {#uniquptonx} + +Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. + +Recomendado para usar con Ns pequeños, hasta 10. El valor máximo de N es 100. + +Para el estado de una función agregada, utiliza la cantidad de memoria igual a 1 + N \* el tamaño de un valor de bytes. +Para las cadenas, almacena un hash no criptográfico de 8 bytes. Es decir, el cálculo se aproxima a las cadenas. + +La función también funciona para varios argumentos. + +Funciona lo más rápido posible, excepto en los casos en que se usa un valor N grande y el número de valores únicos es ligeramente menor que N. + +Ejemplo de uso: + +``` text +Problem: Generate a report that shows only keywords that produced at least 5 unique users. +Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) + +## sumMapFiltered(keys\_to\_keep)(claves, valores) {#summapfilteredkeys-to-keepkeys-values} + +El mismo comportamiento que [sumMap](reference.md#agg_functions-summap) excepto que una matriz de claves se pasa como un parámetro. Esto puede ser especialmente útil cuando se trabaja con una alta cardinalidad de claves. diff --git a/docs/es/sql-reference/aggregate-functions/reference.md b/docs/es/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..6d65bc2a643 --- /dev/null +++ b/docs/es/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1837 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 36 +toc_title: Referencia +--- + +# Referencia De La función {#function-reference} + +## contar {#agg_function-count} + +Cuenta el número de filas o valores no NULL. + +ClickHouse admite las siguientes sintaxis para `count`: +- `count(expr)` o `COUNT(DISTINCT expr)`. +- `count()` o `COUNT(*)`. El `count()` la sintaxis es específica de ClickHouse. + +**Parámetros** + +La función puede tomar: + +- Cero de los parámetros. +- Una [expresion](../syntax.md#syntax-expressions). + +**Valor devuelto** + +- Si se llama a la función sin parámetros, cuenta el número de filas. +- Si el [expresion](../syntax.md#syntax-expressions) se pasa, entonces la función cuenta cuántas veces esta expresión devuelve no nula. Si la expresión devuelve un [NULL](../../sql-reference/data-types/nullable.md)-type valor, entonces el resultado de `count` no se queda `Nullable`. La función devuelve 0 si la expresión devuelta `NULL` para todas las filas. + +En ambos casos el tipo del valor devuelto es [UInt64](../../sql-reference/data-types/int-uint.md). + +**Detalles** + +ClickHouse soporta el `COUNT(DISTINCT ...)` sintaxis. El comportamiento de esta construcción depende del [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) configuración. Define cuál de las [uniq\*](#agg_function-uniq) se utiliza para realizar la operación. El valor predeterminado es el [uniqExact](#agg_function-uniqexact) función. + +El `SELECT count() FROM table` consulta no está optimizado, porque el número de entradas en la tabla no se almacena por separado. Elige una pequeña columna de la tabla y cuenta el número de valores en ella. + +**Ejemplos** + +Ejemplo 1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +Ejemplo 2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +Este ejemplo muestra que `count(DISTINCT num)` se realiza por el `uniqExact` función según el `count_distinct_implementation` valor de ajuste. + +## cualquiera (x) {#agg_function-any} + +Selecciona el primer valor encontrado. +La consulta se puede ejecutar en cualquier orden e incluso en un orden diferente cada vez, por lo que el resultado de esta función es indeterminado. +Para obtener un resultado determinado, puede usar el ‘min’ o ‘max’ función en lugar de ‘any’. + +En algunos casos, puede confiar en el orden de ejecución. Esto se aplica a los casos en que SELECT proviene de una subconsulta que usa ORDER BY. + +Cuando un `SELECT` consulta tiene el `GROUP BY` cláusula o al menos una función agregada, ClickHouse (en contraste con MySQL) requiere que todas las expresiones `SELECT`, `HAVING`, y `ORDER BY` las cláusulas pueden calcularse a partir de claves o de funciones agregadas. En otras palabras, cada columna seleccionada de la tabla debe usarse en claves o dentro de funciones agregadas. Para obtener un comportamiento como en MySQL, puede colocar las otras columnas en el `any` función de agregado. + +## Cualquier Pesado (x) {#anyheavyx} + +Selecciona un valor que ocurre con frecuencia [pesos pesados](http://www.cs.umd.edu/~samir/498/karp.pdf) algoritmo. Si hay un valor que se produce más de la mitad de los casos en cada uno de los subprocesos de ejecución de la consulta, se devuelve este valor. Normalmente, el resultado es no determinista. + +``` sql +anyHeavy(column) +``` + +**Argumento** + +- `column` – The column name. + +**Ejemplo** + +Tome el [A tiempo](../../getting-started/example-datasets/ontime.md) conjunto de datos y seleccione cualquier valor que ocurra con frecuencia `AirlineID` columna. + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## Cualquier último (x) {#anylastx} + +Selecciona el último valor encontrado. +El resultado es tan indeterminado como para el `any` función. + +## Método De codificación De Datos: {#groupbitand} + +Se aplica bit a bit `AND` para la serie de números. + +``` sql +groupBitAnd(expr) +``` + +**Parámetros** + +`expr` – An expression that results in `UInt*` tipo. + +**Valor de retorno** + +Valor de la `UInt*` tipo. + +**Ejemplo** + +Datos de prueba: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Consulta: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +Donde `num` es la columna con los datos de prueba. + +Resultado: + +``` text +binary decimal +00000100 = 4 +``` + +## GrupoBitO {#groupbitor} + +Se aplica bit a bit `OR` para la serie de números. + +``` sql +groupBitOr(expr) +``` + +**Parámetros** + +`expr` – An expression that results in `UInt*` tipo. + +**Valor de retorno** + +Valor de la `UInt*` tipo. + +**Ejemplo** + +Datos de prueba: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Consulta: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +Donde `num` es la columna con los datos de prueba. + +Resultado: + +``` text +binary decimal +01111101 = 125 +``` + +## GrupoBitXor {#groupbitxor} + +Se aplica bit a bit `XOR` para la serie de números. + +``` sql +groupBitXor(expr) +``` + +**Parámetros** + +`expr` – An expression that results in `UInt*` tipo. + +**Valor de retorno** + +Valor de la `UInt*` tipo. + +**Ejemplo** + +Datos de prueba: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Consulta: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +Donde `num` es la columna con los datos de prueba. + +Resultado: + +``` text +binary decimal +01101000 = 104 +``` + +## Método De codificación De Datos: {#groupbitmap} + +Mapa de bits o cálculos agregados de una columna entera sin signo, devuelve cardinalidad de tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmap(expr) +``` + +**Parámetros** + +`expr` – An expression that results in `UInt*` tipo. + +**Valor de retorno** + +Valor de la `UInt64` tipo. + +**Ejemplo** + +Datos de prueba: + +``` text +UserID +1 +1 +2 +3 +``` + +Consulta: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +Resultado: + +``` text +num +3 +``` + +## Mínimo (x) {#agg_function-min} + +Calcula el mínimo. + +## máximo (x) {#agg_function-max} + +Calcula el máximo. + +## ¿Cómo puedo hacerlo?) {#agg-function-argmin} + +Calcula el ‘arg’ para un valor mínimo ‘val’ valor. Si hay varios valores diferentes de ‘arg’ para valores mínimos de ‘val’, el primero de estos valores encontrados es la salida. + +**Ejemplo:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## Descripción) {#agg-function-argmax} + +Calcula el ‘arg’ para un valor máximo ‘val’ valor. Si hay varios valores diferentes de ‘arg’ para valores máximos de ‘val’, el primero de estos valores encontrados es la salida. + +## suma (x) {#agg_function-sum} + +Calcula la suma. +Solo funciona para números. + +## ¿Cómo puedo obtener más información?) {#sumwithoverflowx} + +Calcula la suma de los números, utilizando el mismo tipo de datos para el resultado que para los parámetros de entrada. Si la suma supera el valor máximo para este tipo de datos, la función devuelve un error. + +Solo funciona para números. + +## sumMap(clave, valor) {#agg_functions-summap} + +Totals el ‘value’ matriz de acuerdo con las claves especificadas en el ‘key’ matriz. +El número de elementos en ‘key’ y ‘value’ debe ser el mismo para cada fila que se sume. +Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. + +Ejemplo: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┘ +``` + +## SkewPop {#skewpop} + +Calcula el [la asimetría](https://en.wikipedia.org/wiki/Skewness) de una secuencia. + +``` sql +skewPop(expr) +``` + +**Parámetros** + +`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. + +**Valor devuelto** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Ejemplo** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## Sistema Abierto {#skewsamp} + +Calcula el [asimetría de la muestra](https://en.wikipedia.org/wiki/Skewness) de una secuencia. + +Representa una estimación imparcial de la asimetría de una variable aleatoria si los valores pasados forman su muestra. + +``` sql +skewSamp(expr) +``` + +**Parámetros** + +`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. + +**Valor devuelto** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). Si `n <= 1` (`n` es el tamaño de la muestra), luego la función devuelve `nan`. + +**Ejemplo** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## KurtPop {#kurtpop} + +Calcula el [curtosis](https://en.wikipedia.org/wiki/Kurtosis) de una secuencia. + +``` sql +kurtPop(expr) +``` + +**Parámetros** + +`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. + +**Valor devuelto** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Ejemplo** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## KurtSamp {#kurtsamp} + +Calcula el [curtosis muestra](https://en.wikipedia.org/wiki/Kurtosis) de una secuencia. + +Representa una estimación imparcial de la curtosis de una variable aleatoria si los valores pasados forman su muestra. + +``` sql +kurtSamp(expr) +``` + +**Parámetros** + +`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. + +**Valor devuelto** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). Si `n <= 1` (`n` es un tamaño de la muestra), luego la función devuelve `nan`. + +**Ejemplo** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## Para Obtener más información, Consulta Nuestra Política De Privacidad y Nuestras Condiciones De Uso) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` puede agregar diferentes series de tiempo que muestran la marca de tiempo no la alineación. +Utilizará la interpolación lineal entre dos marcas de tiempo de muestra y luego sumará series temporales juntas. + +- `uid` es la identificación única de la serie temporal, `UInt64`. +- `timestamp` es el tipo Int64 para admitir milisegundos o microsegundos. +- `value` es la métrica. + +La función devuelve una matriz de tuplas con `(timestamp, aggregated_value)` par. + +Antes de utilizar esta función, asegúrese de `timestamp` está en orden ascendente. + +Ejemplo: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +Y el resultado será: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## También Puede Utilizar El Siguiente Ejemplo:) {#agg-function-timeseriesgroupratesum} + +Del mismo modo timeSeriesGroupRateSum, timeSeriesGroupRateSum calculará la tasa de series temporales y luego sumará las tasas juntas. +Además, la marca de tiempo debe estar en orden ascendente antes de usar esta función. + +Use esta función, el resultado anterior será: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## Acerca De) {#agg_function-avg} + +Calcula el promedio. +Solo funciona para números. +El resultado es siempre Float64. + +## uniq {#agg_function-uniq} + +Calcula el número aproximado de diferentes valores del argumento. + +``` sql +uniq(x[, ...]) +``` + +**Parámetros** + +La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. + +**Valor devuelto** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-tipo número. + +**Detalles de implementación** + +Función: + +- Calcula un hash para todos los parámetros en el agregado, luego lo usa en los cálculos. + +- Utiliza un algoritmo de muestreo adaptativo. Para el estado de cálculo, la función utiliza una muestra de valores hash de elemento de hasta 65536. + + This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. + +- Proporciona el resultado de forma determinista (no depende del orden de procesamiento de la consulta). + +Recomendamos usar esta función en casi todos los escenarios. + +**Ver también** + +- [uniqCombined](#agg_function-uniqcombined) +- [UniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined {#agg_function-uniqcombined} + +Calcula el número aproximado de diferentes valores de argumento. + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +El `uniqCombined` es una buena opción para calcular el número de valores diferentes. + +**Parámetros** + +La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. + +`HLL_precision` es el logaritmo base-2 del número de células en [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). Opcional, puede utilizar la función como `uniqCombined(x[, ...])`. El valor predeterminado para `HLL_precision` es 17, que es efectivamente 96 KiB de espacio (2 ^ 17 celdas, 6 bits cada una). + +**Valor devuelto** + +- Un número [UInt64](../../sql-reference/data-types/int-uint.md)-tipo número. + +**Detalles de implementación** + +Función: + +- Calcula un hash (hash de 64 bits para `String` y 32 bits de lo contrario) para todos los parámetros en el agregado, luego lo usa en los cálculos. + +- Utiliza una combinación de tres algoritmos: matriz, tabla hash e HyperLogLog con una tabla de corrección de errores. + + For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. + +- Proporciona el resultado de forma determinista (no depende del orden de procesamiento de la consulta). + +!!! note "Nota" + Dado que usa hash de 32 bits para no-`String` tipo, el resultado tendrá un error muy alto para cardinalidades significativamente mayores que `UINT_MAX` (el error aumentará rápidamente después de unas pocas decenas de miles de millones de valores distintos), por lo tanto, en este caso debe usar [UniqCombined64](#agg_function-uniqcombined64) + +En comparación con el [uniq](#agg_function-uniq) función, el `uniqCombined`: + +- Consume varias veces menos memoria. +- Calcula con una precisión varias veces mayor. +- Por lo general, tiene un rendimiento ligeramente menor. En algunos escenarios, `uniqCombined` puede funcionar mejor que `uniq`, por ejemplo, con consultas distribuidas que transmiten un gran número de estados de agregación a través de la red. + +**Ver también** + +- [uniq](#agg_function-uniq) +- [UniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## UniqCombined64 {#agg_function-uniqcombined64} + +Lo mismo que [uniqCombined](#agg_function-uniqcombined), pero utiliza hash de 64 bits para todos los tipos de datos. + +## uniqHLL12 {#agg_function-uniqhll12} + +Calcula el número aproximado de diferentes valores de argumento [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) algoritmo. + +``` sql +uniqHLL12(x[, ...]) +``` + +**Parámetros** + +La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. + +**Valor devuelto** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-tipo número. + +**Detalles de implementación** + +Función: + +- Calcula un hash para todos los parámetros en el agregado, luego lo usa en los cálculos. + +- Utiliza el algoritmo HyperLogLog para aproximar el número de valores de argumento diferentes. + + 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). + +- Proporciona el resultado determinado (no depende del orden de procesamiento de la consulta). + +No recomendamos usar esta función. En la mayoría de los casos, use el [uniq](#agg_function-uniq) o [uniqCombined](#agg_function-uniqcombined) función. + +**Ver también** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqExact](#agg_function-uniqexact) + +## uniqExact {#agg_function-uniqexact} + +Calcula el número exacto de diferentes valores de argumento. + +``` sql +uniqExact(x[, ...]) +``` + +Utilice el `uniqExact` función si necesita absolutamente un resultado exacto. De lo contrario, use el [uniq](#agg_function-uniq) función. + +El `uniqExact` función utiliza más memoria que `uniq`, porque el tamaño del estado tiene un crecimiento ilimitado a medida que aumenta el número de valores diferentes. + +**Parámetros** + +La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. + +**Ver también** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqHLL12](#agg_function-uniqhll12) + +## ¿Cómo puedo hacerlo?) {#agg_function-grouparray} + +Crea una matriz de valores de argumento. +Los valores se pueden agregar a la matriz en cualquier orden (indeterminado). + +La segunda versión (con el `max_size` parámetro) limita el tamaño de la matriz resultante a `max_size` elemento. +Por ejemplo, `groupArray (1) (x)` es equivalente a `[any (x)]`. + +En algunos casos, aún puede confiar en el orden de ejecución. Esto se aplica a los casos en que `SELECT` procede de una subconsulta que utiliza `ORDER BY`. + +## Para Obtener más información, Consulte El Siguiente Enlace:) {#grouparrayinsertatvalue-position} + +Inserta un valor en la matriz en la posición especificada. + +!!! note "Nota" + Esta función utiliza posiciones de base cero, contrariamente a las posiciones de base única convencionales para matrices SQL. + +Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. + +Parámetros opcionales: + +- El valor predeterminado para sustituir en posiciones vacías. +- La longitud de la matriz resultante. Esto le permite recibir matrices del mismo tamaño para todas las claves agregadas. Al utilizar este parámetro, se debe especificar el valor predeterminado. + +## groupArrayMovingSum {#agg_function-grouparraymovingsum} + +Calcula la suma móvil de los valores de entrada. + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +La función puede tomar el tamaño de la ventana como un parámetro. Si no se especifica, la función toma el tamaño de ventana igual al número de filas de la columna. + +**Parámetros** + +- `numbers_for_summing` — [Expresion](../syntax.md#syntax-expressions) dando como resultado un valor de tipo de datos numérico. +- `window_size` — Size of the calculation window. + +**Valores devueltos** + +- Matriz del mismo tamaño y tipo que los datos de entrada. + +**Ejemplo** + +La tabla de ejemplo: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Consulta: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## Método De codificación De Datos: {#agg_function-grouparraymovingavg} + +Calcula la media móvil de los valores de entrada. + +``` sql +groupArrayMovingAvg(numbers_for_summing) +groupArrayMovingAvg(window_size)(numbers_for_summing) +``` + +La función puede tomar el tamaño de la ventana como un parámetro. Si no se especifica, la función toma el tamaño de ventana igual al número de filas de la columna. + +**Parámetros** + +- `numbers_for_summing` — [Expresion](../syntax.md#syntax-expressions) dando como resultado un valor de tipo de datos numérico. +- `window_size` — Size of the calculation window. + +**Valores devueltos** + +- Matriz del mismo tamaño y tipo que los datos de entrada. + +La función utiliza [redondeando hacia cero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). Trunca los decimales insignificantes para el tipo de datos resultante. + +**Ejemplo** + +La tabla de ejemplo `b`: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Consulta: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## ¿Cómo puedo obtener más información?) {#groupuniqarrayx-groupuniqarraymax-sizex} + +Crea una matriz a partir de diferentes valores de argumento. El consumo de memoria es el mismo que para el `uniqExact` función. + +La segunda versión (con el `max_size` parámetro) limita el tamaño de la matriz resultante a `max_size` elemento. +Por ejemplo, `groupUniqArray(1)(x)` es equivalente a `[any(x)]`. + +## cuantil {#quantile} + +Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. + +Esta función se aplica [muestreo de embalses](https://en.wikipedia.org/wiki/Reservoir_sampling) con un tamaño de depósito de hasta 8192 y un generador de números aleatorios para el muestreo. El resultado es no determinista. Para obtener un cuantil exacto, use el [quantileExact](#quantileexact) función. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantile(level)(expr) +``` + +Apodo: `median`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql-reference/data-types/index.md#data_types), [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). + +**Valor devuelto** + +- Cuantil aproximado del nivel especificado. + +Tipo: + +- [Float64](../../sql-reference/data-types/float.md) para la entrada de tipo de datos numéricos. +- [Fecha](../../sql-reference/data-types/date.md) si los valores de entrada tienen `Date` tipo. +- [FechaHora](../../sql-reference/data-types/datetime.md) si los valores de entrada tienen `DateTime` tipo. + +**Ejemplo** + +Tabla de entrada: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Consulta: + +``` sql +SELECT quantile(val) FROM t +``` + +Resultado: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## quantileDeterminista {#quantiledeterministic} + +Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. + +Esta función se aplica [muestreo de embalses](https://en.wikipedia.org/wiki/Reservoir_sampling) con un tamaño de depósito de hasta 8192 y algoritmo determinista de muestreo. El resultado es determinista. Para obtener un cuantil exacto, use el [quantileExact](#quantileexact) función. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +Apodo: `medianDeterministic`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql-reference/data-types/index.md#data_types), [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). +- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. + +**Valor devuelto** + +- Aproximado cuantil del nivel especificado. + +Tipo: + +- [Float64](../../sql-reference/data-types/float.md) para el tipo de datos numérico de entrada. +- [Fecha](../../sql-reference/data-types/date.md) si los valores de entrada tienen `Date` tipo. +- [FechaHora](../../sql-reference/data-types/datetime.md) si los valores de entrada tienen `DateTime` tipo. + +**Ejemplo** + +Tabla de entrada: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Consulta: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +Resultado: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## quantileExact {#quantileexact} + +Calcula exactamente el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` memoria, donde `n` es un número de valores que se pasaron. Sin embargo, para un pequeño número de valores, la función es muy efectiva. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantileExact(level)(expr) +``` + +Apodo: `medianExact`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql-reference/data-types/index.md#data_types), [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). + +**Valor devuelto** + +- Cuantil del nivel especificado. + +Tipo: + +- [Float64](../../sql-reference/data-types/float.md) para el tipo de datos numérico de entrada. +- [Fecha](../../sql-reference/data-types/date.md) si los valores de entrada tienen `Date` tipo. +- [FechaHora](../../sql-reference/data-types/datetime.md) si los valores de entrada tienen `DateTime` tipo. + +**Ejemplo** + +Consulta: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +Resultado: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## quantileExactWeighted {#quantileexactweighted} + +Calcula exactamente el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos, teniendo en cuenta el peso de cada elemento. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). Puede usar esta función en lugar de `quantileExact` y especifique el peso 1. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +Apodo: `medianExactWeighted`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql-reference/data-types/index.md#data_types), [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. + +**Valor devuelto** + +- Cuantil del nivel especificado. + +Tipo: + +- [Float64](../../sql-reference/data-types/float.md) para la entrada de tipo de datos numéricos. +- [Fecha](../../sql-reference/data-types/date.md) si los valores de entrada tienen `Date` tipo. +- [FechaHora](../../sql-reference/data-types/datetime.md) si los valores de entrada tienen `DateTime` tipo. + +**Ejemplo** + +Tabla de entrada: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +Consulta: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +Resultado: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## quantileTiming {#quantiletiming} + +Con la precisión determinada calcula el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. + +El resultado es determinista (no depende del orden de procesamiento de la consulta). La función está optimizada para trabajar con secuencias que describen distribuciones como tiempos de carga de páginas web o tiempos de respuesta de back-end. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantileTiming(level)(expr) +``` + +Apodo: `medianTiming`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). + +- `expr` — [Expresion](../syntax.md#syntax-expressions) sobre una columna valores que devuelven un [Flotante\*](../../sql-reference/data-types/float.md)-tipo número. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +**Exactitud** + +El cálculo es preciso si: + +- El número total de valores no supera los 5670. +- El número total de valores supera los 5670, pero el tiempo de carga de la página es inferior a 1024 ms. + +De lo contrario, el resultado del cálculo se redondea al múltiplo más cercano de 16 ms. + +!!! note "Nota" + Para calcular los cuantiles de tiempo de carga de la página, esta función es más efectiva y precisa que [cuantil](#quantile). + +**Valor devuelto** + +- Cuantil del nivel especificado. + +Tipo: `Float32`. + +!!! note "Nota" + Si no se pasan valores a la función (cuando se `quantileTimingIf`), [NaN](../../sql-reference/data-types/float.md#data_type-float-nan-inf) se devuelve. El propósito de esto es diferenciar estos casos de los casos que resultan en cero. Ver [ORDER BY cláusula](../statements/select.md#select-order-by) para notas sobre la clasificación `NaN` valor. + +**Ejemplo** + +Tabla de entrada: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +Consulta: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +Resultado: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## quantileTimingWeighted {#quantiletimingweighted} + +Con la precisión determinada calcula el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos según el peso de cada miembro de secuencia. + +El resultado es determinista (no depende del orden de procesamiento de la consulta). La función está optimizada para trabajar con secuencias que describen distribuciones como tiempos de carga de páginas web o tiempos de respuesta de back-end. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +Apodo: `medianTimingWeighted`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). + +- `expr` — [Expresion](../syntax.md#syntax-expressions) sobre una columna valores que devuelven un [Flotante\*](../../sql-reference/data-types/float.md)-tipo número. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Exactitud** + +El cálculo es preciso si: + +- El número total de valores no supera los 5670. +- El número total de valores supera los 5670, pero el tiempo de carga de la página es inferior a 1024 ms. + +De lo contrario, el resultado del cálculo se redondea al múltiplo más cercano de 16 ms. + +!!! note "Nota" + Para calcular los cuantiles de tiempo de carga de la página, esta función es más efectiva y precisa que [cuantil](#quantile). + +**Valor devuelto** + +- Cuantil del nivel especificado. + +Tipo: `Float32`. + +!!! note "Nota" + Si no se pasan valores a la función (cuando se `quantileTimingIf`), [NaN](../../sql-reference/data-types/float.md#data_type-float-nan-inf) se devuelve. El propósito de esto es diferenciar estos casos de los casos que resultan en cero. Ver [ORDER BY cláusula](../statements/select.md#select-order-by) para notas sobre la clasificación `NaN` valor. + +**Ejemplo** + +Tabla de entrada: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +Consulta: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +Resultado: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## quantileTDigest {#quantiletdigest} + +Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos usando el [T-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritmo. + +El error máximo es 1%. El consumo de memoria es `log(n)`, donde `n` es un número de valores. El resultado depende del orden de ejecución de la consulta y no es determinista. + +El rendimiento de la función es menor que el rendimiento de [cuantil](#quantile) o [quantileTiming](#quantiletiming). En términos de la relación entre el tamaño del estado y la precisión, esta función es mucho mejor que `quantile`. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantileTDigest(level)(expr) +``` + +Apodo: `medianTDigest`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql-reference/data-types/index.md#data_types), [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). + +**Valor devuelto** + +- Cuantil aproximado del nivel especificado. + +Tipo: + +- [Float64](../../sql-reference/data-types/float.md) para la entrada de tipo de datos numéricos. +- [Fecha](../../sql-reference/data-types/date.md) si los valores de entrada tienen `Date` tipo. +- [FechaHora](../../sql-reference/data-types/datetime.md) si los valores de entrada tienen `DateTime` tipo. + +**Ejemplo** + +Consulta: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +Resultado: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## quantileTDigestWeighted {#quantiletdigestweighted} + +Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos usando el [T-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritmo. La función tiene en cuenta el peso de cada miembro de secuencia. El error máximo es 1%. El consumo de memoria es `log(n)`, donde `n` es un número de valores. + +El rendimiento de la función es menor que el rendimiento de [cuantil](#quantile) o [quantileTiming](#quantiletiming). En términos de la relación entre el tamaño del estado y la precisión, esta función es mucho mejor que `quantile`. + +El resultado depende del orden de ejecución de la consulta y no es determinista. + +Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. + +**Sintaxis** + +``` sql +quantileTDigest(level)(expr) +``` + +Apodo: `medianTDigest`. + +**Parámetros** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql-reference/data-types/index.md#data_types), [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Valor devuelto** + +- Cuantil aproximado del nivel especificado. + +Tipo: + +- [Float64](../../sql-reference/data-types/float.md) para la entrada de tipo de datos numéricos. +- [Fecha](../../sql-reference/data-types/date.md) si los valores de entrada tienen `Date` tipo. +- [FechaHora](../../sql-reference/data-types/datetime.md) si los valores de entrada tienen `DateTime` tipo. + +**Ejemplo** + +Consulta: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +Resultado: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**Ver también** + +- [mediana](#median) +- [cantiles](#quantiles) + +## mediana {#median} + +El `median*` funciones son los alias para el `quantile*` función. Calculan la mediana de una muestra de datos numéricos. + +Función: + +- `median` — Alias for [cuantil](#quantile). +- `medianDeterministic` — Alias for [quantileDeterminista](#quantiledeterministic). +- `medianExact` — Alias for [quantileExact](#quantileexact). +- `medianExactWeighted` — Alias for [quantileExactWeighted](#quantileexactweighted). +- `medianTiming` — Alias for [quantileTiming](#quantiletiming). +- `medianTimingWeighted` — Alias for [quantileTimingWeighted](#quantiletimingweighted). +- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). +- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). + +**Ejemplo** + +Tabla de entrada: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Consulta: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +Resultado: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +Todas las funciones de cuantiles también tienen funciones de cuantiles correspondientes: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Estas funciones calculan todos los cuantiles de los niveles enumerados en una sola pasada y devuelven una matriz de los valores resultantes. + +## Acerca De Nosotros) {#varsampx} + +Calcula la cantidad `Σ((x - x̅)^2) / (n - 1)`, donde `n` es el tamaño de la muestra y `x̅`es el valor promedio de `x`. + +Representa una estimación imparcial de la varianza de una variable aleatoria si los valores pasados forman su muestra. + +Devoluciones `Float64`. Cuando `n <= 1`, devoluciones `+∞`. + +## Nombre De La Red inalámbrica (SSID):) {#varpopx} + +Calcula la cantidad `Σ((x - x̅)^2) / n`, donde `n` es el tamaño de la muestra y `x̅`es el valor promedio de `x`. + +En otras palabras, dispersión para un conjunto de valores. Devoluciones `Float64`. + +## Soporte técnico) {#stddevsampx} + +El resultado es igual a la raíz cuadrada de `varSamp(x)`. + +## stddevPop(x) {#stddevpopx} + +El resultado es igual a la raíz cuadrada de `varPop(x)`. + +## topK(N)(x) {#topknx} + +Devuelve una matriz de los valores aproximadamente más frecuentes de la columna especificada. La matriz resultante se ordena en orden descendente de frecuencia aproximada de valores (no por los valores mismos). + +Implementa el [Ahorro de espacio filtrado](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) algoritmo para analizar TopK, basado en el algoritmo de reducción y combinación de [Ahorro de espacio paralelo](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +Esta función no proporciona un resultado garantizado. En ciertas situaciones, pueden producirse errores y pueden devolver valores frecuentes que no son los valores más frecuentes. + +Recomendamos usar el `N < 10` valor; el rendimiento se reduce con grandes `N` valor. Valor máximo de `N = 65536`. + +**Parámetros** + +- ‘N’ es el número de elementos a devolver. + +Si se omite el parámetro, se utiliza el valor predeterminado 10. + +**Argumento** + +- ’ x ’ – The value to calculate frequency. + +**Ejemplo** + +Tome el [A tiempo](../../getting-started/example-datasets/ontime.md) conjunto de datos y seleccione los tres valores más frecuentes `AirlineID` columna. + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## topKPeso {#topkweighted} + +Similar a `topK` pero toma un argumento adicional de tipo entero - `weight`. Cada valor se contabiliza `weight` veces para el cálculo de la frecuencia. + +**Sintaxis** + +``` sql +topKWeighted(N)(x, weight) +``` + +**Parámetros** + +- `N` — The number of elements to return. + +**Argumento** + +- `x` – The value. +- `weight` — The weight. [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valor devuelto** + +Devuelve una matriz de los valores con la suma aproximada máxima de pesos. + +**Ejemplo** + +Consulta: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +Resultado: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## covarSamp(x, y) {#covarsampx-y} + +Calcula el valor de `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +Devuelve Float64. Cuando `n <= 1`, returns +∞. + +## covarPop(x, y) {#covarpopx-y} + +Calcula el valor de `Σ((x - x̅)(y - y̅)) / n`. + +## corr(x, y) {#corrx-y} + +Calcula el coeficiente de correlación de Pearson: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## categoricalInformationValue {#categoricalinformationvalue} + +Calcula el valor de `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` para cada categoría. + +``` sql +categoricalInformationValue(category1, category2, ..., tag) +``` + +El resultado indica cómo una característica discreta (categórica `[category1, category2, ...]` contribuir a un modelo de aprendizaje que predice el valor de `tag`. + +## SimpleLinearRegression {#simplelinearregression} + +Realiza una regresión lineal simple (unidimensional). + +``` sql +simpleLinearRegression(x, y) +``` + +Parámetros: + +- `x` — Column with dependent variable values. +- `y` — Column with explanatory variable values. + +Valores devueltos: + +Constante `(a, b)` de la línea resultante `y = a*x + b`. + +**Ejemplos** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## stochasticLinearRegression {#agg_functions-stochasticlinearregression} + +Esta función implementa la regresión lineal estocástica. Admite parámetros personalizados para la tasa de aprendizaje, el coeficiente de regularización L2, el tamaño de mini lote y tiene pocos métodos para actualizar los pesos ([Adán](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (utilizado por defecto), [SGD simple](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Impulso](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### Parámetros {#agg_functions-stochasticlinearregression-parameters} + +Hay 4 parámetros personalizables. Se pasan a la función secuencialmente, pero no es necesario pasar los cuatro; se usarán valores predeterminados, sin embargo, un buen modelo requirió algún ajuste de parámetros. + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. `learning rate` es el coeficiente en la longitud del paso, cuando se realiza el paso de descenso de gradiente. Una tasa de aprendizaje demasiado grande puede causar pesos infinitos del modelo. El valor predeterminado es `0.00001`. +2. `l2 regularization coefficient` que puede ayudar a prevenir el sobreajuste. El valor predeterminado es `0.1`. +3. `mini-batch size` establece el número de elementos, cuyos gradientes se calcularán y sumarán para realizar un paso de descenso de gradiente. El descenso estocástico puro usa un elemento, sin embargo, tener lotes pequeños (aproximadamente 10 elementos) hace que los pasos de gradiente sean más estables. El valor predeterminado es `15`. +4. `method for updating weights`, son: `Adam` (predeterminada), `SGD`, `Momentum`, `Nesterov`. `Momentum` y `Nesterov` requieren un poco más de cálculos y memoria, sin embargo, resultan útiles en términos de velocidad de convergencia y estabilidad de los métodos de gradiente estocásticos. + +### Uso {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` se utiliza en dos pasos: ajustar el modelo y predecir nuevos datos. Para ajustar el modelo y guardar su estado para su uso posterior, utilizamos `-State` combinador, que básicamente guarda el estado (pesos del modelo, etc.). +Para predecir usamos la función [evalMLMethod](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod), que toma un estado como argumento, así como características para predecir. + + + +**1.** Accesorio + +Dicha consulta puede ser utilizada. + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +Aquí también tenemos que insertar datos en `train_data` tabla. El número de parámetros no es fijo, depende solo del número de argumentos, pasados a `linearRegressionState`. Todos deben ser valores numéricos. +Tenga en cuenta que la columna con valor objetivo (que nos gustaría aprender a predecir) se inserta como primer argumento. + +**2.** Predecir + +Después de guardar un estado en la tabla, podemos usarlo varias veces para la predicción, o incluso fusionarlo con otros estados y crear nuevos modelos aún mejores. + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +La consulta devolverá una columna de valores predichos. Tenga en cuenta que el primer argumento de `evalMLMethod` ser `AggregateFunctionState` objeto, siguiente son columnas de características. + +`test_data` es una mesa como `train_data` pero puede no contener el valor objetivo. + +### Nota {#agg_functions-stochasticlinearregression-notes} + +1. Para fusionar dos modelos, el usuario puede crear dicha consulta: + `sql SELECT state1 + state2 FROM your_models` + donde `your_models` la tabla contiene ambos modelos. Esta consulta devolverá un nuevo `AggregateFunctionState` objeto. + +2. El usuario puede obtener pesos del modelo creado para sus propios fines sin guardar el modelo si no `-State` combinador se utiliza. + `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` + Dicha consulta se ajustará al modelo y devolverá sus pesos: primero son los pesos, que corresponden a los parámetros del modelo, el último es el sesgo. Entonces, en el ejemplo anterior, la consulta devolverá una columna con 3 valores. + +**Ver también** + +- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) +- [Diferencia entre regresiones lineales y logísticas](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} + +Esta función implementa la regresión logística estocástica. Se puede usar para problemas de clasificación binaria, admite los mismos parámetros personalizados que stochasticLinearRegression y funciona de la misma manera. + +### Parámetros {#agg_functions-stochasticlogisticregression-parameters} + +Los parámetros son exactamente los mismos que en stochasticLinearRegression: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +Para obtener más información, consulte [parámetros](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. Accesorio + + + + See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. + + Predicted labels have to be in \[-1, 1\]. + +1. Predecir + + + + Using saved state we can predict probability of object having label `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + + The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + + We can also set a bound of probability, which assigns elements to different labels. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + + Then the result will be labels. + + `test_data` is a table like `train_data` but may not contain target value. + +**Ver también** + +- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) +- [Diferencia entre regresiones lineales y logísticas.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## Método De codificación De Datos: {#groupbitmapand} + +Calcula el AND de una columna de mapa de bits, devuelve la cardinalidad del tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapAnd(expr) +``` + +**Parámetros** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tipo. + +**Valor de retorno** + +Valor de la `UInt64` tipo. + +**Ejemplo** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapAnd(z)─┐ +│ 3 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ +│ [6,8,10] │ +└──────────────────────────────────────────────────┘ +``` + +## Método De codificación De Datos: {#groupbitmapor} + +Calcula el OR de una columna de mapa de bits, devuelve la cardinalidad del tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql-reference/functions/bitmap-functions.md). Esto es equivalente a `groupBitmapMerge`. + +``` sql +groupBitmapOr(expr) +``` + +**Parámetros** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tipo. + +**Valor de retorno** + +Valor de la `UInt64` tipo. + +**Ejemplo** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapOr(z)─┐ +│ 15 │ +└──────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ +│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ +└─────────────────────────────────────────────────┘ +``` + +## Método De codificación De Datos: {#groupbitmapxor} + +Calcula el XOR de una columna de mapa de bits, devuelve la cardinalidad del tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapOr(expr) +``` + +**Parámetros** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tipo. + +**Valor de retorno** + +Valor de la `UInt64` tipo. + +**Ejemplo** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapXor(z)─┐ +│ 10 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ +│ [1,3,5,6,8,10,11,13,14,15] │ +└──────────────────────────────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/es/sql-reference/ansi.md b/docs/es/sql-reference/ansi.md new file mode 120000 index 00000000000..3cf6bffed67 --- /dev/null +++ b/docs/es/sql-reference/ansi.md @@ -0,0 +1 @@ +../../en/sql-reference/ansi.md \ No newline at end of file diff --git a/docs/es/sql-reference/data-types/aggregatefunction.md b/docs/es/sql-reference/data-types/aggregatefunction.md new file mode 100644 index 00000000000..a55be5d4d3c --- /dev/null +++ b/docs/es/sql-reference/data-types/aggregatefunction.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 52 +toc_title: "Agregar funci\xF3n (nombre, types_of_arguments)...)" +--- + +# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [una vista materializada](../../sql-reference/statements/select.md#create-view). La forma común de producir un estado de función agregada es llamando a la función agregada con el `-State` sufijo. Para obtener el resultado final de la agregación en el futuro, debe utilizar la misma función de agregado con el `-Merge`sufijo. + +`AggregateFunction` — parametric data type. + +**Parámetros** + +- Nombre de la función de agregado. + + If the function is parametric, specify its parameters too. + +- Tipos de los argumentos de la función agregada. + +**Ejemplo** + +``` sql +CREATE TABLE t +( + column1 AggregateFunction(uniq, UInt64), + column2 AggregateFunction(anyIf, String, UInt8), + column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) +) ENGINE = ... +``` + +[uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq), anyIf ([cualquier](../../sql-reference/aggregate-functions/reference.md#agg_function-any)+[Si](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-if)) y [cantiles](../../sql-reference/aggregate-functions/reference.md) son las funciones agregadas admitidas en ClickHouse. + +## Uso {#usage} + +### Inserción De Datos {#data-insertion} + +Para insertar datos, utilice `INSERT SELECT` con agregado `-State`- función. + +**Ejemplos de funciones** + +``` sql +uniqState(UserID) +quantilesState(0.5, 0.9)(SendTiming) +``` + +En contraste con las funciones correspondientes `uniq` y `quantiles`, `-State`- funciones devuelven el estado, en lugar del valor final. En otras palabras, devuelven un valor de `AggregateFunction` tipo. + +En los resultados de `SELECT` consulta, los valores de `AggregateFunction` tipo tiene representación binaria específica de la implementación para todos los formatos de salida de ClickHouse. Si volcar datos en, por ejemplo, `TabSeparated` formato con `SELECT` consulta, entonces este volcado se puede cargar de nuevo usando `INSERT` consulta. + +### Selección De Datos {#data-selection} + +Al seleccionar datos de `AggregatingMergeTree` mesa, uso `GROUP BY` cláusula y las mismas funciones agregadas que al insertar datos, pero usando `-Merge`sufijo. + +Una función agregada con `-Merge` sufijo toma un conjunto de estados, los combina y devuelve el resultado de la agregación de datos completa. + +Por ejemplo, las siguientes dos consultas devuelven el mismo resultado: + +``` sql +SELECT uniq(UserID) FROM table + +SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) +``` + +## Ejemplo De Uso {#usage-example} + +Ver [AgregaciónMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) Descripción del motor. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/es/sql-reference/data-types/array.md b/docs/es/sql-reference/data-types/array.md new file mode 100644 index 00000000000..e93f8789401 --- /dev/null +++ b/docs/es/sql-reference/data-types/array.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 51 +toc_title: Matriz (T) +--- + +# Matriz (t) {#data-type-array} + +Una matriz de `T`-tipo de artículos. `T` puede ser cualquier tipo de datos, incluida una matriz. + +## Creación De Una Matriz {#creating-an-array} + +Puede usar una función para crear una matriz: + +``` sql +array(T) +``` + +También puede usar corchetes. + +``` sql +[] +``` + +Ejemplo de creación de una matriz: + +``` sql +SELECT array(1, 2) AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName(array(1, 2))─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴─────────────────────────┘ +``` + +``` sql +SELECT [1, 2] AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName([1, 2])─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴────────────────────┘ +``` + +## Trabajar Con Tipos De Datos {#working-with-data-types} + +Al crear una matriz sobre la marcha, ClickHouse define automáticamente el tipo de argumento como el tipo de datos más estrecho que puede almacenar todos los argumentos enumerados. Si hay alguna [NULL](nullable.md#data_type-nullable) o literal [NULL](../../sql-reference/syntax.md#null-literal) valores, el tipo de un elemento de matriz también se convierte en [NULL](nullable.md). + +Si ClickHouse no pudo determinar el tipo de datos, genera una excepción. Por ejemplo, esto sucede cuando se intenta crear una matriz con cadenas y números simultáneamente (`SELECT array(1, 'a')`). + +Ejemplos de detección automática de tipos de datos: + +``` sql +SELECT array(1, 2, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ +│ [1,2,NULL] │ Array(Nullable(UInt8)) │ +└────────────┴───────────────────────────────┘ +``` + +Si intenta crear una matriz de tipos de datos incompatibles, ClickHouse produce una excepción: + +``` sql +SELECT array(1, 'a') +``` + +``` text +Received exception from server (version 1.1.54388): +Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. +``` + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/es/sql-reference/data-types/boolean.md b/docs/es/sql-reference/data-types/boolean.md new file mode 100644 index 00000000000..38af5f9fa6f --- /dev/null +++ b/docs/es/sql-reference/data-types/boolean.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 43 +toc_title: Booleana +--- + +# Valores Booleanos {#boolean-values} + +No hay un tipo separado para los valores booleanos. Utilice el tipo UInt8, restringido a los valores 0 o 1. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/boolean/) diff --git a/docs/es/sql_reference/data_types/date.md b/docs/es/sql-reference/data-types/date.md similarity index 100% rename from docs/es/sql_reference/data_types/date.md rename to docs/es/sql-reference/data-types/date.md diff --git a/docs/es/sql-reference/data-types/datetime.md b/docs/es/sql-reference/data-types/datetime.md new file mode 100644 index 00000000000..6701bf83b87 --- /dev/null +++ b/docs/es/sql-reference/data-types/datetime.md @@ -0,0 +1,129 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 48 +toc_title: FechaHora +--- + +# Datetime {#data_type-datetime} + +Permite almacenar un instante en el tiempo, que se puede expresar como una fecha del calendario y una hora de un día. + +Sintaxis: + +``` sql +DateTime([timezone]) +``` + +Rango de valores: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. + +Resolución: 1 segundo. + +## Observaciones De Uso {#usage-remarks} + +El punto en el tiempo se guarda como un [Timestamp de Unix](https://en.wikipedia.org/wiki/Unix_time), independientemente de la zona horaria o el horario de verano. Además, el `DateTime` tipo puede almacenar zona horaria que es la misma para toda la columna, que afecta a cómo los valores de la `DateTime` Los valores de tipo se muestran en formato de texto y cómo se analizan los valores especificados como cadenas (‘2020-01-01 05:00:01’). La zona horaria no se almacena en las filas de la tabla (o en el conjunto de resultados), sino que se almacena en los metadatos de la columna. +Se puede encontrar una lista de zonas horarias compatibles en el [Base de datos de zonas horarias de IANA](https://www.iana.org/time-zones). +El `tzdata` paquete, que contiene [Base de datos de zonas horarias de IANA](https://www.iana.org/time-zones), debe instalarse en el sistema. Utilice el `timedatectl list-timezones` comando para listar zonas horarias conocidas por un sistema local. + +Puede establecer explícitamente una zona horaria para `DateTime`-type columnas al crear una tabla. Si la zona horaria no está establecida, ClickHouse usa el valor [Zona horaria](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) parámetro en la configuración del servidor o la configuración del sistema operativo en el momento del inicio del servidor ClickHouse. + +El [Casa de clics-cliente](../../interfaces/cli.md) aplica la zona horaria del servidor de forma predeterminada si una zona horaria no se establece explícitamente al inicializar el tipo de datos. Para utilizar la zona horaria del cliente, ejecute `clickhouse-client` con el `--use_client_time_zone` parámetro. + +ClickHouse genera valores en `YYYY-MM-DD hh:mm:ss` formato de texto por defecto. Puede cambiar la salida con el [formatDateTime](../../sql-reference/functions/date-time-functions.md#formatdatetime) función. + +Al insertar datos en ClickHouse, puede usar diferentes formatos de cadenas de fecha y hora, dependiendo del valor de la [Date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) configuración. + +## Ejemplos {#examples} + +**1.** Creación de una tabla con un `DateTime`-tipo de columna e insertar datos en ella: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime('Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog; +``` + +``` sql +INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); +``` + +``` sql +SELECT * FROM dt; +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +- Al insertar datetime como un entero, se trata como Unix Timestamp (UTC). `1546300800` representar `'2019-01-01 00:00:00'` UTC. Sin embargo, como `timestamp` columna tiene `Europe/Moscow` (UTC + 3) zona horaria especificada, al emitir como cadena, el valor se mostrará como `'2019-01-01 03:00:00'` +- Al insertar el valor de cadena como fecha y hora, se trata como si estuviera en la zona horaria de la columna. `'2019-01-01 00:00:00'` será tratado como estar en `Europe/Moscow` zona horaria y guardado como `1546290000`. + +**2.** Filtrado en `DateTime` valor + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +`DateTime` se pueden filtrar usando un valor de cadena en `WHERE` predicado. Se convertirá a `DateTime` automática: + +``` sql +SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +└─────────────────────┴──────────┘ +``` + +**3.** Obtener una zona horaria para un `DateTime`-tipo columna: + +``` sql +SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────column─┬─x─────────────────────────┐ +│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ +└─────────────────────┴───────────────────────────┘ +``` + +**4.** Conversión de zona horaria + +``` sql +SELECT +toDateTime(timestamp, 'Europe/London') as lon_time, +toDateTime(timestamp, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────lon_time──┬────────────mos_time─┐ +│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ +│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ +└─────────────────────┴─────────────────────┘ +``` + +## Ver también {#see-also} + +- [Funciones de conversión de tipos](../../sql-reference/functions/type-conversion-functions.md) +- [Funciones para trabajar con fechas y horas](../../sql-reference/functions/date-time-functions.md) +- [Funciones para trabajar con matrices](../../sql-reference/functions/array-functions.md) +- [El `date_time_input_format` configuración](../../operations/settings/settings.md#settings-date_time_input_format) +- [El `timezone` parámetro de configuración del servidor](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [Operadores para trabajar con fechas y horas](../../sql-reference/operators.md#operators-datetime) +- [El `Date` tipo de datos](date.md) + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/es/sql-reference/data-types/datetime64.md b/docs/es/sql-reference/data-types/datetime64.md new file mode 100644 index 00000000000..076a5ae2dac --- /dev/null +++ b/docs/es/sql-reference/data-types/datetime64.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 49 +toc_title: DateTime64 +--- + +# Datetime64 {#data_type-datetime64} + +Permite almacenar un instante en el tiempo, que se puede expresar como una fecha de calendario y una hora de un día, con una precisión de subsegundo definida + +Tamaño de la marca (precisión): 10-Precision segundo + +Sintaxis: + +``` sql +DateTime64(precision, [timezone]) +``` + +Internamente, almacena datos como un número de ‘ticks’ desde el inicio de la época (1970-01-01 00:00:00 UTC) como Int64. La resolución de tick está determinada por el parámetro precision. Además, el `DateTime64` tipo puede almacenar zona horaria que es la misma para toda la columna, que afecta a cómo los valores de la `DateTime64` Los valores de tipo se muestran en formato de texto y cómo se analizan los valores especificados como cadenas (‘2020-01-01 05:00:01.000’). La zona horaria no se almacena en las filas de la tabla (o en el conjunto de resultados), sino que se almacena en los metadatos de la columna. Ver detalles en [FechaHora](datetime.md). + +## Ejemplos {#examples} + +**1.** Creación de una tabla con `DateTime64`-tipo de columna e insertar datos en ella: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime64(3, 'Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog +``` + +``` sql +INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) +``` + +``` sql +SELECT * FROM dt +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00.000 │ 1 │ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +- Al insertar datetime como un entero, se trata como una marca de tiempo Unix (UTC) apropiadamente escalada. `1546300800000` (con precisión 3) representa `'2019-01-01 00:00:00'` UTC. Sin embargo, como `timestamp` columna tiene `Europe/Moscow` (UTC + 3) zona horaria especificada, al emitir como una cadena, el valor se mostrará como `'2019-01-01 03:00:00'` +- Al insertar el valor de cadena como fecha y hora, se trata como si estuviera en la zona horaria de la columna. `'2019-01-01 00:00:00'` será tratado como estar en `Europe/Moscow` zona horaria y se almacena como `1546290000000`. + +**2.** Filtrado en `DateTime64` valor + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +A diferencia de `DateTime`, `DateTime64` los valores no se convierten desde `String` automática + +**3.** Obtener una zona horaria para un `DateTime64`-tipo de valor: + +``` sql +SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────────column─┬─x──────────────────────────────┐ +│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ +└─────────────────────────┴────────────────────────────────┘ +``` + +**4.** Conversión de zona horaria + +``` sql +SELECT +toDateTime64(timestamp, 3, 'Europe/London') as lon_time, +toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────────lon_time──┬────────────────mos_time─┐ +│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ +│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ +└─────────────────────────┴─────────────────────────┘ +``` + +## Ver también {#see-also} + +- [Funciones de conversión de tipos](../../sql-reference/functions/type-conversion-functions.md) +- [Funciones para trabajar con fechas y horas](../../sql-reference/functions/date-time-functions.md) +- [Funciones para trabajar con matrices](../../sql-reference/functions/array-functions.md) +- [El `date_time_input_format` configuración](../../operations/settings/settings.md#settings-date_time_input_format) +- [El `timezone` parámetro de configuración del servidor](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [Operadores para trabajar con fechas y horas](../../sql-reference/operators.md#operators-datetime) +- [`Date` tipo de datos](date.md) +- [`DateTime` tipo de datos](datetime.md) diff --git a/docs/es/sql-reference/data-types/decimal.md b/docs/es/sql-reference/data-types/decimal.md new file mode 100644 index 00000000000..54a0baf2a10 --- /dev/null +++ b/docs/es/sql-reference/data-types/decimal.md @@ -0,0 +1,109 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 42 +toc_title: Decimal +--- + +# Decimal(P, S), Decimal32(S), Decimal64(S), Decimal128(S) {#decimalp-s-decimal32s-decimal64s-decimal128s} + +Números de punto fijo firmados que mantienen la precisión durante las operaciones de suma, resta y multiplicación. Para la división se descartan los dígitos menos significativos (no redondeados). + +## Parámetros {#parameters} + +- P - precisión. Rango válido: \[ 1 : 38 \]. Determina cuántos dígitos decimales puede tener el número (incluida la fracción). +- S - escala. Rango válido: \[ 0 : P \]. Determina cuántos dígitos decimales puede tener la fracción. + +Dependiendo del valor del parámetro P Decimal(P, S) es un sinónimo de: +- P de \[ 1 : 9 \] - para Decimal32(S) +- P de \[ 10 : 18 \] - para Decimal64(S) +- P de \[ 19 : 38 \] - para Decimal128(S) + +## Rangos De Valores Decimales {#decimal-value-ranges} + +- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9 - S) ) +- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18 - S) ) +- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38 - S) ) + +Por ejemplo, Decimal32(4) puede contener números de -99999.9999 a 99999.9999 con el paso 0.0001. + +## Representación Interna {#internal-representation} + +Internamente, los datos se representan como enteros con signo normal con el ancho de bits respectivo. Los rangos de valores reales que se pueden almacenar en la memoria son un poco más grandes que los especificados anteriormente, que se verifican solo en la conversión de una cadena. + +Debido a que las CPU modernas no admiten enteros de 128 bits de forma nativa, las operaciones en Decimal128 se emulan. Debido a esto, Decimal128 funciona significativamente más lento que Decimal32 / Decimal64. + +## Operaciones y Tipo De Resultado {#operations-and-result-type} + +Las operaciones binarias en Decimal dan como resultado un tipo de resultado más amplio (con cualquier orden de argumentos). + +- Decimal64(S1) Decimal32(S2) -\> Decimal64(S) +- Decimal128(S1) Decimal32(S2) -\> Decimal128(S) +- Decimal128(S1) ¿Cómo puedo hacerlo?) + +Reglas para la escala: + +- Sumar, restar: S = max(S1, S2). +- multuply: S = S1 + S2. +- división: S = S1. + +Para operaciones similares entre Decimal y enteros, el resultado es Decimal del mismo tamaño que un argumento. + +Las operaciones entre Decimal y Float32 / Float64 no están definidas. Si los necesita, puede convertir explícitamente uno de los argumentos utilizando toDecimal32, toDecimal64, toDecimal128 o toFloat32, toFloat64 builtins. Tenga en cuenta que el resultado perderá precisión y la conversión de tipo es una operación computacionalmente costosa. + +Algunas funciones en Decimal devuelven el resultado como Float64 (por ejemplo, var o stddev). Los cálculos intermedios aún se pueden realizar en Decimal, lo que podría dar lugar a resultados diferentes entre las entradas Float64 y Decimal con los mismos valores. + +## Comprobaciones De Desbordamiento {#overflow-checks} + +Durante los cálculos en Decimal, pueden producirse desbordamientos de enteros. Los dígitos excesivos en una fracción se descartan (no se redondean). Los dígitos excesivos en la parte entera conducirán a una excepción. + +``` sql +SELECT toDecimal32(2, 4) AS x, x / 3 +``` + +``` text +┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ +│ 2.0000 │ 0.6666 │ +└────────┴──────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32(4.2, 8) AS x, x * x +``` + +``` text +DB::Exception: Scale is out of bounds. +``` + +``` sql +SELECT toDecimal32(4.2, 8) AS x, 6 * x +``` + +``` text +DB::Exception: Decimal math overflow. +``` + +Las comprobaciones de desbordamiento conducen a la desaceleración de las operaciones. Si se sabe que los desbordamientos no son posibles, tiene sentido deshabilitar las verificaciones usando `decimal_check_overflow` configuración. Cuando las comprobaciones están deshabilitadas y se produce el desbordamiento, el resultado será incorrecto: + +``` sql +SET decimal_check_overflow = 0; +SELECT toDecimal32(4.2, 8) AS x, 6 * x +``` + +``` text +┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ +│ 4.20000000 │ -17.74967296 │ +└────────────┴──────────────────────────────────┘ +``` + +Las comprobaciones de desbordamiento ocurren no solo en operaciones aritméticas sino también en la comparación de valores: + +``` sql +SELECT toDecimal32(1, 8) < 100 +``` + +``` text +DB::Exception: Can't compare. +``` + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/decimal/) diff --git a/docs/es/sql_reference/data_types/domains/index.md b/docs/es/sql-reference/data-types/domains/index.md similarity index 100% rename from docs/es/sql_reference/data_types/domains/index.md rename to docs/es/sql-reference/data-types/domains/index.md diff --git a/docs/es/sql_reference/data_types/domains/ipv4.md b/docs/es/sql-reference/data-types/domains/ipv4.md similarity index 100% rename from docs/es/sql_reference/data_types/domains/ipv4.md rename to docs/es/sql-reference/data-types/domains/ipv4.md diff --git a/docs/es/sql_reference/data_types/domains/ipv6.md b/docs/es/sql-reference/data-types/domains/ipv6.md similarity index 100% rename from docs/es/sql_reference/data_types/domains/ipv6.md rename to docs/es/sql-reference/data-types/domains/ipv6.md diff --git a/docs/es/sql-reference/data-types/domains/overview.md b/docs/es/sql-reference/data-types/domains/overview.md new file mode 100644 index 00000000000..ad7e4ac3bb0 --- /dev/null +++ b/docs/es/sql-reference/data-types/domains/overview.md @@ -0,0 +1,32 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 58 +toc_title: "Descripci\xF3n" +--- + +# Dominio {#domains} + +Los dominios son tipos de propósito especial que agregan algunas características adicionales encima del tipo base existente, pero dejando intacto el formato en cable y en disco del tipo de datos subyacente. Por el momento, ClickHouse no admite dominios definidos por el usuario. + +Puede usar dominios en cualquier lugar que se pueda usar el tipo base correspondiente, por ejemplo: + +- Crear una columna de un tipo de dominio +- Leer/escribir valores desde/a la columna de dominio +- Úselo como un índice si un tipo base se puede usar como un índice +- Funciones de llamada con valores de la columna de dominio + +### Características Adicionales De Los Dominios {#extra-features-of-domains} + +- Nombre de tipo de columna explícito en `SHOW CREATE TABLE` o `DESCRIBE TABLE` +- Entrada del formato humano-amistoso con `INSERT INTO domain_table(domain_column) VALUES(...)` +- Salida al formato humano-amistoso para `SELECT domain_column FROM domain_table` +- Carga de datos desde una fuente externa en el formato de uso humano: `INSERT INTO domain_table FORMAT CSV ...` + +### Limitacion {#limitations} + +- No se puede convertir la columna de índice del tipo base al tipo de dominio a través de `ALTER TABLE`. +- No se pueden convertir implícitamente valores de cadena en valores de dominio al insertar datos de otra columna o tabla. +- Domain no agrega restricciones en los valores almacenados. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/es/sql-reference/data-types/enum.md b/docs/es/sql-reference/data-types/enum.md new file mode 100644 index 00000000000..d568a35b3a2 --- /dev/null +++ b/docs/es/sql-reference/data-types/enum.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 50 +toc_title: Enum +--- + +# Enum {#enum} + +Tipo enumerado que consta de valores con nombre. + +Los valores con nombre deben declararse como `'string' = integer` par. ClickHouse almacena solo números, pero admite operaciones con los valores a través de sus nombres. + +Soporta ClickHouse: + +- de 8 bits `Enum`. Puede contener hasta 256 valores enumerados en el `[-128, 127]` gama. +- de 16 bits `Enum`. Puede contener hasta 65536 valores enumerados en el `[-32768, 32767]` gama. + +ClickHouse elige automáticamente el tipo de `Enum` cuando se insertan datos. También puede utilizar `Enum8` o `Enum16` para estar seguro en el tamaño de almacenamiento. + +## Ejemplos De Uso {#usage-examples} + +Aquí creamos una tabla con un `Enum8('hello' = 1, 'world' = 2)` tipo columna: + +``` sql +CREATE TABLE t_enum +( + x Enum('hello' = 1, 'world' = 2) +) +ENGINE = TinyLog +``` + +Columna `x` sólo puede almacenar valores que se enumeran en la definición de tipo: `'hello'` o `'world'`. Si intenta guardar cualquier otro valor, ClickHouse generará una excepción. Tamaño de 8 bits para esto `Enum` se elige automáticamente. + +``` sql +INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') +``` + +``` text +Ok. +``` + +``` sql +INSERT INTO t_enum values('a') +``` + +``` text +Exception on client: +Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) +``` + +Al consultar datos de la tabla, ClickHouse genera los valores de cadena de `Enum`. + +``` sql +SELECT * FROM t_enum +``` + +``` text +┌─x─────┐ +│ hello │ +│ world │ +│ hello │ +└───────┘ +``` + +Si necesita ver los equivalentes numéricos de las filas, debe `Enum` valor a tipo entero. + +``` sql +SELECT CAST(x, 'Int8') FROM t_enum +``` + +``` text +┌─CAST(x, 'Int8')─┐ +│ 1 │ +│ 2 │ +│ 1 │ +└─────────────────┘ +``` + +Para crear un valor Enum en una consulta, también debe usar `CAST`. + +``` sql +SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) +``` + +``` text +┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ +│ Enum8('a' = 1, 'b' = 2) │ +└─────────────────────────────────────────────────────┘ +``` + +## Reglas Generales y Uso {#general-rules-and-usage} + +A cada uno de los valores se le asigna un número en el rango `-128 ... 127` para `Enum8` o en el rango `-32768 ... 32767` para `Enum16`. Todas las cadenas y números deben ser diferentes. Se permite una cadena vacía. Si se especifica este tipo (en una definición de tabla), los números pueden estar en un orden arbitrario. Sin embargo, el orden no importa. + +Ni la cadena ni el valor numérico en un `Enum` puede ser [NULL](../../sql-reference/syntax.md). + +Un `Enum` puede estar contenido en [NULL](nullable.md) tipo. Entonces, si crea una tabla usando la consulta + +``` sql +CREATE TABLE t_enum_nullable +( + x Nullable( Enum8('hello' = 1, 'world' = 2) ) +) +ENGINE = TinyLog +``` + +puede almacenar no sólo `'hello'` y `'world'`, pero `NULL`, también. + +``` sql +INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) +``` + +En RAM, un `Enum` columna se almacena de la misma manera que `Int8` o `Int16` de los valores numéricos correspondientes. + +Al leer en forma de texto, ClickHouse analiza el valor como una cadena y busca la cadena correspondiente del conjunto de valores Enum. Si no se encuentra, se lanza una excepción. Al leer en formato de texto, se lee la cadena y se busca el valor numérico correspondiente. Se lanzará una excepción si no se encuentra. +Al escribir en forma de texto, escribe el valor como la cadena correspondiente. Si los datos de columna contienen elementos no utilizados (números que no son del conjunto válido), se produce una excepción. Al leer y escribir en forma binaria, funciona de la misma manera que para los tipos de datos Int8 e Int16. +El valor predeterminado es el valor con el número más bajo. + +Durante `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` y así sucesivamente, las enumeraciones se comportan de la misma manera que los números correspondientes. Por ejemplo, ORDER BY los ordena numéricamente. Los operadores de igualdad y comparación funcionan de la misma manera en enumeraciones que en los valores numéricos subyacentes. + +Los valores de Enum no se pueden comparar con los números. Las enumeraciones se pueden comparar con una cadena constante. Si la cadena en comparación con no es un valor válido para el Enum, se lanzará una excepción. El operador IN es compatible con el Enum en el lado izquierdo y un conjunto de cadenas en el lado derecho. Las cadenas son los valores del Enum correspondiente. + +Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. +Sin embargo, el Enum tiene un `toString` función que devuelve su valor de cadena. + +Los valores de Enum también se pueden convertir a tipos numéricos utilizando el `toT` función, donde T es un tipo numérico. Cuando T corresponde al tipo numérico subyacente de la enumeración, esta conversión es de costo cero. +El tipo Enum se puede cambiar sin costo usando ALTER, si solo se cambia el conjunto de valores. Es posible agregar y eliminar miembros del Enum usando ALTER (eliminar es seguro solo si el valor eliminado nunca se ha usado en la tabla). Como salvaguardia, al cambiar el valor numérico de un miembro Enum definido previamente se producirá una excepción. + +Usando ALTER, es posible cambiar un Enum8 a un Enum16 o viceversa, al igual que cambiar un Int8 a Int16. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/es/sql-reference/data-types/fixedstring.md b/docs/es/sql-reference/data-types/fixedstring.md new file mode 100644 index 00000000000..f464c66ddd2 --- /dev/null +++ b/docs/es/sql-reference/data-types/fixedstring.md @@ -0,0 +1,63 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 45 +toc_title: Cadena fija (N) +--- + +# Cuerda Fija {#fixedstring} + +Una cadena de longitud fija de `N` bytes (ni caracteres ni puntos de código). + +Para declarar una columna de `FixedString` tipo, utilice la siguiente sintaxis: + +``` sql + FixedString(N) +``` + +Donde `N` es un número natural. + +El `FixedString` tipo es eficiente cuando los datos tienen la longitud de `N` byte. En todos los demás casos, es probable que reduzca la eficiencia. + +Ejemplos de los valores que se pueden almacenar eficientemente en `FixedString`escrito columnas: + +- La representación binaria de direcciones IP (`FixedString(16)` para IPv6). +- Language codes (ru\_RU, en\_US … ). +- Currency codes (USD, RUB … ). +- Representación binaria de hashes (`FixedString(16)` para MD5, `FixedString(32)` para SHA256). + +Para almacenar valores UUID, utilice el [UUID](uuid.md) tipo de datos. + +Al insertar los datos, ClickHouse: + +- Complementa una cadena con bytes nulos si la cadena contiene menos de `N` byte. +- Lanza el `Too large value for FixedString(N)` excepción si la cadena contiene más de `N` byte. + +Al seleccionar los datos, ClickHouse no elimina los bytes nulos al final de la cadena. Si utiliza el `WHERE` cláusula, debe agregar bytes nulos manualmente para que coincida con el `FixedString` valor. En el ejemplo siguiente se muestra cómo utilizar el `WHERE` cláusula con `FixedString`. + +Consideremos la siguiente tabla con el único `FixedString(2)` columna: + +``` text +┌─name──┐ +│ b │ +└───────┘ +``` + +Consulta `SELECT * FROM FixedStringTable WHERE a = 'b'` no devuelve ningún dato como resultado. Debemos complementar el patrón de filtro con bytes nulos. + +``` sql +SELECT * FROM FixedStringTable +WHERE a = 'b\0' +``` + +``` text +┌─a─┐ +│ b │ +└───┘ +``` + +Este comportamiento difiere de MySQL para el `CHAR` tipo (donde las cadenas se rellenan con espacios y los espacios se eliminan para la salida). + +Tenga en cuenta que la longitud del `FixedString(N)` el valor es constante. El [longitud](../../sql-reference/functions/array-functions.md#array_functions-length) función devuelve `N` incluso si el `FixedString(N)` sólo se rellena con bytes nulos, pero el valor [vaciar](../../sql-reference/functions/string-functions.md#empty) función devuelve `1` en este caso. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/es/sql-reference/data-types/float.md b/docs/es/sql-reference/data-types/float.md new file mode 100644 index 00000000000..e0477c4c532 --- /dev/null +++ b/docs/es/sql-reference/data-types/float.md @@ -0,0 +1,87 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 41 +toc_title: "Descripci\xF3n del producto" +--- + +# Descripción Del Producto {#float32-float64} + +[Números de punto flotante](https://en.wikipedia.org/wiki/IEEE_754). + +Los tipos son equivalentes a los tipos de C: + +- `Float32` - `float` +- `Float64` - `double` + +Le recomendamos que almacene los datos en formato entero siempre que sea posible. Por ejemplo, convierta números de precisión fija en valores enteros, como importes monetarios o tiempos de carga de página en milisegundos. + +## Uso De números De Punto Flotante {#using-floating-point-numbers} + +- Los cálculos con números de punto flotante pueden producir un error de redondeo. + + + +``` sql +SELECT 1 - 0.9 +``` + +``` text +┌───────minus(1, 0.9)─┐ +│ 0.09999999999999998 │ +└─────────────────────┘ +``` + +- El resultado del cálculo depende del método de cálculo (el tipo de procesador y la arquitectura del sistema informático). +- Los cálculos de puntos flotantes pueden dar como resultado números como el infinito (`Inf`) y “not-a-number” (`NaN`). Esto debe tenerse en cuenta al procesar los resultados de los cálculos. +- Al analizar números de punto flotante a partir de texto, el resultado puede no ser el número representable por máquina más cercano. + +## NaN y Inf {#data_type-float-nan-inf} + +A diferencia de SQL estándar, ClickHouse admite las siguientes categorías de números de punto flotante: + +- `Inf` – Infinity. + + + +``` sql +SELECT 0.5 / 0 +``` + +``` text +┌─divide(0.5, 0)─┐ +│ inf │ +└────────────────┘ +``` + +- `-Inf` – Negative infinity. + + + +``` sql +SELECT -0.5 / 0 +``` + +``` text +┌─divide(-0.5, 0)─┐ +│ -inf │ +└─────────────────┘ +``` + +- `NaN` – Not a number. + + + +``` sql +SELECT 0 / 0 +``` + +``` text +┌─divide(0, 0)─┐ +│ nan │ +└──────────────┘ +``` + + See the rules for `NaN` sorting in the section [ORDER BY clause](../sql_reference/statements/select.md). + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/float/) diff --git a/docs/es/sql-reference/data-types/index.md b/docs/es/sql-reference/data-types/index.md new file mode 100644 index 00000000000..258c108aba6 --- /dev/null +++ b/docs/es/sql-reference/data-types/index.md @@ -0,0 +1,15 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Data Types +toc_priority: 37 +toc_title: "Implantaci\xF3n" +--- + +# Tipos De Datos {#data_types} + +ClickHouse puede almacenar varios tipos de datos en celdas de tabla. + +En esta sección se describen los tipos de datos admitidos y las consideraciones especiales para usarlos o implementarlos, si los hubiere. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/) diff --git a/docs/es/sql-reference/data-types/int-uint.md b/docs/es/sql-reference/data-types/int-uint.md new file mode 100644 index 00000000000..a16b7450b07 --- /dev/null +++ b/docs/es/sql-reference/data-types/int-uint.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 40 +toc_title: UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64 +--- + +# UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64} + +Enteros de longitud fija, con o sin signo. + +## Rangos Int {#int-ranges} + +- Int8 - \[-128 : 127\] +- Int16 - \[-32768 : 32767\] +- Int32 - \[-2147483648 : 2147483647\] +- Int64 - \[-9223372036854775808 : 9223372036854775807\] + +## Rangos De Uint {#uint-ranges} + +- UInt8 - \[0 : 255\] +- UInt16 - \[0 : 65535\] +- UInt32 - \[0 : 4294967295\] +- UInt64 - \[0 : 18446744073709551615\] + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/int_uint/) diff --git a/docs/es/sql-reference/data-types/nested-data-structures/index.md b/docs/es/sql-reference/data-types/nested-data-structures/index.md new file mode 100644 index 00000000000..3faaee845c4 --- /dev/null +++ b/docs/es/sql-reference/data-types/nested-data-structures/index.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Nested Data Structures +toc_hidden: true +toc_priority: 54 +toc_title: oculto +--- + +# Estructuras De Datos Anidados {#nested-data-structures} + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/) diff --git a/docs/es/sql-reference/data-types/nested-data-structures/nested.md b/docs/es/sql-reference/data-types/nested-data-structures/nested.md new file mode 100644 index 00000000000..7879e0d3422 --- /dev/null +++ b/docs/es/sql-reference/data-types/nested-data-structures/nested.md @@ -0,0 +1,106 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 57 +toc_title: Anidado (Nombre1 Tipo1, Nombre2 Tipo2, ...) +--- + +# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) consulta. Cada fila de la tabla puede corresponder a cualquier número de filas en una estructura de datos anidada. + +Ejemplo: + +``` sql +CREATE TABLE test.visits +( + CounterID UInt32, + StartDate Date, + Sign Int8, + IsNew UInt8, + VisitID UInt64, + UserID UInt64, + ... + Goals Nested + ( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32 + ), + ... +) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) +``` + +Este ejemplo declara la `Goals` estructura de datos anidada, que contiene datos sobre conversiones (objetivos alcanzados). Cada fila en el ‘visits’ la tabla puede corresponder a cero o cualquier número de conversiones. + +Solo se admite un único nivel de anidamiento. Las columnas de estructuras anidadas que contienen matrices son equivalentes a matrices multidimensionales, por lo que tienen un soporte limitado (no hay soporte para almacenar estas columnas en tablas con el motor MergeTree). + +En la mayoría de los casos, cuando se trabaja con una estructura de datos anidada, sus columnas se especifican con nombres de columna separados por un punto. Estas columnas forman una matriz de tipos coincidentes. Todas las matrices de columnas de una sola estructura de datos anidados tienen la misma longitud. + +Ejemplo: + +``` sql +SELECT + Goals.ID, + Goals.EventTime +FROM test.visits +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ +│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ +│ [1073752] │ ['2014-03-17 00:28:25'] │ +│ [1073752] │ ['2014-03-17 10:46:20'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ +│ [] │ [] │ +│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ +│ [] │ [] │ +│ [] │ [] │ +│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ +└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +Es más fácil pensar en una estructura de datos anidados como un conjunto de múltiples matrices de columnas de la misma longitud. + +El único lugar donde una consulta SELECT puede especificar el nombre de una estructura de datos anidada completa en lugar de columnas individuales es la cláusula ARRAY JOIN. Para obtener más información, consulte “ARRAY JOIN clause”. Ejemplo: + +``` sql +SELECT + Goal.ID, + Goal.EventTime +FROM test.visits +ARRAY JOIN Goals AS Goal +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goal.ID─┬──────Goal.EventTime─┐ +│ 1073752 │ 2014-03-17 16:38:10 │ +│ 591325 │ 2014-03-17 16:38:48 │ +│ 591325 │ 2014-03-17 16:42:27 │ +│ 1073752 │ 2014-03-17 00:28:25 │ +│ 1073752 │ 2014-03-17 10:46:20 │ +│ 1073752 │ 2014-03-17 13:59:20 │ +│ 591325 │ 2014-03-17 22:17:55 │ +│ 591325 │ 2014-03-17 22:18:07 │ +│ 591325 │ 2014-03-17 22:18:51 │ +│ 1073752 │ 2014-03-17 11:37:06 │ +└─────────┴─────────────────────┘ +``` + +No puede realizar SELECT para toda una estructura de datos anidados. Solo puede enumerar explícitamente columnas individuales que forman parte de él. + +Para una consulta INSERT, debe pasar todas las matrices de columnas de componentes de una estructura de datos anidada por separado (como si fueran matrices de columnas individuales). Durante la inserción, el sistema comprueba que tienen la misma longitud. + +Para DESCRIBIR consulta, las columnas anidadas estructura de datos se muestran por separado en la misma forma. + +La consulta ALTER para elementos en una estructura de datos anidados tiene limitaciones. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/es/sql-reference/data-types/nullable.md b/docs/es/sql-reference/data-types/nullable.md new file mode 100644 index 00000000000..bb19db63f5c --- /dev/null +++ b/docs/es/sql-reference/data-types/nullable.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 54 +toc_title: 'NULL' +--- + +# Nivel De Cifrado WEP) {#data_type-nullable} + +Permite almacenar marcador especial ([NULL](../../sql-reference/syntax.md)) que denota “missing value” junto con los valores normales permitidos por `TypeName`. Por ejemplo, un `Nullable(Int8)` tipo columna puede almacenar `Int8` valores de tipo, y las filas que no tienen un valor almacenarán `NULL`. + +Para un `TypeName`, no puede usar tipos de datos compuestos [Matriz](array.md) y [Tupla](tuple.md). Los tipos de datos compuestos pueden contener `Nullable` valores de tipo, como `Array(Nullable(Int8))`. + +A `Nullable` no se puede incluir en los índices de tabla. + +`NULL` es el valor predeterminado para cualquier `Nullable` tipo, a menos que se especifique lo contrario en la configuración del servidor ClickHouse. + +## Características De Almacenamiento {#storage-features} + +Almacenar `Nullable` en una columna de tabla, ClickHouse usa un archivo separado con `NULL` máscaras además del archivo normal con valores. Las entradas en el archivo de máscaras permiten ClickHouse distinguir entre `NULL` y un valor predeterminado del tipo de datos correspondiente para cada fila de la tabla. Debido a un archivo adicional, `Nullable` La columna consume espacio de almacenamiento adicional en comparación con una normal similar. + +!!! info "Nota" + Utilizar `Nullable` casi siempre afecta negativamente al rendimiento, tenga esto en cuenta al diseñar sus bases de datos. + +## Ejemplo De Uso {#usage-example} + +``` sql +CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog +``` + +``` sql +INSERT INTO t_null VALUES (1, NULL), (2, 3) +``` + +``` sql +SELECT x + y FROM t_null +``` + +``` text +┌─plus(x, y)─┐ +│ ᴺᵁᴸᴸ │ +│ 5 │ +└────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/es/sql-reference/data-types/simpleaggregatefunction.md b/docs/es/sql-reference/data-types/simpleaggregatefunction.md new file mode 120000 index 00000000000..76a7ef3b802 --- /dev/null +++ b/docs/es/sql-reference/data-types/simpleaggregatefunction.md @@ -0,0 +1 @@ +../../../en/sql-reference/data-types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/es/sql_reference/data_types/special_data_types/expression.md b/docs/es/sql-reference/data-types/special-data-types/expression.md similarity index 100% rename from docs/es/sql_reference/data_types/special_data_types/expression.md rename to docs/es/sql-reference/data-types/special-data-types/expression.md diff --git a/docs/es/sql-reference/data-types/special-data-types/index.md b/docs/es/sql-reference/data-types/special-data-types/index.md new file mode 100644 index 00000000000..4e5ea3699b6 --- /dev/null +++ b/docs/es/sql-reference/data-types/special-data-types/index.md @@ -0,0 +1,14 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Special Data Types +toc_hidden: true +toc_priority: 55 +toc_title: oculto +--- + +# Tipos De Datos Especiales {#special-data-types} + +Los valores de tipo de datos especiales no se pueden serializar para guardar en una tabla o salida en los resultados de la consulta, pero se pueden usar como un resultado intermedio durante la ejecución de la consulta. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/special_data_types/) diff --git a/docs/es/sql-reference/data-types/special-data-types/interval.md b/docs/es/sql-reference/data-types/special-data-types/interval.md new file mode 100644 index 00000000000..3e2cad305f7 --- /dev/null +++ b/docs/es/sql-reference/data-types/special-data-types/interval.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 61 +toc_title: Intervalo +--- + +# Intervalo {#data-type-interval} + +La familia de tipos de datos que representan intervalos de fecha y hora. Los tipos resultantes del [INTERVAL](../../../sql-reference/operators.md#operator-interval) operador. + +!!! warning "Advertencia" + `Interval` los valores de tipo de datos no se pueden almacenar en tablas. + +Estructura: + +- Intervalo de tiempo como un valor entero sin signo. +- Tipo de intervalo. + +Tipos de intervalo admitidos: + +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +Para cada tipo de intervalo, hay un tipo de datos independiente. Por ejemplo, el `DAY` el intervalo corresponde a la `IntervalDay` tipo de datos: + +``` sql +SELECT toTypeName(INTERVAL 4 DAY) +``` + +``` text +┌─toTypeName(toIntervalDay(4))─┐ +│ IntervalDay │ +└──────────────────────────────┘ +``` + +## Observaciones De Uso {#data-type-interval-usage-remarks} + +Usted puede utilizar `Interval`-type valores en operaciones aritméticas con [Fecha](../../../sql-reference/data-types/date.md) y [FechaHora](../../../sql-reference/data-types/datetime.md)-type valores. Por ejemplo, puede agregar 4 días a la hora actual: + +``` sql +SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY +``` + +``` text +┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ +│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ +└─────────────────────┴───────────────────────────────┘ +``` + +Los intervalos con diferentes tipos no se pueden combinar. No puedes usar intervalos como `4 DAY 1 HOUR`. Especifique los intervalos en unidades que son más pequeñas o iguales que la unidad más pequeña del intervalo, por ejemplo, el intervalo `1 day and an hour` se puede expresar como `25 HOUR` o `90000 SECOND`. + +No puede realizar operaciones aritméticas con `Interval`-type valores, pero puede agregar intervalos de diferentes tipos en consecuencia a los valores en `Date` o `DateTime` tipos de datos. Por ejemplo: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +La siguiente consulta provoca una excepción: + +``` sql +select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) +``` + +``` text +Received exception from server (version 19.14.1): +Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. +``` + +## Ver también {#see-also} + +- [INTERVAL](../../../sql-reference/operators.md#operator-interval) operador +- [ToInterval](../../../sql-reference/functions/type-conversion-functions.md#function-tointerval) funciones de conversión de tipo diff --git a/docs/es/sql-reference/data-types/special-data-types/nothing.md b/docs/es/sql-reference/data-types/special-data-types/nothing.md new file mode 100644 index 00000000000..e1841fca135 --- /dev/null +++ b/docs/es/sql-reference/data-types/special-data-types/nothing.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 60 +toc_title: Nada +--- + +# Nada {#nothing} + +El único propósito de este tipo de datos es representar casos en los que no se espera un valor. Entonces no puedes crear un `Nothing` valor de tipo. + +Por ejemplo, literal [NULL](../../../sql-reference/syntax.md#null-literal) tiene tipo de `Nullable(Nothing)`. Ver más sobre [NULL](../../../sql-reference/data-types/nullable.md). + +El `Nothing` tipo puede también se utiliza para denotar matrices vacías: + +``` sql +SELECT toTypeName(array()) +``` + +``` text +┌─toTypeName(array())─┐ +│ Array(Nothing) │ +└─────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/es/sql-reference/data-types/special-data-types/set.md b/docs/es/sql-reference/data-types/special-data-types/set.md new file mode 100644 index 00000000000..a88ea73b24b --- /dev/null +++ b/docs/es/sql-reference/data-types/special-data-types/set.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 59 +toc_title: Establecer +--- + +# Establecer {#set} + +Utilizado para la mitad derecha de un [IN](../../../sql-reference/statements/select.md#select-in-operators) expresion. + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/es/sql_reference/data_types/string.md b/docs/es/sql-reference/data-types/string.md similarity index 100% rename from docs/es/sql_reference/data_types/string.md rename to docs/es/sql-reference/data-types/string.md diff --git a/docs/es/sql-reference/data-types/tuple.md b/docs/es/sql-reference/data-types/tuple.md new file mode 100644 index 00000000000..8c4dee640b3 --- /dev/null +++ b/docs/es/sql-reference/data-types/tuple.md @@ -0,0 +1,52 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 53 +toc_title: Tuple (T1, T2, ...) +--- + +# Tuple(t1, T2, …) {#tuplet1-t2} + +Una tupla de elementos, cada uno con un individuo [tipo](index.md#data_types). + +Las tuplas se utilizan para la agrupación temporal de columnas. Las columnas se pueden agrupar cuando se usa una expresión IN en una consulta y para especificar ciertos parámetros formales de las funciones lambda. Para obtener más información, consulte las secciones [IN operadores](../../sql-reference/statements/select.md) y [Funciones de orden superior](../../sql-reference/functions/higher-order-functions.md). + +Las tuplas pueden ser el resultado de una consulta. En este caso, para formatos de texto distintos de JSON, los valores están separados por comas entre corchetes. En formatos JSON, las tuplas se generan como matrices (entre corchetes). + +## Creación De Una Tupla {#creating-a-tuple} + +Puedes usar una función para crear una tupla: + +``` sql +tuple(T1, T2, ...) +``` + +Ejemplo de creación de una tupla: + +``` sql +SELECT tuple(1,'a') AS x, toTypeName(x) +``` + +``` text +┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ +│ (1,'a') │ Tuple(UInt8, String) │ +└─────────┴───────────────────────────┘ +``` + +## Trabajar Con Tipos De Datos {#working-with-data-types} + +Al crear una tupla sobre la marcha, ClickHouse detecta automáticamente el tipo de cada argumento como el mínimo de los tipos que pueden almacenar el valor del argumento. Si el argumento es [NULL](../../sql-reference/syntax.md#null-literal), el tipo del elemento de tupla es [NULL](nullable.md). + +Ejemplo de detección automática de tipos de datos: + +``` sql +SELECT tuple(1, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ +│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ +└──────────┴─────────────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/es/sql-reference/data-types/uuid.md b/docs/es/sql-reference/data-types/uuid.md new file mode 100644 index 00000000000..c5632becea7 --- /dev/null +++ b/docs/es/sql-reference/data-types/uuid.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 46 +toc_title: UUID +--- + +# UUID {#uuid-data-type} + +Un identificador único universal (UUID) es un número de 16 bytes utilizado para identificar registros. Para obtener información detallada sobre el UUID, consulte [Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +El ejemplo de valor de tipo UUID se representa a continuación: + +``` text +61f0c404-5cb3-11e7-907b-a6006ad3dba0 +``` + +Si no especifica el valor de la columna UUID al insertar un nuevo registro, el valor UUID se rellena con cero: + +``` text +00000000-0000-0000-0000-000000000000 +``` + +## Cómo Generar {#how-to-generate} + +Para generar el valor UUID, ClickHouse proporciona el [GenerateUUIDv4](../../sql-reference/functions/uuid-functions.md) función. + +## Ejemplo De Uso {#usage-example} + +**Ejemplo 1** + +En este ejemplo se muestra la creación de una tabla con la columna de tipo UUID e insertar un valor en la tabla. + +``` sql +CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog +``` + +``` sql +INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +└──────────────────────────────────────┴───────────┘ +``` + +**Ejemplo 2** + +En este ejemplo, el valor de la columna UUID no se especifica al insertar un nuevo registro. + +``` sql +INSERT INTO t_uuid (y) VALUES ('Example 2') +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ +└──────────────────────────────────────┴───────────┘ +``` + +## Restricción {#restrictions} + +El tipo de datos UUID sólo admite funciones que [Cadena](string.md) tipo de datos también soporta (por ejemplo, [minuto](../../sql-reference/aggregate-functions/reference.md#agg_function-min), [máximo](../../sql-reference/aggregate-functions/reference.md#agg_function-max), y [contar](../../sql-reference/aggregate-functions/reference.md#agg_function-count)). + +El tipo de datos UUID no es compatible con operaciones aritméticas (por ejemplo, [abdominales](../../sql-reference/functions/arithmetic-functions.md#arithm_func-abs)) o funciones agregadas, tales como [resumir](../../sql-reference/aggregate-functions/reference.md#agg_function-sum) y [avg](../../sql-reference/aggregate-functions/reference.md#agg_function-avg). + +[Artículo Original](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md new file mode 100644 index 00000000000..308a913ac7d --- /dev/null +++ b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 45 +toc_title: "Diccionarios jer\xE1rquicos" +--- + +# Diccionarios jerárquicos {#hierarchical-dictionaries} + +ClickHouse soporta diccionarios jerárquicos con un [llave numérica](external-dicts-dict-structure.md#ext_dict-numeric-key). + +Mira la siguiente estructura jerárquica: + +``` text +0 (Common parent) +│ +├── 1 (Russia) +│ │ +│ └── 2 (Moscow) +│ │ +│ └── 3 (Center) +│ +└── 4 (Great Britain) + │ + └── 5 (London) +``` + +Esta jerarquía se puede expresar como la siguiente tabla de diccionario. + +| region\_id | parent\_region | nombre\_región | +|------------|----------------|----------------| +| 1 | 0 | Rusia | +| 2 | 1 | Moscu | +| 3 | 2 | Centrar | +| 4 | 0 | Gran Bretaña | +| 5 | 4 | Londres | + +Esta tabla contiene una columna `parent_region` que contiene la clave del padre más cercano para el elemento. + +ClickHouse soporta el [jerárquica](external-dicts-dict-structure.md#hierarchical-dict-attr) propiedad para [diccionario externo](index.md) atributo. Esta propiedad le permite configurar el diccionario jerárquico similar al descrito anteriormente. + +El [dictGetHierarchy](../../../sql-reference/functions/ext-dict-functions.md#dictgethierarchy) función le permite obtener la cadena principal de un elemento. + +Para nuestro ejemplo, la estructura del diccionario puede ser la siguiente: + +``` xml + + + + region_id + + + + parent_region + UInt64 + 0 + true + + + + region_name + String + + + + + +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md new file mode 100644 index 00000000000..baa18135505 --- /dev/null +++ b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md @@ -0,0 +1,373 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 41 +toc_title: Almacenamiento de diccionarios en la memoria +--- + +# Almacenamiento De Diccionarios En La Memoria {#dicts-external-dicts-dict-layout} + +Hay una variedad de formas de almacenar diccionarios en la memoria. + +Recomendamos [plano](#flat), [Hashed](#dicts-external_dicts_dict_layout-hashed) y [Método de codificación de datos:](#complex-key-hashed). que proporcionan una velocidad de procesamiento óptima. + +No se recomienda el almacenamiento en caché debido al rendimiento potencialmente bajo y las dificultades para seleccionar los parámetros óptimos. Lea más en la sección “[cache](#cache)”. + +Hay varias formas de mejorar el rendimiento del diccionario: + +- Llame a la función para trabajar con el diccionario después `GROUP BY`. +- Marque los atributos para extraer como inyectivos. Un atributo se llama injective si diferentes valores de atributo corresponden a claves diferentes. Entonces, cuando `GROUP BY` utiliza una función que obtiene un valor de atributo mediante la clave, esta función se elimina automáticamente de `GROUP BY`. + +ClickHouse genera una excepción para errores con diccionarios. Ejemplos de errores: + +- No se pudo cargar el diccionario al que se accede. +- Error al consultar un `cached` diccionario. + +Puede ver la lista de diccionarios externos y sus estados en el `system.dictionaries` tabla. + +La configuración se ve así: + +``` xml + + + ... + + + + + + ... + + +``` + +Correspondiente [Consulta DDL](../../statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY (...) +... +LAYOUT(LAYOUT_TYPE(param value)) -- layout settings +... +``` + +## Maneras De Almacenar Diccionarios En La Memoria {#ways-to-store-dictionaries-in-memory} + +- [plano](#flat) +- [Hashed](#dicts-external_dicts_dict_layout-hashed) +- [Sistema abierto.](#dicts-external_dicts_dict_layout-sparse_hashed) +- [cache](#cache) +- [range\_hashed](#range-hashed) +- [Método de codificación de datos:](#complex-key-hashed) +- [complejo\_key\_cache](#complex-key-cache) +- [Método de codificación de datos:](#ip-trie) + +### plano {#flat} + +El diccionario está completamente almacenado en la memoria en forma de matrices planas. ¿Cuánta memoria usa el diccionario? La cantidad es proporcional al tamaño de la clave más grande (en el espacio utilizado). + +La clave del diccionario tiene el `UInt64` tipo y el valor está limitado a 500.000. Si se descubre una clave más grande al crear el diccionario, ClickHouse produce una excepción y no crea el diccionario. + +Se admiten todos los tipos de fuentes. Al actualizar, los datos (de un archivo o de una tabla) se leen en su totalidad. + +Este método proporciona el mejor rendimiento entre todos los métodos disponibles para almacenar el diccionario. + +Ejemplo de configuración: + +``` xml + + + +``` + +o + +``` sql +LAYOUT(FLAT()) +``` + +### Hashed {#dicts-external_dicts_dict_layout-hashed} + +El diccionario está completamente almacenado en la memoria en forma de una tabla hash. El diccionario puede contener cualquier número de elementos con cualquier identificador En la práctica, el número de claves puede alcanzar decenas de millones de elementos. + +Se admiten todos los tipos de fuentes. Al actualizar, los datos (de un archivo o de una tabla) se leen en su totalidad. + +Ejemplo de configuración: + +``` xml + + + +``` + +o + +``` sql +LAYOUT(HASHED()) +``` + +### Sistema Abierto {#dicts-external_dicts_dict_layout-sparse_hashed} + +Similar a `hashed`, pero usa menos memoria a favor más uso de CPU. + +Ejemplo de configuración: + +``` xml + + + +``` + +``` sql +LAYOUT(SPARSE_HASHED()) +``` + +### Método De codificación De Datos: {#complex-key-hashed} + +Este tipo de almacenamiento es para su uso con material compuesto [claves](external-dicts-dict-structure.md). Similar a `hashed`. + +Ejemplo de configuración: + +``` xml + + + +``` + +``` sql +LAYOUT(COMPLEX_KEY_HASHED()) +``` + +### range\_hashed {#range-hashed} + +El diccionario se almacena en la memoria en forma de una tabla hash con una matriz ordenada de rangos y sus valores correspondientes. + +Este método de almacenamiento funciona de la misma manera que hash y permite el uso de intervalos de fecha / hora (tipo numérico arbitrario) además de la clave. + +Ejemplo: La tabla contiene descuentos para cada anunciante en el formato: + +``` text ++---------|-------------|-------------|------+ +| advertiser id | discount start date | discount end date | amount | ++===============+=====================+===================+========+ +| 123 | 2015-01-01 | 2015-01-15 | 0.15 | ++---------|-------------|-------------|------+ +| 123 | 2015-01-16 | 2015-01-31 | 0.25 | ++---------|-------------|-------------|------+ +| 456 | 2015-01-01 | 2015-01-15 | 0.05 | ++---------|-------------|-------------|------+ +``` + +Para utilizar un ejemplo para intervalos de fechas, defina el `range_min` y `range_max` elementos en el [estructura](external-dicts-dict-structure.md). Estos elementos deben contener elementos `name` y`type` (si `type` no se especifica, se utilizará el tipo predeterminado - Fecha). `type` puede ser de cualquier tipo numérico (Fecha / DateTime / UInt64 / Int32 / otros). + +Ejemplo: + +``` xml + + + Id + + + first + Date + + + last + Date + + ... +``` + +o + +``` sql +CREATE DICTIONARY somedict ( + id UInt64, + first Date, + last Date +) +PRIMARY KEY id +LAYOUT(RANGE_HASHED()) +RANGE(MIN first MAX last) +``` + +Para trabajar con estos diccionarios, debe pasar un argumento adicional al `dictGetT` función, para la que se selecciona un rango: + +``` sql +dictGetT('dict_name', 'attr_name', id, date) +``` + +Esta función devuelve el valor para el `id`s y el intervalo de fechas que incluye la fecha pasada. + +Detalles del algoritmo: + +- Si el `id` no se encuentra o no se encuentra un rango para el `id` devuelve el valor predeterminado para el diccionario. +- Si hay rangos superpuestos, puede usar cualquiera. +- Si el delimitador de rango es `NULL` o una fecha no válida (como 1900-01-01 o 2039-01-01), el rango se deja abierto. La gama puede estar abierta en ambos lados. + +Ejemplo de configuración: + +``` xml + + + + ... + + + + + + + + Abcdef + + + StartTimeStamp + UInt64 + + + EndTimeStamp + UInt64 + + + XXXType + String + + + + + + +``` + +o + +``` sql +CREATE DICTIONARY somedict( + Abcdef UInt64, + StartTimeStamp UInt64, + EndTimeStamp UInt64, + XXXType String DEFAULT '' +) +PRIMARY KEY Abcdef +RANGE(MIN StartTimeStamp MAX EndTimeStamp) +``` + +### cache {#cache} + +El diccionario se almacena en una memoria caché que tiene un número fijo de celdas. Estas celdas contienen elementos de uso frecuente. + +Al buscar un diccionario, primero se busca en la memoria caché. Para cada bloque de datos, todas las claves que no se encuentran en la memoria caché o están desactualizadas se solicitan desde el origen utilizando `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Los datos recibidos se escriben en la memoria caché. + +Para los diccionarios de caché, la caducidad [vida](external-dicts-dict-lifetime.md) de datos en la memoria caché se puede establecer. Si más tiempo que `lifetime` ha pasado desde que se cargaron los datos en una celda, el valor de la celda no se usa y se vuelve a solicitar la próxima vez que se deba usar. +Esta es la menos efectiva de todas las formas de almacenar diccionarios. La velocidad de la memoria caché depende en gran medida de la configuración correcta y del escenario de uso. Un diccionario de tipo de caché funciona bien solo cuando las tasas de aciertos son lo suficientemente altas (recomendado 99% y superior). Puede ver la tasa de aciertos promedio en el `system.dictionaries` tabla. + +Para mejorar el rendimiento de la caché, utilice una subconsulta con `LIMIT`, y llame a la función con el diccionario externamente. + +Apoyar [fuente](external-dicts-dict-sources.md): MySQL, ClickHouse, ejecutable, HTTP. + +Ejemplo de configuración: + +``` xml + + + + 1000000000 + + +``` + +o + +``` sql +LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) +``` + +Establezca un tamaño de caché lo suficientemente grande. Necesitas experimentar para seleccionar el número de celdas: + +1. Establecer algún valor. +2. Ejecute consultas hasta que la memoria caché esté completamente llena. +3. Evalúe el consumo de memoria utilizando el `system.dictionaries` tabla. +4. Aumente o disminuya el número de celdas hasta que se alcance el consumo de memoria requerido. + +!!! warning "Advertencia" + No use ClickHouse como fuente, ya que es lento procesar consultas con lecturas aleatorias. + +### complejo\_key\_cache {#complex-key-cache} + +Este tipo de almacenamiento es para su uso con material compuesto [claves](external-dicts-dict-structure.md). Similar a `cache`. + +### Método De codificación De Datos: {#ip-trie} + +Este tipo de almacenamiento sirve para asignar prefijos de red (direcciones IP) a metadatos como ASN. + +Ejemplo: La tabla contiene prefijos de red y su correspondiente número AS y código de país: + +``` text + +-----------|-----|------+ + | prefix | asn | cca2 | + +=================+=======+========+ + | 202.79.32.0/20 | 17501 | NP | + +-----------|-----|------+ + | 2620:0:870::/48 | 3856 | US | + +-----------|-----|------+ + | 2a02:6b8:1::/48 | 13238 | RU | + +-----------|-----|------+ + | 2001:db8::/32 | 65536 | ZZ | + +-----------|-----|------+ +``` + +Cuando se utiliza este tipo de diseño, la estructura debe tener una clave compuesta. + +Ejemplo: + +``` xml + + + + prefix + String + + + + asn + UInt32 + + + + cca2 + String + ?? + + ... +``` + +o + +``` sql +CREATE DICTIONARY somedict ( + prefix String, + asn UInt32, + cca2 String DEFAULT '??' +) +PRIMARY KEY prefix +``` + +La clave debe tener solo un atributo de tipo String que contenga un prefijo IP permitido. Todavía no se admiten otros tipos. + +Para consultas, debe utilizar las mismas funciones (`dictGetT` con una tupla) como para diccionarios con claves compuestas: + +``` sql +dictGetT('dict_name', 'attr_name', tuple(ip)) +``` + +La función toma cualquiera `UInt32` para IPv4, o `FixedString(16)` para IPv6: + +``` sql +dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) +``` + +Todavía no se admiten otros tipos. La función devuelve el atributo para el prefijo que corresponde a esta dirección IP. Si hay prefijos superpuestos, se devuelve el más específico. + +Los datos se almacenan en un `trie`. Debe encajar completamente en la RAM. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md new file mode 100644 index 00000000000..ee88e5273d9 --- /dev/null +++ b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 42 +toc_title: Actualizaciones del diccionario +--- + +# Actualizaciones Del Diccionario {#dictionary-updates} + +ClickHouse actualiza periódicamente los diccionarios. El intervalo de actualización para los diccionarios completamente descargados y el intervalo de invalidación para los diccionarios almacenados en caché se `` etiqueta en segundos. + +Las actualizaciones del diccionario (aparte de la carga para el primer uso) no bloquean las consultas. Durante las actualizaciones, se utiliza la versión anterior de un diccionario. Si se produce un error durante una actualización, el error se escribe en el registro del servidor y las consultas continúan utilizando la versión anterior de los diccionarios. + +Ejemplo de configuración: + +``` xml + + ... + 300 + ... + +``` + +``` sql +CREATE DICTIONARY (...) +... +LIFETIME(300) +... +``` + +Configuración `0` (`LIFETIME(0)`) impide que los diccionarios se actualicen. + +Puede establecer un intervalo de tiempo para las actualizaciones, y ClickHouse elegirá un tiempo uniformemente aleatorio dentro de este rango. Esto es necesario para distribuir la carga en la fuente del diccionario cuando se actualiza en una gran cantidad de servidores. + +Ejemplo de configuración: + +``` xml + + ... + + 300 + 360 + + ... + +``` + +o + +``` sql +LIFETIME(MIN 300 MAX 360) +``` + +Al actualizar los diccionarios, el servidor ClickHouse aplica una lógica diferente según el tipo de [fuente](external-dicts-dict-sources.md): + +- Para un archivo de texto, comprueba el tiempo de modificación. Si la hora difiere de la hora previamente grabada, el diccionario se actualiza. +- Para las tablas MyISAM, el tiempo de modificación se comprueba utilizando un `SHOW TABLE STATUS` consulta. +- Los diccionarios de otras fuentes se actualizan cada vez de forma predeterminada. + +Para fuentes MySQL (InnoDB), ODBC y ClickHouse, puede configurar una consulta que actualizará los diccionarios solo si realmente cambiaron, en lugar de cada vez. Para ello, siga estos pasos: + +- La tabla del diccionario debe tener un campo que siempre cambie cuando se actualizan los datos de origen. +- La configuración del origen debe especificar una consulta que recupere el campo de cambio. El servidor ClickHouse interpreta el resultado de la consulta como una fila, y si esta fila ha cambiado en relación con su estado anterior, el diccionario se actualiza. Especifique la consulta en el `` en la configuración de la [fuente](external-dicts-dict-sources.md). + +Ejemplo de configuración: + +``` xml + + ... + + ... + SELECT update_time FROM dictionary_source where id = 1 + + ... + +``` + +o + +``` sql +... +SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) +... +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md new file mode 100644 index 00000000000..0cdd595f087 --- /dev/null +++ b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md @@ -0,0 +1,608 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 43 +toc_title: Fuentes de diccionarios externos +--- + +# Fuentes De Diccionarios Externos {#dicts-external-dicts-dict-sources} + +Un diccionario externo se puede conectar desde muchas fuentes diferentes. + +Si el diccionario se configura usando xml-file, la configuración se ve así: + +``` xml + + + ... + + + + + + ... + + ... + +``` + +En caso de [Consulta DDL](../../statements/create.md#create-dictionary-query), la configuración igual parecerá: + +``` sql +CREATE DICTIONARY dict_name (...) +... +SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration +... +``` + +El origen está configurado en el `source` apartado. + +Tipos de fuentes (`source_type`): + +- [Archivo Local](#dicts-external_dicts_dict_sources-local_file) +- [Archivo ejecutable](#dicts-external_dicts_dict_sources-executable) +- [HTTP(s))](#dicts-external_dicts_dict_sources-http) +- DBMS + - [ODBC](#dicts-external_dicts_dict_sources-odbc) + - [MySQL](#dicts-external_dicts_dict_sources-mysql) + - [Haga clic en Casa](#dicts-external_dicts_dict_sources-clickhouse) + - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) + - [Redis](#dicts-external_dicts_dict_sources-redis) + +## Archivo Local {#dicts-external_dicts_dict_sources-local_file} + +Ejemplo de configuración: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + +``` + +o + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Configuración de campos: + +- `path` – The absolute path to the file. +- `format` – The file format. All the formats described in “[Formato](../../../interfaces/formats.md#formats)” son compatibles. + +## Archivo Ejecutable {#dicts-external_dicts_dict_sources-executable} + +Trabajar con archivos ejecutables depende de [cómo se almacena el diccionario en la memoria](external-dicts-dict-layout.md). Si el diccionario se almacena usando `cache` y `complex_key_cache`, ClickHouse solicita las claves necesarias enviando una solicitud al STDIN del archivo ejecutable. De lo contrario, ClickHouse inicia el archivo ejecutable y trata su salida como datos del diccionario. + +Ejemplo de configuración: + +``` xml + + + cat /opt/dictionaries/os.tsv + TabSeparated + + +``` + +o + +``` sql +SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Configuración de campos: + +- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). +- `format` – The file format. All the formats described in “[Formato](../../../interfaces/formats.md#formats)” son compatibles. + +## Http(s) {#dicts-external_dicts_dict_sources-http} + +Trabajar con un servidor HTTP depende de [cómo se almacena el diccionario en la memoria](external-dicts-dict-layout.md). Si el diccionario se almacena usando `cache` y `complex_key_cache`, ClickHouse solicita las claves necesarias enviando una solicitud a través del `POST` método. + +Ejemplo de configuración: + +``` xml + + + http://[::1]/os.tsv + TabSeparated + + user + password + + +
+ API-KEY + key +
+
+
+ +``` + +o + +``` sql +SOURCE(HTTP( + url 'http://[::1]/os.tsv' + format 'TabSeparated' + credentials(user 'user' password 'password') + headers(header(name 'API-KEY' value 'key')) +)) +``` + +Para que ClickHouse tenga acceso a un recurso HTTPS, debe [configurar openSSL](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-openssl) en la configuración del servidor. + +Configuración de campos: + +- `url` – The source URL. +- `format` – The file format. All the formats described in “[Formato](../../../interfaces/formats.md#formats)” son compatibles. +- `credentials` – Basic HTTP authentication. Optional parameter. + - `user` – Username required for the authentication. + - `password` – Password required for the authentication. +- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. + - `header` – Single HTTP header entry. + - `name` – Identifiant name used for the header send on the request. + - `value` – Value set for a specific identifiant name. + +## ODBC {#dicts-external_dicts_dict_sources-odbc} + +Puede utilizar este método para conectar cualquier base de datos que tenga un controlador ODBC. + +Ejemplo de configuración: + +``` xml + + + DatabaseName + ShemaName.TableName
+ DSN=some_parameters + SQL_QUERY +
+ +``` + +o + +``` sql +SOURCE(ODBC( + db 'DatabaseName' + table 'SchemaName.TableName' + connection_string 'DSN=some_parameters' + invalidate_query 'SQL_QUERY' +)) +``` + +Configuración de campos: + +- `db` – Name of the database. Omit it if the database name is set in the `` parámetros. +- `table` – Name of the table and schema if exists. +- `connection_string` – Connection string. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Actualización de diccionarios](external-dicts-dict-lifetime.md). + +ClickHouse recibe símbolos de cotización del controlador ODBC y cita todas las configuraciones en las consultas al controlador, por lo que es necesario establecer el nombre de la tabla de acuerdo con el caso del nombre de la tabla en la base de datos. + +Si tiene problemas con las codificaciones al utilizar Oracle, consulte el [FAQ](../../../faq/general.md#oracle-odbc-encodings) artículo. + +### Vulnerabilidad Conocida De La Funcionalidad Del Diccionario ODBC {#known-vulnerability-of-the-odbc-dictionary-functionality} + +!!! attention "Atención" + Cuando se conecta a la base de datos a través del parámetro de conexión del controlador ODBC `Servername` puede ser sustituido. En este caso los valores de `USERNAME` y `PASSWORD` de `odbc.ini` se envían al servidor remoto y pueden verse comprometidos. + +**Ejemplo de uso inseguro** + +Vamos a configurar unixODBC para PostgreSQL. Contenido de `/etc/odbc.ini`: + +``` text +[gregtest] +Driver = /usr/lib/psqlodbca.so +Servername = localhost +PORT = 5432 +DATABASE = test_db +#OPTION = 3 +USERNAME = test +PASSWORD = test +``` + +Si luego realiza una consulta como + +``` sql +SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); +``` + +El controlador ODBC enviará valores de `USERNAME` y `PASSWORD` de `odbc.ini` a `some-server.com`. + +### Ejemplo De conexión Postgresql {#example-of-connecting-postgresql} + +Sistema operativo Ubuntu. + +Instalación de unixODBC y el controlador ODBC para PostgreSQL: + +``` bash +$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql +``` + +Configuración `/etc/odbc.ini` (o `~/.odbc.ini`): + +``` text + [DEFAULT] + Driver = myconnection + + [myconnection] + Description = PostgreSQL connection to my_db + Driver = PostgreSQL Unicode + Database = my_db + Servername = 127.0.0.1 + UserName = username + Password = password + Port = 5432 + Protocol = 9.3 + ReadOnly = No + RowVersioning = No + ShowSystemTables = No + ConnSettings = +``` + +La configuración del diccionario en ClickHouse: + +``` xml + + + table_name + + + + + DSN=myconnection + postgresql_table
+
+ + + 300 + 360 + + + + + + + id + + + some_column + UInt64 + 0 + + +
+
+``` + +o + +``` sql +CREATE DICTIONARY table_name ( + id UInt64, + some_column UInt64 DEFAULT 0 +) +PRIMARY KEY id +SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) +LAYOUT(HASHED()) +LIFETIME(MIN 300 MAX 360) +``` + +Es posible que tenga que editar `odbc.ini` para especificar la ruta completa a la biblioteca con el controlador `DRIVER=/usr/local/lib/psqlodbcw.so`. + +### Ejemplo De conexión De MS SQL Server {#example-of-connecting-ms-sql-server} + +Sistema operativo Ubuntu. + +Instalación del controlador: : + +``` bash +$ sudo apt-get install tdsodbc freetds-bin sqsh +``` + +Configuración del controlador: + +``` bash + $ cat /etc/freetds/freetds.conf + ... + + [MSSQL] + host = 192.168.56.101 + port = 1433 + tds version = 7.0 + client charset = UTF-8 + + $ cat /etc/odbcinst.ini + ... + + [FreeTDS] + Description = FreeTDS + Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so + Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so + FileUsage = 1 + UsageCount = 5 + + $ cat ~/.odbc.ini + ... + + [MSSQL] + Description = FreeTDS + Driver = FreeTDS + Servername = MSSQL + Database = test + UID = test + PWD = test + Port = 1433 +``` + +Configuración del diccionario en ClickHouse: + +``` xml + + + test + + + dict
+ DSN=MSSQL;UID=test;PWD=test +
+ + + + 300 + 360 + + + + + + + + + k + + + s + String + + + +
+
+``` + +o + +``` sql +CREATE DICTIONARY test ( + k UInt64, + s String DEFAULT '' +) +PRIMARY KEY k +SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) +LAYOUT(FLAT()) +LIFETIME(MIN 300 MAX 360) +``` + +## DBMS {#dbms} + +### Mysql {#dicts-external_dicts_dict_sources-mysql} + +Ejemplo de configuración: + +``` xml + + + 3306 + clickhouse + qwerty + + example01-1 + 1 + + + example01-2 + 1 + + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +o + +``` sql +SOURCE(MYSQL( + port 3306 + user 'clickhouse' + password 'qwerty' + replica(host 'example01-1' priority 1) + replica(host 'example01-2' priority 1) + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +Configuración de campos: + +- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). + +- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `replica` – Section of replica configurations. There can be multiple sections. + + - `replica/host` – The MySQL host. + - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. + +- `db` – Name of the database. + +- `table` – Name of the table. + +- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` cláusula en MySQL, por ejemplo, `id > 10 AND id < 20`. Parámetro opcional. + +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Actualización de diccionarios](external-dicts-dict-lifetime.md). + +MySQL se puede conectar en un host local a través de sockets. Para hacer esto, establezca `host` y `socket`. + +Ejemplo de configuración: + +``` xml + + + localhost + /path/to/socket/file.sock + clickhouse + qwerty + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +o + +``` sql +SOURCE(MYSQL( + host 'localhost' + socket '/path/to/socket/file.sock' + user 'clickhouse' + password 'qwerty' + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +### Inicio {#dicts-external_dicts_dict_sources-clickhouse} + +Ejemplo de configuración: + +``` xml + + + example01-01-1 + 9000 + default + + default + ids
+ id=10 +
+ +``` + +o + +``` sql +SOURCE(CLICKHOUSE( + host 'example01-01-1' + port 9000 + user 'default' + password '' + db 'default' + table 'ids' + where 'id=10' +)) +``` + +Configuración de campos: + +- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [Distribuido](../../../engines/table-engines/special/distributed.md) tabla e ingrésela en configuraciones posteriores. +- `port` – The port on the ClickHouse server. +- `user` – Name of the ClickHouse user. +- `password` – Password of the ClickHouse user. +- `db` – Name of the database. +- `table` – Name of the table. +- `where` – The selection criteria. May be omitted. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Actualización de diccionarios](external-dicts-dict-lifetime.md). + +### Mongodb {#dicts-external_dicts_dict_sources-mongodb} + +Ejemplo de configuración: + +``` xml + + + localhost + 27017 + + + test + dictionary_source + + +``` + +o + +``` sql +SOURCE(MONGO( + host 'localhost' + port 27017 + user '' + password '' + db 'test' + collection 'dictionary_source' +)) +``` + +Configuración de campos: + +- `host` – The MongoDB host. +- `port` – The port on the MongoDB server. +- `user` – Name of the MongoDB user. +- `password` – Password of the MongoDB user. +- `db` – Name of the database. +- `collection` – Name of the collection. + +### Redis {#dicts-external_dicts_dict_sources-redis} + +Ejemplo de configuración: + +``` xml + + + localhost + 6379 + simple + 0 + + +``` + +o + +``` sql +SOURCE(REDIS( + host 'localhost' + port 6379 + storage_type 'simple' + db_index 0 +)) +``` + +Configuración de campos: + +- `host` – The Redis host. +- `port` – The port on the Redis server. +- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` es para fuentes simples y para fuentes de clave única hash, `hash_map` es para fuentes hash con dos teclas. Los orígenes a distancia y los orígenes de caché con clave compleja no son compatibles. Puede omitirse, el valor predeterminado es `simple`. +- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md new file mode 100644 index 00000000000..ae476803b3c --- /dev/null +++ b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 44 +toc_title: Clave y campos del diccionario +--- + +# Clave y Campos Del Diccionario {#dictionary-key-and-fields} + +El `` cláusula describe la clave del diccionario y los campos disponibles para consultas. + +Descripción XML: + +``` xml + + + + Id + + + + + + + ... + + + +``` + +Los atributos se describen en los elementos: + +- `` — [Columna clave](external-dicts-dict-structure.md#ext_dict_structure-key). +- `` — [Columna de datos](external-dicts-dict-structure.md#ext_dict_structure-attributes). Puede haber un número múltiple de atributos. + +Consulta DDL: + +``` sql +CREATE DICTIONARY dict_name ( + Id UInt64, + -- attributes +) +PRIMARY KEY Id +... +``` + +Los atributos se describen en el cuerpo de la consulta: + +- `PRIMARY KEY` — [Columna clave](external-dicts-dict-structure.md#ext_dict_structure-key) +- `AttrName AttrType` — [Columna de datos](external-dicts-dict-structure.md#ext_dict_structure-attributes). Puede haber un número múltiple de atributos. + +## Clave {#ext_dict_structure-key} + +ClickHouse admite los siguientes tipos de claves: + +- Tecla numérica. `UInt64`. Definido en el `` etiqueta o usando `PRIMARY KEY` palabra clave. +- Clave compuesta. Conjunto de valores de diferentes tipos. Definido en la etiqueta `` o `PRIMARY KEY` palabra clave. + +Una estructura xml puede contener `` o ``. La consulta DDL debe contener `PRIMARY KEY`. + +!!! warning "Advertencia" + No debe describir la clave como un atributo. + +### Tecla numérica {#ext_dict-numeric-key} + +Tipo: `UInt64`. + +Ejemplo de configuración: + +``` xml + + Id + +``` + +Campos de configuración: + +- `name` – The name of the column with keys. + +Para consulta DDL: + +``` sql +CREATE DICTIONARY ( + Id UInt64, + ... +) +PRIMARY KEY Id +... +``` + +- `PRIMARY KEY` – The name of the column with keys. + +### Clave Compuesta {#composite-key} + +La clave puede ser un `tuple` de cualquier tipo de campo. El [diseño](external-dicts-dict-layout.md) en este caso debe ser `complex_key_hashed` o `complex_key_cache`. + +!!! tip "Consejo" + Una clave compuesta puede consistir en un solo elemento. Esto hace posible usar una cadena como clave, por ejemplo. + +La estructura clave se establece en el elemento ``. Los campos clave se especifican en el mismo formato que el diccionario [atributo](external-dicts-dict-structure.md). Ejemplo: + +``` xml + + + + field1 + String + + + field2 + UInt32 + + ... + +... +``` + +o + +``` sql +CREATE DICTIONARY ( + field1 String, + field2 String + ... +) +PRIMARY KEY field1, field2 +... +``` + +Para una consulta al `dictGet*` función, una tupla se pasa como la clave. Ejemplo: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. + +## Atributo {#ext_dict_structure-attributes} + +Ejemplo de configuración: + +``` xml + + ... + + Name + ClickHouseDataType + + rand64() + true + true + true + + +``` + +o + +``` sql +CREATE DICTIONARY somename ( + Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID +) +``` + +Campos de configuración: + +| Etiqueta | Descripci | Requerir | +|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| +| `name` | Nombre de columna. | Sí | +| `type` | Tipo de datos ClickHouse.
ClickHouse intenta convertir el valor del diccionario al tipo de datos especificado. Por ejemplo, para MySQL, el campo podría ser `TEXT`, `VARCHAR`, o `BLOB` en la tabla fuente de MySQL, pero se puede cargar como `String` en ClickHouse.
[NULL](../../../sql-reference/data-types/nullable.md) no es compatible. | Sí | +| `null_value` | Valor predeterminado para un elemento no existente.
En el ejemplo, es una cadena vacía. No se puede utilizar `NULL` en este campo. | Sí | +| `expression` | [Expresion](../../syntax.md#syntax-expressions) que ClickHouse ejecuta en el valor.
La expresión puede ser un nombre de columna en la base de datos SQL remota. Por lo tanto, puede usarlo para crear un alias para la columna remota.

Valor predeterminado: sin expresión. | No | +| `hierarchical` | Si `true` el atributo contiene el valor de una clave primaria para la clave actual. Ver [Diccionarios jerárquicos](external-dicts-dict-hierarchical.md).

Valor predeterminado: `false`. | No | +| `injective` | Indicador que muestra si el `id -> attribute` la imagen es [inyectivo](https://en.wikipedia.org/wiki/Injective_function).
Si `true`, ClickHouse puede colocar automáticamente después de la `GROUP BY` cláusula las solicitudes a los diccionarios con inyección. Por lo general, reduce significativamente la cantidad de tales solicitudes.

Valor predeterminado: `false`. | No | +| `is_object_id` | Indicador que muestra si la consulta se ejecuta para un documento MongoDB mediante `ObjectID`.

Valor predeterminado: `false`. | No | + +## Ver también {#see-also} + +- [Funciones para trabajar con diccionarios externos](../../../sql-reference/functions/ext-dict-functions.md). + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md new file mode 100644 index 00000000000..b9137e794e3 --- /dev/null +++ b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md @@ -0,0 +1,53 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 40 +toc_title: "Configuraci\xF3n de un diccionario externo" +--- + +# Configuración De Un Diccionario Externo {#dicts-external-dicts-dict} + +Si el diccionario se configura usando un archivo xml, la configuración del diccionario tiene la siguiente estructura: + +``` xml + + dict_name + + + + + + + + + + + + + + + + + +``` + +Correspondiente [Consulta DDL](../../statements/create.md#create-dictionary-query) tiene la siguiente estructura: + +``` sql +CREATE DICTIONARY dict_name +( + ... -- attributes +) +PRIMARY KEY ... -- complex or single key configuration +SOURCE(...) -- Source configuration +LAYOUT(...) -- Memory layout configuration +LIFETIME(...) -- Lifetime of dictionary in memory +``` + +- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. +- [fuente](external-dicts-dict-sources.md) — Source of the dictionary. +- [diseño](external-dicts-dict-layout.md) — Dictionary layout in memory. +- [estructura](external-dicts-dict-structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. +- [vida](external-dicts-dict-lifetime.md) — Frequency of dictionary updates. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts.md b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts.md new file mode 100644 index 00000000000..5588f6e5ecc --- /dev/null +++ b/docs/es/sql-reference/dictionaries/external-dictionaries/external-dicts.md @@ -0,0 +1,56 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 39 +toc_title: "Descripci\xF3n General" +--- + +# Diccionarios Externos {#dicts-external-dicts} + +Puede agregar sus propios diccionarios de varias fuentes de datos. El origen de datos de un diccionario puede ser un archivo ejecutable o de texto local, un recurso HTTP u otro DBMS. Para obtener más información, consulte “[Fuentes para diccionarios externos](external-dicts-dict-sources.md)”. + +Haga clic en Casa: + +- Almacena total o parcialmente los diccionarios en RAM. +- Actualiza periódicamente los diccionarios y carga dinámicamente los valores que faltan. En otras palabras, los diccionarios se pueden cargar dinámicamente. +- Permite crear diccionarios externos con archivos xml o [Consultas DDL](../../statements/create.md#create-dictionary-query). + +La configuración de diccionarios externos se puede ubicar en uno o más archivos xml. La ruta de acceso a la configuración se especifica en el [Diccionarios\_config](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_config) parámetro. + +Los diccionarios se pueden cargar en el inicio del servidor o en el primer uso, dependiendo de la [Diccionarios\_lazy\_load](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) configuración. + +El archivo de configuración del diccionario tiene el siguiente formato: + +``` xml + + An optional element with any content. Ignored by the ClickHouse server. + + + /etc/metrika.xml + + + + + + + + +``` + +Usted puede [configurar](external-dicts-dict.md) cualquier número de diccionarios en el mismo archivo. + +[Consultas DDL para diccionarios](../../statements/create.md#create-dictionary-query) no requiere ningún registro adicional en la configuración del servidor. Permiten trabajar con diccionarios como entidades de primera clase, como tablas o vistas. + +!!! attention "Atención" + Puede convertir valores para un diccionario pequeño describiéndolo en un `SELECT` consulta (ver el [transformar](../../../sql-reference/functions/other-functions.md) función). Esta funcionalidad no está relacionada con diccionarios externos. + +## Ver también {#ext-dicts-see-also} + +- [Configuración de un diccionario externo](external-dicts-dict.md) +- [Almacenamiento de diccionarios en la memoria](external-dicts-dict-layout.md) +- [Actualizaciones del diccionario](external-dicts-dict-lifetime.md) +- [Fuentes de diccionarios externos](external-dicts-dict-sources.md) +- [Clave y campos del diccionario](external-dicts-dict-structure.md) +- [Funciones para trabajar con diccionarios externos](../../../sql-reference/functions/ext-dict-functions.md) + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/index.md b/docs/es/sql-reference/dictionaries/external-dictionaries/index.md similarity index 100% rename from docs/es/sql_reference/dictionaries/external_dictionaries/index.md rename to docs/es/sql-reference/dictionaries/external-dictionaries/index.md diff --git a/docs/es/sql-reference/dictionaries/index.md b/docs/es/sql-reference/dictionaries/index.md new file mode 100644 index 00000000000..ec0992758dc --- /dev/null +++ b/docs/es/sql-reference/dictionaries/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Dictionaries +toc_priority: 35 +toc_title: "Implantaci\xF3n" +--- + +# Diccionario {#dictionaries} + +Un diccionario es un mapeo (`key -> attributes`) que es conveniente para varios tipos de listas de referencia. + +ClickHouse admite funciones especiales para trabajar con diccionarios que se pueden usar en consultas. Es más fácil y más eficiente usar diccionarios con funciones que un `JOIN` con tablas de referencia. + +[NULL](../syntax.md#null) los valores no se pueden almacenar en un diccionario. + +Soporta ClickHouse: + +- [Diccionarios incorporados](internal-dicts.md#internal_dicts) con una específica [conjunto de funciones](../../sql-reference/functions/ym-dict-functions.md). +- [Diccionarios complementarios (externos)](external-dictionaries/external-dicts.md) con un [neto de funciones](../../sql-reference/functions/ext-dict-functions.md). + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/es/sql-reference/dictionaries/internal-dicts.md b/docs/es/sql-reference/dictionaries/internal-dicts.md new file mode 100644 index 00000000000..158d3d1c5fd --- /dev/null +++ b/docs/es/sql-reference/dictionaries/internal-dicts.md @@ -0,0 +1,55 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 39 +toc_title: Diccionarios internos +--- + +# Diccionarios Internos {#internal_dicts} + +ClickHouse contiene una función integrada para trabajar con una geobase. + +Esto le permite: + +- Utilice el ID de una región para obtener su nombre en el idioma deseado. +- Utilice el ID de una región para obtener el ID de una ciudad, área, distrito federal, país o continente. +- Compruebe si una región es parte de otra región. +- Obtener una cadena de regiones principales. + +Todas las funciones de apoyo “translocality,” la capacidad de utilizar simultáneamente diferentes perspectivas sobre la propiedad de la región. Para obtener más información, consulte la sección “Functions for working with Yandex.Metrica dictionaries”. + +Los diccionarios internos están deshabilitados en el paquete predeterminado. +Para habilitarlos, descomente los parámetros `path_to_regions_hierarchy_file` y `path_to_regions_names_files` en el archivo de configuración del servidor. + +La geobase se carga desde archivos de texto. + +Coloque el `regions_hierarchy*.txt` archivos en el `path_to_regions_hierarchy_file` directorio. Este parámetro de configuración debe contener la ruta `regions_hierarchy.txt` archivo (la jerarquía regional predeterminada), y los otros archivos (`regions_hierarchy_ua.txt`) debe estar ubicado en el mismo directorio. + +Ponga el `regions_names_*.txt` archivos en el `path_to_regions_names_files` directorio. + +También puede crear estos archivos usted mismo. El formato de archivo es el siguiente: + +`regions_hierarchy*.txt`: TabSeparated (sin encabezado), columnas: + +- ID de la región (`UInt32`) +- ID de región padre (`UInt32`) +- tipo de región (`UInt8`): 1 - continente, 3 - país, 4 - distrito federal, 5 - región, 6 - ciudad; otros tipos no tienen valores +- población (`UInt32`) — optional column + +`regions_names_*.txt`: TabSeparated (sin encabezado), columnas: + +- ID de la región (`UInt32`) +- nombre de la región (`String`) — Can’t contain tabs or line feeds, even escaped ones. + +Una matriz plana se usa para almacenar en RAM. Por esta razón, los ID no deberían ser más de un millón. + +Los diccionarios se pueden actualizar sin reiniciar el servidor. Sin embargo, el conjunto de diccionarios disponibles no se actualiza. +Para las actualizaciones, se comprueban los tiempos de modificación de archivos. Si un archivo ha cambiado, el diccionario se actualiza. +El intervalo para comprobar si hay cambios se configura en el `builtin_dictionaries_reload_interval` parámetro. +Las actualizaciones del diccionario (aparte de la carga al primer uso) no bloquean las consultas. Durante las actualizaciones, las consultas utilizan las versiones anteriores de los diccionarios. Si se produce un error durante una actualización, el error se escribe en el registro del servidor y las consultas continúan utilizando la versión anterior de los diccionarios. + +Recomendamos actualizar periódicamente los diccionarios con la geobase. Durante una actualización, genere nuevos archivos y escríbalos en una ubicación separada. Cuando todo esté listo, cambie el nombre a los archivos utilizados por el servidor. + +También hay funciones para trabajar con identificadores de sistema operativo y Yandex.Motores de búsqueda Metrica, pero no deben ser utilizados. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/es/sql-reference/functions/arithmetic-functions.md b/docs/es/sql-reference/functions/arithmetic-functions.md new file mode 100644 index 00000000000..9fe8c0f97b0 --- /dev/null +++ b/docs/es/sql-reference/functions/arithmetic-functions.md @@ -0,0 +1,87 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 35 +toc_title: "Aritm\xE9tica" +--- + +# Funciones aritméticas {#arithmetic-functions} + +Para todas las funciones aritméticas, el tipo de resultado se calcula como el tipo de número más pequeño en el que encaja el resultado, si existe dicho tipo. El mínimo se toma simultáneamente en función del número de bits, si está firmado y si flota. Si no hay suficientes bits, se toma el tipo de bit más alto. + +Ejemplo: + +``` sql +SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) +``` + +``` text +┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ +│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ +└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ +``` + +Las funciones aritméticas funcionan para cualquier par de tipos de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 o Float64. + +El desbordamiento se produce de la misma manera que en C ++. + +## más (a, b), a + b operador {#plusa-b-a-b-operator} + +Calcula la suma de los números. +También puede agregar números enteros con una fecha o fecha y hora. En el caso de una fecha, agregar un entero significa agregar el número correspondiente de días. Para una fecha con hora, significa agregar el número correspondiente de segundos. + +## menos(a, b), a - b operador {#minusa-b-a-b-operator} + +Calcula la diferencia. El resultado siempre está firmado. + +You can also calculate integer numbers from a date or date with time. The idea is the same – see above for ‘plus’. + +## multiplicar(a, b) a \* b operador {#multiplya-b-a-b-operator} + +Calcula el producto de los números. + +## divide (a, b), operador a / b {#dividea-b-a-b-operator} + +Calcula el cociente de los números. El tipo de resultado es siempre un tipo de punto flotante. +No es una división entera. Para la división de enteros, use el ‘intDiv’ función. +Al dividir por cero obtienes ‘inf’, ‘-inf’, o ‘nan’. + +## Información De Uso) {#intdiva-b} + +Calcula el cociente de los números. Se divide en enteros, redondeando hacia abajo (por el valor absoluto). +Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. + +## IntDivOrZero (a, B) {#intdivorzeroa-b} + +Difiere de ‘intDiv’ en que devuelve cero al dividir por cero o al dividir un número negativo mínimo por menos uno. + +## modulo(a, b), a % b operador {#moduloa-b-a-b-operator} + +Calcula el resto después de la división. +Si los argumentos son números de coma flotante, se convierten previamente en enteros eliminando la parte decimal. +El resto se toma en el mismo sentido que en C ++. La división truncada se usa para números negativos. +Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. + +## moduloOrZero (a, b) {#moduloorzeroa-b} + +Difiere de ‘modulo’ en que devuelve cero cuando el divisor es cero. + +## negate(a), -un operador {#negatea-a-operator} + +Calcula un número con el signo inverso. El resultado siempre está firmado. + +## abs (a) {#arithm_func-abs} + +Calcula el valor absoluto del número (a). Es decir, si un \<0, devuelve -a . Para los tipos sin firmar no hace nada. Para los tipos de enteros con signo, devuelve un número sin signo. + +## GCD (a, B) {#gcda-b} + +Devuelve el mayor divisor común de los números. +Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. + +## Lcm(a, B) {#lcma-b} + +Devuelve el mínimo múltiplo común de los números. +Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/es/sql-reference/functions/array-functions.md b/docs/es/sql-reference/functions/array-functions.md new file mode 100644 index 00000000000..6c3fc8d4f1c --- /dev/null +++ b/docs/es/sql-reference/functions/array-functions.md @@ -0,0 +1,1057 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 46 +toc_title: Trabajar con matrices +--- + +# Funciones Para Trabajar Con Matrices {#functions-for-working-with-arrays} + +## vaciar {#function-empty} + +Devuelve 1 para una matriz vacía, o 0 para una matriz no vacía. +El tipo de resultado es UInt8. +La función también funciona para cadenas. + +## notEmpty {#function-notempty} + +Devuelve 0 para una matriz vacía, o 1 para una matriz no vacía. +El tipo de resultado es UInt8. +La función también funciona para cadenas. + +## longitud {#array_functions-length} + +Devuelve el número de elementos de la matriz. +El tipo de resultado es UInt64. +La función también funciona para cadenas. + +## Para Obtener más información, Consulta Nuestra Política De Privacidad y Nuestras Condiciones De Uso {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} + +## Para Obtener más información, Consulta Nuestra Política De Privacidad y Nuestras Condiciones De Uso {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} + +## Para Obtener más información, Consulta Nuestra Política De Privacidad y Nuestras Condiciones De Uso {#emptyarrayfloat32-emptyarrayfloat64} + +## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} + +## emptyArrayString {#emptyarraystring} + +Acepta cero argumentos y devuelve una matriz vacía del tipo apropiado. + +## emptyArrayToSingle {#emptyarraytosingle} + +Acepta una matriz vacía y devuelve una matriz de un elemento que es igual al valor predeterminado. + +## rango(final), rango(inicio, fin \[, paso\]) {#rangeend-rangestart-end-step} + +Devuelve una matriz de números de principio a fin-1 por paso. +Si el argumento `start` no se especifica, el valor predeterminado es 0. +Si el argumento `step` no se especifica, el valor predeterminado es 1. +Se comporta casi como pitónico `range`. Pero la diferencia es que todos los tipos de argumentos deben ser `UInt` numero. +Por si acaso, se produce una excepción si se crean matrices con una longitud total de más de 100,000,000 de elementos en un bloque de datos. + +## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} + +Crea una matriz a partir de los argumentos de la función. +Los argumentos deben ser constantes y tener tipos que tengan el tipo común más pequeño. Se debe pasar al menos un argumento, porque de lo contrario no está claro qué tipo de matriz crear. Es decir, no puede usar esta función para crear una matriz vacía (para hacerlo, use el ‘emptyArray\*’ función descrita anteriormente). +Devuelve un ‘Array(T)’ tipo resultado, donde ‘T’ es el tipo común más pequeño de los argumentos pasados. + +## arrayConcat {#arrayconcat} + +Combina matrices pasadas como argumentos. + +``` sql +arrayConcat(arrays) +``` + +**Parámetros** + +- `arrays` – Arbitrary number of arguments of [Matriz](../../sql-reference/data-types/array.md) tipo. + **Ejemplo** + + + +``` sql +SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,3,4,5,6] │ +└───────────────┘ +``` + +## Por Ejemplo, El Operador Arr\[n\] {#arrayelementarr-n-operator-arrn} + +Obtener el elemento con el índice `n` de la matriz `arr`. `n` debe ser de cualquier tipo entero. +Los índices de una matriz comienzan desde uno. +Los índices negativos son compatibles. En este caso, selecciona el elemento correspondiente numerado desde el final. Por ejemplo, `arr[-1]` es el último elemento de la matriz. + +Si el índice cae fuera de los límites de una matriz, devuelve algún valor predeterminado (0 para números, una cadena vacía para cadenas, etc.), a excepción del caso con una matriz no constante y un índice constante 0 (en este caso habrá un error `Array indices are 1-based`). + +## Tiene(arr, Elem) {#hasarr-elem} + +Comprueba si el ‘arr’ la matriz tiene el ‘elem’ elemento. +Devuelve 0 si el elemento no está en la matriz, o 1 si es. + +`NULL` se procesa como un valor. + +``` sql +SELECT has([1, 2, NULL], NULL) +``` + +``` text +┌─has([1, 2, NULL], NULL)─┐ +│ 1 │ +└─────────────────────────┘ +``` + +## TieneTodo {#hasall} + +Comprueba si una matriz es un subconjunto de otra. + +``` sql +hasAll(set, subset) +``` + +**Parámetros** + +- `set` – Array of any type with a set of elements. +- `subset` – Array of any type with elements that should be tested to be a subset of `set`. + +**Valores de retorno** + +- `1`, si `set` contiene todos los elementos de `subset`. +- `0`, de lo contrario. + +**Propiedades peculiares** + +- Una matriz vacía es un subconjunto de cualquier matriz. +- `Null` procesado como un valor. +- El orden de los valores en ambas matrices no importa. + +**Ejemplos** + +`SELECT hasAll([], [])` devoluciones 1. + +`SELECT hasAll([1, Null], [Null])` devoluciones 1. + +`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` devoluciones 1. + +`SELECT hasAll(['a', 'b'], ['a'])` devoluciones 1. + +`SELECT hasAll([1], ['a'])` devuelve 0. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` devuelve 0. + +## TieneCualquier {#hasany} + +Comprueba si dos matrices tienen intersección por algunos elementos. + +``` sql +hasAny(array1, array2) +``` + +**Parámetros** + +- `array1` – Array of any type with a set of elements. +- `array2` – Array of any type with a set of elements. + +**Valores de retorno** + +- `1`, si `array1` y `array2` tienen un elemento similar al menos. +- `0`, de lo contrario. + +**Propiedades peculiares** + +- `Null` procesado como un valor. +- El orden de los valores en ambas matrices no importa. + +**Ejemplos** + +`SELECT hasAny([1], [])` devoluciones `0`. + +`SELECT hasAny([Null], [Null, 1])` devoluciones `1`. + +`SELECT hasAny([-128, 1., 512], [1])` devoluciones `1`. + +`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` devoluciones `0`. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` devoluciones `1`. + +## ¿Cómo puedo hacerlo?) {#indexofarr-x} + +Devuelve el índice de la primera ‘x’ elemento (comenzando desde 1) si está en la matriz, o 0 si no lo está. + +Ejemplo: + +``` sql +SELECT indexOf([1, 3, NULL, NULL], NULL) +``` + +``` text +┌─indexOf([1, 3, NULL, NULL], NULL)─┐ +│ 3 │ +└───────────────────────────────────┘ +``` + +Elementos establecidos en `NULL` se manejan como valores normales. + +## Cuenta Igual (arr, X) {#countequalarr-x} + +Devuelve el número de elementos de la matriz igual a x. Equivalente a arrayCount (elem -\> elem = x, arr). + +`NULL` los elementos se manejan como valores separados. + +Ejemplo: + +``` sql +SELECT countEqual([1, 2, NULL, NULL], NULL) +``` + +``` text +┌─countEqual([1, 2, NULL, NULL], NULL)─┐ +│ 2 │ +└──────────────────────────────────────┘ +``` + +## Información Detallada) {#array_functions-arrayenumerate} + +Returns the array \[1, 2, 3, …, length (arr) \] + +Esta función se utiliza normalmente con ARRAY JOIN. Permite contar algo solo una vez para cada matriz después de aplicar ARRAY JOIN . Ejemplo: + +``` sql +SELECT + count() AS Reaches, + countIf(num = 1) AS Hits +FROM test.hits +ARRAY JOIN + GoalsReached, + arrayEnumerate(GoalsReached) AS num +WHERE CounterID = 160656 +LIMIT 10 +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +En este ejemplo, Reaches es el número de conversiones (las cadenas recibidas después de aplicar ARRAY JOIN) y Hits es el número de páginas vistas (cadenas antes de ARRAY JOIN). En este caso particular, puede obtener el mismo resultado de una manera más fácil: + +``` sql +SELECT + sum(length(GoalsReached)) AS Reaches, + count() AS Hits +FROM test.hits +WHERE (CounterID = 160656) AND notEmpty(GoalsReached) +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +Esta función también se puede utilizar en funciones de orden superior. Por ejemplo, puede usarlo para obtener índices de matriz para elementos que coinciden con una condición. + +## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} + +Devuelve una matriz del mismo tamaño que la matriz de origen, indicando para cada elemento cuál es su posición entre los elementos con el mismo valor. +Por ejemplo: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. + +Esta función es útil cuando se utiliza ARRAY JOIN y la agregación de elementos de matriz. +Ejemplo: + +``` sql +SELECT + Goals.ID AS GoalID, + sum(Sign) AS Reaches, + sumIf(Sign, num = 1) AS Visits +FROM test.visits +ARRAY JOIN + Goals, + arrayEnumerateUniq(Goals.ID) AS num +WHERE CounterID = 160656 +GROUP BY GoalID +ORDER BY Reaches DESC +LIMIT 10 +``` + +``` text +┌──GoalID─┬─Reaches─┬─Visits─┐ +│ 53225 │ 3214 │ 1097 │ +│ 2825062 │ 3188 │ 1097 │ +│ 56600 │ 2803 │ 488 │ +│ 1989037 │ 2401 │ 365 │ +│ 2830064 │ 2396 │ 910 │ +│ 1113562 │ 2372 │ 373 │ +│ 3270895 │ 2262 │ 812 │ +│ 1084657 │ 2262 │ 345 │ +│ 56599 │ 2260 │ 799 │ +│ 3271094 │ 2256 │ 812 │ +└─────────┴─────────┴────────┘ +``` + +En este ejemplo, cada ID de objetivo tiene un cálculo del número de conversiones (cada elemento de la estructura de datos anidados Objetivos es un objetivo alcanzado, al que nos referimos como conversión) y el número de sesiones. Sin ARRAY JOIN, habríamos contado el número de sesiones como sum(Sign) . Pero en este caso particular, las filas se multiplicaron por la estructura de Objetivos anidados, por lo que para contar cada sesión una vez después de esto, aplicamos una condición al valor de la función arrayEnumerateUniq(Goals.ID) . + +La función arrayEnumerateUniq puede tomar varias matrices del mismo tamaño que los argumentos. En este caso, la singularidad se considera para tuplas de elementos en las mismas posiciones en todas las matrices. + +``` sql +SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,1,1,2,1] │ +└───────────────┘ +``` + +Esto es necesario cuando se utiliza ARRAY JOIN con una estructura de datos anidados y una agregación adicional a través de múltiples elementos de esta estructura. + +## arrayPopBack {#arraypopback} + +Quita el último elemento de la matriz. + +``` sql +arrayPopBack(array) +``` + +**Parámetros** + +- `array` – Array. + +**Ejemplo** + +``` sql +SELECT arrayPopBack([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## arrayPopFront {#arraypopfront} + +Quita el primer elemento de la matriz. + +``` sql +arrayPopFront(array) +``` + +**Parámetros** + +- `array` – Array. + +**Ejemplo** + +``` sql +SELECT arrayPopFront([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [2,3] │ +└───────┘ +``` + +## arrayPushBack {#arraypushback} + +Agrega un elemento al final de la matriz. + +``` sql +arrayPushBack(array, single_value) +``` + +**Parámetros** + +- `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` tipo para el tipo de datos de la matriz. Para obtener más información sobre los tipos de datos en ClickHouse, consulte “[Tipos de datos](../../sql-reference/data-types/index.md#data_types)”. Puede ser `NULL`. La función agrega un `NULL` elemento de matriz a una matriz, y el tipo de elementos de matriz se convierte en `Nullable`. + +**Ejemplo** + +``` sql +SELECT arrayPushBack(['a'], 'b') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayPushFront {#arraypushfront} + +Agrega un elemento al principio de la matriz. + +``` sql +arrayPushFront(array, single_value) +``` + +**Parámetros** + +- `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` tipo para el tipo de datos de la matriz. Para obtener más información sobre los tipos de datos en ClickHouse, consulte “[Tipos de datos](../../sql-reference/data-types/index.md#data_types)”. Puede ser `NULL`. La función agrega un `NULL` elemento de matriz a una matriz, y el tipo de elementos de matriz se convierte en `Nullable`. + +**Ejemplo** + +``` sql +SELECT arrayPushFront(['b'], 'a') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayResize {#arrayresize} + +Cambia la longitud de la matriz. + +``` sql +arrayResize(array, size[, extender]) +``` + +**Parámetros:** + +- `array` — Array. +- `size` — Required length of the array. + - Si `size` es menor que el tamaño original de la matriz, la matriz se trunca desde la derecha. +- Si `size` es mayor que el tamaño inicial de la matriz, la matriz se extiende a la derecha con `extender` valores predeterminados para el tipo de datos de los elementos de la matriz. +- `extender` — Value for extending an array. Can be `NULL`. + +**Valor devuelto:** + +Una matriz de longitud `size`. + +**Ejemplos de llamadas** + +``` sql +SELECT arrayResize([1], 3) +``` + +``` text +┌─arrayResize([1], 3)─┐ +│ [1,0,0] │ +└─────────────────────┘ +``` + +``` sql +SELECT arrayResize([1], 3, NULL) +``` + +``` text +┌─arrayResize([1], 3, NULL)─┐ +│ [1,NULL,NULL] │ +└───────────────────────────┘ +``` + +## arraySlice {#arrayslice} + +Devuelve una porción de la matriz. + +``` sql +arraySlice(array, offset[, length]) +``` + +**Parámetros** + +- `array` – Array of data. +- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. +- `length` - La longitud de la porción requerida. Si especifica un valor negativo, la función devuelve un segmento abierto `[offset, array_length - length)`. Si omite el valor, la función devuelve el sector `[offset, the_end_of_array]`. + +**Ejemplo** + +``` sql +SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res +``` + +``` text +┌─res────────┐ +│ [2,NULL,4] │ +└────────────┘ +``` + +Elementos de matriz establecidos en `NULL` se manejan como valores normales. + +## arraySort(\[func,\] arr, …) {#array_functions-sort} + +Ordena los elementos del `arr` matriz en orden ascendente. Si el `func` se especifica la función, el orden de clasificación está determinado por el resultado `func` función aplicada a los elementos de la matriz. Si `func` acepta múltiples argumentos, el `arraySort` función se pasa varias matrices que los argumentos de `func` corresponderá a. Los ejemplos detallados se muestran al final de `arraySort` descripci. + +Ejemplo de clasificación de valores enteros: + +``` sql +SELECT arraySort([1, 3, 3, 0]); +``` + +``` text +┌─arraySort([1, 3, 3, 0])─┐ +│ [0,1,3,3] │ +└─────────────────────────┘ +``` + +Ejemplo de ordenación de valores de cadena: + +``` sql +SELECT arraySort(['hello', 'world', '!']); +``` + +``` text +┌─arraySort(['hello', 'world', '!'])─┐ +│ ['!','hello','world'] │ +└────────────────────────────────────┘ +``` + +Considere el siguiente orden de clasificación `NULL`, `NaN` y `Inf` valor: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); +``` + +``` text +┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ +│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────────────────────────┘ +``` + +- `-Inf` los valores son los primeros en la matriz. +- `NULL` los valores son los últimos en la matriz. +- `NaN` los valores están justo antes `NULL`. +- `Inf` los valores están justo antes `NaN`. + +Tenga en cuenta que `arraySort` es una [función de orden superior](higher-order-functions.md). Puede pasarle una función lambda como primer argumento. En este caso, el orden de clasificación está determinado por el resultado de la función lambda aplicada a los elementos de la matriz. + +Consideremos el siguiente ejemplo: + +``` sql +SELECT arraySort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,2,1] │ +└─────────┘ +``` + +For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` función ordena las teclas en orden ascendente, el resultado es \[3, 2, 1\]. Por lo tanto, el `(x) –> -x` la función lambda establece la [orden descendente](#array_functions-reverse-sort) en una clasificación. + +La función lambda puede aceptar múltiples argumentos. En este caso, debe pasar el `arraySort` función varias matrices de idéntica longitud a las que corresponderán los argumentos de la función lambda. La matriz resultante constará de elementos de la primera matriz de entrada; los elementos de la siguiente matriz de entrada especifican las claves de clasificación. Por ejemplo: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Aquí, los elementos que se pasan en la segunda matriz (\[2, 1\]) definen una clave de ordenación para el elemento correspondiente de la matriz de origen (\[‘hello’, ‘world’Es decir,, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn’t use `x`, los valores reales de la matriz de origen no afectan el orden en el resultado. Tan, ‘hello’ será el segundo elemento en el resultado, y ‘world’ será la primera. + +Otros ejemplos se muestran a continuación. + +``` sql +SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +``` sql +SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +!!! note "Nota" + Para mejorar la eficiencia de clasificación, el [Transformación de Schwartzian](https://en.wikipedia.org/wiki/Schwartzian_transform) se utiliza. + +## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} + +Ordena los elementos del `arr` matriz en orden descendente. Si el `func` se especifica la función, `arr` se ordena de acuerdo con el resultado de la `func` función aplicada a los elementos de la matriz, y luego la matriz ordenada se invierte. Si `func` acepta múltiples argumentos, el `arrayReverseSort` función se pasa varias matrices que los argumentos de `func` corresponderá a. Los ejemplos detallados se muestran al final de `arrayReverseSort` descripci. + +Ejemplo de clasificación de valores enteros: + +``` sql +SELECT arrayReverseSort([1, 3, 3, 0]); +``` + +``` text +┌─arrayReverseSort([1, 3, 3, 0])─┐ +│ [3,3,1,0] │ +└────────────────────────────────┘ +``` + +Ejemplo de ordenación de valores de cadena: + +``` sql +SELECT arrayReverseSort(['hello', 'world', '!']); +``` + +``` text +┌─arrayReverseSort(['hello', 'world', '!'])─┐ +│ ['world','hello','!'] │ +└───────────────────────────────────────────┘ +``` + +Considere el siguiente orden de clasificación `NULL`, `NaN` y `Inf` valor: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; +``` + +``` text +┌─res───────────────────────────────────┐ +│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────┘ +``` + +- `Inf` los valores son los primeros en la matriz. +- `NULL` los valores son los últimos en la matriz. +- `NaN` los valores están justo antes `NULL`. +- `-Inf` los valores están justo antes `NaN`. + +Tenga en cuenta que el `arrayReverseSort` es una [función de orden superior](higher-order-functions.md). Puede pasarle una función lambda como primer argumento. Ejemplo se muestra a continuación. + +``` sql +SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [1,2,3] │ +└─────────┘ +``` + +La matriz se ordena de la siguiente manera: + +1. Al principio, la matriz de origen (\[1, 2, 3\]) se ordena de acuerdo con el resultado de la función lambda aplicada a los elementos de la matriz. El resultado es una matriz \[3, 2, 1\]. +2. Matriz que se obtiene en el paso anterior, se invierte. Entonces, el resultado final es \[1, 2, 3\]. + +La función lambda puede aceptar múltiples argumentos. En este caso, debe pasar el `arrayReverseSort` función varias matrices de idéntica longitud a las que corresponderán los argumentos de la función lambda. La matriz resultante constará de elementos de la primera matriz de entrada; los elementos de la siguiente matriz de entrada especifican las claves de clasificación. Por ejemplo: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +En este ejemplo, la matriz se ordena de la siguiente manera: + +1. Al principio, la matriz de origen (\[‘hello’, ‘world’\]) se ordena de acuerdo con el resultado de la función lambda aplicada a los elementos de las matrices. Los elementos que se pasan en la segunda matriz (\[2, 1\]), definen las claves de ordenación para los elementos correspondientes de la matriz de origen. El resultado es una matriz \[‘world’, ‘hello’\]. +2. Matriz que se ordenó en el paso anterior, se invierte. Entonces, el resultado final es \[‘hello’, ‘world’\]. + +Otros ejemplos se muestran a continuación. + +``` sql +SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; +``` + +``` text +┌─res─────┐ +│ [5,3,4] │ +└─────────┘ +``` + +``` sql +SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; +``` + +``` text +┌─res─────┐ +│ [4,3,5] │ +└─────────┘ +``` + +## arrayUniq(arr, …) {#arrayuniqarr} + +Si se pasa un argumento, cuenta el número de elementos diferentes en la matriz. +Si se pasan varios argumentos, cuenta el número de tuplas diferentes de elementos en las posiciones correspondientes en múltiples matrices. + +Si desea obtener una lista de elementos únicos en una matriz, puede usar arrayReduce(‘groupUniqArray’ arr). + +## Información Adicional) {#array-functions-join} + +Una función especial. Vea la sección [“ArrayJoin function”](array-join.md#functions_arrayjoin). + +## arrayDifference {#arraydifference} + +Calcula la diferencia entre los elementos de matriz adyacentes. Devuelve una matriz donde el primer elemento será 0, el segundo es la diferencia entre `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). + +**Sintaxis** + +``` sql +arrayDifference(array) +``` + +**Parámetros** + +- `array` – [Matriz](https://clickhouse.yandex/docs/en/data_types/array/). + +**Valores devueltos** + +Devuelve una matriz de diferencias entre los elementos adyacentes. + +Tipo: [UInt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [En\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [Flotante\*](https://clickhouse.yandex/docs/en/data_types/float/). + +**Ejemplo** + +Consulta: + +``` sql +SELECT arrayDifference([1, 2, 3, 4]) +``` + +Resultado: + +``` text +┌─arrayDifference([1, 2, 3, 4])─┐ +│ [0,1,1,1] │ +└───────────────────────────────┘ +``` + +Ejemplo del desbordamiento debido al tipo de resultado Int64: + +Consulta: + +``` sql +SELECT arrayDifference([0, 10000000000000000000]) +``` + +Resultado: + +``` text +┌─arrayDifference([0, 10000000000000000000])─┐ +│ [0,-8446744073709551616] │ +└────────────────────────────────────────────┘ +``` + +## arrayDistinct {#arraydistinct} + +Toma una matriz, devuelve una matriz que contiene solo los elementos distintos. + +**Sintaxis** + +``` sql +arrayDistinct(array) +``` + +**Parámetros** + +- `array` – [Matriz](https://clickhouse.yandex/docs/en/data_types/array/). + +**Valores devueltos** + +Devuelve una matriz que contiene los elementos distintos. + +**Ejemplo** + +Consulta: + +``` sql +SELECT arrayDistinct([1, 2, 2, 3, 1]) +``` + +Resultado: + +``` text +┌─arrayDistinct([1, 2, 2, 3, 1])─┐ +│ [1,2,3] │ +└────────────────────────────────┘ +``` + +## Aquí Hay Algunas Opciones) {#array_functions-arrayenumeratedense} + +Devuelve una matriz del mismo tamaño que la matriz de origen, lo que indica dónde aparece cada elemento por primera vez en la matriz de origen. + +Ejemplo: + +``` sql +SELECT arrayEnumerateDense([10, 20, 10, 30]) +``` + +``` text +┌─arrayEnumerateDense([10, 20, 10, 30])─┐ +│ [1,2,1,3] │ +└───────────────────────────────────────┘ +``` + +## Información Detallada) {#array-functions-arrayintersect} + +Toma varias matrices, devuelve una matriz con elementos que están presentes en todas las matrices de origen. El orden de los elementos en la matriz resultante es el mismo que en la primera matriz. + +Ejemplo: + +``` sql +SELECT + arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, + arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect +``` + +``` text +┌─no_intersect─┬─intersect─┐ +│ [] │ [1] │ +└──────────────┴───────────┘ +``` + +## arrayReduce {#arrayreduce} + +Aplica una función de agregado a los elementos de la matriz y devuelve su resultado. El nombre de la función de agregación se pasa como una cadena entre comillas simples `'max'`, `'sum'`. Cuando se utilizan funciones de agregado paramétrico, el parámetro se indica después del nombre de la función entre paréntesis `'uniqUpTo(6)'`. + +**Sintaxis** + +``` sql +arrayReduce(agg_func, arr1, arr2, ..., arrN) +``` + +**Parámetros** + +- `agg_func` — The name of an aggregate function which should be a constant [cadena](../../sql-reference/data-types/string.md). +- `arr` — Any number of [matriz](../../sql-reference/data-types/array.md) escriba columnas como los parámetros de la función de agregación. + +**Valor devuelto** + +**Ejemplo** + +``` sql +SELECT arrayReduce('max', [1, 2, 3]) +``` + +``` text +┌─arrayReduce('max', [1, 2, 3])─┐ +│ 3 │ +└───────────────────────────────┘ +``` + +Si una función agregada toma varios argumentos, esta función debe aplicarse a varias matrices del mismo tamaño. + +``` sql +SELECT arrayReduce('maxIf', [3, 5], [1, 0]) +``` + +``` text +┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ +│ 3 │ +└──────────────────────────────────────┘ +``` + +Ejemplo con una función de agregado paramétrico: + +``` sql +SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) +``` + +``` text +┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ +│ 4 │ +└─────────────────────────────────────────────────────────────┘ +``` + +## arrayReduceInRanges {#arrayreduceinranges} + +Aplica una función de agregado a los elementos de matriz en rangos dados y devuelve una matriz que contiene el resultado correspondiente a cada rango. La función devolverá el mismo resultado que múltiples `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. + +**Sintaxis** + +``` sql +arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) +``` + +**Parámetros** + +- `agg_func` — The name of an aggregate function which should be a constant [cadena](../../sql-reference/data-types/string.md). +- `ranges` — The ranges to aggretate which should be an [matriz](../../sql-reference/data-types/array.md) de [tuplas](../../sql-reference/data-types/tuple.md) que contiene el índice y la longitud de cada rango. +- `arr` — Any number of [matriz](../../sql-reference/data-types/array.md) escriba columnas como los parámetros de la función de agregación. + +**Valor devuelto** + +**Ejemplo** + +``` sql +SELECT arrayReduceInRanges( + 'sum', + [(1, 5), (2, 3), (3, 4), (4, 4)], + [1000000, 200000, 30000, 4000, 500, 60, 7] +) AS res +``` + +``` text +┌─res─────────────────────────┐ +│ [1234500,234000,34560,4567] │ +└─────────────────────────────┘ +``` + +## arrayReverse (arr) {#arrayreverse} + +Devuelve una matriz del mismo tamaño que la matriz original que contiene los elementos en orden inverso. + +Ejemplo: + +``` sql +SELECT arrayReverse([1, 2, 3]) +``` + +``` text +┌─arrayReverse([1, 2, 3])─┐ +│ [3,2,1] │ +└─────────────────────────┘ +``` + +## inversa(arr) {#array-functions-reverse} + +Sinónimo de [“arrayReverse”](#array_functions-arrayreverse) + +## arrayFlatten {#arrayflatten} + +Convierte una matriz de matrices en una matriz plana. + +Función: + +- Se aplica a cualquier profundidad de matrices anidadas. +- No cambia las matrices que ya son planas. + +La matriz aplanada contiene todos los elementos de todas las matrices de origen. + +**Sintaxis** + +``` sql +flatten(array_of_arrays) +``` + +Apodo: `flatten`. + +**Parámetros** + +- `array_of_arrays` — [Matriz](../../sql-reference/data-types/array.md) de matrices. Por ejemplo, `[[1,2,3], [4,5]]`. + +**Ejemplos** + +``` sql +SELECT flatten([[[1]], [[2], [3]]]) +``` + +``` text +┌─flatten(array(array([1]), array([2], [3])))─┐ +│ [1,2,3] │ +└─────────────────────────────────────────────┘ +``` + +## arrayCompact {#arraycompact} + +Elimina elementos duplicados consecutivos de una matriz. El orden de los valores de resultado está determinado por el orden de la matriz de origen. + +**Sintaxis** + +``` sql +arrayCompact(arr) +``` + +**Parámetros** + +`arr` — The [matriz](../../sql-reference/data-types/array.md) inspeccionar. + +**Valor devuelto** + +La matriz sin duplicado. + +Tipo: `Array`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) +``` + +Resultado: + +``` text +┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ +│ [1,nan,nan,2,3] │ +└────────────────────────────────────────────┘ +``` + +## arrayZip {#arrayzip} + +Combine multiple Array type columns into one Array\[Tuple(…)\] column + +**Sintaxis** + +``` sql +arrayZip(arr1, arr2, ..., arrN) +``` + +**Parámetros** + +`arr` — Any number of [matriz](../../sql-reference/data-types/array.md) escriba columnas para combinar. + +**Valor devuelto** + +The result of Array\[Tuple(…)\] type after the combination of these arrays + +**Ejemplo** + +Consulta: + +``` sql +SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); +``` + +Resultado: + +``` text +┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ +│ [('a','d'),('b','e'),('c','f')] │ +└────────────────────────────────────────────┘ +``` + +## arrayAUC {#arrayauc} + +Calcule AUC (Área bajo la curva, que es un concepto en el aprendizaje automático, vea más detalles: https://en.wikipedia.org/wiki/Receiver\_operating\_characteristic\#Area\_under\_the\_curve ). + +**Sintaxis** + +``` sql +arrayAUC(arr_scores, arr_labels) +``` + +**Parámetros** +- `arr_scores` — scores prediction model gives. +- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. + +**Valor devuelto** +Devuelve el valor AUC con el tipo Float64. + +**Ejemplo** +Consulta: + +``` sql +select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) +``` + +Resultado: + +``` text +┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ +│ 0.75 │ +└────────────────────────────────────────---──┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/es/sql_reference/functions/array_join.md b/docs/es/sql-reference/functions/array-join.md similarity index 100% rename from docs/es/sql_reference/functions/array_join.md rename to docs/es/sql-reference/functions/array-join.md diff --git a/docs/es/sql-reference/functions/bit-functions.md b/docs/es/sql-reference/functions/bit-functions.md new file mode 100644 index 00000000000..94c3c1c7ff8 --- /dev/null +++ b/docs/es/sql-reference/functions/bit-functions.md @@ -0,0 +1,255 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 48 +toc_title: Trozo +--- + +# Bit Funciones {#bit-functions} + +Las funciones de bits funcionan para cualquier par de tipos de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 o Float64. + +El tipo de resultado es un entero con bits iguales a los bits máximos de sus argumentos. Si al menos uno de los argumentos está firmado, el resultado es un número firmado. Si un argumento es un número de coma flotante, se convierte en Int64. + +## pocoY(a, b) {#bitanda-b} + +## bitOr (a, b) {#bitora-b} + +## ¿Por qué?) {#bitxora-b} + +## ¿Por qué?) {#bitnota} + +## ¿Cómo puedo hacerlo?) {#bitshiftlefta-b} + +## ¿Cómo puedo hacerlo?) {#bitshiftrighta-b} + +## ¿Cómo puedo hacerlo?) {#bitrotatelefta-b} + +## ¿Cómo puedo hacerlo?) {#bitrotaterighta-b} + +## bitTest {#bittest} + +Toma cualquier entero y lo convierte en [forma binaria](https://en.wikipedia.org/wiki/Binary_number) devuelve el valor de un bit en la posición especificada. La cuenta atrás comienza desde 0 de derecha a izquierda. + +**Sintaxis** + +``` sql +SELECT bitTest(number, index) +``` + +**Parámetros** + +- `number` – integer number. +- `index` – position of bit. + +**Valores devueltos** + +Devuelve un valor de bit en la posición especificada. + +Tipo: `UInt8`. + +**Ejemplo** + +Por ejemplo, el número 43 en el sistema numérico base-2 (binario) es 101011. + +Consulta: + +``` sql +SELECT bitTest(43, 1) +``` + +Resultado: + +``` text +┌─bitTest(43, 1)─┐ +│ 1 │ +└────────────────┘ +``` + +Otro ejemplo: + +Consulta: + +``` sql +SELECT bitTest(43, 2) +``` + +Resultado: + +``` text +┌─bitTest(43, 2)─┐ +│ 0 │ +└────────────────┘ +``` + +## bitTestAll {#bittestall} + +Devuelve el resultado de [conjunción lógica](https://en.wikipedia.org/wiki/Logical_conjunction) (Operador AND) de todos los bits en posiciones dadas. La cuenta atrás comienza desde 0 de derecha a izquierda. + +La conjucción para operaciones bit a bit: + +0 AND 0 = 0 + +0 AND 1 = 0 + +1 AND 0 = 0 + +1 AND 1 = 1 + +**Sintaxis** + +``` sql +SELECT bitTestAll(number, index1, index2, index3, index4, ...) +``` + +**Parámetros** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) es verdadero si y solo si todas sus posiciones son verdaderas (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). + +**Valores devueltos** + +Devuelve el resultado de la conjunción lógica. + +Tipo: `UInt8`. + +**Ejemplo** + +Por ejemplo, el número 43 en el sistema numérico base-2 (binario) es 101011. + +Consulta: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5) +``` + +Resultado: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5)─┐ +│ 1 │ +└────────────────────────────┘ +``` + +Otro ejemplo: + +Consulta: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5, 2) +``` + +Resultado: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ +│ 0 │ +└───────────────────────────────┘ +``` + +## bitTestAny {#bittestany} + +Devuelve el resultado de [disyunción lógica](https://en.wikipedia.org/wiki/Logical_disjunction) (O operador) de todos los bits en posiciones dadas. La cuenta atrás comienza desde 0 de derecha a izquierda. + +La disyunción para las operaciones bit a bit: + +0 OR 0 = 0 + +0 OR 1 = 1 + +1 OR 0 = 1 + +1 OR 1 = 1 + +**Sintaxis** + +``` sql +SELECT bitTestAny(number, index1, index2, index3, index4, ...) +``` + +**Parámetros** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. + +**Valores devueltos** + +Devuelve el resultado de disjuction lógico. + +Tipo: `UInt8`. + +**Ejemplo** + +Por ejemplo, el número 43 en el sistema numérico base-2 (binario) es 101011. + +Consulta: + +``` sql +SELECT bitTestAny(43, 0, 2) +``` + +Resultado: + +``` text +┌─bitTestAny(43, 0, 2)─┐ +│ 1 │ +└──────────────────────┘ +``` + +Otro ejemplo: + +Consulta: + +``` sql +SELECT bitTestAny(43, 4, 2) +``` + +Resultado: + +``` text +┌─bitTestAny(43, 4, 2)─┐ +│ 0 │ +└──────────────────────┘ +``` + +## bitCount {#bitcount} + +Calcula el número de bits establecido en uno en la representación binaria de un número. + +**Sintaxis** + +``` sql +bitCount(x) +``` + +**Parámetros** + +- `x` — [Entero](../../sql-reference/data-types/int-uint.md) o [punto flotante](../../sql-reference/data-types/float.md) numero. La función utiliza la representación de valor en la memoria. Permite admitir números de punto flotante. + +**Valor devuelto** + +- Número de bits establecido en uno en el número de entrada. + +La función no convierte el valor de entrada a un tipo más grande ([extensión de signo](https://en.wikipedia.org/wiki/Sign_extension)). Entonces, por ejemplo, `bitCount(toUInt8(-1)) = 8`. + +Tipo: `UInt8`. + +**Ejemplo** + +Tomemos por ejemplo el número 333. Su representación binaria: 0000000101001101. + +Consulta: + +``` sql +SELECT bitCount(333) +``` + +Resultado: + +``` text +┌─bitCount(333)─┐ +│ 5 │ +└───────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/es/sql-reference/functions/bitmap-functions.md b/docs/es/sql-reference/functions/bitmap-functions.md new file mode 100644 index 00000000000..2ea9ac93b63 --- /dev/null +++ b/docs/es/sql-reference/functions/bitmap-functions.md @@ -0,0 +1,496 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 49 +toc_title: Bits +--- + +# Funciones De Mapa De Bits {#bitmap-functions} + +Las funciones de mapa de bits funcionan para dos mapas de bits Cálculo del valor del objeto, es devolver un nuevo mapa de bits o cardinalidad mientras se usa el cálculo de la fórmula, como y, o, xor, y no, etc. + +Hay 2 tipos de métodos de construcción para Bitmap Object. Uno debe ser construido por la función de agregación groupBitmap con -State , el otro debe ser construido por Array Object . También es para convertir objeto de mapa de bits a objeto de matriz. + +RoaringBitmap se envuelve en una estructura de datos, mientras que el almacenamiento real de los objetos de mapa de bits. Cuando la cardinalidad es menor o igual que 32, utiliza Set objet. Cuando la cardinalidad es mayor que 32, utiliza el objeto RoaringBitmap. Es por eso que el almacenamiento del conjunto de baja cardinalidad es más rápido. + +Para obtener más información sobre RoaringBitmap, consulte: [CRoaring](https://github.com/RoaringBitmap/CRoaring). + +## bitmapBuild {#bitmap_functions-bitmapbuild} + +Construya un mapa de bits a partir de una matriz de enteros sin signo. + +``` sql +bitmapBuild(array) +``` + +**Parámetros** + +- `array` – unsigned integer array. + +**Ejemplo** + +``` sql +SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) +``` + +``` text +┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ +│  │ AggregateFunction(groupBitmap, UInt8) │ +└─────┴──────────────────────────────────────────────┘ +``` + +## bitmapToArray {#bitmaptoarray} + +Convertir mapa de bits a matriz entera. + +``` sql +bitmapToArray(bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapSubsetInRange {#bitmap-functions-bitmapsubsetinrange} + +Devuelve el subconjunto en el rango especificado (no incluye range\_end). + +``` sql +bitmapSubsetInRange(bitmap, range_start, range_end) +``` + +**Parámetros** + +- `bitmap` – [Objeto de mapa de bits](#bitmap_functions-bitmapbuild). +- `range_start` – range start point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `range_end` – range end point(excluded). Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +``` sql +SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +``` text +┌─res───────────────┐ +│ [30,31,32,33,100] │ +└───────────────────┘ +``` + +## bitmapSubsetLimit {#bitmapsubsetlimit} + +Crea un subconjunto de mapa de bits con n elementos tomados entre `range_start` y `cardinality_limit`. + +**Sintaxis** + +``` sql +bitmapSubsetLimit(bitmap, range_start, cardinality_limit) +``` + +**Parámetros** + +- `bitmap` – [Objeto de mapa de bits](#bitmap_functions-bitmapbuild). +- `range_start` – The subset starting point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**Valor devuelto** + +Subconjunto. + +Tipo: `Bitmap object`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +Resultado: + +``` text +┌─res───────────────────────┐ +│ [30,31,32,33,100,200,500] │ +└───────────────────────────┘ +``` + +## bitmapContains {#bitmap_functions-bitmapcontains} + +Comprueba si el mapa de bits contiene un elemento. + +``` sql +bitmapContains(haystack, needle) +``` + +**Parámetros** + +- `haystack` – [Objeto de mapa de bits](#bitmap_functions-bitmapbuild), donde la función busca. +- `needle` – Value that the function searches. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- 0 — If `haystack` no contiene `needle`. +- 1 — If `haystack` contener `needle`. + +Tipo: `UInt8`. + +**Ejemplo** + +``` sql +SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAny {#bitmaphasany} + +Comprueba si dos mapas de bits tienen intersección por algunos elementos. + +``` sql +bitmapHasAny(bitmap1, bitmap2) +``` + +Si está seguro de que `bitmap2` contiene estrictamente un elemento, considere usar el [bitmapContains](#bitmap_functions-bitmapcontains) función. Funciona de manera más eficiente. + +**Parámetros** + +- `bitmap*` – bitmap object. + +**Valores de retorno** + +- `1`, si `bitmap1` y `bitmap2` tienen un elemento similar al menos. +- `0`, de lo contrario. + +**Ejemplo** + +``` sql +SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAll {#bitmaphasall} + +Análogo a `hasAll(array, array)` devuelve 1 si el primer mapa de bits contiene todos los elementos del segundo, 0 de lo contrario. +Si el segundo argumento es un mapa de bits vacío, devuelve 1. + +``` sql +bitmapHasAll(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 0 │ +└─────┘ +``` + +## bitmapCardinalidad {#bitmapcardinality} + +Vuelva a ejecutar la cardinalidad del mapa de bits de tipo UInt64. + +``` sql +bitmapCardinality(bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapMin {#bitmapmin} + +Vuelva a ejecutar el valor más pequeño de tipo UInt64 en el conjunto, UINT32\_MAX si el conjunto está vacío. + + bitmapMin(bitmap) + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## bitmapMax {#bitmapmax} + +Vuelva a ejecutar el mayor valor de tipo UInt64 en el conjunto, 0 si el conjunto está vacío. + + bitmapMax(bitmap) + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## bitmapTransform {#bitmaptransform} + +Transformar una matriz de valores en un mapa de bits a otra matriz de valores, el resultado es un nuevo mapa de bits. + + bitmapTransform(bitmap, from_array, to_array) + +**Parámetros** + +- `bitmap` – bitmap object. +- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. +- `to_array` – UInt32 array, its size shall be the same to from\_array. + +**Ejemplo** + +``` sql +SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res +``` + + ┌─res───────────────────┐ + │ [1,3,4,6,7,8,9,10,20] │ + └───────────────────────┘ + +## bitmapAnd {#bitmapand} + +Dos mapa de bits y cálculo, el resultado es un nuevo mapa de bits. + +``` sql +bitmapAnd(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─┐ +│ [3] │ +└─────┘ +``` + +## bitmapO {#bitmapor} + +Dos mapa de bits o cálculo, el resultado es un nuevo mapa de bits. + +``` sql +bitmapOr(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapXor {#bitmapxor} + +Dos bitmap xor cálculo, el resultado es un nuevo mapa de bits. + +``` sql +bitmapXor(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,4,5] │ +└───────────┘ +``` + +## bitmapAndnot {#bitmapandnot} + +Dos mapas de bits y no cálculo, el resultado es un nuevo mapa de bits. + +``` sql +bitmapAndnot(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## Bienvenido a WordPress {#bitmapandcardinality} + +Dos mapa de bits y cálculo, devuelven cardinalidad de tipo UInt64. + +``` sql +bitmapAndCardinality(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapOrCardinalidad {#bitmaporcardinality} + +Dos mapa de bits o cálculo, retorno cardinalidad de tipo UInt64. + +``` sql +bitmapOrCardinality(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapXorCardinalidad {#bitmapxorcardinality} + +Dos bitmap xor cálculo, retorno cardinalidad de tipo UInt64. + +``` sql +bitmapXorCardinality(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 4 │ +└─────┘ +``` + +## Por Favor, Introduzca Su dirección De Correo electrónico {#bitmapandnotcardinality} + +Dos mapas de bits yno cálculo, devuelve cardinalidad de tipo UInt64. + +``` sql +bitmapAndnotCardinality(bitmap,bitmap) +``` + +**Parámetros** + +- `bitmap` – bitmap object. + +**Ejemplo** + +``` sql +SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 2 │ +└─────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/es/sql-reference/functions/comparison-functions.md b/docs/es/sql-reference/functions/comparison-functions.md new file mode 100644 index 00000000000..fe3b054579e --- /dev/null +++ b/docs/es/sql-reference/functions/comparison-functions.md @@ -0,0 +1,37 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 36 +toc_title: "Comparaci\xF3n" +--- + +# Funciones De comparación {#comparison-functions} + +Las funciones de comparación siempre devuelven 0 o 1 (Uint8). + +Se pueden comparar los siguientes tipos: + +- numero +- cuerdas y cuerdas fijas +- fechas +- fechas con tiempos + +dentro de cada grupo, pero no entre diferentes grupos. + +Por ejemplo, no puede comparar una fecha con una cadena. Debe usar una función para convertir la cadena a una fecha, o viceversa. + +Las cadenas se comparan por bytes. Una cadena más corta es más pequeña que todas las cadenas que comienzan con ella y que contienen al menos un carácter más. + +## iguales, a = b y a == b operador {#function-equals} + +## notEquals, un ! operador = b y un \<\> b {#function-notequals} + +## menos, operador \< {#function-less} + +## Saludos {#function-greater} + +## lessOrEquals, operador \<= {#function-lessorequals} + +## greaterOrEquals, operador \>= {#function-greaterorequals} + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) diff --git a/docs/es/sql-reference/functions/conditional-functions.md b/docs/es/sql-reference/functions/conditional-functions.md new file mode 100644 index 00000000000..7d73a561279 --- /dev/null +++ b/docs/es/sql-reference/functions/conditional-functions.md @@ -0,0 +1,207 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 43 +toc_title: 'Condicional ' +--- + +# Funciones Condicionales {#conditional-functions} + +## si {#if} + +Controla la bifurcación condicional. A diferencia de la mayoría de los sistemas, ClickHouse siempre evalúa ambas expresiones `then` y `else`. + +**Sintaxis** + +``` sql +SELECT if(cond, then, else) +``` + +Si la condición `cond` evalúa a un valor distinto de cero, devuelve el resultado de la expresión `then` y el resultado de la expresión `else` si está presente, se omite. Si el `cond` es cero o `NULL` el resultado de la `then` expresión se omite y el resultado de la `else` expresión, si está presente, se devuelve. + +**Parámetros** + +- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. +- `then` - La expresión que se va a devolver si se cumple la condición. +- `else` - La expresión a devolver si no se cumple la condición.- + +**Valores devueltos** + +La función se ejecuta `then` y `else` expresiones y devuelve su resultado, dependiendo de si la condición `cond` terminó siendo cero o no. + +**Ejemplo** + +Consulta: + +``` sql +SELECT if(1, plus(2, 2), plus(2, 6)) +``` + +Resultado: + +``` text +┌─plus(2, 2)─┐ +│ 4 │ +└────────────┘ +``` + +Consulta: + +``` sql +SELECT if(0, plus(2, 2), plus(2, 6)) +``` + +Resultado: + +``` text +┌─plus(2, 6)─┐ +│ 8 │ +└────────────┘ +``` + +- `then` y `else` debe tener el tipo común más bajo. + +**Ejemplo:** + +Toma esto `LEFT_RIGHT` tabla: + +``` sql +SELECT * +FROM LEFT_RIGHT + +┌─left─┬─right─┐ +│ ᴺᵁᴸᴸ │ 4 │ +│ 1 │ 3 │ +│ 2 │ 2 │ +│ 3 │ 1 │ +│ 4 │ ᴺᵁᴸᴸ │ +└──────┴───────┘ +``` + +La siguiente consulta compara `left` y `right` valor: + +``` sql +SELECT + left, + right, + if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller +FROM LEFT_RIGHT +WHERE isNotNull(left) AND isNotNull(right) + +┌─left─┬─right─┬─is_smaller──────────────────────────┐ +│ 1 │ 3 │ left is smaller than right │ +│ 2 │ 2 │ right is greater or equal than left │ +│ 3 │ 1 │ right is greater or equal than left │ +└──────┴───────┴─────────────────────────────────────┘ +``` + +Nota: `NULL` los valores no se utilizan en este ejemplo, compruebe [Valores NULL en condicionales](#null-values-in-conditionals) apartado. + +## Operador Ternario {#ternary-operator} + +Funciona igual que `if` función. + +Sintaxis: `cond ? then : else` + +Devoluciones `then` si el `cond` evalúa que es verdadero (mayor que cero), de lo contrario devuelve `else`. + +- `cond` debe ser de tipo de `UInt8`, y `then` y `else` debe tener el tipo común más bajo. + +- `then` y `else` puede ser `NULL` + +**Ver también** + +- [ifNotFinite](other-functions.md#ifnotfinite). + +## MultiIf {#multiif} + +Le permite escribir el [CASE](../operators.md#operator_case) operador más compacto en la consulta. + +Sintaxis: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` + +**Parámetros:** + +- `cond_N` — The condition for the function to return `then_N`. +- `then_N` — The result of the function when executed. +- `else` — The result of the function if none of the conditions is met. + +La función acepta `2N+1` parámetros. + +**Valores devueltos** + +La función devuelve uno de los valores `then_N` o `else` dependiendo de las condiciones `cond_N`. + +**Ejemplo** + +De nuevo usando `LEFT_RIGHT` tabla. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─result──────────┐ +│ ᴺᵁᴸᴸ │ 4 │ Null value │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ left is greater │ +│ 4 │ ᴺᵁᴸᴸ │ Null value │ +└──────┴───────┴─────────────────┘ +``` + +## Usar Resultados Condicionales Directamente {#using-conditional-results-directly} + +Los condicionales siempre dan como resultado `0`, `1` o `NULL`. Entonces puedes usar resultados condicionales directamente como este: + +``` sql +SELECT left < right AS is_small +FROM LEFT_RIGHT + +┌─is_small─┐ +│ ᴺᵁᴸᴸ │ +│ 1 │ +│ 0 │ +│ 0 │ +│ ᴺᵁᴸᴸ │ +└──────────┘ +``` + +## Valores NULL En Condicionales {#null-values-in-conditionals} + +Cuando `NULL` están involucrados en condicionales, el resultado también será `NULL`. + +``` sql +SELECT + NULL < 1, + 2 < NULL, + NULL < NULL, + NULL = NULL + +┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ +│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└───────────────┴───────────────┴──────────────────┴────────────────────┘ +``` + +Por lo tanto, debe construir sus consultas cuidadosamente si los tipos son `Nullable`. + +El siguiente ejemplo demuestra esto al no agregar la condición equals a `multiIf`. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─faulty_result────┐ +│ ᴺᵁᴸᴸ │ 4 │ Both equal │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ right is smaller │ +│ 4 │ ᴺᵁᴸᴸ │ Both equal │ +└──────┴───────┴──────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/es/sql-reference/functions/date-time-functions.md b/docs/es/sql-reference/functions/date-time-functions.md new file mode 100644 index 00000000000..cc4a68edca4 --- /dev/null +++ b/docs/es/sql-reference/functions/date-time-functions.md @@ -0,0 +1,450 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 39 +toc_title: Trabajar con fechas y horas +--- + +# Funciones Para Trabajar Con Fechas y Horas {#functions-for-working-with-dates-and-times} + +Soporte para zonas horarias + +Todas las funciones para trabajar con la fecha y la hora que tienen un uso lógico para la zona horaria pueden aceptar un segundo argumento de zona horaria opcional. Ejemplo: Asia/Ekaterimburgo. En este caso, utilizan la zona horaria especificada en lugar de la local (predeterminada). + +``` sql +SELECT + toDateTime('2016-06-15 23:00:00') AS time, + toDate(time) AS date_local, + toDate(time, 'Asia/Yekaterinburg') AS date_yekat, + toString(time, 'US/Samoa') AS time_samoa +``` + +``` text +┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ +└─────────────────────┴────────────┴────────────┴─────────────────────┘ +``` + +Solo se admiten las zonas horarias que difieren de UTC por un número entero de horas. + +## Todos Los Derechos Reservados {#totimezone} + +Convierta la hora o la fecha y la hora a la zona horaria especificada. + +## paraAño {#toyear} + +Convierte una fecha o fecha con hora en un número UInt16 que contiene el número de año (AD). + +## aTrimestre {#toquarter} + +Convierte una fecha o fecha con hora en un número UInt8 que contiene el número de trimestre. + +## ParaMes {#tomonth} + +Convierte una fecha o fecha con hora en un número UInt8 que contiene el número de mes (1-12). + +## Todos Los Derechos Reservados {#todayofyear} + +Convierte una fecha o fecha con hora en un número UInt16 que contiene el número del día del año (1-366). + +## Todos Los Derechos Reservados {#todayofmonth} + +Convierte una fecha o fecha con hora en un número UInt8 que contiene el número del día del mes (1-31). + +## Todos Los Derechos Reservados {#todayofweek} + +Convierte una fecha o fecha con hora en un número UInt8 que contiene el número del día de la semana (el lunes es 1 y el domingo es 7). + +## ParaHora {#tohour} + +Convierte una fecha con hora en un número UInt8 que contiene el número de la hora en el tiempo de 24 horas (0-23). +This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). + +## ToMinute {#tominute} + +Convierte una fecha con hora en un número UInt8 que contiene el número del minuto de la hora (0-59). + +## aSegundo {#tosecond} + +Convierte una fecha con hora en un número UInt8 que contiene el número del segundo en el minuto (0-59). +Los segundos de salto no se contabilizan. + +## Todos Los Derechos Reservados {#to-unix-timestamp} + +Para el argumento DateTime: convierte el valor a su representación numérica interna (Unix Timestamp). +Para el argumento String: analice la fecha y hora de la cadena de acuerdo con la zona horaria (segundo argumento opcional, la zona horaria del servidor se usa de forma predeterminada) y devuelve la marca de tiempo de Unix correspondiente. +Para el argumento Date : el comportamiento no está especificado. + +**Sintaxis** + +``` sql +toUnixTimestamp(datetime) +toUnixTimestamp(str, [timezone]) +``` + +**Valor devuelto** + +- Devuelve la marca de tiempo de Unix. + +Tipo: `UInt32`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp +``` + +Resultado: + +``` text +┌─unix_timestamp─┐ +│ 1509836867 │ +└────────────────┘ +``` + +## Todos Los Derechos Reservados {#tostartofyear} + +Redondea una fecha o fecha con la hora hasta el primer día del año. +Devuelve la fecha. + +## Todos Los Derechos Reservados {#tostartofisoyear} + +Redondea una fecha o fecha con la hora hasta el primer día del año ISO. +Devuelve la fecha. + +## Todos Los Derechos Reservados {#tostartofquarter} + +Redondea una fecha o fecha con la hora hasta el primer día del trimestre. +El primer día del trimestre es el 1 de enero, el 1 de abril, el 1 de julio o el 1 de octubre. +Devuelve la fecha. + +## Todos Los Derechos Reservados {#tostartofmonth} + +Redondea una fecha o fecha con la hora hasta el primer día del mes. +Devuelve la fecha. + +!!! attention "Atención" + El comportamiento de analizar fechas incorrectas es específico de la implementación. ClickHouse puede devolver una fecha cero, lanzar una excepción o hacer “natural” desbordamiento. + +## paraLunes {#tomonday} + +Redondea una fecha o fecha con hora al lunes más cercano. +Devuelve la fecha. + +## ¿Cómo puedo hacerlo?\]) {#tostartofweektmode} + +Redondea una fecha o fecha con hora al domingo o lunes más cercano por modo. +Devuelve la fecha. +El argumento mode funciona exactamente igual que el argumento mode a toWeek() . Para la sintaxis de argumento único, se utiliza un valor de modo de 0. + +## Todos Los Derechos Reservados {#tostartofday} + +Redondea una fecha con el tiempo hasta el comienzo del día. + +## Todos Los Derechos Reservados {#tostartofhour} + +Redondea una fecha con el tiempo hasta el comienzo de la hora. + +## Todos Los Derechos Reservados {#tostartofminute} + +Redondea una fecha con el tiempo hasta el inicio del minuto. + +## Acerca De Nosotros {#tostartoffiveminute} + +Redondea una fecha con el tiempo hasta el inicio del intervalo de cinco minutos. + +## Acerca De Nosotros {#tostartoftenminutes} + +Redondea una fecha con el tiempo hasta el inicio del intervalo de diez minutos. + +## Para Comenzar De Quince Minutos {#tostartoffifteenminutes} + +Redondea la fecha con el tiempo hasta el inicio del intervalo de quince minutos. + +## También Puede Usar Una Interfaz De Usuario.\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} + +Esta es una generalización de otras funciones llamadas `toStartOf*`. Por ejemplo, +`toStartOfInterval(t, INTERVAL 1 year)` devuelve lo mismo que `toStartOfYear(t)`, +`toStartOfInterval(t, INTERVAL 1 month)` devuelve lo mismo que `toStartOfMonth(t)`, +`toStartOfInterval(t, INTERVAL 1 day)` devuelve lo mismo que `toStartOfDay(t)`, +`toStartOfInterval(t, INTERVAL 15 minute)` devuelve lo mismo que `toStartOfFifteenMinutes(t)` sucesivamente. + +## Tiempo {#totime} + +Convierte una fecha con hora en una fecha fija determinada, preservando al mismo tiempo la hora. + +## Todos Los Derechos Reservados {#torelativeyearnum} + +Convierte una fecha con hora o fecha en el número del año, a partir de un determinado punto fijo en el pasado. + +## Nombre De La Red inalámbrica (SSID): {#torelativequarternum} + +Convierte una fecha con hora o fecha en el número del trimestre, a partir de un determinado punto fijo en el pasado. + +## Nombre De La Red inalámbrica (SSID): {#torelativemonthnum} + +Convierte una fecha con hora o fecha en el número del mes, a partir de un determinado punto fijo en el pasado. + +## Nombre De La Red inalámbrica (SSID): {#torelativeweeknum} + +Convierte una fecha con hora o fecha en el número de la semana, a partir de un determinado punto fijo en el pasado. + +## Nombre De La Red inalámbrica (SSID): {#torelativedaynum} + +Convierte una fecha con hora o fecha en el número del día, a partir de un determinado punto fijo en el pasado. + +## Nombre De La Red inalámbrica (SSID): {#torelativehournum} + +Convierte una fecha con hora o fecha en el número de la hora, a partir de un determinado punto fijo en el pasado. + +## Todos Los Derechos Reservados {#torelativeminutenum} + +Convierte una fecha con hora o fecha en el número del minuto, a partir de un cierto punto fijo en el pasado. + +## Todos Los Derechos Reservados {#torelativesecondnum} + +Convierte una fecha con hora o fecha en el número de la segunda, a partir de un cierto punto fijo en el pasado. + +## AISOAño {#toisoyear} + +Convierte una fecha o fecha con hora en un número UInt16 que contiene el número ISO Year. + +## paraISOWeek {#toisoweek} + +Convierte una fecha o fecha con hora en un número UInt8 que contiene el número de semana ISO. + +## ToWeek(fecha\[,modo\]) {#toweekdatemode} + +Esta función devuelve el número de semana para la fecha o la fecha y hora. La forma de dos argumentos de toWeek() le permite especificar si la semana comienza el domingo o el lunes y si el valor de retorno debe estar en el rango de 0 a 53 o de 1 a 53. Si se omite el argumento mode, el modo predeterminado es 0. +`toISOWeek()`es una función de compatibilidad que es equivalente a `toWeek(date,3)`. +La siguiente tabla describe cómo funciona el argumento mode. + +| Modo | Primer día de la semana | Gama | Week 1 is the first week … | +|------|-------------------------|------|----------------------------| +| 0 | Domingo | 0-53 | con un domingo de este año | +| 1 | Lunes | 0-53 | con 4 o más días este año | +| 2 | Domingo | 1-53 | con un domingo de este año | +| 3 | Lunes | 1-53 | con 4 o más días este año | +| 4 | Domingo | 0-53 | con 4 o más días este año | +| 5 | Lunes | 0-53 | con un lunes de este año | +| 6 | Domingo | 1-53 | con 4 o más días este año | +| 7 | Lunes | 1-53 | con un lunes de este año | +| 8 | Domingo | 1-53 | contiene 1 de enero | +| 9 | Lunes | 1-53 | contiene 1 de enero | + +Para valores de modo con un significado de “with 4 or more days this year,” semanas están numeradas según ISO 8601:1988: + +- Si la semana que contiene el 1 de enero tiene 4 o más días en el nuevo año, es la semana 1. + +- De lo contrario, es la última semana del año anterior, y la semana siguiente es la semana 1. + +Para valores de modo con un significado de “contains January 1”, la semana contiene 1 de enero es la semana 1. No importa cuántos días en el nuevo año contenía la semana, incluso si contenía solo un día. + +``` sql +toWeek(date, [, mode][, Timezone]) +``` + +**Parámetros** + +- `date` – Date or DateTime. +- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. +- `Timezone` – Optional parameter, it behaves like any other conversion function. + +**Ejemplo** + +``` sql +SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; +``` + +``` text +┌───────date─┬─week0─┬─week1─┬─week9─┐ +│ 2016-12-27 │ 52 │ 52 │ 1 │ +└────────────┴───────┴───────┴───────┘ +``` + +## aYearWeek(fecha\[,modo\]) {#toyearweekdatemode} + +Devuelve año y semana para una fecha. El año en el resultado puede ser diferente del año en el argumento de fecha para la primera y la última semana del año. + +El argumento mode funciona exactamente igual que el argumento mode a toWeek() . Para la sintaxis de argumento único, se utiliza un valor de modo de 0. + +`toISOYear()`es una función de compatibilidad que es equivalente a `intDiv(toYearWeek(date,3),100)`. + +**Ejemplo** + +``` sql +SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; +``` + +``` text +┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ +│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ +└────────────┴───────────┴───────────┴───────────┘ +``` + +## ahora {#now} + +Acepta cero argumentos y devuelve la hora actual en uno de los momentos de ejecución de la solicitud. +Esta función devuelve una constante, incluso si la solicitud tardó mucho en completarse. + +## hoy {#today} + +Acepta cero argumentos y devuelve la fecha actual en uno de los momentos de ejecución de la solicitud. +Lo mismo que ‘toDate(now())’. + +## ayer {#yesterday} + +Acepta cero argumentos y devuelve la fecha de ayer en uno de los momentos de ejecución de la solicitud. +Lo mismo que ‘today() - 1’. + +## timeSlot {#timeslot} + +Redondea el tiempo a la media hora. +Esta función es específica de Yandex.Metrica, ya que media hora es la cantidad mínima de tiempo para dividir una sesión en dos sesiones si una etiqueta de seguimiento muestra las páginas vistas consecutivas de un solo usuario que difieren en el tiempo en estrictamente más de esta cantidad. Esto significa que las tuplas (el ID de etiqueta, el ID de usuario y el intervalo de tiempo) se pueden usar para buscar páginas vistas que se incluyen en la sesión correspondiente. + +## paraYYYYMM {#toyyyymm} + +Convierte una fecha o fecha con hora en un número UInt32 que contiene el número de año y mes (YYYY \* 100 + MM). + +## paraYYYYMMDD {#toyyyymmdd} + +Convierte una fecha o fecha con hora en un número UInt32 que contiene el número de año y mes (AAAA \* 10000 + MM \* 100 + DD). + +## paraYYYYMMDDhhmmss {#toyyyymmddhhmmss} + +Convierte una fecha o fecha con hora en un número UInt64 que contiene el número de año y mes (YYYY \* 10000000000 + MM \* 100000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss). + +## Por Ejemplo, En El Caso De Que El Usuario Pueda Acceder a La página De Inicio De sesión, Seleccione La página De Inicio De sesión {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} + +La función agrega un intervalo de fecha / fecha y hora a una fecha / fecha y hora y luego devuelve la fecha / fecha y hora. Por ejemplo: + +``` sql +WITH + toDate('2018-01-01') AS date, + toDateTime('2018-01-01 00:00:00') AS date_time +SELECT + addYears(date, 1) AS add_years_with_date, + addYears(date_time, 1) AS add_years_with_date_time +``` + +``` text +┌─add_years_with_date─┬─add_years_with_date_time─┐ +│ 2019-01-01 │ 2019-01-01 00:00:00 │ +└─────────────────────┴──────────────────────────┘ +``` + +## restarAños, restarMeses, restarSemanas, restarDías, restarHoras, restarMinutos, restarSegundos, restarCuartos {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} + +La función resta un intervalo de fecha / fecha y hora a una fecha / fecha y hora y luego devuelve la fecha / fecha y hora. Por ejemplo: + +``` sql +WITH + toDate('2019-01-01') AS date, + toDateTime('2019-01-01 00:00:00') AS date_time +SELECT + subtractYears(date, 1) AS subtract_years_with_date, + subtractYears(date_time, 1) AS subtract_years_with_date_time +``` + +``` text +┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ +│ 2018-01-01 │ 2018-01-01 00:00:00 │ +└──────────────────────────┴───────────────────────────────┘ +``` + +## dateDiff {#datediff} + +Devuelve la diferencia entre dos valores Date o DateTime. + +**Sintaxis** + +``` sql +dateDiff('unit', startdate, enddate, [timezone]) +``` + +**Parámetros** + +- `unit` — Time unit, in which the returned value is expressed. [Cadena](../syntax.md#syntax-string-literal). + + Supported values: + + | unit | + | ---- | + |second | + |minute | + |hour | + |day | + |week | + |month | + |quarter | + |year | + +- `startdate` — The first time value to compare. [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). + +- `enddate` — The second time value to compare. [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). + +- `timezone` — Optional parameter. If specified, it is applied to both `startdate` y `enddate`. Si no se especifica, las zonas horarias `startdate` y `enddate` se utilizan. Si no son lo mismo, el resultado no está especificado. + +**Valor devuelto** + +Diferencia entre `startdate` y `enddate` expresado en `unit`. + +Tipo: `int`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); +``` + +Resultado: + +``` text +┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ +│ 25 │ +└────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## timeSlots(Hora de inicio, Duración, \[, Tamaño\]) {#timeslotsstarttime-duration-size} + +Para un intervalo de tiempo a partir de ‘StartTime’ y continuando por ‘Duration’ segundos, devuelve una matriz de momentos en el tiempo, que consiste en puntos de este intervalo ‘Size’ en segundos. ‘Size’ es un parámetro opcional: una constante UInt32, establecida en 1800 por defecto. +Por ejemplo, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. +Esto es necesario para buscar páginas vistas en la sesión correspondiente. + +## formatDateTime(Hora, Formato\[, Zona horaria\]) {#formatdatetime} + +Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. + +Modificadores compatibles para Formato: +(“Example” columna muestra el resultado de formateo para el tiempo `2018-01-02 22:33:44`) + +| Modificador | Descripci | Ejemplo | +|-----------------|------------------------------------------------------------------|------------| +| %C | año dividido por 100 y truncado a entero (00-99) | 20 | +| %d | día del mes, cero acolchado (01-31) | 02 | +| %D | Fecha corta de MM/DD/YY, equivalente a %m/%d/%y | 01/02/18 | +| %e | día del mes, espacio acolchado ( 1-31) | 2 | +| %F | fecha corta AAAA-MM-DD, equivalente a %Y-%m-%d | 2018-01-02 | +| %H | hora en formato 24h (00-23) | 22 | +| %I | hora en formato 12h (01-12) | 10 | +| %j | día del año (001-366) | 002 | +| Más información | mes como un número decimal (01-12) | 01 | +| %M | minutos (00-59) | 33 | +| %y | carácter de nueva línea (’’) | | +| %p | Designación AM o PM | PM | +| %R | HH de 24 horas: Tiempo del milímetro, equivalente a %H: %M | 22:33 | +| %S | segundo (00-59) | 44 | +| % t | carácter de pestaña horizontal (’) | | +| %T | Formato de hora ISO 8601 (HH:MM:SS), equivalente a %H:%M:%S | 22:33:44 | +| %u | ISO 8601 día de la semana como número con el lunes como 1 (1-7) | 2 | +| %V | Número de semana ISO 8601 (01-53) | 01 | +| % w | día de la semana como un número decimal con domingo como 0 (0-6) | 2 | +| %y | Año, últimos dos dígitos (00-99) | 18 | +| %Y | Año | 2018 | +| %% | signo | % | + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/es/sql-reference/functions/encoding-functions.md b/docs/es/sql-reference/functions/encoding-functions.md new file mode 100644 index 00000000000..b5bc5e35729 --- /dev/null +++ b/docs/es/sql-reference/functions/encoding-functions.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 52 +toc_title: "Codificaci\xF3n" +--- + +# Funciones De codificación {#encoding-functions} + +## char {#char} + +Devuelve la cadena con la longitud como el número de argumentos pasados y cada byte tiene el valor del argumento correspondiente. Acepta varios argumentos de tipos numéricos. Si el valor del argumento está fuera del rango del tipo de datos UInt8, se convierte a UInt8 con posible redondeo y desbordamiento. + +**Sintaxis** + +``` sql +char(number_1, [number_2, ..., number_n]); +``` + +**Parámetros** + +- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [En](../../sql-reference/data-types/int-uint.md), [Flotante](../../sql-reference/data-types/float.md). + +**Valor devuelto** + +- una cadena de bytes. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello +``` + +Resultado: + +``` text +┌─hello─┐ +│ hello │ +└───────┘ +``` + +Puede construir una cadena de codificación arbitraria pasando los bytes correspondientes. Aquí hay un ejemplo para UTF-8: + +Consulta: + +``` sql +SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; +``` + +Resultado: + +``` text +┌─hello──┐ +│ привет │ +└────────┘ +``` + +Consulta: + +``` sql +SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; +``` + +Resultado: + +``` text +┌─hello─┐ +│ 你好 │ +└───────┘ +``` + +## hexagonal {#hex} + +Devuelve una cadena que contiene la representación hexadecimal del argumento. + +**Sintaxis** + +``` sql +hex(arg) +``` + +La función está usando letras mayúsculas `A-F` y no usar ningún prefijo (como `0x`) o sufijos (como `h`). + +Para argumentos enteros, imprime dígitos hexadecimales (“nibbles”) del más significativo al menos significativo (big endian o “human readable” orden). Comienza con el byte distinto de cero más significativo (se omiten los cero bytes principales) pero siempre imprime ambos dígitos de cada byte incluso si el dígito inicial es cero. + +Ejemplo: + +**Ejemplo** + +Consulta: + +``` sql +SELECT hex(1); +``` + +Resultado: + +``` text +01 +``` + +Valores de tipo `Date` y `DateTime` están formateados como enteros correspondientes (el número de días desde Epoch para Date y el valor de Unix Timestamp para DateTime). + +Para `String` y `FixedString`, todos los bytes son simplemente codificados como dos números hexadecimales. No se omiten cero bytes. + +Los valores de los tipos de coma flotante y Decimal se codifican como su representación en la memoria. Como apoyamos la pequeña arquitectura endian, están codificados en little endian. No se omiten cero bytes iniciales / finales. + +**Parámetros** + +- `arg` — A value to convert to hexadecimal. Types: [Cadena](../../sql-reference/data-types/string.md), [UInt](../../sql-reference/data-types/int-uint.md), [Flotante](../../sql-reference/data-types/float.md), [Decimal](../../sql-reference/data-types/decimal.md), [Fecha](../../sql-reference/data-types/date.md) o [FechaHora](../../sql-reference/data-types/datetime.md). + +**Valor devuelto** + +- Una cadena con la representación hexadecimal del argumento. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); +``` + +Resultado: + +``` text +┌─hex_presentation─┐ +│ 00007041 │ +│ 00008041 │ +└──────────────────┘ +``` + +Consulta: + +``` sql +SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); +``` + +Resultado: + +``` text +┌─hex_presentation─┐ +│ 0000000000002E40 │ +│ 0000000000003040 │ +└──────────────────┘ +``` + +## unhex(str) {#unhexstr} + +Acepta una cadena que contiene cualquier número de dígitos hexadecimales y devuelve una cadena que contiene los bytes correspondientes. Admite letras mayúsculas y minúsculas A-F. El número de dígitos hexadecimales no tiene que ser par. Si es impar, el último dígito se interpreta como la mitad menos significativa del byte 00-0F. Si la cadena de argumento contiene algo que no sean dígitos hexadecimales, se devuelve algún resultado definido por la implementación (no se produce una excepción). +Si desea convertir el resultado en un número, puede usar el ‘reverse’ y ‘reinterpretAsType’ función. + +## UUIDStringToNum (str) {#uuidstringtonumstr} + +Acepta una cadena que contiene 36 caracteres en el formato `123e4567-e89b-12d3-a456-426655440000`, y lo devuelve como un conjunto de bytes en un FixedString(16). + +## UUIDNumToString (str) {#uuidnumtostringstr} + +Acepta un valor de FixedString(16). Devuelve una cadena que contiene 36 caracteres en formato de texto. + +## ¿Cómo puedo hacerlo?) {#bitmasktolistnum} + +Acepta un entero. Devuelve una cadena que contiene la lista de potencias de dos que suman el número de origen cuando se suma. Están separados por comas sin espacios en formato de texto, en orden ascendente. + +## ¿Qué puedes encontrar en Neodigit) {#bitmasktoarraynum} + +Acepta un entero. Devuelve una matriz de números UInt64 que contiene la lista de potencias de dos que suman el número de origen cuando se suma. Los números en la matriz están en orden ascendente. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/es/sql-reference/functions/ext-dict-functions.md b/docs/es/sql-reference/functions/ext-dict-functions.md new file mode 100644 index 00000000000..c9360bcffed --- /dev/null +++ b/docs/es/sql-reference/functions/ext-dict-functions.md @@ -0,0 +1,205 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 58 +toc_title: Trabajar con diccionarios externos +--- + +# Funciones Para Trabajar Con Diccionarios Externos {#ext_dict_functions} + +Para obtener información sobre cómo conectar y configurar diccionarios externos, consulte [Diccionarios externos](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +## dictGet {#dictget} + +Recupera un valor de un diccionario externo. + +``` sql +dictGet('dict_name', 'attr_name', id_expr) +dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Parámetros** + +- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql-reference/data-types/int-uint.md) o [Tupla](../../sql-reference/data-types/tuple.md)valor -type dependiendo de la configuración del diccionario. +- `default_value_expr` — Value returned if the dictionary doesn’t contain a row with the `id_expr` clave. [Expresion](../syntax.md#syntax-expressions) devolviendo el valor en el tipo de datos configurado para `attr_name` atributo. + +**Valor devuelto** + +- Si ClickHouse analiza el atributo correctamente en el [tipo de datos del atributo](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), funciones devuelven el valor del atributo de diccionario que corresponde a `id_expr`. + +- Si no hay la clave, correspondiente a `id_expr` en el diccionario, entonces: + + - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. + +ClickHouse produce una excepción si no puede analizar el valor del atributo o si el valor no coincide con el tipo de datos del atributo. + +**Ejemplo** + +Crear un archivo de texto `ext-dict-text.csv` que contiene los siguientes: + +``` text +1,1 +2,2 +``` + +La primera columna es `id` la segunda columna es `c1`. + +Configurar el diccionario externo: + +``` xml + + + ext-dict-test + + + /path-to/ext-dict-test.csv + CSV + + + + + + + + id + + + c1 + UInt32 + + + + 0 + + +``` + +Realizar la consulta: + +``` sql +SELECT + dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, + toTypeName(val) AS type +FROM system.numbers +LIMIT 3 +``` + +``` text +┌─val─┬─type───┐ +│ 1 │ UInt32 │ +│ 2 │ UInt32 │ +│ 20 │ UInt32 │ +└─────┴────────┘ +``` + +**Ver también** + +- [Diccionarios externos](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) + +## dictHas {#dicthas} + +Comprueba si hay una clave en un diccionario. + +``` sql +dictHas('dict_name', id_expr) +``` + +**Parámetros** + +- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql-reference/data-types/int-uint.md)-tipo de valor. + +**Valor devuelto** + +- 0, si no hay clave. +- 1, si hay una llave. + +Tipo: `UInt8`. + +## dictGetHierarchy {#dictgethierarchy} + +Crea una matriz, que contiene todos los padres de una clave [diccionario jerárquico](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md). + +**Sintaxis** + +``` sql +dictGetHierarchy('dict_name', key) +``` + +**Parámetros** + +- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). +- `key` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql-reference/data-types/int-uint.md)-tipo de valor. + +**Valor devuelto** + +- Padres por la llave. + +Tipo: [Matriz (UInt64)](../../sql-reference/data-types/array.md). + +## DictIsIn {#dictisin} + +Comprueba el antecesor de una clave a través de toda la cadena jerárquica en el diccionario. + +``` sql +dictIsIn('dict_name', child_id_expr, ancestor_id_expr) +``` + +**Parámetros** + +- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). +- `child_id_expr` — Key to be checked. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql-reference/data-types/int-uint.md)-tipo de valor. +- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` clave. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql-reference/data-types/int-uint.md)-tipo de valor. + +**Valor devuelto** + +- 0, si `child_id_expr` no es un niño de `ancestor_id_expr`. +- 1, si `child_id_expr` es un niño de `ancestor_id_expr` o si `child_id_expr` es una `ancestor_id_expr`. + +Tipo: `UInt8`. + +## Otras Funciones {#ext_dict_functions-other} + +ClickHouse admite funciones especializadas que convierten los valores de atributo de diccionario a un tipo de datos específico, independientemente de la configuración del diccionario. + +Función: + +- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` +- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` +- `dictGetFloat32`, `dictGetFloat64` +- `dictGetDate` +- `dictGetDateTime` +- `dictGetUUID` +- `dictGetString` + +Todas estas funciones tienen el `OrDefault` modificación. Por ejemplo, `dictGetDateOrDefault`. + +Sintaxis: + +``` sql +dictGet[Type]('dict_name', 'attr_name', id_expr) +dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Parámetros** + +- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql-reference/data-types/int-uint.md)-tipo de valor. +- `default_value_expr` — Value which is returned if the dictionary doesn’t contain a row with the `id_expr` clave. [Expresion](../syntax.md#syntax-expressions) devolviendo un valor en el tipo de datos configurado para `attr_name` atributo. + +**Valor devuelto** + +- Si ClickHouse analiza el atributo correctamente en el [tipo de datos del atributo](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), funciones devuelven el valor del atributo de diccionario que corresponde a `id_expr`. + +- Si no se solicita `id_expr` en el diccionario entonces: + + - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. + +ClickHouse produce una excepción si no puede analizar el valor del atributo o si el valor no coincide con el tipo de datos del atributo. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/es/sql-reference/functions/functions-for-nulls.md b/docs/es/sql-reference/functions/functions-for-nulls.md new file mode 100644 index 00000000000..06d5e7cc9d0 --- /dev/null +++ b/docs/es/sql-reference/functions/functions-for-nulls.md @@ -0,0 +1,312 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 63 +toc_title: Trabajar con argumentos Nullable +--- + +# Funciones Para Trabajar Con Agregados Anulables {#functions-for-working-with-nullable-aggregates} + +## IsNull {#isnull} + +Comprueba si el argumento es [NULL](../syntax.md#null). + +``` sql +isNull(x) +``` + +**Parámetros** + +- `x` — A value with a non-compound data type. + +**Valor devuelto** + +- `1` si `x` ser `NULL`. +- `0` si `x` no es `NULL`. + +**Ejemplo** + +Tabla de entrada + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Consulta + +``` sql +SELECT x FROM t_null WHERE isNull(y) +``` + +``` text +┌─x─┐ +│ 1 │ +└───┘ +``` + +## isNotNull {#isnotnull} + +Comprueba si el argumento es [NULL](../syntax.md#null). + +``` sql +isNotNull(x) +``` + +**Parámetros:** + +- `x` — A value with a non-compound data type. + +**Valor devuelto** + +- `0` si `x` ser `NULL`. +- `1` si `x` no es `NULL`. + +**Ejemplo** + +Tabla de entrada + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Consulta + +``` sql +SELECT x FROM t_null WHERE isNotNull(y) +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## Coalesce {#coalesce} + +Comprueba de izquierda a derecha si `NULL` se aprobaron argumentos y devuelve el primer no-`NULL` argumento. + +``` sql +coalesce(x,...) +``` + +**Parámetros:** + +- Cualquier número de parámetros de un tipo no compuesto. Todos los parámetros deben ser compatibles por tipo de datos. + +**Valores devueltos** + +- El primer no-`NULL` argumento. +- `NULL` si todos los argumentos son `NULL`. + +**Ejemplo** + +Considere una lista de contactos que pueden especificar varias formas de contactar a un cliente. + +``` text +┌─name─────┬─mail─┬─phone─────┬──icq─┐ +│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ +│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└──────────┴──────┴───────────┴──────┘ +``` + +El `mail` y `phone` los campos son de tipo String, pero el `icq` campo `UInt32`, por lo que necesita ser convertido a `String`. + +Obtenga el primer método de contacto disponible para el cliente de la lista de contactos: + +``` sql +SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook +``` + +``` text +┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ +│ client 1 │ 123-45-67 │ +│ client 2 │ ᴺᵁᴸᴸ │ +└──────────┴──────────────────────────────────────────────────────┘ +``` + +## ifNull {#ifnull} + +Devuelve un valor alternativo si el argumento principal es `NULL`. + +``` sql +ifNull(x,alt) +``` + +**Parámetros:** + +- `x` — The value to check for `NULL`. +- `alt` — The value that the function returns if `x` ser `NULL`. + +**Valores devueltos** + +- Valor `x`, si `x` no es `NULL`. +- Valor `alt`, si `x` ser `NULL`. + +**Ejemplo** + +``` sql +SELECT ifNull('a', 'b') +``` + +``` text +┌─ifNull('a', 'b')─┐ +│ a │ +└──────────────────┘ +``` + +``` sql +SELECT ifNull(NULL, 'b') +``` + +``` text +┌─ifNull(NULL, 'b')─┐ +│ b │ +└───────────────────┘ +``` + +## nullIf {#nullif} + +Devoluciones `NULL` si los argumentos son iguales. + +``` sql +nullIf(x, y) +``` + +**Parámetros:** + +`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. + +**Valores devueltos** + +- `NULL` si los argumentos son iguales. +- El `x` valor, si los argumentos no son iguales. + +**Ejemplo** + +``` sql +SELECT nullIf(1, 1) +``` + +``` text +┌─nullIf(1, 1)─┐ +│ ᴺᵁᴸᴸ │ +└──────────────┘ +``` + +``` sql +SELECT nullIf(1, 2) +``` + +``` text +┌─nullIf(1, 2)─┐ +│ 1 │ +└──────────────┘ +``` + +## assumeNotNull {#assumenotnull} + +Resultados en un valor de tipo [NULL](../../sql-reference/data-types/nullable.md) para un no- `Nullable` si el valor no es `NULL`. + +``` sql +assumeNotNull(x) +``` + +**Parámetros:** + +- `x` — The original value. + +**Valores devueltos** + +- El valor original del-`Nullable` tipo, si no es `NULL`. +- El valor predeterminado para el-`Nullable` tipo si el valor original fue `NULL`. + +**Ejemplo** + +Considere el `t_null` tabla. + +``` sql +SHOW CREATE TABLE t_null +``` + +``` text +┌─statement─────────────────────────────────────────────────────────────────┐ +│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ +└───────────────────────────────────────────────────────────────────────────┘ +``` + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Aplicar el `assumeNotNull` función a la `y` columna. + +``` sql +SELECT assumeNotNull(y) FROM t_null +``` + +``` text +┌─assumeNotNull(y)─┐ +│ 0 │ +│ 3 │ +└──────────────────┘ +``` + +``` sql +SELECT toTypeName(assumeNotNull(y)) FROM t_null +``` + +``` text +┌─toTypeName(assumeNotNull(y))─┐ +│ Int8 │ +│ Int8 │ +└──────────────────────────────┘ +``` + +## Acerca De Nosotros {#tonullable} + +Convierte el tipo de argumento a `Nullable`. + +``` sql +toNullable(x) +``` + +**Parámetros:** + +- `x` — The value of any non-compound type. + +**Valor devuelto** + +- El valor de entrada con un `Nullable` tipo. + +**Ejemplo** + +``` sql +SELECT toTypeName(10) +``` + +``` text +┌─toTypeName(10)─┐ +│ UInt8 │ +└────────────────┘ +``` + +``` sql +SELECT toTypeName(toNullable(10)) +``` + +``` text +┌─toTypeName(toNullable(10))─┐ +│ Nullable(UInt8) │ +└────────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/es/sql-reference/functions/geo.md b/docs/es/sql-reference/functions/geo.md new file mode 100644 index 00000000000..717e33a5e68 --- /dev/null +++ b/docs/es/sql-reference/functions/geo.md @@ -0,0 +1,510 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 62 +toc_title: "Trabajar con coordenadas geogr\xE1ficas" +--- + +# Funciones Para Trabajar Con Coordenadas geográficas {#functions-for-working-with-geographical-coordinates} + +## GreatCircleDistance {#greatcircledistance} + +Calcule la distancia entre dos puntos en la superficie de la Tierra usando [la fórmula del gran círculo](https://en.wikipedia.org/wiki/Great-circle_distance). + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**Parámetros de entrada** + +- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. +- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. +- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. +- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. + +Los valores positivos corresponden a latitud norte y longitud este, y los valores negativos corresponden a latitud sur y longitud oeste. + +**Valor devuelto** + +La distancia entre dos puntos en la superficie de la Tierra, en metros. + +Genera una excepción cuando los valores de los parámetros de entrada están fuera del intervalo. + +**Ejemplo** + +``` sql +SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) +``` + +``` text +┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ +│ 14132374.194975413 │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## pointInEllipses {#pointinellipses} + +Comprueba si el punto pertenece al menos a una de las elipses. +Las coordenadas son geométricas en el sistema de coordenadas cartesianas. + +``` sql +pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) +``` + +**Parámetros de entrada** + +- `x, y` — Coordinates of a point on the plane. +- `xᵢ, yᵢ` — Coordinates of the center of the `i`-ésimo puntos suspensivos. +- `aᵢ, bᵢ` — Axes of the `i`-ésimo puntos suspensivos en unidades de coordenadas x, y. + +Los parámetros de entrada deben ser `2+4⋅n`, donde `n` es el número de puntos suspensivos. + +**Valores devueltos** + +`1` si el punto está dentro de al menos una de las elipses; `0`si no lo es. + +**Ejemplo** + +``` sql +SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) +``` + +``` text +┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ +│ 1 │ +└─────────────────────────────────────────────────┘ +``` + +## pointInPolygon {#pointinpolygon} + +Comprueba si el punto pertenece al polígono en el plano. + +``` sql +pointInPolygon((x, y), [(a, b), (c, d) ...], ...) +``` + +**Valores de entrada** + +- `(x, y)` — Coordinates of a point on the plane. Data type — [Tupla](../../sql-reference/data-types/tuple.md) — A tuple of two numbers. +- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [Matriz](../../sql-reference/data-types/array.md). Cada vértice está representado por un par de coordenadas `(a, b)`. Los vértices deben especificarse en sentido horario o antihorario. El número mínimo de vértices es 3. El polígono debe ser constante. +- La función también admite polígonos con agujeros (secciones recortadas). En este caso, agregue polígonos que definan las secciones recortadas utilizando argumentos adicionales de la función. La función no admite polígonos no simplemente conectados. + +**Valores devueltos** + +`1` si el punto está dentro del polígono, `0` si no lo es. +Si el punto está en el límite del polígono, la función puede devolver 0 o 1. + +**Ejemplo** + +``` sql +SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## geohashEncode {#geohashencode} + +Codifica la latitud y la longitud como una cadena geohash, consulte (http://geohash.org/, https://en.wikipedia.org/wiki/Geohash). + +``` sql +geohashEncode(longitude, latitude, [precision]) +``` + +**Valores de entrada** + +- longitud - longitud parte de la coordenada que desea codificar. Flotando en el rango`[-180°, 180°]` +- latitude : parte de latitud de la coordenada que desea codificar. Flotando en el rango `[-90°, 90°]` +- precision - Opcional, longitud de la cadena codificada resultante, por defecto es `12`. Entero en el rango `[1, 12]`. Cualquier valor menor que `1` o mayor que `12` se convierte silenciosamente a `12`. + +**Valores devueltos** + +- alfanumérico `String` de coordenadas codificadas (se utiliza la versión modificada del alfabeto de codificación base32). + +**Ejemplo** + +``` sql +SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res +``` + +``` text +┌─res──────────┐ +│ ezs42d000000 │ +└──────────────┘ +``` + +## geohashDecode {#geohashdecode} + +Decodifica cualquier cadena codificada por geohash en longitud y latitud. + +**Valores de entrada** + +- encoded string - cadena codificada geohash. + +**Valores devueltos** + +- (longitud, latitud) - 2-tupla de `Float64` valores de longitud y latitud. + +**Ejemplo** + +``` sql +SELECT geohashDecode('ezs42') AS res +``` + +``` text +┌─res─────────────────────────────┐ +│ (-5.60302734375,42.60498046875) │ +└─────────────────────────────────┘ +``` + +## geoToH3 {#geotoh3} + +Devoluciones [H3](https://uber.github.io/h3/#/documentation/overview/introduction) índice de punto `(lon, lat)` con la resolución especificada. + +[H3](https://uber.github.io/h3/#/documentation/overview/introduction) es un sistema de indexación geográfica donde la superficie de la Tierra se divide en incluso azulejos hexagonales. Este sistema es jerárquico, es decir, cada hexágono en el nivel superior se puede dividir en siete incluso pero más pequeños y así sucesivamente. + +Este índice se utiliza principalmente para ubicaciones de bucketing y otras manipulaciones geoespaciales. + +**Sintaxis** + +``` sql +geoToH3(lon, lat, resolution) +``` + +**Parámetros** + +- `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]`. Tipo: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- Número de índice hexagonal. +- 0 en caso de error. + +Tipo: `UInt64`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index +``` + +Resultado: + +``` text +┌────────────h3Index─┐ +│ 644325524701193974 │ +└────────────────────┘ +``` + +## Información Adicional {#geohashesinbox} + +Devuelve una matriz de cadenas codificadas por geohash de precisión dada que caen dentro e intersecan los límites de un cuadro dado, básicamente una cuadrícula 2D aplanada en una matriz. + +**Valores de entrada** + +- longitude\_min - longitud mínima, valor flotante en el rango `[-180°, 180°]` +- latitude\_min - latitud mínima, valor flotante en el rango `[-90°, 90°]` +- longitude\_max - longitud máxima, valor flotante en el rango `[-180°, 180°]` +- latitude\_max - latitud máxima, valor flotante en el rango `[-90°, 90°]` +- precisión - precisión del geohash, `UInt8` en el rango `[1, 12]` + +Tenga en cuenta que todos los parámetros de coordenadas deben ser del mismo tipo: `Float32` o `Float64`. + +**Valores devueltos** + +- matriz de cadenas de precisión largas de geohash-cajas que cubren el área proporcionada, no debe confiar en el orden de los artículos. +- \[\] - matriz vacía si *minuto* valores de *latitud* y *longitud* no son menos que los correspondientes *máximo* valor. + +Tenga en cuenta que la función arrojará una excepción si la matriz resultante tiene más de 10’000’000 de elementos. + +**Ejemplo** + +``` sql +SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos +``` + +``` text +┌─thasos──────────────────────────────────────┐ +│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ +└─────────────────────────────────────────────┘ +``` + +## h3GetBaseCell {#h3getbasecell} + +Devuelve el número de celda base del índice. + +**Sintaxis** + +``` sql +h3GetBaseCell(index) +``` + +**Parámetros** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- Número de celda base hexagonal. Tipo: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT h3GetBaseCell(612916788725809151) as basecell +``` + +Resultado: + +``` text +┌─basecell─┐ +│ 12 │ +└──────────┘ +``` + +## H3HexAreaM2 {#h3hexaream2} + +Área hexagonal promedio en metros cuadrados a la resolución dada. + +**Sintaxis** + +``` sql +h3HexAreaM2(resolution) +``` + +**Parámetros** + +- `resolution` — Index resolution. Range: `[0, 15]`. Tipo: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- Area in m². Type: [Float64](../../sql-reference/data-types/float.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT h3HexAreaM2(13) as area +``` + +Resultado: + +``` text +┌─area─┐ +│ 43.9 │ +└──────┘ +``` + +## h3IndexesAreNeighbors {#h3indexesareneighbors} + +Devuelve si los H3Indexes proporcionados son vecinos o no. + +**Sintaxis** + +``` sql +h3IndexesAreNeighbors(index1, index2) +``` + +**Parámetros** + +- `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). + +**Valores devueltos** + +- Devoluciones `1` si los índices son vecinos, `0` de lo contrario. Tipo: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n +``` + +Resultado: + +``` text +┌─n─┐ +│ 1 │ +└───┘ +``` + +## H3ToChildren {#h3tochildren} + +Devuelve una matriz con los índices secundarios del índice dado. + +**Sintaxis** + +``` sql +h3ToChildren(index, resolution) +``` + +**Parámetros** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. Tipo: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- Matriz con los índices H3 hijo. Matriz de tipo: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT h3ToChildren(599405990164561919, 6) AS children +``` + +Resultado: + +``` text +┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## H3ToParent {#h3toparent} + +Devuelve el índice primario (más grueso) que contiene el índice dado. + +**Sintaxis** + +``` sql +h3ToParent(index, resolution) +``` + +**Parámetros** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. Tipo: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- Índice padre H3. Tipo: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT h3ToParent(599405990164561919, 3) as parent +``` + +Resultado: + +``` text +┌─────────────parent─┐ +│ 590398848891879423 │ +└────────────────────┘ +``` + +## H3ToString {#h3tostring} + +Convierte la representación H3Index del índice en la representación de cadena. + +``` sql +h3ToString(index) +``` + +**Parámetros** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- Representación de cadena del índice H3. Tipo: [Cadena](../../sql-reference/data-types/string.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT h3ToString(617420388352917503) as h3_string +``` + +Resultado: + +``` text +┌─h3_string───────┐ +│ 89184926cdbffff │ +└─────────────────┘ +``` + +## stringToH3 {#stringtoh3} + +Convierte la representación de cadena en representación H3Index (UInt64). + +``` sql +stringToH3(index_str) +``` + +**Parámetros** + +- `index_str` — String representation of the H3 index. Type: [Cadena](../../sql-reference/data-types/string.md). + +**Valores devueltos** + +- Número de índice hexagonal. Devuelve 0 en caso de error. Tipo: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT stringToH3('89184926cc3ffff') as index +``` + +Resultado: + +``` text +┌──────────────index─┐ +│ 617420388351344639 │ +└────────────────────┘ +``` + +## h3GetResolution {#h3getresolution} + +Devuelve la resolución del índice. + +**Sintaxis** + +``` sql +h3GetResolution(index) +``` + +**Parámetros** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Valores devueltos** + +- Resolución del índice. Gama: `[0, 15]`. Tipo: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT h3GetResolution(617420388352917503) as res +``` + +Resultado: + +``` text +┌─res─┐ +│ 9 │ +└─────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/es/sql-reference/functions/hash-functions.md b/docs/es/sql-reference/functions/hash-functions.md new file mode 100644 index 00000000000..e0135cf9eff --- /dev/null +++ b/docs/es/sql-reference/functions/hash-functions.md @@ -0,0 +1,446 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 50 +toc_title: Hash +--- + +# Funciones Hash {#hash-functions} + +Las funciones Hash se pueden usar para la barajada pseudoaleatoria determinista de elementos. + +## HalfMD5 {#hash-functions-halfmd5} + +[Interpretar](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) todos los parámetros de entrada como cadenas y calcula el [MD5](https://en.wikipedia.org/wiki/MD5) valor hash para cada uno de ellos. Luego combina hashes, toma los primeros 8 bytes del hash de la cadena resultante y los interpreta como `UInt64` en orden de bytes de big-endian. + +``` sql +halfMD5(par1, ...) +``` + +La función es relativamente lenta (5 millones de cadenas cortas por segundo por núcleo del procesador). +Considere usar el [sipHash64](#hash_functions-siphash64) función en su lugar. + +**Parámetros** + +La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql-reference/data-types/index.md). + +**Valor devuelto** + +A [UInt64](../../sql-reference/data-types/int-uint.md) tipo de datos valor hash. + +**Ejemplo** + +``` sql +SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type +``` + +``` text +┌────────halfMD5hash─┬─type───┐ +│ 186182704141653334 │ UInt64 │ +└────────────────────┴────────┘ +``` + +## MD5 {#hash_functions-md5} + +Calcula el MD5 de una cadena y devuelve el conjunto de bytes resultante como FixedString(16). +Si no necesita MD5 en particular, pero necesita un hash criptográfico decente de 128 bits, use el ‘sipHash128’ función en su lugar. +Si desea obtener el mismo resultado que la salida de la utilidad md5sum, use lower(hex(MD5(s)) . + +## sipHash64 {#hash_functions-siphash64} + +Produce un [SipHash](https://131002.net/siphash/) valor hash. + +``` sql +sipHash64(par1,...) +``` + +Esta es una función hash criptográfica. Funciona al menos tres veces más rápido que el [MD5](#hash_functions-md5) función. + +Función [interpretar](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) todos los parámetros de entrada como cadenas y calcula el valor hash para cada uno de ellos. Luego combina hashes por el siguiente algoritmo: + +1. Después de hash todos los parámetros de entrada, la función obtiene la matriz de hashes. +2. La función toma el primero y el segundo elementos y calcula un hash para la matriz de ellos. +3. Luego, la función toma el valor hash, calculado en el paso anterior, y el tercer elemento de la matriz hash inicial, y calcula un hash para la matriz de ellos. +4. El paso anterior se repite para todos los elementos restantes de la matriz hash inicial. + +**Parámetros** + +La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql-reference/data-types/index.md). + +**Valor devuelto** + +A [UInt64](../../sql-reference/data-types/int-uint.md) tipo de datos valor hash. + +**Ejemplo** + +``` sql +SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type +``` + +``` text +┌──────────────SipHash─┬─type───┐ +│ 13726873534472839665 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## sipHash128 {#hash_functions-siphash128} + +Calcula SipHash a partir de una cadena. +Acepta un argumento de tipo String. Devuelve FixedString(16). +Difiere de sipHash64 en que el estado final de plegado xor solo se realiza hasta 128 bits. + +## cityHash64 {#cityhash64} + +Produce un [Método de codificación de datos:](https://github.com/google/cityhash) valor hash. + +``` sql +cityHash64(par1,...) +``` + +Esta es una función hash rápida no criptográfica. Utiliza el algoritmo CityHash para parámetros de cadena y la función hash no criptográfica rápida específica de la implementación para parámetros con otros tipos de datos. La función utiliza el combinador CityHash para obtener los resultados finales. + +**Parámetros** + +La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql-reference/data-types/index.md). + +**Valor devuelto** + +A [UInt64](../../sql-reference/data-types/int-uint.md) tipo de datos valor hash. + +**Ejemplos** + +Ejemplo de llamada: + +``` sql +SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type +``` + +``` text +┌─────────────CityHash─┬─type───┐ +│ 12072650598913549138 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +En el ejemplo siguiente se muestra cómo calcular la suma de comprobación de toda la tabla con precisión hasta el orden de fila: + +``` sql +SELECT groupBitXor(cityHash64(*)) FROM table +``` + +## intHash32 {#inthash32} + +Calcula un código hash de 32 bits a partir de cualquier tipo de entero. +Esta es una función hash no criptográfica relativamente rápida de calidad media para los números. + +## intHash64 {#inthash64} + +Calcula un código hash de 64 bits a partir de cualquier tipo de entero. +Funciona más rápido que intHash32. Calidad media. + +## SHA1 {#sha1} + +## SHA224 {#sha224} + +## SHA256 {#sha256} + +Calcula SHA-1, SHA-224 o SHA-256 de una cadena y devuelve el conjunto de bytes resultante como FixedString(20), FixedString(28) o FixedString(32). +La función funciona bastante lentamente (SHA-1 procesa alrededor de 5 millones de cadenas cortas por segundo por núcleo del procesador, mientras que SHA-224 y SHA-256 procesan alrededor de 2.2 millones). +Recomendamos usar esta función solo en los casos en que necesite una función hash específica y no pueda seleccionarla. +Incluso en estos casos, recomendamos aplicar la función offline y precalcular valores al insertarlos en la tabla, en lugar de aplicarlo en SELECTS. + +## Nombre De La Red inalámbrica (SSID):\]) {#urlhashurl-n} + +Una función hash no criptográfica rápida y de calidad decente para una cadena obtenida de una URL utilizando algún tipo de normalización. +`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` o `#` al final, si está presente. +`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` o `#` al final, si está presente. +Los niveles son los mismos que en URLHierarchy. Esta función es específica de Yandex.Métrica. + +## Método De codificación De Datos: {#farmhash64} + +Produce un [Método de codificación de datos:](https://github.com/google/farmhash) valor hash. + +``` sql +farmHash64(par1, ...) +``` + +La función utiliza el `Hash64` de todos [métodos disponibles](https://github.com/google/farmhash/blob/master/src/farmhash.h). + +**Parámetros** + +La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql-reference/data-types/index.md). + +**Valor devuelto** + +A [UInt64](../../sql-reference/data-types/int-uint.md) tipo de datos valor hash. + +**Ejemplo** + +``` sql +SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type +``` + +``` text +┌─────────────FarmHash─┬─type───┐ +│ 17790458267262532859 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## Nombre De La Red inalámbrica (SSID): {#hash_functions-javahash} + +Calcular [Nivel de Cifrado WEP](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) de una cuerda. Esta función hash no es rápida ni tiene una buena calidad. La única razón para usarlo es cuando este algoritmo ya se usa en otro sistema y debe calcular exactamente el mismo resultado. + +**Sintaxis** + +``` sql +SELECT javaHash(''); +``` + +**Valor devuelto** + +A `Int32` tipo de datos valor hash. + +**Ejemplo** + +Consulta: + +``` sql +SELECT javaHash('Hello, world!'); +``` + +Resultado: + +``` text +┌─javaHash('Hello, world!')─┐ +│ -1880044555 │ +└───────────────────────────┘ +``` + +## javaHashUTF16LE {#javahashutf16le} + +Calcular [Nivel de Cifrado WEP](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) de una cadena, suponiendo que contiene bytes que representan una cadena en codificación UTF-16LE. + +**Sintaxis** + +``` sql +javaHashUTF16LE(stringUtf16le) +``` + +**Parámetros** + +- `stringUtf16le` — a string in UTF-16LE encoding. + +**Valor devuelto** + +A `Int32` tipo de datos valor hash. + +**Ejemplo** + +Consulta correcta con cadena codificada UTF-16LE. + +Consulta: + +``` sql +SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) +``` + +Resultado: + +``` text +┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ +│ 3556498 │ +└──────────────────────────────────────────────────────────────┘ +``` + +## HiveHash {#hash-functions-hivehash} + +Calcular `HiveHash` de una cuerda. + +``` sql +SELECT hiveHash(''); +``` + +Esto es sólo [Nivel de Cifrado WEP](#hash_functions-javahash) con poco de signo puesto a cero. Esta función se utiliza en [Colmena de Apache](https://en.wikipedia.org/wiki/Apache_Hive) para versiones anteriores a la 3.0. Esta función hash no es rápida ni tiene una buena calidad. La única razón para usarlo es cuando este algoritmo ya se usa en otro sistema y debe calcular exactamente el mismo resultado. + +**Valor devuelto** + +A `Int32` tipo de datos valor hash. + +Tipo: `hiveHash`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT hiveHash('Hello, world!'); +``` + +Resultado: + +``` text +┌─hiveHash('Hello, world!')─┐ +│ 267439093 │ +└───────────────────────────┘ +``` + +## Método De codificación De Datos: {#metrohash64} + +Produce un [Método de codificación de datos:](http://www.jandrewrogers.com/2015/05/27/metrohash/) valor hash. + +``` sql +metroHash64(par1, ...) +``` + +**Parámetros** + +La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql-reference/data-types/index.md). + +**Valor devuelto** + +A [UInt64](../../sql-reference/data-types/int-uint.md) tipo de datos valor hash. + +**Ejemplo** + +``` sql +SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type +``` + +``` text +┌────────────MetroHash─┬─type───┐ +│ 14235658766382344533 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## SaltarConsistentHash {#jumpconsistenthash} + +Calcula JumpConsistentHash forma un UInt64. +Acepta dos argumentos: una clave de tipo UInt64 y el número de cubos. Devuelve Int32. +Para obtener más información, consulte el enlace: [SaltarConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) + +## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} + +Produce un [Método de codificación de datos:](https://github.com/aappleby/smhasher) valor hash. + +``` sql +murmurHash2_32(par1, ...) +murmurHash2_64(par1, ...) +``` + +**Parámetros** + +Ambas funciones toman un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql-reference/data-types/index.md). + +**Valor devuelto** + +- El `murmurHash2_32` función devuelve el valor hash que tiene el [UInt32](../../sql-reference/data-types/int-uint.md) tipo de datos. +- El `murmurHash2_64` función devuelve el valor hash que tiene el [UInt64](../../sql-reference/data-types/int-uint.md) tipo de datos. + +**Ejemplo** + +``` sql +SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type +``` + +``` text +┌──────────MurmurHash2─┬─type───┐ +│ 11832096901709403633 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} + +Produce un [Método de codificación de datos:](https://github.com/aappleby/smhasher) valor hash. + +``` sql +murmurHash3_32(par1, ...) +murmurHash3_64(par1, ...) +``` + +**Parámetros** + +Ambas funciones toman un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql-reference/data-types/index.md). + +**Valor devuelto** + +- El `murmurHash3_32` función devuelve un [UInt32](../../sql-reference/data-types/int-uint.md) tipo de datos valor hash. +- El `murmurHash3_64` función devuelve un [UInt64](../../sql-reference/data-types/int-uint.md) tipo de datos valor hash. + +**Ejemplo** + +``` sql +SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3─┬─type───┐ +│ 2152717 │ UInt32 │ +└─────────────┴────────┘ +``` + +## murmurHash3\_128 {#murmurhash3-128} + +Produce un [Método de codificación de datos:](https://github.com/aappleby/smhasher) valor hash. + +``` sql +murmurHash3_128( expr ) +``` + +**Parámetros** + +- `expr` — [Expresiones](../syntax.md#syntax-expressions) devolviendo un [Cadena](../../sql-reference/data-types/string.md)-tipo de valor. + +**Valor devuelto** + +A [Cadena fija (16)](../../sql-reference/data-types/fixedstring.md) tipo de datos valor hash. + +**Ejemplo** + +``` sql +SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3──────┬─type────────────┐ +│ 6�1�4"S5KT�~~q │ FixedString(16) │ +└──────────────────┴─────────────────┘ +``` + +## xxHash32, xxHash64 {#hash-functions-xxhash32} + +Calcular `xxHash` de una cuerda. Se propone en dos sabores, 32 y 64 bits. + +``` sql +SELECT xxHash32(''); + +OR + +SELECT xxHash64(''); +``` + +**Valor devuelto** + +A `Uint32` o `Uint64` tipo de datos valor hash. + +Tipo: `xxHash`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT xxHash32('Hello, world!'); +``` + +Resultado: + +``` text +┌─xxHash32('Hello, world!')─┐ +│ 834093149 │ +└───────────────────────────┘ +``` + +**Ver también** + +- [xxHash](http://cyan4973.github.io/xxHash/). + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/es/sql-reference/functions/higher-order-functions.md b/docs/es/sql-reference/functions/higher-order-functions.md new file mode 100644 index 00000000000..cf4baa0fc4b --- /dev/null +++ b/docs/es/sql-reference/functions/higher-order-functions.md @@ -0,0 +1,264 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 57 +toc_title: Orden superior +--- + +# Funciones De Orden Superior {#higher-order-functions} + +## `->` operador, función lambda (params, expr) {#operator-lambdaparams-expr-function} + +Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. + +Ejemplos: `x -> 2 * x, str -> str != Referer.` + +Las funciones de orden superior solo pueden aceptar funciones lambda como su argumento funcional. + +Una función lambda que acepta múltiples argumentos se puede pasar a una función de orden superior. En este caso, a la función de orden superior se le pasan varias matrices de idéntica longitud a las que corresponderán estos argumentos. + +Para algunas funciones, tales como [arrayCount](#higher_order_functions-array-count) o [arraySum](#higher_order_functions-array-count), el primer argumento (la función lambda) se puede omitir. En este caso, se supone un mapeo idéntico. + +No se puede omitir una función lambda para las siguientes funciones: + +- [arrayMap](#higher_order_functions-array-map) +- [arrayFilter](#higher_order_functions-array-filter) +- [arrayFill](#higher_order_functions-array-fill) +- [arrayReverseFill](#higher_order_functions-array-reverse-fill) +- [arraySplit](#higher_order_functions-array-split) +- [arrayReverseSplit](#higher_order_functions-array-reverse-split) +- [arrayFirst](#higher_order_functions-array-first) +- [arrayFirstIndex](#higher_order_functions-array-first-index) + +### arrayMap(func, arr1, …) {#higher_order_functions-array-map} + +Devuelve una matriz obtenida de la aplicación original `func` función a cada elemento en el `arr` matriz. + +Ejemplos: + +``` sql +SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,4,5] │ +└─────────┘ +``` + +En el ejemplo siguiente se muestra cómo crear una tupla de elementos de diferentes matrices: + +``` sql +SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res +``` + +``` text +┌─res─────────────────┐ +│ [(1,4),(2,5),(3,6)] │ +└─────────────────────┘ +``` + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayMap` función. + +### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} + +Devuelve una matriz que contiene sólo los elementos en `arr1` para los cuales `func` devuelve algo distinto de 0. + +Ejemplos: + +``` sql +SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res +``` + +``` text +┌─res───────────┐ +│ ['abc World'] │ +└───────────────┘ +``` + +``` sql +SELECT + arrayFilter( + (i, x) -> x LIKE '%World%', + arrayEnumerate(arr), + ['Hello', 'abc World'] AS arr) + AS res +``` + +``` text +┌─res─┐ +│ [2] │ +└─────┘ +``` + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFilter` función. + +### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} + +Escanear a través de `arr1` desde el primer elemento hasta el último elemento y reemplazar `arr1[i]` por `arr1[i - 1]` si `func` devuelve 0. El primer elemento de `arr1` no será reemplazado. + +Ejemplos: + +``` sql +SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res──────────────────────────────┐ +│ [1,1,3,11,12,12,12,5,6,14,14,14] │ +└──────────────────────────────────┘ +``` + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFill` función. + +### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} + +Escanear a través de `arr1` del último elemento al primer elemento y reemplace `arr1[i]` por `arr1[i + 1]` si `func` devuelve 0. El último elemento de `arr1` no será reemplazado. + +Ejemplos: + +``` sql +SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res────────────────────────────────┐ +│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ +└────────────────────────────────────┘ +``` + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayReverseFill` función. + +### arraySplit(func, arr1, …) {#higher_order_functions-array-split} + +Dividir `arr1` en múltiples matrices. Cuando `func` devuelve algo distinto de 0, la matriz se dividirá en el lado izquierdo del elemento. La matriz no se dividirá antes del primer elemento. + +Ejemplos: + +``` sql +SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res─────────────┐ +│ [[1,2,3],[4,5]] │ +└─────────────────┘ +``` + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arraySplit` función. + +### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} + +Dividir `arr1` en múltiples matrices. Cuando `func` devuelve algo distinto de 0, la matriz se dividirá en el lado derecho del elemento. La matriz no se dividirá después del último elemento. + +Ejemplos: + +``` sql +SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res───────────────┐ +│ [[1],[2,3,4],[5]] │ +└───────────────────┘ +``` + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arraySplit` función. + +### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} + +Devuelve el número de elementos de la matriz arr para los cuales func devuelve algo distinto de 0. Si ‘func’ no se especifica, devuelve el número de elementos distintos de cero en la matriz. + +### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} + +Devuelve 1 si hay al menos un elemento en ‘arr’ para los cuales ‘func’ devuelve algo distinto de 0. De lo contrario, devuelve 0. + +### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} + +Devuelve 1 si ‘func’ devuelve algo distinto de 0 para todos los elementos en ‘arr’. De lo contrario, devuelve 0. + +### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} + +Devuelve la suma de la ‘func’ valor. Si se omite la función, simplemente devuelve la suma de los elementos de la matriz. + +### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} + +Devuelve el primer elemento en el ‘arr1’ matriz para la cual ‘func’ devuelve algo distinto de 0. + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFirst` función. + +### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} + +Devuelve el índice del primer elemento ‘arr1’ matriz para la cual ‘func’ devuelve algo distinto de 0. + +Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFirstIndex` función. + +### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} + +Devuelve una matriz de sumas parciales de elementos en la matriz de origen (una suma en ejecución). Si el `func` se especifica la función, luego los valores de los elementos de la matriz se convierten mediante esta función antes de sumar. + +Ejemplo: + +``` sql +SELECT arrayCumSum([1, 1, 1, 1]) AS res +``` + +``` text +┌─res──────────┐ +│ [1, 2, 3, 4] │ +└──────────────┘ +``` + +### Información De Archivo) {#arraycumsumnonnegativearr} + +Lo mismo que `arrayCumSum`, devuelve una matriz de sumas parciales de elementos en la matriz de origen (una suma en ejecución). Diferente `arrayCumSum`, cuando el valor devuelto contiene un valor menor que cero, el valor se reemplaza con cero y el cálculo posterior se realiza con cero parámetros. Por ejemplo: + +``` sql +SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,0,1] │ +└───────────┘ +``` + +### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} + +Devuelve una matriz como resultado de ordenar los elementos de `arr1` en orden ascendente. Si el `func` se especifica la función, el orden de clasificación se determina por el resultado de la función `func` aplicado a los elementos de la matriz (arrays) + +El [Transformación de Schwartzian](https://en.wikipedia.org/wiki/Schwartzian_transform) se utiliza para mejorar la eficiencia de clasificación. + +Ejemplo: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Para obtener más información sobre el `arraySort` método, véase el [Funciones para trabajar con matrices](array-functions.md#array_functions-sort) apartado. + +### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} + +Devuelve una matriz como resultado de ordenar los elementos de `arr1` en orden descendente. Si el `func` se especifica la función, el orden de clasificación se determina por el resultado de la función `func` aplicado a los elementos de la matriz (arrays). + +Ejemplo: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +Para obtener más información sobre el `arrayReverseSort` método, véase el [Funciones para trabajar con matrices](array-functions.md#array_functions-reverse-sort) apartado. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/es/sql-reference/functions/in-functions.md b/docs/es/sql-reference/functions/in-functions.md new file mode 100644 index 00000000000..5a366d4cee2 --- /dev/null +++ b/docs/es/sql-reference/functions/in-functions.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 60 +toc_title: "Implementaci\xF3n del operador IN" +--- + +# Funciones Para Implementar El Operador IN {#functions-for-implementing-the-in-operator} + +## Información De Uso {#in-functions} + +Vea la sección [IN operadores](../statements/select.md#select-in-operators). + +## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} + +Una función que permite agrupar varias columnas. +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. +Las tuplas se usan normalmente como valores intermedios para un argumento de operadores IN, o para crear una lista de parámetros formales de funciones lambda. Las tuplas no se pueden escribir en una tabla. + +## Puede Utilizar El Siguiente Ejemplo: {#tupleelementtuple-n-operator-x-n} + +Una función que permite obtener una columna de una tupla. +‘N’ es el índice de columna, comenzando desde 1. N debe ser una constante. ‘N’ debe ser una constante. ‘N’ debe ser un entero postivo estricto no mayor que el tamaño de la tupla. +No hay ningún costo para ejecutar la función. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/es/sql-reference/functions/index.md b/docs/es/sql-reference/functions/index.md new file mode 100644 index 00000000000..69fbc9188c3 --- /dev/null +++ b/docs/es/sql-reference/functions/index.md @@ -0,0 +1,74 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Functions +toc_priority: 32 +toc_title: "Implantaci\xF3n" +--- + +# Función {#functions} + +Hay al menos \* dos tipos de funciones: funciones regulares (simplemente se llaman “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn’t depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). + +En esta sección discutimos las funciones regulares. Para las funciones agregadas, consulte la sección “Aggregate functions”. + +\* - Existe un tercer tipo de función que el ‘arrayJoin’ la función pertenece a; las funciones de la tabla también se pueden mencionar por separado.\* + +## Tipeo Fuerte {#strong-typing} + +A diferencia del SQL estándar, ClickHouse tiene una tipificación fuerte. En otras palabras, no hace conversiones implícitas entre tipos. Cada función funciona para un conjunto específico de tipos. Esto significa que a veces necesita usar funciones de conversión de tipos. + +## Eliminación De Subexpresiones Comunes {#common-subexpression-elimination} + +Se considera que todas las expresiones de una consulta que tienen el mismo AST (el mismo registro o el mismo resultado del análisis sintáctico) tienen valores idénticos. Tales expresiones se concatenan y se ejecutan una vez. Las subconsultas idénticas también se eliminan de esta manera. + +## Tipos De Resultados {#types-of-results} + +Todas las funciones devuelven un único retorno como resultado (no varios valores, y no valores cero). El tipo de resultado generalmente se define solo por los tipos de argumentos, no por los valores. Las excepciones son la función tupleElement (el operador a.N) y la función toFixedString. + +## Constante {#constants} + +Para simplificar, ciertas funciones solo pueden funcionar con constantes para algunos argumentos. Por ejemplo, el argumento correcto del operador LIKE debe ser una constante. +Casi todas las funciones devuelven una constante para argumentos constantes. La excepción son las funciones que generan números aleatorios. +El ‘now’ function devuelve valores diferentes para las consultas que se ejecutaron en diferentes momentos, pero el resultado se considera una constante, ya que la constancia solo es importante dentro de una sola consulta. +Una expresión constante también se considera una constante (por ejemplo, la mitad derecha del operador LIKE se puede construir a partir de múltiples constantes). + +Las funciones se pueden implementar de diferentes maneras para argumentos constantes y no constantes (se ejecuta un código diferente). Pero los resultados para una constante y para una columna verdadera que contiene solo el mismo valor deben coincidir entre sí. + +## Procesamiento NULL {#null-processing} + +Las funciones tienen los siguientes comportamientos: + +- Si al menos uno de los argumentos de la función es `NULL` el resultado de la función es también `NULL`. +- Comportamiento especial que se especifica individualmente en la descripción de cada función. En el código fuente de ClickHouse, estas funciones tienen `UseDefaultImplementationForNulls=false`. + +## Constancia {#constancy} + +Functions can’t change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. + +## Manejo De Errores {#error-handling} + +Algunas funciones pueden producir una excepción si los datos no son válidos. En este caso, la consulta se cancela y se devuelve un texto de error al cliente. Para el procesamiento distribuido, cuando se produce una excepción en uno de los servidores, los otros servidores también intentan anular la consulta. + +## Evaluación De Expresiones De Argumento {#evaluation-of-argument-expressions} + +En casi todos los lenguajes de programación, uno de los argumentos puede no evaluarse para ciertos operadores. Esto suele ser los operadores `&&`, `||`, y `?:`. +Pero en ClickHouse, los argumentos de las funciones (operadores) siempre se evalúan. Esto se debe a que partes enteras de columnas se evalúan a la vez, en lugar de calcular cada fila por separado. + +## Realización De Funciones Para El Procesamiento De Consultas Distribuidas {#performing-functions-for-distributed-query-processing} + +Para el procesamiento de consultas distribuidas, se realizan tantas etapas de procesamiento de consultas como sea posible en servidores remotos, y el resto de las etapas (fusionando resultados intermedios y todo lo posterior) se realizan en el servidor solicitante. + +Esto significa que las funciones se pueden realizar en diferentes servidores. +Por ejemplo, en la consulta `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` + +- si una `distributed_table` tiene al menos dos fragmentos, las funciones ‘g’ y ‘h’ se realizan en servidores remotos, y la función ‘f’ se realiza en el servidor solicitante. +- si una `distributed_table` tiene sólo un fragmento, todos los ‘f’, ‘g’, y ‘h’ funciones se realizan en el servidor de este fragmento. + +El resultado de una función generalmente no depende del servidor en el que se realice. Sin embargo, a veces esto es importante. +Por ejemplo, las funciones que funcionan con diccionarios utilizan el diccionario que existe en el servidor en el que se están ejecutando. +Otro ejemplo es el `hostName` función, que devuelve el nombre del servidor en el que se está ejecutando para `GROUP BY` por servidores en un `SELECT` consulta. + +Si se realiza una función en una consulta en el servidor solicitante, pero debe realizarla en servidores remotos, puede envolverla en un ‘any’ agregar o agregarlo a una clave en `GROUP BY`. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/es/sql-reference/functions/introspection.md b/docs/es/sql-reference/functions/introspection.md new file mode 100644 index 00000000000..d7dd5d73bc0 --- /dev/null +++ b/docs/es/sql-reference/functions/introspection.md @@ -0,0 +1,310 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 65 +toc_title: "Introspecci\xF3n" +--- + +# Funciones De introspección {#introspection-functions} + +Puede utilizar las funciones descritas en este capítulo para [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) y [DWARF](https://en.wikipedia.org/wiki/DWARF) para la creación de perfiles de consultas. + +!!! warning "Advertencia" + Estas funciones son lentas y pueden imponer consideraciones de seguridad. + +Para el correcto funcionamiento de las funciones de introspección: + +- Instale el `clickhouse-common-static-dbg` paquete. + +- Establezca el [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) a 1. + + For security reasons introspection functions are disabled by default. + +ClickHouse guarda los informes del generador de perfiles [trace\_log](../../operations/system-tables.md#system_tables-trace_log) tabla del sistema. Asegúrese de que la tabla y el generador de perfiles estén configurados correctamente. + +## addressToLine {#addresstoline} + +Convierte la dirección de memoria virtual dentro del proceso del servidor ClickHouse en el nombre de archivo y el número de línea en el código fuente de ClickHouse. + +Si utiliza paquetes oficiales de ClickHouse, debe instalar el `clickhouse-common-static-dbg` paquete. + +**Sintaxis** + +``` sql +addressToLine(address_of_binary_instruction) +``` + +**Parámetros** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**Valor devuelto** + +- Nombre de archivo del código fuente y el número de línea en este archivo delimitado por dos puntos. + + For example, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, where `199` is a line number. + +- Nombre de un binario, si la función no pudo encontrar la información de depuración. + +- Cadena vacía, si la dirección no es válida. + +Tipo: [Cadena](../../sql-reference/data-types/string.md). + +**Ejemplo** + +Habilitación de las funciones de introspección: + +``` sql +SET allow_introspection_functions=1 +``` + +Seleccionando la primera cadena de la `trace_log` tabla del sistema: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-19 +event_time: 2019-11-19 18:57:23 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 421b6855-1858-45a5-8f37-f383409d6d72 +trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] +``` + +El `trace` campo contiene el seguimiento de la pila en el momento del muestreo. + +Obtener el nombre de archivo del código fuente y el número de línea para una sola dirección: + +``` sql +SELECT addressToLine(94784076370703) \G +``` + +``` text +Row 1: +────── +addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +``` + +Aplicando la función a todo el seguimiento de la pila: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines +FROM system.trace_log +LIMIT 1 +\G +``` + +El [arrayMap](higher-order-functions.md#higher_order_functions-array-map) permite procesar cada elemento individual de la `trace` matriz por el `addressToLine` función. El resultado de este procesamiento se ve en el `trace_source_code_lines` columna de salida. + +``` text +Row 1: +────── +trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so +/usr/lib/debug/usr/bin/clickhouse +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 +/usr/include/c++/9/bits/atomic_base.h:551 +/usr/lib/debug/usr/bin/clickhouse +/lib/x86_64-linux-gnu/libpthread-2.27.so +/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 +``` + +## addressToSymbol {#addresstosymbol} + +Convierte la dirección de memoria virtual dentro del proceso del servidor ClickHouse en el símbolo de los archivos de objetos ClickHouse. + +**Sintaxis** + +``` sql +addressToSymbol(address_of_binary_instruction) +``` + +**Parámetros** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**Valor devuelto** + +- Símbolo de archivos de objetos ClickHouse. +- Cadena vacía, si la dirección no es válida. + +Tipo: [Cadena](../../sql-reference/data-types/string.md). + +**Ejemplo** + +Habilitación de las funciones de introspección: + +``` sql +SET allow_introspection_functions=1 +``` + +Seleccionando la primera cadena de la `trace_log` tabla del sistema: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +El `trace` campo contiene el seguimiento de la pila en el momento del muestreo. + +Obtener un símbolo para una sola dirección: + +``` sql +SELECT addressToSymbol(94138803686098) \G +``` + +``` text +Row 1: +────── +addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +``` + +Aplicando la función a todo el seguimiento de la pila: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols +FROM system.trace_log +LIMIT 1 +\G +``` + +El [arrayMap](higher-order-functions.md#higher_order_functions-array-map) permite procesar cada elemento individual de la `trace` matriz por el `addressToSymbols` función. El resultado de este procesamiento se ve en el `trace_symbols` columna de salida. + +``` text +Row 1: +────── +trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE +_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb +_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb +_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE +_ZN2DB27AggregatingBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB28AsynchronousBlockInputStream9calculateEv +_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data +_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E +_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv +_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E +execute_native_thread_routine +start_thread +clone +``` + +## demangle {#demangle} + +Convierte un símbolo que puede obtener utilizando el [addressToSymbol](#addresstosymbol) función a la función de C++ nombre. + +**Sintaxis** + +``` sql +demangle(symbol) +``` + +**Parámetros** + +- `symbol` ([Cadena](../../sql-reference/data-types/string.md)) — Symbol from an object file. + +**Valor devuelto** + +- Nombre de la función C++ +- Cadena vacía si un símbolo no es válido. + +Tipo: [Cadena](../../sql-reference/data-types/string.md). + +**Ejemplo** + +Habilitación de las funciones de introspección: + +``` sql +SET allow_introspection_functions=1 +``` + +Seleccionando la primera cadena de la `trace_log` tabla del sistema: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +El `trace` campo contiene el seguimiento de la pila en el momento del muestreo. + +Obtener un nombre de función para una sola dirección: + +``` sql +SELECT demangle(addressToSymbol(94138803686098)) \G +``` + +``` text +Row 1: +────── +demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +``` + +Aplicando la función a todo el seguimiento de la pila: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions +FROM system.trace_log +LIMIT 1 +\G +``` + +El [arrayMap](higher-order-functions.md#higher_order_functions-array-map) permite procesar cada elemento individual de la `trace` matriz por el `demangle` función. El resultado de este procesamiento se ve en el `trace_functions` columna de salida. + +``` text +Row 1: +────── +trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const +DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) +DB::AggregatingBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::AsynchronousBlockInputStream::calculate() +std::_Function_handler::_M_invoke(std::_Any_data const&) +ThreadPoolImpl::worker(std::_List_iterator) +ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const +ThreadPoolImpl::worker(std::_List_iterator) +execute_native_thread_routine +start_thread +clone +``` diff --git a/docs/es/sql-reference/functions/ip-address-functions.md b/docs/es/sql-reference/functions/ip-address-functions.md new file mode 100644 index 00000000000..84c944e9bc0 --- /dev/null +++ b/docs/es/sql-reference/functions/ip-address-functions.md @@ -0,0 +1,248 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 55 +toc_title: Trabajar con direcciones IP +--- + +# Funciones Para Trabajar Con Direcciones IP {#functions-for-working-with-ip-addresses} + +## Número De código: IPv4NumToString (num) {#ipv4numtostringnum} + +Toma un número UInt32. Lo interpreta como una dirección IPv4 en big endian. Devuelve una cadena que contiene la dirección IPv4 correspondiente en el formato A.B.C.d (números separados por puntos en forma decimal). + +## Nombre De La Red inalámbrica (SSID):) {#ipv4stringtonums} + +La función inversa de IPv4NumToString. Si la dirección IPv4 tiene un formato no válido, devuelve 0. + +## Cómo Hacer Esto?) {#ipv4numtostringclasscnum} + +Similar a IPv4NumToString, pero usando xxx en lugar del último octeto. + +Ejemplo: + +``` sql +SELECT + IPv4NumToStringClassC(ClientIP) AS k, + count() AS c +FROM test.hits +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─k──────────────┬─────c─┐ +│ 83.149.9.xxx │ 26238 │ +│ 217.118.81.xxx │ 26074 │ +│ 213.87.129.xxx │ 25481 │ +│ 83.149.8.xxx │ 24984 │ +│ 217.118.83.xxx │ 22797 │ +│ 78.25.120.xxx │ 22354 │ +│ 213.87.131.xxx │ 21285 │ +│ 78.25.121.xxx │ 20887 │ +│ 188.162.65.xxx │ 19694 │ +│ 83.149.48.xxx │ 17406 │ +└────────────────┴───────┘ +``` + +Desde el uso ‘xxx’ es altamente inusual, esto puede cambiarse en el futuro. Le recomendamos que no confíe en el formato exacto de este fragmento. + +### ¿cómo puedo hacerlo?) {#ipv6numtostringx} + +Acepta un valor FixedString(16) que contiene la dirección IPv6 en formato binario. Devuelve una cadena que contiene esta dirección en formato de texto. +Las direcciones IPv4 asignadas a IPv6 se emiten en el formato ::ffff:111.222.33.44. Ejemplos: + +``` sql +SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr +``` + +``` text +┌─addr─────────┐ +│ 2a02:6b8::11 │ +└──────────────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ +│ 2a02:2168:aaa:bbbb::2 │ 24695 │ +│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ +│ 2a02:6b8:0:fff::ff │ 16389 │ +│ 2a01:4f8:111:6666::2 │ 16016 │ +│ 2a02:2168:888:222::1 │ 15896 │ +│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ +│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ +│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ +│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ +│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ +└─────────────────────────────────────────┴───────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)─┬──────c─┐ +│ ::ffff:94.26.111.111 │ 747440 │ +│ ::ffff:37.143.222.4 │ 529483 │ +│ ::ffff:5.166.111.99 │ 317707 │ +│ ::ffff:46.38.11.77 │ 263086 │ +│ ::ffff:79.105.111.111 │ 186611 │ +│ ::ffff:93.92.111.88 │ 176773 │ +│ ::ffff:84.53.111.33 │ 158709 │ +│ ::ffff:217.118.11.22 │ 154004 │ +│ ::ffff:217.118.11.33 │ 148449 │ +│ ::ffff:217.118.11.44 │ 148243 │ +└────────────────────────────┴────────┘ +``` + +## Nombre De La Red inalámbrica (SSID):) {#ipv6stringtonums} + +La función inversa de IPv6NumToString. Si la dirección IPv6 tiene un formato no válido, devuelve una cadena de bytes nulos. +HEX puede ser mayúscula o minúscula. + +## IPv4ToIPv6 (x) {#ipv4toipv6x} + +Toma un `UInt32` numero. Lo interpreta como una dirección IPv4 en [gran endian](https://en.wikipedia.org/wiki/Endianness). Devuelve un `FixedString(16)` valor que contiene la dirección IPv6 en formato binario. Ejemplos: + +``` sql +SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr +``` + +``` text +┌─addr───────────────┐ +│ ::ffff:192.168.0.1 │ +└────────────────────┘ +``` + +## Para Obtener más información, Consulta Nuestra Política De Privacidad y Nuestras Condiciones De Uso) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} + +Acepta un valor FixedString(16) que contiene la dirección IPv6 en formato binario. Devuelve una cadena que contiene la dirección del número especificado de bits eliminados en formato de texto. Por ejemplo: + +``` sql +WITH + IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, + IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 +SELECT + cutIPv6(ipv6, 2, 0), + cutIPv6(ipv4, 0, 2) +``` + +``` text +┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ +│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ +└─────────────────────────────────────┴─────────────────────┘ +``` + +## ¿cómo puedo hacerlo?), {#ipv4cidrtorangeipv4-cidr} + +Acepta un valor IPv4 y UInt8 que contiene el valor [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Devuelve una tupla con dos IPv4 que contienen el rango inferior y el rango superior de la subred. + +``` sql +SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) +``` + +``` text +┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ +│ ('192.168.0.0','192.168.255.255') │ +└────────────────────────────────────────────┘ +``` + +## ¿cómo puedo hacerlo?), {#ipv6cidrtorangeipv6-cidr} + +Acepta un valor IPv6 y UInt8 que contiene el CIDR. Devuelve una tupla con dos IPv6 que contienen el rango inferior y el rango superior de la subred. + +``` sql +SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); +``` + +``` text +┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ +│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ +└────────────────────────────────────────────────────────────────────────┘ +``` + +## Acerca De Nosotros) {#toipv4string} + +Un alias para `IPv4StringToNum()` que toma una forma de cadena de dirección IPv4 y devuelve el valor de [IPv4](../../sql-reference/data-types/domains/ipv4.md) tipo, que es binario igual al valor devuelto por `IPv4StringToNum()`. + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + toTypeName(IPv4StringToNum(IPv4_string)), + toTypeName(toIPv4(IPv4_string)) +``` + +``` text +┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ +│ UInt32 │ IPv4 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + hex(IPv4StringToNum(IPv4_string)), + hex(toIPv4(IPv4_string)) +``` + +``` text +┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ +│ ABE1822D │ ABE1822D │ +└───────────────────────────────────┴──────────────────────────┘ +``` + +## Acerca De Nosotros) {#toipv6string} + +Un alias para `IPv6StringToNum()` que toma una forma de cadena de dirección IPv6 y devuelve el valor de [IPv6](../../sql-reference/data-types/domains/ipv6.md) tipo, que es binario igual al valor devuelto por `IPv6StringToNum()`. + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + toTypeName(IPv6StringToNum(IPv6_string)), + toTypeName(toIPv6(IPv6_string)) +``` + +``` text +┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ +│ FixedString(16) │ IPv6 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + hex(IPv6StringToNum(IPv6_string)), + hex(toIPv6(IPv6_string)) +``` + +``` text +┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ +│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ +└───────────────────────────────────┴──────────────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/es/sql-reference/functions/json-functions.md b/docs/es/sql-reference/functions/json-functions.md new file mode 100644 index 00000000000..14d87651113 --- /dev/null +++ b/docs/es/sql-reference/functions/json-functions.md @@ -0,0 +1,231 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 56 +toc_title: Trabajando con JSON. +--- + +# Funciones Para Trabajar Con JSON {#functions-for-working-with-json} + +En el Yandex.Metrica, JSON es transmitido por los usuarios como parámetros de sesión. Hay algunas funciones especiales para trabajar con este JSON. (Aunque en la mayoría de los casos, los JSON también se procesan previamente, y los valores resultantes se colocan en columnas separadas en su formato procesado.) Todas estas funciones se basan en sólidas suposiciones sobre lo que puede ser el JSON, pero tratan de hacer lo menos posible para hacer el trabajo. + +Se hacen las siguientes suposiciones: + +1. El nombre de campo (argumento de función) debe ser una constante. +2. El nombre del campo de alguna manera está codificado canónicamente en JSON. Por ejemplo: `visitParamHas('{"abc":"def"}', 'abc') = 1`, pero `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` +3. Los campos se buscan en cualquier nivel de anidación, indiscriminadamente. Si hay varios campos coincidentes, se utiliza la primera aparición. +4. El JSON no tiene caracteres de espacio fuera de los literales de cadena. + +## visitParamHas (params, nombre) {#visitparamhasparams-name} + +Comprueba si hay un campo con el ‘name’ nombre. + +## visitParamExtractUInt (params, nombre) {#visitparamextractuintparams-name} + +Analiza UInt64 a partir del valor del campo denominado ‘name’. Si se trata de un campo de cadena, intenta analizar un número desde el principio de la cadena. Si el campo no existe, o existe pero no contiene un número, devuelve 0. + +## visitParamExtractInt (params, nombre) {#visitparamextractintparams-name} + +Lo mismo que para Int64. + +## visitParamExtractFloat (params, nombre) {#visitparamextractfloatparams-name} + +Lo mismo que para Float64. + +## visitParamExtractBool (params, nombre) {#visitparamextractboolparams-name} + +Analiza un valor verdadero/falso. El resultado es UInt8. + +## visitParamExtractRaw (params, nombre) {#visitparamextractrawparams-name} + +Devuelve el valor de un campo, incluidos los separadores. + +Ejemplos: + +``` sql +visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' +visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' +``` + +## visitParamExtractString(params, nombre) {#visitparamextractstringparams-name} + +Analiza la cadena entre comillas dobles. El valor es sin escape. Si no se pudo desescapar, devuelve una cadena vacía. + +Ejemplos: + +``` sql +visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' +visitParamExtractString('{"abc":"hello}', 'abc') = '' +``` + +Actualmente no hay soporte para puntos de código en el formato `\uXXXX\uYYYY` que no son del plano multilingüe básico (se convierten a CESU-8 en lugar de UTF-8). + +Las siguientes funciones se basan en [simdjson](https://github.com/lemire/simdjson) diseñado para requisitos de análisis JSON más complejos. La suposición 2 mencionada anteriormente todavía se aplica. + +## ¿Qué puedes encontrar en Neodigit) {#isvalidjsonjson} + +Comprueba que la cadena pasada es un json válido. + +Ejemplos: + +``` sql +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} + +Si el valor existe en el documento JSON, `1` serán devueltos. + +Si el valor no existe, `0` serán devueltos. + +Ejemplos: + +``` sql +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 +``` + +`indices_or_keys` es una lista de cero o más argumentos, cada uno de ellos puede ser de cadena o entero. + +- Cadena = miembro del objeto de acceso por clave. +- Entero positivo = acceder al n-ésimo miembro / clave desde el principio. +- Entero negativo = acceder al n-ésimo miembro / clave desde el final. + +El índice mínimo del elemento es 1. Por lo tanto, el elemento 0 no existe. + +Puede usar enteros para acceder a matrices JSON y objetos JSON. + +Entonces, por ejemplo: + +``` sql +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' +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} + +Devuelve la longitud de una matriz JSON o un objeto JSON. + +Si el valor no existe o tiene un tipo incorrecto, `0` serán devueltos. + +Ejemplos: + +``` sql +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} + +Devuelve el tipo de un valor JSON. + +Si el valor no existe, `Null` serán devueltos. + +Ejemplos: + +``` sql +SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' +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} + +## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} + +## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} + +## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} + +Analiza un JSON y extrae un valor. Estas funciones son similares a `visitParam` función. + +Si el valor no existe o tiene un tipo incorrecto, `0` serán devueltos. + +Ejemplos: + +``` sql +SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 +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} + +Analiza un JSON y extrae una cadena. Esta función es similar a `visitParamExtractString` función. + +Si el valor no existe o tiene un tipo incorrecto, se devolverá una cadena vacía. + +El valor es sin escape. Si no se pudo desescapar, devuelve una cadena vacía. + +Ejemplos: + +``` sql +SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' +SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' +SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' +``` + +## JSONExtract(json\[, indices\_or\_keys…\], Return\_type) {#jsonextractjson-indices-or-keys-return-type} + +Analiza un JSON y extrae un valor del tipo de datos ClickHouse dado. + +Esta es una generalización de la anterior `JSONExtract` función. +Esto significa +`JSONExtract(..., 'String')` devuelve exactamente lo mismo que `JSONExtractString()`, +`JSONExtract(..., 'Float64')` devuelve exactamente lo mismo que `JSONExtractFloat()`. + +Ejemplos: + +``` sql +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL +SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 +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} + +Analizar pares clave-valor de un JSON donde los valores son del tipo de datos ClickHouse dado. + +Ejemplo: + +``` sql +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} + +Devuelve una parte de JSON. + +Si la pieza no existe o tiene un tipo incorrecto, se devolverá una cadena vacía. + +Ejemplo: + +``` sql +SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' +``` + +## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} + +Devuelve una matriz con elementos de matriz JSON, cada uno representado como cadena sin analizar. + +Si la parte no existe o no es una matriz, se devolverá una matriz vacía. + +Ejemplo: + +``` sql +SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/es/sql_reference/functions/logical_functions.md b/docs/es/sql-reference/functions/logical-functions.md similarity index 100% rename from docs/es/sql_reference/functions/logical_functions.md rename to docs/es/sql-reference/functions/logical-functions.md diff --git a/docs/es/sql-reference/functions/machine-learning-functions.md b/docs/es/sql-reference/functions/machine-learning-functions.md new file mode 100644 index 00000000000..82615694fca --- /dev/null +++ b/docs/es/sql-reference/functions/machine-learning-functions.md @@ -0,0 +1,20 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 64 +toc_title: "Funciones de aprendizaje autom\xE1tico" +--- + +# Funciones De Aprendizaje automático {#machine-learning-functions} + +## evalMLMethod (predicción) {#machine_learning_methods-evalmlmethod} + +Predicción utilizando modelos de regresión ajustados utiliza `evalMLMethod` función. Ver enlace en `linearRegression`. + +### Regresión Lineal estocástica {#stochastic-linear-regression} + +El [stochasticLinearRegression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlinearregression) la función agregada implementa el método de descenso de gradiente estocástico utilizando el modelo lineal y la función de pérdida MSE. Utilizar `evalMLMethod` para predecir sobre nuevos datos. + +### Regresión logística estocástica {#stochastic-logistic-regression} + +El [stochasticLogisticRegression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlogisticregression) la función de agregado implementa el método de descenso de gradiente estocástico para el problema de clasificación binaria. Utilizar `evalMLMethod` para predecir sobre nuevos datos. diff --git a/docs/es/sql-reference/functions/math-functions.md b/docs/es/sql-reference/functions/math-functions.md new file mode 100644 index 00000000000..298fb4b2a22 --- /dev/null +++ b/docs/es/sql-reference/functions/math-functions.md @@ -0,0 +1,116 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 44 +toc_title: "Matem\xE1tica" +--- + +# Funciones matemáticas {#mathematical-functions} + +Todas las funciones devuelven un número Float64. La precisión del resultado es cercana a la precisión máxima posible, pero el resultado puede no coincidir con el número representable de la máquina más cercano al número real correspondiente. + +## e() {#e} + +Devuelve un número Float64 que está cerca del número e. + +## Ciudad() {#pi} + +Returns a Float64 number that is close to the number π. + +## exp(x) {#expx} + +Acepta un argumento numérico y devuelve un número Float64 cercano al exponente del argumento. + +## Información) {#logx-lnx} + +Acepta un argumento numérico y devuelve un número Float64 cercano al logaritmo natural del argumento. + +## exp2(x) {#exp2x} + +Acepta un argumento numérico y devuelve un número Float64 cercano a 2 a la potencia de x. + +## log2 (x) {#log2x} + +Acepta un argumento numérico y devuelve un número Float64 cercano al logaritmo binario del argumento. + +## exp10 (x) {#exp10x} + +Acepta un argumento numérico y devuelve un número Float64 cercano a 10 a la potencia de x. + +## log10 (x) {#log10x} + +Acepta un argumento numérico y devuelve un número Float64 cercano al logaritmo decimal del argumento. + +## sqrt(x) {#sqrtx} + +Acepta un argumento numérico y devuelve un número Float64 cercano a la raíz cuadrada del argumento. + +## Cbrt (x) {#cbrtx} + +Acepta un argumento numérico y devuelve un número Float64 cercano a la raíz cúbica del argumento. + +## erf(x) {#erfx} + +Si ‘x’ is non-negative, then erf(x / σ√2) es la probabilidad de que una variable aleatoria tenga una distribución normal con desviación estándar ‘σ’ toma el valor que está separado del valor esperado en más de ‘x’. + +Ejemplo (regla de tres sigma): + +``` sql +SELECT erf(3 / sqrt(2)) +``` + +``` text +┌─erf(divide(3, sqrt(2)))─┐ +│ 0.9973002039367398 │ +└─────────────────────────┘ +``` + +## erfc(x) {#erfcx} + +Acepta un argumento numérico y devuelve un número Float64 cercano a 1 - erf(x), pero sin pérdida de precisión para grandes ‘x’ valor. + +## Lgamma (x) {#lgammax} + +El logaritmo de la función gamma. + +## ¿Qué puedes encontrar en Neodigit) {#tgammax} + +Función gamma. + +## sin(x) {#sinx} + +Sinusoidal. + +## cos(x) {#cosx} + +El coseno. + +## pantalla) {#tanx} + +Tangente. + +## (x) {#asinx} + +El arco sinusoidal. + +## Acerca De) {#acosx} + +El arco coseno. + +## atan (x) {#atanx} + +La tangente del arco. + +## pow(x, y), potencia(x, y) {#powx-y-powerx-y} + +Toma dos argumentos numéricos x e y. Devuelve un número Float64 cercano a x a la potencia de y. + +## IntExp2 {#intexp2} + +Acepta un argumento numérico y devuelve un número UInt64 cercano a 2 a la potencia de x. + +## IntExp10 {#intexp10} + +Acepta un argumento numérico y devuelve un número UInt64 cercano a 10 a la potencia de x. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/es/sql-reference/functions/other-functions.md b/docs/es/sql-reference/functions/other-functions.md new file mode 100644 index 00000000000..46e0c6f1fef --- /dev/null +++ b/docs/es/sql-reference/functions/other-functions.md @@ -0,0 +1,1079 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 66 +toc_title: Otro +--- + +# Otras Funciones {#other-functions} + +## nombre de host() {#hostname} + +Devuelve una cadena con el nombre del host en el que se realizó esta función. Para el procesamiento distribuido, este es el nombre del host del servidor remoto, si la función se realiza en un servidor remoto. + +## FQDN {#fqdn} + +Devuelve el nombre de dominio completo. + +**Sintaxis** + +``` sql +fqdn(); +``` + +Esta función no distingue entre mayúsculas y minúsculas. + +**Valor devuelto** + +- Cadena con el nombre de dominio completo. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT FQDN(); +``` + +Resultado: + +``` text +┌─FQDN()──────────────────────────┐ +│ clickhouse.ru-central1.internal │ +└─────────────────────────────────┘ +``` + +## Nombre básico {#basename} + +Extrae la parte final de una cadena después de la última barra o barra invertida. Esta función se utiliza a menudo para extraer el nombre de archivo de una ruta. + +``` sql +basename( expr ) +``` + +**Parámetros** + +- `expr` — Expression resulting in a [Cadena](../../sql-reference/data-types/string.md) valor de tipo. Todas las barras diagonales inversas deben escaparse en el valor resultante. + +**Valor devuelto** + +Una cadena que contiene: + +- La parte final de una cadena después de la última barra o barra invertida. + + If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. + +- La cadena original si no hay barras diagonales o barras diagonales inversas. + +**Ejemplo** + +``` sql +SELECT 'some/long/path/to/file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some\\long\\path\\to\\file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some-file-name' AS a, basename(a) +``` + +``` text +┌─a──────────────┬─basename('some-file-name')─┐ +│ some-file-name │ some-file-name │ +└────────────────┴────────────────────────────┘ +``` + +## Ancho Visible (x) {#visiblewidthx} + +Calcula el ancho aproximado al enviar valores a la consola en formato de texto (separado por tabuladores). +Esta función es utilizada por el sistema para implementar formatos Pretty. + +`NULL` se representa como una cadena correspondiente a `NULL` en `Pretty` formato. + +``` sql +SELECT visibleWidth(NULL) +``` + +``` text +┌─visibleWidth(NULL)─┐ +│ 4 │ +└────────────────────┘ +``` + +## ¿Cómo puedo hacerlo?) {#totypenamex} + +Devuelve una cadena que contiene el nombre de tipo del argumento pasado. + +Si `NULL` se pasa a la función como entrada, luego devuelve el `Nullable(Nothing)` tipo, que corresponde a un tipo interno `NULL` representación en ClickHouse. + +## BlockSize() {#function-blocksize} + +Obtiene el tamaño del bloque. +En ClickHouse, las consultas siempre se ejecutan en bloques (conjuntos de partes de columna). Esta función permite obtener el tamaño del bloque al que lo llamó. + +## materializar (x) {#materializex} + +Convierte una constante en una columna completa que contiene solo un valor. +En ClickHouse, las columnas completas y las constantes se representan de manera diferente en la memoria. Las funciones funcionan de manera diferente para argumentos constantes y argumentos normales (se ejecuta un código diferente), aunque el resultado es casi siempre el mismo. Esta función es para depurar este comportamiento. + +## ignore(…) {#ignore} + +Acepta cualquier argumento, incluyendo `NULL`. Siempre devuelve 0. +Sin embargo, el argumento aún se evalúa. Esto se puede usar para puntos de referencia. + +## sueño (segundos) {#sleepseconds} + +Dormir ‘seconds’ segundos en cada bloque de datos. Puede especificar un número entero o un número de punto flotante. + +## sleepEachRow(segundos) {#sleepeachrowseconds} + +Dormir ‘seconds’ segundos en cada fila. Puede especificar un número entero o un número de punto flotante. + +## currentDatabase() {#currentdatabase} + +Devuelve el nombre de la base de datos actual. +Puede utilizar esta función en los parámetros del motor de tablas en una consulta CREATE TABLE donde debe especificar la base de datos. + +## currentUser() {#other-function-currentuser} + +Devuelve el inicio de sesión del usuario actual. El inicio de sesión del usuario, que inició la consulta, se devolverá en caso de consulta distibuted. + +``` sql +SELECT currentUser(); +``` + +Apodo: `user()`, `USER()`. + +**Valores devueltos** + +- Inicio de sesión del usuario actual. +- Inicio de sesión del usuario que inició la consulta en caso de consulta distribuida. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT currentUser(); +``` + +Resultado: + +``` text +┌─currentUser()─┐ +│ default │ +└───────────────┘ +``` + +## isFinite(x) {#isfinitex} + +Acepta Float32 y Float64 y devuelve UInt8 igual a 1 si el argumento no es infinito y no es un NaN, de lo contrario 0. + +## IsInfinite(x) {#isinfinitex} + +Acepta Float32 y Float64 y devuelve UInt8 igual a 1 si el argumento es infinito, de lo contrario 0. Tenga en cuenta que se devuelve 0 para un NaN. + +## ifNotFinite {#ifnotfinite} + +Comprueba si el valor de punto flotante es finito. + +**Sintaxis** + + ifNotFinite(x,y) + +**Parámetros** + +- `x` — Value to be checked for infinity. Type: [Flotante\*](../../sql-reference/data-types/float.md). +- `y` — Fallback value. Type: [Flotante\*](../../sql-reference/data-types/float.md). + +**Valor devuelto** + +- `x` si `x` es finito. +- `y` si `x` no es finito. + +**Ejemplo** + +Consulta: + + SELECT 1/0 as infimum, ifNotFinite(infimum,42) + +Resultado: + + ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ + │ inf │ 42 │ + └─────────┴───────────────────────────────┘ + +Puede obtener un resultado similar usando [operador ternario](conditional-functions.md#ternary-operator): `isFinite(x) ? x : y`. + +## isNaN(x) {#isnanx} + +Acepta Float32 y Float64 y devuelve UInt8 igual a 1 si el argumento es un NaN, de lo contrario 0. + +## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} + +Acepta cadenas constantes: nombre de base de datos, nombre de tabla y nombre de columna. Devuelve una expresión constante UInt8 igual a 1 si hay una columna; de lo contrario, 0. Si se establece el parámetro hostname, la prueba se ejecutará en un servidor remoto. +La función produce una excepción si la tabla no existe. +Para los elementos de una estructura de datos anidada, la función comprueba la existencia de una columna. Para la propia estructura de datos anidados, la función devuelve 0. + +## Bar {#function-bar} + +Permite construir un diagrama unicode-art. + +`bar(x, min, max, width)` dibuja una banda con un ancho proporcional a `(x - min)` e igual a `width` caracteres cuando `x = max`. + +Parámetros: + +- `x` — Size to display. +- `min, max` — Integer constants. The value must fit in `Int64`. +- `width` — Constant, positive integer, can be fractional. + +La banda se dibuja con precisión a un octavo de un símbolo. + +Ejemplo: + +``` sql +SELECT + toHour(EventTime) AS h, + count() AS c, + bar(c, 0, 600000, 20) AS bar +FROM test.hits +GROUP BY h +ORDER BY h ASC +``` + +``` text +┌──h─┬──────c─┬─bar────────────────┐ +│ 0 │ 292907 │ █████████▋ │ +│ 1 │ 180563 │ ██████ │ +│ 2 │ 114861 │ ███▋ │ +│ 3 │ 85069 │ ██▋ │ +│ 4 │ 68543 │ ██▎ │ +│ 5 │ 78116 │ ██▌ │ +│ 6 │ 113474 │ ███▋ │ +│ 7 │ 170678 │ █████▋ │ +│ 8 │ 278380 │ █████████▎ │ +│ 9 │ 391053 │ █████████████ │ +│ 10 │ 457681 │ ███████████████▎ │ +│ 11 │ 493667 │ ████████████████▍ │ +│ 12 │ 509641 │ ████████████████▊ │ +│ 13 │ 522947 │ █████████████████▍ │ +│ 14 │ 539954 │ █████████████████▊ │ +│ 15 │ 528460 │ █████████████████▌ │ +│ 16 │ 539201 │ █████████████████▊ │ +│ 17 │ 523539 │ █████████████████▍ │ +│ 18 │ 506467 │ ████████████████▊ │ +│ 19 │ 520915 │ █████████████████▎ │ +│ 20 │ 521665 │ █████████████████▍ │ +│ 21 │ 542078 │ ██████████████████ │ +│ 22 │ 493642 │ ████████████████▍ │ +│ 23 │ 400397 │ █████████████▎ │ +└────┴────────┴────────────────────┘ +``` + +## transformar {#transform} + +Transforma un valor de acuerdo con la asignación explícitamente definida de algunos elementos a otros. +Hay dos variaciones de esta función: + +### ¿Cómo puedo hacerlo?) {#transformx-array-from-array-to-default} + +`x` – What to transform. + +`array_from` – Constant array of values for converting. + +`array_to` – Constant array of values to convert the values in ‘from’ a. + +`default` – Which value to use if ‘x’ no es igual a ninguno de los valores en ‘from’. + +`array_from` y `array_to` – Arrays of the same size. + +Tipo: + +`transform(T, Array(T), Array(U), U) -> U` + +`T` y `U` pueden ser tipos numéricos, de cadena o de fecha o de fecha y hora. +Cuando se indica la misma letra (T o U), para los tipos numéricos pueden no ser tipos coincidentes, sino tipos que tienen un tipo común. +Por ejemplo, el primer argumento puede tener el tipo Int64, mientras que el segundo tiene el tipo Array(UInt16). + +Si el ‘x’ valor es igual a uno de los elementos en el ‘array\_from’ matriz, devuelve el elemento existente (que está numerado igual) de la ‘array\_to’ matriz. De lo contrario, devuelve ‘default’. Si hay varios elementos coincidentes en ‘array\_from’, devuelve una de las coincidencias. + +Ejemplo: + +``` sql +SELECT + transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, + count() AS c +FROM test.hits +WHERE SearchEngineID != 0 +GROUP BY title +ORDER BY c DESC +``` + +``` text +┌─title─────┬──────c─┐ +│ Yandex │ 498635 │ +│ Google │ 229872 │ +│ Other │ 104472 │ +└───────────┴────────┘ +``` + +### ¿Cómo puedo hacerlo?) {#transformx-array-from-array-to} + +Difiere de la primera variación en que el ‘default’ se omite el argumento. +Si el ‘x’ valor es igual a uno de los elementos en el ‘array\_from’ matriz, devuelve el elemento coincidente (que está numerado igual) de la ‘array\_to’ matriz. De lo contrario, devuelve ‘x’. + +Tipo: + +`transform(T, Array(T), Array(T)) -> T` + +Ejemplo: + +``` sql +SELECT + transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, + count() AS c +FROM test.hits +GROUP BY domain(Referer) +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +┌─s──────────────┬───────c─┐ +│ │ 2906259 │ +│ www.yandex │ 867767 │ +│ ███████.ru │ 313599 │ +│ mail.yandex.ru │ 107147 │ +│ ██████.ru │ 100355 │ +│ █████████.ru │ 65040 │ +│ news.yandex.ru │ 64515 │ +│ ██████.net │ 59141 │ +│ example.com │ 57316 │ +└────────────────┴─────────┘ +``` + +## Tamaño De FormatoReadable (x) {#formatreadablesizex} + +Acepta el tamaño (número de bytes). Devuelve un tamaño redondeado con un sufijo (KiB, MiB, etc.) como una cadena. + +Ejemplo: + +``` sql +SELECT + arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, + formatReadableSize(filesize_bytes) AS filesize +``` + +``` text +┌─filesize_bytes─┬─filesize───┐ +│ 1 │ 1.00 B │ +│ 1024 │ 1.00 KiB │ +│ 1048576 │ 1.00 MiB │ +│ 192851925 │ 183.92 MiB │ +└────────────────┴────────────┘ +``` + +## menos (a, b) {#leasta-b} + +Devuelve el valor más pequeño de a y b. + +## mayor(a, b) {#greatesta-b} + +Devuelve el valor más grande de a y b. + +## operatividad() {#uptime} + +Devuelve el tiempo de actividad del servidor en segundos. + +## versión() {#version} + +Devuelve la versión del servidor como una cadena. + +## Zona Horaria() {#timezone} + +Devuelve la zona horaria del servidor. + +## blockNumber {#blocknumber} + +Devuelve el número de secuencia del bloque de datos donde se encuentra la fila. + +## rowNumberInBlock {#function-rownumberinblock} + +Devuelve el número ordinal de la fila en el bloque de datos. Los diferentes bloques de datos siempre se recalculan. + +## rowNumberInAllBlocks() {#rownumberinallblocks} + +Devuelve el número ordinal de la fila en el bloque de datos. Esta función solo considera los bloques de datos afectados. + +## vecino {#neighbor} + +La función de ventana que proporciona acceso a una fila en un desplazamiento especificado que viene antes o después de la fila actual de una columna determinada. + +**Sintaxis** + +``` sql +neighbor(column, offset[, default_value]) +``` + +El resultado de la función depende de los bloques de datos afectados y del orden de los datos en el bloque. +Si realiza una subconsulta con ORDER BY y llama a la función desde fuera de la subconsulta, puede obtener el resultado esperado. + +**Parámetros** + +- `column` — A column name or scalar expression. +- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql-reference/data-types/int-uint.md). +- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. + +**Valores devueltos** + +- Valor para `column` en `offset` distancia de la fila actual si `offset` valor no está fuera de los límites del bloque. +- Valor predeterminado para `column` si `offset` valor está fuera de los límites del bloque. Si `default_value` se da, entonces será utilizado. + +Tipo: tipo de bloques de datos afectados o tipo de valor predeterminado. + +**Ejemplo** + +Consulta: + +``` sql +SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; +``` + +Resultado: + +``` text +┌─number─┬─neighbor(number, 2)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 0 │ +│ 9 │ 0 │ +└────────┴─────────────────────┘ +``` + +Consulta: + +``` sql +SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; +``` + +Resultado: + +``` text +┌─number─┬─neighbor(number, 2, 999)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 999 │ +│ 9 │ 999 │ +└────────┴──────────────────────────┘ +``` + +Esta función se puede utilizar para calcular el valor métrico interanual: + +Consulta: + +``` sql +WITH toDate('2018-01-01') AS start_date +SELECT + toStartOfMonth(start_date + (number * 32)) AS month, + toInt32(month) % 100 AS money, + neighbor(money, -12) AS prev_year, + round(prev_year / money, 2) AS year_over_year +FROM numbers(16) +``` + +Resultado: + +``` text +┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ +│ 2018-01-01 │ 32 │ 0 │ 0 │ +│ 2018-02-01 │ 63 │ 0 │ 0 │ +│ 2018-03-01 │ 91 │ 0 │ 0 │ +│ 2018-04-01 │ 22 │ 0 │ 0 │ +│ 2018-05-01 │ 52 │ 0 │ 0 │ +│ 2018-06-01 │ 83 │ 0 │ 0 │ +│ 2018-07-01 │ 13 │ 0 │ 0 │ +│ 2018-08-01 │ 44 │ 0 │ 0 │ +│ 2018-09-01 │ 75 │ 0 │ 0 │ +│ 2018-10-01 │ 5 │ 0 │ 0 │ +│ 2018-11-01 │ 36 │ 0 │ 0 │ +│ 2018-12-01 │ 66 │ 0 │ 0 │ +│ 2019-01-01 │ 97 │ 32 │ 0.33 │ +│ 2019-02-01 │ 28 │ 63 │ 2.25 │ +│ 2019-03-01 │ 56 │ 91 │ 1.62 │ +│ 2019-04-01 │ 87 │ 22 │ 0.25 │ +└────────────┴───────┴───────────┴────────────────┘ +``` + +## EjecuciónDiferencia (x) {#other_functions-runningdifference} + +Calculates the difference between successive row values ​​in the data block. +Devuelve 0 para la primera fila y la diferencia con respecto a la fila anterior para cada fila subsiguiente. + +El resultado de la función depende de los bloques de datos afectados y del orden de los datos en el bloque. +Si realiza una subconsulta con ORDER BY y llama a la función desde fuera de la subconsulta, puede obtener el resultado esperado. + +Ejemplo: + +``` sql +SELECT + EventID, + EventTime, + runningDifference(EventTime) AS delta +FROM +( + SELECT + EventID, + EventTime + FROM events + WHERE EventDate = '2016-11-24' + ORDER BY EventTime ASC + LIMIT 5 +) +``` + +``` text +┌─EventID─┬───────────EventTime─┬─delta─┐ +│ 1106 │ 2016-11-24 00:00:04 │ 0 │ +│ 1107 │ 2016-11-24 00:00:05 │ 1 │ +│ 1108 │ 2016-11-24 00:00:05 │ 0 │ +│ 1109 │ 2016-11-24 00:00:09 │ 4 │ +│ 1110 │ 2016-11-24 00:00:10 │ 1 │ +└─────────┴─────────────────────┴───────┘ +``` + +Tenga en cuenta que el tamaño del bloque afecta el resultado. Con cada nuevo bloque, el `runningDifference` estado de reset. + +``` sql +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +┌─number─┬─diff─┐ +│ 65536 │ 0 │ +└────────┴──────┘ +``` + +``` sql +set max_block_size=100000 -- default value is 65536! + +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +``` + +## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} + +Lo mismo que para [runningDifference](./other-functions.md#other_functions-runningdifference), la diferencia es el valor de la primera fila, devolvió el valor de la primera fila, y cada fila subsiguiente devuelve la diferencia de la fila anterior. + +## ¿cómo puedo hacerlo?) {#macnumtostringnum} + +Acepta un número UInt64. Lo interpreta como una dirección MAC en big endian. Devuelve una cadena que contiene la dirección MAC correspondiente con el formato AA:BB:CC:DD:EE:FF (números separados por dos puntos en forma hexadecimal). + +## Sistema Abierto.) {#macstringtonums} + +La función inversa de MACNumToString. Si la dirección MAC tiene un formato no válido, devuelve 0. + +## Sistema Abierto.) {#macstringtoouis} + +Acepta una dirección MAC con el formato AA:BB:CC:DD:EE:FF (números separados por dos puntos en forma hexadecimal). Devuelve los primeros tres octetos como un número UInt64. Si la dirección MAC tiene un formato no válido, devuelve 0. + +## getSizeOfEnumType {#getsizeofenumtype} + +Devuelve el número de campos en [Enum](../../sql-reference/data-types/enum.md). + +``` sql +getSizeOfEnumType(value) +``` + +**Parámetros:** + +- `value` — Value of type `Enum`. + +**Valores devueltos** + +- El número de campos con `Enum` valores de entrada. +- Se produce una excepción si el tipo no es `Enum`. + +**Ejemplo** + +``` sql +SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## BlockSerializedSize {#blockserializedsize} + +Devuelve el tamaño en el disco (sin tener en cuenta la compresión). + +``` sql +blockSerializedSize(value[, value[, ...]]) +``` + +**Parámetros:** + +- `value` — Any value. + +**Valores devueltos** + +- El número de bytes que se escribirán en el disco para el bloque de valores (sin compresión). + +**Ejemplo** + +``` sql +SELECT blockSerializedSize(maxState(1)) as x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## ToColumnTypeName {#tocolumntypename} + +Devuelve el nombre de la clase que representa el tipo de datos de la columna en la RAM. + +``` sql +toColumnTypeName(value) +``` + +**Parámetros:** + +- `value` — Any type of value. + +**Valores devueltos** + +- Una cadena con el nombre de la clase que se utiliza para representar la `value` tipo de datos en la memoria RAM. + +**Ejemplo de la diferencia entre`toTypeName ' and ' toColumnTypeName`** + +``` sql +SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime │ +└─────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ Const(UInt32) │ +└───────────────────────────────────────────────────────────┘ +``` + +El ejemplo muestra que el `DateTime` tipo de datos se almacena en la memoria como `Const(UInt32)`. + +## dumpColumnStructure {#dumpcolumnstructure} + +Produce una descripción detallada de las estructuras de datos en la memoria RAM + +``` sql +dumpColumnStructure(value) +``` + +**Parámetros:** + +- `value` — Any type of value. + +**Valores devueltos** + +- Una cadena que describe la estructura que se utiliza para representar el `value` tipo de datos en la memoria RAM. + +**Ejemplo** + +``` sql +SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) +``` + +``` text +┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime, Const(size = 1, UInt32(size = 1)) │ +└──────────────────────────────────────────────────────────────┘ +``` + +## defaultValueOfArgumentType {#defaultvalueofargumenttype} + +Genera el valor predeterminado para el tipo de datos. + +No incluye valores predeterminados para columnas personalizadas establecidas por el usuario. + +``` sql +defaultValueOfArgumentType(expression) +``` + +**Parámetros:** + +- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. + +**Valores devueltos** + +- `0` para los números. +- Cadena vacía para cadenas. +- `ᴺᵁᴸᴸ` para [NULL](../../sql-reference/data-types/nullable.md). + +**Ejemplo** + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ +│ 0 │ +└─────────────────────────────────────────────┘ +``` + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ +│ ᴺᵁᴸᴸ │ +└───────────────────────────────────────────────────────┘ +``` + +## replicar {#other-functions-replicate} + +Crea una matriz con un solo valor. + +Utilizado para la implementación interna de [arrayJoin](array-join.md#functions_arrayjoin). + +``` sql +SELECT replicate(x, arr); +``` + +**Parámetros:** + +- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. +- `x` — The value that the resulting array will be filled with. + +**Valor devuelto** + +Una matriz llena con el valor `x`. + +Tipo: `Array`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT replicate(1, ['a', 'b', 'c']) +``` + +Resultado: + +``` text +┌─replicate(1, ['a', 'b', 'c'])─┐ +│ [1,1,1] │ +└───────────────────────────────┘ +``` + +## Sistema De ArchivosDisponible {#filesystemavailable} + +Devuelve la cantidad de espacio restante en el sistema de archivos donde se encuentran los archivos de las bases de datos. Siempre es más pequeño que el espacio libre total ([Sistema de archivosLibre](#filesystemfree)) porque algo de espacio está reservado para el sistema operativo. + +**Sintaxis** + +``` sql +filesystemAvailable() +``` + +**Valor devuelto** + +- La cantidad de espacio restante disponible en bytes. + +Tipo: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; +``` + +Resultado: + +``` text +┌─Available space─┬─Type───┐ +│ 30.75 GiB │ UInt64 │ +└─────────────────┴────────┘ +``` + +## Sistema De ArchivosLibre {#filesystemfree} + +Devuelve la cantidad total del espacio libre en el sistema de archivos donde se encuentran los archivos de las bases de datos. Ver también `filesystemAvailable` + +**Sintaxis** + +``` sql +filesystemFree() +``` + +**Valor devuelto** + +- Cantidad de espacio libre en bytes. + +Tipo: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; +``` + +Resultado: + +``` text +┌─Free space─┬─Type───┐ +│ 32.39 GiB │ UInt64 │ +└────────────┴────────┘ +``` + +## sistema de archivosCapacidad {#filesystemcapacity} + +Devuelve la capacidad del sistema de archivos en bytes. Para la evaluación, el [camino](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) al directorio de datos debe estar configurado. + +**Sintaxis** + +``` sql +filesystemCapacity() +``` + +**Valor devuelto** + +- Información de capacidad del sistema de archivos en bytes. + +Tipo: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Ejemplo** + +Consulta: + +``` sql +SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" +``` + +Resultado: + +``` text +┌─Capacity──┬─Type───┐ +│ 39.32 GiB │ UInt64 │ +└───────────┴────────┘ +``` + +## finalizeAggregation {#function-finalizeaggregation} + +Toma el estado de la función agregada. Devuelve el resultado de la agregación (estado finalizado). + +## runningAccumulate {#function-runningaccumulate} + +Toma los estados de la función agregada y devuelve una columna con valores, son el resultado de la acumulación de estos estados para un conjunto de líneas de bloque, desde la primera hasta la línea actual. +Por ejemplo, toma el estado de la función agregada (ejemplo runningAccumulate(uniqState(UserID)) ), y para cada fila de bloque, devuelve el resultado de la función agregada en la fusión de estados de todas las filas anteriores y la fila actual. +Por lo tanto, el resultado de la función depende de la partición de los datos en los bloques y del orden de los datos en el bloque. + +## joinGet {#joinget} + +La función le permite extraer datos de la tabla de la misma manera que [diccionario](../../sql-reference/dictionaries/index.md). + +Obtiene datos de [Unir](../../engines/table-engines/special/join.md#creating-a-table) usando la clave de unión especificada. + +Solo admite tablas creadas con `ENGINE = Join(ANY, LEFT, )` instrucción. + +**Sintaxis** + +``` sql +joinGet(join_storage_table_name, `value_column`, join_keys) +``` + +**Parámetros** + +- `join_storage_table_name` — an [identificador](../syntax.md#syntax-identifiers) indica dónde se realiza la búsqueda. El identificador se busca en la base de datos predeterminada (ver parámetro `default_database` en el archivo de configuración). Para reemplazar la base de datos predeterminada, utilice `USE db_name` o especifique la base de datos y la tabla a través del separador `db_name.db_table`, ver el ejemplo. +- `value_column` — name of the column of the table that contains required data. +- `join_keys` — list of keys. + +**Valor devuelto** + +Devuelve la lista de valores correspondientes a la lista de claves. + +Si cierto no existe en la tabla fuente, entonces `0` o `null` será devuelto basado en [Sistema abierto.](../../operations/settings/settings.md#join_use_nulls) configuración. + +Más información sobre `join_use_nulls` en [Únase a la operación](../../engines/table-engines/special/join.md). + +**Ejemplo** + +Tabla de entrada: + +``` sql +CREATE DATABASE db_test +CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 +INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) +``` + +``` text +┌─id─┬─val─┐ +│ 4 │ 13 │ +│ 2 │ 12 │ +│ 1 │ 11 │ +└────┴─────┘ +``` + +Consulta: + +``` sql +SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 +``` + +Resultado: + +``` text +┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ +│ 0 │ +│ 11 │ +│ 12 │ +│ 0 │ +└──────────────────────────────────────────────────┘ +``` + +## modelEvaluate(model\_name, …) {#function-modelevaluate} + +Evaluar modelo externo. +Acepta un nombre de modelo y argumentos de modelo. Devuelve Float64. + +## ¿Cómo puedo hacerlo?\]) {#throwifx-custom-message} + +Lance una excepción si el argumento no es cero. +custom\_message - es un parámetro opcional: una cadena constante, proporciona un mensaje de error + +``` sql +SELECT throwIf(number = 3, 'Too many') FROM numbers(10); +``` + +``` text +↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): +Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. +``` + +## identidad {#identity} + +Devuelve el mismo valor que se usó como argumento. Se utiliza para la depuración y pruebas, permite cancelar el uso de índice, y obtener el rendimiento de la consulta de un análisis completo. Cuando se analiza la consulta para el posible uso del índice, el analizador no mira dentro `identity` función. + +**Sintaxis** + +``` sql +identity(x) +``` + +**Ejemplo** + +Consulta: + +``` sql +SELECT identity(42) +``` + +Resultado: + +``` text +┌─identity(42)─┐ +│ 42 │ +└──────────────┘ +``` + +## randomPrintableASCII {#randomascii} + +Genera una cadena con un conjunto aleatorio de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caracteres imprimibles. + +**Sintaxis** + +``` sql +randomPrintableASCII(length) +``` + +**Parámetros** + +- `length` — Resulting string length. Positive integer. + + If you pass `length < 0`, behavior of the function is undefined. + +**Valor devuelto** + +- Cadena con un conjunto aleatorio de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caracteres imprimibles. + +Tipo: [Cadena](../../sql-reference/data-types/string.md) + +**Ejemplo** + +``` sql +SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 +``` + +``` text +┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ +│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ +│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ +│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ +└────────┴────────────────────────────────┴──────────────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/es/sql-reference/functions/random-functions.md b/docs/es/sql-reference/functions/random-functions.md new file mode 100644 index 00000000000..1bdec011e2a --- /dev/null +++ b/docs/es/sql-reference/functions/random-functions.md @@ -0,0 +1,30 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 51 +toc_title: "Generaci\xF3n de n\xFAmeros pseudo-aleatorios" +--- + +# Funciones Para Generar números Pseudoaleatorios {#functions-for-generating-pseudo-random-numbers} + +Se utilizan generadores no criptográficos de números pseudoaleatorios. + +Todas las funciones aceptan cero argumentos o un argumento. +Si se pasa un argumento, puede ser de cualquier tipo y su valor no se usa para nada. +El único propósito de este argumento es evitar la eliminación de subexpresiones comunes, de modo que dos instancias diferentes de la misma función devuelvan columnas diferentes con números aleatorios diferentes. + +## rand {#rand} + +Devuelve un número pseudoaleatorio UInt32, distribuido uniformemente entre todos los números de tipo UInt32. +Utiliza un generador congruente lineal. + +## rand64 {#rand64} + +Devuelve un número pseudoaleatorio UInt64, distribuido uniformemente entre todos los números de tipo UInt64. +Utiliza un generador congruente lineal. + +## randConstant {#randconstant} + +Devuelve un número pseudoaleatorio UInt32, El valor es uno para diferentes bloques. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/es/sql-reference/functions/rounding-functions.md b/docs/es/sql-reference/functions/rounding-functions.md new file mode 100644 index 00000000000..f9409b5faea --- /dev/null +++ b/docs/es/sql-reference/functions/rounding-functions.md @@ -0,0 +1,190 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 45 +toc_title: Redondeo +--- + +# Funciones De Redondeo {#rounding-functions} + +## piso(x\[, N\]) {#floorx-n} + +Devuelve el número de ronda más grande que es menor o igual que `x`. Un número redondo es un múltiplo de 1 / 10N, o el número más cercano del tipo de datos apropiado si 1 / 10N no es exacto. +‘N’ es una constante entera, parámetro opcional. Por defecto es cero, lo que significa redondear a un entero. +‘N’ puede ser negativo. + +Ejemplos: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` + +`x` es cualquier tipo numérico. El resultado es un número del mismo tipo. +Para argumentos enteros, tiene sentido redondear con un negativo `N` valor no negativo `N` la función no hace nada). +Si el redondeo causa desbordamiento (por ejemplo, floor(-128, -1)), se devuelve un resultado específico de la implementación. + +## Por Ejemplo:\]) {#ceilx-n-ceilingx-n} + +Devuelve el número redondo más pequeño que es mayor o igual que `x`. En todos los demás sentidos, es lo mismo que el `floor` función (véase más arriba). + +## ¿Cómo puedo hacerlo?\]) {#truncx-n-truncatex-n} + +Devuelve el número redondo con el valor absoluto más grande que tiene un valor absoluto menor o igual que `x`‘s. In every other way, it is the same as the ’floor’ función (véase más arriba). + +## Ronda (x\[, N\]) {#rounding_functions-round} + +Redondea un valor a un número especificado de decimales. + +La función devuelve el número más cercano del orden especificado. En caso de que el número dado tenga la misma distancia que los números circundantes, la función utiliza el redondeo del banquero para los tipos de números flotantes y se redondea desde cero para los otros tipos de números. + +``` sql +round(expression [, decimal_places]) +``` + +**Parámetros:** + +- `expression` — A number to be rounded. Can be any [expresion](../syntax.md#syntax-expressions) devolviendo el numérico [tipo de datos](../../sql-reference/data-types/index.md#data_types). +- `decimal-places` — An integer value. + - Si `decimal-places > 0` luego la función redondea el valor a la derecha del punto decimal. + - Si `decimal-places < 0` luego la función redondea el valor a la izquierda del punto decimal. + - Si `decimal-places = 0` entonces la función redondea el valor a entero. En este caso, el argumento puede omitirse. + +**Valor devuelto:** + +El número redondeado del mismo tipo que el número de entrada. + +### Ejemplos {#examples} + +**Ejemplo de uso** + +``` sql +SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 +``` + +``` text +┌───x─┬─round(divide(number, 2))─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +└─────┴──────────────────────────┘ +``` + +**Ejemplos de redondeo** + +Redondeando al número más cercano. + +``` text +round(3.2, 0) = 3 +round(4.1267, 2) = 4.13 +round(22,-1) = 20 +round(467,-2) = 500 +round(-467,-2) = -500 +``` + +Redondeo del banquero. + +``` text +round(3.5) = 4 +round(4.5) = 4 +round(3.55, 1) = 3.6 +round(3.65, 1) = 3.6 +``` + +**Ver también** + +- [roundBankers](#roundbankers) + +## roundBankers {#roundbankers} + +Redondea un número a una posición decimal especificada. + +- Si el número de redondeo está a medio camino entre dos números, la función utiliza el redondeo del banquero. + + Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. + + It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. + +- En otros casos, la función redondea los números al entero más cercano. + +Usando el redondeo del banquero, puede reducir el efecto que tiene el redondeo de números en los resultados de sumar o restar estos números. + +Por ejemplo, suma números 1.5, 2.5, 3.5, 4.5 con redondeo diferente: + +- Sin redondeo: 1.5 + 2.5 + 3.5 + 4.5 = 12. +- Redondeo del banquero: 2 + 2 + 4 + 4 = 12. +- Redondeando al entero más cercano: 2 + 3 + 4 + 5 = 14. + +**Sintaxis** + +``` sql +roundBankers(expression [, decimal_places]) +``` + +**Parámetros** + +- `expression` — A number to be rounded. Can be any [expresion](../syntax.md#syntax-expressions) devolviendo el numérico [tipo de datos](../../sql-reference/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`. + - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. + +**Valor devuelto** + +Un valor redondeado por el método de redondeo del banquero. + +### Ejemplos {#examples-1} + +**Ejemplo de uso** + +Consulta: + +``` sql + SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 +``` + +Resultado: + +``` text +┌───x─┬─b─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +│ 1.5 │ 2 │ +│ 2 │ 2 │ +│ 2.5 │ 2 │ +│ 3 │ 3 │ +│ 3.5 │ 4 │ +│ 4 │ 4 │ +│ 4.5 │ 4 │ +└─────┴───┘ +``` + +**Ejemplos de redondeo de Banker** + +``` text +roundBankers(0.4) = 0 +roundBankers(-3.5) = -4 +roundBankers(4.5) = 4 +roundBankers(3.55, 1) = 3.6 +roundBankers(3.65, 1) = 3.6 +roundBankers(10.35, 1) = 10.4 +roundBankers(10.755, 2) = 11,76 +``` + +**Ver también** + +- [ronda](#rounding_functions-round) + +## ¿Cómo puedo hacerlo?) {#roundtoexp2num} + +Acepta un número. Si el número es menor que uno, devuelve 0. De lo contrario, redondea el número al grado más cercano (todo no negativo) de dos. + +## RondaDuración(num) {#rounddurationnum} + +Acepta un número. Si el número es menor que uno, devuelve 0. De lo contrario, redondea el número a números del conjunto: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Esta función es específica de Yandex.Métrica y se utiliza para aplicar el informe sobre la duración del período de sesiones. + +## RondaEdad(num) {#roundagenum} + +Acepta un número. Si el número es menor que 18, devuelve 0. De lo contrario, redondea el número a un número del conjunto: 18, 25, 35, 45, 55. Esta función es específica de Yandex.Métrica y se utiliza para la aplicación del informe sobre la edad del usuario. + +## ¿Cómo puedo hacerlo?) {#rounddownnum-arr} + +Acepta un número y lo redondea a un elemento en la matriz especificada. Si el valor es menor que el límite más bajo, se devuelve el límite más bajo. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/es/sql-reference/functions/splitting-merging-functions.md b/docs/es/sql-reference/functions/splitting-merging-functions.md new file mode 100644 index 00000000000..121a9dee52e --- /dev/null +++ b/docs/es/sql-reference/functions/splitting-merging-functions.md @@ -0,0 +1,116 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 47 +toc_title: "Divisi\xF3n y fusi\xF3n de cuerdas y matrices" +--- + +# Funciones Para Dividir y Fusionar Cadenas y Matrices {#functions-for-splitting-and-merging-strings-and-arrays} + +## Por Ejemplo:) {#splitbycharseparator-s} + +Divide una cadena en subcadenas separadas por un carácter especificado. Utiliza una cadena constante `separator` que consiste en exactamente un carácter. +Devuelve una matriz de subcadenas seleccionadas. Se pueden seleccionar subcadenas vacías si el separador aparece al principio o al final de la cadena, o si hay varios separadores consecutivos. + +**Sintaxis** + +``` sql +splitByChar(, ) +``` + +**Parámetros** + +- `separator` — The separator which should contain exactly one character. [Cadena](../../sql-reference/data-types/string.md). +- `s` — The string to split. [Cadena](../../sql-reference/data-types/string.md). + +**Valores devueltos)** + +Devuelve una matriz de subcadenas seleccionadas. Las subcadenas vacías se pueden seleccionar cuando: + +- Se produce un separador al principio o al final de la cadena; +- Hay varios separadores consecutivos; +- La cadena original `s` está vacío. + +Tipo: [Matriz](../../sql-reference/data-types/array.md) de [Cadena](../../sql-reference/data-types/string.md). + +**Ejemplo** + +``` sql +SELECT splitByChar(',', '1,2,3,abcde') +``` + +``` text +┌─splitByChar(',', '1,2,3,abcde')─┐ +│ ['1','2','3','abcde'] │ +└─────────────────────────────────┘ +``` + +## Por Ejemplo:) {#splitbystringseparator-s} + +Divide una cadena en subcadenas separadas por una cadena. Utiliza una cadena constante `separator` de múltiples caracteres como separador. Si la cadena `separator` está vacío, dividirá la cadena `s` en una matriz de caracteres individuales. + +**Sintaxis** + +``` sql +splitByString(, ) +``` + +**Parámetros** + +- `separator` — The separator. [Cadena](../../sql-reference/data-types/string.md). +- `s` — The string to split. [Cadena](../../sql-reference/data-types/string.md). + +**Valores devueltos)** + +Devuelve una matriz de subcadenas seleccionadas. Las subcadenas vacías se pueden seleccionar cuando: + +Tipo: [Matriz](../../sql-reference/data-types/array.md) de [Cadena](../../sql-reference/data-types/string.md). + +- Se produce un separador no vacío al principio o al final de la cadena; +- Hay varios separadores consecutivos no vacíos; +- La cadena original `s` está vacío mientras el separador no está vacío. + +**Ejemplo** + +``` sql +SELECT splitByString(', ', '1, 2 3, 4,5, abcde') +``` + +``` text +┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ +│ ['1','2 3','4,5','abcde'] │ +└───────────────────────────────────────────┘ +``` + +``` sql +SELECT splitByString('', 'abcde') +``` + +``` text +┌─splitByString('', 'abcde')─┐ +│ ['a','b','c','d','e'] │ +└────────────────────────────┘ +``` + +## Por Ejemplo, Se Puede Usar Una Matriz.\]) {#arraystringconcatarr-separator} + +Concatena las cadenas enumeradas en la matriz con el separador.’separador’ es un parámetro opcional: una constante de cadena, establece una cadena vacía por defecto. +Devuelve la cadena. + +## Sistema Abierto.) {#alphatokenss} + +Selecciona subcadenas de bytes consecutivos de los rangos a-z y A-Z.Devuelve una matriz de subcadenas. + +**Ejemplo** + +``` sql +SELECT alphaTokens('abca1abc') +``` + +``` text +┌─alphaTokens('abca1abc')─┐ +│ ['abca','abc'] │ +└─────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/es/sql-reference/functions/string-functions.md b/docs/es/sql-reference/functions/string-functions.md new file mode 100644 index 00000000000..bcf8c3614fe --- /dev/null +++ b/docs/es/sql-reference/functions/string-functions.md @@ -0,0 +1,489 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 40 +toc_title: Trabajar con cadenas +--- + +# Funciones Para Trabajar Con Cadenas {#functions-for-working-with-strings} + +## vaciar {#empty} + +Devuelve 1 para una cadena vacía o 0 para una cadena no vacía. +El tipo de resultado es UInt8. +Una cadena se considera no vacía si contiene al menos un byte, incluso si se trata de un espacio o un byte nulo. +La función también funciona para matrices. + +## notEmpty {#notempty} + +Devuelve 0 para una cadena vacía o 1 para una cadena no vacía. +El tipo de resultado es UInt8. +La función también funciona para matrices. + +## longitud {#length} + +Devuelve la longitud de una cadena en bytes (no en caracteres y no en puntos de código). +El tipo de resultado es UInt64. +La función también funciona para matrices. + +## longitudUTF8 {#lengthutf8} + +Devuelve la longitud de una cadena en puntos de código Unicode (no en caracteres), suponiendo que la cadena contiene un conjunto de bytes que componen texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). +El tipo de resultado es UInt64. + +## char\_length, CHAR\_LENGTH {#char-length} + +Devuelve la longitud de una cadena en puntos de código Unicode (no en caracteres), suponiendo que la cadena contiene un conjunto de bytes que componen texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). +El tipo de resultado es UInt64. + +## character\_length, CHARACTER\_LENGTH {#character-length} + +Devuelve la longitud de una cadena en puntos de código Unicode (no en caracteres), suponiendo que la cadena contiene un conjunto de bytes que componen texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). +El tipo de resultado es UInt64. + +## inferior, lcase {#lower} + +Convierte símbolos latinos ASCII en una cadena a minúsculas. + +## superior, ucase {#upper} + +Convierte los símbolos latinos ASCII en una cadena a mayúsculas. + +## Método De codificación De Datos: {#lowerutf8} + +Convierte una cadena en minúsculas, suponiendo que la cadena contiene un conjunto de bytes que componen un texto codificado en UTF-8. +No detecta el idioma. Entonces, para el turco, el resultado podría no ser exactamente correcto. +Si la longitud de la secuencia de bytes UTF-8 es diferente para mayúsculas y minúsculas de un punto de código, el resultado puede ser incorrecto para este punto de código. +Si la cadena contiene un conjunto de bytes que no es UTF-8, entonces el comportamiento no está definido. + +## superiorUTF8 {#upperutf8} + +Convierte una cadena en mayúsculas, suponiendo que la cadena contiene un conjunto de bytes que componen un texto codificado en UTF-8. +No detecta el idioma. Entonces, para el turco, el resultado podría no ser exactamente correcto. +Si la longitud de la secuencia de bytes UTF-8 es diferente para mayúsculas y minúsculas de un punto de código, el resultado puede ser incorrecto para este punto de código. +Si la cadena contiene un conjunto de bytes que no es UTF-8, entonces el comportamiento no está definido. + +## Sistema Abierto {#isvalidutf8} + +Devuelve 1, si el conjunto de bytes es válido codificado en UTF-8, de lo contrario 0. + +## Acerca De Nosotros {#tovalidutf8} + +Reemplaza los caracteres UTF-8 no válidos por `�` (U+FFFD) carácter. Todos los caracteres no válidos que se ejecutan en una fila se contraen en el único carácter de reemplazo. + +``` sql +toValidUTF8( input_string ) +``` + +Parámetros: + +- input\_string — Any set of bytes represented as the [Cadena](../../sql-reference/data-types/string.md) objeto de tipo de datos. + +Valor devuelto: cadena UTF-8 válida. + +**Ejemplo** + +``` sql +SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') +``` + +``` text +┌─toValidUTF8('a����b')─┐ +│ a�b │ +└───────────────────────┘ +``` + +## repetir {#repeat} + +Repite una cadena tantas veces como se especifique y concatena los valores replicados como una única cadena. + +**Sintaxis** + +``` sql +repeat(s, n) +``` + +**Parámetros** + +- `s` — The string to repeat. [Cadena](../../sql-reference/data-types/string.md). +- `n` — The number of times to repeat the string. [UInt](../../sql-reference/data-types/int-uint.md). + +**Valor devuelto** + +La cadena única, que contiene la cadena `s` repetir `n` tiempo. Si `n` \< 1, la función devuelve cadena vacía. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT repeat('abc', 10) +``` + +Resultado: + +``` text +┌─repeat('abc', 10)──────────────┐ +│ abcabcabcabcabcabcabcabcabcabc │ +└────────────────────────────────┘ +``` + +## inverso {#reverse} + +Invierte la cadena (como una secuencia de bytes). + +## reverseUTF8 {#reverseutf8} + +Invierte una secuencia de puntos de código Unicode, suponiendo que la cadena contiene un conjunto de bytes que representan un texto UTF-8. De lo contrario, hace otra cosa (no arroja una excepción). + +## format(pattern, s0, s1, …) {#format} + +Formatear el patrón constante con la cadena enumerada en los argumentos. `pattern` es un patrón de formato de Python simplificado. La cadena de formato contiene “replacement fields” rodeado de llaves `{}`. Cualquier cosa que no esté contenida entre llaves se considera texto literal, que se copia sin cambios en la salida. Si necesita incluir un carácter de llave en el texto literal, se puede escapar duplicando: `{{ '{{' }}` y `{{ '}}' }}`. Los nombres de campo pueden ser números (comenzando desde cero) o vacíos (luego se tratan como números de consecuencia). + +``` sql +SELECT format('{1} {0} {1}', 'World', 'Hello') +``` + +``` text +┌─format('{1} {0} {1}', 'World', 'Hello')─┐ +│ Hello World Hello │ +└─────────────────────────────────────────┘ +``` + +``` sql +SELECT format('{} {}', 'Hello', 'World') +``` + +``` text +┌─format('{} {}', 'Hello', 'World')─┐ +│ Hello World │ +└───────────────────────────────────┘ +``` + +## concat {#concat} + +Concatena las cadenas enumeradas en los argumentos, sin un separador. + +**Sintaxis** + +``` sql +concat(s1, s2, ...) +``` + +**Parámetros** + +Valores de tipo String o FixedString. + +**Valores devueltos** + +Devuelve la cadena que resulta de concatenar los argumentos. + +Si alguno de los valores de argumento `NULL`, `concat` devoluciones `NULL`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT concat('Hello, ', 'World!') +``` + +Resultado: + +``` text +┌─concat('Hello, ', 'World!')─┐ +│ Hello, World! │ +└─────────────────────────────┘ +``` + +## ConcatAssumeInjective {#concatassumeinjective} + +Lo mismo que [concat](#concat), la diferencia es que usted necesita asegurar eso `concat(s1, s2, ...) → sn` es inyectivo, se utilizará para la optimización de GROUP BY. + +La función se llama “injective” si siempre devuelve un resultado diferente para diferentes valores de argumentos. En otras palabras: diferentes argumentos nunca arrojan un resultado idéntico. + +**Sintaxis** + +``` sql +concatAssumeInjective(s1, s2, ...) +``` + +**Parámetros** + +Valores de tipo String o FixedString. + +**Valores devueltos** + +Devuelve la cadena que resulta de concatenar los argumentos. + +Si alguno de los valores de argumento `NULL`, `concatAssumeInjective` devoluciones `NULL`. + +**Ejemplo** + +Tabla de entrada: + +``` sql +CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; +INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); +SELECT * from key_val; +``` + +``` text +┌─key1────┬─key2─────┬─value─┐ +│ Hello, │ World │ 1 │ +│ Hello, │ World │ 2 │ +│ Hello, │ World! │ 3 │ +│ Hello │ , World! │ 2 │ +└─────────┴──────────┴───────┘ +``` + +Consulta: + +``` sql +SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) +``` + +Resultado: + +``` text +┌─concat(key1, key2)─┬─sum(value)─┐ +│ Hello, World! │ 3 │ +│ Hello, World! │ 2 │ +│ Hello, World │ 3 │ +└────────────────────┴────────────┘ +``` + +## substring(s, desplazamiento, longitud), mid(s, desplazamiento, longitud), substr(s, desplazamiento, longitud) {#substring} + +Devuelve una subcadena que comienza con el byte ‘offset’ índice que es ‘length’ bytes de largo. La indexación de caracteres comienza desde uno (como en SQL estándar). El ‘offset’ y ‘length’ los argumentos deben ser constantes. + +## substringUTF8(s, desplazamiento, longitud) {#substringutf8} + +Lo mismo que ‘substring’, pero para puntos de código Unicode. Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). + +## Aquí Hay Algunas Opciones) {#appendtrailingcharifabsent} + +Si el ‘s’ cadena no está vacía y no contiene el ‘c’ carácter al final, se añade el ‘c’ carácter hasta el final. + +## convertirCharset(s), de, a) {#convertcharset} + +Devuelve la cadena ‘s’ que se convirtió de la codificación en ‘from’ a la codificación en ‘to’. + +## Sistema Abierto.) {#base64encode} + +Codificar ‘s’ cadena en base64 + +## base64Decode(s)) {#base64decode} + +Decodificar cadena codificada en base64 ‘s’ en la cadena original. En caso de fallo plantea una excepción. + +## tryBase64Decode(s) {#trybase64decode} + +Similar a base64Decode, pero en caso de error se devolverá una cadena vacía. + +## endsWith(s, sufijo) {#endswith} + +Devuelve si se debe terminar con el sufijo especificado. Devuelve 1 si la cadena termina con el sufijo especificado, de lo contrario devuelve 0. + +## startsWith(str, prefijo) {#startswith} + +Devuelve 1 si la cadena comienza con el prefijo especificado, de lo contrario devuelve 0. + +``` sql +SELECT startsWith('Spider-Man', 'Spi'); +``` + +**Valores devueltos** + +- 1, si la cadena comienza con el prefijo especificado. +- 0, si la cadena no comienza con el prefijo especificado. + +**Ejemplo** + +Consulta: + +``` sql +SELECT startsWith('Hello, world!', 'He'); +``` + +Resultado: + +``` text +┌─startsWith('Hello, world!', 'He')─┐ +│ 1 │ +└───────────────────────────────────┘ +``` + +## recortar {#trim} + +Quita todos los caracteres especificados del inicio o el final de una cadena. +De forma predeterminada, elimina todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) de ambos extremos de una cadena. + +**Sintaxis** + +``` sql +trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) +``` + +**Parámetros** + +- `trim_character` — specified characters for trim. [Cadena](../../sql-reference/data-types/string.md). +- `input_string` — string for trim. [Cadena](../../sql-reference/data-types/string.md). + +**Valor devuelto** + +Una cadena sin caracteres especificados iniciales y (o) finales. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT trim(BOTH ' ()' FROM '( Hello, world! )') +``` + +Resultado: + +``` text +┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ +│ Hello, world! │ +└───────────────────────────────────────────────┘ +``` + +## trimLeft {#trimleft} + +Quita todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) desde el principio de una cadena. No elimina otros tipos de caracteres de espacios en blanco (tab, espacio sin interrupción, etc.). + +**Sintaxis** + +``` sql +trimLeft(input_string) +``` + +Apodo: `ltrim(input_string)`. + +**Parámetros** + +- `input_string` — string to trim. [Cadena](../../sql-reference/data-types/string.md). + +**Valor devuelto** + +Una cadena sin espacios en blanco comunes iniciales. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT trimLeft(' Hello, world! ') +``` + +Resultado: + +``` text +┌─trimLeft(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## trimRight {#trimright} + +Quita todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) del final de una cadena. No elimina otros tipos de caracteres de espacios en blanco (tab, espacio sin interrupción, etc.). + +**Sintaxis** + +``` sql +trimRight(input_string) +``` + +Apodo: `rtrim(input_string)`. + +**Parámetros** + +- `input_string` — string to trim. [Cadena](../../sql-reference/data-types/string.md). + +**Valor devuelto** + +Una cadena sin espacios en blanco comunes finales. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT trimRight(' Hello, world! ') +``` + +Resultado: + +``` text +┌─trimRight(' Hello, world! ')─┐ +│ Hello, world! │ +└──────────────────────────────────────┘ +``` + +## AjusteTanto {#trimboth} + +Quita todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) de ambos extremos de una cadena. No elimina otros tipos de caracteres de espacios en blanco (tab, espacio sin interrupción, etc.). + +**Sintaxis** + +``` sql +trimBoth(input_string) +``` + +Apodo: `trim(input_string)`. + +**Parámetros** + +- `input_string` — string to trim. [Cadena](../../sql-reference/data-types/string.md). + +**Valor devuelto** + +Una cadena sin espacios en blanco comunes iniciales y finales. + +Tipo: `String`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT trimBoth(' Hello, world! ') +``` + +Resultado: + +``` text +┌─trimBoth(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## CRC32(s)) {#crc32} + +Devuelve la suma de comprobación CRC32 de una cadena, utilizando el polinomio CRC-32-IEEE 802.3 y el valor inicial `0xffffffff` (implementación zlib). + +El tipo de resultado es UInt32. + +## CRC32IEEE(s) {#crc32ieee} + +Devuelve la suma de comprobación CRC32 de una cadena, utilizando el polinomio CRC-32-IEEE 802.3. + +El tipo de resultado es UInt32. + +## CRC64(s)) {#crc64} + +Devuelve la suma de comprobación CRC64 de una cadena, utilizando el polinomio CRC-64-ECMA. + +El tipo de resultado es UInt64. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/es/sql-reference/functions/string-replace-functions.md b/docs/es/sql-reference/functions/string-replace-functions.md new file mode 100644 index 00000000000..fbc4fe9ce8e --- /dev/null +++ b/docs/es/sql-reference/functions/string-replace-functions.md @@ -0,0 +1,94 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 42 +toc_title: Para reemplazar en cadenas +--- + +# Funciones Para Buscar y Reemplazar En Cadenas {#functions-for-searching-and-replacing-in-strings} + +## replaceOne(pajar, patrón, reemplazo) {#replaceonehaystack-pattern-replacement} + +Sustituye la primera aparición, si existe, de la ‘pattern’ subcadena en ‘haystack’ con el ‘replacement’ subcadena. +Sucesivo, ‘pattern’ y ‘replacement’ deben ser constantes. + +## replaceAll (pajar, patrón, reemplazo), replace (pajar, patrón, reemplazo) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} + +Sustituye todas las apariciones del ‘pattern’ subcadena en ‘haystack’ con el ‘replacement’ subcadena. + +## replaceRegexpOne (pajar, patrón, reemplazo) {#replaceregexponehaystack-pattern-replacement} + +Reemplazo usando el ‘pattern’ expresión regular. Una expresión regular re2. +Sustituye sólo la primera ocurrencia, si existe. +Un patrón se puede especificar como ‘replacement’. Este patrón puede incluir sustituciones `\0-\9`. +Sustitución `\0` incluye toda la expresión regular. Sustitución `\1-\9` corresponden a los números de subpatrón. `\` en una plantilla, escapar de ella usando `\`. +También tenga en cuenta que un literal de cadena requiere un escape adicional. + +Ejemplo 1. Conversión de la fecha a formato americano: + +``` sql +SELECT DISTINCT + EventDate, + replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res +FROM test.hits +LIMIT 7 +FORMAT TabSeparated +``` + +``` text +2014-03-17 03/17/2014 +2014-03-18 03/18/2014 +2014-03-19 03/19/2014 +2014-03-20 03/20/2014 +2014-03-21 03/21/2014 +2014-03-22 03/22/2014 +2014-03-23 03/23/2014 +``` + +Ejemplo 2. Copiar una cadena diez veces: + +``` sql +SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res +``` + +``` text +┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## replaceRegexpAll (pajar, patrón, reemplazo) {#replaceregexpallhaystack-pattern-replacement} + +Esto hace lo mismo, pero reemplaza todas las ocurrencias. Ejemplo: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res +``` + +``` text +┌─res────────────────────────┐ +│ HHeelllloo,, WWoorrlldd!! │ +└────────────────────────────┘ +``` + +Como excepción, si una expresión regular funcionó en una subcadena vacía, el reemplazo no se realiza más de una vez. +Ejemplo: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res +``` + +``` text +┌─res─────────────────┐ +│ here: Hello, World! │ +└─────────────────────┘ +``` + +## Sistema Abierto.) {#regexpquotemetas} + +La función agrega una barra invertida antes de algunos caracteres predefinidos en la cadena. +Caracteres predefinidos: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, ‘\]’, ‘?’, ‘\*‘,’+‘,’{‘,’:‘,’-’. +Esta implementación difiere ligeramente de re2::RE2::QuoteMeta. Escapa de byte cero como \\0 en lugar de 00 y escapa solo de los caracteres requeridos. +Para obtener más información, consulte el enlace: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/es/sql-reference/functions/string-search-functions.md b/docs/es/sql-reference/functions/string-search-functions.md new file mode 100644 index 00000000000..3c14ceb4e86 --- /dev/null +++ b/docs/es/sql-reference/functions/string-search-functions.md @@ -0,0 +1,379 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 41 +toc_title: Para buscar cadenas +--- + +# Funciones Para Buscar Cadenas {#functions-for-searching-strings} + +La búsqueda distingue entre mayúsculas y minúsculas de forma predeterminada en todas estas funciones. Hay variantes separadas para la búsqueda insensible a mayúsculas y minúsculas. + +## posición (pajar, aguja), localizar (pajar, aguja) {#position} + +Devuelve la posición (en bytes) de la subcadena encontrada en la cadena, comenzando desde 1. + +Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado de un solo byte. Si no se cumple esta suposición y un carácter no se puede representar usando un solo byte, la función no lanza una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos bytes, usará dos bytes y así sucesivamente. + +Para una búsqueda sin distinción de mayúsculas y minúsculas, utilice la función [positionCaseInsensitive](#positioncaseinsensitive). + +**Sintaxis** + +``` sql +position(haystack, needle) +``` + +Apodo: `locate(haystack, needle)`. + +**Parámetros** + +- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). + +**Valores devueltos** + +- Posición inicial en bytes (contando desde 1), si se encontró subcadena. +- 0, si no se encontró la subcadena. + +Tipo: `Integer`. + +**Ejemplos** + +Frase “Hello, world!” contiene un conjunto de bytes que representan un texto codificado de un solo byte. La función devuelve algún resultado esperado: + +Consulta: + +``` sql +SELECT position('Hello, world!', '!') +``` + +Resultado: + +``` text +┌─position('Hello, world!', '!')─┐ +│ 13 │ +└────────────────────────────────┘ +``` + +La misma frase en ruso contiene caracteres que no se pueden representar usando un solo byte. La función devuelve algún resultado inesperado (uso [PosiciónUTF8](#positionutf8) función para texto codificado de varios bytes): + +Consulta: + +``` sql +SELECT position('Привет, мир!', '!') +``` + +Resultado: + +``` text +┌─position('Привет, мир!', '!')─┐ +│ 21 │ +└───────────────────────────────┘ +``` + +## positionCaseInsensitive {#positioncaseinsensitive} + +Lo mismo que [posición](#position) devuelve la posición (en bytes) de la subcadena encontrada en la cadena, comenzando desde 1. Utilice la función para una búsqueda que no distingue entre mayúsculas y minúsculas. + +Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado de un solo byte. Si no se cumple esta suposición y un carácter no se puede representar usando un solo byte, la función no lanza una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos bytes, usará dos bytes y así sucesivamente. + +**Sintaxis** + +``` sql +positionCaseInsensitive(haystack, needle) +``` + +**Parámetros** + +- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). + +**Valores devueltos** + +- Posición inicial en bytes (contando desde 1), si se encontró subcadena. +- 0, si no se encontró la subcadena. + +Tipo: `Integer`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT positionCaseInsensitive('Hello, world!', 'hello') +``` + +Resultado: + +``` text +┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ +│ 1 │ +└───────────────────────────────────────────────────┘ +``` + +## PosiciónUTF8 {#positionutf8} + +Devuelve la posición (en puntos Unicode) de la subcadena encontrada en la cadena, comenzando desde 1. + +Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado en UTF-8. Si no se cumple esta suposición, la función no produce una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos puntos Unicode, usará dos y así sucesivamente. + +Para una búsqueda sin distinción de mayúsculas y minúsculas, utilice la función [PosiciónCasoInsensitiveUTF8](#positioncaseinsensitiveutf8). + +**Sintaxis** + +``` sql +positionUTF8(haystack, needle) +``` + +**Parámetros** + +- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). + +**Valores devueltos** + +- Posición inicial en puntos Unicode (contando desde 1), si se encontró subcadena. +- 0, si no se encontró la subcadena. + +Tipo: `Integer`. + +**Ejemplos** + +Frase “Hello, world!” en ruso contiene un conjunto de puntos Unicode que representan un texto codificado de un solo punto. La función devuelve algún resultado esperado: + +Consulta: + +``` sql +SELECT positionUTF8('Привет, мир!', '!') +``` + +Resultado: + +``` text +┌─positionUTF8('Привет, мир!', '!')─┐ +│ 12 │ +└───────────────────────────────────┘ +``` + +Frase “Salut, étudiante!”, donde el carácter `é` puede ser representado usando un un punto (`U+00E9`) o dos puntos (`U+0065U+0301`) la función se puede devolver algún resultado inesperado: + +Consulta de la carta `é`, que se representa un punto Unicode `U+00E9`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +Resultado: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 17 │ +└────────────────────────────────────────┘ +``` + +Consulta de la carta `é`, que se representa dos puntos Unicode `U+0065U+0301`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +Resultado: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 18 │ +└────────────────────────────────────────┘ +``` + +## PosiciónCasoInsensitiveUTF8 {#positioncaseinsensitiveutf8} + +Lo mismo que [PosiciónUTF8](#positionutf8), pero no distingue entre mayúsculas y minúsculas. Devuelve la posición (en puntos Unicode) de la subcadena encontrada en la cadena, comenzando desde 1. + +Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado en UTF-8. Si no se cumple esta suposición, la función no produce una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos puntos Unicode, usará dos y así sucesivamente. + +**Sintaxis** + +``` sql +positionCaseInsensitiveUTF8(haystack, needle) +``` + +**Parámetros** + +- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). + +**Valor devuelto** + +- Posición inicial en puntos Unicode (contando desde 1), si se encontró subcadena. +- 0, si no se encontró la subcadena. + +Tipo: `Integer`. + +**Ejemplo** + +Consulta: + +``` sql +SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') +``` + +Resultado: + +``` text +┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ +│ 9 │ +└────────────────────────────────────────────────────┘ +``` + +## multiSearchAllPositions {#multisearchallpositions} + +Lo mismo que [posición](string-search-functions.md#position) pero devuelve `Array` posiciones (en bytes) de las subcadenas correspondientes encontradas en la cadena. Las posiciones se indexan a partir de 1. + +La búsqueda se realiza en secuencias de bytes sin respecto a la codificación de cadenas y la intercalación. + +- Para la búsqueda ASCII sin distinción de mayúsculas y minúsculas, utilice la función `multiSearchAllPositionsCaseInsensitive`. +- Para buscar en UTF-8, use la función [MultiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). +- Para la búsqueda UTF-8 sin distinción de mayúsculas y minúsculas, utilice la función multiSearchAllPositionsCaseInsensitiveUTF8. + +**Sintaxis** + +``` sql +multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) +``` + +**Parámetros** + +- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). + +**Valores devueltos** + +- Matriz de posiciones iniciales en bytes (contando desde 1), si se encontró la subcadena correspondiente y 0 si no se encuentra. + +**Ejemplo** + +Consulta: + +``` sql +SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) +``` + +Resultado: + +``` text +┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ +│ [0,13,0] │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## MultiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} + +Ver `multiSearchAllPositions`. + +## multiSearchFirstPosition(pajar, \[aguja1, aguja2, …, needley\]) {#multisearchfirstposition} + +Lo mismo que `position` pero devuelve el desplazamiento más a la izquierda de la cadena `haystack` que se corresponde con algunas de las agujas. + +Para una búsqueda que no distingue entre mayúsculas y minúsculas o / y en formato UTF-8, use funciones `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. + +## multiSearchFirstIndex(pajar, \[aguja1, aguja2, …, needley\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} + +Devuelve el índice `i` (a partir de 1) de la aguja encontrada más a la izquierdame en la cadena `haystack` y 0 de lo contrario. + +Para una búsqueda que no distingue entre mayúsculas y minúsculas o / y en formato UTF-8, use funciones `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. + +## multiSearchAny(pajar, \[aguja1, aguja2, …, needley\]) {#function-multisearchany} + +Devuelve 1, si al menos una aguja de cuerdame coincide con la cadena `haystack` y 0 de lo contrario. + +Para una búsqueda que no distingue entre mayúsculas y minúsculas o / y en formato UTF-8, use funciones `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. + +!!! note "Nota" + En todos `multiSearch*` el número de agujas debe ser inferior a 28 debido a la especificación de implementación. + +## match (pajar, patrón) {#matchhaystack-pattern} + +Comprueba si la cadena coincide con la `pattern` expresión regular. Un `re2` expresión regular. El [sintaxis](https://github.com/google/re2/wiki/Syntax) de la `re2` expresiones regulares es más limitada que la sintaxis de las expresiones regulares de Perl. + +Devuelve 0 si no coincide, o 1 si coincide. + +Tenga en cuenta que el símbolo de barra invertida (`\`) se utiliza para escapar en la expresión regular. El mismo símbolo se usa para escapar en literales de cadena. Por lo tanto, para escapar del símbolo en una expresión regular, debe escribir dos barras invertidas (\\) en un literal de cadena. + +La expresión regular funciona con la cadena como si fuera un conjunto de bytes. La expresión regular no puede contener bytes nulos. +Para que los patrones busquen subcadenas en una cadena, es mejor usar LIKE o ‘position’, ya que trabajan mucho más rápido. + +## multiMatchAny(pajar, \[patrón1, patrón2, …, patterny\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} + +Lo mismo que `match`, pero devuelve 0 si ninguna de las expresiones regulares coincide y 1 si alguno de los patrones coincide. Se utiliza [hyperscan](https://github.com/intel/hyperscan) biblioteca. Para que los patrones busquen subcadenas en una cadena, es mejor usar `multiSearchAny` ya que funciona mucho más rápido. + +!!! note "Nota" + La longitud de cualquiera de los `haystack` cadena debe ser inferior a 232 bytes de lo contrario, se lanza la excepción. Esta restricción tiene lugar debido a la API de hiperscan. + +## multiMatchAnyIndex(pajar, \[patrón1, patrón2, …, patterny\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} + +Lo mismo que `multiMatchAny`, pero devuelve cualquier índice que coincida con el pajar. + +## ¿Cómo puedo obtener más información?1, patrón2, …, patterny\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} + +Lo mismo que `multiMatchAny`, pero devuelve la matriz de todas las indicaciones que coinciden con el pajar en cualquier orden. + +## multiFuzzyMatchAny(pajar, distancia, \[patrón1, patrón2, …, patterny\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} + +Lo mismo que `multiMatchAny`, pero devuelve 1 si algún patrón coincide con el pajar dentro de una constante [editar distancia](https://en.wikipedia.org/wiki/Edit_distance). Esta función también está en modo experimental y puede ser extremadamente lenta. Para obtener más información, consulte [documentación de hyperscan](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). + +## multiFuzzyMatchAnyIndex(pajar, distancia, \[patrón1, patrón2, …, patterny\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} + +Lo mismo que `multiFuzzyMatchAny`, pero devuelve cualquier índice que coincida con el pajar dentro de una distancia de edición constante. + +## multiFuzzyMatchAllIndices(pajar, distancia, \[patrón1, patrón2, …, patterny\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} + +Lo mismo que `multiFuzzyMatchAny`, pero devuelve la matriz de todos los índices en cualquier orden que coincida con el pajar dentro de una distancia de edición constante. + +!!! note "Nota" + `multiFuzzyMatch*` las funciones no admiten expresiones regulares UTF-8, y dichas expresiones se tratan como bytes debido a la restricción de hiperscan. + +!!! note "Nota" + Para desactivar todas las funciones que utilizan hyperscan, utilice la configuración `SET allow_hyperscan = 0;`. + +## extracto(pajar, patrón) {#extracthaystack-pattern} + +Extrae un fragmento de una cadena utilizando una expresión regular. Si ‘haystack’ no coincide con el ‘pattern’ regex, se devuelve una cadena vacía. Si la expresión regular no contiene subpatrones, toma el fragmento que coincide con toda la expresión regular. De lo contrario, toma el fragmento que coincide con el primer subpatrón. + +## extractAll(pajar, patrón) {#extractallhaystack-pattern} + +Extrae todos los fragmentos de una cadena utilizando una expresión regular. Si ‘haystack’ no coincide con el ‘pattern’ regex, se devuelve una cadena vacía. Devuelve una matriz de cadenas que consiste en todas las coincidencias con la expresión regular. En general, el comportamiento es el mismo que el ‘extract’ función (toma el primer subpatrón, o la expresión completa si no hay un subpatrón). + +## como (pajar, patrón), operador de patrón COMO pajar {#function-like} + +Comprueba si una cadena coincide con una expresión regular simple. +La expresión regular puede contener los metasímbolos `%` y `_`. + +`%` indica cualquier cantidad de bytes (incluidos cero caracteres). + +`_` indica cualquier byte. + +Utilice la barra invertida (`\`) para escapar de metasímbolos. Vea la nota sobre el escape en la descripción del ‘match’ función. + +Para expresiones regulares como `%needle%`, el código es más óptimo y trabaja tan rápido como el `position` función. +Para otras expresiones regulares, el código es el mismo que para ‘match’ función. + +## notLike(haystack, pattern), haystack NOT LIKE operador de patrón {#function-notlike} + +Lo mismo que ‘like’ pero negativo. + +## ngramDistance(pajar, aguja) {#ngramdistancehaystack-needle} + +Calcula la distancia de 4 gramos entre `haystack` y `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` o `haystack` es más de 32Kb, arroja una excepción. Si algunos de los no constantes `haystack` o `needle` Las cadenas son más de 32Kb, la distancia es siempre una. + +Para la búsqueda sin distinción de mayúsculas y minúsculas o / y en formato UTF-8, use funciones `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. + +## ngramSearch(pajar, aguja) {#ngramsearchhaystack-needle} + +Lo mismo que `ngramDistance` pero calcula la diferencia no simétrica entre `needle` y `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` n-gramas. Cuanto más cerca de uno, más probable es `needle` está en el `haystack`. Puede ser útil para la búsqueda de cadenas difusas. + +Para la búsqueda sin distinción de mayúsculas y minúsculas o / y en formato UTF-8, use funciones `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. + +!!! note "Nota" + For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/es/sql-reference/functions/type-conversion-functions.md b/docs/es/sql-reference/functions/type-conversion-functions.md new file mode 100644 index 00000000000..a9c35819cf5 --- /dev/null +++ b/docs/es/sql-reference/functions/type-conversion-functions.md @@ -0,0 +1,534 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 38 +toc_title: "Conversi\xF3n de tipo" +--- + +# Funciones De conversión De Tipos {#type-conversion-functions} + +## Problemas Comunes De Conversiones numéricas {#numeric-conversion-issues} + +Cuando convierte un valor de uno a otro tipo de datos, debe recordar que, en un caso común, es una operación insegura que puede provocar una pérdida de datos. Puede producirse una pérdida de datos si intenta ajustar el valor de un tipo de datos más grande a un tipo de datos más pequeño, o si convierte valores entre diferentes tipos de datos. + +ClickHouse tiene el [mismo comportamiento que los programas de C++](https://en.cppreference.com/w/cpp/language/implicit_conversion). + +## ¿Cómo puedo obtener más información?) {#toint8163264} + +Convierte un valor de entrada en el [En](../../sql-reference/data-types/int-uint.md) tipo de datos. Esta familia de funciones incluye: + +- `toInt8(expr)` — Results in the `Int8` tipo de datos. +- `toInt16(expr)` — Results in the `Int16` tipo de datos. +- `toInt32(expr)` — Results in the `Int32` tipo de datos. +- `toInt64(expr)` — Results in the `Int64` tipo de datos. + +**Parámetros** + +- `expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número o una cadena con la representación decimal de un número. No se admiten representaciones binarias, octales y hexadecimales de números. Los ceros principales son despojados. + +**Valor devuelto** + +Valor entero en el `Int8`, `Int16`, `Int32`, o `Int64` tipo de datos. + +Funciones de uso [redondeando hacia cero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), lo que significa que truncan dígitos fraccionarios de números. + +El comportamiento de las funciones [NaN y Inf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) los argumentos no están definidos. Recuerde acerca de [problemas de conversión numérica](#numeric-conversion-issues), al usar las funciones. + +**Ejemplo** + +``` sql +SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) +``` + +``` text +┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ +│ -9223372036854775808 │ 32 │ 16 │ 8 │ +└──────────────────────┴─────────────┴───────────────┴─────────────┘ +``` + +## ¿Cómo puedo obtener más información? {#toint8163264orzero} + +Toma un argumento de tipo String e intenta analizarlo en Int (8 \| 16 \| 32 \| 64). Si falla, devuelve 0. + +**Ejemplo** + +``` sql +select toInt64OrZero('123123'), toInt8OrZero('123qwe123') +``` + +``` text +┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ +│ 123123 │ 0 │ +└─────────────────────────┴───────────────────────────┘ +``` + +## ¿Cómo puedo hacerlo? {#toint8163264ornull} + +Toma un argumento de tipo String e intenta analizarlo en Int (8 \| 16 \| 32 \| 64). Si falla, devuelve NULL. + +**Ejemplo** + +``` sql +select toInt64OrNull('123123'), toInt8OrNull('123qwe123') +``` + +``` text +┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ +│ 123123 │ ᴺᵁᴸᴸ │ +└─────────────────────────┴───────────────────────────┘ +``` + +## ¿Cómo puedo obtener más información?) {#touint8163264} + +Convierte un valor de entrada en el [UInt](../../sql-reference/data-types/int-uint.md) tipo de datos. Esta familia de funciones incluye: + +- `toUInt8(expr)` — Results in the `UInt8` tipo de datos. +- `toUInt16(expr)` — Results in the `UInt16` tipo de datos. +- `toUInt32(expr)` — Results in the `UInt32` tipo de datos. +- `toUInt64(expr)` — Results in the `UInt64` tipo de datos. + +**Parámetros** + +- `expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número o una cadena con la representación decimal de un número. No se admiten representaciones binarias, octales y hexadecimales de números. Los ceros principales son despojados. + +**Valor devuelto** + +Valor entero en el `UInt8`, `UInt16`, `UInt32`, o `UInt64` tipo de datos. + +Funciones de uso [redondeando hacia cero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), lo que significa que truncan dígitos fraccionarios de números. + +El comportamiento de las funciones para los instrumentos negativos y para [NaN y Inf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) los argumentos no están definidos. Si pasa una cadena con un número negativo, por ejemplo `'-32'`, ClickHouse genera una excepción. Recuerde acerca de [problemas de conversión numérica](#numeric-conversion-issues), al usar las funciones. + +**Ejemplo** + +``` sql +SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) +``` + +``` text +┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ +│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ +└─────────────────────┴───────────────┴────────────────┴──────────────┘ +``` + +## ¿Cómo puedo obtener más información? {#touint8163264orzero} + +## ¿Cómo puedo hacerlo? {#touint8163264ornull} + +## ¿Cómo puedo obtener más información?) {#tofloat3264} + +## ¿Cómo puedo hacerlo? {#tofloat3264orzero} + +## ¿Cómo puedo hacerlo? {#tofloat3264ornull} + +## Fecha {#todate} + +## Todos Los Derechos Reservados {#todateorzero} + +## ToDateOrNull {#todateornull} + +## toDateTime {#todatetime} + +## ToDateTimeOrZero {#todatetimeorzero} + +## ToDateTimeOrNull {#todatetimeornull} + +## toDecimal(32/64/128) {#todecimal3264128} + +Convertir `value` a la [Decimal](../../sql-reference/data-types/decimal.md) tipo de datos con precisión de `S`. El `value` puede ser un número o una cadena. El `S` (escala) parámetro especifica el número de decimales. + +- `toDecimal32(value, S)` +- `toDecimal64(value, S)` +- `toDecimal128(value, S)` + +## ¿Cómo puedo hacer esto? {#todecimal3264128ornull} + +Convierte una cadena de entrada en un [Información detallada))](../../sql-reference/data-types/decimal.md) valor de tipo de datos. Esta familia de funciones incluye: + +- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` tipo de datos. +- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` tipo de datos. +- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` tipo de datos. + +Estas funciones deben usarse en lugar de `toDecimal*()` funciones, si usted prefiere conseguir un `NULL` valor de entrada en lugar de una excepción en el caso de un error de análisis de valor de entrada. + +**Parámetros** + +- `expr` — [Expresion](../syntax.md#syntax-expressions), devuelve un valor en el [Cadena](../../sql-reference/data-types/string.md) tipo de datos. ClickHouse espera la representación textual del número decimal. Por ejemplo, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**Valor devuelto** + +Un valor en el `Nullable(Decimal(P,S))` tipo de datos. El valor contiene: + +- Número con `S` lugares decimales, si ClickHouse interpreta la cadena de entrada como un número. +- `NULL`, si ClickHouse no puede interpretar la cadena de entrada como un número o si el número de entrada contiene más de `S` lugares decimales. + +**Ejemplos** + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ +│ -1.11100 │ Nullable(Decimal(9, 5)) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ +│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## Por Ejemplo: {#todecimal3264128orzero} + +Convierte un valor de entrada en el [Decimal (P, S)](../../sql-reference/data-types/decimal.md) tipo de datos. Esta familia de funciones incluye: + +- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` tipo de datos. +- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` tipo de datos. +- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` tipo de datos. + +Estas funciones deben usarse en lugar de `toDecimal*()` funciones, si usted prefiere conseguir un `0` valor de entrada en lugar de una excepción en el caso de un error de análisis de valor de entrada. + +**Parámetros** + +- `expr` — [Expresion](../syntax.md#syntax-expressions), devuelve un valor en el [Cadena](../../sql-reference/data-types/string.md) tipo de datos. ClickHouse espera la representación textual del número decimal. Por ejemplo, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**Valor devuelto** + +Un valor en el `Nullable(Decimal(P,S))` tipo de datos. El valor contiene: + +- Número con `S` lugares decimales, si ClickHouse interpreta la cadena de entrada como un número. +- 0 con `S` decimales, si ClickHouse no puede interpretar la cadena de entrada como un número o si el número de entrada contiene más de `S` lugares decimales. + +**Ejemplo** + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ +│ -1.11100 │ Decimal(9, 5) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ +│ 0.00 │ Decimal(9, 2) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## ToString {#tostring} + +Funciones para convertir entre números, cadenas (pero no cadenas fijas), fechas y fechas con horas. +Todas estas funciones aceptan un argumento. + +Al convertir a o desde una cadena, el valor se formatea o se analiza utilizando las mismas reglas que para el formato TabSeparated (y casi todos los demás formatos de texto). Si la cadena no se puede analizar, se lanza una excepción y se cancela la solicitud. + +Al convertir fechas a números o viceversa, la fecha corresponde al número de días desde el comienzo de la época Unix. +Al convertir fechas con horas a números o viceversa, la fecha con hora corresponde al número de segundos desde el comienzo de la época Unix. + +Los formatos de fecha y fecha con hora para las funciones toDate/toDateTime se definen de la siguiente manera: + +``` text +YYYY-MM-DD +YYYY-MM-DD hh:mm:ss +``` + +Como excepción, si convierte de tipos numéricos UInt32, Int32, UInt64 o Int64 a Date, y si el número es mayor o igual que 65536, el número se interpreta como una marca de tiempo Unix (y no como el número de días) y se redondea a la fecha. Esto permite soporte para la ocurrencia común de la escritura ‘toDate(unix\_timestamp)’, que de otra manera sería un error y requeriría escribir el más engorroso ‘toDate(toDateTime(unix\_timestamp))’. + +La conversión entre una fecha y una fecha con la hora se realiza de la manera natural: agregando un tiempo nulo o eliminando el tiempo. + +La conversión entre tipos numéricos utiliza las mismas reglas que las asignaciones entre diferentes tipos numéricos en C++. + +Además, la función toString del argumento DateTime puede tomar un segundo argumento String que contiene el nombre de la zona horaria. Ejemplo: `Asia/Yekaterinburg` En este caso, la hora se formatea de acuerdo con la zona horaria especificada. + +``` sql +SELECT + now() AS now_local, + toString(now(), 'Asia/Yekaterinburg') AS now_yekat +``` + +``` text +┌───────────now_local─┬─now_yekat───────────┐ +│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ +└─────────────────────┴─────────────────────┘ +``` + +Ver también el `toUnixTimestamp` función. + +## ¿Qué puedes encontrar en Neodigit) {#tofixedstrings-n} + +Convierte un argumento de tipo String en un tipo FixedString(N) (una cadena con longitud fija N). N debe ser una constante. +Si la cadena tiene menos bytes que N, se pasa con bytes nulos a la derecha. Si la cadena tiene más bytes que N, se produce una excepción. + +## Todos Los Derechos Reservados.) {#tostringcuttozeros} + +Acepta un argumento String o FixedString. Devuelve la cadena con el contenido truncado en el primer byte cero encontrado. + +Ejemplo: + +``` sql +SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s─────────────┬─s_cut─┐ +│ foo\0\0\0\0\0 │ foo │ +└───────────────┴───────┘ +``` + +``` sql +SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s──────────┬─s_cut─┐ +│ foo\0bar\0 │ foo │ +└────────────┴───────┘ +``` + +## ¿Cómo puedo obtener más información?) {#reinterpretasuint8163264} + +## ¿Cómo puedo obtener más información?) {#reinterpretasint8163264} + +## ¿Cómo puedo obtener más información?) {#reinterpretasfloat3264} + +## reinterpretAsDate {#reinterpretasdate} + +## reinterpretAsDateTime {#reinterpretasdatetime} + +Estas funciones aceptan una cadena e interpretan los bytes colocados al principio de la cadena como un número en orden de host (little endian). Si la cadena no es lo suficientemente larga, las funciones funcionan como si la cadena estuviera rellenada con el número necesario de bytes nulos. Si la cadena es más larga de lo necesario, se ignoran los bytes adicionales. Una fecha se interpreta como el número de días desde el comienzo de la época Unix, y una fecha con hora se interpreta como el número de segundos desde el comienzo de la época Unix. + +## reinterpretAsString {#type_conversion_functions-reinterpretAsString} + +Esta función acepta un número o fecha o fecha con hora, y devuelve una cadena que contiene bytes que representan el valor correspondiente en orden de host (little endian). Los bytes nulos se eliminan desde el final. Por ejemplo, un valor de tipo UInt32 de 255 es una cadena que tiene un byte de longitud. + +## reinterpretAsFixedString {#reinterpretasfixedstring} + +Esta función acepta un número o fecha o fecha con hora, y devuelve un FixedString que contiene bytes que representan el valor correspondiente en orden de host (little endian). Los bytes nulos se eliminan desde el final. Por ejemplo, un valor de tipo UInt32 de 255 es un FixedString que tiene un byte de longitud. + +## CAST(x, T) {#type_conversion_function-cast} + +Convertir ‘x’ a la ‘t’ tipo de datos. La sintaxis CAST(x AS t) también es compatible. + +Ejemplo: + +``` sql +SELECT + '2016-06-15 23:00:00' AS timestamp, + CAST(timestamp AS DateTime) AS datetime, + CAST(timestamp AS Date) AS date, + CAST(timestamp, 'String') AS string, + CAST(timestamp, 'FixedString(22)') AS fixed_string +``` + +``` text +┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ +└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ +``` + +La conversión a FixedString(N) solo funciona para argumentos de tipo String o FixedString(N). + +Conversión de tipo a [NULL](../../sql-reference/data-types/nullable.md) y la espalda es compatible. Ejemplo: + +``` sql +SELECT toTypeName(x) FROM t_null +``` + +``` text +┌─toTypeName(x)─┐ +│ Int8 │ +│ Int8 │ +└───────────────┘ +``` + +``` sql +SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null +``` + +``` text +┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ +│ Nullable(UInt16) │ +│ Nullable(UInt16) │ +└─────────────────────────────────────────┘ +``` + +## toInterval(Year\|Quarter\|Month\|Week\|Day\|Hour\|Minute\|Second) {#function-tointerval} + +Convierte un argumento de tipo Number en un [Intervalo](../../sql-reference/data-types/special-data-types/interval.md) tipo de datos. + +**Sintaxis** + +``` sql +toIntervalSecond(number) +toIntervalMinute(number) +toIntervalHour(number) +toIntervalDay(number) +toIntervalWeek(number) +toIntervalMonth(number) +toIntervalQuarter(number) +toIntervalYear(number) +``` + +**Parámetros** + +- `number` — Duration of interval. Positive integer number. + +**Valores devueltos** + +- El valor en `Interval` tipo de datos. + +**Ejemplo** + +``` sql +WITH + toDate('2019-01-01') AS date, + INTERVAL 1 WEEK AS interval_week, + toIntervalWeek(1) AS interval_to_week +SELECT + date + interval_week, + date + interval_to_week +``` + +``` text +┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ +│ 2019-01-08 │ 2019-01-08 │ +└───────────────────────────┴──────────────────────────────┘ +``` + +## parseDateTimeBestEffort {#parsedatetimebesteffort} + +Convierte una fecha y una hora en el [Cadena](../../sql-reference/data-types/string.md) representación a [FechaHora](../../sql-reference/data-types/datetime.md#data_type-datetime) tipo de datos. + +La función analiza [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC 1123 - 5.2.14 RFC-822 Especificación de fecha y hora](https://tools.ietf.org/html/rfc1123#page-55), ClickHouse y algunos otros formatos de fecha y hora. + +**Sintaxis** + +``` sql +parseDateTimeBestEffort(time_string [, time_zone]); +``` + +**Parámetros** + +- `time_string` — String containing a date and time to convert. [Cadena](../../sql-reference/data-types/string.md). +- `time_zone` — Time zone. The function parses `time_string` según la zona horaria. [Cadena](../../sql-reference/data-types/string.md). + +**Formatos no estándar admitidos** + +- Una cadena que contiene 9..10 dígitos [marca de tiempo unix](https://en.wikipedia.org/wiki/Unix_time). +- Una cadena con un componente de fecha y hora: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, sucesivamente. +- Una cadena con una fecha, pero sin componente de hora: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` sucesivamente. +- Una cadena con un día y una hora: `DD`, `DD hh`, `DD hh:mm`. En este caso `YYYY-MM` se sustituyen como `2000-01`. +- Una cadena que incluye la fecha y la hora junto con la información de desplazamiento de zona horaria: `YYYY-MM-DD hh:mm:ss ±h:mm`, sucesivamente. Por ejemplo, `2020-12-12 17:36:00 -5:00`. + +Para todos los formatos con separador, la función analiza los nombres de meses expresados por su nombre completo o por las primeras tres letras de un nombre de mes. Ejemplos: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. + +**Valor devuelto** + +- `time_string` convertido a la `DateTime` tipo de datos. + +**Ejemplos** + +Consulta: + +``` sql +SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') +AS parseDateTimeBestEffort; +``` + +Resultado: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2020-12-12 12:12:57 │ +└─────────────────────────┘ +``` + +Consulta: + +``` sql +SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') +AS parseDateTimeBestEffort +``` + +Resultado: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-08-18 10:22:16 │ +└─────────────────────────┘ +``` + +Consulta: + +``` sql +SELECT parseDateTimeBestEffort('1284101485') +AS parseDateTimeBestEffort +``` + +Resultado: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2015-07-07 12:04:41 │ +└─────────────────────────┘ +``` + +Consulta: + +``` sql +SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') +AS parseDateTimeBestEffort +``` + +Resultado: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-12-12 10:12:12 │ +└─────────────────────────┘ +``` + +Consulta: + +``` sql +SELECT parseDateTimeBestEffort('10 20:19') +``` + +Resultado: + +``` text +┌─parseDateTimeBestEffort('10 20:19')─┐ +│ 2000-01-10 20:19:00 │ +└─────────────────────────────────────┘ +``` + +**Ver también** + +- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) +- [RFC 1123](https://tools.ietf.org/html/rfc1123) +- [Fecha](#todate) +- [toDateTime](#todatetime) + +## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} + +Lo mismo que para [parseDateTimeBestEffort](#parsedatetimebesteffort) excepto que devuelve null cuando encuentra un formato de fecha que no se puede procesar. + +## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} + +Lo mismo que para [parseDateTimeBestEffort](#parsedatetimebesteffort) excepto que devuelve una fecha cero o una fecha cero cuando encuentra un formato de fecha que no se puede procesar. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/es/sql-reference/functions/url-functions.md b/docs/es/sql-reference/functions/url-functions.md new file mode 100644 index 00000000000..e063163ceb8 --- /dev/null +++ b/docs/es/sql-reference/functions/url-functions.md @@ -0,0 +1,209 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 54 +toc_title: Trabajar con URL +--- + +# Funciones Para Trabajar Con URL {#functions-for-working-with-urls} + +Todas estas funciones no siguen el RFC. Se simplifican al máximo para mejorar el rendimiento. + +## Funciones Que Extraen Partes De Una URL {#functions-that-extract-parts-of-a-url} + +Si la parte relevante no está presente en una URL, se devuelve una cadena vacía. + +### protocolo {#protocol} + +Extrae el protocolo de una URL. + +Examples of typical returned values: http, https, ftp, mailto, tel, magnet… + +### dominio {#domain} + +Extrae el nombre de host de una dirección URL. + +``` sql +domain(url) +``` + +**Parámetros** + +- `url` — URL. Type: [Cadena](../../sql-reference/data-types/string.md). + +La URL se puede especificar con o sin un esquema. Ejemplos: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +Para estos ejemplos, el `domain` función devuelve los siguientes resultados: + +``` text +some.svn-hosting.com +some.svn-hosting.com +yandex.com +``` + +**Valores devueltos** + +- Nombre de host. Si ClickHouse puede analizar la cadena de entrada como una URL. +- Cadena vacía. Si ClickHouse no puede analizar la cadena de entrada como una URL. + +Tipo: `String`. + +**Ejemplo** + +``` sql +SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ +│ some.svn-hosting.com │ +└────────────────────────────────────────────────────────┘ +``` + +### Nuestros Servicios {#domainwithoutwww} + +Devuelve el dominio y no elimina más de uno ‘www.’ desde el principio de la misma, si está presente. + +### topLevelDomain {#topleveldomain} + +Extrae el dominio de nivel superior de una URL. + +``` sql +topLevelDomain(url) +``` + +**Parámetros** + +- `url` — URL. Type: [Cadena](../../sql-reference/data-types/string.md). + +La URL se puede especificar con o sin un esquema. Ejemplos: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +**Valores devueltos** + +- Nombre de dominio. Si ClickHouse puede analizar la cadena de entrada como una URL. +- Cadena vacía. Si ClickHouse no puede analizar la cadena de entrada como una URL. + +Tipo: `String`. + +**Ejemplo** + +``` sql +SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ +│ com │ +└────────────────────────────────────────────────────────────────────┘ +``` + +### FirstSignificantSubdomain {#firstsignificantsubdomain} + +Devuelve el “first significant subdomain”. Este es un concepto no estándar específico de Yandex.Métrica. El primer subdominio significativo es un dominio de segundo nivel si es ‘com’, ‘net’, ‘org’, o ‘co’. De lo contrario, es un dominio de tercer nivel. Por ejemplo, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. La lista de “insignificant” dominios de segundo nivel y otros detalles de implementación pueden cambiar en el futuro. + +### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} + +Devuelve la parte del dominio que incluye subdominios de nivel superior “first significant subdomain” (véase la explicación anterior). + +Por ejemplo, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. + +### camino {#path} + +Devuelve la ruta de acceso. Ejemplo: `/top/news.html` La ruta de acceso no incluye la cadena de consulta. + +### pathFull {#pathfull} + +Lo mismo que el anterior, pero incluyendo cadena de consulta y fragmento. Ejemplo: /top/news.html?Página = 2 \# comentarios + +### queryString {#querystring} + +Devuelve la cadena de consulta. Ejemplo: page=1&lr=213. query-string no incluye el signo de interrogación inicial, así como \# y todo después de \#. + +### fragmento {#fragment} + +Devuelve el identificador de fragmento. el fragmento no incluye el símbolo hash inicial. + +### queryStringAndFragment {#querystringandfragment} + +Devuelve la cadena de consulta y el identificador de fragmento. Ejemplo: page=1\#29390. + +### extractURLParameter(URL, nombre) {#extracturlparameterurl-name} + +Devuelve el valor de la ‘name’ parámetro en la URL, si está presente. De lo contrario, una cadena vacía. Si hay muchos parámetros con este nombre, devuelve la primera aparición. Esta función funciona bajo el supuesto de que el nombre del parámetro está codificado en la URL exactamente de la misma manera que en el argumento pasado. + +### extractURLParameters (URL) {#extracturlparametersurl} + +Devuelve una matriz de cadenas name=value correspondientes a los parámetros de URL. Los valores no se decodifican de ninguna manera. + +### ExtractURLParameterNames (URL) {#extracturlparameternamesurl} + +Devuelve una matriz de cadenas de nombre correspondientes a los nombres de los parámetros de URL. Los valores no se decodifican de ninguna manera. + +### URLJerarquía (URL) {#urlhierarchyurl} + +Devuelve una matriz que contiene la URL, truncada al final por los símbolos /,? en la ruta y la cadena de consulta. Los caracteres separadores consecutivos se cuentan como uno. El corte se realiza en la posición después de todos los caracteres separadores consecutivos. + +### URLPathHierarchy (URL) {#urlpathhierarchyurl} + +Lo mismo que el anterior, pero sin el protocolo y el host en el resultado. El elemento / (raíz) no está incluido. Ejemplo: la función se utiliza para implementar informes de árbol de la URL en Yandex. Métrica. + +``` text +URLPathHierarchy('https://example.com/browse/CONV-6788') = +[ + '/browse/', + '/browse/CONV-6788' +] +``` + +### decodeURLComponent (URL) {#decodeurlcomponenturl} + +Devuelve la dirección URL decodificada. +Ejemplo: + +``` sql +SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; +``` + +``` text +┌─DecodedURL─────────────────────────────┐ +│ http://127.0.0.1:8123/?query=SELECT 1; │ +└────────────────────────────────────────┘ +``` + +## Funciones Que Eliminan Parte De Una URL {#functions-that-remove-part-of-a-url} + +Si la URL no tiene nada similar, la URL permanece sin cambios. + +### Sistema Abierto {#cutwww} + +Elimina no más de uno ‘www.’ desde el principio del dominio de la URL, si está presente. + +### cutQueryString {#cutquerystring} + +Quita la cadena de consulta. El signo de interrogación también se elimina. + +### cutFragment {#cutfragment} + +Quita el identificador de fragmento. El signo de número también se elimina. + +### cutQueryStringAndFragment {#cutquerystringandfragment} + +Quita la cadena de consulta y el identificador de fragmento. El signo de interrogación y el signo de número también se eliminan. + +### cutURLParameter(URL, nombre) {#cuturlparameterurl-name} + +Elimina el ‘name’ Parámetro URL, si está presente. Esta función funciona bajo el supuesto de que el nombre del parámetro está codificado en la URL exactamente de la misma manera que en el argumento pasado. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/es/sql-reference/functions/uuid-functions.md b/docs/es/sql-reference/functions/uuid-functions.md new file mode 100644 index 00000000000..de942f5f7f9 --- /dev/null +++ b/docs/es/sql-reference/functions/uuid-functions.md @@ -0,0 +1,122 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 53 +toc_title: Trabajando con UUID +--- + +# Funciones Para Trabajar Con UUID {#functions-for-working-with-uuid} + +Las funciones para trabajar con UUID se enumeran a continuación. + +## GenerateUUIDv4 {#uuid-function-generate} + +Genera el [UUID](../../sql-reference/data-types/uuid.md) de [versión 4](https://tools.ietf.org/html/rfc4122#section-4.4). + +``` sql +generateUUIDv4() +``` + +**Valor devuelto** + +El valor de tipo UUID. + +**Ejemplo de uso** + +En este ejemplo se muestra la creación de una tabla con la columna de tipo UUID e insertar un valor en la tabla. + +``` sql +CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog + +INSERT INTO t_uuid SELECT generateUUIDv4() + +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┐ +│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ +└──────────────────────────────────────┘ +``` + +## paraUUID (x) {#touuid-x} + +Convierte el valor de tipo de cadena en tipo UUID. + +``` sql +toUUID(String) +``` + +**Valor devuelto** + +El valor de tipo UUID. + +**Ejemplo de uso** + +``` sql +SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid +``` + +``` text +┌─────────────────────────────────uuid─┐ +│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ +└──────────────────────────────────────┘ +``` + +## UUIDStringToNum {#uuidstringtonum} + +Acepta una cadena que contiene 36 caracteres en el formato `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, y lo devuelve como un conjunto de bytes en un [Cadena fija (16)](../../sql-reference/data-types/fixedstring.md). + +``` sql +UUIDStringToNum(String) +``` + +**Valor devuelto** + +Cadena fija (16) + +**Ejemplos de uso** + +``` sql +SELECT + '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, + UUIDStringToNum(uuid) AS bytes +``` + +``` text +┌─uuid─────────────────────────────────┬─bytes────────────┐ +│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ +└──────────────────────────────────────┴──────────────────┘ +``` + +## UUIDNumToString {#uuidnumtostring} + +Acepta un [Cadena fija (16)](../../sql-reference/data-types/fixedstring.md) valor, y devuelve una cadena que contiene 36 caracteres en formato de texto. + +``` sql +UUIDNumToString(FixedString(16)) +``` + +**Valor devuelto** + +Cadena. + +**Ejemplo de uso** + +``` sql +SELECT + 'a/<@];!~p{jTj={)' AS bytes, + UUIDNumToString(toFixedString(bytes, 16)) AS uuid +``` + +``` text +┌─bytes────────────┬─uuid─────────────────────────────────┐ +│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ +└──────────────────┴──────────────────────────────────────┘ +``` + +## Ver también {#see-also} + +- [dictGetUUID](ext-dict-functions.md#ext_dict_functions-other) + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/es/sql-reference/functions/ym-dict-functions.md b/docs/es/sql-reference/functions/ym-dict-functions.md new file mode 100644 index 00000000000..3e14350796d --- /dev/null +++ b/docs/es/sql-reference/functions/ym-dict-functions.md @@ -0,0 +1,155 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 59 +toc_title: Trabajando con Yandex.Diccionarios de Metrica +--- + +# Funciones Para Trabajar Con Yandex.Metrica, Diccionarios {#functions-for-working-with-yandex-metrica-dictionaries} + +Para que las funciones a continuación funcionen, la configuración del servidor debe especificar las rutas y direcciones para obtener todo el Yandex.Diccionarios Metrica. Los diccionarios se cargan en la primera llamada de cualquiera de estas funciones. Si las listas de referencia no se pueden cargar, se lanza una excepción. + +Para obtener información sobre cómo crear listas de referencia, consulte la sección “Dictionaries”. + +## Múltiples Geobases {#multiple-geobases} + +ClickHouse admite trabajar con múltiples geobases alternativas (jerarquías regionales) simultáneamente, con el fin de soportar diversas perspectivas sobre a qué países pertenecen ciertas regiones. + +El ‘clickhouse-server’ config especifica el archivo con la jerarquía regional::`/opt/geo/regions_hierarchy.txt` + +Además de este archivo, también busca archivos cercanos que tengan el símbolo \_ y cualquier sufijo anexado al nombre (antes de la extensión del archivo). +Por ejemplo, también encontrará el archivo `/opt/geo/regions_hierarchy_ua.txt` si está presente. + +`ua` se llama la clave del diccionario. Para un diccionario sin un sufijo, la clave es una cadena vacía. + +Todos los diccionarios se vuelven a cargar en tiempo de ejecución (una vez cada cierto número de segundos, como se define en el parámetro de configuración builtin\_dictionaries\_reload\_interval , o una vez por hora por defecto). Sin embargo, la lista de diccionarios disponibles se define una vez, cuando se inicia el servidor. + +All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. +Ejemplo: + +``` sql +regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt +``` + +### ¿Cómo puedo hacerlo?\]) {#regiontocityid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. + +### ¿Cómo puedo hacerlo?\]) {#regiontoareaid-geobase} + +Convierte una región en un área (tipo 5 en la geobase). En todos los demás sentidos, esta función es la misma que ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ +│ │ +│ Moscow and Moscow region │ +│ St. Petersburg and Leningrad region │ +│ Belgorod region │ +│ Ivanovsk region │ +│ Kaluga region │ +│ Kostroma region │ +│ Kursk region │ +│ Lipetsk region │ +│ Orlov region │ +│ Ryazan region │ +│ Smolensk region │ +│ Tambov region │ +│ Tver region │ +│ Tula region │ +└──────────────────────────────────────────────────────┘ +``` + +### ¿Cómo puedo hacerlo?\]) {#regiontodistrictid-geobase} + +Convierte una región en un distrito federal (tipo 4 en la geobase). En todos los demás sentidos, esta función es la misma que ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ +│ │ +│ Central federal district │ +│ Northwest federal district │ +│ South federal district │ +│ North Caucases federal district │ +│ Privolga federal district │ +│ Ural federal district │ +│ Siberian federal district │ +│ Far East federal district │ +│ Scotland │ +│ Faroe Islands │ +│ Flemish region │ +│ Brussels capital region │ +│ Wallonia │ +│ Federation of Bosnia and Herzegovina │ +└──────────────────────────────────────────────────────────┘ +``` + +### ¿Cómo puedo hacerlo?\]) {#regiontocountryid-geobase} + +Convierte una región en un país. En todos los demás sentidos, esta función es la misma que ‘regionToCity’. +Ejemplo: `regionToCountry(toUInt32(213)) = 225` convierte Moscú (213) a Rusia (225). + +### Aquí está El código De identificación.\]) {#regiontocontinentid-geobase} + +Convierte una región en un continente. En todos los demás sentidos, esta función es la misma que ‘regionToCity’. +Ejemplo: `regionToContinent(toUInt32(213)) = 10001` convierte Moscú (213) a Eurasia (10001). + +### Nuestra misión Es Brindarle Un Servicio De Calidad y Confianza a Nuestros Clientes.) {#regiontotopcontinent-regiontotopcontinent} + +Encuentra el continente más alto en la jerarquía de la región. + +**Sintaxis** + +``` sql +regionToTopContinent(id[, geobase]); +``` + +**Parámetros** + +- `id` — Region ID from the Yandex geobase. [UInt32](../../sql-reference/data-types/int-uint.md). +- `geobase` — Dictionary key. See [Múltiples Geobases](#multiple-geobases). [Cadena](../../sql-reference/data-types/string.md). Opcional. + +**Valor devuelto** + +- Identificador del continente de nivel superior (este último cuando subes la jerarquía de regiones). +- 0, si no hay ninguno. + +Tipo: `UInt32`. + +### Aquí está El código De identificación De La población.\]) {#regiontopopulationid-geobase} + +Obtiene la población de una región. +La población se puede registrar en archivos con la geobase. Vea la sección “External dictionaries”. +Si la población no se registra para la región, devuelve 0. +En la geobase de Yandex, la población podría registrarse para las regiones secundarias, pero no para las regiones parentales. + +### ¿Cómo puedo hacerlo?\]) {#regioninlhs-rhs-geobase} + +Comprueba si un ‘lhs’ región pertenece a un ‘rhs’ regi. Devuelve un número UInt8 igual a 1 si pertenece, o 0 si no pertenece. +The relationship is reflexive – any region also belongs to itself. + +### RegiónJerarquía (id\[, Geobase\]) {#regionhierarchyid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. +Ejemplo: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. + +### ¿Cómo puedo hacerlo?\]) {#regiontonameid-lang} + +Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn’t exist, an empty string is returned. + +`ua` y `uk` ambos significan ucraniano. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/es/sql-reference/index.md b/docs/es/sql-reference/index.md new file mode 100644 index 00000000000..091747f8243 --- /dev/null +++ b/docs/es/sql-reference/index.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: SQL Reference +toc_hidden: true +toc_priority: 28 +toc_title: oculto +--- + +# Referencia SQL {#sql-reference} + +- [SELECT](statements/select.md) +- [INSERT INTO](statements/insert-into.md) +- [CREATE](statements/create.md) +- [ALTER](statements/alter.md#query_language_queries_alter) +- [Otros tipos de consultas](statements/misc.md) + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/es/sql-reference/operators.md b/docs/es/sql-reference/operators.md new file mode 100644 index 00000000000..85e640c4870 --- /dev/null +++ b/docs/es/sql-reference/operators.md @@ -0,0 +1,278 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 37 +toc_title: Operador +--- + +# Operador {#operators} + +Todos los operadores se transforman a sus funciones correspondientes en la etapa de análisis de consulta de acuerdo con su precedencia y asociatividad. +Los grupos de operadores se enumeran en orden de prioridad (cuanto más alto esté en la lista, más temprano estará conectado el operador a sus argumentos). + +## Operadores De Acceso {#access-operators} + +`a[N]` – Access to an element of an array. The `arrayElement(a, N)` función. + +`a.N` – Access to a tuple element. The `tupleElement(a, N)` función. + +## Operador De negación numérica {#numeric-negation-operator} + +`-a` – The `negate (a)` función. + +## Operadores De multiplicación y división {#multiplication-and-division-operators} + +`a * b` – The `multiply (a, b)` función. + +`a / b` – The `divide(a, b)` función. + +`a % b` – The `modulo(a, b)` función. + +## Operadores De Suma y Resta {#addition-and-subtraction-operators} + +`a + b` – The `plus(a, b)` función. + +`a - b` – The `minus(a, b)` función. + +## Operadores De comparación {#comparison-operators} + +`a = b` – The `equals(a, b)` función. + +`a == b` – The `equals(a, b)` función. + +`a != b` – The `notEquals(a, b)` función. + +`a <> b` – The `notEquals(a, b)` función. + +`a <= b` – The `lessOrEquals(a, b)` función. + +`a >= b` – The `greaterOrEquals(a, b)` función. + +`a < b` – The `less(a, b)` función. + +`a > b` – The `greater(a, b)` función. + +`a LIKE s` – The `like(a, b)` función. + +`a NOT LIKE s` – The `notLike(a, b)` función. + +`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. + +`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. + +## Operadores Para Trabajar Con Conjuntos De Datos {#operators-for-working-with-data-sets} + +*Ver [IN operadores](statements/select.md#select-in-operators).* + +`a IN ...` – The `in(a, b)` función. + +`a NOT IN ...` – The `notIn(a, b)` función. + +`a GLOBAL IN ...` – The `globalIn(a, b)` función. + +`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` función. + +## Operadores Para Trabajar Con Fechas y Horarios {#operators-datetime} + +### EXTRACT {#operator-extract} + +``` sql +EXTRACT(part FROM date); +``` + +Extrae una parte de una fecha determinada. Por ejemplo, puede recuperar un mes a partir de una fecha determinada o un segundo a partir de una hora. + +El `part` parámetro especifica qué parte de la fecha se va a recuperar. Los siguientes valores están disponibles: + +- `DAY` — The day of the month. Possible values: 1–31. +- `MONTH` — The number of a month. Possible values: 1–12. +- `YEAR` — The year. +- `SECOND` — The second. Possible values: 0–59. +- `MINUTE` — The minute. Possible values: 0–59. +- `HOUR` — The hour. Possible values: 0–23. + +El `part` El parámetro no distingue entre mayúsculas y minúsculas. + +El `date` parámetro especifica la fecha o la hora a procesar. Bien [Fecha](../sql-reference/data-types/date.md) o [FechaHora](../sql-reference/data-types/datetime.md) tipo es compatible. + +Ejemplos: + +``` sql +SELECT EXTRACT(DAY FROM toDate('2017-06-15')); +SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); +SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); +``` + +En el siguiente ejemplo creamos una tabla e insertamos en ella un valor con el `DateTime` tipo. + +``` sql +CREATE TABLE test.Orders +( + OrderId UInt64, + OrderName String, + OrderDate DateTime +) +ENGINE = Log; +``` + +``` sql +INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); +``` + +``` sql +SELECT + toYear(OrderDate) AS OrderYear, + toMonth(OrderDate) AS OrderMonth, + toDayOfMonth(OrderDate) AS OrderDay, + toHour(OrderDate) AS OrderHour, + toMinute(OrderDate) AS OrderMinute, + toSecond(OrderDate) AS OrderSecond +FROM test.Orders; +``` + +``` text +┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ +│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ +└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ +``` + +Puedes ver más ejemplos en [prueba](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). + +### INTERVAL {#operator-interval} + +Crea un [Intervalo](../sql-reference/data-types/special-data-types/interval.md)-type valor que debe utilizarse en operaciones aritméticas con [Fecha](../sql-reference/data-types/date.md) y [FechaHora](../sql-reference/data-types/datetime.md)-type valores. + +Tipos de intervalos: +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +!!! warning "Advertencia" + Los intervalos con diferentes tipos no se pueden combinar. No puedes usar expresiones como `INTERVAL 4 DAY 1 HOUR`. Exprese los intervalos en unidades que son más pequeñas o iguales a la unidad más pequeña del intervalo, por ejemplo `INTERVAL 25 HOUR`. Puede usar operaciones consequtive como en el siguiente ejemplo. + +Ejemplo: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +**Ver también** + +- [Intervalo](../sql-reference/data-types/special-data-types/interval.md) tipo de datos +- [ToInterval](../sql-reference/functions/type-conversion-functions.md#function-tointerval) funciones de conversión de tipo + +## Operador De Negación Lógica {#logical-negation-operator} + +`NOT a` – The `not(a)` función. + +## Operador lógico and {#logical-and-operator} + +`a AND b` – The`and(a, b)` función. + +## Operador lógico or {#logical-or-operator} + +`a OR b` – The `or(a, b)` función. + +## Operador Condicional {#conditional-operator} + +`a ? b : c` – The `if(a, b, c)` función. + +Nota: + +El operador condicional calcula los valores de b y c, luego verifica si se cumple la condición a y luego devuelve el valor correspondiente. Si `b` o `C` es una [arrayJoin()](../sql-reference/functions/array-join.md#functions_arrayjoin) función, cada fila se replicará independientemente de la “a” condición. + +## Expresión Condicional {#operator_case} + +``` sql +CASE [x] + WHEN a THEN b + [WHEN ... THEN ...] + [ELSE c] +END +``` + +Si `x` se especifica, entonces `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. + +Si no hay `ELSE c` cláusula en la expresión, el valor predeterminado es `NULL`. + +El `transform` no funciona con `NULL`. + +## Operador De Concatenación {#concatenation-operator} + +`s1 || s2` – The `concat(s1, s2) function.` + +## Operador De Creación Lambda {#lambda-creation-operator} + +`x -> expr` – The `lambda(x, expr) function.` + +Los siguientes operadores no tienen prioridad, ya que son corchetes: + +## Operador De creación De Matrices {#array-creation-operator} + +`[x1, ...]` – The `array(x1, ...) function.` + +## Operador De creación De Tupla {#tuple-creation-operator} + +`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` + +## Asociatividad {#associativity} + +Todos los operadores binarios han dejado asociatividad. Por ejemplo, `1 + 2 + 3` se transforma a `plus(plus(1, 2), 3)`. +A veces esto no funciona de la manera que esperas. Por ejemplo, `SELECT 4 > 2 > 3` resultará en 0. + +Para la eficiencia, el `and` y `or` funciones aceptan cualquier número de argumentos. Las cadenas correspondientes de `AND` y `OR` operadores se transforman en una sola llamada de estas funciones. + +## Comprobación De `NULL` {#checking-for-null} + +ClickHouse soporta el `IS NULL` y `IS NOT NULL` a los operadores. + +### IS NULL {#operator-is-null} + +- Para [NULL](../sql-reference/data-types/nullable.md) valores de tipo, el `IS NULL` operador devuelve: + - `1` si el valor es `NULL`. + - `0` de lo contrario. +- Para otros valores, el `IS NULL` operador siempre devuelve `0`. + + + +``` sql +SELECT x+100 FROM t_null WHERE y IS NULL +``` + +``` text +┌─plus(x, 100)─┐ +│ 101 │ +└──────────────┘ +``` + +### IS NOT NULL {#is-not-null} + +- Para [NULL](../sql-reference/data-types/nullable.md) valores de tipo, el `IS NOT NULL` operador devuelve: + - `0` si el valor es `NULL`. + - `1` de lo contrario. +- Para otros valores, el `IS NOT NULL` operador siempre devuelve `1`. + + + +``` sql +SELECT * FROM t_null WHERE y IS NOT NULL +``` + +``` text +┌─x─┬─y─┐ +│ 2 │ 3 │ +└───┴───┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/es/sql-reference/statements/alter.md b/docs/es/sql-reference/statements/alter.md new file mode 100644 index 00000000000..d8455692189 --- /dev/null +++ b/docs/es/sql-reference/statements/alter.md @@ -0,0 +1,505 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 36 +toc_title: ALTER +--- + +## ALTER {#query_language_queries_alter} + +El `ALTER` consulta sólo se admite para `*MergeTree` mesas, así como `Merge`y`Distributed`. La consulta tiene varias variaciones. + +### Manipulaciones De Columna {#column-manipulations} + +Cambiar la estructura de la tabla. + +``` sql +ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... +``` + +En la consulta, especifique una lista de una o más acciones separadas por comas. +Cada acción es una operación en una columna. + +Se admiten las siguientes acciones: + +- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. +- [DROP COLUMN](#alter_drop-column) — Deletes the column. +- [CLEAR COLUMN](#alter_clear-column) — Resets column values. +- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. +- [MODIFY COLUMN](#alter_modify-column) — Changes column’s type, default expression and TTL. + +Estas acciones se describen en detalle a continuación. + +#### ADD COLUMN {#alter_add-column} + +``` sql +ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] +``` + +Agrega una nueva columna a la tabla con el `name`, `type`, [`codec`](create.md#codecs) y `default_expr` (ver la sección [Expresiones predeterminadas](create.md#create-default-values)). + +Si el `IF NOT EXISTS` cláusula, la consulta no devolverá un error si la columna ya existe. Si especifica `AFTER name_after` (el nombre de otra columna), la columna se agrega después de la especificada en la lista de columnas de tabla. De lo contrario, la columna se agrega al final de la tabla. Tenga en cuenta que no hay forma de agregar una columna al principio de una tabla. Para una cadena de acciones, `name_after` puede ser el nombre de una columna que se agrega en una de las acciones anteriores. + +Agregar una columna solo cambia la estructura de la tabla, sin realizar ninguna acción con datos. Los datos no aparecen en el disco después de `ALTER`. Si faltan los datos para una columna al leer de la tabla, se rellena con valores predeterminados (realizando la expresión predeterminada si hay una, o usando ceros o cadenas vacías). La columna aparece en el disco después de fusionar partes de datos (consulte [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md)). + +Este enfoque nos permite completar el `ALTER` consulta al instante, sin aumentar el volumen de datos antiguos. + +Ejemplo: + +``` sql +ALTER TABLE visits ADD COLUMN browser String AFTER user_id +``` + +#### DROP COLUMN {#alter_drop-column} + +``` sql +DROP COLUMN [IF EXISTS] name +``` + +Elimina la columna con el nombre `name`. Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. + +Elimina datos del sistema de archivos. Dado que esto elimina archivos completos, la consulta se completa casi al instante. + +Ejemplo: + +``` sql +ALTER TABLE visits DROP COLUMN browser +``` + +#### CLEAR COLUMN {#alter_clear-column} + +``` sql +CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name +``` + +Restablece todos los datos de una columna para una partición especificada. Obtenga más información sobre cómo configurar el nombre de la partición en la sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). + +Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. + +Ejemplo: + +``` sql +ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() +``` + +#### COMMENT COLUMN {#alter_comment-column} + +``` sql +COMMENT COLUMN [IF EXISTS] name 'comment' +``` + +Agrega un comentario a la columna. Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. + +Cada columna puede tener un comentario. Si ya existe un comentario para la columna, un nuevo comentario sobrescribe el comentario anterior. + +Los comentarios se almacenan en el `comment_expression` columna devuelta por el [DESCRIBE TABLE](misc.md#misc-describe-table) consulta. + +Ejemplo: + +``` sql +ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' +``` + +#### MODIFY COLUMN {#alter_modify-column} + +``` sql +MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] +``` + +Esta consulta cambia el `name` propiedades de la columna: + +- Tipo + +- Expresión predeterminada + +- TTL + + For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). + +Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. + +Al cambiar el tipo, los valores se convierten como si [ToType](../../sql-reference/functions/type-conversion-functions.md) se les aplicaron funciones. Si solo se cambia la expresión predeterminada, la consulta no hace nada complejo y se completa casi al instante. + +Ejemplo: + +``` sql +ALTER TABLE visits MODIFY COLUMN browser Array(String) +``` + +Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. + +Hay varias etapas de procesamiento: + +- Preparación de archivos temporales (nuevos) con datos modificados. +- Cambiar el nombre de los archivos antiguos. +- Cambiar el nombre de los archivos temporales (nuevos) a los nombres antiguos. +- Eliminar los archivos antiguos. + +Solo la primera etapa lleva tiempo. Si hay un error en esta etapa, los datos no se cambian. +Si hay un error durante una de las etapas sucesivas, los datos se pueden restaurar manualmente. La excepción es si los archivos antiguos se eliminaron del sistema de archivos, pero los datos de los nuevos archivos no se escribieron en el disco y se perdieron. + +El `ALTER` se replica la consulta para cambiar columnas. Las instrucciones se guardan en ZooKeeper, luego cada réplica las aplica. Todo `ALTER` las consultas se ejecutan en el mismo orden. La consulta espera a que se completen las acciones adecuadas en las otras réplicas. Sin embargo, una consulta para cambiar columnas en una tabla replicada se puede interrumpir y todas las acciones se realizarán de forma asincrónica. + +#### Limitaciones De Consulta ALTER {#alter-query-limitations} + +El `ALTER` query le permite crear y eliminar elementos separados (columnas) en estructuras de datos anidadas, pero no en estructuras de datos anidadas completas. Para agregar una estructura de datos anidada, puede agregar columnas con un nombre como `name.nested_name` y el tipo `Array(T)`. Una estructura de datos anidada es equivalente a varias columnas de matriz con un nombre que tiene el mismo prefijo antes del punto. + +No hay soporte para eliminar columnas en la clave principal o la clave de muestreo (columnas que se utilizan en el `ENGINE` expresion). Solo es posible cambiar el tipo de las columnas que se incluyen en la clave principal si este cambio no provoca que se modifiquen los datos (por ejemplo, puede agregar valores a un Enum o cambiar un tipo de `DateTime` a `UInt32`). + +Si el `ALTER` la consulta no es suficiente para realizar los cambios en la tabla que necesita, puede crear una nueva tabla, copiar los datos [INSERT SELECT](insert-into.md#insert_query_insert-select) consulta, luego cambie las tablas usando el [RENAME](misc.md#misc_operations-rename) consulta y elimina la tabla anterior. Puede usar el [Método de codificación de datos:](../../operations/utilities/clickhouse-copier.md) como una alternativa a la `INSERT SELECT` consulta. + +El `ALTER` query bloquea todas las lecturas y escrituras para la tabla. En otras palabras, si un largo `SELECT` se está ejecutando en el momento de la `ALTER` consulta, el `ALTER` la consulta esperará a que se complete. Al mismo tiempo, todas las consultas nuevas a la misma tabla esperarán `ALTER` se está ejecutando. + +Para tablas que no almacenan datos por sí mismas (como `Merge` y `Distributed`), `ALTER` simplemente cambia la estructura de la tabla, y no cambia la estructura de las tablas subordinadas. Por ejemplo, cuando se ejecuta ALTER para un `Distributed` mesa, también tendrá que ejecutar `ALTER` para las tablas en todos los servidores remotos. + +### Manipulaciones Con Expresiones Clave {#manipulations-with-key-expressions} + +Se admite el siguiente comando: + +``` sql +MODIFY ORDER BY new_expression +``` + +Solo funciona para tablas en el [`MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) familia (incluyendo +[repetición](../../engines/table-engines/mergetree-family/replication.md) tabla). El comando cambia el +[clave de clasificación](../../engines/table-engines/mergetree-family/mergetree.md) de la mesa +a `new_expression` (una expresión o una tupla de expresiones). La clave principal sigue siendo la misma. + +El comando es liviano en el sentido de que solo cambia los metadatos. Para mantener la propiedad esa parte de datos +las filas están ordenadas por la expresión de clave de ordenación, no puede agregar expresiones que contengan columnas existentes +a la clave de ordenación (sólo las columnas añadidas `ADD COLUMN` comando en el mismo `ALTER` consulta). + +### Manipulaciones Con índices De Saltos De Datos {#manipulations-with-data-skipping-indices} + +Solo funciona para tablas en el [`*MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) familia (incluyendo +[repetición](../../engines/table-engines/mergetree-family/replication.md) tabla). Las siguientes operaciones +están disponibles: + +- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - Agrega la descripción del índice a los metadatos de las tablas. + +- `ALTER TABLE [db].name DROP INDEX name` - Elimina la descripción del índice de los metadatos de las tablas y elimina los archivos de índice del disco. + +Estos comandos son livianos en el sentido de que solo cambian los metadatos o eliminan archivos. +Además, se replican (sincronizando metadatos de índices a través de ZooKeeper). + +### Manipulaciones Con Restricciones {#manipulations-with-constraints} + +Ver más en [limitación](create.md#constraints) + +Las restricciones se pueden agregar o eliminar utilizando la siguiente sintaxis: + +``` sql +ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; +ALTER TABLE [db].name DROP CONSTRAINT constraint_name; +``` + +Las consultas agregarán o eliminarán metadatos sobre restricciones de la tabla para que se procesen inmediatamente. + +Comprobación de restricciones *no se ejecutará* en los datos existentes si se agregaron. + +Todos los cambios en las tablas replicadas se transmiten a ZooKeeper, por lo que se aplicarán en otras réplicas. + +### Manipulaciones Con Particiones y Piezas {#alter_manipulations-with-partitions} + +Las siguientes operaciones con [partición](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) están disponibles: + +- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` directorio y olvidarlo. +- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. +- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` directorio a la tabla. +- [REPLACE PARTITION](#alter_replace-partition) - Copia la partición de datos de una tabla a otra. +- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. +- [REPLACE PARTITION](#alter_replace-partition) - Copia la partición de datos de una tabla a otra y reemplaza. +- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - Mover la partición de datos de una tabla a otra. +- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - Restablece el valor de una columna especificada en una partición. +- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - Restablece el índice secundario especificado en una partición. +- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. +- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. +- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. + + + +#### DETACH PARTITION {\#alter\_detach-partition} {#detach-partition-alter-detach-partition} + +``` sql +ALTER TABLE table_name DETACH PARTITION partition_expr +``` + +Mueve todos los datos de la partición especificada `detached` directorio. El servidor se olvida de la partición de datos separada como si no existiera. El servidor no sabrá acerca de estos datos hasta que [ATTACH](#alter_attach-partition) consulta. + +Ejemplo: + +``` sql +ALTER TABLE visits DETACH PARTITION 201901 +``` + +Lea cómo configurar la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). + +Después de ejecutar la consulta, puede hacer lo que quiera con los datos en el `detached` directory — delete it from the file system, or just leave it. + +This query is replicated – it moves the data to the `detached` directorio en todas las réplicas. Tenga en cuenta que solo puede ejecutar esta consulta en una réplica de líder. Para averiguar si una réplica es un líder, realice `SELECT` consulta a la [sistema.Replica](../../operations/system-tables.md#system_tables-replicas) tabla. Alternativamente, es más fácil hacer un `DETACH` consulta en todas las réplicas: todas las réplicas producen una excepción, excepto la réplica líder. + +#### DROP PARTITION {#alter_drop-partition} + +``` sql +ALTER TABLE table_name DROP PARTITION partition_expr +``` + +Elimina la partición especificada de la tabla. Esta consulta etiqueta la partición como inactiva y elimina los datos por completo, aproximadamente en 10 minutos. + +Lea cómo configurar la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). + +The query is replicated – it deletes data on all replicas. + +#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} + +``` sql +ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr +``` + +Quita la parte especificada o todas las partes de la partición especificada de `detached`. +Más información sobre cómo establecer la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). + +#### ATTACH PARTITION\|PART {#alter_attach-partition} + +``` sql +ALTER TABLE table_name ATTACH PARTITION|PART partition_expr +``` + +Agrega datos a la tabla desde el `detached` directorio. Es posible agregar datos para una partición completa o para una parte separada. Ejemplos: + +``` sql +ALTER TABLE visits ATTACH PARTITION 201901; +ALTER TABLE visits ATTACH PART 201901_2_2_0; +``` + +Más información sobre cómo establecer la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). + +Esta consulta se replica. El iniciador de réplica comprueba si hay datos en el `detached` directorio. Si existen datos, la consulta comprueba su integridad. Si todo es correcto, la consulta agrega los datos a la tabla. Todas las demás réplicas descargan los datos del iniciador de réplica. + +Entonces puedes poner datos en el `detached` en una réplica, y utilice el directorio `ALTER ... ATTACH` consulta para agregarlo a la tabla en todas las réplicas. + +#### ATTACH PARTITION FROM {#alter_attach-partition-from} + +``` sql +ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 +``` + +Esta consulta copia la partición de datos `table1` a `table2` añade datos a los que existen en el `table2`. Tenga en cuenta que los datos no se eliminarán de `table1`. + +Para que la consulta se ejecute correctamente, se deben cumplir las siguientes condiciones: + +- Ambas tablas deben tener la misma estructura. +- Ambas tablas deben tener la misma clave de partición. + +#### REPLACE PARTITION {#alter_replace-partition} + +``` sql +ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 +``` + +Esta consulta copia la partición de datos `table1` a `table2` y reemplaza la partición existente en el `table2`. Tenga en cuenta que los datos no se eliminarán de `table1`. + +Para que la consulta se ejecute correctamente, se deben cumplir las siguientes condiciones: + +- Ambas tablas deben tener la misma estructura. +- Ambas tablas deben tener la misma clave de partición. + +#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} + +``` sql +ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest +``` + +Esta consulta mueve la partición de datos `table_source` a `table_dest` con la eliminación de los datos de `table_source`. + +Para que la consulta se ejecute correctamente, se deben cumplir las siguientes condiciones: + +- Ambas tablas deben tener la misma estructura. +- Ambas tablas deben tener la misma clave de partición. +- Ambas tablas deben ser de la misma familia de motores. (replicado o no replicado) +- Ambas tablas deben tener la misma política de almacenamiento. + +#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} + +``` sql +ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr +``` + +Restablece todos los valores de la columna especificada en una partición. Si el `DEFAULT` cláusula se determinó al crear una tabla, esta consulta establece el valor de columna en un valor predeterminado especificado. + +Ejemplo: + +``` sql +ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 +``` + +#### FREEZE PARTITION {#alter_freeze-partition} + +``` sql +ALTER TABLE table_name FREEZE [PARTITION partition_expr] +``` + +Esta consulta crea una copia de seguridad local de una partición especificada. Si el `PARTITION` se omite la cláusula, la consulta crea la copia de seguridad de todas las particiones a la vez. + +!!! note "Nota" + Todo el proceso de copia de seguridad se realiza sin detener el servidor. + +Tenga en cuenta que para las tablas de estilo antiguo puede especificar el prefijo del nombre de la partición (por ejemplo, ‘2019’) - entonces la consulta crea la copia de seguridad para todas las particiones correspondientes. Lea cómo configurar la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). + +En el momento de la ejecución, para una instantánea de datos, la consulta crea vínculos rígidos a los datos de una tabla. Los enlaces duros se colocan en el directorio `/var/lib/clickhouse/shadow/N/...`, donde: + +- `/var/lib/clickhouse/` es el directorio ClickHouse de trabajo especificado en la configuración. +- `N` es el número incremental de la copia de seguridad. + +!!! note "Nota" + Si usted usa [un conjunto de discos para el almacenamiento de datos en una tabla](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes), el `shadow/N` directorio aparece en cada disco, almacenando partes de datos que coinciden con el `PARTITION` expresion. + +La misma estructura de directorios se crea dentro de la copia de seguridad que dentro `/var/lib/clickhouse/`. La consulta realiza ‘chmod’ para todos los archivos, prohibiendo escribir en ellos. + +Después de crear la copia de seguridad, puede copiar los datos desde `/var/lib/clickhouse/shadow/` al servidor remoto y, a continuación, elimínelo del servidor local. Tenga en cuenta que el `ALTER t FREEZE PARTITION` consulta no se replica. Crea una copia de seguridad local solo en el servidor local. + +La consulta crea una copia de seguridad casi instantáneamente (pero primero espera a que las consultas actuales a la tabla correspondiente terminen de ejecutarse). + +`ALTER TABLE t FREEZE PARTITION` copia solo los datos, no los metadatos de la tabla. Para hacer una copia de seguridad de los metadatos de la tabla, copie el archivo `/var/lib/clickhouse/metadata/database/table.sql` + +Para restaurar los datos de una copia de seguridad, haga lo siguiente: + +1. Crear la tabla si no existe. Para ver la consulta, utilice el .archivo sql (reemplazar `ATTACH` en ella con `CREATE`). +2. Copie los datos de la `data/database/table/` directorio dentro de la copia de seguridad a la `/var/lib/clickhouse/data/database/table/detached/` directorio. +3. Ejecutar `ALTER TABLE t ATTACH PARTITION` consultas para agregar los datos a una tabla. + +La restauración desde una copia de seguridad no requiere detener el servidor. + +Para obtener más información sobre las copias de seguridad y la restauración de datos, consulte [Copia de seguridad de datos](../../operations/backup.md) apartado. + +#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} + +``` sql +ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr +``` + +La consulta funciona de forma similar a `CLEAR COLUMN`, pero restablece un índice en lugar de una columna de datos. + +#### FETCH PARTITION {#alter_fetch-partition} + +``` sql +ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' +``` + +Descarga una partición desde otro servidor. Esta consulta solo funciona para las tablas replicadas. + +La consulta hace lo siguiente: + +1. Descarga la partición del fragmento especificado. En ‘path-in-zookeeper’ debe especificar una ruta al fragmento en ZooKeeper. +2. Luego, la consulta coloca los datos descargados en el `detached` directorio de la `table_name` tabla. Utilice el [ATTACH PARTITION\|PART](#alter_attach-partition) consulta para agregar los datos a la tabla. + +Por ejemplo: + +``` sql +ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; +ALTER TABLE users ATTACH PARTITION 201902; +``` + +Tenga en cuenta que: + +- El `ALTER ... FETCH PARTITION` consulta no se replica. Coloca la partición en el `detached` sólo en el servidor local. +- El `ALTER TABLE ... ATTACH` la consulta se replica. Agrega los datos a todas las réplicas. Los datos se agregan a una de las réplicas de la `detached` directorio, y para los demás - de réplicas vecinas. + +Antes de descargar, el sistema verifica si la partición existe y la estructura de la tabla coincide. La réplica más adecuada se selecciona automáticamente de las réplicas en buen estado. + +Aunque se llama a la consulta `ALTER TABLE`, no cambia la estructura de la tabla y no cambiar inmediatamente los datos disponibles en la tabla. + +#### MOVE PARTITION\|PART {#alter_move-partition} + +Mueve particiones o partes de datos a otro volumen o disco para `MergeTree`-mesas de motor. Ver [Uso de varios dispositivos de bloque para el almacenamiento de datos](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes). + +``` sql +ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' +``` + +El `ALTER TABLE t MOVE` consulta: + +- No replicado, porque diferentes réplicas pueden tener diferentes directivas de almacenamiento. +- Devuelve un error si el disco o volumen especificado no está configurado. La consulta también devuelve un error si no se pueden aplicar las condiciones de movimiento de datos especificadas en la directiva de almacenamiento. +- Puede devolver un error en el caso, cuando los datos que se moverán ya se mueven por un proceso en segundo plano, concurrente `ALTER TABLE t MOVE` consulta o como resultado de la fusión de datos de fondo. Un usuario no debe realizar ninguna acción adicional en este caso. + +Ejemplo: + +``` sql +ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' +ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' +``` + +#### Cómo Establecer La expresión De partición {#alter-how-to-specify-part-expr} + +Puede especificar la expresión de partición en `ALTER ... PARTITION` de diferentes maneras: + +- Como valor de la `partition` columna de la `system.parts` tabla. Por ejemplo, `ALTER TABLE visits DETACH PARTITION 201901`. +- Como la expresión de la columna de la tabla. Se admiten constantes y expresiones constantes. Por ejemplo, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. +- Usando el ID de partición. El ID de partición es un identificador de cadena de la partición (legible por humanos, si es posible) que se usa como nombres de particiones en el sistema de archivos y en ZooKeeper. El ID de partición debe especificarse en el `PARTITION ID` cláusula, entre comillas simples. Por ejemplo, `ALTER TABLE visits DETACH PARTITION ID '201901'`. +- En el [ALTER ATTACH PART](#alter_attach-partition) y [DROP DETACHED PART](#alter_drop-detached) consulta, para especificar el nombre de una parte, utilice un literal de cadena con un valor `name` columna de la [sistema.detached\_parts](../../operations/system-tables.md#system_tables-detached_parts) tabla. Por ejemplo, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. + +El uso de comillas al especificar la partición depende del tipo de expresión de partición. Por ejemplo, para el `String` tipo, debe especificar su nombre entre comillas (`'`). Para el `Date` y `Int*` tipos no se necesitan comillas. + +Para las tablas de estilo antiguo, puede especificar la partición como un número `201901` o una cadena `'201901'`. La sintaxis para las tablas de nuevo estilo es más estricta con los tipos (similar al analizador para el formato de entrada VALUES). + +Todas las reglas anteriores también son ciertas para el [OPTIMIZE](misc.md#misc_operations-optimize) consulta. Si necesita especificar la única partición al optimizar una tabla no particionada, establezca la expresión `PARTITION tuple()`. Por ejemplo: + +``` sql +OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; +``` + +Los ejemplos de `ALTER ... PARTITION` las consultas se demuestran en las pruebas [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) y [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). + +### Manipulaciones Con Tabla TTL {#manipulations-with-table-ttl} + +Usted puede cambiar [tabla TTL](../../engines/table-engines/mergetree-family/mergetree.md#mergetree-table-ttl) con una solicitud del siguiente formulario: + +``` sql +ALTER TABLE table-name MODIFY TTL ttl-expression +``` + +### Sincronicidad De Consultas ALTER {#synchronicity-of-alter-queries} + +Para tablas no replicables, todas `ALTER` las consultas se realizan de forma sincrónica. Para las tablas replicables, la consulta solo agrega instrucciones para las acciones apropiadas para `ZooKeeper`, y las acciones mismas se realizan tan pronto como sea posible. Sin embargo, la consulta puede esperar a que estas acciones se completen en todas las réplicas. + +Para `ALTER ... ATTACH|DETACH|DROP` consultas, puede utilizar el `replication_alter_partitions_sync` configuración para configurar la espera. +Valores posibles: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. + +### Mutación {#alter-mutations} + +Las mutaciones son una variante de consulta ALTER que permite cambiar o eliminar filas en una tabla. En contraste con el estándar `UPDATE` y `DELETE` consultas destinadas a cambios de datos puntuales, las mutaciones están destinadas a operaciones pesadas que cambian muchas filas en una tabla. Apoyado para el `MergeTree` familia de motores de mesa, incluidos los motores con soporte de replicación. + +Las tablas existentes están listas para las mutaciones tal como están (no es necesaria la conversión), pero después de que la primera mutación se aplica a una tabla, su formato de metadatos se vuelve incompatible con las versiones anteriores del servidor y volver a una versión anterior se vuelve imposible. + +Comandos disponibles actualmente: + +``` sql +ALTER TABLE [db.]table DELETE WHERE filter_expr +``` + +El `filter_expr` debe ser de tipo `UInt8`. La consulta elimina las filas de la tabla para la que esta expresión toma un valor distinto de cero. + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr +``` + +El `filter_expr` debe ser de tipo `UInt8`. Esta consulta actualiza los valores de las columnas especificadas a los valores de las expresiones correspondientes `filter_expr` toma un valor distinto de cero. Los valores se convierten al tipo de columna utilizando el `CAST` operador. No se admite la actualización de columnas que se utilizan en el cálculo de la clave principal o de partición. + +``` sql +ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name +``` + +La consulta reconstruye el índice secundario `name` en la partición `partition_name`. + +Una consulta puede contener varios comandos separados por comas. + +Para las tablas \*MergeTree, las mutaciones se ejecutan reescribiendo partes de datos completas. No hay atomicidad - las partes se sustituyen por partes mutadas tan pronto como están listas y una `SELECT` La consulta que comenzó a ejecutarse durante una mutación verá datos de partes que ya han sido mutadas junto con datos de partes que aún no han sido mutadas. + +Las mutaciones están totalmente ordenadas por su orden de creación y se aplican a cada parte en ese orden. Las mutaciones también se ordenan parcialmente con INSERTs: los datos que se insertaron en la tabla antes de que se enviara la mutación se mutarán y los datos que se insertaron después de eso no se mutarán. Tenga en cuenta que las mutaciones no bloquean INSERTs de ninguna manera. + +Una consulta de mutación regresa inmediatamente después de agregar la entrada de mutación (en el caso de tablas replicadas a ZooKeeper, para tablas no replicadas, al sistema de archivos). La mutación en sí se ejecuta de forma asíncrona utilizando la configuración del perfil del sistema. Para realizar un seguimiento del progreso de las mutaciones, puede usar el [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) tabla. Una mutación que se envió correctamente continuará ejecutándose incluso si se reinician los servidores ClickHouse. No hay forma de revertir la mutación una vez que se presenta, pero si la mutación está atascada por alguna razón, puede cancelarse con el [`KILL MUTATION`](misc.md#kill-mutation) consulta. + +Las entradas de mutaciones terminadas no se eliminan de inmediato (el número de entradas conservadas viene determinado por el `finished_mutations_to_keep` parámetro del motor de almacenamiento). Las entradas de mutación más antiguas se eliminan. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/es/sql-reference/statements/create.md b/docs/es/sql-reference/statements/create.md new file mode 100644 index 00000000000..d682e045a90 --- /dev/null +++ b/docs/es/sql-reference/statements/create.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 35 +toc_title: CREATE +--- + +# CREATE Consultas {#create-queries} + +## CREATE DATABASE {#query-language-create-database} + +Crea una base de datos. + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] +``` + +### Clausula {#clauses} + +- `IF NOT EXISTS` + + If the `db_name` database already exists, then ClickHouse doesn't create a new database and: + + - Doesn't throw an exception if clause is specified. + - Throws an exception if clause isn't specified. + +- `ON CLUSTER` + + ClickHouse creates the `db_name` database on all the servers of a specified cluster. + +- `ENGINE` + + - [MySQL](../engines/database_engines/mysql.md) + + Allows you to retrieve data from the remote MySQL server. + + By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). + +## CREATE TABLE {#create-table-query} + +El `CREATE TABLE` consulta puede tener varias formas. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], + ... +) ENGINE = engine +``` + +Crea una tabla llamada ‘name’ en el ‘db’ base de datos o la base de datos actual si ‘db’ no está establecida, con la estructura especificada entre paréntesis y ‘engine’ motor. +La estructura de la tabla es una lista de descripciones de columnas. Si los índices son compatibles con el motor, se indican como parámetros para el motor de tablas. + +Una descripción de columna es `name type` en el caso más simple. Ejemplo: `RegionID UInt32`. +Las expresiones también se pueden definir para los valores predeterminados (ver más abajo). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] +``` + +Crea una tabla con la misma estructura que otra tabla. Puede especificar un motor diferente para la tabla. Si no se especifica el motor, se utilizará el mismo motor que para el `db2.name2` tabla. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() +``` + +Crea una tabla con la estructura y los datos [función de la tabla](../table-functions/index.md). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... +``` + +Crea una tabla con una estructura como el resultado de la `SELECT` consulta, con el ‘engine’ motor, y lo llena con datos de SELECT. + +En todos los casos, si `IF NOT EXISTS` se especifica, la consulta no devolverá un error si la tabla ya existe. En este caso, la consulta no hará nada. + +Puede haber otras cláusulas después del `ENGINE` cláusula en la consulta. Consulte la documentación detallada sobre cómo crear tablas en las descripciones de [motores de mesa](../../engines/table-engines/index.md#table_engines). + +### Valores Predeterminados {#create-default-values} + +La descripción de la columna puede especificar una expresión para un valor predeterminado, de una de las siguientes maneras:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. +Ejemplo: `URLDomain String DEFAULT domain(URL)`. + +Si no se define una expresión para el valor predeterminado, los valores predeterminados se establecerán en ceros para números, cadenas vacías para cadenas, matrices vacías para matrices y `0000-00-00` para fechas o `0000-00-00 00:00:00` para las fechas con el tiempo. Los NULL no son compatibles. + +Si se define la expresión predeterminada, el tipo de columna es opcional. Si no hay un tipo definido explícitamente, se utiliza el tipo de expresión predeterminado. Ejemplo: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ tipo será utilizado para el ‘EventDate’ columna. + +Si el tipo de datos y la expresión predeterminada se definen explícitamente, esta expresión se convertirá al tipo especificado utilizando funciones de conversión de tipos. Ejemplo: `Hits UInt32 DEFAULT 0` significa lo mismo que `Hits UInt32 DEFAULT toUInt32(0)`. + +Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don’t contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. + +`DEFAULT expr` + +Valor predeterminado Normal. Si la consulta INSERT no especifica la columna correspondiente, se completará calculando la expresión correspondiente. + +`MATERIALIZED expr` + +Expresión materializada. Dicha columna no se puede especificar para INSERT, porque siempre se calcula. +Para un INSERT sin una lista de columnas, estas columnas no se consideran. +Además, esta columna no se sustituye cuando se utiliza un asterisco en una consulta SELECT. Esto es para preservar el invariante que el volcado obtuvo usando `SELECT *` se puede volver a insertar en la tabla usando INSERT sin especificar la lista de columnas. + +`ALIAS expr` + +Sinónimo. Tal columna no se almacena en la tabla en absoluto. +Sus valores no se pueden insertar en una tabla, y no se sustituye cuando se usa un asterisco en una consulta SELECT. +Se puede usar en SELECT si el alias se expande durante el análisis de consultas. + +Cuando se utiliza la consulta ALTER para agregar nuevas columnas, no se escriben datos antiguos para estas columnas. En su lugar, al leer datos antiguos que no tienen valores para las nuevas columnas, las expresiones se calculan sobre la marcha de forma predeterminada. Sin embargo, si la ejecución de las expresiones requiere diferentes columnas que no están indicadas en la consulta, estas columnas se leerán adicionalmente, pero solo para los bloques de datos que lo necesitan. + +Si agrega una nueva columna a una tabla pero luego cambia su expresión predeterminada, los valores utilizados para los datos antiguos cambiarán (para los datos donde los valores no se almacenaron en el disco). Tenga en cuenta que cuando se ejecutan combinaciones en segundo plano, los datos de las columnas que faltan en una de las partes de combinación se escriben en la parte combinada. + +No es posible establecer valores predeterminados para elementos en estructuras de datos anidadas. + +### Limitación {#constraints} + +Junto con las descripciones de columnas, se podrían definir restricciones: + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + ... + CONSTRAINT constraint_name_1 CHECK boolean_expr_1, + ... +) ENGINE = engine +``` + +`boolean_expr_1` podría por cualquier expresión booleana. Si se definen restricciones para la tabla, cada una de ellas se verificará para cada fila en `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. + +Agregar una gran cantidad de restricciones puede afectar negativamente el rendimiento de grandes `INSERT` consulta. + +### Expresión TTL {#ttl-expression} + +Define el tiempo de almacenamiento de los valores. Solo se puede especificar para tablas de la familia MergeTree. Para la descripción detallada, ver [TTL para columnas y tablas](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). + +### Códecs De compresión De Columna {#codecs} + +De forma predeterminada, ClickHouse aplica el `lz4` método de compresión. Para `MergeTree`- familia de motor puede cambiar el método de compresión predeterminado en el [compresión](../../operations/server-configuration-parameters/settings.md#server-settings-compression) sección de una configuración de servidor. También puede definir el método de compresión para cada columna `CREATE TABLE` consulta. + +``` sql +CREATE TABLE codec_example +( + dt Date CODEC(ZSTD), + ts DateTime CODEC(LZ4HC), + float_value Float32 CODEC(NONE), + double_value Float64 CODEC(LZ4HC(9)) + value Float32 CODEC(Delta, ZSTD) +) +ENGINE = +... +``` + +Si se especifica un códec, el códec predeterminado no se aplica. Los códecs se pueden combinar en una tubería, por ejemplo, `CODEC(Delta, ZSTD)`. Para seleccionar la mejor combinación de códecs para su proyecto, pase puntos de referencia similares a los descritos en Altinity [Nuevas codificaciones para mejorar la eficiencia de ClickHouse](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) artículo. + +!!! warning "Advertencia" + No puede descomprimir archivos de base de datos ClickHouse con utilidades externas como `lz4`. En su lugar, use el especial [Compresor de clickhouse](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) utilidad. + +La compresión es compatible con los siguientes motores de tablas: + +- [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md) familia. Admite códecs de compresión de columnas y selecciona el método de compresión predeterminado mediante [compresión](../../operations/server-configuration-parameters/settings.md#server-settings-compression) configuración. +- [Registro](../../engines/table-engines/log-family/log-family.md) familia. Utiliza el `lz4` método de compresión por defecto y soporta códecs de compresión de columna. +- [Establecer](../../engines/table-engines/special/set.md). Solo admite la compresión predeterminada. +- [Unir](../../engines/table-engines/special/join.md). Solo admite la compresión predeterminada. + +ClickHouse admite códecs de propósito común y códecs especializados. + +#### Especializados Codecs {#create-query-specialized-codecs} + +Estos códecs están diseñados para hacer que la compresión sea más efectiva mediante el uso de características específicas de los datos. Algunos de estos códecs no comprimen los datos por sí mismos. En su lugar, preparan los datos para un códec de propósito común, que lo comprime mejor que sin esta preparación. + +Especializados codecs: + +- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` se utilizan para almacenar valores delta, por lo que `delta_bytes` es el tamaño máximo de los valores brutos. Posible `delta_bytes` valores: 1, 2, 4, 8. El valor predeterminado para `delta_bytes` ser `sizeof(type)` si es igual a 1, 2, 4 u 8. En todos los demás casos, es 1. +- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorila: Una base de datos de series temporales rápida, escalable y en memoria](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorila: Una base de datos de series temporales rápida, escalable y en memoria](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` y `DateTime`). En cada paso de su algoritmo, el códec toma un bloque de 64 valores, los coloca en una matriz de 64x64 bits, lo transpone, recorta los bits de valores no utilizados y devuelve el resto como una secuencia. Los bits no utilizados son los bits, que no difieren entre los valores máximo y mínimo en toda la parte de datos para la que se utiliza la compresión. + +`DoubleDelta` y `Gorilla` códecs se utilizan en Gorilla TSDB como los componentes de su algoritmo de compresión. El enfoque de gorila es efectivo en escenarios en los que hay una secuencia de valores que cambian lentamente con sus marcas de tiempo. Las marcas de tiempo se comprimen efectivamente por el `DoubleDelta` códec, y los valores son efectivamente comprimidos por el `Gorilla` códec. Por ejemplo, para obtener una tabla almacenada efectivamente, puede crearla en la siguiente configuración: + +``` sql +CREATE TABLE codec_example +( + timestamp DateTime CODEC(DoubleDelta), + slow_values Float32 CODEC(Gorilla) +) +ENGINE = MergeTree() +``` + +#### Propósito Común Codecs {#create-query-common-purpose-codecs} + +Códecs: + +- `NONE` — No compression. +- `LZ4` — Lossless [algoritmo de compresión de datos](https://github.com/lz4/lz4) utilizado por defecto. Aplica compresión rápida LZ4. +- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` aplica el nivel predeterminado. Niveles posibles: \[1, 12\]. Rango de nivel recomendado: \[4, 9\]. +- `ZSTD[(level)]` — [Algoritmo de compresión ZSTD](https://en.wikipedia.org/wiki/Zstandard) con configurable `level`. Niveles posibles: \[1, 22\]. Valor predeterminado: 1. + +Los altos niveles de compresión son útiles para escenarios asimétricos, como comprimir una vez, descomprimir repetidamente. Los niveles más altos significan una mejor compresión y un mayor uso de la CPU. + +## Tablas Temporales {#temporary-tables} + +ClickHouse admite tablas temporales que tienen las siguientes características: + +- Las tablas temporales desaparecen cuando finaliza la sesión, incluso si se pierde la conexión. +- Una tabla temporal solo utiliza el motor de memoria. +- No se puede especificar la base de datos para una tabla temporal. Se crea fuera de las bases de datos. +- Imposible crear una tabla temporal con consulta DDL distribuida en todos los servidores de clúster (mediante `ON CLUSTER`): esta tabla sólo existe en la sesión actual. +- Si una tabla temporal tiene el mismo nombre que otra y una consulta especifica el nombre de la tabla sin especificar la base de datos, se utilizará la tabla temporal. +- Para el procesamiento de consultas distribuidas, las tablas temporales utilizadas en una consulta se pasan a servidores remotos. + +Para crear una tabla temporal, utilice la siguiente sintaxis: + +``` sql +CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) +``` + +En la mayoría de los casos, las tablas temporales no se crean manualmente, sino cuando se utilizan datos externos para una consulta o para `(GLOBAL) IN`. Para obtener más información, consulte las secciones correspondientes + +Es posible usar tablas con [MOTOR = Memoria](../../engines/table-engines/special/memory.md) en lugar de tablas temporales. + +## Consultas DDL Distribuidas (cláusula ON CLUSTER) {#distributed-ddl-queries-on-cluster-clause} + +El `CREATE`, `DROP`, `ALTER`, y `RENAME` las consultas admiten la ejecución distribuida en un clúster. +Por ejemplo, la siguiente consulta crea el `all_hits` `Distributed` la tabla en cada host `cluster`: + +``` sql +CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) +``` + +Para ejecutar estas consultas correctamente, cada host debe tener la misma definición de clúster (para simplificar la sincronización de configuraciones, puede usar sustituciones de ZooKeeper). También deben conectarse a los servidores ZooKeeper. +La versión local de la consulta finalmente se implementará en cada host del clúster, incluso si algunos hosts no están disponibles actualmente. El orden para ejecutar consultas dentro de un único host está garantizado. + +## CREATE VIEW {#create-view} + +``` sql +CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... +``` + +Crea una vista. Hay dos tipos de vistas: normal y MATERIALIZADO. + +Las vistas normales no almacenan ningún dato, solo realizan una lectura desde otra tabla. En otras palabras, una vista normal no es más que una consulta guardada. Al leer desde una vista, esta consulta guardada se utiliza como una subconsulta en la cláusula FROM. + +Como ejemplo, suponga que ha creado una vista: + +``` sql +CREATE VIEW view AS SELECT ... +``` + +y escribió una consulta: + +``` sql +SELECT a, b, c FROM view +``` + +Esta consulta es totalmente equivalente a usar la subconsulta: + +``` sql +SELECT a, b, c FROM (SELECT ...) +``` + +Las vistas materializadas almacenan datos transformados por la consulta SELECT correspondiente. + +Al crear una vista materializada sin `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. + +Al crear una vista materializada con `TO [db].[table]` usted no debe usar `POPULATE`. + +Una vista materializada se organiza de la siguiente manera: al insertar datos en la tabla especificada en SELECT, parte de los datos insertados se convierte mediante esta consulta SELECT y el resultado se inserta en la vista. + +Si especifica POPULATE, los datos de tabla existentes se insertan en la vista al crearlos, como si `CREATE TABLE ... AS SELECT ...` . De lo contrario, la consulta solo contiene los datos insertados en la tabla después de crear la vista. No recomendamos usar POPULATE, ya que los datos insertados en la tabla durante la creación de la vista no se insertarán en ella. + +A `SELECT` consulta puede contener `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` se establece, los datos se agregan durante la inserción, pero solo dentro de un solo paquete de datos insertados. Los datos no se agregarán más. La excepción es cuando se utiliza un ENGINE que realiza de forma independiente la agregación de datos, como `SummingMergeTree`. + +La ejecución de `ALTER` las consultas sobre vistas materializadas no se han desarrollado completamente, por lo que podrían ser inconvenientes. Si la vista materializada utiliza la construcción `TO [db.]name` puede `DETACH` la vista, ejecutar `ALTER` para la tabla de destino, y luego `ATTACH` el previamente separado (`DETACH`) vista. + +Las vistas tienen el mismo aspecto que las tablas normales. Por ejemplo, se enumeran en el resultado de la `SHOW TABLES` consulta. + +No hay una consulta separada para eliminar vistas. Para eliminar una vista, utilice `DROP TABLE`. + +## CREATE DICTIONARY {#create-dictionary-query} + +``` sql +CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] +( + key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + attr1 type2 [DEFAULT|EXPRESSION expr3], + attr2 type2 [DEFAULT|EXPRESSION expr4] +) +PRIMARY KEY key1, key2 +SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) +LAYOUT(LAYOUT_NAME([param_name param_value])) +LIFETIME([MIN val1] MAX val2) +``` + +Crear [diccionario externo](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) con dado [estructura](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md), [fuente](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md), [diseño](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) y [vida](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md). + +La estructura del diccionario externo consta de atributos. Los atributos de diccionario se especifican de manera similar a las columnas de la tabla. La única propiedad de atributo requerida es su tipo, todas las demás propiedades pueden tener valores predeterminados. + +Dependiendo del diccionario [diseño](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) se pueden especificar uno o más atributos como claves de diccionario. + +Para obtener más información, consulte [Diccionarios externos](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) apartado. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/es/sql_reference/statements/index.md b/docs/es/sql-reference/statements/index.md similarity index 100% rename from docs/es/sql_reference/statements/index.md rename to docs/es/sql-reference/statements/index.md diff --git a/docs/es/sql-reference/statements/insert-into.md b/docs/es/sql-reference/statements/insert-into.md new file mode 100644 index 00000000000..a5104667d52 --- /dev/null +++ b/docs/es/sql-reference/statements/insert-into.md @@ -0,0 +1,80 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 34 +toc_title: INSERT INTO +--- + +## INSERT {#insert} + +Adición de datos. + +Formato de consulta básico: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... +``` + +La consulta puede especificar una lista de columnas para insertar `[(c1, c2, c3)]`. En este caso, el resto de las columnas se llenan con: + +- Los valores calculados a partir del `DEFAULT` expresiones especificadas en la definición de la tabla. +- Ceros y cadenas vacías, si `DEFAULT` expresiones no están definidas. + +Si [strict\_insert\_defaults=1](../../operations/settings/settings.md), columnas que no tienen `DEFAULT` definido debe figurar en la consulta. + +Los datos se pueden pasar al INSERT en cualquier [formato](../../interfaces/formats.md#formats) con el apoyo de ClickHouse. El formato debe especificarse explícitamente en la consulta: + +``` sql +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: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... +``` + +ClickHouse elimina todos los espacios y un avance de línea (si hay uno) antes de los datos. Al formar una consulta, recomendamos colocar los datos en una nueva línea después de los operadores de consulta (esto es importante si los datos comienzan con espacios). + +Ejemplo: + +``` sql +INSERT INTO t FORMAT TabSeparated +11 Hello, world! +22 Qwerty +``` + +Puede insertar datos por separado de la consulta mediante el cliente de línea de comandos o la interfaz HTTP. Para obtener más información, consulte la sección “[Interfaz](../../interfaces/index.md#interfaces)”. + +### Limitación {#constraints} + +Si la tabla tiene [limitación](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. + +### Insertar Los Resultados De `SELECT` {#insert_query_insert-select} + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... +``` + +Las columnas se asignan de acuerdo con su posición en la cláusula SELECT. Sin embargo, sus nombres en la expresión SELECT y la tabla para INSERT pueden diferir. Si es necesario, se realiza la fundición de tipo. + +Ninguno de los formatos de datos, excepto Valores, permite establecer valores para expresiones como `now()`, `1 + 2` y así sucesivamente. El formato Values permite el uso limitado de expresiones, pero esto no se recomienda, porque en este caso se usa código ineficiente para su ejecución. + +No se admiten otras consultas para modificar partes de datos: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. +Sin embargo, puede eliminar datos antiguos usando `ALTER TABLE ... DROP PARTITION`. + +`FORMAT` cláusula debe especificarse al final de la consulta si `SELECT` cláusula contiene la función de tabla [entrada()](../table-functions/input.md). + +### Consideraciones De Rendimiento {#performance-considerations} + +`INSERT` ordena los datos de entrada por clave principal y los divide en particiones por una clave de partición. Si inserta datos en varias particiones a la vez, puede reducir significativamente el rendimiento del `INSERT` consulta. Para evitar esto: + +- Agregue datos en lotes bastante grandes, como 100.000 filas a la vez. +- Agrupe los datos por una clave de partición antes de cargarlos en ClickHouse. + +El rendimiento no disminuirá si: + +- Se agregan datos en tiempo real. +- Cargar los datos que generalmente se ordenan por el tiempo. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/es/sql-reference/statements/misc.md b/docs/es/sql-reference/statements/misc.md new file mode 100644 index 00000000000..9ed83b4d874 --- /dev/null +++ b/docs/es/sql-reference/statements/misc.md @@ -0,0 +1,252 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 39 +toc_title: Otro +--- + +# Consultas Misceláneas {#miscellaneous-queries} + +## ATTACH {#attach} + +Esta consulta es exactamente la misma que `CREATE`, pero + +- En lugar de la palabra `CREATE` utiliza la palabra `ATTACH`. +- La consulta no crea datos en el disco, pero supone que los datos ya están en los lugares apropiados, y simplemente agrega información sobre la tabla al servidor. + Después de ejecutar una consulta ATTACH, el servidor sabrá sobre la existencia de la tabla. + +Si la tabla se separó previamente (`DETACH`), lo que significa que su estructura es conocida, puede usar taquigrafía sin definir la estructura. + +``` sql +ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Esta consulta se utiliza al iniciar el servidor. El servidor almacena los metadatos de la tabla como archivos con `ATTACH` consultas, que simplemente se ejecuta en el lanzamiento (con la excepción de las tablas del sistema, que se crean explícitamente en el servidor). + +## CHECK TABLE {#check-table} + +Comprueba si los datos de la tabla están dañados. + +``` sql +CHECK TABLE [db.]name +``` + +El `CHECK TABLE` query compara los tamaños de archivo reales con los valores esperados que se almacenan en el servidor. Si los tamaños de archivo no coinciden con los valores almacenados, significa que los datos están dañados. Esto puede deberse, por ejemplo, a un bloqueo del sistema durante la ejecución de la consulta. + +La respuesta de consulta contiene el `result` columna con una sola fila. La fila tiene un valor de +[Booleana](../../sql-reference/data-types/boolean.md) tipo: + +- 0 - Los datos de la tabla están dañados. +- 1 - Los datos mantienen la integridad. + +El `CHECK TABLE` query admite los siguientes motores de tablas: + +- [Registro](../../engines/table-engines/log-family/log.md) +- [TinyLog](../../engines/table-engines/log-family/tinylog.md) +- [StripeLog](../../engines/table-engines/log-family/stripelog.md) +- [Familia MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) + +Realizado sobre las tablas con otros motores de tabla causa una excepción. + +Motores del `*Log` la familia no proporciona la recuperación automática de datos en caso de fallo. Utilice el `CHECK TABLE` consulta para rastrear la pérdida de datos de manera oportuna. + +Para `MergeTree` motores familiares, el `CHECK TABLE` query muestra un estado de comprobación para cada parte de datos individual de una tabla en el servidor local. + +**Si los datos están dañados** + +Si la tabla está dañada, puede copiar los datos no dañados a otra tabla. Para hacer esto: + +1. Cree una nueva tabla con la misma estructura que la tabla dañada. Para ello, ejecute la consulta `CREATE TABLE AS `. +2. Establezca el [max\_threads](../../operations/settings/settings.md#settings-max_threads) valor a 1 para procesar la siguiente consulta en un único subproceso. Para ello, ejecute la consulta `SET max_threads = 1`. +3. Ejecutar la consulta `INSERT INTO SELECT * FROM `. Esta solicitud copia los datos no dañados de la tabla dañada a otra tabla. Solo se copiarán los datos anteriores a la parte dañada. +4. Reinicie el `clickhouse-client` para restablecer el `max_threads` valor. + +## DESCRIBE TABLE {#misc-describe-table} + +``` sql +DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Devuelve lo siguiente `String` tipo columnas: + +- `name` — Column name. +- `type`— Column type. +- `default_type` — Clause that is used in [expresión predeterminada](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` o `ALIAS`). La columna contiene una cadena vacía, si no se especifica la expresión predeterminada. +- `default_expression` — Value specified in the `DEFAULT` clausula. +- `comment_expression` — Comment text. + +Las estructuras de datos anidadas se generan en “expanded” formato. Cada columna se muestra por separado, con el nombre después de un punto. + +## DETACH {#detach} + +Elimina información sobre el ‘name’ tabla desde el servidor. El servidor deja de saber sobre la existencia de la tabla. + +``` sql +DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Esto no elimina los datos ni los metadatos de la tabla. En el próximo lanzamiento del servidor, el servidor leerá los metadatos y volverá a conocer la tabla. +Del mismo modo, un “detached” se puede volver a conectar usando el `ATTACH` consulta (con la excepción de las tablas del sistema, que no tienen metadatos almacenados para ellas). + +No hay `DETACH DATABASE` consulta. + +## DROP {#drop} + +Esta consulta tiene dos tipos: `DROP DATABASE` y `DROP TABLE`. + +``` sql +DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] +``` + +Elimina todas las tablas dentro del ‘db’ base de datos, a continuación, elimina ‘db’ base de datos en sí. +Si `IF EXISTS` se especifica, no devuelve un error si la base de datos no existe. + +``` sql +DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Elimina la tabla. +Si `IF EXISTS` se especifica, no devuelve un error si la tabla no existe o la base de datos no existe. + + DROP DICTIONARY [IF EXISTS] [db.]name + +Elimina el diccionario. +Si `IF EXISTS` se especifica, no devuelve un error si la tabla no existe o la base de datos no existe. + +## EXISTS {#exists} + +``` sql +EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] +``` + +Devuelve una sola `UInt8`columna -type, que contiene el valor único `0` si la tabla o base de datos no existe, o `1` si la tabla existe en la base de datos especificada. + +## KILL QUERY {#kill-query} + +``` sql +KILL QUERY [ON CLUSTER cluster] + WHERE + [SYNC|ASYNC|TEST] + [FORMAT format] +``` + +Intenta terminar por la fuerza las consultas que se están ejecutando actualmente. +Las consultas a finalizar se seleccionan en el sistema.tabla de procesos utilizando los criterios definidos en el `WHERE` cláusula de la `KILL` consulta. + +Ejemplos: + +``` sql +-- Forcibly terminates all queries with the specified query_id: +KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' + +-- Synchronously terminates all queries run by 'username': +KILL QUERY WHERE user='username' SYNC +``` + +Los usuarios de solo lectura solo pueden detener sus propias consultas. + +De forma predeterminada, se utiliza la versión asincrónica de las consultas (`ASYNC`), que no espera la confirmación de que las consultas se han detenido. + +La versión síncrona (`SYNC`) espera a que se detengan todas las consultas y muestra información sobre cada proceso a medida que se detiene. +La respuesta contiene el `kill_status` columna, que puede tomar los siguientes valores: + +1. ‘finished’ – The query was terminated successfully. +2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. +3. The other values ​​explain why the query can’t be stopped. + +Una consulta de prueba (`TEST`) sólo comprueba los derechos del usuario y muestra una lista de consultas para detener. + +## KILL MUTATION {#kill-mutation} + +``` sql +KILL MUTATION [ON CLUSTER cluster] + WHERE + [TEST] + [FORMAT format] +``` + +Intenta cancelar y quitar [mutación](alter.md#alter-mutations) que se están ejecutando actualmente. Las mutaciones para cancelar se seleccionan en el [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) utilizando el filtro especificado por el `WHERE` cláusula de la `KILL` consulta. + +Una consulta de prueba (`TEST`) sólo comprueba los derechos del usuario y muestra una lista de consultas para detener. + +Ejemplos: + +``` sql +-- Cancel and remove all mutations of the single table: +KILL MUTATION WHERE database = 'default' AND table = 'table' + +-- Cancel the specific mutation: +KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' +``` + +The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). + +Los cambios ya realizados por la mutación no se revierten. + +## OPTIMIZE {#misc_operations-optimize} + +``` sql +OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] +``` + +Esta consulta intenta inicializar una combinación no programada de partes de datos para tablas con un motor de tablas [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md) familia. + +El `OPTMIZE` consulta también es compatible con el [Método de codificación de datos:](../../engines/table-engines/special/materializedview.md) y el [Búfer](../../engines/table-engines/special/buffer.md) motor. No se admiten otros motores de tabla. + +Cuando `OPTIMIZE` se utiliza con el [ReplicatedMergeTree](../../engines/table-engines/mergetree-family/replication.md) la familia de motores de tablas, ClickHouse crea una tarea para fusionar y espera la ejecución en todos los nodos (si `replication_alter_partitions_sync` está habilitada la configuración). + +- Si `OPTIMIZE` no realiza una fusión por ningún motivo, no notifica al cliente. Para habilitar las notificaciones, [Optize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) configuración. +- Si especifica un `PARTITION`, sólo la partición especificada está optimizada. [Cómo establecer la expresión de partición](alter.md#alter-how-to-specify-part-expr). +- Si especifica `FINAL`, la optimización se realiza incluso cuando todos los datos ya están en una parte. +- Si especifica `DEDUPLICATE`, luego se deduplicarán filas completamente idénticas (se comparan todas las columnas), tiene sentido solo para el motor MergeTree. + +!!! warning "Advertencia" + `OPTIMIZE` no se puede arreglar el “Too many parts” error. + +## RENAME {#misc_operations-rename} + +Cambia el nombre de una o más tablas. + +``` sql +RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] +``` + +Todas las tablas se renombran bajo bloqueo global. Cambiar el nombre de las tablas es una operación ligera. Si ha indicado otra base de datos después de TO, la tabla se moverá a esta base de datos. Sin embargo, los directorios con bases de datos deben residir en el mismo sistema de archivos (de lo contrario, se devuelve un error). + +## SET {#query-set} + +``` sql +SET param = value +``` + +Asignar `value` a la `param` [configuración](../../operations/settings/index.md) para la sesión actual. No se puede cambiar [configuración del servidor](../../operations/server-configuration-parameters/index.md) de esta manera. + +También puede establecer todos los valores del perfil de configuración especificado en una sola consulta. + +``` sql +SET profile = 'profile-name-from-the-settings-file' +``` + +Para obtener más información, consulte [Configuración](../../operations/settings/settings.md). + +## TRUNCATE {#truncate} + +``` sql +TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Elimina todos los datos de una tabla. Cuando la cláusula `IF EXISTS` se omite, la consulta devuelve un error si la tabla no existe. + +El `TRUNCATE` consulta no es compatible con [Vista](../../engines/table-engines/special/view.md), [File](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md) y [Nulo](../../engines/table-engines/special/null.md) motores de mesa. + +## USE {#use} + +``` sql +USE db +``` + +Permite establecer la base de datos actual para la sesión. +La base de datos actual se utiliza para buscar tablas si la base de datos no está definida explícitamente en la consulta con un punto antes del nombre de la tabla. +Esta consulta no se puede realizar cuando se usa el protocolo HTTP, ya que no existe un concepto de sesión. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/es/sql-reference/statements/select.md b/docs/es/sql-reference/statements/select.md new file mode 100644 index 00000000000..4439aba8b58 --- /dev/null +++ b/docs/es/sql-reference/statements/select.md @@ -0,0 +1,610 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 33 +toc_title: SELECT +--- + +# SELECCIONAR Consultas Sintaxis {#select-queries-syntax} + +`SELECT` realiza la recuperación de datos. + +``` sql +[WITH expr_list|(subquery)] +SELECT [DISTINCT] expr_list +[FROM [db.]table | (subquery) | table_function] [FINAL] +[SAMPLE sample_coeff] +[ARRAY JOIN ...] +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list +[PREWHERE expr] +[WHERE expr] +[GROUP BY expr_list] [WITH TOTALS] +[HAVING expr] +[ORDER BY expr_list] +[LIMIT [offset_value, ]n BY columns] +[LIMIT [n, ]m] +[UNION ALL ...] +[INTO OUTFILE filename] +[FORMAT format] +``` + +Todas las cláusulas son opcionales, excepto la lista requerida de expresiones inmediatamente después de SELECT. +Las siguientes cláusulas se describen casi en el mismo orden que en el transportador de ejecución de consultas. + +Si la consulta omite el `DISTINCT`, `GROUP BY` y `ORDER BY` cláusulas y el `IN` y `JOIN` subconsultas, la consulta se procesará por completo, utilizando O (1) cantidad de RAM. +De lo contrario, la consulta podría consumir mucha RAM si no se especifican las restricciones adecuadas: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Para obtener más información, consulte la sección “Settings”. Es posible utilizar la clasificación externa (guardar tablas temporales en un disco) y la agregación externa. `The system does not have "merge join"`. + +### CON Cláusula {#with-clause} + +Esta sección proporciona soporte para expresiones de tabla común ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), con algunas limitaciones: +1. No se admiten consultas recursivas +2. Cuando se usa una subconsulta dentro de la sección WITH, su resultado debe ser escalar con exactamente una fila +3. Los resultados de la expresión no están disponibles en las subconsultas +Los resultados de las expresiones de la cláusula WITH se pueden usar dentro de la cláusula SELECT. + +Ejemplo 1: Usar expresión constante como “variable” + +``` sql +WITH '2019-08-01 15:23:00' as ts_upper_bound +SELECT * +FROM hits +WHERE + EventDate = toDate(ts_upper_bound) AND + EventTime <= ts_upper_bound +``` + +Ejemplo 2: Evictar el resultado de la expresión de sum(bytes) de la lista de columnas de la cláusula SELECT + +``` sql +WITH sum(bytes) as s +SELECT + formatReadableSize(s), + table +FROM system.parts +GROUP BY table +ORDER BY s +``` + +Ejemplo 3: Uso de los resultados de la subconsulta escalar + +``` sql +/* this example would return TOP 10 of most huge tables */ +WITH + ( + SELECT sum(bytes) + FROM system.parts + WHERE active + ) AS total_disk_usage +SELECT + (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, + table +FROM system.parts +GROUP BY table +ORDER BY table_disk_usage DESC +LIMIT 10 +``` + +Ejemplo 4: Reutilización de la expresión en subconsulta +Como solución alternativa para la limitación actual para el uso de expresiones en subconsultas, puede duplicarla. + +``` sql +WITH ['hello'] AS hello +SELECT + hello, + * +FROM +( + WITH ['hello'] AS hello + SELECT hello +) +``` + +``` text +┌─hello─────┬─hello─────┐ +│ ['hello'] │ ['hello'] │ +└───────────┴───────────┘ +``` + +### Cláusula FROM {#select-from} + +Si se omite la cláusula FROM, los datos se leerán desde el `system.one` tabla. +El `system.one` table contiene exactamente una fila (esta tabla cumple el mismo propósito que la tabla DUAL que se encuentra en otros DBMS). + +El `FROM` cláusula especifica la fuente de la que se leen los datos: + +- Tabla +- Subconsultas +- [Función de la tabla](../table-functions/index.md) + +`ARRAY JOIN` y el regular `JOIN` también se pueden incluir (ver más abajo). + +En lugar de una tabla, el `SELECT` subconsulta se puede especificar entre paréntesis. +A diferencia del SQL estándar, no es necesario especificar un sinónimo después de una subconsulta. + +Para ejecutar una consulta, todas las columnas enumeradas en la consulta se extraen de la tabla adecuada. Las columnas no necesarias para la consulta externa se eliminan de las subconsultas. +Si una consulta no muestra ninguna columnas (por ejemplo, `SELECT count() FROM t`), alguna columna se extrae de la tabla de todos modos (se prefiere la más pequeña), para calcular el número de filas. + +#### Modificador FINAL {#select-from-final} + +Aplicable al seleccionar datos de tablas del [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md)-Familia de motores distintos de `GraphiteMergeTree`. Cuando `FINAL` se especifica, ClickHouse fusiona completamente los datos antes de devolver el resultado y, por lo tanto, realiza todas las transformaciones de datos que ocurren durante las fusiones para el motor de tabla dado. + +También soportado para: +- [Replicado](../../engines/table-engines/mergetree-family/replication.md) versiones de `MergeTree` motor. +- [Vista](../../engines/table-engines/special/view.md), [Búfer](../../engines/table-engines/special/buffer.md), [Distribuido](../../engines/table-engines/special/distributed.md), y [Método de codificación de datos:](../../engines/table-engines/special/materializedview.md) motores que funcionan sobre otros motores, siempre que se hayan creado sobre `MergeTree`-mesas de motor. + +Consultas que usan `FINAL` se ejecutan no tan rápido como consultas similares que no lo hacen, porque: + +- La consulta se ejecuta en un solo subproceso y los datos se combinan durante la ejecución de la consulta. +- Consultas con `FINAL` leer columnas de clave primaria además de las columnas especificadas en la consulta. + +En la mayoría de los casos, evite usar `FINAL`. + +### Cláusula SAMPLE {#select-sample-clause} + +El `SAMPLE` cláusula permite un procesamiento de consultas aproximado. + +Cuando se habilita el muestreo de datos, la consulta no se realiza en todos los datos, sino solo en una cierta fracción de datos (muestra). Por ejemplo, si necesita calcular estadísticas para todas las visitas, es suficiente ejecutar la consulta en la fracción 1/10 de todas las visitas y luego multiplicar el resultado por 10. + +El procesamiento de consultas aproximado puede ser útil en los siguientes casos: + +- Cuando tiene requisitos de temporización estrictos (como \<100 ms) pero no puede justificar el costo de recursos de hardware adicionales para cumplirlos. +- Cuando sus datos sin procesar no son precisos, la aproximación no degrada notablemente la calidad. +- Los requisitos comerciales se centran en los resultados aproximados (por rentabilidad o para comercializar los resultados exactos a los usuarios premium). + +!!! note "Nota" + Sólo puede utilizar el muestreo con las tablas en el [Método de codificación de datos:](../../engines/table-engines/mergetree-family/mergetree.md) familia, y sólo si la expresión de muestreo se especificó durante la creación de la tabla (ver [Motor MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table)). + +Las características del muestreo de datos se enumeran a continuación: + +- El muestreo de datos es un mecanismo determinista. El resultado de la misma `SELECT .. SAMPLE` la consulta es siempre la misma. +- El muestreo funciona consistentemente para diferentes tablas. Para tablas con una sola clave de muestreo, una muestra con el mismo coeficiente siempre selecciona el mismo subconjunto de datos posibles. Por ejemplo, una muestra de ID de usuario toma filas con el mismo subconjunto de todos los ID de usuario posibles de diferentes tablas. Esto significa que puede utilizar el ejemplo en subconsultas [IN](#select-in-operators) clausula. Además, puede unir muestras usando el [JOIN](#select-join) clausula. +- El muestreo permite leer menos datos de un disco. Tenga en cuenta que debe especificar la clave de muestreo correctamente. Para obtener más información, consulte [Creación de una tabla MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). + +Para el `SAMPLE` cláusula se admite la siguiente sintaxis: + +| SAMPLE Clause Syntax | Descripci | +|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `SAMPLE k` | Aqui `k` es el número de 0 a 1.
La consulta se ejecuta en `k` de datos. Por ejemplo, `SAMPLE 0.1` ejecuta la consulta en el 10% de los datos. [Leer más](#select-sample-k) | +| `SAMPLE n` | Aqui `n` es un entero suficientemente grande.
La consulta se ejecuta en una muestra de al menos `n` filas (pero no significativamente más que esto). Por ejemplo, `SAMPLE 10000000` ejecuta la consulta en un mínimo de 10.000.000 de filas. [Leer más](#select-sample-n) | +| `SAMPLE k OFFSET m` | Aqui `k` y `m` son los números del 0 al 1.
La consulta se ejecuta en una muestra de `k` de los datos. Los datos utilizados para el ejemplo se compensan por `m` fracción. [Leer más](#select-sample-offset) | + +#### SAMPLE K {#select-sample-k} + +Aqui `k` es el número de 0 a 1 (se admiten notaciones fraccionarias y decimales). Por ejemplo, `SAMPLE 1/2` o `SAMPLE 0.5`. + +En un `SAMPLE k` cláusula, la muestra se toma de la `k` de datos. El ejemplo se muestra a continuación: + +``` sql +SELECT + Title, + count() * 10 AS PageViews +FROM hits_distributed +SAMPLE 0.1 +WHERE + CounterID = 34 +GROUP BY Title +ORDER BY PageViews DESC LIMIT 1000 +``` + +En este ejemplo, la consulta se ejecuta en una muestra de 0,1 (10%) de datos. Los valores de las funciones agregadas no se corrigen automáticamente, por lo que para obtener un resultado aproximado, el valor `count()` se multiplica manualmente por 10. + +#### SAMPLE N {#select-sample-n} + +Aqui `n` es un entero suficientemente grande. Por ejemplo, `SAMPLE 10000000`. + +En este caso, la consulta se ejecuta en una muestra de al menos `n` filas (pero no significativamente más que esto). Por ejemplo, `SAMPLE 10000000` ejecuta la consulta en un mínimo de 10.000.000 de filas. + +Dado que la unidad mínima para la lectura de datos es un gránulo (su tamaño se establece mediante el `index_granularity` ajuste), tiene sentido establecer una muestra que es mucho más grande que el tamaño del gránulo. + +Cuando se utiliza el `SAMPLE n` cláusula, no sabe qué porcentaje relativo de datos se procesó. Por lo tanto, no sabe el coeficiente por el que se deben multiplicar las funciones agregadas. Utilice el `_sample_factor` columna virtual para obtener el resultado aproximado. + +El `_sample_factor` columna contiene coeficientes relativos que se calculan dinámicamente. Esta columna se crea automáticamente cuando [crear](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table) una tabla con la clave de muestreo especificada. Los ejemplos de uso del `_sample_factor` columna se muestran a continuación. + +Consideremos la tabla `visits`, que contiene las estadísticas sobre las visitas al sitio. El primer ejemplo muestra cómo calcular el número de páginas vistas: + +``` sql +SELECT sum(PageViews * _sample_factor) +FROM visits +SAMPLE 10000000 +``` + +El siguiente ejemplo muestra cómo calcular el número total de visitas: + +``` sql +SELECT sum(_sample_factor) +FROM visits +SAMPLE 10000000 +``` + +El siguiente ejemplo muestra cómo calcular la duración media de la sesión. Tenga en cuenta que no necesita usar el coeficiente relativo para calcular los valores promedio. + +``` sql +SELECT avg(Duration) +FROM visits +SAMPLE 10000000 +``` + +#### SAMPLE K OFFSET M {#select-sample-offset} + +Aqui `k` y `m` son números del 0 al 1. Los ejemplos se muestran a continuación. + +**Ejemplo 1** + +``` sql +SAMPLE 1/10 +``` + +En este ejemplo, la muestra es 1/10 de todos los datos: + +`[++------------]` + +**Ejemplo 2** + +``` sql +SAMPLE 1/10 OFFSET 1/2 +``` + +Aquí, se toma una muestra del 10% de la segunda mitad de los datos. + +`[------++------]` + +### ARRAY JOIN Cláusula {#select-array-join-clause} + +Permite ejecutar `JOIN` con una matriz o estructura de datos anidada. La intención es similar a la [arrayJoin](../../sql-reference/functions/array-join.md#functions_arrayjoin) función, pero su funcionalidad es más amplia. + +``` sql +SELECT +FROM +[LEFT] ARRAY JOIN +[WHERE|PREWHERE ] +... +``` + +Sólo puede especificar una sola `ARRAY JOIN` cláusula en una consulta. + +El orden de ejecución de la consulta se optimiza cuando se ejecuta `ARRAY JOIN`. Aunque `ARRAY JOIN` debe especificarse siempre antes de la `WHERE/PREWHERE` cláusula, se puede realizar ya sea antes `WHERE/PREWHERE` (si el resultado es necesario en esta cláusula), o después de completarlo (para reducir el volumen de cálculos). El optimizador de consultas controla el orden de procesamiento. + +Tipos admitidos de `ARRAY JOIN` se enumeran a continuación: + +- `ARRAY JOIN` - En este caso, las matrices vacías no se incluyen en el resultado de `JOIN`. +- `LEFT ARRAY JOIN` - El resultado de `JOIN` contiene filas con matrices vacías. El valor de una matriz vacía se establece en el valor predeterminado para el tipo de elemento de matriz (normalmente 0, cadena vacía o NULL). + +Los siguientes ejemplos demuestran el uso de la `ARRAY JOIN` y `LEFT ARRAY JOIN` clausula. Vamos a crear una tabla con un [Matriz](../../sql-reference/data-types/array.md) escriba la columna e inserte valores en ella: + +``` sql +CREATE TABLE arrays_test +( + s String, + arr Array(UInt8) +) ENGINE = Memory; + +INSERT INTO arrays_test +VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); +``` + +``` text +┌─s───────────┬─arr─────┐ +│ Hello │ [1,2] │ +│ World │ [3,4,5] │ +│ Goodbye │ [] │ +└─────────────┴─────────┘ +``` + +El siguiente ejemplo utiliza el `ARRAY JOIN` clausula: + +``` sql +SELECT s, arr +FROM arrays_test +ARRAY JOIN arr; +``` + +``` text +┌─s─────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +└───────┴─────┘ +``` + +El siguiente ejemplo utiliza el `LEFT ARRAY JOIN` clausula: + +``` sql +SELECT s, arr +FROM arrays_test +LEFT ARRAY JOIN arr; +``` + +``` text +┌─s───────────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +│ Goodbye │ 0 │ +└─────────────┴─────┘ +``` + +#### Uso De Alias {#using-aliases} + +Se puede especificar un alias para una matriz en el `ARRAY JOIN` clausula. En este caso, este alias puede acceder a un elemento de matriz, pero el nombre original tiene acceso a la matriz en sí. Ejemplo: + +``` sql +SELECT s, arr, a +FROM arrays_test +ARRAY JOIN arr AS a; +``` + +``` text +┌─s─────┬─arr─────┬─a─┐ +│ Hello │ [1,2] │ 1 │ +│ Hello │ [1,2] │ 2 │ +│ World │ [3,4,5] │ 3 │ +│ World │ [3,4,5] │ 4 │ +│ World │ [3,4,5] │ 5 │ +└───────┴─────────┴───┘ +``` + +Usando alias, puede realizar `ARRAY JOIN` con una matriz externa. Por ejemplo: + +``` sql +SELECT s, arr_external +FROM arrays_test +ARRAY JOIN [1, 2, 3] AS arr_external; +``` + +``` text +┌─s───────────┬─arr_external─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ Hello │ 3 │ +│ World │ 1 │ +│ World │ 2 │ +│ World │ 3 │ +│ Goodbye │ 1 │ +│ Goodbye │ 2 │ +│ Goodbye │ 3 │ +└─────────────┴──────────────┘ +``` + +Múltiples matrices se pueden separar por comas en el `ARRAY JOIN` clausula. En este caso, `JOIN` se realiza con ellos simultáneamente (la suma directa, no el producto cartesiano). Tenga en cuenta que todas las matrices deben tener el mismo tamaño. Ejemplo: + +``` sql +SELECT s, arr, a, num, mapped +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ +│ Hello │ [1,2] │ 1 │ 1 │ 2 │ +│ Hello │ [1,2] │ 2 │ 2 │ 3 │ +│ World │ [3,4,5] │ 3 │ 1 │ 4 │ +│ World │ [3,4,5] │ 4 │ 2 │ 5 │ +│ World │ [3,4,5] │ 5 │ 3 │ 6 │ +└───────┴─────────┴───┴─────┴────────┘ +``` + +El siguiente ejemplo utiliza el [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) función: + +``` sql +SELECT s, arr, a, num, arrayEnumerate(arr) +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ +│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ +│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ +│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ +│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ +│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ +└───────┴─────────┴───┴─────┴─────────────────────┘ +``` + +#### ARRAY JOIN Con Estructura De Datos Anidada {#array-join-with-nested-data-structure} + +`ARRAY`JOIN\`\` también funciona con [estructuras de datos anidados](../../sql-reference/data-types/nested-data-structures/nested.md). Ejemplo: + +``` sql +CREATE TABLE nested_test +( + s String, + nest Nested( + x UInt8, + y UInt32) +) ENGINE = Memory; + +INSERT INTO nested_test +VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); +``` + +``` text +┌─s───────┬─nest.x──┬─nest.y─────┐ +│ Hello │ [1,2] │ [10,20] │ +│ World │ [3,4,5] │ [30,40,50] │ +│ Goodbye │ [] │ [] │ +└─────────┴─────────┴────────────┘ +``` + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +Al especificar nombres de estructuras de datos anidadas en `ARRAY JOIN` el significado es el mismo `ARRAY JOIN` con todos los elementos de la matriz en los que consiste. Los ejemplos se enumeran a continuación: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`, `nest.y`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +Esta variación también tiene sentido: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─────┐ +│ Hello │ 1 │ [10,20] │ +│ Hello │ 2 │ [10,20] │ +│ World │ 3 │ [30,40,50] │ +│ World │ 4 │ [30,40,50] │ +│ World │ 5 │ [30,40,50] │ +└───────┴────────┴────────────┘ +``` + +Se puede usar un alias para una estructura de datos anidada, con el fin de seleccionar `JOIN` resultado o la matriz de origen. Ejemplo: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest AS n; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ +└───────┴─────┴─────┴─────────┴────────────┘ +``` + +Ejemplo de uso del [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) función: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num +FROM nested_test +ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ +└───────┴─────┴─────┴─────────┴────────────┴─────┘ +``` + +### Cláusula JOIN {#select-join} + +Se une a los datos en el [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) sentido. + +!!! info "Nota" + No relacionado con [ARRAY JOIN](#select-array-join-clause). + +``` sql +SELECT +FROM +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN +(ON )|(USING ) ... +``` + +Los nombres de tabla se pueden especificar en lugar de `` y ``. Esto es equivalente a la `SELECT * FROM table` subconsulta, excepto en un caso especial cuando la tabla tiene [Unir](../../engines/table-engines/special/join.md) engine – an array prepared for joining. + +#### Tipos Compatibles De `JOIN` {#select-join-types} + +- `INNER JOIN` (o `JOIN`) +- `LEFT JOIN` (o `LEFT OUTER JOIN`) +- `RIGHT JOIN` (o `RIGHT OUTER JOIN`) +- `FULL JOIN` (o `FULL OUTER JOIN`) +- `CROSS JOIN` (o `,` ) + +Ver el estándar [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) descripci. + +#### ÚNETE Múltiple {#multiple-join} + +Al realizar consultas, ClickHouse reescribe las uniones de varias tablas en la secuencia de uniones de dos tablas. Por ejemplo, si hay cuatro tablas para unir ClickHouse une la primera y la segunda, luego une el resultado con la tercera tabla, y en el último paso, se une a la cuarta. + +Si una consulta contiene el `WHERE` cláusula, ClickHouse intenta empujar hacia abajo los filtros de esta cláusula a través de la unión intermedia. Si no puede aplicar el filtro a cada unión intermedia, ClickHouse aplica los filtros después de que se completen todas las combinaciones. + +Recomendamos el `JOIN ON` o `JOIN USING` sintaxis para crear consultas. Por ejemplo: + +``` sql +SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a +``` + +Puede utilizar listas de tablas separadas por comas `FROM` clausula. Por ejemplo: + +``` sql +SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a +``` + +No mezcle estas sintaxis. + +ClickHouse no admite directamente la sintaxis con comas, por lo que no recomendamos usarlas. El algoritmo intenta reescribir la consulta en términos de `CROSS JOIN` y `INNER JOIN` y luego procede al procesamiento de consultas. Al reescribir la consulta, ClickHouse intenta optimizar el rendimiento y el consumo de memoria. De forma predeterminada, ClickHouse trata las comas como `INNER JOIN` cláusula y convierte `INNER JOIN` a `CROSS JOIN` cuando el algoritmo no puede garantizar que `INNER JOIN` devuelve los datos requeridos. + +#### Rigor {#select-join-strictness} + +- `ALL` — If the right table has several matching rows, ClickHouse creates a [Producto cartesiano](https://en.wikipedia.org/wiki/Cartesian_product) de filas coincidentes. Este es el estándar `JOIN` comportamiento en SQL. +- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` y `ALL` palabras clave son las mismas. +- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` el uso se describe a continuación. + +**ASOF JOIN Uso** + +`ASOF JOIN` es útil cuando necesita unir registros que no tienen una coincidencia exacta. + +Tablas para `ASOF JOIN` debe tener una columna de secuencia ordenada. Esta columna no puede estar sola en una tabla y debe ser uno de los tipos de datos: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`, y `DateTime`. + +Sintaxis `ASOF JOIN ... ON`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF LEFT JOIN table_2 +ON equi_cond AND closest_match_cond +``` + +Puede usar cualquier número de condiciones de igualdad y exactamente una condición de coincidencia más cercana. Por ejemplo, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. + +Condiciones admitidas para la coincidencia más cercana: `>`, `>=`, `<`, `<=`. + +Sintaxis `ASOF JOIN ... USING`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF JOIN table_2 +USING (equi_column1, ... equi_columnN, asof_column) +``` + +`ASOF JOIN` utilizar `equi_columnX` para unirse a la igualdad y `asof_column` para unirse en el partido más cercano con el `table_1.asof_column >= table_2.asof_column` condición. El `asof_column` columna siempre el último en el `USING` clausula. + +Por ejemplo, considere las siguientes tablas: + +\`\`\` texto +table\_1 table\_2 + +evento \| ev\_time \| user\_id evento \| ev\_time \| user\_id diff --git a/docs/es/sql-reference/statements/show.md b/docs/es/sql-reference/statements/show.md new file mode 100644 index 00000000000..19d9dcc35a7 --- /dev/null +++ b/docs/es/sql-reference/statements/show.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 38 +toc_title: SHOW +--- + +# MOSTRAR Consultas {#show-queries} + +## SHOW CREATE TABLE {#show-create-table} + +``` sql +SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Devuelve una sola `String`-tipo ‘statement’ column, which contains a single value – the `CREATE` consulta utilizada para crear el objeto especificado. + +## SHOW DATABASES {#show-databases} + +``` sql +SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] +``` + +Imprime una lista de todas las bases de datos. +Esta consulta es idéntica a `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. + +## SHOW PROCESSLIST {#show-processlist} + +``` sql +SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] +``` + +Envía el contenido de la [sistema.procesa](../../operations/system-tables.md#system_tables-processes) tabla, que contiene una lista de consultas que se están procesando en este momento, exceptuando `SHOW PROCESSLIST` consulta. + +El `SELECT * FROM system.processes` query devuelve datos sobre todas las consultas actuales. + +Consejo (ejecutar en la consola): + +``` bash +$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" +``` + +## SHOW TABLES {#show-tables} + +Muestra una lista de tablas. + +``` sql +SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Si el `FROM` no se especifica la cláusula, la consulta devuelve la lista de tablas de la base de datos actual. + +Puede obtener los mismos resultados que el `SHOW TABLES` consulta de la siguiente manera: + +``` sql +SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Ejemplo** + +La siguiente consulta selecciona las dos primeras filas de la lista de tablas `system` base de datos, cuyos nombres contienen `co`. + +``` sql +SHOW TABLES FROM system LIKE '%co%' LIMIT 2 +``` + +``` text +┌─name───────────────────────────┐ +│ aggregate_function_combinators │ +│ collations │ +└────────────────────────────────┘ +``` + +## SHOW DICTIONARIES {#show-dictionaries} + +Muestra una lista de [diccionarios externos](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +``` sql +SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Si el `FROM` no se especifica la cláusula, la consulta devuelve la lista de diccionarios de la base de datos actual. + +Puede obtener los mismos resultados que el `SHOW DICTIONARIES` consulta de la siguiente manera: + +``` sql +SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Ejemplo** + +La siguiente consulta selecciona las dos primeras filas de la lista de tablas `system` base de datos, cuyos nombres contienen `reg`. + +``` sql +SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 +``` + +``` text +┌─name─────────┐ +│ regions │ +│ region_names │ +└──────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/es/sql-reference/statements/system.md b/docs/es/sql-reference/statements/system.md new file mode 100644 index 00000000000..3eba0728967 --- /dev/null +++ b/docs/es/sql-reference/statements/system.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 37 +toc_title: SYSTEM +--- + +# Consultas Del Sistema {#query-language-system} + +- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) +- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) +- [DROP DNS CACHE](#query_language-system-drop-dns-cache) +- [DROP MARK CACHE](#query_language-system-drop-mark-cache) +- [FLUSH LOGS](#query_language-system-flush_logs) +- [RELOAD CONFIG](#query_language-system-reload-config) +- [SHUTDOWN](#query_language-system-shutdown) +- [KILL](#query_language-system-kill) +- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) +- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) +- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) +- [STOP MERGES](#query_language-system-stop-merges) +- [START MERGES](#query_language-system-start-merges) + +## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} + +Vuelve a cargar todos los diccionarios que se han cargado correctamente antes. +De forma predeterminada, los diccionarios se cargan perezosamente (ver [Diccionarios\_lazy\_load](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), por lo que en lugar de cargarse automáticamente al inicio, se inicializan en el primer acceso a través de la función dictGet o SELECT desde tablas con ENGINE = Dictionary . El `SYSTEM RELOAD DICTIONARIES` consulta vuelve a cargar dichos diccionarios (LOADED). +Siempre vuelve `Ok.` independientemente del resultado de la actualización del diccionario. + +## RELOAD DICTIONARY Dictionary\_name {#query_language-system-reload-dictionary} + +Recarga completamente un diccionario `dictionary_name`, independientemente del estado del diccionario (LOADED / NOT\_LOADED / FAILED). +Siempre vuelve `Ok.` independientemente del resultado de la actualización del diccionario. +El estado del diccionario se puede comprobar consultando el `system.dictionaries` tabla. + +``` sql +SELECT name, status FROM system.dictionaries; +``` + +## DROP DNS CACHE {#query_language-system-drop-dns-cache} + +Restablece la caché DNS interna de ClickHouse. A veces (para versiones anteriores de ClickHouse) es necesario usar este comando al cambiar la infraestructura (cambiar la dirección IP de otro servidor de ClickHouse o el servidor utilizado por los diccionarios). + +Para obtener una administración de caché más conveniente (automática), consulte disable\_internal\_dns\_cache, dns\_cache\_update\_period parameters. + +## DROP MARK CACHE {#query_language-system-drop-mark-cache} + +Restablece la caché de marcas. Utilizado en el desarrollo de ClickHouse y pruebas de rendimiento. + +## FLUSH LOGS {#query_language-system-flush_logs} + +Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. + +## RELOAD CONFIG {#query_language-system-reload-config} + +Vuelve a cargar la configuración de ClickHouse. Se usa cuando la configuración se almacena en ZooKeeeper. + +## SHUTDOWN {#query_language-system-shutdown} + +Normalmente se apaga ClickHouse (como `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) + +## KILL {#query_language-system-kill} + +Anula el proceso de ClickHouse (como `kill -9 {$ pid_clickhouse-server}`) + +## Administración De Tablas Distribuidas {#query-language-system-distributed} + +ClickHouse puede administrar [distribuido](../../engines/table-engines/special/distributed.md) tabla. Cuando un usuario inserta datos en estas tablas, ClickHouse primero crea una cola de los datos que se deben enviar a los nodos del clúster y, a continuación, los envía de forma asincrónica. Puede administrar el procesamiento de colas con el [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed), y [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) consulta. También puede insertar sincrónicamente datos distribuidos con el `insert_distributed_sync` configuración. + +### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} + +Deshabilita la distribución de datos en segundo plano al insertar datos en tablas distribuidas. + +``` sql +SYSTEM STOP DISTRIBUTED SENDS [db.] +``` + +### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} + +Obliga a ClickHouse a enviar datos a nodos de clúster de forma sincrónica. Si algún nodo no está disponible, ClickHouse produce una excepción y detiene la ejecución de la consulta. Puede volver a intentar la consulta hasta que tenga éxito, lo que sucederá cuando todos los nodos estén nuevamente en línea. + +``` sql +SYSTEM FLUSH DISTRIBUTED [db.] +``` + +### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} + +Habilita la distribución de datos en segundo plano al insertar datos en tablas distribuidas. + +``` sql +SYSTEM START DISTRIBUTED SENDS [db.] +``` + +### STOP MERGES {#query_language-system-stop-merges} + +Proporciona la posibilidad de detener las fusiones en segundo plano para las tablas de la familia MergeTree: + +``` sql +SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +``` + +!!! note "Nota" + `DETACH / ATTACH` la tabla comenzará las fusiones de fondo para la tabla, incluso en caso de que las fusiones se hayan detenido para todas las tablas MergeTree antes. + +### START MERGES {#query_language-system-start-merges} + +Proporciona la posibilidad de iniciar fusiones en segundo plano para tablas de la familia MergeTree: + +``` sql +SYSTEM START MERGES [[db.]merge_tree_family_table_name] +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/es/sql-reference/syntax.md b/docs/es/sql-reference/syntax.md new file mode 100644 index 00000000000..67800683f24 --- /dev/null +++ b/docs/es/sql-reference/syntax.md @@ -0,0 +1,187 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 31 +toc_title: Sintaxis +--- + +# Sintaxis {#syntax} + +Hay dos tipos de analizadores en el sistema: el analizador SQL completo (un analizador de descenso recursivo) y el analizador de formato de datos (un analizador de flujo rápido). +En todos los casos, excepto el `INSERT` consulta, sólo se utiliza el analizador SQL completo. +El `INSERT` consulta utiliza ambos analizadores: + +``` sql +INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') +``` + +El `INSERT INTO t VALUES` fragmento es analizado por el analizador completo, y los datos `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` es analizado por el analizador de flujo rápido. También puede activar el analizador completo de los datos mediante el [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) configuración. Cuando `input_format_values_interpret_expressions = 1`, ClickHouse primero intenta analizar valores con el analizador de flujo rápido. Si falla, ClickHouse intenta usar el analizador completo para los datos, tratándolo como un SQL [expresion](#syntax-expressions). + +Los datos pueden tener cualquier formato. Cuando se recibe una consulta, el servidor no calcula más de [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) bytes de la solicitud en RAM (por defecto, 1 MB), y el resto se analiza la secuencia. +Esto significa que el sistema no tiene problemas con `INSERT` consultas, como lo hace MySQL. + +Cuando se utiliza el `Values` formato en un `INSERT` consulta, puede parecer que los datos se analizan igual que las expresiones en un `SELECT` consulta, pero esto no es cierto. El `Values` formato es mucho más limitado. + +A continuación cubriremos el analizador completo. Para obtener más información sobre los analizadores de formato, consulte [Formato](../interfaces/formats.md) apartado. + +## Espacio {#spaces} + +Puede haber cualquier número de símbolos de espacio entre las construcciones sintácticas (incluidos el principio y el final de una consulta). Los símbolos de espacio incluyen el espacio, tabulación, avance de línea, CR y avance de formulario. + +## Comentario {#comments} + +Se admiten comentarios de estilo SQL y de estilo C. +Comentarios de estilo SQL: desde `--` al final de la línea. El espacio después `--` se puede omitir. +Comentarios en estilo C: de `/*` a `*/`. Estos comentarios pueden ser multilínea. Tampoco se requieren espacios aquí. + +## Palabras Clave {#syntax-keywords} + +Las palabras clave no distinguen entre mayúsculas y minúsculas cuando corresponden a: + +- Estándar SQL. Por ejemplo, `SELECT`, `select` y `SeLeCt` son todos válidos. +- Implementación en algunos DBMS populares (MySQL o Postgres). Por ejemplo, `DateTime` es lo mismo que `datetime`. + +Si el nombre del tipo de datos distingue entre mayúsculas y minúsculas `system.data_type_families` tabla. + +A diferencia del SQL estándar, todas las demás palabras clave (incluidos los nombres de las funciones) son **minúsculas**. + +Las palabras clave no están reservadas (simplemente se analizan como palabras clave en el contexto correspondiente). Si usted usa [identificador](#syntax-identifiers) lo mismo que las palabras clave, encerrarlas entre comillas. Por ejemplo, la consulta `SELECT "FROM" FROM table_name` es válido si la tabla `table_name` tiene columna con el nombre `"FROM"`. + +## Identificador {#syntax-identifiers} + +Los identificadores son: + +- Nombres de clúster, base de datos, tabla, partición y columna. +- Función. +- Tipos de datos. +- [Alias de expresión](#syntax-expression_aliases). + +Los identificadores pueden ser citados o no citados. Se recomienda utilizar identificadores no citados. + +Los identificadores no citados deben coincidir con la expresión regular `^[a-zA-Z_][0-9a-zA-Z_]*$` y no puede ser igual a [Palabras clave](#syntax-keywords). Ejemplos: `x, _1, X_y__Z123_.` + +Si desea utilizar identificadores iguales a las palabras clave o si desea utilizar otros símbolos en los identificadores, cítelo con comillas dobles o retrocesos, por ejemplo, `"id"`, `` `id` ``. + +## Literal {#literals} + +Hay: numérico, cadena, compuesto y `NULL` literal. + +### Numérico {#numeric} + +Un literal numérico, intenta ser analizado: + +- Primero como un número firmado de 64 bits, usando el [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) función. +- Si no tiene éxito, como un número de 64 bits sin signo, [Sistema abierto.](https://en.cppreference.com/w/cpp/string/byte/strtol) función. +- Si no tiene éxito, como un número de punto flotante [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) función. +- De lo contrario, se devuelve un error. + +El valor correspondiente tendrá el tipo más pequeño en el que se ajuste el valor. +Por ejemplo, 1 se analiza como `UInt8` pero 256 se analiza como `UInt16`. Para obtener más información, consulte [Tipos de datos](../sql-reference/data-types/index.md). + +Ejemplos: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. + +### Cadena {#syntax-string-literal} + +Solo se admiten literales de cadena entre comillas simples. Los caracteres incluidos se pueden escapar de barra invertida. Las siguientes secuencias de escape tienen un valor especial correspondiente: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. En todos los demás casos, secuencias de escape en el formato `\c`, donde `c` cualquier carácter, se convierten a `c`. Esto significa que puedes usar las secuencias `\'`y`\\`. El valor tendrá el [Cadena](../sql-reference/data-types/string.md) tipo. + +El conjunto mínimo de caracteres que necesita para escapar en literales de cadena: `'` y `\`. La comilla simple se puede escapar con la comilla simple, literales `'It\'s'` y `'It''s'` son iguales. + +### Compuesto {#compound} + +Las construcciones son compatibles con las matrices: `[1, 2, 3]` y tuplas: `(1, 'Hello, world!', 2)`.. +En realidad, estos no son literales, sino expresiones con el operador de creación de matriz y el operador de creación de tuplas, respectivamente. +Una matriz debe constar de al menos un elemento y una tupla debe tener al menos dos elementos. +Las tuplas tienen un propósito especial para su uso en el `IN` cláusula de un `SELECT` consulta. Las tuplas se pueden obtener como resultado de una consulta, pero no se pueden guardar en una base de datos (con la excepción de [Memoria](../engines/table-engines/special/memory.md) tabla). + +### NULL {#null-literal} + +Indica que falta el valor. + +Para almacenar `NULL` en un campo de tabla, debe ser del [NULL](../sql-reference/data-types/nullable.md) tipo. + +Dependiendo del formato de datos (entrada o salida), `NULL` puede tener una representación diferente. Para obtener más información, consulte la documentación de [Formatos de datos](../interfaces/formats.md#formats). + +Hay muchos matices para el procesamiento `NULL`. Por ejemplo, si al menos uno de los argumentos de una operación de comparación es `NULL` el resultado de esta operación también se `NULL`. Lo mismo es cierto para la multiplicación, la suma y otras operaciones. Para obtener más información, lea la documentación de cada operación. + +En las consultas, puede verificar `NULL` utilizando el [IS NULL](operators.md#operator-is-null) y [IS NOT NULL](operators.md) operadores y las funciones relacionadas `isNull` y `isNotNull`. + +## Función {#functions} + +Las funciones se escriben como un identificador con una lista de argumentos (posiblemente vacíos) entre paréntesis. A diferencia de SQL estándar, los corchetes son necesarios, incluso para una lista de argumentos vacía. Ejemplo: `now()`. +Hay funciones regulares y agregadas (ver la sección “Aggregate functions”). Algunas funciones agregadas pueden contener dos listas de argumentos entre paréntesis. Ejemplo: `quantile (0.9) (x)`. Estas funciones agregadas se llaman “parametric” funciones, y los argumentos en la primera lista se llaman “parameters”. La sintaxis de las funciones agregadas sin parámetros es la misma que para las funciones regulares. + +## Operador {#operators} + +Los operadores se convierten a sus funciones correspondientes durante el análisis de consultas, teniendo en cuenta su prioridad y asociatividad. +Por ejemplo, la expresión `1 + 2 * 3 + 4` se transforma a `plus(plus(1, multiply(2, 3)), 4)`. + +## Tipos De Datos y Motores De Tabla De Base De Datos {#data_types-and-database-table-engines} + +Tipos de datos y motores de tablas en el `CREATE` las consultas se escriben de la misma manera que los identificadores o funciones. En otras palabras, pueden o no contener una lista de argumentos entre corchetes. Para obtener más información, consulte las secciones “Data types,” “Table engines,” y “CREATE”. + +## Alias De expresión {#syntax-expression_aliases} + +Un alias es un nombre definido por el usuario para una expresión en una consulta. + +``` sql +expr AS alias +``` + +- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` cláusula sin usar el `AS` palabra clave. + + For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. + + In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. + +- `expr` — Any expression supported by ClickHouse. + + For example, `SELECT column_name * 2 AS double FROM some_table`. + +- `alias` — Name for `expr`. Los alias deben cumplir con el [identificador](#syntax-identifiers) sintaxis. + + For example, `SELECT "table t".column_name FROM table_name AS "table t"`. + +### Notas Sobre El Uso {#notes-on-usage} + +Los alias son globales para una consulta o subconsulta y puede definir un alias en cualquier parte de una consulta para cualquier expresión. Por ejemplo, `SELECT (1 AS n) + 2, n`. + +Los alias no son visibles en subconsultas y entre subconsultas. Por ejemplo, al ejecutar la consulta `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse genera la excepción `Unknown identifier: num`. + +Si se define un alias para las columnas de resultados `SELECT` cláusula de una subconsulta, estas columnas son visibles en la consulta externa. Por ejemplo, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. + +Tenga cuidado con los alias que son iguales a los nombres de columna o tabla. Consideremos el siguiente ejemplo: + +``` sql +CREATE TABLE t +( + a Int, + b Int +) +ENGINE = TinyLog() +``` + +``` sql +SELECT + argMax(a, b), + sum(b) AS b +FROM t +``` + +``` text +Received exception from server (version 18.14.17): +Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. +``` + +En este ejemplo, declaramos tabla `t` con columna `b`. Luego, al seleccionar los datos, definimos el `sum(b) AS b` apodo. Como los alias son globales, ClickHouse sustituyó el literal `b` en la expresión `argMax(a, b)` con la expresión `sum(b)`. Esta sustitución causó la excepción. + +## Asterisco {#asterisk} + +En un `SELECT` consulta, un asterisco puede reemplazar la expresión. Para obtener más información, consulte la sección “SELECT”. + +## Expresiones {#syntax-expressions} + +Una expresión es una función, identificador, literal, aplicación de un operador, expresión entre paréntesis, subconsulta o asterisco. También puede contener un alias. +Una lista de expresiones es una o más expresiones separadas por comas. +Las funciones y los operadores, a su vez, pueden tener expresiones como argumentos. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/es/sql-reference/table-functions/file.md b/docs/es/sql-reference/table-functions/file.md new file mode 100644 index 00000000000..2296c4b41b7 --- /dev/null +++ b/docs/es/sql-reference/table-functions/file.md @@ -0,0 +1,121 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 37 +toc_title: file +--- + +# file {#file} + +Crea una tabla a partir de un archivo. Esta función de tabla es similar a [URL](url.md) y [Hdfs](hdfs.md) aquel. + +``` sql +file(path, format, structure) +``` + +**Parámetros de entrada** + +- `path` — The relative path to the file from [user\_files\_path](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_files_path). Soporte de ruta a archivo siguiendo globs en modo de solo lectura: `*`, `?`, `{abc,def}` y `{N..M}` donde `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [formato](../../interfaces/formats.md#formats) del archivo. +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**Valor devuelto** + +Una tabla con la estructura especificada para leer o escribir datos en el archivo especificado. + +**Ejemplo** + +Configuración `user_files_path` y el contenido del archivo `test.csv`: + +``` bash +$ grep user_files_path /etc/clickhouse-server/config.xml + /var/lib/clickhouse/user_files/ + +$ cat /var/lib/clickhouse/user_files/test.csv + 1,2,3 + 3,2,1 + 78,43,45 +``` + +Tabla de`test.csv` y selección de las dos primeras filas de ella: + +``` sql +SELECT * +FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +``` sql +-- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file +SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 +``` + +**Globs en el camino** + +Múltiples componentes de ruta de acceso pueden tener globs. Para ser procesado, el archivo debe existir y coincidir con todo el patrón de ruta (no solo el sufijo o el prefijo). + +- `*` — Substitutes any number of any characters except `/` incluyendo cadena vacía. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +Construcciones con `{}` son similares a la [función de tabla remota](../../sql-reference/table-functions/remote.md)). + +**Ejemplo** + +1. Supongamos que tenemos varios archivos con las siguientes rutas relativas: + +- ‘some\_dir/some\_file\_1’ +- ‘some\_dir/some\_file\_2’ +- ‘some\_dir/some\_file\_3’ +- ‘another\_dir/some\_file\_1’ +- ‘another\_dir/some\_file\_2’ +- ‘another\_dir/some\_file\_3’ + +1. Consulta la cantidad de filas en estos archivos: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. Consulta la cantidad de filas en todos los archivos de estos dos directorios: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "Advertencia" + Si su lista de archivos contiene rangos de números con ceros a la izquierda, use la construcción con llaves para cada dígito por separado o use `?`. + +**Ejemplo** + +Consultar los datos desde archivos nombrados `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## Virtual Columnas {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Ver también** + +- [Virtual columnas](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/es/sql-reference/table-functions/generate.md b/docs/es/sql-reference/table-functions/generate.md new file mode 100644 index 00000000000..f0d8abb6e45 --- /dev/null +++ b/docs/es/sql-reference/table-functions/generate.md @@ -0,0 +1,45 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 47 +toc_title: generateRandom +--- + +# generateRandom {#generaterandom} + +Genera datos aleatorios con un esquema dado. +Permite rellenar tablas de prueba con datos. +Admite todos los tipos de datos que se pueden almacenar en la tabla, excepto `LowCardinality` y `AggregateFunction`. + +``` sql +generateRandom('name TypeName[, name TypeName]...', [, 'random_seed'[, 'max_string_length'[, 'max_array_length']]]); +``` + +**Parámetros** + +- `name` — Name of corresponding column. +- `TypeName` — Type of corresponding column. +- `limit` — Number of rows to generate. +- `max_array_length` — Maximum array length for all generated arrays. Defaults to `10`. +- `max_string_length` — Maximum string length for all generated strings. Defaults to `10`. +- `random_seed` — Specify random seed manually to produce stable results. If NULL — seed is randomly generated. + +**Valor devuelto** + +Un objeto de tabla con el esquema solicitado. + +## Ejemplo De Uso {#usage-example} + +``` sql +SELECT * FROM generateRandom('a Array(Int8), d Decimal32(4), c Tuple(DateTime64(3), UUID)', 1, 10, 2); +``` + +``` text +┌─a────────┬────────────d─┬─c──────────────────────────────────────────────────────────────────┐ +│ [77] │ -124167.6723 │ ('2061-04-17 21:59:44.573','3f72f405-ec3e-13c8-44ca-66ef335f7835') │ +│ [32,110] │ -141397.7312 │ ('1979-02-09 03:43:48.526','982486d1-5a5d-a308-e525-7bd8b80ffa73') │ +│ [68] │ -67417.0770 │ ('2080-03-12 14:17:31.269','110425e5-413f-10a6-05ba-fa6b3e929f15') │ +└──────────┴──────────────┴────────────────────────────────────────────────────────────────────┘ +``` + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/generate/) diff --git a/docs/es/sql-reference/table-functions/hdfs.md b/docs/es/sql-reference/table-functions/hdfs.md new file mode 100644 index 00000000000..9a5fa469130 --- /dev/null +++ b/docs/es/sql-reference/table-functions/hdfs.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 45 +toc_title: Hdfs +--- + +# Hdfs {#hdfs} + +Crea una tabla a partir de archivos en HDFS. Esta función de tabla es similar a [URL](url.md) y [file](file.md) aquel. + +``` sql +hdfs(URI, format, structure) +``` + +**Parámetros de entrada** + +- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` y `{N..M}` donde `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [formato](../../interfaces/formats.md#formats) del archivo. +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**Valor devuelto** + +Una tabla con la estructura especificada para leer o escribir datos en el archivo especificado. + +**Ejemplo** + +Tabla de `hdfs://hdfs1:9000/test` y selección de las dos primeras filas de ella: + +``` sql +SELECT * +FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +**Globs en el camino** + +Múltiples componentes de ruta de acceso pueden tener globs. Para ser procesado, el archivo debe existir y coincidir con todo el patrón de ruta (no solo el sufijo o el prefijo). + +- `*` — Substitutes any number of any characters except `/` incluyendo cadena vacía. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +Construcciones con `{}` son similares a la [función de tabla remota](../../sql-reference/table-functions/remote.md)). + +**Ejemplo** + +1. Supongamos que tenemos varios archivos con los siguientes URI en HDFS: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. Consulta la cantidad de filas en estos archivos: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. Consulta la cantidad de filas en todos los archivos de estos dos directorios: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "Advertencia" + Si su lista de archivos contiene rangos de números con ceros a la izquierda, use la construcción con llaves para cada dígito por separado o use `?`. + +**Ejemplo** + +Consultar los datos desde archivos nombrados `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## Virtual Columnas {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Ver también** + +- [Virtual columnas](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/es/sql-reference/table-functions/index.md b/docs/es/sql-reference/table-functions/index.md new file mode 100644 index 00000000000..64a46ac31ef --- /dev/null +++ b/docs/es/sql-reference/table-functions/index.md @@ -0,0 +1,38 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Table Functions +toc_priority: 34 +toc_title: "Implantaci\xF3n" +--- + +# Funciones De Tabla {#table-functions} + +Las funciones de tabla son métodos para construir tablas. + +Puede usar funciones de tabla en: + +- [FROM](../statements/select.md#select-from) cláusula de la `SELECT` consulta. + + The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. + +- [CREAR TABLA COMO \](../statements/create.md#create-table-query) consulta. + + It's one of the methods of creating a table. + +!!! warning "Advertencia" + No puede usar funciones de tabla si el [Método de codificación de datos:](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) la configuración está deshabilitada. + +| Función | Descripci | +|----------------------|----------------------------------------------------------------------------------------------------------------------------------------| +| [file](file.md) | Crea un [File](../../engines/table-engines/special/file.md)-mesa del motor. | +| [fusionar](merge.md) | Crea un [Fusionar](../../engines/table-engines/special/merge.md)-mesa del motor. | +| [numero](numbers.md) | Crea una tabla con una sola columna llena de números enteros. | +| [remoto](remote.md) | Le permite acceder a servidores remotos sin crear un [Distribuido](../../engines/table-engines/special/distributed.md)-mesa del motor. | +| [URL](url.md) | Crea un [URL](../../engines/table-engines/special/url.md)-mesa del motor. | +| [mysql](mysql.md) | Crea un [MySQL](../../engines/table-engines/integrations/mysql.md)-mesa del motor. | +| [jdbc](jdbc.md) | Crea un [JDBC](../../engines/table-engines/integrations/jdbc.md)-mesa del motor. | +| [Nosotros](odbc.md) | Crea un [ODBC](../../engines/table-engines/integrations/odbc.md)-mesa del motor. | +| [Hdfs](hdfs.md) | Crea un [HDFS](../../engines/table-engines/integrations/hdfs.md)-mesa del motor. | + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/es/sql_reference/table_functions/input.md b/docs/es/sql-reference/table-functions/input.md similarity index 100% rename from docs/es/sql_reference/table_functions/input.md rename to docs/es/sql-reference/table-functions/input.md diff --git a/docs/es/sql_reference/table_functions/jdbc.md b/docs/es/sql-reference/table-functions/jdbc.md similarity index 100% rename from docs/es/sql_reference/table_functions/jdbc.md rename to docs/es/sql-reference/table-functions/jdbc.md diff --git a/docs/es/sql_reference/table_functions/merge.md b/docs/es/sql-reference/table-functions/merge.md similarity index 100% rename from docs/es/sql_reference/table_functions/merge.md rename to docs/es/sql-reference/table-functions/merge.md diff --git a/docs/es/sql-reference/table-functions/mysql.md b/docs/es/sql-reference/table-functions/mysql.md new file mode 100644 index 00000000000..152916ea54a --- /dev/null +++ b/docs/es/sql-reference/table-functions/mysql.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 42 +toc_title: mysql +--- + +# mysql {#mysql} + +Permitir `SELECT` consultas que se realizarán en los datos que se almacenan en un servidor MySQL remoto. + +``` sql +mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +**Parámetros** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` consultas a `REPLACE INTO`. Si `replace_query=1`, la consulta se reemplaza. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expresión que se añade a la `INSERT` consulta. + + Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. + + To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. + +Simple `WHERE` cláusulas tales como `=, !=, >, >=, <, <=` se ejecutan actualmente en el servidor MySQL. + +El resto de las condiciones y el `LIMIT` La restricción de muestreo se ejecuta en ClickHouse solo después de que finalice la consulta a MySQL. + +**Valor devuelto** + +Un objeto de tabla con las mismas columnas que la tabla MySQL original. + +## Ejemplo De Uso {#usage-example} + +Tabla en MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Selección de datos de ClickHouse: + +``` sql +SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Ver también {#see-also} + +- [El ‘MySQL’ motor de mesa](../../engines/table-engines/integrations/mysql.md) +- [Uso de MySQL como fuente de diccionario externo](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/es/sql_reference/table_functions/numbers.md b/docs/es/sql-reference/table-functions/numbers.md similarity index 100% rename from docs/es/sql_reference/table_functions/numbers.md rename to docs/es/sql-reference/table-functions/numbers.md diff --git a/docs/es/sql-reference/table-functions/odbc.md b/docs/es/sql-reference/table-functions/odbc.md new file mode 100644 index 00000000000..aaa51b710a9 --- /dev/null +++ b/docs/es/sql-reference/table-functions/odbc.md @@ -0,0 +1,108 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 44 +toc_title: Nosotros +--- + +# Nosotros {#table-functions-odbc} + +Devuelve la tabla que está conectada a través de [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +``` sql +odbc(connection_settings, external_database, external_table) +``` + +Parámetros: + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` file. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +Para implementar con seguridad conexiones ODBC, ClickHouse usa un programa separado `clickhouse-odbc-bridge`. Si el controlador ODBC se carga directamente desde `clickhouse-server`, problemas de controlador pueden bloquear el servidor ClickHouse. ClickHouse se inicia automáticamente `clickhouse-odbc-bridge` cuando se requiere. El programa de puente ODBC se instala desde el mismo paquete que el `clickhouse-server`. + +Los campos con el `NULL` Los valores de la tabla externa se convierten en los valores predeterminados para el tipo de datos base. Por ejemplo, si un campo de tabla MySQL remoto tiene `INT NULL` tipo se convierte a 0 (el valor predeterminado para ClickHouse `Int32` tipo de datos). + +## Ejemplo De Uso {#usage-example} + +**Obtener datos de la instalación local de MySQL a través de ODBC** + +Este ejemplo se comprueba para Ubuntu Linux 18.04 y el servidor MySQL 5.7. + +Asegúrese de que unixODBC y MySQL Connector están instalados. + +De forma predeterminada (si se instala desde paquetes), ClickHouse comienza como usuario `clickhouse`. Por lo tanto, debe crear y configurar este usuario en el servidor MySQL. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +A continuación, configure la conexión en `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Puede verificar la conexión usando el `isql` utilidad desde la instalación de unixODBC. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +Tabla en MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Recuperación de datos de la tabla MySQL en ClickHouse: + +``` sql +SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ 0 │ 2 │ 0 │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Ver también {#see-also} + +- [Diccionarios externos ODBC](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [Motor de tabla ODBC](../../engines/table-engines/integrations/odbc.md). + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/es/sql-reference/table-functions/remote.md b/docs/es/sql-reference/table-functions/remote.md new file mode 100644 index 00000000000..3d46e1c56f9 --- /dev/null +++ b/docs/es/sql-reference/table-functions/remote.md @@ -0,0 +1,83 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 40 +toc_title: remoto +--- + +# remoto, remoteSecure {#remote-remotesecure} + +Le permite acceder a servidores remotos sin crear un `Distributed` tabla. + +Firma: + +``` sql +remote('addresses_expr', db, table[, 'user'[, 'password']]) +remote('addresses_expr', db.table[, 'user'[, 'password']]) +``` + +`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` o simplemente `host`. El host se puede especificar como nombre de servidor o como dirección IPv4 o IPv6. Una dirección IPv6 se especifica entre corchetes. El puerto es el puerto TCP del servidor remoto. Si se omite el puerto, utiliza `tcp_port` del archivo de configuración del servidor (por defecto, 9000). + +!!! important "Importante" + El puerto es necesario para una dirección IPv6. + +Ejemplos: + +``` text +example01-01-1 +example01-01-1:9000 +localhost +127.0.0.1 +[::]:9000 +[2a02:6b8:0:1111::11]:9000 +``` + +Se pueden separar varias direcciones por comas. En este caso, ClickHouse usará procesamiento distribuido, por lo que enviará la consulta a todas las direcciones especificadas (como a fragmentos con datos diferentes). + +Ejemplo: + +``` text +example01-01-1,example01-02-1 +``` + +Parte de la expresión se puede especificar entre llaves. El ejemplo anterior se puede escribir de la siguiente manera: + +``` text +example01-0{1,2}-1 +``` + +Los corchetes rizados pueden contener un rango de números separados por dos puntos (enteros no negativos). En este caso, el rango se expande a un conjunto de valores que generan direcciones de fragmentos. Si el primer número comienza con cero, los valores se forman con la misma alineación cero. El ejemplo anterior se puede escribir de la siguiente manera: + +``` text +example01-{01..02}-1 +``` + +Si tiene varios pares de llaves, genera el producto directo de los conjuntos correspondientes. + +Las direcciones y partes de las direcciones entre llaves se pueden separar mediante el símbolo de tubería (\|). En este caso, los conjuntos de direcciones correspondientes se interpretan como réplicas y la consulta se enviará a la primera réplica en buen estado. Sin embargo, las réplicas se iteran en el orden establecido actualmente en el [load\_balancing](../../operations/settings/settings.md) configuración. + +Ejemplo: + +``` text +example01-{01..02}-{1|2} +``` + +En este ejemplo se especifican dos fragmentos que tienen dos réplicas cada uno. + +El número de direcciones generadas está limitado por una constante. En este momento esto es 1000 direcciones. + +Uso de la `remote` función de la tabla es menos óptima que la creación de un `Distributed` mesa, porque en este caso, la conexión del servidor se restablece para cada solicitud. Además, si se establecen nombres de host, los nombres se resuelven y los errores no se cuentan cuando se trabaja con varias réplicas. Cuando procese un gran número de consultas, cree siempre el `Distributed` mesa antes de tiempo, y no utilice el `remote` función de la tabla. + +El `remote` puede ser útil en los siguientes casos: + +- Acceder a un servidor específico para la comparación de datos, la depuración y las pruebas. +- Consultas entre varios clústeres de ClickHouse con fines de investigación. +- Solicitudes distribuidas poco frecuentes que se realizan manualmente. +- Solicitudes distribuidas donde el conjunto de servidores se redefine cada vez. + +Si el usuario no está especificado, `default` se utiliza. +Si no se especifica la contraseña, se utiliza una contraseña vacía. + +`remoteSecure` - igual que `remote` but with secured connection. Default port — [Tcp\_port\_secure](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) de config o 9440. + +[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/es/sql_reference/table_functions/url.md b/docs/es/sql-reference/table-functions/url.md similarity index 100% rename from docs/es/sql_reference/table_functions/url.md rename to docs/es/sql-reference/table-functions/url.md diff --git a/docs/es/sql_reference/aggregate_functions/combinators.md b/docs/es/sql_reference/aggregate_functions/combinators.md deleted file mode 100644 index fb1ed37d427..00000000000 --- a/docs/es/sql_reference/aggregate_functions/combinators.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 37 -toc_title: Combinadores de funciones agregadas ---- - -# Combinadores de funciones agregadas {#aggregate_functions_combinators} - -El nombre de una función agregada puede tener un sufijo anexado. Esto cambia la forma en que funciona la función de agregado. - -## -Si {#agg-functions-combinator-if} - -The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). - -Ejemplos: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` y así sucesivamente. - -Con las funciones de agregado condicional, puede calcular agregados para varias condiciones a la vez, sin utilizar subconsultas y `JOIN`Por ejemplo, en Yandex.Metrica, las funciones de agregado condicional se utilizan para implementar la funcionalidad de comparación de segmentos. - -## -Matriz {#agg-functions-combinator-array} - -El sufijo -Array se puede agregar a cualquier función agregada. En este caso, la función de agregado toma argumentos del ‘Array(T)’ tipo (arrays) en lugar de ‘T’ argumentos de tipo. Si la función de agregado acepta varios argumentos, deben ser matrices de igual longitud. Al procesar matrices, la función de agregado funciona como la función de agregado original en todos los elementos de la matriz. - -Ejemplo 1: `sumArray(arr)` - Totales de todos los elementos de todos ‘arr’ matriz. En este ejemplo, podría haber sido escrito más simplemente: `sum(arraySum(arr))`. - -Ejemplo 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ matriz. Esto podría hacerse de una manera más fácil: `uniq(arrayJoin(arr))`, pero no siempre es posible agregar ‘arrayJoin’ a una consulta. - --If y -Array se pueden combinar. Obstante, ‘Array’ debe venir primero, entonces ‘If’. Ejemplos: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. Debido a este pedido, el ‘cond’ argumento no será una matriz. - -## -Estado {#agg-functions-combinator-state} - -Si aplica este combinador, la función de agregado no devuelve el valor resultante (como el número de valores únicos para el [uniq](reference.md#agg_function-uniq) función), pero un estado intermedio de la agregación (para `uniq`, esta es la tabla hash para calcular el número de valores únicos). Este es un `AggregateFunction(...)` que puede ser utilizado para su posterior procesamiento o almacenado en una tabla para terminar de agregar más tarde. - -Para trabajar con estos estados, use: - -- [AgregaciónMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) motor de mesa. -- [finalizeAggregation](../../sql_reference/functions/other_functions.md#function-finalizeaggregation) función. -- [runningAccumulate](../../sql_reference/functions/other_functions.md#function-runningaccumulate) función. -- [-Fusionar](#aggregate_functions_combinators_merge) combinador. -- [-MergeState](#aggregate_functions_combinators_mergestate) combinador. - -## -Fusionar {#aggregate_functions_combinators-merge} - -Si aplica este combinador, la función de agregado toma el estado de agregación intermedio como argumento, combina los estados para finalizar la agregación y devuelve el valor resultante. - -## -MergeState {#aggregate_functions_combinators-mergestate} - -Combina los estados de agregación intermedios de la misma manera que el combinador -Merge. Sin embargo, no devuelve el valor resultante, sino un estado de agregación intermedio, similar al combinador -State. - -## -ForEach {#agg-functions-combinator-foreach} - -Convierte una función de agregado para tablas en una función de agregado para matrices que agrega los elementos de matriz correspondientes y devuelve una matriz de resultados. Por ejemplo, `sumForEach` para las matrices `[1, 2]`, `[3, 4, 5]`y`[6, 7]`devuelve el resultado `[10, 13, 5]` después de agregar los elementos de la matriz correspondientes. - -## -OPor defecto {#agg-functions-combinator-ordefault} - -Rellena el valor predeterminado del tipo devuelto de la función de agregado si no hay nada que agregar. - -``` sql -SELECT avg(number), avgOrDefault(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrDefault(number)─┐ -│ nan │ 0 │ -└─────────────┴──────────────────────┘ -``` - -## -OrNull {#agg-functions-combinator-ornull} - -Llenar `null` si no hay nada que agregar. La columna de retorno será anulable. - -``` sql -SELECT avg(number), avgOrNull(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrNull(number)─┐ -│ nan │ ᴺᵁᴸᴸ │ -└─────────────┴───────────────────┘ -``` - --OrDefault y -OrNull se pueden combinar con otros combinadores. Es útil cuando la función de agregado no acepta la entrada vacía. - -``` sql -SELECT avgOrNullIf(x, x > 10) -FROM -( - SELECT toDecimal32(1.23, 2) AS x -) -``` - -``` text -┌─avgOrNullIf(x, greater(x, 10))─┐ -│ ᴺᵁᴸᴸ │ -└────────────────────────────────┘ -``` - -## -Remuestrear {#agg-functions-combinator-resample} - -Permite dividir los datos en grupos y, a continuación, agregar por separado los datos de esos grupos. Los grupos se crean dividiendo los valores de una columna en intervalos. - -``` sql -Resample(start, end, step)(, resampling_key) -``` - -**Parámetros** - -- `start` — Starting value of the whole required interval for `resampling_key` valor. -- `stop` — Ending value of the whole required interval for `resampling_key` valor. Todo el intervalo no incluye el `stop` valor `[start, stop)`. -- `step` — Step for separating the whole interval into subintervals. The `aggFunction` se ejecuta sobre cada uno de esos subintervalos de forma independiente. -- `resampling_key` — Column whose values are used for separating data into intervals. -- `aggFunction_params` — `aggFunction` parámetros. - -**Valores devueltos** - -- Matriz de `aggFunction` resultados para cada subintervalo. - -**Ejemplo** - -Considere el `people` con los siguientes datos: - -``` text -┌─name───┬─age─┬─wage─┐ -│ John │ 16 │ 10 │ -│ Alice │ 30 │ 15 │ -│ Mary │ 35 │ 8 │ -│ Evelyn │ 48 │ 11.5 │ -│ David │ 62 │ 9.9 │ -│ Brian │ 60 │ 16 │ -└────────┴─────┴──────┘ -``` - -Obtengamos los nombres de las personas cuya edad se encuentra en los intervalos de `[30,60)` y `[60,75)`. Como usamos la representación entera para la edad, obtenemos edades en el `[30, 59]` y `[60,74]` intervalo. - -Para agregar nombres en una matriz, usamos el [Método de codificación de datos:](reference.md#agg_function-grouparray) función de agregado. Se necesita un argumento. En nuestro caso, es el `name` columna. El `groupArrayResample` función debe utilizar el `age` columna para agregar nombres por edad. Para definir los intervalos requeridos, pasamos el `30, 75, 30` discusiones sobre el `groupArrayResample` función. - -``` sql -SELECT groupArrayResample(30, 75, 30)(name, age) FROM people -``` - -``` text -┌─groupArrayResample(30, 75, 30)(name, age)─────┐ -│ [['Alice','Mary','Evelyn'],['David','Brian']] │ -└───────────────────────────────────────────────┘ -``` - -Considera los resultados. - -`Jonh` est? fuera de la muestra porque es demasiado joven. Otras personas se distribuyen de acuerdo con los intervalos de edad especificados. - -Ahora vamos a contar el número total de personas y su salario promedio en los intervalos de edad especificados. - -``` sql -SELECT - countResample(30, 75, 30)(name, age) AS amount, - avgResample(30, 75, 30)(wage, age) AS avg_wage -FROM people -``` - -``` text -┌─amount─┬─avg_wage──────────────────┐ -│ [3,2] │ [11.5,12.949999809265137] │ -└────────┴───────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/es/sql_reference/aggregate_functions/index.md b/docs/es/sql_reference/aggregate_functions/index.md deleted file mode 100644 index 6075dddb3e3..00000000000 --- a/docs/es/sql_reference/aggregate_functions/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Aggregate Functions -toc_priority: 33 -toc_title: "Implantaci\xF3n" ---- - -# Funciones agregadas {#aggregate-functions} - -Las funciones agregadas funcionan en el [normal](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) forma esperada por los expertos en bases de datos. - -ClickHouse también es compatible: - -- [Funciones agregadas paramétricas](parametric_functions.md#aggregate_functions_parametric) que aceptan otros parámetros además de las columnas. -- [Combinadores](combinators.md#aggregate_functions_combinators), que cambian el comportamiento de las funciones agregadas. - -## Procesamiento NULL {#null-processing} - -Durante la agregación, todos `NULL`s se omiten. - -**Ejemplos:** - -Considere esta tabla: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -Digamos que necesita sumar los valores en el `y` columna: - -``` sql -SELECT sum(y) FROM t_null_big -``` - - ┌─sum(y)─┐ - │ 7 │ - └────────┘ - -El `sum` función interpreta `NULL` como `0`. En particular, esto significa que si la función recibe la entrada de una selección donde todos los valores son `NULL`, entonces el resultado será `0`, ni `NULL`. - -Ahora puedes usar el `groupArray` función para crear una matriz a partir de la `y` columna: - -``` sql -SELECT groupArray(y) FROM t_null_big -``` - -``` text -┌─groupArray(y)─┐ -│ [2,2,3] │ -└───────────────┘ -``` - -`groupArray` no incluye `NULL` en la matriz resultante. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/es/sql_reference/aggregate_functions/parametric_functions.md b/docs/es/sql_reference/aggregate_functions/parametric_functions.md deleted file mode 100644 index f51168d1087..00000000000 --- a/docs/es/sql_reference/aggregate_functions/parametric_functions.md +++ /dev/null @@ -1,499 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 38 -toc_title: "Funciones agregadas param\xE9tricas" ---- - -# Funciones agregadas paramétricas {#aggregate_functions_parametric} - -Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. - -## histograma {#histogram} - -Calcula un histograma adaptativo. No garantiza resultados precisos. - -``` sql -histogram(number_of_bins)(values) -``` - -Las funciones utiliza [Un algoritmo de árbol de decisión paralelo de transmisión](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Los bordes de los contenedores de histograma se ajustan a medida que los nuevos datos entran en una función. En caso común, los anchos de los contenedores no son iguales. - -**Parámetros** - -`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. -`values` — [Expresion](../syntax.md#syntax-expressions) resultando en valores de entrada. - -**Valores devueltos** - -- [Matriz](../../sql_reference/data_types/array.md) de [Tuples](../../sql_reference/data_types/tuple.md) del siguiente formato: - - ``` - [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] - ``` - - - `lower` — Lower bound of the bin. - - `upper` — Upper bound of the bin. - - `height` — Calculated height of the bin. - -**Ejemplo** - -``` sql -SELECT histogram(5)(number + 1) -FROM ( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ -│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -Puede visualizar un histograma con el [Bar](../../sql_reference/functions/other_functions.md#function-bar) función, por ejemplo: - -``` sql -WITH histogram(5)(rand() % 100) AS hist -SELECT - arrayJoin(hist).3 AS height, - bar(height, 0, 6, 5) AS bar -FROM -( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─height─┬─bar───┐ -│ 2.125 │ █▋ │ -│ 3.25 │ ██▌ │ -│ 5.625 │ ████▏ │ -│ 5.625 │ ████▏ │ -│ 3.375 │ ██▌ │ -└────────┴───────┘ -``` - -En este caso, debe recordar que no conoce los bordes del contenedor del histograma. - -## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} - -Comprueba si la secuencia contiene una cadena de eventos que coincida con el patrón. - -``` sql -sequenceMatch(pattern)(timestamp, cond1, cond2, ...) -``` - -!!! warning "Advertencia" - Los eventos que ocurren en el mismo segundo pueden estar en la secuencia en un orden indefinido que afecta el resultado. - -**Parámetros** - -- `pattern` — Pattern string. See [Sintaxis de patrón](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` y `DateTime`. También puede utilizar cualquiera de los [UInt](../../sql_reference/data_types/int_uint.md) tipos de datos. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Puede pasar hasta 32 argumentos de condición. La función sólo tiene en cuenta los eventos descritos en estas condiciones. Si la secuencia contiene datos que no se describen en una condición, la función los omite. - -**Valores devueltos** - -- 1, si el patrón coincide. -- 0, si el patrón no coincide. - -Tipo: `UInt8`. - - -**Sintaxis de patrón** - -- `(?N)` — Matches the condition argument at position `N`. Las condiciones están numeradas en el `[1, 32]` gama. Por ejemplo, `(?1)` coincide con el argumento pasado al `cond1` parámetro. - -- `.*` — Matches any number of events. You don't need conditional arguments to match this element of the pattern. - -- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` coincide con los eventos que ocurren a más de 1800 segundos el uno del otro. Un número arbitrario de cualquier evento puede estar entre estos eventos. Puede usar el `>=`, `>`, `<`, `<=` operador. - -**Ejemplos** - -Considere los datos en el `t` tabla: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -└──────┴────────┘ -``` - -Realizar la consulta: - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 1 │ -└───────────────────────────────────────────────────────────────────────┘ -``` - -La función encontró la cadena de eventos donde el número 2 sigue al número 1. Se saltó el número 3 entre ellos, porque el número no se describe como un evento. Si queremos tener en cuenta este número al buscar la cadena de eventos dada en el ejemplo, debemos establecer una condición para ello. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ -│ 0 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -En este caso, la función no pudo encontrar la cadena de eventos que coincida con el patrón, porque el evento para el número 3 ocurrió entre 1 y 2. Si en el mismo caso comprobamos la condición para el número 4, la secuencia coincidiría con el patrón. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ -│ 1 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Ver también** - -- [sequenceCount](#function-sequencecount) - -## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} - -Cuenta el número de cadenas de eventos que coinciden con el patrón. La función busca cadenas de eventos que no se superponen. Comienza a buscar la siguiente cadena después de que se haga coincidir la cadena actual. - -!!! warning "Advertencia" - Los eventos que ocurren en el mismo segundo pueden estar en la secuencia en un orden indefinido que afecta el resultado. - -``` sql -sequenceCount(pattern)(timestamp, cond1, cond2, ...) -``` - -**Parámetros** - -- `pattern` — Pattern string. See [Sintaxis de patrón](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` y `DateTime`. También puede utilizar cualquiera de los [UInt](../../sql_reference/data_types/int_uint.md) tipos de datos. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Puede pasar hasta 32 argumentos de condición. La función sólo tiene en cuenta los eventos descritos en estas condiciones. Si la secuencia contiene datos que no se describen en una condición, la función los omite. - -**Valores devueltos** - -- Número de cadenas de eventos no superpuestas que coinciden. - -Tipo: `UInt64`. - -**Ejemplo** - -Considere los datos en el `t` tabla: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -│ 4 │ 1 │ -│ 5 │ 3 │ -│ 6 │ 2 │ -└──────┴────────┘ -``` - -Cuente cuántas veces ocurre el número 2 después del número 1 con cualquier cantidad de otros números entre ellos: - -``` sql -SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 2 │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -**Ver también** - -- [sequenceMatch](#function-sequencematch) - -## ventanaEmbudo {#windowfunnel} - -Busca cadenas de eventos en una ventana de tiempo deslizante y calcula el número máximo de eventos que ocurrieron desde la cadena. - -La función funciona de acuerdo con el algoritmo: - -- La función busca datos que desencadenan la primera condición en la cadena y establece el contador de eventos en 1. Este es el momento en que comienza la ventana deslizante. - -- Si los eventos de la cadena ocurren secuencialmente dentro de la ventana, el contador se incrementa. Si se interrumpe la secuencia de eventos, el contador no se incrementa. - -- Si los datos tienen varias cadenas de eventos en diferentes puntos de finalización, la función solo generará el tamaño de la cadena más larga. - -**Sintaxis** - -``` sql -windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) -``` - -**Parámetros** - -- `window` — Length of the sliding window in seconds. -- `mode` - Es un argumento opcional. - - `'strict'` - Cuando el `'strict'` se establece, windowFunnel() aplica condiciones solo para los valores únicos. -- `timestamp` — Name of the column containing the timestamp. Data types supported: [Fecha](../../sql_reference/data_types/date.md), [FechaHora](../../sql_reference/data_types/datetime.md#data_type-datetime) y otros tipos de enteros sin signo (tenga en cuenta que aunque timestamp admite el `UInt64` tipo, su valor no puede exceder el máximo de Int64, que es 2 ^ 63 - 1). -- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valor devuelto** - -El número máximo de condiciones desencadenadas consecutivas de la cadena dentro de la ventana de tiempo deslizante. -Se analizan todas las cadenas en la selección. - -Tipo: `Integer`. - -**Ejemplo** - -Determine si un período de tiempo establecido es suficiente para que el usuario seleccione un teléfono y lo compre dos veces en la tienda en línea. - -Establezca la siguiente cadena de eventos: - -1. El usuario inició sesión en su cuenta en la tienda (`eventID = 1003`). -2. El usuario busca un teléfono (`eventID = 1007, product = 'phone'`). -3. El usuario realizó un pedido (`eventID = 1009`). -4. El usuario volvió a realizar el pedido (`eventID = 1010`). - -Tabla de entrada: - -``` text -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -``` - -Averigüe hasta qué punto el usuario `user_id` podría atravesar la cadena en un período de enero a febrero de 2019. - -Consulta: - -``` sql -SELECT - level, - count() AS c -FROM -( - SELECT - user_id, - windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level - FROM trend - WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') - GROUP BY user_id -) -GROUP BY level -ORDER BY level ASC -``` - -Resultado: - -``` text -┌─level─┬─c─┐ -│ 4 │ 1 │ -└───────┴───┘ -``` - -## retención {#retention} - -La función toma como argumentos un conjunto de condiciones de 1 a 32 argumentos de tipo `UInt8` que indican si se cumplió una determinada condición para el evento. -Cualquier condición se puede especificar como un argumento (como en [WHERE](../../sql_reference/statements/select.md#select-where)). - -Las condiciones, excepto la primera, se aplican en pares: el resultado del segundo será verdadero si el primero y el segundo son verdaderos, del tercero si el primero y el fird son verdaderos, etc. - -**Sintaxis** - -``` sql -retention(cond1, cond2, ..., cond32); -``` - -**Parámetros** - -- `cond` — an expression that returns a `UInt8` resultado (1 o 0). - -**Valor devuelto** - -La matriz de 1 o 0. - -- 1 — condition was met for the event. -- 0 — condition wasn't met for the event. - -Tipo: `UInt8`. - -**Ejemplo** - -Consideremos un ejemplo de cálculo del `retention` función para determinar el tráfico del sitio. - -**1.** Сreate a table to illustrate an example. - -``` sql -CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; - -INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); -INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); -INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); -``` - -Tabla de entrada: - -Consulta: - -``` sql -SELECT * FROM retention_test -``` - -Resultado: - -``` text -┌───────date─┬─uid─┐ -│ 2020-01-01 │ 0 │ -│ 2020-01-01 │ 1 │ -│ 2020-01-01 │ 2 │ -│ 2020-01-01 │ 3 │ -│ 2020-01-01 │ 4 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-02 │ 0 │ -│ 2020-01-02 │ 1 │ -│ 2020-01-02 │ 2 │ -│ 2020-01-02 │ 3 │ -│ 2020-01-02 │ 4 │ -│ 2020-01-02 │ 5 │ -│ 2020-01-02 │ 6 │ -│ 2020-01-02 │ 7 │ -│ 2020-01-02 │ 8 │ -│ 2020-01-02 │ 9 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-03 │ 0 │ -│ 2020-01-03 │ 1 │ -│ 2020-01-03 │ 2 │ -│ 2020-01-03 │ 3 │ -│ 2020-01-03 │ 4 │ -│ 2020-01-03 │ 5 │ -│ 2020-01-03 │ 6 │ -│ 2020-01-03 │ 7 │ -│ 2020-01-03 │ 8 │ -│ 2020-01-03 │ 9 │ -│ 2020-01-03 │ 10 │ -│ 2020-01-03 │ 11 │ -│ 2020-01-03 │ 12 │ -│ 2020-01-03 │ 13 │ -│ 2020-01-03 │ 14 │ -└────────────┴─────┘ -``` - -**2.** Agrupar usuarios por ID único `uid` utilizando el `retention` función. - -Consulta: - -``` sql -SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r -FROM retention_test -WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') -GROUP BY uid -ORDER BY uid ASC -``` - -Resultado: - -``` text -┌─uid─┬─r───────┐ -│ 0 │ [1,1,1] │ -│ 1 │ [1,1,1] │ -│ 2 │ [1,1,1] │ -│ 3 │ [1,1,1] │ -│ 4 │ [1,1,1] │ -│ 5 │ [0,0,0] │ -│ 6 │ [0,0,0] │ -│ 7 │ [0,0,0] │ -│ 8 │ [0,0,0] │ -│ 9 │ [0,0,0] │ -│ 10 │ [0,0,0] │ -│ 11 │ [0,0,0] │ -│ 12 │ [0,0,0] │ -│ 13 │ [0,0,0] │ -│ 14 │ [0,0,0] │ -└─────┴─────────┘ -``` - -**3.** Calcule el número total de visitas al sitio por día. - -Consulta: - -``` sql -SELECT - sum(r[1]) AS r1, - sum(r[2]) AS r2, - sum(r[3]) AS r3 -FROM -( - SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r - FROM retention_test - WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') - GROUP BY uid -) -``` - -Resultado: - -``` text -┌─r1─┬─r2─┬─r3─┐ -│ 5 │ 5 │ 5 │ -└────┴────┴────┘ -``` - -Donde: - -- `r1`- el número de visitantes únicos que visitaron el sitio durante 2020-01-01 (la `cond1` condición). -- `r2`- el número de visitantes únicos que visitaron el sitio durante un período de tiempo específico entre 2020-01-01 y 2020-01-02 (`cond1` y `cond2` condición). -- `r3`- el número de visitantes únicos que visitaron el sitio durante un período de tiempo específico entre 2020-01-01 y 2020-01-03 (`cond1` y `cond3` condición). - -## UniqUpTo(N)(x) {#uniquptonx} - -Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. - -Recomendado para usar con Ns pequeños, hasta 10. El valor máximo de N es 100. - -Para el estado de una función agregada, utiliza la cantidad de memoria igual a 1 + N \* el tamaño de un valor de bytes. -Para las cadenas, almacena un hash no criptográfico de 8 bytes. Es decir, el cálculo se aproxima a las cadenas. - -La función también funciona para varios argumentos. - -Funciona lo más rápido posible, excepto en los casos en que se usa un valor N grande y el número de valores únicos es ligeramente menor que N. - -Ejemplo de uso: - -``` text -Problem: Generate a report that shows only keywords that produced at least 5 unique users. -Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) - -## sumMapFiltered(keys\_to\_keep)(claves, valores) {#summapfilteredkeys-to-keepkeys-values} - -El mismo comportamiento que [sumMap](reference.md#agg_functions-summap) excepto que una matriz de claves se pasa como un parámetro. Esto puede ser especialmente útil cuando se trabaja con una alta cardinalidad de claves. diff --git a/docs/es/sql_reference/aggregate_functions/reference.md b/docs/es/sql_reference/aggregate_functions/reference.md deleted file mode 100644 index 1688cbe0160..00000000000 --- a/docs/es/sql_reference/aggregate_functions/reference.md +++ /dev/null @@ -1,1837 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 36 -toc_title: Referencia ---- - -# Referencia de la función {#function-reference} - -## contar {#agg_function-count} - -Cuenta el número de filas o valores no NULL. - -ClickHouse admite las siguientes sintaxis para `count`: -- `count(expr)` o `COUNT(DISTINCT expr)`. -- `count()` o `COUNT(*)`. El `count()` la sintaxis es específica de ClickHouse. - -**Parámetros** - -La función puede tomar: - -- Cero de los parámetros. -- Una [expresion](../syntax.md#syntax-expressions). - -**Valor devuelto** - -- Si se llama a la función sin parámetros, cuenta el número de filas. -- Si el [expresion](../syntax.md#syntax-expressions) se pasa, entonces la función cuenta cuántas veces esta expresión devuelve no nula. Si la expresión devuelve un [NULL](../../sql_reference/data_types/nullable.md)-type valor, entonces el resultado de `count` no se queda `Nullable`. La función devuelve 0 si la expresión devuelta `NULL` para todas las filas. - -En ambos casos el tipo del valor devuelto es [UInt64](../../sql_reference/data_types/int_uint.md). - -**Detalles** - -ClickHouse soporta el `COUNT(DISTINCT ...)` sintaxis. El comportamiento de esta construcción depende del [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) configuración. Define cuál de las [uniq\*](#agg_function-uniq) se utiliza para realizar la operación. El valor predeterminado es el [uniqExact](#agg_function-uniqexact) función. - -El `SELECT count() FROM table` consulta no está optimizado, porque el número de entradas en la tabla no se almacena por separado. Elige una pequeña columna de la tabla y cuenta el número de valores en ella. - -**Ejemplos** - -Ejemplo 1: - -``` sql -SELECT count() FROM t -``` - -``` text -┌─count()─┐ -│ 5 │ -└─────────┘ -``` - -Ejemplo 2: - -``` sql -SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' -``` - -``` text -┌─name──────────────────────────┬─value─────┐ -│ count_distinct_implementation │ uniqExact │ -└───────────────────────────────┴───────────┘ -``` - -``` sql -SELECT count(DISTINCT num) FROM t -``` - -``` text -┌─uniqExact(num)─┐ -│ 3 │ -└────────────────┘ -``` - -Este ejemplo muestra que `count(DISTINCT num)` se realiza por el `uniqExact` función según el `count_distinct_implementation` valor de ajuste. - -## cualquiera (x) {#agg_function-any} - -Selecciona el primer valor encontrado. -La consulta se puede ejecutar en cualquier orden e incluso en un orden diferente cada vez, por lo que el resultado de esta función es indeterminado. -Para obtener un resultado determinado, puede usar el ‘min’ o ‘max’ función en lugar de ‘any’. - -En algunos casos, puede confiar en el orden de ejecución. Esto se aplica a los casos en que SELECT proviene de una subconsulta que usa ORDER BY. - -Cuando un `SELECT` consulta tiene el `GROUP BY` cláusula o al menos una función agregada, ClickHouse (en contraste con MySQL) requiere que todas las expresiones `SELECT`, `HAVING`, y `ORDER BY` las cláusulas pueden calcularse a partir de claves o de funciones agregadas. En otras palabras, cada columna seleccionada de la tabla debe usarse en claves o dentro de funciones agregadas. Para obtener un comportamiento como en MySQL, puede colocar las otras columnas en el `any` función de agregado. - -## Cualquier pesado (x) {#anyheavyx} - -Selecciona un valor que ocurre con frecuencia [pesos pesados](http://www.cs.umd.edu/~samir/498/karp.pdf) algoritmo. Si hay un valor que se produce más de la mitad de los casos en cada uno de los subprocesos de ejecución de la consulta, se devuelve este valor. Normalmente, el resultado es no determinista. - -``` sql -anyHeavy(column) -``` - -**Argumento** - -- `column` – The column name. - -**Ejemplo** - -Tome el [A tiempo](../../getting_started/example_datasets/ontime.md) conjunto de datos y seleccione cualquier valor que ocurra con frecuencia `AirlineID` columna. - -``` sql -SELECT anyHeavy(AirlineID) AS res -FROM ontime -``` - -``` text -┌───res─┐ -│ 19690 │ -└───────┘ -``` - -## Cualquier último (x) {#anylastx} - -Selecciona el último valor encontrado. -El resultado es tan indeterminado como para el `any` función. - -## Método de codificación de datos: {#groupbitand} - -Se aplica bit a bit `AND` para la serie de números. - -``` sql -groupBitAnd(expr) -``` - -**Parámetros** - -`expr` – An expression that results in `UInt*` tipo. - -**Valor de retorno** - -Valor de la `UInt*` tipo. - -**Ejemplo** - -Datos de prueba: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Consulta: - -``` sql -SELECT groupBitAnd(num) FROM t -``` - -Donde `num` es la columna con los datos de prueba. - -Resultado: - -``` text -binary decimal -00000100 = 4 -``` - -## GrupoBitO {#groupbitor} - -Se aplica bit a bit `OR` para la serie de números. - -``` sql -groupBitOr(expr) -``` - -**Parámetros** - -`expr` – An expression that results in `UInt*` tipo. - -**Valor de retorno** - -Valor de la `UInt*` tipo. - -**Ejemplo** - -Datos de prueba: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Consulta: - -``` sql -SELECT groupBitOr(num) FROM t -``` - -Donde `num` es la columna con los datos de prueba. - -Resultado: - -``` text -binary decimal -01111101 = 125 -``` - -## GrupoBitXor {#groupbitxor} - -Se aplica bit a bit `XOR` para la serie de números. - -``` sql -groupBitXor(expr) -``` - -**Parámetros** - -`expr` – An expression that results in `UInt*` tipo. - -**Valor de retorno** - -Valor de la `UInt*` tipo. - -**Ejemplo** - -Datos de prueba: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Consulta: - -``` sql -SELECT groupBitXor(num) FROM t -``` - -Donde `num` es la columna con los datos de prueba. - -Resultado: - -``` text -binary decimal -01101000 = 104 -``` - -## Método de codificación de datos: {#groupbitmap} - -Mapa de bits o cálculos agregados de una columna entera sin signo, devuelve cardinalidad de tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmap(expr) -``` - -**Parámetros** - -`expr` – An expression that results in `UInt*` tipo. - -**Valor de retorno** - -Valor de la `UInt64` tipo. - -**Ejemplo** - -Datos de prueba: - -``` text -UserID -1 -1 -2 -3 -``` - -Consulta: - -``` sql -SELECT groupBitmap(UserID) as num FROM t -``` - -Resultado: - -``` text -num -3 -``` - -## Mínimo (x) {#agg_function-min} - -Calcula el mínimo. - -## máximo (x) {#agg_function-max} - -Calcula el máximo. - -## ¿Cómo puedo hacerlo?) {#agg-function-argmin} - -Calcula el ‘arg’ para un valor mínimo ‘val’ valor. Si hay varios valores diferentes de ‘arg’ para valores mínimos de ‘val’, el primero de estos valores encontrados es la salida. - -**Ejemplo:** - -``` text -┌─user─────┬─salary─┐ -│ director │ 5000 │ -│ manager │ 3000 │ -│ worker │ 1000 │ -└──────────┴────────┘ -``` - -``` sql -SELECT argMin(user, salary) FROM salary -``` - -``` text -┌─argMin(user, salary)─┐ -│ worker │ -└──────────────────────┘ -``` - -## Descripción) {#agg-function-argmax} - -Calcula el ‘arg’ para un valor máximo ‘val’ valor. Si hay varios valores diferentes de ‘arg’ para valores máximos de ‘val’, el primero de estos valores encontrados es la salida. - -## suma (x) {#agg_function-sum} - -Calcula la suma. -Solo funciona para números. - -## ¿Cómo puedo obtener más información?) {#sumwithoverflowx} - -Calcula la suma de los números, utilizando el mismo tipo de datos para el resultado que para los parámetros de entrada. Si la suma supera el valor máximo para este tipo de datos, la función devuelve un error. - -Solo funciona para números. - -## sumMap(clave, valor) {#agg_functions-summap} - -Totals el ‘value’ matriz de acuerdo con las claves especificadas en el ‘key’ matriz. -El número de elementos en ‘key’ y ‘value’ debe ser el mismo para cada fila que se sume. -Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. - -Ejemplo: - -``` sql -CREATE TABLE sum_map( - date Date, - timeslot DateTime, - statusMap Nested( - status UInt16, - requests UInt64 - ) -) ENGINE = Log; -INSERT INTO sum_map VALUES - ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); -SELECT - timeslot, - sumMap(statusMap.status, statusMap.requests) -FROM sum_map -GROUP BY timeslot -``` - -``` text -┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ -│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ -│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ -└─────────────────────┴──────────────────────────────────────────────┘ -``` - -## SkewPop {#skewpop} - -Calcula el [la asimetría](https://en.wikipedia.org/wiki/Skewness) de una secuencia. - -``` sql -skewPop(expr) -``` - -**Parámetros** - -`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. - -**Valor devuelto** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**Ejemplo** - -``` sql -SELECT skewPop(value) FROM series_with_value_column -``` - -## Sistema abierto. {#skewsamp} - -Calcula el [asimetría de la muestra](https://en.wikipedia.org/wiki/Skewness) de una secuencia. - -Representa una estimación imparcial de la asimetría de una variable aleatoria si los valores pasados forman su muestra. - -``` sql -skewSamp(expr) -``` - -**Parámetros** - -`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. - -**Valor devuelto** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). Si `n <= 1` (`n` es el tamaño de la muestra), luego la función devuelve `nan`. - -**Ejemplo** - -``` sql -SELECT skewSamp(value) FROM series_with_value_column -``` - -## KurtPop {#kurtpop} - -Calcula el [curtosis](https://en.wikipedia.org/wiki/Kurtosis) de una secuencia. - -``` sql -kurtPop(expr) -``` - -**Parámetros** - -`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. - -**Valor devuelto** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**Ejemplo** - -``` sql -SELECT kurtPop(value) FROM series_with_value_column -``` - -## KurtSamp {#kurtsamp} - -Calcula el [curtosis muestra](https://en.wikipedia.org/wiki/Kurtosis) de una secuencia. - -Representa una estimación imparcial de la curtosis de una variable aleatoria si los valores pasados forman su muestra. - -``` sql -kurtSamp(expr) -``` - -**Parámetros** - -`expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número. - -**Valor devuelto** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). Si `n <= 1` (`n` es un tamaño de la muestra), luego la función devuelve `nan`. - -**Ejemplo** - -``` sql -SELECT kurtSamp(value) FROM series_with_value_column -``` - -## Para obtener más información, consulta nuestra Política de privacidad y nuestras Condiciones de uso) {#agg-function-timeseriesgroupsum} - -`timeSeriesGroupSum` puede agregar diferentes series de tiempo que muestran la marca de tiempo no la alineación. -Utilizará la interpolación lineal entre dos marcas de tiempo de muestra y luego sumará series temporales juntas. - -- `uid` es la identificación única de la serie temporal, `UInt64`. -- `timestamp` es el tipo Int64 para admitir milisegundos o microsegundos. -- `value` es la métrica. - -La función devuelve una matriz de tuplas con `(timestamp, aggregated_value)` par. - -Antes de utilizar esta función, asegúrese de `timestamp` está en orden ascendente. - -Ejemplo: - -``` text -┌─uid─┬─timestamp─┬─value─┐ -│ 1 │ 2 │ 0.2 │ -│ 1 │ 7 │ 0.7 │ -│ 1 │ 12 │ 1.2 │ -│ 1 │ 17 │ 1.7 │ -│ 1 │ 25 │ 2.5 │ -│ 2 │ 3 │ 0.6 │ -│ 2 │ 8 │ 1.6 │ -│ 2 │ 12 │ 2.4 │ -│ 2 │ 18 │ 3.6 │ -│ 2 │ 24 │ 4.8 │ -└─────┴───────────┴───────┘ -``` - -``` sql -CREATE TABLE time_series( - uid UInt64, - timestamp Int64, - value Float64 -) ENGINE = Memory; -INSERT INTO time_series VALUES - (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), - (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); - -SELECT timeSeriesGroupSum(uid, timestamp, value) -FROM ( - SELECT * FROM time_series order by timestamp ASC -); -``` - -Y el resultado será: - -``` text -[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] -``` - -## También puede utilizar el siguiente ejemplo:) {#agg-function-timeseriesgroupratesum} - -Del mismo modo timeSeriesGroupRateSum, timeSeriesGroupRateSum calculará la tasa de series temporales y luego sumará las tasas juntas. -Además, la marca de tiempo debe estar en orden ascendente antes de usar esta función. - -Use esta función, el resultado anterior será: - -``` text -[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] -``` - -## Acerca de) {#agg_function-avg} - -Calcula el promedio. -Solo funciona para números. -El resultado es siempre Float64. - -## uniq {#agg_function-uniq} - -Calcula el número aproximado de diferentes valores del argumento. - -``` sql -uniq(x[, ...]) -``` - -**Parámetros** - -La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. - -**Valor devuelto** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-tipo número. - -**Detalles de implementación** - -Función: - -- Calcula un hash para todos los parámetros en el agregado, luego lo usa en los cálculos. - -- Utiliza un algoritmo de muestreo adaptativo. Para el estado de cálculo, la función utiliza una muestra de valores hash de elemento de hasta 65536. - - This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. - -- Proporciona el resultado de forma determinista (no depende del orden de procesamiento de la consulta). - -Recomendamos usar esta función en casi todos los escenarios. - -**Ver también** - -- [uniqCombined](#agg_function-uniqcombined) -- [UniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined {#agg_function-uniqcombined} - -Calcula el número aproximado de diferentes valores de argumento. - -``` sql -uniqCombined(HLL_precision)(x[, ...]) -``` - -El `uniqCombined` es una buena opción para calcular el número de valores diferentes. - -**Parámetros** - -La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. - -`HLL_precision` es el logaritmo base-2 del número de células en [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). Opcional, puede utilizar la función como `uniqCombined(x[, ...])`. El valor predeterminado para `HLL_precision` es 17, que es efectivamente 96 KiB de espacio (2 ^ 17 celdas, 6 bits cada una). - -**Valor devuelto** - -- Un número [UInt64](../../sql_reference/data_types/int_uint.md)-tipo número. - -**Detalles de implementación** - -Función: - -- Calcula un hash (hash de 64 bits para `String` y 32 bits de lo contrario) para todos los parámetros en el agregado, luego lo usa en los cálculos. - -- Utiliza una combinación de tres algoritmos: matriz, tabla hash e HyperLogLog con una tabla de corrección de errores. - - For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. - -- Proporciona el resultado de forma determinista (no depende del orden de procesamiento de la consulta). - -!!! note "Nota" - Dado que usa hash de 32 bits para no-`String` tipo, el resultado tendrá un error muy alto para cardinalidades significativamente mayores que `UINT_MAX` (el error aumentará rápidamente después de unas pocas decenas de miles de millones de valores distintos), por lo tanto, en este caso debe usar [UniqCombined64](#agg_function-uniqcombined64) - -En comparación con el [uniq](#agg_function-uniq) función, el `uniqCombined`: - -- Consume varias veces menos memoria. -- Calcula con una precisión varias veces mayor. -- Por lo general, tiene un rendimiento ligeramente menor. En algunos escenarios, `uniqCombined` puede funcionar mejor que `uniq`, por ejemplo, con consultas distribuidas que transmiten un gran número de estados de agregación a través de la red. - -**Ver también** - -- [uniq](#agg_function-uniq) -- [UniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## UniqCombined64 {#agg_function-uniqcombined64} - -Lo mismo que [uniqCombined](#agg_function-uniqcombined), pero utiliza hash de 64 bits para todos los tipos de datos. - -## uniqHLL12 {#agg_function-uniqhll12} - -Calcula el número aproximado de diferentes valores de argumento [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) algoritmo. - -``` sql -uniqHLL12(x[, ...]) -``` - -**Parámetros** - -La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. - -**Valor devuelto** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-tipo número. - -**Detalles de implementación** - -Función: - -- Calcula un hash para todos los parámetros en el agregado, luego lo usa en los cálculos. - -- Utiliza el algoritmo HyperLogLog para aproximar el número de valores de argumento diferentes. - - 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). - -- Proporciona el resultado determinado (no depende del orden de procesamiento de la consulta). - -No recomendamos usar esta función. En la mayoría de los casos, use el [uniq](#agg_function-uniq) o [uniqCombined](#agg_function-uniqcombined) función. - -**Ver también** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqExact](#agg_function-uniqexact) - -## uniqExact {#agg_function-uniqexact} - -Calcula el número exacto de diferentes valores de argumento. - -``` sql -uniqExact(x[, ...]) -``` - -Utilice el `uniqExact` función si necesita absolutamente un resultado exacto. De lo contrario, use el [uniq](#agg_function-uniq) función. - -El `uniqExact` función utiliza más memoria que `uniq`, porque el tamaño del estado tiene un crecimiento ilimitado a medida que aumenta el número de valores diferentes. - -**Parámetros** - -La función toma un número variable de parámetros. Los parámetros pueden ser `Tuple`, `Array`, `Date`, `DateTime`, `String`, o tipos numéricos. - -**Ver también** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqHLL12](#agg_function-uniqhll12) - -## ¿Cómo puedo hacerlo?) {#agg_function-grouparray} - -Crea una matriz de valores de argumento. -Los valores se pueden agregar a la matriz en cualquier orden (indeterminado). - -La segunda versión (con el `max_size` parámetro) limita el tamaño de la matriz resultante a `max_size` elemento. -Por ejemplo, `groupArray (1) (x)` es equivalente a `[any (x)]`. - -En algunos casos, aún puede confiar en el orden de ejecución. Esto se aplica a los casos en que `SELECT` procede de una subconsulta que utiliza `ORDER BY`. - -## Para obtener más información, consulte el siguiente enlace:) {#grouparrayinsertatvalue-position} - -Inserta un valor en la matriz en la posición especificada. - -!!! note "Nota" - Esta función utiliza posiciones de base cero, contrariamente a las posiciones de base única convencionales para matrices SQL. - -Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. - -Parámetros opcionales: - -- El valor predeterminado para sustituir en posiciones vacías. -- La longitud de la matriz resultante. Esto le permite recibir matrices del mismo tamaño para todas las claves agregadas. Al utilizar este parámetro, se debe especificar el valor predeterminado. - -## groupArrayMovingSum {#agg_function-grouparraymovingsum} - -Calcula la suma móvil de los valores de entrada. - -``` sql -groupArrayMovingSum(numbers_for_summing) -groupArrayMovingSum(window_size)(numbers_for_summing) -``` - -La función puede tomar el tamaño de la ventana como un parámetro. Si no se especifica, la función toma el tamaño de ventana igual al número de filas de la columna. - -**Parámetros** - -- `numbers_for_summing` — [Expresion](../syntax.md#syntax-expressions) dando como resultado un valor de tipo de datos numérico. -- `window_size` — Size of the calculation window. - -**Valores devueltos** - -- Matriz del mismo tamaño y tipo que los datos de entrada. - -**Ejemplo** - -La tabla de ejemplo: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Consulta: - -``` sql -SELECT - groupArrayMovingSum(int) AS I, - groupArrayMovingSum(float) AS F, - groupArrayMovingSum(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingSum(2)(int) AS I, - groupArrayMovingSum(2)(float) AS F, - groupArrayMovingSum(2)(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -## Método de codificación de datos: {#agg_function-grouparraymovingavg} - -Calcula la media móvil de los valores de entrada. - -``` sql -groupArrayMovingAvg(numbers_for_summing) -groupArrayMovingAvg(window_size)(numbers_for_summing) -``` - -La función puede tomar el tamaño de la ventana como un parámetro. Si no se especifica, la función toma el tamaño de ventana igual al número de filas de la columna. - -**Parámetros** - -- `numbers_for_summing` — [Expresion](../syntax.md#syntax-expressions) dando como resultado un valor de tipo de datos numérico. -- `window_size` — Size of the calculation window. - -**Valores devueltos** - -- Matriz del mismo tamaño y tipo que los datos de entrada. - -La función utiliza [redondeando hacia cero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). Trunca los decimales insignificantes para el tipo de datos resultante. - -**Ejemplo** - -La tabla de ejemplo `b`: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Consulta: - -``` sql -SELECT - groupArrayMovingAvg(int) AS I, - groupArrayMovingAvg(float) AS F, - groupArrayMovingAvg(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ -│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ -└───────────┴─────────────────────────────────────┴───────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingAvg(2)(int) AS I, - groupArrayMovingAvg(2)(float) AS F, - groupArrayMovingAvg(2)(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ -│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ -└───────────┴──────────────────────────────────┴───────────────────────┘ -``` - -## ¿Cómo puedo obtener más información?) {#groupuniqarrayx-groupuniqarraymax-sizex} - -Crea una matriz a partir de diferentes valores de argumento. El consumo de memoria es el mismo que para el `uniqExact` función. - -La segunda versión (con el `max_size` parámetro) limita el tamaño de la matriz resultante a `max_size` elemento. -Por ejemplo, `groupUniqArray(1)(x)` es equivalente a `[any(x)]`. - -## cuantil {#quantile} - -Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. - -Esta función se aplica [muestreo de embalses](https://en.wikipedia.org/wiki/Reservoir_sampling) con un tamaño de depósito de hasta 8192 y un generador de números aleatorios para el muestreo. El resultado es no determinista. Para obtener un cuantil exacto, use el [quantileExact](#quantileexact) función. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantile(level)(expr) -``` - -Apodo: `median`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql_reference/data_types/index.md#data_types), [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). - -**Valor devuelto** - -- Cuantil aproximado del nivel especificado. - -Tipo: - -- [Float64](../../sql_reference/data_types/float.md) para la entrada de tipo de datos numéricos. -- [Fecha](../../sql_reference/data_types/date.md) si los valores de entrada tienen `Date` tipo. -- [FechaHora](../../sql_reference/data_types/datetime.md) si los valores de entrada tienen `DateTime` tipo. - -**Ejemplo** - -Tabla de entrada: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Consulta: - -``` sql -SELECT quantile(val) FROM t -``` - -Resultado: - -``` text -┌─quantile(val)─┐ -│ 1.5 │ -└───────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## quantileDeterminista {#quantiledeterministic} - -Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. - -Esta función se aplica [muestreo de embalses](https://en.wikipedia.org/wiki/Reservoir_sampling) con un tamaño de depósito de hasta 8192 y algoritmo determinista de muestreo. El resultado es determinista. Para obtener un cuantil exacto, use el [quantileExact](#quantileexact) función. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantileDeterministic(level)(expr, determinator) -``` - -Apodo: `medianDeterministic`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql_reference/data_types/index.md#data_types), [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). -- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. - -**Valor devuelto** - -- Aproximado cuantil del nivel especificado. - -Tipo: - -- [Float64](../../sql_reference/data_types/float.md) para el tipo de datos numérico de entrada. -- [Fecha](../../sql_reference/data_types/date.md) si los valores de entrada tienen `Date` tipo. -- [FechaHora](../../sql_reference/data_types/datetime.md) si los valores de entrada tienen `DateTime` tipo. - -**Ejemplo** - -Tabla de entrada: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Consulta: - -``` sql -SELECT quantileDeterministic(val, 1) FROM t -``` - -Resultado: - -``` text -┌─quantileDeterministic(val, 1)─┐ -│ 1.5 │ -└───────────────────────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## quantileExact {#quantileexact} - -Calcula exactamente el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` memoria, donde `n` es un número de valores que se pasaron. Sin embargo, para un pequeño número de valores, la función es muy efectiva. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantileExact(level)(expr) -``` - -Apodo: `medianExact`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql_reference/data_types/index.md#data_types), [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). - -**Valor devuelto** - -- Cuantil del nivel especificado. - -Tipo: - -- [Float64](../../sql_reference/data_types/float.md) para el tipo de datos numérico de entrada. -- [Fecha](../../sql_reference/data_types/date.md) si los valores de entrada tienen `Date` tipo. -- [FechaHora](../../sql_reference/data_types/datetime.md) si los valores de entrada tienen `DateTime` tipo. - -**Ejemplo** - -Consulta: - -``` sql -SELECT quantileExact(number) FROM numbers(10) -``` - -Resultado: - -``` text -┌─quantileExact(number)─┐ -│ 5 │ -└───────────────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## quantileExactWeighted {#quantileexactweighted} - -Calcula exactamente el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos, teniendo en cuenta el peso de cada elemento. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). Puede usar esta función en lugar de `quantileExact` y especifique el peso 1. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantileExactWeighted(level)(expr, weight) -``` - -Apodo: `medianExactWeighted`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql_reference/data_types/index.md#data_types), [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. - -**Valor devuelto** - -- Cuantil del nivel especificado. - -Tipo: - -- [Float64](../../sql_reference/data_types/float.md) para la entrada de tipo de datos numéricos. -- [Fecha](../../sql_reference/data_types/date.md) si los valores de entrada tienen `Date` tipo. -- [FechaHora](../../sql_reference/data_types/datetime.md) si los valores de entrada tienen `DateTime` tipo. - -**Ejemplo** - -Tabla de entrada: - -``` text -┌─n─┬─val─┐ -│ 0 │ 3 │ -│ 1 │ 2 │ -│ 2 │ 1 │ -│ 5 │ 4 │ -└───┴─────┘ -``` - -Consulta: - -``` sql -SELECT quantileExactWeighted(n, val) FROM t -``` - -Resultado: - -``` text -┌─quantileExactWeighted(n, val)─┐ -│ 1 │ -└───────────────────────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## quantileTiming {#quantiletiming} - -Con la precisión determinada calcula el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos. - -El resultado es determinista (no depende del orden de procesamiento de la consulta). La función está optimizada para trabajar con secuencias que describen distribuciones como tiempos de carga de páginas web o tiempos de respuesta de back-end. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantileTiming(level)(expr) -``` - -Apodo: `medianTiming`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). - -- `expr` — [Expresion](../syntax.md#syntax-expressions) sobre una columna valores que devuelven un [Flotante\*](../../sql_reference/data_types/float.md)-tipo número. - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -**Exactitud** - -El cálculo es preciso si: - -- El número total de valores no supera los 5670. -- El número total de valores supera los 5670, pero el tiempo de carga de la página es inferior a 1024 ms. - -De lo contrario, el resultado del cálculo se redondea al múltiplo más cercano de 16 ms. - -!!! note "Nota" - Para calcular los cuantiles de tiempo de carga de la página, esta función es más efectiva y precisa que [cuantil](#quantile). - -**Valor devuelto** - -- Cuantil del nivel especificado. - -Tipo: `Float32`. - -!!! note "Nota" - Si no se pasan valores a la función (cuando se `quantileTimingIf`), [NaN](../../sql_reference/data_types/float.md#data_type-float-nan-inf) se devuelve. El propósito de esto es diferenciar estos casos de los casos que resultan en cero. Ver [ORDER BY cláusula](../statements/select.md#select-order-by) para notas sobre la clasificación `NaN` valor. - -**Ejemplo** - -Tabla de entrada: - -``` text -┌─response_time─┐ -│ 72 │ -│ 112 │ -│ 126 │ -│ 145 │ -│ 104 │ -│ 242 │ -│ 313 │ -│ 168 │ -│ 108 │ -└───────────────┘ -``` - -Consulta: - -``` sql -SELECT quantileTiming(response_time) FROM t -``` - -Resultado: - -``` text -┌─quantileTiming(response_time)─┐ -│ 126 │ -└───────────────────────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## quantileTimingWeighted {#quantiletimingweighted} - -Con la precisión determinada calcula el [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos según el peso de cada miembro de secuencia. - -El resultado es determinista (no depende del orden de procesamiento de la consulta). La función está optimizada para trabajar con secuencias que describen distribuciones como tiempos de carga de páginas web o tiempos de respuesta de back-end. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantileTimingWeighted(level)(expr, weight) -``` - -Apodo: `medianTimingWeighted`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). - -- `expr` — [Expresion](../syntax.md#syntax-expressions) sobre una columna valores que devuelven un [Flotante\*](../../sql_reference/data_types/float.md)-tipo número. - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**Exactitud** - -El cálculo es preciso si: - -- El número total de valores no supera los 5670. -- El número total de valores supera los 5670, pero el tiempo de carga de la página es inferior a 1024 ms. - -De lo contrario, el resultado del cálculo se redondea al múltiplo más cercano de 16 ms. - -!!! note "Nota" - Para calcular los cuantiles de tiempo de carga de la página, esta función es más efectiva y precisa que [cuantil](#quantile). - -**Valor devuelto** - -- Cuantil del nivel especificado. - -Tipo: `Float32`. - -!!! note "Nota" - Si no se pasan valores a la función (cuando se `quantileTimingIf`), [NaN](../../sql_reference/data_types/float.md#data_type-float-nan-inf) se devuelve. El propósito de esto es diferenciar estos casos de los casos que resultan en cero. Ver [ORDER BY cláusula](../statements/select.md#select-order-by) para notas sobre la clasificación `NaN` valor. - -**Ejemplo** - -Tabla de entrada: - -``` text -┌─response_time─┬─weight─┐ -│ 68 │ 1 │ -│ 104 │ 2 │ -│ 112 │ 3 │ -│ 126 │ 2 │ -│ 138 │ 1 │ -│ 162 │ 1 │ -└───────────────┴────────┘ -``` - -Consulta: - -``` sql -SELECT quantileTimingWeighted(response_time, weight) FROM t -``` - -Resultado: - -``` text -┌─quantileTimingWeighted(response_time, weight)─┐ -│ 112 │ -└───────────────────────────────────────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## quantileTDigest {#quantiletdigest} - -Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos usando el [T-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritmo. - -El error máximo es 1%. El consumo de memoria es `log(n)`, donde `n` es un número de valores. El resultado depende del orden de ejecución de la consulta y no es determinista. - -El rendimiento de la función es menor que el rendimiento de [cuantil](#quantile) o [quantileTiming](#quantiletiming). En términos de la relación entre el tamaño del estado y la precisión, esta función es mucho mejor que `quantile`. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantileTDigest(level)(expr) -``` - -Apodo: `medianTDigest`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql_reference/data_types/index.md#data_types), [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). - -**Valor devuelto** - -- Cuantil aproximado del nivel especificado. - -Tipo: - -- [Float64](../../sql_reference/data_types/float.md) para la entrada de tipo de datos numéricos. -- [Fecha](../../sql_reference/data_types/date.md) si los valores de entrada tienen `Date` tipo. -- [FechaHora](../../sql_reference/data_types/datetime.md) si los valores de entrada tienen `DateTime` tipo. - -**Ejemplo** - -Consulta: - -``` sql -SELECT quantileTDigest(number) FROM numbers(10) -``` - -Resultado: - -``` text -┌─quantileTDigest(number)─┐ -│ 4.5 │ -└─────────────────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## quantileTDigestWeighted {#quantiletdigestweighted} - -Calcula un aproximado [cuantil](https://en.wikipedia.org/wiki/Quantile) de una secuencia de datos numéricos usando el [T-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritmo. La función tiene en cuenta el peso de cada miembro de secuencia. El error máximo es 1%. El consumo de memoria es `log(n)`, donde `n` es un número de valores. - -El rendimiento de la función es menor que el rendimiento de [cuantil](#quantile) o [quantileTiming](#quantiletiming). En términos de la relación entre el tamaño del estado y la precisión, esta función es mucho mejor que `quantile`. - -El resultado depende del orden de ejecución de la consulta y no es determinista. - -Cuando se utilizan múltiples `quantile*` funciones con diferentes niveles en una consulta, los estados internos no se combinan (es decir, la consulta funciona de manera menos eficiente de lo que podría). En este caso, use el [cantiles](#quantiles) función. - -**Sintaxis** - -``` sql -quantileTDigest(level)(expr) -``` - -Apodo: `medianTDigest`. - -**Parámetros** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` valor en el rango de `[0.01, 0.99]`. Valor predeterminado: 0.5. En `level=0.5` la función calcula [mediana](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [tipos de datos](../../sql_reference/data_types/index.md#data_types), [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**Valor devuelto** - -- Cuantil aproximado del nivel especificado. - -Tipo: - -- [Float64](../../sql_reference/data_types/float.md) para la entrada de tipo de datos numéricos. -- [Fecha](../../sql_reference/data_types/date.md) si los valores de entrada tienen `Date` tipo. -- [FechaHora](../../sql_reference/data_types/datetime.md) si los valores de entrada tienen `DateTime` tipo. - -**Ejemplo** - -Consulta: - -``` sql -SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) -``` - -Resultado: - -``` text -┌─quantileTDigestWeighted(number, 1)─┐ -│ 4.5 │ -└────────────────────────────────────┘ -``` - -**Ver también** - -- [mediana](#median) -- [cantiles](#quantiles) - -## mediana {#median} - -El `median*` funciones son los alias para el `quantile*` función. Calculan la mediana de una muestra de datos numéricos. - -Función: - -- `median` — Alias for [cuantil](#quantile). -- `medianDeterministic` — Alias for [quantileDeterminista](#quantiledeterministic). -- `medianExact` — Alias for [quantileExact](#quantileexact). -- `medianExactWeighted` — Alias for [quantileExactWeighted](#quantileexactweighted). -- `medianTiming` — Alias for [quantileTiming](#quantiletiming). -- `medianTimingWeighted` — Alias for [quantileTimingWeighted](#quantiletimingweighted). -- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). -- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). - -**Ejemplo** - -Tabla de entrada: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Consulta: - -``` sql -SELECT medianDeterministic(val, 1) FROM t -``` - -Resultado: - -``` text -┌─medianDeterministic(val, 1)─┐ -│ 1.5 │ -└─────────────────────────────┘ -``` - -## quantiles(level1, level2, …)(x) {#quantiles} - -Todas las funciones de cuantiles también tienen funciones de cuantiles correspondientes: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Estas funciones calculan todos los cuantiles de los niveles enumerados en una sola pasada y devuelven una matriz de los valores resultantes. - -## Acerca de Nosotros) {#varsampx} - -Calcula la cantidad `Σ((x - x̅)^2) / (n - 1)`, donde `n` es el tamaño de la muestra y `x̅`es el valor promedio de `x`. - -Representa una estimación imparcial de la varianza de una variable aleatoria si los valores pasados forman su muestra. - -Devoluciones `Float64`. Cuando `n <= 1`, devoluciones `+∞`. - -## Nombre de la red inalámbrica (SSID):) {#varpopx} - -Calcula la cantidad `Σ((x - x̅)^2) / n`, donde `n` es el tamaño de la muestra y `x̅`es el valor promedio de `x`. - -En otras palabras, dispersión para un conjunto de valores. Devoluciones `Float64`. - -## Soporte técnico) {#stddevsampx} - -El resultado es igual a la raíz cuadrada de `varSamp(x)`. - -## stddevPop(x) {#stddevpopx} - -El resultado es igual a la raíz cuadrada de `varPop(x)`. - -## topK(N)(x) {#topknx} - -Devuelve una matriz de los valores aproximadamente más frecuentes de la columna especificada. La matriz resultante se ordena en orden descendente de frecuencia aproximada de valores (no por los valores mismos). - -Implementa el [Ahorro de espacio filtrado](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) algoritmo para analizar TopK, basado en el algoritmo de reducción y combinación de [Ahorro de espacio paralelo](https://arxiv.org/pdf/1401.0702.pdf). - -``` sql -topK(N)(column) -``` - -Esta función no proporciona un resultado garantizado. En ciertas situaciones, pueden producirse errores y pueden devolver valores frecuentes que no son los valores más frecuentes. - -Recomendamos usar el `N < 10` valor; el rendimiento se reduce con grandes `N` valor. Valor máximo de `N = 65536`. - -**Parámetros** - -- ‘N’ es el número de elementos a devolver. - -Si se omite el parámetro, se utiliza el valor predeterminado 10. - -**Argumento** - -- ' x ' – The value to calculate frequency. - -**Ejemplo** - -Tome el [A tiempo](../../getting_started/example_datasets/ontime.md) conjunto de datos y seleccione los tres valores más frecuentes `AirlineID` columna. - -``` sql -SELECT topK(3)(AirlineID) AS res -FROM ontime -``` - -``` text -┌─res─────────────────┐ -│ [19393,19790,19805] │ -└─────────────────────┘ -``` - -## topKPeso {#topkweighted} - -Similar a `topK` pero toma un argumento adicional de tipo entero - `weight`. Cada valor se contabiliza `weight` veces para el cálculo de la frecuencia. - -**Sintaxis** - -``` sql -topKWeighted(N)(x, weight) -``` - -**Parámetros** - -- `N` — The number of elements to return. - -**Argumento** - -- `x` – The value. -- `weight` — The weight. [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valor devuelto** - -Devuelve una matriz de los valores con la suma aproximada máxima de pesos. - -**Ejemplo** - -Consulta: - -``` sql -SELECT topKWeighted(10)(number, number) FROM numbers(1000) -``` - -Resultado: - -``` text -┌─topKWeighted(10)(number, number)──────────┐ -│ [999,998,997,996,995,994,993,992,991,990] │ -└───────────────────────────────────────────┘ -``` - -## covarSamp(x, y) {#covarsampx-y} - -Calcula el valor de `Σ((x - x̅)(y - y̅)) / (n - 1)`. - -Devuelve Float64. Cuando `n <= 1`, returns +∞. - -## covarPop(x, y) {#covarpopx-y} - -Calcula el valor de `Σ((x - x̅)(y - y̅)) / n`. - -## corr(x, y) {#corrx-y} - -Calcula el coeficiente de correlación de Pearson: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. - -## categoricalInformationValue {#categoricalinformationvalue} - -Calcula el valor de `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` para cada categoría. - -``` sql -categoricalInformationValue(category1, category2, ..., tag) -``` - -El resultado indica cómo una característica discreta (categórica `[category1, category2, ...]` contribuir a un modelo de aprendizaje que predice el valor de `tag`. - -## SimpleLinearRegression {#simplelinearregression} - -Realiza una regresión lineal simple (unidimensional). - -``` sql -simpleLinearRegression(x, y) -``` - -Parámetros: - -- `x` — Column with dependent variable values. -- `y` — Column with explanatory variable values. - -Valores devueltos: - -Constante `(a, b)` de la línea resultante `y = a*x + b`. - -**Ejemplos** - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ -│ (1,0) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ -│ (1,3) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## stochasticLinearRegression {#agg_functions-stochasticlinearregression} - -Esta función implementa la regresión lineal estocástica. Admite parámetros personalizados para la tasa de aprendizaje, el coeficiente de regularización L2, el tamaño de mini lote y tiene pocos métodos para actualizar los pesos ([Adán](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (utilizado por defecto), [SGD simple](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Impulso](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). - -### Parámetros {#agg_functions-stochasticlinearregression-parameters} - -Hay 4 parámetros personalizables. Se pasan a la función secuencialmente, pero no es necesario pasar los cuatro; se usarán valores predeterminados, sin embargo, un buen modelo requirió algún ajuste de parámetros. - -``` text -stochasticLinearRegression(1.0, 1.0, 10, 'SGD') -``` - -1. `learning rate` es el coeficiente en la longitud del paso, cuando se realiza el paso de descenso de gradiente. Una tasa de aprendizaje demasiado grande puede causar pesos infinitos del modelo. El valor predeterminado es `0.00001`. -2. `l2 regularization coefficient` que puede ayudar a prevenir el sobreajuste. El valor predeterminado es `0.1`. -3. `mini-batch size` establece el número de elementos, cuyos gradientes se calcularán y sumarán para realizar un paso de descenso de gradiente. El descenso estocástico puro usa un elemento, sin embargo, tener lotes pequeños (aproximadamente 10 elementos) hace que los pasos de gradiente sean más estables. El valor predeterminado es `15`. -4. `method for updating weights`, son: `Adam` (predeterminada), `SGD`, `Momentum`, `Nesterov`. `Momentum` y `Nesterov` requieren un poco más de cálculos y memoria, sin embargo, resultan útiles en términos de velocidad de convergencia y estabilidad de los métodos de gradiente estocásticos. - -### Uso {#agg_functions-stochasticlinearregression-usage} - -`stochasticLinearRegression` se utiliza en dos pasos: ajustar el modelo y predecir nuevos datos. Para ajustar el modelo y guardar su estado para su uso posterior, utilizamos `-State` combinador, que básicamente guarda el estado (pesos del modelo, etc.). -Para predecir usamos la función [evalMLMethod](../functions/machine_learning_functions.md#machine_learning_methods-evalmlmethod), que toma un estado como argumento, así como características para predecir. - - - -**1.** Accesorio - -Dicha consulta puede ser utilizada. - -``` sql -CREATE TABLE IF NOT EXISTS train_data -( - param1 Float64, - param2 Float64, - target Float64 -) ENGINE = Memory; - -CREATE TABLE your_model ENGINE = Memory AS SELECT -stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) -AS state FROM train_data; -``` - -Aquí también tenemos que insertar datos en `train_data` tabla. El número de parámetros no es fijo, depende solo del número de argumentos, pasados a `linearRegressionState`. Todos deben ser valores numéricos. -Tenga en cuenta que la columna con valor objetivo (que nos gustaría aprender a predecir) se inserta como primer argumento. - -**2.** Predecir - -Después de guardar un estado en la tabla, podemos usarlo varias veces para la predicción, o incluso fusionarlo con otros estados y crear nuevos modelos aún mejores. - -``` sql -WITH (SELECT state FROM your_model) AS model SELECT -evalMLMethod(model, param1, param2) FROM test_data -``` - -La consulta devolverá una columna de valores predichos. Tenga en cuenta que el primer argumento de `evalMLMethod` ser `AggregateFunctionState` objeto, siguiente son columnas de características. - -`test_data` es una mesa como `train_data` pero puede no contener el valor objetivo. - -### Nota {#agg_functions-stochasticlinearregression-notes} - -1. Para fusionar dos modelos, el usuario puede crear dicha consulta: - `sql SELECT state1 + state2 FROM your_models` - donde `your_models` la tabla contiene ambos modelos. Esta consulta devolverá un nuevo `AggregateFunctionState` objeto. - -2. El usuario puede obtener pesos del modelo creado para sus propios fines sin guardar el modelo si no `-State` combinador se utiliza. - `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` - Dicha consulta se ajustará al modelo y devolverá sus pesos: primero son los pesos, que corresponden a los parámetros del modelo, el último es el sesgo. Entonces, en el ejemplo anterior, la consulta devolverá una columna con 3 valores. - -**Ver también** - -- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) -- [Diferencia entre regresiones lineales y logísticas](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} - -Esta función implementa la regresión logística estocástica. Se puede usar para problemas de clasificación binaria, admite los mismos parámetros personalizados que stochasticLinearRegression y funciona de la misma manera. - -### Parámetros {#agg_functions-stochasticlogisticregression-parameters} - -Los parámetros son exactamente los mismos que en stochasticLinearRegression: -`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. -Para obtener más información, consulte [parámetros](#agg_functions-stochasticlinearregression-parameters). - -``` text -stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') -``` - -1. Accesorio - - - - See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. - - Predicted labels have to be in \[-1, 1\]. - -1. Predecir - - - - Using saved state we can predict probability of object having label `1`. - - ``` sql - WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) FROM test_data - ``` - - The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. - - We can also set a bound of probability, which assigns elements to different labels. - - ``` sql - SELECT ans < 1.1 AND ans > 0.5 FROM - (WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) AS ans FROM test_data) - ``` - - Then the result will be labels. - - `test_data` is a table like `train_data` but may not contain target value. - -**Ver también** - -- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) -- [Diferencia entre regresiones lineales y logísticas.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## Método de codificación de datos: {#groupbitmapand} - -Calcula el AND de una columna de mapa de bits, devuelve la cardinalidad del tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapAnd(expr) -``` - -**Parámetros** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tipo. - -**Valor de retorno** - -Valor de la `UInt64` tipo. - -**Ejemplo** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapAnd(z)─┐ -│ 3 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ -│ [6,8,10] │ -└──────────────────────────────────────────────────┘ -``` - -## Método de codificación de datos: {#groupbitmapor} - -Calcula el OR de una columna de mapa de bits, devuelve la cardinalidad del tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql_reference/functions/bitmap_functions.md). Esto es equivalente a `groupBitmapMerge`. - -``` sql -groupBitmapOr(expr) -``` - -**Parámetros** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tipo. - -**Valor de retorno** - -Valor de la `UInt64` tipo. - -**Ejemplo** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapOr(z)─┐ -│ 15 │ -└──────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ -│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ -└─────────────────────────────────────────────────┘ -``` - -## Método de codificación de datos: {#groupbitmapxor} - -Calcula el XOR de una columna de mapa de bits, devuelve la cardinalidad del tipo UInt64, si agrega el sufijo -State, luego devuelve [objeto de mapa de bits](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapOr(expr) -``` - -**Parámetros** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tipo. - -**Valor de retorno** - -Valor de la `UInt64` tipo. - -**Ejemplo** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapXor(z)─┐ -│ 10 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ -│ [1,3,5,6,8,10,11,13,14,15] │ -└──────────────────────────────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/es/sql_reference/ansi.md b/docs/es/sql_reference/ansi.md deleted file mode 120000 index ee0f9c8cb7e..00000000000 --- a/docs/es/sql_reference/ansi.md +++ /dev/null @@ -1 +0,0 @@ -../../en/sql_reference/ansi.md \ No newline at end of file diff --git a/docs/es/sql_reference/data_types/aggregatefunction.md b/docs/es/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index 648a1bb7150..00000000000 --- a/docs/es/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 52 -toc_title: "Agregar funci\xF3n (nombre, types_of_arguments)...)" ---- - -# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [una vista materializada](../../sql_reference/statements/select.md#create-view). La forma común de producir un estado de función agregada es llamando a la función agregada con el `-State` sufijo. Para obtener el resultado final de la agregación en el futuro, debe utilizar la misma función de agregado con el `-Merge`sufijo. - -`AggregateFunction` — parametric data type. - -**Parámetros** - -- Nombre de la función de agregado. - - If the function is parametric, specify its parameters too. - -- Tipos de los argumentos de la función agregada. - -**Ejemplo** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -[uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq), anyIf ([cualquier](../../sql_reference/aggregate_functions/reference.md#agg_function-any)+[Si](../../sql_reference/aggregate_functions/combinators.md#agg-functions-combinator-if)) y [cantiles](../../sql_reference/aggregate_functions/reference.md) son las funciones agregadas admitidas en ClickHouse. - -## Uso {#usage} - -### Inserción de datos {#data-insertion} - -Para insertar datos, utilice `INSERT SELECT` con agregado `-State`- función. - -**Ejemplos de funciones** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -En contraste con las funciones correspondientes `uniq` y `quantiles`, `-State`- funciones devuelven el estado, en lugar del valor final. En otras palabras, devuelven un valor de `AggregateFunction` tipo. - -En los resultados de `SELECT` consulta, los valores de `AggregateFunction` tipo tiene representación binaria específica de la implementación para todos los formatos de salida de ClickHouse. Si volcar datos en, por ejemplo, `TabSeparated` formato con `SELECT` consulta, entonces este volcado se puede cargar de nuevo usando `INSERT` consulta. - -### Selección de datos {#data-selection} - -Al seleccionar datos de `AggregatingMergeTree` mesa, uso `GROUP BY` cláusula y las mismas funciones agregadas que al insertar datos, pero usando `-Merge`sufijo. - -Una función agregada con `-Merge` sufijo toma un conjunto de estados, los combina y devuelve el resultado de la agregación de datos completa. - -Por ejemplo, las siguientes dos consultas devuelven el mismo resultado: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## Ejemplo de uso {#usage-example} - -Ver [AgregaciónMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) Descripción del motor. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/es/sql_reference/data_types/array.md b/docs/es/sql_reference/data_types/array.md deleted file mode 100644 index 923e581ea8e..00000000000 --- a/docs/es/sql_reference/data_types/array.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 51 -toc_title: Matriz (T) ---- - -# Matriz (t) {#data-type-array} - -Una matriz de `T`-tipo de artículos. `T` puede ser cualquier tipo de datos, incluida una matriz. - -## Creación de una matriz {#creating-an-array} - -Puede usar una función para crear una matriz: - -``` sql -array(T) -``` - -También puede usar corchetes. - -``` sql -[] -``` - -Ejemplo de creación de una matriz: - -``` sql -SELECT array(1, 2) AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName(array(1, 2))─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴─────────────────────────┘ -``` - -``` sql -SELECT [1, 2] AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName([1, 2])─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴────────────────────┘ -``` - -## Trabajar con tipos de datos {#working-with-data-types} - -Al crear una matriz sobre la marcha, ClickHouse define automáticamente el tipo de argumento como el tipo de datos más estrecho que puede almacenar todos los argumentos enumerados. Si hay alguna [NULL](nullable.md#data_type-nullable) o literal [NULL](../../sql_reference/syntax.md#null-literal) valores, el tipo de un elemento de matriz también se convierte en [NULL](nullable.md). - -Si ClickHouse no pudo determinar el tipo de datos, genera una excepción. Por ejemplo, esto sucede cuando se intenta crear una matriz con cadenas y números simultáneamente (`SELECT array(1, 'a')`). - -Ejemplos de detección automática de tipos de datos: - -``` sql -SELECT array(1, 2, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ -│ [1,2,NULL] │ Array(Nullable(UInt8)) │ -└────────────┴───────────────────────────────┘ -``` - -Si intenta crear una matriz de tipos de datos incompatibles, ClickHouse produce una excepción: - -``` sql -SELECT array(1, 'a') -``` - -``` text -Received exception from server (version 1.1.54388): -Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. -``` - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/es/sql_reference/data_types/boolean.md b/docs/es/sql_reference/data_types/boolean.md deleted file mode 100644 index 04a16b108c7..00000000000 --- a/docs/es/sql_reference/data_types/boolean.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 43 -toc_title: Booleana ---- - -# Valores booleanos {#boolean-values} - -No hay un tipo separado para los valores booleanos. Utilice el tipo UInt8, restringido a los valores 0 o 1. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/boolean/) diff --git a/docs/es/sql_reference/data_types/datetime.md b/docs/es/sql_reference/data_types/datetime.md deleted file mode 100644 index 0109a442cae..00000000000 --- a/docs/es/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 48 -toc_title: FechaHora ---- - -# Datetime {#data_type-datetime} - -Permite almacenar un instante en el tiempo, que se puede expresar como una fecha del calendario y una hora de un día. - -Sintaxis: - -``` sql -DateTime([timezone]) -``` - -Rango de valores: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. - -Resolución: 1 segundo. - -## Observaciones de uso {#usage-remarks} - -El punto en el tiempo se guarda como un [Timestamp de Unix](https://en.wikipedia.org/wiki/Unix_time), independientemente de la zona horaria o el horario de verano. Además, el `DateTime` tipo puede almacenar zona horaria que es la misma para toda la columna, que afecta a cómo los valores de la `DateTime` Los valores de tipo se muestran en formato de texto y cómo se analizan los valores especificados como cadenas (‘2020-01-01 05:00:01’). La zona horaria no se almacena en las filas de la tabla (o en el conjunto de resultados), sino que se almacena en los metadatos de la columna. -Se puede encontrar una lista de zonas horarias compatibles en el [Base de datos de zonas horarias de IANA](https://www.iana.org/time-zones). -El `tzdata` paquete, que contiene [Base de datos de zonas horarias de IANA](https://www.iana.org/time-zones), debe instalarse en el sistema. Utilice el `timedatectl list-timezones` comando para listar zonas horarias conocidas por un sistema local. - -Puede establecer explícitamente una zona horaria para `DateTime`-type columnas al crear una tabla. Si la zona horaria no está establecida, ClickHouse usa el valor [Zona horaria](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) parámetro en la configuración del servidor o la configuración del sistema operativo en el momento del inicio del servidor ClickHouse. - -El [Casa de clics-cliente](../../interfaces/cli.md) aplica la zona horaria del servidor de forma predeterminada si una zona horaria no se establece explícitamente al inicializar el tipo de datos. Para utilizar la zona horaria del cliente, ejecute `clickhouse-client` con el `--use_client_time_zone` parámetro. - -ClickHouse genera valores en `YYYY-MM-DD hh:mm:ss` formato de texto por defecto. Puede cambiar la salida con el [formatDateTime](../../sql_reference/functions/date_time_functions.md#formatdatetime) función. - -Al insertar datos en ClickHouse, puede usar diferentes formatos de cadenas de fecha y hora, dependiendo del valor de la [Date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) configuración. - -## Ejemplos {#examples} - -**1.** Creación de una tabla con un `DateTime`-tipo de columna e insertar datos en ella: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime('Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog; -``` - -``` sql -INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); -``` - -``` sql -SELECT * FROM dt; -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -- Al insertar datetime como un entero, se trata como Unix Timestamp (UTC). `1546300800` representar `'2019-01-01 00:00:00'` UTC. Sin embargo, como `timestamp` columna tiene `Europe/Moscow` (UTC + 3) zona horaria especificada, al emitir como cadena, el valor se mostrará como `'2019-01-01 03:00:00'` -- Al insertar el valor de cadena como fecha y hora, se trata como si estuviera en la zona horaria de la columna. `'2019-01-01 00:00:00'` será tratado como estar en `Europe/Moscow` zona horaria y guardado como `1546290000`. - -**2.** Filtrado en `DateTime` valor - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -`DateTime` se pueden filtrar usando un valor de cadena en `WHERE` predicado. Se convertirá a `DateTime` automática: - -``` sql -SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -└─────────────────────┴──────────┘ -``` - -**3.** Obtener una zona horaria para un `DateTime`-tipo columna: - -``` sql -SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────column─┬─x─────────────────────────┐ -│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ -└─────────────────────┴───────────────────────────┘ -``` - -**4.** Conversión de zona horaria - -``` sql -SELECT -toDateTime(timestamp, 'Europe/London') as lon_time, -toDateTime(timestamp, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────lon_time──┬────────────mos_time─┐ -│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ -│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ -└─────────────────────┴─────────────────────┘ -``` - -## Ver también {#see-also} - -- [Funciones de conversión de tipos](../../sql_reference/functions/type_conversion_functions.md) -- [Funciones para trabajar con fechas y horas](../../sql_reference/functions/date_time_functions.md) -- [Funciones para trabajar con matrices](../../sql_reference/functions/array_functions.md) -- [El `date_time_input_format` configuración](../../operations/settings/settings.md#settings-date_time_input_format) -- [El `timezone` parámetro de configuración del servidor](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Operadores para trabajar con fechas y horas](../../sql_reference/operators.md#operators-datetime) -- [El `Date` tipo de datos](date.md) - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/es/sql_reference/data_types/datetime64.md b/docs/es/sql_reference/data_types/datetime64.md deleted file mode 100644 index e7327ccb12d..00000000000 --- a/docs/es/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 49 -toc_title: DateTime64 ---- - -# Datetime64 {#data_type-datetime64} - -Permite almacenar un instante en el tiempo, que se puede expresar como una fecha de calendario y una hora de un día, con una precisión de subsegundo definida - -Tamaño de la marca (precisión): 10-Precision segundo - -Sintaxis: - -``` sql -DateTime64(precision, [timezone]) -``` - -Internamente, almacena datos como un número de ‘ticks’ desde el inicio de la época (1970-01-01 00:00:00 UTC) como Int64. La resolución de tick está determinada por el parámetro precision. Además, el `DateTime64` tipo puede almacenar zona horaria que es la misma para toda la columna, que afecta a cómo los valores de la `DateTime64` Los valores de tipo se muestran en formato de texto y cómo se analizan los valores especificados como cadenas (‘2020-01-01 05:00:01.000’). La zona horaria no se almacena en las filas de la tabla (o en el conjunto de resultados), sino que se almacena en los metadatos de la columna. Ver detalles en [FechaHora](datetime.md). - -## Ejemplos {#examples} - -**1.** Creación de una tabla con `DateTime64`-tipo de columna e insertar datos en ella: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- Al insertar datetime como un entero, se trata como una marca de tiempo Unix (UTC) apropiadamente escalada. `1546300800000` (con precisión 3) representa `'2019-01-01 00:00:00'` UTC. Sin embargo, como `timestamp` columna tiene `Europe/Moscow` (UTC + 3) zona horaria especificada, al emitir como una cadena, el valor se mostrará como `'2019-01-01 03:00:00'` -- Al insertar el valor de cadena como fecha y hora, se trata como si estuviera en la zona horaria de la columna. `'2019-01-01 00:00:00'` será tratado como estar en `Europe/Moscow` zona horaria y se almacena como `1546290000000`. - -**2.** Filtrado en `DateTime64` valor - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -A diferencia de `DateTime`, `DateTime64` los valores no se convierten desde `String` automática - -**3.** Obtener una zona horaria para un `DateTime64`-tipo de valor: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** Conversión de zona horaria - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## Ver también {#see-also} - -- [Funciones de conversión de tipos](../../sql_reference/functions/type_conversion_functions.md) -- [Funciones para trabajar con fechas y horas](../../sql_reference/functions/date_time_functions.md) -- [Funciones para trabajar con matrices](../../sql_reference/functions/array_functions.md) -- [El `date_time_input_format` configuración](../../operations/settings/settings.md#settings-date_time_input_format) -- [El `timezone` parámetro de configuración del servidor](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Operadores para trabajar con fechas y horas](../../sql_reference/operators.md#operators-datetime) -- [`Date` tipo de datos](date.md) -- [`DateTime` tipo de datos](datetime.md) diff --git a/docs/es/sql_reference/data_types/decimal.md b/docs/es/sql_reference/data_types/decimal.md deleted file mode 100644 index 7b838dd70b5..00000000000 --- a/docs/es/sql_reference/data_types/decimal.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 42 -toc_title: Decimal ---- - -# Decimal(P, S), Decimal32(S), Decimal64(S), Decimal128(S) {#decimalp-s-decimal32s-decimal64s-decimal128s} - -Números de punto fijo firmados que mantienen la precisión durante las operaciones de suma, resta y multiplicación. Para la división se descartan los dígitos menos significativos (no redondeados). - -## Parámetros {#parameters} - -- P - precisión. Rango válido: \[ 1 : 38 \]. Determina cuántos dígitos decimales puede tener el número (incluida la fracción). -- S - escala. Rango válido: \[ 0 : P \]. Determina cuántos dígitos decimales puede tener la fracción. - -Dependiendo del valor del parámetro P Decimal(P, S) es un sinónimo de: -- P de \[ 1 : 9 \] - para Decimal32(S) -- P de \[ 10 : 18 \] - para Decimal64(S) -- P de \[ 19 : 38 \] - para Decimal128(S) - -## Rangos de valores decimales {#decimal-value-ranges} - -- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9 - S) ) -- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18 - S) ) -- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38 - S) ) - -Por ejemplo, Decimal32(4) puede contener números de -99999.9999 a 99999.9999 con el paso 0.0001. - -## Representación interna {#internal-representation} - -Internamente, los datos se representan como enteros con signo normal con el ancho de bits respectivo. Los rangos de valores reales que se pueden almacenar en la memoria son un poco más grandes que los especificados anteriormente, que se verifican solo en la conversión de una cadena. - -Debido a que las CPU modernas no admiten enteros de 128 bits de forma nativa, las operaciones en Decimal128 se emulan. Debido a esto, Decimal128 funciona significativamente más lento que Decimal32 / Decimal64. - -## Operaciones y tipo de resultado {#operations-and-result-type} - -Las operaciones binarias en Decimal dan como resultado un tipo de resultado más amplio (con cualquier orden de argumentos). - -- Decimal64(S1) Decimal32(S2) -\> Decimal64(S) -- Decimal128(S1) Decimal32(S2) -\> Decimal128(S) -- Decimal128(S1) ¿Cómo puedo hacerlo?) - -Reglas para la escala: - -- Sumar, restar: S = max(S1, S2). -- multuply: S = S1 + S2. -- división: S = S1. - -Para operaciones similares entre Decimal y enteros, el resultado es Decimal del mismo tamaño que un argumento. - -Las operaciones entre Decimal y Float32 / Float64 no están definidas. Si los necesita, puede convertir explícitamente uno de los argumentos utilizando toDecimal32, toDecimal64, toDecimal128 o toFloat32, toFloat64 builtins. Tenga en cuenta que el resultado perderá precisión y la conversión de tipo es una operación computacionalmente costosa. - -Algunas funciones en Decimal devuelven el resultado como Float64 (por ejemplo, var o stddev). Los cálculos intermedios aún se pueden realizar en Decimal, lo que podría dar lugar a resultados diferentes entre las entradas Float64 y Decimal con los mismos valores. - -## Comprobaciones de desbordamiento {#overflow-checks} - -Durante los cálculos en Decimal, pueden producirse desbordamientos de enteros. Los dígitos excesivos en una fracción se descartan (no se redondean). Los dígitos excesivos en la parte entera conducirán a una excepción. - -``` sql -SELECT toDecimal32(2, 4) AS x, x / 3 -``` - -``` text -┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ -│ 2.0000 │ 0.6666 │ -└────────┴──────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, x * x -``` - -``` text -DB::Exception: Scale is out of bounds. -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -DB::Exception: Decimal math overflow. -``` - -Las comprobaciones de desbordamiento conducen a la desaceleración de las operaciones. Si se sabe que los desbordamientos no son posibles, tiene sentido deshabilitar las verificaciones usando `decimal_check_overflow` configuración. Cuando las comprobaciones están deshabilitadas y se produce el desbordamiento, el resultado será incorrecto: - -``` sql -SET decimal_check_overflow = 0; -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ -│ 4.20000000 │ -17.74967296 │ -└────────────┴──────────────────────────────────┘ -``` - -Las comprobaciones de desbordamiento ocurren no solo en operaciones aritméticas sino también en la comparación de valores: - -``` sql -SELECT toDecimal32(1, 8) < 100 -``` - -``` text -DB::Exception: Can't compare. -``` - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/decimal/) diff --git a/docs/es/sql_reference/data_types/domains/overview.md b/docs/es/sql_reference/data_types/domains/overview.md deleted file mode 100644 index 3207a52482d..00000000000 --- a/docs/es/sql_reference/data_types/domains/overview.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 58 -toc_title: "Descripci\xF3n" ---- - -# Dominio {#domains} - -Los dominios son tipos de propósito especial que agregan algunas características adicionales encima del tipo base existente, pero dejando intacto el formato en cable y en disco del tipo de datos subyacente. Por el momento, ClickHouse no admite dominios definidos por el usuario. - -Puede usar dominios en cualquier lugar que se pueda usar el tipo base correspondiente, por ejemplo: - -- Crear una columna de un tipo de dominio -- Leer/escribir valores desde/a la columna de dominio -- Úselo como un índice si un tipo base se puede usar como un índice -- Funciones de llamada con valores de la columna de dominio - -### Características adicionales de los dominios {#extra-features-of-domains} - -- Nombre de tipo de columna explícito en `SHOW CREATE TABLE` o `DESCRIBE TABLE` -- Entrada del formato humano-amistoso con `INSERT INTO domain_table(domain_column) VALUES(...)` -- Salida al formato humano-amistoso para `SELECT domain_column FROM domain_table` -- Carga de datos desde una fuente externa en el formato de uso humano: `INSERT INTO domain_table FORMAT CSV ...` - -### Limitacion {#limitations} - -- No se puede convertir la columna de índice del tipo base al tipo de dominio a través de `ALTER TABLE`. -- No se pueden convertir implícitamente valores de cadena en valores de dominio al insertar datos de otra columna o tabla. -- Domain no agrega restricciones en los valores almacenados. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/es/sql_reference/data_types/enum.md b/docs/es/sql_reference/data_types/enum.md deleted file mode 100644 index d1065ccf863..00000000000 --- a/docs/es/sql_reference/data_types/enum.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 50 -toc_title: Enum ---- - -# Enum {#enum} - -Tipo enumerado que consta de valores con nombre. - -Los valores con nombre deben declararse como `'string' = integer` par. ClickHouse almacena solo números, pero admite operaciones con los valores a través de sus nombres. - -Soporta ClickHouse: - -- de 8 bits `Enum`. Puede contener hasta 256 valores enumerados en el `[-128, 127]` gama. -- de 16 bits `Enum`. Puede contener hasta 65536 valores enumerados en el `[-32768, 32767]` gama. - -ClickHouse elige automáticamente el tipo de `Enum` cuando se insertan datos. También puede utilizar `Enum8` o `Enum16` para estar seguro en el tamaño de almacenamiento. - -## Ejemplos de uso {#usage-examples} - -Aquí creamos una tabla con un `Enum8('hello' = 1, 'world' = 2)` tipo columna: - -``` sql -CREATE TABLE t_enum -( - x Enum('hello' = 1, 'world' = 2) -) -ENGINE = TinyLog -``` - -Columna `x` sólo puede almacenar valores que se enumeran en la definición de tipo: `'hello'` o `'world'`. Si intenta guardar cualquier otro valor, ClickHouse generará una excepción. Tamaño de 8 bits para esto `Enum` se elige automáticamente. - -``` sql -INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') -``` - -``` text -Ok. -``` - -``` sql -INSERT INTO t_enum values('a') -``` - -``` text -Exception on client: -Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) -``` - -Al consultar datos de la tabla, ClickHouse genera los valores de cadena de `Enum`. - -``` sql -SELECT * FROM t_enum -``` - -``` text -┌─x─────┐ -│ hello │ -│ world │ -│ hello │ -└───────┘ -``` - -Si necesita ver los equivalentes numéricos de las filas, debe `Enum` valor a tipo entero. - -``` sql -SELECT CAST(x, 'Int8') FROM t_enum -``` - -``` text -┌─CAST(x, 'Int8')─┐ -│ 1 │ -│ 2 │ -│ 1 │ -└─────────────────┘ -``` - -Para crear un valor Enum en una consulta, también debe usar `CAST`. - -``` sql -SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) -``` - -``` text -┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ -│ Enum8('a' = 1, 'b' = 2) │ -└─────────────────────────────────────────────────────┘ -``` - -## Reglas generales y uso {#general-rules-and-usage} - -A cada uno de los valores se le asigna un número en el rango `-128 ... 127` para `Enum8` o en el rango `-32768 ... 32767` para `Enum16`. Todas las cadenas y números deben ser diferentes. Se permite una cadena vacía. Si se especifica este tipo (en una definición de tabla), los números pueden estar en un orden arbitrario. Sin embargo, el orden no importa. - -Ni la cadena ni el valor numérico en un `Enum` puede ser [NULL](../../sql_reference/syntax.md). - -Un `Enum` puede estar contenido en [NULL](nullable.md) tipo. Entonces, si crea una tabla usando la consulta - -``` sql -CREATE TABLE t_enum_nullable -( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) -) -ENGINE = TinyLog -``` - -puede almacenar no sólo `'hello'` y `'world'`, pero `NULL`, también. - -``` sql -INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) -``` - -En RAM, un `Enum` columna se almacena de la misma manera que `Int8` o `Int16` de los valores numéricos correspondientes. - -Al leer en forma de texto, ClickHouse analiza el valor como una cadena y busca la cadena correspondiente del conjunto de valores Enum. Si no se encuentra, se lanza una excepción. Al leer en formato de texto, se lee la cadena y se busca el valor numérico correspondiente. Se lanzará una excepción si no se encuentra. -Al escribir en forma de texto, escribe el valor como la cadena correspondiente. Si los datos de columna contienen elementos no utilizados (números que no son del conjunto válido), se produce una excepción. Al leer y escribir en forma binaria, funciona de la misma manera que para los tipos de datos Int8 e Int16. -El valor predeterminado es el valor con el número más bajo. - -Durante `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` y así sucesivamente, las enumeraciones se comportan de la misma manera que los números correspondientes. Por ejemplo, ORDER BY los ordena numéricamente. Los operadores de igualdad y comparación funcionan de la misma manera en enumeraciones que en los valores numéricos subyacentes. - -Los valores de Enum no se pueden comparar con los números. Las enumeraciones se pueden comparar con una cadena constante. Si la cadena en comparación con no es un valor válido para el Enum, se lanzará una excepción. El operador IN es compatible con el Enum en el lado izquierdo y un conjunto de cadenas en el lado derecho. Las cadenas son los valores del Enum correspondiente. - -Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. -Sin embargo, el Enum tiene un `toString` función que devuelve su valor de cadena. - -Los valores de Enum también se pueden convertir a tipos numéricos utilizando el `toT` función, donde T es un tipo numérico. Cuando T corresponde al tipo numérico subyacente de la enumeración, esta conversión es de costo cero. -El tipo Enum se puede cambiar sin costo usando ALTER, si solo se cambia el conjunto de valores. Es posible agregar y eliminar miembros del Enum usando ALTER (eliminar es seguro solo si el valor eliminado nunca se ha usado en la tabla). Como salvaguardia, al cambiar el valor numérico de un miembro Enum definido previamente se producirá una excepción. - -Usando ALTER, es posible cambiar un Enum8 a un Enum16 o viceversa, al igual que cambiar un Int8 a Int16. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/es/sql_reference/data_types/fixedstring.md b/docs/es/sql_reference/data_types/fixedstring.md deleted file mode 100644 index d22b4e118b4..00000000000 --- a/docs/es/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 45 -toc_title: Cadena fija (N) ---- - -# Cuerda fija {#fixedstring} - -Una cadena de longitud fija de `N` bytes (ni caracteres ni puntos de código). - -Para declarar una columna de `FixedString` tipo, utilice la siguiente sintaxis: - -``` sql - FixedString(N) -``` - -Donde `N` es un número natural. - -El `FixedString` tipo es eficiente cuando los datos tienen la longitud de `N` byte. En todos los demás casos, es probable que reduzca la eficiencia. - -Ejemplos de los valores que se pueden almacenar eficientemente en `FixedString`escrito columnas: - -- La representación binaria de direcciones IP (`FixedString(16)` para IPv6). -- Language codes (ru\_RU, en\_US … ). -- Currency codes (USD, RUB … ). -- Representación binaria de hashes (`FixedString(16)` para MD5, `FixedString(32)` para SHA256). - -Para almacenar valores UUID, utilice el [UUID](uuid.md) tipo de datos. - -Al insertar los datos, ClickHouse: - -- Complementa una cadena con bytes nulos si la cadena contiene menos de `N` byte. -- Lanza el `Too large value for FixedString(N)` excepción si la cadena contiene más de `N` byte. - -Al seleccionar los datos, ClickHouse no elimina los bytes nulos al final de la cadena. Si utiliza el `WHERE` cláusula, debe agregar bytes nulos manualmente para que coincida con el `FixedString` valor. En el ejemplo siguiente se muestra cómo utilizar el `WHERE` cláusula con `FixedString`. - -Consideremos la siguiente tabla con el único `FixedString(2)` columna: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -Consulta `SELECT * FROM FixedStringTable WHERE a = 'b'` no devuelve ningún dato como resultado. Debemos complementar el patrón de filtro con bytes nulos. - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -Este comportamiento difiere de MySQL para el `CHAR` tipo (donde las cadenas se rellenan con espacios y los espacios se eliminan para la salida). - -Tenga en cuenta que la longitud del `FixedString(N)` el valor es constante. El [longitud](../../sql_reference/functions/array_functions.md#array_functions-length) función devuelve `N` incluso si el `FixedString(N)` sólo se rellena con bytes nulos, pero el valor [vaciar](../../sql_reference/functions/string_functions.md#empty) función devuelve `1` en este caso. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/es/sql_reference/data_types/float.md b/docs/es/sql_reference/data_types/float.md deleted file mode 100644 index 53a4a1112a8..00000000000 --- a/docs/es/sql_reference/data_types/float.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 41 -toc_title: "Descripci\xF3n del producto" ---- - -# Descripción del producto {#float32-float64} - -[Números de punto flotante](https://en.wikipedia.org/wiki/IEEE_754). - -Los tipos son equivalentes a los tipos de C: - -- `Float32` - `float` -- `Float64` - `double` - -Le recomendamos que almacene los datos en formato entero siempre que sea posible. Por ejemplo, convierta números de precisión fija en valores enteros, como importes monetarios o tiempos de carga de página en milisegundos. - -## Uso de números de punto flotante {#using-floating-point-numbers} - -- Los cálculos con números de punto flotante pueden producir un error de redondeo. - - - -``` sql -SELECT 1 - 0.9 -``` - -``` text -┌───────minus(1, 0.9)─┐ -│ 0.09999999999999998 │ -└─────────────────────┘ -``` - -- El resultado del cálculo depende del método de cálculo (el tipo de procesador y la arquitectura del sistema informático). -- Los cálculos de puntos flotantes pueden dar como resultado números como el infinito (`Inf`) y “not-a-number” (`NaN`). Esto debe tenerse en cuenta al procesar los resultados de los cálculos. -- Al analizar números de punto flotante a partir de texto, el resultado puede no ser el número representable por máquina más cercano. - -## NaN y Inf {#data_type-float-nan-inf} - -A diferencia de SQL estándar, ClickHouse admite las siguientes categorías de números de punto flotante: - -- `Inf` – Infinity. - - - -``` sql -SELECT 0.5 / 0 -``` - -``` text -┌─divide(0.5, 0)─┐ -│ inf │ -└────────────────┘ -``` - -- `-Inf` – Negative infinity. - - - -``` sql -SELECT -0.5 / 0 -``` - -``` text -┌─divide(-0.5, 0)─┐ -│ -inf │ -└─────────────────┘ -``` - -- `NaN` – Not a number. - - - -``` sql -SELECT 0 / 0 -``` - -``` text -┌─divide(0, 0)─┐ -│ nan │ -└──────────────┘ -``` - - See the rules for `NaN` sorting in the section [ORDER BY clause](../sql_reference/statements/select.md). - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/float/) diff --git a/docs/es/sql_reference/data_types/index.md b/docs/es/sql_reference/data_types/index.md deleted file mode 100644 index f50f3461e18..00000000000 --- a/docs/es/sql_reference/data_types/index.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Data Types -toc_priority: 37 -toc_title: "Implantaci\xF3n" ---- - -# Tipos de datos {#data_types} - -ClickHouse puede almacenar varios tipos de datos en celdas de tabla. - -En esta sección se describen los tipos de datos admitidos y las consideraciones especiales para usarlos o implementarlos, si los hubiere. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/) diff --git a/docs/es/sql_reference/data_types/int_uint.md b/docs/es/sql_reference/data_types/int_uint.md deleted file mode 100644 index 4325bbd7a74..00000000000 --- a/docs/es/sql_reference/data_types/int_uint.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 40 -toc_title: UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64 ---- - -# UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64} - -Enteros de longitud fija, con o sin signo. - -## Rangos Int {#int-ranges} - -- Int8 - \[-128 : 127\] -- Int16 - \[-32768 : 32767\] -- Int32 - \[-2147483648 : 2147483647\] -- Int64 - \[-9223372036854775808 : 9223372036854775807\] - -## Rangos de Uint {#uint-ranges} - -- UInt8 - \[0 : 255\] -- UInt16 - \[0 : 65535\] -- UInt32 - \[0 : 4294967295\] -- UInt64 - \[0 : 18446744073709551615\] - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/int_uint/) diff --git a/docs/es/sql_reference/data_types/nested_data_structures/index.md b/docs/es/sql_reference/data_types/nested_data_structures/index.md deleted file mode 100644 index dc1bbb43826..00000000000 --- a/docs/es/sql_reference/data_types/nested_data_structures/index.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Nested Data Structures -toc_hidden: true -toc_priority: 54 -toc_title: oculto ---- - -# Estructuras de datos anidados {#nested-data-structures} - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/) diff --git a/docs/es/sql_reference/data_types/nested_data_structures/nested.md b/docs/es/sql_reference/data_types/nested_data_structures/nested.md deleted file mode 100644 index 21e2479756f..00000000000 --- a/docs/es/sql_reference/data_types/nested_data_structures/nested.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 57 -toc_title: Anidado (Nombre1 Tipo1, Nombre2 Tipo2, ...) ---- - -# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) consulta. Cada fila de la tabla puede corresponder a cualquier número de filas en una estructura de datos anidada. - -Ejemplo: - -``` sql -CREATE TABLE test.visits -( - CounterID UInt32, - StartDate Date, - Sign Int8, - IsNew UInt8, - VisitID UInt64, - UserID UInt64, - ... - Goals Nested - ( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32 - ), - ... -) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) -``` - -Este ejemplo declara la `Goals` estructura de datos anidada, que contiene datos sobre conversiones (objetivos alcanzados). Cada fila en el ‘visits’ la tabla puede corresponder a cero o cualquier número de conversiones. - -Solo se admite un único nivel de anidamiento. Las columnas de estructuras anidadas que contienen matrices son equivalentes a matrices multidimensionales, por lo que tienen un soporte limitado (no hay soporte para almacenar estas columnas en tablas con el motor MergeTree). - -En la mayoría de los casos, cuando se trabaja con una estructura de datos anidada, sus columnas se especifican con nombres de columna separados por un punto. Estas columnas forman una matriz de tipos coincidentes. Todas las matrices de columnas de una sola estructura de datos anidados tienen la misma longitud. - -Ejemplo: - -``` sql -SELECT - Goals.ID, - Goals.EventTime -FROM test.visits -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ -│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ -│ [1073752] │ ['2014-03-17 00:28:25'] │ -│ [1073752] │ ['2014-03-17 10:46:20'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ -│ [] │ [] │ -│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ -│ [] │ [] │ -│ [] │ [] │ -│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ -└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -Es más fácil pensar en una estructura de datos anidados como un conjunto de múltiples matrices de columnas de la misma longitud. - -El único lugar donde una consulta SELECT puede especificar el nombre de una estructura de datos anidada completa en lugar de columnas individuales es la cláusula ARRAY JOIN. Para obtener más información, consulte “ARRAY JOIN clause”. Ejemplo: - -``` sql -SELECT - Goal.ID, - Goal.EventTime -FROM test.visits -ARRAY JOIN Goals AS Goal -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goal.ID─┬──────Goal.EventTime─┐ -│ 1073752 │ 2014-03-17 16:38:10 │ -│ 591325 │ 2014-03-17 16:38:48 │ -│ 591325 │ 2014-03-17 16:42:27 │ -│ 1073752 │ 2014-03-17 00:28:25 │ -│ 1073752 │ 2014-03-17 10:46:20 │ -│ 1073752 │ 2014-03-17 13:59:20 │ -│ 591325 │ 2014-03-17 22:17:55 │ -│ 591325 │ 2014-03-17 22:18:07 │ -│ 591325 │ 2014-03-17 22:18:51 │ -│ 1073752 │ 2014-03-17 11:37:06 │ -└─────────┴─────────────────────┘ -``` - -No puede realizar SELECT para toda una estructura de datos anidados. Solo puede enumerar explícitamente columnas individuales que forman parte de él. - -Para una consulta INSERT, debe pasar todas las matrices de columnas de componentes de una estructura de datos anidada por separado (como si fueran matrices de columnas individuales). Durante la inserción, el sistema comprueba que tienen la misma longitud. - -Para DESCRIBIR consulta, las columnas anidadas estructura de datos se muestran por separado en la misma forma. - -La consulta ALTER para elementos en una estructura de datos anidados tiene limitaciones. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/es/sql_reference/data_types/nullable.md b/docs/es/sql_reference/data_types/nullable.md deleted file mode 100644 index 1bf2c919382..00000000000 --- a/docs/es/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 54 -toc_title: 'NULL' ---- - -# Nivel de Cifrado WEP) {#data_type-nullable} - -Permite almacenar marcador especial ([NULL](../../sql_reference/syntax.md)) que denota “missing value” junto con los valores normales permitidos por `TypeName`. Por ejemplo, un `Nullable(Int8)` tipo columna puede almacenar `Int8` valores de tipo, y las filas que no tienen un valor almacenarán `NULL`. - -Para un `TypeName`, no puede usar tipos de datos compuestos [Matriz](array.md) y [Tupla](tuple.md). Los tipos de datos compuestos pueden contener `Nullable` valores de tipo, como `Array(Nullable(Int8))`. - -A `Nullable` no se puede incluir en los índices de tabla. - -`NULL` es el valor predeterminado para cualquier `Nullable` tipo, a menos que se especifique lo contrario en la configuración del servidor ClickHouse. - -## Características de almacenamiento {#storage-features} - -Almacenar `Nullable` en una columna de tabla, ClickHouse usa un archivo separado con `NULL` máscaras además del archivo normal con valores. Las entradas en el archivo de máscaras permiten ClickHouse distinguir entre `NULL` y un valor predeterminado del tipo de datos correspondiente para cada fila de la tabla. Debido a un archivo adicional, `Nullable` La columna consume espacio de almacenamiento adicional en comparación con una normal similar. - -!!! info "Nota" - Utilizar `Nullable` casi siempre afecta negativamente al rendimiento, tenga esto en cuenta al diseñar sus bases de datos. - -## Ejemplo de uso {#usage-example} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y FROM t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/es/sql_reference/data_types/simpleaggregatefunction.md b/docs/es/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 120000 index 02fad64d50e..00000000000 --- a/docs/es/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/sql_reference/data_types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/es/sql_reference/data_types/special_data_types/index.md b/docs/es/sql_reference/data_types/special_data_types/index.md deleted file mode 100644 index 004d69df154..00000000000 --- a/docs/es/sql_reference/data_types/special_data_types/index.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Special Data Types -toc_hidden: true -toc_priority: 55 -toc_title: oculto ---- - -# Tipos de datos especiales {#special-data-types} - -Los valores de tipo de datos especiales no se pueden serializar para guardar en una tabla o salida en los resultados de la consulta, pero se pueden usar como un resultado intermedio durante la ejecución de la consulta. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/special_data_types/) diff --git a/docs/es/sql_reference/data_types/special_data_types/interval.md b/docs/es/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index 9546c8c4b8e..00000000000 --- a/docs/es/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 61 -toc_title: Intervalo ---- - -# Intervalo {#data-type-interval} - -La familia de tipos de datos que representan intervalos de fecha y hora. Los tipos resultantes del [INTERVAL](../../../sql_reference/operators.md#operator-interval) operador. - -!!! warning "Advertencia" - `Interval` los valores de tipo de datos no se pueden almacenar en tablas. - -Estructura: - -- Intervalo de tiempo como un valor entero sin signo. -- Tipo de intervalo. - -Tipos de intervalo admitidos: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -Para cada tipo de intervalo, hay un tipo de datos independiente. Por ejemplo, el `DAY` el intervalo corresponde a la `IntervalDay` tipo de datos: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## Observaciones de uso {#data-type-interval-usage-remarks} - -Usted puede utilizar `Interval`-type valores en operaciones aritméticas con [Fecha](../../../sql_reference/data_types/date.md) y [FechaHora](../../../sql_reference/data_types/datetime.md)-type valores. Por ejemplo, puede agregar 4 días a la hora actual: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -Los intervalos con diferentes tipos no se pueden combinar. No puedes usar intervalos como `4 DAY 1 HOUR`. Especifique los intervalos en unidades que son más pequeñas o iguales que la unidad más pequeña del intervalo, por ejemplo, el intervalo `1 day and an hour` se puede expresar como `25 HOUR` o `90000 SECOND`. - -No puede realizar operaciones aritméticas con `Interval`-type valores, pero puede agregar intervalos de diferentes tipos en consecuencia a los valores en `Date` o `DateTime` tipos de datos. Por ejemplo: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -La siguiente consulta provoca una excepción: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## Ver también {#see-also} - -- [INTERVAL](../../../sql_reference/operators.md#operator-interval) operador -- [ToInterval](../../../sql_reference/functions/type_conversion_functions.md#function-tointerval) funciones de conversión de tipo diff --git a/docs/es/sql_reference/data_types/special_data_types/nothing.md b/docs/es/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index 2f5144f701d..00000000000 --- a/docs/es/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 60 -toc_title: Nada ---- - -# Nada {#nothing} - -El único propósito de este tipo de datos es representar casos en los que no se espera un valor. Entonces no puedes crear un `Nothing` valor de tipo. - -Por ejemplo, literal [NULL](../../../sql_reference/syntax.md#null-literal) tiene tipo de `Nullable(Nothing)`. Ver más sobre [NULL](../../../sql_reference/data_types/nullable.md). - -El `Nothing` tipo puede también se utiliza para denotar matrices vacías: - -``` sql -SELECT toTypeName(array()) -``` - -``` text -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/es/sql_reference/data_types/special_data_types/set.md b/docs/es/sql_reference/data_types/special_data_types/set.md deleted file mode 100644 index 2b0fc5f5b13..00000000000 --- a/docs/es/sql_reference/data_types/special_data_types/set.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 59 -toc_title: Establecer ---- - -# Establecer {#set} - -Utilizado para la mitad derecha de un [IN](../../../sql_reference/statements/select.md#select-in-operators) expresion. - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/es/sql_reference/data_types/tuple.md b/docs/es/sql_reference/data_types/tuple.md deleted file mode 100644 index 70da0f1652d..00000000000 --- a/docs/es/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 53 -toc_title: Tuple (T1, T2, ...) ---- - -# Tuple(t1, T2, …) {#tuplet1-t2} - -Una tupla de elementos, cada uno con un individuo [tipo](index.md#data_types). - -Las tuplas se utilizan para la agrupación temporal de columnas. Las columnas se pueden agrupar cuando se usa una expresión IN en una consulta y para especificar ciertos parámetros formales de las funciones lambda. Para obtener más información, consulte las secciones [IN operadores](../../sql_reference/statements/select.md) y [Funciones de orden superior](../../sql_reference/functions/higher_order_functions.md). - -Las tuplas pueden ser el resultado de una consulta. En este caso, para formatos de texto distintos de JSON, los valores están separados por comas entre corchetes. En formatos JSON, las tuplas se generan como matrices (entre corchetes). - -## Creación de una tupla {#creating-a-tuple} - -Puedes usar una función para crear una tupla: - -``` sql -tuple(T1, T2, ...) -``` - -Ejemplo de creación de una tupla: - -``` sql -SELECT tuple(1,'a') AS x, toTypeName(x) -``` - -``` text -┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ -│ (1,'a') │ Tuple(UInt8, String) │ -└─────────┴───────────────────────────┘ -``` - -## Trabajar con tipos de datos {#working-with-data-types} - -Al crear una tupla sobre la marcha, ClickHouse detecta automáticamente el tipo de cada argumento como el mínimo de los tipos que pueden almacenar el valor del argumento. Si el argumento es [NULL](../../sql_reference/syntax.md#null-literal), el tipo del elemento de tupla es [NULL](nullable.md). - -Ejemplo de detección automática de tipos de datos: - -``` sql -SELECT tuple(1, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ -│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ -└──────────┴─────────────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/es/sql_reference/data_types/uuid.md b/docs/es/sql_reference/data_types/uuid.md deleted file mode 100644 index 32182011548..00000000000 --- a/docs/es/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 46 -toc_title: UUID ---- - -# UUID {#uuid-data-type} - -Un identificador único universal (UUID) es un número de 16 bytes utilizado para identificar registros. Para obtener información detallada sobre el UUID, consulte [Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -El ejemplo de valor de tipo UUID se representa a continuación: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -Si no especifica el valor de la columna UUID al insertar un nuevo registro, el valor UUID se rellena con cero: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## Cómo generar {#how-to-generate} - -Para generar el valor UUID, ClickHouse proporciona el [GenerateUUIDv4](../../sql_reference/functions/uuid_functions.md) función. - -## Ejemplo de uso {#usage-example} - -**Ejemplo 1** - -En este ejemplo se muestra la creación de una tabla con la columna de tipo UUID e insertar un valor en la tabla. - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**Ejemplo 2** - -En este ejemplo, el valor de la columna UUID no se especifica al insertar un nuevo registro. - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## Restricción {#restrictions} - -El tipo de datos UUID sólo admite funciones que [Cadena](string.md) tipo de datos también soporta (por ejemplo, [minuto](../../sql_reference/aggregate_functions/reference.md#agg_function-min), [máximo](../../sql_reference/aggregate_functions/reference.md#agg_function-max), y [contar](../../sql_reference/aggregate_functions/reference.md#agg_function-count)). - -El tipo de datos UUID no es compatible con operaciones aritméticas (por ejemplo, [abdominales](../../sql_reference/functions/arithmetic_functions.md#arithm_func-abs)) o funciones agregadas, tales como [resumir](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) y [avg](../../sql_reference/aggregate_functions/reference.md#agg_function-avg). - -[Artículo Original](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index 6b64d47c0c0..00000000000 --- a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 39 -toc_title: "Descripci\xF3n General" ---- - -# Diccionarios externos {#dicts-external-dicts} - -Puede agregar sus propios diccionarios de varias fuentes de datos. El origen de datos de un diccionario puede ser un archivo ejecutable o de texto local, un recurso HTTP u otro DBMS. Para obtener más información, consulte “[Fuentes para diccionarios externos](external_dicts_dict_sources.md)”. - -Haga clic en Casa: - -- Almacena total o parcialmente los diccionarios en RAM. -- Actualiza periódicamente los diccionarios y carga dinámicamente los valores que faltan. En otras palabras, los diccionarios se pueden cargar dinámicamente. -- Permite crear diccionarios externos con archivos xml o [Consultas DDL](../../statements/create.md#create-dictionary-query). - -La configuración de diccionarios externos se puede ubicar en uno o más archivos xml. La ruta de acceso a la configuración se especifica en el [Diccionarios\_config](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_config) parámetro. - -Los diccionarios se pueden cargar en el inicio del servidor o en el primer uso, dependiendo de la [Diccionarios\_lazy\_load](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) configuración. - -El archivo de configuración del diccionario tiene el siguiente formato: - -``` xml - - An optional element with any content. Ignored by the ClickHouse server. - - - /etc/metrika.xml - - - - - - - - -``` - -Usted puede [configurar](external_dicts_dict.md) cualquier número de diccionarios en el mismo archivo. - -[Consultas DDL para diccionarios](../../statements/create.md#create-dictionary-query) no requiere ningún registro adicional en la configuración del servidor. Permiten trabajar con diccionarios como entidades de primera clase, como tablas o vistas. - -!!! attention "Atención" - Puede convertir valores para un diccionario pequeño describiéndolo en un `SELECT` consulta (ver el [transformar](../../../sql_reference/functions/other_functions.md) función). Esta funcionalidad no está relacionada con diccionarios externos. - -## Ver también {#ext-dicts-see-also} - -- [Configuración de un diccionario externo](external_dicts_dict.md) -- [Almacenamiento de diccionarios en la memoria](external_dicts_dict_layout.md) -- [Actualizaciones del diccionario](external_dicts_dict_lifetime.md) -- [Fuentes de diccionarios externos](external_dicts_dict_sources.md) -- [Clave y campos del diccionario](external_dicts_dict_structure.md) -- [Funciones para trabajar con diccionarios externos](../../../sql_reference/functions/ext_dict_functions.md) - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index 18481e0a9ef..00000000000 --- a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 40 -toc_title: "Configuraci\xF3n de un diccionario externo" ---- - -# Configuración de un diccionario externo {#dicts-external-dicts-dict} - -Si el diccionario se configura usando un archivo xml, la configuración del diccionario tiene la siguiente estructura: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -Correspondiente [Consulta DDL](../../statements/create.md#create-dictionary-query) tiene la siguiente estructura: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. -- [fuente](external_dicts_dict_sources.md) — Source of the dictionary. -- [diseño](external_dicts_dict_layout.md) — Dictionary layout in memory. -- [estructura](external_dicts_dict_structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. -- [vida](external_dicts_dict_lifetime.md) — Frequency of dictionary updates. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index 23b6cf6ee3e..00000000000 --- a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 45 -toc_title: "Diccionarios jer\xE1rquicos" ---- - -# Diccionarios jerárquicos {#hierarchical-dictionaries} - -ClickHouse soporta diccionarios jerárquicos con un [llave numérica](external_dicts_dict_structure.md#ext_dict-numeric-key). - -Mira la siguiente estructura jerárquica: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -Esta jerarquía se puede expresar como la siguiente tabla de diccionario. - -| region\_id | parent\_region | nombre\_región | -|------------|----------------|----------------| -| 1 | 0 | Rusia | -| 2 | 1 | Moscu | -| 3 | 2 | Centrar | -| 4 | 0 | Gran Bretaña | -| 5 | 4 | Londres | - -Esta tabla contiene una columna `parent_region` que contiene la clave del padre más cercano para el elemento. - -ClickHouse soporta el [jerárquica](external_dicts_dict_structure.md#hierarchical-dict-attr) propiedad para [diccionario externo](index.md) atributo. Esta propiedad le permite configurar el diccionario jerárquico similar al descrito anteriormente. - -El [dictGetHierarchy](../../../sql_reference/functions/ext_dict_functions.md#dictgethierarchy) función le permite obtener la cadena principal de un elemento. - -Para nuestro ejemplo, la estructura del diccionario puede ser la siguiente: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index 9478b239914..00000000000 --- a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,373 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 41 -toc_title: Almacenamiento de diccionarios en la memoria ---- - -# Almacenamiento de diccionarios en la memoria {#dicts-external-dicts-dict-layout} - -Hay una variedad de formas de almacenar diccionarios en la memoria. - -Recomendamos [plano](#flat), [Hashed](#dicts-external_dicts_dict_layout-hashed) y [Método de codificación de datos:](#complex-key-hashed). que proporcionan una velocidad de procesamiento óptima. - -No se recomienda el almacenamiento en caché debido al rendimiento potencialmente bajo y las dificultades para seleccionar los parámetros óptimos. Lea más en la sección “[cache](#cache)”. - -Hay varias formas de mejorar el rendimiento del diccionario: - -- Llame a la función para trabajar con el diccionario después `GROUP BY`. -- Marque los atributos para extraer como inyectivos. Un atributo se llama injective si diferentes valores de atributo corresponden a claves diferentes. Entonces, cuando `GROUP BY` utiliza una función que obtiene un valor de atributo mediante la clave, esta función se elimina automáticamente de `GROUP BY`. - -ClickHouse genera una excepción para errores con diccionarios. Ejemplos de errores: - -- No se pudo cargar el diccionario al que se accede. -- Error al consultar un `cached` diccionario. - -Puede ver la lista de diccionarios externos y sus estados en el `system.dictionaries` tabla. - -La configuración se ve así: - -``` xml - - - ... - - - - - - ... - - -``` - -Correspondiente [Consulta DDL](../../statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## Maneras de almacenar diccionarios en la memoria {#ways-to-store-dictionaries-in-memory} - -- [plano](#flat) -- [Hashed](#dicts-external_dicts_dict_layout-hashed) -- [Sistema abierto.](#dicts-external_dicts_dict_layout-sparse_hashed) -- [cache](#cache) -- [range\_hashed](#range-hashed) -- [Método de codificación de datos:](#complex-key-hashed) -- [complejo\_key\_cache](#complex-key-cache) -- [Método de codificación de datos:](#ip-trie) - -### plano {#flat} - -El diccionario está completamente almacenado en la memoria en forma de matrices planas. ¿Cuánta memoria usa el diccionario? La cantidad es proporcional al tamaño de la clave más grande (en el espacio utilizado). - -La clave del diccionario tiene el `UInt64` tipo y el valor está limitado a 500.000. Si se descubre una clave más grande al crear el diccionario, ClickHouse produce una excepción y no crea el diccionario. - -Se admiten todos los tipos de fuentes. Al actualizar, los datos (de un archivo o de una tabla) se leen en su totalidad. - -Este método proporciona el mejor rendimiento entre todos los métodos disponibles para almacenar el diccionario. - -Ejemplo de configuración: - -``` xml - - - -``` - -o - -``` sql -LAYOUT(FLAT()) -``` - -### Hashed {#dicts-external_dicts_dict_layout-hashed} - -El diccionario está completamente almacenado en la memoria en forma de una tabla hash. El diccionario puede contener cualquier número de elementos con cualquier identificador En la práctica, el número de claves puede alcanzar decenas de millones de elementos. - -Se admiten todos los tipos de fuentes. Al actualizar, los datos (de un archivo o de una tabla) se leen en su totalidad. - -Ejemplo de configuración: - -``` xml - - - -``` - -o - -``` sql -LAYOUT(HASHED()) -``` - -### Sistema abierto. {#dicts-external_dicts_dict_layout-sparse_hashed} - -Similar a `hashed`, pero usa menos memoria a favor más uso de CPU. - -Ejemplo de configuración: - -``` xml - - - -``` - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### Método de codificación de datos: {#complex-key-hashed} - -Este tipo de almacenamiento es para su uso con material compuesto [claves](external_dicts_dict_structure.md). Similar a `hashed`. - -Ejemplo de configuración: - -``` xml - - - -``` - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### range\_hashed {#range-hashed} - -El diccionario se almacena en la memoria en forma de una tabla hash con una matriz ordenada de rangos y sus valores correspondientes. - -Este método de almacenamiento funciona de la misma manera que hash y permite el uso de intervalos de fecha / hora (tipo numérico arbitrario) además de la clave. - -Ejemplo: La tabla contiene descuentos para cada anunciante en el formato: - -``` text -+---------|-------------|-------------|------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------|-------------|-------------|------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------|-------------|-------------|------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------|-------------|-------------|------+ -``` - -Para utilizar un ejemplo para intervalos de fechas, defina el `range_min` y `range_max` elementos en el [estructura](external_dicts_dict_structure.md). Estos elementos deben contener elementos `name` y`type` (si `type` no se especifica, se utilizará el tipo predeterminado - Fecha). `type` puede ser de cualquier tipo numérico (Fecha / DateTime / UInt64 / Int32 / otros). - -Ejemplo: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -o - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -Para trabajar con estos diccionarios, debe pasar un argumento adicional al `dictGetT` función, para la que se selecciona un rango: - -``` sql -dictGetT('dict_name', 'attr_name', id, date) -``` - -Esta función devuelve el valor para el `id`s y el intervalo de fechas que incluye la fecha pasada. - -Detalles del algoritmo: - -- Si el `id` no se encuentra o no se encuentra un rango para el `id` devuelve el valor predeterminado para el diccionario. -- Si hay rangos superpuestos, puede usar cualquiera. -- Si el delimitador de rango es `NULL` o una fecha no válida (como 1900-01-01 o 2039-01-01), el rango se deja abierto. La gama puede estar abierta en ambos lados. - -Ejemplo de configuración: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -o - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### cache {#cache} - -El diccionario se almacena en una memoria caché que tiene un número fijo de celdas. Estas celdas contienen elementos de uso frecuente. - -Al buscar un diccionario, primero se busca en la memoria caché. Para cada bloque de datos, todas las claves que no se encuentran en la memoria caché o están desactualizadas se solicitan desde el origen utilizando `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Los datos recibidos se escriben en la memoria caché. - -Para los diccionarios de caché, la caducidad [vida](external_dicts_dict_lifetime.md) de datos en la memoria caché se puede establecer. Si más tiempo que `lifetime` ha pasado desde que se cargaron los datos en una celda, el valor de la celda no se usa y se vuelve a solicitar la próxima vez que se deba usar. -Esta es la menos efectiva de todas las formas de almacenar diccionarios. La velocidad de la memoria caché depende en gran medida de la configuración correcta y del escenario de uso. Un diccionario de tipo de caché funciona bien solo cuando las tasas de aciertos son lo suficientemente altas (recomendado 99% y superior). Puede ver la tasa de aciertos promedio en el `system.dictionaries` tabla. - -Para mejorar el rendimiento de la caché, utilice una subconsulta con `LIMIT`, y llame a la función con el diccionario externamente. - -Apoyar [fuente](external_dicts_dict_sources.md): MySQL, ClickHouse, ejecutable, HTTP. - -Ejemplo de configuración: - -``` xml - - - - 1000000000 - - -``` - -o - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -Establezca un tamaño de caché lo suficientemente grande. Necesitas experimentar para seleccionar el número de celdas: - -1. Establecer algún valor. -2. Ejecute consultas hasta que la memoria caché esté completamente llena. -3. Evalúe el consumo de memoria utilizando el `system.dictionaries` tabla. -4. Aumente o disminuya el número de celdas hasta que se alcance el consumo de memoria requerido. - -!!! warning "Advertencia" - No use ClickHouse como fuente, ya que es lento procesar consultas con lecturas aleatorias. - -### complejo\_key\_cache {#complex-key-cache} - -Este tipo de almacenamiento es para su uso con material compuesto [claves](external_dicts_dict_structure.md). Similar a `cache`. - -### Método de codificación de datos: {#ip-trie} - -Este tipo de almacenamiento sirve para asignar prefijos de red (direcciones IP) a metadatos como ASN. - -Ejemplo: La tabla contiene prefijos de red y su correspondiente número AS y código de país: - -``` text - +-----------|-----|------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------|-----|------+ - | 2620:0:870::/48 | 3856 | US | - +-----------|-----|------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------|-----|------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------|-----|------+ -``` - -Cuando se utiliza este tipo de diseño, la estructura debe tener una clave compuesta. - -Ejemplo: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -o - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -La clave debe tener solo un atributo de tipo String que contenga un prefijo IP permitido. Todavía no se admiten otros tipos. - -Para consultas, debe utilizar las mismas funciones (`dictGetT` con una tupla) como para diccionarios con claves compuestas: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -La función toma cualquiera `UInt32` para IPv4, o `FixedString(16)` para IPv6: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -Todavía no se admiten otros tipos. La función devuelve el atributo para el prefijo que corresponde a esta dirección IP. Si hay prefijos superpuestos, se devuelve el más específico. - -Los datos se almacenan en un `trie`. Debe encajar completamente en la RAM. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index 78df541cff6..00000000000 --- a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 42 -toc_title: Actualizaciones del diccionario ---- - -# Actualizaciones del diccionario {#dictionary-updates} - -ClickHouse actualiza periódicamente los diccionarios. El intervalo de actualización para los diccionarios completamente descargados y el intervalo de invalidación para los diccionarios almacenados en caché se `` etiqueta en segundos. - -Las actualizaciones del diccionario (aparte de la carga para el primer uso) no bloquean las consultas. Durante las actualizaciones, se utiliza la versión anterior de un diccionario. Si se produce un error durante una actualización, el error se escribe en el registro del servidor y las consultas continúan utilizando la versión anterior de los diccionarios. - -Ejemplo de configuración: - -``` xml - - ... - 300 - ... - -``` - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -Configuración `0` (`LIFETIME(0)`) impide que los diccionarios se actualicen. - -Puede establecer un intervalo de tiempo para las actualizaciones, y ClickHouse elegirá un tiempo uniformemente aleatorio dentro de este rango. Esto es necesario para distribuir la carga en la fuente del diccionario cuando se actualiza en una gran cantidad de servidores. - -Ejemplo de configuración: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -o - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -Al actualizar los diccionarios, el servidor ClickHouse aplica una lógica diferente según el tipo de [fuente](external_dicts_dict_sources.md): - -- Para un archivo de texto, comprueba el tiempo de modificación. Si la hora difiere de la hora previamente grabada, el diccionario se actualiza. -- Para las tablas MyISAM, el tiempo de modificación se comprueba utilizando un `SHOW TABLE STATUS` consulta. -- Los diccionarios de otras fuentes se actualizan cada vez de forma predeterminada. - -Para fuentes MySQL (InnoDB), ODBC y ClickHouse, puede configurar una consulta que actualizará los diccionarios solo si realmente cambiaron, en lugar de cada vez. Para ello, siga estos pasos: - -- La tabla del diccionario debe tener un campo que siempre cambie cuando se actualizan los datos de origen. -- La configuración del origen debe especificar una consulta que recupere el campo de cambio. El servidor ClickHouse interpreta el resultado de la consulta como una fila, y si esta fila ha cambiado en relación con su estado anterior, el diccionario se actualiza. Especifique la consulta en el `` en la configuración de la [fuente](external_dicts_dict_sources.md). - -Ejemplo de configuración: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -o - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index e239fa6c5e5..00000000000 --- a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,608 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 43 -toc_title: Fuentes de diccionarios externos ---- - -# Fuentes de diccionarios externos {#dicts-external-dicts-dict-sources} - -Un diccionario externo se puede conectar desde muchas fuentes diferentes. - -Si el diccionario se configura usando xml-file, la configuración se ve así: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -En caso de [Consulta DDL](../../statements/create.md#create-dictionary-query), la configuración igual parecerá: - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -El origen está configurado en el `source` apartado. - -Tipos de fuentes (`source_type`): - -- [Archivo Local](#dicts-external_dicts_dict_sources-local_file) -- [Archivo ejecutable](#dicts-external_dicts_dict_sources-executable) -- [HTTP(s))](#dicts-external_dicts_dict_sources-http) -- DBMS - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [Haga clic en Casa](#dicts-external_dicts_dict_sources-clickhouse) - - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) - - [Redis](#dicts-external_dicts_dict_sources-redis) - -## Archivo Local {#dicts-external_dicts_dict_sources-local_file} - -Ejemplo de configuración: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -o - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Configuración de campos: - -- `path` – The absolute path to the file. -- `format` – The file format. All the formats described in “[Formato](../../../interfaces/formats.md#formats)” son compatibles. - -## Archivo ejecutable {#dicts-external_dicts_dict_sources-executable} - -Trabajar con archivos ejecutables depende de [cómo se almacena el diccionario en la memoria](external_dicts_dict_layout.md). Si el diccionario se almacena usando `cache` y `complex_key_cache`, ClickHouse solicita las claves necesarias enviando una solicitud al STDIN del archivo ejecutable. De lo contrario, ClickHouse inicia el archivo ejecutable y trata su salida como datos del diccionario. - -Ejemplo de configuración: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -o - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Configuración de campos: - -- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). -- `format` – The file format. All the formats described in “[Formato](../../../interfaces/formats.md#formats)” son compatibles. - -## Http(s) {#dicts-external_dicts_dict_sources-http} - -Trabajar con un servidor HTTP depende de [cómo se almacena el diccionario en la memoria](external_dicts_dict_layout.md). Si el diccionario se almacena usando `cache` y `complex_key_cache`, ClickHouse solicita las claves necesarias enviando una solicitud a través del `POST` método. - -Ejemplo de configuración: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -o - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -Para que ClickHouse tenga acceso a un recurso HTTPS, debe [configurar openSSL](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-openssl) en la configuración del servidor. - -Configuración de campos: - -- `url` – The source URL. -- `format` – The file format. All the formats described in “[Formato](../../../interfaces/formats.md#formats)” son compatibles. -- `credentials` – Basic HTTP authentication. Optional parameter. - - `user` – Username required for the authentication. - - `password` – Password required for the authentication. -- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. - - `header` – Single HTTP header entry. - - `name` – Identifiant name used for the header send on the request. - - `value` – Value set for a specific identifiant name. - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -Puede utilizar este método para conectar cualquier base de datos que tenga un controlador ODBC. - -Ejemplo de configuración: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -o - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -Configuración de campos: - -- `db` – Name of the database. Omit it if the database name is set in the `` parámetros. -- `table` – Name of the table and schema if exists. -- `connection_string` – Connection string. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Actualización de diccionarios](external_dicts_dict_lifetime.md). - -ClickHouse recibe símbolos de cotización del controlador ODBC y cita todas las configuraciones en las consultas al controlador, por lo que es necesario establecer el nombre de la tabla de acuerdo con el caso del nombre de la tabla en la base de datos. - -Si tiene problemas con las codificaciones al utilizar Oracle, consulte el [FAQ](../../../faq/general.md#oracle-odbc-encodings) artículo. - -### Vulnerabilidad conocida de la funcionalidad del diccionario ODBC {#known-vulnerability-of-the-odbc-dictionary-functionality} - -!!! attention "Atención" - Cuando se conecta a la base de datos a través del parámetro de conexión del controlador ODBC `Servername` puede ser sustituido. En este caso los valores de `USERNAME` y `PASSWORD` de `odbc.ini` se envían al servidor remoto y pueden verse comprometidos. - -**Ejemplo de uso inseguro** - -Vamos a configurar unixODBC para PostgreSQL. Contenido de `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -Si luego realiza una consulta como - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -El controlador ODBC enviará valores de `USERNAME` y `PASSWORD` de `odbc.ini` a `some-server.com`. - -### Ejemplo de conexión Postgresql {#example-of-connecting-postgresql} - -Sistema operativo Ubuntu. - -Instalación de unixODBC y el controlador ODBC para PostgreSQL: - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -Configuración `/etc/odbc.ini` (o `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -La configuración del diccionario en ClickHouse: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -o - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) -``` - -Es posible que tenga que editar `odbc.ini` para especificar la ruta completa a la biblioteca con el controlador `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### Ejemplo de conexión de MS SQL Server {#example-of-connecting-ms-sql-server} - -Sistema operativo Ubuntu. - -Instalación del controlador: : - -``` bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -Configuración del controlador: - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -Configuración del diccionario en ClickHouse: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -o - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## DBMS {#dbms} - -### Mysql {#dicts-external_dicts_dict_sources-mysql} - -Ejemplo de configuración: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -o - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -Configuración de campos: - -- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). - -- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `replica` – Section of replica configurations. There can be multiple sections. - - - `replica/host` – The MySQL host. - - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. - -- `db` – Name of the database. - -- `table` – Name of the table. - -- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` cláusula en MySQL, por ejemplo, `id > 10 AND id < 20`. Parámetro opcional. - -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Actualización de diccionarios](external_dicts_dict_lifetime.md). - -MySQL se puede conectar en un host local a través de sockets. Para hacer esto, establezca `host` y `socket`. - -Ejemplo de configuración: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -o - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### Inicio {#dicts-external_dicts_dict_sources-clickhouse} - -Ejemplo de configuración: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -o - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -Configuración de campos: - -- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [Distribuido](../../../engines/table_engines/special/distributed.md) tabla e ingrésela en configuraciones posteriores. -- `port` – The port on the ClickHouse server. -- `user` – Name of the ClickHouse user. -- `password` – Password of the ClickHouse user. -- `db` – Name of the database. -- `table` – Name of the table. -- `where` – The selection criteria. May be omitted. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Actualización de diccionarios](external_dicts_dict_lifetime.md). - -### Mongodb {#dicts-external_dicts_dict_sources-mongodb} - -Ejemplo de configuración: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -o - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -Configuración de campos: - -- `host` – The MongoDB host. -- `port` – The port on the MongoDB server. -- `user` – Name of the MongoDB user. -- `password` – Password of the MongoDB user. -- `db` – Name of the database. -- `collection` – Name of the collection. - -### Redis {#dicts-external_dicts_dict_sources-redis} - -Ejemplo de configuración: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -o - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -Configuración de campos: - -- `host` – The Redis host. -- `port` – The port on the Redis server. -- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` es para fuentes simples y para fuentes de clave única hash, `hash_map` es para fuentes hash con dos teclas. Los orígenes a distancia y los orígenes de caché con clave compleja no son compatibles. Puede omitirse, el valor predeterminado es `simple`. -- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index 0c53ae71210..00000000000 --- a/docs/es/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 44 -toc_title: Clave y campos del diccionario ---- - -# Clave y campos del diccionario {#dictionary-key-and-fields} - -El `` cláusula describe la clave del diccionario y los campos disponibles para consultas. - -Descripción XML: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -Los atributos se describen en los elementos: - -- `` — [Columna clave](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [Columna de datos](external_dicts_dict_structure.md#ext_dict_structure-attributes). Puede haber un número múltiple de atributos. - -Consulta DDL: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -Los atributos se describen en el cuerpo de la consulta: - -- `PRIMARY KEY` — [Columna clave](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [Columna de datos](external_dicts_dict_structure.md#ext_dict_structure-attributes). Puede haber un número múltiple de atributos. - -## Clave {#ext_dict_structure-key} - -ClickHouse admite los siguientes tipos de claves: - -- Tecla numérica. `UInt64`. Definido en el `` etiqueta o usando `PRIMARY KEY` palabra clave. -- Clave compuesta. Conjunto de valores de diferentes tipos. Definido en la etiqueta `` o `PRIMARY KEY` palabra clave. - -Una estructura xml puede contener `` o ``. La consulta DDL debe contener `PRIMARY KEY`. - -!!! warning "Advertencia" - No debe describir la clave como un atributo. - -### Tecla numérica {#ext_dict-numeric-key} - -Tipo: `UInt64`. - -Ejemplo de configuración: - -``` xml - - Id - -``` - -Campos de configuración: - -- `name` – The name of the column with keys. - -Para consulta DDL: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – The name of the column with keys. - -### Clave compuesta {#composite-key} - -La clave puede ser un `tuple` de cualquier tipo de campo. El [diseño](external_dicts_dict_layout.md) en este caso debe ser `complex_key_hashed` o `complex_key_cache`. - -!!! tip "Consejo" - Una clave compuesta puede consistir en un solo elemento. Esto hace posible usar una cadena como clave, por ejemplo. - -La estructura clave se establece en el elemento ``. Los campos clave se especifican en el mismo formato que el diccionario [atributo](external_dicts_dict_structure.md). Ejemplo: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -o - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -Para una consulta al `dictGet*` función, una tupla se pasa como la clave. Ejemplo: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## Atributo {#ext_dict_structure-attributes} - -Ejemplo de configuración: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -o - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -Campos de configuración: - -| Etiqueta | Descripci | Requerir | -|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| -| `name` | Nombre de columna. | Sí | -| `type` | Tipo de datos ClickHouse.
ClickHouse intenta convertir el valor del diccionario al tipo de datos especificado. Por ejemplo, para MySQL, el campo podría ser `TEXT`, `VARCHAR`, o `BLOB` en la tabla fuente de MySQL, pero se puede cargar como `String` en ClickHouse.
[NULL](../../../sql_reference/data_types/nullable.md) no es compatible. | Sí | -| `null_value` | Valor predeterminado para un elemento no existente.
En el ejemplo, es una cadena vacía. No se puede utilizar `NULL` en este campo. | Sí | -| `expression` | [Expresion](../../syntax.md#syntax-expressions) que ClickHouse ejecuta en el valor.
La expresión puede ser un nombre de columna en la base de datos SQL remota. Por lo tanto, puede usarlo para crear un alias para la columna remota.

Valor predeterminado: sin expresión. | No | -| `hierarchical` | Si `true` el atributo contiene el valor de una clave primaria para la clave actual. Ver [Diccionarios jerárquicos](external_dicts_dict_hierarchical.md).

Valor predeterminado: `false`. | No | -| `injective` | Indicador que muestra si el `id -> attribute` la imagen es [inyectivo](https://en.wikipedia.org/wiki/Injective_function).
Si `true`, ClickHouse puede colocar automáticamente después de la `GROUP BY` cláusula las solicitudes a los diccionarios con inyección. Por lo general, reduce significativamente la cantidad de tales solicitudes.

Valor predeterminado: `false`. | No | -| `is_object_id` | Indicador que muestra si la consulta se ejecuta para un documento MongoDB mediante `ObjectID`.

Valor predeterminado: `false`. | No | - -## Ver también {#see-also} - -- [Funciones para trabajar con diccionarios externos](../../../sql_reference/functions/ext_dict_functions.md). - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/es/sql_reference/dictionaries/index.md b/docs/es/sql_reference/dictionaries/index.md deleted file mode 100644 index 610f2ac865e..00000000000 --- a/docs/es/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Dictionaries -toc_priority: 35 -toc_title: "Implantaci\xF3n" ---- - -# Diccionario {#dictionaries} - -Un diccionario es un mapeo (`key -> attributes`) que es conveniente para varios tipos de listas de referencia. - -ClickHouse admite funciones especiales para trabajar con diccionarios que se pueden usar en consultas. Es más fácil y más eficiente usar diccionarios con funciones que un `JOIN` con tablas de referencia. - -[NULL](../syntax.md#null) los valores no se pueden almacenar en un diccionario. - -Soporta ClickHouse: - -- [Diccionarios incorporados](internal_dicts.md#internal_dicts) con una específica [conjunto de funciones](../../sql_reference/functions/ym_dict_functions.md). -- [Diccionarios complementarios (externos)](external_dictionaries/external_dicts.md) con un [neto de funciones](../../sql_reference/functions/ext_dict_functions.md). - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/es/sql_reference/dictionaries/internal_dicts.md b/docs/es/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index 24da4deb80f..00000000000 --- a/docs/es/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 39 -toc_title: Diccionarios internos ---- - -# Diccionarios internos {#internal_dicts} - -ClickHouse contiene una función integrada para trabajar con una geobase. - -Esto le permite: - -- Utilice el ID de una región para obtener su nombre en el idioma deseado. -- Utilice el ID de una región para obtener el ID de una ciudad, área, distrito federal, país o continente. -- Compruebe si una región es parte de otra región. -- Obtener una cadena de regiones principales. - -Todas las funciones de apoyo “translocality,” la capacidad de utilizar simultáneamente diferentes perspectivas sobre la propiedad de la región. Para obtener más información, consulte la sección “Functions for working with Yandex.Metrica dictionaries”. - -Los diccionarios internos están deshabilitados en el paquete predeterminado. -Para habilitarlos, descomente los parámetros `path_to_regions_hierarchy_file` y `path_to_regions_names_files` en el archivo de configuración del servidor. - -La geobase se carga desde archivos de texto. - -Coloque el `regions_hierarchy*.txt` archivos en el `path_to_regions_hierarchy_file` directorio. Este parámetro de configuración debe contener la ruta `regions_hierarchy.txt` archivo (la jerarquía regional predeterminada), y los otros archivos (`regions_hierarchy_ua.txt`) debe estar ubicado en el mismo directorio. - -Ponga el `regions_names_*.txt` archivos en el `path_to_regions_names_files` directorio. - -También puede crear estos archivos usted mismo. El formato de archivo es el siguiente: - -`regions_hierarchy*.txt`: TabSeparated (sin encabezado), columnas: - -- ID de la región (`UInt32`) -- ID de región padre (`UInt32`) -- tipo de región (`UInt8`): 1 - continente, 3 - país, 4 - distrito federal, 5 - región, 6 - ciudad; otros tipos no tienen valores -- población (`UInt32`) — optional column - -`regions_names_*.txt`: TabSeparated (sin encabezado), columnas: - -- ID de la región (`UInt32`) -- nombre de la región (`String`) — Can't contain tabs or line feeds, even escaped ones. - -Una matriz plana se usa para almacenar en RAM. Por esta razón, los ID no deberían ser más de un millón. - -Los diccionarios se pueden actualizar sin reiniciar el servidor. Sin embargo, el conjunto de diccionarios disponibles no se actualiza. -Para las actualizaciones, se comprueban los tiempos de modificación de archivos. Si un archivo ha cambiado, el diccionario se actualiza. -El intervalo para comprobar si hay cambios se configura en el `builtin_dictionaries_reload_interval` parámetro. -Las actualizaciones del diccionario (aparte de la carga al primer uso) no bloquean las consultas. Durante las actualizaciones, las consultas utilizan las versiones anteriores de los diccionarios. Si se produce un error durante una actualización, el error se escribe en el registro del servidor y las consultas continúan utilizando la versión anterior de los diccionarios. - -Recomendamos actualizar periódicamente los diccionarios con la geobase. Durante una actualización, genere nuevos archivos y escríbalos en una ubicación separada. Cuando todo esté listo, cambie el nombre a los archivos utilizados por el servidor. - -También hay funciones para trabajar con identificadores de sistema operativo y Yandex.Motores de búsqueda Metrica, pero no deben ser utilizados. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/es/sql_reference/functions/arithmetic_functions.md b/docs/es/sql_reference/functions/arithmetic_functions.md deleted file mode 100644 index bc407f7b622..00000000000 --- a/docs/es/sql_reference/functions/arithmetic_functions.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 35 -toc_title: "Aritm\xE9tica" ---- - -# Funciones aritméticas {#arithmetic-functions} - -Para todas las funciones aritméticas, el tipo de resultado se calcula como el tipo de número más pequeño en el que encaja el resultado, si existe dicho tipo. El mínimo se toma simultáneamente en función del número de bits, si está firmado y si flota. Si no hay suficientes bits, se toma el tipo de bit más alto. - -Ejemplo: - -``` sql -SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) -``` - -``` text -┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ -│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ -└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ -``` - -Las funciones aritméticas funcionan para cualquier par de tipos de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 o Float64. - -El desbordamiento se produce de la misma manera que en C ++. - -## más (a, b), a + b operador {#plusa-b-a-b-operator} - -Calcula la suma de los números. -También puede agregar números enteros con una fecha o fecha y hora. En el caso de una fecha, agregar un entero significa agregar el número correspondiente de días. Para una fecha con hora, significa agregar el número correspondiente de segundos. - -## menos(a, b), a - b operador {#minusa-b-a-b-operator} - -Calcula la diferencia. El resultado siempre está firmado. - -You can also calculate integer numbers from a date or date with time. The idea is the same – see above for ‘plus’. - -## multiplicar(a, b) a \* b operador {#multiplya-b-a-b-operator} - -Calcula el producto de los números. - -## divide (a, b), operador a / b {#dividea-b-a-b-operator} - -Calcula el cociente de los números. El tipo de resultado es siempre un tipo de punto flotante. -No es una división entera. Para la división de enteros, use el ‘intDiv’ función. -Al dividir por cero obtienes ‘inf’, ‘-inf’, o ‘nan’. - -## Información de uso) {#intdiva-b} - -Calcula el cociente de los números. Se divide en enteros, redondeando hacia abajo (por el valor absoluto). -Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. - -## IntDivOrZero (a, b) {#intdivorzeroa-b} - -Difiere de ‘intDiv’ en que devuelve cero al dividir por cero o al dividir un número negativo mínimo por menos uno. - -## modulo(a, b), a % b operador {#moduloa-b-a-b-operator} - -Calcula el resto después de la división. -Si los argumentos son números de coma flotante, se convierten previamente en enteros eliminando la parte decimal. -El resto se toma en el mismo sentido que en C ++. La división truncada se usa para números negativos. -Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. - -## moduloOrZero (a, b) {#moduloorzeroa-b} - -Difiere de ‘modulo’ en que devuelve cero cuando el divisor es cero. - -## negate(a), -un operador {#negatea-a-operator} - -Calcula un número con el signo inverso. El resultado siempre está firmado. - -## abs (a) {#arithm_func-abs} - -Calcula el valor absoluto del número (a). Es decir, si un \<0, devuelve -a . Para los tipos sin firmar no hace nada. Para los tipos de enteros con signo, devuelve un número sin signo. - -## GCD (a, b) {#gcda-b} - -Devuelve el mayor divisor común de los números. -Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. - -## Lcm(a, b) {#lcma-b} - -Devuelve el mínimo múltiplo común de los números. -Se produce una excepción al dividir por cero o al dividir un número negativo mínimo por menos uno. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/es/sql_reference/functions/array_functions.md b/docs/es/sql_reference/functions/array_functions.md deleted file mode 100644 index 42e22b64bbc..00000000000 --- a/docs/es/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,1057 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 46 -toc_title: Trabajar con matrices ---- - -# Funciones para trabajar con matrices {#functions-for-working-with-arrays} - -## vaciar {#function-empty} - -Devuelve 1 para una matriz vacía, o 0 para una matriz no vacía. -El tipo de resultado es UInt8. -La función también funciona para cadenas. - -## notEmpty {#function-notempty} - -Devuelve 0 para una matriz vacía, o 1 para una matriz no vacía. -El tipo de resultado es UInt8. -La función también funciona para cadenas. - -## longitud {#array_functions-length} - -Devuelve el número de elementos de la matriz. -El tipo de resultado es UInt64. -La función también funciona para cadenas. - -## Para obtener más información, consulta nuestra Política de privacidad y nuestras Condiciones de uso {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## Para obtener más información, consulta nuestra Política de privacidad y nuestras Condiciones de uso {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## Para obtener más información, consulta nuestra Política de privacidad y nuestras Condiciones de uso {#emptyarrayfloat32-emptyarrayfloat64} - -## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} - -## emptyArrayString {#emptyarraystring} - -Acepta cero argumentos y devuelve una matriz vacía del tipo apropiado. - -## emptyArrayToSingle {#emptyarraytosingle} - -Acepta una matriz vacía y devuelve una matriz de un elemento que es igual al valor predeterminado. - -## rango(final), rango(inicio, fin \[, paso\]) {#rangeend-rangestart-end-step} - -Devuelve una matriz de números de principio a fin-1 por paso. -Si el argumento `start` no se especifica, el valor predeterminado es 0. -Si el argumento `step` no se especifica, el valor predeterminado es 1. -Se comporta casi como pitónico `range`. Pero la diferencia es que todos los tipos de argumentos deben ser `UInt` numero. -Por si acaso, se produce una excepción si se crean matrices con una longitud total de más de 100,000,000 de elementos en un bloque de datos. - -## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} - -Crea una matriz a partir de los argumentos de la función. -Los argumentos deben ser constantes y tener tipos que tengan el tipo común más pequeño. Se debe pasar al menos un argumento, porque de lo contrario no está claro qué tipo de matriz crear. Es decir, no puede usar esta función para crear una matriz vacía (para hacerlo, use el ‘emptyArray\*’ función descrita anteriormente). -Devuelve un ‘Array(T)’ tipo resultado, donde ‘T’ es el tipo común más pequeño de los argumentos pasados. - -## arrayConcat {#arrayconcat} - -Combina matrices pasadas como argumentos. - -``` sql -arrayConcat(arrays) -``` - -**Parámetros** - -- `arrays` – Arbitrary number of arguments of [Matriz](../../sql_reference/data_types/array.md) tipo. - **Ejemplo** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,3,4,5,6] │ -└───────────────┘ -``` - -## Por ejemplo, el operador arr\[n\] {#arrayelementarr-n-operator-arrn} - -Obtener el elemento con el índice `n` de la matriz `arr`. `n` debe ser de cualquier tipo entero. -Los índices de una matriz comienzan desde uno. -Los índices negativos son compatibles. En este caso, selecciona el elemento correspondiente numerado desde el final. Por ejemplo, `arr[-1]` es el último elemento de la matriz. - -Si el índice cae fuera de los límites de una matriz, devuelve algún valor predeterminado (0 para números, una cadena vacía para cadenas, etc.), a excepción del caso con una matriz no constante y un índice constante 0 (en este caso habrá un error `Array indices are 1-based`). - -## Tiene(arr, elem) {#hasarr-elem} - -Comprueba si el ‘arr’ la matriz tiene el ‘elem’ elemento. -Devuelve 0 si el elemento no está en la matriz, o 1 si es. - -`NULL` se procesa como un valor. - -``` sql -SELECT has([1, 2, NULL], NULL) -``` - -``` text -┌─has([1, 2, NULL], NULL)─┐ -│ 1 │ -└─────────────────────────┘ -``` - -## TieneTodo {#hasall} - -Comprueba si una matriz es un subconjunto de otra. - -``` sql -hasAll(set, subset) -``` - -**Parámetros** - -- `set` – Array of any type with a set of elements. -- `subset` – Array of any type with elements that should be tested to be a subset of `set`. - -**Valores de retorno** - -- `1`, si `set` contiene todos los elementos de `subset`. -- `0`, de lo contrario. - -**Propiedades peculiares** - -- Una matriz vacía es un subconjunto de cualquier matriz. -- `Null` procesado como un valor. -- El orden de los valores en ambas matrices no importa. - -**Ejemplos** - -`SELECT hasAll([], [])` devoluciones 1. - -`SELECT hasAll([1, Null], [Null])` devoluciones 1. - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` devoluciones 1. - -`SELECT hasAll(['a', 'b'], ['a'])` devoluciones 1. - -`SELECT hasAll([1], ['a'])` devuelve 0. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` devuelve 0. - -## TieneCualquier {#hasany} - -Comprueba si dos matrices tienen intersección por algunos elementos. - -``` sql -hasAny(array1, array2) -``` - -**Parámetros** - -- `array1` – Array of any type with a set of elements. -- `array2` – Array of any type with a set of elements. - -**Valores de retorno** - -- `1`, si `array1` y `array2` tienen un elemento similar al menos. -- `0`, de lo contrario. - -**Propiedades peculiares** - -- `Null` procesado como un valor. -- El orden de los valores en ambas matrices no importa. - -**Ejemplos** - -`SELECT hasAny([1], [])` devoluciones `0`. - -`SELECT hasAny([Null], [Null, 1])` devoluciones `1`. - -`SELECT hasAny([-128, 1., 512], [1])` devoluciones `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` devoluciones `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` devoluciones `1`. - -## ¿Cómo puedo hacerlo?) {#indexofarr-x} - -Devuelve el índice de la primera ‘x’ elemento (comenzando desde 1) si está en la matriz, o 0 si no lo está. - -Ejemplo: - -``` sql -SELECT indexOf([1, 3, NULL, NULL], NULL) -``` - -``` text -┌─indexOf([1, 3, NULL, NULL], NULL)─┐ -│ 3 │ -└───────────────────────────────────┘ -``` - -Elementos establecidos en `NULL` se manejan como valores normales. - -## Cuenta igual (arr, x) {#countequalarr-x} - -Devuelve el número de elementos de la matriz igual a x. Equivalente a arrayCount (elem -\> elem = x, arr). - -`NULL` los elementos se manejan como valores separados. - -Ejemplo: - -``` sql -SELECT countEqual([1, 2, NULL, NULL], NULL) -``` - -``` text -┌─countEqual([1, 2, NULL, NULL], NULL)─┐ -│ 2 │ -└──────────────────────────────────────┘ -``` - -## Información detallada) {#array_functions-arrayenumerate} - -Returns the array \[1, 2, 3, …, length (arr) \] - -Esta función se utiliza normalmente con ARRAY JOIN. Permite contar algo solo una vez para cada matriz después de aplicar ARRAY JOIN . Ejemplo: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -En este ejemplo, Reaches es el número de conversiones (las cadenas recibidas después de aplicar ARRAY JOIN) y Hits es el número de páginas vistas (cadenas antes de ARRAY JOIN). En este caso particular, puede obtener el mismo resultado de una manera más fácil: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -Esta función también se puede utilizar en funciones de orden superior. Por ejemplo, puede usarlo para obtener índices de matriz para elementos que coinciden con una condición. - -## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} - -Devuelve una matriz del mismo tamaño que la matriz de origen, indicando para cada elemento cuál es su posición entre los elementos con el mismo valor. -Por ejemplo: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. - -Esta función es útil cuando se utiliza ARRAY JOIN y la agregación de elementos de matriz. -Ejemplo: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - -``` text -┌──GoalID─┬─Reaches─┬─Visits─┐ -│ 53225 │ 3214 │ 1097 │ -│ 2825062 │ 3188 │ 1097 │ -│ 56600 │ 2803 │ 488 │ -│ 1989037 │ 2401 │ 365 │ -│ 2830064 │ 2396 │ 910 │ -│ 1113562 │ 2372 │ 373 │ -│ 3270895 │ 2262 │ 812 │ -│ 1084657 │ 2262 │ 345 │ -│ 56599 │ 2260 │ 799 │ -│ 3271094 │ 2256 │ 812 │ -└─────────┴─────────┴────────┘ -``` - -En este ejemplo, cada ID de objetivo tiene un cálculo del número de conversiones (cada elemento de la estructura de datos anidados Objetivos es un objetivo alcanzado, al que nos referimos como conversión) y el número de sesiones. Sin ARRAY JOIN, habríamos contado el número de sesiones como sum(Sign) . Pero en este caso particular, las filas se multiplicaron por la estructura de Objetivos anidados, por lo que para contar cada sesión una vez después de esto, aplicamos una condición al valor de la función arrayEnumerateUniq(Goals.ID) . - -La función arrayEnumerateUniq puede tomar varias matrices del mismo tamaño que los argumentos. En este caso, la singularidad se considera para tuplas de elementos en las mismas posiciones en todas las matrices. - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,1,1,2,1] │ -└───────────────┘ -``` - -Esto es necesario cuando se utiliza ARRAY JOIN con una estructura de datos anidados y una agregación adicional a través de múltiples elementos de esta estructura. - -## arrayPopBack {#arraypopback} - -Quita el último elemento de la matriz. - -``` sql -arrayPopBack(array) -``` - -**Parámetros** - -- `array` – Array. - -**Ejemplo** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## arrayPopFront {#arraypopfront} - -Quita el primer elemento de la matriz. - -``` sql -arrayPopFront(array) -``` - -**Parámetros** - -- `array` – Array. - -**Ejemplo** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [2,3] │ -└───────┘ -``` - -## arrayPushBack {#arraypushback} - -Agrega un elemento al final de la matriz. - -``` sql -arrayPushBack(array, single_value) -``` - -**Parámetros** - -- `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` tipo para el tipo de datos de la matriz. Para obtener más información sobre los tipos de datos en ClickHouse, consulte “[Tipos de datos](../../sql_reference/data_types/index.md#data_types)”. Puede ser `NULL`. La función agrega un `NULL` elemento de matriz a una matriz, y el tipo de elementos de matriz se convierte en `Nullable`. - -**Ejemplo** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayPushFront {#arraypushfront} - -Agrega un elemento al principio de la matriz. - -``` sql -arrayPushFront(array, single_value) -``` - -**Parámetros** - -- `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` tipo para el tipo de datos de la matriz. Para obtener más información sobre los tipos de datos en ClickHouse, consulte “[Tipos de datos](../../sql_reference/data_types/index.md#data_types)”. Puede ser `NULL`. La función agrega un `NULL` elemento de matriz a una matriz, y el tipo de elementos de matriz se convierte en `Nullable`. - -**Ejemplo** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayResize {#arrayresize} - -Cambia la longitud de la matriz. - -``` sql -arrayResize(array, size[, extender]) -``` - -**Parámetros:** - -- `array` — Array. -- `size` — Required length of the array. - - Si `size` es menor que el tamaño original de la matriz, la matriz se trunca desde la derecha. -- Si `size` es mayor que el tamaño inicial de la matriz, la matriz se extiende a la derecha con `extender` valores predeterminados para el tipo de datos de los elementos de la matriz. -- `extender` — Value for extending an array. Can be `NULL`. - -**Valor devuelto:** - -Una matriz de longitud `size`. - -**Ejemplos de llamadas** - -``` sql -SELECT arrayResize([1], 3) -``` - -``` text -┌─arrayResize([1], 3)─┐ -│ [1,0,0] │ -└─────────────────────┘ -``` - -``` sql -SELECT arrayResize([1], 3, NULL) -``` - -``` text -┌─arrayResize([1], 3, NULL)─┐ -│ [1,NULL,NULL] │ -└───────────────────────────┘ -``` - -## arraySlice {#arrayslice} - -Devuelve una porción de la matriz. - -``` sql -arraySlice(array, offset[, length]) -``` - -**Parámetros** - -- `array` – Array of data. -- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. -- `length` - La longitud de la porción requerida. Si especifica un valor negativo, la función devuelve un segmento abierto `[offset, array_length - length)`. Si omite el valor, la función devuelve el sector `[offset, the_end_of_array]`. - -**Ejemplo** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - -``` text -┌─res────────┐ -│ [2,NULL,4] │ -└────────────┘ -``` - -Elementos de matriz establecidos en `NULL` se manejan como valores normales. - -## arraySort(\[func,\] arr, …) {#array_functions-sort} - -Ordena los elementos del `arr` matriz en orden ascendente. Si el `func` se especifica la función, el orden de clasificación está determinado por el resultado `func` función aplicada a los elementos de la matriz. Si `func` acepta múltiples argumentos, el `arraySort` función se pasa varias matrices que los argumentos de `func` corresponderá a. Los ejemplos detallados se muestran al final de `arraySort` descripci. - -Ejemplo de clasificación de valores enteros: - -``` sql -SELECT arraySort([1, 3, 3, 0]); -``` - -``` text -┌─arraySort([1, 3, 3, 0])─┐ -│ [0,1,3,3] │ -└─────────────────────────┘ -``` - -Ejemplo de ordenación de valores de cadena: - -``` sql -SELECT arraySort(['hello', 'world', '!']); -``` - -``` text -┌─arraySort(['hello', 'world', '!'])─┐ -│ ['!','hello','world'] │ -└────────────────────────────────────┘ -``` - -Considere el siguiente orden de clasificación `NULL`, `NaN` y `Inf` valor: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - -``` text -┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ -│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────────────────────────┘ -``` - -- `-Inf` los valores son los primeros en la matriz. -- `NULL` los valores son los últimos en la matriz. -- `NaN` los valores están justo antes `NULL`. -- `Inf` los valores están justo antes `NaN`. - -Tenga en cuenta que `arraySort` es una [función de orden superior](higher_order_functions.md). Puede pasarle una función lambda como primer argumento. En este caso, el orden de clasificación está determinado por el resultado de la función lambda aplicada a los elementos de la matriz. - -Consideremos el siguiente ejemplo: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,2,1] │ -└─────────┘ -``` - -For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` función ordena las teclas en orden ascendente, el resultado es \[3, 2, 1\]. Por lo tanto, el `(x) –> -x` la función lambda establece la [orden descendente](#array_functions-reverse-sort) en una clasificación. - -La función lambda puede aceptar múltiples argumentos. En este caso, debe pasar el `arraySort` función varias matrices de idéntica longitud a las que corresponderán los argumentos de la función lambda. La matriz resultante constará de elementos de la primera matriz de entrada; los elementos de la siguiente matriz de entrada especifican las claves de clasificación. Por ejemplo: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Aquí, los elementos que se pasan en la segunda matriz (\[2, 1\]) definen una clave de ordenación para el elemento correspondiente de la matriz de origen (\[‘hello’, ‘world’Es decir,, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn't use `x`, los valores reales de la matriz de origen no afectan el orden en el resultado. Tan, ‘hello’ será el segundo elemento en el resultado, y ‘world’ será la primera. - -Otros ejemplos se muestran a continuación. - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! note "Nota" - Para mejorar la eficiencia de clasificación, el [Transformación de Schwartzian](https://en.wikipedia.org/wiki/Schwartzian_transform) se utiliza. - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} - -Ordena los elementos del `arr` matriz en orden descendente. Si el `func` se especifica la función, `arr` se ordena de acuerdo con el resultado de la `func` función aplicada a los elementos de la matriz, y luego la matriz ordenada se invierte. Si `func` acepta múltiples argumentos, el `arrayReverseSort` función se pasa varias matrices que los argumentos de `func` corresponderá a. Los ejemplos detallados se muestran al final de `arrayReverseSort` descripci. - -Ejemplo de clasificación de valores enteros: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - -``` text -┌─arrayReverseSort([1, 3, 3, 0])─┐ -│ [3,3,1,0] │ -└────────────────────────────────┘ -``` - -Ejemplo de ordenación de valores de cadena: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - -``` text -┌─arrayReverseSort(['hello', 'world', '!'])─┐ -│ ['world','hello','!'] │ -└───────────────────────────────────────────┘ -``` - -Considere el siguiente orden de clasificación `NULL`, `NaN` y `Inf` valor: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` text -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- `Inf` los valores son los primeros en la matriz. -- `NULL` los valores son los últimos en la matriz. -- `NaN` los valores están justo antes `NULL`. -- `-Inf` los valores están justo antes `NaN`. - -Tenga en cuenta que el `arrayReverseSort` es una [función de orden superior](higher_order_functions.md). Puede pasarle una función lambda como primer argumento. Ejemplo se muestra a continuación. - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [1,2,3] │ -└─────────┘ -``` - -La matriz se ordena de la siguiente manera: - -1. Al principio, la matriz de origen (\[1, 2, 3\]) se ordena de acuerdo con el resultado de la función lambda aplicada a los elementos de la matriz. El resultado es una matriz \[3, 2, 1\]. -2. Matriz que se obtiene en el paso anterior, se invierte. Entonces, el resultado final es \[1, 2, 3\]. - -La función lambda puede aceptar múltiples argumentos. En este caso, debe pasar el `arrayReverseSort` función varias matrices de idéntica longitud a las que corresponderán los argumentos de la función lambda. La matriz resultante constará de elementos de la primera matriz de entrada; los elementos de la siguiente matriz de entrada especifican las claves de clasificación. Por ejemplo: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -En este ejemplo, la matriz se ordena de la siguiente manera: - -1. Al principio, la matriz de origen (\[‘hello’, ‘world’\]) se ordena de acuerdo con el resultado de la función lambda aplicada a los elementos de las matrices. Los elementos que se pasan en la segunda matriz (\[2, 1\]), definen las claves de ordenación para los elementos correspondientes de la matriz de origen. El resultado es una matriz \[‘world’, ‘hello’\]. -2. Matriz que se ordenó en el paso anterior, se invierte. Entonces, el resultado final es \[‘hello’, ‘world’\]. - -Otros ejemplos se muestran a continuación. - -``` sql -SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; -``` - -``` text -┌─res─────┐ -│ [5,3,4] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` text -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#arrayuniqarr} - -Si se pasa un argumento, cuenta el número de elementos diferentes en la matriz. -Si se pasan varios argumentos, cuenta el número de tuplas diferentes de elementos en las posiciones correspondientes en múltiples matrices. - -Si desea obtener una lista de elementos únicos en una matriz, puede usar arrayReduce(‘groupUniqArray’ arr). - -## Información adicional) {#array-functions-join} - -Una función especial. Vea la sección [“ArrayJoin function”](array_join.md#functions_arrayjoin). - -## arrayDifference {#arraydifference} - -Calcula la diferencia entre los elementos de matriz adyacentes. Devuelve una matriz donde el primer elemento será 0, el segundo es la diferencia entre `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). - -**Sintaxis** - -``` sql -arrayDifference(array) -``` - -**Parámetros** - -- `array` – [Matriz](https://clickhouse.yandex/docs/en/data_types/array/). - -**Valores devueltos** - -Devuelve una matriz de diferencias entre los elementos adyacentes. - -Tipo: [UInt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [En\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [Flotante\*](https://clickhouse.yandex/docs/en/data_types/float/). - -**Ejemplo** - -Consulta: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - -Resultado: - -``` text -┌─arrayDifference([1, 2, 3, 4])─┐ -│ [0,1,1,1] │ -└───────────────────────────────┘ -``` - -Ejemplo del desbordamiento debido al tipo de resultado Int64: - -Consulta: - -``` sql -SELECT arrayDifference([0, 10000000000000000000]) -``` - -Resultado: - -``` text -┌─arrayDifference([0, 10000000000000000000])─┐ -│ [0,-8446744073709551616] │ -└────────────────────────────────────────────┘ -``` - -## arrayDistinct {#arraydistinct} - -Toma una matriz, devuelve una matriz que contiene solo los elementos distintos. - -**Sintaxis** - -``` sql -arrayDistinct(array) -``` - -**Parámetros** - -- `array` – [Matriz](https://clickhouse.yandex/docs/en/data_types/array/). - -**Valores devueltos** - -Devuelve una matriz que contiene los elementos distintos. - -**Ejemplo** - -Consulta: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - -Resultado: - -``` text -┌─arrayDistinct([1, 2, 2, 3, 1])─┐ -│ [1,2,3] │ -└────────────────────────────────┘ -``` - -## Aquí hay algunas opciones) {#array_functions-arrayenumeratedense} - -Devuelve una matriz del mismo tamaño que la matriz de origen, lo que indica dónde aparece cada elemento por primera vez en la matriz de origen. - -Ejemplo: - -``` sql -SELECT arrayEnumerateDense([10, 20, 10, 30]) -``` - -``` text -┌─arrayEnumerateDense([10, 20, 10, 30])─┐ -│ [1,2,1,3] │ -└───────────────────────────────────────┘ -``` - -## Información detallada) {#array-functions-arrayintersect} - -Toma varias matrices, devuelve una matriz con elementos que están presentes en todas las matrices de origen. El orden de los elementos en la matriz resultante es el mismo que en la primera matriz. - -Ejemplo: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - -``` text -┌─no_intersect─┬─intersect─┐ -│ [] │ [1] │ -└──────────────┴───────────┘ -``` - -## arrayReduce {#arrayreduce} - -Aplica una función de agregado a los elementos de la matriz y devuelve su resultado. El nombre de la función de agregación se pasa como una cadena entre comillas simples `'max'`, `'sum'`. Cuando se utilizan funciones de agregado paramétrico, el parámetro se indica después del nombre de la función entre paréntesis `'uniqUpTo(6)'`. - -**Sintaxis** - -``` sql -arrayReduce(agg_func, arr1, arr2, ..., arrN) -``` - -**Parámetros** - -- `agg_func` — The name of an aggregate function which should be a constant [cadena](../../sql_reference/data_types/string.md). -- `arr` — Any number of [matriz](../../sql_reference/data_types/array.md) escriba columnas como los parámetros de la función de agregación. - -**Valor devuelto** - -**Ejemplo** - -``` sql -SELECT arrayReduce('max', [1, 2, 3]) -``` - -``` text -┌─arrayReduce('max', [1, 2, 3])─┐ -│ 3 │ -└───────────────────────────────┘ -``` - -Si una función agregada toma varios argumentos, esta función debe aplicarse a varias matrices del mismo tamaño. - -``` sql -SELECT arrayReduce('maxIf', [3, 5], [1, 0]) -``` - -``` text -┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ -│ 3 │ -└──────────────────────────────────────┘ -``` - -Ejemplo con una función de agregado paramétrico: - -``` sql -SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -``` - -``` text -┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ -│ 4 │ -└─────────────────────────────────────────────────────────────┘ -``` - -## arrayReduceInRanges {#arrayreduceinranges} - -Aplica una función de agregado a los elementos de matriz en rangos dados y devuelve una matriz que contiene el resultado correspondiente a cada rango. La función devolverá el mismo resultado que múltiples `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. - -**Sintaxis** - -``` sql -arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) -``` - -**Parámetros** - -- `agg_func` — The name of an aggregate function which should be a constant [cadena](../../sql_reference/data_types/string.md). -- `ranges` — The ranges to aggretate which should be an [matriz](../../sql_reference/data_types/array.md) de [tuplas](../../sql_reference/data_types/tuple.md) que contiene el índice y la longitud de cada rango. -- `arr` — Any number of [matriz](../../sql_reference/data_types/array.md) escriba columnas como los parámetros de la función de agregación. - -**Valor devuelto** - -**Ejemplo** - -``` sql -SELECT arrayReduceInRanges( - 'sum', - [(1, 5), (2, 3), (3, 4), (4, 4)], - [1000000, 200000, 30000, 4000, 500, 60, 7] -) AS res -``` - -``` text -┌─res─────────────────────────┐ -│ [1234500,234000,34560,4567] │ -└─────────────────────────────┘ -``` - -## arrayReverse (arr) {#arrayreverse} - -Devuelve una matriz del mismo tamaño que la matriz original que contiene los elementos en orden inverso. - -Ejemplo: - -``` sql -SELECT arrayReverse([1, 2, 3]) -``` - -``` text -┌─arrayReverse([1, 2, 3])─┐ -│ [3,2,1] │ -└─────────────────────────┘ -``` - -## inversa(arr) {#array-functions-reverse} - -Sinónimo de [“arrayReverse”](#array_functions-arrayreverse) - -## arrayFlatten {#arrayflatten} - -Convierte una matriz de matrices en una matriz plana. - -Función: - -- Se aplica a cualquier profundidad de matrices anidadas. -- No cambia las matrices que ya son planas. - -La matriz aplanada contiene todos los elementos de todas las matrices de origen. - -**Sintaxis** - -``` sql -flatten(array_of_arrays) -``` - -Apodo: `flatten`. - -**Parámetros** - -- `array_of_arrays` — [Matriz](../../sql_reference/data_types/array.md) de matrices. Por ejemplo, `[[1,2,3], [4,5]]`. - -**Ejemplos** - -``` sql -SELECT flatten([[[1]], [[2], [3]]]) -``` - -``` text -┌─flatten(array(array([1]), array([2], [3])))─┐ -│ [1,2,3] │ -└─────────────────────────────────────────────┘ -``` - -## arrayCompact {#arraycompact} - -Elimina elementos duplicados consecutivos de una matriz. El orden de los valores de resultado está determinado por el orden de la matriz de origen. - -**Sintaxis** - -``` sql -arrayCompact(arr) -``` - -**Parámetros** - -`arr` — The [matriz](../../sql_reference/data_types/array.md) inspeccionar. - -**Valor devuelto** - -La matriz sin duplicado. - -Tipo: `Array`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) -``` - -Resultado: - -``` text -┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ -│ [1,nan,nan,2,3] │ -└────────────────────────────────────────────┘ -``` - -## arrayZip {#arrayzip} - -Combine multiple Array type columns into one Array\[Tuple(…)\] column - -**Sintaxis** - -``` sql -arrayZip(arr1, arr2, ..., arrN) -``` - -**Parámetros** - -`arr` — Any number of [matriz](../../sql_reference/data_types/array.md) escriba columnas para combinar. - -**Valor devuelto** - -The result of Array\[Tuple(…)\] type after the combination of these arrays - -**Ejemplo** - -Consulta: - -``` sql -SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); -``` - -Resultado: - -``` text -┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ -│ [('a','d'),('b','e'),('c','f')] │ -└────────────────────────────────────────────┘ -``` - -## arrayAUC {#arrayauc} - -Calcule AUC (Área bajo la curva, que es un concepto en el aprendizaje automático, vea más detalles: https://en.wikipedia.org/wiki/Receiver\_operating\_characteristic\#Area\_under\_the\_curve ). - -**Sintaxis** - -``` sql -arrayAUC(arr_scores, arr_labels) -``` - -**Parámetros** -- `arr_scores` — scores prediction model gives. -- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. - -**Valor devuelto** -Devuelve el valor AUC con el tipo Float64. - -**Ejemplo** -Consulta: - -``` sql -select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) -``` - -Resultado: - -``` text -┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ -│ 0.75 │ -└────────────────────────────────────────---──┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/es/sql_reference/functions/bit_functions.md b/docs/es/sql_reference/functions/bit_functions.md deleted file mode 100644 index 6c042834fde..00000000000 --- a/docs/es/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 48 -toc_title: Trozo ---- - -# Bit funciones {#bit-functions} - -Las funciones de bits funcionan para cualquier par de tipos de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 o Float64. - -El tipo de resultado es un entero con bits iguales a los bits máximos de sus argumentos. Si al menos uno de los argumentos está firmado, el resultado es un número firmado. Si un argumento es un número de coma flotante, se convierte en Int64. - -## pocoY(a, b) {#bitanda-b} - -## bitOr (a, b) {#bitora-b} - -## ¿Por qué?) {#bitxora-b} - -## ¿Por qué?) {#bitnota} - -## ¿Cómo puedo hacerlo?) {#bitshiftlefta-b} - -## ¿Cómo puedo hacerlo?) {#bitshiftrighta-b} - -## ¿Cómo puedo hacerlo?) {#bitrotatelefta-b} - -## ¿Cómo puedo hacerlo?) {#bitrotaterighta-b} - -## bitTest {#bittest} - -Toma cualquier entero y lo convierte en [forma binaria](https://en.wikipedia.org/wiki/Binary_number) devuelve el valor de un bit en la posición especificada. La cuenta atrás comienza desde 0 de derecha a izquierda. - -**Sintaxis** - -``` sql -SELECT bitTest(number, index) -``` - -**Parámetros** - -- `number` – integer number. -- `index` – position of bit. - -**Valores devueltos** - -Devuelve un valor de bit en la posición especificada. - -Tipo: `UInt8`. - -**Ejemplo** - -Por ejemplo, el número 43 en el sistema numérico base-2 (binario) es 101011. - -Consulta: - -``` sql -SELECT bitTest(43, 1) -``` - -Resultado: - -``` text -┌─bitTest(43, 1)─┐ -│ 1 │ -└────────────────┘ -``` - -Otro ejemplo: - -Consulta: - -``` sql -SELECT bitTest(43, 2) -``` - -Resultado: - -``` text -┌─bitTest(43, 2)─┐ -│ 0 │ -└────────────────┘ -``` - -## bitTestAll {#bittestall} - -Devuelve el resultado de [conjunción lógica](https://en.wikipedia.org/wiki/Logical_conjunction) (Operador AND) de todos los bits en posiciones dadas. La cuenta atrás comienza desde 0 de derecha a izquierda. - -La conjucción para operaciones bit a bit: - -0 AND 0 = 0 - -0 AND 1 = 0 - -1 AND 0 = 0 - -1 AND 1 = 1 - -**Sintaxis** - -``` sql -SELECT bitTestAll(number, index1, index2, index3, index4, ...) -``` - -**Parámetros** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) es verdadero si y solo si todas sus posiciones son verdaderas (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). - -**Valores devueltos** - -Devuelve el resultado de la conjunción lógica. - -Tipo: `UInt8`. - -**Ejemplo** - -Por ejemplo, el número 43 en el sistema numérico base-2 (binario) es 101011. - -Consulta: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5) -``` - -Resultado: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5)─┐ -│ 1 │ -└────────────────────────────┘ -``` - -Otro ejemplo: - -Consulta: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5, 2) -``` - -Resultado: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ -│ 0 │ -└───────────────────────────────┘ -``` - -## bitTestAny {#bittestany} - -Devuelve el resultado de [disyunción lógica](https://en.wikipedia.org/wiki/Logical_disjunction) (O operador) de todos los bits en posiciones dadas. La cuenta atrás comienza desde 0 de derecha a izquierda. - -La disyunción para las operaciones bit a bit: - -0 OR 0 = 0 - -0 OR 1 = 1 - -1 OR 0 = 1 - -1 OR 1 = 1 - -**Sintaxis** - -``` sql -SELECT bitTestAny(number, index1, index2, index3, index4, ...) -``` - -**Parámetros** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. - -**Valores devueltos** - -Devuelve el resultado de disjuction lógico. - -Tipo: `UInt8`. - -**Ejemplo** - -Por ejemplo, el número 43 en el sistema numérico base-2 (binario) es 101011. - -Consulta: - -``` sql -SELECT bitTestAny(43, 0, 2) -``` - -Resultado: - -``` text -┌─bitTestAny(43, 0, 2)─┐ -│ 1 │ -└──────────────────────┘ -``` - -Otro ejemplo: - -Consulta: - -``` sql -SELECT bitTestAny(43, 4, 2) -``` - -Resultado: - -``` text -┌─bitTestAny(43, 4, 2)─┐ -│ 0 │ -└──────────────────────┘ -``` - -## bitCount {#bitcount} - -Calcula el número de bits establecido en uno en la representación binaria de un número. - -**Sintaxis** - -``` sql -bitCount(x) -``` - -**Parámetros** - -- `x` — [Entero](../../sql_reference/data_types/int_uint.md) o [punto flotante](../../sql_reference/data_types/float.md) numero. La función utiliza la representación de valor en la memoria. Permite admitir números de punto flotante. - -**Valor devuelto** - -- Número de bits establecido en uno en el número de entrada. - -La función no convierte el valor de entrada a un tipo más grande ([extensión de signo](https://en.wikipedia.org/wiki/Sign_extension)). Entonces, por ejemplo, `bitCount(toUInt8(-1)) = 8`. - -Tipo: `UInt8`. - -**Ejemplo** - -Tomemos por ejemplo el número 333. Su representación binaria: 0000000101001101. - -Consulta: - -``` sql -SELECT bitCount(333) -``` - -Resultado: - -``` text -┌─bitCount(333)─┐ -│ 5 │ -└───────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/es/sql_reference/functions/bitmap_functions.md b/docs/es/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index ec105de8382..00000000000 --- a/docs/es/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,496 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 49 -toc_title: Bits ---- - -# Funciones de mapa de bits {#bitmap-functions} - -Las funciones de mapa de bits funcionan para dos mapas de bits Cálculo del valor del objeto, es devolver un nuevo mapa de bits o cardinalidad mientras se usa el cálculo de la fórmula, como y, o, xor, y no, etc. - -Hay 2 tipos de métodos de construcción para Bitmap Object. Uno debe ser construido por la función de agregación groupBitmap con -State , el otro debe ser construido por Array Object . También es para convertir objeto de mapa de bits a objeto de matriz. - -RoaringBitmap se envuelve en una estructura de datos, mientras que el almacenamiento real de los objetos de mapa de bits. Cuando la cardinalidad es menor o igual que 32, utiliza Set objet. Cuando la cardinalidad es mayor que 32, utiliza el objeto RoaringBitmap. Es por eso que el almacenamiento del conjunto de baja cardinalidad es más rápido. - -Para obtener más información sobre RoaringBitmap, consulte: [CRoaring](https://github.com/RoaringBitmap/CRoaring). - -## bitmapBuild {#bitmap_functions-bitmapbuild} - -Construya un mapa de bits a partir de una matriz de enteros sin signo. - -``` sql -bitmapBuild(array) -``` - -**Parámetros** - -- `array` – unsigned integer array. - -**Ejemplo** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) -``` - -``` text -┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ -│  │ AggregateFunction(groupBitmap, UInt8) │ -└─────┴──────────────────────────────────────────────┘ -``` - -## bitmapToArray {#bitmaptoarray} - -Convertir mapa de bits a matriz entera. - -``` sql -bitmapToArray(bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapSubsetInRange {#bitmap-functions-bitmapsubsetinrange} - -Devuelve el subconjunto en el rango especificado (no incluye range\_end). - -``` sql -bitmapSubsetInRange(bitmap, range_start, range_end) -``` - -**Parámetros** - -- `bitmap` – [Objeto de mapa de bits](#bitmap_functions-bitmapbuild). -- `range_start` – range start point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `range_end` – range end point(excluded). Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -``` text -┌─res───────────────┐ -│ [30,31,32,33,100] │ -└───────────────────┘ -``` - -## bitmapSubsetLimit {#bitmapsubsetlimit} - -Crea un subconjunto de mapa de bits con n elementos tomados entre `range_start` y `cardinality_limit`. - -**Sintaxis** - -``` sql -bitmapSubsetLimit(bitmap, range_start, cardinality_limit) -``` - -**Parámetros** - -- `bitmap` – [Objeto de mapa de bits](#bitmap_functions-bitmapbuild). -- `range_start` – The subset starting point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Valor devuelto** - -Subconjunto. - -Tipo: `Bitmap object`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -Resultado: - -``` text -┌─res───────────────────────┐ -│ [30,31,32,33,100,200,500] │ -└───────────────────────────┘ -``` - -## bitmapContains {#bitmap_functions-bitmapcontains} - -Comprueba si el mapa de bits contiene un elemento. - -``` sql -bitmapContains(haystack, needle) -``` - -**Parámetros** - -- `haystack` – [Objeto de mapa de bits](#bitmap_functions-bitmapbuild), donde la función busca. -- `needle` – Value that the function searches. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- 0 — If `haystack` no contiene `needle`. -- 1 — If `haystack` contener `needle`. - -Tipo: `UInt8`. - -**Ejemplo** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAny {#bitmaphasany} - -Comprueba si dos mapas de bits tienen intersección por algunos elementos. - -``` sql -bitmapHasAny(bitmap1, bitmap2) -``` - -Si está seguro de que `bitmap2` contiene estrictamente un elemento, considere usar el [bitmapContains](#bitmap_functions-bitmapcontains) función. Funciona de manera más eficiente. - -**Parámetros** - -- `bitmap*` – bitmap object. - -**Valores de retorno** - -- `1`, si `bitmap1` y `bitmap2` tienen un elemento similar al menos. -- `0`, de lo contrario. - -**Ejemplo** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAll {#bitmaphasall} - -Análogo a `hasAll(array, array)` devuelve 1 si el primer mapa de bits contiene todos los elementos del segundo, 0 de lo contrario. -Si el segundo argumento es un mapa de bits vacío, devuelve 1. - -``` sql -bitmapHasAll(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 0 │ -└─────┘ -``` - -## bitmapCardinalidad {#bitmapcardinality} - -Vuelva a ejecutar la cardinalidad del mapa de bits de tipo UInt64. - -``` sql -bitmapCardinality(bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapMin {#bitmapmin} - -Vuelva a ejecutar el valor más pequeño de tipo UInt64 en el conjunto, UINT32\_MAX si el conjunto está vacío. - - bitmapMin(bitmap) - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapMax {#bitmapmax} - -Vuelva a ejecutar el mayor valor de tipo UInt64 en el conjunto, 0 si el conjunto está vacío. - - bitmapMax(bitmap) - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## bitmapTransform {#bitmaptransform} - -Transformar una matriz de valores en un mapa de bits a otra matriz de valores, el resultado es un nuevo mapa de bits. - - bitmapTransform(bitmap, from_array, to_array) - -**Parámetros** - -- `bitmap` – bitmap object. -- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. -- `to_array` – UInt32 array, its size shall be the same to from\_array. - -**Ejemplo** - -``` sql -SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res -``` - - ┌─res───────────────────┐ - │ [1,3,4,6,7,8,9,10,20] │ - └───────────────────────┘ - -## bitmapAnd {#bitmapand} - -Dos mapa de bits y cálculo, el resultado es un nuevo mapa de bits. - -``` sql -bitmapAnd(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─┐ -│ [3] │ -└─────┘ -``` - -## bitmapO {#bitmapor} - -Dos mapa de bits o cálculo, el resultado es un nuevo mapa de bits. - -``` sql -bitmapOr(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapXor {#bitmapxor} - -Dos bitmap xor cálculo, el resultado es un nuevo mapa de bits. - -``` sql -bitmapXor(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,4,5] │ -└───────────┘ -``` - -## bitmapAndnot {#bitmapandnot} - -Dos mapas de bits y no cálculo, el resultado es un nuevo mapa de bits. - -``` sql -bitmapAndnot(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## Bienvenido a WordPress. {#bitmapandcardinality} - -Dos mapa de bits y cálculo, devuelven cardinalidad de tipo UInt64. - -``` sql -bitmapAndCardinality(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapOrCardinalidad {#bitmaporcardinality} - -Dos mapa de bits o cálculo, retorno cardinalidad de tipo UInt64. - -``` sql -bitmapOrCardinality(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapXorCardinalidad {#bitmapxorcardinality} - -Dos bitmap xor cálculo, retorno cardinalidad de tipo UInt64. - -``` sql -bitmapXorCardinality(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 4 │ -└─────┘ -``` - -## Por favor, introduzca su dirección de correo electrónico {#bitmapandnotcardinality} - -Dos mapas de bits yno cálculo, devuelve cardinalidad de tipo UInt64. - -``` sql -bitmapAndnotCardinality(bitmap,bitmap) -``` - -**Parámetros** - -- `bitmap` – bitmap object. - -**Ejemplo** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 2 │ -└─────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/es/sql_reference/functions/comparison_functions.md b/docs/es/sql_reference/functions/comparison_functions.md deleted file mode 100644 index dace972b6da..00000000000 --- a/docs/es/sql_reference/functions/comparison_functions.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 36 -toc_title: "Comparaci\xF3n" ---- - -# Funciones de comparación {#comparison-functions} - -Las funciones de comparación siempre devuelven 0 o 1 (Uint8). - -Se pueden comparar los siguientes tipos: - -- numero -- cuerdas y cuerdas fijas -- fechas -- fechas con tiempos - -dentro de cada grupo, pero no entre diferentes grupos. - -Por ejemplo, no puede comparar una fecha con una cadena. Debe usar una función para convertir la cadena a una fecha, o viceversa. - -Las cadenas se comparan por bytes. Una cadena más corta es más pequeña que todas las cadenas que comienzan con ella y que contienen al menos un carácter más. - -## iguales, a = b y a == b operador {#function-equals} - -## notEquals, un ! operador = b y un \<\> b {#function-notequals} - -## menos, operador \< {#function-less} - -## Saludos {#function-greater} - -## lessOrEquals, operador \<= {#function-lessorequals} - -## greaterOrEquals, operador \>= {#function-greaterorequals} - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) diff --git a/docs/es/sql_reference/functions/conditional_functions.md b/docs/es/sql_reference/functions/conditional_functions.md deleted file mode 100644 index e05cf4ae82b..00000000000 --- a/docs/es/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,207 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 43 -toc_title: 'Condicional ' ---- - -# Funciones condicionales {#conditional-functions} - -## si {#if} - -Controla la bifurcación condicional. A diferencia de la mayoría de los sistemas, ClickHouse siempre evalúa ambas expresiones `then` y `else`. - -**Sintaxis** - -``` sql -SELECT if(cond, then, else) -``` - -Si la condición `cond` evalúa a un valor distinto de cero, devuelve el resultado de la expresión `then` y el resultado de la expresión `else` si está presente, se omite. Si el `cond` es cero o `NULL` el resultado de la `then` expresión se omite y el resultado de la `else` expresión, si está presente, se devuelve. - -**Parámetros** - -- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. -- `then` - La expresión que se va a devolver si se cumple la condición. -- `else` - La expresión a devolver si no se cumple la condición.- - -**Valores devueltos** - -La función se ejecuta `then` y `else` expresiones y devuelve su resultado, dependiendo de si la condición `cond` terminó siendo cero o no. - -**Ejemplo** - -Consulta: - -``` sql -SELECT if(1, plus(2, 2), plus(2, 6)) -``` - -Resultado: - -``` text -┌─plus(2, 2)─┐ -│ 4 │ -└────────────┘ -``` - -Consulta: - -``` sql -SELECT if(0, plus(2, 2), plus(2, 6)) -``` - -Resultado: - -``` text -┌─plus(2, 6)─┐ -│ 8 │ -└────────────┘ -``` - -- `then` y `else` debe tener el tipo común más bajo. - -**Ejemplo:** - -Toma esto `LEFT_RIGHT` tabla: - -``` sql -SELECT * -FROM LEFT_RIGHT - -┌─left─┬─right─┐ -│ ᴺᵁᴸᴸ │ 4 │ -│ 1 │ 3 │ -│ 2 │ 2 │ -│ 3 │ 1 │ -│ 4 │ ᴺᵁᴸᴸ │ -└──────┴───────┘ -``` - -La siguiente consulta compara `left` y `right` valor: - -``` sql -SELECT - left, - right, - if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller -FROM LEFT_RIGHT -WHERE isNotNull(left) AND isNotNull(right) - -┌─left─┬─right─┬─is_smaller──────────────────────────┐ -│ 1 │ 3 │ left is smaller than right │ -│ 2 │ 2 │ right is greater or equal than left │ -│ 3 │ 1 │ right is greater or equal than left │ -└──────┴───────┴─────────────────────────────────────┘ -``` - -Nota: `NULL` los valores no se utilizan en este ejemplo, compruebe [Valores NULL en condicionales](#null-values-in-conditionals) apartado. - -## Operador ternario {#ternary-operator} - -Funciona igual que `if` función. - -Sintaxis: `cond ? then : else` - -Devoluciones `then` si el `cond` evalúa que es verdadero (mayor que cero), de lo contrario devuelve `else`. - -- `cond` debe ser de tipo de `UInt8`, y `then` y `else` debe tener el tipo común más bajo. - -- `then` y `else` puede ser `NULL` - -**Ver también** - -- [ifNotFinite](other_functions.md#ifnotfinite). - -## MultiIf {#multiif} - -Le permite escribir el [CASE](../operators.md#operator_case) operador más compacto en la consulta. - -Sintaxis: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` - -**Parámetros:** - -- `cond_N` — The condition for the function to return `then_N`. -- `then_N` — The result of the function when executed. -- `else` — The result of the function if none of the conditions is met. - -La función acepta `2N+1` parámetros. - -**Valores devueltos** - -La función devuelve uno de los valores `then_N` o `else` dependiendo de las condiciones `cond_N`. - -**Ejemplo** - -De nuevo usando `LEFT_RIGHT` tabla. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─result──────────┐ -│ ᴺᵁᴸᴸ │ 4 │ Null value │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ left is greater │ -│ 4 │ ᴺᵁᴸᴸ │ Null value │ -└──────┴───────┴─────────────────┘ -``` - -## Usar resultados condicionales directamente {#using-conditional-results-directly} - -Los condicionales siempre dan como resultado `0`, `1` o `NULL`. Entonces puedes usar resultados condicionales directamente como este: - -``` sql -SELECT left < right AS is_small -FROM LEFT_RIGHT - -┌─is_small─┐ -│ ᴺᵁᴸᴸ │ -│ 1 │ -│ 0 │ -│ 0 │ -│ ᴺᵁᴸᴸ │ -└──────────┘ -``` - -## Valores NULL en condicionales {#null-values-in-conditionals} - -Cuando `NULL` están involucrados en condicionales, el resultado también será `NULL`. - -``` sql -SELECT - NULL < 1, - 2 < NULL, - NULL < NULL, - NULL = NULL - -┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ -│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└───────────────┴───────────────┴──────────────────┴────────────────────┘ -``` - -Por lo tanto, debe construir sus consultas cuidadosamente si los tipos son `Nullable`. - -El siguiente ejemplo demuestra esto al no agregar la condición equals a `multiIf`. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─faulty_result────┐ -│ ᴺᵁᴸᴸ │ 4 │ Both equal │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ right is smaller │ -│ 4 │ ᴺᵁᴸᴸ │ Both equal │ -└──────┴───────┴──────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/es/sql_reference/functions/date_time_functions.md b/docs/es/sql_reference/functions/date_time_functions.md deleted file mode 100644 index eb9d8371a29..00000000000 --- a/docs/es/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,450 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 39 -toc_title: Trabajar con fechas y horas ---- - -# Funciones para trabajar con fechas y horas {#functions-for-working-with-dates-and-times} - -Soporte para zonas horarias - -Todas las funciones para trabajar con la fecha y la hora que tienen un uso lógico para la zona horaria pueden aceptar un segundo argumento de zona horaria opcional. Ejemplo: Asia/Ekaterimburgo. En este caso, utilizan la zona horaria especificada en lugar de la local (predeterminada). - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - -``` text -┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ -└─────────────────────┴────────────┴────────────┴─────────────────────┘ -``` - -Solo se admiten las zonas horarias que difieren de UTC por un número entero de horas. - -## Todos los derechos reservados. {#totimezone} - -Convierta la hora o la fecha y la hora a la zona horaria especificada. - -## paraAño {#toyear} - -Convierte una fecha o fecha con hora en un número UInt16 que contiene el número de año (AD). - -## aTrimestre {#toquarter} - -Convierte una fecha o fecha con hora en un número UInt8 que contiene el número de trimestre. - -## ParaMes {#tomonth} - -Convierte una fecha o fecha con hora en un número UInt8 que contiene el número de mes (1-12). - -## Todos los derechos reservados. {#todayofyear} - -Convierte una fecha o fecha con hora en un número UInt16 que contiene el número del día del año (1-366). - -## Todos los derechos reservados. {#todayofmonth} - -Convierte una fecha o fecha con hora en un número UInt8 que contiene el número del día del mes (1-31). - -## Todos los derechos reservados. {#todayofweek} - -Convierte una fecha o fecha con hora en un número UInt8 que contiene el número del día de la semana (el lunes es 1 y el domingo es 7). - -## ParaHora {#tohour} - -Convierte una fecha con hora en un número UInt8 que contiene el número de la hora en el tiempo de 24 horas (0-23). -This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). - -## ToMinute {#tominute} - -Convierte una fecha con hora en un número UInt8 que contiene el número del minuto de la hora (0-59). - -## aSegundo {#tosecond} - -Convierte una fecha con hora en un número UInt8 que contiene el número del segundo en el minuto (0-59). -Los segundos de salto no se contabilizan. - -## Todos los derechos reservados. {#to-unix-timestamp} - -Para el argumento DateTime: convierte el valor a su representación numérica interna (Unix Timestamp). -Para el argumento String: analice la fecha y hora de la cadena de acuerdo con la zona horaria (segundo argumento opcional, la zona horaria del servidor se usa de forma predeterminada) y devuelve la marca de tiempo de Unix correspondiente. -Para el argumento Date : el comportamiento no está especificado. - -**Sintaxis** - -``` sql -toUnixTimestamp(datetime) -toUnixTimestamp(str, [timezone]) -``` - -**Valor devuelto** - -- Devuelve la marca de tiempo de Unix. - -Tipo: `UInt32`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp -``` - -Resultado: - -``` text -┌─unix_timestamp─┐ -│ 1509836867 │ -└────────────────┘ -``` - -## Todos los derechos reservados. {#tostartofyear} - -Redondea una fecha o fecha con la hora hasta el primer día del año. -Devuelve la fecha. - -## Todos los derechos reservados. {#tostartofisoyear} - -Redondea una fecha o fecha con la hora hasta el primer día del año ISO. -Devuelve la fecha. - -## Todos los derechos reservados. {#tostartofquarter} - -Redondea una fecha o fecha con la hora hasta el primer día del trimestre. -El primer día del trimestre es el 1 de enero, el 1 de abril, el 1 de julio o el 1 de octubre. -Devuelve la fecha. - -## Todos los derechos reservados. {#tostartofmonth} - -Redondea una fecha o fecha con la hora hasta el primer día del mes. -Devuelve la fecha. - -!!! attention "Atención" - El comportamiento de analizar fechas incorrectas es específico de la implementación. ClickHouse puede devolver una fecha cero, lanzar una excepción o hacer “natural” desbordamiento. - -## paraLunes {#tomonday} - -Redondea una fecha o fecha con hora al lunes más cercano. -Devuelve la fecha. - -## ¿Cómo puedo hacerlo?\]) {#tostartofweektmode} - -Redondea una fecha o fecha con hora al domingo o lunes más cercano por modo. -Devuelve la fecha. -El argumento mode funciona exactamente igual que el argumento mode a toWeek() . Para la sintaxis de argumento único, se utiliza un valor de modo de 0. - -## Todos los derechos reservados. {#tostartofday} - -Redondea una fecha con el tiempo hasta el comienzo del día. - -## Todos los derechos reservados. {#tostartofhour} - -Redondea una fecha con el tiempo hasta el comienzo de la hora. - -## Todos los derechos reservados. {#tostartofminute} - -Redondea una fecha con el tiempo hasta el inicio del minuto. - -## Acerca de nosotros {#tostartoffiveminute} - -Redondea una fecha con el tiempo hasta el inicio del intervalo de cinco minutos. - -## Acerca de Nosotros {#tostartoftenminutes} - -Redondea una fecha con el tiempo hasta el inicio del intervalo de diez minutos. - -## Para comenzar de quince minutos {#tostartoffifteenminutes} - -Redondea la fecha con el tiempo hasta el inicio del intervalo de quince minutos. - -## También puede usar una interfaz de usuario.\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -Esta es una generalización de otras funciones llamadas `toStartOf*`. Por ejemplo, -`toStartOfInterval(t, INTERVAL 1 year)` devuelve lo mismo que `toStartOfYear(t)`, -`toStartOfInterval(t, INTERVAL 1 month)` devuelve lo mismo que `toStartOfMonth(t)`, -`toStartOfInterval(t, INTERVAL 1 day)` devuelve lo mismo que `toStartOfDay(t)`, -`toStartOfInterval(t, INTERVAL 15 minute)` devuelve lo mismo que `toStartOfFifteenMinutes(t)` sucesivamente. - -## Tiempo {#totime} - -Convierte una fecha con hora en una fecha fija determinada, preservando al mismo tiempo la hora. - -## Todos los derechos reservados. {#torelativeyearnum} - -Convierte una fecha con hora o fecha en el número del año, a partir de un determinado punto fijo en el pasado. - -## Nombre de la red inalámbrica (SSID): {#torelativequarternum} - -Convierte una fecha con hora o fecha en el número del trimestre, a partir de un determinado punto fijo en el pasado. - -## Nombre de la red inalámbrica (SSID): {#torelativemonthnum} - -Convierte una fecha con hora o fecha en el número del mes, a partir de un determinado punto fijo en el pasado. - -## Nombre de la red inalámbrica (SSID): {#torelativeweeknum} - -Convierte una fecha con hora o fecha en el número de la semana, a partir de un determinado punto fijo en el pasado. - -## Nombre de la red inalámbrica (SSID): {#torelativedaynum} - -Convierte una fecha con hora o fecha en el número del día, a partir de un determinado punto fijo en el pasado. - -## Nombre de la red inalámbrica (SSID): {#torelativehournum} - -Convierte una fecha con hora o fecha en el número de la hora, a partir de un determinado punto fijo en el pasado. - -## Todos los derechos reservados. {#torelativeminutenum} - -Convierte una fecha con hora o fecha en el número del minuto, a partir de un cierto punto fijo en el pasado. - -## Todos los derechos reservados. {#torelativesecondnum} - -Convierte una fecha con hora o fecha en el número de la segunda, a partir de un cierto punto fijo en el pasado. - -## AISOAño {#toisoyear} - -Convierte una fecha o fecha con hora en un número UInt16 que contiene el número ISO Year. - -## paraISOWeek {#toisoweek} - -Convierte una fecha o fecha con hora en un número UInt8 que contiene el número de semana ISO. - -## ToWeek(fecha\[,modo\]) {#toweekdatemode} - -Esta función devuelve el número de semana para la fecha o la fecha y hora. La forma de dos argumentos de toWeek() le permite especificar si la semana comienza el domingo o el lunes y si el valor de retorno debe estar en el rango de 0 a 53 o de 1 a 53. Si se omite el argumento mode, el modo predeterminado es 0. -`toISOWeek()`es una función de compatibilidad que es equivalente a `toWeek(date,3)`. -La siguiente tabla describe cómo funciona el argumento mode. - -| Modo | Primer día de la semana | Gama | Week 1 is the first week … | -|------|-------------------------|------|----------------------------| -| 0 | Domingo | 0-53 | con un domingo de este año | -| 1 | Lunes | 0-53 | con 4 o más días este año | -| 2 | Domingo | 1-53 | con un domingo de este año | -| 3 | Lunes | 1-53 | con 4 o más días este año | -| 4 | Domingo | 0-53 | con 4 o más días este año | -| 5 | Lunes | 0-53 | con un lunes de este año | -| 6 | Domingo | 1-53 | con 4 o más días este año | -| 7 | Lunes | 1-53 | con un lunes de este año | -| 8 | Domingo | 1-53 | contiene 1 de enero | -| 9 | Lunes | 1-53 | contiene 1 de enero | - -Para valores de modo con un significado de “with 4 or more days this year,” semanas están numeradas según ISO 8601:1988: - -- Si la semana que contiene el 1 de enero tiene 4 o más días en el nuevo año, es la semana 1. - -- De lo contrario, es la última semana del año anterior, y la semana siguiente es la semana 1. - -Para valores de modo con un significado de “contains January 1”, la semana contiene 1 de enero es la semana 1. No importa cuántos días en el nuevo año contenía la semana, incluso si contenía solo un día. - -``` sql -toWeek(date, [, mode][, Timezone]) -``` - -**Parámetros** - -- `date` – Date or DateTime. -- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. -- `Timezone` – Optional parameter, it behaves like any other conversion function. - -**Ejemplo** - -``` sql -SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; -``` - -``` text -┌───────date─┬─week0─┬─week1─┬─week9─┐ -│ 2016-12-27 │ 52 │ 52 │ 1 │ -└────────────┴───────┴───────┴───────┘ -``` - -## aYearWeek(fecha\[,modo\]) {#toyearweekdatemode} - -Devuelve año y semana para una fecha. El año en el resultado puede ser diferente del año en el argumento de fecha para la primera y la última semana del año. - -El argumento mode funciona exactamente igual que el argumento mode a toWeek() . Para la sintaxis de argumento único, se utiliza un valor de modo de 0. - -`toISOYear()`es una función de compatibilidad que es equivalente a `intDiv(toYearWeek(date,3),100)`. - -**Ejemplo** - -``` sql -SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; -``` - -``` text -┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ -│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ -└────────────┴───────────┴───────────┴───────────┘ -``` - -## ahora {#now} - -Acepta cero argumentos y devuelve la hora actual en uno de los momentos de ejecución de la solicitud. -Esta función devuelve una constante, incluso si la solicitud tardó mucho en completarse. - -## hoy {#today} - -Acepta cero argumentos y devuelve la fecha actual en uno de los momentos de ejecución de la solicitud. -Lo mismo que ‘toDate(now())’. - -## ayer {#yesterday} - -Acepta cero argumentos y devuelve la fecha de ayer en uno de los momentos de ejecución de la solicitud. -Lo mismo que ‘today() - 1’. - -## timeSlot {#timeslot} - -Redondea el tiempo a la media hora. -Esta función es específica de Yandex.Metrica, ya que media hora es la cantidad mínima de tiempo para dividir una sesión en dos sesiones si una etiqueta de seguimiento muestra las páginas vistas consecutivas de un solo usuario que difieren en el tiempo en estrictamente más de esta cantidad. Esto significa que las tuplas (el ID de etiqueta, el ID de usuario y el intervalo de tiempo) se pueden usar para buscar páginas vistas que se incluyen en la sesión correspondiente. - -## paraYYYYMM {#toyyyymm} - -Convierte una fecha o fecha con hora en un número UInt32 que contiene el número de año y mes (YYYY \* 100 + MM). - -## paraYYYYMMDD {#toyyyymmdd} - -Convierte una fecha o fecha con hora en un número UInt32 que contiene el número de año y mes (AAAA \* 10000 + MM \* 100 + DD). - -## paraYYYYMMDDhhmmss {#toyyyymmddhhmmss} - -Convierte una fecha o fecha con hora en un número UInt64 que contiene el número de año y mes (YYYY \* 10000000000 + MM \* 100000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss). - -## Por ejemplo, en el caso de que el usuario pueda acceder a la página de inicio de sesión, seleccione la página de inicio de sesión. {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} - -La función agrega un intervalo de fecha / fecha y hora a una fecha / fecha y hora y luego devuelve la fecha / fecha y hora. Por ejemplo: - -``` sql -WITH - toDate('2018-01-01') AS date, - toDateTime('2018-01-01 00:00:00') AS date_time -SELECT - addYears(date, 1) AS add_years_with_date, - addYears(date_time, 1) AS add_years_with_date_time -``` - -``` text -┌─add_years_with_date─┬─add_years_with_date_time─┐ -│ 2019-01-01 │ 2019-01-01 00:00:00 │ -└─────────────────────┴──────────────────────────┘ -``` - -## restarAños, restarMeses, restarSemanas, restarDías, restarHoras, restarMinutos, restarSegundos, restarCuartos {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} - -La función resta un intervalo de fecha / fecha y hora a una fecha / fecha y hora y luego devuelve la fecha / fecha y hora. Por ejemplo: - -``` sql -WITH - toDate('2019-01-01') AS date, - toDateTime('2019-01-01 00:00:00') AS date_time -SELECT - subtractYears(date, 1) AS subtract_years_with_date, - subtractYears(date_time, 1) AS subtract_years_with_date_time -``` - -``` text -┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ -│ 2018-01-01 │ 2018-01-01 00:00:00 │ -└──────────────────────────┴───────────────────────────────┘ -``` - -## dateDiff {#datediff} - -Devuelve la diferencia entre dos valores Date o DateTime. - -**Sintaxis** - -``` sql -dateDiff('unit', startdate, enddate, [timezone]) -``` - -**Parámetros** - -- `unit` — Time unit, in which the returned value is expressed. [Cadena](../syntax.md#syntax-string-literal). - - Supported values: - - | unit | - | ---- | - |second | - |minute | - |hour | - |day | - |week | - |month | - |quarter | - |year | - -- `startdate` — The first time value to compare. [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). - -- `enddate` — The second time value to compare. [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). - -- `timezone` — Optional parameter. If specified, it is applied to both `startdate` y `enddate`. Si no se especifica, las zonas horarias `startdate` y `enddate` se utilizan. Si no son lo mismo, el resultado no está especificado. - -**Valor devuelto** - -Diferencia entre `startdate` y `enddate` expresado en `unit`. - -Tipo: `int`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); -``` - -Resultado: - -``` text -┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ -│ 25 │ -└────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## timeSlots(Hora de inicio, Duración, \[, Tamaño\]) {#timeslotsstarttime-duration-size} - -Para un intervalo de tiempo a partir de ‘StartTime’ y continuando por ‘Duration’ segundos, devuelve una matriz de momentos en el tiempo, que consiste en puntos de este intervalo ‘Size’ en segundos. ‘Size’ es un parámetro opcional: una constante UInt32, establecida en 1800 por defecto. -Por ejemplo, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. -Esto es necesario para buscar páginas vistas en la sesión correspondiente. - -## formatDateTime(Hora, Formato\[, Zona horaria\]) {#formatdatetime} - -Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. - -Modificadores compatibles para Formato: -(“Example” columna muestra el resultado de formateo para el tiempo `2018-01-02 22:33:44`) - -| Modificador | Descripci | Ejemplo | -|-----------------|------------------------------------------------------------------|------------| -| %C | año dividido por 100 y truncado a entero (00-99) | 20 | -| %d | día del mes, cero acolchado (01-31) | 02 | -| %D | Fecha corta de MM/DD/YY, equivalente a %m/%d/%y | 01/02/18 | -| %e | día del mes, espacio acolchado ( 1-31) | 2 | -| %F | fecha corta AAAA-MM-DD, equivalente a %Y-%m-%d | 2018-01-02 | -| %H | hora en formato 24h (00-23) | 22 | -| %I | hora en formato 12h (01-12) | 10 | -| %j | día del año (001-366) | 002 | -| Más información | mes como un número decimal (01-12) | 01 | -| %M | minutos (00-59) | 33 | -| %y | carácter de nueva línea ('') | | -| %p | Designación AM o PM | PM | -| %R | HH de 24 horas: Tiempo del milímetro, equivalente a %H: %M | 22:33 | -| %S | segundo (00-59) | 44 | -| % t | carácter de pestaña horizontal (') | | -| %T | Formato de hora ISO 8601 (HH:MM:SS), equivalente a %H:%M:%S | 22:33:44 | -| %u | ISO 8601 día de la semana como número con el lunes como 1 (1-7) | 2 | -| %V | Número de semana ISO 8601 (01-53) | 01 | -| % w | día de la semana como un número decimal con domingo como 0 (0-6) | 2 | -| %y | Año, últimos dos dígitos (00-99) | 18 | -| %Y | Año | 2018 | -| %% | signo | % | - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/es/sql_reference/functions/encoding_functions.md b/docs/es/sql_reference/functions/encoding_functions.md deleted file mode 100644 index 7459dfcda0e..00000000000 --- a/docs/es/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 52 -toc_title: "Codificaci\xF3n" ---- - -# Funciones de codificación {#encoding-functions} - -## char {#char} - -Devuelve la cadena con la longitud como el número de argumentos pasados y cada byte tiene el valor del argumento correspondiente. Acepta varios argumentos de tipos numéricos. Si el valor del argumento está fuera del rango del tipo de datos UInt8, se convierte a UInt8 con posible redondeo y desbordamiento. - -**Sintaxis** - -``` sql -char(number_1, [number_2, ..., number_n]); -``` - -**Parámetros** - -- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [En](../../sql_reference/data_types/int_uint.md), [Flotante](../../sql_reference/data_types/float.md). - -**Valor devuelto** - -- una cadena de bytes. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello -``` - -Resultado: - -``` text -┌─hello─┐ -│ hello │ -└───────┘ -``` - -Puede construir una cadena de codificación arbitraria pasando los bytes correspondientes. Aquí hay un ejemplo para UTF-8: - -Consulta: - -``` sql -SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; -``` - -Resultado: - -``` text -┌─hello──┐ -│ привет │ -└────────┘ -``` - -Consulta: - -``` sql -SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; -``` - -Resultado: - -``` text -┌─hello─┐ -│ 你好 │ -└───────┘ -``` - -## hexagonal {#hex} - -Devuelve una cadena que contiene la representación hexadecimal del argumento. - -**Sintaxis** - -``` sql -hex(arg) -``` - -La función está usando letras mayúsculas `A-F` y no usar ningún prefijo (como `0x`) o sufijos (como `h`). - -Para argumentos enteros, imprime dígitos hexadecimales (“nibbles”) del más significativo al menos significativo (big endian o “human readable” orden). Comienza con el byte distinto de cero más significativo (se omiten los cero bytes principales) pero siempre imprime ambos dígitos de cada byte incluso si el dígito inicial es cero. - -Ejemplo: - -**Ejemplo** - -Consulta: - -``` sql -SELECT hex(1); -``` - -Resultado: - -``` text -01 -``` - -Valores de tipo `Date` y `DateTime` están formateados como enteros correspondientes (el número de días desde Epoch para Date y el valor de Unix Timestamp para DateTime). - -Para `String` y `FixedString`, todos los bytes son simplemente codificados como dos números hexadecimales. No se omiten cero bytes. - -Los valores de los tipos de coma flotante y Decimal se codifican como su representación en la memoria. Como apoyamos la pequeña arquitectura endian, están codificados en little endian. No se omiten cero bytes iniciales / finales. - -**Parámetros** - -- `arg` — A value to convert to hexadecimal. Types: [Cadena](../../sql_reference/data_types/string.md), [UInt](../../sql_reference/data_types/int_uint.md), [Flotante](../../sql_reference/data_types/float.md), [Decimal](../../sql_reference/data_types/decimal.md), [Fecha](../../sql_reference/data_types/date.md) o [FechaHora](../../sql_reference/data_types/datetime.md). - -**Valor devuelto** - -- Una cadena con la representación hexadecimal del argumento. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); -``` - -Resultado: - -``` text -┌─hex_presentation─┐ -│ 00007041 │ -│ 00008041 │ -└──────────────────┘ -``` - -Consulta: - -``` sql -SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); -``` - -Resultado: - -``` text -┌─hex_presentation─┐ -│ 0000000000002E40 │ -│ 0000000000003040 │ -└──────────────────┘ -``` - -## unhex(str) {#unhexstr} - -Acepta una cadena que contiene cualquier número de dígitos hexadecimales y devuelve una cadena que contiene los bytes correspondientes. Admite letras mayúsculas y minúsculas A-F. El número de dígitos hexadecimales no tiene que ser par. Si es impar, el último dígito se interpreta como la mitad menos significativa del byte 00-0F. Si la cadena de argumento contiene algo que no sean dígitos hexadecimales, se devuelve algún resultado definido por la implementación (no se produce una excepción). -Si desea convertir el resultado en un número, puede usar el ‘reverse’ y ‘reinterpretAsType’ función. - -## UUIDStringToNum (str) {#uuidstringtonumstr} - -Acepta una cadena que contiene 36 caracteres en el formato `123e4567-e89b-12d3-a456-426655440000`, y lo devuelve como un conjunto de bytes en un FixedString(16). - -## UUIDNumToString (str) {#uuidnumtostringstr} - -Acepta un valor de FixedString(16). Devuelve una cadena que contiene 36 caracteres en formato de texto. - -## ¿Cómo puedo hacerlo?) {#bitmasktolistnum} - -Acepta un entero. Devuelve una cadena que contiene la lista de potencias de dos que suman el número de origen cuando se suma. Están separados por comas sin espacios en formato de texto, en orden ascendente. - -## ¿Qué puedes encontrar en Neodigit) {#bitmasktoarraynum} - -Acepta un entero. Devuelve una matriz de números UInt64 que contiene la lista de potencias de dos que suman el número de origen cuando se suma. Los números en la matriz están en orden ascendente. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/es/sql_reference/functions/ext_dict_functions.md b/docs/es/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index 979f20aafdc..00000000000 --- a/docs/es/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 58 -toc_title: Trabajar con diccionarios externos ---- - -# Funciones para trabajar con diccionarios externos {#ext_dict_functions} - -Para obtener información sobre cómo conectar y configurar diccionarios externos, consulte [Diccionarios externos](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -## dictGet {#dictget} - -Recupera un valor de un diccionario externo. - -``` sql -dictGet('dict_name', 'attr_name', id_expr) -dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Parámetros** - -- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql_reference/data_types/int_uint.md) o [Tupla](../../sql_reference/data_types/tuple.md)valor -type dependiendo de la configuración del diccionario. -- `default_value_expr` — Value returned if the dictionary doesn't contain a row with the `id_expr` clave. [Expresion](../syntax.md#syntax-expressions) devolviendo el valor en el tipo de datos configurado para `attr_name` atributo. - -**Valor devuelto** - -- Si ClickHouse analiza el atributo correctamente en el [tipo de datos del atributo](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), funciones devuelven el valor del atributo de diccionario que corresponde a `id_expr`. - -- Si no hay la clave, correspondiente a `id_expr` en el diccionario, entonces: - - - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouse produce una excepción si no puede analizar el valor del atributo o si el valor no coincide con el tipo de datos del atributo. - -**Ejemplo** - -Crear un archivo de texto `ext-dict-text.csv` que contiene los siguientes: - -``` text -1,1 -2,2 -``` - -La primera columna es `id` la segunda columna es `c1`. - -Configurar el diccionario externo: - -``` xml - - - ext-dict-test - - - /path-to/ext-dict-test.csv - CSV - - - - - - - - id - - - c1 - UInt32 - - - - 0 - - -``` - -Realizar la consulta: - -``` sql -SELECT - dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, - toTypeName(val) AS type -FROM system.numbers -LIMIT 3 -``` - -``` text -┌─val─┬─type───┐ -│ 1 │ UInt32 │ -│ 2 │ UInt32 │ -│ 20 │ UInt32 │ -└─────┴────────┘ -``` - -**Ver también** - -- [Diccionarios externos](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) - -## dictHas {#dicthas} - -Comprueba si hay una clave en un diccionario. - -``` sql -dictHas('dict_name', id_expr) -``` - -**Parámetros** - -- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql_reference/data_types/int_uint.md)-tipo de valor. - -**Valor devuelto** - -- 0, si no hay clave. -- 1, si hay una llave. - -Tipo: `UInt8`. - -## dictGetHierarchy {#dictgethierarchy} - -Crea una matriz, que contiene todos los padres de una clave [diccionario jerárquico](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md). - -**Sintaxis** - -``` sql -dictGetHierarchy('dict_name', key) -``` - -**Parámetros** - -- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). -- `key` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql_reference/data_types/int_uint.md)-tipo de valor. - -**Valor devuelto** - -- Padres por la llave. - -Tipo: [Matriz (UInt64)](../../sql_reference/data_types/array.md). - -## DictIsIn {#dictisin} - -Comprueba el antecesor de una clave a través de toda la cadena jerárquica en el diccionario. - -``` sql -dictIsIn('dict_name', child_id_expr, ancestor_id_expr) -``` - -**Parámetros** - -- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). -- `child_id_expr` — Key to be checked. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql_reference/data_types/int_uint.md)-tipo de valor. -- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` clave. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql_reference/data_types/int_uint.md)-tipo de valor. - -**Valor devuelto** - -- 0, si `child_id_expr` no es un niño de `ancestor_id_expr`. -- 1, si `child_id_expr` es un niño de `ancestor_id_expr` o si `child_id_expr` es una `ancestor_id_expr`. - -Tipo: `UInt8`. - -## Otras funciones {#ext_dict_functions-other} - -ClickHouse admite funciones especializadas que convierten los valores de atributo de diccionario a un tipo de datos específico, independientemente de la configuración del diccionario. - -Función: - -- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` -- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` -- `dictGetFloat32`, `dictGetFloat64` -- `dictGetDate` -- `dictGetDateTime` -- `dictGetUUID` -- `dictGetString` - -Todas estas funciones tienen el `OrDefault` modificación. Por ejemplo, `dictGetDateOrDefault`. - -Sintaxis: - -``` sql -dictGet[Type]('dict_name', 'attr_name', id_expr) -dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Parámetros** - -- `dict_name` — Name of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [Literal de cadena](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expresion](../syntax.md#syntax-expressions) devolviendo un [UInt64](../../sql_reference/data_types/int_uint.md)-tipo de valor. -- `default_value_expr` — Value which is returned if the dictionary doesn't contain a row with the `id_expr` clave. [Expresion](../syntax.md#syntax-expressions) devolviendo un valor en el tipo de datos configurado para `attr_name` atributo. - -**Valor devuelto** - -- Si ClickHouse analiza el atributo correctamente en el [tipo de datos del atributo](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), funciones devuelven el valor del atributo de diccionario que corresponde a `id_expr`. - -- Si no se solicita `id_expr` en el diccionario entonces: - - - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouse produce una excepción si no puede analizar el valor del atributo o si el valor no coincide con el tipo de datos del atributo. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/es/sql_reference/functions/functions_for_nulls.md b/docs/es/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 662b6c27999..00000000000 --- a/docs/es/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,312 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 63 -toc_title: Trabajar con argumentos Nullable ---- - -# Funciones para trabajar con agregados anulables {#functions-for-working-with-nullable-aggregates} - -## IsNull {#isnull} - -Comprueba si el argumento es [NULL](../syntax.md#null). - -``` sql -isNull(x) -``` - -**Parámetros** - -- `x` — A value with a non-compound data type. - -**Valor devuelto** - -- `1` si `x` ser `NULL`. -- `0` si `x` no es `NULL`. - -**Ejemplo** - -Tabla de entrada - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Consulta - -``` sql -SELECT x FROM t_null WHERE isNull(y) -``` - -``` text -┌─x─┐ -│ 1 │ -└───┘ -``` - -## isNotNull {#isnotnull} - -Comprueba si el argumento es [NULL](../syntax.md#null). - -``` sql -isNotNull(x) -``` - -**Parámetros:** - -- `x` — A value with a non-compound data type. - -**Valor devuelto** - -- `0` si `x` ser `NULL`. -- `1` si `x` no es `NULL`. - -**Ejemplo** - -Tabla de entrada - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Consulta - -``` sql -SELECT x FROM t_null WHERE isNotNull(y) -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## Coalesce {#coalesce} - -Comprueba de izquierda a derecha si `NULL` se aprobaron argumentos y devuelve el primer no-`NULL` argumento. - -``` sql -coalesce(x,...) -``` - -**Parámetros:** - -- Cualquier número de parámetros de un tipo no compuesto. Todos los parámetros deben ser compatibles por tipo de datos. - -**Valores devueltos** - -- El primer no-`NULL` argumento. -- `NULL` si todos los argumentos son `NULL`. - -**Ejemplo** - -Considere una lista de contactos que pueden especificar varias formas de contactar a un cliente. - -``` text -┌─name─────┬─mail─┬─phone─────┬──icq─┐ -│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ -│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└──────────┴──────┴───────────┴──────┘ -``` - -El `mail` y `phone` los campos son de tipo String, pero el `icq` campo `UInt32`, por lo que necesita ser convertido a `String`. - -Obtenga el primer método de contacto disponible para el cliente de la lista de contactos: - -``` sql -SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook -``` - -``` text -┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ -│ client 1 │ 123-45-67 │ -│ client 2 │ ᴺᵁᴸᴸ │ -└──────────┴──────────────────────────────────────────────────────┘ -``` - -## ifNull {#ifnull} - -Devuelve un valor alternativo si el argumento principal es `NULL`. - -``` sql -ifNull(x,alt) -``` - -**Parámetros:** - -- `x` — The value to check for `NULL`. -- `alt` — The value that the function returns if `x` ser `NULL`. - -**Valores devueltos** - -- Valor `x`, si `x` no es `NULL`. -- Valor `alt`, si `x` ser `NULL`. - -**Ejemplo** - -``` sql -SELECT ifNull('a', 'b') -``` - -``` text -┌─ifNull('a', 'b')─┐ -│ a │ -└──────────────────┘ -``` - -``` sql -SELECT ifNull(NULL, 'b') -``` - -``` text -┌─ifNull(NULL, 'b')─┐ -│ b │ -└───────────────────┘ -``` - -## nullIf {#nullif} - -Devoluciones `NULL` si los argumentos son iguales. - -``` sql -nullIf(x, y) -``` - -**Parámetros:** - -`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. - -**Valores devueltos** - -- `NULL` si los argumentos son iguales. -- El `x` valor, si los argumentos no son iguales. - -**Ejemplo** - -``` sql -SELECT nullIf(1, 1) -``` - -``` text -┌─nullIf(1, 1)─┐ -│ ᴺᵁᴸᴸ │ -└──────────────┘ -``` - -``` sql -SELECT nullIf(1, 2) -``` - -``` text -┌─nullIf(1, 2)─┐ -│ 1 │ -└──────────────┘ -``` - -## assumeNotNull {#assumenotnull} - -Resultados en un valor de tipo [NULL](../../sql_reference/data_types/nullable.md) para un no- `Nullable` si el valor no es `NULL`. - -``` sql -assumeNotNull(x) -``` - -**Parámetros:** - -- `x` — The original value. - -**Valores devueltos** - -- El valor original del-`Nullable` tipo, si no es `NULL`. -- El valor predeterminado para el-`Nullable` tipo si el valor original fue `NULL`. - -**Ejemplo** - -Considere el `t_null` tabla. - -``` sql -SHOW CREATE TABLE t_null -``` - -``` text -┌─statement─────────────────────────────────────────────────────────────────┐ -│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ -└───────────────────────────────────────────────────────────────────────────┘ -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Aplicar el `assumeNotNull` función a la `y` columna. - -``` sql -SELECT assumeNotNull(y) FROM t_null -``` - -``` text -┌─assumeNotNull(y)─┐ -│ 0 │ -│ 3 │ -└──────────────────┘ -``` - -``` sql -SELECT toTypeName(assumeNotNull(y)) FROM t_null -``` - -``` text -┌─toTypeName(assumeNotNull(y))─┐ -│ Int8 │ -│ Int8 │ -└──────────────────────────────┘ -``` - -## Acerca de Nosotros {#tonullable} - -Convierte el tipo de argumento a `Nullable`. - -``` sql -toNullable(x) -``` - -**Parámetros:** - -- `x` — The value of any non-compound type. - -**Valor devuelto** - -- El valor de entrada con un `Nullable` tipo. - -**Ejemplo** - -``` sql -SELECT toTypeName(10) -``` - -``` text -┌─toTypeName(10)─┐ -│ UInt8 │ -└────────────────┘ -``` - -``` sql -SELECT toTypeName(toNullable(10)) -``` - -``` text -┌─toTypeName(toNullable(10))─┐ -│ Nullable(UInt8) │ -└────────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/es/sql_reference/functions/geo.md b/docs/es/sql_reference/functions/geo.md deleted file mode 100644 index 05734e0289e..00000000000 --- a/docs/es/sql_reference/functions/geo.md +++ /dev/null @@ -1,510 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 62 -toc_title: "Trabajar con coordenadas geogr\xE1ficas" ---- - -# Funciones para trabajar con coordenadas geográficas {#functions-for-working-with-geographical-coordinates} - -## GreatCircleDistance {#greatcircledistance} - -Calcule la distancia entre dos puntos en la superficie de la Tierra usando [la fórmula del gran círculo](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**Parámetros de entrada** - -- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. -- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. -- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. -- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. - -Los valores positivos corresponden a latitud norte y longitud este, y los valores negativos corresponden a latitud sur y longitud oeste. - -**Valor devuelto** - -La distancia entre dos puntos en la superficie de la Tierra, en metros. - -Genera una excepción cuando los valores de los parámetros de entrada están fuera del intervalo. - -**Ejemplo** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## pointInEllipses {#pointinellipses} - -Comprueba si el punto pertenece al menos a una de las elipses. -Las coordenadas son geométricas en el sistema de coordenadas cartesianas. - -``` sql -pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) -``` - -**Parámetros de entrada** - -- `x, y` — Coordinates of a point on the plane. -- `xᵢ, yᵢ` — Coordinates of the center of the `i`-ésimo puntos suspensivos. -- `aᵢ, bᵢ` — Axes of the `i`-ésimo puntos suspensivos en unidades de coordenadas x, y. - -Los parámetros de entrada deben ser `2+4⋅n`, donde `n` es el número de puntos suspensivos. - -**Valores devueltos** - -`1` si el punto está dentro de al menos una de las elipses; `0`si no lo es. - -**Ejemplo** - -``` sql -SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) -``` - -``` text -┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ -│ 1 │ -└─────────────────────────────────────────────────┘ -``` - -## pointInPolygon {#pointinpolygon} - -Comprueba si el punto pertenece al polígono en el plano. - -``` sql -pointInPolygon((x, y), [(a, b), (c, d) ...], ...) -``` - -**Valores de entrada** - -- `(x, y)` — Coordinates of a point on the plane. Data type — [Tupla](../../sql_reference/data_types/tuple.md) — A tuple of two numbers. -- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [Matriz](../../sql_reference/data_types/array.md). Cada vértice está representado por un par de coordenadas `(a, b)`. Los vértices deben especificarse en sentido horario o antihorario. El número mínimo de vértices es 3. El polígono debe ser constante. -- La función también admite polígonos con agujeros (secciones recortadas). En este caso, agregue polígonos que definan las secciones recortadas utilizando argumentos adicionales de la función. La función no admite polígonos no simplemente conectados. - -**Valores devueltos** - -`1` si el punto está dentro del polígono, `0` si no lo es. -Si el punto está en el límite del polígono, la función puede devolver 0 o 1. - -**Ejemplo** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## geohashEncode {#geohashencode} - -Codifica la latitud y la longitud como una cadena geohash, consulte (http://geohash.org/, https://en.wikipedia.org/wiki/Geohash). - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**Valores de entrada** - -- longitud - longitud parte de la coordenada que desea codificar. Flotando en el rango`[-180°, 180°]` -- latitude : parte de latitud de la coordenada que desea codificar. Flotando en el rango `[-90°, 90°]` -- precision - Opcional, longitud de la cadena codificada resultante, por defecto es `12`. Entero en el rango `[1, 12]`. Cualquier valor menor que `1` o mayor que `12` se convierte silenciosamente a `12`. - -**Valores devueltos** - -- alfanumérico `String` de coordenadas codificadas (se utiliza la versión modificada del alfabeto de codificación base32). - -**Ejemplo** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## geohashDecode {#geohashdecode} - -Decodifica cualquier cadena codificada por geohash en longitud y latitud. - -**Valores de entrada** - -- encoded string - cadena codificada geohash. - -**Valores devueltos** - -- (longitud, latitud) - 2-tupla de `Float64` valores de longitud y latitud. - -**Ejemplo** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## geoToH3 {#geotoh3} - -Devoluciones [H3](https://uber.github.io/h3/#/documentation/overview/introduction) índice de punto `(lon, lat)` con la resolución especificada. - -[H3](https://uber.github.io/h3/#/documentation/overview/introduction) es un sistema de indexación geográfica donde la superficie de la Tierra se divide en incluso azulejos hexagonales. Este sistema es jerárquico, es decir, cada hexágono en el nivel superior se puede dividir en siete incluso pero más pequeños y así sucesivamente. - -Este índice se utiliza principalmente para ubicaciones de bucketing y otras manipulaciones geoespaciales. - -**Sintaxis** - -``` sql -geoToH3(lon, lat, resolution) -``` - -**Parámetros** - -- `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]`. Tipo: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- Número de índice hexagonal. -- 0 en caso de error. - -Tipo: `UInt64`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -Resultado: - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## Información adicional {#geohashesinbox} - -Devuelve una matriz de cadenas codificadas por geohash de precisión dada que caen dentro e intersecan los límites de un cuadro dado, básicamente una cuadrícula 2D aplanada en una matriz. - -**Valores de entrada** - -- longitude\_min - longitud mínima, valor flotante en el rango `[-180°, 180°]` -- latitude\_min - latitud mínima, valor flotante en el rango `[-90°, 90°]` -- longitude\_max - longitud máxima, valor flotante en el rango `[-180°, 180°]` -- latitude\_max - latitud máxima, valor flotante en el rango `[-90°, 90°]` -- precisión - precisión del geohash, `UInt8` en el rango `[1, 12]` - -Tenga en cuenta que todos los parámetros de coordenadas deben ser del mismo tipo: `Float32` o `Float64`. - -**Valores devueltos** - -- matriz de cadenas de precisión largas de geohash-cajas que cubren el área proporcionada, no debe confiar en el orden de los artículos. -- \[\] - matriz vacía si *minuto* valores de *latitud* y *longitud* no son menos que los correspondientes *máximo* valor. - -Tenga en cuenta que la función arrojará una excepción si la matriz resultante tiene más de 10'000'000 de elementos. - -**Ejemplo** - -``` sql -SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos -``` - -``` text -┌─thasos──────────────────────────────────────┐ -│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ -└─────────────────────────────────────────────┘ -``` - -## h3GetBaseCell {#h3getbasecell} - -Devuelve el número de celda base del índice. - -**Sintaxis** - -``` sql -h3GetBaseCell(index) -``` - -**Parámetros** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- Número de celda base hexagonal. Tipo: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT h3GetBaseCell(612916788725809151) as basecell -``` - -Resultado: - -``` text -┌─basecell─┐ -│ 12 │ -└──────────┘ -``` - -## H3HexAreaM2 {#h3hexaream2} - -Área hexagonal promedio en metros cuadrados a la resolución dada. - -**Sintaxis** - -``` sql -h3HexAreaM2(resolution) -``` - -**Parámetros** - -- `resolution` — Index resolution. Range: `[0, 15]`. Tipo: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- Area in m². Type: [Float64](../../sql_reference/data_types/float.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT h3HexAreaM2(13) as area -``` - -Resultado: - -``` text -┌─area─┐ -│ 43.9 │ -└──────┘ -``` - -## h3IndexesAreNeighbors {#h3indexesareneighbors} - -Devuelve si los H3Indexes proporcionados son vecinos o no. - -**Sintaxis** - -``` sql -h3IndexesAreNeighbors(index1, index2) -``` - -**Parámetros** - -- `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). - -**Valores devueltos** - -- Devoluciones `1` si los índices son vecinos, `0` de lo contrario. Tipo: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n -``` - -Resultado: - -``` text -┌─n─┐ -│ 1 │ -└───┘ -``` - -## H3ToChildren {#h3tochildren} - -Devuelve una matriz con los índices secundarios del índice dado. - -**Sintaxis** - -``` sql -h3ToChildren(index, resolution) -``` - -**Parámetros** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. Tipo: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- Matriz con los índices H3 hijo. Matriz de tipo: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT h3ToChildren(599405990164561919, 6) AS children -``` - -Resultado: - -``` text -┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## H3ToParent {#h3toparent} - -Devuelve el índice primario (más grueso) que contiene el índice dado. - -**Sintaxis** - -``` sql -h3ToParent(index, resolution) -``` - -**Parámetros** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. Tipo: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- Índice padre H3. Tipo: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT h3ToParent(599405990164561919, 3) as parent -``` - -Resultado: - -``` text -┌─────────────parent─┐ -│ 590398848891879423 │ -└────────────────────┘ -``` - -## H3ToString {#h3tostring} - -Convierte la representación H3Index del índice en la representación de cadena. - -``` sql -h3ToString(index) -``` - -**Parámetros** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- Representación de cadena del índice H3. Tipo: [Cadena](../../sql_reference/data_types/string.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT h3ToString(617420388352917503) as h3_string -``` - -Resultado: - -``` text -┌─h3_string───────┐ -│ 89184926cdbffff │ -└─────────────────┘ -``` - -## stringToH3 {#stringtoh3} - -Convierte la representación de cadena en representación H3Index (UInt64). - -``` sql -stringToH3(index_str) -``` - -**Parámetros** - -- `index_str` — String representation of the H3 index. Type: [Cadena](../../sql_reference/data_types/string.md). - -**Valores devueltos** - -- Número de índice hexagonal. Devuelve 0 en caso de error. Tipo: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT stringToH3('89184926cc3ffff') as index -``` - -Resultado: - -``` text -┌──────────────index─┐ -│ 617420388351344639 │ -└────────────────────┘ -``` - -## h3GetResolution {#h3getresolution} - -Devuelve la resolución del índice. - -**Sintaxis** - -``` sql -h3GetResolution(index) -``` - -**Parámetros** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Valores devueltos** - -- Resolución del índice. Gama: `[0, 15]`. Tipo: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT h3GetResolution(617420388352917503) as res -``` - -Resultado: - -``` text -┌─res─┐ -│ 9 │ -└─────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/es/sql_reference/functions/hash_functions.md b/docs/es/sql_reference/functions/hash_functions.md deleted file mode 100644 index f6cbfabcf06..00000000000 --- a/docs/es/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,446 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 50 -toc_title: Hash ---- - -# Funciones hash {#hash-functions} - -Las funciones Hash se pueden usar para la barajada pseudoaleatoria determinista de elementos. - -## HalfMD5 {#hash-functions-halfmd5} - -[Interpretar](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) todos los parámetros de entrada como cadenas y calcula el [MD5](https://en.wikipedia.org/wiki/MD5) valor hash para cada uno de ellos. Luego combina hashes, toma los primeros 8 bytes del hash de la cadena resultante y los interpreta como `UInt64` en orden de bytes de big-endian. - -``` sql -halfMD5(par1, ...) -``` - -La función es relativamente lenta (5 millones de cadenas cortas por segundo por núcleo del procesador). -Considere usar el [sipHash64](#hash_functions-siphash64) función en su lugar. - -**Parámetros** - -La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql_reference/data_types/index.md). - -**Valor devuelto** - -A [UInt64](../../sql_reference/data_types/int_uint.md) tipo de datos valor hash. - -**Ejemplo** - -``` sql -SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type -``` - -``` text -┌────────halfMD5hash─┬─type───┐ -│ 186182704141653334 │ UInt64 │ -└────────────────────┴────────┘ -``` - -## MD5 {#hash_functions-md5} - -Calcula el MD5 de una cadena y devuelve el conjunto de bytes resultante como FixedString(16). -Si no necesita MD5 en particular, pero necesita un hash criptográfico decente de 128 bits, use el ‘sipHash128’ función en su lugar. -Si desea obtener el mismo resultado que la salida de la utilidad md5sum, use lower(hex(MD5(s)) . - -## sipHash64 {#hash_functions-siphash64} - -Produce un [SipHash](https://131002.net/siphash/) valor hash. - -``` sql -sipHash64(par1,...) -``` - -Esta es una función hash criptográfica. Funciona al menos tres veces más rápido que el [MD5](#hash_functions-md5) función. - -Función [interpretar](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) todos los parámetros de entrada como cadenas y calcula el valor hash para cada uno de ellos. Luego combina hashes por el siguiente algoritmo: - -1. Después de hash todos los parámetros de entrada, la función obtiene la matriz de hashes. -2. La función toma el primero y el segundo elementos y calcula un hash para la matriz de ellos. -3. Luego, la función toma el valor hash, calculado en el paso anterior, y el tercer elemento de la matriz hash inicial, y calcula un hash para la matriz de ellos. -4. El paso anterior se repite para todos los elementos restantes de la matriz hash inicial. - -**Parámetros** - -La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql_reference/data_types/index.md). - -**Valor devuelto** - -A [UInt64](../../sql_reference/data_types/int_uint.md) tipo de datos valor hash. - -**Ejemplo** - -``` sql -SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type -``` - -``` text -┌──────────────SipHash─┬─type───┐ -│ 13726873534472839665 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## sipHash128 {#hash_functions-siphash128} - -Calcula SipHash a partir de una cadena. -Acepta un argumento de tipo String. Devuelve FixedString(16). -Difiere de sipHash64 en que el estado final de plegado xor solo se realiza hasta 128 bits. - -## cityHash64 {#cityhash64} - -Produce un [Método de codificación de datos:](https://github.com/google/cityhash) valor hash. - -``` sql -cityHash64(par1,...) -``` - -Esta es una función hash rápida no criptográfica. Utiliza el algoritmo CityHash para parámetros de cadena y la función hash no criptográfica rápida específica de la implementación para parámetros con otros tipos de datos. La función utiliza el combinador CityHash para obtener los resultados finales. - -**Parámetros** - -La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql_reference/data_types/index.md). - -**Valor devuelto** - -A [UInt64](../../sql_reference/data_types/int_uint.md) tipo de datos valor hash. - -**Ejemplos** - -Ejemplo de llamada: - -``` sql -SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type -``` - -``` text -┌─────────────CityHash─┬─type───┐ -│ 12072650598913549138 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -En el ejemplo siguiente se muestra cómo calcular la suma de comprobación de toda la tabla con precisión hasta el orden de fila: - -``` sql -SELECT groupBitXor(cityHash64(*)) FROM table -``` - -## intHash32 {#inthash32} - -Calcula un código hash de 32 bits a partir de cualquier tipo de entero. -Esta es una función hash no criptográfica relativamente rápida de calidad media para los números. - -## intHash64 {#inthash64} - -Calcula un código hash de 64 bits a partir de cualquier tipo de entero. -Funciona más rápido que intHash32. Calidad media. - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -Calcula SHA-1, SHA-224 o SHA-256 de una cadena y devuelve el conjunto de bytes resultante como FixedString(20), FixedString(28) o FixedString(32). -La función funciona bastante lentamente (SHA-1 procesa alrededor de 5 millones de cadenas cortas por segundo por núcleo del procesador, mientras que SHA-224 y SHA-256 procesan alrededor de 2.2 millones). -Recomendamos usar esta función solo en los casos en que necesite una función hash específica y no pueda seleccionarla. -Incluso en estos casos, recomendamos aplicar la función offline y precalcular valores al insertarlos en la tabla, en lugar de aplicarlo en SELECTS. - -## Nombre de la red inalámbrica (SSID):\]) {#urlhashurl-n} - -Una función hash no criptográfica rápida y de calidad decente para una cadena obtenida de una URL utilizando algún tipo de normalización. -`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` o `#` al final, si está presente. -`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` o `#` al final, si está presente. -Los niveles son los mismos que en URLHierarchy. Esta función es específica de Yandex.Métrica. - -## Método de codificación de datos: {#farmhash64} - -Produce un [Método de codificación de datos:](https://github.com/google/farmhash) valor hash. - -``` sql -farmHash64(par1, ...) -``` - -La función utiliza el `Hash64` de todos [métodos disponibles](https://github.com/google/farmhash/blob/master/src/farmhash.h). - -**Parámetros** - -La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql_reference/data_types/index.md). - -**Valor devuelto** - -A [UInt64](../../sql_reference/data_types/int_uint.md) tipo de datos valor hash. - -**Ejemplo** - -``` sql -SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type -``` - -``` text -┌─────────────FarmHash─┬─type───┐ -│ 17790458267262532859 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## Nombre de la red inalámbrica (SSID): {#hash_functions-javahash} - -Calcular [Nivel de Cifrado WEP](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) de una cuerda. Esta función hash no es rápida ni tiene una buena calidad. La única razón para usarlo es cuando este algoritmo ya se usa en otro sistema y debe calcular exactamente el mismo resultado. - -**Sintaxis** - -``` sql -SELECT javaHash(''); -``` - -**Valor devuelto** - -A `Int32` tipo de datos valor hash. - -**Ejemplo** - -Consulta: - -``` sql -SELECT javaHash('Hello, world!'); -``` - -Resultado: - -``` text -┌─javaHash('Hello, world!')─┐ -│ -1880044555 │ -└───────────────────────────┘ -``` - -## javaHashUTF16LE {#javahashutf16le} - -Calcular [Nivel de Cifrado WEP](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) de una cadena, suponiendo que contiene bytes que representan una cadena en codificación UTF-16LE. - -**Sintaxis** - -``` sql -javaHashUTF16LE(stringUtf16le) -``` - -**Parámetros** - -- `stringUtf16le` — a string in UTF-16LE encoding. - -**Valor devuelto** - -A `Int32` tipo de datos valor hash. - -**Ejemplo** - -Consulta correcta con cadena codificada UTF-16LE. - -Consulta: - -``` sql -SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) -``` - -Resultado: - -``` text -┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ -│ 3556498 │ -└──────────────────────────────────────────────────────────────┘ -``` - -## HiveHash {#hash-functions-hivehash} - -Calcular `HiveHash` de una cuerda. - -``` sql -SELECT hiveHash(''); -``` - -Esto es sólo [Nivel de Cifrado WEP](#hash_functions-javahash) con poco de signo puesto a cero. Esta función se utiliza en [Colmena de Apache](https://en.wikipedia.org/wiki/Apache_Hive) para versiones anteriores a la 3.0. Esta función hash no es rápida ni tiene una buena calidad. La única razón para usarlo es cuando este algoritmo ya se usa en otro sistema y debe calcular exactamente el mismo resultado. - -**Valor devuelto** - -A `Int32` tipo de datos valor hash. - -Tipo: `hiveHash`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT hiveHash('Hello, world!'); -``` - -Resultado: - -``` text -┌─hiveHash('Hello, world!')─┐ -│ 267439093 │ -└───────────────────────────┘ -``` - -## Método de codificación de datos: {#metrohash64} - -Produce un [Método de codificación de datos:](http://www.jandrewrogers.com/2015/05/27/metrohash/) valor hash. - -``` sql -metroHash64(par1, ...) -``` - -**Parámetros** - -La función toma un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql_reference/data_types/index.md). - -**Valor devuelto** - -A [UInt64](../../sql_reference/data_types/int_uint.md) tipo de datos valor hash. - -**Ejemplo** - -``` sql -SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type -``` - -``` text -┌────────────MetroHash─┬─type───┐ -│ 14235658766382344533 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## SaltarConsistentHash {#jumpconsistenthash} - -Calcula JumpConsistentHash forma un UInt64. -Acepta dos argumentos: una clave de tipo UInt64 y el número de cubos. Devuelve Int32. -Para obtener más información, consulte el enlace: [SaltarConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) - -## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} - -Produce un [Método de codificación de datos:](https://github.com/aappleby/smhasher) valor hash. - -``` sql -murmurHash2_32(par1, ...) -murmurHash2_64(par1, ...) -``` - -**Parámetros** - -Ambas funciones toman un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql_reference/data_types/index.md). - -**Valor devuelto** - -- El `murmurHash2_32` función devuelve el valor hash que tiene el [UInt32](../../sql_reference/data_types/int_uint.md) tipo de datos. -- El `murmurHash2_64` función devuelve el valor hash que tiene el [UInt64](../../sql_reference/data_types/int_uint.md) tipo de datos. - -**Ejemplo** - -``` sql -SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type -``` - -``` text -┌──────────MurmurHash2─┬─type───┐ -│ 11832096901709403633 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} - -Produce un [Método de codificación de datos:](https://github.com/aappleby/smhasher) valor hash. - -``` sql -murmurHash3_32(par1, ...) -murmurHash3_64(par1, ...) -``` - -**Parámetros** - -Ambas funciones toman un número variable de parámetros de entrada. Los parámetros pueden ser cualquiera de los [tipos de datos compatibles](../../sql_reference/data_types/index.md). - -**Valor devuelto** - -- El `murmurHash3_32` función devuelve un [UInt32](../../sql_reference/data_types/int_uint.md) tipo de datos valor hash. -- El `murmurHash3_64` función devuelve un [UInt64](../../sql_reference/data_types/int_uint.md) tipo de datos valor hash. - -**Ejemplo** - -``` sql -SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3─┬─type───┐ -│ 2152717 │ UInt32 │ -└─────────────┴────────┘ -``` - -## murmurHash3\_128 {#murmurhash3-128} - -Produce un [Método de codificación de datos:](https://github.com/aappleby/smhasher) valor hash. - -``` sql -murmurHash3_128( expr ) -``` - -**Parámetros** - -- `expr` — [Expresiones](../syntax.md#syntax-expressions) devolviendo un [Cadena](../../sql_reference/data_types/string.md)-tipo de valor. - -**Valor devuelto** - -A [Cadena fija (16)](../../sql_reference/data_types/fixedstring.md) tipo de datos valor hash. - -**Ejemplo** - -``` sql -SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3──────┬─type────────────┐ -│ 6�1�4"S5KT�~~q │ FixedString(16) │ -└──────────────────┴─────────────────┘ -``` - -## xxHash32, xxHash64 {#hash-functions-xxhash32} - -Calcular `xxHash` de una cuerda. Se propone en dos sabores, 32 y 64 bits. - -``` sql -SELECT xxHash32(''); - -OR - -SELECT xxHash64(''); -``` - -**Valor devuelto** - -A `Uint32` o `Uint64` tipo de datos valor hash. - -Tipo: `xxHash`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT xxHash32('Hello, world!'); -``` - -Resultado: - -``` text -┌─xxHash32('Hello, world!')─┐ -│ 834093149 │ -└───────────────────────────┘ -``` - -**Ver también** - -- [xxHash](http://cyan4973.github.io/xxHash/). - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/es/sql_reference/functions/higher_order_functions.md b/docs/es/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index 3fac42e8d3c..00000000000 --- a/docs/es/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 57 -toc_title: Orden superior ---- - -# Funciones de orden superior {#higher-order-functions} - -## `->` operador, función lambda (params, expr) {#operator-lambdaparams-expr-function} - -Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. - -Ejemplos: `x -> 2 * x, str -> str != Referer.` - -Las funciones de orden superior solo pueden aceptar funciones lambda como su argumento funcional. - -Una función lambda que acepta múltiples argumentos se puede pasar a una función de orden superior. En este caso, a la función de orden superior se le pasan varias matrices de idéntica longitud a las que corresponderán estos argumentos. - -Para algunas funciones, tales como [arrayCount](#higher_order_functions-array-count) o [arraySum](#higher_order_functions-array-count), el primer argumento (la función lambda) se puede omitir. En este caso, se supone un mapeo idéntico. - -No se puede omitir una función lambda para las siguientes funciones: - -- [arrayMap](#higher_order_functions-array-map) -- [arrayFilter](#higher_order_functions-array-filter) -- [arrayFill](#higher_order_functions-array-fill) -- [arrayReverseFill](#higher_order_functions-array-reverse-fill) -- [arraySplit](#higher_order_functions-array-split) -- [arrayReverseSplit](#higher_order_functions-array-reverse-split) -- [arrayFirst](#higher_order_functions-array-first) -- [arrayFirstIndex](#higher_order_functions-array-first-index) - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -Devuelve una matriz obtenida de la aplicación original `func` función a cada elemento en el `arr` matriz. - -Ejemplos: - -``` sql -SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,4,5] │ -└─────────┘ -``` - -En el ejemplo siguiente se muestra cómo crear una tupla de elementos de diferentes matrices: - -``` sql -SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res -``` - -``` text -┌─res─────────────────┐ -│ [(1,4),(2,5),(3,6)] │ -└─────────────────────┘ -``` - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayMap` función. - -### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} - -Devuelve una matriz que contiene sólo los elementos en `arr1` para los cuales `func` devuelve algo distinto de 0. - -Ejemplos: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - -``` text -┌─res───────────┐ -│ ['abc World'] │ -└───────────────┘ -``` - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - -``` text -┌─res─┐ -│ [2] │ -└─────┘ -``` - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFilter` función. - -### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} - -Escanear a través de `arr1` desde el primer elemento hasta el último elemento y reemplazar `arr1[i]` por `arr1[i - 1]` si `func` devuelve 0. El primer elemento de `arr1` no será reemplazado. - -Ejemplos: - -``` sql -SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res──────────────────────────────┐ -│ [1,1,3,11,12,12,12,5,6,14,14,14] │ -└──────────────────────────────────┘ -``` - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFill` función. - -### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} - -Escanear a través de `arr1` del último elemento al primer elemento y reemplace `arr1[i]` por `arr1[i + 1]` si `func` devuelve 0. El último elemento de `arr1` no será reemplazado. - -Ejemplos: - -``` sql -SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res────────────────────────────────┐ -│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ -└────────────────────────────────────┘ -``` - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayReverseFill` función. - -### arraySplit(func, arr1, …) {#higher_order_functions-array-split} - -Dividir `arr1` en múltiples matrices. Cuando `func` devuelve algo distinto de 0, la matriz se dividirá en el lado izquierdo del elemento. La matriz no se dividirá antes del primer elemento. - -Ejemplos: - -``` sql -SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res─────────────┐ -│ [[1,2,3],[4,5]] │ -└─────────────────┘ -``` - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arraySplit` función. - -### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} - -Dividir `arr1` en múltiples matrices. Cuando `func` devuelve algo distinto de 0, la matriz se dividirá en el lado derecho del elemento. La matriz no se dividirá después del último elemento. - -Ejemplos: - -``` sql -SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res───────────────┐ -│ [[1],[2,3,4],[5]] │ -└───────────────────┘ -``` - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arraySplit` función. - -### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} - -Devuelve el número de elementos de la matriz arr para los cuales func devuelve algo distinto de 0. Si ‘func’ no se especifica, devuelve el número de elementos distintos de cero en la matriz. - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -Devuelve 1 si hay al menos un elemento en ‘arr’ para los cuales ‘func’ devuelve algo distinto de 0. De lo contrario, devuelve 0. - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -Devuelve 1 si ‘func’ devuelve algo distinto de 0 para todos los elementos en ‘arr’. De lo contrario, devuelve 0. - -### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} - -Devuelve la suma de la ‘func’ valor. Si se omite la función, simplemente devuelve la suma de los elementos de la matriz. - -### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} - -Devuelve el primer elemento en el ‘arr1’ matriz para la cual ‘func’ devuelve algo distinto de 0. - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFirst` función. - -### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} - -Devuelve el índice del primer elemento ‘arr1’ matriz para la cual ‘func’ devuelve algo distinto de 0. - -Tenga en cuenta que el primer argumento (función lambda) no se puede omitir en el `arrayFirstIndex` función. - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -Devuelve una matriz de sumas parciales de elementos en la matriz de origen (una suma en ejecución). Si el `func` se especifica la función, luego los valores de los elementos de la matriz se convierten mediante esta función antes de sumar. - -Ejemplo: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - -``` text -┌─res──────────┐ -│ [1, 2, 3, 4] │ -└──────────────┘ -``` - -### Información de archivo) {#arraycumsumnonnegativearr} - -Lo mismo que `arrayCumSum`, devuelve una matriz de sumas parciales de elementos en la matriz de origen (una suma en ejecución). Diferente `arrayCumSum`, cuando el valor devuelto contiene un valor menor que cero, el valor se reemplaza con cero y el cálculo posterior se realiza con cero parámetros. Por ejemplo: - -``` sql -SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,0,1] │ -└───────────┘ -``` - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -Devuelve una matriz como resultado de ordenar los elementos de `arr1` en orden ascendente. Si el `func` se especifica la función, el orden de clasificación se determina por el resultado de la función `func` aplicado a los elementos de la matriz (arrays) - -El [Transformación de Schwartzian](https://en.wikipedia.org/wiki/Schwartzian_transform) se utiliza para mejorar la eficiencia de clasificación. - -Ejemplo: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Para obtener más información sobre el `arraySort` método, véase el [Funciones para trabajar con matrices](array_functions.md#array_functions-sort) apartado. - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -Devuelve una matriz como resultado de ordenar los elementos de `arr1` en orden descendente. Si el `func` se especifica la función, el orden de clasificación se determina por el resultado de la función `func` aplicado a los elementos de la matriz (arrays). - -Ejemplo: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -Para obtener más información sobre el `arrayReverseSort` método, véase el [Funciones para trabajar con matrices](array_functions.md#array_functions-reverse-sort) apartado. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/es/sql_reference/functions/in_functions.md b/docs/es/sql_reference/functions/in_functions.md deleted file mode 100644 index ea593d14070..00000000000 --- a/docs/es/sql_reference/functions/in_functions.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 60 -toc_title: "Implementaci\xF3n del operador IN" ---- - -# Funciones para implementar el operador IN {#functions-for-implementing-the-in-operator} - -## Información de uso {#in-functions} - -Vea la sección [IN operadores](../statements/select.md#select-in-operators). - -## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} - -Una función que permite agrupar varias columnas. -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. -Las tuplas se usan normalmente como valores intermedios para un argumento de operadores IN, o para crear una lista de parámetros formales de funciones lambda. Las tuplas no se pueden escribir en una tabla. - -## Puede utilizar el siguiente ejemplo: {#tupleelementtuple-n-operator-x-n} - -Una función que permite obtener una columna de una tupla. -‘N’ es el índice de columna, comenzando desde 1. N debe ser una constante. ‘N’ debe ser una constante. ‘N’ debe ser un entero postivo estricto no mayor que el tamaño de la tupla. -No hay ningún costo para ejecutar la función. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/es/sql_reference/functions/index.md b/docs/es/sql_reference/functions/index.md deleted file mode 100644 index 9a8c464cb12..00000000000 --- a/docs/es/sql_reference/functions/index.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Functions -toc_priority: 32 -toc_title: "Implantaci\xF3n" ---- - -# Función {#functions} - -Hay al menos \* dos tipos de funciones: funciones regulares (simplemente se llaman “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn't depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). - -En esta sección discutimos las funciones regulares. Para las funciones agregadas, consulte la sección “Aggregate functions”. - -\* - Existe un tercer tipo de función que el ‘arrayJoin’ la función pertenece a; las funciones de la tabla también se pueden mencionar por separado.\* - -## Tipeo fuerte {#strong-typing} - -A diferencia del SQL estándar, ClickHouse tiene una tipificación fuerte. En otras palabras, no hace conversiones implícitas entre tipos. Cada función funciona para un conjunto específico de tipos. Esto significa que a veces necesita usar funciones de conversión de tipos. - -## Eliminación de subexpresiones comunes {#common-subexpression-elimination} - -Se considera que todas las expresiones de una consulta que tienen el mismo AST (el mismo registro o el mismo resultado del análisis sintáctico) tienen valores idénticos. Tales expresiones se concatenan y se ejecutan una vez. Las subconsultas idénticas también se eliminan de esta manera. - -## Tipos de resultados {#types-of-results} - -Todas las funciones devuelven un único retorno como resultado (no varios valores, y no valores cero). El tipo de resultado generalmente se define solo por los tipos de argumentos, no por los valores. Las excepciones son la función tupleElement (el operador a.N) y la función toFixedString. - -## Constante {#constants} - -Para simplificar, ciertas funciones solo pueden funcionar con constantes para algunos argumentos. Por ejemplo, el argumento correcto del operador LIKE debe ser una constante. -Casi todas las funciones devuelven una constante para argumentos constantes. La excepción son las funciones que generan números aleatorios. -El ‘now’ function devuelve valores diferentes para las consultas que se ejecutaron en diferentes momentos, pero el resultado se considera una constante, ya que la constancia solo es importante dentro de una sola consulta. -Una expresión constante también se considera una constante (por ejemplo, la mitad derecha del operador LIKE se puede construir a partir de múltiples constantes). - -Las funciones se pueden implementar de diferentes maneras para argumentos constantes y no constantes (se ejecuta un código diferente). Pero los resultados para una constante y para una columna verdadera que contiene solo el mismo valor deben coincidir entre sí. - -## Procesamiento NULL {#null-processing} - -Las funciones tienen los siguientes comportamientos: - -- Si al menos uno de los argumentos de la función es `NULL` el resultado de la función es también `NULL`. -- Comportamiento especial que se especifica individualmente en la descripción de cada función. En el código fuente de ClickHouse, estas funciones tienen `UseDefaultImplementationForNulls=false`. - -## Constancia {#constancy} - -Functions can't change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. - -## Manejo de errores {#error-handling} - -Algunas funciones pueden producir una excepción si los datos no son válidos. En este caso, la consulta se cancela y se devuelve un texto de error al cliente. Para el procesamiento distribuido, cuando se produce una excepción en uno de los servidores, los otros servidores también intentan anular la consulta. - -## Evaluación de expresiones de argumento {#evaluation-of-argument-expressions} - -En casi todos los lenguajes de programación, uno de los argumentos puede no evaluarse para ciertos operadores. Esto suele ser los operadores `&&`, `||`, y `?:`. -Pero en ClickHouse, los argumentos de las funciones (operadores) siempre se evalúan. Esto se debe a que partes enteras de columnas se evalúan a la vez, en lugar de calcular cada fila por separado. - -## Realización de funciones para el procesamiento de consultas distribuidas {#performing-functions-for-distributed-query-processing} - -Para el procesamiento de consultas distribuidas, se realizan tantas etapas de procesamiento de consultas como sea posible en servidores remotos, y el resto de las etapas (fusionando resultados intermedios y todo lo posterior) se realizan en el servidor solicitante. - -Esto significa que las funciones se pueden realizar en diferentes servidores. -Por ejemplo, en la consulta `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` - -- si una `distributed_table` tiene al menos dos fragmentos, las funciones ‘g’ y ‘h’ se realizan en servidores remotos, y la función ‘f’ se realiza en el servidor solicitante. -- si una `distributed_table` tiene sólo un fragmento, todos los ‘f’, ‘g’, y ‘h’ funciones se realizan en el servidor de este fragmento. - -El resultado de una función generalmente no depende del servidor en el que se realice. Sin embargo, a veces esto es importante. -Por ejemplo, las funciones que funcionan con diccionarios utilizan el diccionario que existe en el servidor en el que se están ejecutando. -Otro ejemplo es el `hostName` función, que devuelve el nombre del servidor en el que se está ejecutando para `GROUP BY` por servidores en un `SELECT` consulta. - -Si se realiza una función en una consulta en el servidor solicitante, pero debe realizarla en servidores remotos, puede envolverla en un ‘any’ agregar o agregarlo a una clave en `GROUP BY`. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/es/sql_reference/functions/introspection.md b/docs/es/sql_reference/functions/introspection.md deleted file mode 100644 index 212950f2452..00000000000 --- a/docs/es/sql_reference/functions/introspection.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 65 -toc_title: "Introspecci\xF3n" ---- - -# Funciones de introspección {#introspection-functions} - -Puede utilizar las funciones descritas en este capítulo para [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) y [DWARF](https://en.wikipedia.org/wiki/DWARF) para la creación de perfiles de consultas. - -!!! warning "Advertencia" - Estas funciones son lentas y pueden imponer consideraciones de seguridad. - -Para el correcto funcionamiento de las funciones de introspección: - -- Instale el `clickhouse-common-static-dbg` paquete. - -- Establezca el [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) a 1. - - For security reasons introspection functions are disabled by default. - -ClickHouse guarda los informes del generador de perfiles [trace\_log](../../operations/system_tables.md#system_tables-trace_log) tabla del sistema. Asegúrese de que la tabla y el generador de perfiles estén configurados correctamente. - -## addressToLine {#addresstoline} - -Convierte la dirección de memoria virtual dentro del proceso del servidor ClickHouse en el nombre de archivo y el número de línea en el código fuente de ClickHouse. - -Si utiliza paquetes oficiales de ClickHouse, debe instalar el `clickhouse-common-static-dbg` paquete. - -**Sintaxis** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**Parámetros** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**Valor devuelto** - -- Nombre de archivo del código fuente y el número de línea en este archivo delimitado por dos puntos. - - For example, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, where `199` is a line number. - -- Nombre de un binario, si la función no pudo encontrar la información de depuración. - -- Cadena vacía, si la dirección no es válida. - -Tipo: [Cadena](../../sql_reference/data_types/string.md). - -**Ejemplo** - -Habilitación de las funciones de introspección: - -``` sql -SET allow_introspection_functions=1 -``` - -Seleccionando la primera cadena de la `trace_log` tabla del sistema: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -El `trace` campo contiene el seguimiento de la pila en el momento del muestreo. - -Obtener el nombre de archivo del código fuente y el número de línea para una sola dirección: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -``` - -Aplicando la función a todo el seguimiento de la pila: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -El [arrayMap](higher_order_functions.md#higher_order_functions-array-map) permite procesar cada elemento individual de la `trace` matriz por el `addressToLine` función. El resultado de este procesamiento se ve en el `trace_source_code_lines` columna de salida. - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## addressToSymbol {#addresstosymbol} - -Convierte la dirección de memoria virtual dentro del proceso del servidor ClickHouse en el símbolo de los archivos de objetos ClickHouse. - -**Sintaxis** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**Parámetros** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**Valor devuelto** - -- Símbolo de archivos de objetos ClickHouse. -- Cadena vacía, si la dirección no es válida. - -Tipo: [Cadena](../../sql_reference/data_types/string.md). - -**Ejemplo** - -Habilitación de las funciones de introspección: - -``` sql -SET allow_introspection_functions=1 -``` - -Seleccionando la primera cadena de la `trace_log` tabla del sistema: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -El `trace` campo contiene el seguimiento de la pila en el momento del muestreo. - -Obtener un símbolo para una sola dirección: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -Aplicando la función a todo el seguimiento de la pila: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -El [arrayMap](higher_order_functions.md#higher_order_functions-array-map) permite procesar cada elemento individual de la `trace` matriz por el `addressToSymbols` función. El resultado de este procesamiento se ve en el `trace_symbols` columna de salida. - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## demangle {#demangle} - -Convierte un símbolo que puede obtener utilizando el [addressToSymbol](#addresstosymbol) función a la función de C++ nombre. - -**Sintaxis** - -``` sql -demangle(symbol) -``` - -**Parámetros** - -- `symbol` ([Cadena](../../sql_reference/data_types/string.md)) — Symbol from an object file. - -**Valor devuelto** - -- Nombre de la función C++ -- Cadena vacía si un símbolo no es válido. - -Tipo: [Cadena](../../sql_reference/data_types/string.md). - -**Ejemplo** - -Habilitación de las funciones de introspección: - -``` sql -SET allow_introspection_functions=1 -``` - -Seleccionando la primera cadena de la `trace_log` tabla del sistema: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -El `trace` campo contiene el seguimiento de la pila en el momento del muestreo. - -Obtener un nombre de función para una sola dirección: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -Aplicando la función a todo el seguimiento de la pila: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -El [arrayMap](higher_order_functions.md#higher_order_functions-array-map) permite procesar cada elemento individual de la `trace` matriz por el `demangle` función. El resultado de este procesamiento se ve en el `trace_functions` columna de salida. - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/es/sql_reference/functions/ip_address_functions.md b/docs/es/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index 814db50684c..00000000000 --- a/docs/es/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 55 -toc_title: Trabajar con direcciones IP ---- - -# Funciones para trabajar con direcciones IP {#functions-for-working-with-ip-addresses} - -## Número de código: IPv4NumToString (num) {#ipv4numtostringnum} - -Toma un número UInt32. Lo interpreta como una dirección IPv4 en big endian. Devuelve una cadena que contiene la dirección IPv4 correspondiente en el formato A.B.C.d (números separados por puntos en forma decimal). - -## Nombre de la red inalámbrica (SSID):) {#ipv4stringtonums} - -La función inversa de IPv4NumToString. Si la dirección IPv4 tiene un formato no válido, devuelve 0. - -## Cómo hacer esto?) {#ipv4numtostringclasscnum} - -Similar a IPv4NumToString, pero usando xxx en lugar del último octeto. - -Ejemplo: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─k──────────────┬─────c─┐ -│ 83.149.9.xxx │ 26238 │ -│ 217.118.81.xxx │ 26074 │ -│ 213.87.129.xxx │ 25481 │ -│ 83.149.8.xxx │ 24984 │ -│ 217.118.83.xxx │ 22797 │ -│ 78.25.120.xxx │ 22354 │ -│ 213.87.131.xxx │ 21285 │ -│ 78.25.121.xxx │ 20887 │ -│ 188.162.65.xxx │ 19694 │ -│ 83.149.48.xxx │ 17406 │ -└────────────────┴───────┘ -``` - -Desde el uso ‘xxx’ es altamente inusual, esto puede cambiarse en el futuro. Le recomendamos que no confíe en el formato exacto de este fragmento. - -### ¿cómo puedo hacerlo?) {#ipv6numtostringx} - -Acepta un valor FixedString(16) que contiene la dirección IPv6 en formato binario. Devuelve una cadena que contiene esta dirección en formato de texto. -Las direcciones IPv4 asignadas a IPv6 se emiten en el formato ::ffff:111.222.33.44. Ejemplos: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - -``` text -┌─addr─────────┐ -│ 2a02:6b8::11 │ -└──────────────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ -│ 2a02:2168:aaa:bbbb::2 │ 24695 │ -│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ -│ 2a02:6b8:0:fff::ff │ 16389 │ -│ 2a01:4f8:111:6666::2 │ 16016 │ -│ 2a02:2168:888:222::1 │ 15896 │ -│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ -│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ -│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ -│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ -│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ -└─────────────────────────────────────────┴───────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)─┬──────c─┐ -│ ::ffff:94.26.111.111 │ 747440 │ -│ ::ffff:37.143.222.4 │ 529483 │ -│ ::ffff:5.166.111.99 │ 317707 │ -│ ::ffff:46.38.11.77 │ 263086 │ -│ ::ffff:79.105.111.111 │ 186611 │ -│ ::ffff:93.92.111.88 │ 176773 │ -│ ::ffff:84.53.111.33 │ 158709 │ -│ ::ffff:217.118.11.22 │ 154004 │ -│ ::ffff:217.118.11.33 │ 148449 │ -│ ::ffff:217.118.11.44 │ 148243 │ -└────────────────────────────┴────────┘ -``` - -## Nombre de la red inalámbrica (SSID):) {#ipv6stringtonums} - -La función inversa de IPv6NumToString. Si la dirección IPv6 tiene un formato no válido, devuelve una cadena de bytes nulos. -HEX puede ser mayúscula o minúscula. - -## IPv4ToIPv6 (x) {#ipv4toipv6x} - -Toma un `UInt32` numero. Lo interpreta como una dirección IPv4 en [gran endian](https://en.wikipedia.org/wiki/Endianness). Devuelve un `FixedString(16)` valor que contiene la dirección IPv6 en formato binario. Ejemplos: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - -``` text -┌─addr───────────────┐ -│ ::ffff:192.168.0.1 │ -└────────────────────┘ -``` - -## Para obtener más información, consulta nuestra Política de privacidad y nuestras Condiciones de uso) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} - -Acepta un valor FixedString(16) que contiene la dirección IPv6 en formato binario. Devuelve una cadena que contiene la dirección del número especificado de bits eliminados en formato de texto. Por ejemplo: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - -``` text -┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ -│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ -└─────────────────────────────────────┴─────────────────────┘ -``` - -## ¿cómo puedo hacerlo?), {#ipv4cidrtorangeipv4-cidr} - -Acepta un valor IPv4 y UInt8 que contiene el valor [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Devuelve una tupla con dos IPv4 que contienen el rango inferior y el rango superior de la subred. - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - -``` text -┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ -│ ('192.168.0.0','192.168.255.255') │ -└────────────────────────────────────────────┘ -``` - -## ¿cómo puedo hacerlo?), {#ipv6cidrtorangeipv6-cidr} - -Acepta un valor IPv6 y UInt8 que contiene el CIDR. Devuelve una tupla con dos IPv6 que contienen el rango inferior y el rango superior de la subred. - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); -``` - -``` text -┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ -│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -## Acerca de nosotros) {#toipv4string} - -Un alias para `IPv4StringToNum()` que toma una forma de cadena de dirección IPv4 y devuelve el valor de [IPv4](../../sql_reference/data_types/domains/ipv4.md) tipo, que es binario igual al valor devuelto por `IPv4StringToNum()`. - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - -``` text -┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ -│ UInt32 │ IPv4 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - -``` text -┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ -│ ABE1822D │ ABE1822D │ -└───────────────────────────────────┴──────────────────────────┘ -``` - -## Acerca de nosotros) {#toipv6string} - -Un alias para `IPv6StringToNum()` que toma una forma de cadena de dirección IPv6 y devuelve el valor de [IPv6](../../sql_reference/data_types/domains/ipv6.md) tipo, que es binario igual al valor devuelto por `IPv6StringToNum()`. - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - -``` text -┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ -│ FixedString(16) │ IPv6 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - -``` text -┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ -│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ -└───────────────────────────────────┴──────────────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/es/sql_reference/functions/json_functions.md b/docs/es/sql_reference/functions/json_functions.md deleted file mode 100644 index ed7f9ab7312..00000000000 --- a/docs/es/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 56 -toc_title: Trabajando con JSON. ---- - -# Funciones para trabajar con JSON {#functions-for-working-with-json} - -En el Yandex.Metrica, JSON es transmitido por los usuarios como parámetros de sesión. Hay algunas funciones especiales para trabajar con este JSON. (Aunque en la mayoría de los casos, los JSON también se procesan previamente, y los valores resultantes se colocan en columnas separadas en su formato procesado.) Todas estas funciones se basan en sólidas suposiciones sobre lo que puede ser el JSON, pero tratan de hacer lo menos posible para hacer el trabajo. - -Se hacen las siguientes suposiciones: - -1. El nombre de campo (argumento de función) debe ser una constante. -2. El nombre del campo de alguna manera está codificado canónicamente en JSON. Por ejemplo: `visitParamHas('{"abc":"def"}', 'abc') = 1`, pero `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. Los campos se buscan en cualquier nivel de anidación, indiscriminadamente. Si hay varios campos coincidentes, se utiliza la primera aparición. -4. El JSON no tiene caracteres de espacio fuera de los literales de cadena. - -## visitParamHas (params, nombre) {#visitparamhasparams-name} - -Comprueba si hay un campo con el ‘name’ nombre. - -## visitParamExtractUInt (params, nombre) {#visitparamextractuintparams-name} - -Analiza UInt64 a partir del valor del campo denominado ‘name’. Si se trata de un campo de cadena, intenta analizar un número desde el principio de la cadena. Si el campo no existe, o existe pero no contiene un número, devuelve 0. - -## visitParamExtractInt (params, nombre) {#visitparamextractintparams-name} - -Lo mismo que para Int64. - -## visitParamExtractFloat (params, nombre) {#visitparamextractfloatparams-name} - -Lo mismo que para Float64. - -## visitParamExtractBool (params, nombre) {#visitparamextractboolparams-name} - -Analiza un valor verdadero/falso. El resultado es UInt8. - -## visitParamExtractRaw (params, nombre) {#visitparamextractrawparams-name} - -Devuelve el valor de un campo, incluidos los separadores. - -Ejemplos: - -``` sql -visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' -visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' -``` - -## visitParamExtractString(params, nombre) {#visitparamextractstringparams-name} - -Analiza la cadena entre comillas dobles. El valor es sin escape. Si no se pudo desescapar, devuelve una cadena vacía. - -Ejemplos: - -``` sql -visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' -visitParamExtractString('{"abc":"hello}', 'abc') = '' -``` - -Actualmente no hay soporte para puntos de código en el formato `\uXXXX\uYYYY` que no son del plano multilingüe básico (se convierten a CESU-8 en lugar de UTF-8). - -Las siguientes funciones se basan en [simdjson](https://github.com/lemire/simdjson) diseñado para requisitos de análisis JSON más complejos. La suposición 2 mencionada anteriormente todavía se aplica. - -## ¿Qué puedes encontrar en Neodigit) {#isvalidjsonjson} - -Comprueba que la cadena pasada es un json válido. - -Ejemplos: - -``` sql -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} - -Si el valor existe en el documento JSON, `1` serán devueltos. - -Si el valor no existe, `0` serán devueltos. - -Ejemplos: - -``` sql -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 -``` - -`indices_or_keys` es una lista de cero o más argumentos, cada uno de ellos puede ser de cadena o entero. - -- Cadena = miembro del objeto de acceso por clave. -- Entero positivo = acceder al n-ésimo miembro / clave desde el principio. -- Entero negativo = acceder al n-ésimo miembro / clave desde el final. - -El índice mínimo del elemento es 1. Por lo tanto, el elemento 0 no existe. - -Puede usar enteros para acceder a matrices JSON y objetos JSON. - -Entonces, por ejemplo: - -``` sql -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' -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} - -Devuelve la longitud de una matriz JSON o un objeto JSON. - -Si el valor no existe o tiene un tipo incorrecto, `0` serán devueltos. - -Ejemplos: - -``` sql -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} - -Devuelve el tipo de un valor JSON. - -Si el valor no existe, `Null` serán devueltos. - -Ejemplos: - -``` sql -SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' -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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -Analiza un JSON y extrae un valor. Estas funciones son similares a `visitParam` función. - -Si el valor no existe o tiene un tipo incorrecto, `0` serán devueltos. - -Ejemplos: - -``` sql -SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 -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} - -Analiza un JSON y extrae una cadena. Esta función es similar a `visitParamExtractString` función. - -Si el valor no existe o tiene un tipo incorrecto, se devolverá una cadena vacía. - -El valor es sin escape. Si no se pudo desescapar, devuelve una cadena vacía. - -Ejemplos: - -``` sql -SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' -SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' -SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' -``` - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -Analiza un JSON y extrae un valor del tipo de datos ClickHouse dado. - -Esta es una generalización de la anterior `JSONExtract` función. -Esto significa -`JSONExtract(..., 'String')` devuelve exactamente lo mismo que `JSONExtractString()`, -`JSONExtract(..., 'Float64')` devuelve exactamente lo mismo que `JSONExtractFloat()`. - -Ejemplos: - -``` sql -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL -SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 -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} - -Analizar pares clave-valor de un JSON donde los valores son del tipo de datos ClickHouse dado. - -Ejemplo: - -``` sql -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} - -Devuelve una parte de JSON. - -Si la pieza no existe o tiene un tipo incorrecto, se devolverá una cadena vacía. - -Ejemplo: - -``` sql -SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' -``` - -## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} - -Devuelve una matriz con elementos de matriz JSON, cada uno representado como cadena sin analizar. - -Si la parte no existe o no es una matriz, se devolverá una matriz vacía. - -Ejemplo: - -``` sql -SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/es/sql_reference/functions/machine_learning_functions.md b/docs/es/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index fd695934937..00000000000 --- a/docs/es/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 64 -toc_title: "Funciones de aprendizaje autom\xE1tico" ---- - -# Funciones de aprendizaje automático {#machine-learning-functions} - -## evalMLMethod (predicción) {#machine_learning_methods-evalmlmethod} - -Predicción utilizando modelos de regresión ajustados utiliza `evalMLMethod` función. Ver enlace en `linearRegression`. - -### Regresión lineal estocástica {#stochastic-linear-regression} - -El [stochasticLinearRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlinearregression) la función agregada implementa el método de descenso de gradiente estocástico utilizando el modelo lineal y la función de pérdida MSE. Utilizar `evalMLMethod` para predecir sobre nuevos datos. - -### Regresión logística estocástica {#stochastic-logistic-regression} - -El [stochasticLogisticRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlogisticregression) la función de agregado implementa el método de descenso de gradiente estocástico para el problema de clasificación binaria. Utilizar `evalMLMethod` para predecir sobre nuevos datos. diff --git a/docs/es/sql_reference/functions/math_functions.md b/docs/es/sql_reference/functions/math_functions.md deleted file mode 100644 index 6654ba5187b..00000000000 --- a/docs/es/sql_reference/functions/math_functions.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 44 -toc_title: "Matem\xE1tica" ---- - -# Funciones matemáticas {#mathematical-functions} - -Todas las funciones devuelven un número Float64. La precisión del resultado es cercana a la precisión máxima posible, pero el resultado puede no coincidir con el número representable de la máquina más cercano al número real correspondiente. - -## e() {#e} - -Devuelve un número Float64 que está cerca del número e. - -## Ciudad() {#pi} - -Returns a Float64 number that is close to the number π. - -## exp(x) {#expx} - -Acepta un argumento numérico y devuelve un número Float64 cercano al exponente del argumento. - -## Información) {#logx-lnx} - -Acepta un argumento numérico y devuelve un número Float64 cercano al logaritmo natural del argumento. - -## exp2(x) {#exp2x} - -Acepta un argumento numérico y devuelve un número Float64 cercano a 2 a la potencia de x. - -## log2 (x) {#log2x} - -Acepta un argumento numérico y devuelve un número Float64 cercano al logaritmo binario del argumento. - -## exp10 (x) {#exp10x} - -Acepta un argumento numérico y devuelve un número Float64 cercano a 10 a la potencia de x. - -## log10 (x) {#log10x} - -Acepta un argumento numérico y devuelve un número Float64 cercano al logaritmo decimal del argumento. - -## sqrt(x) {#sqrtx} - -Acepta un argumento numérico y devuelve un número Float64 cercano a la raíz cuadrada del argumento. - -## Cbrt (x) {#cbrtx} - -Acepta un argumento numérico y devuelve un número Float64 cercano a la raíz cúbica del argumento. - -## erf(x) {#erfx} - -Si ‘x’ is non-negative, then erf(x / σ√2) es la probabilidad de que una variable aleatoria tenga una distribución normal con desviación estándar ‘σ’ toma el valor que está separado del valor esperado en más de ‘x’. - -Ejemplo (regla de tres sigma): - -``` sql -SELECT erf(3 / sqrt(2)) -``` - -``` text -┌─erf(divide(3, sqrt(2)))─┐ -│ 0.9973002039367398 │ -└─────────────────────────┘ -``` - -## erfc(x) {#erfcx} - -Acepta un argumento numérico y devuelve un número Float64 cercano a 1 - erf(x), pero sin pérdida de precisión para grandes ‘x’ valor. - -## Lgamma (x) {#lgammax} - -El logaritmo de la función gamma. - -## ¿Qué puedes encontrar en Neodigit) {#tgammax} - -Función gamma. - -## sin(x) {#sinx} - -Sinusoidal. - -## cos(x) {#cosx} - -El coseno. - -## pantalla) {#tanx} - -Tangente. - -## (x) {#asinx} - -El arco sinusoidal. - -## Acerca de) {#acosx} - -El arco coseno. - -## atan (x) {#atanx} - -La tangente del arco. - -## pow(x, y), potencia(x, y) {#powx-y-powerx-y} - -Toma dos argumentos numéricos x e y. Devuelve un número Float64 cercano a x a la potencia de y. - -## IntExp2 {#intexp2} - -Acepta un argumento numérico y devuelve un número UInt64 cercano a 2 a la potencia de x. - -## IntExp10 {#intexp10} - -Acepta un argumento numérico y devuelve un número UInt64 cercano a 10 a la potencia de x. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/es/sql_reference/functions/other_functions.md b/docs/es/sql_reference/functions/other_functions.md deleted file mode 100644 index abd97f28c9d..00000000000 --- a/docs/es/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,1079 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 66 -toc_title: Otro ---- - -# Otras funciones {#other-functions} - -## nombre de host() {#hostname} - -Devuelve una cadena con el nombre del host en el que se realizó esta función. Para el procesamiento distribuido, este es el nombre del host del servidor remoto, si la función se realiza en un servidor remoto. - -## FQDN {#fqdn} - -Devuelve el nombre de dominio completo. - -**Sintaxis** - -``` sql -fqdn(); -``` - -Esta función no distingue entre mayúsculas y minúsculas. - -**Valor devuelto** - -- Cadena con el nombre de dominio completo. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT FQDN(); -``` - -Resultado: - -``` text -┌─FQDN()──────────────────────────┐ -│ clickhouse.ru-central1.internal │ -└─────────────────────────────────┘ -``` - -## Nombre básico {#basename} - -Extrae la parte final de una cadena después de la última barra o barra invertida. Esta función se utiliza a menudo para extraer el nombre de archivo de una ruta. - -``` sql -basename( expr ) -``` - -**Parámetros** - -- `expr` — Expression resulting in a [Cadena](../../sql_reference/data_types/string.md) valor de tipo. Todas las barras diagonales inversas deben escaparse en el valor resultante. - -**Valor devuelto** - -Una cadena que contiene: - -- La parte final de una cadena después de la última barra o barra invertida. - - If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. - -- La cadena original si no hay barras diagonales o barras diagonales inversas. - -**Ejemplo** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## Ancho visible (x) {#visiblewidthx} - -Calcula el ancho aproximado al enviar valores a la consola en formato de texto (separado por tabuladores). -Esta función es utilizada por el sistema para implementar formatos Pretty. - -`NULL` se representa como una cadena correspondiente a `NULL` en `Pretty` formato. - -``` sql -SELECT visibleWidth(NULL) -``` - -``` text -┌─visibleWidth(NULL)─┐ -│ 4 │ -└────────────────────┘ -``` - -## ¿Cómo puedo hacerlo?) {#totypenamex} - -Devuelve una cadena que contiene el nombre de tipo del argumento pasado. - -Si `NULL` se pasa a la función como entrada, luego devuelve el `Nullable(Nothing)` tipo, que corresponde a un tipo interno `NULL` representación en ClickHouse. - -## BlockSize() {#function-blocksize} - -Obtiene el tamaño del bloque. -En ClickHouse, las consultas siempre se ejecutan en bloques (conjuntos de partes de columna). Esta función permite obtener el tamaño del bloque al que lo llamó. - -## materializar (x) {#materializex} - -Convierte una constante en una columna completa que contiene solo un valor. -En ClickHouse, las columnas completas y las constantes se representan de manera diferente en la memoria. Las funciones funcionan de manera diferente para argumentos constantes y argumentos normales (se ejecuta un código diferente), aunque el resultado es casi siempre el mismo. Esta función es para depurar este comportamiento. - -## ignore(…) {#ignore} - -Acepta cualquier argumento, incluyendo `NULL`. Siempre devuelve 0. -Sin embargo, el argumento aún se evalúa. Esto se puede usar para puntos de referencia. - -## sueño (segundos) {#sleepseconds} - -Dormir ‘seconds’ segundos en cada bloque de datos. Puede especificar un número entero o un número de punto flotante. - -## sleepEachRow(segundos) {#sleepeachrowseconds} - -Dormir ‘seconds’ segundos en cada fila. Puede especificar un número entero o un número de punto flotante. - -## currentDatabase() {#currentdatabase} - -Devuelve el nombre de la base de datos actual. -Puede utilizar esta función en los parámetros del motor de tablas en una consulta CREATE TABLE donde debe especificar la base de datos. - -## currentUser() {#other-function-currentuser} - -Devuelve el inicio de sesión del usuario actual. El inicio de sesión del usuario, que inició la consulta, se devolverá en caso de consulta distibuted. - -``` sql -SELECT currentUser(); -``` - -Apodo: `user()`, `USER()`. - -**Valores devueltos** - -- Inicio de sesión del usuario actual. -- Inicio de sesión del usuario que inició la consulta en caso de consulta distribuida. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT currentUser(); -``` - -Resultado: - -``` text -┌─currentUser()─┐ -│ default │ -└───────────────┘ -``` - -## isFinite(x) {#isfinitex} - -Acepta Float32 y Float64 y devuelve UInt8 igual a 1 si el argumento no es infinito y no es un NaN, de lo contrario 0. - -## IsInfinite(x) {#isinfinitex} - -Acepta Float32 y Float64 y devuelve UInt8 igual a 1 si el argumento es infinito, de lo contrario 0. Tenga en cuenta que se devuelve 0 para un NaN. - -## ifNotFinite {#ifnotfinite} - -Comprueba si el valor de punto flotante es finito. - -**Sintaxis** - - ifNotFinite(x,y) - -**Parámetros** - -- `x` — Value to be checked for infinity. Type: [Flotante\*](../../sql_reference/data_types/float.md). -- `y` — Fallback value. Type: [Flotante\*](../../sql_reference/data_types/float.md). - -**Valor devuelto** - -- `x` si `x` es finito. -- `y` si `x` no es finito. - -**Ejemplo** - -Consulta: - - SELECT 1/0 as infimum, ifNotFinite(infimum,42) - -Resultado: - - ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ - │ inf │ 42 │ - └─────────┴───────────────────────────────┘ - -Puede obtener un resultado similar usando [operador ternario](conditional_functions.md#ternary-operator): `isFinite(x) ? x : y`. - -## isNaN(x) {#isnanx} - -Acepta Float32 y Float64 y devuelve UInt8 igual a 1 si el argumento es un NaN, de lo contrario 0. - -## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -Acepta cadenas constantes: nombre de base de datos, nombre de tabla y nombre de columna. Devuelve una expresión constante UInt8 igual a 1 si hay una columna; de lo contrario, 0. Si se establece el parámetro hostname, la prueba se ejecutará en un servidor remoto. -La función produce una excepción si la tabla no existe. -Para los elementos de una estructura de datos anidada, la función comprueba la existencia de una columna. Para la propia estructura de datos anidados, la función devuelve 0. - -## Bar {#function-bar} - -Permite construir un diagrama unicode-art. - -`bar(x, min, max, width)` dibuja una banda con un ancho proporcional a `(x - min)` e igual a `width` caracteres cuando `x = max`. - -Parámetros: - -- `x` — Size to display. -- `min, max` — Integer constants. The value must fit in `Int64`. -- `width` — Constant, positive integer, can be fractional. - -La banda se dibuja con precisión a un octavo de un símbolo. - -Ejemplo: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - -``` text -┌──h─┬──────c─┬─bar────────────────┐ -│ 0 │ 292907 │ █████████▋ │ -│ 1 │ 180563 │ ██████ │ -│ 2 │ 114861 │ ███▋ │ -│ 3 │ 85069 │ ██▋ │ -│ 4 │ 68543 │ ██▎ │ -│ 5 │ 78116 │ ██▌ │ -│ 6 │ 113474 │ ███▋ │ -│ 7 │ 170678 │ █████▋ │ -│ 8 │ 278380 │ █████████▎ │ -│ 9 │ 391053 │ █████████████ │ -│ 10 │ 457681 │ ███████████████▎ │ -│ 11 │ 493667 │ ████████████████▍ │ -│ 12 │ 509641 │ ████████████████▊ │ -│ 13 │ 522947 │ █████████████████▍ │ -│ 14 │ 539954 │ █████████████████▊ │ -│ 15 │ 528460 │ █████████████████▌ │ -│ 16 │ 539201 │ █████████████████▊ │ -│ 17 │ 523539 │ █████████████████▍ │ -│ 18 │ 506467 │ ████████████████▊ │ -│ 19 │ 520915 │ █████████████████▎ │ -│ 20 │ 521665 │ █████████████████▍ │ -│ 21 │ 542078 │ ██████████████████ │ -│ 22 │ 493642 │ ████████████████▍ │ -│ 23 │ 400397 │ █████████████▎ │ -└────┴────────┴────────────────────┘ -``` - -## transformar {#transform} - -Transforma un valor de acuerdo con la asignación explícitamente definida de algunos elementos a otros. -Hay dos variaciones de esta función: - -### ¿Cómo puedo hacerlo?) {#transformx-array-from-array-to-default} - -`x` – What to transform. - -`array_from` – Constant array of values for converting. - -`array_to` – Constant array of values to convert the values in ‘from’ a. - -`default` – Which value to use if ‘x’ no es igual a ninguno de los valores en ‘from’. - -`array_from` y `array_to` – Arrays of the same size. - -Tipo: - -`transform(T, Array(T), Array(U), U) -> U` - -`T` y `U` pueden ser tipos numéricos, de cadena o de fecha o de fecha y hora. -Cuando se indica la misma letra (T o U), para los tipos numéricos pueden no ser tipos coincidentes, sino tipos que tienen un tipo común. -Por ejemplo, el primer argumento puede tener el tipo Int64, mientras que el segundo tiene el tipo Array(UInt16). - -Si el ‘x’ valor es igual a uno de los elementos en el ‘array\_from’ matriz, devuelve el elemento existente (que está numerado igual) de la ‘array\_to’ matriz. De lo contrario, devuelve ‘default’. Si hay varios elementos coincidentes en ‘array\_from’, devuelve una de las coincidencias. - -Ejemplo: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - -``` text -┌─title─────┬──────c─┐ -│ Yandex │ 498635 │ -│ Google │ 229872 │ -│ Other │ 104472 │ -└───────────┴────────┘ -``` - -### ¿Cómo puedo hacerlo?) {#transformx-array-from-array-to} - -Difiere de la primera variación en que el ‘default’ se omite el argumento. -Si el ‘x’ valor es igual a uno de los elementos en el ‘array\_from’ matriz, devuelve el elemento coincidente (que está numerado igual) de la ‘array\_to’ matriz. De lo contrario, devuelve ‘x’. - -Tipo: - -`transform(T, Array(T), Array(T)) -> T` - -Ejemplo: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -┌─s──────────────┬───────c─┐ -│ │ 2906259 │ -│ www.yandex │ 867767 │ -│ ███████.ru │ 313599 │ -│ mail.yandex.ru │ 107147 │ -│ ██████.ru │ 100355 │ -│ █████████.ru │ 65040 │ -│ news.yandex.ru │ 64515 │ -│ ██████.net │ 59141 │ -│ example.com │ 57316 │ -└────────────────┴─────────┘ -``` - -## Tamaño de formatoReadable (x) {#formatreadablesizex} - -Acepta el tamaño (número de bytes). Devuelve un tamaño redondeado con un sufijo (KiB, MiB, etc.) como una cadena. - -Ejemplo: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - -``` text -┌─filesize_bytes─┬─filesize───┐ -│ 1 │ 1.00 B │ -│ 1024 │ 1.00 KiB │ -│ 1048576 │ 1.00 MiB │ -│ 192851925 │ 183.92 MiB │ -└────────────────┴────────────┘ -``` - -## menos (a, b) {#leasta-b} - -Devuelve el valor más pequeño de a y b. - -## mayor(a, b) {#greatesta-b} - -Devuelve el valor más grande de a y b. - -## operatividad() {#uptime} - -Devuelve el tiempo de actividad del servidor en segundos. - -## versión() {#version} - -Devuelve la versión del servidor como una cadena. - -## Zona horaria() {#timezone} - -Devuelve la zona horaria del servidor. - -## blockNumber {#blocknumber} - -Devuelve el número de secuencia del bloque de datos donde se encuentra la fila. - -## rowNumberInBlock {#function-rownumberinblock} - -Devuelve el número ordinal de la fila en el bloque de datos. Los diferentes bloques de datos siempre se recalculan. - -## rowNumberInAllBlocks() {#rownumberinallblocks} - -Devuelve el número ordinal de la fila en el bloque de datos. Esta función solo considera los bloques de datos afectados. - -## vecino {#neighbor} - -La función de ventana que proporciona acceso a una fila en un desplazamiento especificado que viene antes o después de la fila actual de una columna determinada. - -**Sintaxis** - -``` sql -neighbor(column, offset[, default_value]) -``` - -El resultado de la función depende de los bloques de datos afectados y del orden de los datos en el bloque. -Si realiza una subconsulta con ORDER BY y llama a la función desde fuera de la subconsulta, puede obtener el resultado esperado. - -**Parámetros** - -- `column` — A column name or scalar expression. -- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql_reference/data_types/int_uint.md). -- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. - -**Valores devueltos** - -- Valor para `column` en `offset` distancia de la fila actual si `offset` valor no está fuera de los límites del bloque. -- Valor predeterminado para `column` si `offset` valor está fuera de los límites del bloque. Si `default_value` se da, entonces será utilizado. - -Tipo: tipo de bloques de datos afectados o tipo de valor predeterminado. - -**Ejemplo** - -Consulta: - -``` sql -SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; -``` - -Resultado: - -``` text -┌─number─┬─neighbor(number, 2)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 0 │ -│ 9 │ 0 │ -└────────┴─────────────────────┘ -``` - -Consulta: - -``` sql -SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; -``` - -Resultado: - -``` text -┌─number─┬─neighbor(number, 2, 999)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 999 │ -│ 9 │ 999 │ -└────────┴──────────────────────────┘ -``` - -Esta función se puede utilizar para calcular el valor métrico interanual: - -Consulta: - -``` sql -WITH toDate('2018-01-01') AS start_date -SELECT - toStartOfMonth(start_date + (number * 32)) AS month, - toInt32(month) % 100 AS money, - neighbor(money, -12) AS prev_year, - round(prev_year / money, 2) AS year_over_year -FROM numbers(16) -``` - -Resultado: - -``` text -┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ -│ 2018-01-01 │ 32 │ 0 │ 0 │ -│ 2018-02-01 │ 63 │ 0 │ 0 │ -│ 2018-03-01 │ 91 │ 0 │ 0 │ -│ 2018-04-01 │ 22 │ 0 │ 0 │ -│ 2018-05-01 │ 52 │ 0 │ 0 │ -│ 2018-06-01 │ 83 │ 0 │ 0 │ -│ 2018-07-01 │ 13 │ 0 │ 0 │ -│ 2018-08-01 │ 44 │ 0 │ 0 │ -│ 2018-09-01 │ 75 │ 0 │ 0 │ -│ 2018-10-01 │ 5 │ 0 │ 0 │ -│ 2018-11-01 │ 36 │ 0 │ 0 │ -│ 2018-12-01 │ 66 │ 0 │ 0 │ -│ 2019-01-01 │ 97 │ 32 │ 0.33 │ -│ 2019-02-01 │ 28 │ 63 │ 2.25 │ -│ 2019-03-01 │ 56 │ 91 │ 1.62 │ -│ 2019-04-01 │ 87 │ 22 │ 0.25 │ -└────────────┴───────┴───────────┴────────────────┘ -``` - -## EjecuciónDiferencia (x) {#other_functions-runningdifference} - -Calculates the difference between successive row values ​​in the data block. -Devuelve 0 para la primera fila y la diferencia con respecto a la fila anterior para cada fila subsiguiente. - -El resultado de la función depende de los bloques de datos afectados y del orden de los datos en el bloque. -Si realiza una subconsulta con ORDER BY y llama a la función desde fuera de la subconsulta, puede obtener el resultado esperado. - -Ejemplo: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - -``` text -┌─EventID─┬───────────EventTime─┬─delta─┐ -│ 1106 │ 2016-11-24 00:00:04 │ 0 │ -│ 1107 │ 2016-11-24 00:00:05 │ 1 │ -│ 1108 │ 2016-11-24 00:00:05 │ 0 │ -│ 1109 │ 2016-11-24 00:00:09 │ 4 │ -│ 1110 │ 2016-11-24 00:00:10 │ 1 │ -└─────────┴─────────────────────┴───────┘ -``` - -Tenga en cuenta que el tamaño del bloque afecta el resultado. Con cada nuevo bloque, el `runningDifference` estado de reset. - -``` sql -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -┌─number─┬─diff─┐ -│ 65536 │ 0 │ -└────────┴──────┘ -``` - -``` sql -set max_block_size=100000 -- default value is 65536! - -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -``` - -## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} - -Lo mismo que para [runningDifference](./other_functions.md#other_functions-runningdifference), la diferencia es el valor de la primera fila, devolvió el valor de la primera fila, y cada fila subsiguiente devuelve la diferencia de la fila anterior. - -## ¿cómo puedo hacerlo?) {#macnumtostringnum} - -Acepta un número UInt64. Lo interpreta como una dirección MAC en big endian. Devuelve una cadena que contiene la dirección MAC correspondiente con el formato AA:BB:CC:DD:EE:FF (números separados por dos puntos en forma hexadecimal). - -## Sistema abierto.) {#macstringtonums} - -La función inversa de MACNumToString. Si la dirección MAC tiene un formato no válido, devuelve 0. - -## Sistema abierto.) {#macstringtoouis} - -Acepta una dirección MAC con el formato AA:BB:CC:DD:EE:FF (números separados por dos puntos en forma hexadecimal). Devuelve los primeros tres octetos como un número UInt64. Si la dirección MAC tiene un formato no válido, devuelve 0. - -## getSizeOfEnumType {#getsizeofenumtype} - -Devuelve el número de campos en [Enum](../../sql_reference/data_types/enum.md). - -``` sql -getSizeOfEnumType(value) -``` - -**Parámetros:** - -- `value` — Value of type `Enum`. - -**Valores devueltos** - -- El número de campos con `Enum` valores de entrada. -- Se produce una excepción si el tipo no es `Enum`. - -**Ejemplo** - -``` sql -SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## BlockSerializedSize {#blockserializedsize} - -Devuelve el tamaño en el disco (sin tener en cuenta la compresión). - -``` sql -blockSerializedSize(value[, value[, ...]]) -``` - -**Parámetros:** - -- `value` — Any value. - -**Valores devueltos** - -- El número de bytes que se escribirán en el disco para el bloque de valores (sin compresión). - -**Ejemplo** - -``` sql -SELECT blockSerializedSize(maxState(1)) as x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## ToColumnTypeName {#tocolumntypename} - -Devuelve el nombre de la clase que representa el tipo de datos de la columna en la RAM. - -``` sql -toColumnTypeName(value) -``` - -**Parámetros:** - -- `value` — Any type of value. - -**Valores devueltos** - -- Una cadena con el nombre de la clase que se utiliza para representar la `value` tipo de datos en la memoria RAM. - -**Ejemplo de la diferencia entre`toTypeName ' and ' toColumnTypeName`** - -``` sql -SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime │ -└─────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ Const(UInt32) │ -└───────────────────────────────────────────────────────────┘ -``` - -El ejemplo muestra que el `DateTime` tipo de datos se almacena en la memoria como `Const(UInt32)`. - -## dumpColumnStructure {#dumpcolumnstructure} - -Produce una descripción detallada de las estructuras de datos en la memoria RAM - -``` sql -dumpColumnStructure(value) -``` - -**Parámetros:** - -- `value` — Any type of value. - -**Valores devueltos** - -- Una cadena que describe la estructura que se utiliza para representar el `value` tipo de datos en la memoria RAM. - -**Ejemplo** - -``` sql -SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) -``` - -``` text -┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime, Const(size = 1, UInt32(size = 1)) │ -└──────────────────────────────────────────────────────────────┘ -``` - -## defaultValueOfArgumentType {#defaultvalueofargumenttype} - -Genera el valor predeterminado para el tipo de datos. - -No incluye valores predeterminados para columnas personalizadas establecidas por el usuario. - -``` sql -defaultValueOfArgumentType(expression) -``` - -**Parámetros:** - -- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. - -**Valores devueltos** - -- `0` para los números. -- Cadena vacía para cadenas. -- `ᴺᵁᴸᴸ` para [NULL](../../sql_reference/data_types/nullable.md). - -**Ejemplo** - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ -│ 0 │ -└─────────────────────────────────────────────┘ -``` - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ -│ ᴺᵁᴸᴸ │ -└───────────────────────────────────────────────────────┘ -``` - -## replicar {#other-functions-replicate} - -Crea una matriz con un solo valor. - -Utilizado para la implementación interna de [arrayJoin](array_join.md#functions_arrayjoin). - -``` sql -SELECT replicate(x, arr); -``` - -**Parámetros:** - -- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. -- `x` — The value that the resulting array will be filled with. - -**Valor devuelto** - -Una matriz llena con el valor `x`. - -Tipo: `Array`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT replicate(1, ['a', 'b', 'c']) -``` - -Resultado: - -``` text -┌─replicate(1, ['a', 'b', 'c'])─┐ -│ [1,1,1] │ -└───────────────────────────────┘ -``` - -## Sistema de archivosDisponible {#filesystemavailable} - -Devuelve la cantidad de espacio restante en el sistema de archivos donde se encuentran los archivos de las bases de datos. Siempre es más pequeño que el espacio libre total ([Sistema de archivosLibre](#filesystemfree)) porque algo de espacio está reservado para el sistema operativo. - -**Sintaxis** - -``` sql -filesystemAvailable() -``` - -**Valor devuelto** - -- La cantidad de espacio restante disponible en bytes. - -Tipo: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; -``` - -Resultado: - -``` text -┌─Available space─┬─Type───┐ -│ 30.75 GiB │ UInt64 │ -└─────────────────┴────────┘ -``` - -## Sistema de archivosLibre {#filesystemfree} - -Devuelve la cantidad total del espacio libre en el sistema de archivos donde se encuentran los archivos de las bases de datos. Ver también `filesystemAvailable` - -**Sintaxis** - -``` sql -filesystemFree() -``` - -**Valor devuelto** - -- Cantidad de espacio libre en bytes. - -Tipo: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; -``` - -Resultado: - -``` text -┌─Free space─┬─Type───┐ -│ 32.39 GiB │ UInt64 │ -└────────────┴────────┘ -``` - -## sistema de archivosCapacidad {#filesystemcapacity} - -Devuelve la capacidad del sistema de archivos en bytes. Para la evaluación, el [camino](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) al directorio de datos debe estar configurado. - -**Sintaxis** - -``` sql -filesystemCapacity() -``` - -**Valor devuelto** - -- Información de capacidad del sistema de archivos en bytes. - -Tipo: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Ejemplo** - -Consulta: - -``` sql -SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" -``` - -Resultado: - -``` text -┌─Capacity──┬─Type───┐ -│ 39.32 GiB │ UInt64 │ -└───────────┴────────┘ -``` - -## finalizeAggregation {#function-finalizeaggregation} - -Toma el estado de la función agregada. Devuelve el resultado de la agregación (estado finalizado). - -## runningAccumulate {#function-runningaccumulate} - -Toma los estados de la función agregada y devuelve una columna con valores, son el resultado de la acumulación de estos estados para un conjunto de líneas de bloque, desde la primera hasta la línea actual. -Por ejemplo, toma el estado de la función agregada (ejemplo runningAccumulate(uniqState(UserID)) ), y para cada fila de bloque, devuelve el resultado de la función agregada en la fusión de estados de todas las filas anteriores y la fila actual. -Por lo tanto, el resultado de la función depende de la partición de los datos en los bloques y del orden de los datos en el bloque. - -## joinGet {#joinget} - -La función le permite extraer datos de la tabla de la misma manera que [diccionario](../../sql_reference/dictionaries/index.md). - -Obtiene datos de [Unir](../../engines/table_engines/special/join.md#creating-a-table) usando la clave de unión especificada. - -Solo admite tablas creadas con `ENGINE = Join(ANY, LEFT, )` instrucción. - -**Sintaxis** - -``` sql -joinGet(join_storage_table_name, `value_column`, join_keys) -``` - -**Parámetros** - -- `join_storage_table_name` — an [identificador](../syntax.md#syntax-identifiers) indica dónde se realiza la búsqueda. El identificador se busca en la base de datos predeterminada (ver parámetro `default_database` en el archivo de configuración). Para reemplazar la base de datos predeterminada, utilice `USE db_name` o especifique la base de datos y la tabla a través del separador `db_name.db_table`, ver el ejemplo. -- `value_column` — name of the column of the table that contains required data. -- `join_keys` — list of keys. - -**Valor devuelto** - -Devuelve la lista de valores correspondientes a la lista de claves. - -Si cierto no existe en la tabla fuente, entonces `0` o `null` será devuelto basado en [Sistema abierto.](../../operations/settings/settings.md#join_use_nulls) configuración. - -Más información sobre `join_use_nulls` en [Únase a la operación](../../engines/table_engines/special/join.md). - -**Ejemplo** - -Tabla de entrada: - -``` sql -CREATE DATABASE db_test -CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 -INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) -``` - -``` text -┌─id─┬─val─┐ -│ 4 │ 13 │ -│ 2 │ 12 │ -│ 1 │ 11 │ -└────┴─────┘ -``` - -Consulta: - -``` sql -SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 -``` - -Resultado: - -``` text -┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ -│ 0 │ -│ 11 │ -│ 12 │ -│ 0 │ -└──────────────────────────────────────────────────┘ -``` - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -Evaluar modelo externo. -Acepta un nombre de modelo y argumentos de modelo. Devuelve Float64. - -## ¿Cómo puedo hacerlo?\]) {#throwifx-custom-message} - -Lance una excepción si el argumento no es cero. -custom\_message - es un parámetro opcional: una cadena constante, proporciona un mensaje de error - -``` sql -SELECT throwIf(number = 3, 'Too many') FROM numbers(10); -``` - -``` text -↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): -Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. -``` - -## identidad {#identity} - -Devuelve el mismo valor que se usó como argumento. Se utiliza para la depuración y pruebas, permite cancelar el uso de índice, y obtener el rendimiento de la consulta de un análisis completo. Cuando se analiza la consulta para el posible uso del índice, el analizador no mira dentro `identity` función. - -**Sintaxis** - -``` sql -identity(x) -``` - -**Ejemplo** - -Consulta: - -``` sql -SELECT identity(42) -``` - -Resultado: - -``` text -┌─identity(42)─┐ -│ 42 │ -└──────────────┘ -``` - -## randomPrintableASCII {#randomascii} - -Genera una cadena con un conjunto aleatorio de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caracteres imprimibles. - -**Sintaxis** - -``` sql -randomPrintableASCII(length) -``` - -**Parámetros** - -- `length` — Resulting string length. Positive integer. - - If you pass `length < 0`, behavior of the function is undefined. - -**Valor devuelto** - -- Cadena con un conjunto aleatorio de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caracteres imprimibles. - -Tipo: [Cadena](../../sql_reference/data_types/string.md) - -**Ejemplo** - -``` sql -SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 -``` - -``` text -┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ -│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ -│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ -│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ -└────────┴────────────────────────────────┴──────────────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/es/sql_reference/functions/random_functions.md b/docs/es/sql_reference/functions/random_functions.md deleted file mode 100644 index cb339f6692b..00000000000 --- a/docs/es/sql_reference/functions/random_functions.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 51 -toc_title: "Generaci\xF3n de n\xFAmeros pseudo-aleatorios" ---- - -# Funciones para generar números pseudoaleatorios {#functions-for-generating-pseudo-random-numbers} - -Se utilizan generadores no criptográficos de números pseudoaleatorios. - -Todas las funciones aceptan cero argumentos o un argumento. -Si se pasa un argumento, puede ser de cualquier tipo y su valor no se usa para nada. -El único propósito de este argumento es evitar la eliminación de subexpresiones comunes, de modo que dos instancias diferentes de la misma función devuelvan columnas diferentes con números aleatorios diferentes. - -## rand {#rand} - -Devuelve un número pseudoaleatorio UInt32, distribuido uniformemente entre todos los números de tipo UInt32. -Utiliza un generador congruente lineal. - -## rand64 {#rand64} - -Devuelve un número pseudoaleatorio UInt64, distribuido uniformemente entre todos los números de tipo UInt64. -Utiliza un generador congruente lineal. - -## randConstant {#randconstant} - -Devuelve un número pseudoaleatorio UInt32, El valor es uno para diferentes bloques. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/es/sql_reference/functions/rounding_functions.md b/docs/es/sql_reference/functions/rounding_functions.md deleted file mode 100644 index ea96a7b393a..00000000000 --- a/docs/es/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 45 -toc_title: Redondeo ---- - -# Funciones de redondeo {#rounding-functions} - -## piso(x\[, N\]) {#floorx-n} - -Devuelve el número de ronda más grande que es menor o igual que `x`. Un número redondo es un múltiplo de 1 / 10N, o el número más cercano del tipo de datos apropiado si 1 / 10N no es exacto. -‘N’ es una constante entera, parámetro opcional. Por defecto es cero, lo que significa redondear a un entero. -‘N’ puede ser negativo. - -Ejemplos: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x` es cualquier tipo numérico. El resultado es un número del mismo tipo. -Para argumentos enteros, tiene sentido redondear con un negativo `N` valor no negativo `N` la función no hace nada). -Si el redondeo causa desbordamiento (por ejemplo, floor(-128, -1)), se devuelve un resultado específico de la implementación. - -## Por ejemplo:\]) {#ceilx-n-ceilingx-n} - -Devuelve el número redondo más pequeño que es mayor o igual que `x`. En todos los demás sentidos, es lo mismo que el `floor` función (véase más arriba). - -## ¿Cómo puedo hacerlo?\]) {#truncx-n-truncatex-n} - -Devuelve el número redondo con el valor absoluto más grande que tiene un valor absoluto menor o igual que `x`‘s. In every other way, it is the same as the ’floor’ función (véase más arriba). - -## Ronda (x\[, N\]) {#rounding_functions-round} - -Redondea un valor a un número especificado de decimales. - -La función devuelve el número más cercano del orden especificado. En caso de que el número dado tenga la misma distancia que los números circundantes, la función utiliza el redondeo del banquero para los tipos de números flotantes y se redondea desde cero para los otros tipos de números. - -``` sql -round(expression [, decimal_places]) -``` - -**Parámetros:** - -- `expression` — A number to be rounded. Can be any [expresion](../syntax.md#syntax-expressions) devolviendo el numérico [tipo de datos](../../sql_reference/data_types/index.md#data_types). -- `decimal-places` — An integer value. - - Si `decimal-places > 0` luego la función redondea el valor a la derecha del punto decimal. - - Si `decimal-places < 0` luego la función redondea el valor a la izquierda del punto decimal. - - Si `decimal-places = 0` entonces la función redondea el valor a entero. En este caso, el argumento puede omitirse. - -**Valor devuelto:** - -El número redondeado del mismo tipo que el número de entrada. - -### Ejemplos {#examples} - -**Ejemplo de uso** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - -``` text -┌───x─┬─round(divide(number, 2))─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -└─────┴──────────────────────────┘ -``` - -**Ejemplos de redondeo** - -Redondeando al número más cercano. - -``` text -round(3.2, 0) = 3 -round(4.1267, 2) = 4.13 -round(22,-1) = 20 -round(467,-2) = 500 -round(-467,-2) = -500 -``` - -Redondeo del banquero. - -``` text -round(3.5) = 4 -round(4.5) = 4 -round(3.55, 1) = 3.6 -round(3.65, 1) = 3.6 -``` - -**Ver también** - -- [roundBankers](#roundbankers) - -## roundBankers {#roundbankers} - -Redondea un número a una posición decimal especificada. - -- Si el número de redondeo está a medio camino entre dos números, la función utiliza el redondeo del banquero. - - Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. - - It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. - -- En otros casos, la función redondea los números al entero más cercano. - -Usando el redondeo del banquero, puede reducir el efecto que tiene el redondeo de números en los resultados de sumar o restar estos números. - -Por ejemplo, suma números 1.5, 2.5, 3.5, 4.5 con redondeo diferente: - -- Sin redondeo: 1.5 + 2.5 + 3.5 + 4.5 = 12. -- Redondeo del banquero: 2 + 2 + 4 + 4 = 12. -- Redondeando al entero más cercano: 2 + 3 + 4 + 5 = 14. - -**Sintaxis** - -``` sql -roundBankers(expression [, decimal_places]) -``` - -**Parámetros** - -- `expression` — A number to be rounded. Can be any [expresion](../syntax.md#syntax-expressions) devolviendo el numérico [tipo de datos](../../sql_reference/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`. - - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. - -**Valor devuelto** - -Un valor redondeado por el método de redondeo del banquero. - -### Ejemplos {#examples-1} - -**Ejemplo de uso** - -Consulta: - -``` sql - SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 -``` - -Resultado: - -``` text -┌───x─┬─b─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -│ 1.5 │ 2 │ -│ 2 │ 2 │ -│ 2.5 │ 2 │ -│ 3 │ 3 │ -│ 3.5 │ 4 │ -│ 4 │ 4 │ -│ 4.5 │ 4 │ -└─────┴───┘ -``` - -**Ejemplos de redondeo de Banker** - -``` text -roundBankers(0.4) = 0 -roundBankers(-3.5) = -4 -roundBankers(4.5) = 4 -roundBankers(3.55, 1) = 3.6 -roundBankers(3.65, 1) = 3.6 -roundBankers(10.35, 1) = 10.4 -roundBankers(10.755, 2) = 11,76 -``` - -**Ver también** - -- [ronda](#rounding_functions-round) - -## ¿Cómo puedo hacerlo?) {#roundtoexp2num} - -Acepta un número. Si el número es menor que uno, devuelve 0. De lo contrario, redondea el número al grado más cercano (todo no negativo) de dos. - -## RondaDuración(num) {#rounddurationnum} - -Acepta un número. Si el número es menor que uno, devuelve 0. De lo contrario, redondea el número a números del conjunto: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Esta función es específica de Yandex.Métrica y se utiliza para aplicar el informe sobre la duración del período de sesiones. - -## RondaEdad(num) {#roundagenum} - -Acepta un número. Si el número es menor que 18, devuelve 0. De lo contrario, redondea el número a un número del conjunto: 18, 25, 35, 45, 55. Esta función es específica de Yandex.Métrica y se utiliza para la aplicación del informe sobre la edad del usuario. - -## ¿Cómo puedo hacerlo?) {#rounddownnum-arr} - -Acepta un número y lo redondea a un elemento en la matriz especificada. Si el valor es menor que el límite más bajo, se devuelve el límite más bajo. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/es/sql_reference/functions/splitting_merging_functions.md b/docs/es/sql_reference/functions/splitting_merging_functions.md deleted file mode 100644 index 62683f72158..00000000000 --- a/docs/es/sql_reference/functions/splitting_merging_functions.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 47 -toc_title: "Divisi\xF3n y fusi\xF3n de cuerdas y matrices" ---- - -# Funciones para dividir y fusionar cadenas y matrices {#functions-for-splitting-and-merging-strings-and-arrays} - -## Por ejemplo:) {#splitbycharseparator-s} - -Divide una cadena en subcadenas separadas por un carácter especificado. Utiliza una cadena constante `separator` que consiste en exactamente un carácter. -Devuelve una matriz de subcadenas seleccionadas. Se pueden seleccionar subcadenas vacías si el separador aparece al principio o al final de la cadena, o si hay varios separadores consecutivos. - -**Sintaxis** - -``` sql -splitByChar(, ) -``` - -**Parámetros** - -- `separator` — The separator which should contain exactly one character. [Cadena](../../sql_reference/data_types/string.md). -- `s` — The string to split. [Cadena](../../sql_reference/data_types/string.md). - -**Valores devueltos)** - -Devuelve una matriz de subcadenas seleccionadas. Las subcadenas vacías se pueden seleccionar cuando: - -- Se produce un separador al principio o al final de la cadena; -- Hay varios separadores consecutivos; -- La cadena original `s` está vacío. - -Tipo: [Matriz](../../sql_reference/data_types/array.md) de [Cadena](../../sql_reference/data_types/string.md). - -**Ejemplo** - -``` sql -SELECT splitByChar(',', '1,2,3,abcde') -``` - -``` text -┌─splitByChar(',', '1,2,3,abcde')─┐ -│ ['1','2','3','abcde'] │ -└─────────────────────────────────┘ -``` - -## Por ejemplo:) {#splitbystringseparator-s} - -Divide una cadena en subcadenas separadas por una cadena. Utiliza una cadena constante `separator` de múltiples caracteres como separador. Si la cadena `separator` está vacío, dividirá la cadena `s` en una matriz de caracteres individuales. - -**Sintaxis** - -``` sql -splitByString(, ) -``` - -**Parámetros** - -- `separator` — The separator. [Cadena](../../sql_reference/data_types/string.md). -- `s` — The string to split. [Cadena](../../sql_reference/data_types/string.md). - -**Valores devueltos)** - -Devuelve una matriz de subcadenas seleccionadas. Las subcadenas vacías se pueden seleccionar cuando: - -Tipo: [Matriz](../../sql_reference/data_types/array.md) de [Cadena](../../sql_reference/data_types/string.md). - -- Se produce un separador no vacío al principio o al final de la cadena; -- Hay varios separadores consecutivos no vacíos; -- La cadena original `s` está vacío mientras el separador no está vacío. - -**Ejemplo** - -``` sql -SELECT splitByString(', ', '1, 2 3, 4,5, abcde') -``` - -``` text -┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ -│ ['1','2 3','4,5','abcde'] │ -└───────────────────────────────────────────┘ -``` - -``` sql -SELECT splitByString('', 'abcde') -``` - -``` text -┌─splitByString('', 'abcde')─┐ -│ ['a','b','c','d','e'] │ -└────────────────────────────┘ -``` - -## Por ejemplo, se puede usar una matriz.\]) {#arraystringconcatarr-separator} - -Concatena las cadenas enumeradas en la matriz con el separador.'separador' es un parámetro opcional: una constante de cadena, establece una cadena vacía por defecto. -Devuelve la cadena. - -## Sistema abierto.) {#alphatokenss} - -Selecciona subcadenas de bytes consecutivos de los rangos a-z y A-Z.Devuelve una matriz de subcadenas. - -**Ejemplo** - -``` sql -SELECT alphaTokens('abca1abc') -``` - -``` text -┌─alphaTokens('abca1abc')─┐ -│ ['abca','abc'] │ -└─────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/es/sql_reference/functions/string_functions.md b/docs/es/sql_reference/functions/string_functions.md deleted file mode 100644 index 25b02ca3bd4..00000000000 --- a/docs/es/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,489 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 40 -toc_title: Trabajar con cadenas ---- - -# Funciones para trabajar con cadenas {#functions-for-working-with-strings} - -## vaciar {#empty} - -Devuelve 1 para una cadena vacía o 0 para una cadena no vacía. -El tipo de resultado es UInt8. -Una cadena se considera no vacía si contiene al menos un byte, incluso si se trata de un espacio o un byte nulo. -La función también funciona para matrices. - -## notEmpty {#notempty} - -Devuelve 0 para una cadena vacía o 1 para una cadena no vacía. -El tipo de resultado es UInt8. -La función también funciona para matrices. - -## longitud {#length} - -Devuelve la longitud de una cadena en bytes (no en caracteres y no en puntos de código). -El tipo de resultado es UInt64. -La función también funciona para matrices. - -## longitudUTF8 {#lengthutf8} - -Devuelve la longitud de una cadena en puntos de código Unicode (no en caracteres), suponiendo que la cadena contiene un conjunto de bytes que componen texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). -El tipo de resultado es UInt64. - -## char\_length, CHAR\_LENGTH {#char-length} - -Devuelve la longitud de una cadena en puntos de código Unicode (no en caracteres), suponiendo que la cadena contiene un conjunto de bytes que componen texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). -El tipo de resultado es UInt64. - -## character\_length, CHARACTER\_LENGTH {#character-length} - -Devuelve la longitud de una cadena en puntos de código Unicode (no en caracteres), suponiendo que la cadena contiene un conjunto de bytes que componen texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). -El tipo de resultado es UInt64. - -## inferior, lcase {#lower} - -Convierte símbolos latinos ASCII en una cadena a minúsculas. - -## superior, ucase {#upper} - -Convierte los símbolos latinos ASCII en una cadena a mayúsculas. - -## Método de codificación de datos: {#lowerutf8} - -Convierte una cadena en minúsculas, suponiendo que la cadena contiene un conjunto de bytes que componen un texto codificado en UTF-8. -No detecta el idioma. Entonces, para el turco, el resultado podría no ser exactamente correcto. -Si la longitud de la secuencia de bytes UTF-8 es diferente para mayúsculas y minúsculas de un punto de código, el resultado puede ser incorrecto para este punto de código. -Si la cadena contiene un conjunto de bytes que no es UTF-8, entonces el comportamiento no está definido. - -## superiorUTF8 {#upperutf8} - -Convierte una cadena en mayúsculas, suponiendo que la cadena contiene un conjunto de bytes que componen un texto codificado en UTF-8. -No detecta el idioma. Entonces, para el turco, el resultado podría no ser exactamente correcto. -Si la longitud de la secuencia de bytes UTF-8 es diferente para mayúsculas y minúsculas de un punto de código, el resultado puede ser incorrecto para este punto de código. -Si la cadena contiene un conjunto de bytes que no es UTF-8, entonces el comportamiento no está definido. - -## Sistema abierto. {#isvalidutf8} - -Devuelve 1, si el conjunto de bytes es válido codificado en UTF-8, de lo contrario 0. - -## Acerca de Nosotros {#tovalidutf8} - -Reemplaza los caracteres UTF-8 no válidos por `�` (U+FFFD) carácter. Todos los caracteres no válidos que se ejecutan en una fila se contraen en el único carácter de reemplazo. - -``` sql -toValidUTF8( input_string ) -``` - -Parámetros: - -- input\_string — Any set of bytes represented as the [Cadena](../../sql_reference/data_types/string.md) objeto de tipo de datos. - -Valor devuelto: cadena UTF-8 válida. - -**Ejemplo** - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## repetir {#repeat} - -Repite una cadena tantas veces como se especifique y concatena los valores replicados como una única cadena. - -**Sintaxis** - -``` sql -repeat(s, n) -``` - -**Parámetros** - -- `s` — The string to repeat. [Cadena](../../sql_reference/data_types/string.md). -- `n` — The number of times to repeat the string. [UInt](../../sql_reference/data_types/int_uint.md). - -**Valor devuelto** - -La cadena única, que contiene la cadena `s` repetir `n` tiempo. Si `n` \< 1, la función devuelve cadena vacía. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT repeat('abc', 10) -``` - -Resultado: - -``` text -┌─repeat('abc', 10)──────────────┐ -│ abcabcabcabcabcabcabcabcabcabc │ -└────────────────────────────────┘ -``` - -## inverso {#reverse} - -Invierte la cadena (como una secuencia de bytes). - -## reverseUTF8 {#reverseutf8} - -Invierte una secuencia de puntos de código Unicode, suponiendo que la cadena contiene un conjunto de bytes que representan un texto UTF-8. De lo contrario, hace otra cosa (no arroja una excepción). - -## format(pattern, s0, s1, …) {#format} - -Formatear el patrón constante con la cadena enumerada en los argumentos. `pattern` es un patrón de formato de Python simplificado. La cadena de formato contiene “replacement fields” rodeado de llaves `{}`. Cualquier cosa que no esté contenida entre llaves se considera texto literal, que se copia sin cambios en la salida. Si necesita incluir un carácter de llave en el texto literal, se puede escapar duplicando: `{{ '{{' }}` y `{{ '}}' }}`. Los nombres de campo pueden ser números (comenzando desde cero) o vacíos (luego se tratan como números de consecuencia). - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') -``` - -``` text -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ -``` - -``` sql -SELECT format('{} {}', 'Hello', 'World') -``` - -``` text -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## concat {#concat} - -Concatena las cadenas enumeradas en los argumentos, sin un separador. - -**Sintaxis** - -``` sql -concat(s1, s2, ...) -``` - -**Parámetros** - -Valores de tipo String o FixedString. - -**Valores devueltos** - -Devuelve la cadena que resulta de concatenar los argumentos. - -Si alguno de los valores de argumento `NULL`, `concat` devoluciones `NULL`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT concat('Hello, ', 'World!') -``` - -Resultado: - -``` text -┌─concat('Hello, ', 'World!')─┐ -│ Hello, World! │ -└─────────────────────────────┘ -``` - -## ConcatAssumeInjective {#concatassumeinjective} - -Lo mismo que [concat](#concat), la diferencia es que usted necesita asegurar eso `concat(s1, s2, ...) → sn` es inyectivo, se utilizará para la optimización de GROUP BY. - -La función se llama “injective” si siempre devuelve un resultado diferente para diferentes valores de argumentos. En otras palabras: diferentes argumentos nunca arrojan un resultado idéntico. - -**Sintaxis** - -``` sql -concatAssumeInjective(s1, s2, ...) -``` - -**Parámetros** - -Valores de tipo String o FixedString. - -**Valores devueltos** - -Devuelve la cadena que resulta de concatenar los argumentos. - -Si alguno de los valores de argumento `NULL`, `concatAssumeInjective` devoluciones `NULL`. - -**Ejemplo** - -Tabla de entrada: - -``` sql -CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; -INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); -SELECT * from key_val; -``` - -``` text -┌─key1────┬─key2─────┬─value─┐ -│ Hello, │ World │ 1 │ -│ Hello, │ World │ 2 │ -│ Hello, │ World! │ 3 │ -│ Hello │ , World! │ 2 │ -└─────────┴──────────┴───────┘ -``` - -Consulta: - -``` sql -SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) -``` - -Resultado: - -``` text -┌─concat(key1, key2)─┬─sum(value)─┐ -│ Hello, World! │ 3 │ -│ Hello, World! │ 2 │ -│ Hello, World │ 3 │ -└────────────────────┴────────────┘ -``` - -## substring(s, desplazamiento, longitud), mid(s, desplazamiento, longitud), substr(s, desplazamiento, longitud) {#substring} - -Devuelve una subcadena que comienza con el byte ‘offset’ índice que es ‘length’ bytes de largo. La indexación de caracteres comienza desde uno (como en SQL estándar). El ‘offset’ y ‘length’ los argumentos deben ser constantes. - -## substringUTF8(s, desplazamiento, longitud) {#substringutf8} - -Lo mismo que ‘substring’, pero para puntos de código Unicode. Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado en UTF-8. Si no se cumple esta suposición, devuelve algún resultado (no arroja una excepción). - -## Aquí hay algunas opciones) {#appendtrailingcharifabsent} - -Si el ‘s’ cadena no está vacía y no contiene el ‘c’ carácter al final, se añade el ‘c’ carácter hasta el final. - -## convertirCharset(s), de, a) {#convertcharset} - -Devuelve la cadena ‘s’ que se convirtió de la codificación en ‘from’ a la codificación en ‘to’. - -## Sistema abierto.) {#base64encode} - -Codificar ‘s’ cadena en base64 - -## base64Decode(s)) {#base64decode} - -Decodificar cadena codificada en base64 ‘s’ en la cadena original. En caso de fallo plantea una excepción. - -## tryBase64Decode(s) {#trybase64decode} - -Similar a base64Decode, pero en caso de error se devolverá una cadena vacía. - -## endsWith(s, sufijo) {#endswith} - -Devuelve si se debe terminar con el sufijo especificado. Devuelve 1 si la cadena termina con el sufijo especificado, de lo contrario devuelve 0. - -## startsWith(str, prefijo) {#startswith} - -Devuelve 1 si la cadena comienza con el prefijo especificado, de lo contrario devuelve 0. - -``` sql -SELECT startsWith('Spider-Man', 'Spi'); -``` - -**Valores devueltos** - -- 1, si la cadena comienza con el prefijo especificado. -- 0, si la cadena no comienza con el prefijo especificado. - -**Ejemplo** - -Consulta: - -``` sql -SELECT startsWith('Hello, world!', 'He'); -``` - -Resultado: - -``` text -┌─startsWith('Hello, world!', 'He')─┐ -│ 1 │ -└───────────────────────────────────┘ -``` - -## recortar {#trim} - -Quita todos los caracteres especificados del inicio o el final de una cadena. -De forma predeterminada, elimina todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) de ambos extremos de una cadena. - -**Sintaxis** - -``` sql -trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) -``` - -**Parámetros** - -- `trim_character` — specified characters for trim. [Cadena](../../sql_reference/data_types/string.md). -- `input_string` — string for trim. [Cadena](../../sql_reference/data_types/string.md). - -**Valor devuelto** - -Una cadena sin caracteres especificados iniciales y (o) finales. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT trim(BOTH ' ()' FROM '( Hello, world! )') -``` - -Resultado: - -``` text -┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ -│ Hello, world! │ -└───────────────────────────────────────────────┘ -``` - -## trimLeft {#trimleft} - -Quita todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) desde el principio de una cadena. No elimina otros tipos de caracteres de espacios en blanco (tab, espacio sin interrupción, etc.). - -**Sintaxis** - -``` sql -trimLeft(input_string) -``` - -Apodo: `ltrim(input_string)`. - -**Parámetros** - -- `input_string` — string to trim. [Cadena](../../sql_reference/data_types/string.md). - -**Valor devuelto** - -Una cadena sin espacios en blanco comunes iniciales. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT trimLeft(' Hello, world! ') -``` - -Resultado: - -``` text -┌─trimLeft(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## trimRight {#trimright} - -Quita todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) del final de una cadena. No elimina otros tipos de caracteres de espacios en blanco (tab, espacio sin interrupción, etc.). - -**Sintaxis** - -``` sql -trimRight(input_string) -``` - -Apodo: `rtrim(input_string)`. - -**Parámetros** - -- `input_string` — string to trim. [Cadena](../../sql_reference/data_types/string.md). - -**Valor devuelto** - -Una cadena sin espacios en blanco comunes finales. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT trimRight(' Hello, world! ') -``` - -Resultado: - -``` text -┌─trimRight(' Hello, world! ')─┐ -│ Hello, world! │ -└──────────────────────────────────────┘ -``` - -## AjusteTanto {#trimboth} - -Quita todas las apariciones consecutivas de espacios en blanco comunes (carácter ASCII 32) de ambos extremos de una cadena. No elimina otros tipos de caracteres de espacios en blanco (tab, espacio sin interrupción, etc.). - -**Sintaxis** - -``` sql -trimBoth(input_string) -``` - -Apodo: `trim(input_string)`. - -**Parámetros** - -- `input_string` — string to trim. [Cadena](../../sql_reference/data_types/string.md). - -**Valor devuelto** - -Una cadena sin espacios en blanco comunes iniciales y finales. - -Tipo: `String`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT trimBoth(' Hello, world! ') -``` - -Resultado: - -``` text -┌─trimBoth(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## CRC32(s)) {#crc32} - -Devuelve la suma de comprobación CRC32 de una cadena, utilizando el polinomio CRC-32-IEEE 802.3 y el valor inicial `0xffffffff` (implementación zlib). - -El tipo de resultado es UInt32. - -## CRC32IEEE(s) {#crc32ieee} - -Devuelve la suma de comprobación CRC32 de una cadena, utilizando el polinomio CRC-32-IEEE 802.3. - -El tipo de resultado es UInt32. - -## CRC64(s)) {#crc64} - -Devuelve la suma de comprobación CRC64 de una cadena, utilizando el polinomio CRC-64-ECMA. - -El tipo de resultado es UInt64. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/es/sql_reference/functions/string_replace_functions.md b/docs/es/sql_reference/functions/string_replace_functions.md deleted file mode 100644 index eeccfb244ec..00000000000 --- a/docs/es/sql_reference/functions/string_replace_functions.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 42 -toc_title: Para reemplazar en cadenas ---- - -# Funciones para buscar y reemplazar en cadenas {#functions-for-searching-and-replacing-in-strings} - -## replaceOne(pajar, patrón, reemplazo) {#replaceonehaystack-pattern-replacement} - -Sustituye la primera aparición, si existe, de la ‘pattern’ subcadena en ‘haystack’ con el ‘replacement’ subcadena. -Sucesivo, ‘pattern’ y ‘replacement’ deben ser constantes. - -## replaceAll (pajar, patrón, reemplazo), replace (pajar, patrón, reemplazo) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} - -Sustituye todas las apariciones del ‘pattern’ subcadena en ‘haystack’ con el ‘replacement’ subcadena. - -## replaceRegexpOne (pajar, patrón, reemplazo) {#replaceregexponehaystack-pattern-replacement} - -Reemplazo usando el ‘pattern’ expresión regular. Una expresión regular re2. -Sustituye sólo la primera ocurrencia, si existe. -Un patrón se puede especificar como ‘replacement’. Este patrón puede incluir sustituciones `\0-\9`. -Sustitución `\0` incluye toda la expresión regular. Sustitución `\1-\9` corresponden a los números de subpatrón. `\` en una plantilla, escapar de ella usando `\`. -También tenga en cuenta que un literal de cadena requiere un escape adicional. - -Ejemplo 1. Conversión de la fecha a formato americano: - -``` sql -SELECT DISTINCT - EventDate, - replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res -FROM test.hits -LIMIT 7 -FORMAT TabSeparated -``` - -``` text -2014-03-17 03/17/2014 -2014-03-18 03/18/2014 -2014-03-19 03/19/2014 -2014-03-20 03/20/2014 -2014-03-21 03/21/2014 -2014-03-22 03/22/2014 -2014-03-23 03/23/2014 -``` - -Ejemplo 2. Copiar una cadena diez veces: - -``` sql -SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res -``` - -``` text -┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## replaceRegexpAll (pajar, patrón, reemplazo) {#replaceregexpallhaystack-pattern-replacement} - -Esto hace lo mismo, pero reemplaza todas las ocurrencias. Ejemplo: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res -``` - -``` text -┌─res────────────────────────┐ -│ HHeelllloo,, WWoorrlldd!! │ -└────────────────────────────┘ -``` - -Como excepción, si una expresión regular funcionó en una subcadena vacía, el reemplazo no se realiza más de una vez. -Ejemplo: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res -``` - -``` text -┌─res─────────────────┐ -│ here: Hello, World! │ -└─────────────────────┘ -``` - -## Sistema abierto.) {#regexpquotemetas} - -La función agrega una barra invertida antes de algunos caracteres predefinidos en la cadena. -Caracteres predefinidos: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, '\]', ‘?’, '\*‘,’+‘,’{‘,’:‘,’-'. -Esta implementación difiere ligeramente de re2::RE2::QuoteMeta. Escapa de byte cero como \\0 en lugar de 00 y escapa solo de los caracteres requeridos. -Para obtener más información, consulte el enlace: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/es/sql_reference/functions/string_search_functions.md b/docs/es/sql_reference/functions/string_search_functions.md deleted file mode 100644 index 060b325d48d..00000000000 --- a/docs/es/sql_reference/functions/string_search_functions.md +++ /dev/null @@ -1,379 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 41 -toc_title: Para buscar cadenas ---- - -# Funciones para buscar cadenas {#functions-for-searching-strings} - -La búsqueda distingue entre mayúsculas y minúsculas de forma predeterminada en todas estas funciones. Hay variantes separadas para la búsqueda insensible a mayúsculas y minúsculas. - -## posición (pajar, aguja), localizar (pajar, aguja) {#position} - -Devuelve la posición (en bytes) de la subcadena encontrada en la cadena, comenzando desde 1. - -Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado de un solo byte. Si no se cumple esta suposición y un carácter no se puede representar usando un solo byte, la función no lanza una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos bytes, usará dos bytes y así sucesivamente. - -Para una búsqueda sin distinción de mayúsculas y minúsculas, utilice la función [positionCaseInsensitive](#positioncaseinsensitive). - -**Sintaxis** - -``` sql -position(haystack, needle) -``` - -Apodo: `locate(haystack, needle)`. - -**Parámetros** - -- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). - -**Valores devueltos** - -- Posición inicial en bytes (contando desde 1), si se encontró subcadena. -- 0, si no se encontró la subcadena. - -Tipo: `Integer`. - -**Ejemplos** - -Frase “Hello, world!” contiene un conjunto de bytes que representan un texto codificado de un solo byte. La función devuelve algún resultado esperado: - -Consulta: - -``` sql -SELECT position('Hello, world!', '!') -``` - -Resultado: - -``` text -┌─position('Hello, world!', '!')─┐ -│ 13 │ -└────────────────────────────────┘ -``` - -La misma frase en ruso contiene caracteres que no se pueden representar usando un solo byte. La función devuelve algún resultado inesperado (uso [PosiciónUTF8](#positionutf8) función para texto codificado de varios bytes): - -Consulta: - -``` sql -SELECT position('Привет, мир!', '!') -``` - -Resultado: - -``` text -┌─position('Привет, мир!', '!')─┐ -│ 21 │ -└───────────────────────────────┘ -``` - -## positionCaseInsensitive {#positioncaseinsensitive} - -Lo mismo que [posición](#position) devuelve la posición (en bytes) de la subcadena encontrada en la cadena, comenzando desde 1. Utilice la función para una búsqueda que no distingue entre mayúsculas y minúsculas. - -Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado de un solo byte. Si no se cumple esta suposición y un carácter no se puede representar usando un solo byte, la función no lanza una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos bytes, usará dos bytes y así sucesivamente. - -**Sintaxis** - -``` sql -positionCaseInsensitive(haystack, needle) -``` - -**Parámetros** - -- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). - -**Valores devueltos** - -- Posición inicial en bytes (contando desde 1), si se encontró subcadena. -- 0, si no se encontró la subcadena. - -Tipo: `Integer`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT positionCaseInsensitive('Hello, world!', 'hello') -``` - -Resultado: - -``` text -┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ -│ 1 │ -└───────────────────────────────────────────────────┘ -``` - -## PosiciónUTF8 {#positionutf8} - -Devuelve la posición (en puntos Unicode) de la subcadena encontrada en la cadena, comenzando desde 1. - -Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado en UTF-8. Si no se cumple esta suposición, la función no produce una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos puntos Unicode, usará dos y así sucesivamente. - -Para una búsqueda sin distinción de mayúsculas y minúsculas, utilice la función [PosiciónCasoInsensitiveUTF8](#positioncaseinsensitiveutf8). - -**Sintaxis** - -``` sql -positionUTF8(haystack, needle) -``` - -**Parámetros** - -- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). - -**Valores devueltos** - -- Posición inicial en puntos Unicode (contando desde 1), si se encontró subcadena. -- 0, si no se encontró la subcadena. - -Tipo: `Integer`. - -**Ejemplos** - -Frase “Hello, world!” en ruso contiene un conjunto de puntos Unicode que representan un texto codificado de un solo punto. La función devuelve algún resultado esperado: - -Consulta: - -``` sql -SELECT positionUTF8('Привет, мир!', '!') -``` - -Resultado: - -``` text -┌─positionUTF8('Привет, мир!', '!')─┐ -│ 12 │ -└───────────────────────────────────┘ -``` - -Frase “Salut, étudiante!”, donde el carácter `é` puede ser representado usando un un punto (`U+00E9`) o dos puntos (`U+0065U+0301`) la función se puede devolver algún resultado inesperado: - -Consulta de la carta `é`, que se representa un punto Unicode `U+00E9`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Resultado: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 17 │ -└────────────────────────────────────────┘ -``` - -Consulta de la carta `é`, que se representa dos puntos Unicode `U+0065U+0301`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Resultado: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 18 │ -└────────────────────────────────────────┘ -``` - -## PosiciónCasoInsensitiveUTF8 {#positioncaseinsensitiveutf8} - -Lo mismo que [PosiciónUTF8](#positionutf8), pero no distingue entre mayúsculas y minúsculas. Devuelve la posición (en puntos Unicode) de la subcadena encontrada en la cadena, comenzando desde 1. - -Funciona bajo el supuesto de que la cadena contiene un conjunto de bytes que representan un texto codificado en UTF-8. Si no se cumple esta suposición, la función no produce una excepción y devuelve algún resultado inesperado. Si el carácter se puede representar usando dos puntos Unicode, usará dos y así sucesivamente. - -**Sintaxis** - -``` sql -positionCaseInsensitiveUTF8(haystack, needle) -``` - -**Parámetros** - -- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). - -**Valor devuelto** - -- Posición inicial en puntos Unicode (contando desde 1), si se encontró subcadena. -- 0, si no se encontró la subcadena. - -Tipo: `Integer`. - -**Ejemplo** - -Consulta: - -``` sql -SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') -``` - -Resultado: - -``` text -┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ -│ 9 │ -└────────────────────────────────────────────────────┘ -``` - -## multiSearchAllPositions {#multisearchallpositions} - -Lo mismo que [posición](string_search_functions.md#position) pero devuelve `Array` posiciones (en bytes) de las subcadenas correspondientes encontradas en la cadena. Las posiciones se indexan a partir de 1. - -La búsqueda se realiza en secuencias de bytes sin respecto a la codificación de cadenas y la intercalación. - -- Para la búsqueda ASCII sin distinción de mayúsculas y minúsculas, utilice la función `multiSearchAllPositionsCaseInsensitive`. -- Para buscar en UTF-8, use la función [MultiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). -- Para la búsqueda UTF-8 sin distinción de mayúsculas y minúsculas, utilice la función multiSearchAllPositionsCaseInsensitiveUTF8. - -**Sintaxis** - -``` sql -multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) -``` - -**Parámetros** - -- `haystack` — string, in which substring will to be searched. [Cadena](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Cadena](../syntax.md#syntax-string-literal). - -**Valores devueltos** - -- Matriz de posiciones iniciales en bytes (contando desde 1), si se encontró la subcadena correspondiente y 0 si no se encuentra. - -**Ejemplo** - -Consulta: - -``` sql -SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) -``` - -Resultado: - -``` text -┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ -│ [0,13,0] │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## MultiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} - -Ver `multiSearchAllPositions`. - -## multiSearchFirstPosition(pajar, \[aguja1, aguja2, …, needley\]) {#multisearchfirstposition} - -Lo mismo que `position` pero devuelve el desplazamiento más a la izquierda de la cadena `haystack` que se corresponde con algunas de las agujas. - -Para una búsqueda que no distingue entre mayúsculas y minúsculas o / y en formato UTF-8, use funciones `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. - -## multiSearchFirstIndex(pajar, \[aguja1, aguja2, …, needley\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} - -Devuelve el índice `i` (a partir de 1) de la aguja encontrada más a la izquierdame en la cadena `haystack` y 0 de lo contrario. - -Para una búsqueda que no distingue entre mayúsculas y minúsculas o / y en formato UTF-8, use funciones `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. - -## multiSearchAny(pajar, \[aguja1, aguja2, …, needley\]) {#function-multisearchany} - -Devuelve 1, si al menos una aguja de cuerdame coincide con la cadena `haystack` y 0 de lo contrario. - -Para una búsqueda que no distingue entre mayúsculas y minúsculas o / y en formato UTF-8, use funciones `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. - -!!! note "Nota" - En todos `multiSearch*` el número de agujas debe ser inferior a 28 debido a la especificación de implementación. - -## match (pajar, patrón) {#matchhaystack-pattern} - -Comprueba si la cadena coincide con la `pattern` expresión regular. Un `re2` expresión regular. El [sintaxis](https://github.com/google/re2/wiki/Syntax) de la `re2` expresiones regulares es más limitada que la sintaxis de las expresiones regulares de Perl. - -Devuelve 0 si no coincide, o 1 si coincide. - -Tenga en cuenta que el símbolo de barra invertida (`\`) se utiliza para escapar en la expresión regular. El mismo símbolo se usa para escapar en literales de cadena. Por lo tanto, para escapar del símbolo en una expresión regular, debe escribir dos barras invertidas (\\) en un literal de cadena. - -La expresión regular funciona con la cadena como si fuera un conjunto de bytes. La expresión regular no puede contener bytes nulos. -Para que los patrones busquen subcadenas en una cadena, es mejor usar LIKE o ‘position’, ya que trabajan mucho más rápido. - -## multiMatchAny(pajar, \[patrón1, patrón2, …, patterny\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} - -Lo mismo que `match`, pero devuelve 0 si ninguna de las expresiones regulares coincide y 1 si alguno de los patrones coincide. Se utiliza [hyperscan](https://github.com/intel/hyperscan) biblioteca. Para que los patrones busquen subcadenas en una cadena, es mejor usar `multiSearchAny` ya que funciona mucho más rápido. - -!!! note "Nota" - La longitud de cualquiera de los `haystack` cadena debe ser inferior a 232 bytes de lo contrario, se lanza la excepción. Esta restricción tiene lugar debido a la API de hiperscan. - -## multiMatchAnyIndex(pajar, \[patrón1, patrón2, …, patterny\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} - -Lo mismo que `multiMatchAny`, pero devuelve cualquier índice que coincida con el pajar. - -## ¿Cómo puedo obtener más información?1, patrón2, …, patterny\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} - -Lo mismo que `multiMatchAny`, pero devuelve la matriz de todas las indicaciones que coinciden con el pajar en cualquier orden. - -## multiFuzzyMatchAny(pajar, distancia, \[patrón1, patrón2, …, patterny\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} - -Lo mismo que `multiMatchAny`, pero devuelve 1 si algún patrón coincide con el pajar dentro de una constante [editar distancia](https://en.wikipedia.org/wiki/Edit_distance). Esta función también está en modo experimental y puede ser extremadamente lenta. Para obtener más información, consulte [documentación de hyperscan](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). - -## multiFuzzyMatchAnyIndex(pajar, distancia, \[patrón1, patrón2, …, patterny\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} - -Lo mismo que `multiFuzzyMatchAny`, pero devuelve cualquier índice que coincida con el pajar dentro de una distancia de edición constante. - -## multiFuzzyMatchAllIndices(pajar, distancia, \[patrón1, patrón2, …, patterny\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} - -Lo mismo que `multiFuzzyMatchAny`, pero devuelve la matriz de todos los índices en cualquier orden que coincida con el pajar dentro de una distancia de edición constante. - -!!! note "Nota" - `multiFuzzyMatch*` las funciones no admiten expresiones regulares UTF-8, y dichas expresiones se tratan como bytes debido a la restricción de hiperscan. - -!!! note "Nota" - Para desactivar todas las funciones que utilizan hyperscan, utilice la configuración `SET allow_hyperscan = 0;`. - -## extracto(pajar, patrón) {#extracthaystack-pattern} - -Extrae un fragmento de una cadena utilizando una expresión regular. Si ‘haystack’ no coincide con el ‘pattern’ regex, se devuelve una cadena vacía. Si la expresión regular no contiene subpatrones, toma el fragmento que coincide con toda la expresión regular. De lo contrario, toma el fragmento que coincide con el primer subpatrón. - -## extractAll(pajar, patrón) {#extractallhaystack-pattern} - -Extrae todos los fragmentos de una cadena utilizando una expresión regular. Si ‘haystack’ no coincide con el ‘pattern’ regex, se devuelve una cadena vacía. Devuelve una matriz de cadenas que consiste en todas las coincidencias con la expresión regular. En general, el comportamiento es el mismo que el ‘extract’ función (toma el primer subpatrón, o la expresión completa si no hay un subpatrón). - -## como (pajar, patrón), operador de patrón COMO pajar {#function-like} - -Comprueba si una cadena coincide con una expresión regular simple. -La expresión regular puede contener los metasímbolos `%` y `_`. - -`%` indica cualquier cantidad de bytes (incluidos cero caracteres). - -`_` indica cualquier byte. - -Utilice la barra invertida (`\`) para escapar de metasímbolos. Vea la nota sobre el escape en la descripción del ‘match’ función. - -Para expresiones regulares como `%needle%`, el código es más óptimo y trabaja tan rápido como el `position` función. -Para otras expresiones regulares, el código es el mismo que para ‘match’ función. - -## notLike(haystack, pattern), haystack NOT LIKE operador de patrón {#function-notlike} - -Lo mismo que ‘like’ pero negativo. - -## ngramDistance(pajar, aguja) {#ngramdistancehaystack-needle} - -Calcula la distancia de 4 gramos entre `haystack` y `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` o `haystack` es más de 32Kb, arroja una excepción. Si algunos de los no constantes `haystack` o `needle` Las cadenas son más de 32Kb, la distancia es siempre una. - -Para la búsqueda sin distinción de mayúsculas y minúsculas o / y en formato UTF-8, use funciones `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. - -## ngramSearch(pajar, aguja) {#ngramsearchhaystack-needle} - -Lo mismo que `ngramDistance` pero calcula la diferencia no simétrica entre `needle` y `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` n-gramas. Cuanto más cerca de uno, más probable es `needle` está en el `haystack`. Puede ser útil para la búsqueda de cadenas difusas. - -Para la búsqueda sin distinción de mayúsculas y minúsculas o / y en formato UTF-8, use funciones `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. - -!!! note "Nota" - For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/es/sql_reference/functions/type_conversion_functions.md b/docs/es/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index 3920e809438..00000000000 --- a/docs/es/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,534 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 38 -toc_title: "Conversi\xF3n de tipo" ---- - -# Funciones de conversión de tipos {#type-conversion-functions} - -## Problemas comunes de conversiones numéricas {#numeric-conversion-issues} - -Cuando convierte un valor de uno a otro tipo de datos, debe recordar que, en un caso común, es una operación insegura que puede provocar una pérdida de datos. Puede producirse una pérdida de datos si intenta ajustar el valor de un tipo de datos más grande a un tipo de datos más pequeño, o si convierte valores entre diferentes tipos de datos. - -ClickHouse tiene el [mismo comportamiento que los programas de C++](https://en.cppreference.com/w/cpp/language/implicit_conversion). - -## ¿Cómo puedo obtener más información?) {#toint8163264} - -Convierte un valor de entrada en el [En](../../sql_reference/data_types/int_uint.md) tipo de datos. Esta familia de funciones incluye: - -- `toInt8(expr)` — Results in the `Int8` tipo de datos. -- `toInt16(expr)` — Results in the `Int16` tipo de datos. -- `toInt32(expr)` — Results in the `Int32` tipo de datos. -- `toInt64(expr)` — Results in the `Int64` tipo de datos. - -**Parámetros** - -- `expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número o una cadena con la representación decimal de un número. No se admiten representaciones binarias, octales y hexadecimales de números. Los ceros principales son despojados. - -**Valor devuelto** - -Valor entero en el `Int8`, `Int16`, `Int32`, o `Int64` tipo de datos. - -Funciones de uso [redondeando hacia cero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), lo que significa que truncan dígitos fraccionarios de números. - -El comportamiento de las funciones [NaN y Inf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) los argumentos no están definidos. Recuerde acerca de [problemas de conversión numérica](#numeric-conversion-issues), al usar las funciones. - -**Ejemplo** - -``` sql -SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) -``` - -``` text -┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ -│ -9223372036854775808 │ 32 │ 16 │ 8 │ -└──────────────────────┴─────────────┴───────────────┴─────────────┘ -``` - -## ¿Cómo puedo obtener más información? {#toint8163264orzero} - -Toma un argumento de tipo String e intenta analizarlo en Int (8 \| 16 \| 32 \| 64). Si falla, devuelve 0. - -**Ejemplo** - -``` sql -select toInt64OrZero('123123'), toInt8OrZero('123qwe123') -``` - -``` text -┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ -│ 123123 │ 0 │ -└─────────────────────────┴───────────────────────────┘ -``` - -## ¿Cómo puedo hacerlo? {#toint8163264ornull} - -Toma un argumento de tipo String e intenta analizarlo en Int (8 \| 16 \| 32 \| 64). Si falla, devuelve NULL. - -**Ejemplo** - -``` sql -select toInt64OrNull('123123'), toInt8OrNull('123qwe123') -``` - -``` text -┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ -│ 123123 │ ᴺᵁᴸᴸ │ -└─────────────────────────┴───────────────────────────┘ -``` - -## ¿Cómo puedo obtener más información?) {#touint8163264} - -Convierte un valor de entrada en el [UInt](../../sql_reference/data_types/int_uint.md) tipo de datos. Esta familia de funciones incluye: - -- `toUInt8(expr)` — Results in the `UInt8` tipo de datos. -- `toUInt16(expr)` — Results in the `UInt16` tipo de datos. -- `toUInt32(expr)` — Results in the `UInt32` tipo de datos. -- `toUInt64(expr)` — Results in the `UInt64` tipo de datos. - -**Parámetros** - -- `expr` — [Expresion](../syntax.md#syntax-expressions) devolviendo un número o una cadena con la representación decimal de un número. No se admiten representaciones binarias, octales y hexadecimales de números. Los ceros principales son despojados. - -**Valor devuelto** - -Valor entero en el `UInt8`, `UInt16`, `UInt32`, o `UInt64` tipo de datos. - -Funciones de uso [redondeando hacia cero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), lo que significa que truncan dígitos fraccionarios de números. - -El comportamiento de las funciones para los instrumentos negativos y para [NaN y Inf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) los argumentos no están definidos. Si pasa una cadena con un número negativo, por ejemplo `'-32'`, ClickHouse genera una excepción. Recuerde acerca de [problemas de conversión numérica](#numeric-conversion-issues), al usar las funciones. - -**Ejemplo** - -``` sql -SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) -``` - -``` text -┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ -│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ -└─────────────────────┴───────────────┴────────────────┴──────────────┘ -``` - -## ¿Cómo puedo obtener más información? {#touint8163264orzero} - -## ¿Cómo puedo hacerlo? {#touint8163264ornull} - -## ¿Cómo puedo obtener más información?) {#tofloat3264} - -## ¿Cómo puedo hacerlo? {#tofloat3264orzero} - -## ¿Cómo puedo hacerlo? {#tofloat3264ornull} - -## Fecha {#todate} - -## Todos los derechos reservados {#todateorzero} - -## ToDateOrNull {#todateornull} - -## toDateTime {#todatetime} - -## ToDateTimeOrZero {#todatetimeorzero} - -## ToDateTimeOrNull {#todatetimeornull} - -## toDecimal(32/64/128) {#todecimal3264128} - -Convertir `value` a la [Decimal](../../sql_reference/data_types/decimal.md) tipo de datos con precisión de `S`. El `value` puede ser un número o una cadena. El `S` (escala) parámetro especifica el número de decimales. - -- `toDecimal32(value, S)` -- `toDecimal64(value, S)` -- `toDecimal128(value, S)` - -## ¿Cómo puedo hacer esto? {#todecimal3264128ornull} - -Convierte una cadena de entrada en un [Información detallada))](../../sql_reference/data_types/decimal.md) valor de tipo de datos. Esta familia de funciones incluye: - -- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` tipo de datos. -- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` tipo de datos. -- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` tipo de datos. - -Estas funciones deben usarse en lugar de `toDecimal*()` funciones, si usted prefiere conseguir un `NULL` valor de entrada en lugar de una excepción en el caso de un error de análisis de valor de entrada. - -**Parámetros** - -- `expr` — [Expresion](../syntax.md#syntax-expressions), devuelve un valor en el [Cadena](../../sql_reference/data_types/string.md) tipo de datos. ClickHouse espera la representación textual del número decimal. Por ejemplo, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**Valor devuelto** - -Un valor en el `Nullable(Decimal(P,S))` tipo de datos. El valor contiene: - -- Número con `S` lugares decimales, si ClickHouse interpreta la cadena de entrada como un número. -- `NULL`, si ClickHouse no puede interpretar la cadena de entrada como un número o si el número de entrada contiene más de `S` lugares decimales. - -**Ejemplos** - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ -│ -1.11100 │ Nullable(Decimal(9, 5)) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ -│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## Por ejemplo: {#todecimal3264128orzero} - -Convierte un valor de entrada en el [Decimal (P, S)](../../sql_reference/data_types/decimal.md) tipo de datos. Esta familia de funciones incluye: - -- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` tipo de datos. -- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` tipo de datos. -- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` tipo de datos. - -Estas funciones deben usarse en lugar de `toDecimal*()` funciones, si usted prefiere conseguir un `0` valor de entrada en lugar de una excepción en el caso de un error de análisis de valor de entrada. - -**Parámetros** - -- `expr` — [Expresion](../syntax.md#syntax-expressions), devuelve un valor en el [Cadena](../../sql_reference/data_types/string.md) tipo de datos. ClickHouse espera la representación textual del número decimal. Por ejemplo, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**Valor devuelto** - -Un valor en el `Nullable(Decimal(P,S))` tipo de datos. El valor contiene: - -- Número con `S` lugares decimales, si ClickHouse interpreta la cadena de entrada como un número. -- 0 con `S` decimales, si ClickHouse no puede interpretar la cadena de entrada como un número o si el número de entrada contiene más de `S` lugares decimales. - -**Ejemplo** - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ -│ -1.11100 │ Decimal(9, 5) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ -│ 0.00 │ Decimal(9, 2) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## ToString {#tostring} - -Funciones para convertir entre números, cadenas (pero no cadenas fijas), fechas y fechas con horas. -Todas estas funciones aceptan un argumento. - -Al convertir a o desde una cadena, el valor se formatea o se analiza utilizando las mismas reglas que para el formato TabSeparated (y casi todos los demás formatos de texto). Si la cadena no se puede analizar, se lanza una excepción y se cancela la solicitud. - -Al convertir fechas a números o viceversa, la fecha corresponde al número de días desde el comienzo de la época Unix. -Al convertir fechas con horas a números o viceversa, la fecha con hora corresponde al número de segundos desde el comienzo de la época Unix. - -Los formatos de fecha y fecha con hora para las funciones toDate/toDateTime se definen de la siguiente manera: - -``` text -YYYY-MM-DD -YYYY-MM-DD hh:mm:ss -``` - -Como excepción, si convierte de tipos numéricos UInt32, Int32, UInt64 o Int64 a Date, y si el número es mayor o igual que 65536, el número se interpreta como una marca de tiempo Unix (y no como el número de días) y se redondea a la fecha. Esto permite soporte para la ocurrencia común de la escritura ‘toDate(unix\_timestamp)’, que de otra manera sería un error y requeriría escribir el más engorroso ‘toDate(toDateTime(unix\_timestamp))’. - -La conversión entre una fecha y una fecha con la hora se realiza de la manera natural: agregando un tiempo nulo o eliminando el tiempo. - -La conversión entre tipos numéricos utiliza las mismas reglas que las asignaciones entre diferentes tipos numéricos en C++. - -Además, la función toString del argumento DateTime puede tomar un segundo argumento String que contiene el nombre de la zona horaria. Ejemplo: `Asia/Yekaterinburg` En este caso, la hora se formatea de acuerdo con la zona horaria especificada. - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - -``` text -┌───────────now_local─┬─now_yekat───────────┐ -│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ -└─────────────────────┴─────────────────────┘ -``` - -Ver también el `toUnixTimestamp` función. - -## ¿Qué puedes encontrar en Neodigit) {#tofixedstrings-n} - -Convierte un argumento de tipo String en un tipo FixedString(N) (una cadena con longitud fija N). N debe ser una constante. -Si la cadena tiene menos bytes que N, se pasa con bytes nulos a la derecha. Si la cadena tiene más bytes que N, se produce una excepción. - -## Todos los derechos reservados.) {#tostringcuttozeros} - -Acepta un argumento String o FixedString. Devuelve la cadena con el contenido truncado en el primer byte cero encontrado. - -Ejemplo: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s─────────────┬─s_cut─┐ -│ foo\0\0\0\0\0 │ foo │ -└───────────────┴───────┘ -``` - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s──────────┬─s_cut─┐ -│ foo\0bar\0 │ foo │ -└────────────┴───────┘ -``` - -## ¿Cómo puedo obtener más información?) {#reinterpretasuint8163264} - -## ¿Cómo puedo obtener más información?) {#reinterpretasint8163264} - -## ¿Cómo puedo obtener más información?) {#reinterpretasfloat3264} - -## reinterpretAsDate {#reinterpretasdate} - -## reinterpretAsDateTime {#reinterpretasdatetime} - -Estas funciones aceptan una cadena e interpretan los bytes colocados al principio de la cadena como un número en orden de host (little endian). Si la cadena no es lo suficientemente larga, las funciones funcionan como si la cadena estuviera rellenada con el número necesario de bytes nulos. Si la cadena es más larga de lo necesario, se ignoran los bytes adicionales. Una fecha se interpreta como el número de días desde el comienzo de la época Unix, y una fecha con hora se interpreta como el número de segundos desde el comienzo de la época Unix. - -## reinterpretAsString {#type_conversion_functions-reinterpretAsString} - -Esta función acepta un número o fecha o fecha con hora, y devuelve una cadena que contiene bytes que representan el valor correspondiente en orden de host (little endian). Los bytes nulos se eliminan desde el final. Por ejemplo, un valor de tipo UInt32 de 255 es una cadena que tiene un byte de longitud. - -## reinterpretAsFixedString {#reinterpretasfixedstring} - -Esta función acepta un número o fecha o fecha con hora, y devuelve un FixedString que contiene bytes que representan el valor correspondiente en orden de host (little endian). Los bytes nulos se eliminan desde el final. Por ejemplo, un valor de tipo UInt32 de 255 es un FixedString que tiene un byte de longitud. - -## CAST(x, t) {#type_conversion_function-cast} - -Convertir ‘x’ a la ‘t’ tipo de datos. La sintaxis CAST(x AS t) también es compatible. - -Ejemplo: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - -``` text -┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ -└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ -``` - -La conversión a FixedString(N) solo funciona para argumentos de tipo String o FixedString(N). - -Conversión de tipo a [NULL](../../sql_reference/data_types/nullable.md) y la espalda es compatible. Ejemplo: - -``` sql -SELECT toTypeName(x) FROM t_null -``` - -``` text -┌─toTypeName(x)─┐ -│ Int8 │ -│ Int8 │ -└───────────────┘ -``` - -``` sql -SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null -``` - -``` text -┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ -│ Nullable(UInt16) │ -│ Nullable(UInt16) │ -└─────────────────────────────────────────┘ -``` - -## toInterval(Year\|Quarter\|Month\|Week\|Day\|Hour\|Minute\|Second) {#function-tointerval} - -Convierte un argumento de tipo Number en un [Intervalo](../../sql_reference/data_types/special_data_types/interval.md) tipo de datos. - -**Sintaxis** - -``` sql -toIntervalSecond(number) -toIntervalMinute(number) -toIntervalHour(number) -toIntervalDay(number) -toIntervalWeek(number) -toIntervalMonth(number) -toIntervalQuarter(number) -toIntervalYear(number) -``` - -**Parámetros** - -- `number` — Duration of interval. Positive integer number. - -**Valores devueltos** - -- El valor en `Interval` tipo de datos. - -**Ejemplo** - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - -``` text -┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ -│ 2019-01-08 │ 2019-01-08 │ -└───────────────────────────┴──────────────────────────────┘ -``` - -## parseDateTimeBestEffort {#parsedatetimebesteffort} - -Convierte una fecha y una hora en el [Cadena](../../sql_reference/data_types/string.md) representación a [FechaHora](../../sql_reference/data_types/datetime.md#data_type-datetime) tipo de datos. - -La función analiza [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC 1123 - 5.2.14 RFC-822 Especificación de fecha y hora](https://tools.ietf.org/html/rfc1123#page-55), ClickHouse y algunos otros formatos de fecha y hora. - -**Sintaxis** - -``` sql -parseDateTimeBestEffort(time_string [, time_zone]); -``` - -**Parámetros** - -- `time_string` — String containing a date and time to convert. [Cadena](../../sql_reference/data_types/string.md). -- `time_zone` — Time zone. The function parses `time_string` según la zona horaria. [Cadena](../../sql_reference/data_types/string.md). - -**Formatos no estándar admitidos** - -- Una cadena que contiene 9..10 dígitos [marca de tiempo unix](https://en.wikipedia.org/wiki/Unix_time). -- Una cadena con un componente de fecha y hora: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, sucesivamente. -- Una cadena con una fecha, pero sin componente de hora: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` sucesivamente. -- Una cadena con un día y una hora: `DD`, `DD hh`, `DD hh:mm`. En este caso `YYYY-MM` se sustituyen como `2000-01`. -- Una cadena que incluye la fecha y la hora junto con la información de desplazamiento de zona horaria: `YYYY-MM-DD hh:mm:ss ±h:mm`, sucesivamente. Por ejemplo, `2020-12-12 17:36:00 -5:00`. - -Para todos los formatos con separador, la función analiza los nombres de meses expresados por su nombre completo o por las primeras tres letras de un nombre de mes. Ejemplos: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. - -**Valor devuelto** - -- `time_string` convertido a la `DateTime` tipo de datos. - -**Ejemplos** - -Consulta: - -``` sql -SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') -AS parseDateTimeBestEffort; -``` - -Resultado: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2020-12-12 12:12:57 │ -└─────────────────────────┘ -``` - -Consulta: - -``` sql -SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') -AS parseDateTimeBestEffort -``` - -Resultado: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-08-18 10:22:16 │ -└─────────────────────────┘ -``` - -Consulta: - -``` sql -SELECT parseDateTimeBestEffort('1284101485') -AS parseDateTimeBestEffort -``` - -Resultado: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2015-07-07 12:04:41 │ -└─────────────────────────┘ -``` - -Consulta: - -``` sql -SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') -AS parseDateTimeBestEffort -``` - -Resultado: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-12-12 10:12:12 │ -└─────────────────────────┘ -``` - -Consulta: - -``` sql -SELECT parseDateTimeBestEffort('10 20:19') -``` - -Resultado: - -``` text -┌─parseDateTimeBestEffort('10 20:19')─┐ -│ 2000-01-10 20:19:00 │ -└─────────────────────────────────────┘ -``` - -**Ver también** - -- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) -- [RFC 1123](https://tools.ietf.org/html/rfc1123) -- [Fecha](#todate) -- [toDateTime](#todatetime) - -## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} - -Lo mismo que para [parseDateTimeBestEffort](#parsedatetimebesteffort) excepto que devuelve null cuando encuentra un formato de fecha que no se puede procesar. - -## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} - -Lo mismo que para [parseDateTimeBestEffort](#parsedatetimebesteffort) excepto que devuelve una fecha cero o una fecha cero cuando encuentra un formato de fecha que no se puede procesar. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/es/sql_reference/functions/url_functions.md b/docs/es/sql_reference/functions/url_functions.md deleted file mode 100644 index 923d9250928..00000000000 --- a/docs/es/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 54 -toc_title: Trabajar con URL ---- - -# Funciones para trabajar con URL {#functions-for-working-with-urls} - -Todas estas funciones no siguen el RFC. Se simplifican al máximo para mejorar el rendimiento. - -## Funciones que extraen partes de una URL {#functions-that-extract-parts-of-a-url} - -Si la parte relevante no está presente en una URL, se devuelve una cadena vacía. - -### protocolo {#protocol} - -Extrae el protocolo de una URL. - -Examples of typical returned values: http, https, ftp, mailto, tel, magnet… - -### dominio {#domain} - -Extrae el nombre de host de una dirección URL. - -``` sql -domain(url) -``` - -**Parámetros** - -- `url` — URL. Type: [Cadena](../../sql_reference/data_types/string.md). - -La URL se puede especificar con o sin un esquema. Ejemplos: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -Para estos ejemplos, el `domain` función devuelve los siguientes resultados: - -``` text -some.svn-hosting.com -some.svn-hosting.com -yandex.com -``` - -**Valores devueltos** - -- Nombre de host. Si ClickHouse puede analizar la cadena de entrada como una URL. -- Cadena vacía. Si ClickHouse no puede analizar la cadena de entrada como una URL. - -Tipo: `String`. - -**Ejemplo** - -``` sql -SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ -│ some.svn-hosting.com │ -└────────────────────────────────────────────────────────┘ -``` - -### Nuestros servicios {#domainwithoutwww} - -Devuelve el dominio y no elimina más de uno ‘www.’ desde el principio de la misma, si está presente. - -### topLevelDomain {#topleveldomain} - -Extrae el dominio de nivel superior de una URL. - -``` sql -topLevelDomain(url) -``` - -**Parámetros** - -- `url` — URL. Type: [Cadena](../../sql_reference/data_types/string.md). - -La URL se puede especificar con o sin un esquema. Ejemplos: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -**Valores devueltos** - -- Nombre de dominio. Si ClickHouse puede analizar la cadena de entrada como una URL. -- Cadena vacía. Si ClickHouse no puede analizar la cadena de entrada como una URL. - -Tipo: `String`. - -**Ejemplo** - -``` sql -SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ -│ com │ -└────────────────────────────────────────────────────────────────────┘ -``` - -### FirstSignificantSubdomain {#firstsignificantsubdomain} - -Devuelve el “first significant subdomain”. Este es un concepto no estándar específico de Yandex.Métrica. El primer subdominio significativo es un dominio de segundo nivel si es ‘com’, ‘net’, ‘org’, o ‘co’. De lo contrario, es un dominio de tercer nivel. Por ejemplo, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. La lista de “insignificant” dominios de segundo nivel y otros detalles de implementación pueden cambiar en el futuro. - -### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} - -Devuelve la parte del dominio que incluye subdominios de nivel superior “first significant subdomain” (véase la explicación anterior). - -Por ejemplo, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### camino {#path} - -Devuelve la ruta de acceso. Ejemplo: `/top/news.html` La ruta de acceso no incluye la cadena de consulta. - -### pathFull {#pathfull} - -Lo mismo que el anterior, pero incluyendo cadena de consulta y fragmento. Ejemplo: /top/news.html?Página = 2 \# comentarios - -### queryString {#querystring} - -Devuelve la cadena de consulta. Ejemplo: page=1&lr=213. query-string no incluye el signo de interrogación inicial, así como \# y todo después de \#. - -### fragmento {#fragment} - -Devuelve el identificador de fragmento. el fragmento no incluye el símbolo hash inicial. - -### queryStringAndFragment {#querystringandfragment} - -Devuelve la cadena de consulta y el identificador de fragmento. Ejemplo: page=1\#29390. - -### extractURLParameter(URL, nombre) {#extracturlparameterurl-name} - -Devuelve el valor de la ‘name’ parámetro en la URL, si está presente. De lo contrario, una cadena vacía. Si hay muchos parámetros con este nombre, devuelve la primera aparición. Esta función funciona bajo el supuesto de que el nombre del parámetro está codificado en la URL exactamente de la misma manera que en el argumento pasado. - -### extractURLParameters (URL) {#extracturlparametersurl} - -Devuelve una matriz de cadenas name=value correspondientes a los parámetros de URL. Los valores no se decodifican de ninguna manera. - -### ExtractURLParameterNames (URL) {#extracturlparameternamesurl} - -Devuelve una matriz de cadenas de nombre correspondientes a los nombres de los parámetros de URL. Los valores no se decodifican de ninguna manera. - -### URLJerarquía (URL) {#urlhierarchyurl} - -Devuelve una matriz que contiene la URL, truncada al final por los símbolos /,? en la ruta y la cadena de consulta. Los caracteres separadores consecutivos se cuentan como uno. El corte se realiza en la posición después de todos los caracteres separadores consecutivos. - -### URLPathHierarchy (URL) {#urlpathhierarchyurl} - -Lo mismo que el anterior, pero sin el protocolo y el host en el resultado. El elemento / (raíz) no está incluido. Ejemplo: la función se utiliza para implementar informes de árbol de la URL en Yandex. Métrica. - -``` text -URLPathHierarchy('https://example.com/browse/CONV-6788') = -[ - '/browse/', - '/browse/CONV-6788' -] -``` - -### decodeURLComponent (URL) {#decodeurlcomponenturl} - -Devuelve la dirección URL decodificada. -Ejemplo: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - -``` text -┌─DecodedURL─────────────────────────────┐ -│ http://127.0.0.1:8123/?query=SELECT 1; │ -└────────────────────────────────────────┘ -``` - -## Funciones que eliminan parte de una URL. {#functions-that-remove-part-of-a-url} - -Si la URL no tiene nada similar, la URL permanece sin cambios. - -### Sistema abierto. {#cutwww} - -Elimina no más de uno ‘www.’ desde el principio del dominio de la URL, si está presente. - -### cutQueryString {#cutquerystring} - -Quita la cadena de consulta. El signo de interrogación también se elimina. - -### cutFragment {#cutfragment} - -Quita el identificador de fragmento. El signo de número también se elimina. - -### cutQueryStringAndFragment {#cutquerystringandfragment} - -Quita la cadena de consulta y el identificador de fragmento. El signo de interrogación y el signo de número también se eliminan. - -### cutURLParameter(URL, nombre) {#cuturlparameterurl-name} - -Elimina el ‘name’ Parámetro URL, si está presente. Esta función funciona bajo el supuesto de que el nombre del parámetro está codificado en la URL exactamente de la misma manera que en el argumento pasado. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/es/sql_reference/functions/uuid_functions.md b/docs/es/sql_reference/functions/uuid_functions.md deleted file mode 100644 index 6bc2f18a59c..00000000000 --- a/docs/es/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 53 -toc_title: Trabajando con UUID ---- - -# Funciones para trabajar con UUID {#functions-for-working-with-uuid} - -Las funciones para trabajar con UUID se enumeran a continuación. - -## GenerateUUIDv4 {#uuid-function-generate} - -Genera el [UUID](../../sql_reference/data_types/uuid.md) de [versión 4](https://tools.ietf.org/html/rfc4122#section-4.4). - -``` sql -generateUUIDv4() -``` - -**Valor devuelto** - -El valor de tipo UUID. - -**Ejemplo de uso** - -En este ejemplo se muestra la creación de una tabla con la columna de tipo UUID e insertar un valor en la tabla. - -``` sql -CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -INSERT INTO t_uuid SELECT generateUUIDv4() - -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## paraUUID (x) {#touuid-x} - -Convierte el valor de tipo de cadena en tipo UUID. - -``` sql -toUUID(String) -``` - -**Valor devuelto** - -El valor de tipo UUID. - -**Ejemplo de uso** - -``` sql -SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid -``` - -``` text -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## UUIDStringToNum {#uuidstringtonum} - -Acepta una cadena que contiene 36 caracteres en el formato `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, y lo devuelve como un conjunto de bytes en un [Cadena fija (16)](../../sql_reference/data_types/fixedstring.md). - -``` sql -UUIDStringToNum(String) -``` - -**Valor devuelto** - -Cadena fija (16) - -**Ejemplos de uso** - -``` sql -SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes -``` - -``` text -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## UUIDNumToString {#uuidnumtostring} - -Acepta un [Cadena fija (16)](../../sql_reference/data_types/fixedstring.md) valor, y devuelve una cadena que contiene 36 caracteres en formato de texto. - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**Valor devuelto** - -Cadena. - -**Ejemplo de uso** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid -``` - -``` text -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## Ver también {#see-also} - -- [dictGetUUID](ext_dict_functions.md#ext_dict_functions-other) - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/es/sql_reference/functions/ym_dict_functions.md b/docs/es/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index 4ef4a169ebf..00000000000 --- a/docs/es/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 59 -toc_title: Trabajando con Yandex.Diccionarios de Metrica ---- - -# Funciones para trabajar con Yandex.Metrica, diccionarios {#functions-for-working-with-yandex-metrica-dictionaries} - -Para que las funciones a continuación funcionen, la configuración del servidor debe especificar las rutas y direcciones para obtener todo el Yandex.Diccionarios Metrica. Los diccionarios se cargan en la primera llamada de cualquiera de estas funciones. Si las listas de referencia no se pueden cargar, se lanza una excepción. - -Para obtener información sobre cómo crear listas de referencia, consulte la sección “Dictionaries”. - -## Múltiples geobases {#multiple-geobases} - -ClickHouse admite trabajar con múltiples geobases alternativas (jerarquías regionales) simultáneamente, con el fin de soportar diversas perspectivas sobre a qué países pertenecen ciertas regiones. - -El ‘clickhouse-server’ config especifica el archivo con la jerarquía regional::`/opt/geo/regions_hierarchy.txt` - -Además de este archivo, también busca archivos cercanos que tengan el símbolo \_ y cualquier sufijo anexado al nombre (antes de la extensión del archivo). -Por ejemplo, también encontrará el archivo `/opt/geo/regions_hierarchy_ua.txt` si está presente. - -`ua` se llama la clave del diccionario. Para un diccionario sin un sufijo, la clave es una cadena vacía. - -Todos los diccionarios se vuelven a cargar en tiempo de ejecución (una vez cada cierto número de segundos, como se define en el parámetro de configuración builtin\_dictionaries\_reload\_interval , o una vez por hora por defecto). Sin embargo, la lista de diccionarios disponibles se define una vez, cuando se inicia el servidor. - -All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. -Ejemplo: - -``` sql -regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt -``` - -### ¿Cómo puedo hacerlo?\]) {#regiontocityid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. - -### ¿Cómo puedo hacerlo?\]) {#regiontoareaid-geobase} - -Convierte una región en un área (tipo 5 en la geobase). En todos los demás sentidos, esta función es la misma que ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ -│ │ -│ Moscow and Moscow region │ -│ St. Petersburg and Leningrad region │ -│ Belgorod region │ -│ Ivanovsk region │ -│ Kaluga region │ -│ Kostroma region │ -│ Kursk region │ -│ Lipetsk region │ -│ Orlov region │ -│ Ryazan region │ -│ Smolensk region │ -│ Tambov region │ -│ Tver region │ -│ Tula region │ -└──────────────────────────────────────────────────────┘ -``` - -### ¿Cómo puedo hacerlo?\]) {#regiontodistrictid-geobase} - -Convierte una región en un distrito federal (tipo 4 en la geobase). En todos los demás sentidos, esta función es la misma que ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ -│ │ -│ Central federal district │ -│ Northwest federal district │ -│ South federal district │ -│ North Caucases federal district │ -│ Privolga federal district │ -│ Ural federal district │ -│ Siberian federal district │ -│ Far East federal district │ -│ Scotland │ -│ Faroe Islands │ -│ Flemish region │ -│ Brussels capital region │ -│ Wallonia │ -│ Federation of Bosnia and Herzegovina │ -└──────────────────────────────────────────────────────────┘ -``` - -### ¿Cómo puedo hacerlo?\]) {#regiontocountryid-geobase} - -Convierte una región en un país. En todos los demás sentidos, esta función es la misma que ‘regionToCity’. -Ejemplo: `regionToCountry(toUInt32(213)) = 225` convierte Moscú (213) a Rusia (225). - -### Aquí está el código de identificación.\]) {#regiontocontinentid-geobase} - -Convierte una región en un continente. En todos los demás sentidos, esta función es la misma que ‘regionToCity’. -Ejemplo: `regionToContinent(toUInt32(213)) = 10001` convierte Moscú (213) a Eurasia (10001). - -### Nuestra misión es brindarle un servicio de calidad y confianza a nuestros clientes.) {#regiontotopcontinent-regiontotopcontinent} - -Encuentra el continente más alto en la jerarquía de la región. - -**Sintaxis** - -``` sql -regionToTopContinent(id[, geobase]); -``` - -**Parámetros** - -- `id` — Region ID from the Yandex geobase. [UInt32](../../sql_reference/data_types/int_uint.md). -- `geobase` — Dictionary key. See [Múltiples Geobases](#multiple-geobases). [Cadena](../../sql_reference/data_types/string.md). Opcional. - -**Valor devuelto** - -- Identificador del continente de nivel superior (este último cuando subes la jerarquía de regiones). -- 0, si no hay ninguno. - -Tipo: `UInt32`. - -### Aquí está el código de identificación de la población.\]) {#regiontopopulationid-geobase} - -Obtiene la población de una región. -La población se puede registrar en archivos con la geobase. Vea la sección “External dictionaries”. -Si la población no se registra para la región, devuelve 0. -En la geobase de Yandex, la población podría registrarse para las regiones secundarias, pero no para las regiones parentales. - -### ¿Cómo puedo hacerlo?\]) {#regioninlhs-rhs-geobase} - -Comprueba si un ‘lhs’ región pertenece a un ‘rhs’ regi. Devuelve un número UInt8 igual a 1 si pertenece, o 0 si no pertenece. -The relationship is reflexive – any region also belongs to itself. - -### RegiónJerarquía (id\[, geobase\]) {#regionhierarchyid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. -Ejemplo: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### ¿Cómo puedo hacerlo?\]) {#regiontonameid-lang} - -Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn't exist, an empty string is returned. - -`ua` y `uk` ambos significan ucraniano. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/es/sql_reference/index.md b/docs/es/sql_reference/index.md deleted file mode 100644 index 69de6894e34..00000000000 --- a/docs/es/sql_reference/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: SQL Reference -toc_hidden: true -toc_priority: 28 -toc_title: oculto ---- - -# Referencia SQL {#sql-reference} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md#query_language_queries_alter) -- [Otros tipos de consultas](statements/misc.md) - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/es/sql_reference/operators.md b/docs/es/sql_reference/operators.md deleted file mode 100644 index f6e9117eecf..00000000000 --- a/docs/es/sql_reference/operators.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 37 -toc_title: Operador ---- - -# Operador {#operators} - -Todos los operadores se transforman a sus funciones correspondientes en la etapa de análisis de consulta de acuerdo con su precedencia y asociatividad. -Los grupos de operadores se enumeran en orden de prioridad (cuanto más alto esté en la lista, más temprano estará conectado el operador a sus argumentos). - -## Operadores de acceso {#access-operators} - -`a[N]` – Access to an element of an array. The `arrayElement(a, N)` función. - -`a.N` – Access to a tuple element. The `tupleElement(a, N)` función. - -## Operador de negación numérica {#numeric-negation-operator} - -`-a` – The `negate (a)` función. - -## Operadores de multiplicación y división {#multiplication-and-division-operators} - -`a * b` – The `multiply (a, b)` función. - -`a / b` – The `divide(a, b)` función. - -`a % b` – The `modulo(a, b)` función. - -## Operadores de suma y resta {#addition-and-subtraction-operators} - -`a + b` – The `plus(a, b)` función. - -`a - b` – The `minus(a, b)` función. - -## Operadores de comparación {#comparison-operators} - -`a = b` – The `equals(a, b)` función. - -`a == b` – The `equals(a, b)` función. - -`a != b` – The `notEquals(a, b)` función. - -`a <> b` – The `notEquals(a, b)` función. - -`a <= b` – The `lessOrEquals(a, b)` función. - -`a >= b` – The `greaterOrEquals(a, b)` función. - -`a < b` – The `less(a, b)` función. - -`a > b` – The `greater(a, b)` función. - -`a LIKE s` – The `like(a, b)` función. - -`a NOT LIKE s` – The `notLike(a, b)` función. - -`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. - -`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. - -## Operadores para trabajar con conjuntos de datos {#operators-for-working-with-data-sets} - -*Ver [IN operadores](statements/select.md#select-in-operators).* - -`a IN ...` – The `in(a, b)` función. - -`a NOT IN ...` – The `notIn(a, b)` función. - -`a GLOBAL IN ...` – The `globalIn(a, b)` función. - -`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` función. - -## Operadores para trabajar con fechas y horarios {#operators-datetime} - -### EXTRACT {#operator-extract} - -``` sql -EXTRACT(part FROM date); -``` - -Extrae una parte de una fecha determinada. Por ejemplo, puede recuperar un mes a partir de una fecha determinada o un segundo a partir de una hora. - -El `part` parámetro especifica qué parte de la fecha se va a recuperar. Los siguientes valores están disponibles: - -- `DAY` — The day of the month. Possible values: 1–31. -- `MONTH` — The number of a month. Possible values: 1–12. -- `YEAR` — The year. -- `SECOND` — The second. Possible values: 0–59. -- `MINUTE` — The minute. Possible values: 0–59. -- `HOUR` — The hour. Possible values: 0–23. - -El `part` El parámetro no distingue entre mayúsculas y minúsculas. - -El `date` parámetro especifica la fecha o la hora a procesar. Bien [Fecha](../sql_reference/data_types/date.md) o [FechaHora](../sql_reference/data_types/datetime.md) tipo es compatible. - -Ejemplos: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -En el siguiente ejemplo creamos una tabla e insertamos en ella un valor con el `DateTime` tipo. - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -Puedes ver más ejemplos en [prueba](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -Crea un [Intervalo](../sql_reference/data_types/special_data_types/interval.md)-type valor que debe utilizarse en operaciones aritméticas con [Fecha](../sql_reference/data_types/date.md) y [FechaHora](../sql_reference/data_types/datetime.md)-type valores. - -Tipos de intervalos: -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -!!! warning "Advertencia" - Los intervalos con diferentes tipos no se pueden combinar. No puedes usar expresiones como `INTERVAL 4 DAY 1 HOUR`. Exprese los intervalos en unidades que son más pequeñas o iguales a la unidad más pequeña del intervalo, por ejemplo `INTERVAL 25 HOUR`. Puede usar operaciones consequtive como en el siguiente ejemplo. - -Ejemplo: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**Ver también** - -- [Intervalo](../sql_reference/data_types/special_data_types/interval.md) tipo de datos -- [ToInterval](../sql_reference/functions/type_conversion_functions.md#function-tointerval) funciones de conversión de tipo - -## Operador de Negación Lógica {#logical-negation-operator} - -`NOT a` – The `not(a)` función. - -## Operador lógico and {#logical-and-operator} - -`a AND b` – The`and(a, b)` función. - -## Operador lógico or {#logical-or-operator} - -`a OR b` – The `or(a, b)` función. - -## Operador condicional {#conditional-operator} - -`a ? b : c` – The `if(a, b, c)` función. - -Nota: - -El operador condicional calcula los valores de b y c, luego verifica si se cumple la condición a y luego devuelve el valor correspondiente. Si `b` o `C` es una [arrayJoin()](../sql_reference/functions/array_join.md#functions_arrayjoin) función, cada fila se replicará independientemente de la “a” condición. - -## Expresión condicional {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -Si `x` se especifica, entonces `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. - -Si no hay `ELSE c` cláusula en la expresión, el valor predeterminado es `NULL`. - -El `transform` no funciona con `NULL`. - -## Operador de Concatenación {#concatenation-operator} - -`s1 || s2` – The `concat(s1, s2) function.` - -## Operador de Creación Lambda {#lambda-creation-operator} - -`x -> expr` – The `lambda(x, expr) function.` - -Los siguientes operadores no tienen prioridad, ya que son corchetes: - -## Operador de creación de matrices {#array-creation-operator} - -`[x1, ...]` – The `array(x1, ...) function.` - -## Operador de creación de tupla {#tuple-creation-operator} - -`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` - -## Asociatividad {#associativity} - -Todos los operadores binarios han dejado asociatividad. Por ejemplo, `1 + 2 + 3` se transforma a `plus(plus(1, 2), 3)`. -A veces esto no funciona de la manera que esperas. Por ejemplo, `SELECT 4 > 2 > 3` resultará en 0. - -Para la eficiencia, el `and` y `or` funciones aceptan cualquier número de argumentos. Las cadenas correspondientes de `AND` y `OR` operadores se transforman en una sola llamada de estas funciones. - -## Comprobación de `NULL` {#checking-for-null} - -ClickHouse soporta el `IS NULL` y `IS NOT NULL` a los operadores. - -### IS NULL {#operator-is-null} - -- Para [NULL](../sql_reference/data_types/nullable.md) valores de tipo, el `IS NULL` operador devuelve: - - `1` si el valor es `NULL`. - - `0` de lo contrario. -- Para otros valores, el `IS NULL` operador siempre devuelve `0`. - - - -``` sql -SELECT x+100 FROM t_null WHERE y IS NULL -``` - -``` text -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ -``` - -### IS NOT NULL {#is-not-null} - -- Para [NULL](../sql_reference/data_types/nullable.md) valores de tipo, el `IS NOT NULL` operador devuelve: - - `0` si el valor es `NULL`. - - `1` de lo contrario. -- Para otros valores, el `IS NOT NULL` operador siempre devuelve `1`. - - - -``` sql -SELECT * FROM t_null WHERE y IS NOT NULL -``` - -``` text -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/es/sql_reference/statements/alter.md b/docs/es/sql_reference/statements/alter.md deleted file mode 100644 index db8b3f09ada..00000000000 --- a/docs/es/sql_reference/statements/alter.md +++ /dev/null @@ -1,505 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -El `ALTER` consulta sólo se admite para `*MergeTree` mesas, así como `Merge`y`Distributed`. La consulta tiene varias variaciones. - -### Manipulaciones de columna {#column-manipulations} - -Cambiar la estructura de la tabla. - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -En la consulta, especifique una lista de una o más acciones separadas por comas. -Cada acción es una operación en una columna. - -Se admiten las siguientes acciones: - -- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. -- [DROP COLUMN](#alter_drop-column) — Deletes the column. -- [CLEAR COLUMN](#alter_clear-column) — Resets column values. -- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. -- [MODIFY COLUMN](#alter_modify-column) — Changes column's type, default expression and TTL. - -Estas acciones se describen en detalle a continuación. - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -Agrega una nueva columna a la tabla con el `name`, `type`, [`codec`](create.md#codecs) y `default_expr` (ver la sección [Expresiones predeterminadas](create.md#create-default-values)). - -Si el `IF NOT EXISTS` cláusula, la consulta no devolverá un error si la columna ya existe. Si especifica `AFTER name_after` (el nombre de otra columna), la columna se agrega después de la especificada en la lista de columnas de tabla. De lo contrario, la columna se agrega al final de la tabla. Tenga en cuenta que no hay forma de agregar una columna al principio de una tabla. Para una cadena de acciones, `name_after` puede ser el nombre de una columna que se agrega en una de las acciones anteriores. - -Agregar una columna solo cambia la estructura de la tabla, sin realizar ninguna acción con datos. Los datos no aparecen en el disco después de `ALTER`. Si faltan los datos para una columna al leer de la tabla, se rellena con valores predeterminados (realizando la expresión predeterminada si hay una, o usando ceros o cadenas vacías). La columna aparece en el disco después de fusionar partes de datos (consulte [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md)). - -Este enfoque nos permite completar el `ALTER` consulta al instante, sin aumentar el volumen de datos antiguos. - -Ejemplo: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -Elimina la columna con el nombre `name`. Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. - -Elimina datos del sistema de archivos. Dado que esto elimina archivos completos, la consulta se completa casi al instante. - -Ejemplo: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -Restablece todos los datos de una columna para una partición especificada. Obtenga más información sobre cómo configurar el nombre de la partición en la sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). - -Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. - -Ejemplo: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'comment' -``` - -Agrega un comentario a la columna. Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. - -Cada columna puede tener un comentario. Si ya existe un comentario para la columna, un nuevo comentario sobrescribe el comentario anterior. - -Los comentarios se almacenan en el `comment_expression` columna devuelta por el [DESCRIBE TABLE](misc.md#misc-describe-table) consulta. - -Ejemplo: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -Esta consulta cambia el `name` propiedades de la columna: - -- Tipo - -- Expresión predeterminada - -- TTL - - For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). - -Si el `IF EXISTS` se especifica una cláusula, la consulta no devolverá un error si la columna no existe. - -Al cambiar el tipo, los valores se convierten como si [ToType](../../sql_reference/functions/type_conversion_functions.md) se les aplicaron funciones. Si solo se cambia la expresión predeterminada, la consulta no hace nada complejo y se completa casi al instante. - -Ejemplo: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. - -Hay varias etapas de procesamiento: - -- Preparación de archivos temporales (nuevos) con datos modificados. -- Cambiar el nombre de los archivos antiguos. -- Cambiar el nombre de los archivos temporales (nuevos) a los nombres antiguos. -- Eliminar los archivos antiguos. - -Solo la primera etapa lleva tiempo. Si hay un error en esta etapa, los datos no se cambian. -Si hay un error durante una de las etapas sucesivas, los datos se pueden restaurar manualmente. La excepción es si los archivos antiguos se eliminaron del sistema de archivos, pero los datos de los nuevos archivos no se escribieron en el disco y se perdieron. - -El `ALTER` se replica la consulta para cambiar columnas. Las instrucciones se guardan en ZooKeeper, luego cada réplica las aplica. Todo `ALTER` las consultas se ejecutan en el mismo orden. La consulta espera a que se completen las acciones adecuadas en las otras réplicas. Sin embargo, una consulta para cambiar columnas en una tabla replicada se puede interrumpir y todas las acciones se realizarán de forma asincrónica. - -#### Limitaciones de consulta ALTER {#alter-query-limitations} - -El `ALTER` query le permite crear y eliminar elementos separados (columnas) en estructuras de datos anidadas, pero no en estructuras de datos anidadas completas. Para agregar una estructura de datos anidada, puede agregar columnas con un nombre como `name.nested_name` y el tipo `Array(T)`. Una estructura de datos anidada es equivalente a varias columnas de matriz con un nombre que tiene el mismo prefijo antes del punto. - -No hay soporte para eliminar columnas en la clave principal o la clave de muestreo (columnas que se utilizan en el `ENGINE` expresion). Solo es posible cambiar el tipo de las columnas que se incluyen en la clave principal si este cambio no provoca que se modifiquen los datos (por ejemplo, puede agregar valores a un Enum o cambiar un tipo de `DateTime` a `UInt32`). - -Si el `ALTER` la consulta no es suficiente para realizar los cambios en la tabla que necesita, puede crear una nueva tabla, copiar los datos [INSERT SELECT](insert_into.md#insert_query_insert-select) consulta, luego cambie las tablas usando el [RENAME](misc.md#misc_operations-rename) consulta y elimina la tabla anterior. Puede usar el [Método de codificación de datos:](../../operations/utilities/clickhouse-copier.md) como una alternativa a la `INSERT SELECT` consulta. - -El `ALTER` query bloquea todas las lecturas y escrituras para la tabla. En otras palabras, si un largo `SELECT` se está ejecutando en el momento de la `ALTER` consulta, el `ALTER` la consulta esperará a que se complete. Al mismo tiempo, todas las consultas nuevas a la misma tabla esperarán `ALTER` se está ejecutando. - -Para tablas que no almacenan datos por sí mismas (como `Merge` y `Distributed`), `ALTER` simplemente cambia la estructura de la tabla, y no cambia la estructura de las tablas subordinadas. Por ejemplo, cuando se ejecuta ALTER para un `Distributed` mesa, también tendrá que ejecutar `ALTER` para las tablas en todos los servidores remotos. - -### Manipulaciones con expresiones clave {#manipulations-with-key-expressions} - -Se admite el siguiente comando: - -``` sql -MODIFY ORDER BY new_expression -``` - -Solo funciona para tablas en el [`MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) familia (incluyendo -[repetición](../../engines/table_engines/mergetree_family/replication.md) tabla). El comando cambia el -[clave de clasificación](../../engines/table_engines/mergetree_family/mergetree.md) de la mesa -a `new_expression` (una expresión o una tupla de expresiones). La clave principal sigue siendo la misma. - -El comando es liviano en el sentido de que solo cambia los metadatos. Para mantener la propiedad esa parte de datos -las filas están ordenadas por la expresión de clave de ordenación, no puede agregar expresiones que contengan columnas existentes -a la clave de ordenación (sólo las columnas añadidas `ADD COLUMN` comando en el mismo `ALTER` consulta). - -### Manipulaciones con índices de saltos de datos {#manipulations-with-data-skipping-indices} - -Solo funciona para tablas en el [`*MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) familia (incluyendo -[repetición](../../engines/table_engines/mergetree_family/replication.md) tabla). Las siguientes operaciones -están disponibles: - -- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - Agrega la descripción del índice a los metadatos de las tablas. - -- `ALTER TABLE [db].name DROP INDEX name` - Elimina la descripción del índice de los metadatos de las tablas y elimina los archivos de índice del disco. - -Estos comandos son livianos en el sentido de que solo cambian los metadatos o eliminan archivos. -Además, se replican (sincronizando metadatos de índices a través de ZooKeeper). - -### Manipulaciones con restricciones {#manipulations-with-constraints} - -Ver más en [limitación](create.md#constraints) - -Las restricciones se pueden agregar o eliminar utilizando la siguiente sintaxis: - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -Las consultas agregarán o eliminarán metadatos sobre restricciones de la tabla para que se procesen inmediatamente. - -Comprobación de restricciones *no se ejecutará* en los datos existentes si se agregaron. - -Todos los cambios en las tablas replicadas se transmiten a ZooKeeper, por lo que se aplicarán en otras réplicas. - -### Manipulaciones con particiones y piezas {#alter_manipulations-with-partitions} - -Las siguientes operaciones con [partición](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) están disponibles: - -- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` directorio y olvidarlo. -- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. -- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` directorio a la tabla. -- [REPLACE PARTITION](#alter_replace-partition) - Copia la partición de datos de una tabla a otra. -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. -- [REPLACE PARTITION](#alter_replace-partition) - Copia la partición de datos de una tabla a otra y reemplaza. -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - Mover la partición de datos de una tabla a otra. -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - Restablece el valor de una columna especificada en una partición. -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - Restablece el índice secundario especificado en una partición. -- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. -- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. -- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. - - - -#### DETACH PARTITION {\#alter\_detach-partition} {#detach-partition-alter-detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -Mueve todos los datos de la partición especificada `detached` directorio. El servidor se olvida de la partición de datos separada como si no existiera. El servidor no sabrá acerca de estos datos hasta que [ATTACH](#alter_attach-partition) consulta. - -Ejemplo: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -Lea cómo configurar la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). - -Después de ejecutar la consulta, puede hacer lo que quiera con los datos en el `detached` directory — delete it from the file system, or just leave it. - -This query is replicated – it moves the data to the `detached` directorio en todas las réplicas. Tenga en cuenta que solo puede ejecutar esta consulta en una réplica de líder. Para averiguar si una réplica es un líder, realice `SELECT` consulta a la [sistema.Replica](../../operations/system_tables.md#system_tables-replicas) tabla. Alternativamente, es más fácil hacer un `DETACH` consulta en todas las réplicas: todas las réplicas producen una excepción, excepto la réplica líder. - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -Elimina la partición especificada de la tabla. Esta consulta etiqueta la partición como inactiva y elimina los datos por completo, aproximadamente en 10 minutos. - -Lea cómo configurar la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). - -The query is replicated – it deletes data on all replicas. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -Quita la parte especificada o todas las partes de la partición especificada de `detached`. -Más información sobre cómo establecer la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -Agrega datos a la tabla desde el `detached` directorio. Es posible agregar datos para una partición completa o para una parte separada. Ejemplos: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -Más información sobre cómo establecer la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). - -Esta consulta se replica. El iniciador de réplica comprueba si hay datos en el `detached` directorio. Si existen datos, la consulta comprueba su integridad. Si todo es correcto, la consulta agrega los datos a la tabla. Todas las demás réplicas descargan los datos del iniciador de réplica. - -Entonces puedes poner datos en el `detached` en una réplica, y utilice el directorio `ALTER ... ATTACH` consulta para agregarlo a la tabla en todas las réplicas. - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -Esta consulta copia la partición de datos `table1` a `table2` añade datos a los que existen en el `table2`. Tenga en cuenta que los datos no se eliminarán de `table1`. - -Para que la consulta se ejecute correctamente, se deben cumplir las siguientes condiciones: - -- Ambas tablas deben tener la misma estructura. -- Ambas tablas deben tener la misma clave de partición. - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -Esta consulta copia la partición de datos `table1` a `table2` y reemplaza la partición existente en el `table2`. Tenga en cuenta que los datos no se eliminarán de `table1`. - -Para que la consulta se ejecute correctamente, se deben cumplir las siguientes condiciones: - -- Ambas tablas deben tener la misma estructura. -- Ambas tablas deben tener la misma clave de partición. - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -Esta consulta mueve la partición de datos `table_source` a `table_dest` con la eliminación de los datos de `table_source`. - -Para que la consulta se ejecute correctamente, se deben cumplir las siguientes condiciones: - -- Ambas tablas deben tener la misma estructura. -- Ambas tablas deben tener la misma clave de partición. -- Ambas tablas deben ser de la misma familia de motores. (replicado o no replicado) -- Ambas tablas deben tener la misma política de almacenamiento. - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -Restablece todos los valores de la columna especificada en una partición. Si el `DEFAULT` cláusula se determinó al crear una tabla, esta consulta establece el valor de columna en un valor predeterminado especificado. - -Ejemplo: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -Esta consulta crea una copia de seguridad local de una partición especificada. Si el `PARTITION` se omite la cláusula, la consulta crea la copia de seguridad de todas las particiones a la vez. - -!!! note "Nota" - Todo el proceso de copia de seguridad se realiza sin detener el servidor. - -Tenga en cuenta que para las tablas de estilo antiguo puede especificar el prefijo del nombre de la partición (por ejemplo, ‘2019’) - entonces la consulta crea la copia de seguridad para todas las particiones correspondientes. Lea cómo configurar la expresión de partición en una sección [Cómo especificar la expresión de partición](#alter-how-to-specify-part-expr). - -En el momento de la ejecución, para una instantánea de datos, la consulta crea vínculos rígidos a los datos de una tabla. Los enlaces duros se colocan en el directorio `/var/lib/clickhouse/shadow/N/...`, donde: - -- `/var/lib/clickhouse/` es el directorio ClickHouse de trabajo especificado en la configuración. -- `N` es el número incremental de la copia de seguridad. - -!!! note "Nota" - Si usted usa [un conjunto de discos para el almacenamiento de datos en una tabla](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes), el `shadow/N` directorio aparece en cada disco, almacenando partes de datos que coinciden con el `PARTITION` expresion. - -La misma estructura de directorios se crea dentro de la copia de seguridad que dentro `/var/lib/clickhouse/`. La consulta realiza ‘chmod’ para todos los archivos, prohibiendo escribir en ellos. - -Después de crear la copia de seguridad, puede copiar los datos desde `/var/lib/clickhouse/shadow/` al servidor remoto y, a continuación, elimínelo del servidor local. Tenga en cuenta que el `ALTER t FREEZE PARTITION` consulta no se replica. Crea una copia de seguridad local solo en el servidor local. - -La consulta crea una copia de seguridad casi instantáneamente (pero primero espera a que las consultas actuales a la tabla correspondiente terminen de ejecutarse). - -`ALTER TABLE t FREEZE PARTITION` copia solo los datos, no los metadatos de la tabla. Para hacer una copia de seguridad de los metadatos de la tabla, copie el archivo `/var/lib/clickhouse/metadata/database/table.sql` - -Para restaurar los datos de una copia de seguridad, haga lo siguiente: - -1. Crear la tabla si no existe. Para ver la consulta, utilice el .archivo sql (reemplazar `ATTACH` en ella con `CREATE`). -2. Copie los datos de la `data/database/table/` directorio dentro de la copia de seguridad a la `/var/lib/clickhouse/data/database/table/detached/` directorio. -3. Ejecutar `ALTER TABLE t ATTACH PARTITION` consultas para agregar los datos a una tabla. - -La restauración desde una copia de seguridad no requiere detener el servidor. - -Para obtener más información sobre las copias de seguridad y la restauración de datos, consulte [Copia de seguridad de datos](../../operations/backup.md) apartado. - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -La consulta funciona de forma similar a `CLEAR COLUMN`, pero restablece un índice en lugar de una columna de datos. - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -Descarga una partición desde otro servidor. Esta consulta solo funciona para las tablas replicadas. - -La consulta hace lo siguiente: - -1. Descarga la partición del fragmento especificado. En ‘path-in-zookeeper’ debe especificar una ruta al fragmento en ZooKeeper. -2. Luego, la consulta coloca los datos descargados en el `detached` directorio de la `table_name` tabla. Utilice el [ATTACH PARTITION\|PART](#alter_attach-partition) consulta para agregar los datos a la tabla. - -Por ejemplo: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -Tenga en cuenta que: - -- El `ALTER ... FETCH PARTITION` consulta no se replica. Coloca la partición en el `detached` sólo en el servidor local. -- El `ALTER TABLE ... ATTACH` la consulta se replica. Agrega los datos a todas las réplicas. Los datos se agregan a una de las réplicas de la `detached` directorio, y para los demás - de réplicas vecinas. - -Antes de descargar, el sistema verifica si la partición existe y la estructura de la tabla coincide. La réplica más adecuada se selecciona automáticamente de las réplicas en buen estado. - -Aunque se llama a la consulta `ALTER TABLE`, no cambia la estructura de la tabla y no cambiar inmediatamente los datos disponibles en la tabla. - -#### MOVE PARTITION\|PART {#alter_move-partition} - -Mueve particiones o partes de datos a otro volumen o disco para `MergeTree`-mesas de motor. Ver [Uso de varios dispositivos de bloque para el almacenamiento de datos](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -El `ALTER TABLE t MOVE` consulta: - -- No replicado, porque diferentes réplicas pueden tener diferentes directivas de almacenamiento. -- Devuelve un error si el disco o volumen especificado no está configurado. La consulta también devuelve un error si no se pueden aplicar las condiciones de movimiento de datos especificadas en la directiva de almacenamiento. -- Puede devolver un error en el caso, cuando los datos que se moverán ya se mueven por un proceso en segundo plano, concurrente `ALTER TABLE t MOVE` consulta o como resultado de la fusión de datos de fondo. Un usuario no debe realizar ninguna acción adicional en este caso. - -Ejemplo: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### Cómo establecer la expresión de partición {#alter-how-to-specify-part-expr} - -Puede especificar la expresión de partición en `ALTER ... PARTITION` de diferentes maneras: - -- Como valor de la `partition` columna de la `system.parts` tabla. Por ejemplo, `ALTER TABLE visits DETACH PARTITION 201901`. -- Como la expresión de la columna de la tabla. Se admiten constantes y expresiones constantes. Por ejemplo, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- Usando el ID de partición. El ID de partición es un identificador de cadena de la partición (legible por humanos, si es posible) que se usa como nombres de particiones en el sistema de archivos y en ZooKeeper. El ID de partición debe especificarse en el `PARTITION ID` cláusula, entre comillas simples. Por ejemplo, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- En el [ALTER ATTACH PART](#alter_attach-partition) y [DROP DETACHED PART](#alter_drop-detached) consulta, para especificar el nombre de una parte, utilice un literal de cadena con un valor `name` columna de la [sistema.detached\_parts](../../operations/system_tables.md#system_tables-detached_parts) tabla. Por ejemplo, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -El uso de comillas al especificar la partición depende del tipo de expresión de partición. Por ejemplo, para el `String` tipo, debe especificar su nombre entre comillas (`'`). Para el `Date` y `Int*` tipos no se necesitan comillas. - -Para las tablas de estilo antiguo, puede especificar la partición como un número `201901` o una cadena `'201901'`. La sintaxis para las tablas de nuevo estilo es más estricta con los tipos (similar al analizador para el formato de entrada VALUES). - -Todas las reglas anteriores también son ciertas para el [OPTIMIZE](misc.md#misc_operations-optimize) consulta. Si necesita especificar la única partición al optimizar una tabla no particionada, establezca la expresión `PARTITION tuple()`. Por ejemplo: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -Los ejemplos de `ALTER ... PARTITION` las consultas se demuestran en las pruebas [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) y [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### Manipulaciones con tabla TTL {#manipulations-with-table-ttl} - -Usted puede cambiar [tabla TTL](../../engines/table_engines/mergetree_family/mergetree.md#mergetree-table-ttl) con una solicitud del siguiente formulario: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### Sincronicidad de consultas ALTER {#synchronicity-of-alter-queries} - -Para tablas no replicables, todas `ALTER` las consultas se realizan de forma sincrónica. Para las tablas replicables, la consulta solo agrega instrucciones para las acciones apropiadas para `ZooKeeper`, y las acciones mismas se realizan tan pronto como sea posible. Sin embargo, la consulta puede esperar a que estas acciones se completen en todas las réplicas. - -Para `ALTER ... ATTACH|DETACH|DROP` consultas, puede utilizar el `replication_alter_partitions_sync` configuración para configurar la espera. -Valores posibles: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. - -### Mutación {#alter-mutations} - -Las mutaciones son una variante de consulta ALTER que permite cambiar o eliminar filas en una tabla. En contraste con el estándar `UPDATE` y `DELETE` consultas destinadas a cambios de datos puntuales, las mutaciones están destinadas a operaciones pesadas que cambian muchas filas en una tabla. Apoyado para el `MergeTree` familia de motores de mesa, incluidos los motores con soporte de replicación. - -Las tablas existentes están listas para las mutaciones tal como están (no es necesaria la conversión), pero después de que la primera mutación se aplica a una tabla, su formato de metadatos se vuelve incompatible con las versiones anteriores del servidor y volver a una versión anterior se vuelve imposible. - -Comandos disponibles actualmente: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -El `filter_expr` debe ser de tipo `UInt8`. La consulta elimina las filas de la tabla para la que esta expresión toma un valor distinto de cero. - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -El `filter_expr` debe ser de tipo `UInt8`. Esta consulta actualiza los valores de las columnas especificadas a los valores de las expresiones correspondientes `filter_expr` toma un valor distinto de cero. Los valores se convierten al tipo de columna utilizando el `CAST` operador. No se admite la actualización de columnas que se utilizan en el cálculo de la clave principal o de partición. - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -La consulta reconstruye el índice secundario `name` en la partición `partition_name`. - -Una consulta puede contener varios comandos separados por comas. - -Para las tablas \*MergeTree, las mutaciones se ejecutan reescribiendo partes de datos completas. No hay atomicidad - las partes se sustituyen por partes mutadas tan pronto como están listas y una `SELECT` La consulta que comenzó a ejecutarse durante una mutación verá datos de partes que ya han sido mutadas junto con datos de partes que aún no han sido mutadas. - -Las mutaciones están totalmente ordenadas por su orden de creación y se aplican a cada parte en ese orden. Las mutaciones también se ordenan parcialmente con INSERTs: los datos que se insertaron en la tabla antes de que se enviara la mutación se mutarán y los datos que se insertaron después de eso no se mutarán. Tenga en cuenta que las mutaciones no bloquean INSERTs de ninguna manera. - -Una consulta de mutación regresa inmediatamente después de agregar la entrada de mutación (en el caso de tablas replicadas a ZooKeeper, para tablas no replicadas, al sistema de archivos). La mutación en sí se ejecuta de forma asíncrona utilizando la configuración del perfil del sistema. Para realizar un seguimiento del progreso de las mutaciones, puede usar el [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) tabla. Una mutación que se envió correctamente continuará ejecutándose incluso si se reinician los servidores ClickHouse. No hay forma de revertir la mutación una vez que se presenta, pero si la mutación está atascada por alguna razón, puede cancelarse con el [`KILL MUTATION`](misc.md#kill-mutation) consulta. - -Las entradas de mutaciones terminadas no se eliminan de inmediato (el número de entradas conservadas viene determinado por el `finished_mutations_to_keep` parámetro del motor de almacenamiento). Las entradas de mutación más antiguas se eliminan. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/es/sql_reference/statements/create.md b/docs/es/sql_reference/statements/create.md deleted file mode 100644 index eb81945335d..00000000000 --- a/docs/es/sql_reference/statements/create.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 35 -toc_title: CREATE ---- - -# CREATE Consultas {#create-queries} - -## CREATE DATABASE {#query-language-create-database} - -Crea una base de datos. - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] -``` - -### Clausula {#clauses} - -- `IF NOT EXISTS` - - If the `db_name` database already exists, then ClickHouse doesn't create a new database and: - - - Doesn't throw an exception if clause is specified. - - Throws an exception if clause isn't specified. - -- `ON CLUSTER` - - ClickHouse creates the `db_name` database on all the servers of a specified cluster. - -- `ENGINE` - - - [MySQL](../engines/database_engines/mysql.md) - - Allows you to retrieve data from the remote MySQL server. - - By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). - -## CREATE TABLE {#create-table-query} - -El `CREATE TABLE` consulta puede tener varias formas. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], - ... -) ENGINE = engine -``` - -Crea una tabla llamada ‘name’ en el ‘db’ base de datos o la base de datos actual si ‘db’ no está establecida, con la estructura especificada entre paréntesis y ‘engine’ motor. -La estructura de la tabla es una lista de descripciones de columnas. Si los índices son compatibles con el motor, se indican como parámetros para el motor de tablas. - -Una descripción de columna es `name type` en el caso más simple. Ejemplo: `RegionID UInt32`. -Las expresiones también se pueden definir para los valores predeterminados (ver más abajo). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -Crea una tabla con la misma estructura que otra tabla. Puede especificar un motor diferente para la tabla. Si no se especifica el motor, se utilizará el mismo motor que para el `db2.name2` tabla. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() -``` - -Crea una tabla con la estructura y los datos [función de la tabla](../table_functions/index.md). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -Crea una tabla con una estructura como el resultado de la `SELECT` consulta, con el ‘engine’ motor, y lo llena con datos de SELECT. - -En todos los casos, si `IF NOT EXISTS` se especifica, la consulta no devolverá un error si la tabla ya existe. En este caso, la consulta no hará nada. - -Puede haber otras cláusulas después del `ENGINE` cláusula en la consulta. Consulte la documentación detallada sobre cómo crear tablas en las descripciones de [motores de mesa](../../engines/table_engines/index.md#table_engines). - -### Valores predeterminados {#create-default-values} - -La descripción de la columna puede especificar una expresión para un valor predeterminado, de una de las siguientes maneras:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. -Ejemplo: `URLDomain String DEFAULT domain(URL)`. - -Si no se define una expresión para el valor predeterminado, los valores predeterminados se establecerán en ceros para números, cadenas vacías para cadenas, matrices vacías para matrices y `0000-00-00` para fechas o `0000-00-00 00:00:00` para las fechas con el tiempo. Los NULL no son compatibles. - -Si se define la expresión predeterminada, el tipo de columna es opcional. Si no hay un tipo definido explícitamente, se utiliza el tipo de expresión predeterminado. Ejemplo: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ tipo será utilizado para el ‘EventDate’ columna. - -Si el tipo de datos y la expresión predeterminada se definen explícitamente, esta expresión se convertirá al tipo especificado utilizando funciones de conversión de tipos. Ejemplo: `Hits UInt32 DEFAULT 0` significa lo mismo que `Hits UInt32 DEFAULT toUInt32(0)`. - -Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don't contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. - -`DEFAULT expr` - -Valor predeterminado Normal. Si la consulta INSERT no especifica la columna correspondiente, se completará calculando la expresión correspondiente. - -`MATERIALIZED expr` - -Expresión materializada. Dicha columna no se puede especificar para INSERT, porque siempre se calcula. -Para un INSERT sin una lista de columnas, estas columnas no se consideran. -Además, esta columna no se sustituye cuando se utiliza un asterisco en una consulta SELECT. Esto es para preservar el invariante que el volcado obtuvo usando `SELECT *` se puede volver a insertar en la tabla usando INSERT sin especificar la lista de columnas. - -`ALIAS expr` - -Sinónimo. Tal columna no se almacena en la tabla en absoluto. -Sus valores no se pueden insertar en una tabla, y no se sustituye cuando se usa un asterisco en una consulta SELECT. -Se puede usar en SELECT si el alias se expande durante el análisis de consultas. - -Cuando se utiliza la consulta ALTER para agregar nuevas columnas, no se escriben datos antiguos para estas columnas. En su lugar, al leer datos antiguos que no tienen valores para las nuevas columnas, las expresiones se calculan sobre la marcha de forma predeterminada. Sin embargo, si la ejecución de las expresiones requiere diferentes columnas que no están indicadas en la consulta, estas columnas se leerán adicionalmente, pero solo para los bloques de datos que lo necesitan. - -Si agrega una nueva columna a una tabla pero luego cambia su expresión predeterminada, los valores utilizados para los datos antiguos cambiarán (para los datos donde los valores no se almacenaron en el disco). Tenga en cuenta que cuando se ejecutan combinaciones en segundo plano, los datos de las columnas que faltan en una de las partes de combinación se escriben en la parte combinada. - -No es posible establecer valores predeterminados para elementos en estructuras de datos anidadas. - -### Limitación {#constraints} - -Junto con las descripciones de columnas, se podrían definir restricciones: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` podría por cualquier expresión booleana. Si se definen restricciones para la tabla, cada una de ellas se verificará para cada fila en `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. - -Agregar una gran cantidad de restricciones puede afectar negativamente el rendimiento de grandes `INSERT` consulta. - -### Expresión TTL {#ttl-expression} - -Define el tiempo de almacenamiento de los valores. Solo se puede especificar para tablas de la familia MergeTree. Para la descripción detallada, ver [TTL para columnas y tablas](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). - -### Códecs de compresión de columna {#codecs} - -De forma predeterminada, ClickHouse aplica el `lz4` método de compresión. Para `MergeTree`- familia de motor puede cambiar el método de compresión predeterminado en el [compresión](../../operations/server_configuration_parameters/settings.md#server-settings-compression) sección de una configuración de servidor. También puede definir el método de compresión para cada columna `CREATE TABLE` consulta. - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -Si se especifica un códec, el códec predeterminado no se aplica. Los códecs se pueden combinar en una tubería, por ejemplo, `CODEC(Delta, ZSTD)`. Para seleccionar la mejor combinación de códecs para su proyecto, pase puntos de referencia similares a los descritos en Altinity [Nuevas codificaciones para mejorar la eficiencia de ClickHouse](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) artículo. - -!!! warning "Advertencia" - No puede descomprimir archivos de base de datos ClickHouse con utilidades externas como `lz4`. En su lugar, use el especial [Compresor de clickhouse](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) utilidad. - -La compresión es compatible con los siguientes motores de tablas: - -- [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md) familia. Admite códecs de compresión de columnas y selecciona el método de compresión predeterminado mediante [compresión](../../operations/server_configuration_parameters/settings.md#server-settings-compression) configuración. -- [Registro](../../engines/table_engines/log_family/log_family.md) familia. Utiliza el `lz4` método de compresión por defecto y soporta códecs de compresión de columna. -- [Establecer](../../engines/table_engines/special/set.md). Solo admite la compresión predeterminada. -- [Unir](../../engines/table_engines/special/join.md). Solo admite la compresión predeterminada. - -ClickHouse admite códecs de propósito común y códecs especializados. - -#### Especializados Codecs {#create-query-specialized-codecs} - -Estos códecs están diseñados para hacer que la compresión sea más efectiva mediante el uso de características específicas de los datos. Algunos de estos códecs no comprimen los datos por sí mismos. En su lugar, preparan los datos para un códec de propósito común, que lo comprime mejor que sin esta preparación. - -Especializados codecs: - -- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` se utilizan para almacenar valores delta, por lo que `delta_bytes` es el tamaño máximo de los valores brutos. Posible `delta_bytes` valores: 1, 2, 4, 8. El valor predeterminado para `delta_bytes` ser `sizeof(type)` si es igual a 1, 2, 4 u 8. En todos los demás casos, es 1. -- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorila: Una base de datos de series temporales rápida, escalable y en memoria](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorila: Una base de datos de series temporales rápida, escalable y en memoria](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` y `DateTime`). En cada paso de su algoritmo, el códec toma un bloque de 64 valores, los coloca en una matriz de 64x64 bits, lo transpone, recorta los bits de valores no utilizados y devuelve el resto como una secuencia. Los bits no utilizados son los bits, que no difieren entre los valores máximo y mínimo en toda la parte de datos para la que se utiliza la compresión. - -`DoubleDelta` y `Gorilla` códecs se utilizan en Gorilla TSDB como los componentes de su algoritmo de compresión. El enfoque de gorila es efectivo en escenarios en los que hay una secuencia de valores que cambian lentamente con sus marcas de tiempo. Las marcas de tiempo se comprimen efectivamente por el `DoubleDelta` códec, y los valores son efectivamente comprimidos por el `Gorilla` códec. Por ejemplo, para obtener una tabla almacenada efectivamente, puede crearla en la siguiente configuración: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### Propósito Común Codecs {#create-query-common-purpose-codecs} - -Códecs: - -- `NONE` — No compression. -- `LZ4` — Lossless [algoritmo de compresión de datos](https://github.com/lz4/lz4) utilizado por defecto. Aplica compresión rápida LZ4. -- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` aplica el nivel predeterminado. Niveles posibles: \[1, 12\]. Rango de nivel recomendado: \[4, 9\]. -- `ZSTD[(level)]` — [Algoritmo de compresión ZSTD](https://en.wikipedia.org/wiki/Zstandard) con configurable `level`. Niveles posibles: \[1, 22\]. Valor predeterminado: 1. - -Los altos niveles de compresión son útiles para escenarios asimétricos, como comprimir una vez, descomprimir repetidamente. Los niveles más altos significan una mejor compresión y un mayor uso de la CPU. - -## Tablas temporales {#temporary-tables} - -ClickHouse admite tablas temporales que tienen las siguientes características: - -- Las tablas temporales desaparecen cuando finaliza la sesión, incluso si se pierde la conexión. -- Una tabla temporal solo utiliza el motor de memoria. -- No se puede especificar la base de datos para una tabla temporal. Se crea fuera de las bases de datos. -- Imposible crear una tabla temporal con consulta DDL distribuida en todos los servidores de clúster (mediante `ON CLUSTER`): esta tabla sólo existe en la sesión actual. -- Si una tabla temporal tiene el mismo nombre que otra y una consulta especifica el nombre de la tabla sin especificar la base de datos, se utilizará la tabla temporal. -- Para el procesamiento de consultas distribuidas, las tablas temporales utilizadas en una consulta se pasan a servidores remotos. - -Para crear una tabla temporal, utilice la siguiente sintaxis: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -En la mayoría de los casos, las tablas temporales no se crean manualmente, sino cuando se utilizan datos externos para una consulta o para `(GLOBAL) IN`. Para obtener más información, consulte las secciones correspondientes - -Es posible usar tablas con [MOTOR = Memoria](../../engines/table_engines/special/memory.md) en lugar de tablas temporales. - -## Consultas DDL distribuidas (cláusula ON CLUSTER) {#distributed-ddl-queries-on-cluster-clause} - -El `CREATE`, `DROP`, `ALTER`, y `RENAME` las consultas admiten la ejecución distribuida en un clúster. -Por ejemplo, la siguiente consulta crea el `all_hits` `Distributed` la tabla en cada host `cluster`: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -Para ejecutar estas consultas correctamente, cada host debe tener la misma definición de clúster (para simplificar la sincronización de configuraciones, puede usar sustituciones de ZooKeeper). También deben conectarse a los servidores ZooKeeper. -La versión local de la consulta finalmente se implementará en cada host del clúster, incluso si algunos hosts no están disponibles actualmente. El orden para ejecutar consultas dentro de un único host está garantizado. - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -Crea una vista. Hay dos tipos de vistas: normal y MATERIALIZADO. - -Las vistas normales no almacenan ningún dato, solo realizan una lectura desde otra tabla. En otras palabras, una vista normal no es más que una consulta guardada. Al leer desde una vista, esta consulta guardada se utiliza como una subconsulta en la cláusula FROM. - -Como ejemplo, suponga que ha creado una vista: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -y escribió una consulta: - -``` sql -SELECT a, b, c FROM view -``` - -Esta consulta es totalmente equivalente a usar la subconsulta: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -Las vistas materializadas almacenan datos transformados por la consulta SELECT correspondiente. - -Al crear una vista materializada sin `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. - -Al crear una vista materializada con `TO [db].[table]` usted no debe usar `POPULATE`. - -Una vista materializada se organiza de la siguiente manera: al insertar datos en la tabla especificada en SELECT, parte de los datos insertados se convierte mediante esta consulta SELECT y el resultado se inserta en la vista. - -Si especifica POPULATE, los datos de tabla existentes se insertan en la vista al crearlos, como si `CREATE TABLE ... AS SELECT ...` . De lo contrario, la consulta solo contiene los datos insertados en la tabla después de crear la vista. No recomendamos usar POPULATE, ya que los datos insertados en la tabla durante la creación de la vista no se insertarán en ella. - -A `SELECT` consulta puede contener `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` se establece, los datos se agregan durante la inserción, pero solo dentro de un solo paquete de datos insertados. Los datos no se agregarán más. La excepción es cuando se utiliza un ENGINE que realiza de forma independiente la agregación de datos, como `SummingMergeTree`. - -La ejecución de `ALTER` las consultas sobre vistas materializadas no se han desarrollado completamente, por lo que podrían ser inconvenientes. Si la vista materializada utiliza la construcción `TO [db.]name` puede `DETACH` la vista, ejecutar `ALTER` para la tabla de destino, y luego `ATTACH` el previamente separado (`DETACH`) vista. - -Las vistas tienen el mismo aspecto que las tablas normales. Por ejemplo, se enumeran en el resultado de la `SHOW TABLES` consulta. - -No hay una consulta separada para eliminar vistas. Para eliminar una vista, utilice `DROP TABLE`. - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` - -Crear [diccionario externo](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) con dado [estructura](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md), [fuente](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md), [diseño](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) y [vida](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md). - -La estructura del diccionario externo consta de atributos. Los atributos de diccionario se especifican de manera similar a las columnas de la tabla. La única propiedad de atributo requerida es su tipo, todas las demás propiedades pueden tener valores predeterminados. - -Dependiendo del diccionario [diseño](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) se pueden especificar uno o más atributos como claves de diccionario. - -Para obtener más información, consulte [Diccionarios externos](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) apartado. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/es/sql_reference/statements/insert_into.md b/docs/es/sql_reference/statements/insert_into.md deleted file mode 100644 index 3d3daffbb36..00000000000 --- a/docs/es/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 34 -toc_title: INSERT INTO ---- - -## INSERT {#insert} - -Adición de datos. - -Formato de consulta básico: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -La consulta puede especificar una lista de columnas para insertar `[(c1, c2, c3)]`. En este caso, el resto de las columnas se llenan con: - -- Los valores calculados a partir del `DEFAULT` expresiones especificadas en la definición de la tabla. -- Ceros y cadenas vacías, si `DEFAULT` expresiones no están definidas. - -Si [strict\_insert\_defaults=1](../../operations/settings/settings.md), columnas que no tienen `DEFAULT` definido debe figurar en la consulta. - -Los datos se pueden pasar al INSERT en cualquier [formato](../../interfaces/formats.md#formats) con el apoyo de ClickHouse. El formato debe especificarse explícitamente en la consulta: - -``` sql -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: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -ClickHouse elimina todos los espacios y un avance de línea (si hay uno) antes de los datos. Al formar una consulta, recomendamos colocar los datos en una nueva línea después de los operadores de consulta (esto es importante si los datos comienzan con espacios). - -Ejemplo: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -Puede insertar datos por separado de la consulta mediante el cliente de línea de comandos o la interfaz HTTP. Para obtener más información, consulte la sección “[Interfaz](../../interfaces/index.md#interfaces)”. - -### Limitación {#constraints} - -Si la tabla tiene [limitación](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. - -### Insertar los resultados de `SELECT` {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -Las columnas se asignan de acuerdo con su posición en la cláusula SELECT. Sin embargo, sus nombres en la expresión SELECT y la tabla para INSERT pueden diferir. Si es necesario, se realiza la fundición de tipo. - -Ninguno de los formatos de datos, excepto Valores, permite establecer valores para expresiones como `now()`, `1 + 2` y así sucesivamente. El formato Values permite el uso limitado de expresiones, pero esto no se recomienda, porque en este caso se usa código ineficiente para su ejecución. - -No se admiten otras consultas para modificar partes de datos: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. -Sin embargo, puede eliminar datos antiguos usando `ALTER TABLE ... DROP PARTITION`. - -`FORMAT` cláusula debe especificarse al final de la consulta si `SELECT` cláusula contiene la función de tabla [entrada()](../table_functions/input.md). - -### Consideraciones de rendimiento {#performance-considerations} - -`INSERT` ordena los datos de entrada por clave principal y los divide en particiones por una clave de partición. Si inserta datos en varias particiones a la vez, puede reducir significativamente el rendimiento del `INSERT` consulta. Para evitar esto: - -- Agregue datos en lotes bastante grandes, como 100.000 filas a la vez. -- Agrupe los datos por una clave de partición antes de cargarlos en ClickHouse. - -El rendimiento no disminuirá si: - -- Se agregan datos en tiempo real. -- Cargar los datos que generalmente se ordenan por el tiempo. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/es/sql_reference/statements/misc.md b/docs/es/sql_reference/statements/misc.md deleted file mode 100644 index 7be8994313b..00000000000 --- a/docs/es/sql_reference/statements/misc.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 39 -toc_title: Otro ---- - -# Consultas Misceláneas {#miscellaneous-queries} - -## ATTACH {#attach} - -Esta consulta es exactamente la misma que `CREATE`, pero - -- En lugar de la palabra `CREATE` utiliza la palabra `ATTACH`. -- La consulta no crea datos en el disco, pero supone que los datos ya están en los lugares apropiados, y simplemente agrega información sobre la tabla al servidor. - Después de ejecutar una consulta ATTACH, el servidor sabrá sobre la existencia de la tabla. - -Si la tabla se separó previamente (`DETACH`), lo que significa que su estructura es conocida, puede usar taquigrafía sin definir la estructura. - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Esta consulta se utiliza al iniciar el servidor. El servidor almacena los metadatos de la tabla como archivos con `ATTACH` consultas, que simplemente se ejecuta en el lanzamiento (con la excepción de las tablas del sistema, que se crean explícitamente en el servidor). - -## CHECK TABLE {#check-table} - -Comprueba si los datos de la tabla están dañados. - -``` sql -CHECK TABLE [db.]name -``` - -El `CHECK TABLE` query compara los tamaños de archivo reales con los valores esperados que se almacenan en el servidor. Si los tamaños de archivo no coinciden con los valores almacenados, significa que los datos están dañados. Esto puede deberse, por ejemplo, a un bloqueo del sistema durante la ejecución de la consulta. - -La respuesta de consulta contiene el `result` columna con una sola fila. La fila tiene un valor de -[Booleana](../../sql_reference/data_types/boolean.md) tipo: - -- 0 - Los datos de la tabla están dañados. -- 1 - Los datos mantienen la integridad. - -El `CHECK TABLE` query admite los siguientes motores de tablas: - -- [Registro](../../engines/table_engines/log_family/log.md) -- [TinyLog](../../engines/table_engines/log_family/tinylog.md) -- [StripeLog](../../engines/table_engines/log_family/stripelog.md) -- [Familia MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) - -Realizado sobre las tablas con otros motores de tabla causa una excepción. - -Motores del `*Log` la familia no proporciona la recuperación automática de datos en caso de fallo. Utilice el `CHECK TABLE` consulta para rastrear la pérdida de datos de manera oportuna. - -Para `MergeTree` motores familiares, el `CHECK TABLE` query muestra un estado de comprobación para cada parte de datos individual de una tabla en el servidor local. - -**Si los datos están dañados** - -Si la tabla está dañada, puede copiar los datos no dañados a otra tabla. Para hacer esto: - -1. Cree una nueva tabla con la misma estructura que la tabla dañada. Para ello, ejecute la consulta `CREATE TABLE AS `. -2. Establezca el [max\_threads](../../operations/settings/settings.md#settings-max_threads) valor a 1 para procesar la siguiente consulta en un único subproceso. Para ello, ejecute la consulta `SET max_threads = 1`. -3. Ejecutar la consulta `INSERT INTO SELECT * FROM `. Esta solicitud copia los datos no dañados de la tabla dañada a otra tabla. Solo se copiarán los datos anteriores a la parte dañada. -4. Reinicie el `clickhouse-client` para restablecer el `max_threads` valor. - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Devuelve lo siguiente `String` tipo columnas: - -- `name` — Column name. -- `type`— Column type. -- `default_type` — Clause that is used in [expresión predeterminada](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` o `ALIAS`). La columna contiene una cadena vacía, si no se especifica la expresión predeterminada. -- `default_expression` — Value specified in the `DEFAULT` clausula. -- `comment_expression` — Comment text. - -Las estructuras de datos anidadas se generan en “expanded” formato. Cada columna se muestra por separado, con el nombre después de un punto. - -## DETACH {#detach} - -Elimina información sobre el ‘name’ tabla desde el servidor. El servidor deja de saber sobre la existencia de la tabla. - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Esto no elimina los datos ni los metadatos de la tabla. En el próximo lanzamiento del servidor, el servidor leerá los metadatos y volverá a conocer la tabla. -Del mismo modo, un “detached” se puede volver a conectar usando el `ATTACH` consulta (con la excepción de las tablas del sistema, que no tienen metadatos almacenados para ellas). - -No hay `DETACH DATABASE` consulta. - -## DROP {#drop} - -Esta consulta tiene dos tipos: `DROP DATABASE` y `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -Elimina todas las tablas dentro del ‘db’ base de datos, a continuación, elimina ‘db’ base de datos en sí. -Si `IF EXISTS` se especifica, no devuelve un error si la base de datos no existe. - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Elimina la tabla. -Si `IF EXISTS` se especifica, no devuelve un error si la tabla no existe o la base de datos no existe. - - DROP DICTIONARY [IF EXISTS] [db.]name - -Elimina el diccionario. -Si `IF EXISTS` se especifica, no devuelve un error si la tabla no existe o la base de datos no existe. - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -Devuelve una sola `UInt8`columna -type, que contiene el valor único `0` si la tabla o base de datos no existe, o `1` si la tabla existe en la base de datos especificada. - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -Intenta terminar por la fuerza las consultas que se están ejecutando actualmente. -Las consultas a finalizar se seleccionan en el sistema.tabla de procesos utilizando los criterios definidos en el `WHERE` cláusula de la `KILL` consulta. - -Ejemplos: - -``` sql --- Forcibly terminates all queries with the specified query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Synchronously terminates all queries run by 'username': -KILL QUERY WHERE user='username' SYNC -``` - -Los usuarios de solo lectura solo pueden detener sus propias consultas. - -De forma predeterminada, se utiliza la versión asincrónica de las consultas (`ASYNC`), que no espera la confirmación de que las consultas se han detenido. - -La versión síncrona (`SYNC`) espera a que se detengan todas las consultas y muestra información sobre cada proceso a medida que se detiene. -La respuesta contiene el `kill_status` columna, que puede tomar los siguientes valores: - -1. ‘finished’ – The query was terminated successfully. -2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. -3. The other values ​​explain why the query can't be stopped. - -Una consulta de prueba (`TEST`) sólo comprueba los derechos del usuario y muestra una lista de consultas para detener. - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -Intenta cancelar y quitar [mutación](alter.md#alter-mutations) que se están ejecutando actualmente. Las mutaciones para cancelar se seleccionan en el [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) utilizando el filtro especificado por el `WHERE` cláusula de la `KILL` consulta. - -Una consulta de prueba (`TEST`) sólo comprueba los derechos del usuario y muestra una lista de consultas para detener. - -Ejemplos: - -``` sql --- Cancel and remove all mutations of the single table: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Cancel the specific mutation: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). - -Los cambios ya realizados por la mutación no se revierten. - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -Esta consulta intenta inicializar una combinación no programada de partes de datos para tablas con un motor de tablas [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md) familia. - -El `OPTMIZE` consulta también es compatible con el [Método de codificación de datos:](../../engines/table_engines/special/materializedview.md) y el [Búfer](../../engines/table_engines/special/buffer.md) motor. No se admiten otros motores de tabla. - -Cuando `OPTIMIZE` se utiliza con el [ReplicatedMergeTree](../../engines/table_engines/mergetree_family/replication.md) la familia de motores de tablas, ClickHouse crea una tarea para fusionar y espera la ejecución en todos los nodos (si `replication_alter_partitions_sync` está habilitada la configuración). - -- Si `OPTIMIZE` no realiza una fusión por ningún motivo, no notifica al cliente. Para habilitar las notificaciones, [Optize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) configuración. -- Si especifica un `PARTITION`, sólo la partición especificada está optimizada. [Cómo establecer la expresión de partición](alter.md#alter-how-to-specify-part-expr). -- Si especifica `FINAL`, la optimización se realiza incluso cuando todos los datos ya están en una parte. -- Si especifica `DEDUPLICATE`, luego se deduplicarán filas completamente idénticas (se comparan todas las columnas), tiene sentido solo para el motor MergeTree. - -!!! warning "Advertencia" - `OPTIMIZE` no se puede arreglar el “Too many parts” error. - -## RENAME {#misc_operations-rename} - -Cambia el nombre de una o más tablas. - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -Todas las tablas se renombran bajo bloqueo global. Cambiar el nombre de las tablas es una operación ligera. Si ha indicado otra base de datos después de TO, la tabla se moverá a esta base de datos. Sin embargo, los directorios con bases de datos deben residir en el mismo sistema de archivos (de lo contrario, se devuelve un error). - -## SET {#query-set} - -``` sql -SET param = value -``` - -Asignar `value` a la `param` [configuración](../../operations/settings/index.md) para la sesión actual. No se puede cambiar [configuración del servidor](../../operations/server_configuration_parameters/index.md) de esta manera. - -También puede establecer todos los valores del perfil de configuración especificado en una sola consulta. - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -Para obtener más información, consulte [Configuración](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Elimina todos los datos de una tabla. Cuando la cláusula `IF EXISTS` se omite, la consulta devuelve un error si la tabla no existe. - -El `TRUNCATE` consulta no es compatible con [Vista](../../engines/table_engines/special/view.md), [File](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) y [Nulo](../../engines/table_engines/special/null.md) motores de mesa. - -## USE {#use} - -``` sql -USE db -``` - -Permite establecer la base de datos actual para la sesión. -La base de datos actual se utiliza para buscar tablas si la base de datos no está definida explícitamente en la consulta con un punto antes del nombre de la tabla. -Esta consulta no se puede realizar cuando se usa el protocolo HTTP, ya que no existe un concepto de sesión. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/es/sql_reference/statements/select.md b/docs/es/sql_reference/statements/select.md deleted file mode 100644 index 5cdcf1008cb..00000000000 --- a/docs/es/sql_reference/statements/select.md +++ /dev/null @@ -1,610 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 33 -toc_title: SELECT ---- - -# SELECCIONAR consultas Sintaxis {#select-queries-syntax} - -`SELECT` realiza la recuperación de datos. - -``` sql -[WITH expr_list|(subquery)] -SELECT [DISTINCT] expr_list -[FROM [db.]table | (subquery) | table_function] [FINAL] -[SAMPLE sample_coeff] -[ARRAY JOIN ...] -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list -[PREWHERE expr] -[WHERE expr] -[GROUP BY expr_list] [WITH TOTALS] -[HAVING expr] -[ORDER BY expr_list] -[LIMIT [offset_value, ]n BY columns] -[LIMIT [n, ]m] -[UNION ALL ...] -[INTO OUTFILE filename] -[FORMAT format] -``` - -Todas las cláusulas son opcionales, excepto la lista requerida de expresiones inmediatamente después de SELECT. -Las siguientes cláusulas se describen casi en el mismo orden que en el transportador de ejecución de consultas. - -Si la consulta omite el `DISTINCT`, `GROUP BY` y `ORDER BY` cláusulas y el `IN` y `JOIN` subconsultas, la consulta se procesará por completo, utilizando O (1) cantidad de RAM. -De lo contrario, la consulta podría consumir mucha RAM si no se especifican las restricciones adecuadas: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Para obtener más información, consulte la sección “Settings”. Es posible utilizar la clasificación externa (guardar tablas temporales en un disco) y la agregación externa. `The system does not have "merge join"`. - -### CON Cláusula {#with-clause} - -Esta sección proporciona soporte para expresiones de tabla común ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), con algunas limitaciones: -1. No se admiten consultas recursivas -2. Cuando se usa una subconsulta dentro de la sección WITH, su resultado debe ser escalar con exactamente una fila -3. Los resultados de la expresión no están disponibles en las subconsultas -Los resultados de las expresiones de la cláusula WITH se pueden usar dentro de la cláusula SELECT. - -Ejemplo 1: Usar expresión constante como “variable” - -``` sql -WITH '2019-08-01 15:23:00' as ts_upper_bound -SELECT * -FROM hits -WHERE - EventDate = toDate(ts_upper_bound) AND - EventTime <= ts_upper_bound -``` - -Ejemplo 2: Evictar el resultado de la expresión de sum(bytes) de la lista de columnas de la cláusula SELECT - -``` sql -WITH sum(bytes) as s -SELECT - formatReadableSize(s), - table -FROM system.parts -GROUP BY table -ORDER BY s -``` - -Ejemplo 3: Uso de los resultados de la subconsulta escalar - -``` sql -/* this example would return TOP 10 of most huge tables */ -WITH - ( - SELECT sum(bytes) - FROM system.parts - WHERE active - ) AS total_disk_usage -SELECT - (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, - table -FROM system.parts -GROUP BY table -ORDER BY table_disk_usage DESC -LIMIT 10 -``` - -Ejemplo 4: Reutilización de la expresión en subconsulta -Como solución alternativa para la limitación actual para el uso de expresiones en subconsultas, puede duplicarla. - -``` sql -WITH ['hello'] AS hello -SELECT - hello, - * -FROM -( - WITH ['hello'] AS hello - SELECT hello -) -``` - -``` text -┌─hello─────┬─hello─────┐ -│ ['hello'] │ ['hello'] │ -└───────────┴───────────┘ -``` - -### Cláusula FROM {#select-from} - -Si se omite la cláusula FROM, los datos se leerán desde el `system.one` tabla. -El `system.one` table contiene exactamente una fila (esta tabla cumple el mismo propósito que la tabla DUAL que se encuentra en otros DBMS). - -El `FROM` cláusula especifica la fuente de la que se leen los datos: - -- Tabla -- Subconsultas -- [Función de la tabla](../table_functions/index.md) - -`ARRAY JOIN` y el regular `JOIN` también se pueden incluir (ver más abajo). - -En lugar de una tabla, el `SELECT` subconsulta se puede especificar entre paréntesis. -A diferencia del SQL estándar, no es necesario especificar un sinónimo después de una subconsulta. - -Para ejecutar una consulta, todas las columnas enumeradas en la consulta se extraen de la tabla adecuada. Las columnas no necesarias para la consulta externa se eliminan de las subconsultas. -Si una consulta no muestra ninguna columnas (por ejemplo, `SELECT count() FROM t`), alguna columna se extrae de la tabla de todos modos (se prefiere la más pequeña), para calcular el número de filas. - -#### Modificador FINAL {#select-from-final} - -Aplicable al seleccionar datos de tablas del [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md)-Familia de motores distintos de `GraphiteMergeTree`. Cuando `FINAL` se especifica, ClickHouse fusiona completamente los datos antes de devolver el resultado y, por lo tanto, realiza todas las transformaciones de datos que ocurren durante las fusiones para el motor de tabla dado. - -También soportado para: -- [Replicado](../../engines/table_engines/mergetree_family/replication.md) versiones de `MergeTree` motor. -- [Vista](../../engines/table_engines/special/view.md), [Búfer](../../engines/table_engines/special/buffer.md), [Distribuido](../../engines/table_engines/special/distributed.md), y [Método de codificación de datos:](../../engines/table_engines/special/materializedview.md) motores que funcionan sobre otros motores, siempre que se hayan creado sobre `MergeTree`-mesas de motor. - -Consultas que usan `FINAL` se ejecutan no tan rápido como consultas similares que no lo hacen, porque: - -- La consulta se ejecuta en un solo subproceso y los datos se combinan durante la ejecución de la consulta. -- Consultas con `FINAL` leer columnas de clave primaria además de las columnas especificadas en la consulta. - -En la mayoría de los casos, evite usar `FINAL`. - -### Cláusula SAMPLE {#select-sample-clause} - -El `SAMPLE` cláusula permite un procesamiento de consultas aproximado. - -Cuando se habilita el muestreo de datos, la consulta no se realiza en todos los datos, sino solo en una cierta fracción de datos (muestra). Por ejemplo, si necesita calcular estadísticas para todas las visitas, es suficiente ejecutar la consulta en la fracción 1/10 de todas las visitas y luego multiplicar el resultado por 10. - -El procesamiento de consultas aproximado puede ser útil en los siguientes casos: - -- Cuando tiene requisitos de temporización estrictos (como \<100 ms) pero no puede justificar el costo de recursos de hardware adicionales para cumplirlos. -- Cuando sus datos sin procesar no son precisos, la aproximación no degrada notablemente la calidad. -- Los requisitos comerciales se centran en los resultados aproximados (por rentabilidad o para comercializar los resultados exactos a los usuarios premium). - -!!! note "Nota" - Sólo puede utilizar el muestreo con las tablas en el [Método de codificación de datos:](../../engines/table_engines/mergetree_family/mergetree.md) familia, y sólo si la expresión de muestreo se especificó durante la creación de la tabla (ver [Motor MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table)). - -Las características del muestreo de datos se enumeran a continuación: - -- El muestreo de datos es un mecanismo determinista. El resultado de la misma `SELECT .. SAMPLE` la consulta es siempre la misma. -- El muestreo funciona consistentemente para diferentes tablas. Para tablas con una sola clave de muestreo, una muestra con el mismo coeficiente siempre selecciona el mismo subconjunto de datos posibles. Por ejemplo, una muestra de ID de usuario toma filas con el mismo subconjunto de todos los ID de usuario posibles de diferentes tablas. Esto significa que puede utilizar el ejemplo en subconsultas [IN](#select-in-operators) clausula. Además, puede unir muestras usando el [JOIN](#select-join) clausula. -- El muestreo permite leer menos datos de un disco. Tenga en cuenta que debe especificar la clave de muestreo correctamente. Para obtener más información, consulte [Creación de una tabla MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -Para el `SAMPLE` cláusula se admite la siguiente sintaxis: - -| SAMPLE Clause Syntax | Descripci | -|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `SAMPLE k` | Aqui `k` es el número de 0 a 1.
La consulta se ejecuta en `k` de datos. Por ejemplo, `SAMPLE 0.1` ejecuta la consulta en el 10% de los datos. [Leer más](#select-sample-k) | -| `SAMPLE n` | Aqui `n` es un entero suficientemente grande.
La consulta se ejecuta en una muestra de al menos `n` filas (pero no significativamente más que esto). Por ejemplo, `SAMPLE 10000000` ejecuta la consulta en un mínimo de 10.000.000 de filas. [Leer más](#select-sample-n) | -| `SAMPLE k OFFSET m` | Aqui `k` y `m` son los números del 0 al 1.
La consulta se ejecuta en una muestra de `k` de los datos. Los datos utilizados para el ejemplo se compensan por `m` fracción. [Leer más](#select-sample-offset) | - -#### SAMPLE K {#select-sample-k} - -Aqui `k` es el número de 0 a 1 (se admiten notaciones fraccionarias y decimales). Por ejemplo, `SAMPLE 1/2` o `SAMPLE 0.5`. - -En un `SAMPLE k` cláusula, la muestra se toma de la `k` de datos. El ejemplo se muestra a continuación: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -En este ejemplo, la consulta se ejecuta en una muestra de 0,1 (10%) de datos. Los valores de las funciones agregadas no se corrigen automáticamente, por lo que para obtener un resultado aproximado, el valor `count()` se multiplica manualmente por 10. - -#### SAMPLE N {#select-sample-n} - -Aqui `n` es un entero suficientemente grande. Por ejemplo, `SAMPLE 10000000`. - -En este caso, la consulta se ejecuta en una muestra de al menos `n` filas (pero no significativamente más que esto). Por ejemplo, `SAMPLE 10000000` ejecuta la consulta en un mínimo de 10.000.000 de filas. - -Dado que la unidad mínima para la lectura de datos es un gránulo (su tamaño se establece mediante el `index_granularity` ajuste), tiene sentido establecer una muestra que es mucho más grande que el tamaño del gránulo. - -Cuando se utiliza el `SAMPLE n` cláusula, no sabe qué porcentaje relativo de datos se procesó. Por lo tanto, no sabe el coeficiente por el que se deben multiplicar las funciones agregadas. Utilice el `_sample_factor` columna virtual para obtener el resultado aproximado. - -El `_sample_factor` columna contiene coeficientes relativos que se calculan dinámicamente. Esta columna se crea automáticamente cuando [crear](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table) una tabla con la clave de muestreo especificada. Los ejemplos de uso del `_sample_factor` columna se muestran a continuación. - -Consideremos la tabla `visits`, que contiene las estadísticas sobre las visitas al sitio. El primer ejemplo muestra cómo calcular el número de páginas vistas: - -``` sql -SELECT sum(PageViews * _sample_factor) -FROM visits -SAMPLE 10000000 -``` - -El siguiente ejemplo muestra cómo calcular el número total de visitas: - -``` sql -SELECT sum(_sample_factor) -FROM visits -SAMPLE 10000000 -``` - -El siguiente ejemplo muestra cómo calcular la duración media de la sesión. Tenga en cuenta que no necesita usar el coeficiente relativo para calcular los valores promedio. - -``` sql -SELECT avg(Duration) -FROM visits -SAMPLE 10000000 -``` - -#### SAMPLE K OFFSET M {#select-sample-offset} - -Aqui `k` y `m` son números del 0 al 1. Los ejemplos se muestran a continuación. - -**Ejemplo 1** - -``` sql -SAMPLE 1/10 -``` - -En este ejemplo, la muestra es 1/10 de todos los datos: - -`[++------------]` - -**Ejemplo 2** - -``` sql -SAMPLE 1/10 OFFSET 1/2 -``` - -Aquí, se toma una muestra del 10% de la segunda mitad de los datos. - -`[------++------]` - -### ARRAY JOIN Cláusula {#select-array-join-clause} - -Permite ejecutar `JOIN` con una matriz o estructura de datos anidada. La intención es similar a la [arrayJoin](../../sql_reference/functions/array_join.md#functions_arrayjoin) función, pero su funcionalidad es más amplia. - -``` sql -SELECT -FROM -[LEFT] ARRAY JOIN -[WHERE|PREWHERE ] -... -``` - -Sólo puede especificar una sola `ARRAY JOIN` cláusula en una consulta. - -El orden de ejecución de la consulta se optimiza cuando se ejecuta `ARRAY JOIN`. Aunque `ARRAY JOIN` debe especificarse siempre antes de la `WHERE/PREWHERE` cláusula, se puede realizar ya sea antes `WHERE/PREWHERE` (si el resultado es necesario en esta cláusula), o después de completarlo (para reducir el volumen de cálculos). El optimizador de consultas controla el orden de procesamiento. - -Tipos admitidos de `ARRAY JOIN` se enumeran a continuación: - -- `ARRAY JOIN` - En este caso, las matrices vacías no se incluyen en el resultado de `JOIN`. -- `LEFT ARRAY JOIN` - El resultado de `JOIN` contiene filas con matrices vacías. El valor de una matriz vacía se establece en el valor predeterminado para el tipo de elemento de matriz (normalmente 0, cadena vacía o NULL). - -Los siguientes ejemplos demuestran el uso de la `ARRAY JOIN` y `LEFT ARRAY JOIN` clausula. Vamos a crear una tabla con un [Matriz](../../sql_reference/data_types/array.md) escriba la columna e inserte valores en ella: - -``` sql -CREATE TABLE arrays_test -( - s String, - arr Array(UInt8) -) ENGINE = Memory; - -INSERT INTO arrays_test -VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); -``` - -``` text -┌─s───────────┬─arr─────┐ -│ Hello │ [1,2] │ -│ World │ [3,4,5] │ -│ Goodbye │ [] │ -└─────────────┴─────────┘ -``` - -El siguiente ejemplo utiliza el `ARRAY JOIN` clausula: - -``` sql -SELECT s, arr -FROM arrays_test -ARRAY JOIN arr; -``` - -``` text -┌─s─────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -└───────┴─────┘ -``` - -El siguiente ejemplo utiliza el `LEFT ARRAY JOIN` clausula: - -``` sql -SELECT s, arr -FROM arrays_test -LEFT ARRAY JOIN arr; -``` - -``` text -┌─s───────────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -│ Goodbye │ 0 │ -└─────────────┴─────┘ -``` - -#### Uso de alias {#using-aliases} - -Se puede especificar un alias para una matriz en el `ARRAY JOIN` clausula. En este caso, este alias puede acceder a un elemento de matriz, pero el nombre original tiene acceso a la matriz en sí. Ejemplo: - -``` sql -SELECT s, arr, a -FROM arrays_test -ARRAY JOIN arr AS a; -``` - -``` text -┌─s─────┬─arr─────┬─a─┐ -│ Hello │ [1,2] │ 1 │ -│ Hello │ [1,2] │ 2 │ -│ World │ [3,4,5] │ 3 │ -│ World │ [3,4,5] │ 4 │ -│ World │ [3,4,5] │ 5 │ -└───────┴─────────┴───┘ -``` - -Usando alias, puede realizar `ARRAY JOIN` con una matriz externa. Por ejemplo: - -``` sql -SELECT s, arr_external -FROM arrays_test -ARRAY JOIN [1, 2, 3] AS arr_external; -``` - -``` text -┌─s───────────┬─arr_external─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ Hello │ 3 │ -│ World │ 1 │ -│ World │ 2 │ -│ World │ 3 │ -│ Goodbye │ 1 │ -│ Goodbye │ 2 │ -│ Goodbye │ 3 │ -└─────────────┴──────────────┘ -``` - -Múltiples matrices se pueden separar por comas en el `ARRAY JOIN` clausula. En este caso, `JOIN` se realiza con ellos simultáneamente (la suma directa, no el producto cartesiano). Tenga en cuenta que todas las matrices deben tener el mismo tamaño. Ejemplo: - -``` sql -SELECT s, arr, a, num, mapped -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ -│ Hello │ [1,2] │ 1 │ 1 │ 2 │ -│ Hello │ [1,2] │ 2 │ 2 │ 3 │ -│ World │ [3,4,5] │ 3 │ 1 │ 4 │ -│ World │ [3,4,5] │ 4 │ 2 │ 5 │ -│ World │ [3,4,5] │ 5 │ 3 │ 6 │ -└───────┴─────────┴───┴─────┴────────┘ -``` - -El siguiente ejemplo utiliza el [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) función: - -``` sql -SELECT s, arr, a, num, arrayEnumerate(arr) -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ -│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ -│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ -│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ -│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ -│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ -└───────┴─────────┴───┴─────┴─────────────────────┘ -``` - -#### ARRAY JOIN con estructura de datos anidada {#array-join-with-nested-data-structure} - -`ARRAY`JOIN\`\` también funciona con [estructuras de datos anidados](../../sql_reference/data_types/nested_data_structures/nested.md). Ejemplo: - -``` sql -CREATE TABLE nested_test -( - s String, - nest Nested( - x UInt8, - y UInt32) -) ENGINE = Memory; - -INSERT INTO nested_test -VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); -``` - -``` text -┌─s───────┬─nest.x──┬─nest.y─────┐ -│ Hello │ [1,2] │ [10,20] │ -│ World │ [3,4,5] │ [30,40,50] │ -│ Goodbye │ [] │ [] │ -└─────────┴─────────┴────────────┘ -``` - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -Al especificar nombres de estructuras de datos anidadas en `ARRAY JOIN` el significado es el mismo `ARRAY JOIN` con todos los elementos de la matriz en los que consiste. Los ejemplos se enumeran a continuación: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`, `nest.y`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -Esta variación también tiene sentido: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─────┐ -│ Hello │ 1 │ [10,20] │ -│ Hello │ 2 │ [10,20] │ -│ World │ 3 │ [30,40,50] │ -│ World │ 4 │ [30,40,50] │ -│ World │ 5 │ [30,40,50] │ -└───────┴────────┴────────────┘ -``` - -Se puede usar un alias para una estructura de datos anidada, con el fin de seleccionar `JOIN` resultado o la matriz de origen. Ejemplo: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest AS n; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ -└───────┴─────┴─────┴─────────┴────────────┘ -``` - -Ejemplo de uso del [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) función: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num -FROM nested_test -ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ -└───────┴─────┴─────┴─────────┴────────────┴─────┘ -``` - -### Cláusula JOIN {#select-join} - -Se une a los datos en el [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) sentido. - -!!! info "Nota" - No relacionado con [ARRAY JOIN](#select-array-join-clause). - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN -(ON )|(USING ) ... -``` - -Los nombres de tabla se pueden especificar en lugar de `` y ``. Esto es equivalente a la `SELECT * FROM table` subconsulta, excepto en un caso especial cuando la tabla tiene [Unir](../../engines/table_engines/special/join.md) engine – an array prepared for joining. - -#### Tipos compatibles de `JOIN` {#select-join-types} - -- `INNER JOIN` (o `JOIN`) -- `LEFT JOIN` (o `LEFT OUTER JOIN`) -- `RIGHT JOIN` (o `RIGHT OUTER JOIN`) -- `FULL JOIN` (o `FULL OUTER JOIN`) -- `CROSS JOIN` (o `,` ) - -Ver el estándar [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) descripci. - -#### ÚNETE Múltiple {#multiple-join} - -Al realizar consultas, ClickHouse reescribe las uniones de varias tablas en la secuencia de uniones de dos tablas. Por ejemplo, si hay cuatro tablas para unir ClickHouse une la primera y la segunda, luego une el resultado con la tercera tabla, y en el último paso, se une a la cuarta. - -Si una consulta contiene el `WHERE` cláusula, ClickHouse intenta empujar hacia abajo los filtros de esta cláusula a través de la unión intermedia. Si no puede aplicar el filtro a cada unión intermedia, ClickHouse aplica los filtros después de que se completen todas las combinaciones. - -Recomendamos el `JOIN ON` o `JOIN USING` sintaxis para crear consultas. Por ejemplo: - -``` sql -SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a -``` - -Puede utilizar listas de tablas separadas por comas `FROM` clausula. Por ejemplo: - -``` sql -SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a -``` - -No mezcle estas sintaxis. - -ClickHouse no admite directamente la sintaxis con comas, por lo que no recomendamos usarlas. El algoritmo intenta reescribir la consulta en términos de `CROSS JOIN` y `INNER JOIN` y luego procede al procesamiento de consultas. Al reescribir la consulta, ClickHouse intenta optimizar el rendimiento y el consumo de memoria. De forma predeterminada, ClickHouse trata las comas como `INNER JOIN` cláusula y convierte `INNER JOIN` a `CROSS JOIN` cuando el algoritmo no puede garantizar que `INNER JOIN` devuelve los datos requeridos. - -#### Rigor {#select-join-strictness} - -- `ALL` — If the right table has several matching rows, ClickHouse creates a [Producto cartesiano](https://en.wikipedia.org/wiki/Cartesian_product) de filas coincidentes. Este es el estándar `JOIN` comportamiento en SQL. -- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` y `ALL` palabras clave son las mismas. -- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` el uso se describe a continuación. - -**ASOF JOIN Uso** - -`ASOF JOIN` es útil cuando necesita unir registros que no tienen una coincidencia exacta. - -Tablas para `ASOF JOIN` debe tener una columna de secuencia ordenada. Esta columna no puede estar sola en una tabla y debe ser uno de los tipos de datos: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`, y `DateTime`. - -Sintaxis `ASOF JOIN ... ON`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF LEFT JOIN table_2 -ON equi_cond AND closest_match_cond -``` - -Puede usar cualquier número de condiciones de igualdad y exactamente una condición de coincidencia más cercana. Por ejemplo, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. - -Condiciones admitidas para la coincidencia más cercana: `>`, `>=`, `<`, `<=`. - -Sintaxis `ASOF JOIN ... USING`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF JOIN table_2 -USING (equi_column1, ... equi_columnN, asof_column) -``` - -`ASOF JOIN` utilizar `equi_columnX` para unirse a la igualdad y `asof_column` para unirse en el partido más cercano con el `table_1.asof_column >= table_2.asof_column` condición. El `asof_column` columna siempre el último en el `USING` clausula. - -Por ejemplo, considere las siguientes tablas: - -\`\`\` texto -table\_1 table\_2 - -evento \| ev\_time \| user\_id evento \| ev\_time \| user\_id diff --git a/docs/es/sql_reference/statements/show.md b/docs/es/sql_reference/statements/show.md deleted file mode 100644 index 264bdaaa519..00000000000 --- a/docs/es/sql_reference/statements/show.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 38 -toc_title: SHOW ---- - -# MOSTRAR consultas {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Devuelve una sola `String`-tipo ‘statement’ column, which contains a single value – the `CREATE` consulta utilizada para crear el objeto especificado. - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -Imprime una lista de todas las bases de datos. -Esta consulta es idéntica a `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -Envía el contenido de la [sistema.procesa](../../operations/system_tables.md#system_tables-processes) tabla, que contiene una lista de consultas que se están procesando en este momento, exceptuando `SHOW PROCESSLIST` consulta. - -El `SELECT * FROM system.processes` query devuelve datos sobre todas las consultas actuales. - -Consejo (ejecutar en la consola): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -Muestra una lista de tablas. - -``` sql -SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Si el `FROM` no se especifica la cláusula, la consulta devuelve la lista de tablas de la base de datos actual. - -Puede obtener los mismos resultados que el `SHOW TABLES` consulta de la siguiente manera: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Ejemplo** - -La siguiente consulta selecciona las dos primeras filas de la lista de tablas `system` base de datos, cuyos nombres contienen `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -Muestra una lista de [diccionarios externos](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Si el `FROM` no se especifica la cláusula, la consulta devuelve la lista de diccionarios de la base de datos actual. - -Puede obtener los mismos resultados que el `SHOW DICTIONARIES` consulta de la siguiente manera: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Ejemplo** - -La siguiente consulta selecciona las dos primeras filas de la lista de tablas `system` base de datos, cuyos nombres contienen `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/es/sql_reference/statements/system.md b/docs/es/sql_reference/statements/system.md deleted file mode 100644 index ddb0a5aa84f..00000000000 --- a/docs/es/sql_reference/statements/system.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 37 -toc_title: SYSTEM ---- - -# Consultas del sistema {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -Vuelve a cargar todos los diccionarios que se han cargado correctamente antes. -De forma predeterminada, los diccionarios se cargan perezosamente (ver [Diccionarios\_lazy\_load](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), por lo que en lugar de cargarse automáticamente al inicio, se inicializan en el primer acceso a través de la función dictGet o SELECT desde tablas con ENGINE = Dictionary . El `SYSTEM RELOAD DICTIONARIES` consulta vuelve a cargar dichos diccionarios (LOADED). -Siempre vuelve `Ok.` independientemente del resultado de la actualización del diccionario. - -## RELOAD DICTIONARY Dictionary\_name {#query_language-system-reload-dictionary} - -Recarga completamente un diccionario `dictionary_name`, independientemente del estado del diccionario (LOADED / NOT\_LOADED / FAILED). -Siempre vuelve `Ok.` independientemente del resultado de la actualización del diccionario. -El estado del diccionario se puede comprobar consultando el `system.dictionaries` tabla. - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -Restablece la caché DNS interna de ClickHouse. A veces (para versiones anteriores de ClickHouse) es necesario usar este comando al cambiar la infraestructura (cambiar la dirección IP de otro servidor de ClickHouse o el servidor utilizado por los diccionarios). - -Para obtener una administración de caché más conveniente (automática), consulte disable\_internal\_dns\_cache, dns\_cache\_update\_period parameters. - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -Restablece la caché de marcas. Utilizado en el desarrollo de ClickHouse y pruebas de rendimiento. - -## FLUSH LOGS {#query_language-system-flush_logs} - -Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. - -## RELOAD CONFIG {#query_language-system-reload-config} - -Vuelve a cargar la configuración de ClickHouse. Se usa cuando la configuración se almacena en ZooKeeeper. - -## SHUTDOWN {#query_language-system-shutdown} - -Normalmente se apaga ClickHouse (como `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -Anula el proceso de ClickHouse (como `kill -9 {$ pid_clickhouse-server}`) - -## Administración de tablas distribuidas {#query-language-system-distributed} - -ClickHouse puede administrar [distribuido](../../engines/table_engines/special/distributed.md) tabla. Cuando un usuario inserta datos en estas tablas, ClickHouse primero crea una cola de los datos que se deben enviar a los nodos del clúster y, a continuación, los envía de forma asincrónica. Puede administrar el procesamiento de colas con el [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed), y [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) consulta. También puede insertar sincrónicamente datos distribuidos con el `insert_distributed_sync` configuración. - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -Deshabilita la distribución de datos en segundo plano al insertar datos en tablas distribuidas. - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -Obliga a ClickHouse a enviar datos a nodos de clúster de forma sincrónica. Si algún nodo no está disponible, ClickHouse produce una excepción y detiene la ejecución de la consulta. Puede volver a intentar la consulta hasta que tenga éxito, lo que sucederá cuando todos los nodos estén nuevamente en línea. - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -Habilita la distribución de datos en segundo plano al insertar datos en tablas distribuidas. - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -Proporciona la posibilidad de detener las fusiones en segundo plano para las tablas de la familia MergeTree: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "Nota" - `DETACH / ATTACH` la tabla comenzará las fusiones de fondo para la tabla, incluso en caso de que las fusiones se hayan detenido para todas las tablas MergeTree antes. - -### START MERGES {#query_language-system-start-merges} - -Proporciona la posibilidad de iniciar fusiones en segundo plano para tablas de la familia MergeTree: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/es/sql_reference/syntax.md b/docs/es/sql_reference/syntax.md deleted file mode 100644 index 1a9e643107a..00000000000 --- a/docs/es/sql_reference/syntax.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 31 -toc_title: Sintaxis ---- - -# Sintaxis {#syntax} - -Hay dos tipos de analizadores en el sistema: el analizador SQL completo (un analizador de descenso recursivo) y el analizador de formato de datos (un analizador de flujo rápido). -En todos los casos, excepto el `INSERT` consulta, sólo se utiliza el analizador SQL completo. -El `INSERT` consulta utiliza ambos analizadores: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -El `INSERT INTO t VALUES` fragmento es analizado por el analizador completo, y los datos `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` es analizado por el analizador de flujo rápido. También puede activar el analizador completo de los datos mediante el [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) configuración. Cuando `input_format_values_interpret_expressions = 1`, ClickHouse primero intenta analizar valores con el analizador de flujo rápido. Si falla, ClickHouse intenta usar el analizador completo para los datos, tratándolo como un SQL [expresion](#syntax-expressions). - -Los datos pueden tener cualquier formato. Cuando se recibe una consulta, el servidor no calcula más de [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) bytes de la solicitud en RAM (por defecto, 1 MB), y el resto se analiza la secuencia. -Esto significa que el sistema no tiene problemas con `INSERT` consultas, como lo hace MySQL. - -Cuando se utiliza el `Values` formato en un `INSERT` consulta, puede parecer que los datos se analizan igual que las expresiones en un `SELECT` consulta, pero esto no es cierto. El `Values` formato es mucho más limitado. - -A continuación cubriremos el analizador completo. Para obtener más información sobre los analizadores de formato, consulte [Formato](../interfaces/formats.md) apartado. - -## Espacio {#spaces} - -Puede haber cualquier número de símbolos de espacio entre las construcciones sintácticas (incluidos el principio y el final de una consulta). Los símbolos de espacio incluyen el espacio, tabulación, avance de línea, CR y avance de formulario. - -## Comentario {#comments} - -Se admiten comentarios de estilo SQL y de estilo C. -Comentarios de estilo SQL: desde `--` al final de la línea. El espacio después `--` se puede omitir. -Comentarios en estilo C: de `/*` a `*/`. Estos comentarios pueden ser multilínea. Tampoco se requieren espacios aquí. - -## Palabras clave {#syntax-keywords} - -Las palabras clave no distinguen entre mayúsculas y minúsculas cuando corresponden a: - -- Estándar SQL. Por ejemplo, `SELECT`, `select` y `SeLeCt` son todos válidos. -- Implementación en algunos DBMS populares (MySQL o Postgres). Por ejemplo, `DateTime` es lo mismo que `datetime`. - -Si el nombre del tipo de datos distingue entre mayúsculas y minúsculas `system.data_type_families` tabla. - -A diferencia del SQL estándar, todas las demás palabras clave (incluidos los nombres de las funciones) son **minúsculas**. - -Las palabras clave no están reservadas (simplemente se analizan como palabras clave en el contexto correspondiente). Si usted usa [identificador](#syntax-identifiers) lo mismo que las palabras clave, encerrarlas entre comillas. Por ejemplo, la consulta `SELECT "FROM" FROM table_name` es válido si la tabla `table_name` tiene columna con el nombre `"FROM"`. - -## Identificador {#syntax-identifiers} - -Los identificadores son: - -- Nombres de clúster, base de datos, tabla, partición y columna. -- Función. -- Tipos de datos. -- [Alias de expresión](#syntax-expression_aliases). - -Los identificadores pueden ser citados o no citados. Se recomienda utilizar identificadores no citados. - -Los identificadores no citados deben coincidir con la expresión regular `^[a-zA-Z_][0-9a-zA-Z_]*$` y no puede ser igual a [Palabras clave](#syntax-keywords). Ejemplos: `x, _1, X_y__Z123_.` - -Si desea utilizar identificadores iguales a las palabras clave o si desea utilizar otros símbolos en los identificadores, cítelo con comillas dobles o retrocesos, por ejemplo, `"id"`, `` `id` ``. - -## Literal {#literals} - -Hay: numérico, cadena, compuesto y `NULL` literal. - -### Numérico {#numeric} - -Un literal numérico, intenta ser analizado: - -- Primero como un número firmado de 64 bits, usando el [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) función. -- Si no tiene éxito, como un número de 64 bits sin signo, [Sistema abierto.](https://en.cppreference.com/w/cpp/string/byte/strtol) función. -- Si no tiene éxito, como un número de punto flotante [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) función. -- De lo contrario, se devuelve un error. - -El valor correspondiente tendrá el tipo más pequeño en el que se ajuste el valor. -Por ejemplo, 1 se analiza como `UInt8` pero 256 se analiza como `UInt16`. Para obtener más información, consulte [Tipos de datos](../sql_reference/data_types/index.md). - -Ejemplos: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### Cadena {#syntax-string-literal} - -Solo se admiten literales de cadena entre comillas simples. Los caracteres incluidos se pueden escapar de barra invertida. Las siguientes secuencias de escape tienen un valor especial correspondiente: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. En todos los demás casos, secuencias de escape en el formato `\c`, donde `c` cualquier carácter, se convierten a `c`. Esto significa que puedes usar las secuencias `\'`y`\\`. El valor tendrá el [Cadena](../sql_reference/data_types/string.md) tipo. - -El conjunto mínimo de caracteres que necesita para escapar en literales de cadena: `'` y `\`. La comilla simple se puede escapar con la comilla simple, literales `'It\'s'` y `'It''s'` son iguales. - -### Compuesto {#compound} - -Las construcciones son compatibles con las matrices: `[1, 2, 3]` y tuplas: `(1, 'Hello, world!', 2)`.. -En realidad, estos no son literales, sino expresiones con el operador de creación de matriz y el operador de creación de tuplas, respectivamente. -Una matriz debe constar de al menos un elemento y una tupla debe tener al menos dos elementos. -Las tuplas tienen un propósito especial para su uso en el `IN` cláusula de un `SELECT` consulta. Las tuplas se pueden obtener como resultado de una consulta, pero no se pueden guardar en una base de datos (con la excepción de [Memoria](../engines/table_engines/special/memory.md) tabla). - -### NULL {#null-literal} - -Indica que falta el valor. - -Para almacenar `NULL` en un campo de tabla, debe ser del [NULL](../sql_reference/data_types/nullable.md) tipo. - -Dependiendo del formato de datos (entrada o salida), `NULL` puede tener una representación diferente. Para obtener más información, consulte la documentación de [Formatos de datos](../interfaces/formats.md#formats). - -Hay muchos matices para el procesamiento `NULL`. Por ejemplo, si al menos uno de los argumentos de una operación de comparación es `NULL` el resultado de esta operación también se `NULL`. Lo mismo es cierto para la multiplicación, la suma y otras operaciones. Para obtener más información, lea la documentación de cada operación. - -En las consultas, puede verificar `NULL` utilizando el [IS NULL](operators.md#operator-is-null) y [IS NOT NULL](operators.md) operadores y las funciones relacionadas `isNull` y `isNotNull`. - -## Función {#functions} - -Las funciones se escriben como un identificador con una lista de argumentos (posiblemente vacíos) entre paréntesis. A diferencia de SQL estándar, los corchetes son necesarios, incluso para una lista de argumentos vacía. Ejemplo: `now()`. -Hay funciones regulares y agregadas (ver la sección “Aggregate functions”). Algunas funciones agregadas pueden contener dos listas de argumentos entre paréntesis. Ejemplo: `quantile (0.9) (x)`. Estas funciones agregadas se llaman “parametric” funciones, y los argumentos en la primera lista se llaman “parameters”. La sintaxis de las funciones agregadas sin parámetros es la misma que para las funciones regulares. - -## Operador {#operators} - -Los operadores se convierten a sus funciones correspondientes durante el análisis de consultas, teniendo en cuenta su prioridad y asociatividad. -Por ejemplo, la expresión `1 + 2 * 3 + 4` se transforma a `plus(plus(1, multiply(2, 3)), 4)`. - -## Tipos de datos y motores de tabla de base de datos {#data_types-and-database-table-engines} - -Tipos de datos y motores de tablas en el `CREATE` las consultas se escriben de la misma manera que los identificadores o funciones. En otras palabras, pueden o no contener una lista de argumentos entre corchetes. Para obtener más información, consulte las secciones “Data types,” “Table engines,” y “CREATE”. - -## Alias de expresión {#syntax-expression_aliases} - -Un alias es un nombre definido por el usuario para una expresión en una consulta. - -``` sql -expr AS alias -``` - -- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` cláusula sin usar el `AS` palabra clave. - - For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. - -- `expr` — Any expression supported by ClickHouse. - - For example, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — Name for `expr`. Los alias deben cumplir con el [identificador](#syntax-identifiers) sintaxis. - - For example, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### Notas sobre el uso {#notes-on-usage} - -Los alias son globales para una consulta o subconsulta y puede definir un alias en cualquier parte de una consulta para cualquier expresión. Por ejemplo, `SELECT (1 AS n) + 2, n`. - -Los alias no son visibles en subconsultas y entre subconsultas. Por ejemplo, al ejecutar la consulta `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse genera la excepción `Unknown identifier: num`. - -Si se define un alias para las columnas de resultados `SELECT` cláusula de una subconsulta, estas columnas son visibles en la consulta externa. Por ejemplo, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -Tenga cuidado con los alias que son iguales a los nombres de columna o tabla. Consideremos el siguiente ejemplo: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -En este ejemplo, declaramos tabla `t` con columna `b`. Luego, al seleccionar los datos, definimos el `sum(b) AS b` apodo. Como los alias son globales, ClickHouse sustituyó el literal `b` en la expresión `argMax(a, b)` con la expresión `sum(b)`. Esta sustitución causó la excepción. - -## Asterisco {#asterisk} - -En un `SELECT` consulta, un asterisco puede reemplazar la expresión. Para obtener más información, consulte la sección “SELECT”. - -## Expresiones {#syntax-expressions} - -Una expresión es una función, identificador, literal, aplicación de un operador, expresión entre paréntesis, subconsulta o asterisco. También puede contener un alias. -Una lista de expresiones es una o más expresiones separadas por comas. -Las funciones y los operadores, a su vez, pueden tener expresiones como argumentos. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/es/sql_reference/table_functions/file.md b/docs/es/sql_reference/table_functions/file.md deleted file mode 100644 index 78353de6328..00000000000 --- a/docs/es/sql_reference/table_functions/file.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 37 -toc_title: file ---- - -# file {#file} - -Crea una tabla a partir de un archivo. Esta función de tabla es similar a [URL](url.md) y [Hdfs](hdfs.md) aquel. - -``` sql -file(path, format, structure) -``` - -**Parámetros de entrada** - -- `path` — The relative path to the file from [user\_files\_path](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-user_files_path). Soporte de ruta a archivo siguiendo globs en modo de solo lectura: `*`, `?`, `{abc,def}` y `{N..M}` donde `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [formato](../../interfaces/formats.md#formats) del archivo. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Valor devuelto** - -Una tabla con la estructura especificada para leer o escribir datos en el archivo especificado. - -**Ejemplo** - -Configuración `user_files_path` y el contenido del archivo `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -Tabla de`test.csv` y selección de las dos primeras filas de ella: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -``` sql --- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file -SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 -``` - -**Globs en el camino** - -Múltiples componentes de ruta de acceso pueden tener globs. Para ser procesado, el archivo debe existir y coincidir con todo el patrón de ruta (no solo el sufijo o el prefijo). - -- `*` — Substitutes any number of any characters except `/` incluyendo cadena vacía. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Construcciones con `{}` son similares a la [función de tabla remota](../../sql_reference/table_functions/remote.md)). - -**Ejemplo** - -1. Supongamos que tenemos varios archivos con las siguientes rutas relativas: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. Consulta la cantidad de filas en estos archivos: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Consulta la cantidad de filas en todos los archivos de estos dos directorios: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Advertencia" - Si su lista de archivos contiene rangos de números con ceros a la izquierda, use la construcción con llaves para cada dígito por separado o use `?`. - -**Ejemplo** - -Consultar los datos desde archivos nombrados `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Virtual Columnas {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Ver también** - -- [Virtual columnas](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/es/sql_reference/table_functions/generate.md b/docs/es/sql_reference/table_functions/generate.md deleted file mode 100644 index 1d11afc5f8c..00000000000 --- a/docs/es/sql_reference/table_functions/generate.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 47 -toc_title: generateRandom ---- - -# generateRandom {#generaterandom} - -Genera datos aleatorios con un esquema dado. -Permite rellenar tablas de prueba con datos. -Admite todos los tipos de datos que se pueden almacenar en la tabla, excepto `LowCardinality` y `AggregateFunction`. - -``` sql -generateRandom('name TypeName[, name TypeName]...', [, 'random_seed'[, 'max_string_length'[, 'max_array_length']]]); -``` - -**Parámetros** - -- `name` — Name of corresponding column. -- `TypeName` — Type of corresponding column. -- `limit` — Number of rows to generate. -- `max_array_length` — Maximum array length for all generated arrays. Defaults to `10`. -- `max_string_length` — Maximum string length for all generated strings. Defaults to `10`. -- `random_seed` — Specify random seed manually to produce stable results. If NULL — seed is randomly generated. - -**Valor devuelto** - -Un objeto de tabla con el esquema solicitado. - -## Ejemplo de uso {#usage-example} - -``` sql -SELECT * FROM generateRandom('a Array(Int8), d Decimal32(4), c Tuple(DateTime64(3), UUID)', 1, 10, 2); -``` - -``` text -┌─a────────┬────────────d─┬─c──────────────────────────────────────────────────────────────────┐ -│ [77] │ -124167.6723 │ ('2061-04-17 21:59:44.573','3f72f405-ec3e-13c8-44ca-66ef335f7835') │ -│ [32,110] │ -141397.7312 │ ('1979-02-09 03:43:48.526','982486d1-5a5d-a308-e525-7bd8b80ffa73') │ -│ [68] │ -67417.0770 │ ('2080-03-12 14:17:31.269','110425e5-413f-10a6-05ba-fa6b3e929f15') │ -└──────────┴──────────────┴────────────────────────────────────────────────────────────────────┘ -``` - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/generate/) diff --git a/docs/es/sql_reference/table_functions/hdfs.md b/docs/es/sql_reference/table_functions/hdfs.md deleted file mode 100644 index b582e89f37e..00000000000 --- a/docs/es/sql_reference/table_functions/hdfs.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 45 -toc_title: Hdfs ---- - -# Hdfs {#hdfs} - -Crea una tabla a partir de archivos en HDFS. Esta función de tabla es similar a [URL](url.md) y [file](file.md) aquel. - -``` sql -hdfs(URI, format, structure) -``` - -**Parámetros de entrada** - -- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` y `{N..M}` donde `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [formato](../../interfaces/formats.md#formats) del archivo. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Valor devuelto** - -Una tabla con la estructura especificada para leer o escribir datos en el archivo especificado. - -**Ejemplo** - -Tabla de `hdfs://hdfs1:9000/test` y selección de las dos primeras filas de ella: - -``` sql -SELECT * -FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -**Globs en el camino** - -Múltiples componentes de ruta de acceso pueden tener globs. Para ser procesado, el archivo debe existir y coincidir con todo el patrón de ruta (no solo el sufijo o el prefijo). - -- `*` — Substitutes any number of any characters except `/` incluyendo cadena vacía. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Construcciones con `{}` son similares a la [función de tabla remota](../../sql_reference/table_functions/remote.md)). - -**Ejemplo** - -1. Supongamos que tenemos varios archivos con los siguientes URI en HDFS: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Consulta la cantidad de filas en estos archivos: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Consulta la cantidad de filas en todos los archivos de estos dos directorios: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Advertencia" - Si su lista de archivos contiene rangos de números con ceros a la izquierda, use la construcción con llaves para cada dígito por separado o use `?`. - -**Ejemplo** - -Consultar los datos desde archivos nombrados `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Virtual Columnas {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Ver también** - -- [Virtual columnas](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/es/sql_reference/table_functions/index.md b/docs/es/sql_reference/table_functions/index.md deleted file mode 100644 index 63f5b0da451..00000000000 --- a/docs/es/sql_reference/table_functions/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Table Functions -toc_priority: 34 -toc_title: "Implantaci\xF3n" ---- - -# Funciones de tabla {#table-functions} - -Las funciones de tabla son métodos para construir tablas. - -Puede usar funciones de tabla en: - -- [FROM](../statements/select.md#select-from) cláusula de la `SELECT` consulta. - - The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. - -- [CREAR TABLA COMO \](../statements/create.md#create-table-query) consulta. - - It's one of the methods of creating a table. - -!!! warning "Advertencia" - No puede usar funciones de tabla si el [Método de codificación de datos:](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) la configuración está deshabilitada. - -| Función | Descripci | -|----------------------|----------------------------------------------------------------------------------------------------------------------------------------| -| [file](file.md) | Crea un [File](../../engines/table_engines/special/file.md)-mesa del motor. | -| [fusionar](merge.md) | Crea un [Fusionar](../../engines/table_engines/special/merge.md)-mesa del motor. | -| [numero](numbers.md) | Crea una tabla con una sola columna llena de números enteros. | -| [remoto](remote.md) | Le permite acceder a servidores remotos sin crear un [Distribuido](../../engines/table_engines/special/distributed.md)-mesa del motor. | -| [URL](url.md) | Crea un [URL](../../engines/table_engines/special/url.md)-mesa del motor. | -| [mysql](mysql.md) | Crea un [MySQL](../../engines/table_engines/integrations/mysql.md)-mesa del motor. | -| [jdbc](jdbc.md) | Crea un [JDBC](../../engines/table_engines/integrations/jdbc.md)-mesa del motor. | -| [Nosotros](odbc.md) | Crea un [ODBC](../../engines/table_engines/integrations/odbc.md)-mesa del motor. | -| [Hdfs](hdfs.md) | Crea un [HDFS](../../engines/table_engines/integrations/hdfs.md)-mesa del motor. | - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/es/sql_reference/table_functions/mysql.md b/docs/es/sql_reference/table_functions/mysql.md deleted file mode 100644 index aacb6832057..00000000000 --- a/docs/es/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 42 -toc_title: mysql ---- - -# mysql {#mysql} - -Permitir `SELECT` consultas que se realizarán en los datos que se almacenan en un servidor MySQL remoto. - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**Parámetros** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` consultas a `REPLACE INTO`. Si `replace_query=1`, la consulta se reemplaza. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expresión que se añade a la `INSERT` consulta. - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -Simple `WHERE` cláusulas tales como `=, !=, >, >=, <, <=` se ejecutan actualmente en el servidor MySQL. - -El resto de las condiciones y el `LIMIT` La restricción de muestreo se ejecuta en ClickHouse solo después de que finalice la consulta a MySQL. - -**Valor devuelto** - -Un objeto de tabla con las mismas columnas que la tabla MySQL original. - -## Ejemplo de uso {#usage-example} - -Tabla en MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Selección de datos de ClickHouse: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Ver también {#see-also} - -- [El ‘MySQL’ motor de mesa](../../engines/table_engines/integrations/mysql.md) -- [Uso de MySQL como fuente de diccionario externo](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/es/sql_reference/table_functions/odbc.md b/docs/es/sql_reference/table_functions/odbc.md deleted file mode 100644 index b5105e1b3e3..00000000000 --- a/docs/es/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 44 -toc_title: Nosotros ---- - -# Nosotros {#table-functions-odbc} - -Devuelve la tabla que está conectada a través de [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -Parámetros: - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` file. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -Para implementar con seguridad conexiones ODBC, ClickHouse usa un programa separado `clickhouse-odbc-bridge`. Si el controlador ODBC se carga directamente desde `clickhouse-server`, problemas de controlador pueden bloquear el servidor ClickHouse. ClickHouse se inicia automáticamente `clickhouse-odbc-bridge` cuando se requiere. El programa de puente ODBC se instala desde el mismo paquete que el `clickhouse-server`. - -Los campos con el `NULL` Los valores de la tabla externa se convierten en los valores predeterminados para el tipo de datos base. Por ejemplo, si un campo de tabla MySQL remoto tiene `INT NULL` tipo se convierte a 0 (el valor predeterminado para ClickHouse `Int32` tipo de datos). - -## Ejemplo de uso {#usage-example} - -**Obtener datos de la instalación local de MySQL a través de ODBC** - -Este ejemplo se comprueba para Ubuntu Linux 18.04 y el servidor MySQL 5.7. - -Asegúrese de que unixODBC y MySQL Connector están instalados. - -De forma predeterminada (si se instala desde paquetes), ClickHouse comienza como usuario `clickhouse`. Por lo tanto, debe crear y configurar este usuario en el servidor MySQL. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -A continuación, configure la conexión en `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Puede verificar la conexión usando el `isql` utilidad desde la instalación de unixODBC. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -Tabla en MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Recuperación de datos de la tabla MySQL en ClickHouse: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Ver también {#see-also} - -- [Diccionarios externos ODBC](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [Motor de tabla ODBC](../../engines/table_engines/integrations/odbc.md). - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/es/sql_reference/table_functions/remote.md b/docs/es/sql_reference/table_functions/remote.md deleted file mode 100644 index 8294a2bd069..00000000000 --- a/docs/es/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 40 -toc_title: remoto ---- - -# remoto, remoteSecure {#remote-remotesecure} - -Le permite acceder a servidores remotos sin crear un `Distributed` tabla. - -Firma: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` o simplemente `host`. El host se puede especificar como nombre de servidor o como dirección IPv4 o IPv6. Una dirección IPv6 se especifica entre corchetes. El puerto es el puerto TCP del servidor remoto. Si se omite el puerto, utiliza `tcp_port` del archivo de configuración del servidor (por defecto, 9000). - -!!! important "Importante" - El puerto es necesario para una dirección IPv6. - -Ejemplos: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -Se pueden separar varias direcciones por comas. En este caso, ClickHouse usará procesamiento distribuido, por lo que enviará la consulta a todas las direcciones especificadas (como a fragmentos con datos diferentes). - -Ejemplo: - -``` text -example01-01-1,example01-02-1 -``` - -Parte de la expresión se puede especificar entre llaves. El ejemplo anterior se puede escribir de la siguiente manera: - -``` text -example01-0{1,2}-1 -``` - -Los corchetes rizados pueden contener un rango de números separados por dos puntos (enteros no negativos). En este caso, el rango se expande a un conjunto de valores que generan direcciones de fragmentos. Si el primer número comienza con cero, los valores se forman con la misma alineación cero. El ejemplo anterior se puede escribir de la siguiente manera: - -``` text -example01-{01..02}-1 -``` - -Si tiene varios pares de llaves, genera el producto directo de los conjuntos correspondientes. - -Las direcciones y partes de las direcciones entre llaves se pueden separar mediante el símbolo de tubería (\|). En este caso, los conjuntos de direcciones correspondientes se interpretan como réplicas y la consulta se enviará a la primera réplica en buen estado. Sin embargo, las réplicas se iteran en el orden establecido actualmente en el [load\_balancing](../../operations/settings/settings.md) configuración. - -Ejemplo: - -``` text -example01-{01..02}-{1|2} -``` - -En este ejemplo se especifican dos fragmentos que tienen dos réplicas cada uno. - -El número de direcciones generadas está limitado por una constante. En este momento esto es 1000 direcciones. - -Uso de la `remote` función de la tabla es menos óptima que la creación de un `Distributed` mesa, porque en este caso, la conexión del servidor se restablece para cada solicitud. Además, si se establecen nombres de host, los nombres se resuelven y los errores no se cuentan cuando se trabaja con varias réplicas. Cuando procese un gran número de consultas, cree siempre el `Distributed` mesa antes de tiempo, y no utilice el `remote` función de la tabla. - -El `remote` puede ser útil en los siguientes casos: - -- Acceder a un servidor específico para la comparación de datos, la depuración y las pruebas. -- Consultas entre varios clústeres de ClickHouse con fines de investigación. -- Solicitudes distribuidas poco frecuentes que se realizan manualmente. -- Solicitudes distribuidas donde el conjunto de servidores se redefine cada vez. - -Si el usuario no está especificado, `default` se utiliza. -Si no se especifica la contraseña, se utiliza una contraseña vacía. - -`remoteSecure` - igual que `remote` but with secured connection. Default port — [Tcp\_port\_secure](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) de config o 9440. - -[Artículo Original](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/es/whats-new/changelog/2017.md b/docs/es/whats-new/changelog/2017.md new file mode 100644 index 00000000000..9d2e2d5b0ed --- /dev/null +++ b/docs/es/whats-new/changelog/2017.md @@ -0,0 +1,268 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 79 +toc_title: '2017' +--- + +### Lanzamiento De ClickHouse 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} + +Esta versión contiene correcciones de errores para la versión anterior 1.1.54318: + +- Se corrigió un error con una posible condición de carrera en la replicación que podría conducir a la pérdida de datos. Este problema afecta a las versiones 1.1.54310 y 1.1.54318. Si utiliza una de estas versiones con tablas replicadas, se recomienda encarecidamente la actualización. Este problema se muestra en los registros en mensajes de advertencia como `Part ... from own log doesn't exist.` El problema es relevante incluso si no ve estos mensajes en los registros. + +### Lanzamiento De ClickHouse 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} + +Esta versión contiene correcciones de errores para la versión anterior 1.1.54310: + +- Se corrigieron las eliminaciones de filas incorrectas durante las fusiones en el motor SummingMergeTree +- Se corrigió una pérdida de memoria en los motores MergeTree no duplicados +- Se corrigió la degradación del rendimiento con inserciones frecuentes en los motores MergeTree +- Se corrigió un problema que provocaba que la cola de replicación dejara de ejecutarse +- Rotación y archivado fijos de los registros del servidor + +### Lanzamiento De ClickHouse 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} + +#### Novedad: {#new-features} + +- Clave de partición personalizada para la familia MergeTree de motores de tabla. +- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) motor de mesa. +- Se agregó soporte para cargar [CatBoost](https://catboost.yandex/) modelos y aplicarlos a los datos almacenados en ClickHouse. +- Se agregó soporte para zonas horarias con desplazamientos no enteros de UTC. +- Se agregó soporte para operaciones aritméticas con intervalos de tiempo. +- El intervalo de valores para los tipos Date y DateTime se extiende hasta el año 2105. +- Se agregó el `CREATE MATERIALIZED VIEW x TO y` consulta (especifica una tabla existente para almacenar los datos de una vista materializada). +- Se agregó el `ATTACH TABLE` consulta sin argumentos. +- La lógica de procesamiento para columnas anidadas con nombres que terminan en -Map en una tabla SummingMergeTree se extrajo a la función de agregado sumMap. Ahora puede especificar dichas columnas explícitamente. +- El tamaño máximo del diccionario IP trie se incrementa a 128M entradas. +- Se agregó la función getSizeOfEnumType. +- Se agregó la función agregada sumWithOverflow. +- Se agregó soporte para el formato de entrada Cap’n Proto. +- Ahora puede personalizar el nivel de compresión al usar el algoritmo zstd. + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes} + +- No se permite la creación de tablas temporales con un motor que no sea Memoria. +- No se permite la creación explícita de tablas con el motor View o MaterializedView. +- Durante la creación de la tabla, una nueva comprobación comprueba que la expresión de clave de muestreo está incluida en la clave principal. + +#### Corrección De Errores: {#bug-fixes} + +- Se corrigieron bloqueos al insertar sincrónicamente en una tabla distribuida. +- Se corrigió la adición y eliminación no atómica de partes en tablas replicadas. +- Los datos insertados en una vista materializada no están sujetos a una deduplicación innecesaria. +- La ejecución de una consulta en una tabla distribuida para la que la réplica local está rezagada y las réplicas remotas no están disponibles ya no genera ningún error. +- Los usuarios no necesitan permisos de acceso `default` base de datos para crear tablas temporales más. +- Se corrigió el bloqueo al especificar el tipo de matriz sin argumentos. +- Se corrigieron bloqueos cuando el volumen del disco que contiene los registros del servidor está lleno. +- Se corrigió un desbordamiento en la función toRelativeWeekNum para la primera semana de la época de Unix. + +#### Mejoras De construcción: {#build-improvements} + +- Varias bibliotecas de terceros (especialmente Poco) se actualizaron y convirtieron a submódulos de git. + +### Lanzamiento De ClickHouse 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} + +#### Novedad: {#new-features-1} + +- Soporte TLS en el protocolo nativo (para habilitar, establecer `tcp_ssl_port` en `config.xml` ). + +#### Corrección De Errores: {#bug-fixes-1} + +- `ALTER` para tablas replicadas ahora intenta comenzar a ejecutarse tan pronto como sea posible. +- Se corrigió el bloqueo al leer datos con la configuración `preferred_block_size_bytes=0.` +- Se corrigieron los bloqueos de `clickhouse-client` al presionar `Page Down` +- Interpretación correcta de ciertas consultas complejas con `GLOBAL IN` y `UNION ALL` +- `FREEZE PARTITION` siempre funciona atómicamente ahora. +- Las solicitudes POST vacías ahora devuelven una respuesta con el código 411. +- Se corrigieron errores de interpretación para expresiones como `CAST(1 AS Nullable(UInt8)).` +- Se ha corregido un error al leer `Array(Nullable(String))` las columnas de `MergeTree` tabla. +- Se corrigió el bloqueo al analizar consultas como `SELECT dummy AS dummy, dummy AS b` +- Los usuarios se actualizan correctamente `users.xml` +- Control correcto cuando un diccionario ejecutable devuelve un código de respuesta distinto de cero. + +### Lanzamiento De ClickHouse 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} + +#### Novedad: {#new-features-2} + +- Se agregó el `pointInPolygon` función para trabajar con coordenadas en un plano de coordenadas. +- Se agregó el `sumMap` función de agregado para calcular la suma de matrices, similar a `SummingMergeTree`. +- Se agregó el `trunc` función. Rendimiento mejorado de las funciones de redondeo (`round`, `floor`, `ceil`, `roundToExp2`) y corrigió la lógica de cómo funcionan. Cambió la lógica del `roundToExp2` función para fracciones y números negativos. +- El archivo ejecutable ClickHouse ahora depende menos de la versión de libc. El mismo archivo ejecutable ClickHouse se puede ejecutar en una amplia variedad de sistemas Linux. Todavía hay una dependencia al usar consultas compiladas (con la configuración `compile = 1` , que no se usa por defecto). +- Se ha reducido el tiempo necesario para la compilación dinámica de consultas. + +#### Corrección De Errores: {#bug-fixes-2} + +- Se corrigió un error que a veces producía `part ... intersects previous part` mensajes y la coherencia de réplica debilitada. +- Se corrigió un error que causaba que el servidor se bloqueara si ZooKeeper no estaba disponible durante el apagado. +- Se eliminó el registro excesivo al restaurar réplicas. +- Se corrigió un error en la implementación de UNION ALL. +- Se ha corregido un error en la función concat que se producía si la primera columna de un bloque tiene el tipo Array. +- El progreso ahora se muestra correctamente en el sistema.fusiones tabla. + +### Lanzamiento De ClickHouse 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} + +#### Novedad: {#new-features-3} + +- `SYSTEM` consultas para la administración del servidor: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. +- Funciones añadidas para trabajar con matrices: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. +- Añadir `root` y `identity` parámetros para la configuración de ZooKeeper. Esto le permite aislar usuarios individuales en el mismo clúster de ZooKeeper. +- Funciones agregadas añadidas `groupBitAnd`, `groupBitOr`, y `groupBitXor` (por compatibilidad, también están disponibles bajo los nombres `BIT_AND`, `BIT_OR`, y `BIT_XOR`). +- Los diccionarios externos se pueden cargar desde MySQL especificando un socket en el sistema de archivos. +- Los diccionarios externos se pueden cargar desde MySQL a través de SSL (`ssl_cert`, `ssl_key`, `ssl_ca` parámetros). +- Se agregó el `max_network_bandwidth_for_user` para restringir el uso general del ancho de banda para consultas por usuario. +- Soporte para `DROP TABLE` para tablas temporales. +- Soporte para lectura `DateTime` valores en formato de marca de tiempo Unix desde el `CSV` y `JSONEachRow` formato. +- Las réplicas rezagadas en las consultas distribuidas ahora se excluyen de forma predeterminada (el umbral predeterminado es de 5 minutos). +- El bloqueo FIFO se usa durante ALTER: una consulta ALTER no se bloquea indefinidamente para consultas que se ejecutan continuamente. +- Opción para establecer `umask` en el archivo de configuración. +- Rendimiento mejorado para consultas con `DISTINCT` . + +#### Corrección De Errores: {#bug-fixes-3} + +- Se ha mejorado el proceso de eliminación de nodos antiguos en ZooKeeper. Anteriormente, los nodos antiguos a veces no se eliminaban si había inserciones muy frecuentes, lo que hacía que el servidor tardara en apagarse, entre otras cosas. +- Se corrigió la aleatorización al elegir hosts para la conexión a ZooKeeper. +- Se corrigió la exclusión de réplicas rezagadas en consultas distribuidas si la réplica es localhost. +- Se corrigió un error por el que una parte de datos en un `ReplicatedMergeTree` la tabla podría estar rota después de correr `ALTER MODIFY` en un elemento en un `Nested` estructura. +- Se corrigió un error que podía causar que las consultas SELECT “hang”. +- Mejoras en las consultas DDL distribuidas. +- Se corrigió la consulta `CREATE TABLE ... AS `. +- Se resolvió el punto muerto en el `ALTER ... CLEAR COLUMN IN PARTITION` consulta para `Buffer` tabla. +- Se corrigió el valor predeterminado no válido para `Enum` s (0 en lugar del mínimo) cuando se utiliza el `JSONEachRow` y `TSKV` formato. +- Se resolvió la aparición de procesos zombis al usar un diccionario con un `executable` fuente. +- Se corrigió el segfault para la consulta HEAD. + +#### Flujo De Trabajo Mejorado Para Desarrollar y Ensamblar ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse} + +- Usted puede utilizar `pbuilder` para construir ClickHouse. +- Usted puede utilizar `libc++` en lugar de `libstdc++` para construir en Linux. +- Se agregaron instrucciones para usar herramientas de análisis de código estático: `Coverage`, `clang-tidy`, `cppcheck`. + +#### Tenga En Cuenta Al Actualizar: {#please-note-when-upgrading} + +- Ahora hay un valor predeterminado más alto para la configuración MergeTree `max_bytes_to_merge_at_max_space_in_pool` (el tamaño total máximo de las partes de datos a fusionar, en bytes): ha aumentado de 100 GiB a 150 GiB. Esto podría dar lugar a grandes fusiones que se ejecutan después de la actualización del servidor, lo que podría provocar una mayor carga en el subsistema de disco. Si el espacio libre disponible en el servidor es inferior al doble de la cantidad total de las fusiones que se están ejecutando, esto hará que todas las demás fusiones dejen de ejecutarse, incluidas las fusiones de pequeñas partes de datos. Como resultado, las consultas INSERT fallarán con el mensaje “Merges are processing significantly slower than inserts.” Utilice el `SELECT * FROM system.merges` consulta para supervisar la situación. También puede comprobar el `DiskSpaceReservedForMerge` métrica en el `system.metrics` mesa, o en Grafito. No necesita hacer nada para solucionar esto, ya que el problema se resolverá solo una vez que finalicen las fusiones grandes. Si encuentra esto inaceptable, puede restaurar el valor anterior para el `max_bytes_to_merge_at_max_space_in_pool` configuración. Para hacer esto, vaya al sección en config.xml, establecer ``` ``107374182400 ``` y reinicie el servidor. + +### Lanzamiento De ClickHouse 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} + +- Esta es una versión de corrección de errores para la versión anterior 1.1.54282. Corrige fugas en el directorio de piezas en ZooKeeper. + +### Lanzamiento De ClickHouse 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} + +Esta versión contiene correcciones de errores para la versión anterior 1.1.54276: + +- Fijo `DB::Exception: Assertion violation: !_path.empty()` cuando se inserta en una tabla distribuida. +- Se corrigió el análisis al insertar en formato RowBinary si los datos de entrada comienzan con’;’. +- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). + +### Clickhouse Lanzamiento 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} + +#### Novedad: {#new-features-4} + +- Se agregó una sección WITH opcional para una consulta SELECT. Consulta de ejemplo: `WITH 1+1 AS a SELECT a, a*a` +- INSERT se puede realizar de forma sincrónica en una tabla distribuida: se devuelve OK solo después de guardar todos los datos en todos los fragmentos. Esto se activa mediante la configuración insert\_distributed\_sync=1. +- Se agregó el tipo de datos UUID para trabajar con identificadores de 16 bytes. +- Se agregaron alias de CHAR, FLOAT y otros tipos para compatibilidad con Tableau. +- Se agregaron las funciones aYYYYMM, aYYYYMMDD y aYYYYMMDDhhmmss para convertir el tiempo en números. +- Puede utilizar direcciones IP (junto con el nombre de host) para identificar servidores para consultas DDL en clúster. +- Se agregó soporte para argumentos no constantes y compensaciones negativas en la función `substring(str, pos, len).` +- Se agregó el parámetro max\_size para el `groupArray(max_size)(column)` función agregada, y optimizó su funcionamiento. + +#### Principales Cambios: {#main-changes} + +- Mejoras de seguridad: todos los archivos del servidor se crean con permisos 0640 (se pueden cambiar a través de parámetro de configuración). +- Mensajes de error mejorados para consultas con sintaxis no válida. +- Se ha reducido significativamente el consumo de memoria y se ha mejorado el rendimiento al combinar grandes secciones de datos de MergeTree. +- Aumentó significativamente el rendimiento de las fusiones de datos para el motor ReplacingMergeTree. +- Mejora del rendimiento de las inserciones asincrónicas de una tabla distribuida mediante la combinación de varias inserciones de origen. Para habilitar esta funcionalidad, utilice la configuración de directorio\_distribuido\_monitor\_batch\_inserts=1. + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-1} + +- Se ha cambiado el formato binario de los estados agregados de `groupArray(array_column)` funciones para matrices. + +#### Lista Completa De Cambios: {#complete-list-of-changes} + +- Se agregó el `output_format_json_quote_denormals` configuración, que permite generar valores nan e inf en formato JSON. +- Asignación de secuencias optimizada al leer desde una tabla distribuida. +- Los ajustes se pueden configurar en modo de solo lectura si el valor no cambia. +- Se agregó la capacidad de recuperar gránulos no enteros del motor MergeTree para cumplir con las restricciones en el tamaño de bloque especificado en la configuración preferred\_block\_size\_bytes. El propósito es reducir el consumo de RAM y aumentar la localidad de caché al procesar consultas desde tablas con columnas grandes. +- Uso eficiente de índices que contienen expresiones como `toStartOfHour(x)` para condiciones como `toStartOfHour(x) op сonstexpr.` +- Se agregaron nuevas configuraciones para los motores MergeTree (la sección merge\_tree en config.XML): + - replicated\_deduplication\_window\_seconds establece el número de segundos permitidos para la deduplicación de inserciones en tablas replicadas. + - cleanup\_delay\_period establece con qué frecuencia iniciar la limpieza para eliminar datos obsoletos. + - replicated\_can\_become\_leader puede evitar que una réplica se convierta en el líder (y asigne fusiones). +- Limpieza acelerada para eliminar datos obsoletos de ZooKeeper. +- Múltiples mejoras y correcciones para consultas DDL en clúster. De particular interés es la nueva configuración distribut\_ddl\_task\_timeout, que limita el tiempo de espera para una respuesta de los servidores en el clúster. Si no se ha realizado una solicitud ddl en todos los hosts, una respuesta contendrá un error de tiempo de espera y una solicitud se ejecutará en modo asíncrono. +- Mejora de la visualización de los rastros de pila en los registros del servidor. +- Se agregó el “none” valor para el método de compresión. +- Puede usar varias secciones dictionaries\_config en config.XML. +- Es posible conectarse a MySQL a través de un socket en el sistema de archivos. +- Sistema.partes tiene una nueva columna con información sobre el tamaño de las marcas, en bytes. + +#### Corrección De Errores: {#bug-fixes-4} + +- Las tablas distribuidas que utilizan una tabla Merge ahora funcionan correctamente para una consulta SELECT con una condición `_table` campo. +- Se corrigió una rara condición de carrera en ReplicatedMergeTree al verificar partes de datos. +- Se corrigió la posible congelación en “leader election” al iniciar un servidor. +- El valor max\_replica\_delay\_for\_distributed\_queries se omitió al usar una réplica local del origen de datos. Esto ha sido solucionado. +- Comportamiento incorrecto fijo de `ALTER TABLE CLEAR COLUMN IN PARTITION` al intentar limpiar una columna no existente. +- Se ha corregido una excepción en la función multiIf al usar matrices o cadenas vacías. +- Se corrigieron asignaciones de memoria excesivas al deserializar el formato nativo. +- Se corrigió la actualización automática incorrecta de los diccionarios Trie. +- Se ha corregido una excepción al ejecutar consultas con una cláusula GROUP BY desde una tabla Merge cuando se usa SAMPLE. +- Se corrigió un bloqueo de GROUP BY cuando se usabaributed\_aggregation\_memory\_efficient = 1. +- Ahora puede especificar la base de datos.en el lado derecho de IN y JOIN. +- Se usaron demasiados subprocesos para la agregación paralela. Esto ha sido solucionado. +- Corregido cómo el “if” funciona con argumentos FixedString. +- SELECT funcionó incorrectamente desde una tabla distribuida para fragmentos con un peso de 0. Esto ha sido solucionado. +- Ejecutar `CREATE VIEW IF EXISTS no longer causes crashes.` +- Se corrigió el comportamiento incorrecto cuando input\_format\_skip\_unknown\_fields = 1 se establece y hay números negativos. +- Se corrigió un bucle infinito en el `dictGetHierarchy()` función si hay algunos datos no válidos en el diccionario. +- Fijo `Syntax error: unexpected (...)` errores al ejecutar consultas distribuidas con subconsultas en una cláusula IN o JOIN y tablas Merge. +- Se corrigió una interpretación incorrecta de una consulta SELECT de tablas de diccionario. +- Se corrigió el “Cannot mremap” error al usar matrices en las cláusulas IN y JOIN con más de 2 mil millones de elementos. +- Se corrigió la conmutación por error para los diccionarios con MySQL como fuente. + +#### Flujo De Trabajo Mejorado Para Desarrollar y Ensamblar ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} + +- Las construcciones se pueden ensamblar en Arcadia. +- Puedes usar gcc 7 para compilar ClickHouse. +- Las compilaciones paralelas que usan ccache + distcc son más rápidas ahora. + +### Lanzamiento De ClickHouse 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} + +#### Novedad: {#new-features-5} + +- DDL distribuido (por ejemplo, `CREATE TABLE ON CLUSTER`) +- La consulta replicada `ALTER TABLE CLEAR COLUMN IN PARTITION.` +- El motor para las tablas del diccionario (acceso a los datos del diccionario en forma de tabla). +- Motor de base de datos de diccionario (este tipo de base de datos tiene automáticamente tablas de diccionario disponibles para todos los diccionarios externos conectados). +- Puede comprobar si hay actualizaciones en el diccionario enviando una solicitud al origen. +- Nombres de columna cualificados +- Citando identificadores usando comillas dobles. +- Sesiones en la interfaz HTTP. +- La consulta OPTIMIZE para una tabla replicada puede ejecutarse no solo en el líder. + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-2} + +- Eliminado SET GLOBAL. + +#### Cambios Menores: {#minor-changes} + +- Ahora, después de activar una alerta, el registro imprime el seguimiento completo de la pila. +- Se relajó la verificación del número de partes de datos dañadas / adicionales al inicio (hubo demasiados falsos positivos). + +#### Corrección De Errores: {#bug-fixes-5} + +- Se corrigió una mala conexión “sticking” cuando se inserta en una tabla distribuida. +- GLOBAL IN ahora funciona para una consulta de una tabla de combinación que mira a una tabla distribuida. +- Se detectó el número incorrecto de núcleos en una máquina virtual de Google Compute Engine. Esto ha sido solucionado. +- Cambios en el funcionamiento de una fuente ejecutable de diccionarios externos en caché. +- Se corrigió la comparación de cadenas que contenían caracteres nulos. +- Se corrigió la comparación de los campos de clave primaria Float32 con constantes. +- Anteriormente, una estimación incorrecta del tamaño de un campo podía conducir a asignaciones demasiado grandes. +- Se corrigió un bloqueo al consultar una columna Nullable agregada a una tabla usando ALTER. +- Se corrigió un bloqueo al ordenar por una columna Nullable, si el número de filas es menor que LIMIT. +- Se corrigió una subconsulta ORDER BY que consistía solo en valores constantes. +- Anteriormente, una tabla replicada podía permanecer en el estado no válido después de un error DROP TABLE. +- Los alias para subconsultas escalares con resultados vacíos ya no se pierden. +- Ahora una consulta que usó compilación no falla con un error si el archivo .so se daña. diff --git a/docs/es/whats-new/changelog/2018.md b/docs/es/whats-new/changelog/2018.md new file mode 100644 index 00000000000..0eb98413e74 --- /dev/null +++ b/docs/es/whats-new/changelog/2018.md @@ -0,0 +1,1063 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 78 +toc_title: '2018' +--- + +## Lanzamiento De ClickHouse 18.16 {#clickhouse-release-18-16} + +### Lanzamiento De ClickHouse 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} + +#### Corrección De Errores: {#bug-fixes} + +- Se corrigió un error que provocaba problemas con la actualización de diccionarios con el origen ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- La compilación JIT de funciones agregadas ahora funciona con columnas LowCardinality. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) + +#### Mejora: {#improvements} + +- Se agregó el `low_cardinality_allow_in_native_format` configuración (habilitada por defecto). Cuando se deshabilita, las columnas LowCardinality se convertirán en columnas ordinarias para las consultas SELECT y se esperarán columnas ordinarias para las consultas INSERT. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) + +#### Mejoras De construcción: {#build-improvements} + +- Correcciones para compilaciones en macOS y ARM. + +### Lanzamiento De ClickHouse 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} + +#### Novedad: {#new-features} + +- `DEFAULT` Las expresiones se evalúan en busca de campos faltantes al cargar datos en formatos de entrada semiestructurados (`JSONEachRow`, `TSKV`). La función está habilitada con `insert_sample_with_metadata` configuración. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) +- El `ALTER TABLE` consulta ahora tiene el `MODIFY ORDER BY` acción para cambiar la clave de ordenación al agregar o eliminar una columna de tabla. Esto es útil para las tablas `MergeTree` familia que realizan tareas adicionales al fusionarse basándose en esta clave de ordenación, como `SummingMergeTree`, `AggregatingMergeTree` y así sucesivamente. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) +- Para las tablas en el `MergeTree` familia, ahora puede especificar una clave de clasificación diferente (`ORDER BY`) e índice (`PRIMARY KEY`). La clave de ordenación puede ser más larga que el índice. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) +- Se agregó el `hdfs` función de la tabla y el `HDFS` para importar y exportar datos a HDFS. [Más información](https://github.com/ClickHouse/ClickHouse/pull/3617) +- Funciones añadidas para trabajar con base64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alejandro Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) +- Ahora puede usar un parámetro para configurar la precisión del `uniqCombined` función de agregado (seleccione el número de celdas HyperLogLog). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) +- Se agregó el `system.contributors` tabla que contiene los nombres de todos los que hicieron compromete en ClickHouse. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) +- Se agregó la capacidad de omitir la partición para el `ALTER TABLE ... FREEZE` consulta para hacer una copia de seguridad de todas las particiones a la vez. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) +- Añadir `dictGet` y `dictGetOrDefault` funciones que no requieren especificar el tipo de valor de retorno. El tipo se determina automáticamente a partir de la descripción del diccionario. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3564) +- Ahora puede especificar comentarios para una columna en la descripción de la tabla y cambiarla usando `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) +- La lectura es compatible para `Join` tablas de escribir con teclas simples. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Ahora puede especificar las opciones `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, y `join_overflow_mode` al crear un `Join` tabla de tipo. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Se agregó el `joinGet` función que le permite utilizar un `Join` tipo de tabla como un diccionario. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Se agregó el `partition_key`, `sorting_key`, `primary_key`, y `sampling_key` columnas a la `system.tables` tabla con el fin de proporcionar información sobre las claves de la tabla. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Se agregó el `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, y `is_in_sampling_key` columnas a la `system.columns` tabla. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Se agregó el `min_time` y `max_time` columnas a la `system.parts` tabla. Estas columnas se rellenan cuando la clave de partición es una expresión que consiste en `DateTime` columna. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) + +#### Corrección De Errores: {#bug-fixes-1} + +- Correcciones y mejoras de rendimiento para el `LowCardinality` tipo de datos. `GROUP BY` utilizar `LowCardinality(Nullable(...))`. Obtener los valores de `extremes`. Procesamiento de funciones de orden superior. `LEFT ARRAY JOIN`. Distribuido `GROUP BY`. Funciones que devuelven `Array`. Ejecución de `ORDER BY`. Escribir a `Distributed` tablas (nicelulu). Compatibilidad con versiones anteriores para `INSERT` consultas de clientes antiguos que implementan el `Native` protocolo. Soporte para `LowCardinality` para `JOIN`. Rendimiento mejorado cuando se trabaja en un solo flujo. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) +- Corregido cómo el `select_sequential_consistency` opción funciona. Anteriormente, cuando se habilitaba esta configuración, a veces se devolvía un resultado incompleto después de comenzar a escribir en una nueva partición. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) +- Las bases de datos se especifican correctamente al ejecutar DDL `ON CLUSTER` consultas y `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Las bases de datos se especifican correctamente para las subconsultas dentro de una VIEW. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Se ha corregido un error en `PREWHERE` con `FINAL` para `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) +- Ahora puedes usar `KILL QUERY` para cancelar consultas que aún no se han iniciado porque están esperando a que se bloquee la tabla. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) +- Se corrigieron los cálculos de fecha y hora si los relojes se movían hacia atrás a la medianoche (esto sucede en Irán, y sucedió en Moscú de 1981 a 1983). Anteriormente, esto llevaba a que la hora se restableciera un día antes de lo necesario, y también causaba un formato incorrecto de la fecha y la hora en formato de texto. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) +- Se corrigieron errores en algunos casos de `VIEW` y subconsultas que omiten la base de datos. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Se corrigió una condición de carrera al leer simultáneamente desde un `MATERIALIZED VIEW` y eliminar un `MATERIALIZED VIEW` debido a no bloquear el interior `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) +- Corregido el error `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) +- Procesamiento de consultas fijo cuando el `compile_expressions` la opción está habilitada (está habilitada por defecto). Expresiones constantes no deterministas como el `now` función ya no están desplegados. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) +- Se corrigió un bloqueo al especificar un argumento de escala no constante en `toDecimal32/64/128` función. +- Se corrigió un error al intentar insertar una matriz con `NULL` elementos en el `Values` formato en una columna de tipo `Array` sin `Nullable` (si `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) +- Se corrigió el registro continuo de errores en `DDLWorker` si ZooKeeper no está disponible. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) +- Se corrigió el tipo de retorno para `quantile*` funciones de `Date` y `DateTime` de argumentos. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) +- Se corrigió el `WITH` cláusula si especifica un alias simple sin expresiones. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) +- Se corrigió el procesamiento de consultas con subconsultas con nombre y nombres de columna calificados cuando `enable_optimize_predicate_expression` está habilitado. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) +- Corregido el error `Attempt to attach to nullptr thread group` cuando se trabaja con vistas materializadas. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) +- Se corrigió un bloqueo al pasar ciertos argumentos incorrectos a la `arrayReverse` función. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- Se corrigió el desbordamiento del búfer en el `extractURLParameter` función. Rendimiento mejorado. Se agregó el procesamiento correcto de cadenas que contienen cero bytes. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) +- Desbordamiento de búfer fijo en el `lowerUTF8` y `upperUTF8` función. Se eliminó la capacidad de ejecutar estas funciones sobre `FixedString` argumentos de tipo. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) +- Se corrigió una rara condición de carrera al eliminar `MergeTree` tabla. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) +- Se corrigió una condición de carrera al leer desde `Buffer` tablas y realizar simultáneamente `ALTER` o `DROP` en las tablas de destino. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) +- Se corrigió una segfault si el `max_temporary_non_const_columns` se excedió el límite. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### Mejora: {#improvements-1} + +- El servidor no escribe los archivos de configuración procesados `/etc/clickhouse-server/` directorio. En su lugar, los guarda en el `preprocessed_configs` directorio dentro `path`. Esto significa que el `/etc/clickhouse-server/` directorio no tiene acceso de escritura para el `clickhouse` usuario, lo que mejora la seguridad. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) +- El `min_merge_bytes_to_use_direct_io` La opción está establecida en 10 GiB de forma predeterminada. Una combinación que forma partes grandes de tablas de la familia MergeTree se realizará en `O_DIRECT` modo, que evita el desalojo excesivo de la caché de la página. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) +- Se inicia el servidor acelerado cuando hay un gran número de tablas. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) +- Se agregó un grupo de conexiones y HTTP `Keep-Alive` para conexiones entre réplicas. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) +- Si la sintaxis de la consulta no es válida, `400 Bad Request` el código se devuelve en el `HTTP` interfaz (500 se devolvió anteriormente). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) +- El `join_default_strictness` opción se establece en `ALL` por defecto para la compatibilidad. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) +- Se eliminó el registro a `stderr` de la `re2` biblioteca para expresiones regulares no válidas o complejas. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) +- Añadido para el `Kafka` motor de tabla: comprueba si hay suscripciones antes de comenzar a leer de Kafka; la configuración kafka\_max\_block\_size para la tabla. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) +- El `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, y `murmurHash3_64` funciones ahora funcionan para cualquier número de argumentos y para argumentos en forma de tuplas. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) +- El `arrayReverse` función ahora funciona con cualquier tipo de matrices. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- Se ha añadido un parámetro opcional: el tamaño de la ranura `timeSlots` función. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) +- Para `FULL` y `RIGHT JOIN`, el `max_block_size` configuración se utiliza para un flujo de datos no unidos de la tabla de la derecha. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3699) +- Se agregó el `--secure` parámetro de línea de comandos en `clickhouse-benchmark` y `clickhouse-performance-test` para habilitar TLS. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) +- Conversión de tipo cuando la estructura de un `Buffer` type table no coincide con la estructura de la tabla de destino. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) +- Se agregó el `tcp_keep_alive_timeout` opción para habilitar los paquetes keep-alive después de la inactividad durante el intervalo de tiempo especificado. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) +- Eliminado cotización innecesaria de valores para la clave de partición en el `system.parts` tabla si consiste en una sola columna. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) +- La función de módulo funciona para `Date` y `DateTime` tipos de datos. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) +- Sinónimos añadidos para el `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, y `MID` función. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Algunos nombres de funciones no distinguen entre mayúsculas y minúsculas por su compatibilidad con el estándar SQL. Azúcar sintáctico añadido `SUBSTRING(expr FROM start FOR length)` por compatibilidad con SQL. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) +- Se agregó la capacidad de `mlock` páginas de memoria correspondientes a `clickhouse-server` código ejecutable para evitar que se vea obligado a salir de la memoria. Esta función está deshabilitada de forma predeterminada. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) +- Rendimiento mejorado al leer desde `O_DIRECT` (con el `min_bytes_to_use_direct_io` opción activada). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) +- Rendimiento mejorado del `dictGet...OrDefault` función para un argumento de clave constante y un argumento predeterminado no constante. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3563) +- El `firstSignificantSubdomain` función ahora procesa los dominios `gov`, `mil`, y `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Rendimiento mejorado. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) +- Posibilidad de especificar variables de entorno personalizadas para iniciar `clickhouse-server` utilizando el `SYS-V init.d` secuencia de comandos definiendo `CLICKHOUSE_PROGRAM_ENV` en `/etc/default/clickhouse`. + [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) +- Corrija el código de retorno para el script init de clickhouse-server. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) +- El `system.metrics` ahora tiene el `VersionInteger` métrica, y `system.build_options` tiene la línea añadida `VERSION_INTEGER`, que contiene la forma numérica de la versión de ClickHouse, como `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) +- Eliminado la capacidad de comparar el `Date` escriba con un número para evitar posibles errores como `date = 2018-12-17`, donde las comillas alrededor de la fecha se omiten por error. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) +- Se corrigió el comportamiento de las funciones con estado como `rowNumberInAllBlocks`. Anteriormente generaron un resultado que era un número mayor debido al inicio durante el análisis de consultas. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3729) +- Si el `force_restore_data` no se puede eliminar, se muestra un mensaje de error. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3794) + +#### Mejoras De construcción: {#build-improvements-1} + +- Actualizado el `jemalloc` biblioteca, que corrige una posible pérdida de memoria. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3557) +- Perfilado con `jemalloc` está habilitado de forma predeterminada para depurar compilaciones. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) +- Se agregó la capacidad de ejecutar pruebas de integración cuando solo `Docker` está instalado en el sistema. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) +- Se agregó la prueba de expresión fuzz en consultas SELECT. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) +- Se agregó una prueba de esfuerzo para confirmaciones, que realiza pruebas funcionales en paralelo y en orden aleatorio para detectar más condiciones de carrera. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) +- Se mejoró el método para iniciar clickhouse-server en una imagen de Docker. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/pull/3663) +- Para una imagen de Docker, se agregó soporte para inicializar bases de datos utilizando `/docker-entrypoint-initdb.d` directorio. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) +- Correcciones para construye en ARM. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes} + +- Eliminado la capacidad de comparar el `Date` escriba con un número. En lugar de `toDate('2018-12-18') = 17883`, debe usar la conversión de tipo explícita `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) + +## Lanzamiento De ClickHouse 18.14 {#clickhouse-release-18-14} + +### Lanzamiento De ClickHouse 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} + +#### Corrección De Errores: {#bug-fixes-2} + +- Se corrigió un error que provocaba problemas con la actualización de diccionarios con el origen ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- Las bases de datos se especifican correctamente al ejecutar DDL `ON CLUSTER` consulta. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Se corrigió una segfault si el `max_temporary_non_const_columns` se excedió el límite. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### Mejoras De construcción: {#build-improvements-2} + +- Correcciones para construye en ARM. + +### Lanzamiento De ClickHouse 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} + +#### Corrección De Errores: {#bug-fixes-3} + +- Corregido el error en `dictGet...` función para diccionarios de tipo `range`, si uno de los argumentos es constante y otro no lo es. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) +- Se corrigió el error que causaba mensajes `netlink: '...': attribute type 1 has an invalid length` para imprimirse en el registro del kernel de Linux, eso estaba sucediendo solo en versiones suficientemente frescas del kernel de Linux. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) +- Segfault fijo en la función `empty` para argumento de `FixedString` tipo. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/pull/3703) +- Se corrigió la asignación excesiva de memoria al usar un gran valor de `max_query_size` configuración (un fragmento de memoria de `max_query_size` bytes fue preasignado a la vez). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) + +#### Crear Cambios: {#build-changes} + +- Compilación fija con las bibliotecas LLVM / Clang de la versión 7 de los paquetes del sistema operativo (estas bibliotecas se utilizan para la compilación de consultas en tiempo de ejecución). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### Lanzamiento De ClickHouse 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} + +#### Corrección De Errores: {#bug-fixes-4} + +- Se corrigieron casos en los que el proceso de puente ODBC no terminaba con el proceso del servidor principal. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) +- Inserción síncrona fija en el `Distributed` tabla con una lista de columnas que difiere de la lista de columnas de la tabla remota. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) +- Se corrigió una rara condición de carrera que podía provocar un bloqueo al soltar una tabla MergeTree. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Se corrigió un punto muerto de consulta en caso de que la creación del hilo de consulta fallara con el `Resource temporarily unavailable` error. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Análisis fijo del `ENGINE` cláusula cuando el `CREATE AS table` se utilizó la sintaxis y el `ENGINE` cláusula se especificó antes de la `AS table` (el error resultó en ignorar el motor especificado). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) + +### Lanzamiento De ClickHouse 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} + +#### Corrección De Errores: {#bug-fixes-5} + +- El tamaño del fragmento de memoria se sobreestimó al deserializar la columna de tipo `Array(String)` que conduce a “Memory limit exceeded” error. El problema apareció en la versión 18.12.13. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) + +### Lanzamiento De ClickHouse 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} + +#### Corrección De Errores: {#bug-fixes-6} + +- Fijo `ON CLUSTER` consultas cuando el clúster está configurado como seguro (indicador ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) + +#### Crear Cambios: {#build-changes-1} + +- Problemas solucionados (llvm-7 del sistema, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### Lanzamiento De ClickHouse 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} + +#### Corrección De Errores: {#bug-fixes-7} + +- Se corrigió el `Block structure mismatch in MergingSorted stream` error. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) +- Fijo `ON CLUSTER` consultas en caso de que se hayan activado las conexiones seguras en la configuración del clúster (el `` bandera). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) +- Se corrigió un error en las consultas que utilizaban `SAMPLE`, `PREWHERE` y columnas de alias. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) +- Se corrigió un raro `unknown compression method` error cuando el `min_bytes_to_use_direct_io` se habilitó la configuración. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) + +#### Mejoras De Rendimiento: {#performance-improvements} + +- Regresión de rendimiento fija de consultas con `GROUP BY` de columnas de tipo UInt16 o Date cuando se ejecuta en procesadores AMD EPYC. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) +- Regresión de rendimiento fija de las consultas que procesan cadenas largas. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) + +#### Mejoras De construcción: {#build-improvements-3} + +- Mejoras para simplificar la compilación de Arcadia. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) + +### Lanzamiento De ClickHouse 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} + +#### Corrección De Errores: {#bug-fixes-8} + +- Se corrigió un bloqueo al unir dos subconsultas sin nombre. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) +- Se corrigió la generación de consultas incorrectas (con un vacío `WHERE` cláusula) al consultar bases de datos externas. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) +- Se corrigió usando un valor de tiempo de espera incorrecto en los diccionarios ODBC. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) + +### Lanzamiento De ClickHouse 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} + +#### Corrección De Errores: {#bug-fixes-9} + +- Corregido el error `Block structure mismatch in UNION stream: different number of columns` en consultas LIMIT. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) +- Se corrigieron errores al fusionar datos en tablas que contienen matrices dentro de estructuras anidadas. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) +- Se corrigieron los resultados de la consulta incorrecta si el `merge_tree_uniform_read_distribution` la configuración está deshabilitada (está habilitada por defecto). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) +- Se corrigió un error en las inserciones en una tabla distribuida en formato nativo. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) + +### Lanzamiento De ClickHouse 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} + +- El `compile_expressions` configuración (compilación JIT de expresiones) está deshabilitada de forma predeterminada. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) +- El `enable_optimize_predicate_expression` configuración está deshabilitada de forma predeterminada. + +### Lanzamiento De ClickHouse 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} + +#### Novedad: {#new-features-1} + +- El `WITH CUBE` modificador para `GROUP BY` (la sintaxis alternativa `GROUP BY CUBE(...)` también está disponible). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) +- Se agregó el `formatDateTime` función. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) +- Se agregó el `JDBC` motor de mesa y `jdbc` función de tabla (requiere la instalación de clickhouse-jdbc-bridge). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- Funciones añadidas para trabajar con el número de semana ISO: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, y `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) +- Ahora puedes usar `Nullable` de columnas para `MySQL` y `ODBC` tabla. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- Las estructuras de datos anidadas se pueden leer como objetos anidados en `JSONEachRow` formato. Se agregó el `input_format_import_nested_json` configuración. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) +- El procesamiento paralelo está disponible para muchos `MATERIALIZED VIEW`s al insertar datos. Ver el `parallel_view_processing` configuración. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) +- Se agregó el `SYSTEM FLUSH LOGS` consulta (vacíos de registro forzados a tablas del sistema como `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) +- Ahora puedes usar predefinidos `database` y `table` macros al declarar `Replicated` tabla. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) +- Se agregó la capacidad de leer `Decimal` valores de tipo en notación de ingeniería (indicando potencias de diez). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) + +#### Experimental características: {#experimental-features} + +- Optimización de la cláusula GROUP BY para `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) +- Cálculo optimizado de expresiones para `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) + +#### Mejora: {#improvements-2} + +- Consumo de memoria significativamente reducido para consultas con `ORDER BY` y `LIMIT`. Ver el `max_bytes_before_remerge_sort` configuración. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- En ausencia de `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` se supone. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) +- Los asteriscos calificados funcionan correctamente en consultas con `JOIN`. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) +- El `ODBC` El motor de tabla elige correctamente el método para citar identificadores en el dialecto SQL de una base de datos remota. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- El `compile_expressions` configuración (compilación JIT de expresiones) está habilitada de forma predeterminada. +- Comportamiento fijo para DROP DATABASE / TABLA SI EXISTE simultáneamente y CREATE DATABASE / TABLA SI NO EXISTE. Anteriormente, un `CREATE DATABASE ... IF NOT EXISTS` consulta podría devolver el mensaje de error “File … already exists” y el `CREATE TABLE ... IF NOT EXISTS` y `DROP TABLE IF EXISTS` las consultas podrían volver `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) +- Las expresiones LIKE e IN con una mitad derecha constante se pasan al servidor remoto al realizar consultas desde tablas MySQL u ODBC. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- Las comparaciones con expresiones constantes en una cláusula WHERE se pasan al servidor remoto al realizar consultas desde tablas MySQL y ODBC. Anteriormente, solo se pasaban las comparaciones con constantes. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- Cálculo correcto del ancho de fila en el terminal para `Pretty` formatos, incluyendo cadenas con jeroglíficos. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3257). +- `ON CLUSTER` se puede especificar para `ALTER UPDATE` consulta. +- Rendimiento mejorado para leer datos en `JSONEachRow` formato. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) +- Sinónimos añadidos para el `LENGTH` y `CHARACTER_LENGTH` funciones de compatibilidad. El `CONCAT` la función ya no distingue entre mayúsculas y minúsculas. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) +- Se agregó el `TIMESTAMP` sinónimo de la `DateTime` tipo. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) +- Siempre hay espacio reservado para query\_id en los registros del servidor, incluso si la línea de registro no está relacionada con una consulta. Esto hace que sea más fácil analizar los registros de texto del servidor con herramientas de terceros. +- El consumo de memoria de una consulta se registra cuando supera el siguiente nivel de un número entero de gigabytes. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- Se agregó el modo de compatibilidad para el caso cuando la biblioteca cliente que usa el protocolo nativo envía menos columnas por error de lo que el servidor espera para la consulta INSERT. Este escenario fue posible cuando se utiliza la biblioteca clickhouse-cpp. Anteriormente, este escenario hacía que el servidor se bloqueara. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) +- En una expresión WHERE definida por el usuario en `clickhouse-copier`, ahora puede usar un `partition_key` alias (para filtrado adicional por partición de tabla de origen). Esto es útil si el esquema de partición cambia durante la copia, pero solo cambia ligeramente. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) +- El flujo de trabajo del `Kafka` el motor se ha movido a un grupo de subprocesos en segundo plano para reducir automáticamente la velocidad de lectura de datos a altas cargas. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- Soporte para lectura `Tuple` y `Nested` de estructuras como `struct` en el `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) +- La lista de dominios de nivel superior `firstSignificantSubdomain` función ahora incluye el dominio `biz`. [disminución](https://github.com/ClickHouse/ClickHouse/pull/3219) +- En la configuración de diccionarios externos, `null_value` se interpreta como el valor del tipo de datos predeterminado. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) +- Soporte para el `intDiv` y `intDivOrZero` funciones para `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) +- Soporte para el `Date`, `DateTime`, `UUID`, y `Decimal` tipos como una clave para el `sumMap` función de agregado. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) +- Soporte para el `Decimal` tipo de datos en diccionarios externos. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) +- Soporte para el `Decimal` tipo de datos en `SummingMergeTree` tabla. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) +- Añadido especializaciones para `UUID` en `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) +- Reducido el número de `open` y `close` llamadas al sistema al leer desde un `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) +- A `TRUNCATE TABLE` consulta se puede ejecutar en cualquier réplica (la consulta se pasa a la réplica líder). [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) + +#### Corrección De Errores: {#bug-fixes-10} + +- Se corrigió un problema con `Dictionary` tablas para `range_hashed` diccionario. Este error se produjo en la versión 18.12.17. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) +- Se corrigió un error al cargar `range_hashed` diccionarios (el mensaje `Unsupported type Nullable (...)`). Este error se produjo en la versión 18.12.17. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- Se corrigieron errores en el `pointInPolygon` función debido a la acumulación de cálculos inexactos para polígonos con un gran número de vértices ubicados cerca uno del otro. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) +- Si después de fusionar partes de datos, la suma de comprobación de la parte resultante difiere del resultado de la misma fusión en otra réplica, el resultado de la fusión se elimina y la parte de datos se descarga de la otra réplica (este es el comportamiento correcto). Pero después de descargar la parte de datos, no se pudo agregar al conjunto de trabajo debido a un error de que la parte ya existe (porque la parte de datos se eliminó con cierto retraso después de la fusión). Esto llevó a intentos cíclicos de descargar los mismos datos. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) +- Se corrigió el cálculo incorrecto del consumo total de memoria por consultas (debido a un cálculo incorrecto, el `max_memory_usage_for_all_queries` la configuración funcionó incorrectamente y el `MemoryTracking` métrica tenía un valor incorrecto). Este error se produjo en la versión 18.12.13. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) +- Se corrigió la funcionalidad de `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` Este error se produjo en la versión 18.12.13. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) +- Se corrigió la preparación innecesaria de estructuras de datos para `JOIN`s en el servidor que inicia la consulta si `JOIN` sólo se realiza en servidores remotos. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) +- Se corrigieron errores en el `Kafka` engine: interbloqueos después de las excepciones al comenzar a leer datos, y se bloquea al finalizar [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- Para `Kafka` mesas, el opcional `schema` no se aprobó el parámetro (el esquema del `Cap'n'Proto` formato). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) +- Si el conjunto de servidores ZooKeeper tiene servidores que aceptan la conexión pero luego la cierran inmediatamente en lugar de responder al protocolo de enlace, ClickHouse elige conectar otro servidor. Anteriormente, esto produjo el error `Cannot read all data. Bytes read: 0. Bytes expected: 4.` y el servidor no pudo iniciarse. [Nombre de la red inalámbrica (SSID):](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) +- Si el conjunto de servidores ZooKeeper contiene servidores para los que la consulta DNS devuelve un error, estos servidores se ignoran. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) +- Conversión de tipo fijo entre `Date` y `DateTime` al insertar datos en el `VALUES` formato (si `input_format_values_interpret_expressions = 1`). Anteriormente, la conversión se realizaba entre el valor numérico del número de días en tiempo de Época Unix y la marca de tiempo Unix, lo que dio lugar a resultados inesperados. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) +- Conversión de tipo corregida entre `Decimal` y números enteros. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) +- Se corrigieron errores en el `enable_optimize_predicate_expression` configuración. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) +- Se ha corregido un error de análisis en formato CSV con números de coma flotante si se utiliza un separador CSV no predeterminado, como por ejemplo `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) +- Se corrigió el `arrayCumSumNonNegative` (no acumula valores negativos si el acumulador es menor que cero). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) +- Corregido cómo `Merge` las tablas funcionan encima de `Distributed` cuando se utiliza `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) +- Corrección de errores en el `ALTER UPDATE` consulta. +- Se corrigieron errores en el `odbc` función de tabla que apareció en la versión 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) +- Se corrigió el funcionamiento de las funciones agregadas con `StateArray` combinadores. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) +- Se corrigió un bloqueo al dividir un `Decimal` valor por cero. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) +- Salida fija de tipos para operaciones usando `Decimal` y argumentos enteros. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) +- Corregido el segfault durante `GROUP BY` en `Decimal128`. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) +- El `log_query_threads` configuración (información de registro sobre cada subproceso de ejecución de la consulta) ahora sólo tiene efecto si `log_queries` opción (información de registro sobre consultas) se establece en 1. Desde el `log_query_threads` la opción está habilitada de forma predeterminada, la información sobre los subprocesos se registró previamente incluso si el registro de consultas estaba deshabilitado. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) +- Se corrigió un error en la operación distribuida de la función de agregado de cuantiles (el mensaje de error `Not found column quantile...`). [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) +- Se corrigió el problema de compatibilidad al trabajar en un clúster de servidores de la versión 18.12.17 y servidores anteriores al mismo tiempo. Para consultas distribuidas con claves GROUP BY de longitud fija y no fija, si había una gran cantidad de datos para agregar, los datos devueltos no siempre se agregaron completamente (dos filas diferentes contenían las mismas claves de agregación). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) +- Manejo fijo de sustituciones en `clickhouse-performance-test`, si la consulta contiene sólo una parte de las sustituciones declaradas en la prueba. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) +- Se corrigió un error al usar `FINAL` con `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Se corrigió un error al usar `PREWHERE` sobre las columnas que se agregaron durante `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Se agregó un cheque por la ausencia de `arrayJoin` para `DEFAULT` y `MATERIALIZED` expresiones. Previamente, `arrayJoin` llevado a un error al insertar datos. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) +- Se agregó un cheque por la ausencia de `arrayJoin` en una `PREWHERE` clausula. Anteriormente, esto llevó a mensajes como `Size ... doesn't match` o `Unknown compression method` al ejecutar consultas. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) +- Se corrigió el segfault que podía ocurrir en casos raros después de la optimización que reemplazaba las cadenas AND de las evaluaciones de igualdad con la expresión IN correspondiente. [Bienvenido a WordPress.](https://github.com/ClickHouse/ClickHouse/pull/3339) +- Correcciones menores a `clickhouse-benchmark`: anteriormente, la información del cliente no se enviaba al servidor; ahora el número de consultas ejecutadas se calcula con mayor precisión al apagar y para limitar el número de iteraciones. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-1} + +- Eliminado el `allow_experimental_decimal_type` opcion. El `Decimal` tipo de datos está disponible para su uso predeterminado. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) + +## Lanzamiento De ClickHouse 18.12 {#clickhouse-release-18-12} + +### Lanzamiento De ClickHouse 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} + +#### Novedad: {#new-features-2} + +- `invalidate_query` (la capacidad de especificar una consulta para comprobar si es necesario actualizar un diccionario externo) `clickhouse` fuente. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) +- Se agregó la capacidad de usar `UInt*`, `Int*`, y `DateTime` tipos de datos (junto con el `Date` tipo) como un `range_hashed` clave de diccionario externa que define los límites de los rangos. Ahora `NULL` se puede utilizar para designar un rango abierto. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) +- El `Decimal` tipo ahora soporta `var*` y `stddev*` funciones agregadas. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- El `Decimal` tipo ahora soporta funciones matemáticas (`exp`, `sin` y así sucesivamente.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- El `system.part_log` ahora tiene el `partition_id` columna. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Corrección De Errores: {#bug-fixes-11} + +- `Merge` ahora funciona correctamente en `Distributed` tabla. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) +- Incompatibilidad fija (dependencia innecesaria del `glibc` versión) que hizo imposible ejecutar ClickHouse en `Ubuntu Precise` y versiones anteriores. La incompatibilidad surgió en la versión 18.12.13. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) +- Se corrigieron errores en el `enable_optimize_predicate_expression` configuración. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) +- Se corrigió un problema menor con compatibilidad con versiones anteriores que aparecía al trabajar con un clúster de réplicas en versiones anteriores a 18.12.13 y al mismo tiempo crear una nueva réplica de una tabla en un servidor con una versión más reciente (que se muestra en el mensaje `Can not clone replica, because the ... updated to new ClickHouse version`, lo cual es lógico, pero no debería suceder). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-2} + +- El `enable_optimize_predicate_expression` opción está habilitada por defecto (que es bastante optimista). Si se producen errores de análisis de consultas relacionados con la búsqueda de los nombres de columna, establezca `enable_optimize_predicate_expression` a 0. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) + +### Lanzamiento De ClickHouse 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} + +#### Novedad: {#new-features-3} + +- Añadido soporte para `ALTER UPDATE` consulta. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) +- Se agregó el `allow_ddl` opción, que restringe el acceso del usuario a consultas DDL. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) +- Se agregó el `min_merge_bytes_to_use_direct_io` opción para `MergeTree` los motores, que le permite establecer un umbral para el tamaño total de la fusión (cuando está por encima del umbral, los archivos de partes de datos se manejarán usando O\_DIRECT). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) +- El `system.merges` tabla del sistema ahora contiene el `partition_id` columna. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) + +#### Mejora {#improvements-3} + +- Si una parte de datos permanece sin cambios durante la mutación, no se descarga mediante réplicas. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) +- Autocompletar está disponible para nombres de configuraciones cuando se trabaja con `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) + +#### Corrección De Errores: {#bug-fixes-12} + +- Se agregó una verificación para los tamaños de las matrices que son elementos de `Nested` escriba campos al insertar. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) +- Se corrigió un error al actualizar los diccionarios externos con el `ODBC` fuente y `hashed` almacenamiento. Este error se produjo en la versión 18.12.13. +- Se corrigió un bloqueo al crear una tabla temporal a partir de una consulta con un `IN` condición. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) +- Se corrigió un error en las funciones agregadas para matrices que pueden tener `NULL` elemento. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) + +### Lanzamiento De ClickHouse 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} + +#### Novedad: {#new-features-4} + +- Se agregó el `DECIMAL(digits, scale)` tipo de datos (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). Para habilitarlo, use la configuración `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) +- Nuevo `WITH ROLLUP` modificador para `GROUP BY` (sintaxis alternativa: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) +- En consultas con JOIN, el carácter estrella se expande a una lista de columnas en todas las tablas, de acuerdo con el estándar SQL. Puede restaurar el comportamiento anterior configurando `asterisk_left_columns_only` a 1 en el nivel de configuración del usuario. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) +- Se agregó soporte para JOIN con funciones de tabla. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- Autocompletar presionando Tab en clickhouse-cliente. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) +- Ctrl + C en clickhouse-client borra una consulta que se ingresó. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) +- Se agregó el `join_default_strictness` ajuste (valores: `"`, `'any'`, `'all'`). Esto le permite no especificar `ANY` o `ALL` para `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) +- Cada línea del registro del servidor relacionada con el procesamiento de consultas muestra el ID de consulta. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Ahora puede obtener registros de ejecución de consultas en clickhouse-client (use el `send_logs_level` configuración). Con el procesamiento de consultas distribuidas, los registros se conectan en cascada desde todos los servidores. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- El `system.query_log` y `system.processes` (`SHOW PROCESSLIST`) las tablas ahora tienen información sobre todas las configuraciones modificadas al ejecutar una consulta (la estructura anidada `Settings` datos). Se agregó el `log_query_settings` configuración. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- El `system.query_log` y `system.processes` las tablas ahora muestran información sobre el número de subprocesos que participan en la ejecución de la consulta (consulte `thread_numbers` columna). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Añadir `ProfileEvents` contadores que miden el tiempo dedicado a leer y escribir a través de la red y a leer y escribir en el disco, el número de errores de red y el tiempo dedicado a esperar cuando el ancho de banda de la red es limitado. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Añadir `ProfileEvents`contadores que contienen las métricas del sistema de rusage (puede usarlas para obtener información sobre el uso de CPU en el espacio de usuario y el kernel, errores de página y modificadores de contexto), así como métricas de taskstats (utilícelas para obtener información sobre el tiempo de espera de E / S, el tiempo de espera de CPU y la cantidad de datos leídos [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- El `ProfileEvents` los contadores se aplican globalmente y para cada consulta, así como para cada subproceso de ejecución de consulta, lo que le permite perfilar el consumo de recursos por consulta en detalle. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Se agregó el `system.query_thread_log` tabla, que contiene información sobre cada subproceso de ejecución de consultas. Se agregó el `log_query_threads` configuración. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- El `system.metrics` y `system.events` las tablas ahora tienen documentación incorporada. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) +- Se agregó el `arrayEnumerateDense` función. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2975) +- Se agregó el `arrayCumSumNonNegative` y `arrayDifference` función. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) +- Se agregó el `retention` función de agregado. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) +- Ahora puede agregar (fusionar) estados de funciones agregadas utilizando el operador más y multiplicar los estados de funciones agregadas por una constante no negativa. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) +- Las tablas de la familia MergeTree ahora tienen la columna virtual `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Experimental características: {#experimental-features-1} + +- Se agregó el `LowCardinality(T)` tipo de datos. Este tipo de datos crea automáticamente un diccionario local de valores y permite el procesamiento de datos sin desempaquetar el diccionario. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) +- Se agregó un caché de funciones compiladas por JIT y un contador para el número de usos antes de compilar. Para compilar expresiones JIT, habilite la `compile_expressions` configuración. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) + +#### Mejora: {#improvements-4} + +- Se ha solucionado el problema con la acumulación ilimitada del registro de replicación cuando hay réplicas abandonadas. Se agregó un modo de recuperación efectivo para réplicas con un largo retraso. +- Rendimiento mejorado de `GROUP BY` con múltiples campos de agregación cuando uno de ellos es cadena y los otros son de longitud fija. +- Rendimiento mejorado al usar `PREWHERE` y con transferencia implícita de expresiones en `PREWHERE`. +- Rendimiento de análisis mejorado para formatos de texto (`CSV`, `TSV`). [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) +- Mejora del rendimiento de las cadenas de lectura y matrices en formatos binarios. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2955) +- Mayor rendimiento y menor consumo de memoria para consultas a `system.tables` y `system.columns` cuando hay un gran número de tablas en un solo servidor. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) +- Se corrigió un problema de rendimiento en el caso de una gran secuencia de consultas que resultaban en un error (el `_dl_addr` la función es visible en `perf top`, pero el servidor no está usando mucha CPU). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) +- Las condiciones se lanzan a la vista (cuando `enable_optimize_predicate_expression` está habilitado). [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- Mejoras en la funcionalidad del `UUID` tipo de datos. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) +- El `UUID` tipo de datos es compatible con los diccionarios de The-Alchemist. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) +- El `visitParamExtractRaw` funciona correctamente con estructuras anidadas. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) +- Cuando el `input_format_skip_unknown_fields` la configuración está habilitada, los campos de objeto `JSONEachRow` se omiten correctamente. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) +- Para un `CASE` expresión con condiciones, ahora puede omitir `ELSE`, que es equivalente a `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) +- El tiempo de espera de la operación ahora se puede configurar cuando se trabaja con ZooKeeper. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) +- Puede especificar un desplazamiento para `LIMIT n, m` como `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- Puede usar el `SELECT TOP n` sintaxis como una alternativa para `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- Aumentó el tamaño de la cola para escribir en las tablas del sistema, por lo que `SystemLog parameter queue is full` el error no ocurre tan a menudo. +- El `windowFunnel` La función de agregado ahora admite eventos que cumplen múltiples condiciones. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2801) +- Las columnas duplicadas se pueden usar en un `USING` cláusula para `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) +- `Pretty` los formatos ahora tienen un límite en la alineación de columnas por ancho. Utilice el `output_format_pretty_max_column_pad_width` configuración. Si un valor es más amplio, aún se mostrará en su totalidad, pero las otras celdas de la tabla no serán demasiado anchas. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) +- El `odbc` función de tabla ahora le permite especificar el nombre de la base de datos / esquema. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2885) +- Se agregó la capacidad de usar un nombre de usuario especificado en el `clickhouse-client` archivo de configuración. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) +- El `ZooKeeperExceptions` se ha dividido en tres contadores: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, y `ZooKeeperOtherExceptions`. +- `ALTER DELETE` las consultas funcionan para vistas materializadas. +- Se agregó aleatorización al ejecutar el hilo de limpieza periódicamente para `ReplicatedMergeTree` para evitar picos de carga periódicos cuando hay un gran número de `ReplicatedMergeTree` tabla. +- Soporte para `ATTACH TABLE ... ON CLUSTER` consulta. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) + +#### Corrección De Errores: {#bug-fixes-13} + +- Se corrigió un problema con `Dictionary` tablas (lanza el `Size of offsets doesn't match size of column` o `Unknown compression method` salvedad). Este error apareció en la versión 18.10.3. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) +- Se ha corregido un error al fusionar `CollapsingMergeTree` tablas si una de las partes de datos está vacía (estas partes se forman durante la fusión o `ALTER DELETE` si se han eliminado todos los datos), y `vertical` se utilizó el algoritmo para la fusión. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) +- Se corrigió una condición de carrera durante `DROP` o `TRUNCATE` para `Memory` tablas con una simultánea `SELECT`, lo que podría conducir a bloqueos del servidor. Este error apareció en la versión 1.1.54388. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) +- Se corrigió la posibilidad de pérdida de datos al insertar en `Replicated` tablas si el `Session is expired` se devuelve un error (la pérdida de datos puede ser detectada por el `ReplicatedDataLoss` métrica). Este error se produjo en la versión 1.1.54378. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) +- Se corrigió una falla seg durante `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) +- Se corrigió el error de búsqueda de nombres de columna cuando el `WHERE` la expresión consiste completamente en un nombre de columna completo, como `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) +- Se corrigió el “Not found column” error que se produjo al ejecutar consultas distribuidas si se solicita una sola columna que consta de una expresión IN con una subconsulta desde un servidor remoto. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) +- Se corrigió el `Block structure mismatch in UNION stream: different number of columns` error que se produjo para las consultas distribuidas si uno de los fragmentos es local y el otro no, y la optimización del movimiento a `PREWHERE` se activa. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) +- Se corrigió el `pointInPolygon` función para ciertos casos de polígonos no convexos. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) +- Se corrigió el resultado incorrecto al comparar `nan` con enteros. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) +- Se corrigió un error en el `zlib-ng` biblioteca que podría conducir a segfault en casos raros. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) +- Se corrigió una pérdida de memoria al insertar en una tabla con `AggregateFunction` columnas, si el estado de la función agregada no es simple (asigna memoria por separado), y si una sola solicitud de inserción da como resultado múltiples bloques pequeños. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) +- Se corrigió una condición de carrera al crear y eliminar la misma `Buffer` o `MergeTree` mesa simultáneamente. +- Se corrigió la posibilidad de una segfault al comparar tuplas formadas por ciertos tipos no triviales, como tuplas. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) +- Se corrigió la posibilidad de un segfault al ejecutar ciertos `ON CLUSTER` consulta. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) +- Se corrigió un error en el `arrayDistinct` función para `Nullable` elementos de matriz. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) +- El `enable_optimize_predicate_expression` opción ahora soporta correctamente casos con `SELECT *`. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) +- Se corrigió el segfault al reinicializar la sesión de ZooKeeper. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) +- Se corrigió el bloqueo de potencial cuando se trabajaba con ZooKeeper. +- Se corrigió el código incorrecto para agregar estructuras de datos anidadas en un `SummingMergeTree`. +- Al asignar memoria para estados de funciones agregadas, la alineación se tiene en cuenta correctamente, lo que permite utilizar operaciones que requieren alineación al implementar estados de funciones agregadas. [Más información](https://github.com/ClickHouse/ClickHouse/pull/2808) + +#### Solución De Seguridad: {#security-fix} + +- Uso seguro de las fuentes de datos ODBC. La interacción con los controladores ODBC utiliza un `clickhouse-odbc-bridge` proceso. Los errores en los controladores ODBC de terceros ya no causan problemas con la estabilidad del servidor o vulnerabilidades. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) +- Se corrigió la validación incorrecta de la ruta del archivo en el `catBoostPool` función de la tabla. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) +- El contenido de las tablas del sistema (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, y `replication_queue`) se filtran de acuerdo con el acceso configurado por el usuario a las bases de datos (`allow_databases`). [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-3} + +- En consultas con JOIN, el carácter estrella se expande a una lista de columnas en todas las tablas, de acuerdo con el estándar SQL. Puede restaurar el comportamiento anterior configurando `asterisk_left_columns_only` a 1 en el nivel de configuración del usuario. + +#### Crear Cambios: {#build-changes-2} + +- La mayoría de las pruebas de integración ahora se pueden ejecutar mediante confirmación. +- Las comprobaciones de estilo de código también se pueden ejecutar mediante confirmación. +- El `memcpy` la implementación se elige correctamente cuando se construye en CentOS7 / Fedora. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) +- Al usar clang para compilar, algunas advertencias de `-Weverything` se han añadido, además de la `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) +- La depuración de la compilación utiliza el `jemalloc` opción de depuración. +- La interfaz de la biblioteca para interactuar con ZooKeeper se declara abstracta. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) + +## Lanzamiento De ClickHouse 18.10 {#clickhouse-release-18-10} + +### Lanzamiento De ClickHouse 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} + +#### Novedad: {#new-features-5} + +- HTTPS se puede utilizar para la replicación. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) +- Se agregaron las funciones `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, y `murmurHash3_128` además de la existente `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) +- Compatibilidad con tipos Nullable en el controlador ODBC de ClickHouse (`ODBCDriver2` formato de salida). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) +- Soporte para `UUID` en las columnas clave. + +#### Mejora: {#improvements-5} + +- Los clústeres se pueden quitar sin reiniciar el servidor cuando se eliminan de los archivos de configuración. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) +- Los diccionarios externos se pueden quitar sin reiniciar el servidor cuando se eliminan de los archivos de configuración. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) +- Añadir `SETTINGS` soporte para el `Kafka` motor de mesa. [Alejandro Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) +- Mejoras para el `UUID` tipo de datos (aún no completo). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) +- Soporte para piezas vacías después de fusiones en el `SummingMergeTree`, `CollapsingMergeTree` y `VersionedCollapsingMergeTree` motor. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) +- Se eliminan los registros antiguos de mutaciones completadas (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) +- Se agregó el `system.merge_tree_settings` tabla. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) +- El `system.tables` la tabla ahora tiene columnas de dependencia: `dependencies_database` y `dependencies_table`. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) +- Se agregó el `max_partition_size_to_drop` opción de configuración. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) +- Se agregó el `output_format_json_escape_forward_slashes` opcion. [Alejandro Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2812) +- Se agregó el `max_fetch_partition_retries_count` configuración. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) +- Se agregó el `prefer_localhost_replica` configuración para deshabilitar la preferencia de una réplica local e ir a una réplica local sin interacción entre procesos. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) +- El `quantileExact` devoluciones de la función agregada `nan` en el caso de la agregación en un vacío `Float32` o `Float64` establecer. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) + +#### Corrección De Errores: {#bug-fixes-14} + +- Se eliminó el escape innecesario de los parámetros de cadena de conexión para ODBC, lo que hizo imposible establecer una conexión. Este error se produjo en la versión 18.6.0. +- Se corrigió la lógica para el procesamiento `REPLACE PARTITION` comandos en la cola de replicación. Si hay dos `REPLACE` comandos para la misma partición, la lógica incorrecta podría hacer que uno de ellos permanezca en la cola de replicación y no se ejecute. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) +- Se corrigió un error de fusión cuando todas las partes de datos estaban vacías (partes que se formaron a partir de una fusión o de `ALTER DELETE` si se han eliminado todos los datos). Este error apareció en la versión 18.1.0. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) +- Se corrigió un error para concurrente `Set` o `Join`. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2823) +- Se corrigió el `Block structure mismatch in UNION stream: different number of columns` error que ocurrió para `UNION ALL` consultas dentro de una subconsulta si una de las `SELECT` queries contiene nombres de columna duplicados. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) +- Se corrigió una pérdida de memoria si se producía una excepción al conectarse a un servidor MySQL. +- Se corrigió el código de respuesta incorrecto de clickhouse-cliente en caso de un error de consulta. +- Se corrigió el comportamiento incorrecto de las vistas materializadas que contenían DISTINCT. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) + +#### Cambios Incompatibles Hacia atrás {#backward-incompatible-changes-4} + +- Se ha eliminado el soporte para consultas CHECK TABLE para tablas distribuidas. + +#### Crear Cambios: {#build-changes-3} + +- El asignador ha sido reemplazado: `jemalloc` ahora se utiliza en lugar de `tcmalloc`. En algunos escenarios, esto aumenta la velocidad hasta un 20%. Sin embargo, hay consultas que se han ralentizado hasta en un 20%. El consumo de memoria se ha reducido en aproximadamente un 10% en algunos escenarios, con una estabilidad mejorada. Con cargas altamente competitivas, el uso de CPU en el espacio de usuario y en el sistema muestra solo un ligero aumento. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) +- Uso de libressl desde un submódulo. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) +- Uso de unixodbc desde un submódulo. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) +- Uso de mariadb-connector-c desde un submódulo. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) +- Se agregaron archivos de prueba funcionales al repositorio que dependen de la disponibilidad de los datos de prueba (por el momento, sin los datos de prueba en sí). + +## Lanzamiento De ClickHouse 18.6 {#clickhouse-release-18-6} + +### Lanzamiento De ClickHouse 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} + +#### Novedad: {#new-features-6} + +- Se agregó soporte para expresiones ON para la sintaxis JOIN ON: + `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` + La expresión debe ser una cadena de igualdad unida por el operador AND. Cada lado de la igualdad puede ser una expresión arbitraria sobre las columnas de una de las tablas. Se admite el uso de nombres de columna completos (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) para la tabla correcta. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) +- HTTPS se puede habilitar para la replicación. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) + +#### Mejora: {#improvements-6} + +- El servidor pasa el componente de parche de su versión al cliente. Los datos sobre el componente de la versión del parche se encuentran en `system.processes` y `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) + +## Lanzamiento De ClickHouse 18.5 {#clickhouse-release-18-5} + +### Lanzamiento De ClickHouse 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} + +#### Novedad: {#new-features-7} + +- Se agregó la función hash `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). + +#### Mejora: {#improvements-7} + +- Ahora puedes usar el `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) atributo para establecer valores en archivos de configuración a partir de variables de entorno. +- Se agregaron versiones que no distinguen entre mayúsculas y minúsculas del `coalesce`, `ifNull`, y `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). + +#### Corrección De Errores: {#bug-fixes-15} + +- Se corrigió un posible error al iniciar una réplica [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). + +## Lanzamiento De ClickHouse 18.4 {#clickhouse-release-18-4} + +### Lanzamiento De ClickHouse 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} + +#### Novedad: {#new-features-8} + +- Tablas de sistema añadidas: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). +- Se agregó la capacidad de usar una función de tabla en lugar de una tabla como argumento de un `remote` o `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). +- Soporte para `HTTP Basic` autenticación en el protocolo de replicación [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). +- El `has` función ahora permite buscar un valor numérico en una matriz de `Enum` valor [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). +- Soporte para agregar separadores de mensajes arbitrarios al leer desde `Kafka` [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2701). + +#### Mejora: {#improvements-8} + +- El `ALTER TABLE t DELETE WHERE` La consulta no reescribe partes de datos que no se vieron afectadas por la condición WHERE [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). +- El `use_minimalistic_checksums_in_zookeeper` opción para `ReplicatedMergeTree` tables está habilitada de forma predeterminada. Esta configuración se agregó en la versión 1.1.54378, 16-04-2018. Las versiones que son anteriores a 1.1.54378 ya no se pueden instalar. +- Soporte para correr `KILL` y `OPTIMIZE` consultas que especifican `ON CLUSTER` [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). + +#### Corrección De Errores: {#bug-fixes-16} + +- Corregido el error `Column ... is not under an aggregate function and not in GROUP BY` para la agregación con una expresión IN. Este error apareció en la versión 18.1.0. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) +- Se ha corregido un error en el `windowFunnel aggregate function` [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). +- Se ha corregido un error en el `anyHeavy` función agregada ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) +- Se corrigió el bloqueo del servidor al usar el `countArray()` función de agregado. + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-5} + +- Parámetros para `Kafka` el motor fue cambiado de `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` a `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. Si sus tablas usan `kafka_schema` o `kafka_num_consumers` parámetros, debe editar manualmente los archivos de metadatos `path/metadata/database/table.sql` y añadir `kafka_row_delimiter` parámetro con `''` valor. + +## Lanzamiento De ClickHouse 18.1 {#clickhouse-release-18-1} + +### Lanzamiento De ClickHouse 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} + +#### Novedad: {#new-features-9} + +- Soporte para el `ALTER TABLE t DELETE WHERE` consulta para tablas MergeTree no replicadas ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). +- Soporte para tipos arbitrarios para el `uniq*` familia de funciones agregadas ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). +- Soporte para tipos arbitrarios en operadores de comparación ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). +- El `users.xml` archivo permite establecer una máscara de subred en el formato `10.0.0.1/255.255.255.0`. Esto es necesario para usar máscaras para redes IPv6 con ceros en el medio ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). +- Se agregó el `arrayDistinct` función ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). +- El motor SummingMergeTree ahora puede funcionar con columnas de tipo AggregateFunction ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). + +#### Mejora: {#improvements-9} + +- Se ha cambiado el esquema de numeración para las versiones de lanzamiento. Ahora la primera parte contiene el año de lanzamiento (A.D., zona horaria de Moscú, menos 2000), la segunda parte contiene el número de cambios importantes (aumentos para la mayoría de las versiones) y la tercera parte es la versión del parche. Las versiones siguen siendo compatibles con versiones anteriores, a menos que se indique lo contrario en el registro de cambios. +- Conversiones más rápidas de números de coma flotante a una cadena ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2664)). +- Si se omitieron algunas filas durante una inserción debido a errores de análisis (esto es posible con el `input_allow_errors_num` y `input_allow_errors_ratio` configuración activada), el número de filas omitidas ahora se escribe en el registro del servidor ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). + +#### Corrección De Errores: {#bug-fixes-17} + +- Se corrigió el comando TRUNCATE para tablas temporales ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2624)). +- Se corrigió un punto muerto raro en la biblioteca de cliente ZooKeeper que se producía cuando había un error de red al leer la respuesta ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). +- Se corrigió un error durante un CAST a Nullable tipos ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). +- Se corrigió el resultado incorrecto de la `maxIntersection()` función cuando los límites de los intervalos coincidieron ([Miguel Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). +- Se corrigió la transformación incorrecta de la cadena de expresión OR en un argumento de función ([Más información](https://github.com/ClickHouse/ClickHouse/pull/2663)). +- Se corrigió la degradación del rendimiento para las consultas que contenían `IN (subquery)` expresiones dentro de otra subconsulta ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). +- Se corrigió la incompatibilidad entre servidores con diferentes versiones en consultas distribuidas `CAST` función que no está en letras mayúsculas ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). +- Se agregaron citas faltantes de identificadores para consultas a un DBMS externo ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-6} + +- La conversión de una cadena que contiene el número cero a DateTime no funciona. Ejemplo: `SELECT toDateTime('0')`. Esta es también la razón por la que `DateTime DEFAULT '0'` no funciona en tablas, así como `0` en los diccionarios. Solución: reemplazar `0` con `0000-00-00 00:00:00`. + +## Lanzamiento De ClickHouse 1.1 {#clickhouse-release-1-1} + +### Lanzamiento De ClickHouse 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} + +#### Novedad: {#new-features-10} + +- Se agregó el `histogram` función agregada ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). +- Ahora `OPTIMIZE TABLE ... FINAL` se puede utilizar sin especificar particiones para `ReplicatedMergeTree` ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2600)). + +#### Corrección De Errores: {#bug-fixes-18} + +- Se corrigió un problema con un tiempo de espera muy pequeño para los sockets (un segundo) para leer y escribir al enviar y descargar datos replicados, lo que hacía imposible descargar partes más grandes si hay una carga en la red o el disco (resultó en intentos cíclicos para descargar partes). Este error se produjo en la versión 1.1.54388. +- Se corrigieron problemas al usar chroot en ZooKeeper si insertaba bloques de datos duplicados en la tabla. +- El `has` la función ahora funciona correctamente para una matriz con elementos Nullable ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). +- El `system.tables` la tabla ahora funciona correctamente cuando se usa en consultas distribuidas. El `metadata_modification_time` y `engine_full` Las columnas ahora no son virtuales. Se corrigió un error que se producía si solo se consultaban estas columnas desde la tabla. +- Se corrigió cómo un vacío `TinyLog` la tabla funciona después de insertar un bloque de datos vacío ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). +- El `system.zookeeper` table funciona si el valor del nodo en ZooKeeper es NULL. + +### Lanzamiento De ClickHouse 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} + +#### Novedad: {#new-features-11} + +- Las consultas se pueden enviar en `multipart/form-data` formato (en el `query` campo), que es útil si también se envían datos externos para el procesamiento de consultas ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). +- Se agregó la capacidad de habilitar o deshabilitar el procesamiento de comillas simples o dobles al leer datos en formato CSV. Puede configurar esto en el `format_csv_allow_single_quotes` y `format_csv_allow_double_quotes` configuración ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2574)). +- Ahora `OPTIMIZE TABLE ... FINAL` se puede utilizar sin especificar la partición para variantes no replicadas de `MergeTree` ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2599)). + +#### Mejora: {#improvements-10} + +- Rendimiento mejorado, consumo de memoria reducido y seguimiento correcto del consumo de memoria con el uso del operador IN cuando se podría usar un índice de tabla ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). +- Se eliminó la comprobación redundante de las sumas de comprobación al agregar una parte de datos. Esto es importante cuando hay un gran número de réplicas, porque en estos casos el número total de comprobaciones fue igual a N^2. +- Añadido soporte para `Array(Tuple(...))` los argumentos para el `arrayEnumerateUniq` función ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). +- Añadir `Nullable` soporte para el `runningDifference` función ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). +- Mejora del rendimiento del análisis de consultas cuando hay un gran número de expresiones ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). +- Selección más rápida de partes de datos para la fusión en `ReplicatedMergeTree` tabla. Recuperación más rápida de la sesión ZooKeeper ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). +- El `format_version.txt` archivo para `MergeTree` tables se vuelve a crear si falta, lo que tiene sentido si ClickHouse se inicia después de copiar la estructura de directorios sin archivos ([Películas De Sexo](https://github.com/ClickHouse/ClickHouse/pull/2593)). + +#### Corrección De Errores: {#bug-fixes-19} + +- Se corrigió un error al trabajar con ZooKeeper que podría hacer imposible recuperar la sesión y los estados de solo lectura de las tablas antes de reiniciar el servidor. +- Se ha corregido un error al trabajar con ZooKeeper que podría hacer que los nodos antiguos no se eliminen si se interrumpe la sesión. +- Se corrigió un error en el `quantileTDigest` función para argumentos Float (este error se introdujo en la versión 1.1.54388) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). +- Se corrigió un error en el índice de las tablas MergeTree si la columna de clave principal se encuentra dentro de la función para convertir tipos entre enteros con signo y sin signo del mismo tamaño ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). +- Segfault fijo si `macros` se usan pero no están en el archivo de configuración ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). +- Se corrigió el cambio a la base de datos predeterminada al volver a conectar el cliente ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). +- Se corrigió un error que ocurría cuando el `use_index_for_in_with_subqueries` la configuración estaba deshabilitada. + +#### Solución De Seguridad: {#security-fix-1} + +- El envío de archivos ya no es posible cuando se conecta a MySQL (`LOAD DATA LOCAL INFILE`). + +### Lanzamiento De ClickHouse 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} + +#### Novedad: {#new-features-12} + +- Soporte para el `ALTER TABLE t DELETE WHERE` consulta para tablas replicadas. Se agregó el `system.mutations` para realizar un seguimiento del progreso de este tipo de consultas. +- Soporte para el `ALTER TABLE t [REPLACE|ATTACH] PARTITION` consulta para tablas \*MergeTree. +- Soporte para el `TRUNCATE TABLE` consulta ([Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) +- Varios nuevos `SYSTEM` consultas para tablas replicadas (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). +- Se agregó la capacidad de escribir en una tabla con el motor MySQL y la función de tabla correspondiente ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). +- Se agregó el `url()` función de la tabla y el `URL` motor de mesa ([Alejandro Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). +- Se agregó el `windowFunnel` función agregada ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). +- Nuevo `startsWith` y `endsWith` funciones para cadenas ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). +- El `numbers()` función de tabla ahora le permite especificar el desplazamiento ([Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). +- La contraseña para `clickhouse-client` se puede introducir de forma interactiva. +- Los registros del servidor ahora se pueden enviar a syslog ([Alejandro Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). +- Compatibilidad con el inicio de sesión en diccionarios con una fuente de biblioteca compartida ([Alejandro Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). +- Soporte para delimitadores CSV personalizados ([Ivan Zhukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) +- Se agregó el `date_time_input_format` configuración. Si cambia esta configuración a `'best_effort'`, DateTime valores se leerán en una amplia gama de formatos. +- Se agregó el `clickhouse-obfuscator` utilidad para la ofuscación de datos. Ejemplo de uso: publicación de datos utilizados en pruebas de rendimiento. + +#### Experimental características: {#experimental-features-2} + +- Se agregó la capacidad de calcular `and` solo donde se necesitan ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) +- La compilación JIT a código nativo ya está disponible para algunas expresiones ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). + +#### Corrección De Errores: {#bug-fixes-20} + +- Los duplicados ya no aparecen para una consulta con `DISTINCT` y `ORDER BY`. +- Consultas con `ARRAY JOIN` y `arrayFilter` ya no devuelve un resultado incorrecto. +- Se corrigió un error al leer una columna de matriz desde una estructura anidada ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). +- Se corrigió un error al analizar consultas con una cláusula HAVING como `HAVING tuple IN (...)`. +- Se ha corregido un error al analizar consultas con alias recursivos. +- Se corrigió un error al leer desde ReplacingMergeTree con una condición en PREWHERE que filtra todas las filas ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). +- La configuración del perfil de usuario no se aplicó al usar sesiones en la interfaz HTTP. +- Se corrigió cómo se aplican los ajustes desde los parámetros de línea de comandos en clickhouse-local. +- La biblioteca de cliente ZooKeeper ahora usa el tiempo de espera de sesión recibido del servidor. +- Se ha corregido un error en la biblioteca de cliente ZooKeeper cuando el cliente esperaba la respuesta del servidor más tiempo que el tiempo de espera. +- Poda fija de piezas para consultas con condiciones en columnas de clave de partición ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). +- Las fusiones ahora son posibles después `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). +- Se ha corregido la asignación de tipos en la función de tabla ODBC ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). +- Las comparaciones de tipos se han fijado para `DateTime` con y sin la zona horaria ([Alejandro Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). +- Análisis sintáctico fijo y formato del `CAST` operador. +- Inserción fija en una vista materializada para el motor de tabla distribuida ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). +- Se corrigió una condición de carrera al escribir datos desde el `Kafka` motor a vistas materializadas ([Información adicional](https://github.com/ClickHouse/ClickHouse/pull/2448)). +- SSRF fijo en la función de tabla remota (). +- Comportamiento de salida fijo de `clickhouse-client` en modo multilínea ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). + +#### Mejora: {#improvements-11} + +- Las tareas en segundo plano de las tablas replicadas ahora se realizan en un grupo de subprocesos en lugar de en subprocesos separados ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). +- Mejora del rendimiento de compresión LZ4. +- Análisis más rápido para consultas con un gran número de JOIN y subconsultas. +- La caché DNS ahora se actualiza automáticamente cuando hay demasiados errores de red. +- Las inserciones de tabla ya no se producen si la inserción en una de las vistas materializadas no es posible porque tiene demasiadas partes. +- Se ha corregido la discrepancia en los contadores de eventos `Query`, `SelectQuery`, y `InsertQuery`. +- Expresiones como `tuple IN (SELECT tuple)` se permiten si los tipos de tupla coinciden. +- Un servidor con tablas replicadas puede iniciarse incluso si no ha configurado ZooKeeper. +- Al calcular el número de núcleos de CPU disponibles, ahora se tienen en cuenta los límites en cgroups ([Más información](https://github.com/ClickHouse/ClickHouse/pull/2325)). +- Se agregó chown para los directorios de configuración en el archivo de configuración systemd ([Mikhail Shiryaev](https://github.com/ClickHouse/ClickHouse/pull/2421)). + +#### Crear Cambios: {#build-changes-4} + +- El compilador gcc8 se puede usar para compilaciones. +- Se agregó la capacidad de construir llvm desde el submódulo. +- La versión de la biblioteca librdkafka se ha actualizado a v0.11.4. +- Se agregó la capacidad de usar la biblioteca libcpuid del sistema. La versión de la biblioteca se ha actualizado a 0.4.0. +- Se corrigió la compilación usando la biblioteca vectorclass ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). +- Cmake ahora genera archivos para ninja de forma predeterminada (como cuando se usa `-G Ninja`). +- Se agregó la capacidad de usar la biblioteca libtinfo en lugar de libtermcap ([Nuestros Servicios](https://github.com/ClickHouse/ClickHouse/pull/2519)). +- Se corrigió un conflicto de archivos de encabezado en Fedora Rawhide ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-7} + +- Eliminado escapar en `Vertical` y `Pretty*` formatea y elimina el `VerticalRaw` formato. +- Si los servidores con la versión 1.1.54388 (o posterior) y los servidores con una versión anterior se utilizan simultáneamente en una consulta distribuida y la consulta tiene `cast(x, 'Type')` expresión sin `AS` palabra clave y no tiene la palabra `cast` en mayúsculas, se lanzará una excepción con un mensaje como `Not found column cast(0, 'UInt8') in block`. Solución: actualice el servidor en todo el clúster. + +### Lanzamiento De ClickHouse 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} + +#### Corrección De Errores: {#bug-fixes-21} + +- Se corrigió un error que en algunos casos causaba que las operaciones de ZooKeeper se bloquearan. + +### Lanzamiento De ClickHouse 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} + +#### Corrección De Errores: {#bug-fixes-22} + +- Se corrigió una desaceleración de la cola de replicación si una tabla tiene muchas réplicas. + +### Lanzamiento De ClickHouse 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} + +#### Corrección De Errores: {#bug-fixes-23} + +- Se corrigió una fuga de nodos en ZooKeeper cuando ClickHouse pierde la conexión con el servidor ZooKeeper. + +### Lanzamiento De ClickHouse 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} + +#### Novedad: {#new-features-13} + +- Se agregó la función de tabla `file(path, format, structure)`. Un ejemplo de lectura de bytes de `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. + +#### Mejora: {#improvements-12} + +- Las subconsultas se pueden envolver en `()` para mejorar la legibilidad de las consultas. Por ejemplo: `(SELECT 1) UNION ALL (SELECT 1)`. +- Simple `SELECT` consultas de la `system.processes` no están incluidos en el `max_concurrent_queries` limite. + +#### Corrección De Errores: {#bug-fixes-24} + +- Corregido el comportamiento incorrecto del `IN` operador cuando seleccione de `MATERIALIZED VIEW`. +- Se corrigió el filtrado incorrecto por índice de partición en expresiones como `partition_key_column IN (...)`. +- Se corrigió la imposibilidad de ejecutar `OPTIMIZE` consulta sobre réplica no líder si `REANAME` se realizó sobre la mesa. +- Se corrigió el error de autorización al ejecutar `OPTIMIZE` o `ALTER` consultas en una réplica que no sea de líder. +- Congelación fija de `KILL QUERY`. +- Se corrigió un error en la biblioteca de cliente ZooKeeper que provocaba la pérdida de observaciones, la congelación de la cola DDL distribuida y ralentizaciones en la cola de replicación si no estaba vacía `chroot` prefijo se utiliza en la configuración ZooKeeper. + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-8} + +- Se eliminó el soporte para expresiones como `(a, b) IN (SELECT (a, b))` (puede usar la expresión equivalente `(a, b) IN (SELECT a, b)`). En versiones anteriores, estas expresiones conducían a `WHERE` filtrado o errores causados. + +### Lanzamiento De ClickHouse 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} + +#### Novedad: {#new-features-14} + +- El nivel de registro se puede cambiar sin reiniciar el servidor. +- Se agregó el `SHOW CREATE DATABASE` consulta. +- El `query_id` se puede pasar a `clickhouse-client` (elBroom). +- Nueva configuración: `max_network_bandwidth_for_all_users`. +- Añadido soporte para `ALTER TABLE ... PARTITION ...` para `MATERIALIZED VIEW`. +- Se agregó información sobre el tamaño de las partes de datos en forma sin comprimir en la tabla del sistema. +- Soporte de cifrado de servidor a servidor para tablas distribuidas (`1` en la configuración de réplica en ``). +- Configuración del nivel de tabla para el `ReplicatedMergeTree` familia con el fin de minimizar la cantidad de datos almacenados en Zookeeper: : `use_minimalistic_checksums_in_zookeeper = 1` +- Configuración del `clickhouse-client` pedir. De forma predeterminada, los nombres de servidor ahora se envían al mensaje. El nombre para mostrar del servidor se puede cambiar. También se envía en el `X-ClickHouse-Display-Name` Encabezado HTTP (Kirill Shvakov). +- Múltiples separados por comas `topics` se puede especificar para el `Kafka` motor (Tobias Adamson) +- Cuando una consulta es detenida por `KILL QUERY` o `replace_running_query` el cliente recibe el `Query was canceled` excepción en lugar de un resultado incompleto. + +#### Mejora: {#improvements-13} + +- `ALTER TABLE ... DROP/DETACH PARTITION` las consultas se ejecutan en la parte frontal de la cola de replicación. +- `SELECT ... FINAL` y `OPTIMIZE ... FINAL` se puede utilizar incluso cuando la tabla tiene una única parte de datos. +- A `query_log` se recrea sobre la marcha si se eliminó manualmente (Kirill Shvakov). +- El `lengthUTF8` funciona más rápido (zhang2014). +- Rendimiento mejorado de los insertos síncronos en `Distributed` tabla (`insert_distributed_sync = 1`) cuando hay una gran cantidad de fragmentos. +- El servidor acepta el `send_timeout` y `receive_timeout` configuraciones del cliente y las aplica cuando se conecta al cliente (se aplican en orden inverso: el socket del servidor `send_timeout` se establece en el `receive_timeout` valor recibido del cliente, y viceversa). +- Recuperación de bloqueos más robusta para la inserción asincrónica en `Distributed` tabla. +- El tipo de devolución del `countEqual` función cambiada de `UInt32` a `UInt64` (谢磊). + +#### Corrección De Errores: {#bug-fixes-25} + +- Se corrigió un error con `IN` cuando el lado izquierdo de la expresión es `Nullable`. +- Ahora se devuelven los resultados correctos cuando se usan tuplas con `IN` cuando algunos de los componentes de la tupla están en el índice de la tabla. +- El `max_execution_time` limit ahora funciona correctamente con consultas distribuidas. +- Se corrigieron errores al calcular el tamaño de las columnas compuestas en el `system.columns` tabla. +- Se corrigió un error al crear una tabla temporal `CREATE TEMPORARY TABLE IF NOT EXISTS.` +- Corregidos errores en `StorageKafka` (\#\#2075) +- Se corrigieron fallos del servidor por argumentos no válidos de ciertas funciones agregadas. +- Se corrigió el error que impedía el `DETACH DATABASE` consulta de detener las tareas en segundo plano para `ReplicatedMergeTree` tabla. +- `Too many parts` es menos probable que ocurra al insertar en vistas materializadas agregadas (\#\# 2084). +- Se corrigió el manejo recursivo de sustituciones en la configuración si una sustitución debe ir seguida de otra sustitución en el mismo nivel. +- Se ha corregido la sintaxis en el archivo de metadatos al crear un `VIEW` que usa una consulta con `UNION ALL`. +- `SummingMergeTree` ahora funciona correctamente para la suma de estructuras de datos anidadas con una clave compuesta. +- Se corrigió la posibilidad de una condición de carrera al elegir el líder para `ReplicatedMergeTree` tabla. + +#### Crear Cambios: {#build-changes-5} + +- La compilación admite `ninja` en lugar de `make` y usos `ninja` de forma predeterminada para la creación de versiones. +- Paquetes renombrados: `clickhouse-server-base` en `clickhouse-common-static`; `clickhouse-server-common` en `clickhouse-server`; `clickhouse-common-dbg` en `clickhouse-common-static-dbg`. Para instalar, utilice `clickhouse-server clickhouse-client`. Los paquetes con los nombres antiguos aún se cargarán en los repositorios por compatibilidad con versiones anteriores. + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-9} + +- Se eliminó la interpretación especial de una expresión IN si se especifica una matriz en el lado izquierdo. Anteriormente, la expresión `arr IN (set)` se interpretó como “at least one `arr` element belongs to the `set`”. Para obtener el mismo comportamiento en la nueva versión, escriba `arrayExists(x -> x IN (set), arr)`. +- Deshabilitado el uso incorrecto de la opción de socket `SO_REUSEPORT`, que se habilitó incorrectamente de forma predeterminada en la biblioteca Poco. Tenga en cuenta que en Linux ya no hay ninguna razón para especificar simultáneamente las direcciones `::` y `0.0.0.0` for listen – use just `::`, que permite escuchar la conexión tanto a través de IPv4 como IPv6 (con los ajustes de configuración predeterminados del kernel). También puede volver al comportamiento de versiones anteriores especificando `1` en la configuración. + +### Lanzamiento De ClickHouse 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} + +#### Novedad: {#new-features-15} + +- Se agregó el `system.macros` tabla y actualización automática de macros cuando se cambia el archivo de configuración. +- Se agregó el `SYSTEM RELOAD CONFIG` consulta. +- Se agregó el `maxIntersections(left_col, right_col)` función de agregado, que devuelve el número máximo de intervalos de intersección simultáneamente `[left; right]`. El `maxIntersectionsPosition(left, right)` función devuelve el comienzo de la “maximum” intervalo. ([Miguel Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). + +#### Mejora: {#improvements-14} + +- Al insertar datos en un `Replicated` se hacen menos solicitudes para `ZooKeeper` (y la mayoría de los errores de nivel de usuario han desaparecido del `ZooKeeper` registro). +- Se agregó la capacidad de crear alias para conjuntos de datos. Ejemplo: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. + +#### Corrección De Errores: {#bug-fixes-26} + +- Se corrigió el `Illegal PREWHERE` error al leer de las tablas Merge para `Distributed`tabla. +- Se agregaron correcciones que le permiten iniciar clickhouse-server en contenedores Docker solo para IPv4. +- Se corrigió una condición de carrera al leer desde el sistema `system.parts_columns tables.` +- Se eliminó el doble almacenamiento en búfer durante una inserción síncrona en un `Distributed` tabla, lo que podría haber causado que la conexión agotara el tiempo de espera. +- Se corrigió un error que causaba esperas excesivamente largas para una réplica no disponible antes de comenzar un `SELECT` consulta. +- Se corrigieron fechas incorrectas en el `system.parts` tabla. +- Se corrigió un error que hacía imposible insertar datos en un `Replicated` mesa si `chroot` no estaba vacío en la configuración del `ZooKeeper` Cluster. +- Se corrigió el algoritmo de fusión vertical para un vacío `ORDER BY` tabla. +- Se restauró la capacidad de usar diccionarios en consultas a tablas remotas, incluso si estos diccionarios no están presentes en el servidor del solicitante. Esta funcionalidad se perdió en la versión 1.1.54362. +- Restauró el comportamiento para consultas como `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` cuando el lado derecho de la `IN` debe utilizar un control remoto `default.table` en lugar de uno local. Este comportamiento se rompió en la versión 1.1.54358. +- Se eliminó el registro de nivel de error extraño de `Not found column ... in block`. + +### ¿Qué Puedes Encontrar En Neodigit {#clickhouse-release-1-1-54362-2018-03-11} + +#### Novedad: {#new-features-16} + +- Agregación sin `GROUP BY` para un conjunto vacío (como `SELECT count(*) FROM table WHERE 0`) ahora devuelve un resultado con una fila con valores nulos para funciones agregadas, de acuerdo con el estándar SQL. Para restaurar el comportamiento anterior (devolver un resultado vacío), establezca `empty_result_for_aggregation_by_empty_set` a 1. +- Añadido tipo de conversión para `UNION ALL`. Se permiten diferentes nombres de alias en `SELECT` posiciones en `UNION ALL`, de acuerdo con el estándar SQL. +- Las expresiones arbitrarias se admiten en `LIMIT BY` clausula. Anteriormente, solo era posible usar columnas resultantes de `SELECT`. +- Un índice de `MergeTree` se utiliza cuando `IN` se aplica a una tupla de expresiones de las columnas de la clave principal. Ejemplo: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). +- Se agregó el `clickhouse-copier` herramienta para copiar entre clústeres y resharding datos (beta). +- Se agregaron funciones hash consistentes: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. Se pueden usar como una clave de fragmentación para reducir la cantidad de tráfico de red durante los subsiguientes reshardings. +- Funciones añadidas: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. +- Se agregó el `arrayCumSum` (Javi Santana). +- Se agregó el `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, y `parseDateTimeBestEffortOrNull` funciones para leer el DateTime de una cadena que contiene texto en una amplia variedad de formatos posibles. +- Los datos se pueden volver a cargar parcialmente de diccionarios externos durante la actualización (cargar sólo los registros en los que el valor del campo especificado mayor que en la descarga anterior) (Arsen Hakobyan). +- Se agregó el `cluster` función de la tabla. Ejemplo: `cluster(cluster_name, db, table)`. El `remote` función de tabla puede aceptar el nombre del clúster como el primer argumento, si se especifica como un identificador. +- El `remote` y `cluster` las funciones de la tabla se pueden utilizar en `INSERT` consulta. +- Se agregó el `create_table_query` y `engine_full` columnas virtuales a la `system.tables`tabla . El `metadata_modification_time` columna es virtual. +- Se agregó el `data_path` y `metadata_path` columnas a `system.tables`y`system.databases` tablas, y añadió el `path` columna a la `system.parts` y `system.parts_columns` tabla. +- Se agregó información adicional sobre fusiones en el `system.part_log` tabla. +- Se puede utilizar una clave de partición arbitraria para `system.query_log` (Kirill Shvakov). +- El `SHOW TABLES` consulta ahora también muestra tablas temporales. Se agregaron tablas temporales y el `is_temporary` columna a `system.tables` (zhang2014). +- Añadir `DROP TEMPORARY TABLE` y `EXISTS TEMPORARY TABLE` consultas (zhang2014). +- Soporte para `SHOW CREATE TABLE` para tablas temporales (zhang2014). +- Se agregó el `system_profile` parámetro de configuración para los ajustes utilizados por los procesos internos. +- Soporte para carga `object_id` como un atributo en `MongoDB` diccionarios (Pavel Litvinenko). +- Lectura `null` como el valor predeterminado al cargar datos para un diccionario externo con el `MongoDB` fuente (Pavel Litvinenko). +- Lectura `DateTime` valores en el `Values` formato de una marca de tiempo Unix sin comillas simples. +- La conmutación por error se admite en `remote` funciones de tabla para los casos en que a algunas de las réplicas les falta la tabla solicitada. +- Los valores de configuración se pueden anular en la línea de comandos al ejecutar `clickhouse-server`. Ejemplo: `clickhouse-server -- --logger.level=information`. +- Implementado el `empty` función de un `FixedString` argumento: la función devuelve 1 si la cadena consta completamente de bytes nulos (zhang2014). +- Se agregó el `listen_try`parámetro de configuración para escuchar al menos una de las direcciones de escucha sin salir, si algunas de las direcciones no se pueden escuchar (útil para sistemas con soporte deshabilitado para IPv4 o IPv6). +- Se agregó el `VersionedCollapsingMergeTree` motor de mesa. +- Soporte para filas y tipos numéricos arbitrarios para el `library` fuente del diccionario. +- `MergeTree` las tablas se pueden usar sin una clave principal (debe especificar `ORDER BY tuple()`). +- A `Nullable` tipo puede ser `CAST` a un no-`Nullable` escriba si el argumento no es `NULL`. +- `RENAME TABLE` se puede realizar para `VIEW`. +- Se agregó el `throwIf` función. +- Se agregó el `odbc_default_field_size` opción, que le permite extender el tamaño máximo del valor cargado desde una fuente ODBC (por defecto, es 1024). +- El `system.processes` mesa y `SHOW PROCESSLIST` ahora tienen el `is_cancelled` y `peak_memory_usage` columna. + +#### Mejora: {#improvements-15} + +- Los límites y las cuotas sobre el resultado ya no se aplican a los datos intermedios para `INSERT SELECT` consultas o para `SELECT` subconsultas. +- Menos desencadenantes falsos de `force_restore_data` al comprobar el estado de `Replicated` cuando se inicia el servidor. +- Se agregó el `allow_distributed_ddl` opcion. +- Las funciones no deterministas no están permitidas en expresiones para `MergeTree` teclas de mesa. +- Archivos con sustituciones de `config.d` los directorios se cargan en orden alfabético. +- Rendimiento mejorado del `arrayElement` función en el caso de una matriz multidimensional constante con una matriz vacía como uno de los elementos. Ejemplo: `[[1], []][x]`. +- El servidor se inicia más rápido ahora cuando se utilizan archivos de configuración con sustituciones muy grandes (por ejemplo, listas muy grandes de redes IP). +- Al ejecutar una consulta, las funciones de valor de tabla se ejecutan una vez. Previamente, `remote` y `mysql` las funciones de valor de tabla realizaron la misma consulta dos veces para recuperar la estructura de tabla de un servidor remoto. +- El `MkDocs` se utiliza el generador de documentación. +- Cuando intenta eliminar una columna de tabla que `DEFAULT`/`MATERIALIZED` expresiones de otras columnas dependen, se lanza una excepción (zhang2014). +- Se agregó la capacidad de analizar una línea vacía en formatos de texto como el número 0 para `Float` tipos de datos. Esta característica estaba disponible anteriormente, pero se perdió en la versión 1.1.54342. +- `Enum` se pueden utilizar en `min`, `max`, `sum` y algunas otras funciones. En estos casos, utiliza los valores numéricos correspondientes. Esta característica estaba disponible anteriormente, pero se perdió en la versión 1.1.54337. +- Añadir `max_expanded_ast_elements` para restringir el tamaño del AST después de expandir recursivamente los alias. + +#### Corrección De Errores: {#bug-fixes-27} + +- Fijo casos innecesarios columnas fueron retirados de las subconsultas en error, o no se quitan de subconsultas que contiene `UNION ALL`. +- Se corrigió un error en las fusiones para `ReplacingMergeTree` tabla. +- Inserciones síncronas fijas en `Distributed` tabla (`insert_distributed_sync = 1`). +- Segfault fijo para ciertos usos de `FULL` y `RIGHT JOIN` con columnas duplicadas en subconsultas. +- Segfault fijo para ciertos usos de `replace_running_query` y `KILL QUERY`. +- Se corrigió el orden de la `source` y `last_exception` columnas en el `system.dictionaries` tabla. +- Se corrigió un error cuando el `DROP DATABASE` la consulta no eliminó el archivo con metadatos. +- Se corrigió el `DROP DATABASE` consulta para `Dictionary` base. +- Se corrigió la baja precisión de `uniqHLL12` y `uniqCombined` funciones para cardinalidades superiores a 100 millones de artículos (Alex Bocharov). +- Se corrigió el cálculo de valores predeterminados implícitos cuando era necesario para calcular simultáneamente expresiones explícitas predeterminadas en `INSERT` consultas (zhang2014). +- Se corrigió un caso raro cuando una consulta a un `MergeTree` la tabla no pudo terminar (chenxing-xc). +- Se corrigió un bloqueo que se produjo al ejecutar un `CHECK` consulta para `Distributed` tablas si todos los fragmentos son locales (chenxing.xc). +- Se corrigió una ligera regresión de rendimiento con funciones que usan expresiones regulares. +- Se corrigió una regresión de rendimiento al crear matrices multidimensionales a partir de expresiones complejas. +- Se corrigió un error que podía causar un extra `FORMAT` sección para aparecer en una `.sql` archivo con metadatos. +- Se corrigió un error que causaba la `max_table_size_to_drop` límite para aplicar cuando se intenta eliminar un `MATERIALIZED VIEW` mirando una tabla explícitamente especificada. +- Se corrigió la incompatibilidad con clientes antiguos (a los clientes antiguos a veces se enviaban datos con el `DateTime('timezone')` tipo, que no entienden). +- Se ha corregido un error al leer `Nested` elementos de columna de estructuras que se agregaron usando `ALTER` pero que están vacíos para las particiones antiguas, cuando las condiciones para estas columnas se movieron a `PREWHERE`. +- Se corrigió un error al filtrar tablas por virtual `_table` columnas en consultas a `Merge` tabla. +- Se corrigió un error al usar `ALIAS` columnas en `Distributed` tabla. +- Se corrigió un error que hacía imposible la compilación dinámica para consultas con funciones agregadas del `quantile` familia. +- Se corrigió una condición de carrera en la canalización de ejecución de consultas que ocurría en casos muy raros al usar `Merge` con un gran número de tablas, y cuando se utiliza `GLOBAL` subconsultas. +- Se corrigió un bloqueo al pasar matrices de diferentes tamaños a un `arrayReduce` función cuando se utilizan funciones agregadas de múltiples argumentos. +- Prohibido el uso de consultas con `UNION ALL` en una `MATERIALIZED VIEW`. +- Se corrigió un error durante la inicialización del `part_log` tabla del sistema cuando se inicia el servidor (de forma predeterminada, `part_log` está deshabilitado). + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-10} + +- Eliminado el `distributed_ddl_allow_replicated_alter` opcion. Este comportamiento está habilitado de forma predeterminada. +- Eliminado el `strict_insert_defaults` configuración. Si estaba utilizando esta funcionalidad, escriba en `clickhouse-feedback@yandex-team.com`. +- Eliminado el `UnsortedMergeTree` motor. + +### ¿Qué Puedes Encontrar En Neodigit {#clickhouse-release-1-1-54343-2018-02-05} + +- Se agregó soporte de macros para definir nombres de clúster en consultas DDL distribuidas y constructores de tablas distribuidas: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. +- Ahora consultas como `SELECT ... FROM table WHERE expr IN (subquery)` se procesan utilizando el `table` Indice. +- Se ha mejorado el procesamiento de duplicados al insertar en tablas replicadas, por lo que ya no ralentizan la ejecución de la cola de replicación. + +### ¿Qué Puedes Encontrar En Neodigit {#clickhouse-release-1-1-54342-2018-01-22} + +Esta versión contiene correcciones de errores para la versión anterior 1.1.54337: + +- Se corrigió una regresión en 1.1.54337: si el usuario predeterminado tiene acceso de solo lectura, entonces el servidor se niega a iniciar con el mensaje `Cannot create database in readonly mode`. +- Se corrigió una regresión en 1.1.54337: en sistemas con systemd, los registros siempre se escriben en syslog independientemente de la configuración; el script de vigilancia todavía usa init .d. +- Se corrigió una regresión en 1.1.54337: configuración predeterminada incorrecta en la imagen de Docker. +- Comportamiento no determinista fijo de GraphiteMergeTree (se puede ver en los mensajes de registro `Data after merge is not byte-identical to the data on another replicas`). +- Se corrigió un error que podía provocar fusiones inconsistentes después de OPTIMIZE consulta a tablas replicadas (es posible que lo vea en los mensajes de registro `Part ... intersects the previous part`). +- Las tablas de búfer ahora funcionan correctamente cuando las columnas MATERIALIZED están presentes en la tabla de destino (por zhang2014). +- Se corrigió un error en la implementación de NULL. + +### ¿Qué Puedes Encontrar En Neodigit {#clickhouse-release-1-1-54337-2018-01-18} + +#### Novedad: {#new-features-17} + +- Se agregó soporte para el almacenamiento de matrices multidimensionales y tuplas (`Tuple` tipo de datos) en las tablas. +- Soporte para funciones de mesa para `DESCRIBE` y `INSERT` consulta. Se agregó soporte para subconsultas en `DESCRIBE`. Ejemplos: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. Soporte para `INSERT INTO TABLE` además de `INSERT INTO`. +- Soporte mejorado para zonas horarias. El `DateTime` tipo de datos se puede anotar con la zona horaria que se utiliza para el análisis y el formato en formatos de texto. Ejemplo: `DateTime('Europe/Moscow')`. Cuando las zonas horarias se especifican en `DateTime` argumentos, el tipo de devolución rastreará la zona horaria y el valor se mostrará como se esperaba. +- Se agregaron las funciones `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. El `toRelativeHour`/`Minute`/`Second` funciones pueden tomar un valor de tipo `Date` como argumento. El `now` nombre de la función distingue entre mayúsculas y minúsculas. +- Se agregó el `toStartOfFifteenMinutes` (Kirill Shvakov). +- Se agregó el `clickhouse format` herramienta para formatear consultas. +- Se agregó el `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` formato. Los archivos de esquema solo se pueden ubicar en el directorio especificado. +- Se agregó soporte para sustituciones de configuración (`incl` y `conf.d`) para la configuración de diccionarios y modelos externos (Pavel Yakunin). +- Se agregó una columna con documentación para el `system.settings` (Kirill Shvakov). +- Se agregó el `system.parts_columns` tabla con información sobre los tamaños de columna en cada parte de datos `MergeTree` tabla. +- Se agregó el `system.models` tabla con información sobre `CatBoost` modelos de aprendizaje automático. +- Se agregó el `mysql` y `odbc` función de la tabla y correspondiente `MySQL` y `ODBC` para acceder a bases de datos remotas. Esta funcionalidad se encuentra en la fase beta. +- Se agregó la posibilidad de pasar un argumento de tipo `AggregateFunction` para el `groupArray` función agregada (para que pueda crear una matriz de estados de alguna función agregada). +- Se eliminaron restricciones en varias combinaciones de combinadores de funciones agregadas. Por ejemplo, puede usar `avgForEachIf` así como `avgIfForEach` funciones agregadas, que tienen diferentes comportamientos. +- El `-ForEach` el combinador de funciones agregadas se extiende para el caso de funciones agregadas de múltiples argumentos. +- Se agregó soporte para funciones agregadas de `Nullable` argumentos incluso para los casos en que la función devuelve un no-`Nullable` resultado (añadido con la contribución de Silviu Caragea). Ejemplo: `groupArray`, `groupUniqArray`, `topK`. +- Se agregó el `max_client_network_bandwidth` para `clickhouse-client` (Kirill Shvakov). +- Los usuarios con `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). +- Se agregó soporte para el uso de múltiples consumidores con el `Kafka` motor. Opciones de configuración ampliadas para `Kafka` (Marek Vavruša). +- Se agregó el `intExp3` y `intExp4` función. +- Se agregó el `sumKahan` función de agregado. +- Añadido el a \* Número\* OrNull funciones, donde \* Número\* es un tipo numérico. +- Añadido soporte para `WITH` para una `INSERT SELECT` consulta (autor: zhang2014). +- Configuración añadida: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. En particular, estos valores se utilizan para descargar partes de datos para la replicación. Cambiar esta configuración permite una conmutación por error más rápida si la red está sobrecargada. +- Añadido soporte para `ALTER` para tablas de tipo `Null` (Anastasiya Tsarkova). +- El `reinterpretAsString` se extiende para todos los tipos de datos que se almacenan contiguamente en la memoria. +- Se agregó el `--silent` opción para el `clickhouse-local` herramienta. Suprime la información de ejecución de consultas de impresión en stderr. +- Se agregó soporte para leer valores de tipo `Date` de texto en un formato donde el mes y / o día del mes se especifica utilizando un solo dígito en lugar de dos dígitos (Amos Bird). + +#### Optimizaciones De Rendimiento: {#performance-optimizations} + +- Rendimiento mejorado de las funciones agregadas `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` de argumentos de cadena. +- Mejora del rendimiento de las funciones `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. +- Rendimiento mejorado del análisis y el formato `Date` y `DateTime` valores de tipo en formato de texto. +- Mejora del rendimiento y la precisión del análisis de números de coma flotante. +- Menor uso de memoria para `JOIN` en el caso cuando las partes izquierda y derecha tienen columnas con nombres idénticos que no están contenidos en `USING` . +- Rendimiento mejorado de las funciones agregadas `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` reduciendo la estabilidad computacional. Las funciones antiguas están disponibles bajo los nombres `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. + +#### Corrección De Errores: {#bug-fixes-28} + +- Deduplicación de datos fija después de ejecutar un `DROP` o `DETACH PARTITION` consulta. En la versión anterior, soltar una partición e insertar los mismos datos de nuevo no funcionaba porque los bloques insertados se consideraban duplicados. +- Se corrigió un error que podía conducir a una interpretación incorrecta de la `WHERE` cláusula para `CREATE MATERIALIZED VIEW` consultas con `POPULATE` . +- Se corrigió un error al usar el `root_path` parámetro en el `zookeeper_servers` configuración. +- Se corrigieron los resultados inesperados de pasar el `Date` argumento a `toStartOfDay` . +- Se corrigió el `addMonths` y `subtractMonths` funciones y la aritmética para `INTERVAL n MONTH` en los casos en que el resultado tiene el año anterior. +- Se agregó soporte faltante para el `UUID` tipo de datos para `DISTINCT` , `JOIN` , y `uniq` funciones agregadas y diccionarios externos (Evgeniy Ivanov). Soporte para `UUID` todavía está incompleto. +- Fijo `SummingMergeTree` comportamiento en los casos en que las filas suman a cero. +- Varias correcciones para el `Kafka` engine (Marek Vavruša). +- Corregido el comportamiento incorrecto del `Join` motor de mesa (Amos Bird). +- Se corrigió el comportamiento incorrecto del asignador en FreeBSD y OS X. +- El `extractAll` la función ahora admite coincidencias vacías. +- Se corrigió un error que bloqueaba el uso de `libressl` en lugar de `openssl` . +- Se corrigió el `CREATE TABLE AS SELECT` consulta de tablas temporales. +- Se corrigió la no anatomía de la actualización de la cola de replicación. Esto podría provocar que las réplicas no estén sincronizadas hasta que se reinicie el servidor. +- Posible desbordamiento fijo en `gcd` , `lcm` y `modulo` (`%` (Maks Skorokhod). +- `-preprocessed` los archivos ahora se crean después de cambiar `umask` (`umask` se puede cambiar en la configuración). +- Se corrigió un error en la verificación de antecedentes de las piezas (`MergeTreePartChecker` ) cuando se utiliza una clave de partición personalizada. +- Análisis fijo de tuplas (valores de la `Tuple` tipo de datos) en formatos de texto. +- Mensajes de error mejorados sobre tipos incompatibles pasados a `multiIf` , `array` y algunas otras funciones. +- Soporte rediseñado para `Nullable` tipo. Se corrigieron errores que podían provocar un bloqueo del servidor. Se corrigieron casi todos los demás errores relacionados con `NULL` soporte: conversiones de tipo incorrectas en INSERT SELECT, soporte insuficiente para Nullable en HAVING y PREWHERE, `join_use_nulls` modo, tipos anulables como argumentos de `OR` operador, etc. +- Se corrigieron varios errores relacionados con la semántica interna de los tipos de datos. Ejemplos: suma innecesaria de `Enum` campos de tipo en `SummingMergeTree` ; alineación de `Enum` tipos en `Pretty` formatos, etc. +- Comprueba más estrictamente las combinaciones permitidas de columnas compuestas. +- Se corrigió el desbordamiento al especificar un parámetro muy grande para el `FixedString` tipo de datos. +- Se ha corregido un error en el `topK` función de agregado en un caso genérico. +- Se agregó la verificación faltante de igualdad de tamaños de matriz en argumentos de variantes narias de funciones agregadas con un `-Array` combinador. +- Se ha corregido un error en `--pager` para `clickhouse-client` (autor: ks1322). +- Se corrigió la precisión del `exp10` función. +- Se corrigió el comportamiento del `visitParamExtract` función para un mejor cumplimiento de la documentación. +- Se corrigió el bloqueo cuando se especifican tipos de datos incorrectos. +- Se corrigió el comportamiento de `DISTINCT` en el caso cuando todas las columnas son constantes. +- Se corrigió el formato de consulta en el caso de usar el `tupleElement` función con una expresión constante compleja como el índice del elemento de tupla. +- Se ha corregido un error en `Dictionary` tablas para `range_hashed` diccionario. +- Se corrigió un error que provocaba filas excesivas en el resultado de `FULL` y `RIGHT JOIN` (Amós De Aves). +- Se corrigió un bloqueo del servidor al crear y eliminar archivos temporales en `config.d` directorios durante la recarga de configuración. +- Se corrigió el `SYSTEM DROP DNS CACHE` consulta: la memoria caché se vació pero las direcciones de los nodos del clúster no se actualizaron. +- Se corrigió el comportamiento de `MATERIALIZED VIEW` después de ejecutar `DETACH TABLE` for the table under the view (Marek Vavruša). + +#### Mejoras De construcción: {#build-improvements-4} + +- El `pbuilder` herramienta se utiliza para compilaciones. El proceso de compilación es casi completamente independiente del entorno de host de compilación. +- Una sola compilación se utiliza para diferentes versiones del sistema operativo. Los paquetes y binarios se han hecho compatibles con una amplia gama de sistemas Linux. +- Se agregó el `clickhouse-test` paquete. Se puede usar para ejecutar pruebas funcionales. +- El archivo tarball de origen ahora se puede publicar en el repositorio. Se puede usar para reproducir la compilación sin usar GitHub. +- Se agregó una integración limitada con Travis CI. Debido a los límites en el tiempo de compilación en Travis, solo se prueba la compilación de depuración y se ejecuta un subconjunto limitado de pruebas. +- Añadido soporte para `Cap'n'Proto` en la compilación predeterminada. +- Se ha cambiado el formato de las fuentes de documentación de `Restricted Text` a `Markdown`. +- Añadido soporte para `systemd` (Vladimir Smirnov). Está deshabilitado por defecto debido a la incompatibilidad con algunas imágenes del sistema operativo y se puede habilitar manualmente. +- Para la generación de código dinámico, `clang` y `lld` están incrustados en el `clickhouse` binario. También se pueden invocar como `clickhouse clang` y `clickhouse lld` . +- Se eliminó el uso de extensiones GNU del código. Habilitado el `-Wextra` opcion. Al construir con `clang` el valor predeterminado es `libc++` en lugar de `libstdc++`. +- Extraer `clickhouse_parsers` y `clickhouse_common_io` bibliotecas para acelerar las compilaciones de varias herramientas. + +#### Cambios Incompatibles Hacia atrás: {#backward-incompatible-changes-11} + +- El formato de las marcas en `Log` tablas de tipos que contienen `Nullable` columnas se cambió de una manera incompatible con versiones anteriores. Si tiene estas tablas, debe convertirlas a la `TinyLog` escriba antes de iniciar la nueva versión del servidor. Para hacer esto, reemplace `ENGINE = Log` con `ENGINE = TinyLog` en el correspondiente `.sql` archivo en el `metadata` directorio. Si su tabla no tiene `Nullable` o si el tipo de su tabla no es `Log`, entonces usted no tiene que hacer nada. +- Eliminado el `experimental_allow_extended_storage_definition_syntax` configuración. Ahora esta característica está habilitada de forma predeterminada. +- El `runningIncome` función fue renombrada a `runningDifferenceStartingWithFirstvalue` para evitar confusiones. +- Eliminado el `FROM ARRAY JOIN arr` sintaxis cuando ARRAY JOIN se especifica directamente después de FROM sin tabla (Amos Bird). +- Eliminado el `BlockTabSeparated` formato que se utilizó únicamente con fines de demostración. +- Se ha cambiado el formato de estado para las funciones agregadas `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Si ha almacenado estados de estas funciones agregadas en tablas (utilizando `AggregateFunction` tipo de datos o vistas materializadas con los estados correspondientes), por favor escriba a clickhouse-feedback@yandex-team.com. +- En versiones anteriores del servidor había una característica no documentada: si una función agregada depende de parámetros, aún puede especificarla sin parámetros en el tipo de datos AggregateFunction . Ejemplo: `AggregateFunction(quantiles, UInt64)` en lugar de `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. Esta característica se perdió. Aunque no estaba documentado, planeamos apoyarlo nuevamente en futuras versiones. +- Los tipos de datos de enumeración no se pueden usar en funciones de agregado mínimo / máximo. Esta habilidad se devolverá en la próxima versión. + +#### Tenga En Cuenta Al Actualizar: {#please-note-when-upgrading} + +- Al realizar una actualización continua en un clúster, en el momento en que algunas de las réplicas ejecutan la versión anterior de ClickHouse y otras ejecutan la nueva versión, la replicación se detiene temporalmente y el mensaje `unknown parameter 'shard'` aparece en el registro. La replicación continuará después de que se actualicen todas las réplicas del clúster. +- Si se están ejecutando diferentes versiones de ClickHouse en los servidores de clúster, es posible que las consultas distribuidas que utilizan las siguientes funciones tengan resultados incorrectos: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Debe actualizar todos los nodos del clúster. + +## [Nivel de Cifrado WEP](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/es/whats-new/changelog/2019.md b/docs/es/whats-new/changelog/2019.md new file mode 100644 index 00000000000..aab7b7a8d4c --- /dev/null +++ b/docs/es/whats-new/changelog/2019.md @@ -0,0 +1,2074 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 77 +toc_title: '2019' +--- + +## ClickHouse De liberación De La V19.17 {#clickhouse-release-v19-17} + +### Lanzamiento De ClickHouse V19.17.6.36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} + +#### Corrección De Errores {#bug-fix} + +- Desbordamiento de búfer potencial fijo en descomprimir. El usuario malintencionado puede pasar datos comprimidos fabricados que podrían causar lectura después del búfer. Este problema fue encontrado por Eldar Zaitov del equipo de seguridad de la información de Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió un posible bloqueo del servidor (`std::terminate`) cuando el servidor no puede enviar o escribir datos en formato JSON o XML con valores de tipo de datos String (que requieren validación UTF-8) o al comprimir datos de resultados con el algoritmo Brotli o en algunos otros casos raros. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Diccionarios fijos con fuente de un clickhouse `VIEW`, ahora leer tales diccionarios no causa el error `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Se corrigió la comprobación de si un host cliente está permitido por host\_regexp especificado en los usuarios.XML. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- `RENAME TABLE` para una tabla distribuida ahora cambia el nombre de la carpeta que contiene los datos insertados antes de enviarlos a los fragmentos. Esto soluciona un problema con los cambios de nombre sucesivos `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([Tavplubix](https://github.com/tavplubix)) +- `range_hashed` Los diccionarios externos creados por consultas DDL ahora permiten rangos de tipos numéricos arbitrarios. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- Fijo `INSERT INTO table SELECT ... FROM mysql(...)` función de la tabla. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([Tavplubix](https://github.com/tavplubix)) +- Segfault fijo en `INSERT INTO TABLE FUNCTION file()` mientras se inserta en un archivo que no existe. Ahora, en este caso, se crearía un archivo y luego se procesaría la inserción. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Se corrigió el error bitmapAnd al intersecar un mapa de bits agregado y un mapa de bits escalar. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Segfault fijo cuando `EXISTS` consulta se utilizó sin `TABLE` o `DICTIONARY` calificador, al igual que `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tipo de retorno fijo para funciones `rand` y `randConstant` en caso de argumento anulable. Ahora las funciones siempre regresan `UInt32` y nunca `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fijo `DROP DICTIONARY IF EXISTS db.dict`, ahora no lanza la excepción si `db` no existe. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- Si una tabla no se eliminó por completo debido a un bloqueo del servidor, el servidor intentará restaurarla y cargarla [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([Tavplubix](https://github.com/tavplubix)) +- Se corrigió una consulta de recuento trivial para una tabla distribuida si hay más de dos tablas locales de fragmentos. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Se corrigió un error que conducía a una carrera de datos en DB :: BlockStreamProfileInfo :: calculateRowsBeforeLimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alejandro Kazakov](https://github.com/Akazz)) +- Fijo `ALTER table MOVE part` se ejecuta inmediatamente después de fusionar la parte especificada, lo que podría provocar el movimiento de una parte en la que la parte especificada se fusionó. Ahora mueve correctamente la parte especificada. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Las expresiones para los diccionarios se pueden especificar como cadenas ahora. Esto es útil para el cálculo de atributos al extraer datos de fuentes que no son de ClickHouse porque permite usar la sintaxis que no son de ClickHouse para esas expresiones. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- Se corrigió una carrera muy rara en `clickhouse-copier` debido a un desbordamiento en ZXid. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Más información](https://github.com/dingxiangfei2009)) +- Se corrigió el error cuando después de la consulta falló (debido a “Too many simultaneous queries” por ejemplo) no leería información de tablas externas, y el + La siguiente solicitud interpretaría esta información como el comienzo de la siguiente consulta causando un error como `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Evite la desreferencia nula después de “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Restaure el soporte de todas las configuraciones regionales de la UCI, agregue la capacidad de aplicar intercalaciones para expresiones constantes y agregue el nombre del idioma al sistema.mesa de colaciones. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- Número de secuencias para leer desde `StorageFile` y `StorageHDFS` ahora está limitado, para evitar exceder el límite de memoria. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- Fijo `CHECK TABLE` consulta para `*MergeTree` mesas sin llave. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- Eliminado el número de mutación de un nombre de pieza en caso de que no hubiera mutaciones. Esta eliminación mejoró la compatibilidad con versiones anteriores. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- Se corrigió el error de que las mutaciones se omiten para algunas partes adjuntas debido a que su versión de datos son más grandes que la versión de mutación de la tabla. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) +- Permita iniciar el servidor con copias redundantes de piezas después de moverlas a otro dispositivo. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Corregido el error “Sizes of columns doesn’t match” que pueden aparecer al usar columnas de función agregadas. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Ahora se lanzará una excepción en caso de usar WITH TIES junto con LIMIT BY. Y ahora es posible usar TOP con LIMIT BY. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Repara la recarga del diccionario si tiene `invalidate_query`, que detuvo las actualizaciones y alguna excepción en los intentos de actualización anteriores. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) + +### Lanzamiento De ClickHouse V19.17.4.11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change} + +- Usar column en lugar de AST para almacenar resultados de subconsultas escalares para un mejor rendimiento. Configuración `enable_scalar_subquery_optimization` se agregó en 19.17 y se habilitó de forma predeterminada. Conduce a errores como [este](https://github.com/ClickHouse/ClickHouse/issues/7851) durante la actualización a 19.17.2 o 19.17.3 de versiones anteriores. Esta configuración estaba deshabilitada de forma predeterminada en 19.17.4, para hacer posible la actualización desde 19.16 y versiones anteriores sin errores. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos pájaro](https://github.com/amosbird)) + +#### Novedad {#new-feature} + +- Agregue la capacidad de crear diccionarios con consultas DDL. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) +- Hacer `bloom_filter` tipo de índice de apoyo `LowCardinality` y `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Añadir función `isValidJSON` para verificar que la cadena pasada sea un json válido. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) +- Implementar `arrayCompact` función [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Memo](https://github.com/Joeywzr)) +- Función creada `hex` para números decimales. Funciona como `hex(reinterpretAsString())`, pero no elimina los últimos cero bytes. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) +- Añadir `arrayFill` y `arrayReverseFill` funciones, que reemplazan elementos por otros elementos delante / detrás de ellos en la matriz. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([Hcz](https://github.com/hczhcz)) +- Añadir `CRC32IEEE()`/`CRC64()` apoyo [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) +- Implementar `char` función similar a uno en [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([Sundyli](https://github.com/sundy-li)) +- Añadir `bitmapTransform` función. Transforma una matriz de valores en un mapa de bits a otra matriz de valores, el resultado es un nuevo mapa de bits [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) +- Aplicado `javaHashUTF16LE()` función [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([chimbab](https://github.com/achimbab)) +- Añadir `_shard_num` columna virtual para el motor distribuido [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) + +#### Característica Experimental {#experimental-feature} + +- Soporte para procesadores (nueva canalización de ejecución de consultas) en `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Corrección De Errores {#bug-fix-1} + +- Corregir el análisis flotante incorrecto en `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([Tavplubix](https://github.com/tavplubix)) +- Soluciona un punto muerto raro que puede ocurrir cuando trace\_log está habilitado. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Evitar la duplicación de mensajes al producir la tabla Kafka tiene cualquier MV seleccionando de ella [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) +- Soporte para `Array(LowCardinality(Nullable(String)))` en `IN`. Resolver [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([chimbab](https://github.com/achimbab)) +- Añadir manejo de `SQL_TINYINT` y `SQL_BIGINT`, y fijar el manejo de `SQL_FLOAT` tipos de origen de datos en ODBC Bridge. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Corregir la agregación (`avg` y quantiles) sobre columnas decimales vacías [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Fijar `INSERT` en Distribuido con `MATERIALIZED` columna [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Hacer `MOVE PARTITION` funciona si algunas partes de la partición ya están en el disco o volumen de destino [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Se corrigió un error con los enlaces duros que no se creaban durante las mutaciones en `ReplicatedMergeTree` en configuraciones de varios discos. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Se corrigió un error con una mutación en un MergeTree cuando toda la parte permanece sin cambios y el mejor espacio se encuentra en otro disco [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Corregido error con `keep_free_space_ratio` no se lee desde la configuración de discos [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Corregir error con la tabla solo contiene `Tuple` columnas o columnas con rutas complejas. Fijar [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) +- No tener en cuenta la memoria para el motor de búfer en el límite de max\_memory\_usage [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) +- Corregir el uso de marcas final en `MergeTree` ordenadas por `tuple()`. En casos raros podría conducir a `Can't adjust last granule` error mientras selecciona. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir errores en mutaciones que tienen predicados con acciones que requieren contexto (por ejemplo, funciones para json), lo que puede provocar bloqueos o excepciones extrañas. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) +- Corregir la falta de coincidencia de los nombres de bases de datos y tablas que se escapan en `data/` y `shadow/` Directory [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alejandro Burmak](https://github.com/Alex-Burmak)) +- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Corregir el bloqueo en este caso. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijar `Not found column in block` al unirse en la expresión con RIGHT o FULL JOIN. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) +- Un intento más de arreglar bucle infinito en `PrettySpace` formato [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) +- Corregir error en `concat` función cuando todos los argumentos fueron `FixedString` del mismo tamaño. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) +- Se corrigió la excepción en caso de usar 1 argumento al definir almacenes S3, URL y HDFS. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Corregir el alcance de InterpreterSelectQuery para vistas con consulta [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) + +#### Mejora {#improvement} + +- `Nullable` columnas reconocidas y valores NULL manejados correctamente por ODBC-bridge [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- Escribir el lote actual para el envío distribuido atómicamente [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) +- Lance una excepción si no podemos detectar la tabla para el nombre de la columna en la consulta. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir `merge_max_block_size` ajuste a `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) +- Consultas con `HAVING` y sin `GROUP BY` asumir grupo por constante. Tan, `SELECT 1 HAVING 1` ahora devuelve un resultado. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos pájaro](https://github.com/amosbird)) +- Soporte de análisis `(X,)` como tupla similar a python. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos pájaro](https://github.com/amosbird)) +- Hacer `range` comportamientos de función casi como uno pitónico. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([Sundyli](https://github.com/sundy-li)) +- Añadir `constraints` columnas a la mesa `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) +- Mejor formato nulo para el controlador tcp, por lo que es posible usar `select ignore() from table format Null` para la medida de perf a través de clickhouse-client [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos pájaro](https://github.com/amosbird)) +- Consultas como `CREATE TABLE ... AS (SELECT (1, 2))` se analizan correctamente [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([Hcz](https://github.com/hczhcz)) + +#### Mejora Del Rendimiento {#performance-improvement} + +- Se mejora el rendimiento de la agregación sobre claves de cadena cortas. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alejandro Kuzmenkov](https://github.com/akuzm), [Amos pájaro](https://github.com/amosbird)) +- Ejecute otra pasada de análisis de sintaxis / expresión para obtener optimizaciones potenciales después de que se plieguen los predicados constantes. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos pájaro](https://github.com/amosbird)) +- Use metainformación de almacenamiento para evaluar trivial `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos pájaro](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) +- Vectorizar el procesamiento `arrayReduce` similar a Aggregator `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos pájaro](https://github.com/amosbird)) +- Mejoras menores en el rendimiento de `Kafka` consumo [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([Ivan](https://github.com/abyss7)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement} + +- Agregue soporte para la compilación cruzada a la arquitectura de CPU AARCH64. Refactorizar la secuencia de comandos del empaquetador. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([Ivan](https://github.com/abyss7)) +- Desempaquete las cadenas de herramientas darwin-x86\_64 y linux-aarch64 en el volumen Docker montado al crear paquetes [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([Ivan](https://github.com/abyss7)) +- Actualizar la imagen de Docker para Binary Packager [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([Ivan](https://github.com/abyss7)) +- Se corrigieron errores de compilación en MacOS Catalina [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) +- Algunas refactorizaciones en la lógica de análisis de consultas: dividir la clase compleja en varias simples. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) +- Reparar la compilación sin submódulos [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([propulsor](https://github.com/proller)) +- Mejor `add_globs` en archivos CMake [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos pájaro](https://github.com/amosbird)) +- Eliminar rutas codificadas en `unwind` objetivo [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) +- Permitir usar el formato mysql sin ssl [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([propulsor](https://github.com/proller)) + +#### Otro {#other} + +- Añadido gramática ANTLR4 para ClickHouse SQL dialecto [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouse De liberación De La V19.16 {#clickhouse-release-v19-16} + +#### Todos Los Derechos Reservados {#clickhouse-release-v19-16-14-65-2020-03-25} + +- Se corrigió un error en los cálculos por lotes de OP lógicos ternarios en múltiples argumentos (más de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alejandro Kazakov](https://github.com/Akazz)) Esta corrección de errores fue portada a la versión 19.16 por una solicitud especial de Altinity. + +#### Todos Los Derechos Reservados {#clickhouse-release-v19-16-14-65-2020-03-05} + +- Corregir la incompatibilidad de subconsultas distribuidas con versiones anteriores de CH. Fijar [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) + [(tabplubix)](https://github.com/tavplubix) +- Al ejecutar `CREATE` consulta, doblar expresiones constantes en argumentos del motor de almacenamiento. Reemplace el nombre de la base de datos vacía con la base de datos actual. Fijar [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). También corrige la verificación de la dirección local en `ClickHouseDictionarySource`. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Ahora el fondo se fusiona en `*MergeTree` familia de motores de mesa preservar el orden de volumen de políticas de almacenamiento con mayor precisión. + [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Evitar la pérdida de datos en `Kafka` en casos raros cuando la excepción ocurre después de leer el sufijo pero antes de confirmar. Fijar [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Relacionados: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Corregir un error que conduce a la terminación del servidor al intentar usar / soltar `Kafka` tabla creada con parámetros incorrectos. Fijar [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporar [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) +- Permitir usar `MaterializedView` con subconsultas anteriores `Kafka` tabla. + [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) + +#### Novedad {#new-feature-1} + +- Añadir `deduplicate_blocks_in_dependent_materialized_views` opción para controlar el comportamiento de las inserciones idempotentes en tablas con vistas materializadas. Esta nueva característica se agregó a la versión de corrección de errores mediante una solicitud especial de Altinity. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### Lanzamiento De ClickHouse V19.16.2.2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-1} + +- Agregue la validación de arity faltante para count/counIf . + [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) + [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) +- Eliminar heredado `asterisk_left_columns_only` configuración (que estaba deshabilitado por defecto). + [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem + Zuikov](https://github.com/4ertus2)) +- Las cadenas de formato para el formato de datos de la plantilla ahora se especifican en los archivos. + [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([Tavplubix](https://github.com/tavplubix)) + +#### Novedad {#new-feature-2} + +- Introduzca uniqCombined64() para calcular la cardinalidad mayor que UINT\_MAX. + [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), + [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat + Khuzhin](https://github.com/azat)) +- Admite índices de filtro Bloom en columnas de matriz. + [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) + ([chimbab](https://github.com/achimbab)) +- Agregar una función `getMacro(name)` que devuelve String con el valor de `` + desde la configuración del servidor. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Establezca dos opciones de configuración para un diccionario basado en un origen HTTP: `credentials` y + `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- Agregar un nuevo ProfileEvent `Merge` que cuenta el número de fusiones de fondo lanzadas. + [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mijaíl + Korotov](https://github.com/millb)) +- Agregue la función fullHostName que devuelve un nombre de dominio completo. + [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) + [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([Sundyli](https://github.com/sundy-li)) +- Añadir función `arraySplit` y `arrayReverseSplit` que dividió una matriz por “cut off” + condición. Son útiles en el manejo de secuencias de tiempo. + [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([Hcz](https://github.com/hczhcz)) +- Agregue nuevas funciones que devuelvan la matriz de todos los índices coincidentes en la familia de funciones multiMatch. + [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila + Kutenin](https://github.com/danlark1)) +- Agregar un nuevo motor de base de datos `Lazy` que está optimizado para almacenar un gran número de pequeños -Log + tabla. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nosotros + Vasilev](https://github.com/nikvas0)) +- Agregue funciones agregadas groupBitmapAnd, -Or, -Xor para columnas de mapa de bits. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang + Yu](https://github.com/yuzhichang)) +- Agregue los combinadores de funciones agregadas -OrNull y -OrDefault , que devuelven null + o valores predeterminados cuando no hay nada que agregar. + [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) + ([Hcz](https://github.com/hczhcz)) +- Introduzca el formato de datos CustomSeparated que admite el escape personalizado y + reglas delimitador. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([Tavplubix](https://github.com/tavplubix)) +- Soporte Redis como fuente de diccionario externo. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton + Popov](https://github.com/CurtizJ)) + +#### Corrección De Errores {#bug-fix-2} + +- Repara el resultado de la consulta incorrecta si tiene `WHERE IN (SELECT ...)` sección y `optimize_read_in_order` ser + utilizar. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton + Popov](https://github.com/CurtizJ)) +- Complemento de autenticación MariaDB deshabilitado, que depende de archivos fuera del proyecto. + [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Yuriy + Baranov](https://github.com/yurriy)) +- Solucionar excepción `Cannot convert column ... because it is constant but values of constants are different in source and result` que rara vez podría suceder cuando funciones `now()`, `today()`, + `yesterday()`, `randConstant()` se utilizan. + [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolai + Kochetov](https://github.com/KochetovNicolai)) +- Solucionado el problema de usar HTTP keep alive timeout en lugar de TCP keep alive timeout. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily + Nemkov](https://github.com/Enmk)) +- Se corrigió un error de segmentación en groupBitmapOr (problema [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). + [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang + Yu](https://github.com/yuzhichang)) +- Para las vistas materializadas, se llama a la confirmación para Kafka después de que se escribieron todos los datos. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) +- Corregido mal `duration_ms` valor en `system.part_log` tabla. Fue diez veces fuera. + [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Una solución rápida para resolver el bloqueo en la tabla LIVE VIEW y volver a habilitar todas las pruebas LIVE VIEW. + [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Serialice los valores NULL correctamente en los índices mínimos / máximos de las partes MergeTree. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alejandro + Kuzmenkov](https://github.com/akuzm)) +- No coloque columnas virtuales en .sql cuando la tabla se crea como `CREATE TABLE AS`. + [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([Ivan](https://github.com/abyss7)) +- Fijar falla de segmentación en `ATTACH PART` consulta. + [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) + ([alesapin](https://github.com/alesapin)) +- Corrija el resultado incorrecto para algunas consultas dadas por la optimización de las subconsultas IN vacías y vacías + INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolai + Kochetov](https://github.com/KochetovNicolai)) +- Reparación del error AddressSanitizer en el método LIVE VIEW getHeader (). + [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) + ([vzakaznikov](https://github.com/vzakaznikov)) + +#### Mejora {#improvement-1} + +- Añadir un mensaje en caso de queue\_wait\_max\_ms espera se lleva a cabo. + [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat + Khuzhin](https://github.com/azat)) +- Ajuste hecho `s3_min_upload_part_size` a nivel de mesa. + [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Compruebe TTL en StorageFactory. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) + ([Sundyli](https://github.com/sundy-li)) +- Squash bloques de la izquierda en combinación de fusión parcial (optimización). + [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem + Zuikov](https://github.com/4ertus2)) +- No permita funciones no deterministas en mutaciones de motores de tabla replicados, porque esto + puede introducir inconsistencias entre réplicas. + [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alejandro + Kazakov](https://github.com/Akazz)) +- Deshabilite el rastreador de memoria mientras convierte el seguimiento de la pila de excepciones en cadena. Puede prevenir la pérdida + de mensajes de error de tipo `Memory limit exceeded` en el servidor, lo que `Attempt to read after eof` excepción en el cliente. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) + ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Mejoras de formato varios. Resolver + [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), + [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), + [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), + [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) + [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) + ([Tavplubix](https://github.com/tavplubix)) +- ClickHouse ignora los valores en el lado derecho del operador IN que no son convertibles a la izquierda + side type. Make it work properly for compound types – Array and Tuple. + [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alejandro + Kuzmenkov](https://github.com/akuzm)) +- Apoyar las desigualdades que faltan para ASOF JOIN. Es posible unir una variante menor o igual y estricta + mayores y menos variantes para la columna ASOF en la sintaxis ON. + [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem + Zuikov](https://github.com/4ertus2)) +- Optimizar la combinación de fusión parcial. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) + ([Artem Zuikov](https://github.com/4ertus2)) +- No utilice más de 98K de memoria en funciones uniqCombined. + [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), + [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat + Khuzhin](https://github.com/azat)) +- Enjuague las partes de la tabla de unión de la derecha en el disco en PartialMergeJoin (si no hay suficiente + memoria). Cargue los datos cuando sea necesario. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) + ([Artem Zuikov](https://github.com/4ertus2)) + +#### Mejora Del Rendimiento {#performance-improvement-1} + +- Acelere joinGet con argumentos const evitando la duplicación de datos. + [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos + Ave](https://github.com/amosbird)) +- Regrese temprano si la subconsulta está vacía. + [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) +- Optimizar el análisis de la expresión SQL en Valores. + [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) + ([Tavplubix](https://github.com/tavplubix)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-1} + +- Deshabilite algunas contribuciones para la compilación cruzada en Mac OS. + [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([Ivan](https://github.com/abyss7)) +- Agregue enlaces faltantes con PocoXML para clickhouse\_common\_io. + [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat + Khuzhin](https://github.com/azat)) +- Acepte varios argumentos de filtro de prueba en clickhouse-test. + [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alejandro + Kuzmenkov](https://github.com/akuzm)) +- Habilitar musl y jemalloc para ARM. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) + ([Amos pájaro](https://github.com/amosbird)) +- Añadir `--client-option` parámetro para `clickhouse-test` para pasar parámetros adicionales al cliente. + [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolai + Kochetov](https://github.com/KochetovNicolai)) +- Conservar las configuraciones existentes en la actualización del paquete rpm. + [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) + ([filimonov](https://github.com/filimonov)) +- Corregir errores detectados por PVS. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem + Zuikov](https://github.com/4ertus2)) +- Corregir la compilación para Darwin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) + ([Ivan](https://github.com/abyss7)) +- glibc 2.29 compatibilidad. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos + Ave](https://github.com/amosbird)) +- Asegúrese de que dh\_clean no toque los archivos fuente potenciales. + [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos + Ave](https://github.com/amosbird)) +- Intente evitar conflictos al actualizar desde rpm de altinidad: tiene un archivo de configuración empaquetado por separado + en clickhouse-server-common. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) + ([filimonov](https://github.com/filimonov)) +- Optimice algunos archivos de encabezado para reconstrucciones más rápidas. + [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), + [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alejandro + Kuzmenkov](https://github.com/akuzm)) +- Agregue pruebas de rendimiento para Date y DateTime. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vasily + Nemkov](https://github.com/Enmk)) +- Corregir algunas pruebas que contenían mutaciones no deterministas. + [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alejandro + Kazakov](https://github.com/Akazz)) +- Agregue compilación con MemorySanitizer a CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) + ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Evite el uso de valores no inicializados en MetricsTransmitter. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat + Khuzhin](https://github.com/azat)) +- Solucionar algunos problemas en los campos encontrados por MemorySanitizer. + [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), + [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alejandro + Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) + ([Amos pájaro](https://github.com/amosbird)) +- Corrige el comportamiento indefinido en murmurhash32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos + Ave](https://github.com/amosbird)) +- Corrige el comportamiento indefinido en StoragesInfoStream. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) + ([Tavplubix](https://github.com/tavplubix)) +- Se corrigieron expresiones constantes plegables para motores de bases de datos externas (MySQL, ODBC, JDBC). En anteriores + versiones no funcionaba para múltiples expresiones constantes y no funcionaba en absoluto para Date, + DateTime y UUID. Esto corrige [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reparación del error de carrera de datos ThreadSanitizer en LIVE VIEW al acceder a la variable no\_users\_thread. + [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Deshacerse de los símbolos malloc en libcommon + [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), + [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos + Ave](https://github.com/amosbird)) +- Agregue el indicador global ENABLE\_LIBRARIES para deshabilitar todas las bibliotecas. + [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) + ([propulsor](https://github.com/proller)) + +#### Limpieza De código {#code-cleanup} + +- Generalice el repositorio de configuración para prepararse para DDL para diccionarios. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) + ([alesapin](https://github.com/alesapin)) +- Analizador de diccionarios DDL sin ninguna semántica. + [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) + ([alesapin](https://github.com/alesapin)) +- Divida ParserCreateQuery en diferentes analizadores más pequeños. + [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) + ([alesapin](https://github.com/alesapin)) +- Pequeña refactorización y cambio de nombre cerca de diccionarios externos. + [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) + ([alesapin](https://github.com/alesapin)) +- Refactorizar el código para prepararse para el papel de control de acceso basado. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly + Baranov](https://github.com/vitlibar)) +- Algunas mejoras en el código DatabaseOrdinary. + [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nosotros + Vasilev](https://github.com/nikvas0)) +- No use iteradores en los métodos find() y emplace() de tablas hash. + [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alejandro + Kuzmenkov](https://github.com/akuzm)) +- Repare getMultipleValuesFromConfig en caso de que la raíz del parámetro no esté vacía. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) + ([Mikhail Korotov](https://github.com/millb)) +- Eliminar algunos copiar y pegar (TemporaryFile y TemporaryFileStream) + [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem + Zuikov](https://github.com/4ertus2)) +- Mejora de la legibilidad del código un poco (`MergeTreeData::getActiveContainingPart`). + [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Espere a que todos los trabajos programados, que utilizan objetos locales, si `ThreadPool::schedule(...)` lanzar + salvedad. Cambiar nombre `ThreadPool::schedule(...)` a `ThreadPool::scheduleOrThrowOnError(...)` y + corregir los comentarios para hacer obvio que puede lanzar. + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) + ([Tavplubix](https://github.com/tavplubix)) + +## Lanzamiento De ClickHouse 19.15 {#clickhouse-release-19-15} + +### Lanzamiento De ClickHouse 19.15.4.10, 31.10.2019 {#clickhouse-release-19-15-4-10-2019-10-31} + +#### Corrección De Errores {#bug-fix-3} + +- Se agregó el manejo de SQL\_TINYINT y SQL\_BIGINT, y el manejo de correcciones de los tipos de origen de datos SQL\_FLOAT en ODBC Bridge. + [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Se permite tener algunas partes en el disco de destino o el volumen en MOVE PARTITION. + [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Se corrigieron valores NULL en columnas anulables a través del puente ODBC. + [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- Se corrigió INSERT en el nodo distribuido no local con columnas MATERIALIZED. + [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Función fija getMultipleValuesFromConfig. + [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) +- Solucionado el problema de usar HTTP keep alive timeout en lugar de TCP keep alive timeout. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) +- Espere a que todos los trabajos finalicen con excepción (corrige fallas raras). + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([Tavplubix](https://github.com/tavplubix)) +- No presione a MVs cuando inserte en la tabla Kafka. + [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) +- Deshabilitar el rastreador de memoria para la pila de excepciones. + [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Se corrigió el código incorrecto en la transformación de la consulta para la base de datos externa. + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evite el uso de valores no inicializados en MetricsTransmitter. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) +- Se agregó configuración de ejemplo con macros para pruebas ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} + +#### Corrección De Errores {#bug-fix-4} + +- Se corrigió bad\_variant en el diccionario hash. + ([alesapin](https://github.com/alesapin)) +- Se corrigió un error con un error de segmentación en la consulta ATTACH PART. + ([alesapin](https://github.com/alesapin)) +- Cálculo de tiempo fijo en `MergeTreeData`. + ([Vladimir Chebotarev](https://github.com/excitoon)) +- Comprometerse con Kafka explícitamente después de finalizar la escritura. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) +- Serialice los valores NULL correctamente en los índices mínimos / máximos de las partes MergeTree. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alejandro Kuzmenkov](https://github.com/akuzm)) + +### Lanzamiento De ClickHouse 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} + +#### Novedad {#new-feature-3} + +- Almacenamiento por niveles: admite el uso de múltiples volúmenes de almacenamiento para tablas con el motor MergeTree. Es posible almacenar datos nuevos en SSD y mover automáticamente datos antiguos a HDD. ([ejemplo](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) +- Agregar función de tabla `input` para leer los datos entrantes en `INSERT SELECT` consulta. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([Palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) +- Añadir un `sparse_hashed` diccionario, que es funcionalmente equivalente al `hashed` diseño, pero es más eficiente en la memoria. Utiliza aproximadamente el doble de menos memoria a costa de una recuperación de valor más lenta. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) +- Implementar la capacidad de definir la lista de usuarios para el acceso a los diccionarios. Sólo la base de datos conectada actual utilizando. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Añadir `LIMIT` opción para `SHOW` consulta. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Filipina Malkovsky](https://github.com/malkfilipp)) +- Añadir `bitmapSubsetLimit(bitmap, range_start, limit)` función, que devuelve subconjunto de la más pequeña `limit` valores en el conjunto que no es menor que `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) +- Añadir `bitmapMin` y `bitmapMax` función. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) +- Añadir función `repeat` relacionado con [Información detallada](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([Más información](https://github.com/ucasFL)) + +#### Característica Experimental {#experimental-feature-1} + +- Implementar (en memoria) Combinar unir variante que no cambia la canalización actual. El resultado está parcialmente ordenado por clave de combinación. Establecer `partial_merge_join = 1` para usar esta función. La combinación de combinación todavía está en desarrollo. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir `S3` función del motor y de la tabla. Todavía está en desarrollo (todavía no hay soporte de autenticación). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) + +#### Mejora {#improvement-2} + +- Cada mensaje leído de Kafka se inserta atómicamente. Esto resuelve casi todos los problemas conocidos con el motor Kafka. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([Ivan](https://github.com/abyss7)) +- Mejoras para la conmutación por error de consultas distribuidas. Acortar el tiempo de recuperación, también ahora es configurable y se puede ver en `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) +- Soporta valores numéricos para enumeraciones directamente en `IN` apartado. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([Dimarub2000](https://github.com/dimarub2000)) +- El soporte (opcional, deshabilitado de forma predeterminada) redirige el almacenamiento de URL. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([Más información](https://github.com/maqroll)) +- Agregue un mensaje de información cuando el cliente con una versión anterior se conecte a un servidor. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Filipina Malkovsky](https://github.com/malkfilipp)) +- Eliminar el límite máximo de tiempo de suspensión de interrupción para el envío de datos en tablas distribuidas [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) +- Agregue la capacidad de enviar eventos de perfil (contadores) con valores acumulativos al grafito. Se puede habilitar bajo `` en el servidor `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) +- Añadir tipo de fundición automática `T` a `LowCardinality(T)` mientras inserta datos en la columna de tipo `LowCardinality(T)` en formato nativo a través de HTTP. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Añadir la capacidad de utilizar la función `hex` sin usar `reinterpretAsString` para `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-2} + +- Agregue gdb-index al binario de clickhouse con información de depuración. Acelerará el tiempo de inicio de `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) +- Acelerar el embalaje deb con parcheado dpkg-deb que utiliza `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) +- Establecer `enable_fuzzing = 1` para habilitar la instrumentación libfuzzer de todo el código del proyecto. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) +- Añadir prueba de humo de construcción dividida en CI. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) +- Agregue compilación con MemorySanitizer a CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Reemplazar `libsparsehash` con `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) + +#### Corrección De Errores {#bug-fix-5} + +- Se corrigió la degradación del rendimiento del análisis de índices en claves complejas en tablas grandes. Esto corrige \#6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir el error lógico que causa segfaults al seleccionar el tema vacío de Kafka. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) +- Arreglar la conexión MySQL demasiado pronto cerca `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Soporte devuelto para núcleos Linux muy antiguos (solución [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Solucionar la posible pérdida de datos en `insert select` consulta en caso de bloque vacío en el flujo de entrada. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Solución para la función `АrrayEnumerateUniqRanked` con matrices vacías en params [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([propulsor](https://github.com/proller)) +- Solucione consultas complejas con combinaciones de matriz y subconsultas globales. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) +- Fijar `Unknown identifier` error en ORDER BY y GROUP BY con múltiples JOINs [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijo `MSan` advertencia al ejecutar la función con `LowCardinality` argumento. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-2} + +- Se ha cambiado el formato de serialización de los estados de la función agregada de mapa de bits \* para mejorar el rendimiento. No se pueden leer los estados serializados de bitmap\* de versiones anteriores. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) + +## Lanzamiento De ClickHouse 19.14 {#clickhouse-release-19-14} + +### Lanzamiento De ClickHouse 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} + +#### Corrección De Errores {#bug-fix-6} + +- Esta versión también contiene todas las correcciones de errores de 19.11.12.69. +- Compatibilidad fija para consultas distribuidas entre 19.14 y versiones anteriores. Esto corrige [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} + +#### Corrección De Errores {#bug-fix-7} + +- Solución para la función `АrrayEnumerateUniqRanked` con matrices vacías en params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([propulsor](https://github.com/proller)) +- Nombre de subconsulta fijo en consultas con `ARRAY JOIN` y `GLOBAL IN subquery` con alias. Utilice el alias de subconsulta para el nombre de tabla externo si se especifica. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-3} + +- Fijar [aleteo](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) prueba `00715_fetch_merged_or_mutated_part_zookeeper` reescribiéndolo en scripts de shell porque necesita esperar a que se apliquen las mutaciones. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alejandro Kazakov](https://github.com/Akazz)) +- Fijo UBSan y MemSan fallo en la función `groupUniqArray` con el argumento de matriz emtpy. Fue causado por la colocación de vacío `PaddedPODArray` en la celda cero de la tabla hash porque no se llamó al constructor para el valor de la celda cero. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos pájaro](https://github.com/amosbird)) + +### Lanzamiento De ClickHouse 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} + +#### Novedad {#new-feature-4} + +- `WITH FILL` modificador para `ORDER BY`. (continuación de [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- `WITH TIES` modificador para `LIMIT`. (continuación de [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- Analizar unquoted `NULL` literal como NULL (si establece `format_csv_unquoted_null_literal_as_null=1`). Inicialice los campos nulos con valores predeterminados si el tipo de datos de este campo no se puede anular (si `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([Tavplubix](https://github.com/tavplubix)) +- Soporte para comodines en rutas de funciones de tabla `file` y `hdfs`. Si la ruta contiene comodines, la tabla será de solo lectura. Ejemplo de uso: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` y `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) +- Nuevo `system.metric_log` tabla que almacena los valores de `system.events` y `system.metrics` con el intervalo de tiempo especificado. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Permitir escribir registros de texto de ClickHouse en `system.text_log` tabla. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mostrar símbolos privados en trazas de pila (esto se hace mediante el análisis de tablas de símbolos de archivos ELF). Se agregó información sobre el archivo y el número de línea en los seguimientos de la pila si la información de depuración está presente. Búsqueda de nombre de símbolo de aceleración con símbolos de indexación presentes en el programa. Se agregaron nuevas funciones SQL para la introspección: `demangle` y `addressToLine`. Función renombrada `symbolizeAddress` a `addressToSymbol` para la consistencia. Función `addressToSymbol` devolverá el nombre destrozado por razones de rendimiento y debe aplicar `demangle`. Añadido `allow_introspection_functions` que está desactivado por defecto. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Función de la tabla `values` (el nombre no distingue entre mayúsculas y minúsculas). Permite leer de `VALUES` lista propuesta en [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Ejemplo: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([Dimarub2000](https://github.com/dimarub2000)) +- Se agregó la capacidad de alterar la configuración de almacenamiento. Sintaxis: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) +- Soporte para la eliminación de piezas separadas. Sintaxis: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([Tavplubix](https://github.com/tavplubix)) +- Restricciones de tabla. Permite agregar restricciones a la definición de la tabla que se verificará en la inserción. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soporte para vistas materializadas en cascada. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos pájaro](https://github.com/amosbird)) +- Active el generador de perfiles de consulta de forma predeterminada para muestrear cada subproceso de ejecución de consultas una vez por segundo. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Formato de entrada `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) +- Se agregaron dos nuevas funciones: `sigmoid` y `tanh` (que son útiles para aplicaciones de aprendizaje automático). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Función `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` para verificar si el token dado está en pajar. Token es una subcadena de longitud máxima entre dos caracteres ASCII no alfanuméricos (o límites de pajar). Token debe ser una cadena constante. Apoyado por la especialización de índice tokenbf\_v1. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) +- Nueva función `neighbor(value, offset[, default_value])`. Permite alcanzar el valor prev / next dentro de la columna en un bloque de datos. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Acerca de Nosotros](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) +- Creó una función `currentUser()`, devolver el inicio de sesión del usuario autorizado. Alias agregado `user()` por compatibilidad con MySQL. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Acerca de Nosotros](https://github.com/alex-krash)) +- Nuevas funciones agregadas `quantilesExactInclusive` y `quantilesExactExclusive` que fueron propuestos en [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([Dimarub2000](https://github.com/dimarub2000)) +- Función `bitmapRange(bitmap, range_begin, range_end)` que devuelve un nuevo conjunto con el rango especificado (no incluye el `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) +- Función `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` que crea una matriz de cadenas de precisión de cajas geohash que cubren el área proporcionada. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) +- Implementar soporte para la consulta INSERT con `Kafka` tabla. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([Ivan](https://github.com/abyss7)) +- Añadido soporte para `_partition` y `_timestamp` columnas virtuales al motor Kafka. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([Ivan](https://github.com/abyss7)) +- Posibilidad de eliminar datos confidenciales de `query_log`, registros del servidor, lista de procesos con reglas basadas en expresiones regulares. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) + +#### Característica Experimental {#experimental-feature-2} + +- Formato de datos de entrada y salida `Template`. Permite especificar cadena de formato personalizado para entrada y salida. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([Tavplubix](https://github.com/tavplubix)) +- Implementación de `LIVE VIEW` tablas que se propusieron originalmente en [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) elaborado en [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), y luego actualizado en [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). Ver [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) para una descripción detallada. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) Tenga en cuenta que `LIVE VIEW` característica puede ser eliminado en las próximas versiones. + +#### Corrección De Errores {#bug-fix-8} + +- Esta versión también contiene todas las correcciones de errores de 19.13 y 19.11. +- Corregir la falla de segmentación cuando la tabla tiene índices de omisión y se produce una fusión vertical. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) +- Corregir TTL por columna con valores predeterminados de columna no triviales. Anteriormente en caso de fuerza TTL se fusionan con `OPTIMIZE ... FINAL` consulta, los valores caducados se reemplazaron por valores predeterminados de tipo en lugar de valores predeterminados de columna especificados por el usuario. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) +- Solucione el problema de duplicación de mensajes de Kafka en el reinicio normal del servidor. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) +- Se corrigió un bucle infinito al leer mensajes de Kafka. No pausar / reanudar el consumidor en la suscripción en absoluto; de lo contrario, puede pausarse indefinidamente en algunos escenarios. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([Ivan](https://github.com/abyss7)) +- Fijar `Key expression contains comparison between inconvertible types` excepción en `bitmapContains` función. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([Dimarub2000](https://github.com/dimarub2000)) +- Reparar segfault con habilitado `optimize_skip_unused_shards` y falta la clave de fragmentación. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) +- Se corrigió el código incorrecto en las mutaciones que pueden conducir a la corrupción de la memoria. segfault fijo con lectura de la dirección `0x14c0` que puede happed debido a concurrente `DROP TABLE` y `SELECT` de `system.parts` o `system.parts_columns`. Condición de carrera fija en la preparación de consultas de mutación. Estancamiento fijo causado por `OPTIMIZE` de tablas replicadas y operaciones de modificación simultáneas como ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se eliminó el registro detallado adicional en la interfaz MySQL [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Devuelve la capacidad de analizar la configuración booleana de ‘true’ y ‘false’ en el archivo de configuración. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- Fix crash en `quantile` y `median` función sobre `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió el posible resultado incompleto devuelto por `SELECT` consulta con `WHERE` condición en la clave principal contenía conversión a tipo flotante. Fue causado por una comprobación incorrecta de la monotonía en `toFloat` función. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([Dimarub2000](https://github.com/dimarub2000)) +- Comprobar `max_expanded_ast_elements` establecimiento de mutaciones. Mutaciones claras después de `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([Invierno Zhang](https://github.com/zhang2014)) +- Repare los resultados de JOIN para las columnas clave cuando se usa con `join_use_nulls`. Adjunte valores nulos en lugar de valores predeterminados de columnas. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) +- Solución para índices de salto con combinación vertical y alteración. Solución para `Bad size of marks file` salvedad. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) +- Arreglar accidente raro en `ALTER MODIFY COLUMN` y fusión vertical cuando una de las partes fusionadas / alteradas está vacía (0 filas) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- Corregido error en la conversión de `LowCardinality` tipos en `AggregateFunctionFactory`. Esto corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir el comportamiento incorrecto y posibles fallas en `topK` y `topKWeighted` funciones agregadas. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) +- Código inseguro fijo alrededor `getIdentifier` función. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió un error en el protocolo de cable MySQL (se usa mientras se conecta al cliente MySQL de ClickHouse). Causado por el desbordamiento del búfer de pila en `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) +- Pérdida de memoria fija en `bitmapSubsetInRange` función. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) +- Corregir un error raro cuando la mutación se ejecuta después del cambio de granularidad. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) +- Permitir mensaje protobuf con todos los campos de forma predeterminada. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) +- Resolver un error con `nullIf` función cuando enviamos un `NULL` en el segundo argumento. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Corregir un error raro con la asignación / desasignación de memoria incorrecta en diccionarios complejos de caché de claves con campos de cadena que conduce a un consumo infinito de memoria (parece una pérdida de memoria). El error se reproduce cuando el tamaño de la cadena era una potencia de dos a partir de ocho (8, 16, 32, etc.). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- Se corrigió la codificación Gorilla en pequeñas secuencias que causaron una excepción `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) +- Permitir el uso de tipos no anulables en JOINs con `join_use_nulls` permitir. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) +- Desactivar `Poco::AbstractConfiguration` sustituciones en consulta en `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evitar el punto muerto en `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Utilizar `arrayReduce` para argumentos constantes puede conducir a segfault. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir partes inconsistentes que pueden aparecer si la réplica se restauró después de `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([Tavplubix](https://github.com/tavplubix)) +- Cuelgue fijo adentro `JSONExtractRaw` función. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir un error con la serialización y agregación de índices de omisión incorrectos con granularidad adaptativa. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) +- Fijar `WITH ROLLUP` y `WITH CUBE` modificadores de `GROUP BY` con agregación de dos niveles. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir un error al escribir marcas de índices secundarios con granularidad adaptativa. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- Corregir el orden de inicialización durante el inicio del servidor. Ya `StorageMergeTree::background_task_handle` se inicializa en `startup()` el `MergeTreeBlockOutputStream::write()` puede intentar usarlo antes de la inicialización. Solo verifique si está inicializado. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) +- Borrar el búfer de datos de la operación de lectura anterior que se completó con un error. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) +- Se corrigió un error al habilitar la granularidad adaptativa al crear una nueva réplica para la tabla Replicated\*MergeTree. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- Se corrigió un posible bloqueo durante el inicio del servidor en caso de que ocurriera una excepción en `libunwind` durante la excepción en el acceso a `ThreadStatus` estructura. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix crash en `yandexConsistentHash` función. Encontrado por prueba de fuzz. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la posibilidad de colgar consultas cuando el servidor está sobrecargado y el grupo de subprocesos global está casi lleno. Esto tiene una mayor probabilidad de ocurrir en clústeres con una gran cantidad de fragmentos (cientos), porque las consultas distribuidas asignan un hilo por conexión a cada fragmento. Por ejemplo, este problema puede reproducirse si un clúster de 330 fragmentos está procesando 30 consultas distribuidas simultáneas. Este problema afecta a todas las versiones a partir de 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Lógica fija de `arrayEnumerateUniqRanked` función. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir segfault al decodificar la tabla de símbolos. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos pájaro](https://github.com/amosbird)) +- Se corrigió una excepción irrelevante en el elenco de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Se eliminó la cita adicional de la descripción en `system.settings` tabla. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evite un posible punto muerto en `TRUNCATE` de la tabla replicada. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir la lectura en orden de clave de clasificación. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) +- Fijar `ALTER TABLE ... UPDATE` consulta para tablas con `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Corregir error abierto por [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (desde 19.4.0). Se reproduce en consultas a tablas distribuidas sobre tablas MergeTree cuando no consultamos ninguna columnas (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- Se corrigió el desbordamiento en la división de enteros de tipo con signo a tipo sin signo. El comportamiento fue exactamente como en el lenguaje C o C ++ (reglas de promoción enteras) que puede ser sorprendente. Tenga en cuenta que el desbordamiento aún es posible cuando se divide un número firmado grande por un número sin signo grande o viceversa (pero ese caso es menos habitual). El problema existía en todas las versiones del servidor. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Limite el tiempo máximo de suspensión para el estrangulamiento cuando `max_execution_speed` o `max_execution_speed_bytes` se establece. Se corrigieron errores falsos como `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigieron problemas sobre el uso `MATERIALIZED` columnas y alias en `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos pájaro](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar `FormatFactory` comportamiento para flujos de entrada que no se implementan como procesador. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Error tipográfico fijo. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Acerca de Nosotros](https://github.com/alexryndin)) +- Typo en el mensaje de error (es -\> are ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) +- Se corrigió el error al analizar la lista de columnas de la cadena si el tipo contenía una coma (este problema era relevante para `File`, `URL`, `HDFS` almacenamiento) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([Dimarub2000](https://github.com/dimarub2000)) + +#### Corrección De Seguridad {#security-fix} + +- Esta versión también contiene todas las correcciones de seguridad de errores de 19.13 y 19.11. +- Se corrigió la posibilidad de que una consulta fabricada causara un bloqueo del servidor debido al desbordamiento de la pila en el analizador SQL. Se corrigió la posibilidad de desbordamiento de pila en las tablas Merge y Distributed, las vistas materializadas y las condiciones para la seguridad a nivel de fila que implicaban subconsultas. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora {#improvement-3} + +- Correcta implementación de la lógica ternaria para `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alejandro Kazakov](https://github.com/Akazz)) +- Ahora los valores y filas con TTL caducado se eliminarán después `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` consulta. Consultas añadidas `SYSTEM STOP/START TTL MERGES` para no permitir / permitir asignar fusiones con TTL y filtrar valores caducados en todas las fusiones. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) +- Posibilidad de cambiar la ubicación del archivo de historial de ClickHouse para el cliente usando `CLICKHOUSE_HISTORY_FILE` envío. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) +- Quitar `dry_run` bandera de `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Apoyo `ASOF JOIN` con `ON` apartado. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) +- Mejor soporte de índices de omisión para mutaciones y replicación. Soporte para `MATERIALIZE/CLEAR INDEX ... IN PARTITION` consulta. `UPDATE x = x` vuelve a calcular todos los índices que usan la columna `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) +- Permitir a `ATTACH` vistas en vivo (por ejemplo, al iniciar el servidor) independientemente de `allow_experimental_live_view` configuración. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Para los seguimientos de pila recopilados por el generador de perfiles de consultas, no incluya los marcos de pila generados por el propio generador de perfiles de consultas. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora funciones de tabla `values`, `file`, `url`, `hdfs` tienen soporte para columnas ALIAS. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Lance una excepción si `config.d` file no tiene el elemento raíz correspondiente como el archivo de configuración. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([Dimarub2000](https://github.com/dimarub2000)) +- Imprimir información adicional en el mensaje de excepción para `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([Tavplubix](https://github.com/tavplubix)) +- Al determinar fragmentos de un `Distributed` debe ser cubierto por una consulta de lectura (para `optimize_skip_unused_shards` = 1) ClickHouse ahora verifica las condiciones de ambos `prewhere` y `where` cláusulas de la instrucción select. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alejandro Kazakov](https://github.com/Akazz)) +- Permitir `SIMDJSON` para máquinas sin AVX2 pero con sistema de instrucciones SSE 4.2 y PCLMUL. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse puede funcionar en sistemas de archivos sin `O_DIRECT` soporte (como ZFS y BtrFS) sin afinación adicional. [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soporte push down predicado para la subconsulta final. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([Método de codificación de datos:](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejor `JOIN ON` extracción de llaves [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) +- Se ha actualizado `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Optimizar la selección de la columna más pequeña para `SELECT count()` consulta. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos pájaro](https://github.com/amosbird)) +- Añadir `strict` parámetro en `windowFunnel()`. Cuando el `strict` se establece, el `windowFunnel()` aplica condiciones sólo para los valores únicos. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([chimbab](https://github.com/achimbab)) +- Interfaz más segura de `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) +- Opciones de tamaño de línea al ejecutar con `--help` opción ahora se corresponde con el tamaño del terminal. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([Dimarub2000](https://github.com/dimarub2000)) +- Desactivar “read in order” optimización para la agregación sin claves. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) +- Código de estado HTTP para `INCORRECT_DATA` y `TYPE_MISMATCH` los códigos de error se cambiaron de forma predeterminada `500 Internal Server Error` a `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alejandro Rodin](https://github.com/a-rodin)) +- Mover un objeto de unión desde `ExpressionAction` en `AnalyzedJoin`. `ExpressionAnalyzer` y `ExpressionAction` no sé `Join` clase más. Su lógica está oculta por `AnalyzedJoin` iface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió un posible interbloqueo de consultas distribuidas cuando uno de los fragmentos es localhost pero la consulta se envía a través de una conexión de red. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Semántica cambiada de varias tablas `RENAME` para evitar posibles interbloqueos. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Servidor de compatibilidad MySQL reescrito para evitar la carga completa de paquetes de carga en la memoria. Disminución del consumo de memoria para cada conexión a aproximadamente `2 * DBMS_DEFAULT_BUFFER_SIZE` (búferes de lectura/escritura). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) +- Mueva la lógica de interpretación de alias AST fuera del analizador que no tiene que saber nada sobre la semántica de consultas. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) +- Análisis ligeramente más seguro de `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-copier`: Permitir el uso `where_condition` de configuración con `partition_key` alias en la consulta para verificar la existencia de la partición (Anteriormente se usaba solo para leer consultas de datos). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([propulsor](https://github.com/proller)) +- Añadido argumento de mensaje opcional en `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) +- La excepción del servidor obtenida al enviar datos de inserción ahora también se está procesando en el cliente. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([Dimarub2000](https://github.com/dimarub2000)) +- Se agregó una métrica `DistributedFilesToInsert` que muestra el número total de archivos en el sistema de archivos que se seleccionan para enviar a servidores remotos mediante tablas distribuidas. El número se suma en todos los fragmentos. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mover la mayoría de JOINs preparar la lógica de `ExpressionAction/ExpressionAnalyzer` a `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) +- Reparar TSan [advertencia](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) +- Mejores mensajes de información sobre la falta de capacidades de Linux. Registro de errores fatales con “fatal” nivel, que hará que sea más fácil de encontrar en `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cuando se habilita el volcado de datos temporales en el disco para restringir el uso de memoria durante `GROUP BY`, `ORDER BY`, no comprobó el espacio de disco libre. La corrección agrega una nueva configuración `min_free_disk_space`, cuando el espacio de disco libre es más pequeño que el umbral, la consulta se detendrá y lanzará `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eliminado rwlock recursivo por hilo. No tiene sentido, porque los hilos se reutilizan entre consultas. `SELECT` la consulta puede adquirir un bloqueo en un hilo, mantener un bloqueo de otro hilo y salir del primer hilo. Al mismo tiempo, el primer hilo puede ser reutilizado por `DROP` consulta. Esto conducirá a falso “Attempt to acquire exclusive lock recursively” mensaje. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Dividir `ExpressionAnalyzer.appendJoin()`. Preparar un lugar en `ExpressionAnalyzer` para `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir `mysql_native_password` complemento de autenticación al servidor de compatibilidad MySQL. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) +- Menos número de `clock_gettime` llamadas; compatibilidad ABI fija entre depuración / liberación en `Allocator` (problema insignificante). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mover `collectUsedColumns` de `ExpressionAnalyzer` a `SyntaxAnalyzer`. `SyntaxAnalyzer` hacer `required_source_columns` sí mismo ahora. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir ajuste `joined_subquery_requires_alias` para requerir alias para subselecciones y funciones de tabla en `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) +- Extraer `GetAggregatesVisitor` clase de `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) +- `system.query_log`: cambiar el tipo de datos de `type` columna a `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Enlace estático de `sha256_password` complemento de autenticación. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) +- Evite una dependencia adicional para la configuración `compile` trabajar. En versiones anteriores, el usuario puede obtener un error como `cannot open crti.o`, `unable to find library -lc` sucesivamente. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Más validación de la entrada que puede provenir de réplica maliciosa. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora `clickhouse-obfuscator` el archivo está disponible en `clickhouse-client` paquete. En versiones anteriores estaba disponible como `clickhouse obfuscator` (con espacios en blanco). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([Dimarub2000](https://github.com/dimarub2000)) +- Fijo interbloqueo cuando tenemos al menos dos consultas que leer al menos dos tablas en orden diferente y otra consulta que realiza DDL operación en una de las mesas. Se corrigió otro punto muerto muy raro. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `os_thread_ids` columna a `system.processes` y `system.query_log` para mejores posibilidades de depuración. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Una solución para los errores de extensión PHP mysqlnd que ocurren cuando `sha256_password` se utiliza como un complemento de autenticación predeterminado (descrito en [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) +- Elimine el lugar innecesario con columnas de nulabilidad modificadas. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) +- Establecer el valor predeterminado de `queue_max_wait_ms` a cero, porque el valor actual (cinco segundos) no tiene sentido. Hay raras circunstancias en las que esta configuración tiene algún uso. Configuración añadida `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` y `connection_pool_max_wait_ms` para la desambiguación. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Extraer `SelectQueryExpressionAnalyzer` de `ExpressionAnalyzer`. Mantenga el último para consultas no seleccionadas. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) +- Se eliminó la duplicación de formatos de entrada y salida. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Permitir al usuario anular `poll_interval` y `idle_connection_timeout` configuración en la conexión. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `MergeTree` ahora tiene una opción adicional `ttl_only_drop_parts` (deshabilitado por defecto) para evitar la poda parcial de las piezas, de modo que se caigan completamente cuando todas las filas de una pieza hayan caducado. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) +- Comprobaciones de tipo para establecer funciones de índice. Lanzar excepción si la función tiene un tipo incorrecto. Esto corrige la prueba de fuzz con UBSan. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Mejora Del Rendimiento {#performance-improvement-2} + +- Optimice las consultas con `ORDER BY expressions` cláusula, donde `expressions` tiene prefijo coincidente con clave de clasificación en `MergeTree` tabla. Esta optimización está controlada por `optimize_read_in_order` configuración. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) +- Permitir el uso de múltiples hilos durante la carga y eliminación de piezas. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Variante por lotes implementada de actualizar los estados de funciones agregadas. Puede conducir a beneficios de rendimiento. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Utilizar `FastOps` biblioteca para funciones `exp`, `log`, `sigmoid`, `tanh`. FastOps es una biblioteca matemática vectorial rápido de Michael Parakhin (Yandex CTO). Rendimiento mejorado de `exp` y `log` funciona más de 6 veces. Función `exp` y `log` de `Float32` el argumento volverá `Float32` (en versiones anteriores siempre regresan `Float64`). Ahora `exp(nan)` puede volver `inf`. El resultado de `exp` y `log` las funciones pueden no ser el número representable de la máquina más cercana a la respuesta verdadera. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) Usando la variante Danila Kutenin para hacer fastops trabajando [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Deshabilitar la optimización de claves consecutivas para `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) +- Rendimiento mejorado de `simdjson` biblioteca al deshacerse de la asignación dinámica en `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) +- Páginas de error previo al asignar memoria con `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) +- Corregir un error de rendimiento en `Decimal` comparación. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-4} + +- Elimine el compilador (creación de instancias de la plantilla de tiempo de ejecución) porque hemos ganado su rendimiento. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó una prueba de rendimiento para mostrar la degradación del rendimiento en gcc-9 de una manera más aislada. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Función de tabla añadida `numbers_mt`, que es la versión multiproceso de `numbers`. Pruebas de rendimiento actualizadas con funciones hash. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Modo de comparación en `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([Dimarub2000](https://github.com/dimarub2000)) +- Mejor esfuerzo para imprimir rastros de pila. También añadido `SIGPROF` como una señal de depuración para imprimir el seguimiento de la pila de un hilo en ejecución. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cada función en su propio archivo, parte 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eliminar doble const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) +- Cambios de formato para `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) +- Mejor subconsulta para la creación de unión en `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) +- Elimine una condición redundante (encontrada por PVS Studio). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) +- Separe la interfaz de la tabla hash para `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) +- Refactorización de configuraciones. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) +- Añadir comentarios para `set` funciones de índice. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) +- Aumente la puntuación de OOM en la versión de depuración en Linux. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) +- HDFS HA ahora funciona en la compilación de depuración. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) +- Se agregó una prueba a `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregue prueba para múltiples vistas materializadas para la tabla Kafka. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([Ivan](https://github.com/abyss7)) +- Hacer un mejor esquema de construcción. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([Ivan](https://github.com/abyss7)) +- Fijo `test_external_dictionaries` integración en caso de que se haya ejecutado bajo un usuario no root. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- El error se reproduce cuando el tamaño total de los paquetes escritos excede `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) +- Se agregó una prueba para `RENAME` condición de carrera de mesa [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evitar la carrera de datos en Configuración en `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir prueba de integración para el manejo de errores por un diccionario de caché. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) +- Deshabilite el análisis de archivos de objetos ELF en Mac OS, porque no tiene sentido. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Intenta mejorar el generador de registro de cambios. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `-Wshadow` cambiar al GCC. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) +- Eliminado el código obsoleto para `mimalloc` apoyo. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `zlib-ng` determina las capacidades de x86 y guarda esta información en variables globales. Esto se hace en la llamada defalteInit , que puede ser hecha por diferentes hilos simultáneamente. Para evitar escrituras multiproceso, hágalo al iniciar la biblioteca. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) +- Prueba de regresión para un error que en join se corrigió en [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) +- Informe MSan fijo. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar aleteo prueba TTL. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) +- Corregido carrera de datos falsos en `MergeTreeDataPart::is_frozen` campo. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigieron los tiempos de espera en la prueba de fuzz. En la versión anterior, se las arregló para encontrar falso bloqueo en la consulta `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregaron comprobaciones de depuración a `static_cast` de columnas. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soporte para Oracle Linux en paquetes RPM oficiales. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cambiado json perftests de `once` a `loop` tipo. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `odbc-bridge.cpp` definir `main()` por lo que no debe ser incluido en `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Películas De Sexo](https://github.com/orivej)) +- Prueba de accidente en `FULL|RIGHT JOIN` con nulos en las claves de la tabla derecha. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) +- Se agregó una prueba para el límite de expansión de alias por si acaso. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cambiado de `boost::filesystem` a `std::filesystem` cuando sea apropiado. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregaron paquetes RPM al sitio web. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir una prueba para fijo `Unknown identifier` excepción en `IN` apartado. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) +- Simplificar `shared_ptr_helper` porque las personas que enfrentan dificultades para entenderlo. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregaron pruebas de rendimiento para el códec Gorilla y DoubleDelta fijo. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) +- Dividir la prueba de integración `test_dictionaries` en 4 pruebas separadas. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) +- Repara la advertencia de PVS-Studio en `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Permitir usar `library` fuente del diccionario con ASan. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó la opción para generar registro de cambios a partir de una lista de relaciones públicas. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bloquee el `TinyLog` almacenamiento al leer. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) +- Compruebe si hay enlaces simbólicos rotos en CI. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Aumentar el tiempo de espera para “stack overflow” prueba porque puede llevar mucho tiempo en la compilación de depuración. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó un cheque para espacios en blanco dobles. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar `new/delete` Seguimiento de memoria cuando se construye con desinfectantes. El seguimiento no está claro. Solo evita las excepciones de límite de memoria en las pruebas. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) +- Habilite la comprobación de símbolos indefinidos durante la vinculación. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([Ivan](https://github.com/abyss7)) +- Evitar la reconstrucción `hyperscan` todos los días. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Informe UBSan fijo en `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- No permita el uso del generador de perfiles de consultas con desinfectantes porque no es compatible. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregue prueba para recargar un diccionario después de fallar por temporizador. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corregir inconsistencia en `PipelineExecutor::prepareProcessor` tipo de argumento. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Se agregó una prueba de URI malos. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregaron más cheques a `CAST` función. Esto debería obtener más información sobre la falla de segmentación en la prueba difusa. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Añadir `gcc-9` apoyo a `docker/builder` contenedor que construye la imagen localmente. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Prueba de clave primaria con `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([Dimarub2000](https://github.com/dimarub2000)) +- Se corrigieron las pruebas afectadas por la impresión de rastros de pila lenta. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregue un caso de prueba para el bloqueo en `groupUniqArray` fijo en [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) +- Pruebas de mutaciones de índices fijos. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) +- En la prueba de rendimiento, no lea el registro de consultas para las consultas que no ejecutamos. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) +- La vista materializada ahora se puede crear con cualquier tipo de cardinalidad baja, independientemente de la configuración sobre tipos de cardinalidad baja sospechosos. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) +- Pruebas actualizadas para `send_logs_level` configuración. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix build bajo gcc-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) +- Corregir la compilación con libc ++ interno. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([Ivan](https://github.com/abyss7)) +- Reparar compilación compartida con `rdkafka` biblioteca [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) +- Correcciones para la compilación de Mac OS (incompleta). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([Más información](https://github.com/alex-zaitsev)) +- Fijar “splitted” construir. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Otras correcciones de compilación: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos pájaro](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([Ivan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([propulsor](https://github.com/proller)) + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-3} + +- Se eliminó la función de tabla raramente utilizada `catBoostPool` y almacenamiento `CatBoostPool`. Si ha utilizado esta función de tabla, escriba un correo electrónico a `clickhouse-feedback@yandex-team.com`. Tenga en cuenta que la integración CatBoost sigue siendo y será compatible. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Desactivar `ANY RIGHT JOIN` y `ANY FULL JOIN` predeterminada. Establecer `any_join_distinct_right_table_keys` configuración para permitirles. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) + +## Lanzamiento De ClickHouse 19.13 {#clickhouse-release-19-13} + +### Lanzamiento De ClickHouse 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} + +#### Corrección De Errores {#bug-fix-9} + +- Esta versión también contiene todas las correcciones de errores de 19.11.12.69. + +### Lanzamiento De ClickHouse 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} + +#### Corrección De Errores {#bug-fix-10} + +- Esta versión también contiene todas las correcciones de errores de 19.14.6.12. +- Se corrigió el posible estado inconsistente de la tabla mientras se ejecutaba `DROP` consulta para la tabla replicada mientras que el zookeeper no es accesible. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Solución para la carrera de datos en StorageMerge [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir error introducido en el generador de perfiles de consultas que conduce a una recv interminable desde el socket. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) +- Corregir el uso excesivo de la CPU mientras se ejecuta `JSONExtractRaw` función sobre un valor booleano. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corrige la regresión mientras presiona a la vista materializada. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([Ivan](https://github.com/abyss7)) +- Función de la tabla `url` la vulnerabilidad permitió al atacante inyectar encabezados HTTP arbitrarios en la solicitud. Este problema fue encontrado por [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Arreglar inútil `AST` compruebe en Establecer índice. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) +- Análisis fijo de `AggregateFunction` valores incrustados en la consulta. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) +- Corregido el comportamiento incorrecto de `trim` funciones familiares. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse liberación 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} + +#### Corrección De Errores {#bug-fix-11} + +- Esta versión también contiene todas las correcciones de seguridad de errores de 19.11.9.52 y 19.11.10.54. +- Carrera de datos fija en `system.parts` mesa y `ALTER` consulta. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el encabezado no coincidente en las secuencias en caso de leer desde una tabla distribuida vacía con sample y prewhere. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Se corrigió el fallo al usar `IN` cláusula con una subconsulta con una tupla. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([Tavplubix](https://github.com/tavplubix)) +- Corregir el caso con los mismos nombres de columna en `GLOBAL JOIN ON` apartado. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) +- Corregir el bloqueo al lanzar tipos a `Decimal` que no lo soportan. Lanzar excepción en su lugar. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió el fallo en `extractAll()` función. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) +- Transformación de consultas para `MySQL`, `ODBC`, `JDBC` funciones de la tabla ahora funciona correctamente para `SELECT WHERE` consultas con múltiples `AND` expresiones. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([Dimarub2000](https://github.com/dimarub2000)) +- Se agregaron verificaciones de declaraciones anteriores para la integración de MySQL 8. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) + +#### Corrección De Seguridad {#security-fix-1} + +- Corrige dos vulnerabilidades en los códecs en fase de descompresión (el usuario malicioso puede fabricar datos comprimidos que provocarán un desbordamiento del búfer en la descompresión). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) + +### Lanzamiento De ClickHouse 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} + +#### Corrección De Errores {#bug-fix-12} + +- Fijar `ALTER TABLE ... UPDATE` consulta para tablas con `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Repare NPE al usar la cláusula IN con una subconsulta con una tupla. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([Tavplubix](https://github.com/tavplubix)) +- Se ha solucionado un problema por el que si una réplica obsoleta cobra vida, puede que aún tenga partes de datos eliminadas por DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([Tavplubix](https://github.com/tavplubix)) +- Solucionado el problema con el análisis CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([Tavplubix](https://github.com/tavplubix)) +- Carrera de datos fija en el sistema.tabla de piezas y consulta ALTER. Esto corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el código incorrecto en las mutaciones que pueden conducir a la corrupción de la memoria. segfault fijo con lectura de la dirección `0x14c0` que puede happed debido a concurrente `DROP TABLE` y `SELECT` de `system.parts` o `system.parts_columns`. Condición de carrera fija en la preparación de consultas de mutación. Estancamiento fijo causado por `OPTIMIZE` de tablas replicadas y operaciones de modificación simultáneas como ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la posible pérdida de datos después de `ALTER DELETE` consulta en la tabla con índice de omisión. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Corrección De Seguridad {#security-fix-2} + +- Si el atacante tiene acceso de escritura a ZooKeeper y es capaz de ejecutar servidor personalizado disponible desde la red donde se ejecuta ClickHouse, puede crear servidor malicioso personalizado que actuará como réplica ClickHouse y registrarlo en ZooKeeper. Cuando otra réplica recuperará la parte de datos de una réplica maliciosa, puede forzar a clickhouse-server a escribir en una ruta arbitraria en el sistema de archivos. Encontrado por Eldar Zaitov, equipo de seguridad de la información en Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} + +#### Novedad {#new-feature-5} + +- Generador de perfiles de muestreo en el nivel de consulta. [Ejemplo](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) +- Permite especificar una lista de columnas con `COLUMNS('regexp')` expresión que funciona como una variante más sofisticada de `*` asterisco. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([Mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CREATE TABLE AS table_function()` es posible [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([Dimarub2000](https://github.com/dimarub2000)) +- El optimizador de Adam para el descenso de gradiente estocástico se usa de forma predeterminada en `stochasticLinearRegression()` y `stochasticLogisticRegression()` funciones agregadas, porque muestra buena calidad sin casi ningún ajuste. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) +- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Cristina Andrés](https://github.com/andyyzh)) +- `RENAME` las consultas ahora funcionan con todos los almacenes. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([Ivan](https://github.com/abyss7)) +- Ahora el cliente recibe registros del servidor con cualquier nivel deseado configurando `send_logs_level` independientemente del nivel de registro especificado en la configuración del servidor. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-4} + +- Configuración `input_format_defaults_for_omitted_fields` está habilitado de forma predeterminada. Las inserciones en las tablas distribuidas necesitan que esta configuración sea la misma en el clúster (debe configurarla antes de actualizar). Permite el cálculo de expresiones predeterminadas complejas para campos omitidos en `JSONEachRow` y `CSV*` formato. Debe ser el comportamiento esperado, pero puede conducir a una diferencia de rendimiento insignificante. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) + +#### Experimental características {#experimental-features} + +- Nueva canalización de procesamiento de consultas. Utilizar `experimental_use_processors=1` opción para habilitarlo. Úselo para su propio problema. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Corrección De Errores {#bug-fix-13} + +- Kafka integración se ha fijado en esta versión. +- Fijo `DoubleDelta` codificación de `Int64` para grandes `DoubleDelta` valores mejorados `DoubleDelta` codificación de datos aleatorios para `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) +- Sobreestimación fija de `max_rows_to_read` si el ajuste `merge_tree_uniform_read_distribution` se establece en 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora {#improvement-4} + +- Lanza una excepción si `config.d` el archivo no tiene el elemento raíz correspondiente como el archivo de configuración [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([Dimarub2000](https://github.com/dimarub2000)) + +#### Mejora Del Rendimiento {#performance-improvement-3} + +- Optimizar `count()`. Ahora usa la columna más pequeña (si es posible). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos pájaro](https://github.com/amosbird)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-5} + +- Informe sobre el uso de memoria en las pruebas de rendimiento. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) +- Corregir compilación con externo `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([Ivan](https://github.com/abyss7)) +- Reparar compilación compartida con `rdkafka` biblioteca [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) + +## Lanzamiento De ClickHouse 19.11 {#clickhouse-release-19-11} + +### Lanzamiento De ClickHouse 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} + +#### Corrección De Errores {#bug-fix-14} + +- Se corrigió un accidente raro en `ALTER MODIFY COLUMN` y fusión vertical cuando una de las partes fusionadas / alteradas está vacía (0 filas). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- Actualización manual de `SIMDJSON`. Esto corrige la posible inundación de archivos stderr con mensajes de diagnóstico json falsos. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alejandro Kazakov](https://github.com/Akazz)) +- Corregido error con `mrk` extensión de archivo para mutaciones ([alesapin](https://github.com/alesapin)) + +### Lanzamiento De ClickHouse 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} + +#### Corrección De Errores {#bug-fix-15} + +- Se corrigió la degradación del rendimiento del análisis de índices en claves complejas en tablas grandes. Esto corrige [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evite SIGSEGV raro al enviar datos en tablas con motor distribuido (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) +- Fijar `Unknown identifier` con múltiples uniones. Esto corrige [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) + +### Lanzamiento De ClickHouse 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} + +- Corregir el error lógico que causa segfaults al seleccionar el tema vacío de Kafka. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) +- Solución para la función `АrrayEnumerateUniqRanked` con matrices vacías en params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([propulsor](https://github.com/proller)) + +### Lanzamiento De ClickHouse 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} + +#### Corrección De Errores {#bug-fix-16} + +- Almacene los desplazamientos para los mensajes de Kafka manualmente para poder confirmarlos todos a la vez para todas las particiones. Corrige la duplicación potencial en “one consumer - many partitions” escenario. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([Ivan](https://github.com/abyss7)) + +### Lanzamiento De ClickHouse 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} + +- Mejorar el manejo de errores en los diccionarios de caché. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corregido error en la función `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([propulsor](https://github.com/proller)) +- Fijar `JSONExtract` la función mientras que la extracción de un `Tuple` de JSON. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) +- Se corrigió la posible pérdida de datos después de `ALTER DELETE` consulta en la tabla con índice de omisión. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) +- Prueba de rendimiento fija. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Parquet: Fijar la lectura de columnas booleanos. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregido el comportamiento incorrecto de `nullIf` la función de la constante de argumentos. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Solucione el problema de duplicación de mensajes de Kafka en el reinicio normal del servidor. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) +- Se ha corregido un problema durante mucho tiempo `ALTER UPDATE` o `ALTER DELETE` puede evitar que se ejecuten fusiones regulares. Evite que las mutaciones se ejecuten si no hay suficientes subprocesos libres disponibles. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([Tavplubix](https://github.com/tavplubix)) +- Corregido el error con el procesamiento “timezone” en el archivo de configuración del servidor. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Revisión de kafka pruebas. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([Ivan](https://github.com/abyss7)) + +#### Corrección De Seguridad {#security-fix-3} + +- Si el atacante tiene acceso de escritura a ZooKeeper y es capaz de ejecutar servidor personalizado disponible desde la red donde se ejecuta ClickHouse, puede crear servidor malicioso personalizado que actuará como réplica ClickHouse y registrarlo en ZooKeeper. Cuando otra réplica recuperará la parte de datos de una réplica maliciosa, puede forzar a clickhouse-server a escribir en una ruta arbitraria en el sistema de archivos. Encontrado por Eldar Zaitov, equipo de seguridad de la información en Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} + +#### Corrección De Errores {#bug-fix-17} + +- Fijar `ALTER TABLE ... UPDATE` consulta para tablas con `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Repare NPE al usar la cláusula IN con una subconsulta con una tupla. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([Tavplubix](https://github.com/tavplubix)) +- Se ha solucionado un problema por el que si una réplica obsoleta cobra vida, puede que aún tenga partes de datos eliminadas por DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([Tavplubix](https://github.com/tavplubix)) +- Solucionado el problema con el análisis CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([Tavplubix](https://github.com/tavplubix)) +- Carrera de datos fija en el sistema.tabla de piezas y consulta ALTER. Esto corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el código incorrecto en las mutaciones que pueden conducir a la corrupción de la memoria. segfault fijo con lectura de la dirección `0x14c0` que puede happed debido a concurrente `DROP TABLE` y `SELECT` de `system.parts` o `system.parts_columns`. Condición de carrera fija en la preparación de consultas de mutación. Estancamiento fijo causado por `OPTIMIZE` de tablas replicadas y operaciones de modificación simultáneas como ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} + +#### Corrección De Errores {#bug-fix-18} + +- Kafka integración se ha fijado en esta versión. +- Corregir segfault cuando se usa `arrayReduce` para argumentos constantes. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijo `toFloat()` monotonicidad. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([Dimarub2000](https://github.com/dimarub2000)) +- Reparar segfault con habilitado `optimize_skip_unused_shards` y falta la clave de fragmentación. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) +- Lógica fija de `arrayEnumerateUniqRanked` función. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se eliminó el registro detallado adicional del controlador MySQL. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir el comportamiento incorrecto y posibles fallas en `topK` y `topKWeighted` funciones agregadas. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) +- No exponga columnas virtuales en `system.columns` tabla. Esto es necesario para la compatibilidad con versiones anteriores. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir un error con la asignación de memoria para campos de cadena en el diccionario de caché de claves complejas. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- Corregir un error al habilitar la granularidad adaptativa al crear una nueva réplica para `Replicated*MergeTree` tabla. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- Corregir bucle infinito al leer los mensajes de Kafka. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) +- Se corrigió la posibilidad de que una consulta fabricada causara un bloqueo del servidor debido al desbordamiento de la pila en el analizador SQL y la posibilidad de desbordamiento de la pila en `Merge` y `Distributed` tabla [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregido el error de codificación Gorilla en pequeñas secuencias. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) + +#### Mejora {#improvement-5} + +- Permitir al usuario anular `poll_interval` y `idle_connection_timeout` configuración en la conexión. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} + +#### Corrección De Errores {#bug-fix-19} + +- Se corrigió la posibilidad de colgar consultas cuando el servidor está sobrecargado. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reparar FPE en la función yandexConsistentHash. Esto corrige [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregido error en la conversión de `LowCardinality` tipos en `AggregateFunctionFactory`. Esto corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir el análisis de `bool` ajustes de `true` y `false` en los archivos de configuración. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- Corrige un error raro con encabezados de flujo incompatibles en consultas para `Distributed` mesa sobre `MergeTree` mesa cuando parte de `WHERE` se mueve a `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- Se corrigió el desbordamiento en la división de enteros de tipo con signo a tipo sin signo. Esto corrige [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-5} + +- `Kafka` todavía roto. + +### Lanzamiento De ClickHouse 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} + +#### Corrección De Errores {#bug-fix-20} + +- Corregir un error al escribir marcas de índices secundarios con granularidad adaptativa. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- Fijar `WITH ROLLUP` y `WITH CUBE` modificadores de `GROUP BY` con agregación de dos niveles. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Cuelgue fijo adentro `JSONExtractRaw` función. Fijo [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Revisión violación de segmento en ExternalLoader::reloadOutdated(). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) +- Se corrigió el caso en el que el servidor podía cerrar sockets de escucha pero no apagar y continuar sirviendo las consultas restantes. Puede terminar con dos procesos de servidor de clickhouse en ejecución. A veces, el servidor puede devolver un error `bad_function_call` para las consultas restantes. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la condición inútil e incorrecta en el campo de actualización para la carga inicial de diccionarios externos a través de ODBC, MySQL, ClickHouse y HTTP. Esto corrige [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió una excepción irrelevante en el elenco de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fijar resultado no determinista de “uniq” función agregada en casos extremos raros. El error estaba presente en todas las versiones de ClickHouse. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Segfault cuando establecemos un CIDR demasiado alto en la función `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Se corrigió una pequeña pérdida de memoria cuando el servidor lanzaba muchas excepciones de muchos contextos diferentes. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soluciona la situación cuando el consumidor se detuvo antes de la suscripción y no se reanudó después. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([Ivan](https://github.com/abyss7)) Tenga en cuenta que Kafka está roto en esta versión. +- Borrar el búfer de datos Kafka de la operación de lectura anterior que se completó con un error [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Tenga en cuenta que Kafka está roto en esta versión. +- Ya `StorageMergeTree::background_task_handle` se inicializa en `startup()` el `MergeTreeBlockOutputStream::write()` puede intentar usarlo antes de la inicialización. Solo verifique si está inicializado. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-6} + +- Añadido oficial `rpm` paquete. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([propulsor](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) +- Añadir una habilidad para construir `.rpm` y `.tgz` paquetes con `packager` script. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) +- Correcciones para “Arcadia” sistema de construcción. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([propulsor](https://github.com/proller)) + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-6} + +- `Kafka` está roto en esta versión. + +### Lanzamiento De ClickHouse 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} + +#### Novedad {#new-feature-6} + +- Se agregó soporte para declaraciones preparadas. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alejandro](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `DoubleDelta` y `Gorilla` codecs de columna [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) +- Añadir `os_thread_priority` ajuste que permite controlar el “nice” valor de los subprocesos de procesamiento de consultas que utiliza el sistema operativo para ajustar la prioridad de programación dinámica. Requiere `CAP_SYS_NICE` capacidades para trabajar. Esto implementa [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Implementar `_topic`, `_offset`, `_key` columnas para el motor Kafka [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([Ivan](https://github.com/abyss7)) Tenga en cuenta que Kafka está roto en esta versión. +- Añadir combinador de funciones agregadas `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([Hcz](https://github.com/hczhcz)) +- Funciones agregadas `groupArrayMovingSum(win_size)(x)` y `groupArrayMovingAvg(win_size)(x)`, que calculan la suma / avg en movimiento con o sin limitación de tamaño de ventana. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([Sistema abierto.](https://github.com/inv2004)) +- Agregar sinónimo `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([Hcz](https://github.com/hczhcz)) +- Función Intergate H3 `geoToH3` de Uber. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Corrección De Errores {#bug-fix-21} + +- Implementar caché DNS con actualización asincrónica. El subproceso separado resuelve todos los hosts y actualiza la caché DNS con el punto (configuración `dns_cache_update_period`). Debería ayudar, cuando la ip de los hosts cambia con frecuencia. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) +- Arreglar segfault en `Delta` codec que afecta a columnas con valores de menos de 32 bits. El error llevó a la corrupción de memoria aleatoria. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- Fix segfault en TTL se fusionan con columnas no físicas en el bloque. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir un error raro en la comprobación de la parte con `LowCardinality` columna. Previamente `checkDataPart` siempre falla para parte con `LowCardinality` columna. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- Evite colgar conexiones cuando el grupo de subprocesos del servidor esté lleno. Es importante para las conexiones desde `remote` función de tabla o conexiones a un fragmento sin réplicas cuando hay un tiempo de espera de conexión largo. Esto corrige [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soporte para argumentos constantes para `evalMLModel` función. Esto corrige [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se ha solucionado el problema cuando ClickHouse determina la zona horaria predeterminada como `UCT` en lugar de `UTC`. Esto corrige [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijo desbordamiento del búfer en `visitParamExtractRaw`. Esto corrige [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora distribuido `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` las consultas se ejecutarán directamente en la réplica del líder. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- Fijar `coalesce` para `ColumnConst` con `ColumnNullable` + cambios relacionados. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijar el `ReadBufferFromKafkaConsumer` para que siga leyendo nuevos mensajes después `commit()` incluso si estaba estancado antes [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([Ivan](https://github.com/abyss7)) +- Fijar `FULL` y `RIGHT` Resultados de JOIN al unirse en `Nullable` teclas en la mesa derecha. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) +- Posible solución de sueño infinito de consultas de baja prioridad. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir la condición de carrera, lo que hace que algunas consultas no aparezcan en query\_log después `SYSTEM FLUSH LOGS` consulta. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Fijo `heap-use-after-free` ASan advertencia en ClusterCopier causada por el reloj que intenta usar el objeto de copiadora ya eliminado. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregido mal `StringRef` puntero devuelto por algunas implementaciones de `IColumn::deserializeAndInsertFromArena`. Este error afectó solo a las pruebas unitarias. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Evite que la matriz de origen y la matriz intermedia se unan a columnas de enmascaramiento de columnas del mismo nombre. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) +- Solucione la inserción y seleccione la consulta al motor MySQL con citas de identificador de estilo MySQL. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([Invierno Zhang](https://github.com/zhang2014)) +- Ahora `CHECK TABLE` consulta puede trabajar con la familia del motor MergeTree. Devuelve el estado de verificación y el mensaje si hay alguno para cada parte (o archivo en caso de motores más simples). Además, corrija el error en la búsqueda de una parte rota. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) +- Reparar el tiempo de ejecución SPLIT\_SHARED\_LIBRARIES [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Más información](https://github.com/danlark1)) +- Inicialización de zona horaria fija cuando `/etc/localtime` es un enlace simbólico relativo como `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- clickhouse-copiadora: Solucionar el uso-después de la libertad en el apagado [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([propulsor](https://github.com/proller)) +- Actualizar `simdjson`. Se corrigió el problema de que algunos JSON no válidos con cero bytes analizaran correctamente. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reparar el cierre de SystemLogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) +- Arreglar colgando cuando la condición en invalidate\_query depende de un diccionario. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Mejora {#improvement-6} + +- Permitir direcciones no resolubles en la configuración del clúster. Se considerarán no disponibles y se intentarán resolver en cada intento de conexión. Esto es especialmente útil para Kubernetes. Esto corrige [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cierre las conexiones TCP inactivas (con un tiempo de espera de una hora por defecto). Esto es especialmente importante para clústeres grandes con múltiples tablas distribuidas en cada servidor, ya que cada servidor puede mantener un grupo de conexiones con cualquier otro servidor, y después de la concurrencia de consultas pico, las conexiones se detendrán. Esto corrige [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejor calidad de `topK` función. Se ha cambiado el comportamiento del conjunto SavingSpace para eliminar el último elemento si el nuevo elemento tiene un peso mayor. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Las funciones de URL para trabajar con dominios ahora pueden funcionar para URL incompletas sin esquema [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) +- Sumas de comprobación añadidas al `system.parts_columns` tabla. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Añadir `Enum` tipo de datos como un sinónimo para `Enum8` o `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([Dimarub2000](https://github.com/dimarub2000)) +- Variante de transposición de bits completa para `T64` códec. Podría conducir a una mejor compresión con `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) +- Condición en `startsWith` la función ahora puede utilizar la clave principal. Esto corrige [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) y [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([Dimarub2000](https://github.com/dimarub2000)) +- Permitir usar `clickhouse-copier` con la topología de clúster de replicación cruzada permitiendo el nombre de base de datos vacío. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) +- Utilizar `UTC` como zona horaria predeterminada en un sistema sin `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` se imprimió y el servidor o el cliente se negó a iniciar. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soporte devuelto para argumento de coma flotante en función `quantileTiming` para la compatibilidad con versiones anteriores. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mostrar qué tabla falta la columna en los mensajes de error. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([Ivan](https://github.com/abyss7)) +- No permitir la consulta de ejecución con el mismo query\_id por varios usuarios [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([propulsor](https://github.com/proller)) +- Código más robusto para enviar métricas a Graphite. Funcionará incluso durante largos múltiples `RENAME TABLE` operación. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se mostrarán mensajes de error más informativos cuando ThreadPool no pueda programar una tarea para su ejecución. Esto corrige [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Invertir ngramSearch para que sea más intuitivo [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Más información](https://github.com/danlark1)) +- Agregar análisis de usuario en el generador de motor HDFS [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) +- Actualizar el valor predeterminado de `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) +- Se agregó una noción de configuraciones obsoletas. La configuración obsoleta `allow_experimental_low_cardinality_type` se puede utilizar sin efecto. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) + +#### Mejora Del Rendimiento {#performance-improvement-4} + +- Aumente el número de secuencias a SELECT desde la tabla Merge para una distribución más uniforme de los subprocesos. Añadido `max_streams_multiplier_for_merge_tables`. Esto corrige [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-7} + +- Agregue una prueba de compatibilidad con versiones anteriores para la interacción cliente-servidor con diferentes versiones de clickhouse. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) +- Pruebe la información de cobertura en cada solicitud de confirmación y extracción. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) +- Coopere con el desinfectante de direcciones para respaldar nuestros asignadores personalizados (`Arena` y `ArenaWithFreeLists`) para una mejor depuración de “use-after-free” error. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) +- Cambiar a [Implementación de LLVM libunwind](https://github.com/llvm-mirror/libunwind) para el manejo de excepciones de C ++ y para la impresión de rastreos de pila [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Vídeos relacionados con nikita Lapkov](https://github.com/laplab)) +- Agregue dos advertencias más de -Weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Permitir construir ClickHouse con Memory Sanitizer. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Informe ubsan fijo sobre `bitTest` función en la prueba de fuzz. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Docker: se agregó la posibilidad de iniciar una instancia de ClickHouse que requiere autenticación. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) +- Actualizar librdkafka a la versión 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([Ivan](https://github.com/abyss7)) +- Agregue el tiempo de espera global para las pruebas de integración y deshabilite algunas de ellas en el código de pruebas. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) +- Solucionar algunas fallas ThreadSanitizer. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) +- El `--no-undefined` opción obliga al enlazador a verificar la existencia de todos los nombres externos mientras se vincula. Es muy útil rastrear dependencias reales entre bibliotecas en el modo de compilación dividida. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([Ivan](https://github.com/abyss7)) +- Prueba de rendimiento añadida para [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Compatibilidad fija con gcc-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó soporte para gcc-9. Esto corrige [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el error cuando libunwind se puede vincular incorrectamente. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigieron algunas advertencias encontradas por PVS-Studio. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó soporte inicial para `clang-tidy` analizador estático. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Convertir macros endian BSD/Linux( ‘be64toh’ y ‘htobe64’) a los equivalentes de Mac OS X [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fuente Chen](https://github.com/fredchenbj)) +- Guía de pruebas de integración mejorada. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Reparación de compilación en macosx + gcc9 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) +- Corrige un error tipográfico difícil de detectar: aggreAGte -\> agregado. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) +- Arreglar la compilación freebsd [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([propulsor](https://github.com/proller)) +- Añadir enlace al canal experimental de YouTube al sitio web [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) +- CMake: agregar opción para indicadores de cobertura: WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([propulsor](https://github.com/proller)) +- Corrige el tamaño inicial de algunos PODArray en línea. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) +- clickhouse-servidor.postinst: arreglar la detección del sistema operativo para centos 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([propulsor](https://github.com/proller)) +- Se agregó la generación de paquetes Arch Linux. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) +- División Común / config.h por libs (dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([propulsor](https://github.com/proller)) +- Correcciones para “Arcadia” plataforma de construcción [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([propulsor](https://github.com/proller)) +- Correcciones para construcción no convencional (gcc9, sin submódulos) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([propulsor](https://github.com/proller)) +- Requerir un tipo explícito en unignmentStore porque se demostró que era propenso a errores [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) +- Corrige la compilación de MacOS [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) +- Prueba de rendimiento relativa a la nueva característica JIT con un conjunto de datos más grande, como se solicita aquí [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Ejecutar pruebas con estado en la prueba de esfuerzo [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-7} + +- `Kafka` está roto en esta versión. +- Permitir `adaptive_index_granularity` = 10MB por defecto para nuevo `MergeTree` tabla. Si creó nuevas tablas MergeTree en la versión 19.11+, será imposible degradar a versiones anteriores a la 19.6. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) +- Eliminado diccionarios incrustados no documentados obsoletos que fueron utilizados por Yandex.Métrica. Función `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` ya no están disponibles. Si está utilizando estas funciones, escriba un correo electrónico a clickhouse-feedback@yandex-team.com. Nota: en el último momento decidimos mantener estas funciones por un tiempo. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## Lanzamiento De ClickHouse 19.10 {#clickhouse-release-19-10} + +### Lanzamiento De ClickHouse 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} + +#### Novedad {#new-feature-7} + +- Agregar nuevo códec de columna: `T64`. Hecho para columnas (U) IntX / EnumX / Data (Time) / DecimalX. Debería ser bueno para columnas con valores de rango constante o pequeño. Codec en sí permite ampliar o reducir el tipo de datos sin volver a comprimir. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) +- Agregar motor de base de datos `MySQL` que permiten ver todas las tablas en el servidor MySQL remoto [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([Invierno Zhang](https://github.com/zhang2014)) +- `bitmapContains` aplicación. Es 2 veces más rápido que `bitmapHasAny` si el segundo mapa de bits contiene un elemento. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) +- Soporte para `crc32` función (con comportamiento exactamente como en MySQL o PHP). No lo use si necesita una función hash. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) +- Aplicado `SYSTEM START/STOP DISTRIBUTED SENDS` consultas para controlar inserciones asincrónicas en `Distributed` tabla. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([Invierno Zhang](https://github.com/zhang2014)) + +#### Corrección De Errores {#bug-fix-22} + +- Ignore los límites de ejecución de consultas y el tamaño máximo de partes para los límites de combinación mientras ejecuta mutaciones. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir un error que puede conducir a la desduplicación de bloques normales (extremadamente raros) y la inserción de bloques duplicados (más a menudo). [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) +- Fijación de la función `arrayEnumerateUniqRanked` para argumentos con matrices vacías [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([propulsor](https://github.com/proller)) +- No se suscriba a los temas de Kafka sin la intención de sondear ningún mensaje. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([Ivan](https://github.com/abyss7)) +- Hacer configuración `join_use_nulls` no obtienen ningún efecto para los tipos que no pueden estar dentro de Nullable [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fijo `Incorrect size of index granularity` error [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([Coraxster](https://github.com/coraxster)) +- Repara el desbordamiento de conversión de flotador a decimal [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([Coraxster](https://github.com/coraxster)) +- Búfer de descarga cuando `WriteBufferFromHDFS`se llama destructor. Esto corrige la escritura en `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) + +#### Mejora {#improvement-7} + +- Trate las celdas vacías en `CSV` como valores predeterminados cuando la configuración `input_format_defaults_for_omitted_fields` está habilitado. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) +- Carga sin bloqueo de diccionarios externos. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) +- Los tiempos de espera de red se pueden cambiar dinámicamente para las conexiones ya establecidas de acuerdo con la configuración. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) +- Utilizar “public\_suffix\_list” para funciones `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. Está usando una tabla hash perfecta generada por `gperf` con una lista generada a partir del archivo: https://publicsuffix.org/list/public\_suffix\_list.dat. (por ejemplo, ahora reconocemos el dominio `ac.uk` como no significativo). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Adoptar `IPv6` tipo de datos en las tablas del sistema; columnas de información de cliente unificadas en `system.processes` y `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Uso de sesiones para conexiones con el protocolo de compatibilidad MySQL. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) +- Apoyo más `ALTER` consulta `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([Sundyli](https://github.com/sundy-li)) +- Apoyo `` sección en `clickhouse-local` archivo de configuración. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([propulsor](https://github.com/proller)) +- Permitir ejecutar consulta con `remote` función de la tabla en `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([propulsor](https://github.com/proller)) + +#### Mejora Del Rendimiento {#performance-improvement-5} + +- Agregue la posibilidad de escribir la marca final al final de las columnas MergeTree. Permite evitar lecturas inútiles para las claves que están fuera del rango de datos de la tabla. Está habilitado sólo si se está utilizando granularidad de índice adaptativo. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) +- Mejora del rendimiento de las tablas MergeTree en sistemas de archivos muy lentos al reducir el número de `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la degradación del rendimiento en la lectura de las tablas MergeTree que se introdujo en la versión 19.6. Correcciones \#5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-8} + +- Aplicado `TestKeeper` como una implementación de la interfaz ZooKeeper utilizada para probar [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) +- A partir de ahora `.sql` las pruebas se pueden ejecutar aisladas por el servidor, en paralelo, con una base de datos aleatoria. Permite ejecutarlos más rápido, agregar nuevas pruebas con configuraciones de servidor personalizadas y asegurarse de que las diferentes pruebas no se afecten entre sí. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([Ivan](https://github.com/abyss7)) +- Quitar `` y `` de pruebas de rendimiento [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fijo “select\_format” prueba de rendimiento para `Pretty` formato [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## Lanzamiento De ClickHouse 19.9 {#clickhouse-release-19-9} + +### Lanzamiento De ClickHouse 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} + +#### Corrección De Errores {#bug-fix-23} + +- Corregir segfault en el códec Delta que afecta a las columnas con valores de menos de 32 bits de tamaño. El error llevó a la corrupción de memoria aleatoria. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- Corregir un error raro en la comprobación de la parte con la columna LowCardinality. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- Fix segfault en TTL se fusionan con columnas no físicas en el bloque. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Repara el potencial de sueño infinito de consultas de baja prioridad. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corrige cómo ClickHouse determina la zona horaria predeterminada como UCT en lugar de UTC. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir un error sobre la ejecución de las consultas distribuidas DROP / ALTER / TRUNCATE / OPTIMIZE ON CLUSTER en la réplica de seguidor antes de la réplica de líder. Ahora se ejecutarán directamente en réplica líder. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- Corregir la condición de carrera, lo que hace que algunas consultas no aparezcan en query\_log instantáneamente después de la consulta SYSTEM FLUSH LOGS. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Se agregó soporte faltante para argumentos constantes para `evalMLModel` función. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} + +#### Novedad {#new-feature-8} + +- Imprima información sobre piezas congeladas en `system.parts` tabla. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([propulsor](https://github.com/proller)) +- Pregunte la contraseña del cliente en clickhouse-client start en tty si no se establece en argumentos [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([propulsor](https://github.com/proller)) +- Implementar `dictGet` y `dictGetOrDefault` funciones para los tipos Decimal. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Mejora {#improvement-8} + +- Debian init: Agregar tiempo de espera de parada de servicio [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([propulsor](https://github.com/proller)) +- Agregar configuración prohibida de forma predeterminada para crear tabla con tipos sospechosos para LowCardinality [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) +- Las funciones de regresión devuelven pesos del modelo cuando no se usan como Estado en función `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) +- Cambiar el nombre y mejorar los métodos de regresión. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) +- Interfaces más claras de los buscadores de cadenas. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Más información](https://github.com/danlark1)) + +#### Corrección De Errores {#bug-fix-24} + +- Corregir la posible pérdida de datos en Kafka [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([Ivan](https://github.com/abyss7)) +- Repara el potencial bucle infinito en `PrettySpace` formato cuando se llama con cero columnas [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) +- Se corrigió el error de desbordamiento UInt32 en modelos lineales. Permitir modelo ML eval para argumento de modelo no const. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `ALTER TABLE ... DROP INDEX IF EXISTS ...` no debe generar una excepción si el índice proporcionado no existe [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Reparar segfault con `bitmapHasAny` en subconsulta escalar [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Se corrigió el error cuando el grupo de conexiones de replicación no vuelve a intentar resolver el host, incluso cuando se eliminó la caché DNS. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- Fijo `ALTER ... MODIFY TTL` en ReplicatedMergeTree. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) +- Repare INSERT en la tabla distribuida con la columna MATERIALIZED [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) +- Corregir la asignación incorrecta al truncar el almacenamiento de unión [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([Método de codificación de datos:](https://github.com/TCeason)) +- En versiones recientes del paquete tzdata algunos de los archivos son enlaces simbólicos ahora. El mecanismo actual para detectar la zona horaria predeterminada se rompe y da nombres incorrectos para algunas zonas horarias. Ahora, al menos, forzamos el nombre de la zona horaria al contenido de TZ si se proporciona. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) +- Solucione algunos casos extremadamente raros con el buscador MultiVolnitsky cuando las agujas constantes en suma tienen al menos 16 KB de largo. El algoritmo omitió o sobrescribió los resultados anteriores que pueden conducir al resultado incorrecto de `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Más información](https://github.com/danlark1)) +- Solucione el problema cuando la configuración de las solicitudes de ExternalData no podía usar la configuración de ClickHouse. Además, por ahora, configuración `date_time_input_format` y `low_cardinality_allow_in_native_format` no se puede usar debido a la ambigüedad de los nombres (en datos externos puede interpretarse como formato de tabla y en la consulta puede ser una configuración). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Más información](https://github.com/danlark1)) +- Corregir un error cuando las piezas se eliminaron solo de FS sin dejarlas caer de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- Eliminar el registro de depuración del protocolo MySQL [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Omitir ZNONODE durante el procesamiento de consultas DDL [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Fijar la mezcla `UNION ALL` tipo de columna de resultado. Hubo casos con datos inconsistentes y tipos de columnas de columnas resultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- Lanzar una excepción en enteros incorrectos en `dictGetT` funciones en lugar de accidente. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Arregle element\_count y load\_factor incorrectos para el diccionario hash en `system.dictionaries` tabla. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-9} + +- Construcción fija sin `Brotli` Soporte de compresión HTTP (`ENABLE_BROTLI=OFF` de la variable cmake). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) +- Incluye rugido.h como rugiendo / rugiendo.h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Películas De Sexo](https://github.com/orivej)) +- Corregir las advertencias de gcc9 en hyperscan (\# ¡la directiva de línea es malvada!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Más información](https://github.com/danlark1)) +- Corrige todas las advertencias al compilar con gcc-9. Soluciona algunos problemas de contribución. Repara gcc9 ICE y envíalo a bugzilla. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Más información](https://github.com/danlark1)) +- Enlace fijo con lld [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eliminar especializaciones no utilizadas en diccionarios [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) +- Pruebas de rendimiento de mejora para formatear y analizar tablas para diferentes tipos de archivos [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) +- Correcciones para la ejecución de pruebas en paralelo [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([propulsor](https://github.com/proller)) +- Docker: use configuraciones de clickhouse-test [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([propulsor](https://github.com/proller)) +- Solucionar compilación para FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([propulsor](https://github.com/proller)) +- Impulso de actualización a 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([propulsor](https://github.com/proller)) +- Repara el clickhouse de compilación como submódulo [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([propulsor](https://github.com/proller)) +- Mejorar las pruebas de rendimiento JSONExtract [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) + +## Lanzamiento De ClickHouse 19.8 {#clickhouse-release-19-8} + +### Lanzamiento De ClickHouse 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} + +#### Novedad {#new-features} + +- Funciones añadidas para trabajar con JSON [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([Hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) +- Agregue una función basename, con un comportamiento similar a una función basename, que existe en muchos idiomas (`os.path.basename` en python, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Añadir `LIMIT n, m BY` o `LIMIT m OFFSET n BY` sintaxis para establecer el desplazamiento de n para la cláusula LIMIT BY. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) +- Añadido nuevo tipo de datos `SimpleAggregateFunction`, lo que permite tener columnas con agregación de luz en un `AggregatingMergeTree`. Esto solo se puede usar con funciones simples como `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) +- Se agregó soporte para argumentos no constantes en función `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Más información](https://github.com/danlark1)) +- Funciones añadidas `skewPop`, `skewSamp`, `kurtPop` y `kurtSamp` para calcular la asimetría de la secuencia, la asimetría de la muestra, la curtosis y la curtosis de la muestra, respectivamente. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([Hcz](https://github.com/hczhcz)) +- La ayuda cambia de nombre la operación para `MaterializeView` almacenamiento. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Se agregó un servidor que permite conectarse a ClickHouse usando el cliente MySQL. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) +- Añadir `toDecimal*OrZero` y `toDecimal*OrNull` función. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) +- Soporte tipos decimales en funciones: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Más información](https://github.com/danlark1)) +- Añadir `format` función. Formateo del patrón constante (patrón de formato Python simplificado) con las cadenas enumeradas en los argumentos. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Más información](https://github.com/danlark1)) +- Añadir `system.detached_parts` que contiene información sobre las partes separadas de `MergeTree` tabla. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) +- Añadir `ngramSearch` función para calcular la diferencia no simétrica entre la aguja y el pajar. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Más información](https://github.com/danlark1)) +- Implementación de métodos básicos de aprendizaje automático (regresión lineal estocástica y regresión logística) utilizando la interfaz de funciones agregadas. Tiene diferentes estrategias para actualizar los pesos del modelo (descenso de gradiente simple, método de impulso, método Nesterov). También es compatible con mini lotes de tamaño personalizado. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) +- Implementación de `geohashEncode` y `geohashDecode` función. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) +- Función agregada agregada `timeSeriesGroupSum`, que puede agregar diferentes series de tiempo que muestran la marca de tiempo no la alineación. Utilizará la interpolación lineal entre dos marcas de tiempo de muestra y luego sumará series temporales juntas. Función agregada agregada `timeSeriesGroupRateSum`, que calcula la tasa de series temporales y luego suma las tasas juntas. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Información adicional](https://github.com/LiuYangkuan)) +- Funciones añadidas `IPv4CIDRtoIPv4Range` y `IPv6CIDRtoIPv6Range` para calcular los límites inferiores y superiores para una IP en la subred utilizando un CIDR. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Agregue un encabezado X-ClickHouse-Summary cuando enviamos una consulta usando HTTP con la configuración habilitada `send_progress_in_http_headers`. Devuelve la información habitual de X-ClickHouse-Progress, con información adicional como cuántas filas y bytes se insertaron en la consulta. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Mejora {#improvements} + +- Añadir `max_parts_in_total` configuración para la familia de tablas MergeTree (predeterminado: 100 000) que evita la especificación insegura de la clave de partición \# 5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-obfuscator`: derivar la semilla para columnas individuales combinando la semilla inicial con el nombre de la columna, no la posición de la columna. Esto está destinado a transformar conjuntos de datos con varias tablas relacionadas, de modo que las tablas permanezcan JOINable después de la transformación. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Funciones añadidas `JSONExtractRaw`, `JSONExtractKeyAndValues`. Funciones renombradas `jsonExtract` a `JSONExtract`. Cuando algo sale mal, estas funciones devuelven los valores correspondientes, no `NULL`. Función modificada `JSONExtract`, ahora obtiene el tipo de devolución de su último parámetro y no inyecta nullables. Implementado de respaldo a RapidJSON en caso de que las instrucciones AVX2 no estén disponibles. Biblioteca Simdjson actualizado a una nueva versión. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ahora `if` y `multiIf` funciones no dependen de la condición `Nullable`, pero confíe en las ramas para la compatibilidad sql. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu](https://github.com/janplus)) +- `In` predicado ahora genera `Null` resultado de `Null` entrada como el `Equal` función. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu](https://github.com/janplus)) +- Verifique el límite de tiempo cada (flush\_interval / poll\_timeout) número de filas de Kafka. Esto permite romper la lectura del consumidor de Kafka con más frecuencia y verificar los límites de tiempo para las transmisiones de nivel superior [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([Ivan](https://github.com/abyss7)) +- Enlace rdkafka con SASL incluido. Debería permitir el uso de autenticación SASL SCRAM [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([Ivan](https://github.com/abyss7)) +- Versión por lotes de RowRefList para TODAS LAS UNIONES. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) +- clickhouse-server: mensajes de error de escucha más informativos. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([propulsor](https://github.com/proller)) +- Diccionarios de soporte en clickhouse-copiadora para funciones en `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([propulsor](https://github.com/proller)) +- Añadir nueva configuración `kafka_commit_every_batch` para regular Kafka cometer política. + Permite establecer el modo de confirmación: después de que se maneje cada lote de mensajes, o después de que se escriba todo el bloque en el almacenamiento. Es una compensación entre perder algunos mensajes o leerlos dos veces en algunas situaciones extremas. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([Ivan](https://github.com/abyss7)) +- Hacer `windowFunnel` soporta otros tipos de enteros sin firmar. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([Sundyli](https://github.com/sundy-li)) +- Permitir sombrear la columna virtual `_table` en el motor de fusión. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([Ivan](https://github.com/abyss7)) +- Hacer `sequenceMatch` Las funciones de agregado admiten otros tipos de enteros sin signo [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([Sundyli](https://github.com/sundy-li)) +- Mejores mensajes de error si la suma de comprobación no coincide probablemente es causada por fallas de hardware. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Compruebe que las tablas subyacentes admiten `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([Ivan](https://github.com/abyss7)) +- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Mejoras de MySQL Wire Protocol. Se ha cambiado el nombre del formato a MySQLWire. Usando RAII para llamar a RSA\_free. Deshabilitar SSL si no se puede crear contexto. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) +- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([propulsor](https://github.com/proller)) +- Respete la configuración de consulta en INSERT asincrónicos en tablas distribuidas. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([Método de codificación de datos:](https://github.com/TCeason)) +- Funciones renombradas `leastSqr` a `simpleLinearRegression`, `LinearRegression` a `linearRegression`, `LogisticRegression` a `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Mejoras De Rendimiento {#performance-improvements} + +- Paralelice el procesamiento de partes de tablas MergeTree no replicadas en la consulta ALTER MODIFY. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) +- Optimizaciones en la extracción de expresiones regulares. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Más información](https://github.com/danlark1)) +- No agregue la columna de clave de unión correcta para unir el resultado si solo se usa en la sección join on . [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) +- Congele el búfer Kafka después de la primera respuesta vacía. Evita múltiples invocaciones de `ReadBuffer::next()` para el resultado vacío en algunas secuencias de análisis de filas. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([Ivan](https://github.com/abyss7)) +- `concat` optimización de funciones para múltiples argumentos. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Más información](https://github.com/danlark1)) +- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) +- Actualice nuestra implementación LZ4 con la referencia uno para tener una descompresión más rápida. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Más información](https://github.com/danlark1)) +- Implementado MSD radix ordenar (basado en kxsort), y la clasificación parcial. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) + +#### Corrección De Errores {#bug-fixes} + +- Fix push requiere columnas con unión [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Invierno Zhang](https://github.com/zhang2014)) +- Corregido error, cuando ClickHouse es ejecutado por systemd, el comando `sudo service clickhouse-server forcerestart` no funcionaba como se esperaba. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([propulsor](https://github.com/proller)) +- Corregir los códigos de error http en DataPartsExchange (el servidor http deinterserver en el puerto 9009 siempre devolvió el código 200, incluso en errores). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([propulsor](https://github.com/proller)) +- Repara SimpleAggregateFunction para String más largo que MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) +- Corregir error para `Decimal` a `Nullable(Decimal)` conversión en IN. Admite otras conversiones de decimales a decimales (incluidas diferentes escalas). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió el clobbering de FPU en la biblioteca simdjson que conducía a un cálculo incorrecto de `uniqHLL` y `uniqCombined` función agregada y funciones matemáticas tales como `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el manejo de casos mixtos const / nonconst en funciones JSON. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fijar `retention` función. Ahora todas las condiciones que cumplen en una fila de datos se agregan al estado de datos. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) +- Corregir el tipo de resultado para `quantileExact` con decimales. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Documentación {#documentation} + +- Traducir documentación para `CollapsingMergeTree` a chino. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) +- Traduzca alguna documentación sobre motores de mesa al chino. + [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) + [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) + ([nunca lee](https://github.com/neverlee)) + +#### Mejoras De compilación / Prueba / Empaquetado {#buildtestingpackaging-improvements} + +- Corrija algunos informes de desinfectantes que muestran un uso probable después de liberar.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([Ivan](https://github.com/abyss7)) +- Mueva las pruebas de rendimiento fuera de directorios separados para mayor comodidad. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir pruebas de rendimiento incorrectas. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) +- Se agregó una herramienta para calcular las sumas de comprobación causadas por los saltos de bits para depurar problemas de hardware. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hacer script corredor más utilizable. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) +- Agregue pequeñas instrucciones sobre cómo escribir pruebas de rendimiento. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) +- Añadir capacidad para hacer sustituciones en crear, llenar y soltar consulta en las pruebas de rendimiento [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) + +## Lanzamiento De ClickHouse 19.7 {#clickhouse-release-19-7} + +### Lanzamiento De ClickHouse 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} + +#### Corrección De Errores {#bug-fix-25} + +- Corregir la regresión de rendimiento en algunas consultas con JOIN. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Invierno Zhang](https://github.com/zhang2014)) + +### Lanzamiento De ClickHouse 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} + +#### Novedad {#new-features-1} + +- Se agregaron funciones relacionadas con el mapa de bits `bitmapHasAny` y `bitmapHasAll` análogo a `hasAny` y `hasAll` funciones para matrices. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) + +#### Corrección De Errores {#bug-fixes-1} + +- Arreglar segfault en `minmax` ÍNDICE con valor nulo. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) +- Marque todas las columnas de entrada en LIMIT BY como salida requerida. Se fija ‘Not found column’ error en algunas consultas distribuidas. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) +- Fijar “Column ‘0’ already exists” error en `SELECT .. PREWHERE` en la columna con DEFAULT [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([propulsor](https://github.com/proller)) +- Fijar `ALTER MODIFY TTL` consulta sobre `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) +- No bloquee el servidor cuando los consumidores de Kafka no se hayan iniciado. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([Ivan](https://github.com/abyss7)) +- Las funciones de mapa de bits fijas producen un resultado incorrecto. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Cristina Andrés](https://github.com/andyyzh)) +- Fix element\_count para el diccionario hash (no incluye duplicados) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) +- Utilice el contenido de la variable de entorno TZ como el nombre de la zona horaria. Ayuda a detectar correctamente la zona horaria predeterminada en algunos casos.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) +- No intente convertir enteros en `dictGetT` funciones, porque no funciona correctamente. Lanza una excepción en su lugar. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Corregir la configuración en la solicitud HTTP ExternalData. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila + Kutenin](https://github.com/danlark1)) +- Corregir un error cuando las piezas se eliminaron solo de FS sin dejarlas caer de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- Fijar falla de segmentación en `bitmapHasAny` función. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Se corrigió el error cuando el grupo de conexiones de replicación no vuelve a intentar resolver el host, incluso cuando se eliminó la caché DNS. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- Fijo `DROP INDEX IF EXISTS` consulta. Ahora `ALTER TABLE ... DROP INDEX IF EXISTS ...` query no genera una excepción si el índice proporcionado no existe. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Corregir unión toda la columna de supertipo. Hubo casos con datos inconsistentes y tipos de columnas de columnas resultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- Omita ZNONODE durante el procesamiento de consultas DDL. Antes, si otro nodo elimina el znode en la cola de tareas, el que + no lo procesó, pero ya obtuvo la lista de hijos, terminará el hilo DDLWorker. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Fije INSERT en la tabla Distributed () con la columna MATERIALIZED. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) + +### Lanzamiento De ClickHouse 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} + +#### Novedad {#new-features-2} + +- Permite limitar el rango de una configuración que puede especificar el usuario. + Estas restricciones se pueden configurar en el perfil de configuración del usuario. + [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly + Baranov](https://github.com/vitlibar)) +- Añadir una segunda versión de la función `groupUniqArray` con una opción + `max_size` parámetro que limita el tamaño de la matriz resultante. Este + comportamiento es similar a `groupArray(max_size)(x)` función. + [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- Para los formatos de archivo de entrada TSVWithNames/CSVWithNames, el orden de columnas ahora puede ser + determinado a partir del encabezado del archivo. Esto es controlado por + `input_format_with_names_use_header` parámetro. + [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) + ([Alejandro](https://github.com/Akazz)) + +#### Corrección De Errores {#bug-fixes-2} + +- Bloqueo con sin comprimir\_cache + JOIN durante la fusión (\# 5197) + [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila + Kutenin](https://github.com/danlark1)) +- Error de segmentación en una consulta de clickhouse-cliente a tablas del sistema. \#5066 + [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) + ([Ivan](https://github.com/abyss7)) +- Pérdida de datos en carga pesada a través de KafkaEngine (\#4736) + [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) + ([Ivan](https://github.com/abyss7)) +- Se corrigió una condición de carrera de datos muy rara que podría ocurrir al ejecutar una consulta con UNION ALL que involucraba al menos dos SELECT del sistema.columnas, sistema.mesas, sistema.partes, sistema.parts\_tables o tablas de la familia Merge y realizar ALTER de columnas de las tablas relacionadas simultáneamente. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejoras De Rendimiento {#performance-improvements-1} + +- Utilice la clasificación de radix para ordenar por una sola columna numérica en `ORDER BY` sin + `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), + [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) + ([Evgenii Pravda](https://github.com/kvinty), + [alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Documentación {#documentation-1} + +- Traduzca la documentación de algunos motores de tabla al chino. + [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), + [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), + [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) + ([张风啸](https://github.com/AlexZFX)), + [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([nunca + Sotavento](https://github.com/neverlee)) + +#### Mejoras De compilación / Prueba / Empaquetado {#buildtestingpackaging-improvements-1} + +- Imprima los caracteres UTF-8 correctamente en `clickhouse-test`. + [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregar parámetro de línea de comandos para clickhouse-cliente para cargar siempre la sugerencia + datos. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Resuelva algunas de las advertencias de PVS-Studio. + [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualizar LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila + Kutenin](https://github.com/danlark1)) +- Agregue gperf a los requisitos de compilación para la próxima solicitud de extracción \# 5030. + [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) + ([propulsor](https://github.com/proller)) + +## Lanzamiento De ClickHouse 19.6 {#clickhouse-release-19-6} + +### Lanzamiento De ClickHouse 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} + +#### Corrección De Errores {#bug-fixes-3} + +- Fijo IN condición pushdown para consultas de funciones de tabla `mysql` y `odbc` y los correspondientes motores de mesa. Esto corrige \# 3540 y \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir el punto muerto en Zookeeper. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) +- Permitir decimales citados en CSV. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) +- No permitir la conversión de float Inf / NaN en Decimales (excepción de lanzamiento). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) +- Corregir la carrera de datos en la consulta de cambio de nombre. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([Invierno Zhang](https://github.com/zhang2014)) +- Deshabilitar temporalmente LFAlloc. El uso de LFAlloc puede conducir a una gran cantidad de MAP\_FAILED en la asignación de UncompressedCache y, como resultado, a bloqueos de consultas en servidores de alta carga. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Más información](https://github.com/danlark1)) + +### Lanzamiento De ClickHouse 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} + +#### Novedad {#new-features-3} + +- Expresiones TTL para columnas y tablas. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) +- Añadido soporte para `brotli` compresión para respuestas HTTP (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mijaíl](https://github.com/fandyushin)) +- Se agregó una nueva función `isValidUTF8` para verificar si un conjunto de bytes está codificado correctamente en utf-8. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Más información](https://github.com/danlark1)) +- Agregar nueva directiva de equilibrio de carga `first_or_random` que envía consultas al primer host especificado y, si es inaccesible, envía consultas a hosts aleatorios de fragmento. Útil para configuraciones de topología de replicación cruzada. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) + +#### Experimental Características {#experimental-features-1} + +- Añadir ajuste `index_granularity_bytes` (granularidad de índice adaptativo) para la familia de tablas MergeTree\*. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) + +#### Mejora {#improvements-1} + +- Se agregó soporte para argumentos de tamaño y longitud no constantes y negativos para la función `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Deshabilite el push-down a la tabla derecha en la unión izquierda, la tabla izquierda en la unión derecha y ambas tablas en unión completa. Esto corrige los resultados JOIN incorrectos en algunos casos. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([Ivan](https://github.com/abyss7)) +- `clickhouse-copier`: configuración de tareas de carga automática desde `--task-file` opcion [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([propulsor](https://github.com/proller)) +- Se agregó el controlador de errores tipográficos para la fábrica de almacenamiento y la fábrica de funciones de tabla. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Más información](https://github.com/danlark1)) +- Admite asteriscos y asteriscos calificados para combinaciones múltiples sin subconsultas [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) +- Haga que el mensaje de error de columna faltante sea más fácil de usar. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Mejoras De Rendimiento {#performance-improvements-2} + +- Aceleración significativa de ASOF JOIN [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) + +#### Cambios Incompatibles Hacia atrás {#backward-incompatible-changes} + +- Encabezado HTTP `Query-Id` fue renombrado a `X-ClickHouse-Query-Id` para la consistencia. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mijaíl](https://github.com/fandyushin)) + +#### Corrección De Errores {#bug-fixes-4} + +- Se corrigió la desreferencia del puntero nulo potencial en `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([propulsor](https://github.com/proller)) +- Se corrigió el error en la consulta con JOIN + ARRAY JOIN [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió el inicio del servidor cuando un diccionario depende de otro diccionario a través de una base de datos con motor = Diccionario. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) +- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) +- Repara el resultado potencialmente incorrecto para `SELECT DISTINCT` con `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió una condición de carrera de datos muy rara que podría ocurrir al ejecutar una consulta con UNION ALL que involucraba al menos dos SELECT del sistema.columnas, sistema.mesas, sistema.partes, sistema.parts\_tables o tablas de la familia Merge y realizar ALTER de columnas de las tablas relacionadas simultáneamente. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejoras De compilación / Prueba / Empaquetado {#buildtestingpackaging-improvements-2} + +- Se corrigieron errores de prueba al ejecutar clickhouse-server en un host diferente [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) +- clickhouse-test: deshabilita las secuencias de control de color en un entorno no tty. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) +- clickhouse-test: Permitir el uso de cualquier base de datos de prueba (eliminar `test.` calificación donde sea posible) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([propulsor](https://github.com/proller)) +- Corregir errores de ubsan [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Yandex LFAlloc se agregó a ClickHouse para asignar datos de MarkCache y UncompressedCache de diferentes maneras para detectar segfaults más confiables [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Más información](https://github.com/danlark1)) +- Python utiliza para ayudar con backports y registros de cambios. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([Ivan](https://github.com/abyss7)) + +## Lanzamiento De ClickHouse 19.5 {#clickhouse-release-19-5} + +### Lanzamiento De ClickHouse 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} + +#### Corrección De Errores {#bug-fixes-5} + +- Se corrigió un posible bloqueo en las funciones de mapa de bits \* [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Cristina Andrés](https://github.com/andyyzh)) +- Se corrigió una condición de carrera de datos muy rara que podría ocurrir al ejecutar una consulta con UNION ALL que involucraba al menos dos SELECT del sistema.columnas, sistema.mesas, sistema.partes, sistema.parts\_tables o tablas de la familia Merge y realizar ALTER de columnas de las tablas relacionadas simultáneamente. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Error fijo `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. Este error ocurrió si la columna LowCardinality era la parte de la clave principal. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Modificación de la función de retención: si una fila satisface la primera condición y la NTH, solo se agrega la primera condición satisfecha al estado de datos. Ahora todas las condiciones que cumplen en una fila de datos se agregan al estado de datos. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) + +### Lanzamiento De ClickHouse 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} + +#### Corrección De Errores {#bug-fixes-6} + +- Tipo fijo de ajuste `max_partitions_per_insert_block` de booleano a UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Más información](https://github.com/mhsekhavat)) + +### Lanzamiento De ClickHouse 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} + +#### Novedad {#new-features-4} + +- [Hyperscan](https://github.com/intel/hyperscan) Se agregó múltiples coincidencias de expresiones regulares (funciones `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Más información](https://github.com/danlark1)) +- `multiSearchFirstPosition` se añadió la función. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Más información](https://github.com/danlark1)) +- Implemente el filtro de expresión predefinido por fila para las tablas. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([Ivan](https://github.com/abyss7)) +- Un nuevo tipo de índices de omisión de datos basados en filtros de floración (se puede usar para `equal`, `in` y `like` función). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) +- Añadir `ASOF JOIN` que permite ejecutar consultas que se unen al valor más reciente conocido. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) +- Reescribir múltiples `COMMA JOIN` a `CROSS JOIN`. Luego reescribirlos para `INNER JOIN` si es posible. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Mejora {#improvement-9} + +- `topK` y `topKWeighted` ahora soporta personalizado `loadFactor` (soluciona el problema [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) +- Permitir usar `parallel_replicas_count > 1` incluso para tablas sin muestreo (la configuración simplemente se ignora para ellas). En versiones anteriores fue conducido a la excepción. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) +- Soporte para `CREATE OR REPLACE VIEW`. Permite crear una vista o establecer una nueva definición en una sola instrucción. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) +- `Buffer` motor de mesa ahora soporta `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Información adicional](https://github.com/LiuYangkuan)) +- Agregue la capacidad de iniciar una tabla replicada sin metadatos en zookeeper en `readonly` modo. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) +- Parpadeo fijo de la barra de progreso en clickhouse-cliente. El problema fue más notable al usar `FORMAT Null` con consultas de streaming. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Permitir deshabilitar funciones con `hyperscan` biblioteca por usuario para limitar el uso de recursos potencialmente excesivo e incontrolado. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregue el registro del número de versión en todos los errores. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([propulsor](https://github.com/proller)) +- Se agregó restricción a la `multiMatch` funciones que requieren tamaño de cadena para encajar en `unsigned int`. También se agregó el número de límite de argumentos al `multiSearch` función. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Más información](https://github.com/danlark1)) +- Uso mejorado del espacio de arañazos y manejo de errores en Hyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Más información](https://github.com/danlark1)) +- Llenar `system.graphite_detentions` de una configuración de tabla de `*GraphiteMergeTree` mesas de motores. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Cambiar nombre `trigramDistance` función para `ngramDistance` y añadir más funciones con `CaseInsensitive` y `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Más información](https://github.com/danlark1)) +- Cálculo de índices de saltos de datos mejorado. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) +- Mantener ordinario, `DEFAULT`, `MATERIALIZED` y `ALIAS` columnas en una sola lista (soluciona el problema [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Método de codificación de datos:](https://github.com/ztlpn)) + +#### Corrección De Errores {#bug-fix-26} + +- Evitar `std::terminate` en caso de error de asignación de memoria. Ahora `std::bad_alloc` excepción se lanza como se esperaba. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corrige la lectura de capnproto desde el búfer. A veces, los archivos no se cargaron correctamente por HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Corregir error `Unknown log entry type: 0` despues `OPTIMIZE TABLE FINAL` consulta. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos pájaro](https://github.com/amosbird)) +- Argumentos erróneos para `hasAny` o `hasAll` funciones pueden conducir a segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Puede producirse un punto muerto durante la ejecución `DROP DATABASE dictionary` consulta. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Repara el comportamiento indefinido en `median` y `quantile` función. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([Hcz](https://github.com/hczhcz)) +- Corregir la detección de nivel de compresión cuando `network_compression_method` en minúsculas. Roto en v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([propulsor](https://github.com/proller)) +- Se corrigió la ignorancia de `UTC` ajuste (soluciona el problema [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([propulsor](https://github.com/proller)) +- Fijar `histogram` comportamiento de la función con `Distributed` tabla. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- Informe tsan fijo `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el informe de TSan sobre el cierre debido a la condición de carrera en el uso de registros del sistema. Se corrigió el uso potencial después de liberar al apagar cuando part\_log está habilitado. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar las piezas de nuevo control en `ReplicatedMergeTreeAlterThread` en caso de error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Las operaciones aritméticas en estados de función de agregado intermedios no funcionaban para argumentos constantes (como los resultados de subconsulta). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Siempre retroceda los nombres de las columnas en los metadatos. De lo contrario, es imposible crear una tabla con una columna llamada `index` (el servidor no se reiniciará debido a `ATTACH` consulta en metadatos). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix crash en `ALTER ... MODIFY ORDER BY` en `Distributed` tabla. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Método de codificación de datos:](https://github.com/TCeason)) +- Arreglar segfault en `JOIN ON` con habilitado `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Invierno Zhang](https://github.com/zhang2014)) +- Corregir un error al agregar una fila extraña después de consumir un mensaje protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corregir el bloqueo de `JOIN` no aceptan vs columna que acepta valores null. Fijar `NULLs` en las teclas de la derecha en `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) +- Condición de carrera fija en `SELECT` de `system.tables` si la tabla se cambia de nombre o se modifica simultáneamente. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la carrera de datos al obtener una parte de datos que ya está obsoleta. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la carrera de datos raros que puede ocurrir durante `RENAME` tabla de la familia MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fallo de segmentación fijo en la función `arrayIntersect`. La falla de segmentación podría ocurrir si se llamara a la función con argumentos constantes y ordinarios mixtos. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix crash en `FULL/RIGHT JOIN` cuando nos unimos en nullable vs no nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijar `No message received` excepción al recuperar partes entre réplicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- Fijo `arrayIntersect` resultado incorrecto de la función en caso de varios valores repetidos en una sola matriz. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir una condición de carrera durante `ALTER COLUMN` consultas que podrían provocar un bloqueo del servidor (soluciona el problema [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Corregir el resultado incorrecto en `FULL/RIGHT JOIN` con la columna const. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) +- Reparar duplicados en `GLOBAL JOIN` con asterisk. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) +- Corregir la deducción de parámetros en `ALTER MODIFY` de la columna `CODEC` cuando no se especifica el tipo de columna. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- Función `cutQueryStringAndFragment()` y `queryStringAndFragment()` ahora funciona correctamente cuando `URL` contiene un fragmento y ninguna consulta. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corregir un error raro al configurar `min_bytes_to_use_direct_io` es mayor que cero, lo que ocurre cuando el hilo tiene que buscar hacia atrás en el archivo de columna. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- Corregir tipos de argumentos incorrectos para funciones agregadas con `LowCardinality` argumentos (soluciona el problema [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir la calificación de nombre incorrecto en `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijar la función `toISOWeek` resultado para el año 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar `DROP`, `TRUNCATE` y `OPTIMIZE` duplicación de consultas, cuando se ejecuta en `ON CLUSTER` para `ReplicatedMergeTree*` tablas de la familia. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-8} + +- Cambiar el nombre de la configuración `insert_sample_with_metadata` establecer `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadido `max_partitions_per_insert_block` (con valor 100 por defecto). Si el bloque insertado contiene un mayor número de particiones, se lanza una excepción. Establezca en 0 si desea eliminar el límite (no recomendado). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se renombraron las funciones de búsqueda múltiple (`multiPosition` a `multiSearchAllPositions`, `multiSearch` a `multiSearchAny`, `firstMatch` a `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Más información](https://github.com/danlark1)) + +#### Mejora Del Rendimiento {#performance-improvement-6} + +- Optimice el buscador Volnitsky al alinear, dando aproximadamente un 5-10% de mejora de búsqueda para consultas con muchas agujas o muchos bigrams similares. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Más información](https://github.com/danlark1)) +- Solucionar problema de rendimiento al configurar `use_uncompressed_cache` es mayor que cero, que apareció cuando todos los datos leídos contenidos en la memoria caché. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-10} + +- Endurecimiento de la compilación de depuración: más asignaciones de memoria granulares y ASLR; agregue protección de memoria para caché de marcas e índice. Esto permite encontrar más errores de memoria en caso de que ASan y MSan no puedan hacerlo. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir soporte para variables cmake `ENABLE_PROTOBUF`, `ENABLE_PARQUET` y `ENABLE_BROTLI` que permite habilitar / deshabilitar las características anteriores (lo mismo que podemos hacer para librdkafka, mysql, etc.). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) +- Agregue la capacidad de imprimir la lista de procesos y los rastros de pila de todos los hilos si algunas consultas se cuelgan después de la ejecución de la prueba. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) +- Agregar reintentos en `Connection loss` error en `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) +- Agregue freebsd build con vagrant y compile con desinfectante de hilos al script del empaquetador. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) +- Ahora el usuario pidió contraseña para el usuario `'default'` durante la instalación. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([propulsor](https://github.com/proller)) +- Suprimir advertencia en `rdkafka` biblioteca. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Permitir la capacidad de construir sin ssl. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([propulsor](https://github.com/proller)) +- Agregar una forma de iniciar clickhouse-servidor de la imagen de un usuario personalizado. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Actualice el impulso de contrib a 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([propulsor](https://github.com/proller)) +- Deshabilitar el uso de `mremap` cuando se compila con Thread Sanitizer. Sorprendentemente, TSan no intercepta `mremap` (aunque intercepta `mmap`, `munmap`) que conduce a falsos positivos. Informe TSan fijo en pruebas con estado. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregue comprobación de prueba usando el esquema de formato a través de la interfaz HTTP. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) + +## Lanzamiento De ClickHouse 19.4 {#clickhouse-release-19-4} + +### Lanzamiento De ClickHouse 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} + +#### Corrección De Errores {#bug-fixes-7} + +- Evitar `std::terminate` en caso de error de asignación de memoria. Ahora `std::bad_alloc` excepción se lanza como se esperaba. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corrige la lectura de capnproto desde el búfer. A veces, los archivos no se cargaron correctamente por HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Corregir error `Unknown log entry type: 0` despues `OPTIMIZE TABLE FINAL` consulta. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos pájaro](https://github.com/amosbird)) +- Argumentos erróneos para `hasAny` o `hasAll` funciones pueden conducir a segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Puede producirse un punto muerto durante la ejecución `DROP DATABASE dictionary` consulta. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Repara el comportamiento indefinido en `median` y `quantile` función. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([Hcz](https://github.com/hczhcz)) +- Corregir la detección de nivel de compresión cuando `network_compression_method` en minúsculas. Roto en v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([propulsor](https://github.com/proller)) +- Se corrigió la ignorancia de `UTC` ajuste (soluciona el problema [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([propulsor](https://github.com/proller)) +- Fijar `histogram` comportamiento de la función con `Distributed` tabla. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([Olegkv](https://github.com/olegkv)) +- Informe tsan fijo `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el informe de TSan sobre el cierre debido a la condición de carrera en el uso de registros del sistema. Se corrigió el uso potencial después de liberar al apagar cuando part\_log está habilitado. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar las piezas de nuevo control en `ReplicatedMergeTreeAlterThread` en caso de error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Las operaciones aritméticas en estados de función de agregado intermedios no funcionaban para argumentos constantes (como los resultados de subconsulta). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Siempre retroceda los nombres de las columnas en los metadatos. De lo contrario es imposible crear una tabla con una columna denominada `index` (el servidor no se reiniciará debido a `ATTACH` consulta en metadatos). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix crash en `ALTER ... MODIFY ORDER BY` en `Distributed` tabla. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Método de codificación de datos:](https://github.com/TCeason)) +- Arreglar segfault en `JOIN ON` con habilitado `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Invierno Zhang](https://github.com/zhang2014)) +- Corregir un error al agregar una fila extraña después de consumir un mensaje protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) +- Condición de carrera fija en `SELECT` de `system.tables` si la tabla se cambia de nombre o se modifica simultáneamente. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la carrera de datos al obtener una parte de datos que ya está obsoleta. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la carrera de datos raros que puede ocurrir durante `RENAME` tabla de la familia MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fallo de segmentación fijo en la función `arrayIntersect`. La falla de segmentación podría ocurrir si se llamara a la función con argumentos constantes y ordinarios mixtos. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fijar `No message received` excepción al recuperar partes entre réplicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- Fijo `arrayIntersect` resultado incorrecto de la función en caso de varios valores repetidos en una sola matriz. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir una condición de carrera durante `ALTER COLUMN` consultas que podrían provocar un bloqueo del servidor (soluciona el problema [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Corregir la deducción de parámetros en `ALTER MODIFY` de la columna `CODEC` cuando no se especifica el tipo de columna. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- Función `cutQueryStringAndFragment()` y `queryStringAndFragment()` ahora funciona correctamente cuando `URL` contiene un fragmento y ninguna consulta. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corregir un error raro al configurar `min_bytes_to_use_direct_io` es mayor que cero, lo que ocurre cuando el hilo tiene que buscar hacia atrás en el archivo de columna. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- Corregir tipos de argumentos incorrectos para funciones agregadas con `LowCardinality` argumentos (soluciona el problema [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fijar la función `toISOWeek` el resultado para el año 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar `DROP`, `TRUNCATE` y `OPTIMIZE` duplicación de consultas, cuando se ejecuta en `ON CLUSTER` para `ReplicatedMergeTree*` tablas de la familia. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### Mejora {#improvements-2} + +- Mantener ordinario, `DEFAULT`, `MATERIALIZED` y `ALIAS` columnas en una sola lista (soluciona el problema [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Método de codificación de datos:](https://github.com/ztlpn)) + +### Lanzamiento De ClickHouse 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} + +#### Corrección De Errores {#bug-fixes-8} + +- Fix crash en `FULL/RIGHT JOIN` cuando nos unimos en nullable vs no nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-11} + +- Agregue una forma de iniciar una imagen de clickhouse-server desde un usuario personalizado. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### Lanzamiento De ClickHouse 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} + +#### Corrección De Errores {#bug-fixes-9} + +- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### Lanzamiento De ClickHouse 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} + +#### Corrección De Errores {#bug-fixes-10} + +- Consultas remotas fijas que contienen ambos `LIMIT BY` y `LIMIT`. Anteriormente, si `LIMIT BY` y `LIMIT` se utilizaron para la consulta remota, `LIMIT` podría pasar antes `LIMIT BY`, cuál llevó al resultado demasiado filtrado. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) + +### Lanzamiento De ClickHouse 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} + +#### Novedad {#new-features-5} + +- Se agregó soporte completo para `Protobuf` formato (entrada y salida, estructuras de datos anidadas). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) +- Se agregaron funciones de mapa de bits con mapas de bits rugientes. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Cristina Andrés](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) +- Soporte de formato de parquet. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([propulsor](https://github.com/proller)) +- Se agregó una distancia de N-gramo para la comparación de cadenas difusas. Es similar a las métricas de q-gram en el lenguaje R. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Más información](https://github.com/danlark1)) +- Combine reglas para el paquete acumulativo de grafito a partir de patrones de agregación y retención dedicados. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Añadir `max_execution_speed` y `max_execution_speed_bytes` para limitar el uso de recursos. Añadir `min_execution_speed_bytes` para complementar el `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([Invierno Zhang](https://github.com/zhang2014)) +- Función implementada `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [Kzon](https://github.com/kzon)) +- Funciones añadidas `arrayEnumerateDenseRanked` y `arrayEnumerateUniqRanked` (es como `arrayEnumerateUniq` pero permite ajustar la profundidad de la matriz para mirar dentro de las matrices multidimensionales). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([propulsor](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Corrección De Errores {#bug-fixes-11} + +- Esta versión también contiene todas las correcciones de errores de 19.3 y 19.1. +- Se corrigió un error en los índices de omisión de datos: el orden de los gránulos después de INSERTAR era incorrecto. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) +- Fijo `set` índice de `Nullable` y `LowCardinality` columna. Antes de eso, `set` índice con `Nullable` o `LowCardinality` columna llevó a error `Data type must be deserialized with multiple streams` mientras se selecciona. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Establecer correctamente update\_time en completo `executable` actualización del diccionario. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) +- Arreglar la barra de progreso rota en 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) +- Se corrigieron los valores inconsistentes de MemoryTracker cuando se redujo la región de la memoria, en ciertos casos. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Comportamiento indefinido fijo en ThreadPool. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió un accidente muy raro con el mensaje `mutex lock failed: Invalid argument` eso podría suceder cuando una tabla MergeTree se eliminó simultáneamente con un SELECT. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Compatibilidad del controlador ODBC con `LowCardinality` tipo de datos. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([propulsor](https://github.com/proller)) +- FreeBSD: Arreglo para `AIOcontextPool: Found io_event with unknown id 0` error. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `system.part_log` se creó independientemente de la configuración. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Repara el comportamiento indefinido en `dictIsIn` función para los diccionarios de caché. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) +- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Deshabilite compile\_expressions de forma predeterminada hasta que obtengamos el propio `llvm` contrib y puede probarlo con `clang` y `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) +- Prevenir `std::terminate` cuando `invalidate_query` para `clickhouse` fuente de diccionario externo ha devuelto un conjunto de resultados incorrecto (vacío o más de una fila o más de una columna). Solucionado el problema cuando `invalidate_query` se realizó cada cinco segundos independientemente de la `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evite el punto muerto cuando `invalidate_query` para un diccionario con `clickhouse` fuente estaba involucrando `system.dictionaries` mesa o `Dictionaries` base de datos (caso raro). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Correcciones para CROSS JOIN con WHERE vacío. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) +- Segfault fijo en la función “replicate” cuando se pasa el argumento constante. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Repara la función lambda con el optimizador de predicados. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([Invierno Zhang](https://github.com/zhang2014)) +- Múltiples JOINs múltiples correcciones. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Mejora {#improvements-3} + +- Soporte alias en la sección JOIN ON para columnas de la tabla derecha. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) +- El resultado de múltiples JOIN necesita nombres de resultados correctos para ser utilizados en subselecciones. Reemplace los alias planos con nombres de origen en el resultado. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) +- Mejorar la lógica push-down para sentencias unidas. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([Ivan](https://github.com/abyss7)) + +#### Mejoras De Rendimiento {#performance-improvements-3} + +- Heurística mejorada de “move to PREWHERE” optimización. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Use tablas de búsqueda adecuadas que usen la API de HashTable para claves de 8 bits y 16 bits. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos pájaro](https://github.com/amosbird)) +- Mejora del rendimiento de la comparación de cadenas. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Limpie la cola DDL distribuida en un subproceso separado para que no ralentice el bucle principal que procesa las tareas DDL distribuidas. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Cuando `min_bytes_to_use_direct_io` se establece en 1, no todos los archivos se abrieron con el modo O\_DIRECT porque el tamaño de los datos a leer a veces se subestimó por el tamaño de un bloque comprimido. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-12} + +- Se agregó soporte para clang-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Arreglar mal `__asm__` instrucciones (de nuevo) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) +- Añadir capacidad para especificar la configuración para `clickhouse-performance-test` desde la línea de comandos. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) +- Agregue pruebas de diccionarios a las pruebas de integración. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) +- Se agregaron consultas desde el punto de referencia en el sitio web a pruebas de rendimiento automatizadas. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `xxhash.h` no existe en lz4 externo porque es un detalle de implementación y sus símbolos tienen un espacio de nombres con `XXH_NAMESPACE` macro. Cuando lz4 es externo, xxHash también tiene que ser externo, y los dependientes tienen que vincularlo. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Películas De Sexo](https://github.com/orivej)) +- Se corrigió un caso cuando `quantileTiming` se puede llamar a la función de agregado con argumento de punto negativo o flotante (esto corrige la prueba de fuzz con un desinfectante de comportamiento indefinido). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corrección de errores de ortografía. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) +- Corregir la compilación en Mac. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) +- Construir correcciones para FreeBSD y varias configuraciones de compilación inusuales. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([propulsor](https://github.com/proller)) + +## Lanzamiento De ClickHouse 19.3 {#clickhouse-release-19-3} + +### Lanzamiento De ClickHouse 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} + +#### Corrección De Errores {#bug-fixes-12} + +- Fix crash en `FULL/RIGHT JOIN` cuando nos unimos en nullable vs no nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) +- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-13} + +- Agregar una forma de iniciar clickhouse-servidor de la imagen de un usuario personalizada [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### Lanzamiento De ClickHouse 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} + +#### Corrección De Errores {#bug-fixes-13} + +- Corregido el error en \# 3920. Este error se manifiesta como corrupción de caché aleatoria (mensajes `Unknown codec family code`, `Cannot seek through file`) y segfaults. Este error apareció por primera vez en la versión 19.1 y está presente en las versiones hasta 19.1.10 y 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} + +#### Corrección De Errores {#bug-fixes-14} + +- Cuando hay más de 1000 subprocesos en un grupo de subprocesos, `std::terminate` puede suceder en la salida del hilo. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora es posible crear `ReplicatedMergeTree*` tablas con comentarios sobre columnas sin valores predeterminados y tablas con códecs de columnas sin comentarios y valores predeterminados. También corrige la comparación de códecs. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) +- Se corrigió el fallo en JOIN con matriz o tupla. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió el fallo en el clickhouse-copiadora con el mensaje `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió el bloqueo en el cierre del servidor si se usaban DDL distribuidos. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Se imprimieron números de columna incorrectos en un mensaje de error sobre el análisis de formato de texto para columnas con un número mayor que 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejoras De compilación / Prueba / Empaquetado {#buildtestingpackaging-improvements-3} + +- Compilación fija con AVX habilitado. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Habilite la contabilidad extendida y la contabilidad IO basada en una versión buena conocida en lugar del kernel bajo el cual se compila. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) +- Permitir omitir la configuración de core\_dump.size\_limit, advertencia en lugar de lanzar si el conjunto de límites falla. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([propulsor](https://github.com/proller)) +- Eliminado el `inline` etiquetas de `void readBinary(...)` en `Field.cpp`. También se fusionó redundante `namespace DB` bloque. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([Hcz](https://github.com/hczhcz)) + +### Lanzamiento De ClickHouse 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} + +#### Corrección De Errores {#bug-fixes-15} + +- Se corrigió un error con el procesamiento de grandes consultas de inserción http. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) +- Se corrigió la incompatibilidad hacia atrás con versiones antiguas debido a una implementación incorrecta de `send_logs_level` configuración. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Incompatibilidad hacia atrás fija de la función de la tabla `remote` introducido con comentarios de columna. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} + +#### Mejora {#improvements-4} + +- El tamaño del índice de tabla no se tiene en cuenta los límites de memoria al hacer `ATTACH TABLE` consulta. Evitó la posibilidad de que una tabla no se pueda adjuntar después de haber sido separada. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Levantó ligeramente el límite en el tamaño máximo de cadena y matriz recibido de ZooKeeper. Permite continuar trabajando con un mayor tamaño de `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` en ZooKeeper. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Permitir reparar réplicas abandonadas incluso si ya tiene una gran cantidad de nodos en su cola. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregue un argumento requerido a `SET` índice (número máximo de filas almacenadas). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Corrección De Errores {#bug-fixes-16} + +- Fijo `WITH ROLLUP` resultado para grupo por solo `LowCardinality` clave. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Se corrigió un error en el índice establecido (dejando caer un gránulo si contiene más de `max_rows` filas). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) +- Muchas correcciones de compilación de FreeBSD. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([propulsor](https://github.com/proller)) +- Se corrigió la sustitución de alias en consultas con subconsulta que contenía el mismo alias (problema [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Mejoras De compilación / Prueba / Empaquetado {#buildtestingpackaging-improvements-4} + +- Añadir capacidad de ejecutar `clickhouse-server` para pruebas sin estado en la imagen de la ventana acoplable. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) + +### Lanzamiento De ClickHouse 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} + +#### Novedad {#new-features-6} + +- Se agregó el `KILL MUTATION` declaración que permite eliminar mutaciones que por alguna razón están atascadas. Añadir `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` campos a la `system.mutations` mesa para una solución de problemas más fácil. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Función agregada agregada `entropy` que calcula la entropía de Shannon. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) +- Añadida la capacidad de enviar consultas `INSERT INTO tbl VALUES (....` al servidor sin dividir en `query` y `data` parte. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) +- Implementación genérica de `arrayWithConstant` se añadió la función. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Aplicado `NOT BETWEEN` operador de comparación. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) +- Implementar `sumMapFiltered` para poder limitar el número de claves para las cuales los valores se sumarán por `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Se agregó soporte de `Nullable` tipos en `mysql` función de la tabla. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) +- Soporte para expresiones constantes arbitrarias en `LIMIT` clausula. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([K3box](https://github.com/k3box)) +- Añadir `topKWeighted` función de agregado que toma argumentos adicionales con peso (entero sin signo). [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Córdoba](https://github.com/andrewgolman)) +- `StorageJoin` ahora soporta `join_any_take_last_row` configuración que permite sobrescribir los valores existentes de la misma clave. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos pájaro](https://github.com/amosbird) +- Función añadida `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) +- Añadir `RowBinaryWithNamesAndTypes` formato. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) +- Añadir `IPv4` y `IPv6` tipos de datos. Implementaciones más efectivas de `IPv*` función. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) +- Función añadida `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) +- Añadir `Protobuf` formato de salida. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) +- Añadido soporte brotli para la interfaz HTTP para la importación de datos (INSERTs). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mijaíl](https://github.com/fandyushin)) +- Se agregaron consejos mientras el usuario hace un error tipográfico en el nombre de la función o escribe el cliente de línea de comandos. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Más información](https://github.com/danlark1)) +- Añadir `Query-Id` al encabezado de respuesta HTTP del servidor. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mijaíl](https://github.com/fandyushin)) + +#### Experimental características {#experimental-features-2} + +- Añadir `minmax` y `set` Índices de saltos de datos para la familia de motores de tablas MergeTree. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- Añadido conversión de `CROSS JOIN` a `INNER JOIN` si es posible. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Corrección De Errores {#bug-fixes-17} + +- Fijo `Not found column` para columnas duplicadas en `JOIN ON` apartado. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Hacer `START REPLICATED SENDS` comando iniciar envíos replicados. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) +- Ejecución de funciones agregadas fijas con `Array(LowCardinality)` argumento. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Corregido el comportamiento incorrecto al hacer `INSERT ... SELECT ... FROM file(...)` consulta y archivo `CSVWithNames` o `TSVWIthNames` formato y falta la primera fila de datos. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el fallo en la recarga del diccionario si el diccionario no está disponible. Este error apareció en 19.1.6. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([propulsor](https://github.com/proller)) +- Fijo `ALL JOIN` con duplicados en la tabla derecha. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Fallo de segmentación fijo con `use_uncompressed_cache=1` y excepción con un tamaño incorrecto sin comprimir. Este error apareció en 19.1.6. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- Fijo `compile_expressions` error con la comparación de fechas grandes (más que int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- Bucle infinito fijo al seleccionar de la función de la tabla `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Deshabilitar temporalmente la optimización de predicados para `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Invierno Zhang](https://github.com/zhang2014)) +- Fijo `Illegal instruction` error al usar funciones base64 en CPU antiguas. Este error se ha reproducido solo cuando ClickHouse se compiló con gcc-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijo `No message received` error al interactuar con PostgreSQL ODBC Driver a través de la conexión TLS. También corrige segfault cuando se utiliza MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el resultado incorrecto cuando `Date` y `DateTime` los argumentos se usan en ramas del operador condicional (función `if`). Añadido caso genérico para la función `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Los diccionarios de ClickHouse ahora se cargan dentro `clickhouse` proceso. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el punto muerto cuando `SELECT` de una mesa con `File` el motor fue reintentado después `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Condición de carrera fija al seleccionar entre `system.tables` puede dar `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-client` puede segfault al salir mientras carga datos para sugerencias de línea de comandos si se ejecutó en modo interactivo. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se ha corregido un error cuando la ejecución de mutaciones que contienen `IN` Los operadores estaban produciendo resultados incorrectos. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Error corregido: si hay una base de datos con `Dictionary` motor, todos los diccionarios obligados a cargar en el inicio del servidor, y si hay un diccionario con fuente ClickHouse de localhost, el diccionario no se puede cargar. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el error cuando los registros del sistema se intentaban crear de nuevo al apagar el servidor. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Devuelva correctamente el tipo correcto y maneje adecuadamente las cerraduras en `joinGet` función. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos pájaro](https://github.com/amosbird)) +- Añadir `sumMapWithOverflow` función. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Segfault fijo con `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) +- Corregido error con incorrecto `Date` y `DateTime` comparación. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([Valexey](https://github.com/valexey)) +- Prueba de fuzz fija bajo desinfectante de comportamiento indefinido: verificación de tipo de parámetro agregada para `quantile*Weighted` familia de funciones. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la condición de carrera rara al eliminar las piezas de datos antiguas que pueden fallar con `File not found` error. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Arregle el paquete de instalación con /etc/clickhouse-server/config que falta.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([propulsor](https://github.com/proller)) + +#### Mejoras De compilación / Prueba / Empaquetado {#buildtestingpackaging-improvements-5} + +- Paquete de Debian: correcto /etc/clickhouse-server/preprocessed link según config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([propulsor](https://github.com/proller)) +- Varias correcciones de compilación para FreeBSD. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([propulsor](https://github.com/proller)) +- Se agregó la capacidad de crear, rellenar y soltar tablas en perftest. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) +- Se ha añadido un script para comprobar si hay duplicados incluye. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó la capacidad de ejecutar consultas por índice en la prueba de rendimiento. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) +- Se sugiere instalar un paquete con símbolos de depuración. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Refactorización de pruebas de rendimiento. Mejor registro y manejo de señales. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) +- Se agregaron documentos a Yandex anónimo.Conjuntos de datos Metrika. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) +- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Se agregaron documentos sobre dos conjuntos de datos en s3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) +- Se agregó un script que crea un registro de cambios a partir de la descripción de las solicitudes de extracción. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Se agregó un módulo de marionetas para Clickhouse. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- Se agregaron documentos para un grupo de funciones no documentadas. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([Invierno Zhang](https://github.com/zhang2014)) +- ARM correcciones de construcción. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([propulsor](https://github.com/proller)) ([propulsor](https://github.com/proller)) +- Las pruebas de diccionario ahora pueden ejecutarse desde `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([propulsor](https://github.com/proller)) +- Ahora `/etc/ssl` se utiliza como directorio predeterminado con certificados SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó la comprobación de las instrucciones SSE y AVX al inicio. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) +- La secuencia de comandos Init esperará el servidor hasta el inicio. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([propulsor](https://github.com/proller)) + +#### Cambios Incompatibles Hacia atrás {#backward-incompatible-changes-1} + +- Quitar `allow_experimental_low_cardinality_type` configuración. `LowCardinality` los tipos de datos están listos para la producción. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reduzca el tamaño de la caché de marca y el tamaño de la caché sin comprimir según la cantidad de memoria disponible. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) +- Palabra clave añadida `INDEX` en `CREATE TABLE` consulta. Una columna con nombre `index` debe citarse con retrocesos o comillas dobles: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- `sumMap` ahora promueve el tipo de resultado en lugar de desbordamiento. Antiguo `sumMap` se puede obtener mediante el uso de `sumMapWithOverflow` función. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) + +#### Mejoras De Rendimiento {#performance-improvements-4} + +- `std::sort` sustituido por `pdqsort` para consultas sin `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) +- Ahora el servidor reutiliza subprocesos del grupo de subprocesos global. Esto afecta el rendimiento en algunos casos de esquina. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora {#improvements-5} + +- Implementado soporte AIO para FreeBSD. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `SELECT * FROM a JOIN b USING a, b` ahora volver `a` y `b` solo de la tabla de la izquierda. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) +- Permitir `-C` opción del cliente para trabajar como `-c` opcion. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) +- Ahora opción `--password` utilizado sin valor requiere contraseña de stdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) +- Se agregó resaltado de metacaracteres no escapados en literales de cadena que contienen `LIKE` expresiones o regex. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó la cancelación de las consultas de solo lectura HTTP si el socket del cliente desaparece. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) +- Ahora los informes del servidor progresan para mantener vivas las conexiones del cliente. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([Ivan](https://github.com/abyss7)) +- Mensaje ligeramente mejor con motivo para OPTIMIZE consulta con `optimize_throw_if_noop` configuración activada. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó soporte de `--version` opción para el servidor de clickhouse. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) +- Añadir `--help/-h` opción para `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) +- Se agregó soporte para subconsultas escalares con el resultado del estado de la función agregada. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Mejora del tiempo de apagado del servidor y ALTERa el tiempo de espera. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se ha añadido información sobre la configuración de la línea de replicado\_can\_become\_leader en el sistema.réplicas y agregue registro si la réplica no intenta convertirse en líder. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Método de codificación de datos:](https://github.com/ztlpn)) + +## Lanzamiento De ClickHouse 19.1 {#clickhouse-release-19-1} + +### Lanzamiento De ClickHouse 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} + +- Error fijo `Column ... queried more than once` que puede suceder si la configuración `asterisk_left_columns_only` se establece en 1 en caso de usar `GLOBAL JOIN` con `SELECT *` (caso raro). El problema no existe en 19.3 y posteriores. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) + +### Lanzamiento De ClickHouse 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} + +Esta versión contiene exactamente el mismo conjunto de parches que 19.3.7. + +### Lanzamiento De ClickHouse 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} + +Esta versión contiene exactamente el mismo conjunto de parches que 19.3.6. + +## Lanzamiento De ClickHouse 19.1 {#clickhouse-release-19-1-1} + +### Lanzamiento De ClickHouse 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} + +#### Corrección De Errores {#bug-fixes-18} + +- Se corrigió la incompatibilidad hacia atrás con versiones antiguas debido a una implementación incorrecta de `send_logs_level` configuración. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Incompatibilidad hacia atrás fija de la función de la tabla `remote` introducido con comentarios de columna. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} + +#### Corrección De Errores {#bug-fixes-19} + +- Arregle el paquete de instalación con /etc/clickhouse-server/config que falta.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([propulsor](https://github.com/proller)) + +## Lanzamiento De ClickHouse 19.1 {#clickhouse-release-19-1-2} + +### Lanzamiento De ClickHouse 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} + +#### Corrección De Errores {#bug-fixes-20} + +- Devuelva correctamente el tipo correcto y maneje adecuadamente las cerraduras en `joinGet` función. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos pájaro](https://github.com/amosbird)) +- Se corrigió el error cuando los registros del sistema se intentaban crear de nuevo al apagar el servidor. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Error corregido: si hay una base de datos con `Dictionary` motor, todos los diccionarios obligados a cargar en el inicio del servidor, y si hay un diccionario con fuente ClickHouse de localhost, el diccionario no se puede cargar. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se ha corregido un error cuando la ejecución de mutaciones que contienen `IN` Los operadores estaban produciendo resultados incorrectos. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Método de codificación de datos:](https://github.com/ztlpn)) +- `clickhouse-client` puede segfault al salir mientras carga datos para sugerencias de línea de comandos si se ejecutó en modo interactivo. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Condición de carrera fija al seleccionar entre `system.tables` puede dar `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el punto muerto cuando `SELECT` de una mesa con `File` el motor fue reintentado después `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se ha solucionado un problema: los diccionarios locales de ClickHouse se cargan a través de TCP, pero deberían cargarse dentro del proceso. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijo `No message received` error al interactuar con PostgreSQL ODBC Driver a través de la conexión TLS. También corrige segfault cuando se utiliza MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Deshabilitar temporalmente la optimización de predicados para `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Invierno Zhang](https://github.com/zhang2014)) +- Bucle infinito fijo al seleccionar de la función de la tabla `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijo `compile_expressions` error con la comparación de fechas grandes (más que int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- Fallo de segmentación fijo con `uncompressed_cache=1` y excepción con un tamaño incorrecto sin comprimir. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- Fijo `ALL JOIN` con duplicados en la tabla derecha. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Corregido el comportamiento incorrecto al hacer `INSERT ... SELECT ... FROM file(...)` consulta y archivo `CSVWithNames` o `TSVWIthNames` formato y falta la primera fila de datos. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ejecución de funciones agregadas fijas con `Array(LowCardinality)` argumento. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Paquete de Debian: correcto /etc/clickhouse-server/preprocessed link según config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([propulsor](https://github.com/proller)) +- Prueba de fuzz fija bajo desinfectante de comportamiento indefinido: verificación de tipo de parámetro agregada para `quantile*Weighted` familia de funciones. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hacer `START REPLICATED SENDS` comando iniciar envíos replicados. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) +- Fijo `Not found column` para columnas duplicadas en la sección JOIN ON. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Ahora `/etc/ssl` se utiliza como directorio predeterminado con certificados SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el fallo en la recarga del diccionario si el diccionario no está disponible. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([propulsor](https://github.com/proller)) +- Corregido error con incorrecto `Date` y `DateTime` comparación. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([Valexey](https://github.com/valexey)) +- Se corrigió el resultado incorrecto cuando `Date` y `DateTime` los argumentos se usan en ramas del operador condicional (función `if`). Añadido caso genérico para la función `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### Lanzamiento De ClickHouse 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} + +#### Novedad {#new-features-7} + +- Códecs de compresión personalizados por columna para tablas. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [Invierno Zhang](https://github.com/zhang2014), [Anatoly](https://github.com/Sindbag)) +- Añadido codec de compresión `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) +- Permitir a `ALTER` códecs de compresión. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) +- Funciones añadidas `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` para la compatibilidad estándar SQL. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) +- Soporte para escribir en `HDFS` mesas y `hdfs` función de la tabla. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) +- Funciones añadidas para buscar múltiples cadenas constantes de gran pajar: `multiPosition`, `multiSearch` ,`firstMatch` también con `-UTF8`, `-CaseInsensitive`, y `-CaseInsensitiveUTF8` variante. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Más información](https://github.com/danlark1)) +- Poda de fragmentos no utilizados si `SELECT` filtros de consulta por clave sharding (configuración `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [Ivan](https://github.com/abyss7)) +- Permitir `Kafka` para ignorar cierta cantidad de errores de análisis por bloque. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([Ivan](https://github.com/abyss7)) +- Añadido soporte para `CatBoost` evaluación de modelos multiclase. Función `modelEvaluate` devuelve tupla con predicciones sin procesar por clase para modelos multiclase. `libcatboostmodel.so` debe ser construido con [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Funciones añadidas `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) +- Funciones hash añadidas `xxHash64` y `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) +- Añadir `gccMurmurHash` función de hash (hash de Murmur con sabor a GCC) que usa la misma semilla de hash que [Gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([Sundyli](https://github.com/sundy-li)) +- Funciones hash añadidas `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) +- Función de tabla añadida `remoteSecure`. Funciona como `remote`, pero usa una conexión segura. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([propulsor](https://github.com/proller)) + +#### Experimental características {#experimental-features-3} + +- Se agregaron múltiples emulaciones JOINs (`allow_experimental_multiple_joins_emulation` configuración). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Corrección De Errores {#bug-fixes-21} + +- Hacer `compiled_expression_cache_size` ajuste limitado por defecto para reducir el consumo de memoria. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) +- Se corrigió un error que provocaba bloqueos en los subprocesos que realizaban ALTERs de tablas replicadas y en el subproceso que actualizaba la configuración de ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Se corrigió una condición de carrera al ejecutar una tarea ALTER distribuida. La condición de carrera provocó que más de una réplica intentara ejecutar la tarea y todas las réplicas, excepto una que fallara con un error de ZooKeeper. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Corregir un error cuando `from_zk` Los elementos de configuración no se actualizaron después de que se agotó el tiempo de espera de una solicitud a ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Corregir un error con el prefijo incorrecto para las máscaras de subred IPv4. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) +- Se corrigió el fallo (`std::terminate`) en casos excepcionales cuando no se puede crear un nuevo subproceso debido a recursos agotados. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir error cuando está en `remote` ejecución de la función de tabla cuando se usaron restricciones incorrectas para `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) +- Corregir una fuga de enchufes netlink. Se colocaron en un grupo donde nunca se eliminaron y se crearon nuevos sockets al comienzo de un nuevo subproceso cuando todos los sockets actuales estaban en uso. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Corregir un error con el cierre `/proc/self/fd` directorio antes de todos los fds fueron leídos de `/proc` después de bifurcar `odbc-bridge` subproceso. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) +- Conversión monótona de cadena a UInt fija en caso de uso de cadena en clave primaria. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([Invierno Zhang](https://github.com/zhang2014)) +- Se corrigió el error en el cálculo de la monotonía de la función de conversión de enteros. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Segfault fijo en `arrayEnumerateUniq`, `arrayEnumerateDense` funciones en caso de algunos argumentos no válidos. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reparar UB en StorageMerge. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos pájaro](https://github.com/amosbird)) +- Segfault fijo en funciones `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregido el error: funciones `round`, `floor`, `trunc`, `ceil` puede devolver un resultado falso cuando se ejecuta en un argumento entero y una gran escala negativa. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió un error inducido por ‘kill query sync’ lo que conduce a un volcado central. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) +- Corregir un error con un largo retraso después de la cola de replicación vacía. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) +- Se corrigió el uso excesivo de memoria en caso de insertar en la tabla con `LowCardinality` clave primaria. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fijo `LowCardinality` serialización para `Native` formato en caso de matrices vacías. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Se corrigió el resultado incorrecto al usar distinta por una sola columna numérica LowCardinality. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Se corrigió la agregación especializada con la clave LowCardinality (en caso de `compile` está habilitada la configuración). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Corregir el reenvío de usuarios y contraseñas para consultas de tablas replicadas. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) +- Se corrigió una condición de carrera muy rara que puede ocurrir al enumerar tablas en la base de datos de diccionarios mientras recargaba diccionarios. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el resultado incorrecto cuando se usaba HAVING con ROLLUP o CUBE. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Más información](https://github.com/reflection)) +- Se corrigieron alias de columna para consultas con `JOIN ON` sintaxis y tablas distribuidas. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([Invierno Zhang](https://github.com/zhang2014)) +- Se corrigió un error en la implementación interna de `quantileTDigest` (encontrado por Artem Vakhrushev). Este error nunca ocurre en ClickHouse y fue relevante solo para aquellos que usan la base de código ClickHouse como una biblioteca directamente. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora {#improvements-6} + +- Soporte para `IF NOT EXISTS` en `ALTER TABLE ADD COLUMN` declaraciones junto con `IF EXISTS` en `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) +- Función `parseDateTimeBestEffort`: soporte para formatos `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` y similares. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CapnProtoInputStream` ahora soportan estructuras dentadas. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) +- Mejora de la usabilidad: se agregó una verificación de que el proceso del servidor se inicia desde el propietario del directorio de datos. No permita iniciar el servidor desde la raíz si los datos pertenecen a un usuario no root. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([Más información](https://github.com/sergey-v-galtsev)) +- Mejor lógica de verificación de columnas requeridas durante el análisis de consultas con JOINs. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) +- Disminución del número de conexiones en caso de un gran número de tablas distribuidas en un único servidor. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([Invierno Zhang](https://github.com/zhang2014)) +- Fila de totales admitidos para `WITH TOTALS` consulta para el controlador ODBC. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) +- Permitido utilizar `Enum`s como enteros dentro de la función if. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([Ivan](https://github.com/abyss7)) +- Añadir `low_cardinality_allow_in_native_format` configuración. Si está desactivado, no utilice `LowCadrinality` escriba en `Native` formato. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Se eliminaron algunos objetos redundantes de la caché de expresiones compiladas para reducir el uso de memoria. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) +- Añadir comprobar que `SET send_logs_level = 'value'` consulta acepta el valor apropiado. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) +- Verificación de tipo de datos fijos en las funciones de conversión de tipo. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([Invierno Zhang](https://github.com/zhang2014)) + +#### Mejoras De Rendimiento {#performance-improvements-5} + +- Agregar una configuración MergeTree `use_minimalistic_part_header_in_zookeeper`. Si está habilitada, las tablas replicadas almacenarán metadatos de piezas compactas en un único znode de piezas. Esto puede reducir drásticamente el tamaño de la instantánea ZooKeeper (especialmente si las tablas tienen muchas columnas). Tenga en cuenta que después de habilitar esta configuración, no podrá degradar a una versión que no la admita. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Agregar una implementación basada en DFA para funciones `sequenceMatch` y `sequenceCount` en caso de que el patrón no contenga tiempo. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Mejora del rendimiento para la serialización de números enteros. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos pájaro](https://github.com/amosbird)) +- Cero a la izquierda relleno PODArray de modo que -1 elemento es siempre válido y puesto a cero. Se utiliza para el cálculo sin ramas de compensaciones. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos pájaro](https://github.com/amosbird)) +- Revertir `jemalloc` versión que conducen a la degradación del rendimiento. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Cambios Incompatibles Hacia atrás {#backward-incompatible-changes-2} + +- Se eliminó la función no documentada `ALTER MODIFY PRIMARY KEY` porque fue reemplazado por el `ALTER MODIFY ORDER BY` comando. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Método de codificación de datos:](https://github.com/ztlpn)) +- Función eliminada `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Prohibir el uso de subconsultas escalares con el resultado del tipo `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([Ivan](https://github.com/abyss7)) + +#### Mejoras De compilación / Prueba / Empaquetado {#buildtestingpackaging-improvements-6} + +- Añadido soporte para PowerPC (`ppc64le`) construir. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Más información](https://github.com/danlark1)) +- Las pruebas funcionales con estado se ejecutan en el conjunto de datos público disponible. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el error cuando el servidor no puede comenzar con el `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` mensaje dentro de Docker o systemd-nspawn. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualizar `rdkafka` Biblioteca a v1.0.0-RC5. Usado cppkafka en lugar de la interfaz C sin procesar. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([Ivan](https://github.com/abyss7)) +- Actualizar `mariadb-client` biblioteca. Se corrigió uno de los problemas encontrados por UBSan. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Algunas correcciones para compilaciones de UBSan. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregaron ejecuciones de pruebas por compromiso con la compilación de UBSan. +- Se agregaron ejecuciones por compromiso del analizador estático PVS-Studio. +- Corregidos errores encontrados por PVS-Studio. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigieron problemas de compatibilidad con glibc. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mueva las imágenes de Docker a 18.10 y agregue el archivo de compatibilidad para glibc\> = 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) +- Agregue la variable env si el usuario no desea chown directorios en la imagen Docker del servidor. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) +- Habilitado la mayoría de las advertencias de `-Weverything` en clang. Permitir `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregaron algunas advertencias más que están disponibles solo en clang 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Enlace a `libLLVM` en lugar de a las librerías LLVM individuales cuando se usan enlaces compartidos. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Películas De Sexo](https://github.com/orivej)) +- Se agregaron variables de desinfectante para imágenes de prueba. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) +- `clickhouse-server` paquete debian recomendará `libcap2-bin` paquete a utilizar `setcap` herramienta para el establecimiento de capacidades. Esto es opcional. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejora del tiempo de compilación, fijo incluye. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([propulsor](https://github.com/proller)) +- Se agregaron pruebas de rendimiento para funciones hash. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) +- Se corrigieron las dependencias de la biblioteca cíclica. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([propulsor](https://github.com/proller)) +- Compilación mejorada con poca memoria disponible. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([propulsor](https://github.com/proller)) +- Se agregó script de prueba para reproducir la degradación del rendimiento en `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigieron errores ortográficos en comentarios y literales de cadena bajo `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) +- Se corrigieron errores tipográficos en los comentarios. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) + +## [Nivel de Cifrado WEP](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/es/whats-new/changelog/index.md b/docs/es/whats-new/changelog/index.md new file mode 100644 index 00000000000..c7b944c0cd6 --- /dev/null +++ b/docs/es/whats-new/changelog/index.md @@ -0,0 +1,668 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_folder_title: Changelog +toc_priority: 74 +toc_title: '2020' +--- + +## Lanzamiento De ClickHouse V20.3 {#clickhouse-release-v20-3} + +### Todos Los Derechos Reservados {#clickhouse-release-v20-3-4-10-2020-03-20} + +#### Corrección De Errores {#bug-fix} + +- Esta versión también contiene todas las correcciones de errores de 20.1.8.41 +- Solución faltante `rows_before_limit_at_least` para consultas sobre http (con canalización de procesadores). Esto corrige [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### Todos Los Derechos Reservados {#clickhouse-release-v20-3-3-6-2020-03-17} + +#### Corrección De Errores {#bug-fix-1} + +- Esta versión también contiene todas las correcciones de errores de 20.1.7.38 +- Corregir un error en una replicación que no permite que la replicación funcione si el usuario ha ejecutado mutaciones en la versión anterior. Esto corrige [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). Hace que la versión 20.3 sea compatible con versiones anteriores de nuevo. +- Añadir ajuste `use_compact_format_in_distributed_parts_names` que permite escribir archivos para `INSERT` consultas en `Distributed` mesa con un formato más compacto. Esto corrige [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). Hace que la versión 20.3 sea compatible con versiones anteriores de nuevo. + +### Todos Los Derechos Reservados {#clickhouse-release-v20-3-2-1-2020-03-12} + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change} + +- Se ha solucionado el problema `file name too long` al enviar datos para `Distributed` para un gran número de réplicas. Se corrigió el problema de que las credenciales de réplica se expusieran en el registro del servidor. El formato del nombre del directorio en el disco se cambió a `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) Después de actualizar a la nueva versión, no podrá degradar sin intervención manual, porque la versión anterior del servidor no reconoce el nuevo formato de directorio. Si desea degradar, debe cambiar el nombre manualmente de los directorios correspondientes al formato anterior. Este cambio sólo es relevante si ha utilizado `INSERT`s a `Distributed` tabla. En la versión 20.3.3 introduciremos una configuración que le permitirá habilitar el nuevo formato gradualmente. +- Se ha cambiado el formato de las entradas de registro de replicación para los comandos de mutación. Tienes que esperar a que las mutaciones antiguas se procesen antes de instalar la nueva versión. +- Implemente un generador de perfiles de memoria simple que vuelca stacktraces a `system.trace_log` cada N bytes sobre el límite de asignación suave [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([Ivan](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov)) La columna de `system.trace_log` fue renombrado desde `timer_type` a `trace_type`. Esto requerirá cambios en el análisis de rendimiento de terceros y herramientas de procesamiento de flamegraph. +- Use la identificación de subproceso del sistema operativo en todas partes en lugar del número de subproceso interno. Esto corrige [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Antiguo `clickhouse-client` no puede recibir registros que se envían desde el servidor cuando `send_logs_level` está habilitado, porque se han cambiado los nombres y tipos de los mensajes de registro estructurados. Por otro lado, diferentes versiones de servidor pueden enviar registros con diferentes tipos entre sí. Cuando usted no utiliza el `send_logs_level` ajuste, no debería importarle. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Quitar `indexHint` función [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Quitar `findClusterIndex`, `findClusterValue` función. Esto corrige [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). Si estaba utilizando estas funciones, envíe un correo electrónico a `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora no está permitido crear columnas o agregar columnas con `SELECT` subconsulta como expresión predeterminada. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) +- Requiere alias para subconsultas en JOIN. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) +- Mejorar `ALTER MODIFY/ADD` consultas lógica. Ahora no puedes `ADD` sin tipo, `MODIFY` expresión predeterminada no cambia el tipo de columna y `MODIFY` type no pierde el valor de expresión predeterminado. Fijar [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) +- Requiere que el servidor se reinicie para aplicar los cambios en la configuración de registro. Esta es una solución temporal para evitar el error en el que el servidor inicia sesión en un archivo de registro eliminado (consulte [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Configuración `experimental_use_processors` está habilitado de forma predeterminada. Esta configuración permite el uso de la nueva canalización de consultas. Esto es refactorización interna y no esperamos cambios visibles. Si ves algún problema, configúralo en cero. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Novedad {#new-feature} + +- Añadir `Avro` y `AvroConfluent` Formatos de entrada/salida [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrés Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrés Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualizaciones de subprocesos múltiples y sin bloqueo de claves caducadas en `cache` diccionarios (con permiso opcional para leer los antiguos). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Agregar consulta `ALTER ... MATERIALIZE TTL`. Ejecuta la mutación que obliga a eliminar los datos caducados por TTL y recalcula la metainformación sobre TTL en todas las partes. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) +- Cambie de HashJoin a MergeJoin (en el disco) si es necesario [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir `MOVE PARTITION` comando para `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Recarga de la configuración de almacenamiento desde el archivo de configuración sobre la marcha. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Permitido cambiar `storage_policy` a uno no menos rico. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Se agregó soporte para globs / wildcards para el almacenamiento S3 y la función de mesa. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Implementar `bitAnd`, `bitOr`, `bitXor`, `bitNot` para `FixedString(N)` Tipo de datos. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Función añadida `bitCount`. Esto corrige [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([kopylov](https://github.com/ikopylov)) +- Añadir `generateRandom` función de tabla para generar filas aleatorias con un esquema dado. Permite rellenar la tabla de prueba arbitraria con datos. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) +- `JSONEachRowFormat`: apoyar caso especial cuando los objetos encerrados en la matriz de nivel superior. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) +- Ahora es posible crear una columna con `DEFAULT` expresión que depende de una columna con el valor predeterminado `ALIAS` expresion. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) +- Permitir especificar `--limit` más que el tamaño de los datos de origen en `clickhouse-obfuscator`. Los datos se repetirán con diferentes semillas aleatorias. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `groupArraySample` función (similar a `groupArray`) con algoritmo de muestreo de reservorio. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos pájaro](https://github.com/amosbird)) +- Ahora puede controlar el tamaño de la cola de actualización en `cache`/`complex_key_cache` diccionarios a través de métricas del sistema. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Permitir usar CRLF como separador de línea en formato de salida CSV con configuración `output_format_csv_crlf_end_of_line` se establece en 1 [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) +- Implementar más funciones del [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` y `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) +- Nueva configuración introducida: `max_parser_depth` para controlar el tamaño máximo de la pila y permitir grandes consultas complejas. Esto corrige [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) y [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) +- Añadir una configuración `force_optimize_skip_unused_shards` configuración para lanzar si no es posible omitir fragmentos no utilizados [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) +- Permitir configurar varios discos / volúmenes para almacenar datos para enviar `Distributed` motor [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) +- Política de almacenamiento de soporte (``) para almacenar datos temporales. [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) +- Añadir `X-ClickHouse-Exception-Code` Encabezado HTTP que se establece si se lanzó una excepción antes de enviar datos. Esto implementa [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) +- Función añadida `ifNotFinite`. Es solo un azúcar sintáctico: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `last_successful_update_time` columna en `system.dictionaries` tabla [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Añadir `blockSerializedSize` función (tamaño en disco sin compresión) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) +- Añadir función `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([Hcz](https://github.com/hczhcz)) +- Tablas de sistema añadidas `system.zeros` y `system.zeros_mt` así como funciones de cuento `zeros()` y `zeros_mt()`. Las tablas (y funciones de tabla) contienen una sola columna con nombre `zero` y tipo `UInt8`. Esta columna contiene ceros. Es necesario para fines de prueba como el método más rápido para generar muchas filas. Esto corrige [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Característica Experimental {#experimental-feature} + +- Añadir nuevo formato compacto de piezas en `MergeTree`-family tablas en las que todas las columnas se almacenan en un archivo. Esto ayuda a aumentar el rendimiento de las inserciones pequeñas y frecuentes. El formato antiguo (un archivo por columna) ahora se llama ancho. El formato de almacenamiento de datos se controla mediante la configuración `min_bytes_for_wide_part` y `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) +- Soporte para almacenamiento S3 para `Log`, `TinyLog` y `StripeLog` tabla. [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) + +#### Corrección De Errores {#bug-fix-2} + +- Se corrigieron espacios en blanco inconsistentes en los mensajes de registro. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir un error en el que las matrices de tuplas sin nombre se aplanaban como estructuras anidadas en la creación de la tabla. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) +- Se corrigió el problema cuando “Too many open files” puede ocurrir un error si hay demasiados archivos que coincidan con el patrón glob en `File` mesa o `file` función de la tabla. Ahora los archivos se abren perezosamente. Esto corrige [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- DROP TEMPORARY TABLE ahora solo deja caer la tabla temporal. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) +- Elimine la partición obsoleta cuando apagamos el servidor o DETACH / ATTACH una tabla. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Para saber cómo el disco predeterminado calcula el espacio libre de `data` subdirectorio. Se ha solucionado el problema cuando la cantidad de espacio libre no se calcula correctamente si el `data` el directorio está montado en un dispositivo separado (caso raro). Esto corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) +- Permitir coma (cruz) unirse con IN () dentro. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) +- Permita reescribir CROSS a INNER JOIN si hay un operador \[NOT\] LIKE en la sección WHERE. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) +- Corregir posible resultado incorrecto después `GROUP BY` con configuración habilitada `distributed_aggregation_memory_efficient`. Fijar [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Las claves encontradas se contaron como perdidas en las métricas de los diccionarios de caché. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Corregir la incompatibilidad del protocolo de replicación introducida en [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- Condición de carrera fija en `queue_task_handle` en el inicio de `ReplicatedMergeTree` tabla. [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Token `NOT` no funcionó en `SHOW TABLES NOT LIKE` consulta [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Comprobación de rango añadida para funcionar `h3EdgeLengthM`. Sin esta comprobación, el desbordamiento del búfer es posible. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió un error en los cálculos por lotes de OP lógicos ternarios en múltiples argumentos (más de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alejandro Kazakov](https://github.com/Akazz)) +- Corregir el error de optimización PREWHERE, que podría conducir a fallas según segfaults o `Inconsistent number of columns got from MergeTreeRangeReader` salvedad. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) +- Arreglar inesperado `Timeout exceeded while reading from socket` excepción, que ocurre aleatoriamente en la conexión segura antes de que se exceda el tiempo de espera y cuando se habilita el generador de perfiles de consultas. También añadir `connect_timeout_with_failover_secure_ms` configuración (por defecto 100 ms), que es similar a `connect_timeout_with_failover_ms`, pero se usa para conexiones seguras (porque el protocolo de enlace SSL es más lento que la conexión TCP ordinaria) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([Tavplubix](https://github.com/tavplubix)) +- Corregir error con finalización de mutaciones, cuando la mutación puede colgarse en estado con `parts_to_do=0` y `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) +- Use la nueva lógica ANY JOIN con `partial_merge_join` configuración. Es posible hacer `ANY|ALL|SEMI LEFT` y `ALL INNER` se une con `partial_merge_join=1` ahora. [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) +- Shard ahora sujeta la configuración obtenida del iniciador a los restos del fragmento en lugar de lanzar una excepción. Esta corrección permite enviar consultas a un fragmento con otras restricciones. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) +- Se corrigió el problema de administración de memoria en `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fijar `toDecimal*OrNull()` familia de funciones cuando se llama con cadena `e`. Fijar [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) +- Asegúrese de que `FORMAT Null` no envía datos al cliente. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Corregir error en la marca de tiempo `LiveViewBlockInputStream` no se actualizará. `LIVE VIEW` es una característica experimental. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) +- Fijo `ALTER MODIFY TTL` comportamiento incorrecto que no permitía eliminar expresiones TTL antiguas. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Informe UBSan fijo en MergeTreeIndexSet. Esto corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió el comportamiento de `match` y `extract` funciona cuando haystack tiene cero bytes. El comportamiento era incorrecto cuando el pajar era constante. Esto corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evite lanzar desde el destructor en la biblioteca Apache Avro de terceros. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrés Onyshchuk](https://github.com/oandrew)) +- No confirmar un lote encuestado desde `Kafka` parcialmente, ya que puede conducir a agujeros en los datos. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) +- Fijar `joinGet` con tipos de devolución anulables. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos pájaro](https://github.com/amosbird)) +- Corregir la incompatibilidad de datos cuando se comprime con `T64` códec. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Fijar identificadores de tipo de datos en `T64` códec de compresión que conduce a una compresión incorrecta (de) en las versiones afectadas. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir ajuste `enable_early_constant_folding` y desactivarlo en algunos casos que conduce a errores. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) +- Repare el optimizador de predicados pushdown con VIEW y habilite la prueba [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([Invierno Zhang](https://github.com/zhang2014)) +- Arreglar segfault en `Merge` tablas, que pueden suceder al leer de `File` almacenamiento [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([Tavplubix](https://github.com/tavplubix)) +- Se agregó una verificación de la política de almacenamiento en `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. De lo contrario, podría hacer que los datos de la parte sean inaccesibles después del reinicio y evitar que se inicie ClickHouse. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix altera si hay TTL establecido para la tabla. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir la condición de carrera que puede ocurrir cuando `SYSTEM RELOAD ALL DICTIONARIES` se ejecuta mientras se modifica / agrega / elimina algún diccionario. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) +- En versiones anteriores `Memory` el motor de base de datos utiliza una ruta de datos vacía, por lo que las tablas se crean en `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([Tavplubix](https://github.com/tavplubix)) +- Se corrigieron los mensajes de registro incorrectos sobre la falta de disco o política predeterminada. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix not(has()) para el índice bloom\_filter de los tipos de matriz. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([chimbab](https://github.com/achimbab)) +- Permitir las primeras columnas en una tabla con `Log` motor ser un alias [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([Ivan](https://github.com/abyss7)) +- Corregir el orden de los rangos mientras se lee desde `MergeTree` mesa en un hilo. Podría dar lugar a excepciones de `MergeTreeRangeReader` o resultados de consultas incorrectos. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) +- Hacer `reinterpretAsFixedString` devolver `FixedString` en lugar de `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrés Onyshchuk](https://github.com/oandrew)) +- Evite casos extremadamente raros cuando el usuario puede obtener un mensaje de error incorrecto (`Success` en lugar de una descripción detallada del error). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- No se bloquee al usar `Template` formato con plantilla de fila vacía. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Los archivos de metadatos para las tablas del sistema se pueden crear en un lugar incorrecto [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([Tavplubix](https://github.com/tavplubix)) Fijar [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). +- Corregir la carrera de datos en exception\_ptr en el diccionario de caché [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- No lanzar una excepción para la consulta `ATTACH TABLE IF NOT EXISTS`. Anteriormente se lanzaba si la tabla ya existe, a pesar de la `IF NOT EXISTS` clausula. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) +- Se corrigió la falta de cierre de paren en el mensaje de excepción. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evitar el mensaje `Possible deadlock avoided` en el inicio de clickhouse-client en modo interactivo. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se solucionó el problema cuando el relleno al final del valor codificado en base64 puede estar mal formado. Actualización de la biblioteca base64. Esto corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), cerca [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evitar la pérdida de datos en `Kafka` en casos raros cuando la excepción ocurre después de leer el sufijo pero antes de confirmar. Fijar [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) +- Excepción fija en `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) +- Corregir el bloqueo cuando un usuario intenta `ALTER MODIFY SETTING` para viejos `MergeTree` familia de motores de mesa. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- Compatibilidad con números UInt64 que no caben en Int64 en funciones relacionadas con JSON. Actualizar SIMDJSON a maestro. Esto corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la ejecución de predicados invertidos cuando se usa un índice funcional no estrictamente monotínico. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alejandro Kazakov](https://github.com/Akazz)) +- No trate de doblar `IN` constante en `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos pájaro](https://github.com/amosbird)) +- Corregir error en `ALTER DELETE` mutaciones que conduce a la corrupción del índice. Esto corrige [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) y [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). Además arreglar condiciones de carrera extremadamente raras en `ReplicatedMergeTree` `ALTER` consulta. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) +- Cuando el ajuste `compile_expressions` está habilitado, puede obtener `unexpected column` en `LLVMExecutableFunction` cuando usamos `Nullable` tipo [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Múltiples correcciones para `Kafka` engine: 1) corrige los duplicados que aparecían durante el reequilibrio del grupo de consumidores. 2) Arreglar raro ‘holes’ apareció cuando los datos se sondearon de varias particiones con una encuesta y se confirmaron parcialmente (ahora siempre procesamos / confirmamos todo el bloque de mensajes sondeados). 3) Arregle los lavados por tamaño de bloque (antes de eso, solo el lavado por tiempo de espera funcionaba correctamente). 4) mejor procedimiento de suscripción (con retroalimentación de la asignación). 5) Haga que las pruebas funcionen más rápido (con intervalos y tiempos de espera predeterminados). Debido al hecho de que los datos no se enjuagaron por el tamaño del bloque antes (como debería según la documentación), ese PR puede conducir a una cierta degradación del rendimiento con la configuración predeterminada (debido a los sofocos más a menudo y más pequeños que son menos óptimos). Si encuentra el problema de rendimiento después de ese cambio, aumente `kafka_max_block_size` en la tabla al valor más grande (por ejemplo `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Fijar [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) +- Fijar `Parameter out of bound` excepción en algunas consultas después de las optimizaciones PREWHERE. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Fallecimiento](https://github.com/bgiard)) +- Se corrigió el caso de la constancia mixta de los argumentos de la función `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Al ejecutar `CREATE` consulta, doblar expresiones constantes en argumentos del motor de almacenamiento. Reemplace el nombre de la base de datos vacía con la base de datos actual. Fijar [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([Tavplubix](https://github.com/tavplubix)) +- Ahora no es posible crear o agregar columnas con alias cíclicos simples como `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- Se ha corregido un error con doble movimiento que puede corromper parte original. Esto es relevante si usa `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Permitir `interval` identificador para analizar correctamente sin retrocesos. Solucionado el problema cuando una consulta no se puede ejecutar incluso si el `interval` identifier está encerrado en backticks o comillas dobles. Esto corrige [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Prueba de fuzz fija y comportamiento incorrecto de `bitTestAll`/`bitTestAny` función. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir un posible bloqueo / número incorrecto de filas en `LIMIT n WITH TIES` cuando hay muchas filas iguales a n’th row. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([Tavplubix](https://github.com/tavplubix)) +- Corregir mutaciones con partes escritas con habilitado `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) +- Corregir la carrera de datos en la destrucción de `Poco::HTTPServer`. Podría suceder cuando el servidor se inicia y se apaga inmediatamente. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir un error en el que se mostraba un mensaje de error engañoso cuando se ejecutaba `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) +- Fijo `Parameters are out of bound` excepción en algunos casos raros cuando tenemos una constante en el `SELECT` cláusula cuando tenemos una `ORDER BY` y una `LIMIT` clausula. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Fijar mutaciones finalización, cuando ya hecho mutación puede tener estado `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) +- Evitar la ejecución `ALTER ADD INDEX` para tablas MergeTree con sintaxis antigua, porque no funciona. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) +- Durante el inicio del servidor, no acceda a la tabla, que `LIVE VIEW` depende de, por lo que el servidor podrá comenzar. También eliminar `LIVE VIEW` dependencias al separar `LIVE VIEW`. `LIVE VIEW` es una característica experimental. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([Tavplubix](https://github.com/tavplubix)) +- Arreglar posible segfault en `MergeTreeRangeReader`, mientras se ejecuta `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir posibles sumas de comprobación no coincidentes con TTL de columna. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Se corrigió un error cuando las partes no se movían en segundo plano por las reglas TTL en caso de que solo haya un volumen. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Se ha solucionado el problema `Method createColumn() is not implemented for data type Set`. Esto corrige [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora intentaremos finalizar las mutaciones con más frecuencia. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- Fijar `intDiv` por menos una constante [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([Hcz](https://github.com/hczhcz)) +- Corregir la posible condición de carrera en `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir un error que conduce a la terminación del servidor al intentar usar / soltar `Kafka` tabla creada con parámetros incorrectos. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) +- Solución alternativa agregada si el sistema operativo devuelve un resultado incorrecto para `timer_create` función. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregido el error en el uso de `min_marks_for_seek` parámetro. Se corrigió el mensaje de error cuando no hay una clave de fragmentación en la tabla distribuida e intentamos omitir fragmentos no utilizados. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) + +#### Mejora {#improvement} + +- Implementar `ALTER MODIFY/DROP` encima de mutaciones para `ReplicatedMergeTree*` familia de motores. Ahora `ALTERS` bloquea solo en la etapa de actualización de metadatos, y no bloquea después de eso. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) +- Agregue la capacidad de reescribir CROSS a INNER JOINs con `WHERE` sección que contiene nombres unqialified. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) +- Hacer `SHOW TABLES` y `SHOW DATABASES` las consultas apoyan el `WHERE` expresiones y `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([Sundyli](https://github.com/sundy-li)) +- Añadido un ajuste `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) +- Después de los cambios recientes, el cliente MySQL comenzó a imprimir cadenas binarias en hexadecimal, lo que las hizo no legibles ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). La solución en ClickHouse es marcar las columnas de cadena como UTF-8, lo que no siempre es, pero generalmente el caso. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) +- Agregue soporte de las claves String y FixedString para `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Fallecimiento](https://github.com/bgiard)) +- Teclas de cadena de soporte en los mapas SummingMergeTree [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Fallecimiento](https://github.com/bgiard)) +- Terminación de la señal del subproceso al grupo de subprocesos incluso si el subproceso ha lanzado una excepción [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Más información](https://github.com/dingxiangfei2009)) +- Permitir establecer `query_id` en `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) +- No permita expresiones extrañas en `ALTER TABLE ... PARTITION partition` consulta. Esto aborda [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tabla `system.table_engines` ahora proporciona información sobre el soporte de características (como `supports_ttl` o `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) +- Permitir `system.metric_log` predeterminada. Contendrá filas con valores de ProfileEvents, CurrentMetrics recopilados con “collect\_interval\_milliseconds” intervalo (un segundo por defecto). La tabla es muy pequeña (generalmente en orden de megabytes) y la recopilación de estos datos por defecto es razonable. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([Ivan](https://github.com/abyss7)) +- Ahora temporal `LIVE VIEW` es creado por `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` en lugar de `CREATE TEMPORARY LIVE VIEW ...`, porque la sintaxis anterior no era consistente con `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([Tavplubix](https://github.com/tavplubix)) +- Agregar text\_log.parámetro de configuración de nivel para limitar las entradas `system.text_log` tabla [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) +- Permitir colocar la parte descargada en discos / volúmenes de acuerdo con las reglas TTL [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Para diccionarios MySQL externos, permita mutualizar el grupo de conexiones MySQL para “share” entre los diccionarios. Esta opción reduce significativamente el número de conexiones a los servidores MySQL. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Mostrar el tiempo de ejecución de consultas más cercano para los cuantiles en `clickhouse-benchmark` salida en lugar de valores interpolados. Es mejor mostrar valores que correspondan al tiempo de ejecución de algunas consultas. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Posibilidad de agregar clave y marca de tiempo para el mensaje al insertar datos en Kafka. Fijar [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) +- Si el servidor se ejecuta desde el terminal, resalte el número de hilo, el id de consulta y la prioridad de registro por colores. Esto es para mejorar la legibilidad de los mensajes de registro correlacionados para los desarrolladores. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejor mensaje de excepción al cargar tablas para `Ordinary` base. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Implementar `arraySlice` para matrices con estados de función agregados. Esto corrige [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Permita que las funciones constantes y las matrices constantes se utilicen en el lado derecho del operador IN. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) +- Si la excepción del zookeeper ha ocurrido al obtener datos para el sistema.réplicas, mostrarlo en una columna separada. Esto implementa [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Elimine atómicamente las partes de datos de MergeTree en destroy. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Soporte de seguridad a nivel de fila para tablas distribuidas. [\#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([Ivan](https://github.com/abyss7)) +- Now we recognize suffix (like KB, KiB…) in settings values. [\#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) +- Evitar la falta de memoria mientras se construye el resultado de una gran UNIÓN. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) +- Se agregaron nombres de clústeres a sugerencias en modo interactivo en `clickhouse-client`. [\#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexey-milovidov](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) ([Ivan](https://github.com/abyss7)) +- Columna añadida `exception_code` en `system.query_log` tabla. [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) +- Servidor de compatibilidad MySQL habilitado en el puerto `9004` en el archivo de configuración del servidor predeterminado. Se corrigió el comando de generación de contraseñas en el ejemplo de configuración. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) +- Evite abortar al apagar si el sistema de archivos es de solo lectura. Esto corrige [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejor mensaje de excepción cuando se requiere longitud en la consulta HTTP POST. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `_path` y `_file` columnas virtuales para `HDFS` y `File` motores y `hdfs` y `file` funciones de la tabla [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) +- Corregir error `Cannot find column` mientras se inserta en `MATERIALIZED VIEW` en caso de que se agregara una nueva columna a la tabla interna de la vista. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corrige el progreso sobre el protocolo cliente-servidor nativo, al enviar el progreso después de la actualización final (como los registros). Esto puede ser relevante solo para algunas herramientas de terceros que usan protocolo nativo. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) +- Agregue una métrica del sistema que rastree el número de conexiones de cliente utilizando el protocolo MySQL ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) +- A partir de ahora, las respuestas HTTP tendrán `X-ClickHouse-Timezone` encabezado establecido en el mismo valor de zona horaria que `SELECT timezone()` informaría. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) + +#### Mejora Del Rendimiento {#performance-improvement} + +- Mejorar el rendimiento del índice de análisis con IN [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) +- Código más simple y eficiente en funciones lógicas + limpiezas de código. Un seguimiento de [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alejandro Kazakov](https://github.com/Akazz)) +- Mejora general del rendimiento (en el rango del 5%..200% para consultas afectadas) garantizando aliasing aún más estricto con las características de C ++ 20. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos pájaro](https://github.com/amosbird)) +- Aliasing más estricto para bucles internos de funciones de comparación. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Aliasing más estricto para bucles internos de funciones aritméticas. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Una implementación ~ 3 veces más rápida para ColumnVector::replicate() , a través de la cual se implementa ColumnConst::convertToFullColumn() . También será útil en pruebas al materializar constantes. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alejandro Kazakov](https://github.com/Akazz)) +- Otra mejora de rendimiento menor a `ColumnVector::replicate()` (esto acelera el `materialize` función y funciones de orden superior) una mejora aún más a [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alejandro Kazakov](https://github.com/Akazz)) +- Rendimiento mejorado de `stochasticLinearRegression` función de agregado. Este parche es aportado por Intel. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejorar el rendimiento de `reinterpretAsFixedString` función. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- No envíe bloques al cliente para `Null` formato en la tubería de procesadores. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alejandro Kuzmenkov](https://github.com/akuzm)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement} + +- El manejo de excepciones ahora funciona correctamente en el subsistema Windows para Linux. Consulte https://github.com/ClickHouse-Extras/libunwind/pull/3 Esto corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) +- Reemplazar `readline` con `replxx` para la edición de línea interactiva en `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([Ivan](https://github.com/abyss7)) +- Mejor tiempo de compilación y menos instancias de plantillas en FunctionsComparison. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Integración añadida con `clang-tidy` en CI. Ver también [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora vinculamos ClickHouse en CI usando `lld` incluso para `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) +- Permitir aleatorizar la programación de subprocesos e insertar fallas cuando `THREAD_FUZZER_*` se establecen variables de entorno. Esto ayuda a las pruebas. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Habilitar sockets seguros en pruebas sin estado [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([Tavplubix](https://github.com/tavplubix)) +- Hacer SPLIT\_SHARED\_LIBRARIES=OFF más robusto [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) +- Hacer “performance\_introspection\_and\_logging” prueba confiable al servidor aleatorio atascado. Esto puede suceder en el entorno de CI. Ver también [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Validar XML en la comprobación de estilo. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Condición de carrera fija en la prueba `00738_lock_for_inner_table`. Esta prueba se basó en el sueño. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eliminar pruebas de rendimiento de tipo `once`. Esto es necesario para ejecutar todas las pruebas de rendimiento en modo de comparación estadística (más confiable). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Prueba de rendimiento agregada para funciones aritméticas. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Prueba de rendimiento añadida para `sumMap` y `sumMapWithOverflow` funciones agregadas. Seguimiento de [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Asegúrese de estilo de ErrorCodes por comprobación de estilo. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregar script para el historial de pruebas. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) +- Añadir advertencia GCC `-Wsuggest-override` para localizar y arreglar todos los lugares donde `override` palabra clave debe ser utilizado. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) +- Ignore el símbolo débil en Mac OS X porque debe definirse [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Usuario eliminado](https://github.com/ghost)) +- Normalice el tiempo de ejecución de algunas consultas en las pruebas de rendimiento. Esto se hace en preparación para ejecutar todas las pruebas de rendimiento en modo de comparación. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Arregle algunas pruebas para admitir pytest con pruebas de consulta [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([Ivan](https://github.com/abyss7)) +- Habilite SSL en compilación con MSan, por lo que el servidor no fallará al iniciarse al ejecutar pruebas sin estado [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([Tavplubix](https://github.com/tavplubix)) +- Corregir la sustitución de la base de datos en los resultados de las pruebas [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) +- Crear correcciones para plataformas diversas [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([propulsor](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([propulsor](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([propulsor](https://github.com/proller)) +- Sección de discos agregada a la imagen de la ventana acoplable de prueba sin estado con cobertura [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) +- Deshágase de los archivos en el árbol de origen al compilar con GRPC [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos pájaro](https://github.com/amosbird)) +- Un tiempo de compilación ligeramente más rápido al eliminar SessionCleaner del contexto. Haga que el código de SessionCleaner sea más simple. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Comprobación actualizada de consultas colgadas en el script de prueba de clickhouse [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alejandro Kazakov](https://github.com/Akazz)) +- Se eliminaron algunos archivos inútiles del repositorio. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tipo cambiado de perftests matemáticos de `once` a `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Agregue una imagen acoplable que permite construir un informe HTML del navegador de código interactivo para nuestra base de código. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin)) Ver [Navegador de código Woboq](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) +- Suprima algunas fallas de prueba bajo MSan. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Aceleración “exception while insert” prueba. Esta prueba a menudo se agota en la compilación de depuración con cobertura. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualizar `libcxx` y `libcxxabi` dominar. En preparación para [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reparar la prueba de flacky `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Limpie las banderas duplicadas del vinculador. Asegúrese de que el enlazador no busque un símbolo inesperado. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos pájaro](https://github.com/amosbird)) +- Añadir `clickhouse-odbc` conductor en imágenes de prueba. Esto permite probar la interacción de ClickHouse con ClickHouse a través de su propio controlador ODBC. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) +- Corregir varios errores en las pruebas unitarias. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) +- Permitir `-Wmissing-include-dirs` Advertencia de GCC para eliminar todas las incluidas no existentes, principalmente como resultado de errores de scripting de CMake [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) +- Describa las razones si el generador de perfiles de consultas no puede funcionar. Esto está destinado a [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualice OpenSSL al maestro ascendente. Se ha solucionado el problema cuando las conexiones TLS pueden fallar con el mensaje `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` y `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. El problema estaba presente en la versión 20.1. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualizar Dockerfile para el servidor [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) +- Correcciones menores en el script build-gcc-from-sources [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) +- Reemplazar `numbers` a `zeros` en perftests donde `number` no se utiliza la columna. Esto conducirá a resultados de pruebas más limpios. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Solucione el problema de desbordamiento de pila al usar initializer\_list en los constructores de columnas. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Usuario eliminado](https://github.com/ghost)) +- Actualizar librdkafka a v1.3.0. Habilitar incluido `rdkafka` y `gsasl` bibliotecas en Mac OS X. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrés Onyshchuk](https://github.com/oandrew)) +- corrección de compilación en GCC 9.2.0 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) + +## Lanzamiento De ClickHouse V20.1 {#clickhouse-release-v20-1} + +### Todos Los Derechos Reservados {#clickhouse-release-v20-1-8-41-2020-03-20} + +#### Corrección De Errores {#bug-fix-3} + +- Arreglar posible permanente `Cannot schedule a task` error (debido a una excepción no controlada en `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). Esto corrige [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) +- Corregir el consumo excesivo de memoria en `ALTER` consultas (mutaciones). Esto corrige [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) y [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) +- Corregir un error en las citas inversas en diccionarios externos DDL. Esto corrige [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) + +### Todos Los Derechos Reservados {#clickhouse-release-v20-1-7-38-2020-03-18} + +#### Corrección De Errores {#bug-fix-4} + +- Se corrigieron los nombres de funciones internas incorrectos para `sumKahan` y `sumWithOverflow`. Conduzco a una excepción mientras uso estas funciones en consultas remotas. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). Este problema estaba en todas las versiones de ClickHouse. +- Permitir `ALTER ON CLUSTER` de `Distributed` tablas con replicación interna. Esto corrige [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). Este problema estaba en todas las versiones de ClickHouse. +- Corregir posibles excepciones `Size of filter doesn't match size of column` y `Invalid number of rows in Chunk` en `MergeTreeRangeReader`. Podrían aparecer mientras se ejecuta `PREWHERE` en algunos casos. Fijar [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) +- Se solucionó el problema: la zona horaria no se conservaba si escribía una expresión aritmética simple como `time + 1` (en contraste con una expresión como `time + INTERVAL 1 SECOND`). Esto corrige [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). Este problema estaba en todas las versiones de ClickHouse. +- Ahora no es posible crear o agregar columnas con alias cíclicos simples como `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- Se solucionó el problema cuando el relleno al final del valor codificado en base64 puede estar mal formado. Actualización de la biblioteca base64. Esto corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), cerca [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir la carrera de datos en la destrucción de `Poco::HTTPServer`. Podría suceder cuando el servidor se inicia y se apaga inmediatamente. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir un posible bloqueo / número incorrecto de filas en `LIMIT n WITH TIES` cuando hay muchas filas iguales a n’th row. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([Tavplubix](https://github.com/tavplubix)) +- Corregir posibles sumas de comprobación no coincidentes con TTL de columna. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Corregir el bloqueo cuando un usuario intenta `ALTER MODIFY SETTING` para viejos `MergeTree` familia de motores de mesa. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- Ahora intentaremos finalizar las mutaciones con más frecuencia. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- Corregir la incompatibilidad del protocolo de replicación introducida en [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- Fix not(has()) para el índice bloom\_filter de los tipos de matriz. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([chimbab](https://github.com/achimbab)) +- Se corrigió el comportamiento de `match` y `extract` funciona cuando haystack tiene cero bytes. El comportamiento era incorrecto cuando el pajar era constante. Esto corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-1} + +- El manejo de excepciones ahora funciona correctamente en el subsistema Windows para Linux. Consulte https://github.com/ClickHouse-Extras/libunwind/pull/3 Esto corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) + +### Todos Los Derechos Reservados {#clickhouse-release-v20-1-6-30-2020-03-05} + +#### Corrección De Errores {#bug-fix-5} + +- Corregir la incompatibilidad de datos cuando se comprime con `T64` códec. + [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) +- Corregir el orden de los rangos mientras se lee de la tabla MergeTree en un hilo. Fijar [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). + [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) +- Arreglar posible segfault en `MergeTreeRangeReader`, mientras se ejecuta `PREWHERE`. Fijar [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). + [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) +- Fijar `reinterpretAsFixedString` devolver `FixedString` en lugar de `String`. + [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) +- Fijar `joinGet` con tipos de devolución anulables. Fijar [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) + [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) +- Repare la prueba de fuzz y el comportamiento incorrecto de las funciones bitTestAll / bitTestAny. + [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Corrige el comportamiento de las funciones de coincidencia y extracción cuando haystack tiene cero bytes. El comportamiento era incorrecto cuando el pajar era constante. Fijar [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) + [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Se corrigió la ejecución de predicados invertidos cuando se usa un índice funcional no estrictamente monotínico. Fijar [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) + [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz))](https://github.com/Akazz) +- Permitir reescribir `CROSS` a `INNER JOIN` si hay `[NOT] LIKE` operador en `WHERE` apartado. Fijar [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) + [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) +- Permitir que las primeras columnas de una tabla con Log engine sean un alias. + [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) +- Permitir la combinación de coma con `IN()` dentro. Fijar [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). + [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) +- Mejorar `ALTER MODIFY/ADD` consultas lógica. Ahora no puedes `ADD` sin tipo, `MODIFY` expresión predeterminada no cambia el tipo de columna y `MODIFY` type no pierde el valor de expresión predeterminado. Fijar [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). + [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) +- Fijar la finalización de las mutaciones, cuando la mutación ya hecha puede tener el estado is\_done = 0. + [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) +- Apoyo “Processors” tubería para el sistema.números y sistema.numbers\_mt. Esto también corrige el error cuando `max_execution_time` no se respeta. + [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- Corregir el conteo incorrecto de `DictCacheKeysRequestedFound` métrica. + [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) +- Se agregó una verificación de la política de almacenamiento en `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` que de lo contrario podría hacer que los datos de la parte sean inaccesibles después del reinicio y evitar que se inicie ClickHouse. + [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) +- Informe UBSan fijo en `MergeTreeIndexSet`. Esto corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) + [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Corrige un posible registro de datos en BlockIO. + [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- Soporte para `UInt64` números que no caben en Int64 en funciones relacionadas con JSON. Actualizar `SIMDJSON` dominar. Esto corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) + [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Solucione el problema cuando la cantidad de espacio libre no se calcula correctamente si el directorio de datos está montado en un dispositivo separado. Para el disco predeterminado, calcule el espacio libre del subdirectorio de datos. Esto corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) + [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) +- Solucione el problema cuando las conexiones TLS pueden fallar con el mensaje `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Actualice OpenSSL al maestro ascendente. + [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Al ejecutar `CREATE` consulta, doblar expresiones constantes en argumentos del motor de almacenamiento. Reemplace el nombre de la base de datos vacía con la base de datos actual. Fijar [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). También corrija la comprobación de la dirección local en ClickHouseDictionarySource. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Arreglar segfault en `StorageMerge`, que puede suceder al leer de StorageFile. + [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) +- Evitar la pérdida de datos en `Kafka` en casos raros cuando la excepción ocurre después de leer el sufijo pero antes de confirmar. Fijar [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Relacionados: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Corregir un error que conduce a la terminación del servidor al intentar usar / soltar `Kafka` tabla creada con parámetros incorrectos. Fijar [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporar [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) + +#### Novedad {#new-feature-1} + +- Añadir `deduplicate_blocks_in_dependent_materialized_views` opción para controlar el comportamiento de las inserciones idempotentes en tablas con vistas materializadas. Esta nueva característica se agregó a la versión de corrección de errores mediante una solicitud especial de Altinity. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### Todos Los Derechos Reservados {#clickhouse-release-v20-1-2-4-2020-01-22} + +#### Cambio Incompatible Hacia atrás {#backward-incompatible-change-1} + +- Haga el ajuste `merge_tree_uniform_read_distribution` obsoleto. El servidor aún reconoce esta configuración, pero no tiene ningún efecto. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tipo de retorno cambiado de la función `greatCircleDistance` a `Float32` porque ahora el resultado del cálculo es `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora se espera que los parámetros de consulta estén representados en “escaped” formato. Por ejemplo, para pasar una cadena `ab` tienes que escribir `a\tb` o `a\b` y respectivamente, `a%5Ctb` o `a%5C%09b` en URL. Esto es necesario para agregar la posibilidad de pasar NULL como `\N`. Esto corrige [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Permitir `use_minimalistic_part_header_in_zookeeper` establecimiento de `ReplicatedMergeTree` predeterminada. Esto reducirá significativamente la cantidad de datos almacenados en ZooKeeper. Esta configuración es compatible desde la versión 19.1 y ya la usamos en producción en múltiples servicios sin problemas durante más de medio año. Deshabilite esta configuración si tiene la posibilidad de cambiar a versiones anteriores a 19.1. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Los índices de omisión de datos están listos para producción y están habilitados de forma predeterminada. Configuración `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` y `allow_experimental_multiple_joins_emulation` ahora están obsoletos y no hacen nada. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir nuevo `ANY JOIN` lógica para `StorageJoin` consistente con `JOIN` operación. Para actualizar sin cambios en el comportamiento, necesita agregar `SETTINGS any_join_distinct_right_table_keys = 1` a Engine Unir metadatos de tablas o volver a crear estas tablas después de la actualización. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) +- Requiere que el servidor se reinicie para aplicar los cambios en la configuración de registro. Esta es una solución temporal para evitar el error en el que el servidor inicia sesión en un archivo de registro eliminado (consulte [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alejandro Kuzmenkov](https://github.com/akuzm)) + +#### Novedad {#new-feature-2} + +- Se agregó información sobre las rutas de acceso de piezas a `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Añadir capacidad de ejecutar `SYSTEM RELOAD DICTIONARY` consulta en `ON CLUSTER` modo. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Añadir capacidad de ejecutar `CREATE DICTIONARY` consultas en `ON CLUSTER` modo. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) +- Ahora el perfil del usuario en `users.xml` puede heredar varios perfiles. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Añadir `system.stack_trace` tabla que permite ver los rastros de pila de todos los hilos del servidor. Esto es útil para los desarrolladores para examinar el estado del servidor. Esto corrige [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `DateTime64` tipo de datos con una precisión de subsegundo configurable. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) +- Agregar función de tabla `clusterAllReplicas` que permite consultar todos los nodos en el clúster. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([mujer madura](https://github.com/kiransunkari)) +- Agregar función agregada `categoricalInformationValue` que calcula el valor de información de una entidad discreta. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([Hcz](https://github.com/hczhcz)) +- Acelerar el análisis de archivos de datos en `CSV`, `TSV` y `JSONEachRow` formato haciéndolo en paralelo. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Añadir función `bankerRound` que realiza el redondeo del banquero. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([Hcz](https://github.com/hczhcz)) +- Soporta más idiomas en el diccionario incrustado para nombres de región: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejoras en la consistencia de `ANY JOIN` lógica. Ahora `t1 ANY LEFT JOIN t2` igual `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir ajuste `any_join_distinct_right_table_keys` que permite un comportamiento antiguo para `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir nuevo `SEMI` y `ANTI JOIN`. Antiguo `ANY INNER JOIN` comportamiento ahora disponible como `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir `Distributed` formato para `File` motor y `file` función de mesa que permite leer desde `.bin` archivos generados por inserciones asincrónicas en `Distributed` tabla. [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Agregar argumento de columna de reinicio opcional para `runningAccumulate` que permite restablecer los resultados de agregación para cada nuevo valor clave. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) +- Agregue la capacidad de usar ClickHouse como punto final Prometheus. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) +- Añadir sección `` en `config.xml` que restringe los hosts permitidos para motores de tabla remotos y funciones de tabla `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) +- Función añadida `greatCircleAngle` que calcula la distancia en una esfera en grados. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se ha cambiado el radio de la Tierra para que sea consistente con la biblioteca H3. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `JSONCompactEachRow` y `JSONCompactEachRowWithNamesAndTypes` Formatos de entrada y salida. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) +- Característica agregada para motores de tablas relacionados con archivos y funciones de tabla (`File`, `S3`, `URL`, `HDFS`) que permite leer y escribir `gzip` archivos basados en el parámetro del motor adicional o extensión de archivo. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) +- Se agregó el `randomASCII(length)` función, generando una cadena con un conjunto aleatorio de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caracteres imprimibles. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([Bayoneta](https://github.com/BayoNet)) +- Función añadida `JSONExtractArrayRaw` que devuelve una matriz en elementos de matriz json no analizados de `JSON` cadena. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) +- Añadir `arrayZip` función que permite combinar múltiples matrices de longitudes iguales en una matriz de tuplas. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([Invierno Zhang](https://github.com/zhang2014)) +- Agregue la capacidad de mover datos entre discos de acuerdo con la configuración `TTL`-expresiones para `*MergeTree` familia de motores de mesa. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Se agregó una nueva función de agregado `avgWeighted` que permite calcular el promedio ponderado. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) +- Ahora el análisis paralelo está habilitado de forma predeterminada para `TSV`, `TSKV`, `CSV` y `JSONEachRow` formato. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Añadir varias funciones geográficas de `H3` biblioteca: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` y `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) +- Añadido soporte para brotli (`br`) compresión en almacenes relacionados con archivos y funciones de tabla. Esto corrige [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Añadir `groupBit*` funciones para el `SimpleAggregationFunction` tipo. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Corrección De Errores {#bug-fix-6} + +- Corregir el cambio de nombre de las tablas con `Distributed` motor. Soluciona el problema [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([Tavplubix](https://github.com/tavplubix)) +- Ahora diccionarios de apoyo `EXPRESSION` para atributos en cadena arbitraria en dialecto SQL no ClickHouse. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- Arreglar roto `INSERT SELECT FROM mysql(...)` consulta. Esto corrige [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) y [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([Tavplubix](https://github.com/tavplubix)) +- Corregir error “Mismatch column sizes” al insertar el valor predeterminado `Tuple` de `JSONEachRow`. Esto corrige [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([Tavplubix](https://github.com/tavplubix)) +- Ahora se lanzará una excepción en caso de usar `WITH TIES` junto `LIMIT BY`. También agregue la capacidad de usar `TOP` con `LIMIT BY`. Esto corrige [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Repara la dependencia del superintendente de la nueva versión de glibc en `clickhouse-odbc-bridge` binario. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos pájaro](https://github.com/amosbird)) +- Corregir error en la función de verificación de `*MergeTree` familia de motores. Ahora no falla en caso de que tengamos la misma cantidad de filas en el último gránulo y la última marca (no final). [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) +- Fijar el inserto en `Enum*` columnas después `ALTER` consulta, cuando el tipo numérico subyacente es igual al tipo especificado en la tabla. Esto corrige [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) +- Negativo no constante permitido “size” argumento para la función `substring`. No fue permitido por error. Esto corrige [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir el error de análisis cuando se pasa un número incorrecto de argumentos a `(O|J)DBC` motor de mesa. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) +- Usar el nombre de comando del proceso de clickhouse en ejecución al enviar registros a syslog. En versiones anteriores, se usaba una cadena vacía en lugar del nombre del comando. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) +- Corregir la comprobación de hosts permitidos para `localhost`. Este PR corrige la solución proporcionada en [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- Arreglar accidente raro en `argMin` y `argMax` funciones para argumentos de cadena larga, cuando el resultado se usa en `runningAccumulate` función. Esto corrige [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinosaurio](https://github.com/769344359)) +- Repara el sobrecompromiso de memoria para tablas con `Buffer` motor. [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) +- Se corrigió un error potencial en las funciones que pueden tomar `NULL` como uno de los argumentos y devuelve no NULL. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejores cálculos de métricas en el grupo de subprocesos para procesos en segundo plano para `MergeTree` motores de mesa. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fijar la función `IN` dentro `WHERE` declaración cuando el filtro de tabla de nivel de fila está presente. Fijar [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([Ivan](https://github.com/abyss7)) +- Ahora se lanza una excepción si el valor integral no se analiza completamente para los valores de configuración. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) +- Solucionar la excepción cuando se utiliza la función de agregado en la consulta a la tabla distribuida con más de dos fragmentos locales. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Ahora el filtro bloom puede manejar matrices de longitud cero y no realiza cálculos redundantes. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([chimbab](https://github.com/achimbab)) +- Se corrigió la comprobación de si se permite un host cliente al hacer coincidir el host cliente con `host_regexp` especificado en `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) +- Relax comprobación de columna ambigua que conduce a falsos positivos en múltiples `JOIN ON` apartado. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió un posible bloqueo del servidor (`std::terminate`) cuando el servidor no puede enviar o escribir datos en `JSON` o `XML` formato con valores de `String` (tipo de datos que requieren `UTF-8` validación) o al comprimir datos de resultados con el algoritmo Brotli o en algunos otros casos raros. Esto corrige [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir la condición de carrera en `StorageDistributedDirectoryMonitor` encontrado por CI. Esto corrige [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ahora el fondo se fusiona en `*MergeTree` familia de motores de mesa preservar el orden de volumen de políticas de almacenamiento con mayor precisión. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Ahora motor de mesa `Kafka` funciona correctamente con `Native` formato. Esto corrige [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Formatos fijos con encabezados (como `CSVWithNames`) que lanzaban una excepción sobre EOF para el motor de tabla `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Se corrigió un error con la creación de conjunto de subconsulta en la parte derecha de `IN` apartado. Esto corrige [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) y [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Solucionar un posible bloqueo al leer desde el almacenamiento `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Lectura fija de los archivos en `Parquet` formato que contiene columnas de tipo `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([Más información](https://github.com/maxulan)) +- Corregir error `Not found column` para consultas distribuidas con `PREWHERE` condición depende de la clave de muestreo si `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir error `Not found column` si se utiliza la consulta `PREWHERE` depende del alias de la tabla y el conjunto de resultados estaba vacío debido a la condición de la clave principal. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Tipo de retorno fijo para funciones `rand` y `randConstant` en caso de `Nullable` argumento. Ahora las funciones siempre regresan `UInt32` y nunca `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Inversión de predicado deshabilitada para `WITH FILL` expresion. Esto corrige [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([Invierno Zhang](https://github.com/zhang2014)) +- Corregido incorrecto `count()` resultado para `SummingMergeTree` cuando `FINAL` se utiliza la sección. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Corregir posible resultado incorrecto para funciones constantes de servidores remotos. Sucedió para consultas con funciones como `version()`, `uptime()`, sucesivamente. que devuelve diferentes valores constantes para diferentes servidores. Esto corrige [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir un error complicado en la optimización de predicados push-down que conduce a resultados incorrectos. Esto soluciona muchos problemas en la optimización de predicados push-down. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([Invierno Zhang](https://github.com/zhang2014)) +- Fix crash en `CREATE TABLE .. AS dictionary` consulta. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) +- Varias mejoras en la gramática ClickHouse `.g4` file. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) +- Corregir un error que conduce a bloqueos en `JOIN`s con mesas con motor `Join`. Esto corrige [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) +- Repara la recarga de diccionarios redundantes en `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) +- Limitar el número máximo de secuencias para leer desde `StorageFile` y `StorageHDFS`. Correcciones https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- Corregir error en `ALTER ... MODIFY ... CODEC` consulta, cuando el usuario especifica tanto la expresión predeterminada como el códec. Fijar [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) +- Corregir error en la fusión de fondo de columnas con `SimpleAggregateFunction(LowCardinality)` tipo. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Tipo fijo comprobar en función `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) +- Ahora el servidor no se bloquea `LEFT` o `FULL JOIN` con y Unirse al motor y no soportado `join_use_nulls` configuración. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) +- Ahora `DROP DICTIONARY IF EXISTS db.dict` la consulta no arroja una excepción si `db` no existe. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corregir posibles bloqueos en las funciones de la tabla (`file`, `mysql`, `remote`) causado por el uso de la referencia a eliminado `IStorage` objeto. Corregir el análisis incorrecto de las columnas especificadas en la inserción en la función de la tabla. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([Tavplubix](https://github.com/tavplubix)) +- Asegúrese de que la red esté activa antes de comenzar `clickhouse-server`. Esto corrige [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) +- Corregir el manejo de los tiempos de espera para conexiones seguras, por lo que las consultas no se cuelgan indefenitamente. Esto corrige [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar `clickhouse-copier`contención despedida entre trabajadores concurrentes. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Más información](https://github.com/dingxiangfei2009)) +- Ahora las mutaciones no omiten las partes adjuntas, incluso si su versión de mutación fuera más grande que la versión de mutación actual. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- Ignore copias redundantes de `*MergeTree` partes de datos después de pasar a otro disco y reiniciar el servidor. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix crash en `FULL JOIN` con `LowCardinality` en `JOIN` clave. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) +- Prohibido usar el nombre de columna más de una vez en la consulta de inserción como `INSERT INTO tbl (x, y, x)`. Esto corrige [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) +- Se agregó respaldo para detectar el número de núcleos de CPU físicos para CPU desconocidas (usando el número de núcleos de CPU lógicos). Esto corrige [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar `There's no column` error para columnas materializadas y alias. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) +- Se corrigió el bloqueo de corte cuando `EXISTS` consulta se utilizó sin `TABLE` o `DICTIONARY` calificador. Como `EXISTS t`. Esto corrige [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). Este error se introdujo en la versión 19.17. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir error raro con error `"Sizes of columns doesn't match"` que podrían aparecer al usar `SimpleAggregateFunction` columna. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Corregir error donde el usuario con vacío `allow_databases` obtuvo acceso a todas las bases de datos (y lo mismo para `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) +- Solucionar el bloqueo del cliente cuando el servidor ya está desconectado del cliente. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Fijar `ORDER BY` comportamiento en caso de ordenar por prefijo de clave primaria y sufijo de clave no primaria. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) +- Compruebe si la columna calificada está presente en la tabla. Esto corrige [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) +- Comportamiento fijo con `ALTER MOVE` se ejecuta inmediatamente después de la fusión de acabado se mueve superparte de especificado. Fijar [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Solucionar un posible bloqueo del servidor mientras se usa `UNION` con diferente número de columnas. Fijar [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir el tamaño de la subcadena de resultados para la función `substr` con tamaño negativo. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ahora el servidor no ejecuta la mutación de parte en `MergeTree` si no hay suficientes hilos libres en el grupo de fondo. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([Tavplubix](https://github.com/tavplubix)) +- Corregir un error tipográfico menor en el formato `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([Litao91](https://github.com/litao91)) +- Se corrigieron los resultados incorrectos del filtro de floración para los números negativos. Esto corrige [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([Invierno Zhang](https://github.com/zhang2014)) +- Desbordamiento de búfer potencial fijo en descomprimir. El usuario malicioso puede pasar datos comprimidos fabricados que causarán lectura después del búfer. Este problema fue encontrado por Eldar Zaitov del equipo de seguridad de la información de Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir el resultado incorrecto debido al desbordamiento de enteros en `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ahora `OPTIMIZE TABLE` La consulta no esperará a que las réplicas sin conexión realicen la operación. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) +- Fijo `ALTER TTL` analizador para `Replicated*MergeTree` tabla. [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Corrige la comunicación entre el servidor y el cliente, por lo que el servidor lee la información de las tablas temporales después de un error de consulta. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Fijar `bitmapAnd` error de función al intersecar un mapa de bits agregado y un mapa de bits escalar. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Refinar la definición de `ZXid` de acuerdo con la Guía del Programador ZooKeeper que corrige errores en `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Más información](https://github.com/dingxiangfei2009)) +- `odbc` la función de la tabla ahora respeta `external_table_functions_use_nulls` configuración. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) +- Se corrigió un error que conducía a una rara carrera de datos. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alejandro Kazakov](https://github.com/Akazz)) +- Ahora `SYSTEM RELOAD DICTIONARY` recarga un diccionario completamente, ignorando `update_field`. Esto corrige [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Agregue la capacidad de verificar si el diccionario existe en la consulta de creación. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) +- Fijar `Float*` análisis en `Values` formato. Esto corrige [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([Tavplubix](https://github.com/tavplubix)) +- Solucionar el bloqueo cuando no podemos reservar espacio en algunas operaciones en segundo plano de `*MergeTree` familia de motores de mesa. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Corregir el bloqueo de la operación de fusión cuando la tabla contiene `SimpleAggregateFunction(LowCardinality)` columna. Esto corrige [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) +- Restaure el soporte de todas las configuraciones regionales de la UCI y agregue la capacidad de aplicar intercalaciones para expresiones constantes. También agregue el nombre del idioma a `system.collations` tabla. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- Corregir un error cuando los diccionarios externos con una vida útil mínima cero (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) no actualizar en segundo plano. [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) +- Solucionar el bloqueo cuando el diccionario externo con la fuente ClickHouse tiene una subconsulta en la consulta. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corregir el análisis incorrecto de la extensión de archivo en la tabla con el motor `URL`. Esto corrige [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) +- Fijar `CHECK TABLE` consulta para `*MergeTree` mesas sin llave. Fijar [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- Conversión fija de `Float64` al tipo de MySQL. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) +- Ahora, si la tabla no se eliminó por completo debido a un bloqueo del servidor, el servidor intentará restaurarla y cargarla. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([Tavplubix](https://github.com/tavplubix)) +- Se corrigió el fallo en la función de la tabla `file` mientras se inserta en el archivo que no existe. Ahora, en este caso, se crearía un archivo y luego se procesaría la inserción. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Repara un punto muerto raro que puede ocurrir cuando `trace_log` está habilitado. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Añadir capacidad de trabajar con diferentes tipos además `Date` en `RangeHashed` diccionario externo creado a partir de consulta DDL. Fijar [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- Corrige el bloqueo cuando `now64()` se llama con el resultado de otra función. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) +- Se corrigió un error con la detección de IP del cliente para las conexiones a través del protocolo de cable mysql. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) +- Repara el manejo de matrices vacías en `arraySplit` función. Esto corrige [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([Hcz](https://github.com/hczhcz)) +- Se corrigió el problema cuando `pid-file` de otra carrera `clickhouse-server` puede ser eliminado. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) +- Repara la recarga del diccionario si tiene `invalidate_query`, que detuvo las actualizaciones y alguna excepción en los intentos de actualización anteriores. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) +- Corregido el error en la función `arrayReduce` que puede conducir a “double free” y error en el combinador de funciones agregadas `Resample` que puede conducir a la pérdida de memoria. Función agregada agregada `aggThrow`. Esta función se puede utilizar para fines de prueba. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora {#improvement-1} + +- Registro mejorado cuando se trabaja con `S3` motor de mesa. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Mensaje de ayuda impreso cuando no se pasan argumentos al llamar `clickhouse-local`. Esto corrige [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) +- Añadir ajuste `mutations_sync` que permite esperar `ALTER UPDATE/DELETE` consultas sincrónicamente. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) +- Permitir configurar relativo `user_files_path` en `config.xml` (en la forma similar a `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([Hcz](https://github.com/hczhcz)) +- Agregue una excepción para tipos ilegales para funciones de conversión con `-OrZero` postfix. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Simplifique el formato del encabezado de los datos que se envían a un fragmento en una consulta distribuida. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) +- `Live View` refactorización del motor de mesa. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) +- Agregue comprobaciones adicionales para diccionarios externos creados a partir de consultas DDL. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) +- Corregir error `Column ... already exists` mientras usa `FINAL` y `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Fijar [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ahora tabla el primer argumento de `joinGet` la función puede ser indentificador de tabla. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos pájaro](https://github.com/amosbird)) +- Permitir usar `MaterializedView` con subconsultas anteriores `Kafka` tabla. [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) +- Ahora el fondo se mueve entre discos, ejecuta el grupo de subprocesos seprate. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) +- `SYSTEM RELOAD DICTIONARY` ahora se ejecuta sincrónicamente. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) +- Los rastros de pila ahora muestran direcciones físicas (desconectados en el archivo de objeto) en lugar de direcciones de memoria virtual (donde se cargó el archivo de objeto). Eso permite el uso de `addr2line` cuando binary es independiente de la posición y ASLR está activo. Esto corrige [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soporte nueva sintaxis para filtros de seguridad de nivel de fila: `
`. Fijar [\#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [\#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([Ivan](https://github.com/abyss7)) +- Ahora `cityHash` función puede trabajar con `Decimal` y `UUID` tipo. Fijar [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) +- Se eliminó la granularidad de índice fijo (era 1024) de los registros del sistema porque está obsoleto después de la implementación de la granularidad adaptativa. [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Habilitado servidor de compatibilidad MySQL cuando ClickHouse se compila sin SSL. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) +- Ahora las sumas de comprobación del servidor distribuyen lotes, lo que da más errores detallados en caso de datos dañados en el lote. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) +- Apoyo `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` y `ATTACH TABLE` para `MySQL` motor de base de datos. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([Invierno Zhang](https://github.com/zhang2014)) +- Agregue autenticación en la función de tabla S3 y el motor de tabla. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Añadido cheque para piezas adicionales de `MergeTree` en diferentes discos, para no permitir perder partes de datos en discos indefinidos. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Habilite el soporte SSL para el cliente y el servidor de Mac. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([Ivan](https://github.com/abyss7)) +- Ahora ClickHouse puede funcionar como servidor federado de MySQL (consulte https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html ). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- `clickhouse-client` ahora sólo habilitar `bracketed-paste` cuando multiquery está encendido y multilínea está apagado. Esto corrige (\#7757)\[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos pájaro](https://github.com/amosbird)) +- Apoyo `Array(Decimal)` en `if` función. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) +- Decimales de apoyo en `arrayDifference`, `arrayCumSum` y `arrayCumSumNegative` función. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) +- Añadir `lifetime` columna a `system.dictionaries` tabla. [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) +- Comprobación mejorada de piezas existentes en diferentes discos para `*MergeTree` motores de mesa. Dirección [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Integración con `AWS SDK` para `S3` interacciones que permite utilizar todas las características de S3 fuera de la caja. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) +- Se agregó soporte para subconsultas en `Live View` tabla. [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) +- Compruebe si el uso `Date` o `DateTime` columna de `TTL` expresiones se eliminó. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Se agregó información sobre el disco a `system.detached_parts` tabla. [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Ahora configuración `max_(table|partition)_size_to_drop` se puede cambiar sin reiniciar. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Ligeramente mejor usabilidad de los mensajes de error. Pida al usuario que no elimine las siguientes líneas `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejor lectura de mensajes de `Kafka` motor en varios formatos después de [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([Ivan](https://github.com/abyss7)) +- Mejor compatibilidad con clientes MySQL que no admiten `sha2_password` complemento auth. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) +- Soporta más tipos de columnas en el servidor de compatibilidad MySQL. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) +- Implementar `ORDER BY` optimización para `Merge`, `Buffer` y `Materilized View` almacenamientos con subyacente `MergeTree` tabla. [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) +- Ahora siempre usamos la implementación POSIX de `getrandom` para tener una mejor compatibilidad con los núcleos antiguos (\<3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos pájaro](https://github.com/amosbird)) +- Es mejor comprobar si hay un destino válido en una regla TTL de movimiento. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Mejores controles de lotes de inserción rotos para `Distributed` motor de mesa. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) +- Agregue una columna con una matriz de nombres de partes para qué mutaciones deben procesar en el futuro `system.mutations` tabla. [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) +- Optimización de ordenación de combinación paralela para procesadores. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Configuración `mark_cache_min_lifetime` ahora está obsoleto y no hace nada. En versiones anteriores, la caché de marcas puede crecer en la memoria más grande que `mark_cache_size` para acomodar datos dentro de `mark_cache_min_lifetime` segundo. Eso provocó confusión y un mayor uso de memoria de lo esperado, lo que es especialmente malo en los sistemas con restricciones de memoria. Si observa una degradación del rendimiento después de instalar esta versión, debe aumentar la `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Preparación para usar `tid` doquier. Esto es necesario para [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Mejora Del Rendimiento {#performance-improvement-1} + +- Optimizaciones de rendimiento en la canalización de procesadores. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Actualizaciones sin bloqueo de claves caducadas en diccionarios de caché (con permiso para leer las antiguas). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Compilar ClickHouse sin `-fno-omit-frame-pointer` a nivel mundial para ahorrar un registro más. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos pájaro](https://github.com/amosbird)) +- Aceleración `greatCircleDistance` función y añadir pruebas de rendimiento para ello. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) +- Rendimiento mejorado de la función `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Rendimiento mejorado de `max`, `min`, `argMin`, `argMax` para `DateTime64` tipo de datos. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) +- Rendimiento mejorado de la clasificación sin límite o con límite grande y clasificación externa. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Rendimiento mejorado de formatear números de coma flotante hasta 6 veces. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Rendimiento mejorado de `modulo` función. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos pájaro](https://github.com/amosbird)) +- Optimizar `ORDER BY` y fusionándose con la clave de una sola columna. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mejor implementación para `arrayReduce`, `-Array` y `-State` combinadores. [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos pájaro](https://github.com/amosbird)) +- Ahora `PREWHERE` debe ser optimizado para ser al menos tan eficiente como `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos pájaro](https://github.com/amosbird)) +- Mejorar el camino `round` y `roundBankers` manejo de números negativos. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([Hcz](https://github.com/hczhcz)) +- Rendimiento de decodificación mejorado de `DoubleDelta` y `Gorilla` códecs en aproximadamente un 30-40%. Esto corrige [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) +- Rendimiento mejorado de `base64` funciones relacionadas. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se agregó una función `geoDistance`. Es similar a `greatCircleDistance` pero utiliza la aproximación al modelo elipsoide WGS-84. El rendimiento de ambas funciones son casi iguales. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Más rápido `min` y `max` funciones de agregación para `Decimal` tipo de datos. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) +- Vectorizar el procesamiento `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos pájaro](https://github.com/amosbird)) +- `if` las cadenas ahora están optimizadas como `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) +- Corregir la regresión de rendimiento de `Kafka` motor de mesa introducido en 19.15. Esto corrige [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) +- Quitar “pie” generación de código que `gcc` de paquetes Debian trae ocasionalmente por defecto. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Formatos de datos de análisis paralelo [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Habilitar analizador optimizado de `Values` con expresiones por defecto (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([Tavplubix](https://github.com/tavplubix)) + +#### Mejora De La construcción/prueba/empaquetado {#buildtestingpackaging-improvement-2} + +- Construir correcciones para `ARM` y en modo mínimo. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([propulsor](https://github.com/proller)) +- Añadir archivo de cobertura al ras para `clickhouse-server` cuando std::atexit no se llama. También mejoró ligeramente el registro en pruebas sin estado con cobertura. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) +- Actualizar la biblioteca LLVM en contrib. Evite usar LLVM de paquetes de sistema operativo. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hacer incluido `curl` construir completamente tranquilo. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) +- Arreglar algunos `MemorySanitizer` las advertencias. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Utilizar `add_warning` y `no_warning` macros en `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([Ivan](https://github.com/abyss7)) +- Agregue soporte del objeto Compatible Minio S3 (https://min.io/) para mejores pruebas de integración. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) +- Importar `libc` encabezados a contrib. Permite hacer que las compilaciones sean más consistentes en varios sistemas (solo para `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Quitar `-fPIC` de algunas bibliotecas. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Limpiar `CMakeLists.txt` para el rizo. Ver https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Advertencias silenciosas en `CapNProto` biblioteca. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Agregue pruebas de rendimiento para tablas hash optimizadas de cadenas cortas. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos pájaro](https://github.com/amosbird)) +- Ahora ClickHouse se basará en `AArch64` aunque `MADV_FREE` no está disponible. Esto corrige [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos pájaro](https://github.com/amosbird)) +- Actualizar `zlib-ng` para solucionar problemas de desinfectante de memoria. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Habilite la biblioteca MySQL interna en sistemas que no son Linux, porque el uso de paquetes de sistemas operativos es muy frágil y generalmente no funciona en absoluto. Esto corrige [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se corrigió la compilación en algunos sistemas después de habilitar `libc++`. Esto reemplaza [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hacer `Field` métodos más seguros para encontrar más errores. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Añadido archivos que faltan a la `libc-headers` submódulo. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Arreglar mal `JSON` cita en la salida de prueba de rendimiento. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ahora se muestra el seguimiento de pila para `std::exception` y `Poco::Exception`. En versiones anteriores sólo estaba disponible para `DB::Exception`. Esto mejora el diagnóstico. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Portabilidad `clock_gettime` y `clock_nanosleep` para versiones glibc frescas. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos pájaro](https://github.com/amosbird)) +- Permitir `part_log` en ejemplo config para desarrolladores. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Corregir la naturaleza asíncrona de la recarga en `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) +- Se corrigieron las pruebas de rendimiento del códec. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) +- Agregar scripts de instalación para `.tgz` y documentación para ellos. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) +- Eliminado viejo `ZSTD` prueba (fue creado en el año 2016 para reproducir el error que ha tenido la versión pre 1.0 de ZSTD). Esto corrige [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Estructura fija en Mac OS Catalina. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) +- Mayor número de filas en las pruebas de rendimiento del códec para que los resultados se noten. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) +- En compilaciones de depuración, trate `LOGICAL_ERROR` excepciones como fallas de aserción, por lo que son más fáciles de notar. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Haga que la prueba de rendimiento relacionada con los formatos sea más determinista. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualizar `lz4` para solucionar un error de MemorySanitizer. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Suprima un falso positivo MemorySanitizer conocido en el control de excepciones. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Actualizar `gcc` y `g++` a la versión 9 en `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) +- Agregue un caso de prueba de rendimiento para probar eso `PREWHERE` es peor que `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos pájaro](https://github.com/amosbird)) +- Progreso hacia la fijación de una prueba flacky. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Evite el informe MemorySanitizer para los datos de `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Actualizar `libc++` a la última versión. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Construir la biblioteca de la UCI a partir de fuentes. Esto corrige [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cambiado de `libressl` a `openssl`. ClickHouse debe admitir TLS 1.3 y SNI después de este cambio. Esto corrige [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Informe UBSan fijo al usar `chacha20_poly1305` de SSL (sucede al conectarse a https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Modo de reparación del archivo de contraseña predeterminado para `.deb` distribuciones de linux. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([propulsor](https://github.com/proller)) +- Expresión mejorada para obtener `clickhouse-server` PID en `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alejandro Kazakov](https://github.com/Akazz)) +- Actualizado contrib / googletest a v1.10.0. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alejandro Burmak](https://github.com/Alex-Burmak)) +- Informe de ThreadSaninitizer fijo en `base64` biblioteca. También actualizó esta biblioteca a la última versión, pero no importa. Esto corrige [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fijar `00600_replace_running_query` para procesadores. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Eliminar soporte para `tcmalloc` hacer `CMakeLists.txt` más simple. [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Lanzamiento gcc construye ahora uso `libc++` en lugar de `libstdc++`. Recientemente `libc++` fue utilizado sólo con clang. Esto mejorará la coherencia de las configuraciones de compilación y la portabilidad. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Habilite la biblioteca de ICU para compilar con MemorySanitizer. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Suprimir advertencias de `CapNProto` biblioteca. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Se eliminaron casos especiales de código para `tcmalloc`, porque ya no es compatible. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- En la tarea de cobertura de CI, elimine el servidor con elegancia para permitirle guardar el informe de cobertura. Esto corrige los informes de cobertura incompletos que hemos estado viendo últimamente. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) +- Pruebas de rendimiento para todos los códecs contra `Float64` y `UInt64` valor. [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) +- `termcap` está muy en desuso y conduce a varios problemas (por ejemplo, falta “up” tapa y eco `^J` en lugar de la línea multi). Favor `terminfo` o empaquetado `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos pájaro](https://github.com/amosbird)) +- Fijar `test_storage_s3` prueba de integración. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Apoyo `StorageFile(, null)` para insertar el bloque en el archivo de formato dado sin realmente escribir en el disco. Esto es necesario para las pruebas de rendimiento. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos pájaro](https://github.com/amosbird)) +- Argumento añadido `--print-time` a las pruebas funcionales que imprime el tiempo de ejecución por prueba. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Se agregaron afirmaciones a `KeyCondition` mientras evalúa RPN. Esto arreglará la advertencia de gcc-9. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Opciones de volcado cmake en compilaciones de CI. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- No genere información de depuración para algunas bibliotecas de grasa. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hacer `log_to_console.xml` siempre inicie sesión en stderr, independientemente de si es interactivo o no. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alejandro Kuzmenkov](https://github.com/akuzm)) +- Se eliminaron algunas características no utilizadas de `clickhouse-performance-test` herramienta. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ahora también buscaremos `lld-X` con la correspondiente `clang-X` versión. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) +- Parquet construir mejora. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([Más información](https://github.com/maxulan)) +- Más advertencias de GCC [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) +- Paquete para Arch Linux ahora permite ejecutar el servidor ClickHouse, y no sólo el cliente. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Prueba de reparación con procesadores. Pequeñas correcciones de rendimiento. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Actualizar contrib/protobuf. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) +- En preparación para cambiar a c ++ 20 como una celebración de año nuevo. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos pájaro](https://github.com/amosbird)) + +#### Característica Experimental {#experimental-feature-1} + +- Añadido ajuste experimental `min_bytes_to_use_mmap_io`. Permite leer archivos grandes sin copiar datos del kernel al espacio de usuario. La configuración está deshabilitada de forma predeterminada. El umbral recomendado es de aproximadamente 64 MB, porque mmap / munmap es lento. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cuotas reanudadas como parte del sistema de control de acceso. Añadido nueva tabla `system.quotas`, nuevas funciones `currentQuota`, `currentQuotaKey`, nueva sintaxis SQL `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) +- Permitir omitir configuraciones desconocidas con advertencias en lugar de lanzar excepciones. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) +- Se reanudaron las políticas de fila como parte del sistema de control de acceso. Añadido nueva tabla `system.row_policies`, nueva función `currentRowPolicies()`, nueva sintaxis SQL `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Corrección De Seguridad {#security-fix} + +- Se corrigió la posibilidad de leer la estructura de directorios en tablas con `File` motor de mesa. Esto corrige [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## [Registro de cambios para 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/es/whats_new/index.md b/docs/es/whats-new/index.md similarity index 100% rename from docs/es/whats_new/index.md rename to docs/es/whats-new/index.md diff --git a/docs/es/whats-new/roadmap.md b/docs/es/whats-new/roadmap.md new file mode 100644 index 00000000000..97d06733861 --- /dev/null +++ b/docs/es/whats-new/roadmap.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 74 +toc_title: Hoja de ruta +--- + +# Hoja De Ruta {#roadmap} + +## Q1 2020 {#q1-2020} + +- Control de acceso basado en roles + +## Q2 2020 {#q2-2020} + +- Integración con servicios de autenticación externos +- Grupos de recursos para una distribución más precisa de la capacidad del clúster entre los usuarios + +{## [Artículo Original](https://clickhouse.tech/docs/en/roadmap/) ##} diff --git a/docs/es/whats-new/security-changelog.md b/docs/es/whats-new/security-changelog.md new file mode 100644 index 00000000000..306c364f9d9 --- /dev/null +++ b/docs/es/whats-new/security-changelog.md @@ -0,0 +1,76 @@ +--- +machine_translated: true +machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa +toc_priority: 76 +toc_title: Seguridad Changelog +--- + +## Corregido En La versión De ClickHouse 19.14.3.3, 2019-09-10 {#fixed-in-clickhouse-release-19-14-3-3-2019-09-10} + +### CVE-2019-15024 {#cve-2019-15024} + +Аn attacker that has write access to ZooKeeper and who ican run a custom server available from the network where ClickHouse runs, can create a custom-built malicious server that will act as a ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from the malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. + +Créditos: Eldar Zaitov del equipo de seguridad de la información de Yandex + +### CVE-2019-16535 {#cve-2019-16535} + +Аn OOB read, OOB write and integer underflow in decompression algorithms can be used to achieve RCE or DoS via native protocol. + +Créditos: Eldar Zaitov del equipo de seguridad de la información de Yandex + +### CVE-2019-16536 {#cve-2019-16536} + +Un cliente autenticado malintencionado puede desencadenar el desbordamiento de pila que conduce a DoS. + +Créditos: Eldar Zaitov del equipo de seguridad de la información de Yandex + +## Corregido En La versión De ClickHouse 19.13.6.1, 2019-09-20 {#fixed-in-clickhouse-release-19-13-6-1-2019-09-20} + +### CVE-2019-18657 {#cve-2019-18657} + +Función de la tabla `url` la vulnerabilidad permitió al atacante inyectar encabezados HTTP arbitrarios en la solicitud. + +Crédito: [Nikita Tikhomirov](https://github.com/NSTikhomirov) + +## Corregido En La versión De ClickHouse 18.12.13, 2018-09-10 {#fixed-in-clickhouse-release-18-12-13-2018-09-10} + +### CVE-2018-14672 {#cve-2018-14672} + +Las funciones para cargar modelos CatBoost permitieron el recorrido de ruta y la lectura de archivos arbitrarios a través de mensajes de error. + +Créditos: Andrey Krasichkov del equipo de seguridad de la información de Yandex + +## Corregido En La versión De ClickHouse 18.10.3, 2018-08-13 {#fixed-in-clickhouse-release-18-10-3-2018-08-13} + +### CVE-2018-14671 {#cve-2018-14671} + +unixODBC permitía cargar objetos compartidos arbitrarios desde el sistema de archivos, lo que provocó una vulnerabilidad de ejecución remota de código. + +Créditos: Andrey Krasichkov y Evgeny Sidorov del equipo de seguridad de la información de Yandex + +## Corregido En La versión De ClickHouse 1.1.54388, 2018-06-28 {#fixed-in-clickhouse-release-1-1-54388-2018-06-28} + +### CVE-2018-14668 {#cve-2018-14668} + +“remote” función de tabla permitió símbolos arbitrarios en “user”, “password” y “default\_database” campos que llevaron a ataques de falsificación de solicitudes de protocolo cruzado. + +Créditos: Andrey Krasichkov del equipo de seguridad de la información de Yandex + +## Corregido En La versión De ClickHouse 1.1.54390, 2018-07-06 {#fixed-in-clickhouse-release-1-1-54390-2018-07-06} + +### CVE-2018-14669 {#cve-2018-14669} + +ClickHouse cliente MySQL tenía “LOAD DATA LOCAL INFILE” funcionalidad habilitada que permitió a una base de datos MySQL maliciosa leer archivos arbitrarios desde el servidor ClickHouse conectado. + +Créditos: Andrey Krasichkov y Evgeny Sidorov del equipo de seguridad de la información de Yandex + +## Corregido En La versión De ClickHouse 1.1.54131, 2017-01-10 {#fixed-in-clickhouse-release-1-1-54131-2017-01-10} + +### CVE-2018-14670 {#cve-2018-14670} + +Una configuración incorrecta en el paquete deb podría conducir al uso no autorizado de la base de datos. + +Créditos: Centro Nacional de Seguridad Cibernética del Reino Unido (NCSC) + +{## [Artículo Original](https://clickhouse.tech/docs/en/security_changelog/) ##} diff --git a/docs/es/whats_new/changelog/2017.md b/docs/es/whats_new/changelog/2017.md deleted file mode 100644 index 3852de2f640..00000000000 --- a/docs/es/whats_new/changelog/2017.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 79 -toc_title: '2017' ---- - -### Lanzamiento de ClickHouse 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} - -Esta versión contiene correcciones de errores para la versión anterior 1.1.54318: - -- Se corrigió un error con una posible condición de carrera en la replicación que podría conducir a la pérdida de datos. Este problema afecta a las versiones 1.1.54310 y 1.1.54318. Si utiliza una de estas versiones con tablas replicadas, se recomienda encarecidamente la actualización. Este problema se muestra en los registros en mensajes de advertencia como `Part ... from own log doesn't exist.` El problema es relevante incluso si no ve estos mensajes en los registros. - -### Lanzamiento de ClickHouse 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} - -Esta versión contiene correcciones de errores para la versión anterior 1.1.54310: - -- Se corrigieron las eliminaciones de filas incorrectas durante las fusiones en el motor SummingMergeTree -- Se corrigió una pérdida de memoria en los motores MergeTree no duplicados -- Se corrigió la degradación del rendimiento con inserciones frecuentes en los motores MergeTree -- Se corrigió un problema que provocaba que la cola de replicación dejara de ejecutarse -- Rotación y archivado fijos de los registros del servidor - -### Lanzamiento de ClickHouse 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} - -#### Novedad: {#new-features} - -- Clave de partición personalizada para la familia MergeTree de motores de tabla. -- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) motor de mesa. -- Se agregó soporte para cargar [CatBoost](https://catboost.yandex/) modelos y aplicarlos a los datos almacenados en ClickHouse. -- Se agregó soporte para zonas horarias con desplazamientos no enteros de UTC. -- Se agregó soporte para operaciones aritméticas con intervalos de tiempo. -- El intervalo de valores para los tipos Date y DateTime se extiende hasta el año 2105. -- Se agregó el `CREATE MATERIALIZED VIEW x TO y` consulta (especifica una tabla existente para almacenar los datos de una vista materializada). -- Se agregó el `ATTACH TABLE` consulta sin argumentos. -- La lógica de procesamiento para columnas anidadas con nombres que terminan en -Map en una tabla SummingMergeTree se extrajo a la función de agregado sumMap. Ahora puede especificar dichas columnas explícitamente. -- El tamaño máximo del diccionario IP trie se incrementa a 128M entradas. -- Se agregó la función getSizeOfEnumType. -- Se agregó la función agregada sumWithOverflow. -- Se agregó soporte para el formato de entrada Cap'n Proto. -- Ahora puede personalizar el nivel de compresión al usar el algoritmo zstd. - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes} - -- No se permite la creación de tablas temporales con un motor que no sea Memoria. -- No se permite la creación explícita de tablas con el motor View o MaterializedView. -- Durante la creación de la tabla, una nueva comprobación comprueba que la expresión de clave de muestreo está incluida en la clave principal. - -#### Corrección de errores: {#bug-fixes} - -- Se corrigieron bloqueos al insertar sincrónicamente en una tabla distribuida. -- Se corrigió la adición y eliminación no atómica de partes en tablas replicadas. -- Los datos insertados en una vista materializada no están sujetos a una deduplicación innecesaria. -- La ejecución de una consulta en una tabla distribuida para la que la réplica local está rezagada y las réplicas remotas no están disponibles ya no genera ningún error. -- Los usuarios no necesitan permisos de acceso `default` base de datos para crear tablas temporales más. -- Se corrigió el bloqueo al especificar el tipo de matriz sin argumentos. -- Se corrigieron bloqueos cuando el volumen del disco que contiene los registros del servidor está lleno. -- Se corrigió un desbordamiento en la función toRelativeWeekNum para la primera semana de la época de Unix. - -#### Mejoras de construcción: {#build-improvements} - -- Varias bibliotecas de terceros (especialmente Poco) se actualizaron y convirtieron a submódulos de git. - -### Lanzamiento de ClickHouse 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} - -#### Novedad: {#new-features-1} - -- Soporte TLS en el protocolo nativo (para habilitar, establecer `tcp_ssl_port` en `config.xml` ). - -#### Corrección de errores: {#bug-fixes-1} - -- `ALTER` para tablas replicadas ahora intenta comenzar a ejecutarse tan pronto como sea posible. -- Se corrigió el bloqueo al leer datos con la configuración `preferred_block_size_bytes=0.` -- Se corrigieron los bloqueos de `clickhouse-client` al presionar `Page Down` -- Interpretación correcta de ciertas consultas complejas con `GLOBAL IN` y `UNION ALL` -- `FREEZE PARTITION` siempre funciona atómicamente ahora. -- Las solicitudes POST vacías ahora devuelven una respuesta con el código 411. -- Se corrigieron errores de interpretación para expresiones como `CAST(1 AS Nullable(UInt8)).` -- Se ha corregido un error al leer `Array(Nullable(String))` las columnas de `MergeTree` tabla. -- Se corrigió el bloqueo al analizar consultas como `SELECT dummy AS dummy, dummy AS b` -- Los usuarios se actualizan correctamente `users.xml` -- Control correcto cuando un diccionario ejecutable devuelve un código de respuesta distinto de cero. - -### Lanzamiento de ClickHouse 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} - -#### Novedad: {#new-features-2} - -- Se agregó el `pointInPolygon` función para trabajar con coordenadas en un plano de coordenadas. -- Se agregó el `sumMap` función de agregado para calcular la suma de matrices, similar a `SummingMergeTree`. -- Se agregó el `trunc` función. Rendimiento mejorado de las funciones de redondeo (`round`, `floor`, `ceil`, `roundToExp2`) y corrigió la lógica de cómo funcionan. Cambió la lógica del `roundToExp2` función para fracciones y números negativos. -- El archivo ejecutable ClickHouse ahora depende menos de la versión de libc. El mismo archivo ejecutable ClickHouse se puede ejecutar en una amplia variedad de sistemas Linux. Todavía hay una dependencia al usar consultas compiladas (con la configuración `compile = 1` , que no se usa por defecto). -- Se ha reducido el tiempo necesario para la compilación dinámica de consultas. - -#### Corrección de errores: {#bug-fixes-2} - -- Se corrigió un error que a veces producía `part ... intersects previous part` mensajes y la coherencia de réplica debilitada. -- Se corrigió un error que causaba que el servidor se bloqueara si ZooKeeper no estaba disponible durante el apagado. -- Se eliminó el registro excesivo al restaurar réplicas. -- Se corrigió un error en la implementación de UNION ALL. -- Se ha corregido un error en la función concat que se producía si la primera columna de un bloque tiene el tipo Array. -- El progreso ahora se muestra correctamente en el sistema.fusiones tabla. - -### Lanzamiento de ClickHouse 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} - -#### Novedad: {#new-features-3} - -- `SYSTEM` consultas para la administración del servidor: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. -- Funciones añadidas para trabajar con matrices: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. -- Añadir `root` y `identity` parámetros para la configuración de ZooKeeper. Esto le permite aislar usuarios individuales en el mismo clúster de ZooKeeper. -- Funciones agregadas añadidas `groupBitAnd`, `groupBitOr`, y `groupBitXor` (por compatibilidad, también están disponibles bajo los nombres `BIT_AND`, `BIT_OR`, y `BIT_XOR`). -- Los diccionarios externos se pueden cargar desde MySQL especificando un socket en el sistema de archivos. -- Los diccionarios externos se pueden cargar desde MySQL a través de SSL (`ssl_cert`, `ssl_key`, `ssl_ca` parámetros). -- Se agregó el `max_network_bandwidth_for_user` para restringir el uso general del ancho de banda para consultas por usuario. -- Soporte para `DROP TABLE` para tablas temporales. -- Soporte para lectura `DateTime` valores en formato de marca de tiempo Unix desde el `CSV` y `JSONEachRow` formato. -- Las réplicas rezagadas en las consultas distribuidas ahora se excluyen de forma predeterminada (el umbral predeterminado es de 5 minutos). -- El bloqueo FIFO se usa durante ALTER: una consulta ALTER no se bloquea indefinidamente para consultas que se ejecutan continuamente. -- Opción para establecer `umask` en el archivo de configuración. -- Rendimiento mejorado para consultas con `DISTINCT` . - -#### Corrección de errores: {#bug-fixes-3} - -- Se ha mejorado el proceso de eliminación de nodos antiguos en ZooKeeper. Anteriormente, los nodos antiguos a veces no se eliminaban si había inserciones muy frecuentes, lo que hacía que el servidor tardara en apagarse, entre otras cosas. -- Se corrigió la aleatorización al elegir hosts para la conexión a ZooKeeper. -- Se corrigió la exclusión de réplicas rezagadas en consultas distribuidas si la réplica es localhost. -- Se corrigió un error por el que una parte de datos en un `ReplicatedMergeTree` la tabla podría estar rota después de correr `ALTER MODIFY` en un elemento en un `Nested` estructura. -- Se corrigió un error que podía causar que las consultas SELECT “hang”. -- Mejoras en las consultas DDL distribuidas. -- Se corrigió la consulta `CREATE TABLE ... AS `. -- Se resolvió el punto muerto en el `ALTER ... CLEAR COLUMN IN PARTITION` consulta para `Buffer` tabla. -- Se corrigió el valor predeterminado no válido para `Enum` s (0 en lugar del mínimo) cuando se utiliza el `JSONEachRow` y `TSKV` formato. -- Se resolvió la aparición de procesos zombis al usar un diccionario con un `executable` fuente. -- Se corrigió el segfault para la consulta HEAD. - -#### Flujo de trabajo mejorado para desarrollar y ensamblar ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse} - -- Usted puede utilizar `pbuilder` para construir ClickHouse. -- Usted puede utilizar `libc++` en lugar de `libstdc++` para construir en Linux. -- Se agregaron instrucciones para usar herramientas de análisis de código estático: `Coverage`, `clang-tidy`, `cppcheck`. - -#### Tenga en cuenta al actualizar: {#please-note-when-upgrading} - -- Ahora hay un valor predeterminado más alto para la configuración MergeTree `max_bytes_to_merge_at_max_space_in_pool` (el tamaño total máximo de las partes de datos a fusionar, en bytes): ha aumentado de 100 GiB a 150 GiB. Esto podría dar lugar a grandes fusiones que se ejecutan después de la actualización del servidor, lo que podría provocar una mayor carga en el subsistema de disco. Si el espacio libre disponible en el servidor es inferior al doble de la cantidad total de las fusiones que se están ejecutando, esto hará que todas las demás fusiones dejen de ejecutarse, incluidas las fusiones de pequeñas partes de datos. Como resultado, las consultas INSERT fallarán con el mensaje “Merges are processing significantly slower than inserts.” Utilice el `SELECT * FROM system.merges` consulta para supervisar la situación. También puede comprobar el `DiskSpaceReservedForMerge` métrica en el `system.metrics` mesa, o en Grafito. No necesita hacer nada para solucionar esto, ya que el problema se resolverá solo una vez que finalicen las fusiones grandes. Si encuentra esto inaceptable, puede restaurar el valor anterior para el `max_bytes_to_merge_at_max_space_in_pool` configuración. Para hacer esto, vaya al sección en config.xml, establecer ``` ``107374182400 ``` y reinicie el servidor. - -### Lanzamiento de ClickHouse 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} - -- Esta es una versión de corrección de errores para la versión anterior 1.1.54282. Corrige fugas en el directorio de piezas en ZooKeeper. - -### Lanzamiento de ClickHouse 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} - -Esta versión contiene correcciones de errores para la versión anterior 1.1.54276: - -- Fijo `DB::Exception: Assertion violation: !_path.empty()` cuando se inserta en una tabla distribuida. -- Se corrigió el análisis al insertar en formato RowBinary si los datos de entrada comienzan con';'. -- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). - -### Clickhouse Lanzamiento 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} - -#### Novedad: {#new-features-4} - -- Se agregó una sección WITH opcional para una consulta SELECT. Consulta de ejemplo: `WITH 1+1 AS a SELECT a, a*a` -- INSERT se puede realizar de forma sincrónica en una tabla distribuida: se devuelve OK solo después de guardar todos los datos en todos los fragmentos. Esto se activa mediante la configuración insert\_distributed\_sync=1. -- Se agregó el tipo de datos UUID para trabajar con identificadores de 16 bytes. -- Se agregaron alias de CHAR, FLOAT y otros tipos para compatibilidad con Tableau. -- Se agregaron las funciones aYYYYMM, aYYYYMMDD y aYYYYMMDDhhmmss para convertir el tiempo en números. -- Puede utilizar direcciones IP (junto con el nombre de host) para identificar servidores para consultas DDL en clúster. -- Se agregó soporte para argumentos no constantes y compensaciones negativas en la función `substring(str, pos, len).` -- Se agregó el parámetro max\_size para el `groupArray(max_size)(column)` función agregada, y optimizó su funcionamiento. - -#### Principales cambios: {#main-changes} - -- Mejoras de seguridad: todos los archivos del servidor se crean con permisos 0640 (se pueden cambiar a través de parámetro de configuración). -- Mensajes de error mejorados para consultas con sintaxis no válida. -- Se ha reducido significativamente el consumo de memoria y se ha mejorado el rendimiento al combinar grandes secciones de datos de MergeTree. -- Aumentó significativamente el rendimiento de las fusiones de datos para el motor ReplacingMergeTree. -- Mejora del rendimiento de las inserciones asincrónicas de una tabla distribuida mediante la combinación de varias inserciones de origen. Para habilitar esta funcionalidad, utilice la configuración de directorio\_distribuido\_monitor\_batch\_inserts=1. - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-1} - -- Se ha cambiado el formato binario de los estados agregados de `groupArray(array_column)` funciones para matrices. - -#### Lista completa de cambios: {#complete-list-of-changes} - -- Se agregó el `output_format_json_quote_denormals` configuración, que permite generar valores nan e inf en formato JSON. -- Asignación de secuencias optimizada al leer desde una tabla distribuida. -- Los ajustes se pueden configurar en modo de solo lectura si el valor no cambia. -- Se agregó la capacidad de recuperar gránulos no enteros del motor MergeTree para cumplir con las restricciones en el tamaño de bloque especificado en la configuración preferred\_block\_size\_bytes. El propósito es reducir el consumo de RAM y aumentar la localidad de caché al procesar consultas desde tablas con columnas grandes. -- Uso eficiente de índices que contienen expresiones como `toStartOfHour(x)` para condiciones como `toStartOfHour(x) op сonstexpr.` -- Se agregaron nuevas configuraciones para los motores MergeTree (la sección merge\_tree en config.XML): - - replicated\_deduplication\_window\_seconds establece el número de segundos permitidos para la deduplicación de inserciones en tablas replicadas. - - cleanup\_delay\_period establece con qué frecuencia iniciar la limpieza para eliminar datos obsoletos. - - replicated\_can\_become\_leader puede evitar que una réplica se convierta en el líder (y asigne fusiones). -- Limpieza acelerada para eliminar datos obsoletos de ZooKeeper. -- Múltiples mejoras y correcciones para consultas DDL en clúster. De particular interés es la nueva configuración distribut\_ddl\_task\_timeout, que limita el tiempo de espera para una respuesta de los servidores en el clúster. Si no se ha realizado una solicitud ddl en todos los hosts, una respuesta contendrá un error de tiempo de espera y una solicitud se ejecutará en modo asíncrono. -- Mejora de la visualización de los rastros de pila en los registros del servidor. -- Se agregó el “none” valor para el método de compresión. -- Puede usar varias secciones dictionaries\_config en config.XML. -- Es posible conectarse a MySQL a través de un socket en el sistema de archivos. -- Sistema.partes tiene una nueva columna con información sobre el tamaño de las marcas, en bytes. - -#### Corrección de errores: {#bug-fixes-4} - -- Las tablas distribuidas que utilizan una tabla Merge ahora funcionan correctamente para una consulta SELECT con una condición `_table` campo. -- Se corrigió una rara condición de carrera en ReplicatedMergeTree al verificar partes de datos. -- Se corrigió la posible congelación en “leader election” al iniciar un servidor. -- El valor max\_replica\_delay\_for\_distributed\_queries se omitió al usar una réplica local del origen de datos. Esto ha sido solucionado. -- Comportamiento incorrecto fijo de `ALTER TABLE CLEAR COLUMN IN PARTITION` al intentar limpiar una columna no existente. -- Se ha corregido una excepción en la función multiIf al usar matrices o cadenas vacías. -- Se corrigieron asignaciones de memoria excesivas al deserializar el formato nativo. -- Se corrigió la actualización automática incorrecta de los diccionarios Trie. -- Se ha corregido una excepción al ejecutar consultas con una cláusula GROUP BY desde una tabla Merge cuando se usa SAMPLE. -- Se corrigió un bloqueo de GROUP BY cuando se usabaributed\_aggregation\_memory\_efficient = 1. -- Ahora puede especificar la base de datos.en el lado derecho de IN y JOIN. -- Se usaron demasiados subprocesos para la agregación paralela. Esto ha sido solucionado. -- Corregido cómo el “if” funciona con argumentos FixedString. -- SELECT funcionó incorrectamente desde una tabla distribuida para fragmentos con un peso de 0. Esto ha sido solucionado. -- Ejecutar `CREATE VIEW IF EXISTS no longer causes crashes.` -- Se corrigió el comportamiento incorrecto cuando input\_format\_skip\_unknown\_fields = 1 se establece y hay números negativos. -- Se corrigió un bucle infinito en el `dictGetHierarchy()` función si hay algunos datos no válidos en el diccionario. -- Fijo `Syntax error: unexpected (...)` errores al ejecutar consultas distribuidas con subconsultas en una cláusula IN o JOIN y tablas Merge. -- Se corrigió una interpretación incorrecta de una consulta SELECT de tablas de diccionario. -- Se corrigió el “Cannot mremap” error al usar matrices en las cláusulas IN y JOIN con más de 2 mil millones de elementos. -- Se corrigió la conmutación por error para los diccionarios con MySQL como fuente. - -#### Flujo de trabajo mejorado para desarrollar y ensamblar ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} - -- Las construcciones se pueden ensamblar en Arcadia. -- Puedes usar gcc 7 para compilar ClickHouse. -- Las compilaciones paralelas que usan ccache + distcc son más rápidas ahora. - -### Lanzamiento de ClickHouse 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} - -#### Novedad: {#new-features-5} - -- DDL distribuido (por ejemplo, `CREATE TABLE ON CLUSTER`) -- La consulta replicada `ALTER TABLE CLEAR COLUMN IN PARTITION.` -- El motor para las tablas del diccionario (acceso a los datos del diccionario en forma de tabla). -- Motor de base de datos de diccionario (este tipo de base de datos tiene automáticamente tablas de diccionario disponibles para todos los diccionarios externos conectados). -- Puede comprobar si hay actualizaciones en el diccionario enviando una solicitud al origen. -- Nombres de columna cualificados -- Citando identificadores usando comillas dobles. -- Sesiones en la interfaz HTTP. -- La consulta OPTIMIZE para una tabla replicada puede ejecutarse no solo en el líder. - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-2} - -- Eliminado SET GLOBAL. - -#### Cambios menores: {#minor-changes} - -- Ahora, después de activar una alerta, el registro imprime el seguimiento completo de la pila. -- Se relajó la verificación del número de partes de datos dañadas / adicionales al inicio (hubo demasiados falsos positivos). - -#### Corrección de errores: {#bug-fixes-5} - -- Se corrigió una mala conexión “sticking” cuando se inserta en una tabla distribuida. -- GLOBAL IN ahora funciona para una consulta de una tabla de combinación que mira a una tabla distribuida. -- Se detectó el número incorrecto de núcleos en una máquina virtual de Google Compute Engine. Esto ha sido solucionado. -- Cambios en el funcionamiento de una fuente ejecutable de diccionarios externos en caché. -- Se corrigió la comparación de cadenas que contenían caracteres nulos. -- Se corrigió la comparación de los campos de clave primaria Float32 con constantes. -- Anteriormente, una estimación incorrecta del tamaño de un campo podía conducir a asignaciones demasiado grandes. -- Se corrigió un bloqueo al consultar una columna Nullable agregada a una tabla usando ALTER. -- Se corrigió un bloqueo al ordenar por una columna Nullable, si el número de filas es menor que LIMIT. -- Se corrigió una subconsulta ORDER BY que consistía solo en valores constantes. -- Anteriormente, una tabla replicada podía permanecer en el estado no válido después de un error DROP TABLE. -- Los alias para subconsultas escalares con resultados vacíos ya no se pierden. -- Ahora una consulta que usó compilación no falla con un error si el archivo .so se daña. diff --git a/docs/es/whats_new/changelog/2018.md b/docs/es/whats_new/changelog/2018.md deleted file mode 100644 index c63b94670ac..00000000000 --- a/docs/es/whats_new/changelog/2018.md +++ /dev/null @@ -1,1063 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 78 -toc_title: '2018' ---- - -## Lanzamiento de ClickHouse 18.16 {#clickhouse-release-18-16} - -### Lanzamiento de ClickHouse 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} - -#### Corrección de errores: {#bug-fixes} - -- Se corrigió un error que provocaba problemas con la actualización de diccionarios con el origen ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- La compilación JIT de funciones agregadas ahora funciona con columnas LowCardinality. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) - -#### Mejora: {#improvements} - -- Se agregó el `low_cardinality_allow_in_native_format` configuración (habilitada por defecto). Cuando se deshabilita, las columnas LowCardinality se convertirán en columnas ordinarias para las consultas SELECT y se esperarán columnas ordinarias para las consultas INSERT. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) - -#### Mejoras de construcción: {#build-improvements} - -- Correcciones para compilaciones en macOS y ARM. - -### Lanzamiento de ClickHouse 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} - -#### Novedad: {#new-features} - -- `DEFAULT` Las expresiones se evalúan en busca de campos faltantes al cargar datos en formatos de entrada semiestructurados (`JSONEachRow`, `TSKV`). La función está habilitada con `insert_sample_with_metadata` configuración. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) -- El `ALTER TABLE` consulta ahora tiene el `MODIFY ORDER BY` acción para cambiar la clave de ordenación al agregar o eliminar una columna de tabla. Esto es útil para las tablas `MergeTree` familia que realizan tareas adicionales al fusionarse basándose en esta clave de ordenación, como `SummingMergeTree`, `AggregatingMergeTree` y así sucesivamente. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) -- Para las tablas en el `MergeTree` familia, ahora puede especificar una clave de clasificación diferente (`ORDER BY`) e índice (`PRIMARY KEY`). La clave de ordenación puede ser más larga que el índice. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) -- Se agregó el `hdfs` función de la tabla y el `HDFS` para importar y exportar datos a HDFS. [Más información](https://github.com/ClickHouse/ClickHouse/pull/3617) -- Funciones añadidas para trabajar con base64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alejandro Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) -- Ahora puede usar un parámetro para configurar la precisión del `uniqCombined` función de agregado (seleccione el número de celdas HyperLogLog). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) -- Se agregó el `system.contributors` tabla que contiene los nombres de todos los que hicieron compromete en ClickHouse. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) -- Se agregó la capacidad de omitir la partición para el `ALTER TABLE ... FREEZE` consulta para hacer una copia de seguridad de todas las particiones a la vez. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) -- Añadir `dictGet` y `dictGetOrDefault` funciones que no requieren especificar el tipo de valor de retorno. El tipo se determina automáticamente a partir de la descripción del diccionario. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3564) -- Ahora puede especificar comentarios para una columna en la descripción de la tabla y cambiarla usando `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) -- La lectura es compatible para `Join` tablas de escribir con teclas simples. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Ahora puede especificar las opciones `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, y `join_overflow_mode` al crear un `Join` tabla de tipo. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Se agregó el `joinGet` función que le permite utilizar un `Join` tipo de tabla como un diccionario. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Se agregó el `partition_key`, `sorting_key`, `primary_key`, y `sampling_key` columnas a la `system.tables` tabla con el fin de proporcionar información sobre las claves de la tabla. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Se agregó el `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, y `is_in_sampling_key` columnas a la `system.columns` tabla. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Se agregó el `min_time` y `max_time` columnas a la `system.parts` tabla. Estas columnas se rellenan cuando la clave de partición es una expresión que consiste en `DateTime` columna. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) - -#### Corrección de errores: {#bug-fixes-1} - -- Correcciones y mejoras de rendimiento para el `LowCardinality` tipo de datos. `GROUP BY` utilizar `LowCardinality(Nullable(...))`. Obtener los valores de `extremes`. Procesamiento de funciones de orden superior. `LEFT ARRAY JOIN`. Distribuido `GROUP BY`. Funciones que devuelven `Array`. Ejecución de `ORDER BY`. Escribir a `Distributed` tablas (nicelulu). Compatibilidad con versiones anteriores para `INSERT` consultas de clientes antiguos que implementan el `Native` protocolo. Soporte para `LowCardinality` para `JOIN`. Rendimiento mejorado cuando se trabaja en un solo flujo. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) -- Corregido cómo el `select_sequential_consistency` opción funciona. Anteriormente, cuando se habilitaba esta configuración, a veces se devolvía un resultado incompleto después de comenzar a escribir en una nueva partición. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) -- Las bases de datos se especifican correctamente al ejecutar DDL `ON CLUSTER` consultas y `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Las bases de datos se especifican correctamente para las subconsultas dentro de una VIEW. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Se ha corregido un error en `PREWHERE` con `FINAL` para `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) -- Ahora puedes usar `KILL QUERY` para cancelar consultas que aún no se han iniciado porque están esperando a que se bloquee la tabla. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) -- Se corrigieron los cálculos de fecha y hora si los relojes se movían hacia atrás a la medianoche (esto sucede en Irán, y sucedió en Moscú de 1981 a 1983). Anteriormente, esto llevaba a que la hora se restableciera un día antes de lo necesario, y también causaba un formato incorrecto de la fecha y la hora en formato de texto. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) -- Se corrigieron errores en algunos casos de `VIEW` y subconsultas que omiten la base de datos. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Se corrigió una condición de carrera al leer simultáneamente desde un `MATERIALIZED VIEW` y eliminar un `MATERIALIZED VIEW` debido a no bloquear el interior `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) -- Corregido el error `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) -- Procesamiento de consultas fijo cuando el `compile_expressions` la opción está habilitada (está habilitada por defecto). Expresiones constantes no deterministas como el `now` función ya no están desplegados. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) -- Se corrigió un bloqueo al especificar un argumento de escala no constante en `toDecimal32/64/128` función. -- Se corrigió un error al intentar insertar una matriz con `NULL` elementos en el `Values` formato en una columna de tipo `Array` sin `Nullable` (si `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) -- Se corrigió el registro continuo de errores en `DDLWorker` si ZooKeeper no está disponible. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) -- Se corrigió el tipo de retorno para `quantile*` funciones de `Date` y `DateTime` de argumentos. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) -- Se corrigió el `WITH` cláusula si especifica un alias simple sin expresiones. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) -- Se corrigió el procesamiento de consultas con subconsultas con nombre y nombres de columna calificados cuando `enable_optimize_predicate_expression` está habilitado. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) -- Corregido el error `Attempt to attach to nullptr thread group` cuando se trabaja con vistas materializadas. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) -- Se corrigió un bloqueo al pasar ciertos argumentos incorrectos a la `arrayReverse` función. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- Se corrigió el desbordamiento del búfer en el `extractURLParameter` función. Rendimiento mejorado. Se agregó el procesamiento correcto de cadenas que contienen cero bytes. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) -- Desbordamiento de búfer fijo en el `lowerUTF8` y `upperUTF8` función. Se eliminó la capacidad de ejecutar estas funciones sobre `FixedString` argumentos de tipo. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) -- Se corrigió una rara condición de carrera al eliminar `MergeTree` tabla. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) -- Se corrigió una condición de carrera al leer desde `Buffer` tablas y realizar simultáneamente `ALTER` o `DROP` en las tablas de destino. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) -- Se corrigió una segfault si el `max_temporary_non_const_columns` se excedió el límite. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### Mejora: {#improvements-1} - -- El servidor no escribe los archivos de configuración procesados `/etc/clickhouse-server/` directorio. En su lugar, los guarda en el `preprocessed_configs` directorio dentro `path`. Esto significa que el `/etc/clickhouse-server/` directorio no tiene acceso de escritura para el `clickhouse` usuario, lo que mejora la seguridad. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) -- El `min_merge_bytes_to_use_direct_io` La opción está establecida en 10 GiB de forma predeterminada. Una combinación que forma partes grandes de tablas de la familia MergeTree se realizará en `O_DIRECT` modo, que evita el desalojo excesivo de la caché de la página. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) -- Se inicia el servidor acelerado cuando hay un gran número de tablas. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) -- Se agregó un grupo de conexiones y HTTP `Keep-Alive` para conexiones entre réplicas. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) -- Si la sintaxis de la consulta no es válida, `400 Bad Request` el código se devuelve en el `HTTP` interfaz (500 se devolvió anteriormente). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) -- El `join_default_strictness` opción se establece en `ALL` por defecto para la compatibilidad. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) -- Se eliminó el registro a `stderr` de la `re2` biblioteca para expresiones regulares no válidas o complejas. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) -- Añadido para el `Kafka` motor de tabla: comprueba si hay suscripciones antes de comenzar a leer de Kafka; la configuración kafka\_max\_block\_size para la tabla. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) -- El `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, y `murmurHash3_64` funciones ahora funcionan para cualquier número de argumentos y para argumentos en forma de tuplas. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) -- El `arrayReverse` función ahora funciona con cualquier tipo de matrices. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- Se ha añadido un parámetro opcional: el tamaño de la ranura `timeSlots` función. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) -- Para `FULL` y `RIGHT JOIN`, el `max_block_size` configuración se utiliza para un flujo de datos no unidos de la tabla de la derecha. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3699) -- Se agregó el `--secure` parámetro de línea de comandos en `clickhouse-benchmark` y `clickhouse-performance-test` para habilitar TLS. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) -- Conversión de tipo cuando la estructura de un `Buffer` type table no coincide con la estructura de la tabla de destino. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) -- Se agregó el `tcp_keep_alive_timeout` opción para habilitar los paquetes keep-alive después de la inactividad durante el intervalo de tiempo especificado. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) -- Eliminado cotización innecesaria de valores para la clave de partición en el `system.parts` tabla si consiste en una sola columna. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) -- La función de módulo funciona para `Date` y `DateTime` tipos de datos. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) -- Sinónimos añadidos para el `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, y `MID` función. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Algunos nombres de funciones no distinguen entre mayúsculas y minúsculas por su compatibilidad con el estándar SQL. Azúcar sintáctico añadido `SUBSTRING(expr FROM start FOR length)` por compatibilidad con SQL. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) -- Se agregó la capacidad de `mlock` páginas de memoria correspondientes a `clickhouse-server` código ejecutable para evitar que se vea obligado a salir de la memoria. Esta función está deshabilitada de forma predeterminada. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) -- Rendimiento mejorado al leer desde `O_DIRECT` (con el `min_bytes_to_use_direct_io` opción activada). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) -- Rendimiento mejorado del `dictGet...OrDefault` función para un argumento de clave constante y un argumento predeterminado no constante. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3563) -- El `firstSignificantSubdomain` función ahora procesa los dominios `gov`, `mil`, y `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Rendimiento mejorado. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) -- Posibilidad de especificar variables de entorno personalizadas para iniciar `clickhouse-server` utilizando el `SYS-V init.d` secuencia de comandos definiendo `CLICKHOUSE_PROGRAM_ENV` en `/etc/default/clickhouse`. - [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) -- Corrija el código de retorno para el script init de clickhouse-server. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) -- El `system.metrics` ahora tiene el `VersionInteger` métrica, y `system.build_options` tiene la línea añadida `VERSION_INTEGER`, que contiene la forma numérica de la versión de ClickHouse, como `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) -- Eliminado la capacidad de comparar el `Date` escriba con un número para evitar posibles errores como `date = 2018-12-17`, donde las comillas alrededor de la fecha se omiten por error. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) -- Se corrigió el comportamiento de las funciones con estado como `rowNumberInAllBlocks`. Anteriormente generaron un resultado que era un número mayor debido al inicio durante el análisis de consultas. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3729) -- Si el `force_restore_data` no se puede eliminar, se muestra un mensaje de error. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3794) - -#### Mejoras de construcción: {#build-improvements-1} - -- Actualizado el `jemalloc` biblioteca, que corrige una posible pérdida de memoria. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3557) -- Perfilado con `jemalloc` está habilitado de forma predeterminada para depurar compilaciones. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) -- Se agregó la capacidad de ejecutar pruebas de integración cuando solo `Docker` está instalado en el sistema. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) -- Se agregó la prueba de expresión fuzz en consultas SELECT. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) -- Se agregó una prueba de esfuerzo para confirmaciones, que realiza pruebas funcionales en paralelo y en orden aleatorio para detectar más condiciones de carrera. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) -- Se mejoró el método para iniciar clickhouse-server en una imagen de Docker. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/pull/3663) -- Para una imagen de Docker, se agregó soporte para inicializar bases de datos utilizando `/docker-entrypoint-initdb.d` directorio. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) -- Correcciones para construye en ARM. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes} - -- Eliminado la capacidad de comparar el `Date` escriba con un número. En lugar de `toDate('2018-12-18') = 17883`, debe usar la conversión de tipo explícita `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) - -## Lanzamiento de ClickHouse 18.14 {#clickhouse-release-18-14} - -### Lanzamiento de ClickHouse 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} - -#### Corrección de errores: {#bug-fixes-2} - -- Se corrigió un error que provocaba problemas con la actualización de diccionarios con el origen ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- Las bases de datos se especifican correctamente al ejecutar DDL `ON CLUSTER` consulta. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Se corrigió una segfault si el `max_temporary_non_const_columns` se excedió el límite. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### Mejoras de construcción: {#build-improvements-2} - -- Correcciones para construye en ARM. - -### Lanzamiento de ClickHouse 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} - -#### Corrección de errores: {#bug-fixes-3} - -- Corregido el error en `dictGet...` función para diccionarios de tipo `range`, si uno de los argumentos es constante y otro no lo es. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) -- Se corrigió el error que causaba mensajes `netlink: '...': attribute type 1 has an invalid length` para imprimirse en el registro del kernel de Linux, eso estaba sucediendo solo en versiones suficientemente frescas del kernel de Linux. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) -- Segfault fijo en la función `empty` para argumento de `FixedString` tipo. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/pull/3703) -- Se corrigió la asignación excesiva de memoria al usar un gran valor de `max_query_size` configuración (un fragmento de memoria de `max_query_size` bytes fue preasignado a la vez). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) - -#### Crear cambios: {#build-changes} - -- Compilación fija con las bibliotecas LLVM / Clang de la versión 7 de los paquetes del sistema operativo (estas bibliotecas se utilizan para la compilación de consultas en tiempo de ejecución). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### Lanzamiento de ClickHouse 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} - -#### Corrección de errores: {#bug-fixes-4} - -- Se corrigieron casos en los que el proceso de puente ODBC no terminaba con el proceso del servidor principal. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) -- Inserción síncrona fija en el `Distributed` tabla con una lista de columnas que difiere de la lista de columnas de la tabla remota. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) -- Se corrigió una rara condición de carrera que podía provocar un bloqueo al soltar una tabla MergeTree. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Se corrigió un punto muerto de consulta en caso de que la creación del hilo de consulta fallara con el `Resource temporarily unavailable` error. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Análisis fijo del `ENGINE` cláusula cuando el `CREATE AS table` se utilizó la sintaxis y el `ENGINE` cláusula se especificó antes de la `AS table` (el error resultó en ignorar el motor especificado). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) - -### Lanzamiento de ClickHouse 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} - -#### Corrección de errores: {#bug-fixes-5} - -- El tamaño del fragmento de memoria se sobreestimó al deserializar la columna de tipo `Array(String)` que conduce a “Memory limit exceeded” error. El problema apareció en la versión 18.12.13. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) - -### Lanzamiento de ClickHouse 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} - -#### Corrección de errores: {#bug-fixes-6} - -- Fijo `ON CLUSTER` consultas cuando el clúster está configurado como seguro (indicador ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) - -#### Crear cambios: {#build-changes-1} - -- Problemas solucionados (llvm-7 del sistema, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### Lanzamiento de ClickHouse 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} - -#### Corrección de errores: {#bug-fixes-7} - -- Se corrigió el `Block structure mismatch in MergingSorted stream` error. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) -- Fijo `ON CLUSTER` consultas en caso de que se hayan activado las conexiones seguras en la configuración del clúster (el `` bandera). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) -- Se corrigió un error en las consultas que utilizaban `SAMPLE`, `PREWHERE` y columnas de alias. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) -- Se corrigió un raro `unknown compression method` error cuando el `min_bytes_to_use_direct_io` se habilitó la configuración. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) - -#### Mejoras de rendimiento: {#performance-improvements} - -- Regresión de rendimiento fija de consultas con `GROUP BY` de columnas de tipo UInt16 o Date cuando se ejecuta en procesadores AMD EPYC. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) -- Regresión de rendimiento fija de las consultas que procesan cadenas largas. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) - -#### Mejoras de construcción: {#build-improvements-3} - -- Mejoras para simplificar la compilación de Arcadia. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) - -### Lanzamiento de ClickHouse 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} - -#### Corrección de errores: {#bug-fixes-8} - -- Se corrigió un bloqueo al unir dos subconsultas sin nombre. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) -- Se corrigió la generación de consultas incorrectas (con un vacío `WHERE` cláusula) al consultar bases de datos externas. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) -- Se corrigió usando un valor de tiempo de espera incorrecto en los diccionarios ODBC. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) - -### Lanzamiento de ClickHouse 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} - -#### Corrección de errores: {#bug-fixes-9} - -- Corregido el error `Block structure mismatch in UNION stream: different number of columns` en consultas LIMIT. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) -- Se corrigieron errores al fusionar datos en tablas que contienen matrices dentro de estructuras anidadas. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) -- Se corrigieron los resultados de la consulta incorrecta si el `merge_tree_uniform_read_distribution` la configuración está deshabilitada (está habilitada por defecto). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) -- Se corrigió un error en las inserciones en una tabla distribuida en formato nativo. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) - -### Lanzamiento de ClickHouse 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} - -- El `compile_expressions` configuración (compilación JIT de expresiones) está deshabilitada de forma predeterminada. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) -- El `enable_optimize_predicate_expression` configuración está deshabilitada de forma predeterminada. - -### Lanzamiento de ClickHouse 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} - -#### Novedad: {#new-features-1} - -- El `WITH CUBE` modificador para `GROUP BY` (la sintaxis alternativa `GROUP BY CUBE(...)` también está disponible). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) -- Se agregó el `formatDateTime` función. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) -- Se agregó el `JDBC` motor de mesa y `jdbc` función de tabla (requiere la instalación de clickhouse-jdbc-bridge). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- Funciones añadidas para trabajar con el número de semana ISO: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, y `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) -- Ahora puedes usar `Nullable` de columnas para `MySQL` y `ODBC` tabla. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- Las estructuras de datos anidadas se pueden leer como objetos anidados en `JSONEachRow` formato. Se agregó el `input_format_import_nested_json` configuración. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) -- El procesamiento paralelo está disponible para muchos `MATERIALIZED VIEW`s al insertar datos. Ver el `parallel_view_processing` configuración. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) -- Se agregó el `SYSTEM FLUSH LOGS` consulta (vacíos de registro forzados a tablas del sistema como `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) -- Ahora puedes usar predefinidos `database` y `table` macros al declarar `Replicated` tabla. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) -- Se agregó la capacidad de leer `Decimal` valores de tipo en notación de ingeniería (indicando potencias de diez). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) - -#### Experimental características: {#experimental-features} - -- Optimización de la cláusula GROUP BY para `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) -- Cálculo optimizado de expresiones para `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) - -#### Mejora: {#improvements-2} - -- Consumo de memoria significativamente reducido para consultas con `ORDER BY` y `LIMIT`. Ver el `max_bytes_before_remerge_sort` configuración. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- En ausencia de `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` se supone. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) -- Los asteriscos calificados funcionan correctamente en consultas con `JOIN`. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) -- El `ODBC` El motor de tabla elige correctamente el método para citar identificadores en el dialecto SQL de una base de datos remota. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- El `compile_expressions` configuración (compilación JIT de expresiones) está habilitada de forma predeterminada. -- Comportamiento fijo para DROP DATABASE / TABLA SI EXISTE simultáneamente y CREATE DATABASE / TABLA SI NO EXISTE. Anteriormente, un `CREATE DATABASE ... IF NOT EXISTS` consulta podría devolver el mensaje de error “File … already exists” y el `CREATE TABLE ... IF NOT EXISTS` y `DROP TABLE IF EXISTS` las consultas podrían volver `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) -- Las expresiones LIKE e IN con una mitad derecha constante se pasan al servidor remoto al realizar consultas desde tablas MySQL u ODBC. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- Las comparaciones con expresiones constantes en una cláusula WHERE se pasan al servidor remoto al realizar consultas desde tablas MySQL y ODBC. Anteriormente, solo se pasaban las comparaciones con constantes. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- Cálculo correcto del ancho de fila en el terminal para `Pretty` formatos, incluyendo cadenas con jeroglíficos. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/3257). -- `ON CLUSTER` se puede especificar para `ALTER UPDATE` consulta. -- Rendimiento mejorado para leer datos en `JSONEachRow` formato. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) -- Sinónimos añadidos para el `LENGTH` y `CHARACTER_LENGTH` funciones de compatibilidad. El `CONCAT` la función ya no distingue entre mayúsculas y minúsculas. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) -- Se agregó el `TIMESTAMP` sinónimo de la `DateTime` tipo. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) -- Siempre hay espacio reservado para query\_id en los registros del servidor, incluso si la línea de registro no está relacionada con una consulta. Esto hace que sea más fácil analizar los registros de texto del servidor con herramientas de terceros. -- El consumo de memoria de una consulta se registra cuando supera el siguiente nivel de un número entero de gigabytes. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- Se agregó el modo de compatibilidad para el caso cuando la biblioteca cliente que usa el protocolo nativo envía menos columnas por error de lo que el servidor espera para la consulta INSERT. Este escenario fue posible cuando se utiliza la biblioteca clickhouse-cpp. Anteriormente, este escenario hacía que el servidor se bloqueara. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) -- En una expresión WHERE definida por el usuario en `clickhouse-copier`, ahora puede usar un `partition_key` alias (para filtrado adicional por partición de tabla de origen). Esto es útil si el esquema de partición cambia durante la copia, pero solo cambia ligeramente. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) -- El flujo de trabajo del `Kafka` el motor se ha movido a un grupo de subprocesos en segundo plano para reducir automáticamente la velocidad de lectura de datos a altas cargas. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- Soporte para lectura `Tuple` y `Nested` de estructuras como `struct` en el `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) -- La lista de dominios de nivel superior `firstSignificantSubdomain` función ahora incluye el dominio `biz`. [disminución](https://github.com/ClickHouse/ClickHouse/pull/3219) -- En la configuración de diccionarios externos, `null_value` se interpreta como el valor del tipo de datos predeterminado. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) -- Soporte para el `intDiv` y `intDivOrZero` funciones para `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) -- Soporte para el `Date`, `DateTime`, `UUID`, y `Decimal` tipos como una clave para el `sumMap` función de agregado. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) -- Soporte para el `Decimal` tipo de datos en diccionarios externos. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) -- Soporte para el `Decimal` tipo de datos en `SummingMergeTree` tabla. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) -- Añadido especializaciones para `UUID` en `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) -- Reducido el número de `open` y `close` llamadas al sistema al leer desde un `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) -- A `TRUNCATE TABLE` consulta se puede ejecutar en cualquier réplica (la consulta se pasa a la réplica líder). [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) - -#### Corrección de errores: {#bug-fixes-10} - -- Se corrigió un problema con `Dictionary` tablas para `range_hashed` diccionario. Este error se produjo en la versión 18.12.17. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) -- Se corrigió un error al cargar `range_hashed` diccionarios (el mensaje `Unsupported type Nullable (...)`). Este error se produjo en la versión 18.12.17. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- Se corrigieron errores en el `pointInPolygon` función debido a la acumulación de cálculos inexactos para polígonos con un gran número de vértices ubicados cerca uno del otro. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) -- Si después de fusionar partes de datos, la suma de comprobación de la parte resultante difiere del resultado de la misma fusión en otra réplica, el resultado de la fusión se elimina y la parte de datos se descarga de la otra réplica (este es el comportamiento correcto). Pero después de descargar la parte de datos, no se pudo agregar al conjunto de trabajo debido a un error de que la parte ya existe (porque la parte de datos se eliminó con cierto retraso después de la fusión). Esto llevó a intentos cíclicos de descargar los mismos datos. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) -- Se corrigió el cálculo incorrecto del consumo total de memoria por consultas (debido a un cálculo incorrecto, el `max_memory_usage_for_all_queries` la configuración funcionó incorrectamente y el `MemoryTracking` métrica tenía un valor incorrecto). Este error se produjo en la versión 18.12.13. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) -- Se corrigió la funcionalidad de `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` Este error se produjo en la versión 18.12.13. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) -- Se corrigió la preparación innecesaria de estructuras de datos para `JOIN`s en el servidor que inicia la consulta si `JOIN` sólo se realiza en servidores remotos. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) -- Se corrigieron errores en el `Kafka` engine: interbloqueos después de las excepciones al comenzar a leer datos, y se bloquea al finalizar [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- Para `Kafka` mesas, el opcional `schema` no se aprobó el parámetro (el esquema del `Cap'n'Proto` formato). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) -- Si el conjunto de servidores ZooKeeper tiene servidores que aceptan la conexión pero luego la cierran inmediatamente en lugar de responder al protocolo de enlace, ClickHouse elige conectar otro servidor. Anteriormente, esto produjo el error `Cannot read all data. Bytes read: 0. Bytes expected: 4.` y el servidor no pudo iniciarse. [Nombre de la red inalámbrica (SSID):](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) -- Si el conjunto de servidores ZooKeeper contiene servidores para los que la consulta DNS devuelve un error, estos servidores se ignoran. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) -- Conversión de tipo fijo entre `Date` y `DateTime` al insertar datos en el `VALUES` formato (si `input_format_values_interpret_expressions = 1`). Anteriormente, la conversión se realizaba entre el valor numérico del número de días en tiempo de Época Unix y la marca de tiempo Unix, lo que dio lugar a resultados inesperados. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) -- Conversión de tipo corregida entre `Decimal` y números enteros. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) -- Se corrigieron errores en el `enable_optimize_predicate_expression` configuración. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) -- Se ha corregido un error de análisis en formato CSV con números de coma flotante si se utiliza un separador CSV no predeterminado, como por ejemplo `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) -- Se corrigió el `arrayCumSumNonNegative` (no acumula valores negativos si el acumulador es menor que cero). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) -- Corregido cómo `Merge` las tablas funcionan encima de `Distributed` cuando se utiliza `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) -- Corrección de errores en el `ALTER UPDATE` consulta. -- Se corrigieron errores en el `odbc` función de tabla que apareció en la versión 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) -- Se corrigió el funcionamiento de las funciones agregadas con `StateArray` combinadores. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) -- Se corrigió un bloqueo al dividir un `Decimal` valor por cero. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) -- Salida fija de tipos para operaciones usando `Decimal` y argumentos enteros. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) -- Corregido el segfault durante `GROUP BY` en `Decimal128`. [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) -- El `log_query_threads` configuración (información de registro sobre cada subproceso de ejecución de la consulta) ahora sólo tiene efecto si `log_queries` opción (información de registro sobre consultas) se establece en 1. Desde el `log_query_threads` la opción está habilitada de forma predeterminada, la información sobre los subprocesos se registró previamente incluso si el registro de consultas estaba deshabilitado. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) -- Se corrigió un error en la operación distribuida de la función de agregado de cuantiles (el mensaje de error `Not found column quantile...`). [Método de codificación de datos:](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) -- Se corrigió el problema de compatibilidad al trabajar en un clúster de servidores de la versión 18.12.17 y servidores anteriores al mismo tiempo. Para consultas distribuidas con claves GROUP BY de longitud fija y no fija, si había una gran cantidad de datos para agregar, los datos devueltos no siempre se agregaron completamente (dos filas diferentes contenían las mismas claves de agregación). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) -- Manejo fijo de sustituciones en `clickhouse-performance-test`, si la consulta contiene sólo una parte de las sustituciones declaradas en la prueba. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) -- Se corrigió un error al usar `FINAL` con `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Se corrigió un error al usar `PREWHERE` sobre las columnas que se agregaron durante `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Se agregó un cheque por la ausencia de `arrayJoin` para `DEFAULT` y `MATERIALIZED` expresiones. Previamente, `arrayJoin` llevado a un error al insertar datos. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) -- Se agregó un cheque por la ausencia de `arrayJoin` en una `PREWHERE` clausula. Anteriormente, esto llevó a mensajes como `Size ... doesn't match` o `Unknown compression method` al ejecutar consultas. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) -- Se corrigió el segfault que podía ocurrir en casos raros después de la optimización que reemplazaba las cadenas AND de las evaluaciones de igualdad con la expresión IN correspondiente. [Bienvenido a WordPress.](https://github.com/ClickHouse/ClickHouse/pull/3339) -- Correcciones menores a `clickhouse-benchmark`: anteriormente, la información del cliente no se enviaba al servidor; ahora el número de consultas ejecutadas se calcula con mayor precisión al apagar y para limitar el número de iteraciones. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-1} - -- Eliminado el `allow_experimental_decimal_type` opcion. El `Decimal` tipo de datos está disponible para su uso predeterminado. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) - -## Lanzamiento de ClickHouse 18.12 {#clickhouse-release-18-12} - -### Lanzamiento de ClickHouse 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} - -#### Novedad: {#new-features-2} - -- `invalidate_query` (la capacidad de especificar una consulta para comprobar si es necesario actualizar un diccionario externo) `clickhouse` fuente. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) -- Se agregó la capacidad de usar `UInt*`, `Int*`, y `DateTime` tipos de datos (junto con el `Date` tipo) como un `range_hashed` clave de diccionario externa que define los límites de los rangos. Ahora `NULL` se puede utilizar para designar un rango abierto. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) -- El `Decimal` tipo ahora soporta `var*` y `stddev*` funciones agregadas. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- El `Decimal` tipo ahora soporta funciones matemáticas (`exp`, `sin` y así sucesivamente.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- El `system.part_log` ahora tiene el `partition_id` columna. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Corrección de errores: {#bug-fixes-11} - -- `Merge` ahora funciona correctamente en `Distributed` tabla. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) -- Incompatibilidad fija (dependencia innecesaria del `glibc` versión) que hizo imposible ejecutar ClickHouse en `Ubuntu Precise` y versiones anteriores. La incompatibilidad surgió en la versión 18.12.13. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) -- Se corrigieron errores en el `enable_optimize_predicate_expression` configuración. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) -- Se corrigió un problema menor con compatibilidad con versiones anteriores que aparecía al trabajar con un clúster de réplicas en versiones anteriores a 18.12.13 y al mismo tiempo crear una nueva réplica de una tabla en un servidor con una versión más reciente (que se muestra en el mensaje `Can not clone replica, because the ... updated to new ClickHouse version`, lo cual es lógico, pero no debería suceder). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-2} - -- El `enable_optimize_predicate_expression` opción está habilitada por defecto (que es bastante optimista). Si se producen errores de análisis de consultas relacionados con la búsqueda de los nombres de columna, establezca `enable_optimize_predicate_expression` a 0. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) - -### Lanzamiento de ClickHouse 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} - -#### Novedad: {#new-features-3} - -- Añadido soporte para `ALTER UPDATE` consulta. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) -- Se agregó el `allow_ddl` opción, que restringe el acceso del usuario a consultas DDL. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) -- Se agregó el `min_merge_bytes_to_use_direct_io` opción para `MergeTree` los motores, que le permite establecer un umbral para el tamaño total de la fusión (cuando está por encima del umbral, los archivos de partes de datos se manejarán usando O\_DIRECT). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) -- El `system.merges` tabla del sistema ahora contiene el `partition_id` columna. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) - -#### Mejora {#improvements-3} - -- Si una parte de datos permanece sin cambios durante la mutación, no se descarga mediante réplicas. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) -- Autocompletar está disponible para nombres de configuraciones cuando se trabaja con `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) - -#### Corrección de errores: {#bug-fixes-12} - -- Se agregó una verificación para los tamaños de las matrices que son elementos de `Nested` escriba campos al insertar. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) -- Se corrigió un error al actualizar los diccionarios externos con el `ODBC` fuente y `hashed` almacenamiento. Este error se produjo en la versión 18.12.13. -- Se corrigió un bloqueo al crear una tabla temporal a partir de una consulta con un `IN` condición. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) -- Se corrigió un error en las funciones agregadas para matrices que pueden tener `NULL` elemento. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) - -### Lanzamiento de ClickHouse 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} - -#### Novedad: {#new-features-4} - -- Se agregó el `DECIMAL(digits, scale)` tipo de datos (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). Para habilitarlo, use la configuración `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) -- Nuevo `WITH ROLLUP` modificador para `GROUP BY` (sintaxis alternativa: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) -- En consultas con JOIN, el carácter estrella se expande a una lista de columnas en todas las tablas, de acuerdo con el estándar SQL. Puede restaurar el comportamiento anterior configurando `asterisk_left_columns_only` a 1 en el nivel de configuración del usuario. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) -- Se agregó soporte para JOIN con funciones de tabla. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- Autocompletar presionando Tab en clickhouse-cliente. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) -- Ctrl + C en clickhouse-client borra una consulta que se ingresó. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) -- Se agregó el `join_default_strictness` ajuste (valores: `"`, `'any'`, `'all'`). Esto le permite no especificar `ANY` o `ALL` para `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) -- Cada línea del registro del servidor relacionada con el procesamiento de consultas muestra el ID de consulta. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Ahora puede obtener registros de ejecución de consultas en clickhouse-client (use el `send_logs_level` configuración). Con el procesamiento de consultas distribuidas, los registros se conectan en cascada desde todos los servidores. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- El `system.query_log` y `system.processes` (`SHOW PROCESSLIST`) las tablas ahora tienen información sobre todas las configuraciones modificadas al ejecutar una consulta (la estructura anidada `Settings` datos). Se agregó el `log_query_settings` configuración. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- El `system.query_log` y `system.processes` las tablas ahora muestran información sobre el número de subprocesos que participan en la ejecución de la consulta (consulte `thread_numbers` columna). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Añadir `ProfileEvents` contadores que miden el tiempo dedicado a leer y escribir a través de la red y a leer y escribir en el disco, el número de errores de red y el tiempo dedicado a esperar cuando el ancho de banda de la red es limitado. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Añadir `ProfileEvents`contadores que contienen las métricas del sistema de rusage (puede usarlas para obtener información sobre el uso de CPU en el espacio de usuario y el kernel, errores de página y modificadores de contexto), así como métricas de taskstats (utilícelas para obtener información sobre el tiempo de espera de E / S, el tiempo de espera de CPU y la cantidad de datos leídos [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- El `ProfileEvents` los contadores se aplican globalmente y para cada consulta, así como para cada subproceso de ejecución de consulta, lo que le permite perfilar el consumo de recursos por consulta en detalle. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Se agregó el `system.query_thread_log` tabla, que contiene información sobre cada subproceso de ejecución de consultas. Se agregó el `log_query_threads` configuración. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- El `system.metrics` y `system.events` las tablas ahora tienen documentación incorporada. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) -- Se agregó el `arrayEnumerateDense` función. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2975) -- Se agregó el `arrayCumSumNonNegative` y `arrayDifference` función. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) -- Se agregó el `retention` función de agregado. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) -- Ahora puede agregar (fusionar) estados de funciones agregadas utilizando el operador más y multiplicar los estados de funciones agregadas por una constante no negativa. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) -- Las tablas de la familia MergeTree ahora tienen la columna virtual `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Experimental características: {#experimental-features-1} - -- Se agregó el `LowCardinality(T)` tipo de datos. Este tipo de datos crea automáticamente un diccionario local de valores y permite el procesamiento de datos sin desempaquetar el diccionario. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) -- Se agregó un caché de funciones compiladas por JIT y un contador para el número de usos antes de compilar. Para compilar expresiones JIT, habilite la `compile_expressions` configuración. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) - -#### Mejora: {#improvements-4} - -- Se ha solucionado el problema con la acumulación ilimitada del registro de replicación cuando hay réplicas abandonadas. Se agregó un modo de recuperación efectivo para réplicas con un largo retraso. -- Rendimiento mejorado de `GROUP BY` con múltiples campos de agregación cuando uno de ellos es cadena y los otros son de longitud fija. -- Rendimiento mejorado al usar `PREWHERE` y con transferencia implícita de expresiones en `PREWHERE`. -- Rendimiento de análisis mejorado para formatos de texto (`CSV`, `TSV`). [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) -- Mejora del rendimiento de las cadenas de lectura y matrices en formatos binarios. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2955) -- Mayor rendimiento y menor consumo de memoria para consultas a `system.tables` y `system.columns` cuando hay un gran número de tablas en un solo servidor. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) -- Se corrigió un problema de rendimiento en el caso de una gran secuencia de consultas que resultaban en un error (el `_dl_addr` la función es visible en `perf top`, pero el servidor no está usando mucha CPU). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) -- Las condiciones se lanzan a la vista (cuando `enable_optimize_predicate_expression` está habilitado). [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- Mejoras en la funcionalidad del `UUID` tipo de datos. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) -- El `UUID` tipo de datos es compatible con los diccionarios de The-Alchemist. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) -- El `visitParamExtractRaw` funciona correctamente con estructuras anidadas. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) -- Cuando el `input_format_skip_unknown_fields` la configuración está habilitada, los campos de objeto `JSONEachRow` se omiten correctamente. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) -- Para un `CASE` expresión con condiciones, ahora puede omitir `ELSE`, que es equivalente a `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) -- El tiempo de espera de la operación ahora se puede configurar cuando se trabaja con ZooKeeper. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) -- Puede especificar un desplazamiento para `LIMIT n, m` como `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- Puede usar el `SELECT TOP n` sintaxis como una alternativa para `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- Aumentó el tamaño de la cola para escribir en las tablas del sistema, por lo que `SystemLog parameter queue is full` el error no ocurre tan a menudo. -- El `windowFunnel` La función de agregado ahora admite eventos que cumplen múltiples condiciones. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2801) -- Las columnas duplicadas se pueden usar en un `USING` cláusula para `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) -- `Pretty` los formatos ahora tienen un límite en la alineación de columnas por ancho. Utilice el `output_format_pretty_max_column_pad_width` configuración. Si un valor es más amplio, aún se mostrará en su totalidad, pero las otras celdas de la tabla no serán demasiado anchas. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) -- El `odbc` función de tabla ahora le permite especificar el nombre de la base de datos / esquema. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2885) -- Se agregó la capacidad de usar un nombre de usuario especificado en el `clickhouse-client` archivo de configuración. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) -- El `ZooKeeperExceptions` se ha dividido en tres contadores: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, y `ZooKeeperOtherExceptions`. -- `ALTER DELETE` las consultas funcionan para vistas materializadas. -- Se agregó aleatorización al ejecutar el hilo de limpieza periódicamente para `ReplicatedMergeTree` para evitar picos de carga periódicos cuando hay un gran número de `ReplicatedMergeTree` tabla. -- Soporte para `ATTACH TABLE ... ON CLUSTER` consulta. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) - -#### Corrección de errores: {#bug-fixes-13} - -- Se corrigió un problema con `Dictionary` tablas (lanza el `Size of offsets doesn't match size of column` o `Unknown compression method` salvedad). Este error apareció en la versión 18.10.3. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) -- Se ha corregido un error al fusionar `CollapsingMergeTree` tablas si una de las partes de datos está vacía (estas partes se forman durante la fusión o `ALTER DELETE` si se han eliminado todos los datos), y `vertical` se utilizó el algoritmo para la fusión. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) -- Se corrigió una condición de carrera durante `DROP` o `TRUNCATE` para `Memory` tablas con una simultánea `SELECT`, lo que podría conducir a bloqueos del servidor. Este error apareció en la versión 1.1.54388. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) -- Se corrigió la posibilidad de pérdida de datos al insertar en `Replicated` tablas si el `Session is expired` se devuelve un error (la pérdida de datos puede ser detectada por el `ReplicatedDataLoss` métrica). Este error se produjo en la versión 1.1.54378. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) -- Se corrigió una falla seg durante `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) -- Se corrigió el error de búsqueda de nombres de columna cuando el `WHERE` la expresión consiste completamente en un nombre de columna completo, como `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) -- Se corrigió el “Not found column” error que se produjo al ejecutar consultas distribuidas si se solicita una sola columna que consta de una expresión IN con una subconsulta desde un servidor remoto. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) -- Se corrigió el `Block structure mismatch in UNION stream: different number of columns` error que se produjo para las consultas distribuidas si uno de los fragmentos es local y el otro no, y la optimización del movimiento a `PREWHERE` se activa. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) -- Se corrigió el `pointInPolygon` función para ciertos casos de polígonos no convexos. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) -- Se corrigió el resultado incorrecto al comparar `nan` con enteros. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) -- Se corrigió un error en el `zlib-ng` biblioteca que podría conducir a segfault en casos raros. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) -- Se corrigió una pérdida de memoria al insertar en una tabla con `AggregateFunction` columnas, si el estado de la función agregada no es simple (asigna memoria por separado), y si una sola solicitud de inserción da como resultado múltiples bloques pequeños. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) -- Se corrigió una condición de carrera al crear y eliminar la misma `Buffer` o `MergeTree` mesa simultáneamente. -- Se corrigió la posibilidad de una segfault al comparar tuplas formadas por ciertos tipos no triviales, como tuplas. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) -- Se corrigió la posibilidad de un segfault al ejecutar ciertos `ON CLUSTER` consulta. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) -- Se corrigió un error en el `arrayDistinct` función para `Nullable` elementos de matriz. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) -- El `enable_optimize_predicate_expression` opción ahora soporta correctamente casos con `SELECT *`. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) -- Se corrigió el segfault al reinicializar la sesión de ZooKeeper. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) -- Se corrigió el bloqueo de potencial cuando se trabajaba con ZooKeeper. -- Se corrigió el código incorrecto para agregar estructuras de datos anidadas en un `SummingMergeTree`. -- Al asignar memoria para estados de funciones agregadas, la alineación se tiene en cuenta correctamente, lo que permite utilizar operaciones que requieren alineación al implementar estados de funciones agregadas. [Más información](https://github.com/ClickHouse/ClickHouse/pull/2808) - -#### Solución de seguridad: {#security-fix} - -- Uso seguro de las fuentes de datos ODBC. La interacción con los controladores ODBC utiliza un `clickhouse-odbc-bridge` proceso. Los errores en los controladores ODBC de terceros ya no causan problemas con la estabilidad del servidor o vulnerabilidades. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) -- Se corrigió la validación incorrecta de la ruta del archivo en el `catBoostPool` función de la tabla. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) -- El contenido de las tablas del sistema (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, y `replication_queue`) se filtran de acuerdo con el acceso configurado por el usuario a las bases de datos (`allow_databases`). [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-3} - -- En consultas con JOIN, el carácter estrella se expande a una lista de columnas en todas las tablas, de acuerdo con el estándar SQL. Puede restaurar el comportamiento anterior configurando `asterisk_left_columns_only` a 1 en el nivel de configuración del usuario. - -#### Crear cambios: {#build-changes-2} - -- La mayoría de las pruebas de integración ahora se pueden ejecutar mediante confirmación. -- Las comprobaciones de estilo de código también se pueden ejecutar mediante confirmación. -- El `memcpy` la implementación se elige correctamente cuando se construye en CentOS7 / Fedora. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) -- Al usar clang para compilar, algunas advertencias de `-Weverything` se han añadido, además de la `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) -- La depuración de la compilación utiliza el `jemalloc` opción de depuración. -- La interfaz de la biblioteca para interactuar con ZooKeeper se declara abstracta. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) - -## Lanzamiento de ClickHouse 18.10 {#clickhouse-release-18-10} - -### Lanzamiento de ClickHouse 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} - -#### Novedad: {#new-features-5} - -- HTTPS se puede utilizar para la replicación. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) -- Se agregaron las funciones `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, y `murmurHash3_128` además de la existente `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) -- Compatibilidad con tipos Nullable en el controlador ODBC de ClickHouse (`ODBCDriver2` formato de salida). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) -- Soporte para `UUID` en las columnas clave. - -#### Mejora: {#improvements-5} - -- Los clústeres se pueden quitar sin reiniciar el servidor cuando se eliminan de los archivos de configuración. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) -- Los diccionarios externos se pueden quitar sin reiniciar el servidor cuando se eliminan de los archivos de configuración. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) -- Añadir `SETTINGS` soporte para el `Kafka` motor de mesa. [Alejandro Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) -- Mejoras para el `UUID` tipo de datos (aún no completo). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) -- Soporte para piezas vacías después de fusiones en el `SummingMergeTree`, `CollapsingMergeTree` y `VersionedCollapsingMergeTree` motor. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) -- Se eliminan los registros antiguos de mutaciones completadas (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) -- Se agregó el `system.merge_tree_settings` tabla. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) -- El `system.tables` la tabla ahora tiene columnas de dependencia: `dependencies_database` y `dependencies_table`. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) -- Se agregó el `max_partition_size_to_drop` opción de configuración. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) -- Se agregó el `output_format_json_escape_forward_slashes` opcion. [Alejandro Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2812) -- Se agregó el `max_fetch_partition_retries_count` configuración. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) -- Se agregó el `prefer_localhost_replica` configuración para deshabilitar la preferencia de una réplica local e ir a una réplica local sin interacción entre procesos. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) -- El `quantileExact` devoluciones de la función agregada `nan` en el caso de la agregación en un vacío `Float32` o `Float64` establecer. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) - -#### Corrección de errores: {#bug-fixes-14} - -- Se eliminó el escape innecesario de los parámetros de cadena de conexión para ODBC, lo que hizo imposible establecer una conexión. Este error se produjo en la versión 18.6.0. -- Se corrigió la lógica para el procesamiento `REPLACE PARTITION` comandos en la cola de replicación. Si hay dos `REPLACE` comandos para la misma partición, la lógica incorrecta podría hacer que uno de ellos permanezca en la cola de replicación y no se ejecute. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) -- Se corrigió un error de fusión cuando todas las partes de datos estaban vacías (partes que se formaron a partir de una fusión o de `ALTER DELETE` si se han eliminado todos los datos). Este error apareció en la versión 18.1.0. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) -- Se corrigió un error para concurrente `Set` o `Join`. [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2823) -- Se corrigió el `Block structure mismatch in UNION stream: different number of columns` error que ocurrió para `UNION ALL` consultas dentro de una subconsulta si una de las `SELECT` queries contiene nombres de columna duplicados. [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) -- Se corrigió una pérdida de memoria si se producía una excepción al conectarse a un servidor MySQL. -- Se corrigió el código de respuesta incorrecto de clickhouse-cliente en caso de un error de consulta. -- Se corrigió el comportamiento incorrecto de las vistas materializadas que contenían DISTINCT. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) - -#### Cambios incompatibles hacia atrás {#backward-incompatible-changes-4} - -- Se ha eliminado el soporte para consultas CHECK TABLE para tablas distribuidas. - -#### Crear cambios: {#build-changes-3} - -- El asignador ha sido reemplazado: `jemalloc` ahora se utiliza en lugar de `tcmalloc`. En algunos escenarios, esto aumenta la velocidad hasta un 20%. Sin embargo, hay consultas que se han ralentizado hasta en un 20%. El consumo de memoria se ha reducido en aproximadamente un 10% en algunos escenarios, con una estabilidad mejorada. Con cargas altamente competitivas, el uso de CPU en el espacio de usuario y en el sistema muestra solo un ligero aumento. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) -- Uso de libressl desde un submódulo. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) -- Uso de unixodbc desde un submódulo. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) -- Uso de mariadb-connector-c desde un submódulo. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) -- Se agregaron archivos de prueba funcionales al repositorio que dependen de la disponibilidad de los datos de prueba (por el momento, sin los datos de prueba en sí). - -## Lanzamiento de ClickHouse 18.6 {#clickhouse-release-18-6} - -### Lanzamiento de ClickHouse 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} - -#### Novedad: {#new-features-6} - -- Se agregó soporte para expresiones ON para la sintaxis JOIN ON: - `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` - La expresión debe ser una cadena de igualdad unida por el operador AND. Cada lado de la igualdad puede ser una expresión arbitraria sobre las columnas de una de las tablas. Se admite el uso de nombres de columna completos (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) para la tabla correcta. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) -- HTTPS se puede habilitar para la replicación. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) - -#### Mejora: {#improvements-6} - -- El servidor pasa el componente de parche de su versión al cliente. Los datos sobre el componente de la versión del parche se encuentran en `system.processes` y `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) - -## Lanzamiento de ClickHouse 18.5 {#clickhouse-release-18-5} - -### Lanzamiento de ClickHouse 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} - -#### Novedad: {#new-features-7} - -- Se agregó la función hash `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). - -#### Mejora: {#improvements-7} - -- Ahora puedes usar el `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) atributo para establecer valores en archivos de configuración a partir de variables de entorno. -- Se agregaron versiones que no distinguen entre mayúsculas y minúsculas del `coalesce`, `ifNull`, y `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). - -#### Corrección de errores: {#bug-fixes-15} - -- Se corrigió un posible error al iniciar una réplica [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). - -## Lanzamiento de ClickHouse 18.4 {#clickhouse-release-18-4} - -### Lanzamiento de ClickHouse 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} - -#### Novedad: {#new-features-8} - -- Tablas de sistema añadidas: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). -- Se agregó la capacidad de usar una función de tabla en lugar de una tabla como argumento de un `remote` o `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). -- Soporte para `HTTP Basic` autenticación en el protocolo de replicación [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). -- El `has` función ahora permite buscar un valor numérico en una matriz de `Enum` valor [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). -- Soporte para agregar separadores de mensajes arbitrarios al leer desde `Kafka` [Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2701). - -#### Mejora: {#improvements-8} - -- El `ALTER TABLE t DELETE WHERE` La consulta no reescribe partes de datos que no se vieron afectadas por la condición WHERE [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). -- El `use_minimalistic_checksums_in_zookeeper` opción para `ReplicatedMergeTree` tables está habilitada de forma predeterminada. Esta configuración se agregó en la versión 1.1.54378, 16-04-2018. Las versiones que son anteriores a 1.1.54378 ya no se pueden instalar. -- Soporte para correr `KILL` y `OPTIMIZE` consultas que especifican `ON CLUSTER` [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). - -#### Corrección de errores: {#bug-fixes-16} - -- Corregido el error `Column ... is not under an aggregate function and not in GROUP BY` para la agregación con una expresión IN. Este error apareció en la versión 18.1.0. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) -- Se ha corregido un error en el `windowFunnel aggregate function` [Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). -- Se ha corregido un error en el `anyHeavy` función agregada ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) -- Se corrigió el bloqueo del servidor al usar el `countArray()` función de agregado. - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-5} - -- Parámetros para `Kafka` el motor fue cambiado de `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` a `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. Si sus tablas usan `kafka_schema` o `kafka_num_consumers` parámetros, debe editar manualmente los archivos de metadatos `path/metadata/database/table.sql` y añadir `kafka_row_delimiter` parámetro con `''` valor. - -## Lanzamiento de ClickHouse 18.1 {#clickhouse-release-18-1} - -### Lanzamiento de ClickHouse 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} - -#### Novedad: {#new-features-9} - -- Soporte para el `ALTER TABLE t DELETE WHERE` consulta para tablas MergeTree no replicadas ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). -- Soporte para tipos arbitrarios para el `uniq*` familia de funciones agregadas ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). -- Soporte para tipos arbitrarios en operadores de comparación ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). -- El `users.xml` archivo permite establecer una máscara de subred en el formato `10.0.0.1/255.255.255.0`. Esto es necesario para usar máscaras para redes IPv6 con ceros en el medio ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). -- Se agregó el `arrayDistinct` función ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). -- El motor SummingMergeTree ahora puede funcionar con columnas de tipo AggregateFunction ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). - -#### Mejora: {#improvements-9} - -- Se ha cambiado el esquema de numeración para las versiones de lanzamiento. Ahora la primera parte contiene el año de lanzamiento (A.D., zona horaria de Moscú, menos 2000), la segunda parte contiene el número de cambios importantes (aumentos para la mayoría de las versiones) y la tercera parte es la versión del parche. Las versiones siguen siendo compatibles con versiones anteriores, a menos que se indique lo contrario en el registro de cambios. -- Conversiones más rápidas de números de coma flotante a una cadena ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2664)). -- Si se omitieron algunas filas durante una inserción debido a errores de análisis (esto es posible con el `input_allow_errors_num` y `input_allow_errors_ratio` configuración activada), el número de filas omitidas ahora se escribe en el registro del servidor ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). - -#### Corrección de errores: {#bug-fixes-17} - -- Se corrigió el comando TRUNCATE para tablas temporales ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2624)). -- Se corrigió un punto muerto raro en la biblioteca de cliente ZooKeeper que se producía cuando había un error de red al leer la respuesta ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). -- Se corrigió un error durante un CAST a Nullable tipos ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). -- Se corrigió el resultado incorrecto de la `maxIntersection()` función cuando los límites de los intervalos coincidieron ([Miguel Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). -- Se corrigió la transformación incorrecta de la cadena de expresión OR en un argumento de función ([Más información](https://github.com/ClickHouse/ClickHouse/pull/2663)). -- Se corrigió la degradación del rendimiento para las consultas que contenían `IN (subquery)` expresiones dentro de otra subconsulta ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). -- Se corrigió la incompatibilidad entre servidores con diferentes versiones en consultas distribuidas `CAST` función que no está en letras mayúsculas ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). -- Se agregaron citas faltantes de identificadores para consultas a un DBMS externo ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-6} - -- La conversión de una cadena que contiene el número cero a DateTime no funciona. Ejemplo: `SELECT toDateTime('0')`. Esta es también la razón por la que `DateTime DEFAULT '0'` no funciona en tablas, así como `0` en los diccionarios. Solución: reemplazar `0` con `0000-00-00 00:00:00`. - -## Lanzamiento de ClickHouse 1.1 {#clickhouse-release-1-1} - -### Lanzamiento de ClickHouse 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} - -#### Novedad: {#new-features-10} - -- Se agregó el `histogram` función agregada ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). -- Ahora `OPTIMIZE TABLE ... FINAL` se puede utilizar sin especificar particiones para `ReplicatedMergeTree` ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2600)). - -#### Corrección de errores: {#bug-fixes-18} - -- Se corrigió un problema con un tiempo de espera muy pequeño para los sockets (un segundo) para leer y escribir al enviar y descargar datos replicados, lo que hacía imposible descargar partes más grandes si hay una carga en la red o el disco (resultó en intentos cíclicos para descargar partes). Este error se produjo en la versión 1.1.54388. -- Se corrigieron problemas al usar chroot en ZooKeeper si insertaba bloques de datos duplicados en la tabla. -- El `has` la función ahora funciona correctamente para una matriz con elementos Nullable ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). -- El `system.tables` la tabla ahora funciona correctamente cuando se usa en consultas distribuidas. El `metadata_modification_time` y `engine_full` Las columnas ahora no son virtuales. Se corrigió un error que se producía si solo se consultaban estas columnas desde la tabla. -- Se corrigió cómo un vacío `TinyLog` la tabla funciona después de insertar un bloque de datos vacío ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). -- El `system.zookeeper` table funciona si el valor del nodo en ZooKeeper es NULL. - -### Lanzamiento de ClickHouse 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} - -#### Novedad: {#new-features-11} - -- Las consultas se pueden enviar en `multipart/form-data` formato (en el `query` campo), que es útil si también se envían datos externos para el procesamiento de consultas ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). -- Se agregó la capacidad de habilitar o deshabilitar el procesamiento de comillas simples o dobles al leer datos en formato CSV. Puede configurar esto en el `format_csv_allow_single_quotes` y `format_csv_allow_double_quotes` configuración ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2574)). -- Ahora `OPTIMIZE TABLE ... FINAL` se puede utilizar sin especificar la partición para variantes no replicadas de `MergeTree` ([Amos pájaro](https://github.com/ClickHouse/ClickHouse/pull/2599)). - -#### Mejora: {#improvements-10} - -- Rendimiento mejorado, consumo de memoria reducido y seguimiento correcto del consumo de memoria con el uso del operador IN cuando se podría usar un índice de tabla ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). -- Se eliminó la comprobación redundante de las sumas de comprobación al agregar una parte de datos. Esto es importante cuando hay un gran número de réplicas, porque en estos casos el número total de comprobaciones fue igual a N^2. -- Añadido soporte para `Array(Tuple(...))` los argumentos para el `arrayEnumerateUniq` función ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). -- Añadir `Nullable` soporte para el `runningDifference` función ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). -- Mejora del rendimiento del análisis de consultas cuando hay un gran número de expresiones ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). -- Selección más rápida de partes de datos para la fusión en `ReplicatedMergeTree` tabla. Recuperación más rápida de la sesión ZooKeeper ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). -- El `format_version.txt` archivo para `MergeTree` tables se vuelve a crear si falta, lo que tiene sentido si ClickHouse se inicia después de copiar la estructura de directorios sin archivos ([Películas De Sexo](https://github.com/ClickHouse/ClickHouse/pull/2593)). - -#### Corrección de errores: {#bug-fixes-19} - -- Se corrigió un error al trabajar con ZooKeeper que podría hacer imposible recuperar la sesión y los estados de solo lectura de las tablas antes de reiniciar el servidor. -- Se ha corregido un error al trabajar con ZooKeeper que podría hacer que los nodos antiguos no se eliminen si se interrumpe la sesión. -- Se corrigió un error en el `quantileTDigest` función para argumentos Float (este error se introdujo en la versión 1.1.54388) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). -- Se corrigió un error en el índice de las tablas MergeTree si la columna de clave principal se encuentra dentro de la función para convertir tipos entre enteros con signo y sin signo del mismo tamaño ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). -- Segfault fijo si `macros` se usan pero no están en el archivo de configuración ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). -- Se corrigió el cambio a la base de datos predeterminada al volver a conectar el cliente ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). -- Se corrigió un error que ocurría cuando el `use_index_for_in_with_subqueries` la configuración estaba deshabilitada. - -#### Solución de seguridad: {#security-fix-1} - -- El envío de archivos ya no es posible cuando se conecta a MySQL (`LOAD DATA LOCAL INFILE`). - -### Lanzamiento de ClickHouse 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} - -#### Novedad: {#new-features-12} - -- Soporte para el `ALTER TABLE t DELETE WHERE` consulta para tablas replicadas. Se agregó el `system.mutations` para realizar un seguimiento del progreso de este tipo de consultas. -- Soporte para el `ALTER TABLE t [REPLACE|ATTACH] PARTITION` consulta para tablas \*MergeTree. -- Soporte para el `TRUNCATE TABLE` consulta ([Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) -- Varios nuevos `SYSTEM` consultas para tablas replicadas (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). -- Se agregó la capacidad de escribir en una tabla con el motor MySQL y la función de tabla correspondiente ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). -- Se agregó el `url()` función de la tabla y el `URL` motor de mesa ([Alejandro Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). -- Se agregó el `windowFunnel` función agregada ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). -- Nuevo `startsWith` y `endsWith` funciones para cadenas ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). -- El `numbers()` función de tabla ahora le permite especificar el desplazamiento ([Invierno Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). -- La contraseña para `clickhouse-client` se puede introducir de forma interactiva. -- Los registros del servidor ahora se pueden enviar a syslog ([Alejandro Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). -- Compatibilidad con el inicio de sesión en diccionarios con una fuente de biblioteca compartida ([Alejandro Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). -- Soporte para delimitadores CSV personalizados ([Ivan Zhukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) -- Se agregó el `date_time_input_format` configuración. Si cambia esta configuración a `'best_effort'`, DateTime valores se leerán en una amplia gama de formatos. -- Se agregó el `clickhouse-obfuscator` utilidad para la ofuscación de datos. Ejemplo de uso: publicación de datos utilizados en pruebas de rendimiento. - -#### Experimental características: {#experimental-features-2} - -- Se agregó la capacidad de calcular `and` solo donde se necesitan ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) -- La compilación JIT a código nativo ya está disponible para algunas expresiones ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). - -#### Corrección de errores: {#bug-fixes-20} - -- Los duplicados ya no aparecen para una consulta con `DISTINCT` y `ORDER BY`. -- Consultas con `ARRAY JOIN` y `arrayFilter` ya no devuelve un resultado incorrecto. -- Se corrigió un error al leer una columna de matriz desde una estructura anidada ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). -- Se corrigió un error al analizar consultas con una cláusula HAVING como `HAVING tuple IN (...)`. -- Se ha corregido un error al analizar consultas con alias recursivos. -- Se corrigió un error al leer desde ReplacingMergeTree con una condición en PREWHERE que filtra todas las filas ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). -- La configuración del perfil de usuario no se aplicó al usar sesiones en la interfaz HTTP. -- Se corrigió cómo se aplican los ajustes desde los parámetros de línea de comandos en clickhouse-local. -- La biblioteca de cliente ZooKeeper ahora usa el tiempo de espera de sesión recibido del servidor. -- Se ha corregido un error en la biblioteca de cliente ZooKeeper cuando el cliente esperaba la respuesta del servidor más tiempo que el tiempo de espera. -- Poda fija de piezas para consultas con condiciones en columnas de clave de partición ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). -- Las fusiones ahora son posibles después `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). -- Se ha corregido la asignación de tipos en la función de tabla ODBC ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). -- Las comparaciones de tipos se han fijado para `DateTime` con y sin la zona horaria ([Alejandro Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). -- Análisis sintáctico fijo y formato del `CAST` operador. -- Inserción fija en una vista materializada para el motor de tabla distribuida ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). -- Se corrigió una condición de carrera al escribir datos desde el `Kafka` motor a vistas materializadas ([Información adicional](https://github.com/ClickHouse/ClickHouse/pull/2448)). -- SSRF fijo en la función de tabla remota (). -- Comportamiento de salida fijo de `clickhouse-client` en modo multilínea ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). - -#### Mejora: {#improvements-11} - -- Las tareas en segundo plano de las tablas replicadas ahora se realizan en un grupo de subprocesos en lugar de en subprocesos separados ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). -- Mejora del rendimiento de compresión LZ4. -- Análisis más rápido para consultas con un gran número de JOIN y subconsultas. -- La caché DNS ahora se actualiza automáticamente cuando hay demasiados errores de red. -- Las inserciones de tabla ya no se producen si la inserción en una de las vistas materializadas no es posible porque tiene demasiadas partes. -- Se ha corregido la discrepancia en los contadores de eventos `Query`, `SelectQuery`, y `InsertQuery`. -- Expresiones como `tuple IN (SELECT tuple)` se permiten si los tipos de tupla coinciden. -- Un servidor con tablas replicadas puede iniciarse incluso si no ha configurado ZooKeeper. -- Al calcular el número de núcleos de CPU disponibles, ahora se tienen en cuenta los límites en cgroups ([Más información](https://github.com/ClickHouse/ClickHouse/pull/2325)). -- Se agregó chown para los directorios de configuración en el archivo de configuración systemd ([Mikhail Shiryaev](https://github.com/ClickHouse/ClickHouse/pull/2421)). - -#### Crear cambios: {#build-changes-4} - -- El compilador gcc8 se puede usar para compilaciones. -- Se agregó la capacidad de construir llvm desde el submódulo. -- La versión de la biblioteca librdkafka se ha actualizado a v0.11.4. -- Se agregó la capacidad de usar la biblioteca libcpuid del sistema. La versión de la biblioteca se ha actualizado a 0.4.0. -- Se corrigió la compilación usando la biblioteca vectorclass ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). -- Cmake ahora genera archivos para ninja de forma predeterminada (como cuando se usa `-G Ninja`). -- Se agregó la capacidad de usar la biblioteca libtinfo en lugar de libtermcap ([Nuestros Servicios](https://github.com/ClickHouse/ClickHouse/pull/2519)). -- Se corrigió un conflicto de archivos de encabezado en Fedora Rawhide ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-7} - -- Eliminado escapar en `Vertical` y `Pretty*` formatea y elimina el `VerticalRaw` formato. -- Si los servidores con la versión 1.1.54388 (o posterior) y los servidores con una versión anterior se utilizan simultáneamente en una consulta distribuida y la consulta tiene `cast(x, 'Type')` expresión sin `AS` palabra clave y no tiene la palabra `cast` en mayúsculas, se lanzará una excepción con un mensaje como `Not found column cast(0, 'UInt8') in block`. Solución: actualice el servidor en todo el clúster. - -### Lanzamiento de ClickHouse 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} - -#### Corrección de errores: {#bug-fixes-21} - -- Se corrigió un error que en algunos casos causaba que las operaciones de ZooKeeper se bloquearan. - -### Lanzamiento de ClickHouse 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} - -#### Corrección de errores: {#bug-fixes-22} - -- Se corrigió una desaceleración de la cola de replicación si una tabla tiene muchas réplicas. - -### Lanzamiento de ClickHouse 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} - -#### Corrección de errores: {#bug-fixes-23} - -- Se corrigió una fuga de nodos en ZooKeeper cuando ClickHouse pierde la conexión con el servidor ZooKeeper. - -### Lanzamiento de ClickHouse 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} - -#### Novedad: {#new-features-13} - -- Se agregó la función de tabla `file(path, format, structure)`. Un ejemplo de lectura de bytes de `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. - -#### Mejora: {#improvements-12} - -- Las subconsultas se pueden envolver en `()` para mejorar la legibilidad de las consultas. Por ejemplo: `(SELECT 1) UNION ALL (SELECT 1)`. -- Simple `SELECT` consultas de la `system.processes` no están incluidos en el `max_concurrent_queries` limite. - -#### Corrección de errores: {#bug-fixes-24} - -- Corregido el comportamiento incorrecto del `IN` operador cuando seleccione de `MATERIALIZED VIEW`. -- Se corrigió el filtrado incorrecto por índice de partición en expresiones como `partition_key_column IN (...)`. -- Se corrigió la imposibilidad de ejecutar `OPTIMIZE` consulta sobre réplica no líder si `REANAME` se realizó sobre la mesa. -- Se corrigió el error de autorización al ejecutar `OPTIMIZE` o `ALTER` consultas en una réplica que no sea de líder. -- Congelación fija de `KILL QUERY`. -- Se corrigió un error en la biblioteca de cliente ZooKeeper que provocaba la pérdida de observaciones, la congelación de la cola DDL distribuida y ralentizaciones en la cola de replicación si no estaba vacía `chroot` prefijo se utiliza en la configuración ZooKeeper. - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-8} - -- Se eliminó el soporte para expresiones como `(a, b) IN (SELECT (a, b))` (puede usar la expresión equivalente `(a, b) IN (SELECT a, b)`). En versiones anteriores, estas expresiones conducían a `WHERE` filtrado o errores causados. - -### Lanzamiento de ClickHouse 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} - -#### Novedad: {#new-features-14} - -- El nivel de registro se puede cambiar sin reiniciar el servidor. -- Se agregó el `SHOW CREATE DATABASE` consulta. -- El `query_id` se puede pasar a `clickhouse-client` (elBroom). -- Nueva configuración: `max_network_bandwidth_for_all_users`. -- Añadido soporte para `ALTER TABLE ... PARTITION ...` para `MATERIALIZED VIEW`. -- Se agregó información sobre el tamaño de las partes de datos en forma sin comprimir en la tabla del sistema. -- Soporte de cifrado de servidor a servidor para tablas distribuidas (`1` en la configuración de réplica en ``). -- Configuración del nivel de tabla para el `ReplicatedMergeTree` familia con el fin de minimizar la cantidad de datos almacenados en Zookeeper: : `use_minimalistic_checksums_in_zookeeper = 1` -- Configuración del `clickhouse-client` pedir. De forma predeterminada, los nombres de servidor ahora se envían al mensaje. El nombre para mostrar del servidor se puede cambiar. También se envía en el `X-ClickHouse-Display-Name` Encabezado HTTP (Kirill Shvakov). -- Múltiples separados por comas `topics` se puede especificar para el `Kafka` motor (Tobias Adamson) -- Cuando una consulta es detenida por `KILL QUERY` o `replace_running_query` el cliente recibe el `Query was canceled` excepción en lugar de un resultado incompleto. - -#### Mejora: {#improvements-13} - -- `ALTER TABLE ... DROP/DETACH PARTITION` las consultas se ejecutan en la parte frontal de la cola de replicación. -- `SELECT ... FINAL` y `OPTIMIZE ... FINAL` se puede utilizar incluso cuando la tabla tiene una única parte de datos. -- A `query_log` se recrea sobre la marcha si se eliminó manualmente (Kirill Shvakov). -- El `lengthUTF8` funciona más rápido (zhang2014). -- Rendimiento mejorado de los insertos síncronos en `Distributed` tabla (`insert_distributed_sync = 1`) cuando hay una gran cantidad de fragmentos. -- El servidor acepta el `send_timeout` y `receive_timeout` configuraciones del cliente y las aplica cuando se conecta al cliente (se aplican en orden inverso: el socket del servidor `send_timeout` se establece en el `receive_timeout` valor recibido del cliente, y viceversa). -- Recuperación de bloqueos más robusta para la inserción asincrónica en `Distributed` tabla. -- El tipo de devolución del `countEqual` función cambiada de `UInt32` a `UInt64` (谢磊). - -#### Corrección de errores: {#bug-fixes-25} - -- Se corrigió un error con `IN` cuando el lado izquierdo de la expresión es `Nullable`. -- Ahora se devuelven los resultados correctos cuando se usan tuplas con `IN` cuando algunos de los componentes de la tupla están en el índice de la tabla. -- El `max_execution_time` limit ahora funciona correctamente con consultas distribuidas. -- Se corrigieron errores al calcular el tamaño de las columnas compuestas en el `system.columns` tabla. -- Se corrigió un error al crear una tabla temporal `CREATE TEMPORARY TABLE IF NOT EXISTS.` -- Corregidos errores en `StorageKafka` (\#\#2075) -- Se corrigieron fallos del servidor por argumentos no válidos de ciertas funciones agregadas. -- Se corrigió el error que impedía el `DETACH DATABASE` consulta de detener las tareas en segundo plano para `ReplicatedMergeTree` tabla. -- `Too many parts` es menos probable que ocurra al insertar en vistas materializadas agregadas (\#\# 2084). -- Se corrigió el manejo recursivo de sustituciones en la configuración si una sustitución debe ir seguida de otra sustitución en el mismo nivel. -- Se ha corregido la sintaxis en el archivo de metadatos al crear un `VIEW` que usa una consulta con `UNION ALL`. -- `SummingMergeTree` ahora funciona correctamente para la suma de estructuras de datos anidadas con una clave compuesta. -- Se corrigió la posibilidad de una condición de carrera al elegir el líder para `ReplicatedMergeTree` tabla. - -#### Crear cambios: {#build-changes-5} - -- La compilación admite `ninja` en lugar de `make` y usos `ninja` de forma predeterminada para la creación de versiones. -- Paquetes renombrados: `clickhouse-server-base` en `clickhouse-common-static`; `clickhouse-server-common` en `clickhouse-server`; `clickhouse-common-dbg` en `clickhouse-common-static-dbg`. Para instalar, utilice `clickhouse-server clickhouse-client`. Los paquetes con los nombres antiguos aún se cargarán en los repositorios por compatibilidad con versiones anteriores. - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-9} - -- Se eliminó la interpretación especial de una expresión IN si se especifica una matriz en el lado izquierdo. Anteriormente, la expresión `arr IN (set)` se interpretó como “at least one `arr` element belongs to the `set`”. Para obtener el mismo comportamiento en la nueva versión, escriba `arrayExists(x -> x IN (set), arr)`. -- Deshabilitado el uso incorrecto de la opción de socket `SO_REUSEPORT`, que se habilitó incorrectamente de forma predeterminada en la biblioteca Poco. Tenga en cuenta que en Linux ya no hay ninguna razón para especificar simultáneamente las direcciones `::` y `0.0.0.0` for listen – use just `::`, que permite escuchar la conexión tanto a través de IPv4 como IPv6 (con los ajustes de configuración predeterminados del kernel). También puede volver al comportamiento de versiones anteriores especificando `1` en la configuración. - -### Lanzamiento de ClickHouse 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} - -#### Novedad: {#new-features-15} - -- Se agregó el `system.macros` tabla y actualización automática de macros cuando se cambia el archivo de configuración. -- Se agregó el `SYSTEM RELOAD CONFIG` consulta. -- Se agregó el `maxIntersections(left_col, right_col)` función de agregado, que devuelve el número máximo de intervalos de intersección simultáneamente `[left; right]`. El `maxIntersectionsPosition(left, right)` función devuelve el comienzo de la “maximum” intervalo. ([Miguel Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). - -#### Mejora: {#improvements-14} - -- Al insertar datos en un `Replicated` se hacen menos solicitudes para `ZooKeeper` (y la mayoría de los errores de nivel de usuario han desaparecido del `ZooKeeper` registro). -- Se agregó la capacidad de crear alias para conjuntos de datos. Ejemplo: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. - -#### Corrección de errores: {#bug-fixes-26} - -- Se corrigió el `Illegal PREWHERE` error al leer de las tablas Merge para `Distributed`tabla. -- Se agregaron correcciones que le permiten iniciar clickhouse-server en contenedores Docker solo para IPv4. -- Se corrigió una condición de carrera al leer desde el sistema `system.parts_columns tables.` -- Se eliminó el doble almacenamiento en búfer durante una inserción síncrona en un `Distributed` tabla, lo que podría haber causado que la conexión agotara el tiempo de espera. -- Se corrigió un error que causaba esperas excesivamente largas para una réplica no disponible antes de comenzar un `SELECT` consulta. -- Se corrigieron fechas incorrectas en el `system.parts` tabla. -- Se corrigió un error que hacía imposible insertar datos en un `Replicated` mesa si `chroot` no estaba vacío en la configuración del `ZooKeeper` Cluster. -- Se corrigió el algoritmo de fusión vertical para un vacío `ORDER BY` tabla. -- Se restauró la capacidad de usar diccionarios en consultas a tablas remotas, incluso si estos diccionarios no están presentes en el servidor del solicitante. Esta funcionalidad se perdió en la versión 1.1.54362. -- Restauró el comportamiento para consultas como `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` cuando el lado derecho de la `IN` debe utilizar un control remoto `default.table` en lugar de uno local. Este comportamiento se rompió en la versión 1.1.54358. -- Se eliminó el registro de nivel de error extraño de `Not found column ... in block`. - -### ¿Qué puedes encontrar en Neodigit {#clickhouse-release-1-1-54362-2018-03-11} - -#### Novedad: {#new-features-16} - -- Agregación sin `GROUP BY` para un conjunto vacío (como `SELECT count(*) FROM table WHERE 0`) ahora devuelve un resultado con una fila con valores nulos para funciones agregadas, de acuerdo con el estándar SQL. Para restaurar el comportamiento anterior (devolver un resultado vacío), establezca `empty_result_for_aggregation_by_empty_set` a 1. -- Añadido tipo de conversión para `UNION ALL`. Se permiten diferentes nombres de alias en `SELECT` posiciones en `UNION ALL`, de acuerdo con el estándar SQL. -- Las expresiones arbitrarias se admiten en `LIMIT BY` clausula. Anteriormente, solo era posible usar columnas resultantes de `SELECT`. -- Un índice de `MergeTree` se utiliza cuando `IN` se aplica a una tupla de expresiones de las columnas de la clave principal. Ejemplo: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). -- Se agregó el `clickhouse-copier` herramienta para copiar entre clústeres y resharding datos (beta). -- Se agregaron funciones hash consistentes: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. Se pueden usar como una clave de fragmentación para reducir la cantidad de tráfico de red durante los subsiguientes reshardings. -- Funciones añadidas: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. -- Se agregó el `arrayCumSum` (Javi Santana). -- Se agregó el `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, y `parseDateTimeBestEffortOrNull` funciones para leer el DateTime de una cadena que contiene texto en una amplia variedad de formatos posibles. -- Los datos se pueden volver a cargar parcialmente de diccionarios externos durante la actualización (cargar sólo los registros en los que el valor del campo especificado mayor que en la descarga anterior) (Arsen Hakobyan). -- Se agregó el `cluster` función de la tabla. Ejemplo: `cluster(cluster_name, db, table)`. El `remote` función de tabla puede aceptar el nombre del clúster como el primer argumento, si se especifica como un identificador. -- El `remote` y `cluster` las funciones de la tabla se pueden utilizar en `INSERT` consulta. -- Se agregó el `create_table_query` y `engine_full` columnas virtuales a la `system.tables`tabla . El `metadata_modification_time` columna es virtual. -- Se agregó el `data_path` y `metadata_path` columnas a `system.tables`y`system.databases` tablas, y añadió el `path` columna a la `system.parts` y `system.parts_columns` tabla. -- Se agregó información adicional sobre fusiones en el `system.part_log` tabla. -- Se puede utilizar una clave de partición arbitraria para `system.query_log` (Kirill Shvakov). -- El `SHOW TABLES` consulta ahora también muestra tablas temporales. Se agregaron tablas temporales y el `is_temporary` columna a `system.tables` (zhang2014). -- Añadir `DROP TEMPORARY TABLE` y `EXISTS TEMPORARY TABLE` consultas (zhang2014). -- Soporte para `SHOW CREATE TABLE` para tablas temporales (zhang2014). -- Se agregó el `system_profile` parámetro de configuración para los ajustes utilizados por los procesos internos. -- Soporte para carga `object_id` como un atributo en `MongoDB` diccionarios (Pavel Litvinenko). -- Lectura `null` como el valor predeterminado al cargar datos para un diccionario externo con el `MongoDB` fuente (Pavel Litvinenko). -- Lectura `DateTime` valores en el `Values` formato de una marca de tiempo Unix sin comillas simples. -- La conmutación por error se admite en `remote` funciones de tabla para los casos en que a algunas de las réplicas les falta la tabla solicitada. -- Los valores de configuración se pueden anular en la línea de comandos al ejecutar `clickhouse-server`. Ejemplo: `clickhouse-server -- --logger.level=information`. -- Implementado el `empty` función de un `FixedString` argumento: la función devuelve 1 si la cadena consta completamente de bytes nulos (zhang2014). -- Se agregó el `listen_try`parámetro de configuración para escuchar al menos una de las direcciones de escucha sin salir, si algunas de las direcciones no se pueden escuchar (útil para sistemas con soporte deshabilitado para IPv4 o IPv6). -- Se agregó el `VersionedCollapsingMergeTree` motor de mesa. -- Soporte para filas y tipos numéricos arbitrarios para el `library` fuente del diccionario. -- `MergeTree` las tablas se pueden usar sin una clave principal (debe especificar `ORDER BY tuple()`). -- A `Nullable` tipo puede ser `CAST` a un no-`Nullable` escriba si el argumento no es `NULL`. -- `RENAME TABLE` se puede realizar para `VIEW`. -- Se agregó el `throwIf` función. -- Se agregó el `odbc_default_field_size` opción, que le permite extender el tamaño máximo del valor cargado desde una fuente ODBC (por defecto, es 1024). -- El `system.processes` mesa y `SHOW PROCESSLIST` ahora tienen el `is_cancelled` y `peak_memory_usage` columna. - -#### Mejora: {#improvements-15} - -- Los límites y las cuotas sobre el resultado ya no se aplican a los datos intermedios para `INSERT SELECT` consultas o para `SELECT` subconsultas. -- Menos desencadenantes falsos de `force_restore_data` al comprobar el estado de `Replicated` cuando se inicia el servidor. -- Se agregó el `allow_distributed_ddl` opcion. -- Las funciones no deterministas no están permitidas en expresiones para `MergeTree` teclas de mesa. -- Archivos con sustituciones de `config.d` los directorios se cargan en orden alfabético. -- Rendimiento mejorado del `arrayElement` función en el caso de una matriz multidimensional constante con una matriz vacía como uno de los elementos. Ejemplo: `[[1], []][x]`. -- El servidor se inicia más rápido ahora cuando se utilizan archivos de configuración con sustituciones muy grandes (por ejemplo, listas muy grandes de redes IP). -- Al ejecutar una consulta, las funciones de valor de tabla se ejecutan una vez. Previamente, `remote` y `mysql` las funciones de valor de tabla realizaron la misma consulta dos veces para recuperar la estructura de tabla de un servidor remoto. -- El `MkDocs` se utiliza el generador de documentación. -- Cuando intenta eliminar una columna de tabla que `DEFAULT`/`MATERIALIZED` expresiones de otras columnas dependen, se lanza una excepción (zhang2014). -- Se agregó la capacidad de analizar una línea vacía en formatos de texto como el número 0 para `Float` tipos de datos. Esta característica estaba disponible anteriormente, pero se perdió en la versión 1.1.54342. -- `Enum` se pueden utilizar en `min`, `max`, `sum` y algunas otras funciones. En estos casos, utiliza los valores numéricos correspondientes. Esta característica estaba disponible anteriormente, pero se perdió en la versión 1.1.54337. -- Añadir `max_expanded_ast_elements` para restringir el tamaño del AST después de expandir recursivamente los alias. - -#### Corrección de errores: {#bug-fixes-27} - -- Fijo casos innecesarios columnas fueron retirados de las subconsultas en error, o no se quitan de subconsultas que contiene `UNION ALL`. -- Se corrigió un error en las fusiones para `ReplacingMergeTree` tabla. -- Inserciones síncronas fijas en `Distributed` tabla (`insert_distributed_sync = 1`). -- Segfault fijo para ciertos usos de `FULL` y `RIGHT JOIN` con columnas duplicadas en subconsultas. -- Segfault fijo para ciertos usos de `replace_running_query` y `KILL QUERY`. -- Se corrigió el orden de la `source` y `last_exception` columnas en el `system.dictionaries` tabla. -- Se corrigió un error cuando el `DROP DATABASE` la consulta no eliminó el archivo con metadatos. -- Se corrigió el `DROP DATABASE` consulta para `Dictionary` base. -- Se corrigió la baja precisión de `uniqHLL12` y `uniqCombined` funciones para cardinalidades superiores a 100 millones de artículos (Alex Bocharov). -- Se corrigió el cálculo de valores predeterminados implícitos cuando era necesario para calcular simultáneamente expresiones explícitas predeterminadas en `INSERT` consultas (zhang2014). -- Se corrigió un caso raro cuando una consulta a un `MergeTree` la tabla no pudo terminar (chenxing-xc). -- Se corrigió un bloqueo que se produjo al ejecutar un `CHECK` consulta para `Distributed` tablas si todos los fragmentos son locales (chenxing.xc). -- Se corrigió una ligera regresión de rendimiento con funciones que usan expresiones regulares. -- Se corrigió una regresión de rendimiento al crear matrices multidimensionales a partir de expresiones complejas. -- Se corrigió un error que podía causar un extra `FORMAT` sección para aparecer en una `.sql` archivo con metadatos. -- Se corrigió un error que causaba la `max_table_size_to_drop` límite para aplicar cuando se intenta eliminar un `MATERIALIZED VIEW` mirando una tabla explícitamente especificada. -- Se corrigió la incompatibilidad con clientes antiguos (a los clientes antiguos a veces se enviaban datos con el `DateTime('timezone')` tipo, que no entienden). -- Se ha corregido un error al leer `Nested` elementos de columna de estructuras que se agregaron usando `ALTER` pero que están vacíos para las particiones antiguas, cuando las condiciones para estas columnas se movieron a `PREWHERE`. -- Se corrigió un error al filtrar tablas por virtual `_table` columnas en consultas a `Merge` tabla. -- Se corrigió un error al usar `ALIAS` columnas en `Distributed` tabla. -- Se corrigió un error que hacía imposible la compilación dinámica para consultas con funciones agregadas del `quantile` familia. -- Se corrigió una condición de carrera en la canalización de ejecución de consultas que ocurría en casos muy raros al usar `Merge` con un gran número de tablas, y cuando se utiliza `GLOBAL` subconsultas. -- Se corrigió un bloqueo al pasar matrices de diferentes tamaños a un `arrayReduce` función cuando se utilizan funciones agregadas de múltiples argumentos. -- Prohibido el uso de consultas con `UNION ALL` en una `MATERIALIZED VIEW`. -- Se corrigió un error durante la inicialización del `part_log` tabla del sistema cuando se inicia el servidor (de forma predeterminada, `part_log` está deshabilitado). - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-10} - -- Eliminado el `distributed_ddl_allow_replicated_alter` opcion. Este comportamiento está habilitado de forma predeterminada. -- Eliminado el `strict_insert_defaults` configuración. Si estaba utilizando esta funcionalidad, escriba en `clickhouse-feedback@yandex-team.com`. -- Eliminado el `UnsortedMergeTree` motor. - -### ¿Qué puedes encontrar en Neodigit {#clickhouse-release-1-1-54343-2018-02-05} - -- Se agregó soporte de macros para definir nombres de clúster en consultas DDL distribuidas y constructores de tablas distribuidas: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. -- Ahora consultas como `SELECT ... FROM table WHERE expr IN (subquery)` se procesan utilizando el `table` Indice. -- Se ha mejorado el procesamiento de duplicados al insertar en tablas replicadas, por lo que ya no ralentizan la ejecución de la cola de replicación. - -### ¿Qué puedes encontrar en Neodigit {#clickhouse-release-1-1-54342-2018-01-22} - -Esta versión contiene correcciones de errores para la versión anterior 1.1.54337: - -- Se corrigió una regresión en 1.1.54337: si el usuario predeterminado tiene acceso de solo lectura, entonces el servidor se niega a iniciar con el mensaje `Cannot create database in readonly mode`. -- Se corrigió una regresión en 1.1.54337: en sistemas con systemd, los registros siempre se escriben en syslog independientemente de la configuración; el script de vigilancia todavía usa init .d. -- Se corrigió una regresión en 1.1.54337: configuración predeterminada incorrecta en la imagen de Docker. -- Comportamiento no determinista fijo de GraphiteMergeTree (se puede ver en los mensajes de registro `Data after merge is not byte-identical to the data on another replicas`). -- Se corrigió un error que podía provocar fusiones inconsistentes después de OPTIMIZE consulta a tablas replicadas (es posible que lo vea en los mensajes de registro `Part ... intersects the previous part`). -- Las tablas de búfer ahora funcionan correctamente cuando las columnas MATERIALIZED están presentes en la tabla de destino (por zhang2014). -- Se corrigió un error en la implementación de NULL. - -### ¿Qué puedes encontrar en Neodigit {#clickhouse-release-1-1-54337-2018-01-18} - -#### Novedad: {#new-features-17} - -- Se agregó soporte para el almacenamiento de matrices multidimensionales y tuplas (`Tuple` tipo de datos) en las tablas. -- Soporte para funciones de mesa para `DESCRIBE` y `INSERT` consulta. Se agregó soporte para subconsultas en `DESCRIBE`. Ejemplos: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. Soporte para `INSERT INTO TABLE` además de `INSERT INTO`. -- Soporte mejorado para zonas horarias. El `DateTime` tipo de datos se puede anotar con la zona horaria que se utiliza para el análisis y el formato en formatos de texto. Ejemplo: `DateTime('Europe/Moscow')`. Cuando las zonas horarias se especifican en `DateTime` argumentos, el tipo de devolución rastreará la zona horaria y el valor se mostrará como se esperaba. -- Se agregaron las funciones `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. El `toRelativeHour`/`Minute`/`Second` funciones pueden tomar un valor de tipo `Date` como argumento. El `now` nombre de la función distingue entre mayúsculas y minúsculas. -- Se agregó el `toStartOfFifteenMinutes` (Kirill Shvakov). -- Se agregó el `clickhouse format` herramienta para formatear consultas. -- Se agregó el `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` formato. Los archivos de esquema solo se pueden ubicar en el directorio especificado. -- Se agregó soporte para sustituciones de configuración (`incl` y `conf.d`) para la configuración de diccionarios y modelos externos (Pavel Yakunin). -- Se agregó una columna con documentación para el `system.settings` (Kirill Shvakov). -- Se agregó el `system.parts_columns` tabla con información sobre los tamaños de columna en cada parte de datos `MergeTree` tabla. -- Se agregó el `system.models` tabla con información sobre `CatBoost` modelos de aprendizaje automático. -- Se agregó el `mysql` y `odbc` función de la tabla y correspondiente `MySQL` y `ODBC` para acceder a bases de datos remotas. Esta funcionalidad se encuentra en la fase beta. -- Se agregó la posibilidad de pasar un argumento de tipo `AggregateFunction` para el `groupArray` función agregada (para que pueda crear una matriz de estados de alguna función agregada). -- Se eliminaron restricciones en varias combinaciones de combinadores de funciones agregadas. Por ejemplo, puede usar `avgForEachIf` así como `avgIfForEach` funciones agregadas, que tienen diferentes comportamientos. -- El `-ForEach` el combinador de funciones agregadas se extiende para el caso de funciones agregadas de múltiples argumentos. -- Se agregó soporte para funciones agregadas de `Nullable` argumentos incluso para los casos en que la función devuelve un no-`Nullable` resultado (añadido con la contribución de Silviu Caragea). Ejemplo: `groupArray`, `groupUniqArray`, `topK`. -- Se agregó el `max_client_network_bandwidth` para `clickhouse-client` (Kirill Shvakov). -- Los usuarios con `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). -- Se agregó soporte para el uso de múltiples consumidores con el `Kafka` motor. Opciones de configuración ampliadas para `Kafka` (Marek Vavruša). -- Se agregó el `intExp3` y `intExp4` función. -- Se agregó el `sumKahan` función de agregado. -- Añadido el a \* Número\* OrNull funciones, donde \* Número\* es un tipo numérico. -- Añadido soporte para `WITH` para una `INSERT SELECT` consulta (autor: zhang2014). -- Configuración añadida: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. En particular, estos valores se utilizan para descargar partes de datos para la replicación. Cambiar esta configuración permite una conmutación por error más rápida si la red está sobrecargada. -- Añadido soporte para `ALTER` para tablas de tipo `Null` (Anastasiya Tsarkova). -- El `reinterpretAsString` se extiende para todos los tipos de datos que se almacenan contiguamente en la memoria. -- Se agregó el `--silent` opción para el `clickhouse-local` herramienta. Suprime la información de ejecución de consultas de impresión en stderr. -- Se agregó soporte para leer valores de tipo `Date` de texto en un formato donde el mes y / o día del mes se especifica utilizando un solo dígito en lugar de dos dígitos (Amos Bird). - -#### Optimizaciones de rendimiento: {#performance-optimizations} - -- Rendimiento mejorado de las funciones agregadas `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` de argumentos de cadena. -- Mejora del rendimiento de las funciones `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. -- Rendimiento mejorado del análisis y el formato `Date` y `DateTime` valores de tipo en formato de texto. -- Mejora del rendimiento y la precisión del análisis de números de coma flotante. -- Menor uso de memoria para `JOIN` en el caso cuando las partes izquierda y derecha tienen columnas con nombres idénticos que no están contenidos en `USING` . -- Rendimiento mejorado de las funciones agregadas `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` reduciendo la estabilidad computacional. Las funciones antiguas están disponibles bajo los nombres `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. - -#### Corrección de errores: {#bug-fixes-28} - -- Deduplicación de datos fija después de ejecutar un `DROP` o `DETACH PARTITION` consulta. En la versión anterior, soltar una partición e insertar los mismos datos de nuevo no funcionaba porque los bloques insertados se consideraban duplicados. -- Se corrigió un error que podía conducir a una interpretación incorrecta de la `WHERE` cláusula para `CREATE MATERIALIZED VIEW` consultas con `POPULATE` . -- Se corrigió un error al usar el `root_path` parámetro en el `zookeeper_servers` configuración. -- Se corrigieron los resultados inesperados de pasar el `Date` argumento a `toStartOfDay` . -- Se corrigió el `addMonths` y `subtractMonths` funciones y la aritmética para `INTERVAL n MONTH` en los casos en que el resultado tiene el año anterior. -- Se agregó soporte faltante para el `UUID` tipo de datos para `DISTINCT` , `JOIN` , y `uniq` funciones agregadas y diccionarios externos (Evgeniy Ivanov). Soporte para `UUID` todavía está incompleto. -- Fijo `SummingMergeTree` comportamiento en los casos en que las filas suman a cero. -- Varias correcciones para el `Kafka` engine (Marek Vavruša). -- Corregido el comportamiento incorrecto del `Join` motor de mesa (Amos Bird). -- Se corrigió el comportamiento incorrecto del asignador en FreeBSD y OS X. -- El `extractAll` la función ahora admite coincidencias vacías. -- Se corrigió un error que bloqueaba el uso de `libressl` en lugar de `openssl` . -- Se corrigió el `CREATE TABLE AS SELECT` consulta de tablas temporales. -- Se corrigió la no anatomía de la actualización de la cola de replicación. Esto podría provocar que las réplicas no estén sincronizadas hasta que se reinicie el servidor. -- Posible desbordamiento fijo en `gcd` , `lcm` y `modulo` (`%` (Maks Skorokhod). -- `-preprocessed` los archivos ahora se crean después de cambiar `umask` (`umask` se puede cambiar en la configuración). -- Se corrigió un error en la verificación de antecedentes de las piezas (`MergeTreePartChecker` ) cuando se utiliza una clave de partición personalizada. -- Análisis fijo de tuplas (valores de la `Tuple` tipo de datos) en formatos de texto. -- Mensajes de error mejorados sobre tipos incompatibles pasados a `multiIf` , `array` y algunas otras funciones. -- Soporte rediseñado para `Nullable` tipo. Se corrigieron errores que podían provocar un bloqueo del servidor. Se corrigieron casi todos los demás errores relacionados con `NULL` soporte: conversiones de tipo incorrectas en INSERT SELECT, soporte insuficiente para Nullable en HAVING y PREWHERE, `join_use_nulls` modo, tipos anulables como argumentos de `OR` operador, etc. -- Se corrigieron varios errores relacionados con la semántica interna de los tipos de datos. Ejemplos: suma innecesaria de `Enum` campos de tipo en `SummingMergeTree` ; alineación de `Enum` tipos en `Pretty` formatos, etc. -- Comprueba más estrictamente las combinaciones permitidas de columnas compuestas. -- Se corrigió el desbordamiento al especificar un parámetro muy grande para el `FixedString` tipo de datos. -- Se ha corregido un error en el `topK` función de agregado en un caso genérico. -- Se agregó la verificación faltante de igualdad de tamaños de matriz en argumentos de variantes narias de funciones agregadas con un `-Array` combinador. -- Se ha corregido un error en `--pager` para `clickhouse-client` (autor: ks1322). -- Se corrigió la precisión del `exp10` función. -- Se corrigió el comportamiento del `visitParamExtract` función para un mejor cumplimiento de la documentación. -- Se corrigió el bloqueo cuando se especifican tipos de datos incorrectos. -- Se corrigió el comportamiento de `DISTINCT` en el caso cuando todas las columnas son constantes. -- Se corrigió el formato de consulta en el caso de usar el `tupleElement` función con una expresión constante compleja como el índice del elemento de tupla. -- Se ha corregido un error en `Dictionary` tablas para `range_hashed` diccionario. -- Se corrigió un error que provocaba filas excesivas en el resultado de `FULL` y `RIGHT JOIN` (Amós De Aves). -- Se corrigió un bloqueo del servidor al crear y eliminar archivos temporales en `config.d` directorios durante la recarga de configuración. -- Se corrigió el `SYSTEM DROP DNS CACHE` consulta: la memoria caché se vació pero las direcciones de los nodos del clúster no se actualizaron. -- Se corrigió el comportamiento de `MATERIALIZED VIEW` después de ejecutar `DETACH TABLE` for the table under the view (Marek Vavruša). - -#### Mejoras de construcción: {#build-improvements-4} - -- El `pbuilder` herramienta se utiliza para compilaciones. El proceso de compilación es casi completamente independiente del entorno de host de compilación. -- Una sola compilación se utiliza para diferentes versiones del sistema operativo. Los paquetes y binarios se han hecho compatibles con una amplia gama de sistemas Linux. -- Se agregó el `clickhouse-test` paquete. Se puede usar para ejecutar pruebas funcionales. -- El archivo tarball de origen ahora se puede publicar en el repositorio. Se puede usar para reproducir la compilación sin usar GitHub. -- Se agregó una integración limitada con Travis CI. Debido a los límites en el tiempo de compilación en Travis, solo se prueba la compilación de depuración y se ejecuta un subconjunto limitado de pruebas. -- Añadido soporte para `Cap'n'Proto` en la compilación predeterminada. -- Se ha cambiado el formato de las fuentes de documentación de `Restricted Text` a `Markdown`. -- Añadido soporte para `systemd` (Vladimir Smirnov). Está deshabilitado por defecto debido a la incompatibilidad con algunas imágenes del sistema operativo y se puede habilitar manualmente. -- Para la generación de código dinámico, `clang` y `lld` están incrustados en el `clickhouse` binario. También se pueden invocar como `clickhouse clang` y `clickhouse lld` . -- Se eliminó el uso de extensiones GNU del código. Habilitado el `-Wextra` opcion. Al construir con `clang` el valor predeterminado es `libc++` en lugar de `libstdc++`. -- Extraer `clickhouse_parsers` y `clickhouse_common_io` bibliotecas para acelerar las compilaciones de varias herramientas. - -#### Cambios incompatibles hacia atrás: {#backward-incompatible-changes-11} - -- El formato de las marcas en `Log` tablas de tipos que contienen `Nullable` columnas se cambió de una manera incompatible con versiones anteriores. Si tiene estas tablas, debe convertirlas a la `TinyLog` escriba antes de iniciar la nueva versión del servidor. Para hacer esto, reemplace `ENGINE = Log` con `ENGINE = TinyLog` en el correspondiente `.sql` archivo en el `metadata` directorio. Si su tabla no tiene `Nullable` o si el tipo de su tabla no es `Log`, entonces usted no tiene que hacer nada. -- Eliminado el `experimental_allow_extended_storage_definition_syntax` configuración. Ahora esta característica está habilitada de forma predeterminada. -- El `runningIncome` función fue renombrada a `runningDifferenceStartingWithFirstvalue` para evitar confusiones. -- Eliminado el `FROM ARRAY JOIN arr` sintaxis cuando ARRAY JOIN se especifica directamente después de FROM sin tabla (Amos Bird). -- Eliminado el `BlockTabSeparated` formato que se utilizó únicamente con fines de demostración. -- Se ha cambiado el formato de estado para las funciones agregadas `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Si ha almacenado estados de estas funciones agregadas en tablas (utilizando `AggregateFunction` tipo de datos o vistas materializadas con los estados correspondientes), por favor escriba a clickhouse-feedback@yandex-team.com. -- En versiones anteriores del servidor había una característica no documentada: si una función agregada depende de parámetros, aún puede especificarla sin parámetros en el tipo de datos AggregateFunction . Ejemplo: `AggregateFunction(quantiles, UInt64)` en lugar de `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. Esta característica se perdió. Aunque no estaba documentado, planeamos apoyarlo nuevamente en futuras versiones. -- Los tipos de datos de enumeración no se pueden usar en funciones de agregado mínimo / máximo. Esta habilidad se devolverá en la próxima versión. - -#### Tenga en cuenta al actualizar: {#please-note-when-upgrading} - -- Al realizar una actualización continua en un clúster, en el momento en que algunas de las réplicas ejecutan la versión anterior de ClickHouse y otras ejecutan la nueva versión, la replicación se detiene temporalmente y el mensaje `unknown parameter 'shard'` aparece en el registro. La replicación continuará después de que se actualicen todas las réplicas del clúster. -- Si se están ejecutando diferentes versiones de ClickHouse en los servidores de clúster, es posible que las consultas distribuidas que utilizan las siguientes funciones tengan resultados incorrectos: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Debe actualizar todos los nodos del clúster. - -## [Nivel de Cifrado WEP](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/es/whats_new/changelog/2019.md b/docs/es/whats_new/changelog/2019.md deleted file mode 100644 index ab0a96f38b2..00000000000 --- a/docs/es/whats_new/changelog/2019.md +++ /dev/null @@ -1,2074 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 77 -toc_title: '2019' ---- - -## ClickHouse de liberación de la v19.17 {#clickhouse-release-v19-17} - -### Lanzamiento de ClickHouse v19.17.6.36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} - -#### Corrección de errores {#bug-fix} - -- Desbordamiento de búfer potencial fijo en descomprimir. El usuario malintencionado puede pasar datos comprimidos fabricados que podrían causar lectura después del búfer. Este problema fue encontrado por Eldar Zaitov del equipo de seguridad de la información de Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió un posible bloqueo del servidor (`std::terminate`) cuando el servidor no puede enviar o escribir datos en formato JSON o XML con valores de tipo de datos String (que requieren validación UTF-8) o al comprimir datos de resultados con el algoritmo Brotli o en algunos otros casos raros. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Diccionarios fijos con fuente de un clickhouse `VIEW`, ahora leer tales diccionarios no causa el error `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Se corrigió la comprobación de si un host cliente está permitido por host\_regexp especificado en los usuarios.XML. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- `RENAME TABLE` para una tabla distribuida ahora cambia el nombre de la carpeta que contiene los datos insertados antes de enviarlos a los fragmentos. Esto soluciona un problema con los cambios de nombre sucesivos `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([Tavplubix](https://github.com/tavplubix)) -- `range_hashed` Los diccionarios externos creados por consultas DDL ahora permiten rangos de tipos numéricos arbitrarios. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -- Fijo `INSERT INTO table SELECT ... FROM mysql(...)` función de la tabla. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([Tavplubix](https://github.com/tavplubix)) -- Segfault fijo en `INSERT INTO TABLE FUNCTION file()` mientras se inserta en un archivo que no existe. Ahora, en este caso, se crearía un archivo y luego se procesaría la inserción. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- Se corrigió el error bitmapAnd al intersecar un mapa de bits agregado y un mapa de bits escalar. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -- Segfault fijo cuando `EXISTS` consulta se utilizó sin `TABLE` o `DICTIONARY` calificador, al igual que `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tipo de retorno fijo para funciones `rand` y `randConstant` en caso de argumento anulable. Ahora las funciones siempre regresan `UInt32` y nunca `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fijo `DROP DICTIONARY IF EXISTS db.dict`, ahora no lanza la excepción si `db` no existe. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- Si una tabla no se eliminó por completo debido a un bloqueo del servidor, el servidor intentará restaurarla y cargarla [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([Tavplubix](https://github.com/tavplubix)) -- Se corrigió una consulta de recuento trivial para una tabla distribuida si hay más de dos tablas locales de fragmentos. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- Se corrigió un error que conducía a una carrera de datos en DB :: BlockStreamProfileInfo :: calculateRowsBeforeLimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alejandro Kazakov](https://github.com/Akazz)) -- Fijo `ALTER table MOVE part` se ejecuta inmediatamente después de fusionar la parte especificada, lo que podría provocar el movimiento de una parte en la que la parte especificada se fusionó. Ahora mueve correctamente la parte especificada. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Las expresiones para los diccionarios se pueden especificar como cadenas ahora. Esto es útil para el cálculo de atributos al extraer datos de fuentes que no son de ClickHouse porque permite usar la sintaxis que no son de ClickHouse para esas expresiones. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -- Se corrigió una carrera muy rara en `clickhouse-copier` debido a un desbordamiento en ZXid. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Más información](https://github.com/dingxiangfei2009)) -- Se corrigió el error cuando después de la consulta falló (debido a “Too many simultaneous queries” por ejemplo) no leería información de tablas externas, y el - La siguiente solicitud interpretaría esta información como el comienzo de la siguiente consulta causando un error como `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- Evite la desreferencia nula después de “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- Restaure el soporte de todas las configuraciones regionales de la UCI, agregue la capacidad de aplicar intercalaciones para expresiones constantes y agregue el nombre del idioma al sistema.mesa de colaciones. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -- Número de secuencias para leer desde `StorageFile` y `StorageHDFS` ahora está limitado, para evitar exceder el límite de memoria. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -- Fijo `CHECK TABLE` consulta para `*MergeTree` mesas sin llave. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -- Eliminado el número de mutación de un nombre de pieza en caso de que no hubiera mutaciones. Esta eliminación mejoró la compatibilidad con versiones anteriores. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -- Se corrigió el error de que las mutaciones se omiten para algunas partes adjuntas debido a que su versión de datos son más grandes que la versión de mutación de la tabla. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) -- Permita iniciar el servidor con copias redundantes de piezas después de moverlas a otro dispositivo. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Corregido el error “Sizes of columns doesn’t match” que pueden aparecer al usar columnas de función agregadas. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- Ahora se lanzará una excepción en caso de usar WITH TIES junto con LIMIT BY. Y ahora es posible usar TOP con LIMIT BY. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Repara la recarga del diccionario si tiene `invalidate_query`, que detuvo las actualizaciones y alguna excepción en los intentos de actualización anteriores. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) - -### Lanzamiento de ClickHouse v19.17.4.11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} - -#### Cambio incompatible hacia atrás {#backward-incompatible-change} - -- Usar column en lugar de AST para almacenar resultados de subconsultas escalares para un mejor rendimiento. Configuración `enable_scalar_subquery_optimization` se agregó en 19.17 y se habilitó de forma predeterminada. Conduce a errores como [este](https://github.com/ClickHouse/ClickHouse/issues/7851) durante la actualización a 19.17.2 o 19.17.3 de versiones anteriores. Esta configuración estaba deshabilitada de forma predeterminada en 19.17.4, para hacer posible la actualización desde 19.16 y versiones anteriores sin errores. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos pájaro](https://github.com/amosbird)) - -#### Novedad {#new-feature} - -- Agregue la capacidad de crear diccionarios con consultas DDL. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) -- Hacer `bloom_filter` tipo de índice de apoyo `LowCardinality` y `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Añadir función `isValidJSON` para verificar que la cadena pasada sea un json válido. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) -- Implementar `arrayCompact` función [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Memo](https://github.com/Joeywzr)) -- Función creada `hex` para números decimales. Funciona como `hex(reinterpretAsString())`, pero no elimina los últimos cero bytes. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) -- Añadir `arrayFill` y `arrayReverseFill` funciones, que reemplazan elementos por otros elementos delante / detrás de ellos en la matriz. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([Hcz](https://github.com/hczhcz)) -- Añadir `CRC32IEEE()`/`CRC64()` apoyo [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) -- Implementar `char` función similar a uno en [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([Sundyli](https://github.com/sundy-li)) -- Añadir `bitmapTransform` función. Transforma una matriz de valores en un mapa de bits a otra matriz de valores, el resultado es un nuevo mapa de bits [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) -- Aplicado `javaHashUTF16LE()` función [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([chimbab](https://github.com/achimbab)) -- Añadir `_shard_num` columna virtual para el motor distribuido [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) - -#### Característica Experimental {#experimental-feature} - -- Soporte para procesadores (nueva canalización de ejecución de consultas) en `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Corrección de errores {#bug-fix-1} - -- Corregir el análisis flotante incorrecto en `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([Tavplubix](https://github.com/tavplubix)) -- Soluciona un punto muerto raro que puede ocurrir cuando trace\_log está habilitado. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- Evitar la duplicación de mensajes al producir la tabla Kafka tiene cualquier MV seleccionando de ella [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) -- Soporte para `Array(LowCardinality(Nullable(String)))` en `IN`. Resolver [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([chimbab](https://github.com/achimbab)) -- Añadir manejo de `SQL_TINYINT` y `SQL_BIGINT`, y fijar el manejo de `SQL_FLOAT` tipos de origen de datos en ODBC Bridge. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Corregir la agregación (`avg` y quantiles) sobre columnas decimales vacías [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) -- Fijar `INSERT` en Distribuido con `MATERIALIZED` columna [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Hacer `MOVE PARTITION` funciona si algunas partes de la partición ya están en el disco o volumen de destino [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Se corrigió un error con los enlaces duros que no se creaban durante las mutaciones en `ReplicatedMergeTree` en configuraciones de varios discos. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Se corrigió un error con una mutación en un MergeTree cuando toda la parte permanece sin cambios y el mejor espacio se encuentra en otro disco [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Corregido error con `keep_free_space_ratio` no se lee desde la configuración de discos [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Corregir error con la tabla solo contiene `Tuple` columnas o columnas con rutas complejas. Fijar [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) -- No tener en cuenta la memoria para el motor de búfer en el límite de max\_memory\_usage [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) -- Corregir el uso de marcas final en `MergeTree` ordenadas por `tuple()`. En casos raros podría conducir a `Can't adjust last granule` error mientras selecciona. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir errores en mutaciones que tienen predicados con acciones que requieren contexto (por ejemplo, funciones para json), lo que puede provocar bloqueos o excepciones extrañas. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) -- Corregir la falta de coincidencia de los nombres de bases de datos y tablas que se escapan en `data/` y `shadow/` Directory [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alejandro Burmak](https://github.com/Alex-Burmak)) -- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Corregir el bloqueo en este caso. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijar `Not found column in block` al unirse en la expresión con RIGHT o FULL JOIN. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) -- Un intento más de arreglar bucle infinito en `PrettySpace` formato [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) -- Corregir error en `concat` función cuando todos los argumentos fueron `FixedString` del mismo tamaño. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) -- Se corrigió la excepción en caso de usar 1 argumento al definir almacenes S3, URL y HDFS. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Corregir el alcance de InterpreterSelectQuery para vistas con consulta [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) - -#### Mejora {#improvement} - -- `Nullable` columnas reconocidas y valores NULL manejados correctamente por ODBC-bridge [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- Escribir el lote actual para el envío distribuido atómicamente [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) -- Lance una excepción si no podemos detectar la tabla para el nombre de la columna en la consulta. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir `merge_max_block_size` ajuste a `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) -- Consultas con `HAVING` y sin `GROUP BY` asumir grupo por constante. Tan, `SELECT 1 HAVING 1` ahora devuelve un resultado. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos pájaro](https://github.com/amosbird)) -- Soporte de análisis `(X,)` como tupla similar a python. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos pájaro](https://github.com/amosbird)) -- Hacer `range` comportamientos de función casi como uno pitónico. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([Sundyli](https://github.com/sundy-li)) -- Añadir `constraints` columnas a la mesa `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) -- Mejor formato nulo para el controlador tcp, por lo que es posible usar `select ignore() from table format Null` para la medida de perf a través de clickhouse-client [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos pájaro](https://github.com/amosbird)) -- Consultas como `CREATE TABLE ... AS (SELECT (1, 2))` se analizan correctamente [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([Hcz](https://github.com/hczhcz)) - -#### Mejora del rendimiento {#performance-improvement} - -- Se mejora el rendimiento de la agregación sobre claves de cadena cortas. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alejandro Kuzmenkov](https://github.com/akuzm), [Amos pájaro](https://github.com/amosbird)) -- Ejecute otra pasada de análisis de sintaxis / expresión para obtener optimizaciones potenciales después de que se plieguen los predicados constantes. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos pájaro](https://github.com/amosbird)) -- Use metainformación de almacenamiento para evaluar trivial `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos pájaro](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) -- Vectorizar el procesamiento `arrayReduce` similar a Aggregator `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos pájaro](https://github.com/amosbird)) -- Mejoras menores en el rendimiento de `Kafka` consumo [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([Ivan](https://github.com/abyss7)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement} - -- Agregue soporte para la compilación cruzada a la arquitectura de CPU AARCH64. Refactorizar la secuencia de comandos del empaquetador. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([Ivan](https://github.com/abyss7)) -- Desempaquete las cadenas de herramientas darwin-x86\_64 y linux-aarch64 en el volumen Docker montado al crear paquetes [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([Ivan](https://github.com/abyss7)) -- Actualizar la imagen de Docker para Binary Packager [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([Ivan](https://github.com/abyss7)) -- Se corrigieron errores de compilación en MacOS Catalina [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) -- Algunas refactorizaciones en la lógica de análisis de consultas: dividir la clase compleja en varias simples. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) -- Reparar la compilación sin submódulos [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([propulsor](https://github.com/proller)) -- Mejor `add_globs` en archivos CMake [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos pájaro](https://github.com/amosbird)) -- Eliminar rutas codificadas en `unwind` objetivo [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) -- Permitir usar el formato mysql sin ssl [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([propulsor](https://github.com/proller)) - -#### Otro {#other} - -- Añadido gramática ANTLR4 para ClickHouse SQL dialecto [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouse de liberación de la v19.16 {#clickhouse-release-v19-16} - -#### Todos los derechos reservados. {#clickhouse-release-v19-16-14-65-2020-03-25} - -- Se corrigió un error en los cálculos por lotes de OP lógicos ternarios en múltiples argumentos (más de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alejandro Kazakov](https://github.com/Akazz)) Esta corrección de errores fue portada a la versión 19.16 por una solicitud especial de Altinity. - -#### Todos los derechos reservados. {#clickhouse-release-v19-16-14-65-2020-03-05} - -- Corregir la incompatibilidad de subconsultas distribuidas con versiones anteriores de CH. Fijar [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) - [(tabplubix)](https://github.com/tavplubix) -- Al ejecutar `CREATE` consulta, doblar expresiones constantes en argumentos del motor de almacenamiento. Reemplace el nombre de la base de datos vacía con la base de datos actual. Fijar [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). También corrige la verificación de la dirección local en `ClickHouseDictionarySource`. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Ahora el fondo se fusiona en `*MergeTree` familia de motores de mesa preservar el orden de volumen de políticas de almacenamiento con mayor precisión. - [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Evitar la pérdida de datos en `Kafka` en casos raros cuando la excepción ocurre después de leer el sufijo pero antes de confirmar. Fijar [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Relacionados: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -- Corregir un error que conduce a la terminación del servidor al intentar usar / soltar `Kafka` tabla creada con parámetros incorrectos. Fijar [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporar [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) -- Permitir usar `MaterializedView` con subconsultas anteriores `Kafka` tabla. - [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) - -#### Novedad {#new-feature-1} - -- Añadir `deduplicate_blocks_in_dependent_materialized_views` opción para controlar el comportamiento de las inserciones idempotentes en tablas con vistas materializadas. Esta nueva característica se agregó a la versión de corrección de errores mediante una solicitud especial de Altinity. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### Lanzamiento de ClickHouse v19.16.2.2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-1} - -- Agregue la validación de arity faltante para count/counIf . - [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) - [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) -- Eliminar heredado `asterisk_left_columns_only` configuración (que estaba deshabilitado por defecto). - [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem - Zuikov](https://github.com/4ertus2)) -- Las cadenas de formato para el formato de datos de la plantilla ahora se especifican en los archivos. - [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([Tavplubix](https://github.com/tavplubix)) - -#### Novedad {#new-feature-2} - -- Introduzca uniqCombined64() para calcular la cardinalidad mayor que UINT\_MAX. - [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), - [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat - Khuzhin](https://github.com/azat)) -- Admite índices de filtro Bloom en columnas de matriz. - [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) - ([chimbab](https://github.com/achimbab)) -- Agregar una función `getMacro(name)` que devuelve String con el valor de `` - desde la configuración del servidor. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Establezca dos opciones de configuración para un diccionario basado en un origen HTTP: `credentials` y - `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- Agregar un nuevo ProfileEvent `Merge` que cuenta el número de fusiones de fondo lanzadas. - [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mijaíl - Korotov](https://github.com/millb)) -- Agregue la función fullHostName que devuelve un nombre de dominio completo. - [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) - [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([Sundyli](https://github.com/sundy-li)) -- Añadir función `arraySplit` y `arrayReverseSplit` que dividió una matriz por “cut off” - condición. Son útiles en el manejo de secuencias de tiempo. - [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([Hcz](https://github.com/hczhcz)) -- Agregue nuevas funciones que devuelvan la matriz de todos los índices coincidentes en la familia de funciones multiMatch. - [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila - Kutenin](https://github.com/danlark1)) -- Agregar un nuevo motor de base de datos `Lazy` que está optimizado para almacenar un gran número de pequeños -Log - tabla. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nosotros - Vasilev](https://github.com/nikvas0)) -- Agregue funciones agregadas groupBitmapAnd, -Or, -Xor para columnas de mapa de bits. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang - Yu](https://github.com/yuzhichang)) -- Agregue los combinadores de funciones agregadas -OrNull y -OrDefault , que devuelven null - o valores predeterminados cuando no hay nada que agregar. - [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) - ([Hcz](https://github.com/hczhcz)) -- Introduzca el formato de datos CustomSeparated que admite el escape personalizado y - reglas delimitador. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([Tavplubix](https://github.com/tavplubix)) -- Soporte Redis como fuente de diccionario externo. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton - Popov](https://github.com/CurtizJ)) - -#### Corrección de errores {#bug-fix-2} - -- Repara el resultado de la consulta incorrecta si tiene `WHERE IN (SELECT ...)` sección y `optimize_read_in_order` ser - utilizar. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton - Popov](https://github.com/CurtizJ)) -- Complemento de autenticación MariaDB deshabilitado, que depende de archivos fuera del proyecto. - [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Yuriy - Baranov](https://github.com/yurriy)) -- Solucionar excepción `Cannot convert column ... because it is constant but values of constants are different in source and result` que rara vez podría suceder cuando funciones `now()`, `today()`, - `yesterday()`, `randConstant()` se utilizan. - [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolai - Kochetov](https://github.com/KochetovNicolai)) -- Solucionado el problema de usar HTTP keep alive timeout en lugar de TCP keep alive timeout. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily - Nemkov](https://github.com/Enmk)) -- Se corrigió un error de segmentación en groupBitmapOr (problema [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). - [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang - Yu](https://github.com/yuzhichang)) -- Para las vistas materializadas, se llama a la confirmación para Kafka después de que se escribieron todos los datos. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) -- Corregido mal `duration_ms` valor en `system.part_log` tabla. Fue diez veces fuera. - [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Una solución rápida para resolver el bloqueo en la tabla LIVE VIEW y volver a habilitar todas las pruebas LIVE VIEW. - [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Serialice los valores NULL correctamente en los índices mínimos / máximos de las partes MergeTree. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alejandro - Kuzmenkov](https://github.com/akuzm)) -- No coloque columnas virtuales en .sql cuando la tabla se crea como `CREATE TABLE AS`. - [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([Ivan](https://github.com/abyss7)) -- Fijar falla de segmentación en `ATTACH PART` consulta. - [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) - ([alesapin](https://github.com/alesapin)) -- Corrija el resultado incorrecto para algunas consultas dadas por la optimización de las subconsultas IN vacías y vacías - INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolai - Kochetov](https://github.com/KochetovNicolai)) -- Reparación del error AddressSanitizer en el método LIVE VIEW getHeader (). - [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) - ([vzakaznikov](https://github.com/vzakaznikov)) - -#### Mejora {#improvement-1} - -- Añadir un mensaje en caso de queue\_wait\_max\_ms espera se lleva a cabo. - [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat - Khuzhin](https://github.com/azat)) -- Ajuste hecho `s3_min_upload_part_size` a nivel de mesa. - [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Compruebe TTL en StorageFactory. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) - ([Sundyli](https://github.com/sundy-li)) -- Squash bloques de la izquierda en combinación de fusión parcial (optimización). - [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem - Zuikov](https://github.com/4ertus2)) -- No permita funciones no deterministas en mutaciones de motores de tabla replicados, porque esto - puede introducir inconsistencias entre réplicas. - [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alejandro - Kazakov](https://github.com/Akazz)) -- Deshabilite el rastreador de memoria mientras convierte el seguimiento de la pila de excepciones en cadena. Puede prevenir la pérdida - de mensajes de error de tipo `Memory limit exceeded` en el servidor, lo que `Attempt to read after eof` excepción en el cliente. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) - ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Mejoras de formato varios. Resolver - [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), - [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), - [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), - [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) - [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) - ([Tavplubix](https://github.com/tavplubix)) -- ClickHouse ignora los valores en el lado derecho del operador IN que no son convertibles a la izquierda - side type. Make it work properly for compound types – Array and Tuple. - [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alejandro - Kuzmenkov](https://github.com/akuzm)) -- Apoyar las desigualdades que faltan para ASOF JOIN. Es posible unir una variante menor o igual y estricta - mayores y menos variantes para la columna ASOF en la sintaxis ON. - [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem - Zuikov](https://github.com/4ertus2)) -- Optimizar la combinación de fusión parcial. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) - ([Artem Zuikov](https://github.com/4ertus2)) -- No utilice más de 98K de memoria en funciones uniqCombined. - [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), - [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat - Khuzhin](https://github.com/azat)) -- Enjuague las partes de la tabla de unión de la derecha en el disco en PartialMergeJoin (si no hay suficiente - memoria). Cargue los datos cuando sea necesario. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) - ([Artem Zuikov](https://github.com/4ertus2)) - -#### Mejora del rendimiento {#performance-improvement-1} - -- Acelere joinGet con argumentos const evitando la duplicación de datos. - [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos - Ave](https://github.com/amosbird)) -- Regrese temprano si la subconsulta está vacía. - [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) -- Optimizar el análisis de la expresión SQL en Valores. - [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) - ([Tavplubix](https://github.com/tavplubix)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-1} - -- Deshabilite algunas contribuciones para la compilación cruzada en Mac OS. - [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([Ivan](https://github.com/abyss7)) -- Agregue enlaces faltantes con PocoXML para clickhouse\_common\_io. - [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat - Khuzhin](https://github.com/azat)) -- Acepte varios argumentos de filtro de prueba en clickhouse-test. - [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alejandro - Kuzmenkov](https://github.com/akuzm)) -- Habilitar musl y jemalloc para ARM. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) - ([Amos pájaro](https://github.com/amosbird)) -- Añadir `--client-option` parámetro para `clickhouse-test` para pasar parámetros adicionales al cliente. - [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolai - Kochetov](https://github.com/KochetovNicolai)) -- Conservar las configuraciones existentes en la actualización del paquete rpm. - [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) - ([filimonov](https://github.com/filimonov)) -- Corregir errores detectados por PVS. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem - Zuikov](https://github.com/4ertus2)) -- Corregir la compilación para Darwin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) - ([Ivan](https://github.com/abyss7)) -- glibc 2.29 compatibilidad. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos - Ave](https://github.com/amosbird)) -- Asegúrese de que dh\_clean no toque los archivos fuente potenciales. - [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos - Ave](https://github.com/amosbird)) -- Intente evitar conflictos al actualizar desde rpm de altinidad: tiene un archivo de configuración empaquetado por separado - en clickhouse-server-common. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) - ([filimonov](https://github.com/filimonov)) -- Optimice algunos archivos de encabezado para reconstrucciones más rápidas. - [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), - [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alejandro - Kuzmenkov](https://github.com/akuzm)) -- Agregue pruebas de rendimiento para Date y DateTime. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vasily - Nemkov](https://github.com/Enmk)) -- Corregir algunas pruebas que contenían mutaciones no deterministas. - [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alejandro - Kazakov](https://github.com/Akazz)) -- Agregue compilación con MemorySanitizer a CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) - ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Evite el uso de valores no inicializados en MetricsTransmitter. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat - Khuzhin](https://github.com/azat)) -- Solucionar algunos problemas en los campos encontrados por MemorySanitizer. - [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), - [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alejandro - Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) - ([Amos pájaro](https://github.com/amosbird)) -- Corrige el comportamiento indefinido en murmurhash32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos - Ave](https://github.com/amosbird)) -- Corrige el comportamiento indefinido en StoragesInfoStream. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) - ([Tavplubix](https://github.com/tavplubix)) -- Se corrigieron expresiones constantes plegables para motores de bases de datos externas (MySQL, ODBC, JDBC). En anteriores - versiones no funcionaba para múltiples expresiones constantes y no funcionaba en absoluto para Date, - DateTime y UUID. Esto corrige [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Reparación del error de carrera de datos ThreadSanitizer en LIVE VIEW al acceder a la variable no\_users\_thread. - [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Deshacerse de los símbolos malloc en libcommon - [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), - [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos - Ave](https://github.com/amosbird)) -- Agregue el indicador global ENABLE\_LIBRARIES para deshabilitar todas las bibliotecas. - [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) - ([propulsor](https://github.com/proller)) - -#### Limpieza de código {#code-cleanup} - -- Generalice el repositorio de configuración para prepararse para DDL para diccionarios. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) - ([alesapin](https://github.com/alesapin)) -- Analizador de diccionarios DDL sin ninguna semántica. - [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) - ([alesapin](https://github.com/alesapin)) -- Divida ParserCreateQuery en diferentes analizadores más pequeños. - [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) - ([alesapin](https://github.com/alesapin)) -- Pequeña refactorización y cambio de nombre cerca de diccionarios externos. - [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) - ([alesapin](https://github.com/alesapin)) -- Refactorizar el código para prepararse para el papel de control de acceso basado. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly - Baranov](https://github.com/vitlibar)) -- Algunas mejoras en el código DatabaseOrdinary. - [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nosotros - Vasilev](https://github.com/nikvas0)) -- No use iteradores en los métodos find() y emplace() de tablas hash. - [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alejandro - Kuzmenkov](https://github.com/akuzm)) -- Repare getMultipleValuesFromConfig en caso de que la raíz del parámetro no esté vacía. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) - ([Mikhail Korotov](https://github.com/millb)) -- Eliminar algunos copiar y pegar (TemporaryFile y TemporaryFileStream) - [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem - Zuikov](https://github.com/4ertus2)) -- Mejora de la legibilidad del código un poco (`MergeTreeData::getActiveContainingPart`). - [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Espere a que todos los trabajos programados, que utilizan objetos locales, si `ThreadPool::schedule(...)` lanzar - salvedad. Cambiar nombre `ThreadPool::schedule(...)` a `ThreadPool::scheduleOrThrowOnError(...)` y - corregir los comentarios para hacer obvio que puede lanzar. - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) - ([Tavplubix](https://github.com/tavplubix)) - -## Lanzamiento de ClickHouse 19.15 {#clickhouse-release-19-15} - -### Lanzamiento de ClickHouse 19.15.4.10, 31.10.2019 {#clickhouse-release-19-15-4-10-2019-10-31} - -#### Corrección de errores {#bug-fix-3} - -- Se agregó el manejo de SQL\_TINYINT y SQL\_BIGINT, y el manejo de correcciones de los tipos de origen de datos SQL\_FLOAT en ODBC Bridge. - [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Se permite tener algunas partes en el disco de destino o el volumen en MOVE PARTITION. - [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Se corrigieron valores NULL en columnas anulables a través del puente ODBC. - [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- Se corrigió INSERT en el nodo distribuido no local con columnas MATERIALIZED. - [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Función fija getMultipleValuesFromConfig. - [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) -- Solucionado el problema de usar HTTP keep alive timeout en lugar de TCP keep alive timeout. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) -- Espere a que todos los trabajos finalicen con excepción (corrige fallas raras). - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([Tavplubix](https://github.com/tavplubix)) -- No presione a MVs cuando inserte en la tabla Kafka. - [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) -- Deshabilitar el rastreador de memoria para la pila de excepciones. - [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Se corrigió el código incorrecto en la transformación de la consulta para la base de datos externa. - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evite el uso de valores no inicializados en MetricsTransmitter. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) -- Se agregó configuración de ejemplo con macros para pruebas ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} - -#### Corrección de errores {#bug-fix-4} - -- Se corrigió bad\_variant en el diccionario hash. - ([alesapin](https://github.com/alesapin)) -- Se corrigió un error con un error de segmentación en la consulta ATTACH PART. - ([alesapin](https://github.com/alesapin)) -- Cálculo de tiempo fijo en `MergeTreeData`. - ([Vladimir Chebotarev](https://github.com/excitoon)) -- Comprometerse con Kafka explícitamente después de finalizar la escritura. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) -- Serialice los valores NULL correctamente en los índices mínimos / máximos de las partes MergeTree. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alejandro Kuzmenkov](https://github.com/akuzm)) - -### Lanzamiento de ClickHouse 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} - -#### Novedad {#new-feature-3} - -- Almacenamiento por niveles: admite el uso de múltiples volúmenes de almacenamiento para tablas con el motor MergeTree. Es posible almacenar datos nuevos en SSD y mover automáticamente datos antiguos a HDD. ([ejemplo](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) -- Agregar función de tabla `input` para leer los datos entrantes en `INSERT SELECT` consulta. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([Palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) -- Añadir un `sparse_hashed` diccionario, que es funcionalmente equivalente al `hashed` diseño, pero es más eficiente en la memoria. Utiliza aproximadamente el doble de menos memoria a costa de una recuperación de valor más lenta. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) -- Implementar la capacidad de definir la lista de usuarios para el acceso a los diccionarios. Sólo la base de datos conectada actual utilizando. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Añadir `LIMIT` opción para `SHOW` consulta. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Filipina Malkovsky](https://github.com/malkfilipp)) -- Añadir `bitmapSubsetLimit(bitmap, range_start, limit)` función, que devuelve subconjunto de la más pequeña `limit` valores en el conjunto que no es menor que `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) -- Añadir `bitmapMin` y `bitmapMax` función. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) -- Añadir función `repeat` relacionado con [Información detallada](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([Más información](https://github.com/ucasFL)) - -#### Característica Experimental {#experimental-feature-1} - -- Implementar (en memoria) Combinar unir variante que no cambia la canalización actual. El resultado está parcialmente ordenado por clave de combinación. Establecer `partial_merge_join = 1` para usar esta función. La combinación de combinación todavía está en desarrollo. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir `S3` función del motor y de la tabla. Todavía está en desarrollo (todavía no hay soporte de autenticación). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) - -#### Mejora {#improvement-2} - -- Cada mensaje leído de Kafka se inserta atómicamente. Esto resuelve casi todos los problemas conocidos con el motor Kafka. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([Ivan](https://github.com/abyss7)) -- Mejoras para la conmutación por error de consultas distribuidas. Acortar el tiempo de recuperación, también ahora es configurable y se puede ver en `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) -- Soporta valores numéricos para enumeraciones directamente en `IN` apartado. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([Dimarub2000](https://github.com/dimarub2000)) -- El soporte (opcional, deshabilitado de forma predeterminada) redirige el almacenamiento de URL. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([Más información](https://github.com/maqroll)) -- Agregue un mensaje de información cuando el cliente con una versión anterior se conecte a un servidor. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Filipina Malkovsky](https://github.com/malkfilipp)) -- Eliminar el límite máximo de tiempo de suspensión de interrupción para el envío de datos en tablas distribuidas [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) -- Agregue la capacidad de enviar eventos de perfil (contadores) con valores acumulativos al grafito. Se puede habilitar bajo `` en el servidor `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) -- Añadir tipo de fundición automática `T` a `LowCardinality(T)` mientras inserta datos en la columna de tipo `LowCardinality(T)` en formato nativo a través de HTTP. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Añadir la capacidad de utilizar la función `hex` sin usar `reinterpretAsString` para `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-2} - -- Agregue gdb-index al binario de clickhouse con información de depuración. Acelerará el tiempo de inicio de `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) -- Acelerar el embalaje deb con parcheado dpkg-deb que utiliza `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) -- Establecer `enable_fuzzing = 1` para habilitar la instrumentación libfuzzer de todo el código del proyecto. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) -- Añadir prueba de humo de construcción dividida en CI. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) -- Agregue compilación con MemorySanitizer a CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Reemplazar `libsparsehash` con `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) - -#### Corrección de errores {#bug-fix-5} - -- Se corrigió la degradación del rendimiento del análisis de índices en claves complejas en tablas grandes. Esto corrige \#6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir el error lógico que causa segfaults al seleccionar el tema vacío de Kafka. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) -- Arreglar la conexión MySQL demasiado pronto cerca `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Soporte devuelto para núcleos Linux muy antiguos (solución [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Solucionar la posible pérdida de datos en `insert select` consulta en caso de bloque vacío en el flujo de entrada. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Solución para la función `АrrayEnumerateUniqRanked` con matrices vacías en params [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([propulsor](https://github.com/proller)) -- Solucione consultas complejas con combinaciones de matriz y subconsultas globales. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) -- Fijar `Unknown identifier` error en ORDER BY y GROUP BY con múltiples JOINs [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijo `MSan` advertencia al ejecutar la función con `LowCardinality` argumento. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-2} - -- Se ha cambiado el formato de serialización de los estados de la función agregada de mapa de bits \* para mejorar el rendimiento. No se pueden leer los estados serializados de bitmap\* de versiones anteriores. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) - -## Lanzamiento de ClickHouse 19.14 {#clickhouse-release-19-14} - -### Lanzamiento de ClickHouse 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} - -#### Corrección de errores {#bug-fix-6} - -- Esta versión también contiene todas las correcciones de errores de 19.11.12.69. -- Compatibilidad fija para consultas distribuidas entre 19.14 y versiones anteriores. Esto corrige [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} - -#### Corrección de errores {#bug-fix-7} - -- Solución para la función `АrrayEnumerateUniqRanked` con matrices vacías en params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([propulsor](https://github.com/proller)) -- Nombre de subconsulta fijo en consultas con `ARRAY JOIN` y `GLOBAL IN subquery` con alias. Utilice el alias de subconsulta para el nombre de tabla externo si se especifica. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-3} - -- Fijar [aleteo](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) prueba `00715_fetch_merged_or_mutated_part_zookeeper` reescribiéndolo en scripts de shell porque necesita esperar a que se apliquen las mutaciones. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alejandro Kazakov](https://github.com/Akazz)) -- Fijo UBSan y MemSan fallo en la función `groupUniqArray` con el argumento de matriz emtpy. Fue causado por la colocación de vacío `PaddedPODArray` en la celda cero de la tabla hash porque no se llamó al constructor para el valor de la celda cero. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos pájaro](https://github.com/amosbird)) - -### Lanzamiento de ClickHouse 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} - -#### Novedad {#new-feature-4} - -- `WITH FILL` modificador para `ORDER BY`. (continuación de [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- `WITH TIES` modificador para `LIMIT`. (continuación de [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- Analizar unquoted `NULL` literal como NULL (si establece `format_csv_unquoted_null_literal_as_null=1`). Inicialice los campos nulos con valores predeterminados si el tipo de datos de este campo no se puede anular (si `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([Tavplubix](https://github.com/tavplubix)) -- Soporte para comodines en rutas de funciones de tabla `file` y `hdfs`. Si la ruta contiene comodines, la tabla será de solo lectura. Ejemplo de uso: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` y `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) -- Nuevo `system.metric_log` tabla que almacena los valores de `system.events` y `system.metrics` con el intervalo de tiempo especificado. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Permitir escribir registros de texto de ClickHouse en `system.text_log` tabla. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mostrar símbolos privados en trazas de pila (esto se hace mediante el análisis de tablas de símbolos de archivos ELF). Se agregó información sobre el archivo y el número de línea en los seguimientos de la pila si la información de depuración está presente. Búsqueda de nombre de símbolo de aceleración con símbolos de indexación presentes en el programa. Se agregaron nuevas funciones SQL para la introspección: `demangle` y `addressToLine`. Función renombrada `symbolizeAddress` a `addressToSymbol` para la consistencia. Función `addressToSymbol` devolverá el nombre destrozado por razones de rendimiento y debe aplicar `demangle`. Añadido `allow_introspection_functions` que está desactivado por defecto. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Función de la tabla `values` (el nombre no distingue entre mayúsculas y minúsculas). Permite leer de `VALUES` lista propuesta en [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Ejemplo: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([Dimarub2000](https://github.com/dimarub2000)) -- Se agregó la capacidad de alterar la configuración de almacenamiento. Sintaxis: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) -- Soporte para la eliminación de piezas separadas. Sintaxis: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([Tavplubix](https://github.com/tavplubix)) -- Restricciones de tabla. Permite agregar restricciones a la definición de la tabla que se verificará en la inserción. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soporte para vistas materializadas en cascada. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos pájaro](https://github.com/amosbird)) -- Active el generador de perfiles de consulta de forma predeterminada para muestrear cada subproceso de ejecución de consultas una vez por segundo. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Formato de entrada `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) -- Se agregaron dos nuevas funciones: `sigmoid` y `tanh` (que son útiles para aplicaciones de aprendizaje automático). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Función `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` para verificar si el token dado está en pajar. Token es una subcadena de longitud máxima entre dos caracteres ASCII no alfanuméricos (o límites de pajar). Token debe ser una cadena constante. Apoyado por la especialización de índice tokenbf\_v1. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) -- Nueva función `neighbor(value, offset[, default_value])`. Permite alcanzar el valor prev / next dentro de la columna en un bloque de datos. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Acerca de Nosotros](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) -- Creó una función `currentUser()`, devolver el inicio de sesión del usuario autorizado. Alias agregado `user()` por compatibilidad con MySQL. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Acerca de Nosotros](https://github.com/alex-krash)) -- Nuevas funciones agregadas `quantilesExactInclusive` y `quantilesExactExclusive` que fueron propuestos en [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([Dimarub2000](https://github.com/dimarub2000)) -- Función `bitmapRange(bitmap, range_begin, range_end)` que devuelve un nuevo conjunto con el rango especificado (no incluye el `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) -- Función `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` que crea una matriz de cadenas de precisión de cajas geohash que cubren el área proporcionada. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) -- Implementar soporte para la consulta INSERT con `Kafka` tabla. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([Ivan](https://github.com/abyss7)) -- Añadido soporte para `_partition` y `_timestamp` columnas virtuales al motor Kafka. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([Ivan](https://github.com/abyss7)) -- Posibilidad de eliminar datos confidenciales de `query_log`, registros del servidor, lista de procesos con reglas basadas en expresiones regulares. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) - -#### Característica Experimental {#experimental-feature-2} - -- Formato de datos de entrada y salida `Template`. Permite especificar cadena de formato personalizado para entrada y salida. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([Tavplubix](https://github.com/tavplubix)) -- Implementación de `LIVE VIEW` tablas que se propusieron originalmente en [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) elaborado en [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), y luego actualizado en [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). Ver [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) para una descripción detallada. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) Tenga en cuenta que `LIVE VIEW` característica puede ser eliminado en las próximas versiones. - -#### Corrección de errores {#bug-fix-8} - -- Esta versión también contiene todas las correcciones de errores de 19.13 y 19.11. -- Corregir la falla de segmentación cuando la tabla tiene índices de omisión y se produce una fusión vertical. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) -- Corregir TTL por columna con valores predeterminados de columna no triviales. Anteriormente en caso de fuerza TTL se fusionan con `OPTIMIZE ... FINAL` consulta, los valores caducados se reemplazaron por valores predeterminados de tipo en lugar de valores predeterminados de columna especificados por el usuario. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) -- Solucione el problema de duplicación de mensajes de Kafka en el reinicio normal del servidor. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) -- Se corrigió un bucle infinito al leer mensajes de Kafka. No pausar / reanudar el consumidor en la suscripción en absoluto; de lo contrario, puede pausarse indefinidamente en algunos escenarios. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([Ivan](https://github.com/abyss7)) -- Fijar `Key expression contains comparison between inconvertible types` excepción en `bitmapContains` función. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([Dimarub2000](https://github.com/dimarub2000)) -- Reparar segfault con habilitado `optimize_skip_unused_shards` y falta la clave de fragmentación. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) -- Se corrigió el código incorrecto en las mutaciones que pueden conducir a la corrupción de la memoria. segfault fijo con lectura de la dirección `0x14c0` que puede happed debido a concurrente `DROP TABLE` y `SELECT` de `system.parts` o `system.parts_columns`. Condición de carrera fija en la preparación de consultas de mutación. Estancamiento fijo causado por `OPTIMIZE` de tablas replicadas y operaciones de modificación simultáneas como ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se eliminó el registro detallado adicional en la interfaz MySQL [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Devuelve la capacidad de analizar la configuración booleana de ‘true’ y ‘false’ en el archivo de configuración. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- Fix crash en `quantile` y `median` función sobre `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió el posible resultado incompleto devuelto por `SELECT` consulta con `WHERE` condición en la clave principal contenía conversión a tipo flotante. Fue causado por una comprobación incorrecta de la monotonía en `toFloat` función. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([Dimarub2000](https://github.com/dimarub2000)) -- Comprobar `max_expanded_ast_elements` establecimiento de mutaciones. Mutaciones claras después de `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([Invierno Zhang](https://github.com/zhang2014)) -- Repare los resultados de JOIN para las columnas clave cuando se usa con `join_use_nulls`. Adjunte valores nulos en lugar de valores predeterminados de columnas. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) -- Solución para índices de salto con combinación vertical y alteración. Solución para `Bad size of marks file` salvedad. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) -- Arreglar accidente raro en `ALTER MODIFY COLUMN` y fusión vertical cuando una de las partes fusionadas / alteradas está vacía (0 filas) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- Corregido error en la conversión de `LowCardinality` tipos en `AggregateFunctionFactory`. Esto corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir el comportamiento incorrecto y posibles fallas en `topK` y `topKWeighted` funciones agregadas. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) -- Código inseguro fijo alrededor `getIdentifier` función. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió un error en el protocolo de cable MySQL (se usa mientras se conecta al cliente MySQL de ClickHouse). Causado por el desbordamiento del búfer de pila en `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) -- Pérdida de memoria fija en `bitmapSubsetInRange` función. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) -- Corregir un error raro cuando la mutación se ejecuta después del cambio de granularidad. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) -- Permitir mensaje protobuf con todos los campos de forma predeterminada. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) -- Resolver un error con `nullIf` función cuando enviamos un `NULL` en el segundo argumento. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Corregir un error raro con la asignación / desasignación de memoria incorrecta en diccionarios complejos de caché de claves con campos de cadena que conduce a un consumo infinito de memoria (parece una pérdida de memoria). El error se reproduce cuando el tamaño de la cadena era una potencia de dos a partir de ocho (8, 16, 32, etc.). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- Se corrigió la codificación Gorilla en pequeñas secuencias que causaron una excepción `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) -- Permitir el uso de tipos no anulables en JOINs con `join_use_nulls` permitir. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) -- Desactivar `Poco::AbstractConfiguration` sustituciones en consulta en `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evitar el punto muerto en `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Utilizar `arrayReduce` para argumentos constantes puede conducir a segfault. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir partes inconsistentes que pueden aparecer si la réplica se restauró después de `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([Tavplubix](https://github.com/tavplubix)) -- Cuelgue fijo adentro `JSONExtractRaw` función. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir un error con la serialización y agregación de índices de omisión incorrectos con granularidad adaptativa. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) -- Fijar `WITH ROLLUP` y `WITH CUBE` modificadores de `GROUP BY` con agregación de dos niveles. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir un error al escribir marcas de índices secundarios con granularidad adaptativa. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- Corregir el orden de inicialización durante el inicio del servidor. Ya `StorageMergeTree::background_task_handle` se inicializa en `startup()` el `MergeTreeBlockOutputStream::write()` puede intentar usarlo antes de la inicialización. Solo verifique si está inicializado. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) -- Borrar el búfer de datos de la operación de lectura anterior que se completó con un error. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) -- Se corrigió un error al habilitar la granularidad adaptativa al crear una nueva réplica para la tabla Replicated\*MergeTree. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- Se corrigió un posible bloqueo durante el inicio del servidor en caso de que ocurriera una excepción en `libunwind` durante la excepción en el acceso a `ThreadStatus` estructura. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Fix crash en `yandexConsistentHash` función. Encontrado por prueba de fuzz. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la posibilidad de colgar consultas cuando el servidor está sobrecargado y el grupo de subprocesos global está casi lleno. Esto tiene una mayor probabilidad de ocurrir en clústeres con una gran cantidad de fragmentos (cientos), porque las consultas distribuidas asignan un hilo por conexión a cada fragmento. Por ejemplo, este problema puede reproducirse si un clúster de 330 fragmentos está procesando 30 consultas distribuidas simultáneas. Este problema afecta a todas las versiones a partir de 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Lógica fija de `arrayEnumerateUniqRanked` función. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir segfault al decodificar la tabla de símbolos. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos pájaro](https://github.com/amosbird)) -- Se corrigió una excepción irrelevante en el elenco de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Se eliminó la cita adicional de la descripción en `system.settings` tabla. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evite un posible punto muerto en `TRUNCATE` de la tabla replicada. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir la lectura en orden de clave de clasificación. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) -- Fijar `ALTER TABLE ... UPDATE` consulta para tablas con `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Corregir error abierto por [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (desde 19.4.0). Se reproduce en consultas a tablas distribuidas sobre tablas MergeTree cuando no consultamos ninguna columnas (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- Se corrigió el desbordamiento en la división de enteros de tipo con signo a tipo sin signo. El comportamiento fue exactamente como en el lenguaje C o C ++ (reglas de promoción enteras) que puede ser sorprendente. Tenga en cuenta que el desbordamiento aún es posible cuando se divide un número firmado grande por un número sin signo grande o viceversa (pero ese caso es menos habitual). El problema existía en todas las versiones del servidor. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Limite el tiempo máximo de suspensión para el estrangulamiento cuando `max_execution_speed` o `max_execution_speed_bytes` se establece. Se corrigieron errores falsos como `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigieron problemas sobre el uso `MATERIALIZED` columnas y alias en `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos pájaro](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar `FormatFactory` comportamiento para flujos de entrada que no se implementan como procesador. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Error tipográfico fijo. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Acerca de Nosotros](https://github.com/alexryndin)) -- Typo en el mensaje de error (es -\> are ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) -- Se corrigió el error al analizar la lista de columnas de la cadena si el tipo contenía una coma (este problema era relevante para `File`, `URL`, `HDFS` almacenamiento) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([Dimarub2000](https://github.com/dimarub2000)) - -#### Corrección de seguridad {#security-fix} - -- Esta versión también contiene todas las correcciones de seguridad de errores de 19.13 y 19.11. -- Se corrigió la posibilidad de que una consulta fabricada causara un bloqueo del servidor debido al desbordamiento de la pila en el analizador SQL. Se corrigió la posibilidad de desbordamiento de pila en las tablas Merge y Distributed, las vistas materializadas y las condiciones para la seguridad a nivel de fila que implicaban subconsultas. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora {#improvement-3} - -- Correcta implementación de la lógica ternaria para `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alejandro Kazakov](https://github.com/Akazz)) -- Ahora los valores y filas con TTL caducado se eliminarán después `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` consulta. Consultas añadidas `SYSTEM STOP/START TTL MERGES` para no permitir / permitir asignar fusiones con TTL y filtrar valores caducados en todas las fusiones. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) -- Posibilidad de cambiar la ubicación del archivo de historial de ClickHouse para el cliente usando `CLICKHOUSE_HISTORY_FILE` envío. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) -- Quitar `dry_run` bandera de `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Apoyo `ASOF JOIN` con `ON` apartado. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) -- Mejor soporte de índices de omisión para mutaciones y replicación. Soporte para `MATERIALIZE/CLEAR INDEX ... IN PARTITION` consulta. `UPDATE x = x` vuelve a calcular todos los índices que usan la columna `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) -- Permitir a `ATTACH` vistas en vivo (por ejemplo, al iniciar el servidor) independientemente de `allow_experimental_live_view` configuración. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Para los seguimientos de pila recopilados por el generador de perfiles de consultas, no incluya los marcos de pila generados por el propio generador de perfiles de consultas. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora funciones de tabla `values`, `file`, `url`, `hdfs` tienen soporte para columnas ALIAS. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Lance una excepción si `config.d` file no tiene el elemento raíz correspondiente como el archivo de configuración. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([Dimarub2000](https://github.com/dimarub2000)) -- Imprimir información adicional en el mensaje de excepción para `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([Tavplubix](https://github.com/tavplubix)) -- Al determinar fragmentos de un `Distributed` debe ser cubierto por una consulta de lectura (para `optimize_skip_unused_shards` = 1) ClickHouse ahora verifica las condiciones de ambos `prewhere` y `where` cláusulas de la instrucción select. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alejandro Kazakov](https://github.com/Akazz)) -- Permitir `SIMDJSON` para máquinas sin AVX2 pero con sistema de instrucciones SSE 4.2 y PCLMUL. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse puede funcionar en sistemas de archivos sin `O_DIRECT` soporte (como ZFS y BtrFS) sin afinación adicional. [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soporte push down predicado para la subconsulta final. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([Método de codificación de datos:](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejor `JOIN ON` extracción de llaves [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) -- Se ha actualizado `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Optimizar la selección de la columna más pequeña para `SELECT count()` consulta. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos pájaro](https://github.com/amosbird)) -- Añadir `strict` parámetro en `windowFunnel()`. Cuando el `strict` se establece, el `windowFunnel()` aplica condiciones sólo para los valores únicos. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([chimbab](https://github.com/achimbab)) -- Interfaz más segura de `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) -- Opciones de tamaño de línea al ejecutar con `--help` opción ahora se corresponde con el tamaño del terminal. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([Dimarub2000](https://github.com/dimarub2000)) -- Desactivar “read in order” optimización para la agregación sin claves. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) -- Código de estado HTTP para `INCORRECT_DATA` y `TYPE_MISMATCH` los códigos de error se cambiaron de forma predeterminada `500 Internal Server Error` a `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alejandro Rodin](https://github.com/a-rodin)) -- Mover un objeto de unión desde `ExpressionAction` en `AnalyzedJoin`. `ExpressionAnalyzer` y `ExpressionAction` no sé `Join` clase más. Su lógica está oculta por `AnalyzedJoin` iface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió un posible interbloqueo de consultas distribuidas cuando uno de los fragmentos es localhost pero la consulta se envía a través de una conexión de red. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Semántica cambiada de varias tablas `RENAME` para evitar posibles interbloqueos. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Servidor de compatibilidad MySQL reescrito para evitar la carga completa de paquetes de carga en la memoria. Disminución del consumo de memoria para cada conexión a aproximadamente `2 * DBMS_DEFAULT_BUFFER_SIZE` (búferes de lectura/escritura). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) -- Mueva la lógica de interpretación de alias AST fuera del analizador que no tiene que saber nada sobre la semántica de consultas. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) -- Análisis ligeramente más seguro de `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-copier`: Permitir el uso `where_condition` de configuración con `partition_key` alias en la consulta para verificar la existencia de la partición (Anteriormente se usaba solo para leer consultas de datos). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([propulsor](https://github.com/proller)) -- Añadido argumento de mensaje opcional en `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) -- La excepción del servidor obtenida al enviar datos de inserción ahora también se está procesando en el cliente. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([Dimarub2000](https://github.com/dimarub2000)) -- Se agregó una métrica `DistributedFilesToInsert` que muestra el número total de archivos en el sistema de archivos que se seleccionan para enviar a servidores remotos mediante tablas distribuidas. El número se suma en todos los fragmentos. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mover la mayoría de JOINs preparar la lógica de `ExpressionAction/ExpressionAnalyzer` a `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) -- Reparar TSan [advertencia](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) -- Mejores mensajes de información sobre la falta de capacidades de Linux. Registro de errores fatales con “fatal” nivel, que hará que sea más fácil de encontrar en `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cuando se habilita el volcado de datos temporales en el disco para restringir el uso de memoria durante `GROUP BY`, `ORDER BY`, no comprobó el espacio de disco libre. La corrección agrega una nueva configuración `min_free_disk_space`, cuando el espacio de disco libre es más pequeño que el umbral, la consulta se detendrá y lanzará `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eliminado rwlock recursivo por hilo. No tiene sentido, porque los hilos se reutilizan entre consultas. `SELECT` la consulta puede adquirir un bloqueo en un hilo, mantener un bloqueo de otro hilo y salir del primer hilo. Al mismo tiempo, el primer hilo puede ser reutilizado por `DROP` consulta. Esto conducirá a falso “Attempt to acquire exclusive lock recursively” mensaje. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Dividir `ExpressionAnalyzer.appendJoin()`. Preparar un lugar en `ExpressionAnalyzer` para `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir `mysql_native_password` complemento de autenticación al servidor de compatibilidad MySQL. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) -- Menos número de `clock_gettime` llamadas; compatibilidad ABI fija entre depuración / liberación en `Allocator` (problema insignificante). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mover `collectUsedColumns` de `ExpressionAnalyzer` a `SyntaxAnalyzer`. `SyntaxAnalyzer` hacer `required_source_columns` sí mismo ahora. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir ajuste `joined_subquery_requires_alias` para requerir alias para subselecciones y funciones de tabla en `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) -- Extraer `GetAggregatesVisitor` clase de `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) -- `system.query_log`: cambiar el tipo de datos de `type` columna a `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Enlace estático de `sha256_password` complemento de autenticación. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) -- Evite una dependencia adicional para la configuración `compile` trabajar. En versiones anteriores, el usuario puede obtener un error como `cannot open crti.o`, `unable to find library -lc` sucesivamente. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Más validación de la entrada que puede provenir de réplica maliciosa. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora `clickhouse-obfuscator` el archivo está disponible en `clickhouse-client` paquete. En versiones anteriores estaba disponible como `clickhouse obfuscator` (con espacios en blanco). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([Dimarub2000](https://github.com/dimarub2000)) -- Fijo interbloqueo cuando tenemos al menos dos consultas que leer al menos dos tablas en orden diferente y otra consulta que realiza DDL operación en una de las mesas. Se corrigió otro punto muerto muy raro. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `os_thread_ids` columna a `system.processes` y `system.query_log` para mejores posibilidades de depuración. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Una solución para los errores de extensión PHP mysqlnd que ocurren cuando `sha256_password` se utiliza como un complemento de autenticación predeterminado (descrito en [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) -- Elimine el lugar innecesario con columnas de nulabilidad modificadas. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) -- Establecer el valor predeterminado de `queue_max_wait_ms` a cero, porque el valor actual (cinco segundos) no tiene sentido. Hay raras circunstancias en las que esta configuración tiene algún uso. Configuración añadida `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` y `connection_pool_max_wait_ms` para la desambiguación. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Extraer `SelectQueryExpressionAnalyzer` de `ExpressionAnalyzer`. Mantenga el último para consultas no seleccionadas. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) -- Se eliminó la duplicación de formatos de entrada y salida. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Permitir al usuario anular `poll_interval` y `idle_connection_timeout` configuración en la conexión. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `MergeTree` ahora tiene una opción adicional `ttl_only_drop_parts` (deshabilitado por defecto) para evitar la poda parcial de las piezas, de modo que se caigan completamente cuando todas las filas de una pieza hayan caducado. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) -- Comprobaciones de tipo para establecer funciones de índice. Lanzar excepción si la función tiene un tipo incorrecto. Esto corrige la prueba de fuzz con UBSan. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Mejora del rendimiento {#performance-improvement-2} - -- Optimice las consultas con `ORDER BY expressions` cláusula, donde `expressions` tiene prefijo coincidente con clave de clasificación en `MergeTree` tabla. Esta optimización está controlada por `optimize_read_in_order` configuración. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) -- Permitir el uso de múltiples hilos durante la carga y eliminación de piezas. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Variante por lotes implementada de actualizar los estados de funciones agregadas. Puede conducir a beneficios de rendimiento. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Utilizar `FastOps` biblioteca para funciones `exp`, `log`, `sigmoid`, `tanh`. FastOps es una biblioteca matemática vectorial rápido de Michael Parakhin (Yandex CTO). Rendimiento mejorado de `exp` y `log` funciona más de 6 veces. Función `exp` y `log` de `Float32` el argumento volverá `Float32` (en versiones anteriores siempre regresan `Float64`). Ahora `exp(nan)` puede volver `inf`. El resultado de `exp` y `log` las funciones pueden no ser el número representable de la máquina más cercana a la respuesta verdadera. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) Usando la variante Danila Kutenin para hacer fastops trabajando [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Deshabilitar la optimización de claves consecutivas para `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) -- Rendimiento mejorado de `simdjson` biblioteca al deshacerse de la asignación dinámica en `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) -- Páginas de error previo al asignar memoria con `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) -- Corregir un error de rendimiento en `Decimal` comparación. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-4} - -- Elimine el compilador (creación de instancias de la plantilla de tiempo de ejecución) porque hemos ganado su rendimiento. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó una prueba de rendimiento para mostrar la degradación del rendimiento en gcc-9 de una manera más aislada. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Función de tabla añadida `numbers_mt`, que es la versión multiproceso de `numbers`. Pruebas de rendimiento actualizadas con funciones hash. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Modo de comparación en `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([Dimarub2000](https://github.com/dimarub2000)) -- Mejor esfuerzo para imprimir rastros de pila. También añadido `SIGPROF` como una señal de depuración para imprimir el seguimiento de la pila de un hilo en ejecución. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cada función en su propio archivo, parte 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eliminar doble const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) -- Cambios de formato para `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) -- Mejor subconsulta para la creación de unión en `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) -- Elimine una condición redundante (encontrada por PVS Studio). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) -- Separe la interfaz de la tabla hash para `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) -- Refactorización de configuraciones. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) -- Añadir comentarios para `set` funciones de índice. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) -- Aumente la puntuación de OOM en la versión de depuración en Linux. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) -- HDFS HA ahora funciona en la compilación de depuración. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) -- Se agregó una prueba a `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregue prueba para múltiples vistas materializadas para la tabla Kafka. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([Ivan](https://github.com/abyss7)) -- Hacer un mejor esquema de construcción. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([Ivan](https://github.com/abyss7)) -- Fijo `test_external_dictionaries` integración en caso de que se haya ejecutado bajo un usuario no root. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- El error se reproduce cuando el tamaño total de los paquetes escritos excede `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) -- Se agregó una prueba para `RENAME` condición de carrera de mesa [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evitar la carrera de datos en Configuración en `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir prueba de integración para el manejo de errores por un diccionario de caché. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) -- Deshabilite el análisis de archivos de objetos ELF en Mac OS, porque no tiene sentido. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Intenta mejorar el generador de registro de cambios. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `-Wshadow` cambiar al GCC. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) -- Eliminado el código obsoleto para `mimalloc` apoyo. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `zlib-ng` determina las capacidades de x86 y guarda esta información en variables globales. Esto se hace en la llamada defalteInit , que puede ser hecha por diferentes hilos simultáneamente. Para evitar escrituras multiproceso, hágalo al iniciar la biblioteca. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) -- Prueba de regresión para un error que en join se corrigió en [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) -- Informe MSan fijo. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar aleteo prueba TTL. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) -- Corregido carrera de datos falsos en `MergeTreeDataPart::is_frozen` campo. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigieron los tiempos de espera en la prueba de fuzz. En la versión anterior, se las arregló para encontrar falso bloqueo en la consulta `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregaron comprobaciones de depuración a `static_cast` de columnas. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soporte para Oracle Linux en paquetes RPM oficiales. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cambiado json perftests de `once` a `loop` tipo. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `odbc-bridge.cpp` definir `main()` por lo que no debe ser incluido en `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Películas De Sexo](https://github.com/orivej)) -- Prueba de accidente en `FULL|RIGHT JOIN` con nulos en las claves de la tabla derecha. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) -- Se agregó una prueba para el límite de expansión de alias por si acaso. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cambiado de `boost::filesystem` a `std::filesystem` cuando sea apropiado. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregaron paquetes RPM al sitio web. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir una prueba para fijo `Unknown identifier` excepción en `IN` apartado. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) -- Simplificar `shared_ptr_helper` porque las personas que enfrentan dificultades para entenderlo. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregaron pruebas de rendimiento para el códec Gorilla y DoubleDelta fijo. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) -- Dividir la prueba de integración `test_dictionaries` en 4 pruebas separadas. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) -- Repara la advertencia de PVS-Studio en `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Permitir usar `library` fuente del diccionario con ASan. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó la opción para generar registro de cambios a partir de una lista de relaciones públicas. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bloquee el `TinyLog` almacenamiento al leer. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) -- Compruebe si hay enlaces simbólicos rotos en CI. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Aumentar el tiempo de espera para “stack overflow” prueba porque puede llevar mucho tiempo en la compilación de depuración. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó un cheque para espacios en blanco dobles. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar `new/delete` Seguimiento de memoria cuando se construye con desinfectantes. El seguimiento no está claro. Solo evita las excepciones de límite de memoria en las pruebas. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) -- Habilite la comprobación de símbolos indefinidos durante la vinculación. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([Ivan](https://github.com/abyss7)) -- Evitar la reconstrucción `hyperscan` todos los días. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Informe UBSan fijo en `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- No permita el uso del generador de perfiles de consultas con desinfectantes porque no es compatible. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregue prueba para recargar un diccionario después de fallar por temporizador. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corregir inconsistencia en `PipelineExecutor::prepareProcessor` tipo de argumento. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Se agregó una prueba de URI malos. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregaron más cheques a `CAST` función. Esto debería obtener más información sobre la falla de segmentación en la prueba difusa. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Añadir `gcc-9` apoyo a `docker/builder` contenedor que construye la imagen localmente. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Prueba de clave primaria con `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([Dimarub2000](https://github.com/dimarub2000)) -- Se corrigieron las pruebas afectadas por la impresión de rastros de pila lenta. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregue un caso de prueba para el bloqueo en `groupUniqArray` fijo en [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) -- Pruebas de mutaciones de índices fijos. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) -- En la prueba de rendimiento, no lea el registro de consultas para las consultas que no ejecutamos. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) -- La vista materializada ahora se puede crear con cualquier tipo de cardinalidad baja, independientemente de la configuración sobre tipos de cardinalidad baja sospechosos. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) -- Pruebas actualizadas para `send_logs_level` configuración. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix build bajo gcc-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) -- Corregir la compilación con libc ++ interno. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([Ivan](https://github.com/abyss7)) -- Reparar compilación compartida con `rdkafka` biblioteca [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) -- Correcciones para la compilación de Mac OS (incompleta). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([Más información](https://github.com/alex-zaitsev)) -- Fijar “splitted” construir. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Otras correcciones de compilación: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos pájaro](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([Ivan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([propulsor](https://github.com/proller)) - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-3} - -- Se eliminó la función de tabla raramente utilizada `catBoostPool` y almacenamiento `CatBoostPool`. Si ha utilizado esta función de tabla, escriba un correo electrónico a `clickhouse-feedback@yandex-team.com`. Tenga en cuenta que la integración CatBoost sigue siendo y será compatible. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Desactivar `ANY RIGHT JOIN` y `ANY FULL JOIN` predeterminada. Establecer `any_join_distinct_right_table_keys` configuración para permitirles. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) - -## Lanzamiento de ClickHouse 19.13 {#clickhouse-release-19-13} - -### Lanzamiento de ClickHouse 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} - -#### Corrección de errores {#bug-fix-9} - -- Esta versión también contiene todas las correcciones de errores de 19.11.12.69. - -### Lanzamiento de ClickHouse 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} - -#### Corrección de errores {#bug-fix-10} - -- Esta versión también contiene todas las correcciones de errores de 19.14.6.12. -- Se corrigió el posible estado inconsistente de la tabla mientras se ejecutaba `DROP` consulta para la tabla replicada mientras que el zookeeper no es accesible. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Solución para la carrera de datos en StorageMerge [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir error introducido en el generador de perfiles de consultas que conduce a una recv interminable desde el socket. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) -- Corregir el uso excesivo de la CPU mientras se ejecuta `JSONExtractRaw` función sobre un valor booleano. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corrige la regresión mientras presiona a la vista materializada. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([Ivan](https://github.com/abyss7)) -- Función de la tabla `url` la vulnerabilidad permitió al atacante inyectar encabezados HTTP arbitrarios en la solicitud. Este problema fue encontrado por [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Arreglar inútil `AST` compruebe en Establecer índice. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) -- Análisis fijo de `AggregateFunction` valores incrustados en la consulta. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) -- Corregido el comportamiento incorrecto de `trim` funciones familiares. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse liberación 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} - -#### Corrección de errores {#bug-fix-11} - -- Esta versión también contiene todas las correcciones de seguridad de errores de 19.11.9.52 y 19.11.10.54. -- Carrera de datos fija en `system.parts` mesa y `ALTER` consulta. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el encabezado no coincidente en las secuencias en caso de leer desde una tabla distribuida vacía con sample y prewhere. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Se corrigió el fallo al usar `IN` cláusula con una subconsulta con una tupla. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([Tavplubix](https://github.com/tavplubix)) -- Corregir el caso con los mismos nombres de columna en `GLOBAL JOIN ON` apartado. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) -- Corregir el bloqueo al lanzar tipos a `Decimal` que no lo soportan. Lanzar excepción en su lugar. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió el fallo en `extractAll()` función. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) -- Transformación de consultas para `MySQL`, `ODBC`, `JDBC` funciones de la tabla ahora funciona correctamente para `SELECT WHERE` consultas con múltiples `AND` expresiones. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([Dimarub2000](https://github.com/dimarub2000)) -- Se agregaron verificaciones de declaraciones anteriores para la integración de MySQL 8. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) - -#### Corrección de seguridad {#security-fix-1} - -- Corrige dos vulnerabilidades en los códecs en fase de descompresión (el usuario malicioso puede fabricar datos comprimidos que provocarán un desbordamiento del búfer en la descompresión). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) - -### Lanzamiento de ClickHouse 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} - -#### Corrección de errores {#bug-fix-12} - -- Fijar `ALTER TABLE ... UPDATE` consulta para tablas con `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Repare NPE al usar la cláusula IN con una subconsulta con una tupla. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([Tavplubix](https://github.com/tavplubix)) -- Se ha solucionado un problema por el que si una réplica obsoleta cobra vida, puede que aún tenga partes de datos eliminadas por DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([Tavplubix](https://github.com/tavplubix)) -- Solucionado el problema con el análisis CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([Tavplubix](https://github.com/tavplubix)) -- Carrera de datos fija en el sistema.tabla de piezas y consulta ALTER. Esto corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el código incorrecto en las mutaciones que pueden conducir a la corrupción de la memoria. segfault fijo con lectura de la dirección `0x14c0` que puede happed debido a concurrente `DROP TABLE` y `SELECT` de `system.parts` o `system.parts_columns`. Condición de carrera fija en la preparación de consultas de mutación. Estancamiento fijo causado por `OPTIMIZE` de tablas replicadas y operaciones de modificación simultáneas como ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la posible pérdida de datos después de `ALTER DELETE` consulta en la tabla con índice de omisión. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Corrección de seguridad {#security-fix-2} - -- Si el atacante tiene acceso de escritura a ZooKeeper y es capaz de ejecutar servidor personalizado disponible desde la red donde se ejecuta ClickHouse, puede crear servidor malicioso personalizado que actuará como réplica ClickHouse y registrarlo en ZooKeeper. Cuando otra réplica recuperará la parte de datos de una réplica maliciosa, puede forzar a clickhouse-server a escribir en una ruta arbitraria en el sistema de archivos. Encontrado por Eldar Zaitov, equipo de seguridad de la información en Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} - -#### Novedad {#new-feature-5} - -- Generador de perfiles de muestreo en el nivel de consulta. [Ejemplo](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) -- Permite especificar una lista de columnas con `COLUMNS('regexp')` expresión que funciona como una variante más sofisticada de `*` asterisco. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([Mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CREATE TABLE AS table_function()` es posible [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([Dimarub2000](https://github.com/dimarub2000)) -- El optimizador de Adam para el descenso de gradiente estocástico se usa de forma predeterminada en `stochasticLinearRegression()` y `stochasticLogisticRegression()` funciones agregadas, porque muestra buena calidad sin casi ningún ajuste. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) -- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Cristina Andrés](https://github.com/andyyzh)) -- `RENAME` las consultas ahora funcionan con todos los almacenes. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([Ivan](https://github.com/abyss7)) -- Ahora el cliente recibe registros del servidor con cualquier nivel deseado configurando `send_logs_level` independientemente del nivel de registro especificado en la configuración del servidor. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-4} - -- Configuración `input_format_defaults_for_omitted_fields` está habilitado de forma predeterminada. Las inserciones en las tablas distribuidas necesitan que esta configuración sea la misma en el clúster (debe configurarla antes de actualizar). Permite el cálculo de expresiones predeterminadas complejas para campos omitidos en `JSONEachRow` y `CSV*` formato. Debe ser el comportamiento esperado, pero puede conducir a una diferencia de rendimiento insignificante. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) - -#### Experimental características {#experimental-features} - -- Nueva canalización de procesamiento de consultas. Utilizar `experimental_use_processors=1` opción para habilitarlo. Úselo para su propio problema. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Corrección de errores {#bug-fix-13} - -- Kafka integración se ha fijado en esta versión. -- Fijo `DoubleDelta` codificación de `Int64` para grandes `DoubleDelta` valores mejorados `DoubleDelta` codificación de datos aleatorios para `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) -- Sobreestimación fija de `max_rows_to_read` si el ajuste `merge_tree_uniform_read_distribution` se establece en 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora {#improvement-4} - -- Lanza una excepción si `config.d` el archivo no tiene el elemento raíz correspondiente como el archivo de configuración [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([Dimarub2000](https://github.com/dimarub2000)) - -#### Mejora del rendimiento {#performance-improvement-3} - -- Optimizar `count()`. Ahora usa la columna más pequeña (si es posible). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos pájaro](https://github.com/amosbird)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-5} - -- Informe sobre el uso de memoria en las pruebas de rendimiento. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) -- Corregir compilación con externo `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([Ivan](https://github.com/abyss7)) -- Reparar compilación compartida con `rdkafka` biblioteca [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) - -## Lanzamiento de ClickHouse 19.11 {#clickhouse-release-19-11} - -### Lanzamiento de ClickHouse 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} - -#### Corrección de errores {#bug-fix-14} - -- Se corrigió un accidente raro en `ALTER MODIFY COLUMN` y fusión vertical cuando una de las partes fusionadas / alteradas está vacía (0 filas). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- Actualización manual de `SIMDJSON`. Esto corrige la posible inundación de archivos stderr con mensajes de diagnóstico json falsos. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alejandro Kazakov](https://github.com/Akazz)) -- Corregido error con `mrk` extensión de archivo para mutaciones ([alesapin](https://github.com/alesapin)) - -### Lanzamiento de ClickHouse 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} - -#### Corrección de errores {#bug-fix-15} - -- Se corrigió la degradación del rendimiento del análisis de índices en claves complejas en tablas grandes. Esto corrige [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evite SIGSEGV raro al enviar datos en tablas con motor distribuido (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) -- Fijar `Unknown identifier` con múltiples uniones. Esto corrige [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) - -### Lanzamiento de ClickHouse 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} - -- Corregir el error lógico que causa segfaults al seleccionar el tema vacío de Kafka. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) -- Solución para la función `АrrayEnumerateUniqRanked` con matrices vacías en params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([propulsor](https://github.com/proller)) - -### Lanzamiento de ClickHouse 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} - -#### Corrección de errores {#bug-fix-16} - -- Almacene los desplazamientos para los mensajes de Kafka manualmente para poder confirmarlos todos a la vez para todas las particiones. Corrige la duplicación potencial en “one consumer - many partitions” escenario. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([Ivan](https://github.com/abyss7)) - -### Lanzamiento de ClickHouse 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} - -- Mejorar el manejo de errores en los diccionarios de caché. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corregido error en la función `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([propulsor](https://github.com/proller)) -- Fijar `JSONExtract` la función mientras que la extracción de un `Tuple` de JSON. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) -- Se corrigió la posible pérdida de datos después de `ALTER DELETE` consulta en la tabla con índice de omisión. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) -- Prueba de rendimiento fija. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Parquet: Fijar la lectura de columnas booleanos. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregido el comportamiento incorrecto de `nullIf` la función de la constante de argumentos. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Solucione el problema de duplicación de mensajes de Kafka en el reinicio normal del servidor. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) -- Se ha corregido un problema durante mucho tiempo `ALTER UPDATE` o `ALTER DELETE` puede evitar que se ejecuten fusiones regulares. Evite que las mutaciones se ejecuten si no hay suficientes subprocesos libres disponibles. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([Tavplubix](https://github.com/tavplubix)) -- Corregido el error con el procesamiento “timezone” en el archivo de configuración del servidor. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Revisión de kafka pruebas. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([Ivan](https://github.com/abyss7)) - -#### Corrección de seguridad {#security-fix-3} - -- Si el atacante tiene acceso de escritura a ZooKeeper y es capaz de ejecutar servidor personalizado disponible desde la red donde se ejecuta ClickHouse, puede crear servidor malicioso personalizado que actuará como réplica ClickHouse y registrarlo en ZooKeeper. Cuando otra réplica recuperará la parte de datos de una réplica maliciosa, puede forzar a clickhouse-server a escribir en una ruta arbitraria en el sistema de archivos. Encontrado por Eldar Zaitov, equipo de seguridad de la información en Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} - -#### Corrección de errores {#bug-fix-17} - -- Fijar `ALTER TABLE ... UPDATE` consulta para tablas con `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Repare NPE al usar la cláusula IN con una subconsulta con una tupla. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([Tavplubix](https://github.com/tavplubix)) -- Se ha solucionado un problema por el que si una réplica obsoleta cobra vida, puede que aún tenga partes de datos eliminadas por DROP PARTITION. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([Tavplubix](https://github.com/tavplubix)) -- Solucionado el problema con el análisis CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([Tavplubix](https://github.com/tavplubix)) -- Carrera de datos fija en el sistema.tabla de piezas y consulta ALTER. Esto corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el código incorrecto en las mutaciones que pueden conducir a la corrupción de la memoria. segfault fijo con lectura de la dirección `0x14c0` que puede happed debido a concurrente `DROP TABLE` y `SELECT` de `system.parts` o `system.parts_columns`. Condición de carrera fija en la preparación de consultas de mutación. Estancamiento fijo causado por `OPTIMIZE` de tablas replicadas y operaciones de modificación simultáneas como ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} - -#### Corrección de errores {#bug-fix-18} - -- Kafka integración se ha fijado en esta versión. -- Corregir segfault cuando se usa `arrayReduce` para argumentos constantes. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijo `toFloat()` monotonicidad. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([Dimarub2000](https://github.com/dimarub2000)) -- Reparar segfault con habilitado `optimize_skip_unused_shards` y falta la clave de fragmentación. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) -- Lógica fija de `arrayEnumerateUniqRanked` función. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se eliminó el registro detallado adicional del controlador MySQL. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir el comportamiento incorrecto y posibles fallas en `topK` y `topKWeighted` funciones agregadas. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) -- No exponga columnas virtuales en `system.columns` tabla. Esto es necesario para la compatibilidad con versiones anteriores. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir un error con la asignación de memoria para campos de cadena en el diccionario de caché de claves complejas. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- Corregir un error al habilitar la granularidad adaptativa al crear una nueva réplica para `Replicated*MergeTree` tabla. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- Corregir bucle infinito al leer los mensajes de Kafka. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) -- Se corrigió la posibilidad de que una consulta fabricada causara un bloqueo del servidor debido al desbordamiento de la pila en el analizador SQL y la posibilidad de desbordamiento de la pila en `Merge` y `Distributed` tabla [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregido el error de codificación Gorilla en pequeñas secuencias. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) - -#### Mejora {#improvement-5} - -- Permitir al usuario anular `poll_interval` y `idle_connection_timeout` configuración en la conexión. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} - -#### Corrección de errores {#bug-fix-19} - -- Se corrigió la posibilidad de colgar consultas cuando el servidor está sobrecargado. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Reparar FPE en la función yandexConsistentHash. Esto corrige [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregido error en la conversión de `LowCardinality` tipos en `AggregateFunctionFactory`. Esto corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir el análisis de `bool` ajustes de `true` y `false` en los archivos de configuración. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- Corrige un error raro con encabezados de flujo incompatibles en consultas para `Distributed` mesa sobre `MergeTree` mesa cuando parte de `WHERE` se mueve a `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- Se corrigió el desbordamiento en la división de enteros de tipo con signo a tipo sin signo. Esto corrige [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-5} - -- `Kafka` todavía roto. - -### Lanzamiento de ClickHouse 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} - -#### Corrección de errores {#bug-fix-20} - -- Corregir un error al escribir marcas de índices secundarios con granularidad adaptativa. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- Fijar `WITH ROLLUP` y `WITH CUBE` modificadores de `GROUP BY` con agregación de dos niveles. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Cuelgue fijo adentro `JSONExtractRaw` función. Fijo [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Revisión violación de segmento en ExternalLoader::reloadOutdated(). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) -- Se corrigió el caso en el que el servidor podía cerrar sockets de escucha pero no apagar y continuar sirviendo las consultas restantes. Puede terminar con dos procesos de servidor de clickhouse en ejecución. A veces, el servidor puede devolver un error `bad_function_call` para las consultas restantes. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la condición inútil e incorrecta en el campo de actualización para la carga inicial de diccionarios externos a través de ODBC, MySQL, ClickHouse y HTTP. Esto corrige [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió una excepción irrelevante en el elenco de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fijar resultado no determinista de “uniq” función agregada en casos extremos raros. El error estaba presente en todas las versiones de ClickHouse. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Segfault cuando establecemos un CIDR demasiado alto en la función `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Se corrigió una pequeña pérdida de memoria cuando el servidor lanzaba muchas excepciones de muchos contextos diferentes. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soluciona la situación cuando el consumidor se detuvo antes de la suscripción y no se reanudó después. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([Ivan](https://github.com/abyss7)) Tenga en cuenta que Kafka está roto en esta versión. -- Borrar el búfer de datos Kafka de la operación de lectura anterior que se completó con un error [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Tenga en cuenta que Kafka está roto en esta versión. -- Ya `StorageMergeTree::background_task_handle` se inicializa en `startup()` el `MergeTreeBlockOutputStream::write()` puede intentar usarlo antes de la inicialización. Solo verifique si está inicializado. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-6} - -- Añadido oficial `rpm` paquete. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([propulsor](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) -- Añadir una habilidad para construir `.rpm` y `.tgz` paquetes con `packager` script. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) -- Correcciones para “Arcadia” sistema de construcción. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([propulsor](https://github.com/proller)) - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-6} - -- `Kafka` está roto en esta versión. - -### Lanzamiento de ClickHouse 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} - -#### Novedad {#new-feature-6} - -- Se agregó soporte para declaraciones preparadas. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alejandro](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `DoubleDelta` y `Gorilla` codecs de columna [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) -- Añadir `os_thread_priority` ajuste que permite controlar el “nice” valor de los subprocesos de procesamiento de consultas que utiliza el sistema operativo para ajustar la prioridad de programación dinámica. Requiere `CAP_SYS_NICE` capacidades para trabajar. Esto implementa [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Implementar `_topic`, `_offset`, `_key` columnas para el motor Kafka [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([Ivan](https://github.com/abyss7)) Tenga en cuenta que Kafka está roto en esta versión. -- Añadir combinador de funciones agregadas `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([Hcz](https://github.com/hczhcz)) -- Funciones agregadas `groupArrayMovingSum(win_size)(x)` y `groupArrayMovingAvg(win_size)(x)`, que calculan la suma / avg en movimiento con o sin limitación de tamaño de ventana. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([Sistema abierto.](https://github.com/inv2004)) -- Agregar sinónimo `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([Hcz](https://github.com/hczhcz)) -- Función Intergate H3 `geoToH3` de Uber. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Corrección de errores {#bug-fix-21} - -- Implementar caché DNS con actualización asincrónica. El subproceso separado resuelve todos los hosts y actualiza la caché DNS con el punto (configuración `dns_cache_update_period`). Debería ayudar, cuando la ip de los hosts cambia con frecuencia. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) -- Arreglar segfault en `Delta` codec que afecta a columnas con valores de menos de 32 bits. El error llevó a la corrupción de memoria aleatoria. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- Fix segfault en TTL se fusionan con columnas no físicas en el bloque. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir un error raro en la comprobación de la parte con `LowCardinality` columna. Previamente `checkDataPart` siempre falla para parte con `LowCardinality` columna. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- Evite colgar conexiones cuando el grupo de subprocesos del servidor esté lleno. Es importante para las conexiones desde `remote` función de tabla o conexiones a un fragmento sin réplicas cuando hay un tiempo de espera de conexión largo. Esto corrige [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soporte para argumentos constantes para `evalMLModel` función. Esto corrige [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se ha solucionado el problema cuando ClickHouse determina la zona horaria predeterminada como `UCT` en lugar de `UTC`. Esto corrige [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijo desbordamiento del búfer en `visitParamExtractRaw`. Esto corrige [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora distribuido `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` las consultas se ejecutarán directamente en la réplica del líder. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- Fijar `coalesce` para `ColumnConst` con `ColumnNullable` + cambios relacionados. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijar el `ReadBufferFromKafkaConsumer` para que siga leyendo nuevos mensajes después `commit()` incluso si estaba estancado antes [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([Ivan](https://github.com/abyss7)) -- Fijar `FULL` y `RIGHT` Resultados de JOIN al unirse en `Nullable` teclas en la mesa derecha. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) -- Posible solución de sueño infinito de consultas de baja prioridad. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir la condición de carrera, lo que hace que algunas consultas no aparezcan en query\_log después `SYSTEM FLUSH LOGS` consulta. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Fijo `heap-use-after-free` ASan advertencia en ClusterCopier causada por el reloj que intenta usar el objeto de copiadora ya eliminado. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregido mal `StringRef` puntero devuelto por algunas implementaciones de `IColumn::deserializeAndInsertFromArena`. Este error afectó solo a las pruebas unitarias. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Evite que la matriz de origen y la matriz intermedia se unan a columnas de enmascaramiento de columnas del mismo nombre. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) -- Solucione la inserción y seleccione la consulta al motor MySQL con citas de identificador de estilo MySQL. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([Invierno Zhang](https://github.com/zhang2014)) -- Ahora `CHECK TABLE` consulta puede trabajar con la familia del motor MergeTree. Devuelve el estado de verificación y el mensaje si hay alguno para cada parte (o archivo en caso de motores más simples). Además, corrija el error en la búsqueda de una parte rota. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) -- Reparar el tiempo de ejecución SPLIT\_SHARED\_LIBRARIES [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Más información](https://github.com/danlark1)) -- Inicialización de zona horaria fija cuando `/etc/localtime` es un enlace simbólico relativo como `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- clickhouse-copiadora: Solucionar el uso-después de la libertad en el apagado [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([propulsor](https://github.com/proller)) -- Actualizar `simdjson`. Se corrigió el problema de que algunos JSON no válidos con cero bytes analizaran correctamente. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Reparar el cierre de SystemLogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) -- Arreglar colgando cuando la condición en invalidate\_query depende de un diccionario. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Mejora {#improvement-6} - -- Permitir direcciones no resolubles en la configuración del clúster. Se considerarán no disponibles y se intentarán resolver en cada intento de conexión. Esto es especialmente útil para Kubernetes. Esto corrige [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cierre las conexiones TCP inactivas (con un tiempo de espera de una hora por defecto). Esto es especialmente importante para clústeres grandes con múltiples tablas distribuidas en cada servidor, ya que cada servidor puede mantener un grupo de conexiones con cualquier otro servidor, y después de la concurrencia de consultas pico, las conexiones se detendrán. Esto corrige [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejor calidad de `topK` función. Se ha cambiado el comportamiento del conjunto SavingSpace para eliminar el último elemento si el nuevo elemento tiene un peso mayor. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Las funciones de URL para trabajar con dominios ahora pueden funcionar para URL incompletas sin esquema [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) -- Sumas de comprobación añadidas al `system.parts_columns` tabla. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Añadir `Enum` tipo de datos como un sinónimo para `Enum8` o `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([Dimarub2000](https://github.com/dimarub2000)) -- Variante de transposición de bits completa para `T64` códec. Podría conducir a una mejor compresión con `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) -- Condición en `startsWith` la función ahora puede utilizar la clave principal. Esto corrige [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) y [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([Dimarub2000](https://github.com/dimarub2000)) -- Permitir usar `clickhouse-copier` con la topología de clúster de replicación cruzada permitiendo el nombre de base de datos vacío. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) -- Utilizar `UTC` como zona horaria predeterminada en un sistema sin `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` se imprimió y el servidor o el cliente se negó a iniciar. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soporte devuelto para argumento de coma flotante en función `quantileTiming` para la compatibilidad con versiones anteriores. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mostrar qué tabla falta la columna en los mensajes de error. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([Ivan](https://github.com/abyss7)) -- No permitir la consulta de ejecución con el mismo query\_id por varios usuarios [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([propulsor](https://github.com/proller)) -- Código más robusto para enviar métricas a Graphite. Funcionará incluso durante largos múltiples `RENAME TABLE` operación. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se mostrarán mensajes de error más informativos cuando ThreadPool no pueda programar una tarea para su ejecución. Esto corrige [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Invertir ngramSearch para que sea más intuitivo [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Más información](https://github.com/danlark1)) -- Agregar análisis de usuario en el generador de motor HDFS [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) -- Actualizar el valor predeterminado de `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) -- Se agregó una noción de configuraciones obsoletas. La configuración obsoleta `allow_experimental_low_cardinality_type` se puede utilizar sin efecto. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) - -#### Mejora del rendimiento {#performance-improvement-4} - -- Aumente el número de secuencias a SELECT desde la tabla Merge para una distribución más uniforme de los subprocesos. Añadido `max_streams_multiplier_for_merge_tables`. Esto corrige [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-7} - -- Agregue una prueba de compatibilidad con versiones anteriores para la interacción cliente-servidor con diferentes versiones de clickhouse. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) -- Pruebe la información de cobertura en cada solicitud de confirmación y extracción. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) -- Coopere con el desinfectante de direcciones para respaldar nuestros asignadores personalizados (`Arena` y `ArenaWithFreeLists`) para una mejor depuración de “use-after-free” error. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) -- Cambiar a [Implementación de LLVM libunwind](https://github.com/llvm-mirror/libunwind) para el manejo de excepciones de C ++ y para la impresión de rastreos de pila [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Vídeos relacionados con nikita Lapkov](https://github.com/laplab)) -- Agregue dos advertencias más de -Weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Permitir construir ClickHouse con Memory Sanitizer. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Informe ubsan fijo sobre `bitTest` función en la prueba de fuzz. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Docker: se agregó la posibilidad de iniciar una instancia de ClickHouse que requiere autenticación. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) -- Actualizar librdkafka a la versión 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([Ivan](https://github.com/abyss7)) -- Agregue el tiempo de espera global para las pruebas de integración y deshabilite algunas de ellas en el código de pruebas. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) -- Solucionar algunas fallas ThreadSanitizer. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) -- El `--no-undefined` opción obliga al enlazador a verificar la existencia de todos los nombres externos mientras se vincula. Es muy útil rastrear dependencias reales entre bibliotecas en el modo de compilación dividida. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([Ivan](https://github.com/abyss7)) -- Prueba de rendimiento añadida para [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Compatibilidad fija con gcc-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó soporte para gcc-9. Esto corrige [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el error cuando libunwind se puede vincular incorrectamente. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigieron algunas advertencias encontradas por PVS-Studio. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó soporte inicial para `clang-tidy` analizador estático. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Convertir macros endian BSD/Linux( ‘be64toh’ y ‘htobe64’) a los equivalentes de Mac OS X [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fuente Chen](https://github.com/fredchenbj)) -- Guía de pruebas de integración mejorada. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Reparación de compilación en macosx + gcc9 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) -- Corrige un error tipográfico difícil de detectar: aggreAGte -\> agregado. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) -- Arreglar la compilación freebsd [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([propulsor](https://github.com/proller)) -- Añadir enlace al canal experimental de YouTube al sitio web [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) -- CMake: agregar opción para indicadores de cobertura: WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([propulsor](https://github.com/proller)) -- Corrige el tamaño inicial de algunos PODArray en línea. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) -- clickhouse-servidor.postinst: arreglar la detección del sistema operativo para centos 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([propulsor](https://github.com/proller)) -- Se agregó la generación de paquetes Arch Linux. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) -- División Común / config.h por libs (dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([propulsor](https://github.com/proller)) -- Correcciones para “Arcadia” plataforma de construcción [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([propulsor](https://github.com/proller)) -- Correcciones para construcción no convencional (gcc9, sin submódulos) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([propulsor](https://github.com/proller)) -- Requerir un tipo explícito en unignmentStore porque se demostró que era propenso a errores [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) -- Corrige la compilación de MacOS [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) -- Prueba de rendimiento relativa a la nueva característica JIT con un conjunto de datos más grande, como se solicita aquí [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Ejecutar pruebas con estado en la prueba de esfuerzo [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-7} - -- `Kafka` está roto en esta versión. -- Permitir `adaptive_index_granularity` = 10MB por defecto para nuevo `MergeTree` tabla. Si creó nuevas tablas MergeTree en la versión 19.11+, será imposible degradar a versiones anteriores a la 19.6. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) -- Eliminado diccionarios incrustados no documentados obsoletos que fueron utilizados por Yandex.Métrica. Función `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` ya no están disponibles. Si está utilizando estas funciones, escriba un correo electrónico a clickhouse-feedback@yandex-team.com. Nota: en el último momento decidimos mantener estas funciones por un tiempo. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## Lanzamiento de ClickHouse 19.10 {#clickhouse-release-19-10} - -### Lanzamiento de ClickHouse 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} - -#### Novedad {#new-feature-7} - -- Agregar nuevo códec de columna: `T64`. Hecho para columnas (U) IntX / EnumX / Data (Time) / DecimalX. Debería ser bueno para columnas con valores de rango constante o pequeño. Codec en sí permite ampliar o reducir el tipo de datos sin volver a comprimir. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) -- Agregar motor de base de datos `MySQL` que permiten ver todas las tablas en el servidor MySQL remoto [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([Invierno Zhang](https://github.com/zhang2014)) -- `bitmapContains` aplicación. Es 2 veces más rápido que `bitmapHasAny` si el segundo mapa de bits contiene un elemento. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) -- Soporte para `crc32` función (con comportamiento exactamente como en MySQL o PHP). No lo use si necesita una función hash. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) -- Aplicado `SYSTEM START/STOP DISTRIBUTED SENDS` consultas para controlar inserciones asincrónicas en `Distributed` tabla. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([Invierno Zhang](https://github.com/zhang2014)) - -#### Corrección de errores {#bug-fix-22} - -- Ignore los límites de ejecución de consultas y el tamaño máximo de partes para los límites de combinación mientras ejecuta mutaciones. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir un error que puede conducir a la desduplicación de bloques normales (extremadamente raros) y la inserción de bloques duplicados (más a menudo). [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) -- Fijación de la función `arrayEnumerateUniqRanked` para argumentos con matrices vacías [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([propulsor](https://github.com/proller)) -- No se suscriba a los temas de Kafka sin la intención de sondear ningún mensaje. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([Ivan](https://github.com/abyss7)) -- Hacer configuración `join_use_nulls` no obtienen ningún efecto para los tipos que no pueden estar dentro de Nullable [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fijo `Incorrect size of index granularity` error [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([Coraxster](https://github.com/coraxster)) -- Repara el desbordamiento de conversión de flotador a decimal [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([Coraxster](https://github.com/coraxster)) -- Búfer de descarga cuando `WriteBufferFromHDFS`se llama destructor. Esto corrige la escritura en `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) - -#### Mejora {#improvement-7} - -- Trate las celdas vacías en `CSV` como valores predeterminados cuando la configuración `input_format_defaults_for_omitted_fields` está habilitado. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) -- Carga sin bloqueo de diccionarios externos. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) -- Los tiempos de espera de red se pueden cambiar dinámicamente para las conexiones ya establecidas de acuerdo con la configuración. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) -- Utilizar “public\_suffix\_list” para funciones `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. Está usando una tabla hash perfecta generada por `gperf` con una lista generada a partir del archivo: https://publicsuffix.org/list/public\_suffix\_list.dat. (por ejemplo, ahora reconocemos el dominio `ac.uk` como no significativo). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Adoptar `IPv6` tipo de datos en las tablas del sistema; columnas de información de cliente unificadas en `system.processes` y `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Uso de sesiones para conexiones con el protocolo de compatibilidad MySQL. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) -- Apoyo más `ALTER` consulta `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([Sundyli](https://github.com/sundy-li)) -- Apoyo `` sección en `clickhouse-local` archivo de configuración. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([propulsor](https://github.com/proller)) -- Permitir ejecutar consulta con `remote` función de la tabla en `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([propulsor](https://github.com/proller)) - -#### Mejora del rendimiento {#performance-improvement-5} - -- Agregue la posibilidad de escribir la marca final al final de las columnas MergeTree. Permite evitar lecturas inútiles para las claves que están fuera del rango de datos de la tabla. Está habilitado sólo si se está utilizando granularidad de índice adaptativo. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) -- Mejora del rendimiento de las tablas MergeTree en sistemas de archivos muy lentos al reducir el número de `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la degradación del rendimiento en la lectura de las tablas MergeTree que se introdujo en la versión 19.6. Correcciones \#5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-8} - -- Aplicado `TestKeeper` como una implementación de la interfaz ZooKeeper utilizada para probar [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) -- A partir de ahora `.sql` las pruebas se pueden ejecutar aisladas por el servidor, en paralelo, con una base de datos aleatoria. Permite ejecutarlos más rápido, agregar nuevas pruebas con configuraciones de servidor personalizadas y asegurarse de que las diferentes pruebas no se afecten entre sí. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([Ivan](https://github.com/abyss7)) -- Quitar `` y `` de pruebas de rendimiento [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fijo “select\_format” prueba de rendimiento para `Pretty` formato [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## Lanzamiento de ClickHouse 19.9 {#clickhouse-release-19-9} - -### Lanzamiento de ClickHouse 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} - -#### Corrección de errores {#bug-fix-23} - -- Corregir segfault en el códec Delta que afecta a las columnas con valores de menos de 32 bits de tamaño. El error llevó a la corrupción de memoria aleatoria. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- Corregir un error raro en la comprobación de la parte con la columna LowCardinality. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- Fix segfault en TTL se fusionan con columnas no físicas en el bloque. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Repara el potencial de sueño infinito de consultas de baja prioridad. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corrige cómo ClickHouse determina la zona horaria predeterminada como UCT en lugar de UTC. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir un error sobre la ejecución de las consultas distribuidas DROP / ALTER / TRUNCATE / OPTIMIZE ON CLUSTER en la réplica de seguidor antes de la réplica de líder. Ahora se ejecutarán directamente en réplica líder. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- Corregir la condición de carrera, lo que hace que algunas consultas no aparezcan en query\_log instantáneamente después de la consulta SYSTEM FLUSH LOGS. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Se agregó soporte faltante para argumentos constantes para `evalMLModel` función. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} - -#### Novedad {#new-feature-8} - -- Imprima información sobre piezas congeladas en `system.parts` tabla. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([propulsor](https://github.com/proller)) -- Pregunte la contraseña del cliente en clickhouse-client start en tty si no se establece en argumentos [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([propulsor](https://github.com/proller)) -- Implementar `dictGet` y `dictGetOrDefault` funciones para los tipos Decimal. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Mejora {#improvement-8} - -- Debian init: Agregar tiempo de espera de parada de servicio [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([propulsor](https://github.com/proller)) -- Agregar configuración prohibida de forma predeterminada para crear tabla con tipos sospechosos para LowCardinality [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) -- Las funciones de regresión devuelven pesos del modelo cuando no se usan como Estado en función `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) -- Cambiar el nombre y mejorar los métodos de regresión. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) -- Interfaces más claras de los buscadores de cadenas. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Más información](https://github.com/danlark1)) - -#### Corrección de errores {#bug-fix-24} - -- Corregir la posible pérdida de datos en Kafka [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([Ivan](https://github.com/abyss7)) -- Repara el potencial bucle infinito en `PrettySpace` formato cuando se llama con cero columnas [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) -- Se corrigió el error de desbordamiento UInt32 en modelos lineales. Permitir modelo ML eval para argumento de modelo no const. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `ALTER TABLE ... DROP INDEX IF EXISTS ...` no debe generar una excepción si el índice proporcionado no existe [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Reparar segfault con `bitmapHasAny` en subconsulta escalar [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Se corrigió el error cuando el grupo de conexiones de replicación no vuelve a intentar resolver el host, incluso cuando se eliminó la caché DNS. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- Fijo `ALTER ... MODIFY TTL` en ReplicatedMergeTree. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) -- Repare INSERT en la tabla distribuida con la columna MATERIALIZED [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) -- Corregir la asignación incorrecta al truncar el almacenamiento de unión [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([Método de codificación de datos:](https://github.com/TCeason)) -- En versiones recientes del paquete tzdata algunos de los archivos son enlaces simbólicos ahora. El mecanismo actual para detectar la zona horaria predeterminada se rompe y da nombres incorrectos para algunas zonas horarias. Ahora, al menos, forzamos el nombre de la zona horaria al contenido de TZ si se proporciona. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) -- Solucione algunos casos extremadamente raros con el buscador MultiVolnitsky cuando las agujas constantes en suma tienen al menos 16 KB de largo. El algoritmo omitió o sobrescribió los resultados anteriores que pueden conducir al resultado incorrecto de `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Más información](https://github.com/danlark1)) -- Solucione el problema cuando la configuración de las solicitudes de ExternalData no podía usar la configuración de ClickHouse. Además, por ahora, configuración `date_time_input_format` y `low_cardinality_allow_in_native_format` no se puede usar debido a la ambigüedad de los nombres (en datos externos puede interpretarse como formato de tabla y en la consulta puede ser una configuración). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Más información](https://github.com/danlark1)) -- Corregir un error cuando las piezas se eliminaron solo de FS sin dejarlas caer de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- Eliminar el registro de depuración del protocolo MySQL [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Omitir ZNONODE durante el procesamiento de consultas DDL [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Fijar la mezcla `UNION ALL` tipo de columna de resultado. Hubo casos con datos inconsistentes y tipos de columnas de columnas resultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- Lanzar una excepción en enteros incorrectos en `dictGetT` funciones en lugar de accidente. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Arregle element\_count y load\_factor incorrectos para el diccionario hash en `system.dictionaries` tabla. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-9} - -- Construcción fija sin `Brotli` Soporte de compresión HTTP (`ENABLE_BROTLI=OFF` de la variable cmake). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) -- Incluye rugido.h como rugiendo / rugiendo.h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Películas De Sexo](https://github.com/orivej)) -- Corregir las advertencias de gcc9 en hyperscan (\# ¡la directiva de línea es malvada!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Más información](https://github.com/danlark1)) -- Corrige todas las advertencias al compilar con gcc-9. Soluciona algunos problemas de contribución. Repara gcc9 ICE y envíalo a bugzilla. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Más información](https://github.com/danlark1)) -- Enlace fijo con lld [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eliminar especializaciones no utilizadas en diccionarios [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) -- Pruebas de rendimiento de mejora para formatear y analizar tablas para diferentes tipos de archivos [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) -- Correcciones para la ejecución de pruebas en paralelo [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([propulsor](https://github.com/proller)) -- Docker: use configuraciones de clickhouse-test [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([propulsor](https://github.com/proller)) -- Solucionar compilación para FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([propulsor](https://github.com/proller)) -- Impulso de actualización a 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([propulsor](https://github.com/proller)) -- Repara el clickhouse de compilación como submódulo [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([propulsor](https://github.com/proller)) -- Mejorar las pruebas de rendimiento JSONExtract [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) - -## Lanzamiento de ClickHouse 19.8 {#clickhouse-release-19-8} - -### Lanzamiento de ClickHouse 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} - -#### Novedad {#new-features} - -- Funciones añadidas para trabajar con JSON [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([Hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) -- Agregue una función basename, con un comportamiento similar a una función basename, que existe en muchos idiomas (`os.path.basename` en python, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Añadir `LIMIT n, m BY` o `LIMIT m OFFSET n BY` sintaxis para establecer el desplazamiento de n para la cláusula LIMIT BY. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) -- Añadido nuevo tipo de datos `SimpleAggregateFunction`, lo que permite tener columnas con agregación de luz en un `AggregatingMergeTree`. Esto solo se puede usar con funciones simples como `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) -- Se agregó soporte para argumentos no constantes en función `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Más información](https://github.com/danlark1)) -- Funciones añadidas `skewPop`, `skewSamp`, `kurtPop` y `kurtSamp` para calcular la asimetría de la secuencia, la asimetría de la muestra, la curtosis y la curtosis de la muestra, respectivamente. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([Hcz](https://github.com/hczhcz)) -- La ayuda cambia de nombre la operación para `MaterializeView` almacenamiento. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Se agregó un servidor que permite conectarse a ClickHouse usando el cliente MySQL. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) -- Añadir `toDecimal*OrZero` y `toDecimal*OrNull` función. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) -- Soporte tipos decimales en funciones: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Más información](https://github.com/danlark1)) -- Añadir `format` función. Formateo del patrón constante (patrón de formato Python simplificado) con las cadenas enumeradas en los argumentos. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Más información](https://github.com/danlark1)) -- Añadir `system.detached_parts` que contiene información sobre las partes separadas de `MergeTree` tabla. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) -- Añadir `ngramSearch` función para calcular la diferencia no simétrica entre la aguja y el pajar. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Más información](https://github.com/danlark1)) -- Implementación de métodos básicos de aprendizaje automático (regresión lineal estocástica y regresión logística) utilizando la interfaz de funciones agregadas. Tiene diferentes estrategias para actualizar los pesos del modelo (descenso de gradiente simple, método de impulso, método Nesterov). También es compatible con mini lotes de tamaño personalizado. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) -- Implementación de `geohashEncode` y `geohashDecode` función. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) -- Función agregada agregada `timeSeriesGroupSum`, que puede agregar diferentes series de tiempo que muestran la marca de tiempo no la alineación. Utilizará la interpolación lineal entre dos marcas de tiempo de muestra y luego sumará series temporales juntas. Función agregada agregada `timeSeriesGroupRateSum`, que calcula la tasa de series temporales y luego suma las tasas juntas. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Información adicional](https://github.com/LiuYangkuan)) -- Funciones añadidas `IPv4CIDRtoIPv4Range` y `IPv6CIDRtoIPv6Range` para calcular los límites inferiores y superiores para una IP en la subred utilizando un CIDR. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Agregue un encabezado X-ClickHouse-Summary cuando enviamos una consulta usando HTTP con la configuración habilitada `send_progress_in_http_headers`. Devuelve la información habitual de X-ClickHouse-Progress, con información adicional como cuántas filas y bytes se insertaron en la consulta. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Mejora {#improvements} - -- Añadir `max_parts_in_total` configuración para la familia de tablas MergeTree (predeterminado: 100 000) que evita la especificación insegura de la clave de partición \# 5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-obfuscator`: derivar la semilla para columnas individuales combinando la semilla inicial con el nombre de la columna, no la posición de la columna. Esto está destinado a transformar conjuntos de datos con varias tablas relacionadas, de modo que las tablas permanezcan JOINable después de la transformación. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Funciones añadidas `JSONExtractRaw`, `JSONExtractKeyAndValues`. Funciones renombradas `jsonExtract` a `JSONExtract`. Cuando algo sale mal, estas funciones devuelven los valores correspondientes, no `NULL`. Función modificada `JSONExtract`, ahora obtiene el tipo de devolución de su último parámetro y no inyecta nullables. Implementado de respaldo a RapidJSON en caso de que las instrucciones AVX2 no estén disponibles. Biblioteca Simdjson actualizado a una nueva versión. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ahora `if` y `multiIf` funciones no dependen de la condición `Nullable`, pero confíe en las ramas para la compatibilidad sql. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu](https://github.com/janplus)) -- `In` predicado ahora genera `Null` resultado de `Null` entrada como el `Equal` función. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu](https://github.com/janplus)) -- Verifique el límite de tiempo cada (flush\_interval / poll\_timeout) número de filas de Kafka. Esto permite romper la lectura del consumidor de Kafka con más frecuencia y verificar los límites de tiempo para las transmisiones de nivel superior [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([Ivan](https://github.com/abyss7)) -- Enlace rdkafka con SASL incluido. Debería permitir el uso de autenticación SASL SCRAM [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([Ivan](https://github.com/abyss7)) -- Versión por lotes de RowRefList para TODAS LAS UNIONES. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) -- clickhouse-server: mensajes de error de escucha más informativos. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([propulsor](https://github.com/proller)) -- Diccionarios de soporte en clickhouse-copiadora para funciones en `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([propulsor](https://github.com/proller)) -- Añadir nueva configuración `kafka_commit_every_batch` para regular Kafka cometer política. - Permite establecer el modo de confirmación: después de que se maneje cada lote de mensajes, o después de que se escriba todo el bloque en el almacenamiento. Es una compensación entre perder algunos mensajes o leerlos dos veces en algunas situaciones extremas. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([Ivan](https://github.com/abyss7)) -- Hacer `windowFunnel` soporta otros tipos de enteros sin firmar. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([Sundyli](https://github.com/sundy-li)) -- Permitir sombrear la columna virtual `_table` en el motor de fusión. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([Ivan](https://github.com/abyss7)) -- Hacer `sequenceMatch` Las funciones de agregado admiten otros tipos de enteros sin signo [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([Sundyli](https://github.com/sundy-li)) -- Mejores mensajes de error si la suma de comprobación no coincide probablemente es causada por fallas de hardware. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Compruebe que las tablas subyacentes admiten `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([Ivan](https://github.com/abyss7)) -- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Mejoras de MySQL Wire Protocol. Se ha cambiado el nombre del formato a MySQLWire. Usando RAII para llamar a RSA\_free. Deshabilitar SSL si no se puede crear contexto. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) -- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([propulsor](https://github.com/proller)) -- Respete la configuración de consulta en INSERT asincrónicos en tablas distribuidas. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([Método de codificación de datos:](https://github.com/TCeason)) -- Funciones renombradas `leastSqr` a `simpleLinearRegression`, `LinearRegression` a `linearRegression`, `LogisticRegression` a `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Mejoras de rendimiento {#performance-improvements} - -- Paralelice el procesamiento de partes de tablas MergeTree no replicadas en la consulta ALTER MODIFY. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) -- Optimizaciones en la extracción de expresiones regulares. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Más información](https://github.com/danlark1)) -- No agregue la columna de clave de unión correcta para unir el resultado si solo se usa en la sección join on . [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) -- Congele el búfer Kafka después de la primera respuesta vacía. Evita múltiples invocaciones de `ReadBuffer::next()` para el resultado vacío en algunas secuencias de análisis de filas. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([Ivan](https://github.com/abyss7)) -- `concat` optimización de funciones para múltiples argumentos. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Más información](https://github.com/danlark1)) -- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) -- Actualice nuestra implementación LZ4 con la referencia uno para tener una descompresión más rápida. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Más información](https://github.com/danlark1)) -- Implementado MSD radix ordenar (basado en kxsort), y la clasificación parcial. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) - -#### Corrección de errores {#bug-fixes} - -- Fix push requiere columnas con unión [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Invierno Zhang](https://github.com/zhang2014)) -- Corregido error, cuando ClickHouse es ejecutado por systemd, el comando `sudo service clickhouse-server forcerestart` no funcionaba como se esperaba. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([propulsor](https://github.com/proller)) -- Corregir los códigos de error http en DataPartsExchange (el servidor http deinterserver en el puerto 9009 siempre devolvió el código 200, incluso en errores). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([propulsor](https://github.com/proller)) -- Repara SimpleAggregateFunction para String más largo que MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) -- Corregir error para `Decimal` a `Nullable(Decimal)` conversión en IN. Admite otras conversiones de decimales a decimales (incluidas diferentes escalas). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió el clobbering de FPU en la biblioteca simdjson que conducía a un cálculo incorrecto de `uniqHLL` y `uniqCombined` función agregada y funciones matemáticas tales como `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el manejo de casos mixtos const / nonconst en funciones JSON. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fijar `retention` función. Ahora todas las condiciones que cumplen en una fila de datos se agregan al estado de datos. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) -- Corregir el tipo de resultado para `quantileExact` con decimales. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Documentación {#documentation} - -- Traducir documentación para `CollapsingMergeTree` a chino. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) -- Traduzca alguna documentación sobre motores de mesa al chino. - [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) - [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) - ([nunca lee](https://github.com/neverlee)) - -#### Mejoras de compilación / prueba / empaquetado {#buildtestingpackaging-improvements} - -- Corrija algunos informes de desinfectantes que muestran un uso probable después de liberar.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([Ivan](https://github.com/abyss7)) -- Mueva las pruebas de rendimiento fuera de directorios separados para mayor comodidad. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir pruebas de rendimiento incorrectas. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) -- Se agregó una herramienta para calcular las sumas de comprobación causadas por los saltos de bits para depurar problemas de hardware. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hacer script corredor más utilizable. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) -- Agregue pequeñas instrucciones sobre cómo escribir pruebas de rendimiento. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) -- Añadir capacidad para hacer sustituciones en crear, llenar y soltar consulta en las pruebas de rendimiento [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) - -## Lanzamiento de ClickHouse 19.7 {#clickhouse-release-19-7} - -### Lanzamiento de ClickHouse 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} - -#### Corrección de errores {#bug-fix-25} - -- Corregir la regresión de rendimiento en algunas consultas con JOIN. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Invierno Zhang](https://github.com/zhang2014)) - -### Lanzamiento de ClickHouse 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} - -#### Novedad {#new-features-1} - -- Se agregaron funciones relacionadas con el mapa de bits `bitmapHasAny` y `bitmapHasAll` análogo a `hasAny` y `hasAll` funciones para matrices. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) - -#### Corrección de errores {#bug-fixes-1} - -- Arreglar segfault en `minmax` ÍNDICE con valor nulo. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) -- Marque todas las columnas de entrada en LIMIT BY como salida requerida. Se fija ‘Not found column’ error en algunas consultas distribuidas. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) -- Fijar “Column ‘0’ already exists” error en `SELECT .. PREWHERE` en la columna con DEFAULT [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([propulsor](https://github.com/proller)) -- Fijar `ALTER MODIFY TTL` consulta sobre `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) -- No bloquee el servidor cuando los consumidores de Kafka no se hayan iniciado. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([Ivan](https://github.com/abyss7)) -- Las funciones de mapa de bits fijas producen un resultado incorrecto. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Cristina Andrés](https://github.com/andyyzh)) -- Fix element\_count para el diccionario hash (no incluye duplicados) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) -- Utilice el contenido de la variable de entorno TZ como el nombre de la zona horaria. Ayuda a detectar correctamente la zona horaria predeterminada en algunos casos.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) -- No intente convertir enteros en `dictGetT` funciones, porque no funciona correctamente. Lanza una excepción en su lugar. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Corregir la configuración en la solicitud HTTP ExternalData. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila - Kutenin](https://github.com/danlark1)) -- Corregir un error cuando las piezas se eliminaron solo de FS sin dejarlas caer de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- Fijar falla de segmentación en `bitmapHasAny` función. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Se corrigió el error cuando el grupo de conexiones de replicación no vuelve a intentar resolver el host, incluso cuando se eliminó la caché DNS. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- Fijo `DROP INDEX IF EXISTS` consulta. Ahora `ALTER TABLE ... DROP INDEX IF EXISTS ...` query no genera una excepción si el índice proporcionado no existe. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Corregir unión toda la columna de supertipo. Hubo casos con datos inconsistentes y tipos de columnas de columnas resultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- Omita ZNONODE durante el procesamiento de consultas DDL. Antes, si otro nodo elimina el znode en la cola de tareas, el que - no lo procesó, pero ya obtuvo la lista de hijos, terminará el hilo DDLWorker. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Fije INSERT en la tabla Distributed () con la columna MATERIALIZED. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) - -### Lanzamiento de ClickHouse 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} - -#### Novedad {#new-features-2} - -- Permite limitar el rango de una configuración que puede especificar el usuario. - Estas restricciones se pueden configurar en el perfil de configuración del usuario. - [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly - Baranov](https://github.com/vitlibar)) -- Añadir una segunda versión de la función `groupUniqArray` con una opción - `max_size` parámetro que limita el tamaño de la matriz resultante. Este - comportamiento es similar a `groupArray(max_size)(x)` función. - [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- Para los formatos de archivo de entrada TSVWithNames/CSVWithNames, el orden de columnas ahora puede ser - determinado a partir del encabezado del archivo. Esto es controlado por - `input_format_with_names_use_header` parámetro. - [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) - ([Alejandro](https://github.com/Akazz)) - -#### Corrección de errores {#bug-fixes-2} - -- Bloqueo con sin comprimir\_cache + JOIN durante la fusión (\# 5197) - [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila - Kutenin](https://github.com/danlark1)) -- Error de segmentación en una consulta de clickhouse-cliente a tablas del sistema. \#5066 - [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) - ([Ivan](https://github.com/abyss7)) -- Pérdida de datos en carga pesada a través de KafkaEngine (\#4736) - [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) - ([Ivan](https://github.com/abyss7)) -- Se corrigió una condición de carrera de datos muy rara que podría ocurrir al ejecutar una consulta con UNION ALL que involucraba al menos dos SELECT del sistema.columnas, sistema.mesas, sistema.partes, sistema.parts\_tables o tablas de la familia Merge y realizar ALTER de columnas de las tablas relacionadas simultáneamente. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejoras de rendimiento {#performance-improvements-1} - -- Utilice la clasificación de radix para ordenar por una sola columna numérica en `ORDER BY` sin - `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), - [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) - ([Evgenii Pravda](https://github.com/kvinty), - [alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Documentación {#documentation-1} - -- Traduzca la documentación de algunos motores de tabla al chino. - [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), - [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), - [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) - ([张风啸](https://github.com/AlexZFX)), - [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([nunca - Sotavento](https://github.com/neverlee)) - -#### Mejoras de compilación / prueba / empaquetado {#buildtestingpackaging-improvements-1} - -- Imprima los caracteres UTF-8 correctamente en `clickhouse-test`. - [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregar parámetro de línea de comandos para clickhouse-cliente para cargar siempre la sugerencia - datos. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Resuelva algunas de las advertencias de PVS-Studio. - [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualizar LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila - Kutenin](https://github.com/danlark1)) -- Agregue gperf a los requisitos de compilación para la próxima solicitud de extracción \# 5030. - [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) - ([propulsor](https://github.com/proller)) - -## Lanzamiento de ClickHouse 19.6 {#clickhouse-release-19-6} - -### Lanzamiento de ClickHouse 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} - -#### Corrección de errores {#bug-fixes-3} - -- Fijo IN condición pushdown para consultas de funciones de tabla `mysql` y `odbc` y los correspondientes motores de mesa. Esto corrige \# 3540 y \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir el punto muerto en Zookeeper. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) -- Permitir decimales citados en CSV. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) -- No permitir la conversión de float Inf / NaN en Decimales (excepción de lanzamiento). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) -- Corregir la carrera de datos en la consulta de cambio de nombre. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([Invierno Zhang](https://github.com/zhang2014)) -- Deshabilitar temporalmente LFAlloc. El uso de LFAlloc puede conducir a una gran cantidad de MAP\_FAILED en la asignación de UncompressedCache y, como resultado, a bloqueos de consultas en servidores de alta carga. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Más información](https://github.com/danlark1)) - -### Lanzamiento de ClickHouse 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} - -#### Novedad {#new-features-3} - -- Expresiones TTL para columnas y tablas. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) -- Añadido soporte para `brotli` compresión para respuestas HTTP (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mijaíl](https://github.com/fandyushin)) -- Se agregó una nueva función `isValidUTF8` para verificar si un conjunto de bytes está codificado correctamente en utf-8. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Más información](https://github.com/danlark1)) -- Agregar nueva directiva de equilibrio de carga `first_or_random` que envía consultas al primer host especificado y, si es inaccesible, envía consultas a hosts aleatorios de fragmento. Útil para configuraciones de topología de replicación cruzada. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) - -#### Experimental Características {#experimental-features-1} - -- Añadir ajuste `index_granularity_bytes` (granularidad de índice adaptativo) para la familia de tablas MergeTree\*. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) - -#### Mejora {#improvements-1} - -- Se agregó soporte para argumentos de tamaño y longitud no constantes y negativos para la función `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Deshabilite el push-down a la tabla derecha en la unión izquierda, la tabla izquierda en la unión derecha y ambas tablas en unión completa. Esto corrige los resultados JOIN incorrectos en algunos casos. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([Ivan](https://github.com/abyss7)) -- `clickhouse-copier`: configuración de tareas de carga automática desde `--task-file` opcion [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([propulsor](https://github.com/proller)) -- Se agregó el controlador de errores tipográficos para la fábrica de almacenamiento y la fábrica de funciones de tabla. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Más información](https://github.com/danlark1)) -- Admite asteriscos y asteriscos calificados para combinaciones múltiples sin subconsultas [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) -- Haga que el mensaje de error de columna faltante sea más fácil de usar. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Mejoras de rendimiento {#performance-improvements-2} - -- Aceleración significativa de ASOF JOIN [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) - -#### Cambios incompatibles hacia atrás {#backward-incompatible-changes} - -- Encabezado HTTP `Query-Id` fue renombrado a `X-ClickHouse-Query-Id` para la consistencia. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mijaíl](https://github.com/fandyushin)) - -#### Corrección de errores {#bug-fixes-4} - -- Se corrigió la desreferencia del puntero nulo potencial en `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([propulsor](https://github.com/proller)) -- Se corrigió el error en la consulta con JOIN + ARRAY JOIN [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió el inicio del servidor cuando un diccionario depende de otro diccionario a través de una base de datos con motor = Diccionario. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) -- Partially fix distributed\_product\_mode = local. It's possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There's not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) -- Repara el resultado potencialmente incorrecto para `SELECT DISTINCT` con `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió una condición de carrera de datos muy rara que podría ocurrir al ejecutar una consulta con UNION ALL que involucraba al menos dos SELECT del sistema.columnas, sistema.mesas, sistema.partes, sistema.parts\_tables o tablas de la familia Merge y realizar ALTER de columnas de las tablas relacionadas simultáneamente. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejoras de compilación / prueba / empaquetado {#buildtestingpackaging-improvements-2} - -- Se corrigieron errores de prueba al ejecutar clickhouse-server en un host diferente [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) -- clickhouse-test: deshabilita las secuencias de control de color en un entorno no tty. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) -- clickhouse-test: Permitir el uso de cualquier base de datos de prueba (eliminar `test.` calificación donde sea posible) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([propulsor](https://github.com/proller)) -- Corregir errores de ubsan [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Yandex LFAlloc se agregó a ClickHouse para asignar datos de MarkCache y UncompressedCache de diferentes maneras para detectar segfaults más confiables [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Más información](https://github.com/danlark1)) -- Python utiliza para ayudar con backports y registros de cambios. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([Ivan](https://github.com/abyss7)) - -## Lanzamiento de ClickHouse 19.5 {#clickhouse-release-19-5} - -### Lanzamiento de ClickHouse 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} - -#### Corrección de errores {#bug-fixes-5} - -- Se corrigió un posible bloqueo en las funciones de mapa de bits \* [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Cristina Andrés](https://github.com/andyyzh)) -- Se corrigió una condición de carrera de datos muy rara que podría ocurrir al ejecutar una consulta con UNION ALL que involucraba al menos dos SELECT del sistema.columnas, sistema.mesas, sistema.partes, sistema.parts\_tables o tablas de la familia Merge y realizar ALTER de columnas de las tablas relacionadas simultáneamente. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Error fijo `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. Este error ocurrió si la columna LowCardinality era la parte de la clave principal. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Modificación de la función de retención: si una fila satisface la primera condición y la NTH, solo se agrega la primera condición satisfecha al estado de datos. Ahora todas las condiciones que cumplen en una fila de datos se agregan al estado de datos. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) - -### Lanzamiento de ClickHouse 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} - -#### Corrección de errores {#bug-fixes-6} - -- Tipo fijo de ajuste `max_partitions_per_insert_block` de booleano a UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Más información](https://github.com/mhsekhavat)) - -### Lanzamiento de ClickHouse 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} - -#### Novedad {#new-features-4} - -- [Hyperscan](https://github.com/intel/hyperscan) Se agregó múltiples coincidencias de expresiones regulares (funciones `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Más información](https://github.com/danlark1)) -- `multiSearchFirstPosition` se añadió la función. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Más información](https://github.com/danlark1)) -- Implemente el filtro de expresión predefinido por fila para las tablas. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([Ivan](https://github.com/abyss7)) -- Un nuevo tipo de índices de omisión de datos basados en filtros de floración (se puede usar para `equal`, `in` y `like` función). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) -- Añadir `ASOF JOIN` que permite ejecutar consultas que se unen al valor más reciente conocido. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) -- Reescribir múltiples `COMMA JOIN` a `CROSS JOIN`. Luego reescribirlos para `INNER JOIN` si es posible. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Mejora {#improvement-9} - -- `topK` y `topKWeighted` ahora soporta personalizado `loadFactor` (soluciona el problema [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) -- Permitir usar `parallel_replicas_count > 1` incluso para tablas sin muestreo (la configuración simplemente se ignora para ellas). En versiones anteriores fue conducido a la excepción. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) -- Soporte para `CREATE OR REPLACE VIEW`. Permite crear una vista o establecer una nueva definición en una sola instrucción. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) -- `Buffer` motor de mesa ahora soporta `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Información adicional](https://github.com/LiuYangkuan)) -- Agregue la capacidad de iniciar una tabla replicada sin metadatos en zookeeper en `readonly` modo. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) -- Parpadeo fijo de la barra de progreso en clickhouse-cliente. El problema fue más notable al usar `FORMAT Null` con consultas de streaming. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Permitir deshabilitar funciones con `hyperscan` biblioteca por usuario para limitar el uso de recursos potencialmente excesivo e incontrolado. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregue el registro del número de versión en todos los errores. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([propulsor](https://github.com/proller)) -- Se agregó restricción a la `multiMatch` funciones que requieren tamaño de cadena para encajar en `unsigned int`. También se agregó el número de límite de argumentos al `multiSearch` función. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Más información](https://github.com/danlark1)) -- Uso mejorado del espacio de arañazos y manejo de errores en Hyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Más información](https://github.com/danlark1)) -- Llenar `system.graphite_detentions` de una configuración de tabla de `*GraphiteMergeTree` mesas de motores. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Cambiar nombre `trigramDistance` función para `ngramDistance` y añadir más funciones con `CaseInsensitive` y `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Más información](https://github.com/danlark1)) -- Cálculo de índices de saltos de datos mejorado. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) -- Mantener ordinario, `DEFAULT`, `MATERIALIZED` y `ALIAS` columnas en una sola lista (soluciona el problema [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Método de codificación de datos:](https://github.com/ztlpn)) - -#### Corrección de errores {#bug-fix-26} - -- Evitar `std::terminate` en caso de error de asignación de memoria. Ahora `std::bad_alloc` excepción se lanza como se esperaba. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corrige la lectura de capnproto desde el búfer. A veces, los archivos no se cargaron correctamente por HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Corregir error `Unknown log entry type: 0` despues `OPTIMIZE TABLE FINAL` consulta. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos pájaro](https://github.com/amosbird)) -- Argumentos erróneos para `hasAny` o `hasAll` funciones pueden conducir a segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Puede producirse un punto muerto durante la ejecución `DROP DATABASE dictionary` consulta. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Repara el comportamiento indefinido en `median` y `quantile` función. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([Hcz](https://github.com/hczhcz)) -- Corregir la detección de nivel de compresión cuando `network_compression_method` en minúsculas. Roto en v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([propulsor](https://github.com/proller)) -- Se corrigió la ignorancia de `UTC` ajuste (soluciona el problema [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([propulsor](https://github.com/proller)) -- Fijar `histogram` comportamiento de la función con `Distributed` tabla. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- Informe tsan fijo `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el informe de TSan sobre el cierre debido a la condición de carrera en el uso de registros del sistema. Se corrigió el uso potencial después de liberar al apagar cuando part\_log está habilitado. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar las piezas de nuevo control en `ReplicatedMergeTreeAlterThread` en caso de error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Las operaciones aritméticas en estados de función de agregado intermedios no funcionaban para argumentos constantes (como los resultados de subconsulta). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Siempre retroceda los nombres de las columnas en los metadatos. De lo contrario, es imposible crear una tabla con una columna llamada `index` (el servidor no se reiniciará debido a `ATTACH` consulta en metadatos). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix crash en `ALTER ... MODIFY ORDER BY` en `Distributed` tabla. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Método de codificación de datos:](https://github.com/TCeason)) -- Arreglar segfault en `JOIN ON` con habilitado `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Invierno Zhang](https://github.com/zhang2014)) -- Corregir un error al agregar una fila extraña después de consumir un mensaje protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corregir el bloqueo de `JOIN` no aceptan vs columna que acepta valores null. Fijar `NULLs` en las teclas de la derecha en `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) -- Condición de carrera fija en `SELECT` de `system.tables` si la tabla se cambia de nombre o se modifica simultáneamente. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la carrera de datos al obtener una parte de datos que ya está obsoleta. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la carrera de datos raros que puede ocurrir durante `RENAME` tabla de la familia MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fallo de segmentación fijo en la función `arrayIntersect`. La falla de segmentación podría ocurrir si se llamara a la función con argumentos constantes y ordinarios mixtos. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fix crash en `FULL/RIGHT JOIN` cuando nos unimos en nullable vs no nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijar `No message received` excepción al recuperar partes entre réplicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- Fijo `arrayIntersect` resultado incorrecto de la función en caso de varios valores repetidos en una sola matriz. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir una condición de carrera durante `ALTER COLUMN` consultas que podrían provocar un bloqueo del servidor (soluciona el problema [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Corregir el resultado incorrecto en `FULL/RIGHT JOIN` con la columna const. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) -- Reparar duplicados en `GLOBAL JOIN` con asterisk. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) -- Corregir la deducción de parámetros en `ALTER MODIFY` de la columna `CODEC` cuando no se especifica el tipo de columna. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- Función `cutQueryStringAndFragment()` y `queryStringAndFragment()` ahora funciona correctamente cuando `URL` contiene un fragmento y ninguna consulta. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corregir un error raro al configurar `min_bytes_to_use_direct_io` es mayor que cero, lo que ocurre cuando el hilo tiene que buscar hacia atrás en el archivo de columna. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- Corregir tipos de argumentos incorrectos para funciones agregadas con `LowCardinality` argumentos (soluciona el problema [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir la calificación de nombre incorrecto en `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijar la función `toISOWeek` resultado para el año 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar `DROP`, `TRUNCATE` y `OPTIMIZE` duplicación de consultas, cuando se ejecuta en `ON CLUSTER` para `ReplicatedMergeTree*` tablas de la familia. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-8} - -- Cambiar el nombre de la configuración `insert_sample_with_metadata` establecer `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadido `max_partitions_per_insert_block` (con valor 100 por defecto). Si el bloque insertado contiene un mayor número de particiones, se lanza una excepción. Establezca en 0 si desea eliminar el límite (no recomendado). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se renombraron las funciones de búsqueda múltiple (`multiPosition` a `multiSearchAllPositions`, `multiSearch` a `multiSearchAny`, `firstMatch` a `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Más información](https://github.com/danlark1)) - -#### Mejora del rendimiento {#performance-improvement-6} - -- Optimice el buscador Volnitsky al alinear, dando aproximadamente un 5-10% de mejora de búsqueda para consultas con muchas agujas o muchos bigrams similares. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Más información](https://github.com/danlark1)) -- Solucionar problema de rendimiento al configurar `use_uncompressed_cache` es mayor que cero, que apareció cuando todos los datos leídos contenidos en la memoria caché. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-10} - -- Endurecimiento de la compilación de depuración: más asignaciones de memoria granulares y ASLR; agregue protección de memoria para caché de marcas e índice. Esto permite encontrar más errores de memoria en caso de que ASan y MSan no puedan hacerlo. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir soporte para variables cmake `ENABLE_PROTOBUF`, `ENABLE_PARQUET` y `ENABLE_BROTLI` que permite habilitar / deshabilitar las características anteriores (lo mismo que podemos hacer para librdkafka, mysql, etc.). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) -- Agregue la capacidad de imprimir la lista de procesos y los rastros de pila de todos los hilos si algunas consultas se cuelgan después de la ejecución de la prueba. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) -- Agregar reintentos en `Connection loss` error en `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) -- Agregue freebsd build con vagrant y compile con desinfectante de hilos al script del empaquetador. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) -- Ahora el usuario pidió contraseña para el usuario `'default'` durante la instalación. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([propulsor](https://github.com/proller)) -- Suprimir advertencia en `rdkafka` biblioteca. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Permitir la capacidad de construir sin ssl. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([propulsor](https://github.com/proller)) -- Agregar una forma de iniciar clickhouse-servidor de la imagen de un usuario personalizado. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Actualice el impulso de contrib a 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([propulsor](https://github.com/proller)) -- Deshabilitar el uso de `mremap` cuando se compila con Thread Sanitizer. Sorprendentemente, TSan no intercepta `mremap` (aunque intercepta `mmap`, `munmap`) que conduce a falsos positivos. Informe TSan fijo en pruebas con estado. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregue comprobación de prueba usando el esquema de formato a través de la interfaz HTTP. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) - -## Lanzamiento de ClickHouse 19.4 {#clickhouse-release-19-4} - -### Lanzamiento de ClickHouse 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} - -#### Corrección de errores {#bug-fixes-7} - -- Evitar `std::terminate` en caso de error de asignación de memoria. Ahora `std::bad_alloc` excepción se lanza como se esperaba. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corrige la lectura de capnproto desde el búfer. A veces, los archivos no se cargaron correctamente por HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Corregir error `Unknown log entry type: 0` despues `OPTIMIZE TABLE FINAL` consulta. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos pájaro](https://github.com/amosbird)) -- Argumentos erróneos para `hasAny` o `hasAll` funciones pueden conducir a segfault. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Puede producirse un punto muerto durante la ejecución `DROP DATABASE dictionary` consulta. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Repara el comportamiento indefinido en `median` y `quantile` función. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([Hcz](https://github.com/hczhcz)) -- Corregir la detección de nivel de compresión cuando `network_compression_method` en minúsculas. Roto en v19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([propulsor](https://github.com/proller)) -- Se corrigió la ignorancia de `UTC` ajuste (soluciona el problema [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([propulsor](https://github.com/proller)) -- Fijar `histogram` comportamiento de la función con `Distributed` tabla. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([Olegkv](https://github.com/olegkv)) -- Informe tsan fijo `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el informe de TSan sobre el cierre debido a la condición de carrera en el uso de registros del sistema. Se corrigió el uso potencial después de liberar al apagar cuando part\_log está habilitado. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar las piezas de nuevo control en `ReplicatedMergeTreeAlterThread` en caso de error. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Las operaciones aritméticas en estados de función de agregado intermedios no funcionaban para argumentos constantes (como los resultados de subconsulta). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Siempre retroceda los nombres de las columnas en los metadatos. De lo contrario es imposible crear una tabla con una columna denominada `index` (el servidor no se reiniciará debido a `ATTACH` consulta en metadatos). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix crash en `ALTER ... MODIFY ORDER BY` en `Distributed` tabla. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Método de codificación de datos:](https://github.com/TCeason)) -- Arreglar segfault en `JOIN ON` con habilitado `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Invierno Zhang](https://github.com/zhang2014)) -- Corregir un error al agregar una fila extraña después de consumir un mensaje protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) -- Condición de carrera fija en `SELECT` de `system.tables` si la tabla se cambia de nombre o se modifica simultáneamente. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la carrera de datos al obtener una parte de datos que ya está obsoleta. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la carrera de datos raros que puede ocurrir durante `RENAME` tabla de la familia MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fallo de segmentación fijo en la función `arrayIntersect`. La falla de segmentación podría ocurrir si se llamara a la función con argumentos constantes y ordinarios mixtos. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fijar `No message received` excepción al recuperar partes entre réplicas. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- Fijo `arrayIntersect` resultado incorrecto de la función en caso de varios valores repetidos en una sola matriz. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir una condición de carrera durante `ALTER COLUMN` consultas que podrían provocar un bloqueo del servidor (soluciona el problema [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Corregir la deducción de parámetros en `ALTER MODIFY` de la columna `CODEC` cuando no se especifica el tipo de columna. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- Función `cutQueryStringAndFragment()` y `queryStringAndFragment()` ahora funciona correctamente cuando `URL` contiene un fragmento y ninguna consulta. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corregir un error raro al configurar `min_bytes_to_use_direct_io` es mayor que cero, lo que ocurre cuando el hilo tiene que buscar hacia atrás en el archivo de columna. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- Corregir tipos de argumentos incorrectos para funciones agregadas con `LowCardinality` argumentos (soluciona el problema [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fijar la función `toISOWeek` el resultado para el año 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar `DROP`, `TRUNCATE` y `OPTIMIZE` duplicación de consultas, cuando se ejecuta en `ON CLUSTER` para `ReplicatedMergeTree*` tablas de la familia. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### Mejora {#improvements-2} - -- Mantener ordinario, `DEFAULT`, `MATERIALIZED` y `ALIAS` columnas en una sola lista (soluciona el problema [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Método de codificación de datos:](https://github.com/ztlpn)) - -### Lanzamiento de ClickHouse 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} - -#### Corrección de errores {#bug-fixes-8} - -- Fix crash en `FULL/RIGHT JOIN` cuando nos unimos en nullable vs no nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-11} - -- Agregue una forma de iniciar una imagen de clickhouse-server desde un usuario personalizado. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### Lanzamiento de ClickHouse 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} - -#### Corrección de errores {#bug-fixes-9} - -- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### Lanzamiento de ClickHouse 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} - -#### Corrección de errores {#bug-fixes-10} - -- Consultas remotas fijas que contienen ambos `LIMIT BY` y `LIMIT`. Anteriormente, si `LIMIT BY` y `LIMIT` se utilizaron para la consulta remota, `LIMIT` podría pasar antes `LIMIT BY`, cuál llevó al resultado demasiado filtrado. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) - -### Lanzamiento de ClickHouse 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} - -#### Novedad {#new-features-5} - -- Se agregó soporte completo para `Protobuf` formato (entrada y salida, estructuras de datos anidadas). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) -- Se agregaron funciones de mapa de bits con mapas de bits rugientes. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Cristina Andrés](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) -- Soporte de formato de parquet. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([propulsor](https://github.com/proller)) -- Se agregó una distancia de N-gramo para la comparación de cadenas difusas. Es similar a las métricas de q-gram en el lenguaje R. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Más información](https://github.com/danlark1)) -- Combine reglas para el paquete acumulativo de grafito a partir de patrones de agregación y retención dedicados. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Añadir `max_execution_speed` y `max_execution_speed_bytes` para limitar el uso de recursos. Añadir `min_execution_speed_bytes` para complementar el `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([Invierno Zhang](https://github.com/zhang2014)) -- Función implementada `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [Kzon](https://github.com/kzon)) -- Funciones añadidas `arrayEnumerateDenseRanked` y `arrayEnumerateUniqRanked` (es como `arrayEnumerateUniq` pero permite ajustar la profundidad de la matriz para mirar dentro de las matrices multidimensionales). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([propulsor](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Corrección de errores {#bug-fixes-11} - -- Esta versión también contiene todas las correcciones de errores de 19.3 y 19.1. -- Se corrigió un error en los índices de omisión de datos: el orden de los gránulos después de INSERTAR era incorrecto. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) -- Fijo `set` índice de `Nullable` y `LowCardinality` columna. Antes de eso, `set` índice con `Nullable` o `LowCardinality` columna llevó a error `Data type must be deserialized with multiple streams` mientras se selecciona. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Establecer correctamente update\_time en completo `executable` actualización del diccionario. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) -- Arreglar la barra de progreso rota en 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) -- Se corrigieron los valores inconsistentes de MemoryTracker cuando se redujo la región de la memoria, en ciertos casos. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Comportamiento indefinido fijo en ThreadPool. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió un accidente muy raro con el mensaje `mutex lock failed: Invalid argument` eso podría suceder cuando una tabla MergeTree se eliminó simultáneamente con un SELECT. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Compatibilidad del controlador ODBC con `LowCardinality` tipo de datos. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([propulsor](https://github.com/proller)) -- FreeBSD: Arreglo para `AIOcontextPool: Found io_event with unknown id 0` error. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `system.part_log` se creó independientemente de la configuración. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Repara el comportamiento indefinido en `dictIsIn` función para los diccionarios de caché. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) -- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Deshabilite compile\_expressions de forma predeterminada hasta que obtengamos el propio `llvm` contrib y puede probarlo con `clang` y `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) -- Prevenir `std::terminate` cuando `invalidate_query` para `clickhouse` fuente de diccionario externo ha devuelto un conjunto de resultados incorrecto (vacío o más de una fila o más de una columna). Solucionado el problema cuando `invalidate_query` se realizó cada cinco segundos independientemente de la `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evite el punto muerto cuando `invalidate_query` para un diccionario con `clickhouse` fuente estaba involucrando `system.dictionaries` mesa o `Dictionaries` base de datos (caso raro). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Correcciones para CROSS JOIN con WHERE vacío. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) -- Segfault fijo en la función “replicate” cuando se pasa el argumento constante. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Repara la función lambda con el optimizador de predicados. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([Invierno Zhang](https://github.com/zhang2014)) -- Múltiples JOINs múltiples correcciones. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Mejora {#improvements-3} - -- Soporte alias en la sección JOIN ON para columnas de la tabla derecha. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) -- El resultado de múltiples JOIN necesita nombres de resultados correctos para ser utilizados en subselecciones. Reemplace los alias planos con nombres de origen en el resultado. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) -- Mejorar la lógica push-down para sentencias unidas. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([Ivan](https://github.com/abyss7)) - -#### Mejoras de rendimiento {#performance-improvements-3} - -- Heurística mejorada de “move to PREWHERE” optimización. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Use tablas de búsqueda adecuadas que usen la API de HashTable para claves de 8 bits y 16 bits. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos pájaro](https://github.com/amosbird)) -- Mejora del rendimiento de la comparación de cadenas. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Limpie la cola DDL distribuida en un subproceso separado para que no ralentice el bucle principal que procesa las tareas DDL distribuidas. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Cuando `min_bytes_to_use_direct_io` se establece en 1, no todos los archivos se abrieron con el modo O\_DIRECT porque el tamaño de los datos a leer a veces se subestimó por el tamaño de un bloque comprimido. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-12} - -- Se agregó soporte para clang-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Arreglar mal `__asm__` instrucciones (de nuevo) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) -- Añadir capacidad para especificar la configuración para `clickhouse-performance-test` desde la línea de comandos. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) -- Agregue pruebas de diccionarios a las pruebas de integración. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) -- Se agregaron consultas desde el punto de referencia en el sitio web a pruebas de rendimiento automatizadas. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `xxhash.h` no existe en lz4 externo porque es un detalle de implementación y sus símbolos tienen un espacio de nombres con `XXH_NAMESPACE` macro. Cuando lz4 es externo, xxHash también tiene que ser externo, y los dependientes tienen que vincularlo. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Películas De Sexo](https://github.com/orivej)) -- Se corrigió un caso cuando `quantileTiming` se puede llamar a la función de agregado con argumento de punto negativo o flotante (esto corrige la prueba de fuzz con un desinfectante de comportamiento indefinido). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corrección de errores de ortografía. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) -- Corregir la compilación en Mac. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) -- Construir correcciones para FreeBSD y varias configuraciones de compilación inusuales. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([propulsor](https://github.com/proller)) - -## Lanzamiento de ClickHouse 19.3 {#clickhouse-release-19-3} - -### Lanzamiento de ClickHouse 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} - -#### Corrección de errores {#bug-fixes-12} - -- Fix crash en `FULL/RIGHT JOIN` cuando nos unimos en nullable vs no nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Fijar falla de segmentación en `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([propulsor](https://github.com/proller)) -- Lectura fija de `Array(LowCardinality)` columna en caso raro cuando la columna contenía una larga secuencia de matrices vacías. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-13} - -- Agregar una forma de iniciar clickhouse-servidor de la imagen de un usuario personalizada [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### Lanzamiento de ClickHouse 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} - -#### Corrección de errores {#bug-fixes-13} - -- Corregido el error en \# 3920. Este error se manifiesta como corrupción de caché aleatoria (mensajes `Unknown codec family code`, `Cannot seek through file`) y segfaults. Este error apareció por primera vez en la versión 19.1 y está presente en las versiones hasta 19.1.10 y 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} - -#### Corrección de errores {#bug-fixes-14} - -- Cuando hay más de 1000 subprocesos en un grupo de subprocesos, `std::terminate` puede suceder en la salida del hilo. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora es posible crear `ReplicatedMergeTree*` tablas con comentarios sobre columnas sin valores predeterminados y tablas con códecs de columnas sin comentarios y valores predeterminados. También corrige la comparación de códecs. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) -- Se corrigió el fallo en JOIN con matriz o tupla. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió el fallo en el clickhouse-copiadora con el mensaje `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió el bloqueo en el cierre del servidor si se usaban DDL distribuidos. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Se imprimieron números de columna incorrectos en un mensaje de error sobre el análisis de formato de texto para columnas con un número mayor que 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejoras de compilación / prueba / empaquetado {#buildtestingpackaging-improvements-3} - -- Compilación fija con AVX habilitado. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Habilite la contabilidad extendida y la contabilidad IO basada en una versión buena conocida en lugar del kernel bajo el cual se compila. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) -- Permitir omitir la configuración de core\_dump.size\_limit, advertencia en lugar de lanzar si el conjunto de límites falla. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([propulsor](https://github.com/proller)) -- Eliminado el `inline` etiquetas de `void readBinary(...)` en `Field.cpp`. También se fusionó redundante `namespace DB` bloque. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([Hcz](https://github.com/hczhcz)) - -### Lanzamiento de ClickHouse 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} - -#### Corrección de errores {#bug-fixes-15} - -- Se corrigió un error con el procesamiento de grandes consultas de inserción http. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) -- Se corrigió la incompatibilidad hacia atrás con versiones antiguas debido a una implementación incorrecta de `send_logs_level` configuración. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Incompatibilidad hacia atrás fija de la función de la tabla `remote` introducido con comentarios de columna. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} - -#### Mejora {#improvements-4} - -- El tamaño del índice de tabla no se tiene en cuenta los límites de memoria al hacer `ATTACH TABLE` consulta. Evitó la posibilidad de que una tabla no se pueda adjuntar después de haber sido separada. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Levantó ligeramente el límite en el tamaño máximo de cadena y matriz recibido de ZooKeeper. Permite continuar trabajando con un mayor tamaño de `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` en ZooKeeper. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Permitir reparar réplicas abandonadas incluso si ya tiene una gran cantidad de nodos en su cola. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregue un argumento requerido a `SET` índice (número máximo de filas almacenadas). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Corrección de errores {#bug-fixes-16} - -- Fijo `WITH ROLLUP` resultado para grupo por solo `LowCardinality` clave. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Se corrigió un error en el índice establecido (dejando caer un gránulo si contiene más de `max_rows` filas). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) -- Muchas correcciones de compilación de FreeBSD. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([propulsor](https://github.com/proller)) -- Se corrigió la sustitución de alias en consultas con subconsulta que contenía el mismo alias (problema [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Mejoras de compilación / prueba / empaquetado {#buildtestingpackaging-improvements-4} - -- Añadir capacidad de ejecutar `clickhouse-server` para pruebas sin estado en la imagen de la ventana acoplable. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) - -### Lanzamiento de ClickHouse 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} - -#### Novedad {#new-features-6} - -- Se agregó el `KILL MUTATION` declaración que permite eliminar mutaciones que por alguna razón están atascadas. Añadir `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` campos a la `system.mutations` mesa para una solución de problemas más fácil. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Función agregada agregada `entropy` que calcula la entropía de Shannon. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) -- Añadida la capacidad de enviar consultas `INSERT INTO tbl VALUES (....` al servidor sin dividir en `query` y `data` parte. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) -- Implementación genérica de `arrayWithConstant` se añadió la función. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Aplicado `NOT BETWEEN` operador de comparación. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) -- Implementar `sumMapFiltered` para poder limitar el número de claves para las cuales los valores se sumarán por `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Se agregó soporte de `Nullable` tipos en `mysql` función de la tabla. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) -- Soporte para expresiones constantes arbitrarias en `LIMIT` clausula. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([K3box](https://github.com/k3box)) -- Añadir `topKWeighted` función de agregado que toma argumentos adicionales con peso (entero sin signo). [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Córdoba](https://github.com/andrewgolman)) -- `StorageJoin` ahora soporta `join_any_take_last_row` configuración que permite sobrescribir los valores existentes de la misma clave. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos pájaro](https://github.com/amosbird) -- Función añadida `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) -- Añadir `RowBinaryWithNamesAndTypes` formato. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) -- Añadir `IPv4` y `IPv6` tipos de datos. Implementaciones más efectivas de `IPv*` función. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) -- Función añadida `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) -- Añadir `Protobuf` formato de salida. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) -- Añadido soporte brotli para la interfaz HTTP para la importación de datos (INSERTs). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mijaíl](https://github.com/fandyushin)) -- Se agregaron consejos mientras el usuario hace un error tipográfico en el nombre de la función o escribe el cliente de línea de comandos. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Más información](https://github.com/danlark1)) -- Añadir `Query-Id` al encabezado de respuesta HTTP del servidor. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mijaíl](https://github.com/fandyushin)) - -#### Experimental características {#experimental-features-2} - -- Añadir `minmax` y `set` Índices de saltos de datos para la familia de motores de tablas MergeTree. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- Añadido conversión de `CROSS JOIN` a `INNER JOIN` si es posible. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Corrección de errores {#bug-fixes-17} - -- Fijo `Not found column` para columnas duplicadas en `JOIN ON` apartado. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Hacer `START REPLICATED SENDS` comando iniciar envíos replicados. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) -- Ejecución de funciones agregadas fijas con `Array(LowCardinality)` argumento. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Corregido el comportamiento incorrecto al hacer `INSERT ... SELECT ... FROM file(...)` consulta y archivo `CSVWithNames` o `TSVWIthNames` formato y falta la primera fila de datos. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el fallo en la recarga del diccionario si el diccionario no está disponible. Este error apareció en 19.1.6. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([propulsor](https://github.com/proller)) -- Fijo `ALL JOIN` con duplicados en la tabla derecha. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Fallo de segmentación fijo con `use_uncompressed_cache=1` y excepción con un tamaño incorrecto sin comprimir. Este error apareció en 19.1.6. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- Fijo `compile_expressions` error con la comparación de fechas grandes (más que int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- Bucle infinito fijo al seleccionar de la función de la tabla `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Deshabilitar temporalmente la optimización de predicados para `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Invierno Zhang](https://github.com/zhang2014)) -- Fijo `Illegal instruction` error al usar funciones base64 en CPU antiguas. Este error se ha reproducido solo cuando ClickHouse se compiló con gcc-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijo `No message received` error al interactuar con PostgreSQL ODBC Driver a través de la conexión TLS. También corrige segfault cuando se utiliza MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el resultado incorrecto cuando `Date` y `DateTime` los argumentos se usan en ramas del operador condicional (función `if`). Añadido caso genérico para la función `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Los diccionarios de ClickHouse ahora se cargan dentro `clickhouse` proceso. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el punto muerto cuando `SELECT` de una mesa con `File` el motor fue reintentado después `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Condición de carrera fija al seleccionar entre `system.tables` puede dar `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-client` puede segfault al salir mientras carga datos para sugerencias de línea de comandos si se ejecutó en modo interactivo. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se ha corregido un error cuando la ejecución de mutaciones que contienen `IN` Los operadores estaban produciendo resultados incorrectos. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Error corregido: si hay una base de datos con `Dictionary` motor, todos los diccionarios obligados a cargar en el inicio del servidor, y si hay un diccionario con fuente ClickHouse de localhost, el diccionario no se puede cargar. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el error cuando los registros del sistema se intentaban crear de nuevo al apagar el servidor. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Devuelva correctamente el tipo correcto y maneje adecuadamente las cerraduras en `joinGet` función. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos pájaro](https://github.com/amosbird)) -- Añadir `sumMapWithOverflow` función. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Segfault fijo con `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) -- Corregido error con incorrecto `Date` y `DateTime` comparación. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([Valexey](https://github.com/valexey)) -- Prueba de fuzz fija bajo desinfectante de comportamiento indefinido: verificación de tipo de parámetro agregada para `quantile*Weighted` familia de funciones. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la condición de carrera rara al eliminar las piezas de datos antiguas que pueden fallar con `File not found` error. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Arregle el paquete de instalación con /etc/clickhouse-server/config que falta.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([propulsor](https://github.com/proller)) - -#### Mejoras de compilación / prueba / empaquetado {#buildtestingpackaging-improvements-5} - -- Paquete de Debian: correcto /etc/clickhouse-server/preprocessed link según config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([propulsor](https://github.com/proller)) -- Varias correcciones de compilación para FreeBSD. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([propulsor](https://github.com/proller)) -- Se agregó la capacidad de crear, rellenar y soltar tablas en perftest. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) -- Se ha añadido un script para comprobar si hay duplicados incluye. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó la capacidad de ejecutar consultas por índice en la prueba de rendimiento. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) -- Se sugiere instalar un paquete con símbolos de depuración. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Refactorización de pruebas de rendimiento. Mejor registro y manejo de señales. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) -- Se agregaron documentos a Yandex anónimo.Conjuntos de datos Metrika. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) -- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Se agregaron documentos sobre dos conjuntos de datos en s3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) -- Se agregó un script que crea un registro de cambios a partir de la descripción de las solicitudes de extracción. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Se agregó un módulo de marionetas para Clickhouse. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- Se agregaron documentos para un grupo de funciones no documentadas. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([Invierno Zhang](https://github.com/zhang2014)) -- ARM correcciones de construcción. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([propulsor](https://github.com/proller)) ([propulsor](https://github.com/proller)) -- Las pruebas de diccionario ahora pueden ejecutarse desde `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([propulsor](https://github.com/proller)) -- Ahora `/etc/ssl` se utiliza como directorio predeterminado con certificados SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó la comprobación de las instrucciones SSE y AVX al inicio. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) -- La secuencia de comandos Init esperará el servidor hasta el inicio. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([propulsor](https://github.com/proller)) - -#### Cambios incompatibles hacia atrás {#backward-incompatible-changes-1} - -- Quitar `allow_experimental_low_cardinality_type` configuración. `LowCardinality` los tipos de datos están listos para la producción. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Reduzca el tamaño de la caché de marca y el tamaño de la caché sin comprimir según la cantidad de memoria disponible. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) -- Palabra clave añadida `INDEX` en `CREATE TABLE` consulta. Una columna con nombre `index` debe citarse con retrocesos o comillas dobles: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- `sumMap` ahora promueve el tipo de resultado en lugar de desbordamiento. Antiguo `sumMap` se puede obtener mediante el uso de `sumMapWithOverflow` función. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) - -#### Mejoras de rendimiento {#performance-improvements-4} - -- `std::sort` sustituido por `pdqsort` para consultas sin `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) -- Ahora el servidor reutiliza subprocesos del grupo de subprocesos global. Esto afecta el rendimiento en algunos casos de esquina. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora {#improvements-5} - -- Implementado soporte AIO para FreeBSD. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `SELECT * FROM a JOIN b USING a, b` ahora volver `a` y `b` solo de la tabla de la izquierda. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) -- Permitir `-C` opción del cliente para trabajar como `-c` opcion. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) -- Ahora opción `--password` utilizado sin valor requiere contraseña de stdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) -- Se agregó resaltado de metacaracteres no escapados en literales de cadena que contienen `LIKE` expresiones o regex. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó la cancelación de las consultas de solo lectura HTTP si el socket del cliente desaparece. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) -- Ahora los informes del servidor progresan para mantener vivas las conexiones del cliente. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([Ivan](https://github.com/abyss7)) -- Mensaje ligeramente mejor con motivo para OPTIMIZE consulta con `optimize_throw_if_noop` configuración activada. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó soporte de `--version` opción para el servidor de clickhouse. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) -- Añadir `--help/-h` opción para `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) -- Se agregó soporte para subconsultas escalares con el resultado del estado de la función agregada. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Mejora del tiempo de apagado del servidor y ALTERa el tiempo de espera. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se ha añadido información sobre la configuración de la línea de replicado\_can\_become\_leader en el sistema.réplicas y agregue registro si la réplica no intenta convertirse en líder. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Método de codificación de datos:](https://github.com/ztlpn)) - -## Lanzamiento de ClickHouse 19.1 {#clickhouse-release-19-1} - -### Lanzamiento de ClickHouse 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} - -- Error fijo `Column ... queried more than once` que puede suceder si la configuración `asterisk_left_columns_only` se establece en 1 en caso de usar `GLOBAL JOIN` con `SELECT *` (caso raro). El problema no existe en 19.3 y posteriores. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) - -### Lanzamiento de ClickHouse 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} - -Esta versión contiene exactamente el mismo conjunto de parches que 19.3.7. - -### Lanzamiento de ClickHouse 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} - -Esta versión contiene exactamente el mismo conjunto de parches que 19.3.6. - -## Lanzamiento de ClickHouse 19.1 {#clickhouse-release-19-1-1} - -### Lanzamiento de ClickHouse 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} - -#### Corrección de errores {#bug-fixes-18} - -- Se corrigió la incompatibilidad hacia atrás con versiones antiguas debido a una implementación incorrecta de `send_logs_level` configuración. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Incompatibilidad hacia atrás fija de la función de la tabla `remote` introducido con comentarios de columna. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} - -#### Corrección de errores {#bug-fixes-19} - -- Arregle el paquete de instalación con /etc/clickhouse-server/config que falta.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([propulsor](https://github.com/proller)) - -## Lanzamiento de ClickHouse 19.1 {#clickhouse-release-19-1-2} - -### Lanzamiento de ClickHouse 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} - -#### Corrección de errores {#bug-fixes-20} - -- Devuelva correctamente el tipo correcto y maneje adecuadamente las cerraduras en `joinGet` función. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos pájaro](https://github.com/amosbird)) -- Se corrigió el error cuando los registros del sistema se intentaban crear de nuevo al apagar el servidor. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Error corregido: si hay una base de datos con `Dictionary` motor, todos los diccionarios obligados a cargar en el inicio del servidor, y si hay un diccionario con fuente ClickHouse de localhost, el diccionario no se puede cargar. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se ha corregido un error cuando la ejecución de mutaciones que contienen `IN` Los operadores estaban produciendo resultados incorrectos. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Método de codificación de datos:](https://github.com/ztlpn)) -- `clickhouse-client` puede segfault al salir mientras carga datos para sugerencias de línea de comandos si se ejecutó en modo interactivo. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Condición de carrera fija al seleccionar entre `system.tables` puede dar `table doesn't exist` error. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el punto muerto cuando `SELECT` de una mesa con `File` el motor fue reintentado después `No such file or directory` error. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se ha solucionado un problema: los diccionarios locales de ClickHouse se cargan a través de TCP, pero deberían cargarse dentro del proceso. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijo `No message received` error al interactuar con PostgreSQL ODBC Driver a través de la conexión TLS. También corrige segfault cuando se utiliza MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Deshabilitar temporalmente la optimización de predicados para `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Invierno Zhang](https://github.com/zhang2014)) -- Bucle infinito fijo al seleccionar de la función de la tabla `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijo `compile_expressions` error con la comparación de fechas grandes (más que int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- Fallo de segmentación fijo con `uncompressed_cache=1` y excepción con un tamaño incorrecto sin comprimir. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- Fijo `ALL JOIN` con duplicados en la tabla derecha. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Corregido el comportamiento incorrecto al hacer `INSERT ... SELECT ... FROM file(...)` consulta y archivo `CSVWithNames` o `TSVWIthNames` formato y falta la primera fila de datos. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ejecución de funciones agregadas fijas con `Array(LowCardinality)` argumento. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Paquete de Debian: correcto /etc/clickhouse-server/preprocessed link según config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([propulsor](https://github.com/proller)) -- Prueba de fuzz fija bajo desinfectante de comportamiento indefinido: verificación de tipo de parámetro agregada para `quantile*Weighted` familia de funciones. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hacer `START REPLICATED SENDS` comando iniciar envíos replicados. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([Nombre de la red inalámbrica (SSID):](https://github.com/nvartolomei)) -- Fijo `Not found column` para columnas duplicadas en la sección JOIN ON. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Ahora `/etc/ssl` se utiliza como directorio predeterminado con certificados SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el fallo en la recarga del diccionario si el diccionario no está disponible. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([propulsor](https://github.com/proller)) -- Corregido error con incorrecto `Date` y `DateTime` comparación. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([Valexey](https://github.com/valexey)) -- Se corrigió el resultado incorrecto cuando `Date` y `DateTime` los argumentos se usan en ramas del operador condicional (función `if`). Añadido caso genérico para la función `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### Lanzamiento de ClickHouse 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} - -#### Novedad {#new-features-7} - -- Códecs de compresión personalizados por columna para tablas. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [Invierno Zhang](https://github.com/zhang2014), [Anatoly](https://github.com/Sindbag)) -- Añadido codec de compresión `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) -- Permitir a `ALTER` códecs de compresión. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) -- Funciones añadidas `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` para la compatibilidad estándar SQL. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) -- Soporte para escribir en `HDFS` mesas y `hdfs` función de la tabla. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) -- Funciones añadidas para buscar múltiples cadenas constantes de gran pajar: `multiPosition`, `multiSearch` ,`firstMatch` también con `-UTF8`, `-CaseInsensitive`, y `-CaseInsensitiveUTF8` variante. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Más información](https://github.com/danlark1)) -- Poda de fragmentos no utilizados si `SELECT` filtros de consulta por clave sharding (configuración `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [Ivan](https://github.com/abyss7)) -- Permitir `Kafka` para ignorar cierta cantidad de errores de análisis por bloque. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([Ivan](https://github.com/abyss7)) -- Añadido soporte para `CatBoost` evaluación de modelos multiclase. Función `modelEvaluate` devuelve tupla con predicciones sin procesar por clase para modelos multiclase. `libcatboostmodel.so` debe ser construido con [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Funciones añadidas `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) -- Funciones hash añadidas `xxHash64` y `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) -- Añadir `gccMurmurHash` función de hash (hash de Murmur con sabor a GCC) que usa la misma semilla de hash que [Gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([Sundyli](https://github.com/sundy-li)) -- Funciones hash añadidas `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) -- Función de tabla añadida `remoteSecure`. Funciona como `remote`, pero usa una conexión segura. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([propulsor](https://github.com/proller)) - -#### Experimental características {#experimental-features-3} - -- Se agregaron múltiples emulaciones JOINs (`allow_experimental_multiple_joins_emulation` configuración). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Corrección de errores {#bug-fixes-21} - -- Hacer `compiled_expression_cache_size` ajuste limitado por defecto para reducir el consumo de memoria. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) -- Se corrigió un error que provocaba bloqueos en los subprocesos que realizaban ALTERs de tablas replicadas y en el subproceso que actualizaba la configuración de ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Se corrigió una condición de carrera al ejecutar una tarea ALTER distribuida. La condición de carrera provocó que más de una réplica intentara ejecutar la tarea y todas las réplicas, excepto una que fallara con un error de ZooKeeper. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Corregir un error cuando `from_zk` Los elementos de configuración no se actualizaron después de que se agotó el tiempo de espera de una solicitud a ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Corregir un error con el prefijo incorrecto para las máscaras de subred IPv4. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) -- Se corrigió el fallo (`std::terminate`) en casos excepcionales cuando no se puede crear un nuevo subproceso debido a recursos agotados. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir error cuando está en `remote` ejecución de la función de tabla cuando se usaron restricciones incorrectas para `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) -- Corregir una fuga de enchufes netlink. Se colocaron en un grupo donde nunca se eliminaron y se crearon nuevos sockets al comienzo de un nuevo subproceso cuando todos los sockets actuales estaban en uso. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Corregir un error con el cierre `/proc/self/fd` directorio antes de todos los fds fueron leídos de `/proc` después de bifurcar `odbc-bridge` subproceso. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) -- Conversión monótona de cadena a UInt fija en caso de uso de cadena en clave primaria. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([Invierno Zhang](https://github.com/zhang2014)) -- Se corrigió el error en el cálculo de la monotonía de la función de conversión de enteros. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Segfault fijo en `arrayEnumerateUniq`, `arrayEnumerateDense` funciones en caso de algunos argumentos no válidos. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Reparar UB en StorageMerge. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos pájaro](https://github.com/amosbird)) -- Segfault fijo en funciones `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregido el error: funciones `round`, `floor`, `trunc`, `ceil` puede devolver un resultado falso cuando se ejecuta en un argumento entero y una gran escala negativa. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió un error inducido por ‘kill query sync’ lo que conduce a un volcado central. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) -- Corregir un error con un largo retraso después de la cola de replicación vacía. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) -- Se corrigió el uso excesivo de memoria en caso de insertar en la tabla con `LowCardinality` clave primaria. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fijo `LowCardinality` serialización para `Native` formato en caso de matrices vacías. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Se corrigió el resultado incorrecto al usar distinta por una sola columna numérica LowCardinality. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Se corrigió la agregación especializada con la clave LowCardinality (en caso de `compile` está habilitada la configuración). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Corregir el reenvío de usuarios y contraseñas para consultas de tablas replicadas. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) -- Se corrigió una condición de carrera muy rara que puede ocurrir al enumerar tablas en la base de datos de diccionarios mientras recargaba diccionarios. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el resultado incorrecto cuando se usaba HAVING con ROLLUP o CUBE. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Más información](https://github.com/reflection)) -- Se corrigieron alias de columna para consultas con `JOIN ON` sintaxis y tablas distribuidas. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([Invierno Zhang](https://github.com/zhang2014)) -- Se corrigió un error en la implementación interna de `quantileTDigest` (encontrado por Artem Vakhrushev). Este error nunca ocurre en ClickHouse y fue relevante solo para aquellos que usan la base de código ClickHouse como una biblioteca directamente. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora {#improvements-6} - -- Soporte para `IF NOT EXISTS` en `ALTER TABLE ADD COLUMN` declaraciones junto con `IF EXISTS` en `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) -- Función `parseDateTimeBestEffort`: soporte para formatos `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` y similares. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CapnProtoInputStream` ahora soportan estructuras dentadas. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) -- Mejora de la usabilidad: se agregó una verificación de que el proceso del servidor se inicia desde el propietario del directorio de datos. No permita iniciar el servidor desde la raíz si los datos pertenecen a un usuario no root. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([Más información](https://github.com/sergey-v-galtsev)) -- Mejor lógica de verificación de columnas requeridas durante el análisis de consultas con JOINs. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) -- Disminución del número de conexiones en caso de un gran número de tablas distribuidas en un único servidor. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([Invierno Zhang](https://github.com/zhang2014)) -- Fila de totales admitidos para `WITH TOTALS` consulta para el controlador ODBC. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) -- Permitido utilizar `Enum`s como enteros dentro de la función if. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([Ivan](https://github.com/abyss7)) -- Añadir `low_cardinality_allow_in_native_format` configuración. Si está desactivado, no utilice `LowCadrinality` escriba en `Native` formato. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Se eliminaron algunos objetos redundantes de la caché de expresiones compiladas para reducir el uso de memoria. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) -- Añadir comprobar que `SET send_logs_level = 'value'` consulta acepta el valor apropiado. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) -- Verificación de tipo de datos fijos en las funciones de conversión de tipo. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([Invierno Zhang](https://github.com/zhang2014)) - -#### Mejoras de rendimiento {#performance-improvements-5} - -- Agregar una configuración MergeTree `use_minimalistic_part_header_in_zookeeper`. Si está habilitada, las tablas replicadas almacenarán metadatos de piezas compactas en un único znode de piezas. Esto puede reducir drásticamente el tamaño de la instantánea ZooKeeper (especialmente si las tablas tienen muchas columnas). Tenga en cuenta que después de habilitar esta configuración, no podrá degradar a una versión que no la admita. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Agregar una implementación basada en DFA para funciones `sequenceMatch` y `sequenceCount` en caso de que el patrón no contenga tiempo. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Mejora del rendimiento para la serialización de números enteros. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos pájaro](https://github.com/amosbird)) -- Cero a la izquierda relleno PODArray de modo que -1 elemento es siempre válido y puesto a cero. Se utiliza para el cálculo sin ramas de compensaciones. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos pájaro](https://github.com/amosbird)) -- Revertir `jemalloc` versión que conducen a la degradación del rendimiento. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Cambios incompatibles hacia atrás {#backward-incompatible-changes-2} - -- Se eliminó la función no documentada `ALTER MODIFY PRIMARY KEY` porque fue reemplazado por el `ALTER MODIFY ORDER BY` comando. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Método de codificación de datos:](https://github.com/ztlpn)) -- Función eliminada `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Prohibir el uso de subconsultas escalares con el resultado del tipo `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([Ivan](https://github.com/abyss7)) - -#### Mejoras de compilación / prueba / empaquetado {#buildtestingpackaging-improvements-6} - -- Añadido soporte para PowerPC (`ppc64le`) construir. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Más información](https://github.com/danlark1)) -- Las pruebas funcionales con estado se ejecutan en el conjunto de datos público disponible. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el error cuando el servidor no puede comenzar con el `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` mensaje dentro de Docker o systemd-nspawn. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualizar `rdkafka` Biblioteca a v1.0.0-RC5. Usado cppkafka en lugar de la interfaz C sin procesar. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([Ivan](https://github.com/abyss7)) -- Actualizar `mariadb-client` biblioteca. Se corrigió uno de los problemas encontrados por UBSan. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Algunas correcciones para compilaciones de UBSan. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregaron ejecuciones de pruebas por compromiso con la compilación de UBSan. -- Se agregaron ejecuciones por compromiso del analizador estático PVS-Studio. -- Corregidos errores encontrados por PVS-Studio. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigieron problemas de compatibilidad con glibc. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mueva las imágenes de Docker a 18.10 y agregue el archivo de compatibilidad para glibc\> = 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) -- Agregue la variable env si el usuario no desea chown directorios en la imagen Docker del servidor. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) -- Habilitado la mayoría de las advertencias de `-Weverything` en clang. Permitir `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregaron algunas advertencias más que están disponibles solo en clang 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Enlace a `libLLVM` en lugar de a las librerías LLVM individuales cuando se usan enlaces compartidos. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Películas De Sexo](https://github.com/orivej)) -- Se agregaron variables de desinfectante para imágenes de prueba. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) -- `clickhouse-server` paquete debian recomendará `libcap2-bin` paquete a utilizar `setcap` herramienta para el establecimiento de capacidades. Esto es opcional. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejora del tiempo de compilación, fijo incluye. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([propulsor](https://github.com/proller)) -- Se agregaron pruebas de rendimiento para funciones hash. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) -- Se corrigieron las dependencias de la biblioteca cíclica. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([propulsor](https://github.com/proller)) -- Compilación mejorada con poca memoria disponible. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([propulsor](https://github.com/proller)) -- Se agregó script de prueba para reproducir la degradación del rendimiento en `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigieron errores ortográficos en comentarios y literales de cadena bajo `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) -- Se corrigieron errores tipográficos en los comentarios. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) - -## [Nivel de Cifrado WEP](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/es/whats_new/changelog/index.md b/docs/es/whats_new/changelog/index.md deleted file mode 100644 index 053f924099a..00000000000 --- a/docs/es/whats_new/changelog/index.md +++ /dev/null @@ -1,668 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_folder_title: Changelog -toc_priority: 74 -toc_title: '2020' ---- - -## Lanzamiento de ClickHouse v20.3 {#clickhouse-release-v20-3} - -### Todos los derechos reservados. {#clickhouse-release-v20-3-4-10-2020-03-20} - -#### Corrección de errores {#bug-fix} - -- Esta versión también contiene todas las correcciones de errores de 20.1.8.41 -- Solución faltante `rows_before_limit_at_least` para consultas sobre http (con canalización de procesadores). Esto corrige [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### Todos los derechos reservados. {#clickhouse-release-v20-3-3-6-2020-03-17} - -#### Corrección de errores {#bug-fix-1} - -- Esta versión también contiene todas las correcciones de errores de 20.1.7.38 -- Corregir un error en una replicación que no permite que la replicación funcione si el usuario ha ejecutado mutaciones en la versión anterior. Esto corrige [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). Hace que la versión 20.3 sea compatible con versiones anteriores de nuevo. -- Añadir ajuste `use_compact_format_in_distributed_parts_names` que permite escribir archivos para `INSERT` consultas en `Distributed` mesa con un formato más compacto. Esto corrige [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). Hace que la versión 20.3 sea compatible con versiones anteriores de nuevo. - -### Todos los derechos reservados. {#clickhouse-release-v20-3-2-1-2020-03-12} - -#### Cambio incompatible hacia atrás {#backward-incompatible-change} - -- Se ha solucionado el problema `file name too long` al enviar datos para `Distributed` para un gran número de réplicas. Se corrigió el problema de que las credenciales de réplica se expusieran en el registro del servidor. El formato del nombre del directorio en el disco se cambió a `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) Después de actualizar a la nueva versión, no podrá degradar sin intervención manual, porque la versión anterior del servidor no reconoce el nuevo formato de directorio. Si desea degradar, debe cambiar el nombre manualmente de los directorios correspondientes al formato anterior. Este cambio sólo es relevante si ha utilizado `INSERT`s a `Distributed` tabla. En la versión 20.3.3 introduciremos una configuración que le permitirá habilitar el nuevo formato gradualmente. -- Se ha cambiado el formato de las entradas de registro de replicación para los comandos de mutación. Tienes que esperar a que las mutaciones antiguas se procesen antes de instalar la nueva versión. -- Implemente un generador de perfiles de memoria simple que vuelca stacktraces a `system.trace_log` cada N bytes sobre el límite de asignación suave [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([Ivan](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov)) La columna de `system.trace_log` fue renombrado desde `timer_type` a `trace_type`. Esto requerirá cambios en el análisis de rendimiento de terceros y herramientas de procesamiento de flamegraph. -- Use la identificación de subproceso del sistema operativo en todas partes en lugar del número de subproceso interno. Esto corrige [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Antiguo `clickhouse-client` no puede recibir registros que se envían desde el servidor cuando `send_logs_level` está habilitado, porque se han cambiado los nombres y tipos de los mensajes de registro estructurados. Por otro lado, diferentes versiones de servidor pueden enviar registros con diferentes tipos entre sí. Cuando usted no utiliza el `send_logs_level` ajuste, no debería importarle. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Quitar `indexHint` función [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Quitar `findClusterIndex`, `findClusterValue` función. Esto corrige [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). Si estaba utilizando estas funciones, envíe un correo electrónico a `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora no está permitido crear columnas o agregar columnas con `SELECT` subconsulta como expresión predeterminada. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) -- Requiere alias para subconsultas en JOIN. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) -- Mejorar `ALTER MODIFY/ADD` consultas lógica. Ahora no puedes `ADD` sin tipo, `MODIFY` expresión predeterminada no cambia el tipo de columna y `MODIFY` type no pierde el valor de expresión predeterminado. Fijar [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) -- Requiere que el servidor se reinicie para aplicar los cambios en la configuración de registro. Esta es una solución temporal para evitar el error en el que el servidor inicia sesión en un archivo de registro eliminado (consulte [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Configuración `experimental_use_processors` está habilitado de forma predeterminada. Esta configuración permite el uso de la nueva canalización de consultas. Esto es refactorización interna y no esperamos cambios visibles. Si ves algún problema, configúralo en cero. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Novedad {#new-feature} - -- Añadir `Avro` y `AvroConfluent` Formatos de entrada/salida [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrés Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrés Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualizaciones de subprocesos múltiples y sin bloqueo de claves caducadas en `cache` diccionarios (con permiso opcional para leer los antiguos). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Agregar consulta `ALTER ... MATERIALIZE TTL`. Ejecuta la mutación que obliga a eliminar los datos caducados por TTL y recalcula la metainformación sobre TTL en todas las partes. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) -- Cambie de HashJoin a MergeJoin (en el disco) si es necesario [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir `MOVE PARTITION` comando para `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Recarga de la configuración de almacenamiento desde el archivo de configuración sobre la marcha. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Permitido cambiar `storage_policy` a uno no menos rico. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Se agregó soporte para globs / wildcards para el almacenamiento S3 y la función de mesa. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Implementar `bitAnd`, `bitOr`, `bitXor`, `bitNot` para `FixedString(N)` Tipo de datos. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Función añadida `bitCount`. Esto corrige [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([kopylov](https://github.com/ikopylov)) -- Añadir `generateRandom` función de tabla para generar filas aleatorias con un esquema dado. Permite rellenar la tabla de prueba arbitraria con datos. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) -- `JSONEachRowFormat`: apoyar caso especial cuando los objetos encerrados en la matriz de nivel superior. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) -- Ahora es posible crear una columna con `DEFAULT` expresión que depende de una columna con el valor predeterminado `ALIAS` expresion. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) -- Permitir especificar `--limit` más que el tamaño de los datos de origen en `clickhouse-obfuscator`. Los datos se repetirán con diferentes semillas aleatorias. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `groupArraySample` función (similar a `groupArray`) con algoritmo de muestreo de reservorio. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos pájaro](https://github.com/amosbird)) -- Ahora puede controlar el tamaño de la cola de actualización en `cache`/`complex_key_cache` diccionarios a través de métricas del sistema. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Permitir usar CRLF como separador de línea en formato de salida CSV con configuración `output_format_csv_crlf_end_of_line` se establece en 1 [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) -- Implementar más funciones del [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` y `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) -- Nueva configuración introducida: `max_parser_depth` para controlar el tamaño máximo de la pila y permitir grandes consultas complejas. Esto corrige [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) y [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) -- Añadir una configuración `force_optimize_skip_unused_shards` configuración para lanzar si no es posible omitir fragmentos no utilizados [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) -- Permitir configurar varios discos / volúmenes para almacenar datos para enviar `Distributed` motor [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) -- Política de almacenamiento de soporte (``) para almacenar datos temporales. [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) -- Añadir `X-ClickHouse-Exception-Code` Encabezado HTTP que se establece si se lanzó una excepción antes de enviar datos. Esto implementa [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) -- Función añadida `ifNotFinite`. Es solo un azúcar sintáctico: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `last_successful_update_time` columna en `system.dictionaries` tabla [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Añadir `blockSerializedSize` función (tamaño en disco sin compresión) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) -- Añadir función `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([Hcz](https://github.com/hczhcz)) -- Tablas de sistema añadidas `system.zeros` y `system.zeros_mt` así como funciones de cuento `zeros()` y `zeros_mt()`. Las tablas (y funciones de tabla) contienen una sola columna con nombre `zero` y tipo `UInt8`. Esta columna contiene ceros. Es necesario para fines de prueba como el método más rápido para generar muchas filas. Esto corrige [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Característica Experimental {#experimental-feature} - -- Añadir nuevo formato compacto de piezas en `MergeTree`-family tablas en las que todas las columnas se almacenan en un archivo. Esto ayuda a aumentar el rendimiento de las inserciones pequeñas y frecuentes. El formato antiguo (un archivo por columna) ahora se llama ancho. El formato de almacenamiento de datos se controla mediante la configuración `min_bytes_for_wide_part` y `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) -- Soporte para almacenamiento S3 para `Log`, `TinyLog` y `StripeLog` tabla. [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) - -#### Corrección de errores {#bug-fix-2} - -- Se corrigieron espacios en blanco inconsistentes en los mensajes de registro. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir un error en el que las matrices de tuplas sin nombre se aplanaban como estructuras anidadas en la creación de la tabla. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) -- Se corrigió el problema cuando “Too many open files” puede ocurrir un error si hay demasiados archivos que coincidan con el patrón glob en `File` mesa o `file` función de la tabla. Ahora los archivos se abren perezosamente. Esto corrige [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- DROP TEMPORARY TABLE ahora solo deja caer la tabla temporal. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) -- Elimine la partición obsoleta cuando apagamos el servidor o DETACH / ATTACH una tabla. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Para saber cómo el disco predeterminado calcula el espacio libre de `data` subdirectorio. Se ha solucionado el problema cuando la cantidad de espacio libre no se calcula correctamente si el `data` el directorio está montado en un dispositivo separado (caso raro). Esto corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) -- Permitir coma (cruz) unirse con IN () dentro. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) -- Permita reescribir CROSS a INNER JOIN si hay un operador \[NOT\] LIKE en la sección WHERE. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) -- Corregir posible resultado incorrecto después `GROUP BY` con configuración habilitada `distributed_aggregation_memory_efficient`. Fijar [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Las claves encontradas se contaron como perdidas en las métricas de los diccionarios de caché. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Corregir la incompatibilidad del protocolo de replicación introducida en [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -- Condición de carrera fija en `queue_task_handle` en el inicio de `ReplicatedMergeTree` tabla. [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Token `NOT` no funcionó en `SHOW TABLES NOT LIKE` consulta [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Comprobación de rango añadida para funcionar `h3EdgeLengthM`. Sin esta comprobación, el desbordamiento del búfer es posible. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió un error en los cálculos por lotes de OP lógicos ternarios en múltiples argumentos (más de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alejandro Kazakov](https://github.com/Akazz)) -- Corregir el error de optimización PREWHERE, que podría conducir a fallas según segfaults o `Inconsistent number of columns got from MergeTreeRangeReader` salvedad. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) -- Arreglar inesperado `Timeout exceeded while reading from socket` excepción, que ocurre aleatoriamente en la conexión segura antes de que se exceda el tiempo de espera y cuando se habilita el generador de perfiles de consultas. También añadir `connect_timeout_with_failover_secure_ms` configuración (por defecto 100 ms), que es similar a `connect_timeout_with_failover_ms`, pero se usa para conexiones seguras (porque el protocolo de enlace SSL es más lento que la conexión TCP ordinaria) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([Tavplubix](https://github.com/tavplubix)) -- Corregir error con finalización de mutaciones, cuando la mutación puede colgarse en estado con `parts_to_do=0` y `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) -- Use la nueva lógica ANY JOIN con `partial_merge_join` configuración. Es posible hacer `ANY|ALL|SEMI LEFT` y `ALL INNER` se une con `partial_merge_join=1` ahora. [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) -- Shard ahora sujeta la configuración obtenida del iniciador a los restos del fragmento en lugar de lanzar una excepción. Esta corrección permite enviar consultas a un fragmento con otras restricciones. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) -- Se corrigió el problema de administración de memoria en `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fijar `toDecimal*OrNull()` familia de funciones cuando se llama con cadena `e`. Fijar [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) -- Asegúrese de que `FORMAT Null` no envía datos al cliente. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Corregir error en la marca de tiempo `LiveViewBlockInputStream` no se actualizará. `LIVE VIEW` es una característica experimental. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) -- Fijo `ALTER MODIFY TTL` comportamiento incorrecto que no permitía eliminar expresiones TTL antiguas. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Informe UBSan fijo en MergeTreeIndexSet. Esto corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió el comportamiento de `match` y `extract` funciona cuando haystack tiene cero bytes. El comportamiento era incorrecto cuando el pajar era constante. Esto corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evite lanzar desde el destructor en la biblioteca Apache Avro de terceros. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrés Onyshchuk](https://github.com/oandrew)) -- No confirmar un lote encuestado desde `Kafka` parcialmente, ya que puede conducir a agujeros en los datos. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) -- Fijar `joinGet` con tipos de devolución anulables. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos pájaro](https://github.com/amosbird)) -- Corregir la incompatibilidad de datos cuando se comprime con `T64` códec. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Fijar identificadores de tipo de datos en `T64` códec de compresión que conduce a una compresión incorrecta (de) en las versiones afectadas. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir ajuste `enable_early_constant_folding` y desactivarlo en algunos casos que conduce a errores. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) -- Repare el optimizador de predicados pushdown con VIEW y habilite la prueba [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([Invierno Zhang](https://github.com/zhang2014)) -- Arreglar segfault en `Merge` tablas, que pueden suceder al leer de `File` almacenamiento [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([Tavplubix](https://github.com/tavplubix)) -- Se agregó una verificación de la política de almacenamiento en `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. De lo contrario, podría hacer que los datos de la parte sean inaccesibles después del reinicio y evitar que se inicie ClickHouse. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fix altera si hay TTL establecido para la tabla. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir la condición de carrera que puede ocurrir cuando `SYSTEM RELOAD ALL DICTIONARIES` se ejecuta mientras se modifica / agrega / elimina algún diccionario. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) -- En versiones anteriores `Memory` el motor de base de datos utiliza una ruta de datos vacía, por lo que las tablas se crean en `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([Tavplubix](https://github.com/tavplubix)) -- Se corrigieron los mensajes de registro incorrectos sobre la falta de disco o política predeterminada. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fix not(has()) para el índice bloom\_filter de los tipos de matriz. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([chimbab](https://github.com/achimbab)) -- Permitir las primeras columnas en una tabla con `Log` motor ser un alias [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([Ivan](https://github.com/abyss7)) -- Corregir el orden de los rangos mientras se lee desde `MergeTree` mesa en un hilo. Podría dar lugar a excepciones de `MergeTreeRangeReader` o resultados de consultas incorrectos. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) -- Hacer `reinterpretAsFixedString` devolver `FixedString` en lugar de `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrés Onyshchuk](https://github.com/oandrew)) -- Evite casos extremadamente raros cuando el usuario puede obtener un mensaje de error incorrecto (`Success` en lugar de una descripción detallada del error). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- No se bloquee al usar `Template` formato con plantilla de fila vacía. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Los archivos de metadatos para las tablas del sistema se pueden crear en un lugar incorrecto [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([Tavplubix](https://github.com/tavplubix)) Fijar [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). -- Corregir la carrera de datos en exception\_ptr en el diccionario de caché [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- No lanzar una excepción para la consulta `ATTACH TABLE IF NOT EXISTS`. Anteriormente se lanzaba si la tabla ya existe, a pesar de la `IF NOT EXISTS` clausula. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) -- Se corrigió la falta de cierre de paren en el mensaje de excepción. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evitar el mensaje `Possible deadlock avoided` en el inicio de clickhouse-client en modo interactivo. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se solucionó el problema cuando el relleno al final del valor codificado en base64 puede estar mal formado. Actualización de la biblioteca base64. Esto corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), cerca [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evitar la pérdida de datos en `Kafka` en casos raros cuando la excepción ocurre después de leer el sufijo pero antes de confirmar. Fijar [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) -- Excepción fija en `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) -- Corregir el bloqueo cuando un usuario intenta `ALTER MODIFY SETTING` para viejos `MergeTree` familia de motores de mesa. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -- Compatibilidad con números UInt64 que no caben en Int64 en funciones relacionadas con JSON. Actualizar SIMDJSON a maestro. Esto corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la ejecución de predicados invertidos cuando se usa un índice funcional no estrictamente monotínico. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alejandro Kazakov](https://github.com/Akazz)) -- No trate de doblar `IN` constante en `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos pájaro](https://github.com/amosbird)) -- Corregir error en `ALTER DELETE` mutaciones que conduce a la corrupción del índice. Esto corrige [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) y [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). Además arreglar condiciones de carrera extremadamente raras en `ReplicatedMergeTree` `ALTER` consulta. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) -- Cuando el ajuste `compile_expressions` está habilitado, puede obtener `unexpected column` en `LLVMExecutableFunction` cuando usamos `Nullable` tipo [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Múltiples correcciones para `Kafka` engine: 1) corrige los duplicados que aparecían durante el reequilibrio del grupo de consumidores. 2) Arreglar raro ‘holes’ apareció cuando los datos se sondearon de varias particiones con una encuesta y se confirmaron parcialmente (ahora siempre procesamos / confirmamos todo el bloque de mensajes sondeados). 3) Arregle los lavados por tamaño de bloque (antes de eso, solo el lavado por tiempo de espera funcionaba correctamente). 4) mejor procedimiento de suscripción (con retroalimentación de la asignación). 5) Haga que las pruebas funcionen más rápido (con intervalos y tiempos de espera predeterminados). Debido al hecho de que los datos no se enjuagaron por el tamaño del bloque antes (como debería según la documentación), ese PR puede conducir a una cierta degradación del rendimiento con la configuración predeterminada (debido a los sofocos más a menudo y más pequeños que son menos óptimos). Si encuentra el problema de rendimiento después de ese cambio, aumente `kafka_max_block_size` en la tabla al valor más grande (por ejemplo `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Fijar [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) -- Fijar `Parameter out of bound` excepción en algunas consultas después de las optimizaciones PREWHERE. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Fallecimiento](https://github.com/bgiard)) -- Se corrigió el caso de la constancia mixta de los argumentos de la función `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Al ejecutar `CREATE` consulta, doblar expresiones constantes en argumentos del motor de almacenamiento. Reemplace el nombre de la base de datos vacía con la base de datos actual. Fijar [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([Tavplubix](https://github.com/tavplubix)) -- Ahora no es posible crear o agregar columnas con alias cíclicos simples como `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -- Se ha corregido un error con doble movimiento que puede corromper parte original. Esto es relevante si usa `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Permitir `interval` identificador para analizar correctamente sin retrocesos. Solucionado el problema cuando una consulta no se puede ejecutar incluso si el `interval` identifier está encerrado en backticks o comillas dobles. Esto corrige [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Prueba de fuzz fija y comportamiento incorrecto de `bitTestAll`/`bitTestAny` función. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir un posible bloqueo / número incorrecto de filas en `LIMIT n WITH TIES` cuando hay muchas filas iguales a n'th row. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([Tavplubix](https://github.com/tavplubix)) -- Corregir mutaciones con partes escritas con habilitado `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) -- Corregir la carrera de datos en la destrucción de `Poco::HTTPServer`. Podría suceder cuando el servidor se inicia y se apaga inmediatamente. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir un error en el que se mostraba un mensaje de error engañoso cuando se ejecutaba `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) -- Fijo `Parameters are out of bound` excepción en algunos casos raros cuando tenemos una constante en el `SELECT` cláusula cuando tenemos una `ORDER BY` y una `LIMIT` clausula. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Fijar mutaciones finalización, cuando ya hecho mutación puede tener estado `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) -- Evitar la ejecución `ALTER ADD INDEX` para tablas MergeTree con sintaxis antigua, porque no funciona. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) -- Durante el inicio del servidor, no acceda a la tabla, que `LIVE VIEW` depende de, por lo que el servidor podrá comenzar. También eliminar `LIVE VIEW` dependencias al separar `LIVE VIEW`. `LIVE VIEW` es una característica experimental. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([Tavplubix](https://github.com/tavplubix)) -- Arreglar posible segfault en `MergeTreeRangeReader`, mientras se ejecuta `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir posibles sumas de comprobación no coincidentes con TTL de columna. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -- Se corrigió un error cuando las partes no se movían en segundo plano por las reglas TTL en caso de que solo haya un volumen. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Se ha solucionado el problema `Method createColumn() is not implemented for data type Set`. Esto corrige [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora intentaremos finalizar las mutaciones con más frecuencia. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -- Fijar `intDiv` por menos una constante [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([Hcz](https://github.com/hczhcz)) -- Corregir la posible condición de carrera en `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir un error que conduce a la terminación del servidor al intentar usar / soltar `Kafka` tabla creada con parámetros incorrectos. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) -- Solución alternativa agregada si el sistema operativo devuelve un resultado incorrecto para `timer_create` función. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregido el error en el uso de `min_marks_for_seek` parámetro. Se corrigió el mensaje de error cuando no hay una clave de fragmentación en la tabla distribuida e intentamos omitir fragmentos no utilizados. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) - -#### Mejora {#improvement} - -- Implementar `ALTER MODIFY/DROP` encima de mutaciones para `ReplicatedMergeTree*` familia de motores. Ahora `ALTERS` bloquea solo en la etapa de actualización de metadatos, y no bloquea después de eso. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) -- Agregue la capacidad de reescribir CROSS a INNER JOINs con `WHERE` sección que contiene nombres unqialified. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) -- Hacer `SHOW TABLES` y `SHOW DATABASES` las consultas apoyan el `WHERE` expresiones y `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([Sundyli](https://github.com/sundy-li)) -- Añadido un ajuste `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) -- Después de los cambios recientes, el cliente MySQL comenzó a imprimir cadenas binarias en hexadecimal, lo que las hizo no legibles ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). La solución en ClickHouse es marcar las columnas de cadena como UTF-8, lo que no siempre es, pero generalmente el caso. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) -- Agregue soporte de las claves String y FixedString para `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Fallecimiento](https://github.com/bgiard)) -- Teclas de cadena de soporte en los mapas SummingMergeTree [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Fallecimiento](https://github.com/bgiard)) -- Terminación de la señal del subproceso al grupo de subprocesos incluso si el subproceso ha lanzado una excepción [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Más información](https://github.com/dingxiangfei2009)) -- Permitir establecer `query_id` en `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) -- No permita expresiones extrañas en `ALTER TABLE ... PARTITION partition` consulta. Esto aborda [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tabla `system.table_engines` ahora proporciona información sobre el soporte de características (como `supports_ttl` o `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) -- Permitir `system.metric_log` predeterminada. Contendrá filas con valores de ProfileEvents, CurrentMetrics recopilados con “collect\_interval\_milliseconds” intervalo (un segundo por defecto). La tabla es muy pequeña (generalmente en orden de megabytes) y la recopilación de estos datos por defecto es razonable. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([Ivan](https://github.com/abyss7)) -- Ahora temporal `LIVE VIEW` es creado por `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` en lugar de `CREATE TEMPORARY LIVE VIEW ...`, porque la sintaxis anterior no era consistente con `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([Tavplubix](https://github.com/tavplubix)) -- Agregar text\_log.parámetro de configuración de nivel para limitar las entradas `system.text_log` tabla [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) -- Permitir colocar la parte descargada en discos / volúmenes de acuerdo con las reglas TTL [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Para diccionarios MySQL externos, permita mutualizar el grupo de conexiones MySQL para “share” entre los diccionarios. Esta opción reduce significativamente el número de conexiones a los servidores MySQL. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Mostrar el tiempo de ejecución de consultas más cercano para los cuantiles en `clickhouse-benchmark` salida en lugar de valores interpolados. Es mejor mostrar valores que correspondan al tiempo de ejecución de algunas consultas. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Posibilidad de agregar clave y marca de tiempo para el mensaje al insertar datos en Kafka. Fijar [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) -- Si el servidor se ejecuta desde el terminal, resalte el número de hilo, el id de consulta y la prioridad de registro por colores. Esto es para mejorar la legibilidad de los mensajes de registro correlacionados para los desarrolladores. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejor mensaje de excepción al cargar tablas para `Ordinary` base. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Implementar `arraySlice` para matrices con estados de función agregados. Esto corrige [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Permita que las funciones constantes y las matrices constantes se utilicen en el lado derecho del operador IN. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) -- Si la excepción del zookeeper ha ocurrido al obtener datos para el sistema.réplicas, mostrarlo en una columna separada. Esto implementa [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Elimine atómicamente las partes de datos de MergeTree en destroy. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Soporte de seguridad a nivel de fila para tablas distribuidas. [\#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([Ivan](https://github.com/abyss7)) -- Now we recognize suffix (like KB, KiB…) in settings values. [\#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) -- Evitar la falta de memoria mientras se construye el resultado de una gran UNIÓN. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) -- Se agregaron nombres de clústeres a sugerencias en modo interactivo en `clickhouse-client`. [\#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexey-milovidov](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) ([Ivan](https://github.com/abyss7)) -- Columna añadida `exception_code` en `system.query_log` tabla. [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) -- Servidor de compatibilidad MySQL habilitado en el puerto `9004` en el archivo de configuración del servidor predeterminado. Se corrigió el comando de generación de contraseñas en el ejemplo de configuración. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) -- Evite abortar al apagar si el sistema de archivos es de solo lectura. Esto corrige [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejor mensaje de excepción cuando se requiere longitud en la consulta HTTP POST. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `_path` y `_file` columnas virtuales para `HDFS` y `File` motores y `hdfs` y `file` funciones de la tabla [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) -- Corregir error `Cannot find column` mientras se inserta en `MATERIALIZED VIEW` en caso de que se agregara una nueva columna a la tabla interna de la vista. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corrige el progreso sobre el protocolo cliente-servidor nativo, al enviar el progreso después de la actualización final (como los registros). Esto puede ser relevante solo para algunas herramientas de terceros que usan protocolo nativo. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) -- Agregue una métrica del sistema que rastree el número de conexiones de cliente utilizando el protocolo MySQL ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) -- A partir de ahora, las respuestas HTTP tendrán `X-ClickHouse-Timezone` encabezado establecido en el mismo valor de zona horaria que `SELECT timezone()` informaría. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) - -#### Mejora del rendimiento {#performance-improvement} - -- Mejorar el rendimiento del índice de análisis con IN [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) -- Código más simple y eficiente en funciones lógicas + limpiezas de código. Un seguimiento de [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alejandro Kazakov](https://github.com/Akazz)) -- Mejora general del rendimiento (en el rango del 5%..200% para consultas afectadas) garantizando aliasing aún más estricto con las características de C ++ 20. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos pájaro](https://github.com/amosbird)) -- Aliasing más estricto para bucles internos de funciones de comparación. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Aliasing más estricto para bucles internos de funciones aritméticas. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Una implementación ~ 3 veces más rápida para ColumnVector::replicate() , a través de la cual se implementa ColumnConst::convertToFullColumn() . También será útil en pruebas al materializar constantes. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alejandro Kazakov](https://github.com/Akazz)) -- Otra mejora de rendimiento menor a `ColumnVector::replicate()` (esto acelera el `materialize` función y funciones de orden superior) una mejora aún más a [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alejandro Kazakov](https://github.com/Akazz)) -- Rendimiento mejorado de `stochasticLinearRegression` función de agregado. Este parche es aportado por Intel. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejorar el rendimiento de `reinterpretAsFixedString` función. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- No envíe bloques al cliente para `Null` formato en la tubería de procesadores. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alejandro Kuzmenkov](https://github.com/akuzm)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement} - -- El manejo de excepciones ahora funciona correctamente en el subsistema Windows para Linux. Consulte https://github.com/ClickHouse-Extras/libunwind/pull/3 Esto corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) -- Reemplazar `readline` con `replxx` para la edición de línea interactiva en `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([Ivan](https://github.com/abyss7)) -- Mejor tiempo de compilación y menos instancias de plantillas en FunctionsComparison. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Integración añadida con `clang-tidy` en CI. Ver también [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora vinculamos ClickHouse en CI usando `lld` incluso para `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) -- Permitir aleatorizar la programación de subprocesos e insertar fallas cuando `THREAD_FUZZER_*` se establecen variables de entorno. Esto ayuda a las pruebas. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Habilitar sockets seguros en pruebas sin estado [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([Tavplubix](https://github.com/tavplubix)) -- Hacer SPLIT\_SHARED\_LIBRARIES=OFF más robusto [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) -- Hacer “performance\_introspection\_and\_logging” prueba confiable al servidor aleatorio atascado. Esto puede suceder en el entorno de CI. Ver también [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Validar XML en la comprobación de estilo. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Condición de carrera fija en la prueba `00738_lock_for_inner_table`. Esta prueba se basó en el sueño. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eliminar pruebas de rendimiento de tipo `once`. Esto es necesario para ejecutar todas las pruebas de rendimiento en modo de comparación estadística (más confiable). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Prueba de rendimiento agregada para funciones aritméticas. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Prueba de rendimiento añadida para `sumMap` y `sumMapWithOverflow` funciones agregadas. Seguimiento de [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Asegúrese de estilo de ErrorCodes por comprobación de estilo. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregar script para el historial de pruebas. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) -- Añadir advertencia GCC `-Wsuggest-override` para localizar y arreglar todos los lugares donde `override` palabra clave debe ser utilizado. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) -- Ignore el símbolo débil en Mac OS X porque debe definirse [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Usuario eliminado](https://github.com/ghost)) -- Normalice el tiempo de ejecución de algunas consultas en las pruebas de rendimiento. Esto se hace en preparación para ejecutar todas las pruebas de rendimiento en modo de comparación. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Arregle algunas pruebas para admitir pytest con pruebas de consulta [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([Ivan](https://github.com/abyss7)) -- Habilite SSL en compilación con MSan, por lo que el servidor no fallará al iniciarse al ejecutar pruebas sin estado [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([Tavplubix](https://github.com/tavplubix)) -- Corregir la sustitución de la base de datos en los resultados de las pruebas [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) -- Crear correcciones para plataformas diversas [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([propulsor](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([propulsor](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([propulsor](https://github.com/proller)) -- Sección de discos agregada a la imagen de la ventana acoplable de prueba sin estado con cobertura [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) -- Deshágase de los archivos en el árbol de origen al compilar con GRPC [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos pájaro](https://github.com/amosbird)) -- Un tiempo de compilación ligeramente más rápido al eliminar SessionCleaner del contexto. Haga que el código de SessionCleaner sea más simple. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Comprobación actualizada de consultas colgadas en el script de prueba de clickhouse [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alejandro Kazakov](https://github.com/Akazz)) -- Se eliminaron algunos archivos inútiles del repositorio. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tipo cambiado de perftests matemáticos de `once` a `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Agregue una imagen acoplable que permite construir un informe HTML del navegador de código interactivo para nuestra base de código. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin)) Ver [Navegador de código Woboq](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) -- Suprima algunas fallas de prueba bajo MSan. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Aceleración “exception while insert” prueba. Esta prueba a menudo se agota en la compilación de depuración con cobertura. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualizar `libcxx` y `libcxxabi` dominar. En preparación para [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Reparar la prueba de flacky `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Limpie las banderas duplicadas del vinculador. Asegúrese de que el enlazador no busque un símbolo inesperado. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos pájaro](https://github.com/amosbird)) -- Añadir `clickhouse-odbc` conductor en imágenes de prueba. Esto permite probar la interacción de ClickHouse con ClickHouse a través de su propio controlador ODBC. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) -- Corregir varios errores en las pruebas unitarias. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) -- Permitir `-Wmissing-include-dirs` Advertencia de GCC para eliminar todas las incluidas no existentes, principalmente como resultado de errores de scripting de CMake [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) -- Describa las razones si el generador de perfiles de consultas no puede funcionar. Esto está destinado a [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualice OpenSSL al maestro ascendente. Se ha solucionado el problema cuando las conexiones TLS pueden fallar con el mensaje `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` y `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. El problema estaba presente en la versión 20.1. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualizar Dockerfile para el servidor [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) -- Correcciones menores en el script build-gcc-from-sources [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) -- Reemplazar `numbers` a `zeros` en perftests donde `number` no se utiliza la columna. Esto conducirá a resultados de pruebas más limpios. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Solucione el problema de desbordamiento de pila al usar initializer\_list en los constructores de columnas. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Usuario eliminado](https://github.com/ghost)) -- Actualizar librdkafka a v1.3.0. Habilitar incluido `rdkafka` y `gsasl` bibliotecas en Mac OS X. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrés Onyshchuk](https://github.com/oandrew)) -- corrección de compilación en GCC 9.2.0 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) - -## Lanzamiento de ClickHouse v20.1 {#clickhouse-release-v20-1} - -### Todos los derechos reservados. {#clickhouse-release-v20-1-8-41-2020-03-20} - -#### Corrección de errores {#bug-fix-3} - -- Arreglar posible permanente `Cannot schedule a task` error (debido a una excepción no controlada en `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). Esto corrige [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) -- Corregir el consumo excesivo de memoria en `ALTER` consultas (mutaciones). Esto corrige [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) y [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) -- Corregir un error en las citas inversas en diccionarios externos DDL. Esto corrige [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) - -### Todos los derechos reservados. {#clickhouse-release-v20-1-7-38-2020-03-18} - -#### Corrección de errores {#bug-fix-4} - -- Se corrigieron los nombres de funciones internas incorrectos para `sumKahan` y `sumWithOverflow`. Conduzco a una excepción mientras uso estas funciones en consultas remotas. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). Este problema estaba en todas las versiones de ClickHouse. -- Permitir `ALTER ON CLUSTER` de `Distributed` tablas con replicación interna. Esto corrige [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). Este problema estaba en todas las versiones de ClickHouse. -- Corregir posibles excepciones `Size of filter doesn't match size of column` y `Invalid number of rows in Chunk` en `MergeTreeRangeReader`. Podrían aparecer mientras se ejecuta `PREWHERE` en algunos casos. Fijar [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) -- Se solucionó el problema: la zona horaria no se conservaba si escribía una expresión aritmética simple como `time + 1` (en contraste con una expresión como `time + INTERVAL 1 SECOND`). Esto corrige [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). Este problema estaba en todas las versiones de ClickHouse. -- Ahora no es posible crear o agregar columnas con alias cíclicos simples como `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -- Se solucionó el problema cuando el relleno al final del valor codificado en base64 puede estar mal formado. Actualización de la biblioteca base64. Esto corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), cerca [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir la carrera de datos en la destrucción de `Poco::HTTPServer`. Podría suceder cuando el servidor se inicia y se apaga inmediatamente. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir un posible bloqueo / número incorrecto de filas en `LIMIT n WITH TIES` cuando hay muchas filas iguales a n'th row. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([Tavplubix](https://github.com/tavplubix)) -- Corregir posibles sumas de comprobación no coincidentes con TTL de columna. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -- Corregir el bloqueo cuando un usuario intenta `ALTER MODIFY SETTING` para viejos `MergeTree` familia de motores de mesa. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -- Ahora intentaremos finalizar las mutaciones con más frecuencia. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -- Corregir la incompatibilidad del protocolo de replicación introducida en [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -- Fix not(has()) para el índice bloom\_filter de los tipos de matriz. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([chimbab](https://github.com/achimbab)) -- Se corrigió el comportamiento de `match` y `extract` funciona cuando haystack tiene cero bytes. El comportamiento era incorrecto cuando el pajar era constante. Esto corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-1} - -- El manejo de excepciones ahora funciona correctamente en el subsistema Windows para Linux. Consulte https://github.com/ClickHouse-Extras/libunwind/pull/3 Esto corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) - -### Todos los derechos reservados. {#clickhouse-release-v20-1-6-30-2020-03-05} - -#### Corrección de errores {#bug-fix-5} - -- Corregir la incompatibilidad de datos cuando se comprime con `T64` códec. - [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) -- Corregir el orden de los rangos mientras se lee de la tabla MergeTree en un hilo. Fijar [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). - [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) -- Arreglar posible segfault en `MergeTreeRangeReader`, mientras se ejecuta `PREWHERE`. Fijar [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). - [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) -- Fijar `reinterpretAsFixedString` devolver `FixedString` en lugar de `String`. - [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) -- Fijar `joinGet` con tipos de devolución anulables. Fijar [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) - [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) -- Repare la prueba de fuzz y el comportamiento incorrecto de las funciones bitTestAll / bitTestAny. - [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Corrige el comportamiento de las funciones de coincidencia y extracción cuando haystack tiene cero bytes. El comportamiento era incorrecto cuando el pajar era constante. Fijar [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) - [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Se corrigió la ejecución de predicados invertidos cuando se usa un índice funcional no estrictamente monotínico. Fijar [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) - [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz))](https://github.com/Akazz) -- Permitir reescribir `CROSS` a `INNER JOIN` si hay `[NOT] LIKE` operador en `WHERE` apartado. Fijar [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) - [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) -- Permitir que las primeras columnas de una tabla con Log engine sean un alias. - [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) -- Permitir la combinación de coma con `IN()` dentro. Fijar [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). - [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) -- Mejorar `ALTER MODIFY/ADD` consultas lógica. Ahora no puedes `ADD` sin tipo, `MODIFY` expresión predeterminada no cambia el tipo de columna y `MODIFY` type no pierde el valor de expresión predeterminado. Fijar [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). - [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) -- Fijar la finalización de las mutaciones, cuando la mutación ya hecha puede tener el estado is\_done = 0. - [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) -- Apoyo “Processors” tubería para el sistema.números y sistema.numbers\_mt. Esto también corrige el error cuando `max_execution_time` no se respeta. - [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- Corregir el conteo incorrecto de `DictCacheKeysRequestedFound` métrica. - [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) -- Se agregó una verificación de la política de almacenamiento en `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` que de lo contrario podría hacer que los datos de la parte sean inaccesibles después del reinicio y evitar que se inicie ClickHouse. - [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) -- Informe UBSan fijo en `MergeTreeIndexSet`. Esto corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) - [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Corrige un posible registro de datos en BlockIO. - [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- Soporte para `UInt64` números que no caben en Int64 en funciones relacionadas con JSON. Actualizar `SIMDJSON` dominar. Esto corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) - [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Solucione el problema cuando la cantidad de espacio libre no se calcula correctamente si el directorio de datos está montado en un dispositivo separado. Para el disco predeterminado, calcule el espacio libre del subdirectorio de datos. Esto corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) - [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) -- Solucione el problema cuando las conexiones TLS pueden fallar con el mensaje `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Actualice OpenSSL al maestro ascendente. - [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Al ejecutar `CREATE` consulta, doblar expresiones constantes en argumentos del motor de almacenamiento. Reemplace el nombre de la base de datos vacía con la base de datos actual. Fijar [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). También corrija la comprobación de la dirección local en ClickHouseDictionarySource. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Arreglar segfault en `StorageMerge`, que puede suceder al leer de StorageFile. - [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) -- Evitar la pérdida de datos en `Kafka` en casos raros cuando la excepción ocurre después de leer el sufijo pero antes de confirmar. Fijar [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Relacionados: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -- Corregir un error que conduce a la terminación del servidor al intentar usar / soltar `Kafka` tabla creada con parámetros incorrectos. Fijar [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporar [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) - -#### Novedad {#new-feature-1} - -- Añadir `deduplicate_blocks_in_dependent_materialized_views` opción para controlar el comportamiento de las inserciones idempotentes en tablas con vistas materializadas. Esta nueva característica se agregó a la versión de corrección de errores mediante una solicitud especial de Altinity. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### Todos los derechos reservados. {#clickhouse-release-v20-1-2-4-2020-01-22} - -#### Cambio incompatible hacia atrás {#backward-incompatible-change-1} - -- Haga el ajuste `merge_tree_uniform_read_distribution` obsoleto. El servidor aún reconoce esta configuración, pero no tiene ningún efecto. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tipo de retorno cambiado de la función `greatCircleDistance` a `Float32` porque ahora el resultado del cálculo es `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora se espera que los parámetros de consulta estén representados en “escaped” formato. Por ejemplo, para pasar una cadena `ab` tienes que escribir `a\tb` o `a\b` y respectivamente, `a%5Ctb` o `a%5C%09b` en URL. Esto es necesario para agregar la posibilidad de pasar NULL como `\N`. Esto corrige [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Permitir `use_minimalistic_part_header_in_zookeeper` establecimiento de `ReplicatedMergeTree` predeterminada. Esto reducirá significativamente la cantidad de datos almacenados en ZooKeeper. Esta configuración es compatible desde la versión 19.1 y ya la usamos en producción en múltiples servicios sin problemas durante más de medio año. Deshabilite esta configuración si tiene la posibilidad de cambiar a versiones anteriores a 19.1. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Los índices de omisión de datos están listos para producción y están habilitados de forma predeterminada. Configuración `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` y `allow_experimental_multiple_joins_emulation` ahora están obsoletos y no hacen nada. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir nuevo `ANY JOIN` lógica para `StorageJoin` consistente con `JOIN` operación. Para actualizar sin cambios en el comportamiento, necesita agregar `SETTINGS any_join_distinct_right_table_keys = 1` a Engine Unir metadatos de tablas o volver a crear estas tablas después de la actualización. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) -- Requiere que el servidor se reinicie para aplicar los cambios en la configuración de registro. Esta es una solución temporal para evitar el error en el que el servidor inicia sesión en un archivo de registro eliminado (consulte [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alejandro Kuzmenkov](https://github.com/akuzm)) - -#### Novedad {#new-feature-2} - -- Se agregó información sobre las rutas de acceso de piezas a `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Añadir capacidad de ejecutar `SYSTEM RELOAD DICTIONARY` consulta en `ON CLUSTER` modo. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Añadir capacidad de ejecutar `CREATE DICTIONARY` consultas en `ON CLUSTER` modo. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) -- Ahora el perfil del usuario en `users.xml` puede heredar varios perfiles. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Añadir `system.stack_trace` tabla que permite ver los rastros de pila de todos los hilos del servidor. Esto es útil para los desarrolladores para examinar el estado del servidor. Esto corrige [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `DateTime64` tipo de datos con una precisión de subsegundo configurable. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) -- Agregar función de tabla `clusterAllReplicas` que permite consultar todos los nodos en el clúster. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([mujer madura](https://github.com/kiransunkari)) -- Agregar función agregada `categoricalInformationValue` que calcula el valor de información de una entidad discreta. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([Hcz](https://github.com/hczhcz)) -- Acelerar el análisis de archivos de datos en `CSV`, `TSV` y `JSONEachRow` formato haciéndolo en paralelo. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Añadir función `bankerRound` que realiza el redondeo del banquero. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([Hcz](https://github.com/hczhcz)) -- Soporta más idiomas en el diccionario incrustado para nombres de región: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejoras en la consistencia de `ANY JOIN` lógica. Ahora `t1 ANY LEFT JOIN t2` igual `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir ajuste `any_join_distinct_right_table_keys` que permite un comportamiento antiguo para `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir nuevo `SEMI` y `ANTI JOIN`. Antiguo `ANY INNER JOIN` comportamiento ahora disponible como `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir `Distributed` formato para `File` motor y `file` función de mesa que permite leer desde `.bin` archivos generados por inserciones asincrónicas en `Distributed` tabla. [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Agregar argumento de columna de reinicio opcional para `runningAccumulate` que permite restablecer los resultados de agregación para cada nuevo valor clave. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) -- Agregue la capacidad de usar ClickHouse como punto final Prometheus. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) -- Añadir sección `` en `config.xml` que restringe los hosts permitidos para motores de tabla remotos y funciones de tabla `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) -- Función añadida `greatCircleAngle` que calcula la distancia en una esfera en grados. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se ha cambiado el radio de la Tierra para que sea consistente con la biblioteca H3. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `JSONCompactEachRow` y `JSONCompactEachRowWithNamesAndTypes` Formatos de entrada y salida. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) -- Característica agregada para motores de tablas relacionados con archivos y funciones de tabla (`File`, `S3`, `URL`, `HDFS`) que permite leer y escribir `gzip` archivos basados en el parámetro del motor adicional o extensión de archivo. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) -- Se agregó el `randomASCII(length)` función, generando una cadena con un conjunto aleatorio de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caracteres imprimibles. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([Bayoneta](https://github.com/BayoNet)) -- Función añadida `JSONExtractArrayRaw` que devuelve una matriz en elementos de matriz json no analizados de `JSON` cadena. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) -- Añadir `arrayZip` función que permite combinar múltiples matrices de longitudes iguales en una matriz de tuplas. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([Invierno Zhang](https://github.com/zhang2014)) -- Agregue la capacidad de mover datos entre discos de acuerdo con la configuración `TTL`-expresiones para `*MergeTree` familia de motores de mesa. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Se agregó una nueva función de agregado `avgWeighted` que permite calcular el promedio ponderado. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) -- Ahora el análisis paralelo está habilitado de forma predeterminada para `TSV`, `TSKV`, `CSV` y `JSONEachRow` formato. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Añadir varias funciones geográficas de `H3` biblioteca: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` y `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) -- Añadido soporte para brotli (`br`) compresión en almacenes relacionados con archivos y funciones de tabla. Esto corrige [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Añadir `groupBit*` funciones para el `SimpleAggregationFunction` tipo. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Corrección de errores {#bug-fix-6} - -- Corregir el cambio de nombre de las tablas con `Distributed` motor. Soluciona el problema [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([Tavplubix](https://github.com/tavplubix)) -- Ahora diccionarios de apoyo `EXPRESSION` para atributos en cadena arbitraria en dialecto SQL no ClickHouse. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -- Arreglar roto `INSERT SELECT FROM mysql(...)` consulta. Esto corrige [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) y [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([Tavplubix](https://github.com/tavplubix)) -- Corregir error “Mismatch column sizes” al insertar el valor predeterminado `Tuple` de `JSONEachRow`. Esto corrige [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([Tavplubix](https://github.com/tavplubix)) -- Ahora se lanzará una excepción en caso de usar `WITH TIES` junto `LIMIT BY`. También agregue la capacidad de usar `TOP` con `LIMIT BY`. Esto corrige [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Repara la dependencia del superintendente de la nueva versión de glibc en `clickhouse-odbc-bridge` binario. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos pájaro](https://github.com/amosbird)) -- Corregir error en la función de verificación de `*MergeTree` familia de motores. Ahora no falla en caso de que tengamos la misma cantidad de filas en el último gránulo y la última marca (no final). [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) -- Fijar el inserto en `Enum*` columnas después `ALTER` consulta, cuando el tipo numérico subyacente es igual al tipo especificado en la tabla. Esto corrige [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) -- Negativo no constante permitido “size” argumento para la función `substring`. No fue permitido por error. Esto corrige [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir el error de análisis cuando se pasa un número incorrecto de argumentos a `(O|J)DBC` motor de mesa. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) -- Usar el nombre de comando del proceso de clickhouse en ejecución al enviar registros a syslog. En versiones anteriores, se usaba una cadena vacía en lugar del nombre del comando. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) -- Corregir la comprobación de hosts permitidos para `localhost`. Este PR corrige la solución proporcionada en [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- Arreglar accidente raro en `argMin` y `argMax` funciones para argumentos de cadena larga, cuando el resultado se usa en `runningAccumulate` función. Esto corrige [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinosaurio](https://github.com/769344359)) -- Repara el sobrecompromiso de memoria para tablas con `Buffer` motor. [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) -- Se corrigió un error potencial en las funciones que pueden tomar `NULL` como uno de los argumentos y devuelve no NULL. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejores cálculos de métricas en el grupo de subprocesos para procesos en segundo plano para `MergeTree` motores de mesa. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fijar la función `IN` dentro `WHERE` declaración cuando el filtro de tabla de nivel de fila está presente. Fijar [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([Ivan](https://github.com/abyss7)) -- Ahora se lanza una excepción si el valor integral no se analiza completamente para los valores de configuración. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) -- Solucionar la excepción cuando se utiliza la función de agregado en la consulta a la tabla distribuida con más de dos fragmentos locales. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- Ahora el filtro bloom puede manejar matrices de longitud cero y no realiza cálculos redundantes. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([chimbab](https://github.com/achimbab)) -- Se corrigió la comprobación de si se permite un host cliente al hacer coincidir el host cliente con `host_regexp` especificado en `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) -- Relax comprobación de columna ambigua que conduce a falsos positivos en múltiples `JOIN ON` apartado. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió un posible bloqueo del servidor (`std::terminate`) cuando el servidor no puede enviar o escribir datos en `JSON` o `XML` formato con valores de `String` (tipo de datos que requieren `UTF-8` validación) o al comprimir datos de resultados con el algoritmo Brotli o en algunos otros casos raros. Esto corrige [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir la condición de carrera en `StorageDistributedDirectoryMonitor` encontrado por CI. Esto corrige [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ahora el fondo se fusiona en `*MergeTree` familia de motores de mesa preservar el orden de volumen de políticas de almacenamiento con mayor precisión. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Ahora motor de mesa `Kafka` funciona correctamente con `Native` formato. Esto corrige [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -- Formatos fijos con encabezados (como `CSVWithNames`) que lanzaban una excepción sobre EOF para el motor de tabla `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -- Se corrigió un error con la creación de conjunto de subconsulta en la parte derecha de `IN` apartado. Esto corrige [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) y [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Solucionar un posible bloqueo al leer desde el almacenamiento `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Lectura fija de los archivos en `Parquet` formato que contiene columnas de tipo `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([Más información](https://github.com/maxulan)) -- Corregir error `Not found column` para consultas distribuidas con `PREWHERE` condición depende de la clave de muestreo si `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir error `Not found column` si se utiliza la consulta `PREWHERE` depende del alias de la tabla y el conjunto de resultados estaba vacío debido a la condición de la clave principal. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Tipo de retorno fijo para funciones `rand` y `randConstant` en caso de `Nullable` argumento. Ahora las funciones siempre regresan `UInt32` y nunca `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Inversión de predicado deshabilitada para `WITH FILL` expresion. Esto corrige [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([Invierno Zhang](https://github.com/zhang2014)) -- Corregido incorrecto `count()` resultado para `SummingMergeTree` cuando `FINAL` se utiliza la sección. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Corregir posible resultado incorrecto para funciones constantes de servidores remotos. Sucedió para consultas con funciones como `version()`, `uptime()`, sucesivamente. que devuelve diferentes valores constantes para diferentes servidores. Esto corrige [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir un error complicado en la optimización de predicados push-down que conduce a resultados incorrectos. Esto soluciona muchos problemas en la optimización de predicados push-down. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([Invierno Zhang](https://github.com/zhang2014)) -- Fix crash en `CREATE TABLE .. AS dictionary` consulta. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) -- Varias mejoras en la gramática ClickHouse `.g4` file. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) -- Corregir un error que conduce a bloqueos en `JOIN`s con mesas con motor `Join`. Esto corrige [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) -- Repara la recarga de diccionarios redundantes en `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) -- Limitar el número máximo de secuencias para leer desde `StorageFile` y `StorageHDFS`. Correcciones https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -- Corregir error en `ALTER ... MODIFY ... CODEC` consulta, cuando el usuario especifica tanto la expresión predeterminada como el códec. Fijar [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) -- Corregir error en la fusión de fondo de columnas con `SimpleAggregateFunction(LowCardinality)` tipo. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Tipo fijo comprobar en función `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) -- Ahora el servidor no se bloquea `LEFT` o `FULL JOIN` con y Unirse al motor y no soportado `join_use_nulls` configuración. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) -- Ahora `DROP DICTIONARY IF EXISTS db.dict` la consulta no arroja una excepción si `db` no existe. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corregir posibles bloqueos en las funciones de la tabla (`file`, `mysql`, `remote`) causado por el uso de la referencia a eliminado `IStorage` objeto. Corregir el análisis incorrecto de las columnas especificadas en la inserción en la función de la tabla. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([Tavplubix](https://github.com/tavplubix)) -- Asegúrese de que la red esté activa antes de comenzar `clickhouse-server`. Esto corrige [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) -- Corregir el manejo de los tiempos de espera para conexiones seguras, por lo que las consultas no se cuelgan indefenitamente. Esto corrige [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar `clickhouse-copier`contención despedida entre trabajadores concurrentes. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Más información](https://github.com/dingxiangfei2009)) -- Ahora las mutaciones no omiten las partes adjuntas, incluso si su versión de mutación fuera más grande que la versión de mutación actual. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -- Ignore copias redundantes de `*MergeTree` partes de datos después de pasar a otro disco y reiniciar el servidor. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fix crash en `FULL JOIN` con `LowCardinality` en `JOIN` clave. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) -- Prohibido usar el nombre de columna más de una vez en la consulta de inserción como `INSERT INTO tbl (x, y, x)`. Esto corrige [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) -- Se agregó respaldo para detectar el número de núcleos de CPU físicos para CPU desconocidas (usando el número de núcleos de CPU lógicos). Esto corrige [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar `There's no column` error para columnas materializadas y alias. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) -- Se corrigió el bloqueo de corte cuando `EXISTS` consulta se utilizó sin `TABLE` o `DICTIONARY` calificador. Como `EXISTS t`. Esto corrige [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). Este error se introdujo en la versión 19.17. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir error raro con error `"Sizes of columns doesn't match"` que podrían aparecer al usar `SimpleAggregateFunction` columna. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- Corregir error donde el usuario con vacío `allow_databases` obtuvo acceso a todas las bases de datos (y lo mismo para `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) -- Solucionar el bloqueo del cliente cuando el servidor ya está desconectado del cliente. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- Fijar `ORDER BY` comportamiento en caso de ordenar por prefijo de clave primaria y sufijo de clave no primaria. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) -- Compruebe si la columna calificada está presente en la tabla. Esto corrige [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) -- Comportamiento fijo con `ALTER MOVE` se ejecuta inmediatamente después de la fusión de acabado se mueve superparte de especificado. Fijar [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Solucionar un posible bloqueo del servidor mientras se usa `UNION` con diferente número de columnas. Fijar [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir el tamaño de la subcadena de resultados para la función `substr` con tamaño negativo. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ahora el servidor no ejecuta la mutación de parte en `MergeTree` si no hay suficientes hilos libres en el grupo de fondo. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([Tavplubix](https://github.com/tavplubix)) -- Corregir un error tipográfico menor en el formato `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([Litao91](https://github.com/litao91)) -- Se corrigieron los resultados incorrectos del filtro de floración para los números negativos. Esto corrige [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([Invierno Zhang](https://github.com/zhang2014)) -- Desbordamiento de búfer potencial fijo en descomprimir. El usuario malicioso puede pasar datos comprimidos fabricados que causarán lectura después del búfer. Este problema fue encontrado por Eldar Zaitov del equipo de seguridad de la información de Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir el resultado incorrecto debido al desbordamiento de enteros en `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ahora `OPTIMIZE TABLE` La consulta no esperará a que las réplicas sin conexión realicen la operación. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) -- Fijo `ALTER TTL` analizador para `Replicated*MergeTree` tabla. [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Corrige la comunicación entre el servidor y el cliente, por lo que el servidor lee la información de las tablas temporales después de un error de consulta. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- Fijar `bitmapAnd` error de función al intersecar un mapa de bits agregado y un mapa de bits escalar. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -- Refinar la definición de `ZXid` de acuerdo con la Guía del Programador ZooKeeper que corrige errores en `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Más información](https://github.com/dingxiangfei2009)) -- `odbc` la función de la tabla ahora respeta `external_table_functions_use_nulls` configuración. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) -- Se corrigió un error que conducía a una rara carrera de datos. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alejandro Kazakov](https://github.com/Akazz)) -- Ahora `SYSTEM RELOAD DICTIONARY` recarga un diccionario completamente, ignorando `update_field`. Esto corrige [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Agregue la capacidad de verificar si el diccionario existe en la consulta de creación. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) -- Fijar `Float*` análisis en `Values` formato. Esto corrige [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([Tavplubix](https://github.com/tavplubix)) -- Solucionar el bloqueo cuando no podemos reservar espacio en algunas operaciones en segundo plano de `*MergeTree` familia de motores de mesa. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Corregir el bloqueo de la operación de fusión cuando la tabla contiene `SimpleAggregateFunction(LowCardinality)` columna. Esto corrige [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) -- Restaure el soporte de todas las configuraciones regionales de la UCI y agregue la capacidad de aplicar intercalaciones para expresiones constantes. También agregue el nombre del idioma a `system.collations` tabla. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -- Corregir un error cuando los diccionarios externos con una vida útil mínima cero (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) no actualizar en segundo plano. [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) -- Solucionar el bloqueo cuando el diccionario externo con la fuente ClickHouse tiene una subconsulta en la consulta. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corregir el análisis incorrecto de la extensión de archivo en la tabla con el motor `URL`. Esto corrige [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) -- Fijar `CHECK TABLE` consulta para `*MergeTree` mesas sin llave. Fijar [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -- Conversión fija de `Float64` al tipo de MySQL. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) -- Ahora, si la tabla no se eliminó por completo debido a un bloqueo del servidor, el servidor intentará restaurarla y cargarla. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([Tavplubix](https://github.com/tavplubix)) -- Se corrigió el fallo en la función de la tabla `file` mientras se inserta en el archivo que no existe. Ahora, en este caso, se crearía un archivo y luego se procesaría la inserción. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- Repara un punto muerto raro que puede ocurrir cuando `trace_log` está habilitado. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- Añadir capacidad de trabajar con diferentes tipos además `Date` en `RangeHashed` diccionario externo creado a partir de consulta DDL. Fijar [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -- Corrige el bloqueo cuando `now64()` se llama con el resultado de otra función. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) -- Se corrigió un error con la detección de IP del cliente para las conexiones a través del protocolo de cable mysql. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) -- Repara el manejo de matrices vacías en `arraySplit` función. Esto corrige [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([Hcz](https://github.com/hczhcz)) -- Se corrigió el problema cuando `pid-file` de otra carrera `clickhouse-server` puede ser eliminado. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) -- Repara la recarga del diccionario si tiene `invalidate_query`, que detuvo las actualizaciones y alguna excepción en los intentos de actualización anteriores. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) -- Corregido el error en la función `arrayReduce` que puede conducir a “double free” y error en el combinador de funciones agregadas `Resample` que puede conducir a la pérdida de memoria. Función agregada agregada `aggThrow`. Esta función se puede utilizar para fines de prueba. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora {#improvement-1} - -- Registro mejorado cuando se trabaja con `S3` motor de mesa. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- Mensaje de ayuda impreso cuando no se pasan argumentos al llamar `clickhouse-local`. Esto corrige [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) -- Añadir ajuste `mutations_sync` que permite esperar `ALTER UPDATE/DELETE` consultas sincrónicamente. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) -- Permitir configurar relativo `user_files_path` en `config.xml` (en la forma similar a `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([Hcz](https://github.com/hczhcz)) -- Agregue una excepción para tipos ilegales para funciones de conversión con `-OrZero` postfix. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) -- Simplifique el formato del encabezado de los datos que se envían a un fragmento en una consulta distribuida. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) -- `Live View` refactorización del motor de mesa. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) -- Agregue comprobaciones adicionales para diccionarios externos creados a partir de consultas DDL. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) -- Corregir error `Column ... already exists` mientras usa `FINAL` y `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Fijar [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ahora tabla el primer argumento de `joinGet` la función puede ser indentificador de tabla. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos pájaro](https://github.com/amosbird)) -- Permitir usar `MaterializedView` con subconsultas anteriores `Kafka` tabla. [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) -- Ahora el fondo se mueve entre discos, ejecuta el grupo de subprocesos seprate. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) -- `SYSTEM RELOAD DICTIONARY` ahora se ejecuta sincrónicamente. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) -- Los rastros de pila ahora muestran direcciones físicas (desconectados en el archivo de objeto) en lugar de direcciones de memoria virtual (donde se cargó el archivo de objeto). Eso permite el uso de `addr2line` cuando binary es independiente de la posición y ASLR está activo. Esto corrige [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soporte nueva sintaxis para filtros de seguridad de nivel de fila: `
`. Fijar [\#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [\#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([Ivan](https://github.com/abyss7)) -- Ahora `cityHash` función puede trabajar con `Decimal` y `UUID` tipo. Fijar [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) -- Se eliminó la granularidad de índice fijo (era 1024) de los registros del sistema porque está obsoleto después de la implementación de la granularidad adaptativa. [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Habilitado servidor de compatibilidad MySQL cuando ClickHouse se compila sin SSL. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) -- Ahora las sumas de comprobación del servidor distribuyen lotes, lo que da más errores detallados en caso de datos dañados en el lote. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) -- Apoyo `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` y `ATTACH TABLE` para `MySQL` motor de base de datos. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([Invierno Zhang](https://github.com/zhang2014)) -- Agregue autenticación en la función de tabla S3 y el motor de tabla. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Añadido cheque para piezas adicionales de `MergeTree` en diferentes discos, para no permitir perder partes de datos en discos indefinidos. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Habilite el soporte SSL para el cliente y el servidor de Mac. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([Ivan](https://github.com/abyss7)) -- Ahora ClickHouse puede funcionar como servidor federado de MySQL (consulte https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html ). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- `clickhouse-client` ahora sólo habilitar `bracketed-paste` cuando multiquery está encendido y multilínea está apagado. Esto corrige (\#7757)\[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos pájaro](https://github.com/amosbird)) -- Apoyo `Array(Decimal)` en `if` función. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) -- Decimales de apoyo en `arrayDifference`, `arrayCumSum` y `arrayCumSumNegative` función. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) -- Añadir `lifetime` columna a `system.dictionaries` tabla. [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) -- Comprobación mejorada de piezas existentes en diferentes discos para `*MergeTree` motores de mesa. Dirección [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Integración con `AWS SDK` para `S3` interacciones que permite utilizar todas las características de S3 fuera de la caja. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) -- Se agregó soporte para subconsultas en `Live View` tabla. [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) -- Compruebe si el uso `Date` o `DateTime` columna de `TTL` expresiones se eliminó. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Se agregó información sobre el disco a `system.detached_parts` tabla. [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Ahora configuración `max_(table|partition)_size_to_drop` se puede cambiar sin reiniciar. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- Ligeramente mejor usabilidad de los mensajes de error. Pida al usuario que no elimine las siguientes líneas `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejor lectura de mensajes de `Kafka` motor en varios formatos después de [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([Ivan](https://github.com/abyss7)) -- Mejor compatibilidad con clientes MySQL que no admiten `sha2_password` complemento auth. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) -- Soporta más tipos de columnas en el servidor de compatibilidad MySQL. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) -- Implementar `ORDER BY` optimización para `Merge`, `Buffer` y `Materilized View` almacenamientos con subyacente `MergeTree` tabla. [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) -- Ahora siempre usamos la implementación POSIX de `getrandom` para tener una mejor compatibilidad con los núcleos antiguos (\<3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos pájaro](https://github.com/amosbird)) -- Es mejor comprobar si hay un destino válido en una regla TTL de movimiento. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Mejores controles de lotes de inserción rotos para `Distributed` motor de mesa. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) -- Agregue una columna con una matriz de nombres de partes para qué mutaciones deben procesar en el futuro `system.mutations` tabla. [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) -- Optimización de ordenación de combinación paralela para procesadores. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Configuración `mark_cache_min_lifetime` ahora está obsoleto y no hace nada. En versiones anteriores, la caché de marcas puede crecer en la memoria más grande que `mark_cache_size` para acomodar datos dentro de `mark_cache_min_lifetime` segundo. Eso provocó confusión y un mayor uso de memoria de lo esperado, lo que es especialmente malo en los sistemas con restricciones de memoria. Si observa una degradación del rendimiento después de instalar esta versión, debe aumentar la `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Preparación para usar `tid` doquier. Esto es necesario para [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Mejora del rendimiento {#performance-improvement-1} - -- Optimizaciones de rendimiento en la canalización de procesadores. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Actualizaciones sin bloqueo de claves caducadas en diccionarios de caché (con permiso para leer las antiguas). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Compilar ClickHouse sin `-fno-omit-frame-pointer` a nivel mundial para ahorrar un registro más. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos pájaro](https://github.com/amosbird)) -- Aceleración `greatCircleDistance` función y añadir pruebas de rendimiento para ello. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) -- Rendimiento mejorado de la función `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Rendimiento mejorado de `max`, `min`, `argMin`, `argMax` para `DateTime64` tipo de datos. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) -- Rendimiento mejorado de la clasificación sin límite o con límite grande y clasificación externa. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Rendimiento mejorado de formatear números de coma flotante hasta 6 veces. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Rendimiento mejorado de `modulo` función. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos pájaro](https://github.com/amosbird)) -- Optimizar `ORDER BY` y fusionándose con la clave de una sola columna. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mejor implementación para `arrayReduce`, `-Array` y `-State` combinadores. [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos pájaro](https://github.com/amosbird)) -- Ahora `PREWHERE` debe ser optimizado para ser al menos tan eficiente como `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos pájaro](https://github.com/amosbird)) -- Mejorar el camino `round` y `roundBankers` manejo de números negativos. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([Hcz](https://github.com/hczhcz)) -- Rendimiento de decodificación mejorado de `DoubleDelta` y `Gorilla` códecs en aproximadamente un 30-40%. Esto corrige [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) -- Rendimiento mejorado de `base64` funciones relacionadas. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se agregó una función `geoDistance`. Es similar a `greatCircleDistance` pero utiliza la aproximación al modelo elipsoide WGS-84. El rendimiento de ambas funciones son casi iguales. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Más rápido `min` y `max` funciones de agregación para `Decimal` tipo de datos. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) -- Vectorizar el procesamiento `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos pájaro](https://github.com/amosbird)) -- `if` las cadenas ahora están optimizadas como `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) -- Corregir la regresión de rendimiento de `Kafka` motor de mesa introducido en 19.15. Esto corrige [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) -- Quitar “pie” generación de código que `gcc` de paquetes Debian trae ocasionalmente por defecto. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Formatos de datos de análisis paralelo [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Habilitar analizador optimizado de `Values` con expresiones por defecto (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([Tavplubix](https://github.com/tavplubix)) - -#### Mejora de la construcción/prueba/empaquetado {#buildtestingpackaging-improvement-2} - -- Construir correcciones para `ARM` y en modo mínimo. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([propulsor](https://github.com/proller)) -- Añadir archivo de cobertura al ras para `clickhouse-server` cuando std::atexit no se llama. También mejoró ligeramente el registro en pruebas sin estado con cobertura. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) -- Actualizar la biblioteca LLVM en contrib. Evite usar LLVM de paquetes de sistema operativo. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hacer incluido `curl` construir completamente tranquilo. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) -- Arreglar algunos `MemorySanitizer` las advertencias. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Utilizar `add_warning` y `no_warning` macros en `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([Ivan](https://github.com/abyss7)) -- Agregue soporte del objeto Compatible Minio S3 (https://min.io/) para mejores pruebas de integración. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) -- Importar `libc` encabezados a contrib. Permite hacer que las compilaciones sean más consistentes en varios sistemas (solo para `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Quitar `-fPIC` de algunas bibliotecas. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Limpiar `CMakeLists.txt` para el rizo. Ver https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Advertencias silenciosas en `CapNProto` biblioteca. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Agregue pruebas de rendimiento para tablas hash optimizadas de cadenas cortas. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos pájaro](https://github.com/amosbird)) -- Ahora ClickHouse se basará en `AArch64` aunque `MADV_FREE` no está disponible. Esto corrige [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos pájaro](https://github.com/amosbird)) -- Actualizar `zlib-ng` para solucionar problemas de desinfectante de memoria. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Habilite la biblioteca MySQL interna en sistemas que no son Linux, porque el uso de paquetes de sistemas operativos es muy frágil y generalmente no funciona en absoluto. Esto corrige [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se corrigió la compilación en algunos sistemas después de habilitar `libc++`. Esto reemplaza [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hacer `Field` métodos más seguros para encontrar más errores. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Añadido archivos que faltan a la `libc-headers` submódulo. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Arreglar mal `JSON` cita en la salida de prueba de rendimiento. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ahora se muestra el seguimiento de pila para `std::exception` y `Poco::Exception`. En versiones anteriores sólo estaba disponible para `DB::Exception`. Esto mejora el diagnóstico. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Portabilidad `clock_gettime` y `clock_nanosleep` para versiones glibc frescas. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos pájaro](https://github.com/amosbird)) -- Permitir `part_log` en ejemplo config para desarrolladores. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Corregir la naturaleza asíncrona de la recarga en `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) -- Se corrigieron las pruebas de rendimiento del códec. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) -- Agregar scripts de instalación para `.tgz` y documentación para ellos. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) -- Eliminado viejo `ZSTD` prueba (fue creado en el año 2016 para reproducir el error que ha tenido la versión pre 1.0 de ZSTD). Esto corrige [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Estructura fija en Mac OS Catalina. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) -- Mayor número de filas en las pruebas de rendimiento del códec para que los resultados se noten. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) -- En compilaciones de depuración, trate `LOGICAL_ERROR` excepciones como fallas de aserción, por lo que son más fáciles de notar. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Haga que la prueba de rendimiento relacionada con los formatos sea más determinista. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualizar `lz4` para solucionar un error de MemorySanitizer. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Suprima un falso positivo MemorySanitizer conocido en el control de excepciones. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Actualizar `gcc` y `g++` a la versión 9 en `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) -- Agregue un caso de prueba de rendimiento para probar eso `PREWHERE` es peor que `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos pájaro](https://github.com/amosbird)) -- Progreso hacia la fijación de una prueba flacky. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Evite el informe MemorySanitizer para los datos de `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Actualizar `libc++` a la última versión. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Construir la biblioteca de la UCI a partir de fuentes. Esto corrige [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cambiado de `libressl` a `openssl`. ClickHouse debe admitir TLS 1.3 y SNI después de este cambio. Esto corrige [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Informe UBSan fijo al usar `chacha20_poly1305` de SSL (sucede al conectarse a https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Modo de reparación del archivo de contraseña predeterminado para `.deb` distribuciones de linux. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([propulsor](https://github.com/proller)) -- Expresión mejorada para obtener `clickhouse-server` PID en `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alejandro Kazakov](https://github.com/Akazz)) -- Actualizado contrib / googletest a v1.10.0. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alejandro Burmak](https://github.com/Alex-Burmak)) -- Informe de ThreadSaninitizer fijo en `base64` biblioteca. También actualizó esta biblioteca a la última versión, pero no importa. Esto corrige [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fijar `00600_replace_running_query` para procesadores. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Eliminar soporte para `tcmalloc` hacer `CMakeLists.txt` más simple. [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Lanzamiento gcc construye ahora uso `libc++` en lugar de `libstdc++`. Recientemente `libc++` fue utilizado sólo con clang. Esto mejorará la coherencia de las configuraciones de compilación y la portabilidad. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Habilite la biblioteca de ICU para compilar con MemorySanitizer. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Suprimir advertencias de `CapNProto` biblioteca. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Se eliminaron casos especiales de código para `tcmalloc`, porque ya no es compatible. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- En la tarea de cobertura de CI, elimine el servidor con elegancia para permitirle guardar el informe de cobertura. Esto corrige los informes de cobertura incompletos que hemos estado viendo últimamente. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) -- Pruebas de rendimiento para todos los códecs contra `Float64` y `UInt64` valor. [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) -- `termcap` está muy en desuso y conduce a varios problemas (por ejemplo, falta “up” tapa y eco `^J` en lugar de la línea multi). Favor `terminfo` o empaquetado `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos pájaro](https://github.com/amosbird)) -- Fijar `test_storage_s3` prueba de integración. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Apoyo `StorageFile(, null)` para insertar el bloque en el archivo de formato dado sin realmente escribir en el disco. Esto es necesario para las pruebas de rendimiento. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos pájaro](https://github.com/amosbird)) -- Argumento añadido `--print-time` a las pruebas funcionales que imprime el tiempo de ejecución por prueba. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Se agregaron afirmaciones a `KeyCondition` mientras evalúa RPN. Esto arreglará la advertencia de gcc-9. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Opciones de volcado cmake en compilaciones de CI. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- No genere información de depuración para algunas bibliotecas de grasa. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hacer `log_to_console.xml` siempre inicie sesión en stderr, independientemente de si es interactivo o no. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alejandro Kuzmenkov](https://github.com/akuzm)) -- Se eliminaron algunas características no utilizadas de `clickhouse-performance-test` herramienta. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ahora también buscaremos `lld-X` con la correspondiente `clang-X` versión. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) -- Parquet construir mejora. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([Más información](https://github.com/maxulan)) -- Más advertencias de GCC [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([Método de codificación de datos:](https://github.com/kreuzerkrieg)) -- Paquete para Arch Linux ahora permite ejecutar el servidor ClickHouse, y no sólo el cliente. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Prueba de reparación con procesadores. Pequeñas correcciones de rendimiento. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Actualizar contrib/protobuf. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) -- En preparación para cambiar a c ++ 20 como una celebración de año nuevo. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos pájaro](https://github.com/amosbird)) - -#### Característica Experimental {#experimental-feature-1} - -- Añadido ajuste experimental `min_bytes_to_use_mmap_io`. Permite leer archivos grandes sin copiar datos del kernel al espacio de usuario. La configuración está deshabilitada de forma predeterminada. El umbral recomendado es de aproximadamente 64 MB, porque mmap / munmap es lento. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cuotas reanudadas como parte del sistema de control de acceso. Añadido nueva tabla `system.quotas`, nuevas funciones `currentQuota`, `currentQuotaKey`, nueva sintaxis SQL `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) -- Permitir omitir configuraciones desconocidas con advertencias en lugar de lanzar excepciones. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) -- Se reanudaron las políticas de fila como parte del sistema de control de acceso. Añadido nueva tabla `system.row_policies`, nueva función `currentRowPolicies()`, nueva sintaxis SQL `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Corrección de seguridad {#security-fix} - -- Se corrigió la posibilidad de leer la estructura de directorios en tablas con `File` motor de mesa. Esto corrige [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## [Registro de cambios para 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/es/whats_new/roadmap.md b/docs/es/whats_new/roadmap.md deleted file mode 100644 index e0a027fc3b7..00000000000 --- a/docs/es/whats_new/roadmap.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 74 -toc_title: Hoja de ruta ---- - -# Hoja de ruta {#roadmap} - -## Q1 2020 {#q1-2020} - -- Control de acceso basado en roles - -## Q2 2020 {#q2-2020} - -- Integración con servicios de autenticación externos -- Grupos de recursos para una distribución más precisa de la capacidad del clúster entre los usuarios - -{## [Artículo Original](https://clickhouse.tech/docs/en/roadmap/) ##} diff --git a/docs/es/whats_new/security_changelog.md b/docs/es/whats_new/security_changelog.md deleted file mode 100644 index 6a830efc3b6..00000000000 --- a/docs/es/whats_new/security_changelog.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: 3e185d24c9fe772c7cf03d5475247fb829a21dfa -toc_priority: 76 -toc_title: Seguridad Changelog ---- - -## Corregido en la versión de ClickHouse 19.14.3.3, 2019-09-10 {#fixed-in-clickhouse-release-19-14-3-3-2019-09-10} - -### CVE-2019-15024 {#cve-2019-15024} - -Аn attacker that has write access to ZooKeeper and who ican run a custom server available from the network where ClickHouse runs, can create a custom-built malicious server that will act as a ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from the malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. - -Créditos: Eldar Zaitov del equipo de seguridad de la información de Yandex - -### CVE-2019-16535 {#cve-2019-16535} - -Аn OOB read, OOB write and integer underflow in decompression algorithms can be used to achieve RCE or DoS via native protocol. - -Créditos: Eldar Zaitov del equipo de seguridad de la información de Yandex - -### CVE-2019-16536 {#cve-2019-16536} - -Un cliente autenticado malintencionado puede desencadenar el desbordamiento de pila que conduce a DoS. - -Créditos: Eldar Zaitov del equipo de seguridad de la información de Yandex - -## Corregido en la versión de ClickHouse 19.13.6.1, 2019-09-20 {#fixed-in-clickhouse-release-19-13-6-1-2019-09-20} - -### CVE-2019-18657 {#cve-2019-18657} - -Función de la tabla `url` la vulnerabilidad permitió al atacante inyectar encabezados HTTP arbitrarios en la solicitud. - -Crédito: [Nikita Tikhomirov](https://github.com/NSTikhomirov) - -## Corregido en la versión de ClickHouse 18.12.13, 2018-09-10 {#fixed-in-clickhouse-release-18-12-13-2018-09-10} - -### CVE-2018-14672 {#cve-2018-14672} - -Las funciones para cargar modelos CatBoost permitieron el recorrido de ruta y la lectura de archivos arbitrarios a través de mensajes de error. - -Créditos: Andrey Krasichkov del equipo de seguridad de la información de Yandex - -## Corregido en la versión de ClickHouse 18.10.3, 2018-08-13 {#fixed-in-clickhouse-release-18-10-3-2018-08-13} - -### CVE-2018-14671 {#cve-2018-14671} - -unixODBC permitía cargar objetos compartidos arbitrarios desde el sistema de archivos, lo que provocó una vulnerabilidad de ejecución remota de código. - -Créditos: Andrey Krasichkov y Evgeny Sidorov del equipo de seguridad de la información de Yandex - -## Corregido en la versión de ClickHouse 1.1.54388, 2018-06-28 {#fixed-in-clickhouse-release-1-1-54388-2018-06-28} - -### CVE-2018-14668 {#cve-2018-14668} - -“remote” función de tabla permitió símbolos arbitrarios en “user”, “password” y “default\_database” campos que llevaron a ataques de falsificación de solicitudes de protocolo cruzado. - -Créditos: Andrey Krasichkov del equipo de seguridad de la información de Yandex - -## Corregido en la versión de ClickHouse 1.1.54390, 2018-07-06 {#fixed-in-clickhouse-release-1-1-54390-2018-07-06} - -### CVE-2018-14669 {#cve-2018-14669} - -ClickHouse cliente MySQL tenía “LOAD DATA LOCAL INFILE” funcionalidad habilitada que permitió a una base de datos MySQL maliciosa leer archivos arbitrarios desde el servidor ClickHouse conectado. - -Créditos: Andrey Krasichkov y Evgeny Sidorov del equipo de seguridad de la información de Yandex - -## Corregido en la versión de ClickHouse 1.1.54131, 2017-01-10 {#fixed-in-clickhouse-release-1-1-54131-2017-01-10} - -### CVE-2018-14670 {#cve-2018-14670} - -Una configuración incorrecta en el paquete deb podría conducir al uso no autorizado de la base de datos. - -Créditos: Centro Nacional de Seguridad Cibernética del Reino Unido (NCSC) - -{## [Artículo Original](https://clickhouse.tech/docs/en/security_changelog/) ##} diff --git a/docs/fa/commercial/cloud.md b/docs/fa/commercial/cloud.md index 511d07f4583..571b496e808 100644 --- a/docs/fa/commercial/cloud.md +++ b/docs/fa/commercial/cloud.md @@ -12,7 +12,7 @@ machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 [سرویس مدیریت یاندکس برای کلیک](https://cloud.yandex.com/services/managed-clickhouse?utm_source=referrals&utm_medium=clickhouseofficialsite&utm_campaign=link3) ویژگی های کلیدی زیر را فراهم می کند: -- خدمات باغ وحش به طور کامل مدیریت برای [تکرار کلیک](../engines/table_engines/mergetree_family/replication.md) +- خدمات باغ وحش به طور کامل مدیریت برای [تکرار کلیک](../engines/table-engines/mergetree-family/replication.md) - های متعدد ذخیره سازی انتخاب نوع - کپی در مناطق مختلف در دسترس بودن - رمزگذاری و جداسازی diff --git a/docs/fa/development/architecture.md b/docs/fa/development/architecture.md index 2a05095c400..abe79ff5647 100644 --- a/docs/fa/development/architecture.md +++ b/docs/fa/development/architecture.md @@ -121,9 +121,9 @@ A `Block` یک ظرف است که نشان دهنده یک زیر مجموعه توابع عادی و توابع کل وجود دارد. برای توابع کل, بخش بعدی را ببینید. -Ordinary functions don't change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`'ثانیه از داده ها برای پیاده سازی اجرای پرس و جو بردار. +Ordinary functions don’t change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`’ثانیه از داده ها برای پیاده سازی اجرای پرس و جو بردار. -برخی از توابع متفرقه مانند وجود دارد [blockSize](../sql_reference/functions/other_functions.md#function-blocksize), [رفع موانع](../sql_reference/functions/other_functions.md#function-rownumberinblock) و [خرابی اجرا](../sql_reference/functions/other_functions.md#function-runningaccumulate), که بهره برداری از پردازش بلوک و نقض استقلال ردیف. +برخی از توابع متفرقه مانند وجود دارد [blockSize](../sql-reference/functions/other-functions.md#function-blocksize), [رفع موانع](../sql-reference/functions/other-functions.md#function-rownumberinblock) و [خرابی اجرا](../sql-reference/functions/other-functions.md#function-runningaccumulate), که بهره برداری از پردازش بلوک و نقض استقلال ردیف. تاتر تایپ قوی, بنابراین هیچ تبدیل نوع ضمنی وجود دارد. اگر یک تابع یک ترکیب خاص از انواع پشتیبانی نمی کند, این می اندازد یک استثنا. اما توابع می توانند کار کنند (غیرمنتظره) برای بسیاری از ترکیبات مختلف از انواع. برای مثال `plus` تابع (برای پیاده سازی `+` اپراتور) برای هر ترکیبی از انواع عددی کار می کند: `UInt8` + `Float32`, `UInt16` + `Int8` و به همین ترتیب. همچنین, برخی از توابع مختلف می توانید هر تعداد از استدلال قبول, مانند `concat` تابع. @@ -178,7 +178,7 @@ Ordinary functions don't change the number of rows – they work as if they are هنگامی که شما `INSERT` یک دسته از داده ها به `MergeTree`, که دسته مرتب شده بر اساس کلید اصلی سفارش و به شکل یک بخش جدید. موضوعات پس زمینه وجود دارد که به صورت دوره ای برخی از قطعات را انتخاب می کنند و به یک بخش مرتب شده اند تا تعداد قطعات نسبتا کم باشد. به همین دلیل است که نامیده می شود `MergeTree`. البته ادغام منجر به “write amplification”. تمام قطعات تغییر ناپذیر هستند: تنها ایجاد و حذف, اما اصلاح نشده. هنگامی که انتخاب اجرا شده است, دارای یک تصویر لحظهای از جدول (مجموعه ای از قطعات). پس از ادغام, ما همچنین قطعات قدیمی برای برخی از زمان به بهبود پس از شکست ساده تر نگه, بنابراین اگر ما می بینیم که برخی از بخش ادغام شده است که احتمالا شکسته, ما می توانیم با قطعات منبع خود را جایگزین. -`MergeTree` یک درخت ل اس ام نیست زیرا حاوی نیست “memtable” و “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity's sake, and because we are already inserting data in batches in our applications. +`MergeTree` یک درخت ل اس ام نیست زیرا حاوی نیست “memtable” و “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity’s sake, and because we are already inserting data in batches in our applications. > جداول ادغام تنها می توانید یک دارند (اولیه) شاخص: هیچ شاخص ثانویه وجود ندارد. این امر می تواند خوب اجازه می دهد تا بازنمایی فیزیکی متعدد تحت یک جدول منطقی, مثلا, برای ذخیره داده ها در بیش از یک نظم فیزیکی و یا حتی اجازه می دهد تا بازنمایی با داده های از پیش جمع همراه با داده های اصلی. diff --git a/docs/fa/development/browse_code.md b/docs/fa/development/browse-code.md similarity index 100% rename from docs/fa/development/browse_code.md rename to docs/fa/development/browse-code.md diff --git a/docs/fa/development/build_cross_arm.md b/docs/fa/development/build-cross-arm.md similarity index 100% rename from docs/fa/development/build_cross_arm.md rename to docs/fa/development/build-cross-arm.md diff --git a/docs/fa/development/build-cross-osx.md b/docs/fa/development/build-cross-osx.md new file mode 100644 index 00000000000..6353576dc4a --- /dev/null +++ b/docs/fa/development/build-cross-osx.md @@ -0,0 +1,67 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 66 +toc_title: "\u0686\u06AF\u0648\u0646\u0647 \u0628\u0631\u0627\u06CC \u0633\u0627\u062E\ + \u062A \u062A\u0627\u062A\u0631 \u062F\u0631 \u0644\u06CC\u0646\u0648\u06A9\u0633\ + \ \u0628\u0631\u0627\u06CC \u0633\u06CC\u0633\u062A\u0645 \u0639\u0627\u0645\u0644\ + \ \u0645\u06A9 \u0627\u06CC\u06A9\u0633" +--- + +# چگونه برای ساخت تاتر در لینوکس برای سیستم عامل مک ایکس {#how-to-build-clickhouse-on-linux-for-mac-os-x} + +این برای مواردی است که شما دستگاه لینوکس دارید و می خواهید از این برای ساخت استفاده کنید `clickhouse` این است که برای چک ادغام مداوم است که بر روی سرور های لینوکس اجرا در نظر گرفته شده. اگر شما می خواهید برای ساخت خانه کلیک به طور مستقیم در سیستم عامل مک ایکس, سپس با ادامه [دستورالعمل دیگر](build-osx.md). + +کراس ساخت برای سیستم عامل مک ایکس بر اساس [ساخت دستورالعمل](build.md) اول دنبالشون کن + +# نصب کلانگ-8 {#install-clang-8} + +دستورالعمل از دنبال https://apt.llvm.org / برای اوبونتو یا دبیان راه اندازی خود را. +به عنوان مثال دستورات برای بیونیک مانند: + +``` bash +sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list +sudo apt-get install clang-8 +``` + +# نصب مجموعه ابزار صلیب کشی {#install-cross-compilation-toolset} + +بیایید مسیری را که ما نصب می کنیم به یاد داشته باشیم `cctools` به عنوان ${CCTOOLS} + +``` bash +mkdir ${CCTOOLS} + +git clone https://github.com/tpoechtrager/apple-libtapi.git +cd apple-libtapi +INSTALLPREFIX=${CCTOOLS} ./build.sh +./install.sh +cd .. + +git clone https://github.com/tpoechtrager/cctools-port.git +cd cctools-port/cctools +./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin +make install +``` + +همچنین, ما نیاز به دانلود ماکو ایکس انحراف معیار به درخت کار. + +``` bash +cd ClickHouse +wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' +mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 +tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 +``` + +# ساخت خانه کلیک {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-osx +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ + -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ + -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ + -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld +ninja -C build-osx +``` + +باینری حاصل یک فرمت اجرایی ماخ ای داشته باشد و نمی تواند در لینوکس اجرا شود. diff --git a/docs/fa/development/build_osx.md b/docs/fa/development/build-osx.md similarity index 100% rename from docs/fa/development/build_osx.md rename to docs/fa/development/build-osx.md diff --git a/docs/fa/development/build_cross_osx.md b/docs/fa/development/build_cross_osx.md deleted file mode 100644 index dd3a1fcc21a..00000000000 --- a/docs/fa/development/build_cross_osx.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 66 -toc_title: "\u0686\u06AF\u0648\u0646\u0647 \u0628\u0631\u0627\u06CC \u0633\u0627\u062E\ - \u062A \u062A\u0627\u062A\u0631 \u062F\u0631 \u0644\u06CC\u0646\u0648\u06A9\u0633\ - \ \u0628\u0631\u0627\u06CC \u0633\u06CC\u0633\u062A\u0645 \u0639\u0627\u0645\u0644\ - \ \u0645\u06A9 \u0627\u06CC\u06A9\u0633" ---- - -# چگونه برای ساخت تاتر در لینوکس برای سیستم عامل مک ایکس {#how-to-build-clickhouse-on-linux-for-mac-os-x} - -این برای مواردی است که شما دستگاه لینوکس دارید و می خواهید از این برای ساخت استفاده کنید `clickhouse` این است که برای چک ادغام مداوم است که بر روی سرور های لینوکس اجرا در نظر گرفته شده. اگر شما می خواهید برای ساخت خانه کلیک به طور مستقیم در سیستم عامل مک ایکس, سپس با ادامه [دستورالعمل دیگر](build_osx.md). - -کراس ساخت برای سیستم عامل مک ایکس بر اساس [ساخت دستورالعمل](build.md) اول دنبالشون کن - -# نصب کلانگ-8 {#install-clang-8} - -دستورالعمل از دنبال https://apt.llvm.org / برای اوبونتو یا دبیان راه اندازی خود را. -به عنوان مثال دستورات برای بیونیک مانند: - -``` bash -sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list -sudo apt-get install clang-8 -``` - -# نصب مجموعه ابزار صلیب کشی {#install-cross-compilation-toolset} - -بیایید مسیری را که ما نصب می کنیم به یاد داشته باشیم `cctools` به عنوان ${CCTOOLS} - -``` bash -mkdir ${CCTOOLS} - -git clone https://github.com/tpoechtrager/apple-libtapi.git -cd apple-libtapi -INSTALLPREFIX=${CCTOOLS} ./build.sh -./install.sh -cd .. - -git clone https://github.com/tpoechtrager/cctools-port.git -cd cctools-port/cctools -./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin -make install -``` - -همچنین, ما نیاز به دانلود ماکو ایکس انحراف معیار به درخت کار. - -``` bash -cd ClickHouse -wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' -mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 -tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 -``` - -# ساخت خانه کلیک {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-osx -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ - -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ - -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ - -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -ninja -C build-osx -``` - -باینری حاصل یک فرمت اجرایی ماخ ای داشته باشد و نمی تواند در لینوکس اجرا شود. diff --git a/docs/fa/development/developer_instruction.md b/docs/fa/development/developer-instruction.md similarity index 100% rename from docs/fa/development/developer_instruction.md rename to docs/fa/development/developer-instruction.md diff --git a/docs/fa/engines/database-engines/index.md b/docs/fa/engines/database-engines/index.md new file mode 100644 index 00000000000..d4c1c0b56d3 --- /dev/null +++ b/docs/fa/engines/database-engines/index.md @@ -0,0 +1,21 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Database Engines +toc_priority: 27 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# موتورهای پایگاه داده {#database-engines} + +موتورهای پایگاه داده به شما اجازه کار با جداول. + +به طور پیش فرض, تاتر با استفاده از موتور پایگاه داده مادری خود, فراهم می کند که تنظیم [موتورهای جدول](../../engines/table-engines/index.md) و یک [شمارهگیری](../../sql-reference/syntax.md). + +شما همچنین می توانید موتورهای پایگاه داده زیر استفاده کنید: + +- [MySQL](mysql.md) + +- [تنبل](lazy.md) + +[مقاله اصلی](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/fa/engines/database_engines/lazy.md b/docs/fa/engines/database-engines/lazy.md similarity index 100% rename from docs/fa/engines/database_engines/lazy.md rename to docs/fa/engines/database-engines/lazy.md diff --git a/docs/fa/engines/database-engines/mysql.md b/docs/fa/engines/database-engines/mysql.md new file mode 100644 index 00000000000..7813257d423 --- /dev/null +++ b/docs/fa/engines/database-engines/mysql.md @@ -0,0 +1,135 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 30 +toc_title: MySQL +--- + +# Mysql {#mysql} + +اجازه می دهد تا برای اتصال به پایگاه داده بر روی یک سرور خروجی از راه دور و انجام `INSERT` و `SELECT` نمایش داده شد به تبادل اطلاعات بین کلیک و خروجی زیر. + +این `MySQL` موتور پایگاه داده ترجمه نمایش داده شد به سرور خروجی زیر بنابراین شما می توانید عملیات مانند انجام `SHOW TABLES` یا `SHOW CREATE TABLE`. + +شما می توانید نمایش داده شد زیر را انجام دهد: + +- `RENAME` +- `CREATE TABLE` +- `ALTER` + +## ایجاد یک پایگاه داده {#creating-a-database} + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] +ENGINE = MySQL('host:port', 'database', 'user', 'password') +``` + +**پارامترهای موتور** + +- `host:port` — MySQL server address. +- `database` — Remote database name. +- `user` — MySQL user. +- `password` — User password. + +## پشتیبانی از انواع داده ها {#data_types-support} + +| MySQL | فاحشه خانه | +|----------------------------------|------------------------------------------------------------| +| UNSIGNED TINYINT | [UInt8](../../sql-reference/data-types/int-uint.md) | +| TINYINT | [Int8](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED SMALLINT | [UInt16](../../sql-reference/data-types/int-uint.md) | +| SMALLINT | [Int16](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql-reference/data-types/int-uint.md) | +| INT, MEDIUMINT | [Int32](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED BIGINT | [UInt64](../../sql-reference/data-types/int-uint.md) | +| BIGINT | [Int64](../../sql-reference/data-types/int-uint.md) | +| FLOAT | [Float32](../../sql-reference/data-types/float.md) | +| DOUBLE | [جسم شناور64](../../sql-reference/data-types/float.md) | +| DATE | [تاریخ](../../sql-reference/data-types/date.md) | +| DATETIME, TIMESTAMP | [DateTime](../../sql-reference/data-types/datetime.md) | +| BINARY | [رشته ثابت](../../sql-reference/data-types/fixedstring.md) | + +همه انواع داده خروجی زیر دیگر به تبدیل [رشته](../../sql-reference/data-types/string.md). + +[Nullable](../../sql-reference/data-types/nullable.md) پشتیبانی می شود. + +## نمونه هایی از استفاده {#examples-of-use} + +جدول در خروجی زیر: + +``` text +mysql> USE test; +Database changed + +mysql> CREATE TABLE `mysql_table` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `float` FLOAT NOT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from mysql_table; ++------+-----+ +| int_id | value | ++------+-----+ +| 1 | 2 | ++------+-----+ +1 row in set (0,00 sec) +``` + +پایگاه داده در خانه, تبادل داده ها با سرور خروجی زیر: + +``` sql +CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') +``` + +``` sql +SHOW DATABASES +``` + +``` text +┌─name─────┐ +│ default │ +│ mysql_db │ +│ system │ +└──────────┘ +``` + +``` sql +SHOW TABLES FROM mysql_db +``` + +``` text +┌─name─────────┐ +│ mysql_table │ +└──────────────┘ +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +└────────┴───────┘ +``` + +``` sql +INSERT INTO mysql_db.mysql_table VALUES (3,4) +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +│ 3 │ 4 │ +└────────┴───────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/fa/engines/database_engines/index.md b/docs/fa/engines/database_engines/index.md deleted file mode 100644 index fdc0816f35b..00000000000 --- a/docs/fa/engines/database_engines/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Database Engines -toc_priority: 27 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# موتورهای پایگاه داده {#database-engines} - -موتورهای پایگاه داده به شما اجازه کار با جداول. - -به طور پیش فرض, تاتر با استفاده از موتور پایگاه داده مادری خود, فراهم می کند که تنظیم [موتورهای جدول](../../engines/table_engines/index.md) و یک [شمارهگیری](../../sql_reference/syntax.md). - -شما همچنین می توانید موتورهای پایگاه داده زیر استفاده کنید: - -- [MySQL](mysql.md) - -- [تنبل](lazy.md) - -[مقاله اصلی](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/fa/engines/database_engines/mysql.md b/docs/fa/engines/database_engines/mysql.md deleted file mode 100644 index e77288257d9..00000000000 --- a/docs/fa/engines/database_engines/mysql.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 30 -toc_title: MySQL ---- - -# Mysql {#mysql} - -اجازه می دهد تا برای اتصال به پایگاه داده بر روی یک سرور خروجی از راه دور و انجام `INSERT` و `SELECT` نمایش داده شد به تبادل اطلاعات بین کلیک و خروجی زیر. - -این `MySQL` موتور پایگاه داده ترجمه نمایش داده شد به سرور خروجی زیر بنابراین شما می توانید عملیات مانند انجام `SHOW TABLES` یا `SHOW CREATE TABLE`. - -شما می توانید نمایش داده شد زیر را انجام دهد: - -- `RENAME` -- `CREATE TABLE` -- `ALTER` - -## ایجاد یک پایگاه داده {#creating-a-database} - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] -ENGINE = MySQL('host:port', 'database', 'user', 'password') -``` - -**پارامترهای موتور** - -- `host:port` — MySQL server address. -- `database` — Remote database name. -- `user` — MySQL user. -- `password` — User password. - -## پشتیبانی از انواع داده ها {#data_types-support} - -| MySQL | فاحشه خانه | -|----------------------------------|------------------------------------------------------------| -| UNSIGNED TINYINT | [UInt8](../../sql_reference/data_types/int_uint.md) | -| TINYINT | [Int8](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED SMALLINT | [UInt16](../../sql_reference/data_types/int_uint.md) | -| SMALLINT | [Int16](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql_reference/data_types/int_uint.md) | -| INT, MEDIUMINT | [Int32](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED BIGINT | [UInt64](../../sql_reference/data_types/int_uint.md) | -| BIGINT | [Int64](../../sql_reference/data_types/int_uint.md) | -| FLOAT | [Float32](../../sql_reference/data_types/float.md) | -| DOUBLE | [جسم شناور64](../../sql_reference/data_types/float.md) | -| DATE | [تاریخ](../../sql_reference/data_types/date.md) | -| DATETIME, TIMESTAMP | [DateTime](../../sql_reference/data_types/datetime.md) | -| BINARY | [رشته ثابت](../../sql_reference/data_types/fixedstring.md) | - -همه انواع داده خروجی زیر دیگر به تبدیل [رشته](../../sql_reference/data_types/string.md). - -[Nullable](../../sql_reference/data_types/nullable.md) پشتیبانی می شود. - -## نمونه هایی از استفاده {#examples-of-use} - -جدول در خروجی زیر: - -``` text -mysql> USE test; -Database changed - -mysql> CREATE TABLE `mysql_table` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `float` FLOAT NOT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from mysql_table; -+------+-----+ -| int_id | value | -+------+-----+ -| 1 | 2 | -+------+-----+ -1 row in set (0,00 sec) -``` - -پایگاه داده در خانه, تبادل داده ها با سرور خروجی زیر: - -``` sql -CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') -``` - -``` sql -SHOW DATABASES -``` - -``` text -┌─name─────┐ -│ default │ -│ mysql_db │ -│ system │ -└──────────┘ -``` - -``` sql -SHOW TABLES FROM mysql_db -``` - -``` text -┌─name─────────┐ -│ mysql_table │ -└──────────────┘ -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -└────────┴───────┘ -``` - -``` sql -INSERT INTO mysql_db.mysql_table VALUES (3,4) -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -│ 3 │ 4 │ -└────────┴───────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/fa/engines/table-engines/index.md b/docs/fa/engines/table-engines/index.md new file mode 100644 index 00000000000..1b8dbcb11c8 --- /dev/null +++ b/docs/fa/engines/table-engines/index.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Table Engines +toc_priority: 26 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# موتورهای جدول {#table_engines} + +موتور جدول (نوع جدول) تعیین می کند: + +- چگونه و در کجا اطلاعات ذخیره شده است, جایی که برای نوشتن به, و از کجا به خواندن از. +- که نمایش داده شد پشتیبانی می شوند, و چگونه. +- همزمان دسترسی به داده ها. +- استفاده از شاخص, در صورت وجود. +- این که اجرای درخواست چند رشته ای امکان پذیر باشد. +- پارامترهای تکرار داده. + +## خانواده موتور {#engine-families} + +### ادغام {#mergetree} + +موتورهای جدول جهانی ترین و کاربردی برای وظایف بار بالا. اموال به اشتراک گذاشته شده توسط این موتور درج داده های سریع با پردازش داده های پس زمینه های بعدی است. `MergeTree` موتورهای خانواده از تکرار داده ها پشتیبانی می کنند (با [تکرار\*](mergetree-family/replication.md) نسخه موتورهای) پارتیشن بندی و ویژگی های دیگر در موتورهای دیگر پشتیبانی نمی شود. + +موتورهای در خانواده: + +- [ادغام](mergetree-family/mergetree.md) +- [جایگزینی](mergetree-family/replacingmergetree.md) +- [سامینگمرگتری](mergetree-family/summingmergetree.md) +- [ریزدانه](mergetree-family/aggregatingmergetree.md) +- [سقوط غذای اصلی](mergetree-family/collapsingmergetree.md) +- [در حال بارگذاری](mergetree-family/versionedcollapsingmergetree.md) +- [نمودار](mergetree-family/graphitemergetree.md) + +### ثبت {#log} + +سبک [موتورها](log-family/index.md) با حداقل قابلیت. هنگامی که شما نیاز به سرعت نوشتن بسیاری از جداول کوچک (تا حدود 1 میلیون ردیف) و خواندن بعد به عنوان یک کل موثر ترین هستند. + +موتورهای در خانواده: + +- [جمع شدن](log-family/tinylog.md) +- [خط زدن](log-family/stripelog.md) +- [ثبت](log-family/log.md) + +### موتورهای یکپارچه سازی {#integration-engines} + +موتورهای برای برقراری ارتباط با دیگر ذخیره سازی داده ها و سیستم های پردازش. + +موتورهای در خانواده: + +- [کافکا](integrations/kafka.md) +- [MySQL](integrations/mysql.md) +- [ODBC](integrations/odbc.md) +- [JDBC](integrations/jdbc.md) +- [HDFS](integrations/hdfs.md) + +### موتورهای ویژه {#special-engines} + +موتورهای در خانواده: + +- [توزیع شده](special/distributed.md) +- [ماده بینی](special/materializedview.md) +- [واژهنامه](special/dictionary.md) +- [ادغام](special/merge.md) +- [پرونده](special/file.md) +- [خالی](special/null.md) +- [تنظیم](special/set.md) +- [پیوستن](special/join.md) +- [URL](special/url.md) +- [نما](special/view.md) +- [حافظه](special/memory.md) +- [بافر](special/buffer.md) + +## ستونهای مجازی {#table_engines-virtual-columns} + +ستون مجازی یک ویژگی موتور جدول انتگرال است که در کد منبع موتور تعریف شده است. + +شما باید ستون مجازی در مشخص نیست `CREATE TABLE` پرس و جو کنید و نمی توانید ببینید `SHOW CREATE TABLE` و `DESCRIBE TABLE` نتایج پرس و جو. ستون مجازی نیز فقط خواندنی, بنابراین شما می توانید داده ها را به ستون مجازی وارد کنید. + +برای انتخاب داده ها از یک ستون مجازی, شما باید نام خود را در مشخص `SELECT` پرس و جو. `SELECT *` مقادیر از ستون های مجازی بازگشت نیست. + +اگر شما یک جدول با یک ستون است که به همین نام به عنوان یکی از ستون های مجازی جدول ایجاد, ستون مجازی غیر قابل دسترس می شود. ما توصیه نمی انجام این کار. برای کمک به جلوگیری از درگیری, نام ستون مجازی معمولا با تاکید پیشوند. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/fa/engines/table-engines/integrations/hdfs.md b/docs/fa/engines/table-engines/integrations/hdfs.md new file mode 100644 index 00000000000..1f12dd5048e --- /dev/null +++ b/docs/fa/engines/table-engines/integrations/hdfs.md @@ -0,0 +1,123 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: HDFS +--- + +# HDFS {#table_engines-hdfs} + +این موتور ادغام با فراهم می کند [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) اکوسیستم با اجازه دادن به مدیریت داده ها در [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)از طریق کلیکهاوس. این موتور مشابه است +به [پرونده](../special/file.md) و [URL](../special/url.md) موتورهای, اما فراهم می کند ویژگی های هادوپ خاص. + +## استفاده {#usage} + +``` sql +ENGINE = HDFS(URI, format) +``` + +این `URI` پارامتر تمام فایل نشانی اینترنتی در اچ دی است. +این `format` پارامتر یکی از فرمت های فایل های موجود را مشخص می کند. برای انجام +`SELECT` نمایش داده شد, فرمت باید برای ورودی پشتیبانی می شود, و به انجام +`INSERT` queries – for output. The available formats are listed in the +[فرشها](../../../interfaces/formats.md#formats) بخش. +قسمت مسیر `URI` ممکن است حاوی دل تنگی. در این مورد جدول قابل خواندن خواهد بود. + +**مثال:** + +**1.** تنظیم `hdfs_engine_table` جدول: + +``` sql +CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') +``` + +**2.** پر کردن پرونده: + +``` sql +INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) +``` + +**3.** پرسوجوی داده: + +``` sql +SELECT * FROM hdfs_engine_table LIMIT 2 +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## پیاده سازی اطلاعات {#implementation-details} + +- می خواند و می نویسد می تواند موازی +- پشتیبانی نمیشود: + - `ALTER` و `SELECT...SAMPLE` عملیات. + - شاخص. + - تکرار. + +**دل تنگی در مسیر** + +اجزای مسیر چندگانه می تواند دل تنگی دارند. برای پردازش فایل باید وجود داشته باشد و مسابقات به الگوی کل مسیر. لیست فایل های تعیین در طول `SELECT` (نه در `CREATE` لحظه). + +- `*` — Substitutes any number of any characters except `/` از جمله رشته خالی. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +سازه با `{}` شبیه به [دور](../../../sql-reference/table-functions/remote.md) تابع جدول. + +**مثال** + +1. فرض کنید ما چندین فایل را در قالب فیلم با اوریس زیر در اچ دی ها داریم: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. راه های مختلفی برای ایجاد یک جدول متشکل از تمام شش فایل وجود دارد: + + + +``` sql +CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') +``` + +راه دیگر: + +``` sql +CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') +``` + +جدول شامل تمام فایل ها در هر دو دایرکتوری (تمام فایل ها باید فرمت و طرح توصیف شده در پرس و جو راضی): + +``` sql +CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') +``` + +!!! warning "اخطار" + اگر فهرستی از فایل های حاوی محدوده تعداد با صفر پیشرو, استفاده از ساخت و ساز با پرانتز برای هر رقم به طور جداگانه و یا استفاده `?`. + +**مثال** + +ایجاد جدول با فایل های به نام `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') +``` + +## ستونهای مجازی {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**همچنین نگاه کنید به** + +- [ستونهای مجازی](../index.md#table_engines-virtual_columns) + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/fa/engines/table_engines/integrations/index.md b/docs/fa/engines/table-engines/integrations/index.md similarity index 100% rename from docs/fa/engines/table_engines/integrations/index.md rename to docs/fa/engines/table-engines/integrations/index.md diff --git a/docs/fa/engines/table-engines/integrations/jdbc.md b/docs/fa/engines/table-engines/integrations/jdbc.md new file mode 100644 index 00000000000..dda1abf3125 --- /dev/null +++ b/docs/fa/engines/table-engines/integrations/jdbc.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: JDBC +--- + +# JDBC {#table-engine-jdbc} + +اجازه می دهد تا تاتر برای اتصال به پایگاه داده های خارجی از طریق [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). + +برای پیاده سازی اتصال جدی بی سی, خانه با استفاده از برنامه جداگانه [هومز-جد بی سی-پل](https://github.com/alex-krash/clickhouse-jdbc-bridge) که باید به عنوان یک شبح اجرا شود. + +این موتور از [Nullable](../../../sql-reference/data-types/nullable.md) نوع داده. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name +( + columns list... +) +ENGINE = JDBC(dbms_uri, external_database, external_table) +``` + +**پارامترهای موتور** + +- `dbms_uri` — URI of an external DBMS. + + قالب: `jdbc:://:/?user=&password=`. + به عنوان مثال برای خروجی زیر: `jdbc:mysql://localhost:3306/?user=root&password=root`. + +- `external_database` — Database in an external DBMS. + +- `external_table` — Name of the table in `external_database`. + +## مثال طریقه استفاده {#usage-example} + +ایجاد یک جدول در سرور خروجی زیر با اتصال مستقیم با مشتری کنسول: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ایجاد یک جدول در سرور کلیک و انتخاب داده ها از: + +``` sql +CREATE TABLE jdbc_table +( + `int_id` Int32, + `int_nullable` Nullable(Int32), + `float` Float32, + `float_nullable` Nullable(Float32) +) +ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') +``` + +``` sql +SELECT * +FROM jdbc_table +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## همچنین نگاه کنید به {#see-also} + +- [تابع جدول جدی بی سی](../../../sql-reference/table-functions/jdbc.md). + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/fa/engines/table-engines/integrations/kafka.md b/docs/fa/engines/table-engines/integrations/kafka.md new file mode 100644 index 00000000000..2124041908e --- /dev/null +++ b/docs/fa/engines/table-engines/integrations/kafka.md @@ -0,0 +1,176 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 32 +toc_title: "\u06A9\u0627\u0641\u06A9\u0627" +--- + +# کافکا {#kafka} + +این موتور با این نسخهها کار [نمایی کافکا](http://kafka.apache.org/). + +کافکا به شما امکان می دهد: + +- انتشار یا اشتراک در جریان داده ها. +- سازماندهی ذخیره سازی مقاوم در برابر خطا. +- روند جریان به عنوان در دسترس تبدیل شده است. + +## ایجاد یک جدول {#table_engine-kafka-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = Kafka() +SETTINGS + kafka_broker_list = 'host:port', + kafka_topic_list = 'topic1,topic2,...', + kafka_group_name = 'group_name', + kafka_format = 'data_format'[,] + [kafka_row_delimiter = 'delimiter_symbol',] + [kafka_schema = '',] + [kafka_num_consumers = N,] + [kafka_skip_broken_messages = N] +``` + +پارامترهای مورد نیاز: + +- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). +- `kafka_topic_list` – A list of Kafka topics. +- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don’t want messages to be duplicated in the cluster, use the same group name everywhere. +- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` تابع مانند `JSONEachRow`. برای کسب اطلاعات بیشتر, دیدن [فرشها](../../../interfaces/formats.md) بخش. + +پارامترهای اختیاری: + +- `kafka_row_delimiter` – Delimiter character, which ends the message. +- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [سروان نیا](https://capnproto.org/) نیاز به مسیر به فایل طرح و نام ریشه `schema.capnp:Message` اعتراض. +- `kafka_num_consumers` – The number of consumers per table. Default: `1`. مشخص مصرف کنندگان بیشتر اگر توان عملیاتی یک مصرف کننده کافی است. تعداد کل مصرف کنندگان باید تعداد پارتیشن در موضوع تجاوز نمی, از تنها یک مصرف کننده را می توان در هر پارتیشن اختصاص داده. +- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. اگر `kafka_skip_broken_messages = N` سپس موتور پرش *N* پیام کافکا که نمی تواند تجزیه شود (یک پیام برابر یک ردیف از داده ها). + +مثالها: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + SELECT * FROM queue LIMIT 5; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', + kafka_topic_list = 'topic', + kafka_group_name = 'group1', + kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') + SETTINGS kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; +``` + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + از این روش در پروژه های جدید استفاده نکنید. در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format + [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) +``` + +
+ +## توصیف {#description} + +پیام تحویل به طور خودکار ردیابی, بنابراین هر پیام در یک گروه تنها یک بار شمارش. اگر شما می خواهید برای دریافت داده ها دو بار, سپس یک کپی از جدول با نام گروه دیگری ایجاد. + +گروه انعطاف پذیر هستند و همگام سازی در خوشه. برای مثال, اگر شما 10 موضوعات و 5 نسخه از یک جدول در یک خوشه, سپس هر کپی می شود 2 موضوعات. اگر تعداد نسخه تغییر, موضوعات در سراسر نسخه توزیع به طور خودکار. اطلاعات بیشتر در مورد این در http://kafka.apache.org/intro. + +`SELECT` به خصوص برای خواندن پیام های مفید نیست (به جز اشکال زدایی), چرا که هر پیام را می توان تنها یک بار به عنوان خوانده شده. این عملی تر است برای ایجاد موضوعات در زمان واقعی با استفاده از نمایش محقق. برای انجام این کار: + +1. از موتور برای ایجاد یک مصرف کننده کافکا استفاده کنید و جریان داده را در نظر بگیرید. +2. ایجاد یک جدول با ساختار مورد نظر. +3. یک دیدگاه محقق ایجاد کنید که داده ها را از موتور تبدیل می کند و به یک جدول قبلا ایجاد شده تبدیل می کند. + +هنگامی که `MATERIALIZED VIEW` به موتور می پیوندد و شروع به جمع کردن داده ها در پس زمینه می کند. این اجازه می دهد تا شما را به طور مستمر دریافت پیام از کافکا و تبدیل به فرمت مورد نیاز با استفاده از `SELECT`. +یک جدول کافکا می تواند به عنوان بسیاری از دیدگاه های تحقق به عنوان دوست دارید, اطلاعات از جدول کافکا به طور مستقیم به عنوان خوانده شده, اما دریافت پرونده های جدید (در بلوک), به این ترتیب شما می توانید به چند جدول با سطح جزییات مختلف ارسال (با گروه بندی - تجمع و بدون). + +مثال: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + CREATE TABLE daily ( + day Date, + level String, + total UInt64 + ) ENGINE = SummingMergeTree(day, (day, level), 8192); + + CREATE MATERIALIZED VIEW consumer TO daily + AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total + FROM queue GROUP BY day, level; + + SELECT level, sum(total) FROM daily GROUP BY level; +``` + +برای بهبود عملکرد, پیام های دریافت شده را به بلوک های اندازه گروه بندی می شوند [ا\_فزونهها](../../../operations/server-configuration-parameters/settings.md#settings-max_insert_block_size). اگر بلوک در داخل تشکیل نشده است [\_خاله جریان](../../../operations/server-configuration-parameters/settings.md) میلی ثانیه, داده خواهد شد به جدول بدون در نظر گرفتن کامل از بلوک سرخ. + +برای جلوگیری از دریافت داده های موضوع و یا تغییر منطق تبدیل جدا مشاهده محقق: + +``` sql + DETACH TABLE consumer; + ATTACH TABLE consumer; +``` + +اگر شما می خواهید به تغییر جدول هدف با استفاده از `ALTER` توصیه می کنیم دیدگاه مادی را غیرفعال کنید تا از اختلاف بین جدول هدف و داده ها از نظر جلوگیری شود. + +## پیکربندی {#configuration} + +شبیه به graphitemergetree های کافکا پشتیبانی از موتور تمدید پیکربندی با استفاده از clickhouse فایل پیکربندی. دو کلید پیکربندی است که شما می توانید استفاده کنید وجود دارد: جهانی (`kafka`) و سطح موضوع (`kafka_*`). پیکربندی جهانی برای اولین بار اعمال می شود و سپس پیکربندی سطح موضوع اعمال می شود (در صورت وجود). + +``` xml + + + cgrp + smallest + + + + + 250 + 100000 + +``` + +برای یک لیست از گزینه های پیکربندی ممکن, دیدن [مرجع پیکربندی کتابدار](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). استفاده از تاکید (`_`) به جای یک نقطه در پیکربندی کلیک. به عنوان مثال, `check.crcs=true` خواهد بود `true`. + +## ستونهای مجازی {#virtual-columns} + +- `_topic` — Kafka topic. +- `_key` — Key of the message. +- `_offset` — Offset of the message. +- `_timestamp` — Timestamp of the message. +- `_partition` — Partition of Kafka topic. + +**همچنین نگاه کنید** + +- [مجازی ستون](../index.md#table_engines-virtual_columns) + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/fa/engines/table-engines/integrations/mysql.md b/docs/fa/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..e3b08d22ebd --- /dev/null +++ b/docs/fa/engines/table-engines/integrations/mysql.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: MySQL +--- + +# Mysql {#mysql} + +موتور خروجی زیر اجازه می دهد تا شما را به انجام `SELECT` نمایش داده شد در داده است که بر روی یک سرور خروجی از راه دور ذخیره می شود. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... +) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +مشاهده شرح مفصلی از [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) پرس و جو. + +ساختار جدول می تواند از ساختار جدول خروجی زیر اصلی متفاوت است: + +- نام ستون باید همان است که در جدول خروجی زیر اصلی باشد, اما شما می توانید تنها برخی از این ستون ها و در هر جهت استفاده. +- انواع ستون ممکن است از کسانی که در جدول خروجی زیر اصلی متفاوت است. فاحشه خانه تلاش می کند تا [بازیگران](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) ارزش ها را به انواع داده های کلیک. + +**پارامترهای موتور** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` نمایش داده شد به `REPLACE INTO`. اگر `replace_query=1`, پرس و جو جایگزین شده است. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` بیان است که به اضافه `INSERT` پرس و جو. + + مثال: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1` کجا `on_duplicate_clause` هست `UPDATE c2 = c2 + 1`. دیدن [مستندات خروجی زیر](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) برای پیدا کردن که `on_duplicate_clause` شما می توانید با استفاده از `ON DUPLICATE KEY` بند بند. + + برای مشخص کردن `on_duplicate_clause` شما نیاز به تصویب `0` به `replace_query` پارامتر. اگر شما به طور همزمان عبور `replace_query = 1` و `on_duplicate_clause`, تاتر تولید یک استثنا. + +ساده `WHERE` بند هایی مانند `=, !=, >, >=, <, <=` بر روی سرور خروجی زیر اجرا شده است. + +بقیه شرایط و `LIMIT` محدودیت نمونه برداری در محل کلیک تنها پس از پرس و جو به پس از اتمام خروجی زیر اجرا شده است. + +## مثال طریقه استفاده {#usage-example} + +جدول در خروجی زیر: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +جدول در تاتر, بازیابی داده ها از جدول خروجی زیر ایجاد شده در بالا: + +``` sql +CREATE TABLE mysql_table +( + `float_nullable` Nullable(Float32), + `int_id` Int32 +) +ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` sql +SELECT * FROM mysql_table +``` + +``` text +┌─float_nullable─┬─int_id─┐ +│ ᴺᵁᴸᴸ │ 1 │ +└────────────────┴────────┘ +``` + +## همچنین نگاه کنید {#see-also} + +- [این ‘mysql’ تابع جدول](../../../sql-reference/table-functions/mysql.md) +- [با استفاده از خروجی زیر به عنوان منبع فرهنگ لغت خارجی](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/fa/engines/table-engines/integrations/odbc.md b/docs/fa/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..344418b32e8 --- /dev/null +++ b/docs/fa/engines/table-engines/integrations/odbc.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: ODBC +--- + +# ODBC {#table-engine-odbc} + +اجازه می دهد تا تاتر برای اتصال به پایگاه داده های خارجی از طریق [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +با خیال راحت پیاده سازی اتصالات ان بی سی, تاتر با استفاده از یک برنامه جداگانه `clickhouse-odbc-bridge`. اگر راننده او بی سی به طور مستقیم از لود `clickhouse-server`, مشکلات راننده می تواند سرور تاتر سقوط. تاتر به طور خودکار شروع می شود `clickhouse-odbc-bridge` هنگامی که مورد نیاز است. برنامه پل او بی سی از همان بسته به عنوان نصب `clickhouse-server`. + +این موتور از [Nullable](../../../sql-reference/data-types/nullable.md) نوع داده. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +مشاهده شرح مفصلی از [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) پرس و جو. + +ساختار جدول می تواند از ساختار جدول منبع متفاوت باشد: + +- نام ستون باید همان است که در جدول منبع باشد, اما شما می توانید تنها برخی از این ستون ها و در هر جهت استفاده. +- انواع ستون ممکن است از کسانی که در جدول منبع متفاوت. فاحشه خانه تلاش می کند تا [بازیگران](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) ارزش ها را به انواع داده های کلیک. + +**پارامترهای موتور** + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` پرونده. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +## مثال طریقه استفاده {#usage-example} + +**بازیابی داده ها از نصب و راه اندازی خروجی زیر محلی از طریق ان بی سی** + +این مثال برای لینوکس اوبونتو 18.04 و سرور خروجی زیر 5.7 بررسی می شود. + +اطمینان حاصل شود که unixodbc و mysql اتصال نصب شده است. + +به طور پیش فرض (در صورت نصب از بسته), کلیک خانه شروع می شود به عنوان کاربر `clickhouse`. بدین ترتیب, شما نیاز به ایجاد و پیکربندی این کاربر در سرور خروجی زیر. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +سپس اتصال را پیکربندی کنید `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +شما می توانید اتصال با استفاده از بررسی `isql` ابزار از unixODBC نصب و راه اندازی. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +جدول در خروجی زیر: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +جدول در تاتر بازیابی داده ها از جدول خروجی زیر: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## همچنین نگاه کنید به {#see-also} + +- [لغت نامه های خارجی ان بی سی](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [تابع جدول ان بی سی](../../../sql-reference/table-functions/odbc.md) + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/fa/engines/table_engines/log_family/index.md b/docs/fa/engines/table-engines/log-family/index.md similarity index 100% rename from docs/fa/engines/table_engines/log_family/index.md rename to docs/fa/engines/table-engines/log-family/index.md diff --git a/docs/fa/engines/table-engines/log-family/log-family.md b/docs/fa/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..86494d037f6 --- /dev/null +++ b/docs/fa/engines/table-engines/log-family/log-family.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 31 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# ورود خانواده موتور {#log-engine-family} + +هنگامی که شما نیاز به سرعت نوشتن بسیاری از جداول کوچک (تا حدود 1 میلیون ردیف) و بعد به عنوان یک کل خواندن این موتور برای حالات توسعه داده شد. + +موتورهای خانواده: + +- [خط زدن](stripelog.md) +- [ثبت](log.md) +- [جمع شدن](tinylog.md) + +## ویژگیهای مشترک {#common-properties} + +موتورها: + +- ذخیره داده ها بر روی یک دیسک. + +- اضافه کردن داده ها به پایان فایل هنگام نوشتن. + +- قفل پشتیبانی برای دسترسی همزمان داده ها. + + در طول `INSERT` نمایش داده شد, جدول قفل شده است, و دیگر نمایش داده شد برای خواندن و نوشتن داده ها هر دو منتظر جدول برای باز کردن. اگر هیچ نمایش داده شد نوشتن داده ها وجود دارد, هر تعداد از نمایش داده شد خواندن داده ها را می توان به صورت همزمان انجام. + +- پشتیبانی نمی کند [جهش](../../../sql-reference/statements/alter.md#alter-mutations) عملیات. + +- هنوز شاخص را پشتیبانی نمی کند. + + این به این معنی است که `SELECT` نمایش داده شد برای محدوده داده ها موثر نیست. + +- هنوز داده نوشتن نیست اتمی. + + شما می توانید یک جدول با داده های خراب اگر چیزی می شکند عملیات نوشتن, مثلا, خاموش کردن سرور غیر طبیعی. + +## تفاوت {#differences} + +این `TinyLog` موتور ساده ترین در خانواده است و فقیرترین قابلیت ها و کمترین بهره وری را فراهم می کند. این `TinyLog` موتور از خواندن داده های موازی با چندین موضوع پشتیبانی نمی کند. این اطلاعات کندتر از موتورهای دیگر در خانواده است که خواندن موازی را پشتیبانی می کند و تقریبا به عنوان بسیاری از توصیفگرها به عنوان `Log` موتور به دلیل ذخیره هر ستون در یک فایل جداگانه. در حالات کم بار ساده استفاده کنید. + +این `Log` و `StripeLog` موتورهای پشتیبانی خواندن داده های موازی. هنگام خواندن داده ها, تاتر با استفاده از موضوعات متعدد. هر موضوع یک بلوک داده جداگانه را پردازش می کند. این `Log` موتور با استفاده از یک فایل جداگانه برای هر ستون از جدول. `StripeLog` ذخیره تمام داده ها در یک فایل. در نتیجه `StripeLog` موتور با استفاده از توصیف کمتر در سیستم عامل, اما `Log` موتور فراهم می کند بهره وری بالاتر در هنگام خواندن داده ها. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/fa/engines/table-engines/log-family/log.md b/docs/fa/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..86045c01f56 --- /dev/null +++ b/docs/fa/engines/table-engines/log-family/log.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: "\u062B\u0628\u062A" +--- + +# ثبت {#log} + +موتور متعلق به خانواده از موتورهای ورود به سیستم. مشاهده خواص مشترک از موتورهای ورود به سیستم و تفاوت های خود را در [ورود خانواده موتور](log-family.md) مقاله. + +ورود متفاوت از [جمع شدن](tinylog.md) در این فایل کوچک “marks” ساکن با فایل های ستون. این علامت ها در هر بلوک داده نوشته شده است و شامل شیپور خاموشی که نشان می دهد از کجا شروع به خواندن فایل به منظور جست و خیز تعداد مشخصی از ردیف. این باعث می شود امکان خواندن داده های جدول در موضوعات مختلف. +برای همزمان دسترسی به داده ها, عملیات خواندن را می توان به طور همزمان انجام, در حالی که ارسال عملیات بلوک می خواند و هر یک از دیگر. +موتور ورود به سیستم می کند شاخص را پشتیبانی نمی کند. به طور مشابه, اگر نوشتن به یک جدول شکست خورده, جدول شکسته است, و خواندن از این خطا را برمی گرداند. موتور ورود به سیستم مناسب برای داده های موقت است, نوشتن یک بار جداول, و برای تست و یا تظاهرات اهداف. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/fa/engines/table-engines/log-family/stripelog.md b/docs/fa/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..fb2be6ebea8 --- /dev/null +++ b/docs/fa/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,95 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 32 +toc_title: "\u062E\u0637 \u0632\u062F\u0646" +--- + +# خط زدن {#stripelog} + +این موتور متعلق به خانواده از موتورهای ورود به سیستم. مشاهده خواص مشترک از موتورهای ورود به سیستم و تفاوت های خود را در [ورود خانواده موتور](log-family.md) مقاله. + +با استفاده از این موتور در حالات زمانی که شما نیاز به نوشتن بسیاری از جداول با مقدار کمی از داده ها (کمتر از 1 میلیون ردیف). + +## ایجاد یک جدول {#table_engines-stripelog-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = StripeLog +``` + +شرح مفصلی از [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) پرس و جو. + +## نوشتن داده ها {#table_engines-stripelog-writing-the-data} + +این `StripeLog` موتور فروشگاه تمام ستون ها در یک فایل. برای هر `INSERT` پرس و جو, خانه رعیتی بلوک داده ها به پایان یک فایل جدول, نوشتن ستون یک به یک. + +برای هر کلیک جدول فایل ها را می نویسد: + +- `data.bin` — Data file. +- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. + +این `StripeLog` موتور را پشتیبانی نمی کند `ALTER UPDATE` و `ALTER DELETE` عملیات. + +## خواندن داده ها {#table_engines-stripelog-reading-the-data} + +فایل را با نشانه اجازه می دهد تا clickhouse به parallelize خواندن داده ها. این به این معنی است که یک `SELECT` پرس و جو ردیف در جهت غیر قابل پیش بینی می گرداند. استفاده از `ORDER BY` بند برای مرتب کردن ردیف. + +## مثال استفاده {#table_engines-stripelog-example-of-use} + +ایجاد یک جدول: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +درج داده: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +ما با استفاده از دو `INSERT` نمایش داده شد برای ایجاد دو بلوک داده ها در داخل `data.bin` پرونده. + +خانه رعیتی با استفاده از موضوعات متعدد در هنگام انتخاب داده ها. هر موضوع یک بلوک داده جداگانه را می خواند و ردیف ها را به طور مستقل به پایان می رساند. در نتیجه, منظور از بلوک های ردیف در خروجی می کند منظور از بلوک های مشابه در ورودی در اکثر موارد مطابقت ندارد. به عنوان مثال: + +``` sql +SELECT * FROM stripe_log_table +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +┌───────────timestamp─┬─message_type─┬─message───────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +└─────────────────────┴──────────────┴───────────────────────────┘ +``` + +مرتب سازی نتایج (صعودی با ترتیب به طور پیش فرض): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/fa/engines/table-engines/log-family/tinylog.md b/docs/fa/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..b6db57f431c --- /dev/null +++ b/docs/fa/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: "\u062C\u0645\u0639 \u0634\u062F\u0646" +--- + +# جمع شدن {#tinylog} + +موتور متعلق به خانواده موتور ورود به سیستم. ببینید [ورود خانواده موتور](log-family.md) برای خواص مشترک موتورهای ورود به سیستم و تفاوت های خود را. + +این موتور جدول معمولا با روش نوشتن یک بار استفاده می شود: نوشتن داده ها یک بار و سپس خواندن هر چند بار که لازم است. مثلا, شما می توانید استفاده کنید `TinyLog`- نوع جداول برای داده های واسطه است که در دسته های کوچک پردازش شده است. توجه داشته باشید که ذخیره سازی داده ها در تعداد زیادی از جداول کوچک بی اثر است. + +نمایش داده شد در یک جریان واحد اجرا شده است. به عبارت دیگر این موتور برای جداول نسبتا کوچک (تا حدود 1000000 ردیف) در نظر گرفته شده است. این را حس می کند به استفاده از این موتور جدول اگر شما بسیاری از جداول کوچک, از ساده تر از [ثبت](log.md) موتور (فایل های کمتر نیاز به باز شود). + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/fa/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/fa/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..426515555eb --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,102 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: "\u0631\u06CC\u0632\u062F\u0627\u0646\u0647" +--- + +# ریزدانه {#aggregatingmergetree} + +موتور به ارث می برد از [ادغام](mergetree.md#table_engines-mergetree), تغییر منطق برای ادغام قطعات داده. تاتر جایگزین تمام ردیف با کلید اصلی همان (یا با دقت بیشتر, با همان [کلید مرتب سازی](mergetree.md)) با یک ردیف (در یک بخش یک داده) که ترکیبی از ایالت های توابع کل را ذخیره می کند. + +شما می توانید استفاده کنید `AggregatingMergeTree` جداول برای تجمع داده افزایشی, از جمله برای نمایش محقق جمع. + +موتور پردازش تمام ستون ها با [کارکرد](../../../sql-reference/data-types/aggregatefunction.md) نوع. + +مناسب برای استفاده است `AggregatingMergeTree` اگر تعداد ردیف ها را با دستور کاهش دهد. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[TTL expr] +[SETTINGS name=value, ...] +``` + +برای شرح پارامترهای درخواست را ببینید [درخواست توضیحات](../../../sql-reference/statements/create.md). + +**بندهای پرسوجو** + +هنگام ایجاد یک `AggregatingMergeTree` جدول همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +همه پارامترها همان معنی را دارند `MergeTree`. +
+ +## انتخاب و درج {#select-and-insert} + +برای وارد کردن داده ها استفاده کنید [INSERT SELECT](../../../sql-reference/statements/insert-into.md) پرس و جو با کل دولت توابع. +هنگام انتخاب داده ها از `AggregatingMergeTree` جدول استفاده کنید `GROUP BY` بند و توابع کل همان هنگام قرار دادن داده, اما با استفاده از `-Merge` پسوند. + +در نتایج `SELECT` پرس و جو, ارزش `AggregateFunction` نوع اجرای خاص نمایندگی دودویی برای همه فرمت های خروجی کلیک کنید. اگر کمپرسی داده ها به, مثلا, `TabSeparated` قالب با `SELECT` پرس و جو و سپس این روگرفت را می توان با استفاده از لود `INSERT` پرس و جو. + +## به عنوان مثال از یک مشاهده محقق جمع {#example-of-an-aggregated-materialized-view} + +`AggregatingMergeTree` مشاهده تحقق است که به تماشای `test.visits` جدول: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +درج داده به `test.visits` جدول + +``` sql +INSERT INTO test.visits ... +``` + +داده ها در هر دو جدول و مشخصات قرار داده شده `test.basic` که تجمع انجام خواهد شد. + +برای دریافت اطلاعات جمع, ما نیاز به اجرای یک پرس و جو مانند `SELECT ... GROUP BY ...` از نظر `test.basic`: + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/fa/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/fa/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..9ce02ad4a46 --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: "\u0633\u0642\u0648\u0637 \u063A\u0630\u0627\u06CC \u0627\u0635\u0644\u06CC" +--- + +# سقوط غذای اصلی {#table_engine-collapsingmergetree} + +موتور به ارث می برد از [ادغام](mergetree.md) و می افزاید: منطق ردیف سقوط به قطعات داده الگوریتم ادغام. + +`CollapsingMergeTree` ناهمزمان حذف (فرو می ریزد) جفت ردیف اگر همه از زمینه ها در یک کلید مرتب سازی (`ORDER BY`) معادل به استثنای زمینه خاص است `Sign` که می تواند داشته باشد `1` و `-1` ارزشهای خبری عبارتند از: ردیف بدون یک جفت نگهداری می شوند. برای اطلاعات بیشتر نگاه کنید به [سقوط](#table_engine-collapsingmergetree-collapsing) بخش از سند. + +موتور ممکن است به طور قابل توجهی حجم ذخیره سازی را کاهش دهد و بهره وری را افزایش دهد `SELECT` پرس و جو به عنوان یک نتیجه. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +برای شرح پارامترهای پرس و جو, دیدن [توضیحات پرس و جو](../../../sql-reference/statements/create.md). + +**پارامترهای پیش ساخته** + +- `sign` — Name of the column with the type of row: `1` یک “state” سطر, `-1` یک “cancel” پارو زدن. + + Column data type — `Int8`. + +**بندهای پرسوجو** + +هنگام ایجاد یک `CollapsingMergeTree` جدول, همان [بندهای پرسوجو](mergetree.md#table_engine-mergetree-creating-a-table) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +همه پارامترها به استثنای `sign` همان معنی را در `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` — “state” سطر, `-1` — “cancel” پارو زدن. + + Column Data Type — `Int8`. + +
+ +## سقوط {#table_engine-collapsingmergetree-collapsing} + +### داده {#data} + +وضعیت جایی که شما نیاز به ذخیره به طور مداوم در حال تغییر داده ها برای برخی از شی را در نظر بگیرید. برای تلفن های موبایل منطقی به یک ردیف برای یک شی و به روز رسانی در هر تغییر, اما عملیات به روز رسانی گران و کند برای سندرم تونل کارپ است چرا که نیاز به بازنویسی از داده ها در ذخیره سازی. اگر شما نیاز به نوشتن داده ها به سرعت, به روز رسانی قابل قبول نیست, اما شما می توانید تغییرات یک شی پی در پی به شرح زیر ارسال. + +استفاده از ستون خاص `Sign`. اگر `Sign = 1` این بدان معنی است که ردیف دولت از یک شی است, اجازه دهید اسمش را “state” پارو زدن. اگر `Sign = -1` به این معنی لغو دولت از یک شی با ویژگی های مشابه, اجازه دهید اسمش را “cancel” پارو زدن. + +برای مثال ما می خواهیم برای محاسبه چقدر صفحات کاربران بررسی می شود در برخی از سایت و چه مدت وجود دارد. در برخی از لحظه ما ارسال ردیف زیر را با دولت از فعالیت های کاربر: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +در چند لحظه بعد ما تغییر فعالیت کاربر را ثبت می کنیم و با دو ردیف زیر می نویسیم. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +ردیف اول لغو حالت قبلی از جسم (کاربر). این باید زمینه های کلیدی مرتب سازی دولت لغو به استثنای کپی کنید `Sign`. + +ردیف دوم شامل وضعیت فعلی. + +همانطور که ما نیاز به تنها دولت گذشته از فعالیت های کاربر, ردیف + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +می توان حذف سقوط نامعتبر (قدیمی) دولت از یک شی. `CollapsingMergeTree` این کار در حالی که ادغام قطعات داده. + +چرا ما نیاز به 2 ردیف برای هر تغییر در خواندن [الگوریتم](#table_engine-collapsingmergetree-collapsing-algorithm) بند بند بند. + +**خواص عجیب و غریب چنین رویکردی** + +1. برنامه ای که می نویسد داده ها باید به یاد داشته باشید دولت از یک شی قادر به لغو. “Cancel” رشته باید نسخه هایی از زمینه های کلیدی مرتب سازی شامل “state” رشته و مخالف `Sign`. این افزایش اندازه اولیه ذخیره سازی اما اجازه می دهد تا به نوشتن داده ها به سرعت. +2. در حال رشد طولانی در ستون کاهش بهره وری از موتور با توجه به بار برای نوشتن. داده های ساده تر, بالاتر بهره وری. +3. این `SELECT` نتایج به شدت بستگی به قوام شی تغییر تاریخ. هنگام تهیه داده ها برای قرار دادن دقیق باشید. شما می توانید نتایج غیر قابل پیش بینی در اطلاعات متناقض برای مثال مقادیر منفی برای معیارهای غیر منفی مانند جلسه عمق. + +### الگوریتم {#table_engine-collapsingmergetree-collapsing-algorithm} + +هنگامی که تاتر ادغام قطعات داده, هر گروه از ردیف متوالی با کلید مرتب سازی همان (`ORDER BY`) به بیش از دو ردیف کاهش می یابد, یکی با `Sign = 1` (“state” ردیف) و دیگری با `Sign = -1` (“cancel” ردیف). به عبارت دیگر, سقوط نوشته. + +برای هر یک از داده ها در نتیجه بخشی تاتر موجب صرفه جویی در: + +1. اولین “cancel” و گذشته “state” ردیف, اگر تعداد “state” و “cancel” ردیف مسابقات و ردیف گذشته است “state” پارو زدن. + +2. گذشته “state” ردیف, اگر بیشتر وجود دارد “state” سطر از “cancel” ردیف + +3. اولین “cancel” ردیف, اگر بیشتر وجود دارد “cancel” سطر از “state” ردیف + +4. هیچ یک از ردیف, در تمام موارد دیگر. + +همچنین زمانی که حداقل وجود دارد 2 بیشتر “state” سطر از “cancel” ردیف یا حداقل 2 بیشتر “cancel” سپس سطرها “state” ردیف, ادغام ادامه, اما تاتر این وضعیت رفتار به عنوان یک خطای منطقی و ثبت در ورود به سیستم سرور. این خطا می تواند رخ دهد اگر داده های مشابه بیش از یک بار قرار داده شد. + +بدین ترتیب, سقوط باید نتایج حاصل از محاسبه ارقام تغییر نمی. +تغییرات به تدریج فرو ریخت به طوری که در پایان تنها دولت گذشته تقریبا در هر شی را ترک کرد. + +این `Sign` لازم است زیرا الگوریتم ادغام تضمین نمی کند که تمام ردیف ها با کلید مرتب سازی مشابه در بخش داده های مشابه و حتی در همان سرور فیزیکی باشد. روند کلیک `SELECT` نمایش داده شد با موضوعات مختلف و می تواند منظور از ردیف در نتیجه پیش بینی نیست. تجمع مورد نیاز است اگر نیاز به طور کامل وجود دارد “collapsed” داده ها از `CollapsingMergeTree` جدول + +برای نهایی سقوط, نوشتن یک پرس و جو با `GROUP BY` بند و مجموع توابع است که برای ثبت نام حساب. برای مثال برای محاسبه مقدار استفاده کنید `sum(Sign)` به جای `count()`. برای محاسبه مجموع چیزی استفاده کنید `sum(Sign * x)` به جای `sum(x)` و به همین ترتیب و همچنین اضافه کنید `HAVING sum(Sign) > 0`. + +مصالح `count`, `sum` و `avg` می تواند محاسبه این راه. مجموع `uniq` می تواند محاسبه شود اگر یک شی حداقل یک دولت سقوط نیست. مصالح `min` و `max` محاسبه نشد زیرا `CollapsingMergeTree` می کند تاریخ ارزش از کشورهای سقوط را نجات دهد. + +اگر شما نیاز به استخراج داده ها بدون تجمع (مثلا, برای بررسی اینکه ردیف در حال حاضر که جدیدترین ارزش مطابقت با شرایط خاص هستند), شما می توانید با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. این رویکرد به طور قابل توجهی کمتر موثر است. + +## مثال استفاده {#example-of-use} + +اطلاعات نمونه: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +ایجاد جدول: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +درج داده ها: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +ما با استفاده از دو `INSERT` نمایش داده شد برای ایجاد دو بخش داده های مختلف. اگر ما وارد کردن داده ها با یک پرس و جو تاتر ایجاد یک بخش داده ها و هر گونه ادغام تا کنون انجام نمی. + +گرفتن داده ها: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +چه ما را ببینید و جایی که در حال سقوط است? + +با دو `INSERT` نمایش داده شد, ما ایجاد 2 قطعات داده. این `SELECT` پرس و جو در انجام شد 2 موضوعات, و ما یک نظم تصادفی از ردیف کردم. سقوط رخ داده است چرا که هیچ ادغام از قطعات داده وجود دارد و در عین حال. تاتر ادغام بخش داده ها در یک لحظه ناشناخته که ما نمی توانیم پیش بینی. + +بنابراین ما نیاز به تجمع: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +اگر ما تجمع نیاز ندارد و می خواهید به زور سقوط, ما می توانیم با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +این روش انتخاب داده ها بسیار کم است. برای میزهای بزرگ ازش استفاده نکن + +## نمونه ای از روش دیگری {#example-of-another-approach} + +اطلاعات نمونه: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ -5 │ -146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +ایده این است که ادغام را به حساب تنها زمینه های کلیدی. و در “Cancel” خط ما می توانیم مقادیر منفی که برابر نسخه های قبلی از ردیف در هنگام جمع بدون استفاده از ستون نشانه را مشخص کنید. برای این روش لازم است نوع داده را تغییر دهید `PageViews`,`Duration` برای ذخیره مقادیر منفی از UInt8 -\> Int16. + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews Int16, + Duration Int16, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +بیایید روش را تست کنیم: + +``` sql +insert into UAct values(4324182021466249494, 5, 146, 1); +insert into UAct values(4324182021466249494, -5, -146, -1); +insert into UAct values(4324182021466249494, 6, 185, 1); + +select * from UAct final; // avoid using final in production (just for a test or small tables) +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +``` sql +SELECT + UserID, + sum(PageViews) AS PageViews, + sum(Duration) AS Duration +FROM UAct +GROUP BY UserID +```text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +``` sqk +select count() FROM UAct +``` + +``` text +┌─count()─┐ +│ 3 │ +└─────────┘ +``` + +``` sql +optimize table UAct final; + +select * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/fa/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/fa/engines/table-engines/mergetree-family/custom-partitioning-key.md new file mode 100644 index 00000000000..e515d1052ee --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,128 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 32 +toc_title: "\u06A9\u0644\u06CC\u062F \u067E\u0627\u0631\u062A\u06CC\u0634\u0646 \u0628\ + \u0646\u062F\u06CC \u0633\u0641\u0627\u0631\u0634\u06CC" +--- + +# کلید پارتیشن بندی سفارشی {#custom-partitioning-key} + +پارتیشن بندی برای [ادغام](mergetree.md) جداول خانواده (شامل [تکرار](replication.md) جدول). [نمایش محقق](../special/materializedview.md) بر اساس جداول ادغام پشتیبانی پارتیشن بندی, همچنین. + +پارتیشن ترکیبی منطقی از سوابق در یک جدول توسط یک معیار مشخص شده است. شما می توانید یک پارتیشن توسط معیار دلخواه تنظیم, مانند ماه, به روز, و یا بر اساس نوع رویداد. هر پارتیشن به طور جداگانه ذخیره می شود به ساده دستکاری این داده ها. هنگام دسترسی به داده ها, تاتر با استفاده از کوچکترین زیر مجموعه از پارتیشن ممکن. + +پارتیشن در مشخص `PARTITION BY expr` بند زمانی که [ایجاد یک جدول](mergetree.md#table_engine-mergetree-creating-a-table). کلید پارتیشن می تواند هر عبارت از ستون های جدول باشد. برای مثال برای مشخص کردن پارتیشن بندی توسط ماه با استفاده از بیان `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour; +``` + +کلید پارتیشن همچنین می تواند یک تاپل از عبارات (شبیه به [کلید اصلی](mergetree.md#primary-keys-and-indexes-in-queries)). به عنوان مثال: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +در این مثال ما مجموعه پارتیشن بندی توسط انواع رویداد رخ داده است که در طول هفته جاری. + +هنگام قرار دادن داده های جدید به یک جدول, این داده ها به عنوان یک بخش جداگانه ذخیره می شود (تکه) مرتب شده بر اساس کلید اصلی. در 10-15 دقیقه پس از قرار دادن, بخش هایی از پارتیشن همان به کل بخش با هم ادغام شدند. + +!!! info "اطلاعات" + ادغام تنها برای قطعات داده که همان مقدار برای بیان پارتیشن بندی کار می کند. این به این معنی است **شما باید پارتیشن بیش از حد دانه را ندارد** (بیش از حدود یک هزار پارتیشن). در غیر این صورت `SELECT` پرس و جو انجام ضعیف به دلیل تعداد نامعقول زیادی از فایل ها در سیستم فایل و توصیف باز کردن فایل. + +استفاده از [سیستم.قطعات](../../../operations/system-tables.md#system_tables-parts) جدول برای مشاهده قطعات جدول و پارتیشن. مثلا, اجازه دهید فرض کنیم که ما یک `visits` جدول با پارتیشن بندی در ماه. بیایید انجام دهیم `SELECT` پرسوجو برای `system.parts` جدول: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 1 │ +│ 201902 │ 201902_11_11_0 │ 1 │ +└───────────┴────────────────┴────────┘ +``` + +این `partition` ستون شامل نام پارتیشن. دو پارتیشن در این مثال وجود دارد: `201901` و `201902`. شما می توانید از این مقدار ستون برای مشخص کردن نام پارتیشن در استفاده کنید [ALTER … PARTITION](#alter_manipulations-with-partitions) نمایش داده شد. + +این `name` ستون شامل نام قطعات داده پارتیشن. شما می توانید از این ستون برای مشخص کردن نام شرکت در [ALTER ATTACH PART](#alter_attach-partition) پرس و جو. + +بیایید شکستن نام بخش اول: `201901_1_3_1`: + +- `201901` نام پارتیشن است. +- `1` حداقل تعداد بلوک داده است. +- `3` حداکثر تعداد بلوک داده است. +- `1` سطح تکه (عمق درخت ادغام از تشکیل شده است). + +!!! info "اطلاعات" + بخش هایی از جداول قدیمی از نوع نام: `20190117_20190123_2_2_0` (حداقل تاریخ - حداکثر تاریخ - حداقل تعداد بلوک - حداکثر تعداد بلوک - سطح). + +این `active` ستون وضعیت بخش را نشان می دهد. `1` فعال است; `0` غیر فعال است. قطعات غیر فعال هستند, مثلا, قطعات منبع باقی مانده پس از ادغام به بخش بزرگتر. قطعات داده خراب نیز به عنوان غیر فعال نشان داد. + +همانطور که شما می توانید در مثال ببینید, چندین بخش از هم جدا از پارتیشن های مشابه وجود دارد (مثلا, `201901_1_3_1` و `201901_1_9_2`). این به این معنی است که این قطعات با هم ادغام شدند و در عین حال. تاتر بخش های داده شده داده ها را به صورت دوره ای در حدود 15 دقیقه پس از قرار دادن ادغام می کند. علاوه بر این, شما می توانید یک ادغام غیر برنامه ریزی شده با استفاده از انجام [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) پرس و جو. مثال: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 0 │ +│ 201902 │ 201902_4_11_2 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 0 │ +│ 201902 │ 201902_11_11_0 │ 0 │ +└───────────┴────────────────┴────────┘ +``` + +قطعات غیر فعال خواهد شد حدود حذف 10 دقیقه پس از ادغام. + +راه دیگر برای مشاهده مجموعه ای از قطعات و پارتیشن ها این است که به دایرکتوری جدول بروید: `/var/lib/clickhouse/data///`. به عنوان مثال: + +``` bash +/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +پوشهها ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ و به همین ترتیب دایرکتوری از قطعات هستند. هر بخش مربوط به پارتیشن مربوطه و شامل داده ها فقط برای یک ماه خاص (جدول در این مثال پارتیشن بندی توسط ماه). + +این `detached` دایرکتوری شامل قطعات است که از جدول با استفاده از جدا شد [DETACH](#alter_detach-partition) پرس و جو. قطعات خراب نیز به این دایرکتوری منتقل, به جای اینکه حذف. سرور از قطعات از `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql-reference/statements/alter.md#alter_attach-partition) پرس و جو. + +توجه داشته باشید که در سرور عامل شما نمی توانید به صورت دستی مجموعه ای از قطعات یا داده های خود را بر روی سیستم فایل تغییر دهید زیرا سرور در این مورد نمی داند. برای جداول غیر تکرار, شما می توانید این کار را انجام زمانی که سرور متوقف شده است, اما توصیه نمی شود. برای جداول تکرار, مجموعه ای از قطعات را نمی توان در هر صورت تغییر. + +کلیک هاوس اجازه می دهد تا شما را به انجام عملیات با پارتیشن: حذف, کپی از یک جدول به دیگری, و یا ایجاد یک نسخه پشتیبان تهیه. مشاهده لیست تمام عملیات در بخش [دستکاری با پارتیشن ها و قطعات](../../../sql-reference/statements/alter.md#alter_manipulations-with-partitions). + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/fa/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/fa/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..1968c5d3046 --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,174 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: "\u0646\u0645\u0648\u062F\u0627\u0631" +--- + +# نمودار {#graphitemergetree} + +این موتور طراحی شده است برای نازک شدن و جمع/متوسط (خلاصه) [گرافیت](http://graphite.readthedocs.io/en/latest/index.html) داده ها. این ممکن است به توسعه دهندگان که می خواهند به استفاده از تاتر به عنوان یک فروشگاه داده ها برای گرافیت مفید است. + +شما می توانید هر موتور جدول کلیک برای ذخیره داده گرافیت اگر شما رولپ نیاز ندارد استفاده, اما اگر شما نیاز به یک استفاده خلاصه `GraphiteMergeTree`. موتور حجم ذخیره سازی را کاهش می دهد و بهره وری نمایش داده شد از گرافیت را افزایش می دهد. + +موتور خواص از ارث می برد [ادغام](mergetree.md). + +## ایجاد یک جدول {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +مشاهده شرح مفصلی از [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) پرس و جو. + +یک جدول برای داده های گرافیت باید ستون های زیر را برای داده های زیر داشته باشد: + +- نام متریک (سنسور گرافیت). نوع داده: `String`. + +- زمان اندازه گیری متریک. نوع داده: `DateTime`. + +- ارزش متریک. نوع داده: هر عددی. + +- نسخه از متریک. نوع داده: هر عددی. + + تاتر موجب صرفه جویی در ردیف با بالاترین نسخه و یا گذشته نوشته شده است اگر نسخه یکسان هستند. ردیف های دیگر در طول ادغام قطعات داده حذف می شوند. + +نام این ستون ها باید در پیکربندی خلاصه مجموعه. + +**پارامترهای نمودار** + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +**بندهای پرسوجو** + +هنگام ایجاد یک `GraphiteMergeTree` جدول, همان [بند](mergetree.md#table_engine-mergetree-creating-a-table) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +همه پارامترها به استثنای `config_section` همان معنی را در `MergeTree`. + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +
+ +## پیکربندی رولپ {#rollup-configuration} + +تنظیمات برای خلاصه توسط تعریف [لغزش \_ نمودار](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) پارامتر در پیکربندی سرور. نام پارامتر می تواند هر. شما می توانید تنظیمات متعددی ایجاد کنید و برای جداول مختلف استفاده کنید. + +ساختار پیکربندی رولپ: + + required-columns + patterns + +### ستون های مورد نیاز {#required-columns} + +- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. +- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. +- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. مقدار پیشفرض: `Value`. +- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. + +### الگوها {#patterns} + +ساختار `patterns` بخش: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "توجه" + الگوها باید به شدت دستور داده شوند: + + 1. Patterns without `function` or `retention`. + 1. Patterns with both `function` and `retention`. + 1. Pattern `default`. + +هنگام پردازش یک ردیف, تاتر چک قوانین در `pattern` بخش. هر یک از `pattern` (شامل `default`) بخش می تواند شامل `function` پارامتر برای تجمع, `retention` پارامترها یا هر دو. اگر نام متریک با `regexp`, قوانین از `pattern` بخش (یا بخش) اعمال می شود; در غیر این صورت, قوانین از `default` بخش استفاده می شود. + +زمینه برای `pattern` و `default` بخش ها: + +- `regexp`– A pattern for the metric name. +- `age` – The minimum age of the data in seconds. +- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). +- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. + +### مثال پیکربندی {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/fa/engines/table_engines/mergetree_family/index.md b/docs/fa/engines/table-engines/mergetree-family/index.md similarity index 100% rename from docs/fa/engines/table_engines/mergetree_family/index.md rename to docs/fa/engines/table-engines/mergetree-family/index.md diff --git a/docs/fa/engines/table-engines/mergetree-family/mergetree.md b/docs/fa/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..c63e6fda534 --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,654 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 30 +toc_title: "\u0627\u062F\u063A\u0627\u0645" +--- + +# ادغام {#table_engines-mergetree} + +این `MergeTree` موتور و سایر موتورهای این خانواده (`*MergeTree`) موتورهای جدول کلیک قوی ترین. + +موتور در `MergeTree` خانواده برای قرار دادن مقدار بسیار زیادی از داده ها را به یک جدول طراحی شده است. داده ها به سرعت به بخش جدول توسط بخش نوشته شده است, سپس قوانین برای ادغام قطعات در پس زمینه اعمال. این روش بسیار موثرتر از به طور مستمر بازنویسی داده ها در ذخیره سازی در درج است. + +ویژگی های اصلی: + +- فروشگاه داده طبقه بندی شده اند توسط کلید اصلی. + + این اجازه می دهد تا به شما برای ایجاد یک شاخص پراکنده کوچک است که کمک می کند تا پیدا کردن اطلاعات سریع تر. + +- پارتیشن ها را می توان در صورت استفاده کرد [کلید پارتیشن بندی](custom-partitioning-key.md) مشخص شده است. + + تاتر پشتیبانی از عملیات خاص با پارتیشن که موثر تر از عملیات عمومی بر روی داده های مشابه با همان نتیجه. کلیک هاوس همچنین به طور خودکار داده های پارتیشن را که کلید پارتیشن بندی در پرس و جو مشخص شده است قطع می کند. این نیز باعث بهبود عملکرد پرس و جو. + +- پشتیبانی از تکرار داده ها. + + خانواده `ReplicatedMergeTree` جداول فراهم می کند تکرار داده ها. برای کسب اطلاعات بیشتر, دیدن [تکرار داده ها](replication.md). + +- پشتیبانی از نمونه برداری داده ها. + + در صورت لزوم می توانید روش نمونه گیری داده ها را در جدول تنظیم کنید. + +!!! info "اطلاعات" + این [ادغام](../special/merge.md) موتور به تعلق ندارد `*MergeTree` خانواده + +## ایجاد یک جدول {#table_engine-mergetree-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 +) ENGINE = MergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] +[SETTINGS name=value, ...] +``` + +برای شرح پارامترها [ایجاد توصیف پرسوجو](../../../sql-reference/statements/create.md). + +!!! note "یادداشت" + `INDEX` یک ویژگی تجربی است [شاخص های داده پرش](#table_engine-mergetree-data_skipping-indexes). + +### بندهای پرسوجو {#mergetree-query-clauses} + +- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. این `MergeTree` موتور پارامترهای ندارد. + +- `PARTITION BY` — The [کلید پارتیشن بندی](custom-partitioning-key.md). + + برای تقسیم ماه از `toYYYYMM(date_column)` عبارت, جایی که `date_column` یک ستون با تاریخ از نوع است [تاریخ](../../../sql-reference/data-types/date.md). نام پارتیشن در اینجا `"YYYYMM"` قالب. + +- `ORDER BY` — The sorting key. + + یک تاپل از ستون ها و یا عبارات دلخواه. مثال: `ORDER BY (CounterID, EventDate)`. + +- `PRIMARY KEY` — The primary key if it [متفاوت از کلید مرتب سازی](#choosing-a-primary-key-that-differs-from-the-sorting-key). + + به طور پیش فرض کلید اصلی همان کلید مرتب سازی است (که توسط مشخص شده است `ORDER BY` بند). بنابراین در اکثر موارد غیر ضروری است برای مشخص کردن یک جداگانه `PRIMARY KEY` بند بند. + +- `SAMPLE BY` — An expression for sampling. + + اگر یک عبارت نمونه برداری استفاده شده است, کلید اصلی باید باشد. مثال: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. + +- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [بین دیسک و حجم](#table_engine-mergetree-multiple-volumes). + + بیان باید یکی داشته باشد `Date` یا `DateTime` ستون به عنوان یک نتیجه. مثال: + `TTL date + INTERVAL 1 DAY` + + نوع قانون `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` مشخص یک عمل با بخش انجام می شود در صورتی که بیان راضی است (می رسد زمان فعلی): حذف ردیف منقضی شده, در حال حرکت بخشی (اگر بیان برای تمام ردیف در یک بخش راضی است) به دیسک مشخص (`TO DISK 'xxx'`) یا به حجم (`TO VOLUME 'xxx'`). نوع پیش فرض قانون حذف است (`DELETE`). فهرست قوانین متعدد می توانید مشخص, اما باید بیش از یک وجود داشته باشد `DELETE` قانون. + + برای اطلاعات بیشتر, دیدن [ستون ها و جداول](#table_engine-mergetree-ttl) + +- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: + + - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [ذخیره سازی داده ها](#mergetree-data-storage). + - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [ذخیره سازی داده ها](#mergetree-data-storage). + - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` تنظیمات. قبل از نسخه 19.11, تنها وجود دارد `index_granularity` تنظیم برای محدود کردن اندازه گرانول. این `index_granularity_bytes` تنظیم را بهبود می بخشد عملکرد کلیک در هنگام انتخاب داده ها از جداول با ردیف بزرگ (ده ها و صدها مگابایت). اگر شما جداول با ردیف بزرگ, شما می توانید این تنظیمات را برای جداول را قادر به بهبود بهره وری از `SELECT` نمایش داده شد. + - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, سپس باغ وحش ذخیره داده های کمتر. برای کسب اطلاعات بیشتر, دیدن [تنظیم توضیحات](../../../operations/server-configuration-parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) داخل “Server configuration parameters”. + - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` بایت, تاتر می خواند و می نویسد داده ها به دیسک ذخیره سازی با استفاده از رابط من/ای مستقیم (`O_DIRECT` گزینه). اگر `min_merge_bytes_to_use_direct_io = 0`, سپس مستقیم من / ای غیر فعال است. مقدار پیشفرض: `10 * 1024 * 1024 * 1024` بایت + + - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). + - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don’t turn it off. + - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. + - `storage_policy` — Storage policy. See [با استفاده از دستگاه های بلوک های متعدد برای ذخیره سازی داده ها](#table_engine-mergetree-multiple-volumes). + +**مثال تنظیمات بخش** + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 +``` + +در مثال ما مجموعه پارتیشن بندی توسط ماه. + +ما همچنین یک عبارت برای نمونه برداری به عنوان یک هش توسط شناسه کاربر تنظیم شده است. این اجازه می دهد تا شما را به نام مستعار داده ها در جدول برای هر `CounterID` و `EventDate`. اگر یک تعریف می کنید [SAMPLE](../../../sql-reference/statements/select.md#select-sample-clause) بند هنگام انتخاب داده ClickHouse را یک به طور مساوی pseudorandom داده های نمونه به صورت زیر مجموعه ای از کاربران است. + +این `index_granularity` تنظیم می تواند حذف شود زیرا 8192 مقدار پیش فرض است. + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + از این روش در پروژه های جدید استفاده نکنید. در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +**پارامترهای ادغام() ** + +- `date-column` — The name of a column of the [تاریخ](../../../sql-reference/data-types/date.md) نوع. تاتر به طور خودکار ایجاد پارتیشن های ماه بر اساس این ستون. نام پارتیشن در `"YYYYMM"` قالب. +- `sampling_expression` — An expression for sampling. +- `(primary, key)` — Primary key. Type: [تاپل()](../../../sql-reference/data-types/tuple.md) +- `index_granularity` — The granularity of an index. The number of data rows between the “marks” از یک شاخص. ارزش 8192 برای بسیاری از وظایف مناسب است. + +**مثال** + +``` sql +MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) +``` + +این `MergeTree` موتور در همان راه به عنوان مثال بالا برای روش پیکربندی موتور اصلی پیکربندی شده است. +
+ +## ذخیره سازی داده ها {#mergetree-data-storage} + +جدول شامل قطعات داده مرتب شده بر اساس کلید اصلی. + +هنگامی که داده ها در یک جدول قرار داده, قطعات داده های جداگانه ایجاد می شوند و هر یک از این واژه ها از لحاظ واژگان توسط کلید اصلی طبقه بندی شده اند. برای مثال اگر کلید اصلی است `(CounterID, Date)` داده ها در بخش طبقه بندی شده اند `CounterID` و در هر `CounterID`, این است که توسط دستور داد `Date`. + +داده های متعلق به پارتیشن های مختلف به بخش های مختلف جدا می شوند. در پس زمینه, کلیکهاوس ادغام قطعات داده ها برای ذخیره سازی موثر تر. قطعات متعلق به پارتیشن های مختلف با هم ادغام شدند. مکانیزم ادغام تضمین نمی کند که تمام ردیف ها با همان کلید اصلی در بخش داده های مشابه باشد. + +هر بخش داده منطقی به گرانول تقسیم شده است. گرانول کوچکترین مجموعه داده های تفکیک پذیر است که خانه می خواند در هنگام انتخاب داده ها است. خانه را کلیک می کند ردیف یا ارزش تقسیم نمی, بنابراین هر گرانول همیشه شامل یک عدد صحیح از ردیف. ردیف اول یک گرانول با ارزش کلید اصلی برای ردیف مشخص شده است. برای هر بخش داده, تاتر ایجاد یک فایل شاخص است که فروشگاه علامت. برای هر ستون, چه در کلید اصلی است یا نه, خانه رعیتی نیز علامت همان فروشگاه. این علامت به شما اجازه داده پیدا کردن به طور مستقیم در فایل های ستون. + +اندازه گرانول توسط `index_granularity` و `index_granularity_bytes` تنظیمات موتور جدول. تعداد ردیف ها در یک گرانول در `[1, index_granularity]` محدوده, بسته به اندازه ردیف. اندازه گرانول می تواند بیش از `index_granularity_bytes` اگر اندازه یک ردیف بیشتر از ارزش تنظیم است. در این مورد, اندازه گرانول برابر اندازه ردیف. + +## کلید های اولیه و شاخص ها در نمایش داده شد {#primary-keys-and-indexes-in-queries} + +نگاهی به `(CounterID, Date)` کلید اصلی به عنوان مثال. در این مورد, مرتب سازی و شاخص را می توان به شرح زیر نشان داده شده: + + Whole data: [---------------------------------------------] + CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] + Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] + Marks: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 + Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 + +اگر پرسوجوی داده مشخص شود: + +- `CounterID in ('a', 'h')`, سرور بار خوانده شده داده ها در محدوده علامت `[0, 3)` و `[6, 8)`. +- `CounterID IN ('a', 'h') AND Date = 3`, سرور بار خوانده شده داده ها در محدوده علامت `[1, 3)` و `[7, 8)`. +- `Date = 3`, سرور می خواند داده ها در طیف وسیعی از علامت `[1, 10]`. + +نمونه های فوق نشان می دهد که همیشه بیشتر موثر برای استفاده از شاخص از اسکن کامل است. + +شاخص پراکنده اجازه می دهد تا داده های اضافی به عنوان خوانده شده. هنگام خواندن یک طیف وسیعی از کلید اصلی, تا `index_granularity * 2` ردیف اضافی در هر بلوک داده را می توان به عنوان خوانده شده. + +شاخص پراکنده اجازه می دهد شما را به کار با تعداد بسیار زیادی از ردیف جدول, چرا که در اکثر موارد, چنین شاخص در رم کامپیوتر مناسب. + +کلیک یک کلید اصلی منحصر به فرد نیاز ندارد. شما می توانید ردیف های متعدد را با همان کلید اولیه وارد کنید. + +### انتخاب کلید اصلی {#selecting-the-primary-key} + +تعداد ستون ها در کلید اصلی به صراحت محدود نمی شود. بسته به ساختار داده ها, شما می توانید ستون های بیشتر یا کمتر در کلید اصلی شامل. این ممکن است: + +- بهبود عملکرد یک شاخص. + + اگر کلید اصلی است `(a, b)` سپس یک ستون دیگر اضافه کنید `c` عملکرد را بهبود می بخشد اگر شرایط زیر رعایت شود: + + - نمایش داده شد با یک شرط در ستون وجود دارد `c`. + - محدوده داده های طولانی (چندین بار طولانی تر از `index_granularity`) با مقادیر یکسان برای `(a, b)` شایع هستند. به عبارت دیگر, در هنگام اضافه کردن یک ستون دیگر اجازه می دهد تا شما را به جست و خیز محدوده داده بسیار طولانی. + +- بهبود فشرده سازی داده ها. + + خانه را کلیک کنید انواع داده ها توسط کلید اصلی, بنابراین بالاتر از ثبات, بهتر فشرده سازی. + +- فراهم می کند که منطق اضافی در هنگام ادغام قطعات داده در [سقوط غذای اصلی](collapsingmergetree.md#table_engine-collapsingmergetree) و [سامینگمرگتری](summingmergetree.md) موتورها. + + در این مورد منطقی است که مشخص شود *کلید مرتب سازی* که متفاوت از کلید اصلی است. + +یک کلید اولیه طولانی منفی عملکرد درج و مصرف حافظه تاثیر می گذارد, اما ستون های اضافی در کلید اصلی انجام عملکرد تاتر در طول تاثیر نمی گذارد `SELECT` نمایش داده شد. + +### انتخاب کلید اصلی است که متفاوت از کلید مرتب سازی {#choosing-a-primary-key-that-differs-from-the-sorting-key} + +ممکن است که به مشخص کردن یک کلید اولیه (بیان با ارزش هایی که در فایل شاخص برای هر علامت نوشته شده است) که متفاوت از کلید مرتب سازی (بیان برای مرتب سازی ردیف در بخش های داده). در این مورد تاپل عبارت کلیدی اولیه باید یک پیشوند از تاپل عبارت کلیدی مرتب سازی شود. + +این ویژگی در هنگام استفاده از مفید است [سامینگمرگتری](summingmergetree.md) و +[ریزدانه](aggregatingmergetree.md) موتورهای جدول. در یک مورد مشترک در هنگام استفاده از این موتور جدول دو نوع ستون است: *ابعاد* و *اقدامات*. نمایش داده شد نمونه مقادیر کل ستون اندازه گیری با دلخواه `GROUP BY` و فیلتر بر اساس ابعاد. چون SummingMergeTree و AggregatingMergeTree جمع ردیف با همان مقدار از مرتب سازی کلیدی است برای اضافه کردن همه ابعاد آن است. در نتیجه, بیان کلیدی شامل یک لیست طولانی از ستون ها و این لیست باید اغلب با ابعاد تازه اضافه شده به روز. + +در این مورد منطقی است که تنها چند ستون در کلید اصلی را ترک کنید که اسکن های محدوده ای موثر را فراهم می کند و ستون های بعد باقی مانده را به دسته کلید مرتب سازی اضافه می کند. + +[ALTER](../../../sql-reference/statements/alter.md) از کلید مرتب سازی یک عملیات سبک وزن است چرا که زمانی که یک ستون جدید به طور همزمان به جدول و به کلید مرتب سازی اضافه, قطعات داده های موجود لازم نیست به تغییر. از کلید مرتب سازی قدیمی یک پیشوند از کلید مرتب سازی جدید است و هیچ داده در ستون به تازگی اضافه شده وجود دارد, داده ها توسط هر دو کلید مرتب سازی قدیمی و جدید در لحظه اصلاح جدول طبقه بندی شده اند. + +### استفاده از شاخص ها و پارتیشن ها در نمایش داده شد {#use-of-indexes-and-partitions-in-queries} + +برای `SELECT` نمایش داده شد, فاحشه خانه تجزیه و تحلیل اینکه یک شاخص می تواند مورد استفاده قرار گیرد. شاخص می تواند مورد استفاده قرار گیرد در صورتی که `WHERE/PREWHERE` بند بیان (به عنوان یکی از عناصر رابطه یا به طور کامل) است که نشان دهنده برابری یا نابرابری عملیات مقایسه و یا اگر `IN` یا `LIKE` با یک پیشوند ثابت در ستون ها و یا عبارات که در کلید اصلی و یا پارتیشن بندی هستند, و یا در برخی از توابع تا حدی تکراری از این ستون ها, و یا روابط منطقی از این عبارات. + +بدین ترتیب, ممکن است به سرعت اجرا نمایش داده شد در یک یا بسیاری از محدوده کلید اصلی. در این مثال, نمایش داده شد سریع خواهد بود که برای یک تگ ردیابی خاص اجرا, برای یک برچسب خاص و محدوده تاریخ, برای یک تگ و تاریخ خاص, برای برچسب های متعدد با محدوده تاریخ, و غیره. + +بیایید به موتور پیکربندی شده به شرح زیر نگاه کنیم: + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 + +در این مورد در نمایش داده شد: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +خانه رعیتی خواهد شاخص کلید اصلی به تر و تمیز داده های نامناسب و کلید پارتیشن بندی ماهانه به تر و تمیز پارتیشن که در محدوده تاریخ نامناسب هستند استفاده کنید. + +نمایش داده شد بالا نشان می دهد که شاخص حتی برای عبارات پیچیده استفاده می شود. خواندن از جدول سازمان یافته است به طوری که با استفاده از شاخص نمی تواند کندتر از اسکن کامل. + +در مثال زیر شاخص نمی تواند مورد استفاده قرار گیرد. + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +برای بررسی اینکه تاتر می توانید شاخص زمانی که در حال اجرا یک پرس و جو استفاده, استفاده از تنظیمات [اجبار](../../../operations/settings/settings.md#settings-force_index_by_date) و [اجبار](../../../operations/settings/settings.md). + +کلید پارتیشن بندی توسط ماه اجازه می دهد تا خواندن تنها کسانی که بلوک های داده که حاوی تاریخ از محدوده مناسب. در این مورد, بلوک داده ها ممکن است حاوی داده ها برای بسیاری از تاریخ (تا یک ماه کامل). در یک بلوک, داده ها توسط کلید اصلی طبقه بندی شده اند, که ممکن است حاوی تاریخ به عنوان ستون اول نیست. به خاطر همین, با استفاده از یک پرس و جو تنها با یک وضعیت تاریخ که پیشوند کلید اصلی مشخص نیست باعث می شود اطلاعات بیشتر از یک تاریخ به عنوان خوانده شود. + +### استفاده از شاخص برای کلید های اولیه تا حدی یکنواخت {#use-of-index-for-partially-monotonic-primary-keys} + +در نظر بگیرید, مثلا, روز از ماه. یک فرم [توالی یکنواختی](https://en.wikipedia.org/wiki/Monotonic_function) برای یک ماه, اما برای مدت طولانی تر یکنواخت نیست. این یک توالی نیمه یکنواخت است. اگر یک کاربر ایجاد جدول با نیمه یکنواخت کلید اولیه, خانه را ایجاد یک شاخص پراکنده به طور معمول. هنگامی که یک کاربر داده ها را انتخاب از این نوع از جدول, تاتر تجزیه و تحلیل شرایط پرس و جو. اگر کاربر می خواهد برای دریافت اطلاعات بین دو علامت از شاخص و هر دو این علامت در عرض یک ماه سقوط, خانه رعیتی می توانید شاخص در این مورد خاص استفاده کنید زیرا می تواند فاصله بین پارامترهای یک پرس و جو و شاخص محاسبه. + +کلیک خانه می تواند یک شاخص استفاده کنید اگر ارزش های کلید اصلی در محدوده پارامتر پرس و جو یک توالی یکنواخت نشان دهنده نیست. در این مورد, تاتر با استفاده از روش اسکن کامل. + +تاتر با استفاده از این منطق نه تنها برای روز از توالی ماه, اما برای هر کلید اصلی است که نشان دهنده یک توالی نیمه یکنواخت. + +### شاخص های پرش داده (تجربی) {#table_engine-mergetree-data_skipping-indexes} + +اعلامیه شاخص در بخش ستون ها از `CREATE` پرس و جو. + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +برای جداول از `*MergeTree` خانواده, شاخص پرش داده را می توان مشخص. + +این شاخص جمع برخی از اطلاعات در مورد بیان مشخص شده بر روی بلوک, که شامل `granularity_value` گرانول (اندازه گرانول با استفاده از `index_granularity` تنظیم در موتور جدول). سپس این دانه ها در استفاده می شود `SELECT` نمایش داده شد برای کاهش مقدار داده ها به خواندن از روی دیسک با پرش بلوک های بزرگ از داده ها که `where` پرس و جو نمی تواند راضی باشد. + +**مثال** + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +شاخص ها از مثال می توانند توسط کلیک خانه استفاده شوند تا میزان داده ها را برای خواندن از دیسک در موارد زیر کاهش دهند: + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### انواع شاخص های موجود {#available-types-of-indices} + +- `minmax` + + فروشگاه افراط و بیان مشخص شده (در صورتی که بیان شده است `tuple` سپس افراط را برای هر عنصر ذخیره می کند `tuple`), با استفاده از اطلاعات ذخیره شده برای پرش بلوک از داده ها مانند کلید اصلی. + +- `set(max_rows)` + + ارزش های منحصر به فرد بیان مشخص شده را ذخیره می کند (بیش از `max_rows` سطرها, `max_rows=0` یعنی “no limits”). با استفاده از مقادیر برای بررسی در صورتی که `WHERE` بیان رضایت بخش در یک بلوک از داده ها نیست. + +- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + فروشگاه ها [فیلتر بلوم](https://en.wikipedia.org/wiki/Bloom_filter) که شامل تمام نمگرام از یک بلوک از داده ها. این نسخهها کار میکند تنها با رشته. می توان برای بهینه سازی استفاده کرد `equals`, `like` و `in` عبارات. + + - `n` — ngram size, + - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). + - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. + - `random_seed` — The seed for Bloom filter hash functions. + +- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + همان `ngrambf_v1`, اما فروشگاه نشانه به جای نمرگرام. نشانه ها توالی هایی هستند که توسط شخصیت های غیر عددی جدا شده اند. + +- `bloom_filter([false_positive])` — Stores a [فیلتر بلوم](https://en.wikipedia.org/wiki/Bloom_filter) برای ستون مشخص. + + اختیاری `false_positive` پارامتر احتمال دریافت پاسخ مثبت کاذب از فیلتر است. مقادیر ممکن: (0, 1). مقدار پیش فرض: 0.025. + + انواع داده های پشتیبانی شده: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. + + توابع زیر می توانند از این استفاده کنند: [برابر](../../../sql-reference/functions/comparison-functions.md), [نقلقولها](../../../sql-reference/functions/comparison-functions.md), [داخل](../../../sql-reference/functions/in-functions.md), [notIn](../../../sql-reference/functions/in-functions.md), [دارد](../../../sql-reference/functions/array-functions.md). + + + +``` sql +INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 +INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 +``` + +#### توابع پشتیبانی {#functions-support} + +شرایط در `WHERE` بند شامل تماس از توابع است که با ستون کار. اگر ستون بخشی از یک شاخص است, خانه رعیتی تلاش می کند تا استفاده از این شاخص در هنگام انجام توابع. تاتر از زیر مجموعه های مختلف از توابع برای استفاده از شاخص. + +این `set` شاخص را می توان با تمام توابع استفاده می شود. زیر مجموعه های تابع برای شاخص های دیگر در جدول زیر نشان داده شده است. + +| تابع (اپراتور) / شاخص | کلید اصلی | مینمکس | نمرمبف1 | توکنبف1 | ت\_ضعیت | +|----------------------------------------------------------------------------------------------------------------------|-----------|--------|---------|---------|---------| +| [اطلاعات دقیق)](../../../sql-reference/functions/comparison-functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [نقلقولهای جدید از این نویسنده=, \<\>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [مانند](../../../sql-reference/functions/string-search-functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [notLike](../../../sql-reference/functions/string-search-functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [startsWith](../../../sql-reference/functions/string-functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [endsWith](../../../sql-reference/functions/string-functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [چندزبانه](../../../sql-reference/functions/string-search-functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | +| [داخل](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notIn](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [کمتر (\<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [بیشتر (\>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [در حال بارگذاری)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [اطلاعات دقیق)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [خالی](../../../sql-reference/functions/array-functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [notEmpty](../../../sql-reference/functions/array-functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| شتابدهنده | ✗ | ✗ | ✗ | ✔ | ✗ | + +توابع با استدلال ثابت است که کمتر از اندازه نیگرام می تواند توسط استفاده نمی شود `ngrambf_v1` برای بهینه سازی پرس و جو. + +فیلتر بلوم می توانید مسابقات مثبت کاذب دارند, به طوری که `ngrambf_v1`, `tokenbf_v1` و `bloom_filter` شاخص ها نمی توانند برای بهینه سازی پرس و جو هایی که انتظار می رود نتیجه عملکرد نادرست باشد استفاده شوند: + +- می توان بهینه سازی کرد: + - `s LIKE '%test%'` + - `NOT s NOT LIKE '%test%'` + - `s = 1` + - `NOT s != 1` + - `startsWith(s, 'test')` +- نمی توان بهینه سازی کرد: + - `NOT s LIKE '%test%'` + - `s NOT LIKE '%test%'` + - `NOT s = 1` + - `s != 1` + - `NOT startsWith(s, 'test')` + +## دسترسی همزمان داده ها {#concurrent-data-access} + +برای دسترسی به جدول همزمان, ما با استفاده از چند نسخه. به عبارت دیگر, زمانی که یک جدول به طور همزمان خواندن و به روز, داده ها از مجموعه ای از قطعات است که در زمان پرس و جو در حال حاضر به عنوان خوانده شده. هیچ قفل طولانی وجود دارد. درج در راه عملیات خواندن نیست. + +خواندن از یک جدول به طور خودکار موازی. + +## ستون ها و جداول {#table_engine-mergetree-ttl} + +تعیین طول عمر ارزش. + +این `TTL` بند را می توان برای کل جدول و برای هر ستون فردی تنظیم شده است. همچنین منطق حرکت خودکار داده ها بین دیسک ها و حجم ها را مشخص می کند. + +عبارات باید به ارزیابی [تاریخ](../../../sql-reference/data-types/date.md) یا [DateTime](../../../sql-reference/data-types/datetime.md) نوع داده. + +مثال: + +``` sql +TTL time_column +TTL time_column + interval +``` + +برای تعریف `interval` استفاده [فاصله زمانی](../../../sql-reference/operators.md#operators-datetime) اپراتورها. + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### ستون {#mergetree-column-ttl} + +هنگامی که مقادیر در ستون منقضی, خانه را جایگزین با مقادیر پیش فرض برای نوع داده ستون. اگر تمام مقادیر ستون در بخش داده منقضی, تاتر حذف این ستون از بخش داده ها در یک سیستم فایل. + +این `TTL` بند را نمی توان برای ستون های کلیدی استفاده کرد. + +مثالها: + +ایجاد یک جدول با تی ال + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +اضافه کردن تی ال به یک ستون از یک جدول موجود + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +تغییر تعداد ستون + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### جدول {#mergetree-table-ttl} + +جدول می تواند بیان برای حذف ردیف منقضی شده و عبارات متعدد برای حرکت خودکار قطعات بین [دیسک یا حجم](#table_engine-mergetree-multiple-volumes). هنگامی که ردیف در جدول منقضی, تاتر حذف تمام ردیف مربوطه. برای قطعات در حال حرکت از ویژگی های, تمام ردیف از یک بخش باید معیارهای بیان جنبش را تامین کند. + +``` sql +TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... +``` + +نوع قانون کنترل هوشمند ممکن است هر عبارت را دنبال کند. این تاثیر می گذارد یک عمل است که باید انجام شود یک بار بیان راضی است (زمان فعلی می رسد): + +- `DELETE` - حذف ردیف منقضی شده (اقدام پیش فرض); +- `TO DISK 'aaa'` - انتقال بخشی به دیسک `aaa`; +- `TO VOLUME 'bbb'` - انتقال بخشی به دیسک `bbb`. + +مثالها: + +ایجاد یک جدول با تی ال + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH [DELETE], + d + INTERVAL 1 WEEK TO VOLUME 'aaa', + d + INTERVAL 2 WEEK TO DISK 'bbb'; +``` + +تغییر تعداد جدول + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**حذف داده ها** + +داده ها با یک حذف شده است زمانی که محل انتخابی ادغام قطعات داده. + +هنگامی که کلیک خانه را ببینید که داده تمام شده است, انجام یک ادغام خارج از برنامه. برای کنترل فرکانس چنین ادغام, شما می توانید مجموعه [ادغام \_بههنگامسازی](#mergetree_setting-merge_with_ttl_timeout). اگر مقدار خیلی کم است, این بسیاری از ادغام خارج از برنامه است که ممکن است مقدار زیادی از منابع مصرف انجام. + +اگر شما انجام `SELECT` پرس و جو بین ادغام, شما ممکن است داده های منقضی شده. برای جلوگیری از استفاده از [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) پرسوجو قبل از `SELECT`. + +## با استفاده از دستگاه های بلوک های متعدد برای ذخیره سازی داده ها {#table_engine-mergetree-multiple-volumes} + +### معرفی شرکت {#introduction} + +`MergeTree` موتورهای جدول خانواده می تواند داده ها در دستگاه های بلوک های متعدد ذخیره کنید. مثلا, این می تواند مفید باشد زمانی که داده ها از یک جدول خاص به طور ضمنی به تقسیم “hot” و “cold”. داده های اخیر به طور منظم درخواست شده است اما نیاز به تنها مقدار کمی از فضای. برعکس, داده های تاریخی چربی دم به ندرت درخواست. اگر چندین دیسک در دسترس هستند “hot” داده ها ممکن است بر روی دیسک های سریع واقع (مثلا, اس اس اس اس بلوم و یا در حافظه), در حالی که “cold” داده ها بر روی موارد نسبتا کند (مثلا هارد). + +بخش داده ها حداقل واحد متحرک برای `MergeTree`- جدول موتور . داده های متعلق به یک بخش بر روی یک دیسک ذخیره می شود. قطعات داده را می توان بین دیسک در پس زمینه (با توجه به تنظیمات کاربر) و همچنین با استفاده از نقل مکان کرد [ALTER](../../../sql-reference/statements/alter.md#alter_move-partition) نمایش داده شد. + +### شرایط {#terms} + +- Disk — Block device mounted to the filesystem. +- Default disk — Disk that stores the path specified in the [مسیر](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) تنظیم سرور. +- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). +- Storage policy — Set of volumes and the rules for moving data between them. + +اسامی داده شده به اشخاص توصیف شده را می توان در جداول سیستم یافت می شود, [سیستم.داستان\_یابی](../../../operations/system-tables.md#system_tables-storage_policies) و [سیستم.دیسکها](../../../operations/system-tables.md#system_tables-disks). برای اعمال یکی از سیاست های ذخیره سازی پیکربندی شده برای یک جدول از `storage_policy` تنظیم از `MergeTree`- جداول خانواده موتور . + +### پیکربندی {#table_engine-mergetree-multiple-volumes-configure} + +دیسک, حجم و سیاست های ذخیره سازی باید در داخل اعلام `` برچسب یا در فایل اصلی `config.xml` یا در یک فایل مجزا در `config.d` فهرست راهنما. + +ساختار پیکربندی: + +``` xml + + + + /mnt/fast_ssd/clickhouse/ + + + /mnt/hdd1/clickhouse/ + 10485760 + + + /mnt/hdd2/clickhouse/ + 10485760 + + + ... + + + ... + +``` + +برچسبها: + +- `` — Disk name. Names must be different for all disks. +- `path` — path under which a server will store data (`data` و `shadow` پوشه ها) باید با پایان ‘/’. +- `keep_free_space_bytes` — the amount of free disk space to be reserved. + +منظور از تعریف دیسک مهم نیست. + +نشانه گذاری پیکربندی سیاست های ذخیره سازی: + +``` xml + + ... + + + + + disk_name_from_disks_configuration + 1073741824 + + + + + + + 0.2 + + + + + + + + ... + +``` + +برچسبها: + +- `policy_name_N` — Policy name. Policy names must be unique. +- `volume_name_N` — Volume name. Volume names must be unique. +- `disk` — a disk within a volume. +- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. +- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). + +Cofiguration نمونه: + +``` xml + + ... + + + + + disk1 + disk2 + + + + + + + + fast_ssd + 1073741824 + + + disk1 + + + 0.2 + + + ... + +``` + +در مثال داده شده `hdd_in_order` سیاست پیاده سازی [گرد رابین](https://en.wikipedia.org/wiki/Round-robin_scheduling) نزدیک شو بنابراین این سیاست تنها یک جلد را تعریف می کند (`single`), قطعات داده ها بر روی تمام دیسک های خود را به ترتیب دایره ای ذخیره می شود. چنین سیاستی می تواند بسیار مفید اگر چندین دیسک مشابه به سیستم نصب شده وجود دارد, اما حمله پیکربندی نشده است. به خاطر داشته باشید که هر درایو دیسک منحصر به فرد قابل اعتماد نیست و شما ممکن است بخواهید با عامل تکرار 3 یا بیشتر جبران. + +اگر انواع مختلف دیسک های موجود در سیستم وجود دارد, `moving_from_ssd_to_hdd` سیاست را می توان به جای استفاده. حجم `hot` شامل یک دیسک اس اس دی (`fast_ssd`), و حداکثر اندازه یک بخش است که می تواند در این حجم ذخیره شده است 1گیگابایت. تمام قطعات با اندازه بزرگتر از 1 گیگابایت به طور مستقیم در `cold` حجم, که شامل یک دیسک هارد `disk1`. +همچنین هنگامی که دیسک `fast_ssd` می شود توسط بیش از پر 80%, داده خواهد شد به انتقال `disk1` توسط یک فرایند پس زمینه. + +منظور شمارش حجم در یک سیاست ذخیره سازی مهم است. هنگامی که یک حجم پر شده است, داده ها به یک بعدی منتقل. ترتیب شمارش دیسک نیز مهم است زیرا داده ها در نوبت ذخیره می شوند. + +هنگام ایجاد یک جدول می توان یکی از سیاست های ذخیره سازی پیکربندی شده را اعمال کرد: + +``` sql +CREATE TABLE table_with_non_default_policy ( + EventDate Date, + OrderID UInt64, + BannerID UInt64, + SearchPhrase String +) ENGINE = MergeTree +ORDER BY (OrderID, BannerID) +PARTITION BY toYYYYMM(EventDate) +SETTINGS storage_policy = 'moving_from_ssd_to_hdd' +``` + +این `default` سیاست ذخیره سازی نشان میدهد تنها با استفاده از یک حجم, که متشکل از تنها یک دیسک داده شده در ``. هنگامی که یک جدول ایجاد شده است, سیاست ذخیره سازی خود را نمی توان تغییر داد. + +### اطلاعات دقیق {#details} + +در مورد `MergeTree` جداول داده ها به دیسک در راه های مختلف گرفتن است: + +- به عنوان یک نتیجه از درج (`INSERT` پرسوجو). +- در طول پس زمینه ادغام و [جهشها](../../../sql-reference/statements/alter.md#alter-mutations). +- هنگام دانلود از ماکت دیگر. +- به عنوان یک نتیجه از انجماد پارتیشن [ALTER TABLE … FREEZE PARTITION](../../../sql-reference/statements/alter.md#alter_freeze-partition). + +در تمام این موارد به جز جهش و پارتیشن انجماد بخش ذخیره شده در حجم و دیسک با توجه به سیاست ذخیره سازی داده شده است: + +1. جلد اول (به ترتیب تعریف) که فضای دیسک به اندازه کافی برای ذخیره سازی یک بخش (`unreserved_space > current_part_size`) و اجازه می دهد تا برای ذخیره سازی بخش هایی از اندازه داده شده (`max_data_part_size_bytes > current_part_size`) انتخاب شده است . +2. در این حجم, که دیسک انتخاب شده است که به دنبال یکی, که برای ذخیره سازی تکه های قبلی از داده مورد استفاده قرار گرفت, و دارای فضای رایگان بیش از اندازه بخش (`unreserved_space - keep_free_space_bytes > current_part_size`). + +تحت هود جهش و پارتیشن انجماد استفاده از [لینک های سخت](https://en.wikipedia.org/wiki/Hard_link). لینک های سخت بین دیسک های مختلف پشتیبانی نمی شوند بنابراین در چنین مواردی قطعات حاصل شده بر روی دیسک های مشابه به عنوان اولیه ذخیره می شوند. + +در پس زمینه, قطعات بین حجم بر اساس مقدار فضای رایگان نقل مکان کرد (`move_factor` پارامتر) با توجه به سفارش حجم در فایل پیکربندی اعلام کرد. +داده ها هرگز از گذشته و به یکی از اولین منتقل شده است. ممکن است از جداول سیستم استفاده کنید [سیستم.\_خروج](../../../operations/system-tables.md#system_tables-part-log) (زمینه `type = MOVE_PART`) و [سیستم.قطعات](../../../operations/system-tables.md#system_tables-parts) (فیلدها `path` و `disk`) برای نظارت بر حرکت پس زمینه . همچنین, اطلاعات دقیق را می توان در سیاهههای مربوط به سرور پیدا شده است. + +کاربر می تواند نیروی حرکت بخشی یا پارتیشن از یک حجم به دیگری با استفاده از پرس و جو [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql-reference/statements/alter.md#alter_move-partition), تمام محدودیت برای عملیات پس زمینه در نظر گرفته شود. پرس و جو شروع یک حرکت به خودی خود و منتظر نیست برای عملیات پس زمینه به پایان خواهد رسید. کاربر یک پیام خطا اگر فضای رایگان به اندازه کافی در دسترس است و یا اگر هر یک از شرایط مورد نیاز را ملاقات کرد. + +داده های متحرک با تکرار داده ها دخالت نمی کنند. از این رو, سیاست های ذخیره سازی مختلف را می توان برای همان جدول در کپی های مختلف مشخص. + +پس از اتمام ادغام پس زمینه و جهش, قطعات قدیمی تنها پس از یک مقدار مشخصی از زمان حذف (`old_parts_lifetime`). +در طول این زمان به حجم یا دیسک های دیگر منتقل نمی شوند. از این رو, تا زمانی که قطعات در نهایت حذف, هنوز هم به حساب برای ارزیابی فضای دیسک اشغال گرفته. + +[مقاله اصلی](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/fa/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/fa/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..60624725f6f --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,69 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: "\u062C\u0627\u06CC\u06AF\u0632\u06CC\u0646\u06CC" +--- + +# جایگزینی {#replacingmergetree} + +موتور متفاوت از [ادغام](mergetree.md#table_engines-mergetree) در که حذف نوشته های تکراری با همان مقدار اصلی کلید (یا دقیق تر, با همان [کلید مرتب سازی](mergetree.md) ارزش). + +تقسیم داده ها تنها در یک ادغام رخ می دهد. ادغام در پس زمینه در زمان ناشناخته رخ می دهد بنابراین شما نمی توانید برنامه ریزی کنید. برخی از داده ها ممکن است بدون پردازش باقی می ماند. اگر چه شما می توانید ادغام برنامه ریزی با استفاده از اجرا `OPTIMIZE` پرس و جو, در استفاده از این حساب نمی, به این دلیل که `OPTIMIZE` پرس و جو خواندن و نوشتن مقدار زیادی از داده ها. + +بدین ترتیب, `ReplacingMergeTree` مناسب برای پاک کردن داده های تکراری در پس زمینه برای صرفه جویی در فضا است اما عدم وجود تکراری را تضمین نمی کند. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +برای شرح پارامترهای درخواست را ببینید [درخواست توضیحات](../../../sql-reference/statements/create.md). + +**پارامترهای جایگزین** + +- `ver` — column with version. Type `UInt*`, `Date` یا `DateTime`. پارامتر اختیاری. + + هنگام ادغام, `ReplacingMergeTree` از تمام ردیف ها با همان کلید اصلی تنها یک برگ دارد: + + - گذشته در انتخاب, اگر `ver` تنظیم نشده است. + - با حداکثر نسخه, اگر `ver` مشخص. + +**بندهای پرسوجو** + +هنگام ایجاد یک `ReplacingMergeTree` جدول همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +همه پارامترها به استثنای `ver` همان معنی را در `MergeTree`. + +- `ver` - ستون با نسخه . پارامتر اختیاری. برای شرح, متن بالا را ببینید. + +
+ +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/fa/engines/table-engines/mergetree-family/replication.md b/docs/fa/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..16c2f0218eb --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,218 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 31 +toc_title: "\u062A\u06A9\u0631\u0627\u0631 \u062F\u0627\u062F\u0647 \u0647\u0627" +--- + +# تکرار داده ها {#table_engines-replication} + +تکرار تنها برای جداول در خانواده ادغام پشتیبانی می شود: + +- تکرار غذای اصلی +- تکرار می شود +- جایگزینی تکراری +- تکرار پلاکتی مگرمرگتری +- تکرار تغییرات +- تکرار مجدد محصول +- تکرار کننده + +تکرار کار می کند در سطح یک جدول فردی, نه کل سرور. سرور می تواند هر دو جدول تکرار و غیر تکرار در همان زمان ذخیره کنید. + +تکرار بستگی ندارد sharding. هر سفال تکرار مستقل خود را دارد. + +داده های فشرده برای `INSERT` و `ALTER` نمایش داده شد تکرار شده است (برای اطلاعات بیشتر, اسناد و مدارک برای دیدن [ALTER](../../../sql-reference/statements/alter.md#query_language_queries_alter)). + +`CREATE`, `DROP`, `ATTACH`, `DETACH` و `RENAME` نمایش داده شد بر روی یک سرور اجرا و تکرار نیست: + +- این `CREATE TABLE` پرس و جو ایجاد یک جدول تکرار جدید بر روی سرور که پرس و جو اجرا شده است. اگر این جدول در حال حاضر بر روی سرور های دیگر وجود دارد, اضافه می کند یک ماکت جدید. +- این `DROP TABLE` پرس و جو حذف ماکت واقع در سرور که پرس و جو اجرا شده است. +- این `RENAME` پرس و جو تغییر نام جدول در یکی از کپی. به عبارت دیگر, جداول تکرار می توانید نام های مختلف در کپی های مختلف دارند. + +استفاده از کلیک [سرویس پرداخت درونبرنامهای پلی](https://zookeeper.apache.org) برای ذخیره سازی اطلاعات متا کپی. استفاده از باغ وحش نسخه 3.4.5 یا جدیدتر. + +برای استفاده از تکرار, پارامترهای مجموعه ای در [باغ وحش](../../../operations/server-configuration-parameters/settings.md#server-settings_zookeeper) بخش پیکربندی سرور. + +!!! attention "توجه" + هنوز تنظیمات امنیتی غفلت نیست. تاتر از `digest` [طرح اکل](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) از زیر سیستم امنیتی باغ وحش. + +به عنوان مثال از تنظیم نشانی های خوشه باغ وحش: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +شما می توانید هر خوشه باغ وحش موجود را مشخص کنید و سیستم یک دایرکتوری را برای داده های خود استفاده می کند (دایرکتوری هنگام ایجاد یک جدول تکرار شده مشخص می شود). + +اگر باغ وحش در فایل پیکربندی تنظیم نشده, شما می توانید جداول تکرار ایجاد کنید, و هر جداول تکرار موجود خواهد شد فقط به عنوان خوانده شده. + +باغ وحش در استفاده نمی شود `SELECT` نمایش داده شد به دلیل تکرار می کند عملکرد تاثیر نمی گذارد `SELECT` و نمایش داده شد اجرا فقط به همان سرعتی که برای جداول غیر تکرار انجام می دهند. هنگامی که پرس و جو جداول تکرار توزیع, رفتار کلیک است که توسط تنظیمات کنترل [\_شروع مجدد \_شروع مجدد \_شروع مجدد \_کاربری](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) و [شناسه بسته:](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). + +برای هر `INSERT` پرس و جو, حدود ده ورودی از طریق معاملات چند به باغ وحش دار اضافه. (به عبارت دقیق تر, این است که برای هر بلوک قرار داده شده از داده; پرس و جو درج شامل یک بلوک و یا یک بلوک در هر `max_insert_block_size = 1048576` ردیف) این منجر به زمان شروع کمی طولانی تر برای `INSERT` در مقایسه با جداول غیر تکرار. اما اگر شما به دنبال توصیه برای وارد کردن داده ها در دسته بیش از یک `INSERT` در هر ثانیه هیچ مشکلی ایجاد نمی کند. کل خوشه محل کلیک مورد استفاده برای هماهنگی یک خوشه باغ وحش در مجموع چند صد است `INSERTs` در هر ثانیه. توان در درج داده (تعداد ردیف در ثانیه) فقط به عنوان بالا به عنوان داده های غیر تکرار شده است. + +برای خوشه های بسیار بزرگ, شما می توانید خوشه باغ وحش های مختلف برای خرده ریز های مختلف استفاده کنید. با این حال, این لازم در یاندکس ثابت نشده.متریکا خوشه (تقریبا 300 سرور). + +تکرار ناهمزمان و چند استاد است. `INSERT` نمایش داده شد (و همچنین `ALTER`) را می توان به هر سرور در دسترس ارسال می شود. داده ها بر روی سرور قرار می گیرند که پرس و جو اجرا می شود و سپس به سرورهای دیگر کپی می شود. زیرا ناهمگام است, داده به تازگی قرار داده شده در کپی دیگر با برخی از تاخیر به نظر می رسد. اگر بخشی از کپی در دسترس نیست, داده ها نوشته شده است که در دسترس تبدیل. اگر یک ماکت در دسترس است, تاخیر مقدار زمان لازم برای انتقال بلوک از داده های فشرده بر روی شبکه است. + +به طور پیش فرض, پرس و جو درج منتظر تایید نوشتن داده ها از تنها یک ماکت. اگر داده ها با موفقیت به تنها یک ماکت نوشته شده بود و سرور با این ماکت متوقف به وجود, داده های ذخیره شده از دست خواهد رفت. برای فعال کردن گرفتن تایید داده ها می نویسد: از کپی های متعدد با استفاده از `insert_quorum` انتخاب + +هر بلوک از داده ها به صورت اتمی نوشته شده است. پرس و جو درج شده است را به بلوک تا تقسیم `max_insert_block_size = 1048576` ردیف به عبارت دیگر اگر `INSERT` پرس و جو کمتر از 1048576 ردیف, این است که به صورت اتمی ساخته شده. + +بلوک های داده تقسیم می شوند. برای چند می نویسد از بلوک داده های مشابه (بلوک های داده از همان اندازه حاوی ردیف در همان جهت) بلوک تنها یک بار نوشته شده است. دلیل این کار این است که در صورت شکست شبکه زمانی که نرم افزار سرویس گیرنده نمی داند که اگر داده ها به دسی بل نوشته شده بود, بنابراین `INSERT` پرس و جو به سادگی می تواند تکرار شود. مهم نیست که درج ماکت با داده های یکسان فرستاده شد. `INSERTs` ژولیده اند. پارامترهای تقسیم بندی توسط [ادغام](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-merge_tree) تنظیمات سرور. + +در طول تکرار, تنها داده های منبع برای وارد کردن بر روی شبکه منتقل. تحول داده های بیشتر (ادغام) هماهنگ و در تمام کپی در همان راه انجام. این به حداقل می رساند استفاده از شبکه, به این معنی که تکرار خوبی کار می کند زمانی که کپی در مراکز داده های مختلف اقامت. (توجه داشته باشید که تکثیر داده ها در مراکز داده های مختلف هدف اصلی از تکرار است.) + +شما می توانید هر تعداد از کپی از داده های مشابه داشته باشد. یاندکسمتریکا از تکرار دوگانه در تولید استفاده می کند. هر سرور با استفاده از حمله-5 و یا حمله-6, و حمله-10 در برخی موارد. این یک راه حل نسبتا قابل اعتماد و راحت است. + +سیستم نظارت بر هماهنگ سازی داده ها در کپی و قادر به بازیابی پس از شکست است. عدم موفقیت خودکار است (برای تفاوت های کوچک در داده ها) و یا نیمه اتوماتیک (زمانی که داده ها متفاوت بیش از حد, که ممکن است یک خطای پیکربندی نشان می دهد). + +## ایجاد جداول تکرار شده {#creating-replicated-tables} + +این `Replicated` پیشوند به نام موتور جدول اضافه شده است. به عنوان مثال:`ReplicatedMergeTree`. + +**تکرار \* پارامترهای ادغام** + +- `zoo_path` — The path to the table in ZooKeeper. +- `replica_name` — The replica name in ZooKeeper. + +مثال: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +
+ +به عنوان مثال در نحو توصیه + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +
+ +به عنوان مثال نشان می دهد, این پارامترها می تواند تعویض در براکت فرفری شامل. مقادیر جایگزین از گرفته ‘macros’ بخش از فایل پیکربندی. مثال: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +مسیر به جدول در باغ وحش باید منحصر به فرد برای هر جدول تکرار شود. جداول در خرده ریز های مختلف باید مسیرهای مختلف داشته باشد. +در این مورد مسیر شامل قسمت های زیر است: + +`/clickhouse/tables/` پیشوند رایج است. ما توصیه می کنیم با استفاده از دقیقا این یکی. + +`{layer}-{shard}` شناسه سفال است. در این مثال شامل دو بخش از یاندکس.متریکا خوشه با استفاده از دو سطح شاردینگ. برای بسیاری از وظایف, شما می توانید فقط جایگزینی {سفال} ترک, خواهد شد که به شناسه سفال گسترش. + +`table_name` نام گره برای جدول در باغ وحش است. این یک ایده خوب را به همان نام جدول است. این است که به صراحت تعریف, چرا که در مقابل به نام جدول, این کار پس از یک پرس و جو تغییر نام نمی. +*HINT*: شما می توانید یک نام پایگاه داده در مقابل اضافه کنید `table_name` همینطور E. g. `db_name.table_name` + +نام ماکت شناسایی کپی های مختلف از همان جدول. شما می توانید نام سرور برای این استفاده, همانطور که در مثال. نام تنها نیاز به منحصر به فرد در هر سفال. + +شما می توانید پارامترهای صراحت به جای استفاده از تعویض تعریف کنیم. این ممکن است مناسب برای تست و برای پیکربندی خوشه های کوچک. با این حال, شما می توانید نمایش داده شد توزیع دی ال استفاده کنید (`ON CLUSTER`) در این مورد. + +هنگام کار با خوشه های بزرگ, توصیه می کنیم با استفاده از تعویض زیرا احتمال خطا را کاهش می دهد. + +اجرای `CREATE TABLE` پرس و جو در هر ماکت. این پرس و جو ایجاد یک جدول تکرار جدید, و یا می افزاید: یک ماکت جدید به یک موجود. + +اگر شما اضافه کردن یک ماکت جدید پس از جدول در حال حاضر شامل برخی از داده ها در کپی های دیگر کپی داده ها از کپی های دیگر کپی به یکی از جدید پس از اجرای پرس و جو. به عبارت دیگر, ماکت جدید خود را با دیگران همگام سازی. + +برای حذف یک ماکت, اجرا `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. + +## بازیابی پس از شکست {#recovery-after-failures} + +اگر باغ وحش در دسترس نیست که یک سرور شروع می شود, جداول تکرار تبدیل به حالت فقط خواندنی. این سیستم به صورت دوره ای تلاش برای اتصال به باغ وحش. + +اگر باغ وحش در طول یک در دسترس نیست `INSERT`, یا یک خطا رخ می دهد در هنگام تعامل با باغ وحش, یک استثنا پرتاب می شود. + +پس از اتصال به باغ وحش, سیستم چک چه مجموعه ای از داده ها در سیستم فایل محلی منطبق بر مجموعه مورد انتظار از داده ها (باغ وحش ذخیره این اطلاعات). اگر تناقضات کوچک وجود دارد, سیستم با همگام سازی داده ها با کپی حل. + +اگر سیستم تشخیص داده های شکسته قطعات (با اندازه اشتباه از فایل ها) و یا قطعات ناشناخته (قطعات نوشته شده به فایل سیستم اما ثبت نشده در باغ وحش) این حرکت را به `detached` دایرکتوری فرعی(حذف نمی شوند). هر بخش از دست رفته از کپی کپی کپی کپی. + +توجه داشته باشید که تاتر هیچ اقدامات مخرب مانند به طور خودکار حذف مقدار زیادی از داده ها را انجام نمی دهد. + +هنگامی که سرور شروع می شود (و یا ایجاد یک جلسه جدید با باغ وحش), این تنها چک مقدار و اندازه تمام فایل های. اگر اندازه فایل مطابقت اما بایت در جایی در وسط تغییر یافته است, این بلافاصله شناسایی نشده, اما تنها زمانی که تلاش برای خواندن داده ها برای یک `SELECT` پرس و جو. پرس و جو می اندازد یک استثنا در مورد کنترلی غیر تطبیق و یا اندازه یک بلوک فشرده. در این مورد, قطعات داده ها به صف تایید اضافه شده و کپی از کپی در صورت لزوم. + +اگر مجموعه ای محلی از داده های متفاوت بیش از حد از یک انتظار, یک مکانیزم ایمنی باعث شده است. سرور وارد این در ورود به سیستم و حاضر به راه اندازی. دلیل این کار این است که این مورد ممکن است یک خطای پیکربندی نشان می دهد, مانند اگر یک ماکت در سفال به طور تصادفی مانند یک ماکت در سفال های مختلف پیکربندی شده بود. با این حال, مانع برای این مکانیزم نسبتا کم, و این وضعیت ممکن است در طول بهبود شکست طبیعی رخ می دهد. در این مورد داده ها به صورت نیمه اتوماتیک بازسازی می شوند “pushing a button”. + +برای شروع بازیابی گره ایجاد کنید `/path_to_table/replica_name/flags/force_restore_data` در باغ وحش با هر یک از مطالب, و یا اجرای دستور برای بازگرداندن تمام جداول تکرار: + +``` bash +sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +سپس سرور راه اندازی مجدد. در ابتدا سرور این پرچم ها را حذف می کند و شروع به بازیابی می کند. + +## بازیابی پس از از دست دادن اطلاعات کامل {#recovery-after-complete-data-loss} + +اگر تمام داده ها و ابرداده از یکی از سرورها ناپدید شد, این مراحل را برای بازیابی دنبال: + +1. نصب کلیک بر روی سرور. تعریف تعویض به درستی در فایل پیکربندی که شامل شناسه سفال و کپی, در صورت استفاده از. +2. اگر شما تا به حال جداول سه برابر است که باید به صورت دستی بر روی سرور تکرار, کپی اطلاعات خود را از یک ماکت (در دایرکتوری `/var/lib/clickhouse/data/db_name/table_name/`). +3. تعاریف جدول کپی واقع در `/var/lib/clickhouse/metadata/` از یک ماکت. اگر یک شناسه سفال یا ماکت به صراحت در تعاریف جدول تعریف, اصلاح به طوری که به این ماکت مربوط. (متناوبا, شروع سرور و تمام `ATTACH TABLE` نمایش داده شد که باید در شده .در حال بارگذاری `/var/lib/clickhouse/metadata/`.) +4. برای شروع بازیابی, ایجاد گره باغ وحش `/path_to_table/replica_name/flags/force_restore_data` با هر محتوا, و یا اجرای دستور برای بازگرداندن تمام جداول تکرار: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +سپس سرور شروع (راه اندازی مجدد, اگر در حال حاضر در حال اجرا). داده خواهد شد از کپی دانلود. + +گزینه بازیابی جایگزین این است که حذف اطلاعات در مورد ماکت از دست رفته از باغ وحش (`/path_to_table/replica_name`), سپس ایجاد ماکت دوباره به عنوان شرح داده شده در “[ایجاد جداول تکرار شده](#creating-replicated-tables)”. + +در طول بازیابی هیچ محدودیتی در پهنای باند شبکه وجود ندارد. این را در ذهن اگر شما در حال بازگرداندن بسیاری از کپی در یک بار. + +## تبدیل از ادغام به تکرار غذای اصلی {#converting-from-mergetree-to-replicatedmergetree} + +ما از اصطلاح استفاده می کنیم `MergeTree` برای اشاره به تمام موتورهای جدول در `MergeTree family`, همان است که برای `ReplicatedMergeTree`. + +اگر شما تا به حال `MergeTree` جدول که به صورت دستی تکرار شد, شما می توانید به یک جدول تکرار تبدیل. شما ممکن است نیاز به انجام این کار اگر شما در حال حاضر مقدار زیادی از داده ها در یک `MergeTree` جدول و در حال حاضر شما می خواهید برای فعال کردن تکرار. + +اگر داده ها در کپی های مختلف متفاوت, برای اولین بار همگام سازی, و یا حذف این داده ها در تمام کپی به جز یکی. + +تغییر نام جدول ادغام موجود, سپس ایجاد یک `ReplicatedMergeTree` جدول با نام های قدیمی. +انتقال داده ها از جدول قدیمی به `detached` دایرکتوری فرعی در داخل دایرکتوری با داده های جدول جدید (`/var/lib/clickhouse/data/db_name/table_name/`). +سپس اجرا کنید `ALTER TABLE ATTACH PARTITION` در یکی از کپی برای اضافه کردن این قطعات داده به مجموعه کار. + +## تبدیل از تکراری به ادغام {#converting-from-replicatedmergetree-to-mergetree} + +ایجاد یک جدول ادغام با نام های مختلف. انتقال تمام داده ها از دایرکتوری با `ReplicatedMergeTree` داده های جدول به دایرکتوری داده جدول جدید. سپس حذف `ReplicatedMergeTree` جدول و راه اندازی مجدد سرور. + +اگر شما می خواهید برای خلاص شدن از شر `ReplicatedMergeTree` جدول بدون راه اندازی سرور: + +- حذف متناظر `.sql` پرونده در فهرست راهنمای فراداده (`/var/lib/clickhouse/metadata/`). +- حذف مسیر مربوطه در باغ وحش (`/path_to_table/replica_name`). + +بعد از این, شما می توانید سرور راه اندازی, ایجاد یک `MergeTree` جدول, انتقال داده ها به دایرکتوری خود, و سپس راه اندازی مجدد سرور. + +## بازیابی هنگامی که ابرداده در خوشه باغ وحش از دست داده و یا صدمه دیده است {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} + +اگر داده های موجود در باغ وحش از دست رفته یا صدمه دیده بود می توانید داده ها را با حرکت دادن به یک جدول بدون علامت همانطور که در بالا توضیح داده شد ذخیره کنید. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/fa/engines/table-engines/mergetree-family/summingmergetree.md b/docs/fa/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..48f94561c73 --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,141 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: "\u0633\u0627\u0645\u06CC\u0646\u06AF\u0645\u0631\u06AF\u062A\u0631\u06CC" +--- + +# سامینگمرگتری {#summingmergetree} + +موتور به ارث می برد از [ادغام](mergetree.md#table_engines-mergetree). تفاوت در این است که هنگامی که ادغام قطعات داده برای `SummingMergeTree` جداول تاتر جایگزین تمام ردیف با کلید اصلی همان (یا با دقت بیشتر ,با همان [کلید مرتب سازی](mergetree.md)) با یک ردیف که حاوی مقادیر خلاصه شده برای ستون ها با نوع داده عددی است. اگر کلید مرتب سازی در راه است که یک مقدار کلید تنها مربوط به تعداد زیادی از ردیف تشکیل شده, این به طور قابل توجهی کاهش می دهد حجم ذخیره سازی و سرعت بخشیدن به انتخاب داده ها. + +ما توصیه می کنیم به استفاده از موتور همراه با `MergeTree`. ذخیره اطلاعات کامل در `MergeTree` جدول و استفاده `SummingMergeTree` برای ذخیره سازی داده ها جمع, مثلا, هنگام تهیه گزارش. چنین رویکردی شما را از دست دادن اطلاعات با ارزش با توجه به کلید اولیه نادرست تشکیل شده جلوگیری می کند. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = SummingMergeTree([columns]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +برای شرح پارامترهای درخواست را ببینید [درخواست توضیحات](../../../sql-reference/statements/create.md). + +**پارامترهای سامینگمرگتری** + +- `columns` - یک تاپل با نام ستون که ارزش خلاصه خواهد شد. پارامتر اختیاری. + ستون باید از یک نوع عددی باشد و نباید در کلید اصلی باشد. + + اگر `columns` مشخص نشده, تاتر خلاصه مقادیر در تمام ستون ها با یک نوع داده عددی است که در کلید اصلی نیست. + +**بندهای پرسوجو** + +هنگام ایجاد یک `SummingMergeTree` جدول همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) +``` + +همه پارامترها به استثنای `columns` همان معنی را در `MergeTree`. + +- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. + +
+ +## مثال طریقه استفاده {#usage-example} + +جدول زیر را در نظر بگیرید: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +درج داده به این: + +``` sql +INSERT INTO summtt Values(1,1),(1,2),(2,1) +``` + +تاتر ممکن است تمام ردیف نه به طور کامل جمع ([پایین را ببینید](#data-processing)), بنابراین ما با استفاده از یک تابع کلی `sum` و `GROUP BY` بند در پرس و جو. + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + +``` text +┌─key─┬─sum(value)─┐ +│ 2 │ 1 │ +│ 1 │ 3 │ +└─────┴────────────┘ +``` + +## پردازش داده ها {#data-processing} + +هنگامی که داده ها را به یک جدول قرار داده, ذخیره می شوند به عنوان است. خانه رعیتی ادغام بخش قرار داده شده از داده ها به صورت دوره ای و این زمانی است که ردیف با کلید اصلی همان خلاصه و جایگزین با یکی برای هر بخش حاصل از داده ها. + +ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) یک تابع جمع [جمع()](../../../sql-reference/aggregate-functions/reference.md#agg_function-sum) و `GROUP BY` بند باید در پرس و جو به عنوان مثال در بالا توضیح داده شده استفاده می شود. + +### قوانین مشترک برای جمع {#common-rules-for-summation} + +مقادیر در ستون با نوع داده عددی خلاصه شده است. مجموعه ای از ستون ها توسط پارامتر تعریف شده است `columns`. + +اگر ارزش شد 0 در تمام ستون ها برای جمع, ردیف حذف شده است. + +اگر ستون در کلید اصلی نیست و خلاصه نشده است, یک مقدار دلخواه از موجود انتخاب. + +مقادیر برای ستون در کلید اصلی خلاصه نشده است. + +### جمعبندی ستونها {#the-summation-in-the-aggregatefunction-columns} + +برای ستون [نوع تابع](../../../sql-reference/data-types/aggregatefunction.md) عمل کلیک به عنوان [ریزدانه](aggregatingmergetree.md) جمع موتور با توجه به عملکرد. + +### ساختارهای تو در تو {#nested-structures} + +جدول می تواند ساختارهای داده تو در تو که در یک راه خاص پردازش کرده اند. + +اگر نام یک جدول تو در تو با به پایان می رسد `Map` و این شامل حداقل دو ستون است که با معیارهای زیر مطابقت دارند: + +- ستون اول عددی است `(*Int*, Date, DateTime)` یا یک رشته `(String, FixedString)` بهش زنگ بزن `key`, +- ستون های دیگر حساب `(*Int*, Float32/64)` بهش زنگ بزن `(values...)`, + +سپس این جدول تو در تو به عنوان یک نقشه برداری از تفسیر `key => (values...)`, و هنگامی که ادغام ردیف خود, عناصر دو مجموعه داده ها با هم ادغام شدند `key` با جمع بندی مربوطه `(values...)`. + +مثالها: + +``` text +[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] +[(1, 100)] + [(1, 150)] -> [(1, 250)] +[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] +[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] +``` + +هنگام درخواست داده ها از [sumMap(key, value)](../../../sql-reference/aggregate-functions/reference.md) تابع برای تجمع `Map`. + +برای ساختار داده های تو در تو, شما لازم نیست که برای مشخص ستون خود را در تاپل ستون برای جمع. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/fa/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/fa/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..19fb3a219a5 --- /dev/null +++ b/docs/fa/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,239 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\ + \u06CC" +--- + +# در حال بارگذاری {#versionedcollapsingmergetree} + +این موتور: + +- اجازه می دهد تا نوشتن سریع از کشورهای شی که به طور مستمر در حال تغییر. +- حذف کشورهای شی قدیمی در پس زمینه. این به طور قابل توجهی حجم ذخیره سازی را کاهش می دهد. + +بخش را ببینید [سقوط](#table_engines_versionedcollapsingmergetree) برای اطلاعات بیشتر. + +موتور به ارث می برد از [ادغام](mergetree.md#table_engines-mergetree) و می افزاید: منطق برای سقوط ردیف به الگوریتم برای ادغام قطعات داده. `VersionedCollapsingMergeTree` در خدمت همان هدف به عنوان [سقوط غذای اصلی](collapsingmergetree.md) اما با استفاده از یک الگوریتم سقوط های مختلف است که اجازه می دهد تا قرار دادن داده ها در هر جهت با موضوعات متعدد. به خصوص `Version` ستون کمک می کند تا به سقوط ردیف درستی حتی در صورتی که در جهت اشتباه قرار داده شده. در مقابل, `CollapsingMergeTree` اجازه می دهد تا درج تنها به شدت متوالی. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +برای شرح پارامترهای پرس و جو, دیدن [توضیحات پرس و جو](../../../sql-reference/statements/create.md). + +**پارامترهای موتور** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Name of the column with the type of row: `1` یک “state” سطر, `-1` یک “cancel” پارو زدن. + + نوع داده ستون باید باشد `Int8`. + +- `version` — Name of the column with the version of the object state. + + نوع داده ستون باید باشد `UInt*`. + +**بندهای پرسوجو** + +هنگام ایجاد یک `VersionedCollapsingMergeTree` جدول, همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول + +
+ +روش منسوخ برای ایجاد یک جدول + +!!! attention "توجه" + از این روش در پروژه های جدید استفاده نکنید. در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +همه پارامترها به جز `sign` و `version` همان معنی را در `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` یک “state” سطر, `-1` یک “cancel” پارو زدن. + + Column Data Type — `Int8`. + +- `version` — Name of the column with the version of the object state. + + نوع داده ستون باید باشد `UInt*`. + +
+ +## سقوط {#table_engines-versionedcollapsingmergetree} + +### داده {#data} + +در نظر بگیرید یک وضعیت که شما نیاز به ذخیره به طور مداوم در حال تغییر داده ها برای برخی از شی. این منطقی است که یک ردیف برای یک شی و به روز رسانی ردیف هر زمان که تغییرات وجود دارد. با این حال, عملیات به روز رسانی گران و کند برای یک سندرم تونل کارپ است چرا که نیاز به بازنویسی داده ها در ذخیره سازی. به روز رسانی قابل قبول نیست اگر شما نیاز به نوشتن داده ها به سرعت, اما شما می توانید تغییرات را به یک شی پی در پی به شرح زیر ارسال. + +استفاده از `Sign` ستون هنگام نوشتن ردیف. اگر `Sign = 1` این بدان معنی است که ردیف دولت از یک شی است (اجازه دهید این تماس “state” ردیف). اگر `Sign = -1` این نشان می دهد لغو دولت از یک شی با ویژگی های مشابه (اجازه دهید این پاسخ “cancel” ردیف). همچنین از `Version` ستون, که باید هر ایالت از یک شی با یک عدد جداگانه شناسایی. + +مثلا, ما می خواهیم برای محاسبه تعداد صفحات کاربران در برخی از سایت بازدید و چه مدت وجود دارد. در برخی از نقطه در زمان ما ارسال ردیف زیر را با دولت از فعالیت های کاربر: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +در برخی موارد بعد ما تغییر فعالیت کاربر را ثبت می کنیم و با دو ردیف زیر می نویسیم. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +ردیف اول لغو حالت قبلی از جسم (کاربر). باید تمام زمینه های دولت لغو شده به جز کپی کنید `Sign`. + +ردیف دوم شامل وضعیت فعلی. + +چرا که ما نیاز به تنها دولت گذشته از فعالیت های کاربر ردیف + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +می توان حذف, سقوط نامعتبر (قدیمی) دولت از جسم. `VersionedCollapsingMergeTree` این کار در حالی که ادغام قطعات داده. + +برای پیدا کردن که چرا ما نیاز به دو ردیف برای هر تغییر را ببینید [الگوریتم](#table_engines-versionedcollapsingmergetree-algorithm). + +**نکاتی در مورد استفاده** + +1. برنامه ای که می نویسد داده ها باید به یاد داشته باشید دولت از یک شی به منظور لغو. این “cancel” رشته باید یک کپی از “state” رشته با مخالف `Sign`. این باعث افزایش اندازه اولیه ذخیره سازی اما اجازه می دهد تا به نوشتن داده ها به سرعت. +2. در حال رشد طولانی در ستون کاهش بهره وری از موتور با توجه به بار برای نوشتن. ساده تر داده, بهتر بهره وری. +3. `SELECT` نتایج به شدت بستگی به قوام تاریخ تغییر شی. هنگام تهیه داده ها برای قرار دادن دقیق باشید. شما می توانید نتایج غیر قابل پیش بینی با اطلاعات متناقض از جمله مقادیر منفی برای معیارهای غیر منفی مانند عمق جلسه. + +### الگوریتم {#table_engines-versionedcollapsingmergetree-algorithm} + +هنگامی که مالکیت خانه ادغام قطعات داده, حذف هر جفت ردیف که کلید اولیه و نسخه های مختلف و همان `Sign`. منظور از ردیف مهم نیست. + +هنگامی که داده ها را درج خانه, دستور ردیف توسط کلید اصلی. اگر `Version` ستون در کلید اصلی نیست, خانه عروسکی اضافه می کند به کلید اصلی به طور ضمنی به عنوان زمینه گذشته و برای سفارش استفاده. + +## انتخاب داده ها {#selecting-data} + +تاتر تضمین نمی کند که همه از ردیف با کلید اصلی همان خواهد شد در همان بخش داده و در نتیجه و یا حتی بر روی سرور فیزیکی است. این درست است هر دو برای نوشتن داده ها و برای ادغام بعدی از قطعات داده است. علاوه بر این فرایندهای کلیک `SELECT` نمایش داده شد با موضوعات متعدد و منظور از ردیف در نتیجه نمی تواند پیش بینی کند. این به این معنی است که تجمع مورد نیاز است اگر نیاز به طور کامل وجود دارد “collapsed” داده ها از یک `VersionedCollapsingMergeTree` جدول + +برای نهایی سقوط, ارسال یک پرس و جو با یک `GROUP BY` بند و مجموع توابع است که برای ثبت نام حساب. برای مثال برای محاسبه مقدار استفاده کنید `sum(Sign)` به جای `count()`. برای محاسبه مجموع چیزی استفاده کنید `sum(Sign * x)` به جای `sum(x)` و اضافه کردن `HAVING sum(Sign) > 0`. + +مصالح `count`, `sum` و `avg` می توان محاسبه این راه. مجموع `uniq` می توان محاسبه اگر یک شی حداقل یک دولت غیر فروریخته. مصالح `min` و `max` نمی توان محاسبه کرد زیرا `VersionedCollapsingMergeTree` تاریخ ارزش های کشورهای فرو ریخت را نجات دهد. + +اگر شما نیاز به استخراج داده ها با “collapsing” اما بدون تجمع (مثلا, برای بررسی اینکه ردیف در حال حاضر که جدیدترین ارزش مطابقت شرایط خاصی هستند), شما می توانید با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. این روش بی فایده است و باید با جداول بزرگ استفاده نمی شود. + +## مثال استفاده {#example-of-use} + +اطلاعات نمونه: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +ایجاد جدول: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +درج داده: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +ما با استفاده از دو `INSERT` نمایش داده شد برای ایجاد دو بخش داده های مختلف. اگر ما داده ها را وارد کنید با یک پرس و جو تنها, تاتر ایجاد یک بخش داده و هرگز هیچ ادغام انجام خواهد داد. + +گرفتن داده ها: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +چه ما در اینجا مشاهده کنید و قطعات فروریخته کجا هستند? +ما دو بخش داده با استفاده از دو `INSERT` نمایش داده شد. این `SELECT` پرس و جو در دو موضوع انجام شد, و در نتیجه یک نظم تصادفی از ردیف است. +سقوط رخ نداد زیرا قطعات داده هنوز ادغام نشده اند. تاتر ادغام قطعات داده در یک نقطه ناشناخته در زمان است که ما نمی توانیم پیش بینی. + +به همین دلیل است که ما نیاز به تجمع: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +اگر ما تجمع نیاز ندارد و می خواهید به زور سقوط, ما می توانیم با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +این یک راه بسیار کارامد برای انتخاب داده ها است. برای جداول بزرگ استفاده نکنید. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/fa/engines/table_engines/special/buffer.md b/docs/fa/engines/table-engines/special/buffer.md similarity index 100% rename from docs/fa/engines/table_engines/special/buffer.md rename to docs/fa/engines/table-engines/special/buffer.md diff --git a/docs/fa/engines/table-engines/special/dictionary.md b/docs/fa/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..1e561aa796b --- /dev/null +++ b/docs/fa/engines/table-engines/special/dictionary.md @@ -0,0 +1,97 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: "\u0648\u0627\u0698\u0647\u0646\u0627\u0645\u0647" +--- + +# واژهنامه {#dictionary} + +این `Dictionary` موتور نمایش [واژهنامه](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) داده ها به عنوان یک جدول کلیک. + +به عنوان مثال, در نظر گرفتن یک فرهنگ لغت از `products` با پیکربندی زیر: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +پرس و جو داده فرهنگ لغت: + +``` sql +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + +``` text +┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ +│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ +└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ +``` + +شما می توانید از [دیکته کردن\*](../../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions) تابع برای دریافت داده های فرهنگ لغت در این فرمت. + +این دیدگاه مفید نیست که شما نیاز به دریافت داده های خام, و یا در هنگام انجام یک `JOIN` عمل برای این موارد می توانید از `Dictionary` موتور, که نمایش داده فرهنگ لغت در یک جدول. + +نحو: + +``` sql +CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` +``` + +به عنوان مثال استفاده: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); +``` + + Ok + +نگاهی به در چه چیزی در جدول. + +``` sql +select * from products limit 1; +``` + +``` text +┌────product_id─┬─title───────────┐ +│ 152689 │ Some item │ +└───────────────┴─────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/fa/engines/table-engines/special/distributed.md b/docs/fa/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..6037957e745 --- /dev/null +++ b/docs/fa/engines/table-engines/special/distributed.md @@ -0,0 +1,152 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: "\u062A\u0648\u0632\u06CC\u0639 \u0634\u062F\u0647" +--- + +# توزیع شده {#distributed} + +**جداول با موتور توزیع شده هیچ اطلاعاتی را توسط خود ذخیره نمی کنند**, اما اجازه می دهد پردازش پرس و جو توزیع شده بر روی سرورهای متعدد. +خواندن به طور خودکار موازی. در طول خواندن, شاخص جدول بر روی سرور از راه دور استفاده می شود, اگر وجود دارد. + +موتور توزیع پارامترها را می پذیرد: + +- نام خوشه در فایل پیکربندی سرور + +- نام یک پایگاه داده از راه دور + +- نام یک میز از راه دور + +- (اختیاری) sharding کلیدی + +- (اختیاری) نام سیاست, استفاده خواهد شد برای ذخیره فایل های موقت برای ارسال کالاهای کابل + + همچنین نگاه کنید به: + + - `insert_distributed_sync` تنظیم + - [ادغام](../mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) برای نمونه + +مثال: + +``` sql +Distributed(logs, default, hits[, sharding_key[, policy_name]]) +``` + +داده ها از تمام سرورها در ‘logs’ خوشه, از پیش فرض.جدول بازدیدها واقع در هر سرور در خوشه. +داده ها نه تنها به عنوان خوانده شده اما تا حدی بر روی سرور از راه دور پردازش (تا حدی که این امکان پذیر است). +مثلا, برای یک پرس و جو با گروه های, داده خواهد شد بر روی سرور از راه دور جمع, و کشورهای متوسط از توابع دانه خواهد شد به سرور درخواست ارسال. سپس داده ها بیشتر جمع خواهد شد. + +به جای نام پایگاه داده, شما می توانید یک عبارت ثابت است که یک رشته را برمی گرداند استفاده. در حال بارگذاری + +logs – The cluster name in the server’s config file. + +خوشه ها مانند این تنظیم می شوند: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 1 + 9440 + + + + +``` + +در اینجا یک خوشه با نام تعریف شده است ‘logs’ که متشکل از دو خرده ریز, که هر کدام شامل دو کپی. +خرده ریز به سرور که شامل بخش های مختلف از داده ها مراجعه (به منظور خواندن تمام داده ها, شما باید تمام خرده ریز دسترسی داشته باشید). +کپی در حال تکثیر سرور (به منظور خواندن تمام داده ها, شما می توانید داده ها بر روی هر یک از کپی دسترسی). + +نام خوشه باید حاوی نقطه نیست. + +پارامترها `host`, `port` و در صورت تمایل `user`, `password`, `secure`, `compression` برای هر سرور مشخص شده است: +- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn’t start. If you change the DNS record, restart the server. +- `port` – The TCP port for messenger activity (‘tcp\_port’ در پیکربندی, معمولا به مجموعه 9000). نه اشتباه آن را با http\_port. +- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [حقوق دسترسی](../../../operations/access-rights.md). +- `password` – The password for connecting to a remote server (not masked). Default value: empty string. +- `secure` - استفاده از اس اس ال برای اتصال, معمولا شما همچنین باید تعریف `port` = 9440. سرور باید گوش کند 9440 و گواهی صحیح. +- `compression` - استفاده از فشرده سازی داده ها. مقدار پیش فرض: درست. + +When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [\_تبالسازی](../../../operations/settings/settings.md#settings-load_balancing) تنظیمات. +اگر ارتباط با سرور ایجاد نشده است, وجود خواهد داشت تلاش برای ارتباط با یک ایست کوتاه. اگر اتصال شکست خورده, ماکت بعدی انتخاب خواهد شد, و به همین ترتیب برای همه کپی. اگر تلاش اتصال برای تمام کپی شکست خورده, تلاش تکرار خواهد شد به همان شیوه, چندین بار. +این کار به نفع حالت ارتجاعی, اما تحمل گسل کامل را فراهم نمی کند: یک سرور از راه دور ممکن است اتصال قبول, اما ممکن است کار نمی کند, و یا کار ضعیف. + +شما می توانید تنها یکی از خرده ریز مشخص (در این مورد, پردازش پرس و جو باید از راه دور به نام, به جای توزیع) و یا تا هر تعداد از خرده ریز. در هر سفال می توانید از یک به هر تعداد از کپی ها مشخص کنید. شما می توانید تعداد مختلف از کپی برای هر سفال مشخص. + +شما می توانید به عنوان بسیاری از خوشه های مشخص که شما در پیکربندی می خواهید. + +برای مشاهده خوشه های خود استفاده کنید ‘system.clusters’ جدول + +موتور توزیع اجازه می دهد تا کار با یک خوشه مانند یک سرور محلی. با این حال, خوشه غیر قابل اجتنابناپذیری است: شما باید پیکربندی خود را در فایل پیکربندی سرور ارسال (حتی بهتر, برای تمام سرورهای خوشه). + +The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don’t need to create a Distributed table – use the ‘remote’ تابع جدول به جای. بخش را ببینید [توابع جدول](../../../sql-reference/table-functions/index.md). + +دو روش برای نوشتن داده ها به یک خوشه وجود دارد: + +اولین, شما می توانید تعریف که سرور به ارسال که داده ها را به و انجام نوشتن به طور مستقیم در هر سفال. به عبارت دیگر, انجام درج در جداول که جدول توزیع “looks at”. این راه حل انعطاف پذیر ترین است که شما می توانید هر طرح شاردینگ استفاده, که می تواند غیر بدیهی با توجه به الزامات منطقه موضوع. این هم بهینه ترین راه حل از داده ها را می توان به خرده ریز های مختلف نوشته شده است به طور کامل به طور مستقل. + +دومین, شما می توانید درج در یک جدول توزیع انجام. در این مورد جدول توزیع داده های درج شده در سراسر سرور خود را. به منظور ارسال به یک جدول توزیع, باید یک مجموعه کلید شارژ دارند (پارامتر گذشته). علاوه بر این, اگر تنها یک سفال وجود دارد, عملیات نوشتن بدون مشخص کردن کلید شاردینگ کار می کند, چرا که هیچ چیز در این مورد معنی نیست. + +هر سفال می تواند وزن تعریف شده در فایل پیکربندی داشته باشد. به طور پیش فرض, وزن به یک برابر است. داده ها در سراسر خرده ریز در مقدار متناسب با وزن سفال توزیع. مثلا, اگر دو خرده ریز وجود دارد و برای اولین بار دارای وزن 9 در حالی که دوم دارای وزن 10, برای اولین بار ارسال خواهد شد 9 / 19 بخش هایی از ردیف, و دوم ارسال خواهد شد 10 / 19. + +هر سفال می تواند داشته باشد ‘internal\_replication’ پارامتر تعریف شده در فایل پیکربندی. + +اگر این پارامتر قرار است به ‘true’ عملیات نوشتن اولین ماکت سالم را انتخاب می کند و داده ها را می نویسد. با استفاده از این جایگزین اگر جدول توزیع شده “looks at” جداول تکرار. به عبارت دیگر اگر جدول ای که داده ها نوشته می شود خود را تکرار می کند. + +اگر قرار است ‘false’ (به طور پیش فرض), داده ها به تمام کپی نوشته شده. در اصل این بدان معنی است که توزیع جدول تکرار داده های خود را. این بدتر از استفاده از جداول تکرار شده است زیرا سازگاری کپی ها بررسی نشده است و در طول زمان حاوی اطلاعات کمی متفاوت خواهد بود. + +برای انتخاب سفال که یک ردیف از داده های فرستاده شده به sharding بیان تجزيه و تحليل است و آن باقی مانده است از تقسیم آن با وزن کلی خرده ریز. ردیف به سفال که مربوط به نیمه فاصله از باقی مانده از ارسال ‘prev\_weight’ به ‘prev\_weights + weight’ کجا ‘prev\_weights’ وزن کل خرده ریز با کمترین تعداد است, و ‘weight’ وزن این سفال است. مثلا, اگر دو خرده ریز وجود دارد, و برای اولین بار دارای یک وزن 9 در حالی که دوم دارای وزن 10, ردیف خواهد شد به سفال اول برای باقی مانده از محدوده ارسال \[0, 9), و دوم برای باقی مانده از محدوده \[9, 19). + +بیان شاردینگ می تواند هر عبارت از ثابت ها و ستون های جدول که یک عدد صحیح را برمی گرداند. برای مثال شما می توانید با استفاده از بیان ‘rand()’ برای توزیع تصادفی داده ها یا ‘UserID’ برای توزیع توسط باقی مانده از تقسیم شناسه کاربر (سپس داده ها از یک کاربر تنها بر روی یک سفال تنها اقامت, که ساده در حال اجرا در و پیوستن به کاربران). اگر یکی از ستون ها به طور مساوی توزیع نشده باشد می توانید در یک تابع هش قرار دهید: اینتاش64 (شناسه). + +یک یادآوری ساده از این بخش محدود است راه حل برای sharding و نیست همیشه مناسب است. این برای حجم متوسط و زیادی از داده ها کار می کند (ده ها تن از سرور), اما نه برای حجم بسیار زیادی از داده ها (صدها سرور یا بیشتر). در مورد دوم با استفاده از sharding طرح های مورد نیاز منطقه موضوع را به جای استفاده از مطالب موجود در توزیع جداول. + +SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don’t have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. + +شما باید نگران sharding طرح در موارد زیر: + +- نمایش داده شد استفاده می شود که نیاز به پیوستن به داده ها (در یا پیوستن) توسط یک کلید خاص. اگر داده ها توسط این کلید پنهان, شما می توانید محلی در استفاده و یا پیوستن به جای جهانی در یا جهانی ملحق, که بسیار موثر تر است. +- تعداد زیادی از سرور استفاده شده است (صدها یا بیشتر) با تعداد زیادی از نمایش داده شد کوچک (نمایش داده شد فردی مشتریان - وب سایت, تبلیغ, و یا شرکای). به منظور نمایش داده شد کوچک به کل خوشه تاثیر نمی گذارد, این باعث می شود حس برای قرار دادن داده ها برای یک مشتری در یک سفال تنها. متناوبا, همانطور که ما در یاندکس انجام داده ام.متریکا, شما می توانید راه اندازی دو سطح شاردینگ: تقسیم کل خوشه را به “layers”, جایی که یک لایه ممکن است از تکه های متعدد تشکیل شده است. داده ها برای یک مشتری تنها بر روی یک لایه قرار دارد اما ذرات را می توان به یک لایه در صورت لزوم اضافه کرد و داده ها به طور تصادفی در داخل توزیع می شوند. جداول توزیع شده برای هر لایه ایجاد می شوند و یک جدول توزیع شده مشترک برای نمایش داده شد جهانی ایجاد می شود. + +داده ها ناهمگام نوشته شده است. هنگامی که در جدول قرار داده شده, بلوک داده ها فقط به سیستم فایل های محلی نوشته شده. داده ها به سرور از راه دور در پس زمینه در اسرع وقت ارسال می شود. دوره ارسال داده ها توسط مدیریت [در حال بارگذاری](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) و [در حال بارگذاری](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) تنظیمات. این `Distributed` موتور هر فایل می فرستد با داده های درج شده به طور جداگانه, اما شما می توانید دسته ای از ارسال فایل های با فعال [نمایش سایت](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) تنظیمات. این تنظیم را بهبود می بخشد عملکرد خوشه با استفاده بهتر از سرور محلی و منابع شبکه. شما باید بررسی کنید که داده ها با موفقیت با چک کردن لیست فایل ها (داده ها در حال انتظار برای ارسال) در دایرکتوری جدول ارسال می شود: `/var/lib/clickhouse/data/database/table/`. + +اگر سرور متوقف به وجود داشته باشد و یا راه اندازی مجدد خشن بود (مثلا, پس از یک شکست دستگاه) پس از قرار دادن به یک جدول توزیع, داده های درج شده ممکن است از دست داده. اگر بخشی از داده های خراب شده در دایرکتوری جدول شناسایی شود به ‘broken’ دایرکتوری فرعی و دیگر استفاده می شود. + +پردازش پرس و جو در سراسر تمام کپی در یک سفال واحد موازی است زمانی که گزینه حداکثر\_پرورالهراپیلاس فعال است. برای کسب اطلاعات بیشتر به بخش مراجعه کنید [بیشینه\_راپرال\_راپیکال](../../../operations/settings/settings.md#settings-max_parallel_replicas). + +## ستونهای مجازی {#virtual-columns} + +- `_shard_num` — Contains the `shard_num` (از `system.clusters`). نوع: [UInt32](../../../sql-reference/data-types/int-uint.md). + +!!! note "یادداشت" + از [`remote`](../../../sql-reference/table-functions/remote.md)/`cluster` توابع جدول داخلی ایجاد نمونه موقت از همان توزیع موتور, `_shard_num` در دسترس وجود دارد بیش از حد. + +**همچنین نگاه کنید** + +- [ستونهای مجازی](index.md#table_engines-virtual_columns) + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/fa/engines/table_engines/special/external_data.md b/docs/fa/engines/table-engines/special/external-data.md similarity index 100% rename from docs/fa/engines/table_engines/special/external_data.md rename to docs/fa/engines/table-engines/special/external-data.md diff --git a/docs/fa/engines/table-engines/special/file.md b/docs/fa/engines/table-engines/special/file.md new file mode 100644 index 00000000000..45bf56af258 --- /dev/null +++ b/docs/fa/engines/table-engines/special/file.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u067E\u0631\u0648\u0646\u062F\u0647" +--- + +# پرونده {#table_engines-file} + +موتور جدول فایل داده ها را در یک فایل در یکی از پشتیبانی نگه می دارد [پرونده +فرشها](../../../interfaces/formats.md#formats) (تابسپار, بومی, و غیره.). + +نمونه های استفاده: + +- صادرات داده ها از خانه کلیک به فایل. +- تبدیل داده ها از یک فرمت به دیگری. +- به روز رسانی داده ها در تاتر از طریق ویرایش یک فایل بر روی یک دیسک. + +## استفاده در سرور کلیک {#usage-in-clickhouse-server} + +``` sql +File(Format) +``` + +این `Format` پارامتر یکی از فرمت های فایل های موجود را مشخص می کند. برای انجام +`SELECT` نمایش داده شد, فرمت باید برای ورودی پشتیبانی می شود, و به انجام +`INSERT` queries – for output. The available formats are listed in the +[فرشها](../../../interfaces/formats.md#formats) بخش. + +کلیک اجازه نمی دهد مسیر سیستم فایل را مشخص کنید`File`. این پوشه تعریف شده توسط استفاده کنید [مسیر](../../../operations/server-configuration-parameters/settings.md) تنظیم در پیکربندی سرور. + +هنگام ایجاد جدول با استفاده از `File(Format)` این دایرکتوری فرعی خالی در این پوشه ایجاد می کند. هنگامی که داده ها به جدول نوشته شده است, این را به قرار `data.Format` فایل در دایرکتوری فرعی. + +شما می توانید این زیر پوشه و فایل را در فایل سیستم سرور و سپس ایجاد کنید [ATTACH](../../../sql-reference/statements/misc.md) این جدول اطلاعات با نام تطبیق, بنابراین شما می توانید داده ها را از این فایل پرس و جو. + +!!! warning "اخطار" + مراقب باشید با این قابلیت, به دلیل تاتر می کند پیگیری تغییرات خارجی به چنین فایل را حفظ کند. نتیجه همزمان می نویسد: از طریق clickhouse و خارج از clickhouse تعریف نشده است. + +**مثال:** + +**1.** تنظیم `file_engine_table` جدول: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +به طور پیش فرض کلیک خواهد پوشه ایجاد کنید `/var/lib/clickhouse/data/default/file_engine_table`. + +**2.** دستی ایجاد کنید `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` حاوی: + +``` bash +$ cat data.TabSeparated +one 1 +two 2 +``` + +**3.** پرسوجوی داده: + +``` sql +SELECT * FROM file_engine_table +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## استفاده در کلیک-محلی {#usage-in-clickhouse-local} + +داخل [کلیک-محلی](../../../operations/utilities/clickhouse-local.md) موتور فایل مسیر فایل علاوه بر می پذیرد `Format`. جریان های ورودی / خروجی پیش فرض را می توان با استفاده از نام های عددی یا قابل خواندن توسط انسان مشخص کرد `0` یا `stdin`, `1` یا `stdout`. +**مثال:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## اطلاعات پیاده سازی {#details-of-implementation} + +- چندگانه `SELECT` نمایش داده شد را می توان به صورت همزمان انجام, ولی `INSERT` نمایش داده شد هر یک از دیگر صبر کنید. +- پشتیبانی از ایجاد فایل جدید توسط `INSERT` پرس و جو. +- اگر پرونده وجود داشته باشد, `INSERT` ارزش های جدید را در این برنامه اضافه کنید. +- پشتیبانی نمیشود: + - `ALTER` + - `SELECT ... SAMPLE` + - شاخص ها + - تکرار + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/fa/engines/table-engines/special/generate.md b/docs/fa/engines/table-engines/special/generate.md new file mode 100644 index 00000000000..e3afae562f6 --- /dev/null +++ b/docs/fa/engines/table-engines/special/generate.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 46 +toc_title: "\u0698\u0646\u0631\u0627\u0644" +--- + +# ژنرال {#table_engines-generate} + +موتور جدول عمومی تولید داده های تصادفی برای طرح جدول داده شده است. + +نمونه های استفاده: + +- استفاده در تست به جمعیت جدول بزرگ تجدید پذیر. +- تولید ورودی تصادفی برای تست ریش ریش شدن. + +## استفاده در سرور کلیک {#usage-in-clickhouse-server} + +``` sql +ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) +``` + +این `max_array_length` و `max_string_length` پارامترها حداکثر طول همه را مشخص می کنند +ستون ها و رشته های متناوب در داده های تولید شده مطابقت دارند. + +تولید موتور جدول پشتیبانی از تنها `SELECT` نمایش داده شد. + +این پشتیبانی از تمام [انواع داده](../../../sql-reference/data-types/index.md) این را می توان در یک جدول ذخیره کرد به جز `LowCardinality` و `AggregateFunction`. + +**مثال:** + +**1.** تنظیم `generate_engine_table` جدول: + +``` sql +CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) +``` + +**2.** پرسوجوی داده: + +``` sql +SELECT * FROM generate_engine_table LIMIT 3 +``` + +``` text +┌─name─┬──────value─┐ +│ c4xJ │ 1412771199 │ +│ r │ 1791099446 │ +│ 7#$ │ 124312908 │ +└──────┴────────────┘ +``` + +## اطلاعات پیاده سازی {#details-of-implementation} + +- پشتیبانی نمیشود: + - `ALTER` + - `SELECT ... SAMPLE` + - `INSERT` + - شاخص ها + - تکرار + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/fa/engines/table_engines/special/index.md b/docs/fa/engines/table-engines/special/index.md similarity index 100% rename from docs/fa/engines/table_engines/special/index.md rename to docs/fa/engines/table-engines/special/index.md diff --git a/docs/fa/engines/table-engines/special/join.md b/docs/fa/engines/table-engines/special/join.md new file mode 100644 index 00000000000..e9614770461 --- /dev/null +++ b/docs/fa/engines/table-engines/special/join.md @@ -0,0 +1,111 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u067E\u06CC\u0648\u0633\u062A\u0646" +--- + +# پیوستن {#join} + +ساختار داده تهیه شده برای استفاده در [JOIN](../../../sql-reference/statements/select.md#select-join) عملیات. + +## ایجاد یک جدول {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], +) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) +``` + +شرح مفصلی از [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) پرس و جو. + +**پارامترهای موتور** + +- `join_strictness` – [پیوستن به سختی](../../../sql-reference/statements/select.md#select-join-strictness). +- `join_type` – [پیوستن به نوع](../../../sql-reference/statements/select.md#select-join-types). +- `k1[, k2, ...]` – Key columns from the `USING` بند که `JOIN` عملیات با ساخته شده. + +وارد کردن `join_strictness` و `join_type` پارامترهای بدون نقل قول, مثلا, `Join(ANY, LEFT, col1)`. اونا باید با `JOIN` عملیاتی که جدول خواهد شد برای استفاده. اگر پارامترها مطابقت ندارند, خانه عروسکی می کند یک استثنا پرتاب نمی کند و ممکن است داده های نادرست بازگشت. + +## استفاده از جدول {#table-usage} + +### مثال {#example} + +ایجاد جدول سمت چپ: + +``` sql +CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog +``` + +``` sql +INSERT INTO id_val VALUES (1,11)(2,12)(3,13) +``` + +ایجاد سمت راست `Join` جدول: + +``` sql +CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) +``` + +``` sql +INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) +``` + +پیوستن به جداول: + +``` sql +SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 +``` + +``` text +┌─id─┬─val─┬─id_val_join.val─┐ +│ 1 │ 11 │ 21 │ +│ 2 │ 12 │ ᴺᵁᴸᴸ │ +│ 3 │ 13 │ 23 │ +└────┴─────┴─────────────────┘ +``` + +به عنوان یک جایگزین, شما می توانید داده ها را از بازیابی `Join` جدول مشخص کردن مقدار پیوستن کلید: + +``` sql +SELECT joinGet('id_val_join', 'val', toUInt32(1)) +``` + +``` text +┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ +│ 21 │ +└────────────────────────────────────────────┘ +``` + +### انتخاب و قرار دادن داده ها {#selecting-and-inserting-data} + +شما می توانید استفاده کنید `INSERT` نمایش داده شد برای اضافه کردن داده ها به `Join`- جدول موتور . اگر جدول با ایجاد شد `ANY` سخت, داده ها برای کلید های تکراری نادیده گرفته می شوند. با `ALL` سخت, تمام ردیف اضافه می شوند. + +شما نمی توانید انجام دهید `SELECT` پرس و جو به طور مستقیم از جدول. بجای, استفاده از یکی از روش های زیر: + +- میز را به سمت راست قرار دهید `JOIN` بند بند. +- تماس با [جوینت](../../../sql-reference/functions/other-functions.md#joinget) تابع, که به شما امکان استخراج داده ها از جدول به همان شیوه به عنوان از یک فرهنگ لغت. + +### محدودیت ها و تنظیمات {#join-limitations-and-settings} + +هنگام ایجاد یک جدول تنظیمات زیر اعمال می شود: + +- [ارزشهای خبری عبارتند از:](../../../operations/settings/settings.md#join_use_nulls) +- [\_پاک کردن \_روشن گرافیک](../../../operations/settings/query-complexity.md#settings-max_rows_in_join) +- [\_پویش همیشگی](../../../operations/settings/query-complexity.md#settings-max_bytes_in_join) +- [\_شروع مجدد](../../../operations/settings/query-complexity.md#settings-join_overflow_mode) +- [نمایش سایت](../../../operations/settings/settings.md#settings-join_any_take_last_row) + +این `Join`- جداول موتور نمی تواند مورد استفاده قرار گیرد `GLOBAL JOIN` عملیات. + +این `Join`- موتور اجازه می دهد تا استفاده کنید [ارزشهای خبری عبارتند از:](../../../operations/settings/settings.md#join_use_nulls) تنظیم در `CREATE TABLE` بیانیه. و [SELECT](../../../sql-reference/statements/select.md) پرسوجو به کار میرود `join_use_nulls` منم همینطور اگر شما متفاوت است `join_use_nulls` تنظیمات, شما می توانید یک خطا پیوستن به جدول از. این بستگی به نوع پیوستن دارد. هنگام استفاده [جوینت](../../../sql-reference/functions/other-functions.md#joinget) تابع, شما مجبور به استفاده از همان `join_use_nulls` تنظیم در `CRATE TABLE` و `SELECT` اظهارات. + +## ذخیره سازی داده ها {#data-storage} + +`Join` داده های جدول است که همیشه در رم واقع. در هنگام قرار دادن ردیف به یک جدول, کلیکهاوس می نویسد بلوک های داده را به دایرکتوری بر روی دیسک به طوری که می توان ترمیم زمانی که سرور راه اندازی مجدد. + +اگر سرور نادرست راه اندازی مجدد بلوک داده ها بر روی دیسک از دست رفته یا صدمه دیده ممکن است. در این مورد ممکن است لازم باشد فایل را به صورت دستی با داده های خراب شده حذف کنید. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/fa/engines/table-engines/special/materializedview.md b/docs/fa/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..9a164e5df73 --- /dev/null +++ b/docs/fa/engines/table-engines/special/materializedview.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 43 +toc_title: "\u0645\u0627\u062F\u0647 \u0628\u06CC\u0646\u06CC" +--- + +# ماده بینی {#materializedview} + +مورد استفاده برای اجرای نمایش محقق (برای اطلاعات بیشتر, دیدن [CREATE TABLE](../../../sql-reference/statements/create.md)). برای ذخیره سازی داده ها از یک موتور مختلف استفاده می کند که هنگام ایجاد دیدگاه مشخص شده است. هنگام خواندن از یک جدول, فقط با استفاده از این موتور. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/fa/engines/table_engines/special/memory.md b/docs/fa/engines/table-engines/special/memory.md similarity index 100% rename from docs/fa/engines/table_engines/special/memory.md rename to docs/fa/engines/table-engines/special/memory.md diff --git a/docs/fa/engines/table-engines/special/merge.md b/docs/fa/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..878e87d27a8 --- /dev/null +++ b/docs/fa/engines/table-engines/special/merge.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: "\u0627\u062F\u063A\u0627\u0645" +--- + +# ادغام {#merge} + +این `Merge` موتور (با اشتباه گرفته شود `MergeTree`) اطلاعات خود را ذخیره نمی, اما اجازه می دهد تا خواندن از هر تعداد از جداول دیگر به طور همزمان. +خواندن به طور خودکار موازی. نوشتن به یک جدول پشتیبانی نمی شود. هنگام خواندن, شاخص جداول که در واقع در حال خواندن استفاده می شود, در صورتی که وجود داشته باشد. +این `Merge` موتور می پذیرد پارامترهای: نام پایگاه داده و یک عبارت منظم برای جداول. + +مثال: + +``` sql +Merge(hits, '^WatchLog') +``` + +داده خواهد شد از جداول در خواندن `hits` پایگاه داده است که نام هایی که مطابقت با عبارت منظم ‘`^WatchLog`’. + +به جای نام پایگاه داده, شما می توانید یک عبارت ثابت است که یک رشته را برمی گرداند استفاده. به عنوان مثال, `currentDatabase()`. + +Regular expressions — [شماره 2](https://github.com/google/re2) (پشتیبانی از یک زیر مجموعه از مدار چاپی), حساس به حروف. +یادداشت ها در مورد فرار نمادها در عبارات منظم در “match” بخش. + +هنگام انتخاب جداول برای خواندن `Merge` جدول خود را انتخاب نخواهد شد, حتی اگر منطبق عبارت منظم. این است که برای جلوگیری از حلقه. +ممکن است که به ایجاد دو `Merge` جداول که بی وقفه سعی خواهد کرد به خواندن داده های هر یک از دیگران, اما این یک ایده خوب نیست. + +راه معمولی برای استفاده از `Merge` موتور برای کار با تعداد زیادی از `TinyLog` جداول به عنوان اگر با یک جدول واحد. + +مثال 2: + +بیایید می گویند شما باید یک جدول (watchlog\_old) و تصمیم به تغییر پارتیشن بندی بدون حرکت داده ها به یک جدول جدید (watchlog\_new) و شما نیاز به مراجعه به داده ها از هر دو جدول. + +``` sql +CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree(date, (UserId, EventType), 8192); +INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + +CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; +INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + +CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + +SELECT * +FROM WatchLog +``` + +``` text +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-01 │ 1 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-02 │ 2 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +``` + +## ستونهای مجازی {#virtual-columns} + +- `_table` — Contains the name of the table from which data was read. Type: [رشته](../../../sql-reference/data-types/string.md). + + شما می توانید شرایط ثابت را تنظیم کنید `_table` در `WHERE/PREWHERE` بند (به عنوان مثال, `WHERE _table='xyz'`). در این مورد عملیات خواندن فقط برای جداول انجام می شود که شرط است `_table` راضی است, به طوری که `_table` ستون به عنوان یک شاخص عمل می کند. + +**همچنین نگاه کنید به** + +- [مجازی ستون](index.md#table_engines-virtual_columns) + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/fa/engines/table_engines/special/null.md b/docs/fa/engines/table-engines/special/null.md similarity index 100% rename from docs/fa/engines/table_engines/special/null.md rename to docs/fa/engines/table-engines/special/null.md diff --git a/docs/fa/engines/table_engines/special/set.md b/docs/fa/engines/table-engines/special/set.md similarity index 100% rename from docs/fa/engines/table_engines/special/set.md rename to docs/fa/engines/table-engines/special/set.md diff --git a/docs/fa/engines/table_engines/special/url.md b/docs/fa/engines/table-engines/special/url.md similarity index 100% rename from docs/fa/engines/table_engines/special/url.md rename to docs/fa/engines/table-engines/special/url.md diff --git a/docs/fa/engines/table_engines/special/view.md b/docs/fa/engines/table-engines/special/view.md similarity index 100% rename from docs/fa/engines/table_engines/special/view.md rename to docs/fa/engines/table-engines/special/view.md diff --git a/docs/fa/engines/table_engines/index.md b/docs/fa/engines/table_engines/index.md deleted file mode 100644 index edef8c0a281..00000000000 --- a/docs/fa/engines/table_engines/index.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Table Engines -toc_priority: 26 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# موتورهای جدول {#table_engines} - -موتور جدول (نوع جدول) تعیین می کند: - -- چگونه و در کجا اطلاعات ذخیره شده است, جایی که برای نوشتن به, و از کجا به خواندن از. -- که نمایش داده شد پشتیبانی می شوند, و چگونه. -- همزمان دسترسی به داده ها. -- استفاده از شاخص, در صورت وجود. -- این که اجرای درخواست چند رشته ای امکان پذیر باشد. -- پارامترهای تکرار داده. - -## خانواده موتور {#engine-families} - -### ادغام {#mergetree} - -موتورهای جدول جهانی ترین و کاربردی برای وظایف بار بالا. اموال به اشتراک گذاشته شده توسط این موتور درج داده های سریع با پردازش داده های پس زمینه های بعدی است. `MergeTree` موتورهای خانواده از تکرار داده ها پشتیبانی می کنند (با [تکرار\*](mergetree_family/replication.md) نسخه موتورهای) پارتیشن بندی و ویژگی های دیگر در موتورهای دیگر پشتیبانی نمی شود. - -موتورهای در خانواده: - -- [ادغام](mergetree_family/mergetree.md) -- [جایگزینی](mergetree_family/replacingmergetree.md) -- [سامینگمرگتری](mergetree_family/summingmergetree.md) -- [ریزدانه](mergetree_family/aggregatingmergetree.md) -- [سقوط غذای اصلی](mergetree_family/collapsingmergetree.md) -- [در حال بارگذاری](mergetree_family/versionedcollapsingmergetree.md) -- [نمودار](mergetree_family/graphitemergetree.md) - -### ثبت {#log} - -سبک [موتورها](log_family/index.md) با حداقل قابلیت. هنگامی که شما نیاز به سرعت نوشتن بسیاری از جداول کوچک (تا حدود 1 میلیون ردیف) و خواندن بعد به عنوان یک کل موثر ترین هستند. - -موتورهای در خانواده: - -- [جمع شدن](log_family/tinylog.md) -- [خط زدن](log_family/stripelog.md) -- [ثبت](log_family/log.md) - -### موتورهای یکپارچه سازی {#integration-engines} - -موتورهای برای برقراری ارتباط با دیگر ذخیره سازی داده ها و سیستم های پردازش. - -موتورهای در خانواده: - -- [کافکا](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) -- [HDFS](integrations/hdfs.md) - -### موتورهای ویژه {#special-engines} - -موتورهای در خانواده: - -- [توزیع شده](special/distributed.md) -- [ماده بینی](special/materializedview.md) -- [واژهنامه](special/dictionary.md) -- [ادغام](special/merge.md) -- [پرونده](special/file.md) -- [خالی](special/null.md) -- [تنظیم](special/set.md) -- [پیوستن](special/join.md) -- [URL](special/url.md) -- [نما](special/view.md) -- [حافظه](special/memory.md) -- [بافر](special/buffer.md) - -## ستونهای مجازی {#table_engines-virtual-columns} - -ستون مجازی یک ویژگی موتور جدول انتگرال است که در کد منبع موتور تعریف شده است. - -شما باید ستون مجازی در مشخص نیست `CREATE TABLE` پرس و جو کنید و نمی توانید ببینید `SHOW CREATE TABLE` و `DESCRIBE TABLE` نتایج پرس و جو. ستون مجازی نیز فقط خواندنی, بنابراین شما می توانید داده ها را به ستون مجازی وارد کنید. - -برای انتخاب داده ها از یک ستون مجازی, شما باید نام خود را در مشخص `SELECT` پرس و جو. `SELECT *` مقادیر از ستون های مجازی بازگشت نیست. - -اگر شما یک جدول با یک ستون است که به همین نام به عنوان یکی از ستون های مجازی جدول ایجاد, ستون مجازی غیر قابل دسترس می شود. ما توصیه نمی انجام این کار. برای کمک به جلوگیری از درگیری, نام ستون مجازی معمولا با تاکید پیشوند. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/fa/engines/table_engines/integrations/hdfs.md b/docs/fa/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index f2449898d04..00000000000 --- a/docs/fa/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: HDFS ---- - -# HDFS {#table_engines-hdfs} - -این موتور ادغام با فراهم می کند [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) اکوسیستم با اجازه دادن به مدیریت داده ها در [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)از طریق کلیکهاوس. این موتور مشابه است -به [پرونده](../special/file.md) و [URL](../special/url.md) موتورهای, اما فراهم می کند ویژگی های هادوپ خاص. - -## استفاده {#usage} - -``` sql -ENGINE = HDFS(URI, format) -``` - -این `URI` پارامتر تمام فایل نشانی اینترنتی در اچ دی است. -این `format` پارامتر یکی از فرمت های فایل های موجود را مشخص می کند. برای انجام -`SELECT` نمایش داده شد, فرمت باید برای ورودی پشتیبانی می شود, و به انجام -`INSERT` queries – for output. The available formats are listed in the -[فرشها](../../../interfaces/formats.md#formats) بخش. -قسمت مسیر `URI` ممکن است حاوی دل تنگی. در این مورد جدول قابل خواندن خواهد بود. - -**مثال:** - -**1.** تنظیم `hdfs_engine_table` جدول: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** پر کردن پرونده: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** پرسوجوی داده: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## پیاده سازی اطلاعات {#implementation-details} - -- می خواند و می نویسد می تواند موازی -- پشتیبانی نمیشود: - - `ALTER` و `SELECT...SAMPLE` عملیات. - - شاخص. - - تکرار. - -**دل تنگی در مسیر** - -اجزای مسیر چندگانه می تواند دل تنگی دارند. برای پردازش فایل باید وجود داشته باشد و مسابقات به الگوی کل مسیر. لیست فایل های تعیین در طول `SELECT` (نه در `CREATE` لحظه). - -- `*` — Substitutes any number of any characters except `/` از جمله رشته خالی. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -سازه با `{}` شبیه به [دور](../../../sql_reference/table_functions/remote.md) تابع جدول. - -**مثال** - -1. فرض کنید ما چندین فایل را در قالب فیلم با اوریس زیر در اچ دی ها داریم: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. راه های مختلفی برای ایجاد یک جدول متشکل از تمام شش فایل وجود دارد: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -راه دیگر: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -جدول شامل تمام فایل ها در هر دو دایرکتوری (تمام فایل ها باید فرمت و طرح توصیف شده در پرس و جو راضی): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "اخطار" - اگر فهرستی از فایل های حاوی محدوده تعداد با صفر پیشرو, استفاده از ساخت و ساز با پرانتز برای هر رقم به طور جداگانه و یا استفاده `?`. - -**مثال** - -ایجاد جدول با فایل های به نام `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') -``` - -## ستونهای مجازی {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**همچنین نگاه کنید به** - -- [ستونهای مجازی](../index.md#table_engines-virtual_columns) - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/fa/engines/table_engines/integrations/jdbc.md b/docs/fa/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index 9afa23dae8d..00000000000 --- a/docs/fa/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: JDBC ---- - -# JDBC {#table-engine-jdbc} - -اجازه می دهد تا تاتر برای اتصال به پایگاه داده های خارجی از طریق [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -برای پیاده سازی اتصال جدی بی سی, خانه با استفاده از برنامه جداگانه [هومز-جد بی سی-پل](https://github.com/alex-krash/clickhouse-jdbc-bridge) که باید به عنوان یک شبح اجرا شود. - -این موتور از [Nullable](../../../sql_reference/data_types/nullable.md) نوع داده. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -( - columns list... -) -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**پارامترهای موتور** - -- `dbms_uri` — URI of an external DBMS. - - قالب: `jdbc:://:/?user=&password=`. - به عنوان مثال برای خروجی زیر: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — Database in an external DBMS. - -- `external_table` — Name of the table in `external_database`. - -## مثال طریقه استفاده {#usage-example} - -ایجاد یک جدول در سرور خروجی زیر با اتصال مستقیم با مشتری کنسول: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ایجاد یک جدول در سرور کلیک و انتخاب داده ها از: - -``` sql -CREATE TABLE jdbc_table -( - `int_id` Int32, - `int_nullable` Nullable(Int32), - `float` Float32, - `float_nullable` Nullable(Float32) -) -ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## همچنین نگاه کنید به {#see-also} - -- [تابع جدول جدی بی سی](../../../sql_reference/table_functions/jdbc.md). - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/fa/engines/table_engines/integrations/kafka.md b/docs/fa/engines/table_engines/integrations/kafka.md deleted file mode 100644 index 6634c7426e0..00000000000 --- a/docs/fa/engines/table_engines/integrations/kafka.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 32 -toc_title: "\u06A9\u0627\u0641\u06A9\u0627" ---- - -# کافکا {#kafka} - -این موتور با این نسخهها کار [نمایی کافکا](http://kafka.apache.org/). - -کافکا به شما امکان می دهد: - -- انتشار یا اشتراک در جریان داده ها. -- سازماندهی ذخیره سازی مقاوم در برابر خطا. -- روند جریان به عنوان در دسترس تبدیل شده است. - -## ایجاد یک جدول {#table_engine-kafka-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = Kafka() -SETTINGS - kafka_broker_list = 'host:port', - kafka_topic_list = 'topic1,topic2,...', - kafka_group_name = 'group_name', - kafka_format = 'data_format'[,] - [kafka_row_delimiter = 'delimiter_symbol',] - [kafka_schema = '',] - [kafka_num_consumers = N,] - [kafka_skip_broken_messages = N] -``` - -پارامترهای مورد نیاز: - -- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). -- `kafka_topic_list` – A list of Kafka topics. -- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don't want messages to be duplicated in the cluster, use the same group name everywhere. -- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` تابع مانند `JSONEachRow`. برای کسب اطلاعات بیشتر, دیدن [فرشها](../../../interfaces/formats.md) بخش. - -پارامترهای اختیاری: - -- `kafka_row_delimiter` – Delimiter character, which ends the message. -- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [سروان نیا](https://capnproto.org/) نیاز به مسیر به فایل طرح و نام ریشه `schema.capnp:Message` اعتراض. -- `kafka_num_consumers` – The number of consumers per table. Default: `1`. مشخص مصرف کنندگان بیشتر اگر توان عملیاتی یک مصرف کننده کافی است. تعداد کل مصرف کنندگان باید تعداد پارتیشن در موضوع تجاوز نمی, از تنها یک مصرف کننده را می توان در هر پارتیشن اختصاص داده. -- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. اگر `kafka_skip_broken_messages = N` سپس موتور پرش *N* پیام کافکا که نمی تواند تجزیه شود (یک پیام برابر یک ردیف از داده ها). - -مثالها: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - SELECT * FROM queue LIMIT 5; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') - SETTINGS kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; -``` - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - از این روش در پروژه های جدید استفاده نکنید. در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format - [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) -``` - -
- -## توصیف {#description} - -پیام تحویل به طور خودکار ردیابی, بنابراین هر پیام در یک گروه تنها یک بار شمارش. اگر شما می خواهید برای دریافت داده ها دو بار, سپس یک کپی از جدول با نام گروه دیگری ایجاد. - -گروه انعطاف پذیر هستند و همگام سازی در خوشه. برای مثال, اگر شما 10 موضوعات و 5 نسخه از یک جدول در یک خوشه, سپس هر کپی می شود 2 موضوعات. اگر تعداد نسخه تغییر, موضوعات در سراسر نسخه توزیع به طور خودکار. اطلاعات بیشتر در مورد این در http://kafka.apache.org/intro. - -`SELECT` به خصوص برای خواندن پیام های مفید نیست (به جز اشکال زدایی), چرا که هر پیام را می توان تنها یک بار به عنوان خوانده شده. این عملی تر است برای ایجاد موضوعات در زمان واقعی با استفاده از نمایش محقق. برای انجام این کار: - -1. از موتور برای ایجاد یک مصرف کننده کافکا استفاده کنید و جریان داده را در نظر بگیرید. -2. ایجاد یک جدول با ساختار مورد نظر. -3. یک دیدگاه محقق ایجاد کنید که داده ها را از موتور تبدیل می کند و به یک جدول قبلا ایجاد شده تبدیل می کند. - -هنگامی که `MATERIALIZED VIEW` به موتور می پیوندد و شروع به جمع کردن داده ها در پس زمینه می کند. این اجازه می دهد تا شما را به طور مستمر دریافت پیام از کافکا و تبدیل به فرمت مورد نیاز با استفاده از `SELECT`. -یک جدول کافکا می تواند به عنوان بسیاری از دیدگاه های تحقق به عنوان دوست دارید, اطلاعات از جدول کافکا به طور مستقیم به عنوان خوانده شده, اما دریافت پرونده های جدید (در بلوک), به این ترتیب شما می توانید به چند جدول با سطح جزییات مختلف ارسال (با گروه بندی - تجمع و بدون). - -مثال: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - CREATE TABLE daily ( - day Date, - level String, - total UInt64 - ) ENGINE = SummingMergeTree(day, (day, level), 8192); - - CREATE MATERIALIZED VIEW consumer TO daily - AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total - FROM queue GROUP BY day, level; - - SELECT level, sum(total) FROM daily GROUP BY level; -``` - -برای بهبود عملکرد, پیام های دریافت شده را به بلوک های اندازه گروه بندی می شوند [ا\_فزونهها](../../../operations/server_configuration_parameters/settings.md#settings-max_insert_block_size). اگر بلوک در داخل تشکیل نشده است [\_خاله جریان](../../../operations/server_configuration_parameters/settings.md) میلی ثانیه, داده خواهد شد به جدول بدون در نظر گرفتن کامل از بلوک سرخ. - -برای جلوگیری از دریافت داده های موضوع و یا تغییر منطق تبدیل جدا مشاهده محقق: - -``` sql - DETACH TABLE consumer; - ATTACH TABLE consumer; -``` - -اگر شما می خواهید به تغییر جدول هدف با استفاده از `ALTER` توصیه می کنیم دیدگاه مادی را غیرفعال کنید تا از اختلاف بین جدول هدف و داده ها از نظر جلوگیری شود. - -## پیکربندی {#configuration} - -شبیه به graphitemergetree های کافکا پشتیبانی از موتور تمدید پیکربندی با استفاده از clickhouse فایل پیکربندی. دو کلید پیکربندی است که شما می توانید استفاده کنید وجود دارد: جهانی (`kafka`) و سطح موضوع (`kafka_*`). پیکربندی جهانی برای اولین بار اعمال می شود و سپس پیکربندی سطح موضوع اعمال می شود (در صورت وجود). - -``` xml - - - cgrp - smallest - - - - - 250 - 100000 - -``` - -برای یک لیست از گزینه های پیکربندی ممکن, دیدن [مرجع پیکربندی کتابدار](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). استفاده از تاکید (`_`) به جای یک نقطه در پیکربندی کلیک. به عنوان مثال, `check.crcs=true` خواهد بود `true`. - -## ستونهای مجازی {#virtual-columns} - -- `_topic` — Kafka topic. -- `_key` — Key of the message. -- `_offset` — Offset of the message. -- `_timestamp` — Timestamp of the message. -- `_partition` — Partition of Kafka topic. - -**همچنین نگاه کنید** - -- [مجازی ستون](../index.md#table_engines-virtual_columns) - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/fa/engines/table_engines/integrations/mysql.md b/docs/fa/engines/table_engines/integrations/mysql.md deleted file mode 100644 index e6786240ec8..00000000000 --- a/docs/fa/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: MySQL ---- - -# Mysql {#mysql} - -موتور خروجی زیر اجازه می دهد تا شما را به انجام `SELECT` نمایش داده شد در داده است که بر روی یک سرور خروجی از راه دور ذخیره می شود. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... -) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -مشاهده شرح مفصلی از [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) پرس و جو. - -ساختار جدول می تواند از ساختار جدول خروجی زیر اصلی متفاوت است: - -- نام ستون باید همان است که در جدول خروجی زیر اصلی باشد, اما شما می توانید تنها برخی از این ستون ها و در هر جهت استفاده. -- انواع ستون ممکن است از کسانی که در جدول خروجی زیر اصلی متفاوت است. فاحشه خانه تلاش می کند تا [بازیگران](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) ارزش ها را به انواع داده های کلیک. - -**پارامترهای موتور** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` نمایش داده شد به `REPLACE INTO`. اگر `replace_query=1`, پرس و جو جایگزین شده است. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` بیان است که به اضافه `INSERT` پرس و جو. - - مثال: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1` کجا `on_duplicate_clause` هست `UPDATE c2 = c2 + 1`. دیدن [مستندات خروجی زیر](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) برای پیدا کردن که `on_duplicate_clause` شما می توانید با استفاده از `ON DUPLICATE KEY` بند بند. - - برای مشخص کردن `on_duplicate_clause` شما نیاز به تصویب `0` به `replace_query` پارامتر. اگر شما به طور همزمان عبور `replace_query = 1` و `on_duplicate_clause`, تاتر تولید یک استثنا. - -ساده `WHERE` بند هایی مانند `=, !=, >, >=, <, <=` بر روی سرور خروجی زیر اجرا شده است. - -بقیه شرایط و `LIMIT` محدودیت نمونه برداری در محل کلیک تنها پس از پرس و جو به پس از اتمام خروجی زیر اجرا شده است. - -## مثال طریقه استفاده {#usage-example} - -جدول در خروجی زیر: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -جدول در تاتر, بازیابی داده ها از جدول خروجی زیر ایجاد شده در بالا: - -``` sql -CREATE TABLE mysql_table -( - `float_nullable` Nullable(Float32), - `int_id` Int32 -) -ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` sql -SELECT * FROM mysql_table -``` - -``` text -┌─float_nullable─┬─int_id─┐ -│ ᴺᵁᴸᴸ │ 1 │ -└────────────────┴────────┘ -``` - -## همچنین نگاه کنید {#see-also} - -- [این ‘mysql’ تابع جدول](../../../sql_reference/table_functions/mysql.md) -- [با استفاده از خروجی زیر به عنوان منبع فرهنگ لغت خارجی](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/fa/engines/table_engines/integrations/odbc.md b/docs/fa/engines/table_engines/integrations/odbc.md deleted file mode 100644 index 1b9d6355479..00000000000 --- a/docs/fa/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: ODBC ---- - -# ODBC {#table-engine-odbc} - -اجازه می دهد تا تاتر برای اتصال به پایگاه داده های خارجی از طریق [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -با خیال راحت پیاده سازی اتصالات ان بی سی, تاتر با استفاده از یک برنامه جداگانه `clickhouse-odbc-bridge`. اگر راننده او بی سی به طور مستقیم از لود `clickhouse-server`, مشکلات راننده می تواند سرور تاتر سقوط. تاتر به طور خودکار شروع می شود `clickhouse-odbc-bridge` هنگامی که مورد نیاز است. برنامه پل او بی سی از همان بسته به عنوان نصب `clickhouse-server`. - -این موتور از [Nullable](../../../sql_reference/data_types/nullable.md) نوع داده. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -مشاهده شرح مفصلی از [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) پرس و جو. - -ساختار جدول می تواند از ساختار جدول منبع متفاوت باشد: - -- نام ستون باید همان است که در جدول منبع باشد, اما شما می توانید تنها برخی از این ستون ها و در هر جهت استفاده. -- انواع ستون ممکن است از کسانی که در جدول منبع متفاوت. فاحشه خانه تلاش می کند تا [بازیگران](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) ارزش ها را به انواع داده های کلیک. - -**پارامترهای موتور** - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` پرونده. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -## مثال طریقه استفاده {#usage-example} - -**بازیابی داده ها از نصب و راه اندازی خروجی زیر محلی از طریق ان بی سی** - -این مثال برای لینوکس اوبونتو 18.04 و سرور خروجی زیر 5.7 بررسی می شود. - -اطمینان حاصل شود که unixodbc و mysql اتصال نصب شده است. - -به طور پیش فرض (در صورت نصب از بسته), کلیک خانه شروع می شود به عنوان کاربر `clickhouse`. بدین ترتیب, شما نیاز به ایجاد و پیکربندی این کاربر در سرور خروجی زیر. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -سپس اتصال را پیکربندی کنید `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -شما می توانید اتصال با استفاده از بررسی `isql` ابزار از unixODBC نصب و راه اندازی. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -جدول در خروجی زیر: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -جدول در تاتر بازیابی داده ها از جدول خروجی زیر: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## همچنین نگاه کنید به {#see-also} - -- [لغت نامه های خارجی ان بی سی](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [تابع جدول ان بی سی](../../../sql_reference/table_functions/odbc.md) - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/fa/engines/table_engines/log_family/log.md b/docs/fa/engines/table_engines/log_family/log.md deleted file mode 100644 index e7317a81470..00000000000 --- a/docs/fa/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: "\u062B\u0628\u062A" ---- - -# ثبت {#log} - -موتور متعلق به خانواده از موتورهای ورود به سیستم. مشاهده خواص مشترک از موتورهای ورود به سیستم و تفاوت های خود را در [ورود خانواده موتور](log_family.md) مقاله. - -ورود متفاوت از [جمع شدن](tinylog.md) در این فایل کوچک “marks” ساکن با فایل های ستون. این علامت ها در هر بلوک داده نوشته شده است و شامل شیپور خاموشی که نشان می دهد از کجا شروع به خواندن فایل به منظور جست و خیز تعداد مشخصی از ردیف. این باعث می شود امکان خواندن داده های جدول در موضوعات مختلف. -برای همزمان دسترسی به داده ها, عملیات خواندن را می توان به طور همزمان انجام, در حالی که ارسال عملیات بلوک می خواند و هر یک از دیگر. -موتور ورود به سیستم می کند شاخص را پشتیبانی نمی کند. به طور مشابه, اگر نوشتن به یک جدول شکست خورده, جدول شکسته است, و خواندن از این خطا را برمی گرداند. موتور ورود به سیستم مناسب برای داده های موقت است, نوشتن یک بار جداول, و برای تست و یا تظاهرات اهداف. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/fa/engines/table_engines/log_family/log_family.md b/docs/fa/engines/table_engines/log_family/log_family.md deleted file mode 100644 index eea788109ed..00000000000 --- a/docs/fa/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 31 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# ورود خانواده موتور {#log-engine-family} - -هنگامی که شما نیاز به سرعت نوشتن بسیاری از جداول کوچک (تا حدود 1 میلیون ردیف) و بعد به عنوان یک کل خواندن این موتور برای حالات توسعه داده شد. - -موتورهای خانواده: - -- [خط زدن](stripelog.md) -- [ثبت](log.md) -- [جمع شدن](tinylog.md) - -## ویژگیهای مشترک {#common-properties} - -موتورها: - -- ذخیره داده ها بر روی یک دیسک. - -- اضافه کردن داده ها به پایان فایل هنگام نوشتن. - -- قفل پشتیبانی برای دسترسی همزمان داده ها. - - در طول `INSERT` نمایش داده شد, جدول قفل شده است, و دیگر نمایش داده شد برای خواندن و نوشتن داده ها هر دو منتظر جدول برای باز کردن. اگر هیچ نمایش داده شد نوشتن داده ها وجود دارد, هر تعداد از نمایش داده شد خواندن داده ها را می توان به صورت همزمان انجام. - -- پشتیبانی نمی کند [جهش](../../../sql_reference/statements/alter.md#alter-mutations) عملیات. - -- هنوز شاخص را پشتیبانی نمی کند. - - این به این معنی است که `SELECT` نمایش داده شد برای محدوده داده ها موثر نیست. - -- هنوز داده نوشتن نیست اتمی. - - شما می توانید یک جدول با داده های خراب اگر چیزی می شکند عملیات نوشتن, مثلا, خاموش کردن سرور غیر طبیعی. - -## تفاوت {#differences} - -این `TinyLog` موتور ساده ترین در خانواده است و فقیرترین قابلیت ها و کمترین بهره وری را فراهم می کند. این `TinyLog` موتور از خواندن داده های موازی با چندین موضوع پشتیبانی نمی کند. این اطلاعات کندتر از موتورهای دیگر در خانواده است که خواندن موازی را پشتیبانی می کند و تقریبا به عنوان بسیاری از توصیفگرها به عنوان `Log` موتور به دلیل ذخیره هر ستون در یک فایل جداگانه. در حالات کم بار ساده استفاده کنید. - -این `Log` و `StripeLog` موتورهای پشتیبانی خواندن داده های موازی. هنگام خواندن داده ها, تاتر با استفاده از موضوعات متعدد. هر موضوع یک بلوک داده جداگانه را پردازش می کند. این `Log` موتور با استفاده از یک فایل جداگانه برای هر ستون از جدول. `StripeLog` ذخیره تمام داده ها در یک فایل. در نتیجه `StripeLog` موتور با استفاده از توصیف کمتر در سیستم عامل, اما `Log` موتور فراهم می کند بهره وری بالاتر در هنگام خواندن داده ها. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/fa/engines/table_engines/log_family/stripelog.md b/docs/fa/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index eef50f02abb..00000000000 --- a/docs/fa/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 32 -toc_title: "\u062E\u0637 \u0632\u062F\u0646" ---- - -# خط زدن {#stripelog} - -این موتور متعلق به خانواده از موتورهای ورود به سیستم. مشاهده خواص مشترک از موتورهای ورود به سیستم و تفاوت های خود را در [ورود خانواده موتور](log_family.md) مقاله. - -با استفاده از این موتور در حالات زمانی که شما نیاز به نوشتن بسیاری از جداول با مقدار کمی از داده ها (کمتر از 1 میلیون ردیف). - -## ایجاد یک جدول {#table_engines-stripelog-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = StripeLog -``` - -شرح مفصلی از [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) پرس و جو. - -## نوشتن داده ها {#table_engines-stripelog-writing-the-data} - -این `StripeLog` موتور فروشگاه تمام ستون ها در یک فایل. برای هر `INSERT` پرس و جو, خانه رعیتی بلوک داده ها به پایان یک فایل جدول, نوشتن ستون یک به یک. - -برای هر کلیک جدول فایل ها را می نویسد: - -- `data.bin` — Data file. -- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. - -این `StripeLog` موتور را پشتیبانی نمی کند `ALTER UPDATE` و `ALTER DELETE` عملیات. - -## خواندن داده ها {#table_engines-stripelog-reading-the-data} - -فایل را با نشانه اجازه می دهد تا clickhouse به parallelize خواندن داده ها. این به این معنی است که یک `SELECT` پرس و جو ردیف در جهت غیر قابل پیش بینی می گرداند. استفاده از `ORDER BY` بند برای مرتب کردن ردیف. - -## مثال استفاده {#table_engines-stripelog-example-of-use} - -ایجاد یک جدول: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -درج داده: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -ما با استفاده از دو `INSERT` نمایش داده شد برای ایجاد دو بلوک داده ها در داخل `data.bin` پرونده. - -خانه رعیتی با استفاده از موضوعات متعدد در هنگام انتخاب داده ها. هر موضوع یک بلوک داده جداگانه را می خواند و ردیف ها را به طور مستقل به پایان می رساند. در نتیجه, منظور از بلوک های ردیف در خروجی می کند منظور از بلوک های مشابه در ورودی در اکثر موارد مطابقت ندارد. به عنوان مثال: - -``` sql -SELECT * FROM stripe_log_table -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -┌───────────timestamp─┬─message_type─┬─message───────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -└─────────────────────┴──────────────┴───────────────────────────┘ -``` - -مرتب سازی نتایج (صعودی با ترتیب به طور پیش فرض): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/fa/engines/table_engines/log_family/tinylog.md b/docs/fa/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index 1611c916516..00000000000 --- a/docs/fa/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: "\u062C\u0645\u0639 \u0634\u062F\u0646" ---- - -# جمع شدن {#tinylog} - -موتور متعلق به خانواده موتور ورود به سیستم. ببینید [ورود خانواده موتور](log_family.md) برای خواص مشترک موتورهای ورود به سیستم و تفاوت های خود را. - -این موتور جدول معمولا با روش نوشتن یک بار استفاده می شود: نوشتن داده ها یک بار و سپس خواندن هر چند بار که لازم است. مثلا, شما می توانید استفاده کنید `TinyLog`- نوع جداول برای داده های واسطه است که در دسته های کوچک پردازش شده است. توجه داشته باشید که ذخیره سازی داده ها در تعداد زیادی از جداول کوچک بی اثر است. - -نمایش داده شد در یک جریان واحد اجرا شده است. به عبارت دیگر این موتور برای جداول نسبتا کوچک (تا حدود 1000000 ردیف) در نظر گرفته شده است. این را حس می کند به استفاده از این موتور جدول اگر شما بسیاری از جداول کوچک, از ساده تر از [ثبت](log.md) موتور (فایل های کمتر نیاز به باز شود). - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/fa/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/fa/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index dde90fd84b3..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: "\u0631\u06CC\u0632\u062F\u0627\u0646\u0647" ---- - -# ریزدانه {#aggregatingmergetree} - -موتور به ارث می برد از [ادغام](mergetree.md#table_engines-mergetree), تغییر منطق برای ادغام قطعات داده. تاتر جایگزین تمام ردیف با کلید اصلی همان (یا با دقت بیشتر, با همان [کلید مرتب سازی](mergetree.md)) با یک ردیف (در یک بخش یک داده) که ترکیبی از ایالت های توابع کل را ذخیره می کند. - -شما می توانید استفاده کنید `AggregatingMergeTree` جداول برای تجمع داده افزایشی, از جمله برای نمایش محقق جمع. - -موتور پردازش تمام ستون ها با [کارکرد](../../../sql_reference/data_types/aggregatefunction.md) نوع. - -مناسب برای استفاده است `AggregatingMergeTree` اگر تعداد ردیف ها را با دستور کاهش دهد. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[TTL expr] -[SETTINGS name=value, ...] -``` - -برای شرح پارامترهای درخواست را ببینید [درخواست توضیحات](../../../sql_reference/statements/create.md). - -**بندهای پرسوجو** - -هنگام ایجاد یک `AggregatingMergeTree` جدول همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -همه پارامترها همان معنی را دارند `MergeTree`. -
- -## انتخاب و درج {#select-and-insert} - -برای وارد کردن داده ها استفاده کنید [INSERT SELECT](../../../sql_reference/statements/insert_into.md) پرس و جو با کل دولت توابع. -هنگام انتخاب داده ها از `AggregatingMergeTree` جدول استفاده کنید `GROUP BY` بند و توابع کل همان هنگام قرار دادن داده, اما با استفاده از `-Merge` پسوند. - -در نتایج `SELECT` پرس و جو, ارزش `AggregateFunction` نوع اجرای خاص نمایندگی دودویی برای همه فرمت های خروجی کلیک کنید. اگر کمپرسی داده ها به, مثلا, `TabSeparated` قالب با `SELECT` پرس و جو و سپس این روگرفت را می توان با استفاده از لود `INSERT` پرس و جو. - -## به عنوان مثال از یک مشاهده محقق جمع {#example-of-an-aggregated-materialized-view} - -`AggregatingMergeTree` مشاهده تحقق است که به تماشای `test.visits` جدول: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -درج داده به `test.visits` جدول - -``` sql -INSERT INTO test.visits ... -``` - -داده ها در هر دو جدول و مشخصات قرار داده شده `test.basic` که تجمع انجام خواهد شد. - -برای دریافت اطلاعات جمع, ما نیاز به اجرای یک پرس و جو مانند `SELECT ... GROUP BY ...` از نظر `test.basic`: - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/fa/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/fa/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index 25bc525885e..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: "\u0633\u0642\u0648\u0637 \u063A\u0630\u0627\u06CC \u0627\u0635\u0644\u06CC" ---- - -# سقوط غذای اصلی {#table_engine-collapsingmergetree} - -موتور به ارث می برد از [ادغام](mergetree.md) و می افزاید: منطق ردیف سقوط به قطعات داده الگوریتم ادغام. - -`CollapsingMergeTree` ناهمزمان حذف (فرو می ریزد) جفت ردیف اگر همه از زمینه ها در یک کلید مرتب سازی (`ORDER BY`) معادل به استثنای زمینه خاص است `Sign` که می تواند داشته باشد `1` و `-1` ارزشهای خبری عبارتند از: ردیف بدون یک جفت نگهداری می شوند. برای اطلاعات بیشتر نگاه کنید به [سقوط](#table_engine-collapsingmergetree-collapsing) بخش از سند. - -موتور ممکن است به طور قابل توجهی حجم ذخیره سازی را کاهش دهد و بهره وری را افزایش دهد `SELECT` پرس و جو به عنوان یک نتیجه. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -برای شرح پارامترهای پرس و جو, دیدن [توضیحات پرس و جو](../../../sql_reference/statements/create.md). - -**پارامترهای پیش ساخته** - -- `sign` — Name of the column with the type of row: `1` یک “state” سطر, `-1` یک “cancel” پارو زدن. - - Column data type — `Int8`. - -**بندهای پرسوجو** - -هنگام ایجاد یک `CollapsingMergeTree` جدول, همان [بندهای پرسوجو](mergetree.md#table_engine-mergetree-creating-a-table) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -همه پارامترها به استثنای `sign` همان معنی را در `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` — “state” سطر, `-1` — “cancel” پارو زدن. - - Column Data Type — `Int8`. - -
- -## سقوط {#table_engine-collapsingmergetree-collapsing} - -### داده {#data} - -وضعیت جایی که شما نیاز به ذخیره به طور مداوم در حال تغییر داده ها برای برخی از شی را در نظر بگیرید. برای تلفن های موبایل منطقی به یک ردیف برای یک شی و به روز رسانی در هر تغییر, اما عملیات به روز رسانی گران و کند برای سندرم تونل کارپ است چرا که نیاز به بازنویسی از داده ها در ذخیره سازی. اگر شما نیاز به نوشتن داده ها به سرعت, به روز رسانی قابل قبول نیست, اما شما می توانید تغییرات یک شی پی در پی به شرح زیر ارسال. - -استفاده از ستون خاص `Sign`. اگر `Sign = 1` این بدان معنی است که ردیف دولت از یک شی است, اجازه دهید اسمش را “state” پارو زدن. اگر `Sign = -1` به این معنی لغو دولت از یک شی با ویژگی های مشابه, اجازه دهید اسمش را “cancel” پارو زدن. - -برای مثال ما می خواهیم برای محاسبه چقدر صفحات کاربران بررسی می شود در برخی از سایت و چه مدت وجود دارد. در برخی از لحظه ما ارسال ردیف زیر را با دولت از فعالیت های کاربر: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -در چند لحظه بعد ما تغییر فعالیت کاربر را ثبت می کنیم و با دو ردیف زیر می نویسیم. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -ردیف اول لغو حالت قبلی از جسم (کاربر). این باید زمینه های کلیدی مرتب سازی دولت لغو به استثنای کپی کنید `Sign`. - -ردیف دوم شامل وضعیت فعلی. - -همانطور که ما نیاز به تنها دولت گذشته از فعالیت های کاربر, ردیف - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -می توان حذف سقوط نامعتبر (قدیمی) دولت از یک شی. `CollapsingMergeTree` این کار در حالی که ادغام قطعات داده. - -چرا ما نیاز به 2 ردیف برای هر تغییر در خواندن [الگوریتم](#table_engine-collapsingmergetree-collapsing-algorithm) بند بند بند. - -**خواص عجیب و غریب چنین رویکردی** - -1. برنامه ای که می نویسد داده ها باید به یاد داشته باشید دولت از یک شی قادر به لغو. “Cancel” رشته باید نسخه هایی از زمینه های کلیدی مرتب سازی شامل “state” رشته و مخالف `Sign`. این افزایش اندازه اولیه ذخیره سازی اما اجازه می دهد تا به نوشتن داده ها به سرعت. -2. در حال رشد طولانی در ستون کاهش بهره وری از موتور با توجه به بار برای نوشتن. داده های ساده تر, بالاتر بهره وری. -3. این `SELECT` نتایج به شدت بستگی به قوام شی تغییر تاریخ. هنگام تهیه داده ها برای قرار دادن دقیق باشید. شما می توانید نتایج غیر قابل پیش بینی در اطلاعات متناقض برای مثال مقادیر منفی برای معیارهای غیر منفی مانند جلسه عمق. - -### الگوریتم {#table_engine-collapsingmergetree-collapsing-algorithm} - -هنگامی که تاتر ادغام قطعات داده, هر گروه از ردیف متوالی با کلید مرتب سازی همان (`ORDER BY`) به بیش از دو ردیف کاهش می یابد, یکی با `Sign = 1` (“state” ردیف) و دیگری با `Sign = -1` (“cancel” ردیف). به عبارت دیگر, سقوط نوشته. - -برای هر یک از داده ها در نتیجه بخشی تاتر موجب صرفه جویی در: - -1. اولین “cancel” و گذشته “state” ردیف, اگر تعداد “state” و “cancel” ردیف مسابقات و ردیف گذشته است “state” پارو زدن. - -2. گذشته “state” ردیف, اگر بیشتر وجود دارد “state” سطر از “cancel” ردیف - -3. اولین “cancel” ردیف, اگر بیشتر وجود دارد “cancel” سطر از “state” ردیف - -4. هیچ یک از ردیف, در تمام موارد دیگر. - -همچنین زمانی که حداقل وجود دارد 2 بیشتر “state” سطر از “cancel” ردیف یا حداقل 2 بیشتر “cancel” سپس سطرها “state” ردیف, ادغام ادامه, اما تاتر این وضعیت رفتار به عنوان یک خطای منطقی و ثبت در ورود به سیستم سرور. این خطا می تواند رخ دهد اگر داده های مشابه بیش از یک بار قرار داده شد. - -بدین ترتیب, سقوط باید نتایج حاصل از محاسبه ارقام تغییر نمی. -تغییرات به تدریج فرو ریخت به طوری که در پایان تنها دولت گذشته تقریبا در هر شی را ترک کرد. - -این `Sign` لازم است زیرا الگوریتم ادغام تضمین نمی کند که تمام ردیف ها با کلید مرتب سازی مشابه در بخش داده های مشابه و حتی در همان سرور فیزیکی باشد. روند کلیک `SELECT` نمایش داده شد با موضوعات مختلف و می تواند منظور از ردیف در نتیجه پیش بینی نیست. تجمع مورد نیاز است اگر نیاز به طور کامل وجود دارد “collapsed” داده ها از `CollapsingMergeTree` جدول - -برای نهایی سقوط, نوشتن یک پرس و جو با `GROUP BY` بند و مجموع توابع است که برای ثبت نام حساب. برای مثال برای محاسبه مقدار استفاده کنید `sum(Sign)` به جای `count()`. برای محاسبه مجموع چیزی استفاده کنید `sum(Sign * x)` به جای `sum(x)` و به همین ترتیب و همچنین اضافه کنید `HAVING sum(Sign) > 0`. - -مصالح `count`, `sum` و `avg` می تواند محاسبه این راه. مجموع `uniq` می تواند محاسبه شود اگر یک شی حداقل یک دولت سقوط نیست. مصالح `min` و `max` محاسبه نشد زیرا `CollapsingMergeTree` می کند تاریخ ارزش از کشورهای سقوط را نجات دهد. - -اگر شما نیاز به استخراج داده ها بدون تجمع (مثلا, برای بررسی اینکه ردیف در حال حاضر که جدیدترین ارزش مطابقت با شرایط خاص هستند), شما می توانید با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. این رویکرد به طور قابل توجهی کمتر موثر است. - -## مثال استفاده {#example-of-use} - -اطلاعات نمونه: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -ایجاد جدول: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -درج داده ها: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -ما با استفاده از دو `INSERT` نمایش داده شد برای ایجاد دو بخش داده های مختلف. اگر ما وارد کردن داده ها با یک پرس و جو تاتر ایجاد یک بخش داده ها و هر گونه ادغام تا کنون انجام نمی. - -گرفتن داده ها: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -چه ما را ببینید و جایی که در حال سقوط است? - -با دو `INSERT` نمایش داده شد, ما ایجاد 2 قطعات داده. این `SELECT` پرس و جو در انجام شد 2 موضوعات, و ما یک نظم تصادفی از ردیف کردم. سقوط رخ داده است چرا که هیچ ادغام از قطعات داده وجود دارد و در عین حال. تاتر ادغام بخش داده ها در یک لحظه ناشناخته که ما نمی توانیم پیش بینی. - -بنابراین ما نیاز به تجمع: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -اگر ما تجمع نیاز ندارد و می خواهید به زور سقوط, ما می توانیم با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -این روش انتخاب داده ها بسیار کم است. برای میزهای بزرگ ازش استفاده نکن - -## نمونه ای از روش دیگری {#example-of-another-approach} - -اطلاعات نمونه: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ -5 │ -146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -ایده این است که ادغام را به حساب تنها زمینه های کلیدی. و در “Cancel” خط ما می توانیم مقادیر منفی که برابر نسخه های قبلی از ردیف در هنگام جمع بدون استفاده از ستون نشانه را مشخص کنید. برای این روش لازم است نوع داده را تغییر دهید `PageViews`,`Duration` برای ذخیره مقادیر منفی از UInt8 -\> Int16. - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews Int16, - Duration Int16, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -بیایید روش را تست کنیم: - -``` sql -insert into UAct values(4324182021466249494, 5, 146, 1); -insert into UAct values(4324182021466249494, -5, -146, -1); -insert into UAct values(4324182021466249494, 6, 185, 1); - -select * from UAct final; // avoid using final in production (just for a test or small tables) -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -``` sql -SELECT - UserID, - sum(PageViews) AS PageViews, - sum(Duration) AS Duration -FROM UAct -GROUP BY UserID -```text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -``` sqk -select count() FROM UAct -``` - -``` text -┌─count()─┐ -│ 3 │ -└─────────┘ -``` - -``` sql -optimize table UAct final; - -select * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/fa/engines/table_engines/mergetree_family/custom_partitioning_key.md b/docs/fa/engines/table_engines/mergetree_family/custom_partitioning_key.md deleted file mode 100644 index b7848bdebc4..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 32 -toc_title: "\u06A9\u0644\u06CC\u062F \u067E\u0627\u0631\u062A\u06CC\u0634\u0646 \u0628\ - \u0646\u062F\u06CC \u0633\u0641\u0627\u0631\u0634\u06CC" ---- - -# کلید پارتیشن بندی سفارشی {#custom-partitioning-key} - -پارتیشن بندی برای [ادغام](mergetree.md) جداول خانواده (شامل [تکرار](replication.md) جدول). [نمایش محقق](../special/materializedview.md) بر اساس جداول ادغام پشتیبانی پارتیشن بندی, همچنین. - -پارتیشن ترکیبی منطقی از سوابق در یک جدول توسط یک معیار مشخص شده است. شما می توانید یک پارتیشن توسط معیار دلخواه تنظیم, مانند ماه, به روز, و یا بر اساس نوع رویداد. هر پارتیشن به طور جداگانه ذخیره می شود به ساده دستکاری این داده ها. هنگام دسترسی به داده ها, تاتر با استفاده از کوچکترین زیر مجموعه از پارتیشن ممکن. - -پارتیشن در مشخص `PARTITION BY expr` بند زمانی که [ایجاد یک جدول](mergetree.md#table_engine-mergetree-creating-a-table). کلید پارتیشن می تواند هر عبارت از ستون های جدول باشد. برای مثال برای مشخص کردن پارتیشن بندی توسط ماه با استفاده از بیان `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour; -``` - -کلید پارتیشن همچنین می تواند یک تاپل از عبارات (شبیه به [کلید اصلی](mergetree.md#primary-keys-and-indexes-in-queries)). به عنوان مثال: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -در این مثال ما مجموعه پارتیشن بندی توسط انواع رویداد رخ داده است که در طول هفته جاری. - -هنگام قرار دادن داده های جدید به یک جدول, این داده ها به عنوان یک بخش جداگانه ذخیره می شود (تکه) مرتب شده بر اساس کلید اصلی. در 10-15 دقیقه پس از قرار دادن, بخش هایی از پارتیشن همان به کل بخش با هم ادغام شدند. - -!!! info "اطلاعات" - ادغام تنها برای قطعات داده که همان مقدار برای بیان پارتیشن بندی کار می کند. این به این معنی است **شما باید پارتیشن بیش از حد دانه را ندارد** (بیش از حدود یک هزار پارتیشن). در غیر این صورت `SELECT` پرس و جو انجام ضعیف به دلیل تعداد نامعقول زیادی از فایل ها در سیستم فایل و توصیف باز کردن فایل. - -استفاده از [سیستم.قطعات](../../../operations/system_tables.md#system_tables-parts) جدول برای مشاهده قطعات جدول و پارتیشن. مثلا, اجازه دهید فرض کنیم که ما یک `visits` جدول با پارتیشن بندی در ماه. بیایید انجام دهیم `SELECT` پرسوجو برای `system.parts` جدول: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 1 │ -│ 201902 │ 201902_11_11_0 │ 1 │ -└───────────┴────────────────┴────────┘ -``` - -این `partition` ستون شامل نام پارتیشن. دو پارتیشن در این مثال وجود دارد: `201901` و `201902`. شما می توانید از این مقدار ستون برای مشخص کردن نام پارتیشن در استفاده کنید [ALTER … PARTITION](#alter_manipulations-with-partitions) نمایش داده شد. - -این `name` ستون شامل نام قطعات داده پارتیشن. شما می توانید از این ستون برای مشخص کردن نام شرکت در [ALTER ATTACH PART](#alter_attach-partition) پرس و جو. - -بیایید شکستن نام بخش اول: `201901_1_3_1`: - -- `201901` نام پارتیشن است. -- `1` حداقل تعداد بلوک داده است. -- `3` حداکثر تعداد بلوک داده است. -- `1` سطح تکه (عمق درخت ادغام از تشکیل شده است). - -!!! info "اطلاعات" - بخش هایی از جداول قدیمی از نوع نام: `20190117_20190123_2_2_0` (حداقل تاریخ - حداکثر تاریخ - حداقل تعداد بلوک - حداکثر تعداد بلوک - سطح). - -این `active` ستون وضعیت بخش را نشان می دهد. `1` فعال است; `0` غیر فعال است. قطعات غیر فعال هستند, مثلا, قطعات منبع باقی مانده پس از ادغام به بخش بزرگتر. قطعات داده خراب نیز به عنوان غیر فعال نشان داد. - -همانطور که شما می توانید در مثال ببینید, چندین بخش از هم جدا از پارتیشن های مشابه وجود دارد (مثلا, `201901_1_3_1` و `201901_1_9_2`). این به این معنی است که این قطعات با هم ادغام شدند و در عین حال. تاتر بخش های داده شده داده ها را به صورت دوره ای در حدود 15 دقیقه پس از قرار دادن ادغام می کند. علاوه بر این, شما می توانید یک ادغام غیر برنامه ریزی شده با استفاده از انجام [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) پرس و جو. مثال: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 0 │ -│ 201902 │ 201902_4_11_2 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 0 │ -│ 201902 │ 201902_11_11_0 │ 0 │ -└───────────┴────────────────┴────────┘ -``` - -قطعات غیر فعال خواهد شد حدود حذف 10 دقیقه پس از ادغام. - -راه دیگر برای مشاهده مجموعه ای از قطعات و پارتیشن ها این است که به دایرکتوری جدول بروید: `/var/lib/clickhouse/data///`. به عنوان مثال: - -``` bash -/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -پوشهها ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ و به همین ترتیب دایرکتوری از قطعات هستند. هر بخش مربوط به پارتیشن مربوطه و شامل داده ها فقط برای یک ماه خاص (جدول در این مثال پارتیشن بندی توسط ماه). - -این `detached` دایرکتوری شامل قطعات است که از جدول با استفاده از جدا شد [DETACH](#alter_detach-partition) پرس و جو. قطعات خراب نیز به این دایرکتوری منتقل, به جای اینکه حذف. سرور از قطعات از `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql_reference/statements/alter.md#alter_attach-partition) پرس و جو. - -توجه داشته باشید که در سرور عامل شما نمی توانید به صورت دستی مجموعه ای از قطعات یا داده های خود را بر روی سیستم فایل تغییر دهید زیرا سرور در این مورد نمی داند. برای جداول غیر تکرار, شما می توانید این کار را انجام زمانی که سرور متوقف شده است, اما توصیه نمی شود. برای جداول تکرار, مجموعه ای از قطعات را نمی توان در هر صورت تغییر. - -کلیک هاوس اجازه می دهد تا شما را به انجام عملیات با پارتیشن: حذف, کپی از یک جدول به دیگری, و یا ایجاد یک نسخه پشتیبان تهیه. مشاهده لیست تمام عملیات در بخش [دستکاری با پارتیشن ها و قطعات](../../../sql_reference/statements/alter.md#alter_manipulations-with-partitions). - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/fa/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/fa/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index b3665e06d24..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: "\u0646\u0645\u0648\u062F\u0627\u0631" ---- - -# نمودار {#graphitemergetree} - -این موتور طراحی شده است برای نازک شدن و جمع/متوسط (خلاصه) [گرافیت](http://graphite.readthedocs.io/en/latest/index.html) داده ها. این ممکن است به توسعه دهندگان که می خواهند به استفاده از تاتر به عنوان یک فروشگاه داده ها برای گرافیت مفید است. - -شما می توانید هر موتور جدول کلیک برای ذخیره داده گرافیت اگر شما رولپ نیاز ندارد استفاده, اما اگر شما نیاز به یک استفاده خلاصه `GraphiteMergeTree`. موتور حجم ذخیره سازی را کاهش می دهد و بهره وری نمایش داده شد از گرافیت را افزایش می دهد. - -موتور خواص از ارث می برد [ادغام](mergetree.md). - -## ایجاد یک جدول {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -مشاهده شرح مفصلی از [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) پرس و جو. - -یک جدول برای داده های گرافیت باید ستون های زیر را برای داده های زیر داشته باشد: - -- نام متریک (سنسور گرافیت). نوع داده: `String`. - -- زمان اندازه گیری متریک. نوع داده: `DateTime`. - -- ارزش متریک. نوع داده: هر عددی. - -- نسخه از متریک. نوع داده: هر عددی. - - تاتر موجب صرفه جویی در ردیف با بالاترین نسخه و یا گذشته نوشته شده است اگر نسخه یکسان هستند. ردیف های دیگر در طول ادغام قطعات داده حذف می شوند. - -نام این ستون ها باید در پیکربندی خلاصه مجموعه. - -**پارامترهای نمودار** - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -**بندهای پرسوجو** - -هنگام ایجاد یک `GraphiteMergeTree` جدول, همان [بند](mergetree.md#table_engine-mergetree-creating-a-table) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -همه پارامترها به استثنای `config_section` همان معنی را در `MergeTree`. - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -
- -## پیکربندی رولپ {#rollup-configuration} - -تنظیمات برای خلاصه توسط تعریف [لغزش \_ نمودار](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) پارامتر در پیکربندی سرور. نام پارامتر می تواند هر. شما می توانید تنظیمات متعددی ایجاد کنید و برای جداول مختلف استفاده کنید. - -ساختار پیکربندی رولپ: - - required-columns - patterns - -### ستون های مورد نیاز {#required-columns} - -- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. -- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. -- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. مقدار پیشفرض: `Value`. -- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. - -### الگوها {#patterns} - -ساختار `patterns` بخش: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "توجه" - الگوها باید به شدت دستور داده شوند: - - 1. Patterns without `function` or `retention`. - 1. Patterns with both `function` and `retention`. - 1. Pattern `default`. - -هنگام پردازش یک ردیف, تاتر چک قوانین در `pattern` بخش. هر یک از `pattern` (شامل `default`) بخش می تواند شامل `function` پارامتر برای تجمع, `retention` پارامترها یا هر دو. اگر نام متریک با `regexp`, قوانین از `pattern` بخش (یا بخش) اعمال می شود; در غیر این صورت, قوانین از `default` بخش استفاده می شود. - -زمینه برای `pattern` و `default` بخش ها: - -- `regexp`– A pattern for the metric name. -- `age` – The minimum age of the data in seconds. -- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). -- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. - -### مثال پیکربندی {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/fa/engines/table_engines/mergetree_family/mergetree.md b/docs/fa/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index 49d3698ca96..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,654 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 30 -toc_title: "\u0627\u062F\u063A\u0627\u0645" ---- - -# ادغام {#table_engines-mergetree} - -این `MergeTree` موتور و سایر موتورهای این خانواده (`*MergeTree`) موتورهای جدول کلیک قوی ترین. - -موتور در `MergeTree` خانواده برای قرار دادن مقدار بسیار زیادی از داده ها را به یک جدول طراحی شده است. داده ها به سرعت به بخش جدول توسط بخش نوشته شده است, سپس قوانین برای ادغام قطعات در پس زمینه اعمال. این روش بسیار موثرتر از به طور مستمر بازنویسی داده ها در ذخیره سازی در درج است. - -ویژگی های اصلی: - -- فروشگاه داده طبقه بندی شده اند توسط کلید اصلی. - - این اجازه می دهد تا به شما برای ایجاد یک شاخص پراکنده کوچک است که کمک می کند تا پیدا کردن اطلاعات سریع تر. - -- پارتیشن ها را می توان در صورت استفاده کرد [کلید پارتیشن بندی](custom_partitioning_key.md) مشخص شده است. - - تاتر پشتیبانی از عملیات خاص با پارتیشن که موثر تر از عملیات عمومی بر روی داده های مشابه با همان نتیجه. کلیک هاوس همچنین به طور خودکار داده های پارتیشن را که کلید پارتیشن بندی در پرس و جو مشخص شده است قطع می کند. این نیز باعث بهبود عملکرد پرس و جو. - -- پشتیبانی از تکرار داده ها. - - خانواده `ReplicatedMergeTree` جداول فراهم می کند تکرار داده ها. برای کسب اطلاعات بیشتر, دیدن [تکرار داده ها](replication.md). - -- پشتیبانی از نمونه برداری داده ها. - - در صورت لزوم می توانید روش نمونه گیری داده ها را در جدول تنظیم کنید. - -!!! info "اطلاعات" - این [ادغام](../special/merge.md) موتور به تعلق ندارد `*MergeTree` خانواده - -## ایجاد یک جدول {#table_engine-mergetree-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 -) ENGINE = MergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] -[SETTINGS name=value, ...] -``` - -برای شرح پارامترها [ایجاد توصیف پرسوجو](../../../sql_reference/statements/create.md). - -!!! note "یادداشت" - `INDEX` یک ویژگی تجربی است [شاخص های داده پرش](#table_engine-mergetree-data_skipping-indexes). - -### بندهای پرسوجو {#mergetree-query-clauses} - -- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. این `MergeTree` موتور پارامترهای ندارد. - -- `PARTITION BY` — The [کلید پارتیشن بندی](custom_partitioning_key.md). - - برای تقسیم ماه از `toYYYYMM(date_column)` عبارت, جایی که `date_column` یک ستون با تاریخ از نوع است [تاریخ](../../../sql_reference/data_types/date.md). نام پارتیشن در اینجا `"YYYYMM"` قالب. - -- `ORDER BY` — The sorting key. - - یک تاپل از ستون ها و یا عبارات دلخواه. مثال: `ORDER BY (CounterID, EventDate)`. - -- `PRIMARY KEY` — The primary key if it [متفاوت از کلید مرتب سازی](#choosing-a-primary-key-that-differs-from-the-sorting-key). - - به طور پیش فرض کلید اصلی همان کلید مرتب سازی است (که توسط مشخص شده است `ORDER BY` بند). بنابراین در اکثر موارد غیر ضروری است برای مشخص کردن یک جداگانه `PRIMARY KEY` بند بند. - -- `SAMPLE BY` — An expression for sampling. - - اگر یک عبارت نمونه برداری استفاده شده است, کلید اصلی باید باشد. مثال: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. - -- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [بین دیسک و حجم](#table_engine-mergetree-multiple-volumes). - - بیان باید یکی داشته باشد `Date` یا `DateTime` ستون به عنوان یک نتیجه. مثال: - `TTL date + INTERVAL 1 DAY` - - نوع قانون `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` مشخص یک عمل با بخش انجام می شود در صورتی که بیان راضی است (می رسد زمان فعلی): حذف ردیف منقضی شده, در حال حرکت بخشی (اگر بیان برای تمام ردیف در یک بخش راضی است) به دیسک مشخص (`TO DISK 'xxx'`) یا به حجم (`TO VOLUME 'xxx'`). نوع پیش فرض قانون حذف است (`DELETE`). فهرست قوانین متعدد می توانید مشخص, اما باید بیش از یک وجود داشته باشد `DELETE` قانون. - - برای اطلاعات بیشتر, دیدن [ستون ها و جداول](#table_engine-mergetree-ttl) - -- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: - - - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [ذخیره سازی داده ها](#mergetree-data-storage). - - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [ذخیره سازی داده ها](#mergetree-data-storage). - - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` تنظیمات. قبل از نسخه 19.11, تنها وجود دارد `index_granularity` تنظیم برای محدود کردن اندازه گرانول. این `index_granularity_bytes` تنظیم را بهبود می بخشد عملکرد کلیک در هنگام انتخاب داده ها از جداول با ردیف بزرگ (ده ها و صدها مگابایت). اگر شما جداول با ردیف بزرگ, شما می توانید این تنظیمات را برای جداول را قادر به بهبود بهره وری از `SELECT` نمایش داده شد. - - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, سپس باغ وحش ذخیره داده های کمتر. برای کسب اطلاعات بیشتر, دیدن [تنظیم توضیحات](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) داخل “Server configuration parameters”. - - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` بایت, تاتر می خواند و می نویسد داده ها به دیسک ذخیره سازی با استفاده از رابط من/ای مستقیم (`O_DIRECT` گزینه). اگر `min_merge_bytes_to_use_direct_io = 0`, سپس مستقیم من / ای غیر فعال است. مقدار پیشفرض: `10 * 1024 * 1024 * 1024` بایت - - - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). - - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don't turn it off. - - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. - - `storage_policy` — Storage policy. See [با استفاده از دستگاه های بلوک های متعدد برای ذخیره سازی داده ها](#table_engine-mergetree-multiple-volumes). - -**مثال تنظیمات بخش** - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 -``` - -در مثال ما مجموعه پارتیشن بندی توسط ماه. - -ما همچنین یک عبارت برای نمونه برداری به عنوان یک هش توسط شناسه کاربر تنظیم شده است. این اجازه می دهد تا شما را به نام مستعار داده ها در جدول برای هر `CounterID` و `EventDate`. اگر یک تعریف می کنید [SAMPLE](../../../sql_reference/statements/select.md#select-sample-clause) بند هنگام انتخاب داده ClickHouse را یک به طور مساوی pseudorandom داده های نمونه به صورت زیر مجموعه ای از کاربران است. - -این `index_granularity` تنظیم می تواند حذف شود زیرا 8192 مقدار پیش فرض است. - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - از این روش در پروژه های جدید استفاده نکنید. در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -**پارامترهای ادغام() ** - -- `date-column` — The name of a column of the [تاریخ](../../../sql_reference/data_types/date.md) نوع. تاتر به طور خودکار ایجاد پارتیشن های ماه بر اساس این ستون. نام پارتیشن در `"YYYYMM"` قالب. -- `sampling_expression` — An expression for sampling. -- `(primary, key)` — Primary key. Type: [تاپل()](../../../sql_reference/data_types/tuple.md) -- `index_granularity` — The granularity of an index. The number of data rows between the “marks” از یک شاخص. ارزش 8192 برای بسیاری از وظایف مناسب است. - -**مثال** - -``` sql -MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) -``` - -این `MergeTree` موتور در همان راه به عنوان مثال بالا برای روش پیکربندی موتور اصلی پیکربندی شده است. -
- -## ذخیره سازی داده ها {#mergetree-data-storage} - -جدول شامل قطعات داده مرتب شده بر اساس کلید اصلی. - -هنگامی که داده ها در یک جدول قرار داده, قطعات داده های جداگانه ایجاد می شوند و هر یک از این واژه ها از لحاظ واژگان توسط کلید اصلی طبقه بندی شده اند. برای مثال اگر کلید اصلی است `(CounterID, Date)` داده ها در بخش طبقه بندی شده اند `CounterID` و در هر `CounterID`, این است که توسط دستور داد `Date`. - -داده های متعلق به پارتیشن های مختلف به بخش های مختلف جدا می شوند. در پس زمینه, کلیکهاوس ادغام قطعات داده ها برای ذخیره سازی موثر تر. قطعات متعلق به پارتیشن های مختلف با هم ادغام شدند. مکانیزم ادغام تضمین نمی کند که تمام ردیف ها با همان کلید اصلی در بخش داده های مشابه باشد. - -هر بخش داده منطقی به گرانول تقسیم شده است. گرانول کوچکترین مجموعه داده های تفکیک پذیر است که خانه می خواند در هنگام انتخاب داده ها است. خانه را کلیک می کند ردیف یا ارزش تقسیم نمی, بنابراین هر گرانول همیشه شامل یک عدد صحیح از ردیف. ردیف اول یک گرانول با ارزش کلید اصلی برای ردیف مشخص شده است. برای هر بخش داده, تاتر ایجاد یک فایل شاخص است که فروشگاه علامت. برای هر ستون, چه در کلید اصلی است یا نه, خانه رعیتی نیز علامت همان فروشگاه. این علامت به شما اجازه داده پیدا کردن به طور مستقیم در فایل های ستون. - -اندازه گرانول توسط `index_granularity` و `index_granularity_bytes` تنظیمات موتور جدول. تعداد ردیف ها در یک گرانول در `[1, index_granularity]` محدوده, بسته به اندازه ردیف. اندازه گرانول می تواند بیش از `index_granularity_bytes` اگر اندازه یک ردیف بیشتر از ارزش تنظیم است. در این مورد, اندازه گرانول برابر اندازه ردیف. - -## کلید های اولیه و شاخص ها در نمایش داده شد {#primary-keys-and-indexes-in-queries} - -نگاهی به `(CounterID, Date)` کلید اصلی به عنوان مثال. در این مورد, مرتب سازی و شاخص را می توان به شرح زیر نشان داده شده: - - Whole data: [---------------------------------------------] - CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] - Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] - Marks: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 - Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 - -اگر پرسوجوی داده مشخص شود: - -- `CounterID in ('a', 'h')`, سرور بار خوانده شده داده ها در محدوده علامت `[0, 3)` و `[6, 8)`. -- `CounterID IN ('a', 'h') AND Date = 3`, سرور بار خوانده شده داده ها در محدوده علامت `[1, 3)` و `[7, 8)`. -- `Date = 3`, سرور می خواند داده ها در طیف وسیعی از علامت `[1, 10]`. - -نمونه های فوق نشان می دهد که همیشه بیشتر موثر برای استفاده از شاخص از اسکن کامل است. - -شاخص پراکنده اجازه می دهد تا داده های اضافی به عنوان خوانده شده. هنگام خواندن یک طیف وسیعی از کلید اصلی, تا `index_granularity * 2` ردیف اضافی در هر بلوک داده را می توان به عنوان خوانده شده. - -شاخص پراکنده اجازه می دهد شما را به کار با تعداد بسیار زیادی از ردیف جدول, چرا که در اکثر موارد, چنین شاخص در رم کامپیوتر مناسب. - -کلیک یک کلید اصلی منحصر به فرد نیاز ندارد. شما می توانید ردیف های متعدد را با همان کلید اولیه وارد کنید. - -### انتخاب کلید اصلی {#selecting-the-primary-key} - -تعداد ستون ها در کلید اصلی به صراحت محدود نمی شود. بسته به ساختار داده ها, شما می توانید ستون های بیشتر یا کمتر در کلید اصلی شامل. این ممکن است: - -- بهبود عملکرد یک شاخص. - - اگر کلید اصلی است `(a, b)` سپس یک ستون دیگر اضافه کنید `c` عملکرد را بهبود می بخشد اگر شرایط زیر رعایت شود: - - - نمایش داده شد با یک شرط در ستون وجود دارد `c`. - - محدوده داده های طولانی (چندین بار طولانی تر از `index_granularity`) با مقادیر یکسان برای `(a, b)` شایع هستند. به عبارت دیگر, در هنگام اضافه کردن یک ستون دیگر اجازه می دهد تا شما را به جست و خیز محدوده داده بسیار طولانی. - -- بهبود فشرده سازی داده ها. - - خانه را کلیک کنید انواع داده ها توسط کلید اصلی, بنابراین بالاتر از ثبات, بهتر فشرده سازی. - -- فراهم می کند که منطق اضافی در هنگام ادغام قطعات داده در [سقوط غذای اصلی](collapsingmergetree.md#table_engine-collapsingmergetree) و [سامینگمرگتری](summingmergetree.md) موتورها. - - در این مورد منطقی است که مشخص شود *کلید مرتب سازی* که متفاوت از کلید اصلی است. - -یک کلید اولیه طولانی منفی عملکرد درج و مصرف حافظه تاثیر می گذارد, اما ستون های اضافی در کلید اصلی انجام عملکرد تاتر در طول تاثیر نمی گذارد `SELECT` نمایش داده شد. - -### انتخاب کلید اصلی است که متفاوت از کلید مرتب سازی {#choosing-a-primary-key-that-differs-from-the-sorting-key} - -ممکن است که به مشخص کردن یک کلید اولیه (بیان با ارزش هایی که در فایل شاخص برای هر علامت نوشته شده است) که متفاوت از کلید مرتب سازی (بیان برای مرتب سازی ردیف در بخش های داده). در این مورد تاپل عبارت کلیدی اولیه باید یک پیشوند از تاپل عبارت کلیدی مرتب سازی شود. - -این ویژگی در هنگام استفاده از مفید است [سامینگمرگتری](summingmergetree.md) و -[ریزدانه](aggregatingmergetree.md) موتورهای جدول. در یک مورد مشترک در هنگام استفاده از این موتور جدول دو نوع ستون است: *ابعاد* و *اقدامات*. نمایش داده شد نمونه مقادیر کل ستون اندازه گیری با دلخواه `GROUP BY` و فیلتر بر اساس ابعاد. چون SummingMergeTree و AggregatingMergeTree جمع ردیف با همان مقدار از مرتب سازی کلیدی است برای اضافه کردن همه ابعاد آن است. در نتیجه, بیان کلیدی شامل یک لیست طولانی از ستون ها و این لیست باید اغلب با ابعاد تازه اضافه شده به روز. - -در این مورد منطقی است که تنها چند ستون در کلید اصلی را ترک کنید که اسکن های محدوده ای موثر را فراهم می کند و ستون های بعد باقی مانده را به دسته کلید مرتب سازی اضافه می کند. - -[ALTER](../../../sql_reference/statements/alter.md) از کلید مرتب سازی یک عملیات سبک وزن است چرا که زمانی که یک ستون جدید به طور همزمان به جدول و به کلید مرتب سازی اضافه, قطعات داده های موجود لازم نیست به تغییر. از کلید مرتب سازی قدیمی یک پیشوند از کلید مرتب سازی جدید است و هیچ داده در ستون به تازگی اضافه شده وجود دارد, داده ها توسط هر دو کلید مرتب سازی قدیمی و جدید در لحظه اصلاح جدول طبقه بندی شده اند. - -### استفاده از شاخص ها و پارتیشن ها در نمایش داده شد {#use-of-indexes-and-partitions-in-queries} - -برای `SELECT` نمایش داده شد, فاحشه خانه تجزیه و تحلیل اینکه یک شاخص می تواند مورد استفاده قرار گیرد. شاخص می تواند مورد استفاده قرار گیرد در صورتی که `WHERE/PREWHERE` بند بیان (به عنوان یکی از عناصر رابطه یا به طور کامل) است که نشان دهنده برابری یا نابرابری عملیات مقایسه و یا اگر `IN` یا `LIKE` با یک پیشوند ثابت در ستون ها و یا عبارات که در کلید اصلی و یا پارتیشن بندی هستند, و یا در برخی از توابع تا حدی تکراری از این ستون ها, و یا روابط منطقی از این عبارات. - -بدین ترتیب, ممکن است به سرعت اجرا نمایش داده شد در یک یا بسیاری از محدوده کلید اصلی. در این مثال, نمایش داده شد سریع خواهد بود که برای یک تگ ردیابی خاص اجرا, برای یک برچسب خاص و محدوده تاریخ, برای یک تگ و تاریخ خاص, برای برچسب های متعدد با محدوده تاریخ, و غیره. - -بیایید به موتور پیکربندی شده به شرح زیر نگاه کنیم: - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 - -در این مورد در نمایش داده شد: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -خانه رعیتی خواهد شاخص کلید اصلی به تر و تمیز داده های نامناسب و کلید پارتیشن بندی ماهانه به تر و تمیز پارتیشن که در محدوده تاریخ نامناسب هستند استفاده کنید. - -نمایش داده شد بالا نشان می دهد که شاخص حتی برای عبارات پیچیده استفاده می شود. خواندن از جدول سازمان یافته است به طوری که با استفاده از شاخص نمی تواند کندتر از اسکن کامل. - -در مثال زیر شاخص نمی تواند مورد استفاده قرار گیرد. - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -برای بررسی اینکه تاتر می توانید شاخص زمانی که در حال اجرا یک پرس و جو استفاده, استفاده از تنظیمات [اجبار](../../../operations/settings/settings.md#settings-force_index_by_date) و [اجبار](../../../operations/settings/settings.md). - -کلید پارتیشن بندی توسط ماه اجازه می دهد تا خواندن تنها کسانی که بلوک های داده که حاوی تاریخ از محدوده مناسب. در این مورد, بلوک داده ها ممکن است حاوی داده ها برای بسیاری از تاریخ (تا یک ماه کامل). در یک بلوک, داده ها توسط کلید اصلی طبقه بندی شده اند, که ممکن است حاوی تاریخ به عنوان ستون اول نیست. به خاطر همین, با استفاده از یک پرس و جو تنها با یک وضعیت تاریخ که پیشوند کلید اصلی مشخص نیست باعث می شود اطلاعات بیشتر از یک تاریخ به عنوان خوانده شود. - -### استفاده از شاخص برای کلید های اولیه تا حدی یکنواخت {#use-of-index-for-partially-monotonic-primary-keys} - -در نظر بگیرید, مثلا, روز از ماه. یک فرم [توالی یکنواختی](https://en.wikipedia.org/wiki/Monotonic_function) برای یک ماه, اما برای مدت طولانی تر یکنواخت نیست. این یک توالی نیمه یکنواخت است. اگر یک کاربر ایجاد جدول با نیمه یکنواخت کلید اولیه, خانه را ایجاد یک شاخص پراکنده به طور معمول. هنگامی که یک کاربر داده ها را انتخاب از این نوع از جدول, تاتر تجزیه و تحلیل شرایط پرس و جو. اگر کاربر می خواهد برای دریافت اطلاعات بین دو علامت از شاخص و هر دو این علامت در عرض یک ماه سقوط, خانه رعیتی می توانید شاخص در این مورد خاص استفاده کنید زیرا می تواند فاصله بین پارامترهای یک پرس و جو و شاخص محاسبه. - -کلیک خانه می تواند یک شاخص استفاده کنید اگر ارزش های کلید اصلی در محدوده پارامتر پرس و جو یک توالی یکنواخت نشان دهنده نیست. در این مورد, تاتر با استفاده از روش اسکن کامل. - -تاتر با استفاده از این منطق نه تنها برای روز از توالی ماه, اما برای هر کلید اصلی است که نشان دهنده یک توالی نیمه یکنواخت. - -### شاخص های پرش داده (تجربی) {#table_engine-mergetree-data_skipping-indexes} - -اعلامیه شاخص در بخش ستون ها از `CREATE` پرس و جو. - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -برای جداول از `*MergeTree` خانواده, شاخص پرش داده را می توان مشخص. - -این شاخص جمع برخی از اطلاعات در مورد بیان مشخص شده بر روی بلوک, که شامل `granularity_value` گرانول (اندازه گرانول با استفاده از `index_granularity` تنظیم در موتور جدول). سپس این دانه ها در استفاده می شود `SELECT` نمایش داده شد برای کاهش مقدار داده ها به خواندن از روی دیسک با پرش بلوک های بزرگ از داده ها که `where` پرس و جو نمی تواند راضی باشد. - -**مثال** - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -شاخص ها از مثال می توانند توسط کلیک خانه استفاده شوند تا میزان داده ها را برای خواندن از دیسک در موارد زیر کاهش دهند: - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### انواع شاخص های موجود {#available-types-of-indices} - -- `minmax` - - فروشگاه افراط و بیان مشخص شده (در صورتی که بیان شده است `tuple` سپس افراط را برای هر عنصر ذخیره می کند `tuple`), با استفاده از اطلاعات ذخیره شده برای پرش بلوک از داده ها مانند کلید اصلی. - -- `set(max_rows)` - - ارزش های منحصر به فرد بیان مشخص شده را ذخیره می کند (بیش از `max_rows` سطرها, `max_rows=0` یعنی “no limits”). با استفاده از مقادیر برای بررسی در صورتی که `WHERE` بیان رضایت بخش در یک بلوک از داده ها نیست. - -- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - فروشگاه ها [فیلتر بلوم](https://en.wikipedia.org/wiki/Bloom_filter) که شامل تمام نمگرام از یک بلوک از داده ها. این نسخهها کار میکند تنها با رشته. می توان برای بهینه سازی استفاده کرد `equals`, `like` و `in` عبارات. - - - `n` — ngram size, - - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). - - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. - - `random_seed` — The seed for Bloom filter hash functions. - -- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - همان `ngrambf_v1`, اما فروشگاه نشانه به جای نمرگرام. نشانه ها توالی هایی هستند که توسط شخصیت های غیر عددی جدا شده اند. - -- `bloom_filter([false_positive])` — Stores a [فیلتر بلوم](https://en.wikipedia.org/wiki/Bloom_filter) برای ستون مشخص. - - اختیاری `false_positive` پارامتر احتمال دریافت پاسخ مثبت کاذب از فیلتر است. مقادیر ممکن: (0, 1). مقدار پیش فرض: 0.025. - - انواع داده های پشتیبانی شده: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. - - توابع زیر می توانند از این استفاده کنند: [برابر](../../../sql_reference/functions/comparison_functions.md), [نقلقولها](../../../sql_reference/functions/comparison_functions.md), [داخل](../../../sql_reference/functions/in_functions.md), [notIn](../../../sql_reference/functions/in_functions.md), [دارد](../../../sql_reference/functions/array_functions.md). - - - -``` sql -INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 -INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 -``` - -#### توابع پشتیبانی {#functions-support} - -شرایط در `WHERE` بند شامل تماس از توابع است که با ستون کار. اگر ستون بخشی از یک شاخص است, خانه رعیتی تلاش می کند تا استفاده از این شاخص در هنگام انجام توابع. تاتر از زیر مجموعه های مختلف از توابع برای استفاده از شاخص. - -این `set` شاخص را می توان با تمام توابع استفاده می شود. زیر مجموعه های تابع برای شاخص های دیگر در جدول زیر نشان داده شده است. - -| تابع (اپراتور) / شاخص | کلید اصلی | مینمکس | نمرمبف1 | توکنبف1 | ت\_ضعیت | -|----------------------------------------------------------------------------------------------------------------------|-----------|--------|---------|---------|---------| -| [اطلاعات دقیق)](../../../sql_reference/functions/comparison_functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [نقلقولهای جدید از این نویسنده=, \<\>)](../../../sql_reference/functions/comparison_functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [مانند](../../../sql_reference/functions/string_search_functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [notLike](../../../sql_reference/functions/string_search_functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [startsWith](../../../sql_reference/functions/string_functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [endsWith](../../../sql_reference/functions/string_functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [چندزبانه](../../../sql_reference/functions/string_search_functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | -| [داخل](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notIn](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [کمتر (\<)](../../../sql_reference/functions/comparison_functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [بیشتر (\>)](../../../sql_reference/functions/comparison_functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [در حال بارگذاری)](../../../sql_reference/functions/comparison_functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [اطلاعات دقیق)](../../../sql_reference/functions/comparison_functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [خالی](../../../sql_reference/functions/array_functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [notEmpty](../../../sql_reference/functions/array_functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| شتابدهنده | ✗ | ✗ | ✗ | ✔ | ✗ | - -توابع با استدلال ثابت است که کمتر از اندازه نیگرام می تواند توسط استفاده نمی شود `ngrambf_v1` برای بهینه سازی پرس و جو. - -فیلتر بلوم می توانید مسابقات مثبت کاذب دارند, به طوری که `ngrambf_v1`, `tokenbf_v1` و `bloom_filter` شاخص ها نمی توانند برای بهینه سازی پرس و جو هایی که انتظار می رود نتیجه عملکرد نادرست باشد استفاده شوند: - -- می توان بهینه سازی کرد: - - `s LIKE '%test%'` - - `NOT s NOT LIKE '%test%'` - - `s = 1` - - `NOT s != 1` - - `startsWith(s, 'test')` -- نمی توان بهینه سازی کرد: - - `NOT s LIKE '%test%'` - - `s NOT LIKE '%test%'` - - `NOT s = 1` - - `s != 1` - - `NOT startsWith(s, 'test')` - -## دسترسی همزمان داده ها {#concurrent-data-access} - -برای دسترسی به جدول همزمان, ما با استفاده از چند نسخه. به عبارت دیگر, زمانی که یک جدول به طور همزمان خواندن و به روز, داده ها از مجموعه ای از قطعات است که در زمان پرس و جو در حال حاضر به عنوان خوانده شده. هیچ قفل طولانی وجود دارد. درج در راه عملیات خواندن نیست. - -خواندن از یک جدول به طور خودکار موازی. - -## ستون ها و جداول {#table_engine-mergetree-ttl} - -تعیین طول عمر ارزش. - -این `TTL` بند را می توان برای کل جدول و برای هر ستون فردی تنظیم شده است. همچنین منطق حرکت خودکار داده ها بین دیسک ها و حجم ها را مشخص می کند. - -عبارات باید به ارزیابی [تاریخ](../../../sql_reference/data_types/date.md) یا [DateTime](../../../sql_reference/data_types/datetime.md) نوع داده. - -مثال: - -``` sql -TTL time_column -TTL time_column + interval -``` - -برای تعریف `interval` استفاده [فاصله زمانی](../../../sql_reference/operators.md#operators-datetime) اپراتورها. - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### ستون {#mergetree-column-ttl} - -هنگامی که مقادیر در ستون منقضی, خانه را جایگزین با مقادیر پیش فرض برای نوع داده ستون. اگر تمام مقادیر ستون در بخش داده منقضی, تاتر حذف این ستون از بخش داده ها در یک سیستم فایل. - -این `TTL` بند را نمی توان برای ستون های کلیدی استفاده کرد. - -مثالها: - -ایجاد یک جدول با تی ال - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -اضافه کردن تی ال به یک ستون از یک جدول موجود - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -تغییر تعداد ستون - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### جدول {#mergetree-table-ttl} - -جدول می تواند بیان برای حذف ردیف منقضی شده و عبارات متعدد برای حرکت خودکار قطعات بین [دیسک یا حجم](#table_engine-mergetree-multiple-volumes). هنگامی که ردیف در جدول منقضی, تاتر حذف تمام ردیف مربوطه. برای قطعات در حال حرکت از ویژگی های, تمام ردیف از یک بخش باید معیارهای بیان جنبش را تامین کند. - -``` sql -TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... -``` - -نوع قانون کنترل هوشمند ممکن است هر عبارت را دنبال کند. این تاثیر می گذارد یک عمل است که باید انجام شود یک بار بیان راضی است (زمان فعلی می رسد): - -- `DELETE` - حذف ردیف منقضی شده (اقدام پیش فرض); -- `TO DISK 'aaa'` - انتقال بخشی به دیسک `aaa`; -- `TO VOLUME 'bbb'` - انتقال بخشی به دیسک `bbb`. - -مثالها: - -ایجاد یک جدول با تی ال - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH [DELETE], - d + INTERVAL 1 WEEK TO VOLUME 'aaa', - d + INTERVAL 2 WEEK TO DISK 'bbb'; -``` - -تغییر تعداد جدول - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**حذف داده ها** - -داده ها با یک حذف شده است زمانی که محل انتخابی ادغام قطعات داده. - -هنگامی که کلیک خانه را ببینید که داده تمام شده است, انجام یک ادغام خارج از برنامه. برای کنترل فرکانس چنین ادغام, شما می توانید مجموعه [ادغام \_بههنگامسازی](#mergetree_setting-merge_with_ttl_timeout). اگر مقدار خیلی کم است, این بسیاری از ادغام خارج از برنامه است که ممکن است مقدار زیادی از منابع مصرف انجام. - -اگر شما انجام `SELECT` پرس و جو بین ادغام, شما ممکن است داده های منقضی شده. برای جلوگیری از استفاده از [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) پرسوجو قبل از `SELECT`. - -## با استفاده از دستگاه های بلوک های متعدد برای ذخیره سازی داده ها {#table_engine-mergetree-multiple-volumes} - -### معرفی شرکت {#introduction} - -`MergeTree` موتورهای جدول خانواده می تواند داده ها در دستگاه های بلوک های متعدد ذخیره کنید. مثلا, این می تواند مفید باشد زمانی که داده ها از یک جدول خاص به طور ضمنی به تقسیم “hot” و “cold”. داده های اخیر به طور منظم درخواست شده است اما نیاز به تنها مقدار کمی از فضای. برعکس, داده های تاریخی چربی دم به ندرت درخواست. اگر چندین دیسک در دسترس هستند “hot” داده ها ممکن است بر روی دیسک های سریع واقع (مثلا, اس اس اس اس بلوم و یا در حافظه), در حالی که “cold” داده ها بر روی موارد نسبتا کند (مثلا هارد). - -بخش داده ها حداقل واحد متحرک برای `MergeTree`- جدول موتور . داده های متعلق به یک بخش بر روی یک دیسک ذخیره می شود. قطعات داده را می توان بین دیسک در پس زمینه (با توجه به تنظیمات کاربر) و همچنین با استفاده از نقل مکان کرد [ALTER](../../../sql_reference/statements/alter.md#alter_move-partition) نمایش داده شد. - -### شرایط {#terms} - -- Disk — Block device mounted to the filesystem. -- Default disk — Disk that stores the path specified in the [مسیر](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) تنظیم سرور. -- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). -- Storage policy — Set of volumes and the rules for moving data between them. - -اسامی داده شده به اشخاص توصیف شده را می توان در جداول سیستم یافت می شود, [سیستم.داستان\_یابی](../../../operations/system_tables.md#system_tables-storage_policies) و [سیستم.دیسکها](../../../operations/system_tables.md#system_tables-disks). برای اعمال یکی از سیاست های ذخیره سازی پیکربندی شده برای یک جدول از `storage_policy` تنظیم از `MergeTree`- جداول خانواده موتور . - -### پیکربندی {#table_engine-mergetree-multiple-volumes-configure} - -دیسک, حجم و سیاست های ذخیره سازی باید در داخل اعلام `` برچسب یا در فایل اصلی `config.xml` یا در یک فایل مجزا در `config.d` فهرست راهنما. - -ساختار پیکربندی: - -``` xml - - - - /mnt/fast_ssd/clickhouse/ - - - /mnt/hdd1/clickhouse/ - 10485760 - - - /mnt/hdd2/clickhouse/ - 10485760 - - - ... - - - ... - -``` - -برچسبها: - -- `` — Disk name. Names must be different for all disks. -- `path` — path under which a server will store data (`data` و `shadow` پوشه ها) باید با پایان ‘/’. -- `keep_free_space_bytes` — the amount of free disk space to be reserved. - -منظور از تعریف دیسک مهم نیست. - -نشانه گذاری پیکربندی سیاست های ذخیره سازی: - -``` xml - - ... - - - - - disk_name_from_disks_configuration - 1073741824 - - - - - - - 0.2 - - - - - - - - ... - -``` - -برچسبها: - -- `policy_name_N` — Policy name. Policy names must be unique. -- `volume_name_N` — Volume name. Volume names must be unique. -- `disk` — a disk within a volume. -- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume's disks. -- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). - -Cofiguration نمونه: - -``` xml - - ... - - - - - disk1 - disk2 - - - - - - - - fast_ssd - 1073741824 - - - disk1 - - - 0.2 - - - ... - -``` - -در مثال داده شده `hdd_in_order` سیاست پیاده سازی [گرد رابین](https://en.wikipedia.org/wiki/Round-robin_scheduling) نزدیک شو بنابراین این سیاست تنها یک جلد را تعریف می کند (`single`), قطعات داده ها بر روی تمام دیسک های خود را به ترتیب دایره ای ذخیره می شود. چنین سیاستی می تواند بسیار مفید اگر چندین دیسک مشابه به سیستم نصب شده وجود دارد, اما حمله پیکربندی نشده است. به خاطر داشته باشید که هر درایو دیسک منحصر به فرد قابل اعتماد نیست و شما ممکن است بخواهید با عامل تکرار 3 یا بیشتر جبران. - -اگر انواع مختلف دیسک های موجود در سیستم وجود دارد, `moving_from_ssd_to_hdd` سیاست را می توان به جای استفاده. حجم `hot` شامل یک دیسک اس اس دی (`fast_ssd`), و حداکثر اندازه یک بخش است که می تواند در این حجم ذخیره شده است 1گیگابایت. تمام قطعات با اندازه بزرگتر از 1 گیگابایت به طور مستقیم در `cold` حجم, که شامل یک دیسک هارد `disk1`. -همچنین هنگامی که دیسک `fast_ssd` می شود توسط بیش از پر 80%, داده خواهد شد به انتقال `disk1` توسط یک فرایند پس زمینه. - -منظور شمارش حجم در یک سیاست ذخیره سازی مهم است. هنگامی که یک حجم پر شده است, داده ها به یک بعدی منتقل. ترتیب شمارش دیسک نیز مهم است زیرا داده ها در نوبت ذخیره می شوند. - -هنگام ایجاد یک جدول می توان یکی از سیاست های ذخیره سازی پیکربندی شده را اعمال کرد: - -``` sql -CREATE TABLE table_with_non_default_policy ( - EventDate Date, - OrderID UInt64, - BannerID UInt64, - SearchPhrase String -) ENGINE = MergeTree -ORDER BY (OrderID, BannerID) -PARTITION BY toYYYYMM(EventDate) -SETTINGS storage_policy = 'moving_from_ssd_to_hdd' -``` - -این `default` سیاست ذخیره سازی نشان میدهد تنها با استفاده از یک حجم, که متشکل از تنها یک دیسک داده شده در ``. هنگامی که یک جدول ایجاد شده است, سیاست ذخیره سازی خود را نمی توان تغییر داد. - -### اطلاعات دقیق {#details} - -در مورد `MergeTree` جداول داده ها به دیسک در راه های مختلف گرفتن است: - -- به عنوان یک نتیجه از درج (`INSERT` پرسوجو). -- در طول پس زمینه ادغام و [جهشها](../../../sql_reference/statements/alter.md#alter-mutations). -- هنگام دانلود از ماکت دیگر. -- به عنوان یک نتیجه از انجماد پارتیشن [ALTER TABLE … FREEZE PARTITION](../../../sql_reference/statements/alter.md#alter_freeze-partition). - -در تمام این موارد به جز جهش و پارتیشن انجماد بخش ذخیره شده در حجم و دیسک با توجه به سیاست ذخیره سازی داده شده است: - -1. جلد اول (به ترتیب تعریف) که فضای دیسک به اندازه کافی برای ذخیره سازی یک بخش (`unreserved_space > current_part_size`) و اجازه می دهد تا برای ذخیره سازی بخش هایی از اندازه داده شده (`max_data_part_size_bytes > current_part_size`) انتخاب شده است . -2. در این حجم, که دیسک انتخاب شده است که به دنبال یکی, که برای ذخیره سازی تکه های قبلی از داده مورد استفاده قرار گرفت, و دارای فضای رایگان بیش از اندازه بخش (`unreserved_space - keep_free_space_bytes > current_part_size`). - -تحت هود جهش و پارتیشن انجماد استفاده از [لینک های سخت](https://en.wikipedia.org/wiki/Hard_link). لینک های سخت بین دیسک های مختلف پشتیبانی نمی شوند بنابراین در چنین مواردی قطعات حاصل شده بر روی دیسک های مشابه به عنوان اولیه ذخیره می شوند. - -در پس زمینه, قطعات بین حجم بر اساس مقدار فضای رایگان نقل مکان کرد (`move_factor` پارامتر) با توجه به سفارش حجم در فایل پیکربندی اعلام کرد. -داده ها هرگز از گذشته و به یکی از اولین منتقل شده است. ممکن است از جداول سیستم استفاده کنید [سیستم.\_خروج](../../../operations/system_tables.md#system_tables-part-log) (زمینه `type = MOVE_PART`) و [سیستم.قطعات](../../../operations/system_tables.md#system_tables-parts) (فیلدها `path` و `disk`) برای نظارت بر حرکت پس زمینه . همچنین, اطلاعات دقیق را می توان در سیاهههای مربوط به سرور پیدا شده است. - -کاربر می تواند نیروی حرکت بخشی یا پارتیشن از یک حجم به دیگری با استفاده از پرس و جو [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql_reference/statements/alter.md#alter_move-partition), تمام محدودیت برای عملیات پس زمینه در نظر گرفته شود. پرس و جو شروع یک حرکت به خودی خود و منتظر نیست برای عملیات پس زمینه به پایان خواهد رسید. کاربر یک پیام خطا اگر فضای رایگان به اندازه کافی در دسترس است و یا اگر هر یک از شرایط مورد نیاز را ملاقات کرد. - -داده های متحرک با تکرار داده ها دخالت نمی کنند. از این رو, سیاست های ذخیره سازی مختلف را می توان برای همان جدول در کپی های مختلف مشخص. - -پس از اتمام ادغام پس زمینه و جهش, قطعات قدیمی تنها پس از یک مقدار مشخصی از زمان حذف (`old_parts_lifetime`). -در طول این زمان به حجم یا دیسک های دیگر منتقل نمی شوند. از این رو, تا زمانی که قطعات در نهایت حذف, هنوز هم به حساب برای ارزیابی فضای دیسک اشغال گرفته. - -[مقاله اصلی](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/fa/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/fa/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index a2008e32229..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: "\u062C\u0627\u06CC\u06AF\u0632\u06CC\u0646\u06CC" ---- - -# جایگزینی {#replacingmergetree} - -موتور متفاوت از [ادغام](mergetree.md#table_engines-mergetree) در که حذف نوشته های تکراری با همان مقدار اصلی کلید (یا دقیق تر, با همان [کلید مرتب سازی](mergetree.md) ارزش). - -تقسیم داده ها تنها در یک ادغام رخ می دهد. ادغام در پس زمینه در زمان ناشناخته رخ می دهد بنابراین شما نمی توانید برنامه ریزی کنید. برخی از داده ها ممکن است بدون پردازش باقی می ماند. اگر چه شما می توانید ادغام برنامه ریزی با استفاده از اجرا `OPTIMIZE` پرس و جو, در استفاده از این حساب نمی, به این دلیل که `OPTIMIZE` پرس و جو خواندن و نوشتن مقدار زیادی از داده ها. - -بدین ترتیب, `ReplacingMergeTree` مناسب برای پاک کردن داده های تکراری در پس زمینه برای صرفه جویی در فضا است اما عدم وجود تکراری را تضمین نمی کند. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -برای شرح پارامترهای درخواست را ببینید [درخواست توضیحات](../../../sql_reference/statements/create.md). - -**پارامترهای جایگزین** - -- `ver` — column with version. Type `UInt*`, `Date` یا `DateTime`. پارامتر اختیاری. - - هنگام ادغام, `ReplacingMergeTree` از تمام ردیف ها با همان کلید اصلی تنها یک برگ دارد: - - - گذشته در انتخاب, اگر `ver` تنظیم نشده است. - - با حداکثر نسخه, اگر `ver` مشخص. - -**بندهای پرسوجو** - -هنگام ایجاد یک `ReplacingMergeTree` جدول همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -همه پارامترها به استثنای `ver` همان معنی را در `MergeTree`. - -- `ver` - ستون با نسخه . پارامتر اختیاری. برای شرح, متن بالا را ببینید. - -
- -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/fa/engines/table_engines/mergetree_family/replication.md b/docs/fa/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index c03e853e29f..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 31 -toc_title: "\u062A\u06A9\u0631\u0627\u0631 \u062F\u0627\u062F\u0647 \u0647\u0627" ---- - -# تکرار داده ها {#table_engines-replication} - -تکرار تنها برای جداول در خانواده ادغام پشتیبانی می شود: - -- تکرار غذای اصلی -- تکرار می شود -- جایگزینی تکراری -- تکرار پلاکتی مگرمرگتری -- تکرار تغییرات -- تکرار مجدد محصول -- تکرار کننده - -تکرار کار می کند در سطح یک جدول فردی, نه کل سرور. سرور می تواند هر دو جدول تکرار و غیر تکرار در همان زمان ذخیره کنید. - -تکرار بستگی ندارد sharding. هر سفال تکرار مستقل خود را دارد. - -داده های فشرده برای `INSERT` و `ALTER` نمایش داده شد تکرار شده است (برای اطلاعات بیشتر, اسناد و مدارک برای دیدن [ALTER](../../../sql_reference/statements/alter.md#query_language_queries_alter)). - -`CREATE`, `DROP`, `ATTACH`, `DETACH` و `RENAME` نمایش داده شد بر روی یک سرور اجرا و تکرار نیست: - -- این `CREATE TABLE` پرس و جو ایجاد یک جدول تکرار جدید بر روی سرور که پرس و جو اجرا شده است. اگر این جدول در حال حاضر بر روی سرور های دیگر وجود دارد, اضافه می کند یک ماکت جدید. -- این `DROP TABLE` پرس و جو حذف ماکت واقع در سرور که پرس و جو اجرا شده است. -- این `RENAME` پرس و جو تغییر نام جدول در یکی از کپی. به عبارت دیگر, جداول تکرار می توانید نام های مختلف در کپی های مختلف دارند. - -استفاده از کلیک [سرویس پرداخت درونبرنامهای پلی](https://zookeeper.apache.org) برای ذخیره سازی اطلاعات متا کپی. استفاده از باغ وحش نسخه 3.4.5 یا جدیدتر. - -برای استفاده از تکرار, پارامترهای مجموعه ای در [باغ وحش](../../../operations/server_configuration_parameters/settings.md#server-settings_zookeeper) بخش پیکربندی سرور. - -!!! attention "توجه" - هنوز تنظیمات امنیتی غفلت نیست. تاتر از `digest` [طرح اکل](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) از زیر سیستم امنیتی باغ وحش. - -به عنوان مثال از تنظیم نشانی های خوشه باغ وحش: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -شما می توانید هر خوشه باغ وحش موجود را مشخص کنید و سیستم یک دایرکتوری را برای داده های خود استفاده می کند (دایرکتوری هنگام ایجاد یک جدول تکرار شده مشخص می شود). - -اگر باغ وحش در فایل پیکربندی تنظیم نشده, شما می توانید جداول تکرار ایجاد کنید, و هر جداول تکرار موجود خواهد شد فقط به عنوان خوانده شده. - -باغ وحش در استفاده نمی شود `SELECT` نمایش داده شد به دلیل تکرار می کند عملکرد تاثیر نمی گذارد `SELECT` و نمایش داده شد اجرا فقط به همان سرعتی که برای جداول غیر تکرار انجام می دهند. هنگامی که پرس و جو جداول تکرار توزیع, رفتار کلیک است که توسط تنظیمات کنترل [\_شروع مجدد \_شروع مجدد \_شروع مجدد \_کاربری](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) و [شناسه بسته:](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). - -برای هر `INSERT` پرس و جو, حدود ده ورودی از طریق معاملات چند به باغ وحش دار اضافه. (به عبارت دقیق تر, این است که برای هر بلوک قرار داده شده از داده; پرس و جو درج شامل یک بلوک و یا یک بلوک در هر `max_insert_block_size = 1048576` ردیف) این منجر به زمان شروع کمی طولانی تر برای `INSERT` در مقایسه با جداول غیر تکرار. اما اگر شما به دنبال توصیه برای وارد کردن داده ها در دسته بیش از یک `INSERT` در هر ثانیه هیچ مشکلی ایجاد نمی کند. کل خوشه محل کلیک مورد استفاده برای هماهنگی یک خوشه باغ وحش در مجموع چند صد است `INSERTs` در هر ثانیه. توان در درج داده (تعداد ردیف در ثانیه) فقط به عنوان بالا به عنوان داده های غیر تکرار شده است. - -برای خوشه های بسیار بزرگ, شما می توانید خوشه باغ وحش های مختلف برای خرده ریز های مختلف استفاده کنید. با این حال, این لازم در یاندکس ثابت نشده.متریکا خوشه (تقریبا 300 سرور). - -تکرار ناهمزمان و چند استاد است. `INSERT` نمایش داده شد (و همچنین `ALTER`) را می توان به هر سرور در دسترس ارسال می شود. داده ها بر روی سرور قرار می گیرند که پرس و جو اجرا می شود و سپس به سرورهای دیگر کپی می شود. زیرا ناهمگام است, داده به تازگی قرار داده شده در کپی دیگر با برخی از تاخیر به نظر می رسد. اگر بخشی از کپی در دسترس نیست, داده ها نوشته شده است که در دسترس تبدیل. اگر یک ماکت در دسترس است, تاخیر مقدار زمان لازم برای انتقال بلوک از داده های فشرده بر روی شبکه است. - -به طور پیش فرض, پرس و جو درج منتظر تایید نوشتن داده ها از تنها یک ماکت. اگر داده ها با موفقیت به تنها یک ماکت نوشته شده بود و سرور با این ماکت متوقف به وجود, داده های ذخیره شده از دست خواهد رفت. برای فعال کردن گرفتن تایید داده ها می نویسد: از کپی های متعدد با استفاده از `insert_quorum` انتخاب - -هر بلوک از داده ها به صورت اتمی نوشته شده است. پرس و جو درج شده است را به بلوک تا تقسیم `max_insert_block_size = 1048576` ردیف به عبارت دیگر اگر `INSERT` پرس و جو کمتر از 1048576 ردیف, این است که به صورت اتمی ساخته شده. - -بلوک های داده تقسیم می شوند. برای چند می نویسد از بلوک داده های مشابه (بلوک های داده از همان اندازه حاوی ردیف در همان جهت) بلوک تنها یک بار نوشته شده است. دلیل این کار این است که در صورت شکست شبکه زمانی که نرم افزار سرویس گیرنده نمی داند که اگر داده ها به دسی بل نوشته شده بود, بنابراین `INSERT` پرس و جو به سادگی می تواند تکرار شود. مهم نیست که درج ماکت با داده های یکسان فرستاده شد. `INSERTs` ژولیده اند. پارامترهای تقسیم بندی توسط [ادغام](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-merge_tree) تنظیمات سرور. - -در طول تکرار, تنها داده های منبع برای وارد کردن بر روی شبکه منتقل. تحول داده های بیشتر (ادغام) هماهنگ و در تمام کپی در همان راه انجام. این به حداقل می رساند استفاده از شبکه, به این معنی که تکرار خوبی کار می کند زمانی که کپی در مراکز داده های مختلف اقامت. (توجه داشته باشید که تکثیر داده ها در مراکز داده های مختلف هدف اصلی از تکرار است.) - -شما می توانید هر تعداد از کپی از داده های مشابه داشته باشد. یاندکسمتریکا از تکرار دوگانه در تولید استفاده می کند. هر سرور با استفاده از حمله-5 و یا حمله-6, و حمله-10 در برخی موارد. این یک راه حل نسبتا قابل اعتماد و راحت است. - -سیستم نظارت بر هماهنگ سازی داده ها در کپی و قادر به بازیابی پس از شکست است. عدم موفقیت خودکار است (برای تفاوت های کوچک در داده ها) و یا نیمه اتوماتیک (زمانی که داده ها متفاوت بیش از حد, که ممکن است یک خطای پیکربندی نشان می دهد). - -## ایجاد جداول تکرار شده {#creating-replicated-tables} - -این `Replicated` پیشوند به نام موتور جدول اضافه شده است. به عنوان مثال:`ReplicatedMergeTree`. - -**تکرار \* پارامترهای ادغام** - -- `zoo_path` — The path to the table in ZooKeeper. -- `replica_name` — The replica name in ZooKeeper. - -مثال: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -
- -به عنوان مثال در نحو توصیه - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -
- -به عنوان مثال نشان می دهد, این پارامترها می تواند تعویض در براکت فرفری شامل. مقادیر جایگزین از گرفته ‘macros’ بخش از فایل پیکربندی. مثال: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -مسیر به جدول در باغ وحش باید منحصر به فرد برای هر جدول تکرار شود. جداول در خرده ریز های مختلف باید مسیرهای مختلف داشته باشد. -در این مورد مسیر شامل قسمت های زیر است: - -`/clickhouse/tables/` پیشوند رایج است. ما توصیه می کنیم با استفاده از دقیقا این یکی. - -`{layer}-{shard}` شناسه سفال است. در این مثال شامل دو بخش از یاندکس.متریکا خوشه با استفاده از دو سطح شاردینگ. برای بسیاری از وظایف, شما می توانید فقط جایگزینی {سفال} ترک, خواهد شد که به شناسه سفال گسترش. - -`table_name` نام گره برای جدول در باغ وحش است. این یک ایده خوب را به همان نام جدول است. این است که به صراحت تعریف, چرا که در مقابل به نام جدول, این کار پس از یک پرس و جو تغییر نام نمی. -*HINT*: شما می توانید یک نام پایگاه داده در مقابل اضافه کنید `table_name` همینطور E. g. `db_name.table_name` - -نام ماکت شناسایی کپی های مختلف از همان جدول. شما می توانید نام سرور برای این استفاده, همانطور که در مثال. نام تنها نیاز به منحصر به فرد در هر سفال. - -شما می توانید پارامترهای صراحت به جای استفاده از تعویض تعریف کنیم. این ممکن است مناسب برای تست و برای پیکربندی خوشه های کوچک. با این حال, شما می توانید نمایش داده شد توزیع دی ال استفاده کنید (`ON CLUSTER`) در این مورد. - -هنگام کار با خوشه های بزرگ, توصیه می کنیم با استفاده از تعویض زیرا احتمال خطا را کاهش می دهد. - -اجرای `CREATE TABLE` پرس و جو در هر ماکت. این پرس و جو ایجاد یک جدول تکرار جدید, و یا می افزاید: یک ماکت جدید به یک موجود. - -اگر شما اضافه کردن یک ماکت جدید پس از جدول در حال حاضر شامل برخی از داده ها در کپی های دیگر کپی داده ها از کپی های دیگر کپی به یکی از جدید پس از اجرای پرس و جو. به عبارت دیگر, ماکت جدید خود را با دیگران همگام سازی. - -برای حذف یک ماکت, اجرا `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. - -## بازیابی پس از شکست {#recovery-after-failures} - -اگر باغ وحش در دسترس نیست که یک سرور شروع می شود, جداول تکرار تبدیل به حالت فقط خواندنی. این سیستم به صورت دوره ای تلاش برای اتصال به باغ وحش. - -اگر باغ وحش در طول یک در دسترس نیست `INSERT`, یا یک خطا رخ می دهد در هنگام تعامل با باغ وحش, یک استثنا پرتاب می شود. - -پس از اتصال به باغ وحش, سیستم چک چه مجموعه ای از داده ها در سیستم فایل محلی منطبق بر مجموعه مورد انتظار از داده ها (باغ وحش ذخیره این اطلاعات). اگر تناقضات کوچک وجود دارد, سیستم با همگام سازی داده ها با کپی حل. - -اگر سیستم تشخیص داده های شکسته قطعات (با اندازه اشتباه از فایل ها) و یا قطعات ناشناخته (قطعات نوشته شده به فایل سیستم اما ثبت نشده در باغ وحش) این حرکت را به `detached` دایرکتوری فرعی(حذف نمی شوند). هر بخش از دست رفته از کپی کپی کپی کپی. - -توجه داشته باشید که تاتر هیچ اقدامات مخرب مانند به طور خودکار حذف مقدار زیادی از داده ها را انجام نمی دهد. - -هنگامی که سرور شروع می شود (و یا ایجاد یک جلسه جدید با باغ وحش), این تنها چک مقدار و اندازه تمام فایل های. اگر اندازه فایل مطابقت اما بایت در جایی در وسط تغییر یافته است, این بلافاصله شناسایی نشده, اما تنها زمانی که تلاش برای خواندن داده ها برای یک `SELECT` پرس و جو. پرس و جو می اندازد یک استثنا در مورد کنترلی غیر تطبیق و یا اندازه یک بلوک فشرده. در این مورد, قطعات داده ها به صف تایید اضافه شده و کپی از کپی در صورت لزوم. - -اگر مجموعه ای محلی از داده های متفاوت بیش از حد از یک انتظار, یک مکانیزم ایمنی باعث شده است. سرور وارد این در ورود به سیستم و حاضر به راه اندازی. دلیل این کار این است که این مورد ممکن است یک خطای پیکربندی نشان می دهد, مانند اگر یک ماکت در سفال به طور تصادفی مانند یک ماکت در سفال های مختلف پیکربندی شده بود. با این حال, مانع برای این مکانیزم نسبتا کم, و این وضعیت ممکن است در طول بهبود شکست طبیعی رخ می دهد. در این مورد داده ها به صورت نیمه اتوماتیک بازسازی می شوند “pushing a button”. - -برای شروع بازیابی گره ایجاد کنید `/path_to_table/replica_name/flags/force_restore_data` در باغ وحش با هر یک از مطالب, و یا اجرای دستور برای بازگرداندن تمام جداول تکرار: - -``` bash -sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -سپس سرور راه اندازی مجدد. در ابتدا سرور این پرچم ها را حذف می کند و شروع به بازیابی می کند. - -## بازیابی پس از از دست دادن اطلاعات کامل {#recovery-after-complete-data-loss} - -اگر تمام داده ها و ابرداده از یکی از سرورها ناپدید شد, این مراحل را برای بازیابی دنبال: - -1. نصب کلیک بر روی سرور. تعریف تعویض به درستی در فایل پیکربندی که شامل شناسه سفال و کپی, در صورت استفاده از. -2. اگر شما تا به حال جداول سه برابر است که باید به صورت دستی بر روی سرور تکرار, کپی اطلاعات خود را از یک ماکت (در دایرکتوری `/var/lib/clickhouse/data/db_name/table_name/`). -3. تعاریف جدول کپی واقع در `/var/lib/clickhouse/metadata/` از یک ماکت. اگر یک شناسه سفال یا ماکت به صراحت در تعاریف جدول تعریف, اصلاح به طوری که به این ماکت مربوط. (متناوبا, شروع سرور و تمام `ATTACH TABLE` نمایش داده شد که باید در شده .در حال بارگذاری `/var/lib/clickhouse/metadata/`.) -4. برای شروع بازیابی, ایجاد گره باغ وحش `/path_to_table/replica_name/flags/force_restore_data` با هر محتوا, و یا اجرای دستور برای بازگرداندن تمام جداول تکرار: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -سپس سرور شروع (راه اندازی مجدد, اگر در حال حاضر در حال اجرا). داده خواهد شد از کپی دانلود. - -گزینه بازیابی جایگزین این است که حذف اطلاعات در مورد ماکت از دست رفته از باغ وحش (`/path_to_table/replica_name`), سپس ایجاد ماکت دوباره به عنوان شرح داده شده در “[ایجاد جداول تکرار شده](#creating-replicated-tables)”. - -در طول بازیابی هیچ محدودیتی در پهنای باند شبکه وجود ندارد. این را در ذهن اگر شما در حال بازگرداندن بسیاری از کپی در یک بار. - -## تبدیل از ادغام به تکرار غذای اصلی {#converting-from-mergetree-to-replicatedmergetree} - -ما از اصطلاح استفاده می کنیم `MergeTree` برای اشاره به تمام موتورهای جدول در `MergeTree family`, همان است که برای `ReplicatedMergeTree`. - -اگر شما تا به حال `MergeTree` جدول که به صورت دستی تکرار شد, شما می توانید به یک جدول تکرار تبدیل. شما ممکن است نیاز به انجام این کار اگر شما در حال حاضر مقدار زیادی از داده ها در یک `MergeTree` جدول و در حال حاضر شما می خواهید برای فعال کردن تکرار. - -اگر داده ها در کپی های مختلف متفاوت, برای اولین بار همگام سازی, و یا حذف این داده ها در تمام کپی به جز یکی. - -تغییر نام جدول ادغام موجود, سپس ایجاد یک `ReplicatedMergeTree` جدول با نام های قدیمی. -انتقال داده ها از جدول قدیمی به `detached` دایرکتوری فرعی در داخل دایرکتوری با داده های جدول جدید (`/var/lib/clickhouse/data/db_name/table_name/`). -سپس اجرا کنید `ALTER TABLE ATTACH PARTITION` در یکی از کپی برای اضافه کردن این قطعات داده به مجموعه کار. - -## تبدیل از تکراری به ادغام {#converting-from-replicatedmergetree-to-mergetree} - -ایجاد یک جدول ادغام با نام های مختلف. انتقال تمام داده ها از دایرکتوری با `ReplicatedMergeTree` داده های جدول به دایرکتوری داده جدول جدید. سپس حذف `ReplicatedMergeTree` جدول و راه اندازی مجدد سرور. - -اگر شما می خواهید برای خلاص شدن از شر `ReplicatedMergeTree` جدول بدون راه اندازی سرور: - -- حذف متناظر `.sql` پرونده در فهرست راهنمای فراداده (`/var/lib/clickhouse/metadata/`). -- حذف مسیر مربوطه در باغ وحش (`/path_to_table/replica_name`). - -بعد از این, شما می توانید سرور راه اندازی, ایجاد یک `MergeTree` جدول, انتقال داده ها به دایرکتوری خود, و سپس راه اندازی مجدد سرور. - -## بازیابی هنگامی که ابرداده در خوشه باغ وحش از دست داده و یا صدمه دیده است {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} - -اگر داده های موجود در باغ وحش از دست رفته یا صدمه دیده بود می توانید داده ها را با حرکت دادن به یک جدول بدون علامت همانطور که در بالا توضیح داده شد ذخیره کنید. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/fa/engines/table_engines/mergetree_family/summingmergetree.md b/docs/fa/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index b2d6169a44e..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: "\u0633\u0627\u0645\u06CC\u0646\u06AF\u0645\u0631\u06AF\u062A\u0631\u06CC" ---- - -# سامینگمرگتری {#summingmergetree} - -موتور به ارث می برد از [ادغام](mergetree.md#table_engines-mergetree). تفاوت در این است که هنگامی که ادغام قطعات داده برای `SummingMergeTree` جداول تاتر جایگزین تمام ردیف با کلید اصلی همان (یا با دقت بیشتر ,با همان [کلید مرتب سازی](mergetree.md)) با یک ردیف که حاوی مقادیر خلاصه شده برای ستون ها با نوع داده عددی است. اگر کلید مرتب سازی در راه است که یک مقدار کلید تنها مربوط به تعداد زیادی از ردیف تشکیل شده, این به طور قابل توجهی کاهش می دهد حجم ذخیره سازی و سرعت بخشیدن به انتخاب داده ها. - -ما توصیه می کنیم به استفاده از موتور همراه با `MergeTree`. ذخیره اطلاعات کامل در `MergeTree` جدول و استفاده `SummingMergeTree` برای ذخیره سازی داده ها جمع, مثلا, هنگام تهیه گزارش. چنین رویکردی شما را از دست دادن اطلاعات با ارزش با توجه به کلید اولیه نادرست تشکیل شده جلوگیری می کند. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = SummingMergeTree([columns]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -برای شرح پارامترهای درخواست را ببینید [درخواست توضیحات](../../../sql_reference/statements/create.md). - -**پارامترهای سامینگمرگتری** - -- `columns` - یک تاپل با نام ستون که ارزش خلاصه خواهد شد. پارامتر اختیاری. - ستون باید از یک نوع عددی باشد و نباید در کلید اصلی باشد. - - اگر `columns` مشخص نشده, تاتر خلاصه مقادیر در تمام ستون ها با یک نوع داده عددی است که در کلید اصلی نیست. - -**بندهای پرسوجو** - -هنگام ایجاد یک `SummingMergeTree` جدول همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - هنوز این روش در پروژه های جدید استفاده کنید و, در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) -``` - -همه پارامترها به استثنای `columns` همان معنی را در `MergeTree`. - -- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. - -
- -## مثال طریقه استفاده {#usage-example} - -جدول زیر را در نظر بگیرید: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -درج داده به این: - -``` sql -INSERT INTO summtt Values(1,1),(1,2),(2,1) -``` - -تاتر ممکن است تمام ردیف نه به طور کامل جمع ([پایین را ببینید](#data-processing)), بنابراین ما با استفاده از یک تابع کلی `sum` و `GROUP BY` بند در پرس و جو. - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - -``` text -┌─key─┬─sum(value)─┐ -│ 2 │ 1 │ -│ 1 │ 3 │ -└─────┴────────────┘ -``` - -## پردازش داده ها {#data-processing} - -هنگامی که داده ها را به یک جدول قرار داده, ذخیره می شوند به عنوان است. خانه رعیتی ادغام بخش قرار داده شده از داده ها به صورت دوره ای و این زمانی است که ردیف با کلید اصلی همان خلاصه و جایگزین با یکی برای هر بخش حاصل از داده ها. - -ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) یک تابع جمع [جمع()](../../../sql_reference/aggregate_functions/reference.md#agg_function-sum) و `GROUP BY` بند باید در پرس و جو به عنوان مثال در بالا توضیح داده شده استفاده می شود. - -### قوانین مشترک برای جمع {#common-rules-for-summation} - -مقادیر در ستون با نوع داده عددی خلاصه شده است. مجموعه ای از ستون ها توسط پارامتر تعریف شده است `columns`. - -اگر ارزش شد 0 در تمام ستون ها برای جمع, ردیف حذف شده است. - -اگر ستون در کلید اصلی نیست و خلاصه نشده است, یک مقدار دلخواه از موجود انتخاب. - -مقادیر برای ستون در کلید اصلی خلاصه نشده است. - -### جمعبندی ستونها {#the-summation-in-the-aggregatefunction-columns} - -برای ستون [نوع تابع](../../../sql_reference/data_types/aggregatefunction.md) عمل کلیک به عنوان [ریزدانه](aggregatingmergetree.md) جمع موتور با توجه به عملکرد. - -### ساختارهای تو در تو {#nested-structures} - -جدول می تواند ساختارهای داده تو در تو که در یک راه خاص پردازش کرده اند. - -اگر نام یک جدول تو در تو با به پایان می رسد `Map` و این شامل حداقل دو ستون است که با معیارهای زیر مطابقت دارند: - -- ستون اول عددی است `(*Int*, Date, DateTime)` یا یک رشته `(String, FixedString)` بهش زنگ بزن `key`, -- ستون های دیگر حساب `(*Int*, Float32/64)` بهش زنگ بزن `(values...)`, - -سپس این جدول تو در تو به عنوان یک نقشه برداری از تفسیر `key => (values...)`, و هنگامی که ادغام ردیف خود, عناصر دو مجموعه داده ها با هم ادغام شدند `key` با جمع بندی مربوطه `(values...)`. - -مثالها: - -``` text -[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] -[(1, 100)] + [(1, 150)] -> [(1, 250)] -[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] -[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] -``` - -هنگام درخواست داده ها از [sumMap(key, value)](../../../sql_reference/aggregate_functions/reference.md) تابع برای تجمع `Map`. - -برای ساختار داده های تو در تو, شما لازم نیست که برای مشخص ستون خود را در تاپل ستون برای جمع. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/fa/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/fa/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index 4a269e8713d..00000000000 --- a/docs/fa/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\ - \u06CC" ---- - -# در حال بارگذاری {#versionedcollapsingmergetree} - -این موتور: - -- اجازه می دهد تا نوشتن سریع از کشورهای شی که به طور مستمر در حال تغییر. -- حذف کشورهای شی قدیمی در پس زمینه. این به طور قابل توجهی حجم ذخیره سازی را کاهش می دهد. - -بخش را ببینید [سقوط](#table_engines_versionedcollapsingmergetree) برای اطلاعات بیشتر. - -موتور به ارث می برد از [ادغام](mergetree.md#table_engines-mergetree) و می افزاید: منطق برای سقوط ردیف به الگوریتم برای ادغام قطعات داده. `VersionedCollapsingMergeTree` در خدمت همان هدف به عنوان [سقوط غذای اصلی](collapsingmergetree.md) اما با استفاده از یک الگوریتم سقوط های مختلف است که اجازه می دهد تا قرار دادن داده ها در هر جهت با موضوعات متعدد. به خصوص `Version` ستون کمک می کند تا به سقوط ردیف درستی حتی در صورتی که در جهت اشتباه قرار داده شده. در مقابل, `CollapsingMergeTree` اجازه می دهد تا درج تنها به شدت متوالی. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -برای شرح پارامترهای پرس و جو, دیدن [توضیحات پرس و جو](../../../sql_reference/statements/create.md). - -**پارامترهای موتور** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Name of the column with the type of row: `1` یک “state” سطر, `-1` یک “cancel” پارو زدن. - - نوع داده ستون باید باشد `Int8`. - -- `version` — Name of the column with the version of the object state. - - نوع داده ستون باید باشد `UInt*`. - -**بندهای پرسوجو** - -هنگام ایجاد یک `VersionedCollapsingMergeTree` جدول, همان [بند](mergetree.md) در هنگام ایجاد یک مورد نیاز است `MergeTree` جدول - -
- -روش منسوخ برای ایجاد یک جدول - -!!! attention "توجه" - از این روش در پروژه های جدید استفاده نکنید. در صورت امکان, تغییر پروژه های قدیمی به روش بالا توضیح. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -همه پارامترها به جز `sign` و `version` همان معنی را در `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` یک “state” سطر, `-1` یک “cancel” پارو زدن. - - Column Data Type — `Int8`. - -- `version` — Name of the column with the version of the object state. - - نوع داده ستون باید باشد `UInt*`. - -
- -## سقوط {#table_engines-versionedcollapsingmergetree} - -### داده {#data} - -در نظر بگیرید یک وضعیت که شما نیاز به ذخیره به طور مداوم در حال تغییر داده ها برای برخی از شی. این منطقی است که یک ردیف برای یک شی و به روز رسانی ردیف هر زمان که تغییرات وجود دارد. با این حال, عملیات به روز رسانی گران و کند برای یک سندرم تونل کارپ است چرا که نیاز به بازنویسی داده ها در ذخیره سازی. به روز رسانی قابل قبول نیست اگر شما نیاز به نوشتن داده ها به سرعت, اما شما می توانید تغییرات را به یک شی پی در پی به شرح زیر ارسال. - -استفاده از `Sign` ستون هنگام نوشتن ردیف. اگر `Sign = 1` این بدان معنی است که ردیف دولت از یک شی است (اجازه دهید این تماس “state” ردیف). اگر `Sign = -1` این نشان می دهد لغو دولت از یک شی با ویژگی های مشابه (اجازه دهید این پاسخ “cancel” ردیف). همچنین از `Version` ستون, که باید هر ایالت از یک شی با یک عدد جداگانه شناسایی. - -مثلا, ما می خواهیم برای محاسبه تعداد صفحات کاربران در برخی از سایت بازدید و چه مدت وجود دارد. در برخی از نقطه در زمان ما ارسال ردیف زیر را با دولت از فعالیت های کاربر: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -در برخی موارد بعد ما تغییر فعالیت کاربر را ثبت می کنیم و با دو ردیف زیر می نویسیم. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -ردیف اول لغو حالت قبلی از جسم (کاربر). باید تمام زمینه های دولت لغو شده به جز کپی کنید `Sign`. - -ردیف دوم شامل وضعیت فعلی. - -چرا که ما نیاز به تنها دولت گذشته از فعالیت های کاربر ردیف - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -می توان حذف, سقوط نامعتبر (قدیمی) دولت از جسم. `VersionedCollapsingMergeTree` این کار در حالی که ادغام قطعات داده. - -برای پیدا کردن که چرا ما نیاز به دو ردیف برای هر تغییر را ببینید [الگوریتم](#table_engines-versionedcollapsingmergetree-algorithm). - -**نکاتی در مورد استفاده** - -1. برنامه ای که می نویسد داده ها باید به یاد داشته باشید دولت از یک شی به منظور لغو. این “cancel” رشته باید یک کپی از “state” رشته با مخالف `Sign`. این باعث افزایش اندازه اولیه ذخیره سازی اما اجازه می دهد تا به نوشتن داده ها به سرعت. -2. در حال رشد طولانی در ستون کاهش بهره وری از موتور با توجه به بار برای نوشتن. ساده تر داده, بهتر بهره وری. -3. `SELECT` نتایج به شدت بستگی به قوام تاریخ تغییر شی. هنگام تهیه داده ها برای قرار دادن دقیق باشید. شما می توانید نتایج غیر قابل پیش بینی با اطلاعات متناقض از جمله مقادیر منفی برای معیارهای غیر منفی مانند عمق جلسه. - -### الگوریتم {#table_engines-versionedcollapsingmergetree-algorithm} - -هنگامی که مالکیت خانه ادغام قطعات داده, حذف هر جفت ردیف که کلید اولیه و نسخه های مختلف و همان `Sign`. منظور از ردیف مهم نیست. - -هنگامی که داده ها را درج خانه, دستور ردیف توسط کلید اصلی. اگر `Version` ستون در کلید اصلی نیست, خانه عروسکی اضافه می کند به کلید اصلی به طور ضمنی به عنوان زمینه گذشته و برای سفارش استفاده. - -## انتخاب داده ها {#selecting-data} - -تاتر تضمین نمی کند که همه از ردیف با کلید اصلی همان خواهد شد در همان بخش داده و در نتیجه و یا حتی بر روی سرور فیزیکی است. این درست است هر دو برای نوشتن داده ها و برای ادغام بعدی از قطعات داده است. علاوه بر این فرایندهای کلیک `SELECT` نمایش داده شد با موضوعات متعدد و منظور از ردیف در نتیجه نمی تواند پیش بینی کند. این به این معنی است که تجمع مورد نیاز است اگر نیاز به طور کامل وجود دارد “collapsed” داده ها از یک `VersionedCollapsingMergeTree` جدول - -برای نهایی سقوط, ارسال یک پرس و جو با یک `GROUP BY` بند و مجموع توابع است که برای ثبت نام حساب. برای مثال برای محاسبه مقدار استفاده کنید `sum(Sign)` به جای `count()`. برای محاسبه مجموع چیزی استفاده کنید `sum(Sign * x)` به جای `sum(x)` و اضافه کردن `HAVING sum(Sign) > 0`. - -مصالح `count`, `sum` و `avg` می توان محاسبه این راه. مجموع `uniq` می توان محاسبه اگر یک شی حداقل یک دولت غیر فروریخته. مصالح `min` و `max` نمی توان محاسبه کرد زیرا `VersionedCollapsingMergeTree` تاریخ ارزش های کشورهای فرو ریخت را نجات دهد. - -اگر شما نیاز به استخراج داده ها با “collapsing” اما بدون تجمع (مثلا, برای بررسی اینکه ردیف در حال حاضر که جدیدترین ارزش مطابقت شرایط خاصی هستند), شما می توانید با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. این روش بی فایده است و باید با جداول بزرگ استفاده نمی شود. - -## مثال استفاده {#example-of-use} - -اطلاعات نمونه: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -ایجاد جدول: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -درج داده: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -ما با استفاده از دو `INSERT` نمایش داده شد برای ایجاد دو بخش داده های مختلف. اگر ما داده ها را وارد کنید با یک پرس و جو تنها, تاتر ایجاد یک بخش داده و هرگز هیچ ادغام انجام خواهد داد. - -گرفتن داده ها: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -چه ما در اینجا مشاهده کنید و قطعات فروریخته کجا هستند? -ما دو بخش داده با استفاده از دو `INSERT` نمایش داده شد. این `SELECT` پرس و جو در دو موضوع انجام شد, و در نتیجه یک نظم تصادفی از ردیف است. -سقوط رخ نداد زیرا قطعات داده هنوز ادغام نشده اند. تاتر ادغام قطعات داده در یک نقطه ناشناخته در زمان است که ما نمی توانیم پیش بینی. - -به همین دلیل است که ما نیاز به تجمع: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -اگر ما تجمع نیاز ندارد و می خواهید به زور سقوط, ما می توانیم با استفاده از `FINAL` تغییردهنده برای `FROM` بند بند. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -این یک راه بسیار کارامد برای انتخاب داده ها است. برای جداول بزرگ استفاده نکنید. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/fa/engines/table_engines/special/dictionary.md b/docs/fa/engines/table_engines/special/dictionary.md deleted file mode 100644 index 53ed5b5cf26..00000000000 --- a/docs/fa/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: "\u0648\u0627\u0698\u0647\u0646\u0627\u0645\u0647" ---- - -# واژهنامه {#dictionary} - -این `Dictionary` موتور نمایش [واژهنامه](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) داده ها به عنوان یک جدول کلیک. - -به عنوان مثال, در نظر گرفتن یک فرهنگ لغت از `products` با پیکربندی زیر: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -پرس و جو داده فرهنگ لغت: - -``` sql -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - -``` text -┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ -│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ -└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ -``` - -شما می توانید از [دیکته کردن\*](../../../sql_reference/functions/ext_dict_functions.md#ext_dict_functions) تابع برای دریافت داده های فرهنگ لغت در این فرمت. - -این دیدگاه مفید نیست که شما نیاز به دریافت داده های خام, و یا در هنگام انجام یک `JOIN` عمل برای این موارد می توانید از `Dictionary` موتور, که نمایش داده فرهنگ لغت در یک جدول. - -نحو: - -``` sql -CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` -``` - -به عنوان مثال استفاده: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); -``` - - Ok - -نگاهی به در چه چیزی در جدول. - -``` sql -select * from products limit 1; -``` - -``` text -┌────product_id─┬─title───────────┐ -│ 152689 │ Some item │ -└───────────────┴─────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/fa/engines/table_engines/special/distributed.md b/docs/fa/engines/table_engines/special/distributed.md deleted file mode 100644 index b2d9dd45a4d..00000000000 --- a/docs/fa/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: "\u062A\u0648\u0632\u06CC\u0639 \u0634\u062F\u0647" ---- - -# توزیع شده {#distributed} - -**جداول با موتور توزیع شده هیچ اطلاعاتی را توسط خود ذخیره نمی کنند**, اما اجازه می دهد پردازش پرس و جو توزیع شده بر روی سرورهای متعدد. -خواندن به طور خودکار موازی. در طول خواندن, شاخص جدول بر روی سرور از راه دور استفاده می شود, اگر وجود دارد. - -موتور توزیع پارامترها را می پذیرد: - -- نام خوشه در فایل پیکربندی سرور - -- نام یک پایگاه داده از راه دور - -- نام یک میز از راه دور - -- (اختیاری) sharding کلیدی - -- (اختیاری) نام سیاست, استفاده خواهد شد برای ذخیره فایل های موقت برای ارسال کالاهای کابل - - همچنین نگاه کنید به: - - - `insert_distributed_sync` تنظیم - - [ادغام](../mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) برای نمونه - -مثال: - -``` sql -Distributed(logs, default, hits[, sharding_key[, policy_name]]) -``` - -داده ها از تمام سرورها در ‘logs’ خوشه, از پیش فرض.جدول بازدیدها واقع در هر سرور در خوشه. -داده ها نه تنها به عنوان خوانده شده اما تا حدی بر روی سرور از راه دور پردازش (تا حدی که این امکان پذیر است). -مثلا, برای یک پرس و جو با گروه های, داده خواهد شد بر روی سرور از راه دور جمع, و کشورهای متوسط از توابع دانه خواهد شد به سرور درخواست ارسال. سپس داده ها بیشتر جمع خواهد شد. - -به جای نام پایگاه داده, شما می توانید یک عبارت ثابت است که یک رشته را برمی گرداند استفاده. در حال بارگذاری - -logs – The cluster name in the server's config file. - -خوشه ها مانند این تنظیم می شوند: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 1 - 9440 - - - - -``` - -در اینجا یک خوشه با نام تعریف شده است ‘logs’ که متشکل از دو خرده ریز, که هر کدام شامل دو کپی. -خرده ریز به سرور که شامل بخش های مختلف از داده ها مراجعه (به منظور خواندن تمام داده ها, شما باید تمام خرده ریز دسترسی داشته باشید). -کپی در حال تکثیر سرور (به منظور خواندن تمام داده ها, شما می توانید داده ها بر روی هر یک از کپی دسترسی). - -نام خوشه باید حاوی نقطه نیست. - -پارامترها `host`, `port` و در صورت تمایل `user`, `password`, `secure`, `compression` برای هر سرور مشخص شده است: -- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn't start. If you change the DNS record, restart the server. -- `port` – The TCP port for messenger activity (‘tcp\_port’ در پیکربندی, معمولا به مجموعه 9000). نه اشتباه آن را با http\_port. -- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [حقوق دسترسی](../../../operations/access_rights.md). -- `password` – The password for connecting to a remote server (not masked). Default value: empty string. -- `secure` - استفاده از اس اس ال برای اتصال, معمولا شما همچنین باید تعریف `port` = 9440. سرور باید گوش کند 9440 و گواهی صحیح. -- `compression` - استفاده از فشرده سازی داده ها. مقدار پیش فرض: درست. - -When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [\_تبالسازی](../../../operations/settings/settings.md#settings-load_balancing) تنظیمات. -اگر ارتباط با سرور ایجاد نشده است, وجود خواهد داشت تلاش برای ارتباط با یک ایست کوتاه. اگر اتصال شکست خورده, ماکت بعدی انتخاب خواهد شد, و به همین ترتیب برای همه کپی. اگر تلاش اتصال برای تمام کپی شکست خورده, تلاش تکرار خواهد شد به همان شیوه, چندین بار. -این کار به نفع حالت ارتجاعی, اما تحمل گسل کامل را فراهم نمی کند: یک سرور از راه دور ممکن است اتصال قبول, اما ممکن است کار نمی کند, و یا کار ضعیف. - -شما می توانید تنها یکی از خرده ریز مشخص (در این مورد, پردازش پرس و جو باید از راه دور به نام, به جای توزیع) و یا تا هر تعداد از خرده ریز. در هر سفال می توانید از یک به هر تعداد از کپی ها مشخص کنید. شما می توانید تعداد مختلف از کپی برای هر سفال مشخص. - -شما می توانید به عنوان بسیاری از خوشه های مشخص که شما در پیکربندی می خواهید. - -برای مشاهده خوشه های خود استفاده کنید ‘system.clusters’ جدول - -موتور توزیع اجازه می دهد تا کار با یک خوشه مانند یک سرور محلی. با این حال, خوشه غیر قابل اجتنابناپذیری است: شما باید پیکربندی خود را در فایل پیکربندی سرور ارسال (حتی بهتر, برای تمام سرورهای خوشه). - -The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don't need to create a Distributed table – use the ‘remote’ تابع جدول به جای. بخش را ببینید [توابع جدول](../../../sql_reference/table_functions/index.md). - -دو روش برای نوشتن داده ها به یک خوشه وجود دارد: - -اولین, شما می توانید تعریف که سرور به ارسال که داده ها را به و انجام نوشتن به طور مستقیم در هر سفال. به عبارت دیگر, انجام درج در جداول که جدول توزیع “looks at”. این راه حل انعطاف پذیر ترین است که شما می توانید هر طرح شاردینگ استفاده, که می تواند غیر بدیهی با توجه به الزامات منطقه موضوع. این هم بهینه ترین راه حل از داده ها را می توان به خرده ریز های مختلف نوشته شده است به طور کامل به طور مستقل. - -دومین, شما می توانید درج در یک جدول توزیع انجام. در این مورد جدول توزیع داده های درج شده در سراسر سرور خود را. به منظور ارسال به یک جدول توزیع, باید یک مجموعه کلید شارژ دارند (پارامتر گذشته). علاوه بر این, اگر تنها یک سفال وجود دارد, عملیات نوشتن بدون مشخص کردن کلید شاردینگ کار می کند, چرا که هیچ چیز در این مورد معنی نیست. - -هر سفال می تواند وزن تعریف شده در فایل پیکربندی داشته باشد. به طور پیش فرض, وزن به یک برابر است. داده ها در سراسر خرده ریز در مقدار متناسب با وزن سفال توزیع. مثلا, اگر دو خرده ریز وجود دارد و برای اولین بار دارای وزن 9 در حالی که دوم دارای وزن 10, برای اولین بار ارسال خواهد شد 9 / 19 بخش هایی از ردیف, و دوم ارسال خواهد شد 10 / 19. - -هر سفال می تواند داشته باشد ‘internal\_replication’ پارامتر تعریف شده در فایل پیکربندی. - -اگر این پارامتر قرار است به ‘true’ عملیات نوشتن اولین ماکت سالم را انتخاب می کند و داده ها را می نویسد. با استفاده از این جایگزین اگر جدول توزیع شده “looks at” جداول تکرار. به عبارت دیگر اگر جدول ای که داده ها نوشته می شود خود را تکرار می کند. - -اگر قرار است ‘false’ (به طور پیش فرض), داده ها به تمام کپی نوشته شده. در اصل این بدان معنی است که توزیع جدول تکرار داده های خود را. این بدتر از استفاده از جداول تکرار شده است زیرا سازگاری کپی ها بررسی نشده است و در طول زمان حاوی اطلاعات کمی متفاوت خواهد بود. - -برای انتخاب سفال که یک ردیف از داده های فرستاده شده به sharding بیان تجزيه و تحليل است و آن باقی مانده است از تقسیم آن با وزن کلی خرده ریز. ردیف به سفال که مربوط به نیمه فاصله از باقی مانده از ارسال ‘prev\_weight’ به ‘prev\_weights + weight’ کجا ‘prev\_weights’ وزن کل خرده ریز با کمترین تعداد است, و ‘weight’ وزن این سفال است. مثلا, اگر دو خرده ریز وجود دارد, و برای اولین بار دارای یک وزن 9 در حالی که دوم دارای وزن 10, ردیف خواهد شد به سفال اول برای باقی مانده از محدوده ارسال \[0, 9), و دوم برای باقی مانده از محدوده \[9, 19). - -بیان شاردینگ می تواند هر عبارت از ثابت ها و ستون های جدول که یک عدد صحیح را برمی گرداند. برای مثال شما می توانید با استفاده از بیان ‘rand()’ برای توزیع تصادفی داده ها یا ‘UserID’ برای توزیع توسط باقی مانده از تقسیم شناسه کاربر (سپس داده ها از یک کاربر تنها بر روی یک سفال تنها اقامت, که ساده در حال اجرا در و پیوستن به کاربران). اگر یکی از ستون ها به طور مساوی توزیع نشده باشد می توانید در یک تابع هش قرار دهید: اینتاش64 (شناسه). - -یک یادآوری ساده از این بخش محدود است راه حل برای sharding و نیست همیشه مناسب است. این برای حجم متوسط و زیادی از داده ها کار می کند (ده ها تن از سرور), اما نه برای حجم بسیار زیادی از داده ها (صدها سرور یا بیشتر). در مورد دوم با استفاده از sharding طرح های مورد نیاز منطقه موضوع را به جای استفاده از مطالب موجود در توزیع جداول. - -SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don't have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. - -شما باید نگران sharding طرح در موارد زیر: - -- نمایش داده شد استفاده می شود که نیاز به پیوستن به داده ها (در یا پیوستن) توسط یک کلید خاص. اگر داده ها توسط این کلید پنهان, شما می توانید محلی در استفاده و یا پیوستن به جای جهانی در یا جهانی ملحق, که بسیار موثر تر است. -- تعداد زیادی از سرور استفاده شده است (صدها یا بیشتر) با تعداد زیادی از نمایش داده شد کوچک (نمایش داده شد فردی مشتریان - وب سایت, تبلیغ, و یا شرکای). به منظور نمایش داده شد کوچک به کل خوشه تاثیر نمی گذارد, این باعث می شود حس برای قرار دادن داده ها برای یک مشتری در یک سفال تنها. متناوبا, همانطور که ما در یاندکس انجام داده ام.متریکا, شما می توانید راه اندازی دو سطح شاردینگ: تقسیم کل خوشه را به “layers”, جایی که یک لایه ممکن است از تکه های متعدد تشکیل شده است. داده ها برای یک مشتری تنها بر روی یک لایه قرار دارد اما ذرات را می توان به یک لایه در صورت لزوم اضافه کرد و داده ها به طور تصادفی در داخل توزیع می شوند. جداول توزیع شده برای هر لایه ایجاد می شوند و یک جدول توزیع شده مشترک برای نمایش داده شد جهانی ایجاد می شود. - -داده ها ناهمگام نوشته شده است. هنگامی که در جدول قرار داده شده, بلوک داده ها فقط به سیستم فایل های محلی نوشته شده. داده ها به سرور از راه دور در پس زمینه در اسرع وقت ارسال می شود. دوره ارسال داده ها توسط مدیریت [در حال بارگذاری](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) و [در حال بارگذاری](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) تنظیمات. این `Distributed` موتور هر فایل می فرستد با داده های درج شده به طور جداگانه, اما شما می توانید دسته ای از ارسال فایل های با فعال [نمایش سایت](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) تنظیمات. این تنظیم را بهبود می بخشد عملکرد خوشه با استفاده بهتر از سرور محلی و منابع شبکه. شما باید بررسی کنید که داده ها با موفقیت با چک کردن لیست فایل ها (داده ها در حال انتظار برای ارسال) در دایرکتوری جدول ارسال می شود: `/var/lib/clickhouse/data/database/table/`. - -اگر سرور متوقف به وجود داشته باشد و یا راه اندازی مجدد خشن بود (مثلا, پس از یک شکست دستگاه) پس از قرار دادن به یک جدول توزیع, داده های درج شده ممکن است از دست داده. اگر بخشی از داده های خراب شده در دایرکتوری جدول شناسایی شود به ‘broken’ دایرکتوری فرعی و دیگر استفاده می شود. - -پردازش پرس و جو در سراسر تمام کپی در یک سفال واحد موازی است زمانی که گزینه حداکثر\_پرورالهراپیلاس فعال است. برای کسب اطلاعات بیشتر به بخش مراجعه کنید [بیشینه\_راپرال\_راپیکال](../../../operations/settings/settings.md#settings-max_parallel_replicas). - -## ستونهای مجازی {#virtual-columns} - -- `_shard_num` — Contains the `shard_num` (از `system.clusters`). نوع: [UInt32](../../../sql_reference/data_types/int_uint.md). - -!!! note "یادداشت" - از [`remote`](../../../sql_reference/table_functions/remote.md)/`cluster` توابع جدول داخلی ایجاد نمونه موقت از همان توزیع موتور, `_shard_num` در دسترس وجود دارد بیش از حد. - -**همچنین نگاه کنید** - -- [ستونهای مجازی](index.md#table_engines-virtual_columns) - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/fa/engines/table_engines/special/file.md b/docs/fa/engines/table_engines/special/file.md deleted file mode 100644 index 1f04f6dc692..00000000000 --- a/docs/fa/engines/table_engines/special/file.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u067E\u0631\u0648\u0646\u062F\u0647" ---- - -# پرونده {#table_engines-file} - -موتور جدول فایل داده ها را در یک فایل در یکی از پشتیبانی نگه می دارد [پرونده -فرشها](../../../interfaces/formats.md#formats) (تابسپار, بومی, و غیره.). - -نمونه های استفاده: - -- صادرات داده ها از خانه کلیک به فایل. -- تبدیل داده ها از یک فرمت به دیگری. -- به روز رسانی داده ها در تاتر از طریق ویرایش یک فایل بر روی یک دیسک. - -## استفاده در سرور کلیک {#usage-in-clickhouse-server} - -``` sql -File(Format) -``` - -این `Format` پارامتر یکی از فرمت های فایل های موجود را مشخص می کند. برای انجام -`SELECT` نمایش داده شد, فرمت باید برای ورودی پشتیبانی می شود, و به انجام -`INSERT` queries – for output. The available formats are listed in the -[فرشها](../../../interfaces/formats.md#formats) بخش. - -کلیک اجازه نمی دهد مسیر سیستم فایل را مشخص کنید`File`. این پوشه تعریف شده توسط استفاده کنید [مسیر](../../../operations/server_configuration_parameters/settings.md) تنظیم در پیکربندی سرور. - -هنگام ایجاد جدول با استفاده از `File(Format)` این دایرکتوری فرعی خالی در این پوشه ایجاد می کند. هنگامی که داده ها به جدول نوشته شده است, این را به قرار `data.Format` فایل در دایرکتوری فرعی. - -شما می توانید این زیر پوشه و فایل را در فایل سیستم سرور و سپس ایجاد کنید [ATTACH](../../../sql_reference/statements/misc.md) این جدول اطلاعات با نام تطبیق, بنابراین شما می توانید داده ها را از این فایل پرس و جو. - -!!! warning "اخطار" - مراقب باشید با این قابلیت, به دلیل تاتر می کند پیگیری تغییرات خارجی به چنین فایل را حفظ کند. نتیجه همزمان می نویسد: از طریق clickhouse و خارج از clickhouse تعریف نشده است. - -**مثال:** - -**1.** تنظیم `file_engine_table` جدول: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -به طور پیش فرض کلیک خواهد پوشه ایجاد کنید `/var/lib/clickhouse/data/default/file_engine_table`. - -**2.** دستی ایجاد کنید `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` حاوی: - -``` bash -$ cat data.TabSeparated -one 1 -two 2 -``` - -**3.** پرسوجوی داده: - -``` sql -SELECT * FROM file_engine_table -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## استفاده در کلیک-محلی {#usage-in-clickhouse-local} - -داخل [کلیک-محلی](../../../operations/utilities/clickhouse-local.md) موتور فایل مسیر فایل علاوه بر می پذیرد `Format`. جریان های ورودی / خروجی پیش فرض را می توان با استفاده از نام های عددی یا قابل خواندن توسط انسان مشخص کرد `0` یا `stdin`, `1` یا `stdout`. -**مثال:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## اطلاعات پیاده سازی {#details-of-implementation} - -- چندگانه `SELECT` نمایش داده شد را می توان به صورت همزمان انجام, ولی `INSERT` نمایش داده شد هر یک از دیگر صبر کنید. -- پشتیبانی از ایجاد فایل جدید توسط `INSERT` پرس و جو. -- اگر پرونده وجود داشته باشد, `INSERT` ارزش های جدید را در این برنامه اضافه کنید. -- پشتیبانی نمیشود: - - `ALTER` - - `SELECT ... SAMPLE` - - شاخص ها - - تکرار - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/fa/engines/table_engines/special/generate.md b/docs/fa/engines/table_engines/special/generate.md deleted file mode 100644 index affef675ae6..00000000000 --- a/docs/fa/engines/table_engines/special/generate.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 46 -toc_title: "\u0698\u0646\u0631\u0627\u0644" ---- - -# ژنرال {#table_engines-generate} - -موتور جدول عمومی تولید داده های تصادفی برای طرح جدول داده شده است. - -نمونه های استفاده: - -- استفاده در تست به جمعیت جدول بزرگ تجدید پذیر. -- تولید ورودی تصادفی برای تست ریش ریش شدن. - -## استفاده در سرور کلیک {#usage-in-clickhouse-server} - -``` sql -ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) -``` - -این `max_array_length` و `max_string_length` پارامترها حداکثر طول همه را مشخص می کنند -ستون ها و رشته های متناوب در داده های تولید شده مطابقت دارند. - -تولید موتور جدول پشتیبانی از تنها `SELECT` نمایش داده شد. - -این پشتیبانی از تمام [انواع داده](../../../sql_reference/data_types/index.md) این را می توان در یک جدول ذخیره کرد به جز `LowCardinality` و `AggregateFunction`. - -**مثال:** - -**1.** تنظیم `generate_engine_table` جدول: - -``` sql -CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) -``` - -**2.** پرسوجوی داده: - -``` sql -SELECT * FROM generate_engine_table LIMIT 3 -``` - -``` text -┌─name─┬──────value─┐ -│ c4xJ │ 1412771199 │ -│ r │ 1791099446 │ -│ 7#$ │ 124312908 │ -└──────┴────────────┘ -``` - -## اطلاعات پیاده سازی {#details-of-implementation} - -- پشتیبانی نمیشود: - - `ALTER` - - `SELECT ... SAMPLE` - - `INSERT` - - شاخص ها - - تکرار - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/fa/engines/table_engines/special/join.md b/docs/fa/engines/table_engines/special/join.md deleted file mode 100644 index 92463b26b7b..00000000000 --- a/docs/fa/engines/table_engines/special/join.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u067E\u06CC\u0648\u0633\u062A\u0646" ---- - -# پیوستن {#join} - -ساختار داده تهیه شده برای استفاده در [JOIN](../../../sql_reference/statements/select.md#select-join) عملیات. - -## ایجاد یک جدول {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], -) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) -``` - -شرح مفصلی از [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) پرس و جو. - -**پارامترهای موتور** - -- `join_strictness` – [پیوستن به سختی](../../../sql_reference/statements/select.md#select-join-strictness). -- `join_type` – [پیوستن به نوع](../../../sql_reference/statements/select.md#select-join-types). -- `k1[, k2, ...]` – Key columns from the `USING` بند که `JOIN` عملیات با ساخته شده. - -وارد کردن `join_strictness` و `join_type` پارامترهای بدون نقل قول, مثلا, `Join(ANY, LEFT, col1)`. اونا باید با `JOIN` عملیاتی که جدول خواهد شد برای استفاده. اگر پارامترها مطابقت ندارند, خانه عروسکی می کند یک استثنا پرتاب نمی کند و ممکن است داده های نادرست بازگشت. - -## استفاده از جدول {#table-usage} - -### مثال {#example} - -ایجاد جدول سمت چپ: - -``` sql -CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog -``` - -``` sql -INSERT INTO id_val VALUES (1,11)(2,12)(3,13) -``` - -ایجاد سمت راست `Join` جدول: - -``` sql -CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) -``` - -``` sql -INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) -``` - -پیوستن به جداول: - -``` sql -SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 -``` - -``` text -┌─id─┬─val─┬─id_val_join.val─┐ -│ 1 │ 11 │ 21 │ -│ 2 │ 12 │ ᴺᵁᴸᴸ │ -│ 3 │ 13 │ 23 │ -└────┴─────┴─────────────────┘ -``` - -به عنوان یک جایگزین, شما می توانید داده ها را از بازیابی `Join` جدول مشخص کردن مقدار پیوستن کلید: - -``` sql -SELECT joinGet('id_val_join', 'val', toUInt32(1)) -``` - -``` text -┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ -│ 21 │ -└────────────────────────────────────────────┘ -``` - -### انتخاب و قرار دادن داده ها {#selecting-and-inserting-data} - -شما می توانید استفاده کنید `INSERT` نمایش داده شد برای اضافه کردن داده ها به `Join`- جدول موتور . اگر جدول با ایجاد شد `ANY` سخت, داده ها برای کلید های تکراری نادیده گرفته می شوند. با `ALL` سخت, تمام ردیف اضافه می شوند. - -شما نمی توانید انجام دهید `SELECT` پرس و جو به طور مستقیم از جدول. بجای, استفاده از یکی از روش های زیر: - -- میز را به سمت راست قرار دهید `JOIN` بند بند. -- تماس با [جوینت](../../../sql_reference/functions/other_functions.md#joinget) تابع, که به شما امکان استخراج داده ها از جدول به همان شیوه به عنوان از یک فرهنگ لغت. - -### محدودیت ها و تنظیمات {#join-limitations-and-settings} - -هنگام ایجاد یک جدول تنظیمات زیر اعمال می شود: - -- [ارزشهای خبری عبارتند از:](../../../operations/settings/settings.md#join_use_nulls) -- [\_پاک کردن \_روشن گرافیک](../../../operations/settings/query_complexity.md#settings-max_rows_in_join) -- [\_پویش همیشگی](../../../operations/settings/query_complexity.md#settings-max_bytes_in_join) -- [\_شروع مجدد](../../../operations/settings/query_complexity.md#settings-join_overflow_mode) -- [نمایش سایت](../../../operations/settings/settings.md#settings-join_any_take_last_row) - -این `Join`- جداول موتور نمی تواند مورد استفاده قرار گیرد `GLOBAL JOIN` عملیات. - -این `Join`- موتور اجازه می دهد تا استفاده کنید [ارزشهای خبری عبارتند از:](../../../operations/settings/settings.md#join_use_nulls) تنظیم در `CREATE TABLE` بیانیه. و [SELECT](../../../sql_reference/statements/select.md) پرسوجو به کار میرود `join_use_nulls` منم همینطور اگر شما متفاوت است `join_use_nulls` تنظیمات, شما می توانید یک خطا پیوستن به جدول از. این بستگی به نوع پیوستن دارد. هنگام استفاده [جوینت](../../../sql_reference/functions/other_functions.md#joinget) تابع, شما مجبور به استفاده از همان `join_use_nulls` تنظیم در `CRATE TABLE` و `SELECT` اظهارات. - -## ذخیره سازی داده ها {#data-storage} - -`Join` داده های جدول است که همیشه در رم واقع. در هنگام قرار دادن ردیف به یک جدول, کلیکهاوس می نویسد بلوک های داده را به دایرکتوری بر روی دیسک به طوری که می توان ترمیم زمانی که سرور راه اندازی مجدد. - -اگر سرور نادرست راه اندازی مجدد بلوک داده ها بر روی دیسک از دست رفته یا صدمه دیده ممکن است. در این مورد ممکن است لازم باشد فایل را به صورت دستی با داده های خراب شده حذف کنید. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/fa/engines/table_engines/special/materializedview.md b/docs/fa/engines/table_engines/special/materializedview.md deleted file mode 100644 index 7fa8c2d217d..00000000000 --- a/docs/fa/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 43 -toc_title: "\u0645\u0627\u062F\u0647 \u0628\u06CC\u0646\u06CC" ---- - -# ماده بینی {#materializedview} - -مورد استفاده برای اجرای نمایش محقق (برای اطلاعات بیشتر, دیدن [CREATE TABLE](../../../sql_reference/statements/create.md)). برای ذخیره سازی داده ها از یک موتور مختلف استفاده می کند که هنگام ایجاد دیدگاه مشخص شده است. هنگام خواندن از یک جدول, فقط با استفاده از این موتور. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/fa/engines/table_engines/special/merge.md b/docs/fa/engines/table_engines/special/merge.md deleted file mode 100644 index f75a20057e6..00000000000 --- a/docs/fa/engines/table_engines/special/merge.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: "\u0627\u062F\u063A\u0627\u0645" ---- - -# ادغام {#merge} - -این `Merge` موتور (با اشتباه گرفته شود `MergeTree`) اطلاعات خود را ذخیره نمی, اما اجازه می دهد تا خواندن از هر تعداد از جداول دیگر به طور همزمان. -خواندن به طور خودکار موازی. نوشتن به یک جدول پشتیبانی نمی شود. هنگام خواندن, شاخص جداول که در واقع در حال خواندن استفاده می شود, در صورتی که وجود داشته باشد. -این `Merge` موتور می پذیرد پارامترهای: نام پایگاه داده و یک عبارت منظم برای جداول. - -مثال: - -``` sql -Merge(hits, '^WatchLog') -``` - -داده خواهد شد از جداول در خواندن `hits` پایگاه داده است که نام هایی که مطابقت با عبارت منظم ‘`^WatchLog`’. - -به جای نام پایگاه داده, شما می توانید یک عبارت ثابت است که یک رشته را برمی گرداند استفاده. به عنوان مثال, `currentDatabase()`. - -Regular expressions — [شماره 2](https://github.com/google/re2) (پشتیبانی از یک زیر مجموعه از مدار چاپی), حساس به حروف. -یادداشت ها در مورد فرار نمادها در عبارات منظم در “match” بخش. - -هنگام انتخاب جداول برای خواندن `Merge` جدول خود را انتخاب نخواهد شد, حتی اگر منطبق عبارت منظم. این است که برای جلوگیری از حلقه. -ممکن است که به ایجاد دو `Merge` جداول که بی وقفه سعی خواهد کرد به خواندن داده های هر یک از دیگران, اما این یک ایده خوب نیست. - -راه معمولی برای استفاده از `Merge` موتور برای کار با تعداد زیادی از `TinyLog` جداول به عنوان اگر با یک جدول واحد. - -مثال 2: - -بیایید می گویند شما باید یک جدول (watchlog\_old) و تصمیم به تغییر پارتیشن بندی بدون حرکت داده ها به یک جدول جدید (watchlog\_new) و شما نیاز به مراجعه به داده ها از هر دو جدول. - -``` sql -CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree(date, (UserId, EventType), 8192); -INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - -CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; -INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - -CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - -SELECT * -FROM WatchLog -``` - -``` text -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-01 │ 1 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-02 │ 2 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -``` - -## ستونهای مجازی {#virtual-columns} - -- `_table` — Contains the name of the table from which data was read. Type: [رشته](../../../sql_reference/data_types/string.md). - - شما می توانید شرایط ثابت را تنظیم کنید `_table` در `WHERE/PREWHERE` بند (به عنوان مثال, `WHERE _table='xyz'`). در این مورد عملیات خواندن فقط برای جداول انجام می شود که شرط است `_table` راضی است, به طوری که `_table` ستون به عنوان یک شاخص عمل می کند. - -**همچنین نگاه کنید به** - -- [مجازی ستون](index.md#table_engines-virtual_columns) - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/fa/faq/general.md b/docs/fa/faq/general.md index a63b0291aea..42b4ecce36a 100644 --- a/docs/fa/faq/general.md +++ b/docs/fa/faq/general.md @@ -47,7 +47,7 @@ SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV ### با استفاده از جدول فایل موتور {#using-a-file-engine-table} -ببینید [پرونده](../engines/table_engines/special/file.md). +ببینید [پرونده](../engines/table-engines/special/file.md). ### با استفاده از تغییر مسیر خط فرمان {#using-command-line-redirection} diff --git a/docs/fa/getting_started/example_datasets/amplab_benchmark.md b/docs/fa/getting-started/example-datasets/amplab-benchmark.md similarity index 100% rename from docs/fa/getting_started/example_datasets/amplab_benchmark.md rename to docs/fa/getting-started/example-datasets/amplab-benchmark.md diff --git a/docs/fa/getting_started/example_datasets/criteo.md b/docs/fa/getting-started/example-datasets/criteo.md similarity index 100% rename from docs/fa/getting_started/example_datasets/criteo.md rename to docs/fa/getting-started/example-datasets/criteo.md diff --git a/docs/fa/getting-started/example-datasets/index.md b/docs/fa/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..7643a5a45aa --- /dev/null +++ b/docs/fa/getting-started/example-datasets/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Example Datasets +toc_priority: 12 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# به عنوان مثال مجموعه داده {#example-datasets} + +در این بخش چگونگی اخذ مجموعه داده ها به عنوان مثال و وارد کردن را به کلیک کنید. +برای برخی از نمونه های داده نمایش داده شد نمایش داده شد نیز در دسترس هستند. + +- [ناشناس یاندکس.مجموعه داده های متریکا](metrica.md) +- [معیار طرحواره ستاره](star-schema.md) +- [ویکیستات](wikistat.md) +- [ترابایت کلیک سیاهههای مربوط از مخلوق](criteo.md) +- [معیار بزرگ داده های تقویت کننده](amplab-benchmark.md) +- [داده های تاکسی نیویورک](nyc-taxi.md) +- [به موقع](ontime.md) + +[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/fa/getting-started/example-datasets/metrica.md b/docs/fa/getting-started/example-datasets/metrica.md new file mode 100644 index 00000000000..db39b784ec1 --- /dev/null +++ b/docs/fa/getting-started/example-datasets/metrica.md @@ -0,0 +1,71 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 21 +toc_title: "\u06CC\u0627\u0646\u062F\u06A9\u0633\u0627\u0637\u0644\u0627\u0639\u0627\ + \u062A \u0645\u062A\u0631\u06CC\u06A9\u0627" +--- + +# ناشناس یاندکس.اطلاعات متریکا {#anonymized-yandex-metrica-data} + +مجموعه داده شامل دو جدول حاوی داده های ناشناس در مورد بازدید (`hits_v1`) و بازدیدکننده داشته است (`visits_v1`) یاندکس . متریکا شما می توانید اطلاعات بیشتر در مورد یاندکس به عنوان خوانده شده.متریکا در [تاریخچه کلیک](../../introduction/history.md) بخش. + +مجموعه داده ها شامل دو جدول است که هر کدام می توانند به عنوان یک فشرده دانلود شوند `tsv.xz` فایل و یا به عنوان پارتیشن تهیه شده است. علاوه بر این, یک نسخه طولانی از `hits` جدول حاوی 100 میلیون ردیف به عنوان تسو در دسترس است https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz و به عنوان پارتیشن تهیه شده در https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. + +## اخذ جداول از پارتیشن های تهیه شده {#obtaining-tables-from-prepared-partitions} + +دانلود و وارد کردن جدول بازدید: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar +tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +دانلود و وارد کردن بازدیدکننده داشته است: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar +tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## اخذ جداول از فایل تسو فشرده {#obtaining-tables-from-compressed-tsv-file} + +دانلود و وارد کردن بازدید از فایل تسو فشرده: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +دانلود و واردات بازدیدکننده داشته است از فشرده فایل: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## به عنوان مثال نمایش داده شد {#example-queries} + +[اموزش کلیک](../../getting-started/tutorial.md) است در یاندکس بر اساس.مجموعه داده های متریکا و راه توصیه شده برای شروع این مجموعه داده ها فقط از طریق تدریس خصوصی است. + +نمونه های اضافی از نمایش داده شد به این جداول را می توان در میان یافت [تست های نفرت انگیز](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) از کلیک هاوس (به نام `test.hists` و `test.visits` وجود دارد). diff --git a/docs/fa/getting_started/example_datasets/nyc_taxi.md b/docs/fa/getting-started/example-datasets/nyc-taxi.md similarity index 100% rename from docs/fa/getting_started/example_datasets/nyc_taxi.md rename to docs/fa/getting-started/example-datasets/nyc-taxi.md diff --git a/docs/fa/getting_started/example_datasets/ontime.md b/docs/fa/getting-started/example-datasets/ontime.md similarity index 100% rename from docs/fa/getting_started/example_datasets/ontime.md rename to docs/fa/getting-started/example-datasets/ontime.md diff --git a/docs/fa/getting_started/example_datasets/star_schema.md b/docs/fa/getting-started/example-datasets/star-schema.md similarity index 100% rename from docs/fa/getting_started/example_datasets/star_schema.md rename to docs/fa/getting-started/example-datasets/star-schema.md diff --git a/docs/fa/getting_started/example_datasets/wikistat.md b/docs/fa/getting-started/example-datasets/wikistat.md similarity index 100% rename from docs/fa/getting_started/example_datasets/wikistat.md rename to docs/fa/getting-started/example-datasets/wikistat.md diff --git a/docs/fa/getting-started/index.md b/docs/fa/getting-started/index.md new file mode 100644 index 00000000000..484da47dce0 --- /dev/null +++ b/docs/fa/getting-started/index.md @@ -0,0 +1,17 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Getting Started +toc_hidden: true +toc_priority: 8 +toc_title: "\u0645\u062E\u0641\u06CC" +--- + +# شروع کار {#getting-started} + +اگر شما تازه به تاتر هستند و می خواهید برای دریافت یک دست در احساس عملکرد خود را, اول از همه, شما نیاز به از طریق رفتن [مراحل نصب](install.md). بعد از که شما می توانید: + +- [برو از طریق مفصل](tutorial.md) +- [تجربه با مجموعه داده های نمونه](example-datasets/ontime.md) + +[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/fa/getting-started/install.md b/docs/fa/getting-started/install.md new file mode 100644 index 00000000000..6ae15234ca9 --- /dev/null +++ b/docs/fa/getting-started/install.md @@ -0,0 +1,185 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 11 +toc_title: "\u0646\u0635\u0628 \u0648 \u0631\u0627\u0647 \u0627\u0646\u062F\u0627\u0632\ + \u06CC" +--- + +# نصب و راه اندازی {#installation} + +## سیستم مورد نیاز {#system-requirements} + +ClickHouse می تواند اجرا بر روی هر Linux, FreeBSD یا سیستم عامل Mac OS X با x86\_64, AArch64 یا PowerPC64LE معماری CPU. + +رسمی از پیش ساخته شده باینری به طور معمول وارد شده برای ایکس86\_64 و اهرم بورس تحصیلی 4.2 مجموعه دستورالعمل, بنابراین مگر اینکه در غیر این صورت اعلام کرد استفاده از پردازنده است که پشتیبانی می شود یک سیستم اضافی مورد نیاز. در اینجا دستور برای بررسی اگر پردازنده فعلی دارای پشتیبانی برای اس اس 4.2: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +برای اجرای clickhouse در پردازنده هایی که پشتیبانی نمی sse 4.2 یا aarch64 یا powerpc64le معماری شما باید [ساخت کلیک از منابع](#from-sources) با تنظیمات پیکربندی مناسب. + +## گزینه های نصب موجود {#available-installation-options} + +### از بسته های دب {#install-from-deb-packages} + +توصیه می شود به استفاده از رسمی از پیش وارد شده `deb` بسته برای دبیان یا اوبونتو. + +سپس این دستورات را برای نصب بسته ها اجرا کنید: + +``` bash +{% include 'install/deb.sh' %}{% include 'install/deb.sh' %} +``` + +اگر شما می خواهید به استفاده از نسخه های اخیر, جایگزین کردن `stable` با `testing` (این است که برای محیط های تست خود را توصیه می شود). + +شما همچنین می توانید بسته ها را به صورت دستی از اینجا دانلود و نصب کنید: https://repo.clickhouse.tech/deb/stable/main/. + +#### بستهها {#packages} + +- `clickhouse-common-static` — Installs ClickHouse compiled binary files. +- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` و نصب پیکربندی سرور به طور پیش فرض. +- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` و دیگر ابزار مربوط به مشتری. و نصب فایل های پیکربندی مشتری. +- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. + +### از بسته های دور در دقیقه {#from-rpm-packages} + +توصیه می شود به استفاده از رسمی از پیش وارد شده `rpm` بسته برای لینوکس لینوکس, کلاه قرمز, و همه توزیع های لینوکس مبتنی بر دور در دقیقه دیگر. + +اولین, شما نیاز به اضافه کردن مخزن رسمی: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 +``` + +اگر شما می خواهید به استفاده از نسخه های اخیر, جایگزین کردن `stable` با `testing` (این است که برای محیط های تست خود را توصیه می شود). این `prestable` برچسب است که گاهی اوقات در دسترس بیش از حد. + +سپس این دستورات را برای نصب بسته ها اجرا کنید: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +شما همچنین می توانید بسته ها را به صورت دستی از اینجا دانلود و نصب کنید: https://repo.فاحشه خانه.تکنولوژی/دور در دقیقه/پایدار / ایکس86\_64. + +### از بایگانی {#from-tgz-archives} + +توصیه می شود به استفاده از رسمی از پیش وارد شده `tgz` بایگانی برای همه توزیع های لینوکس, که نصب و راه اندازی `deb` یا `rpm` بسته امکان پذیر نیست. + +نسخه مورد نیاز را می توان با دانلود `curl` یا `wget` از مخزن https://repo.yandex.ru/clickhouse/tgz/. +پس از که دانلود بایگانی باید غیر بستهای و نصب شده با اسکریپت نصب و راه اندازی. به عنوان مثال برای جدیدترین نسخه: + +``` bash +export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz + +tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz +sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz +sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-server-$LATEST_VERSION.tgz +sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh +sudo /etc/init.d/clickhouse-server start + +tar -xzvf clickhouse-client-$LATEST_VERSION.tgz +sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh +``` + +برای محیط های تولید توصیه می شود از جدیدترین استفاده کنید `stable`- نسخه شما می توانید شماره خود را در صفحه گیتهاب پیدا https://github.com/ClickHouse/ClickHouse/tags با پسوند `-stable`. + +### از تصویر کارگر بارانداز {#from-docker-image} + +برای اجرای کلیک در داخل کارگر بارانداز راهنمای دنبال کنید [داکر توپی](https://hub.docker.com/r/yandex/clickhouse-server/). این تصاویر استفاده رسمی `deb` بسته در داخل. + +### از منابع {#from-sources} + +به صورت دستی کامپایل فاحشه خانه, دستورالعمل برای دنبال [لینوکس](../development/build.md) یا [سیستم عامل مک ایکس](../development/build-osx.md). + +شما می توانید بسته های کامپایل و نصب و یا استفاده از برنامه های بدون نصب بسته. همچنین با ساخت دستی شما می توانید ثانیه 4.2 مورد نیاز غیر فعال کردن و یا ساخت برای ایالت64 پردازنده. + + Client: programs/clickhouse-client + Server: programs/clickhouse-server + +شما نیاز به ایجاد یک داده ها و پوشه ابرداده و `chown` برای کاربر مورد نظر. مسیر خود را می توان در پیکربندی سرور تغییر (سری سی/برنامه/سرور/پیکربندی.به طور پیش فرض: + + /opt/clickhouse/data/default/ + /opt/clickhouse/metadata/default/ + +در جنتو, شما فقط می توانید استفاده کنید `emerge clickhouse` برای نصب کلیک از منابع. + +## راهاندازی {#launch} + +برای شروع سرور به عنوان یک شبح, اجرا: + +``` bash +$ sudo service clickhouse-server start +``` + +اگر شما لازم نیست `service` فرمان, اجرا به عنوان + +``` bash +$ sudo /etc/init.d/clickhouse-server start +``` + +سیاهههای مربوط در `/var/log/clickhouse-server/` فهرست راهنما. + +اگر سرور شروع نمی کند, بررسی تنظیمات در فایل `/etc/clickhouse-server/config.xml`. + +شما همچنین می توانید سرور را از کنسول به صورت دستی راه اندازی کنید: + +``` bash +$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +در این مورد, ورود به سیستم خواهد شد به کنسول چاپ, که مناسب است در طول توسعه. +اگر فایل پیکربندی در دایرکتوری فعلی است, شما لازم نیست برای مشخص کردن `--config-file` پارامتر. به طور پیش فرض استفاده می کند `./config.xml`. + +تاتر پشتیبانی از تنظیمات محدودیت دسترسی. این در واقع `users.xml` پرونده) در کنار ( `config.xml`). +به طور پیش فرض, دسترسی از هر نقطه برای اجازه `default` کاربر, بدون رمز عبور. ببینید `user/default/networks`. +برای کسب اطلاعات بیشتر به بخش مراجعه کنید [“Configuration Files”](../operations/configuration-files.md). + +پس از راه اندازی سرور, شما می توانید مشتری خط فرمان برای اتصال به استفاده: + +``` bash +$ clickhouse-client +``` + +به طور پیش فرض به `localhost:9000` از طرف کاربر `default` بدون رمز عبور. همچنین می تواند مورد استفاده قرار گیرد برای اتصال به یک سرور از راه دور با استفاده از `--host` استدلال کردن. + +ترمینال باید از کدگذاری جی تی اف 8 استفاده کند. +برای کسب اطلاعات بیشتر به بخش مراجعه کنید [“Command-line client”](../interfaces/cli.md). + +مثال: + +``` bash +$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**تبریک, سیستم کار می کند!** + +برای ادامه تجربه, شما می توانید یکی از مجموعه داده های تست دانلود و یا رفتن را از طریق [اموزش](https://clickhouse.tech/tutorial.html). + +[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/fa/getting_started/playground.md b/docs/fa/getting-started/playground.md similarity index 100% rename from docs/fa/getting_started/playground.md rename to docs/fa/getting-started/playground.md diff --git a/docs/fa/getting-started/tutorial.md b/docs/fa/getting-started/tutorial.md new file mode 100644 index 00000000000..087e270c07b --- /dev/null +++ b/docs/fa/getting-started/tutorial.md @@ -0,0 +1,665 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 12 +toc_title: "\u0627\u0645\u0648\u0632\u0634" +--- + +# اموزش کلیک {#clickhouse-tutorial} + +## چه انتظار از این مقاله? {#what-to-expect-from-this-tutorial} + +با رفتن را از طریق این مقاله, شما یاد بگیرند که چگونه به راه اندازی یک خوشه ساده تاتر. این کوچک خواهد بود, اما مقاوم در برابر خطا و مقیاس پذیر. سپس ما از یکی از مجموعه داده های نمونه برای پر کردن داده ها و اجرای برخی از نمایش های نسخه ی نمایشی استفاده خواهیم کرد. + +## راه اندازی تک گره {#single-node-setup} + +برای به تعویق انداختن پیچیدگی های یک محیط توزیع, ما با استقرار کلیک بر روی یک سرور و یا ماشین مجازی شروع. خانه کلیک است که معمولا از نصب [دب](install.md#install-from-deb-packages) یا [دور در دقیقه](install.md#from-rpm-packages) بسته, اما وجود دارد [جایگزین ها](install.md#from-docker-image) برای سیستم عامل هایی که هیچ پشتیبانی نمی کنند. + +مثلا, شما را انتخاب کرده اند `deb` بسته ها و اعدام: + +``` bash +{% include 'install/deb.sh' %} +``` + +در بسته هایی که نصب شده اند چه چیزی داریم: + +- `clickhouse-client` بسته شامل [کلیک مشتری](../interfaces/cli.md) کاربرد, تعاملی مشتری کنسول تاتر. +- `clickhouse-common` بسته شامل یک فایل اجرایی کلیک. +- `clickhouse-server` بسته شامل فایل های پیکربندی برای اجرای تاتر به عنوان یک سرور. + +فایل های پیکربندی سرور در واقع `/etc/clickhouse-server/`. قبل از رفتن بیشتر, لطفا توجه کنید `` عنصر در `config.xml`. مسیر تعیین محل ذخیره سازی داده ها, بنابراین باید در حجم با ظرفیت دیسک بزرگ واقع; مقدار پیش فرض است `/var/lib/clickhouse/`. اگر شما می خواهید برای تنظیم پیکربندی, این دستی به طور مستقیم ویرایش کنید `config.xml` فایل, با توجه به اینکه ممکن است در به روز رسانی بسته های بعدی بازنویسی. راه توصیه می شود به نادیده گرفتن عناصر پیکربندی است که برای ایجاد [فایل ها در پیکربندی.فهرست راهنما](../operations/configuration-files.md) که به عنوان خدمت می کنند “patches” برای پیکربندی.. + +همانطور که شما ممکن است متوجه, `clickhouse-server` به طور خودکار پس از نصب بسته راه اندازی نشده است. این به طور خودکار پس از به روز رسانی دوباره راه اندازی نخواهد شد. راه شما شروع به سرور بستگی به سیستم اینیت خود را, معمولا, این: + +``` bash +sudo service clickhouse-server start +``` + +یا + +``` bash +sudo /etc/init.d/clickhouse-server start +``` + +محل پیش فرض برای سیاهههای مربوط به سرور است `/var/log/clickhouse-server/`. سرور برای رسیدگی به اتصالات مشتری پس از ورود به سیستم `Ready for connections` پیام + +هنگامی که `clickhouse-server` است و در حال اجرا, ما می توانیم با استفاده از `clickhouse-client` برای اتصال به سرور و اجرای برخی از نمایش داده شد تست مانند `SELECT "Hello, world!";`. + +
+ +راهنمایی سریع برای کلیک-مشتری +حالت تعاملی: + +``` bash +clickhouse-client +clickhouse-client --host=... --port=... --user=... --password=... +``` + +فعالسازی پرسشهای چند خطی: + +``` bash +clickhouse-client -m +clickhouse-client --multiline +``` + +نمایش داده شد اجرا در دسته حالت: + +``` bash +clickhouse-client --query='SELECT 1' +echo 'SELECT 1' | clickhouse-client +clickhouse-client <<< 'SELECT 1' +``` + +درج داده از یک پرونده در قالب مشخص شده: + +``` bash +clickhouse-client --query='INSERT INTO table VALUES' < data.txt +clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv +``` + +
+ +## واردات مجموعه داده نمونه {#import-sample-dataset} + +در حال حاضر زمان برای پر کردن سرور کلیک ما با برخی از داده های نمونه است. در این مقاله ما از داده های ناشناس یاندکس استفاده خواهیم کرد.متریکا, اولین سرویس اجرا می شود که کلیک در راه تولید قبل از منبع باز شد (بیشتر در که در [بخش تاریخچه](../introduction/history.md)). وجود دارد [راه های متعدد برای وارد کردن یاندکس.مجموعه داده های متریکا](example-datasets/metrica.md), و به خاطر تدریس خصوصی, ما با یکی از واقع بینانه ترین رفتن. + +### دانلود و استخراج داده های جدول {#download-and-extract-table-data} + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +``` + +فایل های استخراج شده حدود 10 گیگابایت است. + +### ایجاد جداول {#create-tables} + +همانطور که در بسیاری از سیستم های مدیریت پایگاه داده, تاتر منطقی جداول گروه به “databases”. تاپیک `default` پایگاه داده, اما ما یکی از جدید به نام ایجاد `tutorial`: + +``` bash +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" +``` + +نحو برای ایجاد جداول راه پیچیده تر در مقایسه با پایگاه داده است (نگاه کنید به [مرجع](../sql-reference/statements/create.md). به طور کلی `CREATE TABLE` بیانیه باید سه چیز کلیدی را مشخص کند: + +1. نام جدول برای ایجاد. +2. Table schema, i.e. list of columns and their [انواع داده ها](../sql-reference/data-types/index.md). +3. [موتور جدول](../engines/table-engines/index.md) و این تنظیمات است, که تعیین تمام اطلاعات در مورد نحوه نمایش داده شد به این جدول خواهد شد از لحاظ جسمی اجرا. + +یاندکسمتریکا یک سرویس تجزیه و تحلیل وب است و مجموعه داده نمونه قابلیت های کامل خود را پوشش نمی دهد بنابراین تنها دو جدول برای ایجاد وجود دارد: + +- `hits` یک جدول با هر عمل انجام شده توسط همه کاربران در تمام وب سایت های تحت پوشش این سرویس است. +- `visits` یک جدول است که شامل جلسات از پیش ساخته شده به جای اقدامات فردی است. + +بیایید ببینید و اجرای واقعی ایجاد نمایش داده شد جدول برای این جداول: + +``` sql +CREATE TABLE tutorial.hits_v1 +( + `WatchID` UInt64, + `JavaEnable` UInt8, + `Title` String, + `GoodEvent` Int16, + `EventTime` DateTime, + `EventDate` Date, + `CounterID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RegionID` UInt32, + `UserID` UInt64, + `CounterClass` Int8, + `OS` UInt8, + `UserAgent` UInt8, + `URL` String, + `Referer` String, + `URLDomain` String, + `RefererDomain` String, + `Refresh` UInt8, + `IsRobot` UInt8, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `FlashMinor2` String, + `NetMajor` UInt8, + `NetMinor` UInt8, + `UserAgentMajor` UInt16, + `UserAgentMinor` FixedString(2), + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `MobilePhone` UInt8, + `MobilePhoneModel` String, + `Params` String, + `IPNetworkID` UInt32, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `IsArtifical` UInt8, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `ClientTimeZone` Int16, + `ClientEventTime` DateTime, + `SilverlightVersion1` UInt8, + `SilverlightVersion2` UInt8, + `SilverlightVersion3` UInt32, + `SilverlightVersion4` UInt16, + `PageCharset` String, + `CodeVersion` UInt32, + `IsLink` UInt8, + `IsDownload` UInt8, + `IsNotBounce` UInt8, + `FUniqID` UInt64, + `HID` UInt32, + `IsOldCounter` UInt8, + `IsEvent` UInt8, + `IsParameter` UInt8, + `DontCountHits` UInt8, + `WithHash` UInt8, + `HitColor` FixedString(1), + `UTCEventTime` DateTime, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `WindowName` Int32, + `OpenerName` Int32, + `HistoryLength` Int16, + `BrowserLanguage` FixedString(2), + `BrowserCountry` FixedString(2), + `SocialNetwork` String, + `SocialAction` String, + `HTTPError` UInt16, + `SendTiming` Int32, + `DNSTiming` Int32, + `ConnectTiming` Int32, + `ResponseStartTiming` Int32, + `ResponseEndTiming` Int32, + `FetchTiming` Int32, + `RedirectTiming` Int32, + `DOMInteractiveTiming` Int32, + `DOMContentLoadedTiming` Int32, + `DOMCompleteTiming` Int32, + `LoadEventStartTiming` Int32, + `LoadEventEndTiming` Int32, + `NSToDOMContentLoadedTiming` Int32, + `FirstPaintTiming` Int32, + `RedirectCount` Int8, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `ParamPrice` Int64, + `ParamOrderID` String, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `GoalsReached` Array(UInt32), + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `RefererHash` UInt64, + `URLHash` UInt64, + `CLID` UInt32, + `YCLID` UInt64, + `ShareService` String, + `ShareURL` String, + `ShareTitle` String, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `IslandID` FixedString(16), + `RequestNum` UInt32, + `RequestTry` UInt8 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +``` sql +CREATE TABLE tutorial.visits_v1 +( + `CounterID` UInt32, + `StartDate` Date, + `Sign` Int8, + `IsNew` UInt8, + `VisitID` UInt64, + `UserID` UInt64, + `StartTime` DateTime, + `Duration` UInt32, + `UTCStartTime` DateTime, + `PageViews` Int32, + `Hits` Int32, + `IsBounce` UInt8, + `Referer` String, + `StartURL` String, + `RefererDomain` String, + `StartURLDomain` String, + `EndURL` String, + `LinkURL` String, + `IsDownload` UInt8, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `PlaceID` Int32, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `IsYandex` UInt8, + `GoalReachesDepth` Int32, + `GoalReachesURL` Int32, + `GoalReachesAny` Int32, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `MobilePhoneModel` String, + `ClientEventTime` DateTime, + `RegionID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `IPNetworkID` UInt32, + `SilverlightVersion3` UInt32, + `CodeVersion` UInt32, + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `UserAgentMajor` UInt16, + `UserAgentMinor` UInt16, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `SilverlightVersion2` UInt8, + `SilverlightVersion4` UInt16, + `FlashVersion3` UInt16, + `FlashVersion4` UInt16, + `ClientTimeZone` Int16, + `OS` UInt8, + `UserAgent` UInt8, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `NetMajor` UInt8, + `NetMinor` UInt8, + `MobilePhone` UInt8, + `SilverlightVersion1` UInt8, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `JavaEnable` UInt8, + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `BrowserLanguage` UInt16, + `BrowserCountry` UInt16, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `Params` Array(String), + `Goals` Nested( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32), + `WatchIDs` Array(UInt64), + `ParamSumPrice` Int64, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `ClickLogID` UInt64, + `ClickEventID` Int32, + `ClickGoodEvent` Int32, + `ClickEventTime` DateTime, + `ClickPriorityID` Int32, + `ClickPhraseID` Int32, + `ClickPageID` Int32, + `ClickPlaceID` Int32, + `ClickTypeID` Int32, + `ClickResourceID` Int32, + `ClickCost` UInt32, + `ClickClientIP` UInt32, + `ClickDomainID` UInt32, + `ClickURL` String, + `ClickAttempt` UInt8, + `ClickOrderID` UInt32, + `ClickBannerID` UInt32, + `ClickMarketCategoryID` UInt32, + `ClickMarketPP` UInt32, + `ClickMarketCategoryName` String, + `ClickMarketPPName` String, + `ClickAWAPSCampaignName` String, + `ClickPageName` String, + `ClickTargetType` UInt16, + `ClickTargetPhraseID` UInt64, + `ClickContextType` UInt8, + `ClickSelectType` Int8, + `ClickOptions` String, + `ClickGroupBannerID` Int32, + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `FirstVisit` DateTime, + `PredLastVisit` Date, + `LastVisit` Date, + `TotalVisits` UInt32, + `TraficSource` Nested( + ID Int8, + SearchEngineID UInt16, + AdvEngineID UInt8, + PlaceID UInt16, + SocialSourceNetworkID UInt8, + Domain String, + SearchPhrase String, + SocialSourcePage String), + `Attendance` FixedString(16), + `CLID` UInt32, + `YCLID` UInt64, + `NormalizedRefererHash` UInt64, + `SearchPhraseHash` UInt64, + `RefererDomainHash` UInt64, + `NormalizedStartURLHash` UInt64, + `StartURLDomainHash` UInt64, + `NormalizedEndURLHash` UInt64, + `TopLevelDomain` UInt64, + `URLScheme` UInt64, + `OpenstatServiceNameHash` UInt64, + `OpenstatCampaignIDHash` UInt64, + `OpenstatAdIDHash` UInt64, + `OpenstatSourceIDHash` UInt64, + `UTMSourceHash` UInt64, + `UTMMediumHash` UInt64, + `UTMCampaignHash` UInt64, + `UTMContentHash` UInt64, + `UTMTermHash` UInt64, + `FromHash` UInt64, + `WebVisorEnabled` UInt8, + `WebVisorActivity` UInt32, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `Market` Nested( + Type UInt8, + GoalID UInt32, + OrderID String, + OrderPrice Int64, + PP UInt32, + DirectPlaceID UInt32, + DirectOrderID UInt32, + DirectBannerID UInt32, + GoodID String, + GoodName String, + GoodQuantity Int32, + GoodPrice Int64), + `IslandID` FixedString(16) +) +ENGINE = CollapsingMergeTree(Sign) +PARTITION BY toYYYYMM(StartDate) +ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +شما می توانید این پرسش ها را با استفاده از حالت تعاملی اجرا کنید `clickhouse-client` (فقط در یک ترمینال راه اندازی بدون مشخص کردن یک پرس و جو در پیش) و یا سعی کنید برخی از [رابط جایگزین](../interfaces/index.md) اگر شما می خواهید. + +همانطور که می بینیم, `hits_v1` با استفاده از [موتور ادغام عمومی](../engines/table-engines/mergetree-family/mergetree.md) در حالی که `visits_v1` با استفاده از [سقوط](../engines/table-engines/mergetree-family/collapsingmergetree.md) نوع. + +### وارد کردن داده {#import-data} + +وارد کردن داده ها به تاتر از طریق انجام می شود [INSERT INTO](../sql-reference/statements/insert-into.md) پرس و جو مانند در بسیاری از پایگاه داده های دیگر گذاشتن. با این حال, داده ها معمولا در یکی از [پشتیبانی از فرمت های ترتیب](../interfaces/formats.md) به جای `VALUES` بند (که همچنین پشتیبانی). + +فایل هایی که قبلا دانلود کردیم در قالب تب جدا شده اند بنابراین در اینجا نحوه وارد کردن از طریق مشتری کنسول است: + +``` bash +clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv +clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv +``` + +تاتر است که بسیاری از [تنظیمات برای تنظیم](../operations/settings/index.md) و یک راه برای مشخص کردن انها در کنسول مشتری از طریق استدلال است همانطور که ما می توانید ببینید با `--max_insert_block_size`. ساده ترین راه برای کشف کردن چه تنظیمات در دسترس هستند, چه معنی می دهند و چه پیش فرض است به پرس و جو `system.settings` جدول: + +``` sql +SELECT name, value, changed, description +FROM system.settings +WHERE name LIKE '%max_insert_b%' +FORMAT TSV + +max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." +``` + +در صورت تمایل شما می توانید [OPTIMIZE](../query_language/misc/#misc_operations-optimize) جداول پس از واردات. جداول است که با یک موتور از ادغام خانواده پیکربندی همیشه ادغام قطعات داده ها در پس زمینه برای بهینه سازی ذخیره سازی داده ها (یا حداقل چک کنید اگر حس می کند). این نمایش داده شد نیروی موتور جدول به انجام بهینه سازی ذخیره سازی در حال حاضر به جای برخی از زمان بعد: + +``` bash +clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" +clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" +``` + +این نمایش داده شد شروع یک عملیات فشرده من/ای و پردازنده, بنابراین اگر جدول به طور مداوم داده های جدید دریافت, بهتر است به تنهایی ترک و اجازه دهید ادغام در پس زمینه اجرا. + +در حال حاضر ما می توانید بررسی کنید اگر واردات جدول موفق بود: + +``` bash +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" +``` + +## به عنوان مثال نمایش داده شد {#example-queries} + +``` sql +SELECT + StartURL AS URL, + AVG(Duration) AS AvgDuration +FROM tutorial.visits_v1 +WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' +GROUP BY URL +ORDER BY AvgDuration DESC +LIMIT 10 +``` + +``` sql +SELECT + sum(Sign) AS visits, + sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, + (100. * goal_visits) / visits AS goal_percent +FROM tutorial.visits_v1 +WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') +``` + +## استقرار خوشه {#cluster-deployment} + +خوشه کلیک یک خوشه همگن است. مراحل برای راه اندازی: + +1. نصب سرور کلیک بر روی تمام ماشین های خوشه +2. تنظیم پیکربندی خوشه در فایل های پیکربندی +3. ایجاد جداول محلی در هر نمونه +4. ایجاد یک [جدول توزیع شده](../engines/table-engines/special/distributed.md) + +[جدول توزیع شده](../engines/table-engines/special/distributed.md) در واقع یک نوع از “view” به جداول محلی خوشه فاحشه خانه. پرس و جو را انتخاب کنید از یک جدول توزیع اجرا با استفاده از منابع خرده ریز تمام خوشه. شما ممکن است تنظیمات برای خوشه های متعدد مشخص و ایجاد جداول توزیع های متعدد فراهم کردن دیدگاه ها به خوشه های مختلف. + +به عنوان مثال پیکربندی برای یک خوشه با سه خرده ریز, یک ماکت هر: + +``` xml + + + + + example-perftest01j.yandex.ru + 9000 + + + + + example-perftest02j.yandex.ru + 9000 + + + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +برای تظاهرات بیشتر, اجازه دهید یک جدول محلی جدید با همان ایجاد `CREATE TABLE` پرس و جو که ما برای استفاده `hits_v1`, اما نام جدول های مختلف: + +``` sql +CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... +``` + +ایجاد یک جدول توزیع شده برای نمایش در جداول محلی خوشه: + +``` sql +CREATE TABLE tutorial.hits_all AS tutorial.hits_local +ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); +``` + +یک روش معمول این است که جداول توزیع شده مشابه را در تمام ماشین های خوشه ایجاد کنید. این اجازه می دهد در حال اجرا نمایش داده شد توزیع در هر دستگاه از خوشه. همچنین یک گزینه جایگزین برای ایجاد جدول توزیع موقت برای پرس و جو انتخاب داده شده با استفاده از وجود دارد [دور](../sql-reference/table-functions/remote.md) تابع جدول. + +بیا فرار کنیم [INSERT SELECT](../sql-reference/statements/insert-into.md) به جدول توزیع شده برای گسترش جدول به چندین سرور. + +``` sql +INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; +``` + +!!! warning "اطلاع" + این روش مناسب برای شارژ جداول بزرگ نیست. یک ابزار جداگانه وجود دارد [تاتر-کپی](../operations/utilities/clickhouse-copier.md) که می تواند جداول دلخواه بزرگ دوباره سفال. + +همانطور که شما می توانید انتظار, نمایش داده شد محاسباتی سنگین اجرا نفر بار سریع تر در صورتی که استفاده 3 سرور به جای یک. + +در این مورد, ما یک خوشه با استفاده کرده اند 3 خرده ریز, و هر شامل یک ماکت تک. + +برای انعطاف پذیری در یک محیط تولید, توصیه می کنیم که هر سفال باید شامل 2-3 کپی بین مناطق در دسترس بودن متعدد و یا مراکز داده گسترش (یا حداقل قفسه). توجه داشته باشید که کلیک خانه پشتیبانی از تعداد نامحدودی از کپی. + +به عنوان مثال پیکربندی برای یک خوشه از یک سفال حاوی سه کپی: + +``` xml + + ... + + + + example-perftest01j.yandex.ru + 9000 + + + example-perftest02j.yandex.ru + 9000 + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +برای فعال کردن تکثیر بومی [باغ وحش](http://zookeeper.apache.org/) الزامی است. تاتر طول می کشد مراقبت از سازگاری داده ها در تمام کپی و اجرا می شود بازگرداندن روش پس از شکست به طور خودکار. توصیه می شود برای استقرار خوشه باغ وحش بر روی سرورهای جداگانه (جایی که هیچ پروسه های دیگر از جمله کلیک در حال اجرا هستند). + +!!! note "یادداشت" + باغ وحش یک نیاز سخت نیست: در برخی موارد ساده می توانید داده ها را با نوشتن به تمام کپی ها از کد درخواست خود کپی کنید. این رویکرد است **نه** توصیه می شود, در این مورد, تاتر قادر نخواهد بود برای تضمین ثبات داده ها در تمام کپی. بنابراین وظیفه درخواست شما می شود. + +مکان های باغ وحش در فایل پیکربندی مشخص شده است: + +``` xml + + + zoo01.yandex.ru + 2181 + + + zoo02.yandex.ru + 2181 + + + zoo03.yandex.ru + 2181 + + +``` + +همچنین, ما نیاز به تنظیم ماکروها برای شناسایی هر سفال و ماکت که در ایجاد جدول استفاده می شود: + +``` xml + + 01 + 01 + +``` + +اگر هیچ کپی در حال حاضر در ایجاد جدول تکرار وجود دارد, اولین ماکت جدید نمونه است. اگر در حال حاضر زندگی می کنند کپی جدید کلون داده ها از موجود. شما ابتدا یک گزینه برای ایجاد تمام جداول تکرار شده دارید و سپس داده ها را وارد کنید. یکی دیگر از گزینه این است که برای ایجاد برخی از کپی و اضافه کردن دیگران بعد یا در هنگام درج داده ها. + +``` sql +CREATE TABLE tutorial.hits_replica (...) +ENGINE = ReplcatedMergeTree( + '/clickhouse_perftest/tables/{shard}/hits', + '{replica}' +) +... +``` + +در اینجا ما با استفاده از [تکرار غذای اصلی](../engines/table-engines/mergetree-family/replication.md) موتور جدول. در پارامترهای مشخص می کنیم مسیر باغ وحش حاوی سفال و کپی شناسه. + +``` sql +INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; +``` + +تکرار عمل در حالت چند استاد. داده ها را می توان به هر ماکت بارگذاری کرد و سپس سیستم را با موارد دیگر به طور خودکار همگام سازی می کند. تکرار ناهمزمان است بنابراین در یک لحظه معین, همه کپی ممکن است حاوی داده به تازگی قرار داده شده. حداقل یک ماکت باید اجازه می دهد تا مصرف داده ها. دیگران همگام سازی داده ها و قوام تعمیر هنگامی که دوباره فعال تبدیل خواهد شد. توجه داشته باشید که این روش اجازه می دهد تا برای امکان کم از دست دادن داده ها به تازگی قرار داده شده. + +[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/fa/getting_started/example_datasets/index.md b/docs/fa/getting_started/example_datasets/index.md deleted file mode 100644 index 19612cb26b7..00000000000 --- a/docs/fa/getting_started/example_datasets/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Example Datasets -toc_priority: 12 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# به عنوان مثال مجموعه داده {#example-datasets} - -در این بخش چگونگی اخذ مجموعه داده ها به عنوان مثال و وارد کردن را به کلیک کنید. -برای برخی از نمونه های داده نمایش داده شد نمایش داده شد نیز در دسترس هستند. - -- [ناشناس یاندکس.مجموعه داده های متریکا](metrica.md) -- [معیار طرحواره ستاره](star_schema.md) -- [ویکیستات](wikistat.md) -- [ترابایت کلیک سیاهههای مربوط از مخلوق](criteo.md) -- [معیار بزرگ داده های تقویت کننده](amplab_benchmark.md) -- [داده های تاکسی نیویورک](nyc_taxi.md) -- [به موقع](ontime.md) - -[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/fa/getting_started/example_datasets/metrica.md b/docs/fa/getting_started/example_datasets/metrica.md deleted file mode 100644 index 5427a63259e..00000000000 --- a/docs/fa/getting_started/example_datasets/metrica.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 21 -toc_title: "\u06CC\u0627\u0646\u062F\u06A9\u0633\u0627\u0637\u0644\u0627\u0639\u0627\ - \u062A \u0645\u062A\u0631\u06CC\u06A9\u0627" ---- - -# ناشناس یاندکس.اطلاعات متریکا {#anonymized-yandex-metrica-data} - -مجموعه داده شامل دو جدول حاوی داده های ناشناس در مورد بازدید (`hits_v1`) و بازدیدکننده داشته است (`visits_v1`) یاندکس . متریکا شما می توانید اطلاعات بیشتر در مورد یاندکس به عنوان خوانده شده.متریکا در [تاریخچه کلیک](../../introduction/history.md) بخش. - -مجموعه داده ها شامل دو جدول است که هر کدام می توانند به عنوان یک فشرده دانلود شوند `tsv.xz` فایل و یا به عنوان پارتیشن تهیه شده است. علاوه بر این, یک نسخه طولانی از `hits` جدول حاوی 100 میلیون ردیف به عنوان تسو در دسترس است https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz و به عنوان پارتیشن تهیه شده در https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. - -## اخذ جداول از پارتیشن های تهیه شده {#obtaining-tables-from-prepared-partitions} - -دانلود و وارد کردن جدول بازدید: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar -tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -دانلود و وارد کردن بازدیدکننده داشته است: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar -tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## اخذ جداول از فایل تسو فشرده {#obtaining-tables-from-compressed-tsv-file} - -دانلود و وارد کردن بازدید از فایل تسو فشرده: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -دانلود و واردات بازدیدکننده داشته است از فشرده فایل: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## به عنوان مثال نمایش داده شد {#example-queries} - -[اموزش کلیک](../../getting_started/tutorial.md) است در یاندکس بر اساس.مجموعه داده های متریکا و راه توصیه شده برای شروع این مجموعه داده ها فقط از طریق تدریس خصوصی است. - -نمونه های اضافی از نمایش داده شد به این جداول را می توان در میان یافت [تست های نفرت انگیز](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) از کلیک هاوس (به نام `test.hists` و `test.visits` وجود دارد). diff --git a/docs/fa/getting_started/index.md b/docs/fa/getting_started/index.md deleted file mode 100644 index d4b2ba243f2..00000000000 --- a/docs/fa/getting_started/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Getting Started -toc_hidden: true -toc_priority: 8 -toc_title: "\u0645\u062E\u0641\u06CC" ---- - -# شروع کار {#getting-started} - -اگر شما تازه به تاتر هستند و می خواهید برای دریافت یک دست در احساس عملکرد خود را, اول از همه, شما نیاز به از طریق رفتن [مراحل نصب](install.md). بعد از که شما می توانید: - -- [برو از طریق مفصل](tutorial.md) -- [تجربه با مجموعه داده های نمونه](example_datasets/ontime.md) - -[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/fa/getting_started/install.md b/docs/fa/getting_started/install.md deleted file mode 100644 index 0ce568018b3..00000000000 --- a/docs/fa/getting_started/install.md +++ /dev/null @@ -1,192 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 11 -toc_title: "\u0646\u0635\u0628 \u0648 \u0631\u0627\u0647 \u0627\u0646\u062F\u0627\u0632\ - \u06CC" ---- - -# نصب و راه اندازی {#installation} - -## سیستم مورد نیاز {#system-requirements} - -ClickHouse می تواند اجرا بر روی هر Linux, FreeBSD یا سیستم عامل Mac OS X با x86\_64, AArch64 یا PowerPC64LE معماری CPU. - -رسمی از پیش ساخته شده باینری به طور معمول وارد شده برای ایکس86\_64 و اهرم بورس تحصیلی 4.2 مجموعه دستورالعمل, بنابراین مگر اینکه در غیر این صورت اعلام کرد استفاده از پردازنده است که پشتیبانی می شود یک سیستم اضافی مورد نیاز. در اینجا دستور برای بررسی اگر پردازنده فعلی دارای پشتیبانی برای اس اس 4.2: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -برای اجرای clickhouse در پردازنده هایی که پشتیبانی نمی sse 4.2 یا aarch64 یا powerpc64le معماری شما باید [ساخت کلیک از منابع](#from-sources) با تنظیمات پیکربندی مناسب. - -## گزینه های نصب موجود {#available-installation-options} - -### از بسته های دب {#install-from-deb-packages} - -توصیه می شود به استفاده از رسمی از پیش وارد شده `deb` بسته برای دبیان یا اوبونتو. - -برای نصب بسته های رسمی اضافه کردن مخزن یاندکس در `/etc/apt/sources.list` یا در یک جداگانه `/etc/apt/sources.list.d/clickhouse.list` پرونده: - - deb http://repo.clickhouse.tech/deb/stable/ main/ - -اگر شما می خواهید به استفاده از نسخه های اخیر, جایگزین کردن `stable` با `testing` (این است که برای محیط های تست خود را توصیه می شود). - -سپس این دستورات را برای نصب بسته ها اجرا کنید: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -شما همچنین می توانید بسته ها را به صورت دستی از اینجا دانلود و نصب کنید: https://repo.yandex.ru/clickhouse/deb/stable/main/. - -#### بستهها {#packages} - -- `clickhouse-common-static` — Installs ClickHouse compiled binary files. -- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` و نصب پیکربندی سرور به طور پیش فرض. -- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` و دیگر ابزار مربوط به مشتری. و نصب فایل های پیکربندی مشتری. -- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. - -### از بسته های دور در دقیقه {#from-rpm-packages} - -توصیه می شود به استفاده از رسمی از پیش وارد شده `rpm` بسته برای لینوکس لینوکس, کلاه قرمز, و همه توزیع های لینوکس مبتنی بر دور در دقیقه دیگر. - -اولین, شما نیاز به اضافه کردن مخزن رسمی: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 -``` - -اگر شما می خواهید به استفاده از نسخه های اخیر, جایگزین کردن `stable` با `testing` (این است که برای محیط های تست خود را توصیه می شود). این `prestable` برچسب است که گاهی اوقات در دسترس بیش از حد. - -سپس این دستورات را برای نصب بسته ها اجرا کنید: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -شما همچنین می توانید بسته ها را به صورت دستی از اینجا دانلود و نصب کنید: https://repo.فاحشه خانه.تکنولوژی/دور در دقیقه/پایدار / ایکس86\_64. - -### از بایگانی {#from-tgz-archives} - -توصیه می شود به استفاده از رسمی از پیش وارد شده `tgz` بایگانی برای همه توزیع های لینوکس, که نصب و راه اندازی `deb` یا `rpm` بسته امکان پذیر نیست. - -نسخه مورد نیاز را می توان با دانلود `curl` یا `wget` از مخزن https://repo.yandex.ru/clickhouse/tgz/. -پس از که دانلود بایگانی باید غیر بستهای و نصب شده با اسکریپت نصب و راه اندازی. به عنوان مثال برای جدیدترین نسخه: - -``` bash -export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz - -tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz -sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz -sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-server-$LATEST_VERSION.tgz -sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh -sudo /etc/init.d/clickhouse-server start - -tar -xzvf clickhouse-client-$LATEST_VERSION.tgz -sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh -``` - -برای محیط های تولید توصیه می شود از جدیدترین استفاده کنید `stable`- نسخه شما می توانید شماره خود را در صفحه گیتهاب پیدا https://github.com/ClickHouse/ClickHouse/tags با پسوند `-stable`. - -### از تصویر کارگر بارانداز {#from-docker-image} - -برای اجرای کلیک در داخل کارگر بارانداز راهنمای دنبال کنید [داکر توپی](https://hub.docker.com/r/yandex/clickhouse-server/). این تصاویر استفاده رسمی `deb` بسته در داخل. - -### از منابع {#from-sources} - -به صورت دستی کامپایل فاحشه خانه, دستورالعمل برای دنبال [لینوکس](../development/build.md) یا [سیستم عامل مک ایکس](../development/build_osx.md). - -شما می توانید بسته های کامپایل و نصب و یا استفاده از برنامه های بدون نصب بسته. همچنین با ساخت دستی شما می توانید ثانیه 4.2 مورد نیاز غیر فعال کردن و یا ساخت برای ایالت64 پردازنده. - - Client: programs/clickhouse-client - Server: programs/clickhouse-server - -شما نیاز به ایجاد یک داده ها و پوشه ابرداده و `chown` برای کاربر مورد نظر. مسیر خود را می توان در پیکربندی سرور تغییر (سری سی/برنامه/سرور/پیکربندی.به طور پیش فرض: - - /opt/clickhouse/data/default/ - /opt/clickhouse/metadata/default/ - -در جنتو, شما فقط می توانید استفاده کنید `emerge clickhouse` برای نصب کلیک از منابع. - -## راهاندازی {#launch} - -برای شروع سرور به عنوان یک شبح, اجرا: - -``` bash -$ sudo service clickhouse-server start -``` - -اگر شما لازم نیست `service` فرمان, اجرا به عنوان - -``` bash -$ sudo /etc/init.d/clickhouse-server start -``` - -سیاهههای مربوط در `/var/log/clickhouse-server/` فهرست راهنما. - -اگر سرور شروع نمی کند, بررسی تنظیمات در فایل `/etc/clickhouse-server/config.xml`. - -شما همچنین می توانید سرور را از کنسول به صورت دستی راه اندازی کنید: - -``` bash -$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -در این مورد, ورود به سیستم خواهد شد به کنسول چاپ, که مناسب است در طول توسعه. -اگر فایل پیکربندی در دایرکتوری فعلی است, شما لازم نیست برای مشخص کردن `--config-file` پارامتر. به طور پیش فرض استفاده می کند `./config.xml`. - -تاتر پشتیبانی از تنظیمات محدودیت دسترسی. این در واقع `users.xml` پرونده) در کنار ( `config.xml`). -به طور پیش فرض, دسترسی از هر نقطه برای اجازه `default` کاربر, بدون رمز عبور. ببینید `user/default/networks`. -برای کسب اطلاعات بیشتر به بخش مراجعه کنید [“Configuration Files”](../operations/configuration_files.md). - -پس از راه اندازی سرور, شما می توانید مشتری خط فرمان برای اتصال به استفاده: - -``` bash -$ clickhouse-client -``` - -به طور پیش فرض به `localhost:9000` از طرف کاربر `default` بدون رمز عبور. همچنین می تواند مورد استفاده قرار گیرد برای اتصال به یک سرور از راه دور با استفاده از `--host` استدلال کردن. - -ترمینال باید از کدگذاری جی تی اف 8 استفاده کند. -برای کسب اطلاعات بیشتر به بخش مراجعه کنید [“Command-line client”](../interfaces/cli.md). - -مثال: - -``` bash -$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**تبریک, سیستم کار می کند!** - -برای ادامه تجربه, شما می توانید یکی از مجموعه داده های تست دانلود و یا رفتن را از طریق [اموزش](https://clickhouse.tech/tutorial.html). - -[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/fa/getting_started/tutorial.md b/docs/fa/getting_started/tutorial.md deleted file mode 100644 index bb906fc48b5..00000000000 --- a/docs/fa/getting_started/tutorial.md +++ /dev/null @@ -1,671 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 12 -toc_title: "\u0627\u0645\u0648\u0632\u0634" ---- - -# اموزش کلیک {#clickhouse-tutorial} - -## چه انتظار از این مقاله? {#what-to-expect-from-this-tutorial} - -با رفتن را از طریق این مقاله, شما یاد بگیرند که چگونه به راه اندازی یک خوشه ساده تاتر. این کوچک خواهد بود, اما مقاوم در برابر خطا و مقیاس پذیر. سپس ما از یکی از مجموعه داده های نمونه برای پر کردن داده ها و اجرای برخی از نمایش های نسخه ی نمایشی استفاده خواهیم کرد. - -## راه اندازی تک گره {#single-node-setup} - -برای به تعویق انداختن پیچیدگی های یک محیط توزیع, ما با استقرار کلیک بر روی یک سرور و یا ماشین مجازی شروع. خانه کلیک است که معمولا از نصب [دب](index.md#install-from-deb-packages) یا [دور در دقیقه](index.md#from-rpm-packages) بسته, اما وجود دارد [جایگزین ها](index.md#from-docker-image) برای سیستم عامل هایی که هیچ پشتیبانی نمی کنند. - -مثلا, شما را انتخاب کرده اند `deb` بسته ها و اعدام: - -``` bash -sudo apt-get install dirmngr -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 - -echo "deb http://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list -sudo apt-get update - -sudo apt-get install -y clickhouse-server clickhouse-client -``` - -در بسته هایی که نصب شده اند چه چیزی داریم: - -- `clickhouse-client` بسته شامل [کلیک مشتری](../interfaces/cli.md) کاربرد, تعاملی مشتری کنسول تاتر. -- `clickhouse-common` بسته شامل یک فایل اجرایی کلیک. -- `clickhouse-server` بسته شامل فایل های پیکربندی برای اجرای تاتر به عنوان یک سرور. - -فایل های پیکربندی سرور در واقع `/etc/clickhouse-server/`. قبل از رفتن بیشتر, لطفا توجه کنید `` عنصر در `config.xml`. مسیر تعیین محل ذخیره سازی داده ها, بنابراین باید در حجم با ظرفیت دیسک بزرگ واقع; مقدار پیش فرض است `/var/lib/clickhouse/`. اگر شما می خواهید برای تنظیم پیکربندی, این دستی به طور مستقیم ویرایش کنید `config.xml` فایل, با توجه به اینکه ممکن است در به روز رسانی بسته های بعدی بازنویسی. راه توصیه می شود به نادیده گرفتن عناصر پیکربندی است که برای ایجاد [فایل ها در پیکربندی.فهرست راهنما](../operations/configuration_files.md) که به عنوان خدمت می کنند “patches” برای پیکربندی.. - -همانطور که شما ممکن است متوجه, `clickhouse-server` به طور خودکار پس از نصب بسته راه اندازی نشده است. این به طور خودکار پس از به روز رسانی دوباره راه اندازی نخواهد شد. راه شما شروع به سرور بستگی به سیستم اینیت خود را, معمولا, این: - -``` bash -sudo service clickhouse-server start -``` - -یا - -``` bash -sudo /etc/init.d/clickhouse-server start -``` - -محل پیش فرض برای سیاهههای مربوط به سرور است `/var/log/clickhouse-server/`. سرور برای رسیدگی به اتصالات مشتری پس از ورود به سیستم `Ready for connections` پیام - -هنگامی که `clickhouse-server` است و در حال اجرا, ما می توانیم با استفاده از `clickhouse-client` برای اتصال به سرور و اجرای برخی از نمایش داده شد تست مانند `SELECT "Hello, world!";`. - -
- -راهنمایی سریع برای کلیک-مشتری -حالت تعاملی: - -``` bash -clickhouse-client -clickhouse-client --host=... --port=... --user=... --password=... -``` - -فعالسازی پرسشهای چند خطی: - -``` bash -clickhouse-client -m -clickhouse-client --multiline -``` - -نمایش داده شد اجرا در دسته حالت: - -``` bash -clickhouse-client --query='SELECT 1' -echo 'SELECT 1' | clickhouse-client -clickhouse-client <<< 'SELECT 1' -``` - -درج داده از یک پرونده در قالب مشخص شده: - -``` bash -clickhouse-client --query='INSERT INTO table VALUES' < data.txt -clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv -``` - -
- -## واردات مجموعه داده نمونه {#import-sample-dataset} - -در حال حاضر زمان برای پر کردن سرور کلیک ما با برخی از داده های نمونه است. در این مقاله ما از داده های ناشناس یاندکس استفاده خواهیم کرد.متریکا, اولین سرویس اجرا می شود که کلیک در راه تولید قبل از منبع باز شد (بیشتر در که در [بخش تاریخچه](../introduction/history.md)). وجود دارد [راه های متعدد برای وارد کردن یاندکس.مجموعه داده های متریکا](example_datasets/metrica.md), و به خاطر تدریس خصوصی, ما با یکی از واقع بینانه ترین رفتن. - -### دانلود و استخراج داده های جدول {#download-and-extract-table-data} - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -``` - -فایل های استخراج شده حدود 10 گیگابایت است. - -### ایجاد جداول {#create-tables} - -همانطور که در بسیاری از سیستم های مدیریت پایگاه داده, تاتر منطقی جداول گروه به “databases”. تاپیک `default` پایگاه داده, اما ما یکی از جدید به نام ایجاد `tutorial`: - -``` bash -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" -``` - -نحو برای ایجاد جداول راه پیچیده تر در مقایسه با پایگاه داده است (نگاه کنید به [مرجع](../sql_reference/statements/create.md). به طور کلی `CREATE TABLE` بیانیه باید سه چیز کلیدی را مشخص کند: - -1. نام جدول برای ایجاد. -2. Table schema, i.e. list of columns and their [انواع داده ها](../sql_reference/data_types/index.md). -3. [موتور جدول](../engines/table_engines/index.md) و این تنظیمات است, که تعیین تمام اطلاعات در مورد نحوه نمایش داده شد به این جدول خواهد شد از لحاظ جسمی اجرا. - -یاندکسمتریکا یک سرویس تجزیه و تحلیل وب است و مجموعه داده نمونه قابلیت های کامل خود را پوشش نمی دهد بنابراین تنها دو جدول برای ایجاد وجود دارد: - -- `hits` یک جدول با هر عمل انجام شده توسط همه کاربران در تمام وب سایت های تحت پوشش این سرویس است. -- `visits` یک جدول است که شامل جلسات از پیش ساخته شده به جای اقدامات فردی است. - -بیایید ببینید و اجرای واقعی ایجاد نمایش داده شد جدول برای این جداول: - -``` sql -CREATE TABLE tutorial.hits_v1 -( - `WatchID` UInt64, - `JavaEnable` UInt8, - `Title` String, - `GoodEvent` Int16, - `EventTime` DateTime, - `EventDate` Date, - `CounterID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RegionID` UInt32, - `UserID` UInt64, - `CounterClass` Int8, - `OS` UInt8, - `UserAgent` UInt8, - `URL` String, - `Referer` String, - `URLDomain` String, - `RefererDomain` String, - `Refresh` UInt8, - `IsRobot` UInt8, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `FlashMinor2` String, - `NetMajor` UInt8, - `NetMinor` UInt8, - `UserAgentMajor` UInt16, - `UserAgentMinor` FixedString(2), - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `MobilePhone` UInt8, - `MobilePhoneModel` String, - `Params` String, - `IPNetworkID` UInt32, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `IsArtifical` UInt8, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `ClientTimeZone` Int16, - `ClientEventTime` DateTime, - `SilverlightVersion1` UInt8, - `SilverlightVersion2` UInt8, - `SilverlightVersion3` UInt32, - `SilverlightVersion4` UInt16, - `PageCharset` String, - `CodeVersion` UInt32, - `IsLink` UInt8, - `IsDownload` UInt8, - `IsNotBounce` UInt8, - `FUniqID` UInt64, - `HID` UInt32, - `IsOldCounter` UInt8, - `IsEvent` UInt8, - `IsParameter` UInt8, - `DontCountHits` UInt8, - `WithHash` UInt8, - `HitColor` FixedString(1), - `UTCEventTime` DateTime, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `WindowName` Int32, - `OpenerName` Int32, - `HistoryLength` Int16, - `BrowserLanguage` FixedString(2), - `BrowserCountry` FixedString(2), - `SocialNetwork` String, - `SocialAction` String, - `HTTPError` UInt16, - `SendTiming` Int32, - `DNSTiming` Int32, - `ConnectTiming` Int32, - `ResponseStartTiming` Int32, - `ResponseEndTiming` Int32, - `FetchTiming` Int32, - `RedirectTiming` Int32, - `DOMInteractiveTiming` Int32, - `DOMContentLoadedTiming` Int32, - `DOMCompleteTiming` Int32, - `LoadEventStartTiming` Int32, - `LoadEventEndTiming` Int32, - `NSToDOMContentLoadedTiming` Int32, - `FirstPaintTiming` Int32, - `RedirectCount` Int8, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `ParamPrice` Int64, - `ParamOrderID` String, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `GoalsReached` Array(UInt32), - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `RefererHash` UInt64, - `URLHash` UInt64, - `CLID` UInt32, - `YCLID` UInt64, - `ShareService` String, - `ShareURL` String, - `ShareTitle` String, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `IslandID` FixedString(16), - `RequestNum` UInt32, - `RequestTry` UInt8 -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -``` sql -CREATE TABLE tutorial.visits_v1 -( - `CounterID` UInt32, - `StartDate` Date, - `Sign` Int8, - `IsNew` UInt8, - `VisitID` UInt64, - `UserID` UInt64, - `StartTime` DateTime, - `Duration` UInt32, - `UTCStartTime` DateTime, - `PageViews` Int32, - `Hits` Int32, - `IsBounce` UInt8, - `Referer` String, - `StartURL` String, - `RefererDomain` String, - `StartURLDomain` String, - `EndURL` String, - `LinkURL` String, - `IsDownload` UInt8, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `PlaceID` Int32, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `IsYandex` UInt8, - `GoalReachesDepth` Int32, - `GoalReachesURL` Int32, - `GoalReachesAny` Int32, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `MobilePhoneModel` String, - `ClientEventTime` DateTime, - `RegionID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `IPNetworkID` UInt32, - `SilverlightVersion3` UInt32, - `CodeVersion` UInt32, - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `UserAgentMajor` UInt16, - `UserAgentMinor` UInt16, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `SilverlightVersion2` UInt8, - `SilverlightVersion4` UInt16, - `FlashVersion3` UInt16, - `FlashVersion4` UInt16, - `ClientTimeZone` Int16, - `OS` UInt8, - `UserAgent` UInt8, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `NetMajor` UInt8, - `NetMinor` UInt8, - `MobilePhone` UInt8, - `SilverlightVersion1` UInt8, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `JavaEnable` UInt8, - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `BrowserLanguage` UInt16, - `BrowserCountry` UInt16, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `Params` Array(String), - `Goals` Nested( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32), - `WatchIDs` Array(UInt64), - `ParamSumPrice` Int64, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `ClickLogID` UInt64, - `ClickEventID` Int32, - `ClickGoodEvent` Int32, - `ClickEventTime` DateTime, - `ClickPriorityID` Int32, - `ClickPhraseID` Int32, - `ClickPageID` Int32, - `ClickPlaceID` Int32, - `ClickTypeID` Int32, - `ClickResourceID` Int32, - `ClickCost` UInt32, - `ClickClientIP` UInt32, - `ClickDomainID` UInt32, - `ClickURL` String, - `ClickAttempt` UInt8, - `ClickOrderID` UInt32, - `ClickBannerID` UInt32, - `ClickMarketCategoryID` UInt32, - `ClickMarketPP` UInt32, - `ClickMarketCategoryName` String, - `ClickMarketPPName` String, - `ClickAWAPSCampaignName` String, - `ClickPageName` String, - `ClickTargetType` UInt16, - `ClickTargetPhraseID` UInt64, - `ClickContextType` UInt8, - `ClickSelectType` Int8, - `ClickOptions` String, - `ClickGroupBannerID` Int32, - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `FirstVisit` DateTime, - `PredLastVisit` Date, - `LastVisit` Date, - `TotalVisits` UInt32, - `TraficSource` Nested( - ID Int8, - SearchEngineID UInt16, - AdvEngineID UInt8, - PlaceID UInt16, - SocialSourceNetworkID UInt8, - Domain String, - SearchPhrase String, - SocialSourcePage String), - `Attendance` FixedString(16), - `CLID` UInt32, - `YCLID` UInt64, - `NormalizedRefererHash` UInt64, - `SearchPhraseHash` UInt64, - `RefererDomainHash` UInt64, - `NormalizedStartURLHash` UInt64, - `StartURLDomainHash` UInt64, - `NormalizedEndURLHash` UInt64, - `TopLevelDomain` UInt64, - `URLScheme` UInt64, - `OpenstatServiceNameHash` UInt64, - `OpenstatCampaignIDHash` UInt64, - `OpenstatAdIDHash` UInt64, - `OpenstatSourceIDHash` UInt64, - `UTMSourceHash` UInt64, - `UTMMediumHash` UInt64, - `UTMCampaignHash` UInt64, - `UTMContentHash` UInt64, - `UTMTermHash` UInt64, - `FromHash` UInt64, - `WebVisorEnabled` UInt8, - `WebVisorActivity` UInt32, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `Market` Nested( - Type UInt8, - GoalID UInt32, - OrderID String, - OrderPrice Int64, - PP UInt32, - DirectPlaceID UInt32, - DirectOrderID UInt32, - DirectBannerID UInt32, - GoodID String, - GoodName String, - GoodQuantity Int32, - GoodPrice Int64), - `IslandID` FixedString(16) -) -ENGINE = CollapsingMergeTree(Sign) -PARTITION BY toYYYYMM(StartDate) -ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -شما می توانید این پرسش ها را با استفاده از حالت تعاملی اجرا کنید `clickhouse-client` (فقط در یک ترمینال راه اندازی بدون مشخص کردن یک پرس و جو در پیش) و یا سعی کنید برخی از [رابط جایگزین](../interfaces/index.md) اگر شما می خواهید. - -همانطور که می بینیم, `hits_v1` با استفاده از [موتور ادغام عمومی](../engines/table_engines/mergetree_family/mergetree.md) در حالی که `visits_v1` با استفاده از [سقوط](../engines/table_engines/mergetree_family/collapsingmergetree.md) نوع. - -### وارد کردن داده {#import-data} - -وارد کردن داده ها به تاتر از طریق انجام می شود [INSERT INTO](../sql_reference/statements/insert_into.md) پرس و جو مانند در بسیاری از پایگاه داده های دیگر گذاشتن. با این حال, داده ها معمولا در یکی از [پشتیبانی از فرمت های ترتیب](../interfaces/formats.md) به جای `VALUES` بند (که همچنین پشتیبانی). - -فایل هایی که قبلا دانلود کردیم در قالب تب جدا شده اند بنابراین در اینجا نحوه وارد کردن از طریق مشتری کنسول است: - -``` bash -clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv -clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv -``` - -تاتر است که بسیاری از [تنظیمات برای تنظیم](../operations/settings/index.md) و یک راه برای مشخص کردن انها در کنسول مشتری از طریق استدلال است همانطور که ما می توانید ببینید با `--max_insert_block_size`. ساده ترین راه برای کشف کردن چه تنظیمات در دسترس هستند, چه معنی می دهند و چه پیش فرض است به پرس و جو `system.settings` جدول: - -``` sql -SELECT name, value, changed, description -FROM system.settings -WHERE name LIKE '%max_insert_b%' -FORMAT TSV - -max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." -``` - -در صورت تمایل شما می توانید [OPTIMIZE](../query_language/misc/#misc_operations-optimize) جداول پس از واردات. جداول است که با یک موتور از ادغام خانواده پیکربندی همیشه ادغام قطعات داده ها در پس زمینه برای بهینه سازی ذخیره سازی داده ها (یا حداقل چک کنید اگر حس می کند). این نمایش داده شد نیروی موتور جدول به انجام بهینه سازی ذخیره سازی در حال حاضر به جای برخی از زمان بعد: - -``` bash -clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" -clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" -``` - -این نمایش داده شد شروع یک عملیات فشرده من/ای و پردازنده, بنابراین اگر جدول به طور مداوم داده های جدید دریافت, بهتر است به تنهایی ترک و اجازه دهید ادغام در پس زمینه اجرا. - -در حال حاضر ما می توانید بررسی کنید اگر واردات جدول موفق بود: - -``` bash -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" -``` - -## به عنوان مثال نمایش داده شد {#example-queries} - -``` sql -SELECT - StartURL AS URL, - AVG(Duration) AS AvgDuration -FROM tutorial.visits_v1 -WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' -GROUP BY URL -ORDER BY AvgDuration DESC -LIMIT 10 -``` - -``` sql -SELECT - sum(Sign) AS visits, - sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, - (100. * goal_visits) / visits AS goal_percent -FROM tutorial.visits_v1 -WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') -``` - -## استقرار خوشه {#cluster-deployment} - -خوشه کلیک یک خوشه همگن است. مراحل برای راه اندازی: - -1. نصب سرور کلیک بر روی تمام ماشین های خوشه -2. تنظیم پیکربندی خوشه در فایل های پیکربندی -3. ایجاد جداول محلی در هر نمونه -4. ایجاد یک [جدول توزیع شده](../engines/table_engines/special/distributed.md) - -[جدول توزیع شده](../engines/table_engines/special/distributed.md) در واقع یک نوع از “view” به جداول محلی خوشه فاحشه خانه. پرس و جو را انتخاب کنید از یک جدول توزیع اجرا با استفاده از منابع خرده ریز تمام خوشه. شما ممکن است تنظیمات برای خوشه های متعدد مشخص و ایجاد جداول توزیع های متعدد فراهم کردن دیدگاه ها به خوشه های مختلف. - -به عنوان مثال پیکربندی برای یک خوشه با سه خرده ریز, یک ماکت هر: - -``` xml - - - - - example-perftest01j.yandex.ru - 9000 - - - - - example-perftest02j.yandex.ru - 9000 - - - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -برای تظاهرات بیشتر, اجازه دهید یک جدول محلی جدید با همان ایجاد `CREATE TABLE` پرس و جو که ما برای استفاده `hits_v1`, اما نام جدول های مختلف: - -``` sql -CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... -``` - -ایجاد یک جدول توزیع شده برای نمایش در جداول محلی خوشه: - -``` sql -CREATE TABLE tutorial.hits_all AS tutorial.hits_local -ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); -``` - -یک روش معمول این است که جداول توزیع شده مشابه را در تمام ماشین های خوشه ایجاد کنید. این اجازه می دهد در حال اجرا نمایش داده شد توزیع در هر دستگاه از خوشه. همچنین یک گزینه جایگزین برای ایجاد جدول توزیع موقت برای پرس و جو انتخاب داده شده با استفاده از وجود دارد [دور](../sql_reference/table_functions/remote.md) تابع جدول. - -بیا فرار کنیم [INSERT SELECT](../sql_reference/statements/insert_into.md) به جدول توزیع شده برای گسترش جدول به چندین سرور. - -``` sql -INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; -``` - -!!! warning "اطلاع" - این روش مناسب برای شارژ جداول بزرگ نیست. یک ابزار جداگانه وجود دارد [تاتر-کپی](../operations/utilities/clickhouse-copier.md) که می تواند جداول دلخواه بزرگ دوباره سفال. - -همانطور که شما می توانید انتظار, نمایش داده شد محاسباتی سنگین اجرا نفر بار سریع تر در صورتی که استفاده 3 سرور به جای یک. - -در این مورد, ما یک خوشه با استفاده کرده اند 3 خرده ریز, و هر شامل یک ماکت تک. - -برای انعطاف پذیری در یک محیط تولید, توصیه می کنیم که هر سفال باید شامل 2-3 کپی بین مناطق در دسترس بودن متعدد و یا مراکز داده گسترش (یا حداقل قفسه). توجه داشته باشید که کلیک خانه پشتیبانی از تعداد نامحدودی از کپی. - -به عنوان مثال پیکربندی برای یک خوشه از یک سفال حاوی سه کپی: - -``` xml - - ... - - - - example-perftest01j.yandex.ru - 9000 - - - example-perftest02j.yandex.ru - 9000 - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -برای فعال کردن تکثیر بومی [باغ وحش](http://zookeeper.apache.org/) الزامی است. تاتر طول می کشد مراقبت از سازگاری داده ها در تمام کپی و اجرا می شود بازگرداندن روش پس از شکست به طور خودکار. توصیه می شود برای استقرار خوشه باغ وحش بر روی سرورهای جداگانه (جایی که هیچ پروسه های دیگر از جمله کلیک در حال اجرا هستند). - -!!! note "یادداشت" - باغ وحش یک نیاز سخت نیست: در برخی موارد ساده می توانید داده ها را با نوشتن به تمام کپی ها از کد درخواست خود کپی کنید. این رویکرد است **نه** توصیه می شود, در این مورد, تاتر قادر نخواهد بود برای تضمین ثبات داده ها در تمام کپی. بنابراین وظیفه درخواست شما می شود. - -مکان های باغ وحش در فایل پیکربندی مشخص شده است: - -``` xml - - - zoo01.yandex.ru - 2181 - - - zoo02.yandex.ru - 2181 - - - zoo03.yandex.ru - 2181 - - -``` - -همچنین, ما نیاز به تنظیم ماکروها برای شناسایی هر سفال و ماکت که در ایجاد جدول استفاده می شود: - -``` xml - - 01 - 01 - -``` - -اگر هیچ کپی در حال حاضر در ایجاد جدول تکرار وجود دارد, اولین ماکت جدید نمونه است. اگر در حال حاضر زندگی می کنند کپی جدید کلون داده ها از موجود. شما ابتدا یک گزینه برای ایجاد تمام جداول تکرار شده دارید و سپس داده ها را وارد کنید. یکی دیگر از گزینه این است که برای ایجاد برخی از کپی و اضافه کردن دیگران بعد یا در هنگام درج داده ها. - -``` sql -CREATE TABLE tutorial.hits_replica (...) -ENGINE = ReplcatedMergeTree( - '/clickhouse_perftest/tables/{shard}/hits', - '{replica}' -) -... -``` - -در اینجا ما با استفاده از [تکرار غذای اصلی](../engines/table_engines/mergetree_family/replication.md) موتور جدول. در پارامترهای مشخص می کنیم مسیر باغ وحش حاوی سفال و کپی شناسه. - -``` sql -INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; -``` - -تکرار عمل در حالت چند استاد. داده ها را می توان به هر ماکت بارگذاری کرد و سپس سیستم را با موارد دیگر به طور خودکار همگام سازی می کند. تکرار ناهمزمان است بنابراین در یک لحظه معین, همه کپی ممکن است حاوی داده به تازگی قرار داده شده. حداقل یک ماکت باید اجازه می دهد تا مصرف داده ها. دیگران همگام سازی داده ها و قوام تعمیر هنگامی که دوباره فعال تبدیل خواهد شد. توجه داشته باشید که این روش اجازه می دهد تا برای امکان کم از دست دادن داده ها به تازگی قرار داده شده. - -[مقاله اصلی](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/fa/guides/apply-catboost-model.md b/docs/fa/guides/apply-catboost-model.md new file mode 100644 index 00000000000..89dea576ec2 --- /dev/null +++ b/docs/fa/guides/apply-catboost-model.md @@ -0,0 +1,241 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 41 +toc_title: "\u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0645\u062F\u0644\ + \ \u0647\u0627\u06CC \u0627\u062F\u0645 \u06A9\u0648\u062F\u0646 \u0648 \u0627\u062D\ + \u0645\u0642" +--- + +# استفاده از مدل ادم کودن و احمق در فاحشه خانه {#applying-catboost-model-in-clickhouse} + +[مانتو](https://catboost.ai) یک کتابخانه تقویت شیب رایگان و منبع باز توسعه یافته در [یاندکس](https://yandex.com/company/) برای یادگیری ماشین. + +با استفاده از این دستورالعمل یاد خواهید گرفت که با اجرای مدل استنتاج از میدان از مدل های پیش روت شده در خانه استفاده کنید. + +برای اعمال یک مدل ادم کودن و احمق در خانه کلیک کنید: + +1. [ایجاد یک جدول](#create-table). +2. [درج داده به جدول](#insert-data-to-table). +3. [ادغام کاتبوست به کلیک](#integrate-catboost-into-clickhouse) (مرحله اختیاری). +4. [اجرای مدل استنتاج از گذاشتن](#run-model-inference). + +برای کسب اطلاعات بیشتر در مورد اموزش مدل های کاتبوست مراجعه کنید [اموزش و مدل سازی](https://catboost.ai/docs/features/training.html#training). + +## پیش نیازها {#prerequisites} + +اگر شما لازم نیست که [کارگر بارانداز](https://docs.docker.com/install/) هنوز, نصب کنید. + +!!! note "یادداشت" + [کارگر بارانداز](https://www.docker.com) یک پلت فرم نرم افزار است که اجازه می دهد تا به شما برای ایجاد ظروف که منزوی CatBoost و ClickHouse نصب و راه اندازی از بقیه سیستم. + +قبل از استفاده از مدل ادم کودن و احمق: + +**1.** بکش [تصویر کارگر بارانداز](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) از رجیستری: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +این docker تصویر شامل همه چیز شما نیاز به اجرای catboost و clickhouse: کد در زمان اجرا کتابخانه های محیط متغیر و فایل های پیکربندی. + +**2.** اطمینان حاصل کنید که تصویر کارگر بارانداز شده است با موفقیت کشیده: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** شروع یک ظرف کارگر بارانداز بر اساس این تصویر: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. ایجاد یک جدول {#create-table} + +برای ایجاد یک میز کلیک برای نمونه تمرین: + +**1.** شروع مشتری کنسول کلیک در حالت تعاملی: + +``` bash +$ clickhouse client +``` + +!!! note "یادداشت" + سرور کلیک در حال حاضر در داخل ظرف کارگر بارانداز در حال اجرا. + +**2.** ایجاد جدول با استفاده از دستور: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** خروج از مشتری کنسول کلیک کنید: + +``` sql +:) exit +``` + +## 2. درج داده به جدول {#insert-data-to-table} + +برای وارد کردن داده ها: + +**1.** دستور زیر را اجرا کنید: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** شروع مشتری کنسول کلیک در حالت تعاملی: + +``` bash +$ clickhouse client +``` + +**3.** اطمینان حاصل کنید که داده ها ارسال شده است: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++-------+ +``` + +## 3. ادغام کاتبوست به کلیک {#integrate-catboost-into-clickhouse} + +!!! note "یادداشت" + **گام اختیاری.** این Docker تصویر شامل همه چیز شما نیاز به اجرای CatBoost و ClickHouse. + +برای ادغام کاتبوست به کلیک: + +**1.** ساخت کتابخانه ارزیابی. + +سریعترین راه برای ارزیابی مدل ادم کودن و احمق کامپایل است `libcatboostmodel.` کتابخونه. برای کسب اطلاعات بیشتر در مورد چگونگی ساخت کتابخانه, دیدن [مستندات غلطیاب](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** ایجاد یک دایرکتوری جدید در هر کجا و با هر نام, مثلا, `data` و کتابخونه درستشون رو توش بذار. تصویر کارگر بارانداز در حال حاضر شامل کتابخانه `data/libcatboostmodel.so`. + +**3.** ایجاد یک دایرکتوری جدید برای مدل پیکربندی در هر کجا و با هر نام, مثلا, `models`. + +**4.** برای مثال یک فایل پیکربندی مدل با هر نام ایجاد کنید, `models/amazon_model.xml`. + +**5.** توصیف پیکربندی مدل: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** اضافه کردن مسیر به CatBoost و مدل پیکربندی به پیکربندی ClickHouse: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. اجرای مدل استنتاج از گذاشتن {#run-model-inference} + +برای مدل تست اجرای مشتری کلیک `$ clickhouse client`. + +بیایید اطمینان حاصل کنیم که مدل کار می کند: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "یادداشت" + تابع [مدلووات](../sql-reference/functions/other-functions.md#function-modelevaluate) را برمی گرداند تاپل با پیش بینی های خام در هر کلاس برای مدل های چند طبقه. + +بیایید احتمال را پیش بینی کنیم: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "یادداشت" + اطلاعات بیشتر در مورد [خروج()](../sql-reference/functions/math-functions.md) تابع. + +بیایید محاسبه لگ در نمونه: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "یادداشت" + اطلاعات بیشتر در مورد [میانگین()](../sql-reference/aggregate-functions/reference.md#agg_function-avg) و [ثبت()](../sql-reference/functions/math-functions.md) توابع. + +[مقاله اصلی](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/fa/guides/apply_catboost_model.md b/docs/fa/guides/apply_catboost_model.md deleted file mode 100644 index 90b915a60f8..00000000000 --- a/docs/fa/guides/apply_catboost_model.md +++ /dev/null @@ -1,241 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 41 -toc_title: "\u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0645\u062F\u0644\ - \ \u0647\u0627\u06CC \u0627\u062F\u0645 \u06A9\u0648\u062F\u0646 \u0648 \u0627\u062D\ - \u0645\u0642" ---- - -# استفاده از مدل ادم کودن و احمق در فاحشه خانه {#applying-catboost-model-in-clickhouse} - -[مانتو](https://catboost.ai) یک کتابخانه تقویت شیب رایگان و منبع باز توسعه یافته در [یاندکس](https://yandex.com/company/) برای یادگیری ماشین. - -با استفاده از این دستورالعمل یاد خواهید گرفت که با اجرای مدل استنتاج از میدان از مدل های پیش روت شده در خانه استفاده کنید. - -برای اعمال یک مدل ادم کودن و احمق در خانه کلیک کنید: - -1. [ایجاد یک جدول](#create-table). -2. [درج داده به جدول](#insert-data-to-table). -3. [ادغام کاتبوست به کلیک](#integrate-catboost-into-clickhouse) (مرحله اختیاری). -4. [اجرای مدل استنتاج از گذاشتن](#run-model-inference). - -برای کسب اطلاعات بیشتر در مورد اموزش مدل های کاتبوست مراجعه کنید [اموزش و مدل سازی](https://catboost.ai/docs/features/training.html#training). - -## پیش نیازها {#prerequisites} - -اگر شما لازم نیست که [کارگر بارانداز](https://docs.docker.com/install/) هنوز, نصب کنید. - -!!! note "یادداشت" - [کارگر بارانداز](https://www.docker.com) یک پلت فرم نرم افزار است که اجازه می دهد تا به شما برای ایجاد ظروف که منزوی CatBoost و ClickHouse نصب و راه اندازی از بقیه سیستم. - -قبل از استفاده از مدل ادم کودن و احمق: - -**1.** بکش [تصویر کارگر بارانداز](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) از رجیستری: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -این docker تصویر شامل همه چیز شما نیاز به اجرای catboost و clickhouse: کد در زمان اجرا کتابخانه های محیط متغیر و فایل های پیکربندی. - -**2.** اطمینان حاصل کنید که تصویر کارگر بارانداز شده است با موفقیت کشیده: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** شروع یک ظرف کارگر بارانداز بر اساس این تصویر: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. ایجاد یک جدول {#create-table} - -برای ایجاد یک میز کلیک برای نمونه تمرین: - -**1.** شروع مشتری کنسول کلیک در حالت تعاملی: - -``` bash -$ clickhouse client -``` - -!!! note "یادداشت" - سرور کلیک در حال حاضر در داخل ظرف کارگر بارانداز در حال اجرا. - -**2.** ایجاد جدول با استفاده از دستور: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** خروج از مشتری کنسول کلیک کنید: - -``` sql -:) exit -``` - -## 2. درج داده به جدول {#insert-data-to-table} - -برای وارد کردن داده ها: - -**1.** دستور زیر را اجرا کنید: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** شروع مشتری کنسول کلیک در حالت تعاملی: - -``` bash -$ clickhouse client -``` - -**3.** اطمینان حاصل کنید که داده ها ارسال شده است: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+-------+ -``` - -## 3. ادغام کاتبوست به کلیک {#integrate-catboost-into-clickhouse} - -!!! note "یادداشت" - **گام اختیاری.** این Docker تصویر شامل همه چیز شما نیاز به اجرای CatBoost و ClickHouse. - -برای ادغام کاتبوست به کلیک: - -**1.** ساخت کتابخانه ارزیابی. - -سریعترین راه برای ارزیابی مدل ادم کودن و احمق کامپایل است `libcatboostmodel.` کتابخونه. برای کسب اطلاعات بیشتر در مورد چگونگی ساخت کتابخانه, دیدن [مستندات غلطیاب](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** ایجاد یک دایرکتوری جدید در هر کجا و با هر نام, مثلا, `data` و کتابخونه درستشون رو توش بذار. تصویر کارگر بارانداز در حال حاضر شامل کتابخانه `data/libcatboostmodel.so`. - -**3.** ایجاد یک دایرکتوری جدید برای مدل پیکربندی در هر کجا و با هر نام, مثلا, `models`. - -**4.** برای مثال یک فایل پیکربندی مدل با هر نام ایجاد کنید, `models/amazon_model.xml`. - -**5.** توصیف پیکربندی مدل: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** اضافه کردن مسیر به CatBoost و مدل پیکربندی به پیکربندی ClickHouse: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. اجرای مدل استنتاج از گذاشتن {#run-model-inference} - -برای مدل تست اجرای مشتری کلیک `$ clickhouse client`. - -بیایید اطمینان حاصل کنیم که مدل کار می کند: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "یادداشت" - تابع [مدلووات](../sql_reference/functions/other_functions.md#function-modelevaluate) را برمی گرداند تاپل با پیش بینی های خام در هر کلاس برای مدل های چند طبقه. - -بیایید احتمال را پیش بینی کنیم: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "یادداشت" - اطلاعات بیشتر در مورد [خروج()](../sql_reference/functions/math_functions.md) تابع. - -بیایید محاسبه لگ در نمونه: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "یادداشت" - اطلاعات بیشتر در مورد [میانگین()](../sql_reference/aggregate_functions/reference.md#agg_function-avg) و [ثبت()](../sql_reference/functions/math_functions.md) توابع. - -[مقاله اصلی](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/fa/guides/index.md b/docs/fa/guides/index.md index 6915953177b..165fc79164a 100644 --- a/docs/fa/guides/index.md +++ b/docs/fa/guides/index.md @@ -10,7 +10,7 @@ toc_title: "\u0628\u0631\u0631\u0633\u06CC \u0627\u062C\u0645\u0627\u0644\u06CC" فهرست دقیق گام به گام دستورالعمل که برای کمک به حل وظایف مختلف با استفاده از کلیک: -- [اموزش تنظیم خوشه ساده](../getting_started/tutorial.md) -- [استفاده از مدل ادم کودن و احمق در فاحشه خانه](apply_catboost_model.md) +- [اموزش تنظیم خوشه ساده](../getting-started/tutorial.md) +- [استفاده از مدل ادم کودن و احمق در فاحشه خانه](apply-catboost-model.md) [مقاله اصلی](https://clickhouse.tech/docs/en/guides/) diff --git a/docs/fa/images/column_oriented.gif b/docs/fa/images/column-oriented.gif similarity index 100% rename from docs/fa/images/column_oriented.gif rename to docs/fa/images/column-oriented.gif diff --git a/docs/fa/images/logo.svg b/docs/fa/images/logo.svg index b5ab923ff65..17da9417e2d 100644 --- a/docs/fa/images/logo.svg +++ b/docs/fa/images/logo.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/docs/fa/images/row_oriented.gif b/docs/fa/images/row-oriented.gif similarity index 100% rename from docs/fa/images/row_oriented.gif rename to docs/fa/images/row-oriented.gif diff --git a/docs/fa/index.md b/docs/fa/index.md index f2b8f433edb..4e32b4b489c 100644 --- a/docs/fa/index.md +++ b/docs/fa/index.md @@ -1,4 +1,4 @@ -
+
# ClickHouse چیست؟ {#clickhouse-chyst} @@ -63,11 +63,11 @@ ClickHouse یک مدیریت دیتابیس (DBMS) ستون گرا برای پر **ردیف گرا** -![Row oriented](images/row_oriented.gif#) +![Row oriented](images/row-oriented.gif#) **ستون گرا** -![Column oriented](images/column_oriented.gif#) +![Column oriented](images/column-oriented.gif#) تفاوت را دیدید؟ بیشتر بخوانید تا یاد بگیرید چرا این اتفاق رخ میدهد. diff --git a/docs/fa/interfaces/cli.md b/docs/fa/interfaces/cli.md index dfee35f2083..8d8ea93c25a 100644 --- a/docs/fa/interfaces/cli.md +++ b/docs/fa/interfaces/cli.md @@ -9,7 +9,7 @@ toc_title: "\u0645\u0634\u062A\u0631\u06CC \u062E\u0637 \u0641\u0631\u0645\u0627 تاتر یک مشتری خط فرمان بومی فراهم می کند: `clickhouse-client`. مشتری پشتیبانی از گزینه های خط فرمان و فایل های پیکربندی. برای کسب اطلاعات بیشتر, دیدن [پیکربندی](#interfaces_cli_configuration). -[نصب](../getting_started/index.md) این از `clickhouse-client` بسته بندی و اجرا با فرمان `clickhouse-client`. +[نصب](../getting-started/index.md) این از `clickhouse-client` بسته بندی و اجرا با فرمان `clickhouse-client`. ``` bash $ clickhouse-client @@ -89,7 +89,7 @@ $ clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = ``` - `name` — Placeholder identifier. In the console client it should be used in app parameters as `--param_ = value`. -- `data type` — [نوع داده](../sql_reference/data_types/index.md) از مقدار پارامتر برنامه. برای مثال یک ساختار داده مانند `(integer, ('string', integer))` می تواند داشته باشد `Tuple(UInt8, Tuple(String, UInt8))` نوع داده (شما همچنین می توانید از یکی دیگر استفاده کنید [عدد صحیح](../sql_reference/data_types/int_uint.md) انواع). +- `data type` — [نوع داده](../sql-reference/data-types/index.md) از مقدار پارامتر برنامه. برای مثال یک ساختار داده مانند `(integer, ('string', integer))` می تواند داشته باشد `Tuple(UInt8, Tuple(String, UInt8))` نوع داده (شما همچنین می توانید از یکی دیگر استفاده کنید [عدد صحیح](../sql-reference/data-types/int-uint.md) انواع). #### مثال {#example} diff --git a/docs/fa/interfaces/formats.md b/docs/fa/interfaces/formats.md index a39fee6c45f..8881c2a20a2 100644 --- a/docs/fa/interfaces/formats.md +++ b/docs/fa/interfaces/formats.md @@ -111,9 +111,9 @@ world ارریس به عنوان یک لیست از ارزش کاما از هم جدا در براکت مربع نوشته شده است. موارد شماره در مجموعه به طور معمول فرمت می شوند. `Date` و `DateTime` انواع در نقل قول تک نوشته شده است. رشته ها در نقل قول های تک با قوانین فرار همان بالا نوشته شده است. -[NULL](../sql_reference/syntax.md) به عنوان فرمت `\N`. +[NULL](../sql-reference/syntax.md) به عنوان فرمت `\N`. -هر عنصر [تو در تو](../sql_reference/data_types/nested_data_structures/nested.md) سازه ها به عنوان مجموعه ای نشان داده شده است. +هر عنصر [تو در تو](../sql-reference/data-types/nested-data-structures/nested.md) سازه ها به عنوان مجموعه ای نشان داده شده است. به عنوان مثال: @@ -333,7 +333,7 @@ SearchPhrase=curtain designs count()=1064 SearchPhrase=baku count()=1000 ``` -[NULL](../sql_reference/syntax.md) به عنوان فرمت `\N`. +[NULL](../sql-reference/syntax.md) به عنوان فرمت `\N`. ``` sql SELECT * FROM t_null FORMAT TSKV @@ -465,7 +465,7 @@ SELECT SearchPhrase, count() AS c FROM test.hits GROUP BY SearchPhrase WITH TOTA این فرمت فقط برای خروجی یک نتیجه پرس و جو مناسب است, اما نه برای تجزیه (بازیابی اطلاعات برای وارد کردن در یک جدول). -پشتیبانی از کلیک [NULL](../sql_reference/syntax.md), است که به عنوان نمایش داده `null` در خروجی جانسون. +پشتیبانی از کلیک [NULL](../sql-reference/syntax.md), است که به عنوان نمایش داده `null` در خروجی جانسون. همچنین نگاه کنید به [جیسانچرو](#jsoneachrow) قالب. @@ -542,7 +542,7 @@ INSERT INTO UserActivity FORMAT JSONEachRow {"PageViews":5, "UserID":"4324182021 **حذف پردازش مقادیر** -را کلیک کنید جایگزین مقادیر حذف شده با مقادیر پیش فرض برای مربوطه [انواع داده ها](../sql_reference/data_types/index.md). +را کلیک کنید جایگزین مقادیر حذف شده با مقادیر پیش فرض برای مربوطه [انواع داده ها](../sql-reference/data-types/index.md). اگر `DEFAULT expr` مشخص شده است, تاتر با استفاده از قوانین تعویض مختلف بسته به [\_پوشه های ورودی و خروجی](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) تنظیمات. @@ -587,7 +587,7 @@ CREATE TABLE IF NOT EXISTS example_table ### استفاده از ساختارهای تو در تو {#jsoneachrow-nested} -اگر شما یک جدول با [تو در تو](../sql_reference/data_types/nested_data_structures/nested.md) ستون نوع داده, شما می توانید داده های جانسون با همان ساختار وارد. فعال کردن این ویژگی با [تغییر \_کم\_تر\_تنظیم مجدد \_جنسان](../operations/settings/settings.md#settings-input_format_import_nested_json) تنظیمات. +اگر شما یک جدول با [تو در تو](../sql-reference/data-types/nested-data-structures/nested.md) ستون نوع داده, شما می توانید داده های جانسون با همان ساختار وارد. فعال کردن این ویژگی با [تغییر \_کم\_تر\_تنظیم مجدد \_جنسان](../operations/settings/settings.md#settings-input_format_import_nested_json) تنظیمات. برای مثال جدول زیر را در نظر بگیرید: @@ -646,7 +646,7 @@ SELECT * FROM json_each_row_nested ## بومی {#native} -فرمت موثر ترین. داده ها توسط بلوک ها در فرمت باینری نوشته شده و خوانده می شوند. برای هر بلوک, تعداد ردیف, تعداد ستون, نام ستون و انواع, و بخش هایی از ستون ها در این بلوک یکی پس از دیگری ثبت. به عبارت دیگر این قالب است “columnar” – it doesn't convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. +فرمت موثر ترین. داده ها توسط بلوک ها در فرمت باینری نوشته شده و خوانده می شوند. برای هر بلوک, تعداد ردیف, تعداد ستون, نام ستون و انواع, و بخش هایی از ستون ها در این بلوک یکی پس از دیگری ثبت. به عبارت دیگر این قالب است “columnar” – it doesn’t convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. شما می توانید این فرمت را به سرعت تولید افسردگی است که تنها می تواند توسط سندرم تونل کارپ به عنوان خوانده شده استفاده کنید. این حس برای کار با این فرمت خود را ندارد. @@ -661,7 +661,7 @@ SELECT * FROM json_each_row_nested یک شبکه کامل از جدول کشیده شده است, و هر سطر را اشغال دو خط در ترمینال. هر بلوک نتیجه خروجی به عنوان یک جدول جداگانه است. این لازم است به طوری که بلوک می تواند خروجی بدون نتیجه بافر (بافر می شود به منظور قبل از محاسبه عرض قابل مشاهده از تمام مقادیر لازم). -[NULL](../sql_reference/syntax.md) خروجی به عنوان `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) خروجی به عنوان `ᴺᵁᴸᴸ`. مثال (نشان داده شده برای [پیش تیمار](#prettycompact) قالب): @@ -765,7 +765,7 @@ $ watch -n1 "clickhouse-client --query='SELECT event, value FROM system.events F اری به عنوان یک طول ورینت (بدون علامت) نشان داده شده است [LEB128](https://en.wikipedia.org/wiki/LEB128)), پس از عناصر پی در پی از مجموعه. -برای [NULL](../sql_reference/syntax.md#null-literal) حمایت کردن, یک بایت اضافی حاوی 1 یا 0 قبل از هر اضافه [Nullable](../sql_reference/data_types/nullable.md) ارزش. اگر 1, سپس ارزش است `NULL` و این بایت به عنوان یک مقدار جداگانه تفسیر. اگر 0, ارزش پس از بایت است `NULL`. +برای [NULL](../sql-reference/syntax.md#null-literal) حمایت کردن, یک بایت اضافی حاوی 1 یا 0 قبل از هر اضافه [Nullable](../sql-reference/data-types/nullable.md) ارزش. اگر 1, سپس ارزش است `NULL` و این بایت به عنوان یک مقدار جداگانه تفسیر. اگر 0, ارزش پس از بایت است `NULL`. ## ارزشهای خبری عبارتند از: {#rowbinarywithnamesandtypes} @@ -777,7 +777,7 @@ $ watch -n1 "clickhouse-client --query='SELECT event, value FROM system.events F ## مقادیر {#data-format-values} -چاپ هر سطر در براکت. ردیف ها توسط کاما جدا می شوند. بعد از ردیف گذشته هیچ کاما وجود ندارد. مقادیر داخل براکت نیز با کاما از هم جدا هستند. اعداد خروجی در قالب اعشاری بدون نقل قول هستند. ارریس خروجی در براکت مربع است. رشته, تاریخ, و تاریخ با زمان خروجی در نقل قول. فرار قوانین و تجزیه شبیه به [جدول دار](#tabseparated) قالب. در قالب بندی فضاهای اضافی وارد نشده اند اما در طول تجزیه مجاز و نادیده گرفته می شوند (به جز فضاهای درون مقادیر مجموعه ای که مجاز نیستند). [NULL](../sql_reference/syntax.md) به عنوان نمایندگی `NULL`. +چاپ هر سطر در براکت. ردیف ها توسط کاما جدا می شوند. بعد از ردیف گذشته هیچ کاما وجود ندارد. مقادیر داخل براکت نیز با کاما از هم جدا هستند. اعداد خروجی در قالب اعشاری بدون نقل قول هستند. ارریس خروجی در براکت مربع است. رشته, تاریخ, و تاریخ با زمان خروجی در نقل قول. فرار قوانین و تجزیه شبیه به [جدول دار](#tabseparated) قالب. در قالب بندی فضاهای اضافی وارد نشده اند اما در طول تجزیه مجاز و نادیده گرفته می شوند (به جز فضاهای درون مقادیر مجموعه ای که مجاز نیستند). [NULL](../sql-reference/syntax.md) به عنوان نمایندگی `NULL`. The minimum set of characters that you need to escape when passing data in Values ​​format: single quotes and backslashes. @@ -789,7 +789,7 @@ The minimum set of characters that you need to escape when passing data in Value چاپ هر مقدار در یک خط جداگانه با نام ستون مشخص. این فرمت مناسب برای چاپ فقط یک یا چند ردیف است اگر هر سطر شامل تعداد زیادی از ستون. -[NULL](../sql_reference/syntax.md) خروجی به عنوان `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) خروجی به عنوان `ᴺᵁᴸᴸ`. مثال: @@ -949,7 +949,7 @@ message MessageType { }; ``` -برای پیدا کردن مکاتبات بین ستون های جدول و زمینه های بافر پروتکل' نوع پیام تاتر نام خود را مقایسه می کند. +برای پیدا کردن مکاتبات بین ستون های جدول و زمینه های بافر پروتکل’ نوع پیام تاتر نام خود را مقایسه می کند. این مقایسه غیر حساس به حروف و شخصیت است `_` هشدار داده می شود `.` (نقطه) به عنوان برابر در نظر گرفته. اگر نوع ستون و زمینه پیام بافر پروتکل متفاوت تبدیل لازم اعمال می شود. @@ -968,7 +968,7 @@ message MessageType { ``` تاتر تلاش می کند برای پیدا کردن یک ستون به نام `x.y.z` (یا `x_y_z` یا `X.y_Z` و به همین ترتیب). -پیام های تو در تو مناسب برای ورودی یا خروجی هستند [ساختارهای داده تو در تو](../sql_reference/data_types/nested_data_structures/nested.md). +پیام های تو در تو مناسب برای ورودی یا خروجی هستند [ساختارهای داده تو در تو](../sql-reference/data-types/nested-data-structures/nested.md). مقادیر پیش فرض تعریف شده در یک طرح اولیه مانند این @@ -980,7 +980,7 @@ message MessageType { } ``` -اعمال نمی شود [پیشفرضهای جدول](../sql_reference/statements/create.md#create-default-values) به جای اونها استفاده میشه +اعمال نمی شود [پیشفرضهای جدول](../sql-reference/statements/create.md#create-default-values) به جای اونها استفاده میشه ClickHouse ورودی و خروجی protobuf پیام در `length-delimited` قالب. این بدان معنی است قبل از هر پیام باید طول خود را به عنوان یک نوشته [ورینت](https://developers.google.com/protocol-buffers/docs/encoding#varints). @@ -994,23 +994,23 @@ ClickHouse ورودی و خروجی protobuf پیام در `length-delimited` ق ### تطبیق انواع داده ها {#data_types-matching} -جدول زیر انواع داده های پشتیبانی شده را نشان می دهد و چگونه با کلیک مطابقت دارند [انواع داده ها](../sql_reference/data_types/index.md) داخل `INSERT` و `SELECT` نمایش داده شد. +جدول زیر انواع داده های پشتیبانی شده را نشان می دهد و چگونه با کلیک مطابقت دارند [انواع داده ها](../sql-reference/data-types/index.md) داخل `INSERT` و `SELECT` نمایش داده شد. | نوع داده اورو `INSERT` | نوع داده کلیک | نوع داده اورو `SELECT` | |---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|------------------------------| -| `boolean`, `int`, `long`, `float`, `double` | [اعضای هیات(8/16/32)](../sql_reference/data_types/int_uint.md), [اوینت (8/16/32)](../sql_reference/data_types/int_uint.md) | `int` | -| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql_reference/data_types/int_uint.md), [UInt64](../sql_reference/data_types/int_uint.md) | `long` | -| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql_reference/data_types/float.md) | `float` | -| `boolean`, `int`, `long`, `float`, `double` | [جسم شناور64](../sql_reference/data_types/float.md) | `double` | -| `bytes`, `string`, `fixed`, `enum` | [رشته](../sql_reference/data_types/string.md) | `bytes` | -| `bytes`, `string`, `fixed` | [رشته ثابت)](../sql_reference/data_types/fixedstring.md) | `fixed(N)` | -| `enum` | [شمارشی (8/16)](../sql_reference/data_types/enum.md) | `enum` | -| `array(T)` | [& توری)](../sql_reference/data_types/array.md) | `array(T)` | -| `union(null, T)`, `union(T, null)` | [Nullable(T)](../sql_reference/data_types/date.md) | `union(null, T)` | -| `null` | [Nullable(هیچ چیز)](../sql_reference/data_types/special_data_types/nothing.md) | `null` | -| `int (date)` \* | [تاریخ](../sql_reference/data_types/date.md) | `int (date)` \* | -| `long (timestamp-millis)` \* | [طول تاریخ 64 (3)](../sql_reference/data_types/datetime.md) | `long (timestamp-millis)` \* | -| `long (timestamp-micros)` \* | [طول تاریخ 64 (6)](../sql_reference/data_types/datetime.md) | `long (timestamp-micros)` \* | +| `boolean`, `int`, `long`, `float`, `double` | [اعضای هیات(8/16/32)](../sql-reference/data-types/int-uint.md), [اوینت (8/16/32)](../sql-reference/data-types/int-uint.md) | `int` | +| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql-reference/data-types/int-uint.md), [UInt64](../sql-reference/data-types/int-uint.md) | `long` | +| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql-reference/data-types/float.md) | `float` | +| `boolean`, `int`, `long`, `float`, `double` | [جسم شناور64](../sql-reference/data-types/float.md) | `double` | +| `bytes`, `string`, `fixed`, `enum` | [رشته](../sql-reference/data-types/string.md) | `bytes` | +| `bytes`, `string`, `fixed` | [رشته ثابت)](../sql-reference/data-types/fixedstring.md) | `fixed(N)` | +| `enum` | [شمارشی (8/16)](../sql-reference/data-types/enum.md) | `enum` | +| `array(T)` | [& توری)](../sql-reference/data-types/array.md) | `array(T)` | +| `union(null, T)`, `union(T, null)` | [Nullable(T)](../sql-reference/data-types/date.md) | `union(null, T)` | +| `null` | [Nullable(هیچ چیز)](../sql-reference/data-types/special-data-types/nothing.md) | `null` | +| `int (date)` \* | [تاریخ](../sql-reference/data-types/date.md) | `int (date)` \* | +| `long (timestamp-millis)` \* | [طول تاریخ 64 (3)](../sql-reference/data-types/datetime.md) | `long (timestamp-millis)` \* | +| `long (timestamp-micros)` \* | [طول تاریخ 64 (6)](../sql-reference/data-types/datetime.md) | `long (timestamp-micros)` \* | \* [انواع منطقی اورو](http://avro.apache.org/docs/current/spec.html#Logical+Types) @@ -1073,7 +1073,7 @@ $ kafkacat -b kafka-broker -C -t topic1 -o beginning -f '%s' -c 3 | clickhouse- 3 c ``` -برای استفاده `AvroConfluent` با [کافکا](../engines/table_engines/integrations/kafka.md): +برای استفاده `AvroConfluent` با [کافکا](../engines/table-engines/integrations/kafka.md): ``` sql CREATE TABLE topic1_stream @@ -1102,25 +1102,25 @@ SELECT * FROM topic1_stream; ### تطبیق انواع داده ها {#data_types-matching-2} -جدول زیر انواع داده های پشتیبانی شده را نشان می دهد و چگونه با کلیک مطابقت دارند [انواع داده ها](../sql_reference/data_types/index.md) داخل `INSERT` و `SELECT` نمایش داده شد. +جدول زیر انواع داده های پشتیبانی شده را نشان می دهد و چگونه با کلیک مطابقت دارند [انواع داده ها](../sql-reference/data-types/index.md) داخل `INSERT` و `SELECT` نمایش داده شد. | نوع داده پارکت (`INSERT`) | نوع داده کلیک | نوع داده پارکت (`SELECT`) | |---------------------------|---------------------------------------------------------|---------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | `UINT8` | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | `INT8` | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | `UINT16` | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | `INT16` | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | `UINT32` | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | `INT32` | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | `UINT64` | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | `INT64` | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | `FLOAT` | -| `DOUBLE` | [جسم شناور64](../sql_reference/data_types/float.md) | `DOUBLE` | -| `DATE32` | [تاریخ](../sql_reference/data_types/date.md) | `UINT16` | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | `UINT32` | -| `STRING`, `BINARY` | [رشته](../sql_reference/data_types/string.md) | `STRING` | -| — | [رشته ثابت](../sql_reference/data_types/fixedstring.md) | `STRING` | -| `DECIMAL` | [دهدهی](../sql_reference/data_types/decimal.md) | `DECIMAL` | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | `UINT8` | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | `INT8` | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | `UINT16` | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | `INT16` | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | `UINT32` | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | `INT32` | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | `UINT64` | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | `INT64` | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | `FLOAT` | +| `DOUBLE` | [جسم شناور64](../sql-reference/data-types/float.md) | `DOUBLE` | +| `DATE32` | [تاریخ](../sql-reference/data-types/date.md) | `UINT16` | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | `UINT32` | +| `STRING`, `BINARY` | [رشته](../sql-reference/data-types/string.md) | `STRING` | +| — | [رشته ثابت](../sql-reference/data-types/fixedstring.md) | `STRING` | +| `DECIMAL` | [دهدهی](../sql-reference/data-types/decimal.md) | `DECIMAL` | کلیک هاوس از دقت قابل تنظیم پشتیبانی می کند `Decimal` نوع. این `INSERT` پرس و جو رفتار پارکت `DECIMAL` نوع به عنوان محل کلیک `Decimal128` نوع. @@ -1142,7 +1142,7 @@ $ cat {filename} | clickhouse-client --query="INSERT INTO {some_table} FORMAT Pa $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_file.pq} ``` -برای تبادل اطلاعات با هادوپ, شما می توانید استفاده کنید [موتور جدول اچ دی اف](../engines/table_engines/integrations/hdfs.md). +برای تبادل اطلاعات با هادوپ, شما می توانید استفاده کنید [موتور جدول اچ دی اف](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} @@ -1150,24 +1150,24 @@ $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_ ### تطبیق انواع داده ها {#data_types-matching-3} -جدول زیر انواع داده های پشتیبانی شده را نشان می دهد و چگونه با کلیک مطابقت دارند [انواع داده ها](../sql_reference/data_types/index.md) داخل `INSERT` نمایش داده شد. +جدول زیر انواع داده های پشتیبانی شده را نشان می دهد و چگونه با کلیک مطابقت دارند [انواع داده ها](../sql-reference/data-types/index.md) داخل `INSERT` نمایش داده شد. | نوع داده اورک (`INSERT`) | نوع داده کلیک | |--------------------------|-----------------------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [جسم شناور64](../sql_reference/data_types/float.md) | -| `DATE32` | [تاریخ](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [رشته](../sql_reference/data_types/string.md) | -| `DECIMAL` | [دهدهی](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [جسم شناور64](../sql-reference/data-types/float.md) | +| `DATE32` | [تاریخ](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [رشته](../sql-reference/data-types/string.md) | +| `DECIMAL` | [دهدهی](../sql-reference/data-types/decimal.md) | تاتر از دقت قابل تنظیم از `Decimal` نوع. این `INSERT` پرس و جو رفتار اورک `DECIMAL` نوع به عنوان محل کلیک `Decimal128` نوع. @@ -1183,7 +1183,7 @@ $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_ $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -برای تبادل اطلاعات با هادوپ, شما می توانید استفاده کنید [موتور جدول اچ دی اف](../engines/table_engines/integrations/hdfs.md). +برای تبادل اطلاعات با هادوپ, شما می توانید استفاده کنید [موتور جدول اچ دی اف](../engines/table-engines/integrations/hdfs.md). ## شمای فرمت {#formatschema} @@ -1199,7 +1199,7 @@ e.g. `schemafile.proto:MessageType`. اگر شما با استفاده از مشتری در [حالت دسته ای](../interfaces/cli.md#cli_usage) مسیر طرح باید به دلایل امنیتی نسبی باشد. اگر داده های ورودی یا خروجی را از طریق [رابط قام](../interfaces/http.md) نام پرونده مشخص شده در شمای قالب -باید در دایرکتوری مشخص شده در واقع [قالب\_شکلمات شیمی](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) +باید در دایرکتوری مشخص شده در واقع [قالب\_شکلمات شیمی](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) در پیکربندی سرور. ## پرش خطاها {#skippingerrors} diff --git a/docs/fa/interfaces/http.md b/docs/fa/interfaces/http.md index 5ba4d4ef789..13148c57af9 100644 --- a/docs/fa/interfaces/http.md +++ b/docs/fa/interfaces/http.md @@ -11,7 +11,7 @@ toc_title: "\u0631\u0627\u0628\u0637 \u0642\u0627\u0645" به طور پیش فرض, کلیک سرور گوش برای اچ تی پی در بندر 8123 (این را می توان در پیکربندی تغییر). -اگر شما یک دریافت / درخواست بدون پارامتر, باز می گردد 200 کد پاسخ و رشته که در تعریف [نقلقولهای جدید از این نویسنده](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-http_server_default_response) مقدار پیشفرض “Ok.” (با خوراک خط در پایان) +اگر شما یک دریافت / درخواست بدون پارامتر, باز می گردد 200 کد پاسخ و رشته که در تعریف [نقلقولهای جدید از این نویسنده](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-http_server_default_response) مقدار پیشفرض “Ok.” (با خوراک خط در پایان) ``` bash $ curl 'http://localhost:8123/' diff --git a/docs/fa/interfaces/index.md b/docs/fa/interfaces/index.md index 900e176f77d..22e9a05ddfa 100644 --- a/docs/fa/interfaces/index.md +++ b/docs/fa/interfaces/index.md @@ -22,7 +22,7 @@ toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" همچنین طیف گسترده ای از کتابخانه های شخص ثالث برای کار با کلیک وجود دارد: -- [کتابخانه های مشتری](third-party/client_libraries.md) +- [کتابخانه های مشتری](third-party/client-libraries.md) - [یکپارچگی](third-party/integrations.md) - [رابط های بصری](third-party/gui.md) diff --git a/docs/fa/interfaces/mysql.md b/docs/fa/interfaces/mysql.md index 1d9f3669acd..14d409873ae 100644 --- a/docs/fa/interfaces/mysql.md +++ b/docs/fa/interfaces/mysql.md @@ -7,7 +7,7 @@ toc_title: "\u0631\u0627\u0628\u0637 MySQL" # رابط خروجی زیر {#mysql-interface} -کلیک پروتکل سیم خروجی زیر را پشتیبانی می کند. این را می توان با فعال [\_وارد کردن](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) تنظیم در پرونده پیکربندی: +کلیک پروتکل سیم خروجی زیر را پشتیبانی می کند. این را می توان با فعال [\_وارد کردن](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) تنظیم در پرونده پیکربندی: ``` xml 9004 @@ -37,8 +37,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -برای سازگاری با تمام مشتریان خروجی زیر, توصیه می شود برای مشخص کردن رمز عبور کاربر با [دو شی1](../operations/settings/settings_users.md#password_double_sha1_hex) در فایل پیکربندی. -اگر رمز عبور کاربر مشخص شده است با استفاده از [SHA256](../operations/settings/settings_users.md#password_sha256_hex) برخی از مشتریان قادر نخواهد بود به تصدیق (رمز و نسخه های قدیمی خط فرمان ابزار خروجی زیر). +برای سازگاری با تمام مشتریان خروجی زیر, توصیه می شود برای مشخص کردن رمز عبور کاربر با [دو شی1](../operations/settings/settings-users.md#password_double_sha1_hex) در فایل پیکربندی. +اگر رمز عبور کاربر مشخص شده است با استفاده از [SHA256](../operations/settings/settings-users.md#password_sha256_hex) برخی از مشتریان قادر نخواهد بود به تصدیق (رمز و نسخه های قدیمی خط فرمان ابزار خروجی زیر). محدودیت ها: diff --git a/docs/fa/interfaces/third-party/client_libraries.md b/docs/fa/interfaces/third-party/client-libraries.md similarity index 100% rename from docs/fa/interfaces/third-party/client_libraries.md rename to docs/fa/interfaces/third-party/client-libraries.md diff --git a/docs/fa/interfaces/third-party/integrations.md b/docs/fa/interfaces/third-party/integrations.md index 0ad13d1fd9e..3e297d47ea5 100644 --- a/docs/fa/interfaces/third-party/integrations.md +++ b/docs/fa/interfaces/third-party/integrations.md @@ -42,7 +42,7 @@ toc_title: "\u06CC\u06A9\u067E\u0627\u0631\u0686\u06AF\u06CC" - [نمودار](https://github.com/yandex/graphouse) - [کربن کلیک](https://github.com/lomik/carbon-clickhouse) + - [گرافیت-تاتر](https://github.com/lomik/graphite-clickhouse) - - [گرافیت-چ بهینه ساز](https://github.com/innogames/graphite-ch-optimizer) - بهینه سازی پارتیشن های ریخته شده در [اطلاعات دقیق](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) اگر قوانین از [پیکربندی رولپ](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) می تواند اعمال شود + - [گرافیت-چ بهینه ساز](https://github.com/innogames/graphite-ch-optimizer) - بهینه سازی پارتیشن های ریخته شده در [اطلاعات دقیق](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) اگر قوانین از [پیکربندی رولپ](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) می تواند اعمال شود - [گرافانا](https://grafana.com/) - [فاحشه خانه-گرافانا](https://github.com/Vertamedia/clickhouse-grafana) - [پرومتیوس](https://prometheus.io/) @@ -74,7 +74,7 @@ toc_title: "\u06CC\u06A9\u067E\u0627\u0631\u0686\u06AF\u06CC" - [sqlalchemy-clickhouse](https://github.com/cloudflare/sqlalchemy-clickhouse) (استفاده [اطالعات.کلیک \_شورم](https://github.com/Infinidat/infi.clickhouse_orm)) - [پانداها](https://pandas.pydata.org) - [پانداهاوس](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -82,7 +82,7 @@ toc_title: "\u06CC\u06A9\u067E\u0627\u0631\u0686\u06AF\u06CC" - [خانه روستایی](https://github.com/IMSMWU/RClickhouse) (استفاده [صفحه اصلی](https://github.com/artpaul/clickhouse-cpp)) - جاوا - [هادوپ](http://hadoop.apache.org) - - [سرویس پرداخت درونبرنامهای پلی](https://github.com/jaykelin/clickhouse-hdfs-loader) (استفاده [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [سرویس پرداخت درونبرنامهای پلی](https://github.com/jaykelin/clickhouse-hdfs-loader) (استفاده [JDBC](../../sql-reference/table-functions/jdbc.md)) - اسکالا - [اککا](https://akka.io) - [تاتر-اسکالا-کارفرما](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/fa/introduction/distinctive-features.md b/docs/fa/introduction/distinctive-features.md new file mode 100644 index 00000000000..94ee2ee76fa --- /dev/null +++ b/docs/fa/introduction/distinctive-features.md @@ -0,0 +1,73 @@ +
+ +# ویژگی های برجسته ClickHouse {#wyjgy-hy-brjsth-clickhouse} + +## مدیریت دیتابیس ستون گرای واقعی {#mdyryt-dytbys-stwn-gry-wq-y} + +در یک مدیریت دیتابیس ستون گرای واقعی، هیچ مقداری فضای اضافی برای ذخیره سازی ندارد. برای مثال، این به این معنیست که برای مقادیر، constant-length باید پشتیبانی شوند تا از ذخیره سازی طول مقدار به عنوان یه عدد integer کنار مقدار جلوگیری شود. در این مورد، یک میلیارد مقدار Uint8 باید در واقع در حالت غیرفشرده 1 گیگابایت فضا اشغال کند، در غیراین صورت به شدت بر عملکرد CPU تاثیر میگذارد. این خیلی مهم هست که داده ها به صورت compact ذخیره سازی شوند حتی زمانی که uncompressed هستند، از آنجا که سرعت سرعت decompress (CPU Usage) عمدتا به حجم داده های uncompress بستگی دارد. + +این بسیار قابل توجه است چون سیستم هایی وجود دارند که توانایی ذخیره سازی مقادیر ستون ها را به صورت جداگانه دارند، اما به دلیل بهینه سازی آنها برای دیگر سناریو ها، نمیتوانند به طور موثر پردازش های تحیلی انجام دهند. برای مثال HBase، BigTable، Cassandra و HyperTable. در این سیستم ها، شما توان عملیاتی حدود صدها هزار سطر در ثانیه را دارید، اما نه صدها میلیون سطر در ثانیه. + +همچنین توجه داشته باشید که ClickHouse یک مدیریت دیتابیس است نه فقط یک دیتابیس. ClickHouse اجازه میدهد که در زمان اجرا اقدام به ساخت جدول، دیتابیس کنید، داده load کنید و query های خود را بدون restart و یا reconfigure مجدد سرور، اجرا کنید + +## فشرده سازی داده ها {#fshrdh-szy-ddh-h} + +بعضی دیتابیس های ستون گرا (InfiniDB CE یا MonetDB) از فشرده سازی داده ها استفاده نمی کنند. با این حال، فشرده سازی داده ها برای رسیدن به عملکرد عالی ضروری است. + +## Disk Storage of Data {#disk-storage-of-data} + +خیلی از مدیریت دیتابیس های ستون گرا (مثل SAP HANA و Google PowerDrill) فقط داخل RAM کار می کنند. این رویکرد منجر به تخصیص بودجه سخت افزاری بالا برای تحقق آنالیز های real-time می شود. ClickHouse برای کار بر روی هارد دیسک های معمولی طراحی شده است، که هزینه ی برای هر گیگابایت داده را تضمین می کند، اما اگر SSD و RAM موجود باشد به طور کامل مورد استفاده قرار می گیرد. + +## پردازش موازی روی چندین هسته {#prdzsh-mwzy-rwy-chndyn-hsth} + +query های بزرگ به طور طبیعی با استفاده از تمام منابع موجود در روی سرور فعلی، موازی سازی می شوند. + +## پردازش توزیع شده بر روی چندین سرور {#prdzsh-twzy-shdh-br-rwy-chndyn-srwr} + +تقریبا هیچ کدام از DBMS هایی که بالاتر ذکر شد، از اجرای query ها به صورت توزیع شده پشتیبانی نمی کنند. در ClickHouse، داده ها می توانن در shard های مختلف مستقر شوند. هر shard میتوامند گروهی از replica ها برای بالا بردن تحمل پذیری در برابر خطا (fault tolerance) را داشته باشد. یک query به صورت موازی بر روی تمامی shard های اجرا می شود. این برای کاربر شفاف است. + +## پشتیبانی SQL {#pshtybny-sql} + +اگر شما با SQL آشنا باشید، ما واقعا نمیتونیم در مورد پشتیبانی از SQL صحبت کنیم. تمام توابع اسم های مختلفی دارند. با این حال، این یک زبان بر پایه SQL هست که نمیتواند در بسیاری از موارد با SQL متفاوت باشد. JOIN ها پشتیبانی می شود. subquery ها در FROM، IN و JOIN پشتیبانی می شود. Dependent subquery ها پشتیبانی نمی شود. + +ClickHouse زبان بر پایه SQL است که در بسیاری از موارد از استاندارد SQL پیروی می کند. GROUP BY، ORDER BY، scalar subquery ها در FROM، IN و JOIN پشتیبانی می شود. subquery های مرتبط و window function ها پشتیبانی نمی شود. + +## موتور بردارد {#mwtwr-brdrd} + +داده ها نه فقط براساس ستون ها ذخیره می شوند، بلکه با استفاده از برداردها (بخشی از ستون ها) پردازش می شوند. این قابلیت باعث رسیدن به بهره وری بالای CPU می شود. + +## بروزرسانی داده ها به صورت Real-Time {#brwzrsny-ddh-h-bh-swrt-real-time} + +ClickHouse از جداول دارای Primary Key پشتیبانی می کند. به منظور اجرای query های range بر روی Primary Key، داده ها به صورت افزایشی (مرتب شده) با استفاده از merge tree ذخیره سازی می شوند. با توجه به این، داده ها می توانند به طور پیوسته به جدول اضافه شوند. هیچ نوع lock در هنگام مصرف داده ها وجود ندارد. + +## Index {#index} + +داشتن داده ها به صورت فیزیکی و مرتب شده براساس Primary Key این قابلیت را می دهد که استخراج کردن داده برای مقدار خاص و یا مقادیر range با کمترین latencey، یعنی کمتر از چند هزار میلی ثانیه ممکن شود. + +## مناسب برای query های آنلاین {#mnsb-bry-query-hy-anlyn} + +latency پایین به این معنی است که query ها بتونن بدون delay و بدون تلاش برای رسیدن به پیش پاسخ(از قبل محاسبه شده) دقیقا در همان لحظه که کاربر در حال load صفحه است پردازش شوند. به عبارتی دیگر، آنلاین + +## پشتیبانی از محاسبات تقریبی {#pshtybny-z-mhsbt-tqryby} + +ClickHouse روش های مختلفی برای کسب دقیق performance ارائه می دهد: + +1. توابع Aggregate برای محاسبات تقریبی تعداد مقادیر متمایز (distinct)، median و quantity ها +2. اجرای یک query بر پایه بخشی از داده ها (داده ی sample) و دریافت خروجی تقریبی. در این مورد داده ی نسبتا کمتری از دیسک بازیابی می شود. +3. اجرای یک Aggregation برای تعداد محدودی از کلید های تصافی، به جای تمام کلید ها. در شرایط خاص برای توزیع کلید در داده ها، این روش کمک می کند به نتایج منطقی برسیم با استفاده از منابع کمتر. + +## Replication داده ها و Integrity {#replication-ddh-h-w-integrity} + +ClickHouse از روش asynchronous multimaster replication استفاده می کند. بعد از نوشتن داده در یکی از replica های موجود، داده به صورت توزیع شده به بقیه replica ها منتقل می شود. این سیستم داده های مشابه را در replica های مختلف نگه داری می کند. در اکثر موارد که سیستم fail می شوند، داده ها به صورت اتوماتیک restore می شوند و یا در موارد پیچیده به صورت نیمه اتوماتیک restore می شوند. + +برای اطلاعات بیشتر، به بخش [replication داده ها](../engines/table-engines/mergetree-family/replication.md) مراجعه کنید. + +## ویژگی های از ClickHouse که می تواند معایبی باشد {#wyjgy-hy-z-clickhouse-khh-my-twnd-m-yby-bshd} + +1. بدون پشتیبانی کامل از تراکنش +2. عدم توانایی برای تغییر و یا حذف داده های در حال حاضر وارد شده با سرعت بالا و تاخیر کم. برای پاک کردن و یا اصلاح داده ها، به عنوان مثال برای پیروی از [GDPR](https://gdpr-info.eu)، دسته ای پاک و به روزرسانی وجود دارد.حال توسعه می باشد. +3. Sparse index باعث می شود ClickHouse چندان مناسب اجرای پرسمان های point query برای دریافت یک ردیف از داده ها با استفاده از کلید آنها نباشد. + +
+ +[مقاله اصلی](https://clickhouse.tech/docs/fa/introduction/distinctive_features/) diff --git a/docs/fa/introduction/distinctive_features.md b/docs/fa/introduction/distinctive_features.md deleted file mode 100644 index 71a8f3eb543..00000000000 --- a/docs/fa/introduction/distinctive_features.md +++ /dev/null @@ -1,73 +0,0 @@ -
- -# ویژگی های برجسته ClickHouse {#wyjgy-hy-brjsth-clickhouse} - -## مدیریت دیتابیس ستون گرای واقعی {#mdyryt-dytbys-stwn-gry-wq-y} - -در یک مدیریت دیتابیس ستون گرای واقعی، هیچ مقداری فضای اضافی برای ذخیره سازی ندارد. برای مثال، این به این معنیست که برای مقادیر، constant-length باید پشتیبانی شوند تا از ذخیره سازی طول مقدار به عنوان یه عدد integer کنار مقدار جلوگیری شود. در این مورد، یک میلیارد مقدار Uint8 باید در واقع در حالت غیرفشرده 1 گیگابایت فضا اشغال کند، در غیراین صورت به شدت بر عملکرد CPU تاثیر میگذارد. این خیلی مهم هست که داده ها به صورت compact ذخیره سازی شوند حتی زمانی که uncompressed هستند، از آنجا که سرعت سرعت decompress (CPU Usage) عمدتا به حجم داده های uncompress بستگی دارد. - -این بسیار قابل توجه است چون سیستم هایی وجود دارند که توانایی ذخیره سازی مقادیر ستون ها را به صورت جداگانه دارند، اما به دلیل بهینه سازی آنها برای دیگر سناریو ها، نمیتوانند به طور موثر پردازش های تحیلی انجام دهند. برای مثال HBase، BigTable، Cassandra و HyperTable. در این سیستم ها، شما توان عملیاتی حدود صدها هزار سطر در ثانیه را دارید، اما نه صدها میلیون سطر در ثانیه. - -همچنین توجه داشته باشید که ClickHouse یک مدیریت دیتابیس است نه فقط یک دیتابیس. ClickHouse اجازه میدهد که در زمان اجرا اقدام به ساخت جدول، دیتابیس کنید، داده load کنید و query های خود را بدون restart و یا reconfigure مجدد سرور، اجرا کنید - -## فشرده سازی داده ها {#fshrdh-szy-ddh-h} - -بعضی دیتابیس های ستون گرا (InfiniDB CE یا MonetDB) از فشرده سازی داده ها استفاده نمی کنند. با این حال، فشرده سازی داده ها برای رسیدن به عملکرد عالی ضروری است. - -## Disk storage of data {#disk-storage-of-data} - -خیلی از مدیریت دیتابیس های ستون گرا (مثل SAP HANA و Google PowerDrill) فقط داخل RAM کار می کنند. این رویکرد منجر به تخصیص بودجه سخت افزاری بالا برای تحقق آنالیز های real-time می شود. ClickHouse برای کار بر روی هارد دیسک های معمولی طراحی شده است، که هزینه ی برای هر گیگابایت داده را تضمین می کند، اما اگر SSD و RAM موجود باشد به طور کامل مورد استفاده قرار می گیرد. - -## پردازش موازی روی چندین هسته {#prdzsh-mwzy-rwy-chndyn-hsth} - -query های بزرگ به طور طبیعی با استفاده از تمام منابع موجود در روی سرور فعلی، موازی سازی می شوند. - -## پردازش توزیع شده بر روی چندین سرور {#prdzsh-twzy-shdh-br-rwy-chndyn-srwr} - -تقریبا هیچ کدام از DBMS هایی که بالاتر ذکر شد، از اجرای query ها به صورت توزیع شده پشتیبانی نمی کنند. در ClickHouse، داده ها می توانن در shard های مختلف مستقر شوند. هر shard میتوامند گروهی از replica ها برای بالا بردن تحمل پذیری در برابر خطا (fault tolerance) را داشته باشد. یک query به صورت موازی بر روی تمامی shard های اجرا می شود. این برای کاربر شفاف است. - -## پشتیبانی SQL {#pshtybny-sql} - -اگر شما با SQL آشنا باشید، ما واقعا نمیتونیم در مورد پشتیبانی از SQL صحبت کنیم. تمام توابع اسم های مختلفی دارند. با این حال، این یک زبان بر پایه SQL هست که نمیتواند در بسیاری از موارد با SQL متفاوت باشد. JOIN ها پشتیبانی می شود. subquery ها در FROM، IN و JOIN پشتیبانی می شود. Dependent subquery ها پشتیبانی نمی شود. - -ClickHouse زبان بر پایه SQL است که در بسیاری از موارد از استاندارد SQL پیروی می کند. GROUP BY، ORDER BY، scalar subquery ها در FROM، IN و JOIN پشتیبانی می شود. subquery های مرتبط و window function ها پشتیبانی نمی شود. - -## موتور بردارد {#mwtwr-brdrd} - -داده ها نه فقط براساس ستون ها ذخیره می شوند، بلکه با استفاده از برداردها (بخشی از ستون ها) پردازش می شوند. این قابلیت باعث رسیدن به بهره وری بالای CPU می شود. - -## بروزرسانی داده ها به صورت Real-Time {#brwzrsny-ddh-h-bh-swrt-real-time} - -ClickHouse از جداول دارای Primary Key پشتیبانی می کند. به منظور اجرای query های range بر روی Primary Key، داده ها به صورت افزایشی (مرتب شده) با استفاده از merge tree ذخیره سازی می شوند. با توجه به این، داده ها می توانند به طور پیوسته به جدول اضافه شوند. هیچ نوع lock در هنگام مصرف داده ها وجود ندارد. - -## Index {#index} - -داشتن داده ها به صورت فیزیکی و مرتب شده براساس Primary Key این قابلیت را می دهد که استخراج کردن داده برای مقدار خاص و یا مقادیر range با کمترین latencey، یعنی کمتر از چند هزار میلی ثانیه ممکن شود. - -## مناسب برای query های آنلاین {#mnsb-bry-query-hy-anlyn} - -latency پایین به این معنی است که query ها بتونن بدون delay و بدون تلاش برای رسیدن به پیش پاسخ(از قبل محاسبه شده) دقیقا در همان لحظه که کاربر در حال load صفحه است پردازش شوند. به عبارتی دیگر، آنلاین - -## پشتیبانی از محاسبات تقریبی {#pshtybny-z-mhsbt-tqryby} - -ClickHouse روش های مختلفی برای کسب دقیق performance ارائه می دهد: - -1. توابع Aggregate برای محاسبات تقریبی تعداد مقادیر متمایز (distinct)، median و quantity ها -2. اجرای یک query بر پایه بخشی از داده ها (داده ی sample) و دریافت خروجی تقریبی. در این مورد داده ی نسبتا کمتری از دیسک بازیابی می شود. -3. اجرای یک Aggregation برای تعداد محدودی از کلید های تصافی، به جای تمام کلید ها. در شرایط خاص برای توزیع کلید در داده ها، این روش کمک می کند به نتایج منطقی برسیم با استفاده از منابع کمتر. - -## Replication داده ها و integrity {#replication-ddh-h-w-integrity} - -ClickHouse از روش asynchronous multimaster replication استفاده می کند. بعد از نوشتن داده در یکی از replica های موجود، داده به صورت توزیع شده به بقیه replica ها منتقل می شود. این سیستم داده های مشابه را در replica های مختلف نگه داری می کند. در اکثر موارد که سیستم fail می شوند، داده ها به صورت اتوماتیک restore می شوند و یا در موارد پیچیده به صورت نیمه اتوماتیک restore می شوند. - -برای اطلاعات بیشتر، به بخش [replication داده ها](../engines/table_engines/mergetree_family/replication.md) مراجعه کنید. - -## ویژگی های از ClickHouse که می تواند معایبی باشد. {#wyjgy-hy-z-clickhouse-khh-my-twnd-m-yby-bshd} - -1. بدون پشتیبانی کامل از تراکنش -2. عدم توانایی برای تغییر و یا حذف داده های در حال حاضر وارد شده با سرعت بالا و تاخیر کم. برای پاک کردن و یا اصلاح داده ها، به عنوان مثال برای پیروی از [GDPR](https://gdpr-info.eu)، دسته ای پاک و به روزرسانی وجود دارد.حال توسعه می باشد. -3. Sparse index باعث می شود ClickHouse چندان مناسب اجرای پرسمان های point query برای دریافت یک ردیف از داده ها با استفاده از کلید آنها نباشد. - -
- -[مقاله اصلی](https://clickhouse.tech/docs/fa/introduction/distinctive_features/) diff --git a/docs/fa/introduction/performance.md b/docs/fa/introduction/performance.md index 8fa65ad1bb5..497f84e1958 100644 --- a/docs/fa/introduction/performance.md +++ b/docs/fa/introduction/performance.md @@ -1,4 +1,4 @@ -
+
# Performance {#performance} @@ -12,7 +12,7 @@ benchmark های زیادی وجود دارند که این نتایج را تا سرعت پردازش در سرویس توزیع شده تقریبا به صورت خطی افزایش پیدا می کند، اما فقط وقتی که نتایج سطرهای به دست آمده از aggeration یا مرتب سازی زیاد بزرگ نباشند. -## Latency در زمان پردازش query های کوتاه {#latency-dr-zmn-prdzsh-query-hy-khwth} +## Latency در زمان پردازش Query های کوتاه {#latency-dr-zmn-prdzsh-query-hy-khwth} اگر یک query از Primary Key استفاده کند و تعداد زیادی از سطر ها را برای پردازش select نکند (صدها هزار)، و از تعداد زیادی ستون استفاده نکند،اگر داده ها در page cache قرار داشته باشند، ما میتوانیم انتظار latency کمتر از 50 میلی ثانیه را داشته باشیم. در غیر این صورت محاسبه زمان براساس تعداد seek ها انجام خواهد گرفت. اگر شما از هارد های دیسکی استفاده می کنید، برای سیستمی که overload ندارد، محاسبه تقریبی latency با استفاده از این فرمول ممکن است: زمان seek (10 ms) \* تعداد ستون های مورد نیاز در query \* تعداد قطعات داده diff --git a/docs/fa/operations/access-rights.md b/docs/fa/operations/access-rights.md new file mode 100644 index 00000000000..41e97d4d711 --- /dev/null +++ b/docs/fa/operations/access-rights.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 48 +toc_title: "\u062D\u0642\u0648\u0642 \u062F\u0633\u062A\u0631\u0633\u06CC" +--- + +# حقوق دسترسی {#access-rights} + +کاربران و حقوق دسترسی هستند تا در پیکربندی کاربر تنظیم شده است. این است که معمولا `users.xml`. + +کاربران در ثبت `users` بخش. در اینجا یک قطعه از است `users.xml` پرونده: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + + test + + + +``` + +شما می توانید اعلامیه ای از دو کاربر را ببینید: `default`و`web`. ما اضافه کردیم `web` کاربر به طور جداگانه. + +این `default` کاربر در مواردی که نام کاربری تصویب نشده است انتخاب شده است. این `default` کاربر همچنین برای پردازش پرس و جو توزیع شده استفاده می شود, اگر پیکربندی سرور یا خوشه می کند مشخص نیست `user` و `password` (نگاه کنید به بخش در [توزیع شده](../engines/table-engines/special/distributed.md) موتور). + +The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. + +رمز عبور در متن روشن مشخص (توصیه نمی شود) و یا در شا 256. هش شور نیست. در این راستا نباید این رمزهای عبور را به عنوان امنیت در برابر حملات مخرب بالقوه در نظر بگیرید. بلکه لازم است برای حفاظت از کارکنان. + +یک لیست از شبکه مشخص شده است که دسترسی از اجازه. در این مثال لیستی از شبکه ها برای هر دو کاربران لود شده از یک فایل جداگانه (`/etc/metrika.xml`) حاوی `networks` جایگزینی. در اینجا یک قطعه است: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +شما می توانید این لیست از شبکه به طور مستقیم در تعریف `users.xml` یا در یک فایل در `users.d` فهرست راهنما (برای اطلاعات بیشتر, بخش را ببینید “[پروندههای پیکربندی](configuration-files.md#configuration_files)”). + +پیکربندی شامل نظرات توضیح میدهد که چگونه برای باز کردن دسترسی از همه جا. + +برای استفاده در تولید فقط مشخص کنید `ip` عناصر (نشانی اینترنتی و ماسک خود را), از زمان استفاده از `host` و `hoost_regexp` ممکن است تاخیر اضافی شود. + +بعد مشخصات تنظیمات کاربر مشخص شده است (بخش را ببینید “[پروفایل تنظیمات](settings/settings-profiles.md)”. شما می توانید مشخصات پیش فرض را مشخص کنید, `default'`. مشخصات می توانید هر نام دارند. شما می توانید مشخصات مشابه برای کاربران مختلف را مشخص کنید. مهم ترین چیز شما می توانید در مشخصات تنظیمات ارسال شده است `readonly=1`, که تضمین می کند فقط خواندنی دسترسی. سپس سهمیه مشخص مورد استفاده قرار گیرد (بخش را ببینید “[سهمیه](quotas.md#quotas)”). شما می توانید سهمیه پیش فرض را مشخص کنید: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. + +در اختیاری `` بخش, شما همچنین می توانید یک لیست از پایگاه داده که کاربر می تواند دسترسی مشخص. به طور پیش فرض تمام پایگاه های داده در دسترس کاربر هستند. شما می توانید مشخص کنید `default` پایگاه داده است. در این مورد, کاربر دسترسی به پایگاه داده به طور پیش فرض دریافت. + +در اختیاری `` بخش, شما همچنین می توانید یک لیست از لغت نامه که کاربر می تواند دسترسی مشخص. به طور پیش فرض تمام لغت نامه ها برای کاربر در دسترس هستند. + +دسترسی به `system` پایگاه داده همیشه مجاز (از این پایگاه داده برای پردازش نمایش داده شد استفاده می شود). + +کاربر می تواند لیستی از تمام پایگاه های داده و جداول را با استفاده از `SHOW` نمایش داده شد و یا جداول سیستم, حتی اگر دسترسی به پایگاه داده های فردی مجاز نیست. + +دسترسی به پایگاه داده به [فقط خواندنی](settings/permissions-for-queries.md#settings_readonly) تنظیمات. شما نمی توانید دسترسی کامل به یک پایگاه داده و `readonly` دسترسی به یکی دیگر. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/fa/operations/access_rights.md b/docs/fa/operations/access_rights.md deleted file mode 100644 index 2ad006e0fcf..00000000000 --- a/docs/fa/operations/access_rights.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 48 -toc_title: "\u062D\u0642\u0648\u0642 \u062F\u0633\u062A\u0631\u0633\u06CC" ---- - -# حقوق دسترسی {#access-rights} - -کاربران و حقوق دسترسی هستند تا در پیکربندی کاربر تنظیم شده است. این است که معمولا `users.xml`. - -کاربران در ثبت `users` بخش. در اینجا یک قطعه از است `users.xml` پرونده: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - - test - - - -``` - -شما می توانید اعلامیه ای از دو کاربر را ببینید: `default`و`web`. ما اضافه کردیم `web` کاربر به طور جداگانه. - -این `default` کاربر در مواردی که نام کاربری تصویب نشده است انتخاب شده است. این `default` کاربر همچنین برای پردازش پرس و جو توزیع شده استفاده می شود, اگر پیکربندی سرور یا خوشه می کند مشخص نیست `user` و `password` (نگاه کنید به بخش در [توزیع شده](../engines/table_engines/special/distributed.md) موتور). - -The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. - -رمز عبور در متن روشن مشخص (توصیه نمی شود) و یا در شا 256. هش شور نیست. در این راستا نباید این رمزهای عبور را به عنوان امنیت در برابر حملات مخرب بالقوه در نظر بگیرید. بلکه لازم است برای حفاظت از کارکنان. - -یک لیست از شبکه مشخص شده است که دسترسی از اجازه. در این مثال لیستی از شبکه ها برای هر دو کاربران لود شده از یک فایل جداگانه (`/etc/metrika.xml`) حاوی `networks` جایگزینی. در اینجا یک قطعه است: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -شما می توانید این لیست از شبکه به طور مستقیم در تعریف `users.xml` یا در یک فایل در `users.d` فهرست راهنما (برای اطلاعات بیشتر, بخش را ببینید “[پروندههای پیکربندی](configuration_files.md#configuration_files)”). - -پیکربندی شامل نظرات توضیح میدهد که چگونه برای باز کردن دسترسی از همه جا. - -برای استفاده در تولید فقط مشخص کنید `ip` عناصر (نشانی اینترنتی و ماسک خود را), از زمان استفاده از `host` و `hoost_regexp` ممکن است تاخیر اضافی شود. - -بعد مشخصات تنظیمات کاربر مشخص شده است (بخش را ببینید “[پروفایل تنظیمات](settings/settings_profiles.md)”. شما می توانید مشخصات پیش فرض را مشخص کنید, `default'`. مشخصات می توانید هر نام دارند. شما می توانید مشخصات مشابه برای کاربران مختلف را مشخص کنید. مهم ترین چیز شما می توانید در مشخصات تنظیمات ارسال شده است `readonly=1`, که تضمین می کند فقط خواندنی دسترسی. سپس سهمیه مشخص مورد استفاده قرار گیرد (بخش را ببینید “[سهمیه](quotas.md#quotas)”). شما می توانید سهمیه پیش فرض را مشخص کنید: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. - -در اختیاری `` بخش, شما همچنین می توانید یک لیست از پایگاه داده که کاربر می تواند دسترسی مشخص. به طور پیش فرض تمام پایگاه های داده در دسترس کاربر هستند. شما می توانید مشخص کنید `default` پایگاه داده است. در این مورد, کاربر دسترسی به پایگاه داده به طور پیش فرض دریافت. - -در اختیاری `` بخش, شما همچنین می توانید یک لیست از لغت نامه که کاربر می تواند دسترسی مشخص. به طور پیش فرض تمام لغت نامه ها برای کاربر در دسترس هستند. - -دسترسی به `system` پایگاه داده همیشه مجاز (از این پایگاه داده برای پردازش نمایش داده شد استفاده می شود). - -کاربر می تواند لیستی از تمام پایگاه های داده و جداول را با استفاده از `SHOW` نمایش داده شد و یا جداول سیستم, حتی اگر دسترسی به پایگاه داده های فردی مجاز نیست. - -دسترسی به پایگاه داده به [فقط خواندنی](settings/permissions_for_queries.md#settings_readonly) تنظیمات. شما نمی توانید دسترسی کامل به یک پایگاه داده و `readonly` دسترسی به یکی دیگر. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/fa/operations/backup.md b/docs/fa/operations/backup.md index 91938fbcba8..eff538a78a9 100644 --- a/docs/fa/operations/backup.md +++ b/docs/fa/operations/backup.md @@ -8,7 +8,7 @@ toc_title: "\u067E\u0634\u062A\u06CC\u0628\u0627\u0646 \u06AF\u06CC\u0631\u06CC # پشتیبان گیری داده ها {#data-backup} -در حالی که [تکرار](../engines/table_engines/mergetree_family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [شما نمی توانید فقط جداول را با یک موتور ادغام مانند حاوی بیش از 50 گیگابایت داده رها کنید](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). با این حال, این پادمان تمام موارد ممکن را پوشش نمی دهد و می تواند دور. +در حالی که [تکرار](../engines/table-engines/mergetree-family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [شما نمی توانید فقط جداول را با یک موتور ادغام مانند حاوی بیش از 50 گیگابایت داده رها کنید](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). با این حال, این پادمان تمام موارد ممکن را پوشش نمی دهد و می تواند دور. به منظور به طور موثر کاهش خطاهای انسانی ممکن است, شما باید با دقت تهیه یک استراتژی برای پشتیبان گیری و بازیابی اطلاعات خود را **در پیش**. @@ -23,7 +23,7 @@ toc_title: "\u067E\u0634\u062A\u06CC\u0628\u0627\u0646 \u06AF\u06CC\u0631\u06CC ## گزارشهای ویژه سیستم پرونده {#filesystem-snapshots} -برخی از سیستم های فایل های محلی قابلیت عکس فوری (به عنوان مثال, [ZFS](https://en.wikipedia.org/wiki/ZFS)), اما ممکن است بهترین انتخاب برای خدمت نمایش داده شد زندگی می کنند. یک راه حل ممکن است برای ایجاد کپی های اضافی با این نوع از سیستم فایل و حذف از [توزیع شده](../engines/table_engines/special/distributed.md) جداول که برای استفاده `SELECT` نمایش داده شد. عکس های فوری در چنین کپی خواهد شد در دسترس از هر گونه نمایش داده شد که تغییر داده ها باشد. به عنوان یک جایزه, این کپی ممکن است تنظیمات سخت افزار خاص با دیسک های بیشتر متصل در هر سرور, خواهد بود که مقرون به صرفه. +برخی از سیستم های فایل های محلی قابلیت عکس فوری (به عنوان مثال, [ZFS](https://en.wikipedia.org/wiki/ZFS)), اما ممکن است بهترین انتخاب برای خدمت نمایش داده شد زندگی می کنند. یک راه حل ممکن است برای ایجاد کپی های اضافی با این نوع از سیستم فایل و حذف از [توزیع شده](../engines/table-engines/special/distributed.md) جداول که برای استفاده `SELECT` نمایش داده شد. عکس های فوری در چنین کپی خواهد شد در دسترس از هر گونه نمایش داده شد که تغییر داده ها باشد. به عنوان یک جایزه, این کپی ممکن است تنظیمات سخت افزار خاص با دیسک های بیشتر متصل در هر سرور, خواهد بود که مقرون به صرفه. ## تاتر-کپی {#clickhouse-copier} @@ -35,7 +35,7 @@ toc_title: "\u067E\u0634\u062A\u06CC\u0628\u0627\u0646 \u06AF\u06CC\u0631\u06CC کلیک اجازه می دهد تا با استفاده از `ALTER TABLE ... FREEZE PARTITION ...` پرس و جو برای ایجاد یک کپی محلی از پارتیشن های جدول. این اجرا با استفاده از hardlinks به `/var/lib/clickhouse/shadow/` پوشه, بنابراین معمولا فضای دیسک اضافی برای داده های قدیمی مصرف نمی. نسخه های ایجاد شده از فایل ها توسط سرور کلیک هاوس انجام نمی شود, بنابراین شما فقط می توانید ترک وجود دارد: شما یک نسخه پشتیبان تهیه ساده است که هیچ سیستم خارجی اضافی نیاز ندارد, اما هنوز هم مستعد ابتلا به مشکلات سخت افزاری خواهد بود. به همین دلیل بهتر است از راه دور به مکان دیگری کپی کنید و سپس نسخه های محلی را حذف کنید. توزیع فایل سیستم ها و فروشگاه های شی هنوز هم یک گزینه خوب برای این, اما عادی فایل های پیوست شده سرور با ظرفیت به اندازه کافی بزرگ ممکن است کار و همچنین (در این مورد انتقال از طریق فایل سیستم شبکه و یا شاید رخ می دهد [درباره ما](https://en.wikipedia.org/wiki/Rsync)). -برای کسب اطلاعات بیشتر در مورد نمایش داده شد مربوط به دستکاری پارتیشن, دیدن [تغییر مستندات](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +برای کسب اطلاعات بیشتر در مورد نمایش داده شد مربوط به دستکاری پارتیشن, دیدن [تغییر مستندات](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). یک ابزار شخص ثالث در دسترس است به طور خودکار این روش: [کلیک-پشتیبان گیری](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/fa/operations/configuration-files.md b/docs/fa/operations/configuration-files.md new file mode 100644 index 00000000000..2e6ebbbe70b --- /dev/null +++ b/docs/fa/operations/configuration-files.md @@ -0,0 +1,58 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 50 +toc_title: "\u067E\u0631\u0648\u0646\u062F\u0647\u0647\u0627\u06CC \u067E\u06CC\u06A9\ + \u0631\u0628\u0646\u062F\u06CC" +--- + +# پروندههای پیکربندی {#configuration_files} + +تاتر پشتیبانی از مدیریت پیکربندی چند فایل. فایل پیکربندی سرور اصلی است `/etc/clickhouse-server/config.xml`. فایل های دیگر باید در `/etc/clickhouse-server/config.d` فهرست راهنما. + +!!! note "یادداشت" + تمام فایل های پیکربندی باید در فرمت میلی لیتر باشد. همچنین معمولا باید یک عنصر ریشه داشته باشند ``. + +برخی از تنظیمات مشخص شده در فایل پیکربندی اصلی را می توان در دیگر فایل های پیکربندی باطل. این `replace` یا `remove` صفات را می توان برای عناصر این فایل های پیکربندی مشخص شده است. + +اگر نه مشخص شده است, ترکیبی از محتویات عناصر به صورت بازگشتی, جایگزینی مقادیر کودکان تکراری. + +اگر `replace` مشخص شده است, جایگزین کل عنصر با یک مشخص. + +اگر `remove` مشخص شده است, حذف عنصر. + +پیکربندی همچنین می توانید تعریف “substitutions”. اگر یک عنصر است `incl` ویژگی, جایگزینی مربوطه را از فایل خواهد شد به عنوان ارزش استفاده. به طور پیش فرض, مسیر به فایل با تعویض است `/etc/metrika.xml`. این را می توان در تغییر [include\_from](server-configuration-parameters/settings.md#server_configuration_parameters-include_from) عنصر در پیکربندی سرور. مقادیر جایگزینی در مشخص `/yandex/substitution_name` عناصر در این فایل. اگر جایگزینی مشخص شده در `incl` وجود ندارد, این است که در ورود به سیستم ثبت. برای جلوگیری از جایگزینی ورود به سیستم کلیک کنید `optional="true"` ویژگی (مثلا, تنظیمات برای [& کلاندارها](server-configuration-parameters/settings.md)). + +تعویض همچنین می توانید از باغ وحش انجام شود. برای انجام این کار ویژگی را مشخص کنید `from_zk = "/path/to/node"`. مقدار عنصر با محتویات گره در جایگزین `/path/to/node` در باغ وحش. شما همچنین می توانید یک زیر درخت کل در گره باغ وحش قرار داده و به طور کامل به عنصر منبع وارد می شود. + +این `config.xml` فایل می تواند یک پیکربندی جداگانه با تنظیمات کاربر مشخص, پروفایل, و سهمیه. مسیر نسبی به این پیکربندی در مجموعه `users_config` عنصر. به طور پیش فرض است `users.xml`. اگر `users_config` حذف شده است, تنظیمات کاربر, پروفایل, و سهمیه به طور مستقیم در مشخص `config.xml`. + +پیکربندی کاربران را می توان به فایل های جداگانه شبیه به تقسیم `config.xml` و `config.d/`. +نام فهرست راهنما به نام `users_config` تنظیم بدون `.xml` پس از مخلوط با `.d`. +فهرست راهنما `users.d` به طور پیش فرض استفاده می شود, مانند `users_config` پیشفرضها به `users.xml`. +مثلا, شما می توانید فایل پیکربندی جداگانه برای هر کاربر مثل این دارند: + +``` bash +$ cat /etc/clickhouse-server/users.d/alice.xml +``` + +``` xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +برای هر فایل پیکربندی سرور نیز تولید می کند `file-preprocessed.xml` فایل در هنگام شروع. این فایل ها شامل تمام تعویض های تکمیل شده و لغو می شوند و برای استفاده اطلاعاتی در نظر گرفته می شوند. اگر تعویض باغ وحش در فایل های پیکربندی مورد استفاده قرار گرفت اما باغ وحش در دسترس بر روی شروع سرور نیست, سرور بارهای پیکربندی از فایل پیش پردازش. + +مسیر سرور تغییر در فایل های پیکربندی, و همچنین فایل ها و گره باغ وحش که در هنگام انجام تعویض و لغو مورد استفاده قرار گرفت, و بارگذاری مجدد تنظیمات برای کاربران و خوشه در پرواز. این به این معنی است که شما می توانید خوشه تغییر, کاربران, و تنظیمات خود را بدون راه اندازی مجدد سرور. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/fa/operations/configuration_files.md b/docs/fa/operations/configuration_files.md deleted file mode 100644 index 086d92cfda9..00000000000 --- a/docs/fa/operations/configuration_files.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 50 -toc_title: "\u067E\u0631\u0648\u0646\u062F\u0647\u0647\u0627\u06CC \u067E\u06CC\u06A9\ - \u0631\u0628\u0646\u062F\u06CC" ---- - -# پروندههای پیکربندی {#configuration_files} - -تاتر پشتیبانی از مدیریت پیکربندی چند فایل. فایل پیکربندی سرور اصلی است `/etc/clickhouse-server/config.xml`. فایل های دیگر باید در `/etc/clickhouse-server/config.d` فهرست راهنما. - -!!! note "یادداشت" - تمام فایل های پیکربندی باید در فرمت میلی لیتر باشد. همچنین معمولا باید یک عنصر ریشه داشته باشند ``. - -برخی از تنظیمات مشخص شده در فایل پیکربندی اصلی را می توان در دیگر فایل های پیکربندی باطل. این `replace` یا `remove` صفات را می توان برای عناصر این فایل های پیکربندی مشخص شده است. - -اگر نه مشخص شده است, ترکیبی از محتویات عناصر به صورت بازگشتی, جایگزینی مقادیر کودکان تکراری. - -اگر `replace` مشخص شده است, جایگزین کل عنصر با یک مشخص. - -اگر `remove` مشخص شده است, حذف عنصر. - -پیکربندی همچنین می توانید تعریف “substitutions”. اگر یک عنصر است `incl` ویژگی, جایگزینی مربوطه را از فایل خواهد شد به عنوان ارزش استفاده. به طور پیش فرض, مسیر به فایل با تعویض است `/etc/metrika.xml`. این را می توان در تغییر [include\_from](server_configuration_parameters/settings.md#server_configuration_parameters-include_from) عنصر در پیکربندی سرور. مقادیر جایگزینی در مشخص `/yandex/substitution_name` عناصر در این فایل. اگر جایگزینی مشخص شده در `incl` وجود ندارد, این است که در ورود به سیستم ثبت. برای جلوگیری از جایگزینی ورود به سیستم کلیک کنید `optional="true"` ویژگی (مثلا, تنظیمات برای [& کلاندارها](server_configuration_parameters/settings.md)). - -تعویض همچنین می توانید از باغ وحش انجام شود. برای انجام این کار ویژگی را مشخص کنید `from_zk = "/path/to/node"`. مقدار عنصر با محتویات گره در جایگزین `/path/to/node` در باغ وحش. شما همچنین می توانید یک زیر درخت کل در گره باغ وحش قرار داده و به طور کامل به عنصر منبع وارد می شود. - -این `config.xml` فایل می تواند یک پیکربندی جداگانه با تنظیمات کاربر مشخص, پروفایل, و سهمیه. مسیر نسبی به این پیکربندی در مجموعه `users_config` عنصر. به طور پیش فرض است `users.xml`. اگر `users_config` حذف شده است, تنظیمات کاربر, پروفایل, و سهمیه به طور مستقیم در مشخص `config.xml`. - -پیکربندی کاربران را می توان به فایل های جداگانه شبیه به تقسیم `config.xml` و `config.d/`. -نام فهرست راهنما به نام `users_config` تنظیم بدون `.xml` پس از مخلوط با `.d`. -فهرست راهنما `users.d` به طور پیش فرض استفاده می شود, مانند `users_config` پیشفرضها به `users.xml`. -مثلا, شما می توانید فایل پیکربندی جداگانه برای هر کاربر مثل این دارند: - -``` bash -$ cat /etc/clickhouse-server/users.d/alice.xml -``` - -``` xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -برای هر فایل پیکربندی سرور نیز تولید می کند `file-preprocessed.xml` فایل در هنگام شروع. این فایل ها شامل تمام تعویض های تکمیل شده و لغو می شوند و برای استفاده اطلاعاتی در نظر گرفته می شوند. اگر تعویض باغ وحش در فایل های پیکربندی مورد استفاده قرار گرفت اما باغ وحش در دسترس بر روی شروع سرور نیست, سرور بارهای پیکربندی از فایل پیش پردازش. - -مسیر سرور تغییر در فایل های پیکربندی, و همچنین فایل ها و گره باغ وحش که در هنگام انجام تعویض و لغو مورد استفاده قرار گرفت, و بارگذاری مجدد تنظیمات برای کاربران و خوشه در پرواز. این به این معنی است که شما می توانید خوشه تغییر, کاربران, و تنظیمات خود را بدون راه اندازی مجدد سرور. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/fa/operations/index.md b/docs/fa/operations/index.md index ac5c7a28fdc..22706e65608 100644 --- a/docs/fa/operations/index.md +++ b/docs/fa/operations/index.md @@ -15,13 +15,13 @@ toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" - [عیب یابی](troubleshooting.md) - [توصیه های استفاده](tips.md) - [روش به روز رسانی](update.md) -- [حقوق دسترسی](access_rights.md) +- [حقوق دسترسی](access-rights.md) - [پشتیبان گیری داده ها](backup.md) -- [پروندههای پیکربندی](configuration_files.md) +- [پروندههای پیکربندی](configuration-files.md) - [سهمیه](quotas.md) -- [جداول سیستم](system_tables.md) -- [پارامترهای پیکربندی سرور](server_configuration_parameters/index.md) -- [چگونه برای تست سخت افزار خود را با کلیک](performance_test.md) +- [جداول سیستم](system-tables.md) +- [پارامترهای پیکربندی سرور](server-configuration-parameters/index.md) +- [چگونه برای تست سخت افزار خود را با کلیک](performance-test.md) - [تنظیمات](settings/index.md) - [تاسیسات](utilities/index.md) diff --git a/docs/fa/operations/monitoring.md b/docs/fa/operations/monitoring.md index 79e11cf51e6..d4a9849b5ac 100644 --- a/docs/fa/operations/monitoring.md +++ b/docs/fa/operations/monitoring.md @@ -28,16 +28,16 @@ toc_title: "\u0646\u0638\u0627\u0631\u062A" سرور کلیک ابزار برای نظارت خود دولت تعبیه شده است. -برای پیگیری رویدادهای سرور استفاده از سیاهههای مربوط به سرور. دیدن [چوبگر](server_configuration_parameters/settings.md#server_configuration_parameters-logger) بخش از فایل پیکربندی. +برای پیگیری رویدادهای سرور استفاده از سیاهههای مربوط به سرور. دیدن [چوبگر](server-configuration-parameters/settings.md#server_configuration_parameters-logger) بخش از فایل پیکربندی. جمعهای کلیک: - معیارهای مختلف چگونه سرور با استفاده از منابع محاسباتی. - ارقام مشترک در پردازش پرس و جو. -شما می توانید معیارهای موجود در [سیستم.متریک](../operations/system_tables.md#system_tables-metrics), [سیستم.رویدادها](../operations/system_tables.md#system_tables-events) و [سیستم.\_نامهنویسی ناهمزمان](../operations/system_tables.md#system_tables-asynchronous_metrics) میز +شما می توانید معیارهای موجود در [سیستم.متریک](../operations/system-tables.md#system_tables-metrics), [سیستم.رویدادها](../operations/system-tables.md#system_tables-events) و [سیستم.\_نامهنویسی ناهمزمان](../operations/system-tables.md#system_tables-asynchronous_metrics) میز -شما می توانید کلیک کنید هاوس به صادرات معیارهای به پیکربندی کنید [گرافیت](https://github.com/graphite-project). دیدن [بخش گرافیت](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) در فایل پیکربندی سرور کلیک. قبل از پیکربندی صادرات معیارهای, شما باید راه اندازی گرافیت با پیروی از رسمی خود را [راهنما](https://graphite.readthedocs.io/en/latest/install.html). +شما می توانید کلیک کنید هاوس به صادرات معیارهای به پیکربندی کنید [گرافیت](https://github.com/graphite-project). دیدن [بخش گرافیت](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) در فایل پیکربندی سرور کلیک. قبل از پیکربندی صادرات معیارهای, شما باید راه اندازی گرافیت با پیروی از رسمی خود را [راهنما](https://graphite.readthedocs.io/en/latest/install.html). علاوه بر این, شما می توانید در دسترس بودن سرور از طریق صفحه اصلی نظارت. ارسال `HTTP GET` درخواست برای `/ping`. اگر سرور در دسترس است, با پاسخ `200 OK`. diff --git a/docs/fa/operations/optimizing_performance/index.md b/docs/fa/operations/optimizing-performance/index.md similarity index 100% rename from docs/fa/operations/optimizing_performance/index.md rename to docs/fa/operations/optimizing-performance/index.md diff --git a/docs/fa/operations/optimizing-performance/sampling-query-profiler.md b/docs/fa/operations/optimizing-performance/sampling-query-profiler.md new file mode 100644 index 00000000000..ac943531ce4 --- /dev/null +++ b/docs/fa/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1,65 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: "\u067E\u0631\u0648\u0641\u0627\u06CC\u0644 \u067E\u0631\u0633 \u0648 \u062C\ + \u0648" +--- + +# پروفایل پرس و جو نمونه برداری {#sampling-query-profiler} + +فاحشه خانه اجرا می شود نمونه برداری پیشفیلتر که اجازه می دهد تجزیه و تحلیل اجرای پرس و جو. با استفاده از نیمرخ شما می توانید روال کد منبع که اغلب در طول اجرای پرس و جو استفاده پیدا. شما می توانید زمان پردازنده و دیوار ساعت زمان صرف شده از جمله زمان بیکار ردیابی. + +برای استفاده از پروفیل: + +- برپایی [\_قطع](../server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) بخش پیکربندی سرور. + + در این بخش پیکربندی [\_قطع](../../operations/system-tables.md#system_tables-trace_log) جدول سیستم حاوی نتایج حاصل از عملکرد پیشفیلتر. این است که به طور پیش فرض پیکربندی شده است. به یاد داشته باشید که داده ها در این جدول تنها برای یک سرور در حال اجرا معتبر است. پس از راه اندازی مجدد سرور, تاتر تمیز نمی کند تا جدول و تمام نشانی حافظه مجازی ذخیره شده ممکن است نامعتبر. + +- برپایی [ایران در تهران](../settings/settings.md#query_profiler_cpu_time_period_ns) یا [جستجو](../settings/settings.md#query_profiler_real_time_period_ns) تنظیمات. هر دو تنظیمات را می توان به طور همزمان استفاده کرد. + + این تنظیمات به شما اجازه پیکربندی تایمر پیشفیلتر. همانطور که این تنظیمات جلسه هستند, شما می توانید فرکانس نمونه برداری های مختلف برای کل سرور از, کاربران فردی و یا پروفایل های کاربر, برای جلسه تعاملی خود را, و برای هر پرس و جو فردی. + +فرکانس نمونه گیری به طور پیش فرض یک نمونه در هر ثانیه است و هر دو پردازنده و تایمر واقعی را فعال کنید. این فرکانس اجازه می دهد تا اطلاعات کافی در مورد خوشه کلیک کنید. همزمان, کار با این فرکانس, پیشفیلتر می کند عملکرد سرور کلیک را تحت تاثیر قرار نمی. اگر شما نیاز به مشخصات هر پرس و جو فردی سعی کنید به استفاده از فرکانس نمونه برداری بالاتر است. + +برای تجزیه و تحلیل `trace_log` جدول سیستم: + +- نصب `clickhouse-common-static-dbg` بسته ببینید [نصب از بسته های دب](../../getting-started/install.md#install-from-deb-packages). + +- اجازه توابع درون گرایی توسط [اجازه دادن به \_فعال کردن اختلال در عملکرد](../settings/settings.md#settings-allow_introspection_functions) تنظیمات. + + به دلایل امنیتی, توابع درون گرایی به طور پیش فرض غیر فعال. + +- استفاده از `addressToLine`, `addressToSymbol` و `demangle` [توابع درون گرایی](../../sql-reference/functions/introspection.md) برای گرفتن نام تابع و موقعیت خود را در کد کلیک کنید. برای دریافت یک پروفایل برای برخی از پرس و جو, شما نیاز به جمع داده ها از `trace_log` جدول شما می توانید داده ها را با توابع فردی یا کل ردیابی پشته جمع کنید. + +اگر شما نیاز به تجسم `trace_log` اطلاعات را امتحان کنید [شق](../../interfaces/third-party/gui/#clickhouse-flamegraph) و [سرعت سنج](https://github.com/laplab/clickhouse-speedscope). + +## مثال {#example} + +در این مثال ما: + +- پالایش `trace_log` داده ها توسط یک شناسه پرس و جو و تاریخ جاری. + +- جمع توسط ردیابی پشته. + +- با استفاده از توابع درون گرایی, ما یک گزارش از دریافت: + + - نام نمادها و توابع کد منبع مربوطه. + - محل کد منبع از این توابع. + + + +``` sql +SELECT + count(), + arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym +FROM system.trace_log +WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) +GROUP BY trace +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +{% include "examples/sampling_query_profiler_result.txt" %} +``` diff --git a/docs/fa/operations/optimizing_performance/sampling_query_profiler.md b/docs/fa/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 100644 index b0f441c2e44..00000000000 --- a/docs/fa/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: "\u067E\u0631\u0648\u0641\u0627\u06CC\u0644 \u067E\u0631\u0633 \u0648 \u062C\ - \u0648" ---- - -# پروفایل پرس و جو نمونه برداری {#sampling-query-profiler} - -فاحشه خانه اجرا می شود نمونه برداری پیشفیلتر که اجازه می دهد تجزیه و تحلیل اجرای پرس و جو. با استفاده از نیمرخ شما می توانید روال کد منبع که اغلب در طول اجرای پرس و جو استفاده پیدا. شما می توانید زمان پردازنده و دیوار ساعت زمان صرف شده از جمله زمان بیکار ردیابی. - -برای استفاده از پروفیل: - -- برپایی [\_قطع](../server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) بخش پیکربندی سرور. - - در این بخش پیکربندی [\_قطع](../../operations/system_tables.md#system_tables-trace_log) جدول سیستم حاوی نتایج حاصل از عملکرد پیشفیلتر. این است که به طور پیش فرض پیکربندی شده است. به یاد داشته باشید که داده ها در این جدول تنها برای یک سرور در حال اجرا معتبر است. پس از راه اندازی مجدد سرور, تاتر تمیز نمی کند تا جدول و تمام نشانی حافظه مجازی ذخیره شده ممکن است نامعتبر. - -- برپایی [ایران در تهران](../settings/settings.md#query_profiler_cpu_time_period_ns) یا [جستجو](../settings/settings.md#query_profiler_real_time_period_ns) تنظیمات. هر دو تنظیمات را می توان به طور همزمان استفاده کرد. - - این تنظیمات به شما اجازه پیکربندی تایمر پیشفیلتر. همانطور که این تنظیمات جلسه هستند, شما می توانید فرکانس نمونه برداری های مختلف برای کل سرور از, کاربران فردی و یا پروفایل های کاربر, برای جلسه تعاملی خود را, و برای هر پرس و جو فردی. - -فرکانس نمونه گیری به طور پیش فرض یک نمونه در هر ثانیه است و هر دو پردازنده و تایمر واقعی را فعال کنید. این فرکانس اجازه می دهد تا اطلاعات کافی در مورد خوشه کلیک کنید. همزمان, کار با این فرکانس, پیشفیلتر می کند عملکرد سرور کلیک را تحت تاثیر قرار نمی. اگر شما نیاز به مشخصات هر پرس و جو فردی سعی کنید به استفاده از فرکانس نمونه برداری بالاتر است. - -برای تجزیه و تحلیل `trace_log` جدول سیستم: - -- نصب `clickhouse-common-static-dbg` بسته ببینید [نصب از بسته های دب](../../getting_started/install.md#install-from-deb-packages). - -- اجازه توابع درون گرایی توسط [اجازه دادن به \_فعال کردن اختلال در عملکرد](../settings/settings.md#settings-allow_introspection_functions) تنظیمات. - - به دلایل امنیتی, توابع درون گرایی به طور پیش فرض غیر فعال. - -- استفاده از `addressToLine`, `addressToSymbol` و `demangle` [توابع درون گرایی](../../sql_reference/functions/introspection.md) برای گرفتن نام تابع و موقعیت خود را در کد کلیک کنید. برای دریافت یک پروفایل برای برخی از پرس و جو, شما نیاز به جمع داده ها از `trace_log` جدول شما می توانید داده ها را با توابع فردی یا کل ردیابی پشته جمع کنید. - -اگر شما نیاز به تجسم `trace_log` اطلاعات را امتحان کنید [شق](../../interfaces/third-party/gui/#clickhouse-flamegraph) و [سرعت سنج](https://github.com/laplab/clickhouse-speedscope). - -## مثال {#example} - -در این مثال ما: - -- پالایش `trace_log` داده ها توسط یک شناسه پرس و جو و تاریخ جاری. - -- جمع توسط ردیابی پشته. - -- با استفاده از توابع درون گرایی, ما یک گزارش از دریافت: - - - نام نمادها و توابع کد منبع مربوطه. - - محل کد منبع از این توابع. - - - -``` sql -SELECT - count(), - arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym -FROM system.trace_log -WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) -GROUP BY trace -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -{% include "examples/sampling_query_profiler_result.txt" %} -``` diff --git a/docs/fa/operations/performance-test.md b/docs/fa/operations/performance-test.md new file mode 100644 index 00000000000..ce5dab721fb --- /dev/null +++ b/docs/fa/operations/performance-test.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: "\u0633\u062E\u062A \u0627\u0641\u0632\u0627\u0631 \u062A\u0633\u062A" +--- + +# چگونه برای تست سخت افزار خود را با کلیک {#how-to-test-your-hardware-with-clickhouse} + +با این آموزش شما می توانید اجرا پایه clickhouse آزمون عملکرد بر روی هر سرور بدون نصب و راه اندازی clickhouse بسته است. + +1. برو به “commits” صفحه: https://github.com/ClickHouse/ClickHouse/commits/master + +2. با کلیک بر روی اولین علامت چک سبز یا صلیب قرمز با سبز “ClickHouse Build Check” و با کلیک بر روی “Details” لینک نزدیک “ClickHouse Build Check”. + +3. رونوشت از پیوند به “clickhouse” دودویی برای amd64 یا aarch64. + +4. به سرور بروید و با استفاده از ابزار دانلود کنید: + + + + # For amd64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse + # For aarch64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse + # Then do: + chmod a+x clickhouse + +1. دانلود تنظیمات: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml + mkdir config.d + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml + +1. دانلود فایل معیار: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh + chmod a+x benchmark-new.sh + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql + +1. دانلود داده های تست با توجه به [یاندکسمجموعه داده های متریکا](../getting-started/example-datasets/metrica.md) دستورالعمل (“hits” جدول حاوی 100 میلیون ردیف). + + + + wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz + tar xvf hits_100m_obfuscated_v1.tar.xz -C . + mv hits_100m_obfuscated_v1/* . + +1. اجرای کارساز: + + + + ./clickhouse server + +1. داده ها را بررسی کنید: در ترمینال دیگر به سرور مراجعه کنید + + + + ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" + 100000000 + +1. ویرایش benchmark-new.sh تغییر “clickhouse-client” به “./clickhouse client” و اضافه کردن “–max\_memory\_usage 100000000000” پارامتر. + + + + mcedit benchmark-new.sh + +1. اجرای معیار: + + + + ./benchmark-new.sh hits_100m_obfuscated + +1. ارسال اعداد و اطلاعات در مورد پیکربندی سخت افزار خود را به clickhouse-feedback@yandex-team.com + +همه نتایج در اینجا منتشر شده: https://clickhouse.فناوری/ظروف محک.زنگام diff --git a/docs/fa/operations/performance_test.md b/docs/fa/operations/performance_test.md deleted file mode 100644 index 55f589fc83b..00000000000 --- a/docs/fa/operations/performance_test.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: "\u0633\u062E\u062A \u0627\u0641\u0632\u0627\u0631 \u062A\u0633\u062A" ---- - -# چگونه برای تست سخت افزار خود را با کلیک {#how-to-test-your-hardware-with-clickhouse} - -با این آموزش شما می توانید اجرا پایه clickhouse آزمون عملکرد بر روی هر سرور بدون نصب و راه اندازی clickhouse بسته است. - -1. برو به “commits” صفحه: https://github.com/ClickHouse/ClickHouse/commits/master - -2. با کلیک بر روی اولین علامت چک سبز یا صلیب قرمز با سبز “ClickHouse Build Check” و با کلیک بر روی “Details” لینک نزدیک “ClickHouse Build Check”. - -3. رونوشت از پیوند به “clickhouse” دودویی برای amd64 یا aarch64. - -4. به سرور بروید و با استفاده از ابزار دانلود کنید: - - - - # For amd64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse - # For aarch64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse - # Then do: - chmod a+x clickhouse - -1. دانلود تنظیمات: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml - mkdir config.d - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml - -1. دانلود فایل معیار: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh - chmod a+x benchmark-new.sh - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql - -1. دانلود داده های تست با توجه به [یاندکسمجموعه داده های متریکا](../getting_started/example_datasets/metrica.md) دستورالعمل (“hits” جدول حاوی 100 میلیون ردیف). - - - - wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz - tar xvf hits_100m_obfuscated_v1.tar.xz -C . - mv hits_100m_obfuscated_v1/* . - -1. اجرای کارساز: - - - - ./clickhouse server - -1. داده ها را بررسی کنید: در ترمینال دیگر به سرور مراجعه کنید - - - - ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" - 100000000 - -1. ویرایش benchmark-new.sh تغییر “clickhouse-client” به “./clickhouse client” و اضافه کردن “–max\_memory\_usage 100000000000” پارامتر. - - - - mcedit benchmark-new.sh - -1. اجرای معیار: - - - - ./benchmark-new.sh hits_100m_obfuscated - -1. ارسال اعداد و اطلاعات در مورد پیکربندی سخت افزار خود را به clickhouse-feedback@yandex-team.com - -همه نتایج در اینجا منتشر شده: https://clickhouse.فناوری/ظروف محک.زنگام diff --git a/docs/fa/operations/requirements.md b/docs/fa/operations/requirements.md index 6050649de90..29a3e206c68 100644 --- a/docs/fa/operations/requirements.md +++ b/docs/fa/operations/requirements.md @@ -24,9 +24,9 @@ toc_title: "\u0627\u0644\u0632\u0627\u0645\u0627\u062A" - پیچیدگی نمایش داده شد. - مقدار داده هایی که در نمایش داده شد پردازش شده است. -برای محاسبه حجم مورد نیاز رم, شما باید اندازه داده های موقت برای تخمین [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) و عملیات دیگر استفاده می کنید. +برای محاسبه حجم مورد نیاز رم, شما باید اندازه داده های موقت برای تخمین [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) و عملیات دیگر استفاده می کنید. -تاتر می توانید حافظه خارجی برای داده های موقت استفاده. ببینید [گروه در حافظه خارجی](../sql_reference/statements/select.md#select-group-by-in-external-memory) برای اطلاعات بیشتر. +تاتر می توانید حافظه خارجی برای داده های موقت استفاده. ببینید [گروه در حافظه خارجی](../sql-reference/statements/select.md#select-group-by-in-external-memory) برای اطلاعات بیشتر. ## تعویض پرونده {#swap-file} @@ -58,4 +58,4 @@ toc_title: "\u0627\u0644\u0632\u0627\u0645\u0627\u062A" کلیک هاوس برای خانواده لینوکس سیستم عامل توسعه یافته است. توزیع لینوکس توصیه شده اوبونتو است. این `tzdata` بسته باید در سیستم نصب شود. -تاتر همچنین می توانید در دیگر خانواده سیستم عامل کار. مشاهده اطلاعات در [شروع کار](../getting_started/index.md) بخش از اسناد و مدارک. +تاتر همچنین می توانید در دیگر خانواده سیستم عامل کار. مشاهده اطلاعات در [شروع کار](../getting-started/index.md) بخش از اسناد و مدارک. diff --git a/docs/fa/operations/server-configuration-parameters/index.md b/docs/fa/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..dadd6cde790 --- /dev/null +++ b/docs/fa/operations/server-configuration-parameters/index.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Server Configuration Parameters +toc_priority: 54 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# پارامترهای پیکربندی سرور {#server-settings} + +این بخش شامل شرح تنظیمات سرور است که نمی تواند در سطح جلسه یا پرس و جو تغییر کند. + +این تنظیمات در ذخیره می شود `config.xml` فایل بر روی سرور کلیک. + +تنظیمات دیگر در توصیف “[تنظیمات](../settings/index.md#settings)” بخش. + +قبل از مطالعه تنظیمات, خواندن [پروندههای پیکربندی](../configuration-files.md#configuration_files) بخش و توجه داشته باشید استفاده از تعویض ( `incl` و `optional` صفات). + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/fa/operations/server-configuration-parameters/settings.md b/docs/fa/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..47679169264 --- /dev/null +++ b/docs/fa/operations/server-configuration-parameters/settings.md @@ -0,0 +1,873 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 57 +toc_title: "\u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u06A9\u0627\u0631\u06AF\u0632\ + \u0627\u0631" +--- + +# تنظیمات کارگزار {#server-settings} + +## ساختن و احراز هویت اکانتهای دستگاه {#builtin-dictionaries-reload-interval} + +فاصله در ثانیه قبل از بارگذاری ساخته شده است در لغت نامه. + +مخزن بارگذاری مجدد ساخته شده است در لغت نامه در هر ثانیه ایکس. این امکان ویرایش واژهنامهها را فراهم میکند “on the fly” بدون راه اندازی مجدد سرور. + +مقدار پیش فرض: 3600. + +**مثال** + +``` xml +3600 +``` + +## فشردهسازی {#server-settings-compression} + +تنظیمات فشرده سازی داده ها برای [ادغام](../../engines/table-engines/mergetree-family/mergetree.md)- جدول موتور . + +!!! warning "اخطار" + اگر شما فقط شروع به استفاده از خانه کلیک استفاده نکنید. + +قالب پیکربندی: + +``` xml + + + ... + ... + ... + + ... + +``` + +`` زمینه: + +- `min_part_size` – The minimum size of a data part. +- `min_part_size_ratio` – The ratio of the data part size to the table size. +- `method` – Compression method. Acceptable values: `lz4` یا `zstd`. + +شما می توانید چند پیکربندی کنید `` بخش. + +اقدامات زمانی که شرایط ملاقات می شوند: + +- اگر بخشی از داده ها منطبق یک مجموعه شرایط, تاتر با استفاده از روش فشرده سازی مشخص. +- اگر یک بخش داده منطبق مجموعه شرایط متعدد, خانه رعیتی با استفاده از اولین مجموعه شرایط همسان. + +اگر هیچ شرایطی برای یک بخش داده ملاقات, خانه عروسکی با استفاده از `lz4` فشردهسازی. + +**مثال** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## & تنظیمات {#default-database} + +پایگاه داده به طور پیش فرض. + +برای دریافت یک لیست از پایگاه داده, استفاده از [SHOW DATABASES](../../sql-reference/statements/show.md#show-databases) پرس و جو. + +**مثال** + +``` xml +default +``` + +## قصور {#default-profile} + +تنظیمات پیش فرض مشخصات. + +پروفایل های تنظیمات در فایل مشخص شده در پارامتر واقع شده است `user_config`. + +**مثال** + +``` xml +default +``` + +## دیکشنامهای {#server_configuration_parameters-dictionaries_config} + +مسیر به فایل پیکربندی برای لغت نامه های خارجی. + +مسیر: + +- مشخص کردن مسیر مطلق و یا مسیر نسبت به فایل پیکربندی سرور. +- مسیر می تواند حاوی نویسه عام \* و?. + +همچنین نگاه کنید به “[واژهنامهها خارجی](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)”. + +**مثال** + +``` xml +*_dictionary.xml +``` + +## \_بارگیری کامل {#server_configuration_parameters-dictionaries_lazy_load} + +بارگذاری تنبل از لغت نامه. + +اگر `true` سپس هر فرهنگ لغت در اولین استفاده ایجاد می شود. اگر ایجاد فرهنگ لغت شکست خورده, تابع بود که با استفاده از فرهنگ لغت می اندازد یک استثنا. + +اگر `false`, تمام لغت نامه ها ایجاد می شوند زمانی که سرور شروع می شود, و اگر یک خطا وجود دارد, سرور خاموش. + +به طور پیش فرض است `true`. + +**مثال** + +``` xml +true +``` + +## قالب\_شکلمات شیمی {#server_configuration_parameters-format_schema_path} + +مسیر به دایرکتوری با طرح برای داده های ورودی, مانند طرحواره برای [کاپپروتو](../../interfaces/formats.md#capnproto) قالب. + +**مثال** + +``` xml + + format_schemas/ +``` + +## گرافیت {#server_configuration_parameters-graphite} + +ارسال داده به [گرافیت](https://github.com/graphite-project). + +تنظیمات: + +- host – The Graphite server. +- port – The port on the Graphite server. +- interval – The interval for sending, in seconds. +- timeout – The timeout for sending data, in seconds. +- root\_path – Prefix for keys. +- metrics – Sending data from the [سیستم.متریک](../../operations/system-tables.md#system_tables-metrics) جدول +- events – Sending deltas data accumulated for the time period from the [سیستم.رویدادها](../../operations/system-tables.md#system_tables-events) جدول +- events\_cumulative – Sending cumulative data from the [سیستم.رویدادها](../../operations/system-tables.md#system_tables-events) جدول +- asynchronous\_metrics – Sending data from the [سیستم.\_نامهنویسی ناهمزمان](../../operations/system-tables.md#system_tables-asynchronous_metrics) جدول + +شما می توانید چند پیکربندی کنید `` بند. برای مثال شما می توانید از این برای ارسال داده های مختلف در فواصل مختلف استفاده کنید. + +**مثال** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## لغزش \_ نمودار {#server_configuration_parameters-graphite-rollup} + +تنظیمات برای نازک شدن داده ها برای گرافیت. + +برای اطلاعات بیشتر, دیدن [نمودار](../../engines/table-engines/mergetree-family/graphitemergetree.md). + +**مثال** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## \_وارد کردن/پشتیبانی {#http-porthttps-port} + +درگاه برای اتصال به کارساز بالای صفحه) ها (. + +اگر `https_port` مشخص شده است, [openSSL](#server_configuration_parameters-openssl) باید پیکربندی شود. + +اگر `http_port` مشخص شده است, پیکربندی اپنسسل نادیده گرفته شده است حتی اگر قرار است. + +**مثال** + +``` xml +0000 +``` + +## نقلقولهای جدید از این نویسنده {#server_configuration_parameters-http_server_default_response} + +صفحه ای که به طور پیش فرض نشان داده شده است زمانی که شما دسترسی به سرور قام کلیک. +مقدار پیش فرض است “Ok.” (با خوراک خط در پایان) + +**مثال** + +باز می شود `https://tabix.io/` هنگام دسترسی `http://localhost: http_port`. + +``` xml + +
]]> +
+``` + +## include\_from {#server_configuration_parameters-include_from} + +مسیر به فایل با تعویض. + +برای کسب اطلاعات بیشتر به بخش مراجعه کنید “[پروندههای پیکربندی](../configuration-files.md#configuration_files)”. + +**مثال** + +``` xml +/etc/metrica.xml +``` + +## \_صادر کردن {#interserver-http-port} + +پورت برای تبادل اطلاعات بین سرور های فاحشه خانه. + +**مثال** + +``` xml +9009 +``` + +## حذف جستجو {#interserver-http-host} + +نام میزبان است که می تواند توسط سرور های دیگر برای دسترسی به این سرور استفاده می شود. + +اگر حذف, این است که در همان راه به عنوان تعریف `hostname-f` فرمان. + +مفید برای شکستن دور از یک رابط شبکه خاص. + +**مثال** + +``` xml +example.yandex.ru +``` + +## پتانسیلهای متقابل {#server-settings-interserver-http-credentials} + +نام کاربری و رمز عبور مورد استفاده برای تصدیق در طول [تکرار](../../engines/table-engines/mergetree-family/replication.md) با تکرار \* موتورهای. این اعتبار تنها برای ارتباط بین کپی استفاده می شود و ربطی به اعتبار برای مشتریان خانه عروسکی هستند. سرور چک کردن این اعتبار برای اتصال کپی و استفاده از اعتبار همان هنگام اتصال به دیگر کپی. بنابراین, این اعتبار باید همین کار را برای همه کپی در یک خوشه مجموعه. +به طور پیش فرض احراز هویت استفاده نمی شود. + +این بخش شامل پارامترهای زیر است: + +- `user` — username. +- `password` — password. + +**مثال** + +``` xml + + admin + 222 + +``` + +## حفاظت از حریم خصوصی {#keep-alive-timeout} + +تعداد ثانیه که تاتر منتظر درخواست های دریافتی قبل از بستن اتصال. به طور پیش فرض به 3 ثانیه. + +**مثال** + +``` xml +3 +``` + +## \_نوست فهرست {#server_configuration_parameters-listen_host} + +محدودیت در میزبان که درخواست می توانید از. اگر می خواهید سرور برای پاسخ به همه انها مشخص شود `::`. + +مثالها: + +``` xml +::1 +127.0.0.1 +``` + +## چوبگر {#server_configuration_parameters-logger} + +تنظیمات ورود به سیستم. + +کلید: + +- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. +- log – The log file. Contains all the entries according to `level`. +- errorlog – Error log file. +- size – Size of the file. Applies to `log`و`errorlog`. هنگامی که فایل می رسد `size`, بایگانی کلیک هوس و تغییر نام, و ایجاد یک فایل ورود به سیستم جدید را در خود جای. +- count – The number of archived log files that ClickHouse stores. + +**مثال** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +نوشتن به وبلاگ نیز پشتیبانی می کند. پیکربندی مثال: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +کلید: + +- use\_syslog — Required setting if you want to write to the syslog. +- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. +- hostname — Optional. The name of the host that logs are sent from. +- facility — [کلمه کلیدی تسهیلات سیسلوگ](https://en.wikipedia.org/wiki/Syslog#Facility) در حروف بزرگ با “LOG\_” پیشوند: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`, و به همین ترتیب). + مقدار پیشفرض: `LOG_USER` اگر `address` مشخص شده است, `LOG_DAEMON otherwise.` +- format – Message format. Possible values: `bsd` و `syslog.` + +## & کلاندارها {#macros} + +تعویض پارامتر برای جداول تکرار. + +می توان حذف اگر جداول تکرار استفاده نمی شود. + +برای کسب اطلاعات بیشتر به بخش مراجعه کنید “[ایجاد جداول تکرار شده](../../engines/table-engines/mergetree-family/replication.md)”. + +**مثال** + +``` xml + +``` + +## نشاندار کردن \_چ\_سیز {#server-mark-cache-size} + +اندازه تقریبی (به بایت) کش علامت های استفاده شده توسط موتورهای جدول [ادغام](../../engines/table-engines/mergetree-family/mergetree.md) خانواده + +کش برای سرور به اشتراک گذاشته و حافظه به عنوان مورد نیاز اختصاص داده است. اندازه کش باید حداقل 5368709120 باشد. + +**مثال** + +``` xml +5368709120 +``` + +## م\_قیاس تصویر {#max-concurrent-queries} + +حداکثر تعداد درخواست به طور همزمان پردازش. + +**مثال** + +``` xml +100 +``` + +## \_تنامههای بیشینه {#max-connections} + +حداکثر تعداد اتصالات ورودی. + +**مثال** + +``` xml +4096 +``` + +## \_موضوعات بیشینه {#max-open-files} + +حداکثر تعداد فایل های باز. + +به طور پیش فرض: `maximum`. + +ما توصیه می کنیم با استفاده از این گزینه در سیستم عامل مک ایکس از `getrlimit()` تابع یک مقدار نادرست می گرداند. + +**مثال** + +``` xml +262144 +``` + +## حداکثر\_طب\_ضز\_توقف {#max-table-size-to-drop} + +محدودیت در حذف جداول. + +اگر اندازه یک [ادغام](../../engines/table-engines/mergetree-family/mergetree.md) جدول بیش از `max_table_size_to_drop` با استفاده از پرس و جو قطره نمی توانید حذف کنید. + +اگر شما هنوز هم نیاز به حذف جدول بدون راه اندازی مجدد سرور کلیک, ایجاد `/flags/force_drop_table` فایل و اجرای پرس و جو قطره. + +مقدار پیش فرض: 50 گیگابایت. + +ارزش 0 بدان معنی است که شما می توانید تمام جداول بدون هیچ گونه محدودیت حذف. + +**مثال** + +``` xml +0 +``` + +## ادغام {#server_configuration_parameters-merge_tree} + +تنظیم زیبا برای جداول در [ادغام](../../engines/table-engines/mergetree-family/mergetree.md). + +برای کسب اطلاعات بیشتر, دیدن ادغام.فایل هدر ساعت. + +**مثال** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +SSL client/server configuration. + +پشتیبانی از اس اس ال توسط `libpoco` کتابخونه. رابط در فایل شرح داده شده است [سوسمنگر.ه](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +کلید برای تنظیمات سرور / مشتری: + +- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. +- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` شامل گواهی. +- caConfig – The path to the file or directory that contains trusted root certificates. +- verificationMode – The method for checking the node’s certificates. Details are in the description of the [متن](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) کلاس. مقادیر ممکن: `none`, `relaxed`, `strict`, `once`. +- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. +- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| +- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. مقادیر قابل قبول: `true`, `false`. +- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. این پارامتر همیشه توصیه می شود از این کمک می کند تا جلوگیری از مشکلات هر دو اگر سرور حافظه پنهان جلسه و اگر مشتری درخواست ذخیره. مقدار پیشفرض: `${application.name}`. +- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. +- sessionTimeout – Time for caching the session on the server. +- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. +- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. +- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. +- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . +- disableProtocols – Protocols that are not allowed to use. +- preferServerCiphers – Preferred server ciphers on the client. + +**مثال تنظیمات:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## \_خروج {#server_configuration_parameters-part-log} + +وقایع ورود به سیستم که با مرتبط [ادغام](../../engines/table-engines/mergetree-family/mergetree.md). برای مثال, اضافه کردن یا ادغام داده ها. شما می توانید ورود به سیستم برای شبیه سازی الگوریتم های ادغام و مقایسه ویژگی های خود استفاده کنید. شما می توانید روند ادغام تجسم. + +نمایش داده شد در سیستم وارد [سیستم.\_خروج](../../operations/system-tables.md#system_tables-part-log) جدول, نه در یک فایل جداگانه. شما می توانید نام این جدول را در پیکربندی `table` پارامتر (پایین را ببینید). + +از پارامترهای زیر برای پیکربندی ورود استفاده کنید: + +- `database` – Name of the database. +- `table` – Name of the system table. +- `partition_by` – Sets a [کلید پارتیشن بندی سفارشی](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +**مثال** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## مسیر {#server_configuration_parameters-path} + +مسیر به دایرکتوری حاوی داده. + +!!! note "یادداشت" + اسلش الزامی است. + +**مثال** + +``` xml +/var/lib/clickhouse/ +``` + +## \_خروج {#server_configuration_parameters-query-log} + +تنظیم برای ورود به سیستم نمایش داده شد با دریافت [\_ترکیب = 1](../settings/settings.md) تنظیمات. + +نمایش داده شد در سیستم وارد [سیستم.\_خروج](../../operations/system-tables.md#system_tables-query_log) جدول, نه در یک فایل جداگانه. شما می توانید نام جدول را در `table` پارامتر (پایین را ببینید). + +از پارامترهای زیر برای پیکربندی ورود استفاده کنید: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [کلید پارتیشن بندی سفارشی](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) برای یک جدول. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +اگه جدول وجود نداشته باشه. اگر ساختار ورود به سیستم پرس و جو تغییر زمانی که سرور فاحشه خانه به روز شد, جدول با ساختار قدیمی تغییر نام داد, و یک جدول جدید به طور خودکار ایجاد شده است. + +**مثال** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## \_ر\_خروج {#server_configuration_parameters-query-thread-log} + +تنظیم برای ورود به سیستم موضوعات نمایش داده شد دریافت شده با [& پایین: 1](../settings/settings.md#settings-log-query-threads) تنظیمات. + +نمایش داده شد در سیستم وارد [سیستم.\_ر\_خروج](../../operations/system-tables.md#system_tables-query-thread-log) جدول, نه در یک فایل جداگانه. شما می توانید نام جدول را در `table` پارامتر (پایین را ببینید). + +از پارامترهای زیر برای پیکربندی ورود استفاده کنید: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [کلید پارتیشن بندی سفارشی](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) برای یک جدول سیستم. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +اگه جدول وجود نداشته باشه. اگر ساختار پرس و جو موضوع ورود به سیستم تغییر زمانی که سرور فاحشه خانه به روز شد, جدول با ساختار قدیمی تغییر نام داد, و یک جدول جدید به طور خودکار ایجاد شده است. + +**مثال** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## \_قطع {#server_configuration_parameters-trace_log} + +تنظیمات برای [\_قطع](../../operations/system-tables.md#system_tables-trace_log) عملیات جدول سیستم. + +پارامترها: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [کلید پارتیشن بندی سفارشی](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) برای یک جدول سیستم. +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +فایل پیکربندی پیش فرض سرور `config.xml` شامل بخش تنظیمات زیر است: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## \_منبع {#query-masking-rules} + +قوانین مبتنی بر عبارت منظم, خواهد شد که به نمایش داده شد و همچنین تمام پیام های ورود به سیستم قبل از ذخیره سازی در سیاهههای مربوط به سرور اعمال, +`system.query_log`, `system.text_log`, `system.processes` جدول, و در سیاهههای مربوط به مشتری ارسال. که اجازه می دهد تا جلوگیری از +نشت اطلاعات حساس از پرس و جو گذاشتن (مانند نام, ایمیل, شخصی +شناسه و یا شماره کارت اعتباری) به سیاهههای مربوط. + +**مثال** + +``` xml + + + hide SSN + (^|\D)\d{3}-\d{2}-\d{4}($|\D) + 000-00-0000 + + +``` + +زمینه پیکربندی: +- `name` - نام قانون (اختیاری) +- `regexp` - تکرار 2 عبارت منظم سازگار (اجباری) +- `replace` - رشته جایگزینی برای داده های حساس (اختیاری به طور پیش فرض-شش ستاره) + +قوانین پوشش به کل پرس و جو اعمال می شود (برای جلوگیری از نشت اطلاعات حساس از نمایش داده شد ناقص / غیر تجزیه). + +`system.events` جدول شمارنده `QueryMaskingRulesMatch` که تعداد کلی از پرس و جو پوشش قوانین مسابقات. + +برای نمایش داده شد توزیع هر سرور باید به طور جداگانه پیکربندی شود, در غیر این صورت, فرعی به دیگر منتقل +گره ها بدون پوشش ذخیره می شوند. + +## دور دور {#server-settings-remote-servers} + +پیکربندی خوشه های مورد استفاده توسط [توزیع شده](../../engines/table-engines/special/distributed.md) موتور جدول و توسط `cluster` تابع جدول. + +**مثال** + +``` xml + +``` + +برای ارزش `incl` ویژگی, بخش را ببینید “[پروندههای پیکربندی](../configuration-files.md#configuration_files)”. + +**همچنین نگاه کنید** + +- [در حال بارگذاری](../settings/settings.md#settings-skip_unavailable_shards) + +## منطقهی زمانی {#server_configuration_parameters-timezone} + +منطقه زمانی سرور. + +مشخص شده به عنوان شناساگر ایانا برای منطقه زمانی یو تی سی یا موقعیت جغرافیایی (مثلا افریقا / ابیجان). + +منطقه زمانی برای تبدیل بین فرمت های رشته و تاریخ ساعت لازم است که زمینه های تاریخ ساعت خروجی به فرمت متن (چاپ شده بر روی صفحه نمایش و یا در یک فایل), و هنگامی که گرفتن تاریخ ساعت از یک رشته. علاوه بر این, منطقه زمانی در توابع است که با زمان و تاریخ کار می کنند در صورتی که منطقه زمانی در پارامترهای ورودی دریافت نمی استفاده. + +**مثال** + +``` xml +Europe/Moscow +``` + +## \_صادر کردن {#server_configuration_parameters-tcp_port} + +پورت برای برقراری ارتباط با مشتریان بیش از پروتکل تی سی پی. + +**مثال** + +``` xml +9000 +``` + +## \_شروع مجدد {#server_configuration_parameters-tcp_port-secure} + +پورت تی سی پی برای برقراری ارتباط امن با مشتریان. با استفاده از [OpenSSL](#server_configuration_parameters-openssl) تنظیمات. + +**مقادیر ممکن** + +عدد صحیح مثبت. + +**مقدار پیشفرض** + +``` xml +9440 +``` + +## \_وارد کردن {#server_configuration_parameters-mysql_port} + +پورت برای برقراری ارتباط با مشتریان بیش از پروتکل خروجی زیر. + +**مقادیر ممکن** + +عدد صحیح مثبت. + +مثال + +``` xml +9004 +``` + +## \_مخفی کردن {#server-settings-tmp_path} + +مسیر به داده های موقت برای پردازش نمایش داده شد بزرگ است. + +!!! note "یادداشت" + اسلش الزامی است. + +**مثال** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## پیدا کردن موقعیت جغرافیایی از روی شبکه {#server-settings-tmp-policy} + +سیاست از [`storage_configuration`](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) برای ذخیره فایل های موقت. +اگر تنظیم نشود [`tmp_path`](#server-settings-tmp_path) استفاده شده است, در غیر این صورت نادیده گرفته شده است. + +!!! note "یادداشت" + - `move_factor` نادیده گرفته شده است +- `keep_free_space_bytes` نادیده گرفته شده است +- `max_data_part_size_bytes` نادیده گرفته شده است +- شما باید دقیقا یک جلد در این سیاست داشته باشید + +## \_بالا {#server-settings-uncompressed_cache_size} + +اندازه کش (به بایت) برای داده های غیر فشرده استفاده شده توسط موتورهای جدول از [ادغام](../../engines/table-engines/mergetree-family/mergetree.md). + +یک کش مشترک برای سرور وجود دارد. حافظه در تقاضا اختصاص داده. کش در صورتی که گزینه استفاده می شود [همترازی پایین](../settings/settings.md#setting-use_uncompressed_cache) فعال است. + +کش غیر فشرده سودمند برای نمایش داده شد بسیار کوتاه در موارد فردی است. + +**مثال** + +``` xml +8589934592 +``` + +## \_مخفی کردن \_صفحه {#server_configuration_parameters-user_files_path} + +دایرکتوری با فایل های کاربر. مورد استفاده در تابع جدول [پرونده()](../../sql-reference/table-functions/file.md). + +**مثال** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## \_تنفورد {#users-config} + +مسیر پروندهی شامل: + +- تنظیمات کاربر. +- حقوق دسترسی. +- پروفایل تنظیمات. +- تنظیمات سهمیه. + +**مثال** + +``` xml +users.xml +``` + +## باغ وحش {#server-settings_zookeeper} + +شامل تنظیماتی است که اجازه می دهد تا کلیک برای ارتباط برقرار کردن با یک [باغ وحش](http://zookeeper.apache.org/) خوشه خوشه. + +کلیک هاوس با استفاده از باغ وحش برای ذخیره سازی ابرداده از کپی در هنگام استفاده از جداول تکرار. اگر جداول تکرار استفاده نمی شود, این بخش از پارامترها را می توان حذف. + +این بخش شامل پارامترهای زیر است: + +- `node` — ZooKeeper endpoint. You can set multiple endpoints. + + به عنوان مثال: + + + +``` xml + + example_host + 2181 + +``` + + The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. + +- `session_timeout` — Maximum timeout for the client session in milliseconds. +- `root` — The [حالت](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) استفاده شده است که به عنوان ریشه برای znodes استفاده شده توسط ClickHouse سرور. اختیاری. +- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. + +**پیکربندی نمونه** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + 10000 + + /path/to/zookeeper/node + + user:password + +``` + +**همچنین نگاه کنید** + +- [تکرار](../../engines/table-engines/mergetree-family/replication.md) +- [راهنمای برنامه نویس باغ وحش](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## سرویس پرداخت درونبرنامهای پلی {#server-settings-use_minimalistic_part_header_in_zookeeper} + +روش ذخیره سازی برای هدر بخش داده ها در باغ وحش. + +این تنظیم فقط در مورد `MergeTree` خانواده این را می توان مشخص کرد: + +- در سطح جهانی در [ادغام](#server_configuration_parameters-merge_tree) بخش از `config.xml` پرونده. + + تاتر با استفاده از تنظیمات برای تمام جداول بر روی سرور. شما می توانید تنظیمات را در هر زمان تغییر دهید. جداول موجود رفتار خود را تغییر دهید زمانی که تنظیمات تغییر می کند. + +- برای هر جدول. + + هنگام ایجاد یک جدول مربوطه را مشخص کنید [تنظیم موتور](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). رفتار یک جدول موجود با این تنظیم تغییر نمی کند, حتی اگر تغییرات تنظیم جهانی. + +**مقادیر ممکن** + +- 0 — Functionality is turned off. +- 1 — Functionality is turned on. + +اگر `use_minimalistic_part_header_in_zookeeper = 1` پس [تکرار](../../engines/table-engines/mergetree-family/replication.md) جداول هدر قطعات داده را با استفاده از یک واحد ذخیره می کنند `znode`. اگر جدول شامل بسیاری از ستون, این روش ذخیره سازی به طور قابل توجهی کاهش می دهد حجم داده های ذخیره شده در باغ وحش. + +!!! attention "توجه" + پس از استفاده از `use_minimalistic_part_header_in_zookeeper = 1` شما نمیتوانید سرور کلیک را به نسخه ای که از این تنظیم پشتیبانی نمی کند ارتقا دهید. مراقب باشید در هنگام به روز رسانی تاتر بر روی سرور در یک خوشه. همه سرورها را در یک زمان ارتقا ندهید. این امن تر است برای تست نسخه های جدید از خانه رعیتی در یک محیط تست, و یا فقط در چند سرور از یک خوشه. + + Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. + +**مقدار پیشفرض:** 0. + +## نمایش سایت {#server-settings-disable-internal-dns-cache} + +غیر فعال کش دی ان اس داخلی. توصیه شده برای کارخانه کلیک در سیستم +با زیرساخت های اغلب در حال تغییر مانند کوبرنتس. + +**مقدار پیشفرض:** 0. + +## پیدا کردن موقعیت جغرافیایی از روی شبکه {#server-settings-dns-cache-update-period} + +دوره به روز رسانی نشانی های اینترنتی ذخیره شده در کش دی ان اس داخلی خانه (در ثانیه). +به روز رسانی همزمان انجام, در یک موضوع سیستم جداگانه. + +**مقدار پیشفرض**: 15. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/fa/operations/server_configuration_parameters/index.md b/docs/fa/operations/server_configuration_parameters/index.md deleted file mode 100644 index 308eb9cc8b3..00000000000 --- a/docs/fa/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Server Configuration Parameters -toc_priority: 54 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# پارامترهای پیکربندی سرور {#server-settings} - -این بخش شامل شرح تنظیمات سرور است که نمی تواند در سطح جلسه یا پرس و جو تغییر کند. - -این تنظیمات در ذخیره می شود `config.xml` فایل بر روی سرور کلیک. - -تنظیمات دیگر در توصیف “[تنظیمات](../settings/index.md#settings)” بخش. - -قبل از مطالعه تنظیمات, خواندن [پروندههای پیکربندی](../configuration_files.md#configuration_files) بخش و توجه داشته باشید استفاده از تعویض ( `incl` و `optional` صفات). - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/fa/operations/server_configuration_parameters/settings.md b/docs/fa/operations/server_configuration_parameters/settings.md deleted file mode 100644 index a99799b59b9..00000000000 --- a/docs/fa/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,873 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 57 -toc_title: "\u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u06A9\u0627\u0631\u06AF\u0632\ - \u0627\u0631" ---- - -# تنظیمات کارگزار {#server-settings} - -## ساختن و احراز هویت اکانتهای دستگاه {#builtin-dictionaries-reload-interval} - -فاصله در ثانیه قبل از بارگذاری ساخته شده است در لغت نامه. - -مخزن بارگذاری مجدد ساخته شده است در لغت نامه در هر ثانیه ایکس. این امکان ویرایش واژهنامهها را فراهم میکند “on the fly” بدون راه اندازی مجدد سرور. - -مقدار پیش فرض: 3600. - -**مثال** - -``` xml -3600 -``` - -## فشردهسازی {#server-settings-compression} - -تنظیمات فشرده سازی داده ها برای [ادغام](../../engines/table_engines/mergetree_family/mergetree.md)- جدول موتور . - -!!! warning "اخطار" - اگر شما فقط شروع به استفاده از خانه کلیک استفاده نکنید. - -قالب پیکربندی: - -``` xml - - - ... - ... - ... - - ... - -``` - -`` زمینه: - -- `min_part_size` – The minimum size of a data part. -- `min_part_size_ratio` – The ratio of the data part size to the table size. -- `method` – Compression method. Acceptable values: `lz4` یا `zstd`. - -شما می توانید چند پیکربندی کنید `` بخش. - -اقدامات زمانی که شرایط ملاقات می شوند: - -- اگر بخشی از داده ها منطبق یک مجموعه شرایط, تاتر با استفاده از روش فشرده سازی مشخص. -- اگر یک بخش داده منطبق مجموعه شرایط متعدد, خانه رعیتی با استفاده از اولین مجموعه شرایط همسان. - -اگر هیچ شرایطی برای یک بخش داده ملاقات, خانه عروسکی با استفاده از `lz4` فشردهسازی. - -**مثال** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## & تنظیمات {#default-database} - -پایگاه داده به طور پیش فرض. - -برای دریافت یک لیست از پایگاه داده, استفاده از [SHOW DATABASES](../../sql_reference/statements/show.md#show-databases) پرس و جو. - -**مثال** - -``` xml -default -``` - -## قصور {#default-profile} - -تنظیمات پیش فرض مشخصات. - -پروفایل های تنظیمات در فایل مشخص شده در پارامتر واقع شده است `user_config`. - -**مثال** - -``` xml -default -``` - -## دیکشنامهای {#server_configuration_parameters-dictionaries_config} - -مسیر به فایل پیکربندی برای لغت نامه های خارجی. - -مسیر: - -- مشخص کردن مسیر مطلق و یا مسیر نسبت به فایل پیکربندی سرور. -- مسیر می تواند حاوی نویسه عام \* و?. - -همچنین نگاه کنید به “[واژهنامهها خارجی](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)”. - -**مثال** - -``` xml -*_dictionary.xml -``` - -## \_بارگیری کامل {#server_configuration_parameters-dictionaries_lazy_load} - -بارگذاری تنبل از لغت نامه. - -اگر `true` سپس هر فرهنگ لغت در اولین استفاده ایجاد می شود. اگر ایجاد فرهنگ لغت شکست خورده, تابع بود که با استفاده از فرهنگ لغت می اندازد یک استثنا. - -اگر `false`, تمام لغت نامه ها ایجاد می شوند زمانی که سرور شروع می شود, و اگر یک خطا وجود دارد, سرور خاموش. - -به طور پیش فرض است `true`. - -**مثال** - -``` xml -true -``` - -## قالب\_شکلمات شیمی {#server_configuration_parameters-format_schema_path} - -مسیر به دایرکتوری با طرح برای داده های ورودی, مانند طرحواره برای [کاپپروتو](../../interfaces/formats.md#capnproto) قالب. - -**مثال** - -``` xml - - format_schemas/ -``` - -## گرافیت {#server_configuration_parameters-graphite} - -ارسال داده به [گرافیت](https://github.com/graphite-project). - -تنظیمات: - -- host – The Graphite server. -- port – The port on the Graphite server. -- interval – The interval for sending, in seconds. -- timeout – The timeout for sending data, in seconds. -- root\_path – Prefix for keys. -- metrics – Sending data from the [سیستم.متریک](../../operations/system_tables.md#system_tables-metrics) جدول -- events – Sending deltas data accumulated for the time period from the [سیستم.رویدادها](../../operations/system_tables.md#system_tables-events) جدول -- events\_cumulative – Sending cumulative data from the [سیستم.رویدادها](../../operations/system_tables.md#system_tables-events) جدول -- asynchronous\_metrics – Sending data from the [سیستم.\_نامهنویسی ناهمزمان](../../operations/system_tables.md#system_tables-asynchronous_metrics) جدول - -شما می توانید چند پیکربندی کنید `` بند. برای مثال شما می توانید از این برای ارسال داده های مختلف در فواصل مختلف استفاده کنید. - -**مثال** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## لغزش \_ نمودار {#server_configuration_parameters-graphite-rollup} - -تنظیمات برای نازک شدن داده ها برای گرافیت. - -برای اطلاعات بیشتر, دیدن [نمودار](../../engines/table_engines/mergetree_family/graphitemergetree.md). - -**مثال** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## \_وارد کردن/پشتیبانی {#http-porthttps-port} - -درگاه برای اتصال به کارساز بالای صفحه) ها (. - -اگر `https_port` مشخص شده است, [openSSL](#server_configuration_parameters-openssl) باید پیکربندی شود. - -اگر `http_port` مشخص شده است, پیکربندی اپنسسل نادیده گرفته شده است حتی اگر قرار است. - -**مثال** - -``` xml -0000 -``` - -## نقلقولهای جدید از این نویسنده {#server_configuration_parameters-http_server_default_response} - -صفحه ای که به طور پیش فرض نشان داده شده است زمانی که شما دسترسی به سرور قام کلیک. -مقدار پیش فرض است “Ok.” (با خوراک خط در پایان) - -**مثال** - -باز می شود `https://tabix.io/` هنگام دسترسی `http://localhost: http_port`. - -``` xml - -
]]> -
-``` - -## include\_from {#server_configuration_parameters-include_from} - -مسیر به فایل با تعویض. - -برای کسب اطلاعات بیشتر به بخش مراجعه کنید “[پروندههای پیکربندی](../configuration_files.md#configuration_files)”. - -**مثال** - -``` xml -/etc/metrica.xml -``` - -## \_صادر کردن {#interserver-http-port} - -پورت برای تبادل اطلاعات بین سرور های فاحشه خانه. - -**مثال** - -``` xml -9009 -``` - -## حذف جستجو {#interserver-http-host} - -نام میزبان است که می تواند توسط سرور های دیگر برای دسترسی به این سرور استفاده می شود. - -اگر حذف, این است که در همان راه به عنوان تعریف `hostname-f` فرمان. - -مفید برای شکستن دور از یک رابط شبکه خاص. - -**مثال** - -``` xml -example.yandex.ru -``` - -## پتانسیلهای متقابل {#server-settings-interserver-http-credentials} - -نام کاربری و رمز عبور مورد استفاده برای تصدیق در طول [تکرار](../../engines/table_engines/mergetree_family/replication.md) با تکرار \* موتورهای. این اعتبار تنها برای ارتباط بین کپی استفاده می شود و ربطی به اعتبار برای مشتریان خانه عروسکی هستند. سرور چک کردن این اعتبار برای اتصال کپی و استفاده از اعتبار همان هنگام اتصال به دیگر کپی. بنابراین, این اعتبار باید همین کار را برای همه کپی در یک خوشه مجموعه. -به طور پیش فرض احراز هویت استفاده نمی شود. - -این بخش شامل پارامترهای زیر است: - -- `user` — username. -- `password` — password. - -**مثال** - -``` xml - - admin - 222 - -``` - -## حفاظت از حریم خصوصی {#keep-alive-timeout} - -تعداد ثانیه که تاتر منتظر درخواست های دریافتی قبل از بستن اتصال. به طور پیش فرض به 3 ثانیه. - -**مثال** - -``` xml -3 -``` - -## \_نوست فهرست {#server_configuration_parameters-listen_host} - -محدودیت در میزبان که درخواست می توانید از. اگر می خواهید سرور برای پاسخ به همه انها مشخص شود `::`. - -مثالها: - -``` xml -::1 -127.0.0.1 -``` - -## چوبگر {#server_configuration_parameters-logger} - -تنظیمات ورود به سیستم. - -کلید: - -- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. -- log – The log file. Contains all the entries according to `level`. -- errorlog – Error log file. -- size – Size of the file. Applies to `log`و`errorlog`. هنگامی که فایل می رسد `size`, بایگانی کلیک هوس و تغییر نام, و ایجاد یک فایل ورود به سیستم جدید را در خود جای. -- count – The number of archived log files that ClickHouse stores. - -**مثال** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -نوشتن به وبلاگ نیز پشتیبانی می کند. پیکربندی مثال: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -کلید: - -- use\_syslog — Required setting if you want to write to the syslog. -- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. -- hostname — Optional. The name of the host that logs are sent from. -- facility — [کلمه کلیدی تسهیلات سیسلوگ](https://en.wikipedia.org/wiki/Syslog#Facility) در حروف بزرگ با “LOG\_” پیشوند: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`, و به همین ترتیب). - مقدار پیشفرض: `LOG_USER` اگر `address` مشخص شده است, `LOG_DAEMON otherwise.` -- format – Message format. Possible values: `bsd` و `syslog.` - -## & کلاندارها {#macros} - -تعویض پارامتر برای جداول تکرار. - -می توان حذف اگر جداول تکرار استفاده نمی شود. - -برای کسب اطلاعات بیشتر به بخش مراجعه کنید “[ایجاد جداول تکرار شده](../../engines/table_engines/mergetree_family/replication.md)”. - -**مثال** - -``` xml - -``` - -## نشاندار کردن \_چ\_سیز {#server-mark-cache-size} - -اندازه تقریبی (به بایت) کش علامت های استفاده شده توسط موتورهای جدول [ادغام](../../engines/table_engines/mergetree_family/mergetree.md) خانواده - -کش برای سرور به اشتراک گذاشته و حافظه به عنوان مورد نیاز اختصاص داده است. اندازه کش باید حداقل 5368709120 باشد. - -**مثال** - -``` xml -5368709120 -``` - -## م\_قیاس تصویر {#max-concurrent-queries} - -حداکثر تعداد درخواست به طور همزمان پردازش. - -**مثال** - -``` xml -100 -``` - -## \_تنامههای بیشینه {#max-connections} - -حداکثر تعداد اتصالات ورودی. - -**مثال** - -``` xml -4096 -``` - -## \_موضوعات بیشینه {#max-open-files} - -حداکثر تعداد فایل های باز. - -به طور پیش فرض: `maximum`. - -ما توصیه می کنیم با استفاده از این گزینه در سیستم عامل مک ایکس از `getrlimit()` تابع یک مقدار نادرست می گرداند. - -**مثال** - -``` xml -262144 -``` - -## حداکثر\_طب\_ضز\_توقف {#max-table-size-to-drop} - -محدودیت در حذف جداول. - -اگر اندازه یک [ادغام](../../engines/table_engines/mergetree_family/mergetree.md) جدول بیش از `max_table_size_to_drop` با استفاده از پرس و جو قطره نمی توانید حذف کنید. - -اگر شما هنوز هم نیاز به حذف جدول بدون راه اندازی مجدد سرور کلیک, ایجاد `/flags/force_drop_table` فایل و اجرای پرس و جو قطره. - -مقدار پیش فرض: 50 گیگابایت. - -ارزش 0 بدان معنی است که شما می توانید تمام جداول بدون هیچ گونه محدودیت حذف. - -**مثال** - -``` xml -0 -``` - -## ادغام {#server_configuration_parameters-merge_tree} - -تنظیم زیبا برای جداول در [ادغام](../../engines/table_engines/mergetree_family/mergetree.md). - -برای کسب اطلاعات بیشتر, دیدن ادغام.فایل هدر ساعت. - -**مثال** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -SSL client/server configuration. - -پشتیبانی از اس اس ال توسط `libpoco` کتابخونه. رابط در فایل شرح داده شده است [سوسمنگر.ه](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -کلید برای تنظیمات سرور / مشتری: - -- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. -- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` شامل گواهی. -- caConfig – The path to the file or directory that contains trusted root certificates. -- verificationMode – The method for checking the node's certificates. Details are in the description of the [متن](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) کلاس. مقادیر ممکن: `none`, `relaxed`, `strict`, `once`. -- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. -- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| -- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. مقادیر قابل قبول: `true`, `false`. -- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. این پارامتر همیشه توصیه می شود از این کمک می کند تا جلوگیری از مشکلات هر دو اگر سرور حافظه پنهان جلسه و اگر مشتری درخواست ذخیره. مقدار پیشفرض: `${application.name}`. -- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. -- sessionTimeout – Time for caching the session on the server. -- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. -- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. -- fips – Activates OpenSSL FIPS mode. Supported if the library's OpenSSL version supports FIPS. -- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . -- disableProtocols – Protocols that are not allowed to use. -- preferServerCiphers – Preferred server ciphers on the client. - -**مثال تنظیمات:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## \_خروج {#server_configuration_parameters-part-log} - -وقایع ورود به سیستم که با مرتبط [ادغام](../../engines/table_engines/mergetree_family/mergetree.md). برای مثال, اضافه کردن یا ادغام داده ها. شما می توانید ورود به سیستم برای شبیه سازی الگوریتم های ادغام و مقایسه ویژگی های خود استفاده کنید. شما می توانید روند ادغام تجسم. - -نمایش داده شد در سیستم وارد [سیستم.\_خروج](../../operations/system_tables.md#system_tables-part-log) جدول, نه در یک فایل جداگانه. شما می توانید نام این جدول را در پیکربندی `table` پارامتر (پایین را ببینید). - -از پارامترهای زیر برای پیکربندی ورود استفاده کنید: - -- `database` – Name of the database. -- `table` – Name of the system table. -- `partition_by` – Sets a [کلید پارتیشن بندی سفارشی](../../engines/table_engines/mergetree_family/custom_partitioning_key.md). -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -**مثال** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## مسیر {#server_configuration_parameters-path} - -مسیر به دایرکتوری حاوی داده. - -!!! note "یادداشت" - اسلش الزامی است. - -**مثال** - -``` xml -/var/lib/clickhouse/ -``` - -## \_خروج {#server_configuration_parameters-query-log} - -تنظیم برای ورود به سیستم نمایش داده شد با دریافت [\_ترکیب = 1](../settings/settings.md) تنظیمات. - -نمایش داده شد در سیستم وارد [سیستم.\_خروج](../../operations/system_tables.md#system_tables-query_log) جدول, نه در یک فایل جداگانه. شما می توانید نام جدول را در `table` پارامتر (پایین را ببینید). - -از پارامترهای زیر برای پیکربندی ورود استفاده کنید: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [کلید پارتیشن بندی سفارشی](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) برای یک جدول. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -اگه جدول وجود نداشته باشه. اگر ساختار ورود به سیستم پرس و جو تغییر زمانی که سرور فاحشه خانه به روز شد, جدول با ساختار قدیمی تغییر نام داد, و یک جدول جدید به طور خودکار ایجاد شده است. - -**مثال** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## \_ر\_خروج {#server_configuration_parameters-query-thread-log} - -تنظیم برای ورود به سیستم موضوعات نمایش داده شد دریافت شده با [& پایین: 1](../settings/settings.md#settings-log-query-threads) تنظیمات. - -نمایش داده شد در سیستم وارد [سیستم.\_ر\_خروج](../../operations/system_tables.md#system_tables-query-thread-log) جدول, نه در یک فایل جداگانه. شما می توانید نام جدول را در `table` پارامتر (پایین را ببینید). - -از پارامترهای زیر برای پیکربندی ورود استفاده کنید: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [کلید پارتیشن بندی سفارشی](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) برای یک جدول سیستم. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -اگه جدول وجود نداشته باشه. اگر ساختار پرس و جو موضوع ورود به سیستم تغییر زمانی که سرور فاحشه خانه به روز شد, جدول با ساختار قدیمی تغییر نام داد, و یک جدول جدید به طور خودکار ایجاد شده است. - -**مثال** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## \_قطع {#server_configuration_parameters-trace_log} - -تنظیمات برای [\_قطع](../../operations/system_tables.md#system_tables-trace_log) عملیات جدول سیستم. - -پارامترها: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [کلید پارتیشن بندی سفارشی](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) برای یک جدول سیستم. -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -فایل پیکربندی پیش فرض سرور `config.xml` شامل بخش تنظیمات زیر است: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## \_منبع {#query-masking-rules} - -قوانین مبتنی بر عبارت منظم, خواهد شد که به نمایش داده شد و همچنین تمام پیام های ورود به سیستم قبل از ذخیره سازی در سیاهههای مربوط به سرور اعمال, -`system.query_log`, `system.text_log`, `system.processes` جدول, و در سیاهههای مربوط به مشتری ارسال. که اجازه می دهد تا جلوگیری از -نشت اطلاعات حساس از پرس و جو گذاشتن (مانند نام, ایمیل, شخصی -شناسه و یا شماره کارت اعتباری) به سیاهههای مربوط. - -**مثال** - -``` xml - - - hide SSN - (^|\D)\d{3}-\d{2}-\d{4}($|\D) - 000-00-0000 - - -``` - -زمینه پیکربندی: -- `name` - نام قانون (اختیاری) -- `regexp` - تکرار 2 عبارت منظم سازگار (اجباری) -- `replace` - رشته جایگزینی برای داده های حساس (اختیاری به طور پیش فرض-شش ستاره) - -قوانین پوشش به کل پرس و جو اعمال می شود (برای جلوگیری از نشت اطلاعات حساس از نمایش داده شد ناقص / غیر تجزیه). - -`system.events` جدول شمارنده `QueryMaskingRulesMatch` که تعداد کلی از پرس و جو پوشش قوانین مسابقات. - -برای نمایش داده شد توزیع هر سرور باید به طور جداگانه پیکربندی شود, در غیر این صورت, فرعی به دیگر منتقل -گره ها بدون پوشش ذخیره می شوند. - -## دور دور {#server-settings-remote-servers} - -پیکربندی خوشه های مورد استفاده توسط [توزیع شده](../../engines/table_engines/special/distributed.md) موتور جدول و توسط `cluster` تابع جدول. - -**مثال** - -``` xml - -``` - -برای ارزش `incl` ویژگی, بخش را ببینید “[پروندههای پیکربندی](../configuration_files.md#configuration_files)”. - -**همچنین نگاه کنید** - -- [در حال بارگذاری](../settings/settings.md#settings-skip_unavailable_shards) - -## منطقهی زمانی {#server_configuration_parameters-timezone} - -منطقه زمانی سرور. - -مشخص شده به عنوان شناساگر ایانا برای منطقه زمانی یو تی سی یا موقعیت جغرافیایی (مثلا افریقا / ابیجان). - -منطقه زمانی برای تبدیل بین فرمت های رشته و تاریخ ساعت لازم است که زمینه های تاریخ ساعت خروجی به فرمت متن (چاپ شده بر روی صفحه نمایش و یا در یک فایل), و هنگامی که گرفتن تاریخ ساعت از یک رشته. علاوه بر این, منطقه زمانی در توابع است که با زمان و تاریخ کار می کنند در صورتی که منطقه زمانی در پارامترهای ورودی دریافت نمی استفاده. - -**مثال** - -``` xml -Europe/Moscow -``` - -## \_صادر کردن {#server_configuration_parameters-tcp_port} - -پورت برای برقراری ارتباط با مشتریان بیش از پروتکل تی سی پی. - -**مثال** - -``` xml -9000 -``` - -## \_شروع مجدد {#server_configuration_parameters-tcp_port-secure} - -پورت تی سی پی برای برقراری ارتباط امن با مشتریان. با استفاده از [OpenSSL](#server_configuration_parameters-openssl) تنظیمات. - -**مقادیر ممکن** - -عدد صحیح مثبت. - -**مقدار پیشفرض** - -``` xml -9440 -``` - -## \_وارد کردن {#server_configuration_parameters-mysql_port} - -پورت برای برقراری ارتباط با مشتریان بیش از پروتکل خروجی زیر. - -**مقادیر ممکن** - -عدد صحیح مثبت. - -مثال - -``` xml -9004 -``` - -## \_مخفی کردن {#server-settings-tmp_path} - -مسیر به داده های موقت برای پردازش نمایش داده شد بزرگ است. - -!!! note "یادداشت" - اسلش الزامی است. - -**مثال** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## پیدا کردن موقعیت جغرافیایی از روی شبکه {#server-settings-tmp-policy} - -سیاست از [`storage_configuration`](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) برای ذخیره فایل های موقت. -اگر تنظیم نشود [`tmp_path`](#server-settings-tmp_path) استفاده شده است, در غیر این صورت نادیده گرفته شده است. - -!!! note "یادداشت" - - `move_factor` نادیده گرفته شده است -- `keep_free_space_bytes` نادیده گرفته شده است -- `max_data_part_size_bytes` نادیده گرفته شده است -- شما باید دقیقا یک جلد در این سیاست داشته باشید - -## \_بالا {#server-settings-uncompressed_cache_size} - -اندازه کش (به بایت) برای داده های غیر فشرده استفاده شده توسط موتورهای جدول از [ادغام](../../engines/table_engines/mergetree_family/mergetree.md). - -یک کش مشترک برای سرور وجود دارد. حافظه در تقاضا اختصاص داده. کش در صورتی که گزینه استفاده می شود [همترازی پایین](../settings/settings.md#setting-use_uncompressed_cache) فعال است. - -کش غیر فشرده سودمند برای نمایش داده شد بسیار کوتاه در موارد فردی است. - -**مثال** - -``` xml -8589934592 -``` - -## \_مخفی کردن \_صفحه {#server_configuration_parameters-user_files_path} - -دایرکتوری با فایل های کاربر. مورد استفاده در تابع جدول [پرونده()](../../sql_reference/table_functions/file.md). - -**مثال** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## \_تنفورد {#users-config} - -مسیر پروندهی شامل: - -- تنظیمات کاربر. -- حقوق دسترسی. -- پروفایل تنظیمات. -- تنظیمات سهمیه. - -**مثال** - -``` xml -users.xml -``` - -## باغ وحش {#server-settings_zookeeper} - -شامل تنظیماتی است که اجازه می دهد تا کلیک برای ارتباط برقرار کردن با یک [باغ وحش](http://zookeeper.apache.org/) خوشه خوشه. - -کلیک هاوس با استفاده از باغ وحش برای ذخیره سازی ابرداده از کپی در هنگام استفاده از جداول تکرار. اگر جداول تکرار استفاده نمی شود, این بخش از پارامترها را می توان حذف. - -این بخش شامل پارامترهای زیر است: - -- `node` — ZooKeeper endpoint. You can set multiple endpoints. - - به عنوان مثال: - - - -``` xml - - example_host - 2181 - -``` - - The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. - -- `session_timeout` — Maximum timeout for the client session in milliseconds. -- `root` — The [حالت](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) استفاده شده است که به عنوان ریشه برای znodes استفاده شده توسط ClickHouse سرور. اختیاری. -- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. - -**پیکربندی نمونه** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - 10000 - - /path/to/zookeeper/node - - user:password - -``` - -**همچنین نگاه کنید** - -- [تکرار](../../engines/table_engines/mergetree_family/replication.md) -- [راهنمای برنامه نویس باغ وحش](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## سرویس پرداخت درونبرنامهای پلی {#server-settings-use_minimalistic_part_header_in_zookeeper} - -روش ذخیره سازی برای هدر بخش داده ها در باغ وحش. - -این تنظیم فقط در مورد `MergeTree` خانواده این را می توان مشخص کرد: - -- در سطح جهانی در [ادغام](#server_configuration_parameters-merge_tree) بخش از `config.xml` پرونده. - - تاتر با استفاده از تنظیمات برای تمام جداول بر روی سرور. شما می توانید تنظیمات را در هر زمان تغییر دهید. جداول موجود رفتار خود را تغییر دهید زمانی که تنظیمات تغییر می کند. - -- برای هر جدول. - - هنگام ایجاد یک جدول مربوطه را مشخص کنید [تنظیم موتور](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). رفتار یک جدول موجود با این تنظیم تغییر نمی کند, حتی اگر تغییرات تنظیم جهانی. - -**مقادیر ممکن** - -- 0 — Functionality is turned off. -- 1 — Functionality is turned on. - -اگر `use_minimalistic_part_header_in_zookeeper = 1` پس [تکرار](../../engines/table_engines/mergetree_family/replication.md) جداول هدر قطعات داده را با استفاده از یک واحد ذخیره می کنند `znode`. اگر جدول شامل بسیاری از ستون, این روش ذخیره سازی به طور قابل توجهی کاهش می دهد حجم داده های ذخیره شده در باغ وحش. - -!!! attention "توجه" - پس از استفاده از `use_minimalistic_part_header_in_zookeeper = 1` شما نمیتوانید سرور کلیک را به نسخه ای که از این تنظیم پشتیبانی نمی کند ارتقا دهید. مراقب باشید در هنگام به روز رسانی تاتر بر روی سرور در یک خوشه. همه سرورها را در یک زمان ارتقا ندهید. این امن تر است برای تست نسخه های جدید از خانه رعیتی در یک محیط تست, و یا فقط در چند سرور از یک خوشه. - - Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. - -**مقدار پیشفرض:** 0. - -## نمایش سایت {#server-settings-disable-internal-dns-cache} - -غیر فعال کش دی ان اس داخلی. توصیه شده برای کارخانه کلیک در سیستم -با زیرساخت های اغلب در حال تغییر مانند کوبرنتس. - -**مقدار پیشفرض:** 0. - -## پیدا کردن موقعیت جغرافیایی از روی شبکه {#server-settings-dns-cache-update-period} - -دوره به روز رسانی نشانی های اینترنتی ذخیره شده در کش دی ان اس داخلی خانه (در ثانیه). -به روز رسانی همزمان انجام, در یک موضوع سیستم جداگانه. - -**مقدار پیشفرض**: 15. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/fa/operations/settings/constraints_on_settings.md b/docs/fa/operations/settings/constraints-on-settings.md similarity index 100% rename from docs/fa/operations/settings/constraints_on_settings.md rename to docs/fa/operations/settings/constraints-on-settings.md diff --git a/docs/fa/operations/settings/permissions-for-queries.md b/docs/fa/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..764302a65ec --- /dev/null +++ b/docs/fa/operations/settings/permissions-for-queries.md @@ -0,0 +1,62 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 58 +toc_title: "\u0645\u062C\u0648\u0632 \u0628\u0631\u0627\u06CC \u0646\u0645\u0627\u06CC\ + \u0634 \u062F\u0627\u062F\u0647 \u0634\u062F" +--- + +# مجوز برای نمایش داده شد {#permissions_for_queries} + +نمایش داده شد در کلیک خانه را می توان به انواع مختلفی تقسیم شده است: + +1. خواندن نمایش داده شد داده: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. نوشتن نمایش داده شد داده ها: `INSERT`, `OPTIMIZE`. +3. تغییر پرسوجوی تنظیمات: `SET`, `USE`. +4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) نمایش داده شد: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +تنظیمات زیر تنظیم مجوز کاربر بر اساس نوع پرس و جو: + +- [فقط خواندنی](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. +- [اجازه دادن به \_نشانی](#settings_allow_ddl) — Restricts permissions for DDL queries. + +`KILL QUERY` را می توان با هر تنظیمات انجام می شود. + +## فقط خواندنی {#settings_readonly} + +محدود مجوز برای خواندن داده ها, نوشتن داده ها و تغییر تنظیمات نمایش داده شد. + +ببینید که چگونه نمایش داده شد به انواع تقسیم [بالا](#permissions_for_queries). + +مقادیر ممکن: + +- 0 — All queries are allowed. +- 1 — Only read data queries are allowed. +- 2 — Read data and change settings queries are allowed. + +پس از تنظیم `readonly = 1` کاربر نمیتواند تغییر کند `readonly` و `allow_ddl` تنظیمات در جلسه فعلی. + +هنگام استفاده از `GET` روش در [رابط قام](../../interfaces/http.md), `readonly = 1` به طور خودکار تنظیم شده است. برای تغییر داده ها از `POST` روش. + +تنظیم `readonly = 1` منع کاربر از تغییر تمام تنظیمات. یک راه برای منع کاربر وجود دارد +از تغییر تنظیمات تنها خاص, برای اطلاعات بیشتر ببینید [محدودیت در تنظیمات](constraints-on-settings.md). + +مقدار پیشفرض: 0 + +## اجازه دادن به \_نشانی {#settings_allow_ddl} + +اجازه می دهد یا رد می کند [DDL](https://en.wikipedia.org/wiki/Data_definition_language) نمایش داده شد. + +ببینید که چگونه نمایش داده شد به انواع تقسیم [بالا](#permissions_for_queries). + +مقادیر ممکن: + +- 0 — DDL queries are not allowed. +- 1 — DDL queries are allowed. + +شما نمی توانید اجرا کنید `SET allow_ddl = 1` اگر `allow_ddl = 0` برای جلسه فعلی. + +مقدار پیشفرض: 1 + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/fa/operations/settings/permissions_for_queries.md b/docs/fa/operations/settings/permissions_for_queries.md deleted file mode 100644 index f8596d44792..00000000000 --- a/docs/fa/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 58 -toc_title: "\u0645\u062C\u0648\u0632 \u0628\u0631\u0627\u06CC \u0646\u0645\u0627\u06CC\ - \u0634 \u062F\u0627\u062F\u0647 \u0634\u062F" ---- - -# مجوز برای نمایش داده شد {#permissions_for_queries} - -نمایش داده شد در کلیک خانه را می توان به انواع مختلفی تقسیم شده است: - -1. خواندن نمایش داده شد داده: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. نوشتن نمایش داده شد داده ها: `INSERT`, `OPTIMIZE`. -3. تغییر پرسوجوی تنظیمات: `SET`, `USE`. -4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) نمایش داده شد: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -تنظیمات زیر تنظیم مجوز کاربر بر اساس نوع پرس و جو: - -- [فقط خواندنی](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. -- [اجازه دادن به \_نشانی](#settings_allow_ddl) — Restricts permissions for DDL queries. - -`KILL QUERY` را می توان با هر تنظیمات انجام می شود. - -## فقط خواندنی {#settings_readonly} - -محدود مجوز برای خواندن داده ها, نوشتن داده ها و تغییر تنظیمات نمایش داده شد. - -ببینید که چگونه نمایش داده شد به انواع تقسیم [بالا](#permissions_for_queries). - -مقادیر ممکن: - -- 0 — All queries are allowed. -- 1 — Only read data queries are allowed. -- 2 — Read data and change settings queries are allowed. - -پس از تنظیم `readonly = 1` کاربر نمیتواند تغییر کند `readonly` و `allow_ddl` تنظیمات در جلسه فعلی. - -هنگام استفاده از `GET` روش در [رابط قام](../../interfaces/http.md), `readonly = 1` به طور خودکار تنظیم شده است. برای تغییر داده ها از `POST` روش. - -تنظیم `readonly = 1` منع کاربر از تغییر تمام تنظیمات. یک راه برای منع کاربر وجود دارد -از تغییر تنظیمات تنها خاص, برای اطلاعات بیشتر ببینید [محدودیت در تنظیمات](constraints_on_settings.md). - -مقدار پیشفرض: 0 - -## اجازه دادن به \_نشانی {#settings_allow_ddl} - -اجازه می دهد یا رد می کند [DDL](https://en.wikipedia.org/wiki/Data_definition_language) نمایش داده شد. - -ببینید که چگونه نمایش داده شد به انواع تقسیم [بالا](#permissions_for_queries). - -مقادیر ممکن: - -- 0 — DDL queries are not allowed. -- 1 — DDL queries are allowed. - -شما نمی توانید اجرا کنید `SET allow_ddl = 1` اگر `allow_ddl = 0` برای جلسه فعلی. - -مقدار پیشفرض: 1 - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/fa/operations/settings/query-complexity.md b/docs/fa/operations/settings/query-complexity.md new file mode 100644 index 00000000000..4bd552d66fd --- /dev/null +++ b/docs/fa/operations/settings/query-complexity.md @@ -0,0 +1,302 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 59 +toc_title: "\u0645\u062D\u062F\u0648\u062F\u06CC\u062A \u062F\u0631 \u067E\u06CC\u0686\ + \u06CC\u062F\u06AF\u06CC \u067E\u0631\u0633 \u0648 \u062C\u0648" +--- + +# محدودیت در پیچیدگی پرس و جو {#restrictions-on-query-complexity} + +محدودیت در پیچیدگی پرس و جو بخشی از تنظیمات. +برای اجرای امن تر از رابط کاربر استفاده می شود. +تقریبا تمام محدودیت ها فقط برای اعمال `SELECT`. برای پردازش پرس و جو توزیع, محدودیت بر روی هر سرور به طور جداگانه اعمال. + +خانه را کلیک کنید چک محدودیت برای قطعات داده, نه برای هر سطر. این بدان معنی است که شما می توانید ارزش محدودیت با اندازه بخش داده ها تجاوز. + +محدودیت در “maximum amount of something” می توانید مقدار را 0, که به معنی “unrestricted”. +اکثر محدودیت ها نیز دارند ‘overflow\_mode’ محیط, به این معنی چه باید بکنید هنگامی که از حد فراتر رفته است. +این می تواند یکی از دو مقدار را: `throw` یا `break`. محدودیت در تجمع (کد \_شورت\_فلو\_وشه گروه) نیز ارزش داشته باشد `any`. + +`throw` – Throw an exception (default). + +`break` – Stop executing the query and return the partial result, as if the source data ran out. + +`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. + +## \_کاساژ بیشینه {#settings_max_memory_usage} + +حداکثر مقدار رم برای استفاده برای اجرای پرس و جو بر روی یک سرور واحد. + +در فایل پیکربندی پیش فرض, حداکثر است 10 گیگابایت. + +تنظیم می کند حجم حافظه در دسترس و یا حجم کل حافظه بر روی دستگاه در نظر نمی. +محدودیت شامل یک پرس و جو تنها در یک سرور. +شما می توانید استفاده کنید `SHOW PROCESSLIST` برای دیدن مصرف حافظه فعلی برای هر پرس و جو. +بعلاوه, مصرف حافظه اوج برای هر پرس و جو ردیابی و نوشته شده به ورود به سیستم. + +استفاده از حافظه برای ایالت های توابع مجموع خاص نظارت نیست. + +استفاده از حافظه به طور کامل برای ایالت ها از توابع کل ردیابی نیست `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` از `String` و `Array` بحث کردن. + +مصرف حافظه نیز توسط پارامترها محدود شده است `max_memory_usage_for_user` و `max_memory_usage_for_all_queries`. + +## \_شمارهگیر بیشینه {#max-memory-usage-for-user} + +حداکثر مقدار رم برای استفاده برای اجرای نمایش داده شد کاربر بر روی یک سرور واحد. + +مقادیر پیش فرض در تعریف [تنظیمات.ه](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L288). به طور پیش فرض مقدار محدود نمی شود (`max_memory_usage_for_user = 0`). + +همچنین نگاه کنید به شرح [\_کاساژ بیشینه](#settings_max_memory_usage). + +## \_شیشه بخاطر \_خروج {#max-memory-usage-for-all-queries} + +حداکثر مقدار رم برای استفاده برای اجرای تمام نمایش داده شد بر روی یک سرور واحد. + +مقادیر پیش فرض در تعریف [تنظیمات.ه](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L289). به طور پیش فرض مقدار محدود نمی شود (`max_memory_usage_for_all_queries = 0`). + +همچنین نگاه کنید به شرح [\_کاساژ بیشینه](#settings_max_memory_usage). + +## \_گذرواژههای \_ورود {#max-rows-to-read} + +محدودیت های زیر را می توان در هر بلوک بررسی (به جای در هر سطر). به این معنا که, محدودیت را می توان شکسته کمی. +هنگامی که در حال اجرا یک پرس و جو در موضوعات مختلف, محدودیت های زیر به هر موضوع اعمال می شود به طور جداگانه. + +حداکثر تعداد ردیف است که می تواند از یک جدول زمانی که در حال اجرا یک پرس و جو به عنوان خوانده شده. + +## \_مخفی کردن {#max-bytes-to-read} + +حداکثر تعداد بایت (داده های غیر فشرده) است که می تواند از یک جدول به عنوان خوانده شده در هنگام اجرای یک پرس و جو. + +## \_ورود به سیستم {#read-overflow-mode} + +چه باید بکنید هنگامی که حجم داده ها به عنوان خوانده شده بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. + +## \_رو\_تو\_گروهها {#settings-max-rows-to-group-by} + +حداکثر تعداد کلید منحصر به فرد دریافت شده از تجمع. این تنظیم به شما امکان مصرف حافظه محدود در هنگام جمع. + +## \_شماره \_شماره گروه {#group-by-overflow-mode} + +چه باید بکنید هنگامی که تعدادی از کلید های منحصر به فرد برای تجمع بیش از حد: ‘throw’, ‘break’ یا ‘any’. به طور پیش فرض, پرتاب. +با استفاده از ‘any’ ارزش شما اجازه می دهد یک تقریب از گروه های اجرا. کیفیت این تقریب بستگی به ماهیت استاتیک داده ها دارد. + +## ا\_فزون\_بر\_گونهی\_گونهی زیر\_گروهها {#settings-max_bytes_before_external_group_by} + +فعالسازی یا غیرفعالسازی اعدام `GROUP BY` بند در حافظه خارجی. ببینید [گروه در حافظه خارجی](../../sql-reference/statements/select.md#select-group-by-in-external-memory). + +مقادیر ممکن: + +- حداکثر حجم رم (به بایت) است که می تواند توسط تک استفاده می شود [GROUP BY](../../sql-reference/statements/select.md#select-group-by-clause) عمل +- 0 — `GROUP BY` در حافظه خارجی غیر فعال. + +مقدار پیش فرض: 0. + +## \_شماره بیشینه {#max-rows-to-sort} + +حداکثر تعداد ردیف قبل از مرتب سازی. این اجازه می دهد تا شما را به محدود کردن مصرف حافظه در هنگام مرتب سازی. + +## ا\_سلایدی {#max-bytes-to-sort} + +حداکثر تعداد بایت قبل از مرتب سازی. + +## کد\_و\_وشهیابی {#sort-overflow-mode} + +چه باید بکنید اگر تعداد ردیف قبل از مرتب سازی دریافت بیش از یکی از محدودیت: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. + +## بارشهای بیشینه {#setting-max_result_rows} + +محدود در تعداد ردیف در نتیجه. همچنین برای زیرمجموعه بررسی, و بر روی سرور از راه دور در هنگام اجرای بخش هایی از یک پرس و جو توزیع. + +## حداکثر\_زمین بایت {#max-result-bytes} + +محدود در تعداد بایت در نتیجه. همان تنظیمات قبلی. + +## \_شماره حاصل {#result-overflow-mode} + +چه باید بکنید اگر حجم نتیجه بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. + +با استفاده از ‘break’ شبیه به استفاده از حد است. `Break` قطع اعدام تنها در سطح بلوک. این به این معنی است که مقدار ردیف بازگشت بیشتر از [بارشهای بیشینه](#setting-max_result_rows) چندین [ت\_مایش بیشینه](settings.md#setting-max_block_size) و بستگی دارد [\_مخفی کردن](settings.md#settings-max_threads). + +مثال: + +``` sql +SET max_threads = 3, max_block_size = 3333; +SET max_result_rows = 3334, result_overflow_mode = 'break'; + +SELECT * +FROM numbers_mt(100000) +FORMAT Null; +``` + +نتیجه: + +``` text +6666 rows in set. ... +``` + +## زمان \_شنامهی حداکثر {#max-execution-time} + +حداکثر زمان اجرای پرس و جو در ثانیه. +در این زمان برای یکی از مراحل مرتب سازی بررسی نمی شود و یا هنگام ادغام و نهایی کردن توابع کلی. + +## \_شروع مجدد {#timeout-overflow-mode} + +چه باید بکنید اگر پرس و جو اجرا می شود بیش از ‘max\_execution\_time’: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. + +## \_شروع مجدد {#min-execution-speed} + +سرعت اجرای حداقل در ردیف در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای پایین تر است, یک استثنا پرتاب می شود. + +## ا\_فزونهها {#min-execution-speed-bytes} + +حداقل تعداد بایت اعدام در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای پایین تر است, یک استثنا پرتاب می شود. + +## حداکثر\_حاقسازی سرعت {#max-execution-speed} + +حداکثر تعداد ردیف اعدام در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای بالا است, سرعت اجرای کاهش خواهد یافت. + +## حداکثر\_کشن\_پیمایههای سرعت {#max-execution-speed-bytes} + +حداکثر تعداد بایت اعدام در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای بالا است, سرعت اجرای کاهش خواهد یافت. + +## جستجو {#timeout-before-checking-execution-speed} + +چک که سرعت اجرای بیش از حد کند نیست (کمتر از ‘min\_execution\_speed’), پس از زمان مشخص شده در ثانیه تمام شده است. + +## \_رنگ \_ورود {#max-columns-to-read} + +حداکثر تعداد ستون است که می تواند از یک جدول در یک پرس و جو به عنوان خوانده شده. اگر پرس و جو نیاز به خواندن تعداد بیشتری از ستون, این می اندازد یک استثنا. + +## \_رنگ بیشینه {#max-temporary-columns} + +حداکثر تعداد ستون موقت است که باید در رم در همان زمان نگه داشته شود که در حال اجرا یک پرس و جو, از جمله ستون ثابت. اگر ستون موقت بیش از این وجود دارد, این یک استثنا می اندازد. + +## \_رنگ {#max-temporary-non-const-columns} + +همان چیزی که به عنوان ‘max\_temporary\_columns’, اما بدون شمارش ستون ثابت. +توجه داشته باشید که ستون های ثابت در حال اجرا یک پرس و جو نسبتا اغلب تشکیل, اما نیاز به حدود صفر منابع محاسباتی. + +## حداکثر {#max-subquery-depth} + +حداکثر عمق تودرتو از کارخانه های فرعی. اگر کارخانه های فرعی عمیق تر, یک استثنا پرتاب می شود. به طور پیش فرض, 100. + +## حداکثر \_پیپیلین {#max-pipeline-depth} + +حداکثر عمق خط لوله. مربوط به تعدادی از تحولات که هر بلوک داده می رود از طریق در طول پردازش پرس و جو. شمارش در محدوده یک سرور واحد. اگر عمق خط لوله بیشتر است, یک استثنا پرتاب می شود. به طور پیش فرض 1000. + +## \_ص\_خلاف {#max-ast-depth} + +حداکثر عمق تودرتو از یک درخت نحوی پرس و جو. اگر بیش از, یک استثنا پرتاب می شود. +در این زمان در تجزیه بررسی نمی شود اما تنها پس از تجزیه پرس و جو. به این معنا که, یک درخت نحوی است که بیش از حد عمیق می تواند در طول تجزیه ایجاد, اما پرس و جو شکست مواجه خواهد شد. به طور پیش فرض 1000. + +## \_محلولات حداکثر {#max-ast-elements} + +حداکثر تعداد عناصر در یک درخت نحوی پرس و جو. اگر بیش از, یک استثنا پرتاب می شود. +در همان راه به عنوان تنظیمات قبلی تنها پس از تجزیه پرس و جو بررسی می شود. به طور پیش فرض 50000. + +## \_رو\_ تنظیم {#max-rows-in-set} + +حداکثر تعداد ردیف برای یک مجموعه داده ها در بند در ایجاد شده از یک خرده فروشی. + +## تنظیم \_سریع {#max-bytes-in-set} + +حداکثر تعداد بایت (داده های غیر فشرده) استفاده شده توسط یک مجموعه در بند در ایجاد شده از یک خرده فروشی. + +## \_حالت تنظیم {#set-overflow-mode} + +چه باید بکنید هنگامی که مقدار داده ها بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. + +## حوزه \_کاربری مکس {#max-rows-in-distinct} + +حداکثر تعداد ردیف های مختلف در هنگام استفاده از متمایز. + +## مک\_بتس\_ حوزه {#max-bytes-in-distinct} + +حداکثر تعداد بایت استفاده شده توسط یک جدول هش در هنگام استفاده متمایز. + +## \_شروع مجدد {#distinct-overflow-mode} + +چه باید بکنید هنگامی که مقدار داده ها بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. + +## ترجمههای بیشینه {#max-rows-to-transfer} + +حداکثر تعداد ردیف است که می تواند به یک سرور از راه دور منتقل می شود و یا ذخیره شده در یک جدول موقت در هنگام استفاده از جهانی در. + +## ترجمههای بیشینه {#max-bytes-to-transfer} + +حداکثر تعداد بایت (داده های غیر فشرده) است که می تواند به یک سرور از راه دور منتقل می شود و یا ذخیره شده در یک جدول موقت در هنگام استفاده از جهانی در. + +## \_شروع مجدد {#transfer-overflow-mode} + +چه باید بکنید هنگامی که مقدار داده ها بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. + +## \_پاک کردن \_روشن گرافیک {#settings-max_rows_in_join} + +محدودیت تعداد ردیف در جدول هش استفاده شده است که در هنگام پیوستن به جداول. + +این تنظیمات در مورد [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) عملیات و [پیوستن](../../engines/table-engines/special/join.md) موتور جدول. + +اگر یک پرس و جو شامل چند می پیوندد, خانه چک این تنظیم برای هر نتیجه متوسط. + +تاتر می توانید با اقدامات مختلف ادامه دهید زمانی که از حد رسیده است. استفاده از [\_شروع مجدد](#settings-join_overflow_mode) تنظیم برای انتخاب عمل. + +مقادیر ممکن: + +- عدد صحیح مثبت. +- 0 — Unlimited number of rows. + +مقدار پیش فرض: 0. + +## \_پویش همیشگی {#settings-max_bytes_in_join} + +محدودیت اندازه در بایت از جدول هش استفاده می شود در هنگام پیوستن به جداول. + +این تنظیمات در مورد [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) عملیات و [پیوستن به موتور جدول](../../engines/table-engines/special/join.md). + +اگر پرس و جو شامل می پیوندد, کلیک چک این تنظیمات برای هر نتیجه متوسط. + +تاتر می توانید با اقدامات مختلف ادامه دهید زمانی که از حد رسیده است. استفاده [\_شروع مجدد](#settings-join_overflow_mode) تنظیمات برای انتخاب عمل. + +مقادیر ممکن: + +- عدد صحیح مثبت. +- 0 — Memory control is disabled. + +مقدار پیش فرض: 0. + +## \_شروع مجدد {#settings-join_overflow_mode} + +تعریف می کند که چه عمل کلیک انجام زمانی که هر یک از محدودیت های زیر ملحق رسیده است: + +- [\_پویش همیشگی](#settings-max_bytes_in_join) +- [\_پاک کردن \_روشن گرافیک](#settings-max_rows_in_join) + +مقادیر ممکن: + +- `THROW` — ClickHouse throws an exception and breaks operation. +- `BREAK` — ClickHouse breaks operation and doesn’t throw an exception. + +مقدار پیشفرض: `THROW`. + +**همچنین نگاه کنید** + +- [پیوستن بند](../../sql-reference/statements/select.md#select-join) +- [پیوستن به موتور جدول](../../engines/table-engines/special/join.md) + +## \_مسدود کردن بیشینه {#max-partitions-per-insert-block} + +حداکثر تعداد پارتیشن در یک بلوک قرار داده شده را محدود می کند. + +- عدد صحیح مثبت. +- 0 — Unlimited number of partitions. + +مقدار پیش فرض: 100. + +**اطلاعات دقیق** + +هنگام قرار دادن داده ها, تاتر محاسبه تعداد پارتیشن در بلوک قرار داده. اگر تعداد پارتیشن ها بیش از `max_partitions_per_insert_block`, خانه را کلیک می اندازد یک استثنا با متن زیر: + +> “Too many partitions for single INSERT block (more than” اطلاعات دقیق “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/fa/operations/settings/query_complexity.md b/docs/fa/operations/settings/query_complexity.md deleted file mode 100644 index f926e3ced50..00000000000 --- a/docs/fa/operations/settings/query_complexity.md +++ /dev/null @@ -1,302 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 59 -toc_title: "\u0645\u062D\u062F\u0648\u062F\u06CC\u062A \u062F\u0631 \u067E\u06CC\u0686\ - \u06CC\u062F\u06AF\u06CC \u067E\u0631\u0633 \u0648 \u062C\u0648" ---- - -# محدودیت در پیچیدگی پرس و جو {#restrictions-on-query-complexity} - -محدودیت در پیچیدگی پرس و جو بخشی از تنظیمات. -برای اجرای امن تر از رابط کاربر استفاده می شود. -تقریبا تمام محدودیت ها فقط برای اعمال `SELECT`. برای پردازش پرس و جو توزیع, محدودیت بر روی هر سرور به طور جداگانه اعمال. - -خانه را کلیک کنید چک محدودیت برای قطعات داده, نه برای هر سطر. این بدان معنی است که شما می توانید ارزش محدودیت با اندازه بخش داده ها تجاوز. - -محدودیت در “maximum amount of something” می توانید مقدار را 0, که به معنی “unrestricted”. -اکثر محدودیت ها نیز دارند ‘overflow\_mode’ محیط, به این معنی چه باید بکنید هنگامی که از حد فراتر رفته است. -این می تواند یکی از دو مقدار را: `throw` یا `break`. محدودیت در تجمع (کد \_شورت\_فلو\_وشه گروه) نیز ارزش داشته باشد `any`. - -`throw` – Throw an exception (default). - -`break` – Stop executing the query and return the partial result, as if the source data ran out. - -`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don't add new keys to the set. - -## \_کاساژ بیشینه {#settings_max_memory_usage} - -حداکثر مقدار رم برای استفاده برای اجرای پرس و جو بر روی یک سرور واحد. - -در فایل پیکربندی پیش فرض, حداکثر است 10 گیگابایت. - -تنظیم می کند حجم حافظه در دسترس و یا حجم کل حافظه بر روی دستگاه در نظر نمی. -محدودیت شامل یک پرس و جو تنها در یک سرور. -شما می توانید استفاده کنید `SHOW PROCESSLIST` برای دیدن مصرف حافظه فعلی برای هر پرس و جو. -بعلاوه, مصرف حافظه اوج برای هر پرس و جو ردیابی و نوشته شده به ورود به سیستم. - -استفاده از حافظه برای ایالت های توابع مجموع خاص نظارت نیست. - -استفاده از حافظه به طور کامل برای ایالت ها از توابع کل ردیابی نیست `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` از `String` و `Array` بحث کردن. - -مصرف حافظه نیز توسط پارامترها محدود شده است `max_memory_usage_for_user` و `max_memory_usage_for_all_queries`. - -## \_شمارهگیر بیشینه {#max-memory-usage-for-user} - -حداکثر مقدار رم برای استفاده برای اجرای نمایش داده شد کاربر بر روی یک سرور واحد. - -مقادیر پیش فرض در تعریف [تنظیمات.ه](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L288). به طور پیش فرض مقدار محدود نمی شود (`max_memory_usage_for_user = 0`). - -همچنین نگاه کنید به شرح [\_کاساژ بیشینه](#settings_max_memory_usage). - -## \_شیشه بخاطر \_خروج {#max-memory-usage-for-all-queries} - -حداکثر مقدار رم برای استفاده برای اجرای تمام نمایش داده شد بر روی یک سرور واحد. - -مقادیر پیش فرض در تعریف [تنظیمات.ه](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L289). به طور پیش فرض مقدار محدود نمی شود (`max_memory_usage_for_all_queries = 0`). - -همچنین نگاه کنید به شرح [\_کاساژ بیشینه](#settings_max_memory_usage). - -## \_گذرواژههای \_ورود {#max-rows-to-read} - -محدودیت های زیر را می توان در هر بلوک بررسی (به جای در هر سطر). به این معنا که, محدودیت را می توان شکسته کمی. -هنگامی که در حال اجرا یک پرس و جو در موضوعات مختلف, محدودیت های زیر به هر موضوع اعمال می شود به طور جداگانه. - -حداکثر تعداد ردیف است که می تواند از یک جدول زمانی که در حال اجرا یک پرس و جو به عنوان خوانده شده. - -## \_مخفی کردن {#max-bytes-to-read} - -حداکثر تعداد بایت (داده های غیر فشرده) است که می تواند از یک جدول به عنوان خوانده شده در هنگام اجرای یک پرس و جو. - -## \_ورود به سیستم {#read-overflow-mode} - -چه باید بکنید هنگامی که حجم داده ها به عنوان خوانده شده بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. - -## \_رو\_تو\_گروهها {#settings-max-rows-to-group-by} - -حداکثر تعداد کلید منحصر به فرد دریافت شده از تجمع. این تنظیم به شما امکان مصرف حافظه محدود در هنگام جمع. - -## \_شماره \_شماره گروه {#group-by-overflow-mode} - -چه باید بکنید هنگامی که تعدادی از کلید های منحصر به فرد برای تجمع بیش از حد: ‘throw’, ‘break’ یا ‘any’. به طور پیش فرض, پرتاب. -با استفاده از ‘any’ ارزش شما اجازه می دهد یک تقریب از گروه های اجرا. کیفیت این تقریب بستگی به ماهیت استاتیک داده ها دارد. - -## ا\_فزون\_بر\_گونهی\_گونهی زیر\_گروهها {#settings-max_bytes_before_external_group_by} - -فعالسازی یا غیرفعالسازی اعدام `GROUP BY` بند در حافظه خارجی. ببینید [گروه در حافظه خارجی](../../sql_reference/statements/select.md#select-group-by-in-external-memory). - -مقادیر ممکن: - -- حداکثر حجم رم (به بایت) است که می تواند توسط تک استفاده می شود [GROUP BY](../../sql_reference/statements/select.md#select-group-by-clause) عمل -- 0 — `GROUP BY` در حافظه خارجی غیر فعال. - -مقدار پیش فرض: 0. - -## \_شماره بیشینه {#max-rows-to-sort} - -حداکثر تعداد ردیف قبل از مرتب سازی. این اجازه می دهد تا شما را به محدود کردن مصرف حافظه در هنگام مرتب سازی. - -## ا\_سلایدی {#max-bytes-to-sort} - -حداکثر تعداد بایت قبل از مرتب سازی. - -## کد\_و\_وشهیابی {#sort-overflow-mode} - -چه باید بکنید اگر تعداد ردیف قبل از مرتب سازی دریافت بیش از یکی از محدودیت: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. - -## بارشهای بیشینه {#setting-max_result_rows} - -محدود در تعداد ردیف در نتیجه. همچنین برای زیرمجموعه بررسی, و بر روی سرور از راه دور در هنگام اجرای بخش هایی از یک پرس و جو توزیع. - -## حداکثر\_زمین بایت {#max-result-bytes} - -محدود در تعداد بایت در نتیجه. همان تنظیمات قبلی. - -## \_شماره حاصل {#result-overflow-mode} - -چه باید بکنید اگر حجم نتیجه بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. - -با استفاده از ‘break’ شبیه به استفاده از حد است. `Break` قطع اعدام تنها در سطح بلوک. این به این معنی است که مقدار ردیف بازگشت بیشتر از [بارشهای بیشینه](#setting-max_result_rows) چندین [ت\_مایش بیشینه](settings.md#setting-max_block_size) و بستگی دارد [\_مخفی کردن](settings.md#settings-max_threads). - -مثال: - -``` sql -SET max_threads = 3, max_block_size = 3333; -SET max_result_rows = 3334, result_overflow_mode = 'break'; - -SELECT * -FROM numbers_mt(100000) -FORMAT Null; -``` - -نتیجه: - -``` text -6666 rows in set. ... -``` - -## زمان \_شنامهی حداکثر {#max-execution-time} - -حداکثر زمان اجرای پرس و جو در ثانیه. -در این زمان برای یکی از مراحل مرتب سازی بررسی نمی شود و یا هنگام ادغام و نهایی کردن توابع کلی. - -## \_شروع مجدد {#timeout-overflow-mode} - -چه باید بکنید اگر پرس و جو اجرا می شود بیش از ‘max\_execution\_time’: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. - -## \_شروع مجدد {#min-execution-speed} - -سرعت اجرای حداقل در ردیف در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای پایین تر است, یک استثنا پرتاب می شود. - -## ا\_فزونهها {#min-execution-speed-bytes} - -حداقل تعداد بایت اعدام در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای پایین تر است, یک استثنا پرتاب می شود. - -## حداکثر\_حاقسازی سرعت {#max-execution-speed} - -حداکثر تعداد ردیف اعدام در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای بالا است, سرعت اجرای کاهش خواهد یافت. - -## حداکثر\_کشن\_پیمایههای سرعت {#max-execution-speed-bytes} - -حداکثر تعداد بایت اعدام در هر ثانیه. بررسی در هر بلوک داده زمانی که ‘timeout\_before\_checking\_execution\_speed’ انقضا مییابد. اگر سرعت اجرای بالا است, سرعت اجرای کاهش خواهد یافت. - -## جستجو {#timeout-before-checking-execution-speed} - -چک که سرعت اجرای بیش از حد کند نیست (کمتر از ‘min\_execution\_speed’), پس از زمان مشخص شده در ثانیه تمام شده است. - -## \_رنگ \_ورود {#max-columns-to-read} - -حداکثر تعداد ستون است که می تواند از یک جدول در یک پرس و جو به عنوان خوانده شده. اگر پرس و جو نیاز به خواندن تعداد بیشتری از ستون, این می اندازد یک استثنا. - -## \_رنگ بیشینه {#max-temporary-columns} - -حداکثر تعداد ستون موقت است که باید در رم در همان زمان نگه داشته شود که در حال اجرا یک پرس و جو, از جمله ستون ثابت. اگر ستون موقت بیش از این وجود دارد, این یک استثنا می اندازد. - -## \_رنگ {#max-temporary-non-const-columns} - -همان چیزی که به عنوان ‘max\_temporary\_columns’, اما بدون شمارش ستون ثابت. -توجه داشته باشید که ستون های ثابت در حال اجرا یک پرس و جو نسبتا اغلب تشکیل, اما نیاز به حدود صفر منابع محاسباتی. - -## حداکثر {#max-subquery-depth} - -حداکثر عمق تودرتو از کارخانه های فرعی. اگر کارخانه های فرعی عمیق تر, یک استثنا پرتاب می شود. به طور پیش فرض, 100. - -## حداکثر \_پیپیلین {#max-pipeline-depth} - -حداکثر عمق خط لوله. مربوط به تعدادی از تحولات که هر بلوک داده می رود از طریق در طول پردازش پرس و جو. شمارش در محدوده یک سرور واحد. اگر عمق خط لوله بیشتر است, یک استثنا پرتاب می شود. به طور پیش فرض 1000. - -## \_ص\_خلاف {#max-ast-depth} - -حداکثر عمق تودرتو از یک درخت نحوی پرس و جو. اگر بیش از, یک استثنا پرتاب می شود. -در این زمان در تجزیه بررسی نمی شود اما تنها پس از تجزیه پرس و جو. به این معنا که, یک درخت نحوی است که بیش از حد عمیق می تواند در طول تجزیه ایجاد, اما پرس و جو شکست مواجه خواهد شد. به طور پیش فرض 1000. - -## \_محلولات حداکثر {#max-ast-elements} - -حداکثر تعداد عناصر در یک درخت نحوی پرس و جو. اگر بیش از, یک استثنا پرتاب می شود. -در همان راه به عنوان تنظیمات قبلی تنها پس از تجزیه پرس و جو بررسی می شود. به طور پیش فرض 50000. - -## \_رو\_ تنظیم {#max-rows-in-set} - -حداکثر تعداد ردیف برای یک مجموعه داده ها در بند در ایجاد شده از یک خرده فروشی. - -## تنظیم \_سریع {#max-bytes-in-set} - -حداکثر تعداد بایت (داده های غیر فشرده) استفاده شده توسط یک مجموعه در بند در ایجاد شده از یک خرده فروشی. - -## \_حالت تنظیم {#set-overflow-mode} - -چه باید بکنید هنگامی که مقدار داده ها بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. - -## حوزه \_کاربری مکس {#max-rows-in-distinct} - -حداکثر تعداد ردیف های مختلف در هنگام استفاده از متمایز. - -## مک\_بتس\_ حوزه {#max-bytes-in-distinct} - -حداکثر تعداد بایت استفاده شده توسط یک جدول هش در هنگام استفاده متمایز. - -## \_شروع مجدد {#distinct-overflow-mode} - -چه باید بکنید هنگامی که مقدار داده ها بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. - -## ترجمههای بیشینه {#max-rows-to-transfer} - -حداکثر تعداد ردیف است که می تواند به یک سرور از راه دور منتقل می شود و یا ذخیره شده در یک جدول موقت در هنگام استفاده از جهانی در. - -## ترجمههای بیشینه {#max-bytes-to-transfer} - -حداکثر تعداد بایت (داده های غیر فشرده) است که می تواند به یک سرور از راه دور منتقل می شود و یا ذخیره شده در یک جدول موقت در هنگام استفاده از جهانی در. - -## \_شروع مجدد {#transfer-overflow-mode} - -چه باید بکنید هنگامی که مقدار داده ها بیش از یکی از محدودیت های: ‘throw’ یا ‘break’. به طور پیش فرض, پرتاب. - -## \_پاک کردن \_روشن گرافیک {#settings-max_rows_in_join} - -محدودیت تعداد ردیف در جدول هش استفاده شده است که در هنگام پیوستن به جداول. - -این تنظیمات در مورد [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) عملیات و [پیوستن](../../engines/table_engines/special/join.md) موتور جدول. - -اگر یک پرس و جو شامل چند می پیوندد, خانه چک این تنظیم برای هر نتیجه متوسط. - -تاتر می توانید با اقدامات مختلف ادامه دهید زمانی که از حد رسیده است. استفاده از [\_شروع مجدد](#settings-join_overflow_mode) تنظیم برای انتخاب عمل. - -مقادیر ممکن: - -- عدد صحیح مثبت. -- 0 — Unlimited number of rows. - -مقدار پیش فرض: 0. - -## \_پویش همیشگی {#settings-max_bytes_in_join} - -محدودیت اندازه در بایت از جدول هش استفاده می شود در هنگام پیوستن به جداول. - -این تنظیمات در مورد [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) عملیات و [پیوستن به موتور جدول](../../engines/table_engines/special/join.md). - -اگر پرس و جو شامل می پیوندد, کلیک چک این تنظیمات برای هر نتیجه متوسط. - -تاتر می توانید با اقدامات مختلف ادامه دهید زمانی که از حد رسیده است. استفاده [\_شروع مجدد](#settings-join_overflow_mode) تنظیمات برای انتخاب عمل. - -مقادیر ممکن: - -- عدد صحیح مثبت. -- 0 — Memory control is disabled. - -مقدار پیش فرض: 0. - -## \_شروع مجدد {#settings-join_overflow_mode} - -تعریف می کند که چه عمل کلیک انجام زمانی که هر یک از محدودیت های زیر ملحق رسیده است: - -- [\_پویش همیشگی](#settings-max_bytes_in_join) -- [\_پاک کردن \_روشن گرافیک](#settings-max_rows_in_join) - -مقادیر ممکن: - -- `THROW` — ClickHouse throws an exception and breaks operation. -- `BREAK` — ClickHouse breaks operation and doesn't throw an exception. - -مقدار پیشفرض: `THROW`. - -**همچنین نگاه کنید** - -- [پیوستن بند](../../sql_reference/statements/select.md#select-join) -- [پیوستن به موتور جدول](../../engines/table_engines/special/join.md) - -## \_مسدود کردن بیشینه {#max-partitions-per-insert-block} - -حداکثر تعداد پارتیشن در یک بلوک قرار داده شده را محدود می کند. - -- عدد صحیح مثبت. -- 0 — Unlimited number of partitions. - -مقدار پیش فرض: 100. - -**اطلاعات دقیق** - -هنگام قرار دادن داده ها, تاتر محاسبه تعداد پارتیشن در بلوک قرار داده. اگر تعداد پارتیشن ها بیش از `max_partitions_per_insert_block`, خانه را کلیک می اندازد یک استثنا با متن زیر: - -> “Too many partitions for single INSERT block (more than” اطلاعات دقیق “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/fa/operations/settings/settings_profiles.md b/docs/fa/operations/settings/settings-profiles.md similarity index 100% rename from docs/fa/operations/settings/settings_profiles.md rename to docs/fa/operations/settings/settings-profiles.md diff --git a/docs/fa/operations/settings/settings-users.md b/docs/fa/operations/settings/settings-users.md new file mode 100644 index 00000000000..99e4cd910aa --- /dev/null +++ b/docs/fa/operations/settings/settings-users.md @@ -0,0 +1,148 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 63 +toc_title: "\u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u06A9\u0627\u0631\u0628\u0631" +--- + +# تنظیمات کاربر {#user-settings} + +این `users` بخش از `user.xml` فایل پیکربندی شامل تنظیمات کاربر. + +ساختار `users` بخش: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### نام / رمز عبور {#user-namepassword} + +رمز عبور را می توان در متن یا در شی256 (فرمت سحر و جادو) مشخص شده است. + +- برای اختصاص دادن رمز عبور به متن (**توصیه نمی شود**), جای خود را در یک `password` عنصر. + + به عنوان مثال, `qwerty`. رمز عبور را می توان خالی گذاشت. + + + +- برای اختصاص دادن رمز عبور با استفاده از هش ش256 در یک `password_sha256_hex` عنصر. + + به عنوان مثال, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + نمونه ای از نحوه تولید رمز عبور از پوسته: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + + خط اول نتیجه رمز عبور است. خط دوم مربوط به هش ش256 است. + + + +- برای سازگاری با مشتریان خروجی زیر, رمز عبور را می توان در دو شی1 هش مشخص. محل را در `password_double_sha1_hex` عنصر. + + به عنوان مثال, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + نمونه ای از نحوه تولید رمز عبور از پوسته: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + + خط اول نتیجه رمز عبور است. خط دوم مربوط به هش دو شی1 است. + +### نام / شبکه {#user-namenetworks} + +لیست شبکه هایی که کاربر می تواند به سرور کلیک متصل شود. + +هر عنصر از لیست می توانید یکی از اشکال زیر را داشته باشد: + +- `` — IP address or network mask. + + مثالها: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Hostname. + + مثال: `example01.host.ru`. + + برای بررسی دسترسی یک پرسوجوی دی ان اس انجام میشود و تمامی نشانیهای اینترنتی برگشتی با نشانی همکار مقایسه میشوند. + +- `` — Regular expression for hostnames. + + مثال, `^example\d\d-\d\d-\d\.host\.ru$` + + برای بررسی دسترسی [جستجو](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) برای نشانی همکار انجام می شود و سپس عبارت منظم مشخص شده اعمال می شود. سپس پرس و جو دی ان اس دیگری برای نتایج پرس و جو انجام می شود و تمامی نشانیهای دریافتی با نشانی همکار مقایسه می شوند. ما قویا توصیه می کنیم که عبارت منظم به پایان می رسد با$. + +تمام نتایج درخواست دی ان اس ذخیره سازی تا زمانی که سرور راه اندازی مجدد. + +**مثالها** + +برای باز کردن دسترسی برای کاربر از هر شبکه مشخص کنید: + +``` xml +::/0 +``` + +!!! warning "اخطار" + این نا امن برای باز کردن دسترسی از هر شبکه مگر اینکه شما یک فایروال به درستی پیکربندی و یا سرور به طور مستقیم به اینترنت متصل نیست. + +برای باز کردن دسترسی فقط از جایل هاست مشخص کنید: + +``` xml +::1 +127.0.0.1 +``` + +### نام / پروفایل {#user-nameprofile} + +شما می توانید یک پروفایل تنظیمات برای کاربر اختصاص دهید. پروفایل های تنظیمات در یک بخش جداگانه از پیکربندی `users.xml` پرونده. برای کسب اطلاعات بیشتر, دیدن [پروفایل تنظیمات](settings-profiles.md). + +### نام / سهمیه {#user-namequota} + +سهمیه اجازه می دهد شما را به پیگیری و یا محدود کردن استفاده از منابع بیش از یک دوره از زمان. سهمیه در پیکربندی `quotas` +بخش از `users.xml` فایل پیکربندی. + +شما می توانید یک سهمیه تعیین شده برای کاربر اختصاص. برای شرح مفصلی از پیکربندی سهمیه, دیدن [سهمیه](../quotas.md#quotas). + +### نام/پایگاه های داده {#user-namedatabases} + +در این بخش می توانید ردیف هایی را که توسط کلیک برای بازگشت هستند محدود کنید `SELECT` نمایش داده شد ساخته شده توسط کاربر فعلی, در نتیجه اجرای امنیت سطح ردیف پایه. + +**مثال** + +پیکربندی زیر نیروهای که کاربر `user1` فقط می توانید ردیف ها را ببینید `table1` به عنوان نتیجه `SELECT` نمایش داده شد که ارزش `id` درست است 1000. + +``` xml + + + + + id = 1000 + + + + +``` + +این `filter` می تواند هر بیان و در نتیجه [UInt8](../../sql-reference/data-types/int-uint.md)- نوع ارزش. این حالت معمولا شامل مقایسه و اپراتورهای منطقی. سطرها از `database_name.table1` از کجا نتایج فیلتر به 0 برای این کاربر بازگشت نیست. فیلتر کردن با ناسازگار است `PREWHERE` عملیات و معلولین `WHERE→PREWHERE` بهینهسازی. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/fa/operations/settings/settings.md b/docs/fa/operations/settings/settings.md index e4349477cfb..b9f5af73360 100644 --- a/docs/fa/operations/settings/settings.md +++ b/docs/fa/operations/settings/settings.md @@ -9,7 +9,7 @@ toc_title: "\u062A\u0646\u0638\u06CC\u0645\u0627\u062A" ## \_شماره توزیع شده {#distributed-product-mode} -تغییر رفتار [توزیع subqueries](../../sql_reference/statements/select.md). +تغییر رفتار [توزیع subqueries](../../sql-reference/statements/select.md). ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table. @@ -18,7 +18,7 @@ ClickHouse applies this setting when the query contains the product of distribut - تنها برای اعمال در و پیوستن به subqueries. - فقط اگر از بخش با استفاده از یک جدول توزیع حاوی بیش از یک سفال. - اگر خرده فروشی مربوط به یک جدول توزیع حاوی بیش از یک سفال. -- برای ارزش جدول استفاده نمی شود [دور](../../sql_reference/table_functions/remote.md) تابع. +- برای ارزش جدول استفاده نمی شود [دور](../../sql-reference/table-functions/remote.md) تابع. مقادیر ممکن: @@ -53,7 +53,7 @@ ClickHouse applies this setting when the query contains the product of distribut ## شناسه بسته: {#settings-fallback_to_stale_replicas_for_distributed_queries} -نیروهای پرس و جو به ماکت خارج از تاریخ اگر داده به روز شده در دسترس نیست. ببینید [تکرار](../../engines/table_engines/mergetree_family/replication.md). +نیروهای پرس و جو به ماکت خارج از تاریخ اگر داده به روز شده در دسترس نیست. ببینید [تکرار](../../engines/table-engines/mergetree-family/replication.md). تاتر انتخاب مناسب ترین از کپی منسوخ شده از جدول. @@ -67,7 +67,7 @@ ClickHouse applies this setting when the query contains the product of distribut با جداول در خانواده ادغام کار می کند. -اگر `force_index_by_date=1` چک چه پرس و جو وضعیت کلید تاریخ است که می تواند مورد استفاده قرار گیرد برای محدود کردن محدوده داده. اگر هیچ شرایط مناسب وجود دارد, این یک استثنا می اندازد. با این حال, بررسی نمی کند که وضعیت مقدار داده ها به خواندن را کاهش می دهد. مثلا, شرایط `Date != ' 2000-01-01 '` قابل قبول است حتی زمانی که منطبق بر تمام داده ها در جدول (به عنوان مثال در حال اجرا پرس و جو نیاز به اسکن کامل). برای کسب اطلاعات بیشتر در مورد محدوده داده ها در جداول ادغام, دیدن [ادغام](../../engines/table_engines/mergetree_family/mergetree.md). +اگر `force_index_by_date=1` چک چه پرس و جو وضعیت کلید تاریخ است که می تواند مورد استفاده قرار گیرد برای محدود کردن محدوده داده. اگر هیچ شرایط مناسب وجود دارد, این یک استثنا می اندازد. با این حال, بررسی نمی کند که وضعیت مقدار داده ها به خواندن را کاهش می دهد. مثلا, شرایط `Date != ' 2000-01-01 '` قابل قبول است حتی زمانی که منطبق بر تمام داده ها در جدول (به عنوان مثال در حال اجرا پرس و جو نیاز به اسکن کامل). برای کسب اطلاعات بیشتر در مورد محدوده داده ها در جداول ادغام, دیدن [ادغام](../../engines/table-engines/mergetree-family/mergetree.md). ## اجبار {#force-primary-key} @@ -75,7 +75,7 @@ ClickHouse applies this setting when the query contains the product of distribut با جداول در خانواده ادغام کار می کند. -اگر `force_primary_key=1` چک خانه را ببینید اگر پرس و جو شرایط کلیدی اولیه است که می تواند مورد استفاده قرار گیرد برای محدود کردن محدوده داده است. اگر هیچ شرایط مناسب وجود دارد, این یک استثنا می اندازد. با این حال, بررسی نمی کند که وضعیت مقدار داده ها به خواندن را کاهش می دهد. برای کسب اطلاعات بیشتر در مورد محدوده داده ها در جداول ادغام, دیدن [ادغام](../../engines/table_engines/mergetree_family/mergetree.md). +اگر `force_primary_key=1` چک خانه را ببینید اگر پرس و جو شرایط کلیدی اولیه است که می تواند مورد استفاده قرار گیرد برای محدود کردن محدوده داده است. اگر هیچ شرایط مناسب وجود دارد, این یک استثنا می اندازد. با این حال, بررسی نمی کند که وضعیت مقدار داده ها به خواندن را کاهش می دهد. برای کسب اطلاعات بیشتر در مورد محدوده داده ها در جداول ادغام, دیدن [ادغام](../../engines/table-engines/mergetree-family/mergetree.md). ## قالب\_نما {#format-schema} @@ -136,7 +136,7 @@ ClickHouse applies this setting when the query contains the product of distribut ## عناصر {#setting-max_http_get_redirects} -محدودیت حداکثر تعداد قام از رازک تغییر مسیر برای [URL](../../engines/table_engines/special/url.md)- جدول موتور . تنظیمات مربوط به هر دو نوع جداول: کسانی که ایجاد شده توسط [CREATE TABLE](../../query_language/create/#create-table-query) پرس و جو و توسط [نشانی وب](../../sql_reference/table_functions/url.md) تابع جدول. +محدودیت حداکثر تعداد قام از رازک تغییر مسیر برای [URL](../../engines/table-engines/special/url.md)- جدول موتور . تنظیمات مربوط به هر دو نوع جداول: کسانی که ایجاد شده توسط [CREATE TABLE](../../query_language/create/#create-table-query) پرس و جو و توسط [نشانی وب](../../sql-reference/table-functions/url.md) تابع جدول. مقادیر ممکن: @@ -172,7 +172,7 @@ ClickHouse applies this setting when the query contains the product of distribut ## در حال خواندن: {#settings-input_format_values_interpret_expressions} -را قادر می سازد و یا غیر فعال تجزیه کننده کامل گذاشتن اگر تجزیه کننده جریان سریع نمی تواند تجزیه داده ها. این تنظیم فقط برای [مقادیر](../../interfaces/formats.md#data-format-values) فرمت در درج داده ها. برای کسب اطلاعات بیشتر در مورد تجزیه نحو, دیدن [نحو](../../sql_reference/syntax.md) بخش. +را قادر می سازد و یا غیر فعال تجزیه کننده کامل گذاشتن اگر تجزیه کننده جریان سریع نمی تواند تجزیه داده ها. این تنظیم فقط برای [مقادیر](../../interfaces/formats.md#data-format-values) فرمت در درج داده ها. برای کسب اطلاعات بیشتر در مورد تجزیه نحو, دیدن [نحو](../../sql-reference/syntax.md) بخش. مقادیر ممکن: @@ -188,7 +188,7 @@ ClickHouse applies this setting when the query contains the product of distribut مثال استفاده -درج [DateTime](../../sql_reference/data_types/datetime.md) ارزش نوع با تنظیمات مختلف. +درج [DateTime](../../sql-reference/data-types/datetime.md) ارزش نوع با تنظیمات مختلف. ``` sql SET input_format_values_interpret_expressions = 0; @@ -333,7 +333,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl اجازه می دهد تا انتخاب تجزیه کننده از نمایش متن از تاریخ و زمان. -تنظیمات برای اعمال نمی شود [توابع تاریخ و زمان](../../sql_reference/functions/date_time_functions.md). +تنظیمات برای اعمال نمی شود [توابع تاریخ و زمان](../../sql-reference/functions/date-time-functions.md). مقادیر ممکن: @@ -349,12 +349,12 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl همچنین نگاه کنید به: -- [نوع داده حسگر ناحیه رنگی.](../../sql_reference/data_types/datetime.md) -- [توابع برای کار با تاریخ و زمان.](../../sql_reference/functions/date_time_functions.md) +- [نوع داده حسگر ناحیه رنگی.](../../sql-reference/data-types/datetime.md) +- [توابع برای کار با تاریخ و زمان.](../../sql-reference/functions/date-time-functions.md) ## بررسی اجمالی {#settings-join_default_strictness} -مجموعه سختی پیش فرض برای [تاریخ بند](../../sql_reference/statements/select.md#select-join). +مجموعه سختی پیش فرض برای [تاریخ بند](../../sql-reference/statements/select.md#select-join). مقادیر ممکن: @@ -370,7 +370,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl تغییرات رفتار پیوستن به عملیات با `ANY` سخت بودن. !!! warning "توجه" - این تنظیم فقط برای `JOIN` عملیات با [پیوستن](../../engines/table_engines/special/join.md) جداول موتور. + این تنظیم فقط برای `JOIN` عملیات با [پیوستن](../../engines/table-engines/special/join.md) جداول موتور. مقادیر ممکن: @@ -381,18 +381,18 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl همچنین نگاه کنید به: -- [پیوستن بند](../../sql_reference/statements/select.md#select-join) -- [پیوستن به موتور جدول](../../engines/table_engines/special/join.md) +- [پیوستن بند](../../sql-reference/statements/select.md#select-join) +- [پیوستن به موتور جدول](../../engines/table-engines/special/join.md) - [بررسی اجمالی](#settings-join_default_strictness) ## ارزشهای خبری عبارتند از: {#join_use_nulls} -نوع را تنظیم می کند [JOIN](../../sql_reference/statements/select.md) رفتار هنگامی که ادغام جداول سلول های خالی ممکن است ظاهر شود. کلیک هاوس بر اساس این تنظیم متفاوت است. +نوع را تنظیم می کند [JOIN](../../sql-reference/statements/select.md) رفتار هنگامی که ادغام جداول سلول های خالی ممکن است ظاهر شود. کلیک هاوس بر اساس این تنظیم متفاوت است. مقادیر ممکن: - 0 — The empty cells are filled with the default value of the corresponding field type. -- 1 — `JOIN` رفتار به همان شیوه به عنوان در گذاشتن استاندارد. نوع زمینه مربوطه به تبدیل [Nullable](../../sql_reference/data_types/nullable.md#data_type-nullable) سلول های خالی پر شده اند [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` رفتار به همان شیوه به عنوان در گذاشتن استاندارد. نوع زمینه مربوطه به تبدیل [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) سلول های خالی پر شده اند [NULL](../../sql-reference/syntax.md). مقدار پیش فرض: 0. @@ -412,7 +412,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl ## ادغام \_تر\_م\_را\_م\_مایش مجدد {#setting-merge-tree-min-rows-for-concurrent-read} -اگر تعداد ردیف از یک فایل از یک خوانده شود [ادغام](../../engines/table_engines/mergetree_family/mergetree.md) جدول بیش از `merge_tree_min_rows_for_concurrent_read` سپس کلیک کنیدهاوس تلاش می کند برای انجام خواندن همزمان از این فایل در موضوعات مختلف. +اگر تعداد ردیف از یک فایل از یک خوانده شود [ادغام](../../engines/table-engines/mergetree-family/mergetree.md) جدول بیش از `merge_tree_min_rows_for_concurrent_read` سپس کلیک کنیدهاوس تلاش می کند برای انجام خواندن همزمان از این فایل در موضوعات مختلف. مقادیر ممکن: @@ -422,7 +422,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl ## \_انتقال به \_انتقال به \_شخصی {#setting-merge-tree-min-bytes-for-concurrent-read} -اگر تعداد بایت برای خواندن از یک فایل از یک [ادغام](../../engines/table_engines/mergetree_family/mergetree.md)- جدول موتور بیش از `merge_tree_min_bytes_for_concurrent_read` سپس کلیک کنیدهاوس تلاش می کند به صورت همزمان از این فایل در موضوعات مختلف به عنوان خوانده شده. +اگر تعداد بایت برای خواندن از یک فایل از یک [ادغام](../../engines/table-engines/mergetree-family/mergetree.md)- جدول موتور بیش از `merge_tree_min_bytes_for_concurrent_read` سپس کلیک کنیدهاوس تلاش می کند به صورت همزمان از این فایل در موضوعات مختلف به عنوان خوانده شده. مقدار ممکن: @@ -464,7 +464,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl اگر کلیک خانه باید بیش از خواندن `merge_tree_max_rows_to_use_cache` ردیف ها در یک پرس و جو از کش بلوک های غیر فشرده استفاده نمی کنند. -ذخیره سازی داده های ذخیره شده بلوک های غیر فشرده برای نمایش داده شد. تاتر با استفاده از این کش برای سرعت بخشیدن به پاسخ به نمایش داده شد کوچک تکرار شده است. این تنظیم محافظت از کش از سطل زباله توسط نمایش داده شد که مقدار زیادی از داده ها به عنوان خوانده شده. این [\_بالا](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) تنظیم سرور اندازه کش از بلوک های غیر فشرده را تعریف می کند. +ذخیره سازی داده های ذخیره شده بلوک های غیر فشرده برای نمایش داده شد. تاتر با استفاده از این کش برای سرعت بخشیدن به پاسخ به نمایش داده شد کوچک تکرار شده است. این تنظیم محافظت از کش از سطل زباله توسط نمایش داده شد که مقدار زیادی از داده ها به عنوان خوانده شده. این [\_بالا](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) تنظیم سرور اندازه کش از بلوک های غیر فشرده را تعریف می کند. مقادیر ممکن: @@ -476,7 +476,7 @@ Default value: 128 ✕ 8192. اگر کلیک خانه باید بیش از خواندن `merge_tree_max_bytes_to_use_cache` بایت در یک پرس و جو, این کش از بلوک های غیر فشرده استفاده نمی. -ذخیره سازی داده های ذخیره شده بلوک های غیر فشرده برای نمایش داده شد. تاتر با استفاده از این کش برای سرعت بخشیدن به پاسخ به نمایش داده شد کوچک تکرار شده است. این تنظیم محافظت از کش از سطل زباله توسط نمایش داده شد که مقدار زیادی از داده ها به عنوان خوانده شده. این [\_بالا](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) تنظیم سرور اندازه کش از بلوک های غیر فشرده را تعریف می کند. +ذخیره سازی داده های ذخیره شده بلوک های غیر فشرده برای نمایش داده شد. تاتر با استفاده از این کش برای سرعت بخشیدن به پاسخ به نمایش داده شد کوچک تکرار شده است. این تنظیم محافظت از کش از سطل زباله توسط نمایش داده شد که مقدار زیادی از داده ها به عنوان خوانده شده. این [\_بالا](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) تنظیم سرور اندازه کش از بلوک های غیر فشرده را تعریف می کند. مقدار ممکن: @@ -501,7 +501,7 @@ Default value: 128 ✕ 8192. راه اندازی ورود به سیستم پرس و جو. -نمایش داده شد با توجه به قوانین در به کلیک خانه فرستاده می شود [\_خروج](../server_configuration_parameters/settings.md#server_configuration_parameters-query-log) پارامتر پیکربندی سرور. +نمایش داده شد با توجه به قوانین در به کلیک خانه فرستاده می شود [\_خروج](../server-configuration-parameters/settings.md#server_configuration_parameters-query-log) پارامتر پیکربندی سرور. مثال: @@ -513,7 +513,7 @@ log_queries=1 راه اندازی موضوعات پرس و جو ورود به سیستم. -نمایش داده شد' موضوعات runned توسط clickhouse با راه اندازی این سیستم هستند با توجه به قوانین در [\_ر\_خروج](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) پارامتر پیکربندی سرور. +نمایش داده شد’ موضوعات runned توسط clickhouse با راه اندازی این سیستم هستند با توجه به قوانین در [\_ر\_خروج](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) پارامتر پیکربندی سرور. مثال: @@ -535,7 +535,7 @@ log_query_threads=1 ## \_شروع مجدد \_شروع مجدد \_شروع مجدد \_کاربری {#settings-max_replica_delay_for_distributed_queries} -غیرفعال تاخیر کپی برای نمایش داده شد توزیع شده است. ببینید [تکرار](../../engines/table_engines/mergetree_family/replication.md). +غیرفعال تاخیر کپی برای نمایش داده شد توزیع شده است. ببینید [تکرار](../../engines/table-engines/mergetree-family/replication.md). زمان را در عرض چند ثانیه تنظیم می کند. اگر یک ماکت نشدم بیش از ارزش مجموعه, این ماکت استفاده نمی شود. @@ -580,7 +580,7 @@ log_query_threads=1 ## \_بزرگنمایی {#min-compress-block-size} -برای [ادغام](../../engines/table_engines/mergetree_family/mergetree.md)"جداول . به منظور کاهش زمان تاخیر در هنگام پردازش نمایش داده شد, یک بلوک فشرده شده است در هنگام نوشتن علامت بعدی اگر اندازه خود را حداقل ‘min\_compress\_block\_size’. به طور پیش فرض 65,536. +برای [ادغام](../../engines/table-engines/mergetree-family/mergetree.md)"جداول . به منظور کاهش زمان تاخیر در هنگام پردازش نمایش داده شد, یک بلوک فشرده شده است در هنگام نوشتن علامت بعدی اگر اندازه خود را حداقل ‘min\_compress\_block\_size’. به طور پیش فرض 65,536. اندازه واقعی بلوک, اگر داده غیر فشرده کمتر از است ‘max\_compress\_block\_size’, کمتر از این مقدار و کمتر از حجم داده ها برای یک علامت. @@ -658,7 +658,7 @@ Cancels HTTP read-only queries (e.g. SELECT) when a client closes the connectio ## همترازی پایین {#setting-use_uncompressed_cache} اینکه از یک کش از بلوکهای غیر فشرده استفاده شود یا خیر. می پذیرد 0 یا 1. به طور پیش فرض, 0 (غیر فعال). -با استفاده از کش غیر فشرده (فقط برای جداول در خانواده ادغام) می تواند به طور قابل توجهی کاهش زمان تاخیر و افزایش توان در هنگام کار با تعداد زیادی از نمایش داده شد کوتاه است. فعال کردن این تنظیم برای کاربرانی که ارسال درخواست کوتاه مکرر. همچنین با توجه به پرداخت [\_بالا](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. +با استفاده از کش غیر فشرده (فقط برای جداول در خانواده ادغام) می تواند به طور قابل توجهی کاهش زمان تاخیر و افزایش توان در هنگام کار با تعداد زیادی از نمایش داده شد کوتاه است. فعال کردن این تنظیم برای کاربرانی که ارسال درخواست کوتاه مکرر. همچنین با توجه به پرداخت [\_بالا](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. برای نمایش داده شد که خواندن حداقل حجم تا حدودی زیادی از داده ها (یک میلیون ردیف یا بیشتر) غیر فشرده کش غیر فعال است به طور خودکار به صرفه جویی در فضا برای واقعا کوچک نمایش داده شد. این به این معنی است که شما می توانید نگه دارید ‘use\_uncompressed\_cache’ تنظیم همیشه به مجموعه 1. @@ -667,7 +667,7 @@ Cancels HTTP read-only queries (e.g. SELECT) when a client closes the connectio هنگام استفاده از رابط قام ‘query\_id’ پارامتر را می توان گذشت. این هر رشته که به عنوان شناسه پرس و جو در خدمت است. اگر پرس و جو از همان کاربر با همان ‘query\_id’ در حال حاضر در این زمان وجود دارد, رفتار بستگی به ‘replace\_running\_query’ پارامتر. -`0` (default) – Throw an exception (don't allow the query to run if a query with the same ‘query\_id’ در حال حاضر در حال اجرا). +`0` (default) – Throw an exception (don’t allow the query to run if a query with the same ‘query\_id’ در حال حاضر در حال اجرا). `1` – Cancel the old query and start running the new one. @@ -707,7 +707,7 @@ load_balancing = random load_balancing = nearest_hostname ``` -The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server's hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). +The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server’s hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). مثلا example01-01-1 و example01-01-2.yandex.ru متفاوت هستند در یک موقعیت در حالی که example01-01-1 و example01-02-2 متفاوت در دو مکان است. این روش ممکن است ابتدایی به نظر برسد اما اطلاعات خارجی در مورد توپولوژی شبکه نیاز ندارد و نشانی های اینترنتی را مقایسه نمی کند که برای نشانیهای اینترنتی6 پیچیده خواهد بود. @@ -778,7 +778,7 @@ For testing, the value can be set to 0: compilation runs synchronously and the q اگر مقدار است 1 یا بیشتر, تلفیقی ناهمگام در یک موضوع جداگانه رخ می دهد. نتیجه به محض این که حاضر است از جمله نمایش داده شد که در حال حاضر در حال اجرا استفاده می شود. کد کامپایل شده برای هر ترکیب های مختلف از توابع کل مورد استفاده در پرس و جو و نوع کلید در گروه بند مورد نیاز است. -The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don't use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. +The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don’t use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. ## خروجی \_فرمان\_جسون\_کوات\_64بیت\_تنظیمی {#session_settings-output_format_json_quote_64bit_integers} @@ -886,7 +886,7 @@ The results of the compilation are saved in the build directory in the form of . به طور پیش فرض, تقسیم بندی برای نمایش تحقق انجام نشده است اما بالادست انجام, در جدول منبع. اگر یک بلوک قرار داده شده است به دلیل تقسیم بندی در جدول منبع قلم, وجود خواهد داشت بدون درج به نمایش مواد متصل. این رفتار وجود دارد برای فعال کردن درج داده ها بسیار جمع به نمایش محقق, برای مواردی که بلوک های قرار داده شده همان پس از تجمع مشاهده محقق اما مشتق شده از درج های مختلف را به جدول منبع. -همزمان, این رفتار “breaks” `INSERT` حق تقدم. اگر یک `INSERT` به جدول اصلی موفق بود و `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won't receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` اجازه می دهد تا برای تغییر این رفتار. در تلاش مجدد, یک دیدگاه محقق درج تکرار دریافت خواهد کرد و بررسی تکرار به خودی خود انجام, +همزمان, این رفتار “breaks” `INSERT` حق تقدم. اگر یک `INSERT` به جدول اصلی موفق بود و `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won’t receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` اجازه می دهد تا برای تغییر این رفتار. در تلاش مجدد, یک دیدگاه محقق درج تکرار دریافت خواهد کرد و بررسی تکرار به خودی خود انجام, نادیده گرفتن نتیجه چک برای جدول منبع, و ردیف به دلیل شکست اول از دست داده وارد. ## ویژ\_گیها {#settings-max-network-bytes} @@ -935,15 +935,15 @@ The results of the compilation are saved in the build directory in the form of . ## ا\_فزونهها {#settings-count_distinct_implementation} -مشخص می کند که کدام یک از `uniq*` توابع باید برای انجام [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count) ساخت و ساز. +مشخص می کند که کدام یک از `uniq*` توابع باید برای انجام [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count) ساخت و ساز. مقادیر ممکن: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqCombined](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [نیم قرن 64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [یونقلل12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [قرارداد اتحادیه](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqCombined](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [نیم قرن 64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [یونقلل12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [قرارداد اتحادیه](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) مقدار پیشفرض: `uniqExact`. @@ -1008,7 +1008,7 @@ The results of the compilation are saved in the build directory in the form of . ## ا\_فزون\_ف\_کوپ {#setting-optimize_throw_if_noop} -را قادر می سازد و یا غیر فعال پرتاب یک استثنا اگر یک [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) پرس و جو یک ادغام انجام نمی. +را قادر می سازد و یا غیر فعال پرتاب یک استثنا اگر یک [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) پرس و جو یک ادغام انجام نمی. به طور پیش فرض, `OPTIMIZE` حتی اگر هیچ کاری انجام نمی دهد با موفقیت باز می گردد. این تنظیم به شما اجازه می دهد تا این شرایط را متمایز کنید و دلیل را در یک پیام استثنا دریافت کنید. @@ -1028,7 +1028,7 @@ The results of the compilation are saved in the build directory in the form of . همچنین نگاه کنید به: -- [موتور جدول توزیع شده است](../../engines/table_engines/special/distributed.md) +- [موتور جدول توزیع شده است](../../engines/table-engines/special/distributed.md) - [نمایش سایت](#settings-distributed_replica_error_cap) ## نمایش سایت {#settings-distributed_replica_error_cap} @@ -1040,12 +1040,12 @@ The results of the compilation are saved in the build directory in the form of . همچنین نگاه کنید به: -- [موتور جدول توزیع شده است](../../engines/table_engines/special/distributed.md) +- [موتور جدول توزیع شده است](../../engines/table-engines/special/distributed.md) - [در حال بارگذاری](#settings-distributed_replica_error_half_life) ## در حال بارگذاری {#distributed_directory_monitor_sleep_time_ms} -فاصله پایه برای [توزیع شده](../../engines/table_engines/special/distributed.md) موتور جدول برای ارسال داده ها. فاصله واقعی نمایی رشد می کند در صورت خطا. +فاصله پایه برای [توزیع شده](../../engines/table-engines/special/distributed.md) موتور جدول برای ارسال داده ها. فاصله واقعی نمایی رشد می کند در صورت خطا. مقادیر ممکن: @@ -1055,7 +1055,7 @@ The results of the compilation are saved in the build directory in the form of . ## در حال بارگذاری {#distributed_directory_monitor_max_sleep_time_ms} -حداکثر فاصله برای [توزیع شده](../../engines/table_engines/special/distributed.md) موتور جدول برای ارسال داده ها. محدودیت رشد نمایی از فاصله تعیین شده در [در حال بارگذاری](#distributed_directory_monitor_sleep_time_ms) تنظیمات. +حداکثر فاصله برای [توزیع شده](../../engines/table-engines/special/distributed.md) موتور جدول برای ارسال داده ها. محدودیت رشد نمایی از فاصله تعیین شده در [در حال بارگذاری](#distributed_directory_monitor_sleep_time_ms) تنظیمات. مقادیر ممکن: @@ -1067,7 +1067,7 @@ The results of the compilation are saved in the build directory in the form of . را قادر می سازد/غیر فعال ارسال داده های درج شده در دسته. -هنگام ارسال دسته ای فعال است [توزیع شده](../../engines/table_engines/special/distributed.md) موتور جدول تلاش می کند چندین فایل داده های درج شده را در یک عملیات به جای ارسال جداگانه ارسال کند. دسته ای ارسال را بهبود می بخشد عملکرد خوشه با استفاده بهتر از سرور و شبکه منابع. +هنگام ارسال دسته ای فعال است [توزیع شده](../../engines/table-engines/special/distributed.md) موتور جدول تلاش می کند چندین فایل داده های درج شده را در یک عملیات به جای ارسال جداگانه ارسال کند. دسته ای ارسال را بهبود می بخشد عملکرد خوشه با استفاده بهتر از سرور و شبکه منابع. مقادیر ممکن: @@ -1093,7 +1093,7 @@ The results of the compilation are saved in the build directory in the form of . ## جستجو {#query_profiler_real_time_period_ns} -دوره را برای یک تایمر ساعت واقعی تنظیم می کند [پروفیل پرس و جو](../../operations/optimizing_performance/sampling_query_profiler.md). تایمر ساعت واقعی شمارش زمان دیوار ساعت. +دوره را برای یک تایمر ساعت واقعی تنظیم می کند [پروفیل پرس و جو](../../operations/optimizing-performance/sampling-query-profiler.md). تایمر ساعت واقعی شمارش زمان دیوار ساعت. مقادیر ممکن: @@ -1106,17 +1106,17 @@ The results of the compilation are saved in the build directory in the form of . - 0 برای خاموش کردن تایمر. -نوع: [UInt64](../../sql_reference/data_types/int_uint.md). +نوع: [UInt64](../../sql-reference/data-types/int-uint.md). مقدار پیش فرض: 1000000000 نانو ثانیه (یک بار در ثانیه). همچنین نگاه کنید به: -- جدول سیستم [\_قطع](../../operations/system_tables.md#system_tables-trace_log) +- جدول سیستم [\_قطع](../../operations/system-tables.md#system_tables-trace_log) ## ایران در تهران {#query_profiler_cpu_time_period_ns} -دوره را برای تایمر ساعت پردازنده تنظیم می کند [پروفیل پرس و جو](../../operations/optimizing_performance/sampling_query_profiler.md). این تایمر شمارش تنها زمان پردازنده. +دوره را برای تایمر ساعت پردازنده تنظیم می کند [پروفیل پرس و جو](../../operations/optimizing-performance/sampling-query-profiler.md). این تایمر شمارش تنها زمان پردازنده. مقادیر ممکن: @@ -1129,17 +1129,17 @@ The results of the compilation are saved in the build directory in the form of . - 0 برای خاموش کردن تایمر. -نوع: [UInt64](../../sql_reference/data_types/int_uint.md). +نوع: [UInt64](../../sql-reference/data-types/int-uint.md). مقدار پیش فرض: 1000000000 نانو ثانیه. همچنین نگاه کنید به: -- جدول سیستم [\_قطع](../../operations/system_tables.md#system_tables-trace_log) +- جدول سیستم [\_قطع](../../operations/system-tables.md#system_tables-trace_log) ## اجازه دادن به \_فعال کردن اختلال در عملکرد {#settings-allow_introspection_functions} -فعالسازی از کارانداختن [توابع درون گونه](../../sql_reference/functions/introspection.md) برای پروفایل پرس و جو. +فعالسازی از کارانداختن [توابع درون گونه](../../sql-reference/functions/introspection.md) برای پروفایل پرس و جو. مقادیر ممکن: @@ -1150,8 +1150,8 @@ The results of the compilation are saved in the build directory in the form of . **همچنین نگاه کنید** -- [پروفایل پرس و جو نمونه برداری](../optimizing_performance/sampling_query_profiler.md) -- جدول سیستم [\_قطع](../../operations/system_tables.md#system_tables-trace_log) +- [پروفایل پرس و جو نمونه برداری](../optimizing-performance/sampling-query-profiler.md) +- جدول سیستم [\_قطع](../../operations/system-tables.md#system_tables-trace_log) ## وارد\_فرمت\_پارلل\_درپارس {#input-format-parallel-parsing} diff --git a/docs/fa/operations/settings/settings_users.md b/docs/fa/operations/settings/settings_users.md deleted file mode 100644 index 5f5cb6762ea..00000000000 --- a/docs/fa/operations/settings/settings_users.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 63 -toc_title: "\u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u06A9\u0627\u0631\u0628\u0631" ---- - -# تنظیمات کاربر {#user-settings} - -این `users` بخش از `user.xml` فایل پیکربندی شامل تنظیمات کاربر. - -ساختار `users` بخش: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### نام / رمز عبور {#user-namepassword} - -رمز عبور را می توان در متن یا در شی256 (فرمت سحر و جادو) مشخص شده است. - -- برای اختصاص دادن رمز عبور به متن (**توصیه نمی شود**), جای خود را در یک `password` عنصر. - - به عنوان مثال, `qwerty`. رمز عبور را می توان خالی گذاشت. - - - -- برای اختصاص دادن رمز عبور با استفاده از هش ش256 در یک `password_sha256_hex` عنصر. - - به عنوان مثال, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - نمونه ای از نحوه تولید رمز عبور از پوسته: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - - خط اول نتیجه رمز عبور است. خط دوم مربوط به هش ش256 است. - - - -- برای سازگاری با مشتریان خروجی زیر, رمز عبور را می توان در دو شی1 هش مشخص. محل را در `password_double_sha1_hex` عنصر. - - به عنوان مثال, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - نمونه ای از نحوه تولید رمز عبور از پوسته: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - - خط اول نتیجه رمز عبور است. خط دوم مربوط به هش دو شی1 است. - -### نام / شبکه {#user-namenetworks} - -لیست شبکه هایی که کاربر می تواند به سرور کلیک متصل شود. - -هر عنصر از لیست می توانید یکی از اشکال زیر را داشته باشد: - -- `` — IP address or network mask. - - مثالها: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Hostname. - - مثال: `example01.host.ru`. - - برای بررسی دسترسی یک پرسوجوی دی ان اس انجام میشود و تمامی نشانیهای اینترنتی برگشتی با نشانی همکار مقایسه میشوند. - -- `` — Regular expression for hostnames. - - مثال, `^example\d\d-\d\d-\d\.host\.ru$` - - برای بررسی دسترسی [جستجو](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) برای نشانی همکار انجام می شود و سپس عبارت منظم مشخص شده اعمال می شود. سپس پرس و جو دی ان اس دیگری برای نتایج پرس و جو انجام می شود و تمامی نشانیهای دریافتی با نشانی همکار مقایسه می شوند. ما قویا توصیه می کنیم که عبارت منظم به پایان می رسد با$. - -تمام نتایج درخواست دی ان اس ذخیره سازی تا زمانی که سرور راه اندازی مجدد. - -**مثالها** - -برای باز کردن دسترسی برای کاربر از هر شبکه مشخص کنید: - -``` xml -::/0 -``` - -!!! warning "اخطار" - این نا امن برای باز کردن دسترسی از هر شبکه مگر اینکه شما یک فایروال به درستی پیکربندی و یا سرور به طور مستقیم به اینترنت متصل نیست. - -برای باز کردن دسترسی فقط از جایل هاست مشخص کنید: - -``` xml -::1 -127.0.0.1 -``` - -### نام / پروفایل {#user-nameprofile} - -شما می توانید یک پروفایل تنظیمات برای کاربر اختصاص دهید. پروفایل های تنظیمات در یک بخش جداگانه از پیکربندی `users.xml` پرونده. برای کسب اطلاعات بیشتر, دیدن [پروفایل تنظیمات](settings_profiles.md). - -### نام / سهمیه {#user-namequota} - -سهمیه اجازه می دهد شما را به پیگیری و یا محدود کردن استفاده از منابع بیش از یک دوره از زمان. سهمیه در پیکربندی `quotas` -بخش از `users.xml` فایل پیکربندی. - -شما می توانید یک سهمیه تعیین شده برای کاربر اختصاص. برای شرح مفصلی از پیکربندی سهمیه, دیدن [سهمیه](../quotas.md#quotas). - -### نام/پایگاه های داده {#user-namedatabases} - -در این بخش می توانید ردیف هایی را که توسط کلیک برای بازگشت هستند محدود کنید `SELECT` نمایش داده شد ساخته شده توسط کاربر فعلی, در نتیجه اجرای امنیت سطح ردیف پایه. - -**مثال** - -پیکربندی زیر نیروهای که کاربر `user1` فقط می توانید ردیف ها را ببینید `table1` به عنوان نتیجه `SELECT` نمایش داده شد که ارزش `id` درست است 1000. - -``` xml - - - - - id = 1000 - - - - -``` - -این `filter` می تواند هر بیان و در نتیجه [UInt8](../../sql_reference/data_types/int_uint.md)- نوع ارزش. این حالت معمولا شامل مقایسه و اپراتورهای منطقی. سطرها از `database_name.table1` از کجا نتایج فیلتر به 0 برای این کاربر بازگشت نیست. فیلتر کردن با ناسازگار است `PREWHERE` عملیات و معلولین `WHERE→PREWHERE` بهینهسازی. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/fa/operations/system-tables.md b/docs/fa/operations/system-tables.md new file mode 100644 index 00000000000..96658112557 --- /dev/null +++ b/docs/fa/operations/system-tables.md @@ -0,0 +1,1097 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 52 +toc_title: "\u062C\u062F\u0627\u0648\u0644 \u0633\u06CC\u0633\u062A\u0645" +--- + +# جداول سیستم {#system-tables} + +جداول سیستم برای اجرای بخشی از قابلیت های سیستم استفاده می شود و برای دسترسی به اطلاعات در مورد چگونگی کار سیستم. +شما می توانید یک جدول سیستم را حذف کنید (اما شما می توانید جدا انجام). +جداول سیستم فایل های با داده ها بر روی دیسک و یا فایل های با ابرداده ندارد. سرور ایجاد تمام جداول سیستم زمانی که شروع می شود. +جداول سیستم فقط خواندنی. +این در واقع ‘system’ پایگاه داده است. + +## سیستم.\_نامهنویسی ناهمزمان {#system_tables-asynchronous_metrics} + +شامل معیارهای که به صورت دوره ای در پس زمینه محاسبه می شود. مثلا, مقدار رم در حال استفاده. + +ستونها: + +- `metric` ([رشته](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([جسم شناور64](../sql-reference/data-types/float.md)) — Metric value. + +**مثال** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**همچنین نگاه کنید به** + +- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. +- [سیستم.متریک](#system_tables-metrics) — Contains instantly calculated metrics. +- [سیستم.رویدادها](#system_tables-events) — Contains a number of events that have occurred. +- [سیستم.\_اشکالزدایی](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. + +## سیستم.خوشه {#system-clusters} + +حاوی اطلاعاتی در مورد خوشه های موجود در فایل پیکربندی و سرورهای موجود در ان. + +ستونها: + +- `cluster` (String) — The cluster name. +- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. +- `shard_weight` (UInt32) — The relative weight of the shard when writing data. +- `replica_num` (UInt32) — The replica number in the shard, starting from 1. +- `host_name` (String) — The host name, as specified in the config. +- `host_address` (String) — The host IP address obtained from DNS. +- `port` (UInt16) — The port to use for connecting to the server. +- `user` (String) — The name of the user for connecting to the server. +- `errors_count` (اوینت32) - تعداد دفعاتی که این میزبان موفق به رسیدن به ماکت. +- `estimated_recovery_time` (اوینت32) - ثانیه به سمت چپ تا زمانی که تعداد خطا ماکت صفر است و در نظر گرفته می شود به حالت عادی. + +لطفا توجه داشته باشید که `errors_count` یک بار در هر پرس و جو به خوشه به روز, ولی `estimated_recovery_time` بر روی تقاضا محاسبه شده است. بنابراین می تواند یک مورد غیر صفر باشد `errors_count` و صفر `estimated_recovery_time`, که پرس و جو بعدی صفر خواهد شد `errors_count` و سعی کنید به استفاده از ماکت به عنوان اگر هیچ خطا. + +**همچنین نگاه کنید به** + +- [موتور جدول توزیع شده است](../engines/table-engines/special/distributed.md) +- [تنظیمات \_فرهنگ توزیع میشود](settings/settings.md#settings-distributed_replica_error_cap) +- [پخش \_راپیشا\_را\_را\_را\_حالف\_لایف تنظیم](settings/settings.md#settings-distributed_replica_error_half_life) + +## سیستم.ستونها {#system-columns} + +حاوی اطلاعات در مورد ستون در تمام جداول. + +شما می توانید با استفاده از این جدول برای دریافت اطلاعات مشابه به [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table) پرس و جو, اما برای جداول متعدد در یک بار. + +این `system.columns` جدول شامل ستون های زیر (نوع ستون در براکت نشان داده شده است): + +- `database` (String) — Database name. +- `table` (String) — Table name. +- `name` (String) — Column name. +- `type` (String) — Column type. +- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) برای مقدار پیش فرض, و یا یک رشته خالی اگر تعریف نشده است. +- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. +- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. +- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. +- `marks_bytes` (UInt64) — The size of marks, in bytes. +- `comment` (String) — Comment on the column, or an empty string if it is not defined. +- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. +- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. +- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. +- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. + +## سیستم.یاریدهندکان {#system-contributors} + +حاوی اطلاعات در مورد همکاران. همه مربیان به صورت تصادفی. سفارش تصادفی در زمان اجرای پرس و جو است. + +ستونها: + +- `name` (String) — Contributor (author) name from git log. + +**مثال** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +برای پیدا کردن خود را در جدول, استفاده از یک پرس و جو: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## سیستم.پایگاههای داده {#system-databases} + +این جدول شامل یک ستون رشته ای به نام ‘name’ – the name of a database. +هر پایگاه داده که سرور می داند در مورد یک ورودی مربوطه را در جدول. +این جدول سیستم برای اجرای استفاده می شود `SHOW DATABASES` پرس و جو. + +## سیستم.قطعات مجزا {#system_tables-detached_parts} + +حاوی اطلاعات در مورد قطعات جدا شده از [ادغام](../engines/table-engines/mergetree-family/mergetree.md) میز این `reason` ستون مشخص می کند که چرا بخش جدا شد. برای قطعات کاربر جدا, دلیل خالی است. چنین قطعات را می توان با [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) فرمان. برای توضیحات ستون های دیگر را ببینید [سیستم.قطعات](#system_tables-parts). اگر نام قسمت نامعتبر است, ارزش برخی از ستون ممکن است `NULL`. این قطعات را می توان با حذف [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). + +## سیستم.واژهنامهها {#system-dictionaries} + +شامل اطلاعات در مورد لغت نامه های خارجی. + +ستونها: + +- `name` (String) — Dictionary name. +- `type` (String) — Dictionary type: Flat, Hashed, Cache. +- `origin` (String) — Path to the configuration file that describes the dictionary. +- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. +- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. +- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. +- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. +- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. +- `element_count` (UInt64) — The number of items stored in the dictionary. +- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). +- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. +- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn’t be created. +- `source` (String) — Text describing the data source for the dictionary. + +توجه داشته باشید که مقدار حافظه مورد استفاده توسط فرهنگ لغت متناسب با تعداد اقلام ذخیره شده در این نیست. بنابراین برای لغت نامه تخت و کش, تمام سلول های حافظه از پیش تعیین شده, صرف نظر از چگونه کامل فرهنگ لغت در واقع. + +## سیستم.رویدادها {#system_tables-events} + +حاوی اطلاعات در مورد تعدادی از حوادث که در سیستم رخ داده است. مثلا, در جدول, شما می توانید پیدا کنید که چگونه بسیاری از `SELECT` نمایش داده شد از سرور کلیک شروع پردازش شد. + +ستونها: + +- `event` ([رشته](../sql-reference/data-types/string.md)) — Event name. +- `value` ([UInt64](../sql-reference/data-types/int-uint.md)) — Number of events occurred. +- `description` ([رشته](../sql-reference/data-types/string.md)) — Event description. + +**مثال** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [سیستم.\_نامهنویسی ناهمزمان](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [سیستم.متریک](#system_tables-metrics) — Contains instantly calculated metrics. +- [سیستم.\_اشکالزدایی](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. + +## سیستم.توابع {#system-functions} + +حاوی اطلاعات در مورد توابع عادی و جمع. + +ستونها: + +- `name`(`String`) – The name of the function. +- `is_aggregate`(`UInt8`) — Whether the function is aggregate. + +## سیستم.بازداشت گرافیت {#system-graphite-retentions} + +حاوی اطلاعات در مورد پارامترها [لغزش \_ نمودار](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) که در جداول با استفاده [اطلاعات دقیق](../engines/table-engines/mergetree-family/graphitemergetree.md) موتورها. + +ستونها: + +- `config_name` ) رشته) - `graphite_rollup` نام پارامتر. +- `regexp` (رشته) - یک الگوی برای نام متریک. +- `function` (رشته) - نام تابع جمع. +- `age` (UInt64) - حداقل سن دیتا در ثانیه. +- `precision` (اوینت64) - چگونه دقیقا به تعریف سن داده ها در ثانیه. +- `priority` (UInt16) - الگوی اولویت است. +- `is_default` (UInt8) - آیا الگوی پیش فرض است. +- `Tables.database` (مجموعه (رشته)) - مجموعه ای از نام جداول پایگاه داده که از `config_name` پارامتر. +- `Tables.table` (صف (رشته)) - مجموعه ای از نام جدول که با استفاده از `config_name` پارامتر. + +## سیستم.ادغام {#system-merges} + +حاوی اطلاعات در مورد ادغام و جهش بخشی در حال حاضر در روند برای جداول در خانواده ادغام. + +ستونها: + +- `database` (String) — The name of the database the table is in. +- `table` (String) — Table name. +- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. +- `progress` (Float64) — The percentage of completed work from 0 to 1. +- `num_parts` (UInt64) — The number of pieces to be merged. +- `result_part_name` (String) — The name of the part that will be formed as the result of merging. +- `is_mutation` (اوینت8) - 1 اگر این فرایند جهش بخشی است. +- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. +- `total_size_marks` (UInt64) — The total number of marks in the merged parts. +- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. +- `rows_read` (UInt64) — Number of rows read. +- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. +- `rows_written` (UInt64) — Number of rows written. + +## سیستم.متریک {#system_tables-metrics} + +شامل معیارهای است که می تواند فورا محاسبه, و یا یک مقدار فعلی. مثلا, تعداد نمایش داده شد به طور همزمان پردازش و یا تاخیر ماکت فعلی. این جدول همیشه به روز. + +ستونها: + +- `metric` ([رشته](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — Metric value. +- `description` ([رشته](../sql-reference/data-types/string.md)) — Metric description. + +لیستی از معیارهای پشتیبانی شده شما می توانید در [افراد زیر در این افزونه مشارکت کردهاندپردازنده](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Common/CurrentMetrics.cpp) فایل منبع از خانه کلیک. + +**مثال** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [سیستم.\_نامهنویسی ناهمزمان](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [سیستم.رویدادها](#system_tables-events) — Contains a number of events that occurred. +- [سیستم.\_اشکالزدایی](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. + +## سیستم.\_اشکالزدایی {#system_tables-metric_log} + +دارای تاریخچه معیارهای ارزش از جداول `system.metrics` و `system.events`, دوره ای به دیسک سرخ. +برای روشن کردن مجموعه تاریخچه معیارهای در `system.metric_log` ایجاد `/etc/clickhouse-server/config.d/metric_log.xml` با محتوای زیر: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**مثال** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**همچنین نگاه کنید به** + +- [سیستم.\_نامهنویسی ناهمزمان](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [سیستم.رویدادها](#system_tables-events) — Contains a number of events that occurred. +- [سیستم.متریک](#system_tables-metrics) — Contains instantly calculated metrics. +- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. + +## سیستم.اعداد {#system-numbers} + +این جدول شامل یک uint64 ستون به نام ‘number’ که شامل تقریبا تمام اعداد طبیعی با شروع از صفر. +شما می توانید این جدول برای تست استفاده, و یا اگر شما نیاز به انجام یک جستجو نیروی بی رحم. +بار خوانده شده از این جدول موازی نیست. + +## سیستم.\_شماره حساب {#system-numbers-mt} + +همان ‘system.numbers’ اما بار خوانده شده موازی هستند. اعداد را می توان در هر سفارش بازگشت. +مورد استفاده برای تست. + +## سیستم.یک {#system-one} + +این جدول شامل یک ردیف با یک ‘dummy’ در زیر8 ستون حاوی مقدار 0. +این جدول استفاده می شود اگر پرس و جو را انتخاب کنید از بند مشخص نیست. +این شبیه میز دوگانه است که در سایر موارد یافت می شود. + +## سیستم.قطعات {#system_tables-parts} + +حاوی اطلاعات در مورد بخش هایی از [ادغام](../engines/table-engines/mergetree-family/mergetree.md) میز + +هر سطر توصیف یک بخش داده. + +ستونها: + +- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql-reference/statements/alter.md#query_language_queries_alter) پرس و جو. + + فرشها: + + - `YYYYMM` برای پارتیشن بندی خودکار در ماه. + - `any_string` هنگامی که پارتیشن بندی دستی. + +- `name` (`String`) – Name of the data part. + +- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. + +- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` با دانه دانه دانه شاخص (معمولا 8192) (این اشاره برای دانه دانه تطبیقی کار نمی کند). + +- `rows` (`UInt64`) – The number of rows. + +- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. + +- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `marks_bytes` (`UInt64`) – The size of the file with marks. + +- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| + +- `remove_time` (`DateTime`) – The time when the data part became inactive. + +- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. + +- `min_date` (`Date`) – The minimum value of the date key in the data part. + +- `max_date` (`Date`) – The maximum value of the date key in the data part. + +- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. + +- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. + +- `partition_id` (`String`) – ID of the partition. + +- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. + +- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. + +- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. + +- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. + +- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition) + +- `database` (`String`) – Name of the database. + +- `table` (`String`) – Name of the table. + +- `engine` (`String`) – Name of the table engine without parameters. + +- `path` (`String`) – Absolute path to the folder with data part files. + +- `disk` (`String`) – Name of a disk that stores the data part. + +- `hash_of_all_files` (`String`) – [سیفون128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) از فایل های فشرده. + +- `hash_of_uncompressed_files` (`String`) – [سیفون128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) از فایل های غیر فشرده (فایل های با علامت, فایل شاخص و غیره.). + +- `uncompressed_hash_of_compressed_files` (`String`) – [سیفون128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) از داده ها در فایل های فشرده به عنوان اگر غیر فشرده شد. + +- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. + +- `marks_size` (`UInt64`) – Alias for `marks_bytes`. + +## سیستم.\_خروج {#system_tables-part-log} + +این `system.part_log` جدول تنها در صورتی ایجاد می شود [\_خروج](server-configuration-parameters/settings.md#server_configuration_parameters-part-log) تنظیم سرور مشخص شده است. + +این جدول حاوی اطلاعات در مورد اتفاقاتی که با رخ داده است [قطعات داده](../engines/table-engines/mergetree-family/custom-partitioning-key.md) در [ادغام](../engines/table-engines/mergetree-family/mergetree.md) جداول خانواده, مانند اضافه کردن و یا ادغام داده ها. + +این `system.part_log` جدول شامل ستون های زیر است: + +- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: + - `NEW_PART` — Inserting of a new data part. + - `MERGE_PARTS` — Merging of data parts. + - `DOWNLOAD_PART` — Downloading a data part. + - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — Mutating of a data part. + - `MOVE_PART` — Moving the data part from the one disk to another one. +- `event_date` (Date) — Event date. +- `event_time` (DateTime) — Event time. +- `duration_ms` (UInt64) — Duration. +- `database` (String) — Name of the database the data part is in. +- `table` (String) — Name of the table the data part is in. +- `part_name` (String) — Name of the data part. +- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ ارزش اگر پارتیشن بندی توسط `tuple()`. +- `rows` (UInt64) — The number of rows in the data part. +- `size_in_bytes` (UInt64) — Size of the data part in bytes. +- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). +- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. +- `read_rows` (UInt64) — The number of rows was read during the merge. +- `read_bytes` (UInt64) — The number of bytes was read during the merge. +- `error` (UInt16) — The code number of the occurred error. +- `exception` (String) — Text message of the occurred error. + +این `system.part_log` جدول پس از اولین قرار دادن داده ها به ایجاد `MergeTree` جدول + +## سیستم.فرایندها {#system_tables-processes} + +این جدول سیستم برای اجرای استفاده می شود `SHOW PROCESSLIST` پرس و جو. + +ستونها: + +- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` کاربر. زمینه شامل نام کاربری برای یک پرس و جو خاص, نه برای پرس و جو که این پرس و جو شروع. +- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` در سرور درخواست پرس و جو. +- `elapsed` (Float64) – The time in seconds since request execution started. +- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. +- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [\_کاساژ بیشینه](../operations/settings/query-complexity.md#settings_max_memory_usage) تنظیمات. +- `query` (String) – The query text. For `INSERT` این شامل داده ها برای وارد کردن نیست. +- `query_id` (String) – Query ID, if defined. + +## سیستم.\_خروج {#system-tables-text-log} + +شامل ورودی ورود به سیستم. سطح ورود به سیستم که می رود به این جدول را می توان با محدود `text_log.level` تنظیم سرور. + +ستونها: + +- `event_date` (`Date`)- تاریخ ورود. +- `event_time` (`DateTime`)- زمان ورود . +- `microseconds` (`UInt32`)- میکروثانیه از ورود. +- `thread_name` (String) — Name of the thread from which the logging was done. +- `thread_id` (UInt64) — OS thread ID. +- `level` (`Enum8`)- ورود به سطح . + - `'Fatal' = 1` + - `'Critical' = 2` + - `'Error' = 3` + - `'Warning' = 4` + - `'Notice' = 5` + - `'Information' = 6` + - `'Debug' = 7` + - `'Trace' = 8` +- `query_id` (`String`)- شناسه پرس و جو . +- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) +- `message` (`String`)- پیام خود را. +- `revision` (`UInt32`)- تجدید نظر کلیک کنیدهاوس . +- `source_file` (`LowCardinality(String)`)- فایل منبع که از ورود به سیستم انجام شد . +- `source_line` (`UInt64`)- خط منبع که از ورود به سیستم انجام شد. + +## سیستم.\_خروج {#system_tables-query_log} + +حاوی اطلاعات در مورد اجرای نمایش داده شد. برای هر پرس و جو, شما می توانید زمان شروع پردازش را ببینید, مدت زمان پردازش, پیام های خطا و اطلاعات دیگر. + +!!! note "یادداشت" + جدول حاوی اطلاعات ورودی برای `INSERT` نمایش داده شد. + +تاتر این جدول را فقط در صورتی ایجاد می کند [\_خروج](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) پارامتر سرور مشخص شده است. این پارامتر مجموعه قوانین ورود به سیستم, مانند فاصله ورود به سیستم و یا نام جدول نمایش داده شد خواهد شد وارد سایت شوید. + +برای فعال کردن ورود به سیستم پرس و جو, تنظیم [\_خروج](settings/settings.md#settings-log-queries) پارامتر به 1. برای اطلاعات بیشتر [تنظیمات](settings/settings.md) بخش. + +این `system.query_log` جدول ثبت دو نوع نمایش داده شد: + +1. نمایش داده شد اولیه که به طور مستقیم توسط مشتری اجرا شد. +2. کودک نمایش داده شد که توسط دیگر نمایش داده شد (برای اجرای پرس و جو توزیع). برای این نوع از نمایش داده شد, اطلاعات در مورد پدر و مادر نمایش داده شد در نشان داده شده است `initial_*` ستون ها + +ستونها: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` نمایش داده شد, تعداد ردیف نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. +- `written_bytes` (UInt64) — For `INSERT` نمایش داده شد, تعداد بایت نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [کلیک مشتری](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی اجرا می شود. +- `client_name` (String) — The [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نام مشتری تی پی. +- `client_revision` (UInt32) — Revision of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. +- `client_version_major` (UInt32) — Major version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. +- `client_version_minor` (UInt32) — Minor version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. +- `client_version_patch` (UInt32) — Patch component of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نسخه مشتری تی سی پی. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` روش مورد استفاده قرار گرفت. + - 2 — `POST` روش مورد استفاده قرار گرفت. +- `http_user_agent` (String) — The `UserAgent` هدر در درخواست قام منتقل می شود. +- `quota_key` (String) — The “quota key” مشخص شده در [سهمیه](quotas.md) تنظیم (دیدن `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [سیستم.رویدادها](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` ستون. +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` پارامتر به 1. +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` ستون. + +هر پرس و جو ایجاد یک یا دو ردیف در `query_log` جدول بسته به وضعیت پرس و جو: + +1. اگر اجرای پرس و جو موفق است, دو رویداد با انواع 1 و 2 ایجاد می شوند (دیدن `type` ستون). +2. اگر یک خطا در طول پردازش پرس و جو رخ داده است, دو رویداد با انواع 1 و 4 ایجاد می شوند. +3. اگر یک خطا قبل از راه اندازی پرس و جو رخ داده است, یک رویداد واحد با نوع 3 ایجاد شده است. + +به طور پیش فرض, سیاهههای مربوط به جدول در فواصل 7.5 ثانیه اضافه. شما می توانید این فاصله در مجموعه [\_خروج](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) تنظیم سرور (نگاه کنید به `flush_interval_milliseconds` پارامتر). به خیط و پیت کردن سیاهههای مربوط به زور از بافر حافظه را به جدول, استفاده از `SYSTEM FLUSH LOGS` پرس و جو. + +هنگامی که جدول به صورت دستی حذف, به طور خودکار در پرواز ایجاد. توجه داشته باشید که تمام سیاهههای مربوط قبلی حذف خواهد شد. + +!!! note "یادداشت" + دوره ذخیره سازی برای سیاهههای مربوط نامحدود است. سیاهههای مربوط به طور خودکار از جدول حذف نمی شود. شما نیاز به سازماندهی حذف سیاهههای مربوط منسوخ شده خود را. + +شما می توانید یک کلید پارتیشن بندی دلخواه برای مشخص `system.query_log` جدول در [\_خروج](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) تنظیم سرور (نگاه کنید به `partition_by` پارامتر). + +## سیستم.\_ر\_خروج {#system_tables-query-thread-log} + +جدول شامل اطلاعات در مورد هر موضوع اجرای پرس و جو. + +تاتر این جدول را فقط در صورتی ایجاد می کند [\_ر\_خروج](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) پارامتر سرور مشخص شده است. این پارامتر مجموعه قوانین ورود به سیستم, مانند فاصله ورود به سیستم و یا نام جدول نمایش داده شد خواهد شد وارد سایت شوید. + +برای فعال کردن ورود به سیستم پرس و جو, تنظیم [باز کردن](settings/settings.md#settings-log-query-threads) پارامتر به 1. برای اطلاعات بیشتر [تنظیمات](settings/settings.md) بخش. + +ستونها: + +- `event_date` (Date) — the date when the thread has finished execution of the query. +- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` نمایش داده شد, تعداد ردیف نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. +- `written_bytes` (UInt64) — For `INSERT` نمایش داده شد, تعداد بایت نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. +- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. +- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. +- `thread_name` (String) — Name of the thread. +- `thread_number` (UInt32) — Internal thread ID. +- `os_thread_id` (Int32) — OS thread ID. +- `master_thread_id` (UInt64) — OS initial ID of initial thread. +- `query` (String) — Query string. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [کلیک مشتری](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی اجرا می شود. +- `client_name` (String) — The [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نام مشتری تی پی. +- `client_revision` (UInt32) — Revision of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. +- `client_version_major` (UInt32) — Major version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. +- `client_version_minor` (UInt32) — Minor version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. +- `client_version_patch` (UInt32) — Patch component of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نسخه مشتری تی سی پی. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` روش مورد استفاده قرار گرفت. + - 2 — `POST` روش مورد استفاده قرار گرفت. +- `http_user_agent` (String) — The `UserAgent` هدر در درخواست قام منتقل می شود. +- `quota_key` (String) — The “quota key” مشخص شده در [سهمیه](quotas.md) تنظیم (دیدن `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [سیستم.رویدادها](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` ستون. + +به طور پیش فرض, سیاهههای مربوط به جدول در فواصل 7.5 ثانیه اضافه. شما می توانید این فاصله در مجموعه [\_ر\_خروج](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) تنظیم سرور (نگاه کنید به `flush_interval_milliseconds` پارامتر). به خیط و پیت کردن سیاهههای مربوط به زور از بافر حافظه را به جدول, استفاده از `SYSTEM FLUSH LOGS` پرس و جو. + +هنگامی که جدول به صورت دستی حذف, به طور خودکار در پرواز ایجاد. توجه داشته باشید که تمام سیاهههای مربوط قبلی حذف خواهد شد. + +!!! note "یادداشت" + دوره ذخیره سازی برای سیاهههای مربوط نامحدود است. سیاهههای مربوط به طور خودکار از جدول حذف نمی شود. شما نیاز به سازماندهی حذف سیاهههای مربوط منسوخ شده خود را. + +شما می توانید یک کلید پارتیشن بندی دلخواه برای مشخص `system.query_thread_log` جدول در [\_ر\_خروج](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) تنظیم سرور (نگاه کنید به `partition_by` پارامتر). + +## سیستم.\_قطع {#system_tables-trace_log} + +حاوی ردیاب های پشته ای است که توسط پروفایل پرس و جو نمونه گیری می شود. + +تاتر این جدول زمانی ایجاد می کند [\_قطع](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) بخش پیکربندی سرور تنظیم شده است. همچنین [جستجو](settings/settings.md#query_profiler_real_time_period_ns) و [ایران در تهران](settings/settings.md#query_profiler_cpu_time_period_ns) تنظیمات باید تنظیم شود. + +برای تجزیه و تحلیل سیاهههای مربوط, استفاده از `addressToLine`, `addressToSymbol` و `demangle` توابع درون گرایی. + +ستونها: + +- `event_date`([تاریخ](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time`([DateTime](../sql-reference/data-types/datetime.md)) — Timestamp of sampling moment. + +- `revision`([UInt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + هنگام اتصال به سرور توسط `clickhouse-client`, شما رشته شبیه به دیدن `Connected to ClickHouse server version 19.18.1 revision 54429.`. این فیلد شامل `revision` اما نه `version` از یک سرور. + +- `timer_type`([شمار8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` نشان دهنده زمان دیوار ساعت. + - `CPU` نشان دهنده زمان پردازنده. + +- `thread_number`([UInt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id`([رشته](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [\_خروج](#system_tables-query_log) جدول سیستم. + +- `trace`([Array(UInt64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**مثال** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## سیستم.تکرار {#system_tables-replicas} + +شامل اطلاعات و وضعیت برای جداول تکرار ساکن بر روی سرور محلی. +این جدول را می توان برای نظارت استفاده می شود. جدول شامل یک ردیف برای هر تکرار \* جدول. + +مثال: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +ستونها: + +- `database` (`String`)- نام پایگاه داده +- `table` (`String`)- نام جدول +- `engine` (`String`)- نام موتور جدول +- `is_leader` (`UInt8`)- چه ماکت رهبر است. + فقط یک ماکت در یک زمان می تواند رهبر باشد. رهبر برای انتخاب پس زمینه ادغام به انجام است. + توجه داشته باشید که می نویسد را می توان به هر ماکت است که در دسترس است و یک جلسه در زک انجام, صرف نظر از اینکه این یک رهبر است. +- `can_become_leader` (`UInt8`)- چه ماکت می تواند به عنوان یک رهبر انتخاب می شوند. +- `is_readonly` (`UInt8`)- چه ماکت در حالت فقط خواندنی است. + در این حالت روشن است اگر پیکربندی ندارد بخش با باغ وحش اگر یک خطای ناشناخته رخ داده است که reinitializing جلسات در باغ وحش و در طول جلسه reinitialization در باغ وحش. +- `is_session_expired` (`UInt8`)- جلسه با باغ وحش منقضی شده است. در واقع همان `is_readonly`. +- `future_parts` (`UInt32`)- تعداد قطعات داده است که به عنوان نتیجه درج و یا ادغام که هنوز انجام نشده است ظاهر می شود. +- `parts_to_check` (`UInt32`)- تعداد قطعات داده در صف برای تایید. اگر شک وجود دارد که ممکن است صدمه دیده است بخشی در صف تایید قرار داده است. +- `zookeeper_path` (`String`)- مسیر به داده های جدول در باغ وحش. +- `replica_name` (`String`)- نام ماکت در باغ وحش. کپی های مختلف از همان جدول نام های مختلف. +- `replica_path` (`String`)- مسیر به داده های ماکت در باغ وحش. همان الحاق ‘zookeeper\_path/replicas/replica\_path’. +- `columns_version` (`Int32`)- تعداد نسخه از ساختار جدول . نشان می دهد که چند بار تغییر انجام شد. اگر کپی نسخه های مختلف, به این معنی برخی از کپی ساخته شده است همه از تغییر نکرده است. +- `queue_size` (`UInt32`)- اندازه صف برای عملیات در حال انتظار برای انجام شود . عملیات شامل قرار دادن بلوک های داده ادغام و برخی اقدامات دیگر. معمولا همزمان با `future_parts`. +- `inserts_in_queue` (`UInt32`)- تعداد درج بلوک از داده ها که نیاز به ساخته شده است . درج معمولا نسبتا به سرعت تکرار. اگر این تعداد بزرگ است, به این معنی چیزی اشتباه است. +- `merges_in_queue` (`UInt32`)- تعداد ادغام انتظار ساخته شود. گاهی اوقات ادغام طولانی هستند, بنابراین این مقدار ممکن است بیشتر از صفر برای یک مدت طولانی. +- `part_mutations_in_queue` (`UInt32`)- تعداد جهش در انتظار ساخته شده است. +- `queue_oldest_time` (`DateTime`)- اگر `queue_size` بیشتر از 0, نشان می دهد که قدیمی ترین عملیات به صف اضافه شد. +- `inserts_oldest_time` (`DateTime` دیدن وضعیت شبکه `queue_oldest_time` +- `merges_oldest_time` (`DateTime` دیدن وضعیت شبکه `queue_oldest_time` +- `part_mutations_oldest_time` (`DateTime` دیدن وضعیت شبکه `queue_oldest_time` + +4 ستون بعدی یک مقدار غیر صفر تنها جایی که یک جلسه فعال با زک وجود دارد. + +- `log_max_index` (`UInt64`)- حداکثر تعداد ورودی در ورود به سیستم از فعالیت های عمومی. +- `log_pointer` (`UInt64`) - حداکثر تعداد ورودی در ورود به سیستم از فعالیت های عمومی که ماکت کپی شده به صف اعدام خود را, به علاوه یک. اگر `log_pointer` بسیار کوچکتر از `log_max_index`, چیزی اشتباه است. +- `last_queue_update` (`DateTime`)- هنگامی که صف در زمان گذشته به روز شد. +- `absolute_delay` (`UInt64`)- تاخیر چقدر بزرگ در ثانیه ماکت فعلی است. +- `total_replicas` (`UInt8`)- تعداد کل کپی شناخته شده از این جدول. +- `active_replicas` (`UInt8`)- تعداد کپی از این جدول که یک جلسه در باغ وحش (یعنی تعداد تکرار عملکرد). + +اگر شما درخواست تمام ستون, جدول ممکن است کمی کند کار, از چند بار خوانده شده از باغ وحش برای هر سطر ساخته شده. +اگر شما درخواست آخرین 4 ستون (log\_max\_index, log\_pointer, total\_replicas, active\_replicas) جدول با این نسخهها کار به سرعت. + +مثلا, شما می توانید بررسی کنید که همه چیز به درستی کار مثل این: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +اگر این پرس و جو چیزی نمی گرداند, به این معنی که همه چیز خوب است. + +## سیستم.تنظیمات {#system-settings} + +حاوی اطلاعات در مورد تنظیمات که در حال حاضر در حال استفاده. +به عنوان مثال مورد استفاده برای اجرای پرس و جو شما با استفاده از به خواندن از سیستم. جدول تنظیمات. + +ستونها: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. +- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [قیدها](settings/constraints-on-settings.md#constraints-on-settings)). +- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [قیدها](settings/constraints-on-settings.md#constraints-on-settings)). +- `readonly` (UInt8) — Can user change this setting (for more info, look into [قیدها](settings/constraints-on-settings.md#constraints-on-settings)). + +مثال: + +``` sql +SELECT name, value +FROM system.settings +WHERE changed +``` + +``` text +┌─name───────────────────┬─value───────┐ +│ max_threads │ 8 │ +│ use_uncompressed_cache │ 0 │ +│ load_balancing │ random │ +│ max_memory_usage │ 10000000000 │ +└────────────────────────┴─────────────┘ +``` + +## سیستم.خرابی در حذف گواهینامهها {#system-merge_tree_settings} + +حاوی اطلاعات در مورد تنظیمات برای `MergeTree` میز + +ستونها: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. + +## سیستم.\_زبانهها {#system-table-engines} + +شامل شرح موتورهای جدول پشتیبانی شده توسط سرور و اطلاعات پشتیبانی از ویژگی های خود را. + +این جدول شامل ستون های زیر (نوع ستون در براکت نشان داده شده است): + +- `name` (String) — The name of table engine. +- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` بند بند. +- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [پرش شاخص](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` و `SAMPLE_BY`. +- `supports_replication` (UInt8) — Flag that indicates if table engine supports [تکرار داده ها](../engines/table-engines/mergetree-family/replication.md). +- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. + +مثال: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- ادغام خانواده [بندهای پرسوجو](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) +- کافکا [تنظیمات](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) +- پیوستن [تنظیمات](../engines/table-engines/special/join.md#join-limitations-and-settings) + +## سیستم.جداول {#system-tables} + +حاوی ابرداده از هر جدول که سرور می داند در مورد. جداول جداگانه در نشان داده نمی شود `system.tables`. + +این جدول شامل ستون های زیر (نوع ستون در براکت نشان داده شده است): + +- `database` (String) — The name of the database the table is in. + +- `name` (String) — Table name. + +- `engine` (String) — Table engine name (without parameters). + +- `is_temporary` (زیر8) - پرچم که نشان می دهد که جدول موقت است. + +- `data_path` (رشته) - مسیر به داده های جدول در سیستم فایل. + +- `metadata_path` (رشته) - مسیر به ابرداده جدول در سیستم فایل. + +- `metadata_modification_time` (تاریخ ساعت) - زمان شدن اصلاح ابرداده جدول. + +- `dependencies_database` - وابستگی پایگاه داده . + +- `dependencies_table` (رشته)) - وابستگی های جدول ([ماده بینی](../engines/table-engines/special/materializedview.md) جداول بر اساس جدول فعلی). + +- `create_table_query` (رشته) - پرس و جو که برای ایجاد جدول مورد استفاده قرار گرفت. + +- `engine_full` (رشته) - پارامترهای موتور جدول. + +- `partition_key` (رشته) - بیان کلید پارتیشن مشخص شده در جدول. + +- `sorting_key` (رشته) - عبارت کلیدی مرتب سازی مشخص شده در جدول. + +- `primary_key` (رشته) - عبارت کلیدی اولیه مشخص شده در جدول. + +- `sampling_key` (رشته) - نمونه عبارت کلیدی مشخص شده در جدول. + +- `storage_policy` (رشته) - سیاست ذخیره سازی: + + - [ادغام](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) + - [توزیع شده](../engines/table-engines/special/distributed.md#distributed) + +- `total_rows` (Nullable(UInt64)) - تعداد کل ردیف آن است که اگر ممکن است به سرعت تعیین دقیق تعداد ردیف در جدول در غیر این صورت `Null` (از جمله زیرینگ `Buffer` جدول). + +- `total_bytes` (Nullable(UInt64)) - مجموع تعداد بایت, اگر آن را ممکن است به سرعت تعیین دقیق تعداد بایت به صورت جدول ذخیره در غیر این صورت `Null` (**نه** شامل هر ذخیره سازی زمینه ای). + + - If the table stores data on disk, returns used space on disk (i.e. compressed). + - اگر جدول ذخیره داده ها در حافظه, بازده تعداد تقریبی بایت مورد استفاده در حافظه. + +این `system.tables` جدول در استفاده می شود `SHOW TABLES` اجرای پرس و جو. + +## سیستم.باغ وحش {#system-zookeeper} + +جدول وجود ندارد اگر باغ وحش پیکربندی نشده است. اجازه می دهد تا خواندن داده ها از خوشه باغ وحش تعریف شده در پیکربندی. +پرس و جو باید یک ‘path’ شرایط برابری در بند جایی که. این مسیر در باغ وحش برای کودکان که شما می خواهید برای دریافت اطلاعات برای است. + +پرسوجو `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` خروجی داده ها برای همه کودکان در `/clickhouse` گره. +به داده های خروجی برای تمام گره های ریشه, نوشتن مسیر = ‘/’. +اگر مسیر مشخص شده در ‘path’ وجود ندارد, یک استثنا پرتاب خواهد شد. + +ستونها: + +- `name` (String) — The name of the node. +- `path` (String) — The path to the node. +- `value` (String) — Node value. +- `dataLength` (Int32) — Size of the value. +- `numChildren` (Int32) — Number of descendants. +- `czxid` (Int64) — ID of the transaction that created the node. +- `mzxid` (Int64) — ID of the transaction that last changed the node. +- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. +- `ctime` (DateTime) — Time of node creation. +- `mtime` (DateTime) — Time of the last modification of the node. +- `version` (Int32) — Node version: the number of times the node was changed. +- `cversion` (Int32) — Number of added or removed descendants. +- `aversion` (Int32) — Number of changes to the ACL. +- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. + +مثال: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## سیستم.جهشها {#system_tables-mutations} + +جدول حاوی اطلاعات در مورد [جهشها](../sql-reference/statements/alter.md#alter-mutations) از جداول ادغام و پیشرفت خود را. هر دستور جهش توسط یک ردیف نشان داده شده است. جدول دارای ستون های زیر است: + +**دادگان**, **جدول** - نام پایگاه داده و جدول که جهش استفاده شد . + +**قطع عضو** - شناسه جهش. برای جداول تکرار این شناسه به نام زنود در مطابقت `/mutations/` راهنمای در باغ وحش. برای جداول سه برابر شناسه مربوط به فایل نام در دایرکتوری داده ها از جدول. + +**فرمان** - رشته فرمان جهش (بخشی از پرس و جو پس از `ALTER TABLE [db.]table`). + +**\_بروزرسانی** - هنگامی که این دستور جهش برای اجرای ارسال شد . + +**\_شمارهی بلوک.ا\_ضافه کردن**, **\_شمارهی بلوک.شماره** - ستون تو در تو . برای جهش از جداول تکرار, این شامل یک رکورد برای هر پارتیشن: شناسه پارتیشن و شماره بلوک که توسط جهش خریداری شد (در هر پارتیشن, تنها بخش هایی که حاوی بلوک با اعداد کمتر از تعداد بلوک های خریداری شده توسط جهش در پارتیشن که جهش خواهد شد). در جداول غیر تکرار, تعداد بلوک در تمام پارتیشن به صورت یک توالی واحد. این به این معنی است که برای جهش از جداول غیر تکرار, ستون یک رکورد با یک عدد بلوک واحد خریداری شده توسط جهش شامل. + +**\_کوچکنمایی** - تعدادی از قطعات داده است که نیاز به جهش را به پایان برساند جهش یافته است . + +**\_مخفی کردن** - توجه داشته باشید که حتی اگر `parts_to_do = 0` ممکن است که جهش جدول تکرار هنوز به دلیل درج طولانی در حال اجرا است که ایجاد بخش داده های جدید است که نیاز به جهش انجام می شود است. + +اگر مشکلی با جهش برخی از قطعات وجود دارد, ستون های زیر حاوی اطلاعات اضافی: + +**\_شروع مجدد** - نام جدید ترین بخش است که نمی تواند جهش یافته است. + +**زمان \_رشته** - زمان جدید ترین شکست جهش بخشی . + +**\_شروع مجدد** - پیام استثنا که باعث شکست جهش بخشی اخیر. + +## سیستم.دیسکها {#system_tables-disks} + +حاوی اطلاعات در مورد دیسک های تعریف شده در [پیکربندی کارساز](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +ستونها: + +- `name` ([رشته](../sql-reference/data-types/string.md)) — Name of a disk in the server configuration. +- `path` ([رشته](../sql-reference/data-types/string.md)) — Path to the mount point in the file system. +- `free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Free space on disk in bytes. +- `total_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Disk volume in bytes. +- `keep_free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` پارامتر پیکربندی دیسک. + +## سیستم.داستان\_یابی {#system_tables-storage_policies} + +حاوی اطلاعات در مورد سیاست های ذخیره سازی و حجم تعریف شده در [پیکربندی کارساز](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +ستونها: + +- `policy_name` ([رشته](../sql-reference/data-types/string.md)) — Name of the storage policy. +- `volume_name` ([رشته](../sql-reference/data-types/string.md)) — Volume name defined in the storage policy. +- `volume_priority` ([UInt64](../sql-reference/data-types/int-uint.md)) — Volume order number in the configuration. +- `disks` ([رشته)](../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. +- `max_data_part_size` ([UInt64](../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). +- `move_factor` ([جسم شناور64](../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. + +اگر سیاست ذخیره سازی شامل بیش از یک حجم, سپس اطلاعات برای هر حجم در ردیف فرد از جدول ذخیره می شود. + +[مقاله اصلی](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/fa/operations/system_tables.md b/docs/fa/operations/system_tables.md deleted file mode 100644 index 6d393432c18..00000000000 --- a/docs/fa/operations/system_tables.md +++ /dev/null @@ -1,1097 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 52 -toc_title: "\u062C\u062F\u0627\u0648\u0644 \u0633\u06CC\u0633\u062A\u0645" ---- - -# جداول سیستم {#system-tables} - -جداول سیستم برای اجرای بخشی از قابلیت های سیستم استفاده می شود و برای دسترسی به اطلاعات در مورد چگونگی کار سیستم. -شما می توانید یک جدول سیستم را حذف کنید (اما شما می توانید جدا انجام). -جداول سیستم فایل های با داده ها بر روی دیسک و یا فایل های با ابرداده ندارد. سرور ایجاد تمام جداول سیستم زمانی که شروع می شود. -جداول سیستم فقط خواندنی. -این در واقع ‘system’ پایگاه داده است. - -## سیستم.\_نامهنویسی ناهمزمان {#system_tables-asynchronous_metrics} - -شامل معیارهای که به صورت دوره ای در پس زمینه محاسبه می شود. مثلا, مقدار رم در حال استفاده. - -ستونها: - -- `metric` ([رشته](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([جسم شناور64](../sql_reference/data_types/float.md)) — Metric value. - -**مثال** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**همچنین نگاه کنید به** - -- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. -- [سیستم.متریک](#system_tables-metrics) — Contains instantly calculated metrics. -- [سیستم.رویدادها](#system_tables-events) — Contains a number of events that have occurred. -- [سیستم.\_اشکالزدایی](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. - -## سیستم.خوشه {#system-clusters} - -حاوی اطلاعاتی در مورد خوشه های موجود در فایل پیکربندی و سرورهای موجود در ان. - -ستونها: - -- `cluster` (String) — The cluster name. -- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. -- `shard_weight` (UInt32) — The relative weight of the shard when writing data. -- `replica_num` (UInt32) — The replica number in the shard, starting from 1. -- `host_name` (String) — The host name, as specified in the config. -- `host_address` (String) — The host IP address obtained from DNS. -- `port` (UInt16) — The port to use for connecting to the server. -- `user` (String) — The name of the user for connecting to the server. -- `errors_count` (اوینت32) - تعداد دفعاتی که این میزبان موفق به رسیدن به ماکت. -- `estimated_recovery_time` (اوینت32) - ثانیه به سمت چپ تا زمانی که تعداد خطا ماکت صفر است و در نظر گرفته می شود به حالت عادی. - -لطفا توجه داشته باشید که `errors_count` یک بار در هر پرس و جو به خوشه به روز, ولی `estimated_recovery_time` بر روی تقاضا محاسبه شده است. بنابراین می تواند یک مورد غیر صفر باشد `errors_count` و صفر `estimated_recovery_time`, که پرس و جو بعدی صفر خواهد شد `errors_count` و سعی کنید به استفاده از ماکت به عنوان اگر هیچ خطا. - -**همچنین نگاه کنید به** - -- [موتور جدول توزیع شده است](../engines/table_engines/special/distributed.md) -- [تنظیمات \_فرهنگ توزیع میشود](settings/settings.md#settings-distributed_replica_error_cap) -- [پخش \_راپیشا\_را\_را\_را\_حالف\_لایف تنظیم](settings/settings.md#settings-distributed_replica_error_half_life) - -## سیستم.ستونها {#system-columns} - -حاوی اطلاعات در مورد ستون در تمام جداول. - -شما می توانید با استفاده از این جدول برای دریافت اطلاعات مشابه به [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table) پرس و جو, اما برای جداول متعدد در یک بار. - -این `system.columns` جدول شامل ستون های زیر (نوع ستون در براکت نشان داده شده است): - -- `database` (String) — Database name. -- `table` (String) — Table name. -- `name` (String) — Column name. -- `type` (String) — Column type. -- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) برای مقدار پیش فرض, و یا یک رشته خالی اگر تعریف نشده است. -- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. -- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. -- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. -- `marks_bytes` (UInt64) — The size of marks, in bytes. -- `comment` (String) — Comment on the column, or an empty string if it is not defined. -- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. -- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. -- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. -- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. - -## سیستم.یاریدهندکان {#system-contributors} - -حاوی اطلاعات در مورد همکاران. همه مربیان به صورت تصادفی. سفارش تصادفی در زمان اجرای پرس و جو است. - -ستونها: - -- `name` (String) — Contributor (author) name from git log. - -**مثال** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -برای پیدا کردن خود را در جدول, استفاده از یک پرس و جو: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## سیستم.پایگاههای داده {#system-databases} - -این جدول شامل یک ستون رشته ای به نام ‘name’ – the name of a database. -هر پایگاه داده که سرور می داند در مورد یک ورودی مربوطه را در جدول. -این جدول سیستم برای اجرای استفاده می شود `SHOW DATABASES` پرس و جو. - -## سیستم.قطعات مجزا {#system_tables-detached_parts} - -حاوی اطلاعات در مورد قطعات جدا شده از [ادغام](../engines/table_engines/mergetree_family/mergetree.md) میز این `reason` ستون مشخص می کند که چرا بخش جدا شد. برای قطعات کاربر جدا, دلیل خالی است. چنین قطعات را می توان با [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) فرمان. برای توضیحات ستون های دیگر را ببینید [سیستم.قطعات](#system_tables-parts). اگر نام قسمت نامعتبر است, ارزش برخی از ستون ممکن است `NULL`. این قطعات را می توان با حذف [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). - -## سیستم.واژهنامهها {#system-dictionaries} - -شامل اطلاعات در مورد لغت نامه های خارجی. - -ستونها: - -- `name` (String) — Dictionary name. -- `type` (String) — Dictionary type: Flat, Hashed, Cache. -- `origin` (String) — Path to the configuration file that describes the dictionary. -- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. -- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. -- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. -- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. -- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. -- `element_count` (UInt64) — The number of items stored in the dictionary. -- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). -- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. -- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn't be created. -- `source` (String) — Text describing the data source for the dictionary. - -توجه داشته باشید که مقدار حافظه مورد استفاده توسط فرهنگ لغت متناسب با تعداد اقلام ذخیره شده در این نیست. بنابراین برای لغت نامه تخت و کش, تمام سلول های حافظه از پیش تعیین شده, صرف نظر از چگونه کامل فرهنگ لغت در واقع. - -## سیستم.رویدادها {#system_tables-events} - -حاوی اطلاعات در مورد تعدادی از حوادث که در سیستم رخ داده است. مثلا, در جدول, شما می توانید پیدا کنید که چگونه بسیاری از `SELECT` نمایش داده شد از سرور کلیک شروع پردازش شد. - -ستونها: - -- `event` ([رشته](../sql_reference/data_types/string.md)) — Event name. -- `value` ([UInt64](../sql_reference/data_types/int_uint.md)) — Number of events occurred. -- `description` ([رشته](../sql_reference/data_types/string.md)) — Event description. - -**مثال** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [سیستم.\_نامهنویسی ناهمزمان](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [سیستم.متریک](#system_tables-metrics) — Contains instantly calculated metrics. -- [سیستم.\_اشکالزدایی](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. - -## سیستم.توابع {#system-functions} - -حاوی اطلاعات در مورد توابع عادی و جمع. - -ستونها: - -- `name`(`String`) – The name of the function. -- `is_aggregate`(`UInt8`) — Whether the function is aggregate. - -## سیستم.بازداشت گرافیت {#system-graphite-retentions} - -حاوی اطلاعات در مورد پارامترها [لغزش \_ نمودار](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) که در جداول با استفاده [اطلاعات دقیق](../engines/table_engines/mergetree_family/graphitemergetree.md) موتورها. - -ستونها: - -- `config_name` ) رشته) - `graphite_rollup` نام پارامتر. -- `regexp` (رشته) - یک الگوی برای نام متریک. -- `function` (رشته) - نام تابع جمع. -- `age` (UInt64) - حداقل سن دیتا در ثانیه. -- `precision` (اوینت64) - چگونه دقیقا به تعریف سن داده ها در ثانیه. -- `priority` (UInt16) - الگوی اولویت است. -- `is_default` (UInt8) - آیا الگوی پیش فرض است. -- `Tables.database` (مجموعه (رشته)) - مجموعه ای از نام جداول پایگاه داده که از `config_name` پارامتر. -- `Tables.table` (صف (رشته)) - مجموعه ای از نام جدول که با استفاده از `config_name` پارامتر. - -## سیستم.ادغام {#system-merges} - -حاوی اطلاعات در مورد ادغام و جهش بخشی در حال حاضر در روند برای جداول در خانواده ادغام. - -ستونها: - -- `database` (String) — The name of the database the table is in. -- `table` (String) — Table name. -- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. -- `progress` (Float64) — The percentage of completed work from 0 to 1. -- `num_parts` (UInt64) — The number of pieces to be merged. -- `result_part_name` (String) — The name of the part that will be formed as the result of merging. -- `is_mutation` (اوینت8) - 1 اگر این فرایند جهش بخشی است. -- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. -- `total_size_marks` (UInt64) — The total number of marks in the merged parts. -- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. -- `rows_read` (UInt64) — Number of rows read. -- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. -- `rows_written` (UInt64) — Number of rows written. - -## سیستم.متریک {#system_tables-metrics} - -شامل معیارهای است که می تواند فورا محاسبه, و یا یک مقدار فعلی. مثلا, تعداد نمایش داده شد به طور همزمان پردازش و یا تاخیر ماکت فعلی. این جدول همیشه به روز. - -ستونها: - -- `metric` ([رشته](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — Metric value. -- `description` ([رشته](../sql_reference/data_types/string.md)) — Metric description. - -لیستی از معیارهای پشتیبانی شده شما می توانید در [افراد زیر در این افزونه مشارکت کردهاندپردازنده](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Common/CurrentMetrics.cpp) فایل منبع از خانه کلیک. - -**مثال** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [سیستم.\_نامهنویسی ناهمزمان](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [سیستم.رویدادها](#system_tables-events) — Contains a number of events that occurred. -- [سیستم.\_اشکالزدایی](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. - -## سیستم.\_اشکالزدایی {#system_tables-metric_log} - -دارای تاریخچه معیارهای ارزش از جداول `system.metrics` و `system.events`, دوره ای به دیسک سرخ. -برای روشن کردن مجموعه تاریخچه معیارهای در `system.metric_log` ایجاد `/etc/clickhouse-server/config.d/metric_log.xml` با محتوای زیر: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**مثال** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**همچنین نگاه کنید به** - -- [سیستم.\_نامهنویسی ناهمزمان](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [سیستم.رویدادها](#system_tables-events) — Contains a number of events that occurred. -- [سیستم.متریک](#system_tables-metrics) — Contains instantly calculated metrics. -- [نظارت](monitoring.md) — Base concepts of ClickHouse monitoring. - -## سیستم.اعداد {#system-numbers} - -این جدول شامل یک uint64 ستون به نام ‘number’ که شامل تقریبا تمام اعداد طبیعی با شروع از صفر. -شما می توانید این جدول برای تست استفاده, و یا اگر شما نیاز به انجام یک جستجو نیروی بی رحم. -بار خوانده شده از این جدول موازی نیست. - -## سیستم.\_شماره حساب {#system-numbers-mt} - -همان ‘system.numbers’ اما بار خوانده شده موازی هستند. اعداد را می توان در هر سفارش بازگشت. -مورد استفاده برای تست. - -## سیستم.یک {#system-one} - -این جدول شامل یک ردیف با یک ‘dummy’ در زیر8 ستون حاوی مقدار 0. -این جدول استفاده می شود اگر پرس و جو را انتخاب کنید از بند مشخص نیست. -این شبیه میز دوگانه است که در سایر موارد یافت می شود. - -## سیستم.قطعات {#system_tables-parts} - -حاوی اطلاعات در مورد بخش هایی از [ادغام](../engines/table_engines/mergetree_family/mergetree.md) میز - -هر سطر توصیف یک بخش داده. - -ستونها: - -- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql_reference/statements/alter.md#query_language_queries_alter) پرس و جو. - - فرشها: - - - `YYYYMM` برای پارتیشن بندی خودکار در ماه. - - `any_string` هنگامی که پارتیشن بندی دستی. - -- `name` (`String`) – Name of the data part. - -- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it's used in a table. Otherwise, it's deleted. Inactive data parts remain after merging. - -- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` با دانه دانه دانه شاخص (معمولا 8192) (این اشاره برای دانه دانه تطبیقی کار نمی کند). - -- `rows` (`UInt64`) – The number of rows. - -- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. - -- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `marks_bytes` (`UInt64`) – The size of the file with marks. - -- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| - -- `remove_time` (`DateTime`) – The time when the data part became inactive. - -- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. - -- `min_date` (`Date`) – The minimum value of the date key in the data part. - -- `max_date` (`Date`) – The maximum value of the date key in the data part. - -- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. - -- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. - -- `partition_id` (`String`) – ID of the partition. - -- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. - -- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. - -- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. - -- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. - -- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn't exist. For more details, see [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition) - -- `database` (`String`) – Name of the database. - -- `table` (`String`) – Name of the table. - -- `engine` (`String`) – Name of the table engine without parameters. - -- `path` (`String`) – Absolute path to the folder with data part files. - -- `disk` (`String`) – Name of a disk that stores the data part. - -- `hash_of_all_files` (`String`) – [سیفون128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) از فایل های فشرده. - -- `hash_of_uncompressed_files` (`String`) – [سیفون128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) از فایل های غیر فشرده (فایل های با علامت, فایل شاخص و غیره.). - -- `uncompressed_hash_of_compressed_files` (`String`) – [سیفون128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) از داده ها در فایل های فشرده به عنوان اگر غیر فشرده شد. - -- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. - -- `marks_size` (`UInt64`) – Alias for `marks_bytes`. - -## سیستم.\_خروج {#system_tables-part-log} - -این `system.part_log` جدول تنها در صورتی ایجاد می شود [\_خروج](server_configuration_parameters/settings.md#server_configuration_parameters-part-log) تنظیم سرور مشخص شده است. - -این جدول حاوی اطلاعات در مورد اتفاقاتی که با رخ داده است [قطعات داده](../engines/table_engines/mergetree_family/custom_partitioning_key.md) در [ادغام](../engines/table_engines/mergetree_family/mergetree.md) جداول خانواده, مانند اضافه کردن و یا ادغام داده ها. - -این `system.part_log` جدول شامل ستون های زیر است: - -- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: - - `NEW_PART` — Inserting of a new data part. - - `MERGE_PARTS` — Merging of data parts. - - `DOWNLOAD_PART` — Downloading a data part. - - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — Mutating of a data part. - - `MOVE_PART` — Moving the data part from the one disk to another one. -- `event_date` (Date) — Event date. -- `event_time` (DateTime) — Event time. -- `duration_ms` (UInt64) — Duration. -- `database` (String) — Name of the database the data part is in. -- `table` (String) — Name of the table the data part is in. -- `part_name` (String) — Name of the data part. -- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ ارزش اگر پارتیشن بندی توسط `tuple()`. -- `rows` (UInt64) — The number of rows in the data part. -- `size_in_bytes` (UInt64) — Size of the data part in bytes. -- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). -- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. -- `read_rows` (UInt64) — The number of rows was read during the merge. -- `read_bytes` (UInt64) — The number of bytes was read during the merge. -- `error` (UInt16) — The code number of the occurred error. -- `exception` (String) — Text message of the occurred error. - -این `system.part_log` جدول پس از اولین قرار دادن داده ها به ایجاد `MergeTree` جدول - -## سیستم.فرایندها {#system_tables-processes} - -این جدول سیستم برای اجرای استفاده می شود `SHOW PROCESSLIST` پرس و جو. - -ستونها: - -- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` کاربر. زمینه شامل نام کاربری برای یک پرس و جو خاص, نه برای پرس و جو که این پرس و جو شروع. -- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` در سرور درخواست پرس و جو. -- `elapsed` (Float64) – The time in seconds since request execution started. -- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. -- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [\_کاساژ بیشینه](../operations/settings/query_complexity.md#settings_max_memory_usage) تنظیمات. -- `query` (String) – The query text. For `INSERT` این شامل داده ها برای وارد کردن نیست. -- `query_id` (String) – Query ID, if defined. - -## سیستم.\_خروج {#system-tables-text-log} - -شامل ورودی ورود به سیستم. سطح ورود به سیستم که می رود به این جدول را می توان با محدود `text_log.level` تنظیم سرور. - -ستونها: - -- `event_date` (`Date`)- تاریخ ورود. -- `event_time` (`DateTime`)- زمان ورود . -- `microseconds` (`UInt32`)- میکروثانیه از ورود. -- `thread_name` (String) — Name of the thread from which the logging was done. -- `thread_id` (UInt64) — OS thread ID. -- `level` (`Enum8`)- ورود به سطح . - - `'Fatal' = 1` - - `'Critical' = 2` - - `'Error' = 3` - - `'Warning' = 4` - - `'Notice' = 5` - - `'Information' = 6` - - `'Debug' = 7` - - `'Trace' = 8` -- `query_id` (`String`)- شناسه پرس و جو . -- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) -- `message` (`String`)- پیام خود را. -- `revision` (`UInt32`)- تجدید نظر کلیک کنیدهاوس . -- `source_file` (`LowCardinality(String)`)- فایل منبع که از ورود به سیستم انجام شد . -- `source_line` (`UInt64`)- خط منبع که از ورود به سیستم انجام شد. - -## سیستم.\_خروج {#system_tables-query_log} - -حاوی اطلاعات در مورد اجرای نمایش داده شد. برای هر پرس و جو, شما می توانید زمان شروع پردازش را ببینید, مدت زمان پردازش, پیام های خطا و اطلاعات دیگر. - -!!! note "یادداشت" - جدول حاوی اطلاعات ورودی برای `INSERT` نمایش داده شد. - -تاتر این جدول را فقط در صورتی ایجاد می کند [\_خروج](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) پارامتر سرور مشخص شده است. این پارامتر مجموعه قوانین ورود به سیستم, مانند فاصله ورود به سیستم و یا نام جدول نمایش داده شد خواهد شد وارد سایت شوید. - -برای فعال کردن ورود به سیستم پرس و جو, تنظیم [\_خروج](settings/settings.md#settings-log-queries) پارامتر به 1. برای اطلاعات بیشتر [تنظیمات](settings/settings.md) بخش. - -این `system.query_log` جدول ثبت دو نوع نمایش داده شد: - -1. نمایش داده شد اولیه که به طور مستقیم توسط مشتری اجرا شد. -2. کودک نمایش داده شد که توسط دیگر نمایش داده شد (برای اجرای پرس و جو توزیع). برای این نوع از نمایش داده شد, اطلاعات در مورد پدر و مادر نمایش داده شد در نشان داده شده است `initial_*` ستون ها - -ستونها: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` نمایش داده شد, تعداد ردیف نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. -- `written_bytes` (UInt64) — For `INSERT` نمایش داده شد, تعداد بایت نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [کلیک مشتری](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی اجرا می شود. -- `client_name` (String) — The [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نام مشتری تی پی. -- `client_revision` (UInt32) — Revision of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. -- `client_version_major` (UInt32) — Major version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. -- `client_version_minor` (UInt32) — Minor version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. -- `client_version_patch` (UInt32) — Patch component of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نسخه مشتری تی سی پی. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` روش مورد استفاده قرار گرفت. - - 2 — `POST` روش مورد استفاده قرار گرفت. -- `http_user_agent` (String) — The `UserAgent` هدر در درخواست قام منتقل می شود. -- `quota_key` (String) — The “quota key” مشخص شده در [سهمیه](quotas.md) تنظیم (دیدن `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [سیستم.رویدادها](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` ستون. -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` پارامتر به 1. -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` ستون. - -هر پرس و جو ایجاد یک یا دو ردیف در `query_log` جدول بسته به وضعیت پرس و جو: - -1. اگر اجرای پرس و جو موفق است, دو رویداد با انواع 1 و 2 ایجاد می شوند (دیدن `type` ستون). -2. اگر یک خطا در طول پردازش پرس و جو رخ داده است, دو رویداد با انواع 1 و 4 ایجاد می شوند. -3. اگر یک خطا قبل از راه اندازی پرس و جو رخ داده است, یک رویداد واحد با نوع 3 ایجاد شده است. - -به طور پیش فرض, سیاهههای مربوط به جدول در فواصل 7.5 ثانیه اضافه. شما می توانید این فاصله در مجموعه [\_خروج](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) تنظیم سرور (نگاه کنید به `flush_interval_milliseconds` پارامتر). به خیط و پیت کردن سیاهههای مربوط به زور از بافر حافظه را به جدول, استفاده از `SYSTEM FLUSH LOGS` پرس و جو. - -هنگامی که جدول به صورت دستی حذف, به طور خودکار در پرواز ایجاد. توجه داشته باشید که تمام سیاهههای مربوط قبلی حذف خواهد شد. - -!!! note "یادداشت" - دوره ذخیره سازی برای سیاهههای مربوط نامحدود است. سیاهههای مربوط به طور خودکار از جدول حذف نمی شود. شما نیاز به سازماندهی حذف سیاهههای مربوط منسوخ شده خود را. - -شما می توانید یک کلید پارتیشن بندی دلخواه برای مشخص `system.query_log` جدول در [\_خروج](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) تنظیم سرور (نگاه کنید به `partition_by` پارامتر). - -## سیستم.\_ر\_خروج {#system_tables-query-thread-log} - -جدول شامل اطلاعات در مورد هر موضوع اجرای پرس و جو. - -تاتر این جدول را فقط در صورتی ایجاد می کند [\_ر\_خروج](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) پارامتر سرور مشخص شده است. این پارامتر مجموعه قوانین ورود به سیستم, مانند فاصله ورود به سیستم و یا نام جدول نمایش داده شد خواهد شد وارد سایت شوید. - -برای فعال کردن ورود به سیستم پرس و جو, تنظیم [باز کردن](settings/settings.md#settings-log-query-threads) پارامتر به 1. برای اطلاعات بیشتر [تنظیمات](settings/settings.md) بخش. - -ستونها: - -- `event_date` (Date) — the date when the thread has finished execution of the query. -- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` نمایش داده شد, تعداد ردیف نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. -- `written_bytes` (UInt64) — For `INSERT` نمایش داده شد, تعداد بایت نوشته شده. برای نمایش داده شد دیگر مقدار ستون 0 است. -- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. -- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. -- `thread_name` (String) — Name of the thread. -- `thread_number` (UInt32) — Internal thread ID. -- `os_thread_id` (Int32) — OS thread ID. -- `master_thread_id` (UInt64) — OS initial ID of initial thread. -- `query` (String) — Query string. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [کلیک مشتری](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی اجرا می شود. -- `client_name` (String) — The [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نام مشتری تی پی. -- `client_revision` (UInt32) — Revision of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. -- `client_version_major` (UInt32) — Major version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. -- `client_version_minor` (UInt32) — Minor version of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از مشتری تی پی. -- `client_version_patch` (UInt32) — Patch component of the [کلیک مشتری](../interfaces/cli.md) یا یکی دیگر از نسخه مشتری تی سی پی. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` روش مورد استفاده قرار گرفت. - - 2 — `POST` روش مورد استفاده قرار گرفت. -- `http_user_agent` (String) — The `UserAgent` هدر در درخواست قام منتقل می شود. -- `quota_key` (String) — The “quota key” مشخص شده در [سهمیه](quotas.md) تنظیم (دیدن `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [سیستم.رویدادها](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` ستون. - -به طور پیش فرض, سیاهههای مربوط به جدول در فواصل 7.5 ثانیه اضافه. شما می توانید این فاصله در مجموعه [\_ر\_خروج](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) تنظیم سرور (نگاه کنید به `flush_interval_milliseconds` پارامتر). به خیط و پیت کردن سیاهههای مربوط به زور از بافر حافظه را به جدول, استفاده از `SYSTEM FLUSH LOGS` پرس و جو. - -هنگامی که جدول به صورت دستی حذف, به طور خودکار در پرواز ایجاد. توجه داشته باشید که تمام سیاهههای مربوط قبلی حذف خواهد شد. - -!!! note "یادداشت" - دوره ذخیره سازی برای سیاهههای مربوط نامحدود است. سیاهههای مربوط به طور خودکار از جدول حذف نمی شود. شما نیاز به سازماندهی حذف سیاهههای مربوط منسوخ شده خود را. - -شما می توانید یک کلید پارتیشن بندی دلخواه برای مشخص `system.query_thread_log` جدول در [\_ر\_خروج](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) تنظیم سرور (نگاه کنید به `partition_by` پارامتر). - -## سیستم.\_قطع {#system_tables-trace_log} - -حاوی ردیاب های پشته ای است که توسط پروفایل پرس و جو نمونه گیری می شود. - -تاتر این جدول زمانی ایجاد می کند [\_قطع](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) بخش پیکربندی سرور تنظیم شده است. همچنین [جستجو](settings/settings.md#query_profiler_real_time_period_ns) و [ایران در تهران](settings/settings.md#query_profiler_cpu_time_period_ns) تنظیمات باید تنظیم شود. - -برای تجزیه و تحلیل سیاهههای مربوط, استفاده از `addressToLine`, `addressToSymbol` و `demangle` توابع درون گرایی. - -ستونها: - -- `event_date`([تاریخ](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time`([DateTime](../sql_reference/data_types/datetime.md)) — Timestamp of sampling moment. - -- `revision`([UInt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - هنگام اتصال به سرور توسط `clickhouse-client`, شما رشته شبیه به دیدن `Connected to ClickHouse server version 19.18.1 revision 54429.`. این فیلد شامل `revision` اما نه `version` از یک سرور. - -- `timer_type`([شمار8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` نشان دهنده زمان دیوار ساعت. - - `CPU` نشان دهنده زمان پردازنده. - -- `thread_number`([UInt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id`([رشته](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [\_خروج](#system_tables-query_log) جدول سیستم. - -- `trace`([Array(UInt64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**مثال** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## سیستم.تکرار {#system_tables-replicas} - -شامل اطلاعات و وضعیت برای جداول تکرار ساکن بر روی سرور محلی. -این جدول را می توان برای نظارت استفاده می شود. جدول شامل یک ردیف برای هر تکرار \* جدول. - -مثال: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -ستونها: - -- `database` (`String`)- نام پایگاه داده -- `table` (`String`)- نام جدول -- `engine` (`String`)- نام موتور جدول -- `is_leader` (`UInt8`)- چه ماکت رهبر است. - فقط یک ماکت در یک زمان می تواند رهبر باشد. رهبر برای انتخاب پس زمینه ادغام به انجام است. - توجه داشته باشید که می نویسد را می توان به هر ماکت است که در دسترس است و یک جلسه در زک انجام, صرف نظر از اینکه این یک رهبر است. -- `can_become_leader` (`UInt8`)- چه ماکت می تواند به عنوان یک رهبر انتخاب می شوند. -- `is_readonly` (`UInt8`)- چه ماکت در حالت فقط خواندنی است. - در این حالت روشن است اگر پیکربندی ندارد بخش با باغ وحش اگر یک خطای ناشناخته رخ داده است که reinitializing جلسات در باغ وحش و در طول جلسه reinitialization در باغ وحش. -- `is_session_expired` (`UInt8`)- جلسه با باغ وحش منقضی شده است. در واقع همان `is_readonly`. -- `future_parts` (`UInt32`)- تعداد قطعات داده است که به عنوان نتیجه درج و یا ادغام که هنوز انجام نشده است ظاهر می شود. -- `parts_to_check` (`UInt32`)- تعداد قطعات داده در صف برای تایید. اگر شک وجود دارد که ممکن است صدمه دیده است بخشی در صف تایید قرار داده است. -- `zookeeper_path` (`String`)- مسیر به داده های جدول در باغ وحش. -- `replica_name` (`String`)- نام ماکت در باغ وحش. کپی های مختلف از همان جدول نام های مختلف. -- `replica_path` (`String`)- مسیر به داده های ماکت در باغ وحش. همان الحاق ‘zookeeper\_path/replicas/replica\_path’. -- `columns_version` (`Int32`)- تعداد نسخه از ساختار جدول . نشان می دهد که چند بار تغییر انجام شد. اگر کپی نسخه های مختلف, به این معنی برخی از کپی ساخته شده است همه از تغییر نکرده است. -- `queue_size` (`UInt32`)- اندازه صف برای عملیات در حال انتظار برای انجام شود . عملیات شامل قرار دادن بلوک های داده ادغام و برخی اقدامات دیگر. معمولا همزمان با `future_parts`. -- `inserts_in_queue` (`UInt32`)- تعداد درج بلوک از داده ها که نیاز به ساخته شده است . درج معمولا نسبتا به سرعت تکرار. اگر این تعداد بزرگ است, به این معنی چیزی اشتباه است. -- `merges_in_queue` (`UInt32`)- تعداد ادغام انتظار ساخته شود. گاهی اوقات ادغام طولانی هستند, بنابراین این مقدار ممکن است بیشتر از صفر برای یک مدت طولانی. -- `part_mutations_in_queue` (`UInt32`)- تعداد جهش در انتظار ساخته شده است. -- `queue_oldest_time` (`DateTime`)- اگر `queue_size` بیشتر از 0, نشان می دهد که قدیمی ترین عملیات به صف اضافه شد. -- `inserts_oldest_time` (`DateTime` دیدن وضعیت شبکه `queue_oldest_time` -- `merges_oldest_time` (`DateTime` دیدن وضعیت شبکه `queue_oldest_time` -- `part_mutations_oldest_time` (`DateTime` دیدن وضعیت شبکه `queue_oldest_time` - -4 ستون بعدی یک مقدار غیر صفر تنها جایی که یک جلسه فعال با زک وجود دارد. - -- `log_max_index` (`UInt64`)- حداکثر تعداد ورودی در ورود به سیستم از فعالیت های عمومی. -- `log_pointer` (`UInt64`) - حداکثر تعداد ورودی در ورود به سیستم از فعالیت های عمومی که ماکت کپی شده به صف اعدام خود را, به علاوه یک. اگر `log_pointer` بسیار کوچکتر از `log_max_index`, چیزی اشتباه است. -- `last_queue_update` (`DateTime`)- هنگامی که صف در زمان گذشته به روز شد. -- `absolute_delay` (`UInt64`)- تاخیر چقدر بزرگ در ثانیه ماکت فعلی است. -- `total_replicas` (`UInt8`)- تعداد کل کپی شناخته شده از این جدول. -- `active_replicas` (`UInt8`)- تعداد کپی از این جدول که یک جلسه در باغ وحش (یعنی تعداد تکرار عملکرد). - -اگر شما درخواست تمام ستون, جدول ممکن است کمی کند کار, از چند بار خوانده شده از باغ وحش برای هر سطر ساخته شده. -اگر شما درخواست آخرین 4 ستون (log\_max\_index, log\_pointer, total\_replicas, active\_replicas) جدول با این نسخهها کار به سرعت. - -مثلا, شما می توانید بررسی کنید که همه چیز به درستی کار مثل این: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -اگر این پرس و جو چیزی نمی گرداند, به این معنی که همه چیز خوب است. - -## سیستم.تنظیمات {#system-settings} - -حاوی اطلاعات در مورد تنظیمات که در حال حاضر در حال استفاده. -به عنوان مثال مورد استفاده برای اجرای پرس و جو شما با استفاده از به خواندن از سیستم. جدول تنظیمات. - -ستونها: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. -- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [قیدها](settings/constraints_on_settings.md#constraints-on-settings)). -- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [قیدها](settings/constraints_on_settings.md#constraints-on-settings)). -- `readonly` (UInt8) — Can user change this setting (for more info, look into [قیدها](settings/constraints_on_settings.md#constraints-on-settings)). - -مثال: - -``` sql -SELECT name, value -FROM system.settings -WHERE changed -``` - -``` text -┌─name───────────────────┬─value───────┐ -│ max_threads │ 8 │ -│ use_uncompressed_cache │ 0 │ -│ load_balancing │ random │ -│ max_memory_usage │ 10000000000 │ -└────────────────────────┴─────────────┘ -``` - -## سیستم.خرابی در حذف گواهینامهها {#system-merge_tree_settings} - -حاوی اطلاعات در مورد تنظیمات برای `MergeTree` میز - -ستونها: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. - -## سیستم.\_زبانهها {#system-table-engines} - -شامل شرح موتورهای جدول پشتیبانی شده توسط سرور و اطلاعات پشتیبانی از ویژگی های خود را. - -این جدول شامل ستون های زیر (نوع ستون در براکت نشان داده شده است): - -- `name` (String) — The name of table engine. -- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` بند بند. -- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [پرش شاخص](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` و `SAMPLE_BY`. -- `supports_replication` (UInt8) — Flag that indicates if table engine supports [تکرار داده ها](../engines/table_engines/mergetree_family/replication.md). -- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. - -مثال: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- ادغام خانواده [بندهای پرسوجو](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) -- کافکا [تنظیمات](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) -- پیوستن [تنظیمات](../engines/table_engines/special/join.md#join-limitations-and-settings) - -## سیستم.جداول {#system-tables} - -حاوی ابرداده از هر جدول که سرور می داند در مورد. جداول جداگانه در نشان داده نمی شود `system.tables`. - -این جدول شامل ستون های زیر (نوع ستون در براکت نشان داده شده است): - -- `database` (String) — The name of the database the table is in. - -- `name` (String) — Table name. - -- `engine` (String) — Table engine name (without parameters). - -- `is_temporary` (زیر8) - پرچم که نشان می دهد که جدول موقت است. - -- `data_path` (رشته) - مسیر به داده های جدول در سیستم فایل. - -- `metadata_path` (رشته) - مسیر به ابرداده جدول در سیستم فایل. - -- `metadata_modification_time` (تاریخ ساعت) - زمان شدن اصلاح ابرداده جدول. - -- `dependencies_database` - وابستگی پایگاه داده . - -- `dependencies_table` (رشته)) - وابستگی های جدول ([ماده بینی](../engines/table_engines/special/materializedview.md) جداول بر اساس جدول فعلی). - -- `create_table_query` (رشته) - پرس و جو که برای ایجاد جدول مورد استفاده قرار گرفت. - -- `engine_full` (رشته) - پارامترهای موتور جدول. - -- `partition_key` (رشته) - بیان کلید پارتیشن مشخص شده در جدول. - -- `sorting_key` (رشته) - عبارت کلیدی مرتب سازی مشخص شده در جدول. - -- `primary_key` (رشته) - عبارت کلیدی اولیه مشخص شده در جدول. - -- `sampling_key` (رشته) - نمونه عبارت کلیدی مشخص شده در جدول. - -- `storage_policy` (رشته) - سیاست ذخیره سازی: - - - [ادغام](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) - - [توزیع شده](../engines/table_engines/special/distributed.md#distributed) - -- `total_rows` (Nullable(UInt64)) - تعداد کل ردیف آن است که اگر ممکن است به سرعت تعیین دقیق تعداد ردیف در جدول در غیر این صورت `Null` (از جمله زیرینگ `Buffer` جدول). - -- `total_bytes` (Nullable(UInt64)) - مجموع تعداد بایت, اگر آن را ممکن است به سرعت تعیین دقیق تعداد بایت به صورت جدول ذخیره در غیر این صورت `Null` (**نه** شامل هر ذخیره سازی زمینه ای). - - - If the table stores data on disk, returns used space on disk (i.e. compressed). - - اگر جدول ذخیره داده ها در حافظه, بازده تعداد تقریبی بایت مورد استفاده در حافظه. - -این `system.tables` جدول در استفاده می شود `SHOW TABLES` اجرای پرس و جو. - -## سیستم.باغ وحش {#system-zookeeper} - -جدول وجود ندارد اگر باغ وحش پیکربندی نشده است. اجازه می دهد تا خواندن داده ها از خوشه باغ وحش تعریف شده در پیکربندی. -پرس و جو باید یک ‘path’ شرایط برابری در بند جایی که. این مسیر در باغ وحش برای کودکان که شما می خواهید برای دریافت اطلاعات برای است. - -پرسوجو `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` خروجی داده ها برای همه کودکان در `/clickhouse` گره. -به داده های خروجی برای تمام گره های ریشه, نوشتن مسیر = ‘/’. -اگر مسیر مشخص شده در ‘path’ وجود ندارد, یک استثنا پرتاب خواهد شد. - -ستونها: - -- `name` (String) — The name of the node. -- `path` (String) — The path to the node. -- `value` (String) — Node value. -- `dataLength` (Int32) — Size of the value. -- `numChildren` (Int32) — Number of descendants. -- `czxid` (Int64) — ID of the transaction that created the node. -- `mzxid` (Int64) — ID of the transaction that last changed the node. -- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. -- `ctime` (DateTime) — Time of node creation. -- `mtime` (DateTime) — Time of the last modification of the node. -- `version` (Int32) — Node version: the number of times the node was changed. -- `cversion` (Int32) — Number of added or removed descendants. -- `aversion` (Int32) — Number of changes to the ACL. -- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. - -مثال: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## سیستم.جهشها {#system_tables-mutations} - -جدول حاوی اطلاعات در مورد [جهشها](../sql_reference/statements/alter.md#alter-mutations) از جداول ادغام و پیشرفت خود را. هر دستور جهش توسط یک ردیف نشان داده شده است. جدول دارای ستون های زیر است: - -**دادگان**, **جدول** - نام پایگاه داده و جدول که جهش استفاده شد . - -**قطع عضو** - شناسه جهش. برای جداول تکرار این شناسه به نام زنود در مطابقت `/mutations/` راهنمای در باغ وحش. برای جداول سه برابر شناسه مربوط به فایل نام در دایرکتوری داده ها از جدول. - -**فرمان** - رشته فرمان جهش (بخشی از پرس و جو پس از `ALTER TABLE [db.]table`). - -**\_بروزرسانی** - هنگامی که این دستور جهش برای اجرای ارسال شد . - -**\_شمارهی بلوک.ا\_ضافه کردن**, **\_شمارهی بلوک.شماره** - ستون تو در تو . برای جهش از جداول تکرار, این شامل یک رکورد برای هر پارتیشن: شناسه پارتیشن و شماره بلوک که توسط جهش خریداری شد (در هر پارتیشن, تنها بخش هایی که حاوی بلوک با اعداد کمتر از تعداد بلوک های خریداری شده توسط جهش در پارتیشن که جهش خواهد شد). در جداول غیر تکرار, تعداد بلوک در تمام پارتیشن به صورت یک توالی واحد. این به این معنی است که برای جهش از جداول غیر تکرار, ستون یک رکورد با یک عدد بلوک واحد خریداری شده توسط جهش شامل. - -**\_کوچکنمایی** - تعدادی از قطعات داده است که نیاز به جهش را به پایان برساند جهش یافته است . - -**\_مخفی کردن** - توجه داشته باشید که حتی اگر `parts_to_do = 0` ممکن است که جهش جدول تکرار هنوز به دلیل درج طولانی در حال اجرا است که ایجاد بخش داده های جدید است که نیاز به جهش انجام می شود است. - -اگر مشکلی با جهش برخی از قطعات وجود دارد, ستون های زیر حاوی اطلاعات اضافی: - -**\_شروع مجدد** - نام جدید ترین بخش است که نمی تواند جهش یافته است. - -**زمان \_رشته** - زمان جدید ترین شکست جهش بخشی . - -**\_شروع مجدد** - پیام استثنا که باعث شکست جهش بخشی اخیر. - -## سیستم.دیسکها {#system_tables-disks} - -حاوی اطلاعات در مورد دیسک های تعریف شده در [پیکربندی کارساز](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -ستونها: - -- `name` ([رشته](../sql_reference/data_types/string.md)) — Name of a disk in the server configuration. -- `path` ([رشته](../sql_reference/data_types/string.md)) — Path to the mount point in the file system. -- `free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Free space on disk in bytes. -- `total_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Disk volume in bytes. -- `keep_free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` پارامتر پیکربندی دیسک. - -## سیستم.داستان\_یابی {#system_tables-storage_policies} - -حاوی اطلاعات در مورد سیاست های ذخیره سازی و حجم تعریف شده در [پیکربندی کارساز](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -ستونها: - -- `policy_name` ([رشته](../sql_reference/data_types/string.md)) — Name of the storage policy. -- `volume_name` ([رشته](../sql_reference/data_types/string.md)) — Volume name defined in the storage policy. -- `volume_priority` ([UInt64](../sql_reference/data_types/int_uint.md)) — Volume order number in the configuration. -- `disks` ([رشته)](../sql_reference/data_types/array.md)) — Disk names, defined in the storage policy. -- `max_data_part_size` ([UInt64](../sql_reference/data_types/int_uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). -- `move_factor` ([جسم شناور64](../sql_reference/data_types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. - -اگر سیاست ذخیره سازی شامل بیش از یک حجم, سپس اطلاعات برای هر حجم در ردیف فرد از جدول ذخیره می شود. - -[مقاله اصلی](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/fa/operations/tips.md b/docs/fa/operations/tips.md index f411e525012..1280a1a4b80 100644 --- a/docs/fa/operations/tips.md +++ b/docs/fa/operations/tips.md @@ -98,7 +98,7 @@ XFS نیز مناسب است اما از آن شده است به طور کامل شما احتمالا در حال حاضر با استفاده از باغ وحش برای مقاصد دیگر. شما می توانید نصب و راه اندازی همان باغ وحش استفاده, اگر در حال حاضر بیش از حد نیست. -It's best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. +It’s best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. شما هرگز نباید از اسکریپت های دستی نوشته شده برای انتقال داده ها بین خوشه های مختلف باغ وحش استفاده کنید زیرا نتیجه برای گره های متوالی نادرست خواهد بود. هرگز استفاده از “zkcopy” ابزار به همین دلیل: https://github.com/ksprojects/zkcopy/issues/15 diff --git a/docs/fa/operations/troubleshooting.md b/docs/fa/operations/troubleshooting.md index 73f30d78ec6..d8835727628 100644 --- a/docs/fa/operations/troubleshooting.md +++ b/docs/fa/operations/troubleshooting.md @@ -17,7 +17,7 @@ toc_title: "\u0639\u06CC\u0628 \u06CC\u0627\u0628\u06CC" ### شما می توانید بسته های دب از مخزن کلیک با مناسب دریافت کنید {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} - بررسی تنظیمات فایروال. -- اگر شما می توانید مخزن به هر دلیلی دسترسی پیدا کنید, دانلود بسته همانطور که در توصیف [شروع کار](../getting_started/index.md) مقاله و نصب دستی با استفاده از `sudo dpkg -i ` فرمان. همچنین شما می خواهد نیاز `tzdata` بسته +- اگر شما می توانید مخزن به هر دلیلی دسترسی پیدا کنید, دانلود بسته همانطور که در توصیف [شروع کار](../getting-started/index.md) مقاله و نصب دستی با استفاده از `sudo dpkg -i ` فرمان. همچنین شما می خواهد نیاز `tzdata` بسته ## اتصال به سرور {#troubleshooting-accepts-no-connections} @@ -105,7 +105,7 @@ $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-se - تنظیمات نقطه پایانی. - بررسی [\_نوست فهرست](server_configuration_parameters/settings.md#server_configuration_parameters-listen_host) و [\_صادر کردن](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port) تنظیمات. + بررسی [\_نوست فهرست](server-configuration-parameters/settings.md#server_configuration_parameters-listen_host) و [\_صادر کردن](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port) تنظیمات. سرور کلیک می پذیرد اتصالات مجنون تنها به طور پیش فرض. @@ -117,8 +117,8 @@ $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-se بررسی: - - این [\_شروع مجدد](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) تنظیمات. - - تنظیمات برای [SSL sertificates](server_configuration_parameters/settings.md#server_configuration_parameters-openssl). + - این [\_شروع مجدد](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) تنظیمات. + - تنظیمات برای [SSL sertificates](server-configuration-parameters/settings.md#server_configuration_parameters-openssl). استفاده از پارامترهای مناسب در حالی که اتصال. برای مثال با استفاده از `port_secure` پارامتر با `clickhouse_client`. diff --git a/docs/fa/operations/utilities/clickhouse-local.md b/docs/fa/operations/utilities/clickhouse-local.md index 8a77363f694..dd2bb84e7e2 100644 --- a/docs/fa/operations/utilities/clickhouse-local.md +++ b/docs/fa/operations/utilities/clickhouse-local.md @@ -9,7 +9,7 @@ toc_title: "\u06A9\u0644\u06CC\u06A9-\u0645\u062D\u0644\u06CC" این `clickhouse-local` برنامه شما را قادر به انجام پردازش سریع بر روی فایل های محلی, بدون نیاز به استقرار و پیکربندی سرور کلیک. -داده هایی را می پذیرد که نشان دهنده جداول و نمایش داده شد با استفاده از [ClickHouse SQL گویش](../../sql_reference/index.md). +داده هایی را می پذیرد که نشان دهنده جداول و نمایش داده شد با استفاده از [ClickHouse SQL گویش](../../sql-reference/index.md). `clickhouse-local` بنابراین پشتیبانی از بسیاری از ویژگی های و همان مجموعه ای از فرمت ها و موتورهای جدول با استفاده از هسته همان سرور تاتر. diff --git a/docs/fa/sql-reference/aggregate-functions/combinators.md b/docs/fa/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..93586706627 --- /dev/null +++ b/docs/fa/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,167 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u062A\u0631\u06A9\u06CC\u0628 \u06A9\u0646\u0646\u062F\u0647\u0647\u0627\ + \u06CC \u062A\u0627\u0628\u0639 \u062C\u0645\u0639" +--- + +# ترکیب کنندههای تابع جمع {#aggregate_functions_combinators} + +نام یک تابع جمع می تواند یک پسوند اضافه شده است. این تغییر راه تابع کلی کار می کند. + +## - اگر {#agg-functions-combinator-if} + +The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). + +مثالها: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` و به همین ترتیب. + +با توابع مجموع شرطی, شما می توانید مصالح برای چندین شرایط در یک بار محاسبه, بدون استفاده از کارخانه های فرعی و `JOIN`برای مثال در یاندکس.متریکا, توابع مجموع مشروط استفاده می شود برای پیاده سازی قابلیت مقایسه بخش. + +## حداقل صفحه نمایش: {#agg-functions-combinator-array} + +پسوند مجموعه را می توان به هر تابع جمع اضافه شده است. در این مورد, تابع کل استدلال از طول می کشد ‘Array(T)’ نوع (ارریس) به جای ‘T’ استدلال نوع. اگر تابع جمع استدلال های متعدد را می پذیرد, این باید مجموعه ای از طول های برابر شود. هنگامی که پردازش ارریس, تابع کل کار می کند مانند تابع کل اصلی در تمام عناصر مجموعه. + +مثال 1: `sumArray(arr)` - مجموع تمام عناصر از همه ‘arr’ اراریس در این مثال می توانست بیشتر به سادگی نوشته شده است: `sum(arraySum(arr))`. + +مثال 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ اراریس این می تواند انجام شود یک راه ساده تر: `uniq(arrayJoin(arr))` اما همیشه امکان اضافه کردن وجود ندارد ‘arrayJoin’ به پرس و جو. + +\- اگر و مجموعه ای می تواند ترکیب شود. هرچند, ‘Array’ پس اول باید بیای ‘If’. مثالها: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. با توجه به این سفارش ‘cond’ برهان صف نیست. + +## - وضعیت {#agg-functions-combinator-state} + +اگر شما درخواست این ترکیب, تابع کل می کند مقدار حاصل بازگشت نیست (مانند تعدادی از ارزش های منحصر به فرد برای [uniq](reference.md#agg_function-uniq) تابع) , اما یک دولت متوسط از تجمع (برای `uniq`, این جدول هش برای محاسبه تعداد ارزش های منحصر به فرد است). این یک `AggregateFunction(...)` که می تواند برای پردازش بیشتر استفاده می شود و یا ذخیره شده در یک جدول را به پایان برساند جمع بعد. + +برای کار با این کشورها, استفاده: + +- [ریزدانه](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) موتور جدول. +- [پلاکتی](../../sql-reference/functions/other-functions.md#function-finalizeaggregation) تابع. +- [خرابی اجرا](../../sql-reference/functions/other-functions.md#function-runningaccumulate) تابع. +- [- ادغام](#aggregate_functions_combinators_merge) ترکیب کننده. +- [اطلاعات دقیق](#aggregate_functions_combinators_mergestate) ترکیب کننده. + +## - ادغام {#aggregate_functions_combinators-merge} + +اگر شما درخواست این ترکیب, تابع کل طول می کشد حالت تجمع متوسط به عنوان یک استدلال, ترکیبی از کشورهای به پایان تجمع, و ارزش حاصل می گرداند. + +## اطلاعات دقیق {#aggregate_functions_combinators-mergestate} + +ادغام کشورهای تجمع متوسط در همان راه به عنوان ترکیب-ادغام. با این حال, این مقدار حاصل بازگشت نیست, اما یک دولت تجمع متوسط, شبیه به ترکیب دولت. + +## - فورچ {#agg-functions-combinator-foreach} + +تبدیل یک تابع جمع برای جداول به یک تابع کلی برای ارریس که جمع اقلام مجموعه مربوطه و مجموعه ای از نتایج را برمی گرداند. به عنوان مثال, `sumForEach` برای ارریس `[1, 2]`, `[3, 4, 5]`و`[6, 7]`نتیجه را برمی گرداند `[10, 13, 5]` پس از اضافه کردن با هم موارد مجموعه مربوطه. + +## شناسه بسته: {#agg-functions-combinator-ordefault} + +پر مقدار پیش فرض از نوع بازگشت تابع جمع است اگر چیزی برای جمع وجود دارد. + +``` sql +SELECT avg(number), avgOrDefault(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrDefault(number)─┐ +│ nan │ 0 │ +└─────────────┴──────────────────────┘ +``` + +## اطلاعات دقیق {#agg-functions-combinator-ornull} + +پر `null` در صورتی که هیچ چیز به جمع وجود دارد. ستون بازگشت قابل ابطال خواهد بود. + +``` sql +SELECT avg(number), avgOrNull(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrNull(number)─┐ +│ nan │ ᴺᵁᴸᴸ │ +└─────────────┴───────────────────┘ +``` + +-OrDefault و OrNull می تواند در ترکیب با دیگر combinators. این زمانی مفید است که تابع جمع می کند ورودی خالی را قبول نمی کند. + +``` sql +SELECT avgOrNullIf(x, x > 10) +FROM +( + SELECT toDecimal32(1.23, 2) AS x +) +``` + +``` text +┌─avgOrNullIf(x, greater(x, 10))─┐ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────┘ +``` + +## - نمونه {#agg-functions-combinator-resample} + +به شما امکان می دهد داده ها را به گروه تقسیم کنید و سپس به طور جداگانه داده ها را در این گروه ها جمع کنید. گروه ها با تقسیم مقادیر از یک ستون به فواصل ایجاد شده است. + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**پارامترها** + +- `start` — Starting value of the whole required interval for `resampling_key` ارزشهای خبری عبارتند از: +- `stop` — Ending value of the whole required interval for `resampling_key` ارزشهای خبری عبارتند از: کل فاصله شامل نمی شود `stop` مقدار `[start, stop)`. +- `step` — Step for separating the whole interval into subintervals. The `aggFunction` بیش از هر یک از این زیرگروه اعدام به طور مستقل. +- `resampling_key` — Column whose values are used for separating data into intervals. +- `aggFunction_params` — `aggFunction` پارامترها + +**مقادیر بازگشتی** + +- مجموعه ای از `aggFunction` نتایج جستجو برای هر subinterval. + +**مثال** + +در نظر بگیرید که `people` جدول با داده های زیر: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +بیایید نام افرادی که سن نهفته در فواصل `[30,60)` و `[60,75)`. پس ما با استفاده از نمایندگی عدد صحیح برای سن, ما سنین در `[30, 59]` و `[60,74]` فواصل زمانی. + +به نام کلی در مجموعه, ما با استفاده از [گرامری](reference.md#agg_function-grouparray) تابع جمع. طول می کشد تا یک استدلال. در مورد ما این است `name` ستون. این `groupArrayResample` تابع باید از `age` ستون به نام دانه های سن. برای تعریف فواصل مورد نیاز ما `30, 75, 30` نشانوندها به `groupArrayResample` تابع. + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) FROM people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +در نظر گرفتن نتایج. + +`Jonh` خارج از نمونه است چرا که او بیش از حد جوان است. افراد دیگر با توجه به فواصل زمانی مشخص شده توزیع می شوند. + +حالا اجازه دهید تعداد کل مردم و متوسط دستمزد خود را در فواصل سنی مشخص شده است. + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/fa/sql-reference/aggregate-functions/index.md b/docs/fa/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..6c8542765e8 --- /dev/null +++ b/docs/fa/sql-reference/aggregate-functions/index.md @@ -0,0 +1,62 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Aggregate Functions +toc_priority: 33 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# توابع مجموع {#aggregate-functions} + +توابع مجموع در کار [عادی](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) راه به عنوان کارشناسان پایگاه داده انتظار می رود. + +فاحشه خانه نیز پشتیبانی می کند: + +- [توابع مجموع پارامتری](parametric-functions.md#aggregate_functions_parametric), که قبول پارامترهای دیگر علاوه بر ستون. +- [ترکیب کنندهها](combinators.md#aggregate_functions_combinators) که تغییر رفتار مجموع توابع. + +## پردازش پوچ {#null-processing} + +در طول تجمع همه `NULL`بازدید کنندگان قلم می. + +**مثالها:** + +این جدول را در نظر بگیرید: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +بیایید می گویند شما نیاز به کل ارزش ها در `y` ستون: + +``` sql +SELECT sum(y) FROM t_null_big +``` + + ┌─sum(y)─┐ + │ 7 │ + └────────┘ + +این `sum` تابع تفسیر می کند `NULL` به عنوان `0`. به خصوص, این بدان معنی است که اگر تابع ورودی از یک انتخاب که تمام مقادیر دریافت `NULL` سپس نتیجه خواهد بود `0` نه `NULL`. + +حالا شما می توانید استفاده کنید `groupArray` تابع برای ایجاد مجموعه ای از `y` ستون: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` شامل نمی شود `NULL` در مجموعه ای نتیجه. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/fa/sql-reference/aggregate-functions/parametric-functions.md b/docs/fa/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..c8762b751e1 --- /dev/null +++ b/docs/fa/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,500 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: "\u062A\u0648\u0627\u0628\u0639 \u0645\u062C\u0645\u0648\u0639 \u067E\u0627\ + \u0631\u0627\u0645\u062A\u0631\u06CC" +--- + +# توابع مجموع پارامتری {#aggregate_functions_parametric} + +Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. + +## سابقهنما {#histogram} + +محاسبه هیستوگرام تطبیقی. این نتایج دقیق را تضمین نمی کند. + +``` sql +histogram(number_of_bins)(values) +``` + +توابع استفاده می کند [جریان الگوریتم درخت تصمیم موازی](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). مرزهای سطل هیستوگرام تنظیم به عنوان داده های جدید وارد یک تابع. در مورد مشترک عرض سطل برابر نیست. + +**پارامترها** + +`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. +`values` — [عبارت](../syntax.md#syntax-expressions) در نتیجه مقادیر ورودی. + +**مقادیر بازگشتی** + +- [& حذف](../../sql-reference/data-types/array.md) از [توپلس](../../sql-reference/data-types/tuple.md) از قالب زیر: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — Lower bound of the bin. + - `upper` — Upper bound of the bin. + - `height` — Calculated height of the bin. + +**مثال** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +شما می توانید یک هیستوگرام با تجسم [بار](../../sql-reference/functions/other-functions.md#function-bar) تابع برای مثال: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +در این مورد, شما باید به یاد داشته باشید که شما مرزهای هیستوگرام بن نمی دانند. + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +بررسی اینکه دنباله شامل یک زنجیره رویداد که منطبق بر الگوی. + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "اخطار" + رویدادهایی که در همان دوم رخ می دهد ممکن است در دنباله در سفارش تعریف نشده موثر بر نتیجه دراز. + +**پارامترها** + +- `pattern` — Pattern string. See [نحو الگو](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` و `DateTime`. شما همچنین می توانید هر یک از پشتیبانی استفاده کنید [اینترنت](../../sql-reference/data-types/int-uint.md) انواع داده ها. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. شما می توانید به تصویب تا 32 استدلال شرط. تابع طول می کشد تنها حوادث شرح داده شده در این شرایط به حساب. اگر دنباله حاوی اطلاعاتی است که در شرایط توصیف نشده, تابع پرش. + +**مقادیر بازگشتی** + +- 1, اگر الگوی همسان است. +- 0, اگر الگوی همسان نیست. + +نوع: `UInt8`. + + +**نحو الگو** + +- `(?N)` — Matches the condition argument at position `N`. شرایط در شماره `[1, 32]` محدوده. به عنوان مثال, `(?1)` با استدلال به تصویب رسید `cond1` پارامتر. + +- `.*` — Matches any number of events. You don’t need conditional arguments to match this element of the pattern. + +- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` مسابقات رویدادهایی که رخ می دهد بیش از 1800 ثانیه از یکدیگر. تعداد دلخواه از هر رویدادی می تواند بین این حوادث دراز. شما می توانید از `>=`, `>`, `<`, `<=` اپراتورها. + +**مثالها** + +داده ها را در نظر بگیرید `t` جدول: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +انجام پرس و جو: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +تابع زنجیره رویداد که تعداد پیدا شده است 2 زیر شماره 1. این قلم شماره 3 بین, چرا که تعداد به عنوان یک رویداد توصیف نشده. اگر ما می خواهیم این شماره را در نظر بگیریم هنگام جستجو برای زنجیره رویداد داده شده در مثال باید شرایط را ایجاد کنیم. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +در این مورد, تابع می تواند زنجیره رویداد تطبیق الگوی پیدا کنید, چرا که این رویداد برای شماره 3 رخ داده است بین 1 و 2. اگر در همان مورد ما شرایط را برای شماره بررسی 4, دنباله الگوی مطابقت. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**همچنین نگاه کنید** + +- [شمارش معکوس](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +شمارش تعداد زنجیره رویداد که الگوی همسان. تابع جستجو زنجیره رویداد که با هم همپوشانی دارند. این شروع به جستجو برای زنجیره بعدی پس از زنجیره فعلی همسان است. + +!!! warning "اخطار" + رویدادهایی که در همان دوم رخ می دهد ممکن است در دنباله در سفارش تعریف نشده موثر بر نتیجه دراز. + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**پارامترها** + +- `pattern` — Pattern string. See [نحو الگو](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` و `DateTime`. شما همچنین می توانید هر یک از پشتیبانی استفاده کنید [اینترنت](../../sql-reference/data-types/int-uint.md) انواع داده ها. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. شما می توانید به تصویب تا 32 استدلال شرط. تابع طول می کشد تنها حوادث شرح داده شده در این شرایط به حساب. اگر دنباله حاوی اطلاعاتی است که در شرایط توصیف نشده, تابع پرش. + +**مقادیر بازگشتی** + +- تعداد زنجیره رویداد غیر با هم تداخل دارند که همسان. + +نوع: `UInt64`. + +**مثال** + +داده ها را در نظر بگیرید `t` جدول: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +تعداد چند بار تعداد 2 پس از شماره 1 با هر مقدار از شماره های دیگر بین رخ می دهد: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [ترتیب سنج](#function-sequencematch) + +## در پنجره {#windowfunnel} + +جستجو برای زنجیره رویداد در یک پنجره زمان کشویی و محاسبه حداکثر تعداد رویدادهایی که از زنجیره رخ داده است. + +تابع با توجه به الگوریتم کار می کند: + +- تابع جستجو برای داده هایی که باعث شرط اول در زنجیره و مجموعه ضد رویداد به 1. این لحظه ای است که پنجره کشویی شروع می شود. + +- اگر حوادث از زنجیره پی در پی در پنجره رخ می دهد, ضد افزایش است. اگر دنباله ای از حوادث مختل شده است, شمارنده است افزایش نمی. + +- اگر داده های زنجیره رویداد های متعدد در نقاط مختلف از اتمام, تابع تنها خروجی به اندازه طولانی ترین زنجیره ای. + +**نحو** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**پارامترها** + +- `window` — Length of the sliding window in seconds. +- `mode` - این یک استدلال اختیاری است . + - `'strict'` - وقتی که `'strict'` تنظیم شده است, پنجره() اعمال شرایط تنها برای ارزش های منحصر به فرد. +- `timestamp` — Name of the column containing the timestamp. Data types supported: [تاریخ](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) و دیگر انواع عدد صحیح بدون علامت (توجه داشته باشید که حتی اگر برچسب زمان پشتیبانی از `UInt64` نوع, این مقدار می تواند بین المللی تجاوز نمی64 بیشترین, که 2^63 - 1). +- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql-reference/data-types/int-uint.md). + +**مقدار بازگشتی** + +حداکثر تعداد متوالی باعث شرایط از زنجیره ای در پنجره زمان کشویی. +تمام زنجیره ها در انتخاب تجزیه و تحلیل می شوند. + +نوع: `Integer`. + +**مثال** + +تعیین کنید که یک دوره زمانی معین برای کاربر کافی باشد تا گوشی را انتخاب کند و دو بار در فروشگاه اینترنتی خریداری کند. + +زنجیره ای از وقایع زیر را تنظیم کنید: + +1. کاربر وارد شده به حساب خود را در فروشگاه (`eventID = 1003`). +2. کاربر برای یک تلفن جستجو می کند (`eventID = 1007, product = 'phone'`). +3. کاربر سفارش داده شده (`eventID = 1009`). +4. کاربر دوباره سفارش داد (`eventID = 1010`). + +جدول ورودی: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +یافتن پست های تا چه حد کاربر `user_id` می تواند از طریق زنجیره ای در یک دوره در ژانویه و فوریه از 2019. + +پرسوجو: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +نتیجه: + +``` text +┌─level─┬─c─┐ +│ 4 │ 1 │ +└───────┴───┘ +``` + +## نگهداری {#retention} + +تابع طول می کشد به عنوان استدلال مجموعه ای از شرایط از 1 به 32 استدلال از نوع `UInt8` که نشان می دهد که یک بیماری خاص برای این رویداد مواجه شد. +هر گونه شرایط را می توان به عنوان یک استدلال مشخص (همانطور که در [WHERE](../../sql-reference/statements/select.md#select-where)). + +شرایط, به جز اولین, درخواست در جفت: نتیجه دوم درست خواهد بود اگر اول و دوم درست باشد, از سوم اگر اولین و فیرد درست باشد, و غیره. + +**نحو** + +``` sql +retention(cond1, cond2, ..., cond32); +``` + +**پارامترها** + +- `cond` — an expression that returns a `UInt8` نتیجه (1 یا 0). + +**مقدار بازگشتی** + +مجموعه ای از 1 یا 0. + +- 1 — condition was met for the event. +- 0 — condition wasn’t met for the event. + +نوع: `UInt8`. + +**مثال** + +بیایید یک نمونه از محاسبه را در نظر بگیریم `retention` تابع برای تعیین ترافیک سایت. + +**1.** Сreate a table to illustrate an example. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +جدول ورودی: + +پرسوجو: + +``` sql +SELECT * FROM retention_test +``` + +نتیجه: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** کاربران گروه با شناسه منحصر به فرد `uid` با استفاده از `retention` تابع. + +پرسوجو: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +نتیجه: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** محاسبه تعداد کل بازدیدکننده داشته است سایت در هر روز. + +پرسوجو: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +نتیجه: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +کجا: + +- `r1`- تعداد بازدید کنندگان منحصر به فرد که در طول 2020-01-01 (بازدید `cond1` شرط). +- `r2`- تعداد بازدید کنندگان منحصر به فرد که برای بازدید از سایت در طول یک دوره زمانی خاص بین 2020-01-01 و 2020-01-02 (`cond1` و `cond2` شرایط). +- `r3`- تعداد بازدید کنندگان منحصر به فرد که برای بازدید از سایت در طول یک دوره زمانی خاص بین 2020-01-01 و 2020-01-03 (`cond1` و `cond3` شرایط). + +## uniqUpTo(N)(x) {#uniquptonx} + +Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. + +توصیه می شود برای استفاده با شماره های کوچک, تا 10. حداکثر مقدار نفر است 100. + +برای دولت از یک تابع جمع, با استفاده از مقدار حافظه برابر با 1 + نفر \* اندازه یک مقدار بایت. +برای رشته, این فروشگاه یک هش غیر رمزنگاری 8 بایت. به این معنا که محاسبه برای رشته ها تقریبی است. + +این تابع همچنین برای چندین استدلال کار می کند. + +این کار به همان سرعتی که ممکن است, به جز برای موارد زمانی که یک مقدار نفر بزرگ استفاده می شود و تعدادی از ارزش های منحصر به فرد است کمی کمتر از ان. + +مثال طریقه استفاده: + +``` text +Problem: Generate a report that shows only keywords that produced at least 5 unique users. +Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) + +## sumMapFiltered(keys\_to\_keep)(کلید ارزش ها) {#summapfilteredkeys-to-keepkeys-values} + +رفتار مشابه [& سواپ](reference.md#agg_functions-summap) جز این که مجموعه ای از کلید به عنوان یک پارامتر منتقل می شود. این می تواند مفید باشد به خصوص در هنگام کار با یک کارت از کلید های بالا. diff --git a/docs/fa/sql-reference/aggregate-functions/reference.md b/docs/fa/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..64c67902214 --- /dev/null +++ b/docs/fa/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1837 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: "\u0645\u0631\u062C\u0639" +--- + +# مرجع عملکرد {#function-reference} + +## شمارش {#agg_function-count} + +شمارش تعداد ردیف یا نه تهی ارزش. + +ClickHouse زیر پشتیبانی می کند syntaxes برای `count`: +- `count(expr)` یا `COUNT(DISTINCT expr)`. +- `count()` یا `COUNT(*)`. این `count()` نحو ClickHouse خاص. + +**پارامترها** + +این تابع می تواند: + +- صفر پارامتر. +- یک [عبارت](../syntax.md#syntax-expressions). + +**مقدار بازگشتی** + +- اگر تابع بدون پارامتر نامیده می شود تعداد ردیف شمارش. +- اگر [عبارت](../syntax.md#syntax-expressions) به تصویب می رسد, سپس تابع شمارش چند بار این عبارت بازگشت تهی نیست. اگر بیان می گرداند [Nullable](../../sql-reference/data-types/nullable.md)- نوع ارزش و سپس نتیجه `count` باقی نمی ماند `Nullable`. تابع بازده 0 اگر بیان بازگشت `NULL` برای تمام ردیف. + +در هر دو مورد نوع مقدار بازگشتی است [UInt64](../../sql-reference/data-types/int-uint.md). + +**اطلاعات دقیق** + +تاتر از `COUNT(DISTINCT ...)` نحو. رفتار این ساخت و ساز بستگی به [ا\_فزونهها](../../operations/settings/settings.md#settings-count_distinct_implementation) تنظیمات. این تعریف می کند که کدام یک از [uniq\*](#agg_function-uniq) توابع برای انجام عملیات استفاده می شود. به طور پیش فرض است [قرارداد اتحادیه](#agg_function-uniqexact) تابع. + +این `SELECT count() FROM table` پرس و جو بهینه سازی شده نیست, چرا که تعداد ورودی در جدول به طور جداگانه ذخیره نمی. این ستون کوچک را از جدول انتخاب می کند و تعداد مقادیر موجود را شمارش می کند. + +**مثالها** + +مثال 1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +مثال 2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +این مثال نشان می دهد که `count(DISTINCT num)` توسط `uniqExact` عملکرد با توجه به `count_distinct_implementation` مقدار تنظیم. + +## هر) {#agg_function-any} + +انتخاب اولین مقدار مواجه می شوند. +پرس و جو را می توان در هر سفارش و حتی در جهت های مختلف در هر زمان اجرا, بنابراین نتیجه این تابع نامشخص است. +برای دریافت یک نتیجه معین, شما می توانید با استفاده از ‘min’ یا ‘max’ تابع به جای ‘any’. + +در بعضی موارد, شما می توانید در جهت اعدام تکیه. این امر در مورد مواردی که انتخاب می شود از یک زیرخاکی است که از سفارش استفاده می کند. + +هنگامی که یک `SELECT` پرسوجو دارد `GROUP BY` بند و یا حداقل یک مجموع عملکرد ClickHouse (در مقایسه با MySQL) مستلزم آن است که تمام عبارات در `SELECT`, `HAVING` و `ORDER BY` بند از کلید و یا از توابع کل محاسبه می شود. به عبارت دیگر, هر ستون انتخاب شده از جدول باید یا در کلید و یا در داخل توابع دانه استفاده می شود. برای دریافت رفتار مانند خروجی زیر, شما می توانید ستون های دیگر در قرار `any` تابع جمع. + +## هشدار داده می شود) {#anyheavyx} + +انتخاب یک مقدار اغلب اتفاق می افتد با استفاده از [بزرگان سنگین](http://www.cs.umd.edu/~samir/498/karp.pdf) الگوریتم. در صورتی که یک مقدار که بیش از در نیمی از موارد در هر یک از موضوعات اعدام پرس و جو رخ می دهد وجود دارد, این مقدار بازگشته است. به طور معمول نتیجه nondeterministic. + +``` sql +anyHeavy(column) +``` + +**نشانوندها** + +- `column` – The column name. + +**مثال** + +نگاهی به [به موقع](../../getting-started/example-datasets/ontime.md) مجموعه داده ها و انتخاب هر مقدار اغلب اتفاق می افتد در `AirlineID` ستون. + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## حداقل صفحه نمایش:) {#anylastx} + +ارزش گذشته مواجه می شوند را انتخاب می کند. +نتیجه این است که فقط به عنوان نامشخص به عنوان برای `any` تابع. + +## گروه بیتاند {#groupbitand} + +اعمال بیتی `AND` برای مجموعه ای از اعداد. + +``` sql +groupBitAnd(expr) +``` + +**پارامترها** + +`expr` – An expression that results in `UInt*` نوع. + +**مقدار بازگشتی** + +ارزش `UInt*` نوع. + +**مثال** + +داده های تست: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +پرسوجو: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +کجا `num` ستون با داده های تست است. + +نتیجه: + +``` text +binary decimal +00000100 = 4 +``` + +## ویرایشگر گروه {#groupbitor} + +اعمال بیتی `OR` برای مجموعه ای از اعداد. + +``` sql +groupBitOr(expr) +``` + +**پارامترها** + +`expr` – An expression that results in `UInt*` نوع. + +**مقدار بازگشتی** + +ارزش `UInt*` نوع. + +**مثال** + +داده های تست: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +پرسوجو: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +کجا `num` ستون با داده های تست است. + +نتیجه: + +``` text +binary decimal +01111101 = 125 +``` + +## گروهبیتکسور {#groupbitxor} + +شامل اعضای اتحادیه اروپا `XOR` برای مجموعه ای از اعداد. + +``` sql +groupBitXor(expr) +``` + +**پارامترها** + +`expr` – An expression that results in `UInt*` نوع. + +**مقدار بازگشتی** + +ارزش `UInt*` نوع. + +**مثال** + +داده های تست: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +پرسوجو: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +کجا `num` ستون با داده های تست است. + +نتیجه: + +``` text +binary decimal +01101000 = 104 +``` + +## نگاشت گروهی {#groupbitmap} + +بیت مپ و یا کل محاسبات از یک unsigned integer ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmap(expr) +``` + +**پارامترها** + +`expr` – An expression that results in `UInt*` نوع. + +**مقدار بازگشتی** + +ارزش `UInt64` نوع. + +**مثال** + +داده های تست: + +``` text +UserID +1 +1 +2 +3 +``` + +پرسوجو: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +نتیجه: + +``` text +num +3 +``` + +## کمینه) {#agg_function-min} + +محاسبه حداقل. + +## بیشینه) {#agg_function-max} + +محاسبه حداکثر. + +## هشدار داده می شود) {#agg-function-argmin} + +محاسبه ‘arg’ ارزش برای حداقل ‘val’ ارزش. اگر چندین مقدار مختلف وجود دارد ‘arg’ برای مقادیر حداقل ‘val’ اولین بار از این مقادیر مواجه خروجی است. + +**مثال:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## هشدار داده می شود) {#agg-function-argmax} + +محاسبه ‘arg’ مقدار برای حداکثر ‘val’ ارزش. اگر چندین مقدار مختلف وجود دارد ‘arg’ برای حداکثر مقادیر ‘val’ اولین بار از این مقادیر مواجه خروجی است. + +## جمع) {#agg_function-sum} + +محاسبه مجموع. +فقط برای اعداد کار می کند. + +## ورود به سیستم) {#sumwithoverflowx} + +محاسبه مجموع اعداد, با استفاده از همان نوع داده برای نتیجه به عنوان پارامترهای ورودی. اگر مجموع بیش از حداکثر مقدار برای این نوع داده, تابع یک خطا می گرداند. + +فقط برای اعداد کار می کند. + +## sumMap(key, value) {#agg_functions-summap} + +مجموع ‘value’ تنظیم با توجه به کلید های مشخص شده در ‘key’ صف کردن. +تعداد عناصر در ‘key’ و ‘value’ باید همین کار را برای هر سطر است که بالغ بر شود. +Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. + +مثال: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┘ +``` + +## سیخ کباب {#skewpop} + +محاسبه [skewness](https://en.wikipedia.org/wiki/Skewness) از یک توالی. + +``` sql +skewPop(expr) +``` + +**پارامترها** + +`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. + +**مقدار بازگشتی** + +The skewness of the given distribution. Type — [جسم شناور64](../../sql-reference/data-types/float.md) + +**مثال** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## سیخ {#skewsamp} + +محاسبه [نمونه skewness](https://en.wikipedia.org/wiki/Skewness) از یک توالی. + +این نشان دهنده یک تخمین بی طرفانه از اریب یک متغیر تصادفی اگر ارزش گذشت نمونه خود را تشکیل می دهند. + +``` sql +skewSamp(expr) +``` + +**پارامترها** + +`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. + +**مقدار بازگشتی** + +The skewness of the given distribution. Type — [جسم شناور64](../../sql-reference/data-types/float.md). اگر `n <= 1` (`n` اندازه نمونه است), سپس بازده تابع `nan`. + +**مثال** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## کورتپ {#kurtpop} + +محاسبه [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) از یک توالی. + +``` sql +kurtPop(expr) +``` + +**پارامترها** + +`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. + +**مقدار بازگشتی** + +The kurtosis of the given distribution. Type — [جسم شناور64](../../sql-reference/data-types/float.md) + +**مثال** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## کردها {#kurtsamp} + +محاسبه [نمونه kurtosis](https://en.wikipedia.org/wiki/Kurtosis) از یک توالی. + +این نشان دهنده یک تخمین بی طرفانه از کورتوز یک متغیر تصادفی اگر ارزش گذشت نمونه خود را تشکیل می دهند. + +``` sql +kurtSamp(expr) +``` + +**پارامترها** + +`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. + +**مقدار بازگشتی** + +The kurtosis of the given distribution. Type — [جسم شناور64](../../sql-reference/data-types/float.md). اگر `n <= 1` (`n` اندازه نمونه است) و سپس تابع بازده `nan`. + +**مثال** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## هشدار داده می شود) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` می توانید سری های زمانی مختلف که برچسب زمان نمونه هم ترازی جمع نمی. +این برون یابی خطی بین دو برچسب زمان نمونه و سپس مجموع زمان سری با هم استفاده کنید. + +- `uid` سری زمان شناسه منحصر به فرد است, `UInt64`. +- `timestamp` است نوع درون64 به منظور حمایت میلی ثانیه یا میکروثانیه. +- `value` متریک است. + +تابع گرداند مجموعه ای از تاپل با `(timestamp, aggregated_value)` جفت + +قبل از استفاده از این تابع اطمینان حاصل کنید `timestamp` به ترتیب صعودی است. + +مثال: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +و نتیجه خواهد بود: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## هشدار داده می شود) {#agg-function-timeseriesgroupratesum} + +به طور مشابه timeseriesgroupratesum, timeseriesgroupratesum را محاسبه نرخ سری زمانی و سپس مجموع نرخ با هم. +همچنین, برچسب زمان باید در جهت صعود قبل از استفاده از این تابع باشد. + +با استفاده از این تابع نتیجه مورد بالا خواهد بود: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## میانگین) {#agg_function-avg} + +محاسبه متوسط. +فقط برای اعداد کار می کند. +نتیجه این است که همیشه شناور64. + +## uniq {#agg_function-uniq} + +محاسبه تعداد تقریبی مقادیر مختلف استدلال. + +``` sql +uniq(x[, ...]) +``` + +**پارامترها** + +تابع طول می کشد تعداد متغیر از پارامترهای. پارامترها می توانند باشند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. + +**مقدار بازگشتی** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-نوع شماره. + +**پیاده سازی اطلاعات** + +تابع: + +- هش را برای تمام پارامترها در مجموع محاسبه می کند و سپس در محاسبات استفاده می شود. + +- با استفاده از یک تطبیقی نمونه الگوریتم. برای محاسبه دولت تابع با استفاده از یک نمونه از عنصر هش ارزش تا 65536. + + This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. + +- نتیجه را تعیین می کند (به سفارش پردازش پرس و جو بستگی ندارد). + +ما توصیه می کنیم با استفاده از این تابع تقریبا در تمام حالات. + +**همچنین نگاه کنید** + +- [مخلوط نشده](#agg_function-uniqcombined) +- [نیم قرن 64](#agg_function-uniqcombined64) +- [یونقلل12](#agg_function-uniqhll12) +- [قرارداد اتحادیه](#agg_function-uniqexact) + +## uniqCombined {#agg_function-uniqcombined} + +محاسبه تعداد تقریبی مقادیر استدلال های مختلف. + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +این `uniqCombined` تابع یک انتخاب خوب برای محاسبه تعداد مقادیر مختلف است. + +**پارامترها** + +تابع طول می کشد تعداد متغیر از پارامترهای. پارامترها می توانند باشند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. + +`HLL_precision` پایه-2 لگاریتم تعداد سلول ها در [جمع شدن](https://en.wikipedia.org/wiki/HyperLogLog). اختیاری, شما می توانید تابع به عنوان استفاده `uniqCombined(x[, ...])`. مقدار پیش فرض برای `HLL_precision` است 17, که به طور موثر 96 کیلوبایت فضا (2^17 سلول ها, 6 بیت در هر). + +**مقدار بازگشتی** + +- یک عدد [UInt64](../../sql-reference/data-types/int-uint.md)- نوع شماره . + +**پیاده سازی اطلاعات** + +تابع: + +- محاسبه هش (هش 64 بیتی برای `String` و در غیر این صورت 32 بیتی) برای تمام پارامترها در مجموع و سپس در محاسبات استفاده می شود. + +- با استفاده از ترکیبی از سه الگوریتم: مجموعه, جدول هش, و جمع شدن با جدول تصحیح خطا. + + For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. + +- نتیجه را تعیین می کند (به سفارش پردازش پرس و جو بستگی ندارد). + +!!! note "یادداشت" + از هش 32 بیتی برای غیر استفاده می کند-`String` نوع, نتیجه خطا بسیار بالا برای کاریت به طور قابل توجهی بزرگتر از اند `UINT_MAX` (خطا به سرعت پس از چند ده میلیارد ارزش متمایز افزایش خواهد یافت), از این رو در این مورد شما باید استفاده کنید [نیم قرن 64](#agg_function-uniqcombined64) + +در مقایسه با [uniq](#agg_function-uniq) عملکرد `uniqCombined`: + +- مصرف چندین بار حافظه کمتر. +- محاسبه با دقت چند بار بالاتر است. +- معمولا عملکرد کمی پایین تر است. در برخی از حالات, `uniqCombined` می توانید بهتر از انجام `uniq` برای مثال با توزیع نمایش داده شد که انتقال تعداد زیادی از جمع متحده بر روی شبکه. + +**همچنین نگاه کنید** + +- [دانشگاه](#agg_function-uniq) +- [نیم قرن 64](#agg_function-uniqcombined64) +- [یونقلل12](#agg_function-uniqhll12) +- [قرارداد اتحادیه](#agg_function-uniqexact) + +## نیم قرن 64 {#agg_function-uniqcombined64} + +مثل [مخلوط نشده](#agg_function-uniqcombined), اما با استفاده از هش 64 بیتی برای تمام انواع داده ها. + +## یونقلل12 {#agg_function-uniqhll12} + +محاسبه تعداد تقریبی مقادیر استدلال های مختلف, با استفاده از [جمع شدن](https://en.wikipedia.org/wiki/HyperLogLog) الگوریتم. + +``` sql +uniqHLL12(x[, ...]) +``` + +**پارامترها** + +این تابع یک متغیر تعدادی از پارامترهای. پارامترهای می تواند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. + +**مقدار بازگشتی** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-نوع شماره. + +**پیاده سازی اطلاعات** + +تابع: + +- هش را برای تمام پارامترها در مجموع محاسبه می کند و سپس در محاسبات استفاده می شود. + +- با استفاده از الگوریتم جمع شدن تقریبی تعداد مقادیر استدلال های مختلف. + + 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). + +- نتیجه تعیین شده را فراهم می کند (به سفارش پردازش پرس و جو بستگی ندارد). + +ما توصیه نمی کنیم با استفاده از این تابع. در اغلب موارد از [دانشگاه](#agg_function-uniq) یا [مخلوط نشده](#agg_function-uniqcombined) تابع. + +**همچنین نگاه کنید** + +- [دانشگاه](#agg_function-uniq) +- [مخلوط نشده](#agg_function-uniqcombined) +- [قرارداد اتحادیه](#agg_function-uniqexact) + +## قرارداد اتحادیه {#agg_function-uniqexact} + +محاسبه تعداد دقیق ارزش استدلال های مختلف. + +``` sql +uniqExact(x[, ...]) +``` + +استفاده از `uniqExact` تابع اگر شما کاملا نیاز به یک نتیجه دقیق. در غیر این صورت استفاده از [uniq](#agg_function-uniq) تابع. + +این `uniqExact` تابع با استفاده از حافظه بیش از `uniq`, چرا که اندازه دولت رشد گشوده است به عنوان تعدادی از ارزش های مختلف را افزایش می دهد. + +**پارامترها** + +تابع طول می کشد تعداد متغیر از پارامترهای. پارامترها می توانند باشند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. + +**همچنین نگاه کنید به** + +- [uniq](#agg_function-uniq) +- [مخلوط نشده](#agg_function-uniqcombined) +- [یونقلل12](#agg_function-uniqhll12) + +## groupArray(x) groupArray(max\_size)(x) {#agg_function-grouparray} + +مجموعه ای از مقادیر استدلال را ایجاد می کند. +مقادیر را می توان به ترتیب در هر (نامعین) اضافه کرد. + +نسخه دوم (با `max_size` پارامتر) اندازه مجموعه حاصل را محدود می کند `max_size` عناصر. +به عنوان مثال, `groupArray (1) (x)` معادل است `[any (x)]`. + +در بعضی موارد, شما هنوز هم می توانید در جهت اعدام تکیه. این امر در مورد مواردی که `SELECT` همراه از یک خرده فروشی که با استفاده از `ORDER BY`. + +## ارزش موقعیت) {#grouparrayinsertatvalue-position} + +مقدار را به مجموعه ای در موقعیت مشخص شده وارد می کند. + +!!! note "یادداشت" + این تابع با استفاده از موقعیت های مبتنی بر صفر, بر خلاف موقعیت های معمولی مبتنی بر یک برای فرود میدان. + +Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. + +پارامترهای اختیاری: + +- مقدار پیش فرض برای جایگزینی در موقعیت های خالی. +- طول مجموعه حاصل. این اجازه می دهد تا شما را به دریافت مجموعه ای از همان اندازه برای تمام کلید های کل. هنگام استفاده از این پارامتر, مقدار پیش فرض باید مشخص شود. + +## هشدار داده می شود {#agg_function-grouparraymovingsum} + +محاسبه مجموع در حال حرکت از ارزش های ورودی. + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +این تابع می تواند اندازه پنجره به عنوان یک پارامتر را. اگر سمت چپ نامشخص, تابع طول می کشد اندازه پنجره به تعداد ردیف در ستون برابر. + +**پارامترها** + +- `numbers_for_summing` — [عبارت](../syntax.md#syntax-expressions) در نتیجه یک مقدار نوع داده عددی. +- `window_size` — Size of the calculation window. + +**مقادیر بازگشتی** + +- مجموعه ای از همان اندازه و نوع به عنوان داده های ورودی. + +**مثال** + +جدول نمونه: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +نمایش داده شد: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## گروهاریموینگاوگ {#agg_function-grouparraymovingavg} + +محاسبه میانگین متحرک از ارزش های ورودی. + +``` sql +groupArrayMovingAvg(numbers_for_summing) +groupArrayMovingAvg(window_size)(numbers_for_summing) +``` + +این تابع می تواند اندازه پنجره به عنوان یک پارامتر را. اگر سمت چپ نامشخص, تابع طول می کشد اندازه پنجره به تعداد ردیف در ستون برابر. + +**پارامترها** + +- `numbers_for_summing` — [عبارت](../syntax.md#syntax-expressions) در نتیجه یک مقدار نوع داده عددی. +- `window_size` — Size of the calculation window. + +**مقادیر بازگشتی** + +- مجموعه ای از همان اندازه و نوع به عنوان داده های ورودی. + +تابع استفاده می کند [گرد کردن به سمت صفر](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). این کوتاه رقم اعشار ناچیز برای نوع داده و در نتیجه. + +**مثال** + +جدول نمونه `b`: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +نمایش داده شد: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## groupUniqArray(x) groupUniqArray(max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} + +مجموعه ای از مقادیر مختلف استدلال ایجاد می کند. مصرف حافظه همان است که برای `uniqExact` تابع. + +نسخه دوم (با `max_size` پارامتر) اندازه مجموعه حاصل را محدود می کند `max_size` عناصر. +به عنوان مثال, `groupUniqArray(1)(x)` معادل است `[any(x)]`. + +## quantile {#quantile} + +محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. + +این تابع اعمال می شود [نمونه برداری مخزن](https://en.wikipedia.org/wiki/Reservoir_sampling) با اندازه مخزن تا 8192 و یک مولد عدد تصادفی برای نمونه برداری. نتیجه غیر قطعی است. برای دریافت یک کمی دقیق, استفاده از [کوانتوم](#quantileexact) تابع. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantile(level)(expr) +``` + +نام مستعار: `median`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql-reference/data-types/index.md#data_types), [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). + +**مقدار بازگشتی** + +- کمی تقریبی از سطح مشخص شده است. + +نوع: + +- [جسم شناور64](../../sql-reference/data-types/float.md) برای ورودی نوع داده عددی. +- [تاریخ](../../sql-reference/data-types/date.md) اگر مقادیر ورودی `Date` نوع. +- [DateTime](../../sql-reference/data-types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. + +**مثال** + +جدول ورودی: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +پرسوجو: + +``` sql +SELECT quantile(val) FROM t +``` + +نتیجه: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**همچنین نگاه کنید به** + +- [میانه](#median) +- [quantiles](#quantiles) + +## نامعینیهای کوانتی {#quantiledeterministic} + +محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. + +این تابع اعمال می شود [نمونه برداری مخزن](https://en.wikipedia.org/wiki/Reservoir_sampling) با اندازه مخزن تا 8192 و الگوریتم قطعی نمونه گیری. نتیجه قطعی است. برای دریافت یک کمی دقیق, استفاده از [کوانتوم](#quantileexact) تابع. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +نام مستعار: `medianDeterministic`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql-reference/data-types/index.md#data_types), [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). +- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. + +**مقدار بازگشتی** + +- کمی تقریبی از سطح مشخص شده است. + +نوع: + +- [جسم شناور64](../../sql-reference/data-types/float.md) برای ورودی نوع داده عددی. +- [تاریخ](../../sql-reference/data-types/date.md) اگر مقادیر ورودی `Date` نوع. +- [DateTime](../../sql-reference/data-types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. + +**مثال** + +جدول ورودی: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +پرسوجو: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +نتیجه: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**همچنین نگاه کنید** + +- [میانه](#median) +- [quantiles](#quantiles) + +## کوانتوم {#quantileexact} + +دقیقا محاسبه می کند [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` حافظه, جایی که `n` تعدادی از ارزش هایی که تصویب شد. اما, برای تعداد کمی از ارزش, تابع بسیار موثر است. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantileExact(level)(expr) +``` + +نام مستعار: `medianExact`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql-reference/data-types/index.md#data_types), [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). + +**مقدار بازگشتی** + +- Quantile از سطح مشخص شده. + +نوع: + +- [جسم شناور64](../../sql-reference/data-types/float.md) برای ورودی نوع داده عددی. +- [تاریخ](../../sql-reference/data-types/date.md) اگر مقادیر ورودی `Date` نوع. +- [DateTime](../../sql-reference/data-types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. + +**مثال** + +پرسوجو: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +نتیجه: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**همچنین نگاه کنید** + +- [میانه](#median) +- [quantiles](#quantiles) + +## نمایش سایت {#quantileexactweighted} + +دقیقا محاسبه می کند [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی, با در نظر گرفتن وزن هر عنصر. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [کوانتوم](#quantileexact). شما می توانید این تابع به جای استفاده از `quantileExact` و وزن 1 را مشخص کنید. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +نام مستعار: `medianExactWeighted`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql-reference/data-types/index.md#data_types), [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. + +**مقدار بازگشتی** + +- Quantile از سطح مشخص شده. + +نوع: + +- [جسم شناور64](../../sql-reference/data-types/float.md) برای ورودی نوع داده عددی. +- [تاریخ](../../sql-reference/data-types/date.md) اگر مقادیر ورودی `Date` نوع. +- [DateTime](../../sql-reference/data-types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. + +**مثال** + +جدول ورودی: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +پرسوجو: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +نتیجه: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [میانه](#median) +- [quantiles](#quantiles) + +## زمان کمی {#quantiletiming} + +با دقت تعیین شده محاسبه می شود [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. + +نتیجه قطعی است(به سفارش پردازش پرس و جو بستگی ندارد). این تابع برای کار با توالی هایی که توزیع هایی مانند بارگذاری صفحات وب بار یا زمان پاسخ باطن را توصیف می کنند بهینه شده است. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantileTiming(level)(expr) +``` + +نام مستعار: `medianTiming`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). + +- `expr` — [عبارت](../syntax.md#syntax-expressions) بیش از یک مقادیر ستون بازگشت [شناور\*](../../sql-reference/data-types/float.md)-نوع شماره. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +**دقت** + +محاسبه دقیق است اگر: + +- تعداد کل مقادیر 5670 تجاوز نمی کند. +- تعداد کل مقادیر بیش از 5670, اما زمان بارگذاری صفحه کمتر از است 1024خانم. + +در غیر این صورت, نتیجه محاسبه به نزدیکترین چند از گرد 16 خانم. + +!!! note "یادداشت" + برای محاسبه زمان بارگذاری صفحه quantiles این تابع این است که موثر تر و دقیق تر از [quantile](#quantile). + +**مقدار بازگشتی** + +- Quantile از سطح مشخص شده. + +نوع: `Float32`. + +!!! note "یادداشت" + اگر هیچ ارزش به تابع منتقل می شود (هنگام استفاده از `quantileTimingIf`), [نان](../../sql-reference/data-types/float.md#data_type-float-nan-inf) بازگشته است. هدف از این است که افتراق این موارد از مواردی که منجر به صفر. ببینید [ORDER BY](../statements/select.md#select-order-by) برای یادداشت ها در مرتب سازی `NaN` ارزشهای خبری عبارتند از: + +**مثال** + +جدول ورودی: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +پرسوجو: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +نتیجه: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [میانه](#median) +- [quantiles](#quantiles) + +## زمان کمی {#quantiletimingweighted} + +با دقت تعیین شده محاسبه می شود [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی با توجه به وزن هر یک از اعضای دنباله. + +نتیجه قطعی است(به سفارش پردازش پرس و جو بستگی ندارد). این تابع برای کار با توالی هایی که توزیع هایی مانند بارگذاری صفحات وب بار یا زمان پاسخ باطن را توصیف می کنند بهینه شده است. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +نام مستعار: `medianTimingWeighted`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). + +- `expr` — [عبارت](../syntax.md#syntax-expressions) بیش از یک مقادیر ستون بازگشت [شناور\*](../../sql-reference/data-types/float.md)- نوع شماره . + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**دقت** + +محاسبه دقیق است اگر: + +- تعداد کل مقادیر 5670 تجاوز نمی کند. +- تعداد کل مقادیر بیش از 5670, اما زمان بارگذاری صفحه کمتر از است 1024خانم. + +در غیر این صورت, نتیجه محاسبه به نزدیکترین چند از گرد 16 خانم. + +!!! note "یادداشت" + برای محاسبه زمان بارگذاری صفحه quantiles این تابع این است که موثر تر و دقیق تر از [quantile](#quantile). + +**مقدار بازگشتی** + +- Quantile از سطح مشخص شده. + +نوع: `Float32`. + +!!! note "یادداشت" + اگر هیچ ارزش به تابع منتقل می شود (هنگام استفاده از `quantileTimingIf`), [نان](../../sql-reference/data-types/float.md#data_type-float-nan-inf) بازگشته است. هدف از این است که افتراق این موارد از مواردی که منجر به صفر. ببینید [ORDER BY](../statements/select.md#select-order-by) برای یادداشت ها در مرتب سازی `NaN` ارزشهای خبری عبارتند از: + +**مثال** + +جدول ورودی: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +پرسوجو: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +نتیجه: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**همچنین نگاه کنید** + +- [میانه](#median) +- [quantiles](#quantiles) + +## مقدار کمی {#quantiletdigest} + +محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی با استفاده از [خلاصه](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) الگوریتم. + +حداکثر خطا است 1%. مصرف حافظه است `log(n)` کجا `n` تعدادی از ارزش است. نتیجه بستگی دارد منظور از در حال اجرا پرس و جو و nondeterministic. + +عملکرد تابع کمتر از عملکرد است [quantile](#quantile) یا [زمان کمی](#quantiletiming). از لحاظ نسبت اندازه دولت به دقت, این تابع بسیار بهتر از `quantile`. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantileTDigest(level)(expr) +``` + +نام مستعار: `medianTDigest`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql-reference/data-types/index.md#data_types), [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). + +**مقدار بازگشتی** + +- کمی تقریبی از سطح مشخص شده است. + +نوع: + +- [جسم شناور64](../../sql-reference/data-types/float.md) برای ورودی نوع داده عددی. +- [تاریخ](../../sql-reference/data-types/date.md) اگر مقادیر ورودی `Date` نوع. +- [DateTime](../../sql-reference/data-types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. + +**مثال** + +پرسوجو: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +نتیجه: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [میانه](#median) +- [quantiles](#quantiles) + +## نمایش سایت {#quantiletdigestweighted} + +محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی با استفاده از [خلاصه](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) الگوریتم. تابع طول می کشد را به حساب وزن هر یک از اعضای دنباله. حداکثر خطا است 1%. مصرف حافظه است `log(n)` کجا `n` تعدادی از ارزش است. + +عملکرد تابع کمتر از عملکرد است [quantile](#quantile) یا [زمان کمی](#quantiletiming). از لحاظ نسبت اندازه دولت به دقت, این تابع بسیار بهتر از `quantile`. + +نتیجه بستگی دارد منظور از در حال اجرا پرس و جو و nondeterministic. + +هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. + +**نحو** + +``` sql +quantileTDigest(level)(expr) +``` + +نام مستعار: `medianTDigest`. + +**پارامترها** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql-reference/data-types/index.md#data_types), [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**مقدار بازگشتی** + +- کمی تقریبی از سطح مشخص شده است. + +نوع: + +- [جسم شناور64](../../sql-reference/data-types/float.md) برای ورودی نوع داده عددی. +- [تاریخ](../../sql-reference/data-types/date.md) اگر مقادیر ورودی `Date` نوع. +- [DateTime](../../sql-reference/data-types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. + +**مثال** + +پرسوجو: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +نتیجه: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [میانه](#median) +- [quantiles](#quantiles) + +## میانه {#median} + +این `median*` توابع نام مستعار برای مربوطه `quantile*` توابع. متوسط یک نمونه داده عددی را محاسبه می کنند. + +توابع: + +- `median` — Alias for [quantile](#quantile). +- `medianDeterministic` — Alias for [نامعینیهای کوانتی](#quantiledeterministic). +- `medianExact` — Alias for [کوانتوم](#quantileexact). +- `medianExactWeighted` — Alias for [نمایش سایت](#quantileexactweighted). +- `medianTiming` — Alias for [زمان کمی](#quantiletiming). +- `medianTimingWeighted` — Alias for [زمان کمی](#quantiletimingweighted). +- `medianTDigest` — Alias for [مقدار کمی](#quantiletdigest). +- `medianTDigestWeighted` — Alias for [نمایش سایت](#quantiletdigestweighted). + +**مثال** + +جدول ورودی: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +پرسوجو: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +نتیجه: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +تمام quantile توابع نیز مربوط quantiles توابع: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. این توابع محاسبه تمام کوانتوم از سطوح ذکر شده در یک پاس, و بازگشت مجموعه ای از مقادیر حاصل. + +## اطلاعات دقیق) {#varsampx} + +محاسبه مقدار `Σ((x - x̅)^2) / (n - 1)` کجا `n` اندازه نمونه است و `x̅`مقدار متوسط است `x`. + +این نشان دهنده یک تخمین بی طرفانه از واریانس یک متغیر تصادفی اگر ارزش گذشت نمونه خود را تشکیل می دهند. + +بازگشت `Float64`. چه زمانی `n <= 1`, بازگشت `+∞`. + +## هشدار داده می شود) {#varpopx} + +محاسبه مقدار `Σ((x - x̅)^2) / n` کجا `n` اندازه نمونه است و `x̅`مقدار متوسط است `x`. + +به عبارت دیگر, پراکندگی برای مجموعه ای از ارزش. بازگشت `Float64`. + +## اطلاعات دقیق) {#stddevsampx} + +نتیجه برابر با ریشه مربع است `varSamp(x)`. + +## اطلاعات دقیق) {#stddevpopx} + +نتیجه برابر با ریشه مربع است `varPop(x)`. + +## topK(N)(x) {#topknx} + +بازگرداندن مجموعه ای از مقادیر تقریبا شایع ترین در ستون مشخص. مجموعه حاصل به ترتیب نزولی فرکانس تقریبی ارزش ها (نه با ارزش های خود) طبقه بندی شده اند. + +پیاده سازی [فیلتر صرفه جویی در فضا](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) الگوریتم برای تجزیه و تحلیل توپک, بر اساس الگوریتم کاهش و ترکیب از [صرفه جویی در فضای موازی](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +این تابع یک نتیجه تضمین شده را فراهم نمی کند. در شرایط خاص, اشتباهات ممکن است رخ دهد و ممکن است مقادیر مکرر که مقادیر شایع ترین نیست بازگشت. + +ما توصیه می کنیم با استفاده از `N < 10` عملکرد با بزرگ کاهش می یابد `N` ارزشهای خبری عبارتند از: حداکثر مقدار `N = 65536`. + +**پارامترها** + +- ‘N’ است تعدادی از عناصر به بازگشت. + +اگر پارامتر حذف شده است, مقدار پیش فرض 10 استفاده شده است. + +**نشانوندها** + +- ’ x ’ – The value to calculate frequency. + +**مثال** + +نگاهی به [به موقع](../../getting-started/example-datasets/ontime.md) مجموعه داده ها و انتخاب سه ارزش اغلب اتفاق می افتد در `AirlineID` ستون. + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## کشتی کج {#topkweighted} + +مشابه به `topK` اما طول می کشد یک استدلال اضافی از نوع صحیح - `weight`. هر مقدار به حساب `weight` بار برای محاسبه فرکانس. + +**نحو** + +``` sql +topKWeighted(N)(x, weight) +``` + +**پارامترها** + +- `N` — The number of elements to return. + +**نشانوندها** + +- `x` – The value. +- `weight` — The weight. [UInt8](../../sql-reference/data-types/int-uint.md). + +**مقدار بازگشتی** + +بازگرداندن مجموعه ای از مقادیر با حداکثر مجموع تقریبی وزن. + +**مثال** + +پرسوجو: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +نتیجه: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## هشدار داده می شود) {#covarsampx-y} + +محاسبه ارزش `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +را برمی گرداند شناور64. زمانی که `n <= 1`, returns +∞. + +## نمایش سایت) {#covarpopx-y} + +محاسبه ارزش `Σ((x - x̅)(y - y̅)) / n`. + +## هشدار داده می شود) {#corrx-y} + +محاسبه ضریب همبستگی پیرسون: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## طبقه بندی فرمول بندی {#categoricalinformationvalue} + +محاسبه ارزش `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` برای هر دسته. + +``` sql +categoricalInformationValue(category1, category2, ..., tag) +``` + +نتیجه نشان می دهد که چگونه یک ویژگی گسسته (قطعی) `[category1, category2, ...]` کمک به یک مدل یادگیری که پیش بینی ارزش `tag`. + +## ساده سازی مقررات {#simplelinearregression} + +انجام ساده (unidimensional) رگرسیون خطی. + +``` sql +simpleLinearRegression(x, y) +``` + +پارامترها: + +- `x` — Column with dependent variable values. +- `y` — Column with explanatory variable values. + +مقادیر بازگشتی: + +ثابتها `(a, b)` از خط نتیجه `y = a*x + b`. + +**مثالها** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## تنظیم مقررات {#agg_functions-stochasticlinearregression} + +این تابع پیاده سازی رگرسیون خطی تصادفی. این پشتیبانی از پارامترهای سفارشی برای نرخ یادگیری, ل2 ضریب منظم, اندازه مینی دسته ای و دارای چند روش برای به روز رسانی وزن ([ادام](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (به طور پیش فرض استفاده می شود), [اطلاعات دقیق](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [شتاب](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [نستروف](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### پارامترها {#agg_functions-stochasticlinearregression-parameters} + +4 پارامتر قابل تنظیم وجود دارد. به ترتیب تابع منتقل می شود اما بدون نیاز به تصویب تمام مقادیر چهار پیش فرض استفاده می شود با این حال مدل خوب مورد نیاز برخی از تنظیم پارامتر وجود دارد. + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. `learning rate` ضریب در طول گام است, زمانی که گام گرادیان تبار انجام شده است. نرخ یادگیری بیش از حد بزرگ ممکن است وزن بی نهایت از مدل شود. پیشفرض `0.00001`. +2. `l2 regularization coefficient` که ممکن است کمک به جلوگیری از سوراخ سوراخ شدن بیش از حد. پیشفرض `0.1`. +3. `mini-batch size` مجموعه تعدادی از عناصر که شیب محاسبه خواهد شد و خلاصه به انجام یک مرحله از گرادیان تبار. تبار تصادفی خالص با استفاده از یک عنصر, با این حال داشتن دسته های کوچک(در باره 10 عناصر) را گام شیب پایدار تر. پیشفرض `15`. +4. `method for updating weights` اونا: `Adam` (به طور پیش فرض), `SGD`, `Momentum`, `Nesterov`. `Momentum` و `Nesterov` نیاز به کمی بیشتر محاسبات و حافظه, اما آنها به اتفاق مفید از نظر سرعت convergance و ثبات stochastic gradient روش. + +### استفاده {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` در دو مرحله استفاده می شود: اتصالات مدل و پیش بینی بر روی داده های جدید. به منظور متناسب با مدل و صرفه جویی در دولت خود را برای استفاده های بعدی استفاده می کنیم `-State` ترکیب کننده, که اساسا موجب صرفه جویی در دولت (وزن مدل, و غیره). +برای پیش بینی ما با استفاده از تابع [ارزیابی](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod), که طول می کشد یک دولت به عنوان یک استدلال و همچنین ویژگی های به پیش بینی در. + + + +**1.** اتصالات + +چنین پرس و جو ممکن است مورد استفاده قرار گیرد. + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +در اینجا ما همچنین نیاز به وارد کردن داده ها به `train_data` جدول تعداد پارامترهای ثابت نیست, این تنها در تعدادی از استدلال بستگی دارد, گذشت به `linearRegressionState`. همه باید مقادیر عددی باشد. +توجه داشته باشید که ستون با ارزش هدف(که ما می خواهم برای یادگیری به پیش بینی) به عنوان اولین استدلال قرار داده شده است. + +**2.** پیش بینی + +پس از ذخیره یک دولت به جدول, ما ممکن است چندین بار برای پیش بینی استفاده, و یا حتی با کشورهای دیگر ادغام و ایجاد مدل های جدید و حتی بهتر. + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +پرس و جو یک ستون از مقادیر پیش بینی شده بازگشت. توجه داشته باشید که استدلال اول `evalMLMethod` هست `AggregateFunctionState` هدف, بعدی ستون از ویژگی های هستند. + +`test_data` یک جدول مانند `train_data` اما ممکن است حاوی ارزش هدف نیست. + +### یادداشتها {#agg_functions-stochasticlinearregression-notes} + +1. برای ادغام دو مدل کاربر ممکن است چنین پرس و جو ایجاد کنید: + `sql SELECT state1 + state2 FROM your_models` + کجا `your_models` جدول شامل هر دو مدل. این پرس و جو جدید باز خواهد گشت `AggregateFunctionState` اعتراض. + +2. کاربر ممکن است وزن مدل ایجاد شده برای اهداف خود را بدون صرفه جویی در مدل اگر هیچ واکشی `-State` ترکیب استفاده شده است. + `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` + چنین پرس و جو خواهد مدل مناسب و بازگشت وزن خود را - برای اولین بار وزن هستند, که به پارامترهای مدل مطابقت, یکی از گذشته تعصب است. بنابراین در مثال بالا پرس و جو یک ستون با 3 مقدار بازگشت. + +**همچنین نگاه کنید** + +- [سرکوب مقررات عمومی](#agg_functions-stochasticlogisticregression) +- [تفاوت رگرسیون خطی و لجستیک](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## سرکوب مقررات عمومی {#agg_functions-stochasticlogisticregression} + +این تابع پیاده سازی رگرسیون لجستیک تصادفی. این را می توان برای مشکل طبقه بندی دودویی استفاده, پشتیبانی از پارامترهای سفارشی به عنوان مقررات زدایی و کار به همان شیوه. + +### پارامترها {#agg_functions-stochasticlogisticregression-parameters} + +پارامترها دقیقا مشابه در تنظیم مقررات است: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +برای اطلاعات بیشتر نگاه کنید به [پارامترها](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. اتصالات + + + + See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. + + Predicted labels have to be in \[-1, 1\]. + +1. پیش بینی + + + + Using saved state we can predict probability of object having label `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + + The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + + We can also set a bound of probability, which assigns elements to different labels. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + + Then the result will be labels. + + `test_data` is a table like `train_data` but may not contain target value. + +**همچنین نگاه کنید** + +- [تنظیم مقررات](#agg_functions-stochasticlinearregression) +- [تفاوت بین رگرسیون خطی و لجستیک.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## گروهبیتمافند {#groupbitmapand} + +محاسبات و یک بیت مپ ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapAnd(expr) +``` + +**پارامترها** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` نوع. + +**مقدار بازگشتی** + +ارزش `UInt64` نوع. + +**مثال** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapAnd(z)─┐ +│ 3 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ +│ [6,8,10] │ +└──────────────────────────────────────────────────┘ +``` + +## گروهبیتمافور {#groupbitmapor} + +محاسبات و یا یک بیت مپ ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql-reference/functions/bitmap-functions.md). این معادل است `groupBitmapMerge`. + +``` sql +groupBitmapOr(expr) +``` + +**پارامترها** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` نوع. + +**مقدار بازگشتی** + +ارزش `UInt64` نوع. + +**مثال** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapOr(z)─┐ +│ 15 │ +└──────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ +│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ +└─────────────────────────────────────────────────┘ +``` + +## گروهبیتمافکر {#groupbitmapxor} + +محاسبات xor یک بیت مپ ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapOr(expr) +``` + +**پارامترها** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` نوع. + +**مقدار بازگشتی** + +ارزش `UInt64` نوع. + +**مثال** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapXor(z)─┐ +│ 10 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ +│ [1,3,5,6,8,10,11,13,14,15] │ +└──────────────────────────────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/fa/sql-reference/ansi.md b/docs/fa/sql-reference/ansi.md new file mode 120000 index 00000000000..3cf6bffed67 --- /dev/null +++ b/docs/fa/sql-reference/ansi.md @@ -0,0 +1 @@ +../../en/sql-reference/ansi.md \ No newline at end of file diff --git a/docs/fa/sql-reference/data-types/aggregatefunction.md b/docs/fa/sql-reference/data-types/aggregatefunction.md new file mode 100644 index 00000000000..dd36147b8b7 --- /dev/null +++ b/docs/fa/sql-reference/data-types/aggregatefunction.md @@ -0,0 +1,71 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 52 +toc_title: "\u06A9\u0627\u0631\u06A9\u0631\u062F(\u0646\u0627\u0645 \u0648 \u0646\u0627\ + \u0645 \u062E\u0627\u0646\u0648\u0627\u062F\u06AF\u06CC..)" +--- + +# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [مشاهده محقق](../../sql-reference/statements/select.md#create-view). راه معمول برای تولید یک دولت تابع جمع است با فراخوانی تابع جمع با `-State` پسوند. برای دریافت نتیجه نهایی از تجمع در اینده, شما باید همان تابع کل با استفاده از `-Merge`پسوند. + +`AggregateFunction` — parametric data type. + +**پارامترها** + +- نام تابع جمع. + + If the function is parametric, specify its parameters too. + +- انواع استدلال تابع جمع. + +**مثال** + +``` sql +CREATE TABLE t +( + column1 AggregateFunction(uniq, UInt64), + column2 AggregateFunction(anyIf, String, UInt8), + column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) +) ENGINE = ... +``` + +[دانشگاه](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq). ([هر](../../sql-reference/aggregate-functions/reference.md#agg_function-any)+[اگر](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-if)) و [quantiles](../../sql-reference/aggregate-functions/reference.md) توابع مجموع پشتیبانی در خانه کلیک می باشد. + +## استفاده {#usage} + +### درج داده {#data-insertion} + +برای وارد کردن داده ها استفاده کنید `INSERT SELECT` با مجموع `-State`- توابع . + +**نمونه تابع** + +``` sql +uniqState(UserID) +quantilesState(0.5, 0.9)(SendTiming) +``` + +در مقایسه با توابع مربوطه `uniq` و `quantiles`, `-State`- توابع بازگشت به دولت, به جای ارزش نهایی. به عبارت دیگر ارزش بازگشت `AggregateFunction` نوع. + +در نتایج `SELECT` پرس و جو, ارزش `AggregateFunction` نوع اجرای خاص نمایندگی دودویی برای همه فرمت های خروجی کلیک کنید. اگر کمپرسی داده ها به, مثلا, `TabSeparated` قالب با `SELECT` پرس و جو, سپس این روگرفت را می توان با استفاده از لود `INSERT` پرس و جو. + +### گزینش داده {#data-selection} + +هنگام انتخاب داده ها از `AggregatingMergeTree` جدول استفاده کنید `GROUP BY` بند و همان مجموع توابع به عنوان زمانی که قرار دادن داده اما با استفاده از `-Merge`پسوند. + +یک تابع جمع با `-Merge` پسوند مجموعه ای از ایالت ها را ترکیب می کند و نتیجه تجمع کامل داده ها را باز می گرداند. + +مثلا, دو نمایش داده شد زیر بازگشت به همان نتیجه: + +``` sql +SELECT uniq(UserID) FROM table + +SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) +``` + +## مثال طریقه استفاده {#usage-example} + +ببینید [ریزدانه](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) موتور باشرکت. + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/fa/sql-reference/data-types/array.md b/docs/fa/sql-reference/data-types/array.md new file mode 100644 index 00000000000..6786a661904 --- /dev/null +++ b/docs/fa/sql-reference/data-types/array.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 51 +toc_title: "& \u062A\u0648\u0631\u06CC)" +--- + +# & توری) {#data-type-array} + +مجموعه ای از `T`- نوع اقلام است. `T` می تواند هر نوع داده, از جمله مجموعه. + +## ایجاد یک مجموعه {#creating-an-array} + +شما می توانید یک تابع برای ایجاد مجموعه ای استفاده کنید: + +``` sql +array(T) +``` + +شما همچنین می توانید براکت مربع استفاده کنید. + +``` sql +[] +``` + +نمونه ای از ایجاد یک مجموعه: + +``` sql +SELECT array(1, 2) AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName(array(1, 2))─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴─────────────────────────┘ +``` + +``` sql +SELECT [1, 2] AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName([1, 2])─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴────────────────────┘ +``` + +## کار با انواع داده ها {#working-with-data-types} + +در هنگام ایجاد مجموعه ای در پرواز, خانه رعیتی به طور خودکار نوع استدلال به عنوان باریک ترین نوع داده است که می تواند تمام استدلال ذکر شده ذخیره تعریف. اگر وجود دارد [Nullable](nullable.md#data_type-nullable) یا تحت اللفظی [NULL](../../sql-reference/syntax.md#null-literal) ارزش, نوع عنصر مجموعه ای نیز می شود [Nullable](nullable.md). + +اگر فاحشه خانه می تواند نوع داده را تعیین نمی کند, این تولید یک استثنا. مثلا, این اتفاق می افتد زمانی که تلاش برای ایجاد مجموعه ای با رشته ها و اعداد به طور همزمان (`SELECT array(1, 'a')`). + +نمونه هایی از تشخیص نوع داده ها به صورت خودکار: + +``` sql +SELECT array(1, 2, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ +│ [1,2,NULL] │ Array(Nullable(UInt8)) │ +└────────────┴───────────────────────────────┘ +``` + +اگر شما سعی می کنید برای ایجاد یک آرایه از ناسازگار انواع داده ها clickhouse پرتاب یک استثنا: + +``` sql +SELECT array(1, 'a') +``` + +``` text +Received exception from server (version 1.1.54388): +Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/fa/sql_reference/data_types/boolean.md b/docs/fa/sql-reference/data-types/boolean.md similarity index 100% rename from docs/fa/sql_reference/data_types/boolean.md rename to docs/fa/sql-reference/data-types/boolean.md diff --git a/docs/fa/sql_reference/data_types/date.md b/docs/fa/sql-reference/data-types/date.md similarity index 100% rename from docs/fa/sql_reference/data_types/date.md rename to docs/fa/sql-reference/data-types/date.md diff --git a/docs/fa/sql-reference/data-types/datetime.md b/docs/fa/sql-reference/data-types/datetime.md new file mode 100644 index 00000000000..708e5b091c0 --- /dev/null +++ b/docs/fa/sql-reference/data-types/datetime.md @@ -0,0 +1,129 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 48 +toc_title: DateTime +--- + +# تاریخ ساعت {#data_type-datetime} + +اجازه می دهد تا برای ذخیره یک لحظه در زمان, است که می تواند به عنوان یک تاریخ تقویم و یک زمان از یک روز بیان. + +نحو: + +``` sql +DateTime([timezone]) +``` + +محدوده پشتیبانی شده از ارزش ها: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. + +حل: 1 ثانیه. + +## استفاده از سخنان {#usage-remarks} + +نقطه در زمان به عنوان یک ذخیره می شود [برچسب زمان یونیکس](https://en.wikipedia.org/wiki/Unix_time), صرف نظر از منطقه زمانی و یا صرفه جویی در زمان نور روز. علاوه بر این `DateTime` نوع می توانید منطقه زمانی است که همین کار را برای کل ستون ذخیره, که تحت تاثیر قرار چگونه ارزش های `DateTime` مقادیر نوع در قالب متن نمایش داده می شود و چگونه مقادیر مشخص شده به عنوان رشته تجزیه می شوند (‘2020-01-01 05:00:01’). منطقه زمانی در ردیف جدول ذخیره نمی شود (و یا در نتیجه), اما در ابرداده ستون ذخیره می شود. +لیستی از مناطق زمانی پشتیبانی شده را می توان در [اانا پایگاه منطقه زمانی](https://www.iana.org/time-zones). +این `tzdata` بسته حاوی [اانا پایگاه منطقه زمانی](https://www.iana.org/time-zones), باید در سیستم نصب. استفاده از `timedatectl list-timezones` فرمان به لیست جغرافیایی شناخته شده توسط یک سیستم محلی. + +شما به صراحت می توانید یک منطقه زمانی برای `DateTime`- ستون نوع در هنگام ایجاد یک جدول. اگر منطقه زمانی تنظیم نشده است, خانه رعیتی با استفاده از ارزش [منطقهی زمانی](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) پارامتر در تنظیمات سرور و یا تنظیمات سیستم عامل در حال حاضر از شروع سرور کلیک. + +این [کلیک مشتری](../../interfaces/cli.md) اعمال منطقه زمانی سرور به طور پیش فرض اگر یک منطقه زمانی است که به صراحت تنظیم نشده است که مقدار دهی اولیه نوع داده ها. برای استفاده از منطقه زمان مشتری اجرا کنید `clickhouse-client` با `--use_client_time_zone` پارامتر. + +خروجی کلیک ارزش در `YYYY-MM-DD hh:mm:ss` قالب متن به طور پیش فرض. شما می توانید خروجی را با تغییر [formatDateTime](../../sql-reference/functions/date-time-functions.md#formatdatetime) تابع. + +هنگام قرار دادن داده ها به تاتر, شما می توانید فرمت های مختلف تاریخ و زمان رشته استفاده, بسته به ارزش [تغییر \_شماره](../../operations/settings/settings.md#settings-date_time_input_format) تنظیمات. + +## مثالها {#examples} + +**1.** ایجاد یک جدول با یک `DateTime`- ستون را تایپ کنید و داده ها را وارد کنید: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime('Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog; +``` + +``` sql +INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); +``` + +``` sql +SELECT * FROM dt; +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +- هنگام قرار دادن تاریخ ساعت به عنوان یک عدد صحیح, این است که به عنوان برچسب زمان یونیکس درمان (مجموعه مقالات). `1546300800` نشان دهنده `'2019-01-01 00:00:00'` ادا کردن. با این حال, مانند `timestamp` ستون دارد `Europe/Moscow` (مجموعه مقالات+3) منطقه زمانی مشخص, در هنگام خروجی به عنوان رشته ارزش خواهد شد به عنوان نشان داده شده است `'2019-01-01 03:00:00'` +- هنگام قرار دادن مقدار رشته به عنوان تاریخ ساعت, این است که به عنوان بودن در منطقه زمانی ستون درمان. `'2019-01-01 00:00:00'` خواهد شد به عنوان در درمان `Europe/Moscow` منطقه زمانی و ذخیره به عنوان `1546290000`. + +**2.** پالایش بر روی `DateTime` مقادیر + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +`DateTime` مقادیر ستون را می توان با استفاده از یک مقدار رشته در فیلتر `WHERE` مسندکردن. این تبدیل خواهد شد به `DateTime` به طور خودکار: + +``` sql +SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +└─────────────────────┴──────────┘ +``` + +**3.** گرفتن یک منطقه زمانی برای یک `DateTime`- نوع ستون: + +``` sql +SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────column─┬─x─────────────────────────┐ +│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ +└─────────────────────┴───────────────────────────┘ +``` + +**4.** تبدیل منطقه زمانی + +``` sql +SELECT +toDateTime(timestamp, 'Europe/London') as lon_time, +toDateTime(timestamp, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────lon_time──┬────────────mos_time─┐ +│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ +│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ +└─────────────────────┴─────────────────────┘ +``` + +## همچنین نگاه کنید به {#see-also} + +- [توابع تبدیل نوع](../../sql-reference/functions/type-conversion-functions.md) +- [توابع برای کار با تاریخ و زمان](../../sql-reference/functions/date-time-functions.md) +- [توابع کار با آرایه ها](../../sql-reference/functions/array-functions.md) +- [این `date_time_input_format` تنظیم](../../operations/settings/settings.md#settings-date_time_input_format) +- [این `timezone` پارامتر پیکربندی سرور](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [اپراتورها برای کار با تاریخ و زمان](../../sql-reference/operators.md#operators-datetime) +- [این `Date` نوع داده](date.md) + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/fa/sql-reference/data-types/datetime64.md b/docs/fa/sql-reference/data-types/datetime64.md new file mode 100644 index 00000000000..3c7bc236357 --- /dev/null +++ b/docs/fa/sql-reference/data-types/datetime64.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 49 +toc_title: "\u0637\u0648\u0644 \u062A\u0627\u0631\u06CC\u062E 64" +--- + +# طول تاریخ 64 {#data_type-datetime64} + +اجازه می دهد تا برای ذخیره یک لحظه در زمان, است که می تواند به عنوان یک تاریخ تقویم و یک زمان از یک روز بیان, با دقت زیر دوم تعریف شده + +اندازه تیک (دقت): 10- دقت ثانیه + +نحو: + +``` sql +DateTime64(precision, [timezone]) +``` + +داخلی, ذخیره داده ها به عنوان تعدادی از ‘ticks’ از عصر شروع (1970-01-01 00:00:00 یو تی سی) به عنوان اینترنشنال64. وضوح تیک توسط پارامتر دقیق تعیین می شود. علاوه بر این `DateTime64` نوع می توانید منطقه زمانی است که همین کار را برای کل ستون ذخیره, که تحت تاثیر قرار چگونه ارزش های `DateTime64` مقادیر نوع در قالب متن نمایش داده می شود و چگونه مقادیر مشخص شده به عنوان رشته تجزیه می شوند (‘2020-01-01 05:00:01.000’). منطقه زمانی در ردیف جدول ذخیره نمی شود (و یا در نتیجه), اما در ابرداده ستون ذخیره می شود. مشاهده اطلاعات در [DateTime](datetime.md). + +## مثالها {#examples} + +**1.** ایجاد یک جدول با `DateTime64`- ستون را تایپ کنید و داده ها را وارد کنید: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime64(3, 'Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog +``` + +``` sql +INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) +``` + +``` sql +SELECT * FROM dt +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00.000 │ 1 │ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +- هنگام قرار دادن تاریخ ساعت به عنوان یک عدد صحیح, این است که به عنوان یک مناسب کوچک برچسب زمان یونیکس درمان (مجموعه مقالات). `1546300800000` (با دقت 3) نشان دهنده `'2019-01-01 00:00:00'` ادا کردن. با این حال, مانند `timestamp` ستون دارد `Europe/Moscow` (مجموعه مقالات+3) منطقه زمانی مشخص, در هنگام خروجی به عنوان یک رشته ارزش خواهد شد به عنوان نشان داده شده است `'2019-01-01 03:00:00'` +- هنگام قرار دادن مقدار رشته به عنوان تاریخ ساعت, این است که به عنوان بودن در منطقه زمانی ستون درمان. `'2019-01-01 00:00:00'` خواهد شد به عنوان در درمان `Europe/Moscow` منطقه زمانی و ذخیره شده به عنوان `1546290000000`. + +**2.** پالایش بر روی `DateTime64` مقادیر + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +برخلاف `DateTime`, `DateTime64` ارزش ها از تبدیل نمی `String` به طور خودکار + +**3.** گرفتن یک منطقه زمانی برای یک `DateTime64`- مقدار نوع: + +``` sql +SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────────column─┬─x──────────────────────────────┐ +│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ +└─────────────────────────┴────────────────────────────────┘ +``` + +**4.** تبدیل منطقه زمانی + +``` sql +SELECT +toDateTime64(timestamp, 3, 'Europe/London') as lon_time, +toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────────lon_time──┬────────────────mos_time─┐ +│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ +│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ +└─────────────────────────┴─────────────────────────┘ +``` + +## همچنین نگاه کنید {#see-also} + +- [توابع تبدیل نوع](../../sql-reference/functions/type-conversion-functions.md) +- [توابع برای کار با تاریخ و زمان](../../sql-reference/functions/date-time-functions.md) +- [توابع برای کار با ارریس](../../sql-reference/functions/array-functions.md) +- [این `date_time_input_format` تنظیم](../../operations/settings/settings.md#settings-date_time_input_format) +- [این `timezone` پارامتر پیکربندی سرور](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [اپراتورها برای کار با تاریخ و زمان](../../sql-reference/operators.md#operators-datetime) +- [`Date` نوع داده](date.md) +- [`DateTime` نوع داده](datetime.md) diff --git a/docs/fa/sql_reference/data_types/decimal.md b/docs/fa/sql-reference/data-types/decimal.md similarity index 100% rename from docs/fa/sql_reference/data_types/decimal.md rename to docs/fa/sql-reference/data-types/decimal.md diff --git a/docs/fa/sql_reference/data_types/domains/index.md b/docs/fa/sql-reference/data-types/domains/index.md similarity index 100% rename from docs/fa/sql_reference/data_types/domains/index.md rename to docs/fa/sql-reference/data-types/domains/index.md diff --git a/docs/fa/sql_reference/data_types/domains/ipv4.md b/docs/fa/sql-reference/data-types/domains/ipv4.md similarity index 100% rename from docs/fa/sql_reference/data_types/domains/ipv4.md rename to docs/fa/sql-reference/data-types/domains/ipv4.md diff --git a/docs/fa/sql_reference/data_types/domains/ipv6.md b/docs/fa/sql-reference/data-types/domains/ipv6.md similarity index 100% rename from docs/fa/sql_reference/data_types/domains/ipv6.md rename to docs/fa/sql-reference/data-types/domains/ipv6.md diff --git a/docs/fa/sql_reference/data_types/domains/overview.md b/docs/fa/sql-reference/data-types/domains/overview.md similarity index 100% rename from docs/fa/sql_reference/data_types/domains/overview.md rename to docs/fa/sql-reference/data-types/domains/overview.md diff --git a/docs/fa/sql-reference/data-types/enum.md b/docs/fa/sql-reference/data-types/enum.md new file mode 100644 index 00000000000..b79ffa1cea0 --- /dev/null +++ b/docs/fa/sql-reference/data-types/enum.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 50 +toc_title: "\u0634\u0645\u0627\u0631\u0634\u06CC" +--- + +# شمارشی {#enum} + +نوع شمارش متشکل از ارزش به نام. + +مقادیر نام شده باید به عنوان اعلام شود `'string' = integer` جفت انبار فروشگاه تنها اعداد, اما پشتیبانی از عملیات با ارزش از طریق نام خود را. + +پشتیبانی از کلیک: + +- 8 بیتی `Enum`. این می تواند تا 256 مقدار شمارش شده در `[-128, 127]` محدوده. +- 16 بیتی `Enum`. این می تواند تا 65536 مقدار شمارش شده در `[-32768, 32767]` محدوده. + +تاتر به طور خودکار انتخاب نوع `Enum` هنگامی که داده درج شده است. شما همچنین می توانید استفاده کنید `Enum8` یا `Enum16` انواع برای اطمینان در اندازه ذخیره سازی. + +## نمونه های استفاده {#usage-examples} + +در اینجا ما یک جدول با یک ایجاد می کنیم `Enum8('hello' = 1, 'world' = 2)` نوع ستون: + +``` sql +CREATE TABLE t_enum +( + x Enum('hello' = 1, 'world' = 2) +) +ENGINE = TinyLog +``` + +ستون `x` فقط می توانید مقادیر که در تعریف نوع ذکر شده را ذخیره کنید: `'hello'` یا `'world'`. اگر شما سعی می کنید برای صرفه جویی در هر مقدار دیگر, کلیک یک استثنا بالا می برد. اندازه 8 بیتی برای این `Enum` به طور خودکار انتخاب شده است. + +``` sql +INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') +``` + +``` text +Ok. +``` + +``` sql +INSERT INTO t_enum values('a') +``` + +``` text +Exception on client: +Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) +``` + +هنگامی که شما پرس و جو داده ها را از جدول, تاتر خروجی مقادیر رشته از `Enum`. + +``` sql +SELECT * FROM t_enum +``` + +``` text +┌─x─────┐ +│ hello │ +│ world │ +│ hello │ +└───────┘ +``` + +اگر شما نیاز به دیدن معادل عددی از ردیف, شما باید بازیگران `Enum` ارزش به نوع صحیح. + +``` sql +SELECT CAST(x, 'Int8') FROM t_enum +``` + +``` text +┌─CAST(x, 'Int8')─┐ +│ 1 │ +│ 2 │ +│ 1 │ +└─────────────────┘ +``` + +برای ایجاد یک مقدار شمارشی در پرس و جو, شما همچنین نیاز به استفاده از `CAST`. + +``` sql +SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) +``` + +``` text +┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ +│ Enum8('a' = 1, 'b' = 2) │ +└─────────────────────────────────────────────────────┘ +``` + +## قوانین عمومی و استفاده {#general-rules-and-usage} + +هر یک از مقادیر یک عدد در محدوده اختصاص داده شده است `-128 ... 127` برای `Enum8` یا در محدوده `-32768 ... 32767` برای `Enum16`. همه رشته ها و اعداد باید متفاوت باشد. یک رشته خالی مجاز است. اگر این نوع مشخص شده است (در یک تعریف جدول), اعداد را می توان در جهت دلخواه. با این حال, سفارش مهم نیست. + +نه رشته و نه مقدار عددی در یک `Enum` می تواند باشد [NULL](../../sql-reference/syntax.md). + +یک `Enum` می توان در [Nullable](nullable.md) نوع. بنابراین اگر شما یک جدول با استفاده از پرس و جو ایجاد کنید + +``` sql +CREATE TABLE t_enum_nullable +( + x Nullable( Enum8('hello' = 1, 'world' = 2) ) +) +ENGINE = TinyLog +``` + +این می تواند نه تنها ذخیره `'hello'` و `'world'` اما `NULL` همینطور + +``` sql +INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) +``` + +در رم `Enum` ستون به همان شیوه ذخیره می شود `Int8` یا `Int16` از مقادیر عددی مربوطه. + +هنگام خواندن در فرم متن, تاتر تجزیه ارزش به عنوان یک رشته و جستجو برای رشته مربوطه را از مجموعه ای از ارزش شمارشی. اگر یافت نشد, یک استثنا پرتاب می شود. هنگام خواندن در قالب متن, رشته به عنوان خوانده شده و مقدار عددی مربوطه نگاه کردن. یک استثنا پرتاب خواهد شد اگر یافت نشد. +هنگام نوشتن در فرم متن, این ارزش به عنوان رشته مربوطه می نویسد. اگر داده های ستون شامل زباله (اعداد است که از مجموعه معتبر نیست), یک استثنا پرتاب می شود. زمانی که خواندن و نوشتن در فایل باینری فرم آن را با این نسخهها کار به همان روش برای int8 و int16 انواع داده ها. +مقدار پیش فرض ضمنی ارزش با کمترین تعداد است. + +در طول `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` و به همین ترتیب, مادران رفتار به همان شیوه به عنوان اعداد مربوطه. مثلا, سفارش شده توسط انواع عددی. اپراتورهای برابری و مقایسه کار به همان شیوه در مادران به عنوان در مقادیر عددی اساسی انجام. + +مقادیر شمارشی را نمی توان با اعداد مقایسه شده است. شمارشی را می توان به یک رشته ثابت در مقایسه. اگر رشته در مقایسه با یک مقدار معتبر برای شمارشی نیست, یک استثنا پرتاب خواهد شد. اپراتور در با شمارشی در سمت چپ و مجموعه ای از رشته ها در سمت راست پشتیبانی می شود. رشته ارزش مربوط شمارشی هستند. + +Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. +با این حال, شمارشی طبیعی است `toString` تابع است که ارزش رشته خود را برمی گرداند. + +مقادیر شمارشی نیز قابل تبدیل به انواع عددی با استفاده از `toT` تابع, که تی یک نوع عددی است. هنگامی که تی مربوط به نوع عددی اساسی شمارشی است, این تبدیل صفر هزینه است. +نوع شمارشی را می توان بدون هزینه با استفاده از تغییر تغییر, اگر تنها مجموعه ای از ارزش تغییر است. ممکن است که به هر دو اضافه کردن و حذف اعضای شمارشی با استفاده از تغییر (از بین بردن امن است تنها در صورتی که مقدار حذف شده است هرگز در جدول استفاده می شود). به عنوان یک حفاظت, تغییر مقدار عددی از یک عضو شمارشی که قبلا تعریف یک استثنا پرتاب. + +با استفاده از تغییر آن را ممکن است برای تغییر یک enum8 به enum16 یا بالعکس فقط مانند تغییر یک int8 به int16. + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/fa/sql-reference/data-types/fixedstring.md b/docs/fa/sql-reference/data-types/fixedstring.md new file mode 100644 index 00000000000..cb1aaf3c583 --- /dev/null +++ b/docs/fa/sql-reference/data-types/fixedstring.md @@ -0,0 +1,63 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: "\u0631\u0634\u062A\u0647 \u062B\u0627\u0628\u062A)" +--- + +# رشته ثابت {#fixedstring} + +یک رشته ثابت طول `N` بایت (نه شخصیت و نه نقاط کد). + +برای اعلام یک ستون از `FixedString` نوع, استفاده از نحو زیر: + +``` sql + FixedString(N) +``` + +کجا `N` یک عدد طبیعی است. + +این `FixedString` نوع زمانی موثر است که داده ها طول دقیق داشته باشند `N` بایت در تمام موارد دیگر, این احتمال وجود دارد به کاهش بهره وری. + +نمونه هایی از مقادیر است که می تواند موثر در ذخیره می شود `FixedString`- ستون های تایپ شده: + +- نمایندگی دودویی نشانی های اینترنتی (`FixedString(16)` برای ایپو6). +- Language codes (ru\_RU, en\_US … ). +- Currency codes (USD, RUB … ). +- نمایش دودویی رشته هش (`FixedString(16)` برای ام دی 5, `FixedString(32)` برای شی256). + +برای ذخیره مقادیر یوید از [UUID](uuid.md) نوع داده. + +هنگام قرار دادن داده ها, تاتر: + +- مکمل یک رشته با null بایت اگر رشته شامل کمتر از `N` بایت +- پرتاب `Too large value for FixedString(N)` استثنا اگر رشته شامل بیش از `N` بایت + +در هنگام انتخاب داده, تاتر می کند بایت پوچ در پایان رشته را حذف کنید. اگر شما استفاده از `WHERE` بند, شما باید بایت پوچ دستی اضافه برای مطابقت با `FixedString` ارزش. مثال زیر نشان میدهد که چگونه به استفاده از `WHERE` بند با `FixedString`. + +بیایید جدول زیر را با تک در نظر بگیریم `FixedString(2)` ستون: + +``` text +┌─name──┐ +│ b │ +└───────┘ +``` + +پرسوجو `SELECT * FROM FixedStringTable WHERE a = 'b'` هیچ داده به عنوان یک نتیجه نمی گرداند. ما باید الگوی فیلتر با بایت پوچ تکمیل. + +``` sql +SELECT * FROM FixedStringTable +WHERE a = 'b\0' +``` + +``` text +┌─a─┐ +│ b │ +└───┘ +``` + +این رفتار از خروجی زیر برای متفاوت `CHAR` نوع (جایی که رشته ها با فضاهای خالی, و فضاهای برای خروجی حذف). + +توجه داشته باشید که طول `FixedString(N)` ارزش ثابت است. این [طول](../../sql-reference/functions/array-functions.md#array_functions-length) بازده عملکرد `N` حتی اگر `FixedString(N)` ارزش تنها با بایت پوچ پر, اما [خالی](../../sql-reference/functions/string-functions.md#empty) بازده عملکرد `1` در این مورد. + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/fa/sql_reference/data_types/float.md b/docs/fa/sql-reference/data-types/float.md similarity index 100% rename from docs/fa/sql_reference/data_types/float.md rename to docs/fa/sql-reference/data-types/float.md diff --git a/docs/fa/sql_reference/data_types/index.md b/docs/fa/sql-reference/data-types/index.md similarity index 100% rename from docs/fa/sql_reference/data_types/index.md rename to docs/fa/sql-reference/data-types/index.md diff --git a/docs/fa/sql_reference/data_types/int_uint.md b/docs/fa/sql-reference/data-types/int-uint.md similarity index 100% rename from docs/fa/sql_reference/data_types/int_uint.md rename to docs/fa/sql-reference/data-types/int-uint.md diff --git a/docs/fa/sql_reference/data_types/nested_data_structures/index.md b/docs/fa/sql-reference/data-types/nested-data-structures/index.md similarity index 100% rename from docs/fa/sql_reference/data_types/nested_data_structures/index.md rename to docs/fa/sql-reference/data-types/nested-data-structures/index.md diff --git a/docs/fa/sql-reference/data-types/nested-data-structures/nested.md b/docs/fa/sql-reference/data-types/nested-data-structures/nested.md new file mode 100644 index 00000000000..6422fabff53 --- /dev/null +++ b/docs/fa/sql-reference/data-types/nested-data-structures/nested.md @@ -0,0 +1,106 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 57 +toc_title: "\u062A\u0648 \u062F\u0631 \u062A\u0648(Name1 Type1, Name2 Type2, ...)" +--- + +# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) پرس و جو. هر سطر جدول می تواند به هر تعداد از ردیف در یک ساختار داده تو در تو مطابقت. + +مثال: + +``` sql +CREATE TABLE test.visits +( + CounterID UInt32, + StartDate Date, + Sign Int8, + IsNew UInt8, + VisitID UInt64, + UserID UInt64, + ... + Goals Nested + ( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32 + ), + ... +) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) +``` + +این مثال اعلام کرد `Goals` ساختار داده های تو در تو, که شامل داده ها در مورد تبدیل (اهداف رسیده). هر سطر در ‘visits’ جدول می تواند به صفر یا هر تعداد از تبدیل مطابقت دارد. + +فقط یک سطح تودرتو تک پشتیبانی می شود. ستون های سازه های تو در تو حاوی ارریس معادل چندین بعدی هستند بنابراین پشتیبانی محدودی دارند (هیچ پشتیبانی ای برای ذخیره این ستون ها در جداول با موتور ادغام وجود ندارد). + +در بیشتر موارد, در هنگام کار با یک ساختار داده های تو در تو, ستون خود را با نام ستون جدا شده توسط یک نقطه مشخص. این ستون ها مجموعه ای از انواع تطبیق را تشکیل می دهند. تمام ستون ها از یک ساختار داده های تو در تو یکسان هستند. + +مثال: + +``` sql +SELECT + Goals.ID, + Goals.EventTime +FROM test.visits +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ +│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ +│ [1073752] │ ['2014-03-17 00:28:25'] │ +│ [1073752] │ ['2014-03-17 10:46:20'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ +│ [] │ [] │ +│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ +│ [] │ [] │ +│ [] │ [] │ +│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ +└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +ساده ترین راه این است که از یک ساختار داده های تو در تو فکر می کنم به عنوان مجموعه ای از مجموعه ای از مجموعه های ستون های متعدد از همان طول. + +تنها جایی که پرس و جو را انتخاب کنید می توانید نام کل ساختار داده های تو در تو به جای ستون های فردی مشخص مجموعه ملحق بند. برای کسب اطلاعات بیشتر, دیدن “ARRAY JOIN clause”. مثال: + +``` sql +SELECT + Goal.ID, + Goal.EventTime +FROM test.visits +ARRAY JOIN Goals AS Goal +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goal.ID─┬──────Goal.EventTime─┐ +│ 1073752 │ 2014-03-17 16:38:10 │ +│ 591325 │ 2014-03-17 16:38:48 │ +│ 591325 │ 2014-03-17 16:42:27 │ +│ 1073752 │ 2014-03-17 00:28:25 │ +│ 1073752 │ 2014-03-17 10:46:20 │ +│ 1073752 │ 2014-03-17 13:59:20 │ +│ 591325 │ 2014-03-17 22:17:55 │ +│ 591325 │ 2014-03-17 22:18:07 │ +│ 591325 │ 2014-03-17 22:18:51 │ +│ 1073752 │ 2014-03-17 11:37:06 │ +└─────────┴─────────────────────┘ +``` + +شما نمی توانید انتخاب کنید برای کل ساختار داده های تو در تو انجام دهد. شما فقط می توانید به صراحت ستون های فردی را که بخشی از این هستند لیست کنید. + +برای پرس و جو درج, شما باید تمام عناصر ستون مولفه از یک ساختار داده های تو در تو به طور جداگانه منتقل (در صورتی که مجموعه فردی بودند). در حین درج سیستم چک می کند که همان طول را دارند. + +برای پرس و جو توصیف, ستون در یک ساختار داده های تو در تو به طور جداگانه در همان راه ذکر شده. + +پرس و جو را تغییر دهید برای عناصر در یک ساختار داده های تو در تو دارای محدودیت. + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/fa/sql-reference/data-types/nullable.md b/docs/fa/sql-reference/data-types/nullable.md new file mode 100644 index 00000000000..65e6faa0c07 --- /dev/null +++ b/docs/fa/sql-reference/data-types/nullable.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: Nullable +--- + +# Nullable(typename) {#data_type-nullable} + +اجازه می دهد تا برای ذخیره نشانگر ویژه ([NULL](../../sql-reference/syntax.md)) که نشان دهنده “missing value” در کنار مقادیر عادی مجاز `TypeName`. برای مثال یک `Nullable(Int8)` ستون نوع می تواند ذخیره شود `Int8` ارزش نوع و ردیف است که ارزش ذخیره خواهد شد `NULL`. + +برای یک `TypeName` شما نمی توانید از انواع داده های کامپوزیت استفاده کنید [& حذف](array.md) و [تاپل](tuple.md). انواع داده های کامپوزیت می تواند شامل `Nullable` مقادیر نوع مانند `Array(Nullable(Int8))`. + +A `Nullable` فیلد نوع را نمی توان در شاخص های جدول گنجانده شده است. + +`NULL` مقدار پیش فرض برای هر `Nullable` نوع, مگر اینکه در غیر این صورت در پیکربندی سرور کلیک مشخص. + +## ویژگی های ذخیره سازی {#storage-features} + +برای ذخیره `Nullable` ارزش نوع در یک ستون جدول, تاتر با استفاده از یک فایل جداگانه با `NULL` ماسک علاوه بر فایل عادی با ارزش. مطالب در ماسک فایل اجازه می دهد خانه کلیک برای تشخیص بین `NULL` و یک مقدار پیش فرض از نوع داده مربوطه را برای هر سطر جدول. به دلیل یک فایل اضافی, `Nullable` ستون مصرف فضای ذخیره سازی اضافی در مقایسه با یک نرمال مشابه. + +!!! info "یادداشت" + با استفاده از `Nullable` تقریبا همیشه منفی تاثیر می گذارد عملکرد, نگه داشتن این در ذهن در هنگام طراحی پایگاه داده های خود را. + +## مثال طریقه استفاده {#usage-example} + +``` sql +CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog +``` + +``` sql +INSERT INTO t_null VALUES (1, NULL), (2, 3) +``` + +``` sql +SELECT x + y FROM t_null +``` + +``` text +┌─plus(x, y)─┐ +│ ᴺᵁᴸᴸ │ +│ 5 │ +└────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/fa/sql-reference/data-types/simpleaggregatefunction.md b/docs/fa/sql-reference/data-types/simpleaggregatefunction.md new file mode 120000 index 00000000000..76a7ef3b802 --- /dev/null +++ b/docs/fa/sql-reference/data-types/simpleaggregatefunction.md @@ -0,0 +1 @@ +../../../en/sql-reference/data-types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/fa/sql_reference/data_types/special_data_types/expression.md b/docs/fa/sql-reference/data-types/special-data-types/expression.md similarity index 100% rename from docs/fa/sql_reference/data_types/special_data_types/expression.md rename to docs/fa/sql-reference/data-types/special-data-types/expression.md diff --git a/docs/fa/sql_reference/data_types/special_data_types/index.md b/docs/fa/sql-reference/data-types/special-data-types/index.md similarity index 100% rename from docs/fa/sql_reference/data_types/special_data_types/index.md rename to docs/fa/sql-reference/data-types/special-data-types/index.md diff --git a/docs/fa/sql-reference/data-types/special-data-types/interval.md b/docs/fa/sql-reference/data-types/special-data-types/interval.md new file mode 100644 index 00000000000..f9be0f45a46 --- /dev/null +++ b/docs/fa/sql-reference/data-types/special-data-types/interval.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 61 +toc_title: "\u0641\u0627\u0635\u0644\u0647" +--- + +# فاصله {#data-type-interval} + +خانواده از انواع داده ها به نمایندگی از فواصل زمان و تاریخ. انواع حاصل از [INTERVAL](../../../sql-reference/operators.md#operator-interval) اپراتور + +!!! warning "اخطار" + `Interval` مقادیر نوع داده را نمی توان در جداول ذخیره کرد. + +ساختار: + +- فاصله زمانی به عنوان یک مقدار عدد صحیح بدون علامت. +- نوع یک بازه ی زمانی. + +انواع فاصله پشتیبانی شده: + +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +برای هر نوع فاصله, یک نوع داده جداگانه وجود دارد. برای مثال `DAY` فاصله مربوط به `IntervalDay` نوع داده: + +``` sql +SELECT toTypeName(INTERVAL 4 DAY) +``` + +``` text +┌─toTypeName(toIntervalDay(4))─┐ +│ IntervalDay │ +└──────────────────────────────┘ +``` + +## اظهارات طریقه استفاده {#data-type-interval-usage-remarks} + +شما می توانید استفاده کنید `Interval`- ارزش نوع در عملیات ریاضی با [تاریخ](../../../sql-reference/data-types/date.md) و [DateTime](../../../sql-reference/data-types/datetime.md)- ارزش نوع . مثلا, شما می توانید اضافه کنید 4 روز به زمان فعلی: + +``` sql +SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY +``` + +``` text +┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ +│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ +└─────────────────────┴───────────────────────────────┘ +``` + +فواصل با انواع مختلف نمی تواند ترکیب شود. شما می توانید فواصل مانند استفاده کنید `4 DAY 1 HOUR`. تعیین فواصل در واحد هایی که کوچکتر یا مساوی به کوچکترین واحد از فاصله مثلا فاصله `1 day and an hour` فاصله را می توان به عنوان بیان شده است `25 HOUR` یا `90000 SECOND`. + +شما می توانید عملیات ریاضی با انجام نمی `Interval`- ارزش نوع, اما شما می توانید فواصل از انواع مختلف در نتیجه به ارزش در اضافه `Date` یا `DateTime` انواع داده ها. به عنوان مثال: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +پرس و جوی زیر باعث می شود یک استثنا: + +``` sql +select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) +``` + +``` text +Received exception from server (version 19.14.1): +Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. +``` + +## همچنین نگاه کنید به {#see-also} + +- [INTERVAL](../../../sql-reference/operators.md#operator-interval) اپراتور +- [توینتروال](../../../sql-reference/functions/type-conversion-functions.md#function-tointerval) توابع تبدیل نوع diff --git a/docs/fa/sql-reference/data-types/special-data-types/nothing.md b/docs/fa/sql-reference/data-types/special-data-types/nothing.md new file mode 100644 index 00000000000..1b8140bf809 --- /dev/null +++ b/docs/fa/sql-reference/data-types/special-data-types/nothing.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 60 +toc_title: "\u0647\u06CC\u0686 \u0686\u06CC\u0632" +--- + +# هیچی {#nothing} + +تنها هدف از این نوع داده ها نشان دهنده مواردی است که انتظار نمی رود ارزش باشد. بنابراین شما می توانید یک ایجاد کنید `Nothing` نوع ارزش. + +مثلا, تحت اللفظی [NULL](../../../sql-reference/syntax.md#null-literal) دارای نوع `Nullable(Nothing)`. اطلاعات بیشتر در مورد [Nullable](../../../sql-reference/data-types/nullable.md). + +این `Nothing` نوع نیز می تواند مورد استفاده برای نشان دادن خالی: + +``` sql +SELECT toTypeName(array()) +``` + +``` text +┌─toTypeName(array())─┐ +│ Array(Nothing) │ +└─────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/fa/sql-reference/data-types/special-data-types/set.md b/docs/fa/sql-reference/data-types/special-data-types/set.md new file mode 100644 index 00000000000..8f5cc9be947 --- /dev/null +++ b/docs/fa/sql-reference/data-types/special-data-types/set.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 59 +toc_title: "\u062A\u0646\u0638\u06CC\u0645" +--- + +# تنظیم {#set} + +مورد استفاده برای نیمه راست یک [IN](../../../sql-reference/statements/select.md#select-in-operators) اصطلاح. + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/fa/sql_reference/data_types/string.md b/docs/fa/sql-reference/data-types/string.md similarity index 100% rename from docs/fa/sql_reference/data_types/string.md rename to docs/fa/sql-reference/data-types/string.md diff --git a/docs/fa/sql-reference/data-types/tuple.md b/docs/fa/sql-reference/data-types/tuple.md new file mode 100644 index 00000000000..d99b3085ef8 --- /dev/null +++ b/docs/fa/sql-reference/data-types/tuple.md @@ -0,0 +1,52 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 53 +toc_title: "\u062A\u0627\u067E\u0644 (\u062A\u06CC1, \u062A\u06CC2,...)" +--- + +# Tuple(t1, T2, …) {#tuplet1-t2} + +یک تاپل از عناصر, هر یک با داشتن یک فرد [نوع](index.md#data_types). + +تاپل برای گروه بندی ستون موقت استفاده می شود. ستون ها را می توان گروه بندی کرد زمانی که یک عبارت در یک پرس و جو استفاده می شود, و برای مشخص کردن پارامترهای رسمی خاصی از توابع لامبدا. برای کسب اطلاعات بیشتر به بخش ها مراجعه کنید [در اپراتورها](../../sql-reference/statements/select.md) و [توابع سفارش بالاتر](../../sql-reference/functions/higher-order-functions.md). + +تاپل می تواند در نتیجه یک پرس و جو. در این مورد, برای فرمت های متنی غیر از جانسون, ارزش کاما از هم جدا در براکت. در فرمت های جوسون, تاپل خروجی به عنوان ارریس هستند (در براکت مربع). + +## ایجاد یک تاپل {#creating-a-tuple} + +شما می توانید یک تابع برای ایجاد یک تاپل استفاده کنید: + +``` sql +tuple(T1, T2, ...) +``` + +نمونه ای از ایجاد یک تاپل: + +``` sql +SELECT tuple(1,'a') AS x, toTypeName(x) +``` + +``` text +┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ +│ (1,'a') │ Tuple(UInt8, String) │ +└─────────┴───────────────────────────┘ +``` + +## کار با انواع داده ها {#working-with-data-types} + +در هنگام ایجاد یک تاپل در پرواز, تاتر به طور خودکار نوع هر استدلال به عنوان حداقل از انواع که می تواند ارزش استدلال ذخیره تشخیص. اگر استدلال است [NULL](../../sql-reference/syntax.md#null-literal), نوع عنصر تاپل است [Nullable](nullable.md). + +نمونه ای از تشخیص نوع داده ها به صورت خودکار: + +``` sql +SELECT tuple(1, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ +│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ +└──────────┴─────────────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/fa/sql-reference/data-types/uuid.md b/docs/fa/sql-reference/data-types/uuid.md new file mode 100644 index 00000000000..bec3e996f70 --- /dev/null +++ b/docs/fa/sql-reference/data-types/uuid.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 46 +toc_title: UUID +--- + +# UUID {#uuid-data-type} + +شناسه جهانی منحصر به فرد (شناسه) یک عدد 16 بایت مورد استفاده برای شناسایی سوابق است. برای کسب اطلاعات دقیق در مورد شناسه, دیدن [ویکیپدیا](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +نمونه ای از ارزش نوع شناسه در زیر نشان داده شده است: + +``` text +61f0c404-5cb3-11e7-907b-a6006ad3dba0 +``` + +اگر شما مقدار ستون شناسه مشخص نیست در هنگام قرار دادن یک رکورد جدید, ارزش شناسه با صفر پر: + +``` text +00000000-0000-0000-0000-000000000000 +``` + +## چگونه برای تولید {#how-to-generate} + +برای تولید ارزش شناسه, خانه فراهم می کند [جنراتیدو4](../../sql-reference/functions/uuid-functions.md) تابع. + +## مثال طریقه استفاده {#usage-example} + +**مثال 1** + +این مثال نشان می دهد ایجاد یک جدول با ستون نوع شناسه و قرار دادن یک مقدار به جدول. + +``` sql +CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog +``` + +``` sql +INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +└──────────────────────────────────────┴───────────┘ +``` + +**مثال 2** + +در این مثال مقدار ستون یوید هنگام وارد کردن یک رکورد جدید مشخص نشده است. + +``` sql +INSERT INTO t_uuid (y) VALUES ('Example 2') +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ +└──────────────────────────────────────┴───────────┘ +``` + +## محدودیت ها {#restrictions} + +نوع داده شناسه تنها پشتیبانی از توابع که [رشته](string.md) نوع داده نیز پشتیبانی می کند (به عنوان مثال, [کمینه](../../sql-reference/aggregate-functions/reference.md#agg_function-min), [حداکثر](../../sql-reference/aggregate-functions/reference.md#agg_function-max) و [شمارش](../../sql-reference/aggregate-functions/reference.md#agg_function-count)). + +نوع داده یوید توسط عملیات ریاضی پشتیبانی نمی شود (به عنوان مثال, [شکم](../../sql-reference/functions/arithmetic-functions.md#arithm_func-abs)) و یا توابع دانه, مانند [جمع](../../sql-reference/aggregate-functions/reference.md#agg_function-sum) و [میانگین](../../sql-reference/aggregate-functions/reference.md#agg_function-avg). + +[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md new file mode 100644 index 00000000000..055e3ad1204 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md @@ -0,0 +1,71 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: "\u0644\u063A\u062A\u0646\u0627\u0645\u0647\u0647\u0627 \u0633\u0644\u0633\ + \u0644\u0647 \u0645\u0631\u0627\u062A\u0628\u06CC" +--- + +# لغتنامهها سلسله مراتبی {#hierarchical-dictionaries} + +کلیک هاوس از لغت نامه های سلسله مراتبی با یک [کلید عددی](external-dicts-dict-structure.md#ext_dict-numeric-key). + +در ساختار سلسله مراتبی زیر نگاه کنید: + +``` text +0 (Common parent) +│ +├── 1 (Russia) +│ │ +│ └── 2 (Moscow) +│ │ +│ └── 3 (Center) +│ +└── 4 (Great Britain) + │ + └── 5 (London) +``` + +این سلسله مراتب را می توان به عنوان جدول فرهنگ لغت زیر بیان شده است. + +| \_ورود | \_ نواحی | نام \_خانوادگی | +|--------|----------|----------------| +| 1 | 0 | روسیه | +| 2 | 1 | مسکو | +| 3 | 2 | مرکز | +| 4 | 0 | بریتانیا | +| 5 | 4 | لندن | + +این جدول شامل یک ستون است `parent_region` که شامل کلید نزدیکترین پدر و مادر برای عنصر. + +تاتر از [سلسله مراتبی](external-dicts-dict-structure.md#hierarchical-dict-attr) املاک برای [فرهنگ لغت خارجی](index.md) صفات. این ویژگی اجازه می دهد تا شما را به پیکربندی فرهنگ لغت سلسله مراتبی شبیه به بالا توضیح داده شد. + +این [حکومت دیکتاتوری](../../../sql-reference/functions/ext-dict-functions.md#dictgethierarchy) تابع اجازه می دهد تا شما را به زنجیره پدر و مادر از یک عنصر. + +برای مثال ما ساختار فرهنگ لغت می تواند به شرح زیر است: + +``` xml + + + + region_id + + + + parent_region + UInt64 + 0 + true + + + + region_name + String + + + + + +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md new file mode 100644 index 00000000000..5fbf88291a8 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md @@ -0,0 +1,374 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 41 +toc_title: "\u0630\u062E\u06CC\u0631\u0647 \u0648\u0627\u0698\u0647\u0646\u0627\u0645\ + \u0647\u0647\u0627 \u062F\u0631 \u062D\u0627\u0641\u0638\u0647" +--- + +# ذخیره واژهنامهها در حافظه {#dicts-external-dicts-dict-layout} + +راه های مختلفی برای ذخیره لغت نامه ها در حافظه وجود دارد. + +ما توصیه می کنیم [تخت](#flat), [درهم](#dicts-external_dicts_dict_layout-hashed) و [\_ساخت مجتمع](#complex-key-hashed). که سرعت پردازش بهینه را فراهم می کند. + +ذخیره سازی به دلیل عملکرد بالقوه ضعیف و مشکلات در انتخاب پارامترهای مطلوب توصیه نمی شود. ادامه مطلب در بخش “[نهانگاه](#cache)”. + +راه های مختلفی برای بهبود عملکرد فرهنگ لغت وجود دارد: + +- پاسخ تابع برای کار با فرهنگ لغت پس از `GROUP BY`. +- علامت گذاری به عنوان ویژگی برای استخراج به عنوان تزریقی. یک ویژگی است که به نام عاطفی اگر مقادیر ویژگی های مختلف به کلید های مختلف مطابقت دارد. بنابراین زمانی که `GROUP BY` با استفاده از یک تابع است که بازخوانی ارزش ویژگی های کلیدی, این تابع به طور خودکار از گرفته `GROUP BY`. + +تاتر تولید یک استثنا برای خطا با لغت نامه. نمونه هایی از اشتباهات: + +- فرهنگ لغت در حال دسترسی نمی تواند لود شود. +- خطای پرسوجو یک `cached` فرهنگ لغت. + +شما می توانید لیستی از لغت نامه های خارجی و وضعیت خود را در `system.dictionaries` جدول + +پیکربندی به نظر می رسد مثل این: + +``` xml + + + ... + + + + + + ... + + +``` + +متناظر [توصیف](../../statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY (...) +... +LAYOUT(LAYOUT_TYPE(param value)) -- layout settings +... +``` + +## راه هایی برای ذخیره لغت نامه ها در حافظه {#ways-to-store-dictionaries-in-memory} + +- [تخت](#flat) +- [درهم](#dicts-external_dicts_dict_layout-hashed) +- [فشردهسازی](#dicts-external_dicts_dict_layout-sparse_hashed) +- [نهانگاه](#cache) +- [رنگها](#range-hashed) +- [\_ساخت مجتمع](#complex-key-hashed) +- [\_پیچید\_چهای پیچیده](#complex-key-cache) +- [شمال اروپا](#ip-trie) + +### تخت {#flat} + +فرهنگ لغت به طور کامل در حافظه در قالب مجموعه تخت ذخیره می شود. چقدر حافظه استفاده از فرهنگ لغت? مقدار متناسب با اندازه بزرگترین کلید است (در فضا استفاده می شود). + +کلید فرهنگ لغت است `UInt64` نوع و ارزش محدود به 500,000 است. اگر یک کلید بزرگتر کشف شده است در هنگام ایجاد فرهنگ لغت, تاتر می اندازد یک استثنا و فرهنگ لغت ایجاد کنید. + +تمام انواع منابع پشتیبانی می شوند. هنگام به روز رسانی, داده ها (از یک فایل و یا از یک جدول) در تمامیت خود را به عنوان خوانده شده. + +این روش بهترین عملکرد را در میان تمام روش های موجود ذخیره سازی فرهنگ لغت فراهم می کند. + +مثال پیکربندی: + +``` xml + + + +``` + +یا + +``` sql +LAYOUT(FLAT()) +``` + +### درهم {#dicts-external_dicts_dict_layout-hashed} + +فرهنگ لغت به طور کامل در حافظه در قالب یک جدول هش ذخیره می شود. فرهنگ لغت می تواند شامل هر تعداد از عناصر با هر شناسه در عمل تعداد کلید ده ها میلیون نفر از اقلام برسد. + +تمام انواع منابع پشتیبانی می شوند. هنگام به روز رسانی, داده ها (از یک فایل و یا از یک جدول) در تمامیت خود را به عنوان خوانده شده. + +مثال پیکربندی: + +``` xml + + + +``` + +یا + +``` sql +LAYOUT(HASHED()) +``` + +### فشردهسازی {#dicts-external_dicts_dict_layout-sparse_hashed} + +مشابه به `hashed`, اما با استفاده از حافظه کمتر به نفع استفاده از پردازنده بیشتر. + +مثال پیکربندی: + +``` xml + + + +``` + +``` sql +LAYOUT(SPARSE_HASHED()) +``` + +### \_ساخت مجتمع {#complex-key-hashed} + +این نوع ذخیره سازی برای استفاده با کامپوزیت است [کلید](external-dicts-dict-structure.md). مشابه به `hashed`. + +مثال پیکربندی: + +``` xml + + + +``` + +``` sql +LAYOUT(COMPLEX_KEY_HASHED()) +``` + +### رنگها {#range-hashed} + +فرهنگ لغت در حافظه به شکل یک جدول هش با مجموعه ای مرتب از محدوده ها و مقادیر مربوطه ذخیره می شود. + +این روش ذخیره سازی کار می کند به همان شیوه به عنوان درهم و اجازه می دهد تا با استفاده از تاریخ/زمان (نوع عددی دلخواه) محدوده علاوه بر کلید. + +مثال: جدول شامل تخفیف برای هر تبلیغ در قالب: + +``` text ++---------|-------------|-------------|------+ +| advertiser id | discount start date | discount end date | amount | ++===============+=====================+===================+========+ +| 123 | 2015-01-01 | 2015-01-15 | 0.15 | ++---------|-------------|-------------|------+ +| 123 | 2015-01-16 | 2015-01-31 | 0.25 | ++---------|-------------|-------------|------+ +| 456 | 2015-01-01 | 2015-01-15 | 0.05 | ++---------|-------------|-------------|------+ +``` + +برای استفاده از یک نمونه برای محدوده تاریخ, تعریف `range_min` و `range_max` عناصر در [ساختار](external-dicts-dict-structure.md). این عناصر باید حاوی عناصر `name` و`type` (اگر `type` مشخص نشده است, نوع پیش فرض استفاده خواهد شد - تاریخ). `type` می تواند هر نوع عددی (تاریخ / DateTime / UInt64 / Int32 / دیگران). + +مثال: + +``` xml + + + Id + + + first + Date + + + last + Date + + ... +``` + +یا + +``` sql +CREATE DICTIONARY somedict ( + id UInt64, + first Date, + last Date +) +PRIMARY KEY id +LAYOUT(RANGE_HASHED()) +RANGE(MIN first MAX last) +``` + +برای کار با این لغت نامه, شما نیاز به تصویب یک استدلال اضافی به `dictGetT` تابع, که یک محدوده انتخاب شده است: + +``` sql +dictGetT('dict_name', 'attr_name', id, date) +``` + +این تابع ارزش برای مشخص گرداند `id`بازدید کنندگان و محدوده تاریخ که شامل تاریخ گذشت. + +اطلاعات از الگوریتم: + +- اگر `id` یافت نشد و یا یک محدوده برای یافت نشد `id` مقدار پیش فرض فرهنگ لغت را برمی گرداند. +- اگر با هم تداخل دارند محدوده وجود دارد, شما می توانید هر استفاده. +- اگر جداساز محدوده باشد `NULL` یا نامعتبر تاریخ (مانند 1900-01-01 یا 2039-01-01) طیف وسیعی است که در سمت چپ باز است. محدوده را می توان در هر دو طرف باز کرد. + +مثال پیکربندی: + +``` xml + + + + ... + + + + + + + + Abcdef + + + StartTimeStamp + UInt64 + + + EndTimeStamp + UInt64 + + + XXXType + String + + + + + + +``` + +یا + +``` sql +CREATE DICTIONARY somedict( + Abcdef UInt64, + StartTimeStamp UInt64, + EndTimeStamp UInt64, + XXXType String DEFAULT '' +) +PRIMARY KEY Abcdef +RANGE(MIN StartTimeStamp MAX EndTimeStamp) +``` + +### نهانگاه {#cache} + +فرهنگ لغت در کش است که تعداد ثابتی از سلول های ذخیره می شود. این سلول ها حاوی عناصر اغلب استفاده می شود. + +هنگام جستجو برای یک فرهنگ لغت کش اول جستجو می شود. برای هر بلوک از داده ها, تمام کلید هایی که در کش یافت نشد و یا منسوخ شده از منبع با استفاده از درخواست `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. داده های دریافت شده است و سپس به کش نوشته شده است. + +برای لغت نامه کش, انقضا [طول عمر](external-dicts-dict-lifetime.md) از داده ها در کش را می توان تنظیم کرد. اگر زمان بیشتری از `lifetime` از زمان بارگذاری داده ها در یک سلول گذشت, ارزش سلول استفاده نمی شود, و دوباره درخواست دفعه بعد که نیاز به استفاده می شود. +این حداقل موثر از تمام راه هایی برای ذخیره لغت نامه است. سرعت کش به شدت در تنظیمات صحیح و سناریوی استفاده بستگی دارد. فرهنگ لغت نوع کش به خوبی انجام تنها زمانی که نرخ ضربه به اندازه کافی بالا هستند (توصیه می شود 99% و بالاتر). شما می توانید میزان ضربه به طور متوسط در مشاهده `system.dictionaries` جدول + +برای بهبود عملکرد کش, استفاده از یک خرده فروشی با `LIMIT`, و پاسخ تابع با فرهنگ لغت خارجی. + +پشتیبانی [منابع](external-dicts-dict-sources.md) پردازشگر پشتیبانی شده: + +مثال تنظیمات: + +``` xml + + + + 1000000000 + + +``` + +یا + +``` sql +LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) +``` + +تنظیم اندازه کش به اندازه کافی بزرگ است. شما نیاز به تجربه برای انتخاب تعدادی از سلول های: + +1. تنظیم برخی از ارزش. +2. نمایش داده شد اجرا تا کش کاملا کامل است. +3. ارزیابی مصرف حافظه با استفاده از `system.dictionaries` جدول +4. افزایش یا کاهش تعداد سلول ها تا زمانی که مصرف حافظه مورد نیاز رسیده است. + +!!! warning "اخطار" + هنوز تاتر به عنوان یک منبع استفاده نمی, چرا که کند است برای پردازش نمایش داده شد با تصادفی می خواند. + +### \_پیچید\_چهای پیچیده {#complex-key-cache} + +این نوع ذخیره سازی برای استفاده با کامپوزیت است [کلید](external-dicts-dict-structure.md). مشابه به `cache`. + +### شمال اروپا {#ip-trie} + +این نوع ذخیره سازی برای پیشوندهای نقشه برداری شبکه (نشانی های اینترنتی) به فراداده مانند ان است. + +مثال: جدول شامل پیشوندهای شبکه و مربوط به خود را به عنوان شماره و کد کشور: + +``` text + +-----------|-----|------+ + | prefix | asn | cca2 | + +=================+=======+========+ + | 202.79.32.0/20 | 17501 | NP | + +-----------|-----|------+ + | 2620:0:870::/48 | 3856 | US | + +-----------|-----|------+ + | 2a02:6b8:1::/48 | 13238 | RU | + +-----------|-----|------+ + | 2001:db8::/32 | 65536 | ZZ | + +-----------|-----|------+ +``` + +هنگام استفاده از این نوع طرح, ساختار باید یک کلید کامپوزیت دارند. + +مثال: + +``` xml + + + + prefix + String + + + + asn + UInt32 + + + + cca2 + String + ?? + + ... +``` + +یا + +``` sql +CREATE DICTIONARY somedict ( + prefix String, + asn UInt32, + cca2 String DEFAULT '??' +) +PRIMARY KEY prefix +``` + +کلید باید تنها یک ویژگی نوع رشته ای داشته باشد که شامل یک پیشوند مجاز است. انواع دیگر هنوز پشتیبانی نمی شوند. + +برای نمایش داده شد, شما باید توابع مشابه استفاده کنید (`dictGetT` با یک تاپل) به لغت نامه ها با کلید های ترکیبی: + +``` sql +dictGetT('dict_name', 'attr_name', tuple(ip)) +``` + +تابع طول می کشد یا `UInt32` برای ایپو4 یا `FixedString(16)` برای IPv6: + +``` sql +dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) +``` + +انواع دیگر هنوز پشتیبانی نمی شوند. تابع ویژگی برای پیشوند که مربوط به این نشانی اینترنتی را برمی گرداند. اگر پیشوند با هم تداخل دارند وجود دارد, یکی از خاص ترین بازگشته است. + +داده ها در یک ذخیره می شود `trie`. این به طور کامل باید به رم مناسب. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md new file mode 100644 index 00000000000..4080580a329 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md @@ -0,0 +1,87 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 42 +toc_title: "\u0628\u0647 \u0631\u0648\u0632 \u0631\u0633\u0627\u0646\u06CC \u0641\u0631\ + \u0647\u0646\u06AF \u0644\u063A\u062A" +--- + +# به روز رسانی فرهنگ لغت {#dictionary-updates} + +خانه کلیک دوره به روز رسانی لغت نامه. فاصله به روز رسانی برای لغت نامه به طور کامل دانلود و فاصله ابطال لغت نامه کش در تعریف `` برچسب در ثانیه. + +به روز رسانی فرهنگ لغت (به غیر از بارگذاری برای استفاده اول) نمایش داده شد را مسدود کند. در طول به روز رسانی, نسخه های قدیمی از یک فرهنگ لغت استفاده شده است. اگر یک خطا در طول به روز رسانی رخ می دهد, خطا به ورود به سیستم سرور نوشته شده, و نمایش داده شد ادامه استفاده از نسخه های قدیمی از لغت نامه. + +مثال تنظیمات: + +``` xml + + ... + 300 + ... + +``` + +``` sql +CREATE DICTIONARY (...) +... +LIFETIME(300) +... +``` + +تنظیم `0` (`LIFETIME(0)`) جلوگیری از لغت نامه از به روز رسانی . + +شما می توانید یک بازه زمانی برای ارتقا تنظیم, و تاتر یک زمان یکنواخت تصادفی در این محدوده را انتخاب کنید. این به منظور توزیع بار بر روی منبع فرهنگ لغت در هنگام به روز رسانی در تعداد زیادی از سرور لازم است. + +مثال تنظیمات: + +``` xml + + ... + + 300 + 360 + + ... + +``` + +یا + +``` sql +LIFETIME(MIN 300 MAX 360) +``` + +هنگام به روز رسانی لغت نامه, سرور کلیک اعمال منطق مختلف بسته به نوع [متن](external-dicts-dict-sources.md): + +- برای یک فایل متنی زمان اصلاح را بررسی می کند. اگر زمان از زمان قبلا ثبت شده متفاوت, فرهنگ لغت به روز شده است. +- برای جداول میثم, زمان اصلاح بررسی می شود با استفاده از یک `SHOW TABLE STATUS` پرس و جو. +- واژهنامهها از منابع دیگر در هر زمان به طور پیش فرض به روز شد. + +برای خروجی زیر (دیگر), ان بی سی و منابع فاحشه خانه, شما می توانید راه اندازی یک پرس و جو است که لغت نامه تنها در صورتی که واقعا تغییر به روز رسانی, به جای هر زمان. برای انجام این کار این مراحل را دنبال کنید: + +- جدول فرهنگ لغت باید یک میدان است که همیشه تغییر زمانی که داده های منبع به روز شده است. +- تنظیمات منبع باید پرس و جو که بازیابی زمینه در حال تغییر را مشخص کنید. سرور کلیک تفسیر نتیجه پرس و جو به عنوان یک ردیف, و اگر این ردیف نسبت به حالت قبلی خود تغییر کرده است, فرهنگ لغت به روز شده است. مشخص کردن پرسوجو در `` درست در تنظیمات برای [متن](external-dicts-dict-sources.md). + +مثال تنظیمات: + +``` xml + + ... + + ... + SELECT update_time FROM dictionary_source where id = 1 + + ... + +``` + +یا + +``` sql +... +SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) +... +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md new file mode 100644 index 00000000000..8a784f4b3e0 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md @@ -0,0 +1,609 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 43 +toc_title: "\u0645\u0646\u0627\u0628\u0639 \u0644\u063A\u062A \u0646\u0627\u0645\u0647\ + \ \u0647\u0627\u06CC \u062E\u0627\u0631\u062C\u06CC" +--- + +# منابع لغت نامه های خارجی {#dicts-external-dicts-dict-sources} + +فرهنگ لغت خارجی را می توان از بسیاری از منابع مختلف متصل می شود. + +اگر فرهنگ لغت پیکربندی شده است با استفاده از فایل های فشرده, پیکربندی به نظر می رسد مثل این: + +``` xml + + + ... + + + + + + ... + + ... + +``` + +در صورت [توصیف](../../statements/create.md#create-dictionary-query), پیکربندی برابر خواهد شد مانند به نظر می رسد: + +``` sql +CREATE DICTIONARY dict_name (...) +... +SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration +... +``` + +منبع در پیکربندی `source` بخش. + +انواع منابع (`source_type`): + +- [پرونده محلی](#dicts-external_dicts_dict_sources-local_file) +- [پرونده اجرایی](#dicts-external_dicts_dict_sources-executable) +- [HTTP(s)](#dicts-external_dicts_dict_sources-http) +- DBMS + - [ODBC](#dicts-external_dicts_dict_sources-odbc) + - [MySQL](#dicts-external_dicts_dict_sources-mysql) + - [فاحشه خانه](#dicts-external_dicts_dict_sources-clickhouse) + - [مانگودیبی](#dicts-external_dicts_dict_sources-mongodb) + - [ردیس](#dicts-external_dicts_dict_sources-redis) + +## پرونده محلی {#dicts-external_dicts_dict_sources-local_file} + +مثال تنظیمات: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + +``` + +یا + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +تنظیم فیلدها: + +- `path` – The absolute path to the file. +- `format` – The file format. All the formats described in “[فرشها](../../../interfaces/formats.md#formats)” پشتیبانی می شوند. + +## پرونده اجرایی {#dicts-external_dicts_dict_sources-executable} + +کار با فایل های اجرایی بستگی دارد [چگونه فرهنگ لغت در حافظه ذخیره می شود](external-dicts-dict-layout.md). اگر فرهنگ لغت با استفاده از ذخیره می شود `cache` و `complex_key_cache` کلیک هاوس کلید های لازم را با ارسال درخواست به فایل اجرایی درخواست می کند. در غیر این صورت, تاتر شروع می شود فایل اجرایی و خروجی خود را به عنوان داده فرهنگ لغت رفتار. + +مثال تنظیمات: + +``` xml + + + cat /opt/dictionaries/os.tsv + TabSeparated + + +``` + +یا + +``` sql +SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +تنظیم فیلدها: + +- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). +- `format` – The file format. All the formats described in “[فرشها](../../../interfaces/formats.md#formats)” پشتیبانی می شوند. + +## قام) {#dicts-external_dicts_dict_sources-http} + +کار با سرور اچ تی پی بستگی دارد [چگونه فرهنگ لغت در حافظه ذخیره می شود](external-dicts-dict-layout.md). اگر فرهنگ لغت با استفاده از ذخیره می شود `cache` و `complex_key_cache`, کلیک درخواست کلید های لازم با ارسال یک درخواست از طریق `POST` روش. + +مثال تنظیمات: + +``` xml + + + http://[::1]/os.tsv + TabSeparated + + user + password + + +
+ API-KEY + key +
+
+
+ +``` + +یا + +``` sql +SOURCE(HTTP( + url 'http://[::1]/os.tsv' + format 'TabSeparated' + credentials(user 'user' password 'password') + headers(header(name 'API-KEY' value 'key')) +)) +``` + +برای دسترسی به یک منبع اچ تی پی باید از اینجا کلیک کنید [پیکربندی اپنسسل](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-openssl) در پیکربندی سرور. + +تنظیم فیلدها: + +- `url` – The source URL. +- `format` – The file format. All the formats described in “[فرشها](../../../interfaces/formats.md#formats)” پشتیبانی می شوند. +- `credentials` – Basic HTTP authentication. Optional parameter. + - `user` – Username required for the authentication. + - `password` – Password required for the authentication. +- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. + - `header` – Single HTTP header entry. + - `name` – Identifiant name used for the header send on the request. + - `value` – Value set for a specific identifiant name. + +## ODBC {#dicts-external_dicts_dict_sources-odbc} + +شما می توانید از این روش برای اتصال هر پایگاه داده است که یک راننده بی سی استفاده کنید. + +مثال تنظیمات: + +``` xml + + + DatabaseName + ShemaName.TableName
+ DSN=some_parameters + SQL_QUERY +
+ +``` + +یا + +``` sql +SOURCE(ODBC( + db 'DatabaseName' + table 'SchemaName.TableName' + connection_string 'DSN=some_parameters' + invalidate_query 'SQL_QUERY' +)) +``` + +تنظیم فیلدها: + +- `db` – Name of the database. Omit it if the database name is set in the `` پارامترها +- `table` – Name of the table and schema if exists. +- `connection_string` – Connection string. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [بهروزرسانی واژهنامهها](external-dicts-dict-lifetime.md). + +تاتر دریافت به نقل از علامت از او بی سی راننده و نقل قول تمام تنظیمات در نمایش داده شد به راننده, بنابراین لازم است به مجموعه ای از نام جدول بر این اساس به نام جدول مورد در پایگاه داده. + +اگر شما یک مشکل با کدگذاریها در هنگام استفاده از اوراکل, دیدن مربوطه [FAQ](../../../faq/general.md#oracle-odbc-encodings) مقاله. + +### قابلیت پذیری شناخته شده از قابلیت او بی سی فرهنگ لغت {#known-vulnerability-of-the-odbc-dictionary-functionality} + +!!! attention "توجه" + هنگام اتصال به پایگاه داده از طریق پارامتر اتصال درایور او بی سی `Servername` می تواند جایگزین شود. در این مورد ارزش `USERNAME` و `PASSWORD` از `odbc.ini` به سرور از راه دور ارسال می شود و می تواند به خطر بیافتد. + +**نمونه ای از استفاده نا امن** + +اجازه می دهد تا پیکربندی unixodbc برای postgresql. محتوای `/etc/odbc.ini`: + +``` text +[gregtest] +Driver = /usr/lib/psqlodbca.so +Servername = localhost +PORT = 5432 +DATABASE = test_db +#OPTION = 3 +USERNAME = test +PASSWORD = test +``` + +اگر شما پس از ایجاد یک پرس و جو مانند + +``` sql +SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); +``` + +درایور او بی سی خواهد ارزش ارسال `USERNAME` و `PASSWORD` از `odbc.ini` به `some-server.com`. + +### به عنوان مثال از اتصال شل {#example-of-connecting-postgresql} + +سیستم عامل اوبونتو. + +نصب unixodbc و odbc driver for postgresql: + +``` bash +$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql +``` + +پیکربندی `/etc/odbc.ini` (یا `~/.odbc.ini`): + +``` text + [DEFAULT] + Driver = myconnection + + [myconnection] + Description = PostgreSQL connection to my_db + Driver = PostgreSQL Unicode + Database = my_db + Servername = 127.0.0.1 + UserName = username + Password = password + Port = 5432 + Protocol = 9.3 + ReadOnly = No + RowVersioning = No + ShowSystemTables = No + ConnSettings = +``` + +پیکربندی فرهنگ لغت در کلیک: + +``` xml + + + table_name + + + + + DSN=myconnection + postgresql_table
+
+ + + 300 + 360 + + + + + + + id + + + some_column + UInt64 + 0 + + +
+
+``` + +یا + +``` sql +CREATE DICTIONARY table_name ( + id UInt64, + some_column UInt64 DEFAULT 0 +) +PRIMARY KEY id +SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) +LAYOUT(HASHED()) +LIFETIME(MIN 300 MAX 360) +``` + +شما ممکن است نیاز به ویرایش `odbc.ini` برای مشخص کردن مسیر کامل به کتابخانه با راننده `DRIVER=/usr/local/lib/psqlodbcw.so`. + +### به عنوان مثال اتصال سرور کارشناسی ارشد گذاشتن {#example-of-connecting-ms-sql-server} + +سیستم عامل اوبونتو. + +نصب درایور: : + +``` bash +$ sudo apt-get install tdsodbc freetds-bin sqsh +``` + +پیکربندی راننده: + +``` bash + $ cat /etc/freetds/freetds.conf + ... + + [MSSQL] + host = 192.168.56.101 + port = 1433 + tds version = 7.0 + client charset = UTF-8 + + $ cat /etc/odbcinst.ini + ... + + [FreeTDS] + Description = FreeTDS + Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so + Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so + FileUsage = 1 + UsageCount = 5 + + $ cat ~/.odbc.ini + ... + + [MSSQL] + Description = FreeTDS + Driver = FreeTDS + Servername = MSSQL + Database = test + UID = test + PWD = test + Port = 1433 +``` + +پیکربندی فرهنگ لغت در کلیک: + +``` xml + + + test + + + dict
+ DSN=MSSQL;UID=test;PWD=test +
+ + + + 300 + 360 + + + + + + + + + k + + + s + String + + + +
+
+``` + +یا + +``` sql +CREATE DICTIONARY test ( + k UInt64, + s String DEFAULT '' +) +PRIMARY KEY k +SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) +LAYOUT(FLAT()) +LIFETIME(MIN 300 MAX 360) +``` + +## DBMS {#dbms} + +### Mysql {#dicts-external_dicts_dict_sources-mysql} + +مثال تنظیمات: + +``` xml + + + 3306 + clickhouse + qwerty + + example01-1 + 1 + + + example01-2 + 1 + + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +یا + +``` sql +SOURCE(MYSQL( + port 3306 + user 'clickhouse' + password 'qwerty' + replica(host 'example01-1' priority 1) + replica(host 'example01-2' priority 1) + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +تنظیم فیلدها: + +- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). + +- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `replica` – Section of replica configurations. There can be multiple sections. + + - `replica/host` – The MySQL host. + - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. + +- `db` – Name of the database. + +- `table` – Name of the table. + +- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` بند در خروجی زیر, مثلا, `id > 10 AND id < 20`. پارامتر اختیاری. + +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [بهروزرسانی واژهنامهها](external-dicts-dict-lifetime.md). + +خروجی زیر را می توان در یک میزبان محلی از طریق سوکت متصل. برای انجام این کار, تنظیم `host` و `socket`. + +مثال تنظیمات: + +``` xml + + + localhost + /path/to/socket/file.sock + clickhouse + qwerty + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +یا + +``` sql +SOURCE(MYSQL( + host 'localhost' + socket '/path/to/socket/file.sock' + user 'clickhouse' + password 'qwerty' + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +### فاحشه خانه {#dicts-external_dicts_dict_sources-clickhouse} + +مثال تنظیمات: + +``` xml + + + example01-01-1 + 9000 + default + + default + ids
+ id=10 +
+ +``` + +یا + +``` sql +SOURCE(CLICKHOUSE( + host 'example01-01-1' + port 9000 + user 'default' + password '' + db 'default' + table 'ids' + where 'id=10' +)) +``` + +تنظیم فیلدها: + +- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [توزیع شده](../../../engines/table-engines/special/distributed.md) جدول و در تنظیمات بعدی وارد کنید. +- `port` – The port on the ClickHouse server. +- `user` – Name of the ClickHouse user. +- `password` – Password of the ClickHouse user. +- `db` – Name of the database. +- `table` – Name of the table. +- `where` – The selection criteria. May be omitted. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [بهروزرسانی واژهنامهها](external-dicts-dict-lifetime.md). + +### مانگودیبی {#dicts-external_dicts_dict_sources-mongodb} + +مثال تنظیمات: + +``` xml + + + localhost + 27017 + + + test + dictionary_source + + +``` + +یا + +``` sql +SOURCE(MONGO( + host 'localhost' + port 27017 + user '' + password '' + db 'test' + collection 'dictionary_source' +)) +``` + +تنظیم فیلدها: + +- `host` – The MongoDB host. +- `port` – The port on the MongoDB server. +- `user` – Name of the MongoDB user. +- `password` – Password of the MongoDB user. +- `db` – Name of the database. +- `collection` – Name of the collection. + +### ردیس {#dicts-external_dicts_dict_sources-redis} + +مثال تنظیمات: + +``` xml + + + localhost + 6379 + simple + 0 + + +``` + +یا + +``` sql +SOURCE(REDIS( + host 'localhost' + port 6379 + storage_type 'simple' + db_index 0 +)) +``` + +تنظیم فیلدها: + +- `host` – The Redis host. +- `port` – The port on the Redis server. +- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` برای منابع ساده و برای منابع تک کلیدی درهم, `hash_map` برای منابع درهم با دو کلید. منابع در بازه زمانی و منابع کش با کلید پیچیده پشتیبانی نشده است. ممکن است حذف شود, مقدار پیش فرض است `simple`. +- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md new file mode 100644 index 00000000000..c952372656d --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md @@ -0,0 +1,176 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 44 +toc_title: "\u06A9\u0644\u06CC\u062F \u0641\u0631\u0647\u0646\u06AF \u0644\u063A\u062A\ + \ \u0648 \u0632\u0645\u06CC\u0646\u0647 \u0647\u0627\u06CC" +--- + +# کلید فرهنگ لغت و زمینه های {#dictionary-key-and-fields} + +این `` بند توصیف کلید فرهنگ لغت و زمینه های موجود برای نمایش داده شد. + +توصیف: + +``` xml + + + + Id + + + + + + + ... + + + +``` + +صفات در عناصر شرح داده شده است: + +- `` — [ستون کلید](external-dicts-dict-structure.md#ext_dict_structure-key). +- `` — [ستون داده](external-dicts-dict-structure.md#ext_dict_structure-attributes). می تواند تعدادی از ویژگی های وجود دارد. + +پرسوجو: + +``` sql +CREATE DICTIONARY dict_name ( + Id UInt64, + -- attributes +) +PRIMARY KEY Id +... +``` + +صفات در بدن پرس و جو توصیف: + +- `PRIMARY KEY` — [ستون کلید](external-dicts-dict-structure.md#ext_dict_structure-key) +- `AttrName AttrType` — [ستون داده](external-dicts-dict-structure.md#ext_dict_structure-attributes). می تواند تعدادی از ویژگی های وجود دارد. + +## کلید {#ext_dict_structure-key} + +تاتر از انواع زیر از کلید: + +- کلید عددی. `UInt64`. تعریف شده در `` برچسب یا استفاده `PRIMARY KEY` کلمه کلیدی. +- کلید کامپوزیت. مجموعه ای از مقادیر از انواع مختلف. تعریف شده در برچسب `` یا `PRIMARY KEY` کلمه کلیدی. + +یک ساختار میلی لیتر می تواند شامل موارد زیر باشد `` یا ``. دی ال پرس و جو باید شامل تک `PRIMARY KEY`. + +!!! warning "اخطار" + شما باید کلید به عنوان یک ویژگی توصیف نیست. + +### کلید عددی {#ext_dict-numeric-key} + +نوع: `UInt64`. + +مثال پیکربندی: + +``` xml + + Id + +``` + +حوزههای پیکربندی: + +- `name` – The name of the column with keys. + +برای & پرسوجو: + +``` sql +CREATE DICTIONARY ( + Id UInt64, + ... +) +PRIMARY KEY Id +... +``` + +- `PRIMARY KEY` – The name of the column with keys. + +### کلید کامپوزیت {#composite-key} + +کلید می تواند یک `tuple` از هر نوع زمینه. این [طرحبندی](external-dicts-dict-layout.md) در این مورد باید باشد `complex_key_hashed` یا `complex_key_cache`. + +!!! tip "نکته" + کلید کامپوزیت می تواند از یک عنصر واحد تشکیل شده است. این امکان استفاده از یک رشته به عنوان کلید, برای مثال. + +ساختار کلیدی در عنصر تنظیم شده است ``. زمینه های کلیدی در قالب همان فرهنگ لغت مشخص شده است [خصیصهها](external-dicts-dict-structure.md). مثال: + +``` xml + + + + field1 + String + + + field2 + UInt32 + + ... + +... +``` + +یا + +``` sql +CREATE DICTIONARY ( + field1 String, + field2 String + ... +) +PRIMARY KEY field1, field2 +... +``` + +برای پرس و جو به `dictGet*` تابع, یک تاپل به عنوان کلید به تصویب رسید. مثال: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. + +## خصیصهها {#ext_dict_structure-attributes} + +مثال پیکربندی: + +``` xml + + ... + + Name + ClickHouseDataType + + rand64() + true + true + true + + +``` + +یا + +``` sql +CREATE DICTIONARY somename ( + Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID +) +``` + +حوزههای پیکربندی: + +| برچسب | توصیف | مورد نیاز | +|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| +| `name` | نام ستون. | بله | +| `type` | نوع داده کلیک.
تاتر تلاش می کند به بازیگران ارزش از فرهنگ لغت به نوع داده مشخص شده است. مثلا, برای خروجی زیر, زمینه ممکن است `TEXT`, `VARCHAR` یا `BLOB` در جدول منبع خروجی زیر, اما می تواند به عنوان ارسال `String` در فاحشه خانه.
[Nullable](../../../sql-reference/data-types/nullable.md) پشتیبانی نمی شود. | بله | +| `null_value` | مقدار پیش فرض برای یک عنصر غیر موجود.
در مثال این یک رشته خالی است. شما نمی توانید استفاده کنید `NULL` در این زمینه. | بله | +| `expression` | [عبارت](../../syntax.md#syntax-expressions) که فاحشه خانه اجرا در ارزش.
بیان می تواند یک نام ستون در پایگاه داده از راه دور گذاشتن. بدین ترتیب, شما می توانید برای ایجاد یک نام مستعار برای ستون از راه دور استفاده.

مقدار پیش فرض: بدون بیان. | نه | +| `hierarchical` | اگر `true`, ویژگی شامل ارزش یک کلید پدر و مادر برای کلید فعلی. ببینید [لغتنامهها سلسله مراتبی](external-dicts-dict-hierarchical.md).

مقدار پیشفرض: `false`. | نه | +| `injective` | پرچمی که نشان میدهد چه `id -> attribute` تصویر [تزریق](https://en.wikipedia.org/wiki/Injective_function).
اگر `true`, کلیک خانه به طور خودکار می تواند پس از محل `GROUP BY` بند درخواست به لغت نامه با تزریق. معمولا به طور قابل توجهی میزان چنین درخواست را کاهش می دهد.

مقدار پیشفرض: `false`. | نه | +| `is_object_id` | پرچمی که نشان میدهد پرسوجو برای سند مانگودیبی اجرا شده است `ObjectID`.

مقدار پیشفرض: `false`. | نه | + +## همچنین نگاه کنید به {#see-also} + +- [توابع برای کار با لغت نامه های خارجی](../../../sql-reference/functions/ext-dict-functions.md). + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md new file mode 100644 index 00000000000..96aee6503e8 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md @@ -0,0 +1,54 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u067E\u06CC\u06A9\u0631\u0628\u0646\u062F\u06CC \u06CC\u06A9 \u0641\u0631\ + \u0647\u0646\u06AF \u0644\u063A\u062A \u062E\u0627\u0631\u062C\u06CC" +--- + +# پیکربندی یک فرهنگ لغت خارجی {#dicts-external-dicts-dict} + +اگر فرهنگ لغت با استفاده از فایل میلی لیتر پیکربندی, از پیکربندی فرهنگ لغت دارای ساختار زیر: + +``` xml + + dict_name + + + + + + + + + + + + + + + + + +``` + +متناظر [توصیف](../../statements/create.md#create-dictionary-query) دارای ساختار زیر است: + +``` sql +CREATE DICTIONARY dict_name +( + ... -- attributes +) +PRIMARY KEY ... -- complex or single key configuration +SOURCE(...) -- Source configuration +LAYOUT(...) -- Memory layout configuration +LIFETIME(...) -- Lifetime of dictionary in memory +``` + +- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. +- [متن](external-dicts-dict-sources.md) — Source of the dictionary. +- [طرحبندی](external-dicts-dict-layout.md) — Dictionary layout in memory. +- [ساختار](external-dicts-dict-structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. +- [طول عمر](external-dicts-dict-lifetime.md) — Frequency of dictionary updates. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts.md new file mode 100644 index 00000000000..75ee505e630 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/external-dictionaries/external-dicts.md @@ -0,0 +1,56 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u062A\u0648\u0636\u06CC\u062D\u0627\u062A \u06A9\u0644\u06CC" +--- + +# واژهنامهها خارجی {#dicts-external-dicts} + +شما می توانید لغت نامه خود را از منابع داده های مختلف اضافه کنید. منبع داده برای یک فرهنگ لغت می تواند یک متن محلی و یا فایل اجرایی, یک منبع اچتیتیپی(بازدید کنندگان), یا سندرم داون دیگر. برای کسب اطلاعات بیشتر, دیدن “[منابع لغت نامه های خارجی](external-dicts-dict-sources.md)”. + +فاحشه خانه: + +- به طور کامل و یا تا حدی فروشگاه لغت نامه در رم. +- دوره به روز رسانی لغت نامه ها و به صورت پویا بارهای ارزش از دست رفته. به عبارت دیگر, لغت نامه را می توان به صورت پویا لود. +- اجازه می دهد تا برای ایجاد لغت نامه های خارجی با فایل های میلی لیتر و یا [نمایش داده شد](../../statements/create.md#create-dictionary-query). + +پیکربندی لغت نامه های خارجی را می توان در یک یا چند میلی لیتر فایل واقع شده است. مسیر پیکربندی در مشخص [دیکشنامهای](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_config) پارامتر. + +واژهنامهها را می توان در هنگام راه اندازی سرور و یا در اولین استفاده لود, بسته به [\_بارگیری کامل](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) تنظیمات. + +فایل پیکربندی فرهنگ لغت دارای فرمت زیر است: + +``` xml + + An optional element with any content. Ignored by the ClickHouse server. + + + /etc/metrika.xml + + + + + + + + +``` + +شما می توانید [پیکربندی](external-dicts-dict.md) هر تعداد از لغت نامه ها در همان فایل. + +[نمایش داده شد دی ال برای لغت نامه](../../statements/create.md#create-dictionary-query) هیچ پرونده اضافی در پیکربندی سرور نیاز ندارد. اجازه می دهد برای کار با لغت نامه به عنوان نهادهای طبقه اول, مانند جداول و یا دیدگاه. + +!!! attention "توجه" + شما می توانید مقادیر را برای یک فرهنگ لغت کوچک با توصیف در یک تبدیل کنید `SELECT` پرسوجو (نگاه کنید به [تبدیل](../../../sql-reference/functions/other-functions.md) تابع). این قابلیت به لغت نامه های خارجی مربوط نیست. + +## همچنین نگاه کنید به {#ext-dicts-see-also} + +- [پیکربندی یک فرهنگ لغت خارجی](external-dicts-dict.md) +- [ذخیره واژهنامهها در حافظه](external-dicts-dict-layout.md) +- [به روز رسانی فرهنگ لغت](external-dicts-dict-lifetime.md) +- [منابع لغت نامه های خارجی](external-dicts-dict-sources.md) +- [کلید فرهنگ لغت و زمینه های](external-dicts-dict-structure.md) +- [توابع برای کار با لغت نامه های خارجی](../../../sql-reference/functions/ext-dict-functions.md) + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/index.md b/docs/fa/sql-reference/dictionaries/external-dictionaries/index.md similarity index 100% rename from docs/fa/sql_reference/dictionaries/external_dictionaries/index.md rename to docs/fa/sql-reference/dictionaries/external-dictionaries/index.md diff --git a/docs/fa/sql-reference/dictionaries/index.md b/docs/fa/sql-reference/dictionaries/index.md new file mode 100644 index 00000000000..7d76ccc94e0 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Dictionaries +toc_priority: 35 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# واژهنامهها {#dictionaries} + +فرهنگ لغت نقشه برداری است (`key -> attributes`) که مناسب برای انواع مختلفی از لیست مرجع است. + +تاتر پشتیبانی از توابع خاص برای کار با لغت نامه است که می تواند در نمایش داده شد استفاده می شود. این ساده تر و موثر تر به استفاده از لغت نامه ها با توابع از یک است `JOIN` با جداول مرجع. + +[NULL](../syntax.md#null) ارزش ها را نمی توان در یک فرهنگ لغت ذخیره کرد. + +پشتیبانی از کلیک: + +- [ساخته شده در لغت نامه](internal-dicts.md#internal_dicts) با یک خاص [مجموعه ای از توابع](../../sql-reference/functions/ym-dict-functions.md). +- [افزونه لغت نامه (خارجی)](external-dictionaries/external-dicts.md) با یک [خالص توابع](../../sql-reference/functions/ext-dict-functions.md). + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/fa/sql-reference/dictionaries/internal-dicts.md b/docs/fa/sql-reference/dictionaries/internal-dicts.md new file mode 100644 index 00000000000..33700b53f64 --- /dev/null +++ b/docs/fa/sql-reference/dictionaries/internal-dicts.md @@ -0,0 +1,56 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u0648\u0627\u0698\u0647\u0646\u0627\u0645\u0647\u0647\u0627 \u062F\u0627\ + \u062E\u0644\u06CC" +--- + +# واژهنامهها داخلی {#internal_dicts} + +ClickHouse شامل ساخته شده است در ویژگی برای کار با یک geobase. + +این اجازه می دهد تا شما را به: + +- استفاده از شناسه یک منطقه به نام خود را در زبان مورد نظر. +- استفاده از یک منطقه شناسه برای دریافت شناسه شهر منطقه فدرال منطقه کشور یا قاره. +- بررسی کنید که یک منطقه بخشی از یک منطقه دیگر است. +- دریافت زنجیره ای از مناطق پدر و مادر. + +تمام توابع پشتیبانی “translocality,” توانایی به طور همزمان استفاده از دیدگاه های مختلف در مالکیت منطقه. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “Functions for working with Yandex.Metrica dictionaries”. + +واژهنامهها داخلی در بسته به طور پیش فرض غیر فعال. +برای فعال کردن پارامترها `path_to_regions_hierarchy_file` و `path_to_regions_names_files` در فایل پیکربندی سرور. + +پایگاه داده از فایل های متنی لود می شود. + +محل `regions_hierarchy*.txt` فایل ها به `path_to_regions_hierarchy_file` فهرست راهنما. این پارامتر پیکربندی باید مسیر را به `regions_hierarchy.txt` فایل (سلسله مراتب منطقه ای پیش فرض) و فایل های دیگر (`regions_hierarchy_ua.txt`) باید در همان دایرکتوری واقع شده است. + +قرار دادن `regions_names_*.txt` فایل ها در `path_to_regions_names_files` فهرست راهنما. + +شما همچنین می توانید این فایل ها خود را ایجاد کنید. فرمت فایل به شرح زیر است: + +`regions_hierarchy*.txt`: ستون (بدون هدر): + +- شناسه منطقه (`UInt32`) +- شناسه منطقه والد (`UInt32`) +- نوع منطقه (`UInt8`): 1 - قاره, 3 - کشور, 4 - منطقه فدرال, 5 - منطقه, 6-شهرستان; انواع دیگر ارزش ندارد +- جمعیت (`UInt32`) — optional column + +`regions_names_*.txt`: ستون (بدون هدر): + +- شناسه منطقه (`UInt32`) +- نام منطقه (`String`) — Can’t contain tabs or line feeds, even escaped ones. + +مجموعه تخت برای ذخیره سازی در رم استفاده می شود. به همین دلیل شناسه نباید بیش از یک میلیون. + +واژهنامهها را می توان بدون راه اندازی مجدد سرور به روز شد. با این حال, مجموعه ای از لغت نامه های موجود به روز نمی. +برای به روز رسانی بار اصلاح فایل بررسی می شود. اگر یک فایل تغییر کرده است, فرهنگ لغت به روز شده است. +فاصله برای بررسی تغییرات در پیکربندی `builtin_dictionaries_reload_interval` پارامتر. +به روز رسانی فرهنگ لغت (به غیر از بارگذاری در اولین استفاده) نمایش داده شد را مسدود کند. در طول به روز رسانی, نمایش داده شد با استفاده از نسخه های قدیمی از لغت نامه. اگر یک خطا در طول به روز رسانی رخ می دهد, خطا به ورود به سیستم سرور نوشته شده, و نمایش داده شد ادامه استفاده از نسخه های قدیمی از لغت نامه. + +ما توصیه می کنیم دوره به روز رسانی لغت نامه با پایگاه داده. در طول به روز رسانی, تولید فایل های جدید و ارسال به یک مکان جداگانه. وقتی همه چیز اماده است فایل های مورد استفاده توسط سرور را تغییر دهید. + +همچنین توابع برای کار با شناسه های سیستم عامل و یاندکس وجود دارد.موتورهای جستجو متریکا, اما نباید استفاده شود. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/fa/sql_reference/functions/arithmetic_functions.md b/docs/fa/sql-reference/functions/arithmetic-functions.md similarity index 100% rename from docs/fa/sql_reference/functions/arithmetic_functions.md rename to docs/fa/sql-reference/functions/arithmetic-functions.md diff --git a/docs/fa/sql-reference/functions/array-functions.md b/docs/fa/sql-reference/functions/array-functions.md new file mode 100644 index 00000000000..57225333617 --- /dev/null +++ b/docs/fa/sql-reference/functions/array-functions.md @@ -0,0 +1,1057 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 46 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0627\u0631\u0631\u06CC\u0633" +--- + +# توابع برای کار با ارریس {#functions-for-working-with-arrays} + +## خالی {#function-empty} + +بازده 1 برای یک مجموعه خالی, یا 0 برای یک مجموعه غیر خالی. +نتیجه این نوع uint8. +این تابع نیز برای رشته کار می کند. + +## notEmpty {#function-notempty} + +بازده 0 برای یک مجموعه خالی, یا 1 برای یک مجموعه غیر خالی. +نتیجه این نوع uint8. +این تابع نیز برای رشته کار می کند. + +## طول {#array_functions-length} + +بازگرداندن تعداد اقلام در مجموعه. +نتیجه این نوع uint64. +این تابع نیز برای رشته کار می کند. + +## emptyArrayUInt8, emptyArrayUInt16, emptyArrayUInt32, emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} + +## emptyArrayInt8, emptyArrayInt16, emptyArrayInt32, emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} + +## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} + +## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} + +## تخت خواب {#emptyarraystring} + +قبول صفر استدلال و مجموعه ای خالی از نوع مناسب را برمی گرداند. + +## خالی {#emptyarraytosingle} + +یک مجموعه خالی را می پذیرد و یک مجموعه یک عنصر را که برابر با مقدار پیش فرض است باز می گرداند. + +## محدوده( پایان), دامنه (شروع, پایان \[, گام\]) {#rangeend-rangestart-end-step} + +بازگرداندن مجموعه ای از اعداد از ابتدا تا انتها-1 به گام. +اگر استدلال `start` مشخص نشده است, به طور پیش فرض به 0. +اگر استدلال `step` مشخص نشده است, به طور پیش فرض به 1. +این رفتار تقریبا مانند پیتون `range`. اما تفاوت این است که همه نوع استدلال باید باشد `UInt` اعداد. +فقط در مورد, یک استثنا پرتاب می شود اگر ارریس با طول کل بیش از 100,000,000 عناصر در یک بلوک داده ها ایجاد. + +## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} + +ایجاد مجموعه ای از استدلال تابع. +استدلال باید ثابت باشد و انواع که کوچکترین نوع رایج. حداقل یک استدلال باید تصویب شود, چرا که در غیر این صورت مشخص نیست که چه نوع از مجموعه ای برای ایجاد. به این معنا که شما نمی توانید از این تابع برای ایجاد یک مجموعه خالی استفاده کنید (برای انجام این کار از ‘emptyArray\*’ تابع در بالا توضیح داده شد). +بازگشت یک ‘Array(T)’ نوع نتیجه, جایی که ‘T’ کوچکترین نوع رایج از استدلال گذشت. + +## موافقم {#arrayconcat} + +ترکیبی از ارریس به عنوان استدلال گذشت. + +``` sql +arrayConcat(arrays) +``` + +**پارامترها** + +- `arrays` – Arbitrary number of arguments of [& حذف](../../sql-reference/data-types/array.md) نوع. + **مثال** + + + +``` sql +SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,3,4,5,6] │ +└───────────────┘ +``` + +## هشدار داده می شود\] {#arrayelementarr-n-operator-arrn} + +عنصر را با شاخص دریافت کنید `n` از مجموعه `arr`. `n` باید هر نوع عدد صحیح باشد. +شاخص ها در مجموعه ای از یک شروع می شوند. +شاخص های منفی پشتیبانی می شوند. در این مورد آن را انتخاب می کند که عنصر مربوطه شماره از پایان. به عنوان مثال, `arr[-1]` اخرین وسیله ست + +اگر شاخص می افتد در خارج از مرزهای مجموعه, این گرداند برخی از مقدار پیش فرض (0 برای اعداد, یک رشته خالی برای رشته, و غیره.), به جز برای مورد با یک مجموعه غیر ثابت و یک شاخص ثابت 0 (در این مورد وجود خواهد داشت یک خطا `Array indices are 1-based`). + +## است (ورود, علم) {#hasarr-elem} + +بررسی اینکه ‘arr’ اری ‘elem’ عنصر. +بازده 0 اگر عنصر در مجموعه نیست, یا 1 اگر. + +`NULL` به عنوان یک ارزش پردازش شده است. + +``` sql +SELECT has([1, 2, NULL], NULL) +``` + +``` text +┌─has([1, 2, NULL], NULL)─┐ +│ 1 │ +└─────────────────────────┘ +``` + +## حصال {#hasall} + +بررسی اینکه یک مجموعه زیر مجموعه دیگری باشد. + +``` sql +hasAll(set, subset) +``` + +**پارامترها** + +- `set` – Array of any type with a set of elements. +- `subset` – Array of any type with elements that should be tested to be a subset of `set`. + +**مقادیر بازگشتی** + +- `1` اگر `set` شامل تمام عناصر از `subset`. +- `0` وگرنه + +**خواص عجیب و غریب** + +- مجموعه خالی زیر مجموعه ای از هر است. +- `Null` پردازش به عنوان یک ارزش. +- منظور از ارزش ها در هر دو ارریس مهم نیست. + +**مثالها** + +`SELECT hasAll([], [])` بازده 1. + +`SELECT hasAll([1, Null], [Null])` بازده 1. + +`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` بازده 1. + +`SELECT hasAll(['a', 'b'], ['a'])` بازده 1. + +`SELECT hasAll([1], ['a'])` بازده 0. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` بازده 0. + +## hasAny {#hasany} + +بررسی اینکه دو بند چهار راه توسط برخی از عناصر. + +``` sql +hasAny(array1, array2) +``` + +**پارامترها** + +- `array1` – Array of any type with a set of elements. +- `array2` – Array of any type with a set of elements. + +**بازگشت ارزش** + +- `1` اگر `array1` و `array2` حداقل یک عنصر مشابه داشته باشید. +- `0` وگرنه + +**خواص عجیب و غریب** + +- `Null` پردازش به عنوان یک ارزش. +- منظور از ارزش ها در هر دو ارریس مهم نیست. + +**مثالها** + +`SELECT hasAny([1], [])` بازگشت `0`. + +`SELECT hasAny([Null], [Null, 1])` بازگشت `1`. + +`SELECT hasAny([-128, 1., 512], [1])` بازگشت `1`. + +`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` بازگشت `0`. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` بازگشت `1`. + +## هشدار داده می شود) {#indexofarr-x} + +بازگرداندن شاخص از اولین ‘x’ عنصر (با شروع از 1) اگر در مجموعه ای است, یا 0 اگر نیست. + +مثال: + +``` sql +SELECT indexOf([1, 3, NULL, NULL], NULL) +``` + +``` text +┌─indexOf([1, 3, NULL, NULL], NULL)─┐ +│ 3 │ +└───────────────────────────────────┘ +``` + +عناصر را به `NULL` به عنوان مقادیر طبیعی انجام می شود. + +## هشدار داده می شود) {#countequalarr-x} + +بازده تعداد عناصر موجود در آرایه برابر با x. معادل arraycount (elem -\> elem = x arr). + +`NULL` عناصر به عنوان مقادیر جداگانه به کار گرفته. + +مثال: + +``` sql +SELECT countEqual([1, 2, NULL, NULL], NULL) +``` + +``` text +┌─countEqual([1, 2, NULL, NULL], NULL)─┐ +│ 2 │ +└──────────────────────────────────────┘ +``` + +## هشدار داده می شود) {#array_functions-arrayenumerate} + +Returns the array \[1, 2, 3, …, length (arr) \] + +این تابع به طور معمول با مجموعه ای استفاده می شود. این اجازه می دهد شمارش چیزی فقط یک بار برای هر مجموعه پس از استفاده از مجموعه پیوستن. مثال: + +``` sql +SELECT + count() AS Reaches, + countIf(num = 1) AS Hits +FROM test.hits +ARRAY JOIN + GoalsReached, + arrayEnumerate(GoalsReached) AS num +WHERE CounterID = 160656 +LIMIT 10 +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +در این مثال, می رسد تعداد تبدیل است (رشته دریافت پس از استفاده از مجموعه ملحق), و بازدید تعداد بازدید صفحات (رشته قبل از مجموعه ملحق). در این مورد خاص شما می توانید همان نتیجه را در یک راه ساده تر: + +``` sql +SELECT + sum(length(GoalsReached)) AS Reaches, + count() AS Hits +FROM test.hits +WHERE (CounterID = 160656) AND notEmpty(GoalsReached) +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +این تابع همچنین می توانید در توابع مرتبه بالاتر استفاده می شود. برای مثال می توانید از شاخص های مجموعه ای برای عناصری که با شرایط مطابقت دارند استفاده کنید. + +## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} + +بازگرداندن مجموعه ای به همان اندازه به عنوان مجموعه منبع, نشان می دهد برای هر عنصر چه موقعیت خود را در میان عناصر با همان مقدار. +به عنوان مثال: ارریینومراتونیک(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. + +این تابع در هنگام استفاده از مجموعه ای پیوستن و تجمع عناصر مجموعه ای مفید است. +مثال: + +``` sql +SELECT + Goals.ID AS GoalID, + sum(Sign) AS Reaches, + sumIf(Sign, num = 1) AS Visits +FROM test.visits +ARRAY JOIN + Goals, + arrayEnumerateUniq(Goals.ID) AS num +WHERE CounterID = 160656 +GROUP BY GoalID +ORDER BY Reaches DESC +LIMIT 10 +``` + +``` text +┌──GoalID─┬─Reaches─┬─Visits─┐ +│ 53225 │ 3214 │ 1097 │ +│ 2825062 │ 3188 │ 1097 │ +│ 56600 │ 2803 │ 488 │ +│ 1989037 │ 2401 │ 365 │ +│ 2830064 │ 2396 │ 910 │ +│ 1113562 │ 2372 │ 373 │ +│ 3270895 │ 2262 │ 812 │ +│ 1084657 │ 2262 │ 345 │ +│ 56599 │ 2260 │ 799 │ +│ 3271094 │ 2256 │ 812 │ +└─────────┴─────────┴────────┘ +``` + +در این مثال هر هدف شناسه محاسبه تعداد تبدیل (هر عنصر در اهداف تو در تو ساختار داده ها یک هدف است که رسیده بود که ما اشاره به عنوان یک تبدیل) و تعداد جلسات. بدون مجموعه ملحق, ما می خواهیم تعداد جلسات به عنوان مجموع شمارش (امضا کردن). اما در این مورد خاص ردیف شد ضرب در تو در تو در اهداف و ساختار آن در سفارش به تعداد هر جلسه یک بار بعد از این ما اعمال یک شرط به ارزش arrayenumerateuniq(اهداف است.id) تابع. + +تابع ارریینومراتونیک می تواند چندین بار از همان اندازه به عنوان استدلال استفاده کند. در این مورد, منحصر به فرد است برای تاپل از عناصر در موقعیت های مشابه در تمام ارریس در نظر گرفته. + +``` sql +SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,1,1,2,1] │ +└───────────────┘ +``` + +این در هنگام استفاده از مجموعه با یک ساختار داده های تو در تو و تجمع بیشتر در سراسر عناصر متعدد در این ساختار ملحق لازم است. + +## عقبگرد {#arraypopback} + +حذف مورد گذشته از مجموعه. + +``` sql +arrayPopBack(array) +``` + +**پارامترها** + +- `array` – Array. + +**مثال** + +``` sql +SELECT arrayPopBack([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## ساحل {#arraypopfront} + +اولین مورد را از مجموعه حذف می کند. + +``` sql +arrayPopFront(array) +``` + +**پارامترها** + +- `array` – Array. + +**مثال** + +``` sql +SELECT arrayPopFront([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [2,3] │ +└───────┘ +``` + +## عقب نشینی {#arraypushback} + +یک مورد را به انتهای مجموعه اضافه می کند. + +``` sql +arrayPushBack(array, single_value) +``` + +**پارامترها** + +- `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` نوع داده مجموعه را تایپ کنید. برای کسب اطلاعات بیشتر در مورد انواع داده ها در خانه کلیک کنید “[انواع داده ها](../../sql-reference/data-types/index.md#data_types)”. می توان `NULL`. تابع می افزاید: `NULL` عنصر به مجموعه ای, و نوع عناصر مجموعه ای تبدیل به `Nullable`. + +**مثال** + +``` sql +SELECT arrayPushBack(['a'], 'b') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## ساحلی {#arraypushfront} + +یک عنصر را به ابتدای مجموعه اضافه می کند. + +``` sql +arrayPushFront(array, single_value) +``` + +**پارامترها** + +- `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` نوع داده مجموعه را تایپ کنید. برای کسب اطلاعات بیشتر در مورد انواع داده ها در خانه کلیک کنید “[انواع داده ها](../../sql-reference/data-types/index.md#data_types)”. می تواند باشد `NULL`. این تابع می افزاید: `NULL` عنصر به مجموعه ای, و نوع عناصر مجموعه ای تبدیل به `Nullable`. + +**مثال** + +``` sql +SELECT arrayPushFront(['b'], 'a') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## نمایش سایت {#arrayresize} + +طول مجموعه را تغییر می دهد. + +``` sql +arrayResize(array, size[, extender]) +``` + +**پارامترها:** + +- `array` — Array. +- `size` — Required length of the array. + - اگر `size` کمتر از اندازه اصلی مجموعه است, مجموعه ای از سمت راست کوتاه. +- اگر `size` مجموعه بزرگتر از اندازه اولیه مجموعه است که به سمت راست گسترش می یابد `extender` مقادیر یا مقادیر پیش فرض برای نوع داده از موارد مجموعه. +- `extender` — Value for extending an array. Can be `NULL`. + +**مقدار بازگشتی:** + +مجموعه ای از طول `size`. + +**نمونه هایی از تماس** + +``` sql +SELECT arrayResize([1], 3) +``` + +``` text +┌─arrayResize([1], 3)─┐ +│ [1,0,0] │ +└─────────────────────┘ +``` + +``` sql +SELECT arrayResize([1], 3, NULL) +``` + +``` text +┌─arrayResize([1], 3, NULL)─┐ +│ [1,NULL,NULL] │ +└───────────────────────────┘ +``` + +## arraySlice {#arrayslice} + +یک تکه از مجموعه را برمی گرداند. + +``` sql +arraySlice(array, offset[, length]) +``` + +**پارامترها** + +- `array` – Array of data. +- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. +- `length` - طول قطعه مورد نیاز . اگر شما یک مقدار منفی مشخص, تابع یک تکه باز می گرداند `[offset, array_length - length)`. اگر شما حذف ارزش, تابع برش می گرداند `[offset, the_end_of_array]`. + +**مثال** + +``` sql +SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res +``` + +``` text +┌─res────────┐ +│ [2,NULL,4] │ +└────────────┘ +``` + +عناصر مجموعه ای به `NULL` به عنوان مقادیر طبیعی انجام می شود. + +## arraySort(\[func,\] arr, …) {#array_functions-sort} + +عناصر را مرتب می کند `arr` صف در صعودی. اگر `func` تابع مشخص شده است, مرتب سازی سفارش توسط نتیجه تعیین `func` تابع اعمال شده به عناصر مجموعه. اگر `func` قبول استدلال های متعدد `arraySort` تابع به تصویب می رسد چند بند که استدلال `func` خواهد به مطابقت. نمونه های دقیق در پایان نشان داده شده است `arraySort` توصیف. + +نمونه ای از مقادیر صحیح مرتب سازی: + +``` sql +SELECT arraySort([1, 3, 3, 0]); +``` + +``` text +┌─arraySort([1, 3, 3, 0])─┐ +│ [0,1,3,3] │ +└─────────────────────────┘ +``` + +نمونه ای از مقادیر رشته مرتب سازی: + +``` sql +SELECT arraySort(['hello', 'world', '!']); +``` + +``` text +┌─arraySort(['hello', 'world', '!'])─┐ +│ ['!','hello','world'] │ +└────────────────────────────────────┘ +``` + +ترتیب مرتب سازی زیر را برای `NULL`, `NaN` و `Inf` مقادیر: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); +``` + +``` text +┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ +│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────────────────────────┘ +``` + +- `-Inf` مقادیر برای اولین بار در مجموعه هستند. +- `NULL` ارزشهای خبری عبارتند از: +- `NaN` مقادیر درست قبل هستند `NULL`. +- `Inf` مقادیر درست قبل هستند `NaN`. + +توجه داشته باشید که `arraySort` یک [عملکرد عالی مرتبه](higher-order-functions.md). شما می توانید یک تابع لامبدا را به عنوان اولین استدلال منتقل کنید. در این مورد مرتب سازی سفارش تعیین می شود در نتیجه از lambda تابع اعمال شده به عناصر آرایه است. + +بیایید مثال زیر را در نظر بگیریم: + +``` sql +SELECT arraySort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,2,1] │ +└─────────┘ +``` + +For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` تابع انواع کلید به ترتیب صعودی, نتیجه این است \[3, 2, 1\]. بنابراین `(x) –> -x` عملکرد لامبدا مجموعه [ترتیب نزولی](#array_functions-reverse-sort) در یک مرتب سازی. + +تابع لامبدا می تواند استدلال های متعدد را قبول کند. در این مورد, شما نیاز به تصویب `arraySort` تابع چند بند از طول یکسان است که استدلال تابع لامبدا به مطابقت. مجموعه حاصل از عناصر از اولین مجموعه ورودی تشکیل شده است. به عنوان مثال: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +در اینجا عناصر موجود در مجموعه دوم (\[2, 1\]) تعریف یک کلید مرتب سازی برای عنصر مربوطه از مجموعه منبع (\[‘hello’, ‘world’\]), به این معنا که, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn’t use `x` مقادیر واقعی مجموعه منبع بر نظم در نتیجه تاثیر نمی گذارد. پس, ‘hello’ خواهد بود که عنصر دوم در نتیجه, و ‘world’ خواهد بود که برای اولین بار. + +نمونه های دیگر در زیر نشان داده شده. + +``` sql +SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +``` sql +SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +!!! note "یادداشت" + برای بهبود کارایی مرتب سازی [تبدیل شوارتز](https://en.wikipedia.org/wiki/Schwartzian_transform) استفاده شده است. + +## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} + +عناصر را مرتب می کند `arr` صف در نزولی. اگر `func` تابع مشخص شده است, `arr` بر اساس نتیجه طبقه بندی شده اند `func` عملکرد به عناصر مجموعه اعمال می شود و سپس مجموعه مرتب شده معکوس می شود. اگر `func` قبول استدلال های متعدد `arrayReverseSort` تابع به تصویب می رسد چند بند که استدلال `func` خواهد به مطابقت. نمونه های دقیق در پایان نشان داده شده است `arrayReverseSort` توصیف. + +نمونه ای از مقادیر صحیح مرتب سازی: + +``` sql +SELECT arrayReverseSort([1, 3, 3, 0]); +``` + +``` text +┌─arrayReverseSort([1, 3, 3, 0])─┐ +│ [3,3,1,0] │ +└────────────────────────────────┘ +``` + +نمونه ای از مقادیر رشته مرتب سازی: + +``` sql +SELECT arrayReverseSort(['hello', 'world', '!']); +``` + +``` text +┌─arrayReverseSort(['hello', 'world', '!'])─┐ +│ ['world','hello','!'] │ +└───────────────────────────────────────────┘ +``` + +ترتیب مرتب سازی زیر را برای `NULL`, `NaN` و `Inf` مقادیر: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; +``` + +``` text +┌─res───────────────────────────────────┐ +│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────┘ +``` + +- `Inf` مقادیر برای اولین بار در مجموعه هستند. +- `NULL` ارزشهای خبری عبارتند از: +- `NaN` مقادیر درست قبل هستند `NULL`. +- `-Inf` مقادیر درست قبل هستند `NaN`. + +توجه داشته باشید که `arrayReverseSort` یک [عملکرد عالی مرتبه](higher-order-functions.md). شما می توانید یک تابع لامبدا را به عنوان اولین استدلال منتقل کنید. مثال زیر نشان داده شده. + +``` sql +SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [1,2,3] │ +└─────────┘ +``` + +این مجموعه به روش زیر مرتب شده است: + +1. ابتدا مجموعه منبع (\[1, 2, 3\]) با توجه به نتیجه تابع لامبدا اعمال شده به عناصر مجموعه طبقه بندی شده اند. نتیجه یک مجموعه است \[3, 2, 1\]. +2. مجموعه ای است که در مرحله قبل به دست, معکوس شده است. بنابراین, نتیجه نهایی است \[1, 2, 3\]. + +تابع لامبدا می تواند استدلال های متعدد را قبول کند. در این مورد, شما نیاز به تصویب `arrayReverseSort` تابع چند بند از طول یکسان است که استدلال تابع لامبدا به مطابقت. مجموعه حاصل از عناصر از اولین مجموعه ورودی تشکیل شده است. به عنوان مثال: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +در این مثال مجموعه به روش زیر مرتب شده است: + +1. در ابتدا مجموعه منبع (\[‘hello’, ‘world’\]) با توجه به نتیجه تابع لامبدا اعمال شده به عناصر از ارریس طبقه بندی شده اند. عناصر که در مجموعه دوم به تصویب رسید (\[2, 1\]), تعریف کلید مرتب سازی برای عناصر مربوطه را از مجموعه منبع. نتیجه یک مجموعه است \[‘world’, ‘hello’\]. +2. مجموعه ای که در مرحله قبل طبقه بندی شده اند, معکوس شده است. بنابراین نتیجه نهایی این است \[‘hello’, ‘world’\]. + +نمونه های دیگر در زیر نشان داده شده. + +``` sql +SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; +``` + +``` text +┌─res─────┐ +│ [5,3,4] │ +└─────────┘ +``` + +``` sql +SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; +``` + +``` text +┌─res─────┐ +│ [4,3,5] │ +└─────────┘ +``` + +## arrayUniq(arr, …) {#arrayuniqarr} + +اگر یک استدلال به تصویب می رسد, تعداد عناصر مختلف در مجموعه شمارش. +اگر استدلال های متعدد به تصویب می رسد, شمارش تعداد تاپل های مختلف از عناصر در موقعیت های مربوطه در مجموعه های متعدد. + +اگر شما می خواهید برای دریافت یک لیست از اقلام منحصر به فرد در مجموعه, شما می توانید از ارری راهاهن استفاده(‘groupUniqArray’, arr). + +## هشدار داده می شود) {#array-functions-join} + +یک تابع خاص. بخش را ببینید [“ArrayJoin function”](array-join.md#functions_arrayjoin). + +## کلیدواژه {#arraydifference} + +محاسبه تفاوت بین عناصر مجموعه مجاور. بازگرداندن مجموعه ای که عنصر اول خواهد بود 0, دوم تفاوت بین است `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). + +**نحو** + +``` sql +arrayDifference(array) +``` + +**پارامترها** + +- `array` – [& حذف](https://clickhouse.yandex/docs/en/data_types/array/). + +**مقادیر بازگشتی** + +بازگرداندن مجموعه ای از تفاوت بین عناصر مجاور. + +نوع: [اینترنت\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [شناور\*](https://clickhouse.yandex/docs/en/data_types/float/). + +**مثال** + +پرسوجو: + +``` sql +SELECT arrayDifference([1, 2, 3, 4]) +``` + +نتیجه: + +``` text +┌─arrayDifference([1, 2, 3, 4])─┐ +│ [0,1,1,1] │ +└───────────────────────────────┘ +``` + +مثال سرریز به علت نوع نتیجه اینترن64: + +پرسوجو: + +``` sql +SELECT arrayDifference([0, 10000000000000000000]) +``` + +نتیجه: + +``` text +┌─arrayDifference([0, 10000000000000000000])─┐ +│ [0,-8446744073709551616] │ +└────────────────────────────────────────────┘ +``` + +## حوزه ارریددیست {#arraydistinct} + +مجموعه ای را می گیرد و تنها شامل عناصر مجزا می شود. + +**نحو** + +``` sql +arrayDistinct(array) +``` + +**پارامترها** + +- `array` – [& حذف](https://clickhouse.yandex/docs/en/data_types/array/). + +**مقادیر بازگشتی** + +بازگرداندن مجموعه ای حاوی عناصر متمایز. + +**مثال** + +پرسوجو: + +``` sql +SELECT arrayDistinct([1, 2, 2, 3, 1]) +``` + +نتیجه: + +``` text +┌─arrayDistinct([1, 2, 2, 3, 1])─┐ +│ [1,2,3] │ +└────────────────────────────────┘ +``` + +## هشدار داده می شود) {#array_functions-arrayenumeratedense} + +بازگرداندن مجموعه ای از همان اندازه به عنوان مجموعه منبع, نشان می دهد که هر عنصر برای اولین بار در مجموعه منبع به نظر می رسد. + +مثال: + +``` sql +SELECT arrayEnumerateDense([10, 20, 10, 30]) +``` + +``` text +┌─arrayEnumerateDense([10, 20, 10, 30])─┐ +│ [1,2,1,3] │ +└───────────────────────────────────────┘ +``` + +## هشدار داده می شود) {#array-functions-arrayintersect} + +طول می کشد مجموعه ای با عناصر که در تمام مجموعه منبع در حال حاضر می گرداند. عناصر سفارش در مجموعه حاصل همان است که در مجموعه اول است. + +مثال: + +``` sql +SELECT + arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, + arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect +``` + +``` text +┌─no_intersect─┬─intersect─┐ +│ [] │ [1] │ +└──────────────┴───────────┘ +``` + +## نمایش سایت {#arrayreduce} + +یک تابع کلی برای عناصر مجموعه ای اعمال می شود و نتیجه خود را باز می گرداند. نام تابع تجمع به عنوان یک رشته در نقل قول های تک منتقل می شود `'max'`, `'sum'`. هنگام استفاده از توابع دانه پارامتری پارامتر پس از نام تابع در پرانتز نشان داده شده است `'uniqUpTo(6)'`. + +**نحو** + +``` sql +arrayReduce(agg_func, arr1, arr2, ..., arrN) +``` + +**پارامترها** + +- `agg_func` — The name of an aggregate function which should be a constant [رشته](../../sql-reference/data-types/string.md). +- `arr` — Any number of [& حذف](../../sql-reference/data-types/array.md) نوع ستون به عنوان پارامترهای تابع تجمع. + +**مقدار بازگشتی** + +**مثال** + +``` sql +SELECT arrayReduce('max', [1, 2, 3]) +``` + +``` text +┌─arrayReduce('max', [1, 2, 3])─┐ +│ 3 │ +└───────────────────────────────┘ +``` + +اگر یک تابع جمع استدلال های متعدد طول می کشد, سپس این تابع باید به مجموعه های متعدد از همان اندازه اعمال. + +``` sql +SELECT arrayReduce('maxIf', [3, 5], [1, 0]) +``` + +``` text +┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ +│ 3 │ +└──────────────────────────────────────┘ +``` + +به عنوان مثال با یک تابع جمع پارامتری: + +``` sql +SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) +``` + +``` text +┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ +│ 4 │ +└─────────────────────────────────────────────────────────────┘ +``` + +## تغییرات {#arrayreduceinranges} + +یک تابع کلی برای عناصر مجموعه ای در محدوده های داده شده اعمال می شود و مجموعه ای حاوی نتیجه مربوط به هر محدوده را باز می گرداند. تابع همان نتیجه به عنوان چند بازگشت `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. + +**نحو** + +``` sql +arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) +``` + +**پارامترها** + +- `agg_func` — The name of an aggregate function which should be a constant [رشته](../../sql-reference/data-types/string.md). +- `ranges` — The ranges to aggretate which should be an [& حذف](../../sql-reference/data-types/array.md) از [توپلس](../../sql-reference/data-types/tuple.md) که شامل شاخص و طول هر محدوده. +- `arr` — Any number of [& حذف](../../sql-reference/data-types/array.md) نوع ستون به عنوان پارامترهای تابع تجمع. + +**مقدار بازگشتی** + +**مثال** + +``` sql +SELECT arrayReduceInRanges( + 'sum', + [(1, 5), (2, 3), (3, 4), (4, 4)], + [1000000, 200000, 30000, 4000, 500, 60, 7] +) AS res +``` + +``` text +┌─res─────────────────────────┐ +│ [1234500,234000,34560,4567] │ +└─────────────────────────────┘ +``` + +## هشدار داده می شود) {#arrayreverse} + +بازگرداندن مجموعه ای از همان اندازه به عنوان مجموعه اصلی حاوی عناصر در جهت معکوس. + +مثال: + +``` sql +SELECT arrayReverse([1, 2, 3]) +``` + +``` text +┌─arrayReverse([1, 2, 3])─┐ +│ [3,2,1] │ +└─────────────────────────┘ +``` + +## معکوس) {#array-functions-reverse} + +مترادف برای [“arrayReverse”](#array_functions-arrayreverse) + +## ارریفلاتتن {#arrayflatten} + +مجموعه ای از ارریس ها را به یک مجموعه صاف تبدیل می کند. + +تابع: + +- امر به هر عمق مجموعه های تو در تو. +- طعم هایی را که در حال حاضر مسطح هستند تغییر نمی دهد. + +مجموعه مسطح شامل تمام عناصر از تمام منابع است. + +**نحو** + +``` sql +flatten(array_of_arrays) +``` + +نام مستعار: `flatten`. + +**پارامترها** + +- `array_of_arrays` — [& حذف](../../sql-reference/data-types/array.md) ارریس به عنوان مثال, `[[1,2,3], [4,5]]`. + +**مثالها** + +``` sql +SELECT flatten([[[1]], [[2], [3]]]) +``` + +``` text +┌─flatten(array(array([1]), array([2], [3])))─┐ +│ [1,2,3] │ +└─────────────────────────────────────────────┘ +``` + +## اررایکمپکت {#arraycompact} + +عناصر تکراری متوالی را از یک مجموعه حذف می کند. ترتیب مقادیر نتیجه به ترتیب در مجموعه منبع تعیین می شود. + +**نحو** + +``` sql +arrayCompact(arr) +``` + +**پارامترها** + +`arr` — The [& حذف](../../sql-reference/data-types/array.md) برای بازرسی. + +**مقدار بازگشتی** + +مجموعه ای بدون تکراری. + +نوع: `Array`. + +**مثال** + +پرسوجو: + +``` sql +SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) +``` + +نتیجه: + +``` text +┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ +│ [1,nan,nan,2,3] │ +└────────────────────────────────────────────┘ +``` + +## ارریزیپ {#arrayzip} + +Combine multiple Array type columns into one Array\[Tuple(…)\] column + +**نحو** + +``` sql +arrayZip(arr1, arr2, ..., arrN) +``` + +**پارامترها** + +`arr` — Any number of [& حذف](../../sql-reference/data-types/array.md) ستون نوع به ترکیب. + +**مقدار بازگشتی** + +The result of Array\[Tuple(…)\] type after the combination of these arrays + +**مثال** + +پرسوجو: + +``` sql +SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); +``` + +نتیجه: + +``` text +┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ +│ [('a','d'),('b','e'),('c','f')] │ +└────────────────────────────────────────────┘ +``` + +## ارریایکو {#arrayauc} + +محاسبه حراج (منطقه تحت منحنی, که یک مفهوم در یادگیری ماشین است, مشاهده اطلاعات بیشتر: https://en.wikipedia.org/wiki/receiver\_operating\_characteristic\#area\_under\_the\_curve). + +**نحو** + +``` sql +arrayAUC(arr_scores, arr_labels) +``` + +**پارامترها** +- `arr_scores` — scores prediction model gives. +- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. + +**مقدار بازگشتی** +را برمی گرداند ارزش حراج با نوع شناور64. + +**مثال** +پرسوجو: + +``` sql +select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) +``` + +نتیجه: + +``` text +┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ +│ 0.75 │ +└────────────────────────────────────────---──┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/fa/sql_reference/functions/array_join.md b/docs/fa/sql-reference/functions/array-join.md similarity index 100% rename from docs/fa/sql_reference/functions/array_join.md rename to docs/fa/sql-reference/functions/array-join.md diff --git a/docs/fa/sql-reference/functions/bit-functions.md b/docs/fa/sql-reference/functions/bit-functions.md new file mode 100644 index 00000000000..c25f5470614 --- /dev/null +++ b/docs/fa/sql-reference/functions/bit-functions.md @@ -0,0 +1,255 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 48 +toc_title: "\u0628\u06CC\u062A" +--- + +# توابع بیت {#bit-functions} + +بیت توابع کار برای هر جفت از انواع از uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32 یا float64. + +نوع نتیجه یک عدد صحیح با بیت به حداکثر بیت از استدلال خود را برابر است. اگر حداقل یکی از استدلال امضا شده است, نتیجه یک شماره امضا شده است. اگر استدلال یک عدد ممیز شناور است, این است که به درون بازیگران64. + +## بیت و ب) {#bitanda-b} + +## bitOr(a, b) {#bitora-b} + +## هشدار داده می شود) {#bitxora-b} + +## bitNot(یک) {#bitnota} + +## اطلاعات دقیق) {#bitshiftlefta-b} + +## باز کردن پنجره روی برنامههای دیگر) {#bitshiftrighta-b} + +## هشدار داده می شود) {#bitrotatelefta-b} + +## حفاظت از بیت) {#bitrotaterighta-b} + +## بیتترین {#bittest} + +طول می کشد هر عدد صحیح و تبدیل به [شکل دودویی](https://en.wikipedia.org/wiki/Binary_number), بازگرداندن ارزش کمی در موقعیت مشخص. شمارش معکوس از 0 از سمت راست به سمت چپ شروع می شود. + +**نحو** + +``` sql +SELECT bitTest(number, index) +``` + +**پارامترها** + +- `number` – integer number. +- `index` – position of bit. + +**مقادیر بازگشتی** + +بازگرداندن مقدار کمی در موقعیت مشخص. + +نوع: `UInt8`. + +**مثال** + +مثلا, تعداد 43 در پایه-2 (دودویی) سیستم اعداد است 101011. + +پرسوجو: + +``` sql +SELECT bitTest(43, 1) +``` + +نتیجه: + +``` text +┌─bitTest(43, 1)─┐ +│ 1 │ +└────────────────┘ +``` + +مثال دیگر: + +پرسوجو: + +``` sql +SELECT bitTest(43, 2) +``` + +نتیجه: + +``` text +┌─bitTest(43, 2)─┐ +│ 0 │ +└────────────────┘ +``` + +## تماس {#bittestall} + +بازده نتیجه [ساخت منطقی](https://en.wikipedia.org/wiki/Logical_conjunction) (و اپراتور) از تمام بیت در موقعیت های داده شده. شمارش معکوس از 0 از سمت راست به سمت چپ شروع می شود. + +ساخت و ساز برای عملیات بیتی: + +0 AND 0 = 0 + +0 AND 1 = 0 + +1 AND 0 = 0 + +1 AND 1 = 1 + +**نحو** + +``` sql +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`) درست است اگر و تنها اگر تمام موقعیت خود را درست هستند (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). + +**مقادیر بازگشتی** + +بازده نتیجه منطقی conjuction. + +نوع: `UInt8`. + +**مثال** + +مثلا, تعداد 43 در پایه-2 (دودویی) سیستم اعداد است 101011. + +پرسوجو: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5) +``` + +نتیجه: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5)─┐ +│ 1 │ +└────────────────────────────┘ +``` + +مثال دیگر: + +پرسوجو: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5, 2) +``` + +نتیجه: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ +│ 0 │ +└───────────────────────────────┘ +``` + +## بیتستانی {#bittestany} + +بازده نتیجه [حکم منطقی](https://en.wikipedia.org/wiki/Logical_disjunction) (یا اپراتور) از تمام بیت در موقعیت های داده شده. شمارش معکوس از 0 از سمت راست به سمت چپ شروع می شود. + +دستور برای عملیات بیتی: + +0 OR 0 = 0 + +0 OR 1 = 1 + +1 OR 0 = 1 + +1 OR 1 = 1 + +**نحو** + +``` sql +SELECT bitTestAny(number, index1, index2, index3, index4, ...) +``` + +**پارامترها** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. + +**مقادیر بازگشتی** + +بازده نتیجه ساخت و ساز منطقی. + +نوع: `UInt8`. + +**مثال** + +مثلا, تعداد 43 در پایه-2 (دودویی) سیستم اعداد است 101011. + +پرسوجو: + +``` sql +SELECT bitTestAny(43, 0, 2) +``` + +نتیجه: + +``` text +┌─bitTestAny(43, 0, 2)─┐ +│ 1 │ +└──────────────────────┘ +``` + +مثال دیگر: + +پرسوجو: + +``` sql +SELECT bitTestAny(43, 4, 2) +``` + +نتیجه: + +``` text +┌─bitTestAny(43, 4, 2)─┐ +│ 0 │ +└──────────────────────┘ +``` + +## شمارش {#bitcount} + +محاسبه تعداد بیت را به یکی در نمایندگی دودویی از یک عدد است. + +**نحو** + +``` sql +bitCount(x) +``` + +**پارامترها** + +- `x` — [عدد صحیح](../../sql-reference/data-types/int-uint.md) یا [شناور نقطه](../../sql-reference/data-types/float.md) شماره. تابع با استفاده از نمایندگی ارزش در حافظه. این اجازه می دهد تا حمایت از اعداد ممیز شناور. + +**مقدار بازگشتی** + +- تعداد بیت را به یکی در تعداد ورودی. + +تابع مقدار ورودی را به یک نوع بزرگتر تبدیل نمی کند ([ثبت نام پسوند](https://en.wikipedia.org/wiki/Sign_extension)). بنابراین, مثلا, `bitCount(toUInt8(-1)) = 8`. + +نوع: `UInt8`. + +**مثال** + +نگاهی به عنوان مثال تعداد 333. نمایندگی دودویی: 00000001001101. + +پرسوجو: + +``` sql +SELECT bitCount(333) +``` + +نتیجه: + +``` text +┌─bitCount(333)─┐ +│ 5 │ +└───────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/fa/sql-reference/functions/bitmap-functions.md b/docs/fa/sql-reference/functions/bitmap-functions.md new file mode 100644 index 00000000000..64d94dd9571 --- /dev/null +++ b/docs/fa/sql-reference/functions/bitmap-functions.md @@ -0,0 +1,496 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 49 +toc_title: "\u0646\u06AF\u0627\u0634\u062A \u0628\u06CC\u062A" +--- + +# توابع نگاشت بیت {#bitmap-functions} + +توابع بیت مپ برای دو بیت مپ محاسبه ارزش شی کار, این است که بازگشت بیت مپ جدید و یا کارتیت در حالی که با استفاده از محاسبه فرمول, مانند و, یا, صخره نوردی, و نه, و غیره. + +2 نوع از روش های ساخت و ساز برای شی بیت مپ وجود دارد. یکی این است که توسط گروه بیت مپ تابع تجمع با دولت ساخته شود, دیگر این است که توسط شی مجموعه ای ساخته شود. این نیز برای تبدیل شی بیت مپ به مجموعه شی. + +نقشه شهری روارینگ به یک ساختار داده در حالی که ذخیره سازی واقعی از اجسام بیت مپ پیچیده شده است. هنگامی که کارتیت کمتر از یا برابر است 32, با استفاده از عینیت مجموعه. هنگامی که کارتیت بیشتر از است 32, با استفاده از شی نقشه شهری روارینگ. به همین دلیل است ذخیره سازی مجموعه کارتیت کم سریع تر است. + +برای کسب اطلاعات بیشتر در مورد نقشه شهری روارینگ: [پرورش دهنده](https://github.com/RoaringBitmap/CRoaring). + +## طراحی بیت مپ {#bitmap_functions-bitmapbuild} + +ساخت یک بیت مپ از مجموعه عدد صحیح بدون علامت. + +``` sql +bitmapBuild(array) +``` + +**پارامترها** + +- `array` – unsigned integer array. + +**مثال** + +``` sql +SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) +``` + +``` text +┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ +│  │ AggregateFunction(groupBitmap, UInt8) │ +└─────┴──────────────────────────────────────────────┘ +``` + +## بیت مپوری {#bitmaptoarray} + +تبدیل بیت مپ به مجموعه عدد صحیح. + +``` sql +bitmapToArray(bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## اطلاعات دقیق {#bitmap-functions-bitmapsubsetinrange} + +زیرمجموعه بازگشت در محدوده مشخص شده (دامنه را شامل نمی شود). + +``` sql +bitmapSubsetInRange(bitmap, range_start, range_end) +``` + +**پارامترها** + +- `bitmap` – [شی نگاشت بیت](#bitmap_functions-bitmapbuild). +- `range_start` – range start point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `range_end` – range end point(excluded). Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**مثال** + +``` sql +SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +``` text +┌─res───────────────┐ +│ [30,31,32,33,100] │ +└───────────────────┘ +``` + +## نمایش سایت {#bitmapsubsetlimit} + +ایجاد یک زیر مجموعه از بیت مپ با عناصر نفر گرفته شده بین `range_start` و `cardinality_limit`. + +**نحو** + +``` sql +bitmapSubsetLimit(bitmap, range_start, cardinality_limit) +``` + +**پارامترها** + +- `bitmap` – [شی نگاشت بیت](#bitmap_functions-bitmapbuild). +- `range_start` – The subset starting point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**مقدار بازگشتی** + +زیرمجموعه. + +نوع: `Bitmap object`. + +**مثال** + +پرسوجو: + +``` sql +SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +نتیجه: + +``` text +┌─res───────────────────────┐ +│ [30,31,32,33,100,200,500] │ +└───────────────────────────┘ +``` + +## اطلاعات دقیق {#bitmap_functions-bitmapcontains} + +بررسی اینکه نگاشت بیت شامل یک عنصر است. + +``` sql +bitmapContains(haystack, needle) +``` + +**پارامترها** + +- `haystack` – [شی نگاشت بیت](#bitmap_functions-bitmapbuild), جایی که تابع جستجو. +- `needle` – Value that the function searches. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- 0 — If `haystack` شامل نمی شود `needle`. +- 1 — If `haystack` شامل `needle`. + +نوع: `UInt8`. + +**مثال** + +``` sql +SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## بیتمافاسانی {#bitmaphasany} + +بررسی اینکه دو بیت مپ دارند تقاطع توسط برخی از عناصر. + +``` sql +bitmapHasAny(bitmap1, bitmap2) +``` + +اگر شما اطمینان حاصل کنید که `bitmap2` حاوی شدت یک عنصر, در نظر با استفاده از [اطلاعات دقیق](#bitmap_functions-bitmapcontains) تابع. این کار موثر تر است. + +**پارامترها** + +- `bitmap*` – bitmap object. + +**بازگشت ارزش** + +- `1` اگر `bitmap1` و `bitmap2` حداقل یک عنصر مشابه داشته باشید. +- `0` وگرنه + +**مثال** + +``` sql +SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## بیتمافاسال {#bitmaphasall} + +مشابه به `hasAll(array, array)` بازده 1 اگر بیت مپ اول شامل تمام عناصر از یک ثانیه, 0 در غیر این صورت. +اگر استدلال دوم بیت مپ خالی است و سپس باز می گردد 1. + +``` sql +bitmapHasAll(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 0 │ +└─────┘ +``` + +## هشدار داده می شود {#bitmapcardinality} + +Retrun بیت مپ cardinality از نوع UInt64. + +``` sql +bitmapCardinality(bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## بیت مپمن {#bitmapmin} + +Retrun کوچکترین مقدار از نوع UInt64 در مجموعه UINT32\_MAX اگر این مجموعه خالی است. + + bitmapMin(bitmap) + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## جرم اتمی {#bitmapmax} + +جابجایی بزرگترین ارزش نوع اوینت64 در مجموعه, 0 اگر مجموعه ای خالی است. + + bitmapMax(bitmap) + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## ترجمههای بیت مپ {#bitmaptransform} + +تبدیل مجموعه ای از ارزش ها در بیت مپ به مجموعه ای دیگر از ارزش, نتیجه یک بیت مپ جدید است. + + bitmapTransform(bitmap, from_array, to_array) + +**پارامترها** + +- `bitmap` – bitmap object. +- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. +- `to_array` – UInt32 array, its size shall be the same to from\_array. + +**مثال** + +``` sql +SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res +``` + + ┌─res───────────────────┐ + │ [1,3,4,6,7,8,9,10,20] │ + └───────────────────────┘ + +## بیت مپند {#bitmapand} + +دو بیت مپ و محاسبه, نتیجه یک بیت مپ جدید است. + +``` sql +bitmapAnd(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─┐ +│ [3] │ +└─────┘ +``` + +## نگاشت بیت {#bitmapor} + +دو بیت مپ و یا محاسبه, نتیجه یک بیت مپ جدید است. + +``` sql +bitmapOr(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## بیت مپکسور {#bitmapxor} + +دو محاسبه گز بیت مپ, نتیجه یک بیت مپ جدید است. + +``` sql +bitmapXor(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,4,5] │ +└───────────┘ +``` + +## بیت مپندو {#bitmapandnot} + +دو محاسبه بیت مپ اندنوت, نتیجه یک بیت مپ جدید است. + +``` sql +bitmapAndnot(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## اطلاعات دقیق {#bitmapandcardinality} + +دو بیت مپ و محاسبه بازگشت cardinality از نوع uint64. + +``` sql +bitmapAndCardinality(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## کمبود سیگار {#bitmaporcardinality} + +دو بیت مپ و یا محاسبه بازگشت cardinality از نوع uint64. + +``` sql +bitmapOrCardinality(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## هشدار داده می شود {#bitmapxorcardinality} + +دو بیت مپ xor محاسبه بازگشت cardinality از نوع uint64. + +``` sql +bitmapXorCardinality(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 4 │ +└─────┘ +``` + +## اطلاعات دقیق {#bitmapandnotcardinality} + +دو بیت مپ andnot محاسبه بازگشت cardinality از نوع uint64. + +``` sql +bitmapAndnotCardinality(bitmap,bitmap) +``` + +**پارامترها** + +- `bitmap` – bitmap object. + +**مثال** + +``` sql +SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 2 │ +└─────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/fa/sql_reference/functions/comparison_functions.md b/docs/fa/sql-reference/functions/comparison-functions.md similarity index 100% rename from docs/fa/sql_reference/functions/comparison_functions.md rename to docs/fa/sql-reference/functions/comparison-functions.md diff --git a/docs/fa/sql-reference/functions/conditional-functions.md b/docs/fa/sql-reference/functions/conditional-functions.md new file mode 100644 index 00000000000..6e1c651e6ca --- /dev/null +++ b/docs/fa/sql-reference/functions/conditional-functions.md @@ -0,0 +1,207 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 43 +toc_title: "\u0634\u0631\u0637\u06CC " +--- + +# توابع شرطی {#conditional-functions} + +## اگر {#if} + +کنترل انشعاب مشروط. بر خلاف اکثر سیستم های تاتر همیشه هر دو عبارت را ارزیابی کنید `then` و `else`. + +**نحو** + +``` sql +SELECT if(cond, then, else) +``` + +اگر شرایط `cond` ارزیابی به یک مقدار غیر صفر, می گرداند در نتیجه بیان `then` و نتیجه بیان `else`, اگر در حال حاضر, قلم است. اگر `cond` صفر یا `NULL` سپس نتیجه `then` بیان نادیده گرفته شده است و در نتیجه `else` عبارت, در صورت حاضر, بازگشته است. + +**پارامترها** + +- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. +- `then` - بیان به بازگشت اگر شرایط ملاقات کرده است. +- `else` - بیان به بازگشت اگر شرایط ملاقات نکرده است. + +**مقادیر بازگشتی** + +تابع اجرا می شود `then` و `else` عبارات و نتیجه خود را بر می گرداند, بسته به اینکه شرایط `cond` به پایان رسید تا صفر یا نه. + +**مثال** + +پرسوجو: + +``` sql +SELECT if(1, plus(2, 2), plus(2, 6)) +``` + +نتیجه: + +``` text +┌─plus(2, 2)─┐ +│ 4 │ +└────────────┘ +``` + +پرسوجو: + +``` sql +SELECT if(0, plus(2, 2), plus(2, 6)) +``` + +نتیجه: + +``` text +┌─plus(2, 6)─┐ +│ 8 │ +└────────────┘ +``` + +- `then` و `else` باید کمترین نوع مشترک دارند. + +**مثال:** + +اینو بگیر `LEFT_RIGHT` جدول: + +``` sql +SELECT * +FROM LEFT_RIGHT + +┌─left─┬─right─┐ +│ ᴺᵁᴸᴸ │ 4 │ +│ 1 │ 3 │ +│ 2 │ 2 │ +│ 3 │ 1 │ +│ 4 │ ᴺᵁᴸᴸ │ +└──────┴───────┘ +``` + +پرس و جو زیر مقایسه می کند `left` و `right` مقادیر: + +``` sql +SELECT + left, + right, + if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller +FROM LEFT_RIGHT +WHERE isNotNull(left) AND isNotNull(right) + +┌─left─┬─right─┬─is_smaller──────────────────────────┐ +│ 1 │ 3 │ left is smaller than right │ +│ 2 │ 2 │ right is greater or equal than left │ +│ 3 │ 1 │ right is greater or equal than left │ +└──────┴───────┴─────────────────────────────────────┘ +``` + +یادداشت: `NULL` ارزش ها در این مثال استفاده نمی شود, بررسی [ارزشهای پوچ در شرطی](#null-values-in-conditionals) بخش. + +## اپراتور سه تایی {#ternary-operator} + +این همان کار می کند `if` تابع. + +نحو: `cond ? then : else` + +بازگشت `then` اگر `cond` ارزیابی درست باشد (بیشتر از صفر), در غیر این صورت بازده `else`. + +- `cond` باید از نوع باشد `UInt8` و `then` و `else` باید کمترین نوع مشترک دارند. + +- `then` و `else` می تواند باشد `NULL` + +**همچنین نگاه کنید به** + +- [اطلاعات دقیق](other-functions.md#ifnotfinite). + +## چندف {#multiif} + +اجازه می دهد تا شما را به نوشتن [CASE](../operators.md#operator_case) اپراتور فشرده تر در پرس و جو. + +نحو: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` + +**پارامترها:** + +- `cond_N` — The condition for the function to return `then_N`. +- `then_N` — The result of the function when executed. +- `else` — The result of the function if none of the conditions is met. + +تابع می پذیرد `2N+1` پارامترها + +**مقادیر بازگشتی** + +تابع یکی از مقادیر را برمی گرداند `then_N` یا `else`, بسته به شرایط `cond_N`. + +**مثال** + +دوباره با استفاده از `LEFT_RIGHT` جدول + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─result──────────┐ +│ ᴺᵁᴸᴸ │ 4 │ Null value │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ left is greater │ +│ 4 │ ᴺᵁᴸᴸ │ Null value │ +└──────┴───────┴─────────────────┘ +``` + +## با استفاده از نتایج شرطی به طور مستقیم {#using-conditional-results-directly} + +شرطی همیشه به نتیجه `0`, `1` یا `NULL`. بنابراین شما می توانید نتایج شرطی به طور مستقیم مثل این استفاده کنید: + +``` sql +SELECT left < right AS is_small +FROM LEFT_RIGHT + +┌─is_small─┐ +│ ᴺᵁᴸᴸ │ +│ 1 │ +│ 0 │ +│ 0 │ +│ ᴺᵁᴸᴸ │ +└──────────┘ +``` + +## ارزشهای پوچ در شرطی {#null-values-in-conditionals} + +زمانی که `NULL` ارزش ها در شرطی درگیر, نتیجه نیز خواهد بود `NULL`. + +``` sql +SELECT + NULL < 1, + 2 < NULL, + NULL < NULL, + NULL = NULL + +┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ +│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└───────────────┴───────────────┴──────────────────┴────────────────────┘ +``` + +بنابراین شما باید نمایش داده شد خود را با دقت ساخت اگر انواع هستند `Nullable`. + +مثال زیر نشان می دهد این شکست برای اضافه کردن شرایط برابر به `multiIf`. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─faulty_result────┐ +│ ᴺᵁᴸᴸ │ 4 │ Both equal │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ right is smaller │ +│ 4 │ ᴺᵁᴸᴸ │ Both equal │ +└──────┴───────┴──────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/fa/sql-reference/functions/date-time-functions.md b/docs/fa/sql-reference/functions/date-time-functions.md new file mode 100644 index 00000000000..70b764e9f58 --- /dev/null +++ b/docs/fa/sql-reference/functions/date-time-functions.md @@ -0,0 +1,451 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u062A\u0627\u0631\u06CC\u062E \u0648\ + \ \u0632\u0645\u0627\u0646" +--- + +# توابع برای کار با تاریخ و زمان {#functions-for-working-with-dates-and-times} + +پشتیبانی از مناطق زمانی + +همه توابع برای کار با تاریخ و زمان است که یک استفاده منطقی برای منطقه زمانی می تواند یک زمان اختیاری استدلال منطقه دوم قبول. مثال: اسیا/یکاترینبورگ. در این مورد از منطقه زمانی مشخص شده به جای محلی (پیش فرض) استفاده می کنند. + +``` sql +SELECT + toDateTime('2016-06-15 23:00:00') AS time, + toDate(time) AS date_local, + toDate(time, 'Asia/Yekaterinburg') AS date_yekat, + toString(time, 'US/Samoa') AS time_samoa +``` + +``` text +┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ +└─────────────────────┴────────────┴────────────┴─────────────────────┘ +``` + +فقط مناطق زمانی که از مجموعه مقالات توسط تعداد کل ساعت متفاوت پشتیبانی می شوند. + +## توتیمزون {#totimezone} + +تبدیل زمان یا تاریخ و زمان به منطقه زمانی مشخص شده است. + +## اسباب بازی {#toyear} + +تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت16 حاوی شماره سال (میلادی). + +## فهرست توزیع جدید {#toquarter} + +تبدیل یک تاریخ یا تاریخ با زمان به یک عدد کوچک8 حاوی شماره سه ماهه. + +## تامونت {#tomonth} + +تبدیل یک تاریخ یا تاریخ با زمان به یک عدد کوچک8 حاوی شماره ماه (1-12). + +## سال {#todayofyear} + +تبدیل یک تاریخ و یا تاریخ با گذشت زمان به یک uint16 تعداد شامل تعداد روز از سال (1-366). + +## تودیفمون {#todayofmonth} + +تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت8 حاوی تعداد روز از ماه (1-31). + +## تدیفوک {#todayofweek} + +تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت8 حاوی تعداد روز هفته (دوشنبه است 1, و یکشنبه است 7). + +## تمام {#tohour} + +تبدیل تاریخ با هم به یک uint8 شماره حاوی تعداد ساعت در زمان 24 ساعته (0-23). +This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). + +## تامینوت {#tominute} + +تبدیل تاریخ با هم به یک uint8 شماره حاوی تعداد دقیقه از ساعت (0-59). + +## جای خالی {#tosecond} + +تبدیل تاریخ با هم به یک uint8 شماره حاوی شماره دوم در دقیقه (0-59). +ثانیه جهش برای به حساب نمی. + +## تیونیتیمستمپ {#to-unix-timestamp} + +برای استدلال حسگر ناحیه رنگی: تبدیل ارزش به نمایندگی عددی داخلی خود (برچسب زمان یونیکس). +برای استدلال رشته: تاریخ ساعت پارسه از رشته با توجه به منطقه زمانی (بحث دوم اختیاری, منطقه زمانی سرور به طور پیش فرض استفاده می شود) و مربوط برچسب زمان یونیکس می گرداند. +برای استدلال تاریخ: رفتار نامشخص است. + +**نحو** + +``` sql +toUnixTimestamp(datetime) +toUnixTimestamp(str, [timezone]) +``` + +**مقدار بازگشتی** + +- زمان یونیکس را برمی گرداند. + +نوع: `UInt32`. + +**مثال** + +پرسوجو: + +``` sql +SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp +``` + +نتیجه: + +``` text +┌─unix_timestamp─┐ +│ 1509836867 │ +└────────────────┘ +``` + +## سال نو {#tostartofyear} + +دور یک تاریخ یا تاریخ با زمان به روز اول سال. +تاریخ را برمی گرداند. + +## تاستارتوفیزیر {#tostartofisoyear} + +دور کردن تاریخ یا تاریخ با زمان به روز اول سال ایزو. +تاریخ را برمی گرداند. + +## toStartOfQuarter {#tostartofquarter} + +دور یک تاریخ یا تاریخ با زمان به روز اول سه ماهه. +اولین روز از سه ماهه است یا 1 ژانویه, 1 مارس, 1 جولای, یا 1 اکتبر. +تاریخ را برمی گرداند. + +## ماهی تابه {#tostartofmonth} + +دور پایین تاریخ یا تاریخ با زمان به روز اول ماه. +تاریخ را برمی گرداند. + +!!! attention "توجه" + رفتار تجزیه تاریخ نادرست اجرای خاص است. تاتر ممکن است صفر تاریخ بازگشت, پرتاب یک استثنا و یا انجام “natural” سرریز کردن. + +## روز قیامت {#tomonday} + +دور کردن یک تاریخ یا تاریخ با زمان به نزدیکترین دوشنبه. +تاریخ را برمی گرداند. + +## تستارتوفک (تی \[, حالت\]) {#tostartofweektmode} + +دور یک تاریخ یا تاریخ را با زمان به نزدیکترین یکشنبه یا دوشنبه با حالت. +تاریخ را برمی گرداند. +استدلال حالت کار می کند دقیقا مانند استدلال حالت به یدک کش (). برای نحو تک استدلال, ارزش حالت 0 استفاده شده است. + +## روزهای سه بعدی {#tostartofday} + +دور پایین تاریخ با زمان به شروع روز. + +## تاستارتوفهور {#tostartofhour} + +دور پایین تاریخ با زمان به شروع ساعت. + +## حفاظت {#tostartofminute} + +دور پایین تاریخ با زمان به شروع دقیقه. + +## تستارتوفیفومینوت {#tostartoffiveminute} + +دور پایین تاریخ با زمان به شروع فاصله پنج دقیقه. + +## حفاظت {#tostartoftenminutes} + +دور پایین تاریخ با زمان به شروع فاصله ده دقیقه. + +## toStartOfFifteenMinutes {#tostartoffifteenminutes} + +دور پایین تاریخ با زمان به شروع فاصله پانزده دقیقه. + +## toStartOfInterval(time\_or\_data فاصله x واحد \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} + +این یک تعمیم توابع دیگر به نام است `toStartOf*`. به عنوان مثال, +`toStartOfInterval(t, INTERVAL 1 year)` همان را برمی گرداند `toStartOfYear(t)`, +`toStartOfInterval(t, INTERVAL 1 month)` همان را برمی گرداند `toStartOfMonth(t)`, +`toStartOfInterval(t, INTERVAL 1 day)` همان را برمی گرداند `toStartOfDay(t)`, +`toStartOfInterval(t, INTERVAL 15 minute)` همان را برمی گرداند `toStartOfFifteenMinutes(t)` و غیره + +## & تمام کردن {#totime} + +تبدیل یک تاریخ با زمان به یک تاریخ ثابت خاص, در حالی که حفظ زمان. + +## ترلتیویینوم {#torelativeyearnum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد سال, با شروع از یک نقطه ثابت خاص در گذشته. + +## ترلتیواارترن {#torelativequarternum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد سه ماهه, با شروع از یک نقطه ثابت خاص در گذشته. + +## ترلتیومنتنوم {#torelativemonthnum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد ماه, با شروع از یک نقطه ثابت خاص در گذشته. + +## ترلتیواکنام {#torelativeweeknum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد هفته, با شروع از یک نقطه ثابت خاص در گذشته. + +## ترلتیدینوم {#torelativedaynum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد روز, با شروع از یک نقطه ثابت خاص در گذشته. + +## تورلاتویورنام {#torelativehournum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد ساعت, با شروع از یک نقطه ثابت خاص در گذشته. + +## ترلتیومینوتنوم {#torelativeminutenum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد دقیقه, با شروع از یک نقطه ثابت خاص در گذشته. + +## ترلتیویسکنندوم {#torelativesecondnum} + +تبدیل یک تاریخ با زمان و یا تاریخ به تعداد دوم, با شروع از یک نقطه ثابت خاص در گذشته. + +## ریز ریز کردن {#toisoyear} + +تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت16 حاوی شماره سال ایزو. + +## هشدار داده می شود {#toisoweek} + +تبدیل یک تاریخ و یا تاریخ با گذشت زمان به یک uint8 تعداد شامل iso هفته شماره. + +## تاریخ \[, حالت\]) {#toweekdatemode} + +این تابع تعداد هفته برای تاریخ و یا تاریخ ساعت می گرداند. فرم دو برهان یدک کش () شما را قادر به مشخص کنید که هفته در روز یکشنبه یا دوشنبه شروع می شود و چه مقدار بازگشتی باید در محدوده 0 تا 53 یا از 1 به 53 باشد. اگر استدلال حالت حذف شده است, حالت پیش فرض است 0. +`toISOWeek()`یک تابع سازگاری است که معادل است `toWeek(date,3)`. +جدول زیر توضیح می دهد که چگونه استدلال حالت کار می کند. + +| حالت | اولین روز هفته | گستره | Week 1 is the first week … | +|------|----------------|-------|-----------------------------| +| 0 | یکشنبه | 0-53 | با یکشنبه در این سال | +| 1 | دوشنبه | 0-53 | با 4 یا چند روز در سال جاری | +| 2 | یکشنبه | 1-53 | با یکشنبه در این سال | +| 3 | دوشنبه | 1-53 | با 4 یا چند روز در سال جاری | +| 4 | یکشنبه | 0-53 | با 4 یا چند روز در سال جاری | +| 5 | دوشنبه | 0-53 | با دوشنبه در این سال | +| 6 | یکشنبه | 1-53 | با 4 یا چند روز در سال جاری | +| 7 | دوشنبه | 1-53 | با دوشنبه در این سال | +| 8 | یکشنبه | 1-53 | شامل ژانویه 1 | +| 9 | دوشنبه | 1-53 | شامل ژانویه 1 | + +برای مقادیر حالت با معنی “with 4 or more days this year,” هفته ها با توجه به ایزو شماره 8601: 1988: + +- اگر هفته حاوی ژانویه 1 است 4 یا چند روز در سال جدید, هفته است 1. + +- در غیر این صورت, این هفته گذشته سال گذشته است, و هفته بعد هفته است 1. + +برای مقادیر حالت با معنی “contains January 1”, هفته شامل ژانویه 1 هفته است 1. مهم نیست که چند روز در سال جدید هفته شامل, حتی اگر شامل تنها یک روز. + +``` sql +toWeek(date, [, mode][, Timezone]) +``` + +**پارامترها** + +- `date` – Date or DateTime. +- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. +- `Timezone` – Optional parameter, it behaves like any other conversion function. + +**مثال** + +``` sql +SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; +``` + +``` text +┌───────date─┬─week0─┬─week1─┬─week9─┐ +│ 2016-12-27 │ 52 │ 52 │ 1 │ +└────────────┴───────┴───────┴───────┘ +``` + +## تاریخ \[, حالت\]) {#toyearweekdatemode} + +را برمی گرداند سال و هفته برای تاریخ. سال در نتیجه ممکن است متفاوت از سال در بحث تاریخ برای اولین و هفته گذشته سال. + +استدلال حالت کار می کند دقیقا مانند استدلال حالت به یدک کش (). برای نحو تک استدلال, ارزش حالت 0 استفاده شده است. + +`toISOYear()`یک تابع سازگاری است که معادل است `intDiv(toYearWeek(date,3),100)`. + +**مثال** + +``` sql +SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; +``` + +``` text +┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ +│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ +└────────────┴───────────┴───────────┴───────────┘ +``` + +## حالا {#now} + +قبول صفر استدلال و بازده زمان فعلی در یکی از لحظات اجرای درخواست. +این تابع ثابت می گرداند, حتی اگر درخواست زمان طولانی برای تکمیل. + +## امروز {#today} + +قبول صفر استدلال و بازده تاریخ جاری در یکی از لحظات اجرای درخواست. +همان ‘toDate(now())’. + +## دیروز {#yesterday} + +قبول صفر استدلال و بازده تاریخ دیروز در یکی از لحظات اجرای درخواست. +همان ‘today() - 1’. + +## سانس {#timeslot} + +دور زمان به نیم ساعت. +این تابع خاص به یاندکس است.متریکا, از نیم ساعت حداقل مقدار زمان برای شکستن یک جلسه به دو جلسه است اگر یک تگ ردیابی نشان می دهد تعداد صفحات متوالی یک کاربر که در زمان به شدت بیش از این مقدار متفاوت. این به این معنی است که تاپل (شناسه برچسب, شناسه کاربری, و شکاف زمان) را می توان مورد استفاده قرار گیرد به جستجو برای تعداد صفحات که در جلسه مربوطه شامل. + +## ستاره فیلم سکسی {#toyyyymm} + +تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت32 حاوی تعداد سال و ماه (یی \* 100 + میلی متر). + +## ستاره فیلم سکسی {#toyyyymmdd} + +تبدیل یک تاریخ یا تاریخ با زمان به تعداد اوینت32 حاوی سال و ماه شماره (یی \* 10000 + میلی متر \* 100 + دی.دی. + +## اطلاعات دقیق {#toyyyymmddhhmmss} + +تبدیل یک تاریخ و یا تاریخ با گذشت زمان به یک uint64 تعداد شامل سال و ماه شماره (yyyy \* 10000000000 + mm \* 100000000 + dd \* 1000000 + hh \* 10000 + mm \* 100 + ss) است. + +## addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} + +تابع می افزاید: یک تاریخ/فاصله زمانی به یک تاریخ/تاریخ ساعت و سپس بازگشت تاریخ / تاریخ ساعت. به عنوان مثال: + +``` sql +WITH + toDate('2018-01-01') AS date, + toDateTime('2018-01-01 00:00:00') AS date_time +SELECT + addYears(date, 1) AS add_years_with_date, + addYears(date_time, 1) AS add_years_with_date_time +``` + +``` text +┌─add_years_with_date─┬─add_years_with_date_time─┐ +│ 2019-01-01 │ 2019-01-01 00:00:00 │ +└─────────────────────┴──────────────────────────┘ +``` + +## subtractYears, subtractMonths, subtractWeeks, subtractDays, subtractHours, subtractMinutes, subtractSeconds, subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} + +تابع تفریق یک تاریخ/فاصله زمانی به تاریخ/تاریخ ساعت و سپس بازگشت تاریخ / تاریخ ساعت. به عنوان مثال: + +``` sql +WITH + toDate('2019-01-01') AS date, + toDateTime('2019-01-01 00:00:00') AS date_time +SELECT + subtractYears(date, 1) AS subtract_years_with_date, + subtractYears(date_time, 1) AS subtract_years_with_date_time +``` + +``` text +┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ +│ 2018-01-01 │ 2018-01-01 00:00:00 │ +└──────────────────────────┴───────────────────────────────┘ +``` + +## dateDiff {#datediff} + +بازگرداندن تفاوت بین دو تاریخ و یا تاریخ ساعت ارزش. + +**نحو** + +``` sql +dateDiff('unit', startdate, enddate, [timezone]) +``` + +**پارامترها** + +- `unit` — Time unit, in which the returned value is expressed. [رشته](../syntax.md#syntax-string-literal). + + Supported values: + + | unit | + | ---- | + |second | + |minute | + |hour | + |day | + |week | + |month | + |quarter | + |year | + +- `startdate` — The first time value to compare. [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). + +- `enddate` — The second time value to compare. [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). + +- `timezone` — Optional parameter. If specified, it is applied to both `startdate` و `enddate`. اگر مشخص نشده, زمان از `startdate` و `enddate` استفاده می شود. در صورتی که یکسان نیست, نتیجه نامشخص است. + +**مقدار بازگشتی** + +تفاوت بین `startdate` و `enddate` بیان شده در `unit`. + +نوع: `int`. + +**مثال** + +پرسوجو: + +``` sql +SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); +``` + +نتیجه: + +``` text +┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ +│ 25 │ +└────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## زمانهای(StartTime, مدت,\[, اندازه\]) {#timeslotsstarttime-duration-size} + +برای یک بازه زمانی شروع در ‘StartTime’ و در ادامه برای ‘Duration’ ثانیه, این مجموعه ای از لحظات در زمان گرداند, متشکل از نقاط از این فاصله به گرد ‘Size’ در عرض چند ثانیه ‘Size’ یک پارامتر اختیاری است: یک ثابت اوینت32, مجموعه ای به 1800 به طور پیش فرض. +به عنوان مثال, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. +این برای جستجوی صفحات در جلسه مربوطه ضروری است. + +## formatDateTime(زمان فرمت \[منطقه زمانی\]) {#formatdatetime} + +Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. + +اصلاح کننده های پشتیبانی شده برای فرمت: +(“Example” ستون نتیجه قالب بندی برای زمان را نشان می دهد `2018-01-02 22:33:44`) + +| تغییردهنده | توصیف | مثال | +|------------|-----------------------------------------------------------------------------|------------| +| %C | سال تقسیم بر 100 و کوتاه به عدد صحیح (00-99) | 20 | +| \# د | روز از ماه, صفر خالی (01-31) | 02 | +| %D | کوتاه میلی متر/دی دی/یی تاریخ, معادل %متر/%د / %و | 01/02/18 | +| \# ا | روز از ماه, فضا خالی ( 1-31) | 2 | +| %F | کوتاه تاریخ یی-میلی متر-دی دی, معادل%و-%متر - % د | 2018-01-02 | +| %H | ساعت در فرمت 24 ساعت (00-23) | 22 | +| %I | ساعت در فرمت 12 ساعت (01-12) | 10 | +| \# ج | روز سال (001-366) | 002 | +| % متر | ماه به عنوان یک عدد اعشاری (01-12) | 01 | +| %M | دقیقه (00-59) | 33 | +| % ن | شخصیت جدید خط (") | | +| \# پ | هستم یا بعد از ظهر تعیین | PM | +| %R | 24-ساعت ساعت ساعت: زمان میلی متر, معادل %ساعت: % متر | 22:33 | +| %S | دوم (00-59) | 44 | +| % تی | شخصیت افقی تب (’) | | +| %T | ایزو 8601 فرمت زمان (ساعت:میلی متر:اس اس), معادل %ساعت:%متر:%بازدید کنندگان | 22:33:44 | +| \# تو | ایزو 8601 روز هفته به عنوان شماره با دوشنبه به عنوان 1 (1-7) | 2 | +| %V | ایزو 8601 هفته شماره (01-53) | 01 | +| \# وات | روز هفته به عنوان یک عدد اعشاری با یکشنبه به عنوان 0 (0-6) | 2 | +| \#… | سال گذشته دو رقم (00-99) | 18 | +| %Y | سال | 2018 | +| %% | یک % نشانه | % | + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/fa/sql-reference/functions/encoding-functions.md b/docs/fa/sql-reference/functions/encoding-functions.md new file mode 100644 index 00000000000..7a7fe8c221b --- /dev/null +++ b/docs/fa/sql-reference/functions/encoding-functions.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 52 +toc_title: "\u06A9\u062F\u0628\u0646\u062F\u06CC" +--- + +# توابع را پشتیبانی می کند {#encoding-functions} + +## کاراکتر {#char} + +بازگرداندن رشته با طول به عنوان تعدادی از استدلال گذشت و هر بایت دارای ارزش استدلال مربوطه. می پذیرد استدلال های متعدد از انواع عددی. اگر ارزش بحث خارج از محدوده uint8 نوع داده آن است که تبدیل به uint8 با امکان گرد کردن و سرریز. + +**نحو** + +``` sql +char(number_1, [number_2, ..., number_n]); +``` + +**پارامترها** + +- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../../sql-reference/data-types/int-uint.md), [شناور](../../sql-reference/data-types/float.md). + +**مقدار بازگشتی** + +- یک رشته از بایت داده. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello +``` + +نتیجه: + +``` text +┌─hello─┐ +│ hello │ +└───────┘ +``` + +شما می توانید یک رشته از رمزگذاری دلخواه با عبور از بایت مربوطه ساخت. در اینجا به عنوان مثال برای یونایتد-8 است: + +پرسوجو: + +``` sql +SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; +``` + +نتیجه: + +``` text +┌─hello──┐ +│ привет │ +└────────┘ +``` + +پرسوجو: + +``` sql +SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; +``` + +نتیجه: + +``` text +┌─hello─┐ +│ 你好 │ +└───────┘ +``` + +## هکس {#hex} + +بازگرداندن یک رشته حاوی نمایندگی هگزادسیمال استدلال. + +**نحو** + +``` sql +hex(arg) +``` + +تابع با استفاده از حروف بزرگ `A-F` و با استفاده از هیچ پیشوندها (مانند `0x`) یا پسوندها (مانند `h`). + +برای استدلال عدد صحیح رقم سحر و جادو را چاپ می کند (“nibbles”) از مهم ترین به حداقل قابل توجهی (اندی بزرگ یا “human readable” سفارش). این با مهم ترین بایت غیر صفر شروع می شود (پیشرو صفر بایت حذف می شوند) اما همیشه چاپ هر دو رقم از هر بایت حتی اگر رقم پیشرو صفر است. + +مثال: + +**مثال** + +پرسوجو: + +``` sql +SELECT hex(1); +``` + +نتیجه: + +``` text +01 +``` + +مقادیر نوع `Date` و `DateTime` به عنوان اعداد صحیح مربوطه فرمت (تعداد روز از عصر برای تاریخ و ارزش برچسب زمان یونیکس برای تاریخ ساعت داده). + +برای `String` و `FixedString`, تمام بایت به سادگی به عنوان دو عدد هگزادسیمال کد گذاری. صفر بایت حذف نشده است. + +ارزش های ممیز شناور و رقم اعشاری به عنوان نمایندگی خود را در حافظه کد گذاری. همانطور که ما از معماری اندیان کوچک حمایت می کنیم در اندی کوچک کد گذاری می شوند. صفر پیشرو / عقبی بایت حذف نشده است. + +**پارامترها** + +- `arg` — A value to convert to hexadecimal. Types: [رشته](../../sql-reference/data-types/string.md), [اینترنت](../../sql-reference/data-types/int-uint.md), [شناور](../../sql-reference/data-types/float.md), [دهدهی](../../sql-reference/data-types/decimal.md), [تاریخ](../../sql-reference/data-types/date.md) یا [DateTime](../../sql-reference/data-types/datetime.md). + +**مقدار بازگشتی** + +- یک رشته با نمایش هگزادسیمال استدلال. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); +``` + +نتیجه: + +``` text +┌─hex_presentation─┐ +│ 00007041 │ +│ 00008041 │ +└──────────────────┘ +``` + +پرسوجو: + +``` sql +SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); +``` + +نتیجه: + +``` text +┌─hex_presentation─┐ +│ 0000000000002E40 │ +│ 0000000000003040 │ +└──────────────────┘ +``` + +## unhex(str) {#unhexstr} + +می پذیرد یک رشته حاوی هر تعداد از رقم هگزادسیمال, و یک رشته حاوی بایت مربوطه را برمی گرداند. پشتیبانی از حروف بزرگ و کوچک تعداد ارقام هگزادسیمال ندارد به حتی. اگر عجیب و غریب است, رقم گذشته به عنوان نیمه حداقل قابل توجهی از بایت 00-0ف تفسیر. اگر رشته استدلال شامل هر چیزی غیر از رقم هگزادسیمال, برخی از نتیجه پیاده سازی تعریف بازگشته است (یک استثنا پرتاب نمی شود). +اگر شما می خواهید برای تبدیل نتیجه به یک عدد, شما می توانید با استفاده از ‘reverse’ و ‘reinterpretAsType’ توابع. + +## هشدار داده می شود) {#uuidstringtonumstr} + +می پذیرد یک رشته حاوی 36 کاراکتر در قالب `123e4567-e89b-12d3-a456-426655440000` و به عنوان مجموعه ای از بایت ها در یک رشته ثابت(16) باز می گردد. + +## هشدار داده می شود) {#uuidnumtostringstr} + +می پذیرد یک رشته ثابت (16) ارزش. بازگرداندن یک رشته حاوی 36 کاراکتر در قالب متن. + +## بیتماسکتولیست (عدد) {#bitmasktolistnum} + +می پذیرد یک عدد صحیح. بازگرداندن یک رشته حاوی لیستی از قدرت های دو که در مجموع تعداد منبع که خلاصه. با کاما از هم جدا بدون فاصله در قالب متن, به ترتیب صعودی. + +## هشدار داده می شود) {#bitmasktoarraynum} + +می پذیرد یک عدد صحیح. بازگرداندن مجموعه ای از اعداد اوینت64 حاوی لیستی از قدرت های دو که در مجموع تعداد منبع در هنگام خلاصه. اعداد به ترتیب صعودی هستند. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/fa/sql-reference/functions/ext-dict-functions.md b/docs/fa/sql-reference/functions/ext-dict-functions.md new file mode 100644 index 00000000000..f553eccad0a --- /dev/null +++ b/docs/fa/sql-reference/functions/ext-dict-functions.md @@ -0,0 +1,206 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 58 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0648\u0627\u0698\u0647\u0646\u0627\u0645\ + \u0647\u0647\u0627 \u062E\u0627\u0631\u062C\u06CC" +--- + +# توابع برای کار با لغت نامه های خارجی {#ext_dict_functions} + +برای اطلاعات در مورد اتصال و پیکربندی لغت نامه های خارجی, دیدن [واژهنامهها خارجی](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +## دیکته کردن {#dictget} + +بازیابی یک مقدار از یک فرهنگ لغت خارجی. + +``` sql +dictGet('dict_name', 'attr_name', id_expr) +dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**پارامترها** + +- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql-reference/data-types/int-uint.md) یا [تاپل](../../sql-reference/data-types/tuple.md)- نوع ارزش بسته به پیکربندی فرهنگ لغت . +- `default_value_expr` — Value returned if the dictionary doesn’t contain a row with the `id_expr` کلید [عبارت](../syntax.md#syntax-expressions) بازگشت ارزش در نوع داده پیکربندی شده برای `attr_name` صفت کردن. + +**مقدار بازگشتی** + +- اگر تاتر تجزیه ویژگی موفقیت در [نوع داده خصیصه](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), توابع بازگشت ارزش ویژگی فرهنگ لغت که مربوط به `id_expr`. + +- اگر هیچ کلید وجود دارد, مربوط به `id_expr`, در فرهنگ لغت, سپس: + + - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. + +کلیک هاوس می اندازد یک استثنا اگر می تواند ارزش ویژگی تجزیه و یا ارزش می کند نوع داده ویژگی مطابقت ندارد. + +**مثال** + +ایجاد یک فایل متنی `ext-dict-text.csv` حاوی موارد زیر است: + +``` text +1,1 +2,2 +``` + +ستون اول است `id` ستون دوم `c1`. + +پیکربندی واژهنامه خارجی: + +``` xml + + + ext-dict-test + + + /path-to/ext-dict-test.csv + CSV + + + + + + + + id + + + c1 + UInt32 + + + + 0 + + +``` + +انجام پرس و جو: + +``` sql +SELECT + dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, + toTypeName(val) AS type +FROM system.numbers +LIMIT 3 +``` + +``` text +┌─val─┬─type───┐ +│ 1 │ UInt32 │ +│ 2 │ UInt32 │ +│ 20 │ UInt32 │ +└─────┴────────┘ +``` + +**همچنین نگاه کنید** + +- [واژهنامهها خارجی](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) + +## دیکتس {#dicthas} + +بررسی اینکه یک کلید در حال حاضر در یک فرهنگ لغت است. + +``` sql +dictHas('dict_name', id_expr) +``` + +**پارامترها** + +- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql-reference/data-types/int-uint.md)- نوع ارزش. + +**مقدار بازگشتی** + +- 0, اگر هیچ کلید وجود دارد. +- 1, اگر یک کلید وجود دارد. + +نوع: `UInt8`. + +## حکومت دیکتاتوری {#dictgethierarchy} + +یک مجموعه ای ایجاد می کند که شامل همه والدین یک کلید در [فرهنگ لغت سلسله مراتبی](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md). + +**نحو** + +``` sql +dictGetHierarchy('dict_name', key) +``` + +**پارامترها** + +- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). +- `key` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql-reference/data-types/int-uint.md)- نوع ارزش. + +**مقدار بازگشتی** + +- پدر و مادر برای کلید. + +نوع: [Array(UInt64)](../../sql-reference/data-types/array.md). + +## دیکتاتوری {#dictisin} + +جد یک کلید را از طریق کل زنجیره سلسله مراتبی در فرهنگ لغت بررسی می کند. + +``` sql +dictIsIn('dict_name', child_id_expr, ancestor_id_expr) +``` + +**پارامترها** + +- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). +- `child_id_expr` — Key to be checked. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql-reference/data-types/int-uint.md)- نوع ارزش. +- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` کلید [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql-reference/data-types/int-uint.md)- نوع ارزش. + +**مقدار بازگشتی** + +- 0 اگر `child_id_expr` یک کودک نیست `ancestor_id_expr`. +- 1 اگر `child_id_expr` یک کودک است `ancestor_id_expr` یا اگر `child_id_expr` یک `ancestor_id_expr`. + +نوع: `UInt8`. + +## توابع دیگر {#ext_dict_functions-other} + +تاتر پشتیبانی از توابع تخصصی است که تبدیل ارزش فرهنگ لغت ویژگی به یک نوع داده خاص بدون در نظر گرفتن پیکربندی فرهنگ لغت. + +توابع: + +- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` +- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` +- `dictGetFloat32`, `dictGetFloat64` +- `dictGetDate` +- `dictGetDateTime` +- `dictGetUUID` +- `dictGetString` + +همه این توابع `OrDefault` اصلاح. به عنوان مثال, `dictGetDateOrDefault`. + +نحو: + +``` sql +dictGet[Type]('dict_name', 'attr_name', id_expr) +dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**پارامترها** + +- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql-reference/data-types/int-uint.md)- نوع ارزش. +- `default_value_expr` — Value which is returned if the dictionary doesn’t contain a row with the `id_expr` کلید [عبارت](../syntax.md#syntax-expressions) بازگشت یک مقدار در نوع داده پیکربندی شده برای `attr_name` صفت کردن. + +**مقدار بازگشتی** + +- اگر تاتر تجزیه ویژگی موفقیت در [نوع داده خصیصه](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), توابع بازگشت ارزش ویژگی فرهنگ لغت که مربوط به `id_expr`. + +- در صورتی که هیچ درخواست وجود دارد `id_expr` در فرهنگ لغت و سپس: + + - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. + +کلیک هاوس می اندازد یک استثنا اگر می تواند ارزش ویژگی تجزیه و یا ارزش می کند نوع داده ویژگی مطابقت ندارد. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/fa/sql-reference/functions/functions-for-nulls.md b/docs/fa/sql-reference/functions/functions-for-nulls.md new file mode 100644 index 00000000000..2a0da9ea9de --- /dev/null +++ b/docs/fa/sql-reference/functions/functions-for-nulls.md @@ -0,0 +1,313 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 63 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 Nullable \u0627\u0633\u062A\u062F\u0644\ + \u0627\u0644" +--- + +# توابع برای کار با nullable مصالح {#functions-for-working-with-nullable-aggregates} + +## isNull {#isnull} + +بررسی اینکه بحث چیست [NULL](../syntax.md#null). + +``` sql +isNull(x) +``` + +**پارامترها** + +- `x` — A value with a non-compound data type. + +**مقدار بازگشتی** + +- `1` اگر `x` هست `NULL`. +- `0` اگر `x` نیست `NULL`. + +**مثال** + +جدول ورودی + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +پرسوجو + +``` sql +SELECT x FROM t_null WHERE isNull(y) +``` + +``` text +┌─x─┐ +│ 1 │ +└───┘ +``` + +## اینترنت {#isnotnull} + +بررسی اینکه بحث چیست [NULL](../syntax.md#null). + +``` sql +isNotNull(x) +``` + +**پارامترها:** + +- `x` — A value with a non-compound data type. + +**مقدار بازگشتی** + +- `0` اگر `x` هست `NULL`. +- `1` اگر `x` نیست `NULL`. + +**مثال** + +جدول ورودی + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +پرسوجو + +``` sql +SELECT x FROM t_null WHERE isNotNull(y) +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## فلز کاری {#coalesce} + +چک از چپ به راست چه `NULL` استدلال به تصویب رسید و اولین غیر گرداند-`NULL` استدلال کردن. + +``` sql +coalesce(x,...) +``` + +**پارامترها:** + +- هر تعداد از پارامترهای یک نوع غیر مرکب. تمام پارامترها باید با نوع داده سازگار باشند. + +**مقادیر بازگشتی** + +- اولین غیر-`NULL` استدلال کردن. +- `NULL`, اگر همه استدلال ها `NULL`. + +**مثال** + +یک لیست از مخاطبین است که ممکن است راه های متعدد برای تماس با مشتری مشخص را در نظر بگیرید. + +``` text +┌─name─────┬─mail─┬─phone─────┬──icq─┐ +│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ +│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└──────────┴──────┴───────────┴──────┘ +``` + +این `mail` و `phone` زمینه های رشته نوع هستند, اما `icq` زمینه است `UInt32` بنابراین نیاز به تبدیل شدن به `String`. + +دریافت اولین روش تماس در دسترس برای مشتری از لیست تماس: + +``` sql +SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook +``` + +``` text +┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ +│ client 1 │ 123-45-67 │ +│ client 2 │ ᴺᵁᴸᴸ │ +└──────────┴──────────────────────────────────────────────────────┘ +``` + +## ifNull {#ifnull} + +بازگرداندن یک مقدار جایگزین اگر استدلال اصلی است `NULL`. + +``` sql +ifNull(x,alt) +``` + +**پارامترها:** + +- `x` — The value to check for `NULL`. +- `alt` — The value that the function returns if `x` هست `NULL`. + +**مقادیر بازگشتی** + +- مقدار `x` اگر `x` نیست `NULL`. +- مقدار `alt` اگر `x` هست `NULL`. + +**مثال** + +``` sql +SELECT ifNull('a', 'b') +``` + +``` text +┌─ifNull('a', 'b')─┐ +│ a │ +└──────────────────┘ +``` + +``` sql +SELECT ifNull(NULL, 'b') +``` + +``` text +┌─ifNull(NULL, 'b')─┐ +│ b │ +└───────────────────┘ +``` + +## nullIf {#nullif} + +بازگشت `NULL` اگر استدلال برابر هستند. + +``` sql +nullIf(x, y) +``` + +**پارامترها:** + +`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. + +**مقادیر بازگشتی** + +- `NULL`, اگر استدلال برابر هستند. +- این `x` ارزش, اگر استدلال برابر نیست. + +**مثال** + +``` sql +SELECT nullIf(1, 1) +``` + +``` text +┌─nullIf(1, 1)─┐ +│ ᴺᵁᴸᴸ │ +└──────────────┘ +``` + +``` sql +SELECT nullIf(1, 2) +``` + +``` text +┌─nullIf(1, 2)─┐ +│ 1 │ +└──────────────┘ +``` + +## قابل قبول {#assumenotnull} + +نتایج در ارزش نوع [Nullable](../../sql-reference/data-types/nullable.md) برای یک غیر- `Nullable`, اگر مقدار است `NULL`. + +``` sql +assumeNotNull(x) +``` + +**پارامترها:** + +- `x` — The original value. + +**مقادیر بازگشتی** + +- مقدار اصلی از غیر-`Nullable` نوع, اگر نیست `NULL`. +- مقدار پیش فرض برای غیر-`Nullable` نوع اگر مقدار اصلی بود `NULL`. + +**مثال** + +در نظر بگیرید که `t_null` جدول + +``` sql +SHOW CREATE TABLE t_null +``` + +``` text +┌─statement─────────────────────────────────────────────────────────────────┐ +│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ +└───────────────────────────────────────────────────────────────────────────┘ +``` + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +درخواست `assumeNotNull` تابع به `y` ستون. + +``` sql +SELECT assumeNotNull(y) FROM t_null +``` + +``` text +┌─assumeNotNull(y)─┐ +│ 0 │ +│ 3 │ +└──────────────────┘ +``` + +``` sql +SELECT toTypeName(assumeNotNull(y)) FROM t_null +``` + +``` text +┌─toTypeName(assumeNotNull(y))─┐ +│ Int8 │ +│ Int8 │ +└──────────────────────────────┘ +``` + +## قابل تنظیم {#tonullable} + +تبدیل نوع استدلال به `Nullable`. + +``` sql +toNullable(x) +``` + +**پارامترها:** + +- `x` — The value of any non-compound type. + +**مقدار بازگشتی** + +- مقدار ورودی با یک `Nullable` نوع. + +**مثال** + +``` sql +SELECT toTypeName(10) +``` + +``` text +┌─toTypeName(10)─┐ +│ UInt8 │ +└────────────────┘ +``` + +``` sql +SELECT toTypeName(toNullable(10)) +``` + +``` text +┌─toTypeName(toNullable(10))─┐ +│ Nullable(UInt8) │ +└────────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/fa/sql-reference/functions/geo.md b/docs/fa/sql-reference/functions/geo.md new file mode 100644 index 00000000000..04912539622 --- /dev/null +++ b/docs/fa/sql-reference/functions/geo.md @@ -0,0 +1,511 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 62 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0645\u062E\u062A\u0635\u0627\u062A \u062C\ + \u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC" +--- + +# توابع برای کار با مختصات جغرافیایی {#functions-for-working-with-geographical-coordinates} + +## نمایش سایت {#greatcircledistance} + +محاسبه فاصله بین دو نقطه بر روی سطح زمین با استفاده از [فرمول دایره بزرگ](https://en.wikipedia.org/wiki/Great-circle_distance). + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**پارامترهای ورودی** + +- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. +- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. +- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. +- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. + +مقادیر مثبت به طول و عرض جغرافیایی شمال شرق مطابقت, و مقادیر منفی به طول و عرض جغرافیایی جنوبی و طول جغرافیایی غرب مطابقت. + +**مقدار بازگشتی** + +فاصله بین دو نقطه بر روی سطح زمین, در متر. + +تولید یک استثنا زمانی که مقادیر پارامتر ورودی در خارج از محدوده قرار می گیرند. + +**مثال** + +``` sql +SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) +``` + +``` text +┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ +│ 14132374.194975413 │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## نقلقولهای جدید از این نویسنده {#pointinellipses} + +بررسی اینکه نقطه متعلق به حداقل یکی از بیضی. +مختصات هندسی در سیستم مختصات دکارتی هستند. + +``` sql +pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) +``` + +**پارامترهای ورودی** + +- `x, y` — Coordinates of a point on the plane. +- `xᵢ, yᵢ` — Coordinates of the center of the `i`- حذف هفتم . +- `aᵢ, bᵢ` — Axes of the `i`- حذف ت در واحد های ایکس, و مختصات. + +پارامترهای ورودی باید باشد `2+4⋅n` کجا `n` تعداد بیضی است. + +**مقادیر بازگشتی** + +`1` اگر نقطه در داخل است حداقل یکی از بیضی; `0`اگر این طور نیست. + +**مثال** + +``` sql +SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) +``` + +``` text +┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ +│ 1 │ +└─────────────────────────────────────────────────┘ +``` + +## نقطه چین {#pointinpolygon} + +بررسی اینکه نقطه متعلق به چند ضلعی در هواپیما. + +``` sql +pointInPolygon((x, y), [(a, b), (c, d) ...], ...) +``` + +**مقادیر ورودی** + +- `(x, y)` — Coordinates of a point on the plane. Data type — [تاپل](../../sql-reference/data-types/tuple.md) — A tuple of two numbers. +- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [& حذف](../../sql-reference/data-types/array.md). هر راس است که توسط یک جفت مختصات نشان داده شده است `(a, b)`. راس باید در جهت عقربه های ساعت و یا در خلاف جهت عقربه مشخص شده است. حداقل تعداد راس است 3. چند ضلعی باید ثابت باشد. +- این تابع همچنین از چند ضلعی با سوراخ (برش بخش). در این مورد, اضافه چند ضلعی است که تعریف بخش برش با استفاده از استدلال های اضافی از تابع. تابع چند ضلعی غیر به سادگی متصل را پشتیبانی نمی کند. + +**مقادیر بازگشتی** + +`1` اگر نقطه در داخل چند ضلعی باشد, `0` اگر این طور نیست. +اگر نقطه در مرز چند ضلعی, تابع ممکن است یا بازگشت 0 یا 1. + +**مثال** + +``` sql +SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## کد جغرافیایی {#geohashencode} + +کد طول و عرض جغرافیایی به عنوان یک geohash-رشته مراجعه کنید (http://geohash.org/, https://en.wikipedia.org/wiki/geohash). + +``` sql +geohashEncode(longitude, latitude, [precision]) +``` + +**مقادیر ورودی** + +- طول جغرافیایی-طول جغرافیایی بخشی از مختصات شما می خواهید به رمز. شناور در محدوده`[-180°, 180°]` +- عرض جغرافیایی-عرض جغرافیایی بخشی از مختصات شما می خواهید به رمز. شناور در محدوده `[-90°, 90°]` +- دقت-اختیاری, طول رشته کد گذاری نتیجه, به طور پیش فرض به `12`. عدد صحیح در محدوده `[1, 12]`. هر مقدار کمتر از `1` یا بیشتر از `12` در سکوت به تبدیل `12`. + +**مقادیر بازگشتی** + +- عدد و الفبایی `String` مختصات کد گذاری شده (نسخه اصلاح شده از الفبای باس32 رمزگذاری استفاده شده است). + +**مثال** + +``` sql +SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res +``` + +``` text +┌─res──────────┐ +│ ezs42d000000 │ +└──────────────┘ +``` + +## کد جغرافیایی {#geohashdecode} + +هر رشته جغرافیایی کد گذاری به طول و عرض جغرافیایی را رمزگشایی می کند. + +**مقادیر ورودی** + +- رشته کد گذاری-رشته جغرافیایی کد گذاری. + +**مقادیر بازگشتی** + +- (طول جغرافیایی, عرض جغرافیایی) - 2-تاپل از `Float64` ارزش طول و عرض جغرافیایی. + +**مثال** + +``` sql +SELECT geohashDecode('ezs42') AS res +``` + +``` text +┌─res─────────────────────────────┐ +│ (-5.60302734375,42.60498046875) │ +└─────────────────────────────────┘ +``` + +## جغرافیایی 3 {#geotoh3} + +بازگشت [H3](https://uber.github.io/h3/#/documentation/overview/introduction) شاخص نقطه `(lon, lat)` با وضوح مشخص شده است. + +[H3](https://uber.github.io/h3/#/documentation/overview/introduction) یک سیستم نمایه سازی جغرافیایی است که سطح زمین به کاشی های شش ضلعی حتی تقسیم شده است. این سیستم سلسله مراتبی است, به عنوان مثال. هر شش گوش در سطح بالا را می توان به هفت حتی اما کوچکتر و به همین ترتیب تقسیم. + +این شاخص در درجه اول برای مکان های جفتک انداختن و دیگر دستکاری های جغرافیایی استفاده می شود. + +**نحو** + +``` sql +geoToH3(lon, lat, resolution) +``` + +**پارامترها** + +- `lon` — Longitude. Type: [جسم شناور64](../../sql-reference/data-types/float.md). +- `lat` — Latitude. Type: [جسم شناور64](../../sql-reference/data-types/float.md). +- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- عدد شاخص شش گوش. +- 0 در صورت خطا. + +نوع: `UInt64`. + +**مثال** + +پرسوجو: + +``` sql +SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index +``` + +نتیجه: + +``` text +┌────────────h3Index─┐ +│ 644325524701193974 │ +└────────────────────┘ +``` + +## جعبه جواهر {#geohashesinbox} + +بازگرداندن مجموعه ای از رشته های جغرافیایی کد گذاری شده از دقت داده شده است که در داخل و تقاطع مرزهای جعبه داده شده قرار می گیرند, اساسا یک شبکه 2د مسطح به مجموعه. + +**مقادیر ورودی** + +- طولی-دقیقه طول جغرافیایی, ارزش شناور در محدوده `[-180°, 180°]` +- عرضی-دقیقه عرض جغرافیایی, ارزش شناور در محدوده `[-90°, 90°]` +- طولی-حداکثر طول جغرافیایی, ارزش شناور در محدوده `[-180°, 180°]` +- عرضی-حداکثر عرض جغرافیایی, ارزش شناور در محدوده `[-90°, 90°]` +- دقت-جغرافیایی دقیق, `UInt8` در محدوده `[1, 12]` + +لطفا توجه داشته باشید که تمام پارامترهای هماهنگ باید از همان نوع باشد: هم `Float32` یا `Float64`. + +**مقادیر بازگشتی** + +- مجموعه ای از رشته های دقت طولانی از زمینهاش جعبه پوشش منطقه فراهم, شما باید به ترتیب از اقلام تکیه نمی. +- \[\]- مجموعه خالی اگر *کمینه* ارزش *عرض جغرافیایی* و *طول جغرافیایی* کمتر از متناظر نیست *حداکثر* ارزشهای خبری عبارتند از: + +لطفا توجه داشته باشید که عملکرد یک استثنا را پرتاب می کند اگر مجموعه ای بیش از 10’000’000 باشد. + +**مثال** + +``` sql +SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos +``` + +``` text +┌─thasos──────────────────────────────────────┐ +│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ +└─────────────────────────────────────────────┘ +``` + +## هد3گتاسکل {#h3getbasecell} + +بازگرداندن تعداد سلول پایه از شاخص. + +**نحو** + +``` sql +h3GetBaseCell(index) +``` + +**پارامترها** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- شش گوش شماره سلول پایه. نوع: [UInt8](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT h3GetBaseCell(612916788725809151) as basecell +``` + +نتیجه: + +``` text +┌─basecell─┐ +│ 12 │ +└──────────┘ +``` + +## ه3حکسرام2 {#h3hexaream2} + +میانگین منطقه شش گوش در متر مربع در وضوح داده شده. + +**نحو** + +``` sql +h3HexAreaM2(resolution) +``` + +**پارامترها** + +- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- Area in m². Type: [جسم شناور64](../../sql-reference/data-types/float.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT h3HexAreaM2(13) as area +``` + +نتیجه: + +``` text +┌─area─┐ +│ 43.9 │ +└──────┘ +``` + +## در حال بارگذاری {#h3indexesareneighbors} + +بازده یا نه فراهم هیندکس همسایه هستند. + +**نحو** + +``` sql +h3IndexesAreNeighbors(index1, index2) +``` + +**پارامترها** + +- `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). + +**مقادیر بازگشتی** + +- بازگشت `1` اگر شاخص همسایه هستند, `0` وگرنه نوع: [UInt8](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n +``` + +نتیجه: + +``` text +┌─n─┐ +│ 1 │ +└───┘ +``` + +## بچه گانه های 3 {#h3tochildren} + +بازگرداندن مجموعه ای با شاخص کودک از شاخص داده. + +**نحو** + +``` sql +h3ToChildren(index, resolution) +``` + +**پارامترها** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- با شاخص های اچ 3 کودک تنظیم کنید. مجموعه ای از نوع: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT h3ToChildren(599405990164561919, 6) AS children +``` + +نتیجه: + +``` text +┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## ساعت 3 {#h3toparent} + +بازگرداندن پدر و مادر (درشت) شاخص حاوی شاخص داده. + +**نحو** + +``` sql +h3ToParent(index, resolution) +``` + +**پارامترها** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- شاخص اچ 3 پدر و مادر. نوع: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT h3ToParent(599405990164561919, 3) as parent +``` + +نتیجه: + +``` text +┌─────────────parent─┐ +│ 590398848891879423 │ +└────────────────────┘ +``` + +## اچ 3 {#h3tostring} + +تبدیل نمایندگی هیندکس از شاخص به نمایندگی رشته. + +``` sql +h3ToString(index) +``` + +**پارامترها** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- نمایندگی رشته از شاخص اچ 3. نوع: [رشته](../../sql-reference/data-types/string.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT h3ToString(617420388352917503) as h3_string +``` + +نتیجه: + +``` text +┌─h3_string───────┐ +│ 89184926cdbffff │ +└─────────────────┘ +``` + +## استراینگتوه3 {#stringtoh3} + +تبدیل رشته به نمایندگی h3index (uint64) نمایندگی. + +``` sql +stringToH3(index_str) +``` + +**پارامترها** + +- `index_str` — String representation of the H3 index. Type: [رشته](../../sql-reference/data-types/string.md). + +**مقادیر بازگشتی** + +- عدد شاخص شش گوش. بازده 0 در خطا. نوع: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT stringToH3('89184926cc3ffff') as index +``` + +نتیجه: + +``` text +┌──────────────index─┐ +│ 617420388351344639 │ +└────────────────────┘ +``` + +## انتقال انرژی 3 {#h3getresolution} + +بازگرداندن وضوح از شاخص. + +**نحو** + +``` sql +h3GetResolution(index) +``` + +**پارامترها** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مقادیر بازگشتی** + +- وضوح صفحه اول. گستره: `[0, 15]`. نوع: [UInt8](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT h3GetResolution(617420388352917503) as res +``` + +نتیجه: + +``` text +┌─res─┐ +│ 9 │ +└─────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/fa/sql-reference/functions/hash-functions.md b/docs/fa/sql-reference/functions/hash-functions.md new file mode 100644 index 00000000000..7741cf20e4c --- /dev/null +++ b/docs/fa/sql-reference/functions/hash-functions.md @@ -0,0 +1,446 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 50 +toc_title: "\u0647\u0634" +--- + +# توابع هش {#hash-functions} + +توابع هش را می توان برای زدن شبه تصادفی قطعی از عناصر استفاده می شود. + +## نیم مترد5 {#hash-functions-halfmd5} + +[تفسیر](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) تمام پارامترهای ورودی به عنوان رشته ها و محاسبه [MD5](https://en.wikipedia.org/wiki/MD5) ارزش هش برای هر یک از. سپس هش ها را ترکیب می کند و اولین بایت 8 هش رشته حاصل را می گیرد و به عنوان تفسیر می کند `UInt64` به ترتیب بایت بزرگ اندی. + +``` sql +halfMD5(par1, ...) +``` + +تابع نسبتا کند است (5 میلیون رشته کوتاه در هر ثانیه در هر هسته پردازنده). +در نظر بگیرید با استفاده از [سیفون64](#hash_functions-siphash64) تابع به جای. + +**پارامترها** + +تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql-reference/data-types/index.md). + +**مقدار بازگشتی** + +A [UInt64](../../sql-reference/data-types/int-uint.md) نوع داده مقدار هش. + +**مثال** + +``` sql +SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type +``` + +``` text +┌────────halfMD5hash─┬─type───┐ +│ 186182704141653334 │ UInt64 │ +└────────────────────┴────────┘ +``` + +## MD5 {#hash_functions-md5} + +محاسبه ام دی 5 از یک رشته و مجموعه ای در نتیجه از بایت به عنوان رشته ثابت را برمی گرداند(16). +اگر شما ام دی 5 به طور خاص نیاز ندارد, اما شما نیاز به یک رمزنگاری مناسب و معقول هش 128 بیتی, استفاده از ‘sipHash128’ تابع به جای. +اگر شما می خواهید برای دریافت همان نتیجه به عنوان خروجی توسط ابزار موسسه خدمات مالی, استفاده از پایین تر(سحر و جادو کردن(توسعه هزاره5(بازدید کنندگان))). + +## سیفون64 {#hash_functions-siphash64} + +تولید 64 بیتی [سیفون](https://131002.net/siphash/) مقدار هش. + +``` sql +sipHash64(par1,...) +``` + +این یک تابع هش رمزنگاری است. این کار حداقل سه بار سریع تر از [MD5](#hash_functions-md5) تابع. + +تابع [تفسیر](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) تمام پارامترهای ورودی به عنوان رشته و محاسبه مقدار هش برای هر یک از. سپس هش ها را با الگوریتم زیر ترکیب می کند: + +1. پس از هش کردن تمام پارامترهای ورودی, تابع می شود مجموعه ای از رشته هش. +2. تابع عناصر اول و دوم را می گیرد و هش را برای مجموعه ای از این موارد محاسبه می کند. +3. سپس تابع مقدار هش را محاسبه می کند که در مرحله قبل محاسبه می شود و عنصر سوم هش های اولیه را محاسبه می کند و هش را برای مجموعه ای از انها محاسبه می کند. +4. گام قبلی برای تمام عناصر باقی مانده از مجموعه هش اولیه تکرار شده است. + +**پارامترها** + +تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql-reference/data-types/index.md). + +**مقدار بازگشتی** + +A [UInt64](../../sql-reference/data-types/int-uint.md) نوع داده مقدار هش. + +**مثال** + +``` sql +SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type +``` + +``` text +┌──────────────SipHash─┬─type───┐ +│ 13726873534472839665 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## سیفون128 {#hash_functions-siphash128} + +محاسبه سیفون از یک رشته. +می پذیرد استدلال رشته از نوع. را برمی گرداند رشته ثابت (16). +متفاوت از سیفون64 در که حالت نهایی صخره نوردی تاشو تنها تا 128 بیت انجام می شود. + +## 4تیهاش64 {#cityhash64} + +تولید 64 بیتی [هشدار داده می شود](https://github.com/google/cityhash) مقدار هش. + +``` sql +cityHash64(par1,...) +``` + +این یک تابع هش غیر رمزنگاری سریع است. با استفاده از الگوریتم سیتیاش برای پارامترهای رشته و اجرای خاص تابع هش غیر رمزنگاری سریع برای پارامترهای با انواع داده های دیگر. این تابع از ترکیب کننده سیتیاش برای دریافت نتایج نهایی استفاده می کند. + +**پارامترها** + +تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql-reference/data-types/index.md). + +**مقدار بازگشتی** + +A [UInt64](../../sql-reference/data-types/int-uint.md) نوع داده مقدار هش. + +**مثالها** + +مثال تماس: + +``` sql +SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type +``` + +``` text +┌─────────────CityHash─┬─type───┐ +│ 12072650598913549138 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +مثال زیر نشان می دهد که چگونه برای محاسبه کنترلی از کل جدول با دقت تا سفارش ردیف: + +``` sql +SELECT groupBitXor(cityHash64(*)) FROM table +``` + +## اینتش32 {#inthash32} + +محاسبه یک کد هش 32 بیتی از هر نوع عدد صحیح. +این یک تابع هش غیر رمزنگاری نسبتا سریع از کیفیت متوسط برای اعداد است. + +## اینتاش64 {#inthash64} + +محاسبه یک کد هش 64 بیتی از هر نوع عدد صحیح. +این کار سریع تر از اینتش32. میانگین کیفیت. + +## SHA1 {#sha1} + +## SHA224 {#sha224} + +## SHA256 {#sha256} + +محاسبه شا-1, شا-224, یا شا-256 از یک رشته و مجموعه ای در نتیجه از بایت به عنوان رشته گرداند(20), رشته ثابت(28), و یا رشته ثابت(32). +تابع کار می کند نسبتا کند (شا-1 پردازش در مورد 5 میلیون رشته کوتاه در هر ثانیه در هر هسته پردازنده, در حالی که شا-224 و شا-256 روند در مورد 2.2 میلیون). +ما توصیه می کنیم با استفاده از این تابع تنها در مواردی که شما نیاز به یک تابع هش خاص و شما می توانید انتخاب کنید. +حتی در این موارد توصیه می شود که از تابع به صورت افلاین استفاده کنید و مقادیر قبل از محاسبه هنگام وارد کردن جدول به جای استفاده در انتخاب ها. + +## نشانی اینترنتی\]) {#urlhashurl-n} + +یک تابع هش غیر رمزنگاری سریع و با کیفیت مناسب برای یک رشته از یک نشانی وب با استفاده از نوعی عادی سازی. +`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` یا `#` در پایان, اگر در حال حاضر. +`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` یا `#` در پایان, اگر در حال حاضر. +سطح همان است که در هرج و مرج است. این تابع خاص به یاندکس است.متریکا + +## فرمان 64 {#farmhash64} + +تولید 64 بیتی [مزرعه دار](https://github.com/google/farmhash) مقدار هش. + +``` sql +farmHash64(par1, ...) +``` + +تابع با استفاده از `Hash64` روش از همه [روش های موجود](https://github.com/google/farmhash/blob/master/src/farmhash.h). + +**پارامترها** + +تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql-reference/data-types/index.md). + +**مقدار بازگشتی** + +A [UInt64](../../sql-reference/data-types/int-uint.md) نوع داده مقدار هش. + +**مثال** + +``` sql +SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type +``` + +``` text +┌─────────────FarmHash─┬─type───┐ +│ 17790458267262532859 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## جواهاش {#hash_functions-javahash} + +محاسبه [جواهاش](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) از یک رشته. این تابع هش نه سریع و نه با کیفیت خوب است. تنها دلیل استفاده از این است که این الگوریتم در حال حاضر در سیستم دیگری استفاده می شود و شما باید دقیقا همان نتیجه را محاسبه کنید. + +**نحو** + +``` sql +SELECT javaHash(''); +``` + +**مقدار بازگشتی** + +A `Int32` نوع داده مقدار هش. + +**مثال** + +پرسوجو: + +``` sql +SELECT javaHash('Hello, world!'); +``` + +نتیجه: + +``` text +┌─javaHash('Hello, world!')─┐ +│ -1880044555 │ +└───────────────────────────┘ +``` + +## جواهرشوتف16 {#javahashutf16le} + +محاسبه [جواهاش](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) از یک رشته, فرض کنید که شامل بایت به نمایندگی از یک رشته در رمزگذاری اوت-16ل. + +**نحو** + +``` sql +javaHashUTF16LE(stringUtf16le) +``` + +**پارامترها** + +- `stringUtf16le` — a string in UTF-16LE encoding. + +**مقدار بازگشتی** + +A `Int32` نوع داده مقدار هش. + +**مثال** + +درست پرس و جو با utf-16le کد گذاری رشته است. + +پرسوجو: + +``` sql +SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) +``` + +نتیجه: + +``` text +┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ +│ 3556498 │ +└──────────────────────────────────────────────────────────────┘ +``` + +## هیوهاش {#hash-functions-hivehash} + +محاسبه `HiveHash` از یک رشته. + +``` sql +SELECT hiveHash(''); +``` + +این فقط [جواهاش](#hash_functions-javahash) با کمی نشانه صفر کردن. این تابع در استفاده [زنبورک کندو](https://en.wikipedia.org/wiki/Apache_Hive) برای نسخه های قبل از 3.0. این تابع هش نه سریع و نه با کیفیت خوب است. تنها دلیل استفاده از این است که این الگوریتم در حال حاضر در سیستم دیگری استفاده می شود و شما باید دقیقا همان نتیجه را محاسبه کنید. + +**مقدار بازگشتی** + +A `Int32` نوع داده مقدار هش. + +نوع: `hiveHash`. + +**مثال** + +پرسوجو: + +``` sql +SELECT hiveHash('Hello, world!'); +``` + +نتیجه: + +``` text +┌─hiveHash('Hello, world!')─┐ +│ 267439093 │ +└───────────────────────────┘ +``` + +## متروهاش64 {#metrohash64} + +تولید 64 بیتی [متروهاش](http://www.jandrewrogers.com/2015/05/27/metrohash/) مقدار هش. + +``` sql +metroHash64(par1, ...) +``` + +**پارامترها** + +تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql-reference/data-types/index.md). + +**مقدار بازگشتی** + +A [UInt64](../../sql-reference/data-types/int-uint.md) نوع داده مقدار هش. + +**مثال** + +``` sql +SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type +``` + +``` text +┌────────────MetroHash─┬─type───┐ +│ 14235658766382344533 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## مورد احترام {#jumpconsistenthash} + +محاسبه jumpconsistenthash فرم uint64. +می پذیرد دو استدلال: یک کلید بین 64 نوع و تعداد سطل. بازده int32. +برای کسب اطلاعات بیشتر به لینک مراجعه کنید: [مورد احترام](https://arxiv.org/pdf/1406.2294.pdf) + +## سوفلش2\_32, سوفلشه2\_64 {#murmurhash2-32-murmurhash2-64} + +تولید یک [زمزمه 2](https://github.com/aappleby/smhasher) مقدار هش. + +``` sql +murmurHash2_32(par1, ...) +murmurHash2_64(par1, ...) +``` + +**پارامترها** + +هر دو توابع را به تعداد متغیر از پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql-reference/data-types/index.md). + +**مقدار بازگشتی** + +- این `murmurHash2_32` تابع را برمی گرداند مقدار هش داشتن [UInt32](../../sql-reference/data-types/int-uint.md) نوع داده. +- این `murmurHash2_64` تابع را برمی گرداند مقدار هش داشتن [UInt64](../../sql-reference/data-types/int-uint.md) نوع داده. + +**مثال** + +``` sql +SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type +``` + +``` text +┌──────────MurmurHash2─┬─type───┐ +│ 11832096901709403633 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## سوفلش3\_32, سوفلشه3\_64 {#murmurhash3-32-murmurhash3-64} + +تولید یک [سوفلهاش3](https://github.com/aappleby/smhasher) مقدار هش. + +``` sql +murmurHash3_32(par1, ...) +murmurHash3_64(par1, ...) +``` + +**پارامترها** + +هر دو توابع را به تعداد متغیر از پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql-reference/data-types/index.md). + +**مقدار بازگشتی** + +- این `murmurHash3_32` تابع یک [UInt32](../../sql-reference/data-types/int-uint.md) نوع داده مقدار هش. +- این `murmurHash3_64` تابع یک [UInt64](../../sql-reference/data-types/int-uint.md) نوع داده مقدار هش. + +**مثال** + +``` sql +SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3─┬─type───┐ +│ 2152717 │ UInt32 │ +└─────────────┴────────┘ +``` + +## سوفلش3\_128 {#murmurhash3-128} + +تولید 128 بیتی [سوفلهاش3](https://github.com/aappleby/smhasher) مقدار هش. + +``` sql +murmurHash3_128( expr ) +``` + +**پارامترها** + +- `expr` — [عبارتها](../syntax.md#syntax-expressions) بازگشت یک [رشته](../../sql-reference/data-types/string.md)- نوع ارزش. + +**مقدار بازگشتی** + +A [رشته ثابت (16)](../../sql-reference/data-types/fixedstring.md) نوع داده مقدار هش. + +**مثال** + +``` sql +SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3──────┬─type────────────┐ +│ 6�1�4"S5KT�~~q │ FixedString(16) │ +└──────────────────┴─────────────────┘ +``` + +## بیست و 3264 {#hash-functions-xxhash32} + +محاسبه `xxHash` از یک رشته. این است که در دو طعم پیشنهاد, 32 و 64 بیت. + +``` sql +SELECT xxHash32(''); + +OR + +SELECT xxHash64(''); +``` + +**مقدار بازگشتی** + +A `Uint32` یا `Uint64` نوع داده مقدار هش. + +نوع: `xxHash`. + +**مثال** + +پرسوجو: + +``` sql +SELECT xxHash32('Hello, world!'); +``` + +نتیجه: + +``` text +┌─xxHash32('Hello, world!')─┐ +│ 834093149 │ +└───────────────────────────┘ +``` + +**همچنین نگاه کنید به** + +- [معلم](http://cyan4973.github.io/xxHash/). + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/fa/sql-reference/functions/higher-order-functions.md b/docs/fa/sql-reference/functions/higher-order-functions.md new file mode 100644 index 00000000000..e90929668a1 --- /dev/null +++ b/docs/fa/sql-reference/functions/higher-order-functions.md @@ -0,0 +1,264 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 57 +toc_title: "\u0628\u0627\u0644\u0627\u062A\u0631 \u0633\u0641\u0627\u0631\u0634" +--- + +# توابع مرتبه بالاتر {#higher-order-functions} + +## `->` اپراتور, لامبدا (پارامترهای, اکسپر) تابع {#operator-lambdaparams-expr-function} + +Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. + +مثالها: `x -> 2 * x, str -> str != Referer.` + +توابع مرتبه بالاتر تنها می تواند توابع لامبدا به عنوان استدلال عملکردی خود را قبول. + +یک تابع لامبدا که استدلال های متعدد می پذیرد را می توان به یک تابع مرتبه بالاتر منتقل می شود. در این مورد, تابع مرتبه بالاتر به تصویب می رسد چند مجموعه ای از طول یکسان است که این استدلال به مطابقت. + +برای برخی از توابع مانند [پیاده کردن](#higher_order_functions-array-count) یا [ارریسوم](#higher_order_functions-array-count), استدلال اول (تابع لامبدا) را می توان حذف. در این مورد, نقشه برداری یکسان فرض شده است. + +یک تابع لامبدا را نمی توان برای توابع زیر حذف کرد: + +- [اررایماپ](#higher_order_functions-array-map) +- [شلوار لی](#higher_order_functions-array-filter) +- [شلوار لی](#higher_order_functions-array-fill) +- [نمایش سایت](#higher_order_functions-array-reverse-fill) +- [لرزش دستگاه](#higher_order_functions-array-split) +- [نمایش سایت](#higher_order_functions-array-reverse-split) +- [دریافیرست](#higher_order_functions-array-first) +- [نمایش سایت](#higher_order_functions-array-first-index) + +### arrayMap(func, arr1, …) {#higher_order_functions-array-map} + +بازگرداندن مجموعه ای از برنامه اصلی `func` عملکرد به هر عنصر در `arr` صف کردن. + +مثالها: + +``` sql +SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,4,5] │ +└─────────┘ +``` + +مثال زیر نشان می دهد که چگونه برای ایجاد یک تاپل از عناصر از مجموعه های مختلف: + +``` sql +SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res +``` + +``` text +┌─res─────────────────┐ +│ [(1,4),(2,5),(3,6)] │ +└─────────────────────┘ +``` + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayMap` تابع. + +### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} + +بازگرداندن مجموعه ای حاوی تنها عناصر در `arr1` برای کدام `func` چیزی غیر از 0 را برمی گرداند. + +مثالها: + +``` sql +SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res +``` + +``` text +┌─res───────────┐ +│ ['abc World'] │ +└───────────────┘ +``` + +``` sql +SELECT + arrayFilter( + (i, x) -> x LIKE '%World%', + arrayEnumerate(arr), + ['Hello', 'abc World'] AS arr) + AS res +``` + +``` text +┌─res─┐ +│ [2] │ +└─────┘ +``` + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFilter` تابع. + +### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} + +پویش از طریق `arr1` از عنصر اول به عنصر گذشته و جایگزین `arr1[i]` توسط `arr1[i - 1]` اگر `func` بازده 0. اولین عنصر `arr1` جایگزین نخواهد شد. + +مثالها: + +``` sql +SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res──────────────────────────────┐ +│ [1,1,3,11,12,12,12,5,6,14,14,14] │ +└──────────────────────────────────┘ +``` + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFill` تابع. + +### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} + +پویش از طریق `arr1` از عنصر گذشته به عنصر اول و جایگزین `arr1[i]` توسط `arr1[i + 1]` اگر `func` بازده 0. عنصر گذشته از `arr1` جایگزین نخواهد شد. + +مثالها: + +``` sql +SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res────────────────────────────────┐ +│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ +└────────────────────────────────────┘ +``` + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayReverseFill` تابع. + +### arraySplit(func, arr1, …) {#higher_order_functions-array-split} + +شکافتن `arr1` به چندین ردیف چه زمانی `func` بازگرداندن چیزی غیر از 0, مجموعه خواهد شد در سمت چپ عنصر تقسیم. مجموعه قبل از اولین عنصر تقسیم نخواهد شد. + +مثالها: + +``` sql +SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res─────────────┐ +│ [[1,2,3],[4,5]] │ +└─────────────────┘ +``` + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arraySplit` تابع. + +### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} + +شکافتن `arr1` به چندین ردیف چه زمانی `func` بازگرداندن چیزی غیر از 0, مجموعه خواهد شد در سمت راست عنصر تقسیم. مجموعه پس از عنصر گذشته تقسیم نخواهد شد. + +مثالها: + +``` sql +SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res───────────────┐ +│ [[1],[2,3,4],[5]] │ +└───────────────────┘ +``` + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arraySplit` تابع. + +### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} + +بازگرداندن تعدادی از عناصر در مجموعه ارر که فارک چیزی غیر از گرداند 0. اگر ‘func’ مشخص نشده است, تعداد عناصر غیر صفر گرداند در مجموعه. + +### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} + +بازده 1 اگر حداقل یک عنصر در وجود دارد ‘arr’ برای کدام ‘func’ چیزی غیر از 0 را برمی گرداند. در غیر این صورت, باز می گردد 0. + +### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} + +بازده 1 اگر ‘func’ چیزی غیر از 0 را برای تمام عناصر در ‘arr’. در غیر این صورت, باز می گردد 0. + +### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} + +بازگرداندن مجموع ‘func’ ارزشهای خبری عبارتند از: اگر تابع حذف شده است, فقط می گرداند مجموع عناصر مجموعه. + +### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} + +بازگرداندن اولین عنصر در ‘arr1’ تنظیم برای کدام ‘func’ چیزی غیر از 0 را برمی گرداند. + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFirst` تابع. + +### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} + +بازگرداندن شاخص عنصر اول در ‘arr1’ تنظیم برای کدام ‘func’ چیزی غیر از 0 را برمی گرداند. + +توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFirstIndex` تابع. + +### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} + +بازگرداندن مجموعه ای از مبالغ بخشی از عناصر در مجموعه منبع (مجموع در حال اجرا). اگر `func` تابع مشخص شده است, سپس ارزش عناصر مجموعه توسط این تابع قبل از جمع تبدیل. + +مثال: + +``` sql +SELECT arrayCumSum([1, 1, 1, 1]) AS res +``` + +``` text +┌─res──────────┐ +│ [1, 2, 3, 4] │ +└──────────────┘ +``` + +### هشدار داده می شود) {#arraycumsumnonnegativearr} + +مثل `arrayCumSum`, بازگرداندن مجموعه ای از مبالغ بخشی از عناصر در مجموعه منبع (مجموع در حال اجرا). متفاوت `arrayCumSum`, هنگامی که ارزش سپس بازگشت شامل یک مقدار کمتر از صفر, ارزش است جایگزین با صفر و محاسبه بعدی با صفر پارامترهای انجام. به عنوان مثال: + +``` sql +SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,0,1] │ +└───────────┘ +``` + +### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} + +بازگرداندن مجموعه ای به عنوان نتیجه مرتب سازی عناصر `arr1` به ترتیب صعودی. اگر `func` تابع مشخص شده است, مرتب سازی سفارش توسط نتیجه تابع تعیین `func` اعمال شده به عناصر مجموعه (ارریس) + +این [تبدیل شوارتز](https://en.wikipedia.org/wiki/Schwartzian_transform) برای بهبود کارایی مرتب سازی استفاده می شود. + +مثال: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +برای کسب اطلاعات بیشتر در مورد `arraySort` روش, دیدن [توابع برای کار با ارریس](array-functions.md#array_functions-sort) بخش. + +### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} + +بازگرداندن مجموعه ای به عنوان نتیجه مرتب سازی عناصر `arr1` به ترتیب نزولی. اگر `func` تابع مشخص شده است, مرتب سازی سفارش توسط نتیجه تابع تعیین `func` اعمال شده به عناصر مجموعه ای (ارریس). + +مثال: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +برای کسب اطلاعات بیشتر در مورد `arrayReverseSort` روش, دیدن [توابع برای کار با ارریس](array-functions.md#array_functions-reverse-sort) بخش. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/fa/sql_reference/functions/in_functions.md b/docs/fa/sql-reference/functions/in-functions.md similarity index 100% rename from docs/fa/sql_reference/functions/in_functions.md rename to docs/fa/sql-reference/functions/in-functions.md diff --git a/docs/fa/sql-reference/functions/index.md b/docs/fa/sql-reference/functions/index.md new file mode 100644 index 00000000000..6293d0cc3c5 --- /dev/null +++ b/docs/fa/sql-reference/functions/index.md @@ -0,0 +1,74 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Functions +toc_priority: 32 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# توابع {#functions} + +حداقل\* دو نوع از توابع وجود دارد - توابع به طور منظم (فقط به نام “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn’t depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). + +در این بخش ما در مورد توابع به طور منظم. برای توابع کل, بخش را ببینید “Aggregate functions”. + +\* - یک نوع سوم از تابع که وجود دارد ‘arrayJoin’ توابع جدول همچنین می توانید به طور جداگانه ذکر شود.\* + +## تایپ قوی {#strong-typing} + +در مقابل به گذاشتن استاندارد, خانه رعیتی است تایپ قوی. به عبارت دیگر تبدیل ضمنی بین انواع را ندارد. هر تابع برای یک مجموعه خاص از انواع کار می کند. این به این معنی است که گاهی اوقات شما نیاز به استفاده از توابع تبدیل نوع. + +## رفع ضعف مشترک {#common-subexpression-elimination} + +همه عبارات در پرس و جو که همان اعضای هیات (همان رکورد و یا همان نتیجه تجزیه نحوی) در نظر گرفته به ارزش یکسان. چنین عبارات یک بار تایید و اجرا می شوند. زیرمجموعه های یکسان نیز این راه را حذف می کنند. + +## انواع نتایج {#types-of-results} + +همه توابع بازگشت بازگشت بازگشت تنها به عنوان نتیجه (چند ارزش نیست, و نه صفر ارزش). نوع نتیجه است که معمولا تنها با انواع استدلال تعریف, نه با ارزش. استثنا هستند tupleelement function (a.n اپراتور) و tofixedstring تابع. + +## ثابتها {#constants} + +برای سادگی, توابع خاص تنها می تواند با ثابت برای برخی از استدلال کار. مثلا, استدلال درست از اپراتور مانند باید ثابت باشد. +تقریبا تمام توابع بازگشت ثابت برای استدلال ثابت. استثنا توابع است که تولید اعداد تصادفی است. +این ‘now’ تابع مقادیر مختلف برای نمایش داده شد که در زمان های مختلف اجرا شد را برمی گرداند, اما نتیجه در نظر گرفته ثابت, از ثبات در یک پرس و جو تنها مهم است. +یک عبارت ثابت نیز ثابت در نظر گرفته (مثلا, نیمه راست اپراتور مانند را می توان از ثابت های متعدد ساخته). + +توابع را می توان به روش های مختلف برای استدلال ثابت و غیر ثابت اجرا (کد های مختلف اجرا شده است). اما نتایج برای یک ثابت و برای یک ستون واقعی حاوی تنها همان مقدار باید با یکدیگر مطابقت. + +## پردازش پوچ {#null-processing} + +توابع رفتارهای زیر را دارند: + +- اگر حداقل یکی از استدلال از تابع است `NULL` نتیجه عملکرد نیز است `NULL`. +- رفتار ویژه ای است که به صورت جداگانه در شرح هر تابع مشخص. در کد منبع کلیک این توابع `UseDefaultImplementationForNulls=false`. + +## پایداری {#constancy} + +Functions can’t change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. + +## خطا {#error-handling} + +برخی از توابع ممکن است یک استثنا پرتاب اگر داده نامعتبر است. در این مورد پرس و جو لغو شده است و یک متن خطا به مشتری بازگردانده می شود. برای پردازش توزیع, هنگامی که یک استثنا در یکی از سرورهای رخ می دهد, سرور های دیگر نیز تلاش برای لغو پرس و جو. + +## ارزیابی عبارات استدلال {#evaluation-of-argument-expressions} + +تقریبا در تمام زبان های برنامه نویسی, یکی از استدلال ممکن است برای اپراتورهای خاص ارزیابی نمی شود. این است که معمولا اپراتورها `&&`, `||` و `?:`. +اما در فاحشه خانه, استدلال از توابع (اپراتورهای) همیشه مورد بررسی قرار. دلیل این است که کل بخش هایی از ستون ها در یک بار مورد بررسی قرار, به جای محاسبه هر سطر به طور جداگانه. + +## انجام توابع برای پردازش پرس و جو توزیع شده {#performing-functions-for-distributed-query-processing} + +برای پردازش پرس و جو توزیع, به عنوان بسیاری از مراحل پردازش پرس و جو که ممکن است بر روی سرور از راه دور انجام, و بقیه مراحل (ادغام نتایج متوسط و همه چیز که) بر روی سرور درخواست انجام. + +این به این معنی است که توابع را می توان بر روی سرور های مختلف انجام می شود. +برای مثال در پرس و جو `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` + +- اگر یک `distributed_table` دارای حداقل دو خرده ریز, توابع ‘g’ و ‘h’ بر روی سرورهای راه دور و عملکرد انجام می شود ‘f’ بر روی سرور درخواست کننده انجام می شود. +- اگر یک `distributed_table` تنها یک سفال, تمام ‘f’, ‘g’ و ‘h’ توابع بر روی سرور این سفال انجام. + +نتیجه یک تابع معمولا بستگی ندارد که سرور انجام شده است. اما گاهی اوقات این مهم است. +مثلا, توابع است که با لغت نامه کار استفاده از فرهنگ لغت که بر روی سرور وجود دارد که در حال اجرا هستند در. +مثال دیگر این است که `hostName` تابع, که نام سرور را بر می گرداند در حال اجرا است به منظور ایجاد `GROUP BY` توسط سرور در یک `SELECT` پرس و جو. + +اگر یک تابع در یک پرس و جو بر روی سرور درخواست انجام, اما شما نیاز به انجام این کار بر روی سرور از راه دور, شما می توانید در یک بسته بندی ‘any’ تابع جمع و یا اضافه کردن به یک کلید در `GROUP BY`. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/fa/sql-reference/functions/introspection.md b/docs/fa/sql-reference/functions/introspection.md new file mode 100644 index 00000000000..26e1ebd781e --- /dev/null +++ b/docs/fa/sql-reference/functions/introspection.md @@ -0,0 +1,310 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 65 +toc_title: "\u062F\u0631\u0648\u0646 \u0646\u06AF\u0631\u06CC" +--- + +# توابع درون گرایی {#introspection-functions} + +شما می توانید توابع شرح داده شده در این فصل به درون نگری استفاده کنید [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) و [DWARF](https://en.wikipedia.org/wiki/DWARF) برای پروفایل پرس و جو. + +!!! warning "اخطار" + این توابع کند هستند و ممکن است ملاحظات امنیتی تحمیل کنند. + +برای بهره برداری مناسب از توابع درون گرایی: + +- نصب `clickhouse-common-static-dbg` بسته + +- تنظیم [اجازه دادن به \_فعال کردن اختلال در عملکرد](../../operations/settings/settings.md#settings-allow_introspection_functions) تنظیم به 1. + + For security reasons introspection functions are disabled by default. + +تاتر موجب صرفه جویی در گزارش نیمرخ به [\_قطع](../../operations/system-tables.md#system_tables-trace_log) جدول سیستم. اطمینان حاصل کنید که جدول و پیشفیلتر به درستی پیکربندی شده است. + +## افزودن مدخل جدید {#addresstoline} + +تبدیل آدرس حافظه مجازی در داخل clickhouse فرایند سرور به نام فایل و شماره خط در clickhouse کد منبع. + +اگر شما استفاده از بسته های رسمی تاتر, شما نیاز به نصب `clickhouse-common-static-dbg` بسته + +**نحو** + +``` sql +addressToLine(address_of_binary_instruction) +``` + +**پارامترها** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**مقدار بازگشتی** + +- نام فایل کد منبع و شماره خط در این فایل حد و مرز مشخصی توسط روده بزرگ. + + For example, `/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199`, where `199` is a line number. + +- نام یک باینری, اگر تابع می تواند اطلاعات اشکال زدایی پیدا کنید. + +- رشته خالی, اگر نشانی معتبر نیست. + +نوع: [رشته](../../sql-reference/data-types/string.md). + +**مثال** + +فعال کردن توابع درون گرایی: + +``` sql +SET allow_introspection_functions=1 +``` + +انتخاب رشته اول از `trace_log` جدول سیستم: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-19 +event_time: 2019-11-19 18:57:23 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 421b6855-1858-45a5-8f37-f383409d6d72 +trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] +``` + +این `trace` درست شامل ردیابی پشته در حال حاضر نمونه برداری. + +گرفتن نام فایل کد منبع و شماره خط برای یک نشانی واحد: + +``` sql +SELECT addressToLine(94784076370703) \G +``` + +``` text +Row 1: +────── +addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 +``` + +استفاده از تابع به ردیابی کل پشته: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines +FROM system.trace_log +LIMIT 1 +\G +``` + +این [اررایماپ](higher-order-functions.md#higher_order_functions-array-map) تابع اجازه می دهد تا برای پردازش هر عنصر منحصر به فرد از `trace` تنظیم توسط `addressToLine` تابع. در نتیجه این پردازش می بینید در `trace_source_code_lines` ستون خروجی. + +``` text +Row 1: +────── +trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so +/usr/lib/debug/usr/bin/clickhouse +/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 +/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.h:155 +/usr/include/c++/9/bits/atomic_base.h:551 +/usr/lib/debug/usr/bin/clickhouse +/lib/x86_64-linux-gnu/libpthread-2.27.so +/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 +``` + +## افزودن موقعیت {#addresstosymbol} + +تبدیل آدرس حافظه مجازی در داخل clickhouse سرور روند به نمادی از clickhouse شی فایل های. + +**نحو** + +``` sql +addressToSymbol(address_of_binary_instruction) +``` + +**پارامترها** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**مقدار بازگشتی** + +- نمادی از clickhouse شی فایل های. +- رشته خالی, اگر نشانی معتبر نیست. + +نوع: [رشته](../../sql-reference/data-types/string.md). + +**مثال** + +فعال کردن توابع درون گرایی: + +``` sql +SET allow_introspection_functions=1 +``` + +انتخاب رشته اول از `trace_log` جدول سیستم: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +این `trace` درست شامل ردیابی پشته در حال حاضر نمونه برداری. + +گرفتن نماد برای یک نشانی واحد: + +``` sql +SELECT addressToSymbol(94138803686098) \G +``` + +``` text +Row 1: +────── +addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +``` + +استفاده از تابع به ردیابی کل پشته: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols +FROM system.trace_log +LIMIT 1 +\G +``` + +این [اررایماپ](higher-order-functions.md#higher_order_functions-array-map) تابع اجازه می دهد تا برای پردازش هر عنصر منحصر به فرد از `trace` تنظیم توسط `addressToSymbols` تابع. نتیجه این پردازش شما در دیدن `trace_symbols` ستون خروجی. + +``` text +Row 1: +────── +trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE +_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb +_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb +_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE +_ZN2DB27AggregatingBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB28AsynchronousBlockInputStream9calculateEv +_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data +_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E +_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv +_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E +execute_native_thread_routine +start_thread +clone +``` + +## درهم و برهم کردن {#demangle} + +تبدیل یک نماد است که شما می توانید با استفاده از [افزودن موقعیت](#addresstosymbol) تابع به ج++ نام تابع. + +**نحو** + +``` sql +demangle(symbol) +``` + +**پارامترها** + +- `symbol` ([رشته](../../sql-reference/data-types/string.md)) — Symbol from an object file. + +**مقدار بازگشتی** + +- نام تابع ج++. +- رشته خالی اگر یک نماد معتبر نیست. + +نوع: [رشته](../../sql-reference/data-types/string.md). + +**مثال** + +فعال کردن توابع درون گرایی: + +``` sql +SET allow_introspection_functions=1 +``` + +انتخاب رشته اول از `trace_log` جدول سیستم: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +این `trace` زمینه شامل ردیابی پشته در لحظه نمونه برداری. + +گرفتن نام تابع برای یک نشانی واحد: + +``` sql +SELECT demangle(addressToSymbol(94138803686098)) \G +``` + +``` text +Row 1: +────── +demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +``` + +استفاده از تابع به ردیابی کل پشته: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions +FROM system.trace_log +LIMIT 1 +\G +``` + +این [اررایماپ](higher-order-functions.md#higher_order_functions-array-map) تابع اجازه می دهد تا برای پردازش هر عنصر منحصر به فرد از `trace` تنظیم توسط `demangle` تابع. در نتیجه این پردازش می بینید در `trace_functions` ستون خروجی. + +``` text +Row 1: +────── +trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const +DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) +DB::AggregatingBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::AsynchronousBlockInputStream::calculate() +std::_Function_handler::_M_invoke(std::_Any_data const&) +ThreadPoolImpl::worker(std::_List_iterator) +ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const +ThreadPoolImpl::worker(std::_List_iterator) +execute_native_thread_routine +start_thread +clone +``` diff --git a/docs/fa/sql-reference/functions/ip-address-functions.md b/docs/fa/sql-reference/functions/ip-address-functions.md new file mode 100644 index 00000000000..3b19334af4b --- /dev/null +++ b/docs/fa/sql-reference/functions/ip-address-functions.md @@ -0,0 +1,249 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 55 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0646\u0634\u0627\u0646\u06CC\u0647\u0627\ + \u06CC \u0627\u06CC\u0646\u062A\u0631\u0646\u062A\u06CC" +--- + +# توابع برای کار با نشانی های اینترنتی {#functions-for-working-with-ip-addresses} + +## اطلاعات دقیق) {#ipv4numtostringnum} + +طول می کشد یک uint32 شماره. به عنوان یک نشانی اینترنتی 4 در اندی بزرگ تفسیر می کند. بازده یک رشته حاوی مربوطه آدرس ipv4 در قالب a. b. c. d (نقطه جدا کردن اعداد در شکل اعشاری). + +## مدت 4 ساعت) {#ipv4stringtonums} + +عملکرد معکوس ایپو4نومتوسترینگ. اگر نشانی اینترنتی4 دارای یک فرمت نامعتبر, باز می گردد 0. + +## اطلاعات دقیق) {#ipv4numtostringclasscnum} + +شبیه به ipv4numtostring اما با استفاده از \ به جای گذشته هشت تایی. + +مثال: + +``` sql +SELECT + IPv4NumToStringClassC(ClientIP) AS k, + count() AS c +FROM test.hits +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─k──────────────┬─────c─┐ +│ 83.149.9.xxx │ 26238 │ +│ 217.118.81.xxx │ 26074 │ +│ 213.87.129.xxx │ 25481 │ +│ 83.149.8.xxx │ 24984 │ +│ 217.118.83.xxx │ 22797 │ +│ 78.25.120.xxx │ 22354 │ +│ 213.87.131.xxx │ 21285 │ +│ 78.25.121.xxx │ 20887 │ +│ 188.162.65.xxx │ 19694 │ +│ 83.149.48.xxx │ 17406 │ +└────────────────┴───────┘ +``` + +از زمان استفاده ‘xxx’ بسیار غیر معمول است, این ممکن است در اینده تغییر. ما توصیه می کنیم که شما در قالب دقیق این قطعه تکیه نمی. + +### اطلاعات دقیق) {#ipv6numtostringx} + +یک رشته ثابت(16) مقدار حاوی نشانی اینترنتی6 را در قالب باینری می پذیرد. بازگرداندن یک رشته حاوی این نشانی در قالب متن. +نشانی های ایپو6-نقشه برداری ایپو4 خروجی در قالب هستند:: افف:111.222.33.44. مثالها: + +``` sql +SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr +``` + +``` text +┌─addr─────────┐ +│ 2a02:6b8::11 │ +└──────────────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ +│ 2a02:2168:aaa:bbbb::2 │ 24695 │ +│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ +│ 2a02:6b8:0:fff::ff │ 16389 │ +│ 2a01:4f8:111:6666::2 │ 16016 │ +│ 2a02:2168:888:222::1 │ 15896 │ +│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ +│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ +│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ +│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ +│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ +└─────────────────────────────────────────┴───────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)─┬──────c─┐ +│ ::ffff:94.26.111.111 │ 747440 │ +│ ::ffff:37.143.222.4 │ 529483 │ +│ ::ffff:5.166.111.99 │ 317707 │ +│ ::ffff:46.38.11.77 │ 263086 │ +│ ::ffff:79.105.111.111 │ 186611 │ +│ ::ffff:93.92.111.88 │ 176773 │ +│ ::ffff:84.53.111.33 │ 158709 │ +│ ::ffff:217.118.11.22 │ 154004 │ +│ ::ffff:217.118.11.33 │ 148449 │ +│ ::ffff:217.118.11.44 │ 148243 │ +└────────────────────────────┴────────┘ +``` + +## مدت 6 ساعت) {#ipv6stringtonums} + +عملکرد معکوس ایپو6نومتوسترینگ. اگر نشانی اینترنتی6 دارای یک فرمت نامعتبر, یک رشته از بایت پوچ را برمی گرداند. +سحر و جادو می تواند بزرگ یا کوچک. + +## IPv4ToIPv6(x) {#ipv4toipv6x} + +طول می کشد یک `UInt32` شماره. تفسیر به عنوان یک نشانی اینترنتی4 در [اندی بزرگ](https://en.wikipedia.org/wiki/Endianness). بازگرداندن یک `FixedString(16)` مقدار حاوی نشانی اینترنتی6 در قالب دودویی. مثالها: + +``` sql +SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr +``` + +``` text +┌─addr───────────────┐ +│ ::ffff:192.168.0.1 │ +└────────────────────┘ +``` + +## cutIPv6(x bitsToCutForIPv6, bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} + +یک رشته ثابت(16) مقدار حاوی نشانی اینترنتی6 را در قالب باینری می پذیرد. بازگرداندن یک رشته حاوی نشانی از تعداد مشخصی از بیت در قالب متن حذف. به عنوان مثال: + +``` sql +WITH + IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, + IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 +SELECT + cutIPv6(ipv6, 2, 0), + cutIPv6(ipv4, 0, 2) +``` + +``` text +┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ +│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ +└─────────────────────────────────────┴─────────────────────┘ +``` + +## IPv4CIDRToRange(ipv4, Cidr), {#ipv4cidrtorangeipv4-cidr} + +قبول یک ipv4 و uint8 ارزش شامل [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). یک تاپل را با دو لیگ4 حاوی محدوده پایین تر و محدوده بالاتر زیر شبکه باز کنید. + +``` sql +SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) +``` + +``` text +┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ +│ ('192.168.0.0','192.168.255.255') │ +└────────────────────────────────────────────┘ +``` + +## IPv6CIDRToRange(ipv6 Cidr), {#ipv6cidrtorangeipv6-cidr} + +قبول یک ipv6 و uint8 ارزش حاوی cidr. یک تاپل را با دو ایپو6 حاوی محدوده پایین تر و محدوده بالاتر زیر شبکه باز کنید. + +``` sql +SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); +``` + +``` text +┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ +│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ +└────────────────────────────────────────────────────────────────────────┘ +``` + +## تایپه 4 (رشته) {#toipv4string} + +یک نام مستعار برای `IPv4StringToNum()` که طول می کشد یک شکل رشته ای از ایپو4 نشانی و ارزش را برمی گرداند [IPv4](../../sql-reference/data-types/domains/ipv4.md) نوع باینری برابر با مقدار بازگشتی است `IPv4StringToNum()`. + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + toTypeName(IPv4StringToNum(IPv4_string)), + toTypeName(toIPv4(IPv4_string)) +``` + +``` text +┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ +│ UInt32 │ IPv4 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + hex(IPv4StringToNum(IPv4_string)), + hex(toIPv4(IPv4_string)) +``` + +``` text +┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ +│ ABE1822D │ ABE1822D │ +└───────────────────────────────────┴──────────────────────────┘ +``` + +## تیپو6 (رشته) {#toipv6string} + +یک نام مستعار برای `IPv6StringToNum()` که طول می کشد یک شکل رشته ای از ایپو6 نشانی و ارزش را برمی گرداند [IPv6](../../sql-reference/data-types/domains/ipv6.md) نوع باینری برابر با مقدار بازگشتی است `IPv6StringToNum()`. + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + toTypeName(IPv6StringToNum(IPv6_string)), + toTypeName(toIPv6(IPv6_string)) +``` + +``` text +┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ +│ FixedString(16) │ IPv6 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + hex(IPv6StringToNum(IPv6_string)), + hex(toIPv6(IPv6_string)) +``` + +``` text +┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ +│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ +└───────────────────────────────────┴──────────────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/fa/sql-reference/functions/json-functions.md b/docs/fa/sql-reference/functions/json-functions.md new file mode 100644 index 00000000000..ef06b6d599d --- /dev/null +++ b/docs/fa/sql-reference/functions/json-functions.md @@ -0,0 +1,231 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 56 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u062C\u0627\u0646\u0633\u0648\u0646." +--- + +# توابع برای کار با جانسون {#functions-for-working-with-json} + +در یاندکسمتریکا جیسون توسط کاربران به عنوان پارامترهای جلسه منتقل می شود. برخی از توابع خاص برای کار با این جانسون وجود دارد. (اگر چه در بسیاری از موارد jsons هستند علاوه بر این قبل از پردازش و در نتیجه ارزش ها قرار داده و در ستون جداگانه در خود پردازش فرمت.) همه این توابع در فرضیات قوی در مورد چه جانسون می تواند بر اساس, اما سعی می کنند به عنوان کوچک که ممکن است به کار انجام می شود. + +مفروضات زیر ساخته شده است: + +1. نام فیلد (استدلال تابع) باید ثابت باشد. +2. نام فیلد به نحوی می تواند در جیسون کد گذاری شود. به عنوان مثال: `visitParamHas('{"abc":"def"}', 'abc') = 1` اما `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` +3. زمینه ها برای در هر سطح تودرتو جستجو, یکسره. اگر زمینه های تطبیق های متعدد وجود دارد, وقوع اول استفاده شده است. +4. JSON ندارد کاراکتر فضای خارج از string literals. + +## ویسیتپراماس (پارامز, نام) {#visitparamhasparams-name} + +بررسی اینکه یک میدان با وجود ‘name’ اسم. + +## ویسیتپرامستراکتینت (پارامز, نام) {#visitparamextractuintparams-name} + +تجزیه ظاهری64 از ارزش این زمینه به نام ‘name’. اگر این یک رشته رشته زمینه, تلاش می کند به تجزیه یک عدد از ابتدای رشته. اگر میدان وجود ندارد, و یا وجود دارد اما حاوی یک عدد نیست, باز می گردد 0. + +## ویزیتپرامستراکتینت (پارامز, نام) {#visitparamextractintparams-name} + +همان int64. + +## اطلاعات دقیق) {#visitparamextractfloatparams-name} + +همان است که برای شناور64. + +## ویسیتپرامسترکتبولبولول (پارامز, نام) {#visitparamextractboolparams-name} + +تجزیه واقعی / ارزش کاذب. نتیجه این است uint8. + +## ویسیتپرمککتراو (پارامز, نام) {#visitparamextractrawparams-name} + +بازگرداندن ارزش یک میدان, از جمله جدا. + +مثالها: + +``` sql +visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' +visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' +``` + +## نام و نام خانوادگی) {#visitparamextractstringparams-name} + +تجزیه رشته در نقل قول دو. ارزش بی نتیجه است. اگر بیم شکست خورده, این یک رشته خالی می گرداند. + +مثالها: + +``` sql +visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' +visitParamExtractString('{"abc":"hello}', 'abc') = '' +``` + +در حال حاضر هیچ پشتیبانی برای نقاط کد در قالب وجود دارد `\uXXXX\uYYYY` این از هواپیما چند زبانه پایه نیست (به جای اوتو-8 تبدیل می شود). + +توابع زیر بر اساس [سیمدجسون](https://github.com/lemire/simdjson) طراحی شده برای نیازهای پیچیده تر جسون تجزیه. فرض 2 ذکر شده در بالا هنوز هم صدق. + +## هشدار داده می شود) {#isvalidjsonjson} + +چک که رشته گذشت جانسون معتبر است. + +مثالها: + +``` sql +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} + +اگر مقدار در سند جسون وجود داشته باشد, `1` برگردانده خواهد شد. + +اگر این مقدار وجود ندارد, `0` برگردانده خواهد شد. + +مثالها: + +``` sql +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 +``` + +`indices_or_keys` لیستی از استدلال های صفر یا بیشتر است که هر کدام می توانند رشته یا عدد صحیح باشند. + +- رشته = عضو شی دسترسی های کلیدی. +- عدد صحیح مثبت = از ابتدا به عضو / کلید نفر دسترسی پیدا کنید. +- عدد صحیح منفی = دسترسی به عضو / کلید نفر از پایان. + +حداقل شاخص عنصر 1 است. بنابراین عنصر 0 وجود ندارد. + +شما می توانید از اعداد صحیح برای دسترسی به هر دو اشیای جسون ارریس و جسون استفاده کنید. + +بنابراین, مثلا: + +``` sql +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' +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} + +بازگشت طول یک مجموعه جانسون یا یک شی جانسون. + +اگر مقدار وجود ندارد و یا دارای یک نوع اشتباه, `0` برگردانده خواهد شد. + +مثالها: + +``` sql +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} + +بازگشت به نوع یک مقدار جانسون. + +اگر این مقدار وجود ندارد, `Null` برگردانده خواهد شد. + +مثالها: + +``` sql +SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' +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} + +## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} + +## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} + +## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} + +تجزیه جانسون و استخراج ارزش. این توابع شبیه به `visitParam` توابع. + +اگر مقدار وجود ندارد و یا دارای یک نوع اشتباه, `0` برگردانده خواهد شد. + +مثالها: + +``` sql +SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 +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} + +تجزیه جانسون و استخراج یک رشته. این تابع شبیه به `visitParamExtractString` توابع. + +اگر مقدار وجود ندارد و یا دارای یک نوع اشتباه, یک رشته خالی بازگردانده خواهد شد. + +ارزش بی نتیجه است. اگر بیم شکست خورده, این یک رشته خالی می گرداند. + +مثالها: + +``` sql +SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' +SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' +SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' +``` + +## JSONExtract(json\[, indices\_or\_keys…\], Return\_type) {#jsonextractjson-indices-or-keys-return-type} + +تجزیه یک جسون و استخراج یک مقدار از نوع داده داده داده کلیک. + +این یک تعمیم قبلی است `JSONExtract` توابع. +این به این معنی است +`JSONExtract(..., 'String')` بازده دقیقا همان `JSONExtractString()`, +`JSONExtract(..., 'Float64')` بازده دقیقا همان `JSONExtractFloat()`. + +مثالها: + +``` sql +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL +SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 +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} + +پارسه جفت کلید ارزش از یک جانسون که ارزش از نوع داده داده خانه رعیتی هستند. + +مثال: + +``` sql +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} + +بازگرداندن بخشی از جانسون. + +اگر بخش وجود ندارد و یا دارای یک نوع اشتباه, یک رشته خالی بازگردانده خواهد شد. + +مثال: + +``` sql +SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' +``` + +## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} + +بازگرداندن مجموعه ای با عناصر از مجموعه جانسون,هر یک به عنوان رشته نامحدود نشان. + +اگر بخش وجود ندارد و یا مجموعه ای نیست, مجموعه ای خالی بازگردانده خواهد شد. + +مثال: + +``` sql +SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/fa/sql_reference/functions/logical_functions.md b/docs/fa/sql-reference/functions/logical-functions.md similarity index 100% rename from docs/fa/sql_reference/functions/logical_functions.md rename to docs/fa/sql-reference/functions/logical-functions.md diff --git a/docs/fa/sql-reference/functions/machine-learning-functions.md b/docs/fa/sql-reference/functions/machine-learning-functions.md new file mode 100644 index 00000000000..75790643570 --- /dev/null +++ b/docs/fa/sql-reference/functions/machine-learning-functions.md @@ -0,0 +1,21 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 64 +toc_title: "\u062A\u0648\u0627\u0628\u0639 \u06CC\u0627\u062F\u06AF\u06CC\u0631\u06CC\ + \ \u0645\u0627\u0634\u06CC\u0646" +--- + +# توابع یادگیری ماشین {#machine-learning-functions} + +## ارزیابی (پیش بینی) {#machine_learning_methods-evalmlmethod} + +پیش بینی با استفاده از مدل های رگرسیون نصب شده `evalMLMethod` تابع. مشاهده لینک در `linearRegression`. + +### رگرسیون خطی تصادفی {#stochastic-linear-regression} + +این [تنظیم مقررات](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlinearregression) تابع جمع پیاده سازی روش گرادیان نزولی تصادفی با استفاده از مدل خطی و تابع از دست دادن مرتبه اول. استفاده `evalMLMethod` برای پیش بینی در داده های جدید. + +### رگرسیون لجستیک تصادفی {#stochastic-logistic-regression} + +این [سرکوب مقررات عمومی](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlogisticregression) تابع جمع پیاده سازی روش گرادیان نزولی برای مشکل طبقه بندی دودویی. استفاده `evalMLMethod` برای پیش بینی در داده های جدید. diff --git a/docs/fa/sql_reference/functions/math_functions.md b/docs/fa/sql-reference/functions/math-functions.md similarity index 100% rename from docs/fa/sql_reference/functions/math_functions.md rename to docs/fa/sql-reference/functions/math-functions.md diff --git a/docs/fa/sql-reference/functions/other-functions.md b/docs/fa/sql-reference/functions/other-functions.md new file mode 100644 index 00000000000..b0d3e097271 --- /dev/null +++ b/docs/fa/sql-reference/functions/other-functions.md @@ -0,0 +1,1079 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 66 +toc_title: "\u063A\u06CC\u0631\u0647" +--- + +# توابع دیگر {#other-functions} + +## نام میزبان() {#hostname} + +بازگرداندن یک رشته با نام میزبان که این تابع در انجام شد. برای پردازش توزیع شده, این نام میزبان سرور از راه دور است, اگر تابع بر روی یک سرور از راه دور انجام. + +## FQDN {#fqdn} + +بازگرداندن نام دامنه به طور کامل واجد شرایط. + +**نحو** + +``` sql +fqdn(); +``` + +این تابع غیر حساس است. + +**مقدار بازگشتی** + +- رشته با نام دامنه به طور کامل واجد شرایط. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT FQDN(); +``` + +نتیجه: + +``` text +┌─FQDN()──────────────────────────┐ +│ clickhouse.ru-central1.internal │ +└─────────────────────────────────┘ +``` + +## basename {#basename} + +عصاره قسمت انتهایی یک رشته پس از بریده بریده و یا ممیز گذشته. این تابع اگر اغلب مورد استفاده برای استخراج نام فایل از یک مسیر. + +``` sql +basename( expr ) +``` + +**پارامترها** + +- `expr` — Expression resulting in a [رشته](../../sql-reference/data-types/string.md) نوع ارزش. همه بک اسلش باید در ارزش حاصل فرار. + +**مقدار بازگشتی** + +یک رشته که شامل: + +- قسمت انتهایی یک رشته پس از بریده بریده و یا ممیز گذشته. + + If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. + +- رشته اصلی اگر هیچ اسلش یا بک اسلش وجود دارد. + +**مثال** + +``` sql +SELECT 'some/long/path/to/file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some\\long\\path\\to\\file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some-file-name' AS a, basename(a) +``` + +``` text +┌─a──────────────┬─basename('some-file-name')─┐ +│ some-file-name │ some-file-name │ +└────────────────┴────────────────────────────┘ +``` + +## عریض) {#visiblewidthx} + +محاسبه عرض تقریبی در هنگام خروجی ارزش به کنسول در قالب متن (تب از هم جدا). +این تابع توسط سیستم برای اجرای فرمت های زیبا استفاده می شود. + +`NULL` به عنوان یک رشته مربوط به نمایندگی `NULL` داخل `Pretty` فرمتها. + +``` sql +SELECT visibleWidth(NULL) +``` + +``` text +┌─visibleWidth(NULL)─┐ +│ 4 │ +└────────────────────┘ +``` + +## نام کامل) {#totypenamex} + +بازگرداندن یک رشته حاوی نام نوع استدلال گذشت. + +اگر `NULL` به عنوان ورودی به عملکرد منتقل می شود و سپس باز می گردد `Nullable(Nothing)` نوع, که مربوط به داخلی `NULL` نمایندگی در فاحشه خانه. + +## blockSize() {#function-blocksize} + +می شود به اندازه بلوک. +در خانه, نمایش داده شد همیشه در بلوک های اجرا (مجموعه ای از قطعات ستون). این تابع اجازه می دهد تا اندازه بلوک را که شما برای نام برد دریافت کنید. + +## تحقق (ایکس) {#materializex} + +تبدیل ثابت به یک ستون کامل حاوی فقط یک مقدار. +در خانه, ستون کامل و ثابت متفاوت در حافظه نشان. توابع کار متفاوت برای استدلال ثابت و استدلال طبیعی (کد های مختلف اجرا شده است), اگر چه نتیجه این است که تقریبا همیشه همان. این تابع برای اشکال زدایی این رفتار. + +## ignore(…) {#ignore} + +می پذیرد هر استدلال, محتوی `NULL`. همیشه برمی گرداند 0. +با این حال, استدلال هنوز ارزیابی. این را می توان برای معیار استفاده می شود. + +## خواب (ثانیه) {#sleepseconds} + +خواب ‘seconds’ ثانیه در هر بلوک داده ها. شما می توانید یک عدد صحیح یا عدد ممیز شناور را مشخص کنید. + +## خواب (ثانیه) {#sleepeachrowseconds} + +خواب ‘seconds’ ثانیه در هر سطر. شما می توانید یک عدد صحیح یا عدد ممیز شناور را مشخص کنید. + +## متن() {#currentdatabase} + +بازگرداندن نام پایگاه داده فعلی. +شما می توانید این تابع در پارامترهای موتور جدول در یک پرس و جو جدول ایجاد جایی که شما نیاز به مشخص کردن پایگاه داده استفاده. + +## currentUser() {#other-function-currentuser} + +بازده ورود به سایت از کاربر فعلی. ورود کاربر که آغاز پرس و جو بازگردانده خواهد شد در مورد distibuted پرس و جو. + +``` sql +SELECT currentUser(); +``` + +نام مستعار: `user()`, `USER()`. + +**مقادیر بازگشتی** + +- ورود کاربر فعلی. +- ورود کاربر که پرس و جو در صورت پرس و جو از کار افتاده است. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT currentUser(); +``` + +نتیجه: + +``` text +┌─currentUser()─┐ +│ default │ +└───────────────┘ +``` + +## اطلاعات دقیق) {#isfinitex} + +قبول float32 و float64 و بازده uint8 برابر با 1 اگر این استدلال بی نهایت است و نه یک نان در غیر این صورت 0 است. + +## اطلاعات دقیق) {#isinfinitex} + +قبول float32 و float64 و بازده uint8 برابر با 1 اگر این استدلال بی نهایت است در غیر این صورت 0 است. توجه داشته باشید که 0 برای نان بازگشت. + +## اطلاعات دقیق {#ifnotfinite} + +بررسی اینکه مقدار ممیز شناور محدود است. + +**نحو** + + ifNotFinite(x,y) + +**پارامترها** + +- `x` — Value to be checked for infinity. Type: [شناور\*](../../sql-reference/data-types/float.md). +- `y` — Fallback value. Type: [شناور\*](../../sql-reference/data-types/float.md). + +**مقدار بازگشتی** + +- `x` اگر `x` محدود است. +- `y` اگر `x` محدود نیست. + +**مثال** + +پرسوجو: + + SELECT 1/0 as infimum, ifNotFinite(infimum,42) + +نتیجه: + + ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ + │ inf │ 42 │ + └─────────┴───────────────────────────────┘ + +شما می توانید نتیجه مشابه با استفاده از [اپراتور سه تایی](conditional-functions.md#ternary-operator): `isFinite(x) ? x : y`. + +## اطلاعات دقیق) {#isnanx} + +قبول float32 و float64 و بازده uint8 برابر با 1 اگر استدلال این است که یک نان در غیر این صورت 0 است. + +## قابل تنظیم(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} + +می پذیرد رشته ثابت: نام پایگاه داده, نام جدول, و نام ستون. بازگرداندن یک بیان ثابت سنت8 برابر 1 اگر یک ستون وجود دارد, در غیر این صورت 0. اگر پارامتر نام میزبان تنظیم شده است, تست بر روی یک سرور از راه دور اجرا خواهد شد. +تابع می اندازد یک استثنا اگر جدول وجود ندارد. +برای عناصر در یک ساختار داده های تو در تو, تابع چک برای وجود یک ستون. برای ساختار داده های تو در تو خود, بازده تابع 0. + +## بار {#function-bar} + +اجازه می دهد تا ساخت یک نمودار یونیکد هنر. + +`bar(x, min, max, width)` تساوی یک گروه با عرض متناسب با `(x - min)` و برابر با `width` شخصیت زمانی که `x = max`. + +پارامترها: + +- `x` — Size to display. +- `min, max` — Integer constants. The value must fit in `Int64`. +- `width` — Constant, positive integer, can be fractional. + +گروه با دقت به یک هشتم نماد کشیده شده است. + +مثال: + +``` sql +SELECT + toHour(EventTime) AS h, + count() AS c, + bar(c, 0, 600000, 20) AS bar +FROM test.hits +GROUP BY h +ORDER BY h ASC +``` + +``` text +┌──h─┬──────c─┬─bar────────────────┐ +│ 0 │ 292907 │ █████████▋ │ +│ 1 │ 180563 │ ██████ │ +│ 2 │ 114861 │ ███▋ │ +│ 3 │ 85069 │ ██▋ │ +│ 4 │ 68543 │ ██▎ │ +│ 5 │ 78116 │ ██▌ │ +│ 6 │ 113474 │ ███▋ │ +│ 7 │ 170678 │ █████▋ │ +│ 8 │ 278380 │ █████████▎ │ +│ 9 │ 391053 │ █████████████ │ +│ 10 │ 457681 │ ███████████████▎ │ +│ 11 │ 493667 │ ████████████████▍ │ +│ 12 │ 509641 │ ████████████████▊ │ +│ 13 │ 522947 │ █████████████████▍ │ +│ 14 │ 539954 │ █████████████████▊ │ +│ 15 │ 528460 │ █████████████████▌ │ +│ 16 │ 539201 │ █████████████████▊ │ +│ 17 │ 523539 │ █████████████████▍ │ +│ 18 │ 506467 │ ████████████████▊ │ +│ 19 │ 520915 │ █████████████████▎ │ +│ 20 │ 521665 │ █████████████████▍ │ +│ 21 │ 542078 │ ██████████████████ │ +│ 22 │ 493642 │ ████████████████▍ │ +│ 23 │ 400397 │ █████████████▎ │ +└────┴────────┴────────────────────┘ +``` + +## تبدیل {#transform} + +تبدیل یک ارزش با توجه به نقشه برداری به صراحت تعریف شده از برخی از عناصر به دیگر. +دو نوع از این تابع وجود دارد: + +### تبدیل(x array\_from, array\_to به طور پیش فرض) {#transformx-array-from-array-to-default} + +`x` – What to transform. + +`array_from` – Constant array of values for converting. + +`array_to` – Constant array of values to convert the values in ‘from’ به. + +`default` – Which value to use if ‘x’ برابر است با هر یک از مقادیر در ‘from’. + +`array_from` و `array_to` – Arrays of the same size. + +انواع: + +`transform(T, Array(T), Array(U), U) -> U` + +`T` و `U` می تواند عددی, رشته,یا تاریخ و یا انواع تاریخ ساعت. +از کجا همان نامه نشان داده شده است (تی یا تو), برای انواع عددی این ممکن است تطبیق انواع, اما انواع که یک نوع رایج. +برای مثال استدلال می توانید نوع int64 در حالی که دوم آرایه(uint16) نوع. + +اگر ‘x’ ارزش به یکی از عناصر در برابر است ‘array\_from’ مجموعه, این بازگرداندن عنصر موجود (که شماره همان) از ‘array\_to’ صف کردن. در غیر این صورت, باز می گردد ‘default’. اگر عناصر تطبیق های متعدد در وجود دارد ‘array\_from’ این یکی از مسابقات را برمی گرداند. + +مثال: + +``` sql +SELECT + transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, + count() AS c +FROM test.hits +WHERE SearchEngineID != 0 +GROUP BY title +ORDER BY c DESC +``` + +``` text +┌─title─────┬──────c─┐ +│ Yandex │ 498635 │ +│ Google │ 229872 │ +│ Other │ 104472 │ +└───────────┴────────┘ +``` + +### تبدیل) {#transformx-array-from-array-to} + +متفاوت از تنوع برای اولین بار در که ‘default’ استدلال حذف شده است. +اگر ‘x’ ارزش به یکی از عناصر در برابر است ‘array\_from’ مجموعه, این بازگرداندن عنصر تطبیق (که شماره همان) از ‘array\_to’ صف کردن. در غیر این صورت, باز می گردد ‘x’. + +انواع: + +`transform(T, Array(T), Array(T)) -> T` + +مثال: + +``` sql +SELECT + transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, + count() AS c +FROM test.hits +GROUP BY domain(Referer) +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +┌─s──────────────┬───────c─┐ +│ │ 2906259 │ +│ www.yandex │ 867767 │ +│ ███████.ru │ 313599 │ +│ mail.yandex.ru │ 107147 │ +│ ██████.ru │ 100355 │ +│ █████████.ru │ 65040 │ +│ news.yandex.ru │ 64515 │ +│ ██████.net │ 59141 │ +│ example.com │ 57316 │ +└────────────────┴─────────┘ +``` + +## قالببندی) ایکس() {#formatreadablesizex} + +می پذیرد اندازه (تعداد بایت). بازگرداندن اندازه گرد با پسوند (کیلوبایت, مگابایت, و غیره.) به عنوان یک رشته . + +مثال: + +``` sql +SELECT + arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, + formatReadableSize(filesize_bytes) AS filesize +``` + +``` text +┌─filesize_bytes─┬─filesize───┐ +│ 1 │ 1.00 B │ +│ 1024 │ 1.00 KiB │ +│ 1048576 │ 1.00 MiB │ +│ 192851925 │ 183.92 MiB │ +└────────────────┴────────────┘ +``` + +## کمترین) {#leasta-b} + +بازگرداندن کوچکترین ارزش از یک و ب. + +## بزرگترین (و, ب) {#greatesta-b} + +بازگرداندن بزرگترین ارزش یک و ب. + +## زمان بالا() {#uptime} + +بازگرداندن زمان انجام کار سرور در ثانیه. + +## نسخه() {#version} + +بازگرداندن نسخه از سرور به عنوان یک رشته. + +## منطقهی زمانی() {#timezone} + +بازگرداندن منطقه زمانی از سرور. + +## blockNumber {#blocknumber} + +بازگرداندن تعداد دنباله ای از بلوک داده که در ردیف واقع شده است. + +## رفع موانع {#function-rownumberinblock} + +بازگرداندن تعداد ترتیبی از ردیف در بلوک داده. بلوک های داده های مختلف همیشه محاسبه. + +## بلوک های رونمبرینالیک() {#rownumberinallblocks} + +بازگرداندن تعداد ترتیبی از ردیف در بلوک داده. این تابع تنها بلوک های داده تحت تاثیر قرار می گیرد. + +## همسایه {#neighbor} + +تابع پنجره که دسترسی به یک ردیف در یک افست مشخص شده است که قبل یا بعد از ردیف فعلی یک ستون داده می شود فراهم می کند. + +**نحو** + +``` sql +neighbor(column, offset[, default_value]) +``` + +نتیجه عملکرد بستگی به بلوک های داده تحت تاثیر قرار و منظور از داده ها در بلوک. +اگر شما یک خرده فروشی با سفارش و پاسخ تابع از خارج از خرده فروشی, شما می توانید نتیجه مورد انتظار از. + +**پارامترها** + +- `column` — A column name or scalar expression. +- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql-reference/data-types/int-uint.md). +- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. + +**مقادیر بازگشتی** + +- مقدار برای `column` داخل `offset` فاصله از ردیف فعلی اگر `offset` ارزش خارج از مرزهای بلوک نیست. +- مقدار پیشفرض برای `column` اگر `offset` ارزش مرزهای بلوک خارج است. اگر `default_value` داده می شود و سپس از آن استفاده خواهد شد. + +نوع: نوع بلوک های داده را تحت تاثیر قرار و یا نوع مقدار پیش فرض. + +**مثال** + +پرسوجو: + +``` sql +SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; +``` + +نتیجه: + +``` text +┌─number─┬─neighbor(number, 2)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 0 │ +│ 9 │ 0 │ +└────────┴─────────────────────┘ +``` + +پرسوجو: + +``` sql +SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; +``` + +نتیجه: + +``` text +┌─number─┬─neighbor(number, 2, 999)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 999 │ +│ 9 │ 999 │ +└────────┴──────────────────────────┘ +``` + +این تابع می تواند مورد استفاده قرار گیرد برای محاسبه ارزش متریک در سال بیش از سال: + +پرسوجو: + +``` sql +WITH toDate('2018-01-01') AS start_date +SELECT + toStartOfMonth(start_date + (number * 32)) AS month, + toInt32(month) % 100 AS money, + neighbor(money, -12) AS prev_year, + round(prev_year / money, 2) AS year_over_year +FROM numbers(16) +``` + +نتیجه: + +``` text +┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ +│ 2018-01-01 │ 32 │ 0 │ 0 │ +│ 2018-02-01 │ 63 │ 0 │ 0 │ +│ 2018-03-01 │ 91 │ 0 │ 0 │ +│ 2018-04-01 │ 22 │ 0 │ 0 │ +│ 2018-05-01 │ 52 │ 0 │ 0 │ +│ 2018-06-01 │ 83 │ 0 │ 0 │ +│ 2018-07-01 │ 13 │ 0 │ 0 │ +│ 2018-08-01 │ 44 │ 0 │ 0 │ +│ 2018-09-01 │ 75 │ 0 │ 0 │ +│ 2018-10-01 │ 5 │ 0 │ 0 │ +│ 2018-11-01 │ 36 │ 0 │ 0 │ +│ 2018-12-01 │ 66 │ 0 │ 0 │ +│ 2019-01-01 │ 97 │ 32 │ 0.33 │ +│ 2019-02-01 │ 28 │ 63 │ 2.25 │ +│ 2019-03-01 │ 56 │ 91 │ 1.62 │ +│ 2019-04-01 │ 87 │ 22 │ 0.25 │ +└────────────┴───────┴───────────┴────────────────┘ +``` + +## تغییر تنظیمات صدا) {#other_functions-runningdifference} + +Calculates the difference between successive row values ​​in the data block. +بازده 0 برای ردیف اول و تفاوت از ردیف قبلی برای هر سطر بعدی. + +نتیجه عملکرد بستگی به بلوک های داده تحت تاثیر قرار و منظور از داده ها در بلوک. +اگر شما یک خرده فروشی با سفارش و پاسخ تابع از خارج از خرده فروشی, شما می توانید نتیجه مورد انتظار از. + +مثال: + +``` sql +SELECT + EventID, + EventTime, + runningDifference(EventTime) AS delta +FROM +( + SELECT + EventID, + EventTime + FROM events + WHERE EventDate = '2016-11-24' + ORDER BY EventTime ASC + LIMIT 5 +) +``` + +``` text +┌─EventID─┬───────────EventTime─┬─delta─┐ +│ 1106 │ 2016-11-24 00:00:04 │ 0 │ +│ 1107 │ 2016-11-24 00:00:05 │ 1 │ +│ 1108 │ 2016-11-24 00:00:05 │ 0 │ +│ 1109 │ 2016-11-24 00:00:09 │ 4 │ +│ 1110 │ 2016-11-24 00:00:10 │ 1 │ +└─────────┴─────────────────────┴───────┘ +``` + +لطفا توجه داشته باشید-اندازه بلوک بر نتیجه تاثیر می گذارد. با هر بلوک جدید `runningDifference` دولت تنظیم مجدد است. + +``` sql +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +┌─number─┬─diff─┐ +│ 65536 │ 0 │ +└────────┴──────┘ +``` + +``` sql +set max_block_size=100000 -- default value is 65536! + +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +``` + +## در حال بارگذاری {#runningdifferencestartingwithfirstvalue} + +همان است که برای [عدم پذیرش](./other-functions.md#other_functions-runningdifference), تفاوت ارزش ردیف اول است, ارزش سطر اول بازگشت, و هر سطر بعدی تفاوت از ردیف قبلی را برمی گرداند. + +## هشدار داده می شود) {#macnumtostringnum} + +قبول uint64 شماره. تفسیر به عنوان نشانی مک در اندی بزرگ. بازگرداندن یک رشته حاوی نشانی مک مربوطه را در قالب قلمی: ب: ر. ن:دکتر: ف.ا: ف. ف. (تعداد کولون جدا شده در فرم هگزادسیمال). + +## MACStringToNum(s) {#macstringtonums} + +عملکرد معکوس مک نومتوسترینگ. اگر نشانی مک دارای یک فرمت نامعتبر, باز می گردد 0. + +## درشتنمایی) {#macstringtoouis} + +می پذیرد یک نشانی مک در فرمت قلمی:بیت:ر.ن:دی. دی:اف (تعداد روده بزرگ از هم جدا در فرم هگزادسیمال). بازگرداندن سه هشت تایی اول به عنوان یک عدد ظاهری64. اگر نشانی مک دارای یک فرمت نامعتبر, باز می گردد 0. + +## نوع گیرنده {#getsizeofenumtype} + +بازگرداندن تعدادی از زمینه های در [شمارشی](../../sql-reference/data-types/enum.md). + +``` sql +getSizeOfEnumType(value) +``` + +**پارامترها:** + +- `value` — Value of type `Enum`. + +**مقادیر بازگشتی** + +- تعدادی از زمینه های با `Enum` مقادیر ورودی. +- یک استثنا پرتاب می شود اگر نوع نیست `Enum`. + +**مثال** + +``` sql +SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## بلوک سازی {#blockserializedsize} + +بازده اندازه بر روی دیسک (بدون در نظر گرفتن فشرده سازی حساب). + +``` sql +blockSerializedSize(value[, value[, ...]]) +``` + +**پارامترها:** + +- `value` — Any value. + +**مقادیر بازگشتی** + +- تعداد بایت خواهد شد که به دیسک برای بلوک از ارزش های نوشته شده (بدون فشرده سازی). + +**مثال** + +``` sql +SELECT blockSerializedSize(maxState(1)) as x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## بدون نام {#tocolumntypename} + +بازگرداندن نام کلاس است که نشان دهنده نوع داده ها از ستون در رم. + +``` sql +toColumnTypeName(value) +``` + +**پارامترها:** + +- `value` — Any type of value. + +**مقادیر بازگشتی** + +- یک رشته با نام کلاس است که برای نمایندگی از استفاده `value` نوع داده در رم. + +**نمونه ای از تفاوت بین`toTypeName ' and ' toColumnTypeName`** + +``` sql +SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime │ +└─────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ Const(UInt32) │ +└───────────────────────────────────────────────────────────┘ +``` + +مثال نشان می دهد که `DateTime` نوع داده در حافظه ذخیره می شود به عنوان `Const(UInt32)`. + +## روبنا دامپکول {#dumpcolumnstructure} + +خروجی شرح مفصلی از ساختارهای داده در رم + +``` sql +dumpColumnStructure(value) +``` + +**پارامترها:** + +- `value` — Any type of value. + +**مقادیر بازگشتی** + +- یک رشته توصیف ساختار است که برای نمایندگی از استفاده `value` نوع داده در رم. + +**مثال** + +``` sql +SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) +``` + +``` text +┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime, Const(size = 1, UInt32(size = 1)) │ +└──────────────────────────────────────────────────────────────┘ +``` + +## نوع قراردادی {#defaultvalueofargumenttype} + +خروجی مقدار پیش فرض برای نوع داده. + +مقادیر پیش فرض برای ستون های سفارشی تعیین شده توسط کاربر را شامل نمی شود. + +``` sql +defaultValueOfArgumentType(expression) +``` + +**پارامترها:** + +- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. + +**مقادیر بازگشتی** + +- `0` برای اعداد. +- رشته خالی برای رشته. +- `ᴺᵁᴸᴸ` برای [Nullable](../../sql-reference/data-types/nullable.md). + +**مثال** + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ +│ 0 │ +└─────────────────────────────────────────────┘ +``` + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ +│ ᴺᵁᴸᴸ │ +└───────────────────────────────────────────────────────┘ +``` + +## تکرار {#other-functions-replicate} + +ایجاد مجموعه ای با یک مقدار واحد. + +مورد استفاده برای اجرای داخلی [ارریجین](array-join.md#functions_arrayjoin). + +``` sql +SELECT replicate(x, arr); +``` + +**پارامترها:** + +- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. +- `x` — The value that the resulting array will be filled with. + +**مقدار بازگشتی** + +مجموعه ای پر از ارزش `x`. + +نوع: `Array`. + +**مثال** + +پرسوجو: + +``` sql +SELECT replicate(1, ['a', 'b', 'c']) +``` + +نتیجه: + +``` text +┌─replicate(1, ['a', 'b', 'c'])─┐ +│ [1,1,1] │ +└───────────────────────────────┘ +``` + +## رشته های قابل استفاده {#filesystemavailable} + +بازگرداندن مقدار فضای باقی مانده بر روی سیستم فایل که فایل های پایگاه داده واقع. این است که همیشه کوچکتر از فضای کل رایگان ([بدون پرونده](#filesystemfree)) چرا که برخی از فضا برای سیستم عامل محفوظ می باشد. + +**نحو** + +``` sql +filesystemAvailable() +``` + +**مقدار بازگشتی** + +- مقدار فضای باقی مانده موجود در بایت. + +نوع: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; +``` + +نتیجه: + +``` text +┌─Available space─┬─Type───┐ +│ 30.75 GiB │ UInt64 │ +└─────────────────┴────────┘ +``` + +## بدون پرونده {#filesystemfree} + +بازگرداندن مقدار کل فضای رایگان بر روی سیستم فایل که فایل های پایگاه داده واقع. همچنین نگاه کنید به `filesystemAvailable` + +**نحو** + +``` sql +filesystemFree() +``` + +**مقدار بازگشتی** + +- مقدار فضای رایگان در بایت. + +نوع: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; +``` + +نتیجه: + +``` text +┌─Free space─┬─Type───┐ +│ 32.39 GiB │ UInt64 │ +└────────────┴────────┘ +``` + +## سختی پرونده {#filesystemcapacity} + +بازگرداندن ظرفیت فایل سیستم در بایت. برای ارزیابی [مسیر](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) به دایرکتوری داده ها باید پیکربندی شود. + +**نحو** + +``` sql +filesystemCapacity() +``` + +**مقدار بازگشتی** + +- اطلاعات ظرفیت سیستم فایل در بایت. + +نوع: [UInt64](../../sql-reference/data-types/int-uint.md). + +**مثال** + +پرسوجو: + +``` sql +SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" +``` + +نتیجه: + +``` text +┌─Capacity──┬─Type───┐ +│ 39.32 GiB │ UInt64 │ +└───────────┴────────┘ +``` + +## پلاکتی {#function-finalizeaggregation} + +طول می کشد دولت از تابع جمع. بازده نتیجه تجمع (دولت نهایی). + +## خرابی اجرا {#function-runningaccumulate} + +طول می کشد کشورهای تابع جمع و یک ستون با ارزش را برمی گرداند, در نتیجه تجمع این کشورها برای مجموعه ای از خطوط بلوک هستند, از اول به خط فعلی. +برای مثال طول می کشد state of aggregate function (به عنوان مثال runningaccumulate(uniqstate(userid))) و برای هر ردیف از بلوک بازگشت نتیجه از مجموع عملکرد در ادغام دولت قبلی تمام ردیف و ردیف جاری است. +بنابراین نتیجه عملکرد بستگی به پارتیشن داده ها به بلوک ها و به ترتیب داده ها در بلوک دارد. + +## جوینت {#joinget} + +تابع شما اجازه می دهد استخراج داده ها از جدول به همان شیوه به عنوان از یک [واژهنامه](../../sql-reference/dictionaries/index.md). + +می شود داده ها از [پیوستن](../../engines/table-engines/special/join.md#creating-a-table) جداول با استفاده از کلید ملحق مشخص. + +فقط پشتیبانی از جداول ایجاد شده با `ENGINE = Join(ANY, LEFT, )` بیانیه. + +**نحو** + +``` sql +joinGet(join_storage_table_name, `value_column`, join_keys) +``` + +**پارامترها** + +- `join_storage_table_name` — an [شناسه](../syntax.md#syntax-identifiers) نشان می دهد که جستجو انجام شده است. شناسه در پایگاه داده به طور پیش فرض جستجو (پارامتر را ببینید `default_database` در فایل پیکربندی). برای نادیده گرفتن پایگاه داده پیش فرض از `USE db_name` یا پایگاه داده و جدول را از طریق جداساز مشخص کنید `db_name.db_table`, مثال را ببینید. +- `value_column` — name of the column of the table that contains required data. +- `join_keys` — list of keys. + +**مقدار بازگشتی** + +را برمی گرداند لیستی از ارزش مطابقت دارد به لیست کلید. + +اگر برخی در جدول منبع وجود ندارد و سپس `0` یا `null` خواهد شد بر اساس بازگشت [ارزشهای خبری عبارتند از:](../../operations/settings/settings.md#join_use_nulls) تنظیمات. + +اطلاعات بیشتر در مورد `join_use_nulls` داخل [پیوستن به عملیات](../../engines/table-engines/special/join.md). + +**مثال** + +جدول ورودی: + +``` sql +CREATE DATABASE db_test +CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 +INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) +``` + +``` text +┌─id─┬─val─┐ +│ 4 │ 13 │ +│ 2 │ 12 │ +│ 1 │ 11 │ +└────┴─────┘ +``` + +پرسوجو: + +``` sql +SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 +``` + +نتیجه: + +``` text +┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ +│ 0 │ +│ 11 │ +│ 12 │ +│ 0 │ +└──────────────────────────────────────────────────┘ +``` + +## modelEvaluate(model\_name, …) {#function-modelevaluate} + +ارزیابی مدل خارجی. +می پذیرد نام مدل و استدلال مدل. را برمی گرداند شناور64. + +## throwIf(x\[, custom\_message\]) {#throwifx-custom-message} + +پرتاب یک استثنا اگر استدلال غیر صفر است. +\_پیغام سفارشی-پارامتر اختیاری است: یک رشته ثابت, فراهم می کند یک پیغام خطا + +``` sql +SELECT throwIf(number = 3, 'Too many') FROM numbers(10); +``` + +``` text +↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): +Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. +``` + +## هویت {#identity} + +بازگرداندن همان مقدار که به عنوان استدلال خود مورد استفاده قرار گرفت. مورد استفاده برای اشکال زدایی و تست, اجازه می دهد تا به لغو با استفاده از شاخص, و عملکرد پرس و جو از یک اسکن کامل. هنگامی که پرس و جو برای استفاده احتمالی از شاخص تجزیه و تحلیل, تجزیه و تحلیل می کند در داخل نگاه نمی `identity` توابع. + +**نحو** + +``` sql +identity(x) +``` + +**مثال** + +پرسوجو: + +``` sql +SELECT identity(42) +``` + +نتیجه: + +``` text +┌─identity(42)─┐ +│ 42 │ +└──────────────┘ +``` + +## درباره ما {#randomascii} + +تولید یک رشته با مجموعه ای تصادفی از [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) شخصیت های قابل چاپ. + +**نحو** + +``` sql +randomPrintableASCII(length) +``` + +**پارامترها** + +- `length` — Resulting string length. Positive integer. + + If you pass `length < 0`, behavior of the function is undefined. + +**مقدار بازگشتی** + +- رشته با مجموعه ای تصادفی از [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) شخصیت های قابل چاپ. + +نوع: [رشته](../../sql-reference/data-types/string.md) + +**مثال** + +``` sql +SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 +``` + +``` text +┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ +│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ +│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ +│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ +└────────┴────────────────────────────────┴──────────────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/fa/sql_reference/functions/random_functions.md b/docs/fa/sql-reference/functions/random-functions.md similarity index 100% rename from docs/fa/sql_reference/functions/random_functions.md rename to docs/fa/sql-reference/functions/random-functions.md diff --git a/docs/fa/sql-reference/functions/rounding-functions.md b/docs/fa/sql-reference/functions/rounding-functions.md new file mode 100644 index 00000000000..1ded1b41d88 --- /dev/null +++ b/docs/fa/sql-reference/functions/rounding-functions.md @@ -0,0 +1,190 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: "\u06AF\u0631\u062F \u06A9\u0631\u062F\u0646" +--- + +# گرد کردن توابع {#rounding-functions} + +## طبقه (ایکس\]) {#floorx-n} + +بازگرداندن بیشترین تعداد دور است که کمتر از یا مساوی `x`. تعداد دور چند تن از 1/10 و یا نزدیکترین تعداد داده های مناسب نوع اگر 1 / 10 دقیق نیست. +‘N’ ثابت عدد صحیح است, پارامتر اختیاری. به طور پیش فرض صفر است, که به معنی به دور به یک عدد صحیح. +‘N’ ممکن است منفی باشد. + +مثالها: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` + +`x` هر نوع عددی است. نتیجه تعدادی از همان نوع است. +برای استدلال عدد صحیح را حس می کند به دور با منفی `N` ارزش (برای غیر منفی `N` تابع هیچ کاری نمی کند). +اگر گرد باعث سرریز (مثلا, کف سازی(-128, -1)), نتیجه اجرای خاص بازگشته است. + +## هشدار داده می شود\]) {#ceilx-n-ceilingx-n} + +بازگرداندن کوچکترین عدد دور است که بیشتر از یا مساوی `x`. در هر راه دیگر, این همان است که `floor` تابع (بالا را ببینید). + +## هشدار داده می شود\]) {#truncx-n-truncatex-n} + +بازگرداندن تعداد دور با بزرگترین ارزش مطلق است که ارزش مطلق کمتر یا مساوی `x`‘s. In every other way, it is the same as the ’floor’ تابع (بالا را ببینید). + +## دور (ایکس\]) {#rounding_functions-round} + +دور یک مقدار به تعداد مشخصی از رقم اعشار. + +تابع نزدیکترین تعداد از سفارش مشخص شده را برمی گرداند. در صورتی که تعداد داده شده است فاصله برابر با شماره های اطراف, تابع با استفاده از گرد کردن بانکدار برای انواع شماره شناور و دور به دور از صفر برای انواع شماره های دیگر. + +``` sql +round(expression [, decimal_places]) +``` + +**پارامترها:** + +- `expression` — A number to be rounded. Can be any [عبارت](../syntax.md#syntax-expressions) بازگشت عددی [نوع داده](../../sql-reference/data-types/index.md#data_types). +- `decimal-places` — An integer value. + - اگر `decimal-places > 0` سپس تابع دور ارزش به سمت راست از نقطه اعشار. + - اگر `decimal-places < 0` سپس تابع دور ارزش به سمت چپ نقطه اعشار. + - اگر `decimal-places = 0` سپس تابع دور ارزش به عدد صحیح. در این مورد استدلال را می توان حذف. + +**مقدار بازگشتی:** + +گرد شماره از همان نوع به عنوان ورودی شماره. + +### مثالها {#examples} + +**مثال استفاده** + +``` sql +SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 +``` + +``` text +┌───x─┬─round(divide(number, 2))─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +└─────┴──────────────────────────┘ +``` + +**نمونه هایی از گرد کردن** + +گرد کردن به نزدیکترین شماره. + +``` text +round(3.2, 0) = 3 +round(4.1267, 2) = 4.13 +round(22,-1) = 20 +round(467,-2) = 500 +round(-467,-2) = -500 +``` + +گرد کردن بانکدار. + +``` text +round(3.5) = 4 +round(4.5) = 4 +round(3.55, 1) = 3.6 +round(3.65, 1) = 3.6 +``` + +**همچنین نگاه کنید به** + +- [roundBankers](#roundbankers) + +## سرباز {#roundbankers} + +دور یک عدد به یک موقعیت دهدهی مشخص شده است. + +- اگر تعداد گرد کردن در نیمه راه بین دو عدد است, تابع با استفاده از گرد کردن بانکدار. + + Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. + + It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. + +- در موارد دیگر تابع دور اعداد به نزدیکترین عدد صحیح. + +با استفاده از گرد کردن بانکدار, شما می توانید اثر است که گرد کردن اعداد در نتایج حاصل از جمع و یا کم کردن این اعداد را کاهش می دهد. + +برای مثال مجموع اعداد 1.5, 2.5, 3.5, 4.5 مختلف گرد: + +- بدون گرد کردن: 1.5 + 2.5 + 3.5 + 4.5 = 12. +- گرد کردن بانکدار: 2 + 2 + 4 + 4 = 12. +- گرد کردن به نزدیکترین عدد صحیح: 2 + 3 + 4 + 5 = 14. + +**نحو** + +``` sql +roundBankers(expression [, decimal_places]) +``` + +**پارامترها** + +- `expression` — A number to be rounded. Can be any [عبارت](../syntax.md#syntax-expressions) بازگشت عددی [نوع داده](../../sql-reference/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`. + - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. + +**مقدار بازگشتی** + +ارزش گرد شده توسط روش گرد کردن بانکدار. + +### مثالها {#examples-1} + +**مثال استفاده** + +پرسوجو: + +``` sql + SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 +``` + +نتیجه: + +``` text +┌───x─┬─b─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +│ 1.5 │ 2 │ +│ 2 │ 2 │ +│ 2.5 │ 2 │ +│ 3 │ 3 │ +│ 3.5 │ 4 │ +│ 4 │ 4 │ +│ 4.5 │ 4 │ +└─────┴───┘ +``` + +**نمونه هایی از گرد کردن بانکدار** + +``` text +roundBankers(0.4) = 0 +roundBankers(-3.5) = -4 +roundBankers(4.5) = 4 +roundBankers(3.55, 1) = 3.6 +roundBankers(3.65, 1) = 3.6 +roundBankers(10.35, 1) = 10.4 +roundBankers(10.755, 2) = 11,76 +``` + +**همچنین نگاه کنید به** + +- [گرد](#rounding_functions-round) + +## توسعه پایدار2) {#roundtoexp2num} + +می پذیرد تعداد. اگر تعداد کمتر از یک است, باز می گردد 0. در غیر این صورت, این دور تعداد پایین به نزدیکترین (مجموع غیر منفی) درجه دو. + +## طول عمر (تعداد) {#rounddurationnum} + +می پذیرد تعداد. اگر تعداد کمتر از یک است, باز می گردد 0. در غیر این صورت, این دور تعداد را به اعداد از مجموعه: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. این تابع خاص به یاندکس است.متریکا و مورد استفاده برای اجرای گزارش در طول جلسه. + +## عدد) {#roundagenum} + +می پذیرد تعداد. اگر تعداد کمتر از است 18, باز می گردد 0. در غیر این صورت, این دور تعداد را به یک عدد از مجموعه: 18, 25, 35, 45, 55. این تابع خاص به یاندکس است.متریکا و مورد استفاده برای اجرای گزارش در سن کاربر. + +## roundDown(num arr) {#rounddownnum-arr} + +یک عدد را می پذیرد و به یک عنصر در مجموعه مشخص شده منتقل می کند. اگر مقدار کمتر از پایین ترین حد محدود است, پایین ترین حد بازگشته است. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/fa/sql-reference/functions/splitting-merging-functions.md b/docs/fa/sql-reference/functions/splitting-merging-functions.md new file mode 100644 index 00000000000..8cd8b3c6c24 --- /dev/null +++ b/docs/fa/sql-reference/functions/splitting-merging-functions.md @@ -0,0 +1,117 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 47 +toc_title: "\u062A\u0642\u0633\u06CC\u0645 \u0648 \u0627\u062F\u063A\u0627\u0645 \u0631\ + \u0634\u062A\u0647 \u0647\u0627 \u0648 \u0627\u0631\u0631\u06CC\u0633" +--- + +# توابع برای تقسیم و ادغام رشته ها و ارریس {#functions-for-splitting-and-merging-strings-and-arrays} + +## اسپلیت بیچار (جداساز) {#splitbycharseparator-s} + +انشعابات یک رشته به بسترهای جدا شده توسط یک شخصیت مشخص شده است. با استفاده از یک رشته ثابت `separator` که متشکل از دقیقا یک شخصیت. +بازگرداندن مجموعه ای از بسترهای انتخاب. بسترهای خالی ممکن است انتخاب شود اگر جدا در ابتدا یا انتهای رشته رخ می دهد, و یا اگر چند جداکننده متوالی وجود دارد. + +**نحو** + +``` sql +splitByChar(, ) +``` + +**پارامترها** + +- `separator` — The separator which should contain exactly one character. [رشته](../../sql-reference/data-types/string.md). +- `s` — The string to split. [رشته](../../sql-reference/data-types/string.md). + +**مقدار بازگشتی)** + +بازگرداندن مجموعه ای از بسترهای انتخاب. بسترهای خالی ممکن است انتخاب شود که: + +- جداساز در ابتدا یا انتهای رشته رخ می دهد; +- چندین جداکننده متوالی وجود دارد; +- رشته اصلی `s` خالیه + +نوع: [& حذف](../../sql-reference/data-types/array.md) از [رشته](../../sql-reference/data-types/string.md). + +**مثال** + +``` sql +SELECT splitByChar(',', '1,2,3,abcde') +``` + +``` text +┌─splitByChar(',', '1,2,3,abcde')─┐ +│ ['1','2','3','abcde'] │ +└─────────────────────────────────┘ +``` + +## رشته اسپلیتبیست (جداساز) {#splitbystringseparator-s} + +انشعابات یک رشته به بسترهای جدا شده توسط یک رشته. با استفاده از یک رشته ثابت `separator` از شخصیت های متعدد به عنوان جدا کننده. اگر رشته `separator` خالی است, این رشته تقسیم `s` به مجموعه ای از شخصیت های تک. + +**نحو** + +``` sql +splitByString(, ) +``` + +**پارامترها** + +- `separator` — The separator. [رشته](../../sql-reference/data-types/string.md). +- `s` — The string to split. [رشته](../../sql-reference/data-types/string.md). + +**مقدار بازگشتی)** + +بازگرداندن مجموعه ای از بسترهای انتخاب. بسترهای خالی ممکن است انتخاب شود که: + +نوع: [& حذف](../../sql-reference/data-types/array.md) از [رشته](../../sql-reference/data-types/string.md). + +- جدا کننده غیر خالی در ابتدا یا انتهای رشته رخ می دهد; +- چند جدا متوالی غیر خالی وجود دارد; +- رشته اصلی `s` خالی است در حالی که جدا خالی نیست. + +**مثال** + +``` sql +SELECT splitByString(', ', '1, 2 3, 4,5, abcde') +``` + +``` text +┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ +│ ['1','2 3','4,5','abcde'] │ +└───────────────────────────────────────────┘ +``` + +``` sql +SELECT splitByString('', 'abcde') +``` + +``` text +┌─splitByString('', 'abcde')─┐ +│ ['a','b','c','d','e'] │ +└────────────────────────────┘ +``` + +## حذف میانبر در صفحه خانه\]) {#arraystringconcatarr-separator} + +رشته های ذکر شده در مجموعه را با جداساز مطابقت می دهد.’جدا کننده’ پارامتر اختیاری است: یک رشته ثابت, مجموعه ای به یک رشته خالی به طور پیش فرض. +رشته را برمی گرداند. + +## اطلاعات دقیق) {#alphatokenss} + +انتخاب substrings متوالی بایت از محدوده a-z و a-z. بازگرداندن یک آرایه از substrings. + +**مثال** + +``` sql +SELECT alphaTokens('abca1abc') +``` + +``` text +┌─alphaTokens('abca1abc')─┐ +│ ['abca','abc'] │ +└─────────────────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/fa/sql-reference/functions/string-functions.md b/docs/fa/sql-reference/functions/string-functions.md new file mode 100644 index 00000000000..86a0b838497 --- /dev/null +++ b/docs/fa/sql-reference/functions/string-functions.md @@ -0,0 +1,489 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0631\u0634\u062A\u0647 \u0647\u0627" +--- + +# توابع برای کار با رشته {#functions-for-working-with-strings} + +## خالی {#empty} + +بازده 1 برای یک رشته خالی و یا 0 برای یک رشته غیر خالی. +نتیجه این نوع uint8. +یک رشته در نظر گرفته شده است غیر خالی اگر شامل حداقل یک بایت, حتی اگر این یک فضا یا یک بایت پوچ است. +این تابع همچنین برای ارریس کار می کند. + +## notEmpty {#notempty} + +بازده 0 برای یک رشته خالی یا 1 برای یک رشته غیر خالی. +نتیجه این نوع uint8. +این تابع همچنین برای ارریس کار می کند. + +## طول {#length} + +بازگرداندن طول یک رشته در بایت (نه در شخصیت, و نه در نقاط کد). +نتیجه این نوع uint64. +این تابع همچنین برای ارریس کار می کند. + +## طول 8 {#lengthutf8} + +بازگرداندن طول یک رشته در نقاط کد یونیکد (نه در شخصیت), فرض کنید که رشته شامل مجموعه ای از بایت است که متن کد گذاری شده را تشکیل می دهند. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). +نتیجه این نوع uint64. + +## \_شروع مجدد {#char-length} + +بازگرداندن طول یک رشته در نقاط کد یونیکد (نه در شخصیت), فرض کنید که رشته شامل مجموعه ای از بایت است که متن کد گذاری شده را تشکیل می دهند. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). +نتیجه این نوع uint64. + +## \_شخصیت شناسی {#character-length} + +بازگرداندن طول یک رشته در نقاط کد یونیکد (نه در شخصیت), فرض کنید که رشته شامل مجموعه ای از بایت است که متن کد گذاری شده را تشکیل می دهند. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). +نتیجه این نوع uint64. + +## پایین تر {#lower} + +تبدیل نمادهای اسکی لاتین در یک رشته به حروف کوچک. + +## بالارفتن {#upper} + +تبدیل نمادهای اسکی لاتین در یک رشته به حروف بزرگ. + +## لوراتف8 {#lowerutf8} + +تبدیل یک رشته به حروف کوچک, فرض رشته شامل مجموعه ای از بایت که یک متن کد گذاری شده-8 را تشکیل می دهند. +این زبان را تشخیص نمی دهد. بنابراین برای ترکیه نتیجه ممکن است دقیقا درست باشد. +اگر طول توالی یونایتد-8 بایت برای مورد بالا و پایین تر از یک نقطه کد متفاوت است, نتیجه ممکن است برای این نقطه کد نادرست. +اگر رشته شامل مجموعه ای از بایت است که سخن گفتن نیست-8, سپس رفتار تعریف نشده است. + +## یوتف8 {#upperutf8} + +تبدیل یک رشته به حروف بزرگ, فرض رشته شامل مجموعه ای از بایت که یک متن کد گذاری شده-8 را تشکیل می دهند. +این زبان را تشخیص نمی دهد. بنابراین برای ترکیه نتیجه ممکن است دقیقا درست باشد. +اگر طول توالی یونایتد-8 بایت برای مورد بالا و پایین تر از یک نقطه کد متفاوت است, نتیجه ممکن است برای این نقطه کد نادرست. +اگر رشته شامل مجموعه ای از بایت است که سخن گفتن نیست-8, سپس رفتار تعریف نشده است. + +## اسوالدیدوتف8 {#isvalidutf8} + +بازده 1, اگر مجموعه ای از کلمه در ادامه متن معتبر است-8 کد گذاری, در غیر این صورت 0. + +## تولدیدوتف8 {#tovalidutf8} + +8 کاراکتر نامعتبر را جایگزین می کند `�` اطلاعات دقیق همه در حال اجرا در یک ردیف شخصیت نامعتبر را به یک شخصیت جایگزین فرو ریخت. + +``` sql +toValidUTF8( input_string ) +``` + +پارامترها: + +- input\_string — Any set of bytes represented as the [رشته](../../sql-reference/data-types/string.md) شی نوع داده. + +مقدار بازگشتی: معتبر یونایتد-8 رشته. + +**مثال** + +``` sql +SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') +``` + +``` text +┌─toValidUTF8('a����b')─┐ +│ a�b │ +└───────────────────────┘ +``` + +## تکرار {#repeat} + +تکرار یک رشته را به عنوان چند بار به عنوان مشخص شده و concatenates تکراری ارزش به عنوان یک رشته است. + +**نحو** + +``` sql +repeat(s, n) +``` + +**پارامترها** + +- `s` — The string to repeat. [رشته](../../sql-reference/data-types/string.md). +- `n` — The number of times to repeat the string. [اینترنت](../../sql-reference/data-types/int-uint.md). + +**مقدار بازگشتی** + +تک رشته ای که حاوی رشته است `s` تکرار `n` زمان. اگر `n` \< 1, تابع رشته خالی می گرداند. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT repeat('abc', 10) +``` + +نتیجه: + +``` text +┌─repeat('abc', 10)──────────────┐ +│ abcabcabcabcabcabcabcabcabcabc │ +└────────────────────────────────┘ +``` + +## معکوس {#reverse} + +معکوس رشته (به عنوان یک دنباله از بایت). + +## معکوس کردن8 {#reverseutf8} + +معکوس دنباله ای از نقاط کد یونیکد, فرض کنید که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن گفته-8. در غیر این صورت, این کار چیز دیگری (این یک استثنا پرتاب نمی). + +## format(pattern, s0, s1, …) {#format} + +قالب بندی الگوی ثابت با رشته ذکر شده در استدلال. `pattern` یک الگوی فرمت پایتون ساده شده است. رشته فرمت شامل “replacement fields” احاطه شده توسط پرانتز فرفری `{}`. هر چیزی که در پرانتز موجود نیست در نظر گرفته شده است متن تحت اللفظی است که بدون تغییر به خروجی کپی شده است. اگر شما نیاز به شامل یک شخصیت بند در متن تحت اللفظی, این را می توان با دو برابر فرار: `{{ '{{' }}` و `{{ '}}' }}`. نام فیلد می تواند اعداد (با شروع از صفر) یا خالی (سپس به عنوان شماره نتیجه درمان می شوند). + +``` sql +SELECT format('{1} {0} {1}', 'World', 'Hello') +``` + +``` text +┌─format('{1} {0} {1}', 'World', 'Hello')─┐ +│ Hello World Hello │ +└─────────────────────────────────────────┘ +``` + +``` sql +SELECT format('{} {}', 'Hello', 'World') +``` + +``` text +┌─format('{} {}', 'Hello', 'World')─┐ +│ Hello World │ +└───────────────────────────────────┘ +``` + +## الحاق {#concat} + +رشته های ذکر شده در استدلال بدون جدا کننده را تصدیق می کند. + +**نحو** + +``` sql +concat(s1, s2, ...) +``` + +**پارامترها** + +ارزش رشته نوع و یا رشته ثابت. + +**مقادیر بازگشتی** + +را برمی گرداند رشته ای که منجر به از الحاق استدلال. + +اگر هر یک از مقادیر استدلال است `NULL`, `concat` بازگشت `NULL`. + +**مثال** + +پرسوجو: + +``` sql +SELECT concat('Hello, ', 'World!') +``` + +نتیجه: + +``` text +┌─concat('Hello, ', 'World!')─┐ +│ Hello, World! │ +└─────────────────────────────┘ +``` + +## همبسته {#concatassumeinjective} + +مثل [الحاق](#concat) تفاوت این است که شما نیاز به اطمینان حاصل شود که `concat(s1, s2, ...) → sn` این برای بهینه سازی گروه توسط استفاده می شود. + +تابع به نام “injective” اگر همیشه نتیجه های مختلف برای مقادیر مختلف استدلال می گرداند. به عبارت دیگر: استدلال های مختلف هرگز نتیجه یکسان عملکرد. + +**نحو** + +``` sql +concatAssumeInjective(s1, s2, ...) +``` + +**پارامترها** + +ارزش رشته نوع و یا رشته ثابت. + +**مقادیر بازگشتی** + +را برمی گرداند رشته ای که منجر به از الحاق استدلال. + +اگر هر یک از مقادیر استدلال است `NULL`, `concatAssumeInjective` بازگشت `NULL`. + +**مثال** + +جدول ورودی: + +``` sql +CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; +INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); +SELECT * from key_val; +``` + +``` text +┌─key1────┬─key2─────┬─value─┐ +│ Hello, │ World │ 1 │ +│ Hello, │ World │ 2 │ +│ Hello, │ World! │ 3 │ +│ Hello │ , World! │ 2 │ +└─────────┴──────────┴───────┘ +``` + +پرسوجو: + +``` sql +SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) +``` + +نتیجه: + +``` text +┌─concat(key1, key2)─┬─sum(value)─┐ +│ Hello, World! │ 3 │ +│ Hello, World! │ 2 │ +│ Hello, World │ 3 │ +└────────────────────┴────────────┘ +``` + +## زیر رشته(بازدید کنندگان, انحراف, طول), اواسط(بازدید کنندگان, انحراف, طول), عام (بازدید کنندگان, انحراف, طول) {#substring} + +بازگرداندن یک رشته شروع با بایت از ‘offset’ شاخص این است ‘length’ کلمه در ادامه متن طولانی. نمایه سازی شخصیت از یک شروع می شود (همانطور که در گذاشتن استاندارد). این ‘offset’ و ‘length’ استدلال باید ثابت باشد. + +## زیر بغل کردن 8(بازدید کنندگان, انحراف, طول) {#substringutf8} + +همان ‘substring’, اما برای نقاط کد یونیکد. این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری شده وزارت مخابرات 8. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). + +## appendTrailingCharIfAbsent(s, c) {#appendtrailingcharifabsent} + +اگر ‘s’ رشته غیر خالی است و حاوی نیست ‘c’ شخصیت در پایان این برنامه ‘c’ شخصیت به پایان. + +## تبدیل(بازدید کنندگان, از, به) {#convertcharset} + +بازگرداندن رشته ‘s’ که از رمزگذاری در تبدیل شد ‘from’ به رمزگذاری در ‘to’. + +## کد زیر 64) {#base64encode} + +کدگذاریها ‘s’ رشته به پایگاه64 + +## کد زیر 64) {#base64decode} + +رمزگشایی پایگاه64-رشته کد گذاری شده ‘s’ به رشته اصلی. در صورت شکست را افزایش می دهد یک استثنا. + +## تریباس64دسیدی) {#trybase64decode} + +شبیه به حالت کد باس64, اما در صورت خطا یک رشته خالی می شود بازگشت. + +## endsWith(s, پسوند) {#endswith} + +بازگرداندن اینکه با پسوند مشخص شده پایان یابد. بازده 1 اگر رشته به پایان می رسد با پسوند مشخص, در غیر این صورت باز می گردد 0. + +## startsWith(str, پیشوند) {#startswith} + +بازده 1 اینکه رشته با پیشوند مشخص شروع می شود, در غیر این صورت باز می گردد 0. + +``` sql +SELECT startsWith('Spider-Man', 'Spi'); +``` + +**مقادیر بازگشتی** + +- 1, اگر رشته با پیشوند مشخص شروع می شود. +- 0, اگر رشته با پیشوند مشخص شروع نشد. + +**مثال** + +پرسوجو: + +``` sql +SELECT startsWith('Hello, world!', 'He'); +``` + +نتیجه: + +``` text +┌─startsWith('Hello, world!', 'He')─┐ +│ 1 │ +└───────────────────────────────────┘ +``` + +## تر و تمیز {#trim} + +حذف تمام شخصیت های مشخص شده از شروع یا پایان یک رشته. +به طور پیش فرض حذف همه وقوع متوالی از فضای سفید مشترک (شخصیت اسکی 32) از هر دو به پایان می رسد از یک رشته. + +**نحو** + +``` sql +trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) +``` + +**پارامترها** + +- `trim_character` — specified characters for trim. [رشته](../../sql-reference/data-types/string.md). +- `input_string` — string for trim. [رشته](../../sql-reference/data-types/string.md). + +**مقدار بازگشتی** + +یک رشته بدون پیشرو و (یا) انتهایی شخصیت مشخص شده است. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT trim(BOTH ' ()' FROM '( Hello, world! )') +``` + +نتیجه: + +``` text +┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ +│ Hello, world! │ +└───────────────────────────────────────────────┘ +``` + +## trimLeft {#trimleft} + +حذف تمام رخدادهای متوالی از فضای سفید مشترک (شخصیت اسکی 32) از ابتدای یک رشته. آن را نمی کند, حذف انواع دیگر از کاراکترهای فضای سفید (برگه بدون شکستن فضا و غیره.). + +**نحو** + +``` sql +trimLeft(input_string) +``` + +نام مستعار: `ltrim(input_string)`. + +**پارامترها** + +- `input_string` — string to trim. [رشته](../../sql-reference/data-types/string.md). + +**مقدار بازگشتی** + +یک رشته بدون پیشرو فضاهای سفید مشترک. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT trimLeft(' Hello, world! ') +``` + +نتیجه: + +``` text +┌─trimLeft(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## trimRight {#trimright} + +حذف همه متوالی تکرار مشترک فضای خالی (ascii شخصیت 32) از پایان یک رشته است. آن را نمی کند, حذف انواع دیگر از کاراکترهای فضای سفید (برگه بدون شکستن فضا و غیره.). + +**نحو** + +``` sql +trimRight(input_string) +``` + +نام مستعار: `rtrim(input_string)`. + +**پارامترها** + +- `input_string` — string to trim. [رشته](../../sql-reference/data-types/string.md). + +**مقدار بازگشتی** + +یک رشته بدون انتهایی فضاهای خالی مشترک. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT trimRight(' Hello, world! ') +``` + +نتیجه: + +``` text +┌─trimRight(' Hello, world! ')─┐ +│ Hello, world! │ +└──────────────────────────────────────┘ +``` + +## اصلاح {#trimboth} + +حذف تمام رخدادهای متوالی از فضای سفید مشترک (شخصیت اسکی 32) از هر دو به پایان می رسد از یک رشته. این کار انواع دیگر از شخصیت های فضای سفید را حذف کنید (باریکه, فضای بدون استراحت, و غیره.). + +**نحو** + +``` sql +trimBoth(input_string) +``` + +نام مستعار: `trim(input_string)`. + +**پارامترها** + +- `input_string` — string to trim. [رشته](../../sql-reference/data-types/string.md). + +**مقدار بازگشتی** + +یک رشته بدون پیشرو و انتهایی فضاهای سفید مشترک. + +نوع: `String`. + +**مثال** + +پرسوجو: + +``` sql +SELECT trimBoth(' Hello, world! ') +``` + +نتیجه: + +``` text +┌─trimBoth(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## CRC32(s) {#crc32} + +بازگرداندن کنترلی از یک رشته, با استفاده از کروک-32-یی 802.3 چند جملهای و مقدار اولیه `0xffffffff` هشدار داده می شود + +نتیجه این نوع uint32. + +## CRC32IEEE(s) {#crc32ieee} + +را برمی گرداند کنترل از یک رشته, با استفاده از کروم-32-یی 802.3 چند جملهای. + +نتیجه این نوع uint32. + +## CRC64(s) {#crc64} + +بازده crc64 کنترلی از یک رشته با استفاده از crc-64-ecma چند جملهای. + +نتیجه این نوع uint64. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/fa/sql-reference/functions/string-replace-functions.md b/docs/fa/sql-reference/functions/string-replace-functions.md new file mode 100644 index 00000000000..ecc0593ff38 --- /dev/null +++ b/docs/fa/sql-reference/functions/string-replace-functions.md @@ -0,0 +1,95 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 42 +toc_title: "\u0628\u0631\u0627\u06CC \u062C\u0627\u06CC\u06AF\u0632\u06CC\u0646\u06CC\ + \ \u062F\u0631 \u0631\u0634\u062A\u0647\u0647\u0627" +--- + +# توابع برای جستجو و جایگزینی در رشته ها {#functions-for-searching-and-replacing-in-strings} + +## جایگزینی جایگزین) {#replaceonehaystack-pattern-replacement} + +جایگزین وقوع اول, در صورت وجود, از ‘pattern’ زیر رشته در ‘haystack’ با ‘replacement’ زیر رشته. +از این پس, ‘pattern’ و ‘replacement’ حتما ثابته + +## replaceAll(haystack, الگوی جایگزینی) جایگزین(haystack, الگوی جایگزینی) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} + +جایگزین تمام اتفاقات ‘pattern’ زیر رشته در ‘haystack’ با ‘replacement’ زیر رشته. + +## جایگزین کردن الگوی جایگزین) {#replaceregexponehaystack-pattern-replacement} + +جایگزینی با استفاده از ‘pattern’ عبارت منظم. دوباره2 عبارت منظم. +جایگزین تنها وقوع اول, در صورت وجود. +یک الگو را می توان به عنوان ‘replacement’. این الگو می تواند شامل تعویض `\0-\9`. +جایگزینی `\0` شامل کل عبارت منظم. درحال جایگزینی `\1-\9` مربوط به زیرخط numbers.To استفاده از `\` شخصیت در قالب, فرار با استفاده از `\`. +همچنین در نظر داشته باشید که یک رشته تحت اللفظی نیاز به فرار اضافی نگه دارید. + +مثال 1. تبدیل تاریخ به فرمت امریکایی: + +``` sql +SELECT DISTINCT + EventDate, + replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res +FROM test.hits +LIMIT 7 +FORMAT TabSeparated +``` + +``` text +2014-03-17 03/17/2014 +2014-03-18 03/18/2014 +2014-03-19 03/19/2014 +2014-03-20 03/20/2014 +2014-03-21 03/21/2014 +2014-03-22 03/22/2014 +2014-03-23 03/23/2014 +``` + +مثال 2. کپی کردن یک رشته ده بار: + +``` sql +SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res +``` + +``` text +┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## جایگزین کردن الگوی جایگزین) {#replaceregexpallhaystack-pattern-replacement} + +این کار همان چیزی, اما جایگزین همه وقوع. مثال: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res +``` + +``` text +┌─res────────────────────────┐ +│ HHeelllloo,, WWoorrlldd!! │ +└────────────────────────────┘ +``` + +به عنوان یک استثنا, اگر یک عبارت منظم در زیر رشته خالی کار می کرد, جایگزینی بیش از یک بار ساخته شده است. +مثال: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res +``` + +``` text +┌─res─────────────────┐ +│ here: Hello, World! │ +└─────────────────────┘ +``` + +## سرویس پرداخت درونبرنامهای پلی) {#regexpquotemetas} + +تابع می افزاید: یک بک اسلش قبل از برخی از شخصیت های از پیش تعریف شده در رشته. +نویسههای از پیش تعریفشده: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, ‘\]’, ‘?’, ‘\*‘,’+‘,’{‘,’:‘,’-’. +این اجرای کمی از دوباره متفاوت2::پاسخ2:: نقل قول. این فرار صفر بایت به عنوان \\ 0 بجای 00 و فرار شخصیت تنها مورد نیاز. +برای کسب اطلاعات بیشتر به لینک مراجعه کنید: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/fa/sql-reference/functions/string-search-functions.md b/docs/fa/sql-reference/functions/string-search-functions.md new file mode 100644 index 00000000000..a7bf2e1b311 --- /dev/null +++ b/docs/fa/sql-reference/functions/string-search-functions.md @@ -0,0 +1,380 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 41 +toc_title: "\u0628\u0631\u0627\u06CC \u062C\u0633\u062A\u062C\u0648\u06CC \u0631\u0634\ + \u062A\u0647\u0647\u0627" +--- + +# توابع برای جستجوی رشته ها {#functions-for-searching-strings} + +جستجو به طور پیش فرض در تمام این توابع حساس به حروف است. انواع جداگانه ای برای جستجوی غیر حساس مورد وجود دارد. + +## موقعیت (انبار کاه, سوزن), تعیین محل (انبار کاه, سوزن) {#position} + +بازگرداندن موقعیت (به بایت) از رشته پیدا شده است در رشته, با شروع از 1. + +این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری تک بایت. اگر این فرض ملاقات کرد و یک شخصیت نمی تواند با استفاده از یک بایت تنها نشان داده شود, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو بایت نشان, این دو بایت و غیره استفاده. + +برای یک جستجو غیر حساس به حالت, استفاده از تابع [حساس به حالت](#positioncaseinsensitive). + +**نحو** + +``` sql +position(haystack, needle) +``` + +نام مستعار: `locate(haystack, needle)`. + +**پارامترها** + +- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). + +**مقادیر بازگشتی** + +- موقعیت شروع در بایت (شمارش از 1), اگر زیر رشته پیدا شد. +- 0, اگر زیر رشته یافت نشد. + +نوع: `Integer`. + +**مثالها** + +عبارت “Hello, world!” شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری تک بایت. تابع بازده برخی از نتیجه انتظار می رود: + +پرسوجو: + +``` sql +SELECT position('Hello, world!', '!') +``` + +نتیجه: + +``` text +┌─position('Hello, world!', '!')─┐ +│ 13 │ +└────────────────────────────────┘ +``` + +همان عبارت در روسیه شامل شخصیت های که نمی تواند با استفاده از یک بایت نشان داده شود. تابع بازده برخی از نتیجه غیر منتظره (استفاده [موقعیت 8](#positionutf8) تابع برای متن چند بایت کد گذاری): + +پرسوجو: + +``` sql +SELECT position('Привет, мир!', '!') +``` + +نتیجه: + +``` text +┌─position('Привет, мир!', '!')─┐ +│ 21 │ +└───────────────────────────────┘ +``` + +## حساس به حالت {#positioncaseinsensitive} + +همان [موقعیت](#position) بازگرداندن موقعیت (به بایت) از رشته پیدا شده است در رشته, با شروع از 1. استفاده از تابع برای یک جستجو غیر حساس به حالت. + +این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری تک بایت. اگر این فرض ملاقات کرد و یک شخصیت نمی تواند با استفاده از یک بایت تنها نشان داده شود, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو بایت نشان, این دو بایت و غیره استفاده. + +**نحو** + +``` sql +positionCaseInsensitive(haystack, needle) +``` + +**پارامترها** + +- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). + +**مقادیر بازگشتی** + +- موقعیت شروع در بایت (شمارش از 1), اگر زیر رشته پیدا شد. +- 0, اگر زیر رشته یافت نشد. + +نوع: `Integer`. + +**مثال** + +پرسوجو: + +``` sql +SELECT positionCaseInsensitive('Hello, world!', 'hello') +``` + +نتیجه: + +``` text +┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ +│ 1 │ +└───────────────────────────────────────────────────┘ +``` + +## موقعیت 8 {#positionutf8} + +بازگرداندن موقعیت (در نقاط یونیکد) از رشته پیدا شده است در رشته, با شروع از 1. + +این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری شده وزارت مخابرات 8. اگر این فرض ملاقات نمی, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو نقطه یونیکد نشان, این دو و غیره استفاده. + +برای یک جستجو غیر حساس به حالت, استفاده از تابع [در حال بارگذاری](#positioncaseinsensitiveutf8). + +**نحو** + +``` sql +positionUTF8(haystack, needle) +``` + +**پارامترها** + +- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). + +**مقادیر بازگشتی** + +- موقعیت شروع در یونیکد امتیاز (شمارش از 1), اگر زیر رشته پیدا شد. +- 0, اگر زیر رشته یافت نشد. + +نوع: `Integer`. + +**مثالها** + +عبارت “Hello, world!” در روسیه شامل مجموعه ای از نقاط یونیکد نمایندگی یک متن کد گذاری تک نقطه. تابع بازده برخی از نتیجه انتظار می رود: + +پرسوجو: + +``` sql +SELECT positionUTF8('Привет, мир!', '!') +``` + +نتیجه: + +``` text +┌─positionUTF8('Привет, мир!', '!')─┐ +│ 12 │ +└───────────────────────────────────┘ +``` + +عبارت “Salut, étudiante!”, جایی که شخصیت `é` می توان با استفاده از یک نقطه نشان داد (`U+00E9`) یا دو نقطه (`U+0065U+0301`) تابع را می توان بازگشت برخی از نتیجه غیر منتظره: + +پرسوجو برای نامه `é` که نشان داده شده است یک نقطه یونیکد `U+00E9`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +نتیجه: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 17 │ +└────────────────────────────────────────┘ +``` + +پرسوجو برای نامه `é` که به نمایندگی از دو نقطه یونیکد `U+0065U+0301`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +نتیجه: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 18 │ +└────────────────────────────────────────┘ +``` + +## در حال بارگذاری {#positioncaseinsensitiveutf8} + +همان [موقعیت 8](#positionutf8), اما غیر حساس به حروف است. بازگرداندن موقعیت (در نقاط یونیکد) از رشته پیدا شده است در رشته, با شروع از 1. + +این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری شده وزارت مخابرات 8. اگر این فرض ملاقات نمی, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو نقطه یونیکد نشان, این دو و غیره استفاده. + +**نحو** + +``` sql +positionCaseInsensitiveUTF8(haystack, needle) +``` + +**پارامترها** + +- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). + +**مقدار بازگشتی** + +- موقعیت شروع در یونیکد امتیاز (شمارش از 1), اگر زیر رشته پیدا شد. +- 0, اگر زیر رشته یافت نشد. + +نوع: `Integer`. + +**مثال** + +پرسوجو: + +``` sql +SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') +``` + +نتیجه: + +``` text +┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ +│ 9 │ +└────────────────────────────────────────────────────┘ +``` + +## چند ضلعی {#multisearchallpositions} + +همان [موقعیت](string-search-functions.md#position) اما بازگشت `Array` از موقعیت (به بایت) از بسترهای مربوطه موجود در رشته. موقعیت ها با شروع از نمایه 1. + +جستجو در دنباله ای از بایت بدون توجه به رمزگذاری رشته و میترا انجام می شود. + +- برای جستجو اسکی غیر حساس به حالت, استفاده از تابع `multiSearchAllPositionsCaseInsensitive`. +- برای جستجو در یوتف-8, استفاده از تابع [چند ضلعی پایگاه داده های8](#multiSearchAllPositionsUTF8). +- برای غیر حساس به حالت جستجو-8, استفاده از تابع چند تخصیص چندگانه 18. + +**نحو** + +``` sql +multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) +``` + +**پارامترها** + +- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). + +**مقادیر بازگشتی** + +- مجموعه ای از موقعیت های شروع در بایت (شمارش از 1), اگر زیر رشته مربوطه پیدا شد و 0 اگر یافت نشد. + +**مثال** + +پرسوجو: + +``` sql +SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) +``` + +نتیجه: + +``` text +┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ +│ [0,13,0] │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## چند ضلعی پایگاه داده های8 {#multiSearchAllPositionsUTF8} + +ببینید `multiSearchAllPositions`. + +## ترکیب چندجفتاری (هیستک, \[سوزن1 سوزن2, …, needleنه\]) {#multisearchfirstposition} + +همان `position` اما بازده سمت چپ افست از رشته `haystack` که به برخی از سوزن همسان. + +برای یک جستجوی غیر حساس مورد و یا / و در توابع استفاده از فرمت جی تی اف 8 `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. + +## مقالههای جدید مرتبط با تحقیق این نویسنده1 سوزن2, …, needleنه\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} + +بازگرداندن شاخص `i` (شروع از 1) سوزن چپ پیدا شده استمن … در رشته `haystack` و 0 در غیر این صورت. + +برای یک جستجوی غیر حساس مورد و یا / و در توابع استفاده از فرمت جی تی اف 8 `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. + +## مولسیرچانی (هیستک, \[سوزن1 سوزن2, …, needleنه\]) {#function-multisearchany} + +بازده 1, اگر حداقل یک سوزن رشتهمن … مسابقات رشته `haystack` و 0 در غیر این صورت. + +برای یک جستجوی غیر حساس مورد و یا / و در توابع استفاده از فرمت جی تی اف 8 `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. + +!!! note "یادداشت" + در همه `multiSearch*` توابع تعداد سوزن ها باید کمتر از 2 باشد8 به دلیل مشخصات پیاده سازی. + +## همخوانی داشتن (کومه علف خشک, الگو) {#matchhaystack-pattern} + +بررسی اینکه رشته با `pattern` عبارت منظم. یک `re2` عبارت منظم. این [نحو](https://github.com/google/re2/wiki/Syntax) از `re2` عبارات منظم محدود تر از نحو عبارات منظم پرل است. + +بازده 0 اگر مطابقت ندارد, یا 1 اگر منطبق. + +توجه داشته باشید که نماد ممیز (`\`) برای فرار در عبارت منظم استفاده می شود. همان نماد برای فرار در لیتر رشته استفاده می شود. بنابراین به منظور فرار از نماد در یک عبارت منظم, شما باید دو بک اسلش ارسال (\\) در یک رشته تحت اللفظی. + +عبارت منظم با رشته کار می کند به عنوان اگر مجموعه ای از بایت است. عبارت منظم می تواند بایت پوچ نیست. +برای الگوهای به جستجو برای بسترهای در یک رشته, بهتر است به استفاده از مانند و یا ‘position’ از اونجایی که خیلی سریعتر کار میکنن + +## ملتمتچانی (کومه علف خشک, \[الگو1 الگو2, …, patternنه\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} + +همان `match`, اما بازده 0 اگر هیچ یک از عبارات منظم همسان و 1 اگر هر یک از الگوهای مسابقات. این استفاده می کند [hyperscan](https://github.com/intel/hyperscan) کتابخونه. برای الگوهای به جستجو بسترهای در یک رشته, بهتر است به استفاده از `multiSearchAny` چون خیلی سریعتر کار میکنه + +!!! note "یادداشت" + طول هر یک از `haystack` رشته باید کمتر از 2 باشد32 بایت در غیر این صورت استثنا پرتاب می شود. این محدودیت صورت می گیرد به دلیل hyperscan API. + +## مقالههای جدید مرتبط با تحقیق این نویسنده1 الگو2, …, patternنه\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} + +همان `multiMatchAny`, اما بازگرداندن هر شاخص که منطبق بر انبار کاه. + +## اطلاعات دقیق1 الگو2, …, patternنه\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} + +همان `multiMatchAny`, اما بازگرداندن مجموعه ای از تمام شاخص که مطابقت انبار کاه در هر سفارش. + +## چندبازیماتچانی (هیستک, فاصله, \[الگو1 الگو2, …, patternنه\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} + +همان `multiMatchAny`, اما بازده 1 اگر هر الگوی منطبق انبار کاه در یک ثابت [ویرایش فاصله](https://en.wikipedia.org/wiki/Edit_distance). این تابع نیز در حالت تجربی است و می تواند بسیار کند باشد. برای اطلاعات بیشتر نگاه کنید به [hyperscan مستندات](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). + +## چند شکلی (هیستاک, فاصله, \[الگو1 الگو2, …, patternنه\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} + +همان `multiFuzzyMatchAny`, اما می گرداند هر شاخص که منطبق بر انبار کاه در فاصله ویرایش ثابت. + +## بازهای چندگانه (انبار کاه, فاصله, \[الگو1 الگو2, …, patternنه\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} + +همان `multiFuzzyMatchAny`, اما بازگرداندن مجموعه ای از تمام شاخص در هر منظور که مطابقت با انبار کاه در فاصله ویرایش ثابت. + +!!! note "یادداشت" + `multiFuzzyMatch*` توابع از عبارات منظم یونایتد-8 پشتیبانی نمی کنند و چنین عبارات به عنوان بایت به دلیل محدودیت هیپراکسان درمان می شوند. + +!!! note "یادداشت" + برای خاموش کردن تمام توابع است که با استفاده از بیش از حد اسکان, استفاده از تنظیمات `SET allow_hyperscan = 0;`. + +## عصاره (انبار کاه, الگو) {#extracthaystack-pattern} + +عصاره یک قطعه از یک رشته با استفاده از یک عبارت منظم. اگر ‘haystack’ با ‘pattern’ عبارت منظم, یک رشته خالی بازگشته است. اگر عبارت منظم حاوی وسترن نیست, طول می کشد قطعه که منطبق بر کل عبارت منظم. در غیر این صورت قطعه ای را می گیرد که با اولین زیر دست ساز مطابقت دارد. + +## خارج تماس بگیرید) {#extractallhaystack-pattern} + +عصاره تمام قطعات از یک رشته با استفاده از یک عبارت منظم. اگر ‘haystack’ با ‘pattern’ عبارت منظم, یک رشته خالی بازگشته است. بازگرداندن مجموعه ای از رشته متشکل از تمام مسابقات به عبارت منظم. به طور کلی, رفتار همان است که ‘extract’ تابع (در آن طول می کشد برای اولین بار subpattern یا کل بیان اگر وجود ندارد subpattern). + +## مانند (کومه علف خشک, الگو), کومه علف خشک مانند اپراتور الگوی {#function-like} + +بررسی اینکه یک رشته منطبق یک عبارت ساده به طور منظم. +عبارت منظم می تواند حاوی متسیمبلس باشد `%` و `_`. + +`%` نشان می دهد هر مقدار از هر بایت (از جمله صفر شخصیت). + +`_` نشان می دهد هر یک بایت. + +از بک اسلش استفاده کنید (`\`) برای فرار از متسیمبلس . توجه داشته باشید در فرار در شرح ‘match’ تابع. + +برای عبارات منظم مانند `%needle%`, کد مطلوب تر است و کار می کند به همان سرعتی که `position` تابع. +برای دیگر عبارات منظم, کد همان است که برای است ‘match’ تابع. + +## notLike(انبار کاه pattern), انبار کاه نیست مانند الگوی اپراتور {#function-notlike} + +همان چیزی که به عنوان ‘like’, اما منفی. + +## نمک زدایی (انبار کاه, سوزن) {#ngramdistancehaystack-needle} + +محاسبه فاصله 4 گرم بین `haystack` و `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` یا `haystack` بیش از 32 کیلوبایت است, می اندازد یک استثنا. اگر برخی از غیر ثابت `haystack` یا `needle` رشته ها بیش از 32 کیلوبایت, فاصله است که همیشه یکی. + +برای جستجوی غیر حساس به حالت یا / و در توابع استفاده از فرمت جی تی اف 8 `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. + +## نگراماسراچ (هیستک سوزن) {#ngramsearchhaystack-needle} + +مثل `ngramDistance` اما محاسبه تفاوت غیر متقارن بین `needle` و `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` مامان بزرگ نزدیک تر به یک, بیشتر احتمال دارد `needle` در `haystack`. می تواند برای جستجو رشته فازی مفید باشد. + +برای جستجوی غیر حساس به حالت یا / و در توابع استفاده از فرمت جی تی اف 8 `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. + +!!! note "یادداشت" + For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/fa/sql-reference/functions/type-conversion-functions.md b/docs/fa/sql-reference/functions/type-conversion-functions.md new file mode 100644 index 00000000000..85f681d028e --- /dev/null +++ b/docs/fa/sql-reference/functions/type-conversion-functions.md @@ -0,0 +1,534 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: "\u062A\u0628\u062F\u06CC\u0644 \u0646\u0648\u0639" +--- + +# توابع تبدیل نوع {#type-conversion-functions} + +## مشکلات متداول تبدیل عددی {#numeric-conversion-issues} + +هنگامی که شما یک مقدار تبدیل از یک به نوع داده های دیگر, شما باید به یاد داشته باشید که در مورد مشترک, این یک عملیات نا امن است که می تواند به از دست دادن داده ها منجر شود. از دست دادن داده ها می تواند رخ دهد اگر شما سعی می کنید به جا ارزش از یک نوع داده بزرگتر به یک نوع داده کوچکتر, و یا اگر شما ارزش بین انواع داده های مختلف تبدیل. + +کلیک کرده است [همان رفتار به عنوان ج++ برنامه](https://en.cppreference.com/w/cpp/language/implicit_conversion). + +## toInt(8/16/32/64) {#toint8163264} + +تبدیل یک مقدار ورودی به [Int](../../sql-reference/data-types/int-uint.md) نوع داده. این خانواده تابع شامل: + +- `toInt8(expr)` — Results in the `Int8` نوع داده. +- `toInt16(expr)` — Results in the `Int16` نوع داده. +- `toInt32(expr)` — Results in the `Int32` نوع داده. +- `toInt64(expr)` — Results in the `Int64` نوع داده. + +**پارامترها** + +- `expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد یا یک رشته با نمایش اعشاری یک عدد. دودویی, مبنای هشت, و بازنمایی هگزادسیمال از اعداد پشتیبانی نمی شوند. صفر منجر محروم هستند. + +**مقدار بازگشتی** + +مقدار صحیح در `Int8`, `Int16`, `Int32` یا `Int64` نوع داده. + +توابع استفاده [گرد کردن به سمت صفر](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) یعنی عدد کسری از اعداد را کوتاه می کنند. + +رفتار توابع برای [هشدار داده می شود](../../sql-reference/data-types/float.md#data_type-float-nan-inf) استدلال تعریف نشده است. به یاد داشته باشید در مورد [مسایل همگرایی عددی](#numeric-conversion-issues), هنگام استفاده از توابع. + +**مثال** + +``` sql +SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) +``` + +``` text +┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ +│ -9223372036854775808 │ 32 │ 16 │ 8 │ +└──────────────────────┴─────────────┴───────────────┴─────────────┘ +``` + +## toInt(8/16/32/64)OrZero {#toint8163264orzero} + +این استدلال از نوع رشته طول می کشد و تلاش می کند تا به اعضای هیات تجزیه (8 \| 16 \| 32 \| 64). اگر شکست خورده, بازده 0. + +**مثال** + +``` sql +select toInt64OrZero('123123'), toInt8OrZero('123qwe123') +``` + +``` text +┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ +│ 123123 │ 0 │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toInt(8/16/32/64)OrNull {#toint8163264ornull} + +این استدلال از نوع رشته طول می کشد و تلاش می کند تا به اعضای هیات تجزیه (8 \| 16 \| 32 \| 64). اگر شکست خورده, تهی گرداند. + +**مثال** + +``` sql +select toInt64OrNull('123123'), toInt8OrNull('123qwe123') +``` + +``` text +┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ +│ 123123 │ ᴺᵁᴸᴸ │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toUInt(8/16/32/64) {#touint8163264} + +تبدیل یک مقدار ورودی به [اینترنت](../../sql-reference/data-types/int-uint.md) نوع داده. این خانواده تابع شامل: + +- `toUInt8(expr)` — Results in the `UInt8` نوع داده. +- `toUInt16(expr)` — Results in the `UInt16` نوع داده. +- `toUInt32(expr)` — Results in the `UInt32` نوع داده. +- `toUInt64(expr)` — Results in the `UInt64` نوع داده. + +**پارامترها** + +- `expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد یا یک رشته با نمایش اعشاری یک عدد. دودویی, مبنای هشت, و بازنمایی هگزادسیمال از اعداد پشتیبانی نمی شوند. صفر منجر محروم هستند. + +**مقدار بازگشتی** + +مقدار صحیح در `UInt8`, `UInt16`, `UInt32` یا `UInt64` نوع داده. + +توابع استفاده [گرد کردن به سمت صفر](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) یعنی عدد کسری از اعداد را کوتاه می کنند. + +رفتار توابع برای کشاورزی منفی و برای [هشدار داده می شود](../../sql-reference/data-types/float.md#data_type-float-nan-inf) استدلال تعریف نشده است. اگر شما یک رشته عبور با تعداد منفی, مثلا `'-32'`, خانه را افزایش می دهد یک استثنا. به یاد داشته باشید در مورد [مسایل همگرایی عددی](#numeric-conversion-issues), هنگام استفاده از توابع. + +**مثال** + +``` sql +SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) +``` + +``` text +┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ +│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ +└─────────────────────┴───────────────┴────────────────┴──────────────┘ +``` + +## toUInt(8/16/32/64)OrZero {#touint8163264orzero} + +## toUInt(8/16/32/64)OrNull {#touint8163264ornull} + +## توفلوات (32/64) {#tofloat3264} + +## toFloat(32/64)OrZero {#tofloat3264orzero} + +## toFloat(32/64)OrNull {#tofloat3264ornull} + +## toDate {#todate} + +## تودارزرو {#todateorzero} + +## طول عمر {#todateornull} + +## toDateTime {#todatetime} + +## به اندازه تو {#todatetimeorzero} + +## طول عمر ترنول {#todatetimeornull} + +## toDecimal(32/64/128) {#todecimal3264128} + +تبدیل `value` به [دهدهی](../../sql-reference/data-types/decimal.md) نوع داده با دقت `S`. این `value` می تواند یک عدد یا یک رشته. این `S` (مقیاس) پارامتر تعداد رقم اعشار را مشخص می کند. + +- `toDecimal32(value, S)` +- `toDecimal64(value, S)` +- `toDecimal128(value, S)` + +## toDecimal(32/64/128)OrNull {#todecimal3264128ornull} + +تبدیل یک رشته ورودی به یک [Nullable(اعشاری(P,S))](../../sql-reference/data-types/decimal.md) مقدار نوع داده. این خانواده از توابع عبارتند از: + +- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` نوع داده. +- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` نوع داده. +- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` نوع داده. + +این توابع باید به جای استفاده `toDecimal*()` توابع, اگر شما ترجیح می دهید برای دریافت یک `NULL` ارزش به جای یک استثنا در صورت خطا تجزیه ارزش ورودی. + +**پارامترها** + +- `expr` — [عبارت](../syntax.md#syntax-expressions), بازگرداندن یک مقدار در [رشته](../../sql-reference/data-types/string.md) نوع داده. تاتر انتظار نمایندگی متنی از عدد اعشاری. به عنوان مثال, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**مقدار بازگشتی** + +یک مقدار در `Nullable(Decimal(P,S))` نوع داده. مقدار شامل: + +- شماره با `S` اعشار, اگر تاتر تفسیر رشته ورودی به عنوان یک عدد. +- `NULL`, اگر تاتر می توانید رشته ورودی به عنوان یک عدد تفسیر نمی کند و یا اگر تعداد ورودی شامل بیش از `S` رقم اعشار. + +**مثالها** + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ +│ -1.11100 │ Nullable(Decimal(9, 5)) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ +│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toDecimal(32/64/128)OrZero {#todecimal3264128orzero} + +تبدیل یک مقدار ورودی به [دهدهی)](../../sql-reference/data-types/decimal.md) نوع داده. این خانواده از توابع عبارتند از: + +- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` نوع داده. +- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` نوع داده. +- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` نوع داده. + +این توابع باید به جای استفاده `toDecimal*()` توابع, اگر شما ترجیح می دهید برای دریافت یک `0` ارزش به جای یک استثنا در صورت خطا تجزیه ارزش ورودی. + +**پارامترها** + +- `expr` — [عبارت](../syntax.md#syntax-expressions), بازگرداندن یک مقدار در [رشته](../../sql-reference/data-types/string.md) نوع داده. تاتر انتظار نمایندگی متنی از عدد اعشاری. به عنوان مثال, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**مقدار بازگشتی** + +یک مقدار در `Nullable(Decimal(P,S))` نوع داده. مقدار شامل: + +- شماره با `S` اعشار, اگر تاتر تفسیر رشته ورودی به عنوان یک عدد. +- 0 با `S` رقم اعشار, اگر تاتر می توانید رشته ورودی به عنوان یک عدد تفسیر نمی کند و یا اگر تعداد ورودی شامل بیش از `S` رقم اعشار. + +**مثال** + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ +│ -1.11100 │ Decimal(9, 5) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ +│ 0.00 │ Decimal(9, 2) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toString {#tostring} + +توابع برای تبدیل بین اعداد, رشته ها (اما رشته ثابت نیست), تاریخ, و تاریخ با زمان. +همه این توابع قبول یک استدلال. + +در هنگام تبدیل به و یا از یک رشته, ارزش فرمت شده و یا تجزیه با استفاده از قوانین مشابه برای فرمت جدولبندیشده (و تقریبا تمام فرمت های متنی دیگر). اگر رشته را نمی توان تجزیه, یک استثنا پرتاب می شود و درخواست لغو شده است. + +هنگام تبدیل تاریخ به اعداد و یا بالعکس, تاریخ مربوط به تعداد روز از ابتدای عصر یونیکس. +هنگام تبدیل تاریخ با بار به اعداد و یا بالعکس, تاریخ با زمان مربوط به تعداد ثانیه از ابتدای عصر یونیکس. + +تاریخ و تاریخ-با-فرمت زمان برای todate/todatetime توابع تعریف شده به شرح زیر است: + +``` text +YYYY-MM-DD +YYYY-MM-DD hh:mm:ss +``` + +به عنوان یک استثنا اگر تبدیل از uint32, int32, uint64 یا int64 عددی انواع, به, تاریخ, و اگر عدد بزرگتر یا مساوی به 65536 تعدادی را به عنوان تفسیر یک زمان یونیکس (و نه به عنوان تعداد روز) و گرد است به تاریخ. این اجازه می دهد تا پشتیبانی از وقوع مشترک نوشتن ‘toDate(unix\_timestamp)’ که در غیر این صورت یک خطا خواهد بود و نیاز به نوشتن بیشتر دست و پا گیر ‘toDate(toDateTime(unix\_timestamp))’. + +تبدیل بین تاریخ و تاریخ با زمان انجام شده است راه طبیعی: با اضافه کردن یک زمان خالی و یا حذف زمان. + +تبدیل بین انواع عددی با استفاده از قوانین مشابه به عنوان تکالیف بین انواع مختلف عددی در ج++. + +علاوه بر این, تابع حول از استدلال حسگر ناحیه رنگی می توانید یک استدلال رشته دوم حاوی نام منطقه زمانی را. مثال: `Asia/Yekaterinburg` در این مورد, زمان با توجه به منطقه زمانی مشخص فرمت. + +``` sql +SELECT + now() AS now_local, + toString(now(), 'Asia/Yekaterinburg') AS now_yekat +``` + +``` text +┌───────────now_local─┬─now_yekat───────────┐ +│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ +└─────────────────────┴─────────────────────┘ +``` + +همچنین `toUnixTimestamp` تابع. + +## وضعیت زیستشناختی رکورد) {#tofixedstrings-n} + +تبدیل یک استدلال نوع رشته به یک رشته (نفر) نوع (یک رشته با طول ثابت نفر). نفر باید ثابت باشد. +اگر رشته دارای بایت کمتر از نفر, این است که با بایت پوچ به سمت راست منتقل. اگر رشته دارای بایت بیش از نفر, یک استثنا پرتاب می شود. + +## در حال بارگذاری) {#tostringcuttozeros} + +می پذیرد یک رشته یا رشته ثابت استدلال. بازگرداندن رشته با محتوای کوتاه در اولین صفر بایت پیدا شده است. + +مثال: + +``` sql +SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s─────────────┬─s_cut─┐ +│ foo\0\0\0\0\0 │ foo │ +└───────────────┴───────┘ +``` + +``` sql +SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s──────────┬─s_cut─┐ +│ foo\0bar\0 │ foo │ +└────────────┴───────┘ +``` + +## reinterpretAsUInt(8/16/32/64) {#reinterpretasuint8163264} + +## reinterpretAsInt(8/16/32/64) {#reinterpretasint8163264} + +## تفسیر مجدد (32/64) {#reinterpretasfloat3264} + +## بازخوانی مجدد {#reinterpretasdate} + +## حسگر ناحیه رنگی {#reinterpretasdatetime} + +این توابع یک رشته را قبول می کنند و بایت هایی را که در ابتدای رشته قرار می گیرند به عنوان یک عدد در دستور میزبان (اندی کوچک) تفسیر می کنند. اگر رشته به اندازه کافی بلند نیست, توابع کار به عنوان اگر رشته با تعداد لازم از بایت پوچ خالی. اگر رشته طولانی تر از مورد نیاز است, بایت اضافی نادیده گرفته می شوند. تاریخ به عنوان تعداد روز از ابتدای عصر یونیکس تفسیر و تاریخ با زمان به عنوان تعداد ثانیه از ابتدای عصر یونیکس تفسیر شده است. + +## رشته مجدد {#type_conversion_functions-reinterpretAsString} + +این تابع یک شماره یا تاریخ و یا تاریخ با زمان می پذیرد, و یک رشته حاوی بایت به نمایندگی از ارزش مربوطه را در سفارش میزبان را برمی گرداند (اندی کمی). بایت پوچ از پایان کاهش یافته است. مثلا, ارزش نوع اوینت32 255 یک رشته است که یک بایت طولانی است. + +## رشته مجدد {#reinterpretasfixedstring} + +این تابع یک شماره یا تاریخ و یا تاریخ با زمان می پذیرد, و یک رشته ثابت حاوی بایت به نمایندگی از ارزش مربوطه را در سفارش میزبان را برمی گرداند (اندی کمی). بایت پوچ از پایان کاهش یافته است. مثلا, ارزش نوع اوینت32 255 رشته ثابت است که یک بایت طولانی است. + +## قالب (ایکس تی) {#type_conversion_function-cast} + +تبدیل ‘x’ به ‘t’ نوع داده. بازیگران نحو (ایکس به عنوان تی) نیز پشتیبانی می کند. + +مثال: + +``` sql +SELECT + '2016-06-15 23:00:00' AS timestamp, + CAST(timestamp AS DateTime) AS datetime, + CAST(timestamp AS Date) AS date, + CAST(timestamp, 'String') AS string, + CAST(timestamp, 'FixedString(22)') AS fixed_string +``` + +``` text +┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ +└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ +``` + +تبدیل به fixedstring(n) تنها با این نسخهها کار برای استدلال از نوع string یا fixedstring(n). + +تبدیل نوع به [Nullable](../../sql-reference/data-types/nullable.md) و پشت پشتیبانی می شود. مثال: + +``` sql +SELECT toTypeName(x) FROM t_null +``` + +``` text +┌─toTypeName(x)─┐ +│ Int8 │ +│ Int8 │ +└───────────────┘ +``` + +``` sql +SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null +``` + +``` text +┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ +│ Nullable(UInt16) │ +│ Nullable(UInt16) │ +└─────────────────────────────────────────┘ +``` + +## توینتال (سال / سه ماهه / ماه / هفته / روز / ساعت / دقیقه / ثانیه) {#function-tointerval} + +تبدیل یک استدلال نوع شماره به یک [فاصله](../../sql-reference/data-types/special-data-types/interval.md) نوع داده. + +**نحو** + +``` sql +toIntervalSecond(number) +toIntervalMinute(number) +toIntervalHour(number) +toIntervalDay(number) +toIntervalWeek(number) +toIntervalMonth(number) +toIntervalQuarter(number) +toIntervalYear(number) +``` + +**پارامترها** + +- `number` — Duration of interval. Positive integer number. + +**مقادیر بازگشتی** + +- مقدار در `Interval` نوع داده. + +**مثال** + +``` sql +WITH + toDate('2019-01-01') AS date, + INTERVAL 1 WEEK AS interval_week, + toIntervalWeek(1) AS interval_to_week +SELECT + date + interval_week, + date + interval_to_week +``` + +``` text +┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ +│ 2019-01-08 │ 2019-01-08 │ +└───────────────────────────┴──────────────────────────────┘ +``` + +## پردازش زمان {#parsedatetimebesteffort} + +تبدیل یک تاریخ و زمان در [رشته](../../sql-reference/data-types/string.md) نمایندگی به [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) نوع داده. + +تابع تجزیه می کند [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [1123-5.2.14 تومان-822 تاریخ و زمان مشخصات](https://tools.ietf.org/html/rfc1123#page-55), را کلیک کنید و برخی از فرمت های تاریخ و زمان دیگر. + +**نحو** + +``` sql +parseDateTimeBestEffort(time_string [, time_zone]); +``` + +**پارامترها** + +- `time_string` — String containing a date and time to convert. [رشته](../../sql-reference/data-types/string.md). +- `time_zone` — Time zone. The function parses `time_string` با توجه به منطقه زمانی. [رشته](../../sql-reference/data-types/string.md). + +**فرمت های غیر استاندارد پشتیبانی شده** + +- یک رشته حاوی 9..10 رقمی [برچسب زمان یونیکس](https://en.wikipedia.org/wiki/Unix_time). +- یک رشته با یک تاریخ و یک مولفه زمان: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, و غیره. +- یک رشته با یک تاریخ, اما هیچ مولفه زمان: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` و غیره +- یک رشته با یک روز و زمان: `DD`, `DD hh`, `DD hh:mm`. در این مورد `YYYY-MM` به عنوان جایگزین `2000-01`. +- یک رشته است که شامل تاریخ و زمان همراه با منطقه زمانی اطلاعات افست: `YYYY-MM-DD hh:mm:ss ±h:mm`, و غیره. به عنوان مثال, `2020-12-12 17:36:00 -5:00`. + +برای همه فرمت های با جدا تابع تجزیه نام ماه بیان شده توسط نام کامل خود و یا با سه حرف اول یک نام ماه. مثالها: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. + +**مقدار بازگشتی** + +- `time_string` تبدیل به `DateTime` نوع داده. + +**مثالها** + +پرسوجو: + +``` sql +SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') +AS parseDateTimeBestEffort; +``` + +نتیجه: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2020-12-12 12:12:57 │ +└─────────────────────────┘ +``` + +پرسوجو: + +``` sql +SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') +AS parseDateTimeBestEffort +``` + +نتیجه: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-08-18 10:22:16 │ +└─────────────────────────┘ +``` + +پرسوجو: + +``` sql +SELECT parseDateTimeBestEffort('1284101485') +AS parseDateTimeBestEffort +``` + +نتیجه: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2015-07-07 12:04:41 │ +└─────────────────────────┘ +``` + +پرسوجو: + +``` sql +SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') +AS parseDateTimeBestEffort +``` + +نتیجه: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-12-12 10:12:12 │ +└─────────────────────────┘ +``` + +پرسوجو: + +``` sql +SELECT parseDateTimeBestEffort('10 20:19') +``` + +نتیجه: + +``` text +┌─parseDateTimeBestEffort('10 20:19')─┐ +│ 2000-01-10 20:19:00 │ +└─────────────────────────────────────┘ +``` + +**همچنین نگاه کنید** + +- \[ISO 8601 announcement by @xkcd\])https://xkcd.com/1179/) +- [RFC 1123](https://tools.ietf.org/html/rfc1123) +- [toDate](#todate) +- [toDateTime](#todatetime) + +## - ترجمه نشده - {#parsedatetimebesteffortornull} + +همان است که برای [پردازش زمان](#parsedatetimebesteffort) با این تفاوت که وقتی با فرمت تاریخ مواجه می شود که نمی تواند پردازش شود تهی می شود. + +## - ترجمه نشده - {#parsedatetimebesteffortorzero} + +همان است که برای [پردازش زمان](#parsedatetimebesteffort) با این تفاوت که تاریخ صفر یا زمان صفر را باز می گرداند زمانی که یک فرمت تاریخ مواجه است که نمی تواند پردازش شود. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/fa/sql-reference/functions/url-functions.md b/docs/fa/sql-reference/functions/url-functions.md new file mode 100644 index 00000000000..5ef0274e234 --- /dev/null +++ b/docs/fa/sql-reference/functions/url-functions.md @@ -0,0 +1,210 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0646\u0634\u0627\u0646\u06CC\u0647\u0627\ + \ \u06CC \u0627\u06CC\u0646\u062A\u0631\u0646\u062A\u06CC" +--- + +# توابع برای کار با نشانیهای اینترنتی {#functions-for-working-with-urls} + +همه این توابع را دنبال کنید. حداکثر برای بهبود عملکرد ساده شده اند. + +## توابع استخراج بخشهایی از نشانی وب {#functions-that-extract-parts-of-a-url} + +اگر قسمت مربوطه در نشانی وب وجود نداشته باشد یک رشته خالی برگردانده میشود. + +### قرارداد {#protocol} + +پروتکل را از نشانی اینترنتی خارج میکند. + +Examples of typical returned values: http, https, ftp, mailto, tel, magnet… + +### دامنه {#domain} + +نام میزبان را از یک نشانی اینترنتی استخراج می کند. + +``` sql +domain(url) +``` + +**پارامترها** + +- `url` — URL. Type: [رشته](../../sql-reference/data-types/string.md). + +نشانی وب را می توان با یا بدون یک طرح مشخص شده است. مثالها: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +برای این نمونه ها `domain` تابع نتایج زیر را برمی گرداند: + +``` text +some.svn-hosting.com +some.svn-hosting.com +yandex.com +``` + +**مقادیر بازگشتی** + +- نام میزبان. اگر کلیک هاوس می تواند رشته ورودی را به عنوان نشانی وب تجزیه کند. +- رشته خالی. اگر کلیکهاوس نمیتواند رشته ورودی را به عنوان نشانی وب تجزیه کند. + +نوع: `String`. + +**مثال** + +``` sql +SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ +│ some.svn-hosting.com │ +└────────────────────────────────────────────────────────┘ +``` + +### دامینویتهویتوو {#domainwithoutwww} + +بازگرداندن دامنه و حذف بیش از یک ‘www.’ اگه از اول شروع بشه + +### توپولدومین {#topleveldomain} + +عصاره این دامنه سطح بالا از یک url. + +``` sql +topLevelDomain(url) +``` + +**پارامترها** + +- `url` — URL. Type: [رشته](../../sql-reference/data-types/string.md). + +نشانی وب را می توان با یا بدون یک طرح مشخص شده است. مثالها: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +**مقادیر بازگشتی** + +- نام دامنه. اگر کلیک هاوس می تواند رشته ورودی را به عنوان نشانی وب تجزیه کند. +- رشته خالی. اگر کلیکهاوس نمیتواند رشته ورودی را به عنوان نشانی وب تجزیه کند. + +نوع: `String`. + +**مثال** + +``` sql +SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ +│ com │ +└────────────────────────────────────────────────────────────────────┘ +``` + +### در حال بارگذاری {#firstsignificantsubdomain} + +بازگرداندن “first significant subdomain”. این یک مفهوم غیر استاندارد خاص به یاندکس است.متریکا اولین زیر دامنه قابل توجهی یک دامنه سطح دوم است ‘com’, ‘net’, ‘org’ یا ‘co’. در غیر این صورت, این یک دامنه سطح سوم است. به عنوان مثال, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. فهرست “insignificant” دامنه های سطح دوم و سایر اطلاعات پیاده سازی ممکن است در اینده تغییر کند. + +### در حال بارگذاری {#cuttofirstsignificantsubdomain} + +بازگرداندن بخشی از دامنه است که شامل زیر دامنه سطح بالا تا “first significant subdomain” (توضیح بالا را ببینید). + +به عنوان مثال, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. + +### مسیر {#path} + +مسیر را برمی گرداند. مثال: `/top/news.html` مسیر رشته پرس و جو را شامل نمی شود. + +### مسیر {#pathfull} + +همان بالا, اما از جمله رشته پرس و جو و قطعه. مثال:/بالا / اخبار.زنگامصفحه = 2 \# نظرات + +### رشته {#querystring} + +بازگرداندن رشته پرس و جو. مثال: صفحه=1&چاپی=213. پرس و جو رشته علامت سوال اولیه را شامل نمی شود, و همچنین \# و همه چیز بعد از \#. + +### قطعه {#fragment} + +بازگرداندن شناسه قطعه. قطعه می کند نماد هش اولیه را شامل نمی شود. + +### وضعیت زیستشناختی رکورد {#querystringandfragment} + +بازگرداندن رشته پرس و جو و شناسه قطعه. مثال: صفحه=1\#29390. + +### نام) {#extracturlparameterurl-name} + +بازگرداندن ارزش ‘name’ پارامتر در نشانی وب, در صورت وجود. در غیر این صورت, یک رشته خالی. اگر پارامترهای بسیاری با این نام وجود دارد, این اولین رخداد را برمی گرداند. این تابع با این فرض کار می کند که نام پارامتر در نشانی اینترنتی دقیقا به همان شیوه در استدلال گذشت کد گذاری شده است. + +### شمارش معکوس) {#extracturlparametersurl} + +مجموعه ای از نام=رشته ارزش مربوط به پارامترهای نشانی وب را برمی گرداند. ارزش ها به هیچ وجه رمزگشایی نمی. + +### extractURLParameterNames(URL) {#extracturlparameternamesurl} + +مجموعه ای از نام رشته های مربوط به نام پارامترهای نشانی وب را باز می گرداند. ارزش ها به هیچ وجه رمزگشایی نمی. + +### URLHierarchy(URL) {#urlhierarchyurl} + +را برمی گرداند مجموعه ای حاوی نشانی اینترنتی, کوتاه در پایان توسط علامت /,? در مسیر و پرس و جو-رشته. کاراکتر جداکننده متوالی به عنوان یکی شمارش می شود. برش در موقعیت بعد از تمام کاراکتر جدا متوالی ساخته شده است. + +### URLPathHierarchy(URL) {#urlpathhierarchyurl} + +همانطور که در بالا, اما بدون پروتکل و میزبان در نتیجه. / عنصر (ریشه) گنجانده نشده است. به عنوان مثال: تابع استفاده می شود برای پیاده سازی درخت گزارش نشانی اینترنتی در یاندکس. متریک. + +``` text +URLPathHierarchy('https://example.com/browse/CONV-6788') = +[ + '/browse/', + '/browse/CONV-6788' +] +``` + +### نما & نشانی وب) {#decodeurlcomponenturl} + +را برمی گرداند نشانی اینترنتی رمزگشایی. +مثال: + +``` sql +SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; +``` + +``` text +┌─DecodedURL─────────────────────────────┐ +│ http://127.0.0.1:8123/?query=SELECT 1; │ +└────────────────────────────────────────┘ +``` + +## توابع که حذف بخشی از یک نشانی وب {#functions-that-remove-part-of-a-url} + +اگر نشانی وب هیچ چیز مشابه ندارد, نشانی اینترنتی بدون تغییر باقی می ماند. + +### بریدن {#cutwww} + +حذف بیش از یک ‘www.’ از ابتدای دامنه نشانی اینترنتی در صورت وجود. + +### & رشته {#cutquerystring} + +حذف رشته پرس و جو. علامت سوال نیز حذف شده است. + +### تقسیم {#cutfragment} + +حذف شناسه قطعه. علامت شماره نیز حذف شده است. + +### هشدار داده می شود {#cutquerystringandfragment} + +حذف رشته پرس و جو و شناسه قطعه. علامت سوال و علامت شماره نیز حذف شده است. + +### cutURLParameter(URL, نام) {#cuturlparameterurl-name} + +حذف ‘name’ پارامتر نشانی وب, در صورت وجود. این تابع با این فرض کار می کند که نام پارامتر در نشانی اینترنتی دقیقا به همان شیوه در استدلال گذشت کد گذاری شده است. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/fa/sql-reference/functions/uuid-functions.md b/docs/fa/sql-reference/functions/uuid-functions.md new file mode 100644 index 00000000000..7c51b0065f7 --- /dev/null +++ b/docs/fa/sql-reference/functions/uuid-functions.md @@ -0,0 +1,122 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 53 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u06CC\u0648\u06CC\u062F" +--- + +# توابع برای کار با یوید {#functions-for-working-with-uuid} + +توابع برای کار با شناسه به شرح زیر است. + +## جنراتیدو4 {#uuid-function-generate} + +تولید [UUID](../../sql-reference/data-types/uuid.md) از [نسخه 4](https://tools.ietf.org/html/rfc4122#section-4.4). + +``` sql +generateUUIDv4() +``` + +**مقدار بازگشتی** + +مقدار نوع شناسه. + +**مثال طریقه استفاده** + +این مثال نشان می دهد ایجاد یک جدول با ستون نوع شناسه و قرار دادن یک مقدار به جدول. + +``` sql +CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog + +INSERT INTO t_uuid SELECT generateUUIDv4() + +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┐ +│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ +└──────────────────────────────────────┘ +``` + +## شناسه بسته:) {#touuid-x} + +تبدیل مقدار نوع رشته به نوع شناسه. + +``` sql +toUUID(String) +``` + +**مقدار بازگشتی** + +این uuid نوع ارزش است. + +**مثال طریقه استفاده** + +``` sql +SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid +``` + +``` text +┌─────────────────────────────────uuid─┐ +│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ +└──────────────────────────────────────┘ +``` + +## وضعیت زیستشناختی رکورد {#uuidstringtonum} + +می پذیرد یک رشته حاوی 36 کاراکتر در قالب `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` و به عنوان مجموعه ای از بایت ها در یک [رشته ثابت (16)](../../sql-reference/data-types/fixedstring.md). + +``` sql +UUIDStringToNum(String) +``` + +**مقدار بازگشتی** + +رشته ثابت (16) + +**نمونه های استفاده** + +``` sql +SELECT + '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, + UUIDStringToNum(uuid) AS bytes +``` + +``` text +┌─uuid─────────────────────────────────┬─bytes────────────┐ +│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ +└──────────────────────────────────────┴──────────────────┘ +``` + +## هشدار داده می شود {#uuidnumtostring} + +می پذیرد [رشته ثابت (16)](../../sql-reference/data-types/fixedstring.md) ارزش, و یک رشته حاوی گرداند 36 شخصیت در قالب متن. + +``` sql +UUIDNumToString(FixedString(16)) +``` + +**مقدار بازگشتی** + +رشته. + +**مثال طریقه استفاده** + +``` sql +SELECT + 'a/<@];!~p{jTj={)' AS bytes, + UUIDNumToString(toFixedString(bytes, 16)) AS uuid +``` + +``` text +┌─bytes────────────┬─uuid─────────────────────────────────┐ +│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ +└──────────────────┴──────────────────────────────────────┘ +``` + +## همچنین نگاه کنید به {#see-also} + +- [دیکتاتوری](ext-dict-functions.md#ext_dict_functions-other) + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/fa/sql-reference/functions/ym-dict-functions.md b/docs/fa/sql-reference/functions/ym-dict-functions.md new file mode 100644 index 00000000000..625b36ec83e --- /dev/null +++ b/docs/fa/sql-reference/functions/ym-dict-functions.md @@ -0,0 +1,157 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 59 +toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u06CC\u0627\u0646\u062F\u06A9\u0633.\u0648\ + \u0627\u0698\u0647\u0646\u0627\u0645\u0647\u0647\u0627 \u0645\u062A\u0631\u06CC\u06A9\ + \u0627" +--- + +# توابع برای کار با یاندکس.واژهنامهها متریکا {#functions-for-working-with-yandex-metrica-dictionaries} + +به منظور توابع زیر به کار پیکربندی سرور باید مشخص مسیر و نشانی برای گرفتن تمام یاندکس.واژهنامهها متریکا. لغت نامه ها در اولین تماس از هر یک از این توابع لود می شود. اگر لیست مرجع نمی تواند لود شود, یک استثنا پرتاب می شود. + +برای اطلاعات در مورد ایجاد لیست مرجع, بخش را ببینید “Dictionaries”. + +## موقعیت جغرافیایی چندگانه {#multiple-geobases} + +ClickHouse پشتیبانی از کار با چند جایگزین geobases (منطقه ای سلسله مراتب) به طور همزمان به منظور حمایت از دیدگاه های مختلف که در آن کشورهای خاص مناطق متعلق به. + +این ‘clickhouse-server’ پیکربندی فایل را با سلسله مراتب منطقه ای مشخص می کند::`/opt/geo/regions_hierarchy.txt` + +علاوه بر این فایل, همچنین برای فایل های جستجو در این نزدیکی هست که نماد \_ و هر پسوند اضافه به نام (قبل از پسوند فایل). +مثلا, همچنین فایل را پیدا خواهد کرد `/opt/geo/regions_hierarchy_ua.txt`, اگر در حال حاضر. + +`ua` کلید فرهنگ لغت نامیده می شود. برای یک فرهنگ لغت بدون پسوند, کلید یک رشته خالی است. + +تمام واژهنامهها دوباره لود شده در زمان اجرا (یک بار در هر تعداد معینی از ثانیه, همانطور که در دستور داخلی تعریف شده \_فرهنگ\_ پارامتر پیکربندی, و یا یک بار در ساعت به طور پیش فرض). با این حال, لیست لغت نامه های موجود تعریف شده است یک بار, زمانی که سرور شروع می شود. + +All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. +مثال: + +``` sql +regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt +``` + +### regionToCity(id\[, geobase\]) {#regiontocityid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. + +### regionToArea(id\[, geobase\]) {#regiontoareaid-geobase} + +تبدیل یک منطقه به یک منطقه (نوع 5 در پایگاه داده). در هر راه دیگر, این تابع همان است که ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ +│ │ +│ Moscow and Moscow region │ +│ St. Petersburg and Leningrad region │ +│ Belgorod region │ +│ Ivanovsk region │ +│ Kaluga region │ +│ Kostroma region │ +│ Kursk region │ +│ Lipetsk region │ +│ Orlov region │ +│ Ryazan region │ +│ Smolensk region │ +│ Tambov region │ +│ Tver region │ +│ Tula region │ +└──────────────────────────────────────────────────────┘ +``` + +### regionToDistrict(id\[, geobase\]) {#regiontodistrictid-geobase} + +تبدیل یک منطقه به یک منطقه فدرال (نوع 4 در پایگاه داده). در هر راه دیگر, این تابع همان است که ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ +│ │ +│ Central federal district │ +│ Northwest federal district │ +│ South federal district │ +│ North Caucases federal district │ +│ Privolga federal district │ +│ Ural federal district │ +│ Siberian federal district │ +│ Far East federal district │ +│ Scotland │ +│ Faroe Islands │ +│ Flemish region │ +│ Brussels capital region │ +│ Wallonia │ +│ Federation of Bosnia and Herzegovina │ +└──────────────────────────────────────────────────────────┘ +``` + +### regionToCountry(id\[, geobase\]) {#regiontocountryid-geobase} + +تبدیل یک منطقه به یک کشور. در هر راه دیگر, این تابع همان است که ‘regionToCity’. +مثال: `regionToCountry(toUInt32(213)) = 225` تبدیل مسکو (213) به روسیه (225). + +### regionToContinent(id\[, geobase\]) {#regiontocontinentid-geobase} + +تبدیل یک منطقه به یک قاره. در هر راه دیگر, این تابع همان است که ‘regionToCity’. +مثال: `regionToContinent(toUInt32(213)) = 10001` تبدیل مسکو (213) به اوراسیا (10001). + +### نقلقولهای جدید از این نویسنده) {#regiontotopcontinent-regiontotopcontinent} + +بالاترین قاره را در سلسله مراتب منطقه پیدا می کند. + +**نحو** + +``` sql +regionToTopContinent(id[, geobase]); +``` + +**پارامترها** + +- `id` — Region ID from the Yandex geobase. [UInt32](../../sql-reference/data-types/int-uint.md). +- `geobase` — Dictionary key. See [موقعیت جغرافیایی چندگانه](#multiple-geobases). [رشته](../../sql-reference/data-types/string.md). اختیاری. + +**مقدار بازگشتی** + +- شناسه قاره سطح بالا (دومی زمانی که شما صعود سلسله مراتب مناطق). +- 0, اگر هیچ کدام وجود دارد. + +نوع: `UInt32`. + +### regionToPopulation(id\[, geobase\]) {#regiontopopulationid-geobase} + +می شود جمعیت برای یک منطقه. +جمعیت را می توان در فایل های با پایگاه داده ثبت شده است. بخش را ببینید “External dictionaries”. +اگر جمعیت برای منطقه ثبت نشده, باز می گردد 0. +در یاندکس پایگاه جغرافیایی, جمعیت ممکن است برای مناطق کودک ثبت, اما نه برای مناطق پدر و مادر. + +### regionIn(lhs, rhs\[, geobase\]) {#regioninlhs-rhs-geobase} + +بررسی اینکه یک ‘lhs’ منطقه متعلق به ‘rhs’ منطقه. بازگرداندن یک عدد 18 برابر 1 اگر متعلق, یا 0 اگر تعلق ندارد. +The relationship is reflexive – any region also belongs to itself. + +### regionHierarchy(id\[, geobase\]) {#regionhierarchyid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. +مثال: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. + +### شناسه بسته:\]) {#regiontonameid-lang} + +Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn’t exist, an empty string is returned. + +`ua` و `uk` هر دو به معنای اوکراین. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/fa/sql-reference/index.md b/docs/fa/sql-reference/index.md new file mode 100644 index 00000000000..bcd48cf709d --- /dev/null +++ b/docs/fa/sql-reference/index.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: SQL Reference +toc_hidden: true +toc_priority: 28 +toc_title: "\u0645\u062E\u0641\u06CC" +--- + +# مرجع مربع {#sql-reference} + +- [SELECT](statements/select.md) +- [INSERT INTO](statements/insert-into.md) +- [CREATE](statements/create.md) +- [ALTER](statements/alter.md#query_language_queries_alter) +- [انواع دیگر نمایش داده شد](statements/misc.md) + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/fa/sql-reference/operators.md b/docs/fa/sql-reference/operators.md new file mode 100644 index 00000000000..3cec824e880 --- /dev/null +++ b/docs/fa/sql-reference/operators.md @@ -0,0 +1,278 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u0627\u067E\u0631\u0627\u062A\u0648\u0631\u0647\u0627" +--- + +# اپراتورها {#operators} + +همه اپراتورها در حال تبدیل به توابع مربوط به خود را در پرس و جو و تجزیه مرحله مطابق با اولویت و associativity. +گروه اپراتورهای به ترتیب اولویت ذکر شده (بالاتر در لیست است, زودتر اپراتور به استدلال خود متصل). + +## اپراتورهای دسترسی {#access-operators} + +`a[N]` – Access to an element of an array. The `arrayElement(a, N)` تابع. + +`a.N` – Access to a tuple element. The `tupleElement(a, N)` تابع. + +## اپراتور نفی عددی {#numeric-negation-operator} + +`-a` – The `negate (a)` تابع. + +## اپراتورهای ضرب و تقسیم {#multiplication-and-division-operators} + +`a * b` – The `multiply (a, b)` تابع. + +`a / b` – The `divide(a, b)` تابع. + +`a % b` – The `modulo(a, b)` تابع. + +## اپراتورهای جمع و تفریق {#addition-and-subtraction-operators} + +`a + b` – The `plus(a, b)` تابع. + +`a - b` – The `minus(a, b)` تابع. + +## مقایسه اپراتورها {#comparison-operators} + +`a = b` – The `equals(a, b)` تابع. + +`a == b` – The `equals(a, b)` تابع. + +`a != b` – The `notEquals(a, b)` تابع. + +`a <> b` – The `notEquals(a, b)` تابع. + +`a <= b` – The `lessOrEquals(a, b)` تابع. + +`a >= b` – The `greaterOrEquals(a, b)` تابع. + +`a < b` – The `less(a, b)` تابع. + +`a > b` – The `greater(a, b)` تابع. + +`a LIKE s` – The `like(a, b)` تابع. + +`a NOT LIKE s` – The `notLike(a, b)` تابع. + +`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. + +`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. + +## اپراتورها برای کار با مجموعه داده ها {#operators-for-working-with-data-sets} + +*ببینید [در اپراتورها](statements/select.md#select-in-operators).* + +`a IN ...` – The `in(a, b)` تابع. + +`a NOT IN ...` – The `notIn(a, b)` تابع. + +`a GLOBAL IN ...` – The `globalIn(a, b)` تابع. + +`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` تابع. + +## اپراتورها برای کار با تاریخ و زمان {#operators-datetime} + +### EXTRACT {#operator-extract} + +``` sql +EXTRACT(part FROM date); +``` + +عصاره بخشی از یک تاریخ معین. مثلا, شما می توانید یک ماه از یک تاریخ معین بازیابی, یا یک ثانیه از یک زمان. + +این `part` پارامتر مشخص می کند که بخشی از تاریخ برای بازیابی. مقادیر زیر در دسترس هستند: + +- `DAY` — The day of the month. Possible values: 1–31. +- `MONTH` — The number of a month. Possible values: 1–12. +- `YEAR` — The year. +- `SECOND` — The second. Possible values: 0–59. +- `MINUTE` — The minute. Possible values: 0–59. +- `HOUR` — The hour. Possible values: 0–23. + +این `part` پارامتر غیر حساس به حروف است. + +این `date` پارامتر تاریخ یا زمان پردازش را مشخص می کند. هر دو [تاریخ](../sql-reference/data-types/date.md) یا [DateTime](../sql-reference/data-types/datetime.md) نوع پشتیبانی می شود. + +مثالها: + +``` sql +SELECT EXTRACT(DAY FROM toDate('2017-06-15')); +SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); +SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); +``` + +در مثال زیر ما ایجاد یک جدول و قرار دادن به آن یک مقدار با `DateTime` نوع. + +``` sql +CREATE TABLE test.Orders +( + OrderId UInt64, + OrderName String, + OrderDate DateTime +) +ENGINE = Log; +``` + +``` sql +INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); +``` + +``` sql +SELECT + toYear(OrderDate) AS OrderYear, + toMonth(OrderDate) AS OrderMonth, + toDayOfMonth(OrderDate) AS OrderDay, + toHour(OrderDate) AS OrderHour, + toMinute(OrderDate) AS OrderMinute, + toSecond(OrderDate) AS OrderSecond +FROM test.Orders; +``` + +``` text +┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ +│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ +└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ +``` + +شما می توانید نمونه های بیشتری را در [تستها](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). + +### INTERVAL {#operator-interval} + +ایجاد یک [فاصله](../sql-reference/data-types/special-data-types/interval.md)- ارزش نوع است که باید در عملیات ریاضی با استفاده [تاریخ](../sql-reference/data-types/date.md) و [DateTime](../sql-reference/data-types/datetime.md)- ارزش نوع . + +انواع فواصل: +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +!!! warning "اخطار" + فواصل با انواع مختلف نمی تواند ترکیب شود. شما می توانید عبارات مانند استفاده کنید `INTERVAL 4 DAY 1 HOUR`. بیان فواصل در واحد است که کوچکتر یا مساوی کوچکترین واحد فاصله برای مثال `INTERVAL 25 HOUR`. شما می توانید عملیات تبعی مانند مثال زیر استفاده کنید. + +مثال: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +**همچنین نگاه کنید** + +- [فاصله](../sql-reference/data-types/special-data-types/interval.md) نوع داده +- [توینتروال](../sql-reference/functions/type-conversion-functions.md#function-tointerval) توابع تبدیل نوع + +## اپراتور نفی منطقی {#logical-negation-operator} + +`NOT a` – The `not(a)` تابع. + +## منطقی و اپراتور {#logical-and-operator} + +`a AND b` – The`and(a, b)` تابع. + +## منطقی یا اپراتور {#logical-or-operator} + +`a OR b` – The `or(a, b)` تابع. + +## اپراتور شرطی {#conditional-operator} + +`a ? b : c` – The `if(a, b, c)` تابع. + +یادداشت: + +اپراتور مشروط محاسبه ارزش ب و ج, سپس چک چه شرایط ملاقات کرده است, و سپس مقدار مربوطه را برمی گرداند. اگر `b` یا `C` یک [ارریجین()](../sql-reference/functions/array-join.md#functions_arrayjoin) عملکرد هر سطر خواهد بود تکرار صرف نظر از “a” شرط. + +## عبارت شرطی {#operator_case} + +``` sql +CASE [x] + WHEN a THEN b + [WHEN ... THEN ...] + [ELSE c] +END +``` + +اگر `x` مشخص شده است, سپس `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. + +اگر وجود ندارد `ELSE c` بند در بیان, مقدار پیش فرض است `NULL`. + +این `transform` تابع با کار نمی کند `NULL`. + +## اپراتور الحاق {#concatenation-operator} + +`s1 || s2` – The `concat(s1, s2) function.` + +## لامبدا اپراتور ایجاد {#lambda-creation-operator} + +`x -> expr` – The `lambda(x, expr) function.` + +اپراتورهای زیر یک اولویت ندارد, از براکت هستند: + +## اپراتور ایجاد مجموعه {#array-creation-operator} + +`[x1, ...]` – The `array(x1, ...) function.` + +## اپراتور ایجاد تاپل {#tuple-creation-operator} + +`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` + +## Associativity {#associativity} + +همه اپراتورهای دودویی انجمن را ترک کرده اند. به عنوان مثال, `1 + 2 + 3` تبدیل به `plus(plus(1, 2), 3)`. +گاهی اوقات این راه شما انتظار می رود کار نمی کند. به عنوان مثال, `SELECT 4 > 2 > 3` در نتیجه 0. + +برای بهره وری `and` و `or` توابع قبول هر تعداد از استدلال. زنجیره های مربوطه از `AND` و `OR` اپراتورها به یک تماس از این توابع تبدیل شده است. + +## در حال بررسی برای `NULL` {#checking-for-null} + +تاتر از `IS NULL` و `IS NOT NULL` اپراتورها. + +### IS NULL {#operator-is-null} + +- برای [Nullable](../sql-reference/data-types/nullable.md) مقادیر نوع `IS NULL` بازگشت اپراتور: + - `1` اگر مقدار باشد `NULL`. + - `0` وگرنه +- برای ارزش های دیگر `IS NULL` اپراتور همیشه باز می گردد `0`. + + + +``` sql +SELECT x+100 FROM t_null WHERE y IS NULL +``` + +``` text +┌─plus(x, 100)─┐ +│ 101 │ +└──────────────┘ +``` + +### IS NOT NULL {#is-not-null} + +- برای [Nullable](../sql-reference/data-types/nullable.md) مقادیر نوع `IS NOT NULL` بازگشت اپراتور: + - `0` اگر مقدار باشد `NULL`. + - `1` وگرنه +- برای ارزش های دیگر `IS NOT NULL` اپراتور همیشه باز می گردد `1`. + + + +``` sql +SELECT * FROM t_null WHERE y IS NOT NULL +``` + +``` text +┌─x─┬─y─┐ +│ 2 │ 3 │ +└───┴───┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/fa/sql-reference/statements/alter.md b/docs/fa/sql-reference/statements/alter.md new file mode 100644 index 00000000000..985fce8690f --- /dev/null +++ b/docs/fa/sql-reference/statements/alter.md @@ -0,0 +1,505 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: ALTER +--- + +## ALTER {#query_language_queries_alter} + +این `ALTER` پرسوجو فقط برای پشتیبانی `*MergeTree` جداول و همچنین `Merge`و`Distributed`. پرس و جو دارای چندین تغییرات. + +### دستکاری ستون {#column-manipulations} + +تغییر ساختار جدول. + +``` sql +ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... +``` + +در پرس و جو, مشخص یک لیست از یک یا چند اقدامات کاما از هم جدا. +هر عمل یک عملیات بر روی یک ستون است. + +اقدامات زیر پشتیبانی می شوند: + +- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. +- [DROP COLUMN](#alter_drop-column) — Deletes the column. +- [CLEAR COLUMN](#alter_clear-column) — Resets column values. +- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. +- [MODIFY COLUMN](#alter_modify-column) — Changes column’s type, default expression and TTL. + +این اقدامات در زیر توضیح داده شده است. + +#### ADD COLUMN {#alter_add-column} + +``` sql +ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] +``` + +یک ستون جدید به جدول با مشخص اضافه می کند `name`, `type`, [`codec`](create.md#codecs) و `default_expr` (نگاه کنید به بخش [عبارتهای پیشفرض](create.md#create-default-values)). + +اگر `IF NOT EXISTS` بند گنجانده شده است, پرس و جو یک خطا بازگشت نیست اگر ستون در حال حاضر وجود دارد. اگر شما مشخص کنید `AFTER name_after` (نام ستون دیگر), ستون پس از یک مشخص شده در لیست ستون جدول اضافه. در غیر این صورت, ستون به پایان جدول اضافه. توجه داشته باشید که هیچ راهی برای اضافه کردن یک ستون به ابتدای جدول وجود دارد. برای زنجیره ای از اقدامات, `name_after` می تواند نام یک ستون است که در یکی از اقدامات قبلی اضافه شده است. + +اضافه کردن یک ستون فقط تغییر ساختار جدول, بدون انجام هر گونه اقدامات با داده. داده ها بر روی دیسک پس از ظاهر نمی شود `ALTER`. اگر داده ها برای یک ستون از دست رفته در هنگام خواندن از جدول, این است که در با مقادیر پیش فرض پر (با انجام عبارت پیش فرض اگر یکی وجود دارد, و یا با استفاده از صفر یا رشته های خالی). ستون بر روی دیسک به نظر می رسد پس از ادغام قطعات داده (دیدن [ادغام](../../engines/table-engines/mergetree-family/mergetree.md)). + +این رویکرد به ما اجازه می دهد برای تکمیل `ALTER` پرس و جو فورا, بدون افزایش حجم داده های قدیمی. + +مثال: + +``` sql +ALTER TABLE visits ADD COLUMN browser String AFTER user_id +``` + +#### DROP COLUMN {#alter_drop-column} + +``` sql +DROP COLUMN [IF EXISTS] name +``` + +ستون را با نام حذف می کند `name`. اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. + +حذف داده ها از سیستم فایل. از این حذف تمام فایل های پرس و جو تقریبا بلافاصله تکمیل شده است. + +مثال: + +``` sql +ALTER TABLE visits DROP COLUMN browser +``` + +#### CLEAR COLUMN {#alter_clear-column} + +``` sql +CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name +``` + +بازنشانی تمام داده ها در یک ستون برای یک پارتیشن مشخص. اطلاعات بیشتر در مورد تنظیم نام پارتیشن در بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). + +اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. + +مثال: + +``` sql +ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() +``` + +#### COMMENT COLUMN {#alter_comment-column} + +``` sql +COMMENT COLUMN [IF EXISTS] name 'comment' +``` + +می افزاید: نظر به ستون. اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. + +هر ستون می تواند یک نظر داشته باشد. اگر یک نظر در حال حاضر برای ستون وجود دارد, یک نظر جدید رونویسی نظر قبلی. + +نظرات در ذخیره می شود `comment_expression` ستون توسط [DESCRIBE TABLE](misc.md#misc-describe-table) پرس و جو. + +مثال: + +``` sql +ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' +``` + +#### MODIFY COLUMN {#alter_modify-column} + +``` sql +MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] +``` + +این پرسوجو تغییر میکند `name` ویژگیهای ستون: + +- نوع + +- عبارت پیشفرض + +- TTL + + For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). + +اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. + +هنگام تغییر نوع, ارزش ها به عنوان اگر تبدیل [نوع](../../sql-reference/functions/type-conversion-functions.md) توابع به کار گرفته شد. اگر تنها عبارت پیش فرض تغییر می کند, پرس و جو می کند هر چیزی پیچیده نیست, و تقریبا بلافاصله تکمیل. + +مثال: + +``` sql +ALTER TABLE visits MODIFY COLUMN browser Array(String) +``` + +Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. + +چندین مرحله پردازش وجود دارد: + +- تهیه فایل های موقت (جدید) با داده های اصلاح شده. +- تغییر نام فایل های قدیمی. +- تغییر نام فایل های موقت (جدید) به نام های قدیمی. +- حذف فایل های قدیمی. + +فقط مرحله اول زمان طول می کشد. در صورتی که یک شکست در این مرحله وجود دارد, داده ها تغییر نکرده است. +در صورتی که یک شکست در یکی از مراحل پی در پی وجود دارد, داده ها را می توان به صورت دستی ترمیم. استثنا است اگر فایل های قدیمی از سیستم فایل حذف شد اما داده ها را برای فایل های جدید را به دیسک نوشته شده است و از دست داده بود. + +این `ALTER` پرس و جو برای تغییر ستون تکرار شده است. دستورالعمل ها در باغ وحش ذخیره می شوند و سپس هر ماکت اعمال می شود. همه `ALTER` نمایش داده شد در همان جهت اجرا شود. پرس و جو منتظر اقدامات مناسب برای در کپی دیگر تکمیل شود. با این حال, پرس و جو برای تغییر ستون در یک جدول تکرار می تواند قطع, و تمام اقدامات غیر همزمان انجام خواهد شد. + +#### تغییر محدودیت پرس و جو {#alter-query-limitations} + +این `ALTER` پرس و جو به شما امکان ایجاد و حذف عناصر جداگانه (ستون) در ساختارهای داده های تو در تو, اما نه کل ساختارهای داده تو در تو. برای اضافه کردن یک ساختار داده های تو در تو, شما می توانید ستون با یک نام مانند اضافه `name.nested_name` و نوع `Array(T)`. ساختار داده های تو در تو معادل ستون های چندگانه با یک نام است که پیشوند مشابه قبل از نقطه است. + +هیچ پشتیبانی برای حذف ستون ها در کلید اصلی یا کلید نمونه برداری (ستون هایی که در استفاده می شود) وجود ندارد. `ENGINE` عبارت). تغییر نوع ستون که در کلید اصلی گنجانده شده است تنها ممکن است اگر این تغییر باعث نمی شود داده ها به اصلاح شود (مثلا, شما مجاز به اضافه کردن مقادیر به شمارشی و یا برای تغییر یک نوع از `DateTime` به `UInt32`). + +اگر `ALTER` پرس و جو برای ایجاد تغییرات جدول مورد نیاز کافی نیست شما می توانید یک جدول جدید ایجاد کنید و داده ها را با استفاده از داده ها کپی کنید [INSERT SELECT](insert-into.md#insert_query_insert-select) پرس و جو, سپس جداول با استفاده از تغییر [RENAME](misc.md#misc_operations-rename) پرس و جو و حذف جدول قدیمی. شما می توانید از [تاتر-کپی](../../operations/utilities/clickhouse-copier.md) به عنوان یک جایگزین برای `INSERT SELECT` پرس و جو. + +این `ALTER` بلوک پرس و جو همه می خواند و می نویسد برای جدول. به عبارت دیگر, اگر طولانی `SELECT` در حال اجرا است در زمان `ALTER` پرس و جو `ALTER` پرس و جو منتظر خواهد ماند تا کامل شود. همزمان, تمام نمایش داده شد جدید به همان جدول صبر کنید در حالی که این `ALTER` در حال اجرا است. + +برای جداول که داده های خود را ذخیره کنید (مانند `Merge` و `Distributed`), `ALTER` فقط ساختار جدول را تغییر می دهد و ساختار جداول تابع را تغییر نمی دهد. مثلا, زمانی که در حال اجرا را تغییر دهید برای یک `Distributed` جدول, شما همچنین نیاز به اجرا `ALTER` برای جداول در تمام سرور از راه دور. + +### دستکاری با عبارات کلیدی {#manipulations-with-key-expressions} + +دستور زیر پشتیبانی می شود: + +``` sql +MODIFY ORDER BY new_expression +``` + +این فقط برای جداول در کار می کند [`MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) خانواده (از جمله +[تکرار](../../engines/table-engines/mergetree-family/replication.md) جدول). فرمان تغییر +[کلید مرتب سازی](../../engines/table-engines/mergetree-family/mergetree.md) از جدول +به `new_expression` (بیان و یا یک تاپل از عبارات). کلید اصلی یکسان باقی می ماند. + +فرمان سبک وزن به این معنا است که تنها ابرداده را تغییر می دهد. برای حفظ اموال که بخش داده ها +ردیف ها توسط عبارت کلیدی مرتب سازی شما می توانید عبارات حاوی ستون های موجود اضافه کنید دستور داد +به کلید مرتب سازی (فقط ستون اضافه شده توسط `ADD COLUMN` فرمان در همان `ALTER` پرسوجو). + +### دستکاری با شاخص های پرش داده {#manipulations-with-data-skipping-indices} + +این فقط برای جداول در کار می کند [`*MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) خانواده (از جمله +[تکرار](../../engines/table-engines/mergetree-family/replication.md) جدول). عملیات زیر +در دسترس هستند: + +- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - می افزاید توضیحات شاخص به ابرداده جداول . + +- `ALTER TABLE [db].name DROP INDEX name` - حذف شرح شاخص از ابرداده جداول و حذف فایل های شاخص از دیسک. + +این دستورات سبک وزن هستند به این معنا که فقط فراداده را تغییر می دهند یا فایل ها را حذف می کنند. +همچنین تکرار میشوند (همگامسازی فرادادههای شاخص از طریق باغ وحش). + +### دستکاری با محدودیت {#manipulations-with-constraints} + +مشاهده بیشتر در [قیدها](create.md#constraints) + +محدودیت ها می توانند با استفاده از نحو زیر اضافه یا حذف شوند: + +``` sql +ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; +ALTER TABLE [db].name DROP CONSTRAINT constraint_name; +``` + +نمایش داده شد اضافه خواهد شد و یا حذف ابرداده در مورد محدودیت از جدول به طوری که بلافاصله پردازش شده است. + +بررسی قید *اعدام نخواهد شد* در داده های موجود اگر اضافه شد. + +همه تغییرات در جداول تکرار در حال پخش به باغ وحش بنابراین خواهد شد در دیگر کپی اعمال می شود. + +### دستکاری با پارتیشن ها و قطعات {#alter_manipulations-with-partitions} + +عملیات زیر را با [پارتیشن ها](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) در دسترس هستند: + +- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` دایرکتوری و فراموش کرده ام. +- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. +- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` دایرکتوری به جدول. +- [REPLACE PARTITION](#alter_replace-partition) - پارتیشن داده ها را از یک جدول به دیگری کپی می کند. +- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. +- [REPLACE PARTITION](#alter_replace-partition) - پارتیشن داده ها را از یک جدول به دیگری کپی می کند و جایگزین می شود. +- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#تغییر\_موف\_ قابل تنظیم-پارتیشن) - پارتیشن داده را از یک جدول به دیگری حرکت دهید. +- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - بازنشانی ارزش یک ستون مشخص شده در یک پارتیشن. +- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - بازنشانی شاخص ثانویه مشخص شده در یک پارتیشن. +- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. +- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. +- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. + + + +#### جدا پارتیشن {\#alter\_detach-پارتیشن} {#detach-partition-alter-detach-partition} + +``` sql +ALTER TABLE table_name DETACH PARTITION partition_expr +``` + +تمام داده ها را برای پارتیشن مشخص شده به `detached` فهرست راهنما. سرور فراموش در مورد پارتیشن داده جدا به عنوان اگر وجود ندارد. سرور نمی خواهد در مورد این داده ها می دانم تا زمانی که شما را به [ATTACH](#alter_attach-partition) پرس و جو. + +مثال: + +``` sql +ALTER TABLE visits DETACH PARTITION 201901 +``` + +اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). + +پس از پرس و جو اجرا شده است, شما می توانید هر کاری که می خواهید با داده ها در انجام `detached` directory — delete it from the file system, or just leave it. + +This query is replicated – it moves the data to the `detached` دایرکتوری در تمام کپی. توجه داشته باشید که شما می توانید این پرس و جو تنها در یک ماکت رهبر را اجرا کند. برای پیدا کردن اگر یک ماکت یک رهبر است, انجام `SELECT` پرسوجو به [سیستم.تکرار](../../operations/system-tables.md#system_tables-replicas) جدول متناوبا, راحت تر به یک است `DETACH` پرس و جو در تمام کپی - همه کپی پرتاب یک استثنا, به جز ماکت رهبر. + +#### DROP PARTITION {#alter_drop-partition} + +``` sql +ALTER TABLE table_name DROP PARTITION partition_expr +``` + +پارتیشن مشخص شده را از جدول حذف می کند. این برچسب ها پرس و جو پارتیشن به عنوان غیر فعال و حذف داده ها به طور کامل, حدود در 10 دقیقه. + +اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). + +The query is replicated – it deletes data on all replicas. + +#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} + +``` sql +ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr +``` + +بخش مشخص شده یا تمام قسمت های پارتیشن مشخص شده را از بین می برد `detached`. +اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). + +#### ATTACH PARTITION\|PART {#alter_attach-partition} + +``` sql +ALTER TABLE table_name ATTACH PARTITION|PART partition_expr +``` + +می افزاید داده ها به جدول از `detached` فهرست راهنما. ممکن است که به اضافه کردن داده ها برای کل پارتیشن و یا برای یک بخش جداگانه. مثالها: + +``` sql +ALTER TABLE visits ATTACH PARTITION 201901; +ALTER TABLE visits ATTACH PART 201901_2_2_0; +``` + +اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). + +این پرس و جو تکرار شده است. چک المثنی-ابتکار چه داده ها در وجود دارد `detached` فهرست راهنما. اگر داده وجود دارد, پرس و جو چک یکپارچگی خود را. اگر همه چیز درست است, پرس و جو می افزاید: داده ها به جدول. همه کپی دیگر دانلود داده ها از ماکت-مبتکر. + +بنابراین شما می توانید داده ها را به `detached` دایرکتوری در یک ماکت, و استفاده از `ALTER ... ATTACH` پرس و جو برای اضافه کردن به جدول در تمام کپی. + +#### ATTACH PARTITION FROM {#alter_attach-partition-from} + +``` sql +ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 +``` + +این پرس و جو پارتیشن داده را از `table1` به `table2` می افزاید داده ها به لیست موجود در `table2`. توجه داشته باشید که داده ها از حذف نمی شود `table1`. + +برای پرس و جو به اجرا با موفقیت, شرایط زیر باید رعایت شود: + +- هر دو جدول باید همان ساختار دارند. +- هر دو جدول باید کلید پارتیشن همان. + +#### REPLACE PARTITION {#alter_replace-partition} + +``` sql +ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 +``` + +این پرس و جو پارتیشن داده را از `table1` به `table2` و جایگزین پارتیشن موجود در `table2`. توجه داشته باشید که داده ها از حذف نمی شود `table1`. + +برای پرس و جو به اجرا با موفقیت, شرایط زیر باید رعایت شود: + +- هر دو جدول باید همان ساختار دارند. +- هر دو جدول باید کلید پارتیشن همان. + +#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} + +``` sql +ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest +``` + +این پرس و جو انتقال پارتیشن داده ها از `table_source` به `table_dest` با حذف داده ها از `table_source`. + +برای پرس و جو به اجرا با موفقیت, شرایط زیر باید رعایت شود: + +- هر دو جدول باید همان ساختار دارند. +- هر دو جدول باید کلید پارتیشن همان. +- هر دو جدول باید همان خانواده موتور باشد. (تکرار و یا غیر تکرار) +- هر دو جدول باید سیاست ذخیره سازی همان. + +#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} + +``` sql +ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr +``` + +بازنشانی تمام مقادیر در ستون مشخص شده در یک پارتیشن. اگر `DEFAULT` بند هنگام ایجاد یک جدول تعیین شد, این پرس و جو مجموعه مقدار ستون به یک مقدار پیش فرض مشخص. + +مثال: + +``` sql +ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 +``` + +#### FREEZE PARTITION {#alter_freeze-partition} + +``` sql +ALTER TABLE table_name FREEZE [PARTITION partition_expr] +``` + +این پرس و جو یک نسخه پشتیبان تهیه محلی از یک پارتیشن مشخص شده ایجاد می کند. اگر `PARTITION` بند حذف شده است, پرس و جو ایجاد پشتیبان گیری از تمام پارتیشن در یک بار. + +!!! note "یادداشت" + تمامی مراحل پشتیبان گیری بدون توقف سرور انجام می شود. + +توجه داشته باشید که برای جداول قدیمی مدل دهید شما می توانید پیشوند نام پارتیشن را مشخص کنید (به عنوان مثال, ‘2019’)- سپس پرس و جو پشتیبان گیری برای تمام پارتیشن مربوطه ایجاد می کند. اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). + +در زمان اجرای, برای یک تصویر لحظهای داده, پرس و جو ایجاد لینک به داده های جدول. پیوندهای سخت در دایرکتوری قرار می گیرند `/var/lib/clickhouse/shadow/N/...` کجا: + +- `/var/lib/clickhouse/` است دایرکتوری محل کلیک کار مشخص شده در پیکربندی. +- `N` تعداد افزایشی از نسخه پشتیبان تهیه شده است. + +!!! note "یادداشت" + در صورت استفاده [مجموعه ای از دیسک برای ذخیره سازی داده ها در یک جدول](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) این `shadow/N` دایرکتوری به نظر می رسد در هر دیسک, ذخیره سازی قطعات داده که توسط همسان `PARTITION` اصطلاح. + +همان ساختار دایرکتوری ها در داخل پشتیبان به عنوان داخل ایجاد شده است `/var/lib/clickhouse/`. پرس و جو انجام می شود ‘chmod’ برای همه پروندهها نوشتن رو ممنوع کردم + +پس از ایجاد نسخه پشتیبان تهیه, شما می توانید داده ها را از کپی `/var/lib/clickhouse/shadow/` به سرور از راه دور و سپس از سرور محلی حذف کنید. توجه داشته باشید که `ALTER t FREEZE PARTITION` پرس و جو تکرار نشده است. این یک نسخه پشتیبان تهیه محلی تنها بر روی سرور محلی ایجاد می کند. + +پرس و جو ایجاد نسخه پشتیبان تهیه تقریبا بلافاصله (اما برای اولین بار برای نمایش داده شد در حال حاضر به جدول مربوطه منتظر را به پایان برساند در حال اجرا). + +`ALTER TABLE t FREEZE PARTITION` نسخه تنها داده, ابرداده جدول نیست. برای تهیه نسخه پشتیبان از فراداده های جدول فایل را کپی کنید `/var/lib/clickhouse/metadata/database/table.sql` + +برای بازیابی اطلاعات از یک نسخه پشتیبان تهیه زیر را انجام دهید: + +1. ایجاد جدول اگر وجود ندارد. برای مشاهده پرس و جو, استفاده از .پرونده جدید `ATTACH` در این با `CREATE`). +2. رونوشت داده از `data/database/table/` دایرکتوری در داخل پشتیبان گیری به `/var/lib/clickhouse/data/database/table/detached/` فهرست راهنما. +3. بدو `ALTER TABLE t ATTACH PARTITION` نمایش داده شد برای اضافه کردن داده ها به یک جدول. + +بازگرداندن از یک نسخه پشتیبان تهیه می کند نیاز به متوقف کردن سرور نیست. + +برای کسب اطلاعات بیشتر در مورد پشتیبان گیری و بازیابی اطلاعات, دیدن [پشتیبان گیری داده ها](../../operations/backup.md) بخش. + +#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} + +``` sql +ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr +``` + +پرس و جو کار می کند شبیه به `CLEAR COLUMN`, اما بازنشانی شاخص به جای یک داده ستون. + +#### FETCH PARTITION {#alter_fetch-partition} + +``` sql +ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' +``` + +دانلود یک پارتیشن از سرور دیگر. این پرس و جو تنها برای جداول تکرار کار می کند. + +پرس و جو می کند به شرح زیر است: + +1. پارتیشن را از سفال مشخص شده دانلود کنید. داخل ‘path-in-zookeeper’ شما باید یک مسیر به سفال در باغ وحش را مشخص کنید. +2. سپس پرس و جو داده های دانلود شده را به `detached` دایرکتوری از `table_name` جدول استفاده از [ATTACH PARTITION\|PART](#alter_attach-partition) پرسوجو برای افزودن داده به جدول. + +به عنوان مثال: + +``` sql +ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; +ALTER TABLE users ATTACH PARTITION 201902; +``` + +توجه داشته باشید که: + +- این `ALTER ... FETCH PARTITION` پرس و جو تکرار نشده است. این پارتیشن را به `detached` دایرکتوری تنها بر روی سرور محلی. +- این `ALTER TABLE ... ATTACH` پرس و جو تکرار شده است. این می افزاید: داده ها به تمام کپی. داده ها به یکی از کپی ها از `detached` فهرست راهنما, و به دیگران - از کپی همسایه. + +قبل از دانلود, سیستم چک اگر پارتیشن وجود دارد و ساختار جدول مسابقات. ماکت مناسب ترین به طور خودکار از کپی سالم انتخاب شده است. + +اگر چه پرس و جو نامیده می شود `ALTER TABLE`, این ساختار جدول را تغییر دهید و بلافاصله داده های موجود در جدول را تغییر دهید. + +#### MOVE PARTITION\|PART {#alter_move-partition} + +پارتیشن ها یا قطعات داده را به حجم یا دیسک دیگری منتقل می کند `MergeTree`- جدول موتور . ببینید [با استفاده از دستگاه های بلوک های متعدد برای ذخیره سازی داده ها](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes). + +``` sql +ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' +``` + +این `ALTER TABLE t MOVE` پرسوجو: + +- تکرار نشده, به دلیل کپی های مختلف می توانید سیاست های ذخیره سازی مختلف دارند. +- بازگرداندن خطا در صورتی که دیسک یا حجم مشخص پیکربندی نشده است. پرس و جو نیز یک خطا را برمی گرداند اگر شرایط در حال حرکت داده, که مشخص شده در سیاست ذخیره سازی, نمی توان اعمال کرد. +- می توانید یک خطا در مورد بازگشت, زمانی که داده ها به نقل مکان کرد در حال حاضر توسط یک فرایند پس زمینه نقل مکان کرد, همزمان `ALTER TABLE t MOVE` پرس و جو و یا به عنوان یک نتیجه از ادغام داده های پس زمینه. کاربر باید هر گونه اقدامات اضافی در این مورد انجام نمی. + +مثال: + +``` sql +ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' +ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' +``` + +#### نحوه تنظیم بیان پارتیشن {#alter-how-to-specify-part-expr} + +شما می توانید بیان پارتیشن را مشخص کنید `ALTER ... PARTITION` نمایش داده شد به روش های مختلف: + +- به عنوان یک مقدار از `partition` ستون از `system.parts` جدول به عنوان مثال, `ALTER TABLE visits DETACH PARTITION 201901`. +- به عنوان بیان از ستون جدول. ثابت ها و عبارات ثابت پشتیبانی می شوند. به عنوان مثال, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. +- با استفاده از شناسه پارتیشن. شناسه پارتیشن شناسه رشته پارتیشن (انسان قابل خواندن در صورت امکان) است که به عنوان نام پارتیشن در فایل سیستم و در باغ وحش استفاده می شود. شناسه پارتیشن باید در `PARTITION ID` بند, در یک نقل قول واحد. به عنوان مثال, `ALTER TABLE visits DETACH PARTITION ID '201901'`. +- در [ALTER ATTACH PART](#alter_attach-partition) و [DROP DETACHED PART](#alter_drop-detached) پرس و جو, برای مشخص کردن نام یک بخش, استفاده از رشته تحت اللفظی با ارزش از `name` ستون از [سیستم.قطعات مجزا](../../operations/system-tables.md#system_tables-detached_parts) جدول به عنوان مثال, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. + +استفاده از نقل قول در هنگام مشخص کردن پارتیشن بستگی به نوع بیان پارتیشن. برای مثال برای `String` نوع, شما باید برای مشخص کردن نام خود را در نقل قول (`'`). برای `Date` و `Int*` انواع بدون نقل قول مورد نیاز است. + +برای جداول قدیمی به سبک, شما می توانید پارتیشن یا به عنوان یک عدد مشخص `201901` یا یک رشته `'201901'`. نحو برای جداول سبک جدید سختگیرانه تر با انواع است (شبیه به تجزیه کننده برای فرمت ورودی ارزش). + +تمام قوانین فوق نیز برای درست است [OPTIMIZE](misc.md#misc_operations-optimize) پرس و جو. اگر شما نیاز به مشخص کردن تنها پارتیشن در هنگام بهینه سازی یک جدول غیر تقسیم, تنظیم بیان `PARTITION tuple()`. به عنوان مثال: + +``` sql +OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; +``` + +نمونه هایی از `ALTER ... PARTITION` نمایش داده شد در تست نشان داده شده است [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) و [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). + +### دستکاری با جدول جدول {#manipulations-with-table-ttl} + +شما می توانید تغییر دهید [جدول](../../engines/table-engines/mergetree-family/mergetree.md#mergetree-table-ttl) با درخواست فرم زیر: + +``` sql +ALTER TABLE table-name MODIFY TTL ttl-expression +``` + +### همزمانی تغییر نمایش داده شد {#synchronicity-of-alter-queries} + +برای جداول غیر قابل تکرار, همه `ALTER` نمایش داده شد همزمان انجام می شود. برای جداول تکرار, پرس و جو فقط می افزاید دستورالعمل برای اقدامات مناسب به `ZooKeeper` و اقدامات خود را در اسرع وقت انجام می شود. با این حال, پرس و جو می توانید صبر کنید برای این اقدامات در تمام کپی تکمیل شود. + +برای `ALTER ... ATTACH|DETACH|DROP` نمایش داده شد, شما می توانید با استفاده از `replication_alter_partitions_sync` راه اندازی به راه اندازی انتظار. +مقادیر ممکن: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. + +### جهشها {#alter-mutations} + +جهش یک نوع پرس و جو را تغییر دهید که اجازه می دهد تا تغییر یا حذف ردیف در یک جدول. در مقایسه با استاندارد `UPDATE` و `DELETE` نمایش داده شد که برای تغییرات داده نقطه در نظر گرفته شده, جهش برای عملیات سنگین است که تغییر بسیاری از ردیف در یک جدول در نظر گرفته شده. پشتیبانی برای `MergeTree` خانواده از موتورهای جدول از جمله موتورهای با پشتیبانی تکرار. + +جداول موجود برای جهش به عنوان (بدون تبدیل لازم), اما پس از جهش برای اولین بار است که به یک جدول اعمال, فرمت ابرداده خود را با نسخه های سرور قبلی ناسازگار می شود و سقوط به نسخه های قبلی غیر ممکن می شود. + +دستورات در حال حاضر در دسترس: + +``` sql +ALTER TABLE [db.]table DELETE WHERE filter_expr +``` + +این `filter_expr` باید از نوع باشد `UInt8`. پرس و جو حذف ردیف در جدول که این عبارت طول می کشد یک مقدار غیر صفر. + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr +``` + +این `filter_expr` باید از نوع باشد `UInt8`. این پرس و جو به روز رسانی مقادیر ستون مشخص شده به ارزش عبارات مربوطه در ردیف که `filter_expr` طول می کشد یک مقدار غیر صفر. ارزش ها به نوع ستون با استفاده از قالبی `CAST` اپراتور. به روز رسانی ستون هایی که در محاسبه اولیه استفاده می شود و یا کلید پارتیشن پشتیبانی نمی شود. + +``` sql +ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name +``` + +پرس و جو بازسازی شاخص ثانویه `name` در پارتیشن `partition_name`. + +یک پرس و جو می تواند شامل چندین دستورات جدا شده توسط کاما. + +برای \* جداول ادغام جهش اجرا با بازنویسی تمام قطعات داده. هیچ اتمیتی وجود ندارد - قطعات برای قطعات جهش یافته جایگزین می شوند به محض اینکه اماده باشند و `SELECT` پرس و جو است که شروع به اجرای در طول جهش داده ها از قطعات است که در حال حاضر همراه با داده ها از قطعات است که هنوز جهش یافته شده اند جهش را ببینید. + +جهش ها به طور کامل توسط نظم خلقت خود دستور داده می شوند و به هر بخش به این ترتیب اعمال می شوند. جهش نیز تا حدی با درج دستور داد - داده هایی که به جدول وارد شد قبل از جهش ارسال خواهد شد جهش یافته و داده هایی که پس از که قرار داده شد جهش یافته نمی شود. توجه داشته باشید که جهش درج به هیچ وجه مسدود نیست. + +یک جهش پرس و جو می گرداند بلافاصله پس از جهش مطلب اضافه شده است (در صورت تکرار جداول به باغ وحش برای nonreplicated جداول - به فایل سیستم). جهش خود را اجرا ناهمگام با استفاده از تنظیمات مشخصات سیستم. برای پیگیری پیشرفت جهش شما می توانید با استفاده از [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) جدول یک جهش است که با موفقیت ارسال شد ادامه خواهد داد برای اجرای حتی اگر سرور کلیک دوباره راه اندازی. هیچ راهی برای عقب انداختن جهش هنگامی که ارسال شده است وجود دارد, اما اگر جهش برای برخی از دلیل گیر می تواند با لغو [`KILL MUTATION`](misc.md#kill-mutation) پرس و جو. + +مطالب برای جهش به پایان رسید حذف نمی حق دور (تعداد نوشته های حفظ شده توسط تعیین `finished_mutations_to_keep` پارامتر موتور ذخیره سازی). نوشته جهش قدیمی تر حذف می شوند. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/fa/sql-reference/statements/create.md b/docs/fa/sql-reference/statements/create.md new file mode 100644 index 00000000000..4d086d34a77 --- /dev/null +++ b/docs/fa/sql-reference/statements/create.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: CREATE +--- + +# ایجاد پرس و جو {#create-queries} + +## CREATE DATABASE {#query-language-create-database} + +ایجاد پایگاه داده. + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] +``` + +### بند {#clauses} + +- `IF NOT EXISTS` + + If the `db_name` database already exists, then ClickHouse doesn't create a new database and: + + - Doesn't throw an exception if clause is specified. + - Throws an exception if clause isn't specified. + +- `ON CLUSTER` + + ClickHouse creates the `db_name` database on all the servers of a specified cluster. + +- `ENGINE` + + - [MySQL](../engines/database_engines/mysql.md) + + Allows you to retrieve data from the remote MySQL server. + + By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). + +## CREATE TABLE {#create-table-query} + +این `CREATE TABLE` پرس و جو می تواند اشکال مختلف داشته باشد. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], + ... +) ENGINE = engine +``` + +ایجاد یک جدول به نام ‘name’ در ‘db’ پایگاه داده یا پایگاه داده فعلی اگر ‘db’ تنظیم نشده است, با ساختار مشخص شده در براکت و ‘engine’ موتور. +ساختار جدول یک لیست از توصیف ستون است. اگر شاخص ها توسط موتور پشتیبانی می شوند به عنوان پارامتر برای موتور جدول نشان داده می شوند. + +شرح ستون است `name type` در ساده ترین حالت. مثال: `RegionID UInt32`. +عبارات همچنین می توانید برای مقادیر پیش فرض تعریف شود (پایین را ببینید). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] +``` + +ایجاد یک جدول با همان ساختار به عنوان جدول دیگر. شما می توانید یک موتور مختلف برای جدول مشخص کنید. اگر موتور مشخص نشده است, همان موتور خواهد شد که برای استفاده `db2.name2` جدول + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() +``` + +ایجاد یک جدول با ساختار و داده های بازگردانده شده توسط یک [تابع جدول](../table-functions/index.md). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... +``` + +ایجاد یک جدول با یک ساختار مانند نتیجه `SELECT` پرس و جو, با ‘engine’ موتور, و پر با داده ها از را انتخاب کنید. + +در همه موارد اگر `IF NOT EXISTS` مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر جدول در حال حاضر وجود دارد. در این مورد پرس و جو هیچ کاری انجام نخواهد داد. + +می تواند بند دیگر پس از وجود دارد `ENGINE` بند در پرس و جو. دیدن مستندات دقیق در مورد چگونگی ایجاد جدول در شرح [موتورهای جدول](../../engines/table-engines/index.md#table_engines). + +### مقادیر پیشفرض {#create-default-values} + +شرح ستون می تواند یک عبارت برای یک مقدار پیش فرض مشخص, در یکی از روش های زیر:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. +مثال: `URLDomain String DEFAULT domain(URL)`. + +اگر یک عبارت برای مقدار پیش فرض تعریف نشده است, مقادیر پیش فرض خواهد شد به صفر برای اعداد تنظیم, رشته های خالی برای رشته, طعمه خالی برای ارریس, و `0000-00-00` برای تاریخ و یا `0000-00-00 00:00:00` برای تاریخ با زمان. نقاط صفر پشتیبانی نمی شوند. + +اگر عبارت پیش فرض تعریف شده است, نوع ستون اختیاری است. در صورتی که یک نوع به صراحت تعریف شده وجود ندارد, نوع بیان پیش فرض استفاده شده است. مثال: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ نوع خواهد شد برای استفاده ‘EventDate’ ستون. + +اگر نوع داده ها و پیش فرض بیان تعریف شده به صراحت این را بیان خواهد شد بازیگران به نوع مشخص شده با استفاده از نوع مصاحبه توابع. مثال: `Hits UInt32 DEFAULT 0` معنی همان چیزی که به عنوان `Hits UInt32 DEFAULT toUInt32(0)`. + +Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don’t contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. + +`DEFAULT expr` + +مقدار پیش فرض عادی. اگر پرس و جو درج می کند ستون مربوطه مشخص نیست, خواهد شد در محاسبات بیان مربوطه پر. + +`MATERIALIZED expr` + +بیان محقق. چنین ستون ای نمی تواند برای درج مشخص شود زیرا همیشه محاسبه می شود. +برای درج بدون یک لیست از ستون, این ستون ها در نظر گرفته نمی. +علاوه بر این, این ستون جایگزین نشده است که با استفاده از یک ستاره در یک پرس و جو را انتخاب کنید. این است که برای حفظ همواره که تخلیه با استفاده از `SELECT *` را می توان به جدول با استفاده از درج بدون مشخص کردن لیست ستون قرار داده شده. + +`ALIAS expr` + +دو واژه مترادف. چنین ستون در جدول ذخیره نمی شود و در همه. +ارزش های خود را نمی توان در یک جدول قرار داد و هنگام استفاده از ستاره در یک پرس و جو انتخاب جایگزین نمی شود. +این را می توان در انتخاب استفاده می شود اگر نام مستعار است که در طول تجزیه پرس و جو گسترش یافته است. + +هنگام استفاده از پرس و جو را تغییر دهید برای اضافه کردن ستون جدید, داده های قدیمی برای این ستون نوشته نشده است. بجای, در هنگام خواندن داده های قدیمی که ارزش برای ستون جدید ندارد, عبارات در پرواز به طور پیش فرض محاسبه. با این حال, اگر در حال اجرا عبارات نیاز به ستون های مختلف است که در پرس و جو نشان داده نمی, این ستون علاوه بر خوانده خواهد شد, اما فقط برای بلوک های داده که نیاز. + +اگر شما یک ستون جدید اضافه کردن به یک جدول اما بعد تغییر بیان پیش فرض خود, ارزش های مورد استفاده برای داده های قدیمی تغییر خواهد کرد (برای داده هایی که ارزش بر روی دیسک ذخیره نمی شد). توجه داشته باشید که هنگام اجرای ادغام پس زمینه, داده ها را برای ستون که در یکی از قطعات ادغام از دست رفته است به بخش ادغام شده نوشته شده. + +این ممکن است به مجموعه مقادیر پیش فرض برای عناصر در ساختارهای داده تو در تو. + +### قیدها {#constraints} + +همراه با ستون توصیف محدودیت می تواند تعریف شود: + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + ... + CONSTRAINT constraint_name_1 CHECK boolean_expr_1, + ... +) ENGINE = engine +``` + +`boolean_expr_1` می تواند با هر عبارت بولی. اگر قیود برای جدول تعریف شود هر کدام برای هر سطر بررسی خواهند شد `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. + +اضافه کردن مقدار زیادی از محدودیت های منفی می تواند عملکرد بزرگ را تحت تاثیر قرار `INSERT` نمایش داده شد. + +### عبارت دیگر {#ttl-expression} + +تعریف می کند زمان ذخیره سازی برای ارزش. می توان تنها برای ادغام مشخص-جداول خانواده. برای توضیحات دقیق, دیدن [ستون ها و جداول](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). + +### کدکهای فشردهسازی ستون {#codecs} + +به طور پیش فرض, تاتر اعمال `lz4` روش فشرده سازی. برای `MergeTree`- خانواده موتور شما می توانید روش فشرده سازی به طور پیش فرض در تغییر [فشردهسازی](../../operations/server-configuration-parameters/settings.md#server-settings-compression) بخش پیکربندی سرور. شما همچنین می توانید روش فشرده سازی برای هر ستون فردی در تعریف `CREATE TABLE` پرس و جو. + +``` sql +CREATE TABLE codec_example +( + dt Date CODEC(ZSTD), + ts DateTime CODEC(LZ4HC), + float_value Float32 CODEC(NONE), + double_value Float64 CODEC(LZ4HC(9)) + value Float32 CODEC(Delta, ZSTD) +) +ENGINE = +... +``` + +اگر یک کدک مشخص شده است, کدک به طور پیش فرض صدق نمی کند. به عنوان مثال کدک ها را می توان در یک خط لوله ترکیب کرد, `CODEC(Delta, ZSTD)`. برای انتخاب بهترین ترکیب کدک برای شما پروژه معیار شبیه به شرح داده شده در التیت منتقل می کند [کدگذاری های جدید برای بهبود بهره وری کلیک](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) مقاله. + +!!! warning "اخطار" + شما می توانید فایل های پایگاه داده کلیک از حالت فشرده خارج با تاسیسات خارجی مانند `lz4`. بجای, استفاده از ویژه [کلیک کمپرسور](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) سودمند. + +فشرده سازی برای موتورهای جدول زیر پشتیبانی می شود: + +- [ادغام](../../engines/table-engines/mergetree-family/mergetree.md) خانواده پشتیبانی از کدک های فشرده سازی ستون و انتخاب روش فشرده سازی پیش فرض توسط [فشردهسازی](../../operations/server-configuration-parameters/settings.md#server-settings-compression) تنظیمات. +- [ثبت](../../engines/table-engines/log-family/log-family.md) خانواده با استفاده از `lz4` روش فشرده سازی به طور پیش فرض و پشتیبانی از کدک های فشرده سازی ستون. +- [تنظیم](../../engines/table-engines/special/set.md). فقط فشرده سازی پیش فرض پشتیبانی می کند. +- [پیوستن](../../engines/table-engines/special/join.md). فقط فشرده سازی پیش فرض پشتیبانی می کند. + +تاتر با پشتیبانی از کدک های هدف مشترک و کدک های تخصصی. + +#### کدکهای تخصصی {#create-query-specialized-codecs} + +این کدک ها طراحی شده اند تا فشرده سازی را با استفاده از ویژگی های خاص داده ها موثر تر کند. برخی از این کدک ها اطلاعات خود را فشرده سازی نمی کنند. در عوض داده ها را برای یک کدک هدف مشترک تهیه می کنند که بهتر از بدون این دارو را فشرده می کند. + +کدکهای تخصصی: + +- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` برای ذخیره سازی مقادیر دلتا استفاده می شود, بنابراین `delta_bytes` حداکثر اندازه مقادیر خام است. ممکن است `delta_bytes` ارزش: 1, 2, 4, 8. مقدار پیش فرض برای `delta_bytes` هست `sizeof(type)` اگر به برابر 1, 2, 4, یا 8. در تمام موارد دیگر 1 است. +- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [گوریل: سریع, مقیاس پذیر, در حافظه پایگاه داده سری زمان](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [گوریل: سریع, مقیاس پذیر, در حافظه پایگاه داده سری زمان](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` و `DateTime`). در هر مرحله از الگوریتم کدک یک بلوک از ارزش های 64 را می گیرد و به ماتریس بیتی 6464 می رسد و بیت های استفاده نشده ارزش ها را تولید می کند و بقیه را به عنوان یک دنباله باز می گرداند. بیت های استفاده نشده بیت هایی هستند که بین مقادیر حداکثر و حداقل در کل بخش داده ای که فشرده سازی استفاده می شود متفاوت نیستند. + +`DoubleDelta` و `Gorilla` کدک ها در گوریل تسدب به عنوان اجزای الگوریتم فشرده سازی خود استفاده می شود. رویکرد گوریل در سناریوها موثر است زمانی که یک دنباله از ارزش های کم زمان خود را با تغییر دادن زمان وجود دارد. مهر زمانی به طور موثر توسط فشرده `DoubleDelta` کدک و ارزش ها به طور موثر توسط فشرده `Gorilla` وابسته به کدک. مثلا برای دریافت جدول ذخیره شده به طور موثر می توانید در تنظیمات زیر ایجاد کنید: + +``` sql +CREATE TABLE codec_example +( + timestamp DateTime CODEC(DoubleDelta), + slow_values Float32 CODEC(Gorilla) +) +ENGINE = MergeTree() +``` + +#### کدک های هدف مشترک {#create-query-common-purpose-codecs} + +کدکها: + +- `NONE` — No compression. +- `LZ4` — Lossless [الگوریتم فشرده سازی داده ها](https://github.com/lz4/lz4) به طور پیش فرض استفاده می شود. اعمال فشرده سازی سریع 4. +- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` سطح پیش فرض اعمال می شود. سطوح ممکن: \[1, 12\]. محدوده سطح توصیه شده: \[4, 9\]. +- `ZSTD[(level)]` — [الگوریتم فشرد فشاری](https://en.wikipedia.org/wiki/Zstandard) با قابلیت تنظیم `level`. سطوح ممکن: \[1, 22\]. مقدار پیش فرض: 1. + +سطح فشرده سازی بالا برای حالات نامتقارن مفید هستند, مانند فشرده سازی یک بار, از حالت فشرده خارج بارها و بارها. سطوح بالاتر به معنای فشرده سازی بهتر و استفاده از پردازنده بالاتر است. + +## جداول موقت {#temporary-tables} + +تاتر از جداول موقت که دارای ویژگی های زیر: + +- جداول موقت ناپدید می شوند هنگامی که جلسه به پایان می رسد از جمله اگر اتصال از دست داده است. +- جدول موقت با استفاده از موتور حافظه تنها. +- دسی بل را نمی توان برای یک جدول موقت مشخص شده است. این است که در خارج از پایگاه داده ایجاد شده است. +- غیر ممکن است برای ایجاد یک جدول موقت با پرس و جو توزیع دی ال در تمام سرورهای خوشه (با استفاده از `ON CLUSTER`): این جدول تنها در جلسه فعلی وجود دارد. +- اگر یک جدول موقت است به همین نام به عنوان یکی دیگر و یک پرس و جو نام جدول بدون مشخص دسی بل مشخص, جدول موقت استفاده خواهد شد. +- برای پردازش پرس و جو توزیع, جداول موقت مورد استفاده در یک پرس و جو به سرور از راه دور منتقل. + +برای ایجاد یک جدول موقت از نحو زیر استفاده کنید: + +``` sql +CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) +``` + +در بیشتر موارد, جداول موقت به صورت دستی ایجاد نمی, اما در هنگام استفاده از داده های خارجی برای پرس و جو, و یا برای توزیع `(GLOBAL) IN`. برای کسب اطلاعات بیشتر به بخش های مناسب مراجعه کنید + +امکان استفاده از جداول با [موتور = حافظه](../../engines/table-engines/special/memory.md) به جای جداول موقت. + +## توزیع پرس و جو ددل (در بند خوشه) {#distributed-ddl-queries-on-cluster-clause} + +این `CREATE`, `DROP`, `ALTER` و `RENAME` نمایش داده شد حمایت از اجرای توزیع در یک خوشه. +برای مثال پرس و جو زیر ایجاد می کند `all_hits` `Distributed` جدول در هر میزبان در `cluster`: + +``` sql +CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) +``` + +به منظور اجرای این نمایش داده شد به درستی, هر یک از میزبان باید تعریف خوشه همان (برای ساده سازی تنظیمات همگام سازی, شما می توانید تعویض از باغ وحش استفاده). همچنین باید به سرورهای باغ وحش متصل شوند. +نسخه محلی از پرس و جو در نهایت بر روی هر یک از میزبان در خوشه اجرا می شود, حتی اگر برخی از میزبان در حال حاضر در دسترس نیست. سفارش برای اجرای نمایش داده شد در یک میزبان واحد تضمین شده است. + +## CREATE VIEW {#create-view} + +``` sql +CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... +``` + +ایجاد یک دیدگاه. دو نوع دیدگاه وجود دارد: طبیعی و تحقق. + +نمایش عادی هیچ داده ذخیره نمی, اما فقط انجام خواندن از جدول دیگر. به عبارت دیگر, یک نمایش عادی چیزی بیش از یک پرس و جو ذخیره شده است. هنگام خواندن از نظر, این پرس و جو را نجات داد به عنوان یک خرده فروشی در بند از استفاده. + +به عنوان مثال, فرض کنیم شما یک دیدگاه ایجاد کرده اید: + +``` sql +CREATE VIEW view AS SELECT ... +``` + +و پرس و جو نوشته شده است: + +``` sql +SELECT a, b, c FROM view +``` + +این پرس و جو به طور کامل به استفاده از خرده فروشی معادل است: + +``` sql +SELECT a, b, c FROM (SELECT ...) +``` + +نمایش ها محقق داده فروشگاه تبدیل شده توسط پرس و جو مربوطه را انتخاب کنید. + +هنگام ایجاد یک دیدگاه محقق بدون `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. + +هنگام ایجاد یک دیدگاه محقق با `TO [db].[table]`, شما باید استفاده کنید `POPULATE`. + +مشاهده محقق به شرح زیر مرتب: هنگام قرار دادن داده ها به جدول مشخص شده در انتخاب, بخشی از داده های درج شده است این پرس و جو را انتخاب کنید تبدیل, و در نتیجه در نظر قرار داده. + +اگر شما جمعیت مشخص, داده های جدول موجود در نظر قرار داده در هنگام ایجاد, اگر ساخت یک `CREATE TABLE ... AS SELECT ...` . در غیر این صورت پرس و جو شامل تنها داده های درج شده در جدول پس از ایجاد دیدگاه. ما توصیه نمی کنیم با استفاده از جمعیت, از داده ها در جدول در طول ایجاد مشاهده قرار داده نمی شود. + +A `SELECT` پرسوجو می تواند شامل شود `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` تنظیم شده است, داده ها در طول درج جمع, اما تنها در یک بسته واحد از داده های درج شده. داده ها بیشتر جمع نمی شود. استثنا است که با استفاده از یک موتور است که به طور مستقل انجام تجمع داده ها, مانند `SummingMergeTree`. + +اعدام `ALTER` نمایش داده شد در نمایش محقق شده است به طور کامل توسعه یافته نیست, بنابراین ممکن است ناخوشایند. اگر مشاهده محقق با استفاده از ساخت و ساز `TO [db.]name` شما می توانید `DETACH` منظره, اجرا `ALTER` برای جدول هدف و سپس `ATTACH` قبلا جدا (`DETACH`) نظر . + +نمایش ها نگاه همان جداول عادی. برای مثال در نتیجه ذکر شده است `SHOW TABLES` پرس و جو. + +پرس و جو جداگانه برای حذف نمایش ها وجود ندارد. برای حذف یک نما, استفاده `DROP TABLE`. + +## CREATE DICTIONARY {#create-dictionary-query} + +``` sql +CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] +( + key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + attr1 type2 [DEFAULT|EXPRESSION expr3], + attr2 type2 [DEFAULT|EXPRESSION expr4] +) +PRIMARY KEY key1, key2 +SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) +LAYOUT(LAYOUT_NAME([param_name param_value])) +LIFETIME([MIN val1] MAX val2) +``` + +ایجاد [فرهنگ لغت خارجی](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) با توجه به [ساختار](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md), [متن](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md), [طرحبندی](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) و [طول عمر](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md). + +ساختار فرهنگ لغت خارجی شامل ویژگی های. ویژگی فرهنگ لغت به طور مشابه به ستون جدول مشخص شده است. تنها ویژگی مورد نیاز ویژگی نوع خود است, تمام خواص دیگر ممکن است مقادیر پیش فرض دارند. + +بسته به فرهنگ لغت [طرحبندی](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) یک یا چند ویژگی را می توان به عنوان کلید فرهنگ لغت مشخص شده است. + +برای کسب اطلاعات بیشتر, دیدن [واژهنامهها خارجی](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) بخش. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/fa/sql_reference/statements/index.md b/docs/fa/sql-reference/statements/index.md similarity index 100% rename from docs/fa/sql_reference/statements/index.md rename to docs/fa/sql-reference/statements/index.md diff --git a/docs/fa/sql-reference/statements/insert-into.md b/docs/fa/sql-reference/statements/insert-into.md new file mode 100644 index 00000000000..7a309cfeb0f --- /dev/null +++ b/docs/fa/sql-reference/statements/insert-into.md @@ -0,0 +1,80 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: INSERT INTO +--- + +## INSERT {#insert} + +اضافه کردن داده ها. + +قالب پرس و جو عمومی: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... +``` + +پرسوجو میتواند فهرستی از ستونها را برای درج مشخص کند `[(c1, c2, c3)]`. در این مورد, بقیه ستون ها با پر: + +- مقادیر محاسبه شده از `DEFAULT` عبارات مشخص شده در تعریف جدول. +- صفر و رشته خالی, اگر `DEFAULT` عبارات تعریف نشده. + +اگر [\_مرحلهای دقیق = 1](../../operations/settings/settings.md) ستون هایی که ندارند `DEFAULT` تعریف شده باید در پرس و جو ذکر شده است. + +داده ها را می توان به درج در هر گذشت [قالب](../../interfaces/formats.md#formats) پشتیبانی شده توسط فاحشه خانه. قالب باید به صراحت در پرس و جو مشخص شود: + +``` sql +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: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... +``` + +تاتر حذف تمام فضاها و خوراک یک خط (در صورتی که وجود دارد) قبل از داده ها. هنگام تشکیل یک پرس و جو, توصیه می کنیم قرار دادن داده ها بر روی یک خط جدید پس از اپراتورهای پرس و جو (این مهم است که اگر داده ها با فضاهای شروع می شود). + +مثال: + +``` sql +INSERT INTO t FORMAT TabSeparated +11 Hello, world! +22 Qwerty +``` + +شما می توانید داده ها را به طور جداگانه از پرس و جو با استفاده از مشتری خط فرمان یا رابط اچ تی پی وارد کنید. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “[واسط](../../interfaces/index.md#interfaces)”. + +### قیدها {#constraints} + +اگر جدول [قیدها](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. + +### قرار دادن نتایج `SELECT` {#insert_query_insert-select} + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... +``` + +ستون ها با توجه به موقعیت خود را در بند را انتخاب کنید نقشه برداری. با این حال, نام خود را در عبارت را انتخاب کنید و جدول برای درج ممکن است متفاوت باشد. در صورت لزوم نوع ریخته گری انجام می شود. + +هیچ یک از فرمت های داده به جز مقادیر اجازه تنظیم مقادیر به عبارات مانند `now()`, `1 + 2` و به همین ترتیب. فرمت ارزش اجازه می دهد تا استفاده محدود از عبارات, اما این توصیه نمی شود, چرا که در این مورد کد کم است برای اجرای خود استفاده می شود. + +نمایش داده شد دیگر برای تغییر قطعات داده ها پشتیبانی نمی شوند: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. +با این حال, شما می توانید داده های قدیمی با استفاده از حذف `ALTER TABLE ... DROP PARTITION`. + +`FORMAT` بند باید در پایان پرس و جو مشخص شود اگر `SELECT` بند شامل تابع جدول [ورودی()](../table-functions/input.md). + +### ملاحظات عملکرد {#performance-considerations} + +`INSERT` داده های ورودی را با کلید اصلی مرتب می کند و توسط یک کلید پارتیشن به پارتیشن تقسیم می شود. اگر داده ها را به چندین پارتیشن در یک بار وارد کنید می تواند به طور قابل توجهی عملکرد را کاهش دهد `INSERT` پرس و جو. برای جلوگیری از این: + +- اضافه کردن داده ها در دسته نسبتا بزرگ, مانند 100,000 ردیف در یک زمان. +- داده های گروه توسط یک کلید پارتیشن قبل از بارگذاری به کلیک. + +عملکرد کاهش نخواهد یافت اگر: + +- داده ها در زمان واقعی اضافه شده است. +- شما داده ها است که معمولا بر اساس زمان طبقه بندی شده اند را بارگذاری کنید. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/fa/sql-reference/statements/misc.md b/docs/fa/sql-reference/statements/misc.md new file mode 100644 index 00000000000..c279b634ce0 --- /dev/null +++ b/docs/fa/sql-reference/statements/misc.md @@ -0,0 +1,252 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u063A\u06CC\u0631\u0647" +--- + +# متفرقه نمایش داده شد {#miscellaneous-queries} + +## ATTACH {#attach} + +این پرس و جو دقیقا همان است `CREATE` اما + +- به جای کلمه `CREATE` با استفاده از این کلمه `ATTACH`. +- پرس و جو می کند داده ها بر روی دیسک ایجاد کنید, اما فرض می شود که داده ها در حال حاضر در مکان های مناسب, و فقط می افزاید: اطلاعات در مورد جدول به سرور. + پس از اجرای یک ضمیمه پرس و جو در سرور خواهد شد در مورد وجود جدول. + +اگر جدول قبلا جدا شد (`DETACH`), به این معنی که ساختار خود شناخته شده است, شما می توانید مختصر بدون تعریف ساختار استفاده. + +``` sql +ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] +``` + +این پرس و جو در هنگام شروع سرور استفاده می شود. سرور ذخیره ابرداده جدول به عنوان فایل های با `ATTACH` نمایش داده شد, که به سادگی در راه اندازی اجرا می شود (به غیر از جداول سیستم, که به صراحت بر روی سرور ایجاد). + +## CHECK TABLE {#check-table} + +چک اگر داده ها در جدول خراب شده است. + +``` sql +CHECK TABLE [db.]name +``` + +این `CHECK TABLE` پرس و جو اندازه فایل واقعی با مقادیر مورد انتظار که بر روی سرور ذخیره می شود مقایسه می کند. اگر اندازه فایل انجام مقادیر ذخیره شده مطابقت ندارد, به این معنی که داده ها خراب شده است. این می تواند باعث, مثلا, توسط یک تصادف سیستم در طول اجرای پرس و جو. + +پاسخ پرس و جو شامل `result` ستون با یک ردیف. ردیف دارای ارزش +[بولی](../../sql-reference/data-types/boolean.md) نوع: + +- 0-داده ها در جدول خراب شده است. +- 1-داده حفظ یکپارچگی. + +این `CHECK TABLE` پرس و جو از موتورهای جدول زیر پشتیبانی می کند: + +- [ثبت](../../engines/table-engines/log-family/log.md) +- [جمع شدن](../../engines/table-engines/log-family/tinylog.md) +- [خط زدن](../../engines/table-engines/log-family/stripelog.md) +- [ادغام خانواده](../../engines/table-engines/mergetree-family/mergetree.md) + +انجام بیش از جداول با موتورهای جدول دیگر باعث یک استثنا. + +موتورهای از `*Log` خانواده بازیابی اطلاعات خودکار در شکست را فراهم نمی کند. استفاده از `CHECK TABLE` پرس و جو برای پیگیری از دست دادن داده ها به موقع. + +برای `MergeTree` موتورهای خانواده `CHECK TABLE` پرس و جو نشان می دهد وضعیت چک برای هر بخش داده های فردی از یک جدول بر روی سرور محلی. + +**اگر داده ها خراب شده است** + +اگر جدول خراب شده است, شما می توانید داده های غیر خراب به جدول دیگر کپی کنید. برای انجام این کار: + +1. ایجاد یک جدول جدید با ساختار همان جدول صدمه دیده است. برای انجام این کار پرس و جو را اجرا کنید `CREATE TABLE AS `. +2. تنظیم [\_مخفی کردن](../../operations/settings/settings.md#settings-max_threads) ارزش به 1 برای پردازش پرس و جو بعدی در یک موضوع واحد. برای انجام این کار پرس و جو را اجرا کنید `SET max_threads = 1`. +3. اجرای پرسوجو `INSERT INTO SELECT * FROM `. این درخواست داده های غیر خراب شده را از جدول خراب شده به جدول دیگر کپی می کند. فقط داده ها قبل از قسمت خراب کپی خواهد شد. +4. راه اندازی مجدد `clickhouse-client` برای تنظیم مجدد `max_threads` ارزش. + +## DESCRIBE TABLE {#misc-describe-table} + +``` sql +DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +بازگرداندن موارد زیر `String` نوع ستونها: + +- `name` — Column name. +- `type`— Column type. +- `default_type` — Clause that is used in [عبارت پیشفرض](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` یا `ALIAS`). ستون شامل یک رشته خالی, اگر عبارت پیش فرض مشخص نشده است. +- `default_expression` — Value specified in the `DEFAULT` بند بند. +- `comment_expression` — Comment text. + +ساختارهای داده تو در تو خروجی در “expanded” قالب. هر ستون به طور جداگانه نشان داده شده است, با نام بعد از یک نقطه. + +## DETACH {#detach} + +حذف اطلاعات در مورد ‘name’ جدول از سرور. سرور متوقف می شود دانستن در مورد وجود جدول. + +``` sql +DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +این داده ها و یا ابرداده جدول را حذف کنید. در راه اندازی سرور بعدی, سرور خواهد ابرداده به عنوان خوانده شده و پیدا کردن در مورد جدول دوباره. +به طور مشابه “detached” جدول را می توان دوباره متصل با استفاده از `ATTACH` پرس و جو (به غیر از جداول سیستم که لازم نیست metadata ذخیره شده برای آنها). + +وجود ندارد `DETACH DATABASE` پرس و جو. + +## DROP {#drop} + +این پرسوجو دارای دو نوع است: `DROP DATABASE` و `DROP TABLE`. + +``` sql +DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] +``` + +حذف تمام جداول در داخل ‘db’ پایگاه داده, سپس حذف ‘db’ پایگاه داده خود را. +اگر `IF EXISTS` مشخص شده است, این خطا بازگشت نیست اگر پایگاه داده وجود ندارد. + +``` sql +DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +حذف جدول. +اگر `IF EXISTS` مشخص شده است, این خطا را نمی گرداند اگر جدول وجود ندارد و یا پایگاه داده وجود ندارد. + + DROP DICTIONARY [IF EXISTS] [db.]name + +دلس فرهنگ لغت. +اگر `IF EXISTS` مشخص شده است, این خطا را نمی گرداند اگر جدول وجود ندارد و یا پایگاه داده وجود ندارد. + +## EXISTS {#exists} + +``` sql +EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] +``` + +بازگرداندن یک `UInt8`- نوع ستون, که شامل ارزش واحد `0` اگر جدول یا پایگاه داده وجود ندارد, یا `1` اگر جدول در پایگاه داده مشخص شده وجود دارد. + +## KILL QUERY {#kill-query} + +``` sql +KILL QUERY [ON CLUSTER cluster] + WHERE + [SYNC|ASYNC|TEST] + [FORMAT format] +``` + +تلاش برای به زور خاتمه نمایش داده شد در حال حاضر در حال اجرا. +نمایش داده شد به فسخ از سیستم انتخاب شده است.جدول پردازش ها با استفاده از معیارهای تعریف شده در `WHERE` بند از `KILL` پرس و جو. + +مثالها: + +``` sql +-- Forcibly terminates all queries with the specified query_id: +KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' + +-- Synchronously terminates all queries run by 'username': +KILL QUERY WHERE user='username' SYNC +``` + +فقط خواندنی کاربران تنها می تواند نمایش داده شد خود را متوقف کند. + +به طور پیش فرض, نسخه ناهمزمان از نمایش داده شد استفاده شده است (`ASYNC`), که برای تایید است که نمایش داده شد را متوقف کرده اند منتظر نیست. + +نسخه همزمان (`SYNC`) منتظر تمام نمایش داده شد برای متوقف کردن و نمایش اطلاعات در مورد هر فرایند به عنوان متوقف می شود. +پاسخ شامل `kill_status` ستون, که می تواند مقادیر زیر را: + +1. ‘finished’ – The query was terminated successfully. +2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. +3. The other values ​​explain why the query can’t be stopped. + +پرسوجوی تست (`TEST`) فقط چک حقوق کاربر و نمایش یک لیست از نمایش داده شد برای متوقف کردن. + +## KILL MUTATION {#kill-mutation} + +``` sql +KILL MUTATION [ON CLUSTER cluster] + WHERE + [TEST] + [FORMAT format] +``` + +تلاش برای لغو و حذف [جهشها](alter.md#alter-mutations) که در حال حاضر اجرای. جهش به لغو از انتخاب [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) جدول با استفاده از فیلتر مشخص شده توسط `WHERE` بند از `KILL` پرس و جو. + +آزمون پرس و جو (`TEST`) فقط چک حقوق کاربر و نمایش یک لیست از نمایش داده شد برای متوقف کردن. + +مثالها: + +``` sql +-- Cancel and remove all mutations of the single table: +KILL MUTATION WHERE database = 'default' AND table = 'table' + +-- Cancel the specific mutation: +KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' +``` + +The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). + +تغییرات در حال حاضر توسط جهش ساخته شده به عقب نورد نیست. + +## OPTIMIZE {#misc_operations-optimize} + +``` sql +OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] +``` + +این پرس و جو تلاش می کند تا ادغام برنامه ریزی نشده از قطعات داده برای جداول با یک موتور جدول از [ادغام](../../engines/table-engines/mergetree-family/mergetree.md) خانواده + +این `OPTMIZE` پرس و جو نیز برای پشتیبانی [ماده بینی](../../engines/table-engines/special/materializedview.md) و [بافر](../../engines/table-engines/special/buffer.md) موتورها. دیگر موتورهای جدول پشتیبانی نمی شوند. + +زمانی که `OPTIMIZE` با استفاده از [تکرار غذای اصلی](../../engines/table-engines/mergetree-family/replication.md) خانواده از موتورهای جدول, تاتر ایجاد یک کار برای ادغام و منتظر اعدام در تمام گره (در صورتی که `replication_alter_partitions_sync` تنظیم فعال است). + +- اگر `OPTIMIZE` یک ادغام به هر دلیلی انجام نمی, این کار مشتری اطلاع نیست. برای فعال کردن اعلان ها از [ا\_فزون\_ف\_کوپ](../../operations/settings/settings.md#setting-optimize_throw_if_noop) تنظیمات. +- اگر شما یک مشخص `PARTITION` فقط پارتیشن مشخص شده بهینه شده است. [نحوه تنظیم بیان پارتیشن](alter.md#alter-how-to-specify-part-expr). +- اگر شما مشخص کنید `FINAL` حتی زمانی که تمام داده ها در حال حاضر در یک بخش بهینه سازی انجام شده است. +- اگر شما مشخص کنید `DEDUPLICATE` و سپس به طور کامل یکسان ردیف خواهد بود deduplicated (تمام ستون ها در مقایسه با) آن را حس می کند تنها برای MergeTree موتور. + +!!! warning "اخطار" + `OPTIMIZE` می توانید رفع نیست “Too many parts” خطا. + +## RENAME {#misc_operations-rename} + +تغییر نام یک یا چند جدول. + +``` sql +RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] +``` + +همه جداول تحت قفل جهانی تغییر نام داد. تغییر نام جداول یک عملیات نور است. اگر شما یک پایگاه داده دیگر نشان داد پس از به, جدول خواهد شد به این پایگاه داده منتقل. اما, دایرکتوری ها با پایگاه داده باید اقامت در همان فایل سیستم (در غیر این صورت یک خطا بازگشته است). + +## SET {#query-set} + +``` sql +SET param = value +``` + +انتساب `value` به `param` [تنظیم](../../operations/settings/index.md) برای جلسه فعلی. شما نمی توانید تغییر دهید [تنظیمات سرور](../../operations/server-configuration-parameters/index.md) از این طرف + +شما همچنین می توانید تمام مقادیر را از مشخصات تنظیمات مشخص شده در یک پرس و جو واحد تنظیم کنید. + +``` sql +SET profile = 'profile-name-from-the-settings-file' +``` + +برای کسب اطلاعات بیشتر, دیدن [تنظیمات](../../operations/settings/settings.md). + +## TRUNCATE {#truncate} + +``` sql +TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +حذف تمام داده ها را از یک جدول. هنگامی که بند `IF EXISTS` حذف شده است, پرس و جو یک خطا می گرداند اگر جدول وجود ندارد. + +این `TRUNCATE` پرسوجو برای پشتیبانی نمیشود [مشاهده](../../engines/table-engines/special/view.md), [پرونده](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md) و [خالی](../../engines/table-engines/special/null.md) موتورهای جدول. + +## USE {#use} + +``` sql +USE db +``` + +به شما اجازه می دهد پایگاه داده فعلی را برای جلسه تنظیم کنید. +پایگاه داده فعلی برای جستجو برای جداول استفاده می شود اگر پایگاه داده به صراحت در پرس و جو با یک نقطه قبل از نام جدول تعریف نشده است. +این پرس و جو را نمی توان در هنگام استفاده از پروتکل قام ساخته شده, از هیچ مفهوم یک جلسه وجود دارد. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/fa/sql-reference/statements/select.md b/docs/fa/sql-reference/statements/select.md new file mode 100644 index 00000000000..86a7ce74cec --- /dev/null +++ b/docs/fa/sql-reference/statements/select.md @@ -0,0 +1,610 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: SELECT +--- + +# نحو نمایش داده شد را انتخاب کنید {#select-queries-syntax} + +`SELECT` بازیابی داده ها را انجام می دهد. + +``` sql +[WITH expr_list|(subquery)] +SELECT [DISTINCT] expr_list +[FROM [db.]table | (subquery) | table_function] [FINAL] +[SAMPLE sample_coeff] +[ARRAY JOIN ...] +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list +[PREWHERE expr] +[WHERE expr] +[GROUP BY expr_list] [WITH TOTALS] +[HAVING expr] +[ORDER BY expr_list] +[LIMIT [offset_value, ]n BY columns] +[LIMIT [n, ]m] +[UNION ALL ...] +[INTO OUTFILE filename] +[FORMAT format] +``` + +همه بند اختیاری هستند, به جز برای لیست مورد نیاز از عبارات بلافاصله پس از انتخاب. +بند های زیر تقریبا به همان ترتیب در نوار نقاله اجرای پرس و جو توصیف می شوند. + +اگر پرس و جو حذف `DISTINCT`, `GROUP BY` و `ORDER BY` بند و `IN` و `JOIN` subqueries این پرس و جو خواهد شد به طور کامل جریان پردازش با استفاده از O(1) میزان رم. +در غیر این صورت, پرس و جو ممکن است مقدار زیادی از رم مصرف اگر محدودیت های مناسب مشخص نشده است: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “Settings”. ممکن است که به استفاده از مرتب سازی خارجی (صرفه جویی در جداول موقت به یک دیسک) و تجمع خارجی. `The system does not have "merge join"`. + +### با بند {#with-clause} + +در این بخش پشتیبانی از عبارات جدول مشترک فراهم می کند ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), با برخی از محدودیت: +1. نمایش داده شد بازگشتی پشتیبانی نمی شوند +2. هنگامی که زیرخاکری در داخل با بخش استفاده می شود, این نتیجه باید اسکالر با دقیقا یک ردیف باشد +3. بیان نتایج در دسترس نیست در subqueries +نتایج با عبارات بند را می توان در داخل بند را انتخاب کنید استفاده می شود. + +مثال 1: با استفاده از عبارت ثابت به عنوان “variable” + +``` sql +WITH '2019-08-01 15:23:00' as ts_upper_bound +SELECT * +FROM hits +WHERE + EventDate = toDate(ts_upper_bound) AND + EventTime <= ts_upper_bound +``` + +مثال 2: جمع تخلیه(بایت) نتیجه بیان از بند لیست ستون را انتخاب کنید + +``` sql +WITH sum(bytes) as s +SELECT + formatReadableSize(s), + table +FROM system.parts +GROUP BY table +ORDER BY s +``` + +مثال 3: استفاده از نتایج عددی پرس + +``` sql +/* this example would return TOP 10 of most huge tables */ +WITH + ( + SELECT sum(bytes) + FROM system.parts + WHERE active + ) AS total_disk_usage +SELECT + (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, + table +FROM system.parts +GROUP BY table +ORDER BY table_disk_usage DESC +LIMIT 10 +``` + +مثال 4: استفاده مجدد از بیان در زیرخاکری +به عنوان یک راهحل برای محدودیت کنونی برای بیان استفاده در subqueries شما ممکن است تکراری است. + +``` sql +WITH ['hello'] AS hello +SELECT + hello, + * +FROM +( + WITH ['hello'] AS hello + SELECT hello +) +``` + +``` text +┌─hello─────┬─hello─────┐ +│ ['hello'] │ ['hello'] │ +└───────────┴───────────┘ +``` + +### از بند {#select-from} + +اگر از بند حذف شده است, داده خواهد شد از خواندن `system.one` جدول +این `system.one` جدول شامل دقیقا یک ردیف است (این جدول همان هدف را به عنوان جدول دوگانه موجود در سایر دساماسها انجام می دهد). + +این `FROM` بند منبع برای خواندن داده ها از مشخص: + +- جدول +- خرده فروشی +- [تابع جدول](../table-functions/index.md) + +`ARRAY JOIN` و به طور منظم `JOIN` همچنین ممکن است شامل شود (پایین را ببینید). + +به جای یک جدول `SELECT` خرده فروشی ممکن است در پرانتز مشخص. +در مقابل به گذاشتن استاندارد, مترادف نیازی به پس از یک خرده فروشی مشخص شود. + +برای اجرای پرس و جو تمام ستون های ذکر شده در پرس و جو از جدول مناسب استخراج می شوند. هر ستون برای پرس و جو خارجی مورد نیاز نیست از کارخانه های فرعی پرتاب می شود. +اگر پرس و جو هیچ ستون لیست نیست (به عنوان مثال, `SELECT count() FROM t`), برخی از ستون از جدول استخراج به هر حال (کوچکترین ترجیح داده می شود), به منظور محاسبه تعداد ردیف. + +#### تغییردهنده نهایی {#select-from-final} + +قابل استفاده در هنگام انتخاب داده ها از جداول از [ادغام](../../engines/table-engines/mergetree-family/mergetree.md)- خانواده موتور غیر از `GraphiteMergeTree`. چه زمانی `FINAL` مشخص شده است, تاتر به طور کامل ادغام داده ها قبل از بازگشت به نتیجه و در نتیجه انجام تمام تحولات داده که در طول ادغام برای موتور جدول داده شده اتفاق می افتد. + +همچنین برای پشتیبانی: +- [تکرار](../../engines/table-engines/mergetree-family/replication.md) نسخه های `MergeTree` موتورها. +- [نما](../../engines/table-engines/special/view.md), [بافر](../../engines/table-engines/special/buffer.md), [توزیع شده](../../engines/table-engines/special/distributed.md) و [ماده بینی](../../engines/table-engines/special/materializedview.md) موتورها که بیش از موتورهای دیگر کار می کنند به شرطی که بیش از ایجاد شده اند `MergeTree`- جدول موتور . + +نمایش داده شد که با استفاده از `FINAL` اعدام به همان سرعتی که نمایش داده شد مشابه که نمی, زیرا: + +- پرس و جو در یک موضوع اجرا و داده ها در طول اجرای پرس و جو با هم ادغام شدند. +- نمایش داده شد با `FINAL` خوانده شده ستون کلید اولیه در علاوه بر این به ستون مشخص شده در پرس و جو. + +در بیشتر موارد, اجتناب از استفاده از `FINAL`. + +### بند نمونه {#select-sample-clause} + +این `SAMPLE` بند اجازه می دهد تا برای پردازش پرس و جو تقریبی. + +هنگامی که نمونه گیری داده ها فعال است, پرس و جو بر روی تمام داده ها انجام نمی, اما تنها در بخش خاصی از داده ها (نمونه). مثلا, اگر شما نیاز به محاسبه ارقام برای تمام بازدیدکننده داشته است, کافی است برای اجرای پرس و جو در 1/10 کسری از تمام بازدیدکننده داشته است و سپس ضرب در نتیجه 10. + +پردازش پرس و جو تقریبی می تواند در موارد زیر مفید باشد: + +- هنگامی که شما شرایط زمان بندی دقیق (مانند \<100 مگابایت) اما شما نمی توانید هزینه منابع سخت افزاری اضافی را برای دیدار با خود توجیه کنید. +- هنگامی که داده های خام خود را دقیق نیست, بنابراین تقریب می کند به طرز محسوسی کاهش کیفیت. +- نیازهای کسب و کار هدف تقریبی نتایج (برای مقرون به صرفه بودن و یا به منظور به بازار دقیق نتایج به کاربران حق بیمه). + +!!! note "یادداشت" + شما فقط می توانید نمونه برداری با استفاده از جداول در [ادغام](../../engines/table-engines/mergetree-family/mergetree.md) خانواده, و تنها در صورتی که بیان نمونه برداری در ایجاد جدول مشخص شد (دیدن [موتور ادغام](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table)). + +ویژگی های نمونه گیری داده ها به شرح زیر است: + +- نمونهگیری دادهها یک مکانیسم قطعی است. نتیجه همان `SELECT .. SAMPLE` پرس و جو همیشه یکسان است. +- نمونه گیری به طور مداوم برای جداول مختلف کار می کند. برای جداول با یک کلید نمونه برداری تک, یک نمونه با ضریب همان همیشه زیر مجموعه همان داده های ممکن را انتخاب. برای مثال یک نمونه از شناسه های کاربر طول می کشد ردیف با همان زیر مجموعه از همه ممکن است شناسه کاربر از جداول مختلف. این به این معنی است که شما می توانید نمونه در کارخانه های فرعی در استفاده از [IN](#select-in-operators) بند بند. همچنین شما می توانید نمونه ها را با استفاده از [JOIN](#select-join) بند بند. +- نمونه گیری اجازه می دهد تا خواندن اطلاعات کمتر از یک دیسک. توجه داشته باشید که شما باید کلید نمونه برداری به درستی مشخص کنید. برای کسب اطلاعات بیشتر, دیدن [ایجاد یک جدول ادغام](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). + +برای `SAMPLE` بند نحو زیر پشتیبانی می شود: + +| SAMPLE Clause Syntax | توصیف | +|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `SAMPLE k` | اینجا `k` است تعداد از 0 به 1.
پرس و جو در اجرا `k` کسری از داده ها. به عنوان مثال, `SAMPLE 0.1` پرس و جو را در 10 درصد از داده ها اجرا می کند. [ادامه مطلب](#select-sample-k) | +| `SAMPLE n` | اینجا `n` عدد صحیح به اندازه کافی بزرگ است.
پرس و جو بر روی یک نمونه از حداقل اعدام `n` ردیف (اما نه به طور قابل توجهی بیشتر از این). به عنوان مثال, `SAMPLE 10000000` پرس و جو را در حداقل ردیف های 10000000 اجرا می کند. [ادامه مطلب](#select-sample-n) | +| `SAMPLE k OFFSET m` | اینجا `k` و `m` اعداد از 0 به 1.
پرس و جو بر روی یک نمونه از اعدام `k` کسری از داده ها. داده های مورد استفاده برای نمونه توسط جبران `m` کسر کردن. [ادامه مطلب](#select-sample-offset) | + +#### SAMPLE K {#select-sample-k} + +اینجا `k` است تعداد از 0 به 1 (هر دو نمادهای کسری و اعشاری پشتیبانی می شوند). به عنوان مثال, `SAMPLE 1/2` یا `SAMPLE 0.5`. + +در یک `SAMPLE k` بند, نمونه از گرفته `k` کسری از داده ها. مثال زیر نشان داده شده است: + +``` sql +SELECT + Title, + count() * 10 AS PageViews +FROM hits_distributed +SAMPLE 0.1 +WHERE + CounterID = 34 +GROUP BY Title +ORDER BY PageViews DESC LIMIT 1000 +``` + +در این مثال پرس و جو اجرا شده است در یک نمونه از 0.1 (10%) از داده ها. ارزش توابع دانه ها به طور خودکار اصلاح نمی, بنابراین برای دریافت یک نتیجه تقریبی, ارزش `count()` به صورت دستی توسط ضرب 10. + +#### SAMPLE N {#select-sample-n} + +اینجا `n` عدد صحیح به اندازه کافی بزرگ است. به عنوان مثال, `SAMPLE 10000000`. + +در این مورد, پرس و جو بر روی یک نمونه از حداقل اعدام `n` ردیف (اما نه به طور قابل توجهی بیشتر از این). به عنوان مثال, `SAMPLE 10000000` پرس و جو را در حداقل ردیف های 10000000 اجرا می کند. + +از حداقل واحد برای خواندن داده ها یک گرانول است (اندازه خود را توسط مجموعه `index_granularity` تنظیم), این را حس می کند به مجموعه ای از یک نمونه است که بسیار بزرگتر از اندازه گرانول. + +هنگام استفاده از `SAMPLE n` بند, شما نمی دانید که درصد نسبی داده پردازش شد. بنابراین شما نمی دانید ضریب توابع کل باید توسط ضرب. استفاده از `_sample_factor` ستون مجازی برای دریافت نتیجه تقریبی. + +این `_sample_factor` ستون شامل ضرایب نسبی است که به صورت پویا محاسبه می شود. این ستون به طور خودکار ایجاد زمانی که شما [ایجاد](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table) یک جدول با کلید نمونه گیری مشخص. نمونه های استفاده از `_sample_factor` ستون در زیر نشان داده شده. + +بیایید جدول را در نظر بگیریم `visits`, که شامل ارقام در مورد بازدیدکننده داشته است سایت. مثال اول نشان می دهد که چگونه برای محاسبه تعداد بازدید از صفحه: + +``` sql +SELECT sum(PageViews * _sample_factor) +FROM visits +SAMPLE 10000000 +``` + +مثال بعدی نشان می دهد که چگونه برای محاسبه تعداد کل بازدیدکننده داشته است: + +``` sql +SELECT sum(_sample_factor) +FROM visits +SAMPLE 10000000 +``` + +مثال زیر نشان می دهد که چگونه برای محاسبه مدت زمان جلسه به طور متوسط. توجه داشته باشید که شما لازم نیست به استفاده از ضریب نسبی برای محاسبه مقادیر متوسط. + +``` sql +SELECT avg(Duration) +FROM visits +SAMPLE 10000000 +``` + +#### SAMPLE K OFFSET M {#select-sample-offset} + +اینجا `k` و `m` اعداد از 0 به 1. نمونه های زیر نشان داده شده. + +**مثال 1** + +``` sql +SAMPLE 1/10 +``` + +در این مثال نمونه 1 / 10 از تمام داده ها است: + +`[++------------]` + +**مثال 2** + +``` sql +SAMPLE 1/10 OFFSET 1/2 +``` + +در اینجا یک نمونه از 10 درصد گرفته شده از نیمه دوم از داده ها. + +`[------++------]` + +### مجموعه پیوستن بند {#select-array-join-clause} + +اجازه می دهد تا اجرای `JOIN` با یک آرایه یا تو در تو ساختار داده ها. قصد این است که شبیه به [ارریجین](../../sql-reference/functions/array-join.md#functions_arrayjoin) تابع, اما قابلیت های خود را گسترده تر است. + +``` sql +SELECT +FROM +[LEFT] ARRAY JOIN +[WHERE|PREWHERE ] +... +``` + +شما می توانید تنها یک مشخص `ARRAY JOIN` بند در یک پرس و جو. + +سفارش اجرای پرس و جو در هنگام اجرا بهینه شده است `ARRAY JOIN`. اگرچه `ARRAY JOIN` همیشه باید قبل از مشخص شود `WHERE/PREWHERE` بند, این می تواند انجام شود یا قبل از `WHERE/PREWHERE` (اگر نتیجه در این بند مورد نیاز است), و یا پس از اتمام (برای کاهش حجم محاسبات). سفارش پردازش توسط بهینه ساز پرس و جو کنترل می شود. + +انواع پشتیبانی شده از `ARRAY JOIN` به شرح زیر است: + +- `ARRAY JOIN` - در این مورد, بند خالی در نتیجه شامل نمی شود `JOIN`. +- `LEFT ARRAY JOIN` - نتیجه `JOIN` شامل ردیف با ارریس خالی است. مقدار برای یک مجموعه خالی است به مقدار پیش فرض برای نوع عنصر مجموعه (معمولا 0, رشته خالی و یا تهی). + +نمونه های زیر نشان می دهد استفاده از `ARRAY JOIN` و `LEFT ARRAY JOIN` بند. بیایید یک جدول با یک [& حذف](../../sql-reference/data-types/array.md) ستون را تایپ کنید و مقادیر را وارد کنید: + +``` sql +CREATE TABLE arrays_test +( + s String, + arr Array(UInt8) +) ENGINE = Memory; + +INSERT INTO arrays_test +VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); +``` + +``` text +┌─s───────────┬─arr─────┐ +│ Hello │ [1,2] │ +│ World │ [3,4,5] │ +│ Goodbye │ [] │ +└─────────────┴─────────┘ +``` + +مثال زیر از `ARRAY JOIN` بند: + +``` sql +SELECT s, arr +FROM arrays_test +ARRAY JOIN arr; +``` + +``` text +┌─s─────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +└───────┴─────┘ +``` + +مثال بعدی با استفاده از `LEFT ARRAY JOIN` بند: + +``` sql +SELECT s, arr +FROM arrays_test +LEFT ARRAY JOIN arr; +``` + +``` text +┌─s───────────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +│ Goodbye │ 0 │ +└─────────────┴─────┘ +``` + +#### استفاده از نام مستعار {#using-aliases} + +یک نام مستعار می تواند برای مجموعه ای در `ARRAY JOIN` بند بند. در این مورد, یک مورد مجموعه ای را می توان با این نام مستعار دیده, اما مجموعه خود را با نام اصلی قابل دسترسی. مثال: + +``` sql +SELECT s, arr, a +FROM arrays_test +ARRAY JOIN arr AS a; +``` + +``` text +┌─s─────┬─arr─────┬─a─┐ +│ Hello │ [1,2] │ 1 │ +│ Hello │ [1,2] │ 2 │ +│ World │ [3,4,5] │ 3 │ +│ World │ [3,4,5] │ 4 │ +│ World │ [3,4,5] │ 5 │ +└───────┴─────────┴───┘ +``` + +با استفاده از نام مستعار, شما می توانید انجام `ARRAY JOIN` با یک مجموعه خارجی. به عنوان مثال: + +``` sql +SELECT s, arr_external +FROM arrays_test +ARRAY JOIN [1, 2, 3] AS arr_external; +``` + +``` text +┌─s───────────┬─arr_external─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ Hello │ 3 │ +│ World │ 1 │ +│ World │ 2 │ +│ World │ 3 │ +│ Goodbye │ 1 │ +│ Goodbye │ 2 │ +│ Goodbye │ 3 │ +└─────────────┴──────────────┘ +``` + +ارریس های متعدد را می توان با کاما از هم جدا در `ARRAY JOIN` بند بند. در این مورد, `JOIN` به طور همزمان (مجموع مستقیم و نه محصول دکارتی) انجام می شود. توجه داشته باشید که تمام ارریس باید به همان اندازه. مثال: + +``` sql +SELECT s, arr, a, num, mapped +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ +│ Hello │ [1,2] │ 1 │ 1 │ 2 │ +│ Hello │ [1,2] │ 2 │ 2 │ 3 │ +│ World │ [3,4,5] │ 3 │ 1 │ 4 │ +│ World │ [3,4,5] │ 4 │ 2 │ 5 │ +│ World │ [3,4,5] │ 5 │ 3 │ 6 │ +└───────┴─────────┴───┴─────┴────────┘ +``` + +مثال زیر از [شناسه بسته:](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) تابع: + +``` sql +SELECT s, arr, a, num, arrayEnumerate(arr) +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ +│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ +│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ +│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ +│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ +│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ +└───────┴─────────┴───┴─────┴─────────────────────┘ +``` + +#### مجموعه پیوستن با ساختار داده های تو در تو {#array-join-with-nested-data-structure} + +`ARRAY`پیوستن " همچنین با این نسخهها کار [ساختارهای داده تو در تو](../../sql-reference/data-types/nested-data-structures/nested.md). مثال: + +``` sql +CREATE TABLE nested_test +( + s String, + nest Nested( + x UInt8, + y UInt32) +) ENGINE = Memory; + +INSERT INTO nested_test +VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); +``` + +``` text +┌─s───────┬─nest.x──┬─nest.y─────┐ +│ Hello │ [1,2] │ [10,20] │ +│ World │ [3,4,5] │ [30,40,50] │ +│ Goodbye │ [] │ [] │ +└─────────┴─────────┴────────────┘ +``` + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +هنگام مشخص کردن نام ساختارهای داده های تو در تو در `ARRAY JOIN`, معنای همان است که `ARRAY JOIN` با تمام عناصر مجموعه ای که شامل. نمونه به شرح زیر است: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`, `nest.y`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +این تنوع نیز حس می کند: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─────┐ +│ Hello │ 1 │ [10,20] │ +│ Hello │ 2 │ [10,20] │ +│ World │ 3 │ [30,40,50] │ +│ World │ 4 │ [30,40,50] │ +│ World │ 5 │ [30,40,50] │ +└───────┴────────┴────────────┘ +``` + +نام مستعار ممکن است برای یک ساختار داده های تو در تو استفاده می شود, به منظور انتخاب هر دو `JOIN` نتیجه یا مجموعه منبع. مثال: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest AS n; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ +└───────┴─────┴─────┴─────────┴────────────┘ +``` + +نمونه ای از استفاده از [شناسه بسته:](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) تابع: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num +FROM nested_test +ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ +└───────┴─────┴─────┴─────────┴────────────┴─────┘ +``` + +### پیوستن بند {#select-join} + +می پیوندد داده ها در عادی [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) با عقل. + +!!! info "یادداشت" + نه مربوط به [ARRAY JOIN](#select-array-join-clause). + +``` sql +SELECT +FROM +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN +(ON )|(USING ) ... +``` + +نام جدول را می توان به جای مشخص `` و ``. این معادل است `SELECT * FROM table` خرده فروشی, به جز در یک مورد خاص زمانی که جدول است [پیوستن](../../engines/table-engines/special/join.md) engine – an array prepared for joining. + +#### انواع پشتیبانی شده از `JOIN` {#select-join-types} + +- `INNER JOIN` (یا `JOIN`) +- `LEFT JOIN` (یا `LEFT OUTER JOIN`) +- `RIGHT JOIN` (یا `RIGHT OUTER JOIN`) +- `FULL JOIN` (یا `FULL OUTER JOIN`) +- `CROSS JOIN` (یا `,` ) + +مشاهده استاندارد [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) توصیف. + +#### چند پیوستن {#multiple-join} + +انجام نمایش داده شد, بازنویسی کلیک خانه چند جدول می پیوندد به دنباله ای از دو جدول می پیوندد. مثلا, اگر چهار جدول برای عضویت کلیک خانه می پیوندد اول و دوم وجود دارد, سپس نتیجه می پیوندد با جدول سوم, و در مرحله گذشته, می پیوندد یک چهارم. + +اگر پرس و جو شامل `WHERE` بند ClickHouse تلاش می کند به pushdown فیلتر از این بند از طریق متوسط پیوستن به. اگر می تواند فیلتر به هر ملحق متوسط اعمال می شود, تاتر اعمال فیلتر بعد از همه می پیوندد به پایان رسید. + +ما توصیه می کنیم `JOIN ON` یا `JOIN USING` نحو برای ایجاد نمایش داده شد. به عنوان مثال: + +``` sql +SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a +``` + +شما می توانید لیست کاما از هم جدا از جداول در استفاده از `FROM` بند بند. به عنوان مثال: + +``` sql +SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a +``` + +این سینتکس را مخلوط نکنید. + +کلیکهاوس مستقیما از دستورات ارتباطی با کاما پشتیبانی نمی کند بنابراین توصیه نمی کنیم از انها استفاده کنید. الگوریتم تلاش می کند به بازنویسی پرس و جو از نظر `CROSS JOIN` و `INNER JOIN` بند و سپس به پرس و جو پردازش. هنگامی که بازنویسی پرس و جو, تاتر تلاش می کند برای بهینه سازی عملکرد و مصرف حافظه. به طور پیش فرض, تاتر رفتار کاما به عنوان یک `INNER JOIN` بند و تبدیل `INNER JOIN` به `CROSS JOIN` هنگامی که الگوریتم نمی تواند تضمین کند که `INNER JOIN` بازگرداندن اطلاعات مورد نیاز. + +#### سختی {#select-join-strictness} + +- `ALL` — If the right table has several matching rows, ClickHouse creates a [محصول دکارتی](https://en.wikipedia.org/wiki/Cartesian_product) از تطبیق ردیف. این استاندارد است `JOIN` رفتار در گذاشتن. +- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` و `ALL` کلمات کلیدی یکسان هستند. +- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` استفاده در زیر توضیح داده شده است. + +**از این رو پیوستن به استفاده** + +`ASOF JOIN` مفید است زمانی که شما نیاز به پیوستن به سوابق که هیچ بازی دقیق. + +جداول برای `ASOF JOIN` باید یک ستون توالی دستور داده اند. این ستون نمی تواند به تنهایی در یک جدول باشد و باید یکی از انواع داده ها باشد: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date` و `DateTime`. + +نحو `ASOF JOIN ... ON`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF LEFT JOIN table_2 +ON equi_cond AND closest_match_cond +``` + +شما می توانید هر تعداد از شرایط برابری و دقیقا یکی از نزدیک ترین شرایط بازی استفاده کنید. به عنوان مثال, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. + +شرایط پشتیبانی شده برای نزدیک ترین بازی: `>`, `>=`, `<`, `<=`. + +نحو `ASOF JOIN ... USING`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF JOIN table_2 +USING (equi_column1, ... equi_columnN, asof_column) +``` + +`ASOF JOIN` استفاده `equi_columnX` برای پیوستن به برابری و `asof_column` برای پیوستن به نزدیک ترین مسابقه با `table_1.asof_column >= table_2.asof_column` شرط. این `asof_column` ستون همیشه یکی از گذشته در `USING` بند بند. + +مثلا, جداول زیر را در نظر بگیرید: + +"’متن +table\_1 table\_2 + +رویداد \| عصر / رویداد فراسوی / عصر / شناسه diff --git a/docs/fa/sql-reference/statements/show.md b/docs/fa/sql-reference/statements/show.md new file mode 100644 index 00000000000..fd8a74ca50a --- /dev/null +++ b/docs/fa/sql-reference/statements/show.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: SHOW +--- + +# نمایش & پرسوجو {#show-queries} + +## SHOW CREATE TABLE {#show-create-table} + +``` sql +SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +بازگرداندن یک `String`- نوع ‘statement’ column, which contains a single value – the `CREATE` پرس و جو مورد استفاده برای ایجاد شی مشخص شده است. + +## SHOW DATABASES {#show-databases} + +``` sql +SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] +``` + +چاپ یک لیست از تمام پایگاه های داده. +این پرس و جو یکسان است `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. + +## SHOW PROCESSLIST {#show-processlist} + +``` sql +SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] +``` + +خروجی محتوای [سیستم.فرایندها](../../operations/system-tables.md#system_tables-processes) جدول, که شامل یک لیست از نمایش داده شد که در حال حاضر پردازش, به استثنای `SHOW PROCESSLIST` نمایش داده شد. + +این `SELECT * FROM system.processes` پرس و جو داده ها در مورد تمام نمایش داده شد در حال حاضر را برمی گرداند. + +نکته (اجرا در کنسول): + +``` bash +$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" +``` + +## SHOW TABLES {#show-tables} + +نمایش یک لیست از جداول. + +``` sql +SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +اگر `FROM` بند مشخص نشده است, پرس و جو لیستی از جداول گرداند از پایگاه داده فعلی. + +شما می توانید نتایج مشابه را دریافت کنید `SHOW TABLES` پرسوجو به روش زیر: + +``` sql +SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**مثال** + +پرس و جو زیر انتخاب دو ردیف اول از لیست جداول در `system` پایگاه داده, که نام حاوی `co`. + +``` sql +SHOW TABLES FROM system LIKE '%co%' LIMIT 2 +``` + +``` text +┌─name───────────────────────────┐ +│ aggregate_function_combinators │ +│ collations │ +└────────────────────────────────┘ +``` + +## SHOW DICTIONARIES {#show-dictionaries} + +نمایش یک لیست از [واژهنامهها خارجی](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +``` sql +SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +اگر `FROM` بند مشخص نشده است, پرس و جو لیستی از لغت نامه ها را برمی گرداند از پایگاه داده در حال حاضر. + +شما می توانید نتایج مشابه را دریافت کنید `SHOW DICTIONARIES` پرسوجو به روش زیر: + +``` sql +SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**مثال** + +پرس و جو زیر انتخاب دو ردیف اول از لیست جداول در `system` پایگاه داده, که نام حاوی `reg`. + +``` sql +SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 +``` + +``` text +┌─name─────────┐ +│ regions │ +│ region_names │ +└──────────────┘ +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/fa/sql-reference/statements/system.md b/docs/fa/sql-reference/statements/system.md new file mode 100644 index 00000000000..619a0b5c87c --- /dev/null +++ b/docs/fa/sql-reference/statements/system.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: SYSTEM +--- + +# نمایش داده شد سیستم {#query-language-system} + +- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) +- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) +- [DROP DNS CACHE](#query_language-system-drop-dns-cache) +- [DROP MARK CACHE](#query_language-system-drop-mark-cache) +- [FLUSH LOGS](#query_language-system-flush_logs) +- [RELOAD CONFIG](#query_language-system-reload-config) +- [SHUTDOWN](#query_language-system-shutdown) +- [KILL](#query_language-system-kill) +- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) +- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) +- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) +- [STOP MERGES](#query_language-system-stop-merges) +- [START MERGES](#query_language-system-start-merges) + +## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} + +بارگذاری مجدد تمام لغت نامه که با موفقیت قبل از لود شده است. +به طور پیش فرض, لغت نامه ها به صورت تنبلی لود (دیدن [\_بارگیری کامل](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), بنابراین به جای اینکه به طور خودکار در هنگام راه اندازی لود, در اولین دسترسی از طریق تابع دیکته مقداردهی اولیه و یا از جداول با موتور = فرهنگ لغت را انتخاب کنید. این `SYSTEM RELOAD DICTIONARIES` پرس و جو بارگذاری مجدد از جمله لغت نامه (لود شده). +همیشه باز می گردد `Ok.` صرف نظر از نتیجه به روز رسانی فرهنگ لغت. + +## بازخوانی لغتنامهها {#query_language-system-reload-dictionary} + +به طور کامل یک فرهنگ لغت را دوباره بارگذاری کنید `dictionary_name` بدون در نظر گرفتن دولت از فرهنگ لغت (لود / NOT\_LOADED / شکست خورده). +همیشه باز می گردد `Ok.` صرف نظر از نتیجه به روز رسانی فرهنگ لغت. +وضعیت فرهنگ لغت را می توان با پرس و جو بررسی کرد `system.dictionaries` جدول + +``` sql +SELECT name, status FROM system.dictionaries; +``` + +## DROP DNS CACHE {#query_language-system-drop-dns-cache} + +کش دی ان اس داخلی بازنشانی را کلیک کنید. گاهی اوقات (برای clickhouse نسخه) لازم است برای استفاده از این دستور هنگامی که در حال تغییر زیرساخت ها (تغییر آدرس ip دیگر clickhouse سرور یا سرور استفاده شده توسط لغت نامه). + +برای راحت تر (اتوماتیک) مدیریت کش دیدن disable\_internal\_dns\_cache, dns\_cache\_update\_period پارامترهای. + +## DROP MARK CACHE {#query_language-system-drop-mark-cache} + +بازنشانی کش علامت. مورد استفاده در توسعه تست های کلیک و عملکرد. + +## FLUSH LOGS {#query_language-system-flush_logs} + +Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. + +## RELOAD CONFIG {#query_language-system-reload-config} + +بارگذاری مجدد پیکربندی محل کلیک. استفاده می شود که پیکربندی در باغ وحش ذخیره می شود. + +## SHUTDOWN {#query_language-system-shutdown} + +به طور معمول خاموش کردن کلیک (مانند `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) + +## KILL {#query_language-system-kill} + +سقط فرایند کلیک (مانند `kill -9 {$ pid_clickhouse-server}`) + +## مدیریت جداول توزیع شده {#query-language-system-distributed} + +کلیک خانه می تواند مدیریت کند [توزیع شده](../../engines/table-engines/special/distributed.md) میز هنگامی که یک کاربر درج داده ها را به این جداول, خانه رعیتی برای اولین بار ایجاد یک صف از داده ها است که باید به گره های خوشه ای ارسال, سپس ناهمگام می فرستد. شما می توانید پردازش صف با مدیریت [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) و [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) نمایش داده شد. شما همچنین می توانید همزمان داده های توزیع شده را با `insert_distributed_sync` تنظیمات. + +### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} + +غیرفعال توزیع داده های پس زمینه در هنگام قرار دادن داده ها به جداول توزیع شده است. + +``` sql +SYSTEM STOP DISTRIBUTED SENDS [db.] +``` + +### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} + +نیروهای خانه را کلیک کنید برای ارسال داده ها به گره های خوشه همزمان. اگر هر گره در دسترس نیست, تاتر می اندازد یک استثنا و متوقف می شود اجرای پرس و جو. شما می توانید پرس و جو را دوباره امتحان کنید تا زمانی که موفق, که اتفاق خواهد افتاد زمانی که تمام گره ها در حال بازگشت. + +``` sql +SYSTEM FLUSH DISTRIBUTED [db.] +``` + +### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} + +توزیع داده های پس زمینه را هنگام قرار دادن داده ها به جداول توزیع می کند. + +``` sql +SYSTEM START DISTRIBUTED SENDS [db.] +``` + +### STOP MERGES {#query_language-system-stop-merges} + +فراهم می کند امکان متوقف ادغام پس زمینه برای جداول در خانواده ادغام: + +``` sql +SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +``` + +!!! note "یادداشت" + `DETACH / ATTACH` جدول پس زمینه ادغام برای جدول شروع خواهد شد حتی در صورتی که ادغام برای تمام جداول ادغام قبل از متوقف شده است. + +### START MERGES {#query_language-system-start-merges} + +فراهم می کند امکان شروع پس زمینه ادغام برای جداول در خانواده ادغام: + +``` sql +SYSTEM START MERGES [[db.]merge_tree_family_table_name] +``` + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/fa/sql-reference/syntax.md b/docs/fa/sql-reference/syntax.md new file mode 100644 index 00000000000..2efdc20bc0b --- /dev/null +++ b/docs/fa/sql-reference/syntax.md @@ -0,0 +1,187 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 31 +toc_title: "\u0646\u062D\u0648" +--- + +# نحو {#syntax} + +دو نوع تجزیه کننده در سیستم وجود دارد: تجزیه کننده کامل مربع (تجزیه کننده نزول بازگشتی) و تجزیه کننده فرمت داده (تجزیه کننده جریان سریع). +در تمام موارد به جز `INSERT` پرس و جو, تنها تجزیه کننده کامل گذاشتن استفاده شده است. +این `INSERT` پرس و جو از هر دو تجزیه کننده استفاده می کند: + +``` sql +INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') +``` + +این `INSERT INTO t VALUES` قطعه توسط تجزیه کننده کامل و داده ها تجزیه می شود `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` توسط تجزیه کننده جریان سریع تجزیه می شود. شما همچنین می توانید تجزیه کننده کامل برای داده ها با استفاده از [در حال خواندن:](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) تنظیمات. چه زمانی `input_format_values_interpret_expressions = 1` کلیک هاوس اول سعی می کند به تجزیه ارزش با تجزیه کننده جریان سریع. در صورت عدم موفقیت کلیک هاوس تلاش می کند تا از تجزیه کننده کامل برای داده ها استفاده کند و مانند یک مربع درمان شود [عبارت](#syntax-expressions). + +داده ها می توانند هر فرمت داشته باشند. هنگامی که یک پرس و جو را دریافت کرده است, سرور محاسبه بیش از [بیشینه\_کرکی\_سیز](../operations/settings/settings.md#settings-max_query_size) بایت از درخواست در رم (به طور پیش فرض, 1 مگابایت), و بقیه جریان تجزیه. +این به این معنی است که سیستم با مشکلات بزرگ ندارد `INSERT` نمایش داده شد, مانند خروجی زیر می کند. + +هنگام استفاده از `Values` قالب در یک `INSERT` پرس و جو, ممکن است به نظر می رسد که داده ها همان عبارات در تجزیه `SELECT` پرس و جو, اما این درست نیست. این `Values` فرمت بسیار محدود تر است. + +بعد ما تجزیه کننده کامل را پوشش خواهیم داد. برای کسب اطلاعات بیشتر در مورد تجزیه کننده فرمت, دیدن [فرشها](../interfaces/formats.md) بخش. + +## فاصلهها {#spaces} + +ممکن است هر تعداد از نمادهای فضایی بین سازه های نحوی (از جمله شروع و پایان پرس و جو) وجود دارد. علامت فضا شامل فضا, باریکه, خوراک خط, کروم, و خوراک فرم. + +## توضیحات {#comments} + +گذاشتن به سبک و ج سبک نظرات پشتیبانی می شوند. +گذاشتن به سبک نظرات: از `--` به انتهای خط فضای پس از `--` می توان حذف. +نظرات در ج سبک: از `/*` به `*/`. این نظرات می تواند چند خطی باشد. فضاهای اینجا مورد نیاز نیست, هم. + +## کلیدواژهها {#syntax-keywords} + +کلمات کلیدی حساس به حروف هستند که مربوط به: + +- استاندارد گذاشتن. به عنوان مثال, `SELECT`, `select` و `SeLeCt` همه معتبر هستند. +- پیاده سازی در برخی از پایگاه داده محبوب (خروجی زیر و یا پست). به عنوان مثال, `DateTime` همان است `datetime`. + +این که نام نوع داده حساس به حروف باشد را میتوان در `system.data_type_families` جدول + +در مقایسه با استاندارد گذاشتن تمام کلمات کلیدی دیگر (از جمله نام توابع) عبارتند از **حساس به حالت**. + +کلمات کلیدی محفوظ نیست (فقط به عنوان کلمات کلیدی در زمینه مربوطه تجزیه می شوند). در صورت استفاده [شناسهها](#syntax-identifiers) همان کلمات کلیدی را به نقل قول محصور. برای مثال پرس و جو `SELECT "FROM" FROM table_name` معتبر است اگر جدول `table_name` دارای ستون با نام `"FROM"`. + +## شناسهها {#syntax-identifiers} + +شناسه ها عبارتند از: + +- خوشه, پایگاه داده, جدول, پارتیشن و ستون نام. +- توابع. +- انواع داده ها. +- [نامگردانهای بیان](#syntax-expression_aliases). + +شناسه را می توان به نقل و یا غیر نقل. توصیه می شود از شناسه های غیر نقل قول استفاده کنید. + +شناسه های غیر نقل قول باید عبارت منظم مطابقت `^[a-zA-Z_][0-9a-zA-Z_]*$` و نمی تواند برابر باشد [کلیدواژهها](#syntax-keywords). مثالها: `x, _1, X_y__Z123_.` + +اگر شما می خواهید به استفاده از شناسه همان کلمات کلیدی و یا شما می خواهید به استفاده از نمادهای دیگر در شناسه, نقل قول با استفاده از دو نقل قول و یا پشت پرده, مثلا, `"id"`, `` `id` ``. + +## Literals {#literals} + +وجود دارد: عددی, رشته, ترکیب و `NULL` literals. + +### عددی {#numeric} + +تحت اللفظی عددی تلاش می کند به تجزیه شود: + +- برای اولین بار به عنوان یک شماره امضا 64 بیتی, با استفاده از [استرتول](https://en.cppreference.com/w/cpp/string/byte/strtoul) تابع. +- اگر ناموفق, به عنوان یک عدد بدون علامت 64 بیتی, با استفاده از [استرول](https://en.cppreference.com/w/cpp/string/byte/strtol) تابع. +- اگر ناموفق, به عنوان یک عدد شناور نقطه با استفاده از [رشته](https://en.cppreference.com/w/cpp/string/byte/strtof) تابع. +- در غیر این صورت, یک خطا بازگشته است. + +مقدار مربوطه کوچکترین نوع است که متناسب با ارزش داشته باشد. +مثلا, 1 به عنوان تجزیه `UInt8` اما 256 به عنوان تجزیه شده است `UInt16`. برای کسب اطلاعات بیشتر, دیدن [انواع داده ها](../sql-reference/data-types/index.md). + +مثالها: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. + +### رشته {#syntax-string-literal} + +فقط رشته های رشته ای در نقل قول های تک پشتیبانی می شوند. شخصیت های محصور می تواند بک اسلش فرار. توالی فرار زیر یک مقدار خاص مربوطه: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. در تمام موارد دیگر, فرار توالی در قالب `\c` کجا `c` است هر شخصیت, به تبدیل `c`. این به این معنی است که شما می توانید توالی استفاده کنید `\'`و`\\`. ارزش خواهد شد که [رشته](../sql-reference/data-types/string.md) نوع. + +حداقل مجموعه ای از شخصیت های که شما نیاز به فرار در لیتر رشته: `'` و `\`. نقل قول تنها را می توان با نقل قول تنها فرار, لیتر `'It\'s'` و `'It''s'` برابر هستند. + +### ترکیب {#compound} + +سازه ها برای ارریس پشتیبانی می شوند: `[1, 2, 3]` و تاپل: `(1, 'Hello, world!', 2)`.. +در واقع این نیست literals اما عبارات با آرایه ایجاد اپراتور و چند تایی ایجاد اپراتور بود. +مجموعه ای باید شامل حداقل یک مورد باشد و یک تاپل باید حداقل دو مورد داشته باشد. +تاپل یک هدف خاص برای استفاده در `IN` بند یک `SELECT` پرس و جو. توپلس می تواند به عنوان نتیجه یک پرس و جو به دست, اما نمی توان به یک پایگاه داده ذخیره (به غیر از [حافظه](../engines/table-engines/special/memory.md) جدول). + +### NULL {#null-literal} + +نشان می دهد که ارزش از دست رفته است. + +به منظور ذخیره `NULL` در یک میدان جدول باید از [Nullable](../sql-reference/data-types/nullable.md) نوع. + +بسته به فرمت داده (ورودی یا خروجی), `NULL` ممکن است نمایندگی های مختلف. برای کسب اطلاعات بیشتر, اسناد و مدارک برای دیدن [قالبهای داده](../interfaces/formats.md#formats). + +بسیاری از تفاوت های ظریف برای پردازش وجود دارد `NULL`. مثلا, اگر حداقل یکی از استدلال از یک عملیات مقایسه است `NULL` نتیجه این عملیات نیز خواهد بود `NULL`. همان درست است برای ضرب است, بعلاوه, و عملیات دیگر. برای کسب اطلاعات بیشتر, خواندن اسناد و مدارک برای هر عملیات. + +در نمایش داده شد, شما می توانید بررسی کنید `NULL` با استفاده از [IS NULL](operators.md#operator-is-null) و [IS NOT NULL](operators.md) اپراتورها و توابع مرتبط `isNull` و `isNotNull`. + +## توابع {#functions} + +توابع مانند یک شناسه با یک لیست از استدلال نوشته شده (احتمالا خالی) در داخل پرانتز. در مقابل به گذاشتن استاندارد, براکت مورد نیاز است, حتی برای یک لیست استدلال خالی. مثال: `now()`. +توابع منظم و جمع وجود دارد (بخش را ببینید “Aggregate functions”). برخی از توابع دانه می تواند شامل دو لیست از استدلال در براکت. مثال: `quantile (0.9) (x)`. این توابع مجموع نامیده می شوند “parametric” توابع, و استدلال در لیست اول نامیده می شوند “parameters”. نحو توابع کل بدون پارامتر همان است که برای توابع به طور منظم است. + +## اپراتورها {#operators} + +اپراتورها در حال تبدیل به توابع مربوط به خود را طی پرس و جو و تجزیه گرفتن اولویت خود را و associativity به حساب آورد. +برای مثال بیان `1 + 2 * 3 + 4` تبدیل به `plus(plus(1, multiply(2, 3)), 4)`. + +## انواع داده ها و موتورهای جدول پایگاه داده {#data_types-and-database-table-engines} + +انواع داده ها و موتورهای جدول در `CREATE` پرس و جو به همان شیوه به عنوان شناسه و یا توابع نوشته شده است. به عبارت دیگر, ممکن است یا ممکن است حاوی یک لیست استدلال در براکت نیست. برای کسب اطلاعات بیشتر به بخش ها مراجعه کنید “Data types,” “Table engines,” و “CREATE”. + +## نامگردانهای بیان {#syntax-expression_aliases} + +نام مستعار یک نام تعریف شده توسط کاربر برای بیان در پرس و جو است. + +``` sql +expr AS alias +``` + +- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` بند بدون استفاده از `AS` کلمه کلیدی. + + For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. + + In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. + +- `expr` — Any expression supported by ClickHouse. + + For example, `SELECT column_name * 2 AS double FROM some_table`. + +- `alias` — Name for `expr`. نام مستعار باید با پیروی از [شناسهها](#syntax-identifiers) نحو. + + For example, `SELECT "table t".column_name FROM table_name AS "table t"`. + +### نکاتی در مورد استفاده {#notes-on-usage} + +نام مستعار جهانی برای یک پرس و جو و یا زیرخاکی هستند و شما می توانید یک نام مستعار در هر بخشی از یک پرس و جو برای هر بیان تعریف. به عنوان مثال, `SELECT (1 AS n) + 2, n`. + +نام مستعار قابل مشاهده نیست در subqueries و بین subqueries. مثلا, در حالی که اجرای پرس و جو `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` تاتر استثنا را تولید می کند `Unknown identifier: num`. + +اگر یک نام مستعار برای ستون نتیجه در تعریف `SELECT` بند یک خرده فروشی, این ستون ها در پرس و جو بیرونی قابل مشاهده هستند. به عنوان مثال, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. + +مراقب باشید با نام مستعار است که همان نام ستون یا جدول می باشد. بیایید مثال زیر را در نظر بگیریم: + +``` sql +CREATE TABLE t +( + a Int, + b Int +) +ENGINE = TinyLog() +``` + +``` sql +SELECT + argMax(a, b), + sum(b) AS b +FROM t +``` + +``` text +Received exception from server (version 18.14.17): +Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. +``` + +در این مثال ما اعلام جدول `t` با ستون `b`. سپس, در هنگام انتخاب داده, ما تعریف `sum(b) AS b` نام مستعار. به عنوان نام مستعار جهانی هستند, خانه را جایگزین تحت اللفظی `b` در عبارت `argMax(a, b)` با بیان `sum(b)`. این جایگزینی باعث استثنا. + +## ستاره {#asterisk} + +در یک `SELECT` پرس و جو, ستاره می تواند عبارت جایگزین. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “SELECT”. + +## عبارتها {#syntax-expressions} + +بیان یک تابع است, شناسه, تحت اللفظی, استفاده از یک اپراتور, بیان در داخل پرانتز, خرده فروشی, یا ستاره. همچنین می تواند شامل یک نام مستعار. +لیستی از عبارات یک یا چند عبارت از هم جدا شده توسط کاما است. +توابع و اپراتورهای, به نوبه خود, می توانید عبارات به عنوان استدلال دارند. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/fa/sql-reference/table-functions/file.md b/docs/fa/sql-reference/table-functions/file.md new file mode 100644 index 00000000000..65883b3e547 --- /dev/null +++ b/docs/fa/sql-reference/table-functions/file.md @@ -0,0 +1,121 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u067E\u0631\u0648\u0646\u062F\u0647" +--- + +# پرونده {#file} + +ایجاد یک جدول از یک فایل. این تابع جدول شبیه به [نشانی وب](url.md) و [hdfs](hdfs.md) یکی + +``` sql +file(path, format, structure) +``` + +**پارامترهای ورودی** + +- `path` — The relative path to the file from [\_مخفی کردن \_صفحه](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_files_path). مسیر به فایل پشتیبانی پس از دل تنگی در حالت فقط خواندنی: `*`, `?`, `{abc,def}` و `{N..M}` کجا `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [قالب](../../interfaces/formats.md#formats) پرونده +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**مقدار بازگشتی** + +یک جدول با ساختار مشخص شده برای خواندن یا نوشتن داده ها در فایل مشخص شده است. + +**مثال** + +تنظیم `user_files_path` و محتویات فایل `test.csv`: + +``` bash +$ grep user_files_path /etc/clickhouse-server/config.xml + /var/lib/clickhouse/user_files/ + +$ cat /var/lib/clickhouse/user_files/test.csv + 1,2,3 + 3,2,1 + 78,43,45 +``` + +جدول از`test.csv` و انتخاب دو ردیف اول: + +``` sql +SELECT * +FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +``` sql +-- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file +SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 +``` + +**دل تنگی در مسیر** + +اجزای مسیر چندگانه می تواند دل تنگی دارند. برای پردازش فایل باید وجود داشته باشد و مسابقات به الگوی کل مسیر (نه تنها پسوند یا پیشوند). + +- `*` — Substitutes any number of any characters except `/` از جمله رشته خالی. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +سازه با `{}` شبیه به [عملکرد جدول از راه دور](../../sql-reference/table-functions/remote.md)). + +**مثال** + +1. فرض کنید ما چندین فایل با مسیرهای نسبی زیر داریم: + +- ‘some\_dir/some\_file\_1’ +- ‘some\_dir/some\_file\_2’ +- ‘some\_dir/some\_file\_3’ +- ‘another\_dir/some\_file\_1’ +- ‘another\_dir/some\_file\_2’ +- ‘another\_dir/some\_file\_3’ + +1. پرس و جو مقدار ردیف در این فایل ها: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. پرس و جو مقدار ردیف در تمام فایل های این دو دایرکتوری: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "اخطار" + اگر لیست خود را از فایل های حاوی محدوده تعداد با صفر پیشرو, استفاده از ساخت و ساز با پرانتز برای هر رقم به طور جداگانه و یا استفاده `?`. + +**مثال** + +پرس و جو داده ها از فایل های به نام `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## ستونهای مجازی {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**همچنین نگاه کنید به** + +- [مجازی ستون](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/fa/sql_reference/table_functions/generate.md b/docs/fa/sql-reference/table-functions/generate.md similarity index 100% rename from docs/fa/sql_reference/table_functions/generate.md rename to docs/fa/sql-reference/table-functions/generate.md diff --git a/docs/fa/sql-reference/table-functions/hdfs.md b/docs/fa/sql-reference/table-functions/hdfs.md new file mode 100644 index 00000000000..0f90031dd80 --- /dev/null +++ b/docs/fa/sql-reference/table-functions/hdfs.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: hdfs +--- + +# hdfs {#hdfs} + +ایجاد یک جدول از فایل ها در اچ دی. این جدول عملکرد شبیه به [نشانی وب](url.md) و [پرونده](file.md) یکی + +``` sql +hdfs(URI, format, structure) +``` + +**پارامترهای ورودی** + +- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` و `{N..M}` کجا `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [قالب](../../interfaces/formats.md#formats) پرونده +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**مقدار بازگشتی** + +یک جدول با ساختار مشخص شده برای خواندن یا نوشتن داده ها در فایل مشخص شده است. + +**مثال** + +جدول از `hdfs://hdfs1:9000/test` و انتخاب دو ردیف اول: + +``` sql +SELECT * +FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +**دل تنگی در مسیر** + +اجزای مسیر چندگانه می تواند دل تنگی دارند. برای پردازش فایل باید وجود داشته باشد و مسابقات به الگوی کل مسیر (نه تنها پسوند یا پیشوند). + +- `*` — Substitutes any number of any characters except `/` از جمله رشته خالی. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +سازه با `{}` شبیه به [عملکرد جدول از راه دور](../../sql-reference/table-functions/remote.md)). + +**مثال** + +1. فرض کنید که ما چندین فایل با اوریس زیر در اچ دی ها داریم: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. پرس و جو مقدار ردیف در این فایل ها: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. پرس و جو مقدار ردیف در تمام فایل های این دو دایرکتوری: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "اخطار" + اگر لیست خود را از فایل های حاوی محدوده تعداد با صفر پیشرو, استفاده از ساخت و ساز با پرانتز برای هر رقم به طور جداگانه و یا استفاده `?`. + +**مثال** + +پرس و جو داده ها از فایل های به نام `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## ستونهای مجازی {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**همچنین نگاه کنید به** + +- [ستونهای مجازی](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/fa/sql-reference/table-functions/index.md b/docs/fa/sql-reference/table-functions/index.md new file mode 100644 index 00000000000..a639bab05bd --- /dev/null +++ b/docs/fa/sql-reference/table-functions/index.md @@ -0,0 +1,38 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Table Functions +toc_priority: 34 +toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" +--- + +# توابع جدول {#table-functions} + +توابع جدول روش برای ساخت جداول. + +شما می توانید توابع جدول در استفاده: + +- [FROM](../statements/select.md#select-from) بند از `SELECT` پرس و جو. + + The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. + +- [ایجاد جدول به عنوان \](../statements/create.md#create-table-query) پرس و جو. + + It's one of the methods of creating a table. + +!!! warning "اخطار" + شما می توانید توابع جدول اگر استفاده نمی [اجازه دادن به \_نشانی](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) تنظیم غیر فعال است. + +| تابع | توصیف | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------| +| [پرونده](file.md) | ایجاد یک [پرونده](../../engines/table-engines/special/file.md)- جدول موتور. | +| [ادغام](merge.md) | ایجاد یک [ادغام](../../engines/table-engines/special/merge.md)- جدول موتور. | +| [اعداد](numbers.md) | ایجاد یک جدول با یک ستون پر از اعداد صحیح. | +| [دور](remote.md) | اجازه می دهد تا شما را به دسترسی به سرور از راه دور بدون ایجاد یک [توزیع شده](../../engines/table-engines/special/distributed.md)- جدول موتور. | +| [نشانی وب](url.md) | ایجاد یک [نشانی وب](../../engines/table-engines/special/url.md)- جدول موتور. | +| [خروجی زیر](mysql.md) | ایجاد یک [MySQL](../../engines/table-engines/integrations/mysql.md)- جدول موتور. | +| [جستجو](jdbc.md) | ایجاد یک [JDBC](../../engines/table-engines/integrations/jdbc.md)- جدول موتور. | +| [جستجو](odbc.md) | ایجاد یک [ODBC](../../engines/table-engines/integrations/odbc.md)- جدول موتور. | +| [hdfs](hdfs.md) | ایجاد یک [HDFS](../../engines/table-engines/integrations/hdfs.md)- جدول موتور. | + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/fa/sql_reference/table_functions/input.md b/docs/fa/sql-reference/table-functions/input.md similarity index 100% rename from docs/fa/sql_reference/table_functions/input.md rename to docs/fa/sql-reference/table-functions/input.md diff --git a/docs/fa/sql_reference/table_functions/jdbc.md b/docs/fa/sql-reference/table-functions/jdbc.md similarity index 100% rename from docs/fa/sql_reference/table_functions/jdbc.md rename to docs/fa/sql-reference/table-functions/jdbc.md diff --git a/docs/fa/sql_reference/table_functions/merge.md b/docs/fa/sql-reference/table-functions/merge.md similarity index 100% rename from docs/fa/sql_reference/table_functions/merge.md rename to docs/fa/sql-reference/table-functions/merge.md diff --git a/docs/fa/sql-reference/table-functions/mysql.md b/docs/fa/sql-reference/table-functions/mysql.md new file mode 100644 index 00000000000..7455ec398df --- /dev/null +++ b/docs/fa/sql-reference/table-functions/mysql.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 42 +toc_title: "\u062E\u0631\u0648\u062C\u06CC \u0632\u06CC\u0631" +--- + +# خروجی زیر {#mysql} + +اجازه می دهد `SELECT` نمایش داده شد به داده است که بر روی یک سرور خروجی از راه دور ذخیره می شود انجام می شود. + +``` sql +mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +**پارامترها** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` نمایش داده شد به `REPLACE INTO`. اگر `replace_query=1`, پرس و جو جایگزین شده است. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` بیان است که به اضافه `INSERT` پرس و جو. + + Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. + + To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. + +ساده `WHERE` بند هایی مانند `=, !=, >, >=, <, <=` در حال حاضر بر روی سرور خروجی زیر اجرا شده است. + +بقیه شرایط و `LIMIT` محدودیت نمونه برداری در محل کلیک تنها پس از پرس و جو به پس از اتمام خروجی زیر اجرا شده است. + +**مقدار بازگشتی** + +یک شی جدول با ستون همان جدول خروجی زیر اصلی. + +## مثال طریقه استفاده {#usage-example} + +جدول در خروجی زیر: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +انتخاب داده ها از خانه کلیک: + +``` sql +SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## همچنین نگاه کنید به {#see-also} + +- [این ‘MySQL’ موتور جدول](../../engines/table-engines/integrations/mysql.md) +- [با استفاده از خروجی زیر به عنوان منبع فرهنگ لغت خارجی](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/fa/sql_reference/table_functions/numbers.md b/docs/fa/sql-reference/table-functions/numbers.md similarity index 100% rename from docs/fa/sql_reference/table_functions/numbers.md rename to docs/fa/sql-reference/table-functions/numbers.md diff --git a/docs/fa/sql-reference/table-functions/odbc.md b/docs/fa/sql-reference/table-functions/odbc.md new file mode 100644 index 00000000000..7efbeea28eb --- /dev/null +++ b/docs/fa/sql-reference/table-functions/odbc.md @@ -0,0 +1,108 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 44 +toc_title: "\u062C\u0633\u062A\u062C\u0648" +--- + +# جستجو {#table-functions-odbc} + +بازگرداندن جدول است که از طریق متصل [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +``` sql +odbc(connection_settings, external_database, external_table) +``` + +پارامترها: + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` پرونده. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +با خیال راحت پیاده سازی اتصالات ان بی سی, تاتر با استفاده از یک برنامه جداگانه `clickhouse-odbc-bridge`. اگر راننده او بی سی به طور مستقیم از لود `clickhouse-server`, مشکلات راننده می تواند سرور تاتر سقوط. تاتر به طور خودکار شروع می شود `clickhouse-odbc-bridge` هنگامی که مورد نیاز است. برنامه پل او بی سی از همان بسته به عنوان نصب `clickhouse-server`. + +زمینه های با `NULL` مقادیر از جدول خارجی به مقادیر پیش فرض برای نوع داده پایه تبدیل می شوند. مثلا, اگر یک میدان جدول خروجی زیر از راه دور است `INT NULL` نوع این است که به 0 تبدیل (مقدار پیش فرض برای کلیک `Int32` نوع داده). + +## مثال طریقه استفاده {#usage-example} + +**گرفتن اطلاعات از نصب و راه اندازی خروجی زیر محلی از طریق ان بی سی** + +این مثال برای لینوکس اوبونتو 18.04 و سرور خروجی زیر 5.7 بررسی می شود. + +اطمینان حاصل شود که unixodbc و mysql اتصال نصب شده است. + +به طور پیش فرض (در صورت نصب از بسته), کلیک خانه شروع می شود به عنوان کاربر `clickhouse`. بنابراین شما نیاز به ایجاد و پیکربندی این کاربر در سرور خروجی زیر. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +سپس اتصال را پیکربندی کنید `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +شما می توانید اتصال با استفاده از بررسی `isql` ابزار از unixODBC نصب و راه اندازی. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +جدول در خروجی زیر: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +بازیابی اطلاعات از جدول خروجی زیر در کلیک: + +``` sql +SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ 0 │ 2 │ 0 │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## همچنین نگاه کنید به {#see-also} + +- [لغت نامه های خارجی ان بی سی](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [موتور جدول ان بی سی](../../engines/table-engines/integrations/odbc.md). + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/fa/sql-reference/table-functions/remote.md b/docs/fa/sql-reference/table-functions/remote.md new file mode 100644 index 00000000000..cf490a936a9 --- /dev/null +++ b/docs/fa/sql-reference/table-functions/remote.md @@ -0,0 +1,83 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u062F\u0648\u0631" +--- + +# از راه دور remoteSecure {#remote-remotesecure} + +اجازه می دهد تا شما را به دسترسی به سرور از راه دور بدون ایجاد یک `Distributed` جدول + +امضاها: + +``` sql +remote('addresses_expr', db, table[, 'user'[, 'password']]) +remote('addresses_expr', db.table[, 'user'[, 'password']]) +``` + +`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` یا فقط `host`. میزبان را می توان به عنوان نام سرور مشخص, و یا به عنوان ایپو4 یا ایپو6 نشانی. نشانی اینترنتی6 در براکت مربع مشخص شده است. پورت پورت تی سی پی بر روی سرور از راه دور است. اگر پورت حذف شده است, با استفاده از `tcp_port` از فایل پیکربندی سرور (به طور پیش فرض, 9000). + +!!! important "مهم" + پورت برای یک نشانی اینترنتی6 مورد نیاز است. + +مثالها: + +``` text +example01-01-1 +example01-01-1:9000 +localhost +127.0.0.1 +[::]:9000 +[2a02:6b8:0:1111::11]:9000 +``` + +نشانی های متعدد را می توان با کاما از هم جدا شده است. در این مورد کلیک هاوس از پردازش توزیع شده استفاده می کند بنابراین پرس و جو را به تمام نشانیهای مشخص شده ارسال می کند (مانند داده های مختلف). + +مثال: + +``` text +example01-01-1,example01-02-1 +``` + +بخشی از بیان را می توان در براکت فرفری مشخص شده است. مثال قبلی را می توان به شرح زیر نوشته شده است: + +``` text +example01-0{1,2}-1 +``` + +براکت فرفری می تواند شامل طیف وسیعی از اعداد جدا شده توسط دو نقطه (اعداد صحیح غیر منفی). در این مورد, محدوده به مجموعه ای از ارزش هایی که تولید نشانی سفال گسترش. اگر عدد اول با صفر شروع می شود, ارزش ها با همان تراز صفر تشکیل. مثال قبلی را می توان به شرح زیر نوشته شده است: + +``` text +example01-{01..02}-1 +``` + +اگر شما جفت های متعدد از براکت در اشکال مختلف, این تولید محصول مستقیم از مجموعه مربوطه. + +نشانی ها و بخش هایی از نشانی در براکت فرفری را می توان با نماد لوله جدا (\|). در این مورد, مجموعه مربوطه را از نشانی ها به عنوان کپی تفسیر, و پرس و جو خواهد شد به اولین ماکت سالم ارسال. با این حال, کپی در نظم در حال حاضر در مجموعه تکرار [\_تبالسازی](../../operations/settings/settings.md) تنظیمات. + +مثال: + +``` text +example01-{01..02}-{1|2} +``` + +این مثال دو تکه که هر کدام دو کپی مشخص. + +تعدادی از آدرس های تولید شده محدود است توسط یک ثابت است. در حال حاضر این 1000 نشانی است. + +با استفاده از `remote` تابع جدول کمتر مطلوب تر از ایجاد یک است `Distributed` جدول, چرا که در این مورد, اتصال سرور دوباره تاسیس برای هر درخواست. علاوه بر این, اگر نام میزبان قرار است, نام حل و فصل, و خطا شمارش نیست در هنگام کار با کپی های مختلف. هنگامی که پردازش تعداد زیادی از نمایش داده شد, همیشه ایجاد `Distributed` جدول جلوتر از زمان, و استفاده نکنید `remote` تابع جدول. + +این `remote` تابع جدول می تواند در موارد زیر مفید باشد: + +- دسترسی به یک سرور خاص برای مقایسه داده ها, اشکال زدایی, و تست. +- نمایش داده شد بین خوشه های مختلف کلیک برای اهداف تحقیقاتی. +- درخواست توزیع نادر است که به صورت دستی ساخته شده. +- درخواست توزیع شده که مجموعه ای از سرورها در هر زمان دوباره تعریف شده است. + +اگر کاربر مشخص نشده است, `default` استفاده شده است. +اگر رمز عبور مشخص نشده است, رمز عبور خالی استفاده شده است. + +`remoteSecure` - مثل `remote` but with secured connection. Default port — [\_شروع مجدد](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) از پیکربندی و یا 9440. + +[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/fa/sql_reference/table_functions/url.md b/docs/fa/sql-reference/table-functions/url.md similarity index 100% rename from docs/fa/sql_reference/table_functions/url.md rename to docs/fa/sql-reference/table-functions/url.md diff --git a/docs/fa/sql_reference/aggregate_functions/combinators.md b/docs/fa/sql_reference/aggregate_functions/combinators.md deleted file mode 100644 index 6c2450904fd..00000000000 --- a/docs/fa/sql_reference/aggregate_functions/combinators.md +++ /dev/null @@ -1,167 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u062A\u0631\u06A9\u06CC\u0628 \u06A9\u0646\u0646\u062F\u0647\u0647\u0627\ - \u06CC \u062A\u0627\u0628\u0639 \u062C\u0645\u0639" ---- - -# ترکیب کنندههای تابع جمع {#aggregate_functions_combinators} - -نام یک تابع جمع می تواند یک پسوند اضافه شده است. این تغییر راه تابع کلی کار می کند. - -## - اگر {#agg-functions-combinator-if} - -The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). - -مثالها: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` و به همین ترتیب. - -با توابع مجموع شرطی, شما می توانید مصالح برای چندین شرایط در یک بار محاسبه, بدون استفاده از کارخانه های فرعی و `JOIN`برای مثال در یاندکس.متریکا, توابع مجموع مشروط استفاده می شود برای پیاده سازی قابلیت مقایسه بخش. - -## حداقل صفحه نمایش: {#agg-functions-combinator-array} - -پسوند مجموعه را می توان به هر تابع جمع اضافه شده است. در این مورد, تابع کل استدلال از طول می کشد ‘Array(T)’ نوع (ارریس) به جای ‘T’ استدلال نوع. اگر تابع جمع استدلال های متعدد را می پذیرد, این باید مجموعه ای از طول های برابر شود. هنگامی که پردازش ارریس, تابع کل کار می کند مانند تابع کل اصلی در تمام عناصر مجموعه. - -مثال 1: `sumArray(arr)` - مجموع تمام عناصر از همه ‘arr’ اراریس در این مثال می توانست بیشتر به سادگی نوشته شده است: `sum(arraySum(arr))`. - -مثال 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ اراریس این می تواند انجام شود یک راه ساده تر: `uniq(arrayJoin(arr))` اما همیشه امکان اضافه کردن وجود ندارد ‘arrayJoin’ به پرس و جو. - -\- اگر و مجموعه ای می تواند ترکیب شود. هرچند, ‘Array’ پس اول باید بیای ‘If’. مثالها: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. با توجه به این سفارش ‘cond’ برهان صف نیست. - -## - وضعیت {#agg-functions-combinator-state} - -اگر شما درخواست این ترکیب, تابع کل می کند مقدار حاصل بازگشت نیست (مانند تعدادی از ارزش های منحصر به فرد برای [uniq](reference.md#agg_function-uniq) تابع) , اما یک دولت متوسط از تجمع (برای `uniq`, این جدول هش برای محاسبه تعداد ارزش های منحصر به فرد است). این یک `AggregateFunction(...)` که می تواند برای پردازش بیشتر استفاده می شود و یا ذخیره شده در یک جدول را به پایان برساند جمع بعد. - -برای کار با این کشورها, استفاده: - -- [ریزدانه](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) موتور جدول. -- [پلاکتی](../../sql_reference/functions/other_functions.md#function-finalizeaggregation) تابع. -- [خرابی اجرا](../../sql_reference/functions/other_functions.md#function-runningaccumulate) تابع. -- [- ادغام](#aggregate_functions_combinators_merge) ترکیب کننده. -- [اطلاعات دقیق](#aggregate_functions_combinators_mergestate) ترکیب کننده. - -## - ادغام {#aggregate_functions_combinators-merge} - -اگر شما درخواست این ترکیب, تابع کل طول می کشد حالت تجمع متوسط به عنوان یک استدلال, ترکیبی از کشورهای به پایان تجمع, و ارزش حاصل می گرداند. - -## اطلاعات دقیق {#aggregate_functions_combinators-mergestate} - -ادغام کشورهای تجمع متوسط در همان راه به عنوان ترکیب-ادغام. با این حال, این مقدار حاصل بازگشت نیست, اما یک دولت تجمع متوسط, شبیه به ترکیب دولت. - -## - فورچ {#agg-functions-combinator-foreach} - -تبدیل یک تابع جمع برای جداول به یک تابع کلی برای ارریس که جمع اقلام مجموعه مربوطه و مجموعه ای از نتایج را برمی گرداند. به عنوان مثال, `sumForEach` برای ارریس `[1, 2]`, `[3, 4, 5]`و`[6, 7]`نتیجه را برمی گرداند `[10, 13, 5]` پس از اضافه کردن با هم موارد مجموعه مربوطه. - -## شناسه بسته: {#agg-functions-combinator-ordefault} - -پر مقدار پیش فرض از نوع بازگشت تابع جمع است اگر چیزی برای جمع وجود دارد. - -``` sql -SELECT avg(number), avgOrDefault(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrDefault(number)─┐ -│ nan │ 0 │ -└─────────────┴──────────────────────┘ -``` - -## اطلاعات دقیق {#agg-functions-combinator-ornull} - -پر `null` در صورتی که هیچ چیز به جمع وجود دارد. ستون بازگشت قابل ابطال خواهد بود. - -``` sql -SELECT avg(number), avgOrNull(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrNull(number)─┐ -│ nan │ ᴺᵁᴸᴸ │ -└─────────────┴───────────────────┘ -``` - --OrDefault و OrNull می تواند در ترکیب با دیگر combinators. این زمانی مفید است که تابع جمع می کند ورودی خالی را قبول نمی کند. - -``` sql -SELECT avgOrNullIf(x, x > 10) -FROM -( - SELECT toDecimal32(1.23, 2) AS x -) -``` - -``` text -┌─avgOrNullIf(x, greater(x, 10))─┐ -│ ᴺᵁᴸᴸ │ -└────────────────────────────────┘ -``` - -## - نمونه {#agg-functions-combinator-resample} - -به شما امکان می دهد داده ها را به گروه تقسیم کنید و سپس به طور جداگانه داده ها را در این گروه ها جمع کنید. گروه ها با تقسیم مقادیر از یک ستون به فواصل ایجاد شده است. - -``` sql -Resample(start, end, step)(, resampling_key) -``` - -**پارامترها** - -- `start` — Starting value of the whole required interval for `resampling_key` ارزشهای خبری عبارتند از: -- `stop` — Ending value of the whole required interval for `resampling_key` ارزشهای خبری عبارتند از: کل فاصله شامل نمی شود `stop` مقدار `[start, stop)`. -- `step` — Step for separating the whole interval into subintervals. The `aggFunction` بیش از هر یک از این زیرگروه اعدام به طور مستقل. -- `resampling_key` — Column whose values are used for separating data into intervals. -- `aggFunction_params` — `aggFunction` پارامترها - -**مقادیر بازگشتی** - -- مجموعه ای از `aggFunction` نتایج جستجو برای هر subinterval. - -**مثال** - -در نظر بگیرید که `people` جدول با داده های زیر: - -``` text -┌─name───┬─age─┬─wage─┐ -│ John │ 16 │ 10 │ -│ Alice │ 30 │ 15 │ -│ Mary │ 35 │ 8 │ -│ Evelyn │ 48 │ 11.5 │ -│ David │ 62 │ 9.9 │ -│ Brian │ 60 │ 16 │ -└────────┴─────┴──────┘ -``` - -بیایید نام افرادی که سن نهفته در فواصل `[30,60)` و `[60,75)`. پس ما با استفاده از نمایندگی عدد صحیح برای سن, ما سنین در `[30, 59]` و `[60,74]` فواصل زمانی. - -به نام کلی در مجموعه, ما با استفاده از [گرامری](reference.md#agg_function-grouparray) تابع جمع. طول می کشد تا یک استدلال. در مورد ما این است `name` ستون. این `groupArrayResample` تابع باید از `age` ستون به نام دانه های سن. برای تعریف فواصل مورد نیاز ما `30, 75, 30` نشانوندها به `groupArrayResample` تابع. - -``` sql -SELECT groupArrayResample(30, 75, 30)(name, age) FROM people -``` - -``` text -┌─groupArrayResample(30, 75, 30)(name, age)─────┐ -│ [['Alice','Mary','Evelyn'],['David','Brian']] │ -└───────────────────────────────────────────────┘ -``` - -در نظر گرفتن نتایج. - -`Jonh` خارج از نمونه است چرا که او بیش از حد جوان است. افراد دیگر با توجه به فواصل زمانی مشخص شده توزیع می شوند. - -حالا اجازه دهید تعداد کل مردم و متوسط دستمزد خود را در فواصل سنی مشخص شده است. - -``` sql -SELECT - countResample(30, 75, 30)(name, age) AS amount, - avgResample(30, 75, 30)(wage, age) AS avg_wage -FROM people -``` - -``` text -┌─amount─┬─avg_wage──────────────────┐ -│ [3,2] │ [11.5,12.949999809265137] │ -└────────┴───────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/fa/sql_reference/aggregate_functions/index.md b/docs/fa/sql_reference/aggregate_functions/index.md deleted file mode 100644 index 6442dddedd2..00000000000 --- a/docs/fa/sql_reference/aggregate_functions/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Aggregate Functions -toc_priority: 33 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# توابع مجموع {#aggregate-functions} - -توابع مجموع در کار [عادی](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) راه به عنوان کارشناسان پایگاه داده انتظار می رود. - -فاحشه خانه نیز پشتیبانی می کند: - -- [توابع مجموع پارامتری](parametric_functions.md#aggregate_functions_parametric), که قبول پارامترهای دیگر علاوه بر ستون. -- [ترکیب کنندهها](combinators.md#aggregate_functions_combinators) که تغییر رفتار مجموع توابع. - -## پردازش پوچ {#null-processing} - -در طول تجمع همه `NULL`بازدید کنندگان قلم می. - -**مثالها:** - -این جدول را در نظر بگیرید: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -بیایید می گویند شما نیاز به کل ارزش ها در `y` ستون: - -``` sql -SELECT sum(y) FROM t_null_big -``` - - ┌─sum(y)─┐ - │ 7 │ - └────────┘ - -این `sum` تابع تفسیر می کند `NULL` به عنوان `0`. به خصوص, این بدان معنی است که اگر تابع ورودی از یک انتخاب که تمام مقادیر دریافت `NULL` سپس نتیجه خواهد بود `0` نه `NULL`. - -حالا شما می توانید استفاده کنید `groupArray` تابع برای ایجاد مجموعه ای از `y` ستون: - -``` sql -SELECT groupArray(y) FROM t_null_big -``` - -``` text -┌─groupArray(y)─┐ -│ [2,2,3] │ -└───────────────┘ -``` - -`groupArray` شامل نمی شود `NULL` در مجموعه ای نتیجه. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/fa/sql_reference/aggregate_functions/parametric_functions.md b/docs/fa/sql_reference/aggregate_functions/parametric_functions.md deleted file mode 100644 index 3a45a615e07..00000000000 --- a/docs/fa/sql_reference/aggregate_functions/parametric_functions.md +++ /dev/null @@ -1,500 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: "\u062A\u0648\u0627\u0628\u0639 \u0645\u062C\u0645\u0648\u0639 \u067E\u0627\ - \u0631\u0627\u0645\u062A\u0631\u06CC" ---- - -# توابع مجموع پارامتری {#aggregate_functions_parametric} - -Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. - -## سابقهنما {#histogram} - -محاسبه هیستوگرام تطبیقی. این نتایج دقیق را تضمین نمی کند. - -``` sql -histogram(number_of_bins)(values) -``` - -توابع استفاده می کند [جریان الگوریتم درخت تصمیم موازی](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). مرزهای سطل هیستوگرام تنظیم به عنوان داده های جدید وارد یک تابع. در مورد مشترک عرض سطل برابر نیست. - -**پارامترها** - -`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. -`values` — [عبارت](../syntax.md#syntax-expressions) در نتیجه مقادیر ورودی. - -**مقادیر بازگشتی** - -- [& حذف](../../sql_reference/data_types/array.md) از [توپلس](../../sql_reference/data_types/tuple.md) از قالب زیر: - - ``` - [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] - ``` - - - `lower` — Lower bound of the bin. - - `upper` — Upper bound of the bin. - - `height` — Calculated height of the bin. - -**مثال** - -``` sql -SELECT histogram(5)(number + 1) -FROM ( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ -│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -شما می توانید یک هیستوگرام با تجسم [بار](../../sql_reference/functions/other_functions.md#function-bar) تابع برای مثال: - -``` sql -WITH histogram(5)(rand() % 100) AS hist -SELECT - arrayJoin(hist).3 AS height, - bar(height, 0, 6, 5) AS bar -FROM -( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─height─┬─bar───┐ -│ 2.125 │ █▋ │ -│ 3.25 │ ██▌ │ -│ 5.625 │ ████▏ │ -│ 5.625 │ ████▏ │ -│ 3.375 │ ██▌ │ -└────────┴───────┘ -``` - -در این مورد, شما باید به یاد داشته باشید که شما مرزهای هیستوگرام بن نمی دانند. - -## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} - -بررسی اینکه دنباله شامل یک زنجیره رویداد که منطبق بر الگوی. - -``` sql -sequenceMatch(pattern)(timestamp, cond1, cond2, ...) -``` - -!!! warning "اخطار" - رویدادهایی که در همان دوم رخ می دهد ممکن است در دنباله در سفارش تعریف نشده موثر بر نتیجه دراز. - -**پارامترها** - -- `pattern` — Pattern string. See [نحو الگو](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` و `DateTime`. شما همچنین می توانید هر یک از پشتیبانی استفاده کنید [اینترنت](../../sql_reference/data_types/int_uint.md) انواع داده ها. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. شما می توانید به تصویب تا 32 استدلال شرط. تابع طول می کشد تنها حوادث شرح داده شده در این شرایط به حساب. اگر دنباله حاوی اطلاعاتی است که در شرایط توصیف نشده, تابع پرش. - -**مقادیر بازگشتی** - -- 1, اگر الگوی همسان است. -- 0, اگر الگوی همسان نیست. - -نوع: `UInt8`. - - -**نحو الگو** - -- `(?N)` — Matches the condition argument at position `N`. شرایط در شماره `[1, 32]` محدوده. به عنوان مثال, `(?1)` با استدلال به تصویب رسید `cond1` پارامتر. - -- `.*` — Matches any number of events. You don't need conditional arguments to match this element of the pattern. - -- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` مسابقات رویدادهایی که رخ می دهد بیش از 1800 ثانیه از یکدیگر. تعداد دلخواه از هر رویدادی می تواند بین این حوادث دراز. شما می توانید از `>=`, `>`, `<`, `<=` اپراتورها. - -**مثالها** - -داده ها را در نظر بگیرید `t` جدول: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -└──────┴────────┘ -``` - -انجام پرس و جو: - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 1 │ -└───────────────────────────────────────────────────────────────────────┘ -``` - -تابع زنجیره رویداد که تعداد پیدا شده است 2 زیر شماره 1. این قلم شماره 3 بین, چرا که تعداد به عنوان یک رویداد توصیف نشده. اگر ما می خواهیم این شماره را در نظر بگیریم هنگام جستجو برای زنجیره رویداد داده شده در مثال باید شرایط را ایجاد کنیم. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ -│ 0 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -در این مورد, تابع می تواند زنجیره رویداد تطبیق الگوی پیدا کنید, چرا که این رویداد برای شماره 3 رخ داده است بین 1 و 2. اگر در همان مورد ما شرایط را برای شماره بررسی 4, دنباله الگوی مطابقت. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ -│ 1 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**همچنین نگاه کنید** - -- [شمارش معکوس](#function-sequencecount) - -## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} - -شمارش تعداد زنجیره رویداد که الگوی همسان. تابع جستجو زنجیره رویداد که با هم همپوشانی دارند. این شروع به جستجو برای زنجیره بعدی پس از زنجیره فعلی همسان است. - -!!! warning "اخطار" - رویدادهایی که در همان دوم رخ می دهد ممکن است در دنباله در سفارش تعریف نشده موثر بر نتیجه دراز. - -``` sql -sequenceCount(pattern)(timestamp, cond1, cond2, ...) -``` - -**پارامترها** - -- `pattern` — Pattern string. See [نحو الگو](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` و `DateTime`. شما همچنین می توانید هر یک از پشتیبانی استفاده کنید [اینترنت](../../sql_reference/data_types/int_uint.md) انواع داده ها. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. شما می توانید به تصویب تا 32 استدلال شرط. تابع طول می کشد تنها حوادث شرح داده شده در این شرایط به حساب. اگر دنباله حاوی اطلاعاتی است که در شرایط توصیف نشده, تابع پرش. - -**مقادیر بازگشتی** - -- تعداد زنجیره رویداد غیر با هم تداخل دارند که همسان. - -نوع: `UInt64`. - -**مثال** - -داده ها را در نظر بگیرید `t` جدول: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -│ 4 │ 1 │ -│ 5 │ 3 │ -│ 6 │ 2 │ -└──────┴────────┘ -``` - -تعداد چند بار تعداد 2 پس از شماره 1 با هر مقدار از شماره های دیگر بین رخ می دهد: - -``` sql -SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 2 │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [ترتیب سنج](#function-sequencematch) - -## در پنجره {#windowfunnel} - -جستجو برای زنجیره رویداد در یک پنجره زمان کشویی و محاسبه حداکثر تعداد رویدادهایی که از زنجیره رخ داده است. - -تابع با توجه به الگوریتم کار می کند: - -- تابع جستجو برای داده هایی که باعث شرط اول در زنجیره و مجموعه ضد رویداد به 1. این لحظه ای است که پنجره کشویی شروع می شود. - -- اگر حوادث از زنجیره پی در پی در پنجره رخ می دهد, ضد افزایش است. اگر دنباله ای از حوادث مختل شده است, شمارنده است افزایش نمی. - -- اگر داده های زنجیره رویداد های متعدد در نقاط مختلف از اتمام, تابع تنها خروجی به اندازه طولانی ترین زنجیره ای. - -**نحو** - -``` sql -windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) -``` - -**پارامترها** - -- `window` — Length of the sliding window in seconds. -- `mode` - این یک استدلال اختیاری است . - - `'strict'` - وقتی که `'strict'` تنظیم شده است, پنجره() اعمال شرایط تنها برای ارزش های منحصر به فرد. -- `timestamp` — Name of the column containing the timestamp. Data types supported: [تاریخ](../../sql_reference/data_types/date.md), [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) و دیگر انواع عدد صحیح بدون علامت (توجه داشته باشید که حتی اگر برچسب زمان پشتیبانی از `UInt64` نوع, این مقدار می تواند بین المللی تجاوز نمی64 بیشترین, که 2^63 - 1). -- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql_reference/data_types/int_uint.md). - -**مقدار بازگشتی** - -حداکثر تعداد متوالی باعث شرایط از زنجیره ای در پنجره زمان کشویی. -تمام زنجیره ها در انتخاب تجزیه و تحلیل می شوند. - -نوع: `Integer`. - -**مثال** - -تعیین کنید که یک دوره زمانی معین برای کاربر کافی باشد تا گوشی را انتخاب کند و دو بار در فروشگاه اینترنتی خریداری کند. - -زنجیره ای از وقایع زیر را تنظیم کنید: - -1. کاربر وارد شده به حساب خود را در فروشگاه (`eventID = 1003`). -2. کاربر برای یک تلفن جستجو می کند (`eventID = 1007, product = 'phone'`). -3. کاربر سفارش داده شده (`eventID = 1009`). -4. کاربر دوباره سفارش داد (`eventID = 1010`). - -جدول ورودی: - -``` text -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -``` - -یافتن پست های تا چه حد کاربر `user_id` می تواند از طریق زنجیره ای در یک دوره در ژانویه و فوریه از 2019. - -پرسوجو: - -``` sql -SELECT - level, - count() AS c -FROM -( - SELECT - user_id, - windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level - FROM trend - WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') - GROUP BY user_id -) -GROUP BY level -ORDER BY level ASC -``` - -نتیجه: - -``` text -┌─level─┬─c─┐ -│ 4 │ 1 │ -└───────┴───┘ -``` - -## نگهداری {#retention} - -تابع طول می کشد به عنوان استدلال مجموعه ای از شرایط از 1 به 32 استدلال از نوع `UInt8` که نشان می دهد که یک بیماری خاص برای این رویداد مواجه شد. -هر گونه شرایط را می توان به عنوان یک استدلال مشخص (همانطور که در [WHERE](../../sql_reference/statements/select.md#select-where)). - -شرایط, به جز اولین, درخواست در جفت: نتیجه دوم درست خواهد بود اگر اول و دوم درست باشد, از سوم اگر اولین و فیرد درست باشد, و غیره. - -**نحو** - -``` sql -retention(cond1, cond2, ..., cond32); -``` - -**پارامترها** - -- `cond` — an expression that returns a `UInt8` نتیجه (1 یا 0). - -**مقدار بازگشتی** - -مجموعه ای از 1 یا 0. - -- 1 — condition was met for the event. -- 0 — condition wasn't met for the event. - -نوع: `UInt8`. - -**مثال** - -بیایید یک نمونه از محاسبه را در نظر بگیریم `retention` تابع برای تعیین ترافیک سایت. - -**1.** Сreate a table to illustrate an example. - -``` sql -CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; - -INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); -INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); -INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); -``` - -جدول ورودی: - -پرسوجو: - -``` sql -SELECT * FROM retention_test -``` - -نتیجه: - -``` text -┌───────date─┬─uid─┐ -│ 2020-01-01 │ 0 │ -│ 2020-01-01 │ 1 │ -│ 2020-01-01 │ 2 │ -│ 2020-01-01 │ 3 │ -│ 2020-01-01 │ 4 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-02 │ 0 │ -│ 2020-01-02 │ 1 │ -│ 2020-01-02 │ 2 │ -│ 2020-01-02 │ 3 │ -│ 2020-01-02 │ 4 │ -│ 2020-01-02 │ 5 │ -│ 2020-01-02 │ 6 │ -│ 2020-01-02 │ 7 │ -│ 2020-01-02 │ 8 │ -│ 2020-01-02 │ 9 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-03 │ 0 │ -│ 2020-01-03 │ 1 │ -│ 2020-01-03 │ 2 │ -│ 2020-01-03 │ 3 │ -│ 2020-01-03 │ 4 │ -│ 2020-01-03 │ 5 │ -│ 2020-01-03 │ 6 │ -│ 2020-01-03 │ 7 │ -│ 2020-01-03 │ 8 │ -│ 2020-01-03 │ 9 │ -│ 2020-01-03 │ 10 │ -│ 2020-01-03 │ 11 │ -│ 2020-01-03 │ 12 │ -│ 2020-01-03 │ 13 │ -│ 2020-01-03 │ 14 │ -└────────────┴─────┘ -``` - -**2.** کاربران گروه با شناسه منحصر به فرد `uid` با استفاده از `retention` تابع. - -پرسوجو: - -``` sql -SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r -FROM retention_test -WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') -GROUP BY uid -ORDER BY uid ASC -``` - -نتیجه: - -``` text -┌─uid─┬─r───────┐ -│ 0 │ [1,1,1] │ -│ 1 │ [1,1,1] │ -│ 2 │ [1,1,1] │ -│ 3 │ [1,1,1] │ -│ 4 │ [1,1,1] │ -│ 5 │ [0,0,0] │ -│ 6 │ [0,0,0] │ -│ 7 │ [0,0,0] │ -│ 8 │ [0,0,0] │ -│ 9 │ [0,0,0] │ -│ 10 │ [0,0,0] │ -│ 11 │ [0,0,0] │ -│ 12 │ [0,0,0] │ -│ 13 │ [0,0,0] │ -│ 14 │ [0,0,0] │ -└─────┴─────────┘ -``` - -**3.** محاسبه تعداد کل بازدیدکننده داشته است سایت در هر روز. - -پرسوجو: - -``` sql -SELECT - sum(r[1]) AS r1, - sum(r[2]) AS r2, - sum(r[3]) AS r3 -FROM -( - SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r - FROM retention_test - WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') - GROUP BY uid -) -``` - -نتیجه: - -``` text -┌─r1─┬─r2─┬─r3─┐ -│ 5 │ 5 │ 5 │ -└────┴────┴────┘ -``` - -کجا: - -- `r1`- تعداد بازدید کنندگان منحصر به فرد که در طول 2020-01-01 (بازدید `cond1` شرط). -- `r2`- تعداد بازدید کنندگان منحصر به فرد که برای بازدید از سایت در طول یک دوره زمانی خاص بین 2020-01-01 و 2020-01-02 (`cond1` و `cond2` شرایط). -- `r3`- تعداد بازدید کنندگان منحصر به فرد که برای بازدید از سایت در طول یک دوره زمانی خاص بین 2020-01-01 و 2020-01-03 (`cond1` و `cond3` شرایط). - -## uniqUpTo(N)(x) {#uniquptonx} - -Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. - -توصیه می شود برای استفاده با شماره های کوچک, تا 10. حداکثر مقدار نفر است 100. - -برای دولت از یک تابع جمع, با استفاده از مقدار حافظه برابر با 1 + نفر \* اندازه یک مقدار بایت. -برای رشته, این فروشگاه یک هش غیر رمزنگاری 8 بایت. به این معنا که محاسبه برای رشته ها تقریبی است. - -این تابع همچنین برای چندین استدلال کار می کند. - -این کار به همان سرعتی که ممکن است, به جز برای موارد زمانی که یک مقدار نفر بزرگ استفاده می شود و تعدادی از ارزش های منحصر به فرد است کمی کمتر از ان. - -مثال طریقه استفاده: - -``` text -Problem: Generate a report that shows only keywords that produced at least 5 unique users. -Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) - -## sumMapFiltered(keys\_to\_keep)(کلید ارزش ها) {#summapfilteredkeys-to-keepkeys-values} - -رفتار مشابه [& سواپ](reference.md#agg_functions-summap) جز این که مجموعه ای از کلید به عنوان یک پارامتر منتقل می شود. این می تواند مفید باشد به خصوص در هنگام کار با یک کارت از کلید های بالا. diff --git a/docs/fa/sql_reference/aggregate_functions/reference.md b/docs/fa/sql_reference/aggregate_functions/reference.md deleted file mode 100644 index 6c76f2caff0..00000000000 --- a/docs/fa/sql_reference/aggregate_functions/reference.md +++ /dev/null @@ -1,1837 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: "\u0645\u0631\u062C\u0639" ---- - -# مرجع عملکرد {#function-reference} - -## شمارش {#agg_function-count} - -شمارش تعداد ردیف یا نه تهی ارزش. - -ClickHouse زیر پشتیبانی می کند syntaxes برای `count`: -- `count(expr)` یا `COUNT(DISTINCT expr)`. -- `count()` یا `COUNT(*)`. این `count()` نحو ClickHouse خاص. - -**پارامترها** - -این تابع می تواند: - -- صفر پارامتر. -- یک [عبارت](../syntax.md#syntax-expressions). - -**مقدار بازگشتی** - -- اگر تابع بدون پارامتر نامیده می شود تعداد ردیف شمارش. -- اگر [عبارت](../syntax.md#syntax-expressions) به تصویب می رسد, سپس تابع شمارش چند بار این عبارت بازگشت تهی نیست. اگر بیان می گرداند [Nullable](../../sql_reference/data_types/nullable.md)- نوع ارزش و سپس نتیجه `count` باقی نمی ماند `Nullable`. تابع بازده 0 اگر بیان بازگشت `NULL` برای تمام ردیف. - -در هر دو مورد نوع مقدار بازگشتی است [UInt64](../../sql_reference/data_types/int_uint.md). - -**اطلاعات دقیق** - -تاتر از `COUNT(DISTINCT ...)` نحو. رفتار این ساخت و ساز بستگی به [ا\_فزونهها](../../operations/settings/settings.md#settings-count_distinct_implementation) تنظیمات. این تعریف می کند که کدام یک از [uniq\*](#agg_function-uniq) توابع برای انجام عملیات استفاده می شود. به طور پیش فرض است [قرارداد اتحادیه](#agg_function-uniqexact) تابع. - -این `SELECT count() FROM table` پرس و جو بهینه سازی شده نیست, چرا که تعداد ورودی در جدول به طور جداگانه ذخیره نمی. این ستون کوچک را از جدول انتخاب می کند و تعداد مقادیر موجود را شمارش می کند. - -**مثالها** - -مثال 1: - -``` sql -SELECT count() FROM t -``` - -``` text -┌─count()─┐ -│ 5 │ -└─────────┘ -``` - -مثال 2: - -``` sql -SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' -``` - -``` text -┌─name──────────────────────────┬─value─────┐ -│ count_distinct_implementation │ uniqExact │ -└───────────────────────────────┴───────────┘ -``` - -``` sql -SELECT count(DISTINCT num) FROM t -``` - -``` text -┌─uniqExact(num)─┐ -│ 3 │ -└────────────────┘ -``` - -این مثال نشان می دهد که `count(DISTINCT num)` توسط `uniqExact` عملکرد با توجه به `count_distinct_implementation` مقدار تنظیم. - -## هر) {#agg_function-any} - -انتخاب اولین مقدار مواجه می شوند. -پرس و جو را می توان در هر سفارش و حتی در جهت های مختلف در هر زمان اجرا, بنابراین نتیجه این تابع نامشخص است. -برای دریافت یک نتیجه معین, شما می توانید با استفاده از ‘min’ یا ‘max’ تابع به جای ‘any’. - -در بعضی موارد, شما می توانید در جهت اعدام تکیه. این امر در مورد مواردی که انتخاب می شود از یک زیرخاکی است که از سفارش استفاده می کند. - -هنگامی که یک `SELECT` پرسوجو دارد `GROUP BY` بند و یا حداقل یک مجموع عملکرد ClickHouse (در مقایسه با MySQL) مستلزم آن است که تمام عبارات در `SELECT`, `HAVING` و `ORDER BY` بند از کلید و یا از توابع کل محاسبه می شود. به عبارت دیگر, هر ستون انتخاب شده از جدول باید یا در کلید و یا در داخل توابع دانه استفاده می شود. برای دریافت رفتار مانند خروجی زیر, شما می توانید ستون های دیگر در قرار `any` تابع جمع. - -## هشدار داده می شود) {#anyheavyx} - -انتخاب یک مقدار اغلب اتفاق می افتد با استفاده از [بزرگان سنگین](http://www.cs.umd.edu/~samir/498/karp.pdf) الگوریتم. در صورتی که یک مقدار که بیش از در نیمی از موارد در هر یک از موضوعات اعدام پرس و جو رخ می دهد وجود دارد, این مقدار بازگشته است. به طور معمول نتیجه nondeterministic. - -``` sql -anyHeavy(column) -``` - -**نشانوندها** - -- `column` – The column name. - -**مثال** - -نگاهی به [به موقع](../../getting_started/example_datasets/ontime.md) مجموعه داده ها و انتخاب هر مقدار اغلب اتفاق می افتد در `AirlineID` ستون. - -``` sql -SELECT anyHeavy(AirlineID) AS res -FROM ontime -``` - -``` text -┌───res─┐ -│ 19690 │ -└───────┘ -``` - -## حداقل صفحه نمایش:) {#anylastx} - -ارزش گذشته مواجه می شوند را انتخاب می کند. -نتیجه این است که فقط به عنوان نامشخص به عنوان برای `any` تابع. - -## گروه بیتاند {#groupbitand} - -اعمال بیتی `AND` برای مجموعه ای از اعداد. - -``` sql -groupBitAnd(expr) -``` - -**پارامترها** - -`expr` – An expression that results in `UInt*` نوع. - -**مقدار بازگشتی** - -ارزش `UInt*` نوع. - -**مثال** - -داده های تست: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -پرسوجو: - -``` sql -SELECT groupBitAnd(num) FROM t -``` - -کجا `num` ستون با داده های تست است. - -نتیجه: - -``` text -binary decimal -00000100 = 4 -``` - -## ویرایشگر گروه {#groupbitor} - -اعمال بیتی `OR` برای مجموعه ای از اعداد. - -``` sql -groupBitOr(expr) -``` - -**پارامترها** - -`expr` – An expression that results in `UInt*` نوع. - -**مقدار بازگشتی** - -ارزش `UInt*` نوع. - -**مثال** - -داده های تست: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -پرسوجو: - -``` sql -SELECT groupBitOr(num) FROM t -``` - -کجا `num` ستون با داده های تست است. - -نتیجه: - -``` text -binary decimal -01111101 = 125 -``` - -## گروهبیتکسور {#groupbitxor} - -شامل اعضای اتحادیه اروپا `XOR` برای مجموعه ای از اعداد. - -``` sql -groupBitXor(expr) -``` - -**پارامترها** - -`expr` – An expression that results in `UInt*` نوع. - -**مقدار بازگشتی** - -ارزش `UInt*` نوع. - -**مثال** - -داده های تست: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -پرسوجو: - -``` sql -SELECT groupBitXor(num) FROM t -``` - -کجا `num` ستون با داده های تست است. - -نتیجه: - -``` text -binary decimal -01101000 = 104 -``` - -## نگاشت گروهی {#groupbitmap} - -بیت مپ و یا کل محاسبات از یک unsigned integer ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmap(expr) -``` - -**پارامترها** - -`expr` – An expression that results in `UInt*` نوع. - -**مقدار بازگشتی** - -ارزش `UInt64` نوع. - -**مثال** - -داده های تست: - -``` text -UserID -1 -1 -2 -3 -``` - -پرسوجو: - -``` sql -SELECT groupBitmap(UserID) as num FROM t -``` - -نتیجه: - -``` text -num -3 -``` - -## کمینه) {#agg_function-min} - -محاسبه حداقل. - -## بیشینه) {#agg_function-max} - -محاسبه حداکثر. - -## هشدار داده می شود) {#agg-function-argmin} - -محاسبه ‘arg’ ارزش برای حداقل ‘val’ ارزش. اگر چندین مقدار مختلف وجود دارد ‘arg’ برای مقادیر حداقل ‘val’ اولین بار از این مقادیر مواجه خروجی است. - -**مثال:** - -``` text -┌─user─────┬─salary─┐ -│ director │ 5000 │ -│ manager │ 3000 │ -│ worker │ 1000 │ -└──────────┴────────┘ -``` - -``` sql -SELECT argMin(user, salary) FROM salary -``` - -``` text -┌─argMin(user, salary)─┐ -│ worker │ -└──────────────────────┘ -``` - -## هشدار داده می شود) {#agg-function-argmax} - -محاسبه ‘arg’ مقدار برای حداکثر ‘val’ ارزش. اگر چندین مقدار مختلف وجود دارد ‘arg’ برای حداکثر مقادیر ‘val’ اولین بار از این مقادیر مواجه خروجی است. - -## جمع) {#agg_function-sum} - -محاسبه مجموع. -فقط برای اعداد کار می کند. - -## ورود به سیستم) {#sumwithoverflowx} - -محاسبه مجموع اعداد, با استفاده از همان نوع داده برای نتیجه به عنوان پارامترهای ورودی. اگر مجموع بیش از حداکثر مقدار برای این نوع داده, تابع یک خطا می گرداند. - -فقط برای اعداد کار می کند. - -## sumMap(key, value) {#agg_functions-summap} - -مجموع ‘value’ تنظیم با توجه به کلید های مشخص شده در ‘key’ صف کردن. -تعداد عناصر در ‘key’ و ‘value’ باید همین کار را برای هر سطر است که بالغ بر شود. -Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. - -مثال: - -``` sql -CREATE TABLE sum_map( - date Date, - timeslot DateTime, - statusMap Nested( - status UInt16, - requests UInt64 - ) -) ENGINE = Log; -INSERT INTO sum_map VALUES - ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); -SELECT - timeslot, - sumMap(statusMap.status, statusMap.requests) -FROM sum_map -GROUP BY timeslot -``` - -``` text -┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ -│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ -│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ -└─────────────────────┴──────────────────────────────────────────────┘ -``` - -## سیخ کباب {#skewpop} - -محاسبه [skewness](https://en.wikipedia.org/wiki/Skewness) از یک توالی. - -``` sql -skewPop(expr) -``` - -**پارامترها** - -`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. - -**مقدار بازگشتی** - -The skewness of the given distribution. Type — [جسم شناور64](../../sql_reference/data_types/float.md) - -**مثال** - -``` sql -SELECT skewPop(value) FROM series_with_value_column -``` - -## سیخ {#skewsamp} - -محاسبه [نمونه skewness](https://en.wikipedia.org/wiki/Skewness) از یک توالی. - -این نشان دهنده یک تخمین بی طرفانه از اریب یک متغیر تصادفی اگر ارزش گذشت نمونه خود را تشکیل می دهند. - -``` sql -skewSamp(expr) -``` - -**پارامترها** - -`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. - -**مقدار بازگشتی** - -The skewness of the given distribution. Type — [جسم شناور64](../../sql_reference/data_types/float.md). اگر `n <= 1` (`n` اندازه نمونه است), سپس بازده تابع `nan`. - -**مثال** - -``` sql -SELECT skewSamp(value) FROM series_with_value_column -``` - -## کورتپ {#kurtpop} - -محاسبه [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) از یک توالی. - -``` sql -kurtPop(expr) -``` - -**پارامترها** - -`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. - -**مقدار بازگشتی** - -The kurtosis of the given distribution. Type — [جسم شناور64](../../sql_reference/data_types/float.md) - -**مثال** - -``` sql -SELECT kurtPop(value) FROM series_with_value_column -``` - -## کردها {#kurtsamp} - -محاسبه [نمونه kurtosis](https://en.wikipedia.org/wiki/Kurtosis) از یک توالی. - -این نشان دهنده یک تخمین بی طرفانه از کورتوز یک متغیر تصادفی اگر ارزش گذشت نمونه خود را تشکیل می دهند. - -``` sql -kurtSamp(expr) -``` - -**پارامترها** - -`expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد. - -**مقدار بازگشتی** - -The kurtosis of the given distribution. Type — [جسم شناور64](../../sql_reference/data_types/float.md). اگر `n <= 1` (`n` اندازه نمونه است) و سپس تابع بازده `nan`. - -**مثال** - -``` sql -SELECT kurtSamp(value) FROM series_with_value_column -``` - -## هشدار داده می شود) {#agg-function-timeseriesgroupsum} - -`timeSeriesGroupSum` می توانید سری های زمانی مختلف که برچسب زمان نمونه هم ترازی جمع نمی. -این برون یابی خطی بین دو برچسب زمان نمونه و سپس مجموع زمان سری با هم استفاده کنید. - -- `uid` سری زمان شناسه منحصر به فرد است, `UInt64`. -- `timestamp` است نوع درون64 به منظور حمایت میلی ثانیه یا میکروثانیه. -- `value` متریک است. - -تابع گرداند مجموعه ای از تاپل با `(timestamp, aggregated_value)` جفت - -قبل از استفاده از این تابع اطمینان حاصل کنید `timestamp` به ترتیب صعودی است. - -مثال: - -``` text -┌─uid─┬─timestamp─┬─value─┐ -│ 1 │ 2 │ 0.2 │ -│ 1 │ 7 │ 0.7 │ -│ 1 │ 12 │ 1.2 │ -│ 1 │ 17 │ 1.7 │ -│ 1 │ 25 │ 2.5 │ -│ 2 │ 3 │ 0.6 │ -│ 2 │ 8 │ 1.6 │ -│ 2 │ 12 │ 2.4 │ -│ 2 │ 18 │ 3.6 │ -│ 2 │ 24 │ 4.8 │ -└─────┴───────────┴───────┘ -``` - -``` sql -CREATE TABLE time_series( - uid UInt64, - timestamp Int64, - value Float64 -) ENGINE = Memory; -INSERT INTO time_series VALUES - (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), - (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); - -SELECT timeSeriesGroupSum(uid, timestamp, value) -FROM ( - SELECT * FROM time_series order by timestamp ASC -); -``` - -و نتیجه خواهد بود: - -``` text -[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] -``` - -## هشدار داده می شود) {#agg-function-timeseriesgroupratesum} - -به طور مشابه timeseriesgroupratesum, timeseriesgroupratesum را محاسبه نرخ سری زمانی و سپس مجموع نرخ با هم. -همچنین, برچسب زمان باید در جهت صعود قبل از استفاده از این تابع باشد. - -با استفاده از این تابع نتیجه مورد بالا خواهد بود: - -``` text -[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] -``` - -## میانگین) {#agg_function-avg} - -محاسبه متوسط. -فقط برای اعداد کار می کند. -نتیجه این است که همیشه شناور64. - -## uniq {#agg_function-uniq} - -محاسبه تعداد تقریبی مقادیر مختلف استدلال. - -``` sql -uniq(x[, ...]) -``` - -**پارامترها** - -تابع طول می کشد تعداد متغیر از پارامترهای. پارامترها می توانند باشند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. - -**مقدار بازگشتی** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-نوع شماره. - -**پیاده سازی اطلاعات** - -تابع: - -- هش را برای تمام پارامترها در مجموع محاسبه می کند و سپس در محاسبات استفاده می شود. - -- با استفاده از یک تطبیقی نمونه الگوریتم. برای محاسبه دولت تابع با استفاده از یک نمونه از عنصر هش ارزش تا 65536. - - This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. - -- نتیجه را تعیین می کند (به سفارش پردازش پرس و جو بستگی ندارد). - -ما توصیه می کنیم با استفاده از این تابع تقریبا در تمام حالات. - -**همچنین نگاه کنید** - -- [مخلوط نشده](#agg_function-uniqcombined) -- [نیم قرن 64](#agg_function-uniqcombined64) -- [یونقلل12](#agg_function-uniqhll12) -- [قرارداد اتحادیه](#agg_function-uniqexact) - -## uniqCombined {#agg_function-uniqcombined} - -محاسبه تعداد تقریبی مقادیر استدلال های مختلف. - -``` sql -uniqCombined(HLL_precision)(x[, ...]) -``` - -این `uniqCombined` تابع یک انتخاب خوب برای محاسبه تعداد مقادیر مختلف است. - -**پارامترها** - -تابع طول می کشد تعداد متغیر از پارامترهای. پارامترها می توانند باشند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. - -`HLL_precision` پایه-2 لگاریتم تعداد سلول ها در [جمع شدن](https://en.wikipedia.org/wiki/HyperLogLog). اختیاری, شما می توانید تابع به عنوان استفاده `uniqCombined(x[, ...])`. مقدار پیش فرض برای `HLL_precision` است 17, که به طور موثر 96 کیلوبایت فضا (2^17 سلول ها, 6 بیت در هر). - -**مقدار بازگشتی** - -- یک عدد [UInt64](../../sql_reference/data_types/int_uint.md)- نوع شماره . - -**پیاده سازی اطلاعات** - -تابع: - -- محاسبه هش (هش 64 بیتی برای `String` و در غیر این صورت 32 بیتی) برای تمام پارامترها در مجموع و سپس در محاسبات استفاده می شود. - -- با استفاده از ترکیبی از سه الگوریتم: مجموعه, جدول هش, و جمع شدن با جدول تصحیح خطا. - - For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. - -- نتیجه را تعیین می کند (به سفارش پردازش پرس و جو بستگی ندارد). - -!!! note "یادداشت" - از هش 32 بیتی برای غیر استفاده می کند-`String` نوع, نتیجه خطا بسیار بالا برای کاریت به طور قابل توجهی بزرگتر از اند `UINT_MAX` (خطا به سرعت پس از چند ده میلیارد ارزش متمایز افزایش خواهد یافت), از این رو در این مورد شما باید استفاده کنید [نیم قرن 64](#agg_function-uniqcombined64) - -در مقایسه با [uniq](#agg_function-uniq) عملکرد `uniqCombined`: - -- مصرف چندین بار حافظه کمتر. -- محاسبه با دقت چند بار بالاتر است. -- معمولا عملکرد کمی پایین تر است. در برخی از حالات, `uniqCombined` می توانید بهتر از انجام `uniq` برای مثال با توزیع نمایش داده شد که انتقال تعداد زیادی از جمع متحده بر روی شبکه. - -**همچنین نگاه کنید** - -- [دانشگاه](#agg_function-uniq) -- [نیم قرن 64](#agg_function-uniqcombined64) -- [یونقلل12](#agg_function-uniqhll12) -- [قرارداد اتحادیه](#agg_function-uniqexact) - -## نیم قرن 64 {#agg_function-uniqcombined64} - -مثل [مخلوط نشده](#agg_function-uniqcombined), اما با استفاده از هش 64 بیتی برای تمام انواع داده ها. - -## یونقلل12 {#agg_function-uniqhll12} - -محاسبه تعداد تقریبی مقادیر استدلال های مختلف, با استفاده از [جمع شدن](https://en.wikipedia.org/wiki/HyperLogLog) الگوریتم. - -``` sql -uniqHLL12(x[, ...]) -``` - -**پارامترها** - -این تابع یک متغیر تعدادی از پارامترهای. پارامترهای می تواند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. - -**مقدار بازگشتی** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-نوع شماره. - -**پیاده سازی اطلاعات** - -تابع: - -- هش را برای تمام پارامترها در مجموع محاسبه می کند و سپس در محاسبات استفاده می شود. - -- با استفاده از الگوریتم جمع شدن تقریبی تعداد مقادیر استدلال های مختلف. - - 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). - -- نتیجه تعیین شده را فراهم می کند (به سفارش پردازش پرس و جو بستگی ندارد). - -ما توصیه نمی کنیم با استفاده از این تابع. در اغلب موارد از [دانشگاه](#agg_function-uniq) یا [مخلوط نشده](#agg_function-uniqcombined) تابع. - -**همچنین نگاه کنید** - -- [دانشگاه](#agg_function-uniq) -- [مخلوط نشده](#agg_function-uniqcombined) -- [قرارداد اتحادیه](#agg_function-uniqexact) - -## قرارداد اتحادیه {#agg_function-uniqexact} - -محاسبه تعداد دقیق ارزش استدلال های مختلف. - -``` sql -uniqExact(x[, ...]) -``` - -استفاده از `uniqExact` تابع اگر شما کاملا نیاز به یک نتیجه دقیق. در غیر این صورت استفاده از [uniq](#agg_function-uniq) تابع. - -این `uniqExact` تابع با استفاده از حافظه بیش از `uniq`, چرا که اندازه دولت رشد گشوده است به عنوان تعدادی از ارزش های مختلف را افزایش می دهد. - -**پارامترها** - -تابع طول می کشد تعداد متغیر از پارامترهای. پارامترها می توانند باشند `Tuple`, `Array`, `Date`, `DateTime`, `String`, یا انواع عددی. - -**همچنین نگاه کنید به** - -- [uniq](#agg_function-uniq) -- [مخلوط نشده](#agg_function-uniqcombined) -- [یونقلل12](#agg_function-uniqhll12) - -## groupArray(x) groupArray(max\_size)(x) {#agg_function-grouparray} - -مجموعه ای از مقادیر استدلال را ایجاد می کند. -مقادیر را می توان به ترتیب در هر (نامعین) اضافه کرد. - -نسخه دوم (با `max_size` پارامتر) اندازه مجموعه حاصل را محدود می کند `max_size` عناصر. -به عنوان مثال, `groupArray (1) (x)` معادل است `[any (x)]`. - -در بعضی موارد, شما هنوز هم می توانید در جهت اعدام تکیه. این امر در مورد مواردی که `SELECT` همراه از یک خرده فروشی که با استفاده از `ORDER BY`. - -## ارزش موقعیت) {#grouparrayinsertatvalue-position} - -مقدار را به مجموعه ای در موقعیت مشخص شده وارد می کند. - -!!! note "یادداشت" - این تابع با استفاده از موقعیت های مبتنی بر صفر, بر خلاف موقعیت های معمولی مبتنی بر یک برای فرود میدان. - -Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. - -پارامترهای اختیاری: - -- مقدار پیش فرض برای جایگزینی در موقعیت های خالی. -- طول مجموعه حاصل. این اجازه می دهد تا شما را به دریافت مجموعه ای از همان اندازه برای تمام کلید های کل. هنگام استفاده از این پارامتر, مقدار پیش فرض باید مشخص شود. - -## هشدار داده می شود {#agg_function-grouparraymovingsum} - -محاسبه مجموع در حال حرکت از ارزش های ورودی. - -``` sql -groupArrayMovingSum(numbers_for_summing) -groupArrayMovingSum(window_size)(numbers_for_summing) -``` - -این تابع می تواند اندازه پنجره به عنوان یک پارامتر را. اگر سمت چپ نامشخص, تابع طول می کشد اندازه پنجره به تعداد ردیف در ستون برابر. - -**پارامترها** - -- `numbers_for_summing` — [عبارت](../syntax.md#syntax-expressions) در نتیجه یک مقدار نوع داده عددی. -- `window_size` — Size of the calculation window. - -**مقادیر بازگشتی** - -- مجموعه ای از همان اندازه و نوع به عنوان داده های ورودی. - -**مثال** - -جدول نمونه: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -نمایش داده شد: - -``` sql -SELECT - groupArrayMovingSum(int) AS I, - groupArrayMovingSum(float) AS F, - groupArrayMovingSum(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingSum(2)(int) AS I, - groupArrayMovingSum(2)(float) AS F, - groupArrayMovingSum(2)(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -## گروهاریموینگاوگ {#agg_function-grouparraymovingavg} - -محاسبه میانگین متحرک از ارزش های ورودی. - -``` sql -groupArrayMovingAvg(numbers_for_summing) -groupArrayMovingAvg(window_size)(numbers_for_summing) -``` - -این تابع می تواند اندازه پنجره به عنوان یک پارامتر را. اگر سمت چپ نامشخص, تابع طول می کشد اندازه پنجره به تعداد ردیف در ستون برابر. - -**پارامترها** - -- `numbers_for_summing` — [عبارت](../syntax.md#syntax-expressions) در نتیجه یک مقدار نوع داده عددی. -- `window_size` — Size of the calculation window. - -**مقادیر بازگشتی** - -- مجموعه ای از همان اندازه و نوع به عنوان داده های ورودی. - -تابع استفاده می کند [گرد کردن به سمت صفر](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). این کوتاه رقم اعشار ناچیز برای نوع داده و در نتیجه. - -**مثال** - -جدول نمونه `b`: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -نمایش داده شد: - -``` sql -SELECT - groupArrayMovingAvg(int) AS I, - groupArrayMovingAvg(float) AS F, - groupArrayMovingAvg(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ -│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ -└───────────┴─────────────────────────────────────┴───────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingAvg(2)(int) AS I, - groupArrayMovingAvg(2)(float) AS F, - groupArrayMovingAvg(2)(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ -│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ -└───────────┴──────────────────────────────────┴───────────────────────┘ -``` - -## groupUniqArray(x) groupUniqArray(max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} - -مجموعه ای از مقادیر مختلف استدلال ایجاد می کند. مصرف حافظه همان است که برای `uniqExact` تابع. - -نسخه دوم (با `max_size` پارامتر) اندازه مجموعه حاصل را محدود می کند `max_size` عناصر. -به عنوان مثال, `groupUniqArray(1)(x)` معادل است `[any(x)]`. - -## quantile {#quantile} - -محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. - -این تابع اعمال می شود [نمونه برداری مخزن](https://en.wikipedia.org/wiki/Reservoir_sampling) با اندازه مخزن تا 8192 و یک مولد عدد تصادفی برای نمونه برداری. نتیجه غیر قطعی است. برای دریافت یک کمی دقیق, استفاده از [کوانتوم](#quantileexact) تابع. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantile(level)(expr) -``` - -نام مستعار: `median`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql_reference/data_types/index.md#data_types), [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). - -**مقدار بازگشتی** - -- کمی تقریبی از سطح مشخص شده است. - -نوع: - -- [جسم شناور64](../../sql_reference/data_types/float.md) برای ورودی نوع داده عددی. -- [تاریخ](../../sql_reference/data_types/date.md) اگر مقادیر ورودی `Date` نوع. -- [DateTime](../../sql_reference/data_types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. - -**مثال** - -جدول ورودی: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -پرسوجو: - -``` sql -SELECT quantile(val) FROM t -``` - -نتیجه: - -``` text -┌─quantile(val)─┐ -│ 1.5 │ -└───────────────┘ -``` - -**همچنین نگاه کنید به** - -- [میانه](#median) -- [quantiles](#quantiles) - -## نامعینیهای کوانتی {#quantiledeterministic} - -محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. - -این تابع اعمال می شود [نمونه برداری مخزن](https://en.wikipedia.org/wiki/Reservoir_sampling) با اندازه مخزن تا 8192 و الگوریتم قطعی نمونه گیری. نتیجه قطعی است. برای دریافت یک کمی دقیق, استفاده از [کوانتوم](#quantileexact) تابع. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantileDeterministic(level)(expr, determinator) -``` - -نام مستعار: `medianDeterministic`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql_reference/data_types/index.md#data_types), [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). -- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. - -**مقدار بازگشتی** - -- کمی تقریبی از سطح مشخص شده است. - -نوع: - -- [جسم شناور64](../../sql_reference/data_types/float.md) برای ورودی نوع داده عددی. -- [تاریخ](../../sql_reference/data_types/date.md) اگر مقادیر ورودی `Date` نوع. -- [DateTime](../../sql_reference/data_types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. - -**مثال** - -جدول ورودی: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -پرسوجو: - -``` sql -SELECT quantileDeterministic(val, 1) FROM t -``` - -نتیجه: - -``` text -┌─quantileDeterministic(val, 1)─┐ -│ 1.5 │ -└───────────────────────────────┘ -``` - -**همچنین نگاه کنید** - -- [میانه](#median) -- [quantiles](#quantiles) - -## کوانتوم {#quantileexact} - -دقیقا محاسبه می کند [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` حافظه, جایی که `n` تعدادی از ارزش هایی که تصویب شد. اما, برای تعداد کمی از ارزش, تابع بسیار موثر است. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantileExact(level)(expr) -``` - -نام مستعار: `medianExact`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql_reference/data_types/index.md#data_types), [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). - -**مقدار بازگشتی** - -- Quantile از سطح مشخص شده. - -نوع: - -- [جسم شناور64](../../sql_reference/data_types/float.md) برای ورودی نوع داده عددی. -- [تاریخ](../../sql_reference/data_types/date.md) اگر مقادیر ورودی `Date` نوع. -- [DateTime](../../sql_reference/data_types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. - -**مثال** - -پرسوجو: - -``` sql -SELECT quantileExact(number) FROM numbers(10) -``` - -نتیجه: - -``` text -┌─quantileExact(number)─┐ -│ 5 │ -└───────────────────────┘ -``` - -**همچنین نگاه کنید** - -- [میانه](#median) -- [quantiles](#quantiles) - -## نمایش سایت {#quantileexactweighted} - -دقیقا محاسبه می کند [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی, با در نظر گرفتن وزن هر عنصر. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [کوانتوم](#quantileexact). شما می توانید این تابع به جای استفاده از `quantileExact` و وزن 1 را مشخص کنید. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantileExactWeighted(level)(expr, weight) -``` - -نام مستعار: `medianExactWeighted`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql_reference/data_types/index.md#data_types), [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. - -**مقدار بازگشتی** - -- Quantile از سطح مشخص شده. - -نوع: - -- [جسم شناور64](../../sql_reference/data_types/float.md) برای ورودی نوع داده عددی. -- [تاریخ](../../sql_reference/data_types/date.md) اگر مقادیر ورودی `Date` نوع. -- [DateTime](../../sql_reference/data_types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. - -**مثال** - -جدول ورودی: - -``` text -┌─n─┬─val─┐ -│ 0 │ 3 │ -│ 1 │ 2 │ -│ 2 │ 1 │ -│ 5 │ 4 │ -└───┴─────┘ -``` - -پرسوجو: - -``` sql -SELECT quantileExactWeighted(n, val) FROM t -``` - -نتیجه: - -``` text -┌─quantileExactWeighted(n, val)─┐ -│ 1 │ -└───────────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [میانه](#median) -- [quantiles](#quantiles) - -## زمان کمی {#quantiletiming} - -با دقت تعیین شده محاسبه می شود [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی. - -نتیجه قطعی است(به سفارش پردازش پرس و جو بستگی ندارد). این تابع برای کار با توالی هایی که توزیع هایی مانند بارگذاری صفحات وب بار یا زمان پاسخ باطن را توصیف می کنند بهینه شده است. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantileTiming(level)(expr) -``` - -نام مستعار: `medianTiming`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). - -- `expr` — [عبارت](../syntax.md#syntax-expressions) بیش از یک مقادیر ستون بازگشت [شناور\*](../../sql_reference/data_types/float.md)-نوع شماره. - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -**دقت** - -محاسبه دقیق است اگر: - -- تعداد کل مقادیر 5670 تجاوز نمی کند. -- تعداد کل مقادیر بیش از 5670, اما زمان بارگذاری صفحه کمتر از است 1024خانم. - -در غیر این صورت, نتیجه محاسبه به نزدیکترین چند از گرد 16 خانم. - -!!! note "یادداشت" - برای محاسبه زمان بارگذاری صفحه quantiles این تابع این است که موثر تر و دقیق تر از [quantile](#quantile). - -**مقدار بازگشتی** - -- Quantile از سطح مشخص شده. - -نوع: `Float32`. - -!!! note "یادداشت" - اگر هیچ ارزش به تابع منتقل می شود (هنگام استفاده از `quantileTimingIf`), [نان](../../sql_reference/data_types/float.md#data_type-float-nan-inf) بازگشته است. هدف از این است که افتراق این موارد از مواردی که منجر به صفر. ببینید [ORDER BY](../statements/select.md#select-order-by) برای یادداشت ها در مرتب سازی `NaN` ارزشهای خبری عبارتند از: - -**مثال** - -جدول ورودی: - -``` text -┌─response_time─┐ -│ 72 │ -│ 112 │ -│ 126 │ -│ 145 │ -│ 104 │ -│ 242 │ -│ 313 │ -│ 168 │ -│ 108 │ -└───────────────┘ -``` - -پرسوجو: - -``` sql -SELECT quantileTiming(response_time) FROM t -``` - -نتیجه: - -``` text -┌─quantileTiming(response_time)─┐ -│ 126 │ -└───────────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [میانه](#median) -- [quantiles](#quantiles) - -## زمان کمی {#quantiletimingweighted} - -با دقت تعیین شده محاسبه می شود [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی با توجه به وزن هر یک از اعضای دنباله. - -نتیجه قطعی است(به سفارش پردازش پرس و جو بستگی ندارد). این تابع برای کار با توالی هایی که توزیع هایی مانند بارگذاری صفحات وب بار یا زمان پاسخ باطن را توصیف می کنند بهینه شده است. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantileTimingWeighted(level)(expr, weight) -``` - -نام مستعار: `medianTimingWeighted`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). - -- `expr` — [عبارت](../syntax.md#syntax-expressions) بیش از یک مقادیر ستون بازگشت [شناور\*](../../sql_reference/data_types/float.md)- نوع شماره . - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**دقت** - -محاسبه دقیق است اگر: - -- تعداد کل مقادیر 5670 تجاوز نمی کند. -- تعداد کل مقادیر بیش از 5670, اما زمان بارگذاری صفحه کمتر از است 1024خانم. - -در غیر این صورت, نتیجه محاسبه به نزدیکترین چند از گرد 16 خانم. - -!!! note "یادداشت" - برای محاسبه زمان بارگذاری صفحه quantiles این تابع این است که موثر تر و دقیق تر از [quantile](#quantile). - -**مقدار بازگشتی** - -- Quantile از سطح مشخص شده. - -نوع: `Float32`. - -!!! note "یادداشت" - اگر هیچ ارزش به تابع منتقل می شود (هنگام استفاده از `quantileTimingIf`), [نان](../../sql_reference/data_types/float.md#data_type-float-nan-inf) بازگشته است. هدف از این است که افتراق این موارد از مواردی که منجر به صفر. ببینید [ORDER BY](../statements/select.md#select-order-by) برای یادداشت ها در مرتب سازی `NaN` ارزشهای خبری عبارتند از: - -**مثال** - -جدول ورودی: - -``` text -┌─response_time─┬─weight─┐ -│ 68 │ 1 │ -│ 104 │ 2 │ -│ 112 │ 3 │ -│ 126 │ 2 │ -│ 138 │ 1 │ -│ 162 │ 1 │ -└───────────────┴────────┘ -``` - -پرسوجو: - -``` sql -SELECT quantileTimingWeighted(response_time, weight) FROM t -``` - -نتیجه: - -``` text -┌─quantileTimingWeighted(response_time, weight)─┐ -│ 112 │ -└───────────────────────────────────────────────┘ -``` - -**همچنین نگاه کنید** - -- [میانه](#median) -- [quantiles](#quantiles) - -## مقدار کمی {#quantiletdigest} - -محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی با استفاده از [خلاصه](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) الگوریتم. - -حداکثر خطا است 1%. مصرف حافظه است `log(n)` کجا `n` تعدادی از ارزش است. نتیجه بستگی دارد منظور از در حال اجرا پرس و جو و nondeterministic. - -عملکرد تابع کمتر از عملکرد است [quantile](#quantile) یا [زمان کمی](#quantiletiming). از لحاظ نسبت اندازه دولت به دقت, این تابع بسیار بهتر از `quantile`. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantileTDigest(level)(expr) -``` - -نام مستعار: `medianTDigest`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql_reference/data_types/index.md#data_types), [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). - -**مقدار بازگشتی** - -- کمی تقریبی از سطح مشخص شده است. - -نوع: - -- [جسم شناور64](../../sql_reference/data_types/float.md) برای ورودی نوع داده عددی. -- [تاریخ](../../sql_reference/data_types/date.md) اگر مقادیر ورودی `Date` نوع. -- [DateTime](../../sql_reference/data_types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. - -**مثال** - -پرسوجو: - -``` sql -SELECT quantileTDigest(number) FROM numbers(10) -``` - -نتیجه: - -``` text -┌─quantileTDigest(number)─┐ -│ 4.5 │ -└─────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [میانه](#median) -- [quantiles](#quantiles) - -## نمایش سایت {#quantiletdigestweighted} - -محاسبه تقریبی [quantile](https://en.wikipedia.org/wiki/Quantile) از یک توالی داده های عددی با استفاده از [خلاصه](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) الگوریتم. تابع طول می کشد را به حساب وزن هر یک از اعضای دنباله. حداکثر خطا است 1%. مصرف حافظه است `log(n)` کجا `n` تعدادی از ارزش است. - -عملکرد تابع کمتر از عملکرد است [quantile](#quantile) یا [زمان کمی](#quantiletiming). از لحاظ نسبت اندازه دولت به دقت, این تابع بسیار بهتر از `quantile`. - -نتیجه بستگی دارد منظور از در حال اجرا پرس و جو و nondeterministic. - -هنگام استفاده از چندین `quantile*` توابع با سطوح مختلف در پرس و جو, کشورهای داخلی در ترکیب نیست (به این معنا که, پرس و جو کار می کند موثر کمتر از می تواند). در این مورد از [quantiles](#quantiles) تابع. - -**نحو** - -``` sql -quantileTDigest(level)(expr) -``` - -نام مستعار: `medianTDigest`. - -**پارامترها** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` مقدار در محدوده `[0.01, 0.99]`. مقدار پیش فرض: 0.5. در `level=0.5` تابع محاسبه می کند [میانه](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [انواع داده ها](../../sql_reference/data_types/index.md#data_types), [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**مقدار بازگشتی** - -- کمی تقریبی از سطح مشخص شده است. - -نوع: - -- [جسم شناور64](../../sql_reference/data_types/float.md) برای ورودی نوع داده عددی. -- [تاریخ](../../sql_reference/data_types/date.md) اگر مقادیر ورودی `Date` نوع. -- [DateTime](../../sql_reference/data_types/datetime.md) اگر مقادیر ورودی `DateTime` نوع. - -**مثال** - -پرسوجو: - -``` sql -SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) -``` - -نتیجه: - -``` text -┌─quantileTDigestWeighted(number, 1)─┐ -│ 4.5 │ -└────────────────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [میانه](#median) -- [quantiles](#quantiles) - -## میانه {#median} - -این `median*` توابع نام مستعار برای مربوطه `quantile*` توابع. متوسط یک نمونه داده عددی را محاسبه می کنند. - -توابع: - -- `median` — Alias for [quantile](#quantile). -- `medianDeterministic` — Alias for [نامعینیهای کوانتی](#quantiledeterministic). -- `medianExact` — Alias for [کوانتوم](#quantileexact). -- `medianExactWeighted` — Alias for [نمایش سایت](#quantileexactweighted). -- `medianTiming` — Alias for [زمان کمی](#quantiletiming). -- `medianTimingWeighted` — Alias for [زمان کمی](#quantiletimingweighted). -- `medianTDigest` — Alias for [مقدار کمی](#quantiletdigest). -- `medianTDigestWeighted` — Alias for [نمایش سایت](#quantiletdigestweighted). - -**مثال** - -جدول ورودی: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -پرسوجو: - -``` sql -SELECT medianDeterministic(val, 1) FROM t -``` - -نتیجه: - -``` text -┌─medianDeterministic(val, 1)─┐ -│ 1.5 │ -└─────────────────────────────┘ -``` - -## quantiles(level1, level2, …)(x) {#quantiles} - -تمام quantile توابع نیز مربوط quantiles توابع: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. این توابع محاسبه تمام کوانتوم از سطوح ذکر شده در یک پاس, و بازگشت مجموعه ای از مقادیر حاصل. - -## اطلاعات دقیق) {#varsampx} - -محاسبه مقدار `Σ((x - x̅)^2) / (n - 1)` کجا `n` اندازه نمونه است و `x̅`مقدار متوسط است `x`. - -این نشان دهنده یک تخمین بی طرفانه از واریانس یک متغیر تصادفی اگر ارزش گذشت نمونه خود را تشکیل می دهند. - -بازگشت `Float64`. چه زمانی `n <= 1`, بازگشت `+∞`. - -## هشدار داده می شود) {#varpopx} - -محاسبه مقدار `Σ((x - x̅)^2) / n` کجا `n` اندازه نمونه است و `x̅`مقدار متوسط است `x`. - -به عبارت دیگر, پراکندگی برای مجموعه ای از ارزش. بازگشت `Float64`. - -## اطلاعات دقیق) {#stddevsampx} - -نتیجه برابر با ریشه مربع است `varSamp(x)`. - -## اطلاعات دقیق) {#stddevpopx} - -نتیجه برابر با ریشه مربع است `varPop(x)`. - -## topK(N)(x) {#topknx} - -بازگرداندن مجموعه ای از مقادیر تقریبا شایع ترین در ستون مشخص. مجموعه حاصل به ترتیب نزولی فرکانس تقریبی ارزش ها (نه با ارزش های خود) طبقه بندی شده اند. - -پیاده سازی [فیلتر صرفه جویی در فضا](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) الگوریتم برای تجزیه و تحلیل توپک, بر اساس الگوریتم کاهش و ترکیب از [صرفه جویی در فضای موازی](https://arxiv.org/pdf/1401.0702.pdf). - -``` sql -topK(N)(column) -``` - -این تابع یک نتیجه تضمین شده را فراهم نمی کند. در شرایط خاص, اشتباهات ممکن است رخ دهد و ممکن است مقادیر مکرر که مقادیر شایع ترین نیست بازگشت. - -ما توصیه می کنیم با استفاده از `N < 10` عملکرد با بزرگ کاهش می یابد `N` ارزشهای خبری عبارتند از: حداکثر مقدار `N = 65536`. - -**پارامترها** - -- ‘N’ است تعدادی از عناصر به بازگشت. - -اگر پارامتر حذف شده است, مقدار پیش فرض 10 استفاده شده است. - -**نشانوندها** - -- ' x ' – The value to calculate frequency. - -**مثال** - -نگاهی به [به موقع](../../getting_started/example_datasets/ontime.md) مجموعه داده ها و انتخاب سه ارزش اغلب اتفاق می افتد در `AirlineID` ستون. - -``` sql -SELECT topK(3)(AirlineID) AS res -FROM ontime -``` - -``` text -┌─res─────────────────┐ -│ [19393,19790,19805] │ -└─────────────────────┘ -``` - -## کشتی کج {#topkweighted} - -مشابه به `topK` اما طول می کشد یک استدلال اضافی از نوع صحیح - `weight`. هر مقدار به حساب `weight` بار برای محاسبه فرکانس. - -**نحو** - -``` sql -topKWeighted(N)(x, weight) -``` - -**پارامترها** - -- `N` — The number of elements to return. - -**نشانوندها** - -- `x` – The value. -- `weight` — The weight. [UInt8](../../sql_reference/data_types/int_uint.md). - -**مقدار بازگشتی** - -بازگرداندن مجموعه ای از مقادیر با حداکثر مجموع تقریبی وزن. - -**مثال** - -پرسوجو: - -``` sql -SELECT topKWeighted(10)(number, number) FROM numbers(1000) -``` - -نتیجه: - -``` text -┌─topKWeighted(10)(number, number)──────────┐ -│ [999,998,997,996,995,994,993,992,991,990] │ -└───────────────────────────────────────────┘ -``` - -## هشدار داده می شود) {#covarsampx-y} - -محاسبه ارزش `Σ((x - x̅)(y - y̅)) / (n - 1)`. - -را برمی گرداند شناور64. زمانی که `n <= 1`, returns +∞. - -## نمایش سایت) {#covarpopx-y} - -محاسبه ارزش `Σ((x - x̅)(y - y̅)) / n`. - -## هشدار داده می شود) {#corrx-y} - -محاسبه ضریب همبستگی پیرسون: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. - -## طبقه بندی فرمول بندی {#categoricalinformationvalue} - -محاسبه ارزش `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` برای هر دسته. - -``` sql -categoricalInformationValue(category1, category2, ..., tag) -``` - -نتیجه نشان می دهد که چگونه یک ویژگی گسسته (قطعی) `[category1, category2, ...]` کمک به یک مدل یادگیری که پیش بینی ارزش `tag`. - -## ساده سازی مقررات {#simplelinearregression} - -انجام ساده (unidimensional) رگرسیون خطی. - -``` sql -simpleLinearRegression(x, y) -``` - -پارامترها: - -- `x` — Column with dependent variable values. -- `y` — Column with explanatory variable values. - -مقادیر بازگشتی: - -ثابتها `(a, b)` از خط نتیجه `y = a*x + b`. - -**مثالها** - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ -│ (1,0) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ -│ (1,3) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## تنظیم مقررات {#agg_functions-stochasticlinearregression} - -این تابع پیاده سازی رگرسیون خطی تصادفی. این پشتیبانی از پارامترهای سفارشی برای نرخ یادگیری, ل2 ضریب منظم, اندازه مینی دسته ای و دارای چند روش برای به روز رسانی وزن ([ادام](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (به طور پیش فرض استفاده می شود), [اطلاعات دقیق](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [شتاب](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [نستروف](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). - -### پارامترها {#agg_functions-stochasticlinearregression-parameters} - -4 پارامتر قابل تنظیم وجود دارد. به ترتیب تابع منتقل می شود اما بدون نیاز به تصویب تمام مقادیر چهار پیش فرض استفاده می شود با این حال مدل خوب مورد نیاز برخی از تنظیم پارامتر وجود دارد. - -``` text -stochasticLinearRegression(1.0, 1.0, 10, 'SGD') -``` - -1. `learning rate` ضریب در طول گام است, زمانی که گام گرادیان تبار انجام شده است. نرخ یادگیری بیش از حد بزرگ ممکن است وزن بی نهایت از مدل شود. پیشفرض `0.00001`. -2. `l2 regularization coefficient` که ممکن است کمک به جلوگیری از سوراخ سوراخ شدن بیش از حد. پیشفرض `0.1`. -3. `mini-batch size` مجموعه تعدادی از عناصر که شیب محاسبه خواهد شد و خلاصه به انجام یک مرحله از گرادیان تبار. تبار تصادفی خالص با استفاده از یک عنصر, با این حال داشتن دسته های کوچک(در باره 10 عناصر) را گام شیب پایدار تر. پیشفرض `15`. -4. `method for updating weights` اونا: `Adam` (به طور پیش فرض), `SGD`, `Momentum`, `Nesterov`. `Momentum` و `Nesterov` نیاز به کمی بیشتر محاسبات و حافظه, اما آنها به اتفاق مفید از نظر سرعت convergance و ثبات stochastic gradient روش. - -### استفاده {#agg_functions-stochasticlinearregression-usage} - -`stochasticLinearRegression` در دو مرحله استفاده می شود: اتصالات مدل و پیش بینی بر روی داده های جدید. به منظور متناسب با مدل و صرفه جویی در دولت خود را برای استفاده های بعدی استفاده می کنیم `-State` ترکیب کننده, که اساسا موجب صرفه جویی در دولت (وزن مدل, و غیره). -برای پیش بینی ما با استفاده از تابع [ارزیابی](../functions/machine_learning_functions.md#machine_learning_methods-evalmlmethod), که طول می کشد یک دولت به عنوان یک استدلال و همچنین ویژگی های به پیش بینی در. - - - -**1.** اتصالات - -چنین پرس و جو ممکن است مورد استفاده قرار گیرد. - -``` sql -CREATE TABLE IF NOT EXISTS train_data -( - param1 Float64, - param2 Float64, - target Float64 -) ENGINE = Memory; - -CREATE TABLE your_model ENGINE = Memory AS SELECT -stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) -AS state FROM train_data; -``` - -در اینجا ما همچنین نیاز به وارد کردن داده ها به `train_data` جدول تعداد پارامترهای ثابت نیست, این تنها در تعدادی از استدلال بستگی دارد, گذشت به `linearRegressionState`. همه باید مقادیر عددی باشد. -توجه داشته باشید که ستون با ارزش هدف(که ما می خواهم برای یادگیری به پیش بینی) به عنوان اولین استدلال قرار داده شده است. - -**2.** پیش بینی - -پس از ذخیره یک دولت به جدول, ما ممکن است چندین بار برای پیش بینی استفاده, و یا حتی با کشورهای دیگر ادغام و ایجاد مدل های جدید و حتی بهتر. - -``` sql -WITH (SELECT state FROM your_model) AS model SELECT -evalMLMethod(model, param1, param2) FROM test_data -``` - -پرس و جو یک ستون از مقادیر پیش بینی شده بازگشت. توجه داشته باشید که استدلال اول `evalMLMethod` هست `AggregateFunctionState` هدف, بعدی ستون از ویژگی های هستند. - -`test_data` یک جدول مانند `train_data` اما ممکن است حاوی ارزش هدف نیست. - -### یادداشتها {#agg_functions-stochasticlinearregression-notes} - -1. برای ادغام دو مدل کاربر ممکن است چنین پرس و جو ایجاد کنید: - `sql SELECT state1 + state2 FROM your_models` - کجا `your_models` جدول شامل هر دو مدل. این پرس و جو جدید باز خواهد گشت `AggregateFunctionState` اعتراض. - -2. کاربر ممکن است وزن مدل ایجاد شده برای اهداف خود را بدون صرفه جویی در مدل اگر هیچ واکشی `-State` ترکیب استفاده شده است. - `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` - چنین پرس و جو خواهد مدل مناسب و بازگشت وزن خود را - برای اولین بار وزن هستند, که به پارامترهای مدل مطابقت, یکی از گذشته تعصب است. بنابراین در مثال بالا پرس و جو یک ستون با 3 مقدار بازگشت. - -**همچنین نگاه کنید** - -- [سرکوب مقررات عمومی](#agg_functions-stochasticlogisticregression) -- [تفاوت رگرسیون خطی و لجستیک](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## سرکوب مقررات عمومی {#agg_functions-stochasticlogisticregression} - -این تابع پیاده سازی رگرسیون لجستیک تصادفی. این را می توان برای مشکل طبقه بندی دودویی استفاده, پشتیبانی از پارامترهای سفارشی به عنوان مقررات زدایی و کار به همان شیوه. - -### پارامترها {#agg_functions-stochasticlogisticregression-parameters} - -پارامترها دقیقا مشابه در تنظیم مقررات است: -`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. -برای اطلاعات بیشتر نگاه کنید به [پارامترها](#agg_functions-stochasticlinearregression-parameters). - -``` text -stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') -``` - -1. اتصالات - - - - See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. - - Predicted labels have to be in \[-1, 1\]. - -1. پیش بینی - - - - Using saved state we can predict probability of object having label `1`. - - ``` sql - WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) FROM test_data - ``` - - The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. - - We can also set a bound of probability, which assigns elements to different labels. - - ``` sql - SELECT ans < 1.1 AND ans > 0.5 FROM - (WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) AS ans FROM test_data) - ``` - - Then the result will be labels. - - `test_data` is a table like `train_data` but may not contain target value. - -**همچنین نگاه کنید** - -- [تنظیم مقررات](#agg_functions-stochasticlinearregression) -- [تفاوت بین رگرسیون خطی و لجستیک.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## گروهبیتمافند {#groupbitmapand} - -محاسبات و یک بیت مپ ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapAnd(expr) -``` - -**پارامترها** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` نوع. - -**مقدار بازگشتی** - -ارزش `UInt64` نوع. - -**مثال** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapAnd(z)─┐ -│ 3 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ -│ [6,8,10] │ -└──────────────────────────────────────────────────┘ -``` - -## گروهبیتمافور {#groupbitmapor} - -محاسبات و یا یک بیت مپ ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql_reference/functions/bitmap_functions.md). این معادل است `groupBitmapMerge`. - -``` sql -groupBitmapOr(expr) -``` - -**پارامترها** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` نوع. - -**مقدار بازگشتی** - -ارزش `UInt64` نوع. - -**مثال** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapOr(z)─┐ -│ 15 │ -└──────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ -│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ -└─────────────────────────────────────────────────┘ -``` - -## گروهبیتمافکر {#groupbitmapxor} - -محاسبات xor یک بیت مپ ستون بازگشت cardinality از نوع uint64 اگر اضافه کردن پسوند -دولت بازگشت [شی نگاشت بیت](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapOr(expr) -``` - -**پارامترها** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` نوع. - -**مقدار بازگشتی** - -ارزش `UInt64` نوع. - -**مثال** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapXor(z)─┐ -│ 10 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ -│ [1,3,5,6,8,10,11,13,14,15] │ -└──────────────────────────────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/fa/sql_reference/ansi.md b/docs/fa/sql_reference/ansi.md deleted file mode 120000 index ee0f9c8cb7e..00000000000 --- a/docs/fa/sql_reference/ansi.md +++ /dev/null @@ -1 +0,0 @@ -../../en/sql_reference/ansi.md \ No newline at end of file diff --git a/docs/fa/sql_reference/data_types/aggregatefunction.md b/docs/fa/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index f6430b6658c..00000000000 --- a/docs/fa/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 52 -toc_title: "\u06A9\u0627\u0631\u06A9\u0631\u062F(\u0646\u0627\u0645 \u0648 \u0646\u0627\ - \u0645 \u062E\u0627\u0646\u0648\u0627\u062F\u06AF\u06CC..)" ---- - -# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [مشاهده محقق](../../sql_reference/statements/select.md#create-view). راه معمول برای تولید یک دولت تابع جمع است با فراخوانی تابع جمع با `-State` پسوند. برای دریافت نتیجه نهایی از تجمع در اینده, شما باید همان تابع کل با استفاده از `-Merge`پسوند. - -`AggregateFunction` — parametric data type. - -**پارامترها** - -- نام تابع جمع. - - If the function is parametric, specify its parameters too. - -- انواع استدلال تابع جمع. - -**مثال** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -[دانشگاه](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq). ([هر](../../sql_reference/aggregate_functions/reference.md#agg_function-any)+[اگر](../../sql_reference/aggregate_functions/combinators.md#agg-functions-combinator-if)) و [quantiles](../../sql_reference/aggregate_functions/reference.md) توابع مجموع پشتیبانی در خانه کلیک می باشد. - -## استفاده {#usage} - -### درج داده {#data-insertion} - -برای وارد کردن داده ها استفاده کنید `INSERT SELECT` با مجموع `-State`- توابع . - -**نمونه تابع** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -در مقایسه با توابع مربوطه `uniq` و `quantiles`, `-State`- توابع بازگشت به دولت, به جای ارزش نهایی. به عبارت دیگر ارزش بازگشت `AggregateFunction` نوع. - -در نتایج `SELECT` پرس و جو, ارزش `AggregateFunction` نوع اجرای خاص نمایندگی دودویی برای همه فرمت های خروجی کلیک کنید. اگر کمپرسی داده ها به, مثلا, `TabSeparated` قالب با `SELECT` پرس و جو, سپس این روگرفت را می توان با استفاده از لود `INSERT` پرس و جو. - -### گزینش داده {#data-selection} - -هنگام انتخاب داده ها از `AggregatingMergeTree` جدول استفاده کنید `GROUP BY` بند و همان مجموع توابع به عنوان زمانی که قرار دادن داده اما با استفاده از `-Merge`پسوند. - -یک تابع جمع با `-Merge` پسوند مجموعه ای از ایالت ها را ترکیب می کند و نتیجه تجمع کامل داده ها را باز می گرداند. - -مثلا, دو نمایش داده شد زیر بازگشت به همان نتیجه: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## مثال طریقه استفاده {#usage-example} - -ببینید [ریزدانه](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) موتور باشرکت. - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/fa/sql_reference/data_types/array.md b/docs/fa/sql_reference/data_types/array.md deleted file mode 100644 index 322e806b8ba..00000000000 --- a/docs/fa/sql_reference/data_types/array.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 51 -toc_title: "& \u062A\u0648\u0631\u06CC)" ---- - -# & توری) {#data-type-array} - -مجموعه ای از `T`- نوع اقلام است. `T` می تواند هر نوع داده, از جمله مجموعه. - -## ایجاد یک مجموعه {#creating-an-array} - -شما می توانید یک تابع برای ایجاد مجموعه ای استفاده کنید: - -``` sql -array(T) -``` - -شما همچنین می توانید براکت مربع استفاده کنید. - -``` sql -[] -``` - -نمونه ای از ایجاد یک مجموعه: - -``` sql -SELECT array(1, 2) AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName(array(1, 2))─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴─────────────────────────┘ -``` - -``` sql -SELECT [1, 2] AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName([1, 2])─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴────────────────────┘ -``` - -## کار با انواع داده ها {#working-with-data-types} - -در هنگام ایجاد مجموعه ای در پرواز, خانه رعیتی به طور خودکار نوع استدلال به عنوان باریک ترین نوع داده است که می تواند تمام استدلال ذکر شده ذخیره تعریف. اگر وجود دارد [Nullable](nullable.md#data_type-nullable) یا تحت اللفظی [NULL](../../sql_reference/syntax.md#null-literal) ارزش, نوع عنصر مجموعه ای نیز می شود [Nullable](nullable.md). - -اگر فاحشه خانه می تواند نوع داده را تعیین نمی کند, این تولید یک استثنا. مثلا, این اتفاق می افتد زمانی که تلاش برای ایجاد مجموعه ای با رشته ها و اعداد به طور همزمان (`SELECT array(1, 'a')`). - -نمونه هایی از تشخیص نوع داده ها به صورت خودکار: - -``` sql -SELECT array(1, 2, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ -│ [1,2,NULL] │ Array(Nullable(UInt8)) │ -└────────────┴───────────────────────────────┘ -``` - -اگر شما سعی می کنید برای ایجاد یک آرایه از ناسازگار انواع داده ها clickhouse پرتاب یک استثنا: - -``` sql -SELECT array(1, 'a') -``` - -``` text -Received exception from server (version 1.1.54388): -Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/fa/sql_reference/data_types/datetime.md b/docs/fa/sql_reference/data_types/datetime.md deleted file mode 100644 index d2620b35038..00000000000 --- a/docs/fa/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 48 -toc_title: DateTime ---- - -# تاریخ ساعت {#data_type-datetime} - -اجازه می دهد تا برای ذخیره یک لحظه در زمان, است که می تواند به عنوان یک تاریخ تقویم و یک زمان از یک روز بیان. - -نحو: - -``` sql -DateTime([timezone]) -``` - -محدوده پشتیبانی شده از ارزش ها: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. - -حل: 1 ثانیه. - -## استفاده از سخنان {#usage-remarks} - -نقطه در زمان به عنوان یک ذخیره می شود [برچسب زمان یونیکس](https://en.wikipedia.org/wiki/Unix_time), صرف نظر از منطقه زمانی و یا صرفه جویی در زمان نور روز. علاوه بر این `DateTime` نوع می توانید منطقه زمانی است که همین کار را برای کل ستون ذخیره, که تحت تاثیر قرار چگونه ارزش های `DateTime` مقادیر نوع در قالب متن نمایش داده می شود و چگونه مقادیر مشخص شده به عنوان رشته تجزیه می شوند (‘2020-01-01 05:00:01’). منطقه زمانی در ردیف جدول ذخیره نمی شود (و یا در نتیجه), اما در ابرداده ستون ذخیره می شود. -لیستی از مناطق زمانی پشتیبانی شده را می توان در [اانا پایگاه منطقه زمانی](https://www.iana.org/time-zones). -این `tzdata` بسته حاوی [اانا پایگاه منطقه زمانی](https://www.iana.org/time-zones), باید در سیستم نصب. استفاده از `timedatectl list-timezones` فرمان به لیست جغرافیایی شناخته شده توسط یک سیستم محلی. - -شما به صراحت می توانید یک منطقه زمانی برای `DateTime`- ستون نوع در هنگام ایجاد یک جدول. اگر منطقه زمانی تنظیم نشده است, خانه رعیتی با استفاده از ارزش [منطقهی زمانی](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) پارامتر در تنظیمات سرور و یا تنظیمات سیستم عامل در حال حاضر از شروع سرور کلیک. - -این [کلیک مشتری](../../interfaces/cli.md) اعمال منطقه زمانی سرور به طور پیش فرض اگر یک منطقه زمانی است که به صراحت تنظیم نشده است که مقدار دهی اولیه نوع داده ها. برای استفاده از منطقه زمان مشتری اجرا کنید `clickhouse-client` با `--use_client_time_zone` پارامتر. - -خروجی کلیک ارزش در `YYYY-MM-DD hh:mm:ss` قالب متن به طور پیش فرض. شما می توانید خروجی را با تغییر [formatDateTime](../../sql_reference/functions/date_time_functions.md#formatdatetime) تابع. - -هنگام قرار دادن داده ها به تاتر, شما می توانید فرمت های مختلف تاریخ و زمان رشته استفاده, بسته به ارزش [تغییر \_شماره](../../operations/settings/settings.md#settings-date_time_input_format) تنظیمات. - -## مثالها {#examples} - -**1.** ایجاد یک جدول با یک `DateTime`- ستون را تایپ کنید و داده ها را وارد کنید: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime('Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog; -``` - -``` sql -INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); -``` - -``` sql -SELECT * FROM dt; -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -- هنگام قرار دادن تاریخ ساعت به عنوان یک عدد صحیح, این است که به عنوان برچسب زمان یونیکس درمان (مجموعه مقالات). `1546300800` نشان دهنده `'2019-01-01 00:00:00'` ادا کردن. با این حال, مانند `timestamp` ستون دارد `Europe/Moscow` (مجموعه مقالات+3) منطقه زمانی مشخص, در هنگام خروجی به عنوان رشته ارزش خواهد شد به عنوان نشان داده شده است `'2019-01-01 03:00:00'` -- هنگام قرار دادن مقدار رشته به عنوان تاریخ ساعت, این است که به عنوان بودن در منطقه زمانی ستون درمان. `'2019-01-01 00:00:00'` خواهد شد به عنوان در درمان `Europe/Moscow` منطقه زمانی و ذخیره به عنوان `1546290000`. - -**2.** پالایش بر روی `DateTime` مقادیر - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -`DateTime` مقادیر ستون را می توان با استفاده از یک مقدار رشته در فیلتر `WHERE` مسندکردن. این تبدیل خواهد شد به `DateTime` به طور خودکار: - -``` sql -SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -└─────────────────────┴──────────┘ -``` - -**3.** گرفتن یک منطقه زمانی برای یک `DateTime`- نوع ستون: - -``` sql -SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────column─┬─x─────────────────────────┐ -│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ -└─────────────────────┴───────────────────────────┘ -``` - -**4.** تبدیل منطقه زمانی - -``` sql -SELECT -toDateTime(timestamp, 'Europe/London') as lon_time, -toDateTime(timestamp, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────lon_time──┬────────────mos_time─┐ -│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ -│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ -└─────────────────────┴─────────────────────┘ -``` - -## همچنین نگاه کنید به {#see-also} - -- [توابع تبدیل نوع](../../sql_reference/functions/type_conversion_functions.md) -- [توابع برای کار با تاریخ و زمان](../../sql_reference/functions/date_time_functions.md) -- [توابع کار با آرایه ها](../../sql_reference/functions/array_functions.md) -- [این `date_time_input_format` تنظیم](../../operations/settings/settings.md#settings-date_time_input_format) -- [این `timezone` پارامتر پیکربندی سرور](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [اپراتورها برای کار با تاریخ و زمان](../../sql_reference/operators.md#operators-datetime) -- [این `Date` نوع داده](date.md) - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/fa/sql_reference/data_types/datetime64.md b/docs/fa/sql_reference/data_types/datetime64.md deleted file mode 100644 index 6e2ddaf9447..00000000000 --- a/docs/fa/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 49 -toc_title: "\u0637\u0648\u0644 \u062A\u0627\u0631\u06CC\u062E 64" ---- - -# طول تاریخ 64 {#data_type-datetime64} - -اجازه می دهد تا برای ذخیره یک لحظه در زمان, است که می تواند به عنوان یک تاریخ تقویم و یک زمان از یک روز بیان, با دقت زیر دوم تعریف شده - -اندازه تیک (دقت): 10- دقت ثانیه - -نحو: - -``` sql -DateTime64(precision, [timezone]) -``` - -داخلی, ذخیره داده ها به عنوان تعدادی از ‘ticks’ از عصر شروع (1970-01-01 00:00:00 یو تی سی) به عنوان اینترنشنال64. وضوح تیک توسط پارامتر دقیق تعیین می شود. علاوه بر این `DateTime64` نوع می توانید منطقه زمانی است که همین کار را برای کل ستون ذخیره, که تحت تاثیر قرار چگونه ارزش های `DateTime64` مقادیر نوع در قالب متن نمایش داده می شود و چگونه مقادیر مشخص شده به عنوان رشته تجزیه می شوند (‘2020-01-01 05:00:01.000’). منطقه زمانی در ردیف جدول ذخیره نمی شود (و یا در نتیجه), اما در ابرداده ستون ذخیره می شود. مشاهده اطلاعات در [DateTime](datetime.md). - -## مثالها {#examples} - -**1.** ایجاد یک جدول با `DateTime64`- ستون را تایپ کنید و داده ها را وارد کنید: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- هنگام قرار دادن تاریخ ساعت به عنوان یک عدد صحیح, این است که به عنوان یک مناسب کوچک برچسب زمان یونیکس درمان (مجموعه مقالات). `1546300800000` (با دقت 3) نشان دهنده `'2019-01-01 00:00:00'` ادا کردن. با این حال, مانند `timestamp` ستون دارد `Europe/Moscow` (مجموعه مقالات+3) منطقه زمانی مشخص, در هنگام خروجی به عنوان یک رشته ارزش خواهد شد به عنوان نشان داده شده است `'2019-01-01 03:00:00'` -- هنگام قرار دادن مقدار رشته به عنوان تاریخ ساعت, این است که به عنوان بودن در منطقه زمانی ستون درمان. `'2019-01-01 00:00:00'` خواهد شد به عنوان در درمان `Europe/Moscow` منطقه زمانی و ذخیره شده به عنوان `1546290000000`. - -**2.** پالایش بر روی `DateTime64` مقادیر - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -برخلاف `DateTime`, `DateTime64` ارزش ها از تبدیل نمی `String` به طور خودکار - -**3.** گرفتن یک منطقه زمانی برای یک `DateTime64`- مقدار نوع: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** تبدیل منطقه زمانی - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## همچنین نگاه کنید {#see-also} - -- [توابع تبدیل نوع](../../sql_reference/functions/type_conversion_functions.md) -- [توابع برای کار با تاریخ و زمان](../../sql_reference/functions/date_time_functions.md) -- [توابع برای کار با ارریس](../../sql_reference/functions/array_functions.md) -- [این `date_time_input_format` تنظیم](../../operations/settings/settings.md#settings-date_time_input_format) -- [این `timezone` پارامتر پیکربندی سرور](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [اپراتورها برای کار با تاریخ و زمان](../../sql_reference/operators.md#operators-datetime) -- [`Date` نوع داده](date.md) -- [`DateTime` نوع داده](datetime.md) diff --git a/docs/fa/sql_reference/data_types/enum.md b/docs/fa/sql_reference/data_types/enum.md deleted file mode 100644 index e468c910106..00000000000 --- a/docs/fa/sql_reference/data_types/enum.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 50 -toc_title: "\u0634\u0645\u0627\u0631\u0634\u06CC" ---- - -# شمارشی {#enum} - -نوع شمارش متشکل از ارزش به نام. - -مقادیر نام شده باید به عنوان اعلام شود `'string' = integer` جفت انبار فروشگاه تنها اعداد, اما پشتیبانی از عملیات با ارزش از طریق نام خود را. - -پشتیبانی از کلیک: - -- 8 بیتی `Enum`. این می تواند تا 256 مقدار شمارش شده در `[-128, 127]` محدوده. -- 16 بیتی `Enum`. این می تواند تا 65536 مقدار شمارش شده در `[-32768, 32767]` محدوده. - -تاتر به طور خودکار انتخاب نوع `Enum` هنگامی که داده درج شده است. شما همچنین می توانید استفاده کنید `Enum8` یا `Enum16` انواع برای اطمینان در اندازه ذخیره سازی. - -## نمونه های استفاده {#usage-examples} - -در اینجا ما یک جدول با یک ایجاد می کنیم `Enum8('hello' = 1, 'world' = 2)` نوع ستون: - -``` sql -CREATE TABLE t_enum -( - x Enum('hello' = 1, 'world' = 2) -) -ENGINE = TinyLog -``` - -ستون `x` فقط می توانید مقادیر که در تعریف نوع ذکر شده را ذخیره کنید: `'hello'` یا `'world'`. اگر شما سعی می کنید برای صرفه جویی در هر مقدار دیگر, کلیک یک استثنا بالا می برد. اندازه 8 بیتی برای این `Enum` به طور خودکار انتخاب شده است. - -``` sql -INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') -``` - -``` text -Ok. -``` - -``` sql -INSERT INTO t_enum values('a') -``` - -``` text -Exception on client: -Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) -``` - -هنگامی که شما پرس و جو داده ها را از جدول, تاتر خروجی مقادیر رشته از `Enum`. - -``` sql -SELECT * FROM t_enum -``` - -``` text -┌─x─────┐ -│ hello │ -│ world │ -│ hello │ -└───────┘ -``` - -اگر شما نیاز به دیدن معادل عددی از ردیف, شما باید بازیگران `Enum` ارزش به نوع صحیح. - -``` sql -SELECT CAST(x, 'Int8') FROM t_enum -``` - -``` text -┌─CAST(x, 'Int8')─┐ -│ 1 │ -│ 2 │ -│ 1 │ -└─────────────────┘ -``` - -برای ایجاد یک مقدار شمارشی در پرس و جو, شما همچنین نیاز به استفاده از `CAST`. - -``` sql -SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) -``` - -``` text -┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ -│ Enum8('a' = 1, 'b' = 2) │ -└─────────────────────────────────────────────────────┘ -``` - -## قوانین عمومی و استفاده {#general-rules-and-usage} - -هر یک از مقادیر یک عدد در محدوده اختصاص داده شده است `-128 ... 127` برای `Enum8` یا در محدوده `-32768 ... 32767` برای `Enum16`. همه رشته ها و اعداد باید متفاوت باشد. یک رشته خالی مجاز است. اگر این نوع مشخص شده است (در یک تعریف جدول), اعداد را می توان در جهت دلخواه. با این حال, سفارش مهم نیست. - -نه رشته و نه مقدار عددی در یک `Enum` می تواند باشد [NULL](../../sql_reference/syntax.md). - -یک `Enum` می توان در [Nullable](nullable.md) نوع. بنابراین اگر شما یک جدول با استفاده از پرس و جو ایجاد کنید - -``` sql -CREATE TABLE t_enum_nullable -( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) -) -ENGINE = TinyLog -``` - -این می تواند نه تنها ذخیره `'hello'` و `'world'` اما `NULL` همینطور - -``` sql -INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) -``` - -در رم `Enum` ستون به همان شیوه ذخیره می شود `Int8` یا `Int16` از مقادیر عددی مربوطه. - -هنگام خواندن در فرم متن, تاتر تجزیه ارزش به عنوان یک رشته و جستجو برای رشته مربوطه را از مجموعه ای از ارزش شمارشی. اگر یافت نشد, یک استثنا پرتاب می شود. هنگام خواندن در قالب متن, رشته به عنوان خوانده شده و مقدار عددی مربوطه نگاه کردن. یک استثنا پرتاب خواهد شد اگر یافت نشد. -هنگام نوشتن در فرم متن, این ارزش به عنوان رشته مربوطه می نویسد. اگر داده های ستون شامل زباله (اعداد است که از مجموعه معتبر نیست), یک استثنا پرتاب می شود. زمانی که خواندن و نوشتن در فایل باینری فرم آن را با این نسخهها کار به همان روش برای int8 و int16 انواع داده ها. -مقدار پیش فرض ضمنی ارزش با کمترین تعداد است. - -در طول `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` و به همین ترتیب, مادران رفتار به همان شیوه به عنوان اعداد مربوطه. مثلا, سفارش شده توسط انواع عددی. اپراتورهای برابری و مقایسه کار به همان شیوه در مادران به عنوان در مقادیر عددی اساسی انجام. - -مقادیر شمارشی را نمی توان با اعداد مقایسه شده است. شمارشی را می توان به یک رشته ثابت در مقایسه. اگر رشته در مقایسه با یک مقدار معتبر برای شمارشی نیست, یک استثنا پرتاب خواهد شد. اپراتور در با شمارشی در سمت چپ و مجموعه ای از رشته ها در سمت راست پشتیبانی می شود. رشته ارزش مربوط شمارشی هستند. - -Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. -با این حال, شمارشی طبیعی است `toString` تابع است که ارزش رشته خود را برمی گرداند. - -مقادیر شمارشی نیز قابل تبدیل به انواع عددی با استفاده از `toT` تابع, که تی یک نوع عددی است. هنگامی که تی مربوط به نوع عددی اساسی شمارشی است, این تبدیل صفر هزینه است. -نوع شمارشی را می توان بدون هزینه با استفاده از تغییر تغییر, اگر تنها مجموعه ای از ارزش تغییر است. ممکن است که به هر دو اضافه کردن و حذف اعضای شمارشی با استفاده از تغییر (از بین بردن امن است تنها در صورتی که مقدار حذف شده است هرگز در جدول استفاده می شود). به عنوان یک حفاظت, تغییر مقدار عددی از یک عضو شمارشی که قبلا تعریف یک استثنا پرتاب. - -با استفاده از تغییر آن را ممکن است برای تغییر یک enum8 به enum16 یا بالعکس فقط مانند تغییر یک int8 به int16. - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/fa/sql_reference/data_types/fixedstring.md b/docs/fa/sql_reference/data_types/fixedstring.md deleted file mode 100644 index e151008822c..00000000000 --- a/docs/fa/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: "\u0631\u0634\u062A\u0647 \u062B\u0627\u0628\u062A)" ---- - -# رشته ثابت {#fixedstring} - -یک رشته ثابت طول `N` بایت (نه شخصیت و نه نقاط کد). - -برای اعلام یک ستون از `FixedString` نوع, استفاده از نحو زیر: - -``` sql - FixedString(N) -``` - -کجا `N` یک عدد طبیعی است. - -این `FixedString` نوع زمانی موثر است که داده ها طول دقیق داشته باشند `N` بایت در تمام موارد دیگر, این احتمال وجود دارد به کاهش بهره وری. - -نمونه هایی از مقادیر است که می تواند موثر در ذخیره می شود `FixedString`- ستون های تایپ شده: - -- نمایندگی دودویی نشانی های اینترنتی (`FixedString(16)` برای ایپو6). -- Language codes (ru\_RU, en\_US … ). -- Currency codes (USD, RUB … ). -- نمایش دودویی رشته هش (`FixedString(16)` برای ام دی 5, `FixedString(32)` برای شی256). - -برای ذخیره مقادیر یوید از [UUID](uuid.md) نوع داده. - -هنگام قرار دادن داده ها, تاتر: - -- مکمل یک رشته با null بایت اگر رشته شامل کمتر از `N` بایت -- پرتاب `Too large value for FixedString(N)` استثنا اگر رشته شامل بیش از `N` بایت - -در هنگام انتخاب داده, تاتر می کند بایت پوچ در پایان رشته را حذف کنید. اگر شما استفاده از `WHERE` بند, شما باید بایت پوچ دستی اضافه برای مطابقت با `FixedString` ارزش. مثال زیر نشان میدهد که چگونه به استفاده از `WHERE` بند با `FixedString`. - -بیایید جدول زیر را با تک در نظر بگیریم `FixedString(2)` ستون: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -پرسوجو `SELECT * FROM FixedStringTable WHERE a = 'b'` هیچ داده به عنوان یک نتیجه نمی گرداند. ما باید الگوی فیلتر با بایت پوچ تکمیل. - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -این رفتار از خروجی زیر برای متفاوت `CHAR` نوع (جایی که رشته ها با فضاهای خالی, و فضاهای برای خروجی حذف). - -توجه داشته باشید که طول `FixedString(N)` ارزش ثابت است. این [طول](../../sql_reference/functions/array_functions.md#array_functions-length) بازده عملکرد `N` حتی اگر `FixedString(N)` ارزش تنها با بایت پوچ پر, اما [خالی](../../sql_reference/functions/string_functions.md#empty) بازده عملکرد `1` در این مورد. - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/fa/sql_reference/data_types/nested_data_structures/nested.md b/docs/fa/sql_reference/data_types/nested_data_structures/nested.md deleted file mode 100644 index 8d5b9897781..00000000000 --- a/docs/fa/sql_reference/data_types/nested_data_structures/nested.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 57 -toc_title: "\u062A\u0648 \u062F\u0631 \u062A\u0648(Name1 Type1, Name2 Type2, ...)" ---- - -# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) پرس و جو. هر سطر جدول می تواند به هر تعداد از ردیف در یک ساختار داده تو در تو مطابقت. - -مثال: - -``` sql -CREATE TABLE test.visits -( - CounterID UInt32, - StartDate Date, - Sign Int8, - IsNew UInt8, - VisitID UInt64, - UserID UInt64, - ... - Goals Nested - ( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32 - ), - ... -) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) -``` - -این مثال اعلام کرد `Goals` ساختار داده های تو در تو, که شامل داده ها در مورد تبدیل (اهداف رسیده). هر سطر در ‘visits’ جدول می تواند به صفر یا هر تعداد از تبدیل مطابقت دارد. - -فقط یک سطح تودرتو تک پشتیبانی می شود. ستون های سازه های تو در تو حاوی ارریس معادل چندین بعدی هستند بنابراین پشتیبانی محدودی دارند (هیچ پشتیبانی ای برای ذخیره این ستون ها در جداول با موتور ادغام وجود ندارد). - -در بیشتر موارد, در هنگام کار با یک ساختار داده های تو در تو, ستون خود را با نام ستون جدا شده توسط یک نقطه مشخص. این ستون ها مجموعه ای از انواع تطبیق را تشکیل می دهند. تمام ستون ها از یک ساختار داده های تو در تو یکسان هستند. - -مثال: - -``` sql -SELECT - Goals.ID, - Goals.EventTime -FROM test.visits -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ -│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ -│ [1073752] │ ['2014-03-17 00:28:25'] │ -│ [1073752] │ ['2014-03-17 10:46:20'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ -│ [] │ [] │ -│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ -│ [] │ [] │ -│ [] │ [] │ -│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ -└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -ساده ترین راه این است که از یک ساختار داده های تو در تو فکر می کنم به عنوان مجموعه ای از مجموعه ای از مجموعه های ستون های متعدد از همان طول. - -تنها جایی که پرس و جو را انتخاب کنید می توانید نام کل ساختار داده های تو در تو به جای ستون های فردی مشخص مجموعه ملحق بند. برای کسب اطلاعات بیشتر, دیدن “ARRAY JOIN clause”. مثال: - -``` sql -SELECT - Goal.ID, - Goal.EventTime -FROM test.visits -ARRAY JOIN Goals AS Goal -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goal.ID─┬──────Goal.EventTime─┐ -│ 1073752 │ 2014-03-17 16:38:10 │ -│ 591325 │ 2014-03-17 16:38:48 │ -│ 591325 │ 2014-03-17 16:42:27 │ -│ 1073752 │ 2014-03-17 00:28:25 │ -│ 1073752 │ 2014-03-17 10:46:20 │ -│ 1073752 │ 2014-03-17 13:59:20 │ -│ 591325 │ 2014-03-17 22:17:55 │ -│ 591325 │ 2014-03-17 22:18:07 │ -│ 591325 │ 2014-03-17 22:18:51 │ -│ 1073752 │ 2014-03-17 11:37:06 │ -└─────────┴─────────────────────┘ -``` - -شما نمی توانید انتخاب کنید برای کل ساختار داده های تو در تو انجام دهد. شما فقط می توانید به صراحت ستون های فردی را که بخشی از این هستند لیست کنید. - -برای پرس و جو درج, شما باید تمام عناصر ستون مولفه از یک ساختار داده های تو در تو به طور جداگانه منتقل (در صورتی که مجموعه فردی بودند). در حین درج سیستم چک می کند که همان طول را دارند. - -برای پرس و جو توصیف, ستون در یک ساختار داده های تو در تو به طور جداگانه در همان راه ذکر شده. - -پرس و جو را تغییر دهید برای عناصر در یک ساختار داده های تو در تو دارای محدودیت. - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/fa/sql_reference/data_types/nullable.md b/docs/fa/sql_reference/data_types/nullable.md deleted file mode 100644 index 987f338c07e..00000000000 --- a/docs/fa/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: Nullable ---- - -# Nullable(typename) {#data_type-nullable} - -اجازه می دهد تا برای ذخیره نشانگر ویژه ([NULL](../../sql_reference/syntax.md)) که نشان دهنده “missing value” در کنار مقادیر عادی مجاز `TypeName`. برای مثال یک `Nullable(Int8)` ستون نوع می تواند ذخیره شود `Int8` ارزش نوع و ردیف است که ارزش ذخیره خواهد شد `NULL`. - -برای یک `TypeName` شما نمی توانید از انواع داده های کامپوزیت استفاده کنید [& حذف](array.md) و [تاپل](tuple.md). انواع داده های کامپوزیت می تواند شامل `Nullable` مقادیر نوع مانند `Array(Nullable(Int8))`. - -A `Nullable` فیلد نوع را نمی توان در شاخص های جدول گنجانده شده است. - -`NULL` مقدار پیش فرض برای هر `Nullable` نوع, مگر اینکه در غیر این صورت در پیکربندی سرور کلیک مشخص. - -## ویژگی های ذخیره سازی {#storage-features} - -برای ذخیره `Nullable` ارزش نوع در یک ستون جدول, تاتر با استفاده از یک فایل جداگانه با `NULL` ماسک علاوه بر فایل عادی با ارزش. مطالب در ماسک فایل اجازه می دهد خانه کلیک برای تشخیص بین `NULL` و یک مقدار پیش فرض از نوع داده مربوطه را برای هر سطر جدول. به دلیل یک فایل اضافی, `Nullable` ستون مصرف فضای ذخیره سازی اضافی در مقایسه با یک نرمال مشابه. - -!!! info "یادداشت" - با استفاده از `Nullable` تقریبا همیشه منفی تاثیر می گذارد عملکرد, نگه داشتن این در ذهن در هنگام طراحی پایگاه داده های خود را. - -## مثال طریقه استفاده {#usage-example} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y FROM t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/fa/sql_reference/data_types/simpleaggregatefunction.md b/docs/fa/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 120000 index 02fad64d50e..00000000000 --- a/docs/fa/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/sql_reference/data_types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/fa/sql_reference/data_types/special_data_types/interval.md b/docs/fa/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index 7c108a72641..00000000000 --- a/docs/fa/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 61 -toc_title: "\u0641\u0627\u0635\u0644\u0647" ---- - -# فاصله {#data-type-interval} - -خانواده از انواع داده ها به نمایندگی از فواصل زمان و تاریخ. انواع حاصل از [INTERVAL](../../../sql_reference/operators.md#operator-interval) اپراتور - -!!! warning "اخطار" - `Interval` مقادیر نوع داده را نمی توان در جداول ذخیره کرد. - -ساختار: - -- فاصله زمانی به عنوان یک مقدار عدد صحیح بدون علامت. -- نوع یک بازه ی زمانی. - -انواع فاصله پشتیبانی شده: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -برای هر نوع فاصله, یک نوع داده جداگانه وجود دارد. برای مثال `DAY` فاصله مربوط به `IntervalDay` نوع داده: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## اظهارات طریقه استفاده {#data-type-interval-usage-remarks} - -شما می توانید استفاده کنید `Interval`- ارزش نوع در عملیات ریاضی با [تاریخ](../../../sql_reference/data_types/date.md) و [DateTime](../../../sql_reference/data_types/datetime.md)- ارزش نوع . مثلا, شما می توانید اضافه کنید 4 روز به زمان فعلی: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -فواصل با انواع مختلف نمی تواند ترکیب شود. شما می توانید فواصل مانند استفاده کنید `4 DAY 1 HOUR`. تعیین فواصل در واحد هایی که کوچکتر یا مساوی به کوچکترین واحد از فاصله مثلا فاصله `1 day and an hour` فاصله را می توان به عنوان بیان شده است `25 HOUR` یا `90000 SECOND`. - -شما می توانید عملیات ریاضی با انجام نمی `Interval`- ارزش نوع, اما شما می توانید فواصل از انواع مختلف در نتیجه به ارزش در اضافه `Date` یا `DateTime` انواع داده ها. به عنوان مثال: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -پرس و جوی زیر باعث می شود یک استثنا: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## همچنین نگاه کنید به {#see-also} - -- [INTERVAL](../../../sql_reference/operators.md#operator-interval) اپراتور -- [توینتروال](../../../sql_reference/functions/type_conversion_functions.md#function-tointerval) توابع تبدیل نوع diff --git a/docs/fa/sql_reference/data_types/special_data_types/nothing.md b/docs/fa/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index eff72a116ea..00000000000 --- a/docs/fa/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 60 -toc_title: "\u0647\u06CC\u0686 \u0686\u06CC\u0632" ---- - -# هیچی {#nothing} - -تنها هدف از این نوع داده ها نشان دهنده مواردی است که انتظار نمی رود ارزش باشد. بنابراین شما می توانید یک ایجاد کنید `Nothing` نوع ارزش. - -مثلا, تحت اللفظی [NULL](../../../sql_reference/syntax.md#null-literal) دارای نوع `Nullable(Nothing)`. اطلاعات بیشتر در مورد [Nullable](../../../sql_reference/data_types/nullable.md). - -این `Nothing` نوع نیز می تواند مورد استفاده برای نشان دادن خالی: - -``` sql -SELECT toTypeName(array()) -``` - -``` text -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/fa/sql_reference/data_types/special_data_types/set.md b/docs/fa/sql_reference/data_types/special_data_types/set.md deleted file mode 100644 index a3146c4a321..00000000000 --- a/docs/fa/sql_reference/data_types/special_data_types/set.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 59 -toc_title: "\u062A\u0646\u0638\u06CC\u0645" ---- - -# تنظیم {#set} - -مورد استفاده برای نیمه راست یک [IN](../../../sql_reference/statements/select.md#select-in-operators) اصطلاح. - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/fa/sql_reference/data_types/tuple.md b/docs/fa/sql_reference/data_types/tuple.md deleted file mode 100644 index c971a5432fe..00000000000 --- a/docs/fa/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 53 -toc_title: "\u062A\u0627\u067E\u0644 (\u062A\u06CC1, \u062A\u06CC2,...)" ---- - -# Tuple(t1, T2, …) {#tuplet1-t2} - -یک تاپل از عناصر, هر یک با داشتن یک فرد [نوع](index.md#data_types). - -تاپل برای گروه بندی ستون موقت استفاده می شود. ستون ها را می توان گروه بندی کرد زمانی که یک عبارت در یک پرس و جو استفاده می شود, و برای مشخص کردن پارامترهای رسمی خاصی از توابع لامبدا. برای کسب اطلاعات بیشتر به بخش ها مراجعه کنید [در اپراتورها](../../sql_reference/statements/select.md) و [توابع سفارش بالاتر](../../sql_reference/functions/higher_order_functions.md). - -تاپل می تواند در نتیجه یک پرس و جو. در این مورد, برای فرمت های متنی غیر از جانسون, ارزش کاما از هم جدا در براکت. در فرمت های جوسون, تاپل خروجی به عنوان ارریس هستند (در براکت مربع). - -## ایجاد یک تاپل {#creating-a-tuple} - -شما می توانید یک تابع برای ایجاد یک تاپل استفاده کنید: - -``` sql -tuple(T1, T2, ...) -``` - -نمونه ای از ایجاد یک تاپل: - -``` sql -SELECT tuple(1,'a') AS x, toTypeName(x) -``` - -``` text -┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ -│ (1,'a') │ Tuple(UInt8, String) │ -└─────────┴───────────────────────────┘ -``` - -## کار با انواع داده ها {#working-with-data-types} - -در هنگام ایجاد یک تاپل در پرواز, تاتر به طور خودکار نوع هر استدلال به عنوان حداقل از انواع که می تواند ارزش استدلال ذخیره تشخیص. اگر استدلال است [NULL](../../sql_reference/syntax.md#null-literal), نوع عنصر تاپل است [Nullable](nullable.md). - -نمونه ای از تشخیص نوع داده ها به صورت خودکار: - -``` sql -SELECT tuple(1, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ -│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ -└──────────┴─────────────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/fa/sql_reference/data_types/uuid.md b/docs/fa/sql_reference/data_types/uuid.md deleted file mode 100644 index c8ed8a7cf79..00000000000 --- a/docs/fa/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 46 -toc_title: UUID ---- - -# UUID {#uuid-data-type} - -شناسه جهانی منحصر به فرد (شناسه) یک عدد 16 بایت مورد استفاده برای شناسایی سوابق است. برای کسب اطلاعات دقیق در مورد شناسه, دیدن [ویکیپدیا](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -نمونه ای از ارزش نوع شناسه در زیر نشان داده شده است: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -اگر شما مقدار ستون شناسه مشخص نیست در هنگام قرار دادن یک رکورد جدید, ارزش شناسه با صفر پر: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## چگونه برای تولید {#how-to-generate} - -برای تولید ارزش شناسه, خانه فراهم می کند [جنراتیدو4](../../sql_reference/functions/uuid_functions.md) تابع. - -## مثال طریقه استفاده {#usage-example} - -**مثال 1** - -این مثال نشان می دهد ایجاد یک جدول با ستون نوع شناسه و قرار دادن یک مقدار به جدول. - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**مثال 2** - -در این مثال مقدار ستون یوید هنگام وارد کردن یک رکورد جدید مشخص نشده است. - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## محدودیت ها {#restrictions} - -نوع داده شناسه تنها پشتیبانی از توابع که [رشته](string.md) نوع داده نیز پشتیبانی می کند (به عنوان مثال, [کمینه](../../sql_reference/aggregate_functions/reference.md#agg_function-min), [حداکثر](../../sql_reference/aggregate_functions/reference.md#agg_function-max) و [شمارش](../../sql_reference/aggregate_functions/reference.md#agg_function-count)). - -نوع داده یوید توسط عملیات ریاضی پشتیبانی نمی شود (به عنوان مثال, [شکم](../../sql_reference/functions/arithmetic_functions.md#arithm_func-abs)) و یا توابع دانه, مانند [جمع](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) و [میانگین](../../sql_reference/aggregate_functions/reference.md#agg_function-avg). - -[مقاله اصلی](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index 0022f8186a6..00000000000 --- a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u062A\u0648\u0636\u06CC\u062D\u0627\u062A \u06A9\u0644\u06CC" ---- - -# واژهنامهها خارجی {#dicts-external-dicts} - -شما می توانید لغت نامه خود را از منابع داده های مختلف اضافه کنید. منبع داده برای یک فرهنگ لغت می تواند یک متن محلی و یا فایل اجرایی, یک منبع اچتیتیپی(بازدید کنندگان), یا سندرم داون دیگر. برای کسب اطلاعات بیشتر, دیدن “[منابع لغت نامه های خارجی](external_dicts_dict_sources.md)”. - -فاحشه خانه: - -- به طور کامل و یا تا حدی فروشگاه لغت نامه در رم. -- دوره به روز رسانی لغت نامه ها و به صورت پویا بارهای ارزش از دست رفته. به عبارت دیگر, لغت نامه را می توان به صورت پویا لود. -- اجازه می دهد تا برای ایجاد لغت نامه های خارجی با فایل های میلی لیتر و یا [نمایش داده شد](../../statements/create.md#create-dictionary-query). - -پیکربندی لغت نامه های خارجی را می توان در یک یا چند میلی لیتر فایل واقع شده است. مسیر پیکربندی در مشخص [دیکشنامهای](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_config) پارامتر. - -واژهنامهها را می توان در هنگام راه اندازی سرور و یا در اولین استفاده لود, بسته به [\_بارگیری کامل](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) تنظیمات. - -فایل پیکربندی فرهنگ لغت دارای فرمت زیر است: - -``` xml - - An optional element with any content. Ignored by the ClickHouse server. - - - /etc/metrika.xml - - - - - - - - -``` - -شما می توانید [پیکربندی](external_dicts_dict.md) هر تعداد از لغت نامه ها در همان فایل. - -[نمایش داده شد دی ال برای لغت نامه](../../statements/create.md#create-dictionary-query) هیچ پرونده اضافی در پیکربندی سرور نیاز ندارد. اجازه می دهد برای کار با لغت نامه به عنوان نهادهای طبقه اول, مانند جداول و یا دیدگاه. - -!!! attention "توجه" - شما می توانید مقادیر را برای یک فرهنگ لغت کوچک با توصیف در یک تبدیل کنید `SELECT` پرسوجو (نگاه کنید به [تبدیل](../../../sql_reference/functions/other_functions.md) تابع). این قابلیت به لغت نامه های خارجی مربوط نیست. - -## همچنین نگاه کنید به {#ext-dicts-see-also} - -- [پیکربندی یک فرهنگ لغت خارجی](external_dicts_dict.md) -- [ذخیره واژهنامهها در حافظه](external_dicts_dict_layout.md) -- [به روز رسانی فرهنگ لغت](external_dicts_dict_lifetime.md) -- [منابع لغت نامه های خارجی](external_dicts_dict_sources.md) -- [کلید فرهنگ لغت و زمینه های](external_dicts_dict_structure.md) -- [توابع برای کار با لغت نامه های خارجی](../../../sql_reference/functions/ext_dict_functions.md) - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index a33d3f4c18d..00000000000 --- a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u067E\u06CC\u06A9\u0631\u0628\u0646\u062F\u06CC \u06CC\u06A9 \u0641\u0631\ - \u0647\u0646\u06AF \u0644\u063A\u062A \u062E\u0627\u0631\u062C\u06CC" ---- - -# پیکربندی یک فرهنگ لغت خارجی {#dicts-external-dicts-dict} - -اگر فرهنگ لغت با استفاده از فایل میلی لیتر پیکربندی, از پیکربندی فرهنگ لغت دارای ساختار زیر: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -متناظر [توصیف](../../statements/create.md#create-dictionary-query) دارای ساختار زیر است: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. -- [متن](external_dicts_dict_sources.md) — Source of the dictionary. -- [طرحبندی](external_dicts_dict_layout.md) — Dictionary layout in memory. -- [ساختار](external_dicts_dict_structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. -- [طول عمر](external_dicts_dict_lifetime.md) — Frequency of dictionary updates. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index 15120b3e8c2..00000000000 --- a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: "\u0644\u063A\u062A\u0646\u0627\u0645\u0647\u0647\u0627 \u0633\u0644\u0633\ - \u0644\u0647 \u0645\u0631\u0627\u062A\u0628\u06CC" ---- - -# لغتنامهها سلسله مراتبی {#hierarchical-dictionaries} - -کلیک هاوس از لغت نامه های سلسله مراتبی با یک [کلید عددی](external_dicts_dict_structure.md#ext_dict-numeric-key). - -در ساختار سلسله مراتبی زیر نگاه کنید: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -این سلسله مراتب را می توان به عنوان جدول فرهنگ لغت زیر بیان شده است. - -| \_ورود | \_ نواحی | نام \_خانوادگی | -|--------|----------|----------------| -| 1 | 0 | روسیه | -| 2 | 1 | مسکو | -| 3 | 2 | مرکز | -| 4 | 0 | بریتانیا | -| 5 | 4 | لندن | - -این جدول شامل یک ستون است `parent_region` که شامل کلید نزدیکترین پدر و مادر برای عنصر. - -تاتر از [سلسله مراتبی](external_dicts_dict_structure.md#hierarchical-dict-attr) املاک برای [فرهنگ لغت خارجی](index.md) صفات. این ویژگی اجازه می دهد تا شما را به پیکربندی فرهنگ لغت سلسله مراتبی شبیه به بالا توضیح داده شد. - -این [حکومت دیکتاتوری](../../../sql_reference/functions/ext_dict_functions.md#dictgethierarchy) تابع اجازه می دهد تا شما را به زنجیره پدر و مادر از یک عنصر. - -برای مثال ما ساختار فرهنگ لغت می تواند به شرح زیر است: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index b1bbf407f7c..00000000000 --- a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,374 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 41 -toc_title: "\u0630\u062E\u06CC\u0631\u0647 \u0648\u0627\u0698\u0647\u0646\u0627\u0645\ - \u0647\u0647\u0627 \u062F\u0631 \u062D\u0627\u0641\u0638\u0647" ---- - -# ذخیره واژهنامهها در حافظه {#dicts-external-dicts-dict-layout} - -راه های مختلفی برای ذخیره لغت نامه ها در حافظه وجود دارد. - -ما توصیه می کنیم [تخت](#flat), [درهم](#dicts-external_dicts_dict_layout-hashed) و [\_ساخت مجتمع](#complex-key-hashed). که سرعت پردازش بهینه را فراهم می کند. - -ذخیره سازی به دلیل عملکرد بالقوه ضعیف و مشکلات در انتخاب پارامترهای مطلوب توصیه نمی شود. ادامه مطلب در بخش “[نهانگاه](#cache)”. - -راه های مختلفی برای بهبود عملکرد فرهنگ لغت وجود دارد: - -- پاسخ تابع برای کار با فرهنگ لغت پس از `GROUP BY`. -- علامت گذاری به عنوان ویژگی برای استخراج به عنوان تزریقی. یک ویژگی است که به نام عاطفی اگر مقادیر ویژگی های مختلف به کلید های مختلف مطابقت دارد. بنابراین زمانی که `GROUP BY` با استفاده از یک تابع است که بازخوانی ارزش ویژگی های کلیدی, این تابع به طور خودکار از گرفته `GROUP BY`. - -تاتر تولید یک استثنا برای خطا با لغت نامه. نمونه هایی از اشتباهات: - -- فرهنگ لغت در حال دسترسی نمی تواند لود شود. -- خطای پرسوجو یک `cached` فرهنگ لغت. - -شما می توانید لیستی از لغت نامه های خارجی و وضعیت خود را در `system.dictionaries` جدول - -پیکربندی به نظر می رسد مثل این: - -``` xml - - - ... - - - - - - ... - - -``` - -متناظر [توصیف](../../statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## راه هایی برای ذخیره لغت نامه ها در حافظه {#ways-to-store-dictionaries-in-memory} - -- [تخت](#flat) -- [درهم](#dicts-external_dicts_dict_layout-hashed) -- [فشردهسازی](#dicts-external_dicts_dict_layout-sparse_hashed) -- [نهانگاه](#cache) -- [رنگها](#range-hashed) -- [\_ساخت مجتمع](#complex-key-hashed) -- [\_پیچید\_چهای پیچیده](#complex-key-cache) -- [شمال اروپا](#ip-trie) - -### تخت {#flat} - -فرهنگ لغت به طور کامل در حافظه در قالب مجموعه تخت ذخیره می شود. چقدر حافظه استفاده از فرهنگ لغت? مقدار متناسب با اندازه بزرگترین کلید است (در فضا استفاده می شود). - -کلید فرهنگ لغت است `UInt64` نوع و ارزش محدود به 500,000 است. اگر یک کلید بزرگتر کشف شده است در هنگام ایجاد فرهنگ لغت, تاتر می اندازد یک استثنا و فرهنگ لغت ایجاد کنید. - -تمام انواع منابع پشتیبانی می شوند. هنگام به روز رسانی, داده ها (از یک فایل و یا از یک جدول) در تمامیت خود را به عنوان خوانده شده. - -این روش بهترین عملکرد را در میان تمام روش های موجود ذخیره سازی فرهنگ لغت فراهم می کند. - -مثال پیکربندی: - -``` xml - - - -``` - -یا - -``` sql -LAYOUT(FLAT()) -``` - -### درهم {#dicts-external_dicts_dict_layout-hashed} - -فرهنگ لغت به طور کامل در حافظه در قالب یک جدول هش ذخیره می شود. فرهنگ لغت می تواند شامل هر تعداد از عناصر با هر شناسه در عمل تعداد کلید ده ها میلیون نفر از اقلام برسد. - -تمام انواع منابع پشتیبانی می شوند. هنگام به روز رسانی, داده ها (از یک فایل و یا از یک جدول) در تمامیت خود را به عنوان خوانده شده. - -مثال پیکربندی: - -``` xml - - - -``` - -یا - -``` sql -LAYOUT(HASHED()) -``` - -### فشردهسازی {#dicts-external_dicts_dict_layout-sparse_hashed} - -مشابه به `hashed`, اما با استفاده از حافظه کمتر به نفع استفاده از پردازنده بیشتر. - -مثال پیکربندی: - -``` xml - - - -``` - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### \_ساخت مجتمع {#complex-key-hashed} - -این نوع ذخیره سازی برای استفاده با کامپوزیت است [کلید](external_dicts_dict_structure.md). مشابه به `hashed`. - -مثال پیکربندی: - -``` xml - - - -``` - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### رنگها {#range-hashed} - -فرهنگ لغت در حافظه به شکل یک جدول هش با مجموعه ای مرتب از محدوده ها و مقادیر مربوطه ذخیره می شود. - -این روش ذخیره سازی کار می کند به همان شیوه به عنوان درهم و اجازه می دهد تا با استفاده از تاریخ/زمان (نوع عددی دلخواه) محدوده علاوه بر کلید. - -مثال: جدول شامل تخفیف برای هر تبلیغ در قالب: - -``` text -+---------|-------------|-------------|------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------|-------------|-------------|------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------|-------------|-------------|------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------|-------------|-------------|------+ -``` - -برای استفاده از یک نمونه برای محدوده تاریخ, تعریف `range_min` و `range_max` عناصر در [ساختار](external_dicts_dict_structure.md). این عناصر باید حاوی عناصر `name` و`type` (اگر `type` مشخص نشده است, نوع پیش فرض استفاده خواهد شد - تاریخ). `type` می تواند هر نوع عددی (تاریخ / DateTime / UInt64 / Int32 / دیگران). - -مثال: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -یا - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -برای کار با این لغت نامه, شما نیاز به تصویب یک استدلال اضافی به `dictGetT` تابع, که یک محدوده انتخاب شده است: - -``` sql -dictGetT('dict_name', 'attr_name', id, date) -``` - -این تابع ارزش برای مشخص گرداند `id`بازدید کنندگان و محدوده تاریخ که شامل تاریخ گذشت. - -اطلاعات از الگوریتم: - -- اگر `id` یافت نشد و یا یک محدوده برای یافت نشد `id` مقدار پیش فرض فرهنگ لغت را برمی گرداند. -- اگر با هم تداخل دارند محدوده وجود دارد, شما می توانید هر استفاده. -- اگر جداساز محدوده باشد `NULL` یا نامعتبر تاریخ (مانند 1900-01-01 یا 2039-01-01) طیف وسیعی است که در سمت چپ باز است. محدوده را می توان در هر دو طرف باز کرد. - -مثال پیکربندی: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -یا - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### نهانگاه {#cache} - -فرهنگ لغت در کش است که تعداد ثابتی از سلول های ذخیره می شود. این سلول ها حاوی عناصر اغلب استفاده می شود. - -هنگام جستجو برای یک فرهنگ لغت کش اول جستجو می شود. برای هر بلوک از داده ها, تمام کلید هایی که در کش یافت نشد و یا منسوخ شده از منبع با استفاده از درخواست `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. داده های دریافت شده است و سپس به کش نوشته شده است. - -برای لغت نامه کش, انقضا [طول عمر](external_dicts_dict_lifetime.md) از داده ها در کش را می توان تنظیم کرد. اگر زمان بیشتری از `lifetime` از زمان بارگذاری داده ها در یک سلول گذشت, ارزش سلول استفاده نمی شود, و دوباره درخواست دفعه بعد که نیاز به استفاده می شود. -این حداقل موثر از تمام راه هایی برای ذخیره لغت نامه است. سرعت کش به شدت در تنظیمات صحیح و سناریوی استفاده بستگی دارد. فرهنگ لغت نوع کش به خوبی انجام تنها زمانی که نرخ ضربه به اندازه کافی بالا هستند (توصیه می شود 99% و بالاتر). شما می توانید میزان ضربه به طور متوسط در مشاهده `system.dictionaries` جدول - -برای بهبود عملکرد کش, استفاده از یک خرده فروشی با `LIMIT`, و پاسخ تابع با فرهنگ لغت خارجی. - -پشتیبانی [منابع](external_dicts_dict_sources.md) پردازشگر پشتیبانی شده: - -مثال تنظیمات: - -``` xml - - - - 1000000000 - - -``` - -یا - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -تنظیم اندازه کش به اندازه کافی بزرگ است. شما نیاز به تجربه برای انتخاب تعدادی از سلول های: - -1. تنظیم برخی از ارزش. -2. نمایش داده شد اجرا تا کش کاملا کامل است. -3. ارزیابی مصرف حافظه با استفاده از `system.dictionaries` جدول -4. افزایش یا کاهش تعداد سلول ها تا زمانی که مصرف حافظه مورد نیاز رسیده است. - -!!! warning "اخطار" - هنوز تاتر به عنوان یک منبع استفاده نمی, چرا که کند است برای پردازش نمایش داده شد با تصادفی می خواند. - -### \_پیچید\_چهای پیچیده {#complex-key-cache} - -این نوع ذخیره سازی برای استفاده با کامپوزیت است [کلید](external_dicts_dict_structure.md). مشابه به `cache`. - -### شمال اروپا {#ip-trie} - -این نوع ذخیره سازی برای پیشوندهای نقشه برداری شبکه (نشانی های اینترنتی) به فراداده مانند ان است. - -مثال: جدول شامل پیشوندهای شبکه و مربوط به خود را به عنوان شماره و کد کشور: - -``` text - +-----------|-----|------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------|-----|------+ - | 2620:0:870::/48 | 3856 | US | - +-----------|-----|------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------|-----|------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------|-----|------+ -``` - -هنگام استفاده از این نوع طرح, ساختار باید یک کلید کامپوزیت دارند. - -مثال: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -یا - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -کلید باید تنها یک ویژگی نوع رشته ای داشته باشد که شامل یک پیشوند مجاز است. انواع دیگر هنوز پشتیبانی نمی شوند. - -برای نمایش داده شد, شما باید توابع مشابه استفاده کنید (`dictGetT` با یک تاپل) به لغت نامه ها با کلید های ترکیبی: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -تابع طول می کشد یا `UInt32` برای ایپو4 یا `FixedString(16)` برای IPv6: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -انواع دیگر هنوز پشتیبانی نمی شوند. تابع ویژگی برای پیشوند که مربوط به این نشانی اینترنتی را برمی گرداند. اگر پیشوند با هم تداخل دارند وجود دارد, یکی از خاص ترین بازگشته است. - -داده ها در یک ذخیره می شود `trie`. این به طور کامل باید به رم مناسب. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index cb315313a24..00000000000 --- a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 42 -toc_title: "\u0628\u0647 \u0631\u0648\u0632 \u0631\u0633\u0627\u0646\u06CC \u0641\u0631\ - \u0647\u0646\u06AF \u0644\u063A\u062A" ---- - -# به روز رسانی فرهنگ لغت {#dictionary-updates} - -خانه کلیک دوره به روز رسانی لغت نامه. فاصله به روز رسانی برای لغت نامه به طور کامل دانلود و فاصله ابطال لغت نامه کش در تعریف `` برچسب در ثانیه. - -به روز رسانی فرهنگ لغت (به غیر از بارگذاری برای استفاده اول) نمایش داده شد را مسدود کند. در طول به روز رسانی, نسخه های قدیمی از یک فرهنگ لغت استفاده شده است. اگر یک خطا در طول به روز رسانی رخ می دهد, خطا به ورود به سیستم سرور نوشته شده, و نمایش داده شد ادامه استفاده از نسخه های قدیمی از لغت نامه. - -مثال تنظیمات: - -``` xml - - ... - 300 - ... - -``` - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -تنظیم `0` (`LIFETIME(0)`) جلوگیری از لغت نامه از به روز رسانی . - -شما می توانید یک بازه زمانی برای ارتقا تنظیم, و تاتر یک زمان یکنواخت تصادفی در این محدوده را انتخاب کنید. این به منظور توزیع بار بر روی منبع فرهنگ لغت در هنگام به روز رسانی در تعداد زیادی از سرور لازم است. - -مثال تنظیمات: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -یا - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -هنگام به روز رسانی لغت نامه, سرور کلیک اعمال منطق مختلف بسته به نوع [متن](external_dicts_dict_sources.md): - -- برای یک فایل متنی زمان اصلاح را بررسی می کند. اگر زمان از زمان قبلا ثبت شده متفاوت, فرهنگ لغت به روز شده است. -- برای جداول میثم, زمان اصلاح بررسی می شود با استفاده از یک `SHOW TABLE STATUS` پرس و جو. -- واژهنامهها از منابع دیگر در هر زمان به طور پیش فرض به روز شد. - -برای خروجی زیر (دیگر), ان بی سی و منابع فاحشه خانه, شما می توانید راه اندازی یک پرس و جو است که لغت نامه تنها در صورتی که واقعا تغییر به روز رسانی, به جای هر زمان. برای انجام این کار این مراحل را دنبال کنید: - -- جدول فرهنگ لغت باید یک میدان است که همیشه تغییر زمانی که داده های منبع به روز شده است. -- تنظیمات منبع باید پرس و جو که بازیابی زمینه در حال تغییر را مشخص کنید. سرور کلیک تفسیر نتیجه پرس و جو به عنوان یک ردیف, و اگر این ردیف نسبت به حالت قبلی خود تغییر کرده است, فرهنگ لغت به روز شده است. مشخص کردن پرسوجو در `` درست در تنظیمات برای [متن](external_dicts_dict_sources.md). - -مثال تنظیمات: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -یا - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index 398e4ceab39..00000000000 --- a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,609 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 43 -toc_title: "\u0645\u0646\u0627\u0628\u0639 \u0644\u063A\u062A \u0646\u0627\u0645\u0647\ - \ \u0647\u0627\u06CC \u062E\u0627\u0631\u062C\u06CC" ---- - -# منابع لغت نامه های خارجی {#dicts-external-dicts-dict-sources} - -فرهنگ لغت خارجی را می توان از بسیاری از منابع مختلف متصل می شود. - -اگر فرهنگ لغت پیکربندی شده است با استفاده از فایل های فشرده, پیکربندی به نظر می رسد مثل این: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -در صورت [توصیف](../../statements/create.md#create-dictionary-query), پیکربندی برابر خواهد شد مانند به نظر می رسد: - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -منبع در پیکربندی `source` بخش. - -انواع منابع (`source_type`): - -- [پرونده محلی](#dicts-external_dicts_dict_sources-local_file) -- [پرونده اجرایی](#dicts-external_dicts_dict_sources-executable) -- [HTTP(s)](#dicts-external_dicts_dict_sources-http) -- DBMS - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [فاحشه خانه](#dicts-external_dicts_dict_sources-clickhouse) - - [مانگودیبی](#dicts-external_dicts_dict_sources-mongodb) - - [ردیس](#dicts-external_dicts_dict_sources-redis) - -## پرونده محلی {#dicts-external_dicts_dict_sources-local_file} - -مثال تنظیمات: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -یا - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -تنظیم فیلدها: - -- `path` – The absolute path to the file. -- `format` – The file format. All the formats described in “[فرشها](../../../interfaces/formats.md#formats)” پشتیبانی می شوند. - -## پرونده اجرایی {#dicts-external_dicts_dict_sources-executable} - -کار با فایل های اجرایی بستگی دارد [چگونه فرهنگ لغت در حافظه ذخیره می شود](external_dicts_dict_layout.md). اگر فرهنگ لغت با استفاده از ذخیره می شود `cache` و `complex_key_cache` کلیک هاوس کلید های لازم را با ارسال درخواست به فایل اجرایی درخواست می کند. در غیر این صورت, تاتر شروع می شود فایل اجرایی و خروجی خود را به عنوان داده فرهنگ لغت رفتار. - -مثال تنظیمات: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -یا - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -تنظیم فیلدها: - -- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). -- `format` – The file format. All the formats described in “[فرشها](../../../interfaces/formats.md#formats)” پشتیبانی می شوند. - -## قام) {#dicts-external_dicts_dict_sources-http} - -کار با سرور اچ تی پی بستگی دارد [چگونه فرهنگ لغت در حافظه ذخیره می شود](external_dicts_dict_layout.md). اگر فرهنگ لغت با استفاده از ذخیره می شود `cache` و `complex_key_cache`, کلیک درخواست کلید های لازم با ارسال یک درخواست از طریق `POST` روش. - -مثال تنظیمات: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -یا - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -برای دسترسی به یک منبع اچ تی پی باید از اینجا کلیک کنید [پیکربندی اپنسسل](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-openssl) در پیکربندی سرور. - -تنظیم فیلدها: - -- `url` – The source URL. -- `format` – The file format. All the formats described in “[فرشها](../../../interfaces/formats.md#formats)” پشتیبانی می شوند. -- `credentials` – Basic HTTP authentication. Optional parameter. - - `user` – Username required for the authentication. - - `password` – Password required for the authentication. -- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. - - `header` – Single HTTP header entry. - - `name` – Identifiant name used for the header send on the request. - - `value` – Value set for a specific identifiant name. - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -شما می توانید از این روش برای اتصال هر پایگاه داده است که یک راننده بی سی استفاده کنید. - -مثال تنظیمات: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -یا - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -تنظیم فیلدها: - -- `db` – Name of the database. Omit it if the database name is set in the `` پارامترها -- `table` – Name of the table and schema if exists. -- `connection_string` – Connection string. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [بهروزرسانی واژهنامهها](external_dicts_dict_lifetime.md). - -تاتر دریافت به نقل از علامت از او بی سی راننده و نقل قول تمام تنظیمات در نمایش داده شد به راننده, بنابراین لازم است به مجموعه ای از نام جدول بر این اساس به نام جدول مورد در پایگاه داده. - -اگر شما یک مشکل با کدگذاریها در هنگام استفاده از اوراکل, دیدن مربوطه [FAQ](../../../faq/general.md#oracle-odbc-encodings) مقاله. - -### قابلیت پذیری شناخته شده از قابلیت او بی سی فرهنگ لغت {#known-vulnerability-of-the-odbc-dictionary-functionality} - -!!! attention "توجه" - هنگام اتصال به پایگاه داده از طریق پارامتر اتصال درایور او بی سی `Servername` می تواند جایگزین شود. در این مورد ارزش `USERNAME` و `PASSWORD` از `odbc.ini` به سرور از راه دور ارسال می شود و می تواند به خطر بیافتد. - -**نمونه ای از استفاده نا امن** - -اجازه می دهد تا پیکربندی unixodbc برای postgresql. محتوای `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -اگر شما پس از ایجاد یک پرس و جو مانند - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -درایور او بی سی خواهد ارزش ارسال `USERNAME` و `PASSWORD` از `odbc.ini` به `some-server.com`. - -### به عنوان مثال از اتصال شل {#example-of-connecting-postgresql} - -سیستم عامل اوبونتو. - -نصب unixodbc و odbc driver for postgresql: - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -پیکربندی `/etc/odbc.ini` (یا `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -پیکربندی فرهنگ لغت در کلیک: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -یا - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) -``` - -شما ممکن است نیاز به ویرایش `odbc.ini` برای مشخص کردن مسیر کامل به کتابخانه با راننده `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### به عنوان مثال اتصال سرور کارشناسی ارشد گذاشتن {#example-of-connecting-ms-sql-server} - -سیستم عامل اوبونتو. - -نصب درایور: : - -``` bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -پیکربندی راننده: - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -پیکربندی فرهنگ لغت در کلیک: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -یا - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## DBMS {#dbms} - -### Mysql {#dicts-external_dicts_dict_sources-mysql} - -مثال تنظیمات: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -یا - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -تنظیم فیلدها: - -- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). - -- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `replica` – Section of replica configurations. There can be multiple sections. - - - `replica/host` – The MySQL host. - - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. - -- `db` – Name of the database. - -- `table` – Name of the table. - -- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` بند در خروجی زیر, مثلا, `id > 10 AND id < 20`. پارامتر اختیاری. - -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [بهروزرسانی واژهنامهها](external_dicts_dict_lifetime.md). - -خروجی زیر را می توان در یک میزبان محلی از طریق سوکت متصل. برای انجام این کار, تنظیم `host` و `socket`. - -مثال تنظیمات: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -یا - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### فاحشه خانه {#dicts-external_dicts_dict_sources-clickhouse} - -مثال تنظیمات: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -یا - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -تنظیم فیلدها: - -- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [توزیع شده](../../../engines/table_engines/special/distributed.md) جدول و در تنظیمات بعدی وارد کنید. -- `port` – The port on the ClickHouse server. -- `user` – Name of the ClickHouse user. -- `password` – Password of the ClickHouse user. -- `db` – Name of the database. -- `table` – Name of the table. -- `where` – The selection criteria. May be omitted. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [بهروزرسانی واژهنامهها](external_dicts_dict_lifetime.md). - -### مانگودیبی {#dicts-external_dicts_dict_sources-mongodb} - -مثال تنظیمات: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -یا - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -تنظیم فیلدها: - -- `host` – The MongoDB host. -- `port` – The port on the MongoDB server. -- `user` – Name of the MongoDB user. -- `password` – Password of the MongoDB user. -- `db` – Name of the database. -- `collection` – Name of the collection. - -### ردیس {#dicts-external_dicts_dict_sources-redis} - -مثال تنظیمات: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -یا - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -تنظیم فیلدها: - -- `host` – The Redis host. -- `port` – The port on the Redis server. -- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` برای منابع ساده و برای منابع تک کلیدی درهم, `hash_map` برای منابع درهم با دو کلید. منابع در بازه زمانی و منابع کش با کلید پیچیده پشتیبانی نشده است. ممکن است حذف شود, مقدار پیش فرض است `simple`. -- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index 914e7968e5c..00000000000 --- a/docs/fa/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 44 -toc_title: "\u06A9\u0644\u06CC\u062F \u0641\u0631\u0647\u0646\u06AF \u0644\u063A\u062A\ - \ \u0648 \u0632\u0645\u06CC\u0646\u0647 \u0647\u0627\u06CC" ---- - -# کلید فرهنگ لغت و زمینه های {#dictionary-key-and-fields} - -این `` بند توصیف کلید فرهنگ لغت و زمینه های موجود برای نمایش داده شد. - -توصیف: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -صفات در عناصر شرح داده شده است: - -- `` — [ستون کلید](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [ستون داده](external_dicts_dict_structure.md#ext_dict_structure-attributes). می تواند تعدادی از ویژگی های وجود دارد. - -پرسوجو: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -صفات در بدن پرس و جو توصیف: - -- `PRIMARY KEY` — [ستون کلید](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [ستون داده](external_dicts_dict_structure.md#ext_dict_structure-attributes). می تواند تعدادی از ویژگی های وجود دارد. - -## کلید {#ext_dict_structure-key} - -تاتر از انواع زیر از کلید: - -- کلید عددی. `UInt64`. تعریف شده در `` برچسب یا استفاده `PRIMARY KEY` کلمه کلیدی. -- کلید کامپوزیت. مجموعه ای از مقادیر از انواع مختلف. تعریف شده در برچسب `` یا `PRIMARY KEY` کلمه کلیدی. - -یک ساختار میلی لیتر می تواند شامل موارد زیر باشد `` یا ``. دی ال پرس و جو باید شامل تک `PRIMARY KEY`. - -!!! warning "اخطار" - شما باید کلید به عنوان یک ویژگی توصیف نیست. - -### کلید عددی {#ext_dict-numeric-key} - -نوع: `UInt64`. - -مثال پیکربندی: - -``` xml - - Id - -``` - -حوزههای پیکربندی: - -- `name` – The name of the column with keys. - -برای & پرسوجو: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – The name of the column with keys. - -### کلید کامپوزیت {#composite-key} - -کلید می تواند یک `tuple` از هر نوع زمینه. این [طرحبندی](external_dicts_dict_layout.md) در این مورد باید باشد `complex_key_hashed` یا `complex_key_cache`. - -!!! tip "نکته" - کلید کامپوزیت می تواند از یک عنصر واحد تشکیل شده است. این امکان استفاده از یک رشته به عنوان کلید, برای مثال. - -ساختار کلیدی در عنصر تنظیم شده است ``. زمینه های کلیدی در قالب همان فرهنگ لغت مشخص شده است [خصیصهها](external_dicts_dict_structure.md). مثال: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -یا - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -برای پرس و جو به `dictGet*` تابع, یک تاپل به عنوان کلید به تصویب رسید. مثال: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## خصیصهها {#ext_dict_structure-attributes} - -مثال پیکربندی: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -یا - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -حوزههای پیکربندی: - -| برچسب | توصیف | مورد نیاز | -|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| -| `name` | نام ستون. | بله | -| `type` | نوع داده کلیک.
تاتر تلاش می کند به بازیگران ارزش از فرهنگ لغت به نوع داده مشخص شده است. مثلا, برای خروجی زیر, زمینه ممکن است `TEXT`, `VARCHAR` یا `BLOB` در جدول منبع خروجی زیر, اما می تواند به عنوان ارسال `String` در فاحشه خانه.
[Nullable](../../../sql_reference/data_types/nullable.md) پشتیبانی نمی شود. | بله | -| `null_value` | مقدار پیش فرض برای یک عنصر غیر موجود.
در مثال این یک رشته خالی است. شما نمی توانید استفاده کنید `NULL` در این زمینه. | بله | -| `expression` | [عبارت](../../syntax.md#syntax-expressions) که فاحشه خانه اجرا در ارزش.
بیان می تواند یک نام ستون در پایگاه داده از راه دور گذاشتن. بدین ترتیب, شما می توانید برای ایجاد یک نام مستعار برای ستون از راه دور استفاده.

مقدار پیش فرض: بدون بیان. | نه | -| `hierarchical` | اگر `true`, ویژگی شامل ارزش یک کلید پدر و مادر برای کلید فعلی. ببینید [لغتنامهها سلسله مراتبی](external_dicts_dict_hierarchical.md).

مقدار پیشفرض: `false`. | نه | -| `injective` | پرچمی که نشان میدهد چه `id -> attribute` تصویر [تزریق](https://en.wikipedia.org/wiki/Injective_function).
اگر `true`, کلیک خانه به طور خودکار می تواند پس از محل `GROUP BY` بند درخواست به لغت نامه با تزریق. معمولا به طور قابل توجهی میزان چنین درخواست را کاهش می دهد.

مقدار پیشفرض: `false`. | نه | -| `is_object_id` | پرچمی که نشان میدهد پرسوجو برای سند مانگودیبی اجرا شده است `ObjectID`.

مقدار پیشفرض: `false`. | نه | - -## همچنین نگاه کنید به {#see-also} - -- [توابع برای کار با لغت نامه های خارجی](../../../sql_reference/functions/ext_dict_functions.md). - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/fa/sql_reference/dictionaries/index.md b/docs/fa/sql_reference/dictionaries/index.md deleted file mode 100644 index 004dfa7718a..00000000000 --- a/docs/fa/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Dictionaries -toc_priority: 35 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# واژهنامهها {#dictionaries} - -فرهنگ لغت نقشه برداری است (`key -> attributes`) که مناسب برای انواع مختلفی از لیست مرجع است. - -تاتر پشتیبانی از توابع خاص برای کار با لغت نامه است که می تواند در نمایش داده شد استفاده می شود. این ساده تر و موثر تر به استفاده از لغت نامه ها با توابع از یک است `JOIN` با جداول مرجع. - -[NULL](../syntax.md#null) ارزش ها را نمی توان در یک فرهنگ لغت ذخیره کرد. - -پشتیبانی از کلیک: - -- [ساخته شده در لغت نامه](internal_dicts.md#internal_dicts) با یک خاص [مجموعه ای از توابع](../../sql_reference/functions/ym_dict_functions.md). -- [افزونه لغت نامه (خارجی) ](external_dictionaries/external_dicts.md) با یک [خالص توابع](../../sql_reference/functions/ext_dict_functions.md). - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/fa/sql_reference/dictionaries/internal_dicts.md b/docs/fa/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index 1b297c22a5a..00000000000 --- a/docs/fa/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u0648\u0627\u0698\u0647\u0646\u0627\u0645\u0647\u0647\u0627 \u062F\u0627\ - \u062E\u0644\u06CC" ---- - -# واژهنامهها داخلی {#internal_dicts} - -ClickHouse شامل ساخته شده است در ویژگی برای کار با یک geobase. - -این اجازه می دهد تا شما را به: - -- استفاده از شناسه یک منطقه به نام خود را در زبان مورد نظر. -- استفاده از یک منطقه شناسه برای دریافت شناسه شهر منطقه فدرال منطقه کشور یا قاره. -- بررسی کنید که یک منطقه بخشی از یک منطقه دیگر است. -- دریافت زنجیره ای از مناطق پدر و مادر. - -تمام توابع پشتیبانی “translocality,” توانایی به طور همزمان استفاده از دیدگاه های مختلف در مالکیت منطقه. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “Functions for working with Yandex.Metrica dictionaries”. - -واژهنامهها داخلی در بسته به طور پیش فرض غیر فعال. -برای فعال کردن پارامترها `path_to_regions_hierarchy_file` و `path_to_regions_names_files` در فایل پیکربندی سرور. - -پایگاه داده از فایل های متنی لود می شود. - -محل `regions_hierarchy*.txt` فایل ها به `path_to_regions_hierarchy_file` فهرست راهنما. این پارامتر پیکربندی باید مسیر را به `regions_hierarchy.txt` فایل (سلسله مراتب منطقه ای پیش فرض) و فایل های دیگر (`regions_hierarchy_ua.txt`) باید در همان دایرکتوری واقع شده است. - -قرار دادن `regions_names_*.txt` فایل ها در `path_to_regions_names_files` فهرست راهنما. - -شما همچنین می توانید این فایل ها خود را ایجاد کنید. فرمت فایل به شرح زیر است: - -`regions_hierarchy*.txt`: ستون (بدون هدر): - -- شناسه منطقه (`UInt32`) -- شناسه منطقه والد (`UInt32`) -- نوع منطقه (`UInt8`): 1 - قاره, 3 - کشور, 4 - منطقه فدرال, 5 - منطقه, 6-شهرستان; انواع دیگر ارزش ندارد -- جمعیت (`UInt32`) — optional column - -`regions_names_*.txt`: ستون (بدون هدر): - -- شناسه منطقه (`UInt32`) -- نام منطقه (`String`) — Can't contain tabs or line feeds, even escaped ones. - -مجموعه تخت برای ذخیره سازی در رم استفاده می شود. به همین دلیل شناسه نباید بیش از یک میلیون. - -واژهنامهها را می توان بدون راه اندازی مجدد سرور به روز شد. با این حال, مجموعه ای از لغت نامه های موجود به روز نمی. -برای به روز رسانی بار اصلاح فایل بررسی می شود. اگر یک فایل تغییر کرده است, فرهنگ لغت به روز شده است. -فاصله برای بررسی تغییرات در پیکربندی `builtin_dictionaries_reload_interval` پارامتر. -به روز رسانی فرهنگ لغت (به غیر از بارگذاری در اولین استفاده) نمایش داده شد را مسدود کند. در طول به روز رسانی, نمایش داده شد با استفاده از نسخه های قدیمی از لغت نامه. اگر یک خطا در طول به روز رسانی رخ می دهد, خطا به ورود به سیستم سرور نوشته شده, و نمایش داده شد ادامه استفاده از نسخه های قدیمی از لغت نامه. - -ما توصیه می کنیم دوره به روز رسانی لغت نامه با پایگاه داده. در طول به روز رسانی, تولید فایل های جدید و ارسال به یک مکان جداگانه. وقتی همه چیز اماده است فایل های مورد استفاده توسط سرور را تغییر دهید. - -همچنین توابع برای کار با شناسه های سیستم عامل و یاندکس وجود دارد.موتورهای جستجو متریکا, اما نباید استفاده شود. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/fa/sql_reference/functions/array_functions.md b/docs/fa/sql_reference/functions/array_functions.md deleted file mode 100644 index 76064d612a8..00000000000 --- a/docs/fa/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,1057 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 46 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0627\u0631\u0631\u06CC\u0633" ---- - -# توابع برای کار با ارریس {#functions-for-working-with-arrays} - -## خالی {#function-empty} - -بازده 1 برای یک مجموعه خالی, یا 0 برای یک مجموعه غیر خالی. -نتیجه این نوع uint8. -این تابع نیز برای رشته کار می کند. - -## notEmpty {#function-notempty} - -بازده 0 برای یک مجموعه خالی, یا 1 برای یک مجموعه غیر خالی. -نتیجه این نوع uint8. -این تابع نیز برای رشته کار می کند. - -## طول {#array_functions-length} - -بازگرداندن تعداد اقلام در مجموعه. -نتیجه این نوع uint64. -این تابع نیز برای رشته کار می کند. - -## emptyArrayUInt8, emptyArrayUInt16, emptyArrayUInt32, emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## emptyArrayInt8, emptyArrayInt16, emptyArrayInt32, emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} - -## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} - -## تخت خواب {#emptyarraystring} - -قبول صفر استدلال و مجموعه ای خالی از نوع مناسب را برمی گرداند. - -## خالی {#emptyarraytosingle} - -یک مجموعه خالی را می پذیرد و یک مجموعه یک عنصر را که برابر با مقدار پیش فرض است باز می گرداند. - -## محدوده( پایان), دامنه (شروع, پایان \[, گام\]) {#rangeend-rangestart-end-step} - -بازگرداندن مجموعه ای از اعداد از ابتدا تا انتها-1 به گام. -اگر استدلال `start` مشخص نشده است, به طور پیش فرض به 0. -اگر استدلال `step` مشخص نشده است, به طور پیش فرض به 1. -این رفتار تقریبا مانند پیتون `range`. اما تفاوت این است که همه نوع استدلال باید باشد `UInt` اعداد. -فقط در مورد, یک استثنا پرتاب می شود اگر ارریس با طول کل بیش از 100,000,000 عناصر در یک بلوک داده ها ایجاد. - -## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} - -ایجاد مجموعه ای از استدلال تابع. -استدلال باید ثابت باشد و انواع که کوچکترین نوع رایج. حداقل یک استدلال باید تصویب شود, چرا که در غیر این صورت مشخص نیست که چه نوع از مجموعه ای برای ایجاد. به این معنا که شما نمی توانید از این تابع برای ایجاد یک مجموعه خالی استفاده کنید (برای انجام این کار از ‘emptyArray\*’ تابع در بالا توضیح داده شد). -بازگشت یک ‘Array(T)’ نوع نتیجه, جایی که ‘T’ کوچکترین نوع رایج از استدلال گذشت. - -## موافقم {#arrayconcat} - -ترکیبی از ارریس به عنوان استدلال گذشت. - -``` sql -arrayConcat(arrays) -``` - -**پارامترها** - -- `arrays` – Arbitrary number of arguments of [& حذف](../../sql_reference/data_types/array.md) نوع. - **مثال** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,3,4,5,6] │ -└───────────────┘ -``` - -## هشدار داده می شود\] {#arrayelementarr-n-operator-arrn} - -عنصر را با شاخص دریافت کنید `n` از مجموعه `arr`. `n` باید هر نوع عدد صحیح باشد. -شاخص ها در مجموعه ای از یک شروع می شوند. -شاخص های منفی پشتیبانی می شوند. در این مورد آن را انتخاب می کند که عنصر مربوطه شماره از پایان. به عنوان مثال, `arr[-1]` اخرین وسیله ست - -اگر شاخص می افتد در خارج از مرزهای مجموعه, این گرداند برخی از مقدار پیش فرض (0 برای اعداد, یک رشته خالی برای رشته, و غیره.), به جز برای مورد با یک مجموعه غیر ثابت و یک شاخص ثابت 0 (در این مورد وجود خواهد داشت یک خطا `Array indices are 1-based`). - -## است (ورود, علم) {#hasarr-elem} - -بررسی اینکه ‘arr’ اری ‘elem’ عنصر. -بازده 0 اگر عنصر در مجموعه نیست, یا 1 اگر. - -`NULL` به عنوان یک ارزش پردازش شده است. - -``` sql -SELECT has([1, 2, NULL], NULL) -``` - -``` text -┌─has([1, 2, NULL], NULL)─┐ -│ 1 │ -└─────────────────────────┘ -``` - -## حصال {#hasall} - -بررسی اینکه یک مجموعه زیر مجموعه دیگری باشد. - -``` sql -hasAll(set, subset) -``` - -**پارامترها** - -- `set` – Array of any type with a set of elements. -- `subset` – Array of any type with elements that should be tested to be a subset of `set`. - -**مقادیر بازگشتی** - -- `1` اگر `set` شامل تمام عناصر از `subset`. -- `0` وگرنه - -**خواص عجیب و غریب** - -- مجموعه خالی زیر مجموعه ای از هر است. -- `Null` پردازش به عنوان یک ارزش. -- منظور از ارزش ها در هر دو ارریس مهم نیست. - -**مثالها** - -`SELECT hasAll([], [])` بازده 1. - -`SELECT hasAll([1, Null], [Null])` بازده 1. - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` بازده 1. - -`SELECT hasAll(['a', 'b'], ['a'])` بازده 1. - -`SELECT hasAll([1], ['a'])` بازده 0. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` بازده 0. - -## hasAny {#hasany} - -بررسی اینکه دو بند چهار راه توسط برخی از عناصر. - -``` sql -hasAny(array1, array2) -``` - -**پارامترها** - -- `array1` – Array of any type with a set of elements. -- `array2` – Array of any type with a set of elements. - -**بازگشت ارزش** - -- `1` اگر `array1` و `array2` حداقل یک عنصر مشابه داشته باشید. -- `0` وگرنه - -**خواص عجیب و غریب** - -- `Null` پردازش به عنوان یک ارزش. -- منظور از ارزش ها در هر دو ارریس مهم نیست. - -**مثالها** - -`SELECT hasAny([1], [])` بازگشت `0`. - -`SELECT hasAny([Null], [Null, 1])` بازگشت `1`. - -`SELECT hasAny([-128, 1., 512], [1])` بازگشت `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` بازگشت `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` بازگشت `1`. - -## هشدار داده می شود) {#indexofarr-x} - -بازگرداندن شاخص از اولین ‘x’ عنصر (با شروع از 1) اگر در مجموعه ای است, یا 0 اگر نیست. - -مثال: - -``` sql -SELECT indexOf([1, 3, NULL, NULL], NULL) -``` - -``` text -┌─indexOf([1, 3, NULL, NULL], NULL)─┐ -│ 3 │ -└───────────────────────────────────┘ -``` - -عناصر را به `NULL` به عنوان مقادیر طبیعی انجام می شود. - -## هشدار داده می شود) {#countequalarr-x} - -بازده تعداد عناصر موجود در آرایه برابر با x. معادل arraycount (elem -\> elem = x arr). - -`NULL` عناصر به عنوان مقادیر جداگانه به کار گرفته. - -مثال: - -``` sql -SELECT countEqual([1, 2, NULL, NULL], NULL) -``` - -``` text -┌─countEqual([1, 2, NULL, NULL], NULL)─┐ -│ 2 │ -└──────────────────────────────────────┘ -``` - -## هشدار داده می شود) {#array_functions-arrayenumerate} - -Returns the array \[1, 2, 3, …, length (arr) \] - -این تابع به طور معمول با مجموعه ای استفاده می شود. این اجازه می دهد شمارش چیزی فقط یک بار برای هر مجموعه پس از استفاده از مجموعه پیوستن. مثال: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -در این مثال, می رسد تعداد تبدیل است (رشته دریافت پس از استفاده از مجموعه ملحق), و بازدید تعداد بازدید صفحات (رشته قبل از مجموعه ملحق). در این مورد خاص شما می توانید همان نتیجه را در یک راه ساده تر: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -این تابع همچنین می توانید در توابع مرتبه بالاتر استفاده می شود. برای مثال می توانید از شاخص های مجموعه ای برای عناصری که با شرایط مطابقت دارند استفاده کنید. - -## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} - -بازگرداندن مجموعه ای به همان اندازه به عنوان مجموعه منبع, نشان می دهد برای هر عنصر چه موقعیت خود را در میان عناصر با همان مقدار. -به عنوان مثال: ارریینومراتونیک(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. - -این تابع در هنگام استفاده از مجموعه ای پیوستن و تجمع عناصر مجموعه ای مفید است. -مثال: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - -``` text -┌──GoalID─┬─Reaches─┬─Visits─┐ -│ 53225 │ 3214 │ 1097 │ -│ 2825062 │ 3188 │ 1097 │ -│ 56600 │ 2803 │ 488 │ -│ 1989037 │ 2401 │ 365 │ -│ 2830064 │ 2396 │ 910 │ -│ 1113562 │ 2372 │ 373 │ -│ 3270895 │ 2262 │ 812 │ -│ 1084657 │ 2262 │ 345 │ -│ 56599 │ 2260 │ 799 │ -│ 3271094 │ 2256 │ 812 │ -└─────────┴─────────┴────────┘ -``` - -در این مثال هر هدف شناسه محاسبه تعداد تبدیل (هر عنصر در اهداف تو در تو ساختار داده ها یک هدف است که رسیده بود که ما اشاره به عنوان یک تبدیل) و تعداد جلسات. بدون مجموعه ملحق, ما می خواهیم تعداد جلسات به عنوان مجموع شمارش (امضا کردن). اما در این مورد خاص ردیف شد ضرب در تو در تو در اهداف و ساختار آن در سفارش به تعداد هر جلسه یک بار بعد از این ما اعمال یک شرط به ارزش arrayenumerateuniq(اهداف است.id) تابع. - -تابع ارریینومراتونیک می تواند چندین بار از همان اندازه به عنوان استدلال استفاده کند. در این مورد, منحصر به فرد است برای تاپل از عناصر در موقعیت های مشابه در تمام ارریس در نظر گرفته. - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,1,1,2,1] │ -└───────────────┘ -``` - -این در هنگام استفاده از مجموعه با یک ساختار داده های تو در تو و تجمع بیشتر در سراسر عناصر متعدد در این ساختار ملحق لازم است. - -## عقبگرد {#arraypopback} - -حذف مورد گذشته از مجموعه. - -``` sql -arrayPopBack(array) -``` - -**پارامترها** - -- `array` – Array. - -**مثال** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## ساحل {#arraypopfront} - -اولین مورد را از مجموعه حذف می کند. - -``` sql -arrayPopFront(array) -``` - -**پارامترها** - -- `array` – Array. - -**مثال** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [2,3] │ -└───────┘ -``` - -## عقب نشینی {#arraypushback} - -یک مورد را به انتهای مجموعه اضافه می کند. - -``` sql -arrayPushBack(array, single_value) -``` - -**پارامترها** - -- `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` نوع داده مجموعه را تایپ کنید. برای کسب اطلاعات بیشتر در مورد انواع داده ها در خانه کلیک کنید “[انواع داده ها](../../sql_reference/data_types/index.md#data_types)”. می توان `NULL`. تابع می افزاید: `NULL` عنصر به مجموعه ای, و نوع عناصر مجموعه ای تبدیل به `Nullable`. - -**مثال** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## ساحلی {#arraypushfront} - -یک عنصر را به ابتدای مجموعه اضافه می کند. - -``` sql -arrayPushFront(array, single_value) -``` - -**پارامترها** - -- `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` نوع داده مجموعه را تایپ کنید. برای کسب اطلاعات بیشتر در مورد انواع داده ها در خانه کلیک کنید “[انواع داده ها](../../sql_reference/data_types/index.md#data_types)”. می تواند باشد `NULL`. این تابع می افزاید: `NULL` عنصر به مجموعه ای, و نوع عناصر مجموعه ای تبدیل به `Nullable`. - -**مثال** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## نمایش سایت {#arrayresize} - -طول مجموعه را تغییر می دهد. - -``` sql -arrayResize(array, size[, extender]) -``` - -**پارامترها:** - -- `array` — Array. -- `size` — Required length of the array. - - اگر `size` کمتر از اندازه اصلی مجموعه است, مجموعه ای از سمت راست کوتاه. -- اگر `size` مجموعه بزرگتر از اندازه اولیه مجموعه است که به سمت راست گسترش می یابد `extender` مقادیر یا مقادیر پیش فرض برای نوع داده از موارد مجموعه. -- `extender` — Value for extending an array. Can be `NULL`. - -**مقدار بازگشتی:** - -مجموعه ای از طول `size`. - -**نمونه هایی از تماس** - -``` sql -SELECT arrayResize([1], 3) -``` - -``` text -┌─arrayResize([1], 3)─┐ -│ [1,0,0] │ -└─────────────────────┘ -``` - -``` sql -SELECT arrayResize([1], 3, NULL) -``` - -``` text -┌─arrayResize([1], 3, NULL)─┐ -│ [1,NULL,NULL] │ -└───────────────────────────┘ -``` - -## arraySlice {#arrayslice} - -یک تکه از مجموعه را برمی گرداند. - -``` sql -arraySlice(array, offset[, length]) -``` - -**پارامترها** - -- `array` – Array of data. -- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. -- `length` - طول قطعه مورد نیاز . اگر شما یک مقدار منفی مشخص, تابع یک تکه باز می گرداند `[offset, array_length - length)`. اگر شما حذف ارزش, تابع برش می گرداند `[offset, the_end_of_array]`. - -**مثال** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - -``` text -┌─res────────┐ -│ [2,NULL,4] │ -└────────────┘ -``` - -عناصر مجموعه ای به `NULL` به عنوان مقادیر طبیعی انجام می شود. - -## arraySort(\[func,\] arr, …) {#array_functions-sort} - -عناصر را مرتب می کند `arr` صف در صعودی. اگر `func` تابع مشخص شده است, مرتب سازی سفارش توسط نتیجه تعیین `func` تابع اعمال شده به عناصر مجموعه. اگر `func` قبول استدلال های متعدد `arraySort` تابع به تصویب می رسد چند بند که استدلال `func` خواهد به مطابقت. نمونه های دقیق در پایان نشان داده شده است `arraySort` توصیف. - -نمونه ای از مقادیر صحیح مرتب سازی: - -``` sql -SELECT arraySort([1, 3, 3, 0]); -``` - -``` text -┌─arraySort([1, 3, 3, 0])─┐ -│ [0,1,3,3] │ -└─────────────────────────┘ -``` - -نمونه ای از مقادیر رشته مرتب سازی: - -``` sql -SELECT arraySort(['hello', 'world', '!']); -``` - -``` text -┌─arraySort(['hello', 'world', '!'])─┐ -│ ['!','hello','world'] │ -└────────────────────────────────────┘ -``` - -ترتیب مرتب سازی زیر را برای `NULL`, `NaN` و `Inf` مقادیر: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - -``` text -┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ -│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────────────────────────┘ -``` - -- `-Inf` مقادیر برای اولین بار در مجموعه هستند. -- `NULL` ارزشهای خبری عبارتند از: -- `NaN` مقادیر درست قبل هستند `NULL`. -- `Inf` مقادیر درست قبل هستند `NaN`. - -توجه داشته باشید که `arraySort` یک [عملکرد عالی مرتبه](higher_order_functions.md). شما می توانید یک تابع لامبدا را به عنوان اولین استدلال منتقل کنید. در این مورد مرتب سازی سفارش تعیین می شود در نتیجه از lambda تابع اعمال شده به عناصر آرایه است. - -بیایید مثال زیر را در نظر بگیریم: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,2,1] │ -└─────────┘ -``` - -For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` تابع انواع کلید به ترتیب صعودی, نتیجه این است \[3, 2, 1\]. بنابراین `(x) –> -x` عملکرد لامبدا مجموعه [ترتیب نزولی](#array_functions-reverse-sort) در یک مرتب سازی. - -تابع لامبدا می تواند استدلال های متعدد را قبول کند. در این مورد, شما نیاز به تصویب `arraySort` تابع چند بند از طول یکسان است که استدلال تابع لامبدا به مطابقت. مجموعه حاصل از عناصر از اولین مجموعه ورودی تشکیل شده است. به عنوان مثال: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -در اینجا عناصر موجود در مجموعه دوم (\[2, 1\]) تعریف یک کلید مرتب سازی برای عنصر مربوطه از مجموعه منبع (\[‘hello’, ‘world’\]), به این معنا که, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn't use `x` مقادیر واقعی مجموعه منبع بر نظم در نتیجه تاثیر نمی گذارد. پس, ‘hello’ خواهد بود که عنصر دوم در نتیجه, و ‘world’ خواهد بود که برای اولین بار. - -نمونه های دیگر در زیر نشان داده شده. - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! note "یادداشت" - برای بهبود کارایی مرتب سازی [تبدیل شوارتز](https://en.wikipedia.org/wiki/Schwartzian_transform) استفاده شده است. - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} - -عناصر را مرتب می کند `arr` صف در نزولی. اگر `func` تابع مشخص شده است, `arr` بر اساس نتیجه طبقه بندی شده اند `func` عملکرد به عناصر مجموعه اعمال می شود و سپس مجموعه مرتب شده معکوس می شود. اگر `func` قبول استدلال های متعدد `arrayReverseSort` تابع به تصویب می رسد چند بند که استدلال `func` خواهد به مطابقت. نمونه های دقیق در پایان نشان داده شده است `arrayReverseSort` توصیف. - -نمونه ای از مقادیر صحیح مرتب سازی: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - -``` text -┌─arrayReverseSort([1, 3, 3, 0])─┐ -│ [3,3,1,0] │ -└────────────────────────────────┘ -``` - -نمونه ای از مقادیر رشته مرتب سازی: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - -``` text -┌─arrayReverseSort(['hello', 'world', '!'])─┐ -│ ['world','hello','!'] │ -└───────────────────────────────────────────┘ -``` - -ترتیب مرتب سازی زیر را برای `NULL`, `NaN` و `Inf` مقادیر: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` text -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- `Inf` مقادیر برای اولین بار در مجموعه هستند. -- `NULL` ارزشهای خبری عبارتند از: -- `NaN` مقادیر درست قبل هستند `NULL`. -- `-Inf` مقادیر درست قبل هستند `NaN`. - -توجه داشته باشید که `arrayReverseSort` یک [عملکرد عالی مرتبه](higher_order_functions.md). شما می توانید یک تابع لامبدا را به عنوان اولین استدلال منتقل کنید. مثال زیر نشان داده شده. - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [1,2,3] │ -└─────────┘ -``` - -این مجموعه به روش زیر مرتب شده است: - -1. ابتدا مجموعه منبع (\[1, 2, 3\]) با توجه به نتیجه تابع لامبدا اعمال شده به عناصر مجموعه طبقه بندی شده اند. نتیجه یک مجموعه است \[3, 2, 1\]. -2. مجموعه ای است که در مرحله قبل به دست, معکوس شده است. بنابراین, نتیجه نهایی است \[1, 2, 3\]. - -تابع لامبدا می تواند استدلال های متعدد را قبول کند. در این مورد, شما نیاز به تصویب `arrayReverseSort` تابع چند بند از طول یکسان است که استدلال تابع لامبدا به مطابقت. مجموعه حاصل از عناصر از اولین مجموعه ورودی تشکیل شده است. به عنوان مثال: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -در این مثال مجموعه به روش زیر مرتب شده است: - -1. در ابتدا مجموعه منبع (\[‘hello’, ‘world’\]) با توجه به نتیجه تابع لامبدا اعمال شده به عناصر از ارریس طبقه بندی شده اند. عناصر که در مجموعه دوم به تصویب رسید (\[2, 1\]), تعریف کلید مرتب سازی برای عناصر مربوطه را از مجموعه منبع. نتیجه یک مجموعه است \[‘world’, ‘hello’\]. -2. مجموعه ای که در مرحله قبل طبقه بندی شده اند, معکوس شده است. بنابراین نتیجه نهایی این است \[‘hello’, ‘world’\]. - -نمونه های دیگر در زیر نشان داده شده. - -``` sql -SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; -``` - -``` text -┌─res─────┐ -│ [5,3,4] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` text -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#arrayuniqarr} - -اگر یک استدلال به تصویب می رسد, تعداد عناصر مختلف در مجموعه شمارش. -اگر استدلال های متعدد به تصویب می رسد, شمارش تعداد تاپل های مختلف از عناصر در موقعیت های مربوطه در مجموعه های متعدد. - -اگر شما می خواهید برای دریافت یک لیست از اقلام منحصر به فرد در مجموعه, شما می توانید از ارری راهاهن استفاده(‘groupUniqArray’, arr). - -## هشدار داده می شود) {#array-functions-join} - -یک تابع خاص. بخش را ببینید [“ArrayJoin function”](array_join.md#functions_arrayjoin). - -## کلیدواژه {#arraydifference} - -محاسبه تفاوت بین عناصر مجموعه مجاور. بازگرداندن مجموعه ای که عنصر اول خواهد بود 0, دوم تفاوت بین است `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). - -**نحو** - -``` sql -arrayDifference(array) -``` - -**پارامترها** - -- `array` – [& حذف](https://clickhouse.yandex/docs/en/data_types/array/). - -**مقادیر بازگشتی** - -بازگرداندن مجموعه ای از تفاوت بین عناصر مجاور. - -نوع: [اینترنت\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [شناور\*](https://clickhouse.yandex/docs/en/data_types/float/). - -**مثال** - -پرسوجو: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - -نتیجه: - -``` text -┌─arrayDifference([1, 2, 3, 4])─┐ -│ [0,1,1,1] │ -└───────────────────────────────┘ -``` - -مثال سرریز به علت نوع نتیجه اینترن64: - -پرسوجو: - -``` sql -SELECT arrayDifference([0, 10000000000000000000]) -``` - -نتیجه: - -``` text -┌─arrayDifference([0, 10000000000000000000])─┐ -│ [0,-8446744073709551616] │ -└────────────────────────────────────────────┘ -``` - -## حوزه ارریددیست {#arraydistinct} - -مجموعه ای را می گیرد و تنها شامل عناصر مجزا می شود. - -**نحو** - -``` sql -arrayDistinct(array) -``` - -**پارامترها** - -- `array` – [& حذف](https://clickhouse.yandex/docs/en/data_types/array/). - -**مقادیر بازگشتی** - -بازگرداندن مجموعه ای حاوی عناصر متمایز. - -**مثال** - -پرسوجو: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - -نتیجه: - -``` text -┌─arrayDistinct([1, 2, 2, 3, 1])─┐ -│ [1,2,3] │ -└────────────────────────────────┘ -``` - -## هشدار داده می شود) {#array_functions-arrayenumeratedense} - -بازگرداندن مجموعه ای از همان اندازه به عنوان مجموعه منبع, نشان می دهد که هر عنصر برای اولین بار در مجموعه منبع به نظر می رسد. - -مثال: - -``` sql -SELECT arrayEnumerateDense([10, 20, 10, 30]) -``` - -``` text -┌─arrayEnumerateDense([10, 20, 10, 30])─┐ -│ [1,2,1,3] │ -└───────────────────────────────────────┘ -``` - -## هشدار داده می شود) {#array-functions-arrayintersect} - -طول می کشد مجموعه ای با عناصر که در تمام مجموعه منبع در حال حاضر می گرداند. عناصر سفارش در مجموعه حاصل همان است که در مجموعه اول است. - -مثال: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - -``` text -┌─no_intersect─┬─intersect─┐ -│ [] │ [1] │ -└──────────────┴───────────┘ -``` - -## نمایش سایت {#arrayreduce} - -یک تابع کلی برای عناصر مجموعه ای اعمال می شود و نتیجه خود را باز می گرداند. نام تابع تجمع به عنوان یک رشته در نقل قول های تک منتقل می شود `'max'`, `'sum'`. هنگام استفاده از توابع دانه پارامتری پارامتر پس از نام تابع در پرانتز نشان داده شده است `'uniqUpTo(6)'`. - -**نحو** - -``` sql -arrayReduce(agg_func, arr1, arr2, ..., arrN) -``` - -**پارامترها** - -- `agg_func` — The name of an aggregate function which should be a constant [رشته](../../sql_reference/data_types/string.md). -- `arr` — Any number of [& حذف](../../sql_reference/data_types/array.md) نوع ستون به عنوان پارامترهای تابع تجمع. - -**مقدار بازگشتی** - -**مثال** - -``` sql -SELECT arrayReduce('max', [1, 2, 3]) -``` - -``` text -┌─arrayReduce('max', [1, 2, 3])─┐ -│ 3 │ -└───────────────────────────────┘ -``` - -اگر یک تابع جمع استدلال های متعدد طول می کشد, سپس این تابع باید به مجموعه های متعدد از همان اندازه اعمال. - -``` sql -SELECT arrayReduce('maxIf', [3, 5], [1, 0]) -``` - -``` text -┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ -│ 3 │ -└──────────────────────────────────────┘ -``` - -به عنوان مثال با یک تابع جمع پارامتری: - -``` sql -SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -``` - -``` text -┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ -│ 4 │ -└─────────────────────────────────────────────────────────────┘ -``` - -## تغییرات {#arrayreduceinranges} - -یک تابع کلی برای عناصر مجموعه ای در محدوده های داده شده اعمال می شود و مجموعه ای حاوی نتیجه مربوط به هر محدوده را باز می گرداند. تابع همان نتیجه به عنوان چند بازگشت `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. - -**نحو** - -``` sql -arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) -``` - -**پارامترها** - -- `agg_func` — The name of an aggregate function which should be a constant [رشته](../../sql_reference/data_types/string.md). -- `ranges` — The ranges to aggretate which should be an [& حذف](../../sql_reference/data_types/array.md) از [توپلس](../../sql_reference/data_types/tuple.md) که شامل شاخص و طول هر محدوده. -- `arr` — Any number of [& حذف](../../sql_reference/data_types/array.md) نوع ستون به عنوان پارامترهای تابع تجمع. - -**مقدار بازگشتی** - -**مثال** - -``` sql -SELECT arrayReduceInRanges( - 'sum', - [(1, 5), (2, 3), (3, 4), (4, 4)], - [1000000, 200000, 30000, 4000, 500, 60, 7] -) AS res -``` - -``` text -┌─res─────────────────────────┐ -│ [1234500,234000,34560,4567] │ -└─────────────────────────────┘ -``` - -## هشدار داده می شود) {#arrayreverse} - -بازگرداندن مجموعه ای از همان اندازه به عنوان مجموعه اصلی حاوی عناصر در جهت معکوس. - -مثال: - -``` sql -SELECT arrayReverse([1, 2, 3]) -``` - -``` text -┌─arrayReverse([1, 2, 3])─┐ -│ [3,2,1] │ -└─────────────────────────┘ -``` - -## معکوس) {#array-functions-reverse} - -مترادف برای [“arrayReverse”](#array_functions-arrayreverse) - -## ارریفلاتتن {#arrayflatten} - -مجموعه ای از ارریس ها را به یک مجموعه صاف تبدیل می کند. - -تابع: - -- امر به هر عمق مجموعه های تو در تو. -- طعم هایی را که در حال حاضر مسطح هستند تغییر نمی دهد. - -مجموعه مسطح شامل تمام عناصر از تمام منابع است. - -**نحو** - -``` sql -flatten(array_of_arrays) -``` - -نام مستعار: `flatten`. - -**پارامترها** - -- `array_of_arrays` — [& حذف](../../sql_reference/data_types/array.md) ارریس به عنوان مثال, `[[1,2,3], [4,5]]`. - -**مثالها** - -``` sql -SELECT flatten([[[1]], [[2], [3]]]) -``` - -``` text -┌─flatten(array(array([1]), array([2], [3])))─┐ -│ [1,2,3] │ -└─────────────────────────────────────────────┘ -``` - -## اررایکمپکت {#arraycompact} - -عناصر تکراری متوالی را از یک مجموعه حذف می کند. ترتیب مقادیر نتیجه به ترتیب در مجموعه منبع تعیین می شود. - -**نحو** - -``` sql -arrayCompact(arr) -``` - -**پارامترها** - -`arr` — The [& حذف](../../sql_reference/data_types/array.md) برای بازرسی. - -**مقدار بازگشتی** - -مجموعه ای بدون تکراری. - -نوع: `Array`. - -**مثال** - -پرسوجو: - -``` sql -SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) -``` - -نتیجه: - -``` text -┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ -│ [1,nan,nan,2,3] │ -└────────────────────────────────────────────┘ -``` - -## ارریزیپ {#arrayzip} - -Combine multiple Array type columns into one Array\[Tuple(…)\] column - -**نحو** - -``` sql -arrayZip(arr1, arr2, ..., arrN) -``` - -**پارامترها** - -`arr` — Any number of [& حذف](../../sql_reference/data_types/array.md) ستون نوع به ترکیب. - -**مقدار بازگشتی** - -The result of Array\[Tuple(…)\] type after the combination of these arrays - -**مثال** - -پرسوجو: - -``` sql -SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); -``` - -نتیجه: - -``` text -┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ -│ [('a','d'),('b','e'),('c','f')] │ -└────────────────────────────────────────────┘ -``` - -## ارریایکو {#arrayauc} - -محاسبه حراج (منطقه تحت منحنی, که یک مفهوم در یادگیری ماشین است, مشاهده اطلاعات بیشتر: https://en.wikipedia.org/wiki/receiver\_operating\_characteristic\#area\_under\_the\_curve). - -**نحو** - -``` sql -arrayAUC(arr_scores, arr_labels) -``` - -**پارامترها** -- `arr_scores` — scores prediction model gives. -- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. - -**مقدار بازگشتی** -را برمی گرداند ارزش حراج با نوع شناور64. - -**مثال** -پرسوجو: - -``` sql -select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) -``` - -نتیجه: - -``` text -┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ -│ 0.75 │ -└────────────────────────────────────────---──┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/fa/sql_reference/functions/bit_functions.md b/docs/fa/sql_reference/functions/bit_functions.md deleted file mode 100644 index 5399bb3857a..00000000000 --- a/docs/fa/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 48 -toc_title: "\u0628\u06CC\u062A" ---- - -# توابع بیت {#bit-functions} - -بیت توابع کار برای هر جفت از انواع از uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32 یا float64. - -نوع نتیجه یک عدد صحیح با بیت به حداکثر بیت از استدلال خود را برابر است. اگر حداقل یکی از استدلال امضا شده است, نتیجه یک شماره امضا شده است. اگر استدلال یک عدد ممیز شناور است, این است که به درون بازیگران64. - -## بیت و ب) {#bitanda-b} - -## bitOr(a, b) {#bitora-b} - -## هشدار داده می شود) {#bitxora-b} - -## bitNot(یک) {#bitnota} - -## اطلاعات دقیق) {#bitshiftlefta-b} - -## باز کردن پنجره روی برنامههای دیگر) {#bitshiftrighta-b} - -## هشدار داده می شود) {#bitrotatelefta-b} - -## حفاظت از بیت) {#bitrotaterighta-b} - -## بیتترین {#bittest} - -طول می کشد هر عدد صحیح و تبدیل به [شکل دودویی](https://en.wikipedia.org/wiki/Binary_number), بازگرداندن ارزش کمی در موقعیت مشخص. شمارش معکوس از 0 از سمت راست به سمت چپ شروع می شود. - -**نحو** - -``` sql -SELECT bitTest(number, index) -``` - -**پارامترها** - -- `number` – integer number. -- `index` – position of bit. - -**مقادیر بازگشتی** - -بازگرداندن مقدار کمی در موقعیت مشخص. - -نوع: `UInt8`. - -**مثال** - -مثلا, تعداد 43 در پایه-2 (دودویی) سیستم اعداد است 101011. - -پرسوجو: - -``` sql -SELECT bitTest(43, 1) -``` - -نتیجه: - -``` text -┌─bitTest(43, 1)─┐ -│ 1 │ -└────────────────┘ -``` - -مثال دیگر: - -پرسوجو: - -``` sql -SELECT bitTest(43, 2) -``` - -نتیجه: - -``` text -┌─bitTest(43, 2)─┐ -│ 0 │ -└────────────────┘ -``` - -## تماس {#bittestall} - -بازده نتیجه [ساخت منطقی](https://en.wikipedia.org/wiki/Logical_conjunction) (و اپراتور) از تمام بیت در موقعیت های داده شده. شمارش معکوس از 0 از سمت راست به سمت چپ شروع می شود. - -ساخت و ساز برای عملیات بیتی: - -0 AND 0 = 0 - -0 AND 1 = 0 - -1 AND 0 = 0 - -1 AND 1 = 1 - -**نحو** - -``` sql -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`) درست است اگر و تنها اگر تمام موقعیت خود را درست هستند (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). - -**مقادیر بازگشتی** - -بازده نتیجه منطقی conjuction. - -نوع: `UInt8`. - -**مثال** - -مثلا, تعداد 43 در پایه-2 (دودویی) سیستم اعداد است 101011. - -پرسوجو: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5) -``` - -نتیجه: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5)─┐ -│ 1 │ -└────────────────────────────┘ -``` - -مثال دیگر: - -پرسوجو: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5, 2) -``` - -نتیجه: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ -│ 0 │ -└───────────────────────────────┘ -``` - -## بیتستانی {#bittestany} - -بازده نتیجه [حکم منطقی](https://en.wikipedia.org/wiki/Logical_disjunction) (یا اپراتور) از تمام بیت در موقعیت های داده شده. شمارش معکوس از 0 از سمت راست به سمت چپ شروع می شود. - -دستور برای عملیات بیتی: - -0 OR 0 = 0 - -0 OR 1 = 1 - -1 OR 0 = 1 - -1 OR 1 = 1 - -**نحو** - -``` sql -SELECT bitTestAny(number, index1, index2, index3, index4, ...) -``` - -**پارامترها** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. - -**مقادیر بازگشتی** - -بازده نتیجه ساخت و ساز منطقی. - -نوع: `UInt8`. - -**مثال** - -مثلا, تعداد 43 در پایه-2 (دودویی) سیستم اعداد است 101011. - -پرسوجو: - -``` sql -SELECT bitTestAny(43, 0, 2) -``` - -نتیجه: - -``` text -┌─bitTestAny(43, 0, 2)─┐ -│ 1 │ -└──────────────────────┘ -``` - -مثال دیگر: - -پرسوجو: - -``` sql -SELECT bitTestAny(43, 4, 2) -``` - -نتیجه: - -``` text -┌─bitTestAny(43, 4, 2)─┐ -│ 0 │ -└──────────────────────┘ -``` - -## شمارش {#bitcount} - -محاسبه تعداد بیت را به یکی در نمایندگی دودویی از یک عدد است. - -**نحو** - -``` sql -bitCount(x) -``` - -**پارامترها** - -- `x` — [عدد صحیح](../../sql_reference/data_types/int_uint.md) یا [شناور نقطه](../../sql_reference/data_types/float.md) شماره. تابع با استفاده از نمایندگی ارزش در حافظه. این اجازه می دهد تا حمایت از اعداد ممیز شناور. - -**مقدار بازگشتی** - -- تعداد بیت را به یکی در تعداد ورودی. - -تابع مقدار ورودی را به یک نوع بزرگتر تبدیل نمی کند ([ثبت نام پسوند](https://en.wikipedia.org/wiki/Sign_extension)). بنابراین, مثلا, `bitCount(toUInt8(-1)) = 8`. - -نوع: `UInt8`. - -**مثال** - -نگاهی به عنوان مثال تعداد 333. نمایندگی دودویی: 00000001001101. - -پرسوجو: - -``` sql -SELECT bitCount(333) -``` - -نتیجه: - -``` text -┌─bitCount(333)─┐ -│ 5 │ -└───────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/fa/sql_reference/functions/bitmap_functions.md b/docs/fa/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index e561baef9c0..00000000000 --- a/docs/fa/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,496 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 49 -toc_title: "\u0646\u06AF\u0627\u0634\u062A \u0628\u06CC\u062A" ---- - -# توابع نگاشت بیت {#bitmap-functions} - -توابع بیت مپ برای دو بیت مپ محاسبه ارزش شی کار, این است که بازگشت بیت مپ جدید و یا کارتیت در حالی که با استفاده از محاسبه فرمول, مانند و, یا, صخره نوردی, و نه, و غیره. - -2 نوع از روش های ساخت و ساز برای شی بیت مپ وجود دارد. یکی این است که توسط گروه بیت مپ تابع تجمع با دولت ساخته شود, دیگر این است که توسط شی مجموعه ای ساخته شود. این نیز برای تبدیل شی بیت مپ به مجموعه شی. - -نقشه شهری روارینگ به یک ساختار داده در حالی که ذخیره سازی واقعی از اجسام بیت مپ پیچیده شده است. هنگامی که کارتیت کمتر از یا برابر است 32, با استفاده از عینیت مجموعه. هنگامی که کارتیت بیشتر از است 32, با استفاده از شی نقشه شهری روارینگ. به همین دلیل است ذخیره سازی مجموعه کارتیت کم سریع تر است. - -برای کسب اطلاعات بیشتر در مورد نقشه شهری روارینگ: [پرورش دهنده](https://github.com/RoaringBitmap/CRoaring). - -## طراحی بیت مپ {#bitmap_functions-bitmapbuild} - -ساخت یک بیت مپ از مجموعه عدد صحیح بدون علامت. - -``` sql -bitmapBuild(array) -``` - -**پارامترها** - -- `array` – unsigned integer array. - -**مثال** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) -``` - -``` text -┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ -│  │ AggregateFunction(groupBitmap, UInt8) │ -└─────┴──────────────────────────────────────────────┘ -``` - -## بیت مپوری {#bitmaptoarray} - -تبدیل بیت مپ به مجموعه عدد صحیح. - -``` sql -bitmapToArray(bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## اطلاعات دقیق {#bitmap-functions-bitmapsubsetinrange} - -زیرمجموعه بازگشت در محدوده مشخص شده (دامنه را شامل نمی شود). - -``` sql -bitmapSubsetInRange(bitmap, range_start, range_end) -``` - -**پارامترها** - -- `bitmap` – [شی نگاشت بیت](#bitmap_functions-bitmapbuild). -- `range_start` – range start point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `range_end` – range end point(excluded). Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**مثال** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -``` text -┌─res───────────────┐ -│ [30,31,32,33,100] │ -└───────────────────┘ -``` - -## نمایش سایت {#bitmapsubsetlimit} - -ایجاد یک زیر مجموعه از بیت مپ با عناصر نفر گرفته شده بین `range_start` و `cardinality_limit`. - -**نحو** - -``` sql -bitmapSubsetLimit(bitmap, range_start, cardinality_limit) -``` - -**پارامترها** - -- `bitmap` – [شی نگاشت بیت](#bitmap_functions-bitmapbuild). -- `range_start` – The subset starting point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**مقدار بازگشتی** - -زیرمجموعه. - -نوع: `Bitmap object`. - -**مثال** - -پرسوجو: - -``` sql -SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -نتیجه: - -``` text -┌─res───────────────────────┐ -│ [30,31,32,33,100,200,500] │ -└───────────────────────────┘ -``` - -## اطلاعات دقیق {#bitmap_functions-bitmapcontains} - -بررسی اینکه نگاشت بیت شامل یک عنصر است. - -``` sql -bitmapContains(haystack, needle) -``` - -**پارامترها** - -- `haystack` – [شی نگاشت بیت](#bitmap_functions-bitmapbuild), جایی که تابع جستجو. -- `needle` – Value that the function searches. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- 0 — If `haystack` شامل نمی شود `needle`. -- 1 — If `haystack` شامل `needle`. - -نوع: `UInt8`. - -**مثال** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## بیتمافاسانی {#bitmaphasany} - -بررسی اینکه دو بیت مپ دارند تقاطع توسط برخی از عناصر. - -``` sql -bitmapHasAny(bitmap1, bitmap2) -``` - -اگر شما اطمینان حاصل کنید که `bitmap2` حاوی شدت یک عنصر, در نظر با استفاده از [اطلاعات دقیق](#bitmap_functions-bitmapcontains) تابع. این کار موثر تر است. - -**پارامترها** - -- `bitmap*` – bitmap object. - -**بازگشت ارزش** - -- `1` اگر `bitmap1` و `bitmap2` حداقل یک عنصر مشابه داشته باشید. -- `0` وگرنه - -**مثال** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## بیتمافاسال {#bitmaphasall} - -مشابه به `hasAll(array, array)` بازده 1 اگر بیت مپ اول شامل تمام عناصر از یک ثانیه, 0 در غیر این صورت. -اگر استدلال دوم بیت مپ خالی است و سپس باز می گردد 1. - -``` sql -bitmapHasAll(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 0 │ -└─────┘ -``` - -## هشدار داده می شود {#bitmapcardinality} - -Retrun بیت مپ cardinality از نوع UInt64. - -``` sql -bitmapCardinality(bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## بیت مپمن {#bitmapmin} - -Retrun کوچکترین مقدار از نوع UInt64 در مجموعه UINT32\_MAX اگر این مجموعه خالی است. - - bitmapMin(bitmap) - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## جرم اتمی {#bitmapmax} - -جابجایی بزرگترین ارزش نوع اوینت64 در مجموعه, 0 اگر مجموعه ای خالی است. - - bitmapMax(bitmap) - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## ترجمههای بیت مپ {#bitmaptransform} - -تبدیل مجموعه ای از ارزش ها در بیت مپ به مجموعه ای دیگر از ارزش, نتیجه یک بیت مپ جدید است. - - bitmapTransform(bitmap, from_array, to_array) - -**پارامترها** - -- `bitmap` – bitmap object. -- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. -- `to_array` – UInt32 array, its size shall be the same to from\_array. - -**مثال** - -``` sql -SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res -``` - - ┌─res───────────────────┐ - │ [1,3,4,6,7,8,9,10,20] │ - └───────────────────────┘ - -## بیت مپند {#bitmapand} - -دو بیت مپ و محاسبه, نتیجه یک بیت مپ جدید است. - -``` sql -bitmapAnd(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─┐ -│ [3] │ -└─────┘ -``` - -## نگاشت بیت {#bitmapor} - -دو بیت مپ و یا محاسبه, نتیجه یک بیت مپ جدید است. - -``` sql -bitmapOr(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## بیت مپکسور {#bitmapxor} - -دو محاسبه گز بیت مپ, نتیجه یک بیت مپ جدید است. - -``` sql -bitmapXor(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,4,5] │ -└───────────┘ -``` - -## بیت مپندو {#bitmapandnot} - -دو محاسبه بیت مپ اندنوت, نتیجه یک بیت مپ جدید است. - -``` sql -bitmapAndnot(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## اطلاعات دقیق {#bitmapandcardinality} - -دو بیت مپ و محاسبه بازگشت cardinality از نوع uint64. - -``` sql -bitmapAndCardinality(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## کمبود سیگار {#bitmaporcardinality} - -دو بیت مپ و یا محاسبه بازگشت cardinality از نوع uint64. - -``` sql -bitmapOrCardinality(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## هشدار داده می شود {#bitmapxorcardinality} - -دو بیت مپ xor محاسبه بازگشت cardinality از نوع uint64. - -``` sql -bitmapXorCardinality(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 4 │ -└─────┘ -``` - -## اطلاعات دقیق {#bitmapandnotcardinality} - -دو بیت مپ andnot محاسبه بازگشت cardinality از نوع uint64. - -``` sql -bitmapAndnotCardinality(bitmap,bitmap) -``` - -**پارامترها** - -- `bitmap` – bitmap object. - -**مثال** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 2 │ -└─────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/fa/sql_reference/functions/conditional_functions.md b/docs/fa/sql_reference/functions/conditional_functions.md deleted file mode 100644 index a57820687dd..00000000000 --- a/docs/fa/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,207 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 43 -toc_title: "\u0634\u0631\u0637\u06CC " ---- - -# توابع شرطی {#conditional-functions} - -## اگر {#if} - -کنترل انشعاب مشروط. بر خلاف اکثر سیستم های تاتر همیشه هر دو عبارت را ارزیابی کنید `then` و `else`. - -**نحو** - -``` sql -SELECT if(cond, then, else) -``` - -اگر شرایط `cond` ارزیابی به یک مقدار غیر صفر, می گرداند در نتیجه بیان `then` و نتیجه بیان `else`, اگر در حال حاضر, قلم است. اگر `cond` صفر یا `NULL` سپس نتیجه `then` بیان نادیده گرفته شده است و در نتیجه `else` عبارت, در صورت حاضر, بازگشته است. - -**پارامترها** - -- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. -- `then` - بیان به بازگشت اگر شرایط ملاقات کرده است. -- `else` - بیان به بازگشت اگر شرایط ملاقات نکرده است. - -**مقادیر بازگشتی** - -تابع اجرا می شود `then` و `else` عبارات و نتیجه خود را بر می گرداند, بسته به اینکه شرایط `cond` به پایان رسید تا صفر یا نه. - -**مثال** - -پرسوجو: - -``` sql -SELECT if(1, plus(2, 2), plus(2, 6)) -``` - -نتیجه: - -``` text -┌─plus(2, 2)─┐ -│ 4 │ -└────────────┘ -``` - -پرسوجو: - -``` sql -SELECT if(0, plus(2, 2), plus(2, 6)) -``` - -نتیجه: - -``` text -┌─plus(2, 6)─┐ -│ 8 │ -└────────────┘ -``` - -- `then` و `else` باید کمترین نوع مشترک دارند. - -**مثال:** - -اینو بگیر `LEFT_RIGHT` جدول: - -``` sql -SELECT * -FROM LEFT_RIGHT - -┌─left─┬─right─┐ -│ ᴺᵁᴸᴸ │ 4 │ -│ 1 │ 3 │ -│ 2 │ 2 │ -│ 3 │ 1 │ -│ 4 │ ᴺᵁᴸᴸ │ -└──────┴───────┘ -``` - -پرس و جو زیر مقایسه می کند `left` و `right` مقادیر: - -``` sql -SELECT - left, - right, - if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller -FROM LEFT_RIGHT -WHERE isNotNull(left) AND isNotNull(right) - -┌─left─┬─right─┬─is_smaller──────────────────────────┐ -│ 1 │ 3 │ left is smaller than right │ -│ 2 │ 2 │ right is greater or equal than left │ -│ 3 │ 1 │ right is greater or equal than left │ -└──────┴───────┴─────────────────────────────────────┘ -``` - -یادداشت: `NULL` ارزش ها در این مثال استفاده نمی شود, بررسی [ارزشهای پوچ در شرطی](#null-values-in-conditionals) بخش. - -## اپراتور سه تایی {#ternary-operator} - -این همان کار می کند `if` تابع. - -نحو: `cond ? then : else` - -بازگشت `then` اگر `cond` ارزیابی درست باشد (بیشتر از صفر), در غیر این صورت بازده `else`. - -- `cond` باید از نوع باشد `UInt8` و `then` و `else` باید کمترین نوع مشترک دارند. - -- `then` و `else` می تواند باشد `NULL` - -**همچنین نگاه کنید به** - -- [اطلاعات دقیق](other_functions.md#ifnotfinite). - -## چندف {#multiif} - -اجازه می دهد تا شما را به نوشتن [CASE](../operators.md#operator_case) اپراتور فشرده تر در پرس و جو. - -نحو: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` - -**پارامترها:** - -- `cond_N` — The condition for the function to return `then_N`. -- `then_N` — The result of the function when executed. -- `else` — The result of the function if none of the conditions is met. - -تابع می پذیرد `2N+1` پارامترها - -**مقادیر بازگشتی** - -تابع یکی از مقادیر را برمی گرداند `then_N` یا `else`, بسته به شرایط `cond_N`. - -**مثال** - -دوباره با استفاده از `LEFT_RIGHT` جدول - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─result──────────┐ -│ ᴺᵁᴸᴸ │ 4 │ Null value │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ left is greater │ -│ 4 │ ᴺᵁᴸᴸ │ Null value │ -└──────┴───────┴─────────────────┘ -``` - -## با استفاده از نتایج شرطی به طور مستقیم {#using-conditional-results-directly} - -شرطی همیشه به نتیجه `0`, `1` یا `NULL`. بنابراین شما می توانید نتایج شرطی به طور مستقیم مثل این استفاده کنید: - -``` sql -SELECT left < right AS is_small -FROM LEFT_RIGHT - -┌─is_small─┐ -│ ᴺᵁᴸᴸ │ -│ 1 │ -│ 0 │ -│ 0 │ -│ ᴺᵁᴸᴸ │ -└──────────┘ -``` - -## ارزشهای پوچ در شرطی {#null-values-in-conditionals} - -زمانی که `NULL` ارزش ها در شرطی درگیر, نتیجه نیز خواهد بود `NULL`. - -``` sql -SELECT - NULL < 1, - 2 < NULL, - NULL < NULL, - NULL = NULL - -┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ -│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└───────────────┴───────────────┴──────────────────┴────────────────────┘ -``` - -بنابراین شما باید نمایش داده شد خود را با دقت ساخت اگر انواع هستند `Nullable`. - -مثال زیر نشان می دهد این شکست برای اضافه کردن شرایط برابر به `multiIf`. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─faulty_result────┐ -│ ᴺᵁᴸᴸ │ 4 │ Both equal │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ right is smaller │ -│ 4 │ ᴺᵁᴸᴸ │ Both equal │ -└──────┴───────┴──────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/fa/sql_reference/functions/date_time_functions.md b/docs/fa/sql_reference/functions/date_time_functions.md deleted file mode 100644 index 8a34ad69b3f..00000000000 --- a/docs/fa/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,451 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u062A\u0627\u0631\u06CC\u062E \u0648\ - \ \u0632\u0645\u0627\u0646" ---- - -# توابع برای کار با تاریخ و زمان {#functions-for-working-with-dates-and-times} - -پشتیبانی از مناطق زمانی - -همه توابع برای کار با تاریخ و زمان است که یک استفاده منطقی برای منطقه زمانی می تواند یک زمان اختیاری استدلال منطقه دوم قبول. مثال: اسیا/یکاترینبورگ. در این مورد از منطقه زمانی مشخص شده به جای محلی (پیش فرض) استفاده می کنند. - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - -``` text -┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ -└─────────────────────┴────────────┴────────────┴─────────────────────┘ -``` - -فقط مناطق زمانی که از مجموعه مقالات توسط تعداد کل ساعت متفاوت پشتیبانی می شوند. - -## توتیمزون {#totimezone} - -تبدیل زمان یا تاریخ و زمان به منطقه زمانی مشخص شده است. - -## اسباب بازی {#toyear} - -تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت16 حاوی شماره سال (میلادی). - -## فهرست توزیع جدید {#toquarter} - -تبدیل یک تاریخ یا تاریخ با زمان به یک عدد کوچک8 حاوی شماره سه ماهه. - -## تامونت {#tomonth} - -تبدیل یک تاریخ یا تاریخ با زمان به یک عدد کوچک8 حاوی شماره ماه (1-12). - -## سال {#todayofyear} - -تبدیل یک تاریخ و یا تاریخ با گذشت زمان به یک uint16 تعداد شامل تعداد روز از سال (1-366). - -## تودیفمون {#todayofmonth} - -تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت8 حاوی تعداد روز از ماه (1-31). - -## تدیفوک {#todayofweek} - -تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت8 حاوی تعداد روز هفته (دوشنبه است 1, و یکشنبه است 7). - -## تمام {#tohour} - -تبدیل تاریخ با هم به یک uint8 شماره حاوی تعداد ساعت در زمان 24 ساعته (0-23). -This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). - -## تامینوت {#tominute} - -تبدیل تاریخ با هم به یک uint8 شماره حاوی تعداد دقیقه از ساعت (0-59). - -## جای خالی {#tosecond} - -تبدیل تاریخ با هم به یک uint8 شماره حاوی شماره دوم در دقیقه (0-59). -ثانیه جهش برای به حساب نمی. - -## تیونیتیمستمپ {#to-unix-timestamp} - -برای استدلال حسگر ناحیه رنگی: تبدیل ارزش به نمایندگی عددی داخلی خود (برچسب زمان یونیکس). -برای استدلال رشته: تاریخ ساعت پارسه از رشته با توجه به منطقه زمانی (بحث دوم اختیاری, منطقه زمانی سرور به طور پیش فرض استفاده می شود) و مربوط برچسب زمان یونیکس می گرداند. -برای استدلال تاریخ: رفتار نامشخص است. - -**نحو** - -``` sql -toUnixTimestamp(datetime) -toUnixTimestamp(str, [timezone]) -``` - -**مقدار بازگشتی** - -- زمان یونیکس را برمی گرداند. - -نوع: `UInt32`. - -**مثال** - -پرسوجو: - -``` sql -SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp -``` - -نتیجه: - -``` text -┌─unix_timestamp─┐ -│ 1509836867 │ -└────────────────┘ -``` - -## سال نو {#tostartofyear} - -دور یک تاریخ یا تاریخ با زمان به روز اول سال. -تاریخ را برمی گرداند. - -## تاستارتوفیزیر {#tostartofisoyear} - -دور کردن تاریخ یا تاریخ با زمان به روز اول سال ایزو. -تاریخ را برمی گرداند. - -## toStartOfQuarter {#tostartofquarter} - -دور یک تاریخ یا تاریخ با زمان به روز اول سه ماهه. -اولین روز از سه ماهه است یا 1 ژانویه, 1 مارس, 1 جولای, یا 1 اکتبر. -تاریخ را برمی گرداند. - -## ماهی تابه {#tostartofmonth} - -دور پایین تاریخ یا تاریخ با زمان به روز اول ماه. -تاریخ را برمی گرداند. - -!!! attention "توجه" - رفتار تجزیه تاریخ نادرست اجرای خاص است. تاتر ممکن است صفر تاریخ بازگشت, پرتاب یک استثنا و یا انجام “natural” سرریز کردن. - -## روز قیامت {#tomonday} - -دور کردن یک تاریخ یا تاریخ با زمان به نزدیکترین دوشنبه. -تاریخ را برمی گرداند. - -## تستارتوفک (تی \[, حالت\]) {#tostartofweektmode} - -دور یک تاریخ یا تاریخ را با زمان به نزدیکترین یکشنبه یا دوشنبه با حالت. -تاریخ را برمی گرداند. -استدلال حالت کار می کند دقیقا مانند استدلال حالت به یدک کش (). برای نحو تک استدلال, ارزش حالت 0 استفاده شده است. - -## روزهای سه بعدی {#tostartofday} - -دور پایین تاریخ با زمان به شروع روز. - -## تاستارتوفهور {#tostartofhour} - -دور پایین تاریخ با زمان به شروع ساعت. - -## حفاظت {#tostartofminute} - -دور پایین تاریخ با زمان به شروع دقیقه. - -## تستارتوفیفومینوت {#tostartoffiveminute} - -دور پایین تاریخ با زمان به شروع فاصله پنج دقیقه. - -## حفاظت {#tostartoftenminutes} - -دور پایین تاریخ با زمان به شروع فاصله ده دقیقه. - -## toStartOfFifteenMinutes {#tostartoffifteenminutes} - -دور پایین تاریخ با زمان به شروع فاصله پانزده دقیقه. - -## toStartOfInterval(time\_or\_data فاصله x واحد \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -این یک تعمیم توابع دیگر به نام است `toStartOf*`. به عنوان مثال, -`toStartOfInterval(t, INTERVAL 1 year)` همان را برمی گرداند `toStartOfYear(t)`, -`toStartOfInterval(t, INTERVAL 1 month)` همان را برمی گرداند `toStartOfMonth(t)`, -`toStartOfInterval(t, INTERVAL 1 day)` همان را برمی گرداند `toStartOfDay(t)`, -`toStartOfInterval(t, INTERVAL 15 minute)` همان را برمی گرداند `toStartOfFifteenMinutes(t)` و غیره - -## & تمام کردن {#totime} - -تبدیل یک تاریخ با زمان به یک تاریخ ثابت خاص, در حالی که حفظ زمان. - -## ترلتیویینوم {#torelativeyearnum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد سال, با شروع از یک نقطه ثابت خاص در گذشته. - -## ترلتیواارترن {#torelativequarternum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد سه ماهه, با شروع از یک نقطه ثابت خاص در گذشته. - -## ترلتیومنتنوم {#torelativemonthnum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد ماه, با شروع از یک نقطه ثابت خاص در گذشته. - -## ترلتیواکنام {#torelativeweeknum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد هفته, با شروع از یک نقطه ثابت خاص در گذشته. - -## ترلتیدینوم {#torelativedaynum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد روز, با شروع از یک نقطه ثابت خاص در گذشته. - -## تورلاتویورنام {#torelativehournum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد ساعت, با شروع از یک نقطه ثابت خاص در گذشته. - -## ترلتیومینوتنوم {#torelativeminutenum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد دقیقه, با شروع از یک نقطه ثابت خاص در گذشته. - -## ترلتیویسکنندوم {#torelativesecondnum} - -تبدیل یک تاریخ با زمان و یا تاریخ به تعداد دوم, با شروع از یک نقطه ثابت خاص در گذشته. - -## ریز ریز کردن {#toisoyear} - -تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت16 حاوی شماره سال ایزو. - -## هشدار داده می شود {#toisoweek} - -تبدیل یک تاریخ و یا تاریخ با گذشت زمان به یک uint8 تعداد شامل iso هفته شماره. - -## تاریخ \[, حالت\]) {#toweekdatemode} - -این تابع تعداد هفته برای تاریخ و یا تاریخ ساعت می گرداند. فرم دو برهان یدک کش () شما را قادر به مشخص کنید که هفته در روز یکشنبه یا دوشنبه شروع می شود و چه مقدار بازگشتی باید در محدوده 0 تا 53 یا از 1 به 53 باشد. اگر استدلال حالت حذف شده است, حالت پیش فرض است 0. -`toISOWeek()`یک تابع سازگاری است که معادل است `toWeek(date,3)`. -جدول زیر توضیح می دهد که چگونه استدلال حالت کار می کند. - -| حالت | اولین روز هفته | گستره | Week 1 is the first week … | -|------|----------------|-------|-----------------------------| -| 0 | یکشنبه | 0-53 | با یکشنبه در این سال | -| 1 | دوشنبه | 0-53 | با 4 یا چند روز در سال جاری | -| 2 | یکشنبه | 1-53 | با یکشنبه در این سال | -| 3 | دوشنبه | 1-53 | با 4 یا چند روز در سال جاری | -| 4 | یکشنبه | 0-53 | با 4 یا چند روز در سال جاری | -| 5 | دوشنبه | 0-53 | با دوشنبه در این سال | -| 6 | یکشنبه | 1-53 | با 4 یا چند روز در سال جاری | -| 7 | دوشنبه | 1-53 | با دوشنبه در این سال | -| 8 | یکشنبه | 1-53 | شامل ژانویه 1 | -| 9 | دوشنبه | 1-53 | شامل ژانویه 1 | - -برای مقادیر حالت با معنی “with 4 or more days this year,” هفته ها با توجه به ایزو شماره 8601: 1988: - -- اگر هفته حاوی ژانویه 1 است 4 یا چند روز در سال جدید, هفته است 1. - -- در غیر این صورت, این هفته گذشته سال گذشته است, و هفته بعد هفته است 1. - -برای مقادیر حالت با معنی “contains January 1”, هفته شامل ژانویه 1 هفته است 1. مهم نیست که چند روز در سال جدید هفته شامل, حتی اگر شامل تنها یک روز. - -``` sql -toWeek(date, [, mode][, Timezone]) -``` - -**پارامترها** - -- `date` – Date or DateTime. -- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. -- `Timezone` – Optional parameter, it behaves like any other conversion function. - -**مثال** - -``` sql -SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; -``` - -``` text -┌───────date─┬─week0─┬─week1─┬─week9─┐ -│ 2016-12-27 │ 52 │ 52 │ 1 │ -└────────────┴───────┴───────┴───────┘ -``` - -## تاریخ \[, حالت\]) {#toyearweekdatemode} - -را برمی گرداند سال و هفته برای تاریخ. سال در نتیجه ممکن است متفاوت از سال در بحث تاریخ برای اولین و هفته گذشته سال. - -استدلال حالت کار می کند دقیقا مانند استدلال حالت به یدک کش (). برای نحو تک استدلال, ارزش حالت 0 استفاده شده است. - -`toISOYear()`یک تابع سازگاری است که معادل است `intDiv(toYearWeek(date,3),100)`. - -**مثال** - -``` sql -SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; -``` - -``` text -┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ -│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ -└────────────┴───────────┴───────────┴───────────┘ -``` - -## حالا {#now} - -قبول صفر استدلال و بازده زمان فعلی در یکی از لحظات اجرای درخواست. -این تابع ثابت می گرداند, حتی اگر درخواست زمان طولانی برای تکمیل. - -## امروز {#today} - -قبول صفر استدلال و بازده تاریخ جاری در یکی از لحظات اجرای درخواست. -همان ‘toDate(now())’. - -## دیروز {#yesterday} - -قبول صفر استدلال و بازده تاریخ دیروز در یکی از لحظات اجرای درخواست. -همان ‘today() - 1’. - -## سانس {#timeslot} - -دور زمان به نیم ساعت. -این تابع خاص به یاندکس است.متریکا, از نیم ساعت حداقل مقدار زمان برای شکستن یک جلسه به دو جلسه است اگر یک تگ ردیابی نشان می دهد تعداد صفحات متوالی یک کاربر که در زمان به شدت بیش از این مقدار متفاوت. این به این معنی است که تاپل (شناسه برچسب, شناسه کاربری, و شکاف زمان) را می توان مورد استفاده قرار گیرد به جستجو برای تعداد صفحات که در جلسه مربوطه شامل. - -## ستاره فیلم سکسی {#toyyyymm} - -تبدیل یک تاریخ یا تاریخ با زمان به یک عدد اوینت32 حاوی تعداد سال و ماه (یی \* 100 + میلی متر). - -## ستاره فیلم سکسی {#toyyyymmdd} - -تبدیل یک تاریخ یا تاریخ با زمان به تعداد اوینت32 حاوی سال و ماه شماره (یی \* 10000 + میلی متر \* 100 + دی.دی. - -## اطلاعات دقیق {#toyyyymmddhhmmss} - -تبدیل یک تاریخ و یا تاریخ با گذشت زمان به یک uint64 تعداد شامل سال و ماه شماره (yyyy \* 10000000000 + mm \* 100000000 + dd \* 1000000 + hh \* 10000 + mm \* 100 + ss) است. - -## addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} - -تابع می افزاید: یک تاریخ/فاصله زمانی به یک تاریخ/تاریخ ساعت و سپس بازگشت تاریخ / تاریخ ساعت. به عنوان مثال: - -``` sql -WITH - toDate('2018-01-01') AS date, - toDateTime('2018-01-01 00:00:00') AS date_time -SELECT - addYears(date, 1) AS add_years_with_date, - addYears(date_time, 1) AS add_years_with_date_time -``` - -``` text -┌─add_years_with_date─┬─add_years_with_date_time─┐ -│ 2019-01-01 │ 2019-01-01 00:00:00 │ -└─────────────────────┴──────────────────────────┘ -``` - -## subtractYears, subtractMonths, subtractWeeks, subtractDays, subtractHours, subtractMinutes, subtractSeconds, subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} - -تابع تفریق یک تاریخ/فاصله زمانی به تاریخ/تاریخ ساعت و سپس بازگشت تاریخ / تاریخ ساعت. به عنوان مثال: - -``` sql -WITH - toDate('2019-01-01') AS date, - toDateTime('2019-01-01 00:00:00') AS date_time -SELECT - subtractYears(date, 1) AS subtract_years_with_date, - subtractYears(date_time, 1) AS subtract_years_with_date_time -``` - -``` text -┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ -│ 2018-01-01 │ 2018-01-01 00:00:00 │ -└──────────────────────────┴───────────────────────────────┘ -``` - -## dateDiff {#datediff} - -بازگرداندن تفاوت بین دو تاریخ و یا تاریخ ساعت ارزش. - -**نحو** - -``` sql -dateDiff('unit', startdate, enddate, [timezone]) -``` - -**پارامترها** - -- `unit` — Time unit, in which the returned value is expressed. [رشته](../syntax.md#syntax-string-literal). - - Supported values: - - | unit | - | ---- | - |second | - |minute | - |hour | - |day | - |week | - |month | - |quarter | - |year | - -- `startdate` — The first time value to compare. [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). - -- `enddate` — The second time value to compare. [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). - -- `timezone` — Optional parameter. If specified, it is applied to both `startdate` و `enddate`. اگر مشخص نشده, زمان از `startdate` و `enddate` استفاده می شود. در صورتی که یکسان نیست, نتیجه نامشخص است. - -**مقدار بازگشتی** - -تفاوت بین `startdate` و `enddate` بیان شده در `unit`. - -نوع: `int`. - -**مثال** - -پرسوجو: - -``` sql -SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); -``` - -نتیجه: - -``` text -┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ -│ 25 │ -└────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## زمانهای(StartTime, مدت,\[, اندازه\]) {#timeslotsstarttime-duration-size} - -برای یک بازه زمانی شروع در ‘StartTime’ و در ادامه برای ‘Duration’ ثانیه, این مجموعه ای از لحظات در زمان گرداند, متشکل از نقاط از این فاصله به گرد ‘Size’ در عرض چند ثانیه ‘Size’ یک پارامتر اختیاری است: یک ثابت اوینت32, مجموعه ای به 1800 به طور پیش فرض. -به عنوان مثال, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. -این برای جستجوی صفحات در جلسه مربوطه ضروری است. - -## formatDateTime(زمان فرمت \[منطقه زمانی\]) {#formatdatetime} - -Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. - -اصلاح کننده های پشتیبانی شده برای فرمت: -(“Example” ستون نتیجه قالب بندی برای زمان را نشان می دهد `2018-01-02 22:33:44`) - -| تغییردهنده | توصیف | مثال | -|------------|-----------------------------------------------------------------------------|------------| -| %C | سال تقسیم بر 100 و کوتاه به عدد صحیح (00-99) | 20 | -| \# د | روز از ماه, صفر خالی (01-31) | 02 | -| %D | کوتاه میلی متر/دی دی/یی تاریخ, معادل %متر/%د / %و | 01/02/18 | -| \# ا | روز از ماه, فضا خالی ( 1-31) | 2 | -| %F | کوتاه تاریخ یی-میلی متر-دی دی, معادل%و-%متر - % د | 2018-01-02 | -| %H | ساعت در فرمت 24 ساعت (00-23) | 22 | -| %I | ساعت در فرمت 12 ساعت (01-12) | 10 | -| \# ج | روز سال (001-366) | 002 | -| % متر | ماه به عنوان یک عدد اعشاری (01-12) | 01 | -| %M | دقیقه (00-59) | 33 | -| % ن | شخصیت جدید خط (") | | -| \# پ | هستم یا بعد از ظهر تعیین | PM | -| %R | 24-ساعت ساعت ساعت: زمان میلی متر, معادل %ساعت: % متر | 22:33 | -| %S | دوم (00-59) | 44 | -| % تی | شخصیت افقی تب (') | | -| %T | ایزو 8601 فرمت زمان (ساعت:میلی متر:اس اس), معادل %ساعت:%متر:%بازدید کنندگان | 22:33:44 | -| \# تو | ایزو 8601 روز هفته به عنوان شماره با دوشنبه به عنوان 1 (1-7) | 2 | -| %V | ایزو 8601 هفته شماره (01-53) | 01 | -| \# وات | روز هفته به عنوان یک عدد اعشاری با یکشنبه به عنوان 0 (0-6) | 2 | -| \#... | سال گذشته دو رقم (00-99) | 18 | -| %Y | سال | 2018 | -| %% | یک % نشانه | % | - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/fa/sql_reference/functions/encoding_functions.md b/docs/fa/sql_reference/functions/encoding_functions.md deleted file mode 100644 index 0c08d0cad86..00000000000 --- a/docs/fa/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 52 -toc_title: "\u06A9\u062F\u0628\u0646\u062F\u06CC" ---- - -# توابع را پشتیبانی می کند {#encoding-functions} - -## کاراکتر {#char} - -بازگرداندن رشته با طول به عنوان تعدادی از استدلال گذشت و هر بایت دارای ارزش استدلال مربوطه. می پذیرد استدلال های متعدد از انواع عددی. اگر ارزش بحث خارج از محدوده uint8 نوع داده آن است که تبدیل به uint8 با امکان گرد کردن و سرریز. - -**نحو** - -``` sql -char(number_1, [number_2, ..., number_n]); -``` - -**پارامترها** - -- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../../sql_reference/data_types/int_uint.md), [شناور](../../sql_reference/data_types/float.md). - -**مقدار بازگشتی** - -- یک رشته از بایت داده. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello -``` - -نتیجه: - -``` text -┌─hello─┐ -│ hello │ -└───────┘ -``` - -شما می توانید یک رشته از رمزگذاری دلخواه با عبور از بایت مربوطه ساخت. در اینجا به عنوان مثال برای یونایتد-8 است: - -پرسوجو: - -``` sql -SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; -``` - -نتیجه: - -``` text -┌─hello──┐ -│ привет │ -└────────┘ -``` - -پرسوجو: - -``` sql -SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; -``` - -نتیجه: - -``` text -┌─hello─┐ -│ 你好 │ -└───────┘ -``` - -## هکس {#hex} - -بازگرداندن یک رشته حاوی نمایندگی هگزادسیمال استدلال. - -**نحو** - -``` sql -hex(arg) -``` - -تابع با استفاده از حروف بزرگ `A-F` و با استفاده از هیچ پیشوندها (مانند `0x`) یا پسوندها (مانند `h`). - -برای استدلال عدد صحیح رقم سحر و جادو را چاپ می کند (“nibbles”) از مهم ترین به حداقل قابل توجهی (اندی بزرگ یا “human readable” سفارش). این با مهم ترین بایت غیر صفر شروع می شود (پیشرو صفر بایت حذف می شوند) اما همیشه چاپ هر دو رقم از هر بایت حتی اگر رقم پیشرو صفر است. - -مثال: - -**مثال** - -پرسوجو: - -``` sql -SELECT hex(1); -``` - -نتیجه: - -``` text -01 -``` - -مقادیر نوع `Date` و `DateTime` به عنوان اعداد صحیح مربوطه فرمت (تعداد روز از عصر برای تاریخ و ارزش برچسب زمان یونیکس برای تاریخ ساعت داده). - -برای `String` و `FixedString`, تمام بایت به سادگی به عنوان دو عدد هگزادسیمال کد گذاری. صفر بایت حذف نشده است. - -ارزش های ممیز شناور و رقم اعشاری به عنوان نمایندگی خود را در حافظه کد گذاری. همانطور که ما از معماری اندیان کوچک حمایت می کنیم در اندی کوچک کد گذاری می شوند. صفر پیشرو / عقبی بایت حذف نشده است. - -**پارامترها** - -- `arg` — A value to convert to hexadecimal. Types: [رشته](../../sql_reference/data_types/string.md), [اینترنت](../../sql_reference/data_types/int_uint.md), [شناور](../../sql_reference/data_types/float.md), [دهدهی](../../sql_reference/data_types/decimal.md), [تاریخ](../../sql_reference/data_types/date.md) یا [DateTime](../../sql_reference/data_types/datetime.md). - -**مقدار بازگشتی** - -- یک رشته با نمایش هگزادسیمال استدلال. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); -``` - -نتیجه: - -``` text -┌─hex_presentation─┐ -│ 00007041 │ -│ 00008041 │ -└──────────────────┘ -``` - -پرسوجو: - -``` sql -SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); -``` - -نتیجه: - -``` text -┌─hex_presentation─┐ -│ 0000000000002E40 │ -│ 0000000000003040 │ -└──────────────────┘ -``` - -## unhex(str) {#unhexstr} - -می پذیرد یک رشته حاوی هر تعداد از رقم هگزادسیمال, و یک رشته حاوی بایت مربوطه را برمی گرداند. پشتیبانی از حروف بزرگ و کوچک تعداد ارقام هگزادسیمال ندارد به حتی. اگر عجیب و غریب است, رقم گذشته به عنوان نیمه حداقل قابل توجهی از بایت 00-0ف تفسیر. اگر رشته استدلال شامل هر چیزی غیر از رقم هگزادسیمال, برخی از نتیجه پیاده سازی تعریف بازگشته است (یک استثنا پرتاب نمی شود). -اگر شما می خواهید برای تبدیل نتیجه به یک عدد, شما می توانید با استفاده از ‘reverse’ و ‘reinterpretAsType’ توابع. - -## هشدار داده می شود) {#uuidstringtonumstr} - -می پذیرد یک رشته حاوی 36 کاراکتر در قالب `123e4567-e89b-12d3-a456-426655440000` و به عنوان مجموعه ای از بایت ها در یک رشته ثابت(16) باز می گردد. - -## هشدار داده می شود) {#uuidnumtostringstr} - -می پذیرد یک رشته ثابت (16) ارزش. بازگرداندن یک رشته حاوی 36 کاراکتر در قالب متن. - -## بیتماسکتولیست (عدد) {#bitmasktolistnum} - -می پذیرد یک عدد صحیح. بازگرداندن یک رشته حاوی لیستی از قدرت های دو که در مجموع تعداد منبع که خلاصه. با کاما از هم جدا بدون فاصله در قالب متن, به ترتیب صعودی. - -## هشدار داده می شود) {#bitmasktoarraynum} - -می پذیرد یک عدد صحیح. بازگرداندن مجموعه ای از اعداد اوینت64 حاوی لیستی از قدرت های دو که در مجموع تعداد منبع در هنگام خلاصه. اعداد به ترتیب صعودی هستند. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/fa/sql_reference/functions/ext_dict_functions.md b/docs/fa/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index 622344f789c..00000000000 --- a/docs/fa/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,206 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 58 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0648\u0627\u0698\u0647\u0646\u0627\u0645\ - \u0647\u0647\u0627 \u062E\u0627\u0631\u062C\u06CC" ---- - -# توابع برای کار با لغت نامه های خارجی {#ext_dict_functions} - -برای اطلاعات در مورد اتصال و پیکربندی لغت نامه های خارجی, دیدن [واژهنامهها خارجی](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -## دیکته کردن {#dictget} - -بازیابی یک مقدار از یک فرهنگ لغت خارجی. - -``` sql -dictGet('dict_name', 'attr_name', id_expr) -dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**پارامترها** - -- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql_reference/data_types/int_uint.md) یا [تاپل](../../sql_reference/data_types/tuple.md)- نوع ارزش بسته به پیکربندی فرهنگ لغت . -- `default_value_expr` — Value returned if the dictionary doesn't contain a row with the `id_expr` کلید [عبارت](../syntax.md#syntax-expressions) بازگشت ارزش در نوع داده پیکربندی شده برای `attr_name` صفت کردن. - -**مقدار بازگشتی** - -- اگر تاتر تجزیه ویژگی موفقیت در [نوع داده خصیصه](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), توابع بازگشت ارزش ویژگی فرهنگ لغت که مربوط به `id_expr`. - -- اگر هیچ کلید وجود دارد, مربوط به `id_expr`, در فرهنگ لغت, سپس: - - - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. - -کلیک هاوس می اندازد یک استثنا اگر می تواند ارزش ویژگی تجزیه و یا ارزش می کند نوع داده ویژگی مطابقت ندارد. - -**مثال** - -ایجاد یک فایل متنی `ext-dict-text.csv` حاوی موارد زیر است: - -``` text -1,1 -2,2 -``` - -ستون اول است `id` ستون دوم `c1`. - -پیکربندی واژهنامه خارجی: - -``` xml - - - ext-dict-test - - - /path-to/ext-dict-test.csv - CSV - - - - - - - - id - - - c1 - UInt32 - - - - 0 - - -``` - -انجام پرس و جو: - -``` sql -SELECT - dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, - toTypeName(val) AS type -FROM system.numbers -LIMIT 3 -``` - -``` text -┌─val─┬─type───┐ -│ 1 │ UInt32 │ -│ 2 │ UInt32 │ -│ 20 │ UInt32 │ -└─────┴────────┘ -``` - -**همچنین نگاه کنید** - -- [واژهنامهها خارجی](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) - -## دیکتس {#dicthas} - -بررسی اینکه یک کلید در حال حاضر در یک فرهنگ لغت است. - -``` sql -dictHas('dict_name', id_expr) -``` - -**پارامترها** - -- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql_reference/data_types/int_uint.md)- نوع ارزش. - -**مقدار بازگشتی** - -- 0, اگر هیچ کلید وجود دارد. -- 1, اگر یک کلید وجود دارد. - -نوع: `UInt8`. - -## حکومت دیکتاتوری {#dictgethierarchy} - -یک مجموعه ای ایجاد می کند که شامل همه والدین یک کلید در [فرهنگ لغت سلسله مراتبی](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md). - -**نحو** - -``` sql -dictGetHierarchy('dict_name', key) -``` - -**پارامترها** - -- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). -- `key` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql_reference/data_types/int_uint.md)- نوع ارزش. - -**مقدار بازگشتی** - -- پدر و مادر برای کلید. - -نوع: [Array(UInt64)](../../sql_reference/data_types/array.md). - -## دیکتاتوری {#dictisin} - -جد یک کلید را از طریق کل زنجیره سلسله مراتبی در فرهنگ لغت بررسی می کند. - -``` sql -dictIsIn('dict_name', child_id_expr, ancestor_id_expr) -``` - -**پارامترها** - -- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). -- `child_id_expr` — Key to be checked. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql_reference/data_types/int_uint.md)- نوع ارزش. -- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` کلید [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql_reference/data_types/int_uint.md)- نوع ارزش. - -**مقدار بازگشتی** - -- 0 اگر `child_id_expr` یک کودک نیست `ancestor_id_expr`. -- 1 اگر `child_id_expr` یک کودک است `ancestor_id_expr` یا اگر `child_id_expr` یک `ancestor_id_expr`. - -نوع: `UInt8`. - -## توابع دیگر {#ext_dict_functions-other} - -تاتر پشتیبانی از توابع تخصصی است که تبدیل ارزش فرهنگ لغت ویژگی به یک نوع داده خاص بدون در نظر گرفتن پیکربندی فرهنگ لغت. - -توابع: - -- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` -- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` -- `dictGetFloat32`, `dictGetFloat64` -- `dictGetDate` -- `dictGetDateTime` -- `dictGetUUID` -- `dictGetString` - -همه این توابع `OrDefault` اصلاح. به عنوان مثال, `dictGetDateOrDefault`. - -نحو: - -``` sql -dictGet[Type]('dict_name', 'attr_name', id_expr) -dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**پارامترها** - -- `dict_name` — Name of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [رشته تحت اللفظی](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [عبارت](../syntax.md#syntax-expressions) بازگشت یک [UInt64](../../sql_reference/data_types/int_uint.md)- نوع ارزش. -- `default_value_expr` — Value which is returned if the dictionary doesn't contain a row with the `id_expr` کلید [عبارت](../syntax.md#syntax-expressions) بازگشت یک مقدار در نوع داده پیکربندی شده برای `attr_name` صفت کردن. - -**مقدار بازگشتی** - -- اگر تاتر تجزیه ویژگی موفقیت در [نوع داده خصیصه](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), توابع بازگشت ارزش ویژگی فرهنگ لغت که مربوط به `id_expr`. - -- در صورتی که هیچ درخواست وجود دارد `id_expr` در فرهنگ لغت و سپس: - - - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. - -کلیک هاوس می اندازد یک استثنا اگر می تواند ارزش ویژگی تجزیه و یا ارزش می کند نوع داده ویژگی مطابقت ندارد. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/fa/sql_reference/functions/functions_for_nulls.md b/docs/fa/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 02efe209696..00000000000 --- a/docs/fa/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,313 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 63 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 Nullable \u0627\u0633\u062A\u062F\u0644\ - \u0627\u0644" ---- - -# توابع برای کار با nullable مصالح {#functions-for-working-with-nullable-aggregates} - -## isNull {#isnull} - -بررسی اینکه بحث چیست [NULL](../syntax.md#null). - -``` sql -isNull(x) -``` - -**پارامترها** - -- `x` — A value with a non-compound data type. - -**مقدار بازگشتی** - -- `1` اگر `x` هست `NULL`. -- `0` اگر `x` نیست `NULL`. - -**مثال** - -جدول ورودی - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -پرسوجو - -``` sql -SELECT x FROM t_null WHERE isNull(y) -``` - -``` text -┌─x─┐ -│ 1 │ -└───┘ -``` - -## اینترنت {#isnotnull} - -بررسی اینکه بحث چیست [NULL](../syntax.md#null). - -``` sql -isNotNull(x) -``` - -**پارامترها:** - -- `x` — A value with a non-compound data type. - -**مقدار بازگشتی** - -- `0` اگر `x` هست `NULL`. -- `1` اگر `x` نیست `NULL`. - -**مثال** - -جدول ورودی - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -پرسوجو - -``` sql -SELECT x FROM t_null WHERE isNotNull(y) -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## فلز کاری {#coalesce} - -چک از چپ به راست چه `NULL` استدلال به تصویب رسید و اولین غیر گرداند-`NULL` استدلال کردن. - -``` sql -coalesce(x,...) -``` - -**پارامترها:** - -- هر تعداد از پارامترهای یک نوع غیر مرکب. تمام پارامترها باید با نوع داده سازگار باشند. - -**مقادیر بازگشتی** - -- اولین غیر-`NULL` استدلال کردن. -- `NULL`, اگر همه استدلال ها `NULL`. - -**مثال** - -یک لیست از مخاطبین است که ممکن است راه های متعدد برای تماس با مشتری مشخص را در نظر بگیرید. - -``` text -┌─name─────┬─mail─┬─phone─────┬──icq─┐ -│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ -│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└──────────┴──────┴───────────┴──────┘ -``` - -این `mail` و `phone` زمینه های رشته نوع هستند, اما `icq` زمینه است `UInt32` بنابراین نیاز به تبدیل شدن به `String`. - -دریافت اولین روش تماس در دسترس برای مشتری از لیست تماس: - -``` sql -SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook -``` - -``` text -┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ -│ client 1 │ 123-45-67 │ -│ client 2 │ ᴺᵁᴸᴸ │ -└──────────┴──────────────────────────────────────────────────────┘ -``` - -## ifNull {#ifnull} - -بازگرداندن یک مقدار جایگزین اگر استدلال اصلی است `NULL`. - -``` sql -ifNull(x,alt) -``` - -**پارامترها:** - -- `x` — The value to check for `NULL`. -- `alt` — The value that the function returns if `x` هست `NULL`. - -**مقادیر بازگشتی** - -- مقدار `x` اگر `x` نیست `NULL`. -- مقدار `alt` اگر `x` هست `NULL`. - -**مثال** - -``` sql -SELECT ifNull('a', 'b') -``` - -``` text -┌─ifNull('a', 'b')─┐ -│ a │ -└──────────────────┘ -``` - -``` sql -SELECT ifNull(NULL, 'b') -``` - -``` text -┌─ifNull(NULL, 'b')─┐ -│ b │ -└───────────────────┘ -``` - -## nullIf {#nullif} - -بازگشت `NULL` اگر استدلال برابر هستند. - -``` sql -nullIf(x, y) -``` - -**پارامترها:** - -`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. - -**مقادیر بازگشتی** - -- `NULL`, اگر استدلال برابر هستند. -- این `x` ارزش, اگر استدلال برابر نیست. - -**مثال** - -``` sql -SELECT nullIf(1, 1) -``` - -``` text -┌─nullIf(1, 1)─┐ -│ ᴺᵁᴸᴸ │ -└──────────────┘ -``` - -``` sql -SELECT nullIf(1, 2) -``` - -``` text -┌─nullIf(1, 2)─┐ -│ 1 │ -└──────────────┘ -``` - -## قابل قبول {#assumenotnull} - -نتایج در ارزش نوع [Nullable](../../sql_reference/data_types/nullable.md) برای یک غیر- `Nullable`, اگر مقدار است `NULL`. - -``` sql -assumeNotNull(x) -``` - -**پارامترها:** - -- `x` — The original value. - -**مقادیر بازگشتی** - -- مقدار اصلی از غیر-`Nullable` نوع, اگر نیست `NULL`. -- مقدار پیش فرض برای غیر-`Nullable` نوع اگر مقدار اصلی بود `NULL`. - -**مثال** - -در نظر بگیرید که `t_null` جدول - -``` sql -SHOW CREATE TABLE t_null -``` - -``` text -┌─statement─────────────────────────────────────────────────────────────────┐ -│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ -└───────────────────────────────────────────────────────────────────────────┘ -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -درخواست `assumeNotNull` تابع به `y` ستون. - -``` sql -SELECT assumeNotNull(y) FROM t_null -``` - -``` text -┌─assumeNotNull(y)─┐ -│ 0 │ -│ 3 │ -└──────────────────┘ -``` - -``` sql -SELECT toTypeName(assumeNotNull(y)) FROM t_null -``` - -``` text -┌─toTypeName(assumeNotNull(y))─┐ -│ Int8 │ -│ Int8 │ -└──────────────────────────────┘ -``` - -## قابل تنظیم {#tonullable} - -تبدیل نوع استدلال به `Nullable`. - -``` sql -toNullable(x) -``` - -**پارامترها:** - -- `x` — The value of any non-compound type. - -**مقدار بازگشتی** - -- مقدار ورودی با یک `Nullable` نوع. - -**مثال** - -``` sql -SELECT toTypeName(10) -``` - -``` text -┌─toTypeName(10)─┐ -│ UInt8 │ -└────────────────┘ -``` - -``` sql -SELECT toTypeName(toNullable(10)) -``` - -``` text -┌─toTypeName(toNullable(10))─┐ -│ Nullable(UInt8) │ -└────────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/fa/sql_reference/functions/geo.md b/docs/fa/sql_reference/functions/geo.md deleted file mode 100644 index cafe88281d9..00000000000 --- a/docs/fa/sql_reference/functions/geo.md +++ /dev/null @@ -1,511 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 62 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0645\u062E\u062A\u0635\u0627\u062A \u062C\ - \u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC" ---- - -# توابع برای کار با مختصات جغرافیایی {#functions-for-working-with-geographical-coordinates} - -## نمایش سایت {#greatcircledistance} - -محاسبه فاصله بین دو نقطه بر روی سطح زمین با استفاده از [فرمول دایره بزرگ](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**پارامترهای ورودی** - -- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. -- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. -- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. -- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. - -مقادیر مثبت به طول و عرض جغرافیایی شمال شرق مطابقت, و مقادیر منفی به طول و عرض جغرافیایی جنوبی و طول جغرافیایی غرب مطابقت. - -**مقدار بازگشتی** - -فاصله بین دو نقطه بر روی سطح زمین, در متر. - -تولید یک استثنا زمانی که مقادیر پارامتر ورودی در خارج از محدوده قرار می گیرند. - -**مثال** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## نقلقولهای جدید از این نویسنده {#pointinellipses} - -بررسی اینکه نقطه متعلق به حداقل یکی از بیضی. -مختصات هندسی در سیستم مختصات دکارتی هستند. - -``` sql -pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) -``` - -**پارامترهای ورودی** - -- `x, y` — Coordinates of a point on the plane. -- `xᵢ, yᵢ` — Coordinates of the center of the `i`- حذف هفتم . -- `aᵢ, bᵢ` — Axes of the `i`- حذف ت در واحد های ایکس, و مختصات. - -پارامترهای ورودی باید باشد `2+4⋅n` کجا `n` تعداد بیضی است. - -**مقادیر بازگشتی** - -`1` اگر نقطه در داخل است حداقل یکی از بیضی; `0`اگر این طور نیست. - -**مثال** - -``` sql -SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) -``` - -``` text -┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ -│ 1 │ -└─────────────────────────────────────────────────┘ -``` - -## نقطه چین {#pointinpolygon} - -بررسی اینکه نقطه متعلق به چند ضلعی در هواپیما. - -``` sql -pointInPolygon((x, y), [(a, b), (c, d) ...], ...) -``` - -**مقادیر ورودی** - -- `(x, y)` — Coordinates of a point on the plane. Data type — [تاپل](../../sql_reference/data_types/tuple.md) — A tuple of two numbers. -- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [& حذف](../../sql_reference/data_types/array.md). هر راس است که توسط یک جفت مختصات نشان داده شده است `(a, b)`. راس باید در جهت عقربه های ساعت و یا در خلاف جهت عقربه مشخص شده است. حداقل تعداد راس است 3. چند ضلعی باید ثابت باشد. -- این تابع همچنین از چند ضلعی با سوراخ (برش بخش). در این مورد, اضافه چند ضلعی است که تعریف بخش برش با استفاده از استدلال های اضافی از تابع. تابع چند ضلعی غیر به سادگی متصل را پشتیبانی نمی کند. - -**مقادیر بازگشتی** - -`1` اگر نقطه در داخل چند ضلعی باشد, `0` اگر این طور نیست. -اگر نقطه در مرز چند ضلعی, تابع ممکن است یا بازگشت 0 یا 1. - -**مثال** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## کد جغرافیایی {#geohashencode} - -کد طول و عرض جغرافیایی به عنوان یک geohash-رشته مراجعه کنید (http://geohash.org/, https://en.wikipedia.org/wiki/geohash). - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**مقادیر ورودی** - -- طول جغرافیایی-طول جغرافیایی بخشی از مختصات شما می خواهید به رمز. شناور در محدوده`[-180°, 180°]` -- عرض جغرافیایی-عرض جغرافیایی بخشی از مختصات شما می خواهید به رمز. شناور در محدوده `[-90°, 90°]` -- دقت-اختیاری, طول رشته کد گذاری نتیجه, به طور پیش فرض به `12`. عدد صحیح در محدوده `[1, 12]`. هر مقدار کمتر از `1` یا بیشتر از `12` در سکوت به تبدیل `12`. - -**مقادیر بازگشتی** - -- عدد و الفبایی `String` مختصات کد گذاری شده (نسخه اصلاح شده از الفبای باس32 رمزگذاری استفاده شده است). - -**مثال** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## کد جغرافیایی {#geohashdecode} - -هر رشته جغرافیایی کد گذاری به طول و عرض جغرافیایی را رمزگشایی می کند. - -**مقادیر ورودی** - -- رشته کد گذاری-رشته جغرافیایی کد گذاری. - -**مقادیر بازگشتی** - -- (طول جغرافیایی, عرض جغرافیایی) - 2-تاپل از `Float64` ارزش طول و عرض جغرافیایی. - -**مثال** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## جغرافیایی 3 {#geotoh3} - -بازگشت [H3](https://uber.github.io/h3/#/documentation/overview/introduction) شاخص نقطه `(lon, lat)` با وضوح مشخص شده است. - -[H3](https://uber.github.io/h3/#/documentation/overview/introduction) یک سیستم نمایه سازی جغرافیایی است که سطح زمین به کاشی های شش ضلعی حتی تقسیم شده است. این سیستم سلسله مراتبی است, به عنوان مثال. هر شش گوش در سطح بالا را می توان به هفت حتی اما کوچکتر و به همین ترتیب تقسیم. - -این شاخص در درجه اول برای مکان های جفتک انداختن و دیگر دستکاری های جغرافیایی استفاده می شود. - -**نحو** - -``` sql -geoToH3(lon, lat, resolution) -``` - -**پارامترها** - -- `lon` — Longitude. Type: [جسم شناور64](../../sql_reference/data_types/float.md). -- `lat` — Latitude. Type: [جسم شناور64](../../sql_reference/data_types/float.md). -- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- عدد شاخص شش گوش. -- 0 در صورت خطا. - -نوع: `UInt64`. - -**مثال** - -پرسوجو: - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -نتیجه: - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## جعبه جواهر {#geohashesinbox} - -بازگرداندن مجموعه ای از رشته های جغرافیایی کد گذاری شده از دقت داده شده است که در داخل و تقاطع مرزهای جعبه داده شده قرار می گیرند, اساسا یک شبکه 2د مسطح به مجموعه. - -**مقادیر ورودی** - -- طولی-دقیقه طول جغرافیایی, ارزش شناور در محدوده `[-180°, 180°]` -- عرضی-دقیقه عرض جغرافیایی, ارزش شناور در محدوده `[-90°, 90°]` -- طولی-حداکثر طول جغرافیایی, ارزش شناور در محدوده `[-180°, 180°]` -- عرضی-حداکثر عرض جغرافیایی, ارزش شناور در محدوده `[-90°, 90°]` -- دقت-جغرافیایی دقیق, `UInt8` در محدوده `[1, 12]` - -لطفا توجه داشته باشید که تمام پارامترهای هماهنگ باید از همان نوع باشد: هم `Float32` یا `Float64`. - -**مقادیر بازگشتی** - -- مجموعه ای از رشته های دقت طولانی از زمینهاش جعبه پوشش منطقه فراهم, شما باید به ترتیب از اقلام تکیه نمی. -- \[\]- مجموعه خالی اگر *کمینه* ارزش *عرض جغرافیایی* و *طول جغرافیایی* کمتر از متناظر نیست *حداکثر* ارزشهای خبری عبارتند از: - -لطفا توجه داشته باشید که عملکرد یک استثنا را پرتاب می کند اگر مجموعه ای بیش از 10'000'000 باشد. - -**مثال** - -``` sql -SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos -``` - -``` text -┌─thasos──────────────────────────────────────┐ -│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ -└─────────────────────────────────────────────┘ -``` - -## هد3گتاسکل {#h3getbasecell} - -بازگرداندن تعداد سلول پایه از شاخص. - -**نحو** - -``` sql -h3GetBaseCell(index) -``` - -**پارامترها** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- شش گوش شماره سلول پایه. نوع: [UInt8](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT h3GetBaseCell(612916788725809151) as basecell -``` - -نتیجه: - -``` text -┌─basecell─┐ -│ 12 │ -└──────────┘ -``` - -## ه3حکسرام2 {#h3hexaream2} - -میانگین منطقه شش گوش در متر مربع در وضوح داده شده. - -**نحو** - -``` sql -h3HexAreaM2(resolution) -``` - -**پارامترها** - -- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- Area in m². Type: [جسم شناور64](../../sql_reference/data_types/float.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT h3HexAreaM2(13) as area -``` - -نتیجه: - -``` text -┌─area─┐ -│ 43.9 │ -└──────┘ -``` - -## در حال بارگذاری {#h3indexesareneighbors} - -بازده یا نه فراهم هیندکس همسایه هستند. - -**نحو** - -``` sql -h3IndexesAreNeighbors(index1, index2) -``` - -**پارامترها** - -- `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). - -**مقادیر بازگشتی** - -- بازگشت `1` اگر شاخص همسایه هستند, `0` وگرنه نوع: [UInt8](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n -``` - -نتیجه: - -``` text -┌─n─┐ -│ 1 │ -└───┘ -``` - -## بچه گانه های 3 {#h3tochildren} - -بازگرداندن مجموعه ای با شاخص کودک از شاخص داده. - -**نحو** - -``` sql -h3ToChildren(index, resolution) -``` - -**پارامترها** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- با شاخص های اچ 3 کودک تنظیم کنید. مجموعه ای از نوع: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT h3ToChildren(599405990164561919, 6) AS children -``` - -نتیجه: - -``` text -┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## ساعت 3 {#h3toparent} - -بازگرداندن پدر و مادر (درشت) شاخص حاوی شاخص داده. - -**نحو** - -``` sql -h3ToParent(index, resolution) -``` - -**پارامترها** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. نوع: [UInt8](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- شاخص اچ 3 پدر و مادر. نوع: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT h3ToParent(599405990164561919, 3) as parent -``` - -نتیجه: - -``` text -┌─────────────parent─┐ -│ 590398848891879423 │ -└────────────────────┘ -``` - -## اچ 3 {#h3tostring} - -تبدیل نمایندگی هیندکس از شاخص به نمایندگی رشته. - -``` sql -h3ToString(index) -``` - -**پارامترها** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- نمایندگی رشته از شاخص اچ 3. نوع: [رشته](../../sql_reference/data_types/string.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT h3ToString(617420388352917503) as h3_string -``` - -نتیجه: - -``` text -┌─h3_string───────┐ -│ 89184926cdbffff │ -└─────────────────┘ -``` - -## استراینگتوه3 {#stringtoh3} - -تبدیل رشته به نمایندگی h3index (uint64) نمایندگی. - -``` sql -stringToH3(index_str) -``` - -**پارامترها** - -- `index_str` — String representation of the H3 index. Type: [رشته](../../sql_reference/data_types/string.md). - -**مقادیر بازگشتی** - -- عدد شاخص شش گوش. بازده 0 در خطا. نوع: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT stringToH3('89184926cc3ffff') as index -``` - -نتیجه: - -``` text -┌──────────────index─┐ -│ 617420388351344639 │ -└────────────────────┘ -``` - -## انتقال انرژی 3 {#h3getresolution} - -بازگرداندن وضوح از شاخص. - -**نحو** - -``` sql -h3GetResolution(index) -``` - -**پارامترها** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مقادیر بازگشتی** - -- وضوح صفحه اول. گستره: `[0, 15]`. نوع: [UInt8](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT h3GetResolution(617420388352917503) as res -``` - -نتیجه: - -``` text -┌─res─┐ -│ 9 │ -└─────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/fa/sql_reference/functions/hash_functions.md b/docs/fa/sql_reference/functions/hash_functions.md deleted file mode 100644 index 71ca3660ccf..00000000000 --- a/docs/fa/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,446 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 50 -toc_title: "\u0647\u0634" ---- - -# توابع هش {#hash-functions} - -توابع هش را می توان برای زدن شبه تصادفی قطعی از عناصر استفاده می شود. - -## نیم مترد5 {#hash-functions-halfmd5} - -[تفسیر](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) تمام پارامترهای ورودی به عنوان رشته ها و محاسبه [MD5](https://en.wikipedia.org/wiki/MD5) ارزش هش برای هر یک از. سپس هش ها را ترکیب می کند و اولین بایت 8 هش رشته حاصل را می گیرد و به عنوان تفسیر می کند `UInt64` به ترتیب بایت بزرگ اندی. - -``` sql -halfMD5(par1, ...) -``` - -تابع نسبتا کند است (5 میلیون رشته کوتاه در هر ثانیه در هر هسته پردازنده). -در نظر بگیرید با استفاده از [سیفون64](#hash_functions-siphash64) تابع به جای. - -**پارامترها** - -تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql_reference/data_types/index.md). - -**مقدار بازگشتی** - -A [UInt64](../../sql_reference/data_types/int_uint.md) نوع داده مقدار هش. - -**مثال** - -``` sql -SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type -``` - -``` text -┌────────halfMD5hash─┬─type───┐ -│ 186182704141653334 │ UInt64 │ -└────────────────────┴────────┘ -``` - -## MD5 {#hash_functions-md5} - -محاسبه ام دی 5 از یک رشته و مجموعه ای در نتیجه از بایت به عنوان رشته ثابت را برمی گرداند(16). -اگر شما ام دی 5 به طور خاص نیاز ندارد, اما شما نیاز به یک رمزنگاری مناسب و معقول هش 128 بیتی, استفاده از ‘sipHash128’ تابع به جای. -اگر شما می خواهید برای دریافت همان نتیجه به عنوان خروجی توسط ابزار موسسه خدمات مالی, استفاده از پایین تر(سحر و جادو کردن(توسعه هزاره5(بازدید کنندگان))). - -## سیفون64 {#hash_functions-siphash64} - -تولید 64 بیتی [سیفون](https://131002.net/siphash/) مقدار هش. - -``` sql -sipHash64(par1,...) -``` - -این یک تابع هش رمزنگاری است. این کار حداقل سه بار سریع تر از [MD5](#hash_functions-md5) تابع. - -تابع [تفسیر](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) تمام پارامترهای ورودی به عنوان رشته و محاسبه مقدار هش برای هر یک از. سپس هش ها را با الگوریتم زیر ترکیب می کند: - -1. پس از هش کردن تمام پارامترهای ورودی, تابع می شود مجموعه ای از رشته هش. -2. تابع عناصر اول و دوم را می گیرد و هش را برای مجموعه ای از این موارد محاسبه می کند. -3. سپس تابع مقدار هش را محاسبه می کند که در مرحله قبل محاسبه می شود و عنصر سوم هش های اولیه را محاسبه می کند و هش را برای مجموعه ای از انها محاسبه می کند. -4. گام قبلی برای تمام عناصر باقی مانده از مجموعه هش اولیه تکرار شده است. - -**پارامترها** - -تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql_reference/data_types/index.md). - -**مقدار بازگشتی** - -A [UInt64](../../sql_reference/data_types/int_uint.md) نوع داده مقدار هش. - -**مثال** - -``` sql -SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type -``` - -``` text -┌──────────────SipHash─┬─type───┐ -│ 13726873534472839665 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## سیفون128 {#hash_functions-siphash128} - -محاسبه سیفون از یک رشته. -می پذیرد استدلال رشته از نوع. را برمی گرداند رشته ثابت (16). -متفاوت از سیفون64 در که حالت نهایی صخره نوردی تاشو تنها تا 128 بیت انجام می شود. - -## 4تیهاش64 {#cityhash64} - -تولید 64 بیتی [هشدار داده می شود](https://github.com/google/cityhash) مقدار هش. - -``` sql -cityHash64(par1,...) -``` - -این یک تابع هش غیر رمزنگاری سریع است. با استفاده از الگوریتم سیتیاش برای پارامترهای رشته و اجرای خاص تابع هش غیر رمزنگاری سریع برای پارامترهای با انواع داده های دیگر. این تابع از ترکیب کننده سیتیاش برای دریافت نتایج نهایی استفاده می کند. - -**پارامترها** - -تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql_reference/data_types/index.md). - -**مقدار بازگشتی** - -A [UInt64](../../sql_reference/data_types/int_uint.md) نوع داده مقدار هش. - -**مثالها** - -مثال تماس: - -``` sql -SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type -``` - -``` text -┌─────────────CityHash─┬─type───┐ -│ 12072650598913549138 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -مثال زیر نشان می دهد که چگونه برای محاسبه کنترلی از کل جدول با دقت تا سفارش ردیف: - -``` sql -SELECT groupBitXor(cityHash64(*)) FROM table -``` - -## اینتش32 {#inthash32} - -محاسبه یک کد هش 32 بیتی از هر نوع عدد صحیح. -این یک تابع هش غیر رمزنگاری نسبتا سریع از کیفیت متوسط برای اعداد است. - -## اینتاش64 {#inthash64} - -محاسبه یک کد هش 64 بیتی از هر نوع عدد صحیح. -این کار سریع تر از اینتش32. میانگین کیفیت. - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -محاسبه شا-1, شا-224, یا شا-256 از یک رشته و مجموعه ای در نتیجه از بایت به عنوان رشته گرداند(20), رشته ثابت(28), و یا رشته ثابت(32). -تابع کار می کند نسبتا کند (شا-1 پردازش در مورد 5 میلیون رشته کوتاه در هر ثانیه در هر هسته پردازنده, در حالی که شا-224 و شا-256 روند در مورد 2.2 میلیون). -ما توصیه می کنیم با استفاده از این تابع تنها در مواردی که شما نیاز به یک تابع هش خاص و شما می توانید انتخاب کنید. -حتی در این موارد توصیه می شود که از تابع به صورت افلاین استفاده کنید و مقادیر قبل از محاسبه هنگام وارد کردن جدول به جای استفاده در انتخاب ها. - -## نشانی اینترنتی\]) {#urlhashurl-n} - -یک تابع هش غیر رمزنگاری سریع و با کیفیت مناسب برای یک رشته از یک نشانی وب با استفاده از نوعی عادی سازی. -`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` یا `#` در پایان, اگر در حال حاضر. -`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` یا `#` در پایان, اگر در حال حاضر. -سطح همان است که در هرج و مرج است. این تابع خاص به یاندکس است.متریکا - -## فرمان 64 {#farmhash64} - -تولید 64 بیتی [مزرعه دار](https://github.com/google/farmhash) مقدار هش. - -``` sql -farmHash64(par1, ...) -``` - -تابع با استفاده از `Hash64` روش از همه [روش های موجود](https://github.com/google/farmhash/blob/master/src/farmhash.h). - -**پارامترها** - -تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql_reference/data_types/index.md). - -**مقدار بازگشتی** - -A [UInt64](../../sql_reference/data_types/int_uint.md) نوع داده مقدار هش. - -**مثال** - -``` sql -SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type -``` - -``` text -┌─────────────FarmHash─┬─type───┐ -│ 17790458267262532859 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## جواهاش {#hash_functions-javahash} - -محاسبه [جواهاش](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) از یک رشته. این تابع هش نه سریع و نه با کیفیت خوب است. تنها دلیل استفاده از این است که این الگوریتم در حال حاضر در سیستم دیگری استفاده می شود و شما باید دقیقا همان نتیجه را محاسبه کنید. - -**نحو** - -``` sql -SELECT javaHash(''); -``` - -**مقدار بازگشتی** - -A `Int32` نوع داده مقدار هش. - -**مثال** - -پرسوجو: - -``` sql -SELECT javaHash('Hello, world!'); -``` - -نتیجه: - -``` text -┌─javaHash('Hello, world!')─┐ -│ -1880044555 │ -└───────────────────────────┘ -``` - -## جواهرشوتف16 {#javahashutf16le} - -محاسبه [جواهاش](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) از یک رشته, فرض کنید که شامل بایت به نمایندگی از یک رشته در رمزگذاری اوت-16ل. - -**نحو** - -``` sql -javaHashUTF16LE(stringUtf16le) -``` - -**پارامترها** - -- `stringUtf16le` — a string in UTF-16LE encoding. - -**مقدار بازگشتی** - -A `Int32` نوع داده مقدار هش. - -**مثال** - -درست پرس و جو با utf-16le کد گذاری رشته است. - -پرسوجو: - -``` sql -SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) -``` - -نتیجه: - -``` text -┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ -│ 3556498 │ -└──────────────────────────────────────────────────────────────┘ -``` - -## هیوهاش {#hash-functions-hivehash} - -محاسبه `HiveHash` از یک رشته. - -``` sql -SELECT hiveHash(''); -``` - -این فقط [جواهاش](#hash_functions-javahash) با کمی نشانه صفر کردن. این تابع در استفاده [زنبورک کندو](https://en.wikipedia.org/wiki/Apache_Hive) برای نسخه های قبل از 3.0. این تابع هش نه سریع و نه با کیفیت خوب است. تنها دلیل استفاده از این است که این الگوریتم در حال حاضر در سیستم دیگری استفاده می شود و شما باید دقیقا همان نتیجه را محاسبه کنید. - -**مقدار بازگشتی** - -A `Int32` نوع داده مقدار هش. - -نوع: `hiveHash`. - -**مثال** - -پرسوجو: - -``` sql -SELECT hiveHash('Hello, world!'); -``` - -نتیجه: - -``` text -┌─hiveHash('Hello, world!')─┐ -│ 267439093 │ -└───────────────────────────┘ -``` - -## متروهاش64 {#metrohash64} - -تولید 64 بیتی [متروهاش](http://www.jandrewrogers.com/2015/05/27/metrohash/) مقدار هش. - -``` sql -metroHash64(par1, ...) -``` - -**پارامترها** - -تابع طول می کشد تعداد متغیر پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql_reference/data_types/index.md). - -**مقدار بازگشتی** - -A [UInt64](../../sql_reference/data_types/int_uint.md) نوع داده مقدار هش. - -**مثال** - -``` sql -SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type -``` - -``` text -┌────────────MetroHash─┬─type───┐ -│ 14235658766382344533 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## مورد احترام {#jumpconsistenthash} - -محاسبه jumpconsistenthash فرم uint64. -می پذیرد دو استدلال: یک کلید بین 64 نوع و تعداد سطل. بازده int32. -برای کسب اطلاعات بیشتر به لینک مراجعه کنید: [مورد احترام](https://arxiv.org/pdf/1406.2294.pdf) - -## سوفلش2\_32, سوفلشه2\_64 {#murmurhash2-32-murmurhash2-64} - -تولید یک [زمزمه 2](https://github.com/aappleby/smhasher) مقدار هش. - -``` sql -murmurHash2_32(par1, ...) -murmurHash2_64(par1, ...) -``` - -**پارامترها** - -هر دو توابع را به تعداد متغیر از پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql_reference/data_types/index.md). - -**مقدار بازگشتی** - -- این `murmurHash2_32` تابع را برمی گرداند مقدار هش داشتن [UInt32](../../sql_reference/data_types/int_uint.md) نوع داده. -- این `murmurHash2_64` تابع را برمی گرداند مقدار هش داشتن [UInt64](../../sql_reference/data_types/int_uint.md) نوع داده. - -**مثال** - -``` sql -SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type -``` - -``` text -┌──────────MurmurHash2─┬─type───┐ -│ 11832096901709403633 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## سوفلش3\_32, سوفلشه3\_64 {#murmurhash3-32-murmurhash3-64} - -تولید یک [سوفلهاش3](https://github.com/aappleby/smhasher) مقدار هش. - -``` sql -murmurHash3_32(par1, ...) -murmurHash3_64(par1, ...) -``` - -**پارامترها** - -هر دو توابع را به تعداد متغیر از پارامترهای ورودی. پارامترها می توانند هر یک از [انواع داده های پشتیبانی شده](../../sql_reference/data_types/index.md). - -**مقدار بازگشتی** - -- این `murmurHash3_32` تابع یک [UInt32](../../sql_reference/data_types/int_uint.md) نوع داده مقدار هش. -- این `murmurHash3_64` تابع یک [UInt64](../../sql_reference/data_types/int_uint.md) نوع داده مقدار هش. - -**مثال** - -``` sql -SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3─┬─type───┐ -│ 2152717 │ UInt32 │ -└─────────────┴────────┘ -``` - -## سوفلش3\_128 {#murmurhash3-128} - -تولید 128 بیتی [سوفلهاش3](https://github.com/aappleby/smhasher) مقدار هش. - -``` sql -murmurHash3_128( expr ) -``` - -**پارامترها** - -- `expr` — [عبارتها](../syntax.md#syntax-expressions) بازگشت یک [رشته](../../sql_reference/data_types/string.md)- نوع ارزش. - -**مقدار بازگشتی** - -A [رشته ثابت (16)](../../sql_reference/data_types/fixedstring.md) نوع داده مقدار هش. - -**مثال** - -``` sql -SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3──────┬─type────────────┐ -│ 6�1�4"S5KT�~~q │ FixedString(16) │ -└──────────────────┴─────────────────┘ -``` - -## بیست و 3264 {#hash-functions-xxhash32} - -محاسبه `xxHash` از یک رشته. این است که در دو طعم پیشنهاد, 32 و 64 بیت. - -``` sql -SELECT xxHash32(''); - -OR - -SELECT xxHash64(''); -``` - -**مقدار بازگشتی** - -A `Uint32` یا `Uint64` نوع داده مقدار هش. - -نوع: `xxHash`. - -**مثال** - -پرسوجو: - -``` sql -SELECT xxHash32('Hello, world!'); -``` - -نتیجه: - -``` text -┌─xxHash32('Hello, world!')─┐ -│ 834093149 │ -└───────────────────────────┘ -``` - -**همچنین نگاه کنید به** - -- [معلم](http://cyan4973.github.io/xxHash/). - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/fa/sql_reference/functions/higher_order_functions.md b/docs/fa/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index 44e7469a5f7..00000000000 --- a/docs/fa/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 57 -toc_title: "\u0628\u0627\u0644\u0627\u062A\u0631 \u0633\u0641\u0627\u0631\u0634" ---- - -# توابع مرتبه بالاتر {#higher-order-functions} - -## `->` اپراتور, لامبدا (پارامترهای, اکسپر) تابع {#operator-lambdaparams-expr-function} - -Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. - -مثالها: `x -> 2 * x, str -> str != Referer.` - -توابع مرتبه بالاتر تنها می تواند توابع لامبدا به عنوان استدلال عملکردی خود را قبول. - -یک تابع لامبدا که استدلال های متعدد می پذیرد را می توان به یک تابع مرتبه بالاتر منتقل می شود. در این مورد, تابع مرتبه بالاتر به تصویب می رسد چند مجموعه ای از طول یکسان است که این استدلال به مطابقت. - -برای برخی از توابع مانند [پیاده کردن](#higher_order_functions-array-count) یا [ارریسوم](#higher_order_functions-array-count), استدلال اول (تابع لامبدا) را می توان حذف. در این مورد, نقشه برداری یکسان فرض شده است. - -یک تابع لامبدا را نمی توان برای توابع زیر حذف کرد: - -- [اررایماپ](#higher_order_functions-array-map) -- [شلوار لی](#higher_order_functions-array-filter) -- [شلوار لی](#higher_order_functions-array-fill) -- [نمایش سایت](#higher_order_functions-array-reverse-fill) -- [لرزش دستگاه](#higher_order_functions-array-split) -- [نمایش سایت](#higher_order_functions-array-reverse-split) -- [دریافیرست](#higher_order_functions-array-first) -- [نمایش سایت](#higher_order_functions-array-first-index) - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -بازگرداندن مجموعه ای از برنامه اصلی `func` عملکرد به هر عنصر در `arr` صف کردن. - -مثالها: - -``` sql -SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,4,5] │ -└─────────┘ -``` - -مثال زیر نشان می دهد که چگونه برای ایجاد یک تاپل از عناصر از مجموعه های مختلف: - -``` sql -SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res -``` - -``` text -┌─res─────────────────┐ -│ [(1,4),(2,5),(3,6)] │ -└─────────────────────┘ -``` - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayMap` تابع. - -### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} - -بازگرداندن مجموعه ای حاوی تنها عناصر در `arr1` برای کدام `func` چیزی غیر از 0 را برمی گرداند. - -مثالها: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - -``` text -┌─res───────────┐ -│ ['abc World'] │ -└───────────────┘ -``` - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - -``` text -┌─res─┐ -│ [2] │ -└─────┘ -``` - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFilter` تابع. - -### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} - -پویش از طریق `arr1` از عنصر اول به عنصر گذشته و جایگزین `arr1[i]` توسط `arr1[i - 1]` اگر `func` بازده 0. اولین عنصر `arr1` جایگزین نخواهد شد. - -مثالها: - -``` sql -SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res──────────────────────────────┐ -│ [1,1,3,11,12,12,12,5,6,14,14,14] │ -└──────────────────────────────────┘ -``` - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFill` تابع. - -### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} - -پویش از طریق `arr1` از عنصر گذشته به عنصر اول و جایگزین `arr1[i]` توسط `arr1[i + 1]` اگر `func` بازده 0. عنصر گذشته از `arr1` جایگزین نخواهد شد. - -مثالها: - -``` sql -SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res────────────────────────────────┐ -│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ -└────────────────────────────────────┘ -``` - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayReverseFill` تابع. - -### arraySplit(func, arr1, …) {#higher_order_functions-array-split} - -شکافتن `arr1` به چندین ردیف چه زمانی `func` بازگرداندن چیزی غیر از 0, مجموعه خواهد شد در سمت چپ عنصر تقسیم. مجموعه قبل از اولین عنصر تقسیم نخواهد شد. - -مثالها: - -``` sql -SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res─────────────┐ -│ [[1,2,3],[4,5]] │ -└─────────────────┘ -``` - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arraySplit` تابع. - -### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} - -شکافتن `arr1` به چندین ردیف چه زمانی `func` بازگرداندن چیزی غیر از 0, مجموعه خواهد شد در سمت راست عنصر تقسیم. مجموعه پس از عنصر گذشته تقسیم نخواهد شد. - -مثالها: - -``` sql -SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res───────────────┐ -│ [[1],[2,3,4],[5]] │ -└───────────────────┘ -``` - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arraySplit` تابع. - -### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} - -بازگرداندن تعدادی از عناصر در مجموعه ارر که فارک چیزی غیر از گرداند 0. اگر ‘func’ مشخص نشده است, تعداد عناصر غیر صفر گرداند در مجموعه. - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -بازده 1 اگر حداقل یک عنصر در وجود دارد ‘arr’ برای کدام ‘func’ چیزی غیر از 0 را برمی گرداند. در غیر این صورت, باز می گردد 0. - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -بازده 1 اگر ‘func’ چیزی غیر از 0 را برای تمام عناصر در ‘arr’. در غیر این صورت, باز می گردد 0. - -### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} - -بازگرداندن مجموع ‘func’ ارزشهای خبری عبارتند از: اگر تابع حذف شده است, فقط می گرداند مجموع عناصر مجموعه. - -### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} - -بازگرداندن اولین عنصر در ‘arr1’ تنظیم برای کدام ‘func’ چیزی غیر از 0 را برمی گرداند. - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFirst` تابع. - -### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} - -بازگرداندن شاخص عنصر اول در ‘arr1’ تنظیم برای کدام ‘func’ چیزی غیر از 0 را برمی گرداند. - -توجه داشته باشید که استدلال اول (تابع لامبدا) را نمی توان در حذف `arrayFirstIndex` تابع. - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -بازگرداندن مجموعه ای از مبالغ بخشی از عناصر در مجموعه منبع (مجموع در حال اجرا). اگر `func` تابع مشخص شده است, سپس ارزش عناصر مجموعه توسط این تابع قبل از جمع تبدیل. - -مثال: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - -``` text -┌─res──────────┐ -│ [1, 2, 3, 4] │ -└──────────────┘ -``` - -### هشدار داده می شود) {#arraycumsumnonnegativearr} - -مثل `arrayCumSum`, بازگرداندن مجموعه ای از مبالغ بخشی از عناصر در مجموعه منبع (مجموع در حال اجرا). متفاوت `arrayCumSum`, هنگامی که ارزش سپس بازگشت شامل یک مقدار کمتر از صفر, ارزش است جایگزین با صفر و محاسبه بعدی با صفر پارامترهای انجام. به عنوان مثال: - -``` sql -SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,0,1] │ -└───────────┘ -``` - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -بازگرداندن مجموعه ای به عنوان نتیجه مرتب سازی عناصر `arr1` به ترتیب صعودی. اگر `func` تابع مشخص شده است, مرتب سازی سفارش توسط نتیجه تابع تعیین `func` اعمال شده به عناصر مجموعه (ارریس) - -این [تبدیل شوارتز](https://en.wikipedia.org/wiki/Schwartzian_transform) برای بهبود کارایی مرتب سازی استفاده می شود. - -مثال: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -برای کسب اطلاعات بیشتر در مورد `arraySort` روش, دیدن [توابع برای کار با ارریس](array_functions.md#array_functions-sort) بخش. - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -بازگرداندن مجموعه ای به عنوان نتیجه مرتب سازی عناصر `arr1` به ترتیب نزولی. اگر `func` تابع مشخص شده است, مرتب سازی سفارش توسط نتیجه تابع تعیین `func` اعمال شده به عناصر مجموعه ای (ارریس). - -مثال: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -برای کسب اطلاعات بیشتر در مورد `arrayReverseSort` روش, دیدن [توابع برای کار با ارریس](array_functions.md#array_functions-reverse-sort) بخش. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/fa/sql_reference/functions/index.md b/docs/fa/sql_reference/functions/index.md deleted file mode 100644 index 9d9679fca26..00000000000 --- a/docs/fa/sql_reference/functions/index.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Functions -toc_priority: 32 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# توابع {#functions} - -حداقل\* دو نوع از توابع وجود دارد - توابع به طور منظم (فقط به نام “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn't depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). - -در این بخش ما در مورد توابع به طور منظم. برای توابع کل, بخش را ببینید “Aggregate functions”. - -\* - یک نوع سوم از تابع که وجود دارد ‘arrayJoin’ توابع جدول همچنین می توانید به طور جداگانه ذکر شود.\* - -## تایپ قوی {#strong-typing} - -در مقابل به گذاشتن استاندارد, خانه رعیتی است تایپ قوی. به عبارت دیگر تبدیل ضمنی بین انواع را ندارد. هر تابع برای یک مجموعه خاص از انواع کار می کند. این به این معنی است که گاهی اوقات شما نیاز به استفاده از توابع تبدیل نوع. - -## رفع ضعف مشترک {#common-subexpression-elimination} - -همه عبارات در پرس و جو که همان اعضای هیات (همان رکورد و یا همان نتیجه تجزیه نحوی) در نظر گرفته به ارزش یکسان. چنین عبارات یک بار تایید و اجرا می شوند. زیرمجموعه های یکسان نیز این راه را حذف می کنند. - -## انواع نتایج {#types-of-results} - -همه توابع بازگشت بازگشت بازگشت تنها به عنوان نتیجه (چند ارزش نیست, و نه صفر ارزش). نوع نتیجه است که معمولا تنها با انواع استدلال تعریف, نه با ارزش. استثنا هستند tupleelement function (a.n اپراتور) و tofixedstring تابع. - -## ثابتها {#constants} - -برای سادگی, توابع خاص تنها می تواند با ثابت برای برخی از استدلال کار. مثلا, استدلال درست از اپراتور مانند باید ثابت باشد. -تقریبا تمام توابع بازگشت ثابت برای استدلال ثابت. استثنا توابع است که تولید اعداد تصادفی است. -این ‘now’ تابع مقادیر مختلف برای نمایش داده شد که در زمان های مختلف اجرا شد را برمی گرداند, اما نتیجه در نظر گرفته ثابت, از ثبات در یک پرس و جو تنها مهم است. -یک عبارت ثابت نیز ثابت در نظر گرفته (مثلا, نیمه راست اپراتور مانند را می توان از ثابت های متعدد ساخته). - -توابع را می توان به روش های مختلف برای استدلال ثابت و غیر ثابت اجرا (کد های مختلف اجرا شده است). اما نتایج برای یک ثابت و برای یک ستون واقعی حاوی تنها همان مقدار باید با یکدیگر مطابقت. - -## پردازش پوچ {#null-processing} - -توابع رفتارهای زیر را دارند: - -- اگر حداقل یکی از استدلال از تابع است `NULL` نتیجه عملکرد نیز است `NULL`. -- رفتار ویژه ای است که به صورت جداگانه در شرح هر تابع مشخص. در کد منبع کلیک این توابع `UseDefaultImplementationForNulls=false`. - -## پایداری {#constancy} - -Functions can't change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. - -## خطا {#error-handling} - -برخی از توابع ممکن است یک استثنا پرتاب اگر داده نامعتبر است. در این مورد پرس و جو لغو شده است و یک متن خطا به مشتری بازگردانده می شود. برای پردازش توزیع, هنگامی که یک استثنا در یکی از سرورهای رخ می دهد, سرور های دیگر نیز تلاش برای لغو پرس و جو. - -## ارزیابی عبارات استدلال {#evaluation-of-argument-expressions} - -تقریبا در تمام زبان های برنامه نویسی, یکی از استدلال ممکن است برای اپراتورهای خاص ارزیابی نمی شود. این است که معمولا اپراتورها `&&`, `||` و `?:`. -اما در فاحشه خانه, استدلال از توابع (اپراتورهای) همیشه مورد بررسی قرار. دلیل این است که کل بخش هایی از ستون ها در یک بار مورد بررسی قرار, به جای محاسبه هر سطر به طور جداگانه. - -## انجام توابع برای پردازش پرس و جو توزیع شده {#performing-functions-for-distributed-query-processing} - -برای پردازش پرس و جو توزیع, به عنوان بسیاری از مراحل پردازش پرس و جو که ممکن است بر روی سرور از راه دور انجام, و بقیه مراحل (ادغام نتایج متوسط و همه چیز که) بر روی سرور درخواست انجام. - -این به این معنی است که توابع را می توان بر روی سرور های مختلف انجام می شود. -برای مثال در پرس و جو `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` - -- اگر یک `distributed_table` دارای حداقل دو خرده ریز, توابع ‘g’ و ‘h’ بر روی سرورهای راه دور و عملکرد انجام می شود ‘f’ بر روی سرور درخواست کننده انجام می شود. -- اگر یک `distributed_table` تنها یک سفال, تمام ‘f’, ‘g’ و ‘h’ توابع بر روی سرور این سفال انجام. - -نتیجه یک تابع معمولا بستگی ندارد که سرور انجام شده است. اما گاهی اوقات این مهم است. -مثلا, توابع است که با لغت نامه کار استفاده از فرهنگ لغت که بر روی سرور وجود دارد که در حال اجرا هستند در. -مثال دیگر این است که `hostName` تابع, که نام سرور را بر می گرداند در حال اجرا است به منظور ایجاد `GROUP BY` توسط سرور در یک `SELECT` پرس و جو. - -اگر یک تابع در یک پرس و جو بر روی سرور درخواست انجام, اما شما نیاز به انجام این کار بر روی سرور از راه دور, شما می توانید در یک بسته بندی ‘any’ تابع جمع و یا اضافه کردن به یک کلید در `GROUP BY`. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/fa/sql_reference/functions/introspection.md b/docs/fa/sql_reference/functions/introspection.md deleted file mode 100644 index 6eb75456f08..00000000000 --- a/docs/fa/sql_reference/functions/introspection.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 65 -toc_title: "\u062F\u0631\u0648\u0646 \u0646\u06AF\u0631\u06CC" ---- - -# توابع درون گرایی {#introspection-functions} - -شما می توانید توابع شرح داده شده در این فصل به درون نگری استفاده کنید [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) و [DWARF](https://en.wikipedia.org/wiki/DWARF) برای پروفایل پرس و جو. - -!!! warning "اخطار" - این توابع کند هستند و ممکن است ملاحظات امنیتی تحمیل کنند. - -برای بهره برداری مناسب از توابع درون گرایی: - -- نصب `clickhouse-common-static-dbg` بسته - -- تنظیم [اجازه دادن به \_فعال کردن اختلال در عملکرد](../../operations/settings/settings.md#settings-allow_introspection_functions) تنظیم به 1. - - For security reasons introspection functions are disabled by default. - -تاتر موجب صرفه جویی در گزارش نیمرخ به [\_قطع](../../operations/system_tables.md#system_tables-trace_log) جدول سیستم. اطمینان حاصل کنید که جدول و پیشفیلتر به درستی پیکربندی شده است. - -## افزودن مدخل جدید {#addresstoline} - -تبدیل آدرس حافظه مجازی در داخل clickhouse فرایند سرور به نام فایل و شماره خط در clickhouse کد منبع. - -اگر شما استفاده از بسته های رسمی تاتر, شما نیاز به نصب `clickhouse-common-static-dbg` بسته - -**نحو** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**پارامترها** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**مقدار بازگشتی** - -- نام فایل کد منبع و شماره خط در این فایل حد و مرز مشخصی توسط روده بزرگ. - - For example, `/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199`, where `199` is a line number. - -- نام یک باینری, اگر تابع می تواند اطلاعات اشکال زدایی پیدا کنید. - -- رشته خالی, اگر نشانی معتبر نیست. - -نوع: [رشته](../../sql_reference/data_types/string.md). - -**مثال** - -فعال کردن توابع درون گرایی: - -``` sql -SET allow_introspection_functions=1 -``` - -انتخاب رشته اول از `trace_log` جدول سیستم: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -این `trace` درست شامل ردیابی پشته در حال حاضر نمونه برداری. - -گرفتن نام فایل کد منبع و شماره خط برای یک نشانی واحد: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 -``` - -استفاده از تابع به ردیابی کل پشته: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -این [اررایماپ](higher_order_functions.md#higher_order_functions-array-map) تابع اجازه می دهد تا برای پردازش هر عنصر منحصر به فرد از `trace` تنظیم توسط `addressToLine` تابع. در نتیجه این پردازش می بینید در `trace_source_code_lines` ستون خروجی. - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## افزودن موقعیت {#addresstosymbol} - -تبدیل آدرس حافظه مجازی در داخل clickhouse سرور روند به نمادی از clickhouse شی فایل های. - -**نحو** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**پارامترها** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**مقدار بازگشتی** - -- نمادی از clickhouse شی فایل های. -- رشته خالی, اگر نشانی معتبر نیست. - -نوع: [رشته](../../sql_reference/data_types/string.md). - -**مثال** - -فعال کردن توابع درون گرایی: - -``` sql -SET allow_introspection_functions=1 -``` - -انتخاب رشته اول از `trace_log` جدول سیستم: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -این `trace` درست شامل ردیابی پشته در حال حاضر نمونه برداری. - -گرفتن نماد برای یک نشانی واحد: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -استفاده از تابع به ردیابی کل پشته: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -این [اررایماپ](higher_order_functions.md#higher_order_functions-array-map) تابع اجازه می دهد تا برای پردازش هر عنصر منحصر به فرد از `trace` تنظیم توسط `addressToSymbols` تابع. نتیجه این پردازش شما در دیدن `trace_symbols` ستون خروجی. - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## درهم و برهم کردن {#demangle} - -تبدیل یک نماد است که شما می توانید با استفاده از [افزودن موقعیت](#addresstosymbol) تابع به ج++ نام تابع. - -**نحو** - -``` sql -demangle(symbol) -``` - -**پارامترها** - -- `symbol` ([رشته](../../sql_reference/data_types/string.md)) — Symbol from an object file. - -**مقدار بازگشتی** - -- نام تابع ج++. -- رشته خالی اگر یک نماد معتبر نیست. - -نوع: [رشته](../../sql_reference/data_types/string.md). - -**مثال** - -فعال کردن توابع درون گرایی: - -``` sql -SET allow_introspection_functions=1 -``` - -انتخاب رشته اول از `trace_log` جدول سیستم: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -این `trace` زمینه شامل ردیابی پشته در لحظه نمونه برداری. - -گرفتن نام تابع برای یک نشانی واحد: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -استفاده از تابع به ردیابی کل پشته: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -این [اررایماپ](higher_order_functions.md#higher_order_functions-array-map) تابع اجازه می دهد تا برای پردازش هر عنصر منحصر به فرد از `trace` تنظیم توسط `demangle` تابع. در نتیجه این پردازش می بینید در `trace_functions` ستون خروجی. - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/fa/sql_reference/functions/ip_address_functions.md b/docs/fa/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index fe4a6c7828e..00000000000 --- a/docs/fa/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,249 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 55 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0646\u0634\u0627\u0646\u06CC\u0647\u0627\ - \u06CC \u0627\u06CC\u0646\u062A\u0631\u0646\u062A\u06CC" ---- - -# توابع برای کار با نشانی های اینترنتی {#functions-for-working-with-ip-addresses} - -## اطلاعات دقیق) {#ipv4numtostringnum} - -طول می کشد یک uint32 شماره. به عنوان یک نشانی اینترنتی 4 در اندی بزرگ تفسیر می کند. بازده یک رشته حاوی مربوطه آدرس ipv4 در قالب a. b. c. d (نقطه جدا کردن اعداد در شکل اعشاری). - -## مدت 4 ساعت) {#ipv4stringtonums} - -عملکرد معکوس ایپو4نومتوسترینگ. اگر نشانی اینترنتی4 دارای یک فرمت نامعتبر, باز می گردد 0. - -## اطلاعات دقیق) {#ipv4numtostringclasscnum} - -شبیه به ipv4numtostring اما با استفاده از \ به جای گذشته هشت تایی. - -مثال: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─k──────────────┬─────c─┐ -│ 83.149.9.xxx │ 26238 │ -│ 217.118.81.xxx │ 26074 │ -│ 213.87.129.xxx │ 25481 │ -│ 83.149.8.xxx │ 24984 │ -│ 217.118.83.xxx │ 22797 │ -│ 78.25.120.xxx │ 22354 │ -│ 213.87.131.xxx │ 21285 │ -│ 78.25.121.xxx │ 20887 │ -│ 188.162.65.xxx │ 19694 │ -│ 83.149.48.xxx │ 17406 │ -└────────────────┴───────┘ -``` - -از زمان استفاده ‘xxx’ بسیار غیر معمول است, این ممکن است در اینده تغییر. ما توصیه می کنیم که شما در قالب دقیق این قطعه تکیه نمی. - -### اطلاعات دقیق) {#ipv6numtostringx} - -یک رشته ثابت(16) مقدار حاوی نشانی اینترنتی6 را در قالب باینری می پذیرد. بازگرداندن یک رشته حاوی این نشانی در قالب متن. -نشانی های ایپو6-نقشه برداری ایپو4 خروجی در قالب هستند:: افف:111.222.33.44. مثالها: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - -``` text -┌─addr─────────┐ -│ 2a02:6b8::11 │ -└──────────────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ -│ 2a02:2168:aaa:bbbb::2 │ 24695 │ -│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ -│ 2a02:6b8:0:fff::ff │ 16389 │ -│ 2a01:4f8:111:6666::2 │ 16016 │ -│ 2a02:2168:888:222::1 │ 15896 │ -│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ -│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ -│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ -│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ -│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ -└─────────────────────────────────────────┴───────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)─┬──────c─┐ -│ ::ffff:94.26.111.111 │ 747440 │ -│ ::ffff:37.143.222.4 │ 529483 │ -│ ::ffff:5.166.111.99 │ 317707 │ -│ ::ffff:46.38.11.77 │ 263086 │ -│ ::ffff:79.105.111.111 │ 186611 │ -│ ::ffff:93.92.111.88 │ 176773 │ -│ ::ffff:84.53.111.33 │ 158709 │ -│ ::ffff:217.118.11.22 │ 154004 │ -│ ::ffff:217.118.11.33 │ 148449 │ -│ ::ffff:217.118.11.44 │ 148243 │ -└────────────────────────────┴────────┘ -``` - -## مدت 6 ساعت) {#ipv6stringtonums} - -عملکرد معکوس ایپو6نومتوسترینگ. اگر نشانی اینترنتی6 دارای یک فرمت نامعتبر, یک رشته از بایت پوچ را برمی گرداند. -سحر و جادو می تواند بزرگ یا کوچک. - -## IPv4ToIPv6(x) {#ipv4toipv6x} - -طول می کشد یک `UInt32` شماره. تفسیر به عنوان یک نشانی اینترنتی4 در [اندی بزرگ](https://en.wikipedia.org/wiki/Endianness). بازگرداندن یک `FixedString(16)` مقدار حاوی نشانی اینترنتی6 در قالب دودویی. مثالها: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - -``` text -┌─addr───────────────┐ -│ ::ffff:192.168.0.1 │ -└────────────────────┘ -``` - -## cutIPv6(x bitsToCutForIPv6, bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} - -یک رشته ثابت(16) مقدار حاوی نشانی اینترنتی6 را در قالب باینری می پذیرد. بازگرداندن یک رشته حاوی نشانی از تعداد مشخصی از بیت در قالب متن حذف. به عنوان مثال: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - -``` text -┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ -│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ -└─────────────────────────────────────┴─────────────────────┘ -``` - -## IPv4CIDRToRange(ipv4, cidr), {#ipv4cidrtorangeipv4-cidr} - -قبول یک ipv4 و uint8 ارزش شامل [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). یک تاپل را با دو لیگ4 حاوی محدوده پایین تر و محدوده بالاتر زیر شبکه باز کنید. - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - -``` text -┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ -│ ('192.168.0.0','192.168.255.255') │ -└────────────────────────────────────────────┘ -``` - -## IPv6CIDRToRange(ipv6 cidr), {#ipv6cidrtorangeipv6-cidr} - -قبول یک ipv6 و uint8 ارزش حاوی cidr. یک تاپل را با دو ایپو6 حاوی محدوده پایین تر و محدوده بالاتر زیر شبکه باز کنید. - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); -``` - -``` text -┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ -│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -## تایپه 4 (رشته) {#toipv4string} - -یک نام مستعار برای `IPv4StringToNum()` که طول می کشد یک شکل رشته ای از ایپو4 نشانی و ارزش را برمی گرداند [IPv4](../../sql_reference/data_types/domains/ipv4.md) نوع باینری برابر با مقدار بازگشتی است `IPv4StringToNum()`. - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - -``` text -┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ -│ UInt32 │ IPv4 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - -``` text -┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ -│ ABE1822D │ ABE1822D │ -└───────────────────────────────────┴──────────────────────────┘ -``` - -## تیپو6 (رشته) {#toipv6string} - -یک نام مستعار برای `IPv6StringToNum()` که طول می کشد یک شکل رشته ای از ایپو6 نشانی و ارزش را برمی گرداند [IPv6](../../sql_reference/data_types/domains/ipv6.md) نوع باینری برابر با مقدار بازگشتی است `IPv6StringToNum()`. - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - -``` text -┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ -│ FixedString(16) │ IPv6 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - -``` text -┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ -│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ -└───────────────────────────────────┴──────────────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/fa/sql_reference/functions/json_functions.md b/docs/fa/sql_reference/functions/json_functions.md deleted file mode 100644 index fd5d30eaade..00000000000 --- a/docs/fa/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 56 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u062C\u0627\u0646\u0633\u0648\u0646." ---- - -# توابع برای کار با جانسون {#functions-for-working-with-json} - -در یاندکسمتریکا جیسون توسط کاربران به عنوان پارامترهای جلسه منتقل می شود. برخی از توابع خاص برای کار با این جانسون وجود دارد. (اگر چه در بسیاری از موارد jsons هستند علاوه بر این قبل از پردازش و در نتیجه ارزش ها قرار داده و در ستون جداگانه در خود پردازش فرمت.) همه این توابع در فرضیات قوی در مورد چه جانسون می تواند بر اساس, اما سعی می کنند به عنوان کوچک که ممکن است به کار انجام می شود. - -مفروضات زیر ساخته شده است: - -1. نام فیلد (استدلال تابع) باید ثابت باشد. -2. نام فیلد به نحوی می تواند در جیسون کد گذاری شود. به عنوان مثال: `visitParamHas('{"abc":"def"}', 'abc') = 1` اما `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. زمینه ها برای در هر سطح تودرتو جستجو, یکسره. اگر زمینه های تطبیق های متعدد وجود دارد, وقوع اول استفاده شده است. -4. JSON ندارد کاراکتر فضای خارج از string literals. - -## ویسیتپراماس (پارامز, نام) {#visitparamhasparams-name} - -بررسی اینکه یک میدان با وجود ‘name’ اسم. - -## ویسیتپرامستراکتینت (پارامز, نام) {#visitparamextractuintparams-name} - -تجزیه ظاهری64 از ارزش این زمینه به نام ‘name’. اگر این یک رشته رشته زمینه, تلاش می کند به تجزیه یک عدد از ابتدای رشته. اگر میدان وجود ندارد, و یا وجود دارد اما حاوی یک عدد نیست, باز می گردد 0. - -## ویزیتپرامستراکتینت (پارامز, نام) {#visitparamextractintparams-name} - -همان int64. - -## اطلاعات دقیق) {#visitparamextractfloatparams-name} - -همان است که برای شناور64. - -## ویسیتپرامسترکتبولبولول (پارامز, نام) {#visitparamextractboolparams-name} - -تجزیه واقعی / ارزش کاذب. نتیجه این است uint8. - -## ویسیتپرمککتراو (پارامز, نام) {#visitparamextractrawparams-name} - -بازگرداندن ارزش یک میدان, از جمله جدا. - -مثالها: - -``` sql -visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' -visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' -``` - -## نام و نام خانوادگی) {#visitparamextractstringparams-name} - -تجزیه رشته در نقل قول دو. ارزش بی نتیجه است. اگر بیم شکست خورده, این یک رشته خالی می گرداند. - -مثالها: - -``` sql -visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' -visitParamExtractString('{"abc":"hello}', 'abc') = '' -``` - -در حال حاضر هیچ پشتیبانی برای نقاط کد در قالب وجود دارد `\uXXXX\uYYYY` این از هواپیما چند زبانه پایه نیست (به جای اوتو-8 تبدیل می شود). - -توابع زیر بر اساس [سیمدجسون](https://github.com/lemire/simdjson) طراحی شده برای نیازهای پیچیده تر جسون تجزیه. فرض 2 ذکر شده در بالا هنوز هم صدق. - -## هشدار داده می شود) {#isvalidjsonjson} - -چک که رشته گذشت جانسون معتبر است. - -مثالها: - -``` sql -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} - -اگر مقدار در سند جسون وجود داشته باشد, `1` برگردانده خواهد شد. - -اگر این مقدار وجود ندارد, `0` برگردانده خواهد شد. - -مثالها: - -``` sql -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 -``` - -`indices_or_keys` لیستی از استدلال های صفر یا بیشتر است که هر کدام می توانند رشته یا عدد صحیح باشند. - -- رشته = عضو شی دسترسی های کلیدی. -- عدد صحیح مثبت = از ابتدا به عضو / کلید نفر دسترسی پیدا کنید. -- عدد صحیح منفی = دسترسی به عضو / کلید نفر از پایان. - -حداقل شاخص عنصر 1 است. بنابراین عنصر 0 وجود ندارد. - -شما می توانید از اعداد صحیح برای دسترسی به هر دو اشیای جسون ارریس و جسون استفاده کنید. - -بنابراین, مثلا: - -``` sql -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' -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} - -بازگشت طول یک مجموعه جانسون یا یک شی جانسون. - -اگر مقدار وجود ندارد و یا دارای یک نوع اشتباه, `0` برگردانده خواهد شد. - -مثالها: - -``` sql -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} - -بازگشت به نوع یک مقدار جانسون. - -اگر این مقدار وجود ندارد, `Null` برگردانده خواهد شد. - -مثالها: - -``` sql -SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' -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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -تجزیه جانسون و استخراج ارزش. این توابع شبیه به `visitParam` توابع. - -اگر مقدار وجود ندارد و یا دارای یک نوع اشتباه, `0` برگردانده خواهد شد. - -مثالها: - -``` sql -SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 -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} - -تجزیه جانسون و استخراج یک رشته. این تابع شبیه به `visitParamExtractString` توابع. - -اگر مقدار وجود ندارد و یا دارای یک نوع اشتباه, یک رشته خالی بازگردانده خواهد شد. - -ارزش بی نتیجه است. اگر بیم شکست خورده, این یک رشته خالی می گرداند. - -مثالها: - -``` sql -SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' -SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' -SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' -``` - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -تجزیه یک جسون و استخراج یک مقدار از نوع داده داده داده کلیک. - -این یک تعمیم قبلی است `JSONExtract` توابع. -این به این معنی است -`JSONExtract(..., 'String')` بازده دقیقا همان `JSONExtractString()`, -`JSONExtract(..., 'Float64')` بازده دقیقا همان `JSONExtractFloat()`. - -مثالها: - -``` sql -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL -SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 -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} - -پارسه جفت کلید ارزش از یک جانسون که ارزش از نوع داده داده خانه رعیتی هستند. - -مثال: - -``` sql -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} - -بازگرداندن بخشی از جانسون. - -اگر بخش وجود ندارد و یا دارای یک نوع اشتباه, یک رشته خالی بازگردانده خواهد شد. - -مثال: - -``` sql -SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' -``` - -## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} - -بازگرداندن مجموعه ای با عناصر از مجموعه جانسون,هر یک به عنوان رشته نامحدود نشان. - -اگر بخش وجود ندارد و یا مجموعه ای نیست, مجموعه ای خالی بازگردانده خواهد شد. - -مثال: - -``` sql -SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/fa/sql_reference/functions/machine_learning_functions.md b/docs/fa/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index 34b069cdebd..00000000000 --- a/docs/fa/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 64 -toc_title: "\u062A\u0648\u0627\u0628\u0639 \u06CC\u0627\u062F\u06AF\u06CC\u0631\u06CC\ - \ \u0645\u0627\u0634\u06CC\u0646" ---- - -# توابع یادگیری ماشین {#machine-learning-functions} - -## ارزیابی (پیش بینی) {#machine_learning_methods-evalmlmethod} - -پیش بینی با استفاده از مدل های رگرسیون نصب شده `evalMLMethod` تابع. مشاهده لینک در `linearRegression`. - -### رگرسیون خطی تصادفی {#stochastic-linear-regression} - -این [تنظیم مقررات](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlinearregression) تابع جمع پیاده سازی روش گرادیان نزولی تصادفی با استفاده از مدل خطی و تابع از دست دادن مرتبه اول. استفاده `evalMLMethod` برای پیش بینی در داده های جدید. - -### رگرسیون لجستیک تصادفی {#stochastic-logistic-regression} - -این [سرکوب مقررات عمومی](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlogisticregression) تابع جمع پیاده سازی روش گرادیان نزولی برای مشکل طبقه بندی دودویی. استفاده `evalMLMethod` برای پیش بینی در داده های جدید. diff --git a/docs/fa/sql_reference/functions/other_functions.md b/docs/fa/sql_reference/functions/other_functions.md deleted file mode 100644 index 55c44241615..00000000000 --- a/docs/fa/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,1079 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 66 -toc_title: "\u063A\u06CC\u0631\u0647" ---- - -# توابع دیگر {#other-functions} - -## نام میزبان() {#hostname} - -بازگرداندن یک رشته با نام میزبان که این تابع در انجام شد. برای پردازش توزیع شده, این نام میزبان سرور از راه دور است, اگر تابع بر روی یک سرور از راه دور انجام. - -## FQDN {#fqdn} - -بازگرداندن نام دامنه به طور کامل واجد شرایط. - -**نحو** - -``` sql -fqdn(); -``` - -این تابع غیر حساس است. - -**مقدار بازگشتی** - -- رشته با نام دامنه به طور کامل واجد شرایط. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT FQDN(); -``` - -نتیجه: - -``` text -┌─FQDN()──────────────────────────┐ -│ clickhouse.ru-central1.internal │ -└─────────────────────────────────┘ -``` - -## basename {#basename} - -عصاره قسمت انتهایی یک رشته پس از بریده بریده و یا ممیز گذشته. این تابع اگر اغلب مورد استفاده برای استخراج نام فایل از یک مسیر. - -``` sql -basename( expr ) -``` - -**پارامترها** - -- `expr` — Expression resulting in a [رشته](../../sql_reference/data_types/string.md) نوع ارزش. همه بک اسلش باید در ارزش حاصل فرار. - -**مقدار بازگشتی** - -یک رشته که شامل: - -- قسمت انتهایی یک رشته پس از بریده بریده و یا ممیز گذشته. - - If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. - -- رشته اصلی اگر هیچ اسلش یا بک اسلش وجود دارد. - -**مثال** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## عریض) {#visiblewidthx} - -محاسبه عرض تقریبی در هنگام خروجی ارزش به کنسول در قالب متن (تب از هم جدا). -این تابع توسط سیستم برای اجرای فرمت های زیبا استفاده می شود. - -`NULL` به عنوان یک رشته مربوط به نمایندگی `NULL` داخل `Pretty` فرمتها. - -``` sql -SELECT visibleWidth(NULL) -``` - -``` text -┌─visibleWidth(NULL)─┐ -│ 4 │ -└────────────────────┘ -``` - -## نام کامل) {#totypenamex} - -بازگرداندن یک رشته حاوی نام نوع استدلال گذشت. - -اگر `NULL` به عنوان ورودی به عملکرد منتقل می شود و سپس باز می گردد `Nullable(Nothing)` نوع, که مربوط به داخلی `NULL` نمایندگی در فاحشه خانه. - -## blockSize() {#function-blocksize} - -می شود به اندازه بلوک. -در خانه, نمایش داده شد همیشه در بلوک های اجرا (مجموعه ای از قطعات ستون). این تابع اجازه می دهد تا اندازه بلوک را که شما برای نام برد دریافت کنید. - -## تحقق (ایکس) {#materializex} - -تبدیل ثابت به یک ستون کامل حاوی فقط یک مقدار. -در خانه, ستون کامل و ثابت متفاوت در حافظه نشان. توابع کار متفاوت برای استدلال ثابت و استدلال طبیعی (کد های مختلف اجرا شده است), اگر چه نتیجه این است که تقریبا همیشه همان. این تابع برای اشکال زدایی این رفتار. - -## ignore(…) {#ignore} - -می پذیرد هر استدلال, محتوی `NULL`. همیشه برمی گرداند 0. -با این حال, استدلال هنوز ارزیابی. این را می توان برای معیار استفاده می شود. - -## خواب (ثانیه) {#sleepseconds} - -خواب ‘seconds’ ثانیه در هر بلوک داده ها. شما می توانید یک عدد صحیح یا عدد ممیز شناور را مشخص کنید. - -## خواب (ثانیه) {#sleepeachrowseconds} - -خواب ‘seconds’ ثانیه در هر سطر. شما می توانید یک عدد صحیح یا عدد ممیز شناور را مشخص کنید. - -## متن() {#currentdatabase} - -بازگرداندن نام پایگاه داده فعلی. -شما می توانید این تابع در پارامترهای موتور جدول در یک پرس و جو جدول ایجاد جایی که شما نیاز به مشخص کردن پایگاه داده استفاده. - -## currentUser() {#other-function-currentuser} - -بازده ورود به سایت از کاربر فعلی. ورود کاربر که آغاز پرس و جو بازگردانده خواهد شد در مورد distibuted پرس و جو. - -``` sql -SELECT currentUser(); -``` - -نام مستعار: `user()`, `USER()`. - -**مقادیر بازگشتی** - -- ورود کاربر فعلی. -- ورود کاربر که پرس و جو در صورت پرس و جو از کار افتاده است. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT currentUser(); -``` - -نتیجه: - -``` text -┌─currentUser()─┐ -│ default │ -└───────────────┘ -``` - -## اطلاعات دقیق) {#isfinitex} - -قبول float32 و float64 و بازده uint8 برابر با 1 اگر این استدلال بی نهایت است و نه یک نان در غیر این صورت 0 است. - -## اطلاعات دقیق) {#isinfinitex} - -قبول float32 و float64 و بازده uint8 برابر با 1 اگر این استدلال بی نهایت است در غیر این صورت 0 است. توجه داشته باشید که 0 برای نان بازگشت. - -## اطلاعات دقیق {#ifnotfinite} - -بررسی اینکه مقدار ممیز شناور محدود است. - -**نحو** - - ifNotFinite(x,y) - -**پارامترها** - -- `x` — Value to be checked for infinity. Type: [شناور\*](../../sql_reference/data_types/float.md). -- `y` — Fallback value. Type: [شناور\*](../../sql_reference/data_types/float.md). - -**مقدار بازگشتی** - -- `x` اگر `x` محدود است. -- `y` اگر `x` محدود نیست. - -**مثال** - -پرسوجو: - - SELECT 1/0 as infimum, ifNotFinite(infimum,42) - -نتیجه: - - ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ - │ inf │ 42 │ - └─────────┴───────────────────────────────┘ - -شما می توانید نتیجه مشابه با استفاده از [اپراتور سه تایی](conditional_functions.md#ternary-operator): `isFinite(x) ? x : y`. - -## اطلاعات دقیق) {#isnanx} - -قبول float32 و float64 و بازده uint8 برابر با 1 اگر استدلال این است که یک نان در غیر این صورت 0 است. - -## قابل تنظیم(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -می پذیرد رشته ثابت: نام پایگاه داده, نام جدول, و نام ستون. بازگرداندن یک بیان ثابت سنت8 برابر 1 اگر یک ستون وجود دارد, در غیر این صورت 0. اگر پارامتر نام میزبان تنظیم شده است, تست بر روی یک سرور از راه دور اجرا خواهد شد. -تابع می اندازد یک استثنا اگر جدول وجود ندارد. -برای عناصر در یک ساختار داده های تو در تو, تابع چک برای وجود یک ستون. برای ساختار داده های تو در تو خود, بازده تابع 0. - -## بار {#function-bar} - -اجازه می دهد تا ساخت یک نمودار یونیکد هنر. - -`bar(x, min, max, width)` تساوی یک گروه با عرض متناسب با `(x - min)` و برابر با `width` شخصیت زمانی که `x = max`. - -پارامترها: - -- `x` — Size to display. -- `min, max` — Integer constants. The value must fit in `Int64`. -- `width` — Constant, positive integer, can be fractional. - -گروه با دقت به یک هشتم نماد کشیده شده است. - -مثال: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - -``` text -┌──h─┬──────c─┬─bar────────────────┐ -│ 0 │ 292907 │ █████████▋ │ -│ 1 │ 180563 │ ██████ │ -│ 2 │ 114861 │ ███▋ │ -│ 3 │ 85069 │ ██▋ │ -│ 4 │ 68543 │ ██▎ │ -│ 5 │ 78116 │ ██▌ │ -│ 6 │ 113474 │ ███▋ │ -│ 7 │ 170678 │ █████▋ │ -│ 8 │ 278380 │ █████████▎ │ -│ 9 │ 391053 │ █████████████ │ -│ 10 │ 457681 │ ███████████████▎ │ -│ 11 │ 493667 │ ████████████████▍ │ -│ 12 │ 509641 │ ████████████████▊ │ -│ 13 │ 522947 │ █████████████████▍ │ -│ 14 │ 539954 │ █████████████████▊ │ -│ 15 │ 528460 │ █████████████████▌ │ -│ 16 │ 539201 │ █████████████████▊ │ -│ 17 │ 523539 │ █████████████████▍ │ -│ 18 │ 506467 │ ████████████████▊ │ -│ 19 │ 520915 │ █████████████████▎ │ -│ 20 │ 521665 │ █████████████████▍ │ -│ 21 │ 542078 │ ██████████████████ │ -│ 22 │ 493642 │ ████████████████▍ │ -│ 23 │ 400397 │ █████████████▎ │ -└────┴────────┴────────────────────┘ -``` - -## تبدیل {#transform} - -تبدیل یک ارزش با توجه به نقشه برداری به صراحت تعریف شده از برخی از عناصر به دیگر. -دو نوع از این تابع وجود دارد: - -### تبدیل(x array\_from, array\_to به طور پیش فرض) {#transformx-array-from-array-to-default} - -`x` – What to transform. - -`array_from` – Constant array of values for converting. - -`array_to` – Constant array of values to convert the values in ‘from’ به. - -`default` – Which value to use if ‘x’ برابر است با هر یک از مقادیر در ‘from’. - -`array_from` و `array_to` – Arrays of the same size. - -انواع: - -`transform(T, Array(T), Array(U), U) -> U` - -`T` و `U` می تواند عددی, رشته,یا تاریخ و یا انواع تاریخ ساعت. -از کجا همان نامه نشان داده شده است (تی یا تو), برای انواع عددی این ممکن است تطبیق انواع, اما انواع که یک نوع رایج. -برای مثال استدلال می توانید نوع int64 در حالی که دوم آرایه(uint16) نوع. - -اگر ‘x’ ارزش به یکی از عناصر در برابر است ‘array\_from’ مجموعه, این بازگرداندن عنصر موجود (که شماره همان) از ‘array\_to’ صف کردن. در غیر این صورت, باز می گردد ‘default’. اگر عناصر تطبیق های متعدد در وجود دارد ‘array\_from’ این یکی از مسابقات را برمی گرداند. - -مثال: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - -``` text -┌─title─────┬──────c─┐ -│ Yandex │ 498635 │ -│ Google │ 229872 │ -│ Other │ 104472 │ -└───────────┴────────┘ -``` - -### تبدیل) {#transformx-array-from-array-to} - -متفاوت از تنوع برای اولین بار در که ‘default’ استدلال حذف شده است. -اگر ‘x’ ارزش به یکی از عناصر در برابر است ‘array\_from’ مجموعه, این بازگرداندن عنصر تطبیق (که شماره همان) از ‘array\_to’ صف کردن. در غیر این صورت, باز می گردد ‘x’. - -انواع: - -`transform(T, Array(T), Array(T)) -> T` - -مثال: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -┌─s──────────────┬───────c─┐ -│ │ 2906259 │ -│ www.yandex │ 867767 │ -│ ███████.ru │ 313599 │ -│ mail.yandex.ru │ 107147 │ -│ ██████.ru │ 100355 │ -│ █████████.ru │ 65040 │ -│ news.yandex.ru │ 64515 │ -│ ██████.net │ 59141 │ -│ example.com │ 57316 │ -└────────────────┴─────────┘ -``` - -## قالببندی) ایکس() {#formatreadablesizex} - -می پذیرد اندازه (تعداد بایت). بازگرداندن اندازه گرد با پسوند (کیلوبایت, مگابایت, و غیره.) به عنوان یک رشته . - -مثال: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - -``` text -┌─filesize_bytes─┬─filesize───┐ -│ 1 │ 1.00 B │ -│ 1024 │ 1.00 KiB │ -│ 1048576 │ 1.00 MiB │ -│ 192851925 │ 183.92 MiB │ -└────────────────┴────────────┘ -``` - -## کمترین) {#leasta-b} - -بازگرداندن کوچکترین ارزش از یک و ب. - -## بزرگترین (و, ب) {#greatesta-b} - -بازگرداندن بزرگترین ارزش یک و ب. - -## زمان بالا() {#uptime} - -بازگرداندن زمان انجام کار سرور در ثانیه. - -## نسخه() {#version} - -بازگرداندن نسخه از سرور به عنوان یک رشته. - -## منطقهی زمانی() {#timezone} - -بازگرداندن منطقه زمانی از سرور. - -## blockNumber {#blocknumber} - -بازگرداندن تعداد دنباله ای از بلوک داده که در ردیف واقع شده است. - -## رفع موانع {#function-rownumberinblock} - -بازگرداندن تعداد ترتیبی از ردیف در بلوک داده. بلوک های داده های مختلف همیشه محاسبه. - -## بلوک های رونمبرینالیک() {#rownumberinallblocks} - -بازگرداندن تعداد ترتیبی از ردیف در بلوک داده. این تابع تنها بلوک های داده تحت تاثیر قرار می گیرد. - -## همسایه {#neighbor} - -تابع پنجره که دسترسی به یک ردیف در یک افست مشخص شده است که قبل یا بعد از ردیف فعلی یک ستون داده می شود فراهم می کند. - -**نحو** - -``` sql -neighbor(column, offset[, default_value]) -``` - -نتیجه عملکرد بستگی به بلوک های داده تحت تاثیر قرار و منظور از داده ها در بلوک. -اگر شما یک خرده فروشی با سفارش و پاسخ تابع از خارج از خرده فروشی, شما می توانید نتیجه مورد انتظار از. - -**پارامترها** - -- `column` — A column name or scalar expression. -- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql_reference/data_types/int_uint.md). -- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. - -**مقادیر بازگشتی** - -- مقدار برای `column` داخل `offset` فاصله از ردیف فعلی اگر `offset` ارزش خارج از مرزهای بلوک نیست. -- مقدار پیشفرض برای `column` اگر `offset` ارزش مرزهای بلوک خارج است. اگر `default_value` داده می شود و سپس از آن استفاده خواهد شد. - -نوع: نوع بلوک های داده را تحت تاثیر قرار و یا نوع مقدار پیش فرض. - -**مثال** - -پرسوجو: - -``` sql -SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; -``` - -نتیجه: - -``` text -┌─number─┬─neighbor(number, 2)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 0 │ -│ 9 │ 0 │ -└────────┴─────────────────────┘ -``` - -پرسوجو: - -``` sql -SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; -``` - -نتیجه: - -``` text -┌─number─┬─neighbor(number, 2, 999)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 999 │ -│ 9 │ 999 │ -└────────┴──────────────────────────┘ -``` - -این تابع می تواند مورد استفاده قرار گیرد برای محاسبه ارزش متریک در سال بیش از سال: - -پرسوجو: - -``` sql -WITH toDate('2018-01-01') AS start_date -SELECT - toStartOfMonth(start_date + (number * 32)) AS month, - toInt32(month) % 100 AS money, - neighbor(money, -12) AS prev_year, - round(prev_year / money, 2) AS year_over_year -FROM numbers(16) -``` - -نتیجه: - -``` text -┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ -│ 2018-01-01 │ 32 │ 0 │ 0 │ -│ 2018-02-01 │ 63 │ 0 │ 0 │ -│ 2018-03-01 │ 91 │ 0 │ 0 │ -│ 2018-04-01 │ 22 │ 0 │ 0 │ -│ 2018-05-01 │ 52 │ 0 │ 0 │ -│ 2018-06-01 │ 83 │ 0 │ 0 │ -│ 2018-07-01 │ 13 │ 0 │ 0 │ -│ 2018-08-01 │ 44 │ 0 │ 0 │ -│ 2018-09-01 │ 75 │ 0 │ 0 │ -│ 2018-10-01 │ 5 │ 0 │ 0 │ -│ 2018-11-01 │ 36 │ 0 │ 0 │ -│ 2018-12-01 │ 66 │ 0 │ 0 │ -│ 2019-01-01 │ 97 │ 32 │ 0.33 │ -│ 2019-02-01 │ 28 │ 63 │ 2.25 │ -│ 2019-03-01 │ 56 │ 91 │ 1.62 │ -│ 2019-04-01 │ 87 │ 22 │ 0.25 │ -└────────────┴───────┴───────────┴────────────────┘ -``` - -## تغییر تنظیمات صدا) {#other_functions-runningdifference} - -Calculates the difference between successive row values ​​in the data block. -بازده 0 برای ردیف اول و تفاوت از ردیف قبلی برای هر سطر بعدی. - -نتیجه عملکرد بستگی به بلوک های داده تحت تاثیر قرار و منظور از داده ها در بلوک. -اگر شما یک خرده فروشی با سفارش و پاسخ تابع از خارج از خرده فروشی, شما می توانید نتیجه مورد انتظار از. - -مثال: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - -``` text -┌─EventID─┬───────────EventTime─┬─delta─┐ -│ 1106 │ 2016-11-24 00:00:04 │ 0 │ -│ 1107 │ 2016-11-24 00:00:05 │ 1 │ -│ 1108 │ 2016-11-24 00:00:05 │ 0 │ -│ 1109 │ 2016-11-24 00:00:09 │ 4 │ -│ 1110 │ 2016-11-24 00:00:10 │ 1 │ -└─────────┴─────────────────────┴───────┘ -``` - -لطفا توجه داشته باشید-اندازه بلوک بر نتیجه تاثیر می گذارد. با هر بلوک جدید `runningDifference` دولت تنظیم مجدد است. - -``` sql -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -┌─number─┬─diff─┐ -│ 65536 │ 0 │ -└────────┴──────┘ -``` - -``` sql -set max_block_size=100000 -- default value is 65536! - -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -``` - -## در حال بارگذاری {#runningdifferencestartingwithfirstvalue} - -همان است که برای [عدم پذیرش](./other_functions.md#other_functions-runningdifference), تفاوت ارزش ردیف اول است, ارزش سطر اول بازگشت, و هر سطر بعدی تفاوت از ردیف قبلی را برمی گرداند. - -## هشدار داده می شود) {#macnumtostringnum} - -قبول uint64 شماره. تفسیر به عنوان نشانی مک در اندی بزرگ. بازگرداندن یک رشته حاوی نشانی مک مربوطه را در قالب قلمی: ب: ر. ن:دکتر: ف.ا: ف. ف. (تعداد کولون جدا شده در فرم هگزادسیمال). - -## MACStringToNum(s) {#macstringtonums} - -عملکرد معکوس مک نومتوسترینگ. اگر نشانی مک دارای یک فرمت نامعتبر, باز می گردد 0. - -## درشتنمایی) {#macstringtoouis} - -می پذیرد یک نشانی مک در فرمت قلمی:بیت:ر.ن:دی. دی:اف (تعداد روده بزرگ از هم جدا در فرم هگزادسیمال). بازگرداندن سه هشت تایی اول به عنوان یک عدد ظاهری64. اگر نشانی مک دارای یک فرمت نامعتبر, باز می گردد 0. - -## نوع گیرنده {#getsizeofenumtype} - -بازگرداندن تعدادی از زمینه های در [شمارشی](../../sql_reference/data_types/enum.md). - -``` sql -getSizeOfEnumType(value) -``` - -**پارامترها:** - -- `value` — Value of type `Enum`. - -**مقادیر بازگشتی** - -- تعدادی از زمینه های با `Enum` مقادیر ورودی. -- یک استثنا پرتاب می شود اگر نوع نیست `Enum`. - -**مثال** - -``` sql -SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## بلوک سازی {#blockserializedsize} - -بازده اندازه بر روی دیسک (بدون در نظر گرفتن فشرده سازی حساب). - -``` sql -blockSerializedSize(value[, value[, ...]]) -``` - -**پارامترها:** - -- `value` — Any value. - -**مقادیر بازگشتی** - -- تعداد بایت خواهد شد که به دیسک برای بلوک از ارزش های نوشته شده (بدون فشرده سازی). - -**مثال** - -``` sql -SELECT blockSerializedSize(maxState(1)) as x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## بدون نام {#tocolumntypename} - -بازگرداندن نام کلاس است که نشان دهنده نوع داده ها از ستون در رم. - -``` sql -toColumnTypeName(value) -``` - -**پارامترها:** - -- `value` — Any type of value. - -**مقادیر بازگشتی** - -- یک رشته با نام کلاس است که برای نمایندگی از استفاده `value` نوع داده در رم. - -**نمونه ای از تفاوت بین`toTypeName ' and ' toColumnTypeName`** - -``` sql -SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime │ -└─────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ Const(UInt32) │ -└───────────────────────────────────────────────────────────┘ -``` - -مثال نشان می دهد که `DateTime` نوع داده در حافظه ذخیره می شود به عنوان `Const(UInt32)`. - -## روبنا دامپکول {#dumpcolumnstructure} - -خروجی شرح مفصلی از ساختارهای داده در رم - -``` sql -dumpColumnStructure(value) -``` - -**پارامترها:** - -- `value` — Any type of value. - -**مقادیر بازگشتی** - -- یک رشته توصیف ساختار است که برای نمایندگی از استفاده `value` نوع داده در رم. - -**مثال** - -``` sql -SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) -``` - -``` text -┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime, Const(size = 1, UInt32(size = 1)) │ -└──────────────────────────────────────────────────────────────┘ -``` - -## نوع قراردادی {#defaultvalueofargumenttype} - -خروجی مقدار پیش فرض برای نوع داده. - -مقادیر پیش فرض برای ستون های سفارشی تعیین شده توسط کاربر را شامل نمی شود. - -``` sql -defaultValueOfArgumentType(expression) -``` - -**پارامترها:** - -- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. - -**مقادیر بازگشتی** - -- `0` برای اعداد. -- رشته خالی برای رشته. -- `ᴺᵁᴸᴸ` برای [Nullable](../../sql_reference/data_types/nullable.md). - -**مثال** - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ -│ 0 │ -└─────────────────────────────────────────────┘ -``` - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ -│ ᴺᵁᴸᴸ │ -└───────────────────────────────────────────────────────┘ -``` - -## تکرار {#other-functions-replicate} - -ایجاد مجموعه ای با یک مقدار واحد. - -مورد استفاده برای اجرای داخلی [ارریجین](array_join.md#functions_arrayjoin). - -``` sql -SELECT replicate(x, arr); -``` - -**پارامترها:** - -- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. -- `x` — The value that the resulting array will be filled with. - -**مقدار بازگشتی** - -مجموعه ای پر از ارزش `x`. - -نوع: `Array`. - -**مثال** - -پرسوجو: - -``` sql -SELECT replicate(1, ['a', 'b', 'c']) -``` - -نتیجه: - -``` text -┌─replicate(1, ['a', 'b', 'c'])─┐ -│ [1,1,1] │ -└───────────────────────────────┘ -``` - -## رشته های قابل استفاده {#filesystemavailable} - -بازگرداندن مقدار فضای باقی مانده بر روی سیستم فایل که فایل های پایگاه داده واقع. این است که همیشه کوچکتر از فضای کل رایگان ([بدون پرونده](#filesystemfree)) چرا که برخی از فضا برای سیستم عامل محفوظ می باشد. - -**نحو** - -``` sql -filesystemAvailable() -``` - -**مقدار بازگشتی** - -- مقدار فضای باقی مانده موجود در بایت. - -نوع: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; -``` - -نتیجه: - -``` text -┌─Available space─┬─Type───┐ -│ 30.75 GiB │ UInt64 │ -└─────────────────┴────────┘ -``` - -## بدون پرونده {#filesystemfree} - -بازگرداندن مقدار کل فضای رایگان بر روی سیستم فایل که فایل های پایگاه داده واقع. همچنین نگاه کنید به `filesystemAvailable` - -**نحو** - -``` sql -filesystemFree() -``` - -**مقدار بازگشتی** - -- مقدار فضای رایگان در بایت. - -نوع: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; -``` - -نتیجه: - -``` text -┌─Free space─┬─Type───┐ -│ 32.39 GiB │ UInt64 │ -└────────────┴────────┘ -``` - -## سختی پرونده {#filesystemcapacity} - -بازگرداندن ظرفیت فایل سیستم در بایت. برای ارزیابی [مسیر](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) به دایرکتوری داده ها باید پیکربندی شود. - -**نحو** - -``` sql -filesystemCapacity() -``` - -**مقدار بازگشتی** - -- اطلاعات ظرفیت سیستم فایل در بایت. - -نوع: [UInt64](../../sql_reference/data_types/int_uint.md). - -**مثال** - -پرسوجو: - -``` sql -SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" -``` - -نتیجه: - -``` text -┌─Capacity──┬─Type───┐ -│ 39.32 GiB │ UInt64 │ -└───────────┴────────┘ -``` - -## پلاکتی {#function-finalizeaggregation} - -طول می کشد دولت از تابع جمع. بازده نتیجه تجمع (دولت نهایی). - -## خرابی اجرا {#function-runningaccumulate} - -طول می کشد کشورهای تابع جمع و یک ستون با ارزش را برمی گرداند, در نتیجه تجمع این کشورها برای مجموعه ای از خطوط بلوک هستند, از اول به خط فعلی. -برای مثال طول می کشد state of aggregate function (به عنوان مثال runningaccumulate(uniqstate(userid))) و برای هر ردیف از بلوک بازگشت نتیجه از مجموع عملکرد در ادغام دولت قبلی تمام ردیف و ردیف جاری است. -بنابراین نتیجه عملکرد بستگی به پارتیشن داده ها به بلوک ها و به ترتیب داده ها در بلوک دارد. - -## جوینت {#joinget} - -تابع شما اجازه می دهد استخراج داده ها از جدول به همان شیوه به عنوان از یک [واژهنامه](../../sql_reference/dictionaries/index.md). - -می شود داده ها از [پیوستن](../../engines/table_engines/special/join.md#creating-a-table) جداول با استفاده از کلید ملحق مشخص. - -فقط پشتیبانی از جداول ایجاد شده با `ENGINE = Join(ANY, LEFT, )` بیانیه. - -**نحو** - -``` sql -joinGet(join_storage_table_name, `value_column`, join_keys) -``` - -**پارامترها** - -- `join_storage_table_name` — an [شناسه](../syntax.md#syntax-identifiers) نشان می دهد که جستجو انجام شده است. شناسه در پایگاه داده به طور پیش فرض جستجو (پارامتر را ببینید `default_database` در فایل پیکربندی). برای نادیده گرفتن پایگاه داده پیش فرض از `USE db_name` یا پایگاه داده و جدول را از طریق جداساز مشخص کنید `db_name.db_table`, مثال را ببینید. -- `value_column` — name of the column of the table that contains required data. -- `join_keys` — list of keys. - -**مقدار بازگشتی** - -را برمی گرداند لیستی از ارزش مطابقت دارد به لیست کلید. - -اگر برخی در جدول منبع وجود ندارد و سپس `0` یا `null` خواهد شد بر اساس بازگشت [ارزشهای خبری عبارتند از:](../../operations/settings/settings.md#join_use_nulls) تنظیمات. - -اطلاعات بیشتر در مورد `join_use_nulls` داخل [پیوستن به عملیات](../../engines/table_engines/special/join.md). - -**مثال** - -جدول ورودی: - -``` sql -CREATE DATABASE db_test -CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 -INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) -``` - -``` text -┌─id─┬─val─┐ -│ 4 │ 13 │ -│ 2 │ 12 │ -│ 1 │ 11 │ -└────┴─────┘ -``` - -پرسوجو: - -``` sql -SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 -``` - -نتیجه: - -``` text -┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ -│ 0 │ -│ 11 │ -│ 12 │ -│ 0 │ -└──────────────────────────────────────────────────┘ -``` - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -ارزیابی مدل خارجی. -می پذیرد نام مدل و استدلال مدل. را برمی گرداند شناور64. - -## throwIf(x\[, custom\_message\]) {#throwifx-custom-message} - -پرتاب یک استثنا اگر استدلال غیر صفر است. -\_پیغام سفارشی-پارامتر اختیاری است: یک رشته ثابت, فراهم می کند یک پیغام خطا - -``` sql -SELECT throwIf(number = 3, 'Too many') FROM numbers(10); -``` - -``` text -↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): -Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. -``` - -## هویت {#identity} - -بازگرداندن همان مقدار که به عنوان استدلال خود مورد استفاده قرار گرفت. مورد استفاده برای اشکال زدایی و تست, اجازه می دهد تا به لغو با استفاده از شاخص, و عملکرد پرس و جو از یک اسکن کامل. هنگامی که پرس و جو برای استفاده احتمالی از شاخص تجزیه و تحلیل, تجزیه و تحلیل می کند در داخل نگاه نمی `identity` توابع. - -**نحو** - -``` sql -identity(x) -``` - -**مثال** - -پرسوجو: - -``` sql -SELECT identity(42) -``` - -نتیجه: - -``` text -┌─identity(42)─┐ -│ 42 │ -└──────────────┘ -``` - -## درباره ما {#randomascii} - -تولید یک رشته با مجموعه ای تصادفی از [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) شخصیت های قابل چاپ. - -**نحو** - -``` sql -randomPrintableASCII(length) -``` - -**پارامترها** - -- `length` — Resulting string length. Positive integer. - - If you pass `length < 0`, behavior of the function is undefined. - -**مقدار بازگشتی** - -- رشته با مجموعه ای تصادفی از [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) شخصیت های قابل چاپ. - -نوع: [رشته](../../sql_reference/data_types/string.md) - -**مثال** - -``` sql -SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 -``` - -``` text -┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ -│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ -│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ -│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ -└────────┴────────────────────────────────┴──────────────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/fa/sql_reference/functions/rounding_functions.md b/docs/fa/sql_reference/functions/rounding_functions.md deleted file mode 100644 index 41ff2de5d3a..00000000000 --- a/docs/fa/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: "\u06AF\u0631\u062F \u06A9\u0631\u062F\u0646" ---- - -# گرد کردن توابع {#rounding-functions} - -## طبقه (ایکس\]) {#floorx-n} - -بازگرداندن بیشترین تعداد دور است که کمتر از یا مساوی `x`. تعداد دور چند تن از 1/10 و یا نزدیکترین تعداد داده های مناسب نوع اگر 1 / 10 دقیق نیست. -‘N’ ثابت عدد صحیح است, پارامتر اختیاری. به طور پیش فرض صفر است, که به معنی به دور به یک عدد صحیح. -‘N’ ممکن است منفی باشد. - -مثالها: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x` هر نوع عددی است. نتیجه تعدادی از همان نوع است. -برای استدلال عدد صحیح را حس می کند به دور با منفی `N` ارزش (برای غیر منفی `N` تابع هیچ کاری نمی کند). -اگر گرد باعث سرریز (مثلا, کف سازی(-128, -1)), نتیجه اجرای خاص بازگشته است. - -## هشدار داده می شود\]) {#ceilx-n-ceilingx-n} - -بازگرداندن کوچکترین عدد دور است که بیشتر از یا مساوی `x`. در هر راه دیگر, این همان است که `floor` تابع (بالا را ببینید). - -## هشدار داده می شود\]) {#truncx-n-truncatex-n} - -بازگرداندن تعداد دور با بزرگترین ارزش مطلق است که ارزش مطلق کمتر یا مساوی `x`‘s. In every other way, it is the same as the ’floor’ تابع (بالا را ببینید). - -## دور (ایکس\]) {#rounding_functions-round} - -دور یک مقدار به تعداد مشخصی از رقم اعشار. - -تابع نزدیکترین تعداد از سفارش مشخص شده را برمی گرداند. در صورتی که تعداد داده شده است فاصله برابر با شماره های اطراف, تابع با استفاده از گرد کردن بانکدار برای انواع شماره شناور و دور به دور از صفر برای انواع شماره های دیگر. - -``` sql -round(expression [, decimal_places]) -``` - -**پارامترها:** - -- `expression` — A number to be rounded. Can be any [عبارت](../syntax.md#syntax-expressions) بازگشت عددی [نوع داده](../../sql_reference/data_types/index.md#data_types). -- `decimal-places` — An integer value. - - اگر `decimal-places > 0` سپس تابع دور ارزش به سمت راست از نقطه اعشار. - - اگر `decimal-places < 0` سپس تابع دور ارزش به سمت چپ نقطه اعشار. - - اگر `decimal-places = 0` سپس تابع دور ارزش به عدد صحیح. در این مورد استدلال را می توان حذف. - -**مقدار بازگشتی:** - -گرد شماره از همان نوع به عنوان ورودی شماره. - -### مثالها {#examples} - -**مثال استفاده** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - -``` text -┌───x─┬─round(divide(number, 2))─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -└─────┴──────────────────────────┘ -``` - -**نمونه هایی از گرد کردن** - -گرد کردن به نزدیکترین شماره. - -``` text -round(3.2, 0) = 3 -round(4.1267, 2) = 4.13 -round(22,-1) = 20 -round(467,-2) = 500 -round(-467,-2) = -500 -``` - -گرد کردن بانکدار. - -``` text -round(3.5) = 4 -round(4.5) = 4 -round(3.55, 1) = 3.6 -round(3.65, 1) = 3.6 -``` - -**همچنین نگاه کنید به** - -- [roundBankers](#roundbankers) - -## سرباز {#roundbankers} - -دور یک عدد به یک موقعیت دهدهی مشخص شده است. - -- اگر تعداد گرد کردن در نیمه راه بین دو عدد است, تابع با استفاده از گرد کردن بانکدار. - - Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. - - It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. - -- در موارد دیگر تابع دور اعداد به نزدیکترین عدد صحیح. - -با استفاده از گرد کردن بانکدار, شما می توانید اثر است که گرد کردن اعداد در نتایج حاصل از جمع و یا کم کردن این اعداد را کاهش می دهد. - -برای مثال مجموع اعداد 1.5, 2.5, 3.5, 4.5 مختلف گرد: - -- بدون گرد کردن: 1.5 + 2.5 + 3.5 + 4.5 = 12. -- گرد کردن بانکدار: 2 + 2 + 4 + 4 = 12. -- گرد کردن به نزدیکترین عدد صحیح: 2 + 3 + 4 + 5 = 14. - -**نحو** - -``` sql -roundBankers(expression [, decimal_places]) -``` - -**پارامترها** - -- `expression` — A number to be rounded. Can be any [عبارت](../syntax.md#syntax-expressions) بازگشت عددی [نوع داده](../../sql_reference/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`. - - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. - -**مقدار بازگشتی** - -ارزش گرد شده توسط روش گرد کردن بانکدار. - -### مثالها {#examples-1} - -**مثال استفاده** - -پرسوجو: - -``` sql - SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 -``` - -نتیجه: - -``` text -┌───x─┬─b─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -│ 1.5 │ 2 │ -│ 2 │ 2 │ -│ 2.5 │ 2 │ -│ 3 │ 3 │ -│ 3.5 │ 4 │ -│ 4 │ 4 │ -│ 4.5 │ 4 │ -└─────┴───┘ -``` - -**نمونه هایی از گرد کردن بانکدار** - -``` text -roundBankers(0.4) = 0 -roundBankers(-3.5) = -4 -roundBankers(4.5) = 4 -roundBankers(3.55, 1) = 3.6 -roundBankers(3.65, 1) = 3.6 -roundBankers(10.35, 1) = 10.4 -roundBankers(10.755, 2) = 11,76 -``` - -**همچنین نگاه کنید به** - -- [گرد](#rounding_functions-round) - -## توسعه پایدار2) {#roundtoexp2num} - -می پذیرد تعداد. اگر تعداد کمتر از یک است, باز می گردد 0. در غیر این صورت, این دور تعداد پایین به نزدیکترین (مجموع غیر منفی) درجه دو. - -## طول عمر (تعداد) {#rounddurationnum} - -می پذیرد تعداد. اگر تعداد کمتر از یک است, باز می گردد 0. در غیر این صورت, این دور تعداد را به اعداد از مجموعه: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. این تابع خاص به یاندکس است.متریکا و مورد استفاده برای اجرای گزارش در طول جلسه. - -## عدد) {#roundagenum} - -می پذیرد تعداد. اگر تعداد کمتر از است 18, باز می گردد 0. در غیر این صورت, این دور تعداد را به یک عدد از مجموعه: 18, 25, 35, 45, 55. این تابع خاص به یاندکس است.متریکا و مورد استفاده برای اجرای گزارش در سن کاربر. - -## roundDown(num arr) {#rounddownnum-arr} - -یک عدد را می پذیرد و به یک عنصر در مجموعه مشخص شده منتقل می کند. اگر مقدار کمتر از پایین ترین حد محدود است, پایین ترین حد بازگشته است. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/fa/sql_reference/functions/splitting_merging_functions.md b/docs/fa/sql_reference/functions/splitting_merging_functions.md deleted file mode 100644 index fdcb7bbac56..00000000000 --- a/docs/fa/sql_reference/functions/splitting_merging_functions.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 47 -toc_title: "\u062A\u0642\u0633\u06CC\u0645 \u0648 \u0627\u062F\u063A\u0627\u0645 \u0631\ - \u0634\u062A\u0647 \u0647\u0627 \u0648 \u0627\u0631\u0631\u06CC\u0633" ---- - -# توابع برای تقسیم و ادغام رشته ها و ارریس {#functions-for-splitting-and-merging-strings-and-arrays} - -## اسپلیت بیچار (جداساز) {#splitbycharseparator-s} - -انشعابات یک رشته به بسترهای جدا شده توسط یک شخصیت مشخص شده است. با استفاده از یک رشته ثابت `separator` که متشکل از دقیقا یک شخصیت. -بازگرداندن مجموعه ای از بسترهای انتخاب. بسترهای خالی ممکن است انتخاب شود اگر جدا در ابتدا یا انتهای رشته رخ می دهد, و یا اگر چند جداکننده متوالی وجود دارد. - -**نحو** - -``` sql -splitByChar(, ) -``` - -**پارامترها** - -- `separator` — The separator which should contain exactly one character. [رشته](../../sql_reference/data_types/string.md). -- `s` — The string to split. [رشته](../../sql_reference/data_types/string.md). - -**مقدار بازگشتی)** - -بازگرداندن مجموعه ای از بسترهای انتخاب. بسترهای خالی ممکن است انتخاب شود که: - -- جداساز در ابتدا یا انتهای رشته رخ می دهد; -- چندین جداکننده متوالی وجود دارد; -- رشته اصلی `s` خالیه - -نوع: [& حذف](../../sql_reference/data_types/array.md) از [رشته](../../sql_reference/data_types/string.md). - -**مثال** - -``` sql -SELECT splitByChar(',', '1,2,3,abcde') -``` - -``` text -┌─splitByChar(',', '1,2,3,abcde')─┐ -│ ['1','2','3','abcde'] │ -└─────────────────────────────────┘ -``` - -## رشته اسپلیتبیست (جداساز) {#splitbystringseparator-s} - -انشعابات یک رشته به بسترهای جدا شده توسط یک رشته. با استفاده از یک رشته ثابت `separator` از شخصیت های متعدد به عنوان جدا کننده. اگر رشته `separator` خالی است, این رشته تقسیم `s` به مجموعه ای از شخصیت های تک. - -**نحو** - -``` sql -splitByString(, ) -``` - -**پارامترها** - -- `separator` — The separator. [رشته](../../sql_reference/data_types/string.md). -- `s` — The string to split. [رشته](../../sql_reference/data_types/string.md). - -**مقدار بازگشتی)** - -بازگرداندن مجموعه ای از بسترهای انتخاب. بسترهای خالی ممکن است انتخاب شود که: - -نوع: [& حذف](../../sql_reference/data_types/array.md) از [رشته](../../sql_reference/data_types/string.md). - -- جدا کننده غیر خالی در ابتدا یا انتهای رشته رخ می دهد; -- چند جدا متوالی غیر خالی وجود دارد; -- رشته اصلی `s` خالی است در حالی که جدا خالی نیست. - -**مثال** - -``` sql -SELECT splitByString(', ', '1, 2 3, 4,5, abcde') -``` - -``` text -┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ -│ ['1','2 3','4,5','abcde'] │ -└───────────────────────────────────────────┘ -``` - -``` sql -SELECT splitByString('', 'abcde') -``` - -``` text -┌─splitByString('', 'abcde')─┐ -│ ['a','b','c','d','e'] │ -└────────────────────────────┘ -``` - -## حذف میانبر در صفحه خانه\]) {#arraystringconcatarr-separator} - -رشته های ذکر شده در مجموعه را با جداساز مطابقت می دهد.'جدا کننده' پارامتر اختیاری است: یک رشته ثابت, مجموعه ای به یک رشته خالی به طور پیش فرض. -رشته را برمی گرداند. - -## اطلاعات دقیق) {#alphatokenss} - -انتخاب substrings متوالی بایت از محدوده a-z و a-z. بازگرداندن یک آرایه از substrings. - -**مثال** - -``` sql -SELECT alphaTokens('abca1abc') -``` - -``` text -┌─alphaTokens('abca1abc')─┐ -│ ['abca','abc'] │ -└─────────────────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/fa/sql_reference/functions/string_functions.md b/docs/fa/sql_reference/functions/string_functions.md deleted file mode 100644 index 9a2bedf584e..00000000000 --- a/docs/fa/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,489 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0631\u0634\u062A\u0647 \u0647\u0627" ---- - -# توابع برای کار با رشته {#functions-for-working-with-strings} - -## خالی {#empty} - -بازده 1 برای یک رشته خالی و یا 0 برای یک رشته غیر خالی. -نتیجه این نوع uint8. -یک رشته در نظر گرفته شده است غیر خالی اگر شامل حداقل یک بایت, حتی اگر این یک فضا یا یک بایت پوچ است. -این تابع همچنین برای ارریس کار می کند. - -## notEmpty {#notempty} - -بازده 0 برای یک رشته خالی یا 1 برای یک رشته غیر خالی. -نتیجه این نوع uint8. -این تابع همچنین برای ارریس کار می کند. - -## طول {#length} - -بازگرداندن طول یک رشته در بایت (نه در شخصیت, و نه در نقاط کد). -نتیجه این نوع uint64. -این تابع همچنین برای ارریس کار می کند. - -## طول 8 {#lengthutf8} - -بازگرداندن طول یک رشته در نقاط کد یونیکد (نه در شخصیت), فرض کنید که رشته شامل مجموعه ای از بایت است که متن کد گذاری شده را تشکیل می دهند. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). -نتیجه این نوع uint64. - -## \_شروع مجدد {#char-length} - -بازگرداندن طول یک رشته در نقاط کد یونیکد (نه در شخصیت), فرض کنید که رشته شامل مجموعه ای از بایت است که متن کد گذاری شده را تشکیل می دهند. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). -نتیجه این نوع uint64. - -## \_شخصیت شناسی {#character-length} - -بازگرداندن طول یک رشته در نقاط کد یونیکد (نه در شخصیت), فرض کنید که رشته شامل مجموعه ای از بایت است که متن کد گذاری شده را تشکیل می دهند. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). -نتیجه این نوع uint64. - -## پایین تر {#lower} - -تبدیل نمادهای اسکی لاتین در یک رشته به حروف کوچک. - -## بالارفتن {#upper} - -تبدیل نمادهای اسکی لاتین در یک رشته به حروف بزرگ. - -## لوراتف8 {#lowerutf8} - -تبدیل یک رشته به حروف کوچک, فرض رشته شامل مجموعه ای از بایت که یک متن کد گذاری شده-8 را تشکیل می دهند. -این زبان را تشخیص نمی دهد. بنابراین برای ترکیه نتیجه ممکن است دقیقا درست باشد. -اگر طول توالی یونایتد-8 بایت برای مورد بالا و پایین تر از یک نقطه کد متفاوت است, نتیجه ممکن است برای این نقطه کد نادرست. -اگر رشته شامل مجموعه ای از بایت است که سخن گفتن نیست-8, سپس رفتار تعریف نشده است. - -## یوتف8 {#upperutf8} - -تبدیل یک رشته به حروف بزرگ, فرض رشته شامل مجموعه ای از بایت که یک متن کد گذاری شده-8 را تشکیل می دهند. -این زبان را تشخیص نمی دهد. بنابراین برای ترکیه نتیجه ممکن است دقیقا درست باشد. -اگر طول توالی یونایتد-8 بایت برای مورد بالا و پایین تر از یک نقطه کد متفاوت است, نتیجه ممکن است برای این نقطه کد نادرست. -اگر رشته شامل مجموعه ای از بایت است که سخن گفتن نیست-8, سپس رفتار تعریف نشده است. - -## اسوالدیدوتف8 {#isvalidutf8} - -بازده 1, اگر مجموعه ای از کلمه در ادامه متن معتبر است-8 کد گذاری, در غیر این صورت 0. - -## تولدیدوتف8 {#tovalidutf8} - -8 کاراکتر نامعتبر را جایگزین می کند `�` اطلاعات دقیق همه در حال اجرا در یک ردیف شخصیت نامعتبر را به یک شخصیت جایگزین فرو ریخت. - -``` sql -toValidUTF8( input_string ) -``` - -پارامترها: - -- input\_string — Any set of bytes represented as the [رشته](../../sql_reference/data_types/string.md) شی نوع داده. - -مقدار بازگشتی: معتبر یونایتد-8 رشته. - -**مثال** - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## تکرار {#repeat} - -تکرار یک رشته را به عنوان چند بار به عنوان مشخص شده و concatenates تکراری ارزش به عنوان یک رشته است. - -**نحو** - -``` sql -repeat(s, n) -``` - -**پارامترها** - -- `s` — The string to repeat. [رشته](../../sql_reference/data_types/string.md). -- `n` — The number of times to repeat the string. [اینترنت](../../sql_reference/data_types/int_uint.md). - -**مقدار بازگشتی** - -تک رشته ای که حاوی رشته است `s` تکرار `n` زمان. اگر `n` \< 1, تابع رشته خالی می گرداند. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT repeat('abc', 10) -``` - -نتیجه: - -``` text -┌─repeat('abc', 10)──────────────┐ -│ abcabcabcabcabcabcabcabcabcabc │ -└────────────────────────────────┘ -``` - -## معکوس {#reverse} - -معکوس رشته (به عنوان یک دنباله از بایت). - -## معکوس کردن8 {#reverseutf8} - -معکوس دنباله ای از نقاط کد یونیکد, فرض کنید که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن گفته-8. در غیر این صورت, این کار چیز دیگری (این یک استثنا پرتاب نمی). - -## format(pattern, s0, s1, …) {#format} - -قالب بندی الگوی ثابت با رشته ذکر شده در استدلال. `pattern` یک الگوی فرمت پایتون ساده شده است. رشته فرمت شامل “replacement fields” احاطه شده توسط پرانتز فرفری `{}`. هر چیزی که در پرانتز موجود نیست در نظر گرفته شده است متن تحت اللفظی است که بدون تغییر به خروجی کپی شده است. اگر شما نیاز به شامل یک شخصیت بند در متن تحت اللفظی, این را می توان با دو برابر فرار: `{{ '{{' }}` و `{{ '}}' }}`. نام فیلد می تواند اعداد (با شروع از صفر) یا خالی (سپس به عنوان شماره نتیجه درمان می شوند). - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') -``` - -``` text -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ -``` - -``` sql -SELECT format('{} {}', 'Hello', 'World') -``` - -``` text -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## الحاق {#concat} - -رشته های ذکر شده در استدلال بدون جدا کننده را تصدیق می کند. - -**نحو** - -``` sql -concat(s1, s2, ...) -``` - -**پارامترها** - -ارزش رشته نوع و یا رشته ثابت. - -**مقادیر بازگشتی** - -را برمی گرداند رشته ای که منجر به از الحاق استدلال. - -اگر هر یک از مقادیر استدلال است `NULL`, `concat` بازگشت `NULL`. - -**مثال** - -پرسوجو: - -``` sql -SELECT concat('Hello, ', 'World!') -``` - -نتیجه: - -``` text -┌─concat('Hello, ', 'World!')─┐ -│ Hello, World! │ -└─────────────────────────────┘ -``` - -## همبسته {#concatassumeinjective} - -مثل [الحاق](#concat) تفاوت این است که شما نیاز به اطمینان حاصل شود که `concat(s1, s2, ...) → sn` این برای بهینه سازی گروه توسط استفاده می شود. - -تابع به نام “injective” اگر همیشه نتیجه های مختلف برای مقادیر مختلف استدلال می گرداند. به عبارت دیگر: استدلال های مختلف هرگز نتیجه یکسان عملکرد. - -**نحو** - -``` sql -concatAssumeInjective(s1, s2, ...) -``` - -**پارامترها** - -ارزش رشته نوع و یا رشته ثابت. - -**مقادیر بازگشتی** - -را برمی گرداند رشته ای که منجر به از الحاق استدلال. - -اگر هر یک از مقادیر استدلال است `NULL`, `concatAssumeInjective` بازگشت `NULL`. - -**مثال** - -جدول ورودی: - -``` sql -CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; -INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); -SELECT * from key_val; -``` - -``` text -┌─key1────┬─key2─────┬─value─┐ -│ Hello, │ World │ 1 │ -│ Hello, │ World │ 2 │ -│ Hello, │ World! │ 3 │ -│ Hello │ , World! │ 2 │ -└─────────┴──────────┴───────┘ -``` - -پرسوجو: - -``` sql -SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) -``` - -نتیجه: - -``` text -┌─concat(key1, key2)─┬─sum(value)─┐ -│ Hello, World! │ 3 │ -│ Hello, World! │ 2 │ -│ Hello, World │ 3 │ -└────────────────────┴────────────┘ -``` - -## زیر رشته(بازدید کنندگان, انحراف, طول), اواسط(بازدید کنندگان, انحراف, طول), عام (بازدید کنندگان, انحراف, طول) {#substring} - -بازگرداندن یک رشته شروع با بایت از ‘offset’ شاخص این است ‘length’ کلمه در ادامه متن طولانی. نمایه سازی شخصیت از یک شروع می شود (همانطور که در گذاشتن استاندارد). این ‘offset’ و ‘length’ استدلال باید ثابت باشد. - -## زیر بغل کردن 8(بازدید کنندگان, انحراف, طول) {#substringutf8} - -همان ‘substring’, اما برای نقاط کد یونیکد. این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری شده وزارت مخابرات 8. اگر این فرض ملاقات نکرده است, این گرداند برخی از نتیجه (این یک استثنا پرتاب نمی کند). - -## appendTrailingCharIfAbsent(s, c) {#appendtrailingcharifabsent} - -اگر ‘s’ رشته غیر خالی است و حاوی نیست ‘c’ شخصیت در پایان این برنامه ‘c’ شخصیت به پایان. - -## تبدیل(بازدید کنندگان, از, به) {#convertcharset} - -بازگرداندن رشته ‘s’ که از رمزگذاری در تبدیل شد ‘from’ به رمزگذاری در ‘to’. - -## کد زیر 64) {#base64encode} - -کدگذاریها ‘s’ رشته به پایگاه64 - -## کد زیر 64) {#base64decode} - -رمزگشایی پایگاه64-رشته کد گذاری شده ‘s’ به رشته اصلی. در صورت شکست را افزایش می دهد یک استثنا. - -## تریباس64دسیدی) {#trybase64decode} - -شبیه به حالت کد باس64, اما در صورت خطا یک رشته خالی می شود بازگشت. - -## endsWith(s, پسوند) {#endswith} - -بازگرداندن اینکه با پسوند مشخص شده پایان یابد. بازده 1 اگر رشته به پایان می رسد با پسوند مشخص, در غیر این صورت باز می گردد 0. - -## startsWith(str, پیشوند) {#startswith} - -بازده 1 اینکه رشته با پیشوند مشخص شروع می شود, در غیر این صورت باز می گردد 0. - -``` sql -SELECT startsWith('Spider-Man', 'Spi'); -``` - -**مقادیر بازگشتی** - -- 1, اگر رشته با پیشوند مشخص شروع می شود. -- 0, اگر رشته با پیشوند مشخص شروع نشد. - -**مثال** - -پرسوجو: - -``` sql -SELECT startsWith('Hello, world!', 'He'); -``` - -نتیجه: - -``` text -┌─startsWith('Hello, world!', 'He')─┐ -│ 1 │ -└───────────────────────────────────┘ -``` - -## تر و تمیز {#trim} - -حذف تمام شخصیت های مشخص شده از شروع یا پایان یک رشته. -به طور پیش فرض حذف همه وقوع متوالی از فضای سفید مشترک (شخصیت اسکی 32) از هر دو به پایان می رسد از یک رشته. - -**نحو** - -``` sql -trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) -``` - -**پارامترها** - -- `trim_character` — specified characters for trim. [رشته](../../sql_reference/data_types/string.md). -- `input_string` — string for trim. [رشته](../../sql_reference/data_types/string.md). - -**مقدار بازگشتی** - -یک رشته بدون پیشرو و (یا) انتهایی شخصیت مشخص شده است. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT trim(BOTH ' ()' FROM '( Hello, world! )') -``` - -نتیجه: - -``` text -┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ -│ Hello, world! │ -└───────────────────────────────────────────────┘ -``` - -## trimLeft {#trimleft} - -حذف تمام رخدادهای متوالی از فضای سفید مشترک (شخصیت اسکی 32) از ابتدای یک رشته. آن را نمی کند, حذف انواع دیگر از کاراکترهای فضای سفید (برگه بدون شکستن فضا و غیره.). - -**نحو** - -``` sql -trimLeft(input_string) -``` - -نام مستعار: `ltrim(input_string)`. - -**پارامترها** - -- `input_string` — string to trim. [رشته](../../sql_reference/data_types/string.md). - -**مقدار بازگشتی** - -یک رشته بدون پیشرو فضاهای سفید مشترک. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT trimLeft(' Hello, world! ') -``` - -نتیجه: - -``` text -┌─trimLeft(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## trimRight {#trimright} - -حذف همه متوالی تکرار مشترک فضای خالی (ascii شخصیت 32) از پایان یک رشته است. آن را نمی کند, حذف انواع دیگر از کاراکترهای فضای سفید (برگه بدون شکستن فضا و غیره.). - -**نحو** - -``` sql -trimRight(input_string) -``` - -نام مستعار: `rtrim(input_string)`. - -**پارامترها** - -- `input_string` — string to trim. [رشته](../../sql_reference/data_types/string.md). - -**مقدار بازگشتی** - -یک رشته بدون انتهایی فضاهای خالی مشترک. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT trimRight(' Hello, world! ') -``` - -نتیجه: - -``` text -┌─trimRight(' Hello, world! ')─┐ -│ Hello, world! │ -└──────────────────────────────────────┘ -``` - -## اصلاح {#trimboth} - -حذف تمام رخدادهای متوالی از فضای سفید مشترک (شخصیت اسکی 32) از هر دو به پایان می رسد از یک رشته. این کار انواع دیگر از شخصیت های فضای سفید را حذف کنید (باریکه, فضای بدون استراحت, و غیره.). - -**نحو** - -``` sql -trimBoth(input_string) -``` - -نام مستعار: `trim(input_string)`. - -**پارامترها** - -- `input_string` — string to trim. [رشته](../../sql_reference/data_types/string.md). - -**مقدار بازگشتی** - -یک رشته بدون پیشرو و انتهایی فضاهای سفید مشترک. - -نوع: `String`. - -**مثال** - -پرسوجو: - -``` sql -SELECT trimBoth(' Hello, world! ') -``` - -نتیجه: - -``` text -┌─trimBoth(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## CRC32(s) {#crc32} - -بازگرداندن کنترلی از یک رشته, با استفاده از کروک-32-یی 802.3 چند جملهای و مقدار اولیه `0xffffffff` هشدار داده می شود - -نتیجه این نوع uint32. - -## CRC32IEEE(s) {#crc32ieee} - -را برمی گرداند کنترل از یک رشته, با استفاده از کروم-32-یی 802.3 چند جملهای. - -نتیجه این نوع uint32. - -## CRC64(s) {#crc64} - -بازده crc64 کنترلی از یک رشته با استفاده از crc-64-ecma چند جملهای. - -نتیجه این نوع uint64. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/fa/sql_reference/functions/string_replace_functions.md b/docs/fa/sql_reference/functions/string_replace_functions.md deleted file mode 100644 index 311c89c9a45..00000000000 --- a/docs/fa/sql_reference/functions/string_replace_functions.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 42 -toc_title: "\u0628\u0631\u0627\u06CC \u062C\u0627\u06CC\u06AF\u0632\u06CC\u0646\u06CC\ - \ \u062F\u0631 \u0631\u0634\u062A\u0647\u0647\u0627" ---- - -# توابع برای جستجو و جایگزینی در رشته ها {#functions-for-searching-and-replacing-in-strings} - -## جایگزینی جایگزین) {#replaceonehaystack-pattern-replacement} - -جایگزین وقوع اول, در صورت وجود, از ‘pattern’ زیر رشته در ‘haystack’ با ‘replacement’ زیر رشته. -از این پس, ‘pattern’ و ‘replacement’ حتما ثابته - -## replaceAll(haystack, الگوی جایگزینی) جایگزین(haystack, الگوی جایگزینی) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} - -جایگزین تمام اتفاقات ‘pattern’ زیر رشته در ‘haystack’ با ‘replacement’ زیر رشته. - -## جایگزین کردن الگوی جایگزین) {#replaceregexponehaystack-pattern-replacement} - -جایگزینی با استفاده از ‘pattern’ عبارت منظم. دوباره2 عبارت منظم. -جایگزین تنها وقوع اول, در صورت وجود. -یک الگو را می توان به عنوان ‘replacement’. این الگو می تواند شامل تعویض `\0-\9`. -جایگزینی `\0` شامل کل عبارت منظم. درحال جایگزینی `\1-\9` مربوط به زیرخط numbers.To استفاده از `\` شخصیت در قالب, فرار با استفاده از `\`. -همچنین در نظر داشته باشید که یک رشته تحت اللفظی نیاز به فرار اضافی نگه دارید. - -مثال 1. تبدیل تاریخ به فرمت امریکایی: - -``` sql -SELECT DISTINCT - EventDate, - replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res -FROM test.hits -LIMIT 7 -FORMAT TabSeparated -``` - -``` text -2014-03-17 03/17/2014 -2014-03-18 03/18/2014 -2014-03-19 03/19/2014 -2014-03-20 03/20/2014 -2014-03-21 03/21/2014 -2014-03-22 03/22/2014 -2014-03-23 03/23/2014 -``` - -مثال 2. کپی کردن یک رشته ده بار: - -``` sql -SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res -``` - -``` text -┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## جایگزین کردن الگوی جایگزین) {#replaceregexpallhaystack-pattern-replacement} - -این کار همان چیزی, اما جایگزین همه وقوع. مثال: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res -``` - -``` text -┌─res────────────────────────┐ -│ HHeelllloo,, WWoorrlldd!! │ -└────────────────────────────┘ -``` - -به عنوان یک استثنا, اگر یک عبارت منظم در زیر رشته خالی کار می کرد, جایگزینی بیش از یک بار ساخته شده است. -مثال: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res -``` - -``` text -┌─res─────────────────┐ -│ here: Hello, World! │ -└─────────────────────┘ -``` - -## سرویس پرداخت درونبرنامهای پلی) {#regexpquotemetas} - -تابع می افزاید: یک بک اسلش قبل از برخی از شخصیت های از پیش تعریف شده در رشته. -نویسههای از پیش تعریفشده: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, '\]', ‘?’, '\*‘,’+‘,’{‘,’:‘,’-'. -این اجرای کمی از دوباره متفاوت2::پاسخ2:: نقل قول. این فرار صفر بایت به عنوان \\ 0 بجای 00 و فرار شخصیت تنها مورد نیاز. -برای کسب اطلاعات بیشتر به لینک مراجعه کنید: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/fa/sql_reference/functions/string_search_functions.md b/docs/fa/sql_reference/functions/string_search_functions.md deleted file mode 100644 index 9c18958d48f..00000000000 --- a/docs/fa/sql_reference/functions/string_search_functions.md +++ /dev/null @@ -1,380 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 41 -toc_title: "\u0628\u0631\u0627\u06CC \u062C\u0633\u062A\u062C\u0648\u06CC \u0631\u0634\ - \u062A\u0647\u0647\u0627" ---- - -# توابع برای جستجوی رشته ها {#functions-for-searching-strings} - -جستجو به طور پیش فرض در تمام این توابع حساس به حروف است. انواع جداگانه ای برای جستجوی غیر حساس مورد وجود دارد. - -## موقعیت (انبار کاه, سوزن), تعیین محل (انبار کاه, سوزن) {#position} - -بازگرداندن موقعیت (به بایت) از رشته پیدا شده است در رشته, با شروع از 1. - -این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری تک بایت. اگر این فرض ملاقات کرد و یک شخصیت نمی تواند با استفاده از یک بایت تنها نشان داده شود, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو بایت نشان, این دو بایت و غیره استفاده. - -برای یک جستجو غیر حساس به حالت, استفاده از تابع [حساس به حالت](#positioncaseinsensitive). - -**نحو** - -``` sql -position(haystack, needle) -``` - -نام مستعار: `locate(haystack, needle)`. - -**پارامترها** - -- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). - -**مقادیر بازگشتی** - -- موقعیت شروع در بایت (شمارش از 1), اگر زیر رشته پیدا شد. -- 0, اگر زیر رشته یافت نشد. - -نوع: `Integer`. - -**مثالها** - -عبارت “Hello, world!” شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری تک بایت. تابع بازده برخی از نتیجه انتظار می رود: - -پرسوجو: - -``` sql -SELECT position('Hello, world!', '!') -``` - -نتیجه: - -``` text -┌─position('Hello, world!', '!')─┐ -│ 13 │ -└────────────────────────────────┘ -``` - -همان عبارت در روسیه شامل شخصیت های که نمی تواند با استفاده از یک بایت نشان داده شود. تابع بازده برخی از نتیجه غیر منتظره (استفاده [موقعیت 8](#positionutf8) تابع برای متن چند بایت کد گذاری): - -پرسوجو: - -``` sql -SELECT position('Привет, мир!', '!') -``` - -نتیجه: - -``` text -┌─position('Привет, мир!', '!')─┐ -│ 21 │ -└───────────────────────────────┘ -``` - -## حساس به حالت {#positioncaseinsensitive} - -همان [موقعیت](#position) بازگرداندن موقعیت (به بایت) از رشته پیدا شده است در رشته, با شروع از 1. استفاده از تابع برای یک جستجو غیر حساس به حالت. - -این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری تک بایت. اگر این فرض ملاقات کرد و یک شخصیت نمی تواند با استفاده از یک بایت تنها نشان داده شود, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو بایت نشان, این دو بایت و غیره استفاده. - -**نحو** - -``` sql -positionCaseInsensitive(haystack, needle) -``` - -**پارامترها** - -- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). - -**مقادیر بازگشتی** - -- موقعیت شروع در بایت (شمارش از 1), اگر زیر رشته پیدا شد. -- 0, اگر زیر رشته یافت نشد. - -نوع: `Integer`. - -**مثال** - -پرسوجو: - -``` sql -SELECT positionCaseInsensitive('Hello, world!', 'hello') -``` - -نتیجه: - -``` text -┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ -│ 1 │ -└───────────────────────────────────────────────────┘ -``` - -## موقعیت 8 {#positionutf8} - -بازگرداندن موقعیت (در نقاط یونیکد) از رشته پیدا شده است در رشته, با شروع از 1. - -این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری شده وزارت مخابرات 8. اگر این فرض ملاقات نمی, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو نقطه یونیکد نشان, این دو و غیره استفاده. - -برای یک جستجو غیر حساس به حالت, استفاده از تابع [در حال بارگذاری](#positioncaseinsensitiveutf8). - -**نحو** - -``` sql -positionUTF8(haystack, needle) -``` - -**پارامترها** - -- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). - -**مقادیر بازگشتی** - -- موقعیت شروع در یونیکد امتیاز (شمارش از 1), اگر زیر رشته پیدا شد. -- 0, اگر زیر رشته یافت نشد. - -نوع: `Integer`. - -**مثالها** - -عبارت “Hello, world!” در روسیه شامل مجموعه ای از نقاط یونیکد نمایندگی یک متن کد گذاری تک نقطه. تابع بازده برخی از نتیجه انتظار می رود: - -پرسوجو: - -``` sql -SELECT positionUTF8('Привет, мир!', '!') -``` - -نتیجه: - -``` text -┌─positionUTF8('Привет, мир!', '!')─┐ -│ 12 │ -└───────────────────────────────────┘ -``` - -عبارت “Salut, étudiante!”, جایی که شخصیت `é` می توان با استفاده از یک نقطه نشان داد (`U+00E9`) یا دو نقطه (`U+0065U+0301`) تابع را می توان بازگشت برخی از نتیجه غیر منتظره: - -پرسوجو برای نامه `é` که نشان داده شده است یک نقطه یونیکد `U+00E9`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -نتیجه: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 17 │ -└────────────────────────────────────────┘ -``` - -پرسوجو برای نامه `é` که به نمایندگی از دو نقطه یونیکد `U+0065U+0301`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -نتیجه: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 18 │ -└────────────────────────────────────────┘ -``` - -## در حال بارگذاری {#positioncaseinsensitiveutf8} - -همان [موقعیت 8](#positionutf8), اما غیر حساس به حروف است. بازگرداندن موقعیت (در نقاط یونیکد) از رشته پیدا شده است در رشته, با شروع از 1. - -این نسخهها کار میکند با این فرض که رشته شامل مجموعه ای از بایت به نمایندگی از یک متن کد گذاری شده وزارت مخابرات 8. اگر این فرض ملاقات نمی, تابع یک استثنا پرتاب نمی کند و برخی از نتیجه غیر منتظره را برمی گرداند. اگر شخصیت را می توان با استفاده از دو نقطه یونیکد نشان, این دو و غیره استفاده. - -**نحو** - -``` sql -positionCaseInsensitiveUTF8(haystack, needle) -``` - -**پارامترها** - -- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). - -**مقدار بازگشتی** - -- موقعیت شروع در یونیکد امتیاز (شمارش از 1), اگر زیر رشته پیدا شد. -- 0, اگر زیر رشته یافت نشد. - -نوع: `Integer`. - -**مثال** - -پرسوجو: - -``` sql -SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') -``` - -نتیجه: - -``` text -┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ -│ 9 │ -└────────────────────────────────────────────────────┘ -``` - -## چند ضلعی {#multisearchallpositions} - -همان [موقعیت](string_search_functions.md#position) اما بازگشت `Array` از موقعیت (به بایت) از بسترهای مربوطه موجود در رشته. موقعیت ها با شروع از نمایه 1. - -جستجو در دنباله ای از بایت بدون توجه به رمزگذاری رشته و میترا انجام می شود. - -- برای جستجو اسکی غیر حساس به حالت, استفاده از تابع `multiSearchAllPositionsCaseInsensitive`. -- برای جستجو در یوتف-8, استفاده از تابع [چند ضلعی پایگاه داده های8](#multiSearchAllPositionsUTF8). -- برای غیر حساس به حالت جستجو-8, استفاده از تابع چند تخصیص چندگانه 18. - -**نحو** - -``` sql -multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) -``` - -**پارامترها** - -- `haystack` — string, in which substring will to be searched. [رشته](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [رشته](../syntax.md#syntax-string-literal). - -**مقادیر بازگشتی** - -- مجموعه ای از موقعیت های شروع در بایت (شمارش از 1), اگر زیر رشته مربوطه پیدا شد و 0 اگر یافت نشد. - -**مثال** - -پرسوجو: - -``` sql -SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) -``` - -نتیجه: - -``` text -┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ -│ [0,13,0] │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## چند ضلعی پایگاه داده های8 {#multiSearchAllPositionsUTF8} - -ببینید `multiSearchAllPositions`. - -## ترکیب چندجفتاری (هیستک, \[سوزن1 سوزن2, …, needleنه\]) {#multisearchfirstposition} - -همان `position` اما بازده سمت چپ افست از رشته `haystack` که به برخی از سوزن همسان. - -برای یک جستجوی غیر حساس مورد و یا / و در توابع استفاده از فرمت جی تی اف 8 `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. - -## مقالههای جدید مرتبط با تحقیق این نویسنده1 سوزن2, …, needleنه\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} - -بازگرداندن شاخص `i` (شروع از 1) سوزن چپ پیدا شده استمن ... در رشته `haystack` و 0 در غیر این صورت. - -برای یک جستجوی غیر حساس مورد و یا / و در توابع استفاده از فرمت جی تی اف 8 `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. - -## مولسیرچانی (هیستک, \[سوزن1 سوزن2, …, needleنه\]) {#function-multisearchany} - -بازده 1, اگر حداقل یک سوزن رشتهمن ... مسابقات رشته `haystack` و 0 در غیر این صورت. - -برای یک جستجوی غیر حساس مورد و یا / و در توابع استفاده از فرمت جی تی اف 8 `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. - -!!! note "یادداشت" - در همه `multiSearch*` توابع تعداد سوزن ها باید کمتر از 2 باشد8 به دلیل مشخصات پیاده سازی. - -## همخوانی داشتن (کومه علف خشک, الگو) {#matchhaystack-pattern} - -بررسی اینکه رشته با `pattern` عبارت منظم. یک `re2` عبارت منظم. این [نحو](https://github.com/google/re2/wiki/Syntax) از `re2` عبارات منظم محدود تر از نحو عبارات منظم پرل است. - -بازده 0 اگر مطابقت ندارد, یا 1 اگر منطبق. - -توجه داشته باشید که نماد ممیز (`\`) برای فرار در عبارت منظم استفاده می شود. همان نماد برای فرار در لیتر رشته استفاده می شود. بنابراین به منظور فرار از نماد در یک عبارت منظم, شما باید دو بک اسلش ارسال (\\) در یک رشته تحت اللفظی. - -عبارت منظم با رشته کار می کند به عنوان اگر مجموعه ای از بایت است. عبارت منظم می تواند بایت پوچ نیست. -برای الگوهای به جستجو برای بسترهای در یک رشته, بهتر است به استفاده از مانند و یا ‘position’ از اونجایی که خیلی سریعتر کار میکنن - -## ملتمتچانی (کومه علف خشک, \[الگو1 الگو2, …, patternنه\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} - -همان `match`, اما بازده 0 اگر هیچ یک از عبارات منظم همسان و 1 اگر هر یک از الگوهای مسابقات. این استفاده می کند [hyperscan](https://github.com/intel/hyperscan) کتابخونه. برای الگوهای به جستجو بسترهای در یک رشته, بهتر است به استفاده از `multiSearchAny` چون خیلی سریعتر کار میکنه - -!!! note "یادداشت" - طول هر یک از `haystack` رشته باید کمتر از 2 باشد32 بایت در غیر این صورت استثنا پرتاب می شود. این محدودیت صورت می گیرد به دلیل hyperscan API. - -## مقالههای جدید مرتبط با تحقیق این نویسنده1 الگو2, …, patternنه\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} - -همان `multiMatchAny`, اما بازگرداندن هر شاخص که منطبق بر انبار کاه. - -## اطلاعات دقیق1 الگو2, …, patternنه\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} - -همان `multiMatchAny`, اما بازگرداندن مجموعه ای از تمام شاخص که مطابقت انبار کاه در هر سفارش. - -## چندبازیماتچانی (هیستک, فاصله, \[الگو1 الگو2, …, patternنه\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} - -همان `multiMatchAny`, اما بازده 1 اگر هر الگوی منطبق انبار کاه در یک ثابت [ویرایش فاصله](https://en.wikipedia.org/wiki/Edit_distance). این تابع نیز در حالت تجربی است و می تواند بسیار کند باشد. برای اطلاعات بیشتر نگاه کنید به [hyperscan مستندات](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). - -## چند شکلی (هیستاک, فاصله, \[الگو1 الگو2, …, patternنه\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} - -همان `multiFuzzyMatchAny`, اما می گرداند هر شاخص که منطبق بر انبار کاه در فاصله ویرایش ثابت. - -## بازهای چندگانه (انبار کاه, فاصله, \[الگو1 الگو2, …, patternنه\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} - -همان `multiFuzzyMatchAny`, اما بازگرداندن مجموعه ای از تمام شاخص در هر منظور که مطابقت با انبار کاه در فاصله ویرایش ثابت. - -!!! note "یادداشت" - `multiFuzzyMatch*` توابع از عبارات منظم یونایتد-8 پشتیبانی نمی کنند و چنین عبارات به عنوان بایت به دلیل محدودیت هیپراکسان درمان می شوند. - -!!! note "یادداشت" - برای خاموش کردن تمام توابع است که با استفاده از بیش از حد اسکان, استفاده از تنظیمات `SET allow_hyperscan = 0;`. - -## عصاره (انبار کاه, الگو) {#extracthaystack-pattern} - -عصاره یک قطعه از یک رشته با استفاده از یک عبارت منظم. اگر ‘haystack’ با ‘pattern’ عبارت منظم, یک رشته خالی بازگشته است. اگر عبارت منظم حاوی وسترن نیست, طول می کشد قطعه که منطبق بر کل عبارت منظم. در غیر این صورت قطعه ای را می گیرد که با اولین زیر دست ساز مطابقت دارد. - -## خارج تماس بگیرید) {#extractallhaystack-pattern} - -عصاره تمام قطعات از یک رشته با استفاده از یک عبارت منظم. اگر ‘haystack’ با ‘pattern’ عبارت منظم, یک رشته خالی بازگشته است. بازگرداندن مجموعه ای از رشته متشکل از تمام مسابقات به عبارت منظم. به طور کلی, رفتار همان است که ‘extract’ تابع (در آن طول می کشد برای اولین بار subpattern یا کل بیان اگر وجود ندارد subpattern). - -## مانند (کومه علف خشک, الگو), کومه علف خشک مانند اپراتور الگوی {#function-like} - -بررسی اینکه یک رشته منطبق یک عبارت ساده به طور منظم. -عبارت منظم می تواند حاوی متسیمبلس باشد `%` و `_`. - -`%` نشان می دهد هر مقدار از هر بایت (از جمله صفر شخصیت). - -`_` نشان می دهد هر یک بایت. - -از بک اسلش استفاده کنید (`\`) برای فرار از متسیمبلس . توجه داشته باشید در فرار در شرح ‘match’ تابع. - -برای عبارات منظم مانند `%needle%`, کد مطلوب تر است و کار می کند به همان سرعتی که `position` تابع. -برای دیگر عبارات منظم, کد همان است که برای است ‘match’ تابع. - -## notLike(انبار کاه pattern), انبار کاه نیست مانند الگوی اپراتور {#function-notlike} - -همان چیزی که به عنوان ‘like’, اما منفی. - -## نمک زدایی (انبار کاه, سوزن) {#ngramdistancehaystack-needle} - -محاسبه فاصله 4 گرم بین `haystack` و `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` یا `haystack` بیش از 32 کیلوبایت است, می اندازد یک استثنا. اگر برخی از غیر ثابت `haystack` یا `needle` رشته ها بیش از 32 کیلوبایت, فاصله است که همیشه یکی. - -برای جستجوی غیر حساس به حالت یا / و در توابع استفاده از فرمت جی تی اف 8 `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. - -## نگراماسراچ (هیستک سوزن) {#ngramsearchhaystack-needle} - -مثل `ngramDistance` اما محاسبه تفاوت غیر متقارن بین `needle` و `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` مامان بزرگ نزدیک تر به یک, بیشتر احتمال دارد `needle` در `haystack`. می تواند برای جستجو رشته فازی مفید باشد. - -برای جستجوی غیر حساس به حالت یا / و در توابع استفاده از فرمت جی تی اف 8 `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. - -!!! note "یادداشت" - For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/fa/sql_reference/functions/type_conversion_functions.md b/docs/fa/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index ed3c83b3031..00000000000 --- a/docs/fa/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,534 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: "\u062A\u0628\u062F\u06CC\u0644 \u0646\u0648\u0639" ---- - -# توابع تبدیل نوع {#type-conversion-functions} - -## مشکلات متداول تبدیل عددی {#numeric-conversion-issues} - -هنگامی که شما یک مقدار تبدیل از یک به نوع داده های دیگر, شما باید به یاد داشته باشید که در مورد مشترک, این یک عملیات نا امن است که می تواند به از دست دادن داده ها منجر شود. از دست دادن داده ها می تواند رخ دهد اگر شما سعی می کنید به جا ارزش از یک نوع داده بزرگتر به یک نوع داده کوچکتر, و یا اگر شما ارزش بین انواع داده های مختلف تبدیل. - -کلیک کرده است [همان رفتار به عنوان ج++ برنامه](https://en.cppreference.com/w/cpp/language/implicit_conversion). - -## toInt(8/16/32/64) {#toint8163264} - -تبدیل یک مقدار ورودی به [Int](../../sql_reference/data_types/int_uint.md) نوع داده. این خانواده تابع شامل: - -- `toInt8(expr)` — Results in the `Int8` نوع داده. -- `toInt16(expr)` — Results in the `Int16` نوع داده. -- `toInt32(expr)` — Results in the `Int32` نوع داده. -- `toInt64(expr)` — Results in the `Int64` نوع داده. - -**پارامترها** - -- `expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد یا یک رشته با نمایش اعشاری یک عدد. دودویی, مبنای هشت, و بازنمایی هگزادسیمال از اعداد پشتیبانی نمی شوند. صفر منجر محروم هستند. - -**مقدار بازگشتی** - -مقدار صحیح در `Int8`, `Int16`, `Int32` یا `Int64` نوع داده. - -توابع استفاده [گرد کردن به سمت صفر](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) یعنی عدد کسری از اعداد را کوتاه می کنند. - -رفتار توابع برای [هشدار داده می شود](../../sql_reference/data_types/float.md#data_type-float-nan-inf) استدلال تعریف نشده است. به یاد داشته باشید در مورد [مسایل همگرایی عددی](#numeric-conversion-issues), هنگام استفاده از توابع. - -**مثال** - -``` sql -SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) -``` - -``` text -┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ -│ -9223372036854775808 │ 32 │ 16 │ 8 │ -└──────────────────────┴─────────────┴───────────────┴─────────────┘ -``` - -## toInt(8/16/32/64)OrZero {#toint8163264orzero} - -این استدلال از نوع رشته طول می کشد و تلاش می کند تا به اعضای هیات تجزیه (8 \| 16 \| 32 \| 64). اگر شکست خورده, بازده 0. - -**مثال** - -``` sql -select toInt64OrZero('123123'), toInt8OrZero('123qwe123') -``` - -``` text -┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ -│ 123123 │ 0 │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toInt(8/16/32/64)OrNull {#toint8163264ornull} - -این استدلال از نوع رشته طول می کشد و تلاش می کند تا به اعضای هیات تجزیه (8 \| 16 \| 32 \| 64). اگر شکست خورده, تهی گرداند. - -**مثال** - -``` sql -select toInt64OrNull('123123'), toInt8OrNull('123qwe123') -``` - -``` text -┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ -│ 123123 │ ᴺᵁᴸᴸ │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toUInt(8/16/32/64) {#touint8163264} - -تبدیل یک مقدار ورودی به [اینترنت](../../sql_reference/data_types/int_uint.md) نوع داده. این خانواده تابع شامل: - -- `toUInt8(expr)` — Results in the `UInt8` نوع داده. -- `toUInt16(expr)` — Results in the `UInt16` نوع داده. -- `toUInt32(expr)` — Results in the `UInt32` نوع داده. -- `toUInt64(expr)` — Results in the `UInt64` نوع داده. - -**پارامترها** - -- `expr` — [عبارت](../syntax.md#syntax-expressions) بازگشت یک عدد یا یک رشته با نمایش اعشاری یک عدد. دودویی, مبنای هشت, و بازنمایی هگزادسیمال از اعداد پشتیبانی نمی شوند. صفر منجر محروم هستند. - -**مقدار بازگشتی** - -مقدار صحیح در `UInt8`, `UInt16`, `UInt32` یا `UInt64` نوع داده. - -توابع استفاده [گرد کردن به سمت صفر](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) یعنی عدد کسری از اعداد را کوتاه می کنند. - -رفتار توابع برای کشاورزی منفی و برای [هشدار داده می شود](../../sql_reference/data_types/float.md#data_type-float-nan-inf) استدلال تعریف نشده است. اگر شما یک رشته عبور با تعداد منفی, مثلا `'-32'`, خانه را افزایش می دهد یک استثنا. به یاد داشته باشید در مورد [مسایل همگرایی عددی](#numeric-conversion-issues), هنگام استفاده از توابع. - -**مثال** - -``` sql -SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) -``` - -``` text -┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ -│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ -└─────────────────────┴───────────────┴────────────────┴──────────────┘ -``` - -## toUInt(8/16/32/64)OrZero {#touint8163264orzero} - -## toUInt(8/16/32/64)OrNull {#touint8163264ornull} - -## توفلوات (32/64) {#tofloat3264} - -## toFloat(32/64)OrZero {#tofloat3264orzero} - -## toFloat(32/64)OrNull {#tofloat3264ornull} - -## toDate {#todate} - -## تودارزرو {#todateorzero} - -## طول عمر {#todateornull} - -## toDateTime {#todatetime} - -## به اندازه تو {#todatetimeorzero} - -## طول عمر ترنول {#todatetimeornull} - -## toDecimal(32/64/128) {#todecimal3264128} - -تبدیل `value` به [دهدهی](../../sql_reference/data_types/decimal.md) نوع داده با دقت `S`. این `value` می تواند یک عدد یا یک رشته. این `S` (مقیاس) پارامتر تعداد رقم اعشار را مشخص می کند. - -- `toDecimal32(value, S)` -- `toDecimal64(value, S)` -- `toDecimal128(value, S)` - -## toDecimal(32/64/128)OrNull {#todecimal3264128ornull} - -تبدیل یک رشته ورودی به یک [Nullable(اعشاری(P,S))](../../sql_reference/data_types/decimal.md) مقدار نوع داده. این خانواده از توابع عبارتند از: - -- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` نوع داده. -- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` نوع داده. -- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` نوع داده. - -این توابع باید به جای استفاده `toDecimal*()` توابع, اگر شما ترجیح می دهید برای دریافت یک `NULL` ارزش به جای یک استثنا در صورت خطا تجزیه ارزش ورودی. - -**پارامترها** - -- `expr` — [عبارت](../syntax.md#syntax-expressions), بازگرداندن یک مقدار در [رشته](../../sql_reference/data_types/string.md) نوع داده. تاتر انتظار نمایندگی متنی از عدد اعشاری. به عنوان مثال, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**مقدار بازگشتی** - -یک مقدار در `Nullable(Decimal(P,S))` نوع داده. مقدار شامل: - -- شماره با `S` اعشار, اگر تاتر تفسیر رشته ورودی به عنوان یک عدد. -- `NULL`, اگر تاتر می توانید رشته ورودی به عنوان یک عدد تفسیر نمی کند و یا اگر تعداد ورودی شامل بیش از `S` رقم اعشار. - -**مثالها** - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ -│ -1.11100 │ Nullable(Decimal(9, 5)) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ -│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toDecimal(32/64/128)OrZero {#todecimal3264128orzero} - -تبدیل یک مقدار ورودی به [دهدهی)](../../sql_reference/data_types/decimal.md) نوع داده. این خانواده از توابع عبارتند از: - -- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` نوع داده. -- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` نوع داده. -- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` نوع داده. - -این توابع باید به جای استفاده `toDecimal*()` توابع, اگر شما ترجیح می دهید برای دریافت یک `0` ارزش به جای یک استثنا در صورت خطا تجزیه ارزش ورودی. - -**پارامترها** - -- `expr` — [عبارت](../syntax.md#syntax-expressions), بازگرداندن یک مقدار در [رشته](../../sql_reference/data_types/string.md) نوع داده. تاتر انتظار نمایندگی متنی از عدد اعشاری. به عنوان مثال, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**مقدار بازگشتی** - -یک مقدار در `Nullable(Decimal(P,S))` نوع داده. مقدار شامل: - -- شماره با `S` اعشار, اگر تاتر تفسیر رشته ورودی به عنوان یک عدد. -- 0 با `S` رقم اعشار, اگر تاتر می توانید رشته ورودی به عنوان یک عدد تفسیر نمی کند و یا اگر تعداد ورودی شامل بیش از `S` رقم اعشار. - -**مثال** - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ -│ -1.11100 │ Decimal(9, 5) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ -│ 0.00 │ Decimal(9, 2) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toString {#tostring} - -توابع برای تبدیل بین اعداد, رشته ها (اما رشته ثابت نیست), تاریخ, و تاریخ با زمان. -همه این توابع قبول یک استدلال. - -در هنگام تبدیل به و یا از یک رشته, ارزش فرمت شده و یا تجزیه با استفاده از قوانین مشابه برای فرمت جدولبندیشده (و تقریبا تمام فرمت های متنی دیگر). اگر رشته را نمی توان تجزیه, یک استثنا پرتاب می شود و درخواست لغو شده است. - -هنگام تبدیل تاریخ به اعداد و یا بالعکس, تاریخ مربوط به تعداد روز از ابتدای عصر یونیکس. -هنگام تبدیل تاریخ با بار به اعداد و یا بالعکس, تاریخ با زمان مربوط به تعداد ثانیه از ابتدای عصر یونیکس. - -تاریخ و تاریخ-با-فرمت زمان برای todate/todatetime توابع تعریف شده به شرح زیر است: - -``` text -YYYY-MM-DD -YYYY-MM-DD hh:mm:ss -``` - -به عنوان یک استثنا اگر تبدیل از uint32, int32, uint64 یا int64 عددی انواع, به, تاریخ, و اگر عدد بزرگتر یا مساوی به 65536 تعدادی را به عنوان تفسیر یک زمان یونیکس (و نه به عنوان تعداد روز) و گرد است به تاریخ. این اجازه می دهد تا پشتیبانی از وقوع مشترک نوشتن ‘toDate(unix\_timestamp)’ که در غیر این صورت یک خطا خواهد بود و نیاز به نوشتن بیشتر دست و پا گیر ‘toDate(toDateTime(unix\_timestamp))’. - -تبدیل بین تاریخ و تاریخ با زمان انجام شده است راه طبیعی: با اضافه کردن یک زمان خالی و یا حذف زمان. - -تبدیل بین انواع عددی با استفاده از قوانین مشابه به عنوان تکالیف بین انواع مختلف عددی در ج++. - -علاوه بر این, تابع حول از استدلال حسگر ناحیه رنگی می توانید یک استدلال رشته دوم حاوی نام منطقه زمانی را. مثال: `Asia/Yekaterinburg` در این مورد, زمان با توجه به منطقه زمانی مشخص فرمت. - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - -``` text -┌───────────now_local─┬─now_yekat───────────┐ -│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ -└─────────────────────┴─────────────────────┘ -``` - -همچنین `toUnixTimestamp` تابع. - -## وضعیت زیستشناختی رکورد) {#tofixedstrings-n} - -تبدیل یک استدلال نوع رشته به یک رشته (نفر) نوع (یک رشته با طول ثابت نفر). نفر باید ثابت باشد. -اگر رشته دارای بایت کمتر از نفر, این است که با بایت پوچ به سمت راست منتقل. اگر رشته دارای بایت بیش از نفر, یک استثنا پرتاب می شود. - -## در حال بارگذاری) {#tostringcuttozeros} - -می پذیرد یک رشته یا رشته ثابت استدلال. بازگرداندن رشته با محتوای کوتاه در اولین صفر بایت پیدا شده است. - -مثال: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s─────────────┬─s_cut─┐ -│ foo\0\0\0\0\0 │ foo │ -└───────────────┴───────┘ -``` - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s──────────┬─s_cut─┐ -│ foo\0bar\0 │ foo │ -└────────────┴───────┘ -``` - -## reinterpretAsUInt(8/16/32/64) {#reinterpretasuint8163264} - -## reinterpretAsInt(8/16/32/64) {#reinterpretasint8163264} - -## تفسیر مجدد (32/64) {#reinterpretasfloat3264} - -## بازخوانی مجدد {#reinterpretasdate} - -## حسگر ناحیه رنگی {#reinterpretasdatetime} - -این توابع یک رشته را قبول می کنند و بایت هایی را که در ابتدای رشته قرار می گیرند به عنوان یک عدد در دستور میزبان (اندی کوچک) تفسیر می کنند. اگر رشته به اندازه کافی بلند نیست, توابع کار به عنوان اگر رشته با تعداد لازم از بایت پوچ خالی. اگر رشته طولانی تر از مورد نیاز است, بایت اضافی نادیده گرفته می شوند. تاریخ به عنوان تعداد روز از ابتدای عصر یونیکس تفسیر و تاریخ با زمان به عنوان تعداد ثانیه از ابتدای عصر یونیکس تفسیر شده است. - -## رشته مجدد {#type_conversion_functions-reinterpretAsString} - -این تابع یک شماره یا تاریخ و یا تاریخ با زمان می پذیرد, و یک رشته حاوی بایت به نمایندگی از ارزش مربوطه را در سفارش میزبان را برمی گرداند (اندی کمی). بایت پوچ از پایان کاهش یافته است. مثلا, ارزش نوع اوینت32 255 یک رشته است که یک بایت طولانی است. - -## رشته مجدد {#reinterpretasfixedstring} - -این تابع یک شماره یا تاریخ و یا تاریخ با زمان می پذیرد, و یک رشته ثابت حاوی بایت به نمایندگی از ارزش مربوطه را در سفارش میزبان را برمی گرداند (اندی کمی). بایت پوچ از پایان کاهش یافته است. مثلا, ارزش نوع اوینت32 255 رشته ثابت است که یک بایت طولانی است. - -## قالب (ایکس تی) {#type_conversion_function-cast} - -تبدیل ‘x’ به ‘t’ نوع داده. بازیگران نحو (ایکس به عنوان تی) نیز پشتیبانی می کند. - -مثال: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - -``` text -┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ -└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ -``` - -تبدیل به fixedstring(n) تنها با این نسخهها کار برای استدلال از نوع string یا fixedstring(n). - -تبدیل نوع به [Nullable](../../sql_reference/data_types/nullable.md) و پشت پشتیبانی می شود. مثال: - -``` sql -SELECT toTypeName(x) FROM t_null -``` - -``` text -┌─toTypeName(x)─┐ -│ Int8 │ -│ Int8 │ -└───────────────┘ -``` - -``` sql -SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null -``` - -``` text -┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ -│ Nullable(UInt16) │ -│ Nullable(UInt16) │ -└─────────────────────────────────────────┘ -``` - -## توینتال (سال / سه ماهه / ماه / هفته / روز / ساعت / دقیقه / ثانیه) {#function-tointerval} - -تبدیل یک استدلال نوع شماره به یک [فاصله](../../sql_reference/data_types/special_data_types/interval.md) نوع داده. - -**نحو** - -``` sql -toIntervalSecond(number) -toIntervalMinute(number) -toIntervalHour(number) -toIntervalDay(number) -toIntervalWeek(number) -toIntervalMonth(number) -toIntervalQuarter(number) -toIntervalYear(number) -``` - -**پارامترها** - -- `number` — Duration of interval. Positive integer number. - -**مقادیر بازگشتی** - -- مقدار در `Interval` نوع داده. - -**مثال** - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - -``` text -┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ -│ 2019-01-08 │ 2019-01-08 │ -└───────────────────────────┴──────────────────────────────┘ -``` - -## پردازش زمان {#parsedatetimebesteffort} - -تبدیل یک تاریخ و زمان در [رشته](../../sql_reference/data_types/string.md) نمایندگی به [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) نوع داده. - -تابع تجزیه می کند [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [1123-5.2.14 تومان-822 تاریخ و زمان مشخصات](https://tools.ietf.org/html/rfc1123#page-55), را کلیک کنید و برخی از فرمت های تاریخ و زمان دیگر. - -**نحو** - -``` sql -parseDateTimeBestEffort(time_string [, time_zone]); -``` - -**پارامترها** - -- `time_string` — String containing a date and time to convert. [رشته](../../sql_reference/data_types/string.md). -- `time_zone` — Time zone. The function parses `time_string` با توجه به منطقه زمانی. [رشته](../../sql_reference/data_types/string.md). - -**فرمت های غیر استاندارد پشتیبانی شده** - -- یک رشته حاوی 9..10 رقمی [برچسب زمان یونیکس](https://en.wikipedia.org/wiki/Unix_time). -- یک رشته با یک تاریخ و یک مولفه زمان: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, و غیره. -- یک رشته با یک تاریخ, اما هیچ مولفه زمان: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` و غیره -- یک رشته با یک روز و زمان: `DD`, `DD hh`, `DD hh:mm`. در این مورد `YYYY-MM` به عنوان جایگزین `2000-01`. -- یک رشته است که شامل تاریخ و زمان همراه با منطقه زمانی اطلاعات افست: `YYYY-MM-DD hh:mm:ss ±h:mm`, و غیره. به عنوان مثال, `2020-12-12 17:36:00 -5:00`. - -برای همه فرمت های با جدا تابع تجزیه نام ماه بیان شده توسط نام کامل خود و یا با سه حرف اول یک نام ماه. مثالها: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. - -**مقدار بازگشتی** - -- `time_string` تبدیل به `DateTime` نوع داده. - -**مثالها** - -پرسوجو: - -``` sql -SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') -AS parseDateTimeBestEffort; -``` - -نتیجه: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2020-12-12 12:12:57 │ -└─────────────────────────┘ -``` - -پرسوجو: - -``` sql -SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') -AS parseDateTimeBestEffort -``` - -نتیجه: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-08-18 10:22:16 │ -└─────────────────────────┘ -``` - -پرسوجو: - -``` sql -SELECT parseDateTimeBestEffort('1284101485') -AS parseDateTimeBestEffort -``` - -نتیجه: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2015-07-07 12:04:41 │ -└─────────────────────────┘ -``` - -پرسوجو: - -``` sql -SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') -AS parseDateTimeBestEffort -``` - -نتیجه: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-12-12 10:12:12 │ -└─────────────────────────┘ -``` - -پرسوجو: - -``` sql -SELECT parseDateTimeBestEffort('10 20:19') -``` - -نتیجه: - -``` text -┌─parseDateTimeBestEffort('10 20:19')─┐ -│ 2000-01-10 20:19:00 │ -└─────────────────────────────────────┘ -``` - -**همچنین نگاه کنید** - -- \[ISO 8601 announcement by @xkcd\])https://xkcd.com/1179/) -- [RFC 1123](https://tools.ietf.org/html/rfc1123) -- [toDate](#todate) -- [toDateTime](#todatetime) - -## - ترجمه نشده - {#parsedatetimebesteffortornull} - -همان است که برای [پردازش زمان](#parsedatetimebesteffort) با این تفاوت که وقتی با فرمت تاریخ مواجه می شود که نمی تواند پردازش شود تهی می شود. - -## - ترجمه نشده - {#parsedatetimebesteffortorzero} - -همان است که برای [پردازش زمان](#parsedatetimebesteffort) با این تفاوت که تاریخ صفر یا زمان صفر را باز می گرداند زمانی که یک فرمت تاریخ مواجه است که نمی تواند پردازش شود. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/fa/sql_reference/functions/url_functions.md b/docs/fa/sql_reference/functions/url_functions.md deleted file mode 100644 index d2a4e5589c6..00000000000 --- a/docs/fa/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u0646\u0634\u0627\u0646\u06CC\u0647\u0627\ \u06CC \u0627\u06CC\u0646\u062A\u0631\u0646\u062A\u06CC" ---- - -# توابع برای کار با نشانیهای اینترنتی {#functions-for-working-with-urls} - -همه این توابع را دنبال کنید. حداکثر برای بهبود عملکرد ساده شده اند. - -## توابع استخراج بخشهایی از نشانی وب {#functions-that-extract-parts-of-a-url} - -اگر قسمت مربوطه در نشانی وب وجود نداشته باشد یک رشته خالی برگردانده میشود. - -### قرارداد {#protocol} - -پروتکل را از نشانی اینترنتی خارج میکند. - -Examples of typical returned values: http, https, ftp, mailto, tel, magnet… - -### دامنه {#domain} - -نام میزبان را از یک نشانی اینترنتی استخراج می کند. - -``` sql -domain(url) -``` - -**پارامترها** - -- `url` — URL. Type: [رشته](../../sql_reference/data_types/string.md). - -نشانی وب را می توان با یا بدون یک طرح مشخص شده است. مثالها: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -برای این نمونه ها `domain` تابع نتایج زیر را برمی گرداند: - -``` text -some.svn-hosting.com -some.svn-hosting.com -yandex.com -``` - -**مقادیر بازگشتی** - -- نام میزبان. اگر کلیک هاوس می تواند رشته ورودی را به عنوان نشانی وب تجزیه کند. -- رشته خالی. اگر کلیکهاوس نمیتواند رشته ورودی را به عنوان نشانی وب تجزیه کند. - -نوع: `String`. - -**مثال** - -``` sql -SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ -│ some.svn-hosting.com │ -└────────────────────────────────────────────────────────┘ -``` - -### دامینویتهویتوو {#domainwithoutwww} - -بازگرداندن دامنه و حذف بیش از یک ‘www.’ اگه از اول شروع بشه - -### توپولدومین {#topleveldomain} - -عصاره این دامنه سطح بالا از یک url. - -``` sql -topLevelDomain(url) -``` - -**پارامترها** - -- `url` — URL. Type: [رشته](../../sql_reference/data_types/string.md). - -نشانی وب را می توان با یا بدون یک طرح مشخص شده است. مثالها: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -**مقادیر بازگشتی** - -- نام دامنه. اگر کلیک هاوس می تواند رشته ورودی را به عنوان نشانی وب تجزیه کند. -- رشته خالی. اگر کلیکهاوس نمیتواند رشته ورودی را به عنوان نشانی وب تجزیه کند. - -نوع: `String`. - -**مثال** - -``` sql -SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ -│ com │ -└────────────────────────────────────────────────────────────────────┘ -``` - -### در حال بارگذاری {#firstsignificantsubdomain} - -بازگرداندن “first significant subdomain”. این یک مفهوم غیر استاندارد خاص به یاندکس است.متریکا اولین زیر دامنه قابل توجهی یک دامنه سطح دوم است ‘com’, ‘net’, ‘org’ یا ‘co’. در غیر این صورت, این یک دامنه سطح سوم است. به عنوان مثال, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. فهرست “insignificant” دامنه های سطح دوم و سایر اطلاعات پیاده سازی ممکن است در اینده تغییر کند. - -### در حال بارگذاری {#cuttofirstsignificantsubdomain} - -بازگرداندن بخشی از دامنه است که شامل زیر دامنه سطح بالا تا “first significant subdomain” (توضیح بالا را ببینید). - -به عنوان مثال, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### مسیر {#path} - -مسیر را برمی گرداند. مثال: `/top/news.html` مسیر رشته پرس و جو را شامل نمی شود. - -### مسیر {#pathfull} - -همان بالا, اما از جمله رشته پرس و جو و قطعه. مثال:/بالا / اخبار.زنگامصفحه = 2 \# نظرات - -### رشته {#querystring} - -بازگرداندن رشته پرس و جو. مثال: صفحه=1&چاپی=213. پرس و جو رشته علامت سوال اولیه را شامل نمی شود, و همچنین \# و همه چیز بعد از \#. - -### قطعه {#fragment} - -بازگرداندن شناسه قطعه. قطعه می کند نماد هش اولیه را شامل نمی شود. - -### وضعیت زیستشناختی رکورد {#querystringandfragment} - -بازگرداندن رشته پرس و جو و شناسه قطعه. مثال: صفحه=1\#29390. - -### نام) {#extracturlparameterurl-name} - -بازگرداندن ارزش ‘name’ پارامتر در نشانی وب, در صورت وجود. در غیر این صورت, یک رشته خالی. اگر پارامترهای بسیاری با این نام وجود دارد, این اولین رخداد را برمی گرداند. این تابع با این فرض کار می کند که نام پارامتر در نشانی اینترنتی دقیقا به همان شیوه در استدلال گذشت کد گذاری شده است. - -### شمارش معکوس) {#extracturlparametersurl} - -مجموعه ای از نام=رشته ارزش مربوط به پارامترهای نشانی وب را برمی گرداند. ارزش ها به هیچ وجه رمزگشایی نمی. - -### extractURLParameterNames(URL) {#extracturlparameternamesurl} - -مجموعه ای از نام رشته های مربوط به نام پارامترهای نشانی وب را باز می گرداند. ارزش ها به هیچ وجه رمزگشایی نمی. - -### URLHierarchy(URL) {#urlhierarchyurl} - -را برمی گرداند مجموعه ای حاوی نشانی اینترنتی, کوتاه در پایان توسط علامت /,? در مسیر و پرس و جو-رشته. کاراکتر جداکننده متوالی به عنوان یکی شمارش می شود. برش در موقعیت بعد از تمام کاراکتر جدا متوالی ساخته شده است. - -### URLPathHierarchy(URL) {#urlpathhierarchyurl} - -همانطور که در بالا, اما بدون پروتکل و میزبان در نتیجه. / عنصر (ریشه) گنجانده نشده است. به عنوان مثال: تابع استفاده می شود برای پیاده سازی درخت گزارش نشانی اینترنتی در یاندکس. متریک. - -``` text -URLPathHierarchy('https://example.com/browse/CONV-6788') = -[ - '/browse/', - '/browse/CONV-6788' -] -``` - -### نما & نشانی وب) {#decodeurlcomponenturl} - -را برمی گرداند نشانی اینترنتی رمزگشایی. -مثال: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - -``` text -┌─DecodedURL─────────────────────────────┐ -│ http://127.0.0.1:8123/?query=SELECT 1; │ -└────────────────────────────────────────┘ -``` - -## توابع که حذف بخشی از یک نشانی وب. {#functions-that-remove-part-of-a-url} - -اگر نشانی وب هیچ چیز مشابه ندارد, نشانی اینترنتی بدون تغییر باقی می ماند. - -### بریدن {#cutwww} - -حذف بیش از یک ‘www.’ از ابتدای دامنه نشانی اینترنتی در صورت وجود. - -### & رشته {#cutquerystring} - -حذف رشته پرس و جو. علامت سوال نیز حذف شده است. - -### تقسیم {#cutfragment} - -حذف شناسه قطعه. علامت شماره نیز حذف شده است. - -### هشدار داده می شود {#cutquerystringandfragment} - -حذف رشته پرس و جو و شناسه قطعه. علامت سوال و علامت شماره نیز حذف شده است. - -### cutURLParameter(URL, نام) {#cuturlparameterurl-name} - -حذف ‘name’ پارامتر نشانی وب, در صورت وجود. این تابع با این فرض کار می کند که نام پارامتر در نشانی اینترنتی دقیقا به همان شیوه در استدلال گذشت کد گذاری شده است. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/fa/sql_reference/functions/uuid_functions.md b/docs/fa/sql_reference/functions/uuid_functions.md deleted file mode 100644 index d4c6f325b06..00000000000 --- a/docs/fa/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 53 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u06CC\u0648\u06CC\u062F" ---- - -# توابع برای کار با یوید {#functions-for-working-with-uuid} - -توابع برای کار با شناسه به شرح زیر است. - -## جنراتیدو4 {#uuid-function-generate} - -تولید [UUID](../../sql_reference/data_types/uuid.md) از [نسخه 4](https://tools.ietf.org/html/rfc4122#section-4.4). - -``` sql -generateUUIDv4() -``` - -**مقدار بازگشتی** - -مقدار نوع شناسه. - -**مثال طریقه استفاده** - -این مثال نشان می دهد ایجاد یک جدول با ستون نوع شناسه و قرار دادن یک مقدار به جدول. - -``` sql -CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -INSERT INTO t_uuid SELECT generateUUIDv4() - -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## شناسه بسته:) {#touuid-x} - -تبدیل مقدار نوع رشته به نوع شناسه. - -``` sql -toUUID(String) -``` - -**مقدار بازگشتی** - -این uuid نوع ارزش است. - -**مثال طریقه استفاده** - -``` sql -SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid -``` - -``` text -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## وضعیت زیستشناختی رکورد {#uuidstringtonum} - -می پذیرد یک رشته حاوی 36 کاراکتر در قالب `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` و به عنوان مجموعه ای از بایت ها در یک [رشته ثابت (16)](../../sql_reference/data_types/fixedstring.md). - -``` sql -UUIDStringToNum(String) -``` - -**مقدار بازگشتی** - -رشته ثابت (16) - -**نمونه های استفاده** - -``` sql -SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes -``` - -``` text -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## هشدار داده می شود {#uuidnumtostring} - -می پذیرد [رشته ثابت (16)](../../sql_reference/data_types/fixedstring.md) ارزش, و یک رشته حاوی گرداند 36 شخصیت در قالب متن. - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**مقدار بازگشتی** - -رشته. - -**مثال طریقه استفاده** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid -``` - -``` text -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## همچنین نگاه کنید به {#see-also} - -- [دیکتاتوری](ext_dict_functions.md#ext_dict_functions-other) - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/fa/sql_reference/functions/ym_dict_functions.md b/docs/fa/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index 25a31cd1020..00000000000 --- a/docs/fa/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 59 -toc_title: "\u06A9\u0627\u0631 \u0628\u0627 \u06CC\u0627\u0646\u062F\u06A9\u0633.\u0648\ - \u0627\u0698\u0647\u0646\u0627\u0645\u0647\u0647\u0627 \u0645\u062A\u0631\u06CC\u06A9\ - \u0627" ---- - -# توابع برای کار با یاندکس.واژهنامهها متریکا {#functions-for-working-with-yandex-metrica-dictionaries} - -به منظور توابع زیر به کار پیکربندی سرور باید مشخص مسیر و نشانی برای گرفتن تمام یاندکس.واژهنامهها متریکا. لغت نامه ها در اولین تماس از هر یک از این توابع لود می شود. اگر لیست مرجع نمی تواند لود شود, یک استثنا پرتاب می شود. - -برای اطلاعات در مورد ایجاد لیست مرجع, بخش را ببینید “Dictionaries”. - -## موقعیت جغرافیایی چندگانه {#multiple-geobases} - -ClickHouse پشتیبانی از کار با چند جایگزین geobases (منطقه ای سلسله مراتب) به طور همزمان به منظور حمایت از دیدگاه های مختلف که در آن کشورهای خاص مناطق متعلق به. - -این ‘clickhouse-server’ پیکربندی فایل را با سلسله مراتب منطقه ای مشخص می کند::`/opt/geo/regions_hierarchy.txt` - -علاوه بر این فایل, همچنین برای فایل های جستجو در این نزدیکی هست که نماد \_ و هر پسوند اضافه به نام (قبل از پسوند فایل). -مثلا, همچنین فایل را پیدا خواهد کرد `/opt/geo/regions_hierarchy_ua.txt`, اگر در حال حاضر. - -`ua` کلید فرهنگ لغت نامیده می شود. برای یک فرهنگ لغت بدون پسوند, کلید یک رشته خالی است. - -تمام واژهنامهها دوباره لود شده در زمان اجرا (یک بار در هر تعداد معینی از ثانیه, همانطور که در دستور داخلی تعریف شده \_فرهنگ\_ پارامتر پیکربندی, و یا یک بار در ساعت به طور پیش فرض). با این حال, لیست لغت نامه های موجود تعریف شده است یک بار, زمانی که سرور شروع می شود. - -All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. -مثال: - -``` sql -regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt -``` - -### regionToCity(id\[, geobase\]) {#regiontocityid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. - -### regionToArea(id\[, geobase\]) {#regiontoareaid-geobase} - -تبدیل یک منطقه به یک منطقه (نوع 5 در پایگاه داده). در هر راه دیگر, این تابع همان است که ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ -│ │ -│ Moscow and Moscow region │ -│ St. Petersburg and Leningrad region │ -│ Belgorod region │ -│ Ivanovsk region │ -│ Kaluga region │ -│ Kostroma region │ -│ Kursk region │ -│ Lipetsk region │ -│ Orlov region │ -│ Ryazan region │ -│ Smolensk region │ -│ Tambov region │ -│ Tver region │ -│ Tula region │ -└──────────────────────────────────────────────────────┘ -``` - -### regionToDistrict(id\[, geobase\]) {#regiontodistrictid-geobase} - -تبدیل یک منطقه به یک منطقه فدرال (نوع 4 در پایگاه داده). در هر راه دیگر, این تابع همان است که ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ -│ │ -│ Central federal district │ -│ Northwest federal district │ -│ South federal district │ -│ North Caucases federal district │ -│ Privolga federal district │ -│ Ural federal district │ -│ Siberian federal district │ -│ Far East federal district │ -│ Scotland │ -│ Faroe Islands │ -│ Flemish region │ -│ Brussels capital region │ -│ Wallonia │ -│ Federation of Bosnia and Herzegovina │ -└──────────────────────────────────────────────────────────┘ -``` - -### regionToCountry(id\[, geobase\]) {#regiontocountryid-geobase} - -تبدیل یک منطقه به یک کشور. در هر راه دیگر, این تابع همان است که ‘regionToCity’. -مثال: `regionToCountry(toUInt32(213)) = 225` تبدیل مسکو (213) به روسیه (225). - -### regionToContinent(id\[, geobase\]) {#regiontocontinentid-geobase} - -تبدیل یک منطقه به یک قاره. در هر راه دیگر, این تابع همان است که ‘regionToCity’. -مثال: `regionToContinent(toUInt32(213)) = 10001` تبدیل مسکو (213) به اوراسیا (10001). - -### نقلقولهای جدید از این نویسنده) {#regiontotopcontinent-regiontotopcontinent} - -بالاترین قاره را در سلسله مراتب منطقه پیدا می کند. - -**نحو** - -``` sql -regionToTopContinent(id[, geobase]); -``` - -**پارامترها** - -- `id` — Region ID from the Yandex geobase. [UInt32](../../sql_reference/data_types/int_uint.md). -- `geobase` — Dictionary key. See [موقعیت جغرافیایی چندگانه](#multiple-geobases). [رشته](../../sql_reference/data_types/string.md). اختیاری. - -**مقدار بازگشتی** - -- شناسه قاره سطح بالا (دومی زمانی که شما صعود سلسله مراتب مناطق). -- 0, اگر هیچ کدام وجود دارد. - -نوع: `UInt32`. - -### regionToPopulation(id\[, geobase\]) {#regiontopopulationid-geobase} - -می شود جمعیت برای یک منطقه. -جمعیت را می توان در فایل های با پایگاه داده ثبت شده است. بخش را ببینید “External dictionaries”. -اگر جمعیت برای منطقه ثبت نشده, باز می گردد 0. -در یاندکس پایگاه جغرافیایی, جمعیت ممکن است برای مناطق کودک ثبت, اما نه برای مناطق پدر و مادر. - -### regionIn(lhs, rhs\[, geobase\]) {#regioninlhs-rhs-geobase} - -بررسی اینکه یک ‘lhs’ منطقه متعلق به ‘rhs’ منطقه. بازگرداندن یک عدد 18 برابر 1 اگر متعلق, یا 0 اگر تعلق ندارد. -The relationship is reflexive – any region also belongs to itself. - -### regionHierarchy(id\[, geobase\]) {#regionhierarchyid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. -مثال: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### شناسه بسته:\]) {#regiontonameid-lang} - -Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn't exist, an empty string is returned. - -`ua` و `uk` هر دو به معنای اوکراین. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/fa/sql_reference/index.md b/docs/fa/sql_reference/index.md deleted file mode 100644 index bfee52fe239..00000000000 --- a/docs/fa/sql_reference/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: SQL Reference -toc_hidden: true -toc_priority: 28 -toc_title: "\u0645\u062E\u0641\u06CC" ---- - -# مرجع مربع {#sql-reference} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md#query_language_queries_alter) -- [انواع دیگر نمایش داده شد](statements/misc.md) - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/fa/sql_reference/operators.md b/docs/fa/sql_reference/operators.md deleted file mode 100644 index 577b9079998..00000000000 --- a/docs/fa/sql_reference/operators.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u0627\u067E\u0631\u0627\u062A\u0648\u0631\u0647\u0627" ---- - -# اپراتورها {#operators} - -همه اپراتورها در حال تبدیل به توابع مربوط به خود را در پرس و جو و تجزیه مرحله مطابق با اولویت و associativity. -گروه اپراتورهای به ترتیب اولویت ذکر شده (بالاتر در لیست است, زودتر اپراتور به استدلال خود متصل). - -## اپراتورهای دسترسی {#access-operators} - -`a[N]` – Access to an element of an array. The `arrayElement(a, N)` تابع. - -`a.N` – Access to a tuple element. The `tupleElement(a, N)` تابع. - -## اپراتور نفی عددی {#numeric-negation-operator} - -`-a` – The `negate (a)` تابع. - -## اپراتورهای ضرب و تقسیم {#multiplication-and-division-operators} - -`a * b` – The `multiply (a, b)` تابع. - -`a / b` – The `divide(a, b)` تابع. - -`a % b` – The `modulo(a, b)` تابع. - -## اپراتورهای جمع و تفریق {#addition-and-subtraction-operators} - -`a + b` – The `plus(a, b)` تابع. - -`a - b` – The `minus(a, b)` تابع. - -## مقایسه اپراتورها {#comparison-operators} - -`a = b` – The `equals(a, b)` تابع. - -`a == b` – The `equals(a, b)` تابع. - -`a != b` – The `notEquals(a, b)` تابع. - -`a <> b` – The `notEquals(a, b)` تابع. - -`a <= b` – The `lessOrEquals(a, b)` تابع. - -`a >= b` – The `greaterOrEquals(a, b)` تابع. - -`a < b` – The `less(a, b)` تابع. - -`a > b` – The `greater(a, b)` تابع. - -`a LIKE s` – The `like(a, b)` تابع. - -`a NOT LIKE s` – The `notLike(a, b)` تابع. - -`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. - -`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. - -## اپراتورها برای کار با مجموعه داده ها {#operators-for-working-with-data-sets} - -*ببینید [در اپراتورها](statements/select.md#select-in-operators).* - -`a IN ...` – The `in(a, b)` تابع. - -`a NOT IN ...` – The `notIn(a, b)` تابع. - -`a GLOBAL IN ...` – The `globalIn(a, b)` تابع. - -`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` تابع. - -## اپراتورها برای کار با تاریخ و زمان {#operators-datetime} - -### EXTRACT {#operator-extract} - -``` sql -EXTRACT(part FROM date); -``` - -عصاره بخشی از یک تاریخ معین. مثلا, شما می توانید یک ماه از یک تاریخ معین بازیابی, یا یک ثانیه از یک زمان. - -این `part` پارامتر مشخص می کند که بخشی از تاریخ برای بازیابی. مقادیر زیر در دسترس هستند: - -- `DAY` — The day of the month. Possible values: 1–31. -- `MONTH` — The number of a month. Possible values: 1–12. -- `YEAR` — The year. -- `SECOND` — The second. Possible values: 0–59. -- `MINUTE` — The minute. Possible values: 0–59. -- `HOUR` — The hour. Possible values: 0–23. - -این `part` پارامتر غیر حساس به حروف است. - -این `date` پارامتر تاریخ یا زمان پردازش را مشخص می کند. هر دو [تاریخ](../sql_reference/data_types/date.md) یا [DateTime](../sql_reference/data_types/datetime.md) نوع پشتیبانی می شود. - -مثالها: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -در مثال زیر ما ایجاد یک جدول و قرار دادن به آن یک مقدار با `DateTime` نوع. - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -شما می توانید نمونه های بیشتری را در [تستها](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -ایجاد یک [فاصله](../sql_reference/data_types/special_data_types/interval.md)- ارزش نوع است که باید در عملیات ریاضی با استفاده [تاریخ](../sql_reference/data_types/date.md) و [DateTime](../sql_reference/data_types/datetime.md)- ارزش نوع . - -انواع فواصل: -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -!!! warning "اخطار" - فواصل با انواع مختلف نمی تواند ترکیب شود. شما می توانید عبارات مانند استفاده کنید `INTERVAL 4 DAY 1 HOUR`. بیان فواصل در واحد است که کوچکتر یا مساوی کوچکترین واحد فاصله برای مثال `INTERVAL 25 HOUR`. شما می توانید عملیات تبعی مانند مثال زیر استفاده کنید. - -مثال: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**همچنین نگاه کنید** - -- [فاصله](../sql_reference/data_types/special_data_types/interval.md) نوع داده -- [توینتروال](../sql_reference/functions/type_conversion_functions.md#function-tointerval) توابع تبدیل نوع - -## اپراتور نفی منطقی {#logical-negation-operator} - -`NOT a` – The `not(a)` تابع. - -## منطقی و اپراتور {#logical-and-operator} - -`a AND b` – The`and(a, b)` تابع. - -## منطقی یا اپراتور {#logical-or-operator} - -`a OR b` – The `or(a, b)` تابع. - -## اپراتور شرطی {#conditional-operator} - -`a ? b : c` – The `if(a, b, c)` تابع. - -یادداشت: - -اپراتور مشروط محاسبه ارزش ب و ج, سپس چک چه شرایط ملاقات کرده است, و سپس مقدار مربوطه را برمی گرداند. اگر `b` یا `C` یک [ارریجین()](../sql_reference/functions/array_join.md#functions_arrayjoin) عملکرد هر سطر خواهد بود تکرار صرف نظر از “a” شرط. - -## عبارت شرطی {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -اگر `x` مشخص شده است, سپس `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. - -اگر وجود ندارد `ELSE c` بند در بیان, مقدار پیش فرض است `NULL`. - -این `transform` تابع با کار نمی کند `NULL`. - -## اپراتور الحاق {#concatenation-operator} - -`s1 || s2` – The `concat(s1, s2) function.` - -## لامبدا اپراتور ایجاد {#lambda-creation-operator} - -`x -> expr` – The `lambda(x, expr) function.` - -اپراتورهای زیر یک اولویت ندارد, از براکت هستند: - -## اپراتور ایجاد مجموعه {#array-creation-operator} - -`[x1, ...]` – The `array(x1, ...) function.` - -## اپراتور ایجاد تاپل {#tuple-creation-operator} - -`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` - -## Associativity {#associativity} - -همه اپراتورهای دودویی انجمن را ترک کرده اند. به عنوان مثال, `1 + 2 + 3` تبدیل به `plus(plus(1, 2), 3)`. -گاهی اوقات این راه شما انتظار می رود کار نمی کند. به عنوان مثال, `SELECT 4 > 2 > 3` در نتیجه 0. - -برای بهره وری `and` و `or` توابع قبول هر تعداد از استدلال. زنجیره های مربوطه از `AND` و `OR` اپراتورها به یک تماس از این توابع تبدیل شده است. - -## در حال بررسی برای `NULL` {#checking-for-null} - -تاتر از `IS NULL` و `IS NOT NULL` اپراتورها. - -### IS NULL {#operator-is-null} - -- برای [Nullable](../sql_reference/data_types/nullable.md) مقادیر نوع `IS NULL` بازگشت اپراتور: - - `1` اگر مقدار باشد `NULL`. - - `0` وگرنه -- برای ارزش های دیگر `IS NULL` اپراتور همیشه باز می گردد `0`. - - - -``` sql -SELECT x+100 FROM t_null WHERE y IS NULL -``` - -``` text -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ -``` - -### IS NOT NULL {#is-not-null} - -- برای [Nullable](../sql_reference/data_types/nullable.md) مقادیر نوع `IS NOT NULL` بازگشت اپراتور: - - `0` اگر مقدار باشد `NULL`. - - `1` وگرنه -- برای ارزش های دیگر `IS NOT NULL` اپراتور همیشه باز می گردد `1`. - - - -``` sql -SELECT * FROM t_null WHERE y IS NOT NULL -``` - -``` text -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/fa/sql_reference/statements/alter.md b/docs/fa/sql_reference/statements/alter.md deleted file mode 100644 index c2b8561c299..00000000000 --- a/docs/fa/sql_reference/statements/alter.md +++ /dev/null @@ -1,505 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -این `ALTER` پرسوجو فقط برای پشتیبانی `*MergeTree` جداول و همچنین `Merge`و`Distributed`. پرس و جو دارای چندین تغییرات. - -### دستکاری ستون {#column-manipulations} - -تغییر ساختار جدول. - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -در پرس و جو, مشخص یک لیست از یک یا چند اقدامات کاما از هم جدا. -هر عمل یک عملیات بر روی یک ستون است. - -اقدامات زیر پشتیبانی می شوند: - -- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. -- [DROP COLUMN](#alter_drop-column) — Deletes the column. -- [CLEAR COLUMN](#alter_clear-column) — Resets column values. -- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. -- [MODIFY COLUMN](#alter_modify-column) — Changes column's type, default expression and TTL. - -این اقدامات در زیر توضیح داده شده است. - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -یک ستون جدید به جدول با مشخص اضافه می کند `name`, `type`, [`codec`](create.md#codecs) و `default_expr` (نگاه کنید به بخش [عبارتهای پیشفرض](create.md#create-default-values)). - -اگر `IF NOT EXISTS` بند گنجانده شده است, پرس و جو یک خطا بازگشت نیست اگر ستون در حال حاضر وجود دارد. اگر شما مشخص کنید `AFTER name_after` (نام ستون دیگر), ستون پس از یک مشخص شده در لیست ستون جدول اضافه. در غیر این صورت, ستون به پایان جدول اضافه. توجه داشته باشید که هیچ راهی برای اضافه کردن یک ستون به ابتدای جدول وجود دارد. برای زنجیره ای از اقدامات, `name_after` می تواند نام یک ستون است که در یکی از اقدامات قبلی اضافه شده است. - -اضافه کردن یک ستون فقط تغییر ساختار جدول, بدون انجام هر گونه اقدامات با داده. داده ها بر روی دیسک پس از ظاهر نمی شود `ALTER`. اگر داده ها برای یک ستون از دست رفته در هنگام خواندن از جدول, این است که در با مقادیر پیش فرض پر (با انجام عبارت پیش فرض اگر یکی وجود دارد, و یا با استفاده از صفر یا رشته های خالی). ستون بر روی دیسک به نظر می رسد پس از ادغام قطعات داده (دیدن [ادغام](../../engines/table_engines/mergetree_family/mergetree.md)). - -این رویکرد به ما اجازه می دهد برای تکمیل `ALTER` پرس و جو فورا, بدون افزایش حجم داده های قدیمی. - -مثال: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -ستون را با نام حذف می کند `name`. اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. - -حذف داده ها از سیستم فایل. از این حذف تمام فایل های پرس و جو تقریبا بلافاصله تکمیل شده است. - -مثال: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -بازنشانی تمام داده ها در یک ستون برای یک پارتیشن مشخص. اطلاعات بیشتر در مورد تنظیم نام پارتیشن در بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). - -اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. - -مثال: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'comment' -``` - -می افزاید: نظر به ستون. اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. - -هر ستون می تواند یک نظر داشته باشد. اگر یک نظر در حال حاضر برای ستون وجود دارد, یک نظر جدید رونویسی نظر قبلی. - -نظرات در ذخیره می شود `comment_expression` ستون توسط [DESCRIBE TABLE](misc.md#misc-describe-table) پرس و جو. - -مثال: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -این پرسوجو تغییر میکند `name` ویژگیهای ستون: - -- نوع - -- عبارت پیشفرض - -- TTL - - For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). - -اگر `IF EXISTS` بند مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر ستون وجود ندارد. - -هنگام تغییر نوع, ارزش ها به عنوان اگر تبدیل [نوع](../../sql_reference/functions/type_conversion_functions.md) توابع به کار گرفته شد. اگر تنها عبارت پیش فرض تغییر می کند, پرس و جو می کند هر چیزی پیچیده نیست, و تقریبا بلافاصله تکمیل. - -مثال: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. - -چندین مرحله پردازش وجود دارد: - -- تهیه فایل های موقت (جدید) با داده های اصلاح شده. -- تغییر نام فایل های قدیمی. -- تغییر نام فایل های موقت (جدید) به نام های قدیمی. -- حذف فایل های قدیمی. - -فقط مرحله اول زمان طول می کشد. در صورتی که یک شکست در این مرحله وجود دارد, داده ها تغییر نکرده است. -در صورتی که یک شکست در یکی از مراحل پی در پی وجود دارد, داده ها را می توان به صورت دستی ترمیم. استثنا است اگر فایل های قدیمی از سیستم فایل حذف شد اما داده ها را برای فایل های جدید را به دیسک نوشته شده است و از دست داده بود. - -این `ALTER` پرس و جو برای تغییر ستون تکرار شده است. دستورالعمل ها در باغ وحش ذخیره می شوند و سپس هر ماکت اعمال می شود. همه `ALTER` نمایش داده شد در همان جهت اجرا شود. پرس و جو منتظر اقدامات مناسب برای در کپی دیگر تکمیل شود. با این حال, پرس و جو برای تغییر ستون در یک جدول تکرار می تواند قطع, و تمام اقدامات غیر همزمان انجام خواهد شد. - -#### تغییر محدودیت پرس و جو {#alter-query-limitations} - -این `ALTER` پرس و جو به شما امکان ایجاد و حذف عناصر جداگانه (ستون) در ساختارهای داده های تو در تو, اما نه کل ساختارهای داده تو در تو. برای اضافه کردن یک ساختار داده های تو در تو, شما می توانید ستون با یک نام مانند اضافه `name.nested_name` و نوع `Array(T)`. ساختار داده های تو در تو معادل ستون های چندگانه با یک نام است که پیشوند مشابه قبل از نقطه است. - -هیچ پشتیبانی برای حذف ستون ها در کلید اصلی یا کلید نمونه برداری (ستون هایی که در استفاده می شود) وجود ندارد. `ENGINE` عبارت). تغییر نوع ستون که در کلید اصلی گنجانده شده است تنها ممکن است اگر این تغییر باعث نمی شود داده ها به اصلاح شود (مثلا, شما مجاز به اضافه کردن مقادیر به شمارشی و یا برای تغییر یک نوع از `DateTime` به `UInt32`). - -اگر `ALTER` پرس و جو برای ایجاد تغییرات جدول مورد نیاز کافی نیست شما می توانید یک جدول جدید ایجاد کنید و داده ها را با استفاده از داده ها کپی کنید [INSERT SELECT](insert_into.md#insert_query_insert-select) پرس و جو, سپس جداول با استفاده از تغییر [RENAME](misc.md#misc_operations-rename) پرس و جو و حذف جدول قدیمی. شما می توانید از [تاتر-کپی](../../operations/utilities/clickhouse-copier.md) به عنوان یک جایگزین برای `INSERT SELECT` پرس و جو. - -این `ALTER` بلوک پرس و جو همه می خواند و می نویسد برای جدول. به عبارت دیگر, اگر طولانی `SELECT` در حال اجرا است در زمان `ALTER` پرس و جو `ALTER` پرس و جو منتظر خواهد ماند تا کامل شود. همزمان, تمام نمایش داده شد جدید به همان جدول صبر کنید در حالی که این `ALTER` در حال اجرا است. - -برای جداول که داده های خود را ذخیره کنید (مانند `Merge` و `Distributed`), `ALTER` فقط ساختار جدول را تغییر می دهد و ساختار جداول تابع را تغییر نمی دهد. مثلا, زمانی که در حال اجرا را تغییر دهید برای یک `Distributed` جدول, شما همچنین نیاز به اجرا `ALTER` برای جداول در تمام سرور از راه دور. - -### دستکاری با عبارات کلیدی {#manipulations-with-key-expressions} - -دستور زیر پشتیبانی می شود: - -``` sql -MODIFY ORDER BY new_expression -``` - -این فقط برای جداول در کار می کند [`MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) خانواده (از جمله -[تکرار](../../engines/table_engines/mergetree_family/replication.md) جدول). فرمان تغییر -[کلید مرتب سازی](../../engines/table_engines/mergetree_family/mergetree.md) از جدول -به `new_expression` (بیان و یا یک تاپل از عبارات). کلید اصلی یکسان باقی می ماند. - -فرمان سبک وزن به این معنا است که تنها ابرداده را تغییر می دهد. برای حفظ اموال که بخش داده ها -ردیف ها توسط عبارت کلیدی مرتب سازی شما می توانید عبارات حاوی ستون های موجود اضافه کنید دستور داد -به کلید مرتب سازی (فقط ستون اضافه شده توسط `ADD COLUMN` فرمان در همان `ALTER` پرسوجو). - -### دستکاری با شاخص های پرش داده {#manipulations-with-data-skipping-indices} - -این فقط برای جداول در کار می کند [`*MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) خانواده (از جمله -[تکرار](../../engines/table_engines/mergetree_family/replication.md) جدول). عملیات زیر -در دسترس هستند: - -- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - می افزاید توضیحات شاخص به ابرداده جداول . - -- `ALTER TABLE [db].name DROP INDEX name` - حذف شرح شاخص از ابرداده جداول و حذف فایل های شاخص از دیسک. - -این دستورات سبک وزن هستند به این معنا که فقط فراداده را تغییر می دهند یا فایل ها را حذف می کنند. -همچنین تکرار میشوند (همگامسازی فرادادههای شاخص از طریق باغ وحش). - -### دستکاری با محدودیت {#manipulations-with-constraints} - -مشاهده بیشتر در [قیدها](create.md#constraints) - -محدودیت ها می توانند با استفاده از نحو زیر اضافه یا حذف شوند: - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -نمایش داده شد اضافه خواهد شد و یا حذف ابرداده در مورد محدودیت از جدول به طوری که بلافاصله پردازش شده است. - -بررسی قید *اعدام نخواهد شد* در داده های موجود اگر اضافه شد. - -همه تغییرات در جداول تکرار در حال پخش به باغ وحش بنابراین خواهد شد در دیگر کپی اعمال می شود. - -### دستکاری با پارتیشن ها و قطعات {#alter_manipulations-with-partitions} - -عملیات زیر را با [پارتیشن ها](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) در دسترس هستند: - -- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` دایرکتوری و فراموش کرده ام. -- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. -- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` دایرکتوری به جدول. -- [REPLACE PARTITION](#alter_replace-partition) - پارتیشن داده ها را از یک جدول به دیگری کپی می کند. -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. -- [REPLACE PARTITION](#alter_replace-partition) - پارتیشن داده ها را از یک جدول به دیگری کپی می کند و جایگزین می شود. -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#تغییر\_موف\_ قابل تنظیم-پارتیشن) - پارتیشن داده را از یک جدول به دیگری حرکت دهید. -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - بازنشانی ارزش یک ستون مشخص شده در یک پارتیشن. -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - بازنشانی شاخص ثانویه مشخص شده در یک پارتیشن. -- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. -- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. -- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. - - - -#### جدا پارتیشن {\#alter\_detach-پارتیشن} {#detach-partition-alter-detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -تمام داده ها را برای پارتیشن مشخص شده به `detached` فهرست راهنما. سرور فراموش در مورد پارتیشن داده جدا به عنوان اگر وجود ندارد. سرور نمی خواهد در مورد این داده ها می دانم تا زمانی که شما را به [ATTACH](#alter_attach-partition) پرس و جو. - -مثال: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). - -پس از پرس و جو اجرا شده است, شما می توانید هر کاری که می خواهید با داده ها در انجام `detached` directory — delete it from the file system, or just leave it. - -This query is replicated – it moves the data to the `detached` دایرکتوری در تمام کپی. توجه داشته باشید که شما می توانید این پرس و جو تنها در یک ماکت رهبر را اجرا کند. برای پیدا کردن اگر یک ماکت یک رهبر است, انجام `SELECT` پرسوجو به [سیستم.تکرار](../../operations/system_tables.md#system_tables-replicas) جدول متناوبا, راحت تر به یک است `DETACH` پرس و جو در تمام کپی - همه کپی پرتاب یک استثنا, به جز ماکت رهبر. - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -پارتیشن مشخص شده را از جدول حذف می کند. این برچسب ها پرس و جو پارتیشن به عنوان غیر فعال و حذف داده ها به طور کامل, حدود در 10 دقیقه. - -اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). - -The query is replicated – it deletes data on all replicas. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -بخش مشخص شده یا تمام قسمت های پارتیشن مشخص شده را از بین می برد `detached`. -اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -می افزاید داده ها به جدول از `detached` فهرست راهنما. ممکن است که به اضافه کردن داده ها برای کل پارتیشن و یا برای یک بخش جداگانه. مثالها: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). - -این پرس و جو تکرار شده است. چک المثنی-ابتکار چه داده ها در وجود دارد `detached` فهرست راهنما. اگر داده وجود دارد, پرس و جو چک یکپارچگی خود را. اگر همه چیز درست است, پرس و جو می افزاید: داده ها به جدول. همه کپی دیگر دانلود داده ها از ماکت-مبتکر. - -بنابراین شما می توانید داده ها را به `detached` دایرکتوری در یک ماکت, و استفاده از `ALTER ... ATTACH` پرس و جو برای اضافه کردن به جدول در تمام کپی. - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -این پرس و جو پارتیشن داده را از `table1` به `table2` می افزاید داده ها به لیست موجود در `table2`. توجه داشته باشید که داده ها از حذف نمی شود `table1`. - -برای پرس و جو به اجرا با موفقیت, شرایط زیر باید رعایت شود: - -- هر دو جدول باید همان ساختار دارند. -- هر دو جدول باید کلید پارتیشن همان. - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -این پرس و جو پارتیشن داده را از `table1` به `table2` و جایگزین پارتیشن موجود در `table2`. توجه داشته باشید که داده ها از حذف نمی شود `table1`. - -برای پرس و جو به اجرا با موفقیت, شرایط زیر باید رعایت شود: - -- هر دو جدول باید همان ساختار دارند. -- هر دو جدول باید کلید پارتیشن همان. - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -این پرس و جو انتقال پارتیشن داده ها از `table_source` به `table_dest` با حذف داده ها از `table_source`. - -برای پرس و جو به اجرا با موفقیت, شرایط زیر باید رعایت شود: - -- هر دو جدول باید همان ساختار دارند. -- هر دو جدول باید کلید پارتیشن همان. -- هر دو جدول باید همان خانواده موتور باشد. (تکرار و یا غیر تکرار) -- هر دو جدول باید سیاست ذخیره سازی همان. - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -بازنشانی تمام مقادیر در ستون مشخص شده در یک پارتیشن. اگر `DEFAULT` بند هنگام ایجاد یک جدول تعیین شد, این پرس و جو مجموعه مقدار ستون به یک مقدار پیش فرض مشخص. - -مثال: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -این پرس و جو یک نسخه پشتیبان تهیه محلی از یک پارتیشن مشخص شده ایجاد می کند. اگر `PARTITION` بند حذف شده است, پرس و جو ایجاد پشتیبان گیری از تمام پارتیشن در یک بار. - -!!! note "یادداشت" - تمامی مراحل پشتیبان گیری بدون توقف سرور انجام می شود. - -توجه داشته باشید که برای جداول قدیمی مدل دهید شما می توانید پیشوند نام پارتیشن را مشخص کنید (به عنوان مثال, ‘2019’)- سپس پرس و جو پشتیبان گیری برای تمام پارتیشن مربوطه ایجاد می کند. اطلاعات بیشتر در مورد تنظیم بیان پارتیشن در یک بخش [نحوه مشخص کردن عبارت پارتیشن](#alter-how-to-specify-part-expr). - -در زمان اجرای, برای یک تصویر لحظهای داده, پرس و جو ایجاد لینک به داده های جدول. پیوندهای سخت در دایرکتوری قرار می گیرند `/var/lib/clickhouse/shadow/N/...` کجا: - -- `/var/lib/clickhouse/` است دایرکتوری محل کلیک کار مشخص شده در پیکربندی. -- `N` تعداد افزایشی از نسخه پشتیبان تهیه شده است. - -!!! note "یادداشت" - در صورت استفاده [مجموعه ای از دیسک برای ذخیره سازی داده ها در یک جدول](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) این `shadow/N` دایرکتوری به نظر می رسد در هر دیسک, ذخیره سازی قطعات داده که توسط همسان `PARTITION` اصطلاح. - -همان ساختار دایرکتوری ها در داخل پشتیبان به عنوان داخل ایجاد شده است `/var/lib/clickhouse/`. پرس و جو انجام می شود ‘chmod’ برای همه پروندهها نوشتن رو ممنوع کردم - -پس از ایجاد نسخه پشتیبان تهیه, شما می توانید داده ها را از کپی `/var/lib/clickhouse/shadow/` به سرور از راه دور و سپس از سرور محلی حذف کنید. توجه داشته باشید که `ALTER t FREEZE PARTITION` پرس و جو تکرار نشده است. این یک نسخه پشتیبان تهیه محلی تنها بر روی سرور محلی ایجاد می کند. - -پرس و جو ایجاد نسخه پشتیبان تهیه تقریبا بلافاصله (اما برای اولین بار برای نمایش داده شد در حال حاضر به جدول مربوطه منتظر را به پایان برساند در حال اجرا). - -`ALTER TABLE t FREEZE PARTITION` نسخه تنها داده, ابرداده جدول نیست. برای تهیه نسخه پشتیبان از فراداده های جدول فایل را کپی کنید `/var/lib/clickhouse/metadata/database/table.sql` - -برای بازیابی اطلاعات از یک نسخه پشتیبان تهیه زیر را انجام دهید: - -1. ایجاد جدول اگر وجود ندارد. برای مشاهده پرس و جو, استفاده از .پرونده جدید `ATTACH` در این با `CREATE`). -2. رونوشت داده از `data/database/table/` دایرکتوری در داخل پشتیبان گیری به `/var/lib/clickhouse/data/database/table/detached/` فهرست راهنما. -3. بدو `ALTER TABLE t ATTACH PARTITION` نمایش داده شد برای اضافه کردن داده ها به یک جدول. - -بازگرداندن از یک نسخه پشتیبان تهیه می کند نیاز به متوقف کردن سرور نیست. - -برای کسب اطلاعات بیشتر در مورد پشتیبان گیری و بازیابی اطلاعات, دیدن [پشتیبان گیری داده ها](../../operations/backup.md) بخش. - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -پرس و جو کار می کند شبیه به `CLEAR COLUMN`, اما بازنشانی شاخص به جای یک داده ستون. - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -دانلود یک پارتیشن از سرور دیگر. این پرس و جو تنها برای جداول تکرار کار می کند. - -پرس و جو می کند به شرح زیر است: - -1. پارتیشن را از سفال مشخص شده دانلود کنید. داخل ‘path-in-zookeeper’ شما باید یک مسیر به سفال در باغ وحش را مشخص کنید. -2. سپس پرس و جو داده های دانلود شده را به `detached` دایرکتوری از `table_name` جدول استفاده از [ATTACH PARTITION\|PART](#alter_attach-partition) پرسوجو برای افزودن داده به جدول. - -به عنوان مثال: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -توجه داشته باشید که: - -- این `ALTER ... FETCH PARTITION` پرس و جو تکرار نشده است. این پارتیشن را به `detached` دایرکتوری تنها بر روی سرور محلی. -- این `ALTER TABLE ... ATTACH` پرس و جو تکرار شده است. این می افزاید: داده ها به تمام کپی. داده ها به یکی از کپی ها از `detached` فهرست راهنما, و به دیگران - از کپی همسایه. - -قبل از دانلود, سیستم چک اگر پارتیشن وجود دارد و ساختار جدول مسابقات. ماکت مناسب ترین به طور خودکار از کپی سالم انتخاب شده است. - -اگر چه پرس و جو نامیده می شود `ALTER TABLE`, این ساختار جدول را تغییر دهید و بلافاصله داده های موجود در جدول را تغییر دهید. - -#### MOVE PARTITION\|PART {#alter_move-partition} - -پارتیشن ها یا قطعات داده را به حجم یا دیسک دیگری منتقل می کند `MergeTree`- جدول موتور . ببینید [با استفاده از دستگاه های بلوک های متعدد برای ذخیره سازی داده ها](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -این `ALTER TABLE t MOVE` پرسوجو: - -- تکرار نشده, به دلیل کپی های مختلف می توانید سیاست های ذخیره سازی مختلف دارند. -- بازگرداندن خطا در صورتی که دیسک یا حجم مشخص پیکربندی نشده است. پرس و جو نیز یک خطا را برمی گرداند اگر شرایط در حال حرکت داده, که مشخص شده در سیاست ذخیره سازی, نمی توان اعمال کرد. -- می توانید یک خطا در مورد بازگشت, زمانی که داده ها به نقل مکان کرد در حال حاضر توسط یک فرایند پس زمینه نقل مکان کرد, همزمان `ALTER TABLE t MOVE` پرس و جو و یا به عنوان یک نتیجه از ادغام داده های پس زمینه. کاربر باید هر گونه اقدامات اضافی در این مورد انجام نمی. - -مثال: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### نحوه تنظیم بیان پارتیشن {#alter-how-to-specify-part-expr} - -شما می توانید بیان پارتیشن را مشخص کنید `ALTER ... PARTITION` نمایش داده شد به روش های مختلف: - -- به عنوان یک مقدار از `partition` ستون از `system.parts` جدول به عنوان مثال, `ALTER TABLE visits DETACH PARTITION 201901`. -- به عنوان بیان از ستون جدول. ثابت ها و عبارات ثابت پشتیبانی می شوند. به عنوان مثال, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- با استفاده از شناسه پارتیشن. شناسه پارتیشن شناسه رشته پارتیشن (انسان قابل خواندن در صورت امکان) است که به عنوان نام پارتیشن در فایل سیستم و در باغ وحش استفاده می شود. شناسه پارتیشن باید در `PARTITION ID` بند, در یک نقل قول واحد. به عنوان مثال, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- در [ALTER ATTACH PART](#alter_attach-partition) و [DROP DETACHED PART](#alter_drop-detached) پرس و جو, برای مشخص کردن نام یک بخش, استفاده از رشته تحت اللفظی با ارزش از `name` ستون از [سیستم.قطعات مجزا](../../operations/system_tables.md#system_tables-detached_parts) جدول به عنوان مثال, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -استفاده از نقل قول در هنگام مشخص کردن پارتیشن بستگی به نوع بیان پارتیشن. برای مثال برای `String` نوع, شما باید برای مشخص کردن نام خود را در نقل قول (`'`). برای `Date` و `Int*` انواع بدون نقل قول مورد نیاز است. - -برای جداول قدیمی به سبک, شما می توانید پارتیشن یا به عنوان یک عدد مشخص `201901` یا یک رشته `'201901'`. نحو برای جداول سبک جدید سختگیرانه تر با انواع است (شبیه به تجزیه کننده برای فرمت ورودی ارزش). - -تمام قوانین فوق نیز برای درست است [OPTIMIZE](misc.md#misc_operations-optimize) پرس و جو. اگر شما نیاز به مشخص کردن تنها پارتیشن در هنگام بهینه سازی یک جدول غیر تقسیم, تنظیم بیان `PARTITION tuple()`. به عنوان مثال: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -نمونه هایی از `ALTER ... PARTITION` نمایش داده شد در تست نشان داده شده است [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) و [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### دستکاری با جدول جدول {#manipulations-with-table-ttl} - -شما می توانید تغییر دهید [جدول](../../engines/table_engines/mergetree_family/mergetree.md#mergetree-table-ttl) با درخواست فرم زیر: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### همزمانی تغییر نمایش داده شد {#synchronicity-of-alter-queries} - -برای جداول غیر قابل تکرار, همه `ALTER` نمایش داده شد همزمان انجام می شود. برای جداول تکرار, پرس و جو فقط می افزاید دستورالعمل برای اقدامات مناسب به `ZooKeeper` و اقدامات خود را در اسرع وقت انجام می شود. با این حال, پرس و جو می توانید صبر کنید برای این اقدامات در تمام کپی تکمیل شود. - -برای `ALTER ... ATTACH|DETACH|DROP` نمایش داده شد, شما می توانید با استفاده از `replication_alter_partitions_sync` راه اندازی به راه اندازی انتظار. -مقادیر ممکن: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. - -### جهشها {#alter-mutations} - -جهش یک نوع پرس و جو را تغییر دهید که اجازه می دهد تا تغییر یا حذف ردیف در یک جدول. در مقایسه با استاندارد `UPDATE` و `DELETE` نمایش داده شد که برای تغییرات داده نقطه در نظر گرفته شده, جهش برای عملیات سنگین است که تغییر بسیاری از ردیف در یک جدول در نظر گرفته شده. پشتیبانی برای `MergeTree` خانواده از موتورهای جدول از جمله موتورهای با پشتیبانی تکرار. - -جداول موجود برای جهش به عنوان (بدون تبدیل لازم), اما پس از جهش برای اولین بار است که به یک جدول اعمال, فرمت ابرداده خود را با نسخه های سرور قبلی ناسازگار می شود و سقوط به نسخه های قبلی غیر ممکن می شود. - -دستورات در حال حاضر در دسترس: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -این `filter_expr` باید از نوع باشد `UInt8`. پرس و جو حذف ردیف در جدول که این عبارت طول می کشد یک مقدار غیر صفر. - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -این `filter_expr` باید از نوع باشد `UInt8`. این پرس و جو به روز رسانی مقادیر ستون مشخص شده به ارزش عبارات مربوطه در ردیف که `filter_expr` طول می کشد یک مقدار غیر صفر. ارزش ها به نوع ستون با استفاده از قالبی `CAST` اپراتور. به روز رسانی ستون هایی که در محاسبه اولیه استفاده می شود و یا کلید پارتیشن پشتیبانی نمی شود. - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -پرس و جو بازسازی شاخص ثانویه `name` در پارتیشن `partition_name`. - -یک پرس و جو می تواند شامل چندین دستورات جدا شده توسط کاما. - -برای \* جداول ادغام جهش اجرا با بازنویسی تمام قطعات داده. هیچ اتمیتی وجود ندارد - قطعات برای قطعات جهش یافته جایگزین می شوند به محض اینکه اماده باشند و `SELECT` پرس و جو است که شروع به اجرای در طول جهش داده ها از قطعات است که در حال حاضر همراه با داده ها از قطعات است که هنوز جهش یافته شده اند جهش را ببینید. - -جهش ها به طور کامل توسط نظم خلقت خود دستور داده می شوند و به هر بخش به این ترتیب اعمال می شوند. جهش نیز تا حدی با درج دستور داد - داده هایی که به جدول وارد شد قبل از جهش ارسال خواهد شد جهش یافته و داده هایی که پس از که قرار داده شد جهش یافته نمی شود. توجه داشته باشید که جهش درج به هیچ وجه مسدود نیست. - -یک جهش پرس و جو می گرداند بلافاصله پس از جهش مطلب اضافه شده است (در صورت تکرار جداول به باغ وحش برای nonreplicated جداول - به فایل سیستم). جهش خود را اجرا ناهمگام با استفاده از تنظیمات مشخصات سیستم. برای پیگیری پیشرفت جهش شما می توانید با استفاده از [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) جدول یک جهش است که با موفقیت ارسال شد ادامه خواهد داد برای اجرای حتی اگر سرور کلیک دوباره راه اندازی. هیچ راهی برای عقب انداختن جهش هنگامی که ارسال شده است وجود دارد, اما اگر جهش برای برخی از دلیل گیر می تواند با لغو [`KILL MUTATION`](misc.md#kill-mutation) پرس و جو. - -مطالب برای جهش به پایان رسید حذف نمی حق دور (تعداد نوشته های حفظ شده توسط تعیین `finished_mutations_to_keep` پارامتر موتور ذخیره سازی). نوشته جهش قدیمی تر حذف می شوند. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/fa/sql_reference/statements/create.md b/docs/fa/sql_reference/statements/create.md deleted file mode 100644 index 947239c39ce..00000000000 --- a/docs/fa/sql_reference/statements/create.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: CREATE ---- - -# ایجاد پرس و جو {#create-queries} - -## CREATE DATABASE {#query-language-create-database} - -ایجاد پایگاه داده. - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] -``` - -### بند {#clauses} - -- `IF NOT EXISTS` - - If the `db_name` database already exists, then ClickHouse doesn't create a new database and: - - - Doesn't throw an exception if clause is specified. - - Throws an exception if clause isn't specified. - -- `ON CLUSTER` - - ClickHouse creates the `db_name` database on all the servers of a specified cluster. - -- `ENGINE` - - - [MySQL](../engines/database_engines/mysql.md) - - Allows you to retrieve data from the remote MySQL server. - - By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). - -## CREATE TABLE {#create-table-query} - -این `CREATE TABLE` پرس و جو می تواند اشکال مختلف داشته باشد. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], - ... -) ENGINE = engine -``` - -ایجاد یک جدول به نام ‘name’ در ‘db’ پایگاه داده یا پایگاه داده فعلی اگر ‘db’ تنظیم نشده است, با ساختار مشخص شده در براکت و ‘engine’ موتور. -ساختار جدول یک لیست از توصیف ستون است. اگر شاخص ها توسط موتور پشتیبانی می شوند به عنوان پارامتر برای موتور جدول نشان داده می شوند. - -شرح ستون است `name type` در ساده ترین حالت. مثال: `RegionID UInt32`. -عبارات همچنین می توانید برای مقادیر پیش فرض تعریف شود (پایین را ببینید). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -ایجاد یک جدول با همان ساختار به عنوان جدول دیگر. شما می توانید یک موتور مختلف برای جدول مشخص کنید. اگر موتور مشخص نشده است, همان موتور خواهد شد که برای استفاده `db2.name2` جدول - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() -``` - -ایجاد یک جدول با ساختار و داده های بازگردانده شده توسط یک [تابع جدول](../table_functions/index.md). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -ایجاد یک جدول با یک ساختار مانند نتیجه `SELECT` پرس و جو, با ‘engine’ موتور, و پر با داده ها از را انتخاب کنید. - -در همه موارد اگر `IF NOT EXISTS` مشخص شده است, پرس و جو یک خطا بازگشت نیست اگر جدول در حال حاضر وجود دارد. در این مورد پرس و جو هیچ کاری انجام نخواهد داد. - -می تواند بند دیگر پس از وجود دارد `ENGINE` بند در پرس و جو. دیدن مستندات دقیق در مورد چگونگی ایجاد جدول در شرح [موتورهای جدول](../../engines/table_engines/index.md#table_engines). - -### مقادیر پیشفرض {#create-default-values} - -شرح ستون می تواند یک عبارت برای یک مقدار پیش فرض مشخص, در یکی از روش های زیر:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. -مثال: `URLDomain String DEFAULT domain(URL)`. - -اگر یک عبارت برای مقدار پیش فرض تعریف نشده است, مقادیر پیش فرض خواهد شد به صفر برای اعداد تنظیم, رشته های خالی برای رشته, طعمه خالی برای ارریس, و `0000-00-00` برای تاریخ و یا `0000-00-00 00:00:00` برای تاریخ با زمان. نقاط صفر پشتیبانی نمی شوند. - -اگر عبارت پیش فرض تعریف شده است, نوع ستون اختیاری است. در صورتی که یک نوع به صراحت تعریف شده وجود ندارد, نوع بیان پیش فرض استفاده شده است. مثال: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ نوع خواهد شد برای استفاده ‘EventDate’ ستون. - -اگر نوع داده ها و پیش فرض بیان تعریف شده به صراحت این را بیان خواهد شد بازیگران به نوع مشخص شده با استفاده از نوع مصاحبه توابع. مثال: `Hits UInt32 DEFAULT 0` معنی همان چیزی که به عنوان `Hits UInt32 DEFAULT toUInt32(0)`. - -Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don't contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. - -`DEFAULT expr` - -مقدار پیش فرض عادی. اگر پرس و جو درج می کند ستون مربوطه مشخص نیست, خواهد شد در محاسبات بیان مربوطه پر. - -`MATERIALIZED expr` - -بیان محقق. چنین ستون ای نمی تواند برای درج مشخص شود زیرا همیشه محاسبه می شود. -برای درج بدون یک لیست از ستون, این ستون ها در نظر گرفته نمی. -علاوه بر این, این ستون جایگزین نشده است که با استفاده از یک ستاره در یک پرس و جو را انتخاب کنید. این است که برای حفظ همواره که تخلیه با استفاده از `SELECT *` را می توان به جدول با استفاده از درج بدون مشخص کردن لیست ستون قرار داده شده. - -`ALIAS expr` - -دو واژه مترادف. چنین ستون در جدول ذخیره نمی شود و در همه. -ارزش های خود را نمی توان در یک جدول قرار داد و هنگام استفاده از ستاره در یک پرس و جو انتخاب جایگزین نمی شود. -این را می توان در انتخاب استفاده می شود اگر نام مستعار است که در طول تجزیه پرس و جو گسترش یافته است. - -هنگام استفاده از پرس و جو را تغییر دهید برای اضافه کردن ستون جدید, داده های قدیمی برای این ستون نوشته نشده است. بجای, در هنگام خواندن داده های قدیمی که ارزش برای ستون جدید ندارد, عبارات در پرواز به طور پیش فرض محاسبه. با این حال, اگر در حال اجرا عبارات نیاز به ستون های مختلف است که در پرس و جو نشان داده نمی, این ستون علاوه بر خوانده خواهد شد, اما فقط برای بلوک های داده که نیاز. - -اگر شما یک ستون جدید اضافه کردن به یک جدول اما بعد تغییر بیان پیش فرض خود, ارزش های مورد استفاده برای داده های قدیمی تغییر خواهد کرد (برای داده هایی که ارزش بر روی دیسک ذخیره نمی شد). توجه داشته باشید که هنگام اجرای ادغام پس زمینه, داده ها را برای ستون که در یکی از قطعات ادغام از دست رفته است به بخش ادغام شده نوشته شده. - -این ممکن است به مجموعه مقادیر پیش فرض برای عناصر در ساختارهای داده تو در تو. - -### قیدها {#constraints} - -همراه با ستون توصیف محدودیت می تواند تعریف شود: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` می تواند با هر عبارت بولی. اگر قیود برای جدول تعریف شود هر کدام برای هر سطر بررسی خواهند شد `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. - -اضافه کردن مقدار زیادی از محدودیت های منفی می تواند عملکرد بزرگ را تحت تاثیر قرار `INSERT` نمایش داده شد. - -### عبارت دیگر {#ttl-expression} - -تعریف می کند زمان ذخیره سازی برای ارزش. می توان تنها برای ادغام مشخص-جداول خانواده. برای توضیحات دقیق, دیدن [ستون ها و جداول](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). - -### کدکهای فشردهسازی ستون {#codecs} - -به طور پیش فرض, تاتر اعمال `lz4` روش فشرده سازی. برای `MergeTree`- خانواده موتور شما می توانید روش فشرده سازی به طور پیش فرض در تغییر [فشردهسازی](../../operations/server_configuration_parameters/settings.md#server-settings-compression) بخش پیکربندی سرور. شما همچنین می توانید روش فشرده سازی برای هر ستون فردی در تعریف `CREATE TABLE` پرس و جو. - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -اگر یک کدک مشخص شده است, کدک به طور پیش فرض صدق نمی کند. به عنوان مثال کدک ها را می توان در یک خط لوله ترکیب کرد, `CODEC(Delta, ZSTD)`. برای انتخاب بهترین ترکیب کدک برای شما پروژه معیار شبیه به شرح داده شده در التیت منتقل می کند [کدگذاری های جدید برای بهبود بهره وری کلیک](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) مقاله. - -!!! warning "اخطار" - شما می توانید فایل های پایگاه داده کلیک از حالت فشرده خارج با تاسیسات خارجی مانند `lz4`. بجای, استفاده از ویژه [کلیک کمپرسور](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) سودمند. - -فشرده سازی برای موتورهای جدول زیر پشتیبانی می شود: - -- [ادغام](../../engines/table_engines/mergetree_family/mergetree.md) خانواده پشتیبانی از کدک های فشرده سازی ستون و انتخاب روش فشرده سازی پیش فرض توسط [فشردهسازی](../../operations/server_configuration_parameters/settings.md#server-settings-compression) تنظیمات. -- [ثبت](../../engines/table_engines/log_family/log_family.md) خانواده با استفاده از `lz4` روش فشرده سازی به طور پیش فرض و پشتیبانی از کدک های فشرده سازی ستون. -- [تنظیم](../../engines/table_engines/special/set.md). فقط فشرده سازی پیش فرض پشتیبانی می کند. -- [پیوستن](../../engines/table_engines/special/join.md). فقط فشرده سازی پیش فرض پشتیبانی می کند. - -تاتر با پشتیبانی از کدک های هدف مشترک و کدک های تخصصی. - -#### کدکهای تخصصی {#create-query-specialized-codecs} - -این کدک ها طراحی شده اند تا فشرده سازی را با استفاده از ویژگی های خاص داده ها موثر تر کند. برخی از این کدک ها اطلاعات خود را فشرده سازی نمی کنند. در عوض داده ها را برای یک کدک هدف مشترک تهیه می کنند که بهتر از بدون این دارو را فشرده می کند. - -کدکهای تخصصی: - -- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` برای ذخیره سازی مقادیر دلتا استفاده می شود, بنابراین `delta_bytes` حداکثر اندازه مقادیر خام است. ممکن است `delta_bytes` ارزش: 1, 2, 4, 8. مقدار پیش فرض برای `delta_bytes` هست `sizeof(type)` اگر به برابر 1, 2, 4, یا 8. در تمام موارد دیگر 1 است. -- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [گوریل: سریع, مقیاس پذیر, در حافظه پایگاه داده سری زمان](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [گوریل: سریع, مقیاس پذیر, در حافظه پایگاه داده سری زمان](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` و `DateTime`). در هر مرحله از الگوریتم کدک یک بلوک از ارزش های 64 را می گیرد و به ماتریس بیتی 6464 می رسد و بیت های استفاده نشده ارزش ها را تولید می کند و بقیه را به عنوان یک دنباله باز می گرداند. بیت های استفاده نشده بیت هایی هستند که بین مقادیر حداکثر و حداقل در کل بخش داده ای که فشرده سازی استفاده می شود متفاوت نیستند. - -`DoubleDelta` و `Gorilla` کدک ها در گوریل تسدب به عنوان اجزای الگوریتم فشرده سازی خود استفاده می شود. رویکرد گوریل در سناریوها موثر است زمانی که یک دنباله از ارزش های کم زمان خود را با تغییر دادن زمان وجود دارد. مهر زمانی به طور موثر توسط فشرده `DoubleDelta` کدک و ارزش ها به طور موثر توسط فشرده `Gorilla` وابسته به کدک. مثلا برای دریافت جدول ذخیره شده به طور موثر می توانید در تنظیمات زیر ایجاد کنید: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### کدک های هدف مشترک {#create-query-common-purpose-codecs} - -کدکها: - -- `NONE` — No compression. -- `LZ4` — Lossless [الگوریتم فشرده سازی داده ها](https://github.com/lz4/lz4) به طور پیش فرض استفاده می شود. اعمال فشرده سازی سریع 4. -- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` سطح پیش فرض اعمال می شود. سطوح ممکن: \[1, 12\]. محدوده سطح توصیه شده: \[4, 9\]. -- `ZSTD[(level)]` — [الگوریتم فشرد فشاری](https://en.wikipedia.org/wiki/Zstandard) با قابلیت تنظیم `level`. سطوح ممکن: \[1, 22\]. مقدار پیش فرض: 1. - -سطح فشرده سازی بالا برای حالات نامتقارن مفید هستند, مانند فشرده سازی یک بار, از حالت فشرده خارج بارها و بارها. سطوح بالاتر به معنای فشرده سازی بهتر و استفاده از پردازنده بالاتر است. - -## جداول موقت {#temporary-tables} - -تاتر از جداول موقت که دارای ویژگی های زیر: - -- جداول موقت ناپدید می شوند هنگامی که جلسه به پایان می رسد از جمله اگر اتصال از دست داده است. -- جدول موقت با استفاده از موتور حافظه تنها. -- دسی بل را نمی توان برای یک جدول موقت مشخص شده است. این است که در خارج از پایگاه داده ایجاد شده است. -- غیر ممکن است برای ایجاد یک جدول موقت با پرس و جو توزیع دی ال در تمام سرورهای خوشه (با استفاده از `ON CLUSTER`): این جدول تنها در جلسه فعلی وجود دارد. -- اگر یک جدول موقت است به همین نام به عنوان یکی دیگر و یک پرس و جو نام جدول بدون مشخص دسی بل مشخص, جدول موقت استفاده خواهد شد. -- برای پردازش پرس و جو توزیع, جداول موقت مورد استفاده در یک پرس و جو به سرور از راه دور منتقل. - -برای ایجاد یک جدول موقت از نحو زیر استفاده کنید: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -در بیشتر موارد, جداول موقت به صورت دستی ایجاد نمی, اما در هنگام استفاده از داده های خارجی برای پرس و جو, و یا برای توزیع `(GLOBAL) IN`. برای کسب اطلاعات بیشتر به بخش های مناسب مراجعه کنید - -امکان استفاده از جداول با [موتور = حافظه](../../engines/table_engines/special/memory.md) به جای جداول موقت. - -## توزیع پرس و جو ددل (در بند خوشه) {#distributed-ddl-queries-on-cluster-clause} - -این `CREATE`, `DROP`, `ALTER` و `RENAME` نمایش داده شد حمایت از اجرای توزیع در یک خوشه. -برای مثال پرس و جو زیر ایجاد می کند `all_hits` `Distributed` جدول در هر میزبان در `cluster`: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -به منظور اجرای این نمایش داده شد به درستی, هر یک از میزبان باید تعریف خوشه همان (برای ساده سازی تنظیمات همگام سازی, شما می توانید تعویض از باغ وحش استفاده). همچنین باید به سرورهای باغ وحش متصل شوند. -نسخه محلی از پرس و جو در نهایت بر روی هر یک از میزبان در خوشه اجرا می شود, حتی اگر برخی از میزبان در حال حاضر در دسترس نیست. سفارش برای اجرای نمایش داده شد در یک میزبان واحد تضمین شده است. - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -ایجاد یک دیدگاه. دو نوع دیدگاه وجود دارد: طبیعی و تحقق. - -نمایش عادی هیچ داده ذخیره نمی, اما فقط انجام خواندن از جدول دیگر. به عبارت دیگر, یک نمایش عادی چیزی بیش از یک پرس و جو ذخیره شده است. هنگام خواندن از نظر, این پرس و جو را نجات داد به عنوان یک خرده فروشی در بند از استفاده. - -به عنوان مثال, فرض کنیم شما یک دیدگاه ایجاد کرده اید: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -و پرس و جو نوشته شده است: - -``` sql -SELECT a, b, c FROM view -``` - -این پرس و جو به طور کامل به استفاده از خرده فروشی معادل است: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -نمایش ها محقق داده فروشگاه تبدیل شده توسط پرس و جو مربوطه را انتخاب کنید. - -هنگام ایجاد یک دیدگاه محقق بدون `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. - -هنگام ایجاد یک دیدگاه محقق با `TO [db].[table]`, شما باید استفاده کنید `POPULATE`. - -مشاهده محقق به شرح زیر مرتب: هنگام قرار دادن داده ها به جدول مشخص شده در انتخاب, بخشی از داده های درج شده است این پرس و جو را انتخاب کنید تبدیل, و در نتیجه در نظر قرار داده. - -اگر شما جمعیت مشخص, داده های جدول موجود در نظر قرار داده در هنگام ایجاد, اگر ساخت یک `CREATE TABLE ... AS SELECT ...` . در غیر این صورت پرس و جو شامل تنها داده های درج شده در جدول پس از ایجاد دیدگاه. ما توصیه نمی کنیم با استفاده از جمعیت, از داده ها در جدول در طول ایجاد مشاهده قرار داده نمی شود. - -A `SELECT` پرسوجو می تواند شامل شود `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` تنظیم شده است, داده ها در طول درج جمع, اما تنها در یک بسته واحد از داده های درج شده. داده ها بیشتر جمع نمی شود. استثنا است که با استفاده از یک موتور است که به طور مستقل انجام تجمع داده ها, مانند `SummingMergeTree`. - -اعدام `ALTER` نمایش داده شد در نمایش محقق شده است به طور کامل توسعه یافته نیست, بنابراین ممکن است ناخوشایند. اگر مشاهده محقق با استفاده از ساخت و ساز `TO [db.]name` شما می توانید `DETACH` منظره, اجرا `ALTER` برای جدول هدف و سپس `ATTACH` قبلا جدا (`DETACH`) نظر . - -نمایش ها نگاه همان جداول عادی. برای مثال در نتیجه ذکر شده است `SHOW TABLES` پرس و جو. - -پرس و جو جداگانه برای حذف نمایش ها وجود ندارد. برای حذف یک نما, استفاده `DROP TABLE`. - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` - -ایجاد [فرهنگ لغت خارجی](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) با توجه به [ساختار](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md), [متن](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md), [طرحبندی](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) و [طول عمر](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md). - -ساختار فرهنگ لغت خارجی شامل ویژگی های. ویژگی فرهنگ لغت به طور مشابه به ستون جدول مشخص شده است. تنها ویژگی مورد نیاز ویژگی نوع خود است, تمام خواص دیگر ممکن است مقادیر پیش فرض دارند. - -بسته به فرهنگ لغت [طرحبندی](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) یک یا چند ویژگی را می توان به عنوان کلید فرهنگ لغت مشخص شده است. - -برای کسب اطلاعات بیشتر, دیدن [واژهنامهها خارجی](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) بخش. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/fa/sql_reference/statements/insert_into.md b/docs/fa/sql_reference/statements/insert_into.md deleted file mode 100644 index 25709b2ee67..00000000000 --- a/docs/fa/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: INSERT INTO ---- - -## INSERT {#insert} - -اضافه کردن داده ها. - -قالب پرس و جو عمومی: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -پرسوجو میتواند فهرستی از ستونها را برای درج مشخص کند `[(c1, c2, c3)]`. در این مورد, بقیه ستون ها با پر: - -- مقادیر محاسبه شده از `DEFAULT` عبارات مشخص شده در تعریف جدول. -- صفر و رشته خالی, اگر `DEFAULT` عبارات تعریف نشده. - -اگر [\_مرحلهای دقیق = 1](../../operations/settings/settings.md) ستون هایی که ندارند `DEFAULT` تعریف شده باید در پرس و جو ذکر شده است. - -داده ها را می توان به درج در هر گذشت [قالب](../../interfaces/formats.md#formats) پشتیبانی شده توسط فاحشه خانه. قالب باید به صراحت در پرس و جو مشخص شود: - -``` sql -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: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -تاتر حذف تمام فضاها و خوراک یک خط (در صورتی که وجود دارد) قبل از داده ها. هنگام تشکیل یک پرس و جو, توصیه می کنیم قرار دادن داده ها بر روی یک خط جدید پس از اپراتورهای پرس و جو (این مهم است که اگر داده ها با فضاهای شروع می شود). - -مثال: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -شما می توانید داده ها را به طور جداگانه از پرس و جو با استفاده از مشتری خط فرمان یا رابط اچ تی پی وارد کنید. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “[واسط](../../interfaces/index.md#interfaces)”. - -### قیدها {#constraints} - -اگر جدول [قیدها](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. - -### قرار دادن نتایج `SELECT` {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -ستون ها با توجه به موقعیت خود را در بند را انتخاب کنید نقشه برداری. با این حال, نام خود را در عبارت را انتخاب کنید و جدول برای درج ممکن است متفاوت باشد. در صورت لزوم نوع ریخته گری انجام می شود. - -هیچ یک از فرمت های داده به جز مقادیر اجازه تنظیم مقادیر به عبارات مانند `now()`, `1 + 2` و به همین ترتیب. فرمت ارزش اجازه می دهد تا استفاده محدود از عبارات, اما این توصیه نمی شود, چرا که در این مورد کد کم است برای اجرای خود استفاده می شود. - -نمایش داده شد دیگر برای تغییر قطعات داده ها پشتیبانی نمی شوند: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. -با این حال, شما می توانید داده های قدیمی با استفاده از حذف `ALTER TABLE ... DROP PARTITION`. - -`FORMAT` بند باید در پایان پرس و جو مشخص شود اگر `SELECT` بند شامل تابع جدول [ورودی()](../table_functions/input.md). - -### ملاحظات عملکرد {#performance-considerations} - -`INSERT` داده های ورودی را با کلید اصلی مرتب می کند و توسط یک کلید پارتیشن به پارتیشن تقسیم می شود. اگر داده ها را به چندین پارتیشن در یک بار وارد کنید می تواند به طور قابل توجهی عملکرد را کاهش دهد `INSERT` پرس و جو. برای جلوگیری از این: - -- اضافه کردن داده ها در دسته نسبتا بزرگ, مانند 100,000 ردیف در یک زمان. -- داده های گروه توسط یک کلید پارتیشن قبل از بارگذاری به کلیک. - -عملکرد کاهش نخواهد یافت اگر: - -- داده ها در زمان واقعی اضافه شده است. -- شما داده ها است که معمولا بر اساس زمان طبقه بندی شده اند را بارگذاری کنید. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/fa/sql_reference/statements/misc.md b/docs/fa/sql_reference/statements/misc.md deleted file mode 100644 index 113c3e7173d..00000000000 --- a/docs/fa/sql_reference/statements/misc.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u063A\u06CC\u0631\u0647" ---- - -# متفرقه نمایش داده شد {#miscellaneous-queries} - -## ATTACH {#attach} - -این پرس و جو دقیقا همان است `CREATE` اما - -- به جای کلمه `CREATE` با استفاده از این کلمه `ATTACH`. -- پرس و جو می کند داده ها بر روی دیسک ایجاد کنید, اما فرض می شود که داده ها در حال حاضر در مکان های مناسب, و فقط می افزاید: اطلاعات در مورد جدول به سرور. - پس از اجرای یک ضمیمه پرس و جو در سرور خواهد شد در مورد وجود جدول. - -اگر جدول قبلا جدا شد (`DETACH`), به این معنی که ساختار خود شناخته شده است, شما می توانید مختصر بدون تعریف ساختار استفاده. - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -این پرس و جو در هنگام شروع سرور استفاده می شود. سرور ذخیره ابرداده جدول به عنوان فایل های با `ATTACH` نمایش داده شد, که به سادگی در راه اندازی اجرا می شود (به غیر از جداول سیستم, که به صراحت بر روی سرور ایجاد). - -## CHECK TABLE {#check-table} - -چک اگر داده ها در جدول خراب شده است. - -``` sql -CHECK TABLE [db.]name -``` - -این `CHECK TABLE` پرس و جو اندازه فایل واقعی با مقادیر مورد انتظار که بر روی سرور ذخیره می شود مقایسه می کند. اگر اندازه فایل انجام مقادیر ذخیره شده مطابقت ندارد, به این معنی که داده ها خراب شده است. این می تواند باعث, مثلا, توسط یک تصادف سیستم در طول اجرای پرس و جو. - -پاسخ پرس و جو شامل `result` ستون با یک ردیف. ردیف دارای ارزش -[بولی](../../sql_reference/data_types/boolean.md) نوع: - -- 0-داده ها در جدول خراب شده است. -- 1-داده حفظ یکپارچگی. - -این `CHECK TABLE` پرس و جو از موتورهای جدول زیر پشتیبانی می کند: - -- [ثبت](../../engines/table_engines/log_family/log.md) -- [جمع شدن](../../engines/table_engines/log_family/tinylog.md) -- [خط زدن](../../engines/table_engines/log_family/stripelog.md) -- [ادغام خانواده](../../engines/table_engines/mergetree_family/mergetree.md) - -انجام بیش از جداول با موتورهای جدول دیگر باعث یک استثنا. - -موتورهای از `*Log` خانواده بازیابی اطلاعات خودکار در شکست را فراهم نمی کند. استفاده از `CHECK TABLE` پرس و جو برای پیگیری از دست دادن داده ها به موقع. - -برای `MergeTree` موتورهای خانواده `CHECK TABLE` پرس و جو نشان می دهد وضعیت چک برای هر بخش داده های فردی از یک جدول بر روی سرور محلی. - -**اگر داده ها خراب شده است** - -اگر جدول خراب شده است, شما می توانید داده های غیر خراب به جدول دیگر کپی کنید. برای انجام این کار: - -1. ایجاد یک جدول جدید با ساختار همان جدول صدمه دیده است. برای انجام این کار پرس و جو را اجرا کنید `CREATE TABLE AS `. -2. تنظیم [\_مخفی کردن](../../operations/settings/settings.md#settings-max_threads) ارزش به 1 برای پردازش پرس و جو بعدی در یک موضوع واحد. برای انجام این کار پرس و جو را اجرا کنید `SET max_threads = 1`. -3. اجرای پرسوجو `INSERT INTO SELECT * FROM `. این درخواست داده های غیر خراب شده را از جدول خراب شده به جدول دیگر کپی می کند. فقط داده ها قبل از قسمت خراب کپی خواهد شد. -4. راه اندازی مجدد `clickhouse-client` برای تنظیم مجدد `max_threads` ارزش. - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -بازگرداندن موارد زیر `String` نوع ستونها: - -- `name` — Column name. -- `type`— Column type. -- `default_type` — Clause that is used in [عبارت پیشفرض](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` یا `ALIAS`). ستون شامل یک رشته خالی, اگر عبارت پیش فرض مشخص نشده است. -- `default_expression` — Value specified in the `DEFAULT` بند بند. -- `comment_expression` — Comment text. - -ساختارهای داده تو در تو خروجی در “expanded” قالب. هر ستون به طور جداگانه نشان داده شده است, با نام بعد از یک نقطه. - -## DETACH {#detach} - -حذف اطلاعات در مورد ‘name’ جدول از سرور. سرور متوقف می شود دانستن در مورد وجود جدول. - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -این داده ها و یا ابرداده جدول را حذف کنید. در راه اندازی سرور بعدی, سرور خواهد ابرداده به عنوان خوانده شده و پیدا کردن در مورد جدول دوباره. -به طور مشابه “detached” جدول را می توان دوباره متصل با استفاده از `ATTACH` پرس و جو (به غیر از جداول سیستم که لازم نیست metadata ذخیره شده برای آنها). - -وجود ندارد `DETACH DATABASE` پرس و جو. - -## DROP {#drop} - -این پرسوجو دارای دو نوع است: `DROP DATABASE` و `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -حذف تمام جداول در داخل ‘db’ پایگاه داده, سپس حذف ‘db’ پایگاه داده خود را. -اگر `IF EXISTS` مشخص شده است, این خطا بازگشت نیست اگر پایگاه داده وجود ندارد. - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -حذف جدول. -اگر `IF EXISTS` مشخص شده است, این خطا را نمی گرداند اگر جدول وجود ندارد و یا پایگاه داده وجود ندارد. - - DROP DICTIONARY [IF EXISTS] [db.]name - -دلس فرهنگ لغت. -اگر `IF EXISTS` مشخص شده است, این خطا را نمی گرداند اگر جدول وجود ندارد و یا پایگاه داده وجود ندارد. - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -بازگرداندن یک `UInt8`- نوع ستون, که شامل ارزش واحد `0` اگر جدول یا پایگاه داده وجود ندارد, یا `1` اگر جدول در پایگاه داده مشخص شده وجود دارد. - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -تلاش برای به زور خاتمه نمایش داده شد در حال حاضر در حال اجرا. -نمایش داده شد به فسخ از سیستم انتخاب شده است.جدول پردازش ها با استفاده از معیارهای تعریف شده در `WHERE` بند از `KILL` پرس و جو. - -مثالها: - -``` sql --- Forcibly terminates all queries with the specified query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Synchronously terminates all queries run by 'username': -KILL QUERY WHERE user='username' SYNC -``` - -فقط خواندنی کاربران تنها می تواند نمایش داده شد خود را متوقف کند. - -به طور پیش فرض, نسخه ناهمزمان از نمایش داده شد استفاده شده است (`ASYNC`), که برای تایید است که نمایش داده شد را متوقف کرده اند منتظر نیست. - -نسخه همزمان (`SYNC`) منتظر تمام نمایش داده شد برای متوقف کردن و نمایش اطلاعات در مورد هر فرایند به عنوان متوقف می شود. -پاسخ شامل `kill_status` ستون, که می تواند مقادیر زیر را: - -1. ‘finished’ – The query was terminated successfully. -2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. -3. The other values ​​explain why the query can't be stopped. - -پرسوجوی تست (`TEST`) فقط چک حقوق کاربر و نمایش یک لیست از نمایش داده شد برای متوقف کردن. - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -تلاش برای لغو و حذف [جهشها](alter.md#alter-mutations) که در حال حاضر اجرای. جهش به لغو از انتخاب [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) جدول با استفاده از فیلتر مشخص شده توسط `WHERE` بند از `KILL` پرس و جو. - -آزمون پرس و جو (`TEST`) فقط چک حقوق کاربر و نمایش یک لیست از نمایش داده شد برای متوقف کردن. - -مثالها: - -``` sql --- Cancel and remove all mutations of the single table: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Cancel the specific mutation: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). - -تغییرات در حال حاضر توسط جهش ساخته شده به عقب نورد نیست. - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -این پرس و جو تلاش می کند تا ادغام برنامه ریزی نشده از قطعات داده برای جداول با یک موتور جدول از [ادغام](../../engines/table_engines/mergetree_family/mergetree.md) خانواده - -این `OPTMIZE` پرس و جو نیز برای پشتیبانی [ماده بینی](../../engines/table_engines/special/materializedview.md) و [بافر](../../engines/table_engines/special/buffer.md) موتورها. دیگر موتورهای جدول پشتیبانی نمی شوند. - -زمانی که `OPTIMIZE` با استفاده از [تکرار غذای اصلی](../../engines/table_engines/mergetree_family/replication.md) خانواده از موتورهای جدول, تاتر ایجاد یک کار برای ادغام و منتظر اعدام در تمام گره (در صورتی که `replication_alter_partitions_sync` تنظیم فعال است). - -- اگر `OPTIMIZE` یک ادغام به هر دلیلی انجام نمی, این کار مشتری اطلاع نیست. برای فعال کردن اعلان ها از [ا\_فزون\_ف\_کوپ](../../operations/settings/settings.md#setting-optimize_throw_if_noop) تنظیمات. -- اگر شما یک مشخص `PARTITION` فقط پارتیشن مشخص شده بهینه شده است. [نحوه تنظیم بیان پارتیشن](alter.md#alter-how-to-specify-part-expr). -- اگر شما مشخص کنید `FINAL` حتی زمانی که تمام داده ها در حال حاضر در یک بخش بهینه سازی انجام شده است. -- اگر شما مشخص کنید `DEDUPLICATE` و سپس به طور کامل یکسان ردیف خواهد بود deduplicated (تمام ستون ها در مقایسه با) آن را حس می کند تنها برای MergeTree موتور. - -!!! warning "اخطار" - `OPTIMIZE` می توانید رفع نیست “Too many parts” خطا. - -## RENAME {#misc_operations-rename} - -تغییر نام یک یا چند جدول. - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -همه جداول تحت قفل جهانی تغییر نام داد. تغییر نام جداول یک عملیات نور است. اگر شما یک پایگاه داده دیگر نشان داد پس از به, جدول خواهد شد به این پایگاه داده منتقل. اما, دایرکتوری ها با پایگاه داده باید اقامت در همان فایل سیستم (در غیر این صورت یک خطا بازگشته است). - -## SET {#query-set} - -``` sql -SET param = value -``` - -انتساب `value` به `param` [تنظیم](../../operations/settings/index.md) برای جلسه فعلی. شما نمی توانید تغییر دهید [تنظیمات سرور](../../operations/server_configuration_parameters/index.md) از این طرف - -شما همچنین می توانید تمام مقادیر را از مشخصات تنظیمات مشخص شده در یک پرس و جو واحد تنظیم کنید. - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -برای کسب اطلاعات بیشتر, دیدن [تنظیمات](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -حذف تمام داده ها را از یک جدول. هنگامی که بند `IF EXISTS` حذف شده است, پرس و جو یک خطا می گرداند اگر جدول وجود ندارد. - -این `TRUNCATE` پرسوجو برای پشتیبانی نمیشود [مشاهده](../../engines/table_engines/special/view.md), [پرونده](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) و [خالی](../../engines/table_engines/special/null.md) موتورهای جدول. - -## USE {#use} - -``` sql -USE db -``` - -به شما اجازه می دهد پایگاه داده فعلی را برای جلسه تنظیم کنید. -پایگاه داده فعلی برای جستجو برای جداول استفاده می شود اگر پایگاه داده به صراحت در پرس و جو با یک نقطه قبل از نام جدول تعریف نشده است. -این پرس و جو را نمی توان در هنگام استفاده از پروتکل قام ساخته شده, از هیچ مفهوم یک جلسه وجود دارد. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/fa/sql_reference/statements/select.md b/docs/fa/sql_reference/statements/select.md deleted file mode 100644 index a1f0a833e3f..00000000000 --- a/docs/fa/sql_reference/statements/select.md +++ /dev/null @@ -1,610 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: SELECT ---- - -# نحو نمایش داده شد را انتخاب کنید {#select-queries-syntax} - -`SELECT` بازیابی داده ها را انجام می دهد. - -``` sql -[WITH expr_list|(subquery)] -SELECT [DISTINCT] expr_list -[FROM [db.]table | (subquery) | table_function] [FINAL] -[SAMPLE sample_coeff] -[ARRAY JOIN ...] -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list -[PREWHERE expr] -[WHERE expr] -[GROUP BY expr_list] [WITH TOTALS] -[HAVING expr] -[ORDER BY expr_list] -[LIMIT [offset_value, ]n BY columns] -[LIMIT [n, ]m] -[UNION ALL ...] -[INTO OUTFILE filename] -[FORMAT format] -``` - -همه بند اختیاری هستند, به جز برای لیست مورد نیاز از عبارات بلافاصله پس از انتخاب. -بند های زیر تقریبا به همان ترتیب در نوار نقاله اجرای پرس و جو توصیف می شوند. - -اگر پرس و جو حذف `DISTINCT`, `GROUP BY` و `ORDER BY` بند و `IN` و `JOIN` subqueries این پرس و جو خواهد شد به طور کامل جریان پردازش با استفاده از O(1) میزان رم. -در غیر این صورت, پرس و جو ممکن است مقدار زیادی از رم مصرف اگر محدودیت های مناسب مشخص نشده است: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “Settings”. ممکن است که به استفاده از مرتب سازی خارجی (صرفه جویی در جداول موقت به یک دیسک) و تجمع خارجی. `The system does not have "merge join"`. - -### با بند {#with-clause} - -در این بخش پشتیبانی از عبارات جدول مشترک فراهم می کند ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), با برخی از محدودیت: -1. نمایش داده شد بازگشتی پشتیبانی نمی شوند -2. هنگامی که زیرخاکری در داخل با بخش استفاده می شود, این نتیجه باید اسکالر با دقیقا یک ردیف باشد -3. بیان نتایج در دسترس نیست در subqueries -نتایج با عبارات بند را می توان در داخل بند را انتخاب کنید استفاده می شود. - -مثال 1: با استفاده از عبارت ثابت به عنوان “variable” - -``` sql -WITH '2019-08-01 15:23:00' as ts_upper_bound -SELECT * -FROM hits -WHERE - EventDate = toDate(ts_upper_bound) AND - EventTime <= ts_upper_bound -``` - -مثال 2: جمع تخلیه(بایت) نتیجه بیان از بند لیست ستون را انتخاب کنید - -``` sql -WITH sum(bytes) as s -SELECT - formatReadableSize(s), - table -FROM system.parts -GROUP BY table -ORDER BY s -``` - -مثال 3: استفاده از نتایج عددی پرس - -``` sql -/* this example would return TOP 10 of most huge tables */ -WITH - ( - SELECT sum(bytes) - FROM system.parts - WHERE active - ) AS total_disk_usage -SELECT - (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, - table -FROM system.parts -GROUP BY table -ORDER BY table_disk_usage DESC -LIMIT 10 -``` - -مثال 4: استفاده مجدد از بیان در زیرخاکری -به عنوان یک راهحل برای محدودیت کنونی برای بیان استفاده در subqueries شما ممکن است تکراری است. - -``` sql -WITH ['hello'] AS hello -SELECT - hello, - * -FROM -( - WITH ['hello'] AS hello - SELECT hello -) -``` - -``` text -┌─hello─────┬─hello─────┐ -│ ['hello'] │ ['hello'] │ -└───────────┴───────────┘ -``` - -### از بند {#select-from} - -اگر از بند حذف شده است, داده خواهد شد از خواندن `system.one` جدول -این `system.one` جدول شامل دقیقا یک ردیف است (این جدول همان هدف را به عنوان جدول دوگانه موجود در سایر دساماسها انجام می دهد). - -این `FROM` بند منبع برای خواندن داده ها از مشخص: - -- جدول -- خرده فروشی -- [تابع جدول](../table_functions/index.md) - -`ARRAY JOIN` و به طور منظم `JOIN` همچنین ممکن است شامل شود (پایین را ببینید). - -به جای یک جدول `SELECT` خرده فروشی ممکن است در پرانتز مشخص. -در مقابل به گذاشتن استاندارد, مترادف نیازی به پس از یک خرده فروشی مشخص شود. - -برای اجرای پرس و جو تمام ستون های ذکر شده در پرس و جو از جدول مناسب استخراج می شوند. هر ستون برای پرس و جو خارجی مورد نیاز نیست از کارخانه های فرعی پرتاب می شود. -اگر پرس و جو هیچ ستون لیست نیست (به عنوان مثال, `SELECT count() FROM t`), برخی از ستون از جدول استخراج به هر حال (کوچکترین ترجیح داده می شود), به منظور محاسبه تعداد ردیف. - -#### تغییردهنده نهایی {#select-from-final} - -قابل استفاده در هنگام انتخاب داده ها از جداول از [ادغام](../../engines/table_engines/mergetree_family/mergetree.md)- خانواده موتور غیر از `GraphiteMergeTree`. چه زمانی `FINAL` مشخص شده است, تاتر به طور کامل ادغام داده ها قبل از بازگشت به نتیجه و در نتیجه انجام تمام تحولات داده که در طول ادغام برای موتور جدول داده شده اتفاق می افتد. - -همچنین برای پشتیبانی: -- [تکرار](../../engines/table_engines/mergetree_family/replication.md) نسخه های `MergeTree` موتورها. -- [نما](../../engines/table_engines/special/view.md), [بافر](../../engines/table_engines/special/buffer.md), [توزیع شده](../../engines/table_engines/special/distributed.md) و [ماده بینی](../../engines/table_engines/special/materializedview.md) موتورها که بیش از موتورهای دیگر کار می کنند به شرطی که بیش از ایجاد شده اند `MergeTree`- جدول موتور . - -نمایش داده شد که با استفاده از `FINAL` اعدام به همان سرعتی که نمایش داده شد مشابه که نمی, زیرا: - -- پرس و جو در یک موضوع اجرا و داده ها در طول اجرای پرس و جو با هم ادغام شدند. -- نمایش داده شد با `FINAL` خوانده شده ستون کلید اولیه در علاوه بر این به ستون مشخص شده در پرس و جو. - -در بیشتر موارد, اجتناب از استفاده از `FINAL`. - -### بند نمونه {#select-sample-clause} - -این `SAMPLE` بند اجازه می دهد تا برای پردازش پرس و جو تقریبی. - -هنگامی که نمونه گیری داده ها فعال است, پرس و جو بر روی تمام داده ها انجام نمی, اما تنها در بخش خاصی از داده ها (نمونه). مثلا, اگر شما نیاز به محاسبه ارقام برای تمام بازدیدکننده داشته است, کافی است برای اجرای پرس و جو در 1/10 کسری از تمام بازدیدکننده داشته است و سپس ضرب در نتیجه 10. - -پردازش پرس و جو تقریبی می تواند در موارد زیر مفید باشد: - -- هنگامی که شما شرایط زمان بندی دقیق (مانند \<100 مگابایت) اما شما نمی توانید هزینه منابع سخت افزاری اضافی را برای دیدار با خود توجیه کنید. -- هنگامی که داده های خام خود را دقیق نیست, بنابراین تقریب می کند به طرز محسوسی کاهش کیفیت. -- نیازهای کسب و کار هدف تقریبی نتایج (برای مقرون به صرفه بودن و یا به منظور به بازار دقیق نتایج به کاربران حق بیمه). - -!!! note "یادداشت" - شما فقط می توانید نمونه برداری با استفاده از جداول در [ادغام](../../engines/table_engines/mergetree_family/mergetree.md) خانواده, و تنها در صورتی که بیان نمونه برداری در ایجاد جدول مشخص شد (دیدن [موتور ادغام](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table)). - -ویژگی های نمونه گیری داده ها به شرح زیر است: - -- نمونهگیری دادهها یک مکانیسم قطعی است. نتیجه همان `SELECT .. SAMPLE` پرس و جو همیشه یکسان است. -- نمونه گیری به طور مداوم برای جداول مختلف کار می کند. برای جداول با یک کلید نمونه برداری تک, یک نمونه با ضریب همان همیشه زیر مجموعه همان داده های ممکن را انتخاب. برای مثال یک نمونه از شناسه های کاربر طول می کشد ردیف با همان زیر مجموعه از همه ممکن است شناسه کاربر از جداول مختلف. این به این معنی است که شما می توانید نمونه در کارخانه های فرعی در استفاده از [IN](#select-in-operators) بند بند. همچنین شما می توانید نمونه ها را با استفاده از [JOIN](#select-join) بند بند. -- نمونه گیری اجازه می دهد تا خواندن اطلاعات کمتر از یک دیسک. توجه داشته باشید که شما باید کلید نمونه برداری به درستی مشخص کنید. برای کسب اطلاعات بیشتر, دیدن [ایجاد یک جدول ادغام](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -برای `SAMPLE` بند نحو زیر پشتیبانی می شود: - -| SAMPLE Clause Syntax | توصیف | -|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `SAMPLE k` | اینجا `k` است تعداد از 0 به 1.
پرس و جو در اجرا `k` کسری از داده ها. به عنوان مثال, `SAMPLE 0.1` پرس و جو را در 10 درصد از داده ها اجرا می کند. [ادامه مطلب](#select-sample-k) | -| `SAMPLE n` | اینجا `n` عدد صحیح به اندازه کافی بزرگ است.
پرس و جو بر روی یک نمونه از حداقل اعدام `n` ردیف (اما نه به طور قابل توجهی بیشتر از این). به عنوان مثال, `SAMPLE 10000000` پرس و جو را در حداقل ردیف های 10000000 اجرا می کند. [ادامه مطلب](#select-sample-n) | -| `SAMPLE k OFFSET m` | اینجا `k` و `m` اعداد از 0 به 1.
پرس و جو بر روی یک نمونه از اعدام `k` کسری از داده ها. داده های مورد استفاده برای نمونه توسط جبران `m` کسر کردن. [ادامه مطلب](#select-sample-offset) | - -#### SAMPLE K {#select-sample-k} - -اینجا `k` است تعداد از 0 به 1 (هر دو نمادهای کسری و اعشاری پشتیبانی می شوند). به عنوان مثال, `SAMPLE 1/2` یا `SAMPLE 0.5`. - -در یک `SAMPLE k` بند, نمونه از گرفته `k` کسری از داده ها. مثال زیر نشان داده شده است: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -در این مثال پرس و جو اجرا شده است در یک نمونه از 0.1 (10%) از داده ها. ارزش توابع دانه ها به طور خودکار اصلاح نمی, بنابراین برای دریافت یک نتیجه تقریبی, ارزش `count()` به صورت دستی توسط ضرب 10. - -#### SAMPLE N {#select-sample-n} - -اینجا `n` عدد صحیح به اندازه کافی بزرگ است. به عنوان مثال, `SAMPLE 10000000`. - -در این مورد, پرس و جو بر روی یک نمونه از حداقل اعدام `n` ردیف (اما نه به طور قابل توجهی بیشتر از این). به عنوان مثال, `SAMPLE 10000000` پرس و جو را در حداقل ردیف های 10000000 اجرا می کند. - -از حداقل واحد برای خواندن داده ها یک گرانول است (اندازه خود را توسط مجموعه `index_granularity` تنظیم), این را حس می کند به مجموعه ای از یک نمونه است که بسیار بزرگتر از اندازه گرانول. - -هنگام استفاده از `SAMPLE n` بند, شما نمی دانید که درصد نسبی داده پردازش شد. بنابراین شما نمی دانید ضریب توابع کل باید توسط ضرب. استفاده از `_sample_factor` ستون مجازی برای دریافت نتیجه تقریبی. - -این `_sample_factor` ستون شامل ضرایب نسبی است که به صورت پویا محاسبه می شود. این ستون به طور خودکار ایجاد زمانی که شما [ایجاد](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table) یک جدول با کلید نمونه گیری مشخص. نمونه های استفاده از `_sample_factor` ستون در زیر نشان داده شده. - -بیایید جدول را در نظر بگیریم `visits`, که شامل ارقام در مورد بازدیدکننده داشته است سایت. مثال اول نشان می دهد که چگونه برای محاسبه تعداد بازدید از صفحه: - -``` sql -SELECT sum(PageViews * _sample_factor) -FROM visits -SAMPLE 10000000 -``` - -مثال بعدی نشان می دهد که چگونه برای محاسبه تعداد کل بازدیدکننده داشته است: - -``` sql -SELECT sum(_sample_factor) -FROM visits -SAMPLE 10000000 -``` - -مثال زیر نشان می دهد که چگونه برای محاسبه مدت زمان جلسه به طور متوسط. توجه داشته باشید که شما لازم نیست به استفاده از ضریب نسبی برای محاسبه مقادیر متوسط. - -``` sql -SELECT avg(Duration) -FROM visits -SAMPLE 10000000 -``` - -#### SAMPLE K OFFSET M {#select-sample-offset} - -اینجا `k` و `m` اعداد از 0 به 1. نمونه های زیر نشان داده شده. - -**مثال 1** - -``` sql -SAMPLE 1/10 -``` - -در این مثال نمونه 1 / 10 از تمام داده ها است: - -`[++------------]` - -**مثال 2** - -``` sql -SAMPLE 1/10 OFFSET 1/2 -``` - -در اینجا یک نمونه از 10 درصد گرفته شده از نیمه دوم از داده ها. - -`[------++------]` - -### مجموعه پیوستن بند {#select-array-join-clause} - -اجازه می دهد تا اجرای `JOIN` با یک آرایه یا تو در تو ساختار داده ها. قصد این است که شبیه به [ارریجین](../../sql_reference/functions/array_join.md#functions_arrayjoin) تابع, اما قابلیت های خود را گسترده تر است. - -``` sql -SELECT -FROM -[LEFT] ARRAY JOIN -[WHERE|PREWHERE ] -... -``` - -شما می توانید تنها یک مشخص `ARRAY JOIN` بند در یک پرس و جو. - -سفارش اجرای پرس و جو در هنگام اجرا بهینه شده است `ARRAY JOIN`. اگرچه `ARRAY JOIN` همیشه باید قبل از مشخص شود `WHERE/PREWHERE` بند, این می تواند انجام شود یا قبل از `WHERE/PREWHERE` (اگر نتیجه در این بند مورد نیاز است), و یا پس از اتمام (برای کاهش حجم محاسبات). سفارش پردازش توسط بهینه ساز پرس و جو کنترل می شود. - -انواع پشتیبانی شده از `ARRAY JOIN` به شرح زیر است: - -- `ARRAY JOIN` - در این مورد, بند خالی در نتیجه شامل نمی شود `JOIN`. -- `LEFT ARRAY JOIN` - نتیجه `JOIN` شامل ردیف با ارریس خالی است. مقدار برای یک مجموعه خالی است به مقدار پیش فرض برای نوع عنصر مجموعه (معمولا 0, رشته خالی و یا تهی). - -نمونه های زیر نشان می دهد استفاده از `ARRAY JOIN` و `LEFT ARRAY JOIN` بند. بیایید یک جدول با یک [& حذف](../../sql_reference/data_types/array.md) ستون را تایپ کنید و مقادیر را وارد کنید: - -``` sql -CREATE TABLE arrays_test -( - s String, - arr Array(UInt8) -) ENGINE = Memory; - -INSERT INTO arrays_test -VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); -``` - -``` text -┌─s───────────┬─arr─────┐ -│ Hello │ [1,2] │ -│ World │ [3,4,5] │ -│ Goodbye │ [] │ -└─────────────┴─────────┘ -``` - -مثال زیر از `ARRAY JOIN` بند: - -``` sql -SELECT s, arr -FROM arrays_test -ARRAY JOIN arr; -``` - -``` text -┌─s─────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -└───────┴─────┘ -``` - -مثال بعدی با استفاده از `LEFT ARRAY JOIN` بند: - -``` sql -SELECT s, arr -FROM arrays_test -LEFT ARRAY JOIN arr; -``` - -``` text -┌─s───────────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -│ Goodbye │ 0 │ -└─────────────┴─────┘ -``` - -#### استفاده از نام مستعار {#using-aliases} - -یک نام مستعار می تواند برای مجموعه ای در `ARRAY JOIN` بند بند. در این مورد, یک مورد مجموعه ای را می توان با این نام مستعار دیده, اما مجموعه خود را با نام اصلی قابل دسترسی. مثال: - -``` sql -SELECT s, arr, a -FROM arrays_test -ARRAY JOIN arr AS a; -``` - -``` text -┌─s─────┬─arr─────┬─a─┐ -│ Hello │ [1,2] │ 1 │ -│ Hello │ [1,2] │ 2 │ -│ World │ [3,4,5] │ 3 │ -│ World │ [3,4,5] │ 4 │ -│ World │ [3,4,5] │ 5 │ -└───────┴─────────┴───┘ -``` - -با استفاده از نام مستعار, شما می توانید انجام `ARRAY JOIN` با یک مجموعه خارجی. به عنوان مثال: - -``` sql -SELECT s, arr_external -FROM arrays_test -ARRAY JOIN [1, 2, 3] AS arr_external; -``` - -``` text -┌─s───────────┬─arr_external─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ Hello │ 3 │ -│ World │ 1 │ -│ World │ 2 │ -│ World │ 3 │ -│ Goodbye │ 1 │ -│ Goodbye │ 2 │ -│ Goodbye │ 3 │ -└─────────────┴──────────────┘ -``` - -ارریس های متعدد را می توان با کاما از هم جدا در `ARRAY JOIN` بند بند. در این مورد, `JOIN` به طور همزمان (مجموع مستقیم و نه محصول دکارتی) انجام می شود. توجه داشته باشید که تمام ارریس باید به همان اندازه. مثال: - -``` sql -SELECT s, arr, a, num, mapped -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ -│ Hello │ [1,2] │ 1 │ 1 │ 2 │ -│ Hello │ [1,2] │ 2 │ 2 │ 3 │ -│ World │ [3,4,5] │ 3 │ 1 │ 4 │ -│ World │ [3,4,5] │ 4 │ 2 │ 5 │ -│ World │ [3,4,5] │ 5 │ 3 │ 6 │ -└───────┴─────────┴───┴─────┴────────┘ -``` - -مثال زیر از [شناسه بسته:](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) تابع: - -``` sql -SELECT s, arr, a, num, arrayEnumerate(arr) -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ -│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ -│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ -│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ -│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ -│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ -└───────┴─────────┴───┴─────┴─────────────────────┘ -``` - -#### مجموعه پیوستن با ساختار داده های تو در تو {#array-join-with-nested-data-structure} - -`ARRAY`پیوستن " همچنین با این نسخهها کار [ساختارهای داده تو در تو](../../sql_reference/data_types/nested_data_structures/nested.md). مثال: - -``` sql -CREATE TABLE nested_test -( - s String, - nest Nested( - x UInt8, - y UInt32) -) ENGINE = Memory; - -INSERT INTO nested_test -VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); -``` - -``` text -┌─s───────┬─nest.x──┬─nest.y─────┐ -│ Hello │ [1,2] │ [10,20] │ -│ World │ [3,4,5] │ [30,40,50] │ -│ Goodbye │ [] │ [] │ -└─────────┴─────────┴────────────┘ -``` - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -هنگام مشخص کردن نام ساختارهای داده های تو در تو در `ARRAY JOIN`, معنای همان است که `ARRAY JOIN` با تمام عناصر مجموعه ای که شامل. نمونه به شرح زیر است: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`, `nest.y`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -این تنوع نیز حس می کند: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─────┐ -│ Hello │ 1 │ [10,20] │ -│ Hello │ 2 │ [10,20] │ -│ World │ 3 │ [30,40,50] │ -│ World │ 4 │ [30,40,50] │ -│ World │ 5 │ [30,40,50] │ -└───────┴────────┴────────────┘ -``` - -نام مستعار ممکن است برای یک ساختار داده های تو در تو استفاده می شود, به منظور انتخاب هر دو `JOIN` نتیجه یا مجموعه منبع. مثال: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest AS n; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ -└───────┴─────┴─────┴─────────┴────────────┘ -``` - -نمونه ای از استفاده از [شناسه بسته:](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) تابع: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num -FROM nested_test -ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ -└───────┴─────┴─────┴─────────┴────────────┴─────┘ -``` - -### پیوستن بند {#select-join} - -می پیوندد داده ها در عادی [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) با عقل. - -!!! info "یادداشت" - نه مربوط به [ARRAY JOIN](#select-array-join-clause). - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN -(ON )|(USING ) ... -``` - -نام جدول را می توان به جای مشخص `` و ``. این معادل است `SELECT * FROM table` خرده فروشی, به جز در یک مورد خاص زمانی که جدول است [پیوستن](../../engines/table_engines/special/join.md) engine – an array prepared for joining. - -#### انواع پشتیبانی شده از `JOIN` {#select-join-types} - -- `INNER JOIN` (یا `JOIN`) -- `LEFT JOIN` (یا `LEFT OUTER JOIN`) -- `RIGHT JOIN` (یا `RIGHT OUTER JOIN`) -- `FULL JOIN` (یا `FULL OUTER JOIN`) -- `CROSS JOIN` (یا `,` ) - -مشاهده استاندارد [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) توصیف. - -#### چند پیوستن {#multiple-join} - -انجام نمایش داده شد, بازنویسی کلیک خانه چند جدول می پیوندد به دنباله ای از دو جدول می پیوندد. مثلا, اگر چهار جدول برای عضویت کلیک خانه می پیوندد اول و دوم وجود دارد, سپس نتیجه می پیوندد با جدول سوم, و در مرحله گذشته, می پیوندد یک چهارم. - -اگر پرس و جو شامل `WHERE` بند ClickHouse تلاش می کند به pushdown فیلتر از این بند از طریق متوسط پیوستن به. اگر می تواند فیلتر به هر ملحق متوسط اعمال می شود, تاتر اعمال فیلتر بعد از همه می پیوندد به پایان رسید. - -ما توصیه می کنیم `JOIN ON` یا `JOIN USING` نحو برای ایجاد نمایش داده شد. به عنوان مثال: - -``` sql -SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a -``` - -شما می توانید لیست کاما از هم جدا از جداول در استفاده از `FROM` بند بند. به عنوان مثال: - -``` sql -SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a -``` - -این سینتکس را مخلوط نکنید. - -کلیکهاوس مستقیما از دستورات ارتباطی با کاما پشتیبانی نمی کند بنابراین توصیه نمی کنیم از انها استفاده کنید. الگوریتم تلاش می کند به بازنویسی پرس و جو از نظر `CROSS JOIN` و `INNER JOIN` بند و سپس به پرس و جو پردازش. هنگامی که بازنویسی پرس و جو, تاتر تلاش می کند برای بهینه سازی عملکرد و مصرف حافظه. به طور پیش فرض, تاتر رفتار کاما به عنوان یک `INNER JOIN` بند و تبدیل `INNER JOIN` به `CROSS JOIN` هنگامی که الگوریتم نمی تواند تضمین کند که `INNER JOIN` بازگرداندن اطلاعات مورد نیاز. - -#### سختی {#select-join-strictness} - -- `ALL` — If the right table has several matching rows, ClickHouse creates a [محصول دکارتی](https://en.wikipedia.org/wiki/Cartesian_product) از تطبیق ردیف. این استاندارد است `JOIN` رفتار در گذاشتن. -- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` و `ALL` کلمات کلیدی یکسان هستند. -- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` استفاده در زیر توضیح داده شده است. - -**از این رو پیوستن به استفاده** - -`ASOF JOIN` مفید است زمانی که شما نیاز به پیوستن به سوابق که هیچ بازی دقیق. - -جداول برای `ASOF JOIN` باید یک ستون توالی دستور داده اند. این ستون نمی تواند به تنهایی در یک جدول باشد و باید یکی از انواع داده ها باشد: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date` و `DateTime`. - -نحو `ASOF JOIN ... ON`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF LEFT JOIN table_2 -ON equi_cond AND closest_match_cond -``` - -شما می توانید هر تعداد از شرایط برابری و دقیقا یکی از نزدیک ترین شرایط بازی استفاده کنید. به عنوان مثال, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. - -شرایط پشتیبانی شده برای نزدیک ترین بازی: `>`, `>=`, `<`, `<=`. - -نحو `ASOF JOIN ... USING`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF JOIN table_2 -USING (equi_column1, ... equi_columnN, asof_column) -``` - -`ASOF JOIN` استفاده `equi_columnX` برای پیوستن به برابری و `asof_column` برای پیوستن به نزدیک ترین مسابقه با `table_1.asof_column >= table_2.asof_column` شرط. این `asof_column` ستون همیشه یکی از گذشته در `USING` بند بند. - -مثلا, جداول زیر را در نظر بگیرید: - -"'متن -table\_1 table\_2 - -رویداد \| عصر / رویداد فراسوی / عصر / شناسه diff --git a/docs/fa/sql_reference/statements/show.md b/docs/fa/sql_reference/statements/show.md deleted file mode 100644 index 19b6fa5b622..00000000000 --- a/docs/fa/sql_reference/statements/show.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: SHOW ---- - -# نمایش & پرسوجو {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -بازگرداندن یک `String`- نوع ‘statement’ column, which contains a single value – the `CREATE` پرس و جو مورد استفاده برای ایجاد شی مشخص شده است. - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -چاپ یک لیست از تمام پایگاه های داده. -این پرس و جو یکسان است `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -خروجی محتوای [سیستم.فرایندها](../../operations/system_tables.md#system_tables-processes) جدول, که شامل یک لیست از نمایش داده شد که در حال حاضر پردازش, به استثنای `SHOW PROCESSLIST` نمایش داده شد. - -این `SELECT * FROM system.processes` پرس و جو داده ها در مورد تمام نمایش داده شد در حال حاضر را برمی گرداند. - -نکته (اجرا در کنسول): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -نمایش یک لیست از جداول. - -``` sql -SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -اگر `FROM` بند مشخص نشده است, پرس و جو لیستی از جداول گرداند از پایگاه داده فعلی. - -شما می توانید نتایج مشابه را دریافت کنید `SHOW TABLES` پرسوجو به روش زیر: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**مثال** - -پرس و جو زیر انتخاب دو ردیف اول از لیست جداول در `system` پایگاه داده, که نام حاوی `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -نمایش یک لیست از [واژهنامهها خارجی](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -اگر `FROM` بند مشخص نشده است, پرس و جو لیستی از لغت نامه ها را برمی گرداند از پایگاه داده در حال حاضر. - -شما می توانید نتایج مشابه را دریافت کنید `SHOW DICTIONARIES` پرسوجو به روش زیر: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**مثال** - -پرس و جو زیر انتخاب دو ردیف اول از لیست جداول در `system` پایگاه داده, که نام حاوی `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/fa/sql_reference/statements/system.md b/docs/fa/sql_reference/statements/system.md deleted file mode 100644 index 6dfedc03cc1..00000000000 --- a/docs/fa/sql_reference/statements/system.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: SYSTEM ---- - -# نمایش داده شد سیستم {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -بارگذاری مجدد تمام لغت نامه که با موفقیت قبل از لود شده است. -به طور پیش فرض, لغت نامه ها به صورت تنبلی لود (دیدن [\_بارگیری کامل](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), بنابراین به جای اینکه به طور خودکار در هنگام راه اندازی لود, در اولین دسترسی از طریق تابع دیکته مقداردهی اولیه و یا از جداول با موتور = فرهنگ لغت را انتخاب کنید. این `SYSTEM RELOAD DICTIONARIES` پرس و جو بارگذاری مجدد از جمله لغت نامه (لود شده). -همیشه باز می گردد `Ok.` صرف نظر از نتیجه به روز رسانی فرهنگ لغت. - -## بازخوانی لغتنامهها {#query_language-system-reload-dictionary} - -به طور کامل یک فرهنگ لغت را دوباره بارگذاری کنید `dictionary_name` بدون در نظر گرفتن دولت از فرهنگ لغت (لود / NOT\_LOADED / شکست خورده). -همیشه باز می گردد `Ok.` صرف نظر از نتیجه به روز رسانی فرهنگ لغت. -وضعیت فرهنگ لغت را می توان با پرس و جو بررسی کرد `system.dictionaries` جدول - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -کش دی ان اس داخلی بازنشانی را کلیک کنید. گاهی اوقات (برای clickhouse نسخه) لازم است برای استفاده از این دستور هنگامی که در حال تغییر زیرساخت ها (تغییر آدرس ip دیگر clickhouse سرور یا سرور استفاده شده توسط لغت نامه). - -برای راحت تر (اتوماتیک) مدیریت کش دیدن disable\_internal\_dns\_cache, dns\_cache\_update\_period پارامترهای. - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -بازنشانی کش علامت. مورد استفاده در توسعه تست های کلیک و عملکرد. - -## FLUSH LOGS {#query_language-system-flush_logs} - -Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. - -## RELOAD CONFIG {#query_language-system-reload-config} - -بارگذاری مجدد پیکربندی محل کلیک. استفاده می شود که پیکربندی در باغ وحش ذخیره می شود. - -## SHUTDOWN {#query_language-system-shutdown} - -به طور معمول خاموش کردن کلیک (مانند `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -سقط فرایند کلیک (مانند `kill -9 {$ pid_clickhouse-server}`) - -## مدیریت جداول توزیع شده {#query-language-system-distributed} - -کلیک خانه می تواند مدیریت کند [توزیع شده](../../engines/table_engines/special/distributed.md) میز هنگامی که یک کاربر درج داده ها را به این جداول, خانه رعیتی برای اولین بار ایجاد یک صف از داده ها است که باید به گره های خوشه ای ارسال, سپس ناهمگام می فرستد. شما می توانید پردازش صف با مدیریت [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) و [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) نمایش داده شد. شما همچنین می توانید همزمان داده های توزیع شده را با `insert_distributed_sync` تنظیمات. - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -غیرفعال توزیع داده های پس زمینه در هنگام قرار دادن داده ها به جداول توزیع شده است. - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -نیروهای خانه را کلیک کنید برای ارسال داده ها به گره های خوشه همزمان. اگر هر گره در دسترس نیست, تاتر می اندازد یک استثنا و متوقف می شود اجرای پرس و جو. شما می توانید پرس و جو را دوباره امتحان کنید تا زمانی که موفق, که اتفاق خواهد افتاد زمانی که تمام گره ها در حال بازگشت. - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -توزیع داده های پس زمینه را هنگام قرار دادن داده ها به جداول توزیع می کند. - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -فراهم می کند امکان متوقف ادغام پس زمینه برای جداول در خانواده ادغام: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "یادداشت" - `DETACH / ATTACH` جدول پس زمینه ادغام برای جدول شروع خواهد شد حتی در صورتی که ادغام برای تمام جداول ادغام قبل از متوقف شده است. - -### START MERGES {#query_language-system-start-merges} - -فراهم می کند امکان شروع پس زمینه ادغام برای جداول در خانواده ادغام: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/fa/sql_reference/syntax.md b/docs/fa/sql_reference/syntax.md deleted file mode 100644 index 250b6c6aa5f..00000000000 --- a/docs/fa/sql_reference/syntax.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 31 -toc_title: "\u0646\u062D\u0648" ---- - -# نحو {#syntax} - -دو نوع تجزیه کننده در سیستم وجود دارد: تجزیه کننده کامل مربع (تجزیه کننده نزول بازگشتی) و تجزیه کننده فرمت داده (تجزیه کننده جریان سریع). -در تمام موارد به جز `INSERT` پرس و جو, تنها تجزیه کننده کامل گذاشتن استفاده شده است. -این `INSERT` پرس و جو از هر دو تجزیه کننده استفاده می کند: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -این `INSERT INTO t VALUES` قطعه توسط تجزیه کننده کامل و داده ها تجزیه می شود `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` توسط تجزیه کننده جریان سریع تجزیه می شود. شما همچنین می توانید تجزیه کننده کامل برای داده ها با استفاده از [در حال خواندن:](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) تنظیمات. چه زمانی `input_format_values_interpret_expressions = 1` کلیک هاوس اول سعی می کند به تجزیه ارزش با تجزیه کننده جریان سریع. در صورت عدم موفقیت کلیک هاوس تلاش می کند تا از تجزیه کننده کامل برای داده ها استفاده کند و مانند یک مربع درمان شود [عبارت](#syntax-expressions). - -داده ها می توانند هر فرمت داشته باشند. هنگامی که یک پرس و جو را دریافت کرده است, سرور محاسبه بیش از [بیشینه\_کرکی\_سیز](../operations/settings/settings.md#settings-max_query_size) بایت از درخواست در رم (به طور پیش فرض, 1 مگابایت), و بقیه جریان تجزیه. -این به این معنی است که سیستم با مشکلات بزرگ ندارد `INSERT` نمایش داده شد, مانند خروجی زیر می کند. - -هنگام استفاده از `Values` قالب در یک `INSERT` پرس و جو, ممکن است به نظر می رسد که داده ها همان عبارات در تجزیه `SELECT` پرس و جو, اما این درست نیست. این `Values` فرمت بسیار محدود تر است. - -بعد ما تجزیه کننده کامل را پوشش خواهیم داد. برای کسب اطلاعات بیشتر در مورد تجزیه کننده فرمت, دیدن [فرشها](../interfaces/formats.md) بخش. - -## فاصلهها {#spaces} - -ممکن است هر تعداد از نمادهای فضایی بین سازه های نحوی (از جمله شروع و پایان پرس و جو) وجود دارد. علامت فضا شامل فضا, باریکه, خوراک خط, کروم, و خوراک فرم. - -## توضیحات {#comments} - -گذاشتن به سبک و ج سبک نظرات پشتیبانی می شوند. -گذاشتن به سبک نظرات: از `--` به انتهای خط فضای پس از `--` می توان حذف. -نظرات در ج سبک: از `/*` به `*/`. این نظرات می تواند چند خطی باشد. فضاهای اینجا مورد نیاز نیست, هم. - -## کلیدواژهها {#syntax-keywords} - -کلمات کلیدی حساس به حروف هستند که مربوط به: - -- استاندارد گذاشتن. به عنوان مثال, `SELECT`, `select` و `SeLeCt` همه معتبر هستند. -- پیاده سازی در برخی از پایگاه داده محبوب (خروجی زیر و یا پست). به عنوان مثال, `DateTime` همان است `datetime`. - -این که نام نوع داده حساس به حروف باشد را میتوان در `system.data_type_families` جدول - -در مقایسه با استاندارد گذاشتن تمام کلمات کلیدی دیگر (از جمله نام توابع) عبارتند از **حساس به حالت**. - -کلمات کلیدی محفوظ نیست (فقط به عنوان کلمات کلیدی در زمینه مربوطه تجزیه می شوند). در صورت استفاده [شناسهها](#syntax-identifiers) همان کلمات کلیدی را به نقل قول محصور. برای مثال پرس و جو `SELECT "FROM" FROM table_name` معتبر است اگر جدول `table_name` دارای ستون با نام `"FROM"`. - -## شناسهها {#syntax-identifiers} - -شناسه ها عبارتند از: - -- خوشه, پایگاه داده, جدول, پارتیشن و ستون نام. -- توابع. -- انواع داده ها. -- [نامگردانهای بیان](#syntax-expression_aliases). - -شناسه را می توان به نقل و یا غیر نقل. توصیه می شود از شناسه های غیر نقل قول استفاده کنید. - -شناسه های غیر نقل قول باید عبارت منظم مطابقت `^[a-zA-Z_][0-9a-zA-Z_]*$` و نمی تواند برابر باشد [کلیدواژهها](#syntax-keywords). مثالها: `x, _1, X_y__Z123_.` - -اگر شما می خواهید به استفاده از شناسه همان کلمات کلیدی و یا شما می خواهید به استفاده از نمادهای دیگر در شناسه, نقل قول با استفاده از دو نقل قول و یا پشت پرده, مثلا, `"id"`, `` `id` ``. - -## Literals {#literals} - -وجود دارد: عددی, رشته, ترکیب و `NULL` literals. - -### عددی {#numeric} - -تحت اللفظی عددی تلاش می کند به تجزیه شود: - -- برای اولین بار به عنوان یک شماره امضا 64 بیتی, با استفاده از [استرتول](https://en.cppreference.com/w/cpp/string/byte/strtoul) تابع. -- اگر ناموفق, به عنوان یک عدد بدون علامت 64 بیتی, با استفاده از [استرول](https://en.cppreference.com/w/cpp/string/byte/strtol) تابع. -- اگر ناموفق, به عنوان یک عدد شناور نقطه با استفاده از [رشته](https://en.cppreference.com/w/cpp/string/byte/strtof) تابع. -- در غیر این صورت, یک خطا بازگشته است. - -مقدار مربوطه کوچکترین نوع است که متناسب با ارزش داشته باشد. -مثلا, 1 به عنوان تجزیه `UInt8` اما 256 به عنوان تجزیه شده است `UInt16`. برای کسب اطلاعات بیشتر, دیدن [انواع داده ها](../sql_reference/data_types/index.md). - -مثالها: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### رشته {#syntax-string-literal} - -فقط رشته های رشته ای در نقل قول های تک پشتیبانی می شوند. شخصیت های محصور می تواند بک اسلش فرار. توالی فرار زیر یک مقدار خاص مربوطه: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. در تمام موارد دیگر, فرار توالی در قالب `\c` کجا `c` است هر شخصیت, به تبدیل `c`. این به این معنی است که شما می توانید توالی استفاده کنید `\'`و`\\`. ارزش خواهد شد که [رشته](../sql_reference/data_types/string.md) نوع. - -حداقل مجموعه ای از شخصیت های که شما نیاز به فرار در لیتر رشته: `'` و `\`. نقل قول تنها را می توان با نقل قول تنها فرار, لیتر `'It\'s'` و `'It''s'` برابر هستند. - -### ترکیب {#compound} - -سازه ها برای ارریس پشتیبانی می شوند: `[1, 2, 3]` و تاپل: `(1, 'Hello, world!', 2)`.. -در واقع این نیست literals اما عبارات با آرایه ایجاد اپراتور و چند تایی ایجاد اپراتور بود. -مجموعه ای باید شامل حداقل یک مورد باشد و یک تاپل باید حداقل دو مورد داشته باشد. -تاپل یک هدف خاص برای استفاده در `IN` بند یک `SELECT` پرس و جو. توپلس می تواند به عنوان نتیجه یک پرس و جو به دست, اما نمی توان به یک پایگاه داده ذخیره (به غیر از [حافظه](../engines/table_engines/special/memory.md) جدول). - -### NULL {#null-literal} - -نشان می دهد که ارزش از دست رفته است. - -به منظور ذخیره `NULL` در یک میدان جدول باید از [Nullable](../sql_reference/data_types/nullable.md) نوع. - -بسته به فرمت داده (ورودی یا خروجی), `NULL` ممکن است نمایندگی های مختلف. برای کسب اطلاعات بیشتر, اسناد و مدارک برای دیدن [قالبهای داده](../interfaces/formats.md#formats). - -بسیاری از تفاوت های ظریف برای پردازش وجود دارد `NULL`. مثلا, اگر حداقل یکی از استدلال از یک عملیات مقایسه است `NULL` نتیجه این عملیات نیز خواهد بود `NULL`. همان درست است برای ضرب است, بعلاوه, و عملیات دیگر. برای کسب اطلاعات بیشتر, خواندن اسناد و مدارک برای هر عملیات. - -در نمایش داده شد, شما می توانید بررسی کنید `NULL` با استفاده از [IS NULL](operators.md#operator-is-null) و [IS NOT NULL](operators.md) اپراتورها و توابع مرتبط `isNull` و `isNotNull`. - -## توابع {#functions} - -توابع مانند یک شناسه با یک لیست از استدلال نوشته شده (احتمالا خالی) در داخل پرانتز. در مقابل به گذاشتن استاندارد, براکت مورد نیاز است, حتی برای یک لیست استدلال خالی. مثال: `now()`. -توابع منظم و جمع وجود دارد (بخش را ببینید “Aggregate functions”). برخی از توابع دانه می تواند شامل دو لیست از استدلال در براکت. مثال: `quantile (0.9) (x)`. این توابع مجموع نامیده می شوند “parametric” توابع, و استدلال در لیست اول نامیده می شوند “parameters”. نحو توابع کل بدون پارامتر همان است که برای توابع به طور منظم است. - -## اپراتورها {#operators} - -اپراتورها در حال تبدیل به توابع مربوط به خود را طی پرس و جو و تجزیه گرفتن اولویت خود را و associativity به حساب آورد. -برای مثال بیان `1 + 2 * 3 + 4` تبدیل به `plus(plus(1, multiply(2, 3)), 4)`. - -## انواع داده ها و موتورهای جدول پایگاه داده {#data_types-and-database-table-engines} - -انواع داده ها و موتورهای جدول در `CREATE` پرس و جو به همان شیوه به عنوان شناسه و یا توابع نوشته شده است. به عبارت دیگر, ممکن است یا ممکن است حاوی یک لیست استدلال در براکت نیست. برای کسب اطلاعات بیشتر به بخش ها مراجعه کنید “Data types,” “Table engines,” و “CREATE”. - -## نامگردانهای بیان {#syntax-expression_aliases} - -نام مستعار یک نام تعریف شده توسط کاربر برای بیان در پرس و جو است. - -``` sql -expr AS alias -``` - -- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` بند بدون استفاده از `AS` کلمه کلیدی. - - For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. - -- `expr` — Any expression supported by ClickHouse. - - For example, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — Name for `expr`. نام مستعار باید با پیروی از [شناسهها](#syntax-identifiers) نحو. - - For example, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### نکاتی در مورد استفاده {#notes-on-usage} - -نام مستعار جهانی برای یک پرس و جو و یا زیرخاکی هستند و شما می توانید یک نام مستعار در هر بخشی از یک پرس و جو برای هر بیان تعریف. به عنوان مثال, `SELECT (1 AS n) + 2, n`. - -نام مستعار قابل مشاهده نیست در subqueries و بین subqueries. مثلا, در حالی که اجرای پرس و جو `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` تاتر استثنا را تولید می کند `Unknown identifier: num`. - -اگر یک نام مستعار برای ستون نتیجه در تعریف `SELECT` بند یک خرده فروشی, این ستون ها در پرس و جو بیرونی قابل مشاهده هستند. به عنوان مثال, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -مراقب باشید با نام مستعار است که همان نام ستون یا جدول می باشد. بیایید مثال زیر را در نظر بگیریم: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -در این مثال ما اعلام جدول `t` با ستون `b`. سپس, در هنگام انتخاب داده, ما تعریف `sum(b) AS b` نام مستعار. به عنوان نام مستعار جهانی هستند, خانه را جایگزین تحت اللفظی `b` در عبارت `argMax(a, b)` با بیان `sum(b)`. این جایگزینی باعث استثنا. - -## ستاره {#asterisk} - -در یک `SELECT` پرس و جو, ستاره می تواند عبارت جایگزین. برای کسب اطلاعات بیشتر به بخش مراجعه کنید “SELECT”. - -## عبارتها {#syntax-expressions} - -بیان یک تابع است, شناسه, تحت اللفظی, استفاده از یک اپراتور, بیان در داخل پرانتز, خرده فروشی, یا ستاره. همچنین می تواند شامل یک نام مستعار. -لیستی از عبارات یک یا چند عبارت از هم جدا شده توسط کاما است. -توابع و اپراتورهای, به نوبه خود, می توانید عبارات به عنوان استدلال دارند. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/fa/sql_reference/table_functions/file.md b/docs/fa/sql_reference/table_functions/file.md deleted file mode 100644 index 62e49c8cd80..00000000000 --- a/docs/fa/sql_reference/table_functions/file.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u067E\u0631\u0648\u0646\u062F\u0647" ---- - -# پرونده {#file} - -ایجاد یک جدول از یک فایل. این تابع جدول شبیه به [نشانی وب](url.md) و [hdfs](hdfs.md) یکی - -``` sql -file(path, format, structure) -``` - -**پارامترهای ورودی** - -- `path` — The relative path to the file from [\_مخفی کردن \_صفحه](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-user_files_path). مسیر به فایل پشتیبانی پس از دل تنگی در حالت فقط خواندنی: `*`, `?`, `{abc,def}` و `{N..M}` کجا `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [قالب](../../interfaces/formats.md#formats) پرونده -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**مقدار بازگشتی** - -یک جدول با ساختار مشخص شده برای خواندن یا نوشتن داده ها در فایل مشخص شده است. - -**مثال** - -تنظیم `user_files_path` و محتویات فایل `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -جدول از`test.csv` و انتخاب دو ردیف اول: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -``` sql --- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file -SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 -``` - -**دل تنگی در مسیر** - -اجزای مسیر چندگانه می تواند دل تنگی دارند. برای پردازش فایل باید وجود داشته باشد و مسابقات به الگوی کل مسیر (نه تنها پسوند یا پیشوند). - -- `*` — Substitutes any number of any characters except `/` از جمله رشته خالی. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -سازه با `{}` شبیه به [عملکرد جدول از راه دور](../../sql_reference/table_functions/remote.md)). - -**مثال** - -1. فرض کنید ما چندین فایل با مسیرهای نسبی زیر داریم: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. پرس و جو مقدار ردیف در این فایل ها: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. پرس و جو مقدار ردیف در تمام فایل های این دو دایرکتوری: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "اخطار" - اگر لیست خود را از فایل های حاوی محدوده تعداد با صفر پیشرو, استفاده از ساخت و ساز با پرانتز برای هر رقم به طور جداگانه و یا استفاده `?`. - -**مثال** - -پرس و جو داده ها از فایل های به نام `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## ستونهای مجازی {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**همچنین نگاه کنید به** - -- [مجازی ستون](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/fa/sql_reference/table_functions/hdfs.md b/docs/fa/sql_reference/table_functions/hdfs.md deleted file mode 100644 index 44e9c1d627b..00000000000 --- a/docs/fa/sql_reference/table_functions/hdfs.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: hdfs ---- - -# hdfs {#hdfs} - -ایجاد یک جدول از فایل ها در اچ دی. این جدول عملکرد شبیه به [نشانی وب](url.md) و [پرونده](file.md) یکی - -``` sql -hdfs(URI, format, structure) -``` - -**پارامترهای ورودی** - -- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` و `{N..M}` کجا `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [قالب](../../interfaces/formats.md#formats) پرونده -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**مقدار بازگشتی** - -یک جدول با ساختار مشخص شده برای خواندن یا نوشتن داده ها در فایل مشخص شده است. - -**مثال** - -جدول از `hdfs://hdfs1:9000/test` و انتخاب دو ردیف اول: - -``` sql -SELECT * -FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -**دل تنگی در مسیر** - -اجزای مسیر چندگانه می تواند دل تنگی دارند. برای پردازش فایل باید وجود داشته باشد و مسابقات به الگوی کل مسیر (نه تنها پسوند یا پیشوند). - -- `*` — Substitutes any number of any characters except `/` از جمله رشته خالی. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -سازه با `{}` شبیه به [عملکرد جدول از راه دور](../../sql_reference/table_functions/remote.md)). - -**مثال** - -1. فرض کنید که ما چندین فایل با اوریس زیر در اچ دی ها داریم: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. پرس و جو مقدار ردیف در این فایل ها: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. پرس و جو مقدار ردیف در تمام فایل های این دو دایرکتوری: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "اخطار" - اگر لیست خود را از فایل های حاوی محدوده تعداد با صفر پیشرو, استفاده از ساخت و ساز با پرانتز برای هر رقم به طور جداگانه و یا استفاده `?`. - -**مثال** - -پرس و جو داده ها از فایل های به نام `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## ستونهای مجازی {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**همچنین نگاه کنید به** - -- [ستونهای مجازی](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/fa/sql_reference/table_functions/index.md b/docs/fa/sql_reference/table_functions/index.md deleted file mode 100644 index 58143c6a5dd..00000000000 --- a/docs/fa/sql_reference/table_functions/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Table Functions -toc_priority: 34 -toc_title: "\u0645\u0639\u0631\u0641\u06CC \u0634\u0631\u06A9\u062A" ---- - -# توابع جدول {#table-functions} - -توابع جدول روش برای ساخت جداول. - -شما می توانید توابع جدول در استفاده: - -- [FROM](../statements/select.md#select-from) بند از `SELECT` پرس و جو. - - The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. - -- [ایجاد جدول به عنوان \](../statements/create.md#create-table-query) پرس و جو. - - It's one of the methods of creating a table. - -!!! warning "اخطار" - شما می توانید توابع جدول اگر استفاده نمی [اجازه دادن به \_نشانی](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) تنظیم غیر فعال است. - -| تابع | توصیف | -|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------| -| [پرونده](file.md) | ایجاد یک [پرونده](../../engines/table_engines/special/file.md)- جدول موتور. | -| [ادغام](merge.md) | ایجاد یک [ادغام](../../engines/table_engines/special/merge.md)- جدول موتور. | -| [اعداد](numbers.md) | ایجاد یک جدول با یک ستون پر از اعداد صحیح. | -| [دور](remote.md) | اجازه می دهد تا شما را به دسترسی به سرور از راه دور بدون ایجاد یک [توزیع شده](../../engines/table_engines/special/distributed.md)- جدول موتور. | -| [نشانی وب](url.md) | ایجاد یک [نشانی وب](../../engines/table_engines/special/url.md)- جدول موتور. | -| [خروجی زیر](mysql.md) | ایجاد یک [MySQL](../../engines/table_engines/integrations/mysql.md)- جدول موتور. | -| [جستجو](jdbc.md) | ایجاد یک [JDBC](../../engines/table_engines/integrations/jdbc.md)- جدول موتور. | -| [جستجو](odbc.md) | ایجاد یک [ODBC](../../engines/table_engines/integrations/odbc.md)- جدول موتور. | -| [hdfs](hdfs.md) | ایجاد یک [HDFS](../../engines/table_engines/integrations/hdfs.md)- جدول موتور. | - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/fa/sql_reference/table_functions/mysql.md b/docs/fa/sql_reference/table_functions/mysql.md deleted file mode 100644 index 2c00529040c..00000000000 --- a/docs/fa/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 42 -toc_title: "\u062E\u0631\u0648\u062C\u06CC \u0632\u06CC\u0631" ---- - -# خروجی زیر {#mysql} - -اجازه می دهد `SELECT` نمایش داده شد به داده است که بر روی یک سرور خروجی از راه دور ذخیره می شود انجام می شود. - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**پارامترها** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` نمایش داده شد به `REPLACE INTO`. اگر `replace_query=1`, پرس و جو جایگزین شده است. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` بیان است که به اضافه `INSERT` پرس و جو. - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -ساده `WHERE` بند هایی مانند `=, !=, >, >=, <, <=` در حال حاضر بر روی سرور خروجی زیر اجرا شده است. - -بقیه شرایط و `LIMIT` محدودیت نمونه برداری در محل کلیک تنها پس از پرس و جو به پس از اتمام خروجی زیر اجرا شده است. - -**مقدار بازگشتی** - -یک شی جدول با ستون همان جدول خروجی زیر اصلی. - -## مثال طریقه استفاده {#usage-example} - -جدول در خروجی زیر: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -انتخاب داده ها از خانه کلیک: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## همچنین نگاه کنید به {#see-also} - -- [این ‘MySQL’ موتور جدول](../../engines/table_engines/integrations/mysql.md) -- [با استفاده از خروجی زیر به عنوان منبع فرهنگ لغت خارجی](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/fa/sql_reference/table_functions/odbc.md b/docs/fa/sql_reference/table_functions/odbc.md deleted file mode 100644 index 088d1b9bd02..00000000000 --- a/docs/fa/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 44 -toc_title: "\u062C\u0633\u062A\u062C\u0648" ---- - -# جستجو {#table-functions-odbc} - -بازگرداندن جدول است که از طریق متصل [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -پارامترها: - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` پرونده. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -با خیال راحت پیاده سازی اتصالات ان بی سی, تاتر با استفاده از یک برنامه جداگانه `clickhouse-odbc-bridge`. اگر راننده او بی سی به طور مستقیم از لود `clickhouse-server`, مشکلات راننده می تواند سرور تاتر سقوط. تاتر به طور خودکار شروع می شود `clickhouse-odbc-bridge` هنگامی که مورد نیاز است. برنامه پل او بی سی از همان بسته به عنوان نصب `clickhouse-server`. - -زمینه های با `NULL` مقادیر از جدول خارجی به مقادیر پیش فرض برای نوع داده پایه تبدیل می شوند. مثلا, اگر یک میدان جدول خروجی زیر از راه دور است `INT NULL` نوع این است که به 0 تبدیل (مقدار پیش فرض برای کلیک `Int32` نوع داده). - -## مثال طریقه استفاده {#usage-example} - -**گرفتن اطلاعات از نصب و راه اندازی خروجی زیر محلی از طریق ان بی سی** - -این مثال برای لینوکس اوبونتو 18.04 و سرور خروجی زیر 5.7 بررسی می شود. - -اطمینان حاصل شود که unixodbc و mysql اتصال نصب شده است. - -به طور پیش فرض (در صورت نصب از بسته), کلیک خانه شروع می شود به عنوان کاربر `clickhouse`. بنابراین شما نیاز به ایجاد و پیکربندی این کاربر در سرور خروجی زیر. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -سپس اتصال را پیکربندی کنید `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -شما می توانید اتصال با استفاده از بررسی `isql` ابزار از unixODBC نصب و راه اندازی. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -جدول در خروجی زیر: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -بازیابی اطلاعات از جدول خروجی زیر در کلیک: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## همچنین نگاه کنید به {#see-also} - -- [لغت نامه های خارجی ان بی سی](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [موتور جدول ان بی سی](../../engines/table_engines/integrations/odbc.md). - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/fa/sql_reference/table_functions/remote.md b/docs/fa/sql_reference/table_functions/remote.md deleted file mode 100644 index 8763779d9d4..00000000000 --- a/docs/fa/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u062F\u0648\u0631" ---- - -# از راه دور remoteSecure {#remote-remotesecure} - -اجازه می دهد تا شما را به دسترسی به سرور از راه دور بدون ایجاد یک `Distributed` جدول - -امضاها: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` یا فقط `host`. میزبان را می توان به عنوان نام سرور مشخص, و یا به عنوان ایپو4 یا ایپو6 نشانی. نشانی اینترنتی6 در براکت مربع مشخص شده است. پورت پورت تی سی پی بر روی سرور از راه دور است. اگر پورت حذف شده است, با استفاده از `tcp_port` از فایل پیکربندی سرور (به طور پیش فرض, 9000). - -!!! important "مهم" - پورت برای یک نشانی اینترنتی6 مورد نیاز است. - -مثالها: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -نشانی های متعدد را می توان با کاما از هم جدا شده است. در این مورد کلیک هاوس از پردازش توزیع شده استفاده می کند بنابراین پرس و جو را به تمام نشانیهای مشخص شده ارسال می کند (مانند داده های مختلف). - -مثال: - -``` text -example01-01-1,example01-02-1 -``` - -بخشی از بیان را می توان در براکت فرفری مشخص شده است. مثال قبلی را می توان به شرح زیر نوشته شده است: - -``` text -example01-0{1,2}-1 -``` - -براکت فرفری می تواند شامل طیف وسیعی از اعداد جدا شده توسط دو نقطه (اعداد صحیح غیر منفی). در این مورد, محدوده به مجموعه ای از ارزش هایی که تولید نشانی سفال گسترش. اگر عدد اول با صفر شروع می شود, ارزش ها با همان تراز صفر تشکیل. مثال قبلی را می توان به شرح زیر نوشته شده است: - -``` text -example01-{01..02}-1 -``` - -اگر شما جفت های متعدد از براکت در اشکال مختلف, این تولید محصول مستقیم از مجموعه مربوطه. - -نشانی ها و بخش هایی از نشانی در براکت فرفری را می توان با نماد لوله جدا (\|). در این مورد, مجموعه مربوطه را از نشانی ها به عنوان کپی تفسیر, و پرس و جو خواهد شد به اولین ماکت سالم ارسال. با این حال, کپی در نظم در حال حاضر در مجموعه تکرار [\_تبالسازی](../../operations/settings/settings.md) تنظیمات. - -مثال: - -``` text -example01-{01..02}-{1|2} -``` - -این مثال دو تکه که هر کدام دو کپی مشخص. - -تعدادی از آدرس های تولید شده محدود است توسط یک ثابت است. در حال حاضر این 1000 نشانی است. - -با استفاده از `remote` تابع جدول کمتر مطلوب تر از ایجاد یک است `Distributed` جدول, چرا که در این مورد, اتصال سرور دوباره تاسیس برای هر درخواست. علاوه بر این, اگر نام میزبان قرار است, نام حل و فصل, و خطا شمارش نیست در هنگام کار با کپی های مختلف. هنگامی که پردازش تعداد زیادی از نمایش داده شد, همیشه ایجاد `Distributed` جدول جلوتر از زمان, و استفاده نکنید `remote` تابع جدول. - -این `remote` تابع جدول می تواند در موارد زیر مفید باشد: - -- دسترسی به یک سرور خاص برای مقایسه داده ها, اشکال زدایی, و تست. -- نمایش داده شد بین خوشه های مختلف کلیک برای اهداف تحقیقاتی. -- درخواست توزیع نادر است که به صورت دستی ساخته شده. -- درخواست توزیع شده که مجموعه ای از سرورها در هر زمان دوباره تعریف شده است. - -اگر کاربر مشخص نشده است, `default` استفاده شده است. -اگر رمز عبور مشخص نشده است, رمز عبور خالی استفاده شده است. - -`remoteSecure` - مثل `remote` but with secured connection. Default port — [\_شروع مجدد](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) از پیکربندی و یا 9440. - -[مقاله اصلی](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/fa/whats_new/changelog/2017.md b/docs/fa/whats-new/changelog/2017.md similarity index 100% rename from docs/fa/whats_new/changelog/2017.md rename to docs/fa/whats-new/changelog/2017.md diff --git a/docs/fa/whats-new/changelog/2018.md b/docs/fa/whats-new/changelog/2018.md new file mode 100644 index 00000000000..b4077fb4db6 --- /dev/null +++ b/docs/fa/whats-new/changelog/2018.md @@ -0,0 +1,1063 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 78 +toc_title: '2018' +--- + +## انتشار کلیک 18.16 {#clickhouse-release-18-16} + +### انتشار کلیک 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} + +#### رفع اشکال: {#bug-fixes} + +- رفع خطا که به مشکلات با به روز رسانی لغت نامه با منبع ان بی سی منجر شده است. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- مجموعه دستگاه گوارش از توابع کل در حال حاضر با ستون های کمکاری کار می کند. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) + +#### بهبود: {#improvements} + +- اضافه شدن `low_cardinality_allow_in_native_format` تنظیم (فعال به طور پیش فرض). هنگامی که غیر فعال, ستون های کم هزینه خواهد شد به ستون های معمولی برای نمایش داده شد را انتخاب کنید تبدیل و ستون عادی خواهد شد برای قرار دادن نمایش داده شد انتظار می رود. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) + +#### بهبود ساخت: {#build-improvements} + +- رفع برای ایجاد بر روی مکینتاش و بازو. + +### انتشار کلیک 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} + +#### ویژگی های جدید: {#new-features} + +- `DEFAULT` عبارات برای زمینه های از دست رفته در هنگام بارگذاری داده ها در فرمت های ورودی نیمه ساختار ارزیابی (`JSONEachRow`, `TSKV`). این ویژگی با فعال `insert_sample_with_metadata` تنظیمات. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) +- این `ALTER TABLE` پرس و جو در حال حاضر `MODIFY ORDER BY` اقدام برای تغییر کلید مرتب سازی هنگام اضافه کردن یا حذف یک ستون جدول. این برای جداول در مفید است `MergeTree` خانواده ای که انجام کارهای اضافی در هنگام ادغام بر اساس این کلید مرتب سازی, مانند `SummingMergeTree`, `AggregatingMergeTree` و به همین ترتیب. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) +- برای جداول در `MergeTree` خانواده, در حال حاضر شما می توانید یک کلید مرتب سازی های مختلف را مشخص کنید (`ORDER BY`) و شاخص (`PRIMARY KEY`). کلید مرتب سازی می تواند طولانی تر از شاخص باشد. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) +- اضافه شدن `hdfs` عملکرد جدول و `HDFS` موتور جدول برای واردات و صادرات داده ها به اچ دی اف. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) +- اضافه شدن توابع برای کار بازه64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [الکساندر کرشنینیکف](https://github.com/ClickHouse/ClickHouse/pull/3350) +- حالا شما می توانید یک پارامتر برای پیکربندی دقت استفاده کنید `uniqCombined` تابع جمع (تعداد سلول های بیش از حد جمع را انتخاب کنید). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) +- اضافه شدن `system.contributors` جدول که شامل نام هر کسی که مرتکب در خانه کلیک ساخته شده. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) +- اضافه شدن توانایی حذف پارتیشن برای `ALTER TABLE ... FREEZE` پرس و جو به منظور پشتیبان گیری از تمام پارتیشن در یک بار. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) +- اضافه شده `dictGet` و `dictGetOrDefault` توابع که نیاز به تعیین نوع مقدار بازگشتی ندارند. نوع به طور خودکار از توضیحات فرهنگ لغت تعیین می شود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3564) +- حالا شما می توانید نظرات را برای یک ستون در توضیحات جدول مشخص کنید و با استفاده از تغییر دهید `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) +- خواندن برای پشتیبانی `Join` نوع جداول با کلید های ساده. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3728) +- حالا شما می توانید گزینه های مشخص `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join` و `join_overflow_mode` هنگام ایجاد یک `Join` جدول نوع. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3728) +- اضافه شدن `joinGet` تابع است که اجازه می دهد تا شما را به استفاده از یک `Join` نوع جدول مانند یک فرهنگ لغت. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3728) +- اضافه شدن `partition_key`, `sorting_key`, `primary_key` و `sampling_key` ستونها به `system.tables` جدول به منظور فراهم کردن اطلاعات در مورد کلید های جدول. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- اضافه شدن `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key` و `is_in_sampling_key` ستونها به `system.columns` جدول [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- اضافه شدن `min_time` و `max_time` ستونها به `system.parts` جدول این ستون ها جمعیت زمانی که کلید پارتیشن بندی بیان متشکل از است `DateTime` ستون ها [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) + +#### رفع اشکال: {#bug-fixes-1} + +- رفع و بهبود عملکرد برای `LowCardinality` نوع داده. `GROUP BY` با استفاده از `LowCardinality(Nullable(...))`. گرفتن ارزش `extremes`. پردازش توابع بالا سفارش. `LEFT ARRAY JOIN`. توزیع شده `GROUP BY`. توابع است که بازگشت `Array`. اعدام `ORDER BY`. نوشتن به `Distributed` جداول (نیکولولو). سازگاری به عقب برای `INSERT` نمایش داده شد از مشتریان قدیمی که پیاده سازی `Native` قانون پشتیبانی از `LowCardinality` برای `JOIN`. بهبود عملکرد در هنگام کار در یک جریان واحد. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) +- ثابت چگونه `select_sequential_consistency` گزینه کار می کند. قبلا, زمانی که این تنظیم فعال بود, نتیجه ناقص گاهی اوقات پس از شروع به نوشتن به یک پارتیشن جدید بازگردانده شد. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) +- پایگاه داده ها هنگام اجرای دی ال به درستی مشخص شده است `ON CLUSTER` نمایش داده شد و `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- پایگاه داده ها به درستی برای کارخانه های فرعی در داخل یک نمایش مشخص شده است. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) +- رفع اشکال در `PREWHERE` با `FINAL` برای `VersionedCollapsingMergeTree`. [7167بد7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) +- حالا شما می توانید استفاده کنید `KILL QUERY` برای لغو نمایش داده شد که هنوز شروع نشده است زیرا انتظار دارند جدول قفل شود. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) +- اصلاح محاسبات تاریخ و زمان اگر ساعت در نیمه شب منتقل شد (این اتفاق می افتد در ایران, و در مسکو از اتفاق افتاد 1981 به 1983). قبلا, این منجر به زمان در حال تنظیم مجدد یک روز زودتر از حد لازم, و همچنین باعث قالب بندی نادرست از تاریخ و زمان در قالب متن. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) +- اشکالات ثابت در برخی موارد `VIEW` و کارخانه های فرعی که حذف پایگاه داده. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3521) +- ثابت شرایط مسابقه زمانی که به طور همزمان از یک خواندن `MATERIALIZED VIEW` و حذف یک `MATERIALIZED VIEW` با توجه به قفل کردن داخلی `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) +- خطا را ثابت کرد `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) +- پردازش پرس و جو ثابت زمانی که `compile_expressions` گزینه فعال است(به طور پیش فرض فعال است). عبارات ثابت نامشخص مانند `now` تابع دیگر گشوده. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) +- ثابت تصادف در هنگام مشخص کردن یک استدلال مقیاس غیر ثابت در `toDecimal32/64/128` توابع. +- ثابت خطا در هنگام تلاش برای وارد کردن مجموعه ای با `NULL` عناصر در `Values` قالب در یک ستون از نوع `Array` بدون `Nullable` (اگر `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) +- ثابت ورود خطا مداوم در `DDLWorker` اگر باغ وحش در دسترس نیست. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) +- ثابت نوع بازگشت برای `quantile*` توابع از `Date` و `DateTime` انواع استدلال. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) +- ثابت `WITH` بند اگر یک نام مستعار ساده و بدون عبارات مشخص. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) +- پردازش ثابت نمایش داده شد با نام زیر نمایش داده شد و نام ستون واجد شرایط زمانی که `enable_optimize_predicate_expression` فعال است. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3588) +- خطا را ثابت کرد `Attempt to attach to nullptr thread group` در هنگام کار با نمایش محقق. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) +- ثابت تصادف در هنگام عبور استدلال نادرست خاص به `arrayReverse` تابع. [733ا7ب6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- ثابت سرریز بافر در `extractURLParameter` تابع. بهبود عملکرد. اضافه شده پردازش صحیح رشته حاوی صفر بایت. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) +- سرریز بافر ثابت در `lowerUTF8` و `upperUTF8` توابع. حذف توانایی برای اجرای این توابع بیش از `FixedString` استدلال نوع. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) +- ثابت شرایط مسابقه نادر در هنگام حذف `MergeTree` میز [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) +- ثابت شرایط مسابقه در هنگام خواندن از `Buffer` جداول و به طور همزمان انجام `ALTER` یا `DROP` در جداول هدف. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) +- ثابت segfault اگر `max_temporary_non_const_columns` حد بیش از حد شد. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### بهبود: {#improvements-1} + +- سرور فایل های پیکربندی پردازش شده را به `/etc/clickhouse-server/` فهرست راهنما. در عوض, این موجب صرفه جویی در `preprocessed_configs` فهرست راهنمای داخل `path`. این به این معنی است که `/etc/clickhouse-server/` دایرکتوری دسترسی نوشتن برای ندارد `clickhouse` کاربر, که باعث بهبود امنیت. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) +- این `min_merge_bytes_to_use_direct_io` گزینه به 10 دستگاه گوارش به طور پیش فرض تنظیم شده است. ادغام که بخش های زیادی از جداول از خانواده ادغام را تشکیل می دهد در انجام خواهد شد `O_DIRECT` حالت, که مانع از اخراج کش صفحه بیش از حد. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) +- شتاب سرور شروع زمانی که تعداد بسیار زیادی از جداول وجود دارد. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) +- اضافه شدن یک استخر اتصال و قام `Keep-Alive` برای ارتباط بین کپی. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) +- اگر نحو پرس و جو نامعتبر است `400 Bad Request` کد در بازگشت `HTTP` رابط (500 قبلا بازگردانده شد). [31ب680ا](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) +- این `join_default_strictness` گزینه تنظیم شده است `ALL` به طور پیش فرض برای سازگاری. [120الکترونیکی 2جبه](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) +- حذف ورود به سیستم `stderr` از `re2` کتابخانه برای عبارات منظم نامعتبر و یا پیچیده. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) +- اضافه شده برای `Kafka` موتور جدول: چک برای اشتراک قبل از شروع به خواندن از کافکا; تنظیمات کافکا\_مکس\_بلک\_سیز برای جدول. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) +- این `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32` و `murmurHash3_64` توابع در حال حاضر برای هر تعداد از استدلال و برای استدلال در قالب تاپل کار می کنند. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) +- این `arrayReverse` تابع در حال حاضر با هر نوع ارریس کار می کند. [733ا7ب6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- اضافه شده یک پارامتر اختیاری: اندازه اسلات برای `timeSlots` تابع. [کیریل شواکوف](https://github.com/ClickHouse/ClickHouse/pull/3724) +- برای `FULL` و `RIGHT JOIN` این `max_block_size` تنظیم برای یک جریان از داده های غیر پیوست از جدول سمت راست استفاده می شود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3699) +- اضافه شدن `--secure` پارامتر خط فرمان در `clickhouse-benchmark` و `clickhouse-performance-test` برای فعال کردن شماره تلفن. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) +- تبدیل نوع زمانی که ساختار یک `Buffer` جدول نوع ساختار جدول مقصد مطابقت ندارد. [ویتالی بارانو](https://github.com/ClickHouse/ClickHouse/pull/3603) +- اضافه شدن `tcp_keep_alive_timeout` گزینه ای برای فعال نگه داشتن زنده بسته پس از عدم فعالیت برای فاصله زمانی مشخص شده است. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) +- حذف نقل غیر ضروری از ارزش برای کلید پارتیشن در `system.parts` جدول اگر از یک ستون تشکیل شده است. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) +- عملکرد پیمانه برای `Date` و `DateTime` انواع داده ها. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) +- اضافه شده مترادف برای `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR` و `MID` توابع. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) برخی از نام های تابع حروف حساس برای سازگاری با استاندارد گذاشتن. شکر نحوی اضافه شده است `SUBSTRING(expr FROM start FOR length)` برای سازگاری با گذاشتن. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) +- توانایی اضافه شده به `mlock` صفحات حافظه مربوط به `clickhouse-server` کد اجرایی برای جلوگیری از مجبور شدن از حافظه. این ویژگی به طور پیش فرض غیر فعال. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) +- بهبود عملکرد در هنگام خواندن از `O_DIRECT` (با `min_bytes_to_use_direct_io` گزینه فعال). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) +- بهبود عملکرد `dictGet...OrDefault` تابع برای یک استدلال کلیدی ثابت و یک استدلال پیش فرض غیر ثابت. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3563) +- این `firstSignificantSubdomain` تابع در حال حاضر پردازش دامنه `gov`, `mil` و `edu`. [ایگور هاتاریست](https://github.com/ClickHouse/ClickHouse/pull/3601) بهبود عملکرد. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) +- امکان مشخص کردن متغیرهای محیطی سفارشی برای شروع `clickhouse-server` با استفاده از `SYS-V init.d` اسکریپت با تعریف `CLICKHOUSE_PROGRAM_ENV` داخل `/etc/default/clickhouse`. + [پاولو باشینسکیی](https://github.com/ClickHouse/ClickHouse/pull/3612) +- کد بازگشت صحیح برای اسکریپت اینیت کلاینت سرور. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) +- این `system.metrics` جدول در حال حاضر `VersionInteger` متریک و `system.build_options` دارای خط اضافه شده است `VERSION_INTEGER`, که شامل فرم عددی از نسخه کلیک, مانند `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) +- حذف توانایی مقایسه `Date` نوع با یک عدد برای جلوگیری از خطاهای بالقوه مانند `date = 2018-12-17`, جایی که نقل قول در سراسر تاریخ به اشتباه حذف. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) +- ثابت رفتار توابع نفرت انگیز مانند `rowNumberInAllBlocks`. قبلا خروجی نتیجه که یک عدد بزرگتر با توجه به شروع در طول تجزیه و تحلیل پرس و جو بود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3729) +- اگر `force_restore_data` فایل را نمی توان حذف کرد, یک پیغام خطا نمایش داده می شود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3794) + +#### بهبود ساخت: {#build-improvements-1} + +- به روز شده در `jemalloc` کتابخانه, که رفع نشت حافظه بالقوه. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3557) +- پروفایل با `jemalloc` به طور پیش فرض به منظور اشکال زدایی ایجاد فعال است. [2سی82ف5 درجه سانتیگراد](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) +- اضافه شدن توانایی برای اجرای تست ادغام زمانی که تنها `Docker` بر روی سیستم نصب شده است. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) +- اضافه شدن تست بیان ریش ریش شدن در نمایش داده شد را انتخاب کنید. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) +- اضافه شدن یک تست استرس برای مرتکب, که انجام تست های کاربردی به صورت موازی و به صورت تصادفی برای تشخیص شرایط مسابقه بیشتر. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) +- بهبود روش برای شروع کلیک سرور در یک تصویر کارگر بارانداز. [الغزال احمد](https://github.com/ClickHouse/ClickHouse/pull/3663) +- برای یک تصویر کارگر بارانداز, اضافه شدن پشتیبانی برای مقداردهی اولیه پایگاه داده با استفاده از فایل ها در `/docker-entrypoint-initdb.d` فهرست راهنما. [کنستانتین لبتوف](https://github.com/ClickHouse/ClickHouse/pull/3695) +- رفع برای ایجاد بر روی بازو. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes} + +- حذف توانایی مقایسه `Date` نوع با یک عدد. به جای `toDate('2018-12-18') = 17883`, شما باید تبدیل نوع صریح و روشن استفاده `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) + +## انتشار کلیک 18.14 {#clickhouse-release-18-14} + +### انتشار کلیک 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} + +#### رفع اشکال: {#bug-fixes-2} + +- رفع خطا که به مشکلات با به روز رسانی لغت نامه با منبع ان بی سی منجر شده است. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- پایگاه داده ها هنگام اجرای دی ال به درستی مشخص شده است `ON CLUSTER` نمایش داده شد. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- ثابت segfault اگر `max_temporary_non_const_columns` حد بیش از حد شد. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### بهبود ساخت: {#build-improvements-2} + +- رفع برای ایجاد بر روی بازو. + +### انتشار کلیک 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} + +#### رفع اشکال: {#bug-fixes-3} + +- خطای ثابت در `dictGet...` تابع برای لغت نامه از نوع `range`, اگر یکی از استدلال ثابت است و دیگر نیست. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) +- خطا ثابت که باعث پیام `netlink: '...': attribute type 1 has an invalid length` برای چاپ در لینوکس هسته ورود که اتفاق می افتد تنها در نسخه های تازه به اندازه کافی از هسته لینوکس. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) +- پیش فرض ثابت در عملکرد `empty` برای استدلال `FixedString` نوع. [دانیل, دا کوانگ مین](https://github.com/ClickHouse/ClickHouse/pull/3703) +- تخصیص حافظه بیش از حد ثابت در هنگام استفاده از مقدار زیادی از `max_query_size` تنظیم (یک تکه حافظه از `max_query_size` بایت در یک بار تخصیص داده شد). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) + +#### ایجاد تغییرات: {#build-changes} + +- ساخت ثابت با کتابخانه های لووم/کلنگ نسخه 7 از بسته های سیستم عامل (این کتابخانه ها برای تدوین پرس و جو در زمان اجرا استفاده می شود). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### انتشار کلیک 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} + +#### رفع اشکال: {#bug-fixes-4} + +- موارد ثابت زمانی که روند پل ان بی سی با روند سرور اصلی خاتمه نیست. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) +- درج همزمان ثابت به `Distributed` جدول با یک لیست ستون که از لیست ستون جدول از راه دور متفاوت. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) +- ثابت یک بیماری مسابقه نادر است که می تواند به یک تصادف در هنگام حذف یک جدول ادغام منجر شود. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- ثابت بن بست پرس و جو در مورد زمانی که ایجاد موضوع پرس و جو با شکست مواجه `Resource temporarily unavailable` خطا. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- تجزیه ثابت از `ENGINE` بند زمانی که `CREATE AS table` نحو مورد استفاده قرار گرفت و `ENGINE` بند قبل از مشخص شد `AS table` (خطا منجر به نادیده گرفتن موتور مشخص شده). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) + +### انتشار کلیک 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} + +#### رفع اشکال: {#bug-fixes-5} + +- اندازه تکه حافظه دست بالا بود در حالی که غیرشخصی ستون از نوع `Array(String)` که منجر به “Memory limit exceeded” خطاها. این موضوع در نسخه 18.12.13 ظاهر شد. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) + +### انتشار کلیک 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} + +#### رفع اشکال: {#bug-fixes-6} + +- ثابت `ON CLUSTER` نمایش داده شد که خوشه پیکربندی به عنوان امن (پرچم ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) + +#### ایجاد تغییرات: {#build-changes-1} + +- مشکلات ثابت-7 از سیستم مکینتاش) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### انتشار کلیک 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} + +#### رفع اشکال: {#bug-fixes-7} + +- ثابت `Block structure mismatch in MergingSorted stream` خطا. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) +- ثابت `ON CLUSTER` نمایش داده شد در صورتی که اتصالات امن در در پیکربندی خوشه تبدیل شد (از `` پرچم). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) +- ثابت خطا در نمایش داده شد که استفاده می شود `SAMPLE`, `PREWHERE` و ستون نام مستعار. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) +- ثابت نادر `unknown compression method` خطا در هنگام `min_bytes_to_use_direct_io` تنظیمات فعال شد. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) + +#### بهبود عملکرد: {#performance-improvements} + +- رگرسیون عملکرد ثابت نمایش داده شد با `GROUP BY` از ستون UInt16 یا نوع تاریخ که در اجرای AMD EPYC پردازنده. [ایگور لاپکو](https://github.com/ClickHouse/ClickHouse/pull/3512) +- رگرسیون عملکرد ثابت نمایش داده شد که رشته های طولانی را پردازش می کند. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) + +#### بهبود ساخت: {#build-improvements-3} + +- بهبود برای ساده سازی ساخت ارکادیا. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) + +### انتشار کلیک 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} + +#### رفع اشکال: {#bug-fixes-8} + +- ثابت سقوط در پیوستن به دو کارخانه های فرعی که نامش ذکر نشده. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) +- ثابت تولید نمایش داده شد نادرست (با خالی `WHERE` بند) هنگامی که پرس و جو پایگاه داده های خارجی. [هیلد](https://github.com/ClickHouse/ClickHouse/pull/3477) +- ثابت با استفاده از یک مقدار ایست نادرست در لغت نامه او بی سی. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) + +### انتشار کلیک 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} + +#### رفع اشکال: {#bug-fixes-9} + +- خطا را ثابت کرد `Block structure mismatch in UNION stream: different number of columns` در حد نمایش داده شد. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) +- خطاهای ثابت در هنگام ادغام داده ها در جداول حاوی ارریس در داخل ساختارهای تو در تو. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) +- نتایج پرس و جو نادرست ثابت اگر `merge_tree_uniform_read_distribution` تنظیم غیر فعال است(به طور پیش فرض فعال). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) +- ثابت خطا در درج به یک جدول توزیع شده در فرمت بومی. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) + +### انتشار کلیک 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} + +- این `compile_expressions` تنظیم (مجموعه دستگاه گوارش عبارات) به طور پیش فرض غیر فعال است. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) +- این `enable_optimize_predicate_expression` تنظیم به طور پیش فرض غیر فعال است. + +### انتشار کلیک 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} + +#### ویژگی های جدید: {#new-features-1} + +- این `WITH CUBE` تغییردهنده برای `GROUP BY` (نحو جایگزین `GROUP BY CUBE(...)` همچنین در دسترس است). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) +- اضافه شدن `formatDateTime` تابع. [الکساندر کراشنینیکوف](https://github.com/ClickHouse/ClickHouse/pull/2770) +- اضافه شدن `JDBC` موتور جدول و `jdbc` تابع جدول (نیاز به نصب کلیک-جد بی سی پل). [الکساندر کراشنینیکوف](https://github.com/ClickHouse/ClickHouse/pull/3210) +- اضافه شدن توابع برای کار با شماره ایزو هفته: `toISOWeek`, `toISOYear`, `toStartOfISOYear` و `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) +- حالا شما می توانید استفاده کنید `Nullable` ستون برای `MySQL` و `ODBC` میز [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- ساختارهای داده تو در تو را می توان به عنوان اجسام تو در تو در خواندن `JSONEachRow` قالب. اضافه شدن `input_format_import_nested_json` تنظیمات. [ولمان یونکان](https://github.com/ClickHouse/ClickHouse/pull/3144) +- پردازش موازی برای بسیاری در دسترس است `MATERIALIZED VIEW`هنگام قرار دادن داده ها. دیدن `parallel_view_processing` تنظیمات. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) +- اضافه شدن `SYSTEM FLUSH LOGS` پرس و جو (مجبور ورود حملات گرگرفتگی به جداول سیستم مانند `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) +- حالا شما می توانید از پیش تعریف شده استفاده کنید `database` و `table` ماکروها هنگام اعلام `Replicated` میز [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) +- توانایی خواندن را اضافه کرد `Decimal` ارزش نوع در نماد مهندسی (نشان می دهد قدرت ده). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) + +#### ویژگی های تجربی: {#experimental-features} + +- بهینه سازی گروه بند برای `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) +- محاسبه بهینه از عبارات برای `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) + +#### بهبود: {#improvements-2} + +- به طور قابل توجهی کاهش مصرف حافظه برای نمایش داده شد با `ORDER BY` و `LIMIT`. دیدن `max_bytes_before_remerge_sort` تنظیمات. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- در صورت عدم وجود `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` فرض بر این است. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) +- ستاره واجد شرایط به درستی در نمایش داده شد با کار `JOIN`. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3202) +- این `ODBC` موتور جدول به درستی انتخاب روش برای به نقل از شناسه در گویش گذاشتن یک پایگاه داده از راه دور. [الکساندر کراشنینیکوف](https://github.com/ClickHouse/ClickHouse/pull/3210) +- این `compile_expressions` تنظیم (مجموعه دستگاه گوارش از عبارات) به طور پیش فرض فعال است. +- رفتار ثابت برای پایگاه داده قطره به طور همزمان/جدول اگر وجود دارد و ایجاد پایگاه داده / جدول اگر وجود ندارد. قبلا `CREATE DATABASE ... IF NOT EXISTS` پرسوجو میتواند پیغام خطا را بازگرداند “File … already exists” و `CREATE TABLE ... IF NOT EXISTS` و `DROP TABLE IF EXISTS` نمایش داده شد می تواند بازگشت `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) +- مانند و در عبارات با نیمه راست ثابت به سرور از راه دور منتقل می شود که پرس و جو از خروجی زیر و یا جداول ان بی سی. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- مقایسه با عبارات ثابت در جایی که بند به سرور از راه دور منتقل می شود که پرس و جو از خروجی زیر و جداول ان بی سی. قبلا, تنها مقایسه با ثابت تصویب شد. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- محاسبه صحیح عرض ردیف در ترمینال برای `Pretty` فرمت, از جمله رشته با هیروگلیف. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3257). +- `ON CLUSTER` می توان برای مشخص `ALTER UPDATE` نمایش داده شد. +- بهبود عملکرد برای خواندن داده ها در `JSONEachRow` قالب. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) +- اضافه شده مترادف برای `LENGTH` و `CHARACTER_LENGTH` توابع برای سازگاری. این `CONCAT` تابع دیگر حساس به حروف نیست. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) +- اضافه شدن `TIMESTAMP` مترادف برای `DateTime` نوع. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) +- همیشه فضای این سایت متعلق به پرس و جو کوری\_ید در سیاهههای مربوط به سرور وجود دارد, حتی اگر خط ورود به سیستم به یک پرس و جو مربوط نیست. این باعث می شود ساده تر به تجزیه سرور سیاهههای مربوط به متن با ابزار شخص ثالث. +- مصرف حافظه توسط پرس و جو وارد شده است که بیش از سطح بعدی از یک عدد صحیح گیگابایت است. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- اضافه شده حالت سازگاری برای مورد زمانی که کتابخانه مشتری که با استفاده از پروتکل بومی ستون کمتر به اشتباه می فرستد از سرور انتظار برای پرس و جو درج. این سناریو ممکن بود در هنگام استفاده از کتابخانه کلیک پردازنده. قبلا, این سناریو باعث سرور به سقوط. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) +- در تعریف کاربر که بیان در `clickhouse-copier` شما هم اکنون می توانید از یک `partition_key` نام مستعار (برای فیلتر کردن اضافی توسط پارتیشن جدول منبع). این بسیار مفید است اگر طرح پارتیشن بندی در طول کپی تغییر, اما تنها کمی تغییر. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) +- گردش کار از `Kafka` موتور شده است به یک استخر موضوع پس زمینه به منظور به طور خودکار کاهش سرعت خواندن داده ها در بارهای بالا نقل مکان کرد. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- پشتیبانی از خواندن `Tuple` و `Nested` ارزش سازه ها مانند `struct` در `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) +- فهرست دامنه های سطح بالا برای `firstSignificantSubdomain` تابع در حال حاضر شامل دامنه `biz`. [بریدن](https://github.com/ClickHouse/ClickHouse/pull/3219) +- در پیکربندی واژهنامهها خارجی, `null_value` به عنوان مقدار نوع داده پیش فرض تفسیر شده است. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) +- پشتیبانی از `intDiv` و `intDivOrZero` توابع برای `Decimal`. [48402الکترونیکی8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) +- پشتیبانی از `Date`, `DateTime`, `UUID` و `Decimal` انواع به عنوان یک کلید برای `sumMap` تابع جمع. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) +- پشتیبانی از `Decimal` نوع داده در لغت نامه های خارجی. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) +- پشتیبانی از `Decimal` نوع داده در `SummingMergeTree` میز [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) +- اضافه شده تخصص برای `UUID` داخل `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) +- کاهش تعداد `open` و `close` سیستم هنگام خواندن از یک تماس می گیرد `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) +- A `TRUNCATE TABLE` پرس و جو را می توان در هر ماکت اجرا (پرس و جو به ماکت رهبر منتقل). [کیریل شواکوف](https://github.com/ClickHouse/ClickHouse/pull/3375) + +#### رفع اشکال: {#bug-fixes-10} + +- ثابت موضوع را با `Dictionary` جداول برای `range_hashed` واژهنامهها. این خطا در نسخه 18.12.17 رخ داده است. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) +- ثابت خطا در هنگام بارگذاری `range_hashed` واژهنامهها (پیام `Unsupported type Nullable (...)`). این خطا در نسخه 18.12.17 رخ داده است. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- خطاهای ثابت در `pointInPolygon` تابع با توجه به تجمع محاسبات نادرست برای چند ضلعی با تعداد زیادی از راس واقع نزدیک به یکدیگر. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) +- اگر پس از ادغام قطعات داده, کنترلی برای بخش حاصل از نتیجه همان ادغام در ماکت دیگر متفاوت, نتیجه ادغام حذف شده است و بخش داده ها از ماکت های دیگر دانلود (این رفتار صحیح است). اما پس از دانلود بخش داده ها, این می تواند به مجموعه کار به دلیل یک خطا که بخشی در حال حاضر وجود دارد اضافه نمی شود (به این دلیل که بخش داده ها با برخی از تاخیر پس از ادغام حذف شد). این امر منجر به تلاش چرخه ای برای دانلود داده های مشابه. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) +- محاسبه نادرست ثابت از مصرف کل حافظه توسط نمایش داده شد (به دلیل محاسبه نادرست `max_memory_usage_for_all_queries` تنظیم نادرست کار می کرد و `MemoryTracking` متریک مقدار نادرست بود). این خطا در نسخه 18.12.13 رخ داده است. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) +- ثابت قابلیت های `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` این خطا در نسخه 18.12.13 رخ داده است. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) +- تهیه غیر ضروری ثابت از ساختارهای داده برای `JOIN`بازدید کنندگان بر روی سرور که شروع پرس و جو در صورتی که `JOIN` تنها بر روی سرور از راه دور انجام می شود. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) +- اشکالات ثابت در `Kafka` موتور: بن بست پس از استثنا در هنگام شروع به خواندن داده ها و قفل پس از اتمام [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- برای `Kafka` جداول اختیاری `schema` پارامتر تصویب نشد (طرح از `Cap'n'Proto` قالب). [اطلاعات دقیق](https://github.com/ClickHouse/ClickHouse/pull/3150) +- اگر این گروه از باغ وحش سرور است سرور است که اتصال را قبول اما پس از آن بلافاصله آن را به جای پاسخ به از دست دادن clickhouse انتخاب برای اتصال به سرور دیگری. قبلا این خطا را تولید کرد `Cannot read all data. Bytes read: 0. Bytes expected: 4.` و سرور نمی تواند شروع. [8218رف3](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) +- اگر این گروه از سرور باغ وحش شامل سرور که پرس و جو دی ان اس خطا می گرداند, این سرویس دهنده نادیده گرفته می شوند. [17ب8209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) +- تبدیل نوع ثابت بین `Date` و `DateTime` هنگام وارد کردن داده ها در `VALUES` قالب (اگر `input_format_values_interpret_expressions = 1`). قبلا, تبدیل بین مقدار عددی تعداد روز در زمان عصر یونیکس و برچسب زمان یونیکس انجام شد, که منجر به نتایج غیر منتظره. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) +- اصلاح نوع تبدیل بین `Decimal` و اعداد صحیح. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) +- خطاهای ثابت در `enable_optimize_predicate_expression` تنظیمات. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3231) +- یک خطای تجزیه کننده در فرمت سی سی اس وی با اعداد ممیز شناور ثابت شده است اگر جدا کننده سی سی اس وی غیر پیش فرض استفاده شود مانند `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) +- ثابت `arrayCumSumNonNegative` تابع (این مقادیر منفی تجمع می یابد اگر باتری کمتر از صفر است). [الکسی استدیو](https://github.com/ClickHouse/ClickHouse/pull/3163) +- ثابت چگونه `Merge` جداول در بالای کار `Distributed` جداول هنگام استفاده از `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) +- رفع اشکال در `ALTER UPDATE` پرس و جو. +- اشکالات ثابت در `odbc` تابع جدول که در نسخه ظاهر شد 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) +- ثابت بهره برداری از توابع مجموع با `StateArray` ترکیب کننده ها [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) +- ثابت تصادف در هنگام تقسیم یک `Decimal` ارزش صفر. [69د6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) +- خروجی ثابت از انواع برای عملیات با استفاده از `Decimal` و استدلال عدد صحیح. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) +- ثابت segfault در طول `GROUP BY` روشن `Decimal128`. [3359با06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) +- این `log_query_threads` تنظیم (ورود اطلاعات در مورد هر موضوع اجرای پرس و جو) در حال حاضر اثر تنها در صورتی که `log_queries` گزینه (ورود اطلاعات در مورد نمایش داده شد) به 1 تنظیم شده است. از زمان `log_query_threads` گزینه به طور پیش فرض فعال, اطلاعات در مورد موضوعات قبلا وارد شده بود حتی اگر ورود به سیستم پرس و جو غیر فعال شد. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) +- ثابت خطا در توزیع, بهره برداری از quantiles aggregate function (پیام خطا `Not found column quantile...`). [292ا8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) +- ثابت مشکل سازگاری در هنگام کار بر روی یک خوشه از نسخه 18.12.17 سرور و سرور های قدیمی تر در همان زمان. برای نمایش داده شد توزیع شده با گروه های کلید از هر دو ثابت و غیر ثابت طول اگر وجود دارد مقدار زیادی از داده ها به کل بازگشت داده بود و نه همیشه به طور کامل جمع (دو ردیف مختلف شامل همان جمع کلید). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) +- ثابت دست زدن به تعویض در `clickhouse-performance-test`, اگر پرس و جو شامل تنها بخشی از تعویض اعلام شده در تست. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) +- ثابت خطا در هنگام استفاده از `FINAL` با `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- ثابت خطا در هنگام استفاده از `PREWHERE` بیش از ستون که در طول اضافه شد `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- اضافه شدن یک چک برای عدم وجود `arrayJoin` برای `DEFAULT` و `MATERIALIZED` عبارات. قبلا, `arrayJoin` منجر به خطا در هنگام قرار دادن داده ها. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) +- اضافه شدن یک چک برای عدم وجود `arrayJoin` در یک `PREWHERE` بند بند. قبلا, این منجر به پیام هایی مانند `Size ... doesn't match` یا `Unknown compression method` هنگام اجرای نمایش داده شد. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) +- ثابت segfault است که می تواند رخ دهد در موارد نادر پس از بهینه سازی است که جایگزین شده و زنجیره ای از برابری با ارزیابی مربوطه در بیان. [هشدار داده می شود](https://github.com/ClickHouse/ClickHouse/pull/3339) +- اصلاحات جزیی به `clickhouse-benchmark`: قبلا, اطلاعات مربوط به مشتری به سرور ارسال نمی شد; در حال حاضر تعداد نمایش داده شد اجرا شده است با دقت بیشتری محاسبه زمانی که بستن و برای محدود کردن تعداد تکرار. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-1} + +- حذف `allow_experimental_decimal_type` انتخاب این `Decimal` نوع داده برای استفاده پیش فرض در دسترس است. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) + +## انتشار کلیک 18.12 {#clickhouse-release-18-12} + +### انتشار کلیک 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} + +#### ویژگی های جدید: {#new-features-2} + +- `invalidate_query` (قابلیت مشخص کردن پرس و جو برای بررسی اینکه یک فرهنگ لغت خارجی باید به روز شود) برای اجرا `clickhouse` منبع. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) +- توانایی استفاده را اضافه کرد `UInt*`, `Int*` و `DateTime` انواع داده ها (همراه با `Date` نوع) به عنوان یک `range_hashed` کلید فرهنگ لغت خارجی که مرزهای محدوده را تعریف می کند. حالا `NULL` می توان برای تعیین محدوده باز استفاده کرد. [واسیلی نمکو](https://github.com/ClickHouse/ClickHouse/pull/3123) +- این `Decimal` نوع در حال حاضر پشتیبانی می کند `var*` و `stddev*` توابع مجموع. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- این `Decimal` نوع در حال حاضر پشتیبانی از توابع ریاضی (`exp`, `sin` و به همین ترتیب.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- این `system.part_log` جدول در حال حاضر `partition_id` ستون. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### رفع اشکال: {#bug-fixes-11} + +- `Merge` در حال حاضر به درستی کار می کند `Distributed` میز [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3159) +- ناسازگاری ثابت (وابستگی غیر ضروری به `glibc` نسخه) ساخته شده است که غیر ممکن است برای اجرای کلیک بر روی `Ubuntu Precise` و نسخه های قدیمی تر. ناسازگاری در نسخه 18.12.13 ظاهر شد. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) +- خطاهای ثابت در `enable_optimize_predicate_expression` تنظیمات. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3107) +- ثابت یک موضوع کوچک با سازگاری به عقب که به نظر می رسد در هنگام کار با یک خوشه از کپی در نسخه های زودتر از 18.12.13 و به طور همزمان ایجاد یک کپی جدید از یک جدول بر روی یک سرور با یک نسخه جدیدتر (نشان داده شده در پیام `Can not clone replica, because the ... updated to new ClickHouse version` که منطقی است اما نباید اتفاق می افتد). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-2} + +- این `enable_optimize_predicate_expression` گزینه به طور پیش فرض فعال (که است و نه خوش بینانه). اگر تجزیه و تحلیل پرس و جو خطا رخ می دهد که مربوط به جستجو برای نام ستون مجموعه `enable_optimize_predicate_expression` به 0. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3107) + +### انتشار کلیک 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} + +#### ویژگی های جدید: {#new-features-3} + +- اضافه شدن پشتیبانی برای `ALTER UPDATE` نمایش داده شد. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) +- اضافه شدن `allow_ddl` گزینه ای که دسترسی کاربر به پرس و جو دی ال را محدود می کند. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) +- اضافه شدن `min_merge_bytes_to_use_direct_io` گزینه برای `MergeTree` موتورهای, که اجازه می دهد تا شما را به مجموعه یک خودداری برای اندازه کل ادغام (زمانی که بالاتر از حد خودداری, فایل های بخش داده خواهد شد با استفاده از اچ به کار گرفته). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) +- این `system.merges` جدول سیستم در حال حاضر شامل `partition_id` ستون. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) + +#### بهبود {#improvements-3} + +- اگر بخش داده ها در طول جهش بدون تغییر باقی می ماند, این است که توسط کپی دانلود کنید. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) +- تکمیل خودکار برای نام تنظیمات در هنگام کار با در دسترس است `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) + +#### رفع اشکال: {#bug-fixes-12} + +- اضافه شدن یک چک برای اندازه ارریس که عناصر هستند `Nested` نوع زمینه در هنگام قرار دادن. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) +- ثابت خطا به روز رسانی لغت نامه های خارجی با `ODBC` منبع و `hashed` انبار. این خطا در نسخه 18.12.13 رخ داده است. +- ثابت تصادف در هنگام ایجاد یک جدول موقت از پرس و جو با یک `IN` شرط. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3098) +- ثابت خطا در توابع کل برای ارریس است که می تواند داشته باشد `NULL` عناصر. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3097) + +### انتشار کلیک 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} + +#### ویژگی های جدید: {#new-features-4} + +- اضافه شدن `DECIMAL(digits, scale)` نوع داده (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). برای فعال کردن از تنظیمات استفاده کنید `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) +- جدید `WITH ROLLUP` تغییردهنده برای `GROUP BY` (نحو جایگزین: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) +- در نمایش داده شد با پیوستن, شخصیت ستاره گسترش می یابد به یک لیست از ستون ها در تمام جداول, در انطباق با استاندارد گذاشتن. شما می توانید رفتار قدیمی با تنظیم بازگرداندن `asterisk_left_columns_only` به 1 در سطح پیکربندی کاربر. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2787) +- اضافه شدن پشتیبانی برای پیوستن با توابع جدول. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2907) +- تکمیل خودکار با فشار دادن زبانه در خانه مشتری. [سرگی شچربین](https://github.com/ClickHouse/ClickHouse/pull/2447) +- کنترل + ج در فاحشه خانه-مشتری پاک پرس و جو که وارد شد. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) +- اضافه شدن `join_default_strictness` تنظیم (مقادیر: `"`, `'any'`, `'all'`). این اجازه می دهد تا شما را مشخص کنید `ANY` یا `ALL` برای `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) +- هر خط از ورود به سیستم سرور مربوط به پردازش پرس و جو نشان می دهد که شناسه پرس و جو. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- حالا شما می توانید سیاهههای مربوط به اجرای پرس و جو در خانه مشتری (با استفاده از `send_logs_level` تنظیمات). با پردازش پرس و جو توزیع, سیاهههای مربوط از تمام سرور های تهدیدی جدی. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- این `system.query_log` و `system.processes` (`SHOW PROCESSLIST`) جداول در حال حاضر اطلاعات در مورد تمام تنظیمات تغییر زمانی که شما یک پرس و جو (ساختار تو در تو از `Settings` اطلاعات دقیق اضافه شدن `log_query_settings` تنظیمات. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- این `system.query_log` و `system.processes` جداول در حال حاضر اطلاعات مربوط به تعدادی از موضوعات که در اجرای پرس و جو شرکت نشان می دهد (نگاه کنید به `thread_numbers` ستون). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- اضافه شده `ProfileEvents` شمارنده است که اندازه گیری زمان صرف شده در خواندن و نوشتن بر روی شبکه و خواندن و نوشتن بر روی دیسک, تعداد خطاهای شبکه, و زمان صرف انتظار زمانی که پهنای باند شبکه محدود است. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- اضافه شده `ProfileEvents`شمارنده است که شامل سیستم متریک از rusage (شما می توانید آنها را به دریافت اطلاعات در مورد CPU usage در userspace و هسته صفحه گسل و زمینه سوئیچ ها) و همچنین taskstats متریک (با استفاده از این برای به دست آوردن اطلاعات در مورد I/O منتظر زمان CPU صبر کنید زمان و مقدار اطلاعات خوانده شده و ثبت هر دو با و بدون صفحه کش). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- این `ProfileEvents` شمارنده در سطح جهانی و برای هر پرس و جو اعمال, و همچنین برای هر موضوع اعدام پرس و جو, که اجازه می دهد تا شما را به مشخصات مصرف منابع به طور مفصل. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- اضافه شدن `system.query_thread_log` جدول, که شامل اطلاعات در مورد هر موضوع اعدام پرس و جو. اضافه شدن `log_query_threads` تنظیمات. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- این `system.metrics` و `system.events` جداول در حال حاضر ساخته شده است در اسناد و مدارک. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) +- اضافه شدن `arrayEnumerateDense` تابع. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2975) +- اضافه شدن `arrayCumSumNonNegative` و `arrayDifference` توابع. [الکسی استدیو](https://github.com/ClickHouse/ClickHouse/pull/2942) +- اضافه شدن `retention` تابع جمع. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) +- حالا شما می توانید اضافه کنید (ادغام) ایالات کل توابع با استفاده از اپراتور به علاوه و ضرب ایالات کل توابع توسط یک ثابت نامنفی. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) +- جداول در خانواده ادغام در حال حاضر ستون مجازی `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### ویژگی های تجربی: {#experimental-features-1} + +- اضافه شدن `LowCardinality(T)` نوع داده. این نوع داده به طور خودکار یک فرهنگ لغت محلی از ارزش ها ایجاد می کند و اجازه می دهد تا پردازش داده ها بدون باز کردن فرهنگ لغت. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) +- اضافه شده یک کش از توابع دستگاه گوارش وارد شده و یک شمارنده برای تعداد استفاده قبل از کامپایل. به جیت کامپایل عبارات, فعال کردن `compile_expressions` تنظیمات. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) + +#### بهبود: {#improvements-4} + +- ثابت مشکل با تجمع نامحدود از ورود به سیستم تکرار زمانی که کپی رها وجود دارد. اضافه شده یک حالت بهبود موثر برای کپی با تاخیر طولانی. +- بهبود عملکرد `GROUP BY` هنگامی که یکی از رشته ها رشته است و دیگران طول ثابت با زمینه های تجمع های متعدد. +- بهبود عملکرد در هنگام استفاده از `PREWHERE` و با انتقال ضمنی عبارات در `PREWHERE`. +- بهبود عملکرد تجزیه برای فرمت های متن (`CSV`, `TSV`). [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) +- بهبود عملکرد رشته خواندن و جذب در فرمت های باینری. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2955) +- افزایش عملکرد و کاهش مصرف حافظه برای نمایش داده شد به `system.tables` و `system.columns` هنگامی که تعداد بسیار زیادی از جداول در یک سرور وجود دارد. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) +- رفع مشکل عملکرد در مورد یک جریان بزرگ از نمایش داده شد که منجر به خطا ( `_dl_addr` عملکرد در قابل مشاهده است `perf top` اما سرور پردازنده بسیار استفاده نمی شود). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) +- شرایط به نظر بازیگران (وقتی که `enable_optimize_predicate_expression` فعال است). [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2907) +- بهبود عملکرد برای `UUID` نوع داده. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) +- این `UUID` نوع داده ها در لغت نامه کیمیاگر پشتیبانی می شود. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) +- این `visitParamExtractRaw` تابع به درستی کار می کند با ساختارهای تو در تو. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2974) +- هنگامی که `input_format_skip_unknown_fields` تنظیم فعال است, زمینه های شی در `JSONEachRow` قالب به درستی قلم. [بلکجک](https://github.com/ClickHouse/ClickHouse/pull/2958) +- برای یک `CASE` بیان با شرایط, شما هم اکنون می توانید حذف `ELSE` که معادل است `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) +- ایست عملیات هم اکنون می توانید پیکربندی شود در هنگام کار با باغ وحش. [اوریخی](https://github.com/ClickHouse/ClickHouse/pull/2971) +- شما می توانید افست برای مشخص `LIMIT n, m` به عنوان `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- شما می توانید از `SELECT TOP n` نحو به عنوان یک جایگزین برای `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- افزایش اندازه صف برای نوشتن به جداول سیستم, بنابراین `SystemLog parameter queue is full` خطا اغلب اتفاق نمی افتد. +- این `windowFunnel` تابع مجموع در حال حاضر پشتیبانی از اتفاقاتی که با شرایط متعدد. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2801) +- ستون های تکراری را می توان در یک `USING` بند برای `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) +- `Pretty` فرمت در حال حاضر محدودیتی در تراز ستون های عرض است. استفاده از `output_format_pretty_max_column_pad_width` تنظیمات. اگر مقدار گسترده تر است, هنوز هم در تمامیت خود را نمایش داده خواهد شد, اما سلول های دیگر در جدول نخواهد بود بیش از حد گسترده. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) +- این `odbc` تابع جدول در حال حاضر اجازه می دهد تا به شما برای مشخص کردن پایگاه داده/نام طرح. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2885) +- توانایی استفاده از یک نام کاربری مشخص شده در `clickhouse-client` فایل پیکربندی. [ولادیمیر کوزبین](https://github.com/ClickHouse/ClickHouse/pull/2909) +- این `ZooKeeperExceptions` شمارنده به سه شمارنده تقسیم شده است: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions` و `ZooKeeperOtherExceptions`. +- `ALTER DELETE` نمایش داده شد و کار را برای محقق views. +- تصادفی اضافه شده در هنگام اجرای موضوع پاکسازی به صورت دوره ای برای `ReplicatedMergeTree` جداول به منظور جلوگیری از خوشه بار دوره ای زمانی که تعداد بسیار زیادی از وجود دارد `ReplicatedMergeTree` میز +- پشتیبانی از `ATTACH TABLE ... ON CLUSTER` نمایش داده شد. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) + +#### رفع اشکال: {#bug-fixes-13} + +- ثابت موضوع را با `Dictionary` جداول (پرتاب `Size of offsets doesn't match size of column` یا `Unknown compression method` استثنا). این اشکال در نسخه 18.10.3 ظاهر شد. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) +- رفع اشکال هنگام ادغام `CollapsingMergeTree` جداول اگر یکی از قطعات داده خالی است (این قطعات در طول ادغام و یا تشکیل `ALTER DELETE` اگر تمام داده ها حذف شد), و `vertical` الگوریتم برای ادغام مورد استفاده قرار گرفت. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) +- ثابت شرایط مسابقه در طول `DROP` یا `TRUNCATE` برای `Memory` جداول با همزمان `SELECT`, که می تواند به سقوط سرور منجر شود. این اشکال در نسخه 1.1.54388 ظاهر شد. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) +- ثابت امکان از دست دادن داده ها در هنگام قرار دادن در `Replicated` جداول اگر `Session is expired` خطا بازگشته است (از دست دادن داده ها را می توان با شناسایی `ReplicatedDataLoss` متریک). این خطا در نسخه 1.1.54378 رخ داده است. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) +- ثابت segfault در طول `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) +- ثابت خطا جستجو نام ستون زمانی که `WHERE` بیان به طور کامل شامل یک نام ستون واجد شرایط, مانند `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) +- ثابت “Not found column” خطا که هنگام اجرای نمایش داده شد توزیع رخ داده است اگر یک ستون متشکل از یک عبارت در با یک زیرخاکی از یک سرور از راه دور درخواست. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) +- ثابت `Block structure mismatch in UNION stream: different number of columns` خطا که برای نمایش داده شد توزیع رخ داده است اگر یکی از خرده ریز محلی است و از سوی دیگر نمی باشد, و بهینه سازی حرکت به `PREWHERE` باعث شده است. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) +- ثابت `pointInPolygon` تابع برای موارد خاصی از چند ضلعی غیر محدب. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) +- ثابت نتیجه نادرست در هنگام مقایسه `nan` با اعداد صحیح. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) +- ثابت خطا در `zlib-ng` کتابخانه ای که می تواند در موارد نادر به پیش فرض منجر شود. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) +- ثابت نشت حافظه در هنگام قرار دادن به یک جدول با `AggregateFunction` ستون, اگر دولت از تابع کل ساده نیست (اختصاص حافظه به طور جداگانه), و اگر یک درخواست درج نتایج در بلوک های کوچک متعدد. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) +- ثابت شرایط مسابقه در هنگام ایجاد و حذف همان `Buffer` یا `MergeTree` جدول به طور همزمان. +- ثابت امکان یک پشتک زمانی که مقایسه تاپل ساخته شده از برخی از انواع غیر بدیهی, مانند تاپل. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) +- ثابت امکان یک پشتک زمانی که در حال اجرا خاص `ON CLUSTER` نمایش داده شد. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2960) +- ثابت خطا در `arrayDistinct` تابع برای `Nullable` عناصر مجموعه. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) +- این `enable_optimize_predicate_expression` گزینه در حال حاضر به درستی پشتیبانی از موارد با `SELECT *`. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2929) +- ثابت شده است که در هنگام راه اندازی مجدد جلسه باغ وحش. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) +- مسدود کردن پتانسیل ثابت در هنگام کار با باغ وحش. +- کد نادرست ثابت برای اضافه کردن ساختارهای داده تو در تو `SummingMergeTree`. +- هنگام تخصیص حافظه برای ایالت های توابع کل, تراز دلخواه به درستی در نظر گرفته شود, که این امکان را به استفاده از عملیات که نیاز به هم ترازی در هنگام اجرای کشورهای توابع دانه. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) + +#### تعمیر امنیتی: {#security-fix} + +- استفاده ایمن از منابع داده او بی سی. تعامل با رانندگان بی سی با استفاده از یک جداگانه `clickhouse-odbc-bridge` روند. خطاها در رانندگان اد بی سی شخص ثالث دیگر باعث مشکلات با ثبات سرور و یا ناپایداری. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) +- اعتبار سنجی نادرست ثابت از مسیر فایل در `catBoostPool` تابع جدول. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) +- محتویات جداول سیستم (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas` و `replication_queue`) با توجه به دسترسی پیکربندی شده کاربر به پایگاه داده فیلتر شده است (`allow_databases`). [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2856) + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-3} + +- در نمایش داده شد با پیوستن, شخصیت ستاره گسترش می یابد به یک لیست از ستون ها در تمام جداول, در انطباق با استاندارد گذاشتن. شما می توانید رفتار قدیمی با تنظیم بازگرداندن `asterisk_left_columns_only` به 1 در سطح پیکربندی کاربر. + +#### ایجاد تغییرات: {#build-changes-2} + +- اکثر تست های یکپارچه سازی هم اکنون می توانید توسط متعهد اجرا می شود. +- چک سبک کد همچنین می توانید با ارتکاب اجرا می شود. +- این `memcpy` پیاده سازی به درستی در هنگام ساخت در لینوکس7/فدورا انتخاب شده است. [اتین champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) +- هنگام استفاده از صدای شیپور برای ساخت, برخی از هشدارهای از `-Weverything` اضافه شده است, در علاوه بر این به طور منظم `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) +- اشکال زدایی ساخت با استفاده از `jemalloc` گزینه اشکال زدایی. +- رابط کتابخانه برای تعامل با باغ وحش انتزاعی اعلام شده است. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) + +## انتشار کلیک 18.10 {#clickhouse-release-18-10} + +### انتشار کلیک خانه 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} + +#### ویژگی های جدید: {#new-features-5} + +- قام را می توان برای تکرار استفاده می شود. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) +- اضافه شدن توابع `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64` و `murmurHash3_128` علاوه بر موجود `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) +- پشتیبانی از nullable types در clickhouse odbc driver (`ODBCDriver2` فرمت خروجی). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) +- پشتیبانی از `UUID` در ستون های کلیدی. + +#### بهبود: {#improvements-5} + +- خوشه ها را می توان بدون راه اندازی مجدد سرور هنگام حذف از فایل های پیکربندی حذف کرد. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) +- لغت نامه های خارجی را می توان بدون راه اندازی مجدد سرور حذف زمانی که از فایل های پیکربندی حذف شده است. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) +- اضافه شده `SETTINGS` پشتیبانی از `Kafka` موتور جدول. [الکساندر مارشالو](https://github.com/ClickHouse/ClickHouse/pull/2781) +- بهبود برای `UUID` نوع داده (هنوز کامل نیست). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) +- پشتیبانی از قطعات خالی پس از ادغام در `SummingMergeTree`, `CollapsingMergeTree` و `VersionedCollapsingMergeTree` موتورها. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) +- سوابق قدیمی جهش های تکمیل شده حذف می شوند (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) +- اضافه شدن `system.merge_tree_settings` جدول [کیریل شواکوف](https://github.com/ClickHouse/ClickHouse/pull/2841) +- این `system.tables` جدول در حال حاضر ستون وابستگی: `dependencies_database` و `dependencies_table`. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2851) +- اضافه شدن `max_partition_size_to_drop` گزینه پیکربندی. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) +- اضافه شدن `output_format_json_escape_forward_slashes` انتخاب [الکساندر بوچاروف](https://github.com/ClickHouse/ClickHouse/pull/2812) +- اضافه شدن `max_fetch_partition_retries_count` تنظیمات. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) +- اضافه شدن `prefer_localhost_replica` تنظیم برای غیر فعال کردن اولویت برای یک ماکت محلی و رفتن به یک ماکت محلی بدون تعامل بین فرایند. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) +- این `quantileExact` بازده عملکرد کل `nan` در مورد تجمع در خالی `Float32` یا `Float64` حاضر [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) + +#### رفع اشکال: {#bug-fixes-14} + +- حذف غیر ضروری فرار از پارامترهای رشته اتصال برای ان بی سی, ساخته شده است که غیر ممکن است برای ایجاد یک اتصال. این خطا در نسخه 18.6.0 رخ داده است. +- ثابت منطق برای پردازش `REPLACE PARTITION` دستورات در صف تکرار. اگر دو وجود دارد `REPLACE` منطق نادرست میتواند باعث شود که در صف تکرار باقی بمانند و اعدام نشوند. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) +- رفع اشکال ادغام زمانی که تمام قطعات داده خالی بود (بخش هایی که از ادغام و یا از تشکیل شد `ALTER DELETE` اگر تمام داده ها حذف شد). این اشکال در نسخه 18.1.0 ظاهر شد. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) +- ثابت خطا برای همزمان `Set` یا `Join`. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2823) +- ثابت `Block structure mismatch in UNION stream: different number of columns` خطایی که برای `UNION ALL` نمایش داده شد در داخل زیر پرس و جو اگر یکی از `SELECT` نمایش داده شد شامل نام ستون تکراری. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2094) +- ثابت نشت حافظه اگر یک استثنا رخ داده است در هنگام اتصال به یک سرور خروجی زیر. +- ثابت نادرست کد پاسخ کلیک مشتری در صورت خطا پرس و جو. +- رفتار نادرست ثابت از دیدگاه محقق حاوی متمایز. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) + +#### تغییرات ناسازگار به عقب {#backward-incompatible-changes-4} + +- پشتیبانی حذف برای بررسی جدول نمایش داده شد برای جداول توزیع شده است. + +#### ایجاد تغییرات: {#build-changes-3} + +- تخصیص جایگزین شده است: `jemalloc` در حال حاضر به جای استفاده می شود `tcmalloc`. در برخی از حالات, این افزایش سرعت تا 20%. با این حال, نمایش داده شد که تا کند شده وجود دارد 20%. مصرف حافظه شده است حدود کاهش 10% در برخی از حالات, با ثبات بهبود یافته. با بارهای بسیار رقابتی, استفاده از پردازنده در فضای کاربری و در سیستم نشان می دهد فقط یک افزایش کمی. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) +- استفاده از libressl از یک submodule. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) +- استفاده از unixodbc از یک submodule. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) +- استفاده از ماریادب-اتصال-ج از یک زیر زمینی. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) +- اضافه شده فایل های تست عملکردی به مخزن که در دسترس بودن داده های تست بستگی دارد (در حال حاضر, بدون داده های تست خود را). + +## انتشار کلیک 18.6 {#clickhouse-release-18-6} + +### انتشار کلیک 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} + +#### ویژگی های جدید: {#new-features-6} + +- اضافه شدن پشتیبانی برای در عبارات برای عضویت در نحو: + `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` + بیان باید یک زنجیره ای از تجهیزات پیوست شده توسط و اپراتور باشد. هر طرف از برابری می تواند یک بیان دلخواه بیش از ستون از یکی از جداول. استفاده از نام ستون به طور کامل واجد شرایط پشتیبانی می شود (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) برای جدول سمت راست . [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) +- قام را می توان برای تکرار فعال کنید. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) + +#### بهبود: {#improvements-6} + +- سرور بخشی پچ از نسخه خود را به مشتری می گذرد. اطلاعات در مورد مولفه نسخه پچ در `system.processes` و `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) + +## انتشار کلیک 18.5 {#clickhouse-release-18-5} + +### ClickHouse انتشار 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} + +#### ویژگی های جدید: {#new-features-7} + +- تابع هش اضافه شده است `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). + +#### بهبود: {#improvements-7} + +- حالا شما می توانید استفاده کنید `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) نسبت به تنظیم مقادیر در فایل های پیکربندی از متغیرهای محیط زیست. +- نسخه های غیر حساس به حروف اضافه شده است `coalesce`, `ifNull` و `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). + +#### رفع اشکال: {#bug-fixes-15} + +- رفع اشکال ممکن است در هنگام شروع یک ماکت [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). + +## انتشار کلیک 18.4 {#clickhouse-release-18-4} + +### انتشار کلیک 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} + +#### ویژگی های جدید: {#new-features-8} + +- جداول سیستم اضافه شده است: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). +- اضافه شدن توانایی استفاده از یک تابع جدول به جای یک جدول به عنوان یک استدلال از یک `remote` یا `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). +- پشتیبانی از `HTTP Basic` احراز هویت در پروتکل تکرار [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). +- این `has` تابع در حال حاضر اجازه می دهد تا جستجو برای یک مقدار عددی در مجموعه ای از `Enum` مقادیر [ماکسیم خریسانف](https://github.com/ClickHouse/ClickHouse/pull/2699). +- پشتیبانی از اضافه کردن جدا پیام دلخواه در هنگام خواندن از `Kafka` [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2701). + +#### بهبود: {#improvements-8} + +- این `ALTER TABLE t DELETE WHERE` پرس و جو می کند قطعات داده است که توسط جایی که شرایط تحت تاثیر قرار نمی بازنویسی نیست [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). +- این `use_minimalistic_checksums_in_zookeeper` گزینه برای `ReplicatedMergeTree` جداول به طور پیش فرض فعال. این تنظیمات اضافه شده در نسخه 1.1.54378, 2018-04-16. نسخه هایی که مسن تر از 1.1.54378 هستند دیگر نمی توانند نصب شوند. +- پشتیبانی از در حال اجرا `KILL` و `OPTIMIZE` نمایش داده شد که مشخص `ON CLUSTER` [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2689). + +#### رفع اشکال: {#bug-fixes-16} + +- خطا را ثابت کرد `Column ... is not under an aggregate function and not in GROUP BY` برای تجمع با بیان در. این اشکال در نسخه 18.1.0 ظاهر شد. ([ببد780ب](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) +- رفع اشکال در `windowFunnel aggregate function` [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2735). +- رفع اشکال در `anyHeavy` تابع جمع ([الف212](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) +- تصادف سرور ثابت در هنگام استفاده از `countArray()` تابع جمع. + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-5} + +- پارامترها برای `Kafka` موتور از تغییر یافت `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` به `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. اگر جداول خود استفاده کنید `kafka_schema` یا `kafka_num_consumers` پارامترهای, شما باید به صورت دستی ویرایش فایل های ابرداده `path/metadata/database/table.sql` و اضافه کردن `kafka_row_delimiter` پارامتر با `''` ارزش. + +## انتشار کلیک 18.1 {#clickhouse-release-18-1} + +### ClickHouse انتشار 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} + +#### ویژگی های جدید: {#new-features-9} + +- پشتیبانی از `ALTER TABLE t DELETE WHERE` پرسوجو برای جداول ادغام غیر تکرار شده ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). +- پشتیبانی از انواع دلخواه برای `uniq*` خانواده از توابع کل ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). +- پشتیبانی از انواع دلخواه در مقایسه اپراتورها ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). +- این `users.xml` فایل اجازه می دهد تا تنظیم یک ماسک زیر شبکه در قالب `10.0.0.1/255.255.255.0`. این برای استفاده از ماسک برای شبکه های اینترنتی6 با صفر در وسط ضروری است ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). +- اضافه شدن `arrayDistinct` تابع ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). +- این summingmergetree موتور هم اکنون می توانید کار با aggregatefunction نوع ستون ([پان سنتانتین](https://github.com/ClickHouse/ClickHouse/pull/2566)). + +#### بهبود: {#improvements-9} + +- طرح شماره برای نسخه های انتشار تغییر کرده است. در حال حاضر بخش اول شامل سال انتشار (a. d. مسکو منطقه زمانی منهای 2000) بخش دوم شامل تعدادی به صورت عمده تغییرات را افزایش می دهد برای بسیاری منتشر شده) و بخش سوم پچ نسخه. منتشر شده هنوز هم به عقب سازگار هستند, مگر اینکه در غیر این صورت در تغییرات اعلام. +- تبدیل سریع تر اعداد ممیز شناور به یک رشته ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2664)). +- اگر برخی از ردیف در طول درج به دلیل خطاهای تجزیه قلم شد (این ممکن است با `input_allow_errors_num` و `input_allow_errors_ratio` تنظیمات را فعال کنید), تعداد ردیف قلم در حال حاضر به ورود به سیستم سرور نوشته شده است ([لوناردو سیسیچی](https://github.com/ClickHouse/ClickHouse/pull/2669)). + +#### رفع اشکال: {#bug-fixes-17} + +- ثابت فرمان کوتاه برای جداول موقت ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2624)). +- ثابت بن بست نادر در کتابخانه مشتری باغ وحش که رخ داده است زمانی که یک خطای شبکه وجود دارد در حالی که خواندن پاسخ ([315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). +- ثابت خطا در طول بازیگران به nullable types ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). +- ثابت نتیجه نادرست از `maxIntersection()` تابع زمانی که مرزهای فواصل همزمان ([مایکل فورمور](https://github.com/ClickHouse/ClickHouse/pull/2657)). +- تحول نادرست ثابت از زنجیره بیان و یا در یک استدلال تابع ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). +- تخریب عملکرد ثابت برای نمایش داده شد حاوی `IN (subquery)` عبارات در داخل یکی دیگر از خرده فروشی ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). +- ناسازگاری ثابت بین سرورها با نسخه های مختلف در نمایش داده شد توزیع شده است که با استفاده از یک `CAST` تابع است که در حروف بزرگ نیست ([ف8چ4د6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). +- اضافه شده از دست رفته به نقل از شناسه برای نمایش داده شد به سندرم تونل کارپ خارجی ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-6} + +- تبدیل یک رشته حاوی عدد صفر به تاریخ ساعت کار نمی کند. مثال: `SELECT toDateTime('0')`. این نیز دلیل است که `DateTime DEFAULT '0'` در جداول و همچنین کار نمی کند `0` در لغت نامه. راه حل: جایگزین کردن `0` با `0000-00-00 00:00:00`. + +## انتشار کلیک 1.1 {#clickhouse-release-1-1} + +### انتشار کلیک 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} + +#### ویژگی های جدید: {#new-features-10} + +- اضافه شدن `histogram` تابع جمع ([میخیل سورین](https://github.com/ClickHouse/ClickHouse/pull/2521)). +- حالا `OPTIMIZE TABLE ... FINAL` می توان بدون مشخص کردن پارتیشن ها برای `ReplicatedMergeTree` ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2600)). + +#### رفع اشکال: {#bug-fixes-18} + +- رفع مشکل با یک ایست بسیار کوچک برای سوکت (یک ثانیه) برای خواندن و نوشتن در هنگام ارسال و دانلود داده تکرار, ساخته شده است که غیر ممکن است برای دانلود قطعات بزرگتر اگر یک بار بر روی شبکه و یا دیسک وجود دارد (در تلاش دوره ای برای دانلود قطعات منجر). این خطا در نسخه 1.1.54388 رخ داده است. +- مشکلات ثابت در هنگام استفاده از ریشه کن کردن در باغ وحش اگر شما بلوک های داده های تکراری در جدول قرار داده است. +- این `has` تابع در حال حاضر به درستی برای مجموعه ای با عناصر قابل تعویض کار می کند ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). +- این `system.tables` جدول در حال حاضر به درستی کار می کند زمانی که در نمایش داده شد توزیع استفاده می شود. این `metadata_modification_time` و `engine_full` ستون در حال حاضر غیر مجازی. ثابت خطا که رخ داده است اگر تنها این ستون از جدول تردید شد. +- ثابت چگونه خالی `TinyLog` جدول پس از قرار دادن یک بلوک داده خالی کار می کند ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). +- این `system.zookeeper` جدول کار می کند اگر ارزش گره در باغ وحش تهی است. + +### انتشار کلیک 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} + +#### ویژگی های جدید: {#new-features-11} + +- نمایش داده شد را می توان در ارسال `multipart/form-data` قالب (در `query` رشته), مفید است که اگر داده های خارجی نیز برای پردازش پرس و جو ارسال ([اولگا هوستیکوا](https://github.com/ClickHouse/ClickHouse/pull/2490)). +- اضافه شدن توانایی برای فعال یا غیر فعال کردن پردازش نقل قول یک یا دو هنگام خواندن داده ها در فرمت سی سی.وی. شما می توانید این را در پیکربندی `format_csv_allow_single_quotes` و `format_csv_allow_double_quotes` تنظیمات ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2574)). +- حالا `OPTIMIZE TABLE ... FINAL` می توان بدون مشخص کردن پارتیشن برای انواع غیر تکرار استفاده کرد `MergeTree` ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2599)). + +#### بهبود: {#improvements-10} + +- بهبود عملکرد, کاهش مصرف حافظه, و ردیابی مصرف حافظه صحیح با استفاده از اپراتور در زمانی که یک شاخص جدول می تواند مورد استفاده قرار گیرد ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). +- حذف چک کردن کار برکنار شده از چک سام در هنگام اضافه کردن یک بخش داده ها. این مهم است که تعداد زیادی از کپی وجود دارد, چرا که در این موارد تعداد کل چک به نفر برابر بود^2. +- اضافه شدن پشتیبانی برای `Array(Tuple(...))` نشانوندها برای `arrayEnumerateUniq` تابع ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). +- اضافه شده `Nullable` پشتیبانی از `runningDifference` تابع ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). +- بهبود عملکرد تجزیه و تحلیل پرس و جو زمانی که تعداد بسیار زیادی از عبارات وجود دارد ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). +- انتخاب سریع تر از قطعات داده برای ادغام در `ReplicatedMergeTree` میز بازیابی سریع تر از جلسه باغ وحش ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). +- این `format_version.txt` پرونده برای `MergeTree` جداول دوباره ایجاد اگر از دست رفته است, که حس می کند اگر تاتر است پس از کپی کردن ساختار دایرکتوری بدون فایل راه اندازی ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). + +#### رفع اشکال: {#bug-fixes-19} + +- رفع اشکال در هنگام کار با باغ وحش است که می تواند غیر ممکن است برای بازیابی جلسه و خواندنی ایالات جداول قبل از راه اندازی مجدد سرور. +- رفع اشکال در هنگام کار با باغ وحش است که می تواند در گره های قدیمی در نتیجه حذف نمی شود اگر جلسه قطع شده است. +- ثابت خطا در `quantileTDigest` تابع برای استدلال شناور (این اشکال در نسخه 1.1.54388 معرفی شد) ([میخیل سورین](https://github.com/ClickHouse/ClickHouse/pull/2553)). +- رفع اشکال در شاخص برای جداول ادغام اگر ستون کلید اصلی در داخل تابع برای تبدیل انواع بین اعداد صحیح امضا و بدون علامت از همان اندازه واقع شده است ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). +- ثابت segfault اگر `macros` استفاده می شود اما در فایل پیکربندی نیستند ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). +- تعویض ثابت به پایگاه داده به طور پیش فرض در هنگام اتصال مجدد مشتری ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). +- رفع اشکال که زمانی رخ داده است `use_index_for_in_with_subqueries` تنظیم غیر فعال شد. + +#### تعمیر امنیتی: {#security-fix-1} + +- ارسال فایل های دیگر ممکن است زمانی که به خروجی زیر متصل می شود (`LOAD DATA LOCAL INFILE`). + +### انتشار کلیک 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} + +#### ویژگی های جدید: {#new-features-12} + +- پشتیبانی از `ALTER TABLE t DELETE WHERE` پرس و جو برای جداول تکرار. اضافه شدن `system.mutations` جدول برای پیگیری پیشرفت این نوع از نمایش داده شد. +- پشتیبانی از `ALTER TABLE t [REPLACE|ATTACH] PARTITION` پرس و جو برای \* جداول ادغام. +- پشتیبانی از `TRUNCATE TABLE` پرسوجو ([زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2260)) +- چند جدید `SYSTEM` نمایش داده شد برای جداول تکرار (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). +- توانایی نوشتن به یک جدول با موتور خروجی زیر و عملکرد جدول مربوطه اضافه شده است ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). +- اضافه شدن `url()` عملکرد جدول و `URL` موتور جدول ([الکساندر sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). +- اضافه شدن `windowFunnel` تابع جمع ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). +- جدید `startsWith` و `endsWith` توابع برای رشته ها ([وادیم پلختینسکی](https://github.com/ClickHouse/ClickHouse/pull/2429)). +- این `numbers()` تابع جدول در حال حاضر اجازه می دهد تا شما را به مشخص افست ([زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2535)). +- رمز عبور به `clickhouse-client` می توان تعاملی وارد شده است. +- سیاهههای مربوط به سرور هم اکنون می توانید به وبلاگ ارسال می شود ([الکساندر کرشنینیکف](https://github.com/ClickHouse/ClickHouse/pull/2459)). +- پشتیبانی از ورود به لغت نامه ها با یک منبع کتابخانه مشترک ([الکساندر sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). +- پشتیبانی برای سفارشی csv delimiters ([ایوان ژوکوف](https://github.com/ClickHouse/ClickHouse/pull/2263)) +- اضافه شدن `date_time_input_format` تنظیمات. اگر این تنظیم را تغییر دهید `'best_effort'`, ارزش تاریخ ساعت خواهد شد در طیف گسترده ای از فرمت های به عنوان خوانده شده. +- اضافه شدن `clickhouse-obfuscator` ابزار برای مبهم و تاریک کردن داده ها. مثال طریقه استفاده: انتشار داده های مورد استفاده در تست عملکرد. + +#### ویژگی های تجربی: {#experimental-features-2} + +- توانایی محاسبه اضافه شده است `and` استدلال تنها جایی که مورد نیاز هستند ([کشتن از سر ترحم تسارکوا](https://github.com/ClickHouse/ClickHouse/pull/2272)) +- مجموعه کیت به کد بومی در حال حاضر برای برخی از عبارات در دسترس است ([پایوس](https://github.com/ClickHouse/ClickHouse/pull/2277)). + +#### رفع اشکال: {#bug-fixes-20} + +- تکراری دیگر برای پرس و جو با ظاهر `DISTINCT` و `ORDER BY`. +- نمایش داده شد با `ARRAY JOIN` و `arrayFilter` دیگر نتیجه نادرست بازگشت. +- هنگام خواندن یک ستون جداگانه از یک ساختار تو در تو خطایی رخ داد ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). +- ثابت خطا در هنگام تجزیه و تحلیل نمایش داده شد با داشتن بند مانند `HAVING tuple IN (...)`. +- ثابت خطا در هنگام تجزیه و تحلیل نمایش داده شد با نام مستعار بازگشتی. +- ثابت خطا در هنگام خواندن از replacingmergetree با یک بیماری در prewhere فیلتر است که تمام ردیف ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). +- هنگام استفاده از جلسات در رابط اچ تی پی تنظیمات پروفایل کاربر اعمال نشد. +- ثابت چگونه تنظیمات از پارامترهای خط فرمان در خانه کلیک اعمال می شود-محلی. +- کتابخانه مشتری باغ وحش در حال حاضر با استفاده از فاصله جلسه دریافت شده از سرور. +- رفع اشکال در کتابخانه مشتری باغ وحش زمانی که مشتری منتظر پاسخ سرور طولانی تر از ایست. +- هرس ثابت قطعات برای نمایش داده شد با شرایط در ستون های کلیدی پارتیشن ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). +- ادغام در حال حاضر ممکن است پس از `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). +- نقشه برداری نوع در تابع جدول او بی سی ثابت شده است ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). +- مقایسه نوع برای ثابت شده است `DateTime` با و بدون منطقه زمانی ([الکساندر بوچاروف](https://github.com/ClickHouse/ClickHouse/pull/2400)). +- تجزیه نحوی ثابت و قالب بندی از `CAST` اپراتور +- درج ثابت به یک نمایش تحقق برای موتور جدول توزیع شده است ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). +- ثابت شرایط مسابقه در هنگام نوشتن داده ها از `Kafka` موتور به نمایش تحقق ([Yangkuan لیو](https://github.com/ClickHouse/ClickHouse/pull/2448)). +- در از راه دور() تابع جدول ثابت شده است. +- رفتار خروج ثابت از `clickhouse-client` در حالت چند خطی ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). + +#### بهبود: {#improvements-11} + +- وظایف پس زمینه در جداول تکرار در حال حاضر در یک استخر موضوع به جای در موضوعات جداگانه انجام می شود ([سیلو کاراژیا](https://github.com/ClickHouse/ClickHouse/pull/1722)). +- بهبود عملکرد فشرده سازی 2.4. +- تجزیه و تحلیل سریع تر برای نمایش داده شد با تعداد زیادی از می پیوندد و زیر نمایش داده شد. +- کش دی ان اس در حال حاضر به طور خودکار به روز هنگامی که بیش از حد بسیاری از خطاهای شبکه وجود دارد. +- جدول درج دیگر رخ می دهد, اگر وارد یکی از این محقق views امکان پذیر نیست به دلیل آن است بیش از حد بسیاری از قطعات. +- اصلاح اختلاف در شمارنده رویداد `Query`, `SelectQuery` و `InsertQuery`. +- عبارات مانند `tuple IN (SELECT tuple)` مجاز اگر انواع تاپل مطابقت. +- سرور با جداول تکرار می توانید شروع به حتی اگر شما باغ وحش پیکربندی نشده است. +- هنگام محاسبه تعداد هسته های پردازنده در دسترس, محدودیت در گروه های گروه در حال حاضر در نظر گرفته شود ([اتری شارما](https://github.com/ClickHouse/ClickHouse/pull/2325)). +- اضافه شده پیون برای دایرکتوری پیکربندی در فایل پیکربندی سیستم ([میخیل شیریو](https://github.com/ClickHouse/ClickHouse/pull/2421)). + +#### ایجاد تغییرات: {#build-changes-4} + +- کامپایلر جی سی8 را می توان برای ساخت استفاده می شود. +- اضافه شده توانایی برای ساخت llvm از submodule. +- این نسخه از librdkafka کتابخانه به روز شده است برای v0.11.4. +- اضافه شدن توانایی استفاده از کتابخانه سیستم لیبکپویید. نسخه کتابخانه شده است به 0.4.0 به روز شد. +- ثابت ساخت با استفاده از vectorclass کتابخانه ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). +- در حال حاضر تولید فایل برای نینجا به طور پیش فرض (مانند هنگام استفاده از `-G Ninja`). +- اضافه شدن قابلیت استفاده از کتابخانه لیبتاینفو به جای نوشیدن شراب ([جورجی کندراتیف](https://github.com/ClickHouse/ClickHouse/pull/2519)). +- رفع یک درگیری فایل هدر در فدورا پوست دباغی نشده ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-7} + +- حذف فرار در `Vertical` و `Pretty*` فرمت ها و حذف `VerticalRaw` قالب. +- اگر سرور با نسخه 1.1.54388 (یا جدیدتر) و سرور با نسخه های قدیمی تر به طور همزمان در یک پرس و جو توزیع استفاده می شود و پرس و جو است `cast(x, 'Type')` بیان بدون `AS` کلمه کلیدی و کلمه ندارد `cast` در بزرگ, یک استثنا خواهد شد با یک پیام مانند پرتاب `Not found column cast(0, 'UInt8') in block`. تخلیه: به روز رسانی سرور در کل خوشه. + +### انتشار کلیک 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} + +#### رفع اشکال: {#bug-fixes-21} + +- ثابت خطا که در برخی موارد باعث عملیات باغ وحش برای جلوگیری از. + +### انتشار کلیک 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} + +#### رفع اشکال: {#bug-fixes-22} + +- ثابت کاهش سرعت صف تکرار اگر یک جدول است بسیاری از کپی. + +### انتشار کلیک 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} + +#### رفع اشکال: {#bug-fixes-23} + +- ثابت نشت گره در باغ وحش زمانی که خانه رعیتی اتصال به سرور باغ وحش از دست می دهد. + +### ClickHouse انتشار 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} + +#### ویژگی های جدید: {#new-features-13} + +- تابع جدول اضافه شده است `file(path, format, structure)`. به عنوان مثال خواندن بایت از `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. + +#### بهبود: {#improvements-12} + +- زیرمجموعه ها را می توان در `()` براکت به منظور افزایش خوانایی پرس و جو. به عنوان مثال: `(SELECT 1) UNION ALL (SELECT 1)`. +- ساده `SELECT` نمایش داده شد از `system.processes` جدول در شامل نمی شود `max_concurrent_queries` حد. + +#### رفع اشکال: {#bug-fixes-24} + +- رفتار نادرست ثابت از `IN` اپراتور هنگام انتخاب از `MATERIALIZED VIEW`. +- فیلتر نادرست ثابت توسط شاخص پارتیشن در عبارات مانند `partition_key_column IN (...)`. +- ناتوانی ثابت برای اجرا `OPTIMIZE` پرس و جو در ماکت غیر رهبر اگر `REANAME` بر روی میز انجام شد. +- خطای مجوز هنگام اجرای ثابت شد `OPTIMIZE` یا `ALTER` نمایش داده شد در یک ماکت غیر رهبر. +- انجماد ثابت `KILL QUERY`. +- رفع خطا در کتابخانه مشتری باغ وحش که منجر به از دست دادن ساعت انجماد توزیع صف دی ال و کاهش سرعت در صف تکرار اگر غیر خالی `chroot` پیشوند در پیکربندی باغ وحش استفاده می شود. + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-8} + +- پشتیبانی حذف برای عبارات مانند `(a, b) IN (SELECT (a, b))` (شما می توانید بیان معادل استفاده کنید `(a, b) IN (SELECT a, b)`). در نسخه های قبلی, این عبارات منجر به نامشخص `WHERE` فیلتر کردن یا ایجاد خطا. + +### انتشار کلیک 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} + +#### ویژگی های جدید: {#new-features-14} + +- ورود به سیستم سطح را می توان بدون راه اندازی مجدد سرور تغییر کرده است. +- اضافه شدن `SHOW CREATE DATABASE` پرس و جو. +- این `query_id` می توان به تصویب رسید `clickhouse-client` . +- تنظیمات جدید: `max_network_bandwidth_for_all_users`. +- اضافه شدن پشتیبانی برای `ALTER TABLE ... PARTITION ...` برای `MATERIALIZED VIEW`. +- اطلاعات اضافه شده در مورد اندازه قطعات داده در فرم غیر فشرده در جدول سیستم. +- پشتیبانی از رمزگذاری سرور به سرور برای جداول توزیع شده (`1` در پیکربندی ماکت در ``). +- پیکربندی سطح جدول برای `ReplicatedMergeTree` خانواده به منظور به حداقل رساندن مقدار داده های ذخیره شده در باغ وحش: : `use_minimalistic_checksums_in_zookeeper = 1` +- پیکربندی از `clickhouse-client` اعلان کردن. به طور پیش فرض, نام سرور در حال حاضر خروجی به اعلان. نام صفحه نمایش سرور را می توان تغییر داد. همچنین در ارسال `X-ClickHouse-Display-Name` HTTP header (Kirill Shvakov). +- چند کاما از هم جدا `topics` می توان برای مشخص `Kafka` موتور (توبیاس Adamson) +- هنگامی که یک پرس و جو توسط متوقف `KILL QUERY` یا `replace_running_query` مشتری دریافت می کند `Query was canceled` استثنا به جای یک نتیجه ناقص. + +#### بهبود: {#improvements-13} + +- `ALTER TABLE ... DROP/DETACH PARTITION` نمایش داده شد در مقابل صف تکرار اجرا شود. +- `SELECT ... FINAL` و `OPTIMIZE ... FINAL` می توان حتی زمانی که جدول دارای یک بخش داده واحد استفاده می شود. +- A `query_log` جدول در پرواز دوباره اگر به صورت دستی حذف شد (کریل شواکوف). +- این `lengthUTF8` عملکرد سریعتر اجرا می شود (ژانگ2014). +- بهبود عملکرد درج همزمان در `Distributed` جداول (`insert_distributed_sync = 1`) هنگامی که تعداد بسیار زیادی از خرده ریز وجود دارد. +- سرور می پذیرد `send_timeout` و `receive_timeout` تنظیمات از مشتری و در هنگام اتصال به مشتری اعمال می شود (که در جهت معکوس اعمال می شود: سوکت سرور `send_timeout` به مجموعه `receive_timeout` ارزش دریافت شده از مشتری و بالعکس). +- بازیابی سقوط قوی تر برای درج ناهمزمان به `Distributed` میز +- نوع بازگشت `countEqual` تابع تغییر از `UInt32` به `UInt64` (谢磊). + +#### رفع اشکال: {#bug-fixes-25} + +- ثابت خطا با `IN` هنگامی که سمت چپ عبارت است `Nullable`. +- نتایج صحیح در حال حاضر در هنگام استفاده از تاپل با بازگشت `IN` هنگامی که برخی از اجزای تاپل در شاخص جدول هستند. +- این `max_execution_time` محدود در حال حاضر به درستی کار می کند با نمایش داده شد توزیع شده است. +- خطاهای ثابت هنگام محاسبه اندازه ستون های کامپوزیت در `system.columns` جدول +- هنگام ایجاد یک جدول موقت خطایی رخ داد `CREATE TEMPORARY TABLE IF NOT EXISTS.` +- خطاهای ثابت در `StorageKafka` (\#\#2075) +- سقوط سرور ثابت از استدلال نامعتبر از توابع مجموع خاص. +- ثابت خطا که مانع از `DETACH DATABASE` پرسو جو از توقف وظایف پس زمینه برای `ReplicatedMergeTree` میز +- `Too many parts` دولت کمتر احتمال دارد به اتفاق می افتد در هنگام قرار دادن به نمایش مواد جمع (\#2084). +- دست زدن به بازگشتی اصلاح تعویض در پیکربندی اگر یک تعویض باید توسط جایگزینی دیگر در همان سطح به دنبال. +- اصلاح نحو در فایل ابرداده در هنگام ایجاد یک `VIEW` که با استفاده از یک پرس و جو با `UNION ALL`. +- `SummingMergeTree` در حال حاضر به درستی کار می کند برای جمع ساختارهای داده های تو در تو با یک کلید کامپوزیت. +- ثابت امکان شرایط مسابقه در هنگام انتخاب رهبر برای `ReplicatedMergeTree` میز + +#### ایجاد تغییرات: {#build-changes-5} + +- پشتیبانی ساخت `ninja` به جای `make` و موارد استفاده `ninja` به طور پیش فرض برای انتشار ساختمان. +- بسته تغییر نام داد: `clickhouse-server-base` داخل `clickhouse-common-static`; `clickhouse-server-common` داخل `clickhouse-server`; `clickhouse-common-dbg` داخل `clickhouse-common-static-dbg`. برای نصب استفاده کنید `clickhouse-server clickhouse-client`. بسته با نام های قدیمی هنوز هم در مخازن برای سازگاری بار. + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-9} + +- حذف تفسیر خاص از یک عبارت در اگر مجموعه ای در سمت چپ مشخص شده است. قبلا بیان `arr IN (set)` به عنوان تفسیر شد “at least one `arr` element belongs to the `set`”. برای دریافت همان رفتار در نسخه جدید, نوشتن `arrayExists(x -> x IN (set), arr)`. +- استفاده نادرست از گزینه سوکت را غیرفعال کرد `SO_REUSEPORT`, که به اشتباه به طور پیش فرض در کتابخانه کم فعال شد. توجه داشته باشید که در لینوکس دیگر هیچ دلیلی وجود ندارد که به طور همزمان نشانی ها را مشخص کند `::` و `0.0.0.0` for listen – use just `::`, که اجازه می دهد گوش دادن به اتصال هر دو بیش از لیگ4 و ایپو6 (با تنظیمات پیکربندی هسته به طور پیش فرض). شما همچنین می توانید به رفتار از نسخه های قبلی با مشخص برگرداندن `1` در پیکربندی. + +### انتشار کلیک 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} + +#### ویژگی های جدید: {#new-features-15} + +- اضافه شدن `system.macros` جدول و به روز رسانی خودکار از ماکروها زمانی که فایل پیکربندی تغییر کرده است. +- اضافه شدن `SYSTEM RELOAD CONFIG` پرس و جو. +- اضافه شدن `maxIntersections(left_col, right_col)` تابع جمع, که حداکثر تعداد فواصل به طور همزمان متقاطع گرداند `[left; right]`. این `maxIntersectionsPosition(left, right)` تابع می گرداند ابتدای “maximum” فاصله. ([مایکل فورمور](https://github.com/ClickHouse/ClickHouse/pull/2012)). + +#### بهبود: {#improvements-14} + +- هنگام وارد کردن داده ها در یک `Replicated` جدول, درخواست کمتر به ساخته شده `ZooKeeper` (و بسیاری از خطاهای سطح کاربر از ناپدید شد `ZooKeeper` ورود). +- توانایی ایجاد نام مستعار برای مجموعه داده ها اضافه شده است. مثال: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. + +#### رفع اشکال: {#bug-fixes-26} + +- ثابت `Illegal PREWHERE` خطا هنگام خواندن از جداول ادغام برای `Distributed`میز +- رفع اضافه شده است که به شما اجازه شروع کلیک سرور در ظروف فایل اجرایی فقط 4. +- ثابت شرایط مسابقه در هنگام خواندن از سیستم `system.parts_columns tables.` +- بافر دو حذف در طول یک درج همزمان به یک `Distributed` جدول, که می تواند باعث اتصال به ایست. +- رفع اشکال که باعث انتظار بیش از حد طولانی برای یک ماکت در دسترس نیست قبل از شروع یک `SELECT` پرس و جو. +- تاریخ نادرست ثابت در `system.parts` جدول +- رفع اشکال ساخته شده است که غیر ممکن است برای وارد کردن داده ها در یک `Replicated` جدول اگر `chroot` غیر خالی در پیکربندی بود `ZooKeeper` خوشه خوشه. +- ثابت الگوریتم ادغام عمودی برای خالی `ORDER BY` جدول +- ترمیم توانایی استفاده از لغت نامه در نمایش داده شد به جداول از راه دور, حتی اگر این لغت نامه در سرور درخواست وجود ندارد. این قابلیت در نسخه 1.1.54362 از دست داده بود. +- ترمیم رفتار برای نمایش داده شد مانند `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` هنگامی که در سمت راست از `IN` باید از راه دور استفاده کنید `default.table` به جای یک محلی. این رفتار در نسخه 1.1.54358 شکسته شد. +- حذف غیر اصلی ورود به سیستم سطح خطا از `Not found column ... in block`. + +### انتشار کلیک 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} + +#### ویژگی های جدید: {#new-features-16} + +- تجمع بدون `GROUP BY` برای یک مجموعه خالی (مانند `SELECT count(*) FROM table WHERE 0`) در حال حاضر در نتیجه با یک ردیف با ارزش تهی برای توابع کل گرداند, در انطباق با استاندارد گذاشتن. برای بازگرداندن رفتار قدیمی (بازگشت به نتیجه خالی), تنظیم `empty_result_for_aggregation_by_empty_set` به 1. +- تبدیل نوع اضافه شده برای `UNION ALL`. نام مستعار مختلف مجاز است `SELECT` موقعیت خود را در `UNION ALL`, در انطباق با استاندارد گذاشتن. +- عبارات دلخواه در پشتیبانی `LIMIT BY` بند. قبلا, تنها ممکن بود به استفاده از ستون ناشی از `SELECT`. +- یک شاخص از `MergeTree` جداول استفاده می شود که `IN` به یک تاپل عبارات از ستون کلید اصلی اعمال می شود. مثال: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` هشدار داده می شود +- اضافه شدن `clickhouse-copier` ابزار برای کپی کردن بین خوشه ها و داده های تغییر شکل (بتا). +- اضافه شده توابع هش سازگار: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. آنها را می توان به عنوان یک sharding کلیدی به منظور کاهش مقدار از ترافیک شبکه در طول پس از آن reshardings. +- اضافه شدن توابع: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. +- اضافه شدن `arrayCumSum` تابع (جوی سانتانا). +- اضافه شدن `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero` و `parseDateTimeBestEffortOrNull` توابع برای خواندن تاریخ ساعت از یک رشته حاوی متن در طیف گسترده ای از فرمت های ممکن. +- داده ها را می توان تا حدی از لغت نامه های خارجی در طول به روز رسانی دوباره (بار فقط سوابق که ارزش این زمینه مشخص شده بیشتر از در دانلود قبلی) (ارسن هاکوبیان). +- اضافه شدن `cluster` تابع جدول. مثال: `cluster(cluster_name, db, table)`. این `remote` تابع جدول می توانید نام خوشه به عنوان اولین استدلال قبول, اگر به عنوان یک شناسه مشخص. +- این `remote` و `cluster` توابع جدول را می توان در `INSERT` نمایش داده شد. +- اضافه شدن `create_table_query` و `engine_full` ستون های مجازی به `system.tables`جدول این `metadata_modification_time` ستون مجازی است. +- اضافه شدن `data_path` و `metadata_path` ستونها به `system.tables`و`system.databases` جداول و اضافه شدن `path` ستون به `system.parts` و `system.parts_columns` میز +- اضافه شدن اطلاعات اضافی در مورد ادغام در `system.part_log` جدول +- یک کلید پارتیشن بندی دلخواه می تواند برای `system.query_log` جدول (کریل شواکوف). +- این `SHOW TABLES` پرس و جو در حال حاضر نیز جداول موقت را نشان می دهد. جداول موقت و `is_temporary` ستون به `system.tables` (ژانگ2014). +- اضافه شده `DROP TEMPORARY TABLE` و `EXISTS TEMPORARY TABLE` نمایش داده شد (ژانگ2014). +- پشتیبانی از `SHOW CREATE TABLE` برای جداول موقت (ژانگ2014). +- اضافه شدن `system_profile` پارامتر پیکربندی برای تنظیمات مورد استفاده توسط فرایندهای داخلی. +- پشتیبانی برای بارگذاری `object_id` به عنوان یک ویژگی در `MongoDB` واژهنامهها (پاول لیتویننکو). +- خواندن `null` به عنوان مقدار پیش فرض هنگام بارگذاری داده ها برای یک فرهنگ لغت خارجی با `MongoDB` منبع (پاول لیتویننکو). +- خواندن `DateTime` ارزش در `Values` فرمت از برچسب زمان یونیکس بدون نقل قول تنها. +- عدم موفقیت در پشتیبانی `remote` توابع جدول برای موارد زمانی که برخی از کپی از دست رفته جدول درخواست. +- تنظیمات پیکربندی را می توان در خط فرمان باطل زمانی که شما اجرا `clickhouse-server`. مثال: `clickhouse-server -- --logger.level=information`. +- اجرا `empty` تابع از یک `FixedString` استدلال: تابع بازده 1 اگر رشته شامل به طور کامل از بایت پوچ (ژانگ2014). +- اضافه شدن `listen_try`پارامتر پیکربندی برای گوش دادن به حداقل یکی از نشانی های گوش دادن بدون ترک, اگر برخی از نشانی ها را نمی توان به گوش (مفید برای سیستم های با پشتیبانی غیر فعال برای لیگ4 یا ایپو6). +- اضافه شدن `VersionedCollapsingMergeTree` موتور جدول. +- پشتیبانی از ردیف ها و انواع عددی دلخواه برای `library` منبع فرهنگ لغت. +- `MergeTree` جداول را می توان بدون یک کلید اولیه استفاده می شود (شما نیاز به مشخص `ORDER BY tuple()`). +- A `Nullable` نوع می تواند باشد `CAST` به یک غیر-`Nullable` نوع اگر استدلال نیست `NULL`. +- `RENAME TABLE` می توان برای انجام `VIEW`. +- اضافه شدن `throwIf` تابع. +- اضافه شدن `odbc_default_field_size` گزینه, که اجازه می دهد تا شما را به گسترش حداکثر اندازه از ارزش لود شده از یک منبع بی سی (به طور پیش فرض, این هست 1024). +- این `system.processes` جدول و `SHOW PROCESSLIST` در حال حاضر `is_cancelled` و `peak_memory_usage` ستون ها + +#### بهبود: {#improvements-15} + +- محدودیت ها و سهمیه بندی در نتیجه دیگر به داده های متوسط برای اعمال `INSERT SELECT` نمایش داده شد و یا برای `SELECT` subqueries. +- باعث کاذب کمتر از `force_restore_data` هنگام چک کردن وضعیت `Replicated` جداول زمانی که سرور شروع می شود. +- اضافه شدن `allow_distributed_ddl` انتخاب +- توابع نامشخص در عبارات برای مجاز نیست `MergeTree` کلید های جدول. +- پروندهها با جایگزینی از `config.d` دایرکتوری ها به ترتیب حروف الفبا لود می شود. +- بهبود عملکرد `arrayElement` تابع در مورد یک مجموعه چند بعدی ثابت با مجموعه ای خالی به عنوان یکی از عناصر. مثال: `[[1], []][x]`. +- سرور شروع می شود سریع تر در حال حاضر در هنگام استفاده از فایل های پیکربندی با تعویض بسیار بزرگ (به عنوان مثال, لیست بسیار زیادی از شبکه های اینترنتی). +- هنگامی که در حال اجرا یک پرس و جو, جدول توابع ارزش اجرا یک بار. قبلا, `remote` و `mysql` جدول ارزش توابع پرس و جو همان دو بار انجام برای بازیابی ساختار جدول از یک سرور از راه دور. +- این `MkDocs` ژنراتور مستندات استفاده شده است. +- هنگامی که شما سعی می کنید یک ستون جدول را حذف کنید که `DEFAULT`/`MATERIALIZED` عبارات از ستون های دیگر بستگی دارد, یک استثنا پرتاب می شود (ژانگ2014). +- اضافه شدن توانایی تجزیه یک خط خالی در فرمت های متن به عنوان شماره 0 برای `Float` انواع داده ها. این ویژگی قبلا در دسترس بود اما در نسخه 1.1.54342 از دست داده بود. +- `Enum` مقادیر را می توان در استفاده `min`, `max`, `sum` و برخی دیگر توابع. در این موارد با استفاده از آن مربوط به مقادیر عددی. این ویژگی قبلا در دسترس بود اما از دست رفته در انتشار 1.1.54337. +- اضافه شده `max_expanded_ast_elements` برای محدود کردن اندازه از اس تی پس از نام مستعار به صورت بازگشتی در حال گسترش است. + +#### رفع اشکال: {#bug-fixes-27} + +- ثابت مواردی که غیر ضروری ستون حذف شده از subqueries در خطا یا حذف نشده از subqueries حاوی `UNION ALL`. +- رفع اشکال در ادغام برای `ReplacingMergeTree` میز +- درج همزمان ثابت در `Distributed` جداول (`insert_distributed_sync = 1`). +- پیش فرض ثابت برای استفاده های خاص از `FULL` و `RIGHT JOIN` با ستون تکراری در کارخانه های فرعی. +- پیش فرض ثابت برای استفاده های خاص از `replace_running_query` و `KILL QUERY`. +- ثابت منظور از `source` و `last_exception` ستون ها در `system.dictionaries` جدول +- رفع اشکال زمانی که `DROP DATABASE` پرس و جو فایل را با ابرداده را حذف کنید. +- ثابت `DROP DATABASE` پرسوجو برای `Dictionary` پایگاه داده. +- ثابت دقت کم `uniqHLL12` و `uniqCombined` توابع برای کارتنیت بیشتر از 100 میلیون مورد (الکس بوچاروف). +- ثابت محاسبه مقادیر پیش فرض ضمنی در صورت لزوم به طور همزمان محاسبه عبارات صریح و روشن به طور پیش فرض در `INSERT` نمایش داده شد (ژانگ2014). +- ثابت یک مورد نادر زمانی که یک پرس و جو به یک `MergeTree` جدول نمی تواند به پایان برسد (فکس ایکس سی). +- ثابت تصادف رخ داده است که در حال اجرا `CHECK` پرسوجو برای `Distributed` جداول اگر تمام خرده ریز محلی هستند (فکس.اطلاعات دقیق +- ثابت رگرسیون عملکرد کمی با توابع است که با استفاده از عبارات منظم. +- ثابت رگرسیون عملکرد در هنگام ایجاد مجموعه های چند بعدی از عبارات پیچیده است. +- ثابت یک اشکال است که می تواند اضافی `FORMAT` بخش به نظر می رسد در یک `.sql` فایل با ابرداده. +- رفع اشکال که باعث `max_table_size_to_drop` محدود به درخواست در هنگام تلاش برای حذف یک `MATERIALIZED VIEW` با نگاهی به یک جدول به صراحت مشخص. +- ناسازگاری ثابت با مشتریان قدیمی (مشتریان قدیمی گاهی اوقات داده ها را با `DateTime('timezone')` نوع, که درک نمی کنند). +- رفع اشکال در هنگام خواندن `Nested` عناصر ستون سازه هایی که با استفاده از اضافه شد `ALTER` اما این برای پارتیشن های قدیمی خالی است, زمانی که شرایط را برای این ستون ها به نقل مکان کرد `PREWHERE`. +- رفع اشکال هنگام فیلتر کردن جداول توسط مجازی `_table` ستون در نمایش داده شد به `Merge` میز +- رفع اشکال در هنگام استفاده از `ALIAS` ستونها در `Distributed` میز +- رفع اشکال ساخته شده است که تلفیقی پویا غیر ممکن است برای نمایش داده شد با توابع کل از `quantile` خانواده +- ثابت شرایط مسابقه در خط لوله اجرای پرس و جو که در موارد بسیار نادر رخ داده است در هنگام استفاده از `Merge` جداول با تعداد زیادی از جداول, و در هنگام استفاده از `GLOBAL` subqueries. +- تصادف را هنگام عبور از اندازه های مختلف به یک ثابت کرد `arrayReduce` تابع در هنگام استفاده از توابع کل از استدلال های متعدد. +- ممنوع استفاده از نمایش داده شد با `UNION ALL` در یک `MATERIALIZED VIEW`. +- خطا در هنگام مقدار دهی اولیه از ثابت `part_log` جدول سیستم زمانی که سرور شروع می شود (به طور پیش فرض, `part_log` غیر فعال است). + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-10} + +- حذف `distributed_ddl_allow_replicated_alter` انتخاب این رفتار به طور پیش فرض فعال. +- حذف `strict_insert_defaults` تنظیمات. اگر شما با استفاده از این قابلیت, ارسال به `clickhouse-feedback@yandex-team.com`. +- حذف `UnsortedMergeTree` موتور + +### انتشار کلیک 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} + +- اضافه شدن پشتیبانی از ماکرو برای تعریف نام خوشه در نمایش داده شد ددل توزیع و سازنده جداول توزیع شده است: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. +- در حال حاضر نمایش داده شد مانند `SELECT ... FROM table WHERE expr IN (subquery)` با استفاده از پردازش `table` نمایه. +- پردازش تکراری بهبود یافته در هنگام قرار دادن به جداول تکرار, به طوری که دیگر کم کردن سرعت اجرای صف تکرار. + +### انتشار کلیک 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} + +این نسخه شامل رفع اشکال برای نسخه قبلی 1.1.54337: + +- ثابت رگرسیون در 1.1.54337: اگر کاربر به طور پیش فرض دسترسی خوانده است, سپس سرور حاضر به راه اندازی با پیام `Cannot create database in readonly mode`. +- ثابت رگرسیون در 1.1.54337: در سیستم های با سیستم, سیاهههای مربوط همیشه به سای لاگ صرف نظر از پیکربندی نوشته شده; اسکریپت دیده بان هنوز هم با استفاده از اینیت.د +- ثابت رگرسیون در 1.1.54337: پیکربندی پیش فرض اشتباه در تصویر کارگر بارانداز. +- ثابت nondeterministic رفتار graphitemergetree (شما می توانید آن را در ورود به سیستم پیام `Data after merge is not byte-identical to the data on another replicas`). +- رفع اشکال که ممکن است منجر به ادغام متناقض پس از بهینه سازی پرس و جو به تکرار جداول (شما ممکن است در پیام ورود به سیستم را ببینید `Part ... intersects the previous part`). +- جداول بافر در حال حاضر به درستی کار زمانی که ستون محقق در جدول مقصد وجود دارد (توسط ژانگ2014). +- رفع اشکال در اجرای پوچ. + +### انتشار کلیک 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} + +#### ویژگی های جدید: {#new-features-17} + +- اضافه شدن پشتیبانی برای ذخیره سازی از مجموعه های چند بعدی و تاپل (`Tuple` نوع داده) در جداول. +- پشتیبانی از توابع جدول برای `DESCRIBE` و `INSERT` نمایش داده شد. اضافه شدن پشتیبانی برای کارخانه های فرعی در `DESCRIBE`. مثالها: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. پشتیبانی از `INSERT INTO TABLE` علاوه بر `INSERT INTO`. +- پشتیبانی بهبود یافته برای مناطق زمانی. این `DateTime` نوع داده را می توان با منطقه زمانی است که برای تجزیه و قالب بندی در فرمت های متنی استفاده مشروح. مثال: `DateTime('Europe/Moscow')`. هنگامی که زمان در توابع برای مشخص `DateTime` استدلال, نوع بازگشت منطقه زمانی پیگیری, و ارزش نمایش داده خواهد شد به عنوان انتظار می رود. +- اضافه شدن توابع `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. این `toRelativeHour`/`Minute`/`Second` توابع می توانند یک مقدار از نوع را `Date` به عنوان یک استدلال. این `now` نام تابع حساس به حروف است. +- اضافه شدن `toStartOfFifteenMinutes` تابع (کریل شواکوف). +- اضافه شدن `clickhouse format` ابزار برای قالب بندی نمایش داده شد. +- اضافه شدن `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` قالب. فایل های طرح را می توان تنها در دایرکتوری مشخص شده واقع شده است. +- اضافه شدن پشتیبانی برای تعویض پیکربندی (`incl` و `conf.d`) برای پیکربندی لغت نامه ها و مدل های خارجی (پاول یاکونین). +- اضافه شدن یک ستون با اسناد و مدارک برای `system.settings` جدول (Kirill Shvakov). +- اضافه شدن `system.parts_columns` جدول با اطلاعات در مورد اندازه ستون در هر بخش داده ها از `MergeTree` میز +- اضافه شدن `system.models` جدول با اطلاعات در مورد لود `CatBoost` مدل های یادگیری ماشین. +- اضافه شدن `mysql` و `odbc` عملکرد جدول و متناظر `MySQL` و `ODBC` موتورهای جدول برای دسترسی به پایگاه داده از راه دور. این قابلیت در مرحله بتا است. +- اضافه شدن امکان به تصویب یک استدلال از نوع `AggregateFunction` برای `groupArray` تابع جمع (بنابراین شما می توانید مجموعه ای از کشورهای برخی از تابع جمع ایجاد). +- محدودیت حذف در ترکیب های مختلف از ترکیب تابع جمع. مثلا, شما می توانید استفاده کنید `avgForEachIf` و همچنین `avgIfForEach` توابع مجموع, که رفتارهای مختلف. +- این `-ForEach` ترکیب تابع مجموع برای مورد توابع مجموع استدلال های متعدد گسترش یافته است. +- اضافه شدن پشتیبانی از توابع کل `Nullable` استدلال حتی برای موارد زمانی که تابع غیر گرداند-`Nullable` نتیجه (اضافه شده با سهم سیلو کاروجا). مثال: `groupArray`, `groupUniqArray`, `topK`. +- اضافه شدن `max_client_network_bandwidth` برای `clickhouse-client` (Kirill Shvakov). +- کاربران با `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). +- اضافه شدن پشتیبانی برای استفاده از مصرف کنندگان متعدد با `Kafka` موتور گزینه های پیکربندی گسترده برای `Kafka` (Marek Vavruša). +- اضافه شدن `intExp3` و `intExp4` توابع. +- اضافه شدن `sumKahan` تابع جمع. +- اضافه شده به \* شماره\* توابع پرنده, جایی که \* شماره \* یک نوع عددی است. +- اضافه شدن پشتیبانی برای `WITH` جملات برای `INSERT SELECT` پرس و جو (نویسنده: ژانگ2014). +- تنظیمات اضافه شده: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. به خصوص این تنظیمات برای دانلود قطعات داده ها برای تکرار استفاده می شود. تغییر این تنظیمات اجازه می دهد تا برای عدم موفقیت سریع تر اگر شبکه غیرمنتظره است. +- اضافه شدن پشتیبانی برای `ALTER` برای جداول نوع `Null` هشدار داده می شود +- این `reinterpretAsString` تابع برای تمام انواع داده ها که به روشنی در حافظه ذخیره می شود گسترش یافته است. +- اضافه شدن `--silent` گزینه ای برای `clickhouse-local` ابزار. این سرکوب چاپ اطلاعات اجرای پرس و جو در خ. +- اضافه شدن پشتیبانی برای خواندن مقادیر نوع `Date` از متن در قالب ای که ماه و / یا روز از ماه مشخص شده است با استفاده از یک رقم واحد به جای دو رقم (پرنده ایموس). + +#### بهینه سازی عملکرد: {#performance-optimizations} + +- عملکرد بهبود یافته از توابع کل `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` از استدلال رشته. +- عملکرد بهبود یافته از توابع `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. +- بهبود عملکرد تجزیه و قالب بندی `Date` و `DateTime` ارزش نوع در قالب متن. +- بهبود عملکرد و دقت تجزیه اعداد ممیز شناور. +- کاهش استفاده از حافظه برای `JOIN` در مورد زمانی که قطعات چپ و راست ستون با نام یکسان است که در موجود نیست `USING` . +- عملکرد بهبود یافته از توابع کل `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` با کاهش ثبات محاسباتی. توابع قدیمی تحت نام در دسترس هستند `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. + +#### رفع اشکال: {#bug-fixes-28} + +- ثابت data deduplication را پس از اجرا `DROP` یا `DETACH PARTITION` پرس و جو. در نسخه های قبلی, حذف یک پارتیشن و قرار دادن داده های مشابه دوباره کار نمی کند چرا بلوک قرار داده تکراری در نظر گرفته شد. +- رفع اشکال که می تواند به تفسیر نادرست از منجر شود `WHERE` بند برای `CREATE MATERIALIZED VIEW` نمایش داده شد با `POPULATE` . +- رفع اشکال در استفاده از `root_path` پارامتر در `zookeeper_servers` پیکربندی. +- نتایج غیر منتظره ثابت از عبور از `Date` نشانوند به `toStartOfDay` . +- ثابت `addMonths` و `subtractMonths` توابع و حساب برای `INTERVAL n MONTH` در مواردی که نتیجه سال گذشته است. +- اضافه شدن پشتیبانی از دست رفته برای `UUID` نوع داده برای `DISTINCT` , `JOIN` و `uniq` توابع جمع و لغت نامه های خارجی (اوگنی ایوانف). پشتیبانی از `UUID` هنوز ناقصه +- ثابت `SummingMergeTree` رفتار در مواردی که ردیف خلاصه به صفر است. +- رفع مختلف برای `Kafka` engine (Marek Vavruša). +- رفتار نادرست ثابت از `Join` موتور جدول (پرنده ایموس). +- رفتار تخصیص نادرست ثابت تحت بورس و سیستم عامل ایکس. +- این `extractAll` تابع در حال حاضر مسابقات خالی پشتیبانی می کند. +- ثابت خطا که استفاده از مسدود `libressl` به جای `openssl` . +- ثابت `CREATE TABLE AS SELECT` پرس و جو از جداول موقت. +- ثابت غیر atomicity از به روز رسانی تکرار صف. این می تواند منجر به کپی بودن از همگام سازی تا سرور ری استارت. +- سرریز ممکن ثابت در `gcd` , `lcm` و `modulo` (`%` اپراتور) (ماکس اسکروخد). +- `-preprocessed` فایل ها در حال حاضر پس از تغییر ایجاد شده است `umask` (`umask` را می توان در پیکربندی تغییر). +- رفع اشکال در چک پس زمینه از قطعات (`MergeTreePartChecker` )هنگام استفاده از یک کلید پارتیشن سفارشی . +- تجزیه ثابت از تاپل (ارزش های `Tuple` نوع داده) در فرمت های متن. +- پیام های خطا بهبود یافته در مورد انواع ناسازگار منتقل شده به `multiIf` , `array` و برخی دیگر توابع. +- پشتیبانی دوباره طراحی شده برای `Nullable` انواع. اشکالات ثابت که ممکن است به یک تصادف سرور منجر شود. ثابت تقریبا تمام اشکالات دیگر مربوط به `NULL` پشتیبانی: نادرست نوع تبدیل در وارد کردن را انتخاب کنید کافی برای حمایت از Nullable در داشتن و PREWHERE, `join_use_nulls` حالت, انواع قابل ابطال به عنوان استدلال `OR` اپراتور و غیره +- اشکالات مختلف ثابت مربوط به معانی داخلی انواع داده ها. نمونه: جمع غیر ضروری از `Enum` فیلدهای تایپ شده `SummingMergeTree` ; تراز دلخواه `Enum` انواع در `Pretty` فرمت, و غیره. +- چک سختگیرانه تر برای ترکیب مجاز از ستون کامپوزیت. +- ثابت سرریز در هنگام تعیین یک پارامتر بسیار بزرگ برای `FixedString` نوع داده. +- رفع اشکال در `topK` تابع جمع در یک مورد عمومی. +- اضافه شدن چک از دست رفته برای برابری اندازه مجموعه ای در استدلال از انواع ن-عرایی از توابع کل با `-Array` ترکیب کننده. +- رفع اشکال در `--pager` برای `clickhouse-client` (نویسنده: کس1322). +- ثابت دقت از `exp10` تابع. +- ثابت رفتار `visitParamExtract` تابع برای انطباق بهتر با اسناد و مدارک. +- ثابت تصادف زمانی که انواع داده های نادرست مشخص شده است. +- رفتار را ثابت کرد `DISTINCT` در مورد زمانی که همه ستون ثابت هستند. +- قالب بندی پرس و جو ثابت در مورد استفاده از `tupleElement` تابع با یک عبارت ثابت پیچیده به عنوان شاخص عنصر تاپل. +- رفع اشکال در `Dictionary` جداول برای `range_hashed` واژهنامهها. +- رفع اشکال که منجر به ردیف بیش از حد در نتیجه `FULL` و `RIGHT JOIN` (پرنده ایموس). +- ثابت سقوط سرور در هنگام ایجاد و از بین بردن فایل های موقت در `config.d` دایرکتوری در طول بازنگری پیکربندی. +- ثابت `SYSTEM DROP DNS CACHE` پرس و جو: کش سرخ شد اما نشانی از گره های خوشه ای به روز شد. +- رفتار را ثابت کرد `MATERIALIZED VIEW` پس از اجرای `DETACH TABLE` for the table under the view (Marek Vavruša). + +#### بهبود ساخت: {#build-improvements-4} + +- این `pbuilder` ابزار برای ساخت استفاده می شود. روند ساخت تقریبا به طور کامل مستقل از محیط میزبان ساخت است. +- ساخت تک برای نسخه های سیستم عامل های مختلف استفاده می شود. بسته ها و فایل های باینری سازگار با طیف گسترده ای از سیستم های لینوکس ساخته شده است. +- اضافه شدن `clickhouse-test` بسته این می تواند مورد استفاده قرار گیرد برای اجرای تست های کاربردی. +- قطار سریع السیر منبع هم اکنون می توانید به مخزن منتشر شود. این می تواند مورد استفاده قرار گیرد به تولید مثل ساخت بدون استفاده از گیتهاب. +- اضافه شده ادغام محدود با تراویس سی. با توجه به محدودیت در زمان ساخت در تراویس, تنها ساخت اشکال زدایی تست شده است و یک زیر مجموعه محدود از تست اجرا می شوند. +- اضافه شدن پشتیبانی برای `Cap'n'Proto` در ساخت به طور پیش فرض. +- فرمت منابع اسناد را تغییر داد `Restricted Text` به `Markdown`. +- اضافه شدن پشتیبانی برای `systemd` (ولادیمیر اسمیرنوف). این است که به طور پیش فرض به دلیل ناسازگاری با برخی از تصاویر سیستم عامل غیر فعال است و می تواند به صورت دستی فعال کنید. +- برای تولید کد پویا, `clang` و `lld` به جاسازی شده `clickhouse` دودویی. همچنین می توانند به عنوان `clickhouse clang` و `clickhouse lld` . +- استفاده از پسوندهای گنو از کد حذف شده است. فعال کردن `-Wextra` انتخاب هنگام ساخت با `clang` به طور پیش فرض است `libc++` به جای `libstdc++`. +- استخراج شده `clickhouse_parsers` و `clickhouse_common_io` کتابخانه ها برای سرعت بخشیدن به ایجاد ابزارهای مختلف. + +#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-11} + +- قالب برای علامت در `Log` جداول نوع که شامل `Nullable` ستون در راه ناسازگار به عقب تغییر یافت. اگر شما این جداول, شما باید به تبدیل `TinyLog` قبل از شروع نسخه سرور جدید تایپ کنید. برای انجام این کار جایگزین کنید `ENGINE = Log` با `ENGINE = TinyLog` در مربوطه `.sql` پرونده در `metadata` فهرست راهنما. اگر جدول شما ندارد `Nullable` ستون و یا اگر نوع جدول خود را نمی `Log` پس نیازی نیست کاری بکنی +- حذف `experimental_allow_extended_storage_definition_syntax` تنظیمات. در حال حاضر این ویژگی به طور پیش فرض فعال است. +- این `runningIncome` تابع به تغییر نام داد `runningDifferenceStartingWithFirstvalue` برای جلوگیری از سردرگمی. +- حذف `FROM ARRAY JOIN arr` نحو زمانی که مجموعه اضافه کردن به طور مستقیم پس از با هیچ جدول مشخص (پرنده ایموس). +- حذف `BlockTabSeparated` فرمت که صرفا برای اهداف تظاهرات مورد استفاده قرار گرفت. +- فرمت دولت برای توابع کل تغییر `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. اگر شما ایالات از این توابع کل در جداول ذخیره شده اند (با استفاده از `AggregateFunction` نوع داده و یا نمایش تحقق با کشورهای مربوطه), لطفا به ارسال clickhouse-feedback@yandex-team.com. +- در نسخه های سرور قبلی یک ویژگی مستند نشده وجود داشت: اگر یک تابع جمع شده به پارامترها بستگی داشته باشد هنوز هم می توانید بدون پارامتر در نوع داده قابلیت کارکرد مشخص کنید. مثال: `AggregateFunction(quantiles, UInt64)` به جای `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. این ویژگی از دست داده بود. ما قصد داریم دوباره در نسخه های بعدی پشتیبانی کنیم. +- انواع داده شمارشی را نمی توان در توابع جمع دقیقه/حداکثر استفاده می شود. این توانایی خواهد شد در نسخه بعدی بازگشت. + +#### لطفا توجه داشته باشید در هنگام به روز رسانی: {#please-note-when-upgrading} + +- هنگام انجام یک به روز رسانی نورد در یک خوشه, در نقطه ای که برخی از کپی در حال اجرا هستند نسخه های قدیمی از تاتر و برخی در حال اجرا هستند نسخه جدید, تکرار است به طور موقت متوقف و پیام `unknown parameter 'shard'` به نظر می رسد در ورود به سیستم. تکرار ادامه خواهد داد پس از همه کپی از خوشه به روز می شوند. +- اگر نسخه های مختلف از تاتر در حال اجرا بر روی سرورهای خوشه, ممکن است که نمایش داده شد توزیع با استفاده از توابع زیر نتایج نادرست داشته باشد: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. شما باید تمام گره های خوشه ای به روز رسانی. + +## [تغییرات برای 2017](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/fa/whats-new/changelog/2019.md b/docs/fa/whats-new/changelog/2019.md new file mode 100644 index 00000000000..2039246a0e4 --- /dev/null +++ b/docs/fa/whats-new/changelog/2019.md @@ -0,0 +1,2074 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 77 +toc_title: '2019' +--- + +## انتشار کلیک و19. 17 {#clickhouse-release-v19-17} + +### ClickHouse انتشار V19.17.6.36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} + +#### رفع اشکال {#bug-fix} + +- سرریز بافر بالقوه ثابت در حالت فشرده خارج. کاربر مخرب می تواند داده های فشرده ساخته شده است که می تواند باعث به عنوان خوانده شده پس از بافر منتقل می کند. این موضوع توسط الدار زیتوف از تیم امنیت اطلاعات یاندکس یافت شد. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت سقوط سرور ممکن است (`std::terminate`) هنگامی که سرور نمی تواند ارسال و یا ارسال داده ها در فرمت جسون یا میلی لیتر با ارزش از نوع داده رشته (که نیاز به اعتبار سنجی-8) و یا زمانی که فشرده سازی داده ها نتیجه با الگوریتم بروتلی و یا در برخی موارد نادر دیگر. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت لغت نامه با منبع از یک clickhouse `VIEW` در حال حاضر خواندن چنین واژهنامهها خطا ایجاد نمی کند `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- ثابت چک کردن اگر یک مشتری میزبان مجاز است با host\_regexp مشخص شده در کاربران.. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([ویتالی بارانو](https://github.com/vitlibar)) +- `RENAME TABLE` برای یک جدول توزیع در حال حاضر تغییر نام پوشه حاوی داده های درج شده قبل از ارسال به خرده ریز. این رفع یک موضوع را با تغییر نام های پی در پی `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([تاولوبیکس](https://github.com/tavplubix)) +- `range_hashed` واژهنامهها خارجی ایجاد شده توسط دی ال نمایش داده شد در حال حاضر اجازه می دهد محدوده از انواع عددی دلخواه. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([الساپین](https://github.com/alesapin)) +- ثابت `INSERT INTO table SELECT ... FROM mysql(...)` تابع جدول. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([تاولوبیکس](https://github.com/tavplubix)) +- ثابت segfault در `INSERT INTO TABLE FUNCTION file()` در حالی که قرار دادن به یک فایل که وجود ندارد. در حال حاضر در این مورد فایل ایجاد می شود و سپس قرار دادن پردازش می شود. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- خطای بیت مپ ثابت زمانی که متقاطع بیت مپ جمع و بیت مپ اسکالر. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([یو هوانگ](https://github.com/moon03432)) +- ثابت زمانی که segfault `EXISTS` پرس و جو بدون استفاده شد `TABLE` یا `DICTIONARY` مقدماتی, درست مثل `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نوع بازگشت ثابت برای توابع `rand` و `randConstant` در صورت بحث باطل. در حال حاضر توابع همیشه بازگشت `UInt32` و هرگز `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- ثابت `DROP DICTIONARY IF EXISTS db.dict` در حال حاضر استثنا پرتاب نمی کند اگر `db` وجود نداره [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([ویتالی بارانو](https://github.com/vitlibar)) +- اگر یک جدول به دلیل سقوط سرور به طور کامل کاهش یافته است, سرور سعی خواهد کرد برای بازگرداندن و بارگذاری [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([تاولوبیکس](https://github.com/tavplubix)) +- ثابت پرس و جو تعداد بی اهمیت برای یک جدول توزیع اگر بیش از دو میز محلی سفال وجود دارد. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- اشکال ثابت که منجر به یک مسابقه داده در db::blockstreamprofileinfo::calculaterowsbeforelimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([الکساندر کازاکوف](https://github.com/Akazz)) +- ثابت `ALTER table MOVE part` اعدام بلافاصله پس از ادغام بخش مشخص, که می تواند باعث حرکت بخشی که بخش مشخص شده به هم ادغام شدند. در حال حاضر به درستی حرکت می کند بخش مشخص شده است. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- عبارات برای لغت نامه را می توان به عنوان رشته در حال حاضر مشخص شده است. این بسیار مفید است برای محاسبه ویژگی های در حالی که استخراج داده ها از غیر clickhouse منابع به دلیل آن اجازه می دهد تا به استفاده از غیر clickhouse نحو برای آن دسته از عبارات. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([الساپین](https://github.com/alesapin)) +- ثابت یک مسابقه بسیار نادر در `clickhouse-copier` به دلیل سرریز در زکسید. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) +- رفع اشکال زمانی که پس از پرس و جو شکست خورده (با توجه به “Too many simultaneous queries” به عنوان مثال) این اطلاعات جداول خارجی را نمی خواند و + درخواست بعدی این اطلاعات را به عنوان ابتدای پرس و جو بعدی تفسیر می کند که باعث خطا می شود `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([ازات خوژین](https://github.com/azat)) +- اجتناب از اختلاف پوچ پس از “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([ازات خوژین](https://github.com/azat)) +- بازگرداندن پشتیبانی از تمام مناطق ایکو, اضافه کردن توانایی به درخواست تلفیقی برای عبارات ثابت و اضافه کردن نام زبان به سیستم.collations جدول. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([الساپین](https://github.com/alesapin)) +- تعداد جریان برای خواندن از `StorageFile` و `StorageHDFS` در حال حاضر محدود, برای جلوگیری از بیش از حد حافظه. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([الساپین](https://github.com/alesapin)) +- ثابت `CHECK TABLE` پرسوجو برای `*MergeTree` جداول بدون کلید. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([الساپین](https://github.com/alesapin)) +- حذف تعداد جهش از یک نام بخشی در صورتی که هیچ جهش وجود دارد. این حذف بهبود سازگاری با نسخه های قدیمی تر. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([الساپین](https://github.com/alesapin)) +- رفع اشکال که جهش برای برخی از قطعات متصل به دلیل انحراف خود قلم بزرگتر از نسخه جهش جدول. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([ژیچنگ یو](https://github.com/yuzhichang)) +- اجازه شروع سرور با کپی کار برکنار شده از قطعات پس از حرکت به دستگاه دیگر. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- خطا را ثابت کرد “Sizes of columns doesn’t match” که ممکن است در هنگام استفاده از ستون تابع جمع به نظر می رسد. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([بوریس گرانویو](https://github.com/bgranvea)) +- در حال حاضر یک استثنا خواهد شد در صورت استفاده با روابط در کنار محدودیت های پرتاب. و در حال حاضر امکان استفاده از بالا با محدودیت توسط. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- رفع بارگذاری مجدد فرهنگ لغت در صورتی که `invalidate_query` که متوقف به روز رسانی و برخی از استثنا در به روز رسانی قبلی تلاش می کند. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([الساپین](https://github.com/alesapin)) + +### ClickHouse انتشار V19.17.4.11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} + +#### تغییر ناسازگار به عقب {#backward-incompatible-change} + +- با استفاده از ستون به جای اس تی برای ذخیره نتایج زیرخاکری اسکالر برای عملکرد بهتر است. تنظیم `enable_scalar_subquery_optimization` در 19.17 اضافه شد و به طور پیش فرض فعال شد. این منجر به اشتباهات مانند [این](https://github.com/ClickHouse/ClickHouse/issues/7851) در طی ارتقا به 19.17.2 یا 19.17.3 از نسخه های قبلی است. این تنظیم به طور پیش فرض فعال در 19.17.4 را ممکن است به روز رسانی از 19.16 و نسخه های قدیمی تر و بدون خطا. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([ایموس پرنده](https://github.com/amosbird)) + +#### ویژگی جدید {#new-feature} + +- اضافه کردن توانایی برای ایجاد لغت نامه با پرس و جو ددل. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([الساپین](https://github.com/alesapin)) +- ساخت `bloom_filter` نوع حمایت از شاخص `LowCardinality` و `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- افزودن تابع `isValidJSON` برای بررسی رشته گذشت که جانسون معتبر است. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([ولادیمیر](https://github.com/Vdimir)) +- پیاده سازی `arrayCompact` تابع [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([یادداشت](https://github.com/Joeywzr)) +- تابع ایجاد شده `hex` برای اعداد اعشاری. این کار مانند `hex(reinterpretAsString())` اما صفر بایت گذشته را حذف کنید. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([میخیل کوروتف](https://github.com/millb)) +- افزودن `arrayFill` و `arrayReverseFill` توابع که عناصر را با عناصر دیگر در جلو/عقب در مجموعه جایگزین می کنند. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([هکز](https://github.com/hczhcz)) +- افزودن `CRC32IEEE()`/`CRC64()` پردازشگر پشتیبانی شده: [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([ازات خوژین](https://github.com/azat)) +- پیاده سازی `char` عملکرد شبیه به یک در [خروجی زیر](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- افزودن `bitmapTransform` تابع. این مجموعه ای از ارزش ها را در بیت مپ به مجموعه ای دیگر از ارزش ها تبدیل می کند و نتیجه یک بیت مپ جدید است [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([ژیچنگ یو](https://github.com/yuzhichang)) +- پیادهسازی شده `javaHashUTF16LE()` تابع [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([ایشیمب](https://github.com/achimbab)) +- افزودن `_shard_num` ستون مجازی برای موتور توزیع شده [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([ازات خوژین](https://github.com/azat)) + +#### ویژگی تجربی {#experimental-feature} + +- پشتیبانی از پردازنده (خط لوله اجرای پرس و جو جدید) در `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +#### رفع اشکال {#bug-fix-1} + +- رفع شناور نادرست تجزیه در `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع بن بست نادر است که می تواند رخ دهد که ردیاب را فعال کنید. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([فیلیمونف](https://github.com/filimonov)) +- جلوگیری از تکرار پیام در هنگام تولید جدول کافکا دارای هر گونه رزومه انتخاب از [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([ایوان](https://github.com/abyss7)) +- پشتیبانی از `Array(LowCardinality(Nullable(String)))` داخل `IN`. برطرف [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([ایشیمب](https://github.com/achimbab)) +- اضافه کردن سیستم های انتقال مواد از `SQL_TINYINT` و `SQL_BIGINT`, و رفع دست زدن به `SQL_FLOAT` انواع منبع داده در اد بی سی پل. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([دنیس گلازاشف](https://github.com/traceon)) +- رفع تجمع (`avg` و تعداد کمی) روی ستونهای دهدهی خالی [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([اندری کونیایف](https://github.com/akonyaev90)) +- ثابت `INSERT` به توزیع با `MATERIALIZED` ستونها [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([ازات خوژین](https://github.com/azat)) +- ساخت `MOVE PARTITION` کار اگر برخی از قسمت های پارتیشن در حال حاضر بر روی دیسک مقصد یا حجم [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اشکال ثابت با لینک های سخت عدم در طول جهش در ایجاد می شود `ReplicatedMergeTree` در تنظیمات چند دیسک. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع اشکال با یک جهش در ادغام زمانی که تمام قسمت بدون تغییر باقی می ماند و بهترین فضا است که بر روی دیسک دیگر یافت می شود [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اشکال ثابت با `keep_free_space_ratio` از پیکربندی دیسکها قابل خواندن نیست [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع اشکال با جدول شامل تنها `Tuple` ستون ها یا ستون ها با مسیرهای پیچیده. رفع [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([الساپین](https://github.com/alesapin)) +- حافظه را برای موتور بافر در حداکثر\_موری\_سیاژ حساب نکنید [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([ازات خوژین](https://github.com/azat)) +- رفع استفاده از علامت نهایی در `MergeTree` جداول مرتب شده بر اساس `tuple()`. در موارد نادر می تواند منجر به `Can't adjust last granule` خطا هنگام انتخاب. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع اشکال در جهش که با اقداماتی که نیاز به زمینه (به عنوان مثال توابع برای جانسون) مسند که ممکن است منجر به سقوط و یا استثنا عجیب و غریب. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([الساپین](https://github.com/alesapin)) +- رفع عدم تطابق پایگاه داده و نام جدول فرار در `data/` و `shadow/` & فهرستهای راهنما [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([الکساندر بورمک](https://github.com/Alex-Burmak)) +- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. رفع سقوط در این مورد. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([زویکوف](https://github.com/4ertus2)) +- ثابت `Not found column in block` هنگام پیوستن به در بیان با راست یا کامل ملحق. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([زویکوف](https://github.com/4ertus2)) +- یکی دیگر از تلاش برای رفع حلقه بی نهایت در `PrettySpace` قالب [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- رفع اشکال در `concat` تابع زمانی که همه استدلال شد `FixedString` از همان اندازه. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([الساپین](https://github.com/alesapin)) +- استثنا ثابت در صورت استفاده از 1 استدلال در حالی که تعریف اس3, نشانی اینترنتی و ذخیره سازی اچ دی. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع دامنه تفسیری برای نمایش با پرس و جو [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([ازات خوژین](https://github.com/azat)) + +#### بهبود {#improvement} + +- `Nullable` ستون به رسمیت شناخته شده و تهی ارزش به درستی توسط ان بی سی پل به کار گرفته [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([واسیلی نمکو](https://github.com/Enmk)) +- ارسال دسته ای در حال حاضر برای توزیع ارسال اتمی [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([ازات خوژین](https://github.com/azat)) +- پرتاب یک استثنا اگر ما می توانیم جدول برای نام ستون در پرس و جو تشخیص نیست. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([زویکوف](https://github.com/4ertus2)) +- افزودن `merge_max_block_size` تنظیم به `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([زویکوف](https://github.com/4ertus2)) +- نمایش داده شد با `HAVING` و بدون `GROUP BY` فرض گروه های ثابت. پس, `SELECT 1 HAVING 1` در حال حاضر نتیجه را برمی گرداند. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([ایموس پرنده](https://github.com/amosbird)) +- تجزیه پشتیبانی `(X,)` به عنوان تاپل شبیه به پایتون. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([ایموس پرنده](https://github.com/amosbird)) +- ساخت `range` رفتارهای تابع تقریبا مانند یک پیتون. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- افزودن `constraints` ستونها به جدول `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([ویتالی بارانو](https://github.com/vitlibar)) +- فرمت پوچ بهتر برای کنترل کننده تی پی, به طوری که ممکن است به استفاده از `select ignore() from table format Null` برای اندازه گیری نیروی هوایی پاکستان از طریق کلیک مشتری [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([ایموس پرنده](https://github.com/amosbird)) +- نمایش داده شد مانند `CREATE TABLE ... AS (SELECT (1, 2))` به درستی تجزیه شده است [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([هکز](https://github.com/hczhcz)) + +#### بهبود عملکرد {#performance-improvement} + +- عملکرد تجمع بیش از کلید های رشته کوتاه بهبود یافته است. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([الکساندر کوزمنکوف](https://github.com/akuzm), [ایموس پرنده](https://github.com/amosbird)) +- یک پاس دیگر از تجزیه و تحلیل نحو/بیان را اجرا کنید تا بهینه سازی های بالقوه پس از پیش بینی های ثابت خورده شوند. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([ایموس پرنده](https://github.com/amosbird)) +- استفاده از ذخیره سازی متا اطلاعات به ارزیابی بی اهمیت `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([ایموس پرنده](https://github.com/amosbird), [الکسی میلویدو](https://github.com/alexey-milovidov)) +- Vectorize پردازش `arrayReduce` شبیه به تجمعی `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([ایموس پرنده](https://github.com/amosbird)) +- بهبود صغیر در عملکرد `Kafka` مصرف [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([ایوان](https://github.com/abyss7)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement} + +- اضافه کردن پشتیبانی برای متقابل کامپایل به معماری پردازنده عاشق64. refactor packager اسکریپت. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([ایوان](https://github.com/abyss7)) +- باز کردن داروین-x86\_64 و لینوکس-aarch64 toolchains به نصب docker دوره زمانی که ساختمان بسته [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([ایوان](https://github.com/abyss7)) +- به روز رسانی تصویر کارگر بارانداز برای باینری بسته بندی [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([ایوان](https://github.com/abyss7)) +- خطاهای کامپایل ثابت در مکینتاش کاتالینا [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([ارنست پلتایف](https://github.com/ernestp)) +- برخی از فاکتورگیری مجدد در منطق تجزیه و تحلیل پرس و جو: تقسیم کلاس پیچیده را به چند ساده. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([زویکوف](https://github.com/4ertus2)) +- رفع ساخت بدون زیر منو [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([پرولر](https://github.com/proller)) +- بهتر `add_globs` در فایل های کیک [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([ایموس پرنده](https://github.com/amosbird)) +- حذف مسیرهای سختشده در `unwind` هدف [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([کنستانتین پودشوموک](https://github.com/podshumok)) +- مجاز به استفاده از فرمت خروجی زیر بدون اس اس ال [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([پرولر](https://github.com/proller)) + +#### غیره {#other} + +- اضافه شده antlr4 گرامر برای clickhouse sql گویش [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +## انتشار کلیک و19. 16 {#clickhouse-release-v19-16} + +#### انتشار کلیک و19.16. 14. 65, 2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} + +- رفع اشکال در محاسبات باریکش از عملیات منطقی سه تایی در استدلال های متعدد (بیش از 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([الکساندر کازاکوف](https://github.com/Akazz)) این bugfix شد backported به نسخه 19.16 توسط یک درخواست ویژه از Altinity. + +#### Clickhouse انتشار V19.16.14.65 و 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} + +- رفع ناسازگاری خرده فروشی توزیع با نسخه های قدیمی تر کانال. رفع [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) + [(تبلوبیکس)](https://github.com/tavplubix) +- هنگام اجرای `CREATE` پرس و جو, برابر عبارات ثابت در استدلال موتور ذخیره سازی. جایگزین کردن نام دادگان خالی با دادگان فعلی. رفع [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). همچنین رفع بررسی برای نشانی محلی در `ClickHouseDictionarySource`. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(تبلوبیکس)](https://github.com/tavplubix) +- در حال حاضر پس زمینه ادغام در `*MergeTree` موتورهای جدول خانواده حفظ سیاست ذخیره سازی حجم سفارش دقیق تر. + [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- جلوگیری از از دست دادن داده ها در `Kafka` در موارد نادر زمانی که استثنا اتفاق می افتد پس از خواندن پسوند اما قبل از ارتکاب. رفع [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). مرتبط: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(فیلیمونف)](https://github.com/filimonov) +- رفع اشکال منجر به ختم سرور در هنگام تلاش برای استفاده / رها کردن `Kafka` جدول ایجاد شده با پارامترهای اشتباه. رفع [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). دارای [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(فیلیمونف)](https://github.com/filimonov) +- اجازه استفاده `MaterializedView` با subqueries بالا `Kafka` میز + [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([فیلیمونف](https://github.com/filimonov)) + +#### ویژگی جدید {#new-feature-1} + +- افزودن `deduplicate_blocks_in_dependent_materialized_views` گزینه ای برای کنترل رفتار درج ژولیده به جداول با نمایش محقق. این ویژگی جدید توسط یک درخواست ویژه از التیت به نسخه رفع اشکال اضافه شد. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [.)](https://github.com/urykhy) + +### ClickHouse انتشار V19.16.2.2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-1} + +- اضافه کردن گم شده arity اعتبار برای تعداد/counif. + [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) + [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([ولادیمیر](https://github.com/Vdimir)) +- حذف میراث `asterisk_left_columns_only` تنظیم (به طور پیش فرض غیر فعال شد). + [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([علم هنر + زویکوف](https://github.com/4ertus2)) +- رشته فرمت برای قالب فرمت داده در حال حاضر در فایل های مشخص شده است. + [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([تاولوبیکس](https://github.com/tavplubix)) + +#### ویژگی جدید {#new-feature-2} + +- معرفی uniqcombined64() برای محاسبه cardinality بیشتر از uint\_max. + [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), + [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([ازات + خوژین](https://github.com/azat)) +- پشتیبانی از شاخص های فیلتر بلوم در ستون های مجموعه. + [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) + ([ایشیمب](https://github.com/achimbab)) +- اضافه کردن یک تابع `getMacro(name)` که رشته را برمی گرداند با ارزش مربوطه `` + از پیکربندی سرور. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) + ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تنظیم دو گزینه پیکربندی برای یک فرهنگ لغت بر اساس یک منبع قام: `credentials` و + `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([گیمه + کاسری](https://github.com/YiuRULE)) +- افزودن سابقه جدید `Merge` که تعداد پس زمینه راه اندازی ادغام. + [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([میخیل + کوروتف](https://github.com/millb)) +- اضافه کردن تابع نام کامل است که یک نام دامنه به طور کامل واجد شرایط را برمی گرداند. + [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) + [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- افزودن تابع `arraySplit` و `arrayReverseSplit` که یک مجموعه تقسیم شده توسط “cut off” + شرایط. در دست زدن به توالی زمان مفید هستند. + [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([هکز](https://github.com/hczhcz)) +- اضافه کردن توابع جدید است که بازگشت مجموعه ای از تمام شاخص های همسان در خانواده چند از توابع. + [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([دنیلا + کوتنین](https://github.com/danlark1)) +- اضافه کردن یک موتور پایگاه داده جدید `Lazy` این است که برای ذخیره سازی تعداد زیادی از کوچک ورود به سیستم بهینه شده است + میز [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([نیکیتا + واسیلیف](https://github.com/nikvas0)) +- اضافه کردن توابع جمع گروهبیت مپند,- یا, - صخره نوردی برای ستون بیت مپ. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([ژیچنگ + یو](https://github.com/yuzhichang)) +- اضافه کردن مجموع عملکرد combinators -ornull و ordefault که بازگشت تهی + یا مقادیر پیش فرض زمانی که هیچ چیز به جمع وجود دارد. + [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) + ([هکز](https://github.com/hczhcz)) +- قالب داده های سفارشی را معرفی کنید که از فرار سفارشی پشتیبانی می کند و + قوانین جداساز. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([تاولوبیکس](https://github.com/tavplubix)) +- پشتیبانی ردیس به عنوان منبع فرهنگ لغت خارجی. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([کموندی](https://github.com/comunodi), [انتون + پوپوف](https://github.com/CurtizJ)) + +#### رفع اشکال {#bug-fix-2} + +- رفع نتیجه پرس و جو اشتباه در صورتی که `WHERE IN (SELECT ...)` بخش و `optimize_read_in_order` هست + استفاده می شود. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([انتون + پوپوف](https://github.com/CurtizJ)) +- پلاگین احراز هویت ماریادب غیر فعال, که بستگی به فایل های خارج از پروژه. + [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([یوری + Baranov](https://github.com/yurriy)) +- رفع استثنا `Cannot convert column ... because it is constant but values of constants are different in source and result` که به ندرت می تواند رخ دهد زمانی که توابع `now()`, `today()`, + `yesterday()`, `randConstant()` استفاده می شود. + [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([نیکولای + کوچتو](https://github.com/KochetovNicolai)) +- شماره ثابت با استفاده از اچ.تی. پی را نگه دارید ایست زنده به جای تی. پی نگه داشتن ایست زنده است. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([واسیلی + نمکو](https://github.com/Enmk)) +- گسل تقسیم بندی را در گروهبیتماپور ثابت کرد (شماره [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). + [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([ژیچنگ + یو](https://github.com/yuzhichang)) +- برای نمایش تحقق مرتکب کافکا نامیده می شود پس از تمام داده ها نوشته شده است. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([ایوان](https://github.com/abyss7)) +- اشتباه ثابت `duration_ms` مقدار در `system.part_log` جدول ده بار خاموش بود. + [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([ولادیمیر + Chebotarev](https://github.com/excitoon)) +- رفع سریع برای حل و فصل سقوط در جدول نمایش زنده و دوباره قادر می سازد تمام تست نمایش زنده. + [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) + ([vzakaznikov](https://github.com/vzakaznikov)) +- مرتب کردن مقادیر صفر به درستی در شاخص دقیقه/حداکثر از قطعات ادغام. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([الکساندر + کوزمنکوف](https://github.com/akuzm)) +- قرار نیست ستون مجازی به .sql ابرداده هنگامی که جدول ایجاد شده است `CREATE TABLE AS`. + [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([ایوان](https://github.com/abyss7)) +- رفع گسل تقسیم بندی در `ATTACH PART` پرس و جو. + [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) + ([الساپین](https://github.com/alesapin)) +- رفع نتیجه اشتباه برای برخی از نمایش داده شد داده شده توسط بهینه سازی خالی در کارخانه های فرعی و خالی + INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([نیکولای + کوچتو](https://github.com/KochetovNicolai)) +- رفع addresssanitizer خطا در نمایش زنده getheader روش (). + [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) + ([vzakaznikov](https://github.com/vzakaznikov)) + +#### بهبود {#improvement-1} + +- اضافه کردن یک پیام در صورت صبر کردن \_موا\_مایش صورت می گیرد. + [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([ازات + خوژین](https://github.com/azat)) +- تنظیم ساخته شده `s3_min_upload_part_size` جدول سطح. + [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([ولادیمیر + Chebotarev](https://github.com/excitoon)) +- در حال بارگذاری [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) + ([بستنی و مغز گردو](https://github.com/sundy-li)) +- بلوک کدو دست چپ در ادغام بخشی ملحق (بهینه سازی). + [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([علم هنر + زویکوف](https://github.com/4ertus2)) +- اجازه ندهید که توابع غیر قطعی در جهش موتورهای جدول تکرار, چرا که این + می توانید تناقضات بین کپی معرفی. + [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([الکساندر + کازاکوف](https://github.com/Akazz)) +- غیر فعال کردن ردیاب حافظه در حالی که تبدیل ردیابی پشته استثنا به رشته. این می تواند از دست دادن جلوگیری کند + از پیغام خطا از نوع `Memory limit exceeded` بر روی سرور, که باعث `Attempt to read after eof` استثنا در مشتری. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) + ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- بهبود فرمت های دیگر. برطرف + [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), + [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), + [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), + [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) + [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) + ([تاولوبیکس](https://github.com/tavplubix)) +- خانه را نادیده می گیرد ارزش در سمت راست در اپراتور که قابل تبدیل به سمت چپ نیست + side type. Make it work properly for compound types – Array and Tuple. + [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([الکساندر + کوزمنکوف](https://github.com/akuzm)) +- پشتیبانی از نابرابری های از دست رفته برای عضویت. این ممکن است برای پیوستن به نوع کمتر یا برابر و سخت + انواع بیشتر و کمتر برای ستون اسوف در نحو. + [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([علم هنر + Zuikov](https://github.com/4ertus2)) +- بهینه سازی بخشی ادغام اضافه کردن. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) + ([زویکوف](https://github.com/4ertus2)) +- آیا استفاده از بیش از 98k حافظه در uniqcombined توابع. + [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), + [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([ازات + خوژین](https://github.com/azat)) +- قطعات خیط و پیت کردن از جدول پیوستن به دست راست بر روی دیسک در پارتیالمگرمین (اگر کافی نیست + حافظه). بارگیری داده ها در صورت نیاز. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) + ([زویکوف](https://github.com/4ertus2)) + +#### بهبود عملکرد {#performance-improvement-1} + +- سرعت جوینت با استدلال توایع با اجتناب از تکرار داده ها. + [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([ایموس + پرنده](https://github.com/amosbird)) +- بازگشت اولیه اگر زیرخاکری خالی است. + [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) +- بهینه سازی تجزیه بیان گذاشتن در مقادیر. + [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) + ([تاولوبیکس](https://github.com/tavplubix)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-1} + +- غیر فعال کردن برخی از موارد برای متقابل تلفیقی به سیستم عامل مک. + [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([ایوان](https://github.com/abyss7)) +- اضافه کردن گم شده ارتباط با pocoxml برای clickhouse\_common\_io. + [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([ازات + خوژین](https://github.com/azat)) +- قبول متعدد تست فیلتر استدلال در clickhouse آزمون. + [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([الکساندر + کوزمنکوف](https://github.com/akuzm)) +- فعال musl و jemalloc برای arm. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) + ([ایموس پرنده](https://github.com/amosbird)) +- اضافه شده `--client-option` پارامتر به `clickhouse-test` به تصویب پارامترهای اضافی به مشتری. + [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([نیکولای + کوچتو](https://github.com/KochetovNicolai)) +- حفظ تنظیمات موجود در دور در دقیقه ارتقا بسته. + [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) + ([فیلیمونف](https://github.com/filimonov)) +- رفع خطاهای شناسایی شده توسط پوس. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([علم هنر + Zuikov](https://github.com/4ertus2)) +- رفع ساخت برای داروین. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) + ([ایوان](https://github.com/abyss7)) +- glibc 2.29 سازگاری. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([ایموس + پرنده](https://github.com/amosbird)) +- اطمینان حاصل کنید که دکلین می کند فایل های منبع بالقوه را لمس نمی. + [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([ایموس + پرنده](https://github.com/amosbird)) +- تلاش برای جلوگیری از درگیری در هنگام به روز رسانی از دور در دقیقه التیت - فایل پیکربندی بسته بندی شده به طور جداگانه + در کلیک-سرور-مشترک. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) + ([فیلیمونف](https://github.com/filimonov)) +- بهینه سازی برخی از فایل های هدر برای بازسازی سریع تر. + [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), + [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([الکساندر + کوزمنکوف](https://github.com/akuzm)) +- اضافه کردن تست عملکرد برای تاریخ و تاریخ ساعت. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([واسیلی + نمکو](https://github.com/Enmk)) +- رفع برخی از تست هایی که حاوی جهش های غیر قطعی هستند. + [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([الکساندر + کازاکوف](https://github.com/Akazz)) +- اضافه کردن ساخت با حفظ به سی. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) + ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- اجتناب از استفاده از آماده سازی نشده ارزش در metricstransmitter. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([ازات + خوژین](https://github.com/azat)) +- رفع برخی از مشکلات در زمینه های پیدا شده توسط حفظ کننده. + [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), + [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([الکساندر + کوزمنکوف](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) + ([ایموس پرنده](https://github.com/amosbird)) +- رفع رفتار تعریف نشده در سوفلش32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([ایموس + پرنده](https://github.com/amosbird)) +- رفع رفتار تعریف نشده در استورگیسنفستولینگ. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) + ([تاولوبیکس](https://github.com/tavplubix)) +- عبارات ثابت ثابت تاشو برای موتورهای پایگاه داده خارجی (خروجی زیر ,او بی سی, ال بی سی). در گذشته + نسخه این بود برای عبارات ثابت متعدد کار نمی کند و در همه برای تاریخ کار نمی کند, + تاریخ ساعت و امید. این رفع [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) + ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع threadsanitizer اطلاعات مسابقه خطا در نمایش زنده در هنگام دسترسی به no\_users\_thread متغیر است. + [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) + ([وزکازنیکوف](https://github.com/vzakaznikov)) +- خلاص شدن از شر نمادها مالوک در لیبکمون + [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), + [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([ایموس + پرنده](https://github.com/amosbird)) +- اضافه کردن توانمندسازهای پرچم جهانی برای غیر فعال کردن تمام کتابخانه ها. + [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) + ([پرولر](https://github.com/proller)) + +#### پاکسازی کد {#code-cleanup} + +- تعمیم مخزن پیکربندی برای تهیه دی ال برای لغت نامه. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) + ([الساپین](https://github.com/alesapin)) +- تجزیه کننده برای لغت نامه دی ال بدون هیچ معنایی. + [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) + ([الساپین](https://github.com/alesapin)) +- تقسیم پارسرکری به تجزیه کننده های مختلف کوچکتر. + [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) + ([الساپین](https://github.com/alesapin)) +- فاکتورگیری مجدد کوچک و تغییر نام در نزدیکی لغت نامه های خارجی. + [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) + ([الساپین](https://github.com/alesapin)) +- گیرنده برخی از کد برای تهیه برای کنترل دسترسی مبتنی بر نقش. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([ویتالی + بارانوف](https://github.com/vitlibar)) +- برخی از پیشرفت های در کد بانک اطلاعاتی. + [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([نیکیتا + واسیلیف](https://github.com/nikvas0)) +- آیا استفاده از iterators در پیدا کردن() و emplace() روش جداول هش. + [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([الکساندر + کوزمنکوف](https://github.com/akuzm)) +- رفع گیرنده در صورتی که ریشه پارامتر خالی نیست. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) + ([میخیل کوروتف](https://github.com/millb)) +- حذف برخی از کپی و چسباندن (temporaryfile و temporaryfilestream) + [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([علم هنر + زویکوف](https://github.com/4ertus2)) +- بهبود خوانایی کد کمی (`MergeTreeData::getActiveContainingPart`). + [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([ولادیمیر + Chebotarev](https://github.com/excitoon)) +- منتظر تمام مشاغل برنامه ریزی شده باشید که از اشیا محلی استفاده می کنند `ThreadPool::schedule(...)` پرت + یک استثنا. تغییر نام `ThreadPool::schedule(...)` به `ThreadPool::scheduleOrThrowOnError(...)` و + رفع نظرات برای ایجاد واضح است که ممکن است پرتاب. + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) + ([تاولوبیکس](https://github.com/tavplubix)) + +## انتشار کلیک 19.15 {#clickhouse-release-19-15} + +### انتشار کلیک خانه 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} + +#### رفع اشکال {#bug-fix-3} + +- اضافه شده دست زدن به sql\_tinyint و sql\_bigint و ثابت دست زدن به sql\_float منبع داده در انواع odbc پل. + [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([دنیس گلازاشف](https://github.com/traceon)) +- مجاز به برخی از قطعات بر روی دیسک مقصد و یا حجم در پارتیشن حرکت. + [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- ثابت null-ارزش در nullable ستون از طریق odbc-پل. + [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([واسیلی نمکو](https://github.com/Enmk)) +- درج ثابت به گره غیر محلی توزیع شده با ستون محقق. + [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([ازات خوژین](https://github.com/azat)) +- تابع ثابت دریافت می کند. + [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([میخیل کوروتف](https://github.com/millb)) +- شماره ثابت با استفاده از اچ.تی. پی را نگه دارید ایست زنده به جای تی. پی نگه داشتن ایست زنده است. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([واسیلی نمکو](https://github.com/Enmk)) +- صبر کنید برای همه مشاغل را به پایان برساند در استثنا (رفع حملات نادر). + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([تاولوبیکس](https://github.com/tavplubix)) +- هنگام وارد کردن به میز کافکا به موفکا فشار ندهید. + [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([ایوان](https://github.com/abyss7)) +- غیر فعال کردن ردیاب حافظه برای استثنا پشته. + [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- کد بد ثابت در تبدیل پرس و جو برای پایگاه داده خارجی. + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از استفاده از ارزش های بی قید و شرط در مترسستر. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([ازات خوژین](https://github.com/azat)) +- اضافه شده به عنوان مثال پیکربندی با ماکروها برای تست ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} + +#### رفع اشکال {#bug-fix-4} + +- بد\_واریانت ثابت در درهم فرهنگ لغت. + ([الساپین](https://github.com/alesapin)) +- ثابت کردن اشکال با گسل تقسیم بندی در ضمیمه پرس و جو بخش. + ([الساپین](https://github.com/alesapin)) +- محاسبه زمان ثابت در `MergeTreeData`. + ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- متعهد به کافکا به صراحت پس از نوشتن نهایی است. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([ایوان](https://github.com/abyss7)) +- مرتب کردن مقادیر صفر به درستی در شاخص دقیقه/حداکثر از قطعات ادغام. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([الکساندر کوزمنکوف](https://github.com/akuzm)) + +### انتشار کلیک خانه 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} + +#### ویژگی جدید {#new-feature-3} + +- ذخیره سازی چند طبقه: پشتیبانی از استفاده از حجم ذخیره سازی های متعدد برای جداول با موتور ادغام. امکان ذخیره داده های تازه بر روی اس اس دی و انتقال خودکار داده های قدیمی به هارد وجود دارد. ([مثال](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([ایگر](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([الساپین](https://github.com/alesapin)) +- اضافه کردن تابع جدول `input` برای خواندن داده های ورودی در `INSERT SELECT` پرس و جو. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([هشدار داده می شود](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([انتون پوپوف](https://github.com/CurtizJ)) +- افزودن یک `sparse_hashed` طرح فرهنگ لغت, که عملکرد به معادل `hashed` طرح, اما حافظه بیشتر موثر است. این در مورد حافظه دو برابر کمتر با هزینه بازیابی ارزش کندتر استفاده می کند. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([ازات خوژین](https://github.com/azat)) +- پیاده سازی توانایی تعریف لیستی از کاربران برای دسترسی به لغت نامه. فقط پایگاه داده متصل فعلی با استفاده از. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- افزودن `LIMIT` گزینه ای برای `SHOW` پرس و جو. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([فیلیپ مالکوفسکی](https://github.com/malkfilipp)) +- افزودن `bitmapSubsetLimit(bitmap, range_start, limit)` تابع, که زیر مجموعه از کوچکترین گرداند `limit` ارزش ها در مجموعه ای است که هیچ کوچکتر از `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([ژیچنگ یو](https://github.com/yuzhichang)) +- افزودن `bitmapMin` و `bitmapMax` توابع. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([ژیچنگ یو](https://github.com/yuzhichang)) +- افزودن تابع `repeat` مربوط به [شماره-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([فلین](https://github.com/ucasFL)) + +#### ویژگی تجربی {#experimental-feature-1} + +- پیاده سازی (در حافظه) ادغام پیوستن به نوع که خط لوله فعلی را تغییر دهید. نتیجه تا حدی توسط کلید ادغام طبقه بندی شده اند. تنظیم `partial_merge_join = 1` برای استفاده از این ویژگی. ادغام پیوستن هنوز در حال توسعه است. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([زویکوف](https://github.com/4ertus2)) +- افزودن `S3` موتور و عملکرد جدول. هنوز در حال توسعه است (هنوز پشتیبانی احراز هویت وجود ندارد). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([ولادیمیر چبوتراف](https://github.com/excitoon)) + +#### بهبود {#improvement-2} + +- هر پیامی که از کافکا خوانده می شود به صورت عام وارد می شود. این حل مشکلات تقریبا همه شناخته شده با موتور کافکا. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([ایوان](https://github.com/abyss7)) +- بهبود برای عدم موفقیت نمایش داده شد توزیع شده است. کوتاه شدن زمان بازیابی, همچنین در حال حاضر قابل تنظیم است و می تواند در دیده `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([واسیلی نمکو](https://github.com/Enmk)) +- پشتیبانی از مقادیر عددی برای شمارشی به طور مستقیم در `IN` بخش. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([دیماروب2000](https://github.com/dimarub2000)) +- پشتیبانی (اختیاری, غیر فعال به طور پیش فرض) تغییرمسیر در ذخیره سازی نشانی وب. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([رول](https://github.com/maqroll)) +- اضافه کردن پیام اطلاعات زمانی که مشتری با نسخه های قدیمی تر متصل به یک سرور. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([فیلیپ مالکوفسکی](https://github.com/malkfilipp)) +- حذف حداکثر محدودیت زمانی خواب برای ارسال داده ها در جداول توزیع شده [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([ازات خوژین](https://github.com/azat)) +- اضافه کردن توانایی ارسال رویدادهای پروفایل (شمارنده) با ارزش تجمعی به گرافیت. این را می توان تحت فعال `` در کارساز `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([ازات خوژین](https://github.com/azat)) +- اضافه کردن نوع بازیگران به طور خودکار `T` به `LowCardinality(T)` در حالی که قرار دادن داده ها در ستون نوع `LowCardinality(T)` در قالب بومی از طریق قام. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اضافه کردن توانایی استفاده از تابع `hex` بدون استفاده از `reinterpretAsString` برای `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([میخیل کوروتف](https://github.com/millb)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-2} + +- اضافه کردن گدی شاخص به کلیک باینری با اطلاعات اشکال زدایی. این سرعت زمان راه اندازی را افزایش می دهد `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([الساپین](https://github.com/alesapin)) +- بسته بندی با سرعت بالا با بسته بندی پچ پچ که با استفاده از `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([الساپین](https://github.com/alesapin)) +- تنظیم `enable_fuzzing = 1` برای فعال کردن ابزار دقیق رایگان از تمام کد پروژه. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([کیپریزل](https://github.com/kyprizel)) +- اضافه کردن تست دود ساخت تقسیم در سی. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([الساپین](https://github.com/alesapin)) +- اضافه کردن ساخت با حفظ به سی. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- جایگزینی `libsparsehash` با `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([ازات خوژین](https://github.com/azat)) + +#### رفع اشکال {#bug-fix-5} + +- تجزیه عملکرد ثابت تجزیه و تحلیل شاخص بر روی کلید های پیچیده در جداول بزرگ. این رفع \# 6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع خطا منطقی باعث حملات در هنگام انتخاب از کافکا موضوع خالی. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([ایوان](https://github.com/abyss7)) +- رفع خیلی زود خروجی زیر اتصال نزدیک در `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- پشتیبانی از دانه های لینوکس بسیار قدیمی (ثابت [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع از دست دادن داده ها ممکن است در `insert select` پرس و جو در صورت بلوک خالی در جریان ورودی. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- ثابت برای عملکرد `АrrayEnumerateUniqRanked` با بند خالی در پارامز [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([پرولر](https://github.com/proller)) +- رفع نمایش داده شد پیچیده با مجموعه ای می پیوندد و فرعی جهانی است. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([ایوان](https://github.com/abyss7)) +- ثابت `Unknown identifier` خطا در ترتیب و گروه با چند می پیوندد [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([زویکوف](https://github.com/4ertus2)) +- ثابت `MSan` هشدار هنگام اجرای تابع با `LowCardinality` استدلال کردن. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-2} + +- تغییر فرمت ترتیب از بیت مپ \* تابع مجموع می گوید برای بهبود عملکرد. ایالات سریال بیت مپ\* از نسخه های قبلی را نمی توان به عنوان خوانده شده. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([ژیچنگ یو](https://github.com/yuzhichang)) + +## انتشار کلیک 19.14 {#clickhouse-release-19-14} + +### انتشار کلیک کنیدهاوس 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} + +#### رفع اشکال {#bug-fix-6} + +- این نسخه همچنین شامل تمام رفع اشکال از 19.11.12.69. +- سازگاری ثابت برای نمایش داده شد توزیع بین 19.14 و نسخه های قبلی. این رفع [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک کنیدهاوس 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} + +#### رفع اشکال {#bug-fix-7} + +- ثابت برای عملکرد `АrrayEnumerateUniqRanked` با بند خالی در پارامز. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([پرولر](https://github.com/proller)) +- نام زیرخاکی ثابت در نمایش داده شد با `ARRAY JOIN` و `GLOBAL IN subquery` با نام مستعار. استفاده از نام مستعار زیرخاکی برای نام جدول خارجی اگر مشخص شده است. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([ایوان](https://github.com/abyss7)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-3} + +- ثابت [زدن](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) تست `00715_fetch_merged_or_mutated_part_zookeeper` با بازنویسی به اسکریپت پوسته چون نیاز به صبر برای جهش به درخواست. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([الکساندر کازاکوف](https://github.com/Akazz)) +- شکست ثابت اوبسان و ممسان در عملکرد `groupUniqArray` با استدلال امتپی ار این با قرار دادن خالی ایجاد شد `PaddedPODArray` به هش جدول صفر سلول به دلیل سازنده برای ارزش سلول صفر نامیده می شد. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([ایموس پرنده](https://github.com/amosbird)) + +### انتشار کلیک خانه 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} + +#### ویژگی جدید {#new-feature-4} + +- `WITH FILL` تغییردهنده برای `ORDER BY`. (ادامه [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([انتون پوپوف](https://github.com/CurtizJ)) +- `WITH TIES` تغییردهنده برای `LIMIT`. (ادامه [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([انتون پوپوف](https://github.com/CurtizJ)) +- تجزیه unquoted `NULL` تحت اللفظی به عنوان پوچ (اگر تنظیم `format_csv_unquoted_null_literal_as_null=1`). مقداردهی اولیه زمینه های تهی با مقادیر پیش فرض اگر نوع داده ها از این زمینه است قابل ابطال نیست (اگر تنظیم `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([تاولوبیکس](https://github.com/tavplubix)) +- پشتیبانی از نویسه عام در مسیرهای توابع جدول `file` و `hdfs`. اگر مسیر شامل نویسه عام, جدول خوانده خواهد شد. مثال استفاده: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` و `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- جدید `system.metric_log` جدول است که فروشگاه ها ارزش `system.events` و `system.metrics` با فاصله زمانی مشخص شده است. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجازه به نوشتن سیاهههای مربوط به متن کلیک به `system.text_log` جدول [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نمایش علامت خصوصی در اثری پشته (این است که از طریق تجزیه جداول نماد فایل های جن انجام). اضافه شدن اطلاعات در مورد فایل و شماره خط در اثری پشته اگر اطلاعات اشکال زدایی وجود دارد. نام نماد افزایش سرعت مراجعه با علامت نمایه سازی در حال حاضر در برنامه. اضافه شده توابع جدید گذاشتن برای درون گرایی: `demangle` و `addressToLine`. تابع تغییر نام داد `symbolizeAddress` به `addressToSymbol` برای ثبات. تابع `addressToSymbol` خواهد نام لت و پار به دلایل عملکرد بازگشت و شما باید به درخواست `demangle`. اضافه شدن تنظیمات `allow_introspection_functions` که به طور پیش فرض خاموش است. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تابع جدول `values` (نام غیر حساس به حروف است). این اجازه می دهد تا از خواندن `VALUES` فهرست پیشنهادی در [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). مثال: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([دیماروب2000](https://github.com/dimarub2000)) +- توانایی تغییر تنظیمات ذخیره سازی اضافه شده است. نحو: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([الساپین](https://github.com/alesapin)) +- پشتیبانی از حذف قطعات جدا شده. نحو: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([تاولوبیکس](https://github.com/tavplubix)) +- محدودیت های جدول. اجازه می دهد تا برای اضافه کردن محدودیت به تعریف جدول خواهد شد که در درج بررسی می شود. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([گلب novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پشتیبانی برای نمایش ساختگی محقق. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([ایموس پرنده](https://github.com/amosbird)) +- روشن کردن پیشفیلتر پرس و جو به طور پیش فرض برای نمونه هر موضوع اعدام پرس و جو یک بار در ثانیه. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- قالب ورودی `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([اکونیک 90](https://github.com/akonyaev90)) +- اضافه شدن دو توابع جدید: `sigmoid` و `tanh` (که برای برنامه های کاربردی یادگیری ماشین مفید هستند). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تابع `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` برای بررسی اگر نشانه داده شده است در انبار کاه. رمز یک زیر رشته طول حداکثر بین دو شخصیت اسکی غیر الفبایی است (یا مرزهای انبار کاه). رمز باید یک رشته ثابت باشد. پشتیبانی شده توسط تخصص شاخص توکنبف1. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([واسیلی نمکو](https://github.com/Enmk)) +- عملکرد جدید `neighbor(value, offset[, default_value])`. اجازه می دهد تا برای رسیدن به مقدار قبلی/بعدی در ستون در یک بلوک از داده ها. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([الکس کرش](https://github.com/alex-krash)) [6685365اب8ک5ب74ف9650492ج88012596ب1ب06](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341الکترونیکی4587وا18065سی2دا1ک888ج73389ف48ک36 درجه سانتیگراد](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [الکسی میلویدو](https://github.com/alexey-milovidov) +- ایجاد یک تابع `currentUser()`, ورود بازگشت از کاربر مجاز. نام مستعار اضافه شده است `user()` برای سازگاری با خروجی زیر. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([الکس کرش](https://github.com/alex-krash)) +- توابع جدید مجموع `quantilesExactInclusive` و `quantilesExactExclusive` که در پیشنهاد شد [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([دیماروب2000](https://github.com/dimarub2000)) +- تابع `bitmapRange(bitmap, range_begin, range_end)` که برمی گرداند مجموعه ای جدید با محدوده مشخص شده (شامل نمی شود `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([ژیچنگ یو](https://github.com/yuzhichang)) +- تابع `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` که مجموعه ای از رشته های دقیق طولانی از جعبه های جغرافیایی را پوشش می دهد. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([واسیلی نمکو](https://github.com/Enmk)) +- پیاده سازی پشتیبانی برای قرار دادن پرس و جو با `Kafka` میز [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([ایوان](https://github.com/abyss7)) +- اضافه شدن پشتیبانی برای `_partition` و `_timestamp` ستون مجازی به موتور کافکا. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([ایوان](https://github.com/abyss7)) +- امکان حذف اطلاعات حساس از `query_log`, سیاهههای مربوط به سرور, لیست فرایند با قوانین مبتنی بر عبارت منظم. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([فیلیمونف](https://github.com/filimonov)) + +#### ویژگی تجربی {#experimental-feature-2} + +- فرمت داده ورودی و خروجی `Template`. این اجازه می دهد برای مشخص رشته فرمت های سفارشی برای ورودی و خروجی. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([تاولوبیکس](https://github.com/tavplubix)) +- اجرای `LIVE VIEW` جداول که در اصل در پیشنهاد شد [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) در حال بارگذاری [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925) و سپس به روز شده در [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). ببینید [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) برای شرح مفصلی. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([وزکازنیکوف](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) توجه داشته باشید که `LIVE VIEW` ویژگی ممکن است در نسخه های بعدی حذف شده است. + +#### رفع اشکال {#bug-fix-8} + +- این نسخه همچنین شامل رفع اشکال از 19.13 و 19.11. +- رفع گسل تقسیم بندی زمانی که جدول شاخص جست و خیز و ادغام عمودی اتفاق می افتد. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([الساپین](https://github.com/alesapin)) +- رفع ستون در هر ستون با پیش فرض ستون غیر بدیهی است. پیش از این در مورد نیروی تی ال ادغام با `OPTIMIZE ... FINAL` پرس و جو, ارزش منقضی شده توسط پیش فرض نوع به جای پیش فرض ستون مشخص شده توسط کاربر جایگزین شد. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع کافکا پیام های تکراری مشکل در سرور معمولی راه اندازی مجدد. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([ایوان](https://github.com/abyss7)) +- حلقه بی نهایت ثابت در هنگام خواندن پیام کافکا. مکث نکنید / مصرف کننده رزومه در اشتراک در همه-در غیر این صورت ممکن است به طور نامحدود در برخی از حالات متوقف. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([ایوان](https://github.com/abyss7)) +- ثابت `Key expression contains comparison between inconvertible types` استثنا در `bitmapContains` تابع. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([دیماروب2000](https://github.com/dimarub2000)) +- اصلاح سگو با فعال `optimize_skip_unused_shards` و از دست رفته کلید شاردینگ. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([انتون پوپوف](https://github.com/CurtizJ)) +- کد اشتباه ثابت در جهش است که ممکن است به فساد حافظه منجر شود. سگو ثابت با خواندن نشانی `0x14c0` که ممکن است به دلیل همزمان اتفاق `DROP TABLE` و `SELECT` از `system.parts` یا `system.parts_columns`. شرایط مسابقه ثابت در تهیه نمایش داده شد جهش. بن بست ثابت ناشی از `OPTIMIZE` از جداول تکرار و عملیات اصلاح همزمان مانند تغییر. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حذف ورود به سیستم طولانی اضافی در رابط خروجی زیر [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بازگشت توانایی به تجزیه تنظیمات بولی از ‘true’ و ‘false’ در فایل پیکربندی. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([الساپین](https://github.com/alesapin)) +- رفع سقوط در `quantile` و `median` عملکرد بیش از `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([زویکوف](https://github.com/4ertus2)) +- ثابت نتیجه ناقص ممکن توسط بازگشت `SELECT` پرسوجو با `WHERE` شرایط در کلید اولیه شامل تبدیل به نوع شناور. این با چک کردن نادرست از یکنواختی در ایجاد شد `toFloat` تابع. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([دیماروب2000](https://github.com/dimarub2000)) +- بررسی `max_expanded_ast_elements` تنظیم برای جهش. پاک کردن جهش پس از `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([زمستان ژانگ](https://github.com/zhang2014)) +- ثابت پیوستن به نتایج برای ستون های کلیدی زمانی که با استفاده `join_use_nulls`. ضمیمه نقاط صفر به جای ستون پیش فرض. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([زویکوف](https://github.com/4ertus2)) +- ثابت برای پرش شاخص با ادغام عمودی و تغییر دهید. ثابت برای `Bad size of marks file` استثنا. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([الساپین](https://github.com/alesapin)) +- رفع سقوط نادر در `ALTER MODIFY COLUMN` و ادغام عمودی زمانی که یکی از قطعات ادغام شده/تغییر داده شده خالی است (0 ردیف) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([الساپین](https://github.com/alesapin)) +- اشکال ثابت در تبدیل `LowCardinality` انواع در `AggregateFunctionFactory`. این رفع [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع رفتار اشتباه و حملات احتمالی در `topK` و `topKWeighted` توابع جمع. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([انتون پوپوف](https://github.com/CurtizJ)) +- کد ناامن ثابت در اطراف `getIdentifier` تابع. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اشکال ثابت در خروجی زیر پروتکل سیم (استفاده می شود در حالی که اتصال به خانه فرم خروجی زیر مشتری). ناشی از سرریز بافر پشته در `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([یوری بارانوف](https://github.com/yurriy)) +- نشت حافظه ثابت در `bitmapSubsetInRange` تابع. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([ژیچنگ یو](https://github.com/yuzhichang)) +- رفع اشکال نادر زمانی که جهش اجرا پس از تغییر دانه بودن. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([الساپین](https://github.com/alesapin)) +- اجازه دادن به پیام پروتوبوف با تمام زمینه ها به طور پیش فرض. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع اشکال با `nullIf` تابع هنگامی که ما ارسال `NULL` استدلال در بحث دوم. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- رفع اشکال نادر با تخصیص حافظه اشتباه / تخصیص در لغت نامه کش کلید پیچیده با رشته های رشته ای که منجر به مصرف حافظه بی نهایت (به نظر می رسد مانند نشت حافظه). اشکال بازتولید زمانی که اندازه رشته قدرت دو شروع از هشت بود (8, 16, 32, و غیره). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([الساپین](https://github.com/alesapin)) +- پشتیبانی می کند گوریل ثابت در توالی های کوچک که باعث استثنا `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([واسیلی نمکو](https://github.com/Enmk)) +- اجازه استفاده از انواع قابل ابطال نیست در می پیوندد با `join_use_nulls` فعال شد [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([زویکوف](https://github.com/4ertus2)) +- غیرفعالسازی `Poco::AbstractConfiguration` جایگزینی پرسوجو در `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از بن بست در `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- با استفاده از `arrayReduce` برای استدلال های ثابت ممکن است به پیش فرض منجر شود. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع قطعات متناقض است که می تواند به نظر می رسد اگر ماکت پس از ترمیم شد `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([تاولوبیکس](https://github.com/tavplubix)) +- ثابت قطع در `JSONExtractRaw` تابع. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال با نادرست جست و خیز شاخص ترتیب و تجمع با دانه دانه تطبیقی. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([الساپین](https://github.com/alesapin)) +- ثابت `WITH ROLLUP` و `WITH CUBE` اصلاح کننده های `GROUP BY` با تجمع دو سطح. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع اشکال با نوشتن شاخص ثانویه نشانه با دانه دانه تطبیقی. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([الساپین](https://github.com/alesapin)) +- رفع مقدار دهی اولیه سفارش در حالی که راه اندازی سرور. از `StorageMergeTree::background_task_handle` مقدار دهی اولیه در `startup()` این `MergeTreeBlockOutputStream::write()` ممکن است سعی کنید قبل از مقدار دهی اولیه استفاده کنید. فقط بررسی کنید اگر مقداردهی اولیه شده است. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([ایوان](https://github.com/abyss7)) +- پاک کردن بافر داده ها از عملیات خواندن قبلی که با یک خطا تکمیل شد. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([نیکولای](https://github.com/bopohaa)) +- رفع اشکال با فعال کردن دانه دانه تطبیقی در هنگام ایجاد یک ماکت جدید برای تکرار\*جدول ادغام. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([الساپین](https://github.com/alesapin)) +- تصادف ممکن است ثابت در هنگام راه اندازی سرور در صورت استثنا در اتفاق افتاد `libunwind` در طول استثنا در دسترسی به بی قید و شرط `ThreadStatus` ساختار. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- رفع سقوط در `yandexConsistentHash` تابع. پیدا شده توسط تست ریش شدن. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت امکان معلق نمایش داده شد زمانی که سرور غیرمنتظره است و استخر موضوع جهانی در نزدیکی کامل می شود. این بالاتر شانس اتفاق می افتد در خوشه با تعداد زیادی از خرده ریز (صدها), به دلیل نمایش داده شد توزیع اختصاص یک موضوع در هر اتصال به هر سفال. مثلا, این موضوع ممکن است تکثیر اگر یک خوشه از 330 خرده ریز در حال پردازش 30 نمایش داده شد توزیع همزمان. این موضوع بر تمام نسخه های با شروع از 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- منطق ثابت `arrayEnumerateUniqRanked` تابع. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت شده است که جدول نماد رمز گشایی. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([ایموس پرنده](https://github.com/amosbird)) +- استثنا بی ربط ثابت در بازیگران `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- حذف نقل قول اضافی از توضیحات در `system.settings` جدول [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از بن بست ممکن است در `TRUNCATE` از جدول تکرار. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع خواندن به منظور مرتب سازی کلید. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([انتون پوپوف](https://github.com/CurtizJ)) +- ثابت `ALTER TABLE ... UPDATE` پرسو جو برای جداول با `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([الساپین](https://github.com/alesapin)) +- رفع اشکال باز شده توسط [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (پیش 19.4.0). بازتولید در نمایش داده شد به جداول توزیع بیش از جداول ادغام هنگامی که ما هیچ ستون پرس و جو نیست (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([الساپین](https://github.com/alesapin)) +- سرریز ثابت در تقسیم عدد صحیح از نوع امضا شده به نوع بدون علامت. رفتار دقیقا همانطور که در ج یا ج++ زبان (قوانین ترویج عدد صحیح) که ممکن است جای تعجب بود. لطفا توجه داشته باشید که سرریز هنوز هم ممکن است در هنگام تقسیم تعداد زیادی امضا به تعداد بزرگ بدون علامت و یا بالعکس (اما این مورد کمتر معمول است). این موضوع در تمام نسخه های سرور وجود داشته است. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- محدود کردن حداکثر زمان خواب برای متوقف کردن زمانی که `max_execution_speed` یا `max_execution_speed_bytes` قرار است. خطاهای غلط ثابت مانند `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- مشکلات ثابت در مورد استفاده از `MATERIALIZED` ستون ها و نام مستعار در `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([ایموس پرنده](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `FormatFactory` رفتار برای جریان ورودی که به عنوان پردازنده اجرا نمی شود. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- خطای تایپی ثابت. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([الکس ریندین](https://github.com/alexryndin)) +- خطای تایپی در پیام خطا (است - \> هستند ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([دنیس ژورولو](https://github.com/den-crane)) +- خطا ثابت در حالی که تجزیه لیست ستون از رشته اگر نوع حاوی کاما (این موضوع مربوط به بود `File`, `URL`, `HDFS` ذخیره سازی) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([دیماروب2000](https://github.com/dimarub2000)) + +#### تعمیر امنیتی {#security-fix} + +- این نسخه همچنین شامل تمام اشکال امنیتی رفع از 19.13 و 19.11. +- ثابت امکان پرس و جو ساخته به علت سقوط سرور به دلیل سرریز پشته در پارسر گذاشتن. ثابت امکان سرریز پشته در ادغام و توزیع جداول محقق انداز و شرایط برای ردیف-سطح امنیتی است که شامل subqueries. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### بهبود {#improvement-3} + +- اجرای صحیح منطق سه تایی برای `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([الکساندر کازاکوف](https://github.com/Akazz)) +- در حال حاضر ارزش ها و ردیف با تت ال منقضی شده خواهد شد پس از حذف `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` پرس و جو. اضافه شده نمایش داده شد `SYSTEM STOP/START TTL MERGES` برای غیرفعال کردن / اجازه می دهد ادغام اختصاص با کنترل از راه دور و فیلتر مقادیر منقضی شده در تمام ادغام. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([انتون پوپوف](https://github.com/CurtizJ)) +- امکان تغییر محل فایل تاریخچه کلیک برای مشتری با استفاده از `CLICKHOUSE_HISTORY_FILE` انوف [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([فیلیمونف](https://github.com/filimonov)) +- حذف `dry_run` پرچم از `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- پشتیبانی `ASOF JOIN` با `ON` بخش. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([زویکوف](https://github.com/4ertus2)) +- پشتیبانی بهتر از شاخص جست و خیز برای جهش و تکرار. پشتیبانی از `MATERIALIZE/CLEAR INDEX ... IN PARTITION` پرس و جو. `UPDATE x = x` محاسبه تمام شاخص هایی که از ستون استفاده می کنند `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- اجازه دادن به `ATTACH` نمایش زنده (مثلا, در هنگام راه اندازی سرور) بدون در نظر گرفتن به `allow_experimental_live_view` تنظیمات. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- برای ردیابی پشته جمع شده توسط پیشفیلتر پرس و جو, انجام فریم پشته تولید شده توسط پیشفیلتر پرس و جو خود را شامل نمی شود. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر توابع جدول `values`, `file`, `url`, `hdfs` پشتیبانی از ستون نام مستعار. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پرتاب یک استثنا اگر `config.d` فایل عنصر ریشه مربوطه به عنوان فایل پیکربندی ندارد. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([دیماروب2000](https://github.com/dimarub2000)) +- چاپ اطلاعات اضافی در پیام استثنا برای `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([تاولوبیکس](https://github.com/tavplubix)) +- هنگام تعیین تکه های یک `Distributed` جدول به یک پرس و جو به عنوان خوانده شده تحت پوشش (برای `optimize_skip_unused_shards` = 1) تاتر در حال حاضر چک شرایط از هر دو `prewhere` و `where` بند از بیانیه را انتخاب کنید. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([الکساندر کازاکوف](https://github.com/Akazz)) +- فعال شد `SIMDJSON` برای ماشین های بدون AVX2 اما با SSE 4.2 و PCLMUL مجموعه آموزش. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تاتر می توانید بر روی فایل سیستم بدون کار `O_DIRECT` پردازشگر پشتیبانی شده: [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پشتیبانی از فشار پایین گزاره برای خرده فروشی نهایی. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([تسیسون](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهتر `JOIN ON` استخراج کلید [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([زویکوف](https://github.com/4ertus2)) +- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهینه سازی انتخاب کوچکترین ستون برای `SELECT count()` پرس و جو. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([ایموس پرنده](https://github.com/amosbird)) +- اضافه شده `strict` پارامتر در `windowFunnel()`. هنگامی که `strict` تنظیم شده است `windowFunnel()` اعمال شرایط تنها برای ارزش های منحصر به فرد. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([ایشیمب](https://github.com/achimbab)) +- رابط امن تر از `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([مربی](https://github.com/avasiliev)) +- گزینه های اندازه خط در هنگام اجرای با `--help` گزینه در حال حاضر با اندازه ترمینال مربوط. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([دیماروب2000](https://github.com/dimarub2000)) +- غیرفعالسازی “read in order” بهینه سازی برای تجمع بدون کلید. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([انتون پوپوف](https://github.com/CurtizJ)) +- کد وضعیت قام برای `INCORRECT_DATA` و `TYPE_MISMATCH` کد خطا از پیش فرض تغییر یافت `500 Internal Server Error` به `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([الکساندر رودین](https://github.com/a-rodin)) +- حرکت پیوستن شی از `ExpressionAction` به `AnalyzedJoin`. `ExpressionAnalyzer` و `ExpressionAction` در مورد نمی دانم `Join` کلاس دیگر. منطق خود را با پنهان `AnalyzedJoin` صورت. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([زویکوف](https://github.com/4ertus2)) +- بن بست ممکن ثابت از نمایش داده شد توزیع زمانی که یکی از خرده ریز جایلهاست اما پرس و جو از طریق اتصال به شبکه ارسال می شود. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تغییر معنایی جداول چندگانه `RENAME` برای جلوگیری از بن بست ممکن است. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بازنویسی خروجی زیر سرور سازگاری برای جلوگیری از بارگذاری محموله بسته کامل در حافظه است. کاهش مصرف حافظه برای هر اتصال به حدود `2 * DBMS_DEFAULT_BUFFER_SIZE` (خواندن / نوشتن بافر). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([یوری بارانوف](https://github.com/yurriy)) +- حرکت اس تی نام مستعار تفسیر منطق از تجزیه کننده که لازم نیست به دانستن هر چیزی در مورد معناشناسی پرس و جو. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([زویکوف](https://github.com/4ertus2)) +- تجزیه کمی امن تر از `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `clickhouse-copier`: اجازه استفاده `where_condition` از پیکربندی با `partition_key` نام مستعار در پرس و جو برای چک کردن وجود پارتیشن (قبلا فقط در خواندن نمایش داده شد داده ها مورد استفاده قرار گرفت). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([پرولر](https://github.com/proller)) +- اضافه شده استدلال پیام اختیاری در `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([ولادیمیر](https://github.com/Vdimir)) +- استثنا سرور کردم در حالی که ارسال داده های درج در حال حاضر در حال پردازش در مشتری نیز هست. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([دیماروب2000](https://github.com/dimarub2000)) +- اضافه شده متریک `DistributedFilesToInsert` که نشان می دهد تعداد کل فایل ها در سیستم فایل که انتخاب می شوند برای ارسال به سرور از راه دور توسط جداول توزیع شده است. تعداد در تمام خرده ریز خلاصه. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حرکت بسیاری از می پیوندد تهیه منطق از `ExpressionAction/ExpressionAnalyzer` به `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([زویکوف](https://github.com/4ertus2)) +- رفع تسان [اخطار](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([واسیلی نمکو](https://github.com/Enmk)) +- پیام های اطلاعات بهتر در مورد عدم قابلیت های لینوکس. ورود به سیستم خطاهای کشنده با “fatal” سطح, که ساده تر خواهد شد برای پیدا کردن در `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- هنگام فعال کردن اطلاعات موقت تخلیه به دیسک برای محدود کردن استفاده از حافظه در طول `GROUP BY`, `ORDER BY` فضای دیسک رایگان را بررسی نکرد. ثابت اضافه کردن یک محیط جدید `min_free_disk_space`, هنگامی که فضای دیسک رایگان کوچکتر و سپس حد, پرس و جو را متوقف خواهد کرد و پرتاب `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing زو](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رواندا بازگشتی حذف شده توسط موضوع. این باعث می شود هیچ حس, چرا که موضوعات بین نمایش داده شد مورد استفاده مجدد قرار. `SELECT` پرس و جو ممکن است یک قفل در یک موضوع, یک قفل از موضوع دیگر نگه دارید و خروج از موضوع اول. در همان زمان اولین موضوع را می توان با استفاده مجدد `DROP` پرس و جو. این به نادرست منجر شود “Attempt to acquire exclusive lock recursively” پیام [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شکافتن `ExpressionAnalyzer.appendJoin()`. تهیه یک مکان در `ExpressionAnalyzer` برای `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([زویکوف](https://github.com/4ertus2)) +- اضافه شده `mysql_native_password` پلاگین احراز هویت به خروجی زیر سرور سازگاری. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([یوری بارانوف](https://github.com/yurriy)) +- تعداد کمتر از `clock_gettime` سازگاری ابی ثابت بین اشکال زدایی / انتشار در `Allocator` (موضوع ناچیز). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حرکت کن `collectUsedColumns` از `ExpressionAnalyzer` به `SyntaxAnalyzer`. `SyntaxAnalyzer` می سازد `required_source_columns` خود را در حال حاضر. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([زویکوف](https://github.com/4ertus2)) +- افزودن تنظیمات `joined_subquery_requires_alias` برای نیاز به نام مستعار برای انتخاب و توابع جدول در `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([زویکوف](https://github.com/4ertus2)) +- استخراج `GetAggregatesVisitor` رده از `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([زویکوف](https://github.com/4ertus2)) +- `system.query_log`: تغییر نوع داده `type` ستون به `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- پیوند استاتیک `sha256_password` پلاگین احراز هویت. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([یوری بارانوف](https://github.com/yurriy)) +- اجتناب از وابستگی اضافی برای تنظیم `compile` سر کار. در نسخه های قبلی کاربر ممکن است مانند خطا دریافت کنید `cannot open crti.o`, `unable to find library -lc` و غیره [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اعتبار سنجی بیشتر از ورودی که ممکن است از ماکت های مخرب است. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حالا `clickhouse-obfuscator` پرونده در دسترس است `clickhouse-client` بسته در نسخه های قبلی در دسترس بود `clickhouse obfuscator` (با فضای خالی). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([دیماروب2000](https://github.com/dimarub2000)) +- بن بست ثابت زمانی که ما حداقل دو نمایش داده شد که حداقل دو جدول در جهت های مختلف و پرس و جو دیگری که انجام عملیات دسیدل در یکی از جداول به عنوان خوانده شده. ثابت دیگر بن بست بسیار نادر است. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده `os_thread_ids` ستون به `system.processes` و `system.query_log` برای احتمالات اشکال زدایی بهتر. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- یک راه حل برای اشکالات پسوند پی اچ پی میسورند که زمانی رخ می دهد `sha256_password` به عنوان یک پلاگین احراز هویت پیش فرض (شرح داده شده در [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([یوری baranov](https://github.com/yurriy)) +- حذف محل غیر ضروری با ستون ابطال تغییر. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([زویکوف](https://github.com/4ertus2)) +- تنظیم مقدار پیشفرض `queue_max_wait_ms` به صفر, به دلیل ارزش فعلی (پنج ثانیه) می سازد هیچ حس. شرایط نادر وجود دارد که این تنظیمات هر گونه استفاده. تنظیمات اضافه شده `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` و `connection_pool_max_wait_ms` برای ابهامزدایی. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- استخراج `SelectQueryExpressionAnalyzer` از `ExpressionAnalyzer`. نگه داشتن یکی از گذشته برای نمایش داده شد غیر را انتخاب کنید. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([زویکوف](https://github.com/4ertus2)) +- حذف تکثیر فرمت های ورودی و خروجی. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اجازه دادن به کاربر برای لغو `poll_interval` و `idle_connection_timeout` تنظیمات در اتصال. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `MergeTree` در حال حاضر دارای یک گزینه اضافی `ttl_only_drop_parts` (غیر فعال به طور پیش فرض) برای جلوگیری از هرس بخشی از قطعات, به طوری که به طور کامل کاهش یافته است که تمام ردیف در یک بخش منقضی شده است. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([سرگی ولدیکین](https://github.com/svladykin)) +- نوع چک برای توابع شاخص مجموعه. پرتاب استثنا اگر تابع یک نوع اشتباه. این رفع تست ریش شدن با اوبسان. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([نیکیتا واسیلیف](https://github.com/nikvas0)) + +#### بهبود عملکرد {#performance-improvement-2} + +- بهینه سازی نمایش داده شد با `ORDER BY expressions` بند, جایی که `expressions` پیشوند همزمان با مرتب سازی کلید در `MergeTree` میز این بهینه سازی توسط کنترل `optimize_read_in_order` تنظیمات. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([انتون پوپوف](https://github.com/CurtizJ)) +- اجازه می دهد به استفاده از موضوعات مختلف در بخش بارگذاری و حذف. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نوع دسته ای اجرا از به روز رسانی کشورهای تابع جمع. ممکن است به مزایای عملکرد منجر شود. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- با استفاده از `FastOps` کتابخانه برای توابع `exp`, `log`, `sigmoid`, `tanh`. FastOps سریع بردار ریاضی کتابخانه از مایکل Parakhin (Yandex CTO). بهبود عملکرد `exp` و `log` توابع بیش از 6 بار. توابع `exp` و `log` از `Float32` استدلال باز خواهد گشت `Float32` (در نسخه های قبلی همیشه باز می گردند `Float64`). حالا `exp(nan)` ممکن است بازگشت `inf`. نتیجه `exp` و `log` توابع ممکن است نزدیکترین ماشین تعداد نمایندگی به پاسخ واقعی نیست. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) با استفاده از Danila Kutenin نوع را fastops کار [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- غیر فعال کردن بهینه سازی کلید متوالی برای `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([اکوزم](https://github.com/akuzm)) +- بهبود عملکرد `simdjson` کتابخانه با خلاص شدن از تخصیص پویا در `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([ویتالی بارانو](https://github.com/vitlibar)) +- صفحات پیش گسل هنگام تخصیص حافظه با `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([اکوزم](https://github.com/akuzm)) +- رفع اشکال عملکرد در `Decimal` مقایسه. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([زویکوف](https://github.com/4ertus2)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-4} + +- حذف کامپایلر (نمونه زمان اجرا الگو) چرا که ما بیش از عملکرد این برنده ام. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تست عملکرد اضافه شده برای نشان دادن تخریب عملکرد در شورای همکاری خلیج فارس-9 در راه بیشتر جدا شده است. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تابع جدول اضافه شده است `numbers_mt`, که است که نسخه چند رشته ای از `numbers`. تست های عملکرد به روز شده با توابع هش. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- حالت مقایسه در `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([دیماروب2000](https://github.com/dimarub2000)) +- بهترین تلاش برای چاپ اثری پشته. همچنین اضافه شده است `SIGPROF` به عنوان یک سیگنال اشکال زدایی برای چاپ ردیابی پشته از یک موضوع در حال اجرا. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- هر تابع در فایل خود را, بخش 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حذف دو برابر const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([فیلیمونف](https://github.com/filimonov)) +- تغییرات قالب بندی برای `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([اکوزم](https://github.com/akuzm)) +- خرده فروشی بهتر برای پیوستن به ایجاد در `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([زویکوف](https://github.com/4ertus2)) +- حذف یک وضعیت کار برکنار شده (پیدا شده توسط پوس استودیو). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([اکوزم](https://github.com/akuzm)) +- جدا کردن رابط جدول هش برای `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([اکوزم](https://github.com/akuzm)) +- فاکتورگیری مجدد از تنظیمات. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([الساپین](https://github.com/alesapin)) +- اضافه کردن نظر برای `set` توابع شاخص. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- افزایش نمره اتم در نسخه اشکال زدایی در لینوکس. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([اکوزم](https://github.com/akuzm)) +- در حال حاضر در ساخت اشکال زدایی کار می کنند. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing زو](https://github.com/weiqxu)) +- اضافه شدن یک تست به `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن تست برای نمایش چند مادی برای جدول کافکا. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([ایوان](https://github.com/abyss7)) +- ایجاد یک طرح ساخت بهتر است. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([ایوان](https://github.com/abyss7)) +- ثابت `test_external_dictionaries` ادغام در صورتی که تحت کاربر غیر ریشه اعدام شد. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اشکال بازتولید زمانی که اندازه کل بسته های نوشته شده بیش از `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([یوری بارانوف](https://github.com/yurriy)) +- اضافه شدن یک تست برای `RENAME` شرایط مسابقه جدول [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از مسابقه داده ها در تنظیمات در `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن تست ادغام برای دست زدن به اشتباهات توسط یک فرهنگ لغت کش. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([ویتالی بارانو](https://github.com/vitlibar)) +- غیر فعال کردن تجزیه فایل های شی جن در سیستم عامل مک, زیرا باعث می شود هیچ حس. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تلاش برای ایجاد ژنراتور تغییرات بهتر است. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن `-Wshadow` تغییر به شورای همکاری خلیج فارس. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([کروزرکریگ](https://github.com/kreuzerkrieg)) +- حذف کد منسوخ برای `mimalloc` پشتیبانی [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `zlib-ng` قابلیت های ایکس86 را تعیین می کند و این اطلاعات را به متغیرهای جهانی ذخیره می کند. این است که در تماس دفالتینیت انجام, که ممکن است توسط موضوعات مختلف به طور همزمان ساخته شده. برای جلوگیری از چند رشته ای می نویسد, این کار را در هنگام راه اندازی کتابخانه. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([اکوزم](https://github.com/akuzm)) +- تست رگرسیون برای یک اشکال که در پیوستن که در ثابت شد [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([بختیاری روازیف](https://github.com/theruziev)) +- ثابت msan گزارش. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع زدن تست فلش. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([انتون پوپوف](https://github.com/CurtizJ)) +- مسابقه داده های نادرست ثابت در `MergeTreeDataPart::is_frozen` رشته. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- وقفه ثابت در تست ریش شدن. در نسخه های قبلی این موفق به پیدا کردن غلط معوق در پرس و جو `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن چک اشکال زدایی به `static_cast` از ستون. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پشتیبانی از اوراکل لینوکس در بسته های رسمی دور در دقیقه. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تغییر کامل جانسون از `once` به `loop` نوع. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- `odbc-bridge.cpp` تعریف `main()` بنابراین نباید در `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([اوروج دش](https://github.com/orivej)) +- تست تصادف در `FULL|RIGHT JOIN` با نقاط صفر در کلید جدول سمت راست. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([زویکوف](https://github.com/4ertus2)) +- اضافه شده یک تست برای حد در گسترش نام مستعار فقط در مورد. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تغییر از `boost::filesystem` به `std::filesystem` از کجا مناسب. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده بسته دور در دقیقه به وب سایت. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن یک تست برای ثابت `Unknown identifier` استثنا در `IN` بخش. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([زویکوف](https://github.com/4ertus2)) +- ساده کردن `shared_ptr_helper` چون مردم با مشکلاتی روبرو هستند که این را درک می کنند. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تست عملکرد اضافه شده برای گوریل ثابت و کدک مضاعف. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([واسیلی نمکو](https://github.com/Enmk)) +- تقسیم تست ادغام `test_dictionaries` به 4 تست جداگانه. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([ویتالی بارانو](https://github.com/vitlibar)) +- پردازشگر پشتیبانی شده: `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اجازه می دهد به استفاده از `library` منبع فرهنگ لغت با اسان. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن گزینه برای تولید تغییرات از یک لیست از روابط عمومی. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- قفل `TinyLog` ذخیره سازی در هنگام خواندن. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([اکوزم](https://github.com/akuzm)) +- بررسی برای پیوندهای نمادی شکسته در سی. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- افزایش اتمام وقت برای “stack overflow” تست کنید زیرا ممکن است مدت زمان طولانی در ساخت اشکال زدایی طول بکشد. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن یک چک برای فضاهای خالی دو برابر شود. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `new/delete` ردیابی حافظه در هنگام ساخت با ضد عفونی کننده. ردیابی مشخص نیست. این تنها مانع از استثنا حد حافظه در تست. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([زویکوف](https://github.com/4ertus2)) +- فعال کردن چک از علامت تعریف نشده در حالی که ارتباط. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([ایوان](https://github.com/abyss7)) +- اجتناب از بازسازی `hyperscan` هر روز [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- گزارش ثابت اوبسان در `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجازه ندهید که از پیشفیلتر پرس و جو با ضدعفونی کننده استفاده کنید زیرا سازگار نیست. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن تست برای بارگذاری یک فرهنگ لغت پس از شکست تایمر. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع تناقض در `PipelineExecutor::prepareProcessor` استدلال نوع. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اضافه شده یک تست برای ادرار بد. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن چک بیشتر به `CAST` تابع. این باید دریافت اطلاعات بیشتر در مورد گسل تقسیم بندی فازی در تست. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اضافه شده `gcc-9` پشتیبانی به `docker/builder` کانتینر که ایجاد تصویر به صورت محلی. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([گلب novikov](https://github.com/NanoBjorn)) +- تست برای کلید اولیه با `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([دیماروب2000](https://github.com/dimarub2000)) +- تست های ثابت تحت تاثیر اثر کند پشته اثری چاپ. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن یک مورد تست برای سقوط در `groupUniqArray` ثابت در [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([اکوزم](https://github.com/akuzm)) +- شاخص های ثابت تست جهش. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- در تست عملکرد, انجام ورود پرس و جو برای نمایش داده شد ما را اجرا کنید به عنوان خوانده شده. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([اکوزم](https://github.com/akuzm)) +- محقق نمایش در حال حاضر می تواند با ایجاد هر گونه کم cardinality انواع بدون توجه به تنظیمات مورد مشکوک کم cardinality انواع. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- تست های به روز شده برای `send_logs_level` تنظیمات. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع ساخت تحت شورای همکاری خلیج فارس-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([مکس اخمدوف](https://github.com/zlobober)) +- ثابت ساخت با لیبک داخلی++. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([ایوان](https://github.com/abyss7)) +- رفع ساخت مشترک با `rdkafka` کتابخانه [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([ایوان](https://github.com/abyss7)) +- رفع برای سیستم عامل مک ساخت (ناقص). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([اطلاعات دقیق](https://github.com/alex-zaitsev)) +- ثابت “splitted” ساختن. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- دیگر رفع ساخت: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([ایموس پرنده](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([وکسیدر](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([ایوان](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([پرولر](https://github.com/proller)) + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-3} + +- حذف تابع جدول به ندرت استفاده می شود `catBoostPool` و ذخیره سازی `CatBoostPool`. اگر شما این تابع جدول استفاده کرده اند, لطفا ارسال ایمیل به `clickhouse-feedback@yandex-team.com`. توجه داشته باشید که ادغام ادم کودن و احمق باقی می ماند و پشتیبانی خواهد شد. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- غیرفعالسازی `ANY RIGHT JOIN` و `ANY FULL JOIN` به طور پیش فرض. تنظیم `any_join_distinct_right_table_keys` تنظیم برای فعال کردن. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([زویکوف](https://github.com/4ertus2)) + +## انتشار کلیک 19.13 {#clickhouse-release-19-13} + +### انتشار کلیک خانه 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} + +#### رفع اشکال {#bug-fix-9} + +- این نسخه همچنین شامل تمام رفع اشکال از 19.11.12.69. + +### انتشار کلیک خانه 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} + +#### رفع اشکال {#bug-fix-10} + +- این نسخه همچنین شامل تمام رفع اشکال از 19.14.6.12. +- ثابت وضعیت متناقض ممکن است از جدول در حالی که اجرای `DROP` پرس و جو برای جدول تکرار در حالی که باغ وحش در دسترس نیست. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- ثابت برای مسابقه داده ها در انبار ذخیره سازی [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال معرفی شده در پیشفیلتر پرس و جو که منجر به ضبط بی پایان از سوکت. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([الساپین](https://github.com/alesapin)) +- رفع استفاده از پردازنده بیش از حد در حالی که اجرای `JSONExtractRaw` عملکرد بیش از یک مقدار بولی. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع رگرسیون در حالی که هل دادن به مشاهده محقق. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([ایوان](https://github.com/abyss7)) +- تابع جدول `url` در صورت امکان پذیری اجازه مهاجم برای تزریق هدر قام دلخواه در درخواست. این موضوع توسط [نیکیتا تیکومیرو](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع بی فایده `AST` بررسی در شاخص مجموعه. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- تجزیه ثابت از `AggregateFunction` ارزش های جاسازی شده در پرس و جو. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([ژیچنگ یو](https://github.com/yuzhichang)) +- رفتار اشتباه ثابت `trim` توابع خانواده. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### ClickHouse انتشار 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} + +#### رفع اشکال {#bug-fix-11} + +- این نسخه همچنین شامل تمام اشکال امنیتی رفع از 19.11.9.52 و 19.11.10.54. +- مسابقه داده ثابت در `system.parts` جدول و `ALTER` پرس و جو. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- هدر عدم تطابق ثابت در جریان در صورت خواندن از جدول توزیع خالی با نمونه و قبل از وقوع اتفاق افتاد. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang کیان](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- تصادف ثابت در هنگام استفاده از `IN` بند با یک زیر کشت با یک تاپل. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([تاولوبیکس](https://github.com/tavplubix)) +- ثابت مورد با نام ستون در `GLOBAL JOIN ON` بخش. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([زویکوف](https://github.com/4ertus2)) +- رفع تصادف در هنگام ریخته گری انواع به `Decimal` که این کار را پشتیبانی نمی کند. پرتاب استثنا به جای. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([زویکوف](https://github.com/4ertus2)) +- تصادف ثابت در `extractAll()` تابع. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([زویکوف](https://github.com/4ertus2)) +- تبدیل پرسوجو برای `MySQL`, `ODBC`, `JDBC` توابع جدول در حال حاضر به درستی کار می کند برای `SELECT WHERE` نمایش داده شد با چند `AND` عبارات. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([دیماروب2000](https://github.com/dimarub2000)) +- اضافه شده چک اعلامیه قبلی برای خروجی زیر 8 ادغام. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([مایکل دیوید تینکو](https://github.com/rafaeldtinoco)) + +#### تعمیر امنیتی {#security-fix-1} + +- رفع دو ناپایداری در کدک در فاز رفع فشار (کاربر مخرب می تواند داده های فشرده که منجر به سرریز بافر در رفع فشار ساخت). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([زویکوف](https://github.com/4ertus2)) + +### انتشار کلیک کنیدهاوس 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} + +#### رفع اشکال {#bug-fix-12} + +- ثابت `ALTER TABLE ... UPDATE` پرسو جو برای جداول با `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([الساپین](https://github.com/alesapin)) +- ثابت نانپ در هنگام استفاده در بند با یک زیرخاکری با یک تاپل. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([تاولوبیکس](https://github.com/tavplubix)) +- ثابت یک موضوع است که اگر یک ماکت کهنه زنده می شود, هنوز هم ممکن است قطعات داده که توسط پارتیشن قطره حذف شد. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([تاولوبیکس](https://github.com/tavplubix)) +- موضوع ثابت با تجزیه سی اس وی [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([تاولوبیکس](https://github.com/tavplubix)) +- مسابقه داده ثابت در سیستم.جدول قطعات و تغییر پرس و جو. این رفع [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- کد اشتباه ثابت در جهش است که ممکن است به فساد حافظه منجر شود. سگو ثابت با خواندن نشانی `0x14c0` که ممکن است به دلیل همزمان اتفاق `DROP TABLE` و `SELECT` از `system.parts` یا `system.parts_columns`. شرایط مسابقه ثابت در تهیه نمایش داده شد جهش. بن بست ثابت ناشی از `OPTIMIZE` از جداول تکرار و عملیات اصلاح همزمان مانند تغییر. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- از دست دادن داده های ممکن ثابت پس از `ALTER DELETE` پرس و جو در جدول با پرش شاخص. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([نیکیتا واسیلیف](https://github.com/nikvas0)) + +#### تعمیر امنیتی {#security-fix-2} + +- اگر مهاجم دارای دسترسی نوشتن به باغ وحش است و قادر به اجرای سفارشی سرور موجود در شبکه که در آن clickhouse اجرای آن می توانید ایجاد و سفارشی-ساخته شده در سرور های مخرب است که به عنوان clickhouse المثنی و ثبت آن در باغ وحش. هنگامی که ماکت دیگر بخش داده ها از ماکت های مخرب واکشی, می تواند فاحشه خانه و سرور را مجبور به ارسال به مسیر دلخواه در فایل سیستم. پیدا شده توسط الدار زیتوف, تیم امنیت اطلاعات در یاندکس. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} + +#### ویژگی جدید {#new-feature-5} + +- نمونه برداری پیشفیلتر در سطح پرس و جو. [مثال](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) +- اجازه برای مشخص کردن یک لیست از ستون با `COLUMNS('regexp')` بیان که مانند یک نوع پیچیده تر از کار می کند `*` ستاره دار. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([مازریدنتال](https://github.com/mfridental)), ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `CREATE TABLE AS table_function()` در حال حاضر امکان [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([دیماروب2000](https://github.com/dimarub2000)) +- بهینه ساز ادام برای نزول گرادیان تصادفی به طور پیش فرض در استفاده `stochasticLinearRegression()` و `stochasticLogisticRegression()` توابع مجموع, چرا که نشان می دهد با کیفیت خوب و بدون تقریبا هر تنظیم. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([کد37](https://github.com/Quid37)) +- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([اندی یانگ](https://github.com/andyyzh)) +- `RENAME` نمایش داده شد در حال حاضر با تمام ذخیره سازی کار می کنند. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([ایوان](https://github.com/abyss7)) +- در حال حاضر مشتری دریافت سیاهههای مربوط از سرور با هر سطح مورد نظر با تنظیم `send_logs_level` بدون در نظر گرفتن سطح ورود به سیستم مشخص شده در تنظیمات سرور. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-4} + +- تنظیمات `input_format_defaults_for_omitted_fields` به طور پیش فرض فعال است. درج در جداول توزیع شده نیاز به این تنظیم به همان در خوشه (شما نیاز به تنظیم قبل از بروز رسانی نورد). این را قادر می سازد محاسبه عبارات پیش فرض پیچیده برای زمینه های حذف شده در `JSONEachRow` و `CSV*` فرمتها. این باید رفتار مورد انتظار باشد اما ممکن است منجر به تفاوت عملکرد ناچیز. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([زویکوف](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([اکوزم](https://github.com/akuzm)) + +#### ویژگی های تجربی {#experimental-features} + +- خط لوله پردازش پرس و جو جدید. استفاده `experimental_use_processors=1` گزینه ای برای فعال کردن. برای مشکل خود استفاده کنید. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +#### رفع اشکال {#bug-fix-13} + +- ادغام کافکا در این نسخه ثابت شده است. +- ثابت `DoubleDelta` کدبندی `Int64` برای بزرگ `DoubleDelta` ارزش, بهبود یافته `DoubleDelta` رمزگذاری برای داده های تصادفی برای `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([واسیلی نمکو](https://github.com/Enmk)) +- بیش از حد ثابت از `max_rows_to_read` اگر تنظیمات `merge_tree_uniform_read_distribution` تنظیم 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### بهبود {#improvement-4} + +- می اندازد یک استثنا اگر `config.d` فایل عنصر ریشه مربوطه به عنوان فایل پیکربندی ندارد [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([دیماروب2000](https://github.com/dimarub2000)) + +#### بهبود عملکرد {#performance-improvement-3} + +- بهینهسازی `count()`. در حال حاضر با استفاده از کوچکترین ستون (در صورت امکان). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([ایموس پرنده](https://github.com/amosbird)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-5} + +- گزارش استفاده از حافظه در تست عملکرد. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([اکوزم](https://github.com/akuzm)) +- رفع ساخت با خارجی `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([ایوان](https://github.com/abyss7)) +- رفع ساخت مشترک با `rdkafka` کتابخانه [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([ایوان](https://github.com/abyss7)) + +## انتشار کلیک 19.11 {#clickhouse-release-19-11} + +### انتشار کلیک 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} + +#### رفع اشکال {#bug-fix-14} + +- تصادف نادر ثابت در `ALTER MODIFY COLUMN` و ادغام عمودی زمانی که یکی از قطعات با هم ادغام شدند/تغییر خالی است (0 ردیف). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([الساپین](https://github.com/alesapin)) +- به روز رسانی دستی `SIMDJSON`. این رفع جاری شدن سیل ممکن است از فایل های استدر با جعلی جانسون پیام های تشخیصی. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([الکساندر کازاکوف](https://github.com/Akazz)) +- اشکال ثابت با `mrk` پسوند پرونده برای جهش ([الساپین](https://github.com/alesapin)) + +### انتشار کلیک خانه 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} + +#### رفع اشکال {#bug-fix-15} + +- تجزیه عملکرد ثابت تجزیه و تحلیل شاخص بر روی کلید های پیچیده در جداول بزرگ. این رفع [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از سیگزگف نادر در حالی که ارسال داده ها در جداول با موتور توزیع شده (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([ازات خوژین](https://github.com/azat)) +- ثابت `Unknown identifier` با چند می پیوندد. این رفع [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([زویکوف](https://github.com/4ertus2)) + +### انتشار تاتر 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} + +- رفع خطا منطقی باعث حملات در هنگام انتخاب از کافکا موضوع خالی. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([ایوان](https://github.com/abyss7)) +- ثابت برای عملکرد `АrrayEnumerateUniqRanked` با بند خالی در پارامز. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([پرولر](https://github.com/proller)) + +### انتشار کلیک خانه 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} + +#### رفع اشکال {#bug-fix-16} + +- فراموش فروشگاه شیپور خاموشی برای کافکا پیام های دستی قادر به ارتکاب آنها را همه در یک بار و برای همه پارتیشن. رفع بالقوه تقلید در “one consumer - many partitions” سناریو [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([ایوان](https://github.com/abyss7)) + +### انتشار کلیک کنیدهاوس 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} + +- بهبود دست زدن به خطا در لغت نامه کش. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([ویتالی بارانو](https://github.com/vitlibar)) +- اشکال ثابت در عملکرد `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([پرولر](https://github.com/proller)) +- ثابت `JSONExtract` عملکرد در حالی که استخراج یک `Tuple` از جسون [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([ویتالی بارانو](https://github.com/vitlibar)) +- از دست دادن داده های ممکن ثابت پس از `ALTER DELETE` پرس و جو در جدول با پرش شاخص. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- تست عملکرد ثابت. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پارکت: رفع خواندن ستون بولی. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفتار اشتباه ثابت `nullIf` تابع برای استدلال ثابت. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع مشکل پیام های کافکا تقلید در راه اندازی مجدد سرور طبیعی است. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([ایوان](https://github.com/abyss7)) +- ثابت موضوع زمانی که طولانی است `ALTER UPDATE` یا `ALTER DELETE` ممکن است ادغام به طور منظم به اجرا جلوگیری می کند. جلوگیری از جهش از اجرای اگر هیچ موضوعات رایگان به اندازه کافی در دسترس وجود دارد. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([تاولوبیکس](https://github.com/tavplubix)) +- خطا ثابت با پردازش “timezone” در فایل پیکربندی سرور. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع تست کافکا. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([ایوان](https://github.com/abyss7)) + +#### تعمیر امنیتی {#security-fix-3} + +- اگر مهاجم دارای دسترسی نوشتن به باغ وحش است و قادر به اجرای سفارشی سرور موجود در شبکه که در آن clickhouse اجرا می شود, آن می تواند ایجاد سفارشی-ساخته شده در سرور های مخرب است که به عنوان clickhouse المثنی و ثبت آن در باغ وحش. هنگامی که ماکت دیگر بخش داده ها از ماکت های مخرب واکشی, می تواند فاحشه خانه و سرور را مجبور به ارسال به مسیر دلخواه در فایل سیستم. پیدا شده توسط الدار زیتوف, تیم امنیت اطلاعات در یاندکس. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک کنیدهاوس 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} + +#### رفع اشکال {#bug-fix-17} + +- ثابت `ALTER TABLE ... UPDATE` پرسو جو برای جداول با `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([الساپین](https://github.com/alesapin)) +- ثابت نانپ در هنگام استفاده در بند با یک زیرخاکری با یک تاپل. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([تاولوبیکس](https://github.com/tavplubix)) +- ثابت یک موضوع است که اگر یک ماکت کهنه زنده می شود, هنوز هم ممکن است قطعات داده که توسط پارتیشن قطره حذف شد. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([تاولوبیکس](https://github.com/tavplubix)) +- موضوع ثابت با تجزیه سی اس وی [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([تاولوبیکس](https://github.com/tavplubix)) +- مسابقه داده ثابت در سیستم.جدول قطعات و تغییر پرس و جو. این رفع [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت کد اشتباه در جهش است که ممکن است منجر به حافظه فساد است. ثابت segfault با خواندن آدرس `0x14c0` که ممکن است به دلیل همزمان اتفاق `DROP TABLE` و `SELECT` از `system.parts` یا `system.parts_columns`. شرایط مسابقه ثابت در تهیه نمایش داده شد جهش. بن بست ثابت ناشی از `OPTIMIZE` از جداول تکرار و عملیات اصلاح همزمان مانند تغییر. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک کنیدهاوس 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} + +#### رفع اشکال {#bug-fix-18} + +- ادغام کافکا در این نسخه ثابت شده است. +- در هنگام استفاده از سگو را رفع کنید `arrayReduce` برای استدلال ثابت. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `toFloat()` یکنواختی. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([دیماروب2000](https://github.com/dimarub2000)) +- اصلاح سگو با فعال `optimize_skip_unused_shards` و از دست رفته کلید شاردینگ. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([کورتیزج](https://github.com/CurtizJ)) +- منطق ثابت `arrayEnumerateUniqRanked` تابع. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حذف ورود به سیستم طولانی اضافی از کنترل خروجی زیر. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع رفتار اشتباه و حملات احتمالی در `topK` و `topKWeighted` توابع جمع. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([کورتیزج](https://github.com/CurtizJ)) +- ستون های مجازی را در معرض قرار ندهید `system.columns` جدول این برای سازگاری عقب مورد نیاز است. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال با تخصیص حافظه برای رشته در فرهنگ لغت کش کلید پیچیده است. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([الساپین](https://github.com/alesapin)) +- رفع اشکال با فعال کردن دانه دانه تطبیقی در هنگام ایجاد ماکت جدید برای `Replicated*MergeTree` جدول [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([الساپین](https://github.com/alesapin)) +- رفع حلقه بی نهایت در هنگام خواندن پیام کافکا. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([پایان 7](https://github.com/abyss7)) +- ثابت امکان پرس و جو ساخته به علت سقوط سرور به دلیل سرریز پشته در گذاشتن مربع و امکان سرریز پشته در `Merge` و `Distributed` جداول [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطا را پشتیبانی می کند گوریل ثابت در توالی های کوچک. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([انمک](https://github.com/Enmk)) + +#### بهبود {#improvement-5} + +- اجازه دادن به کاربر برای لغو `poll_interval` و `idle_connection_timeout` تنظیمات در اتصال. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} + +#### رفع اشکال {#bug-fix-19} + +- ثابت امکان معلق نمایش داده شد زمانی که سرور غیرمنتظره است. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در مورد نیاز: این رفع [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اشکال ثابت در تبدیل `LowCardinality` انواع در `AggregateFunctionFactory`. این رفع [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع تجزیه از `bool` تنظیمات از `true` و `false` رشته ها در فایل های پیکربندی. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([الساپین](https://github.com/alesapin)) +- رفع اشکال نادر با هدر جریان ناسازگار در نمایش داده شد به `Distributed` جدول بیش از `MergeTree` جدول زمانی که بخشی از `WHERE` حرکت به `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([الساپین](https://github.com/alesapin)) +- سرریز ثابت در تقسیم عدد صحیح از نوع امضا شده به نوع بدون علامت. این رفع [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-5} + +- `Kafka` هنوز شکسته. + +### انتشار کلیک خانه 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} + +#### رفع اشکال {#bug-fix-20} + +- رفع اشکال با نوشتن شاخص ثانویه نشانه با دانه دانه تطبیقی. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([الساپین](https://github.com/alesapin)) +- ثابت `WITH ROLLUP` و `WITH CUBE` اصلاح کننده های `GROUP BY` با تجمع دو سطح. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([انتون پوپوف](https://github.com/CurtizJ)) +- ثابت قطع در `JSONExtractRaw` تابع. ثابت [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع segfault در externalloader::reloadoutdated(). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([ویتالی بارانو](https://github.com/vitlibar)) +- ثابت مورد زمانی که سرور ممکن است گوش دادن سوکت اما خاموش نمی بستن و ادامه خدمت نمایش داده شد باقی مانده است. شما ممکن است در نهایت با دو در حال اجرا فرایندهای فاحشه خانه و سرور. گاهی, سرور ممکن است یک خطا بازگشت `bad_function_call` برای نمایش داده شد باقی مانده است. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شرایط بی فایده و نادرست ثابت در زمینه به روز رسانی برای بارگذاری اولیه از لغت نامه های خارجی از طریق ال بی سی, خروجی زیر, کلیک و قام. این رفع [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- استثنا بی ربط ثابت در بازیگران `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع نتیجه غیر قطعی از “uniq” تابع مجموع در موارد شدید نادر. اشکال در حال حاضر در تمام نسخه های تاتر بود. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- Segfault هنگامی که ما مجموعه ای کمی بیش از حد بالا CIDR در تابع `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- ثابت نشت حافظه کوچک زمانی که سرور پرتاب استثنا بسیاری از بسیاری از زمینه های مختلف. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع وضعیت زمانی که مصرف کننده قبل از اشتراک متوقف شد و پس از سر گرفت. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([ایوان](https://github.com/abyss7)) توجه داشته باشید که کافکا در این نسخه شکسته. +- پاک کردن بافر داده کافکا از عملیات خواندن قبلی که با یک خطا تکمیل شد [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([نیکولای](https://github.com/bopohaa)) توجه داشته باشید که کافکا در این نسخه شکسته. +- از `StorageMergeTree::background_task_handle` مقدار دهی اولیه در `startup()` این `MergeTreeBlockOutputStream::write()` ممکن است سعی کنید قبل از مقدار دهی اولیه استفاده کنید. فقط بررسی کنید اگر مقداردهی اولیه شده است. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([ایوان](https://github.com/abyss7)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-6} + +- اضافه شده رسمی `rpm` بسته. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([پرولر](https://github.com/proller)) ([الساپین](https://github.com/alesapin)) +- اضافه کردن توانایی ساخت `.rpm` و `.tgz` بسته با `packager` خط نوشتن. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([الساپین](https://github.com/alesapin)) +- رفع برای “Arcadia” ساخت سیستم. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([پرولر](https://github.com/proller)) + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-6} + +- `Kafka` در این نسخه شکسته. + +### انتشار کلیک خانه 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} + +#### ویژگی جدید {#new-feature-6} + +- اضافه شدن پشتیبانی از اظهارات تهیه شده است. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([الکساندر](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `DoubleDelta` و `Gorilla` کدکهای ستون [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([واسیلی نمکو](https://github.com/Enmk)) +- اضافه شده `os_thread_priority` تنظیم که اجازه می دهد تا برای کنترل “nice” ارزش موضوعات پردازش پرس و جو است که توسط سیستم عامل مورد استفاده برای تنظیم اولویت برنامه ریزی پویا. این نیاز دارد `CAP_SYS_NICE` قابلیت به کار. این پیاده سازی [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پیاده سازی `_topic`, `_offset`, `_key` ستون برای موتور کافکا [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([ایوان](https://github.com/abyss7)) توجه داشته باشید که کافکا در این نسخه شکسته. +- اضافه کردن ترکیب تابع جمع `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([هکز](https://github.com/hczhcz)) +- توابع مجموع `groupArrayMovingSum(win_size)(x)` و `groupArrayMovingAvg(win_size)(x)` که محاسبه حرکت مجموع / میانگین با یا بدون محدودیت اندازه پنجره. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([اختراع2004](https://github.com/inv2004)) +- افزودن سینونیم `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([هکز](https://github.com/hczhcz)) +- Intergate H3 تابع `geoToH3` از بارگذاری. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen ایوان](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### رفع اشکال {#bug-fix-21} + +- پیاده سازی کش دی ان اس با به روز رسانی ناهمزمان. موضوع جداگانه برطرف تمام میزبان و به روز رسانی دی ان اس کش با دوره (تنظیم `dns_cache_update_period`). این باید زمانی کمک کند که میزبان اغلب تغییر کند. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع segfault در `Delta` کدک که ستون با مقادیر کمتر از 32 بیت اندازه تاثیر می گذارد. اشکال منجر به فساد حافظه تصادفی. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([الساپین](https://github.com/alesapin)) +- رفع اشکال در ادغام ستون های غیر فیزیکی در بلوک. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع اشکال نادر در چک کردن بخشی با `LowCardinality` ستون. قبلا `checkDataPart` همیشه برای بخشی با شکست مواجه `LowCardinality` ستون. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([الساپین](https://github.com/alesapin)) +- اجتناب از اتصالات معلق زمانی که سرور استخر موضوع کامل است. این برای اتصال از مهم است `remote` تابع جدول و یا اتصال به یک سفال بدون کپی زمانی که فاصله اتصال طولانی وجود دارد. این رفع [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پشتیبانی از استدلال های ثابت به `evalMLModel` تابع. این رفع [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت موضوع زمانی که تاتر تعیین منطقه زمانی به طور پیش فرض به عنوان `UCT` به جای `UTC`. این رفع [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- زیر جریان بافر ثابت در `visitParamExtractRaw`. این رفع [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر توزیع شده است `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` نمایش داده شد خواهد شد به طور مستقیم در ماکت رهبر اجرا شده است. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([الساپین](https://github.com/alesapin)) +- ثابت `coalesce` برای `ColumnConst` با `ColumnNullable` + تغییرات مرتبط . [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([زویکوف](https://github.com/4ertus2)) +- رفع `ReadBufferFromKafkaConsumer` به طوری که آن را نگه می دارد و خواندن پیام های جدید پس از `commit()` حتی اگر قبلا متوقف شده بود [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([ایوان](https://github.com/abyss7)) +- ثابت `FULL` و `RIGHT` پیوستن به نتایج در هنگام پیوستن به `Nullable` کلید در جدول سمت راست. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([زویکوف](https://github.com/4ertus2)) +- رفع احتمالی خواب بی نهایت نمایش داده شد اولویت پایین. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع شرایط مسابقه, که باعث می شود که برخی از نمایش داده شد ممکن است در کواریلاگ پس از به نظر می رسد `SYSTEM FLUSH LOGS` پرس و جو. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([انتون پوپوف](https://github.com/CurtizJ)) +- ثابت `heap-use-after-free` اسان هشدار در خوشه بندی ناشی از سازمان دیده بان که سعی کنید به استفاده از شی کپی در حال حاضر حذف شده است. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اشتباه ثابت `StringRef` گر بازگشت توسط برخی از پیاده سازی `IColumn::deserializeAndInsertFromArena`. این اشکال تحت تاثیر قرار تنها واحد تست. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- جلوگیری از منبع و مجموعه ای متوسط پیوستن به ستون از پوشش ستون همان نام. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([زویکوف](https://github.com/4ertus2)) +- رفع درج و پرس و جو را انتخاب کنید به خروجی زیر موتور با خروجی زیر شناسه سبک به نقل از. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([زمستان ژانگ](https://github.com/zhang2014)) +- حالا `CHECK TABLE` پرس و جو می تواند با خانواده موتور ادغام کار می کنند. این گرداند بررسی وضعیت و پیام اگر هر برای هر بخش (و یا فایل در مورد موتورهای ساده تر). همچنین, رفع اشکال در واکشی از یک بخش شکسته. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([الساپین](https://github.com/alesapin)) +- رفع split\_shared\_libraries در زمان اجرا [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([نام و نام خانوادگی](https://github.com/danlark1)) +- مقدار دهی اولیه منطقه زمانی ثابت زمانی که `/etc/localtime` پیوند نمادی نسبی مانند است `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- clickhouse-کپی: ثابت استفاده رایگان در خاموش کردن [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([پرولر](https://github.com/proller)) +- به روز شده `simdjson`. ثابت موضوع است که برخی از پارسونز نامعتبر با صفر بایت موفقیت تجزیه. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع خاموش کردن systemlogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع زمانی که وضعیت در باطل کردن\_قرقمی بستگی به یک فرهنگ لغت. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([ویتالی بارانو](https://github.com/vitlibar)) + +#### بهبود {#improvement-6} + +- اجازه دادن به نشانیهای غیر قابل حل در پیکربندی خوشه. در دسترس نیستند و سعی می کنند در هر تلاش اتصال حل شوند. این امر به ویژه برای کوبرنتیس مفید. این رفع [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بستن اتصالات تی پی بیکار (با فاصله یک ساعت به طور پیش فرض). این امر به ویژه برای خوشه های بزرگ با جداول توزیع متعدد بر روی هر سرور مهم, چرا که هر سرور احتمالا می تواند نگه داشتن یک استخر اتصال به هر سرور دیگر, و پس از همزمانی پرس و جو اوج, اتصالات متوقف خواهد شد. این رفع [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- کیفیت بهتر `topK` تابع. تغییر رفتار فضا مجموعه به حذف عنصر گذشته اگر عنصر جدید یک وزن بزرگتر. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- توابع نشانی وب برای کار با دامنه هم اکنون می توانید برای نشانیهای اینترنتی ناقص بدون طرح کار می کنند [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([الساپین](https://github.com/alesapin)) +- چک سام به اضافه `system.parts_columns` جدول [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- اضافه شده `Enum` نوع داده به عنوان یک سینونیم برای `Enum8` یا `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([دیماروب2000](https://github.com/dimarub2000)) +- بیت کامل انتقال نوع برای `T64` وابسته به کدک. می تواند منجر به فشرده سازی بهتر با `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([زویکوف](https://github.com/4ertus2)) +- شرط در `startsWith` تابع هم اکنون می توانید کلید اصلی استفاده می کند. این رفع [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) و [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([دیماروب2000](https://github.com/dimarub2000)) +- مجاز به استفاده `clickhouse-copier` با توپولوژی خوشه متقابل تکرار با اجازه نام پایگاه داده خالی. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([نوارتولومی](https://github.com/nvartolomei)) +- استفاده `UTC` به عنوان منطقه زمانی پیش فرض بر روی یک سیستم بدون `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` چاپ شد و سرور و یا مشتری حاضر به شروع. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بازگشت پشتیبانی از استدلال نقطه شناور در تابع `quantileTiming` برای سازگاری به عقب. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نشان می دهد که جدول از دست رفته است ستون در پیام های خطا. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([ایوان](https://github.com/abyss7)) +- حذف پرسوجوی اجرا با همان کویری\_ید توسط کاربران مختلف [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([پرولر](https://github.com/proller)) +- کد قوی تر برای ارسال معیارهای گرافیت. این حتی در طول چند طولانی کار خواهد کرد `RENAME TABLE` عمل [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بیشتر پیام های خطا اطلاع رسانی نمایش داده خواهد شد که سه گانه می توانید یک کار برای اجرای برنامه نیست. این رفع [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- معکوس نگرامش به بصری تر [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([نام و نام خانوادگی](https://github.com/danlark1)) +- در حال بارگذاری [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([اکونیک 90](https://github.com/akonyaev90)) +- به روز رسانی مقدار پیش فرض `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([قاسم کونوالوف](https://github.com/izebit)) +- اضافه شدن یک مفهوم از تنظیمات منسوخ باشد. تنظیم منسوخ `allow_experimental_low_cardinality_type` می توان بدون اثر استفاده کرد. [0ف15ج016802ف7سی141494سی12846ب898944](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [الکسی میلویدو](https://github.com/alexey-milovidov) + +#### بهبود عملکرد {#performance-improvement-4} + +- افزایش تعداد جریان از جدول ادغام برای توزیع یکنواخت تر از موضوعات را انتخاب کنید. اضافه شدن تنظیمات `max_streams_multiplier_for_merge_tables`. این رفع [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-7} + +- اضافه کردن یک تست سازگاری رو به عقب برای تعامل مشتری و سرور با نسخه های مختلف از تاتر. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([الساپین](https://github.com/alesapin)) +- تست اطلاعات پوشش در هر مرتکب و جلو و درخواست. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([الساپین](https://github.com/alesapin)) +- همکاری با نشانی ضد عفونی کننده برای حمایت از تخصیص سفارشی ما (`Arena` و `ArenaWithFreeLists`) برای اشکال زدایی بهتر از “use-after-free” خطاها. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([اکوزم](https://github.com/akuzm)) +- سودهی به [اجرای رایگان](https://github.com/llvm-mirror/libunwind) برای ج++ دست زدن به استثنا و برای ردیابی پشته چاپ [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([نیکیتا لکوف](https://github.com/laplab)) +- اضافه کردن دو هشدار بیشتر از-ابزار [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجازه می دهد برای ساخت تاتر با ضد عفونی کننده حافظه. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت ubsan گزارش مورد `bitTest` تابع در تست ریش شدن. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- کارگر بارانداز: اضافه شدن امکان به داخل یک نمونه کلیک که نیاز به احراز هویت. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([هشدار داده می شود](https://github.com/shurshun)) +- به روز رسانی کتابدار به نسخه 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([ایوان](https://github.com/abyss7)) +- اضافه کردن ایست جهانی برای تست ادغام و غیر فعال کردن برخی از در کد تست. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([الساپین](https://github.com/alesapin)) +- رفع برخی از شکست های سه گانه. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([اکوزم](https://github.com/akuzm)) +- این `--no-undefined` گزینه نیروهای لینکر برای بررسی تمام نام های خارجی برای وجود در حالی که ارتباط. این بسیار مفید برای ردیابی وابستگی واقعی بین کتابخانه ها در حالت ساخت تقسیم شده است. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([ایوان](https://github.com/abyss7)) +- تست عملکرد اضافه شده برای [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- سازگاری ثابت با شورای همکاری خلیج فارس-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن پشتیبانی برای شورای همکاری خلیج فارس-9. این رفع [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطا ثابت زمانی که لیبناد را می توان به اشتباه مرتبط کرد. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت چند هشدار پیدا شده توسط پوس استودیو. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن پشتیبانی اولیه برای `clang-tidy` تجزیه و تحلیل استاتیک. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تبدیل ماکرو اس دی/لینوکس اندی( ‘be64toh’ و ‘htobe64’) به معادل سیستم عامل مک ایکس [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([فو چن](https://github.com/fredchenbj)) +- بهبود ادغام تست راهنمای. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع ساخت در مکینتاش [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([فیلیمونف](https://github.com/filimonov)) +- رفع سخت به نقطه تایپی: سنگدانه -\> مصالح. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([اکوزم](https://github.com/akuzm)) +- رفع ساخت بورس [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([پرولر](https://github.com/proller)) +- اضافه کردن لینک به کانال یوتیوب تجربی به وب سایت [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([ایوان بلینکو](https://github.com/blinkov)) +- چوب کوره: اضافه کردن گزینه برای پرچم پوشش: با برقی [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([پرولر](https://github.com/proller)) +- رفع اندازه اولیه برخی از درون خطی پودرای است. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([اکوزم](https://github.com/akuzm)) +- فاحشه خانه-سرور.پستینست: رفع تشخیص سیستم عامل برای لینوکس 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([پرولر](https://github.com/proller)) +- نسل بسته بندی قوس لینوکس اضافه شده است. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- تقسیم مشترک / پیکربندی.هشدار داده می شود) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([پرولر](https://github.com/proller)) +- رفع برای “Arcadia” ساخت پلت فرم [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([پرولر](https://github.com/proller)) +- رفع برای غیر متعارف ساخت (gcc9 هیچ submodules) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([پرولر](https://github.com/proller)) +- نیاز به نوع صریح و روشن در فروشگاه بدون خط زیرا ثابت شده بود که مستعد ابتلا به اشکال [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([اکوزم](https://github.com/akuzm)) +- رفع مکینتاش ساخت [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([فیلیمونف](https://github.com/filimonov)) +- تست عملکرد مربوط به ویژگی دستگاه گوارش جدید با مجموعه داده های بزرگتر, همانطور که در اینجا درخواست [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- تست های نفرت انگیز را در تست استرس اجرا کنید [12693568722ف11 است19859742ف56428455501فرد2ا](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([الساپین](https://github.com/alesapin)) + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-7} + +- `Kafka` در این نسخه شکسته. +- فعالسازی `adaptive_index_granularity` = 10 مگابایت به طور پیش فرض برای جدید `MergeTree` میز اگر شما ایجاد شده جدید MergeTree جداول در نسخه 19.11+, دانگرید به نسخه های قبل 19.6 غیر ممکن خواهد بود. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([الساپین](https://github.com/alesapin)) +- حذف منسوخ لغت نامه تعبیه شده مستند نشده است که توسط یاندکس مورد استفاده قرار گرفت.متریکا توابع `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` دیگر در دسترس نیست. اگر شما با استفاده از این توابع, ارسال ایمیل به clickhouse-feedback@yandex-team.com. توجه: در حال حاضر ما تصمیم به نگه داشتن این توابع در حالی که برای. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +## انتشار کلیک 19.10 {#clickhouse-release-19-10} + +### انتشار کلیک خانه 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} + +#### ویژگی جدید {#new-feature-7} + +- اضافه کردن کدک ستون جدید: `T64`. ساخته شده به صورت (U)IntX/EnumX/Data(زمان)/DecimalX ستون. این باید برای ستون ها با مقادیر محدوده ثابت یا کوچک مناسب باشد. کدک خود را اجازه می دهد تا بزرگ و یا کوچک نوع داده بدون فشرده سازی مجدد. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([زویکوف](https://github.com/4ertus2)) +- افزودن موتور دادگان `MySQL` که اجازه می دهد برای مشاهده تمام جداول در سرور خروجی از راه دور [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([زمستان ژانگ](https://github.com/zhang2014)) +- `bitmapContains` اجرا کردن. این 2 برابر سریعتر از `bitmapHasAny` اگر بیت مپ دوم شامل یک عنصر. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([ژیچنگ یو](https://github.com/yuzhichang)) +- پشتیبانی از `crc32` تابع (با رفتار دقیقا همانطور که در خروجی زیر و یا پی اچ پی). اگر شما نیاز به یک تابع هش استفاده نکنید. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen ایوان](https://github.com/BHYCHIK)) +- پیادهسازی شده `SYSTEM START/STOP DISTRIBUTED SENDS` نمایش داده شد برای کنترل درج ناهمزمان به `Distributed` میز [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([زمستان ژانگ](https://github.com/zhang2014)) + +#### رفع اشکال {#bug-fix-22} + +- نادیده گرفتن محدودیت اجرای پرس و جو و حداکثر اندازه قطعات برای محدودیت ادغام در حالی که اجرای جهش. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع اشکال که ممکن است به تقسیم بلوک های طبیعی (بسیار نادر) و درج بلوک های تکراری (در اغلب موارد) منجر شود. [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([الساپین](https://github.com/alesapin)) +- رفع عملکرد `arrayEnumerateUniqRanked` برای نشانوندها با عرضهای خالی [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([پرولر](https://github.com/proller)) +- هنوز به موضوعات کافکا بدون قصد نظرسنجی هر پیام مشترک نیست. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([ایوان](https://github.com/abyss7)) +- ایجاد تنظیمات `join_use_nulls` هیچ تاثیری برای انواع است که نمی تواند در داخل قابل ابطال است [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- ثابت `Incorrect size of index granularity` خطاها [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([کوراستر](https://github.com/coraxster)) +- ثابت شناور به دهدهی تبدیل سرریز [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([کوراستر](https://github.com/coraxster)) +- بافر خیط و پیت کردن زمانی که `WriteBufferFromHDFS`مخرب نامیده می شود. این رفع نوشتن به `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong پنگ](https://github.com/eejoin)) + +#### بهبود {#improvement-7} + +- درمان سلول های خالی در `CSV` به عنوان مقادیر پیش فرض هنگام تنظیم `input_format_defaults_for_omitted_fields` فعال است. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([اکوزم](https://github.com/akuzm)) +- عدم مسدود کردن بارگذاری لغت نامه های خارجی. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([ویتالی بارانو](https://github.com/vitlibar)) +- وقفه شبکه را می توان به صورت پویا برای اتصالات در حال حاضر تاسیس با توجه به تنظیمات تغییر کرده است. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([کنستانتین پودشوموک](https://github.com/podshumok)) +- با استفاده از “public\_suffix\_list” برای توابع `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. این با استفاده از یک جدول هش کامل تولید شده توسط `gperf` با یک لیست تولید شده از فایل: https://publicsuffix.org/list/public\_suffix\_list.dat. (مثلا, در حال حاضر ما دامنه را تشخیص `ac.uk` به عنوان غیر قابل توجهی). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- به تصویب رسید `IPv6` نوع داده در جداول سیستم. `system.processes` و `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- با استفاده از جلسات برای ارتباط با پروتکل سازگاری خروجی زیر. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([یوری بارانوف](https://github.com/yurriy)) +- پشتیبانی بیشتر `ALTER` نمایش داده شد `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- پشتیبانی `` بخش در `clickhouse-local` فایل پیکربندی. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([پرولر](https://github.com/proller)) +- اجازه اجرای پرس و جو با `remote` تابع جدول در `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([پرولر](https://github.com/proller)) + +#### بهبود عملکرد {#performance-improvement-5} + +- اضافه کردن امکان ارسال علامت نهایی در پایان ستون ادغام. این اجازه می دهد برای جلوگیری از بی فایده می خواند برای کلید های که خارج از محدوده داده های جدول می باشد. این فعال است تنها اگر دانه دانه دانه تطبیقی در حال استفاده است. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([الساپین](https://github.com/alesapin)) +- بهبود عملکرد جداول ادغام در فایل سیستم بسیار کند با کاهش تعداد `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تخریب عملکرد ثابت در خواندن از جداول ادغام که در نسخه معرفی شد 19.6. رفع \# 5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-8} + +- پیادهسازی شده `TestKeeper` به عنوان یک پیاده سازی از رابط باغ وحش مورد استفاده برای تست [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([الکسی میلویدو](https://github.com/alexey-milovidov)) ([لوشکین الکسیر](https://github.com/alexey-milovidov)) +- از حالا به بعد `.sql` تست ها را می توان به صورت موازی با پایگاه داده تصادفی جدا شده توسط سرور اجرا کرد. این اجازه می دهد تا سریعتر اجرا شود و تست های جدید را با تنظیمات سرور سفارشی اضافه کنید و اطمینان حاصل کنید که تست های مختلف بر یکدیگر تاثیر نمی گذارد. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([ایوان](https://github.com/abyss7)) +- حذف `` و `` از تست های عملکرد [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- ثابت “select\_format” تست عملکرد برای `Pretty` فرشها [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +## انتشار کلیک 19.9 {#clickhouse-release-19-9} + +### انتشار تاتر 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} + +#### رفع اشکال {#bug-fix-23} + +- اصلاح سگو در کدک دلتا که ستون ها را با مقادیر کمتر از اندازه 32 بیت تحت تاثیر قرار می دهد. اشکال منجر به فساد حافظه تصادفی. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([الساپین](https://github.com/alesapin)) +- رفع اشکال نادر در چک کردن بخشی با ستون کم هزینه. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([الساپین](https://github.com/alesapin)) +- رفع اشکال در ادغام ستون های غیر فیزیکی در بلوک. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع خواب بی نهایت بالقوه نمایش داده شد با اولویت پایین. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت کنید که چگونه کلیک هاوس منطقه زمانی پیش فرض را به عنوان کمپانی یوسیت تعیین می کند. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال در مورد اجرای توزیع قطره/تغییر/کوتاه / بهینه سازی در نمایش داده شد خوشه در ماکت پیرو قبل از ماکت رهبر. در حال حاضر به طور مستقیم بر روی ماکت رهبر اجرا خواهد شد. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([الساپین](https://github.com/alesapin)) +- رفع شرایط مسابقه, که باعث می شود که برخی از نمایش داده شد ممکن است در انبار کردن بلافاصله پس از سیستم پرس و جو سیاهههای مربوط خیط و پیت کردن ظاهر نمی شود. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([انتون پوپوف](https://github.com/CurtizJ)) +- اضافه شدن پشتیبانی از دست رفته برای استدلال ثابت به `evalMLModel` تابع. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} + +#### ویژگی جدید {#new-feature-8} + +- اطلاعات چاپ در مورد قطعات یخ زده در `system.parts` جدول [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([پرولر](https://github.com/proller)) +- درخواست رمز عبور مشتری در کلیک-مشتری شروع در تیتی اگر در استدلال تنظیم نشده است [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([پرولر](https://github.com/proller)) +- پیاده سازی `dictGet` و `dictGetOrDefault` توابع برای انواع اعشاری. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([زویکوف](https://github.com/4ertus2)) + +#### بهبود {#improvement-8} + +- دبیان اینیت: اضافه کردن سرویس ایست ایست [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([پرولر](https://github.com/proller)) +- اضافه کردن تنظیم ممنوع به طور پیش فرض برای ایجاد جدول با انواع مشکوک برای کم کاری [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- توابع رگرسیون وزن مدل بازگشت زمانی که به عنوان دولت در تابع استفاده نمی شود `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([کد37](https://github.com/Quid37)) +- تغییر نام و بهبود روش رگرسیون. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([کد37](https://github.com/Quid37)) +- رابط های واضح تر از جستجوگران رشته. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([نام و نام خانوادگی](https://github.com/danlark1)) + +#### رفع اشکال {#bug-fix-24} + +- رفع از دست دادن داده های بالقوه در کافکا [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([ایوان](https://github.com/abyss7)) +- رفع حلقه بی نهایت بالقوه در `PrettySpace` فرمت زمانی که با صفر ستون نامیده می شود [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- اشکال سرریز ثابت در مدل های خطی. اجازه مدل میلی لیتر اومال برای استدلال مدل غیر توایع. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- `ALTER TABLE ... DROP INDEX IF EXISTS ...` اگر شاخص موجود وجود ندارد باید یک استثنا را افزایش نمی دهد [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([گلب novikov](https://github.com/NanoBjorn)) +- رفع segfault با `bitmapHasAny` در زیر مقیاس [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([ژیچنگ یو](https://github.com/yuzhichang)) +- خطا ثابت زمانی که استخر اتصال تکرار کند سعی مجدد نیست برای حل و فصل میزبان, حتی زمانی که کش دی ان اس کاهش یافته بود. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([الساپین](https://github.com/alesapin)) +- ثابت `ALTER ... MODIFY TTL` در تکرار غذای اصلی. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع درج در جدول توزیع شده با ستون محقق شده [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([ازات خوژین](https://github.com/azat)) +- رفع تخصیص بد زمانی که کوتاه پیوستن به ذخیره سازی [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([تسیسون](https://github.com/TCeason)) +- در نسخه های اخیر از بسته tzdata برخی از فایل ها symlinks در حال حاضر. مکانیسم فعلی برای تشخیص منطقه زمانی پیش فرض شکسته می شود و نام اشتباه برای برخی از جغرافیایی می دهد. در حال حاضر حداقل ما نام منطقه زمانی را مجبور به محتویات انجمن تاز در صورت فراهم. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([ایوان](https://github.com/abyss7)) +- رفع برخی از موارد بسیار نادر با جستجوگر چندگانه هنگامی که سوزن ثابت در مجموع حداقل 16 کیلوبایت طولانی است. الگوریتم از دست رفته و یا بیش از حد نتایج قبلی که می تواند به نتیجه نادرست منجر شود `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([نام و نام خانوادگی](https://github.com/danlark1)) +- رفع مشکل زمانی که تنظیمات برای externaldata درخواست نمی تواند با استفاده از clickhouse تنظیمات. همچنین در حال حاضر تنظیمات `date_time_input_format` و `low_cardinality_allow_in_native_format` می تواند به دلیل ابهام از نام استفاده نمی شود (در داده های خارجی را می توان به عنوان فرمت جدول تفسیر و در پرس و جو می تواند یک محیط). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([نام و نام خانوادگی](https://github.com/danlark1)) +- رفع اشکال زمانی که قطعات تنها از فدراسیون فوتبال بدون رها کردن از باغ وحش حذف شد. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([الساپین](https://github.com/alesapin)) +- حذف ورود اشکال زدایی از پروتکل خروجی زیر [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رد کردن زنود در طول پردازش پرس و جو دی ال [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([ازات خوژین](https://github.com/azat)) +- ثابت مخلوط `UNION ALL` نوع ستون نتیجه. موارد با داده های متناقض و انواع ستون ستون نتیجه وجود دارد. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([زویکوف](https://github.com/4ertus2)) +- پرتاب یک استثنا در اعداد صحیح اشتباه در `dictGetT` توابع به جای تصادف. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([زویکوف](https://github.com/4ertus2)) +- رفع اشتباه element\_count و load\_factor برای درهم لغت در `system.dictionaries` جدول [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([ازات خوژین](https://github.com/azat)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-9} + +- ساخت ثابت بدون `Brotli` پردازشگر پشتیبانی شده: (`ENABLE_BROTLI=OFF` هشدار داده می شود [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([انت یوژنینو](https://github.com/citrin)) +- شامل خروش.ساعت به عنوان خروش / خروشان.ه [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([اوروج دش](https://github.com/orivej)) +- رفع gcc9 هشدار در hyperscan (\#خط بخشنامه بد است!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([نام و نام خانوادگی](https://github.com/danlark1)) +- رفع تمام هشدارهای هنگام کامپایل با شورای همکاری خلیج فارس-9. رفع برخی از مشکلات احتمالی. یخ گرم9 رو درست کن و به باگزیلا بفرست [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([نام و نام خانوادگی](https://github.com/danlark1)) +- ثابت ارتباط با [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حذف تخصص های استفاده نشده در لغت نامه [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([زویکوف](https://github.com/4ertus2)) +- تست های عملکرد بهبود برای قالب بندی و تجزیه جداول برای انواع مختلف فایل ها [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- رفع تست موازی اجرا [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([پرولر](https://github.com/proller)) +- کارگر بارانداز: تنظیمات استفاده از کلیک-تست [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([پرولر](https://github.com/proller)) +- رفع کامپایل برای بورس [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([پرولر](https://github.com/proller)) +- ارتقا افزایش به 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([پرولر](https://github.com/proller)) +- رفع ساخت clickhouse به عنوان submodule [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([پرولر](https://github.com/proller)) +- بهبود تست های عملکرد فوق العاده [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([ویتالی بارانو](https://github.com/vitlibar)) + +## انتشار کلیک 19.8 {#clickhouse-release-19-8} + +### انتشار کلیک خانه 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} + +#### ویژگی های جدید {#new-features} + +- اضافه شدن توابع برای کار با جانسون [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([هکز](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([ویتالی بارانو](https://github.com/vitlibar)) +- اضافه کردن یک تابع basename با مشابه رفتار یک تابع basename که وجود دارد در بسیاری از زبان ها (`os.path.basename` در پایتون, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- اضافه شده `LIMIT n, m BY` یا `LIMIT m OFFSET n BY` نحو به مجموعه جبران نفر برای حد بند. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([انتون پوپوف](https://github.com/CurtizJ)) +- نوع داده جدید اضافه شده است `SimpleAggregateFunction` که اجازه می دهد ستون ها را با تجمع نور در یک `AggregatingMergeTree`. این تنها می تواند با توابع ساده مانند استفاده می شود `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([بوریس گرانویو](https://github.com/bgranvea)) +- اضافه شدن پشتیبانی برای استدلال غیر ثابت در تابع `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([نام و نام خانوادگی](https://github.com/danlark1)) +- اضافه شدن توابع `skewPop`, `skewSamp`, `kurtPop` و `kurtSamp` برای محاسبه به صورت دنباله skewness نمونه skewness, kurtosis و نمونه kurtosis بود. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([هکز](https://github.com/hczhcz)) +- پشتیبانی تغییر نام عملیات برای `MaterializeView` انبار. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- اضافه شده سرور که اجازه می دهد تا اتصال به تاتر با استفاده از مشتری خروجی زیر. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([یوری بارانوف](https://github.com/yurriy)) +- افزودن `toDecimal*OrZero` و `toDecimal*OrNull` توابع. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([زویکوف](https://github.com/4ertus2)) +- پشتیبانی از انواع دهدهی در توابع: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([زویکوف](https://github.com/4ertus2)) +- اضافه شده `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([نام و نام خانوادگی](https://github.com/danlark1)) +- اضافه شده `format` تابع. قالب بندی الگوی ثابت (الگوی فرمت پایتون ساده) با رشته های ذکر شده در استدلال. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([نام و نام خانوادگی](https://github.com/danlark1)) +- اضافه شده `system.detached_parts` جدول حاوی اطلاعات در مورد قطعات جدا شده از `MergeTree` میز [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([اکوزم](https://github.com/akuzm)) +- اضافه شده `ngramSearch` تابع برای محاسبه تفاوت غیر متقارن بین سوزن و انبار کاه. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([نام و نام خانوادگی](https://github.com/danlark1)) +- اجرای روشهای یادگیری ماشین پایه (رگرسیون خطی تصادفی و رگرسیون لجستیک) با استفاده از رابط توابع کل. دارای استراتژی های مختلف برای به روز رسانی وزن مدل (نزول گرادیان ساده, روش شتاب, روش نستروف). همچنین پشتیبانی از مینی دسته از اندازه های سفارشی. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([کد37](https://github.com/Quid37)) +- اجرای `geohashEncode` و `geohashDecode` توابع. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([واسیلی نمکو](https://github.com/Enmk)) +- اضافه شدن تابع جمع `timeSeriesGroupSum`, که می تواند سری های زمانی مختلف جمع می شوند که برچسب زمان نمونه هم ترازی نیست. این برون یابی خطی بین دو برچسب زمان نمونه و سپس مجموع زمان سری با هم استفاده کنید. اضافه شدن تابع جمع `timeSeriesGroupRateSum` که محاسبه نرخ زمان سری و سپس مجموع نرخ با هم. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([یانگکوان لیو](https://github.com/LiuYangkuan)) +- اضافه شدن توابع `IPv4CIDRtoIPv4Range` و `IPv6CIDRtoIPv6Range` برای محاسبه محدوده های پایین تر و بالاتر برای یک ای پی در زیر شبکه با استفاده از یک سیدر. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- اضافه کردن یک ایکس کلیک-هدر خلاصه زمانی که ما یک پرس و جو با استفاده از قام با تنظیم را فعال کنید ارسال `send_progress_in_http_headers`. بازگشت اطلاعات معمول از ایکس کلیک-پیشرفت, با اطلاعات اضافی مانند چند سطر و بایت در پرس و جو قرار داده شد. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) + +#### بهبود {#improvements} + +- اضافه شده `max_parts_in_total` تنظیم برای خانواده ادغام جداول (به طور پیش فرض: 100 000) که مانع از مشخصات نا امن از کلید پارتیشن \#5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `clickhouse-obfuscator`: استخراج دانه برای ستون های فردی با ترکیب دانه اولیه با نام ستون, موقعیت ستون نیست. این در نظر گرفته شده برای تبدیل مجموعه داده با جداول مرتبط متعدد, به طوری که جداول پس از تحول قابل اجرا باقی خواهد ماند. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن توابع `JSONExtractRaw`, `JSONExtractKeyAndValues`. توابع تغییر نام داد `jsonExtract` به `JSONExtract`. هنگامی که چیزی را اشتباه می رود این توابع بازگشت ارزش خبرنگار, نه `NULL`. تابع اصلاح شده `JSONExtract` در حال حاضر نوع بازگشتی از پارامتر گذشته خود را دریافت می کند و نابل ها را تزریق نمی کند. اجرا مجدد به RapidJSON در مورد AVX2 دستورالعمل در دسترس نیست. کتابخانه سیمدجسون به روز شده به یک نسخه جدید. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([ویتالی بارانو](https://github.com/vitlibar)) +- حالا `if` و `multiIf` توابع به وضعیت تکیه نمی کنند `Nullable`, اما در شاخه برای سازگاری گذاشتن تکیه. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([جیان وو](https://github.com/janplus)) +- `In` گزاره در حال حاضر تولید می کند `Null` نتیجه از `Null` ورودی مانند `Equal` تابع. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([جیان وو](https://github.com/janplus)) +- بررسی محدودیت زمانی هر (flush\_interval / poll\_timeout) تعداد سطر از کافکا. این اجازه می دهد تا خواندن را از مصرف کننده کافکا بیشتر کند و محدودیت های زمانی جریان های سطح بالا را بررسی کند [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([ایوان](https://github.com/abyss7)) +- لینک rdkafka با همراه sasl. باید اجازه می دهد به استفاده از sasl گریختن احراز هویت [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([ایوان](https://github.com/abyss7)) +- Batched نسخه RowRefList برای همه می پیوندد. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([زویکوف](https://github.com/4ertus2)) +- کلیک سرور: اطلاعات بیشتر گوش پیام های خطا. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([پرولر](https://github.com/proller)) +- واژهنامهها پشتیبانی در تاتر-کپی برای توابع در `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([پرولر](https://github.com/proller)) +- افزودن تنظیمات جدید `kafka_commit_every_batch` برای تنظیم کافکا ارتکاب سیاست. + این اجازه می دهد تا به مجموعه ای متعهد حالت: پس از هر دسته ای از پیام های به کار گرفته شده است, و یا پس از کل بلوک به ذخیره سازی نوشته شده. این یک تجارت بین از دست دادن برخی از پیام ها و یا خواندن دو بار در برخی شرایط شدید است. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([ایوان](https://github.com/abyss7)) +- ساخت `windowFunnel` پشتیبانی از دیگر انواع عدد صحیح بدون علامت. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- اجازه دادن به سایه ستون مجازی `_table` در ادغام موتور. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([ایوان](https://github.com/abyss7)) +- ساخت `sequenceMatch` توابع مجموع پشتیبانی دیگر انواع عدد صحیح بدون علامت [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- پیام های خطا بهتر اگر عدم تطابق کنترلی است به احتمال زیاد توسط شکست سخت افزار ایجاد می شود. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بررسی کنید که جداول پایه نمونه برداری را پشتیبانی می کنند `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([ایوان](https://github.com/abyss7)) +- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- بهبود پروتکل سیم خروجی زیر. تغییر نام قالب به میسورقلوایر. با استفاده از raii برای تماس rsa\_free. غیر فعال کردن اس اس ال اگر زمینه نمی تواند ایجاد شود. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([یوری baranov](https://github.com/yurriy)) +- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([پرولر](https://github.com/proller)) +- تنظیمات پرس و جو احترام در درج ناهمزمان به جداول توزیع. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([تسیسون](https://github.com/TCeason)) +- توابع تغییر نام داد `leastSqr` به `simpleLinearRegression`, `LinearRegression` به `linearRegression`, `LogisticRegression` به `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +#### بهبود عملکرد {#performance-improvements} + +- Parallelize پردازش قطعات غیر تکراری MergeTree جداول در تغییر و اصلاح پرس و جو. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([ایوان کوش](https://github.com/IvanKush)) +- بهینه سازی در استخراج عبارات منظم. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([نام و نام خانوادگی](https://github.com/danlark1)) +- اضافه کردن راست پیوستن به ستون های کلیدی برای پیوستن به نتیجه اگر فقط در عضویت در بخش استفاده می شود. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([زویکوف](https://github.com/4ertus2)) +- یخ بافر کافکا پس از اولین پاسخ خالی. از چندین اختراع اجتناب می کند `ReadBuffer::next()` برای نتیجه خالی در برخی از جریان ردیف تجزیه. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([ایوان](https://github.com/abyss7)) +- `concat` بهینه سازی عملکرد برای استدلال های متعدد. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([نام و نام خانوادگی](https://github.com/danlark1)) +- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([زویکوف](https://github.com/4ertus2)) +- پیاده سازی لنز 4 ما را با یک مرجع ارتقا دهید تا فشرده سازی سریع تر داشته باشید. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([نام و نام خانوادگی](https://github.com/danlark1)) +- پردازشگر پشتیبانی شده: [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([اوگنی پراودا](https://github.com/kvinty)) + +#### رفع اشکال {#bug-fixes} + +- رفع فشار نیاز به ستون با پیوستن [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([زمستان ژانگ](https://github.com/zhang2014)) +- اشکال ثابت, زمانی که تاتر توسط سیستم اجرا, فرمان `sudo service clickhouse-server forcerestart` کار نمی کند به عنوان انتظار می رود. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([پرولر](https://github.com/proller)) +- رفع کدهای خطای اچ. تی. اچ. تی. پی در کد 9009 پورت همیشه کد 200 را حتی در خطاها برگرداند. [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([پرولر](https://github.com/proller)) +- رفع simpleaggregatefunction برای رشته بیش از max\_small\_string\_size [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([ازات خوژین](https://github.com/azat)) +- رفع خطا برای `Decimal` به `Nullable(Decimal)` تبدیل در. پشتیبانی از دیگر دهدهی به دهدهی تبدیل (از جمله مقیاس های مختلف). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([زویکوف](https://github.com/4ertus2)) +- مسدود کردن فلش ثابت در کتابخانه سیمدجسون که منجر به محاسبه اشتباه از `uniqHLL` و `uniqCombined` تابع کلی و توابع ریاضی مانند `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- دست زدن به ثابت موارد مخلوط ثابت/غیرنقدی در توابع جانسون. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([ویتالی بارانو](https://github.com/vitlibar)) +- ثابت `retention` تابع. در حال حاضر تمام شرایطی که در یک ردیف از داده ها راضی به دولت داده ها اضافه شده است. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) +- رفع نوع نتیجه برای `quantileExact` با اعشار. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([زویکوف](https://github.com/4ertus2)) + +#### مستندات {#documentation} + +- ترجمه مستندات برای `CollapsingMergeTree` به سلامتی چینیها [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) +- ترجمه برخی از اسناد و مدارک در مورد موتورهای جدول به چینی. + [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) + [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) + ([هرگز لی](https://github.com/neverlee)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements} + +- رفع برخی از گزارش ضد عفونی که نشان می دهد احتمالی استفاده پس از رایگان.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([ایوان](https://github.com/abyss7)) +- حرکت تست عملکرد از دایرکتوری جداگانه برای راحتی. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع تست عملکرد نادرست. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([الساپین](https://github.com/alesapin)) +- اضافه شدن یک ابزار برای محاسبه چک سام ناشی از کمی پایین بپرد به مشکلات اشکال زدایی سخت افزار. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اسکریپت دونده قابل استفاده تر است. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([فیلیمونف](https://github.com/filimonov)) +- اضافه کردن دستور العمل کوچک چگونه برای نوشتن تست عملکرد. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([الساپین](https://github.com/alesapin)) +- اضافه کردن قابلیت تعویض در ایجاد, پر کردن و رها کردن پرس و جو در تست عملکرد [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([اولگا خوستیکوا](https://github.com/stavrolia)) + +## انتشار کلیک 19.7 {#clickhouse-release-19-7} + +### انتشار کلیک خانه 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} + +#### رفع اشکال {#bug-fix-25} + +- رفع رگرسیون عملکرد در برخی از نمایش داده شد با پیوستن. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([زمستان ژانگ](https://github.com/zhang2014)) + +### انتشار کلیک خانه 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} + +#### ویژگی های جدید {#new-features-1} + +- اضافه شده توابع مربوط بیت مپ `bitmapHasAny` و `bitmapHasAll` مشابه به `hasAny` و `hasAll` توابع برای ارریس. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([سرگی ولدیکین](https://github.com/svladykin)) + +#### رفع اشکال {#bug-fixes-1} + +- رفع segfault در `minmax` شاخص با ارزش صفر. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- علامت گذاری به عنوان تمام ستون های ورودی در حد خروجی به عنوان مورد نیاز است. این رفع ‘Not found column’ خطا در برخی از نمایش داده شد توزیع. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([پان سنتانتین](https://github.com/kvap)) +- ثابت “Column ‘0’ already exists” خطا در `SELECT .. PREWHERE` در ستون با پیش فرض [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([پرولر](https://github.com/proller)) +- ثابت `ALTER MODIFY TTL` پرسوجو در `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([انتون پوپوف](https://github.com/CurtizJ)) +- هنگامی که مصرف کنندگان کافکا برای شروع شکست خورده اند سرور تصادف نیست. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([ایوان](https://github.com/abyss7)) +- توابع بیت مپ ثابت تولید نتیجه اشتباه است. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([اندی یانگ](https://github.com/andyyzh)) +- حذف عناصر برای دیکشنری درهم (شامل موارد تکراری نیست) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([ازات خوژین](https://github.com/azat)) +- استفاده از محتویات محیط زیست تغییر تنظیمات متغیر به عنوان نام برای منطقه زمانی. این کمک می کند تا به درستی شناسایی منطقه زمانی پیش فرض در برخی موارد.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([ایوان](https://github.com/abyss7)) +- سعی نکنید برای تبدیل اعداد صحیح در `dictGetT` توابع, چرا که به درستی کار نمی کند. پرتاب یک استثنا به جای. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([زویکوف](https://github.com/4ertus2)) +- رفع تنظیمات در درخواست خارجی. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([دنیلا + کوتنین](https://github.com/danlark1)) +- رفع اشکال زمانی که قطعات تنها از فدراسیون فوتبال بدون رها کردن از باغ وحش حذف شد. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([الساپین](https://github.com/alesapin)) +- رفع گسل تقسیم بندی در `bitmapHasAny` تابع. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([ژیچنگ یو](https://github.com/yuzhichang)) +- خطا ثابت زمانی که استخر اتصال تکرار کند سعی مجدد نیست برای حل و فصل میزبان, حتی زمانی که کش دی ان اس کاهش یافته بود. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([الساپین](https://github.com/alesapin)) +- ثابت `DROP INDEX IF EXISTS` پرس و جو. حالا `ALTER TABLE ... DROP INDEX IF EXISTS ...` پرس و جو یک استثنا را افزایش نمی دهد اگر شاخص وجود ندارد. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([گلب نویکوف](https://github.com/NanoBjorn)) +- رفع اتحادیه تمام ستون نوع فوق. موارد با داده های متناقض و انواع ستون ستون نتیجه وجود دارد. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([زویکوف](https://github.com/4ertus2)) +- جست و خیز znonode در طول دستورات پرس و جو پردازش. قبل از اگر گره دیگر حذف زنود در صف کار, یکی که + اما در حال حاضر لیستی از کودکان را دریافت نمی کند موضوع کار کرم را خاتمه می دهد. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([ازات خوژین](https://github.com/azat)) +- ثابت قرار دادن به توزیع() جدول با ستون محقق. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([ازات خوژین](https://github.com/azat)) + +### انتشار کلیک خانه 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} + +#### ویژگی های جدید {#new-features-2} + +- اجازه می دهد برای محدود کردن طیف وسیعی از یک محیط است که می تواند توسط کاربر مشخص شده است. + این محدودیت ها را می توان در مشخصات تنظیمات کاربر تنظیم شده است. + [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([ویتالی + بارانوف](https://github.com/vitlibar)) +- اضافه کردن نسخه دوم از تابع `groupUniqArray` با اختیاری + `max_size` پارامتر که اندازه مجموعه نتیجه را محدود می کند. این + رفتار شبیه به `groupArray(max_size)(x)` تابع. + [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([گیمه + کاسری](https://github.com/YiuRULE)) +- برای tsvwithnames/csvwithnames ورودی فرمت های فایل های ستون سفارش در حال حاضر می تواند + تعیین شده از هدر فایل. این است که با کنترل + `input_format_with_names_use_header` پارامتر. + [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) + ([الکساندر](https://github.com/Akazz)) + +#### رفع اشکال {#bug-fixes-2} + +- سقوط با غیر فشرده + عضویت در هنگام ادغام (\#5197) + [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([دنیلا + کوتنین](https://github.com/danlark1)) +- گسل تقسیم بندی در یک پرس و جو کلیک مشتری به جداول سیستم. \#5066 + [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) + ([ایوان](https://github.com/abyss7)) +- از دست دادن داده ها در بار سنگین از طریق کافکاینگین (\#4736) + [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) + ([ایوان](https://github.com/abyss7)) +- ثابت شرایط مسابقه داده بسیار نادر است که می تواند در هنگام اجرای یک پرس و جو با اتحادیه همه شامل حداقل دو انتخاب از سیستم اتفاق می افتد.ستون, سیستم.جداول, سیستم.قطعات, سیستم.\_شبردارها یا جداول ادغام خانواده و انجام تغییر ستون از جداول مرتبط به صورت همزمان. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### بهبود عملکرد {#performance-improvements-1} + +- استفاده از مرتب سازی بر رادیوگرافی برای مرتب سازی بر اساس ستون عددی در `ORDER BY` بدون + `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), + [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) + ([اوگنی پراودا](https://github.com/kvinty), + [الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### مستندات {#documentation-1} + +- ترجمه اسناد و مدارک برای برخی از موتورهای جدول به چینی. + [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), + [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), + [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) + ([张风啸](https://github.com/AlexZFX)), + [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([هرگز + لی](https://github.com/neverlee)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-1} + +- نسخه قابل چاپ سخن گفتن-8 کاراکتر به درستی در `clickhouse-test`. + [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) + ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن پارامتر خط فرمان برای فاحشه خانه-مشتری برای همیشه بار پیشنهاد + داده ها. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) + ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حل و فصل برخی از هشدارهای پوس استودیو. + [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) + ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز رسانی lz4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([دنیلا + کوتنین](https://github.com/danlark1)) +- اضافه کردن پردازنده گرافیکی برای ساخت الزامات مورد نیاز برای درخواست پیش رو کشیدن \# 5030. + [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) + ([پرولر](https://github.com/proller)) + +## انتشار کلیک 19.6 {#clickhouse-release-19-6} + +### انتشار کلیک خانه 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} + +#### رفع اشکال {#bug-fixes-3} + +- ثابت در شرایط فشار برای نمایش داده شد از توابع جدول `mysql` و `odbc` و موتورهای جدول مربوطه. این رفع \# 3540 و \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع بن بست در باغ وحش. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([گیتهاب 1یولک](https://github.com/github1youlc)) +- اجازه اعشار نقل در سی سی. وی. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([زویکوف](https://github.com/4ertus2) +- عدم تبدیل از اینف شناور / نان به اعشار (استثنا پرتاب). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([زویکوف](https://github.com/4ertus2)) +- رفع مسابقه داده ها در تغییر نام پرس و جو. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([زمستان ژانگ](https://github.com/zhang2014)) +- به طور موقت غیر فعال کردن کلیک. استفاده از lfalloc ممکن است منجر به بسیاری از map\_failed در تخصیص uncompressedcache و در نتیجه به سقوط از نمایش داده شد در بالا لود سرور. [لامپ کم مصرف93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([نام و نام خانوادگی](https://github.com/danlark1)) + +### انتشار کلیک خانه 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} + +#### ویژگی های جدید {#new-features-3} + +- عبارات برای ستون ها و جداول. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([انتون پوپوف](https://github.com/CurtizJ)) +- اضافه شدن پشتیبانی برای `brotli` فشردهسازی برای پاسخهای قام (پذیرش کدبندی: برزیلی) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([میخیل](https://github.com/fandyushin)) +- اضافه شدن تابع جدید `isValidUTF8` برای بررسی اینکه مجموعه ای از بایت ها به درستی کد گذاری شده باشد-8. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([نام و نام خانوادگی](https://github.com/danlark1)) +- اضافه کردن سیاست متعادل کننده بار جدید `first_or_random` که نمایش داده شد به اولین میزبان مشخص می فرستد و اگر غیر قابل دسترس ارسال نمایش داده شد به میزبان تصادفی از سفال. مفید برای تنظیم توپولوژی متقابل تکرار. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([نوارتولومی](https://github.com/nvartolomei)) + +#### ویژگی های تجربی {#experimental-features-1} + +- افزودن تنظیمات `index_granularity_bytes` (تطبیقی دانه دانه دانه شاخص) برای ادغام \* خانواده جداول. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([الساپین](https://github.com/alesapin)) + +#### بهبود {#improvements-1} + +- اضافه شدن پشتیبانی برای اندازه و طول استدلال غیر ثابت و منفی برای عملکرد `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- غیر فعال کردن فشار به پایین به جدول سمت راست در سمت چپ عضویت, جدول سمت چپ در راست عضویت, و هر دو جدول به طور کامل ملحق. این رفع اشتباه پیوستن به نتایج در برخی موارد. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([ایوان](https://github.com/abyss7)) +- `clickhouse-copier`: بارگذاری خودکار پیکربندی وظیفه از `--task-file` گزینه [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([پرولر](https://github.com/proller)) +- اضافه شده کنترل غلط املایی برای کارخانه ذخیره سازی و توابع جدول کارخانه. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([نام و نام خانوادگی](https://github.com/danlark1)) +- ستاره پشتیبانی و ستاره واجد شرایط برای چند می پیوندد بدون زیر کشت [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([زویکوف](https://github.com/4ertus2)) +- پیام خطای ستون گم شده را کاربر پسند تر کنید. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([زویکوف](https://github.com/4ertus2)) + +#### بهبود عملکرد {#performance-improvements-2} + +- افزایش سرعت قابل توجهی از عضویت [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([مرتیجن باکر](https://github.com/Gladdy)) + +#### تغییرات ناسازگار به عقب {#backward-incompatible-changes} + +- HTTP header `Query-Id` به تغییر نام داد `X-ClickHouse-Query-Id` برای ثبات. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([میخیل](https://github.com/fandyushin)) + +#### رفع اشکال {#bug-fixes-4} + +- اختلاف اشاره گر صفر پتانسیل ثابت در `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([پرولر](https://github.com/proller)) +- خطای ثابت در پرس و جو با پیوستن + مجموعه پیوستن [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([زویکوف](https://github.com/4ertus2)) +- ثابت معلق در شروع سرور زمانی که یک فرهنگ لغت بستگی به فرهنگ لغت دیگری از طریق یک پایگاه داده با موتور=فرهنگ لغت. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([ویتالی بارانو](https://github.com/vitlibar)) +- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([زویکوف](https://github.com/4ertus2)) +- رفع نتیجه به طور بالقوه اشتباه برای `SELECT DISTINCT` با `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([زویکوف](https://github.com/4ertus2)) +- ثابت شرایط مسابقه داده بسیار نادر است که می تواند در هنگام اجرای یک پرس و جو با اتحادیه همه شامل حداقل دو انتخاب از سیستم اتفاق می افتد.ستون, سیستم.جداول, سیستم.قطعات, سیستم.\_شبردارها یا جداول ادغام خانواده و انجام تغییر ستون از جداول مرتبط به صورت همزمان. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-2} + +- شکست تست ثابت زمانی که در حال اجرا خانه عروسکی سرور در میزبان های مختلف [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([واسیلی نمکو](https://github.com/Enmk)) +- تاتر-تست: غیر فعال کردن توالی کنترل رنگ در محیط غیر تیتی. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([الساپین](https://github.com/alesapin)) +- کلیک-تست: اجازه استفاده از هر پایگاه داده تست (برداشتن `test.` صلاحیت در صورت امکان) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([پرولر](https://github.com/proller)) +- رفع خطاهای اوبان [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([ویتالی بارانو](https://github.com/vitlibar)) +- Yandex LFAlloc اضافه شد به ClickHouse به تخصیص MarkCache و UncompressedCache داده ها در روش های مختلف برای گرفتن segfaults بیشتر قابل اعتماد [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([نام و نام خانوادگی](https://github.com/danlark1)) +- پایتون ییل برای کمک به با کوله پشتی و تغییرات. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([ایوان](https://github.com/abyss7)) + +## انتشار کلیک 19.5 {#clickhouse-release-19-5} + +### انتشار کلیک خانه 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} + +#### رفع اشکال {#bug-fixes-5} + +- تصادف ممکن است ثابت در بیت مپ [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([اندی یانگ](https://github.com/andyyzh)) +- ثابت شرایط مسابقه داده بسیار نادر است که می تواند در هنگام اجرای یک پرس و جو با اتحادیه همه شامل حداقل دو انتخاب از سیستم اتفاق می افتد.ستون, سیستم.جداول, سیستم.قطعات, سیستم.\_شبردارها یا جداول ادغام خانواده و انجام تغییر ستون از جداول مرتبط به صورت همزمان. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطای ثابت `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. این خطا اتفاق افتاد اگر ستون کمکاری بخشی از کلید اصلی بود. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اصلاح تابع حفظ و نگهداری: اگر یک ردیف ارضا هر دو شرط اول و بعد از ظهر, تنها اولین شرط راضی به دولت داده اضافه. در حال حاضر تمام شرایطی که در یک ردیف از داده ها راضی به دولت داده ها اضافه شده است. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) + +### انتشار کلیک خانه 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} + +#### رفع اشکال {#bug-fixes-6} + +- نوع ثابت تنظیم `max_partitions_per_insert_block` از بولی به UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([محمد حسین sekhavat](https://github.com/mhsekhavat)) + +### انتشار کلیک خانه 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} + +#### ویژگی های جدید {#new-features-4} + +- [Hyperscan](https://github.com/intel/hyperscan) تطبیق عبارت منظم چندگانه اضافه شد (توابع `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([نام و نام خانوادگی](https://github.com/danlark1)) +- `multiSearchFirstPosition` تابع اضافه شد. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([نام و نام خانوادگی](https://github.com/danlark1)) +- فیلتر بیان از پیش تعریف شده را در هر ردیف برای جداول اجرا کنید. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([ایوان](https://github.com/abyss7)) +- نوع جدیدی از شاخص های داده پرش بر اساس فیلتر بلوم (می تواند برای استفاده `equal`, `in` و `like` توابع). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- اضافه شده `ASOF JOIN` که اجازه می دهد برای اجرای نمایش داده شد که پیوستن به ارزش های اخیر شناخته شده است. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([مرتیجن باکر](https://github.com/Gladdy), [زویکوف](https://github.com/4ertus2)) +- بازنویسی چندگانه `COMMA JOIN` به `CROSS JOIN`. سپس دوباره نوشتن به `INNER JOIN` در صورت امکان. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([زویکوف](https://github.com/4ertus2)) + +#### بهبود {#improvement-9} + +- `topK` و `topKWeighted` در حال حاضر پشتیبانی سفارشی `loadFactor` (رفع مشکل [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) +- مجاز به استفاده `parallel_replicas_count > 1` حتی برای جداول بدون نمونه گیری (تنظیم به سادگی برای نادیده گرفته می شود). در نسخه های قبلی منجر به استثنا شد. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([الکسی الیمانوف](https://github.com/digitalist)) +- پشتیبانی از `CREATE OR REPLACE VIEW`. اجازه می دهد برای ایجاد یک نمایش و یا تنظیم یک تعریف جدید در یک بیانیه واحد. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([بوریس گرانویو](https://github.com/bgranvea)) +- `Buffer` موتور جدول در حال حاضر پشتیبانی می کند `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([یانگکوان لیو](https://github.com/LiuYangkuan)) +- اضافه کردن توانایی برای شروع جدول تکرار بدون ابرداده در باغ وحش در `readonly` حالت. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([الساپین](https://github.com/alesapin)) +- سوسو زدن ثابت از نوار پیشرفت در خانه کلیک مشتری. این موضوع در هنگام استفاده قابل توجه بود `FORMAT Null` با نمایش داده شد جریان. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجازه برای غیر فعال کردن توابع با `hyperscan` کتابخانه بر اساس هر کاربر برای محدود کردن استفاده از منابع بالقوه بیش از حد و کنترل نشده. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن شماره نسخه ورود به سیستم در تمام اشتباهات. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([پرولر](https://github.com/proller)) +- محدودیت اضافه شده به `multiMatch` توابع که نیاز به اندازه رشته به جا به `unsigned int`. همچنین اضافه شده تعداد استدلال محدود به `multiSearch` توابع. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([نام و نام خانوادگی](https://github.com/danlark1)) +- استفاده بهبود یافته از فضای خراش و دست زدن به خطا در هیپرسکان. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([نام و نام خانوادگی](https://github.com/danlark1)) +- پر کردن `system.graphite_detentions` از پیکربندی جدول `*GraphiteMergeTree` جداول موتور. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- تغییر نام `trigramDistance` تابع به `ngramDistance` و اضافه کردن توابع بیشتر با `CaseInsensitive` و `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([نام و نام خانوادگی](https://github.com/danlark1)) +- داده های بهبود پرش محاسبه شاخص. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- عادی نگه دارید, `DEFAULT`, `MATERIALIZED` و `ALIAS` ستون ها در یک لیست واحد (رفع مشکل [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([الکس زتلپین](https://github.com/ztlpn)) + +#### رفع اشکال {#bug-fix-26} + +- اجتناب از `std::terminate` در صورت شکست تخصیص حافظه. حالا `std::bad_alloc` استثنا پرتاب به عنوان انتظار می رود. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع کاپپروتو خواندن از بافر. گاهی اوقات فایل ها با موفقیت توسط اچ تی پی لود نمی شد. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ولادیسلاو](https://github.com/smirnov-vs)) +- رفع خطا `Unknown log entry type: 0` پس از `OPTIMIZE TABLE FINAL` پرس و جو. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([ایموس پرنده](https://github.com/amosbird)) +- نشانوندهای نادرست برای `hasAny` یا `hasAll` توابع ممکن است منجر به تقسیم بندی شوند. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بن بست ممکن است رخ دهد در حالی که اجرای `DROP DATABASE dictionary` پرس و جو. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع رفتار تعریف نشده در `median` و `quantile` توابع. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([هکز](https://github.com/hczhcz)) +- رفع تشخیص سطح فشرده سازی زمانی که `network_compression_method` با حروف کوچک. شکسته در و19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([پرولر](https://github.com/proller)) +- جهل ثابت `UTC` تنظیم (رفع مشکل [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([پرولر](https://github.com/proller)) +- ثابت `histogram` رفتار عملکرد با `Distributed` میز [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([اولگ](https://github.com/olegkv)) +- ثابت گزارش تسان `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- گزارش ساان ثابت در خاموش کردن با توجه به شرایط مسابقه در استفاده از سیستم سیاهههای مربوط. استفاده از پتانسیل ثابت-پس از رایگان در خاموش کردن زمانی که قطعه فعال است. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع قطعات بررسی مجدد در `ReplicatedMergeTreeAlterThread` در صورت خطا. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- عملیات ریاضی در کشورهای تابع جمع متوسط برای استدلال ثابت کار نمی کند (مانند نتایج زیرخاکی). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نام ستون همیشه نقل مکان کردن در ابرداده. در غیر این صورت ایجاد یک جدول با ستون به نام غیرممکن است `index` (سرور به دلیل ناقص راه اندازی مجدد نخواهد شد `ATTACH` پرس و جو در ابرداده). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع سقوط در `ALTER ... MODIFY ORDER BY` روشن `Distributed` جدول [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([تسیسون](https://github.com/TCeason)) +- رفع segfault در `JOIN ON` با فعال `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([زمستان ژانگ](https://github.com/zhang2014)) +- رفع اشکال با اضافه کردن یک ردیف غیر اصلی پس از مصرف یک پیام محافظ از کافکا. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع سقوط از `JOIN` نه-nullable در مقابل nullable ستون. ثابت `NULLs` در کلید سمت راست در `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([زویکوف](https://github.com/4ertus2)) +- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) +- شرایط مسابقه ثابت در `SELECT` از `system.tables` اگر جدول تغییر نام و یا تغییر به صورت همزمان. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- مسابقه داده ثابت زمانی که واکشی بخش داده است که در حال حاضر منسوخ شده است. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- مسابقه داده های نادر ثابت که می تواند در طول اتفاق می افتد `RENAME` جدول خانواده ادغام. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- گسل تقسیم بندی ثابت در عملکرد `arrayIntersect`. گسل تقسیم بندی می تواند رخ دهد اگر تابع با استدلال ثابت و عادی مخلوط نامیده می شد. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang کیان](https://github.com/fancyqlx)) +- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع سقوط در `FULL/RIGHT JOIN` هنگامی که ما در پیوستن به nullable در مقابل نه nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([زویکوف](https://github.com/4ertus2)) +- ثابت `No message received` استثنا در حالی که دلربا قطعات بین کپی. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([الساپین](https://github.com/alesapin)) +- ثابت `arrayIntersect` عملکرد نتیجه اشتباه در مورد چندین مقدار تکرار در مجموعه تک. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع شرایط مسابقه در طول همزمان `ALTER COLUMN` نمایش داده شد که می تواند به یک تصادف سرور منجر شود (رفع مشکل [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([الکس زتلپین](https://github.com/ztlpn)) +- رفع نتیجه نادرست در `FULL/RIGHT JOIN` با ستون توایع. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([زویکوف](https://github.com/4ertus2)) +- رفع موارد تکراری در `GLOBAL JOIN` با ستاره. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([زویکوف](https://github.com/4ertus2)) +- رفع کسر پارامتر در `ALTER MODIFY` از ستون `CODEC` هنگامی که نوع ستون مشخص نشده است. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([الساپین](https://github.com/alesapin)) +- توابع `cutQueryStringAndFragment()` و `queryStringAndFragment()` در حال حاضر به درستی کار می کند زمانی که `URL` شامل یک قطعه و بدون پرس و جو. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع اشکال نادر هنگام تنظیم `min_bytes_to_use_direct_io` بزرگتر از صفر است, که رخ می دهد زمانی که موضوع باید به دنبال عقب در فایل ستون. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([الساپین](https://github.com/alesapin)) +- رفع انواع استدلال اشتباه برای توابع مجموع با `LowCardinality` نشانوندها (رفع مشکل [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع صلاحیت نام اشتباه در `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([زویکوف](https://github.com/4ertus2)) +- تابع ثابت `toISOWeek` نتیجه برای سال 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `DROP`, `TRUNCATE` و `OPTIMIZE` نمایش داده شد تقلید, زمانی که در اجرا `ON CLUSTER` برای `ReplicatedMergeTree*` خانواده جداول. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([الساپین](https://github.com/alesapin)) + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-8} + +- تغییر نام تنظیمات `insert_sample_with_metadata` به تنظیم `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([زویکوف](https://github.com/4ertus2)) +- اضافه شدن تنظیمات `max_partitions_per_insert_block` (با مقدار 100 به طور پیش فرض). اگر بلوک قرار داده شامل تعداد بیشتری از پارتیشن, یک استثنا پرتاب می شود. تنظیم به 0 اگر شما می خواهید به حذف حد (توصیه نمی شود). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- توابع چند جستجو تغییر نام داد (`multiPosition` به `multiSearchAllPositions`, `multiSearch` به `multiSearchAny`, `firstMatch` به `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([نام و نام خانوادگی](https://github.com/danlark1)) + +#### بهبود عملکرد {#performance-improvement-6} + +- بهینه سازی volnitsky جستجوگر توسط inlining دادن حدود 5-10% بهبود جستجو برای نمایش داده شد و با بسیاری از سوزن و یا بسیاری از شبیه bigrams. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([نام و نام خانوادگی](https://github.com/danlark1)) +- رفع مشکل عملکرد در هنگام تنظیم `use_uncompressed_cache` بزرگتر از صفر است, که به نظر می رسد زمانی که همه اطلاعات به عنوان خوانده شده موجود در کش. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([الساپین](https://github.com/alesapin)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-10} + +- سخت شدن اشکال زدایی ساخت: بیشتر نگاشت حافظه دانه و اصل مطلب; اضافه کردن حفاظت از حافظه برای کش علامت و شاخص. این اجازه می دهد تا برای پیدا کردن حافظه بیشتر کوبیدن اشکالات در صورتی که زمانی که اسان و ام اسان نمی تواند این کار را انجام. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن پشتیبانی از متغیرهای کیک `ENABLE_PROTOBUF`, `ENABLE_PARQUET` و `ENABLE_BROTLI` که اجازه می دهد برای فعال/غیر فعال کردن ویژگی های فوق (همان است که ما می توانیم برای کتابدار انجام, خروجی زیر, و غیره). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([سیلو کاراژیا](https://github.com/silviucpp)) +- اضافه کردن توانایی برای چاپ لیست روند و بند از تمام موضوعات اگر برخی از نمایش داده شد پس از اجرای تست را قطع کرد. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([الساپین](https://github.com/alesapin)) +- اضافه کردن مجدد در `Connection loss` خطا در `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([الساپین](https://github.com/alesapin)) +- اضافه کردن ساخت بورس با ولگرد و ساخت با ضد عفونی کننده موضوع به اسکریپت بسته بندی. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([الساپین](https://github.com/alesapin)) +- در حال حاضر کاربر برای رمز عبور برای کاربر خواسته `'default'` در هنگام نصب. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([پرولر](https://github.com/proller)) +- سرکوب هشدار در `rdkafka` کتابخونه. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجازه توانایی ساخت بدون اس اس ال. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([پرولر](https://github.com/proller)) +- اضافه کردن یک راه برای راه اندازی تاتر-تصویر سرور از یک کاربر سفارشی. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- ارتقا تقویت میله به 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([پرولر](https://github.com/proller)) +- غیر فعال کردن استفاده از `mremap` هنگامی که با ضد عفونی کننده موضوع وارد شده است. با کمال تعجب به اندازه کافی, تسان می کند رهگیری نیست `mremap` (هر چند که رهگیری `mmap`, `munmap`) که منجر به مثبت کاذب. گزارش تسان ثابت در تست نفرت انگیز. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن چک کردن تست با استفاده از طرح فرمت از طریق رابط قام. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([ویتالی بارانو](https://github.com/vitlibar)) + +## انتشار کلیک 19.4 {#clickhouse-release-19-4} + +### انتشار کلیک خانه 19.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} + +#### رفع اشکال {#bug-fixes-7} + +- اجتناب از `std::terminate` در صورت شکست تخصیص حافظه. حالا `std::bad_alloc` استثنا پرتاب به عنوان انتظار می رود. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع کاپپروتو خواندن از بافر. گاهی اوقات فایل ها با موفقیت توسط اچ تی پی لود نمی شد. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ولادیسلاو](https://github.com/smirnov-vs)) +- رفع خطا `Unknown log entry type: 0` پس از `OPTIMIZE TABLE FINAL` پرس و جو. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([ایموس پرنده](https://github.com/amosbird)) +- نشانوندهای نادرست برای `hasAny` یا `hasAll` توابع ممکن است منجر به تقسیم بندی شوند. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بن بست ممکن است رخ دهد در حالی که اجرای `DROP DATABASE dictionary` پرس و جو. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع رفتار تعریف نشده در `median` و `quantile` توابع. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([هکز](https://github.com/hczhcz)) +- رفع تشخیص سطح فشرده سازی زمانی که `network_compression_method` با حروف کوچک. شکسته در و19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([پرولر](https://github.com/proller)) +- جهل ثابت `UTC` تنظیم (رفع مشکل [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([پرولر](https://github.com/proller)) +- ثابت `histogram` رفتار عملکرد با `Distributed` میز [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([اولگ](https://github.com/olegkv)) +- ثابت گزارش تسان `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- گزارش ساان ثابت در خاموش کردن با توجه به شرایط مسابقه در استفاده از سیستم سیاهههای مربوط. استفاده از پتانسیل ثابت-پس از رایگان در خاموش کردن زمانی که قطعه فعال است. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع قطعات بررسی مجدد در `ReplicatedMergeTreeAlterThread` در صورت خطا. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- عملیات ریاضی در کشورهای تابع جمع متوسط برای استدلال ثابت کار نمی کند (مانند نتایج زیرخاکی). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نام ستون همیشه نقل مکان کردن در ابرداده. در غیر این صورت ایجاد یک جدول با ستون به نام غیرممکن است `index` (سرور به دلیل ناقص راه اندازی مجدد نخواهد شد `ATTACH` پرس و جو در ابرداده). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع سقوط در `ALTER ... MODIFY ORDER BY` روشن `Distributed` جدول [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([تسیسون](https://github.com/TCeason)) +- رفع segfault در `JOIN ON` با فعال `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([زمستان ژانگ](https://github.com/zhang2014)) +- رفع اشکال با اضافه کردن یک ردیف غیر اصلی پس از مصرف یک پیام محافظ از کافکا. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) +- شرایط مسابقه ثابت در `SELECT` از `system.tables` اگر جدول تغییر نام و یا تغییر به صورت همزمان. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- مسابقه داده ثابت زمانی که واکشی بخش داده است که در حال حاضر منسوخ شده است. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- مسابقه داده های نادر ثابت که می تواند در طول اتفاق می افتد `RENAME` جدول خانواده ادغام. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- گسل تقسیم بندی ثابت در عملکرد `arrayIntersect`. گسل تقسیم بندی می تواند رخ دهد اگر تابع با استدلال ثابت و عادی مخلوط نامیده می شد. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang کیان](https://github.com/fancyqlx)) +- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- ثابت `No message received` استثنا در حالی که دلربا قطعات بین کپی. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([الساپین](https://github.com/alesapin)) +- ثابت `arrayIntersect` عملکرد نتیجه اشتباه در مورد چندین مقدار تکرار در مجموعه تک. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع شرایط مسابقه در طول همزمان `ALTER COLUMN` نمایش داده شد که می تواند به یک تصادف سرور منجر شود (رفع مشکل [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([الکس زتلپین](https://github.com/ztlpn)) +- رفع کسر پارامتر در `ALTER MODIFY` از ستون `CODEC` هنگامی که نوع ستون مشخص نشده است. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([الساپین](https://github.com/alesapin)) +- توابع `cutQueryStringAndFragment()` و `queryStringAndFragment()` در حال حاضر به درستی کار می کند زمانی که `URL` شامل یک قطعه و بدون پرس و جو. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع اشکال نادر هنگام تنظیم `min_bytes_to_use_direct_io` بزرگتر از صفر است, که رخ می دهد زمانی که موضوع باید به دنبال عقب در فایل ستون. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([الساپین](https://github.com/alesapin)) +- رفع انواع استدلال اشتباه برای توابع مجموع با `LowCardinality` نشانوندها (رفع مشکل [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- تابع ثابت `toISOWeek` نتیجه برای سال 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `DROP`, `TRUNCATE` و `OPTIMIZE` نمایش داده شد تقلید, زمانی که در اجرا `ON CLUSTER` برای `ReplicatedMergeTree*` خانواده جداول. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([الساپین](https://github.com/alesapin)) + +#### بهبود {#improvements-2} + +- عادی نگه دارید, `DEFAULT`, `MATERIALIZED` و `ALIAS` ستون ها در یک لیست واحد (رفع مشکل [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([الکس زتلپین](https://github.com/ztlpn)) + +### انتشار کلیک کنیدهاوس 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} + +#### رفع اشکال {#bug-fixes-8} + +- رفع سقوط در `FULL/RIGHT JOIN` هنگامی که ما در پیوستن به nullable در مقابل نه nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([زویکوف](https://github.com/4ertus2)) +- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-11} + +- اضافه کردن یک راه برای راه اندازی تاتر-تصویر سرور از یک کاربر سفارشی. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### انتشار کلیک خانه 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} + +#### رفع اشکال {#bug-fixes-9} + +- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +### انتشار کلیک خانه 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} + +#### رفع اشکال {#bug-fixes-10} + +- نمایش داده شد از راه دور ثابت که شامل هر دو `LIMIT BY` و `LIMIT`. قبلا اگر `LIMIT BY` و `LIMIT` برای پرس و جو از راه دور استفاده شد, `LIMIT` می تواند قبل از اتفاق می افتد `LIMIT BY`, که منجر به نتیجه بیش از حد فیلتر. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([پان سنتانتین](https://github.com/kvap)) + +### انتشار کلیک خانه 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} + +#### ویژگی های جدید {#new-features-5} + +- اضافه شدن پشتیبانی کامل برای `Protobuf` قالب (ورودی و خروجی, ساختارهای داده تو در تو). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([ویتالی بارانو](https://github.com/vitlibar)) +- توابع بیت مپ اضافه شده با بیت مپ خروشان. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([اندی یانگ](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([ویتالی بارانو](https://github.com/vitlibar)) +- پشتیبانی از فرمت پارکت. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([پرولر](https://github.com/proller)) +- فاصله ان گرم برای مقایسه رشته فازی اضافه شد. این شبیه به معیارهای پرسش گرم در زبان تحقیق است. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([نام و نام خانوادگی](https://github.com/danlark1)) +- ترکیب قوانین برای رولپ گرافیت از تجمع اختصاصی و الگوهای نگهداری. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- اضافه شده `max_execution_speed` و `max_execution_speed_bytes` برای محدود کردن استفاده از منابع. اضافه شده `min_execution_speed_bytes` تنظیم برای تکمیل `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([زمستان ژانگ](https://github.com/zhang2014)) +- تابع اجرا شده `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([الکسی میلویدو](https://github.com/alexey-milovidov), [کزون](https://github.com/kzon)) +- اضافه شدن توابع `arrayEnumerateDenseRanked` و `arrayEnumerateUniqRanked` (مثل این است `arrayEnumerateUniq` اما اجازه می دهد تا به عمق مجموعه لحن خوب به داخل مجموعه چند بعدی نگاه). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([پرولر](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([زویکوف](https://github.com/4ertus2)) + +#### رفع اشکال {#bug-fixes-11} + +- این نسخه همچنین شامل تمام رفع اشکال از 19.3 و 19.1. +- اشکال ثابت در داده های پرش شاخص: سفارش گرانول پس از درج نادرست بود. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- ثابت `set` نمایه برای `Nullable` و `LowCardinality` ستون ها قبل از اون, `set` نمایه با `Nullable` یا `LowCardinality` ستون منجر به خطا `Data type must be deserialized with multiple streams` در حالی که انتخاب. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- به درستی تنظیم update\_time کامل `executable` فرهنگ لغت به روز رسانی. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([تما نویکوف](https://github.com/temoon)) +- رفع نوار پیشرفت شکسته در 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([فیلیمونف](https://github.com/filimonov)) +- مقادیر متناقض ثابت از یادداشت دوست داشتنی زمانی که منطقه حافظه کفن شد, در موارد خاص. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفتار تعریف نشده ثابت در استخر. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تصادف بسیار نادر با پیام را ثابت کرد `mutex lock failed: Invalid argument` که می تواند رخ دهد زمانی که یک جدول ادغام همزمان با انتخاب کاهش یافته بود. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([الکس زتلپین](https://github.com/ztlpn)) +- سازگاری درایور اودن بی سی با `LowCardinality` نوع داده. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([پرولر](https://github.com/proller)) +- FreeBSD: Fixup برای `AIOcontextPool: Found io_event with unknown id 0` خطا. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([هشدار داده می شود](https://github.com/urgordeadbeef)) +- `system.part_log` جدول ایجاد شد بدون در نظر گرفتن به پیکربندی. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع رفتار تعریف نشده در `dictIsIn` تابع برای لغت نامه کش. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([الساپین](https://github.com/alesapin)) +- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([الکس زتلپین](https://github.com/ztlpn)) +- غیر فعال کردن اکسپرس به طور پیش فرض تا زمانی که ما خود را دریافت کنید `llvm` تماس با ما و می توانید با تست `clang` و `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([الساپین](https://github.com/alesapin)) +- جلوگیری از `std::terminate` چه زمانی `invalidate_query` برای `clickhouse` منبع فرهنگ لغت خارجی نتیجه اشتباه بازگشته است (خالی یا بیش از یک ردیف یا بیش از یک ستون). موضوع ثابت زمانی که `invalidate_query` هر پنج ثانیه انجام شد بدون در نظر گرفتن به `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- جلوگیری از بن بست زمانی که `invalidate_query` برای یک فرهنگ لغت با `clickhouse` منبع شامل شد `system.dictionaries` جدول یا `Dictionaries` پایگاه (مورد نادر). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع صلیب با خالی جایی که بپیوندید. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([زویکوف](https://github.com/4ertus2)) +- پیش فرض ثابت در عملکرد “replicate” هنگامی که استدلال ثابت به تصویب می رسد. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع عملکرد لامبدا با بهینه ساز پیش فرض. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([زمستان ژانگ](https://github.com/zhang2014)) +- چندگانه می پیوندد رفع متعدد. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([زویکوف](https://github.com/4ertus2)) + +#### بهبود {#improvements-3} + +- نام مستعار پشتیبانی در عضویت در بخش ستون جدول سمت راست. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([زویکوف](https://github.com/4ertus2)) +- نتیجه چند پیوستن نیاز به نام نتیجه درست در زیر مجموعه استفاده می شود. جایگزین نام مستعار تخت با نام منبع در نتیجه. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([زویکوف](https://github.com/4ertus2)) +- بهبود منطق فشار به پایین برای اظهارات پیوست. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([ایوان](https://github.com/abyss7)) + +#### بهبود عملکرد {#performance-improvements-3} + +- اکتشافی بهبود یافته از “move to PREWHERE” بهینهسازی. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- استفاده از جداول مراجعه مناسب است که با استفاده از رابط برنامه کاربردی هش را برای کلید 8 بیتی و 16 بیتی. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([ایموس پرنده](https://github.com/amosbird)) +- بهبود عملکرد مقایسه رشته. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پاکسازی صف دی ال در یک موضوع جداگانه توزیع به طوری که کم کردن سرعت حلقه اصلی که پردازش توزیع وظایف دسیدال نیست. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([الکس زتلپین](https://github.com/ztlpn)) +- زمانی که `min_bytes_to_use_direct_io` تنظیم شده است 1, هر فایل با حالت اچ باز شد چرا که اندازه داده ها به خواندن گاهی اوقات به اندازه یک بلوک فشرده دست کم گرفت. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-12} + +- اضافه شدن پشتیبانی برای صدای جرنگ جرنگ-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشتباه `__asm__` دستورالعمل ها (دوباره) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([کنستانتین پودشوموک](https://github.com/podshumok)) +- اضافه کردن قابلیت مشخص کردن تنظیمات برای `clickhouse-performance-test` از خط فرمان. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([الساپین](https://github.com/alesapin)) +- اضافه کردن لغت نامه تست به تست ادغام. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([الساپین](https://github.com/alesapin)) +- اضافه شده نمایش داده شد از معیار در وب سایت به تست عملکرد خودکار. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `xxhash.h` در لنز خارجی 4 وجود ندارد زیرا این یک پیاده سازی دقیق است و نمادهای خود را با فضای نام `XXH_NAMESPACE` ماکرو. زمانی که lz4 خارجی xxHash به خارجی بیش از حد و وابستگان به لینک به آن. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([اوروج دش](https://github.com/orivej)) +- ثابت مورد زمانی که `quantileTiming` تابع جمع را می توان با استدلال نقطه منفی یا شناور نامیده می شود (این رفع تست ریش شدن با ضد عفونی کننده رفتار تعریف نشده). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تصحیح خطای املایی. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) +- رفع تلفیقی در مک. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([ویتالی بارانو](https://github.com/vitlibar)) +- ساخت رفع برای بورس و تنظیمات مختلف ساخت غیر معمول. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([پرولر](https://github.com/proller)) + +## انتشار کلیک 19.3 {#clickhouse-release-19-3} + +### انتشار کلیک خانه 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} + +#### رفع اشکال {#bug-fixes-12} + +- رفع سقوط در `FULL/RIGHT JOIN` هنگامی که ما در پیوستن به nullable در مقابل نه nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([زویکوف](https://github.com/4ertus2)) +- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) +- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-13} + +- اضافه کردن یک راه برای راه اندازی تاتر-تصویر سرور از یک کاربر سفارشی [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### انتشار کلیک خانه 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} + +#### رفع اشکال {#bug-fixes-13} + +- خطا ثابت در \# 3920. این خطا خود را به عنوان فساد کش تصادفی (پیام) نشان می دهد `Unknown codec family code`, `Cannot seek through file`) و segfaults. این اشکال اول به نظر می رسد در نسخه 19.1 و در حال حاضر در نسخه های تا به 19.1.10 و 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} + +#### رفع اشکال {#bug-fixes-14} + +- هنگامی که بیش از 1000 موضوع در استخر موضوع وجود دارد, `std::terminate` ممکن است در خروج موضوع اتفاق می افتد. [ازات خوژین](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر این امکان وجود دارد برای ایجاد `ReplicatedMergeTree*` جداول با نظرات در ستون بدون پیش فرض و جداول با کدک ستون بدون نظر و پیش فرض. همچنین مقایسه کدک ها را رفع کنید. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([الساپین](https://github.com/alesapin)) +- تصادف ثابت در پیوستن با مجموعه یا تاپل. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([زویکوف](https://github.com/4ertus2)) +- تصادف ثابت در تاتر-کپی با پیام `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([زویکوف](https://github.com/4ertus2)) +- قطع ثابت در خاموش کردن سرور اگر دستی توزیع مورد استفاده قرار گرفت. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([الکس زتلپین](https://github.com/ztlpn)) +- تعداد ستون نادرست در پیام خطا در مورد فرمت متن تجزیه برای ستون با تعداد بیشتر از چاپ شد 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-3} + +- ساخت ثابت با اوکس را فعال کنید. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حسابداری گسترده و حسابداری یو را بر اساس نسخه شناخته شده خوب به جای هسته ای که وارد شده است فعال کنید. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([نوارتولومی](https://github.com/nvartolomei)) +- اجازه به جست و خیز تنظیم از رمز و راز.کلیمی, هشدار به جای پرتاب اگر مجموعه ای محدود شکست. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([پرولر](https://github.com/proller)) +- حذف `inline` برچسب ها از `void readBinary(...)` داخل `Field.cpp`. همچنین با هم ادغام شدند کار برکنار شده `namespace DB` بلاک [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([هکز](https://github.com/hczhcz)) + +### انتشار کلیک خانه 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} + +#### رفع اشکال {#bug-fixes-15} + +- اشکال ثابت با پردازش نمایش داده شد قرار دادن قام بزرگ است. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([الساپین](https://github.com/alesapin)) +- ناسازگاری عقب ثابت با نسخه های قدیمی به دلیل اجرای اشتباه از `send_logs_level` تنظیمات. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ناسازگاری عقب مانده تابع جدول ثابت `remote` معرفی شده با نظرات ستون. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} + +#### بهبود {#improvements-4} + +- اندازه شاخص جدول برای محدودیت حافظه در هنگام انجام به حساب نمی `ATTACH TABLE` پرس و جو. اجتناب از احتمال که یک جدول می تواند پس از جدا شدن متصل نمی شود. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- کمی محدودیت در حداکثر رشته و مجموعه ای اندازه دریافت شده از باغ وحش مطرح شده است. این اجازه می دهد تا برای ادامه کار با افزایش اندازه `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` در باغ وحش. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجازه می دهد برای تعمیر ماکت رها حتی اگر در حال حاضر تعداد زیادی از گره ها در صف خود. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن یک استدلال مورد نیاز برای `SET` شاخص (حداکثر تعداد ردیف های ذخیره شده). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([نیکیتا واسیلیف](https://github.com/nikvas0)) + +#### رفع اشکال {#bug-fixes-16} + +- ثابت `WITH ROLLUP` نتیجه برای گروه های تک `LowCardinality` کلیدی است. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اشکال ثابت در شاخص مجموعه (حذف گرانول اگر شامل بیش از `max_rows` ردیف). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- بسیاری از رفع بورس ساخت. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([پرولر](https://github.com/proller)) +- جایگزینی نام مستعار ثابت در نمایش داده شد با زیرخاکی حاوی همان نام مستعار (موضوع [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([زویکوف](https://github.com/4ertus2)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-4} + +- اضافه کردن قابلیت اجرا `clickhouse-server` برای تست بدون تابعیت در تصویر کارگر بارانداز. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([واسیلی نمکو](https://github.com/Enmk)) + +### انتشار تاتر 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} + +#### ویژگی های جدید {#new-features-6} + +- اضافه شدن `KILL MUTATION` بیانیه ای که اجازه می دهد تا از بین بردن جهش است که برای برخی از دلایل گیر کرده است. اضافه شده `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` زمینه به `system.mutations` جدول برای عیب یابی ساده تر. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([الکس زتلپین](https://github.com/ztlpn)) +- اضافه شدن تابع جمع `entropy` که شانون انتروپی رو محاسبه میکنه [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([کد37](https://github.com/Quid37)) +- توانایی اضافه شده به ارسال نمایش داده شد `INSERT INTO tbl VALUES (....` به سرور بدون تقسیم در `query` و `data` قطعات. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([الساپین](https://github.com/alesapin)) +- اجرای عمومی `arrayWithConstant` تابع اضافه شد. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پیادهسازی شده `NOT BETWEEN` اپراتور مقایسه. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([دیمیتری نوموف](https://github.com/nezed)) +- پیاده سازی `sumMapFiltered` به منظور قادر به محدود کردن تعداد کلید که ارزش خواهد شد خلاصه `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- اضافه شدن پشتیبانی از `Nullable` انواع در `mysql` تابع جدول. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) +- پشتیبانی از عبارات ثابت دلخواه در `LIMIT` بند بند. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([جعبه 3](https://github.com/k3box)) +- اضافه شده `topKWeighted` تابع مجموع طول می کشد که استدلال اضافی با (عدد صحیح بدون علامت) وزن. [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([اندرو گولمن](https://github.com/andrewgolman)) +- `StorageJoin` در حال حاضر پشتیبانی `join_any_take_last_row` تنظیم که اجازه می دهد تا جای نوشتن ارزش های موجود از همان کلید. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([ایموس پرنده](https://github.com/amosbird) +- اضافه شدن تابع `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([ویتالی بارانو](https://github.com/vitlibar)) +- اضافه شده `RowBinaryWithNamesAndTypes` قالب. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([اولگ و کوزلوک](https://github.com/DarkWanderer)) +- اضافه شده `IPv4` و `IPv6` انواع داده ها. پیاده سازی موثر تر از `IPv*` توابع. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([واسیلی نمکو](https://github.com/Enmk)) +- اضافه شدن تابع `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([ویتالی بارانو](https://github.com/vitlibar)) +- اضافه شده `Protobuf` فرمت خروجی. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([ویتالی بارانو](https://github.com/vitlibar)) +- اضافه شده brotli پشتیبانی از http رابط برای واردات داده ها (درج). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([میخیل](https://github.com/fandyushin)) +- نکات اضافه شده در حالی که کاربر را تایپی در نام تابع و یا نوع در مشتری خط فرمان. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([نام و نام خانوادگی](https://github.com/danlark1)) +- اضافه شده `Query-Id` به هدر پاسخ قام سرور. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([میخیل](https://github.com/fandyushin)) + +#### ویژگی های تجربی {#experimental-features-2} + +- اضافه شده `minmax` و `set` داده پرش شاخص برای ادغام جدول موتورهای خانواده. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- تبدیل اضافه شده از `CROSS JOIN` به `INNER JOIN` در صورت امکان. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([زویکوف](https://github.com/4ertus2)) + +#### رفع اشکال {#bug-fixes-17} + +- ثابت `Not found column` برای ستون های تکراری در `JOIN ON` بخش. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([زویکوف](https://github.com/4ertus2)) +- ساخت `START REPLICATED SENDS` شروع فرمان تکرار می فرستد. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([نوارتولومی](https://github.com/nvartolomei)) +- ثابت توابع مجموع اعدام با `Array(LowCardinality)` بحث کردن. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- رفتار اشتباه ثابت هنگام انجام `INSERT ... SELECT ... FROM file(...)` پرس و جو و فایل است `CSVWithNames` یا `TSVWIthNames` فرمت و ردیف داده برای اولین بار از دست رفته است. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تصادف ثابت در بازنگری فرهنگ لغت اگر فرهنگ لغت در دسترس نیست. این اشکال در 19.1.6 ظاهر شد. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([پرولر](https://github.com/proller)) +- ثابت `ALL JOIN` با تکراری در جدول سمت راست. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([زویکوف](https://github.com/4ertus2)) +- گسل تقسیم بندی ثابت با `use_uncompressed_cache=1` و استثنا با اندازه غیر فشرده اشتباه است. این اشکال در 19.1.6 ظاهر شد. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([الساپین](https://github.com/alesapin)) +- ثابت `compile_expressions` اشکال با مقایسه بزرگ (بیش از مقدمه16) تاریخ. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([الساپین](https://github.com/alesapin)) +- حلقه بی نهایت ثابت در هنگام انتخاب از تابع جدول `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به طور موقت بهینه سازی پیش فرض برای غیر فعال کردن `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([زمستان ژانگ](https://github.com/zhang2014)) +- ثابت `Illegal instruction` خطا در هنگام استفاده از توابع بازه64 در پردازنده های قدیمی. این خطا تکثیر شده است تنها زمانی که فاحشه خانه با شورای همکاری خلیج فارس وارد شد-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `No message received` خطا در هنگام تعامل با راننده خیال راحت اد بی سی از طریق اتصال. همچنین رفع segfault در هنگام استفاده از MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نتیجه نادرست ثابت زمانی که `Date` و `DateTime` استدلال ها در شاخه های اپراتور شرطی (تابع `if`). مورد عمومی برای عملکرد اضافه شده است `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- لغت نامه کلیک کن در داخل بار `clickhouse` روند. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بن بست ثابت زمانی که `SELECT` از یک جدول با `File` موتور پس از دوباره انجام شد `No such file or directory` خطا. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شرایط مسابقه ثابت در هنگام انتخاب از `system.tables` ممکن است به `table doesn't exist` خطا. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `clickhouse-client` می توانید در هنگام خروج به طور مرتب داده ها را برای پیشنهادات خط فرمان بارگیری کنید اگر در حالت تعاملی اجرا شود. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال زمانی که اجرای جهش های حاوی `IN` اپراتورها نتایج نادرست تولید می کردند. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([الکس زتلپین](https://github.com/ztlpn)) +- خطا ثابت: اگر یک پایگاه داده با وجود `Dictionary` موتور, تمام لغت نامه مجبور به بارگذاری در هنگام راه اندازی سرور, و اگر یک فرهنگ لغت با منبع کلیک از منبع محلی هاست وجود دارد, فرهنگ لغت نمی تواند بار. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطا ثابت زمانی که سیستم سیاهههای مربوط به تلاش برای ایجاد دوباره در خاموش کردن سرور. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به درستی نوع مناسب را باز کنید و قفل ها را به درستی مدیریت کنید `joinGet` تابع. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([ایموس پرنده](https://github.com/amosbird)) +- اضافه شده `sumMapWithOverflow` تابع. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- ثابت segfault با `allow_experimental_multiple_joins_emulation`. [52دسی 2 درجه سانتیگراد](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([زویکوف](https://github.com/4ertus2)) +- اشکال ثابت با نادرست `Date` و `DateTime` مقایسه. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([حداکثر](https://github.com/valexey)) +- تست ریش ریش شدن ثابت تحت تعریف نشده رفتار ضد عفونی کننده: اضافه شدن نوع پارامتر را بررسی کنید `quantile*Weighted` خانواده از توابع. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شرایط مسابقه نادر ثابت در هنگام از بین بردن قطعات داده های قدیمی می تواند با شکست مواجه `File not found` خطا. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت نصب بسته با گم شده /و غیره/خانه کلیک-سرور / پیکربندی.. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([پرولر](https://github.com/proller)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-5} + +- دبیان بسته بندی: درست /و غیره/کلیک-سرور/لینک پیش پردازش با توجه به پیکربندی. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([پرولر](https://github.com/proller)) +- رفع ساخت های مختلف برای بورس. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([پرولر](https://github.com/proller)) +- توانایی اضافه شده به ایجاد, پر کردن و رها کردن جداول در اصلح. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([الساپین](https://github.com/alesapin)) +- اضافه شده یک اسکریپت برای تکراری بررسی شامل. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- توانایی اضافه شده به اجرا نمایش داده شد توسط شاخص در تست عملکرد. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([الساپین](https://github.com/alesapin)) +- بسته بندی با علامت اشکال زدایی پیشنهاد می شود نصب شود. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بازسازی عملکرد-تست. ورود به سیستم بهتر و سیگنال های دست زدن به. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([الساپین](https://github.com/alesapin)) +- اسناد اضافه شده به ناشناس یاندکس.مجموعه داده های متریکا. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([الساپین](https://github.com/alesapin)) +- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([الکس زتلپین](https://github.com/ztlpn)) +- اسناد اضافه شده در مورد دو مجموعه داده در اس3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([الساپین](https://github.com/alesapin)) +- اضافه شده اسکریپت که ایجاد تغییرات از کشش درخواست توضیحات. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([کوچتونیکولای](https://github.com/KochetovNicolai)) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- اضافه شده ماژول عروسک خیمه شب بازی برای فاحشه خانه. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([ماکسیم فدوتف](https://github.com/MaxFedotov)) +- اسناد اضافه شده برای یک گروه از توابع مستند نشده. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([زمستان ژانگ](https://github.com/zhang2014)) +- بازوی رفع ساخت. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([پرولر](https://github.com/proller)) ([پرولر](https://github.com/proller)) +- تست فرهنگ لغت در حال حاضر قادر به اجرا از `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([پرولر](https://github.com/proller)) +- حالا `/etc/ssl` به عنوان دایرکتوری پیش فرض با گواهی اس اس ال استفاده می شود. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده چک کردن اس اس اس و توضیحات در شروع. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([ایگر](https://github.com/igron99)) +- اسکریپت اینیت سرور صبر کنید تا شروع. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([پرولر](https://github.com/proller)) + +#### تغییرات ناسازگار به عقب {#backward-incompatible-changes-1} + +- حذف شد `allow_experimental_low_cardinality_type` تنظیمات. `LowCardinality` انواع داده ها تولید می شوند. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- کاهش اندازه علامت کش و اندازه کش غیر فشرده بر این اساس به مقدار حافظه در دسترس است. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([لوپاتین کنستانتین](https://github.com/k-lopatin) +- کلمه کلیدی اضافه شده است `INDEX` داخل `CREATE TABLE` پرس و جو. یک ستون با نام `index` باید با پشتی یا نقل قول های دوگانه نقل قول شود: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- `sumMap` در حال حاضر نوع نتیجه به جای سرریز ترویج. قدیمی `sumMap` رفتار را می توان با استفاده از `sumMapWithOverflow` تابع. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) + +#### بهبود عملکرد {#performance-improvements-4} + +- `std::sort` جایگزین شده توسط `pdqsort` برای نمایش داده شد بدون `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([اوگنی پراودا](https://github.com/kvinty)) +- در حال حاضر سرور موضوعات استفاده مجدد از استخر موضوع جهانی است. این عملکرد در برخی موارد گوشه تاثیر می گذارد. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### بهبود {#improvements-5} + +- پیاده سازی پشتیبانی برای بورس. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([هشدار داده می شود](https://github.com/urgordeadbeef)) +- `SELECT * FROM a JOIN b USING a, b` حالا برگرد `a` و `b` ستون تنها از جدول سمت چپ. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([زویکوف](https://github.com/4ertus2)) +- اجازه داده شود `-C` گزینه مشتری برای کار به عنوان `-c` انتخاب [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([سیمینسرگی](https://github.com/syominsergey)) +- در حال حاضر گزینه `--password` استفاده بدون ارزش نیاز به رمز عبور از استدین. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([حداقل صفحه نمایش:](https://github.com/bsd-conqueror)) +- افزود برجسته از unescaped metacharacters در string literals که حاوی `LIKE` عبارات و یا عبارت منظم. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده لغو قام به عنوان خوانده شده تنها نمایش داده شد اگر سوکت مشتری از بین می رود. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([نوارتولومی](https://github.com/nvartolomei)) +- در حال حاضر گزارش سرور پیشرفت برای زنده نگه داشتن اتصالات مشتری. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([ایوان](https://github.com/abyss7)) +- پیام کمی بهتر با دلیل برای بهینه سازی پرس و جو با `optimize_throw_if_noop` تنظیم را فعال کنید. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن پشتیبانی از `--version` گزینه ای برای سرور کلیک. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([لوپاتین کنستانتین](https://github.com/k-lopatin)) +- اضافه شده `--help/-h` گزینه ای برای `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([یوری baranov](https://github.com/yurriy)) +- اضافه شدن پشتیبانی برای زیرمجموعه اسکالر با تابع کل نتیجه دولت است. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- بهبود زمان خاموش کردن سرور و تغییر زمان انتظار. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن اطلاعات در مورد تنظیمات \_شروع مجدد به سیستم.کپی و اضافه کردن ورود به سیستم اگر ماکت نمی خواهد سعی کنید برای تبدیل شدن به رهبر. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([الکس زتلپین](https://github.com/ztlpn)) + +## انتشار کلیک 19.1 {#clickhouse-release-19-1} + +### انتشار کلیک خانه 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} + +- خطای ثابت `Column ... queried more than once` که ممکن است اتفاق می افتد اگر تنظیمات `asterisk_left_columns_only` در صورت استفاده به 1 تنظیم می شود `GLOBAL JOIN` با `SELECT *` (مورد نادر). این موضوع در وجود ندارد 19.3 و جدیدتر. [6باک7د8د](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([زویکوف](https://github.com/4ertus2)) + +### انتشار کلیک خانه 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} + +این نسخه شامل دقیقا همان مجموعه ای از تکه های به عنوان 19.3.7. + +### انتشار کلیک خانه 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} + +این نسخه شامل دقیقا همان مجموعه ای از تکه های به عنوان 19.3.6. + +## انتشار کلیک 19.1 {#clickhouse-release-19-1-1} + +### انتشار کلیک خانه 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} + +#### رفع اشکال {#bug-fixes-18} + +- ناسازگاری عقب ثابت با نسخه های قدیمی به دلیل اجرای اشتباه از `send_logs_level` تنظیمات. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ناسازگاری عقب مانده تابع جدول ثابت `remote` معرفی شده با نظرات ستون. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} + +#### رفع اشکال {#bug-fixes-19} + +- ثابت نصب بسته با گم شده /و غیره/خانه کلیک-سرور / پیکربندی.. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([پرولر](https://github.com/proller)) + +## انتشار کلیک 19.1 {#clickhouse-release-19-1-2} + +### انتشار کلیک خانه 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} + +#### رفع اشکال {#bug-fixes-20} + +- به درستی نوع مناسب را باز کنید و قفل ها را به درستی مدیریت کنید `joinGet` تابع. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([ایموس پرنده](https://github.com/amosbird)) +- خطا ثابت زمانی که سیستم سیاهههای مربوط به تلاش برای ایجاد دوباره در خاموش کردن سرور. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطا ثابت: اگر یک پایگاه داده با وجود `Dictionary` موتور, تمام لغت نامه مجبور به بارگذاری در هنگام راه اندازی سرور, و اگر یک فرهنگ لغت با منبع کلیک از منبع محلی هاست وجود دارد, فرهنگ لغت نمی تواند بار. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال زمانی که اجرای جهش های حاوی `IN` اپراتورها نتایج نادرست تولید می کردند. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([الکس زتلپین](https://github.com/ztlpn)) +- `clickhouse-client` می توانید در هنگام خروج به طور مرتب داده ها را برای پیشنهادات خط فرمان بارگیری کنید اگر در حالت تعاملی اجرا شود. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شرایط مسابقه ثابت در هنگام انتخاب از `system.tables` ممکن است به `table doesn't exist` خطا. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بن بست ثابت زمانی که `SELECT` از یک جدول با `File` موتور پس از دوباره انجام شد `No such file or directory` خطا. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت موضوع: لغت نامه خانه کلیک محلی از طریق تی سی پی لود, اما باید در روند بارگذاری. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `No message received` خطا در هنگام تعامل با راننده خیال راحت اد بی سی از طریق اتصال. همچنین رفع segfault در هنگام استفاده از MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به طور موقت بهینه سازی پیش فرض برای غیر فعال کردن `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([زمستان ژانگ](https://github.com/zhang2014)) +- حلقه بی نهایت ثابت در هنگام انتخاب از تابع جدول `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `compile_expressions` اشکال با مقایسه بزرگ (بیش از مقدمه16) تاریخ. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([الساپین](https://github.com/alesapin)) +- گسل تقسیم بندی ثابت با `uncompressed_cache=1` و استثنا با اندازه غیر فشرده اشتباه است. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([الساپین](https://github.com/alesapin)) +- ثابت `ALL JOIN` با تکراری در جدول سمت راست. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([زویکوف](https://github.com/4ertus2)) +- رفتار اشتباه ثابت هنگام انجام `INSERT ... SELECT ... FROM file(...)` پرس و جو و فایل است `CSVWithNames` یا `TSVWIthNames` فرمت و ردیف داده برای اولین بار از دست رفته است. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت توابع مجموع اعدام با `Array(LowCardinality)` بحث کردن. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- دبیان بسته بندی: درست /و غیره/کلیک-سرور/لینک پیش پردازش با توجه به پیکربندی. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([پرولر](https://github.com/proller)) +- تست ریش ریش شدن ثابت تحت تعریف نشده رفتار ضد عفونی کننده: اضافه شدن نوع پارامتر را بررسی کنید `quantile*Weighted` خانواده از توابع. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ساخت `START REPLICATED SENDS` شروع فرمان تکرار می فرستد. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([نوارتولومی](https://github.com/nvartolomei)) +- ثابت `Not found column` برای ستون های تکراری در عضویت در بخش. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([زویکوف](https://github.com/4ertus2)) +- حالا `/etc/ssl` به عنوان دایرکتوری پیش فرض با گواهی اس اس ال استفاده می شود. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تصادف ثابت در بازنگری فرهنگ لغت اگر فرهنگ لغت در دسترس نیست. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([پرولر](https://github.com/proller)) +- اشکال ثابت با نادرست `Date` و `DateTime` مقایسه. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([حداکثر](https://github.com/valexey)) +- نتیجه نادرست ثابت زمانی که `Date` و `DateTime` استدلال ها در شاخه های اپراتور شرطی (تابع `if`). مورد عمومی برای عملکرد اضافه شده است `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +### انتشار کلیک خانه 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} + +#### ویژگی های جدید {#new-features-7} + +- سفارشی در هر کدک های فشرده سازی ستون برای جداول. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([الساپین](https://github.com/alesapin), [زمستان ژانگ](https://github.com/zhang2014), [انتولی](https://github.com/Sindbag)) +- اضافه شده کدک فشرده سازی `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([الساپین](https://github.com/alesapin)) +- اجازه دادن به `ALTER` کدک های فشرده سازی. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([الساپین](https://github.com/alesapin)) +- اضافه شدن توابع `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` برای سازگاری استاندارد گذاشتن. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([ایوان بلینکو](https://github.com/blinkov)) +- پشتیبانی از نوشتن در `HDFS` جداول و `hdfs` تابع جدول. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([الساپین](https://github.com/alesapin)) +- اضافه شدن توابع به جستجو برای رشته ثابت متعدد از انبار کاه بزرگ: `multiPosition`, `multiSearch` ,`firstMatch` همچنین با `-UTF8`, `-CaseInsensitive` و `-CaseInsensitiveUTF8` انواع. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([نام و نام خانوادگی](https://github.com/danlark1)) +- هرس کردن تکه های استفاده نشده اگر `SELECT` فیلترهای پرس و جو با کلید شاردینگ (تنظیم `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([گلب کنتروف](https://github.com/kanterov), [ایوان](https://github.com/abyss7)) +- اجازه داده شود `Kafka` موتور به چشم پوشی از برخی از تعدادی از خطاهای تجزیه در هر بلوک. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([ایوان](https://github.com/abyss7)) +- اضافه شدن پشتیبانی برای `CatBoost` multiclass مدل های ارزیابی. تابع `modelEvaluate` را برمی گرداند تاپل با پیش بینی های خام در هر کلاس برای مدل های چند طبقه. `libcatboostmodel.so` باید با ساخته شده است [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- اضافه شدن توابع `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([بوریس گرانویو](https://github.com/bgranvea)) +- اضافه شده توابع هش کردن `xxHash64` و `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([فیلیمونف](https://github.com/filimonov)) +- اضافه شده `gccMurmurHash` تابع هش (شورای همکاری خلیج فارس طعم زمزمه هش) که با استفاده از همان دانه هش به عنوان [شورای همکاری خلیج فارس](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- اضافه شده توابع هش کردن `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([شانگشویی365](https://github.com/shangshujie365)) +- تابع جدول اضافه شده است `remoteSecure`. تابع به عنوان کار می کند `remote`, اما با استفاده از اتصال امن. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([پرولر](https://github.com/proller)) + +#### ویژگی های تجربی {#experimental-features-3} + +- اضافه شده چند تقلید می پیوندد (`allow_experimental_multiple_joins_emulation` تنظیمات). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([زویکوف](https://github.com/4ertus2)) + +#### رفع اشکال {#bug-fixes-21} + +- ساخت `compiled_expression_cache_size` تنظیم به طور پیش فرض برای کاهش مصرف حافظه محدود شده است. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([الساپین](https://github.com/alesapin)) +- رفع اشکال که منجر به hangups در تاپیک های که انجام تغییر از تکرار جداول و در این موضوع است که به روز رسانی پیکربندی از باغ وحش. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([الکس زتلپین](https://github.com/ztlpn)) +- ثابت شرایط مسابقه در هنگام اجرای یک کار تغییر توزیع شده است. شرایط مسابقه منجر به بیش از یک ماکت در تلاش برای اجرای کار و همه کپی به جز یک شکست با یک خطای باغ وحش. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([الکس زتلپین](https://github.com/ztlpn)) +- رفع اشکال زمانی که `from_zk` عناصر پیکربندی شد پس از یک درخواست به باغ وحش به پایان رسیده است تجدید نیست. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([الکس زتلپین](https://github.com/ztlpn)) +- رفع اشکال با پیشوند اشتباه برای ماسک زیر شبکه ایپسویچ. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([الساپین](https://github.com/alesapin)) +- تصادف ثابت (`std::terminate`) در موارد نادر زمانی که یک موضوع جدید نمی تواند به دلیل منابع خسته ایجاد شود. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال زمانی که در `remote` اجرای تابع جدول زمانی که محدودیت اشتباه برای در مورد استفاده قرار گرفت `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([الساپین](https://github.com/alesapin)) +- رفع نشت از سوکت نتلینک. در یک استخر قرار گرفتند که هرگز حذف نشدند و سوکت های جدید در ابتدای یک موضوع جدید ایجاد شد زمانی که همه سوکت های فعلی استفاده می شد. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([الکس زتلپین](https://github.com/ztlpn)) +- رفع اشکال با بسته شدن `/proc/self/fd` دایرکتوری زودتر از همه پزشکان از خوانده شد `/proc` پس از مجبور `odbc-bridge` مانع عبور. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([الساپین](https://github.com/alesapin)) +- رشته ثابت به تبدیل یکنواخت کهنه در مورد رشته استفاده در کلید اولیه. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([زمستان ژانگ](https://github.com/zhang2014)) +- خطا ثابت در محاسبه یکنواختی تابع تبدیل عدد صحیح. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت segfault در `arrayEnumerateUniq`, `arrayEnumerateDense` توابع در مورد برخی از استدلال نامعتبر. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال بارگذاری [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([ایموس پرنده](https://github.com/amosbird)) +- پیش فرض ثابت در توابع `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطای ثابت: توابع `round`, `floor`, `trunc`, `ceil` ممکن است نتیجه جعلی بازگشت زمانی که در استدلال صحیح و مقیاس بزرگ منفی اجرا. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال ناشی از ‘kill query sync’ که منجر به روگرفت هسته. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([شناسه بسته:](https://github.com/fancyqlx)) +- رفع اشکال با تاخیر طولانی پس از صف تکرار خالی است. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([الساپین](https://github.com/alesapin)) +- استفاده از حافظه بیش از حد ثابت در صورت قرار دادن به جدول با `LowCardinality` کلید اصلی. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- ثابت `LowCardinality` ترتیب برای `Native` فرمت در مورد مجموعه های خالی. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- نتیجه نادرست ثابت در حالی که با استفاده از مجزا توسط ستون عددی کم حافظه. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- تجمع تخصصی ثابت با کلید کمکاری (در صورتی که `compile` تنظیم فعال است). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- رفع کاربر و رمز عبور حمل و نقل برای جداول تکرار نمایش داده شد. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([الساپین](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) +- ثابت شرایط مسابقه بسیار نادر است که می تواند رخ دهد که لیست جداول در پایگاه داده فرهنگ لغت در حالی که بارگذاری لغت نامه. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نتیجه نادرست ثابت زمانی که با رولپ یا مکعب مورد استفاده قرار گرفت. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([سام چو](https://github.com/reflection)) +- نام مستعار ستون ثابت برای پرس و جو با `JOIN ON` نحو و جداول توزیع. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([زمستان ژانگ](https://github.com/zhang2014)) +- خطای ثابت در اجرای داخلی `quantileTDigest` (که توسط آرتم Vakhrushev). این خطا اتفاق هرگز در ClickHouse و مناسب بود تنها برای کسانی که استفاده از ClickHouse کدهای به عنوان یک کتابخانه به طور مستقیم. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### بهبود {#improvements-6} + +- پشتیبانی از `IF NOT EXISTS` داخل `ALTER TABLE ADD COLUMN` بیانیه همراه با `IF EXISTS` داخل `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([بوریس گرانویو](https://github.com/bgranvea)) +- تابع `parseDateTimeBestEffort`: پشتیبانی از فرمت های `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` و مشابه. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- `CapnProtoInputStream` در حال حاضر سازه های ناهموار ممکن میکند پشتیبانی می کند. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) +- بهبود قابلیت استفاده: اضافه شدن چک که روند سرور از صاحب دایرکتوری داده ها شروع شده است. اجازه ندهید سرور را از ریشه شروع کنید اگر داده ها متعلق به کاربر غیر ریشه باشد. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([سرگی-وی-گالتسف](https://github.com/sergey-v-galtsev)) +- منطق بهتر از چک کردن ستون های مورد نیاز در طول تجزیه و تحلیل نمایش داده شد با می پیوندد. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([زویکوف](https://github.com/4ertus2)) +- تعداد اتصالات در صورت تعداد زیادی از جداول توزیع شده در یک سرور کاهش یافته است. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([زمستان ژانگ](https://github.com/zhang2014)) +- بالغ پشتیبانی ردیف برای `WITH TOTALS` پرس و جو برای راننده او بی سی. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([مکسیم کریتکی](https://github.com/nightweb)) +- مجاز به استفاده `Enum`به عنوان اعداد صحیح در داخل اگر تابع. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([ایوان](https://github.com/abyss7)) +- اضافه شده `low_cardinality_allow_in_native_format` تنظیمات. اگر غیر فعال, استفاده نکنید `LowCadrinality` نوع در `Native` قالب. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([کوچتونیکولای](https://github.com/KochetovNicolai)) +- حذف برخی از اجسام کار برکنار شده از عبارات وارد کش به کاهش استفاده از حافظه است. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([الساپین](https://github.com/alesapin)) +- اضافه کردن چک که `SET send_logs_level = 'value'` پرس و جو قبول ارزش مناسب. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([سابین ماکسیم](https://github.com/s-mx)) +- بررسی نوع داده ثابت در توابع تبدیل نوع. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([زمستان ژانگ](https://github.com/zhang2014)) + +#### بهبود عملکرد {#performance-improvements-5} + +- افزودن تنظیمات ادغام `use_minimalistic_part_header_in_zookeeper`. اگر فعال, جداول تکرار خواهد ابرداده بخش جمع و جور در یک قسمت صفر ذخیره. این به طور چشمگیری می تواند به کاهش اندازه عکس فوری باغ وحش (به خصوص اگر جداول یک مقدار زیادی از ستون). توجه داشته باشید که پس از فعال کردن این تنظیمات شما قادر نخواهد بود به جمع و جور کردن به نسخه ای که پشتیبانی نمی کند. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([الکس زتلپین](https://github.com/ztlpn)) +- اضافه کردن یک پیاده سازی مبتنی بر وزارت امور خارجه برای توابع `sequenceMatch` و `sequenceCount` در مورد الگوی حاوی زمان نیست. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- بهبود عملکرد برای اعداد صحیح ترتیب. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([ایموس پرنده](https://github.com/amosbird)) +- صفر پدرارهای چپ به طوری که -1 عنصر همیشه معتبر و صفر است. این برای محاسبه بدون شاخه از شیپور خاموشی استفاده می شود. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([ایموس پرنده](https://github.com/amosbird)) +- واگردانی `jemalloc` نسخه که منجر به تخریب عملکرد. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### تغییرات ناسازگار به عقب {#backward-incompatible-changes-2} + +- حذف ویژگی مستند نشده است `ALTER MODIFY PRIMARY KEY` چرا که توسط جایگزین شد `ALTER MODIFY ORDER BY` فرمان. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([الکس زتلپین](https://github.com/ztlpn)) +- تابع حذف شده `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- منع استفاده از زیرکورهای اسکالر با نتیجه نوع `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([ایوان](https://github.com/abyss7)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-6} + +- اضافه شدن پشتیبانی برای پاور (`ppc64le`) ساختن . [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([نام و نام خانوادگی](https://github.com/danlark1)) +- تست های عملکردی نفرت انگیز بر روی مجموعه داده های عمومی در دسترس اجرا. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطا ثابت زمانی که سرور نمی تواند با شروع `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` پیام در داکر یا سیستم-خوانده. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز شده `rdkafka` کتابخانه به 1. 0. 0-ارک5. کپکافکا مورد استفاده به جای رابط ج خام. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([ایوان](https://github.com/abyss7)) +- به روز شده `mariadb-client` کتابخونه. ثابت یکی از مشکلات پیدا شده توسط اوبسان. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- برخی از رفع برای اوبسان ایجاد. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده در هر مرتکب اجرا می شود از تست با ساخت اوبان. +- اضافه شده در هر مرتکب اجرا می شود از پوس استودیو تجزیه و تحلیل استاتیک می باشد. +- اشکالات ثابت پیدا شده توسط پوس استودیو. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت glibc مسائل مربوط به سازگاری. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- انتقال تصاویر کارگر بارانداز به 18.10 و اضافه کردن فایل سازگاری برای چرب \> = 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([الساپین](https://github.com/alesapin)) +- اضافه کردن متغیر پاکت اگر کاربر نمی خواهید به دایرکتوری پی ان در سرور تصویر کارگر بارانداز. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([الساپین](https://github.com/alesapin)) +- فعال بسیاری از هشدارهای از `-Weverything` تو کلانگ فعال شد `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده چند هشدار که تنها در صدای جرنگ جرنگ در دسترس هستند 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پیوند به `libLLVM` در هنگام استفاده از پیوند مشترک به جای استفاده از لوب های فردی لورم. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([اوروج دش](https://github.com/orivej)) +- اضافه شده متغیرهای ضد عفونی کننده برای تصاویر تست. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([الساپین](https://github.com/alesapin)) +- `clickhouse-server` بسته دبیان توصیه خواهد شد `libcap2-bin` بسته برای استفاده `setcap` ابزار برای تنظیم قابلیت های. این اختیاری است. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- زمان تدوین بهبود, ثابت شامل. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([پرولر](https://github.com/proller)) +- تست عملکرد اضافه شده برای توابع هش. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([فیلیمونف](https://github.com/filimonov)) +- وابستگی کتابخانه چرخهای ثابت. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([پرولر](https://github.com/proller)) +- تلفیقی بهبود یافته با حافظه کم در دسترس است. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([پرولر](https://github.com/proller)) +- اضافه شدن اسکریپت تست به تکثیر تخریب عملکرد در `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت misspells در نظرات و string literals تحت `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([مامان](https://github.com/maiha)) +- غلط املایی ثابت در نظرات. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([اوگنی پراودا](https://github.com/kvinty)) + +## [تغییرات برای 2018](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/fa/whats-new/changelog/index.md b/docs/fa/whats-new/changelog/index.md new file mode 100644 index 00000000000..ebf1ee992e0 --- /dev/null +++ b/docs/fa/whats-new/changelog/index.md @@ -0,0 +1,668 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Changelog +toc_priority: 74 +toc_title: '2020' +--- + +## انتشار کلیک و 20.3 {#clickhouse-release-v20-3} + +### ClickHouse انتشار V20.3.4.10, 2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} + +#### رفع اشکال {#bug-fix} + +- این نسخه همچنین شامل تمام رفع اشکال از 20.1.8.41 +- رفع از دست رفته `rows_before_limit_at_least` برای نمایش داده شد بیش از قام (با پردازنده خط لوله). این رفع [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +### انتشار کلیک و 20.3.3.6, 2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} + +#### رفع اشکال {#bug-fix-1} + +- این نسخه همچنین شامل تمام رفع اشکال از 20.1.7.38 +- رفع اشکال در تکرار می کند که تکرار اجازه نمی دهد به کار اگر کاربر جهش در نسخه های قبلی اجرا کرده است. این رفع [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([الساپین](https://github.com/alesapin)). این باعث می شود نسخه 20.3 به عقب سازگار دوباره. +- افزودن تنظیمات `use_compact_format_in_distributed_parts_names` که اجازه می دهد برای نوشتن فایل برای `INSERT` نمایش داده شد به `Distributed` جدول با فرمت جمع و جور تر. این رفع [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([الساپین](https://github.com/alesapin)). این باعث می شود نسخه 20.3 به عقب سازگار دوباره. + +### انتشار کلیک و 20.3.2.1, 2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} + +#### تغییر ناسازگار به عقب {#backward-incompatible-change} + +- ثابت موضوع `file name too long` هنگام ارسال داده ها برای `Distributed` جداول برای تعداد زیادی از کپی. ثابت این موضوع که اعتبار ماکت در ورود به سیستم سرور قرار گرفتند. فرمت نام دایرکتوری بر روی دیسک به تغییر یافت `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([میخیل کوروتف](https://github.com/millb)) پس از شما به نسخه جدید ارتقا دهید, شما نمی قادر خواهد بود به جمع و جور کردن بدون دخالت دستی, به دلیل نسخه سرور قدیمی می کند فرمت دایرکتوری جدید به رسمیت نمی شناسد. اگر شما می خواهید به جمع و جور کردن, شما باید به صورت دستی تغییر نام دایرکتوری مربوطه را به فرمت های قدیمی. این تغییر مربوط است تنها اگر شما ناهمزمان استفاده کرده اند `INSERT`اس به `Distributed` میز در نسخه 20.3.3 ما یک محیط است که به شما اجازه فعال کردن فرمت جدید به تدریج معرفی. +- فرمت ورودی ورود به سیستم تکرار برای دستورات جهش تغییر کرده است. شما باید صبر کنید برای جهش های قدیمی برای پردازش قبل از نصب نسخه جدید. +- پیاده سازی پیشفیلتر حافظه ساده است که افسردگی زخم به `system.trace_log` هر بایت بر سر حد تخصیص نرم [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([ایوان](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([الکسی میلویدو](https://github.com/alexey-milovidov)) ستون `system.trace_log` از تغییر نام داد `timer_type` به `trace_type`. این تغییرات در تجزیه و تحلیل عملکرد شخص ثالث و ابزارهای پردازش فلامگراف نیاز دارد. +- استفاده از شناسه موضوع سیستم عامل در همه جا به جای شماره موضوع داخلی. این رفع [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) قدیمی `clickhouse-client` می توانید سیاهههای مربوط که از سرور ارسال زمانی که تنظیم دریافت نمی `send_logs_level` فعال است, چرا که نام و نوع پیام ورود به سیستم ساختار تغییر یافت. از سوی دیگر نسخه های سرور مختلف سیاهههای مربوط با انواع مختلف به یکدیگر ارسال کنید. هنگامی که شما از `send_logs_level` محیط, شما باید مهم نیست. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حذف `indexHint` تابع [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حذف `findClusterIndex`, `findClusterValue` توابع. این رفع [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). اگر شما با استفاده از این توابع, ارسال یک ایمیل به `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر مجاز به ایجاد ستون و یا اضافه کردن ستون با `SELECT` زیرخاکری به عنوان عبارت پیش فرض. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([الساپین](https://github.com/alesapin)) +- نیاز نام مستعار برای کارخانه های فرعی در عضویت. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([زویکوف](https://github.com/4ertus2)) +- بهبود `ALTER MODIFY/ADD` نمایش داده شد منطق. حالا شما نمی توانید `ADD` ستون بدون نوع, `MODIFY` عبارت پیش فرض نوع ستون را تغییر نمی دهد و `MODIFY` نوع ارزش بیان پیش فرض را از دست نمی دهد. رفع [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([الساپین](https://github.com/alesapin)) +- نیاز به سرور برای راه اندازی مجدد برای اعمال تغییرات در پیکربندی ورود به سیستم. این یک راه حل موقت برای جلوگیری از اشکال که سرور سیاهههای مربوط به یک فایل ورود به سیستم حذف شده است (دیدن [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- تنظیمات `experimental_use_processors` به طور پیش فرض فعال است. این تنظیم را قادر می سازد استفاده از خط لوله پرس و جو جدید. این فاکتورگیری مجدد داخلی است و ما انتظار داریم هیچ تغییری قابل مشاهده. اگر مشکلی خواهید دید صفر را تنظیم کنید. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### ویژگی جدید {#new-feature} + +- افزودن `Avro` و `AvroConfluent` فرمت های ورودی/خروجی [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([اندرو انیشچوک](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([اندرو انیشچوک](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز رسانی چند رشته ای و غیر مسدود کردن کلید منقضی شده در `cache` واژهنامهها (با اجازه اختیاری به خواندن قدیمی). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- افزودن پرسوجو `ALTER ... MATERIALIZE TTL`. این اجرا می شود جهش است که نیروهای به حذف داده های منقضی شده توسط کنترل از راه دور و دوباره حساب متا اطلاعات در مورد کنترل از راه دور در تمام نقاط. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([انتون پوپوف](https://github.com/CurtizJ)) +- سوئیچ از hashjoin به mergejoin (بر روی دیسک) در صورت نیاز [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([زویکوف](https://github.com/4ertus2)) +- اضافه شده `MOVE PARTITION` فرمان برای `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- بارگذاری مجدد پیکربندی ذخیره سازی از فایل پیکربندی در پرواز. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- مجاز به تغییر `storage_policy` به یکی کمتر غنی. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اضافه شدن پشتیبانی برای کره / نویسه عام برای ذخیره سازی اس3 و عملکرد جدول. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- پیاده سازی `bitAnd`, `bitOr`, `bitXor`, `bitNot` برای `FixedString(N)` نوع داده. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- اضافه شدن تابع `bitCount`. این رفع [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([درباره ما](https://github.com/ikopylov)) +- افزودن `generateRandom` تابع جدول برای تولید ردیف تصادفی با طرح داده شده است. اجازه می دهد تا به جمعیت جدول تست دلخواه با داده ها. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([ایلیا یاتسیشین](https://github.com/qoega)) +- `JSONEachRowFormat`: پشتیبانی از موارد خاص زمانی که اشیا محصور شده در مجموعه سطح بالا. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([کروگلو پاول](https://github.com/Avogar)) +- در حال حاضر امکان ایجاد یک ستون با `DEFAULT` عبارت که به یک ستون با پیش فرض بستگی دارد `ALIAS` اصطلاح. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([الساپین](https://github.com/alesapin)) +- اجازه مشخص کردن `--limit` بیش از اندازه منبع داده در `clickhouse-obfuscator`. داده ها خود را با دانه های مختلف تصادفی تکرار. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده `groupArraySample` تابع (شبیه به `groupArray`) با الگوریتم نمونه برداری ذخیره. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([ایموس پرنده](https://github.com/amosbird)) +- حالا شما می توانید اندازه صف به روز رسانی در نظارت `cache`/`complex_key_cache` واژهنامهها از طریق معیارهای سیستم. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- اجازه دهید به عنوان یک جداساز خط در فرمت خروجی سی. سی. وی با تنظیم استفاده کنید `output_format_csv_crlf_end_of_line` به 1 تنظیم شده است [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([میخیل کوروتف](https://github.com/millb)) +- اجرای توابع بیشتری از [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` و `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([نیکو مان پودری](https://github.com/nmandery)) +- تنظیمات جدید معرفی شده است: `max_parser_depth` برای کنترل حداکثر اندازه پشته و اجازه می دهد نمایش داده شد پیچیده بزرگ است. این رفع [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) و [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([ماکسیم اسمیرنوف](https://github.com/qMBQx8GH)) +- افزودن یک تنظیم `force_optimize_skip_unused_shards` تنظیم به پرتاب اگر پرش از خرده ریز استفاده نشده امکان پذیر نیست [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([ازات خوژین](https://github.com/azat)) +- مجاز به پیکربندی چندین دیسک / حجم برای ذخیره سازی داده ها برای ارسال در `Distributed` موتور [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([ازات خوژین](https://github.com/azat)) +- سیاست ذخیره سازی پشتیبانی (``)برای ذخیره سازی داده های موقت . [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([ازات خوژین](https://github.com/azat)) +- اضافه شده `X-ClickHouse-Exception-Code` هدر قام است که اگر استثنا قبل از ارسال داده ها پرتاب شد. این پیاده سازی [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([میخیل کوروتف](https://github.com/millb)) +- اضافه شدن تابع `ifNotFinite`. این فقط یک شکر نحوی است: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده `last_successful_update_time` ستون در `system.dictionaries` جدول [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- افزودن `blockSerializedSize` تابع (اندازه بر روی دیسک بدون فشرده سازی) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([ازات خوژین](https://github.com/azat)) +- افزودن تابع `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([هکز](https://github.com/hczhcz)) +- جداول سیستم اضافه شده است `system.zeros` و `system.zeros_mt` و همچنین توابع داستان `zeros()` و `zeros_mt()`. جداول (و توابع جدول) شامل یک ستون با نام `zero` و نوع `UInt8`. این ستون حاوی صفر. این است که برای اهداف تست به عنوان سریع ترین روش برای تولید بسیاری از ردیف مورد نیاز است. این رفع [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) + +#### ویژگی تجربی {#experimental-feature} + +- اضافه کردن فرمت جمع و جور جدید از قطعات در `MergeTree`- جداول خانواده که در تمام ستون ها در یک فایل ذخیره می شود . این کمک می کند برای افزایش عملکرد درج کوچک و مکرر. فرمت قدیمی (یک فایل در هر ستون) در حال حاضر گسترده ای نامیده می شود. فرمت ذخیره سازی داده ها توسط تنظیمات کنترل می شود `min_bytes_for_wide_part` و `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([انتون پوپوف](https://github.com/CurtizJ)) +- پشتیبانی از ذخیره سازی اس 3 برای `Log`, `TinyLog` و `StripeLog` میز [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([پاول کووالنکو](https://github.com/Jokser)) + +#### رفع اشکال {#bug-fix-2} + +- فضاهای خالی متناقض ثابت در پیام های ورود به سیستم. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال که در مجموعه ای از تاپل نامش ذکر نشده به عنوان ساختارهای تو در تو در ایجاد جدول پهن شد. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([اچولکوف2](https://github.com/achulkov2)) +- ثابت موضوع زمانی که “Too many open files” خطا ممکن است رخ دهد اگر بیش از حد بسیاری از فایل های تطبیق الگوی لکه در وجود دارد `File` جدول یا `file` تابع جدول. در حال حاضر فایل ها باز تنبلی. این رفع [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- قطره جدول موقت در حال حاضر قطره تنها جدول موقت. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([ویتالی بارانو](https://github.com/vitlibar)) +- حذف پارتیشن منسوخ شده زمانی که ما خاموش کردن سرور و یا جدا / ضمیمه یک جدول. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- برای چگونه دیسک پیش فرض محاسبه فضای رایگان از `data` شاخه فرعی. ثابت موضوع زمانی که مقدار فضای رایگان به درستی محاسبه نمی شود اگر `data` دایرکتوری به یک دستگاه جداگانه (مورد نادر) نصب شده است. این رفع [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([میخیل کوروتف](https://github.com/millb)) +- اجازه کاما (صلیب) عضویت با در () داخل. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([زویکوف](https://github.com/4ertus2)) +- اجازه می دهد به بازنویسی صلیب به درونی ملحق اگر وجود دارد \[نه\] مانند اپراتور در جایی که بخش. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([زویکوف](https://github.com/4ertus2)) +- رفع نتیجه نادرست ممکن است پس از `GROUP BY` با تنظیم فعال `distributed_aggregation_memory_efficient`. رفع [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- کلید پیدا شده است به عنوان در معیارهای لغت نامه کش از دست رفته شمارش شد. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- رفع ناسازگاری پروتکل تکرار معرفی شده در [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([الساپین](https://github.com/alesapin)) +- شرایط مسابقه ثابت در `queue_task_handle` در هنگام راه اندازی `ReplicatedMergeTree` میز [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رمز `NOT` جواب نداد `SHOW TABLES NOT LIKE` پرسوجو [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن محدوده چک به تابع `h3EdgeLengthM`. بدون این چک, سرریز بافر امکان پذیر است. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال در محاسبات باریکش از عملیات منطقی سه تایی در استدلال های متعدد (بیش از 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([الکساندر کازاکوف](https://github.com/Akazz)) +- رفع خطای prewhere بهینه سازی است که می تواند منجر به segfaults یا `Inconsistent number of columns got from MergeTreeRangeReader` استثنا. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع غیر منتظره `Timeout exceeded while reading from socket` استثنا, که به طور تصادفی در اتصال امن اتفاق می افتد قبل از ایست در واقع بیش از حد و هنگامی که پیشفیلتر پرس و جو فعال است. همچنین اضافه کنید `connect_timeout_with_failover_secure_ms` تنظیمات (به طور پیش فرض 100 مگابایت), که شبیه به است `connect_timeout_with_failover_ms`, اما برای اتصالات امن استفاده می شود (به دلیل دست دادن اس اس ال کندتر است, از اتصال تی پی معمولی) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع اشکال با جهش نهایی, زمانی که جهش ممکن است در حالت قطع با `parts_to_do=0` و `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([الساپین](https://github.com/alesapin)) +- استفاده از جدید هر پیوستن به منطق با `partial_merge_join` تنظیمات. این ممکن است به `ANY|ALL|SEMI LEFT` و `ALL INNER` می پیوندد با `partial_merge_join=1` حالا [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([زویکوف](https://github.com/4ertus2)) +- سفال در حال حاضر بست تنظیمات کردم از مبتکر به مواضع سفال به جای پرتاب یک استثنا. این ثابت اجازه می دهد تا برای ارسال نمایش داده شد به یک سفال با محدودیت های دیگر. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([ویتالی بارانو](https://github.com/vitlibar)) +- مشکل مدیریت حافظه ثابت در `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- ثابت `toDecimal*OrNull()` توابع خانواده که با رشته به نام `e`. رفع [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([زویکوف](https://github.com/4ertus2)) +- اطمینان حاصل کنید که `FORMAT Null` هیچ اطلاعاتی را به مشتری ارسال نمی کند. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- رفع اشکال که برچسب زمان در `LiveViewBlockInputStream` به روز نمی. `LIVE VIEW` یکی از ویژگی های تجربی است. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([وکسیدر](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([وکسیدر](https://github.com/Vxider)) +- ثابت `ALTER MODIFY TTL` رفتار اشتباه است که اجازه نمی دهد به حذف عبارات قدیمی. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- گزارش ثابت اوبسان در ادغام. این رفع [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفتار را ثابت کرد `match` و `extract` توابع زمانی که کومه علف خشک است صفر بایت. رفتار اشتباه بود که کومه علف خشک ثابت بود. این رفع [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از پرتاب از تخریب کننده در کتابخانه ’ 3-حزب خود نمایی. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([اندرو انیشچوک](https://github.com/oandrew)) +- هنوز یک دسته نظرسنجی از مرتکب نشده `Kafka` تا حدی که می تواند به سوراخ در داده ها منجر شود. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([فیلیمونف](https://github.com/filimonov)) +- ثابت `joinGet` با انواع بازگشت باطل. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([ایموس پرنده](https://github.com/amosbird)) +- رفع ناسازگاری داده ها در هنگام فشرده با `T64` وابسته به کدک. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([زویکوف](https://github.com/4ertus2)) رفع شناسه نوع داده در `T64` کدک فشرده سازی است که منجر به اشتباه (د) فشرده سازی در نسخه های تحت تاثیر قرار. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([زویکوف](https://github.com/4ertus2)) +- افزودن تنظیمات `enable_early_constant_folding` و در برخی موارد که منجر به خطا غیر فعال کنید. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([زویکوف](https://github.com/4ertus2)) +- رفع pushdown گزاره optimizer با مشاهده و فعال کردن آزمون [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([زمستان ژانگ](https://github.com/zhang2014)) +- رفع segfault در `Merge` جداول, که می تواند رخ دهد در هنگام خواندن از `File` ذخیره سازی [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([تاولوبیکس](https://github.com/tavplubix)) +- اضافه شدن یک چک برای سیاست ذخیره سازی در `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. در غیر این صورت می تواند داده ها از بخش غیر قابل دسترس پس از راه اندازی مجدد و جلوگیری از کلیک برای شروع. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اصلاح تغییر می دهد اگر برای جدول تنظیم شده است. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع شرایط مسابقه است که می تواند رخ دهد که `SYSTEM RELOAD ALL DICTIONARIES` اعدام در حالی که برخی از فرهنگ لغت است که اصلاح/اضافه/حذف شده است. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([ویتالی بارانو](https://github.com/vitlibar)) +- در نسخه های قبلی `Memory` موتور پایگاه داده استفاده از مسیر داده خالی, بنابراین جداول در ایجاد `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([تاولوبیکس](https://github.com/tavplubix)) +- ثابت پیام ورود به سیستم اشتباه در مورد از دست رفته دیسک به طور پیش فرض و یا سیاست. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- ثابت نیست (است ()) برای شاخص نفخ\_فیلتر از انواع مجموعه. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([ایشیمب](https://github.com/achimbab)) +- اجازه دادن ستون اول (ها) در یک جدول با `Log` موتور یک نام مستعار است [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([ایوان](https://github.com/abyss7)) +- رفع منظور از محدوده در حالی که خواندن از `MergeTree` جدول در یک موضوع. این می تواند به استثنا از منجر `MergeTreeRangeReader` یا نتایج پرس و جو اشتباه است. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([انتون پوپوف](https://github.com/CurtizJ)) +- ساخت `reinterpretAsFixedString` برای بازگشت `FixedString` به جای `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([اندرو انیشچوک](https://github.com/oandrew)) +- اجتناب از موارد بسیار نادر زمانی که کاربر می تواند پیغام خطا اشتباه دریافت کنید (`Success` به جای شرح خطا دقیق). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- هنگام استفاده از تصادف نکنید `Template` قالب با قالب ردیف خالی. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- فایل های ابرداده برای جداول سیستم را می توان در جای اشتباه ایجاد شده است [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([تاولوبیکس](https://github.com/tavplubix)) رفع [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). +- رفع مسابقه داده ها به استثنای در فرهنگ لغت کش [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- یک استثنا برای پرس و جو پرتاب نکنید `ATTACH TABLE IF NOT EXISTS`. پیش از این پرتاب شد اگر جدول در حال حاضر وجود دارد, با وجود `IF NOT EXISTS` بند بند. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([انتون پوپوف](https://github.com/CurtizJ)) +- ثابت بسته شدن از دست رفته پین در پیام استثنا. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از پیام `Possible deadlock avoided` در راه اندازی تاتر مشتری در حالت تعاملی. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت موضوع زمانی که بالشتک در پایان پایگاه64 ارزش کد گذاری را می توان ناقص. به روز رسانی پایگاه64 کتابخانه. این رفع [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491) بسته [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- جلوگیری از از دست دادن داده ها در `Kafka` در موارد نادر زمانی که استثنا اتفاق می افتد پس از خواندن پسوند اما قبل از ارتکاب. رفع [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([فیلیمونف](https://github.com/filimonov)) +- استثنا ثابت در `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([نیکیتا واسیلیف](https://github.com/nikvas0)) +- رفع سقوط زمانی که یک کاربر تلاش می کند `ALTER MODIFY SETTING` برای قدیمی شکل گرفته `MergeTree` موتورهای جدول خانواده. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([الساپین](https://github.com/alesapin)) +- پشتیبانی از uint64 اعداد است که مناسب نیست در int64 در json-توابع مربوط. به روز رسانی سیمدجسون به استاد. این رفع [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت اعدام inversed predicates که غیر به شدت monotinic عملکردی شاخص استفاده شده است. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([الکساندر کازاکوف](https://github.com/Akazz)) +- سعی نکنید به برابر `IN` ثابت در `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([ایموس پرنده](https://github.com/amosbird)) +- رفع اشکال در `ALTER DELETE` جهش که منجر به شاخص فساد. این رفع [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) و [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). علاوه بر این رفع شرایط مسابقه بسیار نادر در `ReplicatedMergeTree` `ALTER` نمایش داده شد. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([الساپین](https://github.com/alesapin)) +- هنگامی که تنظیمات `compile_expressions` فعال است, شما می توانید `unexpected column` داخل `LLVMExecutableFunction` هنگامی که ما با استفاده از `Nullable` نوع [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- رفع چندگانه برای `Kafka` موتور: 1) ثابت تکراری که در طول توازن گروه مصرف کننده ظاهر شد. 2) رفع نادر ‘holes’ به نظر می رسد زمانی که داده ها از چندین پارتیشن با یک نظرسنجی نظرسنجی نظرسنجی نظرسنجی شد و تا حدی متعهد (در حال حاضر ما همیشه پردازش / مرتکب کل نظرسنجی بلوک از پیام). 3) رفع حملات گرگرفتگی با اندازه بلوک (قبل از که تنها با فاصله گرگرفتگی به درستی کار می کرد). 4) روش اشتراک بهتر (با بازخورد انتساب). 5) را تست کار سریع تر (با فواصل پیش فرض و وقفه). با توجه به این واقعیت است که داده ها توسط اندازه بلوک قبل از سرخ نیست (همانطور که باید با توجه به اسناد و مدارک), که روابط عمومی ممکن است به برخی از تخریب عملکرد با تنظیمات پیش فرض منجر شود (با توجه به بیشتر & حملات گرگرفتگی قلع که کمتر بهینه هستند). اگر موضوع عملکرد شما روبرو می شوند که پس از تغییر - لطفا افزایش می دهد `kafka_max_block_size` در جدول به ارزش بزرگتر ( به عنوان مثال `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). رفع [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([فیلیمونف](https://github.com/filimonov)) +- ثابت `Parameter out of bound` استثنا در برخی از نمایش داده شد پس از بهینه سازی در همه جا. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) +- ثابت مورد مخلوط ثابت استدلال از تابع `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- هنگام اجرای `CREATE` پرس و جو, برابر عبارات ثابت در استدلال موتور ذخیره سازی. جایگزین کردن نام دادگان خالی با دادگان فعلی. رفع [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([تاولوبیکس](https://github.com/tavplubix)) +- در حال حاضر امکان ایجاد یا اضافه کردن ستون ها با نام مستعار چرخه ای ساده مانند وجود ندارد `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([الساپین](https://github.com/alesapin)) +- رفع اشکال با حرکت دو که ممکن است بخش اصلی فاسد است. این مربوط است اگر شما استفاده کنید `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اجازه داده شود `interval` شناسه به درستی تجزیه و تحلیل بدون پشت. موضوع ثابت زمانی که پرس و جو نمی تواند اجرا شود حتی اگر `interval` شناسه در پشت و یا به نقل از دو محصور. این رفع [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تست ریش ریش شدن ثابت و رفتار نادرست از `bitTestAll`/`bitTestAny` توابع. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع سقوط احتمالی / تعداد اشتباه ردیف در `LIMIT n WITH TIES` هنگامی که بسیاری از ردیف به نفر ردیف برابر وجود دارد. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع جهش با قطعات نوشته شده با فعال `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([الساپین](https://github.com/alesapin)) +- رفع مسابقه داده ها در نابودی `Poco::HTTPServer`. این می تواند رخ دهد زمانی که سرور شروع شده است و بلافاصله تعطیل. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع اشکال که در هنگام اجرای پیغام خطای گمراه کننده نشان داده شده است `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([اچولکوف2](https://github.com/achulkov2)) +- ثابت `Parameters are out of bound` استثنا در برخی موارد نادر زمانی که ما یک ثابت در `SELECT` بند زمانی که ما یک `ORDER BY` و یک `LIMIT` بند بند. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- رفع جهش نهایی, زمانی که در حال حاضر انجام جهش می تواند وضعیت را داشته باشد `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([الساپین](https://github.com/alesapin)) +- جلوگیری از اجرای `ALTER ADD INDEX` برای جداول ادغام با نحو قدیمی, چرا که کار نمی کند. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([میخیل کوروتف](https://github.com/millb)) +- در هنگام راه اندازی سرور جدول دسترسی پیدا کنید, که `LIVE VIEW` بستگی دارد, بنابراین سرور قادر به شروع خواهد بود. همچنین حذف `LIVE VIEW` وابستگی زمانی که جدا `LIVE VIEW`. `LIVE VIEW` یکی از ویژگی های تجربی است. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع اشکال احتمالی در `MergeTreeRangeReader`, در حالی که اجرای `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع چک عدم تطابق ممکن است با ستون. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع اشکال زمانی که قطعات شد که در پس زمینه با قوانین تغییر زمان در مورد نقل مکان کرد زمانی که تنها یک حجم وجود دارد. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- ثابت موضوع `Method createColumn() is not implemented for data type Set`. این رفع [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر ما سعی خواهد کرد نهایی جهش بیشتر. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([الساپین](https://github.com/alesapin)) +- ثابت `intDiv` توسط منهای یک ثابت [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([هکز](https://github.com/hczhcz)) +- رفع شرایط مسابقه ممکن است در `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع اشکال منجر به ختم سرور در هنگام تلاش برای استفاده / رها کردن `Kafka` جدول ایجاد شده با اشتباه پارامترهای. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([فیلیمونف](https://github.com/filimonov)) +- اضافه شده راه حل اگر سیستم عامل نتیجه اشتباه را برمی گرداند `timer_create` تابع. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خطای ثابت در استفاده از `min_marks_for_seek` پارامتر. ثابت پیام خطا زمانی که هیچ کلید شارژ در جدول توزیع وجود دارد و ما سعی می کنیم به جست و خیز خرده ریز استفاده نشده. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([ازات خوژین](https://github.com/azat)) + +#### بهبود {#improvement} + +- پیاده سازی `ALTER MODIFY/DROP` نمایش داده شد در بالای جهش برای `ReplicatedMergeTree*` خانواده موتور. حالا `ALTERS` بلوک تنها در مرحله به روز رسانی ابرداده, و بعد از که مسدود نمی. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([الساپین](https://github.com/alesapin)) +- اضافه کردن توانایی بازنویسی صلیب به درونی می پیوندد با `WHERE` بخش حاوی نام بدون تغییر. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([زویکوف](https://github.com/4ertus2)) +- ساخت `SHOW TABLES` و `SHOW DATABASES` نمایش داده شد حمایت از `WHERE` عبارات و `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([بستنی و مغز گردو](https://github.com/sundy-li)) +- اضافه شدن یک تنظیم `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([اوریخی](https://github.com/urykhy)) +- پس از تغییرات اخیر مشتری خروجی زیر شروع به چاپ رشته های باینری در سحر و جادو در نتیجه ساخت قابل خواندن نیست ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). راه حل در محل کلیک است به علامت ستون رشته به عنوان سخن گفتن-8, که همیشه نمی, اما معمولا مورد. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([یوری بارانوف](https://github.com/yurriy)) +- اضافه کردن پشتیبانی از رشته و کلید رشته برای `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) +- کلید های رشته پشتیبانی در نقشه های خلاصه [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) +- سیگنال ختم موضوع به استخر موضوع حتی اگر موضوع استثنا پرتاب کرده است [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) +- مجاز به تنظیم `query_id` داخل `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([انتون پوپوف](https://github.com/CurtizJ)) +- اجازه نمی دهد عبارات عجیب و غریب در `ALTER TABLE ... PARTITION partition` پرس و جو. این آدرس [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- جدول `system.table_engines` در حال حاضر اطلاعات در مورد پشتیبانی از ویژگی فراهم می کند (مانند `supports_ttl` یا `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([مکس اخمدوف](https://github.com/zlobober)) +- فعالسازی `system.metric_log` به طور پیش فرض. آن را شامل ردیف های با ارزش از ProfileEvents, CurrentMetrics جمع آوری شده با “collect\_interval\_milliseconds” فاصله (یک ثانیه به طور پیش فرض). جدول بسیار کوچک است (معمولا به ترتیب مگابایت) و جمع اوری این داده ها به طور پیش فرض معقول است. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([ایوان](https://github.com/abyss7)) +- در حال حاضر موقت `LIVE VIEW` ایجاد شده توسط `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` به جای `CREATE TEMPORARY LIVE VIEW ...`, چرا که نحو قبلی بود سازگار با نیست `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([تاولوبیکس](https://github.com/tavplubix)) +- اضافه کردن \_خروج.پارامتر پیکربندی سطح برای محدود کردن ورودی که می رود به `system.text_log` جدول [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([ازات خوژین](https://github.com/azat)) +- اجازه می دهد برای قرار دادن بخش دانلود شده به دیسک/حجم با توجه به قوانین تی ال [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- برای لغت نامه خروجی زیر خارجی, اجازه می دهد برای تغییر دادن خروجی زیر استخر اتصال به “share” در میان واژهنامهها. این گزینه به طور قابل توجهی تعداد اتصالات به سرور خروجی زیر را کاهش می دهد. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- نمایش نزدیکترین زمان اجرای پرس و جو برای کوانتوم در `clickhouse-benchmark` خروجی به جای مقادیر درونیابی. بهتر است برای نشان دادن ارزش هایی که مربوط به زمان اجرای برخی از نمایش داده شد. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- امکان اضافه کردن کلید و زمان بندی برای پیام هنگام قرار دادن داده ها به کافکا. رفع [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([فیلیمونف](https://github.com/filimonov)) +- اگر سرور از ترمینال اجرا, تعداد موضوع برجسته, شناسه پرس و جو و اولویت ورود به سیستم با رنگ. این است که برای خوانایی بهبود یافته از پیام ورود به سیستم در ارتباط برای توسعه دهندگان. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پیام استثنا بهتر در حالی که بارگذاری جداول برای `Ordinary` پایگاه داده است. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پیاده سازی `arraySlice` برای ارریس با عملکرد کل ایالات. این رفع [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجازه می دهد توابع ثابت و مجموعه های ثابت در سمت راست در اپراتور استفاده می شود. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([انتون پوپوف](https://github.com/CurtizJ)) +- اگر استثنا باغ وحش اتفاق افتاده است در حالی که واکشی داده ها برای سیستم.تکرار, نمایش در یک ستون جداگانه. این پیاده سازی [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بطور عام حذف قطعات داده ادغام در نابود کردن. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([ولادیمیر چبوتراف](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)) +- جلوگیری از حافظه در حالی که ساخت نتیجه یک بزرگ بپیوندید. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([زویکوف](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)) +- ستون اضافه شده `exception_code` داخل `system.query_log` جدول [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([میخیل کوروتف](https://github.com/millb)) +- فعال خروجی زیر سرور سازگاری در بندر `9004` در فایل پیکربندی سرور به طور پیش فرض. دستور تولید رمز عبور ثابت در مثال در پیکربندی. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([یوری بارانوف](https://github.com/yurriy)) +- جلوگیری از سقط جنین در خاموش کردن اگر سیستم فایل به صورت خوانده است. این رفع [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پیام استثنا بهتر زمانی که طول در قام پست پرس و جو مورد نیاز است. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- افزودن `_path` و `_file` ستون مجازی به `HDFS` و `File` موتور و `hdfs` و `file` توابع جدول [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- رفع خطا `Cannot find column` در حالی که قرار دادن به `MATERIALIZED VIEW` در صورتی که اگر ستون جدید برای مشاهده جدول داخلی اضافه شد. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع پیشرفت بیش از پروتکل کلاینت سرور بومی, با ارسال پیشرفت پس از به روز رسانی نهایی (مانند سیاهههای مربوط). این ممکن است تنها مربوط به برخی از ابزار های شخص ثالث که با استفاده از پروتکل های بومی. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([ازات خوژین](https://github.com/azat)) +- اضافه کردن یک سیستم متریک ردیابی تعداد اتصالات مشتری با استفاده از پروتکل خروجی زیر ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([یوجین کلیموف](https://github.com/Slach)) +- از این به بعد پاسخ های اچ تی پی `X-ClickHouse-Timezone` هدر را به مقدار منطقه زمانی همان است که `SELECT timezone()` دوست گزارش. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([دنیس گلازاشف](https://github.com/traceon)) + +#### بهبود عملکرد {#performance-improvement} + +- بهبود عملکرد شاخص تجزیه و تحلیل با در [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([انتون پوپوف](https://github.com/CurtizJ)) +- کد ساده تر و موثر تر در توابع منطقی + پاکسازی کد. پیگیری به [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([الکساندر کازاکوف](https://github.com/Akazz)) +- بهبود عملکرد کلی (در محدوده 5%..200% برای نمایش داده شد تحت تاثیر قرار) با تضمین و حتی بایاس سخت تر با ج++20 ویژگی های. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([ایموس پرنده](https://github.com/amosbird)) +- مقایسه دقیق تر برای حلقه های داخلی توابع مقایسه. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بایاس سخت تر برای حلقه داخلی از توابع ریاضی. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- A ~3 بار سریع تر برای اجرای ColumnVector::تکرار () از طریق آن ColumnConst::convertToFullColumn() اجرا شده است. همچنین در تست مفید خواهد بود که تحقق ثابت. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([الکساندر کازاکوف](https://github.com/Akazz)) +- یکی دیگر از بهبود عملکرد کوچک به `ColumnVector::replicate()` (این سرعت `materialize` عملکرد و توابع سفارش بالاتر) بهبود و حتی بیشتر به [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([الکساندر کازاکوف](https://github.com/Akazz)) +- بهبود عملکرد `stochasticLinearRegression` تابع جمع. این پچ توسط اینتل کمک. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهبود عملکرد `reinterpretAsFixedString` تابع. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بلوک ها را به مشتری ارسال نکنید `Null` فرمت در پردازنده خط لوله. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([الکساندر کوزمنکوف](https://github.com/akuzm)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement} + +- سیستم های انتقال مواد استثنا در حال حاضر به درستی کار می کند در زیر سیستم ویندوز برای لینوکس. ببینید https://github.com/clickhouse-extras/libunwind/pull/3 این رفع [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([سوبولسو](https://github.com/sobolevsv)) +- جایگزینی `readline` با `replxx` برای ویرایش خط تعاملی در `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([ایوان](https://github.com/abyss7)) +- بهتر است زمان ساخت و کمتر در قالب instantiations در functionscomparison. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ادغام اضافه شده با `clang-tidy` در سی. همچنین نگاه کنید به [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر ما لینک کلیک در سی با استفاده از `lld` حتی برای `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([الساپین](https://github.com/alesapin)) +- اجازه می دهد به صورت تصادفی برنامه ریزی موضوع و درج اشکالات زمانی که `THREAD_FUZZER_*` متغیرهای محیطی تنظیم شده است. این کمک می کند تا تست. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- فعال کردن سوکت امن در تست بدون تابعیت [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([تاولوبیکس](https://github.com/tavplubix)) +- را split\_shared\_libraries=خاموش قوی تر [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([ازات خوژین](https://github.com/azat)) +- ساخت “performance\_introspection\_and\_logging” تست قابل اعتماد به سرور تصادفی گیر کرده است. این ممکن است در محیط زیست سی اتفاق می افتد. همچنین نگاه کنید به [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اعتبار میلی لیتر در چک سبک. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شرایط مسابقه ثابت در تست `00738_lock_for_inner_table`. این تست به خواب متکی بود. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تست عملکرد نوع را حذف کنید `once`. این مورد نیاز است برای اجرای تمام تست های عملکرد در حالت مقایسه استاتیک (قابل اعتماد تر). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده تست عملکرد برای توابع ریاضی. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تست عملکرد اضافه شده برای `sumMap` و `sumMapWithOverflow` توابع مجموع. پیگیری برای [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اطمینان از سبک کد های خطا با چک سبک. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن اسکریپت برای تست تاریخ. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([الساپین](https://github.com/alesapin)) +- افزودن هشدار شورای همکاری خلیج فارس `-Wsuggest-override` برای قرار دادن و رفع تمام مکان هایی که `override` کلمه کلیدی باید استفاده شود. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([کروزرکریگ](https://github.com/kreuzerkrieg)) +- نادیده گرفتن نماد ضعیف تحت سیستم عامل مک ایکس زیرا باید تعریف شود [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([کاربر حذفشده](https://github.com/ghost)) +- عادی زمان در حال اجرا از برخی از نمایش داده شد در تست عملکرد. این است که در تهیه برای اجرای تمام تست های عملکرد در حالت مقایسه انجام می شود. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع برخی از تست ها برای حمایت از تست های پرس و جو [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([ایوان](https://github.com/abyss7)) +- فعال کردن اس اس ال در ساخت با ام اس ان, بنابراین سرور نمی خواهد شکست در هنگام راه اندازی در حال اجرا تست بدون تابعیت [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع جایگزینی پایگاه داده در نتایج تست [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([ایلیا یاتسیشین](https://github.com/qoega)) +- ساخت رفع برای سیستم عامل های دیگر [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([پرولر](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([پرولر](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([پرولر](https://github.com/proller)) +- اضافه شدن بخش دیسک به بدون تابعیت با پوشش تصویر داکر تست [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([پاول کووالنکو](https://github.com/Jokser)) +- خلاص شدن از شر در منبع درخت فایل در هنگام ساخت با پتروشیمی [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([ایموس پرنده](https://github.com/amosbird)) +- زمان ساخت کمی سریع تر با از بین بردن تجزیه طلبان از زمینه. کد را ساده تر کنید. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز شده در چک کردن برای نمایش داده شد را قطع کرد در اسکریپت کلیک تست [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([الکساندر کازاکوف](https://github.com/Akazz)) +- حذف برخی از فایل های بی فایده از مخزن. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نوع تغییر کامل ریاضی از `once` به `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اضافه کردن تصویر کارگر بارانداز که اجازه می دهد تا برای ساخت کد تعاملی مرورگر گزارش متنی برای کدهای ما. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([الساپین](https://github.com/alesapin)) ببینید [مرورگر کد ووبوک](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) +- سرکوب برخی از شکست تست تحت مسان. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- افزایش سرعت “exception while insert” امتحان این تست اغلب زمان در اشکال زدایی با پوشش ساخت. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز شده `libcxx` و `libcxxabi` به سلامتی استاد در تهیه به [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع تست پوسته شدن `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- پاک کردن پرچم لینکر تکرار. اطمینان حاصل کنید که لینکر نمی خواهد نگاه کردن یک نماد غیر منتظره. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([ایموس پرنده](https://github.com/amosbird)) +- افزودن `clickhouse-odbc` درایور را به تصاویر تست. این اجازه می دهد تا به تست تعامل ClickHouse با ClickHouse از طریق خود ODBC driver. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([فیلیمونف](https://github.com/filimonov)) +- رفع چندین باگ در تست واحد. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([الساپین](https://github.com/alesapin)) +- فعالسازی `-Wmissing-include-dirs` هشدار شورای همکاری خلیج فارس برای از بین بردن تمام غیر موجود شامل-عمدتا به عنوان یک نتیجه از خطاهای برنامه نویسی کیک [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([کروزرکریگ](https://github.com/kreuzerkrieg)) +- توصیف دلایل اگر پیشفیلتر پرس و جو نمی تواند کار کند. این است که برای در نظر گرفته شده [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز رسانی اپنسسل به بالادست استاد. ثابت موضوع زمانی که اتصالات ال اس ممکن است با پیام شکست `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` و `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. این موضوع در حال حاضر در نسخه 20.1 بود. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز رسانی صفحه مدیریت برای سرور [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([ایلیا مزایف](https://github.com/ne-ray)) +- اصلاحات جزیی در ساخت شورای همکاری خلیج فارس از منابع اسکریپت [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([مایکل ناچاروف](https://github.com/mnach)) +- جایگزینی `numbers` به `zeros` در کامل کجا `number` ستون استفاده نمی شود. این به نتایج تست تمیز تر منجر شود. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع مشکل سرریز پشته در هنگام استفاده از مقدار دهی اولیه در سازنده ستون. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([کاربر حذفشده](https://github.com/ghost)) +- ارتقا کتابدار به نسخه 1. 3.0. فعالسازی همراه `rdkafka` و `gsasl` کتابخانه ها در سیستم عامل مک ایکس. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([اندرو انیشچوک](https://github.com/oandrew)) +- ساخت ثابت در شورای همکاری خلیج فارس 9.2.0 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([وکسیدر](https://github.com/Vxider)) + +## انتشار کلیک و 20.1 {#clickhouse-release-v20-1} + +### ClickHouse انتشار V20.1.8.41, 2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} + +#### رفع اشکال {#bug-fix-3} + +- رفع همیشگی احتمالی `Cannot schedule a task` خطا (با توجه به استثنای بدون مانع در `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). این رفع [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([ازات خوژین](https://github.com/azat)) +- رفع مصرف حافظه بیش از حد در `ALTER` نمایش داده شد (جهش). این رفع [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) و [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([الساپین](https://github.com/alesapin)) +- رفع اشکال در عقب نشینی در لغت نامه های خارجی. این رفع [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([الساپین](https://github.com/alesapin)) + +### ClickHouse انتشار V20.1.7.38, 2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} + +#### رفع اشکال {#bug-fix-4} + +- ثابت نادرست نام تابع داخلی برای `sumKahan` و `sumWithOverflow`. من به استثنا منجر شود در حالی که با استفاده از این توابع در نمایش داده شد از راه دور. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([ازات خوژین](https://github.com/azat)). این موضوع در تمام نسخه های کلیک خانه بود. +- اجازه داده شود `ALTER ON CLUSTER` از `Distributed` جداول با تکرار داخلی. این رفع [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([شینی2](https://github.com/shinoi2)). این موضوع در تمام نسخه های کلیک خانه بود. +- رفع استثناهای احتمالی `Size of filter doesn't match size of column` و `Invalid number of rows in Chunk` داخل `MergeTreeRangeReader`. می توانند هنگام اجرای ظاهر شوند `PREWHERE` در برخی موارد. رفع [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([انتون پوپوف](https://github.com/CurtizJ)) +- ثابت موضوع: منطقه زمانی حفظ نشده بود اگر شما نوشتن یک عبارت ریاضی ساده مانند `time + 1` (در مقایسه با بیان مانند `time + INTERVAL 1 SECOND`). این رفع [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([الکسی میلویدو](https://github.com/alexey-milovidov)). این موضوع در تمام نسخه های کلیک خانه بود. +- در حال حاضر امکان ایجاد یا اضافه کردن ستون ها با نام مستعار چرخه ای ساده مانند وجود ندارد `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([الساپین](https://github.com/alesapin)) +- ثابت موضوع که بالشتک در پایان base64 کد گذاری ارزش می تواند ناقص. به روز رسانی پایگاه64 کتابخانه. این رفع [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491) بسته [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع مسابقه داده ها در نابودی `Poco::HTTPServer`. این می تواند رخ دهد زمانی که سرور شروع شده است و بلافاصله تعطیل. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع سقوط احتمالی / تعداد اشتباه ردیف در `LIMIT n WITH TIES` هنگامی که بسیاری از ردیف به نفر ردیف برابر وجود دارد. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع چک عدم تطابق ممکن است با ستون. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([انتون پوپوف](https://github.com/CurtizJ)) +- رفع سقوط زمانی که یک کاربر تلاش می کند `ALTER MODIFY SETTING` برای قدیمی شکل گرفته `MergeTree` موتورهای جدول خانواده. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([الساپین](https://github.com/alesapin)) +- در حال حاضر ما سعی خواهد کرد نهایی جهش بیشتر. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([الساپین](https://github.com/alesapin)) +- رفع ناسازگاری پروتکل تکرار معرفی شده در [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([الساپین](https://github.com/alesapin)) +- ثابت نیست (است ()) برای شاخص نفخ\_فیلتر از انواع مجموعه. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([ایشیمب](https://github.com/achimbab)) +- رفتار را ثابت کرد `match` و `extract` توابع زمانی که کومه علف خشک است صفر بایت. رفتار اشتباه بود که کومه علف خشک ثابت بود. این رفع [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-1} + +- سیستم های انتقال مواد استثنا در حال حاضر به درستی کار می کند در زیر سیستم ویندوز برای لینوکس. ببینید https://github.com/clickhouse-extras/libunwind/pull/3 این رفع [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([سوبولسو](https://github.com/sobolevsv)) + +### ClickHouse انتشار V20.1.6.30, 2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} + +#### رفع اشکال {#bug-fix-5} + +- رفع ناسازگاری داده ها در هنگام فشرده با `T64` وابسته به کدک. + [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(بی پایان 7)](https://github.com/abyss7) +- ثابت منظور از محدوده در حالی که خواندن از جدول ادغام در یک موضوع. رفع [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). + [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(کورتیزج)](https://github.com/CurtizJ) +- رفع اشکال احتمالی در `MergeTreeRangeReader`, در حالی که اجرای `PREWHERE`. رفع [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). + [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(کورتیزج)](https://github.com/CurtizJ) +- ثابت `reinterpretAsFixedString` برای بازگشت `FixedString` به جای `String`. + [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(اوندرو)](https://github.com/oandrew) +- ثابت `joinGet` با انواع بازگشت باطل. رفع [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) + [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(طرقه)](https://github.com/amosbird) +- تعمیر ریش ریش شدن آزمون و نادرست رفتار bittestall/bittestany توابع. + [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(الکسی میلویدو)](https://github.com/alexey-milovidov) +- رفع رفتار توابع بازی و استخراج زمانی که انبار کاه است صفر بایت. رفتار اشتباه بود که کومه علف خشک ثابت بود. رفع [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) + [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(الکسی میلویدو)](https://github.com/alexey-milovidov) +- ثابت اعدام inversed predicates که غیر به شدت monotinic عملکردی شاخص استفاده شده است. رفع [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) + [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(اکازز)](https://github.com/Akazz) +- اجازه به بازنویسی `CROSS` به `INNER JOIN` اگر وجود دارد `[NOT] LIKE` اپراتور در `WHERE` بخش. رفع [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) + [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4رتوس2)](https://github.com/4ertus2) +- اجازه ستون اول (بازدید کنندگان) در یک جدول با موتور ورود به سیستم یک نام مستعار. + [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(بی پایان 7)](https://github.com/abyss7) +- اجازه دادن به کاما از هم پیوستن با `IN()` داخل رفع [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). + [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4رتوس2)](https://github.com/4ertus2) +- بهبود `ALTER MODIFY/ADD` نمایش داده شد منطق. حالا شما نمی توانید `ADD` ستون بدون نوع, `MODIFY` عبارت پیش فرض نوع ستون را تغییر نمی دهد و `MODIFY` نوع ارزش بیان پیش فرض را از دست نمی دهد. رفع [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). + [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(الساپین)](https://github.com/alesapin) +- رفع جهش نهایی, زمانی که جهش در حال حاضر انجام می شود می توانید وضعیت داشته باشد \_دون=0. + [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(الساپین)](https://github.com/alesapin) +- پشتیبانی “Processors” خط لوله برای سیستم.اعداد و سیستم.\_شماره. این نیز رفع اشکال زمانی که `max_execution_time` محترم نیست. + [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [.)](https://github.com/KochetovNicolai) +- رفع شمارش اشتباه از `DictCacheKeysRequestedFound` متریک. + [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(نیکیتامیخایلو)](https://github.com/nikitamikhaylov) +- اضافه شدن یک چک برای سیاست ذخیره سازی در `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` که در غیر این صورت می تواند داده ها از بخش غیر قابل دسترس پس از راه اندازی مجدد و جلوگیری از کلیک برای شروع. + [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(هیجان)](https://github.com/excitoon) +- گزارش ثابت اوبسان در `MergeTreeIndexSet`. این رفع [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) + [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(الکسی میلویدو)](https://github.com/alexey-milovidov) +- رفع فضای داده ممکن در بلوکیو. + [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [.)](https://github.com/KochetovNicolai) +- پشتیبانی از `UInt64` اعداد است که متناسب نیست در درون64 در توابع مربوط به جانسون. بهروزرسانی `SIMDJSON` به سلامتی استاد این رفع [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) + [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(الکسی میلویدو)](https://github.com/alexey-milovidov) +- رفع مشکل زمانی که مقدار فضای رایگان به درستی محاسبه نمی شود اگر دایرکتوری داده ها به یک دستگاه جداگانه نصب شود. برای دیسک پیش فرض محاسبه فضای رایگان از دایرکتوری فرعی داده ها. این رفع [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) + [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(میلب)](https://github.com/millb) +- رفع مشکل زمانی که اتصالات ال اس ممکن است با پیام شکست `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` به روز رسانی اپنسسل به بالادست استاد. + [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(الکسی میلویدو)](https://github.com/alexey-milovidov) +- هنگام اجرای `CREATE` پرس و جو, برابر عبارات ثابت در استدلال موتور ذخیره سازی. جایگزین کردن نام دادگان خالی با دادگان فعلی. رفع [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). همچنین رفع بررسی برای نشانی های محلی در کلیک کنیدشاهارزش. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(تبلوبیکس)](https://github.com/tavplubix) +- رفع segfault در `StorageMerge`, که می تواند در هنگام خواندن از داستان اتفاق می افتد. + [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(تبلوبیکس)](https://github.com/tavplubix) +- جلوگیری از از دست دادن داده ها در `Kafka` در موارد نادر زمانی که استثنا اتفاق می افتد پس از خواندن پسوند اما قبل از ارتکاب. رفع [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). مرتبط: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(فیلیمونف)](https://github.com/filimonov) +- رفع اشکال منجر به ختم سرور در هنگام تلاش برای استفاده / رها کردن `Kafka` جدول ایجاد شده با پارامترهای اشتباه. رفع [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). دارای [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(فیلیمونف)](https://github.com/filimonov) + +#### ویژگی جدید {#new-feature-1} + +- افزودن `deduplicate_blocks_in_dependent_materialized_views` گزینه ای برای کنترل رفتار درج ژولیده به جداول با نمایش محقق. این ویژگی جدید توسط یک درخواست ویژه از التیت به نسخه رفع اشکال اضافه شد. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [.)](https://github.com/urykhy) + +### ClickHouse انتشار V20.1.2.4, 2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} + +#### تغییر ناسازگار به عقب {#backward-incompatible-change-1} + +- ایجاد تنظیمات `merge_tree_uniform_read_distribution` منسوخ شده. سرور هنوز این تنظیم به رسمیت می شناسد اما هیچ اثر. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- نوع بازگشت تغییر از تابع `greatCircleDistance` به `Float32` چرا که در حال حاضر نتیجه محاسبه است `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر انتظار می رود که پارامترهای پرس و جو در “escaped” قالب. مثلا, به تصویب رشته `ab` شما باید برای نوشتن `a\tb` یا `a\b` و به ترتیب, `a%5Ctb` یا `a%5C%09b` در URL. این مورد نیاز است برای اضافه کردن امکان به تصویب تهی به عنوان `\N`. این رفع [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- فعالسازی `use_minimalistic_part_header_in_zookeeper` تنظیم برای `ReplicatedMergeTree` به طور پیش فرض. این به طور قابل توجهی مقدار داده های ذخیره شده در باغ وحش را کاهش دهد. این تنظیم از نسخه 19.1 پشتیبانی می شود و ما در حال حاضر در تولید خدمات متعدد بدون هیچ مشکلی برای بیش از نیم سال استفاده می کنیم. غیر فعال کردن این تنظیم اگر شما یک فرصت برای جمع و جور کردن به نسخه های قدیمی تر از 19.1. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شاخص های پرش داده ها تولید می شوند و به طور پیش فرض فعال می شوند. تنظیمات `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` و `allow_experimental_multiple_joins_emulation` در حال حاضر منسوخ و هیچ چیز. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- افزودن جدید `ANY JOIN` منطق برای `StorageJoin` سازگار با `JOIN` عمل به روز رسانی بدون تغییر در رفتار شما نیاز به اضافه کردن `SETTINGS any_join_distinct_right_table_keys = 1` به موتور پیوستن ابرداده جداول و یا از نو خلق این جداول پس از ارتقا دهید. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([زویکوف](https://github.com/4ertus2)) +- نیاز به سرور برای راه اندازی مجدد برای اعمال تغییرات در پیکربندی ورود به سیستم. این یک راه حل موقت برای جلوگیری از اشکال که سرور سیاهههای مربوط به یک فایل ورود به سیستم حذف شده است (دیدن [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([الکساندر کوزمنکوف](https://github.com/akuzm)) + +#### ویژگی جدید {#new-feature-2} + +- اطلاعات اضافه شده در مورد مسیرهای بخشی به `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- افزودن قابلیت اجرا `SYSTEM RELOAD DICTIONARY` پرسوجو در `ON CLUSTER` حالت. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) +- افزودن قابلیت اجرا `CREATE DICTIONARY` نمایش داده شد در `ON CLUSTER` حالت. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([الساپین](https://github.com/alesapin)) +- در حال حاضر مشخصات کاربر در `users.xml` می توانید پروفایل های متعدد به ارث می برند. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- اضافه شده `system.stack_trace` جدول که اجازه می دهد تا در اثری پشته از تمام موضوعات سرور نگاه. این برای توسعه دهندگان به درون نگری دولت سرور مفید است. این رفع [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- افزودن `DateTime64` نوع داده با دقت زیر دوم قابل تنظیم. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([واسیلی نمکو](https://github.com/Enmk)) +- اضافه کردن تابع جدول `clusterAllReplicas` که اجازه می دهد به پرس و جو تمام گره در خوشه. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([کیران سونکری](https://github.com/kiransunkari)) +- اضافه کردن تابع جمع `categoricalInformationValue` که محاسبه ارزش اطلاعات از ویژگی های گسسته. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([هکز](https://github.com/hczhcz)) +- سرعت تجزیه فایل های داده در `CSV`, `TSV` و `JSONEachRow` قالب با انجام این کار به صورت موازی. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- افزودن تابع `bankerRound` که انجام گرد بانکدار. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([هکز](https://github.com/hczhcz)) +- پشتیبانی از زبان های بیشتر در فرهنگ لغت تعبیه شده برای نام منطقه: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهبود در سازگاری `ANY JOIN` منطق. حالا `t1 ANY LEFT JOIN t2` برابر `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([زویکوف](https://github.com/4ertus2)) +- افزودن تنظیمات `any_join_distinct_right_table_keys` که رفتار قدیمی را قادر می سازد `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([زویکوف](https://github.com/4ertus2)) +- افزودن جدید `SEMI` و `ANTI JOIN`. قدیمی `ANY INNER JOIN` رفتار در حال حاضر به عنوان در دسترس `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([زویکوف](https://github.com/4ertus2)) +- اضافه شده `Distributed` قالب برای `File` موتور و `file` تابع جدول که اجازه می دهد تا از خواندن `.bin` فایل های تولید شده توسط درج ناهمزمان به `Distributed` جدول [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اضافه کردن استدلال ستون تنظیم مجدد اختیاری برای `runningAccumulate` که اجازه می دهد برای تنظیم مجدد نتایج تجمع برای هر مقدار کلید جدید. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([سرگی کنوننکو](https://github.com/kononencheg)) +- اضافه کردن توانایی استفاده از فاحشه خانه به عنوان نقطه پایانی پرومته. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([ولادیمیر](https://github.com/Vdimir)) +- اضافه کردن بخش `` داخل `config.xml` که میزبان مجاز برای موتورهای جدول از راه دور و توابع جدول را محدود می کند `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([میخیل کوروتف](https://github.com/millb)) +- اضافه شدن تابع `greatCircleAngle` که محاسبه فاصله در یک کره در درجه. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- شعاع زمین تغییر می شود سازگار با ساعت3 کتابخانه. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شده `JSONCompactEachRow` و `JSONCompactEachRowWithNamesAndTypes` فرمت برای ورودی و خروجی. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([میخیل کوروتف](https://github.com/millb)) +- ویژگی اضافه شده برای موتورهای جدول مربوط به فایل و توابع جدول (`File`, `S3`, `URL`, `HDFS`) که اجازه می دهد به خواندن و نوشتن `gzip` فایل ها بر اساس پارامتر موتور اضافی و یا فرمت فایل. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([هشدار داده می شود](https://github.com/apbodrov)) +- اضافه شدن `randomASCII(length)` تابع, تولید یک رشته با یک مجموعه تصادفی از [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) شخصیت های قابل چاپ. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([سرنیزه](https://github.com/BayoNet)) +- اضافه شدن تابع `JSONExtractArrayRaw` که مجموعه ای از عناصر مجموعه ای از جیسون نامحدود را باز می کند `JSON` رشته. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([اولگ متررخین](https://github.com/errx)) +- افزودن `arrayZip` تابع است که اجازه می دهد تا به ترکیب مجموعه ای از چند بند از طول برابر به یک مجموعه ای از تاپل. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([زمستان ژانگ](https://github.com/zhang2014)) +- اضافه کردن توانایی انتقال داده ها بین دیسک ها با توجه به پیکربندی `TTL`- عبارات برای `*MergeTree` موتورهای جدول خانواده. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اضافه شدن تابع جمع جدید `avgWeighted` که اجازه می دهد برای محاسبه میانگین وزن. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([هشدار داده می شود](https://github.com/apbodrov)) +- در حال حاضر تجزیه موازی به طور پیش فرض برای فعال `TSV`, `TSKV`, `CSV` و `JSONEachRow` فرمتها. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- اضافه کردن چندین توابع جغرافیایی از `H3` کتابخانه: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` و `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([کنستانتین مالانچو](https://github.com/hombit)) +- اضافه شدن پشتیبانی برای برتلی (`br`) فشرده سازی در ذخیره سازی مربوط به فایل و توابع جدول . این رفع [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- افزودن `groupBit*` توابع برای `SimpleAggregationFunction` نوع. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) + +#### رفع اشکال {#bug-fix-6} + +- رفع تغییر نام جداول با `Distributed` موتور رفع مشکل [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([تاولوبیکس](https://github.com/tavplubix)) +- در حال حاضر پشتیبانی لغت نامه `EXPRESSION` برای ویژگی های در رشته دلخواه در گویش غیر کلیک میدان. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([الساپین](https://github.com/alesapin)) +- رفع شکسته `INSERT SELECT FROM mysql(...)` پرس و جو. این رفع [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) و [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع خطا “Mismatch column sizes” هنگام وارد کردن پیشفرض `Tuple` از `JSONEachRow`. این رفع [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([تاولوبیکس](https://github.com/tavplubix)) +- در حال حاضر یک استثنا خواهد شد در صورت استفاده از پرتاب `WITH TIES` در کنار `LIMIT BY`. همچنین توانایی استفاده را اضافه کنید `TOP` با `LIMIT BY`. این رفع [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- رفع unintendent وابستگی از تازه glibc نسخه در `clickhouse-odbc-bridge` دودویی. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([ایموس پرنده](https://github.com/amosbird)) +- رفع اشکال در بررسی عملکرد `*MergeTree` خانواده موتور. در حال حاضر در صورتی که زمانی که ما مقدار مساوی از ردیف در گرانول گذشته و علامت گذشته (غیر نهایی) شکست نیست. [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([الساپین](https://github.com/alesapin)) +- رفع درج در `Enum*` ستون پس از `ALTER` پرس و جو, زمانی که زمینه ای نوع عددی به جدول نوع مشخص برابر است. این رفع [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([انتون پوپوف](https://github.com/CurtizJ)) +- مجاز منفی غیر ثابت “size” استدلال برای عملکرد `substring`. این اشتباه مجاز نیست. این رفع [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال تجزیه زمانی که تعداد اشتباه استدلال به تصویب رسید `(O|J)DBC` موتور جدول. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([الساپین](https://github.com/alesapin)) +- با استفاده از نام فرمان از روند در حال اجرا خانه کلیک در هنگام ارسال سیاهههای مربوط به سیسلوگ. در نسخه های قبلی, رشته خالی به جای نام فرمان مورد استفاده قرار گرفت. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([مایکل ناچاروف](https://github.com/mnach)) +- رفع چک میزبان مجاز برای `localhost`. این روابط عمومی رفع راه حل در [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع سقوط نادر در `argMin` و `argMax` توابع برای استدلال رشته طولانی, زمانی که نتیجه در استفاده `runningAccumulate` تابع. این رفع [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([دایناسور](https://github.com/769344359)) +- رفع بیش از حد حافظه برای جداول با `Buffer` موتور [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([ازات خوژین](https://github.com/azat)) +- اشکال بالقوه ثابت در توابع است که می تواند `NULL` به عنوان یکی از استدلال و بازگشت غیر تهی. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- معیارهای محاسبات بهتر در استخر موضوع برای فرایندهای پس زمینه برای `MergeTree` موتورهای جدول. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- تابع ثابت `IN` داخل `WHERE` بیانیه ای که در سطح ردیف فیلتر جدول وجود دارد. رفع [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([ایوان](https://github.com/abyss7)) +- در حال حاضر یک استثنا پرتاب می شود اگر ارزش جدایی ناپذیر است به طور کامل برای مقادیر تنظیمات تجزیه نشده است. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([میخیل کوروتف](https://github.com/millb)) +- رفع استثنا زمانی که عملکرد دانه ها در پرس و جو به جدول توزیع شده با بیش از دو خرده ریز محلی استفاده می شود. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- در حال حاضر فیلتر بلوم می توانید طول صفر عرایز رسیدگی می کند و محاسبات کار برکنار شده انجام نمی دهد. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([ایشیمب](https://github.com/achimbab)) +- چک کردن ثابت اگر یک میزبان مشتری با تطبیق میزبان مشتری به اجازه `host_regexp` مشخص شده در `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([ویتالی بارانو](https://github.com/vitlibar)) +- استراحت چک ستون مبهم است که منجر به مثبت کاذب در چند `JOIN ON` بخش. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([زویکوف](https://github.com/4ertus2)) +- ثابت سقوط سرور ممکن است (`std::terminate`) هنگامی که سرور نمی تواند ارسال و یا نوشتن داده ها در `JSON` یا `XML` قالب با مقادیر `String` نوع داده (که نیاز به `UTF-8` اعتبار سنجی) و یا زمانی که فشرده سازی داده های نتیجه با الگوریتم برتلی و یا در برخی موارد نادر دیگر. این رفع [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع شرایط مسابقه در `StorageDistributedDirectoryMonitor` پیدا شده توسط سی. این رفع [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- در حال حاضر پس زمینه ادغام در `*MergeTree` جدول موتورهای خانواده حفظ سیاست ذخیره سازی حجم سفارش دقیق تر است. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- در حال حاضر موتور جدول `Kafka` به درستی کار می کند با `Native` قالب. این رفع [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([فیلیمونف](https://github.com/filimonov)) +- فرمت های ثابت با هدر (مانند `CSVWithNames`) که پرتاب شد استثنا در مورد ایف برای موتور جدول `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([فیلیمونف](https://github.com/filimonov)) +- رفع اشکال با ساخت مجموعه ای از زیرخاکری در قسمت سمت راست از `IN` بخش. این رفع [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) و [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- رفع سقوط احتمالی در هنگام خواندن از ذخیره سازی `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- خواندن ثابت از فایل ها در `Parquet` قالب حاوی ستونهای نوع `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([مکسولان](https://github.com/maxulan)) +- رفع خطا `Not found column` برای نمایش داده شد توزیع با `PREWHERE` شرایط وابسته به کلید نمونه برداری اگر `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع خطا `Not found column` اگر پرسوجو استفاده شود `PREWHERE` وابسته به نام مستعار جدول و مجموعه نتیجه به دلیل شرایط کلیدی اولیه خالی بود. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- نوع بازگشت ثابت برای توابع `rand` و `randConstant` در صورت `Nullable` استدلال کردن. در حال حاضر توابع همیشه بازگشت `UInt32` و هرگز `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- پیش فرض غیر فعال فشار پایین برای `WITH FILL` اصطلاح. این رفع [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([زمستان ژانگ](https://github.com/zhang2014)) +- نادرست ثابت `count()` نتیجه برای `SummingMergeTree` چه زمانی `FINAL` بخش استفاده شده است. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- رفع نتیجه نادرست ممکن است برای توابع ثابت از سرور از راه دور. این برای نمایش داده شد با توابع مانند اتفاق افتاد `version()`, `uptime()`, و غیره. که برمی گرداند مقادیر ثابت مختلف برای سرورهای مختلف. این رفع [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع اشکال پیچیده در بهینه سازی پیش فرض فشار به پایین که منجر به نتایج اشتباه است. این مشکلات زیادی را در بهینه سازی پیش فرض پایین حل می کند. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([زمستان ژانگ](https://github.com/zhang2014)) +- رفع سقوط در `CREATE TABLE .. AS dictionary` پرس و جو. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([ازات خوژین](https://github.com/azat)) +- چند بهبود دستور زبان کلیک در `.g4` پرونده. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) +- رفع اشکال که منجر به سقوط در `JOIN`با جداول با موتور `Join`. این رفع [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([زویکوف](https://github.com/4ertus2)) +- رفع لغت نامه کار برکنار بارگذاری مجدد در `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([ازات خوژین](https://github.com/azat)) +- محدود کردن حداکثر تعداد جریان برای خواندن از `StorageFile` و `StorageHDFS`. رفع https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([الساپین](https://github.com/alesapin)) +- رفع اشکال در `ALTER ... MODIFY ... CODEC` پرس و جو, زمانی که کاربر هر دو عبارت به طور پیش فرض و کدک را مشخص کنید. رفع [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([الساپین](https://github.com/alesapin)) +- رفع خطا در ادغام پس زمینه ستون ها با `SimpleAggregateFunction(LowCardinality)` نوع. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- بررسی نوع ثابت در عملکرد `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([واسیلی نمکو](https://github.com/Enmk)) +- در حال حاضر سرور در سقوط نیست `LEFT` یا `FULL JOIN` با و پیوستن به موتور و پشتیبانی نشده `join_use_nulls` تنظیمات. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([زویکوف](https://github.com/4ertus2)) +- حالا `DROP DICTIONARY IF EXISTS db.dict` پرس و جو می کند و پرتاب استثنا اگر `db` وجود نداره [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([ویتالی بارانو](https://github.com/vitlibar)) +- رفع سقوط احتمالی در توابع جدول (`file`, `mysql`, `remote`) ناشی از استفاده از مرجع به حذف `IStorage` اعتراض. رفع تجزیه نادرست از ستون مشخص شده در درج به تابع جدول. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([تاولوبیکس](https://github.com/tavplubix)) +- اطمینان از شبکه قبل از شروع `clickhouse-server`. این رفع [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([ژیچنگ یو](https://github.com/yuzhichang)) +- رفع وقفه دست زدن به برای اتصالات امن, بنابراین نمایش داده شد می کند بی تعریف قطع نمی. این رفع [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `clickhouse-copier`مشاجره کار برکنار بین کارگران همزمان. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) +- در حال حاضر جهش می کند قطعات متصل جست و خیز نیست, حتی اگر نسخه جهش خود را بزرگتر از نسخه جهش فعلی بود. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([ژیچنگ یو](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([الساپین](https://github.com/alesapin)) +- چشمپوشی از نسخههای برکنار شده `*MergeTree` قطعات داده ها پس از حرکت به یکی دیگر از دیسک و سرور راه اندازی مجدد. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع سقوط در `FULL JOIN` با `LowCardinality` داخل `JOIN` کلیدی است. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([زویکوف](https://github.com/4ertus2)) +- ممنوع به استفاده از نام ستون بیش از یک بار در قرار دادن پرس و جو مانند `INSERT INTO tbl (x, y, x)`. این رفع [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([الساپین](https://github.com/alesapin)) +- اضافه شدن مجدد برای تشخیص تعداد هسته های پردازنده فیزیکی برای پردازنده ناشناخته (با استفاده از تعدادی از هسته های پردازنده منطقی). این رفع [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `There's no column` خطا برای مفردات و نام مستعار ستون. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([زویکوف](https://github.com/4ertus2)) +- تصادف شدید ثابت زمانی که `EXISTS` پرس و جو بدون استفاده شد `TABLE` یا `DICTIONARY` مقدماتی. درست مثل `EXISTS t`. این رفع [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). این اشکال در نسخه 19.17 معرفی شد. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشکال نادر با خطا `"Sizes of columns doesn't match"` که ممکن است به نظر می رسد در هنگام استفاده از `SimpleAggregateFunction` ستون. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([بوریس گرانویو](https://github.com/bgranvea)) +- رفع اشکال که کاربر با خالی است `allow_databases` دسترسی به تمام پایگاه های داده کردم (و همین کار را برای `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([دوفایت](https://github.com/DeifyTheGod)) +- رفع سقوط مشتری زمانی که سرور در حال حاضر از مشتری قطع شده است. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([ازات خوژین](https://github.com/azat)) +- ثابت `ORDER BY` رفتار در صورت مرتب سازی بر اساس پیشوند کلید اولیه و پسوند کلید غیر اولیه. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([انتون پوپوف](https://github.com/CurtizJ)) +- بررسی کنید که در حال حاضر ستون واجد شرایط در جدول. این رفع [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([زویکوف](https://github.com/4ertus2)) +- رفتار ثابت با `ALTER MOVE` فرار بلافاصله پس از ادغام پایان حرکت سوپر شروع مشخص شده است. رفع [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع سقوط سرور ممکن است در حالی که با استفاده از `UNION` با شماره های مختلف ستون. رفع [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع اندازه زیر رشته نتیجه برای عملکرد `substr` با اندازه منفی. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- در حال حاضر سرور جهش بخشی در اجرا نیست `MergeTree` اگر موضوعات رایگان به اندازه کافی در استخر پس زمینه وجود ندارد. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع خطای تایپی کوچک در قالب بندی `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([لیتا91](https://github.com/litao91)) +- ثابت نتایج فیلتر شکوفه نادرست برای اعداد منفی. این رفع [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([زمستان ژانگ](https://github.com/zhang2014)) +- سرریز بافر بالقوه ثابت در حالت فشرده خارج. کاربر مخرب می تواند داده های فشرده ساخته شده است که باعث می شود پس از بافر به عنوان خوانده شده منتقل می کند. این موضوع توسط الدار زیتوف از تیم امنیت اطلاعات یاندکس یافت شد. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع نتیجه نادرست به دلیل سرریز اعداد صحیح در `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- حالا `OPTIMIZE TABLE` پرس و جو نمی خواهد برای کپی نیست منتظر به انجام عملیات. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([جوی سانتانا](https://github.com/javisantana)) +- ثابت `ALTER TTL` تجزیه کننده برای `Replicated*MergeTree` میز [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع ارتباط بین سرور و کلاینت, بنابراین سرور خواندن اطلاعات جداول موقت پس از شکست پرس و جو. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([ازات خوژین](https://github.com/azat)) +- ثابت `bitmapAnd` خطای تابع هنگام تقاطع کردن بیت مپ جمع و بیت مپ اسکالر. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([یو هوانگ](https://github.com/moon03432)) +- اصلاح تعریف `ZXid` با توجه به راهنمای برنامه نویس باغ وحش که رفع اشکال در `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) +- `odbc` تابع جدول در حال حاضر احترام می گذارد `external_table_functions_use_nulls` تنظیمات. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([واسیلی نمکو](https://github.com/Enmk)) +- اشکال ثابت که منجر به یک مسابقه داده نادر است. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([الکساندر کازاکوف](https://github.com/Akazz)) +- حالا `SYSTEM RELOAD DICTIONARY` بارگذاری مجدد یک فرهنگ لغت به طور کامل, نادیده گرفتن `update_field`. این رفع [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([ویتالی بارانو](https://github.com/vitlibar)) +- اضافه کردن توانایی برای بررسی اگر فرهنگ لغت در ایجاد پرس و جو وجود دارد. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([الساپین](https://github.com/alesapin)) +- ثابت `Float*` تجزیه در `Values` قالب. این رفع [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([تاولوبیکس](https://github.com/tavplubix)) +- رفع سقوط زمانی که ما نمی توانیم فضای ذخیره در برخی از عملیات پس زمینه از `*MergeTree` موتورهای جدول خانواده. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- رفع سقوط عملیات ادغام زمانی که جدول شامل `SimpleAggregateFunction(LowCardinality)` ستون. این رفع [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([ازات خوژین](https://github.com/azat)) +- بازگرداندن پشتیبانی از تمام مناطق فناوری اطلاعات و ارتباطات و اضافه کردن توانایی به درخواست تلفیقی برای عبارات ثابت. همچنین نام زبان را اضافه کنید `system.collations` جدول [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([الساپین](https://github.com/alesapin)) +- رفع اشکال در هنگام خارجی لغت نامه صفر و حداقل طول عمر (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) در پس زمینه به روز رسانی نیست . [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([الساپین](https://github.com/alesapin)) +- رفع تصادف در هنگام فرهنگ لغت خارجی با منبع کلیک است زیرخاکی در پرس و جو. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- رفع نادرست تجزیه پسوند فایل در جدول با موتور `URL`. این رفع [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([هشدار داده می شود](https://github.com/apbodrov)) +- ثابت `CHECK TABLE` پرسوجو برای `*MergeTree` جداول بدون کلید. رفع [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([الساپین](https://github.com/alesapin)) +- تبدیل ثابت از `Float64` به نوع خروجی زیر. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([یوری بارانوف](https://github.com/yurriy)) +- در حال حاضر اگر جدول به طور کامل به دلیل سقوط سرور کاهش یافته است, سرور سعی خواهد کرد برای بازگرداندن و بارگذاری. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([تاولوبیکس](https://github.com/tavplubix)) +- تصادف ثابت در عملکرد جدول `file` در حالی که قرار دادن به فایل که وجود ندارد. در حال حاضر در این مورد فایل ایجاد می شود و سپس قرار دادن پردازش می شود. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- رفع بن بست نادر است که می تواند زمانی اتفاق می افتد `trace_log` در را فعال کنید. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([فیلیمونف](https://github.com/filimonov)) +- اضافه کردن توانایی برای کار با انواع مختلف علاوه بر `Date` داخل `RangeHashed` فرهنگ لغت خارجی ایجاد شده از پرس و جو دی ال. رفع [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([الساپین](https://github.com/alesapin)) +- رفع سقوط زمانی که `now64()` با نتیجه تابع دیگری نامیده می شود. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([واسیلی نمکو](https://github.com/Enmk)) +- اشکال ثابت با تشخیص قانون مجازات اسلامی مشتری برای اتصال به شبکه از طریق پروتکل سیم خروجی زیر. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([دیمیتری موزیکا](https://github.com/dmitriy-myz)) +- رفع دست زدن به مجموعه خالی در `arraySplit` تابع. این رفع [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([هکز](https://github.com/hczhcz)) +- ثابت موضوع زمانی که `pid-file` از یکی دیگر از در حال اجرا `clickhouse-server` ممکن است حذف شود. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing زو](https://github.com/weiqxu)) +- رفع بارگذاری مجدد فرهنگ لغت در صورتی که `invalidate_query` که متوقف به روز رسانی و برخی از استثنا در به روز رسانی قبلی تلاش می کند. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([الساپین](https://github.com/alesapin)) +- ثابت خطا در تابع `arrayReduce` که ممکن است منجر به “double free” و خطا در ترکیب تابع کل `Resample` که ممکن است به نشت حافظه منجر شود. اضافه شدن تابع جمع `aggThrow`. این تابع را می توان برای اهداف تست استفاده کرد. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### بهبود {#improvement-1} + +- ورود به سیستم بهبود یافته در هنگام کار با `S3` موتور جدول. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([گریگوری پرواکوف](https://github.com/GrigoryPervakov)) +- پیام راهنما چاپ شده زمانی که هیچ استدلال در هنگام تماس گذشت `clickhouse-local`. این رفع [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([هشدار داده می شود](https://github.com/Melancholic)) +- افزودن تنظیمات `mutations_sync` که اجازه می دهد تا صبر کنید `ALTER UPDATE/DELETE` نمایش داده شد همزمان. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([الساپین](https://github.com/alesapin)) +- اجازه برای راه اندازی نسبی `user_files_path` داخل `config.xml` (در راه شبیه به `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([هکز](https://github.com/hczhcz)) +- اضافه کردن استثنا برای انواع غیر قانونی برای توابع تبدیل با `-OrZero` پسوند. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([اندری کونیایف](https://github.com/akonyaev90)) +- ساده فرمت هدر داده ارسال به سفال در پرس و جو توزیع شده است. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([ویتالی بارانو](https://github.com/vitlibar)) +- `Live View` تعمیر مجدد موتور جدول. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) +- اضافه کردن چک های اضافی برای لغت نامه های خارجی ایجاد شده از دی ال نمایش داده شد. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([الساپین](https://github.com/alesapin)) +- رفع خطا `Column ... already exists` در حالی که با استفاده از `FINAL` و `SAMPLE` together, e.g. `select count() from table final sample 1/2`. رفع [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- در حال حاضر جدول استدلال اول `joinGet` تابع می تواند جدول شناسایی. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([ایموس پرنده](https://github.com/amosbird)) +- اجازه استفاده `MaterializedView` با subqueries بالا `Kafka` میز [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([فیلیمونف](https://github.com/filimonov)) +- در حال حاضر پس زمینه بین دیسک ها حرکت می کند استخر تار شده را اجرا می کند. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- `SYSTEM RELOAD DICTIONARY` در حال حاضر اجرا همزمان. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([ویتالی بارانو](https://github.com/vitlibar)) +- ردیابی پشته در حال حاضر نمایش نشانی های فیزیکی (شیپور خاموشی در فایل شی) به جای نشانی های حافظه مجازی (جایی که فایل شی لود شد). که اجازه می دهد تا استفاده از `addr2line` هنگامی که باینری موقعیت مستقل است و اصل فعال است. این رفع [\#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)) +- حالا `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)) +- فعال خروجی زیر سرور سازگاری زمانی که تاتر بدون اس اس ال وارد شده است. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([یوری بارانوف](https://github.com/yurriy)) +- در حال حاضر چک سرور دسته توزیع, می دهد که خطاهای طولانی تر در مورد داده های خراب شده در دسته ای. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([ازات خوژین](https://github.com/azat)) +- پشتیبانی `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` و `ATTACH TABLE` برای `MySQL` موتور پایگاه داده. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([زمستان ژانگ](https://github.com/zhang2014)) +- اضافه کردن احراز هویت در اس 3 تابع جدول و موتور جدول. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اضافه شدن چک برای قطعات اضافی از `MergeTree` در دیسک های مختلف, به منظور اجازه نمی دهد به دست قطعات داده در دیسک تعریف نشده. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- فعال کردن پشتیبانی اس اس ال برای مشتری مک و سرور. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([ایوان](https://github.com/abyss7)) +- در حال حاضر clickhouse کار می تواند به عنوان خروجی يکپارچه سرور (دیدن https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([ماکسیم فدوتف](https://github.com/MaxFedotov)) +- `clickhouse-client` در حال حاضر تنها فعال `bracketed-paste` هنگامی که چند ضلعی روشن است و چند خطی خاموش است. این رفع (\#7757) \[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([ایموس پرنده](https://github.com/amosbird)) +- پشتیبانی `Array(Decimal)` داخل `if` تابع. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([زویکوف](https://github.com/4ertus2)) +- اعشار پشتیبانی در `arrayDifference`, `arrayCumSum` و `arrayCumSumNegative` توابع. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([زویکوف](https://github.com/4ertus2)) +- اضافه شده `lifetime` ستون به `system.dictionaries` جدول [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([کیککول](https://github.com/kekekekule)) +- بررسی بهبود یافته برای قطعات موجود بر روی دیسک های مختلف برای `*MergeTree` موتورهای جدول. نشانیهای [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- ادغام با `AWS SDK` برای `S3` فعل و انفعالات که اجازه می دهد تا به استفاده از تمام 3 ویژگی های خارج از جعبه. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([پاول کووالنکو](https://github.com/Jokser)) +- اضافه شدن پشتیبانی برای کارخانه های فرعی در `Live View` میز [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) +- بررسی برای استفاده از `Date` یا `DateTime` ستون از `TTL` عبارات حذف شد. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- اطلاعات در مورد دیسک به اضافه شد `system.detached_parts` جدول [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- در حال حاضر تنظیمات `max_(table|partition)_size_to_drop` را می توان بدون راه اندازی مجدد تغییر کرده است. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([گریگوری پرواکوف](https://github.com/GrigoryPervakov)) +- قابلیت استفاده کمی بهتر از پیام های خطا. از کاربر بخواهید که خطوط زیر را حذف کند `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- خواندن بهتر پیام ها از `Kafka` موتور در فرمت های مختلف پس از [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([ایوان](https://github.com/abyss7)) +- سازگاری بهتر با مشتریان خروجی زیر که پشتیبانی نمی کند `sha2_password` auth پلاگین. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([یوری baranov](https://github.com/yurriy)) +- پشتیبانی از انواع ستون بیشتر در خروجی زیر سرور سازگاری. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([یوری baranov](https://github.com/yurriy)) +- پیاده سازی `ORDER BY` بهینه سازی برای `Merge`, `Buffer` و `Materilized View` ذخیره سازی با زمینه `MergeTree` میز [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([انتون پوپوف](https://github.com/CurtizJ)) +- در حال حاضر ما همیشه اجرای پسوند استفاده از `getrandom` برای سازگاری بهتر با دانه های قدیمی (\<3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([ایموس پرنده](https://github.com/amosbird)) +- بررسی بهتر برای مقصد معتبر در یک قانون حرکت تغییر جنسیت. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- چک بهتر برای دسته درج شکسته برای `Distributed` موتور جدول. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([ازات خوژین](https://github.com/azat)) +- اضافه کردن ستون با مجموعه ای از نام قطعات که جهش باید در اینده پردازش به `system.mutations` جدول [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([الساپین](https://github.com/alesapin)) +- موازی با مرتب کردن بر اساس ادغام بهینه سازی برای پردازنده. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- تنظیمات `mark_cache_min_lifetime` در حال حاضر منسوخ و هیچ کاری نمی کند. در نسخه های قبلی, علامت گذاری به عنوان کش می تواند در حافظه بزرگتر از رشد `mark_cache_size` به جای داده ها در `mark_cache_min_lifetime` چند ثانیه که منجر به سردرگمی و استفاده از حافظه بالاتر از حد انتظار است که به خصوص بد در حافظه محدود سیستم. اگر شما تخریب عملکرد پس از نصب این نسخه را ببینید, شما باید افزایش `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- طرز تهیه برای استفاده `tid` همه جا این برای مورد نیاز است [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +#### بهبود عملکرد {#performance-improvement-1} + +- بهینه سازی عملکرد در خط لوله پردازنده. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- به روز رسانی غیر مسدود کردن کلید منقضی شده در لغت نامه کش (با اجازه خواندن قدیمی). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- کامپایل تاتر بدون `-fno-omit-frame-pointer` در سطح جهانی به فراغت یک ثبت نام بیشتر. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([ایموس پرنده](https://github.com/amosbird)) +- افزایش سرعت `greatCircleDistance` عملکرد و تست عملکرد را اضافه کنید. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([اولگا خوستیکوا](https://github.com/stavrolia)) +- بهبود عملکرد عملکرد `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهبود عملکرد `max`, `min`, `argMin`, `argMax` برای `DateTime64` نوع داده. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([واسیلی نمکو](https://github.com/Enmk)) +- بهبود عملکرد مرتب سازی بدون محدودیت و یا با حد بزرگ و مرتب سازی خارجی. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهبود عملکرد قالب بندی اعداد ممیز شناور تا 6 بار. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهبود عملکرد `modulo` تابع. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([ایموس پرنده](https://github.com/amosbird)) +- بهینهسازی شده `ORDER BY` و ادغام با کلید ستون. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجرای بهتر برای `arrayReduce`, `-Array` و `-State` ترکیب کننده ها [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([ایموس پرنده](https://github.com/amosbird)) +- حالا `PREWHERE` باید بهینه سازی شود حداقل به عنوان موثر به عنوان `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([ایموس پرنده](https://github.com/amosbird)) +- بهبود راه `round` و `roundBankers` دست زدن به اعداد منفی. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([هکز](https://github.com/hczhcz)) +- رمزگشایی بهبود عملکرد `DoubleDelta` و `Gorilla` کدک های تقریبا 30-40%. این رفع [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([واسیلی نمکو](https://github.com/Enmk)) +- بهبود عملکرد `base64` توابع مرتبط. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه شدن یک تابع `geoDistance`. این شبیه به `greatCircleDistance` اما با استفاده از تقریب به دندان-84 مدل بیضی. عملکرد هر دو توابع در نزدیکی یکسان هستند. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- سریع تر `min` و `max` توابع تجمع برای `Decimal` نوع داده. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([زویکوف](https://github.com/4ertus2)) +- Vectorize پردازش `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([ایموس پرنده](https://github.com/amosbird)) +- `if` زنجیر در حال حاضر به عنوان بهینه سازی شده `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([کمالف روسلان](https://github.com/kamalov-ruslan)) +- رفع رگرسیون عملکرد `Kafka` موتور جدول معرفی شده در 19.15. این رفع [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([فیلیمونف](https://github.com/filimonov)) +- حذف شد “pie” تولید کد که `gcc` از بسته های دبیان گاهی اوقات به طور پیش فرض به ارمغان بیاورد. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- موازی تجزیه فرمت های داده [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) +- به کار انداختن تجزیه کننده بهینه `Values` با عبارات به طور پیش فرض (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([تاولوبیکس](https://github.com/tavplubix)) + +#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-2} + +- ساخت رفع برای `ARM` و در حالت حداقل. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([پرولر](https://github.com/proller)) +- اضافه کردن پوشش خیط و پیت کردن فایل برای `clickhouse-server` وقتی بیماری مقاربتی:: اختلال نامیده می شود نیست. همچنین کمی بهبود یافته ورود به سیستم در تست بدون تابعیت با پوشش. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([الساپین](https://github.com/alesapin)) +- به روز رسانی llvm کتابخانه در contrib. اجتناب از استفاده از llvm از سیستم عامل بسته است. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- را همراه `curl` ساخت کاملا ساکت. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([پاول کووالنکو](https://github.com/Jokser)) +- رفع برخی از `MemorySanitizer` اخطار. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- استفاده `add_warning` و `no_warning` ماکروها در `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([ایوان](https://github.com/abyss7)) +- اضافه کردن پشتیبانی از minio s3 سازگار شی (https://min.io/) برای ادغام بهتر شد. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([پاول کووالنکو](https://github.com/Jokser)) +- وارد شده `libc` سرصفحهها به کنترب. این اجازه می دهد تا به ایجاد بیشتر سازگار در سراسر سیستم های مختلف (فقط برای `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حذف `-fPIC` از برخی از کتابخانه ها. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تمیز `CMakeLists.txt` برای حلقه. ببینید https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- هشدار خاموش در `CapNProto` کتابخونه. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اضافه کردن تست عملکرد برای رشته کوتاه بهینه سازی جداول هش. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([ایموس پرنده](https://github.com/amosbird)) +- در حال حاضر خانه کلیک بر روی ساخت `AArch64` حتی اگر `MADV_FREE` در دسترس نیست. این رفع [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([ایموس پرنده](https://github.com/amosbird)) +- بهروزرسانی `zlib-ng` برای رفع مشکلات ضدعفونی کننده حافظه. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- فعال کردن کتابخانه خروجی زیر داخلی در سیستم غیر لینوکس, به دلیل استفاده از بسته های سیستم عامل بسیار شکننده است و معمولا در همه کار نمی کند. این رفع [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ساخت ثابت در برخی از سیستم های پس از فعال کردن `libc++`. این جانشین [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ساخت `Field` مواد و روش ها نوع بیشتر-امن برای پیدا کردن خطاهای بیشتر. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- اضافه شده فایل های از دست رفته به `libc-headers` submodule. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع اشتباه `JSON` نقل قول در خروجی تست عملکرد. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- در حال حاضر ردیابی پشته برای نمایش داده می شود `std::exception` و `Poco::Exception`. در نسخه های قبلی فقط برای `DB::Exception`. این باعث بهبود تشخیص می شود. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بارینگ `clock_gettime` و `clock_nanosleep` برای نسخه های چرب زبان تازه. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([ایموس پرنده](https://github.com/amosbird)) +- فعالسازی `part_log` در مثال پیکربندی برای توسعه دهندگان. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- رفع ماهیت کالاهای کابل از بازنگری در `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([ازات خوژین](https://github.com/azat)) +- تست عملکرد کدک ثابت. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([واسیلی نمکو](https://github.com/Enmk)) +- اضافه کردن اسکریپت نصب برای `.tgz` ساخت و اسناد و مدارک برای خود. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([الساپین](https://github.com/alesapin)) +- حذف قدیمی `ZSTD` تست (این در سال 2016 ایجاد شد به تکثیر اشکال که قبل از 1.0 نسخه از زد تا به حال). این رفع [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ساخت ثابت در سیستم عامل مک کاتالینا. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([مو](https://github.com/meob)) +- افزایش تعداد ردیف در تست عملکرد کدک برای ایجاد نتایج قابل توجه است. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([واسیلی نمکو](https://github.com/Enmk)) +- در اشکال زدایی ایجاد, درمان `LOGICAL_ERROR` استثنا به عنوان شکست ادعای, به طوری که راحت تر به اطلاع. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- تست عملکرد مربوط به فرمت را قطعی تر کنید. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- بهروزرسانی `lz4` برای رفع یک شکست حفظ کننده. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- سرکوب یک یادداشت شناخته شده مثبت کاذب در دست زدن به استثنا. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- بهروزرسانی `gcc` و `g++` به نسخه 9 در `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([تلیتسکی](https://github.com/tlightsky)) +- اضافه کردن مورد تست عملکرد برای تست که `PREWHERE` بدتر از `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([ایموس پرنده](https://github.com/amosbird)) +- پیشرفت به سمت رفع یک تست فلکی. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- اجتناب از گزارش یادداشت برای داده ها از `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- به روز شده `libc++` به جدیدترین نسخه. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ساخت کتابخانه ایکو از منابع. این رفع [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تغییر از `libressl` به `openssl`. ClickHouse باید پشتیبانی از TLS 1.3 و SNI پس از این تغییر. این رفع [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- گزارش ثابت اوبسان هنگام استفاده `chacha20_poly1305` از اس اس ال (اتفاق می افتد در اتصال به https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- حالت ثابت فایل رمز عبور پیش فرض برای `.deb` توزیع لینوکس. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([پرولر](https://github.com/proller)) +- بیان بهبود یافته برای گرفتن `clickhouse-server` PID در `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([الکساندر کازاکوف](https://github.com/Akazz)) +- به روز شده در تماس/ماده چسبنده و لزج به نسخه برداری1.10.0. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([الکساندر بورمک](https://github.com/Alex-Burmak)) +- گزارش سه گانه ثابت در `base64` کتابخونه. همچنین این کتابخانه به جدیدترین نسخه به روز, اما مهم نیست. این رفع [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ثابت `00600_replace_running_query` برای پردازنده. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- حذف پشتیبانی برای `tcmalloc` برای ساخت `CMakeLists.txt` ساده تر [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- انتشار شورای همکاری خلیج فارس ایجاد در حال حاضر استفاده کنید `libc++` به جای `libstdc++`. اخیرا `libc++` تنها با صدای جرنگ جرنگ مورد استفاده قرار گرفت. این ثبات تنظیمات ساخت و قابلیت حمل را بهبود بخشد. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- فعال کردن کتابخانه فناوری اطلاعات و ارتباطات برای ساخت با حفظ. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- سرکوب هشدارها از `CapNProto` کتابخونه. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- موارد خاص حذف کد برای `tcmalloc`, زیرا دیگر پشتیبانی. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- کشتن سرور برازنده اجازه می دهد تا برای ذخیره گزارش پوشش. این رفع گزارش پوشش ناقص ما به تازگی دیدن شده است. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([الساپین](https://github.com/alesapin)) +- تست عملکرد برای تمام کدک در برابر `Float64` و `UInt64` ارزشهای خبری عبارتند از: [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([واسیلی نمکو](https://github.com/Enmk)) +- `termcap` بسیار توصیه شده و منجر به مشکلات مختلف (f.g. از دست رفته “up” کلاه و انعکاس `^J` به جای چند خط). به نفع `terminfo` یا همراه `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([ایموس پرنده](https://github.com/amosbird)) +- ثابت `test_storage_s3` تست ادغام. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- پشتیبانی `StorageFile(, null)` برای قرار دادن بلوک به فایل فرمت داده شده بدون در واقع به دیسک ارسال. این برای تست عملکرد مورد نیاز است. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([ایموس پرنده](https://github.com/amosbird)) +- استدلال اضافه شده `--print-time` به تست های عملکردی که زمان اجرای هر تست را چاپ می کند. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اضافه ادعا به `KeyCondition` در حالی که ارزیابی مالیات بر ارزش افزوده. این هشدار را از شورای همکاری خلیج فارس-9 حل کنند. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- تخلیه گزینه های چوب کوره در سی ایجاد. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- اطلاعات اشکال زدایی برای برخی از کتابخانه های چربی تولید نمی کند. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- ساخت `log_to_console.xml` همیشه به خ ورود, صرف نظر از تعاملی است یا نه. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([الکساندر کوزمنکوف](https://github.com/akuzm)) +- حذف برخی از ویژگی های استفاده نشده از `clickhouse-performance-test` ابزار. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- در حال حاضر ما نیز برای جستجو `lld-X` با متناظر `clang-X` نسخه. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([الساپین](https://github.com/alesapin)) +- پارکت ساخت بهبود. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([مکسولان](https://github.com/maxulan)) +- هشدارهای شورای همکاری خلیج فارس بیشتر [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([کروزرکریگ](https://github.com/kreuzerkrieg)) +- بسته بندی برای قوس لینوکس در حال حاضر اجازه می دهد تا برای اجرای سرور کلیک, و نه تنها مشتری. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([ولادیمیر چبوتراف](https://github.com/excitoon)) +- ثابت تست با پردازنده. رفع عملکرد کوچک. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) +- اطلاعات دقیق [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([هشدار داده می شود](https://github.com/matwey)) +- در تهیه تعویض به سی++20 به عنوان یک جشن سال نو. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([ایموس پرنده](https://github.com/amosbird)) + +#### ویژگی تجربی {#experimental-feature-1} + +- اضافه شدن تنظیمات تجربی `min_bytes_to_use_mmap_io`. این اجازه می دهد به خواندن فایل های بزرگ بدون کپی کردن داده ها از هسته به فضای کاربری. تنظیمات به طور پیش فرض غیر فعال. توصیه می شود در حدود 64 مگابایت است, چون اماسپ / مون مپ کند است. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([الکسی میلویدو](https://github.com/alexey-milovidov)) +- سهمیه به عنوان بخشی از سیستم کنترل دسترسی دوباره. جدول جدید اضافه شده است `system.quotas` توابع جدید `currentQuota`, `currentQuotaKey` نحو گذاشتن جدید `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([ویتالی بارانو](https://github.com/vitlibar)) +- اجازه پرش تنظیمات ناشناخته با هشدار به جای پرتاب استثنا. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([ویتالی بارانو](https://github.com/vitlibar)) +- سیاست های ردیف به عنوان بخشی از سیستم کنترل دسترسی دوباره. جدول جدید اضافه شده است `system.row_policies` تابع جدید `currentRowPolicies()` نحو گذاشتن جدید `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([ویتالی بارانو](https://github.com/vitlibar)) + +#### تعمیر امنیتی {#security-fix} + +- ثابت امکان خواندن ساختار دایرکتوری در جداول با `File` موتور جدول. این رفع [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([الکسی میلویدو](https://github.com/alexey-milovidov)) + +## [تغییرات برای 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/fa/whats_new/index.md b/docs/fa/whats-new/index.md similarity index 100% rename from docs/fa/whats_new/index.md rename to docs/fa/whats-new/index.md diff --git a/docs/fa/whats_new/roadmap.md b/docs/fa/whats-new/roadmap.md similarity index 100% rename from docs/fa/whats_new/roadmap.md rename to docs/fa/whats-new/roadmap.md diff --git a/docs/fa/whats_new/security_changelog.md b/docs/fa/whats-new/security-changelog.md similarity index 100% rename from docs/fa/whats_new/security_changelog.md rename to docs/fa/whats-new/security-changelog.md diff --git a/docs/fa/whats_new/changelog/2018.md b/docs/fa/whats_new/changelog/2018.md deleted file mode 100644 index 65d9b37dfc1..00000000000 --- a/docs/fa/whats_new/changelog/2018.md +++ /dev/null @@ -1,1063 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 78 -toc_title: '2018' ---- - -## انتشار کلیک 18.16 {#clickhouse-release-18-16} - -### انتشار کلیک 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} - -#### رفع اشکال: {#bug-fixes} - -- رفع خطا که به مشکلات با به روز رسانی لغت نامه با منبع ان بی سی منجر شده است. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- مجموعه دستگاه گوارش از توابع کل در حال حاضر با ستون های کمکاری کار می کند. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) - -#### بهبود: {#improvements} - -- اضافه شدن `low_cardinality_allow_in_native_format` تنظیم (فعال به طور پیش فرض). هنگامی که غیر فعال, ستون های کم هزینه خواهد شد به ستون های معمولی برای نمایش داده شد را انتخاب کنید تبدیل و ستون عادی خواهد شد برای قرار دادن نمایش داده شد انتظار می رود. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) - -#### بهبود ساخت: {#build-improvements} - -- رفع برای ایجاد بر روی مکینتاش و بازو. - -### انتشار کلیک 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} - -#### ویژگی های جدید: {#new-features} - -- `DEFAULT` عبارات برای زمینه های از دست رفته در هنگام بارگذاری داده ها در فرمت های ورودی نیمه ساختار ارزیابی (`JSONEachRow`, `TSKV`). این ویژگی با فعال `insert_sample_with_metadata` تنظیمات. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) -- این `ALTER TABLE` پرس و جو در حال حاضر `MODIFY ORDER BY` اقدام برای تغییر کلید مرتب سازی هنگام اضافه کردن یا حذف یک ستون جدول. این برای جداول در مفید است `MergeTree` خانواده ای که انجام کارهای اضافی در هنگام ادغام بر اساس این کلید مرتب سازی, مانند `SummingMergeTree`, `AggregatingMergeTree` و به همین ترتیب. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) -- برای جداول در `MergeTree` خانواده, در حال حاضر شما می توانید یک کلید مرتب سازی های مختلف را مشخص کنید (`ORDER BY`) و شاخص (`PRIMARY KEY`). کلید مرتب سازی می تواند طولانی تر از شاخص باشد. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) -- اضافه شدن `hdfs` عملکرد جدول و `HDFS` موتور جدول برای واردات و صادرات داده ها به اچ دی اف. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) -- اضافه شدن توابع برای کار بازه64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [الکساندر کرشنینیکف](https://github.com/ClickHouse/ClickHouse/pull/3350) -- حالا شما می توانید یک پارامتر برای پیکربندی دقت استفاده کنید `uniqCombined` تابع جمع (تعداد سلول های بیش از حد جمع را انتخاب کنید). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) -- اضافه شدن `system.contributors` جدول که شامل نام هر کسی که مرتکب در خانه کلیک ساخته شده. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) -- اضافه شدن توانایی حذف پارتیشن برای `ALTER TABLE ... FREEZE` پرس و جو به منظور پشتیبان گیری از تمام پارتیشن در یک بار. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) -- اضافه شده `dictGet` و `dictGetOrDefault` توابع که نیاز به تعیین نوع مقدار بازگشتی ندارند. نوع به طور خودکار از توضیحات فرهنگ لغت تعیین می شود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3564) -- حالا شما می توانید نظرات را برای یک ستون در توضیحات جدول مشخص کنید و با استفاده از تغییر دهید `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) -- خواندن برای پشتیبانی `Join` نوع جداول با کلید های ساده. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3728) -- حالا شما می توانید گزینه های مشخص `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join` و `join_overflow_mode` هنگام ایجاد یک `Join` جدول نوع. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3728) -- اضافه شدن `joinGet` تابع است که اجازه می دهد تا شما را به استفاده از یک `Join` نوع جدول مانند یک فرهنگ لغت. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3728) -- اضافه شدن `partition_key`, `sorting_key`, `primary_key` و `sampling_key` ستونها به `system.tables` جدول به منظور فراهم کردن اطلاعات در مورد کلید های جدول. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- اضافه شدن `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key` و `is_in_sampling_key` ستونها به `system.columns` جدول [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- اضافه شدن `min_time` و `max_time` ستونها به `system.parts` جدول این ستون ها جمعیت زمانی که کلید پارتیشن بندی بیان متشکل از است `DateTime` ستون ها [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) - -#### رفع اشکال: {#bug-fixes-1} - -- رفع و بهبود عملکرد برای `LowCardinality` نوع داده. `GROUP BY` با استفاده از `LowCardinality(Nullable(...))`. گرفتن ارزش `extremes`. پردازش توابع بالا سفارش. `LEFT ARRAY JOIN`. توزیع شده `GROUP BY`. توابع است که بازگشت `Array`. اعدام `ORDER BY`. نوشتن به `Distributed` جداول (نیکولولو). سازگاری به عقب برای `INSERT` نمایش داده شد از مشتریان قدیمی که پیاده سازی `Native` قانون پشتیبانی از `LowCardinality` برای `JOIN`. بهبود عملکرد در هنگام کار در یک جریان واحد. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) -- ثابت چگونه `select_sequential_consistency` گزینه کار می کند. قبلا, زمانی که این تنظیم فعال بود, نتیجه ناقص گاهی اوقات پس از شروع به نوشتن به یک پارتیشن جدید بازگردانده شد. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) -- پایگاه داده ها هنگام اجرای دی ال به درستی مشخص شده است `ON CLUSTER` نمایش داده شد و `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- پایگاه داده ها به درستی برای کارخانه های فرعی در داخل یک نمایش مشخص شده است. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) -- رفع اشکال در `PREWHERE` با `FINAL` برای `VersionedCollapsingMergeTree`. [7167بد7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) -- حالا شما می توانید استفاده کنید `KILL QUERY` برای لغو نمایش داده شد که هنوز شروع نشده است زیرا انتظار دارند جدول قفل شود. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) -- اصلاح محاسبات تاریخ و زمان اگر ساعت در نیمه شب منتقل شد (این اتفاق می افتد در ایران, و در مسکو از اتفاق افتاد 1981 به 1983). قبلا, این منجر به زمان در حال تنظیم مجدد یک روز زودتر از حد لازم, و همچنین باعث قالب بندی نادرست از تاریخ و زمان در قالب متن. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) -- اشکالات ثابت در برخی موارد `VIEW` و کارخانه های فرعی که حذف پایگاه داده. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3521) -- ثابت شرایط مسابقه زمانی که به طور همزمان از یک خواندن `MATERIALIZED VIEW` و حذف یک `MATERIALIZED VIEW` با توجه به قفل کردن داخلی `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) -- خطا را ثابت کرد `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) -- پردازش پرس و جو ثابت زمانی که `compile_expressions` گزینه فعال است(به طور پیش فرض فعال است). عبارات ثابت نامشخص مانند `now` تابع دیگر گشوده. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) -- ثابت تصادف در هنگام مشخص کردن یک استدلال مقیاس غیر ثابت در `toDecimal32/64/128` توابع. -- ثابت خطا در هنگام تلاش برای وارد کردن مجموعه ای با `NULL` عناصر در `Values` قالب در یک ستون از نوع `Array` بدون `Nullable` (اگر `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) -- ثابت ورود خطا مداوم در `DDLWorker` اگر باغ وحش در دسترس نیست. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) -- ثابت نوع بازگشت برای `quantile*` توابع از `Date` و `DateTime` انواع استدلال. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) -- ثابت `WITH` بند اگر یک نام مستعار ساده و بدون عبارات مشخص. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) -- پردازش ثابت نمایش داده شد با نام زیر نمایش داده شد و نام ستون واجد شرایط زمانی که `enable_optimize_predicate_expression` فعال است. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3588) -- خطا را ثابت کرد `Attempt to attach to nullptr thread group` در هنگام کار با نمایش محقق. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) -- ثابت تصادف در هنگام عبور استدلال نادرست خاص به `arrayReverse` تابع. [733ا7ب6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- ثابت سرریز بافر در `extractURLParameter` تابع. بهبود عملکرد. اضافه شده پردازش صحیح رشته حاوی صفر بایت. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) -- سرریز بافر ثابت در `lowerUTF8` و `upperUTF8` توابع. حذف توانایی برای اجرای این توابع بیش از `FixedString` استدلال نوع. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) -- ثابت شرایط مسابقه نادر در هنگام حذف `MergeTree` میز [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) -- ثابت شرایط مسابقه در هنگام خواندن از `Buffer` جداول و به طور همزمان انجام `ALTER` یا `DROP` در جداول هدف. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) -- ثابت segfault اگر `max_temporary_non_const_columns` حد بیش از حد شد. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### بهبود: {#improvements-1} - -- سرور فایل های پیکربندی پردازش شده را به `/etc/clickhouse-server/` فهرست راهنما. در عوض, این موجب صرفه جویی در `preprocessed_configs` فهرست راهنمای داخل `path`. این به این معنی است که `/etc/clickhouse-server/` دایرکتوری دسترسی نوشتن برای ندارد `clickhouse` کاربر, که باعث بهبود امنیت. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) -- این `min_merge_bytes_to_use_direct_io` گزینه به 10 دستگاه گوارش به طور پیش فرض تنظیم شده است. ادغام که بخش های زیادی از جداول از خانواده ادغام را تشکیل می دهد در انجام خواهد شد `O_DIRECT` حالت, که مانع از اخراج کش صفحه بیش از حد. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) -- شتاب سرور شروع زمانی که تعداد بسیار زیادی از جداول وجود دارد. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) -- اضافه شدن یک استخر اتصال و قام `Keep-Alive` برای ارتباط بین کپی. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) -- اگر نحو پرس و جو نامعتبر است `400 Bad Request` کد در بازگشت `HTTP` رابط (500 قبلا بازگردانده شد). [31ب680ا](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) -- این `join_default_strictness` گزینه تنظیم شده است `ALL` به طور پیش فرض برای سازگاری. [120الکترونیکی 2جبه](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) -- حذف ورود به سیستم `stderr` از `re2` کتابخانه برای عبارات منظم نامعتبر و یا پیچیده. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) -- اضافه شده برای `Kafka` موتور جدول: چک برای اشتراک قبل از شروع به خواندن از کافکا; تنظیمات کافکا\_مکس\_بلک\_سیز برای جدول. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) -- این `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32` و `murmurHash3_64` توابع در حال حاضر برای هر تعداد از استدلال و برای استدلال در قالب تاپل کار می کنند. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) -- این `arrayReverse` تابع در حال حاضر با هر نوع ارریس کار می کند. [733ا7ب6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- اضافه شده یک پارامتر اختیاری: اندازه اسلات برای `timeSlots` تابع. [کیریل شواکوف](https://github.com/ClickHouse/ClickHouse/pull/3724) -- برای `FULL` و `RIGHT JOIN` این `max_block_size` تنظیم برای یک جریان از داده های غیر پیوست از جدول سمت راست استفاده می شود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3699) -- اضافه شدن `--secure` پارامتر خط فرمان در `clickhouse-benchmark` و `clickhouse-performance-test` برای فعال کردن شماره تلفن. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) -- تبدیل نوع زمانی که ساختار یک `Buffer` جدول نوع ساختار جدول مقصد مطابقت ندارد. [ویتالی بارانو](https://github.com/ClickHouse/ClickHouse/pull/3603) -- اضافه شدن `tcp_keep_alive_timeout` گزینه ای برای فعال نگه داشتن زنده بسته پس از عدم فعالیت برای فاصله زمانی مشخص شده است. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) -- حذف نقل غیر ضروری از ارزش برای کلید پارتیشن در `system.parts` جدول اگر از یک ستون تشکیل شده است. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) -- عملکرد پیمانه برای `Date` و `DateTime` انواع داده ها. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) -- اضافه شده مترادف برای `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR` و `MID` توابع. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) برخی از نام های تابع حروف حساس برای سازگاری با استاندارد گذاشتن. شکر نحوی اضافه شده است `SUBSTRING(expr FROM start FOR length)` برای سازگاری با گذاشتن. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) -- توانایی اضافه شده به `mlock` صفحات حافظه مربوط به `clickhouse-server` کد اجرایی برای جلوگیری از مجبور شدن از حافظه. این ویژگی به طور پیش فرض غیر فعال. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) -- بهبود عملکرد در هنگام خواندن از `O_DIRECT` (با `min_bytes_to_use_direct_io` گزینه فعال). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) -- بهبود عملکرد `dictGet...OrDefault` تابع برای یک استدلال کلیدی ثابت و یک استدلال پیش فرض غیر ثابت. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3563) -- این `firstSignificantSubdomain` تابع در حال حاضر پردازش دامنه `gov`, `mil` و `edu`. [ایگور هاتاریست](https://github.com/ClickHouse/ClickHouse/pull/3601) بهبود عملکرد. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) -- امکان مشخص کردن متغیرهای محیطی سفارشی برای شروع `clickhouse-server` با استفاده از `SYS-V init.d` اسکریپت با تعریف `CLICKHOUSE_PROGRAM_ENV` داخل `/etc/default/clickhouse`. - [پاولو باشینسکیی](https://github.com/ClickHouse/ClickHouse/pull/3612) -- کد بازگشت صحیح برای اسکریپت اینیت کلاینت سرور. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) -- این `system.metrics` جدول در حال حاضر `VersionInteger` متریک و `system.build_options` دارای خط اضافه شده است `VERSION_INTEGER`, که شامل فرم عددی از نسخه کلیک, مانند `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) -- حذف توانایی مقایسه `Date` نوع با یک عدد برای جلوگیری از خطاهای بالقوه مانند `date = 2018-12-17`, جایی که نقل قول در سراسر تاریخ به اشتباه حذف. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) -- ثابت رفتار توابع نفرت انگیز مانند `rowNumberInAllBlocks`. قبلا خروجی نتیجه که یک عدد بزرگتر با توجه به شروع در طول تجزیه و تحلیل پرس و جو بود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3729) -- اگر `force_restore_data` فایل را نمی توان حذف کرد, یک پیغام خطا نمایش داده می شود. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3794) - -#### بهبود ساخت: {#build-improvements-1} - -- به روز شده در `jemalloc` کتابخانه, که رفع نشت حافظه بالقوه. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3557) -- پروفایل با `jemalloc` به طور پیش فرض به منظور اشکال زدایی ایجاد فعال است. [2سی82ف5 درجه سانتیگراد](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) -- اضافه شدن توانایی برای اجرای تست ادغام زمانی که تنها `Docker` بر روی سیستم نصب شده است. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) -- اضافه شدن تست بیان ریش ریش شدن در نمایش داده شد را انتخاب کنید. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) -- اضافه شدن یک تست استرس برای مرتکب, که انجام تست های کاربردی به صورت موازی و به صورت تصادفی برای تشخیص شرایط مسابقه بیشتر. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) -- بهبود روش برای شروع کلیک سرور در یک تصویر کارگر بارانداز. [الغزال احمد](https://github.com/ClickHouse/ClickHouse/pull/3663) -- برای یک تصویر کارگر بارانداز, اضافه شدن پشتیبانی برای مقداردهی اولیه پایگاه داده با استفاده از فایل ها در `/docker-entrypoint-initdb.d` فهرست راهنما. [کنستانتین لبتوف](https://github.com/ClickHouse/ClickHouse/pull/3695) -- رفع برای ایجاد بر روی بازو. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes} - -- حذف توانایی مقایسه `Date` نوع با یک عدد. به جای `toDate('2018-12-18') = 17883`, شما باید تبدیل نوع صریح و روشن استفاده `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) - -## انتشار کلیک 18.14 {#clickhouse-release-18-14} - -### انتشار کلیک 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} - -#### رفع اشکال: {#bug-fixes-2} - -- رفع خطا که به مشکلات با به روز رسانی لغت نامه با منبع ان بی سی منجر شده است. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- پایگاه داده ها هنگام اجرای دی ال به درستی مشخص شده است `ON CLUSTER` نمایش داده شد. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- ثابت segfault اگر `max_temporary_non_const_columns` حد بیش از حد شد. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### بهبود ساخت: {#build-improvements-2} - -- رفع برای ایجاد بر روی بازو. - -### انتشار کلیک 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} - -#### رفع اشکال: {#bug-fixes-3} - -- خطای ثابت در `dictGet...` تابع برای لغت نامه از نوع `range`, اگر یکی از استدلال ثابت است و دیگر نیست. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) -- خطا ثابت که باعث پیام `netlink: '...': attribute type 1 has an invalid length` برای چاپ در لینوکس هسته ورود که اتفاق می افتد تنها در نسخه های تازه به اندازه کافی از هسته لینوکس. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) -- پیش فرض ثابت در عملکرد `empty` برای استدلال `FixedString` نوع. [دانیل, دا کوانگ مین](https://github.com/ClickHouse/ClickHouse/pull/3703) -- تخصیص حافظه بیش از حد ثابت در هنگام استفاده از مقدار زیادی از `max_query_size` تنظیم (یک تکه حافظه از `max_query_size` بایت در یک بار تخصیص داده شد). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) - -#### ایجاد تغییرات: {#build-changes} - -- ساخت ثابت با کتابخانه های لووم/کلنگ نسخه 7 از بسته های سیستم عامل (این کتابخانه ها برای تدوین پرس و جو در زمان اجرا استفاده می شود). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### انتشار کلیک 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} - -#### رفع اشکال: {#bug-fixes-4} - -- موارد ثابت زمانی که روند پل ان بی سی با روند سرور اصلی خاتمه نیست. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) -- درج همزمان ثابت به `Distributed` جدول با یک لیست ستون که از لیست ستون جدول از راه دور متفاوت. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) -- ثابت یک بیماری مسابقه نادر است که می تواند به یک تصادف در هنگام حذف یک جدول ادغام منجر شود. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- ثابت بن بست پرس و جو در مورد زمانی که ایجاد موضوع پرس و جو با شکست مواجه `Resource temporarily unavailable` خطا. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- تجزیه ثابت از `ENGINE` بند زمانی که `CREATE AS table` نحو مورد استفاده قرار گرفت و `ENGINE` بند قبل از مشخص شد `AS table` (خطا منجر به نادیده گرفتن موتور مشخص شده). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) - -### انتشار کلیک 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} - -#### رفع اشکال: {#bug-fixes-5} - -- اندازه تکه حافظه دست بالا بود در حالی که غیرشخصی ستون از نوع `Array(String)` که منجر به “Memory limit exceeded” خطاها. این موضوع در نسخه 18.12.13 ظاهر شد. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) - -### انتشار کلیک 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} - -#### رفع اشکال: {#bug-fixes-6} - -- ثابت `ON CLUSTER` نمایش داده شد که خوشه پیکربندی به عنوان امن (پرچم ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) - -#### ایجاد تغییرات: {#build-changes-1} - -- مشکلات ثابت-7 از سیستم مکینتاش) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### انتشار کلیک 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} - -#### رفع اشکال: {#bug-fixes-7} - -- ثابت `Block structure mismatch in MergingSorted stream` خطا. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) -- ثابت `ON CLUSTER` نمایش داده شد در صورتی که اتصالات امن در در پیکربندی خوشه تبدیل شد (از `` پرچم). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) -- ثابت خطا در نمایش داده شد که استفاده می شود `SAMPLE`, `PREWHERE` و ستون نام مستعار. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) -- ثابت نادر `unknown compression method` خطا در هنگام `min_bytes_to_use_direct_io` تنظیمات فعال شد. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) - -#### بهبود عملکرد: {#performance-improvements} - -- رگرسیون عملکرد ثابت نمایش داده شد با `GROUP BY` از ستون UInt16 یا نوع تاریخ که در اجرای AMD EPYC پردازنده. [ایگور لاپکو](https://github.com/ClickHouse/ClickHouse/pull/3512) -- رگرسیون عملکرد ثابت نمایش داده شد که رشته های طولانی را پردازش می کند. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) - -#### بهبود ساخت: {#build-improvements-3} - -- بهبود برای ساده سازی ساخت ارکادیا. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) - -### انتشار کلیک 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} - -#### رفع اشکال: {#bug-fixes-8} - -- ثابت سقوط در پیوستن به دو کارخانه های فرعی که نامش ذکر نشده. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) -- ثابت تولید نمایش داده شد نادرست (با خالی `WHERE` بند) هنگامی که پرس و جو پایگاه داده های خارجی. [هیلد](https://github.com/ClickHouse/ClickHouse/pull/3477) -- ثابت با استفاده از یک مقدار ایست نادرست در لغت نامه او بی سی. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) - -### انتشار کلیک 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} - -#### رفع اشکال: {#bug-fixes-9} - -- خطا را ثابت کرد `Block structure mismatch in UNION stream: different number of columns` در حد نمایش داده شد. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) -- خطاهای ثابت در هنگام ادغام داده ها در جداول حاوی ارریس در داخل ساختارهای تو در تو. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) -- نتایج پرس و جو نادرست ثابت اگر `merge_tree_uniform_read_distribution` تنظیم غیر فعال است(به طور پیش فرض فعال). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) -- ثابت خطا در درج به یک جدول توزیع شده در فرمت بومی. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) - -### انتشار کلیک 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} - -- این `compile_expressions` تنظیم (مجموعه دستگاه گوارش عبارات) به طور پیش فرض غیر فعال است. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) -- این `enable_optimize_predicate_expression` تنظیم به طور پیش فرض غیر فعال است. - -### انتشار کلیک 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} - -#### ویژگی های جدید: {#new-features-1} - -- این `WITH CUBE` تغییردهنده برای `GROUP BY` (نحو جایگزین `GROUP BY CUBE(...)` همچنین در دسترس است). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) -- اضافه شدن `formatDateTime` تابع. [الکساندر کراشنینیکوف](https://github.com/ClickHouse/ClickHouse/pull/2770) -- اضافه شدن `JDBC` موتور جدول و `jdbc` تابع جدول (نیاز به نصب کلیک-جد بی سی پل). [الکساندر کراشنینیکوف](https://github.com/ClickHouse/ClickHouse/pull/3210) -- اضافه شدن توابع برای کار با شماره ایزو هفته: `toISOWeek`, `toISOYear`, `toStartOfISOYear` و `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) -- حالا شما می توانید استفاده کنید `Nullable` ستون برای `MySQL` و `ODBC` میز [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- ساختارهای داده تو در تو را می توان به عنوان اجسام تو در تو در خواندن `JSONEachRow` قالب. اضافه شدن `input_format_import_nested_json` تنظیمات. [ولمان یونکان](https://github.com/ClickHouse/ClickHouse/pull/3144) -- پردازش موازی برای بسیاری در دسترس است `MATERIALIZED VIEW`هنگام قرار دادن داده ها. دیدن `parallel_view_processing` تنظیمات. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) -- اضافه شدن `SYSTEM FLUSH LOGS` پرس و جو (مجبور ورود حملات گرگرفتگی به جداول سیستم مانند `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) -- حالا شما می توانید از پیش تعریف شده استفاده کنید `database` و `table` ماکروها هنگام اعلام `Replicated` میز [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) -- توانایی خواندن را اضافه کرد `Decimal` ارزش نوع در نماد مهندسی (نشان می دهد قدرت ده). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) - -#### ویژگی های تجربی: {#experimental-features} - -- بهینه سازی گروه بند برای `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) -- محاسبه بهینه از عبارات برای `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) - -#### بهبود: {#improvements-2} - -- به طور قابل توجهی کاهش مصرف حافظه برای نمایش داده شد با `ORDER BY` و `LIMIT`. دیدن `max_bytes_before_remerge_sort` تنظیمات. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- در صورت عدم وجود `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` فرض بر این است. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) -- ستاره واجد شرایط به درستی در نمایش داده شد با کار `JOIN`. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3202) -- این `ODBC` موتور جدول به درستی انتخاب روش برای به نقل از شناسه در گویش گذاشتن یک پایگاه داده از راه دور. [الکساندر کراشنینیکوف](https://github.com/ClickHouse/ClickHouse/pull/3210) -- این `compile_expressions` تنظیم (مجموعه دستگاه گوارش از عبارات) به طور پیش فرض فعال است. -- رفتار ثابت برای پایگاه داده قطره به طور همزمان/جدول اگر وجود دارد و ایجاد پایگاه داده / جدول اگر وجود ندارد. قبلا `CREATE DATABASE ... IF NOT EXISTS` پرسوجو میتواند پیغام خطا را بازگرداند “File … already exists” و `CREATE TABLE ... IF NOT EXISTS` و `DROP TABLE IF EXISTS` نمایش داده شد می تواند بازگشت `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) -- مانند و در عبارات با نیمه راست ثابت به سرور از راه دور منتقل می شود که پرس و جو از خروجی زیر و یا جداول ان بی سی. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- مقایسه با عبارات ثابت در جایی که بند به سرور از راه دور منتقل می شود که پرس و جو از خروجی زیر و جداول ان بی سی. قبلا, تنها مقایسه با ثابت تصویب شد. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- محاسبه صحیح عرض ردیف در ترمینال برای `Pretty` فرمت, از جمله رشته با هیروگلیف. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/3257). -- `ON CLUSTER` می توان برای مشخص `ALTER UPDATE` نمایش داده شد. -- بهبود عملکرد برای خواندن داده ها در `JSONEachRow` قالب. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) -- اضافه شده مترادف برای `LENGTH` و `CHARACTER_LENGTH` توابع برای سازگاری. این `CONCAT` تابع دیگر حساس به حروف نیست. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) -- اضافه شدن `TIMESTAMP` مترادف برای `DateTime` نوع. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) -- همیشه فضای این سایت متعلق به پرس و جو کوری\_ید در سیاهههای مربوط به سرور وجود دارد, حتی اگر خط ورود به سیستم به یک پرس و جو مربوط نیست. این باعث می شود ساده تر به تجزیه سرور سیاهههای مربوط به متن با ابزار شخص ثالث. -- مصرف حافظه توسط پرس و جو وارد شده است که بیش از سطح بعدی از یک عدد صحیح گیگابایت است. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- اضافه شده حالت سازگاری برای مورد زمانی که کتابخانه مشتری که با استفاده از پروتکل بومی ستون کمتر به اشتباه می فرستد از سرور انتظار برای پرس و جو درج. این سناریو ممکن بود در هنگام استفاده از کتابخانه کلیک پردازنده. قبلا, این سناریو باعث سرور به سقوط. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) -- در تعریف کاربر که بیان در `clickhouse-copier` شما هم اکنون می توانید از یک `partition_key` نام مستعار (برای فیلتر کردن اضافی توسط پارتیشن جدول منبع). این بسیار مفید است اگر طرح پارتیشن بندی در طول کپی تغییر, اما تنها کمی تغییر. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) -- گردش کار از `Kafka` موتور شده است به یک استخر موضوع پس زمینه به منظور به طور خودکار کاهش سرعت خواندن داده ها در بارهای بالا نقل مکان کرد. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- پشتیبانی از خواندن `Tuple` و `Nested` ارزش سازه ها مانند `struct` در `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) -- فهرست دامنه های سطح بالا برای `firstSignificantSubdomain` تابع در حال حاضر شامل دامنه `biz`. [بریدن](https://github.com/ClickHouse/ClickHouse/pull/3219) -- در پیکربندی واژهنامهها خارجی, `null_value` به عنوان مقدار نوع داده پیش فرض تفسیر شده است. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) -- پشتیبانی از `intDiv` و `intDivOrZero` توابع برای `Decimal`. [48402الکترونیکی8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) -- پشتیبانی از `Date`, `DateTime`, `UUID` و `Decimal` انواع به عنوان یک کلید برای `sumMap` تابع جمع. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) -- پشتیبانی از `Decimal` نوع داده در لغت نامه های خارجی. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) -- پشتیبانی از `Decimal` نوع داده در `SummingMergeTree` میز [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) -- اضافه شده تخصص برای `UUID` داخل `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) -- کاهش تعداد `open` و `close` سیستم هنگام خواندن از یک تماس می گیرد `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) -- A `TRUNCATE TABLE` پرس و جو را می توان در هر ماکت اجرا (پرس و جو به ماکت رهبر منتقل). [کیریل شواکوف](https://github.com/ClickHouse/ClickHouse/pull/3375) - -#### رفع اشکال: {#bug-fixes-10} - -- ثابت موضوع را با `Dictionary` جداول برای `range_hashed` واژهنامهها. این خطا در نسخه 18.12.17 رخ داده است. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) -- ثابت خطا در هنگام بارگذاری `range_hashed` واژهنامهها (پیام `Unsupported type Nullable (...)`). این خطا در نسخه 18.12.17 رخ داده است. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- خطاهای ثابت در `pointInPolygon` تابع با توجه به تجمع محاسبات نادرست برای چند ضلعی با تعداد زیادی از راس واقع نزدیک به یکدیگر. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) -- اگر پس از ادغام قطعات داده, کنترلی برای بخش حاصل از نتیجه همان ادغام در ماکت دیگر متفاوت, نتیجه ادغام حذف شده است و بخش داده ها از ماکت های دیگر دانلود (این رفتار صحیح است). اما پس از دانلود بخش داده ها, این می تواند به مجموعه کار به دلیل یک خطا که بخشی در حال حاضر وجود دارد اضافه نمی شود (به این دلیل که بخش داده ها با برخی از تاخیر پس از ادغام حذف شد). این امر منجر به تلاش چرخه ای برای دانلود داده های مشابه. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) -- محاسبه نادرست ثابت از مصرف کل حافظه توسط نمایش داده شد (به دلیل محاسبه نادرست `max_memory_usage_for_all_queries` تنظیم نادرست کار می کرد و `MemoryTracking` متریک مقدار نادرست بود). این خطا در نسخه 18.12.13 رخ داده است. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) -- ثابت قابلیت های `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` این خطا در نسخه 18.12.13 رخ داده است. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) -- تهیه غیر ضروری ثابت از ساختارهای داده برای `JOIN`بازدید کنندگان بر روی سرور که شروع پرس و جو در صورتی که `JOIN` تنها بر روی سرور از راه دور انجام می شود. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) -- اشکالات ثابت در `Kafka` موتور: بن بست پس از استثنا در هنگام شروع به خواندن داده ها و قفل پس از اتمام [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- برای `Kafka` جداول اختیاری `schema` پارامتر تصویب نشد (طرح از `Cap'n'Proto` قالب). [اطلاعات دقیق](https://github.com/ClickHouse/ClickHouse/pull/3150) -- اگر این گروه از باغ وحش سرور است سرور است که اتصال را قبول اما پس از آن بلافاصله آن را به جای پاسخ به از دست دادن clickhouse انتخاب برای اتصال به سرور دیگری. قبلا این خطا را تولید کرد `Cannot read all data. Bytes read: 0. Bytes expected: 4.` و سرور نمی تواند شروع. [8218رف3](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) -- اگر این گروه از سرور باغ وحش شامل سرور که پرس و جو دی ان اس خطا می گرداند, این سرویس دهنده نادیده گرفته می شوند. [17ب8209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) -- تبدیل نوع ثابت بین `Date` و `DateTime` هنگام وارد کردن داده ها در `VALUES` قالب (اگر `input_format_values_interpret_expressions = 1`). قبلا, تبدیل بین مقدار عددی تعداد روز در زمان عصر یونیکس و برچسب زمان یونیکس انجام شد, که منجر به نتایج غیر منتظره. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) -- اصلاح نوع تبدیل بین `Decimal` و اعداد صحیح. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) -- خطاهای ثابت در `enable_optimize_predicate_expression` تنظیمات. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3231) -- یک خطای تجزیه کننده در فرمت سی سی اس وی با اعداد ممیز شناور ثابت شده است اگر جدا کننده سی سی اس وی غیر پیش فرض استفاده شود مانند `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) -- ثابت `arrayCumSumNonNegative` تابع (این مقادیر منفی تجمع می یابد اگر باتری کمتر از صفر است). [الکسی استدیو](https://github.com/ClickHouse/ClickHouse/pull/3163) -- ثابت چگونه `Merge` جداول در بالای کار `Distributed` جداول هنگام استفاده از `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) -- رفع اشکال در `ALTER UPDATE` پرس و جو. -- اشکالات ثابت در `odbc` تابع جدول که در نسخه ظاهر شد 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) -- ثابت بهره برداری از توابع مجموع با `StateArray` ترکیب کننده ها [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) -- ثابت تصادف در هنگام تقسیم یک `Decimal` ارزش صفر. [69د6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) -- خروجی ثابت از انواع برای عملیات با استفاده از `Decimal` و استدلال عدد صحیح. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) -- ثابت segfault در طول `GROUP BY` روشن `Decimal128`. [3359با06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) -- این `log_query_threads` تنظیم (ورود اطلاعات در مورد هر موضوع اجرای پرس و جو) در حال حاضر اثر تنها در صورتی که `log_queries` گزینه (ورود اطلاعات در مورد نمایش داده شد) به 1 تنظیم شده است. از زمان `log_query_threads` گزینه به طور پیش فرض فعال, اطلاعات در مورد موضوعات قبلا وارد شده بود حتی اگر ورود به سیستم پرس و جو غیر فعال شد. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) -- ثابت خطا در توزیع, بهره برداری از quantiles aggregate function (پیام خطا `Not found column quantile...`). [292ا8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) -- ثابت مشکل سازگاری در هنگام کار بر روی یک خوشه از نسخه 18.12.17 سرور و سرور های قدیمی تر در همان زمان. برای نمایش داده شد توزیع شده با گروه های کلید از هر دو ثابت و غیر ثابت طول اگر وجود دارد مقدار زیادی از داده ها به کل بازگشت داده بود و نه همیشه به طور کامل جمع (دو ردیف مختلف شامل همان جمع کلید). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) -- ثابت دست زدن به تعویض در `clickhouse-performance-test`, اگر پرس و جو شامل تنها بخشی از تعویض اعلام شده در تست. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) -- ثابت خطا در هنگام استفاده از `FINAL` با `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- ثابت خطا در هنگام استفاده از `PREWHERE` بیش از ستون که در طول اضافه شد `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- اضافه شدن یک چک برای عدم وجود `arrayJoin` برای `DEFAULT` و `MATERIALIZED` عبارات. قبلا, `arrayJoin` منجر به خطا در هنگام قرار دادن داده ها. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) -- اضافه شدن یک چک برای عدم وجود `arrayJoin` در یک `PREWHERE` بند بند. قبلا, این منجر به پیام هایی مانند `Size ... doesn't match` یا `Unknown compression method` هنگام اجرای نمایش داده شد. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) -- ثابت segfault است که می تواند رخ دهد در موارد نادر پس از بهینه سازی است که جایگزین شده و زنجیره ای از برابری با ارزیابی مربوطه در بیان. [هشدار داده می شود](https://github.com/ClickHouse/ClickHouse/pull/3339) -- اصلاحات جزیی به `clickhouse-benchmark`: قبلا, اطلاعات مربوط به مشتری به سرور ارسال نمی شد; در حال حاضر تعداد نمایش داده شد اجرا شده است با دقت بیشتری محاسبه زمانی که بستن و برای محدود کردن تعداد تکرار. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-1} - -- حذف `allow_experimental_decimal_type` انتخاب این `Decimal` نوع داده برای استفاده پیش فرض در دسترس است. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) - -## انتشار کلیک 18.12 {#clickhouse-release-18-12} - -### انتشار کلیک 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} - -#### ویژگی های جدید: {#new-features-2} - -- `invalidate_query` (قابلیت مشخص کردن پرس و جو برای بررسی اینکه یک فرهنگ لغت خارجی باید به روز شود) برای اجرا `clickhouse` منبع. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) -- توانایی استفاده را اضافه کرد `UInt*`, `Int*` و `DateTime` انواع داده ها (همراه با `Date` نوع) به عنوان یک `range_hashed` کلید فرهنگ لغت خارجی که مرزهای محدوده را تعریف می کند. حالا `NULL` می توان برای تعیین محدوده باز استفاده کرد. [واسیلی نمکو](https://github.com/ClickHouse/ClickHouse/pull/3123) -- این `Decimal` نوع در حال حاضر پشتیبانی می کند `var*` و `stddev*` توابع مجموع. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- این `Decimal` نوع در حال حاضر پشتیبانی از توابع ریاضی (`exp`, `sin` و به همین ترتیب.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- این `system.part_log` جدول در حال حاضر `partition_id` ستون. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### رفع اشکال: {#bug-fixes-11} - -- `Merge` در حال حاضر به درستی کار می کند `Distributed` میز [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3159) -- ناسازگاری ثابت (وابستگی غیر ضروری به `glibc` نسخه) ساخته شده است که غیر ممکن است برای اجرای کلیک بر روی `Ubuntu Precise` و نسخه های قدیمی تر. ناسازگاری در نسخه 18.12.13 ظاهر شد. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) -- خطاهای ثابت در `enable_optimize_predicate_expression` تنظیمات. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3107) -- ثابت یک موضوع کوچک با سازگاری به عقب که به نظر می رسد در هنگام کار با یک خوشه از کپی در نسخه های زودتر از 18.12.13 و به طور همزمان ایجاد یک کپی جدید از یک جدول بر روی یک سرور با یک نسخه جدیدتر (نشان داده شده در پیام `Can not clone replica, because the ... updated to new ClickHouse version` که منطقی است اما نباید اتفاق می افتد). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-2} - -- این `enable_optimize_predicate_expression` گزینه به طور پیش فرض فعال (که است و نه خوش بینانه). اگر تجزیه و تحلیل پرس و جو خطا رخ می دهد که مربوط به جستجو برای نام ستون مجموعه `enable_optimize_predicate_expression` به 0. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3107) - -### انتشار کلیک 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} - -#### ویژگی های جدید: {#new-features-3} - -- اضافه شدن پشتیبانی برای `ALTER UPDATE` نمایش داده شد. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) -- اضافه شدن `allow_ddl` گزینه ای که دسترسی کاربر به پرس و جو دی ال را محدود می کند. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) -- اضافه شدن `min_merge_bytes_to_use_direct_io` گزینه برای `MergeTree` موتورهای, که اجازه می دهد تا شما را به مجموعه یک خودداری برای اندازه کل ادغام (زمانی که بالاتر از حد خودداری, فایل های بخش داده خواهد شد با استفاده از اچ به کار گرفته). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) -- این `system.merges` جدول سیستم در حال حاضر شامل `partition_id` ستون. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) - -#### بهبود {#improvements-3} - -- اگر بخش داده ها در طول جهش بدون تغییر باقی می ماند, این است که توسط کپی دانلود کنید. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) -- تکمیل خودکار برای نام تنظیمات در هنگام کار با در دسترس است `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) - -#### رفع اشکال: {#bug-fixes-12} - -- اضافه شدن یک چک برای اندازه ارریس که عناصر هستند `Nested` نوع زمینه در هنگام قرار دادن. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) -- ثابت خطا به روز رسانی لغت نامه های خارجی با `ODBC` منبع و `hashed` انبار. این خطا در نسخه 18.12.13 رخ داده است. -- ثابت تصادف در هنگام ایجاد یک جدول موقت از پرس و جو با یک `IN` شرط. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3098) -- ثابت خطا در توابع کل برای ارریس است که می تواند داشته باشد `NULL` عناصر. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/3097) - -### انتشار کلیک 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} - -#### ویژگی های جدید: {#new-features-4} - -- اضافه شدن `DECIMAL(digits, scale)` نوع داده (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). برای فعال کردن از تنظیمات استفاده کنید `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) -- جدید `WITH ROLLUP` تغییردهنده برای `GROUP BY` (نحو جایگزین: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) -- در نمایش داده شد با پیوستن, شخصیت ستاره گسترش می یابد به یک لیست از ستون ها در تمام جداول, در انطباق با استاندارد گذاشتن. شما می توانید رفتار قدیمی با تنظیم بازگرداندن `asterisk_left_columns_only` به 1 در سطح پیکربندی کاربر. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2787) -- اضافه شدن پشتیبانی برای پیوستن با توابع جدول. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2907) -- تکمیل خودکار با فشار دادن زبانه در خانه مشتری. [سرگی شچربین](https://github.com/ClickHouse/ClickHouse/pull/2447) -- کنترل + ج در فاحشه خانه-مشتری پاک پرس و جو که وارد شد. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) -- اضافه شدن `join_default_strictness` تنظیم (مقادیر: `"`, `'any'`, `'all'`). این اجازه می دهد تا شما را مشخص کنید `ANY` یا `ALL` برای `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) -- هر خط از ورود به سیستم سرور مربوط به پردازش پرس و جو نشان می دهد که شناسه پرس و جو. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- حالا شما می توانید سیاهههای مربوط به اجرای پرس و جو در خانه مشتری (با استفاده از `send_logs_level` تنظیمات). با پردازش پرس و جو توزیع, سیاهههای مربوط از تمام سرور های تهدیدی جدی. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- این `system.query_log` و `system.processes` (`SHOW PROCESSLIST`) جداول در حال حاضر اطلاعات در مورد تمام تنظیمات تغییر زمانی که شما یک پرس و جو (ساختار تو در تو از `Settings` اطلاعات دقیق اضافه شدن `log_query_settings` تنظیمات. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- این `system.query_log` و `system.processes` جداول در حال حاضر اطلاعات مربوط به تعدادی از موضوعات که در اجرای پرس و جو شرکت نشان می دهد (نگاه کنید به `thread_numbers` ستون). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- اضافه شده `ProfileEvents` شمارنده است که اندازه گیری زمان صرف شده در خواندن و نوشتن بر روی شبکه و خواندن و نوشتن بر روی دیسک, تعداد خطاهای شبکه, و زمان صرف انتظار زمانی که پهنای باند شبکه محدود است. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- اضافه شده `ProfileEvents`شمارنده است که شامل سیستم متریک از rusage (شما می توانید آنها را به دریافت اطلاعات در مورد CPU usage در userspace و هسته صفحه گسل و زمینه سوئیچ ها) و همچنین taskstats متریک (با استفاده از این برای به دست آوردن اطلاعات در مورد I/O منتظر زمان CPU صبر کنید زمان و مقدار اطلاعات خوانده شده و ثبت هر دو با و بدون صفحه کش). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- این `ProfileEvents` شمارنده در سطح جهانی و برای هر پرس و جو اعمال, و همچنین برای هر موضوع اعدام پرس و جو, که اجازه می دهد تا شما را به مشخصات مصرف منابع به طور مفصل. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- اضافه شدن `system.query_thread_log` جدول, که شامل اطلاعات در مورد هر موضوع اعدام پرس و جو. اضافه شدن `log_query_threads` تنظیمات. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- این `system.metrics` و `system.events` جداول در حال حاضر ساخته شده است در اسناد و مدارک. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) -- اضافه شدن `arrayEnumerateDense` تابع. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2975) -- اضافه شدن `arrayCumSumNonNegative` و `arrayDifference` توابع. [الکسی استدیو](https://github.com/ClickHouse/ClickHouse/pull/2942) -- اضافه شدن `retention` تابع جمع. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) -- حالا شما می توانید اضافه کنید (ادغام) ایالات کل توابع با استفاده از اپراتور به علاوه و ضرب ایالات کل توابع توسط یک ثابت نامنفی. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) -- جداول در خانواده ادغام در حال حاضر ستون مجازی `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### ویژگی های تجربی: {#experimental-features-1} - -- اضافه شدن `LowCardinality(T)` نوع داده. این نوع داده به طور خودکار یک فرهنگ لغت محلی از ارزش ها ایجاد می کند و اجازه می دهد تا پردازش داده ها بدون باز کردن فرهنگ لغت. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) -- اضافه شده یک کش از توابع دستگاه گوارش وارد شده و یک شمارنده برای تعداد استفاده قبل از کامپایل. به جیت کامپایل عبارات, فعال کردن `compile_expressions` تنظیمات. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) - -#### بهبود: {#improvements-4} - -- ثابت مشکل با تجمع نامحدود از ورود به سیستم تکرار زمانی که کپی رها وجود دارد. اضافه شده یک حالت بهبود موثر برای کپی با تاخیر طولانی. -- بهبود عملکرد `GROUP BY` هنگامی که یکی از رشته ها رشته است و دیگران طول ثابت با زمینه های تجمع های متعدد. -- بهبود عملکرد در هنگام استفاده از `PREWHERE` و با انتقال ضمنی عبارات در `PREWHERE`. -- بهبود عملکرد تجزیه برای فرمت های متن (`CSV`, `TSV`). [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) -- بهبود عملکرد رشته خواندن و جذب در فرمت های باینری. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2955) -- افزایش عملکرد و کاهش مصرف حافظه برای نمایش داده شد به `system.tables` و `system.columns` هنگامی که تعداد بسیار زیادی از جداول در یک سرور وجود دارد. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) -- رفع مشکل عملکرد در مورد یک جریان بزرگ از نمایش داده شد که منجر به خطا ( `_dl_addr` عملکرد در قابل مشاهده است `perf top` اما سرور پردازنده بسیار استفاده نمی شود). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) -- شرایط به نظر بازیگران (وقتی که `enable_optimize_predicate_expression` فعال است). [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2907) -- بهبود عملکرد برای `UUID` نوع داده. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) -- این `UUID` نوع داده ها در لغت نامه کیمیاگر پشتیبانی می شود. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) -- این `visitParamExtractRaw` تابع به درستی کار می کند با ساختارهای تو در تو. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2974) -- هنگامی که `input_format_skip_unknown_fields` تنظیم فعال است, زمینه های شی در `JSONEachRow` قالب به درستی قلم. [بلکجک](https://github.com/ClickHouse/ClickHouse/pull/2958) -- برای یک `CASE` بیان با شرایط, شما هم اکنون می توانید حذف `ELSE` که معادل است `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) -- ایست عملیات هم اکنون می توانید پیکربندی شود در هنگام کار با باغ وحش. [اوریخی](https://github.com/ClickHouse/ClickHouse/pull/2971) -- شما می توانید افست برای مشخص `LIMIT n, m` به عنوان `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- شما می توانید از `SELECT TOP n` نحو به عنوان یک جایگزین برای `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- افزایش اندازه صف برای نوشتن به جداول سیستم, بنابراین `SystemLog parameter queue is full` خطا اغلب اتفاق نمی افتد. -- این `windowFunnel` تابع مجموع در حال حاضر پشتیبانی از اتفاقاتی که با شرایط متعدد. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2801) -- ستون های تکراری را می توان در یک `USING` بند برای `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) -- `Pretty` فرمت در حال حاضر محدودیتی در تراز ستون های عرض است. استفاده از `output_format_pretty_max_column_pad_width` تنظیمات. اگر مقدار گسترده تر است, هنوز هم در تمامیت خود را نمایش داده خواهد شد, اما سلول های دیگر در جدول نخواهد بود بیش از حد گسترده. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) -- این `odbc` تابع جدول در حال حاضر اجازه می دهد تا به شما برای مشخص کردن پایگاه داده/نام طرح. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2885) -- توانایی استفاده از یک نام کاربری مشخص شده در `clickhouse-client` فایل پیکربندی. [ولادیمیر کوزبین](https://github.com/ClickHouse/ClickHouse/pull/2909) -- این `ZooKeeperExceptions` شمارنده به سه شمارنده تقسیم شده است: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions` و `ZooKeeperOtherExceptions`. -- `ALTER DELETE` نمایش داده شد و کار را برای محقق views. -- تصادفی اضافه شده در هنگام اجرای موضوع پاکسازی به صورت دوره ای برای `ReplicatedMergeTree` جداول به منظور جلوگیری از خوشه بار دوره ای زمانی که تعداد بسیار زیادی از وجود دارد `ReplicatedMergeTree` میز -- پشتیبانی از `ATTACH TABLE ... ON CLUSTER` نمایش داده شد. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) - -#### رفع اشکال: {#bug-fixes-13} - -- ثابت موضوع را با `Dictionary` جداول (پرتاب `Size of offsets doesn't match size of column` یا `Unknown compression method` استثنا). این اشکال در نسخه 18.10.3 ظاهر شد. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) -- رفع اشکال هنگام ادغام `CollapsingMergeTree` جداول اگر یکی از قطعات داده خالی است (این قطعات در طول ادغام و یا تشکیل `ALTER DELETE` اگر تمام داده ها حذف شد), و `vertical` الگوریتم برای ادغام مورد استفاده قرار گرفت. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) -- ثابت شرایط مسابقه در طول `DROP` یا `TRUNCATE` برای `Memory` جداول با همزمان `SELECT`, که می تواند به سقوط سرور منجر شود. این اشکال در نسخه 1.1.54388 ظاهر شد. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) -- ثابت امکان از دست دادن داده ها در هنگام قرار دادن در `Replicated` جداول اگر `Session is expired` خطا بازگشته است (از دست دادن داده ها را می توان با شناسایی `ReplicatedDataLoss` متریک). این خطا در نسخه 1.1.54378 رخ داده است. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) -- ثابت segfault در طول `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) -- ثابت خطا جستجو نام ستون زمانی که `WHERE` بیان به طور کامل شامل یک نام ستون واجد شرایط, مانند `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) -- ثابت “Not found column” خطا که هنگام اجرای نمایش داده شد توزیع رخ داده است اگر یک ستون متشکل از یک عبارت در با یک زیرخاکی از یک سرور از راه دور درخواست. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) -- ثابت `Block structure mismatch in UNION stream: different number of columns` خطا که برای نمایش داده شد توزیع رخ داده است اگر یکی از خرده ریز محلی است و از سوی دیگر نمی باشد, و بهینه سازی حرکت به `PREWHERE` باعث شده است. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) -- ثابت `pointInPolygon` تابع برای موارد خاصی از چند ضلعی غیر محدب. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) -- ثابت نتیجه نادرست در هنگام مقایسه `nan` با اعداد صحیح. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) -- ثابت خطا در `zlib-ng` کتابخانه ای که می تواند در موارد نادر به پیش فرض منجر شود. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) -- ثابت نشت حافظه در هنگام قرار دادن به یک جدول با `AggregateFunction` ستون, اگر دولت از تابع کل ساده نیست (اختصاص حافظه به طور جداگانه), و اگر یک درخواست درج نتایج در بلوک های کوچک متعدد. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) -- ثابت شرایط مسابقه در هنگام ایجاد و حذف همان `Buffer` یا `MergeTree` جدول به طور همزمان. -- ثابت امکان یک پشتک زمانی که مقایسه تاپل ساخته شده از برخی از انواع غیر بدیهی, مانند تاپل. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) -- ثابت امکان یک پشتک زمانی که در حال اجرا خاص `ON CLUSTER` نمایش داده شد. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2960) -- ثابت خطا در `arrayDistinct` تابع برای `Nullable` عناصر مجموعه. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) -- این `enable_optimize_predicate_expression` گزینه در حال حاضر به درستی پشتیبانی از موارد با `SELECT *`. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2929) -- ثابت شده است که در هنگام راه اندازی مجدد جلسه باغ وحش. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) -- مسدود کردن پتانسیل ثابت در هنگام کار با باغ وحش. -- کد نادرست ثابت برای اضافه کردن ساختارهای داده تو در تو `SummingMergeTree`. -- هنگام تخصیص حافظه برای ایالت های توابع کل, تراز دلخواه به درستی در نظر گرفته شود, که این امکان را به استفاده از عملیات که نیاز به هم ترازی در هنگام اجرای کشورهای توابع دانه. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) - -#### تعمیر امنیتی: {#security-fix} - -- استفاده ایمن از منابع داده او بی سی. تعامل با رانندگان بی سی با استفاده از یک جداگانه `clickhouse-odbc-bridge` روند. خطاها در رانندگان اد بی سی شخص ثالث دیگر باعث مشکلات با ثبات سرور و یا ناپایداری. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) -- اعتبار سنجی نادرست ثابت از مسیر فایل در `catBoostPool` تابع جدول. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) -- محتویات جداول سیستم (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas` و `replication_queue`) با توجه به دسترسی پیکربندی شده کاربر به پایگاه داده فیلتر شده است (`allow_databases`). [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2856) - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-3} - -- در نمایش داده شد با پیوستن, شخصیت ستاره گسترش می یابد به یک لیست از ستون ها در تمام جداول, در انطباق با استاندارد گذاشتن. شما می توانید رفتار قدیمی با تنظیم بازگرداندن `asterisk_left_columns_only` به 1 در سطح پیکربندی کاربر. - -#### ایجاد تغییرات: {#build-changes-2} - -- اکثر تست های یکپارچه سازی هم اکنون می توانید توسط متعهد اجرا می شود. -- چک سبک کد همچنین می توانید با ارتکاب اجرا می شود. -- این `memcpy` پیاده سازی به درستی در هنگام ساخت در لینوکس7/فدورا انتخاب شده است. [اتین champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) -- هنگام استفاده از صدای شیپور برای ساخت, برخی از هشدارهای از `-Weverything` اضافه شده است, در علاوه بر این به طور منظم `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) -- اشکال زدایی ساخت با استفاده از `jemalloc` گزینه اشکال زدایی. -- رابط کتابخانه برای تعامل با باغ وحش انتزاعی اعلام شده است. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) - -## انتشار کلیک 18.10 {#clickhouse-release-18-10} - -### انتشار کلیک خانه 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} - -#### ویژگی های جدید: {#new-features-5} - -- قام را می توان برای تکرار استفاده می شود. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) -- اضافه شدن توابع `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64` و `murmurHash3_128` علاوه بر موجود `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) -- پشتیبانی از nullable types در clickhouse odbc driver (`ODBCDriver2` فرمت خروجی). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) -- پشتیبانی از `UUID` در ستون های کلیدی. - -#### بهبود: {#improvements-5} - -- خوشه ها را می توان بدون راه اندازی مجدد سرور هنگام حذف از فایل های پیکربندی حذف کرد. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) -- لغت نامه های خارجی را می توان بدون راه اندازی مجدد سرور حذف زمانی که از فایل های پیکربندی حذف شده است. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) -- اضافه شده `SETTINGS` پشتیبانی از `Kafka` موتور جدول. [الکساندر مارشالو](https://github.com/ClickHouse/ClickHouse/pull/2781) -- بهبود برای `UUID` نوع داده (هنوز کامل نیست). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) -- پشتیبانی از قطعات خالی پس از ادغام در `SummingMergeTree`, `CollapsingMergeTree` و `VersionedCollapsingMergeTree` موتورها. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) -- سوابق قدیمی جهش های تکمیل شده حذف می شوند (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) -- اضافه شدن `system.merge_tree_settings` جدول [کیریل شواکوف](https://github.com/ClickHouse/ClickHouse/pull/2841) -- این `system.tables` جدول در حال حاضر ستون وابستگی: `dependencies_database` و `dependencies_table`. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2851) -- اضافه شدن `max_partition_size_to_drop` گزینه پیکربندی. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) -- اضافه شدن `output_format_json_escape_forward_slashes` انتخاب [الکساندر بوچاروف](https://github.com/ClickHouse/ClickHouse/pull/2812) -- اضافه شدن `max_fetch_partition_retries_count` تنظیمات. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) -- اضافه شدن `prefer_localhost_replica` تنظیم برای غیر فعال کردن اولویت برای یک ماکت محلی و رفتن به یک ماکت محلی بدون تعامل بین فرایند. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) -- این `quantileExact` بازده عملکرد کل `nan` در مورد تجمع در خالی `Float32` یا `Float64` حاضر [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) - -#### رفع اشکال: {#bug-fixes-14} - -- حذف غیر ضروری فرار از پارامترهای رشته اتصال برای ان بی سی, ساخته شده است که غیر ممکن است برای ایجاد یک اتصال. این خطا در نسخه 18.6.0 رخ داده است. -- ثابت منطق برای پردازش `REPLACE PARTITION` دستورات در صف تکرار. اگر دو وجود دارد `REPLACE` منطق نادرست میتواند باعث شود که در صف تکرار باقی بمانند و اعدام نشوند. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) -- رفع اشکال ادغام زمانی که تمام قطعات داده خالی بود (بخش هایی که از ادغام و یا از تشکیل شد `ALTER DELETE` اگر تمام داده ها حذف شد). این اشکال در نسخه 18.1.0 ظاهر شد. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) -- ثابت خطا برای همزمان `Set` یا `Join`. [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2823) -- ثابت `Block structure mismatch in UNION stream: different number of columns` خطایی که برای `UNION ALL` نمایش داده شد در داخل زیر پرس و جو اگر یکی از `SELECT` نمایش داده شد شامل نام ستون تکراری. [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2094) -- ثابت نشت حافظه اگر یک استثنا رخ داده است در هنگام اتصال به یک سرور خروجی زیر. -- ثابت نادرست کد پاسخ کلیک مشتری در صورت خطا پرس و جو. -- رفتار نادرست ثابت از دیدگاه محقق حاوی متمایز. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) - -#### تغییرات ناسازگار به عقب {#backward-incompatible-changes-4} - -- پشتیبانی حذف برای بررسی جدول نمایش داده شد برای جداول توزیع شده است. - -#### ایجاد تغییرات: {#build-changes-3} - -- تخصیص جایگزین شده است: `jemalloc` در حال حاضر به جای استفاده می شود `tcmalloc`. در برخی از حالات, این افزایش سرعت تا 20%. با این حال, نمایش داده شد که تا کند شده وجود دارد 20%. مصرف حافظه شده است حدود کاهش 10% در برخی از حالات, با ثبات بهبود یافته. با بارهای بسیار رقابتی, استفاده از پردازنده در فضای کاربری و در سیستم نشان می دهد فقط یک افزایش کمی. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) -- استفاده از libressl از یک submodule. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) -- استفاده از unixodbc از یک submodule. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) -- استفاده از ماریادب-اتصال-ج از یک زیر زمینی. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) -- اضافه شده فایل های تست عملکردی به مخزن که در دسترس بودن داده های تست بستگی دارد (در حال حاضر, بدون داده های تست خود را). - -## انتشار کلیک 18.6 {#clickhouse-release-18-6} - -### انتشار کلیک 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} - -#### ویژگی های جدید: {#new-features-6} - -- اضافه شدن پشتیبانی برای در عبارات برای عضویت در نحو: - `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` - بیان باید یک زنجیره ای از تجهیزات پیوست شده توسط و اپراتور باشد. هر طرف از برابری می تواند یک بیان دلخواه بیش از ستون از یکی از جداول. استفاده از نام ستون به طور کامل واجد شرایط پشتیبانی می شود (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) برای جدول سمت راست . [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) -- قام را می توان برای تکرار فعال کنید. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) - -#### بهبود: {#improvements-6} - -- سرور بخشی پچ از نسخه خود را به مشتری می گذرد. اطلاعات در مورد مولفه نسخه پچ در `system.processes` و `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) - -## انتشار کلیک 18.5 {#clickhouse-release-18-5} - -### ClickHouse انتشار 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} - -#### ویژگی های جدید: {#new-features-7} - -- تابع هش اضافه شده است `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). - -#### بهبود: {#improvements-7} - -- حالا شما می توانید استفاده کنید `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) نسبت به تنظیم مقادیر در فایل های پیکربندی از متغیرهای محیط زیست. -- نسخه های غیر حساس به حروف اضافه شده است `coalesce`, `ifNull` و `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). - -#### رفع اشکال: {#bug-fixes-15} - -- رفع اشکال ممکن است در هنگام شروع یک ماکت [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). - -## انتشار کلیک 18.4 {#clickhouse-release-18-4} - -### انتشار کلیک 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} - -#### ویژگی های جدید: {#new-features-8} - -- جداول سیستم اضافه شده است: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). -- اضافه شدن توانایی استفاده از یک تابع جدول به جای یک جدول به عنوان یک استدلال از یک `remote` یا `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). -- پشتیبانی از `HTTP Basic` احراز هویت در پروتکل تکرار [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). -- این `has` تابع در حال حاضر اجازه می دهد تا جستجو برای یک مقدار عددی در مجموعه ای از `Enum` مقادیر [ماکسیم خریسانف](https://github.com/ClickHouse/ClickHouse/pull/2699). -- پشتیبانی از اضافه کردن جدا پیام دلخواه در هنگام خواندن از `Kafka` [ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2701). - -#### بهبود: {#improvements-8} - -- این `ALTER TABLE t DELETE WHERE` پرس و جو می کند قطعات داده است که توسط جایی که شرایط تحت تاثیر قرار نمی بازنویسی نیست [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). -- این `use_minimalistic_checksums_in_zookeeper` گزینه برای `ReplicatedMergeTree` جداول به طور پیش فرض فعال. این تنظیمات اضافه شده در نسخه 1.1.54378, 2018-04-16. نسخه هایی که مسن تر از 1.1.54378 هستند دیگر نمی توانند نصب شوند. -- پشتیبانی از در حال اجرا `KILL` و `OPTIMIZE` نمایش داده شد که مشخص `ON CLUSTER` [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2689). - -#### رفع اشکال: {#bug-fixes-16} - -- خطا را ثابت کرد `Column ... is not under an aggregate function and not in GROUP BY` برای تجمع با بیان در. این اشکال در نسخه 18.1.0 ظاهر شد. ([ببد780ب](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) -- رفع اشکال در `windowFunnel aggregate function` [زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2735). -- رفع اشکال در `anyHeavy` تابع جمع ([الف212](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) -- تصادف سرور ثابت در هنگام استفاده از `countArray()` تابع جمع. - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-5} - -- پارامترها برای `Kafka` موتور از تغییر یافت `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` به `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. اگر جداول خود استفاده کنید `kafka_schema` یا `kafka_num_consumers` پارامترهای, شما باید به صورت دستی ویرایش فایل های ابرداده `path/metadata/database/table.sql` و اضافه کردن `kafka_row_delimiter` پارامتر با `''` ارزش. - -## انتشار کلیک 18.1 {#clickhouse-release-18-1} - -### ClickHouse انتشار 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} - -#### ویژگی های جدید: {#new-features-9} - -- پشتیبانی از `ALTER TABLE t DELETE WHERE` پرسوجو برای جداول ادغام غیر تکرار شده ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). -- پشتیبانی از انواع دلخواه برای `uniq*` خانواده از توابع کل ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). -- پشتیبانی از انواع دلخواه در مقایسه اپراتورها ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). -- این `users.xml` فایل اجازه می دهد تا تنظیم یک ماسک زیر شبکه در قالب `10.0.0.1/255.255.255.0`. این برای استفاده از ماسک برای شبکه های اینترنتی6 با صفر در وسط ضروری است ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). -- اضافه شدن `arrayDistinct` تابع ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). -- این summingmergetree موتور هم اکنون می توانید کار با aggregatefunction نوع ستون ([پان سنتانتین](https://github.com/ClickHouse/ClickHouse/pull/2566)). - -#### بهبود: {#improvements-9} - -- طرح شماره برای نسخه های انتشار تغییر کرده است. در حال حاضر بخش اول شامل سال انتشار (a. d. مسکو منطقه زمانی منهای 2000) بخش دوم شامل تعدادی به صورت عمده تغییرات را افزایش می دهد برای بسیاری منتشر شده) و بخش سوم پچ نسخه. منتشر شده هنوز هم به عقب سازگار هستند, مگر اینکه در غیر این صورت در تغییرات اعلام. -- تبدیل سریع تر اعداد ممیز شناور به یک رشته ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2664)). -- اگر برخی از ردیف در طول درج به دلیل خطاهای تجزیه قلم شد (این ممکن است با `input_allow_errors_num` و `input_allow_errors_ratio` تنظیمات را فعال کنید), تعداد ردیف قلم در حال حاضر به ورود به سیستم سرور نوشته شده است ([لوناردو سیسیچی](https://github.com/ClickHouse/ClickHouse/pull/2669)). - -#### رفع اشکال: {#bug-fixes-17} - -- ثابت فرمان کوتاه برای جداول موقت ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2624)). -- ثابت بن بست نادر در کتابخانه مشتری باغ وحش که رخ داده است زمانی که یک خطای شبکه وجود دارد در حالی که خواندن پاسخ ([315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). -- ثابت خطا در طول بازیگران به nullable types ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). -- ثابت نتیجه نادرست از `maxIntersection()` تابع زمانی که مرزهای فواصل همزمان ([مایکل فورمور](https://github.com/ClickHouse/ClickHouse/pull/2657)). -- تحول نادرست ثابت از زنجیره بیان و یا در یک استدلال تابع ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). -- تخریب عملکرد ثابت برای نمایش داده شد حاوی `IN (subquery)` عبارات در داخل یکی دیگر از خرده فروشی ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). -- ناسازگاری ثابت بین سرورها با نسخه های مختلف در نمایش داده شد توزیع شده است که با استفاده از یک `CAST` تابع است که در حروف بزرگ نیست ([ف8چ4د6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). -- اضافه شده از دست رفته به نقل از شناسه برای نمایش داده شد به سندرم تونل کارپ خارجی ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-6} - -- تبدیل یک رشته حاوی عدد صفر به تاریخ ساعت کار نمی کند. مثال: `SELECT toDateTime('0')`. این نیز دلیل است که `DateTime DEFAULT '0'` در جداول و همچنین کار نمی کند `0` در لغت نامه. راه حل: جایگزین کردن `0` با `0000-00-00 00:00:00`. - -## انتشار کلیک 1.1 {#clickhouse-release-1-1} - -### انتشار کلیک 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} - -#### ویژگی های جدید: {#new-features-10} - -- اضافه شدن `histogram` تابع جمع ([میخیل سورین](https://github.com/ClickHouse/ClickHouse/pull/2521)). -- حالا `OPTIMIZE TABLE ... FINAL` می توان بدون مشخص کردن پارتیشن ها برای `ReplicatedMergeTree` ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2600)). - -#### رفع اشکال: {#bug-fixes-18} - -- رفع مشکل با یک ایست بسیار کوچک برای سوکت (یک ثانیه) برای خواندن و نوشتن در هنگام ارسال و دانلود داده تکرار, ساخته شده است که غیر ممکن است برای دانلود قطعات بزرگتر اگر یک بار بر روی شبکه و یا دیسک وجود دارد (در تلاش دوره ای برای دانلود قطعات منجر). این خطا در نسخه 1.1.54388 رخ داده است. -- مشکلات ثابت در هنگام استفاده از ریشه کن کردن در باغ وحش اگر شما بلوک های داده های تکراری در جدول قرار داده است. -- این `has` تابع در حال حاضر به درستی برای مجموعه ای با عناصر قابل تعویض کار می کند ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). -- این `system.tables` جدول در حال حاضر به درستی کار می کند زمانی که در نمایش داده شد توزیع استفاده می شود. این `metadata_modification_time` و `engine_full` ستون در حال حاضر غیر مجازی. ثابت خطا که رخ داده است اگر تنها این ستون از جدول تردید شد. -- ثابت چگونه خالی `TinyLog` جدول پس از قرار دادن یک بلوک داده خالی کار می کند ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). -- این `system.zookeeper` جدول کار می کند اگر ارزش گره در باغ وحش تهی است. - -### انتشار کلیک 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} - -#### ویژگی های جدید: {#new-features-11} - -- نمایش داده شد را می توان در ارسال `multipart/form-data` قالب (در `query` رشته), مفید است که اگر داده های خارجی نیز برای پردازش پرس و جو ارسال ([اولگا هوستیکوا](https://github.com/ClickHouse/ClickHouse/pull/2490)). -- اضافه شدن توانایی برای فعال یا غیر فعال کردن پردازش نقل قول یک یا دو هنگام خواندن داده ها در فرمت سی سی.وی. شما می توانید این را در پیکربندی `format_csv_allow_single_quotes` و `format_csv_allow_double_quotes` تنظیمات ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2574)). -- حالا `OPTIMIZE TABLE ... FINAL` می توان بدون مشخص کردن پارتیشن برای انواع غیر تکرار استفاده کرد `MergeTree` ([ایموس پرنده](https://github.com/ClickHouse/ClickHouse/pull/2599)). - -#### بهبود: {#improvements-10} - -- بهبود عملکرد, کاهش مصرف حافظه, و ردیابی مصرف حافظه صحیح با استفاده از اپراتور در زمانی که یک شاخص جدول می تواند مورد استفاده قرار گیرد ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). -- حذف چک کردن کار برکنار شده از چک سام در هنگام اضافه کردن یک بخش داده ها. این مهم است که تعداد زیادی از کپی وجود دارد, چرا که در این موارد تعداد کل چک به نفر برابر بود^2. -- اضافه شدن پشتیبانی برای `Array(Tuple(...))` نشانوندها برای `arrayEnumerateUniq` تابع ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). -- اضافه شده `Nullable` پشتیبانی از `runningDifference` تابع ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). -- بهبود عملکرد تجزیه و تحلیل پرس و جو زمانی که تعداد بسیار زیادی از عبارات وجود دارد ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). -- انتخاب سریع تر از قطعات داده برای ادغام در `ReplicatedMergeTree` میز بازیابی سریع تر از جلسه باغ وحش ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). -- این `format_version.txt` پرونده برای `MergeTree` جداول دوباره ایجاد اگر از دست رفته است, که حس می کند اگر تاتر است پس از کپی کردن ساختار دایرکتوری بدون فایل راه اندازی ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). - -#### رفع اشکال: {#bug-fixes-19} - -- رفع اشکال در هنگام کار با باغ وحش است که می تواند غیر ممکن است برای بازیابی جلسه و خواندنی ایالات جداول قبل از راه اندازی مجدد سرور. -- رفع اشکال در هنگام کار با باغ وحش است که می تواند در گره های قدیمی در نتیجه حذف نمی شود اگر جلسه قطع شده است. -- ثابت خطا در `quantileTDigest` تابع برای استدلال شناور (این اشکال در نسخه 1.1.54388 معرفی شد) ([میخیل سورین](https://github.com/ClickHouse/ClickHouse/pull/2553)). -- رفع اشکال در شاخص برای جداول ادغام اگر ستون کلید اصلی در داخل تابع برای تبدیل انواع بین اعداد صحیح امضا و بدون علامت از همان اندازه واقع شده است ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). -- ثابت segfault اگر `macros` استفاده می شود اما در فایل پیکربندی نیستند ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). -- تعویض ثابت به پایگاه داده به طور پیش فرض در هنگام اتصال مجدد مشتری ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). -- رفع اشکال که زمانی رخ داده است `use_index_for_in_with_subqueries` تنظیم غیر فعال شد. - -#### تعمیر امنیتی: {#security-fix-1} - -- ارسال فایل های دیگر ممکن است زمانی که به خروجی زیر متصل می شود (`LOAD DATA LOCAL INFILE`). - -### انتشار کلیک 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} - -#### ویژگی های جدید: {#new-features-12} - -- پشتیبانی از `ALTER TABLE t DELETE WHERE` پرس و جو برای جداول تکرار. اضافه شدن `system.mutations` جدول برای پیگیری پیشرفت این نوع از نمایش داده شد. -- پشتیبانی از `ALTER TABLE t [REPLACE|ATTACH] PARTITION` پرس و جو برای \* جداول ادغام. -- پشتیبانی از `TRUNCATE TABLE` پرسوجو ([زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2260)) -- چند جدید `SYSTEM` نمایش داده شد برای جداول تکرار (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). -- توانایی نوشتن به یک جدول با موتور خروجی زیر و عملکرد جدول مربوطه اضافه شده است ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). -- اضافه شدن `url()` عملکرد جدول و `URL` موتور جدول ([الکساندر sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). -- اضافه شدن `windowFunnel` تابع جمع ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). -- جدید `startsWith` و `endsWith` توابع برای رشته ها ([وادیم پلختینسکی](https://github.com/ClickHouse/ClickHouse/pull/2429)). -- این `numbers()` تابع جدول در حال حاضر اجازه می دهد تا شما را به مشخص افست ([زمستان ژانگ](https://github.com/ClickHouse/ClickHouse/pull/2535)). -- رمز عبور به `clickhouse-client` می توان تعاملی وارد شده است. -- سیاهههای مربوط به سرور هم اکنون می توانید به وبلاگ ارسال می شود ([الکساندر کرشنینیکف](https://github.com/ClickHouse/ClickHouse/pull/2459)). -- پشتیبانی از ورود به لغت نامه ها با یک منبع کتابخانه مشترک ([الکساندر sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). -- پشتیبانی برای سفارشی csv delimiters ([ایوان ژوکوف](https://github.com/ClickHouse/ClickHouse/pull/2263)) -- اضافه شدن `date_time_input_format` تنظیمات. اگر این تنظیم را تغییر دهید `'best_effort'`, ارزش تاریخ ساعت خواهد شد در طیف گسترده ای از فرمت های به عنوان خوانده شده. -- اضافه شدن `clickhouse-obfuscator` ابزار برای مبهم و تاریک کردن داده ها. مثال طریقه استفاده: انتشار داده های مورد استفاده در تست عملکرد. - -#### ویژگی های تجربی: {#experimental-features-2} - -- توانایی محاسبه اضافه شده است `and` استدلال تنها جایی که مورد نیاز هستند ([کشتن از سر ترحم تسارکوا](https://github.com/ClickHouse/ClickHouse/pull/2272)) -- مجموعه کیت به کد بومی در حال حاضر برای برخی از عبارات در دسترس است ([پایوس](https://github.com/ClickHouse/ClickHouse/pull/2277)). - -#### رفع اشکال: {#bug-fixes-20} - -- تکراری دیگر برای پرس و جو با ظاهر `DISTINCT` و `ORDER BY`. -- نمایش داده شد با `ARRAY JOIN` و `arrayFilter` دیگر نتیجه نادرست بازگشت. -- هنگام خواندن یک ستون جداگانه از یک ساختار تو در تو خطایی رخ داد ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). -- ثابت خطا در هنگام تجزیه و تحلیل نمایش داده شد با داشتن بند مانند `HAVING tuple IN (...)`. -- ثابت خطا در هنگام تجزیه و تحلیل نمایش داده شد با نام مستعار بازگشتی. -- ثابت خطا در هنگام خواندن از replacingmergetree با یک بیماری در prewhere فیلتر است که تمام ردیف ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). -- هنگام استفاده از جلسات در رابط اچ تی پی تنظیمات پروفایل کاربر اعمال نشد. -- ثابت چگونه تنظیمات از پارامترهای خط فرمان در خانه کلیک اعمال می شود-محلی. -- کتابخانه مشتری باغ وحش در حال حاضر با استفاده از فاصله جلسه دریافت شده از سرور. -- رفع اشکال در کتابخانه مشتری باغ وحش زمانی که مشتری منتظر پاسخ سرور طولانی تر از ایست. -- هرس ثابت قطعات برای نمایش داده شد با شرایط در ستون های کلیدی پارتیشن ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). -- ادغام در حال حاضر ممکن است پس از `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). -- نقشه برداری نوع در تابع جدول او بی سی ثابت شده است ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). -- مقایسه نوع برای ثابت شده است `DateTime` با و بدون منطقه زمانی ([الکساندر بوچاروف](https://github.com/ClickHouse/ClickHouse/pull/2400)). -- تجزیه نحوی ثابت و قالب بندی از `CAST` اپراتور -- درج ثابت به یک نمایش تحقق برای موتور جدول توزیع شده است ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). -- ثابت شرایط مسابقه در هنگام نوشتن داده ها از `Kafka` موتور به نمایش تحقق ([Yangkuan لیو](https://github.com/ClickHouse/ClickHouse/pull/2448)). -- در از راه دور() تابع جدول ثابت شده است. -- رفتار خروج ثابت از `clickhouse-client` در حالت چند خطی ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). - -#### بهبود: {#improvements-11} - -- وظایف پس زمینه در جداول تکرار در حال حاضر در یک استخر موضوع به جای در موضوعات جداگانه انجام می شود ([سیلو کاراژیا](https://github.com/ClickHouse/ClickHouse/pull/1722)). -- بهبود عملکرد فشرده سازی 2.4. -- تجزیه و تحلیل سریع تر برای نمایش داده شد با تعداد زیادی از می پیوندد و زیر نمایش داده شد. -- کش دی ان اس در حال حاضر به طور خودکار به روز هنگامی که بیش از حد بسیاری از خطاهای شبکه وجود دارد. -- جدول درج دیگر رخ می دهد, اگر وارد یکی از این محقق views امکان پذیر نیست به دلیل آن است بیش از حد بسیاری از قطعات. -- اصلاح اختلاف در شمارنده رویداد `Query`, `SelectQuery` و `InsertQuery`. -- عبارات مانند `tuple IN (SELECT tuple)` مجاز اگر انواع تاپل مطابقت. -- سرور با جداول تکرار می توانید شروع به حتی اگر شما باغ وحش پیکربندی نشده است. -- هنگام محاسبه تعداد هسته های پردازنده در دسترس, محدودیت در گروه های گروه در حال حاضر در نظر گرفته شود ([اتری شارما](https://github.com/ClickHouse/ClickHouse/pull/2325)). -- اضافه شده پیون برای دایرکتوری پیکربندی در فایل پیکربندی سیستم ([میخیل شیریو](https://github.com/ClickHouse/ClickHouse/pull/2421)). - -#### ایجاد تغییرات: {#build-changes-4} - -- کامپایلر جی سی8 را می توان برای ساخت استفاده می شود. -- اضافه شده توانایی برای ساخت llvm از submodule. -- این نسخه از librdkafka کتابخانه به روز شده است برای v0.11.4. -- اضافه شدن توانایی استفاده از کتابخانه سیستم لیبکپویید. نسخه کتابخانه شده است به 0.4.0 به روز شد. -- ثابت ساخت با استفاده از vectorclass کتابخانه ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). -- در حال حاضر تولید فایل برای نینجا به طور پیش فرض (مانند هنگام استفاده از `-G Ninja`). -- اضافه شدن قابلیت استفاده از کتابخانه لیبتاینفو به جای نوشیدن شراب ([جورجی کندراتیف](https://github.com/ClickHouse/ClickHouse/pull/2519)). -- رفع یک درگیری فایل هدر در فدورا پوست دباغی نشده ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-7} - -- حذف فرار در `Vertical` و `Pretty*` فرمت ها و حذف `VerticalRaw` قالب. -- اگر سرور با نسخه 1.1.54388 (یا جدیدتر) و سرور با نسخه های قدیمی تر به طور همزمان در یک پرس و جو توزیع استفاده می شود و پرس و جو است `cast(x, 'Type')` بیان بدون `AS` کلمه کلیدی و کلمه ندارد `cast` در بزرگ, یک استثنا خواهد شد با یک پیام مانند پرتاب `Not found column cast(0, 'UInt8') in block`. تخلیه: به روز رسانی سرور در کل خوشه. - -### انتشار کلیک 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} - -#### رفع اشکال: {#bug-fixes-21} - -- ثابت خطا که در برخی موارد باعث عملیات باغ وحش برای جلوگیری از. - -### انتشار کلیک 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} - -#### رفع اشکال: {#bug-fixes-22} - -- ثابت کاهش سرعت صف تکرار اگر یک جدول است بسیاری از کپی. - -### انتشار کلیک 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} - -#### رفع اشکال: {#bug-fixes-23} - -- ثابت نشت گره در باغ وحش زمانی که خانه رعیتی اتصال به سرور باغ وحش از دست می دهد. - -### ClickHouse انتشار 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} - -#### ویژگی های جدید: {#new-features-13} - -- تابع جدول اضافه شده است `file(path, format, structure)`. به عنوان مثال خواندن بایت از `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. - -#### بهبود: {#improvements-12} - -- زیرمجموعه ها را می توان در `()` براکت به منظور افزایش خوانایی پرس و جو. به عنوان مثال: `(SELECT 1) UNION ALL (SELECT 1)`. -- ساده `SELECT` نمایش داده شد از `system.processes` جدول در شامل نمی شود `max_concurrent_queries` حد. - -#### رفع اشکال: {#bug-fixes-24} - -- رفتار نادرست ثابت از `IN` اپراتور هنگام انتخاب از `MATERIALIZED VIEW`. -- فیلتر نادرست ثابت توسط شاخص پارتیشن در عبارات مانند `partition_key_column IN (...)`. -- ناتوانی ثابت برای اجرا `OPTIMIZE` پرس و جو در ماکت غیر رهبر اگر `REANAME` بر روی میز انجام شد. -- خطای مجوز هنگام اجرای ثابت شد `OPTIMIZE` یا `ALTER` نمایش داده شد در یک ماکت غیر رهبر. -- انجماد ثابت `KILL QUERY`. -- رفع خطا در کتابخانه مشتری باغ وحش که منجر به از دست دادن ساعت انجماد توزیع صف دی ال و کاهش سرعت در صف تکرار اگر غیر خالی `chroot` پیشوند در پیکربندی باغ وحش استفاده می شود. - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-8} - -- پشتیبانی حذف برای عبارات مانند `(a, b) IN (SELECT (a, b))` (شما می توانید بیان معادل استفاده کنید `(a, b) IN (SELECT a, b)`). در نسخه های قبلی, این عبارات منجر به نامشخص `WHERE` فیلتر کردن یا ایجاد خطا. - -### انتشار کلیک 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} - -#### ویژگی های جدید: {#new-features-14} - -- ورود به سیستم سطح را می توان بدون راه اندازی مجدد سرور تغییر کرده است. -- اضافه شدن `SHOW CREATE DATABASE` پرس و جو. -- این `query_id` می توان به تصویب رسید `clickhouse-client` . -- تنظیمات جدید: `max_network_bandwidth_for_all_users`. -- اضافه شدن پشتیبانی برای `ALTER TABLE ... PARTITION ...` برای `MATERIALIZED VIEW`. -- اطلاعات اضافه شده در مورد اندازه قطعات داده در فرم غیر فشرده در جدول سیستم. -- پشتیبانی از رمزگذاری سرور به سرور برای جداول توزیع شده (`1` در پیکربندی ماکت در ``). -- پیکربندی سطح جدول برای `ReplicatedMergeTree` خانواده به منظور به حداقل رساندن مقدار داده های ذخیره شده در باغ وحش: : `use_minimalistic_checksums_in_zookeeper = 1` -- پیکربندی از `clickhouse-client` اعلان کردن. به طور پیش فرض, نام سرور در حال حاضر خروجی به اعلان. نام صفحه نمایش سرور را می توان تغییر داد. همچنین در ارسال `X-ClickHouse-Display-Name` HTTP header (Kirill Shvakov). -- چند کاما از هم جدا `topics` می توان برای مشخص `Kafka` موتور (توبیاس Adamson) -- هنگامی که یک پرس و جو توسط متوقف `KILL QUERY` یا `replace_running_query` مشتری دریافت می کند `Query was canceled` استثنا به جای یک نتیجه ناقص. - -#### بهبود: {#improvements-13} - -- `ALTER TABLE ... DROP/DETACH PARTITION` نمایش داده شد در مقابل صف تکرار اجرا شود. -- `SELECT ... FINAL` و `OPTIMIZE ... FINAL` می توان حتی زمانی که جدول دارای یک بخش داده واحد استفاده می شود. -- A `query_log` جدول در پرواز دوباره اگر به صورت دستی حذف شد (کریل شواکوف). -- این `lengthUTF8` عملکرد سریعتر اجرا می شود (ژانگ2014). -- بهبود عملکرد درج همزمان در `Distributed` جداول (`insert_distributed_sync = 1`) هنگامی که تعداد بسیار زیادی از خرده ریز وجود دارد. -- سرور می پذیرد `send_timeout` و `receive_timeout` تنظیمات از مشتری و در هنگام اتصال به مشتری اعمال می شود (که در جهت معکوس اعمال می شود: سوکت سرور `send_timeout` به مجموعه `receive_timeout` ارزش دریافت شده از مشتری و بالعکس). -- بازیابی سقوط قوی تر برای درج ناهمزمان به `Distributed` میز -- نوع بازگشت `countEqual` تابع تغییر از `UInt32` به `UInt64` (谢磊). - -#### رفع اشکال: {#bug-fixes-25} - -- ثابت خطا با `IN` هنگامی که سمت چپ عبارت است `Nullable`. -- نتایج صحیح در حال حاضر در هنگام استفاده از تاپل با بازگشت `IN` هنگامی که برخی از اجزای تاپل در شاخص جدول هستند. -- این `max_execution_time` محدود در حال حاضر به درستی کار می کند با نمایش داده شد توزیع شده است. -- خطاهای ثابت هنگام محاسبه اندازه ستون های کامپوزیت در `system.columns` جدول -- هنگام ایجاد یک جدول موقت خطایی رخ داد `CREATE TEMPORARY TABLE IF NOT EXISTS.` -- خطاهای ثابت در `StorageKafka` (\#\#2075) -- سقوط سرور ثابت از استدلال نامعتبر از توابع مجموع خاص. -- ثابت خطا که مانع از `DETACH DATABASE` پرسو جو از توقف وظایف پس زمینه برای `ReplicatedMergeTree` میز -- `Too many parts` دولت کمتر احتمال دارد به اتفاق می افتد در هنگام قرار دادن به نمایش مواد جمع (\#2084). -- دست زدن به بازگشتی اصلاح تعویض در پیکربندی اگر یک تعویض باید توسط جایگزینی دیگر در همان سطح به دنبال. -- اصلاح نحو در فایل ابرداده در هنگام ایجاد یک `VIEW` که با استفاده از یک پرس و جو با `UNION ALL`. -- `SummingMergeTree` در حال حاضر به درستی کار می کند برای جمع ساختارهای داده های تو در تو با یک کلید کامپوزیت. -- ثابت امکان شرایط مسابقه در هنگام انتخاب رهبر برای `ReplicatedMergeTree` میز - -#### ایجاد تغییرات: {#build-changes-5} - -- پشتیبانی ساخت `ninja` به جای `make` و موارد استفاده `ninja` به طور پیش فرض برای انتشار ساختمان. -- بسته تغییر نام داد: `clickhouse-server-base` داخل `clickhouse-common-static`; `clickhouse-server-common` داخل `clickhouse-server`; `clickhouse-common-dbg` داخل `clickhouse-common-static-dbg`. برای نصب استفاده کنید `clickhouse-server clickhouse-client`. بسته با نام های قدیمی هنوز هم در مخازن برای سازگاری بار. - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-9} - -- حذف تفسیر خاص از یک عبارت در اگر مجموعه ای در سمت چپ مشخص شده است. قبلا بیان `arr IN (set)` به عنوان تفسیر شد “at least one `arr` element belongs to the `set`”. برای دریافت همان رفتار در نسخه جدید, نوشتن `arrayExists(x -> x IN (set), arr)`. -- استفاده نادرست از گزینه سوکت را غیرفعال کرد `SO_REUSEPORT`, که به اشتباه به طور پیش فرض در کتابخانه کم فعال شد. توجه داشته باشید که در لینوکس دیگر هیچ دلیلی وجود ندارد که به طور همزمان نشانی ها را مشخص کند `::` و `0.0.0.0` for listen – use just `::`, که اجازه می دهد گوش دادن به اتصال هر دو بیش از لیگ4 و ایپو6 (با تنظیمات پیکربندی هسته به طور پیش فرض). شما همچنین می توانید به رفتار از نسخه های قبلی با مشخص برگرداندن `1` در پیکربندی. - -### انتشار کلیک 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} - -#### ویژگی های جدید: {#new-features-15} - -- اضافه شدن `system.macros` جدول و به روز رسانی خودکار از ماکروها زمانی که فایل پیکربندی تغییر کرده است. -- اضافه شدن `SYSTEM RELOAD CONFIG` پرس و جو. -- اضافه شدن `maxIntersections(left_col, right_col)` تابع جمع, که حداکثر تعداد فواصل به طور همزمان متقاطع گرداند `[left; right]`. این `maxIntersectionsPosition(left, right)` تابع می گرداند ابتدای “maximum” فاصله. ([مایکل فورمور](https://github.com/ClickHouse/ClickHouse/pull/2012)). - -#### بهبود: {#improvements-14} - -- هنگام وارد کردن داده ها در یک `Replicated` جدول, درخواست کمتر به ساخته شده `ZooKeeper` (و بسیاری از خطاهای سطح کاربر از ناپدید شد `ZooKeeper` ورود). -- توانایی ایجاد نام مستعار برای مجموعه داده ها اضافه شده است. مثال: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. - -#### رفع اشکال: {#bug-fixes-26} - -- ثابت `Illegal PREWHERE` خطا هنگام خواندن از جداول ادغام برای `Distributed`میز -- رفع اضافه شده است که به شما اجازه شروع کلیک سرور در ظروف فایل اجرایی فقط 4. -- ثابت شرایط مسابقه در هنگام خواندن از سیستم `system.parts_columns tables.` -- بافر دو حذف در طول یک درج همزمان به یک `Distributed` جدول, که می تواند باعث اتصال به ایست. -- رفع اشکال که باعث انتظار بیش از حد طولانی برای یک ماکت در دسترس نیست قبل از شروع یک `SELECT` پرس و جو. -- تاریخ نادرست ثابت در `system.parts` جدول -- رفع اشکال ساخته شده است که غیر ممکن است برای وارد کردن داده ها در یک `Replicated` جدول اگر `chroot` غیر خالی در پیکربندی بود `ZooKeeper` خوشه خوشه. -- ثابت الگوریتم ادغام عمودی برای خالی `ORDER BY` جدول -- ترمیم توانایی استفاده از لغت نامه در نمایش داده شد به جداول از راه دور, حتی اگر این لغت نامه در سرور درخواست وجود ندارد. این قابلیت در نسخه 1.1.54362 از دست داده بود. -- ترمیم رفتار برای نمایش داده شد مانند `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` هنگامی که در سمت راست از `IN` باید از راه دور استفاده کنید `default.table` به جای یک محلی. این رفتار در نسخه 1.1.54358 شکسته شد. -- حذف غیر اصلی ورود به سیستم سطح خطا از `Not found column ... in block`. - -### انتشار کلیک 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} - -#### ویژگی های جدید: {#new-features-16} - -- تجمع بدون `GROUP BY` برای یک مجموعه خالی (مانند `SELECT count(*) FROM table WHERE 0`) در حال حاضر در نتیجه با یک ردیف با ارزش تهی برای توابع کل گرداند, در انطباق با استاندارد گذاشتن. برای بازگرداندن رفتار قدیمی (بازگشت به نتیجه خالی), تنظیم `empty_result_for_aggregation_by_empty_set` به 1. -- تبدیل نوع اضافه شده برای `UNION ALL`. نام مستعار مختلف مجاز است `SELECT` موقعیت خود را در `UNION ALL`, در انطباق با استاندارد گذاشتن. -- عبارات دلخواه در پشتیبانی `LIMIT BY` بند. قبلا, تنها ممکن بود به استفاده از ستون ناشی از `SELECT`. -- یک شاخص از `MergeTree` جداول استفاده می شود که `IN` به یک تاپل عبارات از ستون کلید اصلی اعمال می شود. مثال: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` هشدار داده می شود -- اضافه شدن `clickhouse-copier` ابزار برای کپی کردن بین خوشه ها و داده های تغییر شکل (بتا). -- اضافه شده توابع هش سازگار: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. آنها را می توان به عنوان یک sharding کلیدی به منظور کاهش مقدار از ترافیک شبکه در طول پس از آن reshardings. -- اضافه شدن توابع: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. -- اضافه شدن `arrayCumSum` تابع (جوی سانتانا). -- اضافه شدن `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero` و `parseDateTimeBestEffortOrNull` توابع برای خواندن تاریخ ساعت از یک رشته حاوی متن در طیف گسترده ای از فرمت های ممکن. -- داده ها را می توان تا حدی از لغت نامه های خارجی در طول به روز رسانی دوباره (بار فقط سوابق که ارزش این زمینه مشخص شده بیشتر از در دانلود قبلی) (ارسن هاکوبیان). -- اضافه شدن `cluster` تابع جدول. مثال: `cluster(cluster_name, db, table)`. این `remote` تابع جدول می توانید نام خوشه به عنوان اولین استدلال قبول, اگر به عنوان یک شناسه مشخص. -- این `remote` و `cluster` توابع جدول را می توان در `INSERT` نمایش داده شد. -- اضافه شدن `create_table_query` و `engine_full` ستون های مجازی به `system.tables`جدول این `metadata_modification_time` ستون مجازی است. -- اضافه شدن `data_path` و `metadata_path` ستونها به `system.tables`و`system.databases` جداول و اضافه شدن `path` ستون به `system.parts` و `system.parts_columns` میز -- اضافه شدن اطلاعات اضافی در مورد ادغام در `system.part_log` جدول -- یک کلید پارتیشن بندی دلخواه می تواند برای `system.query_log` جدول (کریل شواکوف). -- این `SHOW TABLES` پرس و جو در حال حاضر نیز جداول موقت را نشان می دهد. جداول موقت و `is_temporary` ستون به `system.tables` (ژانگ2014). -- اضافه شده `DROP TEMPORARY TABLE` و `EXISTS TEMPORARY TABLE` نمایش داده شد (ژانگ2014). -- پشتیبانی از `SHOW CREATE TABLE` برای جداول موقت (ژانگ2014). -- اضافه شدن `system_profile` پارامتر پیکربندی برای تنظیمات مورد استفاده توسط فرایندهای داخلی. -- پشتیبانی برای بارگذاری `object_id` به عنوان یک ویژگی در `MongoDB` واژهنامهها (پاول لیتویننکو). -- خواندن `null` به عنوان مقدار پیش فرض هنگام بارگذاری داده ها برای یک فرهنگ لغت خارجی با `MongoDB` منبع (پاول لیتویننکو). -- خواندن `DateTime` ارزش در `Values` فرمت از برچسب زمان یونیکس بدون نقل قول تنها. -- عدم موفقیت در پشتیبانی `remote` توابع جدول برای موارد زمانی که برخی از کپی از دست رفته جدول درخواست. -- تنظیمات پیکربندی را می توان در خط فرمان باطل زمانی که شما اجرا `clickhouse-server`. مثال: `clickhouse-server -- --logger.level=information`. -- اجرا `empty` تابع از یک `FixedString` استدلال: تابع بازده 1 اگر رشته شامل به طور کامل از بایت پوچ (ژانگ2014). -- اضافه شدن `listen_try`پارامتر پیکربندی برای گوش دادن به حداقل یکی از نشانی های گوش دادن بدون ترک, اگر برخی از نشانی ها را نمی توان به گوش (مفید برای سیستم های با پشتیبانی غیر فعال برای لیگ4 یا ایپو6). -- اضافه شدن `VersionedCollapsingMergeTree` موتور جدول. -- پشتیبانی از ردیف ها و انواع عددی دلخواه برای `library` منبع فرهنگ لغت. -- `MergeTree` جداول را می توان بدون یک کلید اولیه استفاده می شود (شما نیاز به مشخص `ORDER BY tuple()`). -- A `Nullable` نوع می تواند باشد `CAST` به یک غیر-`Nullable` نوع اگر استدلال نیست `NULL`. -- `RENAME TABLE` می توان برای انجام `VIEW`. -- اضافه شدن `throwIf` تابع. -- اضافه شدن `odbc_default_field_size` گزینه, که اجازه می دهد تا شما را به گسترش حداکثر اندازه از ارزش لود شده از یک منبع بی سی (به طور پیش فرض, این هست 1024). -- این `system.processes` جدول و `SHOW PROCESSLIST` در حال حاضر `is_cancelled` و `peak_memory_usage` ستون ها - -#### بهبود: {#improvements-15} - -- محدودیت ها و سهمیه بندی در نتیجه دیگر به داده های متوسط برای اعمال `INSERT SELECT` نمایش داده شد و یا برای `SELECT` subqueries. -- باعث کاذب کمتر از `force_restore_data` هنگام چک کردن وضعیت `Replicated` جداول زمانی که سرور شروع می شود. -- اضافه شدن `allow_distributed_ddl` انتخاب -- توابع نامشخص در عبارات برای مجاز نیست `MergeTree` کلید های جدول. -- پروندهها با جایگزینی از `config.d` دایرکتوری ها به ترتیب حروف الفبا لود می شود. -- بهبود عملکرد `arrayElement` تابع در مورد یک مجموعه چند بعدی ثابت با مجموعه ای خالی به عنوان یکی از عناصر. مثال: `[[1], []][x]`. -- سرور شروع می شود سریع تر در حال حاضر در هنگام استفاده از فایل های پیکربندی با تعویض بسیار بزرگ (به عنوان مثال, لیست بسیار زیادی از شبکه های اینترنتی). -- هنگامی که در حال اجرا یک پرس و جو, جدول توابع ارزش اجرا یک بار. قبلا, `remote` و `mysql` جدول ارزش توابع پرس و جو همان دو بار انجام برای بازیابی ساختار جدول از یک سرور از راه دور. -- این `MkDocs` ژنراتور مستندات استفاده شده است. -- هنگامی که شما سعی می کنید یک ستون جدول را حذف کنید که `DEFAULT`/`MATERIALIZED` عبارات از ستون های دیگر بستگی دارد, یک استثنا پرتاب می شود (ژانگ2014). -- اضافه شدن توانایی تجزیه یک خط خالی در فرمت های متن به عنوان شماره 0 برای `Float` انواع داده ها. این ویژگی قبلا در دسترس بود اما در نسخه 1.1.54342 از دست داده بود. -- `Enum` مقادیر را می توان در استفاده `min`, `max`, `sum` و برخی دیگر توابع. در این موارد با استفاده از آن مربوط به مقادیر عددی. این ویژگی قبلا در دسترس بود اما از دست رفته در انتشار 1.1.54337. -- اضافه شده `max_expanded_ast_elements` برای محدود کردن اندازه از اس تی پس از نام مستعار به صورت بازگشتی در حال گسترش است. - -#### رفع اشکال: {#bug-fixes-27} - -- ثابت مواردی که غیر ضروری ستون حذف شده از subqueries در خطا یا حذف نشده از subqueries حاوی `UNION ALL`. -- رفع اشکال در ادغام برای `ReplacingMergeTree` میز -- درج همزمان ثابت در `Distributed` جداول (`insert_distributed_sync = 1`). -- پیش فرض ثابت برای استفاده های خاص از `FULL` و `RIGHT JOIN` با ستون تکراری در کارخانه های فرعی. -- پیش فرض ثابت برای استفاده های خاص از `replace_running_query` و `KILL QUERY`. -- ثابت منظور از `source` و `last_exception` ستون ها در `system.dictionaries` جدول -- رفع اشکال زمانی که `DROP DATABASE` پرس و جو فایل را با ابرداده را حذف کنید. -- ثابت `DROP DATABASE` پرسوجو برای `Dictionary` پایگاه داده. -- ثابت دقت کم `uniqHLL12` و `uniqCombined` توابع برای کارتنیت بیشتر از 100 میلیون مورد (الکس بوچاروف). -- ثابت محاسبه مقادیر پیش فرض ضمنی در صورت لزوم به طور همزمان محاسبه عبارات صریح و روشن به طور پیش فرض در `INSERT` نمایش داده شد (ژانگ2014). -- ثابت یک مورد نادر زمانی که یک پرس و جو به یک `MergeTree` جدول نمی تواند به پایان برسد (فکس ایکس سی). -- ثابت تصادف رخ داده است که در حال اجرا `CHECK` پرسوجو برای `Distributed` جداول اگر تمام خرده ریز محلی هستند (فکس.اطلاعات دقیق -- ثابت رگرسیون عملکرد کمی با توابع است که با استفاده از عبارات منظم. -- ثابت رگرسیون عملکرد در هنگام ایجاد مجموعه های چند بعدی از عبارات پیچیده است. -- ثابت یک اشکال است که می تواند اضافی `FORMAT` بخش به نظر می رسد در یک `.sql` فایل با ابرداده. -- رفع اشکال که باعث `max_table_size_to_drop` محدود به درخواست در هنگام تلاش برای حذف یک `MATERIALIZED VIEW` با نگاهی به یک جدول به صراحت مشخص. -- ناسازگاری ثابت با مشتریان قدیمی (مشتریان قدیمی گاهی اوقات داده ها را با `DateTime('timezone')` نوع, که درک نمی کنند). -- رفع اشکال در هنگام خواندن `Nested` عناصر ستون سازه هایی که با استفاده از اضافه شد `ALTER` اما این برای پارتیشن های قدیمی خالی است, زمانی که شرایط را برای این ستون ها به نقل مکان کرد `PREWHERE`. -- رفع اشکال هنگام فیلتر کردن جداول توسط مجازی `_table` ستون در نمایش داده شد به `Merge` میز -- رفع اشکال در هنگام استفاده از `ALIAS` ستونها در `Distributed` میز -- رفع اشکال ساخته شده است که تلفیقی پویا غیر ممکن است برای نمایش داده شد با توابع کل از `quantile` خانواده -- ثابت شرایط مسابقه در خط لوله اجرای پرس و جو که در موارد بسیار نادر رخ داده است در هنگام استفاده از `Merge` جداول با تعداد زیادی از جداول, و در هنگام استفاده از `GLOBAL` subqueries. -- تصادف را هنگام عبور از اندازه های مختلف به یک ثابت کرد `arrayReduce` تابع در هنگام استفاده از توابع کل از استدلال های متعدد. -- ممنوع استفاده از نمایش داده شد با `UNION ALL` در یک `MATERIALIZED VIEW`. -- خطا در هنگام مقدار دهی اولیه از ثابت `part_log` جدول سیستم زمانی که سرور شروع می شود (به طور پیش فرض, `part_log` غیر فعال است). - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-10} - -- حذف `distributed_ddl_allow_replicated_alter` انتخاب این رفتار به طور پیش فرض فعال. -- حذف `strict_insert_defaults` تنظیمات. اگر شما با استفاده از این قابلیت, ارسال به `clickhouse-feedback@yandex-team.com`. -- حذف `UnsortedMergeTree` موتور - -### انتشار کلیک 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} - -- اضافه شدن پشتیبانی از ماکرو برای تعریف نام خوشه در نمایش داده شد ددل توزیع و سازنده جداول توزیع شده است: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. -- در حال حاضر نمایش داده شد مانند `SELECT ... FROM table WHERE expr IN (subquery)` با استفاده از پردازش `table` نمایه. -- پردازش تکراری بهبود یافته در هنگام قرار دادن به جداول تکرار, به طوری که دیگر کم کردن سرعت اجرای صف تکرار. - -### انتشار کلیک 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} - -این نسخه شامل رفع اشکال برای نسخه قبلی 1.1.54337: - -- ثابت رگرسیون در 1.1.54337: اگر کاربر به طور پیش فرض دسترسی خوانده است, سپس سرور حاضر به راه اندازی با پیام `Cannot create database in readonly mode`. -- ثابت رگرسیون در 1.1.54337: در سیستم های با سیستم, سیاهههای مربوط همیشه به سای لاگ صرف نظر از پیکربندی نوشته شده; اسکریپت دیده بان هنوز هم با استفاده از اینیت.د -- ثابت رگرسیون در 1.1.54337: پیکربندی پیش فرض اشتباه در تصویر کارگر بارانداز. -- ثابت nondeterministic رفتار graphitemergetree (شما می توانید آن را در ورود به سیستم پیام `Data after merge is not byte-identical to the data on another replicas`). -- رفع اشکال که ممکن است منجر به ادغام متناقض پس از بهینه سازی پرس و جو به تکرار جداول (شما ممکن است در پیام ورود به سیستم را ببینید `Part ... intersects the previous part`). -- جداول بافر در حال حاضر به درستی کار زمانی که ستون محقق در جدول مقصد وجود دارد (توسط ژانگ2014). -- رفع اشکال در اجرای پوچ. - -### انتشار کلیک 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} - -#### ویژگی های جدید: {#new-features-17} - -- اضافه شدن پشتیبانی برای ذخیره سازی از مجموعه های چند بعدی و تاپل (`Tuple` نوع داده) در جداول. -- پشتیبانی از توابع جدول برای `DESCRIBE` و `INSERT` نمایش داده شد. اضافه شدن پشتیبانی برای کارخانه های فرعی در `DESCRIBE`. مثالها: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. پشتیبانی از `INSERT INTO TABLE` علاوه بر `INSERT INTO`. -- پشتیبانی بهبود یافته برای مناطق زمانی. این `DateTime` نوع داده را می توان با منطقه زمانی است که برای تجزیه و قالب بندی در فرمت های متنی استفاده مشروح. مثال: `DateTime('Europe/Moscow')`. هنگامی که زمان در توابع برای مشخص `DateTime` استدلال, نوع بازگشت منطقه زمانی پیگیری, و ارزش نمایش داده خواهد شد به عنوان انتظار می رود. -- اضافه شدن توابع `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. این `toRelativeHour`/`Minute`/`Second` توابع می توانند یک مقدار از نوع را `Date` به عنوان یک استدلال. این `now` نام تابع حساس به حروف است. -- اضافه شدن `toStartOfFifteenMinutes` تابع (کریل شواکوف). -- اضافه شدن `clickhouse format` ابزار برای قالب بندی نمایش داده شد. -- اضافه شدن `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` قالب. فایل های طرح را می توان تنها در دایرکتوری مشخص شده واقع شده است. -- اضافه شدن پشتیبانی برای تعویض پیکربندی (`incl` و `conf.d`) برای پیکربندی لغت نامه ها و مدل های خارجی (پاول یاکونین). -- اضافه شدن یک ستون با اسناد و مدارک برای `system.settings` جدول (Kirill Shvakov). -- اضافه شدن `system.parts_columns` جدول با اطلاعات در مورد اندازه ستون در هر بخش داده ها از `MergeTree` میز -- اضافه شدن `system.models` جدول با اطلاعات در مورد لود `CatBoost` مدل های یادگیری ماشین. -- اضافه شدن `mysql` و `odbc` عملکرد جدول و متناظر `MySQL` و `ODBC` موتورهای جدول برای دسترسی به پایگاه داده از راه دور. این قابلیت در مرحله بتا است. -- اضافه شدن امکان به تصویب یک استدلال از نوع `AggregateFunction` برای `groupArray` تابع جمع (بنابراین شما می توانید مجموعه ای از کشورهای برخی از تابع جمع ایجاد). -- محدودیت حذف در ترکیب های مختلف از ترکیب تابع جمع. مثلا, شما می توانید استفاده کنید `avgForEachIf` و همچنین `avgIfForEach` توابع مجموع, که رفتارهای مختلف. -- این `-ForEach` ترکیب تابع مجموع برای مورد توابع مجموع استدلال های متعدد گسترش یافته است. -- اضافه شدن پشتیبانی از توابع کل `Nullable` استدلال حتی برای موارد زمانی که تابع غیر گرداند-`Nullable` نتیجه (اضافه شده با سهم سیلو کاروجا). مثال: `groupArray`, `groupUniqArray`, `topK`. -- اضافه شدن `max_client_network_bandwidth` برای `clickhouse-client` (Kirill Shvakov). -- کاربران با `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). -- اضافه شدن پشتیبانی برای استفاده از مصرف کنندگان متعدد با `Kafka` موتور گزینه های پیکربندی گسترده برای `Kafka` (Marek Vavruša). -- اضافه شدن `intExp3` و `intExp4` توابع. -- اضافه شدن `sumKahan` تابع جمع. -- اضافه شده به \* شماره\* توابع پرنده, جایی که \* شماره \* یک نوع عددی است. -- اضافه شدن پشتیبانی برای `WITH` جملات برای `INSERT SELECT` پرس و جو (نویسنده: ژانگ2014). -- تنظیمات اضافه شده: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. به خصوص این تنظیمات برای دانلود قطعات داده ها برای تکرار استفاده می شود. تغییر این تنظیمات اجازه می دهد تا برای عدم موفقیت سریع تر اگر شبکه غیرمنتظره است. -- اضافه شدن پشتیبانی برای `ALTER` برای جداول نوع `Null` هشدار داده می شود -- این `reinterpretAsString` تابع برای تمام انواع داده ها که به روشنی در حافظه ذخیره می شود گسترش یافته است. -- اضافه شدن `--silent` گزینه ای برای `clickhouse-local` ابزار. این سرکوب چاپ اطلاعات اجرای پرس و جو در خ. -- اضافه شدن پشتیبانی برای خواندن مقادیر نوع `Date` از متن در قالب ای که ماه و / یا روز از ماه مشخص شده است با استفاده از یک رقم واحد به جای دو رقم (پرنده ایموس). - -#### بهینه سازی عملکرد: {#performance-optimizations} - -- عملکرد بهبود یافته از توابع کل `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` از استدلال رشته. -- عملکرد بهبود یافته از توابع `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. -- بهبود عملکرد تجزیه و قالب بندی `Date` و `DateTime` ارزش نوع در قالب متن. -- بهبود عملکرد و دقت تجزیه اعداد ممیز شناور. -- کاهش استفاده از حافظه برای `JOIN` در مورد زمانی که قطعات چپ و راست ستون با نام یکسان است که در موجود نیست `USING` . -- عملکرد بهبود یافته از توابع کل `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` با کاهش ثبات محاسباتی. توابع قدیمی تحت نام در دسترس هستند `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. - -#### رفع اشکال: {#bug-fixes-28} - -- ثابت data deduplication را پس از اجرا `DROP` یا `DETACH PARTITION` پرس و جو. در نسخه های قبلی, حذف یک پارتیشن و قرار دادن داده های مشابه دوباره کار نمی کند چرا بلوک قرار داده تکراری در نظر گرفته شد. -- رفع اشکال که می تواند به تفسیر نادرست از منجر شود `WHERE` بند برای `CREATE MATERIALIZED VIEW` نمایش داده شد با `POPULATE` . -- رفع اشکال در استفاده از `root_path` پارامتر در `zookeeper_servers` پیکربندی. -- نتایج غیر منتظره ثابت از عبور از `Date` نشانوند به `toStartOfDay` . -- ثابت `addMonths` و `subtractMonths` توابع و حساب برای `INTERVAL n MONTH` در مواردی که نتیجه سال گذشته است. -- اضافه شدن پشتیبانی از دست رفته برای `UUID` نوع داده برای `DISTINCT` , `JOIN` و `uniq` توابع جمع و لغت نامه های خارجی (اوگنی ایوانف). پشتیبانی از `UUID` هنوز ناقصه -- ثابت `SummingMergeTree` رفتار در مواردی که ردیف خلاصه به صفر است. -- رفع مختلف برای `Kafka` engine (Marek Vavruša). -- رفتار نادرست ثابت از `Join` موتور جدول (پرنده ایموس). -- رفتار تخصیص نادرست ثابت تحت بورس و سیستم عامل ایکس. -- این `extractAll` تابع در حال حاضر مسابقات خالی پشتیبانی می کند. -- ثابت خطا که استفاده از مسدود `libressl` به جای `openssl` . -- ثابت `CREATE TABLE AS SELECT` پرس و جو از جداول موقت. -- ثابت غیر atomicity از به روز رسانی تکرار صف. این می تواند منجر به کپی بودن از همگام سازی تا سرور ری استارت. -- سرریز ممکن ثابت در `gcd` , `lcm` و `modulo` (`%` اپراتور) (ماکس اسکروخد). -- `-preprocessed` فایل ها در حال حاضر پس از تغییر ایجاد شده است `umask` (`umask` را می توان در پیکربندی تغییر). -- رفع اشکال در چک پس زمینه از قطعات (`MergeTreePartChecker` )هنگام استفاده از یک کلید پارتیشن سفارشی . -- تجزیه ثابت از تاپل (ارزش های `Tuple` نوع داده) در فرمت های متن. -- پیام های خطا بهبود یافته در مورد انواع ناسازگار منتقل شده به `multiIf` , `array` و برخی دیگر توابع. -- پشتیبانی دوباره طراحی شده برای `Nullable` انواع. اشکالات ثابت که ممکن است به یک تصادف سرور منجر شود. ثابت تقریبا تمام اشکالات دیگر مربوط به `NULL` پشتیبانی: نادرست نوع تبدیل در وارد کردن را انتخاب کنید کافی برای حمایت از Nullable در داشتن و PREWHERE, `join_use_nulls` حالت, انواع قابل ابطال به عنوان استدلال `OR` اپراتور و غیره -- اشکالات مختلف ثابت مربوط به معانی داخلی انواع داده ها. نمونه: جمع غیر ضروری از `Enum` فیلدهای تایپ شده `SummingMergeTree` ; تراز دلخواه `Enum` انواع در `Pretty` فرمت, و غیره. -- چک سختگیرانه تر برای ترکیب مجاز از ستون کامپوزیت. -- ثابت سرریز در هنگام تعیین یک پارامتر بسیار بزرگ برای `FixedString` نوع داده. -- رفع اشکال در `topK` تابع جمع در یک مورد عمومی. -- اضافه شدن چک از دست رفته برای برابری اندازه مجموعه ای در استدلال از انواع ن-عرایی از توابع کل با `-Array` ترکیب کننده. -- رفع اشکال در `--pager` برای `clickhouse-client` (نویسنده: کس1322). -- ثابت دقت از `exp10` تابع. -- ثابت رفتار `visitParamExtract` تابع برای انطباق بهتر با اسناد و مدارک. -- ثابت تصادف زمانی که انواع داده های نادرست مشخص شده است. -- رفتار را ثابت کرد `DISTINCT` در مورد زمانی که همه ستون ثابت هستند. -- قالب بندی پرس و جو ثابت در مورد استفاده از `tupleElement` تابع با یک عبارت ثابت پیچیده به عنوان شاخص عنصر تاپل. -- رفع اشکال در `Dictionary` جداول برای `range_hashed` واژهنامهها. -- رفع اشکال که منجر به ردیف بیش از حد در نتیجه `FULL` و `RIGHT JOIN` (پرنده ایموس). -- ثابت سقوط سرور در هنگام ایجاد و از بین بردن فایل های موقت در `config.d` دایرکتوری در طول بازنگری پیکربندی. -- ثابت `SYSTEM DROP DNS CACHE` پرس و جو: کش سرخ شد اما نشانی از گره های خوشه ای به روز شد. -- رفتار را ثابت کرد `MATERIALIZED VIEW` پس از اجرای `DETACH TABLE` for the table under the view (Marek Vavruša). - -#### بهبود ساخت: {#build-improvements-4} - -- این `pbuilder` ابزار برای ساخت استفاده می شود. روند ساخت تقریبا به طور کامل مستقل از محیط میزبان ساخت است. -- ساخت تک برای نسخه های سیستم عامل های مختلف استفاده می شود. بسته ها و فایل های باینری سازگار با طیف گسترده ای از سیستم های لینوکس ساخته شده است. -- اضافه شدن `clickhouse-test` بسته این می تواند مورد استفاده قرار گیرد برای اجرای تست های کاربردی. -- قطار سریع السیر منبع هم اکنون می توانید به مخزن منتشر شود. این می تواند مورد استفاده قرار گیرد به تولید مثل ساخت بدون استفاده از گیتهاب. -- اضافه شده ادغام محدود با تراویس سی. با توجه به محدودیت در زمان ساخت در تراویس, تنها ساخت اشکال زدایی تست شده است و یک زیر مجموعه محدود از تست اجرا می شوند. -- اضافه شدن پشتیبانی برای `Cap'n'Proto` در ساخت به طور پیش فرض. -- فرمت منابع اسناد را تغییر داد `Restricted Text` به `Markdown`. -- اضافه شدن پشتیبانی برای `systemd` (ولادیمیر اسمیرنوف). این است که به طور پیش فرض به دلیل ناسازگاری با برخی از تصاویر سیستم عامل غیر فعال است و می تواند به صورت دستی فعال کنید. -- برای تولید کد پویا, `clang` و `lld` به جاسازی شده `clickhouse` دودویی. همچنین می توانند به عنوان `clickhouse clang` و `clickhouse lld` . -- استفاده از پسوندهای گنو از کد حذف شده است. فعال کردن `-Wextra` انتخاب هنگام ساخت با `clang` به طور پیش فرض است `libc++` به جای `libstdc++`. -- استخراج شده `clickhouse_parsers` و `clickhouse_common_io` کتابخانه ها برای سرعت بخشیدن به ایجاد ابزارهای مختلف. - -#### تغییرات ناسازگار به عقب: {#backward-incompatible-changes-11} - -- قالب برای علامت در `Log` جداول نوع که شامل `Nullable` ستون در راه ناسازگار به عقب تغییر یافت. اگر شما این جداول, شما باید به تبدیل `TinyLog` قبل از شروع نسخه سرور جدید تایپ کنید. برای انجام این کار جایگزین کنید `ENGINE = Log` با `ENGINE = TinyLog` در مربوطه `.sql` پرونده در `metadata` فهرست راهنما. اگر جدول شما ندارد `Nullable` ستون و یا اگر نوع جدول خود را نمی `Log` پس نیازی نیست کاری بکنی -- حذف `experimental_allow_extended_storage_definition_syntax` تنظیمات. در حال حاضر این ویژگی به طور پیش فرض فعال است. -- این `runningIncome` تابع به تغییر نام داد `runningDifferenceStartingWithFirstvalue` برای جلوگیری از سردرگمی. -- حذف `FROM ARRAY JOIN arr` نحو زمانی که مجموعه اضافه کردن به طور مستقیم پس از با هیچ جدول مشخص (پرنده ایموس). -- حذف `BlockTabSeparated` فرمت که صرفا برای اهداف تظاهرات مورد استفاده قرار گرفت. -- فرمت دولت برای توابع کل تغییر `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. اگر شما ایالات از این توابع کل در جداول ذخیره شده اند (با استفاده از `AggregateFunction` نوع داده و یا نمایش تحقق با کشورهای مربوطه), لطفا به ارسال clickhouse-feedback@yandex-team.com. -- در نسخه های سرور قبلی یک ویژگی مستند نشده وجود داشت: اگر یک تابع جمع شده به پارامترها بستگی داشته باشد هنوز هم می توانید بدون پارامتر در نوع داده قابلیت کارکرد مشخص کنید. مثال: `AggregateFunction(quantiles, UInt64)` به جای `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. این ویژگی از دست داده بود. ما قصد داریم دوباره در نسخه های بعدی پشتیبانی کنیم. -- انواع داده شمارشی را نمی توان در توابع جمع دقیقه/حداکثر استفاده می شود. این توانایی خواهد شد در نسخه بعدی بازگشت. - -#### لطفا توجه داشته باشید در هنگام به روز رسانی: {#please-note-when-upgrading} - -- هنگام انجام یک به روز رسانی نورد در یک خوشه, در نقطه ای که برخی از کپی در حال اجرا هستند نسخه های قدیمی از تاتر و برخی در حال اجرا هستند نسخه جدید, تکرار است به طور موقت متوقف و پیام `unknown parameter 'shard'` به نظر می رسد در ورود به سیستم. تکرار ادامه خواهد داد پس از همه کپی از خوشه به روز می شوند. -- اگر نسخه های مختلف از تاتر در حال اجرا بر روی سرورهای خوشه, ممکن است که نمایش داده شد توزیع با استفاده از توابع زیر نتایج نادرست داشته باشد: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. شما باید تمام گره های خوشه ای به روز رسانی. - -## [تغییرات برای 2017](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/fa/whats_new/changelog/2019.md b/docs/fa/whats_new/changelog/2019.md deleted file mode 100644 index 60e34307c25..00000000000 --- a/docs/fa/whats_new/changelog/2019.md +++ /dev/null @@ -1,2074 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 77 -toc_title: '2019' ---- - -## انتشار کلیک و19. 17 {#clickhouse-release-v19-17} - -### ClickHouse انتشار v19.17.6.36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} - -#### رفع اشکال {#bug-fix} - -- سرریز بافر بالقوه ثابت در حالت فشرده خارج. کاربر مخرب می تواند داده های فشرده ساخته شده است که می تواند باعث به عنوان خوانده شده پس از بافر منتقل می کند. این موضوع توسط الدار زیتوف از تیم امنیت اطلاعات یاندکس یافت شد. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت سقوط سرور ممکن است (`std::terminate`) هنگامی که سرور نمی تواند ارسال و یا ارسال داده ها در فرمت جسون یا میلی لیتر با ارزش از نوع داده رشته (که نیاز به اعتبار سنجی-8) و یا زمانی که فشرده سازی داده ها نتیجه با الگوریتم بروتلی و یا در برخی موارد نادر دیگر. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت لغت نامه با منبع از یک clickhouse `VIEW` در حال حاضر خواندن چنین واژهنامهها خطا ایجاد نمی کند `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- ثابت چک کردن اگر یک مشتری میزبان مجاز است با host\_regexp مشخص شده در کاربران.. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([ویتالی بارانو](https://github.com/vitlibar)) -- `RENAME TABLE` برای یک جدول توزیع در حال حاضر تغییر نام پوشه حاوی داده های درج شده قبل از ارسال به خرده ریز. این رفع یک موضوع را با تغییر نام های پی در پی `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([تاولوبیکس](https://github.com/tavplubix)) -- `range_hashed` واژهنامهها خارجی ایجاد شده توسط دی ال نمایش داده شد در حال حاضر اجازه می دهد محدوده از انواع عددی دلخواه. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([الساپین](https://github.com/alesapin)) -- ثابت `INSERT INTO table SELECT ... FROM mysql(...)` تابع جدول. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([تاولوبیکس](https://github.com/tavplubix)) -- ثابت segfault در `INSERT INTO TABLE FUNCTION file()` در حالی که قرار دادن به یک فایل که وجود ندارد. در حال حاضر در این مورد فایل ایجاد می شود و سپس قرار دادن پردازش می شود. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- خطای بیت مپ ثابت زمانی که متقاطع بیت مپ جمع و بیت مپ اسکالر. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([یو هوانگ](https://github.com/moon03432)) -- ثابت زمانی که segfault `EXISTS` پرس و جو بدون استفاده شد `TABLE` یا `DICTIONARY` مقدماتی, درست مثل `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نوع بازگشت ثابت برای توابع `rand` و `randConstant` در صورت بحث باطل. در حال حاضر توابع همیشه بازگشت `UInt32` و هرگز `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- ثابت `DROP DICTIONARY IF EXISTS db.dict` در حال حاضر استثنا پرتاب نمی کند اگر `db` وجود نداره [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([ویتالی بارانو](https://github.com/vitlibar)) -- اگر یک جدول به دلیل سقوط سرور به طور کامل کاهش یافته است, سرور سعی خواهد کرد برای بازگرداندن و بارگذاری [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([تاولوبیکس](https://github.com/tavplubix)) -- ثابت پرس و جو تعداد بی اهمیت برای یک جدول توزیع اگر بیش از دو میز محلی سفال وجود دارد. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- اشکال ثابت که منجر به یک مسابقه داده در db::blockstreamprofileinfo::calculaterowsbeforelimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([الکساندر کازاکوف](https://github.com/Akazz)) -- ثابت `ALTER table MOVE part` اعدام بلافاصله پس از ادغام بخش مشخص, که می تواند باعث حرکت بخشی که بخش مشخص شده به هم ادغام شدند. در حال حاضر به درستی حرکت می کند بخش مشخص شده است. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- عبارات برای لغت نامه را می توان به عنوان رشته در حال حاضر مشخص شده است. این بسیار مفید است برای محاسبه ویژگی های در حالی که استخراج داده ها از غیر clickhouse منابع به دلیل آن اجازه می دهد تا به استفاده از غیر clickhouse نحو برای آن دسته از عبارات. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([الساپین](https://github.com/alesapin)) -- ثابت یک مسابقه بسیار نادر در `clickhouse-copier` به دلیل سرریز در زکسید. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) -- رفع اشکال زمانی که پس از پرس و جو شکست خورده (با توجه به “Too many simultaneous queries” به عنوان مثال) این اطلاعات جداول خارجی را نمی خواند و - درخواست بعدی این اطلاعات را به عنوان ابتدای پرس و جو بعدی تفسیر می کند که باعث خطا می شود `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([ازات خوژین](https://github.com/azat)) -- اجتناب از اختلاف پوچ پس از “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([ازات خوژین](https://github.com/azat)) -- بازگرداندن پشتیبانی از تمام مناطق ایکو, اضافه کردن توانایی به درخواست تلفیقی برای عبارات ثابت و اضافه کردن نام زبان به سیستم.collations جدول. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([الساپین](https://github.com/alesapin)) -- تعداد جریان برای خواندن از `StorageFile` و `StorageHDFS` در حال حاضر محدود, برای جلوگیری از بیش از حد حافظه. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([الساپین](https://github.com/alesapin)) -- ثابت `CHECK TABLE` پرسوجو برای `*MergeTree` جداول بدون کلید. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([الساپین](https://github.com/alesapin)) -- حذف تعداد جهش از یک نام بخشی در صورتی که هیچ جهش وجود دارد. این حذف بهبود سازگاری با نسخه های قدیمی تر. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([الساپین](https://github.com/alesapin)) -- رفع اشکال که جهش برای برخی از قطعات متصل به دلیل انحراف خود قلم بزرگتر از نسخه جهش جدول. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([ژیچنگ یو](https://github.com/yuzhichang)) -- اجازه شروع سرور با کپی کار برکنار شده از قطعات پس از حرکت به دستگاه دیگر. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- خطا را ثابت کرد “Sizes of columns doesn’t match” که ممکن است در هنگام استفاده از ستون تابع جمع به نظر می رسد. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([بوریس گرانویو](https://github.com/bgranvea)) -- در حال حاضر یک استثنا خواهد شد در صورت استفاده با روابط در کنار محدودیت های پرتاب. و در حال حاضر امکان استفاده از بالا با محدودیت توسط. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- رفع بارگذاری مجدد فرهنگ لغت در صورتی که `invalidate_query` که متوقف به روز رسانی و برخی از استثنا در به روز رسانی قبلی تلاش می کند. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([الساپین](https://github.com/alesapin)) - -### ClickHouse انتشار v19.17.4.11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} - -#### تغییر ناسازگار به عقب {#backward-incompatible-change} - -- با استفاده از ستون به جای اس تی برای ذخیره نتایج زیرخاکری اسکالر برای عملکرد بهتر است. تنظیم `enable_scalar_subquery_optimization` در 19.17 اضافه شد و به طور پیش فرض فعال شد. این منجر به اشتباهات مانند [این](https://github.com/ClickHouse/ClickHouse/issues/7851) در طی ارتقا به 19.17.2 یا 19.17.3 از نسخه های قبلی است. این تنظیم به طور پیش فرض فعال در 19.17.4 را ممکن است به روز رسانی از 19.16 و نسخه های قدیمی تر و بدون خطا. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([ایموس پرنده](https://github.com/amosbird)) - -#### ویژگی جدید {#new-feature} - -- اضافه کردن توانایی برای ایجاد لغت نامه با پرس و جو ددل. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([الساپین](https://github.com/alesapin)) -- ساخت `bloom_filter` نوع حمایت از شاخص `LowCardinality` و `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- افزودن تابع `isValidJSON` برای بررسی رشته گذشت که جانسون معتبر است. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([ولادیمیر](https://github.com/Vdimir)) -- پیاده سازی `arrayCompact` تابع [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([یادداشت](https://github.com/Joeywzr)) -- تابع ایجاد شده `hex` برای اعداد اعشاری. این کار مانند `hex(reinterpretAsString())` اما صفر بایت گذشته را حذف کنید. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([میخیل کوروتف](https://github.com/millb)) -- افزودن `arrayFill` و `arrayReverseFill` توابع که عناصر را با عناصر دیگر در جلو/عقب در مجموعه جایگزین می کنند. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([هکز](https://github.com/hczhcz)) -- افزودن `CRC32IEEE()`/`CRC64()` پردازشگر پشتیبانی شده: [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([ازات خوژین](https://github.com/azat)) -- پیاده سازی `char` عملکرد شبیه به یک در [خروجی زیر](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- افزودن `bitmapTransform` تابع. این مجموعه ای از ارزش ها را در بیت مپ به مجموعه ای دیگر از ارزش ها تبدیل می کند و نتیجه یک بیت مپ جدید است [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([ژیچنگ یو](https://github.com/yuzhichang)) -- پیادهسازی شده `javaHashUTF16LE()` تابع [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([ایشیمب](https://github.com/achimbab)) -- افزودن `_shard_num` ستون مجازی برای موتور توزیع شده [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([ازات خوژین](https://github.com/azat)) - -#### ویژگی تجربی {#experimental-feature} - -- پشتیبانی از پردازنده (خط لوله اجرای پرس و جو جدید) در `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -#### رفع اشکال {#bug-fix-1} - -- رفع شناور نادرست تجزیه در `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع بن بست نادر است که می تواند رخ دهد که ردیاب را فعال کنید. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([فیلیمونف](https://github.com/filimonov)) -- جلوگیری از تکرار پیام در هنگام تولید جدول کافکا دارای هر گونه رزومه انتخاب از [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([ایوان](https://github.com/abyss7)) -- پشتیبانی از `Array(LowCardinality(Nullable(String)))` داخل `IN`. برطرف [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([ایشیمب](https://github.com/achimbab)) -- اضافه کردن سیستم های انتقال مواد از `SQL_TINYINT` و `SQL_BIGINT`, و رفع دست زدن به `SQL_FLOAT` انواع منبع داده در اد بی سی پل. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([دنیس گلازاشف](https://github.com/traceon)) -- رفع تجمع (`avg` و تعداد کمی) روی ستونهای دهدهی خالی [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([اندری کونیایف](https://github.com/akonyaev90)) -- ثابت `INSERT` به توزیع با `MATERIALIZED` ستونها [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([ازات خوژین](https://github.com/azat)) -- ساخت `MOVE PARTITION` کار اگر برخی از قسمت های پارتیشن در حال حاضر بر روی دیسک مقصد یا حجم [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اشکال ثابت با لینک های سخت عدم در طول جهش در ایجاد می شود `ReplicatedMergeTree` در تنظیمات چند دیسک. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع اشکال با یک جهش در ادغام زمانی که تمام قسمت بدون تغییر باقی می ماند و بهترین فضا است که بر روی دیسک دیگر یافت می شود [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اشکال ثابت با `keep_free_space_ratio` از پیکربندی دیسکها قابل خواندن نیست [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع اشکال با جدول شامل تنها `Tuple` ستون ها یا ستون ها با مسیرهای پیچیده. رفع [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([الساپین](https://github.com/alesapin)) -- حافظه را برای موتور بافر در حداکثر\_موری\_سیاژ حساب نکنید [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([ازات خوژین](https://github.com/azat)) -- رفع استفاده از علامت نهایی در `MergeTree` جداول مرتب شده بر اساس `tuple()`. در موارد نادر می تواند منجر به `Can't adjust last granule` خطا هنگام انتخاب. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع اشکال در جهش که با اقداماتی که نیاز به زمینه (به عنوان مثال توابع برای جانسون) مسند که ممکن است منجر به سقوط و یا استثنا عجیب و غریب. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([الساپین](https://github.com/alesapin)) -- رفع عدم تطابق پایگاه داده و نام جدول فرار در `data/` و `shadow/` & فهرستهای راهنما [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([الکساندر بورمک](https://github.com/Alex-Burmak)) -- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. رفع سقوط در این مورد. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([زویکوف](https://github.com/4ertus2)) -- ثابت `Not found column in block` هنگام پیوستن به در بیان با راست یا کامل ملحق. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([زویکوف](https://github.com/4ertus2)) -- یکی دیگر از تلاش برای رفع حلقه بی نهایت در `PrettySpace` قالب [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- رفع اشکال در `concat` تابع زمانی که همه استدلال شد `FixedString` از همان اندازه. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([الساپین](https://github.com/alesapin)) -- استثنا ثابت در صورت استفاده از 1 استدلال در حالی که تعریف اس3, نشانی اینترنتی و ذخیره سازی اچ دی. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع دامنه تفسیری برای نمایش با پرس و جو [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([ازات خوژین](https://github.com/azat)) - -#### بهبود {#improvement} - -- `Nullable` ستون به رسمیت شناخته شده و تهی ارزش به درستی توسط ان بی سی پل به کار گرفته [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([واسیلی نمکو](https://github.com/Enmk)) -- ارسال دسته ای در حال حاضر برای توزیع ارسال اتمی [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([ازات خوژین](https://github.com/azat)) -- پرتاب یک استثنا اگر ما می توانیم جدول برای نام ستون در پرس و جو تشخیص نیست. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([زویکوف](https://github.com/4ertus2)) -- افزودن `merge_max_block_size` تنظیم به `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([زویکوف](https://github.com/4ertus2)) -- نمایش داده شد با `HAVING` و بدون `GROUP BY` فرض گروه های ثابت. پس, `SELECT 1 HAVING 1` در حال حاضر نتیجه را برمی گرداند. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([ایموس پرنده](https://github.com/amosbird)) -- تجزیه پشتیبانی `(X,)` به عنوان تاپل شبیه به پایتون. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([ایموس پرنده](https://github.com/amosbird)) -- ساخت `range` رفتارهای تابع تقریبا مانند یک پیتون. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- افزودن `constraints` ستونها به جدول `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([ویتالی بارانو](https://github.com/vitlibar)) -- فرمت پوچ بهتر برای کنترل کننده تی پی, به طوری که ممکن است به استفاده از `select ignore() from table format Null` برای اندازه گیری نیروی هوایی پاکستان از طریق کلیک مشتری [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([ایموس پرنده](https://github.com/amosbird)) -- نمایش داده شد مانند `CREATE TABLE ... AS (SELECT (1, 2))` به درستی تجزیه شده است [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([هکز](https://github.com/hczhcz)) - -#### بهبود عملکرد {#performance-improvement} - -- عملکرد تجمع بیش از کلید های رشته کوتاه بهبود یافته است. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([الکساندر کوزمنکوف](https://github.com/akuzm), [ایموس پرنده](https://github.com/amosbird)) -- یک پاس دیگر از تجزیه و تحلیل نحو/بیان را اجرا کنید تا بهینه سازی های بالقوه پس از پیش بینی های ثابت خورده شوند. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([ایموس پرنده](https://github.com/amosbird)) -- استفاده از ذخیره سازی متا اطلاعات به ارزیابی بی اهمیت `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([ایموس پرنده](https://github.com/amosbird), [الکسی میلویدو](https://github.com/alexey-milovidov)) -- Vectorize پردازش `arrayReduce` شبیه به تجمعی `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([ایموس پرنده](https://github.com/amosbird)) -- بهبود صغیر در عملکرد `Kafka` مصرف [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([ایوان](https://github.com/abyss7)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement} - -- اضافه کردن پشتیبانی برای متقابل کامپایل به معماری پردازنده عاشق64. refactor packager اسکریپت. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([ایوان](https://github.com/abyss7)) -- باز کردن داروین-x86\_64 و لینوکس-aarch64 toolchains به نصب docker دوره زمانی که ساختمان بسته [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([ایوان](https://github.com/abyss7)) -- به روز رسانی تصویر کارگر بارانداز برای باینری بسته بندی [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([ایوان](https://github.com/abyss7)) -- خطاهای کامپایل ثابت در مکینتاش کاتالینا [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([ارنست پلتایف](https://github.com/ernestp)) -- برخی از فاکتورگیری مجدد در منطق تجزیه و تحلیل پرس و جو: تقسیم کلاس پیچیده را به چند ساده. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([زویکوف](https://github.com/4ertus2)) -- رفع ساخت بدون زیر منو [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([پرولر](https://github.com/proller)) -- بهتر `add_globs` در فایل های کیک [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([ایموس پرنده](https://github.com/amosbird)) -- حذف مسیرهای سختشده در `unwind` هدف [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([کنستانتین پودشوموک](https://github.com/podshumok)) -- مجاز به استفاده از فرمت خروجی زیر بدون اس اس ال [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([پرولر](https://github.com/proller)) - -#### غیره {#other} - -- اضافه شده antlr4 گرامر برای clickhouse sql گویش [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -## انتشار کلیک و19. 16 {#clickhouse-release-v19-16} - -#### انتشار کلیک و19.16. 14. 65, 2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} - -- رفع اشکال در محاسبات باریکش از عملیات منطقی سه تایی در استدلال های متعدد (بیش از 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([الکساندر کازاکوف](https://github.com/Akazz)) این bugfix شد backported به نسخه 19.16 توسط یک درخواست ویژه از Altinity. - -#### Clickhouse انتشار v19.16.14.65 و 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} - -- رفع ناسازگاری خرده فروشی توزیع با نسخه های قدیمی تر کانال. رفع [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) - [(تبلوبیکس)](https://github.com/tavplubix) -- هنگام اجرای `CREATE` پرس و جو, برابر عبارات ثابت در استدلال موتور ذخیره سازی. جایگزین کردن نام دادگان خالی با دادگان فعلی. رفع [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). همچنین رفع بررسی برای نشانی محلی در `ClickHouseDictionarySource`. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(تبلوبیکس)](https://github.com/tavplubix) -- در حال حاضر پس زمینه ادغام در `*MergeTree` موتورهای جدول خانواده حفظ سیاست ذخیره سازی حجم سفارش دقیق تر. - [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- جلوگیری از از دست دادن داده ها در `Kafka` در موارد نادر زمانی که استثنا اتفاق می افتد پس از خواندن پسوند اما قبل از ارتکاب. رفع [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). مرتبط: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(فیلیمونف)](https://github.com/filimonov) -- رفع اشکال منجر به ختم سرور در هنگام تلاش برای استفاده / رها کردن `Kafka` جدول ایجاد شده با پارامترهای اشتباه. رفع [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). دارای [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(فیلیمونف)](https://github.com/filimonov) -- اجازه استفاده `MaterializedView` با subqueries بالا `Kafka` میز - [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([فیلیمونف](https://github.com/filimonov)) - -#### ویژگی جدید {#new-feature-1} - -- افزودن `deduplicate_blocks_in_dependent_materialized_views` گزینه ای برای کنترل رفتار درج ژولیده به جداول با نمایش محقق. این ویژگی جدید توسط یک درخواست ویژه از التیت به نسخه رفع اشکال اضافه شد. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [.)](https://github.com/urykhy) - -### ClickHouse انتشار v19.16.2.2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-1} - -- اضافه کردن گم شده arity اعتبار برای تعداد/counif. - [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) - [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([ولادیمیر](https://github.com/Vdimir)) -- حذف میراث `asterisk_left_columns_only` تنظیم (به طور پیش فرض غیر فعال شد). - [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([علم هنر - زویکوف](https://github.com/4ertus2)) -- رشته فرمت برای قالب فرمت داده در حال حاضر در فایل های مشخص شده است. - [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([تاولوبیکس](https://github.com/tavplubix)) - -#### ویژگی جدید {#new-feature-2} - -- معرفی uniqcombined64() برای محاسبه cardinality بیشتر از uint\_max. - [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), - [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([ازات - خوژین](https://github.com/azat)) -- پشتیبانی از شاخص های فیلتر بلوم در ستون های مجموعه. - [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) - ([ایشیمب](https://github.com/achimbab)) -- اضافه کردن یک تابع `getMacro(name)` که رشته را برمی گرداند با ارزش مربوطه `` - از پیکربندی سرور. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) - ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تنظیم دو گزینه پیکربندی برای یک فرهنگ لغت بر اساس یک منبع قام: `credentials` و - `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([گیمه - کاسری](https://github.com/YiuRULE)) -- افزودن سابقه جدید `Merge` که تعداد پس زمینه راه اندازی ادغام. - [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([میخیل - کوروتف](https://github.com/millb)) -- اضافه کردن تابع نام کامل است که یک نام دامنه به طور کامل واجد شرایط را برمی گرداند. - [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) - [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- افزودن تابع `arraySplit` و `arrayReverseSplit` که یک مجموعه تقسیم شده توسط “cut off” - شرایط. در دست زدن به توالی زمان مفید هستند. - [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([هکز](https://github.com/hczhcz)) -- اضافه کردن توابع جدید است که بازگشت مجموعه ای از تمام شاخص های همسان در خانواده چند از توابع. - [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([دنیلا - کوتنین](https://github.com/danlark1)) -- اضافه کردن یک موتور پایگاه داده جدید `Lazy` این است که برای ذخیره سازی تعداد زیادی از کوچک ورود به سیستم بهینه شده است - میز [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([نیکیتا - واسیلیف](https://github.com/nikvas0)) -- اضافه کردن توابع جمع گروهبیت مپند,- یا, - صخره نوردی برای ستون بیت مپ. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([ژیچنگ - یو](https://github.com/yuzhichang)) -- اضافه کردن مجموع عملکرد combinators -ornull و ordefault که بازگشت تهی - یا مقادیر پیش فرض زمانی که هیچ چیز به جمع وجود دارد. - [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) - ([هکز](https://github.com/hczhcz)) -- قالب داده های سفارشی را معرفی کنید که از فرار سفارشی پشتیبانی می کند و - قوانین جداساز. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([تاولوبیکس](https://github.com/tavplubix)) -- پشتیبانی ردیس به عنوان منبع فرهنگ لغت خارجی. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([کموندی](https://github.com/comunodi), [انتون - پوپوف](https://github.com/CurtizJ)) - -#### رفع اشکال {#bug-fix-2} - -- رفع نتیجه پرس و جو اشتباه در صورتی که `WHERE IN (SELECT ...)` بخش و `optimize_read_in_order` هست - استفاده می شود. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([انتون - پوپوف](https://github.com/CurtizJ)) -- پلاگین احراز هویت ماریادب غیر فعال, که بستگی به فایل های خارج از پروژه. - [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([یوری - Baranov](https://github.com/yurriy)) -- رفع استثنا `Cannot convert column ... because it is constant but values of constants are different in source and result` که به ندرت می تواند رخ دهد زمانی که توابع `now()`, `today()`, - `yesterday()`, `randConstant()` استفاده می شود. - [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([نیکولای - کوچتو](https://github.com/KochetovNicolai)) -- شماره ثابت با استفاده از اچ.تی. پی را نگه دارید ایست زنده به جای تی. پی نگه داشتن ایست زنده است. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([واسیلی - نمکو](https://github.com/Enmk)) -- گسل تقسیم بندی را در گروهبیتماپور ثابت کرد (شماره [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). - [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([ژیچنگ - یو](https://github.com/yuzhichang)) -- برای نمایش تحقق مرتکب کافکا نامیده می شود پس از تمام داده ها نوشته شده است. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([ایوان](https://github.com/abyss7)) -- اشتباه ثابت `duration_ms` مقدار در `system.part_log` جدول ده بار خاموش بود. - [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([ولادیمیر - Chebotarev](https://github.com/excitoon)) -- رفع سریع برای حل و فصل سقوط در جدول نمایش زنده و دوباره قادر می سازد تمام تست نمایش زنده. - [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) - ([vzakaznikov](https://github.com/vzakaznikov)) -- مرتب کردن مقادیر صفر به درستی در شاخص دقیقه/حداکثر از قطعات ادغام. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([الکساندر - کوزمنکوف](https://github.com/akuzm)) -- قرار نیست ستون مجازی به .sql ابرداده هنگامی که جدول ایجاد شده است `CREATE TABLE AS`. - [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([ایوان](https://github.com/abyss7)) -- رفع گسل تقسیم بندی در `ATTACH PART` پرس و جو. - [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) - ([الساپین](https://github.com/alesapin)) -- رفع نتیجه اشتباه برای برخی از نمایش داده شد داده شده توسط بهینه سازی خالی در کارخانه های فرعی و خالی - INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([نیکولای - کوچتو](https://github.com/KochetovNicolai)) -- رفع addresssanitizer خطا در نمایش زنده getheader روش (). - [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) - ([vzakaznikov](https://github.com/vzakaznikov)) - -#### بهبود {#improvement-1} - -- اضافه کردن یک پیام در صورت صبر کردن \_موا\_مایش صورت می گیرد. - [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([ازات - خوژین](https://github.com/azat)) -- تنظیم ساخته شده `s3_min_upload_part_size` جدول سطح. - [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([ولادیمیر - Chebotarev](https://github.com/excitoon)) -- در حال بارگذاری [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) - ([بستنی و مغز گردو](https://github.com/sundy-li)) -- بلوک کدو دست چپ در ادغام بخشی ملحق (بهینه سازی). - [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([علم هنر - زویکوف](https://github.com/4ertus2)) -- اجازه ندهید که توابع غیر قطعی در جهش موتورهای جدول تکرار, چرا که این - می توانید تناقضات بین کپی معرفی. - [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([الکساندر - کازاکوف](https://github.com/Akazz)) -- غیر فعال کردن ردیاب حافظه در حالی که تبدیل ردیابی پشته استثنا به رشته. این می تواند از دست دادن جلوگیری کند - از پیغام خطا از نوع `Memory limit exceeded` بر روی سرور, که باعث `Attempt to read after eof` استثنا در مشتری. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) - ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- بهبود فرمت های دیگر. برطرف - [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), - [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), - [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), - [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) - [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) - ([تاولوبیکس](https://github.com/tavplubix)) -- خانه را نادیده می گیرد ارزش در سمت راست در اپراتور که قابل تبدیل به سمت چپ نیست - side type. Make it work properly for compound types – Array and Tuple. - [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([الکساندر - کوزمنکوف](https://github.com/akuzm)) -- پشتیبانی از نابرابری های از دست رفته برای عضویت. این ممکن است برای پیوستن به نوع کمتر یا برابر و سخت - انواع بیشتر و کمتر برای ستون اسوف در نحو. - [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([علم هنر - Zuikov](https://github.com/4ertus2)) -- بهینه سازی بخشی ادغام اضافه کردن. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) - ([زویکوف](https://github.com/4ertus2)) -- آیا استفاده از بیش از 98k حافظه در uniqcombined توابع. - [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), - [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([ازات - خوژین](https://github.com/azat)) -- قطعات خیط و پیت کردن از جدول پیوستن به دست راست بر روی دیسک در پارتیالمگرمین (اگر کافی نیست - حافظه). بارگیری داده ها در صورت نیاز. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) - ([زویکوف](https://github.com/4ertus2)) - -#### بهبود عملکرد {#performance-improvement-1} - -- سرعت جوینت با استدلال توایع با اجتناب از تکرار داده ها. - [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([ایموس - پرنده](https://github.com/amosbird)) -- بازگشت اولیه اگر زیرخاکری خالی است. - [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) -- بهینه سازی تجزیه بیان گذاشتن در مقادیر. - [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) - ([تاولوبیکس](https://github.com/tavplubix)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-1} - -- غیر فعال کردن برخی از موارد برای متقابل تلفیقی به سیستم عامل مک. - [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([ایوان](https://github.com/abyss7)) -- اضافه کردن گم شده ارتباط با pocoxml برای clickhouse\_common\_io. - [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([ازات - خوژین](https://github.com/azat)) -- قبول متعدد تست فیلتر استدلال در clickhouse آزمون. - [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([الکساندر - کوزمنکوف](https://github.com/akuzm)) -- فعال musl و jemalloc برای arm. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) - ([ایموس پرنده](https://github.com/amosbird)) -- اضافه شده `--client-option` پارامتر به `clickhouse-test` به تصویب پارامترهای اضافی به مشتری. - [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([نیکولای - کوچتو](https://github.com/KochetovNicolai)) -- حفظ تنظیمات موجود در دور در دقیقه ارتقا بسته. - [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) - ([فیلیمونف](https://github.com/filimonov)) -- رفع خطاهای شناسایی شده توسط پوس. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([علم هنر - Zuikov](https://github.com/4ertus2)) -- رفع ساخت برای داروین. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) - ([ایوان](https://github.com/abyss7)) -- glibc 2.29 سازگاری. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([ایموس - پرنده](https://github.com/amosbird)) -- اطمینان حاصل کنید که دکلین می کند فایل های منبع بالقوه را لمس نمی. - [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([ایموس - پرنده](https://github.com/amosbird)) -- تلاش برای جلوگیری از درگیری در هنگام به روز رسانی از دور در دقیقه التیت - فایل پیکربندی بسته بندی شده به طور جداگانه - در کلیک-سرور-مشترک. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) - ([فیلیمونف](https://github.com/filimonov)) -- بهینه سازی برخی از فایل های هدر برای بازسازی سریع تر. - [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), - [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([الکساندر - کوزمنکوف](https://github.com/akuzm)) -- اضافه کردن تست عملکرد برای تاریخ و تاریخ ساعت. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([واسیلی - نمکو](https://github.com/Enmk)) -- رفع برخی از تست هایی که حاوی جهش های غیر قطعی هستند. - [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([الکساندر - کازاکوف](https://github.com/Akazz)) -- اضافه کردن ساخت با حفظ به سی. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) - ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- اجتناب از استفاده از آماده سازی نشده ارزش در metricstransmitter. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([ازات - خوژین](https://github.com/azat)) -- رفع برخی از مشکلات در زمینه های پیدا شده توسط حفظ کننده. - [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), - [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([الکساندر - کوزمنکوف](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) - ([ایموس پرنده](https://github.com/amosbird)) -- رفع رفتار تعریف نشده در سوفلش32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([ایموس - پرنده](https://github.com/amosbird)) -- رفع رفتار تعریف نشده در استورگیسنفستولینگ. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) - ([تاولوبیکس](https://github.com/tavplubix)) -- عبارات ثابت ثابت تاشو برای موتورهای پایگاه داده خارجی (خروجی زیر ,او بی سی, ال بی سی). در گذشته - نسخه این بود برای عبارات ثابت متعدد کار نمی کند و در همه برای تاریخ کار نمی کند, - تاریخ ساعت و امید. این رفع [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) - ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع threadsanitizer اطلاعات مسابقه خطا در نمایش زنده در هنگام دسترسی به no\_users\_thread متغیر است. - [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) - ([وزکازنیکوف](https://github.com/vzakaznikov)) -- خلاص شدن از شر نمادها مالوک در لیبکمون - [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), - [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([ایموس - پرنده](https://github.com/amosbird)) -- اضافه کردن توانمندسازهای پرچم جهانی برای غیر فعال کردن تمام کتابخانه ها. - [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) - ([پرولر](https://github.com/proller)) - -#### پاکسازی کد {#code-cleanup} - -- تعمیم مخزن پیکربندی برای تهیه دی ال برای لغت نامه. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) - ([الساپین](https://github.com/alesapin)) -- تجزیه کننده برای لغت نامه دی ال بدون هیچ معنایی. - [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) - ([الساپین](https://github.com/alesapin)) -- تقسیم پارسرکری به تجزیه کننده های مختلف کوچکتر. - [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) - ([الساپین](https://github.com/alesapin)) -- فاکتورگیری مجدد کوچک و تغییر نام در نزدیکی لغت نامه های خارجی. - [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) - ([الساپین](https://github.com/alesapin)) -- گیرنده برخی از کد برای تهیه برای کنترل دسترسی مبتنی بر نقش. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([ویتالی - بارانوف](https://github.com/vitlibar)) -- برخی از پیشرفت های در کد بانک اطلاعاتی. - [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([نیکیتا - واسیلیف](https://github.com/nikvas0)) -- آیا استفاده از iterators در پیدا کردن() و emplace() روش جداول هش. - [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([الکساندر - کوزمنکوف](https://github.com/akuzm)) -- رفع گیرنده در صورتی که ریشه پارامتر خالی نیست. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) - ([میخیل کوروتف](https://github.com/millb)) -- حذف برخی از کپی و چسباندن (temporaryfile و temporaryfilestream) - [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([علم هنر - زویکوف](https://github.com/4ertus2)) -- بهبود خوانایی کد کمی (`MergeTreeData::getActiveContainingPart`). - [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([ولادیمیر - Chebotarev](https://github.com/excitoon)) -- منتظر تمام مشاغل برنامه ریزی شده باشید که از اشیا محلی استفاده می کنند `ThreadPool::schedule(...)` پرت - یک استثنا. تغییر نام `ThreadPool::schedule(...)` به `ThreadPool::scheduleOrThrowOnError(...)` و - رفع نظرات برای ایجاد واضح است که ممکن است پرتاب. - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) - ([تاولوبیکس](https://github.com/tavplubix)) - -## انتشار کلیک 19.15 {#clickhouse-release-19-15} - -### انتشار کلیک خانه 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} - -#### رفع اشکال {#bug-fix-3} - -- اضافه شده دست زدن به sql\_tinyint و sql\_bigint و ثابت دست زدن به sql\_float منبع داده در انواع odbc پل. - [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([دنیس گلازاشف](https://github.com/traceon)) -- مجاز به برخی از قطعات بر روی دیسک مقصد و یا حجم در پارتیشن حرکت. - [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- ثابت null-ارزش در nullable ستون از طریق odbc-پل. - [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([واسیلی نمکو](https://github.com/Enmk)) -- درج ثابت به گره غیر محلی توزیع شده با ستون محقق. - [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([ازات خوژین](https://github.com/azat)) -- تابع ثابت دریافت می کند. - [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([میخیل کوروتف](https://github.com/millb)) -- شماره ثابت با استفاده از اچ.تی. پی را نگه دارید ایست زنده به جای تی. پی نگه داشتن ایست زنده است. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([واسیلی نمکو](https://github.com/Enmk)) -- صبر کنید برای همه مشاغل را به پایان برساند در استثنا (رفع حملات نادر). - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([تاولوبیکس](https://github.com/tavplubix)) -- هنگام وارد کردن به میز کافکا به موفکا فشار ندهید. - [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([ایوان](https://github.com/abyss7)) -- غیر فعال کردن ردیاب حافظه برای استثنا پشته. - [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- کد بد ثابت در تبدیل پرس و جو برای پایگاه داده خارجی. - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از استفاده از ارزش های بی قید و شرط در مترسستر. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([ازات خوژین](https://github.com/azat)) -- اضافه شده به عنوان مثال پیکربندی با ماکروها برای تست ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} - -#### رفع اشکال {#bug-fix-4} - -- بد\_واریانت ثابت در درهم فرهنگ لغت. - ([الساپین](https://github.com/alesapin)) -- ثابت کردن اشکال با گسل تقسیم بندی در ضمیمه پرس و جو بخش. - ([الساپین](https://github.com/alesapin)) -- محاسبه زمان ثابت در `MergeTreeData`. - ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- متعهد به کافکا به صراحت پس از نوشتن نهایی است. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([ایوان](https://github.com/abyss7)) -- مرتب کردن مقادیر صفر به درستی در شاخص دقیقه/حداکثر از قطعات ادغام. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([الکساندر کوزمنکوف](https://github.com/akuzm)) - -### انتشار کلیک خانه 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} - -#### ویژگی جدید {#new-feature-3} - -- ذخیره سازی چند طبقه: پشتیبانی از استفاده از حجم ذخیره سازی های متعدد برای جداول با موتور ادغام. امکان ذخیره داده های تازه بر روی اس اس دی و انتقال خودکار داده های قدیمی به هارد وجود دارد. ([مثال](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([ایگر](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([الساپین](https://github.com/alesapin)) -- اضافه کردن تابع جدول `input` برای خواندن داده های ورودی در `INSERT SELECT` پرس و جو. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([هشدار داده می شود](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([انتون پوپوف](https://github.com/CurtizJ)) -- افزودن یک `sparse_hashed` طرح فرهنگ لغت, که عملکرد به معادل `hashed` طرح, اما حافظه بیشتر موثر است. این در مورد حافظه دو برابر کمتر با هزینه بازیابی ارزش کندتر استفاده می کند. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([ازات خوژین](https://github.com/azat)) -- پیاده سازی توانایی تعریف لیستی از کاربران برای دسترسی به لغت نامه. فقط پایگاه داده متصل فعلی با استفاده از. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- افزودن `LIMIT` گزینه ای برای `SHOW` پرس و جو. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([فیلیپ مالکوفسکی](https://github.com/malkfilipp)) -- افزودن `bitmapSubsetLimit(bitmap, range_start, limit)` تابع, که زیر مجموعه از کوچکترین گرداند `limit` ارزش ها در مجموعه ای است که هیچ کوچکتر از `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([ژیچنگ یو](https://github.com/yuzhichang)) -- افزودن `bitmapMin` و `bitmapMax` توابع. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([ژیچنگ یو](https://github.com/yuzhichang)) -- افزودن تابع `repeat` مربوط به [شماره-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([فلین](https://github.com/ucasFL)) - -#### ویژگی تجربی {#experimental-feature-1} - -- پیاده سازی (در حافظه) ادغام پیوستن به نوع که خط لوله فعلی را تغییر دهید. نتیجه تا حدی توسط کلید ادغام طبقه بندی شده اند. تنظیم `partial_merge_join = 1` برای استفاده از این ویژگی. ادغام پیوستن هنوز در حال توسعه است. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([زویکوف](https://github.com/4ertus2)) -- افزودن `S3` موتور و عملکرد جدول. هنوز در حال توسعه است (هنوز پشتیبانی احراز هویت وجود ندارد). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([ولادیمیر چبوتراف](https://github.com/excitoon)) - -#### بهبود {#improvement-2} - -- هر پیامی که از کافکا خوانده می شود به صورت عام وارد می شود. این حل مشکلات تقریبا همه شناخته شده با موتور کافکا. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([ایوان](https://github.com/abyss7)) -- بهبود برای عدم موفقیت نمایش داده شد توزیع شده است. کوتاه شدن زمان بازیابی, همچنین در حال حاضر قابل تنظیم است و می تواند در دیده `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([واسیلی نمکو](https://github.com/Enmk)) -- پشتیبانی از مقادیر عددی برای شمارشی به طور مستقیم در `IN` بخش. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([دیماروب2000](https://github.com/dimarub2000)) -- پشتیبانی (اختیاری, غیر فعال به طور پیش فرض) تغییرمسیر در ذخیره سازی نشانی وب. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([رول](https://github.com/maqroll)) -- اضافه کردن پیام اطلاعات زمانی که مشتری با نسخه های قدیمی تر متصل به یک سرور. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([فیلیپ مالکوفسکی](https://github.com/malkfilipp)) -- حذف حداکثر محدودیت زمانی خواب برای ارسال داده ها در جداول توزیع شده [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([ازات خوژین](https://github.com/azat)) -- اضافه کردن توانایی ارسال رویدادهای پروفایل (شمارنده) با ارزش تجمعی به گرافیت. این را می توان تحت فعال `` در کارساز `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([ازات خوژین](https://github.com/azat)) -- اضافه کردن نوع بازیگران به طور خودکار `T` به `LowCardinality(T)` در حالی که قرار دادن داده ها در ستون نوع `LowCardinality(T)` در قالب بومی از طریق قام. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اضافه کردن توانایی استفاده از تابع `hex` بدون استفاده از `reinterpretAsString` برای `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([میخیل کوروتف](https://github.com/millb)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-2} - -- اضافه کردن گدی شاخص به کلیک باینری با اطلاعات اشکال زدایی. این سرعت زمان راه اندازی را افزایش می دهد `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([الساپین](https://github.com/alesapin)) -- بسته بندی با سرعت بالا با بسته بندی پچ پچ که با استفاده از `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([الساپین](https://github.com/alesapin)) -- تنظیم `enable_fuzzing = 1` برای فعال کردن ابزار دقیق رایگان از تمام کد پروژه. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([کیپریزل](https://github.com/kyprizel)) -- اضافه کردن تست دود ساخت تقسیم در سی. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([الساپین](https://github.com/alesapin)) -- اضافه کردن ساخت با حفظ به سی. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- جایگزینی `libsparsehash` با `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([ازات خوژین](https://github.com/azat)) - -#### رفع اشکال {#bug-fix-5} - -- تجزیه عملکرد ثابت تجزیه و تحلیل شاخص بر روی کلید های پیچیده در جداول بزرگ. این رفع \# 6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع خطا منطقی باعث حملات در هنگام انتخاب از کافکا موضوع خالی. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([ایوان](https://github.com/abyss7)) -- رفع خیلی زود خروجی زیر اتصال نزدیک در `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- پشتیبانی از دانه های لینوکس بسیار قدیمی (ثابت [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع از دست دادن داده ها ممکن است در `insert select` پرس و جو در صورت بلوک خالی در جریان ورودی. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- ثابت برای عملکرد `АrrayEnumerateUniqRanked` با بند خالی در پارامز [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([پرولر](https://github.com/proller)) -- رفع نمایش داده شد پیچیده با مجموعه ای می پیوندد و فرعی جهانی است. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([ایوان](https://github.com/abyss7)) -- ثابت `Unknown identifier` خطا در ترتیب و گروه با چند می پیوندد [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([زویکوف](https://github.com/4ertus2)) -- ثابت `MSan` هشدار هنگام اجرای تابع با `LowCardinality` استدلال کردن. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-2} - -- تغییر فرمت ترتیب از بیت مپ \* تابع مجموع می گوید برای بهبود عملکرد. ایالات سریال بیت مپ\* از نسخه های قبلی را نمی توان به عنوان خوانده شده. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([ژیچنگ یو](https://github.com/yuzhichang)) - -## انتشار کلیک 19.14 {#clickhouse-release-19-14} - -### انتشار کلیک کنیدهاوس 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} - -#### رفع اشکال {#bug-fix-6} - -- این نسخه همچنین شامل تمام رفع اشکال از 19.11.12.69. -- سازگاری ثابت برای نمایش داده شد توزیع بین 19.14 و نسخه های قبلی. این رفع [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک کنیدهاوس 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} - -#### رفع اشکال {#bug-fix-7} - -- ثابت برای عملکرد `АrrayEnumerateUniqRanked` با بند خالی در پارامز. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([پرولر](https://github.com/proller)) -- نام زیرخاکی ثابت در نمایش داده شد با `ARRAY JOIN` و `GLOBAL IN subquery` با نام مستعار. استفاده از نام مستعار زیرخاکی برای نام جدول خارجی اگر مشخص شده است. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([ایوان](https://github.com/abyss7)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-3} - -- ثابت [زدن](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) تست `00715_fetch_merged_or_mutated_part_zookeeper` با بازنویسی به اسکریپت پوسته چون نیاز به صبر برای جهش به درخواست. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([الکساندر کازاکوف](https://github.com/Akazz)) -- شکست ثابت اوبسان و ممسان در عملکرد `groupUniqArray` با استدلال امتپی ار این با قرار دادن خالی ایجاد شد `PaddedPODArray` به هش جدول صفر سلول به دلیل سازنده برای ارزش سلول صفر نامیده می شد. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([ایموس پرنده](https://github.com/amosbird)) - -### انتشار کلیک خانه 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} - -#### ویژگی جدید {#new-feature-4} - -- `WITH FILL` تغییردهنده برای `ORDER BY`. (ادامه [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([انتون پوپوف](https://github.com/CurtizJ)) -- `WITH TIES` تغییردهنده برای `LIMIT`. (ادامه [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([انتون پوپوف](https://github.com/CurtizJ)) -- تجزیه unquoted `NULL` تحت اللفظی به عنوان پوچ (اگر تنظیم `format_csv_unquoted_null_literal_as_null=1`). مقداردهی اولیه زمینه های تهی با مقادیر پیش فرض اگر نوع داده ها از این زمینه است قابل ابطال نیست (اگر تنظیم `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([تاولوبیکس](https://github.com/tavplubix)) -- پشتیبانی از نویسه عام در مسیرهای توابع جدول `file` و `hdfs`. اگر مسیر شامل نویسه عام, جدول خوانده خواهد شد. مثال استفاده: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` و `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- جدید `system.metric_log` جدول است که فروشگاه ها ارزش `system.events` و `system.metrics` با فاصله زمانی مشخص شده است. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجازه به نوشتن سیاهههای مربوط به متن کلیک به `system.text_log` جدول [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نمایش علامت خصوصی در اثری پشته (این است که از طریق تجزیه جداول نماد فایل های جن انجام). اضافه شدن اطلاعات در مورد فایل و شماره خط در اثری پشته اگر اطلاعات اشکال زدایی وجود دارد. نام نماد افزایش سرعت مراجعه با علامت نمایه سازی در حال حاضر در برنامه. اضافه شده توابع جدید گذاشتن برای درون گرایی: `demangle` و `addressToLine`. تابع تغییر نام داد `symbolizeAddress` به `addressToSymbol` برای ثبات. تابع `addressToSymbol` خواهد نام لت و پار به دلایل عملکرد بازگشت و شما باید به درخواست `demangle`. اضافه شدن تنظیمات `allow_introspection_functions` که به طور پیش فرض خاموش است. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تابع جدول `values` (نام غیر حساس به حروف است). این اجازه می دهد تا از خواندن `VALUES` فهرست پیشنهادی در [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). مثال: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([دیماروب2000](https://github.com/dimarub2000)) -- توانایی تغییر تنظیمات ذخیره سازی اضافه شده است. نحو: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([الساپین](https://github.com/alesapin)) -- پشتیبانی از حذف قطعات جدا شده. نحو: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([تاولوبیکس](https://github.com/tavplubix)) -- محدودیت های جدول. اجازه می دهد تا برای اضافه کردن محدودیت به تعریف جدول خواهد شد که در درج بررسی می شود. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([گلب novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پشتیبانی برای نمایش ساختگی محقق. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([ایموس پرنده](https://github.com/amosbird)) -- روشن کردن پیشفیلتر پرس و جو به طور پیش فرض برای نمونه هر موضوع اعدام پرس و جو یک بار در ثانیه. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- قالب ورودی `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([اکونیک 90](https://github.com/akonyaev90)) -- اضافه شدن دو توابع جدید: `sigmoid` و `tanh` (که برای برنامه های کاربردی یادگیری ماشین مفید هستند). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تابع `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` برای بررسی اگر نشانه داده شده است در انبار کاه. رمز یک زیر رشته طول حداکثر بین دو شخصیت اسکی غیر الفبایی است (یا مرزهای انبار کاه). رمز باید یک رشته ثابت باشد. پشتیبانی شده توسط تخصص شاخص توکنبف1. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([واسیلی نمکو](https://github.com/Enmk)) -- عملکرد جدید `neighbor(value, offset[, default_value])`. اجازه می دهد تا برای رسیدن به مقدار قبلی/بعدی در ستون در یک بلوک از داده ها. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([الکس کرش](https://github.com/alex-krash)) [6685365اب8ک5ب74ف9650492ج88012596ب1ب06](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341الکترونیکی4587وا18065سی2دا1ک888ج73389ف48ک36 درجه سانتیگراد](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [الکسی میلویدو](https://github.com/alexey-milovidov) -- ایجاد یک تابع `currentUser()`, ورود بازگشت از کاربر مجاز. نام مستعار اضافه شده است `user()` برای سازگاری با خروجی زیر. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([الکس کرش](https://github.com/alex-krash)) -- توابع جدید مجموع `quantilesExactInclusive` و `quantilesExactExclusive` که در پیشنهاد شد [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([دیماروب2000](https://github.com/dimarub2000)) -- تابع `bitmapRange(bitmap, range_begin, range_end)` که برمی گرداند مجموعه ای جدید با محدوده مشخص شده (شامل نمی شود `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([ژیچنگ یو](https://github.com/yuzhichang)) -- تابع `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` که مجموعه ای از رشته های دقیق طولانی از جعبه های جغرافیایی را پوشش می دهد. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([واسیلی نمکو](https://github.com/Enmk)) -- پیاده سازی پشتیبانی برای قرار دادن پرس و جو با `Kafka` میز [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([ایوان](https://github.com/abyss7)) -- اضافه شدن پشتیبانی برای `_partition` و `_timestamp` ستون مجازی به موتور کافکا. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([ایوان](https://github.com/abyss7)) -- امکان حذف اطلاعات حساس از `query_log`, سیاهههای مربوط به سرور, لیست فرایند با قوانین مبتنی بر عبارت منظم. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([فیلیمونف](https://github.com/filimonov)) - -#### ویژگی تجربی {#experimental-feature-2} - -- فرمت داده ورودی و خروجی `Template`. این اجازه می دهد برای مشخص رشته فرمت های سفارشی برای ورودی و خروجی. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([تاولوبیکس](https://github.com/tavplubix)) -- اجرای `LIVE VIEW` جداول که در اصل در پیشنهاد شد [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) در حال بارگذاری [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925) و سپس به روز شده در [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). ببینید [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) برای شرح مفصلی. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([وزکازنیکوف](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) توجه داشته باشید که `LIVE VIEW` ویژگی ممکن است در نسخه های بعدی حذف شده است. - -#### رفع اشکال {#bug-fix-8} - -- این نسخه همچنین شامل رفع اشکال از 19.13 و 19.11. -- رفع گسل تقسیم بندی زمانی که جدول شاخص جست و خیز و ادغام عمودی اتفاق می افتد. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([الساپین](https://github.com/alesapin)) -- رفع ستون در هر ستون با پیش فرض ستون غیر بدیهی است. پیش از این در مورد نیروی تی ال ادغام با `OPTIMIZE ... FINAL` پرس و جو, ارزش منقضی شده توسط پیش فرض نوع به جای پیش فرض ستون مشخص شده توسط کاربر جایگزین شد. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع کافکا پیام های تکراری مشکل در سرور معمولی راه اندازی مجدد. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([ایوان](https://github.com/abyss7)) -- حلقه بی نهایت ثابت در هنگام خواندن پیام کافکا. مکث نکنید / مصرف کننده رزومه در اشتراک در همه-در غیر این صورت ممکن است به طور نامحدود در برخی از حالات متوقف. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([ایوان](https://github.com/abyss7)) -- ثابت `Key expression contains comparison between inconvertible types` استثنا در `bitmapContains` تابع. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([دیماروب2000](https://github.com/dimarub2000)) -- اصلاح سگو با فعال `optimize_skip_unused_shards` و از دست رفته کلید شاردینگ. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([انتون پوپوف](https://github.com/CurtizJ)) -- کد اشتباه ثابت در جهش است که ممکن است به فساد حافظه منجر شود. سگو ثابت با خواندن نشانی `0x14c0` که ممکن است به دلیل همزمان اتفاق `DROP TABLE` و `SELECT` از `system.parts` یا `system.parts_columns`. شرایط مسابقه ثابت در تهیه نمایش داده شد جهش. بن بست ثابت ناشی از `OPTIMIZE` از جداول تکرار و عملیات اصلاح همزمان مانند تغییر. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حذف ورود به سیستم طولانی اضافی در رابط خروجی زیر [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بازگشت توانایی به تجزیه تنظیمات بولی از ‘true’ و ‘false’ در فایل پیکربندی. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([الساپین](https://github.com/alesapin)) -- رفع سقوط در `quantile` و `median` عملکرد بیش از `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([زویکوف](https://github.com/4ertus2)) -- ثابت نتیجه ناقص ممکن توسط بازگشت `SELECT` پرسوجو با `WHERE` شرایط در کلید اولیه شامل تبدیل به نوع شناور. این با چک کردن نادرست از یکنواختی در ایجاد شد `toFloat` تابع. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([دیماروب2000](https://github.com/dimarub2000)) -- بررسی `max_expanded_ast_elements` تنظیم برای جهش. پاک کردن جهش پس از `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([زمستان ژانگ](https://github.com/zhang2014)) -- ثابت پیوستن به نتایج برای ستون های کلیدی زمانی که با استفاده `join_use_nulls`. ضمیمه نقاط صفر به جای ستون پیش فرض. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([زویکوف](https://github.com/4ertus2)) -- ثابت برای پرش شاخص با ادغام عمودی و تغییر دهید. ثابت برای `Bad size of marks file` استثنا. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([الساپین](https://github.com/alesapin)) -- رفع سقوط نادر در `ALTER MODIFY COLUMN` و ادغام عمودی زمانی که یکی از قطعات ادغام شده/تغییر داده شده خالی است (0 ردیف) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([الساپین](https://github.com/alesapin)) -- اشکال ثابت در تبدیل `LowCardinality` انواع در `AggregateFunctionFactory`. این رفع [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع رفتار اشتباه و حملات احتمالی در `topK` و `topKWeighted` توابع جمع. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([انتون پوپوف](https://github.com/CurtizJ)) -- کد ناامن ثابت در اطراف `getIdentifier` تابع. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اشکال ثابت در خروجی زیر پروتکل سیم (استفاده می شود در حالی که اتصال به خانه فرم خروجی زیر مشتری). ناشی از سرریز بافر پشته در `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([یوری بارانوف](https://github.com/yurriy)) -- نشت حافظه ثابت در `bitmapSubsetInRange` تابع. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([ژیچنگ یو](https://github.com/yuzhichang)) -- رفع اشکال نادر زمانی که جهش اجرا پس از تغییر دانه بودن. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([الساپین](https://github.com/alesapin)) -- اجازه دادن به پیام پروتوبوف با تمام زمینه ها به طور پیش فرض. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع اشکال با `nullIf` تابع هنگامی که ما ارسال `NULL` استدلال در بحث دوم. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- رفع اشکال نادر با تخصیص حافظه اشتباه / تخصیص در لغت نامه کش کلید پیچیده با رشته های رشته ای که منجر به مصرف حافظه بی نهایت (به نظر می رسد مانند نشت حافظه). اشکال بازتولید زمانی که اندازه رشته قدرت دو شروع از هشت بود (8, 16, 32, و غیره). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([الساپین](https://github.com/alesapin)) -- پشتیبانی می کند گوریل ثابت در توالی های کوچک که باعث استثنا `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([واسیلی نمکو](https://github.com/Enmk)) -- اجازه استفاده از انواع قابل ابطال نیست در می پیوندد با `join_use_nulls` فعال شد [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([زویکوف](https://github.com/4ertus2)) -- غیرفعالسازی `Poco::AbstractConfiguration` جایگزینی پرسوجو در `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از بن بست در `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- با استفاده از `arrayReduce` برای استدلال های ثابت ممکن است به پیش فرض منجر شود. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع قطعات متناقض است که می تواند به نظر می رسد اگر ماکت پس از ترمیم شد `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([تاولوبیکس](https://github.com/tavplubix)) -- ثابت قطع در `JSONExtractRaw` تابع. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال با نادرست جست و خیز شاخص ترتیب و تجمع با دانه دانه تطبیقی. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([الساپین](https://github.com/alesapin)) -- ثابت `WITH ROLLUP` و `WITH CUBE` اصلاح کننده های `GROUP BY` با تجمع دو سطح. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع اشکال با نوشتن شاخص ثانویه نشانه با دانه دانه تطبیقی. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([الساپین](https://github.com/alesapin)) -- رفع مقدار دهی اولیه سفارش در حالی که راه اندازی سرور. از `StorageMergeTree::background_task_handle` مقدار دهی اولیه در `startup()` این `MergeTreeBlockOutputStream::write()` ممکن است سعی کنید قبل از مقدار دهی اولیه استفاده کنید. فقط بررسی کنید اگر مقداردهی اولیه شده است. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([ایوان](https://github.com/abyss7)) -- پاک کردن بافر داده ها از عملیات خواندن قبلی که با یک خطا تکمیل شد. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([نیکولای](https://github.com/bopohaa)) -- رفع اشکال با فعال کردن دانه دانه تطبیقی در هنگام ایجاد یک ماکت جدید برای تکرار\*جدول ادغام. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([الساپین](https://github.com/alesapin)) -- تصادف ممکن است ثابت در هنگام راه اندازی سرور در صورت استثنا در اتفاق افتاد `libunwind` در طول استثنا در دسترسی به بی قید و شرط `ThreadStatus` ساختار. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- رفع سقوط در `yandexConsistentHash` تابع. پیدا شده توسط تست ریش شدن. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت امکان معلق نمایش داده شد زمانی که سرور غیرمنتظره است و استخر موضوع جهانی در نزدیکی کامل می شود. این بالاتر شانس اتفاق می افتد در خوشه با تعداد زیادی از خرده ریز (صدها), به دلیل نمایش داده شد توزیع اختصاص یک موضوع در هر اتصال به هر سفال. مثلا, این موضوع ممکن است تکثیر اگر یک خوشه از 330 خرده ریز در حال پردازش 30 نمایش داده شد توزیع همزمان. این موضوع بر تمام نسخه های با شروع از 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- منطق ثابت `arrayEnumerateUniqRanked` تابع. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت شده است که جدول نماد رمز گشایی. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([ایموس پرنده](https://github.com/amosbird)) -- استثنا بی ربط ثابت در بازیگران `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- حذف نقل قول اضافی از توضیحات در `system.settings` جدول [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از بن بست ممکن است در `TRUNCATE` از جدول تکرار. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع خواندن به منظور مرتب سازی کلید. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([انتون پوپوف](https://github.com/CurtizJ)) -- ثابت `ALTER TABLE ... UPDATE` پرسو جو برای جداول با `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([الساپین](https://github.com/alesapin)) -- رفع اشکال باز شده توسط [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (پیش 19.4.0). بازتولید در نمایش داده شد به جداول توزیع بیش از جداول ادغام هنگامی که ما هیچ ستون پرس و جو نیست (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([الساپین](https://github.com/alesapin)) -- سرریز ثابت در تقسیم عدد صحیح از نوع امضا شده به نوع بدون علامت. رفتار دقیقا همانطور که در ج یا ج++ زبان (قوانین ترویج عدد صحیح) که ممکن است جای تعجب بود. لطفا توجه داشته باشید که سرریز هنوز هم ممکن است در هنگام تقسیم تعداد زیادی امضا به تعداد بزرگ بدون علامت و یا بالعکس (اما این مورد کمتر معمول است). این موضوع در تمام نسخه های سرور وجود داشته است. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- محدود کردن حداکثر زمان خواب برای متوقف کردن زمانی که `max_execution_speed` یا `max_execution_speed_bytes` قرار است. خطاهای غلط ثابت مانند `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- مشکلات ثابت در مورد استفاده از `MATERIALIZED` ستون ها و نام مستعار در `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([ایموس پرنده](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `FormatFactory` رفتار برای جریان ورودی که به عنوان پردازنده اجرا نمی شود. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- خطای تایپی ثابت. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([الکس ریندین](https://github.com/alexryndin)) -- خطای تایپی در پیام خطا (است - \> هستند ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([دنیس ژورولو](https://github.com/den-crane)) -- خطا ثابت در حالی که تجزیه لیست ستون از رشته اگر نوع حاوی کاما (این موضوع مربوط به بود `File`, `URL`, `HDFS` ذخیره سازی) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([دیماروب2000](https://github.com/dimarub2000)) - -#### تعمیر امنیتی {#security-fix} - -- این نسخه همچنین شامل تمام اشکال امنیتی رفع از 19.13 و 19.11. -- ثابت امکان پرس و جو ساخته به علت سقوط سرور به دلیل سرریز پشته در پارسر گذاشتن. ثابت امکان سرریز پشته در ادغام و توزیع جداول محقق انداز و شرایط برای ردیف-سطح امنیتی است که شامل subqueries. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### بهبود {#improvement-3} - -- اجرای صحیح منطق سه تایی برای `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([الکساندر کازاکوف](https://github.com/Akazz)) -- در حال حاضر ارزش ها و ردیف با تت ال منقضی شده خواهد شد پس از حذف `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` پرس و جو. اضافه شده نمایش داده شد `SYSTEM STOP/START TTL MERGES` برای غیرفعال کردن / اجازه می دهد ادغام اختصاص با کنترل از راه دور و فیلتر مقادیر منقضی شده در تمام ادغام. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([انتون پوپوف](https://github.com/CurtizJ)) -- امکان تغییر محل فایل تاریخچه کلیک برای مشتری با استفاده از `CLICKHOUSE_HISTORY_FILE` انوف [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([فیلیمونف](https://github.com/filimonov)) -- حذف `dry_run` پرچم از `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- پشتیبانی `ASOF JOIN` با `ON` بخش. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([زویکوف](https://github.com/4ertus2)) -- پشتیبانی بهتر از شاخص جست و خیز برای جهش و تکرار. پشتیبانی از `MATERIALIZE/CLEAR INDEX ... IN PARTITION` پرس و جو. `UPDATE x = x` محاسبه تمام شاخص هایی که از ستون استفاده می کنند `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- اجازه دادن به `ATTACH` نمایش زنده (مثلا, در هنگام راه اندازی سرور) بدون در نظر گرفتن به `allow_experimental_live_view` تنظیمات. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- برای ردیابی پشته جمع شده توسط پیشفیلتر پرس و جو, انجام فریم پشته تولید شده توسط پیشفیلتر پرس و جو خود را شامل نمی شود. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر توابع جدول `values`, `file`, `url`, `hdfs` پشتیبانی از ستون نام مستعار. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پرتاب یک استثنا اگر `config.d` فایل عنصر ریشه مربوطه به عنوان فایل پیکربندی ندارد. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([دیماروب2000](https://github.com/dimarub2000)) -- چاپ اطلاعات اضافی در پیام استثنا برای `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([تاولوبیکس](https://github.com/tavplubix)) -- هنگام تعیین تکه های یک `Distributed` جدول به یک پرس و جو به عنوان خوانده شده تحت پوشش (برای `optimize_skip_unused_shards` = 1) تاتر در حال حاضر چک شرایط از هر دو `prewhere` و `where` بند از بیانیه را انتخاب کنید. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([الکساندر کازاکوف](https://github.com/Akazz)) -- فعال شد `SIMDJSON` برای ماشین های بدون AVX2 اما با SSE 4.2 و PCLMUL مجموعه آموزش. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تاتر می توانید بر روی فایل سیستم بدون کار `O_DIRECT` پردازشگر پشتیبانی شده: [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پشتیبانی از فشار پایین گزاره برای خرده فروشی نهایی. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([تسیسون](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهتر `JOIN ON` استخراج کلید [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([زویکوف](https://github.com/4ertus2)) -- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهینه سازی انتخاب کوچکترین ستون برای `SELECT count()` پرس و جو. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([ایموس پرنده](https://github.com/amosbird)) -- اضافه شده `strict` پارامتر در `windowFunnel()`. هنگامی که `strict` تنظیم شده است `windowFunnel()` اعمال شرایط تنها برای ارزش های منحصر به فرد. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([ایشیمب](https://github.com/achimbab)) -- رابط امن تر از `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([مربی](https://github.com/avasiliev)) -- گزینه های اندازه خط در هنگام اجرای با `--help` گزینه در حال حاضر با اندازه ترمینال مربوط. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([دیماروب2000](https://github.com/dimarub2000)) -- غیرفعالسازی “read in order” بهینه سازی برای تجمع بدون کلید. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([انتون پوپوف](https://github.com/CurtizJ)) -- کد وضعیت قام برای `INCORRECT_DATA` و `TYPE_MISMATCH` کد خطا از پیش فرض تغییر یافت `500 Internal Server Error` به `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([الکساندر رودین](https://github.com/a-rodin)) -- حرکت پیوستن شی از `ExpressionAction` به `AnalyzedJoin`. `ExpressionAnalyzer` و `ExpressionAction` در مورد نمی دانم `Join` کلاس دیگر. منطق خود را با پنهان `AnalyzedJoin` صورت. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([زویکوف](https://github.com/4ertus2)) -- بن بست ممکن ثابت از نمایش داده شد توزیع زمانی که یکی از خرده ریز جایلهاست اما پرس و جو از طریق اتصال به شبکه ارسال می شود. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تغییر معنایی جداول چندگانه `RENAME` برای جلوگیری از بن بست ممکن است. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بازنویسی خروجی زیر سرور سازگاری برای جلوگیری از بارگذاری محموله بسته کامل در حافظه است. کاهش مصرف حافظه برای هر اتصال به حدود `2 * DBMS_DEFAULT_BUFFER_SIZE` (خواندن / نوشتن بافر). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([یوری بارانوف](https://github.com/yurriy)) -- حرکت اس تی نام مستعار تفسیر منطق از تجزیه کننده که لازم نیست به دانستن هر چیزی در مورد معناشناسی پرس و جو. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([زویکوف](https://github.com/4ertus2)) -- تجزیه کمی امن تر از `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `clickhouse-copier`: اجازه استفاده `where_condition` از پیکربندی با `partition_key` نام مستعار در پرس و جو برای چک کردن وجود پارتیشن (قبلا فقط در خواندن نمایش داده شد داده ها مورد استفاده قرار گرفت). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([پرولر](https://github.com/proller)) -- اضافه شده استدلال پیام اختیاری در `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([ولادیمیر](https://github.com/Vdimir)) -- استثنا سرور کردم در حالی که ارسال داده های درج در حال حاضر در حال پردازش در مشتری نیز هست. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([دیماروب2000](https://github.com/dimarub2000)) -- اضافه شده متریک `DistributedFilesToInsert` که نشان می دهد تعداد کل فایل ها در سیستم فایل که انتخاب می شوند برای ارسال به سرور از راه دور توسط جداول توزیع شده است. تعداد در تمام خرده ریز خلاصه. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حرکت بسیاری از می پیوندد تهیه منطق از `ExpressionAction/ExpressionAnalyzer` به `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([زویکوف](https://github.com/4ertus2)) -- رفع تسان [اخطار](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([واسیلی نمکو](https://github.com/Enmk)) -- پیام های اطلاعات بهتر در مورد عدم قابلیت های لینوکس. ورود به سیستم خطاهای کشنده با “fatal” سطح, که ساده تر خواهد شد برای پیدا کردن در `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- هنگام فعال کردن اطلاعات موقت تخلیه به دیسک برای محدود کردن استفاده از حافظه در طول `GROUP BY`, `ORDER BY` فضای دیسک رایگان را بررسی نکرد. ثابت اضافه کردن یک محیط جدید `min_free_disk_space`, هنگامی که فضای دیسک رایگان کوچکتر و سپس حد, پرس و جو را متوقف خواهد کرد و پرتاب `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing زو](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رواندا بازگشتی حذف شده توسط موضوع. این باعث می شود هیچ حس, چرا که موضوعات بین نمایش داده شد مورد استفاده مجدد قرار. `SELECT` پرس و جو ممکن است یک قفل در یک موضوع, یک قفل از موضوع دیگر نگه دارید و خروج از موضوع اول. در همان زمان اولین موضوع را می توان با استفاده مجدد `DROP` پرس و جو. این به نادرست منجر شود “Attempt to acquire exclusive lock recursively” پیام [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شکافتن `ExpressionAnalyzer.appendJoin()`. تهیه یک مکان در `ExpressionAnalyzer` برای `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([زویکوف](https://github.com/4ertus2)) -- اضافه شده `mysql_native_password` پلاگین احراز هویت به خروجی زیر سرور سازگاری. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([یوری بارانوف](https://github.com/yurriy)) -- تعداد کمتر از `clock_gettime` سازگاری ابی ثابت بین اشکال زدایی / انتشار در `Allocator` (موضوع ناچیز). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حرکت کن `collectUsedColumns` از `ExpressionAnalyzer` به `SyntaxAnalyzer`. `SyntaxAnalyzer` می سازد `required_source_columns` خود را در حال حاضر. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([زویکوف](https://github.com/4ertus2)) -- افزودن تنظیمات `joined_subquery_requires_alias` برای نیاز به نام مستعار برای انتخاب و توابع جدول در `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([زویکوف](https://github.com/4ertus2)) -- استخراج `GetAggregatesVisitor` رده از `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([زویکوف](https://github.com/4ertus2)) -- `system.query_log`: تغییر نوع داده `type` ستون به `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- پیوند استاتیک `sha256_password` پلاگین احراز هویت. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([یوری بارانوف](https://github.com/yurriy)) -- اجتناب از وابستگی اضافی برای تنظیم `compile` سر کار. در نسخه های قبلی کاربر ممکن است مانند خطا دریافت کنید `cannot open crti.o`, `unable to find library -lc` و غیره [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اعتبار سنجی بیشتر از ورودی که ممکن است از ماکت های مخرب است. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حالا `clickhouse-obfuscator` پرونده در دسترس است `clickhouse-client` بسته در نسخه های قبلی در دسترس بود `clickhouse obfuscator` (با فضای خالی). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([دیماروب2000](https://github.com/dimarub2000)) -- بن بست ثابت زمانی که ما حداقل دو نمایش داده شد که حداقل دو جدول در جهت های مختلف و پرس و جو دیگری که انجام عملیات دسیدل در یکی از جداول به عنوان خوانده شده. ثابت دیگر بن بست بسیار نادر است. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده `os_thread_ids` ستون به `system.processes` و `system.query_log` برای احتمالات اشکال زدایی بهتر. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- یک راه حل برای اشکالات پسوند پی اچ پی میسورند که زمانی رخ می دهد `sha256_password` به عنوان یک پلاگین احراز هویت پیش فرض (شرح داده شده در [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([یوری baranov](https://github.com/yurriy)) -- حذف محل غیر ضروری با ستون ابطال تغییر. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([زویکوف](https://github.com/4ertus2)) -- تنظیم مقدار پیشفرض `queue_max_wait_ms` به صفر, به دلیل ارزش فعلی (پنج ثانیه) می سازد هیچ حس. شرایط نادر وجود دارد که این تنظیمات هر گونه استفاده. تنظیمات اضافه شده `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` و `connection_pool_max_wait_ms` برای ابهامزدایی. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- استخراج `SelectQueryExpressionAnalyzer` از `ExpressionAnalyzer`. نگه داشتن یکی از گذشته برای نمایش داده شد غیر را انتخاب کنید. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([زویکوف](https://github.com/4ertus2)) -- حذف تکثیر فرمت های ورودی و خروجی. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اجازه دادن به کاربر برای لغو `poll_interval` و `idle_connection_timeout` تنظیمات در اتصال. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `MergeTree` در حال حاضر دارای یک گزینه اضافی `ttl_only_drop_parts` (غیر فعال به طور پیش فرض) برای جلوگیری از هرس بخشی از قطعات, به طوری که به طور کامل کاهش یافته است که تمام ردیف در یک بخش منقضی شده است. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([سرگی ولدیکین](https://github.com/svladykin)) -- نوع چک برای توابع شاخص مجموعه. پرتاب استثنا اگر تابع یک نوع اشتباه. این رفع تست ریش شدن با اوبسان. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([نیکیتا واسیلیف](https://github.com/nikvas0)) - -#### بهبود عملکرد {#performance-improvement-2} - -- بهینه سازی نمایش داده شد با `ORDER BY expressions` بند, جایی که `expressions` پیشوند همزمان با مرتب سازی کلید در `MergeTree` میز این بهینه سازی توسط کنترل `optimize_read_in_order` تنظیمات. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([انتون پوپوف](https://github.com/CurtizJ)) -- اجازه می دهد به استفاده از موضوعات مختلف در بخش بارگذاری و حذف. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نوع دسته ای اجرا از به روز رسانی کشورهای تابع جمع. ممکن است به مزایای عملکرد منجر شود. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- با استفاده از `FastOps` کتابخانه برای توابع `exp`, `log`, `sigmoid`, `tanh`. FastOps سریع بردار ریاضی کتابخانه از مایکل Parakhin (Yandex CTO). بهبود عملکرد `exp` و `log` توابع بیش از 6 بار. توابع `exp` و `log` از `Float32` استدلال باز خواهد گشت `Float32` (در نسخه های قبلی همیشه باز می گردند `Float64`). حالا `exp(nan)` ممکن است بازگشت `inf`. نتیجه `exp` و `log` توابع ممکن است نزدیکترین ماشین تعداد نمایندگی به پاسخ واقعی نیست. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) با استفاده از Danila Kutenin نوع را fastops کار [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- غیر فعال کردن بهینه سازی کلید متوالی برای `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([اکوزم](https://github.com/akuzm)) -- بهبود عملکرد `simdjson` کتابخانه با خلاص شدن از تخصیص پویا در `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([ویتالی بارانو](https://github.com/vitlibar)) -- صفحات پیش گسل هنگام تخصیص حافظه با `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([اکوزم](https://github.com/akuzm)) -- رفع اشکال عملکرد در `Decimal` مقایسه. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([زویکوف](https://github.com/4ertus2)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-4} - -- حذف کامپایلر (نمونه زمان اجرا الگو) چرا که ما بیش از عملکرد این برنده ام. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تست عملکرد اضافه شده برای نشان دادن تخریب عملکرد در شورای همکاری خلیج فارس-9 در راه بیشتر جدا شده است. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تابع جدول اضافه شده است `numbers_mt`, که است که نسخه چند رشته ای از `numbers`. تست های عملکرد به روز شده با توابع هش. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- حالت مقایسه در `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([دیماروب2000](https://github.com/dimarub2000)) -- بهترین تلاش برای چاپ اثری پشته. همچنین اضافه شده است `SIGPROF` به عنوان یک سیگنال اشکال زدایی برای چاپ ردیابی پشته از یک موضوع در حال اجرا. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- هر تابع در فایل خود را, بخش 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حذف دو برابر const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([فیلیمونف](https://github.com/filimonov)) -- تغییرات قالب بندی برای `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([اکوزم](https://github.com/akuzm)) -- خرده فروشی بهتر برای پیوستن به ایجاد در `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([زویکوف](https://github.com/4ertus2)) -- حذف یک وضعیت کار برکنار شده (پیدا شده توسط پوس استودیو). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([اکوزم](https://github.com/akuzm)) -- جدا کردن رابط جدول هش برای `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([اکوزم](https://github.com/akuzm)) -- فاکتورگیری مجدد از تنظیمات. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([الساپین](https://github.com/alesapin)) -- اضافه کردن نظر برای `set` توابع شاخص. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- افزایش نمره اتم در نسخه اشکال زدایی در لینوکس. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([اکوزم](https://github.com/akuzm)) -- در حال حاضر در ساخت اشکال زدایی کار می کنند. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing زو](https://github.com/weiqxu)) -- اضافه شدن یک تست به `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن تست برای نمایش چند مادی برای جدول کافکا. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([ایوان](https://github.com/abyss7)) -- ایجاد یک طرح ساخت بهتر است. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([ایوان](https://github.com/abyss7)) -- ثابت `test_external_dictionaries` ادغام در صورتی که تحت کاربر غیر ریشه اعدام شد. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اشکال بازتولید زمانی که اندازه کل بسته های نوشته شده بیش از `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([یوری بارانوف](https://github.com/yurriy)) -- اضافه شدن یک تست برای `RENAME` شرایط مسابقه جدول [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از مسابقه داده ها در تنظیمات در `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن تست ادغام برای دست زدن به اشتباهات توسط یک فرهنگ لغت کش. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([ویتالی بارانو](https://github.com/vitlibar)) -- غیر فعال کردن تجزیه فایل های شی جن در سیستم عامل مک, زیرا باعث می شود هیچ حس. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تلاش برای ایجاد ژنراتور تغییرات بهتر است. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن `-Wshadow` تغییر به شورای همکاری خلیج فارس. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([کروزرکریگ](https://github.com/kreuzerkrieg)) -- حذف کد منسوخ برای `mimalloc` پشتیبانی [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `zlib-ng` قابلیت های ایکس86 را تعیین می کند و این اطلاعات را به متغیرهای جهانی ذخیره می کند. این است که در تماس دفالتینیت انجام, که ممکن است توسط موضوعات مختلف به طور همزمان ساخته شده. برای جلوگیری از چند رشته ای می نویسد, این کار را در هنگام راه اندازی کتابخانه. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([اکوزم](https://github.com/akuzm)) -- تست رگرسیون برای یک اشکال که در پیوستن که در ثابت شد [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([بختیاری روازیف](https://github.com/theruziev)) -- ثابت msan گزارش. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع زدن تست فلش. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([انتون پوپوف](https://github.com/CurtizJ)) -- مسابقه داده های نادرست ثابت در `MergeTreeDataPart::is_frozen` رشته. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- وقفه ثابت در تست ریش شدن. در نسخه های قبلی این موفق به پیدا کردن غلط معوق در پرس و جو `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن چک اشکال زدایی به `static_cast` از ستون. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پشتیبانی از اوراکل لینوکس در بسته های رسمی دور در دقیقه. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تغییر کامل جانسون از `once` به `loop` نوع. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- `odbc-bridge.cpp` تعریف `main()` بنابراین نباید در `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([اوروج دش](https://github.com/orivej)) -- تست تصادف در `FULL|RIGHT JOIN` با نقاط صفر در کلید جدول سمت راست. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([زویکوف](https://github.com/4ertus2)) -- اضافه شده یک تست برای حد در گسترش نام مستعار فقط در مورد. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تغییر از `boost::filesystem` به `std::filesystem` از کجا مناسب. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده بسته دور در دقیقه به وب سایت. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن یک تست برای ثابت `Unknown identifier` استثنا در `IN` بخش. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([زویکوف](https://github.com/4ertus2)) -- ساده کردن `shared_ptr_helper` چون مردم با مشکلاتی روبرو هستند که این را درک می کنند. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تست عملکرد اضافه شده برای گوریل ثابت و کدک مضاعف. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([واسیلی نمکو](https://github.com/Enmk)) -- تقسیم تست ادغام `test_dictionaries` به 4 تست جداگانه. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([ویتالی بارانو](https://github.com/vitlibar)) -- پردازشگر پشتیبانی شده: `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اجازه می دهد به استفاده از `library` منبع فرهنگ لغت با اسان. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن گزینه برای تولید تغییرات از یک لیست از روابط عمومی. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- قفل `TinyLog` ذخیره سازی در هنگام خواندن. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([اکوزم](https://github.com/akuzm)) -- بررسی برای پیوندهای نمادی شکسته در سی. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- افزایش اتمام وقت برای “stack overflow” تست کنید زیرا ممکن است مدت زمان طولانی در ساخت اشکال زدایی طول بکشد. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن یک چک برای فضاهای خالی دو برابر شود. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `new/delete` ردیابی حافظه در هنگام ساخت با ضد عفونی کننده. ردیابی مشخص نیست. این تنها مانع از استثنا حد حافظه در تست. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([زویکوف](https://github.com/4ertus2)) -- فعال کردن چک از علامت تعریف نشده در حالی که ارتباط. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([ایوان](https://github.com/abyss7)) -- اجتناب از بازسازی `hyperscan` هر روز [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- گزارش ثابت اوبسان در `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجازه ندهید که از پیشفیلتر پرس و جو با ضدعفونی کننده استفاده کنید زیرا سازگار نیست. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن تست برای بارگذاری یک فرهنگ لغت پس از شکست تایمر. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع تناقض در `PipelineExecutor::prepareProcessor` استدلال نوع. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اضافه شده یک تست برای ادرار بد. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن چک بیشتر به `CAST` تابع. این باید دریافت اطلاعات بیشتر در مورد گسل تقسیم بندی فازی در تست. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اضافه شده `gcc-9` پشتیبانی به `docker/builder` کانتینر که ایجاد تصویر به صورت محلی. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([گلب novikov](https://github.com/NanoBjorn)) -- تست برای کلید اولیه با `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([دیماروب2000](https://github.com/dimarub2000)) -- تست های ثابت تحت تاثیر اثر کند پشته اثری چاپ. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن یک مورد تست برای سقوط در `groupUniqArray` ثابت در [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([اکوزم](https://github.com/akuzm)) -- شاخص های ثابت تست جهش. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- در تست عملکرد, انجام ورود پرس و جو برای نمایش داده شد ما را اجرا کنید به عنوان خوانده شده. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([اکوزم](https://github.com/akuzm)) -- محقق نمایش در حال حاضر می تواند با ایجاد هر گونه کم cardinality انواع بدون توجه به تنظیمات مورد مشکوک کم cardinality انواع. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- تست های به روز شده برای `send_logs_level` تنظیمات. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع ساخت تحت شورای همکاری خلیج فارس-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([مکس اخمدوف](https://github.com/zlobober)) -- ثابت ساخت با لیبک داخلی++. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([ایوان](https://github.com/abyss7)) -- رفع ساخت مشترک با `rdkafka` کتابخانه [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([ایوان](https://github.com/abyss7)) -- رفع برای سیستم عامل مک ساخت (ناقص). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([اطلاعات دقیق](https://github.com/alex-zaitsev)) -- ثابت “splitted” ساختن. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- دیگر رفع ساخت: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([ایموس پرنده](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([وکسیدر](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([ایوان](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([پرولر](https://github.com/proller)) - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-3} - -- حذف تابع جدول به ندرت استفاده می شود `catBoostPool` و ذخیره سازی `CatBoostPool`. اگر شما این تابع جدول استفاده کرده اند, لطفا ارسال ایمیل به `clickhouse-feedback@yandex-team.com`. توجه داشته باشید که ادغام ادم کودن و احمق باقی می ماند و پشتیبانی خواهد شد. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- غیرفعالسازی `ANY RIGHT JOIN` و `ANY FULL JOIN` به طور پیش فرض. تنظیم `any_join_distinct_right_table_keys` تنظیم برای فعال کردن. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([زویکوف](https://github.com/4ertus2)) - -## انتشار کلیک 19.13 {#clickhouse-release-19-13} - -### انتشار کلیک خانه 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} - -#### رفع اشکال {#bug-fix-9} - -- این نسخه همچنین شامل تمام رفع اشکال از 19.11.12.69. - -### انتشار کلیک خانه 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} - -#### رفع اشکال {#bug-fix-10} - -- این نسخه همچنین شامل تمام رفع اشکال از 19.14.6.12. -- ثابت وضعیت متناقض ممکن است از جدول در حالی که اجرای `DROP` پرس و جو برای جدول تکرار در حالی که باغ وحش در دسترس نیست. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- ثابت برای مسابقه داده ها در انبار ذخیره سازی [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال معرفی شده در پیشفیلتر پرس و جو که منجر به ضبط بی پایان از سوکت. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([الساپین](https://github.com/alesapin)) -- رفع استفاده از پردازنده بیش از حد در حالی که اجرای `JSONExtractRaw` عملکرد بیش از یک مقدار بولی. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع رگرسیون در حالی که هل دادن به مشاهده محقق. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([ایوان](https://github.com/abyss7)) -- تابع جدول `url` در صورت امکان پذیری اجازه مهاجم برای تزریق هدر قام دلخواه در درخواست. این موضوع توسط [نیکیتا تیکومیرو](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع بی فایده `AST` بررسی در شاخص مجموعه. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- تجزیه ثابت از `AggregateFunction` ارزش های جاسازی شده در پرس و جو. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([ژیچنگ یو](https://github.com/yuzhichang)) -- رفتار اشتباه ثابت `trim` توابع خانواده. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### ClickHouse انتشار 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} - -#### رفع اشکال {#bug-fix-11} - -- این نسخه همچنین شامل تمام اشکال امنیتی رفع از 19.11.9.52 و 19.11.10.54. -- مسابقه داده ثابت در `system.parts` جدول و `ALTER` پرس و جو. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- هدر عدم تطابق ثابت در جریان در صورت خواندن از جدول توزیع خالی با نمونه و قبل از وقوع اتفاق افتاد. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang کیان](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- تصادف ثابت در هنگام استفاده از `IN` بند با یک زیر کشت با یک تاپل. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([تاولوبیکس](https://github.com/tavplubix)) -- ثابت مورد با نام ستون در `GLOBAL JOIN ON` بخش. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([زویکوف](https://github.com/4ertus2)) -- رفع تصادف در هنگام ریخته گری انواع به `Decimal` که این کار را پشتیبانی نمی کند. پرتاب استثنا به جای. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([زویکوف](https://github.com/4ertus2)) -- تصادف ثابت در `extractAll()` تابع. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([زویکوف](https://github.com/4ertus2)) -- تبدیل پرسوجو برای `MySQL`, `ODBC`, `JDBC` توابع جدول در حال حاضر به درستی کار می کند برای `SELECT WHERE` نمایش داده شد با چند `AND` عبارات. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([دیماروب2000](https://github.com/dimarub2000)) -- اضافه شده چک اعلامیه قبلی برای خروجی زیر 8 ادغام. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([مایکل دیوید تینکو](https://github.com/rafaeldtinoco)) - -#### تعمیر امنیتی {#security-fix-1} - -- رفع دو ناپایداری در کدک در فاز رفع فشار (کاربر مخرب می تواند داده های فشرده که منجر به سرریز بافر در رفع فشار ساخت). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([زویکوف](https://github.com/4ertus2)) - -### انتشار کلیک کنیدهاوس 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} - -#### رفع اشکال {#bug-fix-12} - -- ثابت `ALTER TABLE ... UPDATE` پرسو جو برای جداول با `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([الساپین](https://github.com/alesapin)) -- ثابت نانپ در هنگام استفاده در بند با یک زیرخاکری با یک تاپل. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([تاولوبیکس](https://github.com/tavplubix)) -- ثابت یک موضوع است که اگر یک ماکت کهنه زنده می شود, هنوز هم ممکن است قطعات داده که توسط پارتیشن قطره حذف شد. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([تاولوبیکس](https://github.com/tavplubix)) -- موضوع ثابت با تجزیه سی اس وی [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([تاولوبیکس](https://github.com/tavplubix)) -- مسابقه داده ثابت در سیستم.جدول قطعات و تغییر پرس و جو. این رفع [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- کد اشتباه ثابت در جهش است که ممکن است به فساد حافظه منجر شود. سگو ثابت با خواندن نشانی `0x14c0` که ممکن است به دلیل همزمان اتفاق `DROP TABLE` و `SELECT` از `system.parts` یا `system.parts_columns`. شرایط مسابقه ثابت در تهیه نمایش داده شد جهش. بن بست ثابت ناشی از `OPTIMIZE` از جداول تکرار و عملیات اصلاح همزمان مانند تغییر. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- از دست دادن داده های ممکن ثابت پس از `ALTER DELETE` پرس و جو در جدول با پرش شاخص. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([نیکیتا واسیلیف](https://github.com/nikvas0)) - -#### تعمیر امنیتی {#security-fix-2} - -- اگر مهاجم دارای دسترسی نوشتن به باغ وحش است و قادر به اجرای سفارشی سرور موجود در شبکه که در آن clickhouse اجرای آن می توانید ایجاد و سفارشی-ساخته شده در سرور های مخرب است که به عنوان clickhouse المثنی و ثبت آن در باغ وحش. هنگامی که ماکت دیگر بخش داده ها از ماکت های مخرب واکشی, می تواند فاحشه خانه و سرور را مجبور به ارسال به مسیر دلخواه در فایل سیستم. پیدا شده توسط الدار زیتوف, تیم امنیت اطلاعات در یاندکس. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} - -#### ویژگی جدید {#new-feature-5} - -- نمونه برداری پیشفیلتر در سطح پرس و جو. [مثال](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) -- اجازه برای مشخص کردن یک لیست از ستون با `COLUMNS('regexp')` بیان که مانند یک نوع پیچیده تر از کار می کند `*` ستاره دار. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([مازریدنتال](https://github.com/mfridental)), ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `CREATE TABLE AS table_function()` در حال حاضر امکان [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([دیماروب2000](https://github.com/dimarub2000)) -- بهینه ساز ادام برای نزول گرادیان تصادفی به طور پیش فرض در استفاده `stochasticLinearRegression()` و `stochasticLogisticRegression()` توابع مجموع, چرا که نشان می دهد با کیفیت خوب و بدون تقریبا هر تنظیم. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([کد37](https://github.com/Quid37)) -- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([اندی یانگ](https://github.com/andyyzh)) -- `RENAME` نمایش داده شد در حال حاضر با تمام ذخیره سازی کار می کنند. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([ایوان](https://github.com/abyss7)) -- در حال حاضر مشتری دریافت سیاهههای مربوط از سرور با هر سطح مورد نظر با تنظیم `send_logs_level` بدون در نظر گرفتن سطح ورود به سیستم مشخص شده در تنظیمات سرور. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-4} - -- تنظیمات `input_format_defaults_for_omitted_fields` به طور پیش فرض فعال است. درج در جداول توزیع شده نیاز به این تنظیم به همان در خوشه (شما نیاز به تنظیم قبل از بروز رسانی نورد). این را قادر می سازد محاسبه عبارات پیش فرض پیچیده برای زمینه های حذف شده در `JSONEachRow` و `CSV*` فرمتها. این باید رفتار مورد انتظار باشد اما ممکن است منجر به تفاوت عملکرد ناچیز. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([زویکوف](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([اکوزم](https://github.com/akuzm)) - -#### ویژگی های تجربی {#experimental-features} - -- خط لوله پردازش پرس و جو جدید. استفاده `experimental_use_processors=1` گزینه ای برای فعال کردن. برای مشکل خود استفاده کنید. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -#### رفع اشکال {#bug-fix-13} - -- ادغام کافکا در این نسخه ثابت شده است. -- ثابت `DoubleDelta` کدبندی `Int64` برای بزرگ `DoubleDelta` ارزش, بهبود یافته `DoubleDelta` رمزگذاری برای داده های تصادفی برای `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([واسیلی نمکو](https://github.com/Enmk)) -- بیش از حد ثابت از `max_rows_to_read` اگر تنظیمات `merge_tree_uniform_read_distribution` تنظیم 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### بهبود {#improvement-4} - -- می اندازد یک استثنا اگر `config.d` فایل عنصر ریشه مربوطه به عنوان فایل پیکربندی ندارد [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([دیماروب2000](https://github.com/dimarub2000)) - -#### بهبود عملکرد {#performance-improvement-3} - -- بهینهسازی `count()`. در حال حاضر با استفاده از کوچکترین ستون (در صورت امکان). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([ایموس پرنده](https://github.com/amosbird)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-5} - -- گزارش استفاده از حافظه در تست عملکرد. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([اکوزم](https://github.com/akuzm)) -- رفع ساخت با خارجی `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([ایوان](https://github.com/abyss7)) -- رفع ساخت مشترک با `rdkafka` کتابخانه [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([ایوان](https://github.com/abyss7)) - -## انتشار کلیک 19.11 {#clickhouse-release-19-11} - -### انتشار کلیک 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} - -#### رفع اشکال {#bug-fix-14} - -- تصادف نادر ثابت در `ALTER MODIFY COLUMN` و ادغام عمودی زمانی که یکی از قطعات با هم ادغام شدند/تغییر خالی است (0 ردیف). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([الساپین](https://github.com/alesapin)) -- به روز رسانی دستی `SIMDJSON`. این رفع جاری شدن سیل ممکن است از فایل های استدر با جعلی جانسون پیام های تشخیصی. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([الکساندر کازاکوف](https://github.com/Akazz)) -- اشکال ثابت با `mrk` پسوند پرونده برای جهش ([الساپین](https://github.com/alesapin)) - -### انتشار کلیک خانه 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} - -#### رفع اشکال {#bug-fix-15} - -- تجزیه عملکرد ثابت تجزیه و تحلیل شاخص بر روی کلید های پیچیده در جداول بزرگ. این رفع [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از سیگزگف نادر در حالی که ارسال داده ها در جداول با موتور توزیع شده (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([ازات خوژین](https://github.com/azat)) -- ثابت `Unknown identifier` با چند می پیوندد. این رفع [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([زویکوف](https://github.com/4ertus2)) - -### انتشار تاتر 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} - -- رفع خطا منطقی باعث حملات در هنگام انتخاب از کافکا موضوع خالی. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([ایوان](https://github.com/abyss7)) -- ثابت برای عملکرد `АrrayEnumerateUniqRanked` با بند خالی در پارامز. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([پرولر](https://github.com/proller)) - -### انتشار کلیک خانه 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} - -#### رفع اشکال {#bug-fix-16} - -- فراموش فروشگاه شیپور خاموشی برای کافکا پیام های دستی قادر به ارتکاب آنها را همه در یک بار و برای همه پارتیشن. رفع بالقوه تقلید در “one consumer - many partitions” سناریو [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([ایوان](https://github.com/abyss7)) - -### انتشار کلیک کنیدهاوس 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} - -- بهبود دست زدن به خطا در لغت نامه کش. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([ویتالی بارانو](https://github.com/vitlibar)) -- اشکال ثابت در عملکرد `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([پرولر](https://github.com/proller)) -- ثابت `JSONExtract` عملکرد در حالی که استخراج یک `Tuple` از جسون [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([ویتالی بارانو](https://github.com/vitlibar)) -- از دست دادن داده های ممکن ثابت پس از `ALTER DELETE` پرس و جو در جدول با پرش شاخص. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- تست عملکرد ثابت. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پارکت: رفع خواندن ستون بولی. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفتار اشتباه ثابت `nullIf` تابع برای استدلال ثابت. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع مشکل پیام های کافکا تقلید در راه اندازی مجدد سرور طبیعی است. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([ایوان](https://github.com/abyss7)) -- ثابت موضوع زمانی که طولانی است `ALTER UPDATE` یا `ALTER DELETE` ممکن است ادغام به طور منظم به اجرا جلوگیری می کند. جلوگیری از جهش از اجرای اگر هیچ موضوعات رایگان به اندازه کافی در دسترس وجود دارد. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([تاولوبیکس](https://github.com/tavplubix)) -- خطا ثابت با پردازش “timezone” در فایل پیکربندی سرور. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع تست کافکا. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([ایوان](https://github.com/abyss7)) - -#### تعمیر امنیتی {#security-fix-3} - -- اگر مهاجم دارای دسترسی نوشتن به باغ وحش است و قادر به اجرای سفارشی سرور موجود در شبکه که در آن clickhouse اجرا می شود, آن می تواند ایجاد سفارشی-ساخته شده در سرور های مخرب است که به عنوان clickhouse المثنی و ثبت آن در باغ وحش. هنگامی که ماکت دیگر بخش داده ها از ماکت های مخرب واکشی, می تواند فاحشه خانه و سرور را مجبور به ارسال به مسیر دلخواه در فایل سیستم. پیدا شده توسط الدار زیتوف, تیم امنیت اطلاعات در یاندکس. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک کنیدهاوس 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} - -#### رفع اشکال {#bug-fix-17} - -- ثابت `ALTER TABLE ... UPDATE` پرسو جو برای جداول با `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([الساپین](https://github.com/alesapin)) -- ثابت نانپ در هنگام استفاده در بند با یک زیرخاکری با یک تاپل. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([تاولوبیکس](https://github.com/tavplubix)) -- ثابت یک موضوع است که اگر یک ماکت کهنه زنده می شود, هنوز هم ممکن است قطعات داده که توسط پارتیشن قطره حذف شد. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([تاولوبیکس](https://github.com/tavplubix)) -- موضوع ثابت با تجزیه سی اس وی [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([تاولوبیکس](https://github.com/tavplubix)) -- مسابقه داده ثابت در سیستم.جدول قطعات و تغییر پرس و جو. این رفع [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت کد اشتباه در جهش است که ممکن است منجر به حافظه فساد است. ثابت segfault با خواندن آدرس `0x14c0` که ممکن است به دلیل همزمان اتفاق `DROP TABLE` و `SELECT` از `system.parts` یا `system.parts_columns`. شرایط مسابقه ثابت در تهیه نمایش داده شد جهش. بن بست ثابت ناشی از `OPTIMIZE` از جداول تکرار و عملیات اصلاح همزمان مانند تغییر. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک کنیدهاوس 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} - -#### رفع اشکال {#bug-fix-18} - -- ادغام کافکا در این نسخه ثابت شده است. -- در هنگام استفاده از سگو را رفع کنید `arrayReduce` برای استدلال ثابت. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `toFloat()` یکنواختی. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([دیماروب2000](https://github.com/dimarub2000)) -- اصلاح سگو با فعال `optimize_skip_unused_shards` و از دست رفته کلید شاردینگ. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([کورتیزج](https://github.com/CurtizJ)) -- منطق ثابت `arrayEnumerateUniqRanked` تابع. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حذف ورود به سیستم طولانی اضافی از کنترل خروجی زیر. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع رفتار اشتباه و حملات احتمالی در `topK` و `topKWeighted` توابع جمع. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([کورتیزج](https://github.com/CurtizJ)) -- ستون های مجازی را در معرض قرار ندهید `system.columns` جدول این برای سازگاری عقب مورد نیاز است. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال با تخصیص حافظه برای رشته در فرهنگ لغت کش کلید پیچیده است. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([الساپین](https://github.com/alesapin)) -- رفع اشکال با فعال کردن دانه دانه تطبیقی در هنگام ایجاد ماکت جدید برای `Replicated*MergeTree` جدول [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([الساپین](https://github.com/alesapin)) -- رفع حلقه بی نهایت در هنگام خواندن پیام کافکا. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([پایان 7](https://github.com/abyss7)) -- ثابت امکان پرس و جو ساخته به علت سقوط سرور به دلیل سرریز پشته در گذاشتن مربع و امکان سرریز پشته در `Merge` و `Distributed` جداول [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطا را پشتیبانی می کند گوریل ثابت در توالی های کوچک. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([انمک](https://github.com/Enmk)) - -#### بهبود {#improvement-5} - -- اجازه دادن به کاربر برای لغو `poll_interval` و `idle_connection_timeout` تنظیمات در اتصال. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} - -#### رفع اشکال {#bug-fix-19} - -- ثابت امکان معلق نمایش داده شد زمانی که سرور غیرمنتظره است. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در مورد نیاز: این رفع [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اشکال ثابت در تبدیل `LowCardinality` انواع در `AggregateFunctionFactory`. این رفع [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع تجزیه از `bool` تنظیمات از `true` و `false` رشته ها در فایل های پیکربندی. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([الساپین](https://github.com/alesapin)) -- رفع اشکال نادر با هدر جریان ناسازگار در نمایش داده شد به `Distributed` جدول بیش از `MergeTree` جدول زمانی که بخشی از `WHERE` حرکت به `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([الساپین](https://github.com/alesapin)) -- سرریز ثابت در تقسیم عدد صحیح از نوع امضا شده به نوع بدون علامت. این رفع [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-5} - -- `Kafka` هنوز شکسته. - -### انتشار کلیک خانه 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} - -#### رفع اشکال {#bug-fix-20} - -- رفع اشکال با نوشتن شاخص ثانویه نشانه با دانه دانه تطبیقی. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([الساپین](https://github.com/alesapin)) -- ثابت `WITH ROLLUP` و `WITH CUBE` اصلاح کننده های `GROUP BY` با تجمع دو سطح. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([انتون پوپوف](https://github.com/CurtizJ)) -- ثابت قطع در `JSONExtractRaw` تابع. ثابت [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع segfault در externalloader::reloadoutdated(). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([ویتالی بارانو](https://github.com/vitlibar)) -- ثابت مورد زمانی که سرور ممکن است گوش دادن سوکت اما خاموش نمی بستن و ادامه خدمت نمایش داده شد باقی مانده است. شما ممکن است در نهایت با دو در حال اجرا فرایندهای فاحشه خانه و سرور. گاهی, سرور ممکن است یک خطا بازگشت `bad_function_call` برای نمایش داده شد باقی مانده است. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شرایط بی فایده و نادرست ثابت در زمینه به روز رسانی برای بارگذاری اولیه از لغت نامه های خارجی از طریق ال بی سی, خروجی زیر, کلیک و قام. این رفع [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- استثنا بی ربط ثابت در بازیگران `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع نتیجه غیر قطعی از “uniq” تابع مجموع در موارد شدید نادر. اشکال در حال حاضر در تمام نسخه های تاتر بود. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- Segfault هنگامی که ما مجموعه ای کمی بیش از حد بالا CIDR در تابع `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- ثابت نشت حافظه کوچک زمانی که سرور پرتاب استثنا بسیاری از بسیاری از زمینه های مختلف. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع وضعیت زمانی که مصرف کننده قبل از اشتراک متوقف شد و پس از سر گرفت. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([ایوان](https://github.com/abyss7)) توجه داشته باشید که کافکا در این نسخه شکسته. -- پاک کردن بافر داده کافکا از عملیات خواندن قبلی که با یک خطا تکمیل شد [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([نیکولای](https://github.com/bopohaa)) توجه داشته باشید که کافکا در این نسخه شکسته. -- از `StorageMergeTree::background_task_handle` مقدار دهی اولیه در `startup()` این `MergeTreeBlockOutputStream::write()` ممکن است سعی کنید قبل از مقدار دهی اولیه استفاده کنید. فقط بررسی کنید اگر مقداردهی اولیه شده است. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([ایوان](https://github.com/abyss7)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-6} - -- اضافه شده رسمی `rpm` بسته. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([پرولر](https://github.com/proller)) ([الساپین](https://github.com/alesapin)) -- اضافه کردن توانایی ساخت `.rpm` و `.tgz` بسته با `packager` خط نوشتن. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([الساپین](https://github.com/alesapin)) -- رفع برای “Arcadia” ساخت سیستم. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([پرولر](https://github.com/proller)) - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-6} - -- `Kafka` در این نسخه شکسته. - -### انتشار کلیک خانه 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} - -#### ویژگی جدید {#new-feature-6} - -- اضافه شدن پشتیبانی از اظهارات تهیه شده است. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([الکساندر](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `DoubleDelta` و `Gorilla` کدکهای ستون [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([واسیلی نمکو](https://github.com/Enmk)) -- اضافه شده `os_thread_priority` تنظیم که اجازه می دهد تا برای کنترل “nice” ارزش موضوعات پردازش پرس و جو است که توسط سیستم عامل مورد استفاده برای تنظیم اولویت برنامه ریزی پویا. این نیاز دارد `CAP_SYS_NICE` قابلیت به کار. این پیاده سازی [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پیاده سازی `_topic`, `_offset`, `_key` ستون برای موتور کافکا [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([ایوان](https://github.com/abyss7)) توجه داشته باشید که کافکا در این نسخه شکسته. -- اضافه کردن ترکیب تابع جمع `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([هکز](https://github.com/hczhcz)) -- توابع مجموع `groupArrayMovingSum(win_size)(x)` و `groupArrayMovingAvg(win_size)(x)` که محاسبه حرکت مجموع / میانگین با یا بدون محدودیت اندازه پنجره. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([اختراع2004](https://github.com/inv2004)) -- افزودن سینونیم `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([هکز](https://github.com/hczhcz)) -- Intergate H3 تابع `geoToH3` از بارگذاری. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen ایوان](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### رفع اشکال {#bug-fix-21} - -- پیاده سازی کش دی ان اس با به روز رسانی ناهمزمان. موضوع جداگانه برطرف تمام میزبان و به روز رسانی دی ان اس کش با دوره (تنظیم `dns_cache_update_period`). این باید زمانی کمک کند که میزبان اغلب تغییر کند. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع segfault در `Delta` کدک که ستون با مقادیر کمتر از 32 بیت اندازه تاثیر می گذارد. اشکال منجر به فساد حافظه تصادفی. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([الساپین](https://github.com/alesapin)) -- رفع اشکال در ادغام ستون های غیر فیزیکی در بلوک. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع اشکال نادر در چک کردن بخشی با `LowCardinality` ستون. قبلا `checkDataPart` همیشه برای بخشی با شکست مواجه `LowCardinality` ستون. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([الساپین](https://github.com/alesapin)) -- اجتناب از اتصالات معلق زمانی که سرور استخر موضوع کامل است. این برای اتصال از مهم است `remote` تابع جدول و یا اتصال به یک سفال بدون کپی زمانی که فاصله اتصال طولانی وجود دارد. این رفع [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پشتیبانی از استدلال های ثابت به `evalMLModel` تابع. این رفع [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت موضوع زمانی که تاتر تعیین منطقه زمانی به طور پیش فرض به عنوان `UCT` به جای `UTC`. این رفع [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- زیر جریان بافر ثابت در `visitParamExtractRaw`. این رفع [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر توزیع شده است `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` نمایش داده شد خواهد شد به طور مستقیم در ماکت رهبر اجرا شده است. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([الساپین](https://github.com/alesapin)) -- ثابت `coalesce` برای `ColumnConst` با `ColumnNullable` + تغییرات مرتبط . [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([زویکوف](https://github.com/4ertus2)) -- رفع `ReadBufferFromKafkaConsumer` به طوری که آن را نگه می دارد و خواندن پیام های جدید پس از `commit()` حتی اگر قبلا متوقف شده بود [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([ایوان](https://github.com/abyss7)) -- ثابت `FULL` و `RIGHT` پیوستن به نتایج در هنگام پیوستن به `Nullable` کلید در جدول سمت راست. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([زویکوف](https://github.com/4ertus2)) -- رفع احتمالی خواب بی نهایت نمایش داده شد اولویت پایین. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع شرایط مسابقه, که باعث می شود که برخی از نمایش داده شد ممکن است در کواریلاگ پس از به نظر می رسد `SYSTEM FLUSH LOGS` پرس و جو. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([انتون پوپوف](https://github.com/CurtizJ)) -- ثابت `heap-use-after-free` اسان هشدار در خوشه بندی ناشی از سازمان دیده بان که سعی کنید به استفاده از شی کپی در حال حاضر حذف شده است. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اشتباه ثابت `StringRef` گر بازگشت توسط برخی از پیاده سازی `IColumn::deserializeAndInsertFromArena`. این اشکال تحت تاثیر قرار تنها واحد تست. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- جلوگیری از منبع و مجموعه ای متوسط پیوستن به ستون از پوشش ستون همان نام. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([زویکوف](https://github.com/4ertus2)) -- رفع درج و پرس و جو را انتخاب کنید به خروجی زیر موتور با خروجی زیر شناسه سبک به نقل از. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([زمستان ژانگ](https://github.com/zhang2014)) -- حالا `CHECK TABLE` پرس و جو می تواند با خانواده موتور ادغام کار می کنند. این گرداند بررسی وضعیت و پیام اگر هر برای هر بخش (و یا فایل در مورد موتورهای ساده تر). همچنین, رفع اشکال در واکشی از یک بخش شکسته. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([الساپین](https://github.com/alesapin)) -- رفع split\_shared\_libraries در زمان اجرا [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([نام و نام خانوادگی](https://github.com/danlark1)) -- مقدار دهی اولیه منطقه زمانی ثابت زمانی که `/etc/localtime` پیوند نمادی نسبی مانند است `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- clickhouse-کپی: ثابت استفاده رایگان در خاموش کردن [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([پرولر](https://github.com/proller)) -- به روز شده `simdjson`. ثابت موضوع است که برخی از پارسونز نامعتبر با صفر بایت موفقیت تجزیه. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع خاموش کردن systemlogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع زمانی که وضعیت در باطل کردن\_قرقمی بستگی به یک فرهنگ لغت. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([ویتالی بارانو](https://github.com/vitlibar)) - -#### بهبود {#improvement-6} - -- اجازه دادن به نشانیهای غیر قابل حل در پیکربندی خوشه. در دسترس نیستند و سعی می کنند در هر تلاش اتصال حل شوند. این امر به ویژه برای کوبرنتیس مفید. این رفع [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بستن اتصالات تی پی بیکار (با فاصله یک ساعت به طور پیش فرض). این امر به ویژه برای خوشه های بزرگ با جداول توزیع متعدد بر روی هر سرور مهم, چرا که هر سرور احتمالا می تواند نگه داشتن یک استخر اتصال به هر سرور دیگر, و پس از همزمانی پرس و جو اوج, اتصالات متوقف خواهد شد. این رفع [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- کیفیت بهتر `topK` تابع. تغییر رفتار فضا مجموعه به حذف عنصر گذشته اگر عنصر جدید یک وزن بزرگتر. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- توابع نشانی وب برای کار با دامنه هم اکنون می توانید برای نشانیهای اینترنتی ناقص بدون طرح کار می کنند [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([الساپین](https://github.com/alesapin)) -- چک سام به اضافه `system.parts_columns` جدول [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- اضافه شده `Enum` نوع داده به عنوان یک سینونیم برای `Enum8` یا `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([دیماروب2000](https://github.com/dimarub2000)) -- بیت کامل انتقال نوع برای `T64` وابسته به کدک. می تواند منجر به فشرده سازی بهتر با `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([زویکوف](https://github.com/4ertus2)) -- شرط در `startsWith` تابع هم اکنون می توانید کلید اصلی استفاده می کند. این رفع [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) و [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([دیماروب2000](https://github.com/dimarub2000)) -- مجاز به استفاده `clickhouse-copier` با توپولوژی خوشه متقابل تکرار با اجازه نام پایگاه داده خالی. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([نوارتولومی](https://github.com/nvartolomei)) -- استفاده `UTC` به عنوان منطقه زمانی پیش فرض بر روی یک سیستم بدون `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` چاپ شد و سرور و یا مشتری حاضر به شروع. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بازگشت پشتیبانی از استدلال نقطه شناور در تابع `quantileTiming` برای سازگاری به عقب. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نشان می دهد که جدول از دست رفته است ستون در پیام های خطا. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([ایوان](https://github.com/abyss7)) -- حذف پرسوجوی اجرا با همان کویری\_ید توسط کاربران مختلف [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([پرولر](https://github.com/proller)) -- کد قوی تر برای ارسال معیارهای گرافیت. این حتی در طول چند طولانی کار خواهد کرد `RENAME TABLE` عمل [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بیشتر پیام های خطا اطلاع رسانی نمایش داده خواهد شد که سه گانه می توانید یک کار برای اجرای برنامه نیست. این رفع [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- معکوس نگرامش به بصری تر [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([نام و نام خانوادگی](https://github.com/danlark1)) -- در حال بارگذاری [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([اکونیک 90](https://github.com/akonyaev90)) -- به روز رسانی مقدار پیش فرض `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([قاسم کونوالوف](https://github.com/izebit)) -- اضافه شدن یک مفهوم از تنظیمات منسوخ باشد. تنظیم منسوخ `allow_experimental_low_cardinality_type` می توان بدون اثر استفاده کرد. [0ف15ج016802ف7سی141494سی12846ب898944](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [الکسی میلویدو](https://github.com/alexey-milovidov) - -#### بهبود عملکرد {#performance-improvement-4} - -- افزایش تعداد جریان از جدول ادغام برای توزیع یکنواخت تر از موضوعات را انتخاب کنید. اضافه شدن تنظیمات `max_streams_multiplier_for_merge_tables`. این رفع [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-7} - -- اضافه کردن یک تست سازگاری رو به عقب برای تعامل مشتری و سرور با نسخه های مختلف از تاتر. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([الساپین](https://github.com/alesapin)) -- تست اطلاعات پوشش در هر مرتکب و جلو و درخواست. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([الساپین](https://github.com/alesapin)) -- همکاری با نشانی ضد عفونی کننده برای حمایت از تخصیص سفارشی ما (`Arena` و `ArenaWithFreeLists`) برای اشکال زدایی بهتر از “use-after-free” خطاها. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([اکوزم](https://github.com/akuzm)) -- سودهی به [اجرای رایگان](https://github.com/llvm-mirror/libunwind) برای ج++ دست زدن به استثنا و برای ردیابی پشته چاپ [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([نیکیتا لکوف](https://github.com/laplab)) -- اضافه کردن دو هشدار بیشتر از-ابزار [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجازه می دهد برای ساخت تاتر با ضد عفونی کننده حافظه. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت ubsan گزارش مورد `bitTest` تابع در تست ریش شدن. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- کارگر بارانداز: اضافه شدن امکان به داخل یک نمونه کلیک که نیاز به احراز هویت. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([هشدار داده می شود](https://github.com/shurshun)) -- به روز رسانی کتابدار به نسخه 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([ایوان](https://github.com/abyss7)) -- اضافه کردن ایست جهانی برای تست ادغام و غیر فعال کردن برخی از در کد تست. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([الساپین](https://github.com/alesapin)) -- رفع برخی از شکست های سه گانه. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([اکوزم](https://github.com/akuzm)) -- این `--no-undefined` گزینه نیروهای لینکر برای بررسی تمام نام های خارجی برای وجود در حالی که ارتباط. این بسیار مفید برای ردیابی وابستگی واقعی بین کتابخانه ها در حالت ساخت تقسیم شده است. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([ایوان](https://github.com/abyss7)) -- تست عملکرد اضافه شده برای [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- سازگاری ثابت با شورای همکاری خلیج فارس-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن پشتیبانی برای شورای همکاری خلیج فارس-9. این رفع [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطا ثابت زمانی که لیبناد را می توان به اشتباه مرتبط کرد. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت چند هشدار پیدا شده توسط پوس استودیو. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن پشتیبانی اولیه برای `clang-tidy` تجزیه و تحلیل استاتیک. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تبدیل ماکرو اس دی/لینوکس اندی( ‘be64toh’ و ‘htobe64’) به معادل سیستم عامل مک ایکس [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([فو چن](https://github.com/fredchenbj)) -- بهبود ادغام تست راهنمای. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع ساخت در مکینتاش [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([فیلیمونف](https://github.com/filimonov)) -- رفع سخت به نقطه تایپی: سنگدانه -\> مصالح. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([اکوزم](https://github.com/akuzm)) -- رفع ساخت بورس [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([پرولر](https://github.com/proller)) -- اضافه کردن لینک به کانال یوتیوب تجربی به وب سایت [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([ایوان بلینکو](https://github.com/blinkov)) -- چوب کوره: اضافه کردن گزینه برای پرچم پوشش: با برقی [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([پرولر](https://github.com/proller)) -- رفع اندازه اولیه برخی از درون خطی پودرای است. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([اکوزم](https://github.com/akuzm)) -- فاحشه خانه-سرور.پستینست: رفع تشخیص سیستم عامل برای لینوکس 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([پرولر](https://github.com/proller)) -- نسل بسته بندی قوس لینوکس اضافه شده است. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- تقسیم مشترک / پیکربندی.هشدار داده می شود) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([پرولر](https://github.com/proller)) -- رفع برای “Arcadia” ساخت پلت فرم [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([پرولر](https://github.com/proller)) -- رفع برای غیر متعارف ساخت (gcc9 هیچ submodules) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([پرولر](https://github.com/proller)) -- نیاز به نوع صریح و روشن در فروشگاه بدون خط زیرا ثابت شده بود که مستعد ابتلا به اشکال [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([اکوزم](https://github.com/akuzm)) -- رفع مکینتاش ساخت [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([فیلیمونف](https://github.com/filimonov)) -- تست عملکرد مربوط به ویژگی دستگاه گوارش جدید با مجموعه داده های بزرگتر, همانطور که در اینجا درخواست [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- تست های نفرت انگیز را در تست استرس اجرا کنید [12693568722ف11 است19859742ف56428455501فرد2ا](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([الساپین](https://github.com/alesapin)) - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-7} - -- `Kafka` در این نسخه شکسته. -- فعالسازی `adaptive_index_granularity` = 10 مگابایت به طور پیش فرض برای جدید `MergeTree` میز اگر شما ایجاد شده جدید MergeTree جداول در نسخه 19.11+, دانگرید به نسخه های قبل 19.6 غیر ممکن خواهد بود. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([الساپین](https://github.com/alesapin)) -- حذف منسوخ لغت نامه تعبیه شده مستند نشده است که توسط یاندکس مورد استفاده قرار گرفت.متریکا توابع `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` دیگر در دسترس نیست. اگر شما با استفاده از این توابع, ارسال ایمیل به clickhouse-feedback@yandex-team.com. توجه: در حال حاضر ما تصمیم به نگه داشتن این توابع در حالی که برای. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -## انتشار کلیک 19.10 {#clickhouse-release-19-10} - -### انتشار کلیک خانه 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} - -#### ویژگی جدید {#new-feature-7} - -- اضافه کردن کدک ستون جدید: `T64`. ساخته شده به صورت (U)IntX/EnumX/Data(زمان)/DecimalX ستون. این باید برای ستون ها با مقادیر محدوده ثابت یا کوچک مناسب باشد. کدک خود را اجازه می دهد تا بزرگ و یا کوچک نوع داده بدون فشرده سازی مجدد. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([زویکوف](https://github.com/4ertus2)) -- افزودن موتور دادگان `MySQL` که اجازه می دهد برای مشاهده تمام جداول در سرور خروجی از راه دور [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([زمستان ژانگ](https://github.com/zhang2014)) -- `bitmapContains` اجرا کردن. این 2 برابر سریعتر از `bitmapHasAny` اگر بیت مپ دوم شامل یک عنصر. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([ژیچنگ یو](https://github.com/yuzhichang)) -- پشتیبانی از `crc32` تابع (با رفتار دقیقا همانطور که در خروجی زیر و یا پی اچ پی). اگر شما نیاز به یک تابع هش استفاده نکنید. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen ایوان](https://github.com/BHYCHIK)) -- پیادهسازی شده `SYSTEM START/STOP DISTRIBUTED SENDS` نمایش داده شد برای کنترل درج ناهمزمان به `Distributed` میز [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([زمستان ژانگ](https://github.com/zhang2014)) - -#### رفع اشکال {#bug-fix-22} - -- نادیده گرفتن محدودیت اجرای پرس و جو و حداکثر اندازه قطعات برای محدودیت ادغام در حالی که اجرای جهش. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع اشکال که ممکن است به تقسیم بلوک های طبیعی (بسیار نادر) و درج بلوک های تکراری (در اغلب موارد) منجر شود. [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([الساپین](https://github.com/alesapin)) -- رفع عملکرد `arrayEnumerateUniqRanked` برای نشانوندها با عرضهای خالی [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([پرولر](https://github.com/proller)) -- هنوز به موضوعات کافکا بدون قصد نظرسنجی هر پیام مشترک نیست. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([ایوان](https://github.com/abyss7)) -- ایجاد تنظیمات `join_use_nulls` هیچ تاثیری برای انواع است که نمی تواند در داخل قابل ابطال است [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- ثابت `Incorrect size of index granularity` خطاها [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([کوراستر](https://github.com/coraxster)) -- ثابت شناور به دهدهی تبدیل سرریز [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([کوراستر](https://github.com/coraxster)) -- بافر خیط و پیت کردن زمانی که `WriteBufferFromHDFS`مخرب نامیده می شود. این رفع نوشتن به `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong پنگ](https://github.com/eejoin)) - -#### بهبود {#improvement-7} - -- درمان سلول های خالی در `CSV` به عنوان مقادیر پیش فرض هنگام تنظیم `input_format_defaults_for_omitted_fields` فعال است. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([اکوزم](https://github.com/akuzm)) -- عدم مسدود کردن بارگذاری لغت نامه های خارجی. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([ویتالی بارانو](https://github.com/vitlibar)) -- وقفه شبکه را می توان به صورت پویا برای اتصالات در حال حاضر تاسیس با توجه به تنظیمات تغییر کرده است. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([کنستانتین پودشوموک](https://github.com/podshumok)) -- با استفاده از “public\_suffix\_list” برای توابع `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. این با استفاده از یک جدول هش کامل تولید شده توسط `gperf` با یک لیست تولید شده از فایل: https://publicsuffix.org/list/public\_suffix\_list.dat. (مثلا, در حال حاضر ما دامنه را تشخیص `ac.uk` به عنوان غیر قابل توجهی). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- به تصویب رسید `IPv6` نوع داده در جداول سیستم. `system.processes` و `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- با استفاده از جلسات برای ارتباط با پروتکل سازگاری خروجی زیر. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([یوری بارانوف](https://github.com/yurriy)) -- پشتیبانی بیشتر `ALTER` نمایش داده شد `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- پشتیبانی `` بخش در `clickhouse-local` فایل پیکربندی. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([پرولر](https://github.com/proller)) -- اجازه اجرای پرس و جو با `remote` تابع جدول در `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([پرولر](https://github.com/proller)) - -#### بهبود عملکرد {#performance-improvement-5} - -- اضافه کردن امکان ارسال علامت نهایی در پایان ستون ادغام. این اجازه می دهد برای جلوگیری از بی فایده می خواند برای کلید های که خارج از محدوده داده های جدول می باشد. این فعال است تنها اگر دانه دانه دانه تطبیقی در حال استفاده است. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([الساپین](https://github.com/alesapin)) -- بهبود عملکرد جداول ادغام در فایل سیستم بسیار کند با کاهش تعداد `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تخریب عملکرد ثابت در خواندن از جداول ادغام که در نسخه معرفی شد 19.6. رفع \# 5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-8} - -- پیادهسازی شده `TestKeeper` به عنوان یک پیاده سازی از رابط باغ وحش مورد استفاده برای تست [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([الکسی میلویدو](https://github.com/alexey-milovidov)) ([لوشکین الکسیر](https://github.com/alexey-milovidov)) -- از حالا به بعد `.sql` تست ها را می توان به صورت موازی با پایگاه داده تصادفی جدا شده توسط سرور اجرا کرد. این اجازه می دهد تا سریعتر اجرا شود و تست های جدید را با تنظیمات سرور سفارشی اضافه کنید و اطمینان حاصل کنید که تست های مختلف بر یکدیگر تاثیر نمی گذارد. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([ایوان](https://github.com/abyss7)) -- حذف `` و `` از تست های عملکرد [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- ثابت “select\_format” تست عملکرد برای `Pretty` فرشها [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -## انتشار کلیک 19.9 {#clickhouse-release-19-9} - -### انتشار تاتر 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} - -#### رفع اشکال {#bug-fix-23} - -- اصلاح سگو در کدک دلتا که ستون ها را با مقادیر کمتر از اندازه 32 بیت تحت تاثیر قرار می دهد. اشکال منجر به فساد حافظه تصادفی. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([الساپین](https://github.com/alesapin)) -- رفع اشکال نادر در چک کردن بخشی با ستون کم هزینه. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([الساپین](https://github.com/alesapin)) -- رفع اشکال در ادغام ستون های غیر فیزیکی در بلوک. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع خواب بی نهایت بالقوه نمایش داده شد با اولویت پایین. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت کنید که چگونه کلیک هاوس منطقه زمانی پیش فرض را به عنوان کمپانی یوسیت تعیین می کند. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال در مورد اجرای توزیع قطره/تغییر/کوتاه / بهینه سازی در نمایش داده شد خوشه در ماکت پیرو قبل از ماکت رهبر. در حال حاضر به طور مستقیم بر روی ماکت رهبر اجرا خواهد شد. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([الساپین](https://github.com/alesapin)) -- رفع شرایط مسابقه, که باعث می شود که برخی از نمایش داده شد ممکن است در انبار کردن بلافاصله پس از سیستم پرس و جو سیاهههای مربوط خیط و پیت کردن ظاهر نمی شود. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([انتون پوپوف](https://github.com/CurtizJ)) -- اضافه شدن پشتیبانی از دست رفته برای استدلال ثابت به `evalMLModel` تابع. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} - -#### ویژگی جدید {#new-feature-8} - -- اطلاعات چاپ در مورد قطعات یخ زده در `system.parts` جدول [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([پرولر](https://github.com/proller)) -- درخواست رمز عبور مشتری در کلیک-مشتری شروع در تیتی اگر در استدلال تنظیم نشده است [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([پرولر](https://github.com/proller)) -- پیاده سازی `dictGet` و `dictGetOrDefault` توابع برای انواع اعشاری. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([زویکوف](https://github.com/4ertus2)) - -#### بهبود {#improvement-8} - -- دبیان اینیت: اضافه کردن سرویس ایست ایست [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([پرولر](https://github.com/proller)) -- اضافه کردن تنظیم ممنوع به طور پیش فرض برای ایجاد جدول با انواع مشکوک برای کم کاری [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- توابع رگرسیون وزن مدل بازگشت زمانی که به عنوان دولت در تابع استفاده نمی شود `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([کد37](https://github.com/Quid37)) -- تغییر نام و بهبود روش رگرسیون. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([کد37](https://github.com/Quid37)) -- رابط های واضح تر از جستجوگران رشته. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([نام و نام خانوادگی](https://github.com/danlark1)) - -#### رفع اشکال {#bug-fix-24} - -- رفع از دست دادن داده های بالقوه در کافکا [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([ایوان](https://github.com/abyss7)) -- رفع حلقه بی نهایت بالقوه در `PrettySpace` فرمت زمانی که با صفر ستون نامیده می شود [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- اشکال سرریز ثابت در مدل های خطی. اجازه مدل میلی لیتر اومال برای استدلال مدل غیر توایع. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- `ALTER TABLE ... DROP INDEX IF EXISTS ...` اگر شاخص موجود وجود ندارد باید یک استثنا را افزایش نمی دهد [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([گلب novikov](https://github.com/NanoBjorn)) -- رفع segfault با `bitmapHasAny` در زیر مقیاس [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([ژیچنگ یو](https://github.com/yuzhichang)) -- خطا ثابت زمانی که استخر اتصال تکرار کند سعی مجدد نیست برای حل و فصل میزبان, حتی زمانی که کش دی ان اس کاهش یافته بود. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([الساپین](https://github.com/alesapin)) -- ثابت `ALTER ... MODIFY TTL` در تکرار غذای اصلی. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع درج در جدول توزیع شده با ستون محقق شده [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([ازات خوژین](https://github.com/azat)) -- رفع تخصیص بد زمانی که کوتاه پیوستن به ذخیره سازی [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([تسیسون](https://github.com/TCeason)) -- در نسخه های اخیر از بسته tzdata برخی از فایل ها symlinks در حال حاضر. مکانیسم فعلی برای تشخیص منطقه زمانی پیش فرض شکسته می شود و نام اشتباه برای برخی از جغرافیایی می دهد. در حال حاضر حداقل ما نام منطقه زمانی را مجبور به محتویات انجمن تاز در صورت فراهم. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([ایوان](https://github.com/abyss7)) -- رفع برخی از موارد بسیار نادر با جستجوگر چندگانه هنگامی که سوزن ثابت در مجموع حداقل 16 کیلوبایت طولانی است. الگوریتم از دست رفته و یا بیش از حد نتایج قبلی که می تواند به نتیجه نادرست منجر شود `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([نام و نام خانوادگی](https://github.com/danlark1)) -- رفع مشکل زمانی که تنظیمات برای externaldata درخواست نمی تواند با استفاده از clickhouse تنظیمات. همچنین در حال حاضر تنظیمات `date_time_input_format` و `low_cardinality_allow_in_native_format` می تواند به دلیل ابهام از نام استفاده نمی شود (در داده های خارجی را می توان به عنوان فرمت جدول تفسیر و در پرس و جو می تواند یک محیط). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([نام و نام خانوادگی](https://github.com/danlark1)) -- رفع اشکال زمانی که قطعات تنها از فدراسیون فوتبال بدون رها کردن از باغ وحش حذف شد. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([الساپین](https://github.com/alesapin)) -- حذف ورود اشکال زدایی از پروتکل خروجی زیر [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رد کردن زنود در طول پردازش پرس و جو دی ال [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([ازات خوژین](https://github.com/azat)) -- ثابت مخلوط `UNION ALL` نوع ستون نتیجه. موارد با داده های متناقض و انواع ستون ستون نتیجه وجود دارد. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([زویکوف](https://github.com/4ertus2)) -- پرتاب یک استثنا در اعداد صحیح اشتباه در `dictGetT` توابع به جای تصادف. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([زویکوف](https://github.com/4ertus2)) -- رفع اشتباه element\_count و load\_factor برای درهم لغت در `system.dictionaries` جدول [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([ازات خوژین](https://github.com/azat)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-9} - -- ساخت ثابت بدون `Brotli` پردازشگر پشتیبانی شده: (`ENABLE_BROTLI=OFF` هشدار داده می شود [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([انت یوژنینو](https://github.com/citrin)) -- شامل خروش.ساعت به عنوان خروش / خروشان.ه [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([اوروج دش](https://github.com/orivej)) -- رفع gcc9 هشدار در hyperscan (\#خط بخشنامه بد است!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([نام و نام خانوادگی](https://github.com/danlark1)) -- رفع تمام هشدارهای هنگام کامپایل با شورای همکاری خلیج فارس-9. رفع برخی از مشکلات احتمالی. یخ گرم9 رو درست کن و به باگزیلا بفرست [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([نام و نام خانوادگی](https://github.com/danlark1)) -- ثابت ارتباط با [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حذف تخصص های استفاده نشده در لغت نامه [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([زویکوف](https://github.com/4ertus2)) -- تست های عملکرد بهبود برای قالب بندی و تجزیه جداول برای انواع مختلف فایل ها [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- رفع تست موازی اجرا [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([پرولر](https://github.com/proller)) -- کارگر بارانداز: تنظیمات استفاده از کلیک-تست [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([پرولر](https://github.com/proller)) -- رفع کامپایل برای بورس [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([پرولر](https://github.com/proller)) -- ارتقا افزایش به 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([پرولر](https://github.com/proller)) -- رفع ساخت clickhouse به عنوان submodule [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([پرولر](https://github.com/proller)) -- بهبود تست های عملکرد فوق العاده [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([ویتالی بارانو](https://github.com/vitlibar)) - -## انتشار کلیک 19.8 {#clickhouse-release-19-8} - -### انتشار کلیک خانه 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} - -#### ویژگی های جدید {#new-features} - -- اضافه شدن توابع برای کار با جانسون [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([هکز](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([ویتالی بارانو](https://github.com/vitlibar)) -- اضافه کردن یک تابع basename با مشابه رفتار یک تابع basename که وجود دارد در بسیاری از زبان ها (`os.path.basename` در پایتون, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- اضافه شده `LIMIT n, m BY` یا `LIMIT m OFFSET n BY` نحو به مجموعه جبران نفر برای حد بند. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([انتون پوپوف](https://github.com/CurtizJ)) -- نوع داده جدید اضافه شده است `SimpleAggregateFunction` که اجازه می دهد ستون ها را با تجمع نور در یک `AggregatingMergeTree`. این تنها می تواند با توابع ساده مانند استفاده می شود `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([بوریس گرانویو](https://github.com/bgranvea)) -- اضافه شدن پشتیبانی برای استدلال غیر ثابت در تابع `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([نام و نام خانوادگی](https://github.com/danlark1)) -- اضافه شدن توابع `skewPop`, `skewSamp`, `kurtPop` و `kurtSamp` برای محاسبه به صورت دنباله skewness نمونه skewness, kurtosis و نمونه kurtosis بود. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([هکز](https://github.com/hczhcz)) -- پشتیبانی تغییر نام عملیات برای `MaterializeView` انبار. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- اضافه شده سرور که اجازه می دهد تا اتصال به تاتر با استفاده از مشتری خروجی زیر. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([یوری بارانوف](https://github.com/yurriy)) -- افزودن `toDecimal*OrZero` و `toDecimal*OrNull` توابع. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([زویکوف](https://github.com/4ertus2)) -- پشتیبانی از انواع دهدهی در توابع: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([زویکوف](https://github.com/4ertus2)) -- اضافه شده `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([نام و نام خانوادگی](https://github.com/danlark1)) -- اضافه شده `format` تابع. قالب بندی الگوی ثابت (الگوی فرمت پایتون ساده) با رشته های ذکر شده در استدلال. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([نام و نام خانوادگی](https://github.com/danlark1)) -- اضافه شده `system.detached_parts` جدول حاوی اطلاعات در مورد قطعات جدا شده از `MergeTree` میز [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([اکوزم](https://github.com/akuzm)) -- اضافه شده `ngramSearch` تابع برای محاسبه تفاوت غیر متقارن بین سوزن و انبار کاه. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([نام و نام خانوادگی](https://github.com/danlark1)) -- اجرای روشهای یادگیری ماشین پایه (رگرسیون خطی تصادفی و رگرسیون لجستیک) با استفاده از رابط توابع کل. دارای استراتژی های مختلف برای به روز رسانی وزن مدل (نزول گرادیان ساده, روش شتاب, روش نستروف). همچنین پشتیبانی از مینی دسته از اندازه های سفارشی. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([کد37](https://github.com/Quid37)) -- اجرای `geohashEncode` و `geohashDecode` توابع. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([واسیلی نمکو](https://github.com/Enmk)) -- اضافه شدن تابع جمع `timeSeriesGroupSum`, که می تواند سری های زمانی مختلف جمع می شوند که برچسب زمان نمونه هم ترازی نیست. این برون یابی خطی بین دو برچسب زمان نمونه و سپس مجموع زمان سری با هم استفاده کنید. اضافه شدن تابع جمع `timeSeriesGroupRateSum` که محاسبه نرخ زمان سری و سپس مجموع نرخ با هم. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([یانگکوان لیو](https://github.com/LiuYangkuan)) -- اضافه شدن توابع `IPv4CIDRtoIPv4Range` و `IPv6CIDRtoIPv6Range` برای محاسبه محدوده های پایین تر و بالاتر برای یک ای پی در زیر شبکه با استفاده از یک سیدر. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- اضافه کردن یک ایکس کلیک-هدر خلاصه زمانی که ما یک پرس و جو با استفاده از قام با تنظیم را فعال کنید ارسال `send_progress_in_http_headers`. بازگشت اطلاعات معمول از ایکس کلیک-پیشرفت, با اطلاعات اضافی مانند چند سطر و بایت در پرس و جو قرار داده شد. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) - -#### بهبود {#improvements} - -- اضافه شده `max_parts_in_total` تنظیم برای خانواده ادغام جداول (به طور پیش فرض: 100 000) که مانع از مشخصات نا امن از کلید پارتیشن \#5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `clickhouse-obfuscator`: استخراج دانه برای ستون های فردی با ترکیب دانه اولیه با نام ستون, موقعیت ستون نیست. این در نظر گرفته شده برای تبدیل مجموعه داده با جداول مرتبط متعدد, به طوری که جداول پس از تحول قابل اجرا باقی خواهد ماند. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن توابع `JSONExtractRaw`, `JSONExtractKeyAndValues`. توابع تغییر نام داد `jsonExtract` به `JSONExtract`. هنگامی که چیزی را اشتباه می رود این توابع بازگشت ارزش خبرنگار, نه `NULL`. تابع اصلاح شده `JSONExtract` در حال حاضر نوع بازگشتی از پارامتر گذشته خود را دریافت می کند و نابل ها را تزریق نمی کند. اجرا مجدد به RapidJSON در مورد AVX2 دستورالعمل در دسترس نیست. کتابخانه سیمدجسون به روز شده به یک نسخه جدید. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([ویتالی بارانو](https://github.com/vitlibar)) -- حالا `if` و `multiIf` توابع به وضعیت تکیه نمی کنند `Nullable`, اما در شاخه برای سازگاری گذاشتن تکیه. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([جیان وو](https://github.com/janplus)) -- `In` گزاره در حال حاضر تولید می کند `Null` نتیجه از `Null` ورودی مانند `Equal` تابع. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([جیان وو](https://github.com/janplus)) -- بررسی محدودیت زمانی هر (flush\_interval / poll\_timeout) تعداد سطر از کافکا. این اجازه می دهد تا خواندن را از مصرف کننده کافکا بیشتر کند و محدودیت های زمانی جریان های سطح بالا را بررسی کند [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([ایوان](https://github.com/abyss7)) -- لینک rdkafka با همراه sasl. باید اجازه می دهد به استفاده از sasl گریختن احراز هویت [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([ایوان](https://github.com/abyss7)) -- Batched نسخه RowRefList برای همه می پیوندد. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([زویکوف](https://github.com/4ertus2)) -- کلیک سرور: اطلاعات بیشتر گوش پیام های خطا. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([پرولر](https://github.com/proller)) -- واژهنامهها پشتیبانی در تاتر-کپی برای توابع در `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([پرولر](https://github.com/proller)) -- افزودن تنظیمات جدید `kafka_commit_every_batch` برای تنظیم کافکا ارتکاب سیاست. - این اجازه می دهد تا به مجموعه ای متعهد حالت: پس از هر دسته ای از پیام های به کار گرفته شده است, و یا پس از کل بلوک به ذخیره سازی نوشته شده. این یک تجارت بین از دست دادن برخی از پیام ها و یا خواندن دو بار در برخی شرایط شدید است. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([ایوان](https://github.com/abyss7)) -- ساخت `windowFunnel` پشتیبانی از دیگر انواع عدد صحیح بدون علامت. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- اجازه دادن به سایه ستون مجازی `_table` در ادغام موتور. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([ایوان](https://github.com/abyss7)) -- ساخت `sequenceMatch` توابع مجموع پشتیبانی دیگر انواع عدد صحیح بدون علامت [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- پیام های خطا بهتر اگر عدم تطابق کنترلی است به احتمال زیاد توسط شکست سخت افزار ایجاد می شود. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بررسی کنید که جداول پایه نمونه برداری را پشتیبانی می کنند `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([ایوان](https://github.com/abyss7)) -- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- بهبود پروتکل سیم خروجی زیر. تغییر نام قالب به میسورقلوایر. با استفاده از raii برای تماس rsa\_free. غیر فعال کردن اس اس ال اگر زمینه نمی تواند ایجاد شود. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([یوری baranov](https://github.com/yurriy)) -- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([پرولر](https://github.com/proller)) -- تنظیمات پرس و جو احترام در درج ناهمزمان به جداول توزیع. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([تسیسون](https://github.com/TCeason)) -- توابع تغییر نام داد `leastSqr` به `simpleLinearRegression`, `LinearRegression` به `linearRegression`, `LogisticRegression` به `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -#### بهبود عملکرد {#performance-improvements} - -- Parallelize پردازش قطعات غیر تکراری MergeTree جداول در تغییر و اصلاح پرس و جو. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([ایوان کوش](https://github.com/IvanKush)) -- بهینه سازی در استخراج عبارات منظم. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([نام و نام خانوادگی](https://github.com/danlark1)) -- اضافه کردن راست پیوستن به ستون های کلیدی برای پیوستن به نتیجه اگر فقط در عضویت در بخش استفاده می شود. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([زویکوف](https://github.com/4ertus2)) -- یخ بافر کافکا پس از اولین پاسخ خالی. از چندین اختراع اجتناب می کند `ReadBuffer::next()` برای نتیجه خالی در برخی از جریان ردیف تجزیه. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([ایوان](https://github.com/abyss7)) -- `concat` بهینه سازی عملکرد برای استدلال های متعدد. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([نام و نام خانوادگی](https://github.com/danlark1)) -- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([زویکوف](https://github.com/4ertus2)) -- پیاده سازی لنز 4 ما را با یک مرجع ارتقا دهید تا فشرده سازی سریع تر داشته باشید. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([نام و نام خانوادگی](https://github.com/danlark1)) -- پردازشگر پشتیبانی شده: [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([اوگنی پراودا](https://github.com/kvinty)) - -#### رفع اشکال {#bug-fixes} - -- رفع فشار نیاز به ستون با پیوستن [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([زمستان ژانگ](https://github.com/zhang2014)) -- اشکال ثابت, زمانی که تاتر توسط سیستم اجرا, فرمان `sudo service clickhouse-server forcerestart` کار نمی کند به عنوان انتظار می رود. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([پرولر](https://github.com/proller)) -- رفع کدهای خطای اچ. تی. اچ. تی. پی در کد 9009 پورت همیشه کد 200 را حتی در خطاها برگرداند. [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([پرولر](https://github.com/proller)) -- رفع simpleaggregatefunction برای رشته بیش از max\_small\_string\_size [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([ازات خوژین](https://github.com/azat)) -- رفع خطا برای `Decimal` به `Nullable(Decimal)` تبدیل در. پشتیبانی از دیگر دهدهی به دهدهی تبدیل (از جمله مقیاس های مختلف). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([زویکوف](https://github.com/4ertus2)) -- مسدود کردن فلش ثابت در کتابخانه سیمدجسون که منجر به محاسبه اشتباه از `uniqHLL` و `uniqCombined` تابع کلی و توابع ریاضی مانند `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- دست زدن به ثابت موارد مخلوط ثابت/غیرنقدی در توابع جانسون. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([ویتالی بارانو](https://github.com/vitlibar)) -- ثابت `retention` تابع. در حال حاضر تمام شرایطی که در یک ردیف از داده ها راضی به دولت داده ها اضافه شده است. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) -- رفع نوع نتیجه برای `quantileExact` با اعشار. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([زویکوف](https://github.com/4ertus2)) - -#### مستندات {#documentation} - -- ترجمه مستندات برای `CollapsingMergeTree` به سلامتی چینیها [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) -- ترجمه برخی از اسناد و مدارک در مورد موتورهای جدول به چینی. - [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) - [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) - ([هرگز لی](https://github.com/neverlee)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements} - -- رفع برخی از گزارش ضد عفونی که نشان می دهد احتمالی استفاده پس از رایگان.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([ایوان](https://github.com/abyss7)) -- حرکت تست عملکرد از دایرکتوری جداگانه برای راحتی. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع تست عملکرد نادرست. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([الساپین](https://github.com/alesapin)) -- اضافه شدن یک ابزار برای محاسبه چک سام ناشی از کمی پایین بپرد به مشکلات اشکال زدایی سخت افزار. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اسکریپت دونده قابل استفاده تر است. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([فیلیمونف](https://github.com/filimonov)) -- اضافه کردن دستور العمل کوچک چگونه برای نوشتن تست عملکرد. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([الساپین](https://github.com/alesapin)) -- اضافه کردن قابلیت تعویض در ایجاد, پر کردن و رها کردن پرس و جو در تست عملکرد [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([اولگا خوستیکوا](https://github.com/stavrolia)) - -## انتشار کلیک 19.7 {#clickhouse-release-19-7} - -### انتشار کلیک خانه 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} - -#### رفع اشکال {#bug-fix-25} - -- رفع رگرسیون عملکرد در برخی از نمایش داده شد با پیوستن. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([زمستان ژانگ](https://github.com/zhang2014)) - -### انتشار کلیک خانه 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} - -#### ویژگی های جدید {#new-features-1} - -- اضافه شده توابع مربوط بیت مپ `bitmapHasAny` و `bitmapHasAll` مشابه به `hasAny` و `hasAll` توابع برای ارریس. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([سرگی ولدیکین](https://github.com/svladykin)) - -#### رفع اشکال {#bug-fixes-1} - -- رفع segfault در `minmax` شاخص با ارزش صفر. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- علامت گذاری به عنوان تمام ستون های ورودی در حد خروجی به عنوان مورد نیاز است. این رفع ‘Not found column’ خطا در برخی از نمایش داده شد توزیع. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([پان سنتانتین](https://github.com/kvap)) -- ثابت “Column ‘0’ already exists” خطا در `SELECT .. PREWHERE` در ستون با پیش فرض [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([پرولر](https://github.com/proller)) -- ثابت `ALTER MODIFY TTL` پرسوجو در `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([انتون پوپوف](https://github.com/CurtizJ)) -- هنگامی که مصرف کنندگان کافکا برای شروع شکست خورده اند سرور تصادف نیست. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([ایوان](https://github.com/abyss7)) -- توابع بیت مپ ثابت تولید نتیجه اشتباه است. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([اندی یانگ](https://github.com/andyyzh)) -- حذف عناصر برای دیکشنری درهم (شامل موارد تکراری نیست) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([ازات خوژین](https://github.com/azat)) -- استفاده از محتویات محیط زیست تغییر تنظیمات متغیر به عنوان نام برای منطقه زمانی. این کمک می کند تا به درستی شناسایی منطقه زمانی پیش فرض در برخی موارد.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([ایوان](https://github.com/abyss7)) -- سعی نکنید برای تبدیل اعداد صحیح در `dictGetT` توابع, چرا که به درستی کار نمی کند. پرتاب یک استثنا به جای. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([زویکوف](https://github.com/4ertus2)) -- رفع تنظیمات در درخواست خارجی. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([دنیلا - کوتنین](https://github.com/danlark1)) -- رفع اشکال زمانی که قطعات تنها از فدراسیون فوتبال بدون رها کردن از باغ وحش حذف شد. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([الساپین](https://github.com/alesapin)) -- رفع گسل تقسیم بندی در `bitmapHasAny` تابع. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([ژیچنگ یو](https://github.com/yuzhichang)) -- خطا ثابت زمانی که استخر اتصال تکرار کند سعی مجدد نیست برای حل و فصل میزبان, حتی زمانی که کش دی ان اس کاهش یافته بود. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([الساپین](https://github.com/alesapin)) -- ثابت `DROP INDEX IF EXISTS` پرس و جو. حالا `ALTER TABLE ... DROP INDEX IF EXISTS ...` پرس و جو یک استثنا را افزایش نمی دهد اگر شاخص وجود ندارد. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([گلب نویکوف](https://github.com/NanoBjorn)) -- رفع اتحادیه تمام ستون نوع فوق. موارد با داده های متناقض و انواع ستون ستون نتیجه وجود دارد. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([زویکوف](https://github.com/4ertus2)) -- جست و خیز znonode در طول دستورات پرس و جو پردازش. قبل از اگر گره دیگر حذف زنود در صف کار, یکی که - اما در حال حاضر لیستی از کودکان را دریافت نمی کند موضوع کار کرم را خاتمه می دهد. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([ازات خوژین](https://github.com/azat)) -- ثابت قرار دادن به توزیع() جدول با ستون محقق. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([ازات خوژین](https://github.com/azat)) - -### انتشار کلیک خانه 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} - -#### ویژگی های جدید {#new-features-2} - -- اجازه می دهد برای محدود کردن طیف وسیعی از یک محیط است که می تواند توسط کاربر مشخص شده است. - این محدودیت ها را می توان در مشخصات تنظیمات کاربر تنظیم شده است. - [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([ویتالی - بارانوف](https://github.com/vitlibar)) -- اضافه کردن نسخه دوم از تابع `groupUniqArray` با اختیاری - `max_size` پارامتر که اندازه مجموعه نتیجه را محدود می کند. این - رفتار شبیه به `groupArray(max_size)(x)` تابع. - [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([گیمه - کاسری](https://github.com/YiuRULE)) -- برای tsvwithnames/csvwithnames ورودی فرمت های فایل های ستون سفارش در حال حاضر می تواند - تعیین شده از هدر فایل. این است که با کنترل - `input_format_with_names_use_header` پارامتر. - [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) - ([الکساندر](https://github.com/Akazz)) - -#### رفع اشکال {#bug-fixes-2} - -- سقوط با غیر فشرده + عضویت در هنگام ادغام (\#5197) - [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([دنیلا - کوتنین](https://github.com/danlark1)) -- گسل تقسیم بندی در یک پرس و جو کلیک مشتری به جداول سیستم. \#5066 - [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) - ([ایوان](https://github.com/abyss7)) -- از دست دادن داده ها در بار سنگین از طریق کافکاینگین (\#4736) - [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) - ([ایوان](https://github.com/abyss7)) -- ثابت شرایط مسابقه داده بسیار نادر است که می تواند در هنگام اجرای یک پرس و جو با اتحادیه همه شامل حداقل دو انتخاب از سیستم اتفاق می افتد.ستون, سیستم.جداول, سیستم.قطعات, سیستم.\_شبردارها یا جداول ادغام خانواده و انجام تغییر ستون از جداول مرتبط به صورت همزمان. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### بهبود عملکرد {#performance-improvements-1} - -- استفاده از مرتب سازی بر رادیوگرافی برای مرتب سازی بر اساس ستون عددی در `ORDER BY` بدون - `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), - [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) - ([اوگنی پراودا](https://github.com/kvinty), - [الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### مستندات {#documentation-1} - -- ترجمه اسناد و مدارک برای برخی از موتورهای جدول به چینی. - [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), - [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), - [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) - ([张风啸](https://github.com/AlexZFX)), - [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([هرگز - لی](https://github.com/neverlee)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-1} - -- نسخه قابل چاپ سخن گفتن-8 کاراکتر به درستی در `clickhouse-test`. - [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) - ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن پارامتر خط فرمان برای فاحشه خانه-مشتری برای همیشه بار پیشنهاد - داده ها. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) - ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حل و فصل برخی از هشدارهای پوس استودیو. - [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) - ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز رسانی lz4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([دنیلا - کوتنین](https://github.com/danlark1)) -- اضافه کردن پردازنده گرافیکی برای ساخت الزامات مورد نیاز برای درخواست پیش رو کشیدن \# 5030. - [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) - ([پرولر](https://github.com/proller)) - -## انتشار کلیک 19.6 {#clickhouse-release-19-6} - -### انتشار کلیک خانه 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} - -#### رفع اشکال {#bug-fixes-3} - -- ثابت در شرایط فشار برای نمایش داده شد از توابع جدول `mysql` و `odbc` و موتورهای جدول مربوطه. این رفع \# 3540 و \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع بن بست در باغ وحش. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([گیتهاب 1یولک](https://github.com/github1youlc)) -- اجازه اعشار نقل در سی سی. وی. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([زویکوف](https://github.com/4ertus2) -- عدم تبدیل از اینف شناور / نان به اعشار (استثنا پرتاب). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([زویکوف](https://github.com/4ertus2)) -- رفع مسابقه داده ها در تغییر نام پرس و جو. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([زمستان ژانگ](https://github.com/zhang2014)) -- به طور موقت غیر فعال کردن کلیک. استفاده از lfalloc ممکن است منجر به بسیاری از map\_failed در تخصیص uncompressedcache و در نتیجه به سقوط از نمایش داده شد در بالا لود سرور. [لامپ کم مصرف93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([نام و نام خانوادگی](https://github.com/danlark1)) - -### انتشار کلیک خانه 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} - -#### ویژگی های جدید {#new-features-3} - -- عبارات برای ستون ها و جداول. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([انتون پوپوف](https://github.com/CurtizJ)) -- اضافه شدن پشتیبانی برای `brotli` فشردهسازی برای پاسخهای قام (پذیرش کدبندی: برزیلی) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([میخیل](https://github.com/fandyushin)) -- اضافه شدن تابع جدید `isValidUTF8` برای بررسی اینکه مجموعه ای از بایت ها به درستی کد گذاری شده باشد-8. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([نام و نام خانوادگی](https://github.com/danlark1)) -- اضافه کردن سیاست متعادل کننده بار جدید `first_or_random` که نمایش داده شد به اولین میزبان مشخص می فرستد و اگر غیر قابل دسترس ارسال نمایش داده شد به میزبان تصادفی از سفال. مفید برای تنظیم توپولوژی متقابل تکرار. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([نوارتولومی](https://github.com/nvartolomei)) - -#### ویژگی های تجربی {#experimental-features-1} - -- افزودن تنظیمات `index_granularity_bytes` (تطبیقی دانه دانه دانه شاخص) برای ادغام \* خانواده جداول. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([الساپین](https://github.com/alesapin)) - -#### بهبود {#improvements-1} - -- اضافه شدن پشتیبانی برای اندازه و طول استدلال غیر ثابت و منفی برای عملکرد `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- غیر فعال کردن فشار به پایین به جدول سمت راست در سمت چپ عضویت, جدول سمت چپ در راست عضویت, و هر دو جدول به طور کامل ملحق. این رفع اشتباه پیوستن به نتایج در برخی موارد. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([ایوان](https://github.com/abyss7)) -- `clickhouse-copier`: بارگذاری خودکار پیکربندی وظیفه از `--task-file` گزینه [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([پرولر](https://github.com/proller)) -- اضافه شده کنترل غلط املایی برای کارخانه ذخیره سازی و توابع جدول کارخانه. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([نام و نام خانوادگی](https://github.com/danlark1)) -- ستاره پشتیبانی و ستاره واجد شرایط برای چند می پیوندد بدون زیر کشت [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([زویکوف](https://github.com/4ertus2)) -- پیام خطای ستون گم شده را کاربر پسند تر کنید. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([زویکوف](https://github.com/4ertus2)) - -#### بهبود عملکرد {#performance-improvements-2} - -- افزایش سرعت قابل توجهی از عضویت [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([مرتیجن باکر](https://github.com/Gladdy)) - -#### تغییرات ناسازگار به عقب {#backward-incompatible-changes} - -- HTTP header `Query-Id` به تغییر نام داد `X-ClickHouse-Query-Id` برای ثبات. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([میخیل](https://github.com/fandyushin)) - -#### رفع اشکال {#bug-fixes-4} - -- اختلاف اشاره گر صفر پتانسیل ثابت در `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([پرولر](https://github.com/proller)) -- خطای ثابت در پرس و جو با پیوستن + مجموعه پیوستن [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([زویکوف](https://github.com/4ertus2)) -- ثابت معلق در شروع سرور زمانی که یک فرهنگ لغت بستگی به فرهنگ لغت دیگری از طریق یک پایگاه داده با موتور=فرهنگ لغت. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([ویتالی بارانو](https://github.com/vitlibar)) -- Partially fix distributed\_product\_mode = local. It's possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There's not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([زویکوف](https://github.com/4ertus2)) -- رفع نتیجه به طور بالقوه اشتباه برای `SELECT DISTINCT` با `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([زویکوف](https://github.com/4ertus2)) -- ثابت شرایط مسابقه داده بسیار نادر است که می تواند در هنگام اجرای یک پرس و جو با اتحادیه همه شامل حداقل دو انتخاب از سیستم اتفاق می افتد.ستون, سیستم.جداول, سیستم.قطعات, سیستم.\_شبردارها یا جداول ادغام خانواده و انجام تغییر ستون از جداول مرتبط به صورت همزمان. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-2} - -- شکست تست ثابت زمانی که در حال اجرا خانه عروسکی سرور در میزبان های مختلف [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([واسیلی نمکو](https://github.com/Enmk)) -- تاتر-تست: غیر فعال کردن توالی کنترل رنگ در محیط غیر تیتی. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([الساپین](https://github.com/alesapin)) -- کلیک-تست: اجازه استفاده از هر پایگاه داده تست (برداشتن `test.` صلاحیت در صورت امکان) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([پرولر](https://github.com/proller)) -- رفع خطاهای اوبان [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([ویتالی بارانو](https://github.com/vitlibar)) -- Yandex LFAlloc اضافه شد به ClickHouse به تخصیص MarkCache و UncompressedCache داده ها در روش های مختلف برای گرفتن segfaults بیشتر قابل اعتماد [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([نام و نام خانوادگی](https://github.com/danlark1)) -- پایتون ییل برای کمک به با کوله پشتی و تغییرات. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([ایوان](https://github.com/abyss7)) - -## انتشار کلیک 19.5 {#clickhouse-release-19-5} - -### انتشار کلیک خانه 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} - -#### رفع اشکال {#bug-fixes-5} - -- تصادف ممکن است ثابت در بیت مپ [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([اندی یانگ](https://github.com/andyyzh)) -- ثابت شرایط مسابقه داده بسیار نادر است که می تواند در هنگام اجرای یک پرس و جو با اتحادیه همه شامل حداقل دو انتخاب از سیستم اتفاق می افتد.ستون, سیستم.جداول, سیستم.قطعات, سیستم.\_شبردارها یا جداول ادغام خانواده و انجام تغییر ستون از جداول مرتبط به صورت همزمان. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطای ثابت `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. این خطا اتفاق افتاد اگر ستون کمکاری بخشی از کلید اصلی بود. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اصلاح تابع حفظ و نگهداری: اگر یک ردیف ارضا هر دو شرط اول و بعد از ظهر, تنها اولین شرط راضی به دولت داده اضافه. در حال حاضر تمام شرایطی که در یک ردیف از داده ها راضی به دولت داده ها اضافه شده است. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) - -### انتشار کلیک خانه 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} - -#### رفع اشکال {#bug-fixes-6} - -- نوع ثابت تنظیم `max_partitions_per_insert_block` از بولی به UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([محمد حسین sekhavat](https://github.com/mhsekhavat)) - -### انتشار کلیک خانه 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} - -#### ویژگی های جدید {#new-features-4} - -- [Hyperscan](https://github.com/intel/hyperscan) تطبیق عبارت منظم چندگانه اضافه شد (توابع `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([نام و نام خانوادگی](https://github.com/danlark1)) -- `multiSearchFirstPosition` تابع اضافه شد. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([نام و نام خانوادگی](https://github.com/danlark1)) -- فیلتر بیان از پیش تعریف شده را در هر ردیف برای جداول اجرا کنید. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([ایوان](https://github.com/abyss7)) -- نوع جدیدی از شاخص های داده پرش بر اساس فیلتر بلوم (می تواند برای استفاده `equal`, `in` و `like` توابع). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- اضافه شده `ASOF JOIN` که اجازه می دهد برای اجرای نمایش داده شد که پیوستن به ارزش های اخیر شناخته شده است. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([مرتیجن باکر](https://github.com/Gladdy), [زویکوف](https://github.com/4ertus2)) -- بازنویسی چندگانه `COMMA JOIN` به `CROSS JOIN`. سپس دوباره نوشتن به `INNER JOIN` در صورت امکان. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([زویکوف](https://github.com/4ertus2)) - -#### بهبود {#improvement-9} - -- `topK` و `topKWeighted` در حال حاضر پشتیبانی سفارشی `loadFactor` (رفع مشکل [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) -- مجاز به استفاده `parallel_replicas_count > 1` حتی برای جداول بدون نمونه گیری (تنظیم به سادگی برای نادیده گرفته می شود). در نسخه های قبلی منجر به استثنا شد. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([الکسی الیمانوف](https://github.com/digitalist)) -- پشتیبانی از `CREATE OR REPLACE VIEW`. اجازه می دهد برای ایجاد یک نمایش و یا تنظیم یک تعریف جدید در یک بیانیه واحد. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([بوریس گرانویو](https://github.com/bgranvea)) -- `Buffer` موتور جدول در حال حاضر پشتیبانی می کند `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([یانگکوان لیو](https://github.com/LiuYangkuan)) -- اضافه کردن توانایی برای شروع جدول تکرار بدون ابرداده در باغ وحش در `readonly` حالت. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([الساپین](https://github.com/alesapin)) -- سوسو زدن ثابت از نوار پیشرفت در خانه کلیک مشتری. این موضوع در هنگام استفاده قابل توجه بود `FORMAT Null` با نمایش داده شد جریان. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجازه برای غیر فعال کردن توابع با `hyperscan` کتابخانه بر اساس هر کاربر برای محدود کردن استفاده از منابع بالقوه بیش از حد و کنترل نشده. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن شماره نسخه ورود به سیستم در تمام اشتباهات. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([پرولر](https://github.com/proller)) -- محدودیت اضافه شده به `multiMatch` توابع که نیاز به اندازه رشته به جا به `unsigned int`. همچنین اضافه شده تعداد استدلال محدود به `multiSearch` توابع. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([نام و نام خانوادگی](https://github.com/danlark1)) -- استفاده بهبود یافته از فضای خراش و دست زدن به خطا در هیپرسکان. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([نام و نام خانوادگی](https://github.com/danlark1)) -- پر کردن `system.graphite_detentions` از پیکربندی جدول `*GraphiteMergeTree` جداول موتور. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- تغییر نام `trigramDistance` تابع به `ngramDistance` و اضافه کردن توابع بیشتر با `CaseInsensitive` و `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([نام و نام خانوادگی](https://github.com/danlark1)) -- داده های بهبود پرش محاسبه شاخص. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- عادی نگه دارید, `DEFAULT`, `MATERIALIZED` و `ALIAS` ستون ها در یک لیست واحد (رفع مشکل [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([الکس زتلپین](https://github.com/ztlpn)) - -#### رفع اشکال {#bug-fix-26} - -- اجتناب از `std::terminate` در صورت شکست تخصیص حافظه. حالا `std::bad_alloc` استثنا پرتاب به عنوان انتظار می رود. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع کاپپروتو خواندن از بافر. گاهی اوقات فایل ها با موفقیت توسط اچ تی پی لود نمی شد. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ولادیسلاو](https://github.com/smirnov-vs)) -- رفع خطا `Unknown log entry type: 0` پس از `OPTIMIZE TABLE FINAL` پرس و جو. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([ایموس پرنده](https://github.com/amosbird)) -- نشانوندهای نادرست برای `hasAny` یا `hasAll` توابع ممکن است منجر به تقسیم بندی شوند. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بن بست ممکن است رخ دهد در حالی که اجرای `DROP DATABASE dictionary` پرس و جو. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع رفتار تعریف نشده در `median` و `quantile` توابع. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([هکز](https://github.com/hczhcz)) -- رفع تشخیص سطح فشرده سازی زمانی که `network_compression_method` با حروف کوچک. شکسته در و19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([پرولر](https://github.com/proller)) -- جهل ثابت `UTC` تنظیم (رفع مشکل [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([پرولر](https://github.com/proller)) -- ثابت `histogram` رفتار عملکرد با `Distributed` میز [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([اولگ](https://github.com/olegkv)) -- ثابت گزارش تسان `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- گزارش ساان ثابت در خاموش کردن با توجه به شرایط مسابقه در استفاده از سیستم سیاهههای مربوط. استفاده از پتانسیل ثابت-پس از رایگان در خاموش کردن زمانی که قطعه فعال است. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع قطعات بررسی مجدد در `ReplicatedMergeTreeAlterThread` در صورت خطا. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- عملیات ریاضی در کشورهای تابع جمع متوسط برای استدلال ثابت کار نمی کند (مانند نتایج زیرخاکی). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نام ستون همیشه نقل مکان کردن در ابرداده. در غیر این صورت ایجاد یک جدول با ستون به نام غیرممکن است `index` (سرور به دلیل ناقص راه اندازی مجدد نخواهد شد `ATTACH` پرس و جو در ابرداده). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع سقوط در `ALTER ... MODIFY ORDER BY` روشن `Distributed` جدول [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([تسیسون](https://github.com/TCeason)) -- رفع segfault در `JOIN ON` با فعال `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([زمستان ژانگ](https://github.com/zhang2014)) -- رفع اشکال با اضافه کردن یک ردیف غیر اصلی پس از مصرف یک پیام محافظ از کافکا. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع سقوط از `JOIN` نه-nullable در مقابل nullable ستون. ثابت `NULLs` در کلید سمت راست در `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([زویکوف](https://github.com/4ertus2)) -- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) -- شرایط مسابقه ثابت در `SELECT` از `system.tables` اگر جدول تغییر نام و یا تغییر به صورت همزمان. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- مسابقه داده ثابت زمانی که واکشی بخش داده است که در حال حاضر منسوخ شده است. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- مسابقه داده های نادر ثابت که می تواند در طول اتفاق می افتد `RENAME` جدول خانواده ادغام. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- گسل تقسیم بندی ثابت در عملکرد `arrayIntersect`. گسل تقسیم بندی می تواند رخ دهد اگر تابع با استدلال ثابت و عادی مخلوط نامیده می شد. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang کیان](https://github.com/fancyqlx)) -- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع سقوط در `FULL/RIGHT JOIN` هنگامی که ما در پیوستن به nullable در مقابل نه nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([زویکوف](https://github.com/4ertus2)) -- ثابت `No message received` استثنا در حالی که دلربا قطعات بین کپی. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([الساپین](https://github.com/alesapin)) -- ثابت `arrayIntersect` عملکرد نتیجه اشتباه در مورد چندین مقدار تکرار در مجموعه تک. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع شرایط مسابقه در طول همزمان `ALTER COLUMN` نمایش داده شد که می تواند به یک تصادف سرور منجر شود (رفع مشکل [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([الکس زتلپین](https://github.com/ztlpn)) -- رفع نتیجه نادرست در `FULL/RIGHT JOIN` با ستون توایع. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([زویکوف](https://github.com/4ertus2)) -- رفع موارد تکراری در `GLOBAL JOIN` با ستاره. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([زویکوف](https://github.com/4ertus2)) -- رفع کسر پارامتر در `ALTER MODIFY` از ستون `CODEC` هنگامی که نوع ستون مشخص نشده است. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([الساپین](https://github.com/alesapin)) -- توابع `cutQueryStringAndFragment()` و `queryStringAndFragment()` در حال حاضر به درستی کار می کند زمانی که `URL` شامل یک قطعه و بدون پرس و جو. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع اشکال نادر هنگام تنظیم `min_bytes_to_use_direct_io` بزرگتر از صفر است, که رخ می دهد زمانی که موضوع باید به دنبال عقب در فایل ستون. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([الساپین](https://github.com/alesapin)) -- رفع انواع استدلال اشتباه برای توابع مجموع با `LowCardinality` نشانوندها (رفع مشکل [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع صلاحیت نام اشتباه در `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([زویکوف](https://github.com/4ertus2)) -- تابع ثابت `toISOWeek` نتیجه برای سال 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `DROP`, `TRUNCATE` و `OPTIMIZE` نمایش داده شد تقلید, زمانی که در اجرا `ON CLUSTER` برای `ReplicatedMergeTree*` خانواده جداول. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([الساپین](https://github.com/alesapin)) - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-8} - -- تغییر نام تنظیمات `insert_sample_with_metadata` به تنظیم `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([زویکوف](https://github.com/4ertus2)) -- اضافه شدن تنظیمات `max_partitions_per_insert_block` (با مقدار 100 به طور پیش فرض). اگر بلوک قرار داده شامل تعداد بیشتری از پارتیشن, یک استثنا پرتاب می شود. تنظیم به 0 اگر شما می خواهید به حذف حد (توصیه نمی شود). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- توابع چند جستجو تغییر نام داد (`multiPosition` به `multiSearchAllPositions`, `multiSearch` به `multiSearchAny`, `firstMatch` به `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([نام و نام خانوادگی](https://github.com/danlark1)) - -#### بهبود عملکرد {#performance-improvement-6} - -- بهینه سازی volnitsky جستجوگر توسط inlining دادن حدود 5-10% بهبود جستجو برای نمایش داده شد و با بسیاری از سوزن و یا بسیاری از شبیه bigrams. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([نام و نام خانوادگی](https://github.com/danlark1)) -- رفع مشکل عملکرد در هنگام تنظیم `use_uncompressed_cache` بزرگتر از صفر است, که به نظر می رسد زمانی که همه اطلاعات به عنوان خوانده شده موجود در کش. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([الساپین](https://github.com/alesapin)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-10} - -- سخت شدن اشکال زدایی ساخت: بیشتر نگاشت حافظه دانه و اصل مطلب; اضافه کردن حفاظت از حافظه برای کش علامت و شاخص. این اجازه می دهد تا برای پیدا کردن حافظه بیشتر کوبیدن اشکالات در صورتی که زمانی که اسان و ام اسان نمی تواند این کار را انجام. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن پشتیبانی از متغیرهای کیک `ENABLE_PROTOBUF`, `ENABLE_PARQUET` و `ENABLE_BROTLI` که اجازه می دهد برای فعال/غیر فعال کردن ویژگی های فوق (همان است که ما می توانیم برای کتابدار انجام, خروجی زیر, و غیره). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([سیلو کاراژیا](https://github.com/silviucpp)) -- اضافه کردن توانایی برای چاپ لیست روند و بند از تمام موضوعات اگر برخی از نمایش داده شد پس از اجرای تست را قطع کرد. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([الساپین](https://github.com/alesapin)) -- اضافه کردن مجدد در `Connection loss` خطا در `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([الساپین](https://github.com/alesapin)) -- اضافه کردن ساخت بورس با ولگرد و ساخت با ضد عفونی کننده موضوع به اسکریپت بسته بندی. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([الساپین](https://github.com/alesapin)) -- در حال حاضر کاربر برای رمز عبور برای کاربر خواسته `'default'` در هنگام نصب. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([پرولر](https://github.com/proller)) -- سرکوب هشدار در `rdkafka` کتابخونه. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجازه توانایی ساخت بدون اس اس ال. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([پرولر](https://github.com/proller)) -- اضافه کردن یک راه برای راه اندازی تاتر-تصویر سرور از یک کاربر سفارشی. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- ارتقا تقویت میله به 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([پرولر](https://github.com/proller)) -- غیر فعال کردن استفاده از `mremap` هنگامی که با ضد عفونی کننده موضوع وارد شده است. با کمال تعجب به اندازه کافی, تسان می کند رهگیری نیست `mremap` (هر چند که رهگیری `mmap`, `munmap`) که منجر به مثبت کاذب. گزارش تسان ثابت در تست نفرت انگیز. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن چک کردن تست با استفاده از طرح فرمت از طریق رابط قام. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([ویتالی بارانو](https://github.com/vitlibar)) - -## انتشار کلیک 19.4 {#clickhouse-release-19-4} - -### انتشار کلیک خانه 19.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} - -#### رفع اشکال {#bug-fixes-7} - -- اجتناب از `std::terminate` در صورت شکست تخصیص حافظه. حالا `std::bad_alloc` استثنا پرتاب به عنوان انتظار می رود. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع کاپپروتو خواندن از بافر. گاهی اوقات فایل ها با موفقیت توسط اچ تی پی لود نمی شد. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ولادیسلاو](https://github.com/smirnov-vs)) -- رفع خطا `Unknown log entry type: 0` پس از `OPTIMIZE TABLE FINAL` پرس و جو. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([ایموس پرنده](https://github.com/amosbird)) -- نشانوندهای نادرست برای `hasAny` یا `hasAll` توابع ممکن است منجر به تقسیم بندی شوند. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بن بست ممکن است رخ دهد در حالی که اجرای `DROP DATABASE dictionary` پرس و جو. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع رفتار تعریف نشده در `median` و `quantile` توابع. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([هکز](https://github.com/hczhcz)) -- رفع تشخیص سطح فشرده سازی زمانی که `network_compression_method` با حروف کوچک. شکسته در و19.1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([پرولر](https://github.com/proller)) -- جهل ثابت `UTC` تنظیم (رفع مشکل [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([پرولر](https://github.com/proller)) -- ثابت `histogram` رفتار عملکرد با `Distributed` میز [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([اولگ](https://github.com/olegkv)) -- ثابت گزارش تسان `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- گزارش ساان ثابت در خاموش کردن با توجه به شرایط مسابقه در استفاده از سیستم سیاهههای مربوط. استفاده از پتانسیل ثابت-پس از رایگان در خاموش کردن زمانی که قطعه فعال است. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع قطعات بررسی مجدد در `ReplicatedMergeTreeAlterThread` در صورت خطا. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- عملیات ریاضی در کشورهای تابع جمع متوسط برای استدلال ثابت کار نمی کند (مانند نتایج زیرخاکی). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نام ستون همیشه نقل مکان کردن در ابرداده. در غیر این صورت ایجاد یک جدول با ستون به نام غیرممکن است `index` (سرور به دلیل ناقص راه اندازی مجدد نخواهد شد `ATTACH` پرس و جو در ابرداده). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع سقوط در `ALTER ... MODIFY ORDER BY` روشن `Distributed` جدول [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([تسیسون](https://github.com/TCeason)) -- رفع segfault در `JOIN ON` با فعال `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([زمستان ژانگ](https://github.com/zhang2014)) -- رفع اشکال با اضافه کردن یک ردیف غیر اصلی پس از مصرف یک پیام محافظ از کافکا. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) -- شرایط مسابقه ثابت در `SELECT` از `system.tables` اگر جدول تغییر نام و یا تغییر به صورت همزمان. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- مسابقه داده ثابت زمانی که واکشی بخش داده است که در حال حاضر منسوخ شده است. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- مسابقه داده های نادر ثابت که می تواند در طول اتفاق می افتد `RENAME` جدول خانواده ادغام. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- گسل تقسیم بندی ثابت در عملکرد `arrayIntersect`. گسل تقسیم بندی می تواند رخ دهد اگر تابع با استدلال ثابت و عادی مخلوط نامیده می شد. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang کیان](https://github.com/fancyqlx)) -- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- ثابت `No message received` استثنا در حالی که دلربا قطعات بین کپی. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([الساپین](https://github.com/alesapin)) -- ثابت `arrayIntersect` عملکرد نتیجه اشتباه در مورد چندین مقدار تکرار در مجموعه تک. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع شرایط مسابقه در طول همزمان `ALTER COLUMN` نمایش داده شد که می تواند به یک تصادف سرور منجر شود (رفع مشکل [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([الکس زتلپین](https://github.com/ztlpn)) -- رفع کسر پارامتر در `ALTER MODIFY` از ستون `CODEC` هنگامی که نوع ستون مشخص نشده است. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([الساپین](https://github.com/alesapin)) -- توابع `cutQueryStringAndFragment()` و `queryStringAndFragment()` در حال حاضر به درستی کار می کند زمانی که `URL` شامل یک قطعه و بدون پرس و جو. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع اشکال نادر هنگام تنظیم `min_bytes_to_use_direct_io` بزرگتر از صفر است, که رخ می دهد زمانی که موضوع باید به دنبال عقب در فایل ستون. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([الساپین](https://github.com/alesapin)) -- رفع انواع استدلال اشتباه برای توابع مجموع با `LowCardinality` نشانوندها (رفع مشکل [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- تابع ثابت `toISOWeek` نتیجه برای سال 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `DROP`, `TRUNCATE` و `OPTIMIZE` نمایش داده شد تقلید, زمانی که در اجرا `ON CLUSTER` برای `ReplicatedMergeTree*` خانواده جداول. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([الساپین](https://github.com/alesapin)) - -#### بهبود {#improvements-2} - -- عادی نگه دارید, `DEFAULT`, `MATERIALIZED` و `ALIAS` ستون ها در یک لیست واحد (رفع مشکل [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([الکس زتلپین](https://github.com/ztlpn)) - -### انتشار کلیک کنیدهاوس 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} - -#### رفع اشکال {#bug-fixes-8} - -- رفع سقوط در `FULL/RIGHT JOIN` هنگامی که ما در پیوستن به nullable در مقابل نه nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([زویکوف](https://github.com/4ertus2)) -- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-11} - -- اضافه کردن یک راه برای راه اندازی تاتر-تصویر سرور از یک کاربر سفارشی. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### انتشار کلیک خانه 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} - -#### رفع اشکال {#bug-fixes-9} - -- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -### انتشار کلیک خانه 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} - -#### رفع اشکال {#bug-fixes-10} - -- نمایش داده شد از راه دور ثابت که شامل هر دو `LIMIT BY` و `LIMIT`. قبلا اگر `LIMIT BY` و `LIMIT` برای پرس و جو از راه دور استفاده شد, `LIMIT` می تواند قبل از اتفاق می افتد `LIMIT BY`, که منجر به نتیجه بیش از حد فیلتر. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([پان سنتانتین](https://github.com/kvap)) - -### انتشار کلیک خانه 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} - -#### ویژگی های جدید {#new-features-5} - -- اضافه شدن پشتیبانی کامل برای `Protobuf` قالب (ورودی و خروجی, ساختارهای داده تو در تو). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([ویتالی بارانو](https://github.com/vitlibar)) -- توابع بیت مپ اضافه شده با بیت مپ خروشان. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([اندی یانگ](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([ویتالی بارانو](https://github.com/vitlibar)) -- پشتیبانی از فرمت پارکت. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([پرولر](https://github.com/proller)) -- فاصله ان گرم برای مقایسه رشته فازی اضافه شد. این شبیه به معیارهای پرسش گرم در زبان تحقیق است. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([نام و نام خانوادگی](https://github.com/danlark1)) -- ترکیب قوانین برای رولپ گرافیت از تجمع اختصاصی و الگوهای نگهداری. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- اضافه شده `max_execution_speed` و `max_execution_speed_bytes` برای محدود کردن استفاده از منابع. اضافه شده `min_execution_speed_bytes` تنظیم برای تکمیل `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([زمستان ژانگ](https://github.com/zhang2014)) -- تابع اجرا شده `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([الکسی میلویدو](https://github.com/alexey-milovidov), [کزون](https://github.com/kzon)) -- اضافه شدن توابع `arrayEnumerateDenseRanked` و `arrayEnumerateUniqRanked` (مثل این است `arrayEnumerateUniq` اما اجازه می دهد تا به عمق مجموعه لحن خوب به داخل مجموعه چند بعدی نگاه). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([پرولر](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([زویکوف](https://github.com/4ertus2)) - -#### رفع اشکال {#bug-fixes-11} - -- این نسخه همچنین شامل تمام رفع اشکال از 19.3 و 19.1. -- اشکال ثابت در داده های پرش شاخص: سفارش گرانول پس از درج نادرست بود. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- ثابت `set` نمایه برای `Nullable` و `LowCardinality` ستون ها قبل از اون, `set` نمایه با `Nullable` یا `LowCardinality` ستون منجر به خطا `Data type must be deserialized with multiple streams` در حالی که انتخاب. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- به درستی تنظیم update\_time کامل `executable` فرهنگ لغت به روز رسانی. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([تما نویکوف](https://github.com/temoon)) -- رفع نوار پیشرفت شکسته در 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([فیلیمونف](https://github.com/filimonov)) -- مقادیر متناقض ثابت از یادداشت دوست داشتنی زمانی که منطقه حافظه کفن شد, در موارد خاص. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفتار تعریف نشده ثابت در استخر. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تصادف بسیار نادر با پیام را ثابت کرد `mutex lock failed: Invalid argument` که می تواند رخ دهد زمانی که یک جدول ادغام همزمان با انتخاب کاهش یافته بود. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([الکس زتلپین](https://github.com/ztlpn)) -- سازگاری درایور اودن بی سی با `LowCardinality` نوع داده. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([پرولر](https://github.com/proller)) -- FreeBSD: Fixup برای `AIOcontextPool: Found io_event with unknown id 0` خطا. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([هشدار داده می شود](https://github.com/urgordeadbeef)) -- `system.part_log` جدول ایجاد شد بدون در نظر گرفتن به پیکربندی. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع رفتار تعریف نشده در `dictIsIn` تابع برای لغت نامه کش. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([الساپین](https://github.com/alesapin)) -- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([الکس زتلپین](https://github.com/ztlpn)) -- غیر فعال کردن اکسپرس به طور پیش فرض تا زمانی که ما خود را دریافت کنید `llvm` تماس با ما و می توانید با تست `clang` و `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([الساپین](https://github.com/alesapin)) -- جلوگیری از `std::terminate` چه زمانی `invalidate_query` برای `clickhouse` منبع فرهنگ لغت خارجی نتیجه اشتباه بازگشته است (خالی یا بیش از یک ردیف یا بیش از یک ستون). موضوع ثابت زمانی که `invalidate_query` هر پنج ثانیه انجام شد بدون در نظر گرفتن به `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- جلوگیری از بن بست زمانی که `invalidate_query` برای یک فرهنگ لغت با `clickhouse` منبع شامل شد `system.dictionaries` جدول یا `Dictionaries` پایگاه (مورد نادر). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع صلیب با خالی جایی که بپیوندید. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([زویکوف](https://github.com/4ertus2)) -- پیش فرض ثابت در عملکرد “replicate” هنگامی که استدلال ثابت به تصویب می رسد. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع عملکرد لامبدا با بهینه ساز پیش فرض. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([زمستان ژانگ](https://github.com/zhang2014)) -- چندگانه می پیوندد رفع متعدد. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([زویکوف](https://github.com/4ertus2)) - -#### بهبود {#improvements-3} - -- نام مستعار پشتیبانی در عضویت در بخش ستون جدول سمت راست. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([زویکوف](https://github.com/4ertus2)) -- نتیجه چند پیوستن نیاز به نام نتیجه درست در زیر مجموعه استفاده می شود. جایگزین نام مستعار تخت با نام منبع در نتیجه. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([زویکوف](https://github.com/4ertus2)) -- بهبود منطق فشار به پایین برای اظهارات پیوست. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([ایوان](https://github.com/abyss7)) - -#### بهبود عملکرد {#performance-improvements-3} - -- اکتشافی بهبود یافته از “move to PREWHERE” بهینهسازی. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- استفاده از جداول مراجعه مناسب است که با استفاده از رابط برنامه کاربردی هش را برای کلید 8 بیتی و 16 بیتی. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([ایموس پرنده](https://github.com/amosbird)) -- بهبود عملکرد مقایسه رشته. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پاکسازی صف دی ال در یک موضوع جداگانه توزیع به طوری که کم کردن سرعت حلقه اصلی که پردازش توزیع وظایف دسیدال نیست. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([الکس زتلپین](https://github.com/ztlpn)) -- زمانی که `min_bytes_to_use_direct_io` تنظیم شده است 1, هر فایل با حالت اچ باز شد چرا که اندازه داده ها به خواندن گاهی اوقات به اندازه یک بلوک فشرده دست کم گرفت. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-12} - -- اضافه شدن پشتیبانی برای صدای جرنگ جرنگ-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشتباه `__asm__` دستورالعمل ها (دوباره) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([کنستانتین پودشوموک](https://github.com/podshumok)) -- اضافه کردن قابلیت مشخص کردن تنظیمات برای `clickhouse-performance-test` از خط فرمان. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([الساپین](https://github.com/alesapin)) -- اضافه کردن لغت نامه تست به تست ادغام. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([الساپین](https://github.com/alesapin)) -- اضافه شده نمایش داده شد از معیار در وب سایت به تست عملکرد خودکار. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `xxhash.h` در لنز خارجی 4 وجود ندارد زیرا این یک پیاده سازی دقیق است و نمادهای خود را با فضای نام `XXH_NAMESPACE` ماکرو. زمانی که lz4 خارجی xxHash به خارجی بیش از حد و وابستگان به لینک به آن. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([اوروج دش](https://github.com/orivej)) -- ثابت مورد زمانی که `quantileTiming` تابع جمع را می توان با استدلال نقطه منفی یا شناور نامیده می شود (این رفع تست ریش شدن با ضد عفونی کننده رفتار تعریف نشده). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تصحیح خطای املایی. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) -- رفع تلفیقی در مک. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([ویتالی بارانو](https://github.com/vitlibar)) -- ساخت رفع برای بورس و تنظیمات مختلف ساخت غیر معمول. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([پرولر](https://github.com/proller)) - -## انتشار کلیک 19.3 {#clickhouse-release-19-3} - -### انتشار کلیک خانه 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} - -#### رفع اشکال {#bug-fixes-12} - -- رفع سقوط در `FULL/RIGHT JOIN` هنگامی که ما در پیوستن به nullable در مقابل نه nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([زویکوف](https://github.com/4ertus2)) -- رفع گسل تقسیم بندی در `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([پرولر](https://github.com/proller)) -- خواندن ثابت از `Array(LowCardinality)` ستون در مورد نادر زمانی که ستون شامل یک توالی طولانی از مجموعه خالی. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-13} - -- اضافه کردن یک راه برای راه اندازی تاتر-تصویر سرور از یک کاربر سفارشی [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### انتشار کلیک خانه 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} - -#### رفع اشکال {#bug-fixes-13} - -- خطا ثابت در \# 3920. این خطا خود را به عنوان فساد کش تصادفی (پیام) نشان می دهد `Unknown codec family code`, `Cannot seek through file`) و segfaults. این اشکال اول به نظر می رسد در نسخه 19.1 و در حال حاضر در نسخه های تا به 19.1.10 و 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} - -#### رفع اشکال {#bug-fixes-14} - -- هنگامی که بیش از 1000 موضوع در استخر موضوع وجود دارد, `std::terminate` ممکن است در خروج موضوع اتفاق می افتد. [ازات خوژین](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر این امکان وجود دارد برای ایجاد `ReplicatedMergeTree*` جداول با نظرات در ستون بدون پیش فرض و جداول با کدک ستون بدون نظر و پیش فرض. همچنین مقایسه کدک ها را رفع کنید. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([الساپین](https://github.com/alesapin)) -- تصادف ثابت در پیوستن با مجموعه یا تاپل. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([زویکوف](https://github.com/4ertus2)) -- تصادف ثابت در تاتر-کپی با پیام `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([زویکوف](https://github.com/4ertus2)) -- قطع ثابت در خاموش کردن سرور اگر دستی توزیع مورد استفاده قرار گرفت. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([الکس زتلپین](https://github.com/ztlpn)) -- تعداد ستون نادرست در پیام خطا در مورد فرمت متن تجزیه برای ستون با تعداد بیشتر از چاپ شد 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-3} - -- ساخت ثابت با اوکس را فعال کنید. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حسابداری گسترده و حسابداری یو را بر اساس نسخه شناخته شده خوب به جای هسته ای که وارد شده است فعال کنید. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([نوارتولومی](https://github.com/nvartolomei)) -- اجازه به جست و خیز تنظیم از رمز و راز.کلیمی, هشدار به جای پرتاب اگر مجموعه ای محدود شکست. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([پرولر](https://github.com/proller)) -- حذف `inline` برچسب ها از `void readBinary(...)` داخل `Field.cpp`. همچنین با هم ادغام شدند کار برکنار شده `namespace DB` بلاک [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([هکز](https://github.com/hczhcz)) - -### انتشار کلیک خانه 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} - -#### رفع اشکال {#bug-fixes-15} - -- اشکال ثابت با پردازش نمایش داده شد قرار دادن قام بزرگ است. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([الساپین](https://github.com/alesapin)) -- ناسازگاری عقب ثابت با نسخه های قدیمی به دلیل اجرای اشتباه از `send_logs_level` تنظیمات. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ناسازگاری عقب مانده تابع جدول ثابت `remote` معرفی شده با نظرات ستون. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} - -#### بهبود {#improvements-4} - -- اندازه شاخص جدول برای محدودیت حافظه در هنگام انجام به حساب نمی `ATTACH TABLE` پرس و جو. اجتناب از احتمال که یک جدول می تواند پس از جدا شدن متصل نمی شود. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- کمی محدودیت در حداکثر رشته و مجموعه ای اندازه دریافت شده از باغ وحش مطرح شده است. این اجازه می دهد تا برای ادامه کار با افزایش اندازه `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` در باغ وحش. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجازه می دهد برای تعمیر ماکت رها حتی اگر در حال حاضر تعداد زیادی از گره ها در صف خود. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن یک استدلال مورد نیاز برای `SET` شاخص (حداکثر تعداد ردیف های ذخیره شده). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([نیکیتا واسیلیف](https://github.com/nikvas0)) - -#### رفع اشکال {#bug-fixes-16} - -- ثابت `WITH ROLLUP` نتیجه برای گروه های تک `LowCardinality` کلیدی است. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اشکال ثابت در شاخص مجموعه (حذف گرانول اگر شامل بیش از `max_rows` ردیف). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- بسیاری از رفع بورس ساخت. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([پرولر](https://github.com/proller)) -- جایگزینی نام مستعار ثابت در نمایش داده شد با زیرخاکی حاوی همان نام مستعار (موضوع [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([زویکوف](https://github.com/4ertus2)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-4} - -- اضافه کردن قابلیت اجرا `clickhouse-server` برای تست بدون تابعیت در تصویر کارگر بارانداز. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([واسیلی نمکو](https://github.com/Enmk)) - -### انتشار تاتر 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} - -#### ویژگی های جدید {#new-features-6} - -- اضافه شدن `KILL MUTATION` بیانیه ای که اجازه می دهد تا از بین بردن جهش است که برای برخی از دلایل گیر کرده است. اضافه شده `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` زمینه به `system.mutations` جدول برای عیب یابی ساده تر. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([الکس زتلپین](https://github.com/ztlpn)) -- اضافه شدن تابع جمع `entropy` که شانون انتروپی رو محاسبه میکنه [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([کد37](https://github.com/Quid37)) -- توانایی اضافه شده به ارسال نمایش داده شد `INSERT INTO tbl VALUES (....` به سرور بدون تقسیم در `query` و `data` قطعات. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([الساپین](https://github.com/alesapin)) -- اجرای عمومی `arrayWithConstant` تابع اضافه شد. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پیادهسازی شده `NOT BETWEEN` اپراتور مقایسه. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([دیمیتری نوموف](https://github.com/nezed)) -- پیاده سازی `sumMapFiltered` به منظور قادر به محدود کردن تعداد کلید که ارزش خواهد شد خلاصه `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- اضافه شدن پشتیبانی از `Nullable` انواع در `mysql` تابع جدول. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) -- پشتیبانی از عبارات ثابت دلخواه در `LIMIT` بند بند. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([جعبه 3](https://github.com/k3box)) -- اضافه شده `topKWeighted` تابع مجموع طول می کشد که استدلال اضافی با (عدد صحیح بدون علامت) وزن. [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([اندرو گولمن](https://github.com/andrewgolman)) -- `StorageJoin` در حال حاضر پشتیبانی `join_any_take_last_row` تنظیم که اجازه می دهد تا جای نوشتن ارزش های موجود از همان کلید. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([ایموس پرنده](https://github.com/amosbird) -- اضافه شدن تابع `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([ویتالی بارانو](https://github.com/vitlibar)) -- اضافه شده `RowBinaryWithNamesAndTypes` قالب. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([اولگ و کوزلوک](https://github.com/DarkWanderer)) -- اضافه شده `IPv4` و `IPv6` انواع داده ها. پیاده سازی موثر تر از `IPv*` توابع. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([واسیلی نمکو](https://github.com/Enmk)) -- اضافه شدن تابع `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([ویتالی بارانو](https://github.com/vitlibar)) -- اضافه شده `Protobuf` فرمت خروجی. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([ویتالی بارانو](https://github.com/vitlibar)) -- اضافه شده brotli پشتیبانی از http رابط برای واردات داده ها (درج). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([میخیل](https://github.com/fandyushin)) -- نکات اضافه شده در حالی که کاربر را تایپی در نام تابع و یا نوع در مشتری خط فرمان. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([نام و نام خانوادگی](https://github.com/danlark1)) -- اضافه شده `Query-Id` به هدر پاسخ قام سرور. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([میخیل](https://github.com/fandyushin)) - -#### ویژگی های تجربی {#experimental-features-2} - -- اضافه شده `minmax` و `set` داده پرش شاخص برای ادغام جدول موتورهای خانواده. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- تبدیل اضافه شده از `CROSS JOIN` به `INNER JOIN` در صورت امکان. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([زویکوف](https://github.com/4ertus2)) - -#### رفع اشکال {#bug-fixes-17} - -- ثابت `Not found column` برای ستون های تکراری در `JOIN ON` بخش. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([زویکوف](https://github.com/4ertus2)) -- ساخت `START REPLICATED SENDS` شروع فرمان تکرار می فرستد. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([نوارتولومی](https://github.com/nvartolomei)) -- ثابت توابع مجموع اعدام با `Array(LowCardinality)` بحث کردن. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- رفتار اشتباه ثابت هنگام انجام `INSERT ... SELECT ... FROM file(...)` پرس و جو و فایل است `CSVWithNames` یا `TSVWIthNames` فرمت و ردیف داده برای اولین بار از دست رفته است. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تصادف ثابت در بازنگری فرهنگ لغت اگر فرهنگ لغت در دسترس نیست. این اشکال در 19.1.6 ظاهر شد. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([پرولر](https://github.com/proller)) -- ثابت `ALL JOIN` با تکراری در جدول سمت راست. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([زویکوف](https://github.com/4ertus2)) -- گسل تقسیم بندی ثابت با `use_uncompressed_cache=1` و استثنا با اندازه غیر فشرده اشتباه است. این اشکال در 19.1.6 ظاهر شد. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([الساپین](https://github.com/alesapin)) -- ثابت `compile_expressions` اشکال با مقایسه بزرگ (بیش از مقدمه16) تاریخ. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([الساپین](https://github.com/alesapin)) -- حلقه بی نهایت ثابت در هنگام انتخاب از تابع جدول `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به طور موقت بهینه سازی پیش فرض برای غیر فعال کردن `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([زمستان ژانگ](https://github.com/zhang2014)) -- ثابت `Illegal instruction` خطا در هنگام استفاده از توابع بازه64 در پردازنده های قدیمی. این خطا تکثیر شده است تنها زمانی که فاحشه خانه با شورای همکاری خلیج فارس وارد شد-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `No message received` خطا در هنگام تعامل با راننده خیال راحت اد بی سی از طریق اتصال. همچنین رفع segfault در هنگام استفاده از MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نتیجه نادرست ثابت زمانی که `Date` و `DateTime` استدلال ها در شاخه های اپراتور شرطی (تابع `if`). مورد عمومی برای عملکرد اضافه شده است `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- لغت نامه کلیک کن در داخل بار `clickhouse` روند. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بن بست ثابت زمانی که `SELECT` از یک جدول با `File` موتور پس از دوباره انجام شد `No such file or directory` خطا. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شرایط مسابقه ثابت در هنگام انتخاب از `system.tables` ممکن است به `table doesn't exist` خطا. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `clickhouse-client` می توانید در هنگام خروج به طور مرتب داده ها را برای پیشنهادات خط فرمان بارگیری کنید اگر در حالت تعاملی اجرا شود. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال زمانی که اجرای جهش های حاوی `IN` اپراتورها نتایج نادرست تولید می کردند. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([الکس زتلپین](https://github.com/ztlpn)) -- خطا ثابت: اگر یک پایگاه داده با وجود `Dictionary` موتور, تمام لغت نامه مجبور به بارگذاری در هنگام راه اندازی سرور, و اگر یک فرهنگ لغت با منبع کلیک از منبع محلی هاست وجود دارد, فرهنگ لغت نمی تواند بار. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطا ثابت زمانی که سیستم سیاهههای مربوط به تلاش برای ایجاد دوباره در خاموش کردن سرور. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به درستی نوع مناسب را باز کنید و قفل ها را به درستی مدیریت کنید `joinGet` تابع. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([ایموس پرنده](https://github.com/amosbird)) -- اضافه شده `sumMapWithOverflow` تابع. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- ثابت segfault با `allow_experimental_multiple_joins_emulation`. [52دسی 2 درجه سانتیگراد](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([زویکوف](https://github.com/4ertus2)) -- اشکال ثابت با نادرست `Date` و `DateTime` مقایسه. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([حداکثر](https://github.com/valexey)) -- تست ریش ریش شدن ثابت تحت تعریف نشده رفتار ضد عفونی کننده: اضافه شدن نوع پارامتر را بررسی کنید `quantile*Weighted` خانواده از توابع. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شرایط مسابقه نادر ثابت در هنگام از بین بردن قطعات داده های قدیمی می تواند با شکست مواجه `File not found` خطا. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت نصب بسته با گم شده /و غیره/خانه کلیک-سرور / پیکربندی.. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([پرولر](https://github.com/proller)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-5} - -- دبیان بسته بندی: درست /و غیره/کلیک-سرور/لینک پیش پردازش با توجه به پیکربندی. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([پرولر](https://github.com/proller)) -- رفع ساخت های مختلف برای بورس. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([پرولر](https://github.com/proller)) -- توانایی اضافه شده به ایجاد, پر کردن و رها کردن جداول در اصلح. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([الساپین](https://github.com/alesapin)) -- اضافه شده یک اسکریپت برای تکراری بررسی شامل. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- توانایی اضافه شده به اجرا نمایش داده شد توسط شاخص در تست عملکرد. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([الساپین](https://github.com/alesapin)) -- بسته بندی با علامت اشکال زدایی پیشنهاد می شود نصب شود. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بازسازی عملکرد-تست. ورود به سیستم بهتر و سیگنال های دست زدن به. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([الساپین](https://github.com/alesapin)) -- اسناد اضافه شده به ناشناس یاندکس.مجموعه داده های متریکا. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([الساپین](https://github.com/alesapin)) -- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([الکس زتلپین](https://github.com/ztlpn)) -- اسناد اضافه شده در مورد دو مجموعه داده در اس3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([الساپین](https://github.com/alesapin)) -- اضافه شده اسکریپت که ایجاد تغییرات از کشش درخواست توضیحات. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([کوچتونیکولای](https://github.com/KochetovNicolai)) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- اضافه شده ماژول عروسک خیمه شب بازی برای فاحشه خانه. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([ماکسیم فدوتف](https://github.com/MaxFedotov)) -- اسناد اضافه شده برای یک گروه از توابع مستند نشده. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([زمستان ژانگ](https://github.com/zhang2014)) -- بازوی رفع ساخت. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([پرولر](https://github.com/proller)) ([پرولر](https://github.com/proller)) -- تست فرهنگ لغت در حال حاضر قادر به اجرا از `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([پرولر](https://github.com/proller)) -- حالا `/etc/ssl` به عنوان دایرکتوری پیش فرض با گواهی اس اس ال استفاده می شود. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده چک کردن اس اس اس و توضیحات در شروع. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([ایگر](https://github.com/igron99)) -- اسکریپت اینیت سرور صبر کنید تا شروع. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([پرولر](https://github.com/proller)) - -#### تغییرات ناسازگار به عقب {#backward-incompatible-changes-1} - -- حذف شد `allow_experimental_low_cardinality_type` تنظیمات. `LowCardinality` انواع داده ها تولید می شوند. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- کاهش اندازه علامت کش و اندازه کش غیر فشرده بر این اساس به مقدار حافظه در دسترس است. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([لوپاتین کنستانتین](https://github.com/k-lopatin) -- کلمه کلیدی اضافه شده است `INDEX` داخل `CREATE TABLE` پرس و جو. یک ستون با نام `index` باید با پشتی یا نقل قول های دوگانه نقل قول شود: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- `sumMap` در حال حاضر نوع نتیجه به جای سرریز ترویج. قدیمی `sumMap` رفتار را می توان با استفاده از `sumMapWithOverflow` تابع. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) - -#### بهبود عملکرد {#performance-improvements-4} - -- `std::sort` جایگزین شده توسط `pdqsort` برای نمایش داده شد بدون `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([اوگنی پراودا](https://github.com/kvinty)) -- در حال حاضر سرور موضوعات استفاده مجدد از استخر موضوع جهانی است. این عملکرد در برخی موارد گوشه تاثیر می گذارد. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### بهبود {#improvements-5} - -- پیاده سازی پشتیبانی برای بورس. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([هشدار داده می شود](https://github.com/urgordeadbeef)) -- `SELECT * FROM a JOIN b USING a, b` حالا برگرد `a` و `b` ستون تنها از جدول سمت چپ. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([زویکوف](https://github.com/4ertus2)) -- اجازه داده شود `-C` گزینه مشتری برای کار به عنوان `-c` انتخاب [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([سیمینسرگی](https://github.com/syominsergey)) -- در حال حاضر گزینه `--password` استفاده بدون ارزش نیاز به رمز عبور از استدین. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([حداقل صفحه نمایش:](https://github.com/bsd-conqueror)) -- افزود برجسته از unescaped metacharacters در string literals که حاوی `LIKE` عبارات و یا عبارت منظم. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده لغو قام به عنوان خوانده شده تنها نمایش داده شد اگر سوکت مشتری از بین می رود. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([نوارتولومی](https://github.com/nvartolomei)) -- در حال حاضر گزارش سرور پیشرفت برای زنده نگه داشتن اتصالات مشتری. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([ایوان](https://github.com/abyss7)) -- پیام کمی بهتر با دلیل برای بهینه سازی پرس و جو با `optimize_throw_if_noop` تنظیم را فعال کنید. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن پشتیبانی از `--version` گزینه ای برای سرور کلیک. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([لوپاتین کنستانتین](https://github.com/k-lopatin)) -- اضافه شده `--help/-h` گزینه ای برای `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([یوری baranov](https://github.com/yurriy)) -- اضافه شدن پشتیبانی برای زیرمجموعه اسکالر با تابع کل نتیجه دولت است. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- بهبود زمان خاموش کردن سرور و تغییر زمان انتظار. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن اطلاعات در مورد تنظیمات \_شروع مجدد به سیستم.کپی و اضافه کردن ورود به سیستم اگر ماکت نمی خواهد سعی کنید برای تبدیل شدن به رهبر. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([الکس زتلپین](https://github.com/ztlpn)) - -## انتشار کلیک 19.1 {#clickhouse-release-19-1} - -### انتشار کلیک خانه 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} - -- خطای ثابت `Column ... queried more than once` که ممکن است اتفاق می افتد اگر تنظیمات `asterisk_left_columns_only` در صورت استفاده به 1 تنظیم می شود `GLOBAL JOIN` با `SELECT *` (مورد نادر). این موضوع در وجود ندارد 19.3 و جدیدتر. [6باک7د8د](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([زویکوف](https://github.com/4ertus2)) - -### انتشار کلیک خانه 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} - -این نسخه شامل دقیقا همان مجموعه ای از تکه های به عنوان 19.3.7. - -### انتشار کلیک خانه 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} - -این نسخه شامل دقیقا همان مجموعه ای از تکه های به عنوان 19.3.6. - -## انتشار کلیک 19.1 {#clickhouse-release-19-1-1} - -### انتشار کلیک خانه 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} - -#### رفع اشکال {#bug-fixes-18} - -- ناسازگاری عقب ثابت با نسخه های قدیمی به دلیل اجرای اشتباه از `send_logs_level` تنظیمات. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ناسازگاری عقب مانده تابع جدول ثابت `remote` معرفی شده با نظرات ستون. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} - -#### رفع اشکال {#bug-fixes-19} - -- ثابت نصب بسته با گم شده /و غیره/خانه کلیک-سرور / پیکربندی.. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([پرولر](https://github.com/proller)) - -## انتشار کلیک 19.1 {#clickhouse-release-19-1-2} - -### انتشار کلیک خانه 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} - -#### رفع اشکال {#bug-fixes-20} - -- به درستی نوع مناسب را باز کنید و قفل ها را به درستی مدیریت کنید `joinGet` تابع. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([ایموس پرنده](https://github.com/amosbird)) -- خطا ثابت زمانی که سیستم سیاهههای مربوط به تلاش برای ایجاد دوباره در خاموش کردن سرور. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطا ثابت: اگر یک پایگاه داده با وجود `Dictionary` موتور, تمام لغت نامه مجبور به بارگذاری در هنگام راه اندازی سرور, و اگر یک فرهنگ لغت با منبع کلیک از منبع محلی هاست وجود دارد, فرهنگ لغت نمی تواند بار. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال زمانی که اجرای جهش های حاوی `IN` اپراتورها نتایج نادرست تولید می کردند. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([الکس زتلپین](https://github.com/ztlpn)) -- `clickhouse-client` می توانید در هنگام خروج به طور مرتب داده ها را برای پیشنهادات خط فرمان بارگیری کنید اگر در حالت تعاملی اجرا شود. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شرایط مسابقه ثابت در هنگام انتخاب از `system.tables` ممکن است به `table doesn't exist` خطا. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بن بست ثابت زمانی که `SELECT` از یک جدول با `File` موتور پس از دوباره انجام شد `No such file or directory` خطا. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت موضوع: لغت نامه خانه کلیک محلی از طریق تی سی پی لود, اما باید در روند بارگذاری. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `No message received` خطا در هنگام تعامل با راننده خیال راحت اد بی سی از طریق اتصال. همچنین رفع segfault در هنگام استفاده از MySQL ODBC Driver. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به طور موقت بهینه سازی پیش فرض برای غیر فعال کردن `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([زمستان ژانگ](https://github.com/zhang2014)) -- حلقه بی نهایت ثابت در هنگام انتخاب از تابع جدول `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `compile_expressions` اشکال با مقایسه بزرگ (بیش از مقدمه16) تاریخ. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([الساپین](https://github.com/alesapin)) -- گسل تقسیم بندی ثابت با `uncompressed_cache=1` و استثنا با اندازه غیر فشرده اشتباه است. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([الساپین](https://github.com/alesapin)) -- ثابت `ALL JOIN` با تکراری در جدول سمت راست. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([زویکوف](https://github.com/4ertus2)) -- رفتار اشتباه ثابت هنگام انجام `INSERT ... SELECT ... FROM file(...)` پرس و جو و فایل است `CSVWithNames` یا `TSVWIthNames` فرمت و ردیف داده برای اولین بار از دست رفته است. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت توابع مجموع اعدام با `Array(LowCardinality)` بحث کردن. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- دبیان بسته بندی: درست /و غیره/کلیک-سرور/لینک پیش پردازش با توجه به پیکربندی. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([پرولر](https://github.com/proller)) -- تست ریش ریش شدن ثابت تحت تعریف نشده رفتار ضد عفونی کننده: اضافه شدن نوع پارامتر را بررسی کنید `quantile*Weighted` خانواده از توابع. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ساخت `START REPLICATED SENDS` شروع فرمان تکرار می فرستد. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([نوارتولومی](https://github.com/nvartolomei)) -- ثابت `Not found column` برای ستون های تکراری در عضویت در بخش. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([زویکوف](https://github.com/4ertus2)) -- حالا `/etc/ssl` به عنوان دایرکتوری پیش فرض با گواهی اس اس ال استفاده می شود. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تصادف ثابت در بازنگری فرهنگ لغت اگر فرهنگ لغت در دسترس نیست. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([پرولر](https://github.com/proller)) -- اشکال ثابت با نادرست `Date` و `DateTime` مقایسه. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([حداکثر](https://github.com/valexey)) -- نتیجه نادرست ثابت زمانی که `Date` و `DateTime` استدلال ها در شاخه های اپراتور شرطی (تابع `if`). مورد عمومی برای عملکرد اضافه شده است `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -### انتشار کلیک خانه 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} - -#### ویژگی های جدید {#new-features-7} - -- سفارشی در هر کدک های فشرده سازی ستون برای جداول. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([الساپین](https://github.com/alesapin), [زمستان ژانگ](https://github.com/zhang2014), [انتولی](https://github.com/Sindbag)) -- اضافه شده کدک فشرده سازی `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([الساپین](https://github.com/alesapin)) -- اجازه دادن به `ALTER` کدک های فشرده سازی. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([الساپین](https://github.com/alesapin)) -- اضافه شدن توابع `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` برای سازگاری استاندارد گذاشتن. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([ایوان بلینکو](https://github.com/blinkov)) -- پشتیبانی از نوشتن در `HDFS` جداول و `hdfs` تابع جدول. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([الساپین](https://github.com/alesapin)) -- اضافه شدن توابع به جستجو برای رشته ثابت متعدد از انبار کاه بزرگ: `multiPosition`, `multiSearch` ,`firstMatch` همچنین با `-UTF8`, `-CaseInsensitive` و `-CaseInsensitiveUTF8` انواع. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([نام و نام خانوادگی](https://github.com/danlark1)) -- هرس کردن تکه های استفاده نشده اگر `SELECT` فیلترهای پرس و جو با کلید شاردینگ (تنظیم `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([گلب کنتروف](https://github.com/kanterov), [ایوان](https://github.com/abyss7)) -- اجازه داده شود `Kafka` موتور به چشم پوشی از برخی از تعدادی از خطاهای تجزیه در هر بلوک. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([ایوان](https://github.com/abyss7)) -- اضافه شدن پشتیبانی برای `CatBoost` multiclass مدل های ارزیابی. تابع `modelEvaluate` را برمی گرداند تاپل با پیش بینی های خام در هر کلاس برای مدل های چند طبقه. `libcatboostmodel.so` باید با ساخته شده است [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- اضافه شدن توابع `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([بوریس گرانویو](https://github.com/bgranvea)) -- اضافه شده توابع هش کردن `xxHash64` و `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([فیلیمونف](https://github.com/filimonov)) -- اضافه شده `gccMurmurHash` تابع هش (شورای همکاری خلیج فارس طعم زمزمه هش) که با استفاده از همان دانه هش به عنوان [شورای همکاری خلیج فارس](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- اضافه شده توابع هش کردن `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([شانگشویی365](https://github.com/shangshujie365)) -- تابع جدول اضافه شده است `remoteSecure`. تابع به عنوان کار می کند `remote`, اما با استفاده از اتصال امن. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([پرولر](https://github.com/proller)) - -#### ویژگی های تجربی {#experimental-features-3} - -- اضافه شده چند تقلید می پیوندد (`allow_experimental_multiple_joins_emulation` تنظیمات). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([زویکوف](https://github.com/4ertus2)) - -#### رفع اشکال {#bug-fixes-21} - -- ساخت `compiled_expression_cache_size` تنظیم به طور پیش فرض برای کاهش مصرف حافظه محدود شده است. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([الساپین](https://github.com/alesapin)) -- رفع اشکال که منجر به hangups در تاپیک های که انجام تغییر از تکرار جداول و در این موضوع است که به روز رسانی پیکربندی از باغ وحش. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([الکس زتلپین](https://github.com/ztlpn)) -- ثابت شرایط مسابقه در هنگام اجرای یک کار تغییر توزیع شده است. شرایط مسابقه منجر به بیش از یک ماکت در تلاش برای اجرای کار و همه کپی به جز یک شکست با یک خطای باغ وحش. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([الکس زتلپین](https://github.com/ztlpn)) -- رفع اشکال زمانی که `from_zk` عناصر پیکربندی شد پس از یک درخواست به باغ وحش به پایان رسیده است تجدید نیست. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([الکس زتلپین](https://github.com/ztlpn)) -- رفع اشکال با پیشوند اشتباه برای ماسک زیر شبکه ایپسویچ. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([الساپین](https://github.com/alesapin)) -- تصادف ثابت (`std::terminate`) در موارد نادر زمانی که یک موضوع جدید نمی تواند به دلیل منابع خسته ایجاد شود. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال زمانی که در `remote` اجرای تابع جدول زمانی که محدودیت اشتباه برای در مورد استفاده قرار گرفت `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([الساپین](https://github.com/alesapin)) -- رفع نشت از سوکت نتلینک. در یک استخر قرار گرفتند که هرگز حذف نشدند و سوکت های جدید در ابتدای یک موضوع جدید ایجاد شد زمانی که همه سوکت های فعلی استفاده می شد. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([الکس زتلپین](https://github.com/ztlpn)) -- رفع اشکال با بسته شدن `/proc/self/fd` دایرکتوری زودتر از همه پزشکان از خوانده شد `/proc` پس از مجبور `odbc-bridge` مانع عبور. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([الساپین](https://github.com/alesapin)) -- رشته ثابت به تبدیل یکنواخت کهنه در مورد رشته استفاده در کلید اولیه. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([زمستان ژانگ](https://github.com/zhang2014)) -- خطا ثابت در محاسبه یکنواختی تابع تبدیل عدد صحیح. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت segfault در `arrayEnumerateUniq`, `arrayEnumerateDense` توابع در مورد برخی از استدلال نامعتبر. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال بارگذاری [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([ایموس پرنده](https://github.com/amosbird)) -- پیش فرض ثابت در توابع `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطای ثابت: توابع `round`, `floor`, `trunc`, `ceil` ممکن است نتیجه جعلی بازگشت زمانی که در استدلال صحیح و مقیاس بزرگ منفی اجرا. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال ناشی از ‘kill query sync’ که منجر به روگرفت هسته. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([شناسه بسته:](https://github.com/fancyqlx)) -- رفع اشکال با تاخیر طولانی پس از صف تکرار خالی است. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([الساپین](https://github.com/alesapin)) -- استفاده از حافظه بیش از حد ثابت در صورت قرار دادن به جدول با `LowCardinality` کلید اصلی. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- ثابت `LowCardinality` ترتیب برای `Native` فرمت در مورد مجموعه های خالی. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- نتیجه نادرست ثابت در حالی که با استفاده از مجزا توسط ستون عددی کم حافظه. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- تجمع تخصصی ثابت با کلید کمکاری (در صورتی که `compile` تنظیم فعال است). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- رفع کاربر و رمز عبور حمل و نقل برای جداول تکرار نمایش داده شد. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([الساپین](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) -- ثابت شرایط مسابقه بسیار نادر است که می تواند رخ دهد که لیست جداول در پایگاه داده فرهنگ لغت در حالی که بارگذاری لغت نامه. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نتیجه نادرست ثابت زمانی که با رولپ یا مکعب مورد استفاده قرار گرفت. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([سام چو](https://github.com/reflection)) -- نام مستعار ستون ثابت برای پرس و جو با `JOIN ON` نحو و جداول توزیع. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([زمستان ژانگ](https://github.com/zhang2014)) -- خطای ثابت در اجرای داخلی `quantileTDigest` (که توسط آرتم Vakhrushev). این خطا اتفاق هرگز در ClickHouse و مناسب بود تنها برای کسانی که استفاده از ClickHouse کدهای به عنوان یک کتابخانه به طور مستقیم. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### بهبود {#improvements-6} - -- پشتیبانی از `IF NOT EXISTS` داخل `ALTER TABLE ADD COLUMN` بیانیه همراه با `IF EXISTS` داخل `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([بوریس گرانویو](https://github.com/bgranvea)) -- تابع `parseDateTimeBestEffort`: پشتیبانی از فرمت های `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` و مشابه. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- `CapnProtoInputStream` در حال حاضر سازه های ناهموار ممکن میکند پشتیبانی می کند. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) -- بهبود قابلیت استفاده: اضافه شدن چک که روند سرور از صاحب دایرکتوری داده ها شروع شده است. اجازه ندهید سرور را از ریشه شروع کنید اگر داده ها متعلق به کاربر غیر ریشه باشد. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([سرگی-وی-گالتسف](https://github.com/sergey-v-galtsev)) -- منطق بهتر از چک کردن ستون های مورد نیاز در طول تجزیه و تحلیل نمایش داده شد با می پیوندد. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([زویکوف](https://github.com/4ertus2)) -- تعداد اتصالات در صورت تعداد زیادی از جداول توزیع شده در یک سرور کاهش یافته است. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([زمستان ژانگ](https://github.com/zhang2014)) -- بالغ پشتیبانی ردیف برای `WITH TOTALS` پرس و جو برای راننده او بی سی. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([مکسیم کریتکی](https://github.com/nightweb)) -- مجاز به استفاده `Enum`به عنوان اعداد صحیح در داخل اگر تابع. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([ایوان](https://github.com/abyss7)) -- اضافه شده `low_cardinality_allow_in_native_format` تنظیمات. اگر غیر فعال, استفاده نکنید `LowCadrinality` نوع در `Native` قالب. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([کوچتونیکولای](https://github.com/KochetovNicolai)) -- حذف برخی از اجسام کار برکنار شده از عبارات وارد کش به کاهش استفاده از حافظه است. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([الساپین](https://github.com/alesapin)) -- اضافه کردن چک که `SET send_logs_level = 'value'` پرس و جو قبول ارزش مناسب. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([سابین ماکسیم](https://github.com/s-mx)) -- بررسی نوع داده ثابت در توابع تبدیل نوع. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([زمستان ژانگ](https://github.com/zhang2014)) - -#### بهبود عملکرد {#performance-improvements-5} - -- افزودن تنظیمات ادغام `use_minimalistic_part_header_in_zookeeper`. اگر فعال, جداول تکرار خواهد ابرداده بخش جمع و جور در یک قسمت صفر ذخیره. این به طور چشمگیری می تواند به کاهش اندازه عکس فوری باغ وحش (به خصوص اگر جداول یک مقدار زیادی از ستون). توجه داشته باشید که پس از فعال کردن این تنظیمات شما قادر نخواهد بود به جمع و جور کردن به نسخه ای که پشتیبانی نمی کند. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([الکس زتلپین](https://github.com/ztlpn)) -- اضافه کردن یک پیاده سازی مبتنی بر وزارت امور خارجه برای توابع `sequenceMatch` و `sequenceCount` در مورد الگوی حاوی زمان نیست. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- بهبود عملکرد برای اعداد صحیح ترتیب. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([ایموس پرنده](https://github.com/amosbird)) -- صفر پدرارهای چپ به طوری که -1 عنصر همیشه معتبر و صفر است. این برای محاسبه بدون شاخه از شیپور خاموشی استفاده می شود. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([ایموس پرنده](https://github.com/amosbird)) -- واگردانی `jemalloc` نسخه که منجر به تخریب عملکرد. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### تغییرات ناسازگار به عقب {#backward-incompatible-changes-2} - -- حذف ویژگی مستند نشده است `ALTER MODIFY PRIMARY KEY` چرا که توسط جایگزین شد `ALTER MODIFY ORDER BY` فرمان. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([الکس زتلپین](https://github.com/ztlpn)) -- تابع حذف شده `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- منع استفاده از زیرکورهای اسکالر با نتیجه نوع `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([ایوان](https://github.com/abyss7)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvements-6} - -- اضافه شدن پشتیبانی برای پاور (`ppc64le`) ساختن . [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([نام و نام خانوادگی](https://github.com/danlark1)) -- تست های عملکردی نفرت انگیز بر روی مجموعه داده های عمومی در دسترس اجرا. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطا ثابت زمانی که سرور نمی تواند با شروع `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` پیام در داکر یا سیستم-خوانده. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز شده `rdkafka` کتابخانه به 1. 0. 0-ارک5. کپکافکا مورد استفاده به جای رابط ج خام. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([ایوان](https://github.com/abyss7)) -- به روز شده `mariadb-client` کتابخونه. ثابت یکی از مشکلات پیدا شده توسط اوبسان. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- برخی از رفع برای اوبسان ایجاد. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده در هر مرتکب اجرا می شود از تست با ساخت اوبان. -- اضافه شده در هر مرتکب اجرا می شود از پوس استودیو تجزیه و تحلیل استاتیک می باشد. -- اشکالات ثابت پیدا شده توسط پوس استودیو. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت glibc مسائل مربوط به سازگاری. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- انتقال تصاویر کارگر بارانداز به 18.10 و اضافه کردن فایل سازگاری برای چرب \> = 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([الساپین](https://github.com/alesapin)) -- اضافه کردن متغیر پاکت اگر کاربر نمی خواهید به دایرکتوری پی ان در سرور تصویر کارگر بارانداز. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([الساپین](https://github.com/alesapin)) -- فعال بسیاری از هشدارهای از `-Weverything` تو کلانگ فعال شد `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده چند هشدار که تنها در صدای جرنگ جرنگ در دسترس هستند 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پیوند به `libLLVM` در هنگام استفاده از پیوند مشترک به جای استفاده از لوب های فردی لورم. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([اوروج دش](https://github.com/orivej)) -- اضافه شده متغیرهای ضد عفونی کننده برای تصاویر تست. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([الساپین](https://github.com/alesapin)) -- `clickhouse-server` بسته دبیان توصیه خواهد شد `libcap2-bin` بسته برای استفاده `setcap` ابزار برای تنظیم قابلیت های. این اختیاری است. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- زمان تدوین بهبود, ثابت شامل. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([پرولر](https://github.com/proller)) -- تست عملکرد اضافه شده برای توابع هش. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([فیلیمونف](https://github.com/filimonov)) -- وابستگی کتابخانه چرخهای ثابت. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([پرولر](https://github.com/proller)) -- تلفیقی بهبود یافته با حافظه کم در دسترس است. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([پرولر](https://github.com/proller)) -- اضافه شدن اسکریپت تست به تکثیر تخریب عملکرد در `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت misspells در نظرات و string literals تحت `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([مامان](https://github.com/maiha)) -- غلط املایی ثابت در نظرات. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([اوگنی پراودا](https://github.com/kvinty)) - -## [تغییرات برای 2018](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/fa/whats_new/changelog/index.md b/docs/fa/whats_new/changelog/index.md deleted file mode 100644 index 8dcc20e9409..00000000000 --- a/docs/fa/whats_new/changelog/index.md +++ /dev/null @@ -1,668 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Changelog -toc_priority: 74 -toc_title: '2020' ---- - -## انتشار کلیک و 20.3 {#clickhouse-release-v20-3} - -### ClickHouse انتشار v20.3.4.10, 2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} - -#### رفع اشکال {#bug-fix} - -- این نسخه همچنین شامل تمام رفع اشکال از 20.1.8.41 -- رفع از دست رفته `rows_before_limit_at_least` برای نمایش داده شد بیش از قام (با پردازنده خط لوله). این رفع [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -### انتشار کلیک و 20.3.3.6, 2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} - -#### رفع اشکال {#bug-fix-1} - -- این نسخه همچنین شامل تمام رفع اشکال از 20.1.7.38 -- رفع اشکال در تکرار می کند که تکرار اجازه نمی دهد به کار اگر کاربر جهش در نسخه های قبلی اجرا کرده است. این رفع [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([الساپین](https://github.com/alesapin)). این باعث می شود نسخه 20.3 به عقب سازگار دوباره. -- افزودن تنظیمات `use_compact_format_in_distributed_parts_names` که اجازه می دهد برای نوشتن فایل برای `INSERT` نمایش داده شد به `Distributed` جدول با فرمت جمع و جور تر. این رفع [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([الساپین](https://github.com/alesapin)). این باعث می شود نسخه 20.3 به عقب سازگار دوباره. - -### انتشار کلیک و 20.3.2.1, 2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} - -#### تغییر ناسازگار به عقب {#backward-incompatible-change} - -- ثابت موضوع `file name too long` هنگام ارسال داده ها برای `Distributed` جداول برای تعداد زیادی از کپی. ثابت این موضوع که اعتبار ماکت در ورود به سیستم سرور قرار گرفتند. فرمت نام دایرکتوری بر روی دیسک به تغییر یافت `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([میخیل کوروتف](https://github.com/millb)) پس از شما به نسخه جدید ارتقا دهید, شما نمی قادر خواهد بود به جمع و جور کردن بدون دخالت دستی, به دلیل نسخه سرور قدیمی می کند فرمت دایرکتوری جدید به رسمیت نمی شناسد. اگر شما می خواهید به جمع و جور کردن, شما باید به صورت دستی تغییر نام دایرکتوری مربوطه را به فرمت های قدیمی. این تغییر مربوط است تنها اگر شما ناهمزمان استفاده کرده اند `INSERT`اس به `Distributed` میز در نسخه 20.3.3 ما یک محیط است که به شما اجازه فعال کردن فرمت جدید به تدریج معرفی. -- فرمت ورودی ورود به سیستم تکرار برای دستورات جهش تغییر کرده است. شما باید صبر کنید برای جهش های قدیمی برای پردازش قبل از نصب نسخه جدید. -- پیاده سازی پیشفیلتر حافظه ساده است که افسردگی زخم به `system.trace_log` هر بایت بر سر حد تخصیص نرم [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([ایوان](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([الکسی میلویدو](https://github.com/alexey-milovidov)) ستون `system.trace_log` از تغییر نام داد `timer_type` به `trace_type`. این تغییرات در تجزیه و تحلیل عملکرد شخص ثالث و ابزارهای پردازش فلامگراف نیاز دارد. -- استفاده از شناسه موضوع سیستم عامل در همه جا به جای شماره موضوع داخلی. این رفع [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) قدیمی `clickhouse-client` می توانید سیاهههای مربوط که از سرور ارسال زمانی که تنظیم دریافت نمی `send_logs_level` فعال است, چرا که نام و نوع پیام ورود به سیستم ساختار تغییر یافت. از سوی دیگر نسخه های سرور مختلف سیاهههای مربوط با انواع مختلف به یکدیگر ارسال کنید. هنگامی که شما از `send_logs_level` محیط, شما باید مهم نیست. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حذف `indexHint` تابع [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حذف `findClusterIndex`, `findClusterValue` توابع. این رفع [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). اگر شما با استفاده از این توابع, ارسال یک ایمیل به `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر مجاز به ایجاد ستون و یا اضافه کردن ستون با `SELECT` زیرخاکری به عنوان عبارت پیش فرض. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([الساپین](https://github.com/alesapin)) -- نیاز نام مستعار برای کارخانه های فرعی در عضویت. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([زویکوف](https://github.com/4ertus2)) -- بهبود `ALTER MODIFY/ADD` نمایش داده شد منطق. حالا شما نمی توانید `ADD` ستون بدون نوع, `MODIFY` عبارت پیش فرض نوع ستون را تغییر نمی دهد و `MODIFY` نوع ارزش بیان پیش فرض را از دست نمی دهد. رفع [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([الساپین](https://github.com/alesapin)) -- نیاز به سرور برای راه اندازی مجدد برای اعمال تغییرات در پیکربندی ورود به سیستم. این یک راه حل موقت برای جلوگیری از اشکال که سرور سیاهههای مربوط به یک فایل ورود به سیستم حذف شده است (دیدن [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- تنظیمات `experimental_use_processors` به طور پیش فرض فعال است. این تنظیم را قادر می سازد استفاده از خط لوله پرس و جو جدید. این فاکتورگیری مجدد داخلی است و ما انتظار داریم هیچ تغییری قابل مشاهده. اگر مشکلی خواهید دید صفر را تنظیم کنید. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### ویژگی جدید {#new-feature} - -- افزودن `Avro` و `AvroConfluent` فرمت های ورودی/خروجی [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([اندرو انیشچوک](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([اندرو انیشچوک](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز رسانی چند رشته ای و غیر مسدود کردن کلید منقضی شده در `cache` واژهنامهها (با اجازه اختیاری به خواندن قدیمی). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- افزودن پرسوجو `ALTER ... MATERIALIZE TTL`. این اجرا می شود جهش است که نیروهای به حذف داده های منقضی شده توسط کنترل از راه دور و دوباره حساب متا اطلاعات در مورد کنترل از راه دور در تمام نقاط. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([انتون پوپوف](https://github.com/CurtizJ)) -- سوئیچ از hashjoin به mergejoin (بر روی دیسک) در صورت نیاز [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([زویکوف](https://github.com/4ertus2)) -- اضافه شده `MOVE PARTITION` فرمان برای `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- بارگذاری مجدد پیکربندی ذخیره سازی از فایل پیکربندی در پرواز. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- مجاز به تغییر `storage_policy` به یکی کمتر غنی. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اضافه شدن پشتیبانی برای کره / نویسه عام برای ذخیره سازی اس3 و عملکرد جدول. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- پیاده سازی `bitAnd`, `bitOr`, `bitXor`, `bitNot` برای `FixedString(N)` نوع داده. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- اضافه شدن تابع `bitCount`. این رفع [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([درباره ما](https://github.com/ikopylov)) -- افزودن `generateRandom` تابع جدول برای تولید ردیف تصادفی با طرح داده شده است. اجازه می دهد تا به جمعیت جدول تست دلخواه با داده ها. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([ایلیا یاتسیشین](https://github.com/qoega)) -- `JSONEachRowFormat`: پشتیبانی از موارد خاص زمانی که اشیا محصور شده در مجموعه سطح بالا. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([کروگلو پاول](https://github.com/Avogar)) -- در حال حاضر امکان ایجاد یک ستون با `DEFAULT` عبارت که به یک ستون با پیش فرض بستگی دارد `ALIAS` اصطلاح. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([الساپین](https://github.com/alesapin)) -- اجازه مشخص کردن `--limit` بیش از اندازه منبع داده در `clickhouse-obfuscator`. داده ها خود را با دانه های مختلف تصادفی تکرار. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده `groupArraySample` تابع (شبیه به `groupArray`) با الگوریتم نمونه برداری ذخیره. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([ایموس پرنده](https://github.com/amosbird)) -- حالا شما می توانید اندازه صف به روز رسانی در نظارت `cache`/`complex_key_cache` واژهنامهها از طریق معیارهای سیستم. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- اجازه دهید به عنوان یک جداساز خط در فرمت خروجی سی. سی. وی با تنظیم استفاده کنید `output_format_csv_crlf_end_of_line` به 1 تنظیم شده است [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([میخیل کوروتف](https://github.com/millb)) -- اجرای توابع بیشتری از [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` و `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([نیکو مان پودری](https://github.com/nmandery)) -- تنظیمات جدید معرفی شده است: `max_parser_depth` برای کنترل حداکثر اندازه پشته و اجازه می دهد نمایش داده شد پیچیده بزرگ است. این رفع [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) و [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([ماکسیم اسمیرنوف](https://github.com/qMBQx8GH)) -- افزودن یک تنظیم `force_optimize_skip_unused_shards` تنظیم به پرتاب اگر پرش از خرده ریز استفاده نشده امکان پذیر نیست [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([ازات خوژین](https://github.com/azat)) -- مجاز به پیکربندی چندین دیسک / حجم برای ذخیره سازی داده ها برای ارسال در `Distributed` موتور [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([ازات خوژین](https://github.com/azat)) -- سیاست ذخیره سازی پشتیبانی (``)برای ذخیره سازی داده های موقت . [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([ازات خوژین](https://github.com/azat)) -- اضافه شده `X-ClickHouse-Exception-Code` هدر قام است که اگر استثنا قبل از ارسال داده ها پرتاب شد. این پیاده سازی [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([میخیل کوروتف](https://github.com/millb)) -- اضافه شدن تابع `ifNotFinite`. این فقط یک شکر نحوی است: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده `last_successful_update_time` ستون در `system.dictionaries` جدول [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- افزودن `blockSerializedSize` تابع (اندازه بر روی دیسک بدون فشرده سازی) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([ازات خوژین](https://github.com/azat)) -- افزودن تابع `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([هکز](https://github.com/hczhcz)) -- جداول سیستم اضافه شده است `system.zeros` و `system.zeros_mt` و همچنین توابع داستان `zeros()` و `zeros_mt()`. جداول (و توابع جدول) شامل یک ستون با نام `zero` و نوع `UInt8`. این ستون حاوی صفر. این است که برای اهداف تست به عنوان سریع ترین روش برای تولید بسیاری از ردیف مورد نیاز است. این رفع [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) - -#### ویژگی تجربی {#experimental-feature} - -- اضافه کردن فرمت جمع و جور جدید از قطعات در `MergeTree`- جداول خانواده که در تمام ستون ها در یک فایل ذخیره می شود . این کمک می کند برای افزایش عملکرد درج کوچک و مکرر. فرمت قدیمی (یک فایل در هر ستون) در حال حاضر گسترده ای نامیده می شود. فرمت ذخیره سازی داده ها توسط تنظیمات کنترل می شود `min_bytes_for_wide_part` و `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([انتون پوپوف](https://github.com/CurtizJ)) -- پشتیبانی از ذخیره سازی اس 3 برای `Log`, `TinyLog` و `StripeLog` میز [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([پاول کووالنکو](https://github.com/Jokser)) - -#### رفع اشکال {#bug-fix-2} - -- فضاهای خالی متناقض ثابت در پیام های ورود به سیستم. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال که در مجموعه ای از تاپل نامش ذکر نشده به عنوان ساختارهای تو در تو در ایجاد جدول پهن شد. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([اچولکوف2](https://github.com/achulkov2)) -- ثابت موضوع زمانی که “Too many open files” خطا ممکن است رخ دهد اگر بیش از حد بسیاری از فایل های تطبیق الگوی لکه در وجود دارد `File` جدول یا `file` تابع جدول. در حال حاضر فایل ها باز تنبلی. این رفع [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- قطره جدول موقت در حال حاضر قطره تنها جدول موقت. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([ویتالی بارانو](https://github.com/vitlibar)) -- حذف پارتیشن منسوخ شده زمانی که ما خاموش کردن سرور و یا جدا / ضمیمه یک جدول. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- برای چگونه دیسک پیش فرض محاسبه فضای رایگان از `data` شاخه فرعی. ثابت موضوع زمانی که مقدار فضای رایگان به درستی محاسبه نمی شود اگر `data` دایرکتوری به یک دستگاه جداگانه (مورد نادر) نصب شده است. این رفع [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([میخیل کوروتف](https://github.com/millb)) -- اجازه کاما (صلیب) عضویت با در () داخل. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([زویکوف](https://github.com/4ertus2)) -- اجازه می دهد به بازنویسی صلیب به درونی ملحق اگر وجود دارد \[نه\] مانند اپراتور در جایی که بخش. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([زویکوف](https://github.com/4ertus2)) -- رفع نتیجه نادرست ممکن است پس از `GROUP BY` با تنظیم فعال `distributed_aggregation_memory_efficient`. رفع [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- کلید پیدا شده است به عنوان در معیارهای لغت نامه کش از دست رفته شمارش شد. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- رفع ناسازگاری پروتکل تکرار معرفی شده در [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([الساپین](https://github.com/alesapin)) -- شرایط مسابقه ثابت در `queue_task_handle` در هنگام راه اندازی `ReplicatedMergeTree` میز [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رمز `NOT` جواب نداد `SHOW TABLES NOT LIKE` پرسوجو [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن محدوده چک به تابع `h3EdgeLengthM`. بدون این چک, سرریز بافر امکان پذیر است. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال در محاسبات باریکش از عملیات منطقی سه تایی در استدلال های متعدد (بیش از 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([الکساندر کازاکوف](https://github.com/Akazz)) -- رفع خطای prewhere بهینه سازی است که می تواند منجر به segfaults یا `Inconsistent number of columns got from MergeTreeRangeReader` استثنا. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع غیر منتظره `Timeout exceeded while reading from socket` استثنا, که به طور تصادفی در اتصال امن اتفاق می افتد قبل از ایست در واقع بیش از حد و هنگامی که پیشفیلتر پرس و جو فعال است. همچنین اضافه کنید `connect_timeout_with_failover_secure_ms` تنظیمات (به طور پیش فرض 100 مگابایت), که شبیه به است `connect_timeout_with_failover_ms`, اما برای اتصالات امن استفاده می شود (به دلیل دست دادن اس اس ال کندتر است, از اتصال تی پی معمولی) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع اشکال با جهش نهایی, زمانی که جهش ممکن است در حالت قطع با `parts_to_do=0` و `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([الساپین](https://github.com/alesapin)) -- استفاده از جدید هر پیوستن به منطق با `partial_merge_join` تنظیمات. این ممکن است به `ANY|ALL|SEMI LEFT` و `ALL INNER` می پیوندد با `partial_merge_join=1` حالا [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([زویکوف](https://github.com/4ertus2)) -- سفال در حال حاضر بست تنظیمات کردم از مبتکر به مواضع سفال به جای پرتاب یک استثنا. این ثابت اجازه می دهد تا برای ارسال نمایش داده شد به یک سفال با محدودیت های دیگر. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([ویتالی بارانو](https://github.com/vitlibar)) -- مشکل مدیریت حافظه ثابت در `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- ثابت `toDecimal*OrNull()` توابع خانواده که با رشته به نام `e`. رفع [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([زویکوف](https://github.com/4ertus2)) -- اطمینان حاصل کنید که `FORMAT Null` هیچ اطلاعاتی را به مشتری ارسال نمی کند. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- رفع اشکال که برچسب زمان در `LiveViewBlockInputStream` به روز نمی. `LIVE VIEW` یکی از ویژگی های تجربی است. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([وکسیدر](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([وکسیدر](https://github.com/Vxider)) -- ثابت `ALTER MODIFY TTL` رفتار اشتباه است که اجازه نمی دهد به حذف عبارات قدیمی. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- گزارش ثابت اوبسان در ادغام. این رفع [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفتار را ثابت کرد `match` و `extract` توابع زمانی که کومه علف خشک است صفر بایت. رفتار اشتباه بود که کومه علف خشک ثابت بود. این رفع [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از پرتاب از تخریب کننده در کتابخانه ' 3-حزب خود نمایی. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([اندرو انیشچوک](https://github.com/oandrew)) -- هنوز یک دسته نظرسنجی از مرتکب نشده `Kafka` تا حدی که می تواند به سوراخ در داده ها منجر شود. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([فیلیمونف](https://github.com/filimonov)) -- ثابت `joinGet` با انواع بازگشت باطل. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([ایموس پرنده](https://github.com/amosbird)) -- رفع ناسازگاری داده ها در هنگام فشرده با `T64` وابسته به کدک. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([زویکوف](https://github.com/4ertus2)) رفع شناسه نوع داده در `T64` کدک فشرده سازی است که منجر به اشتباه (د) فشرده سازی در نسخه های تحت تاثیر قرار. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([زویکوف](https://github.com/4ertus2)) -- افزودن تنظیمات `enable_early_constant_folding` و در برخی موارد که منجر به خطا غیر فعال کنید. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([زویکوف](https://github.com/4ertus2)) -- رفع pushdown گزاره optimizer با مشاهده و فعال کردن آزمون [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([زمستان ژانگ](https://github.com/zhang2014)) -- رفع segfault در `Merge` جداول, که می تواند رخ دهد در هنگام خواندن از `File` ذخیره سازی [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([تاولوبیکس](https://github.com/tavplubix)) -- اضافه شدن یک چک برای سیاست ذخیره سازی در `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. در غیر این صورت می تواند داده ها از بخش غیر قابل دسترس پس از راه اندازی مجدد و جلوگیری از کلیک برای شروع. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اصلاح تغییر می دهد اگر برای جدول تنظیم شده است. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع شرایط مسابقه است که می تواند رخ دهد که `SYSTEM RELOAD ALL DICTIONARIES` اعدام در حالی که برخی از فرهنگ لغت است که اصلاح/اضافه/حذف شده است. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([ویتالی بارانو](https://github.com/vitlibar)) -- در نسخه های قبلی `Memory` موتور پایگاه داده استفاده از مسیر داده خالی, بنابراین جداول در ایجاد `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([تاولوبیکس](https://github.com/tavplubix)) -- ثابت پیام ورود به سیستم اشتباه در مورد از دست رفته دیسک به طور پیش فرض و یا سیاست. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- ثابت نیست (است ()) برای شاخص نفخ\_فیلتر از انواع مجموعه. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([ایشیمب](https://github.com/achimbab)) -- اجازه دادن ستون اول (ها) در یک جدول با `Log` موتور یک نام مستعار است [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([ایوان](https://github.com/abyss7)) -- رفع منظور از محدوده در حالی که خواندن از `MergeTree` جدول در یک موضوع. این می تواند به استثنا از منجر `MergeTreeRangeReader` یا نتایج پرس و جو اشتباه است. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([انتون پوپوف](https://github.com/CurtizJ)) -- ساخت `reinterpretAsFixedString` برای بازگشت `FixedString` به جای `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([اندرو انیشچوک](https://github.com/oandrew)) -- اجتناب از موارد بسیار نادر زمانی که کاربر می تواند پیغام خطا اشتباه دریافت کنید (`Success` به جای شرح خطا دقیق). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- هنگام استفاده از تصادف نکنید `Template` قالب با قالب ردیف خالی. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- فایل های ابرداده برای جداول سیستم را می توان در جای اشتباه ایجاد شده است [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([تاولوبیکس](https://github.com/tavplubix)) رفع [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). -- رفع مسابقه داده ها به استثنای در فرهنگ لغت کش [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- یک استثنا برای پرس و جو پرتاب نکنید `ATTACH TABLE IF NOT EXISTS`. پیش از این پرتاب شد اگر جدول در حال حاضر وجود دارد, با وجود `IF NOT EXISTS` بند بند. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([انتون پوپوف](https://github.com/CurtizJ)) -- ثابت بسته شدن از دست رفته پین در پیام استثنا. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از پیام `Possible deadlock avoided` در راه اندازی تاتر مشتری در حالت تعاملی. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت موضوع زمانی که بالشتک در پایان پایگاه64 ارزش کد گذاری را می توان ناقص. به روز رسانی پایگاه64 کتابخانه. این رفع [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491) بسته [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- جلوگیری از از دست دادن داده ها در `Kafka` در موارد نادر زمانی که استثنا اتفاق می افتد پس از خواندن پسوند اما قبل از ارتکاب. رفع [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([فیلیمونف](https://github.com/filimonov)) -- استثنا ثابت در `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([نیکیتا واسیلیف](https://github.com/nikvas0)) -- رفع سقوط زمانی که یک کاربر تلاش می کند `ALTER MODIFY SETTING` برای قدیمی شکل گرفته `MergeTree` موتورهای جدول خانواده. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([الساپین](https://github.com/alesapin)) -- پشتیبانی از uint64 اعداد است که مناسب نیست در int64 در json-توابع مربوط. به روز رسانی سیمدجسون به استاد. این رفع [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت اعدام inversed predicates که غیر به شدت monotinic عملکردی شاخص استفاده شده است. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([الکساندر کازاکوف](https://github.com/Akazz)) -- سعی نکنید به برابر `IN` ثابت در `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([ایموس پرنده](https://github.com/amosbird)) -- رفع اشکال در `ALTER DELETE` جهش که منجر به شاخص فساد. این رفع [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) و [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). علاوه بر این رفع شرایط مسابقه بسیار نادر در `ReplicatedMergeTree` `ALTER` نمایش داده شد. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([الساپین](https://github.com/alesapin)) -- هنگامی که تنظیمات `compile_expressions` فعال است, شما می توانید `unexpected column` داخل `LLVMExecutableFunction` هنگامی که ما با استفاده از `Nullable` نوع [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- رفع چندگانه برای `Kafka` موتور: 1) ثابت تکراری که در طول توازن گروه مصرف کننده ظاهر شد. 2) رفع نادر ‘holes’ به نظر می رسد زمانی که داده ها از چندین پارتیشن با یک نظرسنجی نظرسنجی نظرسنجی نظرسنجی شد و تا حدی متعهد (در حال حاضر ما همیشه پردازش / مرتکب کل نظرسنجی بلوک از پیام). 3) رفع حملات گرگرفتگی با اندازه بلوک (قبل از که تنها با فاصله گرگرفتگی به درستی کار می کرد). 4) روش اشتراک بهتر (با بازخورد انتساب). 5) را تست کار سریع تر (با فواصل پیش فرض و وقفه). با توجه به این واقعیت است که داده ها توسط اندازه بلوک قبل از سرخ نیست (همانطور که باید با توجه به اسناد و مدارک), که روابط عمومی ممکن است به برخی از تخریب عملکرد با تنظیمات پیش فرض منجر شود (با توجه به بیشتر & حملات گرگرفتگی قلع که کمتر بهینه هستند). اگر موضوع عملکرد شما روبرو می شوند که پس از تغییر - لطفا افزایش می دهد `kafka_max_block_size` در جدول به ارزش بزرگتر ( به عنوان مثال `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). رفع [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([فیلیمونف](https://github.com/filimonov)) -- ثابت `Parameter out of bound` استثنا در برخی از نمایش داده شد پس از بهینه سازی در همه جا. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) -- ثابت مورد مخلوط ثابت استدلال از تابع `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- هنگام اجرای `CREATE` پرس و جو, برابر عبارات ثابت در استدلال موتور ذخیره سازی. جایگزین کردن نام دادگان خالی با دادگان فعلی. رفع [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([تاولوبیکس](https://github.com/tavplubix)) -- در حال حاضر امکان ایجاد یا اضافه کردن ستون ها با نام مستعار چرخه ای ساده مانند وجود ندارد `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([الساپین](https://github.com/alesapin)) -- رفع اشکال با حرکت دو که ممکن است بخش اصلی فاسد است. این مربوط است اگر شما استفاده کنید `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اجازه داده شود `interval` شناسه به درستی تجزیه و تحلیل بدون پشت. موضوع ثابت زمانی که پرس و جو نمی تواند اجرا شود حتی اگر `interval` شناسه در پشت و یا به نقل از دو محصور. این رفع [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تست ریش ریش شدن ثابت و رفتار نادرست از `bitTestAll`/`bitTestAny` توابع. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع سقوط احتمالی / تعداد اشتباه ردیف در `LIMIT n WITH TIES` هنگامی که بسیاری از ردیف به نفر ردیف برابر وجود دارد. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع جهش با قطعات نوشته شده با فعال `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([الساپین](https://github.com/alesapin)) -- رفع مسابقه داده ها در نابودی `Poco::HTTPServer`. این می تواند رخ دهد زمانی که سرور شروع شده است و بلافاصله تعطیل. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع اشکال که در هنگام اجرای پیغام خطای گمراه کننده نشان داده شده است `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([اچولکوف2](https://github.com/achulkov2)) -- ثابت `Parameters are out of bound` استثنا در برخی موارد نادر زمانی که ما یک ثابت در `SELECT` بند زمانی که ما یک `ORDER BY` و یک `LIMIT` بند بند. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- رفع جهش نهایی, زمانی که در حال حاضر انجام جهش می تواند وضعیت را داشته باشد `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([الساپین](https://github.com/alesapin)) -- جلوگیری از اجرای `ALTER ADD INDEX` برای جداول ادغام با نحو قدیمی, چرا که کار نمی کند. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([میخیل کوروتف](https://github.com/millb)) -- در هنگام راه اندازی سرور جدول دسترسی پیدا کنید, که `LIVE VIEW` بستگی دارد, بنابراین سرور قادر به شروع خواهد بود. همچنین حذف `LIVE VIEW` وابستگی زمانی که جدا `LIVE VIEW`. `LIVE VIEW` یکی از ویژگی های تجربی است. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع اشکال احتمالی در `MergeTreeRangeReader`, در حالی که اجرای `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع چک عدم تطابق ممکن است با ستون. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع اشکال زمانی که قطعات شد که در پس زمینه با قوانین تغییر زمان در مورد نقل مکان کرد زمانی که تنها یک حجم وجود دارد. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- ثابت موضوع `Method createColumn() is not implemented for data type Set`. این رفع [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر ما سعی خواهد کرد نهایی جهش بیشتر. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([الساپین](https://github.com/alesapin)) -- ثابت `intDiv` توسط منهای یک ثابت [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([هکز](https://github.com/hczhcz)) -- رفع شرایط مسابقه ممکن است در `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع اشکال منجر به ختم سرور در هنگام تلاش برای استفاده / رها کردن `Kafka` جدول ایجاد شده با اشتباه پارامترهای. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([فیلیمونف](https://github.com/filimonov)) -- اضافه شده راه حل اگر سیستم عامل نتیجه اشتباه را برمی گرداند `timer_create` تابع. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خطای ثابت در استفاده از `min_marks_for_seek` پارامتر. ثابت پیام خطا زمانی که هیچ کلید شارژ در جدول توزیع وجود دارد و ما سعی می کنیم به جست و خیز خرده ریز استفاده نشده. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([ازات خوژین](https://github.com/azat)) - -#### بهبود {#improvement} - -- پیاده سازی `ALTER MODIFY/DROP` نمایش داده شد در بالای جهش برای `ReplicatedMergeTree*` خانواده موتور. حالا `ALTERS` بلوک تنها در مرحله به روز رسانی ابرداده, و بعد از که مسدود نمی. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([الساپین](https://github.com/alesapin)) -- اضافه کردن توانایی بازنویسی صلیب به درونی می پیوندد با `WHERE` بخش حاوی نام بدون تغییر. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([زویکوف](https://github.com/4ertus2)) -- ساخت `SHOW TABLES` و `SHOW DATABASES` نمایش داده شد حمایت از `WHERE` عبارات و `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([بستنی و مغز گردو](https://github.com/sundy-li)) -- اضافه شدن یک تنظیم `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([اوریخی](https://github.com/urykhy)) -- پس از تغییرات اخیر مشتری خروجی زیر شروع به چاپ رشته های باینری در سحر و جادو در نتیجه ساخت قابل خواندن نیست ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). راه حل در محل کلیک است به علامت ستون رشته به عنوان سخن گفتن-8, که همیشه نمی, اما معمولا مورد. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([یوری بارانوف](https://github.com/yurriy)) -- اضافه کردن پشتیبانی از رشته و کلید رشته برای `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) -- کلید های رشته پشتیبانی در نقشه های خلاصه [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) -- سیگنال ختم موضوع به استخر موضوع حتی اگر موضوع استثنا پرتاب کرده است [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) -- مجاز به تنظیم `query_id` داخل `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([انتون پوپوف](https://github.com/CurtizJ)) -- اجازه نمی دهد عبارات عجیب و غریب در `ALTER TABLE ... PARTITION partition` پرس و جو. این آدرس [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- جدول `system.table_engines` در حال حاضر اطلاعات در مورد پشتیبانی از ویژگی فراهم می کند (مانند `supports_ttl` یا `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([مکس اخمدوف](https://github.com/zlobober)) -- فعالسازی `system.metric_log` به طور پیش فرض. آن را شامل ردیف های با ارزش از ProfileEvents, CurrentMetrics جمع آوری شده با “collect\_interval\_milliseconds” فاصله (یک ثانیه به طور پیش فرض). جدول بسیار کوچک است (معمولا به ترتیب مگابایت) و جمع اوری این داده ها به طور پیش فرض معقول است. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([ایوان](https://github.com/abyss7)) -- در حال حاضر موقت `LIVE VIEW` ایجاد شده توسط `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` به جای `CREATE TEMPORARY LIVE VIEW ...`, چرا که نحو قبلی بود سازگار با نیست `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([تاولوبیکس](https://github.com/tavplubix)) -- اضافه کردن \_خروج.پارامتر پیکربندی سطح برای محدود کردن ورودی که می رود به `system.text_log` جدول [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([ازات خوژین](https://github.com/azat)) -- اجازه می دهد برای قرار دادن بخش دانلود شده به دیسک/حجم با توجه به قوانین تی ال [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- برای لغت نامه خروجی زیر خارجی, اجازه می دهد برای تغییر دادن خروجی زیر استخر اتصال به “share” در میان واژهنامهها. این گزینه به طور قابل توجهی تعداد اتصالات به سرور خروجی زیر را کاهش می دهد. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- نمایش نزدیکترین زمان اجرای پرس و جو برای کوانتوم در `clickhouse-benchmark` خروجی به جای مقادیر درونیابی. بهتر است برای نشان دادن ارزش هایی که مربوط به زمان اجرای برخی از نمایش داده شد. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- امکان اضافه کردن کلید و زمان بندی برای پیام هنگام قرار دادن داده ها به کافکا. رفع [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([فیلیمونف](https://github.com/filimonov)) -- اگر سرور از ترمینال اجرا, تعداد موضوع برجسته, شناسه پرس و جو و اولویت ورود به سیستم با رنگ. این است که برای خوانایی بهبود یافته از پیام ورود به سیستم در ارتباط برای توسعه دهندگان. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پیام استثنا بهتر در حالی که بارگذاری جداول برای `Ordinary` پایگاه داده است. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پیاده سازی `arraySlice` برای ارریس با عملکرد کل ایالات. این رفع [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجازه می دهد توابع ثابت و مجموعه های ثابت در سمت راست در اپراتور استفاده می شود. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([انتون پوپوف](https://github.com/CurtizJ)) -- اگر استثنا باغ وحش اتفاق افتاده است در حالی که واکشی داده ها برای سیستم.تکرار, نمایش در یک ستون جداگانه. این پیاده سازی [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بطور عام حذف قطعات داده ادغام در نابود کردن. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([ولادیمیر چبوتراف](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)) -- جلوگیری از حافظه در حالی که ساخت نتیجه یک بزرگ بپیوندید. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([زویکوف](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)) -- ستون اضافه شده `exception_code` داخل `system.query_log` جدول [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([میخیل کوروتف](https://github.com/millb)) -- فعال خروجی زیر سرور سازگاری در بندر `9004` در فایل پیکربندی سرور به طور پیش فرض. دستور تولید رمز عبور ثابت در مثال در پیکربندی. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([یوری بارانوف](https://github.com/yurriy)) -- جلوگیری از سقط جنین در خاموش کردن اگر سیستم فایل به صورت خوانده است. این رفع [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پیام استثنا بهتر زمانی که طول در قام پست پرس و جو مورد نیاز است. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- افزودن `_path` و `_file` ستون مجازی به `HDFS` و `File` موتور و `hdfs` و `file` توابع جدول [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- رفع خطا `Cannot find column` در حالی که قرار دادن به `MATERIALIZED VIEW` در صورتی که اگر ستون جدید برای مشاهده جدول داخلی اضافه شد. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع پیشرفت بیش از پروتکل کلاینت سرور بومی, با ارسال پیشرفت پس از به روز رسانی نهایی (مانند سیاهههای مربوط). این ممکن است تنها مربوط به برخی از ابزار های شخص ثالث که با استفاده از پروتکل های بومی. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([ازات خوژین](https://github.com/azat)) -- اضافه کردن یک سیستم متریک ردیابی تعداد اتصالات مشتری با استفاده از پروتکل خروجی زیر ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([یوجین کلیموف](https://github.com/Slach)) -- از این به بعد پاسخ های اچ تی پی `X-ClickHouse-Timezone` هدر را به مقدار منطقه زمانی همان است که `SELECT timezone()` دوست گزارش. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([دنیس گلازاشف](https://github.com/traceon)) - -#### بهبود عملکرد {#performance-improvement} - -- بهبود عملکرد شاخص تجزیه و تحلیل با در [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([انتون پوپوف](https://github.com/CurtizJ)) -- کد ساده تر و موثر تر در توابع منطقی + پاکسازی کد. پیگیری به [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([الکساندر کازاکوف](https://github.com/Akazz)) -- بهبود عملکرد کلی (در محدوده 5%..200% برای نمایش داده شد تحت تاثیر قرار) با تضمین و حتی بایاس سخت تر با ج++20 ویژگی های. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([ایموس پرنده](https://github.com/amosbird)) -- مقایسه دقیق تر برای حلقه های داخلی توابع مقایسه. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بایاس سخت تر برای حلقه داخلی از توابع ریاضی. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- A ~3 بار سریع تر برای اجرای ColumnVector::تکرار () از طریق آن ColumnConst::convertToFullColumn() اجرا شده است. همچنین در تست مفید خواهد بود که تحقق ثابت. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([الکساندر کازاکوف](https://github.com/Akazz)) -- یکی دیگر از بهبود عملکرد کوچک به `ColumnVector::replicate()` (این سرعت `materialize` عملکرد و توابع سفارش بالاتر) بهبود و حتی بیشتر به [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([الکساندر کازاکوف](https://github.com/Akazz)) -- بهبود عملکرد `stochasticLinearRegression` تابع جمع. این پچ توسط اینتل کمک. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهبود عملکرد `reinterpretAsFixedString` تابع. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بلوک ها را به مشتری ارسال نکنید `Null` فرمت در پردازنده خط لوله. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([الکساندر کوزمنکوف](https://github.com/akuzm)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement} - -- سیستم های انتقال مواد استثنا در حال حاضر به درستی کار می کند در زیر سیستم ویندوز برای لینوکس. ببینید https://github.com/clickhouse-extras/libunwind/pull/3 این رفع [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([سوبولسو](https://github.com/sobolevsv)) -- جایگزینی `readline` با `replxx` برای ویرایش خط تعاملی در `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([ایوان](https://github.com/abyss7)) -- بهتر است زمان ساخت و کمتر در قالب instantiations در functionscomparison. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ادغام اضافه شده با `clang-tidy` در سی. همچنین نگاه کنید به [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر ما لینک کلیک در سی با استفاده از `lld` حتی برای `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([الساپین](https://github.com/alesapin)) -- اجازه می دهد به صورت تصادفی برنامه ریزی موضوع و درج اشکالات زمانی که `THREAD_FUZZER_*` متغیرهای محیطی تنظیم شده است. این کمک می کند تا تست. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- فعال کردن سوکت امن در تست بدون تابعیت [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([تاولوبیکس](https://github.com/tavplubix)) -- را split\_shared\_libraries=خاموش قوی تر [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([ازات خوژین](https://github.com/azat)) -- ساخت “performance\_introspection\_and\_logging” تست قابل اعتماد به سرور تصادفی گیر کرده است. این ممکن است در محیط زیست سی اتفاق می افتد. همچنین نگاه کنید به [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اعتبار میلی لیتر در چک سبک. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شرایط مسابقه ثابت در تست `00738_lock_for_inner_table`. این تست به خواب متکی بود. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تست عملکرد نوع را حذف کنید `once`. این مورد نیاز است برای اجرای تمام تست های عملکرد در حالت مقایسه استاتیک (قابل اعتماد تر). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده تست عملکرد برای توابع ریاضی. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تست عملکرد اضافه شده برای `sumMap` و `sumMapWithOverflow` توابع مجموع. پیگیری برای [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اطمینان از سبک کد های خطا با چک سبک. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن اسکریپت برای تست تاریخ. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([الساپین](https://github.com/alesapin)) -- افزودن هشدار شورای همکاری خلیج فارس `-Wsuggest-override` برای قرار دادن و رفع تمام مکان هایی که `override` کلمه کلیدی باید استفاده شود. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([کروزرکریگ](https://github.com/kreuzerkrieg)) -- نادیده گرفتن نماد ضعیف تحت سیستم عامل مک ایکس زیرا باید تعریف شود [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([کاربر حذفشده](https://github.com/ghost)) -- عادی زمان در حال اجرا از برخی از نمایش داده شد در تست عملکرد. این است که در تهیه برای اجرای تمام تست های عملکرد در حالت مقایسه انجام می شود. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع برخی از تست ها برای حمایت از تست های پرس و جو [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([ایوان](https://github.com/abyss7)) -- فعال کردن اس اس ال در ساخت با ام اس ان, بنابراین سرور نمی خواهد شکست در هنگام راه اندازی در حال اجرا تست بدون تابعیت [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع جایگزینی پایگاه داده در نتایج تست [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([ایلیا یاتسیشین](https://github.com/qoega)) -- ساخت رفع برای سیستم عامل های دیگر [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([پرولر](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([پرولر](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([پرولر](https://github.com/proller)) -- اضافه شدن بخش دیسک به بدون تابعیت با پوشش تصویر داکر تست [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([پاول کووالنکو](https://github.com/Jokser)) -- خلاص شدن از شر در منبع درخت فایل در هنگام ساخت با پتروشیمی [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([ایموس پرنده](https://github.com/amosbird)) -- زمان ساخت کمی سریع تر با از بین بردن تجزیه طلبان از زمینه. کد را ساده تر کنید. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز شده در چک کردن برای نمایش داده شد را قطع کرد در اسکریپت کلیک تست [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([الکساندر کازاکوف](https://github.com/Akazz)) -- حذف برخی از فایل های بی فایده از مخزن. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نوع تغییر کامل ریاضی از `once` به `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اضافه کردن تصویر کارگر بارانداز که اجازه می دهد تا برای ساخت کد تعاملی مرورگر گزارش متنی برای کدهای ما. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([الساپین](https://github.com/alesapin)) ببینید [مرورگر کد ووبوک](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) -- سرکوب برخی از شکست تست تحت مسان. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- افزایش سرعت “exception while insert” امتحان این تست اغلب زمان در اشکال زدایی با پوشش ساخت. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز شده `libcxx` و `libcxxabi` به سلامتی استاد در تهیه به [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع تست پوسته شدن `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- پاک کردن پرچم لینکر تکرار. اطمینان حاصل کنید که لینکر نمی خواهد نگاه کردن یک نماد غیر منتظره. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([ایموس پرنده](https://github.com/amosbird)) -- افزودن `clickhouse-odbc` درایور را به تصاویر تست. این اجازه می دهد تا به تست تعامل ClickHouse با ClickHouse از طریق خود ODBC driver. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([فیلیمونف](https://github.com/filimonov)) -- رفع چندین باگ در تست واحد. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([الساپین](https://github.com/alesapin)) -- فعالسازی `-Wmissing-include-dirs` هشدار شورای همکاری خلیج فارس برای از بین بردن تمام غیر موجود شامل-عمدتا به عنوان یک نتیجه از خطاهای برنامه نویسی کیک [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([کروزرکریگ](https://github.com/kreuzerkrieg)) -- توصیف دلایل اگر پیشفیلتر پرس و جو نمی تواند کار کند. این است که برای در نظر گرفته شده [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز رسانی اپنسسل به بالادست استاد. ثابت موضوع زمانی که اتصالات ال اس ممکن است با پیام شکست `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` و `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. این موضوع در حال حاضر در نسخه 20.1 بود. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز رسانی صفحه مدیریت برای سرور [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([ایلیا مزایف](https://github.com/ne-ray)) -- اصلاحات جزیی در ساخت شورای همکاری خلیج فارس از منابع اسکریپت [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([مایکل ناچاروف](https://github.com/mnach)) -- جایگزینی `numbers` به `zeros` در کامل کجا `number` ستون استفاده نمی شود. این به نتایج تست تمیز تر منجر شود. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع مشکل سرریز پشته در هنگام استفاده از مقدار دهی اولیه در سازنده ستون. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([کاربر حذفشده](https://github.com/ghost)) -- ارتقا کتابدار به نسخه 1. 3.0. فعالسازی همراه `rdkafka` و `gsasl` کتابخانه ها در سیستم عامل مک ایکس. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([اندرو انیشچوک](https://github.com/oandrew)) -- ساخت ثابت در شورای همکاری خلیج فارس 9.2.0 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([وکسیدر](https://github.com/Vxider)) - -## انتشار کلیک و 20.1 {#clickhouse-release-v20-1} - -### ClickHouse انتشار v20.1.8.41, 2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} - -#### رفع اشکال {#bug-fix-3} - -- رفع همیشگی احتمالی `Cannot schedule a task` خطا (با توجه به استثنای بدون مانع در `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). این رفع [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([ازات خوژین](https://github.com/azat)) -- رفع مصرف حافظه بیش از حد در `ALTER` نمایش داده شد (جهش). این رفع [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) و [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([الساپین](https://github.com/alesapin)) -- رفع اشکال در عقب نشینی در لغت نامه های خارجی. این رفع [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([الساپین](https://github.com/alesapin)) - -### ClickHouse انتشار v20.1.7.38, 2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} - -#### رفع اشکال {#bug-fix-4} - -- ثابت نادرست نام تابع داخلی برای `sumKahan` و `sumWithOverflow`. من به استثنا منجر شود در حالی که با استفاده از این توابع در نمایش داده شد از راه دور. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([ازات خوژین](https://github.com/azat)). این موضوع در تمام نسخه های کلیک خانه بود. -- اجازه داده شود `ALTER ON CLUSTER` از `Distributed` جداول با تکرار داخلی. این رفع [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([شینی2](https://github.com/shinoi2)). این موضوع در تمام نسخه های کلیک خانه بود. -- رفع استثناهای احتمالی `Size of filter doesn't match size of column` و `Invalid number of rows in Chunk` داخل `MergeTreeRangeReader`. می توانند هنگام اجرای ظاهر شوند `PREWHERE` در برخی موارد. رفع [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([انتون پوپوف](https://github.com/CurtizJ)) -- ثابت موضوع: منطقه زمانی حفظ نشده بود اگر شما نوشتن یک عبارت ریاضی ساده مانند `time + 1` (در مقایسه با بیان مانند `time + INTERVAL 1 SECOND`). این رفع [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([الکسی میلویدو](https://github.com/alexey-milovidov)). این موضوع در تمام نسخه های کلیک خانه بود. -- در حال حاضر امکان ایجاد یا اضافه کردن ستون ها با نام مستعار چرخه ای ساده مانند وجود ندارد `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([الساپین](https://github.com/alesapin)) -- ثابت موضوع که بالشتک در پایان base64 کد گذاری ارزش می تواند ناقص. به روز رسانی پایگاه64 کتابخانه. این رفع [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491) بسته [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع مسابقه داده ها در نابودی `Poco::HTTPServer`. این می تواند رخ دهد زمانی که سرور شروع شده است و بلافاصله تعطیل. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع سقوط احتمالی / تعداد اشتباه ردیف در `LIMIT n WITH TIES` هنگامی که بسیاری از ردیف به نفر ردیف برابر وجود دارد. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع چک عدم تطابق ممکن است با ستون. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([انتون پوپوف](https://github.com/CurtizJ)) -- رفع سقوط زمانی که یک کاربر تلاش می کند `ALTER MODIFY SETTING` برای قدیمی شکل گرفته `MergeTree` موتورهای جدول خانواده. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([الساپین](https://github.com/alesapin)) -- در حال حاضر ما سعی خواهد کرد نهایی جهش بیشتر. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([الساپین](https://github.com/alesapin)) -- رفع ناسازگاری پروتکل تکرار معرفی شده در [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([الساپین](https://github.com/alesapin)) -- ثابت نیست (است ()) برای شاخص نفخ\_فیلتر از انواع مجموعه. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([ایشیمب](https://github.com/achimbab)) -- رفتار را ثابت کرد `match` و `extract` توابع زمانی که کومه علف خشک است صفر بایت. رفتار اشتباه بود که کومه علف خشک ثابت بود. این رفع [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([الکسی میلویدو](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-1} - -- سیستم های انتقال مواد استثنا در حال حاضر به درستی کار می کند در زیر سیستم ویندوز برای لینوکس. ببینید https://github.com/clickhouse-extras/libunwind/pull/3 این رفع [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([سوبولسو](https://github.com/sobolevsv)) - -### ClickHouse انتشار v20.1.6.30, 2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} - -#### رفع اشکال {#bug-fix-5} - -- رفع ناسازگاری داده ها در هنگام فشرده با `T64` وابسته به کدک. - [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(بی پایان 7)](https://github.com/abyss7) -- ثابت منظور از محدوده در حالی که خواندن از جدول ادغام در یک موضوع. رفع [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). - [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(کورتیزج)](https://github.com/CurtizJ) -- رفع اشکال احتمالی در `MergeTreeRangeReader`, در حالی که اجرای `PREWHERE`. رفع [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). - [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(کورتیزج)](https://github.com/CurtizJ) -- ثابت `reinterpretAsFixedString` برای بازگشت `FixedString` به جای `String`. - [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(اوندرو)](https://github.com/oandrew) -- ثابت `joinGet` با انواع بازگشت باطل. رفع [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) - [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(طرقه)](https://github.com/amosbird) -- تعمیر ریش ریش شدن آزمون و نادرست رفتار bittestall/bittestany توابع. - [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(الکسی میلویدو)](https://github.com/alexey-milovidov) -- رفع رفتار توابع بازی و استخراج زمانی که انبار کاه است صفر بایت. رفتار اشتباه بود که کومه علف خشک ثابت بود. رفع [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) - [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(الکسی میلویدو)](https://github.com/alexey-milovidov) -- ثابت اعدام inversed predicates که غیر به شدت monotinic عملکردی شاخص استفاده شده است. رفع [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) - [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(اکازز)](https://github.com/Akazz) -- اجازه به بازنویسی `CROSS` به `INNER JOIN` اگر وجود دارد `[NOT] LIKE` اپراتور در `WHERE` بخش. رفع [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) - [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4رتوس2)](https://github.com/4ertus2) -- اجازه ستون اول (بازدید کنندگان) در یک جدول با موتور ورود به سیستم یک نام مستعار. - [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(بی پایان 7)](https://github.com/abyss7) -- اجازه دادن به کاما از هم پیوستن با `IN()` داخل رفع [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). - [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4رتوس2)](https://github.com/4ertus2) -- بهبود `ALTER MODIFY/ADD` نمایش داده شد منطق. حالا شما نمی توانید `ADD` ستون بدون نوع, `MODIFY` عبارت پیش فرض نوع ستون را تغییر نمی دهد و `MODIFY` نوع ارزش بیان پیش فرض را از دست نمی دهد. رفع [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). - [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(الساپین)](https://github.com/alesapin) -- رفع جهش نهایی, زمانی که جهش در حال حاضر انجام می شود می توانید وضعیت داشته باشد \_دون=0. - [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(الساپین)](https://github.com/alesapin) -- پشتیبانی “Processors” خط لوله برای سیستم.اعداد و سیستم.\_شماره. این نیز رفع اشکال زمانی که `max_execution_time` محترم نیست. - [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [.)](https://github.com/KochetovNicolai) -- رفع شمارش اشتباه از `DictCacheKeysRequestedFound` متریک. - [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(نیکیتامیخایلو)](https://github.com/nikitamikhaylov) -- اضافه شدن یک چک برای سیاست ذخیره سازی در `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` که در غیر این صورت می تواند داده ها از بخش غیر قابل دسترس پس از راه اندازی مجدد و جلوگیری از کلیک برای شروع. - [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(هیجان)](https://github.com/excitoon) -- گزارش ثابت اوبسان در `MergeTreeIndexSet`. این رفع [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) - [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(الکسی میلویدو)](https://github.com/alexey-milovidov) -- رفع فضای داده ممکن در بلوکیو. - [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [.)](https://github.com/KochetovNicolai) -- پشتیبانی از `UInt64` اعداد است که متناسب نیست در درون64 در توابع مربوط به جانسون. بهروزرسانی `SIMDJSON` به سلامتی استاد این رفع [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) - [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(الکسی میلویدو)](https://github.com/alexey-milovidov) -- رفع مشکل زمانی که مقدار فضای رایگان به درستی محاسبه نمی شود اگر دایرکتوری داده ها به یک دستگاه جداگانه نصب شود. برای دیسک پیش فرض محاسبه فضای رایگان از دایرکتوری فرعی داده ها. این رفع [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) - [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(میلب)](https://github.com/millb) -- رفع مشکل زمانی که اتصالات ال اس ممکن است با پیام شکست `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` به روز رسانی اپنسسل به بالادست استاد. - [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(الکسی میلویدو)](https://github.com/alexey-milovidov) -- هنگام اجرای `CREATE` پرس و جو, برابر عبارات ثابت در استدلال موتور ذخیره سازی. جایگزین کردن نام دادگان خالی با دادگان فعلی. رفع [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). همچنین رفع بررسی برای نشانی های محلی در کلیک کنیدشاهارزش. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(تبلوبیکس)](https://github.com/tavplubix) -- رفع segfault در `StorageMerge`, که می تواند در هنگام خواندن از داستان اتفاق می افتد. - [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(تبلوبیکس)](https://github.com/tavplubix) -- جلوگیری از از دست دادن داده ها در `Kafka` در موارد نادر زمانی که استثنا اتفاق می افتد پس از خواندن پسوند اما قبل از ارتکاب. رفع [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). مرتبط: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(فیلیمونف)](https://github.com/filimonov) -- رفع اشکال منجر به ختم سرور در هنگام تلاش برای استفاده / رها کردن `Kafka` جدول ایجاد شده با پارامترهای اشتباه. رفع [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). دارای [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(فیلیمونف)](https://github.com/filimonov) - -#### ویژگی جدید {#new-feature-1} - -- افزودن `deduplicate_blocks_in_dependent_materialized_views` گزینه ای برای کنترل رفتار درج ژولیده به جداول با نمایش محقق. این ویژگی جدید توسط یک درخواست ویژه از التیت به نسخه رفع اشکال اضافه شد. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [.)](https://github.com/urykhy) - -### ClickHouse انتشار v20.1.2.4, 2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} - -#### تغییر ناسازگار به عقب {#backward-incompatible-change-1} - -- ایجاد تنظیمات `merge_tree_uniform_read_distribution` منسوخ شده. سرور هنوز این تنظیم به رسمیت می شناسد اما هیچ اثر. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- نوع بازگشت تغییر از تابع `greatCircleDistance` به `Float32` چرا که در حال حاضر نتیجه محاسبه است `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر انتظار می رود که پارامترهای پرس و جو در “escaped” قالب. مثلا, به تصویب رشته `ab` شما باید برای نوشتن `a\tb` یا `a\b` و به ترتیب, `a%5Ctb` یا `a%5C%09b` در URL. این مورد نیاز است برای اضافه کردن امکان به تصویب تهی به عنوان `\N`. این رفع [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- فعالسازی `use_minimalistic_part_header_in_zookeeper` تنظیم برای `ReplicatedMergeTree` به طور پیش فرض. این به طور قابل توجهی مقدار داده های ذخیره شده در باغ وحش را کاهش دهد. این تنظیم از نسخه 19.1 پشتیبانی می شود و ما در حال حاضر در تولید خدمات متعدد بدون هیچ مشکلی برای بیش از نیم سال استفاده می کنیم. غیر فعال کردن این تنظیم اگر شما یک فرصت برای جمع و جور کردن به نسخه های قدیمی تر از 19.1. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شاخص های پرش داده ها تولید می شوند و به طور پیش فرض فعال می شوند. تنظیمات `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` و `allow_experimental_multiple_joins_emulation` در حال حاضر منسوخ و هیچ چیز. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- افزودن جدید `ANY JOIN` منطق برای `StorageJoin` سازگار با `JOIN` عمل به روز رسانی بدون تغییر در رفتار شما نیاز به اضافه کردن `SETTINGS any_join_distinct_right_table_keys = 1` به موتور پیوستن ابرداده جداول و یا از نو خلق این جداول پس از ارتقا دهید. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([زویکوف](https://github.com/4ertus2)) -- نیاز به سرور برای راه اندازی مجدد برای اعمال تغییرات در پیکربندی ورود به سیستم. این یک راه حل موقت برای جلوگیری از اشکال که سرور سیاهههای مربوط به یک فایل ورود به سیستم حذف شده است (دیدن [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([الکساندر کوزمنکوف](https://github.com/akuzm)) - -#### ویژگی جدید {#new-feature-2} - -- اطلاعات اضافه شده در مورد مسیرهای بخشی به `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- افزودن قابلیت اجرا `SYSTEM RELOAD DICTIONARY` پرسوجو در `ON CLUSTER` حالت. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) -- افزودن قابلیت اجرا `CREATE DICTIONARY` نمایش داده شد در `ON CLUSTER` حالت. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([الساپین](https://github.com/alesapin)) -- در حال حاضر مشخصات کاربر در `users.xml` می توانید پروفایل های متعدد به ارث می برند. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- اضافه شده `system.stack_trace` جدول که اجازه می دهد تا در اثری پشته از تمام موضوعات سرور نگاه. این برای توسعه دهندگان به درون نگری دولت سرور مفید است. این رفع [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- افزودن `DateTime64` نوع داده با دقت زیر دوم قابل تنظیم. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([واسیلی نمکو](https://github.com/Enmk)) -- اضافه کردن تابع جدول `clusterAllReplicas` که اجازه می دهد به پرس و جو تمام گره در خوشه. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([کیران سونکری](https://github.com/kiransunkari)) -- اضافه کردن تابع جمع `categoricalInformationValue` که محاسبه ارزش اطلاعات از ویژگی های گسسته. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([هکز](https://github.com/hczhcz)) -- سرعت تجزیه فایل های داده در `CSV`, `TSV` و `JSONEachRow` قالب با انجام این کار به صورت موازی. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- افزودن تابع `bankerRound` که انجام گرد بانکدار. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([هکز](https://github.com/hczhcz)) -- پشتیبانی از زبان های بیشتر در فرهنگ لغت تعبیه شده برای نام منطقه: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهبود در سازگاری `ANY JOIN` منطق. حالا `t1 ANY LEFT JOIN t2` برابر `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([زویکوف](https://github.com/4ertus2)) -- افزودن تنظیمات `any_join_distinct_right_table_keys` که رفتار قدیمی را قادر می سازد `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([زویکوف](https://github.com/4ertus2)) -- افزودن جدید `SEMI` و `ANTI JOIN`. قدیمی `ANY INNER JOIN` رفتار در حال حاضر به عنوان در دسترس `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([زویکوف](https://github.com/4ertus2)) -- اضافه شده `Distributed` قالب برای `File` موتور و `file` تابع جدول که اجازه می دهد تا از خواندن `.bin` فایل های تولید شده توسط درج ناهمزمان به `Distributed` جدول [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اضافه کردن استدلال ستون تنظیم مجدد اختیاری برای `runningAccumulate` که اجازه می دهد برای تنظیم مجدد نتایج تجمع برای هر مقدار کلید جدید. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([سرگی کنوننکو](https://github.com/kononencheg)) -- اضافه کردن توانایی استفاده از فاحشه خانه به عنوان نقطه پایانی پرومته. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([ولادیمیر](https://github.com/Vdimir)) -- اضافه کردن بخش `` داخل `config.xml` که میزبان مجاز برای موتورهای جدول از راه دور و توابع جدول را محدود می کند `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([میخیل کوروتف](https://github.com/millb)) -- اضافه شدن تابع `greatCircleAngle` که محاسبه فاصله در یک کره در درجه. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- شعاع زمین تغییر می شود سازگار با ساعت3 کتابخانه. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شده `JSONCompactEachRow` و `JSONCompactEachRowWithNamesAndTypes` فرمت برای ورودی و خروجی. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([میخیل کوروتف](https://github.com/millb)) -- ویژگی اضافه شده برای موتورهای جدول مربوط به فایل و توابع جدول (`File`, `S3`, `URL`, `HDFS`) که اجازه می دهد به خواندن و نوشتن `gzip` فایل ها بر اساس پارامتر موتور اضافی و یا فرمت فایل. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([هشدار داده می شود](https://github.com/apbodrov)) -- اضافه شدن `randomASCII(length)` تابع, تولید یک رشته با یک مجموعه تصادفی از [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) شخصیت های قابل چاپ. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([سرنیزه](https://github.com/BayoNet)) -- اضافه شدن تابع `JSONExtractArrayRaw` که مجموعه ای از عناصر مجموعه ای از جیسون نامحدود را باز می کند `JSON` رشته. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([اولگ متررخین](https://github.com/errx)) -- افزودن `arrayZip` تابع است که اجازه می دهد تا به ترکیب مجموعه ای از چند بند از طول برابر به یک مجموعه ای از تاپل. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([زمستان ژانگ](https://github.com/zhang2014)) -- اضافه کردن توانایی انتقال داده ها بین دیسک ها با توجه به پیکربندی `TTL`- عبارات برای `*MergeTree` موتورهای جدول خانواده. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اضافه شدن تابع جمع جدید `avgWeighted` که اجازه می دهد برای محاسبه میانگین وزن. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([هشدار داده می شود](https://github.com/apbodrov)) -- در حال حاضر تجزیه موازی به طور پیش فرض برای فعال `TSV`, `TSKV`, `CSV` و `JSONEachRow` فرمتها. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- اضافه کردن چندین توابع جغرافیایی از `H3` کتابخانه: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` و `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([کنستانتین مالانچو](https://github.com/hombit)) -- اضافه شدن پشتیبانی برای برتلی (`br`) فشرده سازی در ذخیره سازی مربوط به فایل و توابع جدول . این رفع [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- افزودن `groupBit*` توابع برای `SimpleAggregationFunction` نوع. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([کارخانه شراب سازی گیوم](https://github.com/YiuRULE)) - -#### رفع اشکال {#bug-fix-6} - -- رفع تغییر نام جداول با `Distributed` موتور رفع مشکل [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([تاولوبیکس](https://github.com/tavplubix)) -- در حال حاضر پشتیبانی لغت نامه `EXPRESSION` برای ویژگی های در رشته دلخواه در گویش غیر کلیک میدان. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([الساپین](https://github.com/alesapin)) -- رفع شکسته `INSERT SELECT FROM mysql(...)` پرس و جو. این رفع [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) و [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع خطا “Mismatch column sizes” هنگام وارد کردن پیشفرض `Tuple` از `JSONEachRow`. این رفع [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([تاولوبیکس](https://github.com/tavplubix)) -- در حال حاضر یک استثنا خواهد شد در صورت استفاده از پرتاب `WITH TIES` در کنار `LIMIT BY`. همچنین توانایی استفاده را اضافه کنید `TOP` با `LIMIT BY`. این رفع [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- رفع unintendent وابستگی از تازه glibc نسخه در `clickhouse-odbc-bridge` دودویی. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([ایموس پرنده](https://github.com/amosbird)) -- رفع اشکال در بررسی عملکرد `*MergeTree` خانواده موتور. در حال حاضر در صورتی که زمانی که ما مقدار مساوی از ردیف در گرانول گذشته و علامت گذشته (غیر نهایی) شکست نیست. [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([الساپین](https://github.com/alesapin)) -- رفع درج در `Enum*` ستون پس از `ALTER` پرس و جو, زمانی که زمینه ای نوع عددی به جدول نوع مشخص برابر است. این رفع [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([انتون پوپوف](https://github.com/CurtizJ)) -- مجاز منفی غیر ثابت “size” استدلال برای عملکرد `substring`. این اشتباه مجاز نیست. این رفع [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال تجزیه زمانی که تعداد اشتباه استدلال به تصویب رسید `(O|J)DBC` موتور جدول. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([الساپین](https://github.com/alesapin)) -- با استفاده از نام فرمان از روند در حال اجرا خانه کلیک در هنگام ارسال سیاهههای مربوط به سیسلوگ. در نسخه های قبلی, رشته خالی به جای نام فرمان مورد استفاده قرار گرفت. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([مایکل ناچاروف](https://github.com/mnach)) -- رفع چک میزبان مجاز برای `localhost`. این روابط عمومی رفع راه حل در [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع سقوط نادر در `argMin` و `argMax` توابع برای استدلال رشته طولانی, زمانی که نتیجه در استفاده `runningAccumulate` تابع. این رفع [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([دایناسور](https://github.com/769344359)) -- رفع بیش از حد حافظه برای جداول با `Buffer` موتور [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([ازات خوژین](https://github.com/azat)) -- اشکال بالقوه ثابت در توابع است که می تواند `NULL` به عنوان یکی از استدلال و بازگشت غیر تهی. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- معیارهای محاسبات بهتر در استخر موضوع برای فرایندهای پس زمینه برای `MergeTree` موتورهای جدول. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- تابع ثابت `IN` داخل `WHERE` بیانیه ای که در سطح ردیف فیلتر جدول وجود دارد. رفع [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([ایوان](https://github.com/abyss7)) -- در حال حاضر یک استثنا پرتاب می شود اگر ارزش جدایی ناپذیر است به طور کامل برای مقادیر تنظیمات تجزیه نشده است. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([میخیل کوروتف](https://github.com/millb)) -- رفع استثنا زمانی که عملکرد دانه ها در پرس و جو به جدول توزیع شده با بیش از دو خرده ریز محلی استفاده می شود. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- در حال حاضر فیلتر بلوم می توانید طول صفر عرایز رسیدگی می کند و محاسبات کار برکنار شده انجام نمی دهد. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([ایشیمب](https://github.com/achimbab)) -- چک کردن ثابت اگر یک میزبان مشتری با تطبیق میزبان مشتری به اجازه `host_regexp` مشخص شده در `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([ویتالی بارانو](https://github.com/vitlibar)) -- استراحت چک ستون مبهم است که منجر به مثبت کاذب در چند `JOIN ON` بخش. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([زویکوف](https://github.com/4ertus2)) -- ثابت سقوط سرور ممکن است (`std::terminate`) هنگامی که سرور نمی تواند ارسال و یا نوشتن داده ها در `JSON` یا `XML` قالب با مقادیر `String` نوع داده (که نیاز به `UTF-8` اعتبار سنجی) و یا زمانی که فشرده سازی داده های نتیجه با الگوریتم برتلی و یا در برخی موارد نادر دیگر. این رفع [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع شرایط مسابقه در `StorageDistributedDirectoryMonitor` پیدا شده توسط سی. این رفع [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- در حال حاضر پس زمینه ادغام در `*MergeTree` جدول موتورهای خانواده حفظ سیاست ذخیره سازی حجم سفارش دقیق تر است. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- در حال حاضر موتور جدول `Kafka` به درستی کار می کند با `Native` قالب. این رفع [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([فیلیمونف](https://github.com/filimonov)) -- فرمت های ثابت با هدر (مانند `CSVWithNames`) که پرتاب شد استثنا در مورد ایف برای موتور جدول `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([فیلیمونف](https://github.com/filimonov)) -- رفع اشکال با ساخت مجموعه ای از زیرخاکری در قسمت سمت راست از `IN` بخش. این رفع [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) و [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- رفع سقوط احتمالی در هنگام خواندن از ذخیره سازی `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- خواندن ثابت از فایل ها در `Parquet` قالب حاوی ستونهای نوع `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([مکسولان](https://github.com/maxulan)) -- رفع خطا `Not found column` برای نمایش داده شد توزیع با `PREWHERE` شرایط وابسته به کلید نمونه برداری اگر `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع خطا `Not found column` اگر پرسوجو استفاده شود `PREWHERE` وابسته به نام مستعار جدول و مجموعه نتیجه به دلیل شرایط کلیدی اولیه خالی بود. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- نوع بازگشت ثابت برای توابع `rand` و `randConstant` در صورت `Nullable` استدلال کردن. در حال حاضر توابع همیشه بازگشت `UInt32` و هرگز `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- پیش فرض غیر فعال فشار پایین برای `WITH FILL` اصطلاح. این رفع [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([زمستان ژانگ](https://github.com/zhang2014)) -- نادرست ثابت `count()` نتیجه برای `SummingMergeTree` چه زمانی `FINAL` بخش استفاده شده است. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- رفع نتیجه نادرست ممکن است برای توابع ثابت از سرور از راه دور. این برای نمایش داده شد با توابع مانند اتفاق افتاد `version()`, `uptime()`, و غیره. که برمی گرداند مقادیر ثابت مختلف برای سرورهای مختلف. این رفع [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع اشکال پیچیده در بهینه سازی پیش فرض فشار به پایین که منجر به نتایج اشتباه است. این مشکلات زیادی را در بهینه سازی پیش فرض پایین حل می کند. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([زمستان ژانگ](https://github.com/zhang2014)) -- رفع سقوط در `CREATE TABLE .. AS dictionary` پرس و جو. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([ازات خوژین](https://github.com/azat)) -- چند بهبود دستور زبان کلیک در `.g4` پرونده. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) -- رفع اشکال که منجر به سقوط در `JOIN`با جداول با موتور `Join`. این رفع [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([زویکوف](https://github.com/4ertus2)) -- رفع لغت نامه کار برکنار بارگذاری مجدد در `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([ازات خوژین](https://github.com/azat)) -- محدود کردن حداکثر تعداد جریان برای خواندن از `StorageFile` و `StorageHDFS`. رفع https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([الساپین](https://github.com/alesapin)) -- رفع اشکال در `ALTER ... MODIFY ... CODEC` پرس و جو, زمانی که کاربر هر دو عبارت به طور پیش فرض و کدک را مشخص کنید. رفع [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([الساپین](https://github.com/alesapin)) -- رفع خطا در ادغام پس زمینه ستون ها با `SimpleAggregateFunction(LowCardinality)` نوع. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- بررسی نوع ثابت در عملکرد `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([واسیلی نمکو](https://github.com/Enmk)) -- در حال حاضر سرور در سقوط نیست `LEFT` یا `FULL JOIN` با و پیوستن به موتور و پشتیبانی نشده `join_use_nulls` تنظیمات. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([زویکوف](https://github.com/4ertus2)) -- حالا `DROP DICTIONARY IF EXISTS db.dict` پرس و جو می کند و پرتاب استثنا اگر `db` وجود نداره [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([ویتالی بارانو](https://github.com/vitlibar)) -- رفع سقوط احتمالی در توابع جدول (`file`, `mysql`, `remote`) ناشی از استفاده از مرجع به حذف `IStorage` اعتراض. رفع تجزیه نادرست از ستون مشخص شده در درج به تابع جدول. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([تاولوبیکس](https://github.com/tavplubix)) -- اطمینان از شبکه قبل از شروع `clickhouse-server`. این رفع [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([ژیچنگ یو](https://github.com/yuzhichang)) -- رفع وقفه دست زدن به برای اتصالات امن, بنابراین نمایش داده شد می کند بی تعریف قطع نمی. این رفع [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `clickhouse-copier`مشاجره کار برکنار بین کارگران همزمان. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) -- در حال حاضر جهش می کند قطعات متصل جست و خیز نیست, حتی اگر نسخه جهش خود را بزرگتر از نسخه جهش فعلی بود. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([ژیچنگ یو](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([الساپین](https://github.com/alesapin)) -- چشمپوشی از نسخههای برکنار شده `*MergeTree` قطعات داده ها پس از حرکت به یکی دیگر از دیسک و سرور راه اندازی مجدد. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع سقوط در `FULL JOIN` با `LowCardinality` داخل `JOIN` کلیدی است. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([زویکوف](https://github.com/4ertus2)) -- ممنوع به استفاده از نام ستون بیش از یک بار در قرار دادن پرس و جو مانند `INSERT INTO tbl (x, y, x)`. این رفع [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([الساپین](https://github.com/alesapin)) -- اضافه شدن مجدد برای تشخیص تعداد هسته های پردازنده فیزیکی برای پردازنده ناشناخته (با استفاده از تعدادی از هسته های پردازنده منطقی). این رفع [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `There's no column` خطا برای مفردات و نام مستعار ستون. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([زویکوف](https://github.com/4ertus2)) -- تصادف شدید ثابت زمانی که `EXISTS` پرس و جو بدون استفاده شد `TABLE` یا `DICTIONARY` مقدماتی. درست مثل `EXISTS t`. این رفع [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). این اشکال در نسخه 19.17 معرفی شد. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشکال نادر با خطا `"Sizes of columns doesn't match"` که ممکن است به نظر می رسد در هنگام استفاده از `SimpleAggregateFunction` ستون. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([بوریس گرانویو](https://github.com/bgranvea)) -- رفع اشکال که کاربر با خالی است `allow_databases` دسترسی به تمام پایگاه های داده کردم (و همین کار را برای `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([دوفایت](https://github.com/DeifyTheGod)) -- رفع سقوط مشتری زمانی که سرور در حال حاضر از مشتری قطع شده است. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([ازات خوژین](https://github.com/azat)) -- ثابت `ORDER BY` رفتار در صورت مرتب سازی بر اساس پیشوند کلید اولیه و پسوند کلید غیر اولیه. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([انتون پوپوف](https://github.com/CurtizJ)) -- بررسی کنید که در حال حاضر ستون واجد شرایط در جدول. این رفع [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([زویکوف](https://github.com/4ertus2)) -- رفتار ثابت با `ALTER MOVE` فرار بلافاصله پس از ادغام پایان حرکت سوپر شروع مشخص شده است. رفع [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع سقوط سرور ممکن است در حالی که با استفاده از `UNION` با شماره های مختلف ستون. رفع [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع اندازه زیر رشته نتیجه برای عملکرد `substr` با اندازه منفی. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- در حال حاضر سرور جهش بخشی در اجرا نیست `MergeTree` اگر موضوعات رایگان به اندازه کافی در استخر پس زمینه وجود ندارد. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع خطای تایپی کوچک در قالب بندی `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([لیتا91](https://github.com/litao91)) -- ثابت نتایج فیلتر شکوفه نادرست برای اعداد منفی. این رفع [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([زمستان ژانگ](https://github.com/zhang2014)) -- سرریز بافر بالقوه ثابت در حالت فشرده خارج. کاربر مخرب می تواند داده های فشرده ساخته شده است که باعث می شود پس از بافر به عنوان خوانده شده منتقل می کند. این موضوع توسط الدار زیتوف از تیم امنیت اطلاعات یاندکس یافت شد. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع نتیجه نادرست به دلیل سرریز اعداد صحیح در `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- حالا `OPTIMIZE TABLE` پرس و جو نمی خواهد برای کپی نیست منتظر به انجام عملیات. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([جوی سانتانا](https://github.com/javisantana)) -- ثابت `ALTER TTL` تجزیه کننده برای `Replicated*MergeTree` میز [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع ارتباط بین سرور و کلاینت, بنابراین سرور خواندن اطلاعات جداول موقت پس از شکست پرس و جو. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([ازات خوژین](https://github.com/azat)) -- ثابت `bitmapAnd` خطای تابع هنگام تقاطع کردن بیت مپ جمع و بیت مپ اسکالر. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([یو هوانگ](https://github.com/moon03432)) -- اصلاح تعریف `ZXid` با توجه به راهنمای برنامه نویس باغ وحش که رفع اشکال در `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([هشدار داده می شود](https://github.com/dingxiangfei2009)) -- `odbc` تابع جدول در حال حاضر احترام می گذارد `external_table_functions_use_nulls` تنظیمات. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([واسیلی نمکو](https://github.com/Enmk)) -- اشکال ثابت که منجر به یک مسابقه داده نادر است. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([الکساندر کازاکوف](https://github.com/Akazz)) -- حالا `SYSTEM RELOAD DICTIONARY` بارگذاری مجدد یک فرهنگ لغت به طور کامل, نادیده گرفتن `update_field`. این رفع [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([ویتالی بارانو](https://github.com/vitlibar)) -- اضافه کردن توانایی برای بررسی اگر فرهنگ لغت در ایجاد پرس و جو وجود دارد. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([الساپین](https://github.com/alesapin)) -- ثابت `Float*` تجزیه در `Values` قالب. این رفع [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([تاولوبیکس](https://github.com/tavplubix)) -- رفع سقوط زمانی که ما نمی توانیم فضای ذخیره در برخی از عملیات پس زمینه از `*MergeTree` موتورهای جدول خانواده. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- رفع سقوط عملیات ادغام زمانی که جدول شامل `SimpleAggregateFunction(LowCardinality)` ستون. این رفع [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([ازات خوژین](https://github.com/azat)) -- بازگرداندن پشتیبانی از تمام مناطق فناوری اطلاعات و ارتباطات و اضافه کردن توانایی به درخواست تلفیقی برای عبارات ثابت. همچنین نام زبان را اضافه کنید `system.collations` جدول [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([الساپین](https://github.com/alesapin)) -- رفع اشکال در هنگام خارجی لغت نامه صفر و حداقل طول عمر (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) در پس زمینه به روز رسانی نیست . [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([الساپین](https://github.com/alesapin)) -- رفع تصادف در هنگام فرهنگ لغت خارجی با منبع کلیک است زیرخاکی در پرس و جو. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- رفع نادرست تجزیه پسوند فایل در جدول با موتور `URL`. این رفع [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([هشدار داده می شود](https://github.com/apbodrov)) -- ثابت `CHECK TABLE` پرسوجو برای `*MergeTree` جداول بدون کلید. رفع [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([الساپین](https://github.com/alesapin)) -- تبدیل ثابت از `Float64` به نوع خروجی زیر. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([یوری بارانوف](https://github.com/yurriy)) -- در حال حاضر اگر جدول به طور کامل به دلیل سقوط سرور کاهش یافته است, سرور سعی خواهد کرد برای بازگرداندن و بارگذاری. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([تاولوبیکس](https://github.com/tavplubix)) -- تصادف ثابت در عملکرد جدول `file` در حالی که قرار دادن به فایل که وجود ندارد. در حال حاضر در این مورد فایل ایجاد می شود و سپس قرار دادن پردازش می شود. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- رفع بن بست نادر است که می تواند زمانی اتفاق می افتد `trace_log` در را فعال کنید. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([فیلیمونف](https://github.com/filimonov)) -- اضافه کردن توانایی برای کار با انواع مختلف علاوه بر `Date` داخل `RangeHashed` فرهنگ لغت خارجی ایجاد شده از پرس و جو دی ال. رفع [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([الساپین](https://github.com/alesapin)) -- رفع سقوط زمانی که `now64()` با نتیجه تابع دیگری نامیده می شود. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([واسیلی نمکو](https://github.com/Enmk)) -- اشکال ثابت با تشخیص قانون مجازات اسلامی مشتری برای اتصال به شبکه از طریق پروتکل سیم خروجی زیر. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([دیمیتری موزیکا](https://github.com/dmitriy-myz)) -- رفع دست زدن به مجموعه خالی در `arraySplit` تابع. این رفع [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([هکز](https://github.com/hczhcz)) -- ثابت موضوع زمانی که `pid-file` از یکی دیگر از در حال اجرا `clickhouse-server` ممکن است حذف شود. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing زو](https://github.com/weiqxu)) -- رفع بارگذاری مجدد فرهنگ لغت در صورتی که `invalidate_query` که متوقف به روز رسانی و برخی از استثنا در به روز رسانی قبلی تلاش می کند. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([الساپین](https://github.com/alesapin)) -- ثابت خطا در تابع `arrayReduce` که ممکن است منجر به “double free” و خطا در ترکیب تابع کل `Resample` که ممکن است به نشت حافظه منجر شود. اضافه شدن تابع جمع `aggThrow`. این تابع را می توان برای اهداف تست استفاده کرد. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### بهبود {#improvement-1} - -- ورود به سیستم بهبود یافته در هنگام کار با `S3` موتور جدول. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([گریگوری پرواکوف](https://github.com/GrigoryPervakov)) -- پیام راهنما چاپ شده زمانی که هیچ استدلال در هنگام تماس گذشت `clickhouse-local`. این رفع [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([هشدار داده می شود](https://github.com/Melancholic)) -- افزودن تنظیمات `mutations_sync` که اجازه می دهد تا صبر کنید `ALTER UPDATE/DELETE` نمایش داده شد همزمان. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([الساپین](https://github.com/alesapin)) -- اجازه برای راه اندازی نسبی `user_files_path` داخل `config.xml` (در راه شبیه به `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([هکز](https://github.com/hczhcz)) -- اضافه کردن استثنا برای انواع غیر قانونی برای توابع تبدیل با `-OrZero` پسوند. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([اندری کونیایف](https://github.com/akonyaev90)) -- ساده فرمت هدر داده ارسال به سفال در پرس و جو توزیع شده است. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([ویتالی بارانو](https://github.com/vitlibar)) -- `Live View` تعمیر مجدد موتور جدول. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) -- اضافه کردن چک های اضافی برای لغت نامه های خارجی ایجاد شده از دی ال نمایش داده شد. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([الساپین](https://github.com/alesapin)) -- رفع خطا `Column ... already exists` در حالی که با استفاده از `FINAL` و `SAMPLE` together, e.g. `select count() from table final sample 1/2`. رفع [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- در حال حاضر جدول استدلال اول `joinGet` تابع می تواند جدول شناسایی. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([ایموس پرنده](https://github.com/amosbird)) -- اجازه استفاده `MaterializedView` با subqueries بالا `Kafka` میز [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([فیلیمونف](https://github.com/filimonov)) -- در حال حاضر پس زمینه بین دیسک ها حرکت می کند استخر تار شده را اجرا می کند. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- `SYSTEM RELOAD DICTIONARY` در حال حاضر اجرا همزمان. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([ویتالی بارانو](https://github.com/vitlibar)) -- ردیابی پشته در حال حاضر نمایش نشانی های فیزیکی (شیپور خاموشی در فایل شی) به جای نشانی های حافظه مجازی (جایی که فایل شی لود شد). که اجازه می دهد تا استفاده از `addr2line` هنگامی که باینری موقعیت مستقل است و اصل فعال است. این رفع [\#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)) -- حالا `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)) -- فعال خروجی زیر سرور سازگاری زمانی که تاتر بدون اس اس ال وارد شده است. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([یوری بارانوف](https://github.com/yurriy)) -- در حال حاضر چک سرور دسته توزیع, می دهد که خطاهای طولانی تر در مورد داده های خراب شده در دسته ای. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([ازات خوژین](https://github.com/azat)) -- پشتیبانی `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` و `ATTACH TABLE` برای `MySQL` موتور پایگاه داده. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([زمستان ژانگ](https://github.com/zhang2014)) -- اضافه کردن احراز هویت در اس 3 تابع جدول و موتور جدول. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اضافه شدن چک برای قطعات اضافی از `MergeTree` در دیسک های مختلف, به منظور اجازه نمی دهد به دست قطعات داده در دیسک تعریف نشده. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- فعال کردن پشتیبانی اس اس ال برای مشتری مک و سرور. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([ایوان](https://github.com/abyss7)) -- در حال حاضر clickhouse کار می تواند به عنوان خروجی يکپارچه سرور (دیدن https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([ماکسیم فدوتف](https://github.com/MaxFedotov)) -- `clickhouse-client` در حال حاضر تنها فعال `bracketed-paste` هنگامی که چند ضلعی روشن است و چند خطی خاموش است. این رفع (\#7757) \[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([ایموس پرنده](https://github.com/amosbird)) -- پشتیبانی `Array(Decimal)` داخل `if` تابع. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([زویکوف](https://github.com/4ertus2)) -- اعشار پشتیبانی در `arrayDifference`, `arrayCumSum` و `arrayCumSumNegative` توابع. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([زویکوف](https://github.com/4ertus2)) -- اضافه شده `lifetime` ستون به `system.dictionaries` جدول [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([کیککول](https://github.com/kekekekule)) -- بررسی بهبود یافته برای قطعات موجود بر روی دیسک های مختلف برای `*MergeTree` موتورهای جدول. نشانیهای [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- ادغام با `AWS SDK` برای `S3` فعل و انفعالات که اجازه می دهد تا به استفاده از تمام 3 ویژگی های خارج از جعبه. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([پاول کووالنکو](https://github.com/Jokser)) -- اضافه شدن پشتیبانی برای کارخانه های فرعی در `Live View` میز [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) -- بررسی برای استفاده از `Date` یا `DateTime` ستون از `TTL` عبارات حذف شد. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- اطلاعات در مورد دیسک به اضافه شد `system.detached_parts` جدول [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- در حال حاضر تنظیمات `max_(table|partition)_size_to_drop` را می توان بدون راه اندازی مجدد تغییر کرده است. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([گریگوری پرواکوف](https://github.com/GrigoryPervakov)) -- قابلیت استفاده کمی بهتر از پیام های خطا. از کاربر بخواهید که خطوط زیر را حذف کند `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- خواندن بهتر پیام ها از `Kafka` موتور در فرمت های مختلف پس از [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([ایوان](https://github.com/abyss7)) -- سازگاری بهتر با مشتریان خروجی زیر که پشتیبانی نمی کند `sha2_password` auth پلاگین. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([یوری baranov](https://github.com/yurriy)) -- پشتیبانی از انواع ستون بیشتر در خروجی زیر سرور سازگاری. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([یوری baranov](https://github.com/yurriy)) -- پیاده سازی `ORDER BY` بهینه سازی برای `Merge`, `Buffer` و `Materilized View` ذخیره سازی با زمینه `MergeTree` میز [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([انتون پوپوف](https://github.com/CurtizJ)) -- در حال حاضر ما همیشه اجرای پسوند استفاده از `getrandom` برای سازگاری بهتر با دانه های قدیمی (\<3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([ایموس پرنده](https://github.com/amosbird)) -- بررسی بهتر برای مقصد معتبر در یک قانون حرکت تغییر جنسیت. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- چک بهتر برای دسته درج شکسته برای `Distributed` موتور جدول. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([ازات خوژین](https://github.com/azat)) -- اضافه کردن ستون با مجموعه ای از نام قطعات که جهش باید در اینده پردازش به `system.mutations` جدول [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([الساپین](https://github.com/alesapin)) -- موازی با مرتب کردن بر اساس ادغام بهینه سازی برای پردازنده. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- تنظیمات `mark_cache_min_lifetime` در حال حاضر منسوخ و هیچ کاری نمی کند. در نسخه های قبلی, علامت گذاری به عنوان کش می تواند در حافظه بزرگتر از رشد `mark_cache_size` به جای داده ها در `mark_cache_min_lifetime` چند ثانیه که منجر به سردرگمی و استفاده از حافظه بالاتر از حد انتظار است که به خصوص بد در حافظه محدود سیستم. اگر شما تخریب عملکرد پس از نصب این نسخه را ببینید, شما باید افزایش `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- طرز تهیه برای استفاده `tid` همه جا این برای مورد نیاز است [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -#### بهبود عملکرد {#performance-improvement-1} - -- بهینه سازی عملکرد در خط لوله پردازنده. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- به روز رسانی غیر مسدود کردن کلید منقضی شده در لغت نامه کش (با اجازه خواندن قدیمی). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- کامپایل تاتر بدون `-fno-omit-frame-pointer` در سطح جهانی به فراغت یک ثبت نام بیشتر. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([ایموس پرنده](https://github.com/amosbird)) -- افزایش سرعت `greatCircleDistance` عملکرد و تست عملکرد را اضافه کنید. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([اولگا خوستیکوا](https://github.com/stavrolia)) -- بهبود عملکرد عملکرد `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهبود عملکرد `max`, `min`, `argMin`, `argMax` برای `DateTime64` نوع داده. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([واسیلی نمکو](https://github.com/Enmk)) -- بهبود عملکرد مرتب سازی بدون محدودیت و یا با حد بزرگ و مرتب سازی خارجی. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهبود عملکرد قالب بندی اعداد ممیز شناور تا 6 بار. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهبود عملکرد `modulo` تابع. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([ایموس پرنده](https://github.com/amosbird)) -- بهینهسازی شده `ORDER BY` و ادغام با کلید ستون. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجرای بهتر برای `arrayReduce`, `-Array` و `-State` ترکیب کننده ها [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([ایموس پرنده](https://github.com/amosbird)) -- حالا `PREWHERE` باید بهینه سازی شود حداقل به عنوان موثر به عنوان `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([ایموس پرنده](https://github.com/amosbird)) -- بهبود راه `round` و `roundBankers` دست زدن به اعداد منفی. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([هکز](https://github.com/hczhcz)) -- رمزگشایی بهبود عملکرد `DoubleDelta` و `Gorilla` کدک های تقریبا 30-40%. این رفع [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([واسیلی نمکو](https://github.com/Enmk)) -- بهبود عملکرد `base64` توابع مرتبط. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه شدن یک تابع `geoDistance`. این شبیه به `greatCircleDistance` اما با استفاده از تقریب به دندان-84 مدل بیضی. عملکرد هر دو توابع در نزدیکی یکسان هستند. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- سریع تر `min` و `max` توابع تجمع برای `Decimal` نوع داده. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([زویکوف](https://github.com/4ertus2)) -- Vectorize پردازش `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([ایموس پرنده](https://github.com/amosbird)) -- `if` زنجیر در حال حاضر به عنوان بهینه سازی شده `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([کمالف روسلان](https://github.com/kamalov-ruslan)) -- رفع رگرسیون عملکرد `Kafka` موتور جدول معرفی شده در 19.15. این رفع [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([فیلیمونف](https://github.com/filimonov)) -- حذف شد “pie” تولید کد که `gcc` از بسته های دبیان گاهی اوقات به طور پیش فرض به ارمغان بیاورد. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- موازی تجزیه فرمت های داده [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([نیکیتا میخایلو](https://github.com/nikitamikhaylov)) -- به کار انداختن تجزیه کننده بهینه `Values` با عبارات به طور پیش فرض (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([تاولوبیکس](https://github.com/tavplubix)) - -#### ساخت/تست / بهبود بسته بندی {#buildtestingpackaging-improvement-2} - -- ساخت رفع برای `ARM` و در حالت حداقل. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([پرولر](https://github.com/proller)) -- اضافه کردن پوشش خیط و پیت کردن فایل برای `clickhouse-server` وقتی بیماری مقاربتی:: اختلال نامیده می شود نیست. همچنین کمی بهبود یافته ورود به سیستم در تست بدون تابعیت با پوشش. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([الساپین](https://github.com/alesapin)) -- به روز رسانی llvm کتابخانه در contrib. اجتناب از استفاده از llvm از سیستم عامل بسته است. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- را همراه `curl` ساخت کاملا ساکت. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([پاول کووالنکو](https://github.com/Jokser)) -- رفع برخی از `MemorySanitizer` اخطار. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- استفاده `add_warning` و `no_warning` ماکروها در `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([ایوان](https://github.com/abyss7)) -- اضافه کردن پشتیبانی از minio s3 سازگار شی (https://min.io/) برای ادغام بهتر شد. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([پاول کووالنکو](https://github.com/Jokser)) -- وارد شده `libc` سرصفحهها به کنترب. این اجازه می دهد تا به ایجاد بیشتر سازگار در سراسر سیستم های مختلف (فقط برای `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حذف `-fPIC` از برخی از کتابخانه ها. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تمیز `CMakeLists.txt` برای حلقه. ببینید https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- هشدار خاموش در `CapNProto` کتابخونه. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اضافه کردن تست عملکرد برای رشته کوتاه بهینه سازی جداول هش. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([ایموس پرنده](https://github.com/amosbird)) -- در حال حاضر خانه کلیک بر روی ساخت `AArch64` حتی اگر `MADV_FREE` در دسترس نیست. این رفع [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([ایموس پرنده](https://github.com/amosbird)) -- بهروزرسانی `zlib-ng` برای رفع مشکلات ضدعفونی کننده حافظه. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- فعال کردن کتابخانه خروجی زیر داخلی در سیستم غیر لینوکس, به دلیل استفاده از بسته های سیستم عامل بسیار شکننده است و معمولا در همه کار نمی کند. این رفع [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ساخت ثابت در برخی از سیستم های پس از فعال کردن `libc++`. این جانشین [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ساخت `Field` مواد و روش ها نوع بیشتر-امن برای پیدا کردن خطاهای بیشتر. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- اضافه شده فایل های از دست رفته به `libc-headers` submodule. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع اشتباه `JSON` نقل قول در خروجی تست عملکرد. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- در حال حاضر ردیابی پشته برای نمایش داده می شود `std::exception` و `Poco::Exception`. در نسخه های قبلی فقط برای `DB::Exception`. این باعث بهبود تشخیص می شود. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بارینگ `clock_gettime` و `clock_nanosleep` برای نسخه های چرب زبان تازه. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([ایموس پرنده](https://github.com/amosbird)) -- فعالسازی `part_log` در مثال پیکربندی برای توسعه دهندگان. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- رفع ماهیت کالاهای کابل از بازنگری در `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([ازات خوژین](https://github.com/azat)) -- تست عملکرد کدک ثابت. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([واسیلی نمکو](https://github.com/Enmk)) -- اضافه کردن اسکریپت نصب برای `.tgz` ساخت و اسناد و مدارک برای خود. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([الساپین](https://github.com/alesapin)) -- حذف قدیمی `ZSTD` تست (این در سال 2016 ایجاد شد به تکثیر اشکال که قبل از 1.0 نسخه از زد تا به حال). این رفع [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ساخت ثابت در سیستم عامل مک کاتالینا. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([مو](https://github.com/meob)) -- افزایش تعداد ردیف در تست عملکرد کدک برای ایجاد نتایج قابل توجه است. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([واسیلی نمکو](https://github.com/Enmk)) -- در اشکال زدایی ایجاد, درمان `LOGICAL_ERROR` استثنا به عنوان شکست ادعای, به طوری که راحت تر به اطلاع. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- تست عملکرد مربوط به فرمت را قطعی تر کنید. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- بهروزرسانی `lz4` برای رفع یک شکست حفظ کننده. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- سرکوب یک یادداشت شناخته شده مثبت کاذب در دست زدن به استثنا. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- بهروزرسانی `gcc` و `g++` به نسخه 9 در `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([تلیتسکی](https://github.com/tlightsky)) -- اضافه کردن مورد تست عملکرد برای تست که `PREWHERE` بدتر از `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([ایموس پرنده](https://github.com/amosbird)) -- پیشرفت به سمت رفع یک تست فلکی. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- اجتناب از گزارش یادداشت برای داده ها از `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- به روز شده `libc++` به جدیدترین نسخه. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ساخت کتابخانه ایکو از منابع. این رفع [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تغییر از `libressl` به `openssl`. ClickHouse باید پشتیبانی از TLS 1.3 و SNI پس از این تغییر. این رفع [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- گزارش ثابت اوبسان هنگام استفاده `chacha20_poly1305` از اس اس ال (اتفاق می افتد در اتصال به https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- حالت ثابت فایل رمز عبور پیش فرض برای `.deb` توزیع لینوکس. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([پرولر](https://github.com/proller)) -- بیان بهبود یافته برای گرفتن `clickhouse-server` PID در `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([الکساندر کازاکوف](https://github.com/Akazz)) -- به روز شده در تماس/ماده چسبنده و لزج به نسخه برداری1.10.0. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([الکساندر بورمک](https://github.com/Alex-Burmak)) -- گزارش سه گانه ثابت در `base64` کتابخونه. همچنین این کتابخانه به جدیدترین نسخه به روز, اما مهم نیست. این رفع [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ثابت `00600_replace_running_query` برای پردازنده. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- حذف پشتیبانی برای `tcmalloc` برای ساخت `CMakeLists.txt` ساده تر [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- انتشار شورای همکاری خلیج فارس ایجاد در حال حاضر استفاده کنید `libc++` به جای `libstdc++`. اخیرا `libc++` تنها با صدای جرنگ جرنگ مورد استفاده قرار گرفت. این ثبات تنظیمات ساخت و قابلیت حمل را بهبود بخشد. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- فعال کردن کتابخانه فناوری اطلاعات و ارتباطات برای ساخت با حفظ. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- سرکوب هشدارها از `CapNProto` کتابخونه. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- موارد خاص حذف کد برای `tcmalloc`, زیرا دیگر پشتیبانی. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- کشتن سرور برازنده اجازه می دهد تا برای ذخیره گزارش پوشش. این رفع گزارش پوشش ناقص ما به تازگی دیدن شده است. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([الساپین](https://github.com/alesapin)) -- تست عملکرد برای تمام کدک در برابر `Float64` و `UInt64` ارزشهای خبری عبارتند از: [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([واسیلی نمکو](https://github.com/Enmk)) -- `termcap` بسیار توصیه شده و منجر به مشکلات مختلف (f.g. از دست رفته “up” کلاه و انعکاس `^J` به جای چند خط). به نفع `terminfo` یا همراه `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([ایموس پرنده](https://github.com/amosbird)) -- ثابت `test_storage_s3` تست ادغام. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- پشتیبانی `StorageFile(, null)` برای قرار دادن بلوک به فایل فرمت داده شده بدون در واقع به دیسک ارسال. این برای تست عملکرد مورد نیاز است. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([ایموس پرنده](https://github.com/amosbird)) -- استدلال اضافه شده `--print-time` به تست های عملکردی که زمان اجرای هر تست را چاپ می کند. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اضافه ادعا به `KeyCondition` در حالی که ارزیابی مالیات بر ارزش افزوده. این هشدار را از شورای همکاری خلیج فارس-9 حل کنند. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- تخلیه گزینه های چوب کوره در سی ایجاد. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- اطلاعات اشکال زدایی برای برخی از کتابخانه های چربی تولید نمی کند. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- ساخت `log_to_console.xml` همیشه به خ ورود, صرف نظر از تعاملی است یا نه. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([الکساندر کوزمنکوف](https://github.com/akuzm)) -- حذف برخی از ویژگی های استفاده نشده از `clickhouse-performance-test` ابزار. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- در حال حاضر ما نیز برای جستجو `lld-X` با متناظر `clang-X` نسخه. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([الساپین](https://github.com/alesapin)) -- پارکت ساخت بهبود. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([مکسولان](https://github.com/maxulan)) -- هشدارهای شورای همکاری خلیج فارس بیشتر [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([کروزرکریگ](https://github.com/kreuzerkrieg)) -- بسته بندی برای قوس لینوکس در حال حاضر اجازه می دهد تا برای اجرای سرور کلیک, و نه تنها مشتری. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([ولادیمیر چبوتراف](https://github.com/excitoon)) -- ثابت تست با پردازنده. رفع عملکرد کوچک. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([نیکولای کوچتو](https://github.com/KochetovNicolai)) -- اطلاعات دقیق [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([هشدار داده می شود](https://github.com/matwey)) -- در تهیه تعویض به سی++20 به عنوان یک جشن سال نو. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([ایموس پرنده](https://github.com/amosbird)) - -#### ویژگی تجربی {#experimental-feature-1} - -- اضافه شدن تنظیمات تجربی `min_bytes_to_use_mmap_io`. این اجازه می دهد به خواندن فایل های بزرگ بدون کپی کردن داده ها از هسته به فضای کاربری. تنظیمات به طور پیش فرض غیر فعال. توصیه می شود در حدود 64 مگابایت است, چون اماسپ / مون مپ کند است. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([الکسی میلویدو](https://github.com/alexey-milovidov)) -- سهمیه به عنوان بخشی از سیستم کنترل دسترسی دوباره. جدول جدید اضافه شده است `system.quotas` توابع جدید `currentQuota`, `currentQuotaKey` نحو گذاشتن جدید `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([ویتالی بارانو](https://github.com/vitlibar)) -- اجازه پرش تنظیمات ناشناخته با هشدار به جای پرتاب استثنا. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([ویتالی بارانو](https://github.com/vitlibar)) -- سیاست های ردیف به عنوان بخشی از سیستم کنترل دسترسی دوباره. جدول جدید اضافه شده است `system.row_policies` تابع جدید `currentRowPolicies()` نحو گذاشتن جدید `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([ویتالی بارانو](https://github.com/vitlibar)) - -#### تعمیر امنیتی {#security-fix} - -- ثابت امکان خواندن ساختار دایرکتوری در جداول با `File` موتور جدول. این رفع [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([الکسی میلویدو](https://github.com/alexey-milovidov)) - -## [تغییرات برای 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/fr/commercial/cloud.md b/docs/fr/commercial/cloud.md index 3a04f95fc9a..ea97c969b02 100644 --- a/docs/fr/commercial/cloud.md +++ b/docs/fr/commercial/cloud.md @@ -6,16 +6,16 @@ machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 # Fournisseurs De Services Cloud ClickHouse {#clickhouse-cloud-service-providers} !!! info "Info" - Si vous avez lancé un cloud public avec un service clickhouse géré, n'hésitez pas à [ouvrir une demande d'extraction](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/commercial/cloud.md) ajouter à la liste suivante. + Si vous avez lancé un cloud public avec un service clickhouse géré, n’hésitez pas à [ouvrir une demande d’extraction](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/commercial/cloud.md) ajouter à la liste suivante. ## Yandex Cloud {#yandex-cloud} [Service géré Yandex pour ClickHouse](https://cloud.yandex.com/services/managed-clickhouse?utm_source=referrals&utm_medium=clickhouseofficialsite&utm_campaign=link3) offre les fonctionnalités suivantes: -- Service ZooKeeper entièrement géré pour [Réplication de ClickHouse](../engines/table_engines/mergetree_family/replication.md) +- Service ZooKeeper entièrement géré pour [Réplication de ClickHouse](../engines/table-engines/mergetree-family/replication.md) - Choix multiples de type de stockage - Répliques dans différentes zones de disponibilité -- Le chiffrement et l'isolement +- Le chiffrement et l’isolement - Automatisation de la maintenance {## [Article Original](https://clickhouse.tech/docs/en/commercial/cloud/) ##} diff --git a/docs/fr/development/architecture.md b/docs/fr/development/architecture.md index eb9cab7ecf9..4d6630403fa 100644 --- a/docs/fr/development/architecture.md +++ b/docs/fr/development/architecture.md @@ -5,199 +5,199 @@ toc_priority: 62 toc_title: Vue d'ensemble de L'Architecture ClickHouse --- -# Vue d'ensemble de L'Architecture ClickHouse {#overview-of-clickhouse-architecture} +# Vue d’ensemble De L’Architecture ClickHouse {#overview-of-clickhouse-architecture} -ClickHouse est un véritable SGBD orienté colonne. Les données sont stockées par colonnes et lors de l'exécution de tableaux (vecteurs ou morceaux de colonnes). Dans la mesure du possible, les opérations sont distribuées sur des tableaux, plutôt que sur des valeurs individuelles. Il est appelé “vectorized query execution,” et cela aide à réduire le coût du traitement des données réel. +ClickHouse est un véritable SGBD orienté colonne. Les données sont stockées par colonnes et lors de l’exécution de tableaux (vecteurs ou morceaux de colonnes). Dans la mesure du possible, les opérations sont distribuées sur des tableaux, plutôt que sur des valeurs individuelles. Il est appelé “vectorized query execution,” et cela aide à réduire le coût du traitement des données réel. -> Cette idée n'est pas nouvelle. Il remonte à la `APL` langage de programmation et ses descendants: `A +`, `J`, `K`, et `Q`. La programmation de tableau est utilisée dans le traitement des données scientifiques. Cette idée n'est pas non plus nouvelle dans les bases de données relationnelles: par exemple, elle est utilisée dans le `Vectorwise` système. +> Cette idée n’est pas nouvelle. Il remonte à la `APL` langage de programmation et ses descendants: `A +`, `J`, `K`, et `Q`. La programmation de tableau est utilisée dans le traitement des données scientifiques. Cette idée n’est pas non plus nouvelle dans les bases de données relationnelles: par exemple, elle est utilisée dans le `Vectorwise` système. -Il existe deux approches différentes pour accélérer le traitement des requêtes: l'exécution vectorisée des requêtes et la génération de code d'exécution. Ce dernier supprime toute indirection et expédition dynamique. Aucune de ces approches est strictement meilleure que l'autre. La génération de code d'exécution peut être meilleure lorsqu'elle fusionne de nombreuses opérations, utilisant ainsi pleinement les unités D'exécution du processeur et le pipeline. L'exécution de requête vectorisée peut être moins pratique car elle implique des vecteurs temporaires qui doivent être écrits dans le cache et lus. Si les données temporaires ne rentre pas dans le cache L2, cela devient un problème. Mais l'exécution de requête vectorisée utilise plus facilement les capacités SIMD de la CPU. Un [document de recherche](http://15721.courses.cs.cmu.edu/spring2016/papers/p5-sompolski.pdf) écrit par nos amis montre qu'il est préférable de combiner les deux approches. ClickHouse utilise l'exécution de requête vectorisée et a un support initial limité pour la génération de code d'exécution. +Il existe deux approches différentes pour accélérer le traitement des requêtes: l’exécution vectorisée des requêtes et la génération de code d’exécution. Ce dernier supprime toute indirection et expédition dynamique. Aucune de ces approches est strictement meilleure que l’autre. La génération de code d’exécution peut être meilleure lorsqu’elle fusionne de nombreuses opérations, utilisant ainsi pleinement les unités D’exécution du processeur et le pipeline. L’exécution de requête vectorisée peut être moins pratique car elle implique des vecteurs temporaires qui doivent être écrits dans le cache et lus. Si les données temporaires ne rentre pas dans le cache L2, cela devient un problème. Mais l’exécution de requête vectorisée utilise plus facilement les capacités SIMD de la CPU. Un [document de recherche](http://15721.courses.cs.cmu.edu/spring2016/papers/p5-sompolski.pdf) écrit par nos amis montre qu’il est préférable de combiner les deux approches. ClickHouse utilise l’exécution de requête vectorisée et a un support initial limité pour la génération de code d’exécution. ## Colonne {#columns} -`IColumn` l'interface est utilisée pour représenter des colonnes en mémoire (en fait, des morceaux de colonnes). Cette interface fournit des méthodes d'aide pour la mise en œuvre de divers opérateurs relationnels. Presque toutes les opérations sont immuables: elles ne modifient pas la colonne d'origine, mais en créent une nouvelle modifiée. Par exemple, l' `IColumn :: filter` méthode accepte un masque d'octet de filtre. Il est utilisé pour le `WHERE` et `HAVING` opérateurs relationnels. Exemples supplémentaires: `IColumn :: permute` méthode de soutien `ORDER BY`, le `IColumn :: cut` méthode de soutien `LIMIT`. +`IColumn` l’interface est utilisée pour représenter des colonnes en mémoire (en fait, des morceaux de colonnes). Cette interface fournit des méthodes d’aide pour la mise en œuvre de divers opérateurs relationnels. Presque toutes les opérations sont immuables: elles ne modifient pas la colonne d’origine, mais en créent une nouvelle modifiée. Par exemple, l’ `IColumn :: filter` méthode accepte un masque d’octet de filtre. Il est utilisé pour le `WHERE` et `HAVING` opérateurs relationnels. Exemples supplémentaires: `IColumn :: permute` méthode de soutien `ORDER BY`, le `IColumn :: cut` méthode de soutien `LIMIT`. -Divers `IColumn` application (`ColumnUInt8`, `ColumnString` et ainsi de suite) sont responsables de la mémoire disposition de colonnes. La disposition de la mémoire est généralement un tableau contigu. Pour le type entier de colonnes, c'est juste un contiguë tableau, comme `std :: vector`. Pour `String` et `Array` colonnes, il s'agit de deux vecteurs: Un pour tous les éléments du tableau, placé de manière contiguë, et un second pour les décalages au début de chaque tableau. Il y a aussi `ColumnConst` cela stocke une seule valeur en mémoire, mais ressemble à une colonne. +Divers `IColumn` application (`ColumnUInt8`, `ColumnString` et ainsi de suite) sont responsables de la mémoire disposition de colonnes. La disposition de la mémoire est généralement un tableau contigu. Pour le type entier de colonnes, c’est juste un contiguë tableau, comme `std :: vector`. Pour `String` et `Array` colonnes, il s’agit de deux vecteurs: Un pour tous les éléments du tableau, placé de manière contiguë, et un second pour les décalages au début de chaque tableau. Il y a aussi `ColumnConst` cela stocke une seule valeur en mémoire, mais ressemble à une colonne. ## Champ {#field} -Néanmoins, il est possible de travailler avec des valeurs individuelles ainsi. Pour représenter une valeur individuelle, la `Field` est utilisée. `Field` est juste une union discriminée de `UInt64`, `Int64`, `Float64`, `String` et `Array`. `IColumn` a l' `operator[]` méthode pour obtenir la n-ème valeur en tant que `Field` et la `insert` méthode pour ajouter un `Field` à la fin d'une colonne. Ces méthodes ne sont pas très efficaces, car ils nécessitent de traiter avec temporaire `Field` des objets représentant une valeur individuelle. Il existe des méthodes plus efficaces, telles que `insertFrom`, `insertRangeFrom` et ainsi de suite. +Néanmoins, il est possible de travailler avec des valeurs individuelles ainsi. Pour représenter une valeur individuelle, la `Field` est utilisée. `Field` est juste une union discriminée de `UInt64`, `Int64`, `Float64`, `String` et `Array`. `IColumn` a l’ `operator[]` méthode pour obtenir la n-ème valeur en tant que `Field` et la `insert` méthode pour ajouter un `Field` à la fin d’une colonne. Ces méthodes ne sont pas très efficaces, car ils nécessitent de traiter avec temporaire `Field` des objets représentant une valeur individuelle. Il existe des méthodes plus efficaces, telles que `insertFrom`, `insertRangeFrom` et ainsi de suite. -`Field` ne pas avoir assez d'informations sur un type de données spécifique pour une table. Exemple, `UInt8`, `UInt16`, `UInt32`, et `UInt64` tous sont représentés comme `UInt64` dans un `Field`. +`Field` ne pas avoir assez d’informations sur un type de données spécifique pour une table. Exemple, `UInt8`, `UInt16`, `UInt32`, et `UInt64` tous sont représentés comme `UInt64` dans un `Field`. ## Abstractions Qui Fuient {#leaky-abstractions} -`IColumn` a des méthodes pour les transformations relationnelles communes des données, mais elles ne répondent pas à tous les besoins. Exemple, `ColumnUInt64` ne pas avoir une méthode pour calculer la somme des deux colonnes, et `ColumnString` n'a pas de méthode pour exécuter une recherche de sous-chaîne. Ces innombrables routines sont mises en œuvre en dehors de `IColumn`. +`IColumn` a des méthodes pour les transformations relationnelles communes des données, mais elles ne répondent pas à tous les besoins. Exemple, `ColumnUInt64` ne pas avoir une méthode pour calculer la somme des deux colonnes, et `ColumnString` n’a pas de méthode pour exécuter une recherche de sous-chaîne. Ces innombrables routines sont mises en œuvre en dehors de `IColumn`. -Diverses fonctions sur les colonnes peuvent être implémentées de manière générique et non efficace en utilisant `IColumn` méthodes pour extraire `Field` valeurs, ou d'une manière spécialisée en utilisant la connaissance de la disposition de la mémoire interne des données dans un `IColumn` application. Il est implémenté en lançant des fonctions à un `IColumn` tapez et traitez directement la représentation interne. Exemple, `ColumnUInt64` a l' `getData` méthode qui renvoie une référence à un tableau interne, puis une autre routine lit ou remplit ce tableau directement. Nous avons “leaky abstractions” permettent de spécialisations diverses routines. +Diverses fonctions sur les colonnes peuvent être implémentées de manière générique et non efficace en utilisant `IColumn` méthodes pour extraire `Field` valeurs, ou d’une manière spécialisée en utilisant la connaissance de la disposition de la mémoire interne des données dans un `IColumn` application. Il est implémenté en lançant des fonctions à un `IColumn` tapez et traitez directement la représentation interne. Exemple, `ColumnUInt64` a l’ `getData` méthode qui renvoie une référence à un tableau interne, puis une autre routine lit ou remplit ce tableau directement. Nous avons “leaky abstractions” permettent de spécialisations diverses routines. ## Types De Données {#data_types} -`IDataType` est responsable de la sérialisation et de la désérialisation: pour la lecture et l'écriture de morceaux de colonnes ou de valeurs individuelles sous forme binaire ou de texte. `IDataType` correspond directement aux types de données dans les tables. Par exemple, il y a `DataTypeUInt32`, `DataTypeDateTime`, `DataTypeString` et ainsi de suite. +`IDataType` est responsable de la sérialisation et de la désérialisation: pour la lecture et l’écriture de morceaux de colonnes ou de valeurs individuelles sous forme binaire ou de texte. `IDataType` correspond directement aux types de données dans les tables. Par exemple, il y a `DataTypeUInt32`, `DataTypeDateTime`, `DataTypeString` et ainsi de suite. `IDataType` et `IColumn` ne sont que faiblement liés les uns aux autres. Différents types de données peuvent être représentés en mémoire par le même `IColumn` application. Exemple, `DataTypeUInt32` et `DataTypeDateTime` sont tous deux représentés par `ColumnUInt32` ou `ColumnConstUInt32`. En outre, le même type de données peut être représentée par différents `IColumn` application. Exemple, `DataTypeUInt8` peut être représenté par `ColumnUInt8` ou `ColumnConstUInt8`. `IDataType` stocke uniquement les métadonnées. Par exemple, `DataTypeUInt8` ne stocke rien du tout (sauf vptr) et `DataTypeFixedString` magasins juste `N` (la taille des chaînes de taille fixe). -`IDataType` a des méthodes d'aide pour différents formats de données. Des exemples sont des méthodes pour sérialiser une valeur avec des guillemets possibles, pour sérialiser une valeur pour JSON et pour sérialiser une valeur dans le format XML. Il n'y a pas de correspondance directe avec les formats de données. Par exemple, les différents formats de données `Pretty` et `TabSeparated` pouvez utiliser le même `serializeTextEscaped` méthode d'aide à partir de la `IDataType` interface. +`IDataType` a des méthodes d’aide pour différents formats de données. Des exemples sont des méthodes pour sérialiser une valeur avec des guillemets possibles, pour sérialiser une valeur pour JSON et pour sérialiser une valeur dans le format XML. Il n’y a pas de correspondance directe avec les formats de données. Par exemple, les différents formats de données `Pretty` et `TabSeparated` pouvez utiliser le même `serializeTextEscaped` méthode d’aide à partir de la `IDataType` interface. ## Bloc {#block} -A `Block` est un conteneur qui représente un sous-ensemble (morceau) d'une table en mémoire. C'est juste un ensemble de triplets: `(IColumn, IDataType, column name)`. Pendant l'exécution de la requête, les données sont traitées par `Block`s. Si nous avons un `Block`, nous disposons de données (dans le `IColumn` objet), nous avons des informations sur son type (dans `IDataType`) qui nous indique comment traiter cette colonne, et nous avons le nom de la colonne. Il peut s'agir du nom de colonne d'origine de la table ou d'un nom artificiel attribué pour obtenir des résultats temporaires de calculs. +A `Block` est un conteneur qui représente un sous-ensemble (morceau) d’une table en mémoire. C’est juste un ensemble de triplets: `(IColumn, IDataType, column name)`. Pendant l’exécution de la requête, les données sont traitées par `Block`s. Si nous avons un `Block`, nous disposons de données (dans le `IColumn` objet), nous avons des informations sur son type (dans `IDataType`) qui nous indique comment traiter cette colonne, et nous avons le nom de la colonne. Il peut s’agir du nom de colonne d’origine de la table ou d’un nom artificiel attribué pour obtenir des résultats temporaires de calculs. -Lorsque nous calculons une fonction sur des colonnes dans un bloc, nous ajoutons une autre colonne avec son résultat au bloc, et nous ne touchons pas les colonnes pour les arguments de la fonction car les opérations sont immuables. Plus tard, les colonnes inutiles peuvent être supprimées du bloc, mais pas modifiées. Il est pratique pour l'élimination des sous-expressions communes. +Lorsque nous calculons une fonction sur des colonnes dans un bloc, nous ajoutons une autre colonne avec son résultat au bloc, et nous ne touchons pas les colonnes pour les arguments de la fonction car les opérations sont immuables. Plus tard, les colonnes inutiles peuvent être supprimées du bloc, mais pas modifiées. Il est pratique pour l’élimination des sous-expressions communes. -Des blocs sont créés pour chaque bloc de données traité. Notez que pour le même type de calcul, les noms et les types de colonnes restent les mêmes pour différents blocs, et seules les données de colonne changent. Il est préférable de diviser les données de bloc de l'en-tête de bloc car les petites tailles de Bloc ont une surcharge élevée de chaînes temporaires pour copier shared\_ptrs et les noms de colonnes. +Des blocs sont créés pour chaque bloc de données traité. Notez que pour le même type de calcul, les noms et les types de colonnes restent les mêmes pour différents blocs, et seules les données de colonne changent. Il est préférable de diviser les données de bloc de l’en-tête de bloc car les petites tailles de Bloc ont une surcharge élevée de chaînes temporaires pour copier shared\_ptrs et les noms de colonnes. ## Bloquer Les Flux {#block-streams} -Les flux de blocs sont destinés au traitement des données. Nous utilisons des flux de blocs pour lire des données quelque part, effectuer des transformations de données ou écrire des données quelque part. `IBlockInputStream` a l' `read` méthode pour récupérer le bloc suivant, tandis que des. `IBlockOutputStream` a l' `write` méthode pour pousser le bloc quelque part. +Les flux de blocs sont destinés au traitement des données. Nous utilisons des flux de blocs pour lire des données quelque part, effectuer des transformations de données ou écrire des données quelque part. `IBlockInputStream` a l’ `read` méthode pour récupérer le bloc suivant, tandis que des. `IBlockOutputStream` a l’ `write` méthode pour pousser le bloc quelque part. Les flux sont responsables de: -1. De la lecture ou de l'écriture dans une table. La table renvoie simplement un flux pour lire ou écrire des blocs. +1. De la lecture ou de l’écriture dans une table. La table renvoie simplement un flux pour lire ou écrire des blocs. 2. Mise en œuvre des formats de données. Par exemple, si vous souhaitez envoyer des données vers un terminal `Pretty` format, vous créez un flux de sortie de bloc où vous poussez des blocs, et il les formate. -3. Effectuer des transformations de données. Disons que vous avez `IBlockInputStream` et veulent créer un flux filtré. Vous créez `FilterBlockInputStream` et l'initialiser avec votre flux de données. Puis quand vous tirez un bloc de `FilterBlockInputStream`, il extrait un bloc de votre flux, le filtre et vous renvoie le bloc filtré. Les pipelines d'exécution des requêtes sont représentés de cette façon. +3. Effectuer des transformations de données. Disons que vous avez `IBlockInputStream` et veulent créer un flux filtré. Vous créez `FilterBlockInputStream` et l’initialiser avec votre flux de données. Puis quand vous tirez un bloc de `FilterBlockInputStream`, il extrait un bloc de votre flux, le filtre et vous renvoie le bloc filtré. Les pipelines d’exécution des requêtes sont représentés de cette façon. -Il y a des transformations plus sophistiquées. Par exemple, lorsque vous tirez de `AggregatingBlockInputStream` il lit toutes les données à partir de sa source, agrégats, puis renvoie un flux de données agrégées pour vous. Un autre exemple: `UnionBlockInputStream` accepte de nombreuses sources d'entrée dans le constructeur et également un certain nombre de threads. Il lance plusieurs threads et lit à partir de plusieurs sources en parallèle. +Il y a des transformations plus sophistiquées. Par exemple, lorsque vous tirez de `AggregatingBlockInputStream` il lit toutes les données à partir de sa source, agrégats, puis renvoie un flux de données agrégées pour vous. Un autre exemple: `UnionBlockInputStream` accepte de nombreuses sources d’entrée dans le constructeur et également un certain nombre de threads. Il lance plusieurs threads et lit à partir de plusieurs sources en parallèle. -> Les flux de blocs utilisent le “pull” approche pour contrôler le flux: lorsque vous extrayez un bloc du premier flux, il extrait par conséquent les blocs requis des flux imbriqués, et l'ensemble du pipeline d'exécution fonctionnera. Ni “pull” ni “push” est la meilleure solution, car le flux de contrôle est implicite, ce qui limite l'implémentation de diverses fonctionnalités telles que l'exécution simultanée de plusieurs requêtes (fusion de plusieurs pipelines ensemble). Cette limitation pourrait être surmontée avec des coroutines ou simplement en exécutant des threads supplémentaires qui s'attendent les uns aux autres. Nous pouvons avoir plus de possibilités si nous rendons le flux de contrôle explicite: si nous localisons la logique pour passer des données d'une unité de calcul à une autre en dehors de ces unités de calcul. Lire ce [article](http://journal.stuffwithstuff.com/2013/01/13/iteration-inside-and-out/) pour plus de pensées. +> Les flux de blocs utilisent le “pull” approche pour contrôler le flux: lorsque vous extrayez un bloc du premier flux, il extrait par conséquent les blocs requis des flux imbriqués, et l’ensemble du pipeline d’exécution fonctionnera. Ni “pull” ni “push” est la meilleure solution, car le flux de contrôle est implicite, ce qui limite l’implémentation de diverses fonctionnalités telles que l’exécution simultanée de plusieurs requêtes (fusion de plusieurs pipelines ensemble). Cette limitation pourrait être surmontée avec des coroutines ou simplement en exécutant des threads supplémentaires qui s’attendent les uns aux autres. Nous pouvons avoir plus de possibilités si nous rendons le flux de contrôle explicite: si nous localisons la logique pour passer des données d’une unité de calcul à une autre en dehors de ces unités de calcul. Lire ce [article](http://journal.stuffwithstuff.com/2013/01/13/iteration-inside-and-out/) pour plus de pensées. -Il convient de noter que le pipeline d'exécution de la requête crée des données temporaires à chaque étape. Nous essayons de garder la taille du bloc suffisamment petite pour que les données temporaires tiennent dans le cache du processeur. Avec cette hypothèse, l'écriture et la lecture de données temporaires sont presque libres en comparaison avec d'autres calculs. Nous pourrions envisager une alternative, qui est de fusionner de nombreuses opérations dans le pipeline ensemble. Cela pourrait rendre le pipeline aussi court que possible et supprimer une grande partie des données temporaires, ce qui pourrait être un avantage, mais cela présente également des inconvénients. Par exemple, un pipeline divisé facilite l'implémentation de la mise en cache de données intermédiaires, le vol de données intermédiaires à partir de requêtes similaires exécutées en même temps et la fusion de pipelines pour des requêtes similaires. +Il convient de noter que le pipeline d’exécution de la requête crée des données temporaires à chaque étape. Nous essayons de garder la taille du bloc suffisamment petite pour que les données temporaires tiennent dans le cache du processeur. Avec cette hypothèse, l’écriture et la lecture de données temporaires sont presque libres en comparaison avec d’autres calculs. Nous pourrions envisager une alternative, qui est de fusionner de nombreuses opérations dans le pipeline ensemble. Cela pourrait rendre le pipeline aussi court que possible et supprimer une grande partie des données temporaires, ce qui pourrait être un avantage, mais cela présente également des inconvénients. Par exemple, un pipeline divisé facilite l’implémentation de la mise en cache de données intermédiaires, le vol de données intermédiaires à partir de requêtes similaires exécutées en même temps et la fusion de pipelines pour des requêtes similaires. ## Format {#formats} -Les formats de données sont implémentés avec des flux de blocs. Il y a “presentational” formats appropriés uniquement pour la sortie de données vers le client, tels que `Pretty` format, qui fournit seulement `IBlockOutputStream`. Et il existe des formats d'entrée / sortie, tels que `TabSeparated` ou `JSONEachRow`. +Les formats de données sont implémentés avec des flux de blocs. Il y a “presentational” formats appropriés uniquement pour la sortie de données vers le client, tels que `Pretty` format, qui fournit seulement `IBlockOutputStream`. Et il existe des formats d’entrée / sortie, tels que `TabSeparated` ou `JSONEachRow`. Il y a aussi des flux de lignes: `IRowInputStream` et `IRowOutputStream`. Ils vous permettent de tirer/pousser des données par des lignes individuelles, pas par des blocs. Et ils ne sont nécessaires que pour simplifier la mise en œuvre des formats orientés ligne. Wrapper `BlockInputStreamFromRowInputStream` et `BlockOutputStreamFromRowOutputStream` vous permet de convertir des flux orientés ligne en flux orientés blocs réguliers. ## I/O {#io} -Pour l'entrée/sortie orientée octet, il y a `ReadBuffer` et `WriteBuffer` les classes abstraites. Ils sont utilisés à la place de C++ `iostream`s. Ne vous inquiétez pas: chaque projet c++ mature utilise autre chose que `iostream`s pour de bonnes raisons. +Pour l’entrée/sortie orientée octet, il y a `ReadBuffer` et `WriteBuffer` les classes abstraites. Ils sont utilisés à la place de C++ `iostream`s. Ne vous inquiétez pas: chaque projet c++ mature utilise autre chose que `iostream`s pour de bonnes raisons. `ReadBuffer` et `WriteBuffer` sont juste un tampon contigu et un curseur pointant vers la position dans ce tampon. Les implémentations peuvent posséder ou non la mémoire du tampon. Il existe une méthode virtuelle pour remplir le tampon avec les données suivantes (pour `ReadBuffer`) ou pour vider le tampon quelque part (pour `WriteBuffer`). Les méthodes virtuelles sont rarement cités. Les implémentations de `ReadBuffer`/`WriteBuffer` sont utilisés pour travailler avec des fichiers et des descripteurs de fichiers et des sockets réseau, pour implémenter la compression (`CompressedWriteBuffer` is initialized with another WriteBuffer and performs compression before writing data to it), and for other purposes – the names `ConcatReadBuffer`, `LimitReadBuffer`, et `HashingWriteBuffer` parler pour eux-mêmes. -Read / WriteBuffers ne traite que les octets. Il y a des fonctions de `ReadHelpers` et `WriteHelpers` fichiers d'en-tête pour aider à formater l'entrée / sortie. Par exemple, il existe des assistants pour écrire un nombre au format décimal. +Read / WriteBuffers ne traite que les octets. Il y a des fonctions de `ReadHelpers` et `WriteHelpers` fichiers d’en-tête pour aider à formater l’entrée / sortie. Par exemple, il existe des assistants pour écrire un nombre au format décimal. Regardons ce qui se passe lorsque vous voulez écrire un ensemble de résultats dans `JSON` format de sortie standard (stdout). Vous avez un jeu de résultats prêt à être récupéré `IBlockInputStream`. Vous créez `WriteBufferFromFileDescriptor(STDOUT_FILENO)` pour écrire des octets dans stdout. Vous créez `JSONRowOutputStream`, initialisé avec qui `WriteBuffer`, pour écrire des lignes dans `JSON` à stdout. Vous créez `BlockOutputStreamFromRowOutputStream` de plus, pour la représenter comme `IBlockOutputStream`. Ensuite, vous appelez `copyData` pour transférer des données de `IBlockInputStream` de `IBlockOutputStream` et tout fonctionne. Interne, `JSONRowOutputStream` écrira divers délimiteurs JSON et appellera `IDataType::serializeTextJSON` méthode avec une référence à `IColumn` et le numéro de ligne comme arguments. Conséquent, `IDataType::serializeTextJSON` appellera une méthode de `WriteHelpers.h`: exemple, `writeText` pour les types numériques et `writeJSONString` pour `DataTypeString`. ## Table {#tables} -Le `IStorage` l'interface représente les tables. Différentes implémentations de cette interface sont des moteurs de table différents. Les exemples sont `StorageMergeTree`, `StorageMemory` et ainsi de suite. Les Instances de ces classes ne sont que des tables. +Le `IStorage` l’interface représente les tables. Différentes implémentations de cette interface sont des moteurs de table différents. Les exemples sont `StorageMergeTree`, `StorageMemory` et ainsi de suite. Les Instances de ces classes ne sont que des tables. -Clé `IStorage` les méthodes sont `read` et `write`. Il y a aussi des `alter`, `rename`, `drop` et ainsi de suite. Le `read` méthode accepte les arguments suivants: l'ensemble de colonnes à lire à partir d'un tableau, l' `AST` requête à considérer, et le nombre souhaité de flux de retour. Il renvoie un ou plusieurs `IBlockInputStream` objets et informations sur l'étape de traitement des données qui a été effectuée dans un moteur de table lors de l'exécution de la requête. +Clé `IStorage` les méthodes sont `read` et `write`. Il y a aussi des `alter`, `rename`, `drop` et ainsi de suite. Le `read` méthode accepte les arguments suivants: l’ensemble de colonnes à lire à partir d’un tableau, l’ `AST` requête à considérer, et le nombre souhaité de flux de retour. Il renvoie un ou plusieurs `IBlockInputStream` objets et informations sur l’étape de traitement des données qui a été effectuée dans un moteur de table lors de l’exécution de la requête. -Dans la plupart des cas, la méthode read n'est responsable que de la lecture des colonnes spécifiées à partir d'une table, et non d'un traitement ultérieur des données. Tout traitement ultérieur des données est effectué par l'interpréteur de requêtes et n'est pas de la responsabilité de `IStorage`. +Dans la plupart des cas, la méthode read n’est responsable que de la lecture des colonnes spécifiées à partir d’une table, et non d’un traitement ultérieur des données. Tout traitement ultérieur des données est effectué par l’interpréteur de requêtes et n’est pas de la responsabilité de `IStorage`. Mais il y a des exceptions notables: -- La requête AST est transmise au `read` et le moteur de table peut l'utiliser pour dériver l'utilisation de l'index et pour lire moins de données à partir d'une table. -- Parfois, le moteur de table peut traiter les données lui-même à une étape spécifique. Exemple, `StorageDistributed` peut envoyer une requête aux serveurs distants, leur demander de traiter les données à une étape où les données de différents serveurs distants peuvent être fusionnées, et renvoyer ces données prétraitées. L'interpréteur de requête termine ensuite le traitement des données. +- La requête AST est transmise au `read` et le moteur de table peut l’utiliser pour dériver l’utilisation de l’index et pour lire moins de données à partir d’une table. +- Parfois, le moteur de table peut traiter les données lui-même à une étape spécifique. Exemple, `StorageDistributed` peut envoyer une requête aux serveurs distants, leur demander de traiter les données à une étape où les données de différents serveurs distants peuvent être fusionnées, et renvoyer ces données prétraitées. L’interpréteur de requête termine ensuite le traitement des données. -Table `read` la méthode peut retourner plusieurs `IBlockInputStream` objets permettant le traitement parallèle des données. Ces flux d'entrée de bloc multiples peuvent lire à partir d'une table en parallèle. Ensuite, vous pouvez envelopper ces flux avec diverses transformations (telles que l'évaluation d'expression ou le filtrage) qui peuvent être calculées indépendamment et créer un `UnionBlockInputStream` en plus d'eux, pour lire à partir de plusieurs flux en parallèle. +Table `read` la méthode peut retourner plusieurs `IBlockInputStream` objets permettant le traitement parallèle des données. Ces flux d’entrée de bloc multiples peuvent lire à partir d’une table en parallèle. Ensuite, vous pouvez envelopper ces flux avec diverses transformations (telles que l’évaluation d’expression ou le filtrage) qui peuvent être calculées indépendamment et créer un `UnionBlockInputStream` en plus d’eux, pour lire à partir de plusieurs flux en parallèle. -Il y a aussi des `TableFunction`s. Ce sont des fonctions qui renvoient un `IStorage` objet à utiliser dans le `FROM` la clause d'une requête. +Il y a aussi des `TableFunction`s. Ce sont des fonctions qui renvoient un `IStorage` objet à utiliser dans le `FROM` la clause d’une requête. -Pour avoir une idée rapide de la façon d'implémenter votre moteur de table, regardez quelque chose de simple, comme `StorageMemory` ou `StorageTinyLog`. +Pour avoir une idée rapide de la façon d’implémenter votre moteur de table, regardez quelque chose de simple, comme `StorageMemory` ou `StorageTinyLog`. -> Comme le résultat de l' `read` méthode, `IStorage` retourner `QueryProcessingStage` – information about what parts of the query were already calculated inside storage. +> Comme le résultat de l’ `read` méthode, `IStorage` retourner `QueryProcessingStage` – information about what parts of the query were already calculated inside storage. ## Analyseur {#parsers} Un analyseur de descente récursif écrit à la main analyse une requête. Exemple, `ParserSelectQuery` appelle simplement récursivement les analyseurs sous-jacents pour diverses parties de la requête. Les analyseurs créent un `AST`. Le `AST` est représenté par des nœuds, qui sont des instances de `IAST`. -> Les générateurs d'analyseurs ne sont pas utilisés pour des raisons historiques. +> Les générateurs d’analyseurs ne sont pas utilisés pour des raisons historiques. ## Interprète {#interpreters} -Les interprètes sont responsables de la création du pipeline d'exécution des requêtes à partir `AST`. Il existe des interprètes simples, tels que `InterpreterExistsQuery` et `InterpreterDropQuery` ou le plus sophistiqué de `InterpreterSelectQuery`. Le pipeline d'exécution de requête est une combinaison de flux d'entrée ou de sortie de bloc. Par exemple, le résultat de l'interprétation de la `SELECT` la requête est la `IBlockInputStream` pour lire le jeu de résultats; le résultat de la requête d'INSERTION est l' `IBlockOutputStream` pour écrire des données à insérer, et le résultat de l'interprétation `INSERT SELECT` la requête est la `IBlockInputStream` cela renvoie un jeu de résultats vide lors de la première lecture, mais qui copie `SELECT` de `INSERT` dans le même temps. +Les interprètes sont responsables de la création du pipeline d’exécution des requêtes à partir `AST`. Il existe des interprètes simples, tels que `InterpreterExistsQuery` et `InterpreterDropQuery` ou le plus sophistiqué de `InterpreterSelectQuery`. Le pipeline d’exécution de requête est une combinaison de flux d’entrée ou de sortie de bloc. Par exemple, le résultat de l’interprétation de la `SELECT` la requête est la `IBlockInputStream` pour lire le jeu de résultats; le résultat de la requête d’INSERTION est l’ `IBlockOutputStream` pour écrire des données à insérer, et le résultat de l’interprétation `INSERT SELECT` la requête est la `IBlockInputStream` cela renvoie un jeu de résultats vide lors de la première lecture, mais qui copie `SELECT` de `INSERT` dans le même temps. -`InterpreterSelectQuery` utiliser `ExpressionAnalyzer` et `ExpressionActions` machines pour l'analyse des requêtes et des transformations. C'est là que la plupart des optimisations de requêtes basées sur des règles sont effectuées. `ExpressionAnalyzer` est assez désordonné et devrait être réécrit: diverses transformations et optimisations de requête doivent être extraites dans des classes séparées pour permettre des transformations modulaires ou une requête. +`InterpreterSelectQuery` utiliser `ExpressionAnalyzer` et `ExpressionActions` machines pour l’analyse des requêtes et des transformations. C’est là que la plupart des optimisations de requêtes basées sur des règles sont effectuées. `ExpressionAnalyzer` est assez désordonné et devrait être réécrit: diverses transformations et optimisations de requête doivent être extraites dans des classes séparées pour permettre des transformations modulaires ou une requête. ## Fonction {#functions} -Il y a des fonctions ordinaires et des fonctions agrégées. Pour les fonctions d'agrégation, voir la section suivante. +Il y a des fonctions ordinaires et des fonctions agrégées. Pour les fonctions d’agrégation, voir la section suivante. -Ordinary functions don't change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`'s de données pour implémenter l'exécution de requête vectorisée. +Ordinary functions don’t change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`’s de données pour implémenter l’exécution de requête vectorisée. -Il y a quelques fonctions diverses, comme [la taille de bloc](../sql_reference/functions/other_functions.md#function-blocksize), [rowNumberInBlock](../sql_reference/functions/other_functions.md#function-rownumberinblock), et [runningAccumulate](../sql_reference/functions/other_functions.md#function-runningaccumulate), qui exploitent le traitement de bloc et violent l'indépendance des lignes. +Il y a quelques fonctions diverses, comme [la taille de bloc](../sql-reference/functions/other-functions.md#function-blocksize), [rowNumberInBlock](../sql-reference/functions/other-functions.md#function-rownumberinblock), et [runningAccumulate](../sql-reference/functions/other-functions.md#function-runningaccumulate), qui exploitent le traitement de bloc et violent l’indépendance des lignes. -ClickHouse a un typage fort, donc il n'y a pas de conversion de type implicite. Si une fonction ne prend pas en charge une combinaison spécifique de types, elle lève une exception. Mais les fonctions peuvent fonctionner (être surchargées) pour de nombreuses combinaisons de types différentes. Par exemple, l' `plus` fonction (pour mettre en œuvre la `+` opérateur) fonctionne pour toute combinaison de types numériques: `UInt8` + `Float32`, `UInt16` + `Int8` et ainsi de suite. En outre, certaines fonctions variadiques peuvent accepter n'importe quel nombre d'arguments, tels que `concat` fonction. +ClickHouse a un typage fort, donc il n’y a pas de conversion de type implicite. Si une fonction ne prend pas en charge une combinaison spécifique de types, elle lève une exception. Mais les fonctions peuvent fonctionner (être surchargées) pour de nombreuses combinaisons de types différentes. Par exemple, l’ `plus` fonction (pour mettre en œuvre la `+` opérateur) fonctionne pour toute combinaison de types numériques: `UInt8` + `Float32`, `UInt16` + `Int8` et ainsi de suite. En outre, certaines fonctions variadiques peuvent accepter n’importe quel nombre d’arguments, tels que `concat` fonction. -L'implémentation d'une fonction peut être légèrement gênante car une fonction distribue explicitement les types de données pris en charge et pris en charge `IColumns`. Par exemple, l' `plus` la fonction a du code généré par l'instanciation D'un modèle C++ pour chaque combinaison de types numériques, et des arguments gauche et droit constants ou non constants. +L’implémentation d’une fonction peut être légèrement gênante car une fonction distribue explicitement les types de données pris en charge et pris en charge `IColumns`. Par exemple, l’ `plus` la fonction a du code généré par l’instanciation D’un modèle C++ pour chaque combinaison de types numériques, et des arguments gauche et droit constants ou non constants. -C'est un excellent endroit pour implémenter la génération de code d'exécution pour éviter le gonflement du code de modèle. En outre, il permet d'ajouter des fonctions fusionnées comme Fusionné Multiplier-Ajouter ou de faire plusieurs comparaisons dans une itération de boucle. +C’est un excellent endroit pour implémenter la génération de code d’exécution pour éviter le gonflement du code de modèle. En outre, il permet d’ajouter des fonctions fusionnées comme Fusionné Multiplier-Ajouter ou de faire plusieurs comparaisons dans une itération de boucle. -En raison de l'exécution de requête vectorisée, les fonctions ne sont pas court-circuitées. Par exemple, si vous écrivez `WHERE f(x) AND g(y)` les deux faces sont calculés, même pour les lignes, quand `f(x)` est égal à zéro (sauf quand `f(x)` est une expression constante nulle). Mais si la sélectivité de l' `f(x)` la condition est élevée, et le calcul de `f(x)` est beaucoup moins cher que `g(y)`, il est préférable d'implémenter le calcul multi-pass. Il serait d'abord calculer `f(x)` puis filtrer les colonnes par la suite, puis de calculer `g(y)` uniquement pour les petits morceaux de données filtrés. +En raison de l’exécution de requête vectorisée, les fonctions ne sont pas court-circuitées. Par exemple, si vous écrivez `WHERE f(x) AND g(y)` les deux faces sont calculés, même pour les lignes, quand `f(x)` est égal à zéro (sauf quand `f(x)` est une expression constante nulle). Mais si la sélectivité de l’ `f(x)` la condition est élevée, et le calcul de `f(x)` est beaucoup moins cher que `g(y)`, il est préférable d’implémenter le calcul multi-pass. Il serait d’abord calculer `f(x)` puis filtrer les colonnes par la suite, puis de calculer `g(y)` uniquement pour les petits morceaux de données filtrés. -## Les Fonctions D'Agrégation {#aggregate-functions} +## Les Fonctions D’Agrégation {#aggregate-functions} -Les fonctions d'agrégation sont des fonctions avec État. Ils accumulent les valeurs passées dans certains etats et vous permettent d'obtenir des résultats de cet état. Ils sont gérés avec le `IAggregateFunction` interface. Les États peuvent être assez simples (l'État pour `AggregateFunctionCount` est juste un seul `UInt64` valeur) ou très complexes (l'état de `AggregateFunctionUniqCombined` est une combinaison linéaire du tableau, d'une table de hachage, et un `HyperLogLog` structure probabiliste des données). +Les fonctions d’agrégation sont des fonctions avec État. Ils accumulent les valeurs passées dans certains etats et vous permettent d’obtenir des résultats de cet état. Ils sont gérés avec le `IAggregateFunction` interface. Les États peuvent être assez simples (l’État pour `AggregateFunctionCount` est juste un seul `UInt64` valeur) ou très complexes (l’état de `AggregateFunctionUniqCombined` est une combinaison linéaire du tableau, d’une table de hachage, et un `HyperLogLog` structure probabiliste des données). -Les États sont répartis en `Arena` (un pool de mémoire) pour traiter plusieurs états lors de l'exécution d'une cardinalité élevée `GROUP BY` requête. Les États peuvent avoir un constructeur et un destructeur non triviaux: par exemple, les États d'agrégation compliqués peuvent allouer eux-mêmes de la mémoire supplémentaire. Il faut accorder une certaine attention à la création et à la destruction des États et à la transmission appropriée de leur propriété et de leur ordre de destruction. +Les États sont répartis en `Arena` (un pool de mémoire) pour traiter plusieurs états lors de l’exécution d’une cardinalité élevée `GROUP BY` requête. Les États peuvent avoir un constructeur et un destructeur non triviaux: par exemple, les États d’agrégation compliqués peuvent allouer eux-mêmes de la mémoire supplémentaire. Il faut accorder une certaine attention à la création et à la destruction des États et à la transmission appropriée de leur propriété et de leur ordre de destruction. -Les États d'agrégation peuvent être sérialisés et désérialisés pour passer sur le réseau pendant l'exécution de la requête distribuée ou pour les écrire sur le disque où il n'y a pas assez de RAM. Ils peuvent même être stockés dans une table avec le `DataTypeAggregateFunction` pour permettre l'agrégation incrémentielle des données. +Les États d’agrégation peuvent être sérialisés et désérialisés pour passer sur le réseau pendant l’exécution de la requête distribuée ou pour les écrire sur le disque où il n’y a pas assez de RAM. Ils peuvent même être stockés dans une table avec le `DataTypeAggregateFunction` pour permettre l’agrégation incrémentielle des données. -> Le format de données sérialisé pour les états de fonction d'agrégat n'est pas versionné pour le moment. C'est ok si les États d'agrégat ne sont stockés que temporairement. Mais nous avons l' `AggregatingMergeTree` moteur de table pour l'agrégation incrémentielle, et les gens l'utilisent déjà en production. C'est la raison pour laquelle la rétrocompatibilité est requise lors de la modification du format sérialisé pour toute fonction d'agrégat à l'avenir. +> Le format de données sérialisé pour les états de fonction d’agrégat n’est pas versionné pour le moment. C’est ok si les États d’agrégat ne sont stockés que temporairement. Mais nous avons l’ `AggregatingMergeTree` moteur de table pour l’agrégation incrémentielle, et les gens l’utilisent déjà en production. C’est la raison pour laquelle la rétrocompatibilité est requise lors de la modification du format sérialisé pour toute fonction d’agrégat à l’avenir. ## Serveur {#server} Le serveur implémente plusieurs interfaces différentes: - Une interface HTTP pour tous les clients étrangers. -- Une interface TCP pour le client clickhouse natif et pour la communication inter-serveur lors de l'exécution de la requête distribuée. +- Une interface TCP pour le client clickhouse natif et pour la communication inter-serveur lors de l’exécution de la requête distribuée. - Une interface pour transférer des données pour la réplication. -En interne, il s'agit simplement d'un serveur multithread primitif sans coroutines ni fibres. Étant donné que le serveur n'est pas conçu pour traiter un taux élevé de requêtes simples, mais pour traiter un taux relativement faible de requêtes complexes, chacun d'eux peut traiter une grande quantité de données à des fins d'analyse. +En interne, il s’agit simplement d’un serveur multithread primitif sans coroutines ni fibres. Étant donné que le serveur n’est pas conçu pour traiter un taux élevé de requêtes simples, mais pour traiter un taux relativement faible de requêtes complexes, chacun d’eux peut traiter une grande quantité de données à des fins d’analyse. -Le serveur initialise le `Context` classe avec l'environnement nécessaire à l'exécution des requêtes: la liste des bases de données disponibles, des utilisateurs et des droits d'accès, des paramètres, des clusters, la liste des processus, le journal des requêtes, etc. Les interprètes utilisent cet environnement. +Le serveur initialise le `Context` classe avec l’environnement nécessaire à l’exécution des requêtes: la liste des bases de données disponibles, des utilisateurs et des droits d’accès, des paramètres, des clusters, la liste des processus, le journal des requêtes, etc. Les interprètes utilisent cet environnement. -Nous maintenons une compatibilité ascendante et descendante complète pour le protocole TCP du serveur: les anciens clients peuvent parler à de nouveaux serveurs, et les nouveaux clients peuvent parler à d'anciens serveurs. Mais nous ne voulons pas le maintenir éternellement, et nous supprimons le support pour les anciennes versions après environ un an. +Nous maintenons une compatibilité ascendante et descendante complète pour le protocole TCP du serveur: les anciens clients peuvent parler à de nouveaux serveurs, et les nouveaux clients peuvent parler à d’anciens serveurs. Mais nous ne voulons pas le maintenir éternellement, et nous supprimons le support pour les anciennes versions après environ un an. !!! note "Note" - Pour la plupart des applications externes, nous vous recommandons d'utiliser L'interface HTTP car elle est simple et facile à utiliser. Le protocole TCP est plus étroitement lié aux structures de données internes: il utilise un format interne pour passer des blocs de données, et il utilise un cadrage personnalisé pour les données compressées. Nous n'avons pas publié de bibliothèque C pour ce protocole car elle nécessite de lier la plupart de la base de code ClickHouse, ce qui n'est pas pratique. + Pour la plupart des applications externes, nous vous recommandons d’utiliser L’interface HTTP car elle est simple et facile à utiliser. Le protocole TCP est plus étroitement lié aux structures de données internes: il utilise un format interne pour passer des blocs de données, et il utilise un cadrage personnalisé pour les données compressées. Nous n’avons pas publié de bibliothèque C pour ce protocole car elle nécessite de lier la plupart de la base de code ClickHouse, ce qui n’est pas pratique. ## Exécution De Requête Distribuée {#distributed-query-execution} -Les serveurs d'une configuration de cluster sont pour la plupart indépendants. Vous pouvez créer un `Distributed` table sur un ou tous les serveurs dans un cluster. Le `Distributed` table does not store data itself – it only provides a “view” à toutes les tables sur plusieurs nœuds d'un cluster. Lorsque vous sélectionnez à partir d'un `Distributed` table, il réécrit cette requête, choisit les nœuds distants en fonction des paramètres d'équilibrage de charge et leur envoie la requête. Le `Distributed` table demande aux serveurs distants de traiter une requête jusqu'à une étape où les résultats intermédiaires de différents serveurs peuvent être fusionnés. Puis il reçoit les résultats intermédiaires et les fusionne. La table distribuée essaie de distribuer autant de travail que possible aux serveurs distants et n'envoie pas beaucoup de données intermédiaires sur le réseau. +Les serveurs d’une configuration de cluster sont pour la plupart indépendants. Vous pouvez créer un `Distributed` table sur un ou tous les serveurs dans un cluster. Le `Distributed` table does not store data itself – it only provides a “view” à toutes les tables sur plusieurs nœuds d’un cluster. Lorsque vous sélectionnez à partir d’un `Distributed` table, il réécrit cette requête, choisit les nœuds distants en fonction des paramètres d’équilibrage de charge et leur envoie la requête. Le `Distributed` table demande aux serveurs distants de traiter une requête jusqu’à une étape où les résultats intermédiaires de différents serveurs peuvent être fusionnés. Puis il reçoit les résultats intermédiaires et les fusionne. La table distribuée essaie de distribuer autant de travail que possible aux serveurs distants et n’envoie pas beaucoup de données intermédiaires sur le réseau. -Les choses deviennent plus compliquées lorsque vous avez des sous-requêtes dans des clauses IN ou JOIN, et que chacune d'elles utilise un `Distributed` table. Nous avons différentes stratégies pour l'exécution de ces requêtes. +Les choses deviennent plus compliquées lorsque vous avez des sous-requêtes dans des clauses IN ou JOIN, et que chacune d’elles utilise un `Distributed` table. Nous avons différentes stratégies pour l’exécution de ces requêtes. -Il n'existe pas de plan de requête global pour l'exécution des requêtes distribuées. Chaque nœud a son plan de requête local pour sa partie du travail. Nous n'avons qu'une simple exécution de requête distribuée en une seule passe: nous envoyons des requêtes pour les nœuds distants, puis fusionnons les résultats. Mais cela n'est pas possible pour les requêtes compliquées avec des groupes de cardinalité élevés ou avec une grande quantité de données temporaires pour la jointure. Dans de tels cas, nous avons besoin de “reshuffle” données entre les serveurs, ce qui nécessite une coordination supplémentaire. ClickHouse ne supporte pas ce type d'exécution de requête, et nous devons y travailler. +Il n’existe pas de plan de requête global pour l’exécution des requêtes distribuées. Chaque nœud a son plan de requête local pour sa partie du travail. Nous n’avons qu’une simple exécution de requête distribuée en une seule passe: nous envoyons des requêtes pour les nœuds distants, puis fusionnons les résultats. Mais cela n’est pas possible pour les requêtes compliquées avec des groupes de cardinalité élevés ou avec une grande quantité de données temporaires pour la jointure. Dans de tels cas, nous avons besoin de “reshuffle” données entre les serveurs, ce qui nécessite une coordination supplémentaire. ClickHouse ne supporte pas ce type d’exécution de requête, et nous devons y travailler. -## Fusion De L'Arbre {#merge-tree} +## Fusion De L’Arbre {#merge-tree} -`MergeTree` est une famille de moteurs de stockage qui prend en charge l'indexation par clé primaire. La clé primaire peut être un tuple arbitraire de colonnes ou d'expressions. De données dans un `MergeTree` la table est stockée dans “parts”. Chaque partie stocke les données dans l'ordre de la clé primaire, de sorte que les données sont ordonnées lexicographiquement par le tuple de clé primaire. Toutes les colonnes du tableau sont stockés dans différents `column.bin` les fichiers dans ces régions. Les fichiers sont constitués de blocs compressés. Chaque bloc est généralement de 64 KO à 1 Mo de données non compressées, en fonction de la taille de la valeur moyenne. Les blocs sont constitués de valeurs de colonne placées de manière contiguë l'une après l'autre. Les valeurs de colonne sont dans le même ordre pour chaque colonne (la clé primaire définit l'ordre), donc lorsque vous itérez par plusieurs colonnes, vous obtenez des valeurs pour les lignes correspondantes. +`MergeTree` est une famille de moteurs de stockage qui prend en charge l’indexation par clé primaire. La clé primaire peut être un tuple arbitraire de colonnes ou d’expressions. De données dans un `MergeTree` la table est stockée dans “parts”. Chaque partie stocke les données dans l’ordre de la clé primaire, de sorte que les données sont ordonnées lexicographiquement par le tuple de clé primaire. Toutes les colonnes du tableau sont stockés dans différents `column.bin` les fichiers dans ces régions. Les fichiers sont constitués de blocs compressés. Chaque bloc est généralement de 64 KO à 1 Mo de données non compressées, en fonction de la taille de la valeur moyenne. Les blocs sont constitués de valeurs de colonne placées de manière contiguë l’une après l’autre. Les valeurs de colonne sont dans le même ordre pour chaque colonne (la clé primaire définit l’ordre), donc lorsque vous itérez par plusieurs colonnes, vous obtenez des valeurs pour les lignes correspondantes. -La clé primaire elle-même est “sparse”. Il ne traite pas chaque ligne, mais seulement certaines plages de données. Séparé `primary.idx` fichier a la valeur de la clé primaire pour chaque N-ième ligne, où N est appelé `index_granularity` (habituellement, N = 8192). Aussi, pour chaque colonne, nous avons `column.mrk` les fichiers avec l' “marks,” qui sont des décalages à chaque N-ème ligne dans le fichier de données. Chaque marque est une paire: le décalage dans le fichier au début du bloc compressé, et le décalage dans le bloc décompressé au début des données. Habituellement, les blocs compressés sont alignés par des marques, et le décalage dans le bloc décompressé est nul. Les données pour `primary.idx` réside toujours dans la mémoire, et les données pour `column.mrk` les fichiers sont mis en cache. +La clé primaire elle-même est “sparse”. Il ne traite pas chaque ligne, mais seulement certaines plages de données. Séparé `primary.idx` fichier a la valeur de la clé primaire pour chaque N-ième ligne, où N est appelé `index_granularity` (habituellement, N = 8192). Aussi, pour chaque colonne, nous avons `column.mrk` les fichiers avec l’ “marks,” qui sont des décalages à chaque N-ème ligne dans le fichier de données. Chaque marque est une paire: le décalage dans le fichier au début du bloc compressé, et le décalage dans le bloc décompressé au début des données. Habituellement, les blocs compressés sont alignés par des marques, et le décalage dans le bloc décompressé est nul. Les données pour `primary.idx` réside toujours dans la mémoire, et les données pour `column.mrk` les fichiers sont mis en cache. -Quand nous allons lire quelque chose d'une partie dans `MergeTree` nous regardons `primary.idx` données et locate plages qui pourraient contenir des données demandées, puis regardez `column.mrk` données et calculer des décalages pour savoir où commencer à lire ces plages. En raison de la rareté, les données excédentaires peuvent être lues. ClickHouse ne convient pas à une charge élevée de requêtes ponctuelles simples, car toute la gamme avec `index_granularity` les lignes doivent être lues pour chaque clé, et le bloc compressé entier doit être décompressé pour chaque colonne. Nous avons rendu l'index clairsemé parce que nous devons être en mesure de maintenir des milliards de lignes par serveur unique sans consommation de mémoire notable pour l'index. De plus, comme la clé primaire est clairsemée, elle n'est pas unique: elle ne peut pas vérifier l'existence de la clé dans la table au moment de l'insertion. Vous pourriez avoir plusieurs lignes avec la même clé dans une table. +Quand nous allons lire quelque chose d’une partie dans `MergeTree` nous regardons `primary.idx` données et locate plages qui pourraient contenir des données demandées, puis regardez `column.mrk` données et calculer des décalages pour savoir où commencer à lire ces plages. En raison de la rareté, les données excédentaires peuvent être lues. ClickHouse ne convient pas à une charge élevée de requêtes ponctuelles simples, car toute la gamme avec `index_granularity` les lignes doivent être lues pour chaque clé, et le bloc compressé entier doit être décompressé pour chaque colonne. Nous avons rendu l’index clairsemé parce que nous devons être en mesure de maintenir des milliards de lignes par serveur unique sans consommation de mémoire notable pour l’index. De plus, comme la clé primaire est clairsemée, elle n’est pas unique: elle ne peut pas vérifier l’existence de la clé dans la table au moment de l’insertion. Vous pourriez avoir plusieurs lignes avec la même clé dans une table. -Lorsque vous `INSERT` un tas de données dans `MergeTree`, ce groupe est trié par ordre de clé primaire et forme une nouvelle partie. Il existe des threads d'arrière-plan qui sélectionnent périodiquement certaines parties et les fusionnent en une seule partie triée pour maintenir le nombre de parties relativement faible. C'est pourquoi il est appelé `MergeTree`. Bien sûr, la fusion conduit à “write amplification”. Toutes les parties sont immuables: elles sont seulement créées et supprimées, mais pas modifiées. Lorsque SELECT est exécuté, il contient un instantané de la table (un ensemble de parties). Après la Fusion, nous conservons également les anciennes pièces pendant un certain temps pour faciliter une récupération après une défaillance, donc si nous voyons qu'une partie fusionnée est probablement cassée, nous pouvons la remplacer par ses parties sources. +Lorsque vous `INSERT` un tas de données dans `MergeTree`, ce groupe est trié par ordre de clé primaire et forme une nouvelle partie. Il existe des threads d’arrière-plan qui sélectionnent périodiquement certaines parties et les fusionnent en une seule partie triée pour maintenir le nombre de parties relativement faible. C’est pourquoi il est appelé `MergeTree`. Bien sûr, la fusion conduit à “write amplification”. Toutes les parties sont immuables: elles sont seulement créées et supprimées, mais pas modifiées. Lorsque SELECT est exécuté, il contient un instantané de la table (un ensemble de parties). Après la Fusion, nous conservons également les anciennes pièces pendant un certain temps pour faciliter une récupération après une défaillance, donc si nous voyons qu’une partie fusionnée est probablement cassée, nous pouvons la remplacer par ses parties sources. -`MergeTree` n'est pas un arbre LSM car il ne contient pas “memtable” et “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity's sake, and because we are already inserting data in batches in our applications. +`MergeTree` n’est pas un arbre LSM car il ne contient pas “memtable” et “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity’s sake, and because we are already inserting data in batches in our applications. -> Les tables MergeTree ne peuvent avoir qu'un seul index (primaire): il n'y a pas d'index secondaires. Il serait bon d'autoriser plusieurs représentations physiques sous une table logique, par exemple, pour stocker des données dans plus d'un ordre physique ou même pour autoriser des représentations avec des données pré-agrégées avec des données originales. +> Les tables MergeTree ne peuvent avoir qu’un seul index (primaire): il n’y a pas d’index secondaires. Il serait bon d’autoriser plusieurs représentations physiques sous une table logique, par exemple, pour stocker des données dans plus d’un ordre physique ou même pour autoriser des représentations avec des données pré-agrégées avec des données originales. -Il existe des moteurs MergeTree qui effectuent un travail supplémentaire lors des fusions en arrière-plan. Les exemples sont `CollapsingMergeTree` et `AggregatingMergeTree`. Cela pourrait être traité comme un support spécial pour les mises à jour. Gardez à l'esprit que ce ne sont pas de vraies mises à jour car les utilisateurs n'ont généralement aucun contrôle sur le moment où les fusions en arrière-plan sont exécutées et les données dans un `MergeTree` la table est presque toujours stockée dans plus d'une partie, pas sous une forme complètement fusionnée. +Il existe des moteurs MergeTree qui effectuent un travail supplémentaire lors des fusions en arrière-plan. Les exemples sont `CollapsingMergeTree` et `AggregatingMergeTree`. Cela pourrait être traité comme un support spécial pour les mises à jour. Gardez à l’esprit que ce ne sont pas de vraies mises à jour car les utilisateurs n’ont généralement aucun contrôle sur le moment où les fusions en arrière-plan sont exécutées et les données dans un `MergeTree` la table est presque toujours stockée dans plus d’une partie, pas sous une forme complètement fusionnée. ## Réplication {#replication} La réplication dans ClickHouse peut être configurée sur une base par table. Vous pouvez avoir des tables répliquées et des tables non répliquées sur le même serveur. Vous pouvez également avoir des tables répliquées de différentes manières, comme une table avec une réplication à deux facteurs et une autre avec trois facteurs. -La réplication est implémentée dans le `ReplicatedMergeTree` moteur de stockage. Le chemin d'accès dans `ZooKeeper` est spécifié comme paramètre pour le moteur de stockage. Toutes les tables avec le même chemin dans `ZooKeeper` devenez des répliques les unes des autres: elles synchronisent leurs données et maintiennent la cohérence. Les répliques peuvent être ajoutées et supprimées dynamiquement simplement en créant ou en supprimant une table. +La réplication est implémentée dans le `ReplicatedMergeTree` moteur de stockage. Le chemin d’accès dans `ZooKeeper` est spécifié comme paramètre pour le moteur de stockage. Toutes les tables avec le même chemin dans `ZooKeeper` devenez des répliques les unes des autres: elles synchronisent leurs données et maintiennent la cohérence. Les répliques peuvent être ajoutées et supprimées dynamiquement simplement en créant ou en supprimant une table. -La réplication utilise un schéma multi-maître asynchrone. Vous pouvez insérer des données dans n'importe quel réplica qui a une session avec `ZooKeeper`, et les données sont répliquées à toutes les autres répliques de manière asynchrone. Parce que ClickHouse ne prend pas en charge les mises à jour, la réplication est sans conflit. Comme il n'y a pas d'accusé de réception de quorum des insertions, les données juste insérées peuvent être perdues si un nœud échoue. +La réplication utilise un schéma multi-maître asynchrone. Vous pouvez insérer des données dans n’importe quel réplica qui a une session avec `ZooKeeper`, et les données sont répliquées à toutes les autres répliques de manière asynchrone. Parce que ClickHouse ne prend pas en charge les mises à jour, la réplication est sans conflit. Comme il n’y a pas d’accusé de réception de quorum des insertions, les données juste insérées peuvent être perdues si un nœud échoue. -Les métadonnées pour la réplication sont stockées dans ZooKeeper. Il existe un journal de réplication qui répertorie les actions à effectuer. Les Actions sont: obtenir une partie; fusionner des parties; déposer une partition, et ainsi de suite. Chaque réplica copie le journal de réplication dans sa file d'attente, puis exécute les actions de la file d'attente. Par exemple, sur l'insertion, l' “get the part” l'action est créée dans le journal, et chaque réplique téléchargements de la partie. Les fusions sont coordonnées entre les répliques pour obtenir des résultats identiques aux octets. Toutes les parties sont fusionnées de la même manière sur toutes les répliques. Il est réalisé en élisant une réplique en tant que leader, et cette réplique initie fusionne et écrit “merge parts” actions dans le journal. +Les métadonnées pour la réplication sont stockées dans ZooKeeper. Il existe un journal de réplication qui répertorie les actions à effectuer. Les Actions sont: obtenir une partie; fusionner des parties; déposer une partition, et ainsi de suite. Chaque réplica copie le journal de réplication dans sa file d’attente, puis exécute les actions de la file d’attente. Par exemple, sur l’insertion, l’ “get the part” l’action est créée dans le journal, et chaque réplique téléchargements de la partie. Les fusions sont coordonnées entre les répliques pour obtenir des résultats identiques aux octets. Toutes les parties sont fusionnées de la même manière sur toutes les répliques. Il est réalisé en élisant une réplique en tant que leader, et cette réplique initie fusionne et écrit “merge parts” actions dans le journal. -La réplication est physique: seules les parties compressées sont transférées entre les nœuds, pas les requêtes. Les fusions sont traitées sur chaque réplique indépendamment dans la plupart des cas pour réduire les coûts du réseau en évitant l'amplification du réseau. Grand fusionné les pièces sont envoyées sur le réseau uniquement en cas de retard de réplication. +La réplication est physique: seules les parties compressées sont transférées entre les nœuds, pas les requêtes. Les fusions sont traitées sur chaque réplique indépendamment dans la plupart des cas pour réduire les coûts du réseau en évitant l’amplification du réseau. Grand fusionné les pièces sont envoyées sur le réseau uniquement en cas de retard de réplication. -En outre, chaque réplique stocke son état dans ZooKeeper comme l'ensemble des pièces et ses sommes de contrôle. Lorsque l'état sur le système de fichiers local diverge de l'état de référence dans ZooKeeper, le réplica restaure sa cohérence en téléchargeant les parties manquantes et brisées à partir d'autres réplicas. Lorsqu'il y a des données inattendues ou brisées dans le système de fichiers local, ClickHouse ne les supprime pas, mais les déplace dans un répertoire séparé et les oublie. +En outre, chaque réplique stocke son état dans ZooKeeper comme l’ensemble des pièces et ses sommes de contrôle. Lorsque l’état sur le système de fichiers local diverge de l’état de référence dans ZooKeeper, le réplica restaure sa cohérence en téléchargeant les parties manquantes et brisées à partir d’autres réplicas. Lorsqu’il y a des données inattendues ou brisées dans le système de fichiers local, ClickHouse ne les supprime pas, mais les déplace dans un répertoire séparé et les oublie. !!! note "Note" - Le cluster ClickHouse est constitué de fragments indépendants, et chaque fragment est constitué de répliques. Le cluster est **pas élastique**, donc, après avoir ajouté un nouveau fragment, les données ne sont pas rééquilibrées automatiquement entre les fragments. Au lieu de cela, la charge du cluster est censée être ajustée pour être inégale. Cette implémentation vous donne plus de contrôle, et c'est ok pour des clusters relativement petits, tels que des dizaines de nœuds. Mais pour les clusters avec des centaines de nœuds que nous utilisons en production, cette approche devient un inconvénient important. Nous devrions implémenter un moteur de table qui s'étend sur le cluster avec des régions répliquées dynamiquement qui pourraient être divisées et équilibrées automatiquement entre les clusters. + Le cluster ClickHouse est constitué de fragments indépendants, et chaque fragment est constitué de répliques. Le cluster est **pas élastique**, donc, après avoir ajouté un nouveau fragment, les données ne sont pas rééquilibrées automatiquement entre les fragments. Au lieu de cela, la charge du cluster est censée être ajustée pour être inégale. Cette implémentation vous donne plus de contrôle, et c’est ok pour des clusters relativement petits, tels que des dizaines de nœuds. Mais pour les clusters avec des centaines de nœuds que nous utilisons en production, cette approche devient un inconvénient important. Nous devrions implémenter un moteur de table qui s’étend sur le cluster avec des régions répliquées dynamiquement qui pourraient être divisées et équilibrées automatiquement entre les clusters. {## [Article Original](https://clickhouse.tech/docs/en/development/architecture/) ##} diff --git a/docs/fr/development/browse-code.md b/docs/fr/development/browse-code.md new file mode 100644 index 00000000000..e26a621b156 --- /dev/null +++ b/docs/fr/development/browse-code.md @@ -0,0 +1,14 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 63 +toc_title: Parcourir Le Code Source De ClickHouse +--- + +# Parcourir Le Code Source De ClickHouse {#browse-clickhouse-source-code} + +Vous pouvez utiliser **Woboq** navigateur de code en ligne disponible [ici](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/index.html). Il fournit la navigation de code et la mise en évidence sémantique, la recherche et l’indexation. L’instantané de code est mis à jour quotidiennement. + +Aussi, vous pouvez parcourir les sources sur [GitHub](https://github.com/ClickHouse/ClickHouse) comme à l’habitude. + +Si vous êtes intéressé par L’IDE à utiliser, nous vous recommandons CLion, Qt Creator, VS Code et KDevelop (avec des mises en garde). Vous pouvez utiliser N’importe quel IDE préféré. Vim et Emacs comptent également. diff --git a/docs/fr/development/browse_code.md b/docs/fr/development/browse_code.md deleted file mode 100644 index 0d708da5beb..00000000000 --- a/docs/fr/development/browse_code.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 63 -toc_title: Parcourir Le Code Source De ClickHouse ---- - -# Parcourir Le Code Source De ClickHouse {#browse-clickhouse-source-code} - -Vous pouvez utiliser **Woboq** navigateur de code en ligne disponible [ici](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/index.html). Il fournit la navigation de code et la mise en évidence sémantique, la recherche et l'indexation. L'instantané de code est mis à jour quotidiennement. - -Aussi, vous pouvez parcourir les sources sur [GitHub](https://github.com/ClickHouse/ClickHouse) comme à l'habitude. - -Si vous êtes intéressé par L'IDE à utiliser, nous vous recommandons CLion, Qt Creator, VS Code et KDevelop (avec des mises en garde). Vous pouvez utiliser N'importe quel IDE préféré. Vim et Emacs comptent également. diff --git a/docs/fr/development/build-cross-arm.md b/docs/fr/development/build-cross-arm.md new file mode 100644 index 00000000000..668a5f03376 --- /dev/null +++ b/docs/fr/development/build-cross-arm.md @@ -0,0 +1,43 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 67 +toc_title: Comment Construire ClickHouse sur Linux pour AARCH64 (ARM64) +--- + +# Comment Construire ClickHouse Sur Linux Pour l’architecture AARCH64 (ARM64) {#how-to-build-clickhouse-on-linux-for-aarch64-arm64-architecture} + +C’est pour le cas où vous avez machine Linux et que vous voulez utiliser pour construire `clickhouse` binaire qui fonctionnera sur une autre machine Linux avec une architecture CPU AARCH64. Ceci est destiné aux contrôles d’intégration continus qui s’exécutent sur des serveurs Linux. + +La construction croisée pour AARCH64 est basée sur [Instructions de construction](build.md), suivez d’abord. + +# Installer Clang-8 {#install-clang-8} + +Suivez les instructions de https://apt.llvm.org/ pour votre configuration Ubuntu ou Debian. +Par exemple, dans Ubuntu Bionic vous pouvez utiliser les commandes suivantes: + +``` bash +echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" | sudo tee /etc/apt/sources.list.d/llvm.list +sudo apt-get update +sudo apt-get install clang-8 +``` + +# Installer Un Ensemble D’Outils De Compilation Croisée {#install-cross-compilation-toolset} + +``` bash +cd ClickHouse +mkdir -p build-aarch64/cmake/toolchain/linux-aarch64 +wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9&la=en' -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz +tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cmake/toolchain/linux-aarch64 --strip-components=1 +``` + +# Construire ClickHouse {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-arm64 +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake +ninja -C build-arm64 +``` + +Le binaire résultant s’exécutera uniquement sur Linux avec l’architecture CPU AARCH64. diff --git a/docs/fr/development/build-cross-osx.md b/docs/fr/development/build-cross-osx.md new file mode 100644 index 00000000000..847c397c261 --- /dev/null +++ b/docs/fr/development/build-cross-osx.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 66 +toc_title: Comment Construire ClickHouse sur Linux pour Mac OS X +--- + +# Comment Construire ClickHouse Sur Linux Pour Mac OS X {#how-to-build-clickhouse-on-linux-for-mac-os-x} + +C’est pour le cas où vous avez machine Linux et que vous voulez utiliser pour construire `clickhouse` binaire qui s’exécutera sur OS X. Ceci est destiné aux contrôles d’intégration continus qui s’exécutent sur des serveurs Linux. Si vous voulez construire ClickHouse directement sur Mac OS X, puis procéder à [une autre instruction](build-osx.md). + +Le cross-build pour Mac OS X est basé sur le [Instructions de construction](build.md), suivez d’abord. + +# Installer Clang-8 {#install-clang-8} + +Suivez les instructions de https://apt.llvm.org/ pour votre configuration Ubuntu ou Debian. +Par exemple les commandes pour Bionic sont comme: + +``` bash +sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list +sudo apt-get install clang-8 +``` + +# Installer Un Ensemble D’Outils De Compilation Croisée {#install-cross-compilation-toolset} + +Souvenons nous du chemin où nous installons `cctools` comme ${CCTOOLS} + +``` bash +mkdir ${CCTOOLS} + +git clone https://github.com/tpoechtrager/apple-libtapi.git +cd apple-libtapi +INSTALLPREFIX=${CCTOOLS} ./build.sh +./install.sh +cd .. + +git clone https://github.com/tpoechtrager/cctools-port.git +cd cctools-port/cctools +./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin +make install +``` + +En outre, nous devons télécharger macOS X SDK dans l’arbre de travail. + +``` bash +cd ClickHouse +wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' +mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 +tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 +``` + +# Construire ClickHouse {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-osx +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ + -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ + -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ + -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld +ninja -C build-osx +``` + +Le binaire résultant aura un format exécutable Mach-O et ne pourra pas être exécuté sous Linux. diff --git a/docs/fr/development/build-osx.md b/docs/fr/development/build-osx.md new file mode 100644 index 00000000000..b8a76195b4b --- /dev/null +++ b/docs/fr/development/build-osx.md @@ -0,0 +1,93 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 65 +toc_title: Comment Construire ClickHouse sur Mac OS X +--- + +# Comment Construire ClickHouse Sur Mac OS X {#how-to-build-clickhouse-on-mac-os-x} + +Build devrait fonctionner sur Mac OS X 10.15 (Catalina) + +## Installer Homebrew {#install-homebrew} + +``` bash +$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +## Installez Les Compilateurs, Outils Et bibliothèques Requis {#install-required-compilers-tools-and-libraries} + +``` bash +$ brew install cmake ninja libtool gettext +``` + +## Commander Clickhouse Sources {#checkout-clickhouse-sources} + +``` bash +$ git clone --recursive git@github.com:ClickHouse/ClickHouse.git +``` + +ou + +``` bash +$ git clone --recursive https://github.com/ClickHouse/ClickHouse.git + +$ cd ClickHouse +``` + +## Construire ClickHouse {#build-clickhouse} + +``` bash +$ mkdir build +$ cd build +$ cmake .. -DCMAKE_CXX_COMPILER=`which clang++` -DCMAKE_C_COMPILER=`which clang` +$ ninja +$ cd .. +``` + +## Mises En Garde {#caveats} + +Si vous avez l’intention d’exécuter clickhouse-server, assurez-vous d’augmenter la variable maxfiles du système. + +!!! info "Note" + Vous aurez besoin d’utiliser sudo. + +Pour ce faire, créez le fichier suivant: + +/ Bibliothèque / LaunchDaemons / limite.maxfiles.plist: + +``` xml + + + + + Label + limit.maxfiles + ProgramArguments + + launchctl + limit + maxfiles + 524288 + 524288 + + RunAtLoad + + ServiceIPC + + + +``` + +Exécutez la commande suivante: + +``` bash +$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist +``` + +Redémarrer. + +Pour vérifier si elle fonctionne, vous pouvez utiliser `ulimit -n` commande. + +[Article Original](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/fr/development/build.md b/docs/fr/development/build.md index 0a5e5838d66..f55b5451632 100644 --- a/docs/fr/development/build.md +++ b/docs/fr/development/build.md @@ -5,13 +5,13 @@ toc_priority: 64 toc_title: Comment Construire ClickHouse sur Linux --- -# Comment Construire ClickHouse pour le développement {#how-to-build-clickhouse-for-development} +# Comment Construire ClickHouse Pour Le développement {#how-to-build-clickhouse-for-development} Le tutoriel suivant est basé sur le système Linux Ubuntu. Avec les modifications appropriées, il devrait également fonctionner sur toute autre distribution Linux. Plates-formes prises en charge: x86\_64 et AArch64. La prise en charge de Power9 est expérimentale. -## Installez Git, CMake, Python et Ninja {#install-git-cmake-python-and-ninja} +## Installez Git, CMake, Python Et Ninja {#install-git-cmake-python-and-ninja} ``` bash $ sudo apt-get install git cmake python ninja-build @@ -23,7 +23,7 @@ Ou cmake3 au lieu de cmake sur les systèmes plus anciens. Il y a plusieurs façons de le faire. -### Installer à partir d'un paquet PPA {#install-from-a-ppa-package} +### Installer à Partir d’un Paquet PPA {#install-from-a-ppa-package} ``` bash $ sudo apt-get install software-properties-common @@ -32,11 +32,11 @@ $ sudo apt-get update $ sudo apt-get install gcc-9 g++-9 ``` -### Installer à partir de Sources {#install-from-sources} +### Installer à Partir De Sources {#install-from-sources} Regarder [utils/ci/build-gcc-from-sources.sh](https://github.com/ClickHouse/ClickHouse/blob/master/utils/ci/build-gcc-from-sources.sh) -## Utilisez GCC 9 pour les Builds {#use-gcc-9-for-builds} +## Utilisez GCC 9 Pour Les Builds {#use-gcc-9-for-builds} ``` bash $ export CC=gcc-9 @@ -67,13 +67,13 @@ $ cd .. ``` Pour créer un exécutable, exécutez `ninja clickhouse`. -Cela va créer de l' `programs/clickhouse` exécutable, qui peut être utilisé avec `client` ou `server` argument. +Cela va créer de l’ `programs/clickhouse` exécutable, qui peut être utilisé avec `client` ou `server` argument. -# Comment Construire ClickHouse sur N'importe quel Linux {#how-to-build-clickhouse-on-any-linux} +# Comment Construire ClickHouse Sur N’importe Quel Linux {#how-to-build-clickhouse-on-any-linux} La construction nécessite les composants suivants: -- Git (est utilisé uniquement pour extraire les sources, ce n'est pas nécessaire pour la construction) +- Git (est utilisé uniquement pour extraire les sources, ce n’est pas nécessaire pour la construction) - CMake 3.10 ou plus récent - Ninja (recommandé) ou faire - Compilateur C++: gcc 9 ou clang 8 ou plus récent @@ -108,17 +108,17 @@ Exemple Pour Fedora Rawhide: cmake ../ClickHouse make -j $(nproc) -# Vous N'avez pas à construire ClickHouse {#you-dont-have-to-build-clickhouse} +# Vous N’avez Pas à Construire ClickHouse {#you-dont-have-to-build-clickhouse} -ClickHouse est disponible dans des binaires et des paquets pré-construits. Les binaires sont portables et peuvent être exécutés sur N'importe quelle saveur Linux. +ClickHouse est disponible dans des binaires et des paquets pré-construits. Les binaires sont portables et peuvent être exécutés sur N’importe quelle saveur Linux. -Ils sont conçus pour les versions stables, préconfigurables et de test aussi longtemps que pour chaque commit à master et pour chaque requête d'extraction. +Ils sont conçus pour les versions stables, préconfigurables et de test aussi longtemps que pour chaque commit à master et pour chaque requête d’extraction. Pour trouver la construction la plus fraîche de `master`, aller à [page commits](https://github.com/ClickHouse/ClickHouse/commits/master), cliquez sur la première coche verte ou Croix Rouge près de commit, et cliquez sur le “Details” lien à droite après “ClickHouse Build Check”. -# Comment construire le paquet ClickHouse Debian {#how-to-build-clickhouse-debian-package} +# Comment Construire Le Paquet ClickHouse Debian {#how-to-build-clickhouse-debian-package} -## Installer Git et Pbuilder {#install-git-and-pbuilder} +## Installer Git Et Pbuilder {#install-git-and-pbuilder} ``` bash $ sudo apt-get update diff --git a/docs/fr/development/build_cross_arm.md b/docs/fr/development/build_cross_arm.md deleted file mode 100644 index 7da37869583..00000000000 --- a/docs/fr/development/build_cross_arm.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 67 -toc_title: Comment Construire ClickHouse sur Linux pour AARCH64 (ARM64) ---- - -# Comment Construire ClickHouse sur Linux pour l'architecture AARCH64 (ARM64) {#how-to-build-clickhouse-on-linux-for-aarch64-arm64-architecture} - -C'est pour le cas où vous avez machine Linux et que vous voulez utiliser pour construire `clickhouse` binaire qui fonctionnera sur une autre machine Linux avec une architecture CPU AARCH64. Ceci est destiné aux contrôles d'intégration continus qui s'exécutent sur des serveurs Linux. - -La construction croisée pour AARCH64 est basée sur [Instructions de construction](build.md), suivez d'abord. - -# Installer Clang-8 {#install-clang-8} - -Suivez les instructions de https://apt.llvm.org/ pour votre configuration Ubuntu ou Debian. -Par exemple, dans Ubuntu Bionic vous pouvez utiliser les commandes suivantes: - -``` bash -echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" | sudo tee /etc/apt/sources.list.d/llvm.list -sudo apt-get update -sudo apt-get install clang-8 -``` - -# Installer Un Ensemble D'Outils De Compilation Croisée {#install-cross-compilation-toolset} - -``` bash -cd ClickHouse -mkdir -p build-aarch64/cmake/toolchain/linux-aarch64 -wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9&la=en' -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cmake/toolchain/linux-aarch64 --strip-components=1 -``` - -# Construire ClickHouse {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-arm64 -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake -ninja -C build-arm64 -``` - -Le binaire résultant s'exécutera uniquement sur Linux avec l'architecture CPU AARCH64. diff --git a/docs/fr/development/build_cross_osx.md b/docs/fr/development/build_cross_osx.md deleted file mode 100644 index 809b6ef0dd6..00000000000 --- a/docs/fr/development/build_cross_osx.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 66 -toc_title: Comment Construire ClickHouse sur Linux pour Mac OS X ---- - -# Comment Construire ClickHouse sur Linux pour Mac OS X {#how-to-build-clickhouse-on-linux-for-mac-os-x} - -C'est pour le cas où vous avez machine Linux et que vous voulez utiliser pour construire `clickhouse` binaire qui s'exécutera sur OS X. Ceci est destiné aux contrôles d'intégration continus qui s'exécutent sur des serveurs Linux. Si vous voulez construire ClickHouse directement sur Mac OS X, puis procéder à [une autre instruction](build_osx.md). - -Le cross-build pour Mac OS X est basé sur le [Instructions de construction](build.md), suivez d'abord. - -# Installer Clang-8 {#install-clang-8} - -Suivez les instructions de https://apt.llvm.org/ pour votre configuration Ubuntu ou Debian. -Par exemple les commandes pour Bionic sont comme: - -``` bash -sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list -sudo apt-get install clang-8 -``` - -# Installer Un Ensemble D'Outils De Compilation Croisée {#install-cross-compilation-toolset} - -Souvenons nous du chemin où nous installons `cctools` comme ${CCTOOLS} - -``` bash -mkdir ${CCTOOLS} - -git clone https://github.com/tpoechtrager/apple-libtapi.git -cd apple-libtapi -INSTALLPREFIX=${CCTOOLS} ./build.sh -./install.sh -cd .. - -git clone https://github.com/tpoechtrager/cctools-port.git -cd cctools-port/cctools -./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin -make install -``` - -En outre, nous devons télécharger macOS X SDK dans l'arbre de travail. - -``` bash -cd ClickHouse -wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' -mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 -tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 -``` - -# Construire ClickHouse {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-osx -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ - -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ - -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ - -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -ninja -C build-osx -``` - -Le binaire résultant aura un format exécutable Mach-O et ne pourra pas être exécuté sous Linux. diff --git a/docs/fr/development/build_osx.md b/docs/fr/development/build_osx.md deleted file mode 100644 index b2122c2117f..00000000000 --- a/docs/fr/development/build_osx.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 65 -toc_title: Comment Construire ClickHouse sur Mac OS X ---- - -# Comment Construire ClickHouse sur Mac OS X {#how-to-build-clickhouse-on-mac-os-x} - -Build devrait fonctionner sur Mac OS X 10.15 (Catalina) - -## Installer Homebrew {#install-homebrew} - -``` bash -$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - -## Installez les compilateurs, outils et bibliothèques requis {#install-required-compilers-tools-and-libraries} - -``` bash -$ brew install cmake ninja libtool gettext -``` - -## Commander Clickhouse Sources {#checkout-clickhouse-sources} - -``` bash -$ git clone --recursive git@github.com:ClickHouse/ClickHouse.git -``` - -ou - -``` bash -$ git clone --recursive https://github.com/ClickHouse/ClickHouse.git - -$ cd ClickHouse -``` - -## Construire ClickHouse {#build-clickhouse} - -``` bash -$ mkdir build -$ cd build -$ cmake .. -DCMAKE_CXX_COMPILER=`which clang++` -DCMAKE_C_COMPILER=`which clang` -$ ninja -$ cd .. -``` - -## Mises en garde {#caveats} - -Si vous avez l'intention d'exécuter clickhouse-server, assurez-vous d'augmenter la variable maxfiles du système. - -!!! info "Note" - Vous aurez besoin d'utiliser sudo. - -Pour ce faire, créez le fichier suivant: - -/ Bibliothèque / LaunchDaemons / limite.maxfiles.plist: - -``` xml - - - - - Label - limit.maxfiles - ProgramArguments - - launchctl - limit - maxfiles - 524288 - 524288 - - RunAtLoad - - ServiceIPC - - - -``` - -Exécutez la commande suivante: - -``` bash -$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist -``` - -Redémarrer. - -Pour vérifier si elle fonctionne, vous pouvez utiliser `ulimit -n` commande. - -[Article Original](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/fr/development/developer-instruction.md b/docs/fr/development/developer-instruction.md new file mode 100644 index 00000000000..ef9a965e0f5 --- /dev/null +++ b/docs/fr/development/developer-instruction.md @@ -0,0 +1,285 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 61 +toc_title: "Le D\xE9butant Clickhouse Developer Instruction" +--- + +La construction de ClickHouse est prise en charge sous Linux, FreeBSD et Mac OS X. + +# Si Vous Utilisez Windows {#if-you-use-windows} + +Si vous utilisez Windows, vous devez créer une machine virtuelle avec Ubuntu. Pour commencer à travailler avec une machine virtuelle, installez VirtualBox. Vous pouvez télécharger Ubuntu sur le site: https://www.ubuntu.com/\#download. veuillez créer une machine virtuelle à partir de l’image téléchargée (vous devez réserver au moins 4 Go de RAM pour cela). Pour exécuter un terminal de ligne de commande dans Ubuntu, recherchez un programme contenant le mot “terminal” dans son nom (gnome-terminal, konsole etc.) ou appuyez simplement sur Ctrl + Alt + T. + +# Si Vous Utilisez Un système 32 Bits {#if-you-use-a-32-bit-system} + +ClickHouse ne peut pas fonctionner ou construire sur un système 32 bits. Vous devez acquérir l’accès à un système 64 bits et vous pouvez continuer la lecture. + +# Création d’un référentiel Sur GitHub {#creating-a-repository-on-github} + +Pour commencer à travailler avec clickhouse repository, vous aurez besoin d’un compte GitHub. + +Vous en avez probablement déjà un, mais si vous ne le faites pas, veuillez vous inscrire à https://github.com. dans le cas où vous n’avez pas de clés SSH, vous devez les générer, puis les télécharger sur GitHub. Il est nécessaire pour l’envoi de vos correctifs. Il est également possible d’utiliser les mêmes clés SSH que vous utilisez avec d’autres serveurs SSH - vous les avez probablement déjà. + +Créer un fork de clickhouse repository. Pour ce faire, cliquez sur l’ “fork” bouton dans le coin supérieur droit à https://github.com/ClickHouse/ClickHouse. il fourche votre propre copie de ClickHouse / ClickHouse à votre compte. + +Le processus de développement consiste d’abord à valider les modifications prévues dans votre fork de ClickHouse, puis à créer un “pull request” pour que ces modifications soient acceptées dans le référentiel principal (ClickHouse/ClickHouse). + +Pour travailler avec les dépôts git, veuillez installer `git`. + +Pour ce faire dans Ubuntu vous exécutez dans le terminal de ligne de commande: + + sudo apt update + sudo apt install git + +Un bref manuel sur l’utilisation de Git peut être trouvé ici: https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf. +Pour un manuel détaillé sur Git voir https://git-scm.com/book/en/v2. + +# Clonage d’un référentiel Sur Votre Machine De développement {#cloning-a-repository-to-your-development-machine} + +Ensuite, vous devez télécharger les fichiers source sur votre machine de travail. Ceci est appelé “to clone a repository” parce qu’il crée une copie locale du dépôt sur votre machine de travail. + +Dans le terminal de ligne de commande exécuter: + + git clone --recursive git@guthub.com:your_github_username/ClickHouse.git + cd ClickHouse + +Remarque: Veuillez remplacer *your\_github\_username* avec ce qui est approprié! + +Cette commande va créer un répertoire `ClickHouse` contenant la copie de travail du projet. + +Il est important que le chemin d’accès au répertoire de travail ne contienne aucun espace, car cela peut entraîner des problèmes lors de l’exécution du système de construction. + +Veuillez noter que clickhouse repository utilise `submodules`. That is what the references to additional repositories are called (i.e. external libraries on which the project depends). It means that when cloning the repository you need to specify the `--recursive` drapeau comme dans l’exemple ci-dessus. Si le dépôt a été cloné sans submodules, pour télécharger, vous devez exécuter les opérations suivantes: + + git submodule init + git submodule update + +Vous pouvez vérifier l’état avec la commande: `git submodule status`. + +Si vous obtenez le message d’erreur suivantes: + + Permission denied (publickey). + fatal: Could not read from remote repository. + + Please make sure you have the correct access rights + and the repository exists. + +Cela signifie généralement que les clés SSH pour la connexion à GitHub sont manquantes. Ces clés sont normalement situés dans `~/.ssh`. Pour que les clés SSH soient acceptées, vous devez les télécharger dans la section Paramètres de L’interface utilisateur GitHub. + +Vous pouvez également cloner le référentiel via le protocole https: + + git clone https://github.com/ClickHouse/ClickHouse.git + +Ceci, cependant, ne vous permettra pas d’envoyer vos modifications sur le serveur. Vous pouvez toujours l’utiliser temporairement et ajouter les clés SSH plus tard en remplaçant l’adresse distante du référentiel par `git remote` commande. + +Vous pouvez également ajouter l’adresse du dépôt clickhouse original à votre référentiel local pour extraire les mises à jour à partir de là: + + git remote add upstream git@github.com:ClickHouse/ClickHouse.git + +Après avoir exécuté avec succès cette commande vous serez en mesure de tirer les mises à jour du repo clickhouse principal en exécutant `git pull upstream master`. + +## Travailler Avec Des Submodules {#working-with-submodules} + +Travailler avec des sous-modules dans git pourrait être douloureux. Prochaines commandes aidera à gérer: + + # ! each command accepts --recursive + # Update remote URLs for submodules. Barely rare case + git submodule sync + # Add new submodules + git submodule init + # Update existing submodules to the current state + git submodule update + # Two last commands could be merged together + git submodule update --init + +Les commandes suivantes vous aideront à réinitialiser tous les sous-modules à l’état initial (!AVERTISSEMENT! - tout changement à l’intérieur sera supprimé): + + # Synchronizes submodules' remote URL with .gitmodules + git submodule sync --recursive + # Update the registered submodules with initialize not yet initialized + git submodule update --init --recursive + # Reset all changes done after HEAD + git submodule foreach git reset --hard + # Clean files from .gitignore + git submodule foreach git clean -xfd + # Repeat last 4 commands for all submodule + git submodule foreach git submodule sync --recursive + git submodule foreach git submodule update --init --recursive + git submodule foreach git submodule foreach git reset --hard + git submodule foreach git submodule foreach git clean -xfd + +# Système De Construction {#build-system} + +ClickHouse utilise CMake et Ninja pour la construction. + +CMake - un système de méta-construction qui peut générer des fichiers Ninja (tâches de construction). +Ninja - un système de construction plus petit avec un accent sur la vitesse utilisée pour exécuter ces tâches générées cmake. + +Pour installer sur Ubuntu, Debian ou mint run `sudo apt install cmake ninja-build`. + +Sur CentOS, RedHat run `sudo yum install cmake ninja-build`. + +Si vous utilisez Arch ou Gentoo, vous savez probablement vous - même comment installer CMake. + +Pour installer CMake et Ninja sur Mac OS X installez D’abord Homebrew puis installez tout le reste via brew: + + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + brew install cmake ninja + +Ensuite, vérifiez la version de CMake: `cmake --version`. Si elle est inférieure à 3.3, vous devez installer une version plus récente du site web: https://cmake.org/download/. + +# Bibliothèques Externes Facultatives {#optional-external-libraries} + +ClickHouse utilise plusieurs bibliothèques externes pour la construction. Tous n’ont pas besoin d’être installés séparément car ils sont construits avec ClickHouse à partir des sources situées dans les sous-modules. Vous pouvez vérifier la liste dans `contrib`. + +# Compilateur C++ {#c-compiler} + +Les compilateurs GCC à partir de la version 9 et Clang version 8 ou supérieure sont pris en charge pour construire ClickHouse. + +Les builds officiels de Yandex utilisent actuellement GCC car ils génèrent du code machine de performances légèrement meilleures (ce qui donne une différence allant jusqu’à plusieurs pour cent selon nos benchmarks). Et Clang est plus pratique pour le développement habituellement. Cependant, notre plate-forme d’intégration continue (CI) vérifie environ une douzaine de combinaisons de construction. + +Pour installer GCC sur Ubuntu Exécutez: `sudo apt install gcc g++` + +Vérifiez la version de gcc: `gcc --version`. Si elle est inférieure à 9, suivez les instructions ici: https://clickhouse.tech/docs/fr/développement/construction/\#install-gcc-9. + +Mac OS X build est pris en charge uniquement pour Clang. Il suffit d’exécuter `brew install llvm` + +Si vous décidez d’utiliser Clang, vous pouvez également installer `libc++` et `lld` si vous savez ce que c’est. Utiliser `ccache` est également recommandé. + +# Le Processus De Construction {#the-building-process} + +Maintenant que vous êtes prêt à construire ClickHouse nous vous conseillons de créer un répertoire séparé `build` à l’intérieur de `ClickHouse` qui contiendra tous les artefacts de construction: + + mkdir build + cd build + +Vous pouvez avoir plusieurs répertoires différents (build\_release, build\_debug, etc.) pour les différents types de construction. + +Tandis qu’à l’intérieur de la `build` répertoire, configurez votre build en exécutant CMake. Avant la première exécution, vous devez définir des variables d’environnement qui spécifient le compilateur (compilateur gcc version 9 dans cet exemple). + +Linux: + + export CC=gcc-9 CXX=g++-9 + cmake .. + +Mac OS X: + + export CC=clang CXX=clang++ + cmake .. + +Le `CC` variable spécifie le compilateur pour C (abréviation de compilateur C), et `CXX` variable indique quel compilateur C++ doit être utilisé pour la construction. + +Pour une version plus rapide, vous pouvez recourir à l’ `debug` build type - Une construction sans optimisations. Pour cela fournissez le paramètre suivant `-D CMAKE_BUILD_TYPE=Debug`: + + cmake -D CMAKE_BUILD_TYPE=Debug .. + +Vous pouvez modifier le type de génération en exécutant cette commande dans le `build` répertoire. + +Exécutez ninja pour construire: + + ninja clickhouse-server clickhouse-client + +Seules les binaires vont être construites dans cet exemple. + +Si vous avez besoin de construire tous les binaires (utilitaires et tests), vous devez exécuter ninja sans paramètres: + + ninja + +La construction complète nécessite environ 30 Go d’espace disque libre ou 15 Go pour construire les binaires principaux. + +Lorsqu’une grande quantité de RAM est disponible sur la machine de construction vous devez limiter le nombre de tâches de construction exécutées en parallèle avec `-j` param: + + ninja -j 1 clickhouse-server clickhouse-client + +Sur les machines avec 4 Go de RAM, il est recommandé de spécifier 1, pour 8 Go de RAM `-j 2` est recommandé. + +Si vous recevez le message: `ninja: error: loading 'build.ninja': No such file or directory`, cela signifie que la génération d’une configuration de construction a échoué et que vous devez inspecter le message ci-dessus. + +Après le démarrage réussi du processus de construction, vous verrez la progression de la construction - le nombre de tâches traitées et le nombre total de tâches. + +Lors de la construction de messages sur les fichiers protobuf dans la bibliothèque libhdfs2 comme `libprotobuf WARNING` peuvent apparaître. Ils touchent rien et sont sûrs d’être ignoré. + +Lors de la construction, vous obtenez un fichier exécutable `ClickHouse//programs/clickhouse`: + + ls -l programs/clickhouse + +# Exécution De L’exécutable Construit De ClickHouse {#running-the-built-executable-of-clickhouse} + +Pour exécuter le serveur sous l’utilisateur actuel vous devez naviguer vers `ClickHouse/programs/server/` (situé à l’extérieur de `build` et les exécuter: + + ../../../build/programs/clickhouse server + +Dans ce cas, ClickHouse utilisera les fichiers de configuration situés dans le répertoire courant. Vous pouvez l’exécuter `clickhouse server` depuis n’importe quel répertoire spécifiant le chemin d’accès à un fichier de configuration en tant que paramètre de ligne de commande `--config-file`. + +Pour vous connecter à ClickHouse avec clickhouse-client dans un autre terminal, accédez à `ClickHouse/build/programs/` et exécuter `clickhouse client`. + +Si vous obtenez `Connection refused` message sur Mac OS X ou FreeBSD, essayez de spécifier l’adresse hôte 127.0.0.1: + + clickhouse client --host 127.0.0.1 + +Vous pouvez remplacer la version de production de clickhouse binary installée dans votre système par votre clickhouse Binary sur mesure. Pour ce faire, installez ClickHouse sur votre machine en suivant les instructions du site officiel. Ensuite, exécutez ce qui suit: + + sudo service clickhouse-server stop + sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ + sudo service clickhouse-server start + +Notez que `clickhouse-client`, `clickhouse-server` et d’autres sont des liens symboliques à la commune `clickhouse` binaire. + +Vous pouvez également exécuter votre binaire ClickHouse personnalisé avec le fichier de configuration du package clickhouse installé sur votre système: + + sudo service clickhouse-server stop + sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml + +# IDE (environnement De développement intégré) {#ide-integrated-development-environment} + +Si vous ne savez pas quel IDE utiliser, nous vous recommandons D’utiliser CLion. CLion est un logiciel commercial, mais il offre une période d’essai gratuite de 30 jours. Il est également gratuit pour les étudiants. CLion peut être utilisé à la fois sur Linux et sur Mac OS X. + +KDevelop et QTCreator sont d’autres grandes alternatives D’un IDE pour développer ClickHouse. KDevelop est un IDE très pratique bien qu’instable. Si KDevelop se bloque après un certain temps lors de l’ouverture du projet, vous devez cliquer sur “Stop All” bouton dès qu’il a ouvert la liste des fichiers du projet. Après cela, KDevelop devrait être bien pour travailler avec. + +En tant qu’éditeurs de code simples, vous pouvez utiliser Sublime Text ou Visual Studio Code, ou Kate (qui sont tous disponibles sur Linux). + +Juste au cas où, il convient de mentionner que CLion crée `build` chemin sur son propre, il aussi sur son propre sélectionne `debug` pour le type de construction, pour la configuration, il utilise une version de CMake définie dans CLion et non celle installée par vous, et enfin, CLion utilisera `make` pour exécuter construire des tâches au lieu de `ninja`. C’est un comportement normal, gardez cela à l’esprit pour éviter toute confusion. + +# L’Écriture De Code {#writing-code} + +La description de l’architecture ClickHouse peut être trouvée ici: https://clickhouse.tech/docs/fr/développement/architecture/ + +Le code Style Guide: https://clickhouse.tech/docs/fr/développement/style/ + +Rédaction de tests: https://clickhouse.tech/docs/fr/développement/tests/ + +Liste des tâches: https://github.com/ClickHouse/ClickHouse/blob/master/testsructions/easy\_tasks\_sorted\_en.md + +# Des Données De Test {#test-data} + +Le développement de ClickHouse nécessite souvent le chargement d’ensembles de données réalistes. Il est particulièrement important pour les tests de performance. Nous avons un ensemble spécialement préparé de données anonymisées de Yandex.Metrica. Il nécessite en outre quelques 3 Go d’espace disque libre. Notez que ces données ne sont pas requises pour accomplir la plupart des tâches de développement. + + sudo apt install wget xz-utils + + wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz + wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz + + xz -v -d hits_v1.tsv.xz + xz -v -d visits_v1.tsv.xz + + clickhouse-client + + CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); + + CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); + + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv + +# La Création De Pull Request {#creating-pull-request} + +Accédez à votre référentiel fork dans L’interface utilisateur de GitHub. Si vous avez développé dans une branche, vous devez sélectionner cette branche. Il y aura un “Pull request” bouton situé sur l’écran. En substance, cela signifie “create a request for accepting my changes into the main repository”. + +Une demande d’extraction peuvent être créés, même si le travail n’est pas encore terminée. Dans ce cas veuillez mettre le mot “WIP” (travaux en cours) au début du titre, il peut être modifié plus tard. Ceci est utile pour l’examen coopératif et la discussion des changements ainsi que pour l’exécution de tous les tests disponibles. Il est important que vous fournissiez une brève description de vos modifications, il sera ensuite utilisé pour générer des journaux de modifications de version. + +Les tests commenceront dès que les employés de Yandex étiqueteront votre PR avec une étiquette “can be tested”. The results of some first checks (e.g. code style) will come in within several minutes. Build check results will arrive within half an hour. And the main set of tests will report itself within an hour. + +Le système préparera les builds binaires ClickHouse pour votre demande de tirage individuellement. Pour récupérer ces versions cliquez sur le “Details” lien à côté “ClickHouse build check” entrée dans la liste de vérifications. Vous y trouverez des liens directs vers les construit .paquets deb de ClickHouse que vous pouvez déployer même sur vos serveurs de production (si vous n’avez pas peur). + +Très probablement, certaines des constructions échoueront à la première fois. Cela est dû au fait que nous avons vérifier s’appuie à la fois avec gcc, ainsi qu’avec clang, pratiquement tous les avertissements existants (toujours avec le `-Werror` drapeau) activé pour clang. Sur cette même page, vous pouvez trouver tous les journaux de construction afin que vous n’ayez pas à construire ClickHouse de toutes les manières possibles. diff --git a/docs/fr/development/developer_instruction.md b/docs/fr/development/developer_instruction.md deleted file mode 100644 index cf15f8f36ac..00000000000 --- a/docs/fr/development/developer_instruction.md +++ /dev/null @@ -1,285 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 61 -toc_title: "Le D\xE9butant Clickhouse Developer Instruction" ---- - -La construction de ClickHouse est prise en charge sous Linux, FreeBSD et Mac OS X. - -# Si vous utilisez Windows {#if-you-use-windows} - -Si vous utilisez Windows, vous devez créer une machine virtuelle avec Ubuntu. Pour commencer à travailler avec une machine virtuelle, installez VirtualBox. Vous pouvez télécharger Ubuntu sur le site: https://www.ubuntu.com/\#download. veuillez créer une machine virtuelle à partir de l'image téléchargée (vous devez réserver au moins 4 Go de RAM pour cela). Pour exécuter un terminal de ligne de commande dans Ubuntu, recherchez un programme contenant le mot “terminal” dans son nom (gnome-terminal, konsole etc.) ou appuyez simplement sur Ctrl + Alt + T. - -# Si vous utilisez un système 32 bits {#if-you-use-a-32-bit-system} - -ClickHouse ne peut pas fonctionner ou construire sur un système 32 bits. Vous devez acquérir l'accès à un système 64 bits et vous pouvez continuer la lecture. - -# Création d'un référentiel sur GitHub {#creating-a-repository-on-github} - -Pour commencer à travailler avec clickhouse repository, vous aurez besoin d'un compte GitHub. - -Vous en avez probablement déjà un, mais si vous ne le faites pas, veuillez vous inscrire à https://github.com. dans le cas où vous n'avez pas de clés SSH, vous devez les générer, puis les télécharger sur GitHub. Il est nécessaire pour l'envoi de vos correctifs. Il est également possible d'utiliser les mêmes clés SSH que vous utilisez avec d'autres serveurs SSH - vous les avez probablement déjà. - -Créer un fork de clickhouse repository. Pour ce faire, cliquez sur l' “fork” bouton dans le coin supérieur droit à https://github.com/ClickHouse/ClickHouse. il fourche votre propre copie de ClickHouse / ClickHouse à votre compte. - -Le processus de développement consiste d'abord à valider les modifications prévues dans votre fork de ClickHouse, puis à créer un “pull request” pour que ces modifications soient acceptées dans le référentiel principal (ClickHouse/ClickHouse). - -Pour travailler avec les dépôts git, veuillez installer `git`. - -Pour ce faire dans Ubuntu vous exécutez dans le terminal de ligne de commande: - - sudo apt update - sudo apt install git - -Un bref manuel sur l'utilisation de Git peut être trouvé ici: https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf. -Pour un manuel détaillé sur Git voir https://git-scm.com/book/en/v2. - -# Clonage d'un référentiel sur votre machine de développement {#cloning-a-repository-to-your-development-machine} - -Ensuite, vous devez télécharger les fichiers source sur votre machine de travail. Ceci est appelé “to clone a repository” parce qu'il crée une copie locale du dépôt sur votre machine de travail. - -Dans le terminal de ligne de commande exécuter: - - git clone --recursive git@guthub.com:your_github_username/ClickHouse.git - cd ClickHouse - -Remarque: Veuillez remplacer *your\_github\_username* avec ce qui est approprié! - -Cette commande va créer un répertoire `ClickHouse` contenant la copie de travail du projet. - -Il est important que le chemin d'accès au répertoire de travail ne contienne aucun espace, car cela peut entraîner des problèmes lors de l'exécution du système de construction. - -Veuillez noter que clickhouse repository utilise `submodules`. That is what the references to additional repositories are called (i.e. external libraries on which the project depends). It means that when cloning the repository you need to specify the `--recursive` drapeau comme dans l'exemple ci-dessus. Si le dépôt a été cloné sans submodules, pour télécharger, vous devez exécuter les opérations suivantes: - - git submodule init - git submodule update - -Vous pouvez vérifier l'état avec la commande: `git submodule status`. - -Si vous obtenez le message d'erreur suivantes: - - Permission denied (publickey). - fatal: Could not read from remote repository. - - Please make sure you have the correct access rights - and the repository exists. - -Cela signifie généralement que les clés SSH pour la connexion à GitHub sont manquantes. Ces clés sont normalement situés dans `~/.ssh`. Pour que les clés SSH soient acceptées, vous devez les télécharger dans la section Paramètres de L'interface utilisateur GitHub. - -Vous pouvez également cloner le référentiel via le protocole https: - - git clone https://github.com/ClickHouse/ClickHouse.git - -Ceci, cependant, ne vous permettra pas d'envoyer vos modifications sur le serveur. Vous pouvez toujours l'utiliser temporairement et ajouter les clés SSH plus tard en remplaçant l'adresse distante du référentiel par `git remote` commande. - -Vous pouvez également ajouter l'adresse du dépôt clickhouse original à votre référentiel local pour extraire les mises à jour à partir de là: - - git remote add upstream git@github.com:ClickHouse/ClickHouse.git - -Après avoir exécuté avec succès cette commande vous serez en mesure de tirer les mises à jour du repo clickhouse principal en exécutant `git pull upstream master`. - -## Travailler avec des submodules {#working-with-submodules} - -Travailler avec des sous-modules dans git pourrait être douloureux. Prochaines commandes aidera à gérer: - - # ! each command accepts --recursive - # Update remote URLs for submodules. Barely rare case - git submodule sync - # Add new submodules - git submodule init - # Update existing submodules to the current state - git submodule update - # Two last commands could be merged together - git submodule update --init - -Les commandes suivantes vous aideront à réinitialiser tous les sous-modules à l'état initial (!AVERTISSEMENT! - tout changement à l'intérieur sera supprimé): - - # Synchronizes submodules' remote URL with .gitmodules - git submodule sync --recursive - # Update the registered submodules with initialize not yet initialized - git submodule update --init --recursive - # Reset all changes done after HEAD - git submodule foreach git reset --hard - # Clean files from .gitignore - git submodule foreach git clean -xfd - # Repeat last 4 commands for all submodule - git submodule foreach git submodule sync --recursive - git submodule foreach git submodule update --init --recursive - git submodule foreach git submodule foreach git reset --hard - git submodule foreach git submodule foreach git clean -xfd - -# Système De Construction {#build-system} - -ClickHouse utilise CMake et Ninja pour la construction. - -CMake - un système de méta-construction qui peut générer des fichiers Ninja (tâches de construction). -Ninja - un système de construction plus petit avec un accent sur la vitesse utilisée pour exécuter ces tâches générées cmake. - -Pour installer sur Ubuntu, Debian ou mint run `sudo apt install cmake ninja-build`. - -Sur CentOS, RedHat run `sudo yum install cmake ninja-build`. - -Si vous utilisez Arch ou Gentoo, vous savez probablement vous - même comment installer CMake. - -Pour installer CMake et Ninja sur Mac OS X installez D'abord Homebrew puis installez tout le reste via brew: - - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install cmake ninja - -Ensuite, vérifiez la version de CMake: `cmake --version`. Si elle est inférieure à 3.3, vous devez installer une version plus récente du site web: https://cmake.org/download/. - -# Bibliothèques Externes Facultatives {#optional-external-libraries} - -ClickHouse utilise plusieurs bibliothèques externes pour la construction. Tous n'ont pas besoin d'être installés séparément car ils sont construits avec ClickHouse à partir des sources situées dans les sous-modules. Vous pouvez vérifier la liste dans `contrib`. - -# Compilateur C++ {#c-compiler} - -Les compilateurs GCC à partir de la version 9 et Clang version 8 ou supérieure sont pris en charge pour construire ClickHouse. - -Les builds officiels de Yandex utilisent actuellement GCC car ils génèrent du code machine de performances légèrement meilleures (ce qui donne une différence allant jusqu'à plusieurs pour cent selon nos benchmarks). Et Clang est plus pratique pour le développement habituellement. Cependant, notre plate-forme d'intégration continue (CI) vérifie environ une douzaine de combinaisons de construction. - -Pour installer GCC sur Ubuntu Exécutez: `sudo apt install gcc g++` - -Vérifiez la version de gcc: `gcc --version`. Si elle est inférieure à 9, suivez les instructions ici: https://clickhouse.tech/docs/fr/développement/construction/\#install-gcc-9. - -Mac OS X build est pris en charge uniquement pour Clang. Il suffit d'exécuter `brew install llvm` - -Si vous décidez d'utiliser Clang, vous pouvez également installer `libc++` et `lld` si vous savez ce que c'est. Utiliser `ccache` est également recommandé. - -# Le processus de construction {#the-building-process} - -Maintenant que vous êtes prêt à construire ClickHouse nous vous conseillons de créer un répertoire séparé `build` à l'intérieur de `ClickHouse` qui contiendra tous les artefacts de construction: - - mkdir build - cd build - -Vous pouvez avoir plusieurs répertoires différents (build\_release, build\_debug, etc.) pour les différents types de construction. - -Tandis qu'à l'intérieur de la `build` répertoire, configurez votre build en exécutant CMake. Avant la première exécution, vous devez définir des variables d'environnement qui spécifient le compilateur (compilateur gcc version 9 dans cet exemple). - -Linux: - - export CC=gcc-9 CXX=g++-9 - cmake .. - -Mac OS X: - - export CC=clang CXX=clang++ - cmake .. - -Le `CC` variable spécifie le compilateur pour C (abréviation de compilateur C), et `CXX` variable indique quel compilateur C++ doit être utilisé pour la construction. - -Pour une version plus rapide, vous pouvez recourir à l' `debug` build type - Une construction sans optimisations. Pour cela fournissez le paramètre suivant `-D CMAKE_BUILD_TYPE=Debug`: - - cmake -D CMAKE_BUILD_TYPE=Debug .. - -Vous pouvez modifier le type de génération en exécutant cette commande dans le `build` répertoire. - -Exécutez ninja pour construire: - - ninja clickhouse-server clickhouse-client - -Seules les binaires vont être construites dans cet exemple. - -Si vous avez besoin de construire tous les binaires (utilitaires et tests), vous devez exécuter ninja sans paramètres: - - ninja - -La construction complète nécessite environ 30 Go d'espace disque libre ou 15 Go pour construire les binaires principaux. - -Lorsqu'une grande quantité de RAM est disponible sur la machine de construction vous devez limiter le nombre de tâches de construction exécutées en parallèle avec `-j` param: - - ninja -j 1 clickhouse-server clickhouse-client - -Sur les machines avec 4 Go de RAM, il est recommandé de spécifier 1, pour 8 Go de RAM `-j 2` est recommandé. - -Si vous recevez le message: `ninja: error: loading 'build.ninja': No such file or directory`, cela signifie que la génération d'une configuration de construction a échoué et que vous devez inspecter le message ci-dessus. - -Après le démarrage réussi du processus de construction, vous verrez la progression de la construction - le nombre de tâches traitées et le nombre total de tâches. - -Lors de la construction de messages sur les fichiers protobuf dans la bibliothèque libhdfs2 comme `libprotobuf WARNING` peuvent apparaître. Ils touchent rien et sont sûrs d'être ignoré. - -Lors de la construction, vous obtenez un fichier exécutable `ClickHouse//programs/clickhouse`: - - ls -l programs/clickhouse - -# Exécution de L'exécutable construit de ClickHouse {#running-the-built-executable-of-clickhouse} - -Pour exécuter le serveur sous l'utilisateur actuel vous devez naviguer vers `ClickHouse/programs/server/` (situé à l'extérieur de `build` et les exécuter: - - ../../../build/programs/clickhouse server - -Dans ce cas, ClickHouse utilisera les fichiers de configuration situés dans le répertoire courant. Vous pouvez l'exécuter `clickhouse server` depuis n'importe quel répertoire spécifiant le chemin d'accès à un fichier de configuration en tant que paramètre de ligne de commande `--config-file`. - -Pour vous connecter à ClickHouse avec clickhouse-client dans un autre terminal, accédez à `ClickHouse/build/programs/` et exécuter `clickhouse client`. - -Si vous obtenez `Connection refused` message sur Mac OS X ou FreeBSD, essayez de spécifier l'adresse hôte 127.0.0.1: - - clickhouse client --host 127.0.0.1 - -Vous pouvez remplacer la version de production de clickhouse binary installée dans votre système par votre clickhouse Binary sur mesure. Pour ce faire, installez ClickHouse sur votre machine en suivant les instructions du site officiel. Ensuite, exécutez ce qui suit: - - sudo service clickhouse-server stop - sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ - sudo service clickhouse-server start - -Notez que `clickhouse-client`, `clickhouse-server` et d'autres sont des liens symboliques à la commune `clickhouse` binaire. - -Vous pouvez également exécuter votre binaire ClickHouse personnalisé avec le fichier de configuration du package clickhouse installé sur votre système: - - sudo service clickhouse-server stop - sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml - -# IDE (environnement de développement intégré) {#ide-integrated-development-environment} - -Si vous ne savez pas quel IDE utiliser, nous vous recommandons D'utiliser CLion. CLion est un logiciel commercial, mais il offre une période d'essai gratuite de 30 jours. Il est également gratuit pour les étudiants. CLion peut être utilisé à la fois sur Linux et sur Mac OS X. - -KDevelop et QTCreator sont d'autres grandes alternatives D'un IDE pour développer ClickHouse. KDevelop est un IDE très pratique bien qu'instable. Si KDevelop se bloque après un certain temps lors de l'ouverture du projet, vous devez cliquer sur “Stop All” bouton dès qu'il a ouvert la liste des fichiers du projet. Après cela, KDevelop devrait être bien pour travailler avec. - -En tant qu'éditeurs de code simples, vous pouvez utiliser Sublime Text ou Visual Studio Code, ou Kate (qui sont tous disponibles sur Linux). - -Juste au cas où, il convient de mentionner que CLion crée `build` chemin sur son propre, il aussi sur son propre sélectionne `debug` pour le type de construction, pour la configuration, il utilise une version de CMake définie dans CLion et non celle installée par vous, et enfin, CLion utilisera `make` pour exécuter construire des tâches au lieu de `ninja`. C'est un comportement normal, gardez cela à l'esprit pour éviter toute confusion. - -# L'Écriture De Code {#writing-code} - -La description de l'architecture ClickHouse peut être trouvée ici: https://clickhouse.tech/docs/fr/développement/architecture/ - -Le code Style Guide: https://clickhouse.tech/docs/fr/développement/style/ - -Rédaction de tests: https://clickhouse.tech/docs/fr/développement/tests/ - -Liste des tâches: https://github.com/ClickHouse/ClickHouse/blob/master/testsructions/easy\_tasks\_sorted\_en.md - -# Des Données De Test {#test-data} - -Le développement de ClickHouse nécessite souvent le chargement d'ensembles de données réalistes. Il est particulièrement important pour les tests de performance. Nous avons un ensemble spécialement préparé de données anonymisées de Yandex.Metrica. Il nécessite en outre quelques 3 Go d'espace disque libre. Notez que ces données ne sont pas requises pour accomplir la plupart des tâches de développement. - - sudo apt install wget xz-utils - - wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz - wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz - - xz -v -d hits_v1.tsv.xz - xz -v -d visits_v1.tsv.xz - - clickhouse-client - - CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); - - CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); - - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv - -# La Création De Pull Request {#creating-pull-request} - -Accédez à votre référentiel fork dans L'interface utilisateur de GitHub. Si vous avez développé dans une branche, vous devez sélectionner cette branche. Il y aura un “Pull request” bouton situé sur l'écran. En substance, cela signifie “create a request for accepting my changes into the main repository”. - -Une demande d'extraction peuvent être créés, même si le travail n'est pas encore terminée. Dans ce cas veuillez mettre le mot “WIP” (travaux en cours) au début du titre, il peut être modifié plus tard. Ceci est utile pour l'examen coopératif et la discussion des changements ainsi que pour l'exécution de tous les tests disponibles. Il est important que vous fournissiez une brève description de vos modifications, il sera ensuite utilisé pour générer des journaux de modifications de version. - -Les tests commenceront dès que les employés de Yandex étiqueteront votre PR avec une étiquette “can be tested”. The results of some first checks (e.g. code style) will come in within several minutes. Build check results will arrive within half an hour. And the main set of tests will report itself within an hour. - -Le système préparera les builds binaires ClickHouse pour votre demande de tirage individuellement. Pour récupérer ces versions cliquez sur le “Details” lien à côté “ClickHouse build check” entrée dans la liste de vérifications. Vous y trouverez des liens directs vers les construit .paquets deb de ClickHouse que vous pouvez déployer même sur vos serveurs de production (si vous n'avez pas peur). - -Très probablement, certaines des constructions échoueront à la première fois. Cela est dû au fait que nous avons vérifier s'appuie à la fois avec gcc, ainsi qu'avec clang, pratiquement tous les avertissements existants (toujours avec le `-Werror` drapeau) activé pour clang. Sur cette même page, vous pouvez trouver tous les journaux de construction afin que vous n'ayez pas à construire ClickHouse de toutes les manières possibles. diff --git a/docs/fr/development/style.md b/docs/fr/development/style.md index 606e6af920e..7d229b7e8f1 100644 --- a/docs/fr/development/style.md +++ b/docs/fr/development/style.md @@ -5,7 +5,7 @@ toc_priority: 68 toc_title: "Comment \xE9crire du Code C++ " --- -# Comment écrire du Code C++ {#how-to-write-c-code} +# Comment écrire Du Code C++ {#how-to-write-c-code} ## Recommandations Générales {#general-recommendations} @@ -15,15 +15,15 @@ toc_title: "Comment \xE9crire du Code C++ " **3.** Le style de Code est nécessaire pour la cohérence. La cohérence facilite la lecture du code et facilite également la recherche du code. -**4.** Beaucoup de règles n'ont pas de raisons logiques; elles sont dictées par des pratiques établies. +**4.** Beaucoup de règles n’ont pas de raisons logiques; elles sont dictées par des pratiques établies. ## Formater {#formatting} **1.** La plupart du formatage se fera automatiquement par `clang-format`. -**2.** Les tirets sont 4 espaces. Configurez votre environnement de développement afin qu'un onglet ajoute quatre espaces. +**2.** Les tirets sont 4 espaces. Configurez votre environnement de développement afin qu’un onglet ajoute quatre espaces. -**3.** Les crochets d'ouverture et de fermeture doivent être sur une ligne séparée. +**3.** Les crochets d’ouverture et de fermeture doivent être sur une ligne séparée. ``` cpp inline void readBoolText(bool & x, ReadBuffer & buf) @@ -34,14 +34,14 @@ inline void readBoolText(bool & x, ReadBuffer & buf) } ``` -**4.** Si le corps entier de la fonction est un `statement` il peut donc être placé sur une seule ligne. Place des espaces autour des accolades (en plus de l'espace à la fin de la ligne). +**4.** Si le corps entier de la fonction est un `statement` il peut donc être placé sur une seule ligne. Place des espaces autour des accolades (en plus de l’espace à la fin de la ligne). ``` cpp inline size_t mask() const { return buf_size() - 1; } inline size_t place(HashValue x) const { return x & mask(); } ``` -**5.** Pour les fonctions. Ne mettez pas d'espaces entre parenthèses. +**5.** Pour les fonctions. Ne mettez pas d’espaces entre parenthèses. ``` cpp void reinsert(const Value & x) @@ -51,7 +51,7 @@ void reinsert(const Value & x) memcpy(&buf[place_value], &x, sizeof(x)); ``` -**6.** Dans `if`, `for`, `while` et d'autres expressions, un espace est inséré devant le support d'ouverture (par opposition aux appels de fonction). +**6.** Dans `if`, `for`, `while` et d’autres expressions, un espace est inséré devant le support d’ouverture (par opposition aux appels de fonction). ``` cpp for (size_t i = 0; i < rows; i += storage.index_granularity) @@ -65,7 +65,7 @@ UInt8 month = (s[5] - '0') * 10 + (s[6] - '0'); UInt8 day = (s[8] - '0') * 10 + (s[9] - '0'); ``` -**8.** Si un saut de ligne est entré, placez l'opérateur sur une nouvelle ligne et augmentez le retrait avant. +**8.** Si un saut de ligne est entré, placez l’opérateur sur une nouvelle ligne et augmentez le retrait avant. ``` cpp if (elapsed_ns) @@ -74,7 +74,7 @@ if (elapsed_ns) << bytes_read_on_server * 1000.0 / elapsed_ns << " MB/s.) "; ``` -**9.** Vous pouvez utiliser des espaces pour l'alignement dans une ligne, si vous le souhaitez. +**9.** Vous pouvez utiliser des espaces pour l’alignement dans une ligne, si vous le souhaitez. ``` cpp dst.ClickLogID = click.LogID; @@ -82,17 +82,17 @@ dst.ClickEventID = click.EventID; dst.ClickGoodEvent = click.GoodEvent; ``` -**10.** N'utilisez pas d'espaces autour des opérateurs `.`, `->`. +**10.** N’utilisez pas d’espaces autour des opérateurs `.`, `->`. -Si nécessaire, l'opérateur peut être renvoyé à la ligne suivante. Dans ce cas, le décalage devant celui-ci est augmenté. +Si nécessaire, l’opérateur peut être renvoyé à la ligne suivante. Dans ce cas, le décalage devant celui-ci est augmenté. -**11.** N'utilisez pas d'espace pour séparer les opérateurs unaires (`--`, `++`, `*`, `&`, …) from the argument. +**11.** N’utilisez pas d’espace pour séparer les opérateurs unaires (`--`, `++`, `*`, `&`, …) from the argument. -**12.** Mettre un espace après une virgule, mais pas avant. La même règle vaut pour un point-virgule à l'intérieur d'un `for` expression. +**12.** Mettre un espace après une virgule, mais pas avant. La même règle vaut pour un point-virgule à l’intérieur d’un `for` expression. **13.** Ne pas utiliser des espaces pour séparer les `[]` opérateur. -**14.** Dans un `template <...>` expression, utiliser un espace entre les `template` et `<`; pas d'espace après `<` ou avant `>`. +**14.** Dans un `template <...>` expression, utiliser un espace entre les `template` et `<`; pas d’espace après `<` ou avant `>`. ``` cpp template @@ -113,11 +113,11 @@ public: } ``` -**16.** Si le même `namespace` est utilisé pour l'ensemble du fichier, et il n'y a rien d'autre significatif, un décalage n'est pas nécessaire à l'intérieur `namespace`. +**16.** Si le même `namespace` est utilisé pour l’ensemble du fichier, et il n’y a rien d’autre significatif, un décalage n’est pas nécessaire à l’intérieur `namespace`. -**17.** Si le bloc pour un `if`, `for`, `while` ou autres expressions se compose d'un seul `statement`, les accolades sont facultatives. Place de la `statement` sur une ligne séparée, à la place. Cette règle est également valable pour les imbriqués `if`, `for`, `while`, … +**17.** Si le bloc pour un `if`, `for`, `while` ou autres expressions se compose d’un seul `statement`, les accolades sont facultatives. Place de la `statement` sur une ligne séparée, à la place. Cette règle est également valable pour les imbriqués `if`, `for`, `while`, … -Mais si l'intérieur `statement` contient des accolades ou `else` le bloc externe doit être écrit dans les accolades. +Mais si l’intérieur `statement` contient des accolades ou `else` le bloc externe doit être écrit dans les accolades. ``` cpp /// Finish write. @@ -125,7 +125,7 @@ for (auto & stream : streams) stream.second->finalize(); ``` -**18.** Il ne devrait pas y avoir d'espaces aux extrémités des lignes. +**18.** Il ne devrait pas y avoir d’espaces aux extrémités des lignes. **19.** Les fichiers Source sont encodés en UTF-8. @@ -135,9 +135,9 @@ for (auto & stream : streams) << ", " << (timer.elapsed() / chunks_stats.hits) << " μsec/hit."; ``` -**21.** N'écrivez pas plusieurs expressions sur une seule ligne. +**21.** N’écrivez pas plusieurs expressions sur une seule ligne. -**22.** Groupez les sections de code à l'intérieur des fonctions et séparez-les avec pas plus d'une ligne vide. +**22.** Groupez les sections de code à l’intérieur des fonctions et séparez-les avec pas plus d’une ligne vide. **23.** Séparez les fonctions, les classes, etc. avec une ou deux lignes vides. @@ -151,7 +151,7 @@ const std::string & s char const * pos ``` -**25.** Lors de la déclaration d'un pointeur ou d'une référence, le `*` et `&` les symboles doivent être séparés par des espaces des deux côtés. +**25.** Lors de la déclaration d’un pointeur ou d’une référence, le `*` et `&` les symboles doivent être séparés par des espaces des deux côtés. ``` cpp //correct @@ -161,9 +161,9 @@ const char* pos const char *pos ``` -**26.** Lors de l'utilisation de types de modèles, les alias avec le `using` mot-clé (sauf dans les cas les plus simples). +**26.** Lors de l’utilisation de types de modèles, les alias avec le `using` mot-clé (sauf dans les cas les plus simples). -En d'autres termes, les paramètres du modèle sont indiquées que dans `using` et ne sont pas répétés dans le code. +En d’autres termes, les paramètres du modèle sont indiquées que dans `using` et ne sont pas répétés dans le code. `using` peut être déclaré localement, comme dans une fonction. @@ -182,7 +182,7 @@ std::map> streams; int x, *y; ``` -**28.** N'utilisez pas de moulages de style C. +**28.** N’utilisez pas de moulages de style C. ``` cpp //incorrect @@ -193,15 +193,15 @@ std::cerr << static_cast(c) << std::endl; **29.** Dans les classes et les structures, groupez les membres et les fonctions séparément dans chaque portée de visibilité. -**30.** Pour les petites classes et structures, il n'est pas nécessaire de séparer la déclaration de méthode de l'implémentation. +**30.** Pour les petites classes et structures, il n’est pas nécessaire de séparer la déclaration de méthode de l’implémentation. La même chose est vraie pour les petites méthodes dans toutes les classes ou structures. -Pour les classes et les structures modélisées, ne séparez pas les déclarations de méthode de l'implémentation (car sinon elles doivent être définies dans la même unité de traduction). +Pour les classes et les structures modélisées, ne séparez pas les déclarations de méthode de l’implémentation (car sinon elles doivent être définies dans la même unité de traduction). **31.** Vous pouvez envelopper des lignes à 140 caractères, au lieu de 80. -**32.** Utilisez toujours les opérateurs d'incrémentation/décrémentation de préfixe si postfix n'est pas requis. +**32.** Utilisez toujours les opérateurs d’incrémentation/décrémentation de préfixe si postfix n’est pas requis. ``` cpp for (Names::const_iterator it = column_names.begin(); it != column_names.end(); ++it) @@ -209,9 +209,9 @@ for (Names::const_iterator it = column_names.begin(); it != column_names.end(); ## Commentaire {#comments} -**1.** Assurez-vous d'ajouter des commentaires pour toutes les parties non triviales du code. +**1.** Assurez-vous d’ajouter des commentaires pour toutes les parties non triviales du code. -C'est très important. Écrit le commentaire peut vous aider à réaliser que le code n'est pas nécessaire, ou qu'il est mal conçu. +C’est très important. Écrit le commentaire peut vous aider à réaliser que le code n’est pas nécessaire, ou qu’il est mal conçu. ``` cpp /** Part of piece of memory, that can be used. @@ -223,7 +223,7 @@ C'est très important. Écrit le commentaire peut vous aider à réaliser que le **2.** Les commentaires peuvent être aussi détaillées que nécessaire. -**3.** Placez les commentaires avant le code qu'ils décrivent. Dans de rares cas, des commentaires peuvent venir après le code, sur la même ligne. +**3.** Placez les commentaires avant le code qu’ils décrivent. Dans de rares cas, des commentaires peuvent venir après le code, sur la même ligne. ``` cpp /** Parses and executes the query. @@ -239,9 +239,9 @@ void executeQuery( **4.** Les commentaires doivent être rédigés en anglais seulement. -**5.** Si vous écrivez une bibliothèque, incluez des commentaires détaillés l'expliquant dans le fichier d'en-tête principal. +**5.** Si vous écrivez une bibliothèque, incluez des commentaires détaillés l’expliquant dans le fichier d’en-tête principal. -**6.** N'ajoutez pas de commentaires qui ne fournissent pas d'informations supplémentaires. En particulier, ne laissez pas de commentaires vides comme celui-ci: +**6.** N’ajoutez pas de commentaires qui ne fournissent pas d’informations supplémentaires. En particulier, ne laissez pas de commentaires vides comme celui-ci: ``` cpp /* @@ -264,13 +264,13 @@ void executeQuery( */ ``` -L'exemple est emprunté à partir de la ressource http://home.tamk.fi/~jaalto/cours/coding-style/doc/désuète-code/. +L’exemple est emprunté à partir de la ressource http://home.tamk.fi/~jaalto/cours/coding-style/doc/désuète-code/. **7.** Ne pas écrire des commentaires de déchets (auteur, date de création .. au début de chaque fichier. **8.** Les commentaires sur une seule ligne commencent par trois barres obliques: `///` et les commentaires multi-lignes commencer avec `/**`. Ces commentaires sont pris en considération “documentation”. -REMARQUE: Vous pouvez utiliser Doxygen pour générer de la documentation à partir de ces commentaires. Mais Doxygen n'est généralement pas utilisé car il est plus pratique de naviguer dans le code dans L'IDE. +REMARQUE: Vous pouvez utiliser Doxygen pour générer de la documentation à partir de ces commentaires. Mais Doxygen n’est généralement pas utilisé car il est plus pratique de naviguer dans le code dans L’IDE. **9.** Les commentaires multilignes ne doivent pas avoir de lignes vides au début et à la fin (sauf la ligne qui ferme un commentaire multilignes). @@ -278,15 +278,15 @@ REMARQUE: Vous pouvez utiliser Doxygen pour générer de la documentation à par **11.** Supprimez les parties commentées du code avant de valider. -**12.** N'utilisez pas de blasphème dans les commentaires ou le code. +**12.** N’utilisez pas de blasphème dans les commentaires ou le code. -**13.** N'utilisez pas de majuscules. N'utilisez pas de ponctuation excessive. +**13.** N’utilisez pas de majuscules. N’utilisez pas de ponctuation excessive. ``` cpp /// WHAT THE FAIL??? ``` -**14.** N'utilisez pas de commentaires pour créer des délimiteurs. +**14.** N’utilisez pas de commentaires pour créer des délimiteurs. ``` cpp ///****************************************************** @@ -298,7 +298,7 @@ REMARQUE: Vous pouvez utiliser Doxygen pour générer de la documentation à par /// Why did you do this stuff? ``` -**16.** Il n'est pas nécessaire d'écrire un commentaire à la fin d'un bloc décrivant de quoi il s'agissait. +**16.** Il n’est pas nécessaire d’écrire un commentaire à la fin d’un bloc décrivant de quoi il s’agissait. ``` cpp /// for @@ -370,8 +370,8 @@ Si le fichier contient une seule fonction, nommez le fichier de la même manièr **11.** Si le nom contient une abréviation, puis: -- Pour les noms de variables, l'abréviation doit utiliser des lettres minuscules `mysql_connection` (pas `mySQL_connection`). -- Pour les noms de classes et de fonctions, conservez les majuscules dans l'abréviation`MySQLConnection` (pas `MySqlConnection`). +- Pour les noms de variables, l’abréviation doit utiliser des lettres minuscules `mysql_connection` (pas `mySQL_connection`). +- Pour les noms de classes et de fonctions, conservez les majuscules dans l’abréviation`MySQLConnection` (pas `MySqlConnection`). **12.** Les arguments du constructeur utilisés uniquement pour initialiser les membres de la classe doivent être nommés de la même manière que les membres de la classe, mais avec un trait de soulignement à la fin. @@ -388,15 +388,15 @@ FileQueueProcessor( } ``` -Le suffixe de soulignement peut être omis si l'argument n'est pas utilisé dans le corps du constructeur. +Le suffixe de soulignement peut être omis si l’argument n’est pas utilisé dans le corps du constructeur. -**13.** Il n'y a pas de différence dans les noms des variables locales et des membres de classe (aucun préfixe requis). +**13.** Il n’y a pas de différence dans les noms des variables locales et des membres de classe (aucun préfixe requis). ``` cpp timer (not m_timer) ``` -**14.** Pour les constantes dans un `enum`, utilisez CamelCase avec une lettre majuscule. ALL\_CAPS est également acceptable. Si l' `enum` est non local, utilisez un `enum class`. +**14.** Pour les constantes dans un `enum`, utilisez CamelCase avec une lettre majuscule. ALL\_CAPS est également acceptable. Si l’ `enum` est non local, utilisez un `enum class`. ``` cpp enum class CompressionMethod @@ -406,37 +406,37 @@ enum class CompressionMethod }; ``` -**15.** Tous les noms doivent être en anglais. La translittération des mots russes n'est pas autorisé. +**15.** Tous les noms doivent être en anglais. La translittération des mots russes n’est pas autorisé. not Stroka -**16.** Les abréviations sont acceptables si elles sont bien connues (quand vous pouvez facilement trouver la signification de l'abréviation dans Wikipédia ou dans un moteur de recherche). +**16.** Les abréviations sont acceptables si elles sont bien connues (quand vous pouvez facilement trouver la signification de l’abréviation dans Wikipédia ou dans un moteur de recherche). `AST`, `SQL`. Not `NVDH` (some random letters) -Les mots incomplets sont acceptables si la version abrégée est d'usage courant. +Les mots incomplets sont acceptables si la version abrégée est d’usage courant. Vous pouvez également utiliser une abréviation si le nom complet est ensuite incluse dans les commentaires. -**17.** Les noms de fichiers avec le code source C++ doivent avoir `.cpp` extension. Fichiers d'en-tête doit avoir la `.h` extension. +**17.** Les noms de fichiers avec le code source C++ doivent avoir `.cpp` extension. Fichiers d’en-tête doit avoir la `.h` extension. -## Comment écrire du Code {#how-to-write-code} +## Comment écrire Du Code {#how-to-write-code} **1.** Gestion de la mémoire. Désallocation manuelle de la mémoire (`delete`) ne peut être utilisé que dans le code de la bibliothèque. -Dans le code de la bibliothèque, de la `delete` l'opérateur ne peut être utilisé dans des destructeurs. +Dans le code de la bibliothèque, de la `delete` l’opérateur ne peut être utilisé dans des destructeurs. -Dans le code de l'application, la mémoire doit être libérée par l'objet qui la possède. +Dans le code de l’application, la mémoire doit être libérée par l’objet qui la possède. Exemple: -- Le plus simple est de placer un objet sur la pile, ou d'en faire un membre d'une autre classe. +- Le plus simple est de placer un objet sur la pile, ou d’en faire un membre d’une autre classe. - Pour un grand nombre de petits objets, utiliser des récipients. -- Pour la désallocation automatique d'un petit nombre d'objets qui résident dans le tas, utilisez `shared_ptr/unique_ptr`. +- Pour la désallocation automatique d’un petit nombre d’objets qui résident dans le tas, utilisez `shared_ptr/unique_ptr`. **2.** La gestion des ressources. @@ -444,11 +444,11 @@ Utiliser `RAII` et voir ci-dessus. **3.** La gestion des erreurs. -Utilisez des exceptions. Dans la plupart des cas, vous avez seulement besoin de lancer une exception, et n'avez pas besoin de l'attraper (à cause de `RAII`). +Utilisez des exceptions. Dans la plupart des cas, vous avez seulement besoin de lancer une exception, et n’avez pas besoin de l’attraper (à cause de `RAII`). -Dans les applications de traitement de données hors ligne, il est souvent acceptable de ne pas attraper d'exceptions. +Dans les applications de traitement de données hors ligne, il est souvent acceptable de ne pas attraper d’exceptions. -Dans les serveurs qui gèrent les demandes des utilisateurs, il suffit généralement d'attraper des exceptions au niveau supérieur du gestionnaire de connexion. +Dans les serveurs qui gèrent les demandes des utilisateurs, il suffit généralement d’attraper des exceptions au niveau supérieur du gestionnaire de connexion. Dans les fonctions de thread, vous devez attraper et conserver toutes les exceptions pour les repasser dans le thread principal après `join`. @@ -485,7 +485,7 @@ catch (const DB::Exception & e) } ``` -Lorsque vous utilisez des fonctions avec des codes de réponse ou `errno` toujours vérifier le résultat et de lever une exception en cas d'erreur. +Lorsque vous utilisez des fonctions avec des codes de réponse ou `errno` toujours vérifier le résultat et de lever une exception en cas d’erreur. ``` cpp if (0 != close(fd)) @@ -494,24 +494,24 @@ if (0 != close(fd)) `Do not use assert`. -**4.** Les types d'Exception. +**4.** Les types d’Exception. -Il n'est pas nécessaire d'utiliser une hiérarchie d'exceptions complexe dans le code de l'application. Le texte d'exception doit être compréhensible pour un administrateur système. +Il n’est pas nécessaire d’utiliser une hiérarchie d’exceptions complexe dans le code de l’application. Le texte d’exception doit être compréhensible pour un administrateur système. **5.** Lancer des exceptions de destructeurs. -Ce n'est pas recommandé, mais il est permis. +Ce n’est pas recommandé, mais il est permis. Utilisez les options suivantes: - Créer une fonction (`done()` ou `finalize()`) qui vont faire tout le travail en amont qui pourrait conduire à une exception. Si cette fonction a été appelée, il ne devrait y avoir aucune exception dans le destructeur plus tard. -- Les tâches trop complexes (comme l'envoi de messages sur le réseau) peuvent être placées dans une méthode distincte que l'utilisateur de la classe devra appeler avant la destruction. -- Si il y a une exception dans le destructeur, il est préférable de l'enregistrer que de le cacher (si l'enregistreur est disponible). +- Les tâches trop complexes (comme l’envoi de messages sur le réseau) peuvent être placées dans une méthode distincte que l’utilisateur de la classe devra appeler avant la destruction. +- Si il y a une exception dans le destructeur, il est préférable de l’enregistrer que de le cacher (si l’enregistreur est disponible). - Dans les applications simples, il est acceptable de compter sur `std::terminate` (pour les cas de `noexcept` par défaut en C++11) pour gérer les exceptions. **6.** Blocs de code anonymes. -Vous pouvez créer un bloc de code séparé à l'intérieur d'une seule fonction afin de rendre certaines variables locales, de sorte que les destructeurs sont appelés à la sortie du bloc. +Vous pouvez créer un bloc de code séparé à l’intérieur d’une seule fonction afin de rendre certaines variables locales, de sorte que les destructeurs sont appelés à la sortie du bloc. ``` cpp Block block = data.in->read(); @@ -529,25 +529,25 @@ ready_any.set(); Dans les programmes de traitement de données hors ligne: -- Essayez d'obtenir les meilleures performances possibles sur un seul noyau CPU. Vous pouvez ensuite paralléliser votre code si nécessaire. +- Essayez d’obtenir les meilleures performances possibles sur un seul noyau CPU. Vous pouvez ensuite paralléliser votre code si nécessaire. Dans les applications serveur: -- Utiliser le pool de threads pour traiter les demandes. À ce stade, nous n'avons pas eu de tâches nécessitant un changement de contexte dans l'espace utilisateur. +- Utiliser le pool de threads pour traiter les demandes. À ce stade, nous n’avons pas eu de tâches nécessitant un changement de contexte dans l’espace utilisateur. -La fourche n'est pas utilisé pour la parallélisation. +La fourche n’est pas utilisé pour la parallélisation. **8.** Synchronisation des threads. Souvent, il est possible de faire en sorte que différents threads utilisent différentes cellules de mémoire (encore mieux: différentes lignes de cache,) et de ne pas utiliser de synchronisation de thread (sauf `joinAll`). -Si la synchronisation est nécessaire, dans la plupart des cas, il suffit d'utiliser mutex sous `lock_guard`. +Si la synchronisation est nécessaire, dans la plupart des cas, il suffit d’utiliser mutex sous `lock_guard`. -Dans d'autres cas, utilisez des primitives de synchronisation système. Ne pas utiliser occupé attendre. +Dans d’autres cas, utilisez des primitives de synchronisation système. Ne pas utiliser occupé attendre. Les opérations atomiques ne doivent être utilisées que dans les cas les plus simples. -N'essayez pas d'implémenter des structures de données sans verrou à moins qu'il ne s'agisse de votre principal domaine d'expertise. +N’essayez pas d’implémenter des structures de données sans verrou à moins qu’il ne s’agisse de votre principal domaine d’expertise. **9.** Pointeurs vs références. @@ -557,7 +557,7 @@ Dans la plupart des cas, préférez les références. Utiliser des références constantes, des pointeurs vers des constantes, `const_iterator` et const méthodes. -Considérer `const` pour être par défaut et utiliser non-`const` seulement quand c'est nécessaire. +Considérer `const` pour être par défaut et utiliser non-`const` seulement quand c’est nécessaire. Lors du passage de variables par valeur, en utilisant `const` habituellement ne fait pas de sens. @@ -569,21 +569,21 @@ Utiliser `unsigned` si nécessaire. Utiliser les types `UInt8`, `UInt16`, `UInt32`, `UInt64`, `Int8`, `Int16`, `Int32`, et `Int64` ainsi que `size_t`, `ssize_t`, et `ptrdiff_t`. -N'utilisez pas ces types pour les nombres: `signed/unsigned long`, `long long`, `short`, `signed/unsigned char`, `char`. +N’utilisez pas ces types pour les nombres: `signed/unsigned long`, `long long`, `short`, `signed/unsigned char`, `char`. **13.** Passer des arguments. Passer des valeurs complexes par référence (y compris `std::string`). -Si une fonction capture la propriété d'un objet créé dans le tas, définissez le type d'argument `shared_ptr` ou `unique_ptr`. +Si une fonction capture la propriété d’un objet créé dans le tas, définissez le type d’argument `shared_ptr` ou `unique_ptr`. **14.** Les valeurs de retour. -Dans la plupart des cas, il suffit d'utiliser `return`. Ne pas écrire `[return std::move(res)]{.strike}`. +Dans la plupart des cas, il suffit d’utiliser `return`. Ne pas écrire `[return std::move(res)]{.strike}`. Si la fonction alloue un objet sur le tas et le renvoie, utilisez `shared_ptr` ou `unique_ptr`. -Dans de rares cas, vous devrez peut-être renvoyer la valeur via un argument. Dans ce cas, l'argument doit être une référence. +Dans de rares cas, vous devrez peut-être renvoyer la valeur via un argument. Dans ce cas, l’argument doit être une référence. ``` cpp using AggregateFunctionPtr = std::shared_ptr; @@ -599,23 +599,23 @@ public: **15.** espace de noms. -Il n'est pas nécessaire d'utiliser une `namespace` pour le code de l'application. +Il n’est pas nécessaire d’utiliser une `namespace` pour le code de l’application. -Les petites bibliothèques n'ont pas besoin de cela non plus. +Les petites bibliothèques n’ont pas besoin de cela non plus. Pour les bibliothèques moyennes et grandes, mettez tout dans un `namespace`. -Dans la bibliothèque `.h` fichier, vous pouvez utiliser `namespace detail` pour masquer les détails d'implémentation non nécessaires pour le code de l'application. +Dans la bibliothèque `.h` fichier, vous pouvez utiliser `namespace detail` pour masquer les détails d’implémentation non nécessaires pour le code de l’application. Dans un `.cpp` fichier, vous pouvez utiliser un `static` ou un espace de noms anonyme pour masquer les symboles. -Aussi, un `namespace` peut être utilisé pour un `enum` pour éviter que les noms correspondants ne tombent dans un `namespace` (mais il est préférable d'utiliser un `enum class`). +Aussi, un `namespace` peut être utilisé pour un `enum` pour éviter que les noms correspondants ne tombent dans un `namespace` (mais il est préférable d’utiliser un `enum class`). **16.** Initialisation différée. -Si des arguments sont requis pour l'initialisation, vous ne devriez normalement pas écrire de constructeur par défaut. +Si des arguments sont requis pour l’initialisation, vous ne devriez normalement pas écrire de constructeur par défaut. -Si plus tard, vous devez retarder l'initialisation, vous pouvez ajouter un constructeur par défaut qui créera un objet invalide. Ou, pour un petit nombre d'objets, vous pouvez utiliser `shared_ptr/unique_ptr`. +Si plus tard, vous devez retarder l’initialisation, vous pouvez ajouter un constructeur par défaut qui créera un objet invalide. Ou, pour un petit nombre d’objets, vous pouvez utiliser `shared_ptr/unique_ptr`. ``` cpp Loader(DB::Connection * connection_, const std::string & query, size_t max_block_size_); @@ -626,7 +626,7 @@ Loader() {} **17.** Des fonctions virtuelles. -Si la classe n'est pas destinée à une utilisation polymorphe, vous n'avez pas besoin de rendre les fonctions virtuelles. Ceci s'applique également pour le destructeur. +Si la classe n’est pas destinée à une utilisation polymorphe, vous n’avez pas besoin de rendre les fonctions virtuelles. Ceci s’applique également pour le destructeur. **18.** Encodage. @@ -638,37 +638,37 @@ Voir les exemples partout dans le code. Avant de valider, supprimez toute journalisation sans signification et de débogage, ainsi que tout autre type de sortie de débogage. -L'enregistrement des cycles doit être évité, même au niveau de la Trace. +L’enregistrement des cycles doit être évité, même au niveau de la Trace. -Les journaux doivent être lisibles à tout niveau d'enregistrement. +Les journaux doivent être lisibles à tout niveau d’enregistrement. -La journalisation ne doit être utilisée que dans le code de l'application, pour la plupart. +La journalisation ne doit être utilisée que dans le code de l’application, pour la plupart. Les messages du journal doivent être écrits en anglais. -Le journal devrait de préférence être compréhensible pour l'administrateur système. +Le journal devrait de préférence être compréhensible pour l’administrateur système. -N'utilisez pas de blasphème dans le journal. +N’utilisez pas de blasphème dans le journal. -Utilisez L'encodage UTF-8 dans le journal. Dans de rares cas, vous pouvez utiliser des caractères non-ASCII dans le journal. +Utilisez L’encodage UTF-8 dans le journal. Dans de rares cas, vous pouvez utiliser des caractères non-ASCII dans le journal. -**20.** D'entrée-sortie. +**20.** D’entrée-sortie. -Ne pas utiliser de `iostreams` dans les cycles internes qui sont critiques pour les performances de l'application (et ne jamais utiliser `stringstream`). +Ne pas utiliser de `iostreams` dans les cycles internes qui sont critiques pour les performances de l’application (et ne jamais utiliser `stringstream`). -L'utilisation de la `DB/IO` la bibliothèque la place. +L’utilisation de la `DB/IO` la bibliothèque la place. -**21.** La Date et l'heure. +**21.** La Date et l’heure. Voir la `DateLUT` bibliothèque. **22.** comprendre. -Toujours utiliser `#pragma once` au lieu d'inclure des gardes. +Toujours utiliser `#pragma once` au lieu d’inclure des gardes. **23.** utiliser. -`using namespace` n'est pas utilisé. Vous pouvez utiliser `using` avec quelque chose de spécifique. Mais faire local à l'intérieur d'une classe ou d'une fonction. +`using namespace` n’est pas utilisé. Vous pouvez utiliser `using` avec quelque chose de spécifique. Mais faire local à l’intérieur d’une classe ou d’une fonction. **24.** Ne pas utiliser de `trailing return type` pour les fonctions, sauf si nécessaire. @@ -687,13 +687,13 @@ std::string s{"Hello"}; auto s = std::string{"Hello"}; ``` -**26.** Pour les fonctions virtuelles, écrire `virtual` dans la classe de base, mais d'écrire `override` plutôt `virtual` dans les classes descendantes. +**26.** Pour les fonctions virtuelles, écrire `virtual` dans la classe de base, mais d’écrire `override` plutôt `virtual` dans les classes descendantes. -## Fonctionnalités inutilisées de C++ {#unused-features-of-c} +## Fonctionnalités inutilisées De C++ {#unused-features-of-c} -**1.** L'héritage virtuel n'est pas utilisé. +**1.** L’héritage virtuel n’est pas utilisé. -**2.** Les spécificateurs d'Exception de C++03 ne sont pas utilisés. +**2.** Les spécificateurs d’Exception de C++03 ne sont pas utilisés. ## Plate {#platform} @@ -709,9 +709,9 @@ La bibliothèque standard est utilisée (`libstdc++` ou `libc++`). **4.**OS: Linux Ubuntu, pas plus vieux que précis. -**5.**Le Code est écrit pour l'architecture CPU x86\_64. +**5.**Le Code est écrit pour l’architecture CPU x86\_64. -Le jeu D'instructions CPU est l'ensemble minimum pris en charge parmi nos serveurs. Actuellement, il s'agit de SSE 4.2. +Le jeu D’instructions CPU est l’ensemble minimum pris en charge parmi nos serveurs. Actuellement, il s’agit de SSE 4.2. **6.** Utiliser `-Wall -Wextra -Werror` drapeaux de compilation. @@ -737,11 +737,11 @@ Le jeu D'instructions CPU est l'ensemble minimum pris en charge parmi nos serveu Bien que seules les révisions sélectionnées soient considérées comme réalisables. -**8.** Faire s'engage aussi souvent que possible, même si le code n'est que partiellement prêt. +**8.** Faire s’engage aussi souvent que possible, même si le code n’est que partiellement prêt. Utilisez des branches à cet effet. -Si votre code dans le `master` la branche n'est pas constructible pourtant, l'exclure de la construction avant que le `push`. Vous devrez le terminer ou l'enlever dans quelques jours. +Si votre code dans le `master` la branche n’est pas constructible pourtant, l’exclure de la construction avant que le `push`. Vous devrez le terminer ou l’enlever dans quelques jours. **9.** Pour les modifications non triviales, utilisez les branches et publiez-les sur le serveur. @@ -753,13 +753,13 @@ Si votre code dans le `master` la branche n'est pas constructible pourtant, l'ex **2.** Si nécessaire, vous pouvez utiliser toutes les bibliothèques bien connues disponibles dans le package OS. -S'il existe déjà une bonne solution, utilisez-la, même si cela signifie que vous devez installer une autre bibliothèque. +S’il existe déjà une bonne solution, utilisez-la, même si cela signifie que vous devez installer une autre bibliothèque. (Mais soyez prêt à supprimer les mauvaises bibliothèques du code.) -**3.** Vous pouvez installer une bibliothèque qui n'est pas dans les paquets, les paquets n'ont pas ce que vous souhaitez ou avez une version périmée ou le mauvais type de compilation. +**3.** Vous pouvez installer une bibliothèque qui n’est pas dans les paquets, les paquets n’ont pas ce que vous souhaitez ou avez une version périmée ou le mauvais type de compilation. -**4.** Si la Bibliothèque est petite et n'a pas son propre système de construction complexe, placez les fichiers source dans le `contrib` dossier. +**4.** Si la Bibliothèque est petite et n’a pas son propre système de construction complexe, placez les fichiers source dans le `contrib` dossier. **5.** La préférence est toujours donnée aux bibliothèques déjà utilisées. @@ -769,11 +769,11 @@ S'il existe déjà une bonne solution, utilisez-la, même si cela signifie que v **2.** Essayez la solution la plus simple. -**3.** N'écrivez pas de code tant que vous ne savez pas comment cela va fonctionner et comment la boucle interne fonctionnera. +**3.** N’écrivez pas de code tant que vous ne savez pas comment cela va fonctionner et comment la boucle interne fonctionnera. **4.** Dans les cas les plus simples, utilisez `using` au lieu de classes ou des structures. -**5.** Si possible, n'écrivez pas de constructeurs de copie, d'opérateurs d'affectation, de destructeurs (autres que Virtuels, si la classe contient au moins une fonction virtuelle), de constructeurs de déplacement ou d'opérateurs d'affectation de déplacement. En d'autres termes, les fonctions générées par le compilateur doivent fonctionner correctement. Vous pouvez utiliser `default`. +**5.** Si possible, n’écrivez pas de constructeurs de copie, d’opérateurs d’affectation, de destructeurs (autres que Virtuels, si la classe contient au moins une fonction virtuelle), de constructeurs de déplacement ou d’opérateurs d’affectation de déplacement. En d’autres termes, les fonctions générées par le compilateur doivent fonctionner correctement. Vous pouvez utiliser `default`. **6.** La simplification du Code est encouragée. Réduire la taille de votre code si possible. @@ -781,15 +781,15 @@ S'il existe déjà une bonne solution, utilisez-la, même si cela signifie que v **1.** Spécifier explicitement `std::` pour les types de `stddef.h` -n'est pas recommandé. En d'autres termes, nous vous recommandons d'écriture `size_t` plutôt `std::size_t` parce que c'est plus court. +n’est pas recommandé. En d’autres termes, nous vous recommandons d’écriture `size_t` plutôt `std::size_t` parce que c’est plus court. -Il est acceptable d'ajouter `std::`. +Il est acceptable d’ajouter `std::`. **2.** Spécifier explicitement `std::` pour les fonctions de la bibliothèque C standard -n'est pas recommandé. En d'autres termes, écrire `memcpy` plutôt `std::memcpy`. +n’est pas recommandé. En d’autres termes, écrire `memcpy` plutôt `std::memcpy`. -La raison en est qu'il existe des fonctions non standard similaires, telles que `memmem`. Nous utilisons ces fonctions à l'occasion. Ces fonctions n'existent pas dans `namespace std`. +La raison en est qu’il existe des fonctions non standard similaires, telles que `memmem`. Nous utilisons ces fonctions à l’occasion. Ces fonctions n’existent pas dans `namespace std`. Si vous écrivez `std::memcpy` plutôt `memcpy` partout, puis `memmem` sans `std::` va sembler étrange. @@ -797,13 +797,13 @@ Néanmoins, vous pouvez toujours utiliser `std::` si vous le souhaitez. **3.** Utilisation des fonctions de C lorsque les mêmes sont disponibles dans la bibliothèque C++ standard. -Ceci est acceptable s'il est plus efficace. +Ceci est acceptable s’il est plus efficace. -Par exemple, l'utilisation `memcpy` plutôt `std::copy` pour copier de gros morceaux de mémoire. +Par exemple, l’utilisation `memcpy` plutôt `std::copy` pour copier de gros morceaux de mémoire. **4.** Arguments de fonction multiligne. -L'un des styles d'emballage suivants est autorisé: +L’un des styles d’emballage suivants est autorisé: ``` cpp function( diff --git a/docs/fr/development/tests.md b/docs/fr/development/tests.md index 6637e9546fe..9a34cb5f61f 100644 --- a/docs/fr/development/tests.md +++ b/docs/fr/development/tests.md @@ -11,15 +11,15 @@ toc_title: "Comment ex\xE9cuter des Tests ClickHouse" Les tests fonctionnels sont les plus simples et pratiques à utiliser. La plupart des fonctionnalités de ClickHouse peuvent être testées avec des tests fonctionnels et elles sont obligatoires à utiliser pour chaque changement de code de ClickHouse qui peut être testé de cette façon. -Chaque test fonctionnel envoie une ou plusieurs requêtes au serveur clickhouse en cours d'exécution et compare le résultat avec la référence. +Chaque test fonctionnel envoie une ou plusieurs requêtes au serveur clickhouse en cours d’exécution et compare le résultat avec la référence. -Les Tests sont situés dans `queries` répertoire. Il y a deux sous-répertoires: `stateless` et `stateful`. Les tests sans état exécutent des requêtes sans données de test préchargées - ils créent souvent de petits ensembles de données synthétiques à la volée, dans le test lui-même. Les tests avec État nécessitent des données de test préchargées de Yandex.Metrica et non disponible pour le grand public. Nous avons tendance à utiliser uniquement `stateless` tests et éviter d'ajouter de nouveaux `stateful` test. +Les Tests sont situés dans `queries` répertoire. Il y a deux sous-répertoires: `stateless` et `stateful`. Les tests sans état exécutent des requêtes sans données de test préchargées - ils créent souvent de petits ensembles de données synthétiques à la volée, dans le test lui-même. Les tests avec État nécessitent des données de test préchargées de Yandex.Metrica et non disponible pour le grand public. Nous avons tendance à utiliser uniquement `stateless` tests et éviter d’ajouter de nouveaux `stateful` test. Chaque test peut être de deux types: `.sql` et `.sh`. `.sql` test est le script SQL simple qui est canalisé vers `clickhouse-client --multiquery --testmode`. `.sh` test est un script qui est exécuté par lui-même. Pour exécuter tous les tests, utilisez `clickhouse-test` outil. Regarder `--help` pour la liste des options possibles. Vous pouvez simplement exécuter tous les tests ou exécuter un sous ensemble de tests filtrés par sous chaîne dans le nom du test: `./clickhouse-test substring`. -Le moyen le plus simple d'invoquer des tests fonctionnels est de copier `clickhouse-client` de `/usr/bin/`, exécuter `clickhouse-server` et puis exécutez `./clickhouse-test` à partir de son propre répertoire. +Le moyen le plus simple d’invoquer des tests fonctionnels est de copier `clickhouse-client` de `/usr/bin/`, exécuter `clickhouse-server` et puis exécutez `./clickhouse-test` à partir de son propre répertoire. Pour ajouter un nouveau test, créez un `.sql` ou `.sh` fichier dans `queries/0_stateless` répertoire, vérifiez-le manuellement, puis générez `.reference` fichier de la façon suivante: `clickhouse-client -n --testmode < 00000_test.sql > 00000_test.reference` ou `./00000_test.sh > ./00000_test.reference`. @@ -29,56 +29,56 @@ Si vous souhaitez utiliser des requêtes distribuées dans les tests fonctionnel Certains tests sont marqués avec `zookeeper`, `shard` ou `long` en leurs noms. `zookeeper` est pour les tests qui utilisent ZooKeeper. `shard` est pour les tests -nécessite l'écoute du serveur `127.0.0.*`; `distributed` ou `global` avoir le même -sens. `long` est pour les tests qui s'exécutent légèrement plus longtemps qu'une seconde. Vous pouvez +nécessite l’écoute du serveur `127.0.0.*`; `distributed` ou `global` avoir le même +sens. `long` est pour les tests qui s’exécutent légèrement plus longtemps qu’une seconde. Vous pouvez désactivez ces groupes de tests en utilisant `--no-zookeeper`, `--no-shard` et `--no-long` options, respectivement. -## Bugs connus {#known-bugs} +## Bugs Connus {#known-bugs} Si nous connaissons des bugs qui peuvent être facilement reproduits par des tests fonctionnels, nous plaçons des tests fonctionnels préparés dans `tests/queries/bugs` répertoire. Ces tests seront déplacés à `tests/queries/0_stateless` quand les bugs sont corrigés. -## Les Tests D'Intégration {#integration-tests} +## Les Tests D’Intégration {#integration-tests} -Les tests d'intégration permettent de tester ClickHouse en configuration cluster et clickhouse interaction avec D'autres serveurs comme MySQL, Postgres, MongoDB. Ils sont utiles pour émuler les splits réseau, les chutes de paquets, etc. Ces tests sont exécutés sous Docker et créent plusieurs conteneurs avec divers logiciels. +Les tests d’intégration permettent de tester ClickHouse en configuration cluster et clickhouse interaction avec D’autres serveurs comme MySQL, Postgres, MongoDB. Ils sont utiles pour émuler les splits réseau, les chutes de paquets, etc. Ces tests sont exécutés sous Docker et créent plusieurs conteneurs avec divers logiciels. -Voir `tests/integration/README.md` sur la façon d'exécuter ces tests. +Voir `tests/integration/README.md` sur la façon d’exécuter ces tests. -Notez que l'intégration de ClickHouse avec des pilotes tiers n'est pas testée. De plus, nous n'avons actuellement pas de tests d'intégration avec nos pilotes JDBC et ODBC. +Notez que l’intégration de ClickHouse avec des pilotes tiers n’est pas testée. De plus, nous n’avons actuellement pas de tests d’intégration avec nos pilotes JDBC et ODBC. ## Les Tests Unitaires {#unit-tests} -Les tests unitaires sont utiles lorsque vous voulez tester non pas le ClickHouse dans son ensemble, mais une seule bibliothèque ou classe isolée. Vous pouvez activer ou désactiver la génération de tests avec `ENABLE_TESTS` Option CMake. Les tests unitaires (et autres programmes de test) sont situés dans `tests` sous-répertoires à travers le code. Pour exécuter des tests unitaires, tapez `ninja test`. Certains tests utilisent `gtest`, mais certains ne sont que des programmes qui renvoient un code de sortie non nul en cas d'échec du test. +Les tests unitaires sont utiles lorsque vous voulez tester non pas le ClickHouse dans son ensemble, mais une seule bibliothèque ou classe isolée. Vous pouvez activer ou désactiver la génération de tests avec `ENABLE_TESTS` Option CMake. Les tests unitaires (et autres programmes de test) sont situés dans `tests` sous-répertoires à travers le code. Pour exécuter des tests unitaires, tapez `ninja test`. Certains tests utilisent `gtest`, mais certains ne sont que des programmes qui renvoient un code de sortie non nul en cas d’échec du test. -Ce n'est pas nécessairement d'avoir des tests unitaires si le code est déjà couvert par des tests fonctionnels (et les tests fonctionnels sont généralement beaucoup plus simples à utiliser). +Ce n’est pas nécessairement d’avoir des tests unitaires si le code est déjà couvert par des tests fonctionnels (et les tests fonctionnels sont généralement beaucoup plus simples à utiliser). ## Tests De Performance {#performance-tests} -Les tests de Performance permettent de mesurer et de comparer les performances d'une partie isolée de ClickHouse sur des requêtes synthétiques. Les Tests sont situés à `tests/performance`. Chaque test est représenté par `.xml` fichier avec description du cas de test. Les Tests sont exécutés avec `clickhouse performance-test` outil (qui est incorporé dans `clickhouse` binaire). Voir `--help` pour l'invocation. +Les tests de Performance permettent de mesurer et de comparer les performances d’une partie isolée de ClickHouse sur des requêtes synthétiques. Les Tests sont situés à `tests/performance`. Chaque test est représenté par `.xml` fichier avec description du cas de test. Les Tests sont exécutés avec `clickhouse performance-test` outil (qui est incorporé dans `clickhouse` binaire). Voir `--help` pour l’invocation. -Chaque essai un ou miltiple requêtes (éventuellement avec des combinaisons de paramètres) dans une boucle avec certaines conditions pour l'arrêt (comme “maximum execution speed is not changing in three seconds”) et mesurer certaines mesures sur les performances de la requête (comme “maximum execution speed”). Certains tests peuvent contenir des conditions préalables sur un ensemble de données de test préchargé. +Chaque essai un ou miltiple requêtes (éventuellement avec des combinaisons de paramètres) dans une boucle avec certaines conditions pour l’arrêt (comme “maximum execution speed is not changing in three seconds”) et mesurer certaines mesures sur les performances de la requête (comme “maximum execution speed”). Certains tests peuvent contenir des conditions préalables sur un ensemble de données de test préchargé. -Si vous souhaitez améliorer les performances de ClickHouse dans certains scénarios, et si des améliorations peuvent être observées sur des requêtes simples, il est fortement recommandé d'écrire un test de performance. Il est toujours logique d'utiliser `perf top` ou d'autres outils perf pendant vos tests. +Si vous souhaitez améliorer les performances de ClickHouse dans certains scénarios, et si des améliorations peuvent être observées sur des requêtes simples, il est fortement recommandé d’écrire un test de performance. Il est toujours logique d’utiliser `perf top` ou d’autres outils perf pendant vos tests. ## Outils Et Scripts De Test {#test-tools-and-scripts} -Certains programmes dans `tests` directory ne sont pas des tests préparés, mais sont des outils de test. Par exemple, pour `Lexer` il est un outil `dbms/Parsers/tests/lexer` Cela fait juste la tokenisation de stdin et écrit le résultat colorisé dans stdout. Vous pouvez utiliser ce genre d'outils comme exemples de code et pour l'exploration et les tests manuels. +Certains programmes dans `tests` directory ne sont pas des tests préparés, mais sont des outils de test. Par exemple, pour `Lexer` il est un outil `dbms/Parsers/tests/lexer` Cela fait juste la tokenisation de stdin et écrit le résultat colorisé dans stdout. Vous pouvez utiliser ce genre d’outils comme exemples de code et pour l’exploration et les tests manuels. -Vous pouvez également placer une paire de fichiers `.sh` et `.reference` avec l'outil pour l'exécuter sur une entrée prédéfinie - alors le résultat du script peut être comparé à `.reference` fichier. Ce genre de tests ne sont pas automatisés. +Vous pouvez également placer une paire de fichiers `.sh` et `.reference` avec l’outil pour l’exécuter sur une entrée prédéfinie - alors le résultat du script peut être comparé à `.reference` fichier. Ce genre de tests ne sont pas automatisés. ## Tests Divers {#miscellanous-tests} -Il existe des tests pour les dictionnaires externes situés à `tests/external_dictionaries` et pour machine appris modèles dans `tests/external_models`. Ces tests ne sont pas mis à jour et doivent être transférés aux tests d'intégration. +Il existe des tests pour les dictionnaires externes situés à `tests/external_dictionaries` et pour machine appris modèles dans `tests/external_models`. Ces tests ne sont pas mis à jour et doivent être transférés aux tests d’intégration. -Il y a un test séparé pour les inserts de quorum. Ce test exécute le cluster ClickHouse sur des serveurs séparés et émule divers cas d'échec: scission réseau, chute de paquets (entre les nœuds ClickHouse, entre Clickhouse et ZooKeeper, entre le serveur ClickHouse et le client, etc.), `kill -9`, `kill -STOP` et `kill -CONT` , comme [Jepsen](https://aphyr.com/tags/Jepsen). Ensuite, le test vérifie que toutes les insertions reconnues ont été écrites et que toutes les insertions rejetées ne l'ont pas été. +Il y a un test séparé pour les inserts de quorum. Ce test exécute le cluster ClickHouse sur des serveurs séparés et émule divers cas d’échec: scission réseau, chute de paquets (entre les nœuds ClickHouse, entre Clickhouse et ZooKeeper, entre le serveur ClickHouse et le client, etc.), `kill -9`, `kill -STOP` et `kill -CONT` , comme [Jepsen](https://aphyr.com/tags/Jepsen). Ensuite, le test vérifie que toutes les insertions reconnues ont été écrites et que toutes les insertions rejetées ne l’ont pas été. -Le test de Quorum a été écrit par une équipe distincte avant que ClickHouse ne soit open-source. Cette équipe ne travaille plus avec ClickHouse. Test a été écrit accidentellement en Java. Pour ces raisons, quorum test doit être réécrit et déplacé vers tests d'intégration. +Le test de Quorum a été écrit par une équipe distincte avant que ClickHouse ne soit open-source. Cette équipe ne travaille plus avec ClickHouse. Test a été écrit accidentellement en Java. Pour ces raisons, quorum test doit être réécrit et déplacé vers tests d’intégration. ## Les Tests Manuels {#manual-testing} Lorsque vous développez une nouvelle fonctionnalité, il est raisonnable de tester également manuellement. Vous pouvez le faire avec les étapes suivantes: -Construire ClickHouse. Exécuter ClickHouse à partir du terminal: changer le répertoire à `programs/clickhouse-server` et de l'exécuter avec `./clickhouse-server`. Il utilisera la configuration (`config.xml`, `users.xml` et les fichiers à l'intérieur `config.d` et `users.d` répertoires) à partir du répertoire courant par défaut. Pour vous connecter au serveur ClickHouse, exécutez `programs/clickhouse-client/clickhouse-client`. +Construire ClickHouse. Exécuter ClickHouse à partir du terminal: changer le répertoire à `programs/clickhouse-server` et de l’exécuter avec `./clickhouse-server`. Il utilisera la configuration (`config.xml`, `users.xml` et les fichiers à l’intérieur `config.d` et `users.d` répertoires) à partir du répertoire courant par défaut. Pour vous connecter au serveur ClickHouse, exécutez `programs/clickhouse-client/clickhouse-client`. Notez que tous les outils clickhouse (serveur, client, etc.) ne sont que des liens symboliques vers un seul binaire nommé `clickhouse`. Vous pouvez trouver ce binaire à `programs/clickhouse`. Tous les outils peuvent également être invoquée comme `clickhouse tool` plutôt `clickhouse-tool`. @@ -105,23 +105,23 @@ Exemple avec gdb: $ sudo -u clickhouse gdb --args /usr/bin/clickhouse server --config-file /etc/clickhouse-server/config.xml ``` -Si le système clickhouse-server est déjà en cours d'exécution et que vous ne voulez pas l'arrêter, vous pouvez modifier les numéros de port dans votre `config.xml` (ou de les remplacer dans un fichier `config.d` répertoire), fournissez le chemin de données approprié, et exécutez-le. +Si le système clickhouse-server est déjà en cours d’exécution et que vous ne voulez pas l’arrêter, vous pouvez modifier les numéros de port dans votre `config.xml` (ou de les remplacer dans un fichier `config.d` répertoire), fournissez le chemin de données approprié, et exécutez-le. -`clickhouse` binary n'a presque aucune dépendance et fonctionne sur un large éventail de distributions Linux. Rapide et sale de tester vos modifications sur un serveur, vous pouvez simplement `scp` votre douce construite `clickhouse` binaire à votre serveur et ensuite l'exécuter comme dans les exemples ci-dessus. +`clickhouse` binary n’a presque aucune dépendance et fonctionne sur un large éventail de distributions Linux. Rapide et sale de tester vos modifications sur un serveur, vous pouvez simplement `scp` votre douce construite `clickhouse` binaire à votre serveur et ensuite l’exécuter comme dans les exemples ci-dessus. -## L'Environnement De Test {#testing-environment} +## L’Environnement De Test {#testing-environment} -Avant de publier la version stable, nous la déployons sur l'environnement de test. L'environnement de test est un cluster processus 1/39 partie de [Yandex.Metrica](https://metrica.yandex.com/) données. Nous partageons notre environnement de test avec Yandex.Metrica de l'équipe. ClickHouse est mis à niveau sans temps d'arrêt au-dessus des données existantes. Nous regardons d'abord que les données sont traitées avec succès sans retard par rapport au temps réel, la réplication continue à fonctionner et il n'y a pas de problèmes visibles pour Yandex.Metrica de l'équipe. Première vérification peut être effectuée de la façon suivante: +Avant de publier la version stable, nous la déployons sur l’environnement de test. L’environnement de test est un cluster processus 1/39 partie de [Yandex.Metrica](https://metrica.yandex.com/) données. Nous partageons notre environnement de test avec Yandex.Metrica de l’équipe. ClickHouse est mis à niveau sans temps d’arrêt au-dessus des données existantes. Nous regardons d’abord que les données sont traitées avec succès sans retard par rapport au temps réel, la réplication continue à fonctionner et il n’y a pas de problèmes visibles pour Yandex.Metrica de l’équipe. Première vérification peut être effectuée de la façon suivante: ``` sql SELECT hostName() AS h, any(version()), any(uptime()), max(UTCEventTime), count() FROM remote('example01-01-{1..3}t', merge, hits) WHERE EventDate >= today() - 2 GROUP BY h ORDER BY h; ``` -Dans certains cas, nous déployons également à l'environnement de test de nos équipes d'amis dans Yandex: marché, Cloud, etc. Nous avons également des serveurs matériels qui sont utilisés à des fins de développement. +Dans certains cas, nous déployons également à l’environnement de test de nos équipes d’amis dans Yandex: marché, Cloud, etc. Nous avons également des serveurs matériels qui sont utilisés à des fins de développement. ## Les Tests De Charge {#load-testing} -Après le déploiement dans l'environnement de test, nous exécutons des tests de charge avec des requêtes du cluster de production. Ceci est fait manuellement. +Après le déploiement dans l’environnement de test, nous exécutons des tests de charge avec des requêtes du cluster de production. Ceci est fait manuellement. Assurez-vous que vous avez activé `query_log` sur votre cluster de production. @@ -131,9 +131,9 @@ Recueillir le journal des requêtes pour une journée ou plus: $ clickhouse-client --query="SELECT DISTINCT query FROM system.query_log WHERE event_date = today() AND query LIKE '%ym:%' AND query NOT LIKE '%system.query_log%' AND type = 2 AND is_initial_query" > queries.tsv ``` -C'est une façon compliquée exemple. `type = 2` filtrera les requêtes exécutées avec succès. `query LIKE '%ym:%'` est de sélectionner les requêtes de Yandex.Metrica. `is_initial_query` est de sélectionner uniquement les requêtes initiées par le client, pas par ClickHouse lui-même (en tant que partie du traitement de requête distribué). +C’est une façon compliquée exemple. `type = 2` filtrera les requêtes exécutées avec succès. `query LIKE '%ym:%'` est de sélectionner les requêtes de Yandex.Metrica. `is_initial_query` est de sélectionner uniquement les requêtes initiées par le client, pas par ClickHouse lui-même (en tant que partie du traitement de requête distribué). -`scp` ce journal à votre cluster de test et l'exécuter comme suit: +`scp` ce journal à votre cluster de test et l’exécuter comme suit: ``` bash $ clickhouse benchmark --concurrency 16 < queries.tsv @@ -143,13 +143,13 @@ $ clickhouse benchmark --concurrency 16 < queries.tsv Ensuite, laissez-le pour une nuit ou un week-end et allez vous reposer. -Tu devrais vérifier ça `clickhouse-server` ne plante pas, l'empreinte mémoire est limitée et les performances ne se dégradent pas au fil du temps. +Tu devrais vérifier ça `clickhouse-server` ne plante pas, l’empreinte mémoire est limitée et les performances ne se dégradent pas au fil du temps. -Les délais précis d'exécution des requêtes ne sont pas enregistrés et ne sont pas comparés en raison de la grande variabilité des requêtes et de l'environnement. +Les délais précis d’exécution des requêtes ne sont pas enregistrés et ne sont pas comparés en raison de la grande variabilité des requêtes et de l’environnement. ## Essais De Construction {#build-tests} -Les tests de construction permettent de vérifier que la construction n'est pas interrompue sur diverses configurations alternatives et sur certains systèmes étrangers. Les Tests sont situés à `ci` répertoire. Ils exécutent build from source à L'intérieur de Docker, Vagrant, et parfois avec `qemu-user-static` à l'intérieur de Docker. Ces tests sont en cours de développement et les essais ne sont pas automatisées. +Les tests de construction permettent de vérifier que la construction n’est pas interrompue sur diverses configurations alternatives et sur certains systèmes étrangers. Les Tests sont situés à `ci` répertoire. Ils exécutent build from source à L’intérieur de Docker, Vagrant, et parfois avec `qemu-user-static` à l’intérieur de Docker. Ces tests sont en cours de développement et les essais ne sont pas automatisées. Motivation: @@ -161,47 +161,47 @@ Normalement, nous libérons et exécutons tous les tests sur une seule variante - construire sur la plate-forme AArch64; - construire sur la plate-forme PowerPc. -Par exemple, construire avec des paquets système est une mauvaise pratique, car nous ne pouvons pas garantir quelle version exacte des paquets un système aura. Mais c'est vraiment nécessaire pour les responsables Debian. Pour cette raison, nous devons au moins soutenir cette variante de construction. Un autre exemple: la liaison partagée est une source commune de problèmes, mais elle est nécessaire pour certains amateurs. +Par exemple, construire avec des paquets système est une mauvaise pratique, car nous ne pouvons pas garantir quelle version exacte des paquets un système aura. Mais c’est vraiment nécessaire pour les responsables Debian. Pour cette raison, nous devons au moins soutenir cette variante de construction. Un autre exemple: la liaison partagée est une source commune de problèmes, mais elle est nécessaire pour certains amateurs. Bien que nous ne puissions pas exécuter tous les tests sur toutes les variantes de builds, nous voulons vérifier au moins que les différentes variantes de build ne sont pas cassées. Pour cela nous utilisons les essais de construction. ## Test De Compatibilité Du Protocole {#testing-for-protocol-compatibility} -Lorsque nous étendons le protocole réseau ClickHouse, nous testons manuellement que l'ancien clickhouse-client fonctionne avec le nouveau clickhouse-server et que le nouveau clickhouse-client fonctionne avec l'ancien clickhouse-server (simplement en exécutant des binaires à partir des paquets correspondants). +Lorsque nous étendons le protocole réseau ClickHouse, nous testons manuellement que l’ancien clickhouse-client fonctionne avec le nouveau clickhouse-server et que le nouveau clickhouse-client fonctionne avec l’ancien clickhouse-server (simplement en exécutant des binaires à partir des paquets correspondants). -## L'Aide Du Compilateur {#help-from-the-compiler} +## L’Aide Du Compilateur {#help-from-the-compiler} Code ClickHouse principal (qui est situé dans `dbms` annuaire) est construit avec `-Wall -Wextra -Werror` et avec quelques avertissements supplémentaires activés. Bien que ces options ne soient pas activées pour les bibliothèques tierces. Clang a des avertissements encore plus utiles - vous pouvez les chercher avec `-Weverything` et choisissez quelque chose à construire par défaut. -Pour les builds de production, gcc est utilisé (il génère toujours un code légèrement plus efficace que clang). Pour le développement, clang est généralement plus pratique à utiliser. Vous pouvez construire sur votre propre machine avec le mode débogage (pour économiser la batterie de votre ordinateur portable), mais veuillez noter que le compilateur est capable de générer plus d'Avertissements avec `-O3` grâce à une meilleure analyse du flux de contrôle et de l'inter-procédure. Lors de la construction avec clang, `libc++` est utilisé au lieu de `libstdc++` et lors de la construction avec le mode débogage, la version de débogage de `libc++` est utilisé qui permet d'attraper plus d'erreurs à l'exécution. +Pour les builds de production, gcc est utilisé (il génère toujours un code légèrement plus efficace que clang). Pour le développement, clang est généralement plus pratique à utiliser. Vous pouvez construire sur votre propre machine avec le mode débogage (pour économiser la batterie de votre ordinateur portable), mais veuillez noter que le compilateur est capable de générer plus d’Avertissements avec `-O3` grâce à une meilleure analyse du flux de contrôle et de l’inter-procédure. Lors de la construction avec clang, `libc++` est utilisé au lieu de `libstdc++` et lors de la construction avec le mode débogage, la version de débogage de `libc++` est utilisé qui permet d’attraper plus d’erreurs à l’exécution. ## Désinfectant {#sanitizers} -**Désinfectant d'adresse**. -Nous exécutons des tests fonctionnels et d'intégration sous ASan sur la base de per-commit. +**Désinfectant d’adresse**. +Nous exécutons des tests fonctionnels et d’intégration sous ASan sur la base de per-commit. **Valgrind (Memcheck)**. Nous effectuons des tests fonctionnels sous Valgrind pendant la nuit. Cela prend plusieurs heures. Actuellement il y a un faux positif connu dans `re2` bibliothèque, consultez [cet article](https://research.swtch.com/sparse). **Désinfectant de comportement indéfini.** -Nous exécutons des tests fonctionnels et d'intégration sous ASan sur la base de per-commit. +Nous exécutons des tests fonctionnels et d’intégration sous ASan sur la base de per-commit. **Désinfectant pour filetage**. -Nous exécutons des tests fonctionnels sous TSan sur la base de per-commit. Nous n'exécutons toujours pas de tests D'intégration sous TSan sur la base de la validation. +Nous exécutons des tests fonctionnels sous TSan sur la base de per-commit. Nous n’exécutons toujours pas de tests D’intégration sous TSan sur la base de la validation. **Mémoire de désinfectant**. -Actuellement, nous n'utilisons toujours pas MSan. +Actuellement, nous n’utilisons toujours pas MSan. **Débogueur allocateur.** Version de débogage de `jemalloc` est utilisé pour la construction de débogage. ## Fuzzing {#fuzzing} -Nous utilisons un simple test fuzz pour générer des requêtes SQL aléatoires et vérifier que le serveur ne meurt pas. Le test de Fuzz est effectué avec un désinfectant D'adresse. Vous pouvez le trouver dans `00746_sql_fuzzy.pl`. Ce test doit être exécuté en continu (pendant la nuit et plus longtemps). +Nous utilisons un simple test fuzz pour générer des requêtes SQL aléatoires et vérifier que le serveur ne meurt pas. Le test de Fuzz est effectué avec un désinfectant D’adresse. Vous pouvez le trouver dans `00746_sql_fuzzy.pl`. Ce test doit être exécuté en continu (pendant la nuit et plus longtemps). -En décembre 2018, nous n'utilisons toujours pas de tests fuzz isolés du code de la bibliothèque. +En décembre 2018, nous n’utilisons toujours pas de tests fuzz isolés du code de la bibliothèque. ## Audit De Sécurité {#security-audit} @@ -209,13 +209,13 @@ Les gens du Département Cloud de Yandex font un aperçu de base des capacités ## Analyseurs Statiques {#static-analyzers} -Nous courons `PVS-Studio` par commettre base. Nous avons évalué `clang-tidy`, `Coverity`, `cppcheck`, `PVS-Studio`, `tscancode`. Vous trouverez des instructions pour l'utilisation dans `tests/instructions/` répertoire. Aussi, vous pouvez lire [l'article en russe](https://habr.com/company/yandex/blog/342018/). +Nous courons `PVS-Studio` par commettre base. Nous avons évalué `clang-tidy`, `Coverity`, `cppcheck`, `PVS-Studio`, `tscancode`. Vous trouverez des instructions pour l’utilisation dans `tests/instructions/` répertoire. Aussi, vous pouvez lire [l’article en russe](https://habr.com/company/yandex/blog/342018/). -Si vous utilisez `CLion` en tant QU'IDE, vous pouvez tirer parti de certains `clang-tidy` contrôles de la boîte. +Si vous utilisez `CLion` en tant QU’IDE, vous pouvez tirer parti de certains `clang-tidy` contrôles de la boîte. ## Durcir {#hardening} -`FORTIFY_SOURCE` est utilisé par défaut. C'est presque inutile, mais cela a toujours du sens dans de rares cas et nous ne le désactivons pas. +`FORTIFY_SOURCE` est utilisé par défaut. C’est presque inutile, mais cela a toujours du sens dans de rares cas et nous ne le désactivons pas. ## Code De Style {#code-style} @@ -223,7 +223,7 @@ Les règles de style de Code sont décrites [ici](https://clickhouse.tech/docs/e Pour vérifier certaines violations de style courantes, vous pouvez utiliser `utils/check-style` script. -Pour forcer le style approprié de votre code, vous pouvez utiliser `clang-format`. Fichier `.clang-format` est situé à la racine des sources. Il correspond principalement à notre style de code réel. Mais il n'est pas recommandé d'appliquer `clang-format` pour les fichiers existants, car il rend le formatage pire. Vous pouvez utiliser `clang-format-diff` outil que vous pouvez trouver dans clang référentiel source. +Pour forcer le style approprié de votre code, vous pouvez utiliser `clang-format`. Fichier `.clang-format` est situé à la racine des sources. Il correspond principalement à notre style de code réel. Mais il n’est pas recommandé d’appliquer `clang-format` pour les fichiers existants, car il rend le formatage pire. Vous pouvez utiliser `clang-format-diff` outil que vous pouvez trouver dans clang référentiel source. Alternativement vous pouvez essayer `uncrustify` outil pour reformater votre code. La Configuration est en `uncrustify.cfg` dans la racine des sources. Il est moins testé que `clang-format`. @@ -231,7 +231,7 @@ Alternativement vous pouvez essayer `uncrustify` outil pour reformater votre cod ## Tests Metrica B2B {#metrica-b2b-tests} -Chaque version de ClickHouse est testée avec les moteurs Yandex Metrica et AppMetrica. Les versions de test et stables de ClickHouse sont déployées sur des machines virtuelles et exécutées avec une petite copie de metrica engine qui traite un échantillon fixe de données d'entrée. Ensuite, les résultats de deux instances de metrica engine sont comparés ensemble. +Chaque version de ClickHouse est testée avec les moteurs Yandex Metrica et AppMetrica. Les versions de test et stables de ClickHouse sont déployées sur des machines virtuelles et exécutées avec une petite copie de metrica engine qui traite un échantillon fixe de données d’entrée. Ensuite, les résultats de deux instances de metrica engine sont comparés ensemble. Ces tests sont automatisés par une équipe distincte. En raison du nombre élevé de pièces en mouvement, les tests échouent la plupart du temps complètement raisons, qui sont très difficiles à comprendre. Très probablement, ces tests ont une valeur négative pour nous. Néanmoins, ces tests se sont révélés utiles dans environ une ou deux fois sur des centaines. @@ -241,12 +241,12 @@ En juillet 2018, nous ne suivons pas la couverture des tests. ## Automatisation Des Tests {#test-automation} -Nous exécutons des tests avec Yandex CI interne et le système d'automatisation des tâches nommé “Sandbox”. +Nous exécutons des tests avec Yandex CI interne et le système d’automatisation des tâches nommé “Sandbox”. -Les travaux de construction et les tests sont exécutés dans Sandbox sur une base de validation. Les paquets résultants et les résultats des tests sont publiés dans GitHub et peuvent être téléchargés par des liens directs. Les artefacts sont stockés éternellement. Lorsque vous envoyez une demande de tirage sur GitHub, nous l'étiquetons comme “can be tested” et notre système CI construira des paquets ClickHouse (release, debug, avec un désinfectant d'adresse, etc.) pour vous. +Les travaux de construction et les tests sont exécutés dans Sandbox sur une base de validation. Les paquets résultants et les résultats des tests sont publiés dans GitHub et peuvent être téléchargés par des liens directs. Les artefacts sont stockés éternellement. Lorsque vous envoyez une demande de tirage sur GitHub, nous l’étiquetons comme “can be tested” et notre système CI construira des paquets ClickHouse (release, debug, avec un désinfectant d’adresse, etc.) pour vous. -Nous n'utilisons pas Travis CI en raison de la limite de temps et de puissance de calcul. -On n'utilise pas Jenkins. Il a été utilisé avant et maintenant nous sommes heureux de ne pas utiliser Jenkins. +Nous n’utilisons pas Travis CI en raison de la limite de temps et de puissance de calcul. +On n’utilise pas Jenkins. Il a été utilisé avant et maintenant nous sommes heureux de ne pas utiliser Jenkins. [Article Original](https://clickhouse.tech/docs/en/development/tests/) développement/tests/) diff --git a/docs/fr/engines/database-engines/index.md b/docs/fr/engines/database-engines/index.md new file mode 100644 index 00000000000..fe44cdaf558 --- /dev/null +++ b/docs/fr/engines/database-engines/index.md @@ -0,0 +1,21 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Database Engines +toc_priority: 27 +toc_title: Introduction +--- + +# Moteurs De Base De Données {#database-engines} + +Moteurs de base de données vous permettent de travailler avec des tables. + +Par défaut, ClickHouse utilise son moteur de base de données natif, qui fournit [moteurs de table](../../engines/table-engines/index.md) et un [Dialecte SQL](../../sql-reference/syntax.md). + +Vous pouvez également utiliser les moteurs de base de données suivants: + +- [MySQL](mysql.md) + +- [Paresseux](lazy.md) + +[Article Original](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/fr/engines/database-engines/lazy.md b/docs/fr/engines/database-engines/lazy.md new file mode 100644 index 00000000000..69cba3ebba3 --- /dev/null +++ b/docs/fr/engines/database-engines/lazy.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 31 +toc_title: Paresseux +--- + +# Paresseux {#lazy} + +Conserve les tables en RAM uniquement `expiration_time_in_seconds` secondes après le dernier accès. Peut être utilisé uniquement avec les tables \* Log. + +Il est optimisé pour stocker de nombreuses petites tables \*Log, pour lesquelles il y a un long intervalle de temps entre les accès. + +## La création d’une Base De données {#creating-a-database} + + CREATE DATABASE testlazy ENGINE = Lazy(expiration_time_in_seconds); + +[Article Original](https://clickhouse.tech/docs/en/database_engines/lazy/) diff --git a/docs/fr/engines/database-engines/mysql.md b/docs/fr/engines/database-engines/mysql.md new file mode 100644 index 00000000000..8b76c870cc7 --- /dev/null +++ b/docs/fr/engines/database-engines/mysql.md @@ -0,0 +1,135 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 30 +toc_title: MySQL +--- + +# Mysql {#mysql} + +Permet de se connecter à des bases de données sur un serveur MySQL distant et `INSERT` et `SELECT` requêtes pour échanger des données entre Clickhouse et MySQL. + +Le `MySQL` moteur de base de données traduire les requêtes sur le serveur MySQL afin que vous puissiez effectuer des opérations telles que `SHOW TABLES` ou `SHOW CREATE TABLE`. + +Vous ne pouvez pas effectuer les requêtes suivantes: + +- `RENAME` +- `CREATE TABLE` +- `ALTER` + +## La création d’une Base De données {#creating-a-database} + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] +ENGINE = MySQL('host:port', 'database', 'user', 'password') +``` + +**Les Paramètres Du Moteur** + +- `host:port` — MySQL server address. +- `database` — Remote database name. +- `user` — MySQL user. +- `password` — User password. + +## Types De Données Soutien {#data_types-support} + +| MySQL | ClickHouse | +|----------------------------------|--------------------------------------------------------------| +| UNSIGNED TINYINT | [UInt8](../../sql-reference/data-types/int-uint.md) | +| TINYINT | [Int8](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED SMALLINT | [UInt16](../../sql-reference/data-types/int-uint.md) | +| SMALLINT | [Int16](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql-reference/data-types/int-uint.md) | +| INT, MEDIUMINT | [Int32](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED BIGINT | [UInt64](../../sql-reference/data-types/int-uint.md) | +| BIGINT | [Int64](../../sql-reference/data-types/int-uint.md) | +| FLOAT | [Float32](../../sql-reference/data-types/float.md) | +| DOUBLE | [Float64](../../sql-reference/data-types/float.md) | +| DATE | [Date](../../sql-reference/data-types/date.md) | +| DATETIME, TIMESTAMP | [DateTime](../../sql-reference/data-types/datetime.md) | +| BINARY | [FixedString](../../sql-reference/data-types/fixedstring.md) | + +Tous les autres types de données MySQL sont convertis en [Chaîne](../../sql-reference/data-types/string.md). + +[Nullable](../../sql-reference/data-types/nullable.md) est pris en charge. + +## Exemples D’Utilisation {#examples-of-use} + +Table dans MySQL: + +``` text +mysql> USE test; +Database changed + +mysql> CREATE TABLE `mysql_table` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `float` FLOAT NOT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from mysql_table; ++------+-----+ +| int_id | value | ++------+-----+ +| 1 | 2 | ++------+-----+ +1 row in set (0,00 sec) +``` + +Base de données dans ClickHouse, échange de données avec le serveur MySQL: + +``` sql +CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') +``` + +``` sql +SHOW DATABASES +``` + +``` text +┌─name─────┐ +│ default │ +│ mysql_db │ +│ system │ +└──────────┘ +``` + +``` sql +SHOW TABLES FROM mysql_db +``` + +``` text +┌─name─────────┐ +│ mysql_table │ +└──────────────┘ +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +└────────┴───────┘ +``` + +``` sql +INSERT INTO mysql_db.mysql_table VALUES (3,4) +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +│ 3 │ 4 │ +└────────┴───────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/fr/engines/database_engines/index.md b/docs/fr/engines/database_engines/index.md deleted file mode 100644 index 5b019ef4e75..00000000000 --- a/docs/fr/engines/database_engines/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Database Engines -toc_priority: 27 -toc_title: Introduction ---- - -# Moteurs De Base De Données {#database-engines} - -Moteurs de base de données vous permettent de travailler avec des tables. - -Par défaut, ClickHouse utilise son moteur de base de données natif, qui fournit [moteurs de table](../../engines/table_engines/index.md) et un [Dialecte SQL](../../sql_reference/syntax.md). - -Vous pouvez également utiliser les moteurs de base de données suivants: - -- [MySQL](mysql.md) - -- [Paresseux](lazy.md) - -[Article Original](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/fr/engines/database_engines/lazy.md b/docs/fr/engines/database_engines/lazy.md deleted file mode 100644 index 77a2cb15dde..00000000000 --- a/docs/fr/engines/database_engines/lazy.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 31 -toc_title: Paresseux ---- - -# Paresseux {#lazy} - -Conserve les tables en RAM uniquement `expiration_time_in_seconds` secondes après le dernier accès. Peut être utilisé uniquement avec les tables \* Log. - -Il est optimisé pour stocker de nombreuses petites tables \*Log, pour lesquelles il y a un long intervalle de temps entre les accès. - -## La création d'une Base de données {#creating-a-database} - - CREATE DATABASE testlazy ENGINE = Lazy(expiration_time_in_seconds); - -[Article Original](https://clickhouse.tech/docs/en/database_engines/lazy/) diff --git a/docs/fr/engines/database_engines/mysql.md b/docs/fr/engines/database_engines/mysql.md deleted file mode 100644 index ebe50498967..00000000000 --- a/docs/fr/engines/database_engines/mysql.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 30 -toc_title: MySQL ---- - -# Mysql {#mysql} - -Permet de se connecter à des bases de données sur un serveur MySQL distant et `INSERT` et `SELECT` requêtes pour échanger des données entre Clickhouse et MySQL. - -Le `MySQL` moteur de base de données traduire les requêtes sur le serveur MySQL afin que vous puissiez effectuer des opérations telles que `SHOW TABLES` ou `SHOW CREATE TABLE`. - -Vous ne pouvez pas effectuer les requêtes suivantes: - -- `RENAME` -- `CREATE TABLE` -- `ALTER` - -## La création d'une Base de données {#creating-a-database} - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] -ENGINE = MySQL('host:port', 'database', 'user', 'password') -``` - -**Les Paramètres Du Moteur** - -- `host:port` — MySQL server address. -- `database` — Remote database name. -- `user` — MySQL user. -- `password` — User password. - -## Types De Données Soutien {#data_types-support} - -| MySQL | ClickHouse | -|----------------------------------|--------------------------------------------------------------| -| UNSIGNED TINYINT | [UInt8](../../sql_reference/data_types/int_uint.md) | -| TINYINT | [Int8](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED SMALLINT | [UInt16](../../sql_reference/data_types/int_uint.md) | -| SMALLINT | [Int16](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql_reference/data_types/int_uint.md) | -| INT, MEDIUMINT | [Int32](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED BIGINT | [UInt64](../../sql_reference/data_types/int_uint.md) | -| BIGINT | [Int64](../../sql_reference/data_types/int_uint.md) | -| FLOAT | [Float32](../../sql_reference/data_types/float.md) | -| DOUBLE | [Float64](../../sql_reference/data_types/float.md) | -| DATE | [Date](../../sql_reference/data_types/date.md) | -| DATETIME, TIMESTAMP | [DateTime](../../sql_reference/data_types/datetime.md) | -| BINARY | [FixedString](../../sql_reference/data_types/fixedstring.md) | - -Tous les autres types de données MySQL sont convertis en [Chaîne](../../sql_reference/data_types/string.md). - -[Nullable](../../sql_reference/data_types/nullable.md) est pris en charge. - -## Exemples D'Utilisation {#examples-of-use} - -Table dans MySQL: - -``` text -mysql> USE test; -Database changed - -mysql> CREATE TABLE `mysql_table` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `float` FLOAT NOT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from mysql_table; -+------+-----+ -| int_id | value | -+------+-----+ -| 1 | 2 | -+------+-----+ -1 row in set (0,00 sec) -``` - -Base de données dans ClickHouse, échange de données avec le serveur MySQL: - -``` sql -CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') -``` - -``` sql -SHOW DATABASES -``` - -``` text -┌─name─────┐ -│ default │ -│ mysql_db │ -│ system │ -└──────────┘ -``` - -``` sql -SHOW TABLES FROM mysql_db -``` - -``` text -┌─name─────────┐ -│ mysql_table │ -└──────────────┘ -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -└────────┴───────┘ -``` - -``` sql -INSERT INTO mysql_db.mysql_table VALUES (3,4) -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -│ 3 │ 4 │ -└────────┴───────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/fr/engines/table-engines/index.md b/docs/fr/engines/table-engines/index.md new file mode 100644 index 00000000000..0eb7f715e40 --- /dev/null +++ b/docs/fr/engines/table-engines/index.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Table Engines +toc_priority: 26 +toc_title: Introduction +--- + +# Moteurs De Table {#table_engines} + +Le moteur de table (type de table) détermine: + +- Comment et où les données sont stockées, où les écrire et où les lire. +- Quelles requêtes sont prises en charge et comment. +- Accès simultané aux données. +- Utilisation des index, si elle est présente. +- Indique si l’exécution d’une requête multithread est possible. +- Paramètres de réplication des données. + +## Familles De Moteurs {#engine-families} + +### Mergetree {#mergetree} + +Les moteurs de table les plus universels et fonctionnels pour les tâches à forte charge. La propriété partagée par ces moteurs est l’insertion rapide des données avec traitement ultérieur des données d’arrière-plan. `MergeTree` les moteurs de la famille prennent en charge la réplication des données (avec [Répliqué\*](mergetree-family/replication.md) versions de moteurs), le partitionnement, et d’autres fonctionnalités non prises en charge dans d’autres moteurs. + +Moteurs dans la famille: + +- [MergeTree](mergetree-family/mergetree.md) +- [ReplacingMergeTree](mergetree-family/replacingmergetree.md) +- [SummingMergeTree](mergetree-family/summingmergetree.md) +- [AggregatingMergeTree](mergetree-family/aggregatingmergetree.md) +- [CollapsingMergeTree](mergetree-family/collapsingmergetree.md) +- [VersionedCollapsingMergeTree](mergetree-family/versionedcollapsingmergetree.md) +- [GraphiteMergeTree](mergetree-family/graphitemergetree.md) + +### Journal {#log} + +Léger [moteur](log-family/index.md) avec une fonctionnalité minimale. Ils sont les plus efficaces lorsque vous devez écrire rapidement de nombreuses petites tables (jusqu’à environ 1 million de lignes) et les lire plus tard dans leur ensemble. + +Moteurs dans la famille: + +- [TinyLog](log-family/tinylog.md) +- [StripeLog](log-family/stripelog.md) +- [Journal](log-family/log.md) + +### Moteurs D’Intégration {#integration-engines} + +Moteurs de communication avec d’autres systèmes de stockage et de traitement de données. + +Moteurs dans la famille: + +- [Kafka](integrations/kafka.md) +- [MySQL](integrations/mysql.md) +- [ODBC](integrations/odbc.md) +- [JDBC](integrations/jdbc.md) +- [HDFS](integrations/hdfs.md) + +### Moteurs Spéciaux {#special-engines} + +Moteurs dans la famille: + +- [Distribué](special/distributed.md) +- [MaterializedView](special/materializedview.md) +- [Dictionnaire](special/dictionary.md) +- [Fusionner](special/merge.md) +- [Fichier](special/file.md) +- [NULL](special/null.md) +- [Définir](special/set.md) +- [Rejoindre](special/join.md) +- [URL](special/url.md) +- [Vue](special/view.md) +- [Mémoire](special/memory.md) +- [Tampon](special/buffer.md) + +## Les Colonnes Virtuelles {#table_engines-virtual-columns} + +Colonne virtuelle est un attribut de moteur de table intégrale qui est défini dans le code source du moteur. + +Vous ne devez pas spécifier de colonnes virtuelles dans `CREATE TABLE` requête et vous ne pouvez pas les voir dans `SHOW CREATE TABLE` et `DESCRIBE TABLE` les résultats de la requête. Les colonnes virtuelles sont également en lecture seule, vous ne pouvez donc pas insérer de données dans des colonnes virtuelles. + +Pour sélectionner des données dans une colonne virtuelle, vous devez spécifier son nom `SELECT` requête. `SELECT *` ne renvoie pas de valeurs à partir de colonnes virtuelles. + +Si vous créez une table avec une colonne portant le même nom que l’une des colonnes virtuelles de la table, la colonne virtuelle devient inaccessible. Nous ne recommandons pas de faire cela. Pour éviter les conflits, les noms de colonnes virtuelles sont généralement précédés d’un trait de soulignement. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/fr/engines/table-engines/integrations/hdfs.md b/docs/fr/engines/table-engines/integrations/hdfs.md new file mode 100644 index 00000000000..8177c16fc2c --- /dev/null +++ b/docs/fr/engines/table-engines/integrations/hdfs.md @@ -0,0 +1,123 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 36 +toc_title: HDFS +--- + +# HDFS {#table_engines-hdfs} + +Ce moteur fournit l’intégration avec [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) l’écosystème en permettant de gérer les données sur [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)via ClickHouse. Ce moteur est similaire +à l’ [Fichier](../special/file.md) et [URL](../special/url.md) moteurs, mais fournit des fonctionnalités spécifiques Hadoop. + +## Utilisation {#usage} + +``` sql +ENGINE = HDFS(URI, format) +``` + +Le `URI` paramètre est L’URI du fichier entier dans HDFS. +Le `format` paramètre spécifie l’un des formats de fichier disponibles. Effectuer +`SELECT` requêtes, le format doit être pris en charge pour l’entrée, et à effectuer +`INSERT` queries – for output. The available formats are listed in the +[Format](../../../interfaces/formats.md#formats) section. +Le chemin le cadre de `URI` peut contenir des globules. Dans ce cas, le tableau serait en lecture seule. + +**Exemple:** + +**1.** Configurer le `hdfs_engine_table` table: + +``` sql +CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') +``` + +**2.** Remplir le fichier: + +``` sql +INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) +``` + +**3.** Interroger les données: + +``` sql +SELECT * FROM hdfs_engine_table LIMIT 2 +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Détails De Mise En Œuvre {#implementation-details} + +- Les lectures et les écritures peuvent être parallèles +- Pas pris en charge: + - `ALTER` et `SELECT...SAMPLE` opérations. + - Index. + - Réplication. + +**Globs dans le chemin** + +Plusieurs composants de chemin peuvent avoir des globs. Pour être traité, le fichier devrait exister et correspondre au modèle de chemin entier. Liste des fichiers détermine pendant `SELECT` (pas à l’ `CREATE` moment). + +- `*` — Substitutes any number of any characters except `/` y compris la chaîne vide. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +Les Constructions avec `{}` sont similaires à l’ [distant](../../../sql-reference/table-functions/remote.md) table de fonction. + +**Exemple** + +1. Supposons que nous ayons plusieurs fichiers au format TSV avec les URI suivants sur HDFS: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. Il y a plusieurs façons de faire une table composée des six fichiers: + + + +``` sql +CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') +``` + +Une autre façon: + +``` sql +CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') +``` + +Table se compose de tous les fichiers dans les deux répertoires (tous les fichiers doivent satisfaire le format et le schéma décrits dans la requête): + +``` sql +CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') +``` + +!!! warning "Avertissement" + Si la liste des fichiers contient des plages de nombres avec des zéros en tête, utilisez la construction avec des accolades pour chaque chiffre séparément ou utilisez `?`. + +**Exemple** + +Créer une table avec des fichiers nommés `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') +``` + +## Les Colonnes Virtuelles {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Voir Aussi** + +- [Les colonnes virtuelles](../index.md#table_engines-virtual_columns) + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/fr/engines/table_engines/integrations/index.md b/docs/fr/engines/table-engines/integrations/index.md similarity index 100% rename from docs/fr/engines/table_engines/integrations/index.md rename to docs/fr/engines/table-engines/integrations/index.md diff --git a/docs/fr/engines/table-engines/integrations/jdbc.md b/docs/fr/engines/table-engines/integrations/jdbc.md new file mode 100644 index 00000000000..728dd873a27 --- /dev/null +++ b/docs/fr/engines/table-engines/integrations/jdbc.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 34 +toc_title: JDBC +--- + +# JDBC {#table-engine-jdbc} + +Permet à ClickHouse de se connecter à des bases de données externes via [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). + +Pour implémenter la connexion JDBC, ClickHouse utilise le programme séparé [clickhouse-JDBC-pont](https://github.com/alex-krash/clickhouse-jdbc-bridge) cela devrait fonctionner comme un démon. + +Ce moteur prend en charge le [Nullable](../../../sql-reference/data-types/nullable.md) type de données. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name +( + columns list... +) +ENGINE = JDBC(dbms_uri, external_database, external_table) +``` + +**Les Paramètres Du Moteur** + +- `dbms_uri` — URI of an external DBMS. + + Format: `jdbc:://:/?user=&password=`. + Exemple pour MySQL: `jdbc:mysql://localhost:3306/?user=root&password=root`. + +- `external_database` — Database in an external DBMS. + +- `external_table` — Name of the table in `external_database`. + +## Exemple D’Utilisation {#usage-example} + +Création d’une table dans le serveur MySQL en se connectant directement avec son client console: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Création d’une table dans le serveur ClickHouse et sélection des données: + +``` sql +CREATE TABLE jdbc_table +( + `int_id` Int32, + `int_nullable` Nullable(Int32), + `float` Float32, + `float_nullable` Nullable(Float32) +) +ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') +``` + +``` sql +SELECT * +FROM jdbc_table +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Voir Aussi {#see-also} + +- [Fonction de table JDBC](../../../sql-reference/table-functions/jdbc.md). + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/fr/engines/table-engines/integrations/kafka.md b/docs/fr/engines/table-engines/integrations/kafka.md new file mode 100644 index 00000000000..ff91cf140e5 --- /dev/null +++ b/docs/fr/engines/table-engines/integrations/kafka.md @@ -0,0 +1,176 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 32 +toc_title: Kafka +--- + +# Kafka {#kafka} + +Ce moteur fonctionne avec [Apache Kafka](http://kafka.apache.org/). + +Kafka vous permet de: + +- Publier ou s’abonner aux flux de données. +- Organiser le stockage tolérant aux pannes. +- Traiter les flux à mesure qu’ils deviennent disponibles. + +## Création d’une Table {#table_engine-kafka-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = Kafka() +SETTINGS + kafka_broker_list = 'host:port', + kafka_topic_list = 'topic1,topic2,...', + kafka_group_name = 'group_name', + kafka_format = 'data_format'[,] + [kafka_row_delimiter = 'delimiter_symbol',] + [kafka_schema = '',] + [kafka_num_consumers = N,] + [kafka_skip_broken_messages = N] +``` + +Les paramètres requis: + +- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). +- `kafka_topic_list` – A list of Kafka topics. +- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don’t want messages to be duplicated in the cluster, use the same group name everywhere. +- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` la fonction, tels que `JSONEachRow`. Pour plus d’informations, voir le [Format](../../../interfaces/formats.md) section. + +Paramètres facultatifs: + +- `kafka_row_delimiter` – Delimiter character, which ends the message. +- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap’n Proto](https://capnproto.org/) nécessite le chemin d’accès du fichier de schéma et le nom de la racine `schema.capnp:Message` objet. +- `kafka_num_consumers` – The number of consumers per table. Default: `1`. Spécifiez plus de consommateurs si le débit d’un consommateur est insuffisant. Le nombre total de consommateurs ne doit pas dépasser le nombre de partitions dans la rubrique, car un seul consommateur peut être affecté par partition. +- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. Si `kafka_skip_broken_messages = N` puis le moteur saute *N* Messages Kafka qui ne peuvent pas être analysés (un message est égal à une ligne de données). + +Exemple: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + SELECT * FROM queue LIMIT 5; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', + kafka_topic_list = 'topic', + kafka_group_name = 'group1', + kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') + SETTINGS kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; +``` + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets. Si possible, optez anciens projets à la méthode décrite ci-dessus. + +``` sql +Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format + [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) +``` + +
+ +## Description {#description} + +Les messages livrés sont suivis automatiquement, de sorte que chaque message d’un groupe n’est compté qu’une seule fois. Si vous souhaitez obtenir les données deux fois, créez une copie de la table avec un autre nom de groupe. + +Les groupes sont flexibles et synchronisés sur le cluster. Par exemple, si vous avez 10 thèmes et 5 copies d’une table dans un cluster, chaque copie obtient 2 sujets. Si le nombre de copies change, les rubriques sont redistribuées automatiquement entre les copies. En savoir plus à ce sujet à http://kafka.apache.org/intro. + +`SELECT` n’est pas particulièrement utile pour la lecture de messages (sauf pour le débogage), car chaque message ne peut être lu qu’une seule fois. Il est plus pratique de créer des threads en temps réel à l’aide de vues matérialisées. Pour ce faire: + +1. Utilisez le moteur pour créer un consommateur Kafka et considérez-le comme un flux de données. +2. Créez une table avec la structure souhaitée. +3. Créer une vue matérialisée qui convertit les données du moteur et le met dans une table créée précédemment. + +Lorsque l’ `MATERIALIZED VIEW` rejoint le moteur, il commence à collecter des données en arrière-plan. Cela vous permet de recevoir continuellement des messages de Kafka et de les convertir au format requis en utilisant `SELECT`. +Une table kafka peut avoir autant de vues matérialisées que vous le souhaitez, elles ne lisent pas directement les données de la table kafka, mais reçoivent de nouveaux enregistrements( en blocs), de cette façon vous pouvez écrire sur plusieurs tables avec différents niveaux de détail (avec regroupement - agrégation et sans). + +Exemple: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + CREATE TABLE daily ( + day Date, + level String, + total UInt64 + ) ENGINE = SummingMergeTree(day, (day, level), 8192); + + CREATE MATERIALIZED VIEW consumer TO daily + AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total + FROM queue GROUP BY day, level; + + SELECT level, sum(total) FROM daily GROUP BY level; +``` + +Pour améliorer les performances, les messages reçus sont regroupées en blocs de la taille de [max\_insert\_block\_size](../../../operations/server-configuration-parameters/settings.md#settings-max_insert_block_size). Si le bloc n’a pas été formé à l’intérieur [stream\_flush\_interval\_ms](../../../operations/server-configuration-parameters/settings.md) millisecondes, les données seront vidées dans le tableau, indépendamment de l’intégralité du bloc. + +Pour arrêter de recevoir des données de rubrique ou pour modifier la logique de conversion, détachez la vue matérialisée: + +``` sql + DETACH TABLE consumer; + ATTACH TABLE consumer; +``` + +Si vous souhaitez modifier la table cible en utilisant `ALTER`, nous vous recommandons de désactiver la vue matériel pour éviter les divergences entre la table cible et les données de la vue. + +## Configuration {#configuration} + +Similaire à GraphiteMergeTree, le moteur Kafka prend en charge la configuration étendue à l’aide du fichier de configuration ClickHouse. Il y a deux clés de configuration que vous pouvez utiliser: global (`kafka`) et des rubriques (`kafka_*`). La configuration globale est appliquée en premier, puis la configuration au niveau de la rubrique est appliquée (si elle existe). + +``` xml + + + cgrp + smallest + + + + + 250 + 100000 + +``` + +Pour obtenir une liste des options de configuration possibles, consultez [librdkafka référence de configuration](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Utilisez le trait de soulignement (`_`) au lieu d’un point dans la configuration ClickHouse. Exemple, `check.crcs=true` sera `true`. + +## Les Colonnes Virtuelles {#virtual-columns} + +- `_topic` — Kafka topic. +- `_key` — Key of the message. +- `_offset` — Offset of the message. +- `_timestamp` — Timestamp of the message. +- `_partition` — Partition of Kafka topic. + +**Voir Aussi** + +- [Les colonnes virtuelles](../index.md#table_engines-virtual_columns) + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/fr/engines/table-engines/integrations/mysql.md b/docs/fr/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..d44ac762d0b --- /dev/null +++ b/docs/fr/engines/table-engines/integrations/mysql.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 33 +toc_title: MySQL +--- + +# Mysql {#mysql} + +Le moteur MySQL vous permet d’effectuer `SELECT` requêtes sur les données stockées sur un serveur MySQL distant. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... +) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +Voir une description détaillée de la [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) requête. + +La structure de la table peut différer de la structure de la table MySQL d’origine: + +- Les noms de colonnes doivent être les mêmes que dans la table MySQL d’origine, mais vous pouvez utiliser seulement certaines de ces colonnes et dans n’importe quel ordre. +- Les types de colonnes peuvent différer de ceux de la table MySQL d’origine. ClickHouse essaie de [jeter](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) valeurs des types de données ClickHouse. + +**Les Paramètres Du Moteur** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` les requêtes de `REPLACE INTO`. Si `replace_query=1` la requête est substitué. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expression qui est ajoutée à la `INSERT` requête. + + Exemple: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, où `on_duplicate_clause` être `UPDATE c2 = c2 + 1`. Voir la [Documentation de MySQL](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) pour trouver lequel `on_duplicate_clause` vous pouvez utiliser avec le `ON DUPLICATE KEY` clause. + + Spécifier `on_duplicate_clause` vous avez besoin de passer `0` à l’ `replace_query` paramètre. Si vous passez simultanément `replace_query = 1` et `on_duplicate_clause`, Clickhouse génère une exception. + +Simple `WHERE` des clauses telles que `=, !=, >, >=, <, <=` sont exécutés sur le serveur MySQL. + +Le reste des conditions et le `LIMIT` les contraintes d’échantillonnage sont exécutées dans ClickHouse uniquement après la fin de la requête à MySQL. + +## Exemple D’Utilisation {#usage-example} + +Table dans MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Table dans ClickHouse, récupération des données de la table MySQL créée ci-dessus: + +``` sql +CREATE TABLE mysql_table +( + `float_nullable` Nullable(Float32), + `int_id` Int32 +) +ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` sql +SELECT * FROM mysql_table +``` + +``` text +┌─float_nullable─┬─int_id─┐ +│ ᴺᵁᴸᴸ │ 1 │ +└────────────────┴────────┘ +``` + +## Voir Aussi {#see-also} + +- [Le ‘mysql’ fonction de table](../../../sql-reference/table-functions/mysql.md) +- [Utilisation de MySQL comme source de dictionnaire externe](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/fr/engines/table-engines/integrations/odbc.md b/docs/fr/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..8f24024602e --- /dev/null +++ b/docs/fr/engines/table-engines/integrations/odbc.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 35 +toc_title: ODBC +--- + +# ODBC {#table-engine-odbc} + +Permet à ClickHouse de se connecter à des bases de données externes via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +Pour implémenter en toute sécurité les connexions ODBC, ClickHouse utilise un programme distinct `clickhouse-odbc-bridge`. Si le pilote ODBC est chargé directement depuis `clickhouse-server`, les problèmes de pilote peuvent planter le serveur ClickHouse. Clickhouse démarre automatiquement `clickhouse-odbc-bridge` lorsque cela est nécessaire. Le programme ODBC bridge est installé à partir du même package que `clickhouse-server`. + +Ce moteur prend en charge le [Nullable](../../../sql-reference/data-types/nullable.md) type de données. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +Voir une description détaillée de la [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) requête. + +La structure de la table peut différer de la structure de la table source: + +- Les noms de colonnes doivent être les mêmes que dans la table source, mais vous pouvez utiliser quelques-unes de ces colonnes et dans n’importe quel ordre. +- Les types de colonnes peuvent différer de ceux de la table source. ClickHouse essaie de [jeter](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) valeurs des types de données ClickHouse. + +**Les Paramètres Du Moteur** + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` fichier. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +## Exemple D’Utilisation {#usage-example} + +**Récupération des données de L’installation MySQL locale via ODBC** + +Cet exemple est vérifié pour Ubuntu Linux 18.04 et MySQL server 5.7. + +Assurez-vous que unixODBC et MySQL Connector sont installés. + +Par défaut (si installé à partir de paquets), ClickHouse démarre en tant qu’utilisateur `clickhouse`. Ainsi, vous devez créer et configurer cet utilisateur dans le serveur MySQL. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +Puis configurez la connexion dans `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Vous pouvez vérifier la connexion en utilisant le `isql` utilitaire de l’installation unixODBC. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +Table dans MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Table dans ClickHouse, récupération des données de la table MySQL: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## Voir Aussi {#see-also} + +- [Dictionnaires externes ODBC](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [Fonction de table ODBC](../../../sql-reference/table-functions/odbc.md) + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/fr/engines/table_engines/log_family/index.md b/docs/fr/engines/table-engines/log-family/index.md similarity index 100% rename from docs/fr/engines/table_engines/log_family/index.md rename to docs/fr/engines/table-engines/log-family/index.md diff --git a/docs/fr/engines/table-engines/log-family/log-family.md b/docs/fr/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..b13155e2e8f --- /dev/null +++ b/docs/fr/engines/table-engines/log-family/log-family.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 31 +toc_title: Introduction +--- + +# Famille De Moteurs En Rondins {#log-engine-family} + +Ces moteurs ont été développés pour les scénarios où vous devez écrire rapidement de nombreuses petites tables (jusqu’à environ 1 million de lignes) et les lire plus tard dans leur ensemble. + +Les moteurs de la famille: + +- [StripeLog](stripelog.md) +- [Journal](log.md) +- [TinyLog](tinylog.md) + +## Propriétés Communes {#common-properties} + +Moteur: + +- Stocker des données sur un disque. + +- Ajouter des données à la fin du fichier lors de l’écriture. + +- Bloque simultanées dans l’accès aux données. + + Lors `INSERT` requêtes, la table est verrouillée, et d’autres requêtes pour la lecture et l’écriture de données attendent que la table se déverrouille. S’il n’y a pas de requêtes d’écriture de données, un certain nombre de requêtes de lecture de données peuvent être effectuées simultanément. + +- Ne prennent pas en charge [mutation](../../../sql-reference/statements/alter.md#alter-mutations) opérations. + +- Ne prennent pas en charge les index. + + Cela signifie que `SELECT` les requêtes pour les plages de données ne sont pas efficaces. + +- N’écrivez pas de données de manière atomique. + + Vous pouvez obtenir une table avec des données corrompues si quelque chose interrompt l’opération d’écriture, par exemple, un arrêt anormal du serveur. + +## Différence {#differences} + +Le `TinyLog` le moteur est le plus simple de la famille et offre la fonctionnalité la plus pauvre et la plus faible efficacité. Le `TinyLog` le moteur ne prend pas en charge la lecture de données parallèles par plusieurs threads. Il lit les données plus lentement que les autres moteurs de la famille qui prennent en charge la lecture parallèle et utilise presque autant de descripteurs que `Log` moteur, car il stocke chaque colonne dans un fichier séparé. Utilisez-le dans des scénarios simples à faible charge. + +Le `Log` et `StripeLog` les moteurs prennent en charge la lecture de données parallèle. Lors de la lecture de données, ClickHouse utilise plusieurs threads. Chaque thread traite un bloc de données séparé. Le `Log` le moteur utilise un fichier distinct pour chaque colonne de la table. `StripeLog` stocke toutes les données dans un seul fichier. En conséquence, la `StripeLog` moteur utilise moins de descripteurs dans le système d’exploitation, mais le `Log` moteur fournit une plus grande efficacité lors de la lecture des données. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/fr/engines/table-engines/log-family/log.md b/docs/fr/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..8389412dbec --- /dev/null +++ b/docs/fr/engines/table-engines/log-family/log.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 33 +toc_title: Journal +--- + +# Journal {#log} + +Moteur appartient à la famille de journal des moteurs. Voir les propriétés communes des moteurs de journal et leurs différences dans le [Famille De Moteurs En Rondins](log-family.md) article. + +Journal diffère de [TinyLog](tinylog.md) dans un petit fichier de “marks” réside avec les fichiers de colonne. Ces marques sont écrites sur chaque bloc de données et contiennent des décalages qui indiquent où commencer à lire le fichier afin d’ignorer le nombre de lignes spécifié. Cela permet de lire les données de table dans plusieurs threads. +Pour l’accès aux données simultanées, les opérations de lecture peuvent être effectuées simultanément, tandis que les opérations d’écriture bloc lit et l’autre. +Le moteur de journal ne prend pas en charge les index. De même, si l’écriture dans une table a échoué, la table est cassée et la lecture de celle-ci renvoie une erreur. Le moteur de journal est approprié pour les données temporaires, les tables en écriture unique, et à des fins de test ou de démonstration. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/fr/engines/table-engines/log-family/stripelog.md b/docs/fr/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..53d790abaf4 --- /dev/null +++ b/docs/fr/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,95 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 32 +toc_title: StripeLog +--- + +# Stripelog {#stripelog} + +Ce moteur appartient à la famille des moteurs en rondins. Voir les propriétés communes des moteurs de journal et leurs différences dans le [Famille De Moteurs En Rondins](log-family.md) article. + +Utilisez ce moteur dans des scénarios lorsque vous devez écrire de nombreuses tables avec une petite quantité de données (moins de 1 million de lignes). + +## Création d’une Table {#table_engines-stripelog-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = StripeLog +``` + +Voir la description détaillée de la [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) requête. + +## L’écriture Des Données {#table_engines-stripelog-writing-the-data} + +Le `StripeLog` moteur stocke toutes les colonnes dans un fichier. Pour chaque `INSERT` requête, ClickHouse ajoute le bloc de données à la fin d’un fichier de table, en écrivant des colonnes une par une. + +Pour chaque table ClickHouse écrit les fichiers: + +- `data.bin` — Data file. +- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. + +Le `StripeLog` moteur ne prend pas en charge la `ALTER UPDATE` et `ALTER DELETE` opérations. + +## La Lecture Des Données {#table_engines-stripelog-reading-the-data} + +Le fichier avec des marques permet à ClickHouse de paralléliser la lecture des données. Cela signifie qu’une `SELECT` la requête renvoie des lignes dans un ordre imprévisible. L’utilisation de la `ORDER BY` clause pour trier les lignes. + +## Exemple D’Utilisation {#table_engines-stripelog-example-of-use} + +Création d’une table: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +Insertion de données: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +Nous avons utilisé deux `INSERT` requêtes pour créer deux blocs de données `data.bin` fichier. + +ClickHouse utilise plusieurs threads lors de la sélection des données. Chaque thread lit un bloc de données séparé et renvoie les lignes résultantes indépendamment à la fin. En conséquence, l’ordre des blocs de lignes dans le résultat ne correspond pas à l’ordre des mêmes blocs dans l’entrée, dans la plupart des cas. Exemple: + +``` sql +SELECT * FROM stripe_log_table +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +┌───────────timestamp─┬─message_type─┬─message───────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +└─────────────────────┴──────────────┴───────────────────────────┘ +``` + +Trier les résultats (ordre croissant par défaut): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/fr/engines/table-engines/log-family/tinylog.md b/docs/fr/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..3cb2388ec23 --- /dev/null +++ b/docs/fr/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 34 +toc_title: TinyLog +--- + +# TinyLog {#tinylog} + +Le moteur appartient à la famille de moteurs en rondins. Voir [Famille De Moteurs En Rondins](log-family.md) pour les propriétés communes des moteurs en rondins et leurs différences. + +Ce moteur de table est généralement utilisé avec la méthode write-once: écrivez des données une fois, puis lisez-les autant de fois que nécessaire. Par exemple, vous pouvez utiliser `TinyLog`- tapez des tables pour les données intermédiaires qui sont traitées en petits lots. Notez que le stockage des données dans un grand nombre de petites tables est inefficace. + +Les requêtes sont exécutées dans un flux unique. En d’autres termes, ce moteur est destiné à des tables relativement petites (jusqu’à environ 1 000 000 de lignes). Il est logique d’utiliser ce moteur de table si vous avez beaucoup de petites tables, car il est plus simple que le [Journal](log.md) moteur (moins de fichiers doivent être ouverts). + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/fr/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/fr/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..9f473daa26c --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,102 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 35 +toc_title: AggregatingMergeTree +--- + +# Aggregatingmergetree {#aggregatingmergetree} + +Le moteur hérite de [MergeTree](mergetree.md#table_engines-mergetree), modifier la logique pour les parties de données Fusion. ClickHouse remplace toutes les lignes avec la même clé primaire (ou, plus précisément, avec la même [clé de tri](mergetree.md)) avec une seule ligne (dans un rayon d’une partie des données) qui stocke une combinaison d’états de fonctions d’agrégation. + +Vous pouvez utiliser `AggregatingMergeTree` tables pour l’agrégation incrémentielle des données, y compris pour les vues matérialisées agrégées. + +Le moteur traite toutes les colonnes avec [AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md) type. + +Il est approprié d’utiliser `AggregatingMergeTree` si elle réduit le nombre de lignes par commande. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[TTL expr] +[SETTINGS name=value, ...] +``` + +Pour une description des paramètres de requête, voir [demande de description](../../../sql-reference/statements/create.md). + +**Les clauses de requête** + +Lors de la création d’un `AggregatingMergeTree` la table de la même [clause](mergetree.md) sont nécessaires, comme lors de la création d’un `MergeTree` table. + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +Tous les paramètres ont la même signification que dans `MergeTree`. +
+ +## Sélectionner Et insérer {#select-and-insert} + +Pour insérer des données, utilisez [INSERT SELECT](../../../sql-reference/statements/insert-into.md) requête avec l’ensemble-l’État des fonctions. +Lors de la sélection des données `AggregatingMergeTree` table, utilisez `GROUP BY` et les mêmes fonctions d’agrégat que lors de l’insertion de données, mais en utilisant `-Merge` suffixe. + +Dans les résultats de `SELECT` requête, les valeurs de `AggregateFunction` type ont une représentation binaire spécifique à l’implémentation pour tous les formats de sortie ClickHouse. Si les données de vidage dans, par exemple, `TabSeparated` format avec `SELECT` requête alors ce vidage peut être chargé en utilisant `INSERT` requête. + +## Exemple D’une Vue matérialisée agrégée {#example-of-an-aggregated-materialized-view} + +`AggregatingMergeTree` vue matérialisée qui regarde le `test.visits` table: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +Insertion de données dans la `test.visits` table. + +``` sql +INSERT INTO test.visits ... +``` + +Les données sont insérées dans la table et la vue `test.basic` que va effectuer l’agrégation. + +Pour obtenir les données agrégées, nous devons exécuter une requête telle que `SELECT ... GROUP BY ...` à partir de la vue `test.basic`: + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/fr/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/fr/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..9f3fb2fe5a3 --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 36 +toc_title: CollapsingMergeTree +--- + +# Collapsingmergetree {#table_engine-collapsingmergetree} + +Le moteur hérite de [MergeTree](mergetree.md) et ajoute la logique de l’effondrement des lignes de données de pièces algorithme de fusion. + +`CollapsingMergeTree` supprime de manière asynchrone (réduit) les paires de lignes si tous les champs d’une clé de tri (`ORDER BY`) sont équivalents à l’exception du champ particulier `Sign` ce qui peut avoir `1` et `-1` valeur. Les lignes sans paire sont conservées. Pour plus de détails, voir le [Effondrer](#table_engine-collapsingmergetree-collapsing) la section du document. + +Le moteur peut réduire considérablement le volume de stockage et augmenter l’efficacité de `SELECT` requête en conséquence. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Pour une description des paramètres de requête, voir [description de la requête](../../../sql-reference/statements/create.md). + +**Paramètres CollapsingMergeTree** + +- `sign` — Name of the column with the type of row: `1` est un “state” rangée, `-1` est un “cancel” rangée. + + Column data type — `Int8`. + +**Les clauses de requête** + +Lors de la création d’un `CollapsingMergeTree` de table, de la même [les clauses de requête](mergetree.md#table_engine-mergetree-creating-a-table) sont nécessaires, comme lors de la création d’un `MergeTree` table. + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +Tous les paramètres excepté `sign` ont la même signification que dans `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` — “state” rangée, `-1` — “cancel” rangée. + + Column Data Type — `Int8`. + +
+ +## Effondrer {#table_engine-collapsingmergetree-collapsing} + +### Données {#data} + +Considérez la situation où vous devez enregistrer des données en constante évolution pour un objet. Il semble logique d’avoir une ligne pour un objet et de la mettre à jour à tout changement, mais l’opération de mise à jour est coûteuse et lente pour le SGBD car elle nécessite une réécriture des données dans le stockage. Si vous avez besoin d’écrire des données rapidement, la mise à jour n’est pas acceptable, mais vous pouvez écrire les modifications d’un objet de manière séquentielle comme suit. + +Utilisez la colonne particulière `Sign`. Si `Sign = 1` cela signifie que la ligne est un état d’un objet, appelons-la “state” rangée. Si `Sign = -1` il signifie l’annulation de l’état d’un objet avec les mêmes attributs, nous allons l’appeler “cancel” rangée. + +Par exemple, nous voulons calculer combien de pages les utilisateurs ont vérifié sur un site et combien de temps ils étaient là. À un certain moment nous écrire la ligne suivante avec l’état de l’activité de l’utilisateur: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +À un moment donné, nous enregistrons le changement d’activité de l’utilisateur et l’écrivons avec les deux lignes suivantes. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +La première ligne annule le précédent état de l’objet (utilisateur). Il doit copier les champs de clé de tri de l’état annulé sauf `Sign`. + +La deuxième ligne contient l’état actuel. + +Comme nous avons besoin seulement le dernier état de l’activité de l’utilisateur, les lignes + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +peut être supprimé en réduisant l’état invalide (ancien) d’un objet. `CollapsingMergeTree` fait cela lors de la fusion des parties de données. + +Pourquoi nous avons besoin de 2 lignes pour chaque changement lu dans le [Algorithme](#table_engine-collapsingmergetree-collapsing-algorithm) paragraphe. + +**Propriétés particulières d’une telle approche** + +1. Le programme qui écrit les données doit se souvenir de l’état d’un objet pour pouvoir l’annuler. “Cancel” string doit contenir des copies des champs de clé de tri du “state” chaîne et le contraire `Sign`. Il augmente la taille initiale de stockage, mais permet d’écrire les données rapidement. +2. Les tableaux de plus en plus longs dans les colonnes réduisent l’efficacité du moteur en raison de la charge pour l’écriture. Plus les données sont simples, plus l’efficacité est élevée. +3. Le `SELECT` les résultats dépendent fortement de la cohérence de l’historique des modifications d’objet. Être précis lors de la préparation des données pour l’insertion. Vous pouvez obtenir des résultats imprévisibles dans des données incohérentes, par exemple des valeurs négatives pour des mesures non négatives telles que la profondeur de session. + +### Algorithme {#table_engine-collapsingmergetree-collapsing-algorithm} + +Lorsque ClickHouse fusionne des parties de données, chaque groupe de lignes consécutives avec la même clé de tri (`ORDER BY`) est réduit à pas plus de deux rangées, une avec `Sign = 1` (“state” ligne) et l’autre avec `Sign = -1` (“cancel” rangée). En d’autres termes, les entrées de l’effondrement. + +Pour chaque partie de données résultante clickhouse enregistre: + +1. Première “cancel” et la dernière “state” lignes, si le nombre de “state” et “cancel” lignes correspond et la dernière ligne est un “state” rangée. + +2. La dernière “state” ligne, si il y a plus de “state” les lignes de “cancel” rangée. + +3. Première “cancel” ligne, si il y a plus de “cancel” les lignes de “state” rangée. + +4. Aucune des lignes, dans tous les autres cas. + +Aussi quand il y a au moins 2 plus “state” les lignes de “cancel” les lignes, ou au moins 2 de plus “cancel” rangs puis “state” la fusion continue, mais ClickHouse traite cette situation comme une erreur logique et l’enregistre dans le journal du serveur. Cette erreur peut se produire si les mêmes données ont été insérées plus d’une fois. + +Ainsi, l’effondrement ne devrait pas changer les résultats du calcul des statistiques. +Les changements se sont progressivement effondrés de sorte qu’à la fin seul le dernier état de presque tous les objets à gauche. + +Le `Sign` est nécessaire car l’algorithme de fusion ne garantit pas que toutes les lignes avec la même clé de tri seront dans la même partie de données résultante et même sur le même serveur physique. Processus de ClickHouse `SELECT` les requêtes avec plusieurs threads, et il ne peut pas prédire l’ordre des lignes dans le résultat. L’agrégation est nécessaire s’il y a un besoin d’obtenir complètement “collapsed” les données de `CollapsingMergeTree` table. + +Pour finaliser la réduction, écrivez une requête avec `GROUP BY` fonctions de clause et d’agrégation qui tiennent compte du signe. Par exemple, pour calculer la quantité, l’utilisation `sum(Sign)` plutôt `count()`. Pour calculer la somme de quelque chose, utilisez `sum(Sign * x)` plutôt `sum(x)` et ainsi de suite , et également ajouter `HAVING sum(Sign) > 0`. + +Aggregate `count`, `sum` et `avg` pourrait être calculée de cette manière. Aggregate `uniq` peut être calculé si un objet a au moins un état non réduit. Aggregate `min` et `max` impossible de calculer parce que `CollapsingMergeTree` n’enregistre pas l’historique des valeurs des États réduits. + +Si vous avez besoin d’extraire des données sans agrégation (par exemple, pour vérifier si des lignes sont présentes dont les valeurs les plus récentes correspondent à certaines conditions), vous pouvez utiliser `FINAL` le modificateur du `FROM` clause. Cette approche est nettement moins efficace. + +## Exemple D’Utilisation {#example-of-use} + +Les données de l’exemple: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Création de la table: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Insertion des données: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +Nous utilisons deux `INSERT` requêtes pour créer deux parties de données différentes. Si nous insérons les données avec une requête, ClickHouse crée une partie de données et n’effectuera aucune fusion. + +L’obtention de données: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Que voyons-nous et où s’effondre? + +Avec deux `INSERT` requêtes, nous avons créé 2 parties de données. Le `SELECT` la requête a été effectuée dans 2 threads, et nous avons obtenu un ordre aléatoire de lignes. L’effondrement n’a pas eu lieu car il n’y avait pas encore de fusion des parties de données. ClickHouse fusionne une partie des données dans un moment inconnu que nous ne pouvons pas prédire. + +Nous avons donc besoin d’agrégation: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +Si nous n’avons pas besoin d’agrégation et de vouloir forcer l’effondrement, nous pouvons utiliser `FINAL` le modificateur `FROM` clause. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Cette façon de sélectionner les données est très inefficace. Ne l’utilisez pas pour les grandes tables. + +## Exemple D’Une Autre Approche {#example-of-another-approach} + +Les données de l’exemple: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ -5 │ -146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +L’idée est que les fusions ne prennent en compte que les champs clés. Et dans le “Cancel” ligne nous pouvons spécifier des valeurs négatives qui égalisent la version précédente de la ligne lors de la sommation sans utiliser la colonne de signe. Pour cette approche, il est nécessaire de changer le type de données `PageViews`,`Duration` pour stocker les valeurs négatives de UInt8 - \> Int16. + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews Int16, + Duration Int16, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Nous allons tester l’approche: + +``` sql +insert into UAct values(4324182021466249494, 5, 146, 1); +insert into UAct values(4324182021466249494, -5, -146, -1); +insert into UAct values(4324182021466249494, 6, 185, 1); + +select * from UAct final; // avoid using final in production (just for a test or small tables) +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +``` sql +SELECT + UserID, + sum(PageViews) AS PageViews, + sum(Duration) AS Duration +FROM UAct +GROUP BY UserID +```text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +``` sqk +select count() FROM UAct +``` + +``` text +┌─count()─┐ +│ 3 │ +└─────────┘ +``` + +``` sql +optimize table UAct final; + +select * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/fr/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/fr/engines/table-engines/mergetree-family/custom-partitioning-key.md new file mode 100644 index 00000000000..5bf4db5b1bc --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,127 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 32 +toc_title: "Cl\xE9 De Partitionnement Personnalis\xE9e" +--- + +# Clé De Partitionnement Personnalisée {#custom-partitioning-key} + +Le partitionnement est disponible pour [MergeTree](mergetree.md) table de famille (y compris les [répliqué](replication.md) table). [Les vues matérialisées](../special/materializedview.md) basé sur les tables MergeTree prennent également en charge le partitionnement. + +Une partition est une combinaison logique d’enregistrements dans une table selon un critère spécifié. Vous pouvez définir une partition par un critère arbitraire, comme, par mois, par jour, ou par type d’événement. Chaque partition est stockée séparément pour simplifier les manipulations de ces données. Lors de l’accès aux données, ClickHouse utilise le plus petit sous-ensemble de partitions possible. + +La partition est spécifiée dans le `PARTITION BY expr` clause lors de [création d’une table](mergetree.md#table_engine-mergetree-creating-a-table). La clé de partition peut être n’importe quelle expression des colonnes de la table. Par exemple, pour spécifier le partitionnement par mois, utilisez l’expression `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour; +``` + +La clé de partition peut également être un tuple d’expressions (similaire à la [clé primaire](mergetree.md#primary-keys-and-indexes-in-queries)). Exemple: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +Dans cet exemple, nous définissons le partitionnement par les types d’événements qui se sont produits au cours de la semaine en cours. + +Lors de l’insertion de nouvelles données dans une table, ces données sont stockées en tant que partie séparée (bloc) triée par la clé primaire. Dans 10-15 minutes après l’insertion, les parties de la même partition sont fusionnées dans la partie entière. + +!!! info "Info" + Une fusion ne fonctionne que pour les parties de données qui ont la même valeur pour l’expression de partitionnement. Cela signifie **vous ne devriez pas faire des partitions trop granulaires** (plus d’un millier de partitions). Sinon, l’ `SELECT` la requête fonctionne mal en raison d’un nombre déraisonnablement élevé de fichiers dans le système de fichiers et des descripteurs de fichiers ouverts. + +L’utilisation de la [système.partie](../../../operations/system-tables.md#system_tables-parts) table pour afficher les parties et les partitions de la table. Par exemple, supposons que nous avons une `visits` table avec partitionnement par mois. Nous allons effectuer le `SELECT` la requête pour l’ `system.parts` table: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 1 │ +│ 201902 │ 201902_11_11_0 │ 1 │ +└───────────┴────────────────┴────────┘ +``` + +Le `partition` colonne contient les noms des partitions. Il y a deux partitions dans cet exemple: `201901` et `201902`. Vous pouvez utiliser cette valeur de colonne pour spécifier le nom de [ALTER … PARTITION](#alter_manipulations-with-partitions) requête. + +Le `name` colonne contient les noms des parties de données de partition. Vous pouvez utiliser cette colonne pour spécifier le nom de la partie dans la [ALTER ATTACH PART](#alter_attach-partition) requête. + +Décomposons le nom de la première partie: `201901_1_3_1`: + +- `201901` est le nom de la partition. +- `1` est le nombre minimum du bloc de données. +- `3` est le nombre maximal de blocs de données. +- `1` est le niveau de bloc (la profondeur de l’arbre de fusion à partir duquel il est formé). + +!!! info "Info" + Les parties des tables de type ancien ont le nom: `20190117_20190123_2_2_0` (date minimale - date maximale - numéro de bloc minimum - numéro de bloc maximum-niveau). + +Le `active` colonne indique le statut de la partie. `1` est active; `0` est inactif. Les parties inactives sont, par exemple, des parties source restant après la fusion à une partie plus grande. Les parties de données corrompues sont également indiquées comme inactives. + +Comme vous pouvez le voir dans l’exemple, il y a plusieurs parties séparées de la même partition (par exemple, `201901_1_3_1` et `201901_1_9_2`). Cela signifie que ces parties ne sont pas encore fusionnées. Clickhouse fusionne les parties insérées des données périodiquement, environ 15 minutes après l’insertion. En outre, vous pouvez effectuer une fusion non planifiée en utilisant [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) requête. Exemple: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 0 │ +│ 201902 │ 201902_4_11_2 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 0 │ +│ 201902 │ 201902_11_11_0 │ 0 │ +└───────────┴────────────────┴────────┘ +``` + +Les parties inactives seront supprimées environ 10 minutes après la fusion. + +Une autre façon d’afficher un ensemble de pièces et de partitions est d’aller dans le répertoire de la table: `/var/lib/clickhouse/data///`. Exemple: + +``` bash +/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +Dossier ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ et ainsi de suite sont les répertoires des parties. Chaque partie se rapporte à une partition correspondante et contient des données juste pour un certain mois (la table dans cet exemple a partitionnement par mois). + +Le `detached` le répertoire contient des parties qui ont été détachées de la table à l’aide [DETACH](#alter_detach-partition) requête. Les parties corrompues sont également déplacées dans ce répertoire, au lieu d’être supprimées. Le serveur n’utilise pas les pièces de la `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql-reference/statements/alter.md#alter_attach-partition) requête. + +Notez que sur le serveur d’exploitation, vous ne pouvez pas modifier manuellement l’ensemble de pièces ou leurs données sur le système de fichiers, car le serveur ne le saura pas. Pour les tables non répliquées, vous pouvez le faire lorsque le serveur est arrêté, mais ce n’est pas recommandé. Pour les tables répliquées, l’ensemble de pièces ne peut en aucun cas être modifié. + +ClickHouse vous permet d’effectuer des opérations avec les partitions: les supprimer, copier d’une table à une autre, ou créer une sauvegarde. Voir la liste de toutes les opérations de la section [Manipulations avec des Partitions et des pièces](../../../sql-reference/statements/alter.md#alter_manipulations-with-partitions). + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/fr/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/fr/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..f0a03729826 --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,174 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 38 +toc_title: GraphiteMergeTree +--- + +# Graphitemergetree {#graphitemergetree} + +Ce moteur est conçu pour l’amincissement et l’agrégation / moyenne (cumul) [Graphite](http://graphite.readthedocs.io/en/latest/index.html) données. Il peut être utile aux développeurs qui veulent utiliser ClickHouse comme un magasin de données pour Graphite. + +Vous pouvez utiliser N’importe quel moteur de table ClickHouse pour stocker les données Graphite si vous n’avez pas besoin de cumul, mais si vous avez besoin d’un cumul, utilisez `GraphiteMergeTree`. Le moteur réduit le volume de stockage et augmente l’efficacité des requêtes de Graphite. + +Le moteur hérite des propriétés de [MergeTree](mergetree.md). + +## Création d’une Table {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Voir une description détaillée de la [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) requête. + +Un tableau pour les données de Graphite devrait avoir les colonnes suivantes pour les données suivantes: + +- Nom métrique (Capteur De Graphite). Type de données: `String`. + +- Temps de mesure de la métrique. Type de données: `DateTime`. + +- La valeur de la métrique. Type de données: tout numérique. + +- La Version de la métrique. Type de données: tout numérique. + + ClickHouse enregistre les lignes avec la version la plus élevée ou la dernière écrite si les versions sont les mêmes. Les autres lignes sont supprimées lors de la fusion des parties de données. + +Les noms de ces colonnes doivent être définis dans la configuration de cumul. + +**GraphiteMergeTree paramètres** + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +**Les clauses de requête** + +Lors de la création d’un `GraphiteMergeTree` de table, de la même [clause](mergetree.md#table_engine-mergetree-creating-a-table) sont nécessaires, comme lors de la création d’un `MergeTree` table. + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +Tous les paramètres excepté `config_section` ont la même signification que dans `MergeTree`. + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +
+ +## Configuration De Cumul {#rollup-configuration} + +Les paramètres de cumul sont définis par [graphite\_rollup](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) paramètre dans la configuration du serveur. Le nom du paramètre pourrait être tout. Vous pouvez créer plusieurs configurations et les utiliser pour différentes tables. + +Structure de configuration de cumul: + + required-columns + patterns + +### Les Colonnes Requises {#required-columns} + +- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. +- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. +- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Valeur par défaut: `Value`. +- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. + +### Modèle {#patterns} + +La Structure de la `patterns` section: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "Attention" + Les motifs doivent être strictement commandés: + + 1. Patterns without `function` or `retention`. + 1. Patterns with both `function` and `retention`. + 1. Pattern `default`. + +Lors du traitement d’une ligne, ClickHouse vérifie les règles `pattern` section. Chacun `pattern` (comprendre `default`) les articles peuvent contenir des `function` paramètre d’agrégation, `retention` les paramètres ou les deux à la fois. Si le nom de la métrique correspond `regexp` les règles de la `pattern` section (ou sections) sont appliquées; sinon, les règles de la `default` section sont utilisés. + +Champs pour `pattern` et `default` section: + +- `regexp`– A pattern for the metric name. +- `age` – The minimum age of the data in seconds. +- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). +- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. + +### Exemple De Configuration {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/fr/engines/table_engines/mergetree_family/index.md b/docs/fr/engines/table-engines/mergetree-family/index.md similarity index 100% rename from docs/fr/engines/table_engines/mergetree_family/index.md rename to docs/fr/engines/table-engines/mergetree-family/index.md diff --git a/docs/fr/engines/table-engines/mergetree-family/mergetree.md b/docs/fr/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..c5d2be944b4 --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,654 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 30 +toc_title: MergeTree +--- + +# Mergetree {#table_engines-mergetree} + +Le `MergeTree` moteur et autres moteurs de cette famille (`*MergeTree`) sont les moteurs de table ClickHouse les plus robustes. + +Les moteurs de la `MergeTree` famille sont conçus pour l’insertion d’une très grande quantité de données dans une table. Les données sont rapidement écrites dans la table partie par partie, puis des règles sont appliquées pour fusionner les parties en arrière-plan. Cette méthode est beaucoup plus efficace que de réécrire continuellement les données dans le stockage pendant l’insertion. + +Principales caractéristiques: + +- Stocke les données triées par clé primaire. + + Cela vous permet de créer un petit index clairsemé qui aide à trouver les données plus rapidement. + +- Les Partitions peuvent être utilisées si [clé de partitionnement](custom-partitioning-key.md) est spécifié. + + ClickHouse prend en charge certaines opérations avec des partitions plus efficaces que les opérations générales sur les mêmes données avec le même résultat. ClickHouse Coupe également automatiquement les données de partition où la clé de partitionnement est spécifiée dans la requête. Cela améliore également les performances de la requête. + +- Prise en charge de la réplication des données. + + La famille de `ReplicatedMergeTree` tables fournit la réplication des données. Pour plus d’informations, voir [Réplication des données](replication.md). + +- Appui d’échantillonnage de données. + + Si nécessaire, vous pouvez définir la méthode d’échantillonnage des données dans le tableau. + +!!! info "Info" + Le [Fusionner](../special/merge.md) le moteur n’appartient pas à la `*MergeTree` famille. + +## Création d’une Table {#table_engine-mergetree-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 +) ENGINE = MergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] +[SETTINGS name=value, ...] +``` + +Pour une description des paramètres, voir [Créer une description de requête](../../../sql-reference/statements/create.md). + +!!! note "Note" + `INDEX` est une fonctionnalité expérimentale, voir [Index De Saut De Données](#table_engine-mergetree-data_skipping-indexes). + +### Les Clauses De Requête {#mergetree-query-clauses} + +- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. Le `MergeTree` le moteur n’a pas de paramètres. + +- `PARTITION BY` — The [clé de partitionnement](custom-partitioning-key.md). + + Pour le partitionnement par mois, utilisez les `toYYYYMM(date_column)` l’expression, où `date_column` est une colonne avec une date du type [Date](../../../sql-reference/data-types/date.md). Les noms de partition ici ont le `"YYYYMM"` format. + +- `ORDER BY` — The sorting key. + + Un tuple de colonnes ou d’expressions arbitraires. Exemple: `ORDER BY (CounterID, EventDate)`. + +- `PRIMARY KEY` — The primary key if it [diffère de la clé de tri](#choosing-a-primary-key-that-differs-from-the-sorting-key). + + Par défaut, la clé primaire est la même que la clé de tri (qui est spécifiée par `ORDER BY` clause). Ainsi dans la plupart des cas il n’est pas nécessaire de spécifier un `PRIMARY KEY` clause. + +- `SAMPLE BY` — An expression for sampling. + + Si un échantillonnage expression est utilisée, la clé primaire doit contenir. Exemple: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. + +- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [entre disques et volumes](#table_engine-mergetree-multiple-volumes). + + L’Expression doit en avoir une `Date` ou `DateTime` colonne comme un résultat. Exemple: + `TTL date + INTERVAL 1 DAY` + + Le Type de la règle `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` spécifie une action à effectuer avec la partie si l’expression est satisfaite (atteint l’heure actuelle): suppression des Lignes expirées, déplacement d’une partie (si l’expression est satisfaite pour toutes les lignes d’une partie) sur le disque spécifié (`TO DISK 'xxx'`) ou de volume (`TO VOLUME 'xxx'`). Le type par défaut de la règle est suppression (`DELETE`). Liste de règles multiples peut spécifié, mais il ne devrait pas y avoir plus d’un `DELETE` règle. + + Pour plus de détails, voir [TTL pour les colonnes et les tableaux](#table_engine-mergetree-ttl) + +- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: + + - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Le Stockage De Données](#mergetree-data-storage). + - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Le Stockage De Données](#mergetree-data-storage). + - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` paramètre. Avant la version 19.11, il n’y avait que le `index_granularity` réglage pour restreindre la taille des granules. Le `index_granularity_bytes` le paramètre améliore les performances de ClickHouse lors de la sélection de données à partir de tables avec de grandes lignes (des dizaines et des centaines de mégaoctets). Si vous avez des tables avec de grandes lignes, vous pouvez activer ce paramètre pour les tables d’améliorer l’efficacité de `SELECT` requête. + - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, puis Zookeeper stocke moins de données. Pour plus d’informations, voir le [Description du réglage](../../../operations/server-configuration-parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) dans “Server configuration parameters”. + - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` octets, ClickHouse lit et écrit les données sur le disque de stockage en utilisant l’interface d’E/S directe (`O_DIRECT` option). Si `min_merge_bytes_to_use_direct_io = 0`, puis les e/s directes sont désactivées. Valeur par défaut: `10 * 1024 * 1024 * 1024` octet. + + - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). + - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don’t turn it off. + - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. + - `storage_policy` — Storage policy. See [Utilisation de plusieurs périphériques de bloc pour le stockage de données](#table_engine-mergetree-multiple-volumes). + +**Exemple de réglage des Sections** + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 +``` + +Dans l’exemple, nous définissons le partitionnement par mois. + +Nous définissons également une expression pour l’échantillonnage en tant que hachage par l’ID utilisateur. Cela vous permet de pseudorandomiser les données dans la table pour chaque `CounterID` et `EventDate`. Si vous définissez un [SAMPLE](../../../sql-reference/statements/select.md#select-sample-clause) clause lors de la sélection des données, ClickHouse retournera un échantillon de données uniformément pseudo-aléatoire pour un sous-ensemble d’utilisateurs. + +Le `index_granularity` paramètre peut être omis, car 8192 est la valeur par défaut. + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets. Si possible, optez anciens projets à la méthode décrite ci-dessus. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +**Paramètres MergeTree ()** + +- `date-column` — The name of a column of the [Date](../../../sql-reference/data-types/date.md) type. ClickHouse crée automatiquement des partitions par mois en fonction de cette colonne. Les noms de partition sont dans le `"YYYYMM"` format. +- `sampling_expression` — An expression for sampling. +- `(primary, key)` — Primary key. Type: [Tuple()](../../../sql-reference/data-types/tuple.md) +- `index_granularity` — The granularity of an index. The number of data rows between the “marks” d’un index. La valeur 8192 est appropriée pour la plupart des tâches. + +**Exemple** + +``` sql +MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) +``` + +Le `MergeTree` le moteur est configuré de la même manière que dans l’exemple ci-dessus pour la méthode de configuration du moteur principal. +
+ +## Le Stockage De Données {#mergetree-data-storage} + +Une table se compose de parties de données triées par clé primaire. + +Lorsque des données sont insérées dans une table, des parties de données distinctes sont créées et chacune d’elles est lexicographiquement triée par clé primaire. Par exemple, si la clé primaire est `(CounterID, Date)`, les données de la pièce sont triées par `CounterID` et au sein de chaque `CounterID` il est commandé par `Date`. + +Les données appartenant à différentes partitions sont séparés en différentes parties. En arrière-plan, ClickHouse fusionne des parties de données pour un stockage plus efficace. Les parties appartenant à des partitions différentes ne sont pas fusionnées. La fusion mécanisme ne garantit pas que toutes les lignes avec la même clé primaire sera dans la même partie des données. + +Chaque partie de données est logiquement divisée en granules. Un granule est le plus petit ensemble de données indivisible que ClickHouse lit lors de la sélection des données. ClickHouse ne divise pas les lignes ou les valeurs, de sorte que chaque granule contient toujours un nombre entier de lignes. La première rangée de granules est marqué avec la valeur de la clé primaire de la ligne. Pour chaque partie de données, ClickHouse crée un fichier d’index qui stocke les marques. Pour chaque colonne, que ce soit dans la clé primaire ou non, ClickHouse stocke également les mêmes marques. Ces marques vous permettent de trouver des données directement dans les fichiers de colonnes. + +La taille de granule est limitée par `index_granularity` et `index_granularity_bytes` paramètres du moteur de table. Le nombre de lignes dans un granule jette dans la `[1, index_granularity]` gamme, en fonction de la taille des lignes. La taille des granulés peut dépasser `index_granularity_bytes` si la taille d’une seule ligne est supérieure à la valeur du paramètre. Dans ce cas, la taille du granule est égale à la taille de la ligne. + +## Clés Primaires Et Index Dans Les requêtes {#primary-keys-and-indexes-in-queries} + +Prendre la `(CounterID, Date)` clé primaire comme un exemple. Dans ce cas, le tri et l’index peuvent être illustrés comme suit: + + Whole data: [---------------------------------------------] + CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] + Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] + Marks: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 + Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 + +Si la requête de données spécifie: + +- `CounterID in ('a', 'h')` le serveur lit les données dans les gammes des marques `[0, 3)` et `[6, 8)`. +- `CounterID IN ('a', 'h') AND Date = 3` le serveur lit les données dans les gammes des marques `[1, 3)` et `[7, 8)`. +- `Date = 3`, le serveur lit les données de la plage de marque `[1, 10]`. + +Les exemples ci-dessus montrent qu’il est toujours plus efficace d’utiliser un indice qu’une analyse complète. + +Un index clairsemé permet de lire des données supplémentaires. Lors de la lecture d’une plage unique de la clé primaire, jusqu’à `index_granularity * 2` lignes supplémentaires dans chaque bloc de données peut être lu. + +Les index clairsemés vous permettent de travailler avec un très grand nombre de lignes de table, car dans la plupart des cas, ces index tiennent dans la RAM de l’ordinateur. + +ClickHouse ne nécessite pas de clé primaire unique. Vous pouvez insérer plusieurs lignes avec la même clé primaire. + +### Sélection De La clé Primaire {#selecting-the-primary-key} + +Le nombre de colonnes de la clé primaire n’est pas explicitement limitée. Selon la structure de données, vous pouvez inclure plus ou moins de colonnes dans la clé primaire. Cela peut: + +- Améliorer la performance d’un indice. + + Si la clé primaire est `(a, b)`, puis ajouter une autre colonne `c` pour améliorer les performances si les conditions suivantes sont réunies: + + - Il y a des requêtes avec une condition sur la colonne `c`. + - Longues plages de données (plusieurs fois plus longues que `index_granularity`) avec des valeurs identiques pour `(a, b)` sont communs. En d’autres termes, lors de l’ajout d’une autre colonne vous permet de passer très longues plages de données. + +- Améliorer la compression des données. + + ClickHouse trie les données par clé primaire, donc plus la cohérence est élevée, meilleure est la compression. + +- Fournir une logique supplémentaire lors de la fusion de parties de [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) et [SummingMergeTree](summingmergetree.md) moteur. + + Dans ce cas, on peut spécifier l’ *clé de tri* qui est différente de la clé primaire. + +Une clé primaire longue affectera négativement les performances d’insertion et la consommation de mémoire, mais des colonnes supplémentaires dans la clé primaire n’affecteront pas les performances de ClickHouse pendant `SELECT` requête. + +### Choisir Une clé Primaire Qui diffère De La clé De Tri {#choosing-a-primary-key-that-differs-from-the-sorting-key} + +Il est possible de spécifier une clé primaire (une expression avec des valeurs qui sont écrites dans le fichier d’index pour chaque marque) qui est différente de la clé de tri (une expression pour trier les lignes dans les parties de données). Dans ce cas, le tuple d’expression de clé primaire doit être un préfixe du tuple d’expression de clé de tri. + +Cette fonctionnalité est utile lorsque vous utilisez le [SummingMergeTree](summingmergetree.md) et +[AggregatingMergeTree](aggregatingmergetree.md) table des moteurs. Dans un cas courant lors de l’utilisation de ces moteurs, la table a deux types de colonnes: *dimension* et *mesure*. Les requêtes typiques agrégent les valeurs des colonnes de mesure avec arbitraire `GROUP BY` et filtrage par dimensions. Comme SummingMergeTree et AggregatingMergeTree regroupent des lignes avec la même valeur de la clé de tri, il est naturel d’y ajouter toutes les dimensions. En conséquence, l’expression se compose d’une longue liste de colonnes, et cette liste doit être mise à jour fréquemment avec nouvellement ajoutée. + +Dans ce cas, il est logique de ne laisser que quelques colonnes dans la clé primaire qui fourniront des analyses de plage efficaces et ajouteront les colonnes de dimension restantes au tuple de clé de tri. + +[ALTER](../../../sql-reference/statements/alter.md) la clé de tri est une opération légère car lorsqu’une nouvelle colonne est ajoutée simultanément à la table et à la clé de tri, les parties de données existantes n’ont pas besoin d’être modifiées. Comme l’ancienne clé de tri est un préfixe de la nouvelle clé de tri et qu’il n’y a pas de données dans la colonne nouvellement ajoutée, les données sont triées à la fois par l’ancienne et la nouvelle clé de tri au moment de la modification de la table. + +### Utilisation D’Index Et De Partitions Dans Les requêtes {#use-of-indexes-and-partitions-in-queries} + +Pour `SELECT` requêtes, clickhouse analyse si un index peut être utilisé. Un index peut être utilisé si le `WHERE/PREWHERE` clause a une expression (comme l’un des éléments de conjonction, ou entièrement) qui représente une opération de comparaison d’égalité ou d’inégalité, ou si elle a `IN` ou `LIKE` avec un préfixe fixe sur les colonnes ou les expressions qui sont dans la clé primaire ou la clé de partitionnement, ou sur certaines fonctions partiellement répétitives de ces colonnes, ou les relations logiques de ces expressions. + +Ainsi, il est possible d’exécuter des requêtes sur une ou plusieurs plages de la clé primaire. Dans cet exemple, les requêtes seront rapides lorsqu’elles sont exécutées pour une balise de suivi spécifique, pour une balise et une plage de dates spécifiques, pour une balise et une date spécifiques, pour plusieurs balises avec une plage de dates, etc. + +Regardons le moteur configuré comme suit: + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 + +Dans ce cas, dans les requêtes: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +ClickHouse utilisera l’index de clé primaire pour supprimer les données incorrectes et la clé de partitionnement mensuel pour supprimer les partitions qui se trouvent dans des plages de dates incorrectes. + +Les requêtes ci-dessus montrent que l’index est utilisé même pour les expressions complexes. La lecture de la table est organisée de sorte que l’utilisation de l’index ne peut pas être plus lente qu’une analyse complète. + +Dans l’exemple ci-dessous, l’index ne peut pas être utilisé. + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +Pour vérifier si ClickHouse pouvez utiliser l’index lors de l’exécution d’une requête, utilisez les paramètres [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) et [force\_primary\_key](../../../operations/settings/settings.md). + +La clé de partitionnement par mois permet de lire uniquement les blocs de données qui contiennent des dates de la plage appropriée. Dans ce cas, le bloc de données peut contenir des données pour plusieurs dates (jusqu’à un mois entier). Dans un bloc, les données sont triées par clé primaire, qui peut ne pas contenir la date comme première colonne. Pour cette raison, l’utilisation d’une requête avec seulement une condition de date qui ne spécifie pas le préfixe de clé primaire entraînera la lecture de plus de données que pour une seule date. + +### Utilisation De L’Index Pour Les clés Primaires Partiellement Monotones {#use-of-index-for-partially-monotonic-primary-keys} + +Considérons, par exemple, les jours du mois. Ils forment un [monotone de la séquence](https://en.wikipedia.org/wiki/Monotonic_function) pendant un mois, mais pas monotone pendant des périodes plus longues. C’est une séquence partiellement monotone. Si un utilisateur crée la table avec une clé primaire partiellement monotone, ClickHouse crée un index clairsemé comme d’habitude. Lorsqu’un utilisateur sélectionne des données à partir de ce type de table, ClickHouse analyse les conditions de requête. Si L’utilisateur veut obtenir des données entre deux marques de l’index et que ces deux marques tombent dans un mois, ClickHouse peut utiliser l’index dans ce cas particulier car il peut calculer la distance entre les paramètres d’une requête et les marques d’index. + +ClickHouse ne peut pas utiliser un index si les valeurs de la clé primaire dans la plage de paramètres de requête ne représentent pas une séquence monotone. Dans ce cas, ClickHouse utilise la méthode full scan. + +ClickHouse utilise cette logique non seulement pour les séquences de jours du mois, mais pour toute clé primaire qui représente une séquence partiellement monotone. + +### Index De Saut De données (expérimental) {#table_engine-mergetree-data_skipping-indexes} + +La déclaration d’index se trouve dans la section colonnes du `CREATE` requête. + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +Pour les tables de la `*MergeTree` famille, les indices de saut de données peuvent être spécifiés. + +Ces indices agrégent certaines informations sur l’expression spécifiée sur les blocs, qui consistent en `granularity_value` granules (la taille du granule est spécifiée en utilisant `index_granularity` réglage dans le moteur de table). Ensuite, ces agrégats sont utilisés dans `SELECT` requêtes pour réduire la quantité de données à lire à partir du disque en ignorant de gros blocs de données `where` la requête ne peut pas être satisfait. + +**Exemple** + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +Les Indices de L’exemple peuvent être utilisés par ClickHouse pour réduire la quantité de données à lire à partir du disque dans les requêtes suivantes: + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### Types D’Indices Disponibles {#available-types-of-indices} + +- `minmax` + + Magasins extrêmes de l’expression spécifiée (si l’expression est `tuple` puis il stocke les extrêmes pour chaque élément de `tuple`), utilise les informations stockées pour sauter des blocs de données comme la clé primaire. + +- `set(max_rows)` + + Stocke les valeurs uniques de l’expression spécifiée (pas plus de `max_rows` rangée, `max_rows=0` moyen “no limits”). Utilise les valeurs pour vérifier si le `WHERE` l’expression n’est pas satisfiable sur un bloc de données. + +- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + Magasins un [Filtre de Bloom](https://en.wikipedia.org/wiki/Bloom_filter) qui contient tous les ngrams d’un bloc de données. Fonctionne uniquement avec des chaînes. Peut être utilisé pour l’optimisation de `equals`, `like` et `in` expression. + + - `n` — ngram size, + - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). + - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. + - `random_seed` — The seed for Bloom filter hash functions. + +- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + Le même que `ngrambf_v1`, mais stocke des jetons au lieu de ngrams. Les jetons sont des séquences séparées par des caractères non alphanumériques. + +- `bloom_filter([false_positive])` — Stores a [Filtre de Bloom](https://en.wikipedia.org/wiki/Bloom_filter) pour les colonnes spécifiées. + + Facultatif `false_positive` le paramètre est la probabilité de recevoir une réponse faussement positive du filtre. Valeurs possibles: (0, 1). Valeur par défaut: 0.025. + + Types de données pris en charge: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. + + Les fonctions suivantes peuvent l’utiliser: [égal](../../../sql-reference/functions/comparison-functions.md), [notEquals](../../../sql-reference/functions/comparison-functions.md), [dans](../../../sql-reference/functions/in-functions.md), [notIn](../../../sql-reference/functions/in-functions.md), [avoir](../../../sql-reference/functions/array-functions.md). + + + +``` sql +INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 +INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 +``` + +#### Les Fonctions De Soutien {#functions-support} + +Les Conditions dans le `WHERE` la clause contient des appels des fonctions qui fonctionnent avec des colonnes. Si la colonne fait partie d’un index, ClickHouse essaie d’utiliser cet index lors de l’exécution des fonctions. ClickHouse prend en charge différents sous-ensembles de fonctions pour l’utilisation d’index. + +Le `set` l’indice peut être utilisé avec toutes les fonctions. Les sous-ensembles de fonctions pour les autres index sont présentés dans le tableau ci-dessous. + +| Fonction (opérateur) / Indice de | clé primaire | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | +|--------------------------------------------------------------------------------------------------------------|--------------|--------|-------------|-------------|---------------| +| [égal (=, ==)](../../../sql-reference/functions/comparison-functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notEquals (!=, \<\>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [comme](../../../sql-reference/functions/string-search-functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [notLike](../../../sql-reference/functions/string-search-functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [startsWith](../../../sql-reference/functions/string-functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [endsWith](../../../sql-reference/functions/string-functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [multiSearchAny](../../../sql-reference/functions/string-search-functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | +| [dans](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notIn](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [peu (\<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [grand (\>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [lessOrEquals (\<=)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [greaterOrEquals ( \> =)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [vide](../../../sql-reference/functions/array-functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [notEmpty](../../../sql-reference/functions/array-functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | + +Les fonctions avec un argument constant inférieur à la taille ngram ne peuvent pas être utilisées par `ngrambf_v1` pour l’optimisation de la requête. + +Les filtres Bloom peuvent avoir des correspondances faussement positives, de sorte que le `ngrambf_v1`, `tokenbf_v1`, et `bloom_filter` les index ne peuvent pas être utilisés pour optimiser les requêtes où le résultat d’une fonction est censé être faux, par exemple: + +- Peut être optimisé: + - `s LIKE '%test%'` + - `NOT s NOT LIKE '%test%'` + - `s = 1` + - `NOT s != 1` + - `startsWith(s, 'test')` +- Ne peut pas être optimisé: + - `NOT s LIKE '%test%'` + - `s NOT LIKE '%test%'` + - `NOT s = 1` + - `s != 1` + - `NOT startsWith(s, 'test')` + +## Accès Simultané Aux Données {#concurrent-data-access} + +Pour l’accès aux tables simultanées, nous utilisons le multi-versioning. En d’autres termes, lorsqu’une table est lue et mise à jour simultanément, les données sont lues à partir d’un ensemble de parties en cours au moment de la requête. Il n’y a pas de longues mèches. Les Inserts ne gênent pas les opérations de lecture. + +Lecture à partir d’un tableau est automatiquement parallélisée. + +## TTL Pour Les Colonnes Et Les Tableaux {#table_engine-mergetree-ttl} + +Détermine la durée de vie de des valeurs. + +Le `TTL` clause peut être définie pour la table entière et pour chaque colonne individuelle. Ttl de niveau Table peut également spécifier la logique de déplacement automatique des données entre les disques et les volumes. + +Les Expressions doivent évaluer pour [Date](../../../sql-reference/data-types/date.md) ou [DateTime](../../../sql-reference/data-types/datetime.md) type de données. + +Exemple: + +``` sql +TTL time_column +TTL time_column + interval +``` + +Définir `interval`, utiliser [intervalle](../../../sql-reference/operators.md#operators-datetime) opérateur. + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### Colonne TTL {#mergetree-column-ttl} + +Lorsque les valeurs de la colonne expirent, ClickHouse les remplace par les valeurs par défaut du type de données de la colonne. Si toutes les valeurs de colonne de la partie données expirent, ClickHouse supprime cette colonne de la partie données d’un système de fichiers. + +Le `TTL` la clause ne peut pas être utilisée pour les colonnes clés. + +Exemple: + +Création d’une table avec TTL + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +Ajout de TTL à une colonne d’une table existante + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +Modification de TTL de la colonne + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### Tableau TTL {#mergetree-table-ttl} + +Table peut avoir une expression pour la suppression de Lignes expirées, et plusieurs expressions pour le déplacement automatique de pièces entre [disques ou volumes](#table_engine-mergetree-multiple-volumes). Lorsque les lignes de la table expirent, ClickHouse supprime toutes les lignes correspondantes. Pour les pièces en mouvement, toutes les lignes d’une pièce doivent satisfaire aux critères d’expression de mouvement. + +``` sql +TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... +``` + +Type de règle TTL peut suivre chaque expression TTL. Il affecte une action qui doit être faite une fois que l’expression est satisfaite (atteint l’heure actuelle): + +- `DELETE` - supprimer les Lignes expirées (action par défaut); +- `TO DISK 'aaa'` - déplacer la partie sur le disque `aaa`; +- `TO VOLUME 'bbb'` - déplacer la partie sur le disque `bbb`. + +Exemple: + +Création d’une table avec TTL + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH [DELETE], + d + INTERVAL 1 WEEK TO VOLUME 'aaa', + d + INTERVAL 2 WEEK TO DISK 'bbb'; +``` + +Modification de TTL de la table + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**Suppression De Données** + +Les données avec un TTL expiré sont supprimées lorsque ClickHouse fusionne des parties de données. + +Lorsque ClickHouse voit que les données sont expirées, il effectue une fusion hors calendrier. Pour contrôler la fréquence de ces fusions, vous pouvez définir [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). Si la valeur est trop faible, il effectuera de nombreuses fusions hors calendrier qui peuvent consommer beaucoup de ressources. + +Si vous effectuez la `SELECT` requête entre les fusionne, vous pouvez obtenir des données expirées. Pour éviter cela, utilisez la [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) requête avant de l’ `SELECT`. + +## Utilisation De Plusieurs Périphériques De Bloc Pour Le Stockage De Données {#table_engine-mergetree-multiple-volumes} + +### Introduction {#introduction} + +`MergeTree` les moteurs de table de famille peuvent stocker des données sur plusieurs périphériques de bloc. Par exemple, il peut être utile lorsque les données d’un tableau sont implicitement divisé en “hot” et “cold”. Les données les plus récentes sont régulièrement demandées mais ne nécessitent qu’une petite quantité d’espace. Au contraire, les données historiques à queue grasse sont rarement demandées. Si plusieurs disques sont disponibles, la “hot” les données peuvent être situées sur des disques rapides (par exemple, SSD NVMe ou en mémoire), tandis que le “cold” des données relativement lente (par exemple, disque dur). + +La partie de données est l’unité mobile minimum pour `MergeTree`-tables de moteur. Les données appartenant à une partie sont stockées sur un disque. Les parties de données peuvent être déplacées entre les disques en arrière-plan (selon les paramètres de l’utilisateur) ainsi qu’au moyen du [ALTER](../../../sql-reference/statements/alter.md#alter_move-partition) requête. + +### Terme {#terms} + +- Disk — Block device mounted to the filesystem. +- Default disk — Disk that stores the path specified in the [chemin](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) paramètre de serveur. +- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). +- Storage policy — Set of volumes and the rules for moving data between them. + +Les noms donnés aux entités décrites peuvent être trouvés dans les tables système, [système.storage\_policies](../../../operations/system-tables.md#system_tables-storage_policies) et [système.disque](../../../operations/system-tables.md#system_tables-disks). Pour appliquer l’une des stratégies de stockage configurées pour une table, utilisez `storage_policy` réglage de `MergeTree`-moteur de table de famille. + +### Configuration {#table_engine-mergetree-multiple-volumes-configure} + +Les disques, les volumes et les stratégies de stockage doivent être déclarés `` étiquette, soit dans le fichier principal `config.xml` ou dans un fichier distinct dans le `config.d` répertoire. + +Structure de Configuration: + +``` xml + + + + /mnt/fast_ssd/clickhouse/ + + + /mnt/hdd1/clickhouse/ + 10485760 + + + /mnt/hdd2/clickhouse/ + 10485760 + + + ... + + + ... + +``` + +Balise: + +- `` — Disk name. Names must be different for all disks. +- `path` — path under which a server will store data (`data` et `shadow` des dossiers), doit être terminé par ‘/’. +- `keep_free_space_bytes` — the amount of free disk space to be reserved. + +L’ordre du disque définition n’est pas important. + +Stratégies de stockage balisage de configuration: + +``` xml + + ... + + + + + disk_name_from_disks_configuration + 1073741824 + + + + + + + 0.2 + + + + + + + + ... + +``` + +Balise: + +- `policy_name_N` — Policy name. Policy names must be unique. +- `volume_name_N` — Volume name. Volume names must be unique. +- `disk` — a disk within a volume. +- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. +- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). + +Exemples de Cofiguration: + +``` xml + + ... + + + + + disk1 + disk2 + + + + + + + + fast_ssd + 1073741824 + + + disk1 + + + 0.2 + + + ... + +``` + +Dans l’exemple donné, la `hdd_in_order` politique met en œuvre les [round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) approche. Ainsi cette politique ne définit qu’un seul volume (`single`), les parties des données sont stockées sur tous ses disques dans l’ordre circulaire. Une telle politique peut être très utile s’il y a plusieurs disques similaires sont montés sur le système, mais RAID N’est pas configuré. Gardez à l’esprit que chaque lecteur de disque n’est pas fiable et vous pouvez compenser avec facteur de réplication de 3 ou plus. + +S’il existe différents types de disques disponibles dans le système, `moving_from_ssd_to_hdd` la stratégie peut être utilisée à la place. Volume `hot` se compose d’un disque SSD (`fast_ssd`), et la taille maximale d’une pièce qui peut être stocké sur ce volume est de 1 go. Toutes les pièces avec la taille plus grande que 1 GB sera stocké directement sur le `cold` le volume, qui contient un disque dur de disque `disk1`. +Aussi, une fois le disque `fast_ssd` est complété par plus de 80%, les données seront transférées à la `disk1` par un processus d’arrière-plan. + +L’ordre d’énumération des volumes dans une stratégie de stockage est important. Une fois qu’un volume est surchargé, les données sont déplacées vers le suivant. L’ordre d’énumération des disques est important parce que les données sont stockées dans les virages. + +Lors de la création d’une table, on peut lui appliquer l’une des stratégies de stockage configurées: + +``` sql +CREATE TABLE table_with_non_default_policy ( + EventDate Date, + OrderID UInt64, + BannerID UInt64, + SearchPhrase String +) ENGINE = MergeTree +ORDER BY (OrderID, BannerID) +PARTITION BY toYYYYMM(EventDate) +SETTINGS storage_policy = 'moving_from_ssd_to_hdd' +``` + +Le `default` la Politique de stockage implique d’utiliser un seul volume, qui se compose d’un seul disque donné dans ``. Une fois qu’une table est créée, sa stratégie de stockage ne peut pas être modifiée. + +### Détail {#details} + +Dans le cas de `MergeTree` les tableaux, les données sont sur le disque de différentes façons: + +- En tant que résultat d’un insert (`INSERT` requête). +- En arrière-plan fusionne et [mutation](../../../sql-reference/statements/alter.md#alter-mutations). +- Lors du téléchargement à partir d’une autre réplique. +- À la suite du gel de la partition [ALTER TABLE … FREEZE PARTITION](../../../sql-reference/statements/alter.md#alter_freeze-partition). + +Dans tous ces cas, à l’exception des mutations et du gel de partition, une pièce est stockée sur un volume et un disque selon la Politique de stockage donnée: + +1. Le premier volume (dans l’ordre de définition) qui a suffisamment d’espace disque pour stocker une pièce (`unreserved_space > current_part_size`) et permet de stocker des pièces d’une taille donnée (`max_data_part_size_bytes > current_part_size`) est choisi. +2. Dans ce volume, ce disque est choisi qui suit celui, qui a été utilisé pour stocker le bloc de données précédent, et qui a de l’espace libre plus que la taille de la pièce (`unreserved_space - keep_free_space_bytes > current_part_size`). + +Sous le capot, les mutations et la congélation des cloisons utilisent [des liens en dur](https://en.wikipedia.org/wiki/Hard_link). Les liens durs entre différents disques ne sont pas pris en charge, donc dans de tels cas, les pièces résultantes sont stockées sur les mêmes disques que les disques initiaux. + +En arrière - plan, les pièces sont déplacées entre les volumes en fonction de la quantité d’espace libre (`move_factor` paramètre) selon l’ordre les volumes sont déclarées dans le fichier de configuration. +Les données ne sont jamais transférées du dernier et dans le premier. On peut utiliser des tables système [système.part\_log](../../../operations/system-tables.md#system_tables-part-log) (champ `type = MOVE_PART`) et [système.partie](../../../operations/system-tables.md#system_tables-parts) (Fields `path` et `disk`) pour surveiller l’arrière-plan se déplace. Aussi, les informations détaillées peuvent être trouvées dans les journaux du serveur. + +L’utilisateur peut forcer le déplacement d’une partie ou d’une partition d’un volume à l’autre à l’aide de la requête [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql-reference/statements/alter.md#alter_move-partition), toutes les restrictions pour les opérations de fond sont prises en compte. La requête initie un mouvement seul et n’attend pas que les opérations d’arrière-plan soient terminées. L’utilisateur recevra un message d’erreur si pas assez d’espace libre est disponible ou si l’une des conditions requises ne sont pas remplies. + +Le déplacement des données n’interfère pas avec la réplication des données. Par conséquent, différentes stratégies de stockage peuvent être spécifiées pour la même table sur différents réplicas. + +Après l’achèvement des fusions d’arrière-plan et des mutations, les anciennes parties ne sont supprimées qu’après un certain temps (`old_parts_lifetime`). +Pendant ce temps, ils ne sont pas déplacés vers d’autres volumes ou des disques. Par conséquent, jusqu’à ce que les pièces soient finalement supprimées, elles sont toujours prises en compte pour l’évaluation de l’espace disque occupé. + +[Article Original](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/fr/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/fr/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..85f8fc7b8ff --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,69 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 33 +toc_title: ReplacingMergeTree +--- + +# Replacingmergetree {#replacingmergetree} + +Le moteur diffère de [MergeTree](mergetree.md#table_engines-mergetree) en ce qu’il supprime les doublons avec la même valeur de clé primaire (ou, plus précisément, avec la même [clé de tri](mergetree.md) valeur). + +La déduplication des données se produit uniquement lors d’une fusion. La fusion se produit en arrière-plan à un moment inconnu, vous ne pouvez donc pas le planifier. Certaines des données peuvent rester non traitées. Bien que vous puissiez exécuter une fusion imprévue en utilisant le `OPTIMIZE` requête, ne comptez pas l’utiliser, parce que la `OPTIMIZE` requête va lire et écrire une grande quantité de données. + +Ainsi, `ReplacingMergeTree` convient pour effacer les données en double en arrière-plan afin d’économiser de l’espace, mais cela ne garantit pas l’absence de doublons. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Pour une description des paramètres de requête, voir [demande de description](../../../sql-reference/statements/create.md). + +**ReplacingMergeTree Paramètres** + +- `ver` — column with version. Type `UInt*`, `Date` ou `DateTime`. Paramètre facultatif. + + Lors de la fusion, `ReplacingMergeTree` de toutes les lignes avec la même clé primaire ne laisse qu’un: + + - Dernier dans la sélection, si `ver` pas ensemble. + - Avec la version maximale, si `ver` défini. + +**Les clauses de requête** + +Lors de la création d’un `ReplacingMergeTree` la table de la même [clause](mergetree.md) sont nécessaires, comme lors de la création d’un `MergeTree` table. + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +Tous les paramètres excepté `ver` ont la même signification que dans `MergeTree`. + +- `ver` - colonne avec la version. Paramètre facultatif. Pour une description, voir le texte ci-dessus. + +
+ +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/fr/engines/table-engines/mergetree-family/replication.md b/docs/fr/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..6c444d689eb --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,218 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 31 +toc_title: "R\xE9plication Des Donn\xE9es" +--- + +# Réplication Des Données {#table_engines-replication} + +La réplication n’est prise en charge que pour les tables de la famille MergeTree: + +- ReplicatedMergeTree +- ReplicatedSummingMergeTree +- ReplicatedReplacingMergeTree +- ReplicatedAggregatingMergeTree +- ReplicatedCollapsingMergeTree +- ReplicatedVersionedCollapsingMergetree +- ReplicatedGraphiteMergeTree + +La réplication fonctionne au niveau d’une table individuelle, Pas du serveur entier. Un serveur peut stocker des tables répliquées et non répliquées en même temps. + +La réplication ne dépend pas de la fragmentation. Chaque fragment a sa propre réplication indépendante. + +Données compressées pour `INSERT` et `ALTER` les requêtes sont répliquées (pour plus d’informations, consultez la documentation de [ALTER](../../../sql-reference/statements/alter.md#query_language_queries_alter)). + +`CREATE`, `DROP`, `ATTACH`, `DETACH` et `RENAME` les requêtes sont exécutées sur un seul serveur et ne sont pas répliquées: + +- Le `CREATE TABLE` query crée une nouvelle table réplicable sur le serveur où la requête est exécutée. Si cette table existe déjà sur d’autres serveurs, il ajoute une nouvelle réplique. +- Le `DROP TABLE` requête supprime la réplique situé sur le serveur où l’exécution de la requête. +- Le `RENAME` requête renomme la table sur l’une des répliques. En d’autres termes, les tables répliquées peuvent avoir des noms différents sur différentes répliques. + +Clickhouse utilise [Apache ZooKeeper](https://zookeeper.apache.org) pour stocker des informations méta répliques. Utilisez ZooKeeper version 3.4.5 ou plus récente. + +Pour utiliser la réplication, définissez les paramètres [zookeeper](../../../operations/server-configuration-parameters/settings.md#server-settings_zookeeper) section de configuration du serveur. + +!!! attention "Attention" + Ne négligez pas la sécurité. Clickhouse soutient le `digest` [Schéma ACL](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) du sous-système de sécurité ZooKeeper. + +Exemple de définition des adresses du cluster ZooKeeper: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +Vous pouvez spécifier N’importe quel cluster Zookeeper existant et le système utilisera un répertoire pour ses propres données (le répertoire est spécifié lors de la création d’une table réplicable). + +Si ZooKeeper n’est pas défini dans le fichier de configuration, vous ne pouvez pas créer de tables répliquées et toutes les tables répliquées existantes seront en lecture seule. + +La gardienne n’est pas utilisé dans `SELECT` requêtes car la réplication n’affecte pas les performances de `SELECT` et les requêtes s’exécutent aussi vite que pour les tables non répliquées. Lors de l’interrogation de tables répliquées distribuées, le comportement de ClickHouse est contrôlé par les paramètres [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) et [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). + +Pour chaque `INSERT` requête, environ dix entrées sont ajoutées à ZooKeeper par le biais de plusieurs transactions. (Pour être plus précis, c’est pour chaque bloc de données inséré; une requête D’insertion contient un bloc ou un bloc par `max_insert_block_size = 1048576` rangée.) Cela conduit à des latences légèrement plus longues pour `INSERT` par rapport aux tables non répliquées. Mais si vous suivez les recommandations pour insérer des données dans des lots de pas plus d’un `INSERT` par seconde, cela ne crée aucun problème. L’ensemble du cluster clickhouse utilisé pour coordonner un cluster ZooKeeper a un total de plusieurs centaines `INSERTs` par seconde. Le débit sur les insertions de données (le nombre de lignes par seconde) est aussi élevé que pour les non-données répliquées. + +Pour les clusters très volumineux, vous pouvez utiliser différents clusters ZooKeeper pour différents fragments. Cependant, cela ne s’est pas avéré nécessaire sur le Yandex.Cluster Metrica (environ 300 serveurs). + +La réplication est asynchrone et multi-maître. `INSERT` les requêtes (ainsi que `ALTER`) peuvent être envoyés à n’importe quel serveur disponible. Les données sont insérées sur le serveur où la requête est exécutée, puis il est copié sur les autres serveurs. Comme il est asynchrone, les données récemment insérées apparaissent sur les autres répliques avec une certaine latence. Si une partie des répliques ne sont pas disponibles, les données sont écrites lorsqu’elles sont disponibles. Si une réplique est disponible, la latence correspond au temps nécessaire pour transférer le bloc de données compressées sur le réseau. + +Par défaut, une requête INSERT attend la confirmation de l’écriture des données à partir d’un seul réplica. Si les données ont été correctement écrit sur une seule réplique et le serveur avec cette réplique cesse d’exister, les données enregistrées seront perdues. Pour activer la confirmation des Écritures de données à partir de plusieurs réplicas, utilisez `insert_quorum` option. + +Chaque bloc de données est écrit de manière atomique. La requête D’insertion est divisée en blocs jusqu’à `max_insert_block_size = 1048576` rangée. En d’autres termes, si l’ `INSERT` la requête a moins de 1048576 lignes, elle est faite de manière atomique. + +Les blocs de données sont dédupliquées. Pour plusieurs écritures du même bloc de données (blocs de données de même taille contenant les mêmes lignes dans le même ordre), le bloc n’est écrit qu’une seule fois. La raison en est en cas de défaillance du réseau lorsque l’application cliente ne sait pas si les données ont été écrites dans la base de données, de sorte que le `INSERT` requête peut simplement être répété. Peu importe à quelles insertions de réplica ont été envoyées avec des données identiques. `INSERTs` sont idempotents. Les paramètres de déduplication sont contrôlés par [merge\_tree](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-merge_tree) les paramètres du serveur. + +Pendant la réplication, seules les données source à insérer sont transférées sur le réseau. D’autres transformations de données (fusion) sont coordonnées et effectuées sur toutes les répliques de la même manière. Cela minimise l’utilisation du réseau, ce qui signifie que la réplication fonctionne bien lorsque les répliques résident dans différents centres de données. (Notez que la duplication de données dans différents centres de données est l’objectif principal de la réplication.) + +Vous pouvez avoir n’importe quel nombre de répliques des mêmes données. Yandex.Metrica utilise la double réplication en production. Chaque serveur utilise RAID-5 ou RAID-6, et RAID-10 dans certains cas. C’est une solution relativement fiable et pratique. + +Le système surveille la synchronicité des données sur les répliques et est capable de récupérer après une défaillance. Le basculement est automatique (pour les petites différences de données) ou semi-automatique (lorsque les données diffèrent trop, ce qui peut indiquer une erreur de configuration). + +## Création De Tables Répliquées {#creating-replicated-tables} + +Le `Replicated` le préfixe est ajouté au nom du moteur de table. Exemple:`ReplicatedMergeTree`. + +**Répliqué \* MergeTree paramètres** + +- `zoo_path` — The path to the table in ZooKeeper. +- `replica_name` — The replica name in ZooKeeper. + +Exemple: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +
+ +Exemple de syntaxe obsolète + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +
+ +Comme le montre l’exemple, ces paramètres peuvent contenir des substitutions entre crochets. Les valeurs substituées sont tirées de la ‘macros’ section du fichier de configuration. Exemple: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +Le chemin d’accès à la table dans ZooKeeper doit être unique pour chaque table répliquée. Les Tables sur différents fragments doivent avoir des chemins différents. +Dans ce cas, le chemin se compose des parties suivantes: + +`/clickhouse/tables/` est le préfixe commun. Nous vous recommandons d’utiliser exactement celui-ci. + +`{layer}-{shard}` est l’identificateur de fragment. Dans cet exemple, il se compose de deux parties, depuis l’Yandex.Le cluster Metrica utilise le sharding à deux niveaux. Pour la plupart des tâches, vous ne pouvez laisser que la substitution {shard}, qui sera étendue à l’Identificateur de partition. + +`table_name` est le nom du nœud de la table dans ZooKeeper. C’est une bonne idée de le rendre identique au nom de la table. Il est défini explicitement, car contrairement au nom de la table, il ne change pas après une requête de renommage. +*HINT*: vous pouvez ajouter un nom de base de données devant `table_name` Aussi. E. g. `db_name.table_name` + +Le nom du réplica identifie différentes réplicas de la même table. Vous pouvez utiliser le nom de serveur pour cela, comme dans l’exemple. Le nom doit seulement être unique dans chaque fragment. + +Vous pouvez définir les paramètres explicitement au lieu d’utiliser des substitutions. Cela peut être pratique pour tester et configurer de petits clusters. Cependant, vous ne pouvez pas utiliser de requêtes DDL distribuées (`ON CLUSTER`) dans ce cas. + +Lorsque vous travaillez avec de grands clusters, nous vous recommandons d’utiliser des substitutions car elles réduisent la probabilité d’erreur. + +Exécutez l’ `CREATE TABLE` requête sur chaque réplique. Cette requête crée une nouvelle table répliquée, ou ajoute une nouvelle réplique à un existant. + +Si vous ajoutez une nouvelle réplique après que la table contient déjà des données sur d’autres répliques, les données seront copiées des autres répliques vers la nouvelle après l’exécution de la requête. En d’autres termes, la nouvelle réplique synchronise avec les autres. + +Pour supprimer une réplique, exécutez `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. + +## Récupération Après Des Échecs {#recovery-after-failures} + +Si ZooKeeper n’est pas disponible au démarrage d’un serveur, les tables répliquées passent en mode Lecture seule. Le système tente périodiquement de se connecter à ZooKeeper. + +Si ZooKeeper est indisponible pendant un `INSERT`, ou une erreur se produit lors de l’interaction avec ZooKeeper, une exception est levée. + +Après la connexion à ZooKeeper, le système vérifie si l’ensemble de données du système de fichiers local correspond à l’ensemble de données attendu (ZooKeeper stocke ces informations). S’il y a des incohérences mineures, le système les résout en synchronisant les données avec les répliques. + +Si le système détecte des parties de données brisées (avec la mauvaise taille des fichiers) ou des parties non reconnues (parties écrites dans le système de fichiers mais non enregistrées dans ZooKeeper), il les déplace vers le `detached` sous-répertoire (ils ne sont pas supprimés). Toutes les pièces manquantes sont copiées à partir des répliques. + +Notez que ClickHouse n’effectue aucune action destructrice telle que la suppression automatique d’une grande quantité de données. + +Lorsque le serveur démarre (ou établit une nouvelle session avec ZooKeeper), il vérifie uniquement la quantité et la taille de tous les fichiers. Si les tailles de fichier correspondent mais que les octets ont été modifiés quelque part au milieu, cela n’est pas détecté immédiatement, mais uniquement lorsque vous tentez de lire les données `SELECT` requête. La requête lève une exception concernant une somme de contrôle ou une taille non correspondante d’un bloc compressé. Dans ce cas, des parties de données sont ajoutées à la file d’attente de vérification et copiées à partir des répliques si nécessaire. + +Si la série de données diffère trop de celle attendue, un mécanisme de sécurité est déclenché. Le serveur entre cela dans le journal et refuse de lancer. La raison en est que ce cas peut indiquer une erreur de configuration, par exemple si une réplique sur un fragment a été accidentellement configurée comme une réplique sur un fragment différent. Cependant, les seuils pour ce mécanisme sont fixés assez bas, et cette situation peut se produire pendant la récupération normale de la défaillance. Dans ce cas, les données sont restaurées semi-automatiquement - par “pushing a button”. + +Pour démarrer la récupération, créez le nœud `/path_to_table/replica_name/flags/force_restore_data` dans ZooKeeper avec n’importe quel contenu, ou exécutez la commande pour restaurer toutes les tables répliquées: + +``` bash +sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +Puis redémarrez le serveur. Au démarrage, le serveur supprime ces indicateurs et démarre la récupération. + +## Récupération Après La Perte De Données Complète {#recovery-after-complete-data-loss} + +Si toutes les données et métadonnées ont disparu de l’un des serveurs, procédez comme suit pour la récupération: + +1. Installez ClickHouse sur le serveur. Définissez correctement les substitutions dans le fichier de configuration qui contient l’Identificateur de fragment et les répliques, si vous les utilisez. +2. Si vous avez des tables non compliquées qui doivent être dupliquées manuellement sur les serveurs, copiez leurs données à partir d’un réplica (dans le répertoire `/var/lib/clickhouse/data/db_name/table_name/`). +3. Copier les définitions de table situées dans `/var/lib/clickhouse/metadata/` à partir d’une réplique. Si un identificateur de fragment ou de réplica est défini explicitement dans les définitions de table, corrigez-le de manière à ce qu’il corresponde à ce réplica. (Alternativement, démarrez le serveur et faites tous les `ATTACH TABLE` les requêtes qui auraient dû être dans les .les fichiers sql dans `/var/lib/clickhouse/metadata/`.) +4. Pour démarrer la récupération, créez le nœud ZooKeeper `/path_to_table/replica_name/flags/force_restore_data` tout contenu, ou d’exécuter la commande pour restaurer toutes les tables répliquées: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +Ensuite, démarrez le serveur (redémarrez, s’il est déjà en cours d’exécution). Les données seront téléchargées à partir de répliques. + +Une autre option de récupération consiste à supprimer des informations sur la réplique perdue de ZooKeeper (`/path_to_table/replica_name`), puis créez à nouveau la réplique comme décrit dans “[Création de tables répliquées](#creating-replicated-tables)”. + +Il n’y a aucune restriction sur la bande passante réseau pendant la récupération. Gardez cela à l’esprit si vous restaurez de nombreuses répliques à la fois. + +## Conversion De Mergetree En Replicatedmergetree {#converting-from-mergetree-to-replicatedmergetree} + +Nous utilisons le terme `MergeTree` pour consulter tous les moteurs de la `MergeTree family` le même que pour `ReplicatedMergeTree`. + +Si vous avez eu une `MergeTree` table qui a été répliquée manuellement, vous pouvez le convertir en une table répliquée. Vous devrez peut-être le faire si vous avez déjà recueilli une grande quantité de données dans un `MergeTree` table et maintenant vous voulez activer la réplication. + +Si les données diffèrent sur différentes répliques, synchronisez-les d’abord ou supprimez-les sur toutes les répliques sauf une. + +Renommez la table mergetree existante, puis créez un `ReplicatedMergeTree` table avec l’ancien nom. +Déplacez les données de l’ancienne table vers `detached` sous-répertoire à l’intérieur du répertoire avec les nouvelles données de la table (`/var/lib/clickhouse/data/db_name/table_name/`). +Ensuite, exécutez `ALTER TABLE ATTACH PARTITION` sur l’une des répliques d’ajouter ces données à des parties de l’ensemble de travail. + +## Conversion De Replicatedmergetree En Mergetree {#converting-from-replicatedmergetree-to-mergetree} + +Créez une table MergeTree avec un nom différent. Déplacez toutes les données du répertoire avec le `ReplicatedMergeTree` données de la table dans le répertoire de données de la nouvelle table. Ensuite, supprimer le `ReplicatedMergeTree` table et redémarrez le serveur. + +Si vous voulez vous débarrasser d’un `ReplicatedMergeTree` table sans lancer le serveur: + +- Supprimer la `.sql` fichier dans le répertoire de métadonnées (`/var/lib/clickhouse/metadata/`). +- Supprimer le chemin correspondant dans ZooKeeper (`/path_to_table/replica_name`). + +Après cela, vous pouvez lancer le serveur, créer un `MergeTree` tableau, déplacer les données de son répertoire, puis redémarrez le serveur. + +## Récupération Lorsque Les métadonnées Du Cluster Zookeeper Sont Perdues Ou endommagées {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} + +Si les données de ZooKeeper ont été perdues ou endommagées, vous pouvez les enregistrer en les déplaçant dans une table non compliquée comme décrit ci-dessus. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/fr/engines/table-engines/mergetree-family/summingmergetree.md b/docs/fr/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..6be54f6dbef --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,141 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 34 +toc_title: SummingMergeTree +--- + +# Summingmergetree {#summingmergetree} + +Le moteur hérite de [MergeTree](mergetree.md#table_engines-mergetree). La différence est que lors de la fusion de parties de données pour `SummingMergeTree` tables ClickHouse remplace toutes les lignes avec la même clé primaire (ou, plus précisément, avec la même [clé de tri](mergetree.md)) avec une ligne qui contient des valeurs résumées pour les colonnes avec le type de données numériques. Si la clé de tri est composée de telle sorte qu’une seule valeur de clé correspond à un grand nombre de lignes, cela réduit considérablement le volume de stockage et accélère la sélection des données. + +Nous vous recommandons d’utiliser le moteur avec `MergeTree`. Stocker des données complètes dans `MergeTree` table, et l’utilisation `SummingMergeTree` pour le stockage de données agrégées, par exemple, lors de la préparation de rapports. Une telle approche vous empêchera de perdre des données précieuses en raison d’une clé primaire mal composée. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = SummingMergeTree([columns]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Pour une description des paramètres de requête, voir [demande de description](../../../sql-reference/statements/create.md). + +**Paramètres de SummingMergeTree** + +- `columns` - un n-uplet avec les noms de colonnes où les valeurs seront résumées. Paramètre facultatif. + Les colonnes doivent être d’un type numérique et ne doit pas être dans la clé primaire. + + Si `columns` non spécifié, ClickHouse résume les valeurs dans toutes les colonnes avec un type de données numérique qui ne sont pas dans la clé primaire. + +**Les clauses de requête** + +Lors de la création d’un `SummingMergeTree` la table de la même [clause](mergetree.md) sont nécessaires, comme lors de la création d’un `MergeTree` table. + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) +``` + +Tous les paramètres excepté `columns` ont la même signification que dans `MergeTree`. + +- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. + +
+ +## Exemple D’Utilisation {#usage-example} + +Considérons le tableau suivant: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +Insérer des données: + +``` sql +INSERT INTO summtt Values(1,1),(1,2),(2,1) +``` + +ClickHouse peut résumer toutes les lignes pas complètement ([voir ci-dessous](#data-processing)), nous utilisons donc une fonction d’agrégation `sum` et `GROUP BY` la clause dans la requête. + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + +``` text +┌─key─┬─sum(value)─┐ +│ 2 │ 1 │ +│ 1 │ 3 │ +└─────┴────────────┘ +``` + +## Le Traitement Des Données {#data-processing} + +Lorsque les données sont insérées dans une table, elles sont enregistrées telles quelles. Clickhouse fusionne périodiquement les parties de données insérées et c’est à ce moment que les lignes avec la même clé primaire sont additionnées et remplacées par une pour chaque partie de données résultante. + +ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) une fonction d’agrégation [somme()](../../../sql-reference/aggregate-functions/reference.md#agg_function-sum) et `GROUP BY` la clause doit être utilisé dans une requête comme décrit dans l’exemple ci-dessus. + +### Règles Communes Pour La Sommation {#common-rules-for-summation} + +Les valeurs dans les colonnes avec le type de données numériques sont résumées. L’ensemble des colonnes est défini par le paramètre `columns`. + +Si les valeurs étaient 0 dans toutes les colonnes pour la sommation, la ligne est supprimée. + +Si la colonne n’est pas dans la clé primaire et n’est pas résumée, une valeur arbitraire est sélectionnée parmi celles existantes. + +Les valeurs ne sont pas résumés des colonnes de la clé primaire. + +### La Somme Dans Les Colonnes Aggregatefunction {#the-summation-in-the-aggregatefunction-columns} + +Pour les colonnes de [Type AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md) ClickHouse se comporte comme [AggregatingMergeTree](aggregatingmergetree.md) moteur d’agrégation selon la fonction. + +### Structures Imbriquées {#nested-structures} + +Table peut avoir des structures de données imbriquées qui sont traitées d’une manière spéciale. + +Si le nom d’une table imbriquée se termine avec `Map` et il contient au moins deux colonnes qui répondent aux critères suivants: + +- la première colonne est numérique `(*Int*, Date, DateTime)` ou une chaîne de caractères `(String, FixedString)`, nous allons l’appeler `key`, +- les autres colonnes sont arithmétique `(*Int*, Float32/64)`, nous allons l’appeler `(values...)`, + +ensuite, cette table imbriquée est interprétée comme un mappage de `key => (values...)` et lors de la fusion de ses lignes, les éléments de deux ensembles de données sont regroupées par `key` avec une sommation du correspondant `(values...)`. + +Exemple: + +``` text +[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] +[(1, 100)] + [(1, 150)] -> [(1, 250)] +[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] +[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] +``` + +Lorsque vous demandez des données, utilisez [sumMap (clé, valeur)](../../../sql-reference/aggregate-functions/reference.md) fonction pour l’agrégation de `Map`. + +Pour la structure de données imbriquée, vous n’avez pas besoin de spécifier ses colonnes dans le tuple de colonnes pour la sommation. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/fr/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/fr/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..4238ce9b371 --- /dev/null +++ b/docs/fr/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,238 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 37 +toc_title: VersionedCollapsingMergeTree +--- + +# Versionedcollapsingmergetree {#versionedcollapsingmergetree} + +Ce moteur: + +- Permet l’écriture rapide des États d’objet qui changent continuellement. +- Supprime les anciens États d’objets en arrière-plan. Cela réduit considérablement le volume de stockage. + +Voir la section [Effondrer](#table_engines_versionedcollapsingmergetree) pour plus de détails. + +Le moteur hérite de [MergeTree](mergetree.md#table_engines-mergetree) et ajoute la logique de réduction des lignes à l’algorithme de fusion des parties de données. `VersionedCollapsingMergeTree` sert le même but que [CollapsingMergeTree](collapsingmergetree.md) mais utilise un autre effondrement algorithme qui permet d’insérer les données dans n’importe quel ordre avec plusieurs threads. En particulier, l’ `Version` la colonne aide à réduire correctement les lignes même si elles sont insérées dans le mauvais ordre. Contrairement, `CollapsingMergeTree` permet uniquement une insertion strictement consécutive. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Pour une description des paramètres de requête, voir les [description de la requête](../../../sql-reference/statements/create.md). + +**Les Paramètres Du Moteur** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Name of the column with the type of row: `1` est un “state” rangée, `-1` est un “cancel” rangée. + + Le type de données de colonne doit être `Int8`. + +- `version` — Name of the column with the version of the object state. + + Le type de données de colonne doit être `UInt*`. + +**Les Clauses De Requête** + +Lors de la création d’un `VersionedCollapsingMergeTree` de table, de la même [clause](mergetree.md) sont requis lors de la création d’un `MergeTree` table. + +
+ +Méthode obsolète pour créer une Table + +!!! attention "Attention" + N’utilisez pas cette méthode dans les nouveaux projets. Si possible, passer les anciens projets à la méthode décrite ci-dessus. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +Tous les paramètres, à l’exception `sign` et `version` ont la même signification que dans `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` est un “state” rangée, `-1` est un “cancel” rangée. + + Column Data Type — `Int8`. + +- `version` — Name of the column with the version of the object state. + + Le type de données de colonne doit être `UInt*`. + +
+ +## Effondrer {#table_engines-versionedcollapsingmergetree} + +### Données {#data} + +Considérez une situation où vous devez enregistrer des données en constante évolution pour un objet. Il est raisonnable d’avoir une ligne pour un objet et de mettre à jour la ligne chaque fois qu’il y a des modifications. Cependant, l’opération de mise à jour est coûteuse et lente pour un SGBD car elle nécessite la réécriture des données dans le stockage. La mise à jour n’est pas acceptable si vous devez écrire des données rapidement, mais vous pouvez écrire les modifications sur un objet de manière séquentielle comme suit. + +L’utilisation de la `Sign` colonne lors de l’écriture de la ligne. Si `Sign = 1` cela signifie que la ligne est un état d’un objet (appelons-la “state” rangée). Si `Sign = -1` il indique l’annulation de l’état d’un objet avec les mêmes attributs (appelons-la “cancel” rangée). Également utiliser l’ `Version` colonne, qui doit identifier chaque état d’un objet avec un numéro distinct. + +Par exemple, nous voulons calculer le nombre de pages visitées sur le site et combien de temps ils étaient là. À un moment donné nous écrivons la ligne suivante avec l’état de l’activité de l’utilisateur: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +À un moment donné, nous enregistrons le changement d’activité de l’utilisateur et l’écrivons avec les deux lignes suivantes. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +La première ligne annule le précédent état de l’objet (utilisateur). Il doit copier tous les champs de l’état annulé sauf `Sign`. + +La deuxième ligne contient l’état actuel. + +Parce que nous avons besoin seulement le dernier état de l’activité de l’utilisateur, les lignes + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +peut être supprimé, réduisant l’état invalide (ancien) de l’objet. `VersionedCollapsingMergeTree` fait cela lors de la fusion des parties de données. + +Pour savoir pourquoi nous avons besoin de deux lignes pour chaque changement, voir [Algorithme](#table_engines-versionedcollapsingmergetree-algorithm). + +**Notes sur l’Utilisation de la** + +1. Le programme qui écrit les données devraient se souvenir de l’état d’un objet afin de l’annuler. Le “cancel” chaîne doit être une copie de la “state” chaîne avec le contraire `Sign`. Cela augmente la taille initiale de stockage, mais permet d’écrire les données rapidement. +2. Les tableaux de plus en plus longs dans les colonnes réduisent l’efficacité du moteur en raison de la charge d’écriture. Plus les données sont simples, meilleure est l’efficacité. +3. `SELECT` les résultats dépendent fortement de la cohérence de l’histoire de l’objet change. Être précis lors de la préparation des données pour l’insertion. Vous pouvez obtenir des résultats imprévisibles avec des données incohérentes, telles que des valeurs négatives pour des métriques non négatives telles que la profondeur de session. + +### Algorithme {#table_engines-versionedcollapsingmergetree-algorithm} + +Lorsque ClickHouse fusionne des parties de données, il supprime chaque paire de lignes ayant la même clé primaire et la même version et différentes `Sign`. L’ordre des lignes n’a pas d’importance. + +Lorsque ClickHouse insère des données, il ordonne les lignes par la clé primaire. Si l’ `Version` la colonne n’est pas dans la clé primaire, ClickHouse ajoute à la clé primaire implicitement que le dernier champ et l’utilise pour la commande. + +## La Sélection De Données {#selecting-data} + +ClickHouse ne garantit pas que toutes les lignes avec la même clé primaire sera dans la même partie des données ou même sur le même serveur physique. Cela est vrai à la fois pour l’écriture des données et pour la fusion ultérieure des parties de données. En outre, les processus ClickHouse `SELECT` requêtes avec plusieurs threads, et il ne peut pas prédire l’ordre des lignes dans le résultat. Cela signifie que le regroupement est nécessaire s’il est nécessaire pour obtenir complètement “collapsed” données à partir d’un `VersionedCollapsingMergeTree` table. + +Pour finaliser la réduction, écrivez une requête avec un `GROUP BY` fonctions de clause et d’agrégation qui tiennent compte du signe. Par exemple, pour calculer la quantité, l’utilisation `sum(Sign)` plutôt `count()`. Pour calculer la somme de quelque chose, utilisez `sum(Sign * x)` plutôt `sum(x)` et d’ajouter `HAVING sum(Sign) > 0`. + +Aggregate `count`, `sum` et `avg` peut être calculée de cette manière. Aggregate `uniq` peut être calculé si un objet a au moins un non-état effondré. Aggregate `min` et `max` ne peut pas être calculé, car `VersionedCollapsingMergeTree` ne sauvegarde pas l’historique des valeurs des États réduits. + +Si vous avez besoin d’extraire les données avec “collapsing” mais sans agrégation (par exemple, pour vérifier si des lignes sont présentes dont les valeurs les plus récentes correspondent à certaines conditions), vous pouvez utiliser `FINAL` le modificateur du `FROM` clause. Cette approche est inefficace et ne devrait pas être utilisée avec de grandes tables. + +## Exemple D’Utilisation {#example-of-use} + +Les données de l’exemple: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Création de la table: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +Insérer les données: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +Nous utilisons deux `INSERT` requêtes pour créer deux parties de données différentes. Si nous insérons les données avec une seule requête, ClickHouse crée une partie de données et n’effectuera jamais de fusion. + +L’obtention de données: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Que voyons-nous ici et où sont les parties effondrées? +Nous avons créé deux parties de données en utilisant deux `INSERT` requête. Le `SELECT` la requête a été effectuée dans deux threads, et le résultat est un ordre aléatoire de lignes. +L’effondrement n’a pas eu lieu car les parties de données n’ont pas encore été fusionnées. ClickHouse fusionne des parties de données à un moment inconnu que nous ne pouvons pas prédire. + +C’est pourquoi nous avons besoin de l’agrégation: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +Si nous n’avons pas besoin d’agrégation et que nous voulons forcer l’effondrement, nous pouvons utiliser le `FINAL` le modificateur du `FROM` clause. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +C’est un moyen très inefficace de sélectionner des données. Ne l’utilisez pas pour les grandes tables. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/fr/engines/table-engines/special/buffer.md b/docs/fr/engines/table-engines/special/buffer.md new file mode 100644 index 00000000000..085e82a95e4 --- /dev/null +++ b/docs/fr/engines/table-engines/special/buffer.md @@ -0,0 +1,71 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 45 +toc_title: Tampon +--- + +# Tampon {#buffer} + +Met en mémoire tampon les données à écrire dans la RAM, les vidant périodiquement dans une autre table. Pendant l’opération de lecture, les données sont lues à partir de la mémoire tampon, et l’autre simultanément. + +``` sql +Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) +``` + +Les paramètres du moteur: + +- `database` – Database name. Instead of the database name, you can use a constant expression that returns a string. +- `table` – Table to flush data to. +- `num_layers` – Parallelism layer. Physically, the table will be represented as `num_layers` indépendant de tampons. Valeur recommandée: 16. +- `min_time`, `max_time`, `min_rows`, `max_rows`, `min_bytes`, et `max_bytes` – Conditions for flushing data from the buffer. + +Les données sont vidées du tampon et écrites dans la table de destination si toutes les `min*` conditions ou au moins un `max*` conditions sont remplies. + +- `min_time`, `max_time` – Condition for the time in seconds from the moment of the first write to the buffer. +- `min_rows`, `max_rows` – Condition for the number of rows in the buffer. +- `min_bytes`, `max_bytes` – Condition for the number of bytes in the buffer. + +Pendant l’opération d’écriture, les données sont insérées dans un `num_layers` nombre aléatoire de tampons. Ou, si la partie de données à insérer est suffisamment grande (supérieure à `max_rows` ou `max_bytes`), il est écrit directement dans la table de destination, en omettant le tampon. + +Les conditions de purger les données sont calculées séparément pour chacun des `num_layers` tampon. Par exemple, si `num_layers = 16` et `max_bytes = 100000000`, la consommation maximale de RAM est de 1,6 Go. + +Exemple: + +``` sql +CREATE TABLE merge.hits_buffer AS merge.hits ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000) +``` + +La création d’un ‘merge.hits\_buffer’ table avec la même structure que ‘merge.hits’ et en utilisant le moteur tampon. Lors de l’écriture dans cette table, les données sont mises en mémoire tampon dans la RAM ‘merge.hits’ table. 16 tampons sont créés. Les données dans chacun d’entre eux est rincé si 100 secondes sont écoulées, ou un million de lignes ont été écrites, ou 100 MO de données ont été écrits; ou si, simultanément, 10 secondes et 10 000 lignes et 10 MO de données ont été écrites. Par exemple, si une ligne a été écrite, après 100 secondes, il sera vidé, n’importe quoi. Mais si plusieurs lignes ont été écrites, les données seront vidées plus tôt. + +Lorsque le serveur est arrêté, avec DROP TABLE ou DETACH TABLE, les données du tampon sont également vidées vers la table de destination. + +Vous pouvez définir des chaînes vides entre guillemets simples pour le nom de la base de données et de la table. Cela indique l’absence d’une table de destination. Dans ce cas, lorsque les conditions de vidage des données sont atteintes, le tampon est simplement effacé. Cela peut être utile pour garder une fenêtre de données dans la mémoire. + +Lors de la lecture à partir d’une table tampon, les données sont traitées à la fois à partir du tampon et de la table de destination (s’il y en a une). +Notez que les tables de tampon ne prennent pas en charge un index. En d’autres termes, les données dans le tampon sont entièrement analysées, ce qui peut être lent pour les grands tampons. (Pour les données dans une table subordonnée, l’index qu’il prend en charge sera utilisé.) + +Si l’ensemble de colonnes de la table tampon ne correspond pas à l’ensemble de colonnes d’une table subordonnée, un sous-ensemble de colonnes existant dans les deux tables est inséré. + +Si les types ne correspondent pas à l’une des colonnes de la table tampon et à une table subordonnée, un message d’erreur est entré dans le journal du serveur et le tampon est effacé. +La même chose se produit si la table subordonnée n’existe pas lorsque le tampon est vidé. + +Si vous devez exécuter ALTER pour une table subordonnée et la table tampon, nous vous recommandons de supprimer d’abord la table tampon, d’exécuter ALTER pour la table subordonnée, puis de créer à nouveau la table tampon. + +Si le serveur est redémarré anormalement, les données dans le tampon sont perdues. + +FINAL et SAMPLE ne fonctionnent pas correctement pour les tables tampon. Ces conditions sont transmises à la table de destination, mais ne sont pas utilisées pour traiter les données dans le tampon. Si ces fonctionnalités sont nécessaires, nous vous recommandons d’utiliser uniquement la table tampon pour l’écriture, lors de la lecture à partir de la table de destination. + +Lors de l’ajout de données à un Tampon, un des tampons est verrouillé. Cela entraîne des retards si une opération de lecture est effectuée simultanément à partir de la table. + +Les données insérées dans une table tampon peuvent se retrouver dans la table subordonnée dans un ordre différent et dans des blocs différents. Pour cette raison, une table tampon est difficile à utiliser pour écrire correctement dans un CollapsingMergeTree. Pour éviter les problèmes, vous pouvez définir ‘num\_layers’ 1. + +Si la table de destination est répliquée, certaines caractéristiques attendues des tables répliquées sont perdues lors de l’écriture dans une table tampon. Les modifications aléatoires apportées à l’ordre des lignes et des tailles des parties de données provoquent l’arrêt de la déduplication des données, ce qui signifie qu’il n’est pas possible d’avoir un ‘exactly once’ Ecrire dans des tables répliquées. + +En raison de ces inconvénients, nous ne pouvons recommander l’utilisation d’une table tampon que dans de rares cas. + +Une table tampon est utilisée lorsque trop D’insertions sont reçues d’un grand nombre de serveurs sur une unité de temps et que les données ne peuvent pas être mises en mémoire tampon avant l’insertion, ce qui signifie que les insertions ne peuvent pas s’exécuter assez rapidement. + +Notez qu’il n’est pas judicieux d’insérer des données d’une ligne de temps, même pour Tampon tables. Cela ne produira qu’une vitesse de quelques milliers de lignes par seconde, tandis que l’insertion de blocs de données plus grands peut produire plus d’un million de lignes par seconde (voir la section “Performance”). + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/buffer/) diff --git a/docs/fr/engines/table-engines/special/dictionary.md b/docs/fr/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..a3db44b2064 --- /dev/null +++ b/docs/fr/engines/table-engines/special/dictionary.md @@ -0,0 +1,97 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 35 +toc_title: Dictionnaire +--- + +# Dictionnaire {#dictionary} + +Le `Dictionary` le moteur affiche le [dictionnaire](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) données comme une table ClickHouse. + +À titre d’exemple, considérons un dictionnaire de `products` avec la configuration suivante: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +Interroger les données du dictionnaire: + +``` sql +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + +``` text +┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ +│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ +└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ +``` + +Vous pouvez utiliser l’ [dictGet\*](../../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions) fonction pour obtenir les données du dictionnaire dans ce format. + +Cette vue n’est pas utile lorsque vous avez besoin d’obtenir des données brutes ou `JOIN` opération. Pour ces cas, vous pouvez utiliser le `Dictionary` moteur, qui affiche les données du dictionnaire dans une table. + +Syntaxe: + +``` sql +CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` +``` + +Exemple d’utilisation: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); +``` + + Ok + +Jetez un oeil à ce qui est dans le tableau. + +``` sql +select * from products limit 1; +``` + +``` text +┌────product_id─┬─title───────────┐ +│ 152689 │ Some item │ +└───────────────┴─────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/fr/engines/table-engines/special/distributed.md b/docs/fr/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..17712c754bf --- /dev/null +++ b/docs/fr/engines/table-engines/special/distributed.md @@ -0,0 +1,152 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 33 +toc_title: "Distribu\xE9" +--- + +# Distribué {#distributed} + +**Les Tables avec moteur distribué ne stockent aucune donnée par elles mêmes**, mais autoriser le traitement des requêtes distribuées sur plusieurs serveurs. +La lecture est automatiquement parallélisée. Lors d’une lecture, les index de table sur les serveurs distants sont utilisés, s’il y en a. + +Le moteur distribué accepte les paramètres: + +- le nom du cluster dans le fichier de configuration du serveur + +- le nom d’une base de données distante + +- le nom d’une table distante + +- (en option) sharding clé + +- (éventuellement) nom de la stratégie, il sera utilisé pour stocker des fichiers temporaires pour l’envoi asynchrone + + Voir aussi: + + - `insert_distributed_sync` paramètre + - [MergeTree](../mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) pour les exemples + +Exemple: + +``` sql +Distributed(logs, default, hits[, sharding_key[, policy_name]]) +``` + +Les données seront lues à partir de tous les serveurs ‘logs’ cluster, à partir de la valeur par défaut.hits table située sur chaque serveur du cluster. +Les données ne sont pas seulement lues mais sont partiellement traitées sur les serveurs distants (dans la mesure du possible). +Par exemple, pour une requête avec GROUP BY, les données seront agrégées sur des serveurs distants et les états intermédiaires des fonctions d’agrégation seront envoyés au serveur demandeur. Ensuite, les données seront plus agrégées. + +Au lieu du nom de la base de données, vous pouvez utiliser une expression constante qui renvoie une chaîne. Par exemple: currentDatabase(). + +logs – The cluster name in the server’s config file. + +Les Clusters sont définis comme ceci: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 1 + 9440 + + + + +``` + +Ici un cluster est défini avec le nom ‘logs’ qui se compose de deux fragments, dont chacune contient deux répliques. +Les partitions se réfèrent aux serveurs qui contiennent différentes parties des données (pour lire toutes les données, vous devez accéder à tous les partitions). +Les répliques sont des serveurs de duplication (afin de lire toutes les données, vous pouvez accéder aux données sur l’une des répliques). + +Les noms de Cluster ne doivent pas contenir de points. + +Paramètre `host`, `port` et , éventuellement, `user`, `password`, `secure`, `compression` sont spécifiés pour chaque serveur: +- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn’t start. If you change the DNS record, restart the server. +- `port` – The TCP port for messenger activity (‘tcp\_port’ dans la configuration, généralement définie sur 9000). Ne le confondez pas avec http\_port. +- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Les droits d’accès](../../../operations/access-rights.md). +- `password` – The password for connecting to a remote server (not masked). Default value: empty string. +- `secure` - Utilisez ssl pour la connexion, généralement vous devez également définir `port` = 9440. Le serveur doit écouter 9440 et avoir des certificats corrects. +- `compression` - Utiliser la compression de données. Valeur par défaut: true. + +When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [équilibrage](../../../operations/settings/settings.md#settings-load_balancing) paramètre. +Si la connexion avec le serveur n’est pas établie, il y aura une tentative de connexion avec un court délai. Si la connexion échoue, la réplique suivante sera sélectionnée, et ainsi de suite pour toutes les répliques. Si la tentative de connexion a échoué pour toutes les répliques, la tentative sera répété de la même façon, plusieurs fois. +Cela fonctionne en faveur de la résilience, mais ne fournit pas de tolérance aux pannes complète: un serveur distant peut accepter la connexion, mais peut ne pas fonctionner ou fonctionner mal. + +Vous pouvez spécifier un seul des fragments (dans ce cas, le traitement de la requête doit être appelé distant, plutôt que distribué) ou jusqu’à un nombre quelconque de fragments. Dans chaque fragment, vous pouvez spécifier un nombre de répliques. Vous pouvez spécifier un nombre différent de répliques pour chaque fragment. + +Vous pouvez spécifier autant de clusters que vous souhaitez dans la configuration. + +Pour afficher vos clusters, utilisez ‘system.clusters’ table. + +Le moteur distribué permet de travailler avec un cluster comme un serveur local. Cependant, le cluster est inextensible: vous devez écrire sa configuration dans le fichier de configuration du serveur (encore mieux, pour tous les serveurs du cluster). + +The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don’t need to create a Distributed table – use the ‘remote’ fonction de table à la place. Voir la section [Les fonctions de Table](../../../sql-reference/table-functions/index.md). + +Il existe deux méthodes pour écrire des données dans un cluster: + +Tout d’abord, vous pouvez définir les serveurs d’écrire les données à et effectuer l’écriture directement sur chaque fragment. En d’autres termes, effectuez INSERT dans les tables que la table distribuée “looks at”. C’est la solution la plus flexible car vous pouvez utiliser n’importe quel schéma de sharding, qui pourrait être non trivial en raison des exigences du sujet. C’est également la solution la plus optimale puisque les données peuvent être écrites sur différents fragments de manière complètement indépendante. + +Deuxièmement, vous pouvez effectuer INSERT dans une table distribuée. Dans ce cas, la table distribuera les données insérées sur les serveurs eux-mêmes. Pour écrire dans une table distribuée, elle doit avoir un jeu de clés de sharding (le dernier paramètre). De plus, s’il n’y a qu’un seul fragment, l’opération d’écriture fonctionne sans spécifier la clé de sharding, car cela ne signifie rien dans ce cas. + +Chaque fragment peut avoir un poids défini dans le fichier de configuration. Par défaut, le poids est égal à un. Les données sont réparties entre les fragments dans la quantité proportionnelle au poids des fragments. Par exemple, si il y a deux tessons et le premier a un poids de 9 tandis que la seconde a un poids de 10, le premier sera envoyé 9 / 19 parties de lignes, et le second sera envoyé 10 / 19. + +Chaque fragment peut avoir le ‘internal\_replication’ paramètre défini dans le fichier de configuration. + +Si ce paramètre est défini à ‘true’, l’opération d’écriture sélectionne le premier saine réplique et écrit les données. Utilisez cette option si le tableau Distribué “looks at” tables répliquées. En d’autres termes, si la table où les données seront écrites va répliquer elle-même. + +Si elle est définie sur ‘false’ (par défaut), les données sont écrites dans toutes les répliques. En substance, cela signifie que la table distribuée réplique les données elle-même. C’est pire que d’utiliser des tables répliquées, car la cohérence des répliques n’est pas vérifiée et, au fil du temps, elles contiendront des données légèrement différentes. + +Pour sélectionner le fragment auquel une ligne de données est envoyée, l’expression de sharding est analysée et son reste est extrait de la diviser par le poids total des fragments. La ligne est envoyée au fragment qui correspond au demi-intervalle des restes de ‘prev\_weight’ de ‘prev\_weights + weight’, où ‘prev\_weights’ c’est le poids total des tessons avec le plus petit nombre, et ‘weight’ est le poids de cet éclat. Par exemple, s’il y a deux fragments, et que le premier a un poids de 9 tandis que le second a un poids de 10, la ligne sera envoyée au premier fragment pour les restes de la plage \[0, 9), et au second pour les restes de la plage \[9, 19). + +L’expression de sharding peut être n’importe quelle expression de constantes et de colonnes de table qui renvoie un entier. Par exemple, vous pouvez utiliser l’expression ‘rand()’ pour la distribution aléatoire des données, ou ‘UserID’ pour la distribution par le reste de la division de L’ID de l’utilisateur (alors les données d’un seul utilisateur résideront sur un seul fragment, ce qui simplifie l’exécution et la jointure par les utilisateurs). Si l’une des colonnes n’est pas assez répartie uniformément, vous pouvez l’envelopper dans une fonction de hachage: intHash64 (UserID). + +Un simple rappel de la division est une solution limitée pour le sharding et n’est pas toujours approprié. Cela fonctionne pour des volumes de données moyens et importants (des dizaines de serveurs), mais pas pour des volumes de données très importants (des centaines de serveurs ou plus). Dans ce dernier cas, utilisez le schéma de répartition requis par le domaine, plutôt que d’utiliser des entrées dans des tableaux distribués. + +SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don’t have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. + +Vous devriez être préoccupé par le système de sharding dans les cas suivants: + +- Les requêtes sont utilisées qui nécessitent des données de jointure (IN ou JOIN) par une clé spécifique. Si les données sont partagées par cette clé, vous pouvez utiliser local in ou JOIN au lieu de GLOBAL IN ou global JOIN, ce qui est beaucoup plus efficace. +- Un grand nombre de serveurs est utilisé (des centaines ou plus) avec un grand nombre de petites requêtes (requêtes de clients individuels - sites Web, annonceurs ou partenaires). Pour que les petites requêtes n’affectent pas l’ensemble du cluster, il est logique de localiser les données d’un seul client sur un seul fragment. Alternativement, comme nous l’avons fait dans Yandex.Metrica, vous pouvez configurer le sharding à deux niveaux: divisez le cluster entier en “layers”, où une couche peut être constituée de plusieurs éclats. Les données d’un seul client sont situées sur une seule couche, mais des fragments peuvent être ajoutés à une couche si nécessaire, et les données sont distribuées aléatoirement à l’intérieur de celles-ci. Des tables distribuées sont créées pour chaque couche et une seule table distribuée partagée est créée pour les requêtes globales. + +Les données sont écrites de manière asynchrone. Lorsqu’il est inséré dans la table, le bloc de données est simplement écrit dans le système de fichiers local. Les données sont envoyées aux serveurs distants en arrière-plan dès que possible. La période d’envoi des données est gérée par [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) et [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) paramètre. Le `Distributed` moteur envoie chaque fichier de données insérées séparément, mais vous pouvez activer le lot envoi de fichiers avec l’ [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) paramètre. Ce paramètre améliore les performances du cluster en utilisant mieux les ressources réseau et serveur local. Vous devriez vérifier si les données sont envoyées avec succès en vérifiant la liste des fichiers (données en attente d’envoi) dans le répertoire de la table: `/var/lib/clickhouse/data/database/table/`. + +Si le serveur a cessé d’exister ou a subi un redémarrage Brutal (par exemple, après une panne de périphérique) après une insertion dans une table distribuée, les données insérées peuvent être perdues. Si une partie de données endommagée est détectée dans le répertoire de la table, elle est transférée ‘broken’ sous-répertoire et n’est plus utilisé. + +Lorsque l’option max\_parallel\_replicas est activée, le traitement des requêtes est parallélisé entre toutes les répliques d’un seul fragment. Pour plus d’informations, consultez la section [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). + +## Les Colonnes Virtuelles {#virtual-columns} + +- `_shard_num` — Contains the `shard_num` (de `system.clusters`). Type: [UInt32](../../../sql-reference/data-types/int-uint.md). + +!!! note "Note" + Depuis [`remote`](../../../sql-reference/table-functions/remote.md)/`cluster` les fonctions de table créent en interne une instance temporaire du même moteur distribué, `_shard_num` est disponible là-bas aussi. + +**Voir Aussi** + +- [Les colonnes virtuelles](../index.md#table_engines-virtual_columns) + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/fr/engines/table-engines/special/external-data.md b/docs/fr/engines/table-engines/special/external-data.md new file mode 100644 index 00000000000..58946f2bc5f --- /dev/null +++ b/docs/fr/engines/table-engines/special/external-data.md @@ -0,0 +1,68 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 34 +toc_title: "De donn\xE9es externes" +--- + +# Données Externes Pour Le Traitement Des requêtes {#external-data-for-query-processing} + +ClickHouse permet d’Envoyer à un serveur les données nécessaires au traitement d’une requête, ainsi qu’une requête SELECT. Ces données sont placées dans une table temporaire (voir la section “Temporary tables”) et peut être utilisé dans la requête (par exemple, dans les DANS les opérateurs). + +Par exemple, si vous disposez d’un fichier texte avec important des identifiants d’utilisateur, vous pouvez le télécharger sur le serveur avec une requête qui utilise la filtration par cette liste. + +Si vous devez exécuter plusieurs requêtes avec un volume important de données externes, n’utilisez pas cette fonctionnalité. Il est préférable de télécharger les données sur la base de données à l’avance. + +Les données externes peuvent être téléchargées à l’aide du client de ligne de commande (en mode non interactif) ou à l’aide de L’interface HTTP. + +Dans le client de ligne de commande, vous pouvez spécifier une section paramètres du format + +``` bash +--external --file=... [--name=...] [--format=...] [--types=...|--structure=...] +``` + +Vous pouvez avoir plusieurs sections comme ça, pour le nombre de tables étant transmis. + +**–external** – Marks the beginning of a clause. +**–file** – Path to the file with the table dump, or -, which refers to stdin. +Une seule table peut être récupérée à partir de stdin. + +Les paramètres suivants sont facultatifs: **–name**– Name of the table. If omitted, \_data is used. +**–format** – Data format in the file. If omitted, TabSeparated is used. + +L’un des paramètres suivants est requis:**–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`. Définit les noms et les types de colonnes. + +Les fichiers spécifiés dans ‘file’ sera analysé par le format spécifié dans ‘format’, en utilisant les types de données spécifié dans ‘types’ ou ‘structure’. La table sera téléchargée sur le serveur et accessible en tant que table temporaire avec le nom dans ‘name’. + +Exemple: + +``` bash +$ echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 +849897 +$ cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +Lors de l’utilisation de L’interface HTTP, les données externes sont transmises au format multipart/form-data. Chaque tableau est transmis en tant que fichier séparé. Le nom de la table est tiré du nom du fichier. Le ‘query\_string’ est passé les paramètres ‘name\_format’, ‘name\_types’, et ‘name\_structure’, où ‘name’ est le nom de la table que ces paramètres correspondent. La signification des paramètres est la même que lors de l’utilisation du client de ligne de commande. + +Exemple: + +``` bash +$ cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv + +$ curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +Pour le traitement des requêtes distribuées, les tables temporaires sont envoyées à tous les serveurs distants. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/external_data/) diff --git a/docs/fr/engines/table-engines/special/file.md b/docs/fr/engines/table-engines/special/file.md new file mode 100644 index 00000000000..7b599f0820e --- /dev/null +++ b/docs/fr/engines/table-engines/special/file.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 37 +toc_title: Fichier +--- + +# Fichier {#table_engines-file} + +Le moteur de table de fichiers conserve les données dans un fichier dans l’un des [fichier +format](../../../interfaces/formats.md#formats) (TabSeparated, Native, etc.). + +Exemples d’utilisation: + +- Exportation de données de ClickHouse vers un fichier. +- Convertir des données d’un format à un autre. +- Mise à jour des données dans ClickHouse via l’édition d’un fichier sur un disque. + +## Utilisation Dans Le Serveur Clickhouse {#usage-in-clickhouse-server} + +``` sql +File(Format) +``` + +Le `Format` paramètre spécifie l’un des formats de fichier disponibles. Effectuer +`SELECT` requêtes, le format doit être pris en charge pour l’entrée, et à effectuer +`INSERT` queries – for output. The available formats are listed in the +[Format](../../../interfaces/formats.md#formats) section. + +ClickHouse ne permet pas de spécifier le chemin du système de fichiers pour`File`. Il utilisera le dossier défini par [chemin](../../../operations/server-configuration-parameters/settings.md) réglage dans la configuration du serveur. + +Lors de la création de la table en utilisant `File(Format)` il crée sous-répertoire vide dans ce dossier. Lorsque les données sont écrites dans cette table, elles sont mises dans `data.Format` fichier dans ce répertoire. + +Vous pouvez créer manuellement ce sous dossier et ce fichier dans le système de fichiers [ATTACH](../../../sql-reference/statements/misc.md) il à la table des informations avec le nom correspondant, de sorte que vous pouvez interroger les données de ce fichier. + +!!! warning "Avertissement" + Soyez prudent avec cette fonctionnalité, car ClickHouse ne garde pas trace des modifications externes apportées à ces fichiers. Le résultat des Écritures simultanées via ClickHouse et en dehors de ClickHouse n’est pas défini. + +**Exemple:** + +**1.** Configurer le `file_engine_table` table: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +Par défaut ClickHouse va créer un dossier `/var/lib/clickhouse/data/default/file_engine_table`. + +**2.** Créer manuellement `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` contenant: + +``` bash +$ cat data.TabSeparated +one 1 +two 2 +``` + +**3.** Interroger les données: + +``` sql +SELECT * FROM file_engine_table +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Utilisation Dans Clickhouse-local {#usage-in-clickhouse-local} + +Dans [clickhouse-local](../../../operations/utilities/clickhouse-local.md) Fichier moteur accepte chemin d’accès au fichier en plus `Format`. Les flux d’entrée / sortie par défaut peuvent être spécifiés en utilisant des noms numériques ou lisibles par l’homme comme `0` ou `stdin`, `1` ou `stdout`. +**Exemple:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## Les Détails De Mise En Œuvre {#details-of-implementation} + +- Plusieurs `SELECT` les requêtes peuvent être effectuées simultanément, mais `INSERT` requêtes s’attendre les uns les autres. +- Prise en charge de la création d’un nouveau fichier par `INSERT` requête. +- Si le fichier existe, `INSERT` ajouterait de nouvelles valeurs dedans. +- Pas pris en charge: + - `ALTER` + - `SELECT ... SAMPLE` + - Index + - Réplication + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/fr/engines/table-engines/special/generate.md b/docs/fr/engines/table-engines/special/generate.md new file mode 100644 index 00000000000..74e3c6fb7bb --- /dev/null +++ b/docs/fr/engines/table-engines/special/generate.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 46 +toc_title: GenerateRandom +--- + +# Generaterandom {#table_engines-generate} + +Le moteur de table GenerateRandom produit des données aléatoires pour un schéma de table donné. + +Exemples d’utilisation: + +- Utiliser dans le test pour remplir une grande table reproductible. +- Générer une entrée aléatoire pour les tests de fuzzing. + +## Utilisation Dans Le Serveur Clickhouse {#usage-in-clickhouse-server} + +``` sql +ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) +``` + +Le `max_array_length` et `max_string_length` les paramètres spécifient la longueur maximale de tous +colonnes et chaînes de tableau en conséquence dans les données générées. + +Générer le moteur de table prend en charge uniquement `SELECT` requête. + +Il prend en charge tous les [Les types de données](../../../sql-reference/data-types/index.md) cela peut être stocké dans une table sauf `LowCardinality` et `AggregateFunction`. + +**Exemple:** + +**1.** Configurer le `generate_engine_table` table: + +``` sql +CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) +``` + +**2.** Interroger les données: + +``` sql +SELECT * FROM generate_engine_table LIMIT 3 +``` + +``` text +┌─name─┬──────value─┐ +│ c4xJ │ 1412771199 │ +│ r │ 1791099446 │ +│ 7#$ │ 124312908 │ +└──────┴────────────┘ +``` + +## Les Détails De Mise En Œuvre {#details-of-implementation} + +- Pas pris en charge: + - `ALTER` + - `SELECT ... SAMPLE` + - `INSERT` + - Index + - Réplication + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/fr/engines/table_engines/special/index.md b/docs/fr/engines/table-engines/special/index.md similarity index 100% rename from docs/fr/engines/table_engines/special/index.md rename to docs/fr/engines/table-engines/special/index.md diff --git a/docs/fr/engines/table-engines/special/join.md b/docs/fr/engines/table-engines/special/join.md new file mode 100644 index 00000000000..7af77d21fb2 --- /dev/null +++ b/docs/fr/engines/table-engines/special/join.md @@ -0,0 +1,111 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 40 +toc_title: Rejoindre +--- + +# Rejoindre {#join} + +Structure de données préparée pour l’utilisation dans [JOIN](../../../sql-reference/statements/select.md#select-join) opérations. + +## Création d’une Table {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], +) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) +``` + +Voir la description détaillée de la [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) requête. + +**Les Paramètres Du Moteur** + +- `join_strictness` – [ADHÉRER à la rigueur](../../../sql-reference/statements/select.md#select-join-strictness). +- `join_type` – [Type de jointure](../../../sql-reference/statements/select.md#select-join-types). +- `k1[, k2, ...]` – Key columns from the `USING` la clause que l’ `JOIN` l’opération est faite avec de la. + +Entrer `join_strictness` et `join_type` paramètres sans guillemets, par exemple, `Join(ANY, LEFT, col1)`. Ils doivent correspondre à la `JOIN` fonctionnement que le tableau sera utilisé pour. Si les paramètres ne correspondent pas, ClickHouse ne lance pas d’exception et peut renvoyer des données incorrectes. + +## Utilisation Du Tableau {#table-usage} + +### Exemple {#example} + +Création de la table de gauche: + +``` sql +CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog +``` + +``` sql +INSERT INTO id_val VALUES (1,11)(2,12)(3,13) +``` + +Création du côté droit `Join` table: + +``` sql +CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) +``` + +``` sql +INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) +``` + +Rejoindre les tables: + +``` sql +SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 +``` + +``` text +┌─id─┬─val─┬─id_val_join.val─┐ +│ 1 │ 11 │ 21 │ +│ 2 │ 12 │ ᴺᵁᴸᴸ │ +│ 3 │ 13 │ 23 │ +└────┴─────┴─────────────────┘ +``` + +Comme alternative, vous pouvez récupérer des données de la `Join` table, spécifiant la valeur de la clé de jointure: + +``` sql +SELECT joinGet('id_val_join', 'val', toUInt32(1)) +``` + +``` text +┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ +│ 21 │ +└────────────────────────────────────────────┘ +``` + +### Sélection Et Insertion De données {#selecting-and-inserting-data} + +Vous pouvez utiliser `INSERT` requêtes pour ajouter des données au `Join`-tables de moteur. Si la table a été créée avec `ANY` rigueur, les données pour les clés en double sont ignorées. Avec l’ `ALL` rigueur, toutes les lignes sont ajoutées. + +Vous ne pouvez pas effectuer un `SELECT` requête directement à partir de la table. Au lieu de cela, utilisez l’une des méthodes suivantes: + +- Placez la table sur le côté droit dans un `JOIN` clause. +- Appelez le [joinGet](../../../sql-reference/functions/other-functions.md#joinget) fonction, qui vous permet d’extraire des données de la table de la même manière que d’un dictionnaire. + +### Limitations Et paramètres {#join-limitations-and-settings} + +Lors de la création d’un tableau, les paramètres suivants sont appliqués: + +- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) +- [max\_rows\_in\_join](../../../operations/settings/query-complexity.md#settings-max_rows_in_join) +- [max\_bytes\_in\_join](../../../operations/settings/query-complexity.md#settings-max_bytes_in_join) +- [join\_overflow\_mode](../../../operations/settings/query-complexity.md#settings-join_overflow_mode) +- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) + +Le `Join`- les tables de moteur ne peuvent pas être utilisées dans `GLOBAL JOIN` opérations. + +Le `Join`-moteur permet d’utiliser [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) réglage de la `CREATE TABLE` déclaration. Et [SELECT](../../../sql-reference/statements/select.md) requête permet d’utiliser `join_use_nulls` trop. Si vous avez différents `join_use_nulls` paramètres, vous pouvez obtenir une table de jointure d’erreur. Il dépend de type de JOINTURE. Lorsque vous utilisez [joinGet](../../../sql-reference/functions/other-functions.md#joinget) fonction, vous devez utiliser le même `join_use_nulls` réglage en `CRATE TABLE` et `SELECT` déclaration. + +## Le Stockage De Données {#data-storage} + +`Join` les données de la table sont toujours situées dans la RAM. Lors de l’insertion de lignes dans une table, ClickHouse écrit des blocs de données dans le répertoire du disque afin qu’ils puissent être restaurés lorsque le serveur redémarre. + +Si le serveur redémarre incorrectement, le bloc de données sur le disque peut être perdu ou endommagé. Dans ce cas, vous devrez peut-être supprimer manuellement le fichier contenant des données endommagées. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/fr/engines/table-engines/special/materializedview.md b/docs/fr/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..84e5a94c9fe --- /dev/null +++ b/docs/fr/engines/table-engines/special/materializedview.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 43 +toc_title: MaterializedView +--- + +# Materializedview {#materializedview} + +Utilisé pour implémenter des vues matérialisées (pour plus d’informations, voir [CREATE TABLE](../../../sql-reference/statements/create.md)). Pour stocker des données, il utilise un moteur différent qui a été spécifié lors de la création de la vue. Lors de la lecture d’une table, il utilise juste ce moteur. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/fr/engines/table-engines/special/memory.md b/docs/fr/engines/table-engines/special/memory.md new file mode 100644 index 00000000000..06c727a4eb0 --- /dev/null +++ b/docs/fr/engines/table-engines/special/memory.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 44 +toc_title: "M\xE9moire" +--- + +# Mémoire {#memory} + +Le moteur de mémoire stocke les données en RAM, sous forme non compressée. Les données sont stockées exactement sous la même forme qu’elles sont reçues lors de la lecture. En d’autres termes, la lecture de ce tableau est entièrement gratuit. +L’accès aux données simultanées est synchronisé. Les verrous sont courts: les opérations de lecture et d’écriture ne se bloquent pas. +Les index ne sont pas pris en charge. La lecture est parallélisée. +La productivité maximale (plus de 10 Go / s) est atteinte sur les requêtes simples, car il n’y a pas de lecture à partir du disque, de décompression ou de désérialisation des données. (Il convient de noter que dans de nombreux cas, la productivité du moteur MergeTree est presque aussi élevée.) +Lors du redémarrage d’un serveur, les données disparaissent de la table et la table devient vide. +Normalement, l’utilisation de ce moteur de table n’est pas justifiée. Cependant, il peut être utilisé pour des tests, et pour des tâches où la vitesse maximale est requise sur un nombre relativement faible de lignes (jusqu’à environ 100 000 000). + +Le moteur de mémoire est utilisé par le système pour les tables temporaires avec des données de requête externes (voir la section “External data for processing a query”), et pour la mise en œuvre globale dans (voir la section “IN operators”). + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/memory/) diff --git a/docs/fr/engines/table-engines/special/merge.md b/docs/fr/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..d534f30b6c9 --- /dev/null +++ b/docs/fr/engines/table-engines/special/merge.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 36 +toc_title: Fusionner +--- + +# Fusionner {#merge} + +Le `Merge` moteur (à ne pas confondre avec `MergeTree`) ne stocke pas les données elles-mêmes, mais permet la lecture de n’importe quel nombre d’autres tables simultanément. +La lecture est automatiquement parallélisée. L’écriture dans une table n’est pas prise en charge. Lors de la lecture, les index des tables en cours de lecture sont utilisés, s’ils existent. +Le `Merge` engine accepte les paramètres: le nom de la base de données et une expression régulière pour les tables. + +Exemple: + +``` sql +Merge(hits, '^WatchLog') +``` + +Les données seront lues à partir des tableaux du `hits` base de données dont les noms correspondent à l’expression régulière ‘`^WatchLog`’. + +Au lieu du nom de la base de données, vous pouvez utiliser une expression constante qui renvoie une chaîne. Exemple, `currentDatabase()`. + +Regular expressions — [re2](https://github.com/google/re2) (prend en charge un sous-ensemble de PCRE), sensible à la casse. +Voir les notes sur les symboles d’échappement dans les expressions régulières “match” section. + +Lors de la sélection des tables à lire, le `Merge` le tableau lui-même ne sera pas choisie, même si elle correspond à l’expression rationnelle. C’est pour éviter les boucles. +Il est possible de créer deux `Merge` des tables qui essaieront sans cesse de lire les données des autres, mais ce n’est pas une bonne idée. + +L’utilisation traditionnelle de la `Merge` moteur pour travailler avec un grand nombre de `TinyLog` les tables comme si avec une seule table. + +Exemple 2: + +Disons que vous avez une ancienne table (WatchLog\_old) et que vous avez décidé de changer de partitionnement sans déplacer les données vers une nouvelle table (WatchLog\_new) et que vous devez voir les données des deux tables. + +``` sql +CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree(date, (UserId, EventType), 8192); +INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + +CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; +INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + +CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + +SELECT * +FROM WatchLog +``` + +``` text +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-01 │ 1 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-02 │ 2 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +``` + +## Les Colonnes Virtuelles {#virtual-columns} + +- `_table` — Contains the name of the table from which data was read. Type: [Chaîne](../../../sql-reference/data-types/string.md). + + Vous pouvez définir les conditions constantes sur `_table` dans le `WHERE/PREWHERE` clause (par exemple, `WHERE _table='xyz'`). Dans ce cas l’opération de lecture est effectuée uniquement pour les tables où la condition sur `_table` est satisfaite, pour le `_table` colonne agit comme un index. + +**Voir Aussi** + +- [Les colonnes virtuelles](index.md#table_engines-virtual_columns) + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/fr/engines/table-engines/special/null.md b/docs/fr/engines/table-engines/special/null.md new file mode 100644 index 00000000000..bffd4267b79 --- /dev/null +++ b/docs/fr/engines/table-engines/special/null.md @@ -0,0 +1,14 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 38 +toc_title: 'NULL' +--- + +# NULL {#null} + +Lors de l’écriture dans une table Null, Les données sont ignorées. Lors de la lecture à partir d’une table Null, la réponse est vide. + +Toutefois, vous pouvez créer une vue matérialisée sur une table Nuls. Ainsi, les données écrites dans la table finira dans la vue. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/null/) diff --git a/docs/fr/engines/table-engines/special/set.md b/docs/fr/engines/table-engines/special/set.md new file mode 100644 index 00000000000..5f81f2b0a30 --- /dev/null +++ b/docs/fr/engines/table-engines/special/set.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 39 +toc_title: "D\xE9finir" +--- + +# Définir {#set} + +Un ensemble de données qui est toujours en RAM. Il est conçu pour être utilisé sur le côté droit de l’opérateur (voir la section “IN operators”). + +Vous pouvez utiliser INSERT pour insérer des données dans la table. De nouveaux éléments seront ajoutés à l’ensemble de données, tandis que les doublons seront ignorés. +Mais vous ne pouvez pas effectuer SELECT à partir de la table. La seule façon de récupérer des données est en l’utilisant dans la moitié droite de l’opérateur. + +Les données sont toujours situées dans la RAM. Pour INSERT, les blocs de données insérées sont également écrits dans le répertoire des tables sur le disque. Lors du démarrage du serveur, ces données sont chargées dans la RAM. En d’autres termes, après le redémarrage, les données restent en place. + +Pour un redémarrage brutal du serveur, le bloc de données sur le disque peut être perdu ou endommagé. Dans ce dernier cas, vous devrez peut-être supprimer manuellement le fichier contenant des données endommagées. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/set/) diff --git a/docs/fr/engines/table-engines/special/url.md b/docs/fr/engines/table-engines/special/url.md new file mode 100644 index 00000000000..30b1d0b7e8b --- /dev/null +++ b/docs/fr/engines/table-engines/special/url.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 41 +toc_title: URL +--- + +# URL (URL, Format) {#table_engines-url} + +Gère les données sur un serveur HTTP / HTTPS distant. Ce moteur est similaire +à l’ [Fichier](file.md) moteur. + +## Utilisation Du Moteur Dans Le Serveur Clickhouse {#using-the-engine-in-the-clickhouse-server} + +Le `format` doit être celui que ClickHouse peut utiliser dans +`SELECT` les requêtes et, si nécessaire, en `INSERTs`. Pour la liste complète des formats pris en charge, voir +[Format](../../../interfaces/formats.md#formats). + +Le `URL` doit être conforme à la structure D’un Localisateur de ressources uniforme. L’URL spécifiée doit pointer vers un serveur +qui utilise le protocole HTTP ou HTTPS. Cela ne nécessite pas de +en-têtes supplémentaires pour obtenir une réponse du serveur. + +`INSERT` et `SELECT` les requêtes sont transformées en `POST` et `GET` demande, +respectivement. Pour le traitement `POST` demandes, le serveur distant doit prendre en charge +[Encodage de transfert en morceaux](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). + +Vous pouvez limiter le nombre maximal de sauts de redirection HTTP GET en utilisant [max\_http\_get\_redirects](../../../operations/settings/settings.md#setting-max_http_get_redirects) paramètre. + +**Exemple:** + +**1.** Créer un `url_engine_table` table sur le serveur : + +``` sql +CREATE TABLE url_engine_table (word String, value UInt64) +ENGINE=URL('http://127.0.0.1:12345/', CSV) +``` + +**2.** Créez un serveur HTTP de base à l’aide des outils Python 3 standard et +démarrer: + +``` python3 +from http.server import BaseHTTPRequestHandler, HTTPServer + +class CSVHTTPServer(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-type', 'text/csv') + self.end_headers() + + self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) + +if __name__ == "__main__": + server_address = ('127.0.0.1', 12345) + HTTPServer(server_address, CSVHTTPServer).serve_forever() +``` + +``` bash +$ python3 server.py +``` + +**3.** Les données de la demande: + +``` sql +SELECT * FROM url_engine_table +``` + +``` text +┌─word──┬─value─┐ +│ Hello │ 1 │ +│ World │ 2 │ +└───────┴───────┘ +``` + +## Les Détails De Mise En Œuvre {#details-of-implementation} + +- Les lectures et les écritures peuvent être parallèles +- Pas pris en charge: + - `ALTER` et `SELECT...SAMPLE` opérations. + - Index. + - Réplication. + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/fr/engines/table-engines/special/view.md b/docs/fr/engines/table-engines/special/view.md new file mode 100644 index 00000000000..6711f0817d7 --- /dev/null +++ b/docs/fr/engines/table-engines/special/view.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 42 +toc_title: Vue +--- + +# Vue {#table_engines-view} + +Utilisé pour implémenter des vues (pour plus d’informations, voir `CREATE VIEW query`). Il ne stocke pas de données, mais stocke uniquement les `SELECT` requête. Lors de la lecture d’une table, il exécute cette requête (et supprime toutes les colonnes inutiles de la requête). + +[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/view/) diff --git a/docs/fr/engines/table_engines/index.md b/docs/fr/engines/table_engines/index.md deleted file mode 100644 index 3e199de8ebd..00000000000 --- a/docs/fr/engines/table_engines/index.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Table Engines -toc_priority: 26 -toc_title: Introduction ---- - -# Moteurs De Table {#table_engines} - -Le moteur de table (type de table) détermine: - -- Comment et où les données sont stockées, où les écrire et où les lire. -- Quelles requêtes sont prises en charge et comment. -- Accès simultané aux données. -- Utilisation des index, si elle est présente. -- Indique si l'exécution d'une requête multithread est possible. -- Paramètres de réplication des données. - -## Familles De Moteurs {#engine-families} - -### Mergetree {#mergetree} - -Les moteurs de table les plus universels et fonctionnels pour les tâches à forte charge. La propriété partagée par ces moteurs est l'insertion rapide des données avec traitement ultérieur des données d'arrière-plan. `MergeTree` les moteurs de la famille prennent en charge la réplication des données (avec [Répliqué\*](mergetree_family/replication.md) versions de moteurs), le partitionnement, et d'autres fonctionnalités non prises en charge dans d'autres moteurs. - -Moteurs dans la famille: - -- [MergeTree](mergetree_family/mergetree.md) -- [ReplacingMergeTree](mergetree_family/replacingmergetree.md) -- [SummingMergeTree](mergetree_family/summingmergetree.md) -- [AggregatingMergeTree](mergetree_family/aggregatingmergetree.md) -- [CollapsingMergeTree](mergetree_family/collapsingmergetree.md) -- [VersionedCollapsingMergeTree](mergetree_family/versionedcollapsingmergetree.md) -- [GraphiteMergeTree](mergetree_family/graphitemergetree.md) - -### Journal {#log} - -Léger [moteur](log_family/index.md) avec une fonctionnalité minimale. Ils sont les plus efficaces lorsque vous devez écrire rapidement de nombreuses petites tables (jusqu'à environ 1 million de lignes) et les lire plus tard dans leur ensemble. - -Moteurs dans la famille: - -- [TinyLog](log_family/tinylog.md) -- [StripeLog](log_family/stripelog.md) -- [Journal](log_family/log.md) - -### Moteurs D'Intégration {#integration-engines} - -Moteurs de communication avec d'autres systèmes de stockage et de traitement de données. - -Moteurs dans la famille: - -- [Kafka](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) -- [HDFS](integrations/hdfs.md) - -### Moteurs Spéciaux {#special-engines} - -Moteurs dans la famille: - -- [Distribué](special/distributed.md) -- [MaterializedView](special/materializedview.md) -- [Dictionnaire](special/dictionary.md) -- [Fusionner](special/merge.md) -- [Fichier](special/file.md) -- [NULL](special/null.md) -- [Définir](special/set.md) -- [Rejoindre](special/join.md) -- [URL](special/url.md) -- [Vue](special/view.md) -- [Mémoire](special/memory.md) -- [Tampon](special/buffer.md) - -## Les Colonnes Virtuelles {#table_engines-virtual-columns} - -Colonne virtuelle est un attribut de moteur de table intégrale qui est défini dans le code source du moteur. - -Vous ne devez pas spécifier de colonnes virtuelles dans `CREATE TABLE` requête et vous ne pouvez pas les voir dans `SHOW CREATE TABLE` et `DESCRIBE TABLE` les résultats de la requête. Les colonnes virtuelles sont également en lecture seule, vous ne pouvez donc pas insérer de données dans des colonnes virtuelles. - -Pour sélectionner des données dans une colonne virtuelle, vous devez spécifier son nom `SELECT` requête. `SELECT *` ne renvoie pas de valeurs à partir de colonnes virtuelles. - -Si vous créez une table avec une colonne portant le même nom que l'une des colonnes virtuelles de la table, la colonne virtuelle devient inaccessible. Nous ne recommandons pas de faire cela. Pour éviter les conflits, les noms de colonnes virtuelles sont généralement précédés d'un trait de soulignement. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/fr/engines/table_engines/integrations/hdfs.md b/docs/fr/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index 0cc1b423983..00000000000 --- a/docs/fr/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 36 -toc_title: HDFS ---- - -# HDFS {#table_engines-hdfs} - -Ce moteur fournit l'intégration avec [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) l'écosystème en permettant de gérer les données sur [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)via ClickHouse. Ce moteur est similaire -à l' [Fichier](../special/file.md) et [URL](../special/url.md) moteurs, mais fournit des fonctionnalités spécifiques Hadoop. - -## Utilisation {#usage} - -``` sql -ENGINE = HDFS(URI, format) -``` - -Le `URI` paramètre est L'URI du fichier entier dans HDFS. -Le `format` paramètre spécifie l'un des formats de fichier disponibles. Effectuer -`SELECT` requêtes, le format doit être pris en charge pour l'entrée, et à effectuer -`INSERT` queries – for output. The available formats are listed in the -[Format](../../../interfaces/formats.md#formats) section. -Le chemin le cadre de `URI` peut contenir des globules. Dans ce cas, le tableau serait en lecture seule. - -**Exemple:** - -**1.** Configurer le `hdfs_engine_table` table: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** Remplir le fichier: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** Interroger les données: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Détails De Mise En Œuvre {#implementation-details} - -- Les lectures et les écritures peuvent être parallèles -- Pas pris en charge: - - `ALTER` et `SELECT...SAMPLE` opérations. - - Index. - - Réplication. - -**Globs dans le chemin** - -Plusieurs composants de chemin peuvent avoir des globs. Pour être traité, le fichier devrait exister et correspondre au modèle de chemin entier. Liste des fichiers détermine pendant `SELECT` (pas à l' `CREATE` moment). - -- `*` — Substitutes any number of any characters except `/` y compris la chaîne vide. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Les Constructions avec `{}` sont similaires à l' [distant](../../../sql_reference/table_functions/remote.md) table de fonction. - -**Exemple** - -1. Supposons que nous ayons plusieurs fichiers au format TSV avec les URI suivants sur HDFS: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Il y a plusieurs façons de faire une table composée des six fichiers: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -Une autre façon: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -Table se compose de tous les fichiers dans les deux répertoires (tous les fichiers doivent satisfaire le format et le schéma décrits dans la requête): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "Avertissement" - Si la liste des fichiers contient des plages de nombres avec des zéros en tête, utilisez la construction avec des accolades pour chaque chiffre séparément ou utilisez `?`. - -**Exemple** - -Créer une table avec des fichiers nommés `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') -``` - -## Les Colonnes Virtuelles {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Voir Aussi** - -- [Les colonnes virtuelles](../index.md#table_engines-virtual_columns) - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/fr/engines/table_engines/integrations/jdbc.md b/docs/fr/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index de636f70abc..00000000000 --- a/docs/fr/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 34 -toc_title: JDBC ---- - -# JDBC {#table-engine-jdbc} - -Permet à ClickHouse de se connecter à des bases de données externes via [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -Pour implémenter la connexion JDBC, ClickHouse utilise le programme séparé [clickhouse-JDBC-pont](https://github.com/alex-krash/clickhouse-jdbc-bridge) cela devrait fonctionner comme un démon. - -Ce moteur prend en charge le [Nullable](../../../sql_reference/data_types/nullable.md) type de données. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -( - columns list... -) -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**Les Paramètres Du Moteur** - -- `dbms_uri` — URI of an external DBMS. - - Format: `jdbc:://:/?user=&password=`. - Exemple pour MySQL: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — Database in an external DBMS. - -- `external_table` — Name of the table in `external_database`. - -## Exemple D'Utilisation {#usage-example} - -Création d'une table dans le serveur MySQL en se connectant directement avec son client console: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Création d'une table dans le serveur ClickHouse et sélection des données: - -``` sql -CREATE TABLE jdbc_table -( - `int_id` Int32, - `int_nullable` Nullable(Int32), - `float` Float32, - `float_nullable` Nullable(Float32) -) -ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Voir Aussi {#see-also} - -- [Fonction de table JDBC](../../../sql_reference/table_functions/jdbc.md). - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/fr/engines/table_engines/integrations/kafka.md b/docs/fr/engines/table_engines/integrations/kafka.md deleted file mode 100644 index 6bb2f2a1bad..00000000000 --- a/docs/fr/engines/table_engines/integrations/kafka.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 32 -toc_title: Kafka ---- - -# Kafka {#kafka} - -Ce moteur fonctionne avec [Apache Kafka](http://kafka.apache.org/). - -Kafka vous permet de: - -- Publier ou s'abonner aux flux de données. -- Organiser le stockage tolérant aux pannes. -- Traiter les flux à mesure qu'ils deviennent disponibles. - -## Création d'une Table {#table_engine-kafka-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = Kafka() -SETTINGS - kafka_broker_list = 'host:port', - kafka_topic_list = 'topic1,topic2,...', - kafka_group_name = 'group_name', - kafka_format = 'data_format'[,] - [kafka_row_delimiter = 'delimiter_symbol',] - [kafka_schema = '',] - [kafka_num_consumers = N,] - [kafka_skip_broken_messages = N] -``` - -Les paramètres requis: - -- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). -- `kafka_topic_list` – A list of Kafka topics. -- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don't want messages to be duplicated in the cluster, use the same group name everywhere. -- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` la fonction, tels que `JSONEachRow`. Pour plus d'informations, voir le [Format](../../../interfaces/formats.md) section. - -Paramètres facultatifs: - -- `kafka_row_delimiter` – Delimiter character, which ends the message. -- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap'n Proto](https://capnproto.org/) nécessite le chemin d'accès du fichier de schéma et le nom de la racine `schema.capnp:Message` objet. -- `kafka_num_consumers` – The number of consumers per table. Default: `1`. Spécifiez plus de consommateurs si le débit d'un consommateur est insuffisant. Le nombre total de consommateurs ne doit pas dépasser le nombre de partitions dans la rubrique, car un seul consommateur peut être affecté par partition. -- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. Si `kafka_skip_broken_messages = N` puis le moteur saute *N* Messages Kafka qui ne peuvent pas être analysés (un message est égal à une ligne de données). - -Exemple: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - SELECT * FROM queue LIMIT 5; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') - SETTINGS kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; -``` - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets. Si possible, optez anciens projets à la méthode décrite ci-dessus. - -``` sql -Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format - [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) -``` - -
- -## Description {#description} - -Les messages livrés sont suivis automatiquement, de sorte que chaque message d'un groupe n'est compté qu'une seule fois. Si vous souhaitez obtenir les données deux fois, créez une copie de la table avec un autre nom de groupe. - -Les groupes sont flexibles et synchronisés sur le cluster. Par exemple, si vous avez 10 thèmes et 5 copies d'une table dans un cluster, chaque copie obtient 2 sujets. Si le nombre de copies change, les rubriques sont redistribuées automatiquement entre les copies. En savoir plus à ce sujet à http://kafka.apache.org/intro. - -`SELECT` n'est pas particulièrement utile pour la lecture de messages (sauf pour le débogage), car chaque message ne peut être lu qu'une seule fois. Il est plus pratique de créer des threads en temps réel à l'aide de vues matérialisées. Pour ce faire: - -1. Utilisez le moteur pour créer un consommateur Kafka et considérez-le comme un flux de données. -2. Créez une table avec la structure souhaitée. -3. Créer une vue matérialisée qui convertit les données du moteur et le met dans une table créée précédemment. - -Lorsque l' `MATERIALIZED VIEW` rejoint le moteur, il commence à collecter des données en arrière-plan. Cela vous permet de recevoir continuellement des messages de Kafka et de les convertir au format requis en utilisant `SELECT`. -Une table kafka peut avoir autant de vues matérialisées que vous le souhaitez, elles ne lisent pas directement les données de la table kafka, mais reçoivent de nouveaux enregistrements( en blocs), de cette façon vous pouvez écrire sur plusieurs tables avec différents niveaux de détail (avec regroupement - agrégation et sans). - -Exemple: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - CREATE TABLE daily ( - day Date, - level String, - total UInt64 - ) ENGINE = SummingMergeTree(day, (day, level), 8192); - - CREATE MATERIALIZED VIEW consumer TO daily - AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total - FROM queue GROUP BY day, level; - - SELECT level, sum(total) FROM daily GROUP BY level; -``` - -Pour améliorer les performances, les messages reçus sont regroupées en blocs de la taille de [max\_insert\_block\_size](../../../operations/server_configuration_parameters/settings.md#settings-max_insert_block_size). Si le bloc n'a pas été formé à l'intérieur [stream\_flush\_interval\_ms](../../../operations/server_configuration_parameters/settings.md) millisecondes, les données seront vidées dans le tableau, indépendamment de l'intégralité du bloc. - -Pour arrêter de recevoir des données de rubrique ou pour modifier la logique de conversion, détachez la vue matérialisée: - -``` sql - DETACH TABLE consumer; - ATTACH TABLE consumer; -``` - -Si vous souhaitez modifier la table cible en utilisant `ALTER`, nous vous recommandons de désactiver la vue matériel pour éviter les divergences entre la table cible et les données de la vue. - -## Configuration {#configuration} - -Similaire à GraphiteMergeTree, le moteur Kafka prend en charge la configuration étendue à l'aide du fichier de configuration ClickHouse. Il y a deux clés de configuration que vous pouvez utiliser: global (`kafka`) et des rubriques (`kafka_*`). La configuration globale est appliquée en premier, puis la configuration au niveau de la rubrique est appliquée (si elle existe). - -``` xml - - - cgrp - smallest - - - - - 250 - 100000 - -``` - -Pour obtenir une liste des options de configuration possibles, consultez [librdkafka référence de configuration](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Utilisez le trait de soulignement (`_`) au lieu d'un point dans la configuration ClickHouse. Exemple, `check.crcs=true` sera `true`. - -## Les Colonnes Virtuelles {#virtual-columns} - -- `_topic` — Kafka topic. -- `_key` — Key of the message. -- `_offset` — Offset of the message. -- `_timestamp` — Timestamp of the message. -- `_partition` — Partition of Kafka topic. - -**Voir Aussi** - -- [Les colonnes virtuelles](../index.md#table_engines-virtual_columns) - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/fr/engines/table_engines/integrations/mysql.md b/docs/fr/engines/table_engines/integrations/mysql.md deleted file mode 100644 index 5cec6701228..00000000000 --- a/docs/fr/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 33 -toc_title: MySQL ---- - -# Mysql {#mysql} - -Le moteur MySQL vous permet d'effectuer `SELECT` requêtes sur les données stockées sur un serveur MySQL distant. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... -) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -Voir une description détaillée de la [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) requête. - -La structure de la table peut différer de la structure de la table MySQL d'origine: - -- Les noms de colonnes doivent être les mêmes que dans la table MySQL d'origine, mais vous pouvez utiliser seulement certaines de ces colonnes et dans n'importe quel ordre. -- Les types de colonnes peuvent différer de ceux de la table MySQL d'origine. ClickHouse essaie de [jeter](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) valeurs des types de données ClickHouse. - -**Les Paramètres Du Moteur** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` les requêtes de `REPLACE INTO`. Si `replace_query=1` la requête est substitué. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expression qui est ajoutée à la `INSERT` requête. - - Exemple: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, où `on_duplicate_clause` être `UPDATE c2 = c2 + 1`. Voir la [Documentation de MySQL](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) pour trouver lequel `on_duplicate_clause` vous pouvez utiliser avec le `ON DUPLICATE KEY` clause. - - Spécifier `on_duplicate_clause` vous avez besoin de passer `0` à l' `replace_query` paramètre. Si vous passez simultanément `replace_query = 1` et `on_duplicate_clause`, Clickhouse génère une exception. - -Simple `WHERE` des clauses telles que `=, !=, >, >=, <, <=` sont exécutés sur le serveur MySQL. - -Le reste des conditions et le `LIMIT` les contraintes d'échantillonnage sont exécutées dans ClickHouse uniquement après la fin de la requête à MySQL. - -## Exemple D'Utilisation {#usage-example} - -Table dans MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Table dans ClickHouse, récupération des données de la table MySQL créée ci-dessus: - -``` sql -CREATE TABLE mysql_table -( - `float_nullable` Nullable(Float32), - `int_id` Int32 -) -ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` sql -SELECT * FROM mysql_table -``` - -``` text -┌─float_nullable─┬─int_id─┐ -│ ᴺᵁᴸᴸ │ 1 │ -└────────────────┴────────┘ -``` - -## Voir Aussi {#see-also} - -- [Le ‘mysql’ fonction de table](../../../sql_reference/table_functions/mysql.md) -- [Utilisation de MySQL comme source de dictionnaire externe](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/fr/engines/table_engines/integrations/odbc.md b/docs/fr/engines/table_engines/integrations/odbc.md deleted file mode 100644 index 22db868bdad..00000000000 --- a/docs/fr/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 35 -toc_title: ODBC ---- - -# ODBC {#table-engine-odbc} - -Permet à ClickHouse de se connecter à des bases de données externes via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -Pour implémenter en toute sécurité les connexions ODBC, ClickHouse utilise un programme distinct `clickhouse-odbc-bridge`. Si le pilote ODBC est chargé directement depuis `clickhouse-server`, les problèmes de pilote peuvent planter le serveur ClickHouse. Clickhouse démarre automatiquement `clickhouse-odbc-bridge` lorsque cela est nécessaire. Le programme ODBC bridge est installé à partir du même package que `clickhouse-server`. - -Ce moteur prend en charge le [Nullable](../../../sql_reference/data_types/nullable.md) type de données. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -Voir une description détaillée de la [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) requête. - -La structure de la table peut différer de la structure de la table source: - -- Les noms de colonnes doivent être les mêmes que dans la table source, mais vous pouvez utiliser quelques-unes de ces colonnes et dans n'importe quel ordre. -- Les types de colonnes peuvent différer de ceux de la table source. ClickHouse essaie de [jeter](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) valeurs des types de données ClickHouse. - -**Les Paramètres Du Moteur** - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` fichier. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -## Exemple D'Utilisation {#usage-example} - -**Récupération des données de L'installation MySQL locale via ODBC** - -Cet exemple est vérifié pour Ubuntu Linux 18.04 et MySQL server 5.7. - -Assurez-vous que unixODBC et MySQL Connector sont installés. - -Par défaut (si installé à partir de paquets), ClickHouse démarre en tant qu'utilisateur `clickhouse`. Ainsi, vous devez créer et configurer cet utilisateur dans le serveur MySQL. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Puis configurez la connexion dans `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Vous pouvez vérifier la connexion en utilisant le `isql` utilitaire de l'installation unixODBC. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -Table dans MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Table dans ClickHouse, récupération des données de la table MySQL: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## Voir Aussi {#see-also} - -- [Dictionnaires externes ODBC](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [Fonction de table ODBC](../../../sql_reference/table_functions/odbc.md) - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/fr/engines/table_engines/log_family/log.md b/docs/fr/engines/table_engines/log_family/log.md deleted file mode 100644 index 9adcd4cf9fa..00000000000 --- a/docs/fr/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 33 -toc_title: Journal ---- - -# Journal {#log} - -Moteur appartient à la famille de journal des moteurs. Voir les propriétés communes des moteurs de journal et leurs différences dans le [Famille De Moteurs En Rondins](log_family.md) article. - -Journal diffère de [TinyLog](tinylog.md) dans un petit fichier de “marks” réside avec les fichiers de colonne. Ces marques sont écrites sur chaque bloc de données et contiennent des décalages qui indiquent où commencer à lire le fichier afin d'ignorer le nombre de lignes spécifié. Cela permet de lire les données de table dans plusieurs threads. -Pour l'accès aux données simultanées, les opérations de lecture peuvent être effectuées simultanément, tandis que les opérations d'écriture bloc lit et l'autre. -Le moteur de journal ne prend pas en charge les index. De même, si l'écriture dans une table a échoué, la table est cassée et la lecture de celle-ci renvoie une erreur. Le moteur de journal est approprié pour les données temporaires, les tables en écriture unique, et à des fins de test ou de démonstration. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/fr/engines/table_engines/log_family/log_family.md b/docs/fr/engines/table_engines/log_family/log_family.md deleted file mode 100644 index e16f9e6639a..00000000000 --- a/docs/fr/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 31 -toc_title: Introduction ---- - -# Famille De Moteurs En Rondins {#log-engine-family} - -Ces moteurs ont été développés pour les scénarios où vous devez écrire rapidement de nombreuses petites tables (jusqu'à environ 1 million de lignes) et les lire plus tard dans leur ensemble. - -Les moteurs de la famille: - -- [StripeLog](stripelog.md) -- [Journal](log.md) -- [TinyLog](tinylog.md) - -## Propriétés Communes {#common-properties} - -Moteur: - -- Stocker des données sur un disque. - -- Ajouter des données à la fin du fichier lors de l'écriture. - -- Bloque simultanées dans l'accès aux données. - - Lors `INSERT` requêtes, la table est verrouillée, et d'autres requêtes pour la lecture et l'écriture de données attendent que la table se déverrouille. S'il n'y a pas de requêtes d'écriture de données, un certain nombre de requêtes de lecture de données peuvent être effectuées simultanément. - -- Ne prennent pas en charge [mutation](../../../sql_reference/statements/alter.md#alter-mutations) opérations. - -- Ne prennent pas en charge les index. - - Cela signifie que `SELECT` les requêtes pour les plages de données ne sont pas efficaces. - -- N'écrivez pas de données de manière atomique. - - Vous pouvez obtenir une table avec des données corrompues si quelque chose interrompt l'opération d'écriture, par exemple, un arrêt anormal du serveur. - -## Différence {#differences} - -Le `TinyLog` le moteur est le plus simple de la famille et offre la fonctionnalité la plus pauvre et la plus faible efficacité. Le `TinyLog` le moteur ne prend pas en charge la lecture de données parallèles par plusieurs threads. Il lit les données plus lentement que les autres moteurs de la famille qui prennent en charge la lecture parallèle et utilise presque autant de descripteurs que `Log` moteur, car il stocke chaque colonne dans un fichier séparé. Utilisez-le dans des scénarios simples à faible charge. - -Le `Log` et `StripeLog` les moteurs prennent en charge la lecture de données parallèle. Lors de la lecture de données, ClickHouse utilise plusieurs threads. Chaque thread traite un bloc de données séparé. Le `Log` le moteur utilise un fichier distinct pour chaque colonne de la table. `StripeLog` stocke toutes les données dans un seul fichier. En conséquence, la `StripeLog` moteur utilise moins de descripteurs dans le système d'exploitation, mais le `Log` moteur fournit une plus grande efficacité lors de la lecture des données. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/fr/engines/table_engines/log_family/stripelog.md b/docs/fr/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index 35d4706c592..00000000000 --- a/docs/fr/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 32 -toc_title: StripeLog ---- - -# Stripelog {#stripelog} - -Ce moteur appartient à la famille des moteurs en rondins. Voir les propriétés communes des moteurs de journal et leurs différences dans le [Famille De Moteurs En Rondins](log_family.md) article. - -Utilisez ce moteur dans des scénarios lorsque vous devez écrire de nombreuses tables avec une petite quantité de données (moins de 1 million de lignes). - -## Création d'une Table {#table_engines-stripelog-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = StripeLog -``` - -Voir la description détaillée de la [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) requête. - -## L'écriture des Données {#table_engines-stripelog-writing-the-data} - -Le `StripeLog` moteur stocke toutes les colonnes dans un fichier. Pour chaque `INSERT` requête, ClickHouse ajoute le bloc de données à la fin d'un fichier de table, en écrivant des colonnes une par une. - -Pour chaque table ClickHouse écrit les fichiers: - -- `data.bin` — Data file. -- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. - -Le `StripeLog` moteur ne prend pas en charge la `ALTER UPDATE` et `ALTER DELETE` opérations. - -## La lecture des Données {#table_engines-stripelog-reading-the-data} - -Le fichier avec des marques permet à ClickHouse de paralléliser la lecture des données. Cela signifie qu'une `SELECT` la requête renvoie des lignes dans un ordre imprévisible. L'utilisation de la `ORDER BY` clause pour trier les lignes. - -## Exemple D'Utilisation {#table_engines-stripelog-example-of-use} - -Création d'une table: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -Insertion de données: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -Nous avons utilisé deux `INSERT` requêtes pour créer deux blocs de données `data.bin` fichier. - -ClickHouse utilise plusieurs threads lors de la sélection des données. Chaque thread lit un bloc de données séparé et renvoie les lignes résultantes indépendamment à la fin. En conséquence, l'ordre des blocs de lignes dans le résultat ne correspond pas à l'ordre des mêmes blocs dans l'entrée, dans la plupart des cas. Exemple: - -``` sql -SELECT * FROM stripe_log_table -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -┌───────────timestamp─┬─message_type─┬─message───────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -└─────────────────────┴──────────────┴───────────────────────────┘ -``` - -Trier les résultats (ordre croissant par défaut): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/fr/engines/table_engines/log_family/tinylog.md b/docs/fr/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index ddf935ba789..00000000000 --- a/docs/fr/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 34 -toc_title: TinyLog ---- - -# TinyLog {#tinylog} - -Le moteur appartient à la famille de moteurs en rondins. Voir [Famille De Moteurs En Rondins](log_family.md) pour les propriétés communes des moteurs en rondins et leurs différences. - -Ce moteur de table est généralement utilisé avec la méthode write-once: écrivez des données une fois, puis lisez-les autant de fois que nécessaire. Par exemple, vous pouvez utiliser `TinyLog`- tapez des tables pour les données intermédiaires qui sont traitées en petits lots. Notez que le stockage des données dans un grand nombre de petites tables est inefficace. - -Les requêtes sont exécutées dans un flux unique. En d'autres termes, ce moteur est destiné à des tables relativement petites (jusqu'à environ 1 000 000 de lignes). Il est logique d'utiliser ce moteur de table si vous avez beaucoup de petites tables, car il est plus simple que le [Journal](log.md) moteur (moins de fichiers doivent être ouverts). - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/fr/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/fr/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index 307e9ac3aff..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 35 -toc_title: AggregatingMergeTree ---- - -# Aggregatingmergetree {#aggregatingmergetree} - -Le moteur hérite de [MergeTree](mergetree.md#table_engines-mergetree), modifier la logique pour les parties de données Fusion. ClickHouse remplace toutes les lignes avec la même clé primaire (ou, plus précisément, avec la même [clé de tri](mergetree.md)) avec une seule ligne (dans un rayon d'une partie des données) qui stocke une combinaison d'états de fonctions d'agrégation. - -Vous pouvez utiliser `AggregatingMergeTree` tables pour l'agrégation incrémentielle des données, y compris pour les vues matérialisées agrégées. - -Le moteur traite toutes les colonnes avec [AggregateFunction](../../../sql_reference/data_types/aggregatefunction.md) type. - -Il est approprié d'utiliser `AggregatingMergeTree` si elle réduit le nombre de lignes par commande. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[TTL expr] -[SETTINGS name=value, ...] -``` - -Pour une description des paramètres de requête, voir [demande de description](../../../sql_reference/statements/create.md). - -**Les clauses de requête** - -Lors de la création d'un `AggregatingMergeTree` la table de la même [clause](mergetree.md) sont nécessaires, comme lors de la création d'un `MergeTree` table. - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -Tous les paramètres ont la même signification que dans `MergeTree`. -
- -## Sélectionner et insérer {#select-and-insert} - -Pour insérer des données, utilisez [INSERT SELECT](../../../sql_reference/statements/insert_into.md) requête avec l'ensemble-l'État des fonctions. -Lors de la sélection des données `AggregatingMergeTree` table, utilisez `GROUP BY` et les mêmes fonctions d'agrégat que lors de l'insertion de données, mais en utilisant `-Merge` suffixe. - -Dans les résultats de `SELECT` requête, les valeurs de `AggregateFunction` type ont une représentation binaire spécifique à l'implémentation pour tous les formats de sortie ClickHouse. Si les données de vidage dans, par exemple, `TabSeparated` format avec `SELECT` requête alors ce vidage peut être chargé en utilisant `INSERT` requête. - -## Exemple D'une vue matérialisée agrégée {#example-of-an-aggregated-materialized-view} - -`AggregatingMergeTree` vue matérialisée qui regarde le `test.visits` table: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -Insertion de données dans la `test.visits` table. - -``` sql -INSERT INTO test.visits ... -``` - -Les données sont insérées dans la table et la vue `test.basic` que va effectuer l'agrégation. - -Pour obtenir les données agrégées, nous devons exécuter une requête telle que `SELECT ... GROUP BY ...` à partir de la vue `test.basic`: - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/fr/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/fr/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index b58a4e7ebe8..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 36 -toc_title: CollapsingMergeTree ---- - -# Collapsingmergetree {#table_engine-collapsingmergetree} - -Le moteur hérite de [MergeTree](mergetree.md) et ajoute la logique de l'effondrement des lignes de données de pièces algorithme de fusion. - -`CollapsingMergeTree` supprime de manière asynchrone (réduit) les paires de lignes si tous les champs d'une clé de tri (`ORDER BY`) sont équivalents à l'exception du champ particulier `Sign` ce qui peut avoir `1` et `-1` valeur. Les lignes sans paire sont conservées. Pour plus de détails, voir le [Effondrer](#table_engine-collapsingmergetree-collapsing) la section du document. - -Le moteur peut réduire considérablement le volume de stockage et augmenter l'efficacité de `SELECT` requête en conséquence. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Pour une description des paramètres de requête, voir [description de la requête](../../../sql_reference/statements/create.md). - -**Paramètres CollapsingMergeTree** - -- `sign` — Name of the column with the type of row: `1` est un “state” rangée, `-1` est un “cancel” rangée. - - Column data type — `Int8`. - -**Les clauses de requête** - -Lors de la création d'un `CollapsingMergeTree` de table, de la même [les clauses de requête](mergetree.md#table_engine-mergetree-creating-a-table) sont nécessaires, comme lors de la création d'un `MergeTree` table. - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -Tous les paramètres excepté `sign` ont la même signification que dans `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` — “state” rangée, `-1` — “cancel” rangée. - - Column Data Type — `Int8`. - -
- -## Effondrer {#table_engine-collapsingmergetree-collapsing} - -### Données {#data} - -Considérez la situation où vous devez enregistrer des données en constante évolution pour un objet. Il semble logique d'avoir une ligne pour un objet et de la mettre à jour à tout changement, mais l'opération de mise à jour est coûteuse et lente pour le SGBD car elle nécessite une réécriture des données dans le stockage. Si vous avez besoin d'écrire des données rapidement, la mise à jour n'est pas acceptable, mais vous pouvez écrire les modifications d'un objet de manière séquentielle comme suit. - -Utilisez la colonne particulière `Sign`. Si `Sign = 1` cela signifie que la ligne est un état d'un objet, appelons-la “state” rangée. Si `Sign = -1` il signifie l'annulation de l'état d'un objet avec les mêmes attributs, nous allons l'appeler “cancel” rangée. - -Par exemple, nous voulons calculer combien de pages les utilisateurs ont vérifié sur un site et combien de temps ils étaient là. À un certain moment nous écrire la ligne suivante avec l'état de l'activité de l'utilisateur: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -À un moment donné, nous enregistrons le changement d'activité de l'utilisateur et l'écrivons avec les deux lignes suivantes. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -La première ligne annule le précédent état de l'objet (utilisateur). Il doit copier les champs de clé de tri de l'état annulé sauf `Sign`. - -La deuxième ligne contient l'état actuel. - -Comme nous avons besoin seulement le dernier état de l'activité de l'utilisateur, les lignes - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -peut être supprimé en réduisant l'état invalide (ancien) d'un objet. `CollapsingMergeTree` fait cela lors de la fusion des parties de données. - -Pourquoi nous avons besoin de 2 lignes pour chaque changement lu dans le [Algorithme](#table_engine-collapsingmergetree-collapsing-algorithm) paragraphe. - -**Propriétés particulières d'une telle approche** - -1. Le programme qui écrit les données doit se souvenir de l'état d'un objet pour pouvoir l'annuler. “Cancel” string doit contenir des copies des champs de clé de tri du “state” chaîne et le contraire `Sign`. Il augmente la taille initiale de stockage, mais permet d'écrire les données rapidement. -2. Les tableaux de plus en plus longs dans les colonnes réduisent l'efficacité du moteur en raison de la charge pour l'écriture. Plus les données sont simples, plus l'efficacité est élevée. -3. Le `SELECT` les résultats dépendent fortement de la cohérence de l'historique des modifications d'objet. Être précis lors de la préparation des données pour l'insertion. Vous pouvez obtenir des résultats imprévisibles dans des données incohérentes, par exemple des valeurs négatives pour des mesures non négatives telles que la profondeur de session. - -### Algorithme {#table_engine-collapsingmergetree-collapsing-algorithm} - -Lorsque ClickHouse fusionne des parties de données, chaque groupe de lignes consécutives avec la même clé de tri (`ORDER BY`) est réduit à pas plus de deux rangées, une avec `Sign = 1` (“state” ligne) et l'autre avec `Sign = -1` (“cancel” rangée). En d'autres termes, les entrées de l'effondrement. - -Pour chaque partie de données résultante clickhouse enregistre: - -1. Première “cancel” et la dernière “state” lignes, si le nombre de “state” et “cancel” lignes correspond et la dernière ligne est un “state” rangée. - -2. La dernière “state” ligne, si il y a plus de “state” les lignes de “cancel” rangée. - -3. Première “cancel” ligne, si il y a plus de “cancel” les lignes de “state” rangée. - -4. Aucune des lignes, dans tous les autres cas. - -Aussi quand il y a au moins 2 plus “state” les lignes de “cancel” les lignes, ou au moins 2 de plus “cancel” rangs puis “state” la fusion continue, mais ClickHouse traite cette situation comme une erreur logique et l'enregistre dans le journal du serveur. Cette erreur peut se produire si les mêmes données ont été insérées plus d'une fois. - -Ainsi, l'effondrement ne devrait pas changer les résultats du calcul des statistiques. -Les changements se sont progressivement effondrés de sorte qu'à la fin seul le dernier état de presque tous les objets à gauche. - -Le `Sign` est nécessaire car l'algorithme de fusion ne garantit pas que toutes les lignes avec la même clé de tri seront dans la même partie de données résultante et même sur le même serveur physique. Processus de ClickHouse `SELECT` les requêtes avec plusieurs threads, et il ne peut pas prédire l'ordre des lignes dans le résultat. L'agrégation est nécessaire s'il y a un besoin d'obtenir complètement “collapsed” les données de `CollapsingMergeTree` table. - -Pour finaliser la réduction, écrivez une requête avec `GROUP BY` fonctions de clause et d'agrégation qui tiennent compte du signe. Par exemple, pour calculer la quantité, l'utilisation `sum(Sign)` plutôt `count()`. Pour calculer la somme de quelque chose, utilisez `sum(Sign * x)` plutôt `sum(x)` et ainsi de suite , et également ajouter `HAVING sum(Sign) > 0`. - -Aggregate `count`, `sum` et `avg` pourrait être calculée de cette manière. Aggregate `uniq` peut être calculé si un objet a au moins un état non réduit. Aggregate `min` et `max` impossible de calculer parce que `CollapsingMergeTree` n'enregistre pas l'historique des valeurs des États réduits. - -Si vous avez besoin d'extraire des données sans agrégation (par exemple, pour vérifier si des lignes sont présentes dont les valeurs les plus récentes correspondent à certaines conditions), vous pouvez utiliser `FINAL` le modificateur du `FROM` clause. Cette approche est nettement moins efficace. - -## Exemple D'Utilisation {#example-of-use} - -Les données de l'exemple: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Création de la table: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Insertion des données: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -Nous utilisons deux `INSERT` requêtes pour créer deux parties de données différentes. Si nous insérons les données avec une requête, ClickHouse crée une partie de données et n'effectuera aucune fusion. - -L'obtention de données: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Que voyons-nous et où s'effondre? - -Avec deux `INSERT` requêtes, nous avons créé 2 parties de données. Le `SELECT` la requête a été effectuée dans 2 threads, et nous avons obtenu un ordre aléatoire de lignes. L'effondrement n'a pas eu lieu car il n'y avait pas encore de fusion des parties de données. ClickHouse fusionne une partie des données dans un moment inconnu que nous ne pouvons pas prédire. - -Nous avons donc besoin d'agrégation: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -Si nous n'avons pas besoin d'agrégation et de vouloir forcer l'effondrement, nous pouvons utiliser `FINAL` le modificateur `FROM` clause. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Cette façon de sélectionner les données est très inefficace. Ne l'utilisez pas pour les grandes tables. - -## Exemple D'Une Autre Approche {#example-of-another-approach} - -Les données de l'exemple: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ -5 │ -146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -L'idée est que les fusions ne prennent en compte que les champs clés. Et dans le “Cancel” ligne nous pouvons spécifier des valeurs négatives qui égalisent la version précédente de la ligne lors de la sommation sans utiliser la colonne de signe. Pour cette approche, il est nécessaire de changer le type de données `PageViews`,`Duration` pour stocker les valeurs négatives de UInt8 - \> Int16. - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews Int16, - Duration Int16, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Nous allons tester l'approche: - -``` sql -insert into UAct values(4324182021466249494, 5, 146, 1); -insert into UAct values(4324182021466249494, -5, -146, -1); -insert into UAct values(4324182021466249494, 6, 185, 1); - -select * from UAct final; // avoid using final in production (just for a test or small tables) -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -``` sql -SELECT - UserID, - sum(PageViews) AS PageViews, - sum(Duration) AS Duration -FROM UAct -GROUP BY UserID -```text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -``` sqk -select count() FROM UAct -``` - -``` text -┌─count()─┐ -│ 3 │ -└─────────┘ -``` - -``` sql -optimize table UAct final; - -select * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/fr/engines/table_engines/mergetree_family/custom_partitioning_key.md b/docs/fr/engines/table_engines/mergetree_family/custom_partitioning_key.md deleted file mode 100644 index 499d71f3f00..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 32 -toc_title: "Cl\xE9 De Partitionnement Personnalis\xE9e" ---- - -# Clé De Partitionnement Personnalisée {#custom-partitioning-key} - -Le partitionnement est disponible pour [MergeTree](mergetree.md) table de famille (y compris les [répliqué](replication.md) table). [Les vues matérialisées](../special/materializedview.md) basé sur les tables MergeTree prennent également en charge le partitionnement. - -Une partition est une combinaison logique d'enregistrements dans une table selon un critère spécifié. Vous pouvez définir une partition par un critère arbitraire, comme, par mois, par jour, ou par type d'événement. Chaque partition est stockée séparément pour simplifier les manipulations de ces données. Lors de l'accès aux données, ClickHouse utilise le plus petit sous-ensemble de partitions possible. - -La partition est spécifiée dans le `PARTITION BY expr` clause lors de [création d'une table](mergetree.md#table_engine-mergetree-creating-a-table). La clé de partition peut être n'importe quelle expression des colonnes de la table. Par exemple, pour spécifier le partitionnement par mois, utilisez l'expression `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour; -``` - -La clé de partition peut également être un tuple d'expressions (similaire à la [clé primaire](mergetree.md#primary-keys-and-indexes-in-queries)). Exemple: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -Dans cet exemple, nous définissons le partitionnement par les types d'événements qui se sont produits au cours de la semaine en cours. - -Lors de l'insertion de nouvelles données dans une table, ces données sont stockées en tant que partie séparée (bloc) triée par la clé primaire. Dans 10-15 minutes après l'insertion, les parties de la même partition sont fusionnées dans la partie entière. - -!!! info "Info" - Une fusion ne fonctionne que pour les parties de données qui ont la même valeur pour l'expression de partitionnement. Cela signifie **vous ne devriez pas faire des partitions trop granulaires** (plus d'un millier de partitions). Sinon, l' `SELECT` la requête fonctionne mal en raison d'un nombre déraisonnablement élevé de fichiers dans le système de fichiers et des descripteurs de fichiers ouverts. - -L'utilisation de la [système.partie](../../../operations/system_tables.md#system_tables-parts) table pour afficher les parties et les partitions de la table. Par exemple, supposons que nous avons une `visits` table avec partitionnement par mois. Nous allons effectuer le `SELECT` la requête pour l' `system.parts` table: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 1 │ -│ 201902 │ 201902_11_11_0 │ 1 │ -└───────────┴────────────────┴────────┘ -``` - -Le `partition` colonne contient les noms des partitions. Il y a deux partitions dans cet exemple: `201901` et `201902`. Vous pouvez utiliser cette valeur de colonne pour spécifier le nom de [ALTER … PARTITION](#alter_manipulations-with-partitions) requête. - -Le `name` colonne contient les noms des parties de données de partition. Vous pouvez utiliser cette colonne pour spécifier le nom de la partie dans la [ALTER ATTACH PART](#alter_attach-partition) requête. - -Décomposons le nom de la première partie: `201901_1_3_1`: - -- `201901` est le nom de la partition. -- `1` est le nombre minimum du bloc de données. -- `3` est le nombre maximal de blocs de données. -- `1` est le niveau de bloc (la profondeur de l'arbre de fusion à partir duquel il est formé). - -!!! info "Info" - Les parties des tables de type ancien ont le nom: `20190117_20190123_2_2_0` (date minimale - date maximale - numéro de bloc minimum - numéro de bloc maximum-niveau). - -Le `active` colonne indique le statut de la partie. `1` est active; `0` est inactif. Les parties inactives sont, par exemple, des parties source restant après la fusion à une partie plus grande. Les parties de données corrompues sont également indiquées comme inactives. - -Comme vous pouvez le voir dans l'exemple, il y a plusieurs parties séparées de la même partition (par exemple, `201901_1_3_1` et `201901_1_9_2`). Cela signifie que ces parties ne sont pas encore fusionnées. Clickhouse fusionne les parties insérées des données périodiquement, environ 15 minutes après l'insertion. En outre, vous pouvez effectuer une fusion non planifiée en utilisant [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) requête. Exemple: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 0 │ -│ 201902 │ 201902_4_11_2 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 0 │ -│ 201902 │ 201902_11_11_0 │ 0 │ -└───────────┴────────────────┴────────┘ -``` - -Les parties inactives seront supprimées environ 10 minutes après la fusion. - -Une autre façon d'afficher un ensemble de pièces et de partitions est d'aller dans le répertoire de la table: `/var/lib/clickhouse/data///`. Exemple: - -``` bash -/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -Dossier ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ et ainsi de suite sont les répertoires des parties. Chaque partie se rapporte à une partition correspondante et contient des données juste pour un certain mois (la table dans cet exemple a partitionnement par mois). - -Le `detached` le répertoire contient des parties qui ont été détachées de la table à l'aide [DETACH](#alter_detach-partition) requête. Les parties corrompues sont également déplacées dans ce répertoire, au lieu d'être supprimées. Le serveur n'utilise pas les pièces de la `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql_reference/statements/alter.md#alter_attach-partition) requête. - -Notez que sur le serveur d'exploitation, vous ne pouvez pas modifier manuellement l'ensemble de pièces ou leurs données sur le système de fichiers, car le serveur ne le saura pas. Pour les tables non répliquées, vous pouvez le faire lorsque le serveur est arrêté, mais ce n'est pas recommandé. Pour les tables répliquées, l'ensemble de pièces ne peut en aucun cas être modifié. - -ClickHouse vous permet d'effectuer des opérations avec les partitions: les supprimer, copier d'une table à une autre, ou créer une sauvegarde. Voir la liste de toutes les opérations de la section [Manipulations avec des Partitions et des pièces](../../../sql_reference/statements/alter.md#alter_manipulations-with-partitions). - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/fr/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/fr/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index e0cb60c088f..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 38 -toc_title: GraphiteMergeTree ---- - -# Graphitemergetree {#graphitemergetree} - -Ce moteur est conçu pour l'amincissement et l'agrégation / moyenne (cumul) [Graphite](http://graphite.readthedocs.io/en/latest/index.html) données. Il peut être utile aux développeurs qui veulent utiliser ClickHouse comme un magasin de données pour Graphite. - -Vous pouvez utiliser N'importe quel moteur de table ClickHouse pour stocker les données Graphite si vous n'avez pas besoin de cumul, mais si vous avez besoin d'un cumul, utilisez `GraphiteMergeTree`. Le moteur réduit le volume de stockage et augmente l'efficacité des requêtes de Graphite. - -Le moteur hérite des propriétés de [MergeTree](mergetree.md). - -## Création d'une Table {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Voir une description détaillée de la [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) requête. - -Un tableau pour les données de Graphite devrait avoir les colonnes suivantes pour les données suivantes: - -- Nom métrique (Capteur De Graphite). Type de données: `String`. - -- Temps de mesure de la métrique. Type de données: `DateTime`. - -- La valeur de la métrique. Type de données: tout numérique. - -- La Version de la métrique. Type de données: tout numérique. - - ClickHouse enregistre les lignes avec la version la plus élevée ou la dernière écrite si les versions sont les mêmes. Les autres lignes sont supprimées lors de la fusion des parties de données. - -Les noms de ces colonnes doivent être définis dans la configuration de cumul. - -**GraphiteMergeTree paramètres** - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -**Les clauses de requête** - -Lors de la création d'un `GraphiteMergeTree` de table, de la même [clause](mergetree.md#table_engine-mergetree-creating-a-table) sont nécessaires, comme lors de la création d'un `MergeTree` table. - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -Tous les paramètres excepté `config_section` ont la même signification que dans `MergeTree`. - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -
- -## Configuration De Cumul {#rollup-configuration} - -Les paramètres de cumul sont définis par [graphite\_rollup](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) paramètre dans la configuration du serveur. Le nom du paramètre pourrait être tout. Vous pouvez créer plusieurs configurations et les utiliser pour différentes tables. - -Structure de configuration de cumul: - - required-columns - patterns - -### Les Colonnes Requises {#required-columns} - -- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. -- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. -- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Valeur par défaut: `Value`. -- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. - -### Modèle {#patterns} - -La Structure de la `patterns` section: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "Attention" - Les motifs doivent être strictement commandés: - - 1. Patterns without `function` or `retention`. - 1. Patterns with both `function` and `retention`. - 1. Pattern `default`. - -Lors du traitement d'une ligne, ClickHouse vérifie les règles `pattern` section. Chacun `pattern` (comprendre `default`) les articles peuvent contenir des `function` paramètre d'agrégation, `retention` les paramètres ou les deux à la fois. Si le nom de la métrique correspond `regexp` les règles de la `pattern` section (ou sections) sont appliquées; sinon, les règles de la `default` section sont utilisés. - -Champs pour `pattern` et `default` section: - -- `regexp`– A pattern for the metric name. -- `age` – The minimum age of the data in seconds. -- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). -- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. - -### Exemple De Configuration {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/fr/engines/table_engines/mergetree_family/mergetree.md b/docs/fr/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index f45d072c4c0..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,654 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 30 -toc_title: MergeTree ---- - -# Mergetree {#table_engines-mergetree} - -Le `MergeTree` moteur et autres moteurs de cette famille (`*MergeTree`) sont les moteurs de table ClickHouse les plus robustes. - -Les moteurs de la `MergeTree` famille sont conçus pour l'insertion d'une très grande quantité de données dans une table. Les données sont rapidement écrites dans la table partie par partie, puis des règles sont appliquées pour fusionner les parties en arrière-plan. Cette méthode est beaucoup plus efficace que de réécrire continuellement les données dans le stockage pendant l'insertion. - -Principales caractéristiques: - -- Stocke les données triées par clé primaire. - - Cela vous permet de créer un petit index clairsemé qui aide à trouver les données plus rapidement. - -- Les Partitions peuvent être utilisées si [clé de partitionnement](custom_partitioning_key.md) est spécifié. - - ClickHouse prend en charge certaines opérations avec des partitions plus efficaces que les opérations générales sur les mêmes données avec le même résultat. ClickHouse Coupe également automatiquement les données de partition où la clé de partitionnement est spécifiée dans la requête. Cela améliore également les performances de la requête. - -- Prise en charge de la réplication des données. - - La famille de `ReplicatedMergeTree` tables fournit la réplication des données. Pour plus d'informations, voir [Réplication des données](replication.md). - -- Appui d'échantillonnage de données. - - Si nécessaire, vous pouvez définir la méthode d'échantillonnage des données dans le tableau. - -!!! info "Info" - Le [Fusionner](../special/merge.md) le moteur n'appartient pas à la `*MergeTree` famille. - -## Création d'une Table {#table_engine-mergetree-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 -) ENGINE = MergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] -[SETTINGS name=value, ...] -``` - -Pour une description des paramètres, voir [Créer une description de requête](../../../sql_reference/statements/create.md). - -!!! note "Note" - `INDEX` est une fonctionnalité expérimentale, voir [Index De Saut De Données](#table_engine-mergetree-data_skipping-indexes). - -### Les Clauses De Requête {#mergetree-query-clauses} - -- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. Le `MergeTree` le moteur n'a pas de paramètres. - -- `PARTITION BY` — The [clé de partitionnement](custom_partitioning_key.md). - - Pour le partitionnement par mois, utilisez les `toYYYYMM(date_column)` l'expression, où `date_column` est une colonne avec une date du type [Date](../../../sql_reference/data_types/date.md). Les noms de partition ici ont le `"YYYYMM"` format. - -- `ORDER BY` — The sorting key. - - Un tuple de colonnes ou d'expressions arbitraires. Exemple: `ORDER BY (CounterID, EventDate)`. - -- `PRIMARY KEY` — The primary key if it [diffère de la clé de tri](#choosing-a-primary-key-that-differs-from-the-sorting-key). - - Par défaut, la clé primaire est la même que la clé de tri (qui est spécifiée par `ORDER BY` clause). Ainsi dans la plupart des cas il n'est pas nécessaire de spécifier un `PRIMARY KEY` clause. - -- `SAMPLE BY` — An expression for sampling. - - Si un échantillonnage expression est utilisée, la clé primaire doit contenir. Exemple: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. - -- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [entre disques et volumes](#table_engine-mergetree-multiple-volumes). - - L'Expression doit en avoir une `Date` ou `DateTime` colonne comme un résultat. Exemple: - `TTL date + INTERVAL 1 DAY` - - Le Type de la règle `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` spécifie une action à effectuer avec la partie si l'expression est satisfaite (atteint l'heure actuelle): suppression des Lignes expirées, déplacement d'une partie (si l'expression est satisfaite pour toutes les lignes d'une partie) sur le disque spécifié (`TO DISK 'xxx'`) ou de volume (`TO VOLUME 'xxx'`). Le type par défaut de la règle est suppression (`DELETE`). Liste de règles multiples peut spécifié, mais il ne devrait pas y avoir plus d'un `DELETE` règle. - - Pour plus de détails, voir [TTL pour les colonnes et les tableaux](#table_engine-mergetree-ttl) - -- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: - - - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Le Stockage De Données](#mergetree-data-storage). - - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Le Stockage De Données](#mergetree-data-storage). - - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` paramètre. Avant la version 19.11, il n'y avait que le `index_granularity` réglage pour restreindre la taille des granules. Le `index_granularity_bytes` le paramètre améliore les performances de ClickHouse lors de la sélection de données à partir de tables avec de grandes lignes (des dizaines et des centaines de mégaoctets). Si vous avez des tables avec de grandes lignes, vous pouvez activer ce paramètre pour les tables d'améliorer l'efficacité de `SELECT` requête. - - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, puis Zookeeper stocke moins de données. Pour plus d'informations, voir le [Description du réglage](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) dans “Server configuration parameters”. - - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` octets, ClickHouse lit et écrit les données sur le disque de stockage en utilisant l'interface d'E/S directe (`O_DIRECT` option). Si `min_merge_bytes_to_use_direct_io = 0`, puis les e/s directes sont désactivées. Valeur par défaut: `10 * 1024 * 1024 * 1024` octet. - - - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). - - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don't turn it off. - - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. - - `storage_policy` — Storage policy. See [Utilisation de plusieurs périphériques de bloc pour le stockage de données](#table_engine-mergetree-multiple-volumes). - -**Exemple de réglage des Sections** - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 -``` - -Dans l'exemple, nous définissons le partitionnement par mois. - -Nous définissons également une expression pour l'échantillonnage en tant que hachage par l'ID utilisateur. Cela vous permet de pseudorandomiser les données dans la table pour chaque `CounterID` et `EventDate`. Si vous définissez un [SAMPLE](../../../sql_reference/statements/select.md#select-sample-clause) clause lors de la sélection des données, ClickHouse retournera un échantillon de données uniformément pseudo-aléatoire pour un sous-ensemble d'utilisateurs. - -Le `index_granularity` paramètre peut être omis, car 8192 est la valeur par défaut. - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets. Si possible, optez anciens projets à la méthode décrite ci-dessus. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -**Paramètres MergeTree ()** - -- `date-column` — The name of a column of the [Date](../../../sql_reference/data_types/date.md) type. ClickHouse crée automatiquement des partitions par mois en fonction de cette colonne. Les noms de partition sont dans le `"YYYYMM"` format. -- `sampling_expression` — An expression for sampling. -- `(primary, key)` — Primary key. Type: [Tuple()](../../../sql_reference/data_types/tuple.md) -- `index_granularity` — The granularity of an index. The number of data rows between the “marks” d'un index. La valeur 8192 est appropriée pour la plupart des tâches. - -**Exemple** - -``` sql -MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) -``` - -Le `MergeTree` le moteur est configuré de la même manière que dans l'exemple ci-dessus pour la méthode de configuration du moteur principal. -
- -## Le Stockage De Données {#mergetree-data-storage} - -Une table se compose de parties de données triées par clé primaire. - -Lorsque des données sont insérées dans une table, des parties de données distinctes sont créées et chacune d'elles est lexicographiquement triée par clé primaire. Par exemple, si la clé primaire est `(CounterID, Date)`, les données de la pièce sont triées par `CounterID` et au sein de chaque `CounterID` il est commandé par `Date`. - -Les données appartenant à différentes partitions sont séparés en différentes parties. En arrière-plan, ClickHouse fusionne des parties de données pour un stockage plus efficace. Les parties appartenant à des partitions différentes ne sont pas fusionnées. La fusion mécanisme ne garantit pas que toutes les lignes avec la même clé primaire sera dans la même partie des données. - -Chaque partie de données est logiquement divisée en granules. Un granule est le plus petit ensemble de données indivisible que ClickHouse lit lors de la sélection des données. ClickHouse ne divise pas les lignes ou les valeurs, de sorte que chaque granule contient toujours un nombre entier de lignes. La première rangée de granules est marqué avec la valeur de la clé primaire de la ligne. Pour chaque partie de données, ClickHouse crée un fichier d'index qui stocke les marques. Pour chaque colonne, que ce soit dans la clé primaire ou non, ClickHouse stocke également les mêmes marques. Ces marques vous permettent de trouver des données directement dans les fichiers de colonnes. - -La taille de granule est limitée par `index_granularity` et `index_granularity_bytes` paramètres du moteur de table. Le nombre de lignes dans un granule jette dans la `[1, index_granularity]` gamme, en fonction de la taille des lignes. La taille des granulés peut dépasser `index_granularity_bytes` si la taille d'une seule ligne est supérieure à la valeur du paramètre. Dans ce cas, la taille du granule est égale à la taille de la ligne. - -## Clés primaires et Index dans les requêtes {#primary-keys-and-indexes-in-queries} - -Prendre la `(CounterID, Date)` clé primaire comme un exemple. Dans ce cas, le tri et l'index peuvent être illustrés comme suit: - - Whole data: [---------------------------------------------] - CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] - Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] - Marks: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 - Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 - -Si la requête de données spécifie: - -- `CounterID in ('a', 'h')` le serveur lit les données dans les gammes des marques `[0, 3)` et `[6, 8)`. -- `CounterID IN ('a', 'h') AND Date = 3` le serveur lit les données dans les gammes des marques `[1, 3)` et `[7, 8)`. -- `Date = 3`, le serveur lit les données de la plage de marque `[1, 10]`. - -Les exemples ci-dessus montrent qu'il est toujours plus efficace d'utiliser un indice qu'une analyse complète. - -Un index clairsemé permet de lire des données supplémentaires. Lors de la lecture d'une plage unique de la clé primaire, jusqu'à `index_granularity * 2` lignes supplémentaires dans chaque bloc de données peut être lu. - -Les index clairsemés vous permettent de travailler avec un très grand nombre de lignes de table, car dans la plupart des cas, ces index tiennent dans la RAM de l'ordinateur. - -ClickHouse ne nécessite pas de clé primaire unique. Vous pouvez insérer plusieurs lignes avec la même clé primaire. - -### Sélection de la clé primaire {#selecting-the-primary-key} - -Le nombre de colonnes de la clé primaire n'est pas explicitement limitée. Selon la structure de données, vous pouvez inclure plus ou moins de colonnes dans la clé primaire. Cela peut: - -- Améliorer la performance d'un indice. - - Si la clé primaire est `(a, b)`, puis ajouter une autre colonne `c` pour améliorer les performances si les conditions suivantes sont réunies: - - - Il y a des requêtes avec une condition sur la colonne `c`. - - Longues plages de données (plusieurs fois plus longues que `index_granularity`) avec des valeurs identiques pour `(a, b)` sont communs. En d'autres termes, lors de l'ajout d'une autre colonne vous permet de passer très longues plages de données. - -- Améliorer la compression des données. - - ClickHouse trie les données par clé primaire, donc plus la cohérence est élevée, meilleure est la compression. - -- Fournir une logique supplémentaire lors de la fusion de parties de [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) et [SummingMergeTree](summingmergetree.md) moteur. - - Dans ce cas, on peut spécifier l' *clé de tri* qui est différente de la clé primaire. - -Une clé primaire longue affectera négativement les performances d'insertion et la consommation de mémoire, mais des colonnes supplémentaires dans la clé primaire n'affecteront pas les performances de ClickHouse pendant `SELECT` requête. - -### Choisir une clé primaire qui diffère de la clé de tri {#choosing-a-primary-key-that-differs-from-the-sorting-key} - -Il est possible de spécifier une clé primaire (une expression avec des valeurs qui sont écrites dans le fichier d'index pour chaque marque) qui est différente de la clé de tri (une expression pour trier les lignes dans les parties de données). Dans ce cas, le tuple d'expression de clé primaire doit être un préfixe du tuple d'expression de clé de tri. - -Cette fonctionnalité est utile lorsque vous utilisez le [SummingMergeTree](summingmergetree.md) et -[AggregatingMergeTree](aggregatingmergetree.md) table des moteurs. Dans un cas courant lors de l'utilisation de ces moteurs, la table a deux types de colonnes: *dimension* et *mesure*. Les requêtes typiques agrégent les valeurs des colonnes de mesure avec arbitraire `GROUP BY` et filtrage par dimensions. Comme SummingMergeTree et AggregatingMergeTree regroupent des lignes avec la même valeur de la clé de tri, il est naturel d'y ajouter toutes les dimensions. En conséquence, l'expression se compose d'une longue liste de colonnes, et cette liste doit être mise à jour fréquemment avec nouvellement ajoutée. - -Dans ce cas, il est logique de ne laisser que quelques colonnes dans la clé primaire qui fourniront des analyses de plage efficaces et ajouteront les colonnes de dimension restantes au tuple de clé de tri. - -[ALTER](../../../sql_reference/statements/alter.md) la clé de tri est une opération légère car lorsqu'une nouvelle colonne est ajoutée simultanément à la table et à la clé de tri, les parties de données existantes n'ont pas besoin d'être modifiées. Comme l'ancienne clé de tri est un préfixe de la nouvelle clé de tri et qu'il n'y a pas de données dans la colonne nouvellement ajoutée, les données sont triées à la fois par l'ancienne et la nouvelle clé de tri au moment de la modification de la table. - -### Utilisation D'Index et de Partitions dans les requêtes {#use-of-indexes-and-partitions-in-queries} - -Pour `SELECT` requêtes, clickhouse analyse si un index peut être utilisé. Un index peut être utilisé si le `WHERE/PREWHERE` clause a une expression (comme l'un des éléments de conjonction, ou entièrement) qui représente une opération de comparaison d'égalité ou d'inégalité, ou si elle a `IN` ou `LIKE` avec un préfixe fixe sur les colonnes ou les expressions qui sont dans la clé primaire ou la clé de partitionnement, ou sur certaines fonctions partiellement répétitives de ces colonnes, ou les relations logiques de ces expressions. - -Ainsi, il est possible d'exécuter des requêtes sur une ou plusieurs plages de la clé primaire. Dans cet exemple, les requêtes seront rapides lorsqu'elles sont exécutées pour une balise de suivi spécifique, pour une balise et une plage de dates spécifiques, pour une balise et une date spécifiques, pour plusieurs balises avec une plage de dates, etc. - -Regardons le moteur configuré comme suit: - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 - -Dans ce cas, dans les requêtes: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -ClickHouse utilisera l'index de clé primaire pour supprimer les données incorrectes et la clé de partitionnement mensuel pour supprimer les partitions qui se trouvent dans des plages de dates incorrectes. - -Les requêtes ci-dessus montrent que l'index est utilisé même pour les expressions complexes. La lecture de la table est organisée de sorte que l'utilisation de l'index ne peut pas être plus lente qu'une analyse complète. - -Dans l'exemple ci-dessous, l'index ne peut pas être utilisé. - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -Pour vérifier si ClickHouse pouvez utiliser l'index lors de l'exécution d'une requête, utilisez les paramètres [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) et [force\_primary\_key](../../../operations/settings/settings.md). - -La clé de partitionnement par mois permet de lire uniquement les blocs de données qui contiennent des dates de la plage appropriée. Dans ce cas, le bloc de données peut contenir des données pour plusieurs dates (jusqu'à un mois entier). Dans un bloc, les données sont triées par clé primaire, qui peut ne pas contenir la date comme première colonne. Pour cette raison, l'utilisation d'une requête avec seulement une condition de date qui ne spécifie pas le préfixe de clé primaire entraînera la lecture de plus de données que pour une seule date. - -### Utilisation de L'Index pour les clés primaires partiellement monotones {#use-of-index-for-partially-monotonic-primary-keys} - -Considérons, par exemple, les jours du mois. Ils forment un [monotone de la séquence](https://en.wikipedia.org/wiki/Monotonic_function) pendant un mois, mais pas monotone pendant des périodes plus longues. C'est une séquence partiellement monotone. Si un utilisateur crée la table avec une clé primaire partiellement monotone, ClickHouse crée un index clairsemé comme d'habitude. Lorsqu'un utilisateur sélectionne des données à partir de ce type de table, ClickHouse analyse les conditions de requête. Si L'utilisateur veut obtenir des données entre deux marques de l'index et que ces deux marques tombent dans un mois, ClickHouse peut utiliser l'index dans ce cas particulier car il peut calculer la distance entre les paramètres d'une requête et les marques d'index. - -ClickHouse ne peut pas utiliser un index si les valeurs de la clé primaire dans la plage de paramètres de requête ne représentent pas une séquence monotone. Dans ce cas, ClickHouse utilise la méthode full scan. - -ClickHouse utilise cette logique non seulement pour les séquences de jours du mois, mais pour toute clé primaire qui représente une séquence partiellement monotone. - -### Index de saut de données (expérimental) {#table_engine-mergetree-data_skipping-indexes} - -La déclaration d'index se trouve dans la section colonnes du `CREATE` requête. - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -Pour les tables de la `*MergeTree` famille, les indices de saut de données peuvent être spécifiés. - -Ces indices agrégent certaines informations sur l'expression spécifiée sur les blocs, qui consistent en `granularity_value` granules (la taille du granule est spécifiée en utilisant `index_granularity` réglage dans le moteur de table). Ensuite, ces agrégats sont utilisés dans `SELECT` requêtes pour réduire la quantité de données à lire à partir du disque en ignorant de gros blocs de données `where` la requête ne peut pas être satisfait. - -**Exemple** - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -Les Indices de L'exemple peuvent être utilisés par ClickHouse pour réduire la quantité de données à lire à partir du disque dans les requêtes suivantes: - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### Types D'Indices Disponibles {#available-types-of-indices} - -- `minmax` - - Magasins extrêmes de l'expression spécifiée (si l'expression est `tuple` puis il stocke les extrêmes pour chaque élément de `tuple`), utilise les informations stockées pour sauter des blocs de données comme la clé primaire. - -- `set(max_rows)` - - Stocke les valeurs uniques de l'expression spécifiée (pas plus de `max_rows` rangée, `max_rows=0` moyen “no limits”). Utilise les valeurs pour vérifier si le `WHERE` l'expression n'est pas satisfiable sur un bloc de données. - -- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - Magasins un [Filtre de Bloom](https://en.wikipedia.org/wiki/Bloom_filter) qui contient tous les ngrams d'un bloc de données. Fonctionne uniquement avec des chaînes. Peut être utilisé pour l'optimisation de `equals`, `like` et `in` expression. - - - `n` — ngram size, - - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). - - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. - - `random_seed` — The seed for Bloom filter hash functions. - -- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - Le même que `ngrambf_v1`, mais stocke des jetons au lieu de ngrams. Les jetons sont des séquences séparées par des caractères non alphanumériques. - -- `bloom_filter([false_positive])` — Stores a [Filtre de Bloom](https://en.wikipedia.org/wiki/Bloom_filter) pour les colonnes spécifiées. - - Facultatif `false_positive` le paramètre est la probabilité de recevoir une réponse faussement positive du filtre. Valeurs possibles: (0, 1). Valeur par défaut: 0.025. - - Types de données pris en charge: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. - - Les fonctions suivantes peuvent l'utiliser: [égal](../../../sql_reference/functions/comparison_functions.md), [notEquals](../../../sql_reference/functions/comparison_functions.md), [dans](../../../sql_reference/functions/in_functions.md), [notIn](../../../sql_reference/functions/in_functions.md), [avoir](../../../sql_reference/functions/array_functions.md). - - - -``` sql -INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 -INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 -``` - -#### Les Fonctions De Soutien {#functions-support} - -Les Conditions dans le `WHERE` la clause contient des appels des fonctions qui fonctionnent avec des colonnes. Si la colonne fait partie d'un index, ClickHouse essaie d'utiliser cet index lors de l'exécution des fonctions. ClickHouse prend en charge différents sous-ensembles de fonctions pour l'utilisation d'index. - -Le `set` l'indice peut être utilisé avec toutes les fonctions. Les sous-ensembles de fonctions pour les autres index sont présentés dans le tableau ci-dessous. - -| Fonction (opérateur) / Indice de | clé primaire | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | -|--------------------------------------------------------------------------------------------------------------|--------------|--------|-------------|-------------|---------------| -| [égal (=, ==)](../../../sql_reference/functions/comparison_functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notEquals (!=, \<\>)](../../../sql_reference/functions/comparison_functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [comme](../../../sql_reference/functions/string_search_functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [notLike](../../../sql_reference/functions/string_search_functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [startsWith](../../../sql_reference/functions/string_functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [endsWith](../../../sql_reference/functions/string_functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [multiSearchAny](../../../sql_reference/functions/string_search_functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | -| [dans](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notIn](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [peu (\<)](../../../sql_reference/functions/comparison_functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [grand (\>)](../../../sql_reference/functions/comparison_functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [lessOrEquals (\<=)](../../../sql_reference/functions/comparison_functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [greaterOrEquals ( \> =)](../../../sql_reference/functions/comparison_functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [vide](../../../sql_reference/functions/array_functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [notEmpty](../../../sql_reference/functions/array_functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | - -Les fonctions avec un argument constant inférieur à la taille ngram ne peuvent pas être utilisées par `ngrambf_v1` pour l'optimisation de la requête. - -Les filtres Bloom peuvent avoir des correspondances faussement positives, de sorte que le `ngrambf_v1`, `tokenbf_v1`, et `bloom_filter` les index ne peuvent pas être utilisés pour optimiser les requêtes où le résultat d'une fonction est censé être faux, par exemple: - -- Peut être optimisé: - - `s LIKE '%test%'` - - `NOT s NOT LIKE '%test%'` - - `s = 1` - - `NOT s != 1` - - `startsWith(s, 'test')` -- Ne peut pas être optimisé: - - `NOT s LIKE '%test%'` - - `s NOT LIKE '%test%'` - - `NOT s = 1` - - `s != 1` - - `NOT startsWith(s, 'test')` - -## Accès Simultané Aux Données {#concurrent-data-access} - -Pour l'accès aux tables simultanées, nous utilisons le multi-versioning. En d'autres termes, lorsqu'une table est lue et mise à jour simultanément, les données sont lues à partir d'un ensemble de parties en cours au moment de la requête. Il n'y a pas de longues mèches. Les Inserts ne gênent pas les opérations de lecture. - -Lecture à partir d'un tableau est automatiquement parallélisée. - -## TTL pour les colonnes et les tableaux {#table_engine-mergetree-ttl} - -Détermine la durée de vie de des valeurs. - -Le `TTL` clause peut être définie pour la table entière et pour chaque colonne individuelle. Ttl de niveau Table peut également spécifier la logique de déplacement automatique des données entre les disques et les volumes. - -Les Expressions doivent évaluer pour [Date](../../../sql_reference/data_types/date.md) ou [DateTime](../../../sql_reference/data_types/datetime.md) type de données. - -Exemple: - -``` sql -TTL time_column -TTL time_column + interval -``` - -Définir `interval`, utiliser [intervalle](../../../sql_reference/operators.md#operators-datetime) opérateur. - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### Colonne TTL {#mergetree-column-ttl} - -Lorsque les valeurs de la colonne expirent, ClickHouse les remplace par les valeurs par défaut du type de données de la colonne. Si toutes les valeurs de colonne de la partie données expirent, ClickHouse supprime cette colonne de la partie données d'un système de fichiers. - -Le `TTL` la clause ne peut pas être utilisée pour les colonnes clés. - -Exemple: - -Création d'une table avec TTL - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -Ajout de TTL à une colonne d'une table existante - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -Modification de TTL de la colonne - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### Tableau TTL {#mergetree-table-ttl} - -Table peut avoir une expression pour la suppression de Lignes expirées, et plusieurs expressions pour le déplacement automatique de pièces entre [disques ou volumes](#table_engine-mergetree-multiple-volumes). Lorsque les lignes de la table expirent, ClickHouse supprime toutes les lignes correspondantes. Pour les pièces en mouvement, toutes les lignes d'une pièce doivent satisfaire aux critères d'expression de mouvement. - -``` sql -TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... -``` - -Type de règle TTL peut suivre chaque expression TTL. Il affecte une action qui doit être faite une fois que l'expression est satisfaite (atteint l'heure actuelle): - -- `DELETE` - supprimer les Lignes expirées (action par défaut); -- `TO DISK 'aaa'` - déplacer la partie sur le disque `aaa`; -- `TO VOLUME 'bbb'` - déplacer la partie sur le disque `bbb`. - -Exemple: - -Création d'une table avec TTL - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH [DELETE], - d + INTERVAL 1 WEEK TO VOLUME 'aaa', - d + INTERVAL 2 WEEK TO DISK 'bbb'; -``` - -Modification de TTL de la table - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**Suppression De Données** - -Les données avec un TTL expiré sont supprimées lorsque ClickHouse fusionne des parties de données. - -Lorsque ClickHouse voit que les données sont expirées, il effectue une fusion hors calendrier. Pour contrôler la fréquence de ces fusions, vous pouvez définir [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). Si la valeur est trop faible, il effectuera de nombreuses fusions hors calendrier qui peuvent consommer beaucoup de ressources. - -Si vous effectuez la `SELECT` requête entre les fusionne, vous pouvez obtenir des données expirées. Pour éviter cela, utilisez la [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) requête avant de l' `SELECT`. - -## Utilisation De Plusieurs Périphériques De Bloc Pour Le Stockage De Données {#table_engine-mergetree-multiple-volumes} - -### Introduction {#introduction} - -`MergeTree` les moteurs de table de famille peuvent stocker des données sur plusieurs périphériques de bloc. Par exemple, il peut être utile lorsque les données d'un tableau sont implicitement divisé en “hot” et “cold”. Les données les plus récentes sont régulièrement demandées mais ne nécessitent qu'une petite quantité d'espace. Au contraire, les données historiques à queue grasse sont rarement demandées. Si plusieurs disques sont disponibles, la “hot” les données peuvent être situées sur des disques rapides (par exemple, SSD NVMe ou en mémoire), tandis que le “cold” des données relativement lente (par exemple, disque dur). - -La partie de données est l'unité mobile minimum pour `MergeTree`-tables de moteur. Les données appartenant à une partie sont stockées sur un disque. Les parties de données peuvent être déplacées entre les disques en arrière-plan (selon les paramètres de l'utilisateur) ainsi qu'au moyen du [ALTER](../../../sql_reference/statements/alter.md#alter_move-partition) requête. - -### Terme {#terms} - -- Disk — Block device mounted to the filesystem. -- Default disk — Disk that stores the path specified in the [chemin](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) paramètre de serveur. -- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). -- Storage policy — Set of volumes and the rules for moving data between them. - -Les noms donnés aux entités décrites peuvent être trouvés dans les tables système, [système.storage\_policies](../../../operations/system_tables.md#system_tables-storage_policies) et [système.disque](../../../operations/system_tables.md#system_tables-disks). Pour appliquer l'une des stratégies de stockage configurées pour une table, utilisez `storage_policy` réglage de `MergeTree`-moteur de table de famille. - -### Configuration {#table_engine-mergetree-multiple-volumes-configure} - -Les disques, les volumes et les stratégies de stockage doivent être déclarés `` étiquette, soit dans le fichier principal `config.xml` ou dans un fichier distinct dans le `config.d` répertoire. - -Structure de Configuration: - -``` xml - - - - /mnt/fast_ssd/clickhouse/ - - - /mnt/hdd1/clickhouse/ - 10485760 - - - /mnt/hdd2/clickhouse/ - 10485760 - - - ... - - - ... - -``` - -Balise: - -- `` — Disk name. Names must be different for all disks. -- `path` — path under which a server will store data (`data` et `shadow` des dossiers), doit être terminé par ‘/’. -- `keep_free_space_bytes` — the amount of free disk space to be reserved. - -L'ordre du disque définition n'est pas important. - -Stratégies de stockage balisage de configuration: - -``` xml - - ... - - - - - disk_name_from_disks_configuration - 1073741824 - - - - - - - 0.2 - - - - - - - - ... - -``` - -Balise: - -- `policy_name_N` — Policy name. Policy names must be unique. -- `volume_name_N` — Volume name. Volume names must be unique. -- `disk` — a disk within a volume. -- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume's disks. -- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). - -Exemples de Cofiguration: - -``` xml - - ... - - - - - disk1 - disk2 - - - - - - - - fast_ssd - 1073741824 - - - disk1 - - - 0.2 - - - ... - -``` - -Dans l'exemple donné, la `hdd_in_order` politique met en œuvre les [round-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) approche. Ainsi cette politique ne définit qu'un seul volume (`single`), les parties des données sont stockées sur tous ses disques dans l'ordre circulaire. Une telle politique peut être très utile s'il y a plusieurs disques similaires sont montés sur le système, mais RAID N'est pas configuré. Gardez à l'esprit que chaque lecteur de disque n'est pas fiable et vous pouvez compenser avec facteur de réplication de 3 ou plus. - -S'il existe différents types de disques disponibles dans le système, `moving_from_ssd_to_hdd` la stratégie peut être utilisée à la place. Volume `hot` se compose d'un disque SSD (`fast_ssd`), et la taille maximale d'une pièce qui peut être stocké sur ce volume est de 1 go. Toutes les pièces avec la taille plus grande que 1 GB sera stocké directement sur le `cold` le volume, qui contient un disque dur de disque `disk1`. -Aussi, une fois le disque `fast_ssd` est complété par plus de 80%, les données seront transférées à la `disk1` par un processus d'arrière-plan. - -L'ordre d'énumération des volumes dans une stratégie de stockage est important. Une fois qu'un volume est surchargé, les données sont déplacées vers le suivant. L'ordre d'énumération des disques est important parce que les données sont stockées dans les virages. - -Lors de la création d'une table, on peut lui appliquer l'une des stratégies de stockage configurées: - -``` sql -CREATE TABLE table_with_non_default_policy ( - EventDate Date, - OrderID UInt64, - BannerID UInt64, - SearchPhrase String -) ENGINE = MergeTree -ORDER BY (OrderID, BannerID) -PARTITION BY toYYYYMM(EventDate) -SETTINGS storage_policy = 'moving_from_ssd_to_hdd' -``` - -Le `default` la Politique de stockage implique d'utiliser un seul volume, qui se compose d'un seul disque donné dans ``. Une fois qu'une table est créée, sa stratégie de stockage ne peut pas être modifiée. - -### Détail {#details} - -Dans le cas de `MergeTree` les tableaux, les données sont sur le disque de différentes façons: - -- En tant que résultat d'un insert (`INSERT` requête). -- En arrière-plan fusionne et [mutation](../../../sql_reference/statements/alter.md#alter-mutations). -- Lors du téléchargement à partir d'une autre réplique. -- À la suite du gel de la partition [ALTER TABLE … FREEZE PARTITION](../../../sql_reference/statements/alter.md#alter_freeze-partition). - -Dans tous ces cas, à l'exception des mutations et du gel de partition, une pièce est stockée sur un volume et un disque selon la Politique de stockage donnée: - -1. Le premier volume (dans l'ordre de définition) qui a suffisamment d'espace disque pour stocker une pièce (`unreserved_space > current_part_size`) et permet de stocker des pièces d'une taille donnée (`max_data_part_size_bytes > current_part_size`) est choisi. -2. Dans ce volume, ce disque est choisi qui suit celui, qui a été utilisé pour stocker le bloc de données précédent, et qui a de l'espace libre plus que la taille de la pièce (`unreserved_space - keep_free_space_bytes > current_part_size`). - -Sous le capot, les mutations et la congélation des cloisons utilisent [des liens en dur](https://en.wikipedia.org/wiki/Hard_link). Les liens durs entre différents disques ne sont pas pris en charge, donc dans de tels cas, les pièces résultantes sont stockées sur les mêmes disques que les disques initiaux. - -En arrière - plan, les pièces sont déplacées entre les volumes en fonction de la quantité d'espace libre (`move_factor` paramètre) selon l'ordre les volumes sont déclarées dans le fichier de configuration. -Les données ne sont jamais transférées du dernier et dans le premier. On peut utiliser des tables système [système.part\_log](../../../operations/system_tables.md#system_tables-part-log) (champ `type = MOVE_PART`) et [système.partie](../../../operations/system_tables.md#system_tables-parts) (Fields `path` et `disk`) pour surveiller l'arrière-plan se déplace. Aussi, les informations détaillées peuvent être trouvées dans les journaux du serveur. - -L'utilisateur peut forcer le déplacement d'une partie ou d'une partition d'un volume à l'autre à l'aide de la requête [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql_reference/statements/alter.md#alter_move-partition), toutes les restrictions pour les opérations de fond sont prises en compte. La requête initie un mouvement seul et n'attend pas que les opérations d'arrière-plan soient terminées. L'utilisateur recevra un message d'erreur si pas assez d'espace libre est disponible ou si l'une des conditions requises ne sont pas remplies. - -Le déplacement des données n'interfère pas avec la réplication des données. Par conséquent, différentes stratégies de stockage peuvent être spécifiées pour la même table sur différents réplicas. - -Après l'achèvement des fusions d'arrière-plan et des mutations, les anciennes parties ne sont supprimées qu'après un certain temps (`old_parts_lifetime`). -Pendant ce temps, ils ne sont pas déplacés vers d'autres volumes ou des disques. Par conséquent, jusqu'à ce que les pièces soient finalement supprimées, elles sont toujours prises en compte pour l'évaluation de l'espace disque occupé. - -[Article Original](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/fr/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/fr/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index 8051bf5bfcc..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 33 -toc_title: ReplacingMergeTree ---- - -# Replacingmergetree {#replacingmergetree} - -Le moteur diffère de [MergeTree](mergetree.md#table_engines-mergetree) en ce qu'il supprime les doublons avec la même valeur de clé primaire (ou, plus précisément, avec la même [clé de tri](mergetree.md) valeur). - -La déduplication des données se produit uniquement lors d'une fusion. La fusion se produit en arrière-plan à un moment inconnu, vous ne pouvez donc pas le planifier. Certaines des données peuvent rester non traitées. Bien que vous puissiez exécuter une fusion imprévue en utilisant le `OPTIMIZE` requête, ne comptez pas l'utiliser, parce que la `OPTIMIZE` requête va lire et écrire une grande quantité de données. - -Ainsi, `ReplacingMergeTree` convient pour effacer les données en double en arrière-plan afin d'économiser de l'espace, mais cela ne garantit pas l'absence de doublons. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Pour une description des paramètres de requête, voir [demande de description](../../../sql_reference/statements/create.md). - -**ReplacingMergeTree Paramètres** - -- `ver` — column with version. Type `UInt*`, `Date` ou `DateTime`. Paramètre facultatif. - - Lors de la fusion, `ReplacingMergeTree` de toutes les lignes avec la même clé primaire ne laisse qu'un: - - - Dernier dans la sélection, si `ver` pas ensemble. - - Avec la version maximale, si `ver` défini. - -**Les clauses de requête** - -Lors de la création d'un `ReplacingMergeTree` la table de la même [clause](mergetree.md) sont nécessaires, comme lors de la création d'un `MergeTree` table. - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -Tous les paramètres excepté `ver` ont la même signification que dans `MergeTree`. - -- `ver` - colonne avec la version. Paramètre facultatif. Pour une description, voir le texte ci-dessus. - -
- -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/fr/engines/table_engines/mergetree_family/replication.md b/docs/fr/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index cf02e3da217..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 31 -toc_title: "R\xE9plication Des Donn\xE9es" ---- - -# Réplication Des Données {#table_engines-replication} - -La réplication n'est prise en charge que pour les tables de la famille MergeTree: - -- ReplicatedMergeTree -- ReplicatedSummingMergeTree -- ReplicatedReplacingMergeTree -- ReplicatedAggregatingMergeTree -- ReplicatedCollapsingMergeTree -- ReplicatedVersionedCollapsingMergetree -- ReplicatedGraphiteMergeTree - -La réplication fonctionne au niveau d'une table individuelle, Pas du serveur entier. Un serveur peut stocker des tables répliquées et non répliquées en même temps. - -La réplication ne dépend pas de la fragmentation. Chaque fragment a sa propre réplication indépendante. - -Données compressées pour `INSERT` et `ALTER` les requêtes sont répliquées (pour plus d'informations, consultez la documentation de [ALTER](../../../sql_reference/statements/alter.md#query_language_queries_alter)). - -`CREATE`, `DROP`, `ATTACH`, `DETACH` et `RENAME` les requêtes sont exécutées sur un seul serveur et ne sont pas répliquées: - -- Le `CREATE TABLE` query crée une nouvelle table réplicable sur le serveur où la requête est exécutée. Si cette table existe déjà sur d'autres serveurs, il ajoute une nouvelle réplique. -- Le `DROP TABLE` requête supprime la réplique situé sur le serveur où l'exécution de la requête. -- Le `RENAME` requête renomme la table sur l'une des répliques. En d'autres termes, les tables répliquées peuvent avoir des noms différents sur différentes répliques. - -Clickhouse utilise [Apache ZooKeeper](https://zookeeper.apache.org) pour stocker des informations méta répliques. Utilisez ZooKeeper version 3.4.5 ou plus récente. - -Pour utiliser la réplication, définissez les paramètres [zookeeper](../../../operations/server_configuration_parameters/settings.md#server-settings_zookeeper) section de configuration du serveur. - -!!! attention "Attention" - Ne négligez pas la sécurité. Clickhouse soutient le `digest` [Schéma ACL](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) du sous-système de sécurité ZooKeeper. - -Exemple de définition des adresses du cluster ZooKeeper: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -Vous pouvez spécifier N'importe quel cluster Zookeeper existant et le système utilisera un répertoire pour ses propres données (le répertoire est spécifié lors de la création d'une table réplicable). - -Si ZooKeeper n'est pas défini dans le fichier de configuration, vous ne pouvez pas créer de tables répliquées et toutes les tables répliquées existantes seront en lecture seule. - -La gardienne n'est pas utilisé dans `SELECT` requêtes car la réplication n'affecte pas les performances de `SELECT` et les requêtes s'exécutent aussi vite que pour les tables non répliquées. Lors de l'interrogation de tables répliquées distribuées, le comportement de ClickHouse est contrôlé par les paramètres [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) et [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). - -Pour chaque `INSERT` requête, environ dix entrées sont ajoutées à ZooKeeper par le biais de plusieurs transactions. (Pour être plus précis, c'est pour chaque bloc de données inséré; une requête D'insertion contient un bloc ou un bloc par `max_insert_block_size = 1048576` rangée.) Cela conduit à des latences légèrement plus longues pour `INSERT` par rapport aux tables non répliquées. Mais si vous suivez les recommandations pour insérer des données dans des lots de pas plus d'un `INSERT` par seconde, cela ne crée aucun problème. L'ensemble du cluster clickhouse utilisé pour coordonner un cluster ZooKeeper a un total de plusieurs centaines `INSERTs` par seconde. Le débit sur les insertions de données (le nombre de lignes par seconde) est aussi élevé que pour les non-données répliquées. - -Pour les clusters très volumineux, vous pouvez utiliser différents clusters ZooKeeper pour différents fragments. Cependant, cela ne s'est pas avéré nécessaire sur le Yandex.Cluster Metrica (environ 300 serveurs). - -La réplication est asynchrone et multi-maître. `INSERT` les requêtes (ainsi que `ALTER`) peuvent être envoyés à n'importe quel serveur disponible. Les données sont insérées sur le serveur où la requête est exécutée, puis il est copié sur les autres serveurs. Comme il est asynchrone, les données récemment insérées apparaissent sur les autres répliques avec une certaine latence. Si une partie des répliques ne sont pas disponibles, les données sont écrites lorsqu'elles sont disponibles. Si une réplique est disponible, la latence correspond au temps nécessaire pour transférer le bloc de données compressées sur le réseau. - -Par défaut, une requête INSERT attend la confirmation de l'écriture des données à partir d'un seul réplica. Si les données ont été correctement écrit sur une seule réplique et le serveur avec cette réplique cesse d'exister, les données enregistrées seront perdues. Pour activer la confirmation des Écritures de données à partir de plusieurs réplicas, utilisez `insert_quorum` option. - -Chaque bloc de données est écrit de manière atomique. La requête D'insertion est divisée en blocs jusqu'à `max_insert_block_size = 1048576` rangée. En d'autres termes, si l' `INSERT` la requête a moins de 1048576 lignes, elle est faite de manière atomique. - -Les blocs de données sont dédupliquées. Pour plusieurs écritures du même bloc de données (blocs de données de même taille contenant les mêmes lignes dans le même ordre), le bloc n'est écrit qu'une seule fois. La raison en est en cas de défaillance du réseau lorsque l'application cliente ne sait pas si les données ont été écrites dans la base de données, de sorte que le `INSERT` requête peut simplement être répété. Peu importe à quelles insertions de réplica ont été envoyées avec des données identiques. `INSERTs` sont idempotents. Les paramètres de déduplication sont contrôlés par [merge\_tree](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-merge_tree) les paramètres du serveur. - -Pendant la réplication, seules les données source à insérer sont transférées sur le réseau. D'autres transformations de données (fusion) sont coordonnées et effectuées sur toutes les répliques de la même manière. Cela minimise l'utilisation du réseau, ce qui signifie que la réplication fonctionne bien lorsque les répliques résident dans différents centres de données. (Notez que la duplication de données dans différents centres de données est l'objectif principal de la réplication.) - -Vous pouvez avoir n'importe quel nombre de répliques des mêmes données. Yandex.Metrica utilise la double réplication en production. Chaque serveur utilise RAID-5 ou RAID-6, et RAID-10 dans certains cas. C'est une solution relativement fiable et pratique. - -Le système surveille la synchronicité des données sur les répliques et est capable de récupérer après une défaillance. Le basculement est automatique (pour les petites différences de données) ou semi-automatique (lorsque les données diffèrent trop, ce qui peut indiquer une erreur de configuration). - -## Création De Tables Répliquées {#creating-replicated-tables} - -Le `Replicated` le préfixe est ajouté au nom du moteur de table. Exemple:`ReplicatedMergeTree`. - -**Répliqué \* MergeTree paramètres** - -- `zoo_path` — The path to the table in ZooKeeper. -- `replica_name` — The replica name in ZooKeeper. - -Exemple: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -
- -Exemple de syntaxe obsolète - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -
- -Comme le montre l'exemple, ces paramètres peuvent contenir des substitutions entre crochets. Les valeurs substituées sont tirées de la ‘macros’ section du fichier de configuration. Exemple: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -Le chemin d'accès à la table dans ZooKeeper doit être unique pour chaque table répliquée. Les Tables sur différents fragments doivent avoir des chemins différents. -Dans ce cas, le chemin se compose des parties suivantes: - -`/clickhouse/tables/` est le préfixe commun. Nous vous recommandons d'utiliser exactement celui-ci. - -`{layer}-{shard}` est l'identificateur de fragment. Dans cet exemple, il se compose de deux parties, depuis l'Yandex.Le cluster Metrica utilise le sharding à deux niveaux. Pour la plupart des tâches, vous ne pouvez laisser que la substitution {shard}, qui sera étendue à l'Identificateur de partition. - -`table_name` est le nom du nœud de la table dans ZooKeeper. C'est une bonne idée de le rendre identique au nom de la table. Il est défini explicitement, car contrairement au nom de la table, il ne change pas après une requête de renommage. -*HINT*: vous pouvez ajouter un nom de base de données devant `table_name` Aussi. E. g. `db_name.table_name` - -Le nom du réplica identifie différentes réplicas de la même table. Vous pouvez utiliser le nom de serveur pour cela, comme dans l'exemple. Le nom doit seulement être unique dans chaque fragment. - -Vous pouvez définir les paramètres explicitement au lieu d'utiliser des substitutions. Cela peut être pratique pour tester et configurer de petits clusters. Cependant, vous ne pouvez pas utiliser de requêtes DDL distribuées (`ON CLUSTER`) dans ce cas. - -Lorsque vous travaillez avec de grands clusters, nous vous recommandons d'utiliser des substitutions car elles réduisent la probabilité d'erreur. - -Exécutez l' `CREATE TABLE` requête sur chaque réplique. Cette requête crée une nouvelle table répliquée, ou ajoute une nouvelle réplique à un existant. - -Si vous ajoutez une nouvelle réplique après que la table contient déjà des données sur d'autres répliques, les données seront copiées des autres répliques vers la nouvelle après l'exécution de la requête. En d'autres termes, la nouvelle réplique synchronise avec les autres. - -Pour supprimer une réplique, exécutez `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. - -## Récupération Après Des Échecs {#recovery-after-failures} - -Si ZooKeeper n'est pas disponible au démarrage d'un serveur, les tables répliquées passent en mode Lecture seule. Le système tente périodiquement de se connecter à ZooKeeper. - -Si ZooKeeper est indisponible pendant un `INSERT`, ou une erreur se produit lors de l'interaction avec ZooKeeper, une exception est levée. - -Après la connexion à ZooKeeper, le système vérifie si l'ensemble de données du système de fichiers local correspond à l'ensemble de données attendu (ZooKeeper stocke ces informations). S'il y a des incohérences mineures, le système les résout en synchronisant les données avec les répliques. - -Si le système détecte des parties de données brisées (avec la mauvaise taille des fichiers) ou des parties non reconnues (parties écrites dans le système de fichiers mais non enregistrées dans ZooKeeper), il les déplace vers le `detached` sous-répertoire (ils ne sont pas supprimés). Toutes les pièces manquantes sont copiées à partir des répliques. - -Notez que ClickHouse n'effectue aucune action destructrice telle que la suppression automatique d'une grande quantité de données. - -Lorsque le serveur démarre (ou établit une nouvelle session avec ZooKeeper), il vérifie uniquement la quantité et la taille de tous les fichiers. Si les tailles de fichier correspondent mais que les octets ont été modifiés quelque part au milieu, cela n'est pas détecté immédiatement, mais uniquement lorsque vous tentez de lire les données `SELECT` requête. La requête lève une exception concernant une somme de contrôle ou une taille non correspondante d'un bloc compressé. Dans ce cas, des parties de données sont ajoutées à la file d'attente de vérification et copiées à partir des répliques si nécessaire. - -Si la série de données diffère trop de celle attendue, un mécanisme de sécurité est déclenché. Le serveur entre cela dans le journal et refuse de lancer. La raison en est que ce cas peut indiquer une erreur de configuration, par exemple si une réplique sur un fragment a été accidentellement configurée comme une réplique sur un fragment différent. Cependant, les seuils pour ce mécanisme sont fixés assez bas, et cette situation peut se produire pendant la récupération normale de la défaillance. Dans ce cas, les données sont restaurées semi-automatiquement - par “pushing a button”. - -Pour démarrer la récupération, créez le nœud `/path_to_table/replica_name/flags/force_restore_data` dans ZooKeeper avec n'importe quel contenu, ou exécutez la commande pour restaurer toutes les tables répliquées: - -``` bash -sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -Puis redémarrez le serveur. Au démarrage, le serveur supprime ces indicateurs et démarre la récupération. - -## Récupération Après La Perte De Données Complète {#recovery-after-complete-data-loss} - -Si toutes les données et métadonnées ont disparu de l'un des serveurs, procédez comme suit pour la récupération: - -1. Installez ClickHouse sur le serveur. Définissez correctement les substitutions dans le fichier de configuration qui contient l'Identificateur de fragment et les répliques, si vous les utilisez. -2. Si vous avez des tables non compliquées qui doivent être dupliquées manuellement sur les serveurs, copiez leurs données à partir d'un réplica (dans le répertoire `/var/lib/clickhouse/data/db_name/table_name/`). -3. Copier les définitions de table situées dans `/var/lib/clickhouse/metadata/` à partir d'une réplique. Si un identificateur de fragment ou de réplica est défini explicitement dans les définitions de table, corrigez-le de manière à ce qu'il corresponde à ce réplica. (Alternativement, démarrez le serveur et faites tous les `ATTACH TABLE` les requêtes qui auraient dû être dans les .les fichiers sql dans `/var/lib/clickhouse/metadata/`.) -4. Pour démarrer la récupération, créez le nœud ZooKeeper `/path_to_table/replica_name/flags/force_restore_data` tout contenu, ou d'exécuter la commande pour restaurer toutes les tables répliquées: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -Ensuite, démarrez le serveur (redémarrez, s'il est déjà en cours d'exécution). Les données seront téléchargées à partir de répliques. - -Une autre option de récupération consiste à supprimer des informations sur la réplique perdue de ZooKeeper (`/path_to_table/replica_name`), puis créez à nouveau la réplique comme décrit dans “[Création de tables répliquées](#creating-replicated-tables)”. - -Il n'y a aucune restriction sur la bande passante réseau pendant la récupération. Gardez cela à l'esprit si vous restaurez de nombreuses répliques à la fois. - -## Conversion De Mergetree En Replicatedmergetree {#converting-from-mergetree-to-replicatedmergetree} - -Nous utilisons le terme `MergeTree` pour consulter tous les moteurs de la `MergeTree family` le même que pour `ReplicatedMergeTree`. - -Si vous avez eu une `MergeTree` table qui a été répliquée manuellement, vous pouvez le convertir en une table répliquée. Vous devrez peut-être le faire si vous avez déjà recueilli une grande quantité de données dans un `MergeTree` table et maintenant vous voulez activer la réplication. - -Si les données diffèrent sur différentes répliques, synchronisez-les d'abord ou supprimez-les sur toutes les répliques sauf une. - -Renommez la table mergetree existante, puis créez un `ReplicatedMergeTree` table avec l'ancien nom. -Déplacez les données de l'ancienne table vers `detached` sous-répertoire à l'intérieur du répertoire avec les nouvelles données de la table (`/var/lib/clickhouse/data/db_name/table_name/`). -Ensuite, exécutez `ALTER TABLE ATTACH PARTITION` sur l'une des répliques d'ajouter ces données à des parties de l'ensemble de travail. - -## Conversion De Replicatedmergetree En Mergetree {#converting-from-replicatedmergetree-to-mergetree} - -Créez une table MergeTree avec un nom différent. Déplacez toutes les données du répertoire avec le `ReplicatedMergeTree` données de la table dans le répertoire de données de la nouvelle table. Ensuite, supprimer le `ReplicatedMergeTree` table et redémarrez le serveur. - -Si vous voulez vous débarrasser d'un `ReplicatedMergeTree` table sans lancer le serveur: - -- Supprimer la `.sql` fichier dans le répertoire de métadonnées (`/var/lib/clickhouse/metadata/`). -- Supprimer le chemin correspondant dans ZooKeeper (`/path_to_table/replica_name`). - -Après cela, vous pouvez lancer le serveur, créer un `MergeTree` tableau, déplacer les données de son répertoire, puis redémarrez le serveur. - -## Récupération lorsque les métadonnées du Cluster Zookeeper sont perdues ou endommagées {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} - -Si les données de ZooKeeper ont été perdues ou endommagées, vous pouvez les enregistrer en les déplaçant dans une table non compliquée comme décrit ci-dessus. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/fr/engines/table_engines/mergetree_family/summingmergetree.md b/docs/fr/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index 52bfaee15ca..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 34 -toc_title: SummingMergeTree ---- - -# Summingmergetree {#summingmergetree} - -Le moteur hérite de [MergeTree](mergetree.md#table_engines-mergetree). La différence est que lors de la fusion de parties de données pour `SummingMergeTree` tables ClickHouse remplace toutes les lignes avec la même clé primaire (ou, plus précisément, avec la même [clé de tri](mergetree.md)) avec une ligne qui contient des valeurs résumées pour les colonnes avec le type de données numériques. Si la clé de tri est composée de telle sorte qu'une seule valeur de clé correspond à un grand nombre de lignes, cela réduit considérablement le volume de stockage et accélère la sélection des données. - -Nous vous recommandons d'utiliser le moteur avec `MergeTree`. Stocker des données complètes dans `MergeTree` table, et l'utilisation `SummingMergeTree` pour le stockage de données agrégées, par exemple, lors de la préparation de rapports. Une telle approche vous empêchera de perdre des données précieuses en raison d'une clé primaire mal composée. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = SummingMergeTree([columns]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Pour une description des paramètres de requête, voir [demande de description](../../../sql_reference/statements/create.md). - -**Paramètres de SummingMergeTree** - -- `columns` - un n-uplet avec les noms de colonnes où les valeurs seront résumées. Paramètre facultatif. - Les colonnes doivent être d'un type numérique et ne doit pas être dans la clé primaire. - - Si `columns` non spécifié, ClickHouse résume les valeurs dans toutes les colonnes avec un type de données numérique qui ne sont pas dans la clé primaire. - -**Les clauses de requête** - -Lors de la création d'un `SummingMergeTree` la table de la même [clause](mergetree.md) sont nécessaires, comme lors de la création d'un `MergeTree` table. - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets et, si possible, remplacez les anciens projets par la méthode décrite ci-dessus. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) -``` - -Tous les paramètres excepté `columns` ont la même signification que dans `MergeTree`. - -- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. - -
- -## Exemple D'Utilisation {#usage-example} - -Considérons le tableau suivant: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -Insérer des données: - -``` sql -INSERT INTO summtt Values(1,1),(1,2),(2,1) -``` - -ClickHouse peut résumer toutes les lignes pas complètement ([voir ci-dessous](#data-processing)), nous utilisons donc une fonction d'agrégation `sum` et `GROUP BY` la clause dans la requête. - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - -``` text -┌─key─┬─sum(value)─┐ -│ 2 │ 1 │ -│ 1 │ 3 │ -└─────┴────────────┘ -``` - -## Le Traitement Des Données {#data-processing} - -Lorsque les données sont insérées dans une table, elles sont enregistrées telles quelles. Clickhouse fusionne périodiquement les parties de données insérées et c'est à ce moment que les lignes avec la même clé primaire sont additionnées et remplacées par une pour chaque partie de données résultante. - -ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) une fonction d'agrégation [somme()](../../../sql_reference/aggregate_functions/reference.md#agg_function-sum) et `GROUP BY` la clause doit être utilisé dans une requête comme décrit dans l'exemple ci-dessus. - -### Règles Communes Pour La Sommation {#common-rules-for-summation} - -Les valeurs dans les colonnes avec le type de données numériques sont résumées. L'ensemble des colonnes est défini par le paramètre `columns`. - -Si les valeurs étaient 0 dans toutes les colonnes pour la sommation, la ligne est supprimée. - -Si la colonne n'est pas dans la clé primaire et n'est pas résumée, une valeur arbitraire est sélectionnée parmi celles existantes. - -Les valeurs ne sont pas résumés des colonnes de la clé primaire. - -### La somme dans les colonnes Aggregatefunction {#the-summation-in-the-aggregatefunction-columns} - -Pour les colonnes de [Type AggregateFunction](../../../sql_reference/data_types/aggregatefunction.md) ClickHouse se comporte comme [AggregatingMergeTree](aggregatingmergetree.md) moteur d'agrégation selon la fonction. - -### Structures Imbriquées {#nested-structures} - -Table peut avoir des structures de données imbriquées qui sont traitées d'une manière spéciale. - -Si le nom d'une table imbriquée se termine avec `Map` et il contient au moins deux colonnes qui répondent aux critères suivants: - -- la première colonne est numérique `(*Int*, Date, DateTime)` ou une chaîne de caractères `(String, FixedString)`, nous allons l'appeler `key`, -- les autres colonnes sont arithmétique `(*Int*, Float32/64)`, nous allons l'appeler `(values...)`, - -ensuite, cette table imbriquée est interprétée comme un mappage de `key => (values...)` et lors de la fusion de ses lignes, les éléments de deux ensembles de données sont regroupées par `key` avec une sommation du correspondant `(values...)`. - -Exemple: - -``` text -[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] -[(1, 100)] + [(1, 150)] -> [(1, 250)] -[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] -[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] -``` - -Lorsque vous demandez des données, utilisez [sumMap (clé, valeur)](../../../sql_reference/aggregate_functions/reference.md) fonction pour l'agrégation de `Map`. - -Pour la structure de données imbriquée, vous n'avez pas besoin de spécifier ses colonnes dans le tuple de colonnes pour la sommation. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/fr/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/fr/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index 9f80a1683bd..00000000000 --- a/docs/fr/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 37 -toc_title: VersionedCollapsingMergeTree ---- - -# Versionedcollapsingmergetree {#versionedcollapsingmergetree} - -Ce moteur: - -- Permet l'écriture rapide des États d'objet qui changent continuellement. -- Supprime les anciens États d'objets en arrière-plan. Cela réduit considérablement le volume de stockage. - -Voir la section [Effondrer](#table_engines_versionedcollapsingmergetree) pour plus de détails. - -Le moteur hérite de [MergeTree](mergetree.md#table_engines-mergetree) et ajoute la logique de réduction des lignes à l'algorithme de fusion des parties de données. `VersionedCollapsingMergeTree` sert le même but que [CollapsingMergeTree](collapsingmergetree.md) mais utilise un autre effondrement algorithme qui permet d'insérer les données dans n'importe quel ordre avec plusieurs threads. En particulier, l' `Version` la colonne aide à réduire correctement les lignes même si elles sont insérées dans le mauvais ordre. Contrairement, `CollapsingMergeTree` permet uniquement une insertion strictement consécutive. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Pour une description des paramètres de requête, voir les [description de la requête](../../../sql_reference/statements/create.md). - -**Les Paramètres Du Moteur** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Name of the column with the type of row: `1` est un “state” rangée, `-1` est un “cancel” rangée. - - Le type de données de colonne doit être `Int8`. - -- `version` — Name of the column with the version of the object state. - - Le type de données de colonne doit être `UInt*`. - -**Les Clauses De Requête** - -Lors de la création d'un `VersionedCollapsingMergeTree` de table, de la même [clause](mergetree.md) sont requis lors de la création d'un `MergeTree` table. - -
- -Méthode obsolète pour créer une Table - -!!! attention "Attention" - N'utilisez pas cette méthode dans les nouveaux projets. Si possible, passer les anciens projets à la méthode décrite ci-dessus. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -Tous les paramètres, à l'exception `sign` et `version` ont la même signification que dans `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` est un “state” rangée, `-1` est un “cancel” rangée. - - Column Data Type — `Int8`. - -- `version` — Name of the column with the version of the object state. - - Le type de données de colonne doit être `UInt*`. - -
- -## Effondrer {#table_engines-versionedcollapsingmergetree} - -### Données {#data} - -Considérez une situation où vous devez enregistrer des données en constante évolution pour un objet. Il est raisonnable d'avoir une ligne pour un objet et de mettre à jour la ligne chaque fois qu'il y a des modifications. Cependant, l'opération de mise à jour est coûteuse et lente pour un SGBD car elle nécessite la réécriture des données dans le stockage. La mise à jour n'est pas acceptable si vous devez écrire des données rapidement, mais vous pouvez écrire les modifications sur un objet de manière séquentielle comme suit. - -L'utilisation de la `Sign` colonne lors de l'écriture de la ligne. Si `Sign = 1` cela signifie que la ligne est un état d'un objet (appelons-la “state” rangée). Si `Sign = -1` il indique l'annulation de l'état d'un objet avec les mêmes attributs (appelons-la “cancel” rangée). Également utiliser l' `Version` colonne, qui doit identifier chaque état d'un objet avec un numéro distinct. - -Par exemple, nous voulons calculer le nombre de pages visitées sur le site et combien de temps ils étaient là. À un moment donné nous écrivons la ligne suivante avec l'état de l'activité de l'utilisateur: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -À un moment donné, nous enregistrons le changement d'activité de l'utilisateur et l'écrivons avec les deux lignes suivantes. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -La première ligne annule le précédent état de l'objet (utilisateur). Il doit copier tous les champs de l'état annulé sauf `Sign`. - -La deuxième ligne contient l'état actuel. - -Parce que nous avons besoin seulement le dernier état de l'activité de l'utilisateur, les lignes - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -peut être supprimé, réduisant l'état invalide (ancien) de l'objet. `VersionedCollapsingMergeTree` fait cela lors de la fusion des parties de données. - -Pour savoir pourquoi nous avons besoin de deux lignes pour chaque changement, voir [Algorithme](#table_engines-versionedcollapsingmergetree-algorithm). - -**Notes sur l'Utilisation de la** - -1. Le programme qui écrit les données devraient se souvenir de l'état d'un objet afin de l'annuler. Le “cancel” chaîne doit être une copie de la “state” chaîne avec le contraire `Sign`. Cela augmente la taille initiale de stockage, mais permet d'écrire les données rapidement. -2. Les tableaux de plus en plus longs dans les colonnes réduisent l'efficacité du moteur en raison de la charge d'écriture. Plus les données sont simples, meilleure est l'efficacité. -3. `SELECT` les résultats dépendent fortement de la cohérence de l'histoire de l'objet change. Être précis lors de la préparation des données pour l'insertion. Vous pouvez obtenir des résultats imprévisibles avec des données incohérentes, telles que des valeurs négatives pour des métriques non négatives telles que la profondeur de session. - -### Algorithme {#table_engines-versionedcollapsingmergetree-algorithm} - -Lorsque ClickHouse fusionne des parties de données, il supprime chaque paire de lignes ayant la même clé primaire et la même version et différentes `Sign`. L'ordre des lignes n'a pas d'importance. - -Lorsque ClickHouse insère des données, il ordonne les lignes par la clé primaire. Si l' `Version` la colonne n'est pas dans la clé primaire, ClickHouse ajoute à la clé primaire implicitement que le dernier champ et l'utilise pour la commande. - -## La Sélection De Données {#selecting-data} - -ClickHouse ne garantit pas que toutes les lignes avec la même clé primaire sera dans la même partie des données ou même sur le même serveur physique. Cela est vrai à la fois pour l'écriture des données et pour la fusion ultérieure des parties de données. En outre, les processus ClickHouse `SELECT` requêtes avec plusieurs threads, et il ne peut pas prédire l'ordre des lignes dans le résultat. Cela signifie que le regroupement est nécessaire s'il est nécessaire pour obtenir complètement “collapsed” données à partir d'un `VersionedCollapsingMergeTree` table. - -Pour finaliser la réduction, écrivez une requête avec un `GROUP BY` fonctions de clause et d'agrégation qui tiennent compte du signe. Par exemple, pour calculer la quantité, l'utilisation `sum(Sign)` plutôt `count()`. Pour calculer la somme de quelque chose, utilisez `sum(Sign * x)` plutôt `sum(x)` et d'ajouter `HAVING sum(Sign) > 0`. - -Aggregate `count`, `sum` et `avg` peut être calculée de cette manière. Aggregate `uniq` peut être calculé si un objet a au moins un non-état effondré. Aggregate `min` et `max` ne peut pas être calculé, car `VersionedCollapsingMergeTree` ne sauvegarde pas l'historique des valeurs des États réduits. - -Si vous avez besoin d'extraire les données avec “collapsing” mais sans agrégation (par exemple, pour vérifier si des lignes sont présentes dont les valeurs les plus récentes correspondent à certaines conditions), vous pouvez utiliser `FINAL` le modificateur du `FROM` clause. Cette approche est inefficace et ne devrait pas être utilisée avec de grandes tables. - -## Exemple D'Utilisation {#example-of-use} - -Les données de l'exemple: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Création de la table: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -Insérer les données: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -Nous utilisons deux `INSERT` requêtes pour créer deux parties de données différentes. Si nous insérons les données avec une seule requête, ClickHouse crée une partie de données et n'effectuera jamais de fusion. - -L'obtention de données: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Que voyons-nous ici et où sont les parties effondrées? -Nous avons créé deux parties de données en utilisant deux `INSERT` requête. Le `SELECT` la requête a été effectuée dans deux threads, et le résultat est un ordre aléatoire de lignes. -L'effondrement n'a pas eu lieu car les parties de données n'ont pas encore été fusionnées. ClickHouse fusionne des parties de données à un moment inconnu que nous ne pouvons pas prédire. - -C'est pourquoi nous avons besoin de l'agrégation: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -Si nous n'avons pas besoin d'agrégation et que nous voulons forcer l'effondrement, nous pouvons utiliser le `FINAL` le modificateur du `FROM` clause. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -C'est un moyen très inefficace de sélectionner des données. Ne l'utilisez pas pour les grandes tables. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/fr/engines/table_engines/special/buffer.md b/docs/fr/engines/table_engines/special/buffer.md deleted file mode 100644 index 5ffc6e6724c..00000000000 --- a/docs/fr/engines/table_engines/special/buffer.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 45 -toc_title: Tampon ---- - -# Tampon {#buffer} - -Met en mémoire tampon les données à écrire dans la RAM, les vidant périodiquement dans une autre table. Pendant l'opération de lecture, les données sont lues à partir de la mémoire tampon, et l'autre simultanément. - -``` sql -Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) -``` - -Les paramètres du moteur: - -- `database` – Database name. Instead of the database name, you can use a constant expression that returns a string. -- `table` – Table to flush data to. -- `num_layers` – Parallelism layer. Physically, the table will be represented as `num_layers` indépendant de tampons. Valeur recommandée: 16. -- `min_time`, `max_time`, `min_rows`, `max_rows`, `min_bytes`, et `max_bytes` – Conditions for flushing data from the buffer. - -Les données sont vidées du tampon et écrites dans la table de destination si toutes les `min*` conditions ou au moins un `max*` conditions sont remplies. - -- `min_time`, `max_time` – Condition for the time in seconds from the moment of the first write to the buffer. -- `min_rows`, `max_rows` – Condition for the number of rows in the buffer. -- `min_bytes`, `max_bytes` – Condition for the number of bytes in the buffer. - -Pendant l'opération d'écriture, les données sont insérées dans un `num_layers` nombre aléatoire de tampons. Ou, si la partie de données à insérer est suffisamment grande (supérieure à `max_rows` ou `max_bytes`), il est écrit directement dans la table de destination, en omettant le tampon. - -Les conditions de purger les données sont calculées séparément pour chacun des `num_layers` tampon. Par exemple, si `num_layers = 16` et `max_bytes = 100000000`, la consommation maximale de RAM est de 1,6 Go. - -Exemple: - -``` sql -CREATE TABLE merge.hits_buffer AS merge.hits ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000) -``` - -La création d'un ‘merge.hits\_buffer’ table avec la même structure que ‘merge.hits’ et en utilisant le moteur tampon. Lors de l'écriture dans cette table, les données sont mises en mémoire tampon dans la RAM ‘merge.hits’ table. 16 tampons sont créés. Les données dans chacun d'entre eux est rincé si 100 secondes sont écoulées, ou un million de lignes ont été écrites, ou 100 MO de données ont été écrits; ou si, simultanément, 10 secondes et 10 000 lignes et 10 MO de données ont été écrites. Par exemple, si une ligne a été écrite, après 100 secondes, il sera vidé, n'importe quoi. Mais si plusieurs lignes ont été écrites, les données seront vidées plus tôt. - -Lorsque le serveur est arrêté, avec DROP TABLE ou DETACH TABLE, les données du tampon sont également vidées vers la table de destination. - -Vous pouvez définir des chaînes vides entre guillemets simples pour le nom de la base de données et de la table. Cela indique l'absence d'une table de destination. Dans ce cas, lorsque les conditions de vidage des données sont atteintes, le tampon est simplement effacé. Cela peut être utile pour garder une fenêtre de données dans la mémoire. - -Lors de la lecture à partir d'une table tampon, les données sont traitées à la fois à partir du tampon et de la table de destination (s'il y en a une). -Notez que les tables de tampon ne prennent pas en charge un index. En d'autres termes, les données dans le tampon sont entièrement analysées, ce qui peut être lent pour les grands tampons. (Pour les données dans une table subordonnée, l'index qu'il prend en charge sera utilisé.) - -Si l'ensemble de colonnes de la table tampon ne correspond pas à l'ensemble de colonnes d'une table subordonnée, un sous-ensemble de colonnes existant dans les deux tables est inséré. - -Si les types ne correspondent pas à l'une des colonnes de la table tampon et à une table subordonnée, un message d'erreur est entré dans le journal du serveur et le tampon est effacé. -La même chose se produit si la table subordonnée n'existe pas lorsque le tampon est vidé. - -Si vous devez exécuter ALTER pour une table subordonnée et la table tampon, nous vous recommandons de supprimer d'abord la table tampon, d'exécuter ALTER pour la table subordonnée, puis de créer à nouveau la table tampon. - -Si le serveur est redémarré anormalement, les données dans le tampon sont perdues. - -FINAL et SAMPLE ne fonctionnent pas correctement pour les tables tampon. Ces conditions sont transmises à la table de destination, mais ne sont pas utilisées pour traiter les données dans le tampon. Si ces fonctionnalités sont nécessaires, nous vous recommandons d'utiliser uniquement la table tampon pour l'écriture, lors de la lecture à partir de la table de destination. - -Lors de l'ajout de données à un Tampon, un des tampons est verrouillé. Cela entraîne des retards si une opération de lecture est effectuée simultanément à partir de la table. - -Les données insérées dans une table tampon peuvent se retrouver dans la table subordonnée dans un ordre différent et dans des blocs différents. Pour cette raison, une table tampon est difficile à utiliser pour écrire correctement dans un CollapsingMergeTree. Pour éviter les problèmes, vous pouvez définir ‘num\_layers’ 1. - -Si la table de destination est répliquée, certaines caractéristiques attendues des tables répliquées sont perdues lors de l'écriture dans une table tampon. Les modifications aléatoires apportées à l'ordre des lignes et des tailles des parties de données provoquent l'arrêt de la déduplication des données, ce qui signifie qu'il n'est pas possible d'avoir un ‘exactly once’ Ecrire dans des tables répliquées. - -En raison de ces inconvénients, nous ne pouvons recommander l'utilisation d'une table tampon que dans de rares cas. - -Une table tampon est utilisée lorsque trop D'insertions sont reçues d'un grand nombre de serveurs sur une unité de temps et que les données ne peuvent pas être mises en mémoire tampon avant l'insertion, ce qui signifie que les insertions ne peuvent pas s'exécuter assez rapidement. - -Notez qu'il n'est pas judicieux d'insérer des données d'une ligne de temps, même pour Tampon tables. Cela ne produira qu'une vitesse de quelques milliers de lignes par seconde, tandis que l'insertion de blocs de données plus grands peut produire plus d'un million de lignes par seconde (voir la section “Performance”). - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/buffer/) diff --git a/docs/fr/engines/table_engines/special/dictionary.md b/docs/fr/engines/table_engines/special/dictionary.md deleted file mode 100644 index 79b05a5c855..00000000000 --- a/docs/fr/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 35 -toc_title: Dictionnaire ---- - -# Dictionnaire {#dictionary} - -Le `Dictionary` le moteur affiche le [dictionnaire](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) données comme une table ClickHouse. - -À titre d'exemple, considérons un dictionnaire de `products` avec la configuration suivante: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -Interroger les données du dictionnaire: - -``` sql -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - -``` text -┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ -│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ -└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ -``` - -Vous pouvez utiliser l' [dictGet\*](../../../sql_reference/functions/ext_dict_functions.md#ext_dict_functions) fonction pour obtenir les données du dictionnaire dans ce format. - -Cette vue n'est pas utile lorsque vous avez besoin d'obtenir des données brutes ou `JOIN` opération. Pour ces cas, vous pouvez utiliser le `Dictionary` moteur, qui affiche les données du dictionnaire dans une table. - -Syntaxe: - -``` sql -CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` -``` - -Exemple d'utilisation: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); -``` - - Ok - -Jetez un oeil à ce qui est dans le tableau. - -``` sql -select * from products limit 1; -``` - -``` text -┌────product_id─┬─title───────────┐ -│ 152689 │ Some item │ -└───────────────┴─────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/fr/engines/table_engines/special/distributed.md b/docs/fr/engines/table_engines/special/distributed.md deleted file mode 100644 index 39ce3d72e3e..00000000000 --- a/docs/fr/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 33 -toc_title: "Distribu\xE9" ---- - -# Distribué {#distributed} - -**Les Tables avec moteur distribué ne stockent aucune donnée par elles mêmes**, mais autoriser le traitement des requêtes distribuées sur plusieurs serveurs. -La lecture est automatiquement parallélisée. Lors d'une lecture, les index de table sur les serveurs distants sont utilisés, s'il y en a. - -Le moteur distribué accepte les paramètres: - -- le nom du cluster dans le fichier de configuration du serveur - -- le nom d'une base de données distante - -- le nom d'une table distante - -- (en option) sharding clé - -- (éventuellement) nom de la stratégie, il sera utilisé pour stocker des fichiers temporaires pour l'envoi asynchrone - - Voir aussi: - - - `insert_distributed_sync` paramètre - - [MergeTree](../mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) pour les exemples - -Exemple: - -``` sql -Distributed(logs, default, hits[, sharding_key[, policy_name]]) -``` - -Les données seront lues à partir de tous les serveurs ‘logs’ cluster, à partir de la valeur par défaut.hits table située sur chaque serveur du cluster. -Les données ne sont pas seulement lues mais sont partiellement traitées sur les serveurs distants (dans la mesure du possible). -Par exemple, pour une requête avec GROUP BY, les données seront agrégées sur des serveurs distants et les états intermédiaires des fonctions d'agrégation seront envoyés au serveur demandeur. Ensuite, les données seront plus agrégées. - -Au lieu du nom de la base de données, vous pouvez utiliser une expression constante qui renvoie une chaîne. Par exemple: currentDatabase(). - -logs – The cluster name in the server's config file. - -Les Clusters sont définis comme ceci: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 1 - 9440 - - - - -``` - -Ici un cluster est défini avec le nom ‘logs’ qui se compose de deux fragments, dont chacune contient deux répliques. -Les partitions se réfèrent aux serveurs qui contiennent différentes parties des données (pour lire toutes les données, vous devez accéder à tous les partitions). -Les répliques sont des serveurs de duplication (afin de lire toutes les données, vous pouvez accéder aux données sur l'une des répliques). - -Les noms de Cluster ne doivent pas contenir de points. - -Paramètre `host`, `port` et , éventuellement, `user`, `password`, `secure`, `compression` sont spécifiés pour chaque serveur: -- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn't start. If you change the DNS record, restart the server. -- `port` – The TCP port for messenger activity (‘tcp\_port’ dans la configuration, généralement définie sur 9000). Ne le confondez pas avec http\_port. -- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Les droits d'accès](../../../operations/access_rights.md). -- `password` – The password for connecting to a remote server (not masked). Default value: empty string. -- `secure` - Utilisez ssl pour la connexion, généralement vous devez également définir `port` = 9440. Le serveur doit écouter 9440 et avoir des certificats corrects. -- `compression` - Utiliser la compression de données. Valeur par défaut: true. - -When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [équilibrage](../../../operations/settings/settings.md#settings-load_balancing) paramètre. -Si la connexion avec le serveur n'est pas établie, il y aura une tentative de connexion avec un court délai. Si la connexion échoue, la réplique suivante sera sélectionnée, et ainsi de suite pour toutes les répliques. Si la tentative de connexion a échoué pour toutes les répliques, la tentative sera répété de la même façon, plusieurs fois. -Cela fonctionne en faveur de la résilience, mais ne fournit pas de tolérance aux pannes complète: un serveur distant peut accepter la connexion, mais peut ne pas fonctionner ou fonctionner mal. - -Vous pouvez spécifier un seul des fragments (dans ce cas, le traitement de la requête doit être appelé distant, plutôt que distribué) ou jusqu'à un nombre quelconque de fragments. Dans chaque fragment, vous pouvez spécifier un nombre de répliques. Vous pouvez spécifier un nombre différent de répliques pour chaque fragment. - -Vous pouvez spécifier autant de clusters que vous souhaitez dans la configuration. - -Pour afficher vos clusters, utilisez ‘system.clusters’ table. - -Le moteur distribué permet de travailler avec un cluster comme un serveur local. Cependant, le cluster est inextensible: vous devez écrire sa configuration dans le fichier de configuration du serveur (encore mieux, pour tous les serveurs du cluster). - -The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don't need to create a Distributed table – use the ‘remote’ fonction de table à la place. Voir la section [Les fonctions de Table](../../../sql_reference/table_functions/index.md). - -Il existe deux méthodes pour écrire des données dans un cluster: - -Tout d'abord, vous pouvez définir les serveurs d'écrire les données à et effectuer l'écriture directement sur chaque fragment. En d'autres termes, effectuez INSERT dans les tables que la table distribuée “looks at”. C'est la solution la plus flexible car vous pouvez utiliser n'importe quel schéma de sharding, qui pourrait être non trivial en raison des exigences du sujet. C'est également la solution la plus optimale puisque les données peuvent être écrites sur différents fragments de manière complètement indépendante. - -Deuxièmement, vous pouvez effectuer INSERT dans une table distribuée. Dans ce cas, la table distribuera les données insérées sur les serveurs eux-mêmes. Pour écrire dans une table distribuée, elle doit avoir un jeu de clés de sharding (le dernier paramètre). De plus, s'il n'y a qu'un seul fragment, l'opération d'écriture fonctionne sans spécifier la clé de sharding, car cela ne signifie rien dans ce cas. - -Chaque fragment peut avoir un poids défini dans le fichier de configuration. Par défaut, le poids est égal à un. Les données sont réparties entre les fragments dans la quantité proportionnelle au poids des fragments. Par exemple, si il y a deux tessons et le premier a un poids de 9 tandis que la seconde a un poids de 10, le premier sera envoyé 9 / 19 parties de lignes, et le second sera envoyé 10 / 19. - -Chaque fragment peut avoir le ‘internal\_replication’ paramètre défini dans le fichier de configuration. - -Si ce paramètre est défini à ‘true’, l'opération d'écriture sélectionne le premier saine réplique et écrit les données. Utilisez cette option si le tableau Distribué “looks at” tables répliquées. En d'autres termes, si la table où les données seront écrites va répliquer elle-même. - -Si elle est définie sur ‘false’ (par défaut), les données sont écrites dans toutes les répliques. En substance, cela signifie que la table distribuée réplique les données elle-même. C'est pire que d'utiliser des tables répliquées, car la cohérence des répliques n'est pas vérifiée et, au fil du temps, elles contiendront des données légèrement différentes. - -Pour sélectionner le fragment auquel une ligne de données est envoyée, l'expression de sharding est analysée et son reste est extrait de la diviser par le poids total des fragments. La ligne est envoyée au fragment qui correspond au demi-intervalle des restes de ‘prev\_weight’ de ‘prev\_weights + weight’, où ‘prev\_weights’ c'est le poids total des tessons avec le plus petit nombre, et ‘weight’ est le poids de cet éclat. Par exemple, s'il y a deux fragments, et que le premier a un poids de 9 tandis que le second a un poids de 10, la ligne sera envoyée au premier fragment pour les restes de la plage \[0, 9), et au second pour les restes de la plage \[9, 19). - -L'expression de sharding peut être n'importe quelle expression de constantes et de colonnes de table qui renvoie un entier. Par exemple, vous pouvez utiliser l'expression ‘rand()’ pour la distribution aléatoire des données, ou ‘UserID’ pour la distribution par le reste de la division de L'ID de l'utilisateur (alors les données d'un seul utilisateur résideront sur un seul fragment, ce qui simplifie l'exécution et la jointure par les utilisateurs). Si l'une des colonnes n'est pas assez répartie uniformément, vous pouvez l'envelopper dans une fonction de hachage: intHash64 (UserID). - -Un simple rappel de la division est une solution limitée pour le sharding et n'est pas toujours approprié. Cela fonctionne pour des volumes de données moyens et importants (des dizaines de serveurs), mais pas pour des volumes de données très importants (des centaines de serveurs ou plus). Dans ce dernier cas, utilisez le schéma de répartition requis par le domaine, plutôt que d'utiliser des entrées dans des tableaux distribués. - -SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don't have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. - -Vous devriez être préoccupé par le système de sharding dans les cas suivants: - -- Les requêtes sont utilisées qui nécessitent des données de jointure (IN ou JOIN) par une clé spécifique. Si les données sont partagées par cette clé, vous pouvez utiliser local in ou JOIN au lieu de GLOBAL IN ou global JOIN, ce qui est beaucoup plus efficace. -- Un grand nombre de serveurs est utilisé (des centaines ou plus) avec un grand nombre de petites requêtes (requêtes de clients individuels - sites Web, annonceurs ou partenaires). Pour que les petites requêtes n'affectent pas l'ensemble du cluster, il est logique de localiser les données d'un seul client sur un seul fragment. Alternativement, comme nous l'avons fait dans Yandex.Metrica, vous pouvez configurer le sharding à deux niveaux: divisez le cluster entier en “layers”, où une couche peut être constituée de plusieurs éclats. Les données d'un seul client sont situées sur une seule couche, mais des fragments peuvent être ajoutés à une couche si nécessaire, et les données sont distribuées aléatoirement à l'intérieur de celles-ci. Des tables distribuées sont créées pour chaque couche et une seule table distribuée partagée est créée pour les requêtes globales. - -Les données sont écrites de manière asynchrone. Lorsqu'il est inséré dans la table, le bloc de données est simplement écrit dans le système de fichiers local. Les données sont envoyées aux serveurs distants en arrière-plan dès que possible. La période d'envoi des données est gérée par [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) et [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) paramètre. Le `Distributed` moteur envoie chaque fichier de données insérées séparément, mais vous pouvez activer le lot envoi de fichiers avec l' [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) paramètre. Ce paramètre améliore les performances du cluster en utilisant mieux les ressources réseau et serveur local. Vous devriez vérifier si les données sont envoyées avec succès en vérifiant la liste des fichiers (données en attente d'envoi) dans le répertoire de la table: `/var/lib/clickhouse/data/database/table/`. - -Si le serveur a cessé d'exister ou a subi un redémarrage Brutal (par exemple, après une panne de périphérique) après une insertion dans une table distribuée, les données insérées peuvent être perdues. Si une partie de données endommagée est détectée dans le répertoire de la table, elle est transférée ‘broken’ sous-répertoire et n'est plus utilisé. - -Lorsque l'option max\_parallel\_replicas est activée, le traitement des requêtes est parallélisé entre toutes les répliques d'un seul fragment. Pour plus d'informations, consultez la section [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). - -## Les Colonnes Virtuelles {#virtual-columns} - -- `_shard_num` — Contains the `shard_num` (de `system.clusters`). Type: [UInt32](../../../sql_reference/data_types/int_uint.md). - -!!! note "Note" - Depuis [`remote`](../../../sql_reference/table_functions/remote.md)/`cluster` les fonctions de table créent en interne une instance temporaire du même moteur distribué, `_shard_num` est disponible là-bas aussi. - -**Voir Aussi** - -- [Les colonnes virtuelles](../index.md#table_engines-virtual_columns) - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/fr/engines/table_engines/special/external_data.md b/docs/fr/engines/table_engines/special/external_data.md deleted file mode 100644 index 2c1f1633e3e..00000000000 --- a/docs/fr/engines/table_engines/special/external_data.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 34 -toc_title: "De donn\xE9es externes" ---- - -# Données externes pour le traitement des requêtes {#external-data-for-query-processing} - -ClickHouse permet d'Envoyer à un serveur les données nécessaires au traitement d'une requête, ainsi qu'une requête SELECT. Ces données sont placées dans une table temporaire (voir la section “Temporary tables”) et peut être utilisé dans la requête (par exemple, dans les DANS les opérateurs). - -Par exemple, si vous disposez d'un fichier texte avec important des identifiants d'utilisateur, vous pouvez le télécharger sur le serveur avec une requête qui utilise la filtration par cette liste. - -Si vous devez exécuter plusieurs requêtes avec un volume important de données externes, n'utilisez pas cette fonctionnalité. Il est préférable de télécharger les données sur la base de données à l'avance. - -Les données externes peuvent être téléchargées à l'aide du client de ligne de commande (en mode non interactif) ou à l'aide de L'interface HTTP. - -Dans le client de ligne de commande, vous pouvez spécifier une section paramètres du format - -``` bash ---external --file=... [--name=...] [--format=...] [--types=...|--structure=...] -``` - -Vous pouvez avoir plusieurs sections comme ça, pour le nombre de tables étant transmis. - -**–external** – Marks the beginning of a clause. -**–file** – Path to the file with the table dump, or -, which refers to stdin. -Une seule table peut être récupérée à partir de stdin. - -Les paramètres suivants sont facultatifs: **–name**– Name of the table. If omitted, \_data is used. -**–format** – Data format in the file. If omitted, TabSeparated is used. - -L'un des paramètres suivants est requis:**–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`. Définit les noms et les types de colonnes. - -Les fichiers spécifiés dans ‘file’ sera analysé par le format spécifié dans ‘format’, en utilisant les types de données spécifié dans ‘types’ ou ‘structure’. La table sera téléchargée sur le serveur et accessible en tant que table temporaire avec le nom dans ‘name’. - -Exemple: - -``` bash -$ echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 -849897 -$ cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -Lors de l'utilisation de L'interface HTTP, les données externes sont transmises au format multipart/form-data. Chaque tableau est transmis en tant que fichier séparé. Le nom de la table est tiré du nom du fichier. Le ‘query\_string’ est passé les paramètres ‘name\_format’, ‘name\_types’, et ‘name\_structure’, où ‘name’ est le nom de la table que ces paramètres correspondent. La signification des paramètres est la même que lors de l'utilisation du client de ligne de commande. - -Exemple: - -``` bash -$ cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv - -$ curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -Pour le traitement des requêtes distribuées, les tables temporaires sont envoyées à tous les serveurs distants. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/external_data/) diff --git a/docs/fr/engines/table_engines/special/file.md b/docs/fr/engines/table_engines/special/file.md deleted file mode 100644 index c24444e09f2..00000000000 --- a/docs/fr/engines/table_engines/special/file.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 37 -toc_title: Fichier ---- - -# Fichier {#table_engines-file} - -Le moteur de table de fichiers conserve les données dans un fichier dans l'un des [fichier -format](../../../interfaces/formats.md#formats) (TabSeparated, Native, etc.). - -Exemples d'utilisation: - -- Exportation de données de ClickHouse vers un fichier. -- Convertir des données d'un format à un autre. -- Mise à jour des données dans ClickHouse via l'édition d'un fichier sur un disque. - -## Utilisation Dans Le Serveur Clickhouse {#usage-in-clickhouse-server} - -``` sql -File(Format) -``` - -Le `Format` paramètre spécifie l'un des formats de fichier disponibles. Effectuer -`SELECT` requêtes, le format doit être pris en charge pour l'entrée, et à effectuer -`INSERT` queries – for output. The available formats are listed in the -[Format](../../../interfaces/formats.md#formats) section. - -ClickHouse ne permet pas de spécifier le chemin du système de fichiers pour`File`. Il utilisera le dossier défini par [chemin](../../../operations/server_configuration_parameters/settings.md) réglage dans la configuration du serveur. - -Lors de la création de la table en utilisant `File(Format)` il crée sous-répertoire vide dans ce dossier. Lorsque les données sont écrites dans cette table, elles sont mises dans `data.Format` fichier dans ce répertoire. - -Vous pouvez créer manuellement ce sous dossier et ce fichier dans le système de fichiers [ATTACH](../../../sql_reference/statements/misc.md) il à la table des informations avec le nom correspondant, de sorte que vous pouvez interroger les données de ce fichier. - -!!! warning "Avertissement" - Soyez prudent avec cette fonctionnalité, car ClickHouse ne garde pas trace des modifications externes apportées à ces fichiers. Le résultat des Écritures simultanées via ClickHouse et en dehors de ClickHouse n'est pas défini. - -**Exemple:** - -**1.** Configurer le `file_engine_table` table: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -Par défaut ClickHouse va créer un dossier `/var/lib/clickhouse/data/default/file_engine_table`. - -**2.** Créer manuellement `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` contenant: - -``` bash -$ cat data.TabSeparated -one 1 -two 2 -``` - -**3.** Interroger les données: - -``` sql -SELECT * FROM file_engine_table -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Utilisation dans Clickhouse-local {#usage-in-clickhouse-local} - -Dans [clickhouse-local](../../../operations/utilities/clickhouse-local.md) Fichier moteur accepte chemin d'accès au fichier en plus `Format`. Les flux d'entrée / sortie par défaut peuvent être spécifiés en utilisant des noms numériques ou lisibles par l'homme comme `0` ou `stdin`, `1` ou `stdout`. -**Exemple:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## Les Détails De Mise En Œuvre {#details-of-implementation} - -- Plusieurs `SELECT` les requêtes peuvent être effectuées simultanément, mais `INSERT` requêtes s'attendre les uns les autres. -- Prise en charge de la création d'un nouveau fichier par `INSERT` requête. -- Si le fichier existe, `INSERT` ajouterait de nouvelles valeurs dedans. -- Pas pris en charge: - - `ALTER` - - `SELECT ... SAMPLE` - - Index - - Réplication - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/fr/engines/table_engines/special/generate.md b/docs/fr/engines/table_engines/special/generate.md deleted file mode 100644 index 43709c54af1..00000000000 --- a/docs/fr/engines/table_engines/special/generate.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 46 -toc_title: GenerateRandom ---- - -# Generaterandom {#table_engines-generate} - -Le moteur de table GenerateRandom produit des données aléatoires pour un schéma de table donné. - -Exemples d'utilisation: - -- Utiliser dans le test pour remplir une grande table reproductible. -- Générer une entrée aléatoire pour les tests de fuzzing. - -## Utilisation Dans Le Serveur Clickhouse {#usage-in-clickhouse-server} - -``` sql -ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) -``` - -Le `max_array_length` et `max_string_length` les paramètres spécifient la longueur maximale de tous -colonnes et chaînes de tableau en conséquence dans les données générées. - -Générer le moteur de table prend en charge uniquement `SELECT` requête. - -Il prend en charge tous les [Les types de données](../../../sql_reference/data_types/index.md) cela peut être stocké dans une table sauf `LowCardinality` et `AggregateFunction`. - -**Exemple:** - -**1.** Configurer le `generate_engine_table` table: - -``` sql -CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) -``` - -**2.** Interroger les données: - -``` sql -SELECT * FROM generate_engine_table LIMIT 3 -``` - -``` text -┌─name─┬──────value─┐ -│ c4xJ │ 1412771199 │ -│ r │ 1791099446 │ -│ 7#$ │ 124312908 │ -└──────┴────────────┘ -``` - -## Les Détails De Mise En Œuvre {#details-of-implementation} - -- Pas pris en charge: - - `ALTER` - - `SELECT ... SAMPLE` - - `INSERT` - - Index - - Réplication - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/fr/engines/table_engines/special/join.md b/docs/fr/engines/table_engines/special/join.md deleted file mode 100644 index 946b9464cdb..00000000000 --- a/docs/fr/engines/table_engines/special/join.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 40 -toc_title: Rejoindre ---- - -# Rejoindre {#join} - -Structure de données préparée pour l'utilisation dans [JOIN](../../../sql_reference/statements/select.md#select-join) opérations. - -## Création d'une Table {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], -) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) -``` - -Voir la description détaillée de la [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) requête. - -**Les Paramètres Du Moteur** - -- `join_strictness` – [ADHÉRER à la rigueur](../../../sql_reference/statements/select.md#select-join-strictness). -- `join_type` – [Type de jointure](../../../sql_reference/statements/select.md#select-join-types). -- `k1[, k2, ...]` – Key columns from the `USING` la clause que l' `JOIN` l'opération est faite avec de la. - -Entrer `join_strictness` et `join_type` paramètres sans guillemets, par exemple, `Join(ANY, LEFT, col1)`. Ils doivent correspondre à la `JOIN` fonctionnement que le tableau sera utilisé pour. Si les paramètres ne correspondent pas, ClickHouse ne lance pas d'exception et peut renvoyer des données incorrectes. - -## Utilisation Du Tableau {#table-usage} - -### Exemple {#example} - -Création de la table de gauche: - -``` sql -CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog -``` - -``` sql -INSERT INTO id_val VALUES (1,11)(2,12)(3,13) -``` - -Création du côté droit `Join` table: - -``` sql -CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) -``` - -``` sql -INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) -``` - -Rejoindre les tables: - -``` sql -SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 -``` - -``` text -┌─id─┬─val─┬─id_val_join.val─┐ -│ 1 │ 11 │ 21 │ -│ 2 │ 12 │ ᴺᵁᴸᴸ │ -│ 3 │ 13 │ 23 │ -└────┴─────┴─────────────────┘ -``` - -Comme alternative, vous pouvez récupérer des données de la `Join` table, spécifiant la valeur de la clé de jointure: - -``` sql -SELECT joinGet('id_val_join', 'val', toUInt32(1)) -``` - -``` text -┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ -│ 21 │ -└────────────────────────────────────────────┘ -``` - -### Sélection et insertion de données {#selecting-and-inserting-data} - -Vous pouvez utiliser `INSERT` requêtes pour ajouter des données au `Join`-tables de moteur. Si la table a été créée avec `ANY` rigueur, les données pour les clés en double sont ignorées. Avec l' `ALL` rigueur, toutes les lignes sont ajoutées. - -Vous ne pouvez pas effectuer un `SELECT` requête directement à partir de la table. Au lieu de cela, utilisez l'une des méthodes suivantes: - -- Placez la table sur le côté droit dans un `JOIN` clause. -- Appelez le [joinGet](../../../sql_reference/functions/other_functions.md#joinget) fonction, qui vous permet d'extraire des données de la table de la même manière que d'un dictionnaire. - -### Limitations et paramètres {#join-limitations-and-settings} - -Lors de la création d'un tableau, les paramètres suivants sont appliqués: - -- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) -- [max\_rows\_in\_join](../../../operations/settings/query_complexity.md#settings-max_rows_in_join) -- [max\_bytes\_in\_join](../../../operations/settings/query_complexity.md#settings-max_bytes_in_join) -- [join\_overflow\_mode](../../../operations/settings/query_complexity.md#settings-join_overflow_mode) -- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) - -Le `Join`- les tables de moteur ne peuvent pas être utilisées dans `GLOBAL JOIN` opérations. - -Le `Join`-moteur permet d'utiliser [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) réglage de la `CREATE TABLE` déclaration. Et [SELECT](../../../sql_reference/statements/select.md) requête permet d'utiliser `join_use_nulls` trop. Si vous avez différents `join_use_nulls` paramètres, vous pouvez obtenir une table de jointure d'erreur. Il dépend de type de JOINTURE. Lorsque vous utilisez [joinGet](../../../sql_reference/functions/other_functions.md#joinget) fonction, vous devez utiliser le même `join_use_nulls` réglage en `CRATE TABLE` et `SELECT` déclaration. - -## Le Stockage De Données {#data-storage} - -`Join` les données de la table sont toujours situées dans la RAM. Lors de l'insertion de lignes dans une table, ClickHouse écrit des blocs de données dans le répertoire du disque afin qu'ils puissent être restaurés lorsque le serveur redémarre. - -Si le serveur redémarre incorrectement, le bloc de données sur le disque peut être perdu ou endommagé. Dans ce cas, vous devrez peut-être supprimer manuellement le fichier contenant des données endommagées. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/fr/engines/table_engines/special/materializedview.md b/docs/fr/engines/table_engines/special/materializedview.md deleted file mode 100644 index bd9177e7203..00000000000 --- a/docs/fr/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 43 -toc_title: MaterializedView ---- - -# Materializedview {#materializedview} - -Utilisé pour implémenter des vues matérialisées (pour plus d'informations, voir [CREATE TABLE](../../../sql_reference/statements/create.md)). Pour stocker des données, il utilise un moteur différent qui a été spécifié lors de la création de la vue. Lors de la lecture d'une table, il utilise juste ce moteur. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/fr/engines/table_engines/special/memory.md b/docs/fr/engines/table_engines/special/memory.md deleted file mode 100644 index 4f8411188ee..00000000000 --- a/docs/fr/engines/table_engines/special/memory.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 44 -toc_title: "M\xE9moire" ---- - -# Mémoire {#memory} - -Le moteur de mémoire stocke les données en RAM, sous forme non compressée. Les données sont stockées exactement sous la même forme qu'elles sont reçues lors de la lecture. En d'autres termes, la lecture de ce tableau est entièrement gratuit. -L'accès aux données simultanées est synchronisé. Les verrous sont courts: les opérations de lecture et d'écriture ne se bloquent pas. -Les index ne sont pas pris en charge. La lecture est parallélisée. -La productivité maximale (plus de 10 Go / s) est atteinte sur les requêtes simples, car il n'y a pas de lecture à partir du disque, de décompression ou de désérialisation des données. (Il convient de noter que dans de nombreux cas, la productivité du moteur MergeTree est presque aussi élevée.) -Lors du redémarrage d'un serveur, les données disparaissent de la table et la table devient vide. -Normalement, l'utilisation de ce moteur de table n'est pas justifiée. Cependant, il peut être utilisé pour des tests, et pour des tâches où la vitesse maximale est requise sur un nombre relativement faible de lignes (jusqu'à environ 100 000 000). - -Le moteur de mémoire est utilisé par le système pour les tables temporaires avec des données de requête externes (voir la section “External data for processing a query”), et pour la mise en œuvre globale dans (voir la section “IN operators”). - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/memory/) diff --git a/docs/fr/engines/table_engines/special/merge.md b/docs/fr/engines/table_engines/special/merge.md deleted file mode 100644 index 4f879c5e76e..00000000000 --- a/docs/fr/engines/table_engines/special/merge.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 36 -toc_title: Fusionner ---- - -# Fusionner {#merge} - -Le `Merge` moteur (à ne pas confondre avec `MergeTree`) ne stocke pas les données elles-mêmes, mais permet la lecture de n'importe quel nombre d'autres tables simultanément. -La lecture est automatiquement parallélisée. L'écriture dans une table n'est pas prise en charge. Lors de la lecture, les index des tables en cours de lecture sont utilisés, s'ils existent. -Le `Merge` engine accepte les paramètres: le nom de la base de données et une expression régulière pour les tables. - -Exemple: - -``` sql -Merge(hits, '^WatchLog') -``` - -Les données seront lues à partir des tableaux du `hits` base de données dont les noms correspondent à l'expression régulière ‘`^WatchLog`’. - -Au lieu du nom de la base de données, vous pouvez utiliser une expression constante qui renvoie une chaîne. Exemple, `currentDatabase()`. - -Regular expressions — [re2](https://github.com/google/re2) (prend en charge un sous-ensemble de PCRE), sensible à la casse. -Voir les notes sur les symboles d'échappement dans les expressions régulières “match” section. - -Lors de la sélection des tables à lire, le `Merge` le tableau lui-même ne sera pas choisie, même si elle correspond à l'expression rationnelle. C'est pour éviter les boucles. -Il est possible de créer deux `Merge` des tables qui essaieront sans cesse de lire les données des autres, mais ce n'est pas une bonne idée. - -L'utilisation traditionnelle de la `Merge` moteur pour travailler avec un grand nombre de `TinyLog` les tables comme si avec une seule table. - -Exemple 2: - -Disons que vous avez une ancienne table (WatchLog\_old) et que vous avez décidé de changer de partitionnement sans déplacer les données vers une nouvelle table (WatchLog\_new) et que vous devez voir les données des deux tables. - -``` sql -CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree(date, (UserId, EventType), 8192); -INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - -CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; -INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - -CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - -SELECT * -FROM WatchLog -``` - -``` text -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-01 │ 1 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-02 │ 2 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -``` - -## Les Colonnes Virtuelles {#virtual-columns} - -- `_table` — Contains the name of the table from which data was read. Type: [Chaîne](../../../sql_reference/data_types/string.md). - - Vous pouvez définir les conditions constantes sur `_table` dans le `WHERE/PREWHERE` clause (par exemple, `WHERE _table='xyz'`). Dans ce cas l'opération de lecture est effectuée uniquement pour les tables où la condition sur `_table` est satisfaite, pour le `_table` colonne agit comme un index. - -**Voir Aussi** - -- [Les colonnes virtuelles](index.md#table_engines-virtual_columns) - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/fr/engines/table_engines/special/null.md b/docs/fr/engines/table_engines/special/null.md deleted file mode 100644 index 8122f91ae7c..00000000000 --- a/docs/fr/engines/table_engines/special/null.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 38 -toc_title: 'NULL' ---- - -# NULL {#null} - -Lors de l'écriture dans une table Null, Les données sont ignorées. Lors de la lecture à partir d'une table Null, la réponse est vide. - -Toutefois, vous pouvez créer une vue matérialisée sur une table Nuls. Ainsi, les données écrites dans la table finira dans la vue. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/null/) diff --git a/docs/fr/engines/table_engines/special/set.md b/docs/fr/engines/table_engines/special/set.md deleted file mode 100644 index 44b03fd89d4..00000000000 --- a/docs/fr/engines/table_engines/special/set.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 39 -toc_title: "D\xE9finir" ---- - -# Définir {#set} - -Un ensemble de données qui est toujours en RAM. Il est conçu pour être utilisé sur le côté droit de l'opérateur (voir la section “IN operators”). - -Vous pouvez utiliser INSERT pour insérer des données dans la table. De nouveaux éléments seront ajoutés à l'ensemble de données, tandis que les doublons seront ignorés. -Mais vous ne pouvez pas effectuer SELECT à partir de la table. La seule façon de récupérer des données est en l'utilisant dans la moitié droite de l'opérateur. - -Les données sont toujours situées dans la RAM. Pour INSERT, les blocs de données insérées sont également écrits dans le répertoire des tables sur le disque. Lors du démarrage du serveur, ces données sont chargées dans la RAM. En d'autres termes, après le redémarrage, les données restent en place. - -Pour un redémarrage brutal du serveur, le bloc de données sur le disque peut être perdu ou endommagé. Dans ce dernier cas, vous devrez peut-être supprimer manuellement le fichier contenant des données endommagées. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/set/) diff --git a/docs/fr/engines/table_engines/special/url.md b/docs/fr/engines/table_engines/special/url.md deleted file mode 100644 index a32c49a180c..00000000000 --- a/docs/fr/engines/table_engines/special/url.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 41 -toc_title: URL ---- - -# URL (URL, Format) {#table_engines-url} - -Gère les données sur un serveur HTTP / HTTPS distant. Ce moteur est similaire -à l' [Fichier](file.md) moteur. - -## Utilisation du moteur dans le serveur Clickhouse {#using-the-engine-in-the-clickhouse-server} - -Le `format` doit être celui que ClickHouse peut utiliser dans -`SELECT` les requêtes et, si nécessaire, en `INSERTs`. Pour la liste complète des formats pris en charge, voir -[Format](../../../interfaces/formats.md#formats). - -Le `URL` doit être conforme à la structure D'un Localisateur de ressources uniforme. L'URL spécifiée doit pointer vers un serveur -qui utilise le protocole HTTP ou HTTPS. Cela ne nécessite pas de -en-têtes supplémentaires pour obtenir une réponse du serveur. - -`INSERT` et `SELECT` les requêtes sont transformées en `POST` et `GET` demande, -respectivement. Pour le traitement `POST` demandes, le serveur distant doit prendre en charge -[Encodage de transfert en morceaux](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). - -Vous pouvez limiter le nombre maximal de sauts de redirection HTTP GET en utilisant [max\_http\_get\_redirects](../../../operations/settings/settings.md#setting-max_http_get_redirects) paramètre. - -**Exemple:** - -**1.** Créer un `url_engine_table` table sur le serveur : - -``` sql -CREATE TABLE url_engine_table (word String, value UInt64) -ENGINE=URL('http://127.0.0.1:12345/', CSV) -``` - -**2.** Créez un serveur HTTP de base à l'aide des outils Python 3 standard et -démarrer: - -``` python3 -from http.server import BaseHTTPRequestHandler, HTTPServer - -class CSVHTTPServer(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type', 'text/csv') - self.end_headers() - - self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) - -if __name__ == "__main__": - server_address = ('127.0.0.1', 12345) - HTTPServer(server_address, CSVHTTPServer).serve_forever() -``` - -``` bash -$ python3 server.py -``` - -**3.** Les données de la demande: - -``` sql -SELECT * FROM url_engine_table -``` - -``` text -┌─word──┬─value─┐ -│ Hello │ 1 │ -│ World │ 2 │ -└───────┴───────┘ -``` - -## Les Détails De Mise En Œuvre {#details-of-implementation} - -- Les lectures et les écritures peuvent être parallèles -- Pas pris en charge: - - `ALTER` et `SELECT...SAMPLE` opérations. - - Index. - - Réplication. - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/fr/engines/table_engines/special/view.md b/docs/fr/engines/table_engines/special/view.md deleted file mode 100644 index 4898e7ba41f..00000000000 --- a/docs/fr/engines/table_engines/special/view.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 42 -toc_title: Vue ---- - -# Vue {#table_engines-view} - -Utilisé pour implémenter des vues (pour plus d'informations, voir `CREATE VIEW query`). Il ne stocke pas de données, mais stocke uniquement les `SELECT` requête. Lors de la lecture d'une table, il exécute cette requête (et supprime toutes les colonnes inutiles de la requête). - -[Article Original](https://clickhouse.tech/docs/en/operations/table_engines/view/) diff --git a/docs/fr/faq/general.md b/docs/fr/faq/general.md index d42e1432f99..443eea4bf49 100644 --- a/docs/fr/faq/general.md +++ b/docs/fr/faq/general.md @@ -9,15 +9,15 @@ toc_title: "Questions G\xE9n\xE9rales" ## Pourquoi Ne Pas Utiliser Quelque Chose Comme MapReduce? {#why-not-use-something-like-mapreduce} -Nous pouvons nous référer à des systèmes comme MapReduce en tant que systèmes informatiques distribués dans lesquels l'opération de réduction est basée sur le tri distribué. La solution open-source la plus courante dans cette classe est [Apache Hadoop](http://hadoop.apache.org). Yandex utilise sa solution interne, YT. +Nous pouvons nous référer à des systèmes comme MapReduce en tant que systèmes informatiques distribués dans lesquels l’opération de réduction est basée sur le tri distribué. La solution open-source la plus courante dans cette classe est [Apache Hadoop](http://hadoop.apache.org). Yandex utilise sa solution interne, YT. -Ces systèmes ne sont pas appropriés pour les requêtes en ligne en raison de leur latence élevée. En d'autres termes, ils ne peuvent pas être utilisés comme back-end pour une interface web. Ces types de systèmes ne sont pas utiles pour les mises à jour de données en temps réel. Le tri distribué n'est pas la meilleure façon d'effectuer des opérations de réduction si le résultat de l'opération et tous les résultats intermédiaires (s'il y en a) sont situés dans la RAM d'un seul serveur, ce qui est généralement le cas pour les requêtes en ligne. Dans un tel cas, une table de hachage est un moyen optimal d'effectuer des opérations de réduction. Une approche courante pour optimiser les tâches map-reduce est la pré-agrégation (réduction partielle) à l'aide d'une table de hachage en RAM. L'utilisateur effectue cette optimisation manuellement. Le tri distribué est l'une des principales causes de réduction des performances lors de l'exécution de tâches simples de réduction de la carte. +Ces systèmes ne sont pas appropriés pour les requêtes en ligne en raison de leur latence élevée. En d’autres termes, ils ne peuvent pas être utilisés comme back-end pour une interface web. Ces types de systèmes ne sont pas utiles pour les mises à jour de données en temps réel. Le tri distribué n’est pas la meilleure façon d’effectuer des opérations de réduction si le résultat de l’opération et tous les résultats intermédiaires (s’il y en a) sont situés dans la RAM d’un seul serveur, ce qui est généralement le cas pour les requêtes en ligne. Dans un tel cas, une table de hachage est un moyen optimal d’effectuer des opérations de réduction. Une approche courante pour optimiser les tâches map-reduce est la pré-agrégation (réduction partielle) à l’aide d’une table de hachage en RAM. L’utilisateur effectue cette optimisation manuellement. Le tri distribué est l’une des principales causes de réduction des performances lors de l’exécution de tâches simples de réduction de la carte. -La plupart des implémentations MapReduce vous permettent d'exécuter du code arbitraire sur un cluster. Mais un langage de requête déclaratif est mieux adapté à OLAP pour exécuter des expériences rapidement. Par exemple, Hadoop a ruche et Cochon. Considérez également Cloudera Impala ou Shark (obsolète) pour Spark, ainsi que Spark SQL, Presto et Apache Drill. Les performances lors de l'exécution de telles tâches sont très sous-optimales par rapport aux systèmes spécialisés, mais une latence relativement élevée rend irréaliste l'utilisation de ces systèmes comme backend pour une interface web. +La plupart des implémentations MapReduce vous permettent d’exécuter du code arbitraire sur un cluster. Mais un langage de requête déclaratif est mieux adapté à OLAP pour exécuter des expériences rapidement. Par exemple, Hadoop a ruche et Cochon. Considérez également Cloudera Impala ou Shark (obsolète) pour Spark, ainsi que Spark SQL, Presto et Apache Drill. Les performances lors de l’exécution de telles tâches sont très sous-optimales par rapport aux systèmes spécialisés, mais une latence relativement élevée rend irréaliste l’utilisation de ces systèmes comme backend pour une interface web. -## Que Faire si j'ai un problème avec les encodages lors de l'utilisation D'Oracle via ODBC? {#oracle-odbc-encodings} +## Que Faire Si j’ai Un problème Avec Les Encodages Lors De l’utilisation D’Oracle Via ODBC? {#oracle-odbc-encodings} -Si vous utilisez Oracle via le pilote ODBC comme source de dictionnaires externes, vous devez définir la valeur correcte pour `NLS_LANG` variable d'environnement dans `/etc/default/clickhouse`. Pour plus d'informations, voir le [FAQ Oracle NLS\_LANG](https://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html). +Si vous utilisez Oracle via le pilote ODBC comme source de dictionnaires externes, vous devez définir la valeur correcte pour `NLS_LANG` variable d’environnement dans `/etc/default/clickhouse`. Pour plus d’informations, voir le [FAQ Oracle NLS\_LANG](https://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html). **Exemple** @@ -25,9 +25,9 @@ Si vous utilisez Oracle via le pilote ODBC comme source de dictionnaires externe NLS_LANG=RUSSIAN_RUSSIA.UTF8 ``` -## Comment exporter des données de ClickHouse vers un fichier? {#how-to-export-to-file} +## Comment Exporter Des données De ClickHouse Vers Un Fichier? {#how-to-export-to-file} -### Utilisation de la Clause INTO OUTFILE {#using-into-outfile-clause} +### Utilisation De La Clause INTO OUTFILE {#using-into-outfile-clause} Ajouter un [INTO OUTFILE](../query_language/select/#into-outfile-clause) clause à votre requête. @@ -45,9 +45,9 @@ Exemple: SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV ``` -### Utilisation d'une Table de moteur de fichiers {#using-a-file-engine-table} +### Utilisation d’une Table De Moteur De Fichiers {#using-a-file-engine-table} -Voir [Fichier](../engines/table_engines/special/file.md). +Voir [Fichier](../engines/table-engines/special/file.md). ### Utilisation De La Redirection En Ligne De Commande {#using-command-line-redirection} diff --git a/docs/fr/getting-started/example-datasets/amplab-benchmark.md b/docs/fr/getting-started/example-datasets/amplab-benchmark.md new file mode 100644 index 00000000000..6a5f8d53c72 --- /dev/null +++ b/docs/fr/getting-started/example-datasets/amplab-benchmark.md @@ -0,0 +1,129 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 17 +toc_title: AMPLab Big Data Benchmark +--- + +# AMPLab Big Data Benchmark {#amplab-big-data-benchmark} + +Tu vois https://amplab.cs.berkeley.edu/benchmark/ + +Inscrivez-vous pour un compte GRATUIT à https://aws.amazon.com. il nécessite une carte de crédit, e-mail et numéro de téléphone. Obtenir une nouvelle clé d’accès à https://console.aws.amazon.com/iam/home?nc2=h\_m\_sc\#security\_credential + +Exécutez ce qui suit dans la console: + +``` bash +$ sudo apt-get install s3cmd +$ mkdir tiny; cd tiny; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/tiny/ . +$ cd .. +$ mkdir 1node; cd 1node; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/1node/ . +$ cd .. +$ mkdir 5nodes; cd 5nodes; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/5nodes/ . +$ cd .. +``` + +Exécutez les requêtes ClickHouse suivantes: + +``` sql +CREATE TABLE rankings_tiny +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_tiny +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); + +CREATE TABLE rankings_1node +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_1node +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); + +CREATE TABLE rankings_5nodes_on_single +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_5nodes_on_single +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); +``` + +Retournez à la console: + +``` bash +$ for i in tiny/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_tiny FORMAT CSV"; done +$ for i in tiny/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_tiny FORMAT CSV"; done +$ for i in 1node/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_1node FORMAT CSV"; done +$ for i in 1node/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_1node FORMAT CSV"; done +$ for i in 5nodes/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_5nodes_on_single FORMAT CSV"; done +$ for i in 5nodes/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_5nodes_on_single FORMAT CSV"; done +``` + +Requêtes pour obtenir des échantillons de données: + +``` sql +SELECT pageURL, pageRank FROM rankings_1node WHERE pageRank > 1000 + +SELECT substring(sourceIP, 1, 8), sum(adRevenue) FROM uservisits_1node GROUP BY substring(sourceIP, 1, 8) + +SELECT + sourceIP, + sum(adRevenue) AS totalRevenue, + avg(pageRank) AS pageRank +FROM rankings_1node ALL INNER JOIN +( + SELECT + sourceIP, + destinationURL AS pageURL, + adRevenue + FROM uservisits_1node + WHERE (visitDate > '1980-01-01') AND (visitDate < '1980-04-01') +) USING pageURL +GROUP BY sourceIP +ORDER BY totalRevenue DESC +LIMIT 1 +``` + +[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/amplab_benchmark/) diff --git a/docs/fr/getting-started/example-datasets/criteo.md b/docs/fr/getting-started/example-datasets/criteo.md new file mode 100644 index 00000000000..1ddc9da6313 --- /dev/null +++ b/docs/fr/getting-started/example-datasets/criteo.md @@ -0,0 +1,81 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 19 +toc_title: "T\xE9raoctet click Logs de Criteo" +--- + +# Téraoctet De Journaux De Clics De Criteo {#terabyte-of-click-logs-from-criteo} + +Télécharger les données à partir de http://labs.criteo.com/downloads/download-terabyte-click-logs/ + +Créer une table pour importer le journal: + +``` sql +CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log +``` + +Télécharger les données: + +``` bash +$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done +``` + +Créer une table pour les données converties: + +``` sql +CREATE TABLE criteo +( + date Date, + clicked UInt8, + int1 Int32, + int2 Int32, + int3 Int32, + int4 Int32, + int5 Int32, + int6 Int32, + int7 Int32, + int8 Int32, + int9 Int32, + int10 Int32, + int11 Int32, + int12 Int32, + int13 Int32, + icat1 UInt32, + icat2 UInt32, + icat3 UInt32, + icat4 UInt32, + icat5 UInt32, + icat6 UInt32, + icat7 UInt32, + icat8 UInt32, + icat9 UInt32, + icat10 UInt32, + icat11 UInt32, + icat12 UInt32, + icat13 UInt32, + icat14 UInt32, + icat15 UInt32, + icat16 UInt32, + icat17 UInt32, + icat18 UInt32, + icat19 UInt32, + icat20 UInt32, + icat21 UInt32, + icat22 UInt32, + icat23 UInt32, + icat24 UInt32, + icat25 UInt32, + icat26 UInt32 +) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) +``` + +Transformez les données du journal brut et placez - les dans la deuxième table: + +``` sql +INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; + +DROP TABLE criteo_log; +``` + +[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/fr/getting-started/example-datasets/index.md b/docs/fr/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..93a8ca9c699 --- /dev/null +++ b/docs/fr/getting-started/example-datasets/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Example Datasets +toc_priority: 12 +toc_title: Introduction +--- + +# Exemple De Jeux De Données {#example-datasets} + +Cette section décrit comment obtenir des exemples de jeux de données et les importer dans ClickHouse. +Pour certains ensembles de données exemple les requêtes sont également disponibles. + +- [Yandex Anonymisé.Metrica Dataset](metrica.md) +- [Référence Du Schéma En Étoile](star-schema.md) +- [WikiStat](wikistat.md) +- [Téraoctet de journaux de clics de Criteo](criteo.md) +- [AMPLab Big Data Benchmark](amplab-benchmark.md) +- [New York Taxi Données](nyc-taxi.md) +- [OnTime](ontime.md) + +[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/fr/getting-started/example-datasets/metrica.md b/docs/fr/getting-started/example-datasets/metrica.md new file mode 100644 index 00000000000..e4b37429b67 --- /dev/null +++ b/docs/fr/getting-started/example-datasets/metrica.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 21 +toc_title: "Yandex.Metrica De Donn\xE9es" +--- + +# Yandex Anonymisé.Metrica De Données {#anonymized-yandex-metrica-data} + +Dataset se compose de deux tables contenant des données anonymisées sur les hits (`hits_v1`) et les visites (`visits_v1`) de Yandex.Metrica. Vous pouvez en savoir plus sur Yandex.Metrica dans [Histoire de ClickHouse](../../introduction/history.md) section. + +L’ensemble de données se compose de deux tables, l’une d’elles peut être téléchargée sous forme compressée `tsv.xz` fichier ou comme partitions préparées. En outre, une version étendue de l’ `hits` table contenant 100 millions de lignes est disponible comme TSV à https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz et comme partitions préparées à https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. + +## Obtention De Tables à Partir De Partitions préparées {#obtaining-tables-from-prepared-partitions} + +Télécharger et importer la table hits: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar +tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +Télécharger et importer des visites: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar +tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Obtention De Tables à Partir D’un Fichier TSV compressé {#obtaining-tables-from-compressed-tsv-file} + +Télécharger et importer des hits à partir du fichier TSV compressé: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +Télécharger et importer des visites à partir du fichier TSV compressé: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Exemple De Requêtes {#example-queries} + +[Tutoriel ClickHouse](../../getting-started/tutorial.md) est basé sur Yandex.Metrica dataset et la façon recommandée pour commencer avec cet ensemble de données est de simplement passer par tutoriel. + +D’autres exemples de requêtes pour ces tables peuvent être trouvés parmi [tests avec État](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) de ClickHouse (ils sont nommés `test.hists` et `test.visits` y). diff --git a/docs/fr/getting-started/example-datasets/nyc-taxi.md b/docs/fr/getting-started/example-datasets/nyc-taxi.md new file mode 100644 index 00000000000..6ddc5f17190 --- /dev/null +++ b/docs/fr/getting-started/example-datasets/nyc-taxi.md @@ -0,0 +1,390 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 16 +toc_title: "New York Taxi Donn\xE9es" +--- + +# New York Taxi Données {#new-york-taxi-data} + +Ce jeu de données peut être obtenu de deux façons: + +- importation à partir de données brutes +- téléchargement de partitions + +## Comment Importer Les données Brutes {#how-to-import-the-raw-data} + +Tu vois https://github.com/toddwschneider/nyc-taxi-data et http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html pour la description d’un ensemble de données et les instructions de téléchargement. + +Le téléchargement entraînera environ 227 Go de données non compressées dans des fichiers CSV. Le téléchargement prend environ une heure sur une connexion 1 Gbit (téléchargement parallèle depuis s3.amazonaws.com récupère au moins la moitié d’un canal 1 Gbit). +Certains fichiers peuvent ne pas télécharger entièrement. Vérifiez la taille des fichiers et re-télécharger tout ce qui semble douteux. + +Certains fichiers peuvent contenir des lignes invalides. Vous pouvez les corriger comme suit: + +``` bash +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ +mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv +mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv +``` + +Ensuite, les données doivent être pré-traitées dans PostgreSQL. Cela créera des sélections de points dans les polygones (pour faire correspondre les points sur la carte avec les arrondissements de New York) et combinera toutes les données en une seule table plate dénormalisée à l’aide d’une jointure. Pour ce faire, vous devrez installer PostgreSQL avec le support PostGIS. + +Soyez prudent lors de l’exécution `initialize_database.sh` et vérifiez à nouveau manuellement que toutes les tables ont été créées correctement. + +Il faut environ 20-30 minutes pour traiter la valeur de chaque mois de données dans PostgreSQL, pour un total d’environ 48 heures. + +Vous pouvez vérifier le nombre de téléchargé lignes comme suit: + +``` bash +$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" +## Count + 1298979494 +(1 row) + +real 7m9.164s +``` + +(C’est un peu plus de 1,1 milliard de lignes rapportées par Mark Litwintschik dans une série de billets de blog.) + +Les données de PostgreSQL utilisent 370 GO d’espace. + +Exportation des données depuis PostgreSQL: + +``` sql +COPY +( + SELECT trips.id, + trips.vendor_id, + trips.pickup_datetime, + trips.dropoff_datetime, + trips.store_and_fwd_flag, + trips.rate_code_id, + trips.pickup_longitude, + trips.pickup_latitude, + trips.dropoff_longitude, + trips.dropoff_latitude, + trips.passenger_count, + trips.trip_distance, + trips.fare_amount, + trips.extra, + trips.mta_tax, + trips.tip_amount, + trips.tolls_amount, + trips.ehail_fee, + trips.improvement_surcharge, + trips.total_amount, + trips.payment_type, + trips.trip_type, + trips.pickup, + trips.dropoff, + + cab_types.type cab_type, + + weather.precipitation_tenths_of_mm rain, + weather.snow_depth_mm, + weather.snowfall_mm, + weather.max_temperature_tenths_degrees_celsius max_temp, + weather.min_temperature_tenths_degrees_celsius min_temp, + weather.average_wind_speed_tenths_of_meters_per_second wind, + + pick_up.gid pickup_nyct2010_gid, + pick_up.ctlabel pickup_ctlabel, + pick_up.borocode pickup_borocode, + pick_up.boroname pickup_boroname, + pick_up.ct2010 pickup_ct2010, + pick_up.boroct2010 pickup_boroct2010, + pick_up.cdeligibil pickup_cdeligibil, + pick_up.ntacode pickup_ntacode, + pick_up.ntaname pickup_ntaname, + pick_up.puma pickup_puma, + + drop_off.gid dropoff_nyct2010_gid, + drop_off.ctlabel dropoff_ctlabel, + drop_off.borocode dropoff_borocode, + drop_off.boroname dropoff_boroname, + drop_off.ct2010 dropoff_ct2010, + drop_off.boroct2010 dropoff_boroct2010, + drop_off.cdeligibil dropoff_cdeligibil, + drop_off.ntacode dropoff_ntacode, + drop_off.ntaname dropoff_ntaname, + drop_off.puma dropoff_puma + FROM trips + LEFT JOIN cab_types + ON trips.cab_type_id = cab_types.id + LEFT JOIN central_park_weather_observations_raw weather + ON weather.date = trips.pickup_datetime::date + LEFT JOIN nyct2010 pick_up + ON pick_up.gid = trips.pickup_nyct2010_gid + LEFT JOIN nyct2010 drop_off + ON drop_off.gid = trips.dropoff_nyct2010_gid +) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; +``` + +L’instantané de données est créé à une vitesse d’environ 50 Mo par seconde. Lors de la création de l’instantané, PostgreSQL lit à partir du disque à une vitesse d’environ 28 Mo par seconde. +Cela prend environ 5 heures. Le fichier TSV résultant est 590612904969 octets. + +Créer une table temporaire dans ClickHouse: + +``` sql +CREATE TABLE trips +( +trip_id UInt32, +vendor_id String, +pickup_datetime DateTime, +dropoff_datetime Nullable(DateTime), +store_and_fwd_flag Nullable(FixedString(1)), +rate_code_id Nullable(UInt8), +pickup_longitude Nullable(Float64), +pickup_latitude Nullable(Float64), +dropoff_longitude Nullable(Float64), +dropoff_latitude Nullable(Float64), +passenger_count Nullable(UInt8), +trip_distance Nullable(Float64), +fare_amount Nullable(Float32), +extra Nullable(Float32), +mta_tax Nullable(Float32), +tip_amount Nullable(Float32), +tolls_amount Nullable(Float32), +ehail_fee Nullable(Float32), +improvement_surcharge Nullable(Float32), +total_amount Nullable(Float32), +payment_type Nullable(String), +trip_type Nullable(UInt8), +pickup Nullable(String), +dropoff Nullable(String), +cab_type Nullable(String), +precipitation Nullable(UInt8), +snow_depth Nullable(UInt8), +snowfall Nullable(UInt8), +max_temperature Nullable(UInt8), +min_temperature Nullable(UInt8), +average_wind_speed Nullable(UInt8), +pickup_nyct2010_gid Nullable(UInt8), +pickup_ctlabel Nullable(String), +pickup_borocode Nullable(UInt8), +pickup_boroname Nullable(String), +pickup_ct2010 Nullable(String), +pickup_boroct2010 Nullable(String), +pickup_cdeligibil Nullable(FixedString(1)), +pickup_ntacode Nullable(String), +pickup_ntaname Nullable(String), +pickup_puma Nullable(String), +dropoff_nyct2010_gid Nullable(UInt8), +dropoff_ctlabel Nullable(String), +dropoff_borocode Nullable(UInt8), +dropoff_boroname Nullable(String), +dropoff_ct2010 Nullable(String), +dropoff_boroct2010 Nullable(String), +dropoff_cdeligibil Nullable(String), +dropoff_ntacode Nullable(String), +dropoff_ntaname Nullable(String), +dropoff_puma Nullable(String) +) ENGINE = Log; +``` + +Il est nécessaire pour convertir les champs en types de données plus corrects et, si possible, pour éliminer les valeurs Null. + +``` bash +$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv + +real 75m56.214s +``` + +Les données sont lues à une vitesse de 112-140 Mo/seconde. +Le chargement de données dans une table de type de journal dans un flux a pris 76 minutes. +Les données de ce tableau utilisent 142 GO. + +(L’importation de données directement depuis Postgres est également possible en utilisant `COPY ... TO PROGRAM`.) + +Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. + +Pour commencer, nous allons créer une table sur un serveur unique. Plus tard, nous ferons le tableau distribué. + +Créer et remplir un tableau récapitulatif: + +``` sql +CREATE TABLE trips_mergetree +ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +AS SELECT + +trip_id, +CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, +toDate(pickup_datetime) AS pickup_date, +ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, +toDate(dropoff_datetime) AS dropoff_date, +ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, +assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, +assumeNotNull(rate_code_id) AS rate_code_id, +assumeNotNull(pickup_longitude) AS pickup_longitude, +assumeNotNull(pickup_latitude) AS pickup_latitude, +assumeNotNull(dropoff_longitude) AS dropoff_longitude, +assumeNotNull(dropoff_latitude) AS dropoff_latitude, +assumeNotNull(passenger_count) AS passenger_count, +assumeNotNull(trip_distance) AS trip_distance, +assumeNotNull(fare_amount) AS fare_amount, +assumeNotNull(extra) AS extra, +assumeNotNull(mta_tax) AS mta_tax, +assumeNotNull(tip_amount) AS tip_amount, +assumeNotNull(tolls_amount) AS tolls_amount, +assumeNotNull(ehail_fee) AS ehail_fee, +assumeNotNull(improvement_surcharge) AS improvement_surcharge, +assumeNotNull(total_amount) AS total_amount, +CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, +assumeNotNull(trip_type) AS trip_type, +ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, +ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, +CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, + +assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, +toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, +assumeNotNull(pickup_borocode) AS pickup_borocode, +CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, +toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, +toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, +CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, +toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, + +CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, + +toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, + +assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, +toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, +assumeNotNull(dropoff_borocode) AS dropoff_borocode, +CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, +toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, +toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, +CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, +toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, + +CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, + +toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma + +FROM trips +``` + +Cela prend 3030 secondes à une vitesse d’environ 428 000 lignes par seconde. +Pour le charger plus rapidement, vous pouvez créer la table avec le `Log` le moteur de `MergeTree`. Dans ce cas, le téléchargement fonctionne plus rapidement que 200 secondes. + +La table utilise 126 GO d’espace disque. + +``` sql +SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active +``` + +``` text +┌─formatReadableSize(sum(bytes))─┐ +│ 126.18 GiB │ +└────────────────────────────────┘ +``` + +Entre autres choses, vous pouvez exécuter la requête OPTIMIZE sur MergeTree. Mais ce n’est pas nécessaire puisque tout ira bien sans elle. + +## Téléchargement Des Partitions préparées {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar +$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" +``` + +!!! info "Info" + Si vous exécutez les requêtes décrites ci-dessous, vous devez utiliser le nom complet de la table, `datasets.trips_mergetree`. + +## Résultats Sur Un Seul Serveur {#results-on-single-server} + +Q1: + +``` sql +SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type +``` + +0.490 secondes. + +Q2: + +``` sql +SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count +``` + +1.224 secondes. + +Q3: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year +``` + +2.104 secondes. + +Q4: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) +FROM trips_mergetree +GROUP BY passenger_count, year, distance +ORDER BY year, count(*) DESC +``` + +3.593 secondes. + +Le serveur suivant a été utilisé: + +Deux Intel (R) Xeon (R) CPU E5-2650 v2 @ 2.60 GHz, 16 noyaux physiques total, 128 GiB RAM, 8x6 TB HD sur le matériel RAID-5 + +Temps d’exécution est le meilleur des trois pistes. Mais à partir de la deuxième exécution, les requêtes lisent les données du cache du système de fichiers. Aucune autre mise en cache ne se produit: les données sont lues et traitées à chaque exécution. + +La création d’un tableau sur trois serveurs: + +Sur chaque serveur: + +``` sql +CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +``` + +Sur le serveur source: + +``` sql +CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) +``` + +La requête suivante redistribue les données: + +``` sql +INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree +``` + +Cela prend 2454 secondes. + +Sur les trois serveurs: + +Q1: 0.212 secondes. +Q2: 0.438 secondes. +Q3: 0.733 secondes. +Q4: 1.241 secondes. + +Pas de surprise ici, depuis les requêtes sont réparties linéairement. + +Nous avons également les résultats d’un cluster de 140 serveurs: + +Q1: 0,028 sec. +Q2: 0,043 sec. +Q3: 0,051 sec. +Q4: 0,072 sec. + +Dans ce cas, le temps de traitement des requêtes est déterminé surtout par la latence du réseau. +Nous avons exécuté des requêtes en utilisant un client situé dans un centre de données Yandex en Finlande sur un cluster en Russie, ce qui a ajouté environ 20 ms de latence. + +## Résumé {#summary} + +| serveur | Q1 | Q2 | Q3 | Q4 | +|---------|-------|-------|-------|-------| +| 1 | 0.490 | 1.224 | 2.104 | 3.593 | +| 3 | 0.212 | 0.438 | 0.733 | 1.241 | +| 140 | 0.028 | 0.043 | 0.051 | 0.072 | + +[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/fr/getting-started/example-datasets/ontime.md b/docs/fr/getting-started/example-datasets/ontime.md new file mode 100644 index 00000000000..668e2a04ac0 --- /dev/null +++ b/docs/fr/getting-started/example-datasets/ontime.md @@ -0,0 +1,412 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 15 +toc_title: OnTime +--- + +# OnTime {#ontime} + +Ce jeu de données peut être obtenu de deux façons: + +- importation à partir de données brutes +- téléchargement de partitions + +## Importation À Partir De Données Brutes {#import-from-raw-data} + +Téléchargement de données: + +``` bash +for s in `seq 1987 2018` +do +for m in `seq 1 12` +do +wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip +done +done +``` + +(à partir de https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) + +Création d’une table: + +``` sql +CREATE TABLE `ontime` ( + `Year` UInt16, + `Quarter` UInt8, + `Month` UInt8, + `DayofMonth` UInt8, + `DayOfWeek` UInt8, + `FlightDate` Date, + `UniqueCarrier` FixedString(7), + `AirlineID` Int32, + `Carrier` FixedString(2), + `TailNum` String, + `FlightNum` String, + `OriginAirportID` Int32, + `OriginAirportSeqID` Int32, + `OriginCityMarketID` Int32, + `Origin` FixedString(5), + `OriginCityName` String, + `OriginState` FixedString(2), + `OriginStateFips` String, + `OriginStateName` String, + `OriginWac` Int32, + `DestAirportID` Int32, + `DestAirportSeqID` Int32, + `DestCityMarketID` Int32, + `Dest` FixedString(5), + `DestCityName` String, + `DestState` FixedString(2), + `DestStateFips` String, + `DestStateName` String, + `DestWac` Int32, + `CRSDepTime` Int32, + `DepTime` Int32, + `DepDelay` Int32, + `DepDelayMinutes` Int32, + `DepDel15` Int32, + `DepartureDelayGroups` String, + `DepTimeBlk` String, + `TaxiOut` Int32, + `WheelsOff` Int32, + `WheelsOn` Int32, + `TaxiIn` Int32, + `CRSArrTime` Int32, + `ArrTime` Int32, + `ArrDelay` Int32, + `ArrDelayMinutes` Int32, + `ArrDel15` Int32, + `ArrivalDelayGroups` Int32, + `ArrTimeBlk` String, + `Cancelled` UInt8, + `CancellationCode` FixedString(1), + `Diverted` UInt8, + `CRSElapsedTime` Int32, + `ActualElapsedTime` Int32, + `AirTime` Int32, + `Flights` Int32, + `Distance` Int32, + `DistanceGroup` UInt8, + `CarrierDelay` Int32, + `WeatherDelay` Int32, + `NASDelay` Int32, + `SecurityDelay` Int32, + `LateAircraftDelay` Int32, + `FirstDepTime` String, + `TotalAddGTime` String, + `LongestAddGTime` String, + `DivAirportLandings` String, + `DivReachedDest` String, + `DivActualElapsedTime` String, + `DivArrDelay` String, + `DivDistance` String, + `Div1Airport` String, + `Div1AirportID` Int32, + `Div1AirportSeqID` Int32, + `Div1WheelsOn` String, + `Div1TotalGTime` String, + `Div1LongestGTime` String, + `Div1WheelsOff` String, + `Div1TailNum` String, + `Div2Airport` String, + `Div2AirportID` Int32, + `Div2AirportSeqID` Int32, + `Div2WheelsOn` String, + `Div2TotalGTime` String, + `Div2LongestGTime` String, + `Div2WheelsOff` String, + `Div2TailNum` String, + `Div3Airport` String, + `Div3AirportID` Int32, + `Div3AirportSeqID` Int32, + `Div3WheelsOn` String, + `Div3TotalGTime` String, + `Div3LongestGTime` String, + `Div3WheelsOff` String, + `Div3TailNum` String, + `Div4Airport` String, + `Div4AirportID` Int32, + `Div4AirportSeqID` Int32, + `Div4WheelsOn` String, + `Div4TotalGTime` String, + `Div4LongestGTime` String, + `Div4WheelsOff` String, + `Div4TailNum` String, + `Div5Airport` String, + `Div5AirportID` Int32, + `Div5AirportSeqID` Int32, + `Div5WheelsOn` String, + `Div5TotalGTime` String, + `Div5LongestGTime` String, + `Div5WheelsOff` String, + `Div5TailNum` String +) ENGINE = MergeTree +PARTITION BY Year +ORDER BY (Carrier, FlightDate) +SETTINGS index_granularity = 8192; +``` + +Le chargement des données: + +``` bash +$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done +``` + +## Téléchargement Des Partitions préparées {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar +$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.ontime" +``` + +!!! info "Info" + Si vous exécutez les requêtes décrites ci-dessous, vous devez utiliser le nom complet de la table, `datasets.ontime`. + +## Requête {#queries} + +Q0. + +``` sql +SELECT avg(c1) +FROM +( + SELECT Year, Month, count(*) AS c1 + FROM ontime + GROUP BY Year, Month +); +``` + +T1. Le nombre de vols par jour de l’année 2000 à 2008 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +T2. Le nombre de vols retardés de plus de 10 minutes, regroupés par jour de la semaine, pour 2000-2008 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +T3. Le nombre de retards par l’aéroport pour 2000-2008 + +``` sql +SELECT Origin, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY Origin +ORDER BY c DESC +LIMIT 10; +``` + +T4. Nombre de retards par transporteur pour 2007 + +``` sql +SELECT Carrier, count(*) +FROM ontime +WHERE DepDelay>10 AND Year=2007 +GROUP BY Carrier +ORDER BY count(*) DESC; +``` + +Q5. Pourcentage de retards par transporteur pour 2007 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year=2007 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year=2007 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Meilleure version de la même requête: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year=2007 +GROUP BY Carrier +ORDER BY c3 DESC +``` + +Q6. La demande précédente pour une plus large gamme d’années, 2000-2008 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year>=2000 AND Year<=2008 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year>=2000 AND Year<=2008 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Meilleure version de la même requête: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY Carrier +ORDER BY c3 DESC; +``` + +Q7. Pourcentage de vols retardés de plus de 10 minutes, par année + +``` sql +SELECT Year, c1/c2 +FROM +( + select + Year, + count(*)*100 as c1 + from ontime + WHERE DepDelay>10 + GROUP BY Year +) +JOIN +( + select + Year, + count(*) as c2 + from ontime + GROUP BY Year +) USING (Year) +ORDER BY Year; +``` + +Meilleure version de la même requête: + +``` sql +SELECT Year, avg(DepDelay>10)*100 +FROM ontime +GROUP BY Year +ORDER BY Year; +``` + +Q8. Les destinations les plus populaires par le nombre de villes directement connectées pour différentes plages d’années + +``` sql +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +WHERE Year >= 2000 and Year <= 2010 +GROUP BY DestCityName +ORDER BY u DESC LIMIT 10; +``` + +Q9. + +``` sql +SELECT Year, count(*) AS c1 +FROM ontime +GROUP BY Year; +``` + +Q10. + +``` sql +SELECT + min(Year), max(Year), Carrier, count(*) AS cnt, + sum(ArrDelayMinutes>30) AS flights_delayed, + round(sum(ArrDelayMinutes>30)/count(*),2) AS rate +FROM ontime +WHERE + DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') + AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') + AND FlightDate < '2010-01-01' +GROUP by Carrier +HAVING cnt>100000 and max(Year)>1990 +ORDER by rate DESC +LIMIT 1000; +``` + +Bonus: + +``` sql +SELECT avg(cnt) +FROM +( + SELECT Year,Month,count(*) AS cnt + FROM ontime + WHERE DepDel15=1 + GROUP BY Year,Month +); + +SELECT avg(c1) FROM +( + SELECT Year,Month,count(*) AS c1 + FROM ontime + GROUP BY Year,Month +); + +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +GROUP BY DestCityName +ORDER BY u DESC +LIMIT 10; + +SELECT OriginCityName, DestCityName, count() AS c +FROM ontime +GROUP BY OriginCityName, DestCityName +ORDER BY c DESC +LIMIT 10; + +SELECT OriginCityName, count() AS c +FROM ontime +GROUP BY OriginCityName +ORDER BY c DESC +LIMIT 10; +``` + +Ce test de performance a été créé par Vadim Tkachenko. Voir: + +- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ +- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ +- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ +- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ +- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ +- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html + +[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/fr/getting_started/example_datasets/star_schema.md b/docs/fr/getting-started/example-datasets/star-schema.md similarity index 100% rename from docs/fr/getting_started/example_datasets/star_schema.md rename to docs/fr/getting-started/example-datasets/star-schema.md diff --git a/docs/fr/getting-started/example-datasets/wikistat.md b/docs/fr/getting-started/example-datasets/wikistat.md new file mode 100644 index 00000000000..266d5c6da1c --- /dev/null +++ b/docs/fr/getting-started/example-datasets/wikistat.md @@ -0,0 +1,35 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 18 +toc_title: WikiStat +--- + +# WikiStat {#wikistat} + +Voir: http://dumps.wikimedia.org/other/pagecounts-raw/ + +Création d’une table: + +``` sql +CREATE TABLE wikistat +( + date Date, + time DateTime, + project String, + subproject String, + path String, + hits UInt64, + size UInt64 +) ENGINE = MergeTree(date, (path, time), 8192); +``` + +Le chargement des données: + +``` bash +$ for i in {2007..2016}; do for j in {01..12}; do echo $i-$j >&2; curl -sSL "http://dumps.wikimedia.org/other/pagecounts-raw/$i/$i-$j/" | grep -oE 'pagecounts-[0-9]+-[0-9]+\.gz'; done; done | sort | uniq | tee links.txt +$ cat links.txt | while read link; do wget http://dumps.wikimedia.org/other/pagecounts-raw/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1/')/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1-\2/')/$link; done +$ ls -1 /opt/wikistat/ | grep gz | while read i; do echo $i; gzip -cd /opt/wikistat/$i | ./wikistat-loader --time="$(echo -n $i | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2})\.gz/\1-\2-\3 \4-00-00/')" | clickhouse-client --query="INSERT INTO wikistat FORMAT TabSeparated"; done +``` + +[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/wikistat/) diff --git a/docs/fr/getting-started/index.md b/docs/fr/getting-started/index.md new file mode 100644 index 00000000000..ec0cf7da48b --- /dev/null +++ b/docs/fr/getting-started/index.md @@ -0,0 +1,17 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Getting Started +toc_hidden: true +toc_priority: 8 +toc_title: "cach\xE9s" +--- + +# Prise En Main {#getting-started} + +Si vous êtes nouveau à ClickHouse et que vous voulez obtenir un sentiment pratique de sa performance, tout d’abord, vous devez passer par le [processus d’installation](install.md). Après cela, vous pouvez: + +- [Passez par tutoriel détaillé](tutorial.md) +- [Expérience avec des exemples de jeux de données](example-datasets/ontime.md) + +[Article Original](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/fr/getting-started/install.md b/docs/fr/getting-started/install.md new file mode 100644 index 00000000000..ea97b5a63de --- /dev/null +++ b/docs/fr/getting-started/install.md @@ -0,0 +1,184 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 11 +toc_title: Installation +--- + +# Installation {#installation} + +## Configuration Système Requise {#system-requirements} + +ClickHouse peut fonctionner sur N’importe quel Linux, FreeBSD ou Mac OS X avec une architecture CPU x86\_64, AArch64 ou PowerPC64LE. + +Les binaires pré-construits officiels sont généralement compilés pour le jeu d’instructions x86\_64 et leverage SSE 4.2, donc sauf indication contraire, l’utilisation du processeur qui le prend en charge devient une exigence système supplémentaire. Voici la commande pour vérifier si le processeur actuel prend en charge SSE 4.2: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +Pour exécuter ClickHouse sur des processeurs qui ne prennent pas en charge SSE 4.2 ou qui ont une architecture AArch64 ou PowerPC64LE, vous devez [construire ClickHouse à partir de sources](#from-sources) avec des ajustements de configuration appropriés. + +## Options D’Installation Disponibles {#available-installation-options} + +### À Partir De Paquets DEB {#install-from-deb-packages} + +Il est recommandé d’utiliser officiel pré-compilé `deb` Paquets Pour Debian ou Ubuntu. + +Exécutez ensuite ces commandes pour installer les paquets: + +``` bash +{% include 'install/deb.sh' %} +``` + +Si vous souhaitez utiliser la version la plus récente, remplacer `stable` avec `testing` (ceci est recommandé pour vos environnements de test). + +Vous pouvez également télécharger et installer des paquets manuellement à partir d’ici: https://repo.clickhouse.tech/deb/stable/main/. + +#### Paquet {#packages} + +- `clickhouse-common-static` — Installs ClickHouse compiled binary files. +- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` et installe la configuration du serveur par défaut. +- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` et d’autres outils. et installe les fichiers de configuration du client. +- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. + +### À Partir De Paquets RPM {#from-rpm-packages} + +Il est recommandé d’utiliser officiel pré-compilé `rpm` packages pour CentOS, RedHat et toutes les autres distributions Linux basées sur rpm. + +Tout d’abord, vous devez ajouter le dépôt officiel: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 +``` + +Si vous souhaitez utiliser la version la plus récente, remplacer `stable` avec `testing` (ceci est recommandé pour vos environnements de test). Le `prestable` la balise est parfois trop. + +Exécutez ensuite ces commandes pour installer les paquets: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +Vous pouvez également télécharger et installer des paquets manuellement à partir d’ici: https://repo.clickhouse.tech / rpm / stable / x86\_64. + +### À Partir d’archives Tgz {#from-tgz-archives} + +Il est recommandé d’utiliser officiel pré-compilé `tgz` archives pour toutes les distributions Linux, où l’installation de `deb` ou `rpm` les emballages n’est pas possible. + +La version requise peut être téléchargée avec `curl` ou `wget` depuis le référentiel https://repo.yandex.ru/clickhouse/tgz/. +Après cela, les archives téléchargées doivent être décompressées et installées avec des scripts d’installation. Exemple pour la dernière version: + +``` bash +export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz + +tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz +sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz +sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-server-$LATEST_VERSION.tgz +sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh +sudo /etc/init.d/clickhouse-server start + +tar -xzvf clickhouse-client-$LATEST_VERSION.tgz +sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh +``` + +Pour les environnements de production, il est recommandé d’utiliser la dernière `stable`-version. Vous pouvez trouver son numéro sur la page GitHub https://github.com/ClickHouse/ClickHouse/tags avec postfix `-stable`. + +### À Partir De L’Image Docker {#from-docker-image} + +Pour exécuter Clickhouse à L’intérieur Docker suivez le guide sur [Hub Docker](https://hub.docker.com/r/yandex/clickhouse-server/). Ces images utilisent officiel `deb` les paquets à l’intérieur. + +### À Partir De Sources {#from-sources} + +Pour compiler manuellement ClickHouse, suivez les instructions pour [Linux](../development/build.md) ou [Mac OS X](../development/build-osx.md). + +Vous pouvez compiler des paquets et les installer ou utiliser des programmes sans installer de paquets. En outre, en construisant manuellement, vous pouvez désactiver L’exigence SSE 4.2 ou construire pour les processeurs AArch64. + + Client: programs/clickhouse-client + Server: programs/clickhouse-server + +Vous devrez créer un dossier de données et de métadonnées et `chown` pour l’utilisateur souhaité. Leurs chemins peuvent être modifiés dans la configuration du serveur (src / programs / server / config.xml), par défaut, ils sont: + + /opt/clickhouse/data/default/ + /opt/clickhouse/metadata/default/ + +Sur Gentoo, vous pouvez simplement utiliser `emerge clickhouse` pour installer ClickHouse à partir de sources. + +## Lancer {#launch} + +Pour démarrer le serveur en tant que démon, exécutez: + +``` bash +$ sudo service clickhouse-server start +``` + +Si vous n’avez pas `service` commande, exécuter comme + +``` bash +$ sudo /etc/init.d/clickhouse-server start +``` + +Voir les journaux dans le `/var/log/clickhouse-server/` répertoire. + +Si le serveur ne démarre pas, vérifiez les configurations dans le fichier `/etc/clickhouse-server/config.xml`. + +Vous pouvez également lancer manuellement le serveur à partir de la console: + +``` bash +$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +Dans ce cas, le journal sera imprimé sur la console, ce qui est pratique lors du développement. +Si le fichier de configuration se trouve dans le répertoire courant, vous n’avez pas besoin `--config-file` paramètre. Par défaut, il utilise `./config.xml`. + +ClickHouse prend en charge les paramètres de restriction d’accès. Ils sont situés dans la `users.xml` fichier (à côté de `config.xml`). +Par défaut, l’accès est autorisé depuis n’importe où pour `default` l’utilisateur, sans un mot de passe. Voir `user/default/networks`. +Pour plus d’informations, consultez la section [“Configuration Files”](../operations/configuration-files.md). + +Après le lancement du serveur, vous pouvez utiliser le client de ligne de commande pour vous y connecter: + +``` bash +$ clickhouse-client +``` + +Par défaut, il se connecte à `localhost:9000` au nom de l’utilisateur `default` sans un mot de passe. Il peut également être utilisé pour se connecter à un serveur distant en utilisant `--host` argument. + +Le terminal doit utiliser L’encodage UTF-8. +Pour plus d’informations, consultez la section [“Command-line client”](../interfaces/cli.md). + +Exemple: + +``` bash +$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**Félicitations, le système fonctionne!** + +Pour continuer à expérimenter, vous pouvez télécharger l’un des jeux de données de test ou passer par [tutoriel](https://clickhouse.tech/tutorial.html). + +[Article Original](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/fr/getting-started/playground.md b/docs/fr/getting-started/playground.md new file mode 100644 index 00000000000..c68d2281ad2 --- /dev/null +++ b/docs/fr/getting-started/playground.md @@ -0,0 +1,48 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 14 +toc_title: "R\xE9cr\xE9ation" +--- + +# Clickhouse Aire De Jeux {#clickhouse-playground} + +[Clickhouse Aire De Jeux](https://play.clickhouse.tech?file=welcome) permet aux utilisateurs d’expérimenter avec ClickHouse en exécutant des requêtes instantanément, sans configurer leur serveur ou leur cluster. +Plusieurs exemples de jeux de données sont disponibles dans le terrain de jeu ainsi que des exemples de requêtes qui montrent les fonctionnalités de ClickHouse. + +Les requêtes sont exécutées comme un utilisateur en lecture seule. Cela implique certaines limites: + +- Les requêtes DDL ne sont pas autorisées +- Les requêtes D’insertion ne sont pas autorisées + +Les paramètres suivants sont également appliquées: +- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) +- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) +- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) +- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) + +Clickhouse Playground donne l’expérience du m2.Petite +[Service géré pour ClickHouse](https://cloud.yandex.com/services/managed-clickhouse) +exemple hébergé dans [Yandex.Nuage](https://cloud.yandex.com/). +Plus d’informations sur [les fournisseurs de cloud](../commercial/cloud.md). + +Clickhouse Playground interface web fait des demandes via ClickHouse [HTTP API](../interfaces/http.md). +Le backend Playground est juste un cluster ClickHouse sans aucune application Côté Serveur supplémentaire. +ClickHouse HTTPS endpoint est également disponible dans le cadre du terrain de jeu. + +Vous pouvez effectuer des requêtes sur playground en utilisant n’importe quel client HTTP, par exemple [curl](https://curl.haxx.se) ou [wget](https://www.gnu.org/software/wget/), ou configurer une connexion en utilisant [JDBC](../interfaces/jdbc.md) ou [ODBC](../interfaces/odbc.md) pilote. +Plus d’informations sur les produits logiciels qui prennent en charge ClickHouse est disponible [ici](../interfaces/index.md). + +| Paramètre | Valeur | +|:-------------|:----------------------------------------------| +| Terminaison | https://play-api.clickhouse.technologie: 8443 | +| Utilisateur | `playground` | +| Mot de passe | `clickhouse` | + +Notez que ce paramètre nécessite une connexion sécurisée. + +Exemple: + +``` bash +curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" +``` diff --git a/docs/fr/getting-started/tutorial.md b/docs/fr/getting-started/tutorial.md new file mode 100644 index 00000000000..e8434310029 --- /dev/null +++ b/docs/fr/getting-started/tutorial.md @@ -0,0 +1,665 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 12 +toc_title: Tutoriel +--- + +# Tutoriel ClickHouse {#clickhouse-tutorial} + +## À Quoi S’attendre De Ce Tutoriel? {#what-to-expect-from-this-tutorial} + +En parcourant ce tutoriel, vous apprendrez à configurer un cluster ClickHouse simple. Ce sera petit, mais tolérant aux pannes et évolutif. Ensuite, nous utiliserons l’un des exemples de jeux de données pour le remplir de données et exécuter des requêtes de démonstration. + +## Configuration De Noeud Unique {#single-node-setup} + +Pour retarder les complexités d’un environnement distribué, nous allons commencer par déployer ClickHouse sur un seul serveur ou une machine virtuelle. ClickHouse est généralement installé à partir de [deb](install.md#install-from-deb-packages) ou [rpm](install.md#from-rpm-packages) les paquets, mais il y a [alternative](install.md#from-docker-image) pour les systèmes d’exploitation qui ne sont pas les soutenir. + +Par exemple, vous avez choisi `deb` paquets et exécutés: + +``` bash +{% include 'install/deb.sh' %} +``` + +Quelles sont les paquets installés: + +- `clickhouse-client` package contient [clickhouse-client](../interfaces/cli.md) application, client interactif de console de ClickHouse. +- `clickhouse-common` paquet contient un fichier exécutable ClickHouse. +- `clickhouse-server` package contient des fichiers de configuration pour exécuter ClickHouse en tant que serveur. + +Les fichiers de configuration du serveur sont `/etc/clickhouse-server/`. Avant d’aller plus loin, notez le `` élément `config.xml`. Path détermine l’emplacement pour le stockage des données, il doit donc être situé sur le volume avec une grande capacité de disque; la valeur par défaut est `/var/lib/clickhouse/`. Si vous souhaitez ajuster la configuration, il n’est pas pratique de modifier directement `config.xml` fichier, considérant qu’il pourrait obtenir réécrit sur les futures mises à jour du progiciel. La façon recommandée de remplacer les éléments de configuration est de créer [fichiers dans config.d: répertoire](../operations/configuration-files.md) qui servent de “patches” config.XML. + +Comme vous l’avez peut-être remarqué, `clickhouse-server` n’est pas lancé automatiquement après l’installation du paquet. Il ne sera pas redémarré automatiquement après les mises à jour, non plus. La façon dont vous démarrez le serveur dépend de votre système d’initialisation, généralement, c’est: + +``` bash +sudo service clickhouse-server start +``` + +ou + +``` bash +sudo /etc/init.d/clickhouse-server start +``` + +L’emplacement par défaut pour les journaux du serveur est `/var/log/clickhouse-server/`. Le serveur est prêt à gérer les connexions client une fois `Ready for connections` message. + +Une fois l’ `clickhouse-server` est opérationnel, nous pouvons utiliser `clickhouse-client` pour se connecter au serveur et effectuer des tests de requêtes comme `SELECT "Hello, world!";`. + +
+ +Conseils rapides pour clickhouse-client +Mode interactif: + +``` bash +clickhouse-client +clickhouse-client --host=... --port=... --user=... --password=... +``` + +Activer les requêtes multilignes: + +``` bash +clickhouse-client -m +clickhouse-client --multiline +``` + +Exécuter des requêtes en mode batch: + +``` bash +clickhouse-client --query='SELECT 1' +echo 'SELECT 1' | clickhouse-client +clickhouse-client <<< 'SELECT 1' +``` + +Insérer des données à partir d’un fichier au format spécifié: + +``` bash +clickhouse-client --query='INSERT INTO table VALUES' < data.txt +clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv +``` + +
+ +## Importer Un Échantillon De Données {#import-sample-dataset} + +Maintenant, il est temps de remplir notre serveur ClickHouse avec quelques exemples de données. Dans ce tutoriel, nous allons utiliser les données anonymisées de Yandex.Metrica, le premier service qui exécute ClickHouse en production avant de devenir open-source (plus à ce sujet dans [section d’histoire](../introduction/history.md)). Il y a [plusieurs façons d’importer Yandex.Metrica dataset](example-datasets/metrica.md), et pour le bien du tutoriel, nous irons avec le plus réaliste. + +### Télécharger Et Extraire Les données De La Table {#download-and-extract-table-data} + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +``` + +Les fichiers extraits ont une taille d’environ 10 Go. + +### Créer Des Tables {#create-tables} + +Comme dans la plupart des systèmes de gestion de bases de données, clickhouse regroupe logiquement les tables en “databases”. Il y a un `default` base de données, mais nous allons en créer une nouvelle nommée `tutorial`: + +``` bash +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" +``` + +La syntaxe pour créer des tables est beaucoup plus compliquée par rapport aux bases de données (voir [référence](../sql-reference/statements/create.md). En général `CREATE TABLE` déclaration doit spécifier trois choses clés: + +1. Nom de la table à créer. +2. Table schema, i.e. list of columns and their [types de données](../sql-reference/data-types/index.md). +3. [Tableau moteur](../engines/table-engines/index.md) et ce sont les paramètres, qui déterminent tous les détails sur la façon dont les requêtes à cette table seront physiquement exécutées. + +Yandex.Metrica est un service d’analyse web, et l’exemple de jeu de données ne couvre pas toutes ses fonctionnalités, il n’y a donc que deux tables à créer: + +- `hits` est un tableau avec chaque action effectuée par tous les utilisateurs sur tous les sites couverts par le service. +- `visits` est une table qui contient des sessions pré-construites au lieu d’actions individuelles. + +Voyons et exécutons les vraies requêtes create table pour ces tables: + +``` sql +CREATE TABLE tutorial.hits_v1 +( + `WatchID` UInt64, + `JavaEnable` UInt8, + `Title` String, + `GoodEvent` Int16, + `EventTime` DateTime, + `EventDate` Date, + `CounterID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RegionID` UInt32, + `UserID` UInt64, + `CounterClass` Int8, + `OS` UInt8, + `UserAgent` UInt8, + `URL` String, + `Referer` String, + `URLDomain` String, + `RefererDomain` String, + `Refresh` UInt8, + `IsRobot` UInt8, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `FlashMinor2` String, + `NetMajor` UInt8, + `NetMinor` UInt8, + `UserAgentMajor` UInt16, + `UserAgentMinor` FixedString(2), + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `MobilePhone` UInt8, + `MobilePhoneModel` String, + `Params` String, + `IPNetworkID` UInt32, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `IsArtifical` UInt8, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `ClientTimeZone` Int16, + `ClientEventTime` DateTime, + `SilverlightVersion1` UInt8, + `SilverlightVersion2` UInt8, + `SilverlightVersion3` UInt32, + `SilverlightVersion4` UInt16, + `PageCharset` String, + `CodeVersion` UInt32, + `IsLink` UInt8, + `IsDownload` UInt8, + `IsNotBounce` UInt8, + `FUniqID` UInt64, + `HID` UInt32, + `IsOldCounter` UInt8, + `IsEvent` UInt8, + `IsParameter` UInt8, + `DontCountHits` UInt8, + `WithHash` UInt8, + `HitColor` FixedString(1), + `UTCEventTime` DateTime, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `WindowName` Int32, + `OpenerName` Int32, + `HistoryLength` Int16, + `BrowserLanguage` FixedString(2), + `BrowserCountry` FixedString(2), + `SocialNetwork` String, + `SocialAction` String, + `HTTPError` UInt16, + `SendTiming` Int32, + `DNSTiming` Int32, + `ConnectTiming` Int32, + `ResponseStartTiming` Int32, + `ResponseEndTiming` Int32, + `FetchTiming` Int32, + `RedirectTiming` Int32, + `DOMInteractiveTiming` Int32, + `DOMContentLoadedTiming` Int32, + `DOMCompleteTiming` Int32, + `LoadEventStartTiming` Int32, + `LoadEventEndTiming` Int32, + `NSToDOMContentLoadedTiming` Int32, + `FirstPaintTiming` Int32, + `RedirectCount` Int8, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `ParamPrice` Int64, + `ParamOrderID` String, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `GoalsReached` Array(UInt32), + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `RefererHash` UInt64, + `URLHash` UInt64, + `CLID` UInt32, + `YCLID` UInt64, + `ShareService` String, + `ShareURL` String, + `ShareTitle` String, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `IslandID` FixedString(16), + `RequestNum` UInt32, + `RequestTry` UInt8 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +``` sql +CREATE TABLE tutorial.visits_v1 +( + `CounterID` UInt32, + `StartDate` Date, + `Sign` Int8, + `IsNew` UInt8, + `VisitID` UInt64, + `UserID` UInt64, + `StartTime` DateTime, + `Duration` UInt32, + `UTCStartTime` DateTime, + `PageViews` Int32, + `Hits` Int32, + `IsBounce` UInt8, + `Referer` String, + `StartURL` String, + `RefererDomain` String, + `StartURLDomain` String, + `EndURL` String, + `LinkURL` String, + `IsDownload` UInt8, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `PlaceID` Int32, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `IsYandex` UInt8, + `GoalReachesDepth` Int32, + `GoalReachesURL` Int32, + `GoalReachesAny` Int32, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `MobilePhoneModel` String, + `ClientEventTime` DateTime, + `RegionID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `IPNetworkID` UInt32, + `SilverlightVersion3` UInt32, + `CodeVersion` UInt32, + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `UserAgentMajor` UInt16, + `UserAgentMinor` UInt16, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `SilverlightVersion2` UInt8, + `SilverlightVersion4` UInt16, + `FlashVersion3` UInt16, + `FlashVersion4` UInt16, + `ClientTimeZone` Int16, + `OS` UInt8, + `UserAgent` UInt8, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `NetMajor` UInt8, + `NetMinor` UInt8, + `MobilePhone` UInt8, + `SilverlightVersion1` UInt8, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `JavaEnable` UInt8, + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `BrowserLanguage` UInt16, + `BrowserCountry` UInt16, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `Params` Array(String), + `Goals` Nested( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32), + `WatchIDs` Array(UInt64), + `ParamSumPrice` Int64, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `ClickLogID` UInt64, + `ClickEventID` Int32, + `ClickGoodEvent` Int32, + `ClickEventTime` DateTime, + `ClickPriorityID` Int32, + `ClickPhraseID` Int32, + `ClickPageID` Int32, + `ClickPlaceID` Int32, + `ClickTypeID` Int32, + `ClickResourceID` Int32, + `ClickCost` UInt32, + `ClickClientIP` UInt32, + `ClickDomainID` UInt32, + `ClickURL` String, + `ClickAttempt` UInt8, + `ClickOrderID` UInt32, + `ClickBannerID` UInt32, + `ClickMarketCategoryID` UInt32, + `ClickMarketPP` UInt32, + `ClickMarketCategoryName` String, + `ClickMarketPPName` String, + `ClickAWAPSCampaignName` String, + `ClickPageName` String, + `ClickTargetType` UInt16, + `ClickTargetPhraseID` UInt64, + `ClickContextType` UInt8, + `ClickSelectType` Int8, + `ClickOptions` String, + `ClickGroupBannerID` Int32, + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `FirstVisit` DateTime, + `PredLastVisit` Date, + `LastVisit` Date, + `TotalVisits` UInt32, + `TraficSource` Nested( + ID Int8, + SearchEngineID UInt16, + AdvEngineID UInt8, + PlaceID UInt16, + SocialSourceNetworkID UInt8, + Domain String, + SearchPhrase String, + SocialSourcePage String), + `Attendance` FixedString(16), + `CLID` UInt32, + `YCLID` UInt64, + `NormalizedRefererHash` UInt64, + `SearchPhraseHash` UInt64, + `RefererDomainHash` UInt64, + `NormalizedStartURLHash` UInt64, + `StartURLDomainHash` UInt64, + `NormalizedEndURLHash` UInt64, + `TopLevelDomain` UInt64, + `URLScheme` UInt64, + `OpenstatServiceNameHash` UInt64, + `OpenstatCampaignIDHash` UInt64, + `OpenstatAdIDHash` UInt64, + `OpenstatSourceIDHash` UInt64, + `UTMSourceHash` UInt64, + `UTMMediumHash` UInt64, + `UTMCampaignHash` UInt64, + `UTMContentHash` UInt64, + `UTMTermHash` UInt64, + `FromHash` UInt64, + `WebVisorEnabled` UInt8, + `WebVisorActivity` UInt32, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `Market` Nested( + Type UInt8, + GoalID UInt32, + OrderID String, + OrderPrice Int64, + PP UInt32, + DirectPlaceID UInt32, + DirectOrderID UInt32, + DirectBannerID UInt32, + GoodID String, + GoodName String, + GoodQuantity Int32, + GoodPrice Int64), + `IslandID` FixedString(16) +) +ENGINE = CollapsingMergeTree(Sign) +PARTITION BY toYYYYMM(StartDate) +ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +Vous pouvez exécuter ces requêtes en utilisant le mode interactif de `clickhouse-client` (lancez - le simplement dans un terminal sans spécifier une requête à l’avance) ou essayez-en [interface de rechange](../interfaces/index.md) Si tu veux. + +Comme nous pouvons le voir, `hits_v1` utilise la [moteur MergeTree de base](../engines/table-engines/mergetree-family/mergetree.md) tandis que le `visits_v1` utilise la [Effondrer](../engines/table-engines/mergetree-family/collapsingmergetree.md) variante. + +### Importer Des Données {#import-data} + +L’importation de données vers ClickHouse se fait via [INSERT INTO](../sql-reference/statements/insert-into.md) requête comme dans de nombreuses autres bases de données SQL. Toutefois, les données sont généralement fournies dans l’une des [formats de sérialisation pris en charge](../interfaces/formats.md) plutôt `VALUES` clause (qui est également pris en charge). + +Les fichiers que nous avons téléchargés plus tôt sont au format séparé par des onglets, alors voici comment les importer via le client console: + +``` bash +clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv +clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv +``` + +ClickHouse a beaucoup de [les paramètres de tune](../operations/settings/index.md) et une façon de Les spécifier dans le client console est via des arguments, comme nous pouvons le voir avec `--max_insert_block_size`. La façon la plus simple de comprendre quels paramètres sont disponibles, que signifient-ils et quelles sont les valeurs par défaut est d’interroger le `system.settings` table: + +``` sql +SELECT name, value, changed, description +FROM system.settings +WHERE name LIKE '%max_insert_b%' +FORMAT TSV + +max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." +``` + +Optionnellement, vous pouvez [OPTIMIZE](../query_language/misc/#misc_operations-optimize) les tables après l’importation. Les Tables configurées avec un moteur de MergeTree-family font toujours des fusions de parties de données en arrière-plan pour optimiser le stockage des données (ou au moins vérifier si cela a du sens). Ces requêtes forcent le moteur de table à optimiser le stockage dès maintenant au lieu d’un certain temps plus tard: + +``` bash +clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" +clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" +``` + +Ces requêtes démarrent une opération intensive D’E/S et de CPU, donc si la table reçoit systématiquement de nouvelles données, il est préférable de la laisser seule et de laisser les fusions s’exécuter en arrière-plan. + +Maintenant, nous pouvons vérifier si l’importation de table a réussi: + +``` bash +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" +``` + +## Exemple De Requêtes {#example-queries} + +``` sql +SELECT + StartURL AS URL, + AVG(Duration) AS AvgDuration +FROM tutorial.visits_v1 +WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' +GROUP BY URL +ORDER BY AvgDuration DESC +LIMIT 10 +``` + +``` sql +SELECT + sum(Sign) AS visits, + sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, + (100. * goal_visits) / visits AS goal_percent +FROM tutorial.visits_v1 +WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') +``` + +## Déploiement De Cluster {#cluster-deployment} + +Clickhouse cluster est un cluster homogène. Étapes pour configurer: + +1. Installer clickhouse server sur toutes les machines du cluster +2. Configurer les configurations de cluster dans les fichiers de configuration +3. Créer des tables locales sur chaque instance +4. Créer un [Distribué table](../engines/table-engines/special/distributed.md) + +[Distribué table](../engines/table-engines/special/distributed.md) est en fait une sorte de “view” aux tables locales du cluster ClickHouse. SELECT query from a distributed table s’exécute à l’aide des ressources de tous les fragments du cluster. Vous pouvez spécifier des configurations pour plusieurs clusters et créer plusieurs tables distribuées fournissant des vues à différents clusters. + +Exemple de configuration pour un cluster avec trois fragments, une réplique chacun: + +``` xml + + + + + example-perftest01j.yandex.ru + 9000 + + + + + example-perftest02j.yandex.ru + 9000 + + + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +Pour plus de démonstration, créons une nouvelle table locale avec le même `CREATE TABLE` la requête que nous avons utilisé pour `hits_v1`, mais nom de table différent: + +``` sql +CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... +``` + +Création d’une table distribuée fournissant une vue dans les tables locales du cluster: + +``` sql +CREATE TABLE tutorial.hits_all AS tutorial.hits_local +ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); +``` + +Une pratique courante consiste à créer des tables distribuées similaires sur toutes les machines du cluster. Il permet d’exécuter des requêtes distribuées sur n’importe quelle machine du cluster. Il existe également une autre option pour créer une table distribuée temporaire pour une requête SELECT donnée en utilisant [distant](../sql-reference/table-functions/remote.md) table de fonction. + +Passons à l’exécution de [INSERT SELECT](../sql-reference/statements/insert-into.md) dans les Distribué table la table à plusieurs serveurs. + +``` sql +INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; +``` + +!!! warning "Avis" + Cette approche ne convient pas au sharding de grandes tables. Il y a un outil séparé [clickhouse-copieur](../operations/utilities/clickhouse-copier.md) cela peut re-fragmenter de grandes tables arbitraires. + +Comme vous pouvez vous y attendre, les requêtes lourdes de calcul s’exécutent N fois plus vite si elles utilisent 3 serveurs au lieu d’un. + +Dans ce cas, nous avons utilisé un cluster avec 3 fragments, et chacun contient une seule réplique. + +Pour assurer la résilience dans un environnement de production, nous recommandons que chaque fragment contienne 2-3 répliques réparties entre plusieurs zones de disponibilité ou centres de données (ou au moins des racks). Notez que ClickHouse prend en charge un nombre illimité de répliques. + +Exemple de configuration pour un cluster d’un fragment contenant trois répliques: + +``` xml + + ... + + + + example-perftest01j.yandex.ru + 9000 + + + example-perftest02j.yandex.ru + 9000 + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +Pour activer la réplication native [ZooKeeper](http://zookeeper.apache.org/) est requis. ClickHouse s’occupe de la cohérence des données sur toutes les répliques et exécute automatiquement la procédure de restauration après l’échec. Il est recommandé de déployer le cluster ZooKeeper sur des serveurs séparés (où aucun autre processus, y compris ClickHouse, n’est en cours d’exécution). + +!!! note "Note" + ZooKeeper est pas une exigence stricte: dans certains cas simples, vous pouvez dupliquer les données par écrit dans tous les réplicas de votre code d’application. Cette approche est **pas** recommandé, dans ce cas, ClickHouse ne sera pas en mesure de garantir la cohérence des données sur toutes les répliques. Ainsi, il devient la responsabilité de votre application. + +Les emplacements ZooKeeper sont spécifiés dans le fichier de configuration: + +``` xml + + + zoo01.yandex.ru + 2181 + + + zoo02.yandex.ru + 2181 + + + zoo03.yandex.ru + 2181 + + +``` + +En outre, nous devons définir des macros pour identifier chaque fragment et chaque réplique utilisés lors de la création de la table: + +``` xml + + 01 + 01 + +``` + +S’il n’y a pas de répliques pour le moment lors de la création de la table répliquée, une nouvelle première réplique est instanciée. S’il existe déjà des répliques en direct, la nouvelle réplique clone les données de celles existantes. Vous avez la possibilité de créer toutes les tables répliquées d’abord, et ensuite insérer les données. Une autre option consiste à créer des répliques et à en ajouter d’autres Après ou pendant l’insertion des données. + +``` sql +CREATE TABLE tutorial.hits_replica (...) +ENGINE = ReplcatedMergeTree( + '/clickhouse_perftest/tables/{shard}/hits', + '{replica}' +) +... +``` + +Ici, nous utilisons [ReplicatedMergeTree](../engines/table-engines/mergetree-family/replication.md) tableau moteur. Dans les paramètres, nous spécifions le chemin Zookeeper contenant des identificateurs de fragments et de répliques. + +``` sql +INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; +``` + +La réplication fonctionne en mode multi-maître. Les données peuvent être chargées dans n’importe quel réplica, et le système les synchronise ensuite automatiquement avec d’autres instances. La réplication est asynchrone, donc à un moment donné, toutes les répliques ne peuvent pas contenir de données récemment insérées. Au moins une réplique devrait être en place pour permettre l’ingestion de données. D’autres synchroniseront les données et répareront la cohérence une fois qu’ils redeviendront actifs. Notez que cette approche permet une faible possibilité de perte de données récemment insérées. + +[Article Original](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/fr/getting_started/example_datasets/amplab_benchmark.md b/docs/fr/getting_started/example_datasets/amplab_benchmark.md deleted file mode 100644 index 5e552480e01..00000000000 --- a/docs/fr/getting_started/example_datasets/amplab_benchmark.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 17 -toc_title: AMPLab Big Data Benchmark ---- - -# AMPLab Big Data Benchmark {#amplab-big-data-benchmark} - -Tu vois https://amplab.cs.berkeley.edu/benchmark/ - -Inscrivez-vous pour un compte GRATUIT à https://aws.amazon.com. il nécessite une carte de crédit, e-mail et numéro de téléphone. Obtenir une nouvelle clé d'accès à https://console.aws.amazon.com/iam/home?nc2=h\_m\_sc\#security\_credential - -Exécutez ce qui suit dans la console: - -``` bash -$ sudo apt-get install s3cmd -$ mkdir tiny; cd tiny; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/tiny/ . -$ cd .. -$ mkdir 1node; cd 1node; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/1node/ . -$ cd .. -$ mkdir 5nodes; cd 5nodes; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/5nodes/ . -$ cd .. -``` - -Exécutez les requêtes ClickHouse suivantes: - -``` sql -CREATE TABLE rankings_tiny -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_tiny -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); - -CREATE TABLE rankings_1node -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_1node -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); - -CREATE TABLE rankings_5nodes_on_single -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_5nodes_on_single -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); -``` - -Retournez à la console: - -``` bash -$ for i in tiny/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_tiny FORMAT CSV"; done -$ for i in tiny/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_tiny FORMAT CSV"; done -$ for i in 1node/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_1node FORMAT CSV"; done -$ for i in 1node/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_1node FORMAT CSV"; done -$ for i in 5nodes/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_5nodes_on_single FORMAT CSV"; done -$ for i in 5nodes/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_5nodes_on_single FORMAT CSV"; done -``` - -Requêtes pour obtenir des échantillons de données: - -``` sql -SELECT pageURL, pageRank FROM rankings_1node WHERE pageRank > 1000 - -SELECT substring(sourceIP, 1, 8), sum(adRevenue) FROM uservisits_1node GROUP BY substring(sourceIP, 1, 8) - -SELECT - sourceIP, - sum(adRevenue) AS totalRevenue, - avg(pageRank) AS pageRank -FROM rankings_1node ALL INNER JOIN -( - SELECT - sourceIP, - destinationURL AS pageURL, - adRevenue - FROM uservisits_1node - WHERE (visitDate > '1980-01-01') AND (visitDate < '1980-04-01') -) USING pageURL -GROUP BY sourceIP -ORDER BY totalRevenue DESC -LIMIT 1 -``` - -[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/amplab_benchmark/) diff --git a/docs/fr/getting_started/example_datasets/criteo.md b/docs/fr/getting_started/example_datasets/criteo.md deleted file mode 100644 index 7669209d032..00000000000 --- a/docs/fr/getting_started/example_datasets/criteo.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 19 -toc_title: "T\xE9raoctet click Logs de Criteo" ---- - -# Téraoctet de journaux de clics de Criteo {#terabyte-of-click-logs-from-criteo} - -Télécharger les données à partir de http://labs.criteo.com/downloads/download-terabyte-click-logs/ - -Créer une table pour importer le journal: - -``` sql -CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log -``` - -Télécharger les données: - -``` bash -$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done -``` - -Créer une table pour les données converties: - -``` sql -CREATE TABLE criteo -( - date Date, - clicked UInt8, - int1 Int32, - int2 Int32, - int3 Int32, - int4 Int32, - int5 Int32, - int6 Int32, - int7 Int32, - int8 Int32, - int9 Int32, - int10 Int32, - int11 Int32, - int12 Int32, - int13 Int32, - icat1 UInt32, - icat2 UInt32, - icat3 UInt32, - icat4 UInt32, - icat5 UInt32, - icat6 UInt32, - icat7 UInt32, - icat8 UInt32, - icat9 UInt32, - icat10 UInt32, - icat11 UInt32, - icat12 UInt32, - icat13 UInt32, - icat14 UInt32, - icat15 UInt32, - icat16 UInt32, - icat17 UInt32, - icat18 UInt32, - icat19 UInt32, - icat20 UInt32, - icat21 UInt32, - icat22 UInt32, - icat23 UInt32, - icat24 UInt32, - icat25 UInt32, - icat26 UInt32 -) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) -``` - -Transformez les données du journal brut et placez - les dans la deuxième table: - -``` sql -INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; - -DROP TABLE criteo_log; -``` - -[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/fr/getting_started/example_datasets/index.md b/docs/fr/getting_started/example_datasets/index.md deleted file mode 100644 index f3aaf473527..00000000000 --- a/docs/fr/getting_started/example_datasets/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Example Datasets -toc_priority: 12 -toc_title: Introduction ---- - -# Exemple De Jeux De Données {#example-datasets} - -Cette section décrit comment obtenir des exemples de jeux de données et les importer dans ClickHouse. -Pour certains ensembles de données exemple les requêtes sont également disponibles. - -- [Yandex Anonymisé.Metrica Dataset](metrica.md) -- [Référence Du Schéma En Étoile](star_schema.md) -- [WikiStat](wikistat.md) -- [Téraoctet de journaux de clics de Criteo](criteo.md) -- [AMPLab Big Data Benchmark](amplab_benchmark.md) -- [New York Taxi Données](nyc_taxi.md) -- [OnTime](ontime.md) - -[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/fr/getting_started/example_datasets/metrica.md b/docs/fr/getting_started/example_datasets/metrica.md deleted file mode 100644 index 7b148781e3a..00000000000 --- a/docs/fr/getting_started/example_datasets/metrica.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 21 -toc_title: "Yandex.Metrica De Donn\xE9es" ---- - -# Yandex Anonymisé.Metrica De Données {#anonymized-yandex-metrica-data} - -Dataset se compose de deux tables contenant des données anonymisées sur les hits (`hits_v1`) et les visites (`visits_v1`) de Yandex.Metrica. Vous pouvez en savoir plus sur Yandex.Metrica dans [Histoire de ClickHouse](../../introduction/history.md) section. - -L'ensemble de données se compose de deux tables, l'une d'elles peut être téléchargée sous forme compressée `tsv.xz` fichier ou comme partitions préparées. En outre, une version étendue de l' `hits` table contenant 100 millions de lignes est disponible comme TSV à https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz et comme partitions préparées à https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. - -## Obtention de Tables à partir de Partitions préparées {#obtaining-tables-from-prepared-partitions} - -Télécharger et importer la table hits: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar -tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -Télécharger et importer des visites: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar -tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Obtention de Tables à partir D'un fichier TSV compressé {#obtaining-tables-from-compressed-tsv-file} - -Télécharger et importer des hits à partir du fichier TSV compressé: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -Télécharger et importer des visites à partir du fichier TSV compressé: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Exemple De Requêtes {#example-queries} - -[Tutoriel ClickHouse](../../getting_started/tutorial.md) est basé sur Yandex.Metrica dataset et la façon recommandée pour commencer avec cet ensemble de données est de simplement passer par tutoriel. - -D'autres exemples de requêtes pour ces tables peuvent être trouvés parmi [tests avec État](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) de ClickHouse (ils sont nommés `test.hists` et `test.visits` y). diff --git a/docs/fr/getting_started/example_datasets/nyc_taxi.md b/docs/fr/getting_started/example_datasets/nyc_taxi.md deleted file mode 100644 index 6f002ecec9a..00000000000 --- a/docs/fr/getting_started/example_datasets/nyc_taxi.md +++ /dev/null @@ -1,390 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 16 -toc_title: "New York Taxi Donn\xE9es" ---- - -# New York Taxi Données {#new-york-taxi-data} - -Ce jeu de données peut être obtenu de deux façons: - -- importation à partir de données brutes -- téléchargement de partitions - -## Comment importer les données brutes {#how-to-import-the-raw-data} - -Tu vois https://github.com/toddwschneider/nyc-taxi-data et http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html pour la description d'un ensemble de données et les instructions de téléchargement. - -Le téléchargement entraînera environ 227 Go de données non compressées dans des fichiers CSV. Le téléchargement prend environ une heure sur une connexion 1 Gbit (téléchargement parallèle depuis s3.amazonaws.com récupère au moins la moitié d'un canal 1 Gbit). -Certains fichiers peuvent ne pas télécharger entièrement. Vérifiez la taille des fichiers et re-télécharger tout ce qui semble douteux. - -Certains fichiers peuvent contenir des lignes invalides. Vous pouvez les corriger comme suit: - -``` bash -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ -mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv -mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv -``` - -Ensuite, les données doivent être pré-traitées dans PostgreSQL. Cela créera des sélections de points dans les polygones (pour faire correspondre les points sur la carte avec les arrondissements de New York) et combinera toutes les données en une seule table plate dénormalisée à l'aide d'une jointure. Pour ce faire, vous devrez installer PostgreSQL avec le support PostGIS. - -Soyez prudent lors de l'exécution `initialize_database.sh` et vérifiez à nouveau manuellement que toutes les tables ont été créées correctement. - -Il faut environ 20-30 minutes pour traiter la valeur de chaque mois de données dans PostgreSQL, pour un total d'environ 48 heures. - -Vous pouvez vérifier le nombre de téléchargé lignes comme suit: - -``` bash -$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" -## Count - 1298979494 -(1 row) - -real 7m9.164s -``` - -(C'est un peu plus de 1,1 milliard de lignes rapportées par Mark Litwintschik dans une série de billets de blog.) - -Les données de PostgreSQL utilisent 370 GO d'espace. - -Exportation des données depuis PostgreSQL: - -``` sql -COPY -( - SELECT trips.id, - trips.vendor_id, - trips.pickup_datetime, - trips.dropoff_datetime, - trips.store_and_fwd_flag, - trips.rate_code_id, - trips.pickup_longitude, - trips.pickup_latitude, - trips.dropoff_longitude, - trips.dropoff_latitude, - trips.passenger_count, - trips.trip_distance, - trips.fare_amount, - trips.extra, - trips.mta_tax, - trips.tip_amount, - trips.tolls_amount, - trips.ehail_fee, - trips.improvement_surcharge, - trips.total_amount, - trips.payment_type, - trips.trip_type, - trips.pickup, - trips.dropoff, - - cab_types.type cab_type, - - weather.precipitation_tenths_of_mm rain, - weather.snow_depth_mm, - weather.snowfall_mm, - weather.max_temperature_tenths_degrees_celsius max_temp, - weather.min_temperature_tenths_degrees_celsius min_temp, - weather.average_wind_speed_tenths_of_meters_per_second wind, - - pick_up.gid pickup_nyct2010_gid, - pick_up.ctlabel pickup_ctlabel, - pick_up.borocode pickup_borocode, - pick_up.boroname pickup_boroname, - pick_up.ct2010 pickup_ct2010, - pick_up.boroct2010 pickup_boroct2010, - pick_up.cdeligibil pickup_cdeligibil, - pick_up.ntacode pickup_ntacode, - pick_up.ntaname pickup_ntaname, - pick_up.puma pickup_puma, - - drop_off.gid dropoff_nyct2010_gid, - drop_off.ctlabel dropoff_ctlabel, - drop_off.borocode dropoff_borocode, - drop_off.boroname dropoff_boroname, - drop_off.ct2010 dropoff_ct2010, - drop_off.boroct2010 dropoff_boroct2010, - drop_off.cdeligibil dropoff_cdeligibil, - drop_off.ntacode dropoff_ntacode, - drop_off.ntaname dropoff_ntaname, - drop_off.puma dropoff_puma - FROM trips - LEFT JOIN cab_types - ON trips.cab_type_id = cab_types.id - LEFT JOIN central_park_weather_observations_raw weather - ON weather.date = trips.pickup_datetime::date - LEFT JOIN nyct2010 pick_up - ON pick_up.gid = trips.pickup_nyct2010_gid - LEFT JOIN nyct2010 drop_off - ON drop_off.gid = trips.dropoff_nyct2010_gid -) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; -``` - -L'instantané de données est créé à une vitesse d'environ 50 Mo par seconde. Lors de la création de l'instantané, PostgreSQL lit à partir du disque à une vitesse d'environ 28 Mo par seconde. -Cela prend environ 5 heures. Le fichier TSV résultant est 590612904969 octets. - -Créer une table temporaire dans ClickHouse: - -``` sql -CREATE TABLE trips -( -trip_id UInt32, -vendor_id String, -pickup_datetime DateTime, -dropoff_datetime Nullable(DateTime), -store_and_fwd_flag Nullable(FixedString(1)), -rate_code_id Nullable(UInt8), -pickup_longitude Nullable(Float64), -pickup_latitude Nullable(Float64), -dropoff_longitude Nullable(Float64), -dropoff_latitude Nullable(Float64), -passenger_count Nullable(UInt8), -trip_distance Nullable(Float64), -fare_amount Nullable(Float32), -extra Nullable(Float32), -mta_tax Nullable(Float32), -tip_amount Nullable(Float32), -tolls_amount Nullable(Float32), -ehail_fee Nullable(Float32), -improvement_surcharge Nullable(Float32), -total_amount Nullable(Float32), -payment_type Nullable(String), -trip_type Nullable(UInt8), -pickup Nullable(String), -dropoff Nullable(String), -cab_type Nullable(String), -precipitation Nullable(UInt8), -snow_depth Nullable(UInt8), -snowfall Nullable(UInt8), -max_temperature Nullable(UInt8), -min_temperature Nullable(UInt8), -average_wind_speed Nullable(UInt8), -pickup_nyct2010_gid Nullable(UInt8), -pickup_ctlabel Nullable(String), -pickup_borocode Nullable(UInt8), -pickup_boroname Nullable(String), -pickup_ct2010 Nullable(String), -pickup_boroct2010 Nullable(String), -pickup_cdeligibil Nullable(FixedString(1)), -pickup_ntacode Nullable(String), -pickup_ntaname Nullable(String), -pickup_puma Nullable(String), -dropoff_nyct2010_gid Nullable(UInt8), -dropoff_ctlabel Nullable(String), -dropoff_borocode Nullable(UInt8), -dropoff_boroname Nullable(String), -dropoff_ct2010 Nullable(String), -dropoff_boroct2010 Nullable(String), -dropoff_cdeligibil Nullable(String), -dropoff_ntacode Nullable(String), -dropoff_ntaname Nullable(String), -dropoff_puma Nullable(String) -) ENGINE = Log; -``` - -Il est nécessaire pour convertir les champs en types de données plus corrects et, si possible, pour éliminer les valeurs Null. - -``` bash -$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv - -real 75m56.214s -``` - -Les données sont lues à une vitesse de 112-140 Mo/seconde. -Le chargement de données dans une table de type de journal dans un flux a pris 76 minutes. -Les données de ce tableau utilisent 142 GO. - -(L'importation de données directement depuis Postgres est également possible en utilisant `COPY ... TO PROGRAM`.) - -Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. - -Pour commencer, nous allons créer une table sur un serveur unique. Plus tard, nous ferons le tableau distribué. - -Créer et remplir un tableau récapitulatif: - -``` sql -CREATE TABLE trips_mergetree -ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -AS SELECT - -trip_id, -CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, -toDate(pickup_datetime) AS pickup_date, -ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, -toDate(dropoff_datetime) AS dropoff_date, -ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, -assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, -assumeNotNull(rate_code_id) AS rate_code_id, -assumeNotNull(pickup_longitude) AS pickup_longitude, -assumeNotNull(pickup_latitude) AS pickup_latitude, -assumeNotNull(dropoff_longitude) AS dropoff_longitude, -assumeNotNull(dropoff_latitude) AS dropoff_latitude, -assumeNotNull(passenger_count) AS passenger_count, -assumeNotNull(trip_distance) AS trip_distance, -assumeNotNull(fare_amount) AS fare_amount, -assumeNotNull(extra) AS extra, -assumeNotNull(mta_tax) AS mta_tax, -assumeNotNull(tip_amount) AS tip_amount, -assumeNotNull(tolls_amount) AS tolls_amount, -assumeNotNull(ehail_fee) AS ehail_fee, -assumeNotNull(improvement_surcharge) AS improvement_surcharge, -assumeNotNull(total_amount) AS total_amount, -CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, -assumeNotNull(trip_type) AS trip_type, -ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, -ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, -CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, - -assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, -toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, -assumeNotNull(pickup_borocode) AS pickup_borocode, -CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, -toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, -toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, -CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, -toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, - -CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, - -toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, - -assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, -toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, -assumeNotNull(dropoff_borocode) AS dropoff_borocode, -CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, -toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, -toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, -CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, -toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, - -CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, - -toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma - -FROM trips -``` - -Cela prend 3030 secondes à une vitesse d'environ 428 000 lignes par seconde. -Pour le charger plus rapidement, vous pouvez créer la table avec le `Log` le moteur de `MergeTree`. Dans ce cas, le téléchargement fonctionne plus rapidement que 200 secondes. - -La table utilise 126 GO d'espace disque. - -``` sql -SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active -``` - -``` text -┌─formatReadableSize(sum(bytes))─┐ -│ 126.18 GiB │ -└────────────────────────────────┘ -``` - -Entre autres choses, vous pouvez exécuter la requête OPTIMIZE sur MergeTree. Mais ce n'est pas nécessaire puisque tout ira bien sans elle. - -## Téléchargement des Partitions préparées {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar -$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" -``` - -!!! info "Info" - Si vous exécutez les requêtes décrites ci-dessous, vous devez utiliser le nom complet de la table, `datasets.trips_mergetree`. - -## Résultats sur un seul serveur {#results-on-single-server} - -Q1: - -``` sql -SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type -``` - -0.490 secondes. - -Q2: - -``` sql -SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count -``` - -1.224 secondes. - -Q3: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year -``` - -2.104 secondes. - -Q4: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) -FROM trips_mergetree -GROUP BY passenger_count, year, distance -ORDER BY year, count(*) DESC -``` - -3.593 secondes. - -Le serveur suivant a été utilisé: - -Deux Intel (R) Xeon (R) CPU E5-2650 v2 @ 2.60 GHz, 16 noyaux physiques total, 128 GiB RAM, 8x6 TB HD sur le matériel RAID-5 - -Temps d'exécution est le meilleur des trois pistes. Mais à partir de la deuxième exécution, les requêtes lisent les données du cache du système de fichiers. Aucune autre mise en cache ne se produit: les données sont lues et traitées à chaque exécution. - -La création d'un tableau sur trois serveurs: - -Sur chaque serveur: - -``` sql -CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -``` - -Sur le serveur source: - -``` sql -CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) -``` - -La requête suivante redistribue les données: - -``` sql -INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree -``` - -Cela prend 2454 secondes. - -Sur les trois serveurs: - -Q1: 0.212 secondes. -Q2: 0.438 secondes. -Q3: 0.733 secondes. -Q4: 1.241 secondes. - -Pas de surprise ici, depuis les requêtes sont réparties linéairement. - -Nous avons également les résultats d'un cluster de 140 serveurs: - -Q1: 0,028 sec. -Q2: 0,043 sec. -Q3: 0,051 sec. -Q4: 0,072 sec. - -Dans ce cas, le temps de traitement des requêtes est déterminé surtout par la latence du réseau. -Nous avons exécuté des requêtes en utilisant un client situé dans un centre de données Yandex en Finlande sur un cluster en Russie, ce qui a ajouté environ 20 ms de latence. - -## Résumé {#summary} - -| serveur | Q1 | Q2 | Q3 | Q4 | -|---------|-------|-------|-------|-------| -| 1 | 0.490 | 1.224 | 2.104 | 3.593 | -| 3 | 0.212 | 0.438 | 0.733 | 1.241 | -| 140 | 0.028 | 0.043 | 0.051 | 0.072 | - -[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/fr/getting_started/example_datasets/ontime.md b/docs/fr/getting_started/example_datasets/ontime.md deleted file mode 100644 index 2ee93d3d556..00000000000 --- a/docs/fr/getting_started/example_datasets/ontime.md +++ /dev/null @@ -1,412 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 15 -toc_title: OnTime ---- - -# OnTime {#ontime} - -Ce jeu de données peut être obtenu de deux façons: - -- importation à partir de données brutes -- téléchargement de partitions - -## Importation À Partir De Données Brutes {#import-from-raw-data} - -Téléchargement de données: - -``` bash -for s in `seq 1987 2018` -do -for m in `seq 1 12` -do -wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip -done -done -``` - -(à partir de https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) - -Création d'une table: - -``` sql -CREATE TABLE `ontime` ( - `Year` UInt16, - `Quarter` UInt8, - `Month` UInt8, - `DayofMonth` UInt8, - `DayOfWeek` UInt8, - `FlightDate` Date, - `UniqueCarrier` FixedString(7), - `AirlineID` Int32, - `Carrier` FixedString(2), - `TailNum` String, - `FlightNum` String, - `OriginAirportID` Int32, - `OriginAirportSeqID` Int32, - `OriginCityMarketID` Int32, - `Origin` FixedString(5), - `OriginCityName` String, - `OriginState` FixedString(2), - `OriginStateFips` String, - `OriginStateName` String, - `OriginWac` Int32, - `DestAirportID` Int32, - `DestAirportSeqID` Int32, - `DestCityMarketID` Int32, - `Dest` FixedString(5), - `DestCityName` String, - `DestState` FixedString(2), - `DestStateFips` String, - `DestStateName` String, - `DestWac` Int32, - `CRSDepTime` Int32, - `DepTime` Int32, - `DepDelay` Int32, - `DepDelayMinutes` Int32, - `DepDel15` Int32, - `DepartureDelayGroups` String, - `DepTimeBlk` String, - `TaxiOut` Int32, - `WheelsOff` Int32, - `WheelsOn` Int32, - `TaxiIn` Int32, - `CRSArrTime` Int32, - `ArrTime` Int32, - `ArrDelay` Int32, - `ArrDelayMinutes` Int32, - `ArrDel15` Int32, - `ArrivalDelayGroups` Int32, - `ArrTimeBlk` String, - `Cancelled` UInt8, - `CancellationCode` FixedString(1), - `Diverted` UInt8, - `CRSElapsedTime` Int32, - `ActualElapsedTime` Int32, - `AirTime` Int32, - `Flights` Int32, - `Distance` Int32, - `DistanceGroup` UInt8, - `CarrierDelay` Int32, - `WeatherDelay` Int32, - `NASDelay` Int32, - `SecurityDelay` Int32, - `LateAircraftDelay` Int32, - `FirstDepTime` String, - `TotalAddGTime` String, - `LongestAddGTime` String, - `DivAirportLandings` String, - `DivReachedDest` String, - `DivActualElapsedTime` String, - `DivArrDelay` String, - `DivDistance` String, - `Div1Airport` String, - `Div1AirportID` Int32, - `Div1AirportSeqID` Int32, - `Div1WheelsOn` String, - `Div1TotalGTime` String, - `Div1LongestGTime` String, - `Div1WheelsOff` String, - `Div1TailNum` String, - `Div2Airport` String, - `Div2AirportID` Int32, - `Div2AirportSeqID` Int32, - `Div2WheelsOn` String, - `Div2TotalGTime` String, - `Div2LongestGTime` String, - `Div2WheelsOff` String, - `Div2TailNum` String, - `Div3Airport` String, - `Div3AirportID` Int32, - `Div3AirportSeqID` Int32, - `Div3WheelsOn` String, - `Div3TotalGTime` String, - `Div3LongestGTime` String, - `Div3WheelsOff` String, - `Div3TailNum` String, - `Div4Airport` String, - `Div4AirportID` Int32, - `Div4AirportSeqID` Int32, - `Div4WheelsOn` String, - `Div4TotalGTime` String, - `Div4LongestGTime` String, - `Div4WheelsOff` String, - `Div4TailNum` String, - `Div5Airport` String, - `Div5AirportID` Int32, - `Div5AirportSeqID` Int32, - `Div5WheelsOn` String, - `Div5TotalGTime` String, - `Div5LongestGTime` String, - `Div5WheelsOff` String, - `Div5TailNum` String -) ENGINE = MergeTree -PARTITION BY Year -ORDER BY (Carrier, FlightDate) -SETTINGS index_granularity = 8192; -``` - -Le chargement des données: - -``` bash -$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done -``` - -## Téléchargement des Partitions préparées {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar -$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.ontime" -``` - -!!! info "Info" - Si vous exécutez les requêtes décrites ci-dessous, vous devez utiliser le nom complet de la table, `datasets.ontime`. - -## Requête {#queries} - -Q0. - -``` sql -SELECT avg(c1) -FROM -( - SELECT Year, Month, count(*) AS c1 - FROM ontime - GROUP BY Year, Month -); -``` - -T1. Le nombre de vols par jour de l'année 2000 à 2008 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -T2. Le nombre de vols retardés de plus de 10 minutes, regroupés par jour de la semaine, pour 2000-2008 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -T3. Le nombre de retards par l'aéroport pour 2000-2008 - -``` sql -SELECT Origin, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY Origin -ORDER BY c DESC -LIMIT 10; -``` - -T4. Nombre de retards par transporteur pour 2007 - -``` sql -SELECT Carrier, count(*) -FROM ontime -WHERE DepDelay>10 AND Year=2007 -GROUP BY Carrier -ORDER BY count(*) DESC; -``` - -Q5. Pourcentage de retards par transporteur pour 2007 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year=2007 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year=2007 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Meilleure version de la même requête: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year=2007 -GROUP BY Carrier -ORDER BY c3 DESC -``` - -Q6. La demande précédente pour une plus large gamme d'années, 2000-2008 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year>=2000 AND Year<=2008 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year>=2000 AND Year<=2008 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Meilleure version de la même requête: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY Carrier -ORDER BY c3 DESC; -``` - -Q7. Pourcentage de vols retardés de plus de 10 minutes, par année - -``` sql -SELECT Year, c1/c2 -FROM -( - select - Year, - count(*)*100 as c1 - from ontime - WHERE DepDelay>10 - GROUP BY Year -) -JOIN -( - select - Year, - count(*) as c2 - from ontime - GROUP BY Year -) USING (Year) -ORDER BY Year; -``` - -Meilleure version de la même requête: - -``` sql -SELECT Year, avg(DepDelay>10)*100 -FROM ontime -GROUP BY Year -ORDER BY Year; -``` - -Q8. Les destinations les plus populaires par le nombre de villes directement connectées pour différentes plages d'années - -``` sql -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -WHERE Year >= 2000 and Year <= 2010 -GROUP BY DestCityName -ORDER BY u DESC LIMIT 10; -``` - -Q9. - -``` sql -SELECT Year, count(*) AS c1 -FROM ontime -GROUP BY Year; -``` - -Q10. - -``` sql -SELECT - min(Year), max(Year), Carrier, count(*) AS cnt, - sum(ArrDelayMinutes>30) AS flights_delayed, - round(sum(ArrDelayMinutes>30)/count(*),2) AS rate -FROM ontime -WHERE - DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') - AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') - AND FlightDate < '2010-01-01' -GROUP by Carrier -HAVING cnt>100000 and max(Year)>1990 -ORDER by rate DESC -LIMIT 1000; -``` - -Bonus: - -``` sql -SELECT avg(cnt) -FROM -( - SELECT Year,Month,count(*) AS cnt - FROM ontime - WHERE DepDel15=1 - GROUP BY Year,Month -); - -SELECT avg(c1) FROM -( - SELECT Year,Month,count(*) AS c1 - FROM ontime - GROUP BY Year,Month -); - -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -GROUP BY DestCityName -ORDER BY u DESC -LIMIT 10; - -SELECT OriginCityName, DestCityName, count() AS c -FROM ontime -GROUP BY OriginCityName, DestCityName -ORDER BY c DESC -LIMIT 10; - -SELECT OriginCityName, count() AS c -FROM ontime -GROUP BY OriginCityName -ORDER BY c DESC -LIMIT 10; -``` - -Ce test de performance a été créé par Vadim Tkachenko. Voir: - -- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ -- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ -- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ -- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ -- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ -- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html - -[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/fr/getting_started/example_datasets/wikistat.md b/docs/fr/getting_started/example_datasets/wikistat.md deleted file mode 100644 index e3b8a322f09..00000000000 --- a/docs/fr/getting_started/example_datasets/wikistat.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 18 -toc_title: WikiStat ---- - -# WikiStat {#wikistat} - -Voir: http://dumps.wikimedia.org/other/pagecounts-raw/ - -Création d'une table: - -``` sql -CREATE TABLE wikistat -( - date Date, - time DateTime, - project String, - subproject String, - path String, - hits UInt64, - size UInt64 -) ENGINE = MergeTree(date, (path, time), 8192); -``` - -Le chargement des données: - -``` bash -$ for i in {2007..2016}; do for j in {01..12}; do echo $i-$j >&2; curl -sSL "http://dumps.wikimedia.org/other/pagecounts-raw/$i/$i-$j/" | grep -oE 'pagecounts-[0-9]+-[0-9]+\.gz'; done; done | sort | uniq | tee links.txt -$ cat links.txt | while read link; do wget http://dumps.wikimedia.org/other/pagecounts-raw/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1/')/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1-\2/')/$link; done -$ ls -1 /opt/wikistat/ | grep gz | while read i; do echo $i; gzip -cd /opt/wikistat/$i | ./wikistat-loader --time="$(echo -n $i | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2})\.gz/\1-\2-\3 \4-00-00/')" | clickhouse-client --query="INSERT INTO wikistat FORMAT TabSeparated"; done -``` - -[Article Original](https://clickhouse.tech/docs/en/getting_started/example_datasets/wikistat/) diff --git a/docs/fr/getting_started/index.md b/docs/fr/getting_started/index.md deleted file mode 100644 index 375c87b112c..00000000000 --- a/docs/fr/getting_started/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Getting Started -toc_hidden: true -toc_priority: 8 -toc_title: "cach\xE9s" ---- - -# Prise En Main {#getting-started} - -Si vous êtes nouveau à ClickHouse et que vous voulez obtenir un sentiment pratique de sa performance, tout d'abord, vous devez passer par le [processus d'installation](install.md). Après cela, vous pouvez: - -- [Passez par tutoriel détaillé](tutorial.md) -- [Expérience avec des exemples de jeux de données](example_datasets/ontime.md) - -[Article Original](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/fr/getting_started/install.md b/docs/fr/getting_started/install.md deleted file mode 100644 index 72e59b279f1..00000000000 --- a/docs/fr/getting_started/install.md +++ /dev/null @@ -1,191 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 11 -toc_title: Installation ---- - -# Installation {#installation} - -## Configuration Système Requise {#system-requirements} - -ClickHouse peut fonctionner sur N'importe quel Linux, FreeBSD ou Mac OS X avec une architecture CPU x86\_64, AArch64 ou PowerPC64LE. - -Les binaires pré-construits officiels sont généralement compilés pour le jeu d'instructions x86\_64 et leverage SSE 4.2, donc sauf indication contraire, l'utilisation du processeur qui le prend en charge devient une exigence système supplémentaire. Voici la commande pour vérifier si le processeur actuel prend en charge SSE 4.2: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -Pour exécuter ClickHouse sur des processeurs qui ne prennent pas en charge SSE 4.2 ou qui ont une architecture AArch64 ou PowerPC64LE, vous devez [construire ClickHouse à partir de sources](#from-sources) avec des ajustements de configuration appropriés. - -## Options D'Installation Disponibles {#available-installation-options} - -### À partir de paquets DEB {#install-from-deb-packages} - -Il est recommandé d'utiliser officiel pré-compilé `deb` Paquets Pour Debian ou Ubuntu. - -Pour installer les paquets officiels ajoutez le référentiel Yandex dans `/etc/apt/sources.list` ou dans un autre `/etc/apt/sources.list.d/clickhouse.list` fichier: - - deb http://repo.clickhouse.tech/deb/stable/ main/ - -Si vous souhaitez utiliser la version la plus récente, remplacer `stable` avec `testing` (ceci est recommandé pour vos environnements de test). - -Exécutez ensuite ces commandes pour installer les paquets: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -Vous pouvez également télécharger et installer des paquets manuellement à partir d'ici: https://repo.yandex.ru/clickhouse/deb/stable/main/. - -#### Paquet {#packages} - -- `clickhouse-common-static` — Installs ClickHouse compiled binary files. -- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` et installe la configuration du serveur par défaut. -- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` et d'autres outils. et installe les fichiers de configuration du client. -- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. - -### À partir de paquets RPM {#from-rpm-packages} - -Il est recommandé d'utiliser officiel pré-compilé `rpm` packages pour CentOS, RedHat et toutes les autres distributions Linux basées sur rpm. - -Tout d'abord, vous devez ajouter le dépôt officiel: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 -``` - -Si vous souhaitez utiliser la version la plus récente, remplacer `stable` avec `testing` (ceci est recommandé pour vos environnements de test). Le `prestable` la balise est parfois trop. - -Exécutez ensuite ces commandes pour installer les paquets: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -Vous pouvez également télécharger et installer des paquets manuellement à partir d'ici: https://repo.clickhouse.tech / rpm / stable / x86\_64. - -### À partir d'archives tgz {#from-tgz-archives} - -Il est recommandé d'utiliser officiel pré-compilé `tgz` archives pour toutes les distributions Linux, où l'installation de `deb` ou `rpm` les emballages n'est pas possible. - -La version requise peut être téléchargée avec `curl` ou `wget` depuis le référentiel https://repo.yandex.ru/clickhouse/tgz/. -Après cela, les archives téléchargées doivent être décompressées et installées avec des scripts d'installation. Exemple pour la dernière version: - -``` bash -export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz - -tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz -sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz -sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-server-$LATEST_VERSION.tgz -sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh -sudo /etc/init.d/clickhouse-server start - -tar -xzvf clickhouse-client-$LATEST_VERSION.tgz -sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh -``` - -Pour les environnements de production, il est recommandé d'utiliser la dernière `stable`-version. Vous pouvez trouver son numéro sur la page GitHub https://github.com/ClickHouse/ClickHouse/tags avec postfix `-stable`. - -### À Partir De L'Image Docker {#from-docker-image} - -Pour exécuter Clickhouse à L'intérieur Docker suivez le guide sur [Hub Docker](https://hub.docker.com/r/yandex/clickhouse-server/). Ces images utilisent officiel `deb` les paquets à l'intérieur. - -### À Partir De Sources {#from-sources} - -Pour compiler manuellement ClickHouse, suivez les instructions pour [Linux](../development/build.md) ou [Mac OS X](../development/build_osx.md). - -Vous pouvez compiler des paquets et les installer ou utiliser des programmes sans installer de paquets. En outre, en construisant manuellement, vous pouvez désactiver L'exigence SSE 4.2 ou construire pour les processeurs AArch64. - - Client: programs/clickhouse-client - Server: programs/clickhouse-server - -Vous devrez créer un dossier de données et de métadonnées et `chown` pour l'utilisateur souhaité. Leurs chemins peuvent être modifiés dans la configuration du serveur (src / programs / server / config.xml), par défaut, ils sont: - - /opt/clickhouse/data/default/ - /opt/clickhouse/metadata/default/ - -Sur Gentoo, vous pouvez simplement utiliser `emerge clickhouse` pour installer ClickHouse à partir de sources. - -## Lancer {#launch} - -Pour démarrer le serveur en tant que démon, exécutez: - -``` bash -$ sudo service clickhouse-server start -``` - -Si vous n'avez pas `service` commande, exécuter comme - -``` bash -$ sudo /etc/init.d/clickhouse-server start -``` - -Voir les journaux dans le `/var/log/clickhouse-server/` répertoire. - -Si le serveur ne démarre pas, vérifiez les configurations dans le fichier `/etc/clickhouse-server/config.xml`. - -Vous pouvez également lancer manuellement le serveur à partir de la console: - -``` bash -$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -Dans ce cas, le journal sera imprimé sur la console, ce qui est pratique lors du développement. -Si le fichier de configuration se trouve dans le répertoire courant, vous n'avez pas besoin `--config-file` paramètre. Par défaut, il utilise `./config.xml`. - -ClickHouse prend en charge les paramètres de restriction d'accès. Ils sont situés dans la `users.xml` fichier (à côté de `config.xml`). -Par défaut, l'accès est autorisé depuis n'importe où pour `default` l'utilisateur, sans un mot de passe. Voir `user/default/networks`. -Pour plus d'informations, consultez la section [“Configuration Files”](../operations/configuration_files.md). - -Après le lancement du serveur, vous pouvez utiliser le client de ligne de commande pour vous y connecter: - -``` bash -$ clickhouse-client -``` - -Par défaut, il se connecte à `localhost:9000` au nom de l'utilisateur `default` sans un mot de passe. Il peut également être utilisé pour se connecter à un serveur distant en utilisant `--host` argument. - -Le terminal doit utiliser L'encodage UTF-8. -Pour plus d'informations, consultez la section [“Command-line client”](../interfaces/cli.md). - -Exemple: - -``` bash -$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**Félicitations, le système fonctionne!** - -Pour continuer à expérimenter, vous pouvez télécharger l'un des jeux de données de test ou passer par [tutoriel](https://clickhouse.tech/tutorial.html). - -[Article Original](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/fr/getting_started/playground.md b/docs/fr/getting_started/playground.md deleted file mode 100644 index 57993309923..00000000000 --- a/docs/fr/getting_started/playground.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 14 -toc_title: "R\xE9cr\xE9ation" ---- - -# Clickhouse Aire De Jeux {#clickhouse-playground} - -[Clickhouse Aire De Jeux](https://play.clickhouse.tech?file=welcome) permet aux utilisateurs d'expérimenter avec ClickHouse en exécutant des requêtes instantanément, sans configurer leur serveur ou leur cluster. -Plusieurs exemples de jeux de données sont disponibles dans le terrain de jeu ainsi que des exemples de requêtes qui montrent les fonctionnalités de ClickHouse. - -Les requêtes sont exécutées comme un utilisateur en lecture seule. Cela implique certaines limites: - -- Les requêtes DDL ne sont pas autorisées -- Les requêtes D'insertion ne sont pas autorisées - -Les paramètres suivants sont également appliquées: -- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) -- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) -- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) -- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) - -Clickhouse Playground donne l'expérience du m2.Petite -[Service géré pour ClickHouse](https://cloud.yandex.com/services/managed-clickhouse) -exemple hébergé dans [Yandex.Nuage](https://cloud.yandex.com/). -Plus d'informations sur [les fournisseurs de cloud](../commercial/cloud.md). - -Clickhouse Playground interface web fait des demandes via ClickHouse [HTTP API](../interfaces/http.md). -Le backend Playground est juste un cluster ClickHouse sans aucune application Côté Serveur supplémentaire. -ClickHouse HTTPS endpoint est également disponible dans le cadre du terrain de jeu. - -Vous pouvez effectuer des requêtes sur playground en utilisant n'importe quel client HTTP, par exemple [curl](https://curl.haxx.se) ou [wget](https://www.gnu.org/software/wget/), ou configurer une connexion en utilisant [JDBC](../interfaces/jdbc.md) ou [ODBC](../interfaces/odbc.md) pilote. -Plus d'informations sur les produits logiciels qui prennent en charge ClickHouse est disponible [ici](../interfaces/index.md). - -| Paramètre | Valeur | -|:-------------|:----------------------------------------------| -| Terminaison | https://play-api.clickhouse.technologie: 8443 | -| Utilisateur | `playground` | -| Mot de passe | `clickhouse` | - -Notez que ce paramètre nécessite une connexion sécurisée. - -Exemple: - -``` bash -curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" -``` diff --git a/docs/fr/getting_started/tutorial.md b/docs/fr/getting_started/tutorial.md deleted file mode 100644 index 1806268c1b4..00000000000 --- a/docs/fr/getting_started/tutorial.md +++ /dev/null @@ -1,671 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 12 -toc_title: Tutoriel ---- - -# Tutoriel ClickHouse {#clickhouse-tutorial} - -## À quoi S'attendre de ce tutoriel? {#what-to-expect-from-this-tutorial} - -En parcourant ce tutoriel, vous apprendrez à configurer un cluster ClickHouse simple. Ce sera petit, mais tolérant aux pannes et évolutif. Ensuite, nous utiliserons l'un des exemples de jeux de données pour le remplir de données et exécuter des requêtes de démonstration. - -## Configuration De Noeud Unique {#single-node-setup} - -Pour retarder les complexités d'un environnement distribué, nous allons commencer par déployer ClickHouse sur un seul serveur ou une machine virtuelle. ClickHouse est généralement installé à partir de [deb](index.md#install-from-deb-packages) ou [tr / min](index.md#from-rpm-packages) les paquets, mais il y a [alternative](index.md#from-docker-image) pour les systèmes d'exploitation qui ne sont pas les soutenir. - -Par exemple, vous avez choisi `deb` paquets et exécutés: - -``` bash -sudo apt-get install dirmngr -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 - -echo "deb http://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list -sudo apt-get update - -sudo apt-get install -y clickhouse-server clickhouse-client -``` - -Quelles sont les paquets installés: - -- `clickhouse-client` package contient [clickhouse-client](../interfaces/cli.md) application, client interactif de console de ClickHouse. -- `clickhouse-common` paquet contient un fichier exécutable ClickHouse. -- `clickhouse-server` package contient des fichiers de configuration pour exécuter ClickHouse en tant que serveur. - -Les fichiers de configuration du serveur sont `/etc/clickhouse-server/`. Avant d'aller plus loin, notez le `` élément `config.xml`. Path détermine l'emplacement pour le stockage des données, il doit donc être situé sur le volume avec une grande capacité de disque; la valeur par défaut est `/var/lib/clickhouse/`. Si vous souhaitez ajuster la configuration, il n'est pas pratique de modifier directement `config.xml` fichier, considérant qu'il pourrait obtenir réécrit sur les futures mises à jour du progiciel. La façon recommandée de remplacer les éléments de configuration est de créer [fichiers dans config.d: répertoire](../operations/configuration_files.md) qui servent de “patches” config.XML. - -Comme vous l'avez peut-être remarqué, `clickhouse-server` n'est pas lancé automatiquement après l'installation du paquet. Il ne sera pas redémarré automatiquement après les mises à jour, non plus. La façon dont vous démarrez le serveur dépend de votre système d'initialisation, généralement, c'est: - -``` bash -sudo service clickhouse-server start -``` - -ou - -``` bash -sudo /etc/init.d/clickhouse-server start -``` - -L'emplacement par défaut pour les journaux du serveur est `/var/log/clickhouse-server/`. Le serveur est prêt à gérer les connexions client une fois `Ready for connections` message. - -Une fois l' `clickhouse-server` est opérationnel, nous pouvons utiliser `clickhouse-client` pour se connecter au serveur et effectuer des tests de requêtes comme `SELECT "Hello, world!";`. - -
- -Conseils rapides pour clickhouse-client -Mode interactif: - -``` bash -clickhouse-client -clickhouse-client --host=... --port=... --user=... --password=... -``` - -Activer les requêtes multilignes: - -``` bash -clickhouse-client -m -clickhouse-client --multiline -``` - -Exécuter des requêtes en mode batch: - -``` bash -clickhouse-client --query='SELECT 1' -echo 'SELECT 1' | clickhouse-client -clickhouse-client <<< 'SELECT 1' -``` - -Insérer des données à partir d'un fichier au format spécifié: - -``` bash -clickhouse-client --query='INSERT INTO table VALUES' < data.txt -clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv -``` - -
- -## Importer Un Échantillon De Données {#import-sample-dataset} - -Maintenant, il est temps de remplir notre serveur ClickHouse avec quelques exemples de données. Dans ce tutoriel, nous allons utiliser les données anonymisées de Yandex.Metrica, le premier service qui exécute ClickHouse en production avant de devenir open-source (plus à ce sujet dans [section d'histoire](../introduction/history.md)). Il y a [plusieurs façons d'importer Yandex.Metrica dataset](example_datasets/metrica.md), et pour le bien du tutoriel, nous irons avec le plus réaliste. - -### Télécharger et extraire les données de la Table {#download-and-extract-table-data} - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -``` - -Les fichiers extraits ont une taille d'environ 10 Go. - -### Créer Des Tables {#create-tables} - -Comme dans la plupart des systèmes de gestion de bases de données, clickhouse regroupe logiquement les tables en “databases”. Il y a un `default` base de données, mais nous allons en créer une nouvelle nommée `tutorial`: - -``` bash -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" -``` - -La syntaxe pour créer des tables est beaucoup plus compliquée par rapport aux bases de données (voir [référence](../sql_reference/statements/create.md). En général `CREATE TABLE` déclaration doit spécifier trois choses clés: - -1. Nom de la table à créer. -2. Table schema, i.e. list of columns and their [types de données](../sql_reference/data_types/index.md). -3. [Tableau moteur](../engines/table_engines/index.md) et ce sont les paramètres, qui déterminent tous les détails sur la façon dont les requêtes à cette table seront physiquement exécutées. - -Yandex.Metrica est un service d'analyse web, et l'exemple de jeu de données ne couvre pas toutes ses fonctionnalités, il n'y a donc que deux tables à créer: - -- `hits` est un tableau avec chaque action effectuée par tous les utilisateurs sur tous les sites couverts par le service. -- `visits` est une table qui contient des sessions pré-construites au lieu d'actions individuelles. - -Voyons et exécutons les vraies requêtes create table pour ces tables: - -``` sql -CREATE TABLE tutorial.hits_v1 -( - `WatchID` UInt64, - `JavaEnable` UInt8, - `Title` String, - `GoodEvent` Int16, - `EventTime` DateTime, - `EventDate` Date, - `CounterID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RegionID` UInt32, - `UserID` UInt64, - `CounterClass` Int8, - `OS` UInt8, - `UserAgent` UInt8, - `URL` String, - `Referer` String, - `URLDomain` String, - `RefererDomain` String, - `Refresh` UInt8, - `IsRobot` UInt8, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `FlashMinor2` String, - `NetMajor` UInt8, - `NetMinor` UInt8, - `UserAgentMajor` UInt16, - `UserAgentMinor` FixedString(2), - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `MobilePhone` UInt8, - `MobilePhoneModel` String, - `Params` String, - `IPNetworkID` UInt32, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `IsArtifical` UInt8, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `ClientTimeZone` Int16, - `ClientEventTime` DateTime, - `SilverlightVersion1` UInt8, - `SilverlightVersion2` UInt8, - `SilverlightVersion3` UInt32, - `SilverlightVersion4` UInt16, - `PageCharset` String, - `CodeVersion` UInt32, - `IsLink` UInt8, - `IsDownload` UInt8, - `IsNotBounce` UInt8, - `FUniqID` UInt64, - `HID` UInt32, - `IsOldCounter` UInt8, - `IsEvent` UInt8, - `IsParameter` UInt8, - `DontCountHits` UInt8, - `WithHash` UInt8, - `HitColor` FixedString(1), - `UTCEventTime` DateTime, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `WindowName` Int32, - `OpenerName` Int32, - `HistoryLength` Int16, - `BrowserLanguage` FixedString(2), - `BrowserCountry` FixedString(2), - `SocialNetwork` String, - `SocialAction` String, - `HTTPError` UInt16, - `SendTiming` Int32, - `DNSTiming` Int32, - `ConnectTiming` Int32, - `ResponseStartTiming` Int32, - `ResponseEndTiming` Int32, - `FetchTiming` Int32, - `RedirectTiming` Int32, - `DOMInteractiveTiming` Int32, - `DOMContentLoadedTiming` Int32, - `DOMCompleteTiming` Int32, - `LoadEventStartTiming` Int32, - `LoadEventEndTiming` Int32, - `NSToDOMContentLoadedTiming` Int32, - `FirstPaintTiming` Int32, - `RedirectCount` Int8, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `ParamPrice` Int64, - `ParamOrderID` String, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `GoalsReached` Array(UInt32), - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `RefererHash` UInt64, - `URLHash` UInt64, - `CLID` UInt32, - `YCLID` UInt64, - `ShareService` String, - `ShareURL` String, - `ShareTitle` String, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `IslandID` FixedString(16), - `RequestNum` UInt32, - `RequestTry` UInt8 -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -``` sql -CREATE TABLE tutorial.visits_v1 -( - `CounterID` UInt32, - `StartDate` Date, - `Sign` Int8, - `IsNew` UInt8, - `VisitID` UInt64, - `UserID` UInt64, - `StartTime` DateTime, - `Duration` UInt32, - `UTCStartTime` DateTime, - `PageViews` Int32, - `Hits` Int32, - `IsBounce` UInt8, - `Referer` String, - `StartURL` String, - `RefererDomain` String, - `StartURLDomain` String, - `EndURL` String, - `LinkURL` String, - `IsDownload` UInt8, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `PlaceID` Int32, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `IsYandex` UInt8, - `GoalReachesDepth` Int32, - `GoalReachesURL` Int32, - `GoalReachesAny` Int32, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `MobilePhoneModel` String, - `ClientEventTime` DateTime, - `RegionID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `IPNetworkID` UInt32, - `SilverlightVersion3` UInt32, - `CodeVersion` UInt32, - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `UserAgentMajor` UInt16, - `UserAgentMinor` UInt16, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `SilverlightVersion2` UInt8, - `SilverlightVersion4` UInt16, - `FlashVersion3` UInt16, - `FlashVersion4` UInt16, - `ClientTimeZone` Int16, - `OS` UInt8, - `UserAgent` UInt8, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `NetMajor` UInt8, - `NetMinor` UInt8, - `MobilePhone` UInt8, - `SilverlightVersion1` UInt8, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `JavaEnable` UInt8, - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `BrowserLanguage` UInt16, - `BrowserCountry` UInt16, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `Params` Array(String), - `Goals` Nested( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32), - `WatchIDs` Array(UInt64), - `ParamSumPrice` Int64, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `ClickLogID` UInt64, - `ClickEventID` Int32, - `ClickGoodEvent` Int32, - `ClickEventTime` DateTime, - `ClickPriorityID` Int32, - `ClickPhraseID` Int32, - `ClickPageID` Int32, - `ClickPlaceID` Int32, - `ClickTypeID` Int32, - `ClickResourceID` Int32, - `ClickCost` UInt32, - `ClickClientIP` UInt32, - `ClickDomainID` UInt32, - `ClickURL` String, - `ClickAttempt` UInt8, - `ClickOrderID` UInt32, - `ClickBannerID` UInt32, - `ClickMarketCategoryID` UInt32, - `ClickMarketPP` UInt32, - `ClickMarketCategoryName` String, - `ClickMarketPPName` String, - `ClickAWAPSCampaignName` String, - `ClickPageName` String, - `ClickTargetType` UInt16, - `ClickTargetPhraseID` UInt64, - `ClickContextType` UInt8, - `ClickSelectType` Int8, - `ClickOptions` String, - `ClickGroupBannerID` Int32, - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `FirstVisit` DateTime, - `PredLastVisit` Date, - `LastVisit` Date, - `TotalVisits` UInt32, - `TraficSource` Nested( - ID Int8, - SearchEngineID UInt16, - AdvEngineID UInt8, - PlaceID UInt16, - SocialSourceNetworkID UInt8, - Domain String, - SearchPhrase String, - SocialSourcePage String), - `Attendance` FixedString(16), - `CLID` UInt32, - `YCLID` UInt64, - `NormalizedRefererHash` UInt64, - `SearchPhraseHash` UInt64, - `RefererDomainHash` UInt64, - `NormalizedStartURLHash` UInt64, - `StartURLDomainHash` UInt64, - `NormalizedEndURLHash` UInt64, - `TopLevelDomain` UInt64, - `URLScheme` UInt64, - `OpenstatServiceNameHash` UInt64, - `OpenstatCampaignIDHash` UInt64, - `OpenstatAdIDHash` UInt64, - `OpenstatSourceIDHash` UInt64, - `UTMSourceHash` UInt64, - `UTMMediumHash` UInt64, - `UTMCampaignHash` UInt64, - `UTMContentHash` UInt64, - `UTMTermHash` UInt64, - `FromHash` UInt64, - `WebVisorEnabled` UInt8, - `WebVisorActivity` UInt32, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `Market` Nested( - Type UInt8, - GoalID UInt32, - OrderID String, - OrderPrice Int64, - PP UInt32, - DirectPlaceID UInt32, - DirectOrderID UInt32, - DirectBannerID UInt32, - GoodID String, - GoodName String, - GoodQuantity Int32, - GoodPrice Int64), - `IslandID` FixedString(16) -) -ENGINE = CollapsingMergeTree(Sign) -PARTITION BY toYYYYMM(StartDate) -ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -Vous pouvez exécuter ces requêtes en utilisant le mode interactif de `clickhouse-client` (lancez - le simplement dans un terminal sans spécifier une requête à l'avance) ou essayez-en [interface de rechange](../interfaces/index.md) Si tu veux. - -Comme nous pouvons le voir, `hits_v1` utilise la [moteur MergeTree de base](../engines/table_engines/mergetree_family/mergetree.md) tandis que le `visits_v1` utilise la [Effondrer](../engines/table_engines/mergetree_family/collapsingmergetree.md) variante. - -### Importer Des Données {#import-data} - -L'importation de données vers ClickHouse se fait via [INSERT INTO](../sql_reference/statements/insert_into.md) requête comme dans de nombreuses autres bases de données SQL. Toutefois, les données sont généralement fournies dans l'une des [formats de sérialisation pris en charge](../interfaces/formats.md) plutôt `VALUES` clause (qui est également pris en charge). - -Les fichiers que nous avons téléchargés plus tôt sont au format séparé par des onglets, alors voici comment les importer via le client console: - -``` bash -clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv -clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv -``` - -ClickHouse a beaucoup de [les paramètres de tune](../operations/settings/index.md) et une façon de Les spécifier dans le client console est via des arguments, comme nous pouvons le voir avec `--max_insert_block_size`. La façon la plus simple de comprendre quels paramètres sont disponibles, que signifient-ils et quelles sont les valeurs par défaut est d'interroger le `system.settings` table: - -``` sql -SELECT name, value, changed, description -FROM system.settings -WHERE name LIKE '%max_insert_b%' -FORMAT TSV - -max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." -``` - -Optionnellement, vous pouvez [OPTIMIZE](../query_language/misc/#misc_operations-optimize) les tables après l'importation. Les Tables configurées avec un moteur de MergeTree-family font toujours des fusions de parties de données en arrière-plan pour optimiser le stockage des données (ou au moins vérifier si cela a du sens). Ces requêtes forcent le moteur de table à optimiser le stockage dès maintenant au lieu d'un certain temps plus tard: - -``` bash -clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" -clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" -``` - -Ces requêtes démarrent une opération intensive D'E/S et de CPU, donc si la table reçoit systématiquement de nouvelles données, il est préférable de la laisser seule et de laisser les fusions s'exécuter en arrière-plan. - -Maintenant, nous pouvons vérifier si l'importation de table a réussi: - -``` bash -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" -``` - -## Exemple De Requêtes {#example-queries} - -``` sql -SELECT - StartURL AS URL, - AVG(Duration) AS AvgDuration -FROM tutorial.visits_v1 -WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' -GROUP BY URL -ORDER BY AvgDuration DESC -LIMIT 10 -``` - -``` sql -SELECT - sum(Sign) AS visits, - sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, - (100. * goal_visits) / visits AS goal_percent -FROM tutorial.visits_v1 -WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') -``` - -## Déploiement De Cluster {#cluster-deployment} - -Clickhouse cluster est un cluster homogène. Étapes pour configurer: - -1. Installer clickhouse server sur toutes les machines du cluster -2. Configurer les configurations de cluster dans les fichiers de configuration -3. Créer des tables locales sur chaque instance -4. Créer un [Distribué table](../engines/table_engines/special/distributed.md) - -[Distribué table](../engines/table_engines/special/distributed.md) est en fait une sorte de “view” aux tables locales du cluster ClickHouse. SELECT query from a distributed table s'exécute à l'aide des ressources de tous les fragments du cluster. Vous pouvez spécifier des configurations pour plusieurs clusters et créer plusieurs tables distribuées fournissant des vues à différents clusters. - -Exemple de configuration pour un cluster avec trois fragments, une réplique chacun: - -``` xml - - - - - example-perftest01j.yandex.ru - 9000 - - - - - example-perftest02j.yandex.ru - 9000 - - - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -Pour plus de démonstration, créons une nouvelle table locale avec le même `CREATE TABLE` la requête que nous avons utilisé pour `hits_v1`, mais nom de table différent: - -``` sql -CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... -``` - -Création d'une table distribuée fournissant une vue dans les tables locales du cluster: - -``` sql -CREATE TABLE tutorial.hits_all AS tutorial.hits_local -ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); -``` - -Une pratique courante consiste à créer des tables distribuées similaires sur toutes les machines du cluster. Il permet d'exécuter des requêtes distribuées sur n'importe quelle machine du cluster. Il existe également une autre option pour créer une table distribuée temporaire pour une requête SELECT donnée en utilisant [distant](../sql_reference/table_functions/remote.md) table de fonction. - -Passons à l'exécution de [INSERT SELECT](../sql_reference/statements/insert_into.md) dans les Distribué table la table à plusieurs serveurs. - -``` sql -INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; -``` - -!!! warning "Avis" - Cette approche ne convient pas au sharding de grandes tables. Il y a un outil séparé [clickhouse-copieur](../operations/utilities/clickhouse-copier.md) cela peut re-fragmenter de grandes tables arbitraires. - -Comme vous pouvez vous y attendre, les requêtes lourdes de calcul s'exécutent N fois plus vite si elles utilisent 3 serveurs au lieu d'un. - -Dans ce cas, nous avons utilisé un cluster avec 3 fragments, et chacun contient une seule réplique. - -Pour assurer la résilience dans un environnement de production, nous recommandons que chaque fragment contienne 2-3 répliques réparties entre plusieurs zones de disponibilité ou centres de données (ou au moins des racks). Notez que ClickHouse prend en charge un nombre illimité de répliques. - -Exemple de configuration pour un cluster d'un fragment contenant trois répliques: - -``` xml - - ... - - - - example-perftest01j.yandex.ru - 9000 - - - example-perftest02j.yandex.ru - 9000 - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -Pour activer la réplication native [ZooKeeper](http://zookeeper.apache.org/) est requis. ClickHouse s'occupe de la cohérence des données sur toutes les répliques et exécute automatiquement la procédure de restauration après l'échec. Il est recommandé de déployer le cluster ZooKeeper sur des serveurs séparés (où aucun autre processus, y compris ClickHouse, n'est en cours d'exécution). - -!!! note "Note" - ZooKeeper est pas une exigence stricte: dans certains cas simples, vous pouvez dupliquer les données par écrit dans tous les réplicas de votre code d'application. Cette approche est **pas** recommandé, dans ce cas, ClickHouse ne sera pas en mesure de garantir la cohérence des données sur toutes les répliques. Ainsi, il devient la responsabilité de votre application. - -Les emplacements ZooKeeper sont spécifiés dans le fichier de configuration: - -``` xml - - - zoo01.yandex.ru - 2181 - - - zoo02.yandex.ru - 2181 - - - zoo03.yandex.ru - 2181 - - -``` - -En outre, nous devons définir des macros pour identifier chaque fragment et chaque réplique utilisés lors de la création de la table: - -``` xml - - 01 - 01 - -``` - -S'il n'y a pas de répliques pour le moment lors de la création de la table répliquée, une nouvelle première réplique est instanciée. S'il existe déjà des répliques en direct, la nouvelle réplique clone les données de celles existantes. Vous avez la possibilité de créer toutes les tables répliquées d'abord, et ensuite insérer les données. Une autre option consiste à créer des répliques et à en ajouter d'autres Après ou pendant l'insertion des données. - -``` sql -CREATE TABLE tutorial.hits_replica (...) -ENGINE = ReplcatedMergeTree( - '/clickhouse_perftest/tables/{shard}/hits', - '{replica}' -) -... -``` - -Ici, nous utilisons [ReplicatedMergeTree](../engines/table_engines/mergetree_family/replication.md) tableau moteur. Dans les paramètres, nous spécifions le chemin Zookeeper contenant des identificateurs de fragments et de répliques. - -``` sql -INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; -``` - -La réplication fonctionne en mode multi-maître. Les données peuvent être chargées dans n'importe quel réplica, et le système les synchronise ensuite automatiquement avec d'autres instances. La réplication est asynchrone, donc à un moment donné, toutes les répliques ne peuvent pas contenir de données récemment insérées. Au moins une réplique devrait être en place pour permettre l'ingestion de données. D'autres synchroniseront les données et répareront la cohérence une fois qu'ils redeviendront actifs. Notez que cette approche permet une faible possibilité de perte de données récemment insérées. - -[Article Original](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/fr/guides/apply-catboost-model.md b/docs/fr/guides/apply-catboost-model.md new file mode 100644 index 00000000000..05293c451ad --- /dev/null +++ b/docs/fr/guides/apply-catboost-model.md @@ -0,0 +1,239 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 41 +toc_title: "Application Des Mod\xE8les CatBoost" +--- + +# Application D’un modèle Catboost Dans ClickHouse {#applying-catboost-model-in-clickhouse} + +[CatBoost](https://catboost.ai) est une bibliothèque de dynamisation de gradient libre et open-source développée à [Yandex](https://yandex.com/company/) pour l’apprentissage automatique. + +Avec cette instruction, vous apprendrez à appliquer des modèles pré-formés dans ClickHouse en exécutant l’inférence de modèle à partir de SQL. + +Pour appliquer un modèle CatBoost dans ClickHouse: + +1. [Créer une Table](#create-table). +2. [Insérez les données dans la Table](#insert-data-to-table). +3. [Intégrer CatBoost dans ClickHouse](#integrate-catboost-into-clickhouse) (Étape facultative). +4. [Exécutez L’inférence du modèle à partir de SQL](#run-model-inference). + +Pour plus d’informations sur la formation des modèles CatBoost, voir [Formation et application de modèles](https://catboost.ai/docs/features/training.html#training). + +## Préalable {#prerequisites} + +Si vous n’avez pas le [Docker](https://docs.docker.com/install/) pourtant, l’installer. + +!!! note "Note" + [Docker](https://www.docker.com) est une plate-forme logicielle qui vous permet de créer des conteneurs qui isolent une installation CatBoost et ClickHouse du reste du système. + +Avant d’appliquer un modèle CatBoost: + +**1.** Tirez la [Docker image](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) à partir du registre: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +Cette image Docker contient tout ce dont vous avez besoin pour exécuter CatBoost et ClickHouse: code, runtime, bibliothèques, variables d’environnement et fichiers de configuration. + +**2.** Assurez-vous que l’image Docker a été tirée avec succès: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** Démarrer un conteneur Docker basé sur cette image: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. Créer une Table {#create-table} + +Pour créer une table ClickHouse pour l’exemple de formation: + +**1.** Démarrez clickhouse console client en mode interactif: + +``` bash +$ clickhouse client +``` + +!!! note "Note" + Le serveur ClickHouse est déjà en cours d’exécution dans le conteneur Docker. + +**2.** Créer la table à l’aide de la commande: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** Quitter le client de la console ClickHouse: + +``` sql +:) exit +``` + +## 2. Insérez les données dans la Table {#insert-data-to-table} + +Pour insérer les données: + +**1.** Exécutez la commande suivante: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** Démarrez clickhouse console client en mode interactif: + +``` bash +$ clickhouse client +``` + +**3.** Assurez-vous que les données ont été téléchargées: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++-------+ +``` + +## 3. Intégrer CatBoost dans ClickHouse {#integrate-catboost-into-clickhouse} + +!!! note "Note" + **Étape facultative.** L’image Docker contient tout ce dont vous avez besoin pour exécuter CatBoost et ClickHouse. + +Pour intégrer CatBoost dans ClickHouse: + +**1.** Construire la bibliothèque d’évaluation. + +Le moyen le plus rapide d’évaluer un modèle CatBoost est la compilation `libcatboostmodel.` bibliothèque. Pour plus d’informations sur la création de la bibliothèque, voir [Documentation CatBoost](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** Créez un nouveau répertoire n’importe où et avec n’importe quel nom, par exemple, `data` et mettez la bibliothèque créée dedans. L’image Docker contient déjà la bibliothèque `data/libcatboostmodel.so`. + +**3.** Créez un nouveau répertoire pour le modèle de configuration n’importe où et avec n’importe quel nom, par exemple, `models`. + +**4.** Créez un fichier de configuration de modèle avec n’importe quel nom, par exemple, `models/amazon_model.xml`. + +**5.** Décrire la configuration du modèle: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** Ajoutez le chemin D’accès à CatBoost et la configuration du modèle à la configuration de ClickHouse: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. Exécutez L’inférence du modèle à partir de SQL {#run-model-inference} + +Pour le modèle de test exécutez le client ClickHouse `$ clickhouse client`. + +Assurons nous que le modèle fonctionne: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Note" + Fonction [modelEvaluate](../sql-reference/functions/other-functions.md#function-modelevaluate) retourne tuple avec des prédictions brutes par classe pour les modèles multiclasse. + +Prédisons la probabilité: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Note" + Plus d’infos sur [exp()](../sql-reference/functions/math-functions.md) fonction. + +Calculons LogLoss sur l’échantillon: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "Note" + Plus d’infos sur [avg()](../sql-reference/aggregate-functions/reference.md#agg_function-avg) et [journal()](../sql-reference/functions/math-functions.md) fonction. + +[Article Original](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/fr/guides/apply_catboost_model.md b/docs/fr/guides/apply_catboost_model.md deleted file mode 100644 index 698f26d10d2..00000000000 --- a/docs/fr/guides/apply_catboost_model.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 41 -toc_title: "Application Des Mod\xE8les CatBoost" ---- - -# Application D'un modèle Catboost dans ClickHouse {#applying-catboost-model-in-clickhouse} - -[CatBoost](https://catboost.ai) est une bibliothèque de dynamisation de gradient libre et open-source développée à [Yandex](https://yandex.com/company/) pour l'apprentissage automatique. - -Avec cette instruction, vous apprendrez à appliquer des modèles pré-formés dans ClickHouse en exécutant l'inférence de modèle à partir de SQL. - -Pour appliquer un modèle CatBoost dans ClickHouse: - -1. [Créer une Table](#create-table). -2. [Insérez les données dans la Table](#insert-data-to-table). -3. [Intégrer CatBoost dans ClickHouse](#integrate-catboost-into-clickhouse) (Étape facultative). -4. [Exécutez L'inférence du modèle à partir de SQL](#run-model-inference). - -Pour plus d'informations sur la formation des modèles CatBoost, voir [Formation et application de modèles](https://catboost.ai/docs/features/training.html#training). - -## Préalable {#prerequisites} - -Si vous n'avez pas le [Docker](https://docs.docker.com/install/) pourtant, l'installer. - -!!! note "Note" - [Docker](https://www.docker.com) est une plate-forme logicielle qui vous permet de créer des conteneurs qui isolent une installation CatBoost et ClickHouse du reste du système. - -Avant d'appliquer un modèle CatBoost: - -**1.** Tirez la [Docker image](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) à partir du registre: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -Cette image Docker contient tout ce dont vous avez besoin pour exécuter CatBoost et ClickHouse: code, runtime, bibliothèques, variables d'environnement et fichiers de configuration. - -**2.** Assurez-vous que l'image Docker a été tirée avec succès: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** Démarrer un conteneur Docker basé sur cette image: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. Créer une Table {#create-table} - -Pour créer une table ClickHouse pour l'exemple de formation: - -**1.** Démarrez clickhouse console client en mode interactif: - -``` bash -$ clickhouse client -``` - -!!! note "Note" - Le serveur ClickHouse est déjà en cours d'exécution dans le conteneur Docker. - -**2.** Créer la table à l'aide de la commande: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** Quitter le client de la console ClickHouse: - -``` sql -:) exit -``` - -## 2. Insérez les données dans la Table {#insert-data-to-table} - -Pour insérer les données: - -**1.** Exécutez la commande suivante: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** Démarrez clickhouse console client en mode interactif: - -``` bash -$ clickhouse client -``` - -**3.** Assurez-vous que les données ont été téléchargées: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+-------+ -``` - -## 3. Intégrer CatBoost dans ClickHouse {#integrate-catboost-into-clickhouse} - -!!! note "Note" - **Étape facultative.** L'image Docker contient tout ce dont vous avez besoin pour exécuter CatBoost et ClickHouse. - -Pour intégrer CatBoost dans ClickHouse: - -**1.** Construire la bibliothèque d'évaluation. - -Le moyen le plus rapide d'évaluer un modèle CatBoost est la compilation `libcatboostmodel.` bibliothèque. Pour plus d'informations sur la création de la bibliothèque, voir [Documentation CatBoost](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** Créez un nouveau répertoire n'importe où et avec n'importe quel nom, par exemple, `data` et mettez la bibliothèque créée dedans. L'image Docker contient déjà la bibliothèque `data/libcatboostmodel.so`. - -**3.** Créez un nouveau répertoire pour le modèle de configuration n'importe où et avec n'importe quel nom, par exemple, `models`. - -**4.** Créez un fichier de configuration de modèle avec n'importe quel nom, par exemple, `models/amazon_model.xml`. - -**5.** Décrire la configuration du modèle: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** Ajoutez le chemin D'accès à CatBoost et la configuration du modèle à la configuration de ClickHouse: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. Exécutez L'inférence du modèle à partir de SQL {#run-model-inference} - -Pour le modèle de test exécutez le client ClickHouse `$ clickhouse client`. - -Assurons nous que le modèle fonctionne: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Note" - Fonction [modelEvaluate](../sql_reference/functions/other_functions.md#function-modelevaluate) retourne tuple avec des prédictions brutes par classe pour les modèles multiclasse. - -Prédisons la probabilité: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Note" - Plus d'infos sur [exp()](../sql_reference/functions/math_functions.md) fonction. - -Calculons LogLoss sur l'échantillon: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "Note" - Plus d'infos sur [avg()](../sql_reference/aggregate_functions/reference.md#agg_function-avg) et [journal()](../sql_reference/functions/math_functions.md) fonction. - -[Article Original](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/fr/guides/index.md b/docs/fr/guides/index.md index 1149406b662..f33c0cccb6f 100644 --- a/docs/fr/guides/index.md +++ b/docs/fr/guides/index.md @@ -10,7 +10,7 @@ toc_title: "Aper\xE7u" Liste des instructions détaillées étape par étape qui aident à résoudre diverses tâches en utilisant ClickHouse: -- [Tutoriel sur la configuration simple du cluster](../getting_started/tutorial.md) -- [Application D'un modèle CatBoost dans ClickHouse](apply_catboost_model.md) +- [Tutoriel sur la configuration simple du cluster](../getting-started/tutorial.md) +- [Application D’un modèle CatBoost dans ClickHouse](apply-catboost-model.md) [Article Original](https://clickhouse.tech/docs/en/guides/) diff --git a/docs/fr/index.md b/docs/fr/index.md index bcdeda0a693..8d29d755185 100644 --- a/docs/fr/index.md +++ b/docs/fr/index.md @@ -5,7 +5,7 @@ toc_priority: 3 toc_title: "Aper\xE7u" --- -# Qu'est-ce que ClickHouse? {#what-is-clickhouse} +# Qu’est-ce Que ClickHouse? {#what-is-clickhouse} ClickHouse est un système de gestion de base de données orienté colonne (SGBD) pour le traitement analytique en ligne des requêtes (OLAP). @@ -18,9 +18,9 @@ Dans un “normal” SGBD orienté ligne, les données sont stockées dans cet o | \#2 | 89953706054 | 1 | Mission | 1 | 2016-05-18 07:38:00 | | \#N | … | … | … | … | … | -En d'autres termes, toutes les valeurs liées à une ligne sont physiquement stockées l'une à côté de l'autre. +En d’autres termes, toutes les valeurs liées à une ligne sont physiquement stockées l’une à côté de l’autre. -Des exemples d'un SGBD orienté ligne sont MySQL, Postgres et MS SQL Server. +Des exemples d’un SGBD orienté ligne sont MySQL, Postgres et MS SQL Server. Dans un SGBD orienté colonne, les données sont stockées comme ceci: @@ -32,66 +32,66 @@ Dans un SGBD orienté colonne, les données sont stockées comme ceci: | GoodEvent: | 1 | 1 | 1 | … | | EventTime: | 2016-05-18 05:19:20 | 2016-05-18 08:10:20 | 2016-05-18 07:38:00 | … | -Ces exemples montrent l'ordre que les données sont organisées en. Les valeurs de différentes colonnes sont stockés séparément, et les données de la même colonne sont stockées ensemble. +Ces exemples montrent l’ordre que les données sont organisées en. Les valeurs de différentes colonnes sont stockés séparément, et les données de la même colonne sont stockées ensemble. -Exemples D'un SGBD orienté colonne: Vertica, Paraccel (matrice Actian et Amazon Redshift), Sybase IQ, Exasol, Infobright, InfiniDB, MonetDB (VectorWise et Actian Vector), LucidDB, SAP HANA, Google Dremel, Google PowerDrill, Druid et kdb+. +Exemples D’un SGBD orienté colonne: Vertica, Paraccel (matrice Actian et Amazon Redshift), Sybase IQ, Exasol, Infobright, InfiniDB, MonetDB (VectorWise et Actian Vector), LucidDB, SAP HANA, Google Dremel, Google PowerDrill, Druid et kdb+. Different orders for storing data are better suited to different scenarios. The data access scenario refers to what queries are made, how often, and in what proportion; how much data is read for each type of query – rows, columns, and bytes; the relationship between reading and updating data; the working size of the data and how locally it is used; whether transactions are used, and how isolated they are; requirements for data replication and logical integrity; requirements for latency and throughput for each type of query, and so on. -Plus la charge sur le système est élevée, plus il est important de personnaliser le système configuré pour correspondre aux exigences du scénario d'utilisation, et plus cette personnalisation devient fine. Il n'y a pas de système qui soit aussi bien adapté à des scénarios significativement différents. Si un système est adaptable à un large ensemble de scénarios, sous une charge élevée, le système traitera tous les scénarios de manière également médiocre, ou fonctionnera bien pour un ou quelques-uns des scénarios possibles. +Plus la charge sur le système est élevée, plus il est important de personnaliser le système configuré pour correspondre aux exigences du scénario d’utilisation, et plus cette personnalisation devient fine. Il n’y a pas de système qui soit aussi bien adapté à des scénarios significativement différents. Si un système est adaptable à un large ensemble de scénarios, sous une charge élevée, le système traitera tous les scénarios de manière également médiocre, ou fonctionnera bien pour un ou quelques-uns des scénarios possibles. -## Propriétés clés du scénario OLAP {#key-properties-of-olap-scenario} +## Propriétés clés Du scénario OLAP {#key-properties-of-olap-scenario} -- La grande majorité des demandes concernent l'accès en lecture. +- La grande majorité des demandes concernent l’accès en lecture. - Les données sont mises à jour en lots assez importants (\> 1000 lignes), pas par des lignes simples; ou elles ne sont pas mises à jour du tout. - Les données sont ajoutées à la base de données mais ne sont pas modifiées. - Pour les lectures, un assez grand nombre de lignes sont extraites de la base de données, mais seulement un petit sous-ensemble de colonnes. -- Les Tables sont “wide,” ce qui signifie qu'ils contiennent un grand nombre de colonnes. +- Les Tables sont “wide,” ce qui signifie qu’ils contiennent un grand nombre de colonnes. - Les requêtes sont relativement rares (généralement des centaines de requêtes par serveur ou moins par seconde). - Pour les requêtes simples, les latences autour de 50 ms sont autorisées. - Les valeurs de colonne sont assez petites: nombres et chaînes courtes (par exemple, 60 octets par URL). -- Nécessite un débit élevé lors du traitement d'une seule requête (jusqu'à des milliards de lignes par seconde par serveur). +- Nécessite un débit élevé lors du traitement d’une seule requête (jusqu’à des milliards de lignes par seconde par serveur). - Les Transactions ne sont pas nécessaires. - Faibles exigences en matière de cohérence des données. - Il y a une grande table par requête. Toutes les tables sont petites, sauf une. -- Un résultat de requête est significativement plus petit que les données source. En d'autres termes, les données sont filtrées ou agrégées, de sorte que le résultat s'intègre dans la RAM d'un seul serveur. +- Un résultat de requête est significativement plus petit que les données source. En d’autres termes, les données sont filtrées ou agrégées, de sorte que le résultat s’intègre dans la RAM d’un seul serveur. -Il est facile de voir que le scénario OLAP est très différent des autres scénarios populaires (tels que OLTP ou key-Value access). Il n'est donc pas logique d'essayer D'utiliser OLTP ou une base de données clé-valeur pour traiter les requêtes analytiques si vous voulez obtenir des performances décentes. Par exemple, si vous essayez D'utiliser MongoDB ou Redis pour l'analyse, vous obtiendrez des performances très médiocres par rapport aux bases de données OLAP. +Il est facile de voir que le scénario OLAP est très différent des autres scénarios populaires (tels que OLTP ou key-Value access). Il n’est donc pas logique d’essayer D’utiliser OLTP ou une base de données clé-valeur pour traiter les requêtes analytiques si vous voulez obtenir des performances décentes. Par exemple, si vous essayez D’utiliser MongoDB ou Redis pour l’analyse, vous obtiendrez des performances très médiocres par rapport aux bases de données OLAP. -## Pourquoi les bases de données orientées colonne fonctionnent mieux dans le scénario OLAP {#why-column-oriented-databases-work-better-in-the-olap-scenario} +## Pourquoi Les Bases De données orientées Colonne Fonctionnent Mieux Dans Le scénario OLAP {#why-column-oriented-databases-work-better-in-the-olap-scenario} Les bases de données orientées colonne sont mieux adaptées aux scénarios OLAP: elles sont au moins 100 fois plus rapides dans le traitement de la plupart des requêtes. Les raisons sont expliquées en détail ci-dessous, mais le fait est plus facile de démontrer visuellement: **SGBD orienté ligne** -![Row-oriented](images/row_oriented.gif#) +![Row-oriented](images/row-oriented.gif#) **SGBD orienté colonne** -![Column-oriented](images/column_oriented.gif#) +![Column-oriented](images/column-oriented.gif#) Vous voyez la différence? -### D'entrée/sortie {#inputoutput} +### D’entrée/sortie {#inputoutput} 1. Pour une requête analytique, seul un petit nombre de colonnes de table doit être lu. Dans une base de données orientée colonne, vous pouvez lire uniquement les données dont vous avez besoin. Par exemple, si vous avez besoin de 5 colonnes sur 100, Vous pouvez vous attendre à une réduction de 20 fois des e / s. -2. Puisque les données sont lues en paquets, il est plus facile de les compresser. Les données dans les colonnes sont également plus faciles à compresser. Cela réduit d'autant le volume d'e/S. -3. En raison de la réduction des E / S, Plus de données s'insèrent dans le cache du système. +2. Puisque les données sont lues en paquets, il est plus facile de les compresser. Les données dans les colonnes sont également plus faciles à compresser. Cela réduit d’autant le volume d’e/S. +3. En raison de la réduction des E / S, Plus de données s’insèrent dans le cache du système. -Par exemple, la requête “count the number of records for each advertising platform” nécessite la lecture d'un “advertising platform ID” colonne, qui prend 1 octet non compressé. Si la majeure partie du trafic ne provenait pas de plates-formes publicitaires, vous pouvez vous attendre à une compression d'au moins 10 fois de cette colonne. Lors de l'utilisation d'un algorithme de compression rapide, la décompression des données est possible à une vitesse d'au moins plusieurs gigaoctets de données non compressées par seconde. En d'autres termes, cette requête ne peut être traitée qu'à une vitesse d'environ plusieurs milliards de lignes par seconde sur un seul serveur. Cette vitesse est effectivement atteinte dans la pratique. +Par exemple, la requête “count the number of records for each advertising platform” nécessite la lecture d’un “advertising platform ID” colonne, qui prend 1 octet non compressé. Si la majeure partie du trafic ne provenait pas de plates-formes publicitaires, vous pouvez vous attendre à une compression d’au moins 10 fois de cette colonne. Lors de l’utilisation d’un algorithme de compression rapide, la décompression des données est possible à une vitesse d’au moins plusieurs gigaoctets de données non compressées par seconde. En d’autres termes, cette requête ne peut être traitée qu’à une vitesse d’environ plusieurs milliards de lignes par seconde sur un seul serveur. Cette vitesse est effectivement atteinte dans la pratique. ### CPU {#cpu} -Étant donné que l'exécution d'une requête nécessite le traitement d'un grand nombre de lignes, il est utile de répartir toutes les opérations pour des vecteurs entiers au lieu de lignes séparées, ou d'implémenter le moteur de requête de sorte qu'il n'y ait presque aucun coût d'expédition. Si vous ne le faites pas, avec un sous-système de disque à moitié décent, l'interpréteur de requête bloque inévitablement le processeur. Il est logique de stocker des données dans des colonnes et de les traiter, si possible, par des colonnes. +Étant donné que l’exécution d’une requête nécessite le traitement d’un grand nombre de lignes, il est utile de répartir toutes les opérations pour des vecteurs entiers au lieu de lignes séparées, ou d’implémenter le moteur de requête de sorte qu’il n’y ait presque aucun coût d’expédition. Si vous ne le faites pas, avec un sous-système de disque à moitié décent, l’interpréteur de requête bloque inévitablement le processeur. Il est logique de stocker des données dans des colonnes et de les traiter, si possible, par des colonnes. Il y a deux façons de le faire: -1. Un moteur vectoriel. Toutes les opérations sont écrites pour les vecteurs, au lieu de valeurs séparées. Cela signifie que vous n'avez pas besoin d'appeler les opérations très souvent, et les coûts d'expédition sont négligeables. Le code d'opération contient un cycle interne optimisé. +1. Un moteur vectoriel. Toutes les opérations sont écrites pour les vecteurs, au lieu de valeurs séparées. Cela signifie que vous n’avez pas besoin d’appeler les opérations très souvent, et les coûts d’expédition sont négligeables. Le code d’opération contient un cycle interne optimisé. 2. La génération de Code. Le code généré pour la requête contient tous les appels indirects. -Ce n'est pas fait dans “normal” bases de données, car cela n'a pas de sens lors de l'exécution de requêtes simples. Cependant, il y a des exceptions. Par exemple, MemSQL utilise la génération de code pour réduire la latence lors du traitement des requêtes SQL. (À titre de comparaison, les SGBD analytiques nécessitent une optimisation du débit, et non une latence.) +Ce n’est pas fait dans “normal” bases de données, car cela n’a pas de sens lors de l’exécution de requêtes simples. Cependant, il y a des exceptions. Par exemple, MemSQL utilise la génération de code pour réduire la latence lors du traitement des requêtes SQL. (À titre de comparaison, les SGBD analytiques nécessitent une optimisation du débit, et non une latence.) -Notez que pour l'efficacité du processeur, le langage de requête doit être déclaratif (SQL ou MDX), ou au moins un vecteur (J, K). La requête ne doit contenir que des boucles implicites, permettant une optimisation. +Notez que pour l’efficacité du processeur, le langage de requête doit être déclaratif (SQL ou MDX), ou au moins un vecteur (J, K). La requête ne doit contenir que des boucles implicites, permettant une optimisation. {## [Article Original](https://clickhouse.tech/docs/en/) ##} diff --git a/docs/fr/interfaces/cli.md b/docs/fr/interfaces/cli.md index 118dc40ce7d..69c7d8ba0b1 100644 --- a/docs/fr/interfaces/cli.md +++ b/docs/fr/interfaces/cli.md @@ -5,11 +5,11 @@ toc_priority: 17 toc_title: Client De Ligne De Commande --- -# Client de ligne de commande {#command-line-client} +# Client De Ligne De Commande {#command-line-client} -ClickHouse fournit un client de ligne de commande natif: `clickhouse-client`. Le client prend en charge les options de ligne de commande et les fichiers de configuration. Pour plus d'informations, voir [Configuration](#interfaces_cli_configuration). +ClickHouse fournit un client de ligne de commande natif: `clickhouse-client`. Le client prend en charge les options de ligne de commande et les fichiers de configuration. Pour plus d’informations, voir [Configuration](#interfaces_cli_configuration). -[Installer](../getting_started/index.md) à partir de la `clickhouse-client` package et l'exécuter avec la commande `clickhouse-client`. +[Installer](../getting-started/index.md) à partir de la `clickhouse-client` package et l’exécuter avec la commande `clickhouse-client`. ``` bash $ clickhouse-client @@ -20,15 +20,15 @@ Connected to ClickHouse server version 19.17.1 revision 54428. :) ``` -Différentes versions client et serveur sont compatibles les unes avec les autres, mais certaines fonctionnalités peuvent ne pas être disponibles dans les anciens clients. Nous vous recommandons d'utiliser la même version du client que l'application serveur. Lorsque vous essayez d'utiliser un client de l'ancienne version, puis le serveur, `clickhouse-client` affiche le message: +Différentes versions client et serveur sont compatibles les unes avec les autres, mais certaines fonctionnalités peuvent ne pas être disponibles dans les anciens clients. Nous vous recommandons d’utiliser la même version du client que l’application serveur. Lorsque vous essayez d’utiliser un client de l’ancienne version, puis le serveur, `clickhouse-client` affiche le message: ClickHouse client version is older than ClickHouse server. It may lack support for new features. ## Utilisation {#cli_usage} -Le client peut être utilisé en mode interactif et non interactif (batch). Pour utiliser le mode batch, spécifiez ‘query’ d'un paramètre ou d'envoyer des données à ‘stdin’ (il vérifie que ‘stdin’ n'est pas un terminal), ou les deux. Similaire à L'interface HTTP, lors de l'utilisation ‘query’ paramètre et envoi de données à ‘stdin’ la demande est une concaténation de la ‘query’ paramètre, un saut de ligne, et les données de ‘stdin’. Ceci est pratique pour les grandes requêtes D'insertion. +Le client peut être utilisé en mode interactif et non interactif (batch). Pour utiliser le mode batch, spécifiez ‘query’ d’un paramètre ou d’envoyer des données à ‘stdin’ (il vérifie que ‘stdin’ n’est pas un terminal), ou les deux. Similaire à L’interface HTTP, lors de l’utilisation ‘query’ paramètre et envoi de données à ‘stdin’ la demande est une concaténation de la ‘query’ paramètre, un saut de ligne, et les données de ‘stdin’. Ceci est pratique pour les grandes requêtes D’insertion. -Exemple d'utilisation du client pour insérer des données: +Exemple d’utilisation du client pour insérer des données: ``` bash $ echo -ne "1, 'some text', '2016-08-14 00:00:00'\n2, 'some more text', '2016-08-14 00:00:01'" | clickhouse-client --database=test --query="INSERT INTO test FORMAT CSV"; @@ -43,38 +43,38 @@ $ cat file.csv | clickhouse-client --database=test --query="INSERT INTO test FOR En mode batch, le format de données par défaut est TabSeparated. Vous pouvez définir le format dans la clause FORMAT de la requête. -Par défaut, vous ne pouvez traiter une seule requête en mode batch. De faire plusieurs requêtes à partir d'un “script,” l'utilisation de la `--multiquery` paramètre. Cela fonctionne pour toutes les requêtes sauf INSERT. Les résultats de la requête sont produits consécutivement sans séparateurs supplémentaires. De même, pour traiter un grand nombre de requêtes, vous pouvez exécuter ‘clickhouse-client’ pour chaque requête. Notez que cela peut prendre des dizaines de millisecondes pour lancer le ‘clickhouse-client’ programme. +Par défaut, vous ne pouvez traiter une seule requête en mode batch. De faire plusieurs requêtes à partir d’un “script,” l’utilisation de la `--multiquery` paramètre. Cela fonctionne pour toutes les requêtes sauf INSERT. Les résultats de la requête sont produits consécutivement sans séparateurs supplémentaires. De même, pour traiter un grand nombre de requêtes, vous pouvez exécuter ‘clickhouse-client’ pour chaque requête. Notez que cela peut prendre des dizaines de millisecondes pour lancer le ‘clickhouse-client’ programme. En mode interactif, vous obtenez une ligne de commande où vous pouvez entrer des requêtes. -Si ‘multiline’ n'est pas spécifié (par défaut): Pour exécuter la requête, appuyez sur Entrée. Le point-virgule n'est pas nécessaire à la fin de la requête. Pour entrer une requête multiligne, entrez une barre oblique inverse `\` avant le saut de ligne. Après avoir appuyé sur Entrée, il vous sera demandé d'entrer la ligne suivante de la requête. +Si ‘multiline’ n’est pas spécifié (par défaut): Pour exécuter la requête, appuyez sur Entrée. Le point-virgule n’est pas nécessaire à la fin de la requête. Pour entrer une requête multiligne, entrez une barre oblique inverse `\` avant le saut de ligne. Après avoir appuyé sur Entrée, il vous sera demandé d’entrer la ligne suivante de la requête. -Si multiline est spécifié: pour exécuter une requête, terminez-la par un point-virgule et appuyez sur Entrée. Si le point-virgule a été omis à la fin de l'entrée ligne, vous serez invité à entrer la ligne suivante de la requête. +Si multiline est spécifié: pour exécuter une requête, terminez-la par un point-virgule et appuyez sur Entrée. Si le point-virgule a été omis à la fin de l’entrée ligne, vous serez invité à entrer la ligne suivante de la requête. Une seule requête est exécutée, donc tout après le point-virgule est ignoré. Vous pouvez spécifier `\G` au lieu de le ou après le point-virgule. Cela indique le format Vertical. Dans ce format, chaque valeur est imprimée sur une ligne distincte, ce qui est pratique pour les grandes tables. Cette fonctionnalité inhabituelle a été ajoutée pour la compatibilité avec la CLI MySQL. -La ligne de commande est basé sur ‘replxx’ (similaire à ‘readline’). En d'autres termes, il utilise les raccourcis clavier familiers et conserve un historique. L'histoire est écrite à `~/.clickhouse-client-history`. +La ligne de commande est basé sur ‘replxx’ (similaire à ‘readline’). En d’autres termes, il utilise les raccourcis clavier familiers et conserve un historique. L’histoire est écrite à `~/.clickhouse-client-history`. Par défaut, le format utilisé est Jolicompact. Vous pouvez modifier le format dans la clause FORMAT de la requête, ou en spécifiant `\G` à la fin de la requête, en utilisant le `--format` ou `--vertical` dans la ligne de commande, ou en utilisant le fichier de configuration client. -Pour quitter le client, appuyez sur Ctrl + D (ou Ctrl + C), ou entrez l'une des options suivantes au lieu d'une requête: “exit”, “quit”, “logout”, “exit;”, “quit;”, “logout;”, “q”, “Q”, “:q” +Pour quitter le client, appuyez sur Ctrl + D (ou Ctrl + C), ou entrez l’une des options suivantes au lieu d’une requête: “exit”, “quit”, “logout”, “exit;”, “quit;”, “logout;”, “q”, “Q”, “:q” -Lors du traitement d'une requête, le client affiche: +Lors du traitement d’une requête, le client affiche: -1. Progrès, qui est mis à jour pas plus de 10 fois par seconde (par défaut). Pour les requêtes rapides, la progression peut ne pas avoir le temps d'être affichée. -2. La requête formatée après l'analyse, pour le débogage. +1. Progrès, qui est mis à jour pas plus de 10 fois par seconde (par défaut). Pour les requêtes rapides, la progression peut ne pas avoir le temps d’être affichée. +2. La requête formatée après l’analyse, pour le débogage. 3. Le résultat dans le format spécifié. 4. Le nombre de lignes dans le résultat, le temps passé et la vitesse moyenne de traitement des requêtes. -Vous pouvez annuler une requête longue en appuyant sur Ctrl + C. Cependant, vous devrez toujours attendre un peu pour que le serveur abandonne la requête. Il n'est pas possible d'annuler une requête à certaines étapes. Si vous n'attendez pas et appuyez une seconde fois sur Ctrl+C, le client quittera. +Vous pouvez annuler une requête longue en appuyant sur Ctrl + C. Cependant, vous devrez toujours attendre un peu pour que le serveur abandonne la requête. Il n’est pas possible d’annuler une requête à certaines étapes. Si vous n’attendez pas et appuyez une seconde fois sur Ctrl+C, le client quittera. -Le client de ligne de commande permet de passer des données externes (tables temporaires externes) pour l'interrogation. Pour plus d'informations, consultez la section “External data for query processing”. +Le client de ligne de commande permet de passer des données externes (tables temporaires externes) pour l’interrogation. Pour plus d’informations, consultez la section “External data for query processing”. -### Requêtes avec paramètres {#cli-queries-with-parameters} +### Requêtes Avec paramètres {#cli-queries-with-parameters} -Vous pouvez créer une requête avec des paramètres et leur transmettre des valeurs à partir de l'application cliente. Cela permet d'éviter le formatage de la requête avec des valeurs dynamiques spécifiques côté client. Exemple: +Vous pouvez créer une requête avec des paramètres et leur transmettre des valeurs à partir de l’application cliente. Cela permet d’éviter le formatage de la requête avec des valeurs dynamiques spécifiques côté client. Exemple: ``` bash $ clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = {parName:Array(UInt16)}" @@ -82,14 +82,14 @@ $ clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = #### La Syntaxe De La Requête {#cli-queries-with-parameters-syntax} -Formatez une requête comme d'habitude, puis placez les valeurs que vous souhaitez transmettre des paramètres de l'application à la requête entre accolades au format suivant: +Formatez une requête comme d’habitude, puis placez les valeurs que vous souhaitez transmettre des paramètres de l’application à la requête entre accolades au format suivant: ``` sql {:} ``` - `name` — Placeholder identifier. In the console client it should be used in app parameters as `--param_ = value`. -- `data type` — [Type de données](../sql_reference/data_types/index.md) de l'application valeur de paramètre. Par exemple, une structure de données comme `(integer, ('string', integer))` peut avoir la `Tuple(UInt8, Tuple(String, UInt8))` type de données (vous pouvez également utiliser un autre [entier](../sql_reference/data_types/int_uint.md) type). +- `data type` — [Type de données](../sql-reference/data-types/index.md) de l’application valeur de paramètre. Par exemple, une structure de données comme `(integer, ('string', integer))` peut avoir la `Tuple(UInt8, Tuple(String, UInt8))` type de données (vous pouvez également utiliser un autre [entier](../sql-reference/data-types/int-uint.md) type). #### Exemple {#example} @@ -111,7 +111,7 @@ Vous pouvez passer des paramètres à `clickhouse-client` (tous les paramètres ### Options De Ligne De Commande {#command-line-options} -- `--host, -h` -– The server name, ‘localhost’ par défaut. Vous pouvez utiliser le nom ou L'adresse IPv4 ou IPv6. +- `--host, -h` -– The server name, ‘localhost’ par défaut. Vous pouvez utiliser le nom ou L’adresse IPv4 ou IPv6. - `--port` – The port to connect to. Default value: 9000. Note that the HTTP interface and the native interface use different ports. - `--user, -u` – The username. Default value: default. - `--password` – The password. Default value: empty string. @@ -120,7 +120,7 @@ Vous pouvez passer des paramètres à `clickhouse-client` (tous les paramètres - `--multiline, -m` – If specified, allow multiline queries (do not send the query on Enter). - `--multiquery, -n` – If specified, allow processing multiple queries separated by semicolons. - `--format, -f` – Use the specified default format to output the result. -- `--vertical, -E` – If specified, use the Vertical format by default to output the result. This is the same as ‘–format=Vertical’. Dans ce format, chaque valeur est imprimée sur une ligne séparée, ce qui est utile lors de l'affichage de tables larges. +- `--vertical, -E` – If specified, use the Vertical format by default to output the result. This is the same as ‘–format=Vertical’. Dans ce format, chaque valeur est imprimée sur une ligne séparée, ce qui est utile lors de l’affichage de tables larges. - `--time, -t` – If specified, print the query execution time to ‘stderr’ en mode non interactif. - `--stacktrace` – If specified, also print the stack trace if an exception occurs. - `--config-file` – The name of the configuration file. diff --git a/docs/fr/interfaces/cpp.md b/docs/fr/interfaces/cpp.md index 7863e448ad6..32009fc42c0 100644 --- a/docs/fr/interfaces/cpp.md +++ b/docs/fr/interfaces/cpp.md @@ -5,7 +5,7 @@ toc_priority: 24 toc_title: "Biblioth\xE8que Client C++ " --- -# Bibliothèque Client C++ {#c-client-library} +# Bibliothèque Client C++ {#c-client-library} Voir le fichier README à [clickhouse-cpp](https://github.com/ClickHouse/clickhouse-cpp) référentiel. diff --git a/docs/fr/interfaces/formats.md b/docs/fr/interfaces/formats.md index 590812fe59c..a97eaf3f372 100644 --- a/docs/fr/interfaces/formats.md +++ b/docs/fr/interfaces/formats.md @@ -5,10 +5,10 @@ toc_priority: 21 toc_title: "Formats d'entr\xE9e et de sortie" --- -# Formats pour les données D'entrée et de sortie {#formats} +# Formats Pour Les données D’entrée Et De Sortie {#formats} -ClickHouse peut accepter et renvoyer des données dans différents formats. Un format pris en charge pour l'entrée peut être utilisée pour analyser les données fournies à `INSERT`s, pour effectuer `SELECT`s à partir d'une table sauvegardée par fichier, telle Qu'un fichier, une URL ou un HDFS, ou pour lire un dictionnaire externe. Un format pris en charge pour la sortie peut être utilisé pour organiser -les résultats d'une `SELECT` et pour effectuer `INSERT`s dans une table sauvegardée par fichier. +ClickHouse peut accepter et renvoyer des données dans différents formats. Un format pris en charge pour l’entrée peut être utilisée pour analyser les données fournies à `INSERT`s, pour effectuer `SELECT`s à partir d’une table sauvegardée par fichier, telle Qu’un fichier, une URL ou un HDFS, ou pour lire un dictionnaire externe. Un format pris en charge pour la sortie peut être utilisé pour organiser +les résultats d’une `SELECT` et pour effectuer `INSERT`s dans une table sauvegardée par fichier. Les formats pris en charge sont: @@ -47,17 +47,17 @@ Les formats pris en charge sont: | [XML](#xml) | ✗ | ✔ | | [CapnProto](#capnproto) | ✔ | ✗ | -Vous pouvez contrôler certains paramètres de traitement de format avec les paramètres ClickHouse. Pour plus d'informations, lisez le [Paramètre](../operations/settings/settings.md) section. +Vous pouvez contrôler certains paramètres de traitement de format avec les paramètres ClickHouse. Pour plus d’informations, lisez le [Paramètre](../operations/settings/settings.md) section. ## TabSeparated {#tabseparated} -Au format TabSeparated, les données sont écrites par ligne. Chaque ligne contient des valeurs séparées par des onglets. Chaque valeur est suivie par un onglet, à l'exception de la dernière valeur dans la ligne, qui est suivi par un saut de ligne. Les flux de ligne strictement Unix sont supposés partout. La dernière ligne doit également contenir un saut de ligne à la fin. Les valeurs sont écrites au format texte, sans guillemets et avec des caractères spéciaux échappés. +Au format TabSeparated, les données sont écrites par ligne. Chaque ligne contient des valeurs séparées par des onglets. Chaque valeur est suivie par un onglet, à l’exception de la dernière valeur dans la ligne, qui est suivi par un saut de ligne. Les flux de ligne strictement Unix sont supposés partout. La dernière ligne doit également contenir un saut de ligne à la fin. Les valeurs sont écrites au format texte, sans guillemets et avec des caractères spéciaux échappés. Ce format est également disponible sous le nom de `TSV`. -Le `TabSeparated` le format est pratique pour le traitement des données à l'aide de programmes et de scripts personnalisés. Il est utilisé par défaut dans L'interface HTTP et dans le mode batch du client de ligne de commande. Ce format permet également de transférer des données entre différents SGBD. Par exemple, vous pouvez obtenir un dump de MySQL et le télécharger sur ClickHouse, ou vice versa. +Le `TabSeparated` le format est pratique pour le traitement des données à l’aide de programmes et de scripts personnalisés. Il est utilisé par défaut dans L’interface HTTP et dans le mode batch du client de ligne de commande. Ce format permet également de transférer des données entre différents SGBD. Par exemple, vous pouvez obtenir un dump de MySQL et le télécharger sur ClickHouse, ou vice versa. -Le `TabSeparated` format prend en charge la sortie des valeurs totales (lors de L'utilisation avec des totaux) et des valeurs extrêmes (lorsque ‘extremes’ est réglé sur 1). Dans ces cas, les valeurs totales et les extrêmes sont sorties après les données principales. Le résultat principal, les valeurs totales et les extrêmes sont séparés les uns des autres par une ligne vide. Exemple: +Le `TabSeparated` format prend en charge la sortie des valeurs totales (lors de L’utilisation avec des totaux) et des valeurs extrêmes (lorsque ‘extremes’ est réglé sur 1). Dans ces cas, les valeurs totales et les extrêmes sont sorties après les données principales. Le résultat principal, les valeurs totales et les extrêmes sont séparés les uns des autres par une ligne vide. Exemple: ``` sql SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT TabSeparated`` @@ -80,20 +80,20 @@ SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORD ### Mise En Forme Des Données {#data-formatting} -Les nombres entiers sont écrits sous forme décimale. Les numéros peuvent contenir un supplément “+” caractère au début (ignoré lors de l'analyse, et non enregistré lors du formatage). Les nombres non négatifs ne peuvent pas contenir le signe négatif. Lors de la lecture, il est permis d'analyser une chaîne vide en tant que zéro, ou (pour les types signés) une chaîne composée d'un signe moins en tant que zéro. Les nombres qui ne correspondent pas au type de données correspondant peuvent être analysés comme un nombre différent, sans message d'erreur. +Les nombres entiers sont écrits sous forme décimale. Les numéros peuvent contenir un supplément “+” caractère au début (ignoré lors de l’analyse, et non enregistré lors du formatage). Les nombres non négatifs ne peuvent pas contenir le signe négatif. Lors de la lecture, il est permis d’analyser une chaîne vide en tant que zéro, ou (pour les types signés) une chaîne composée d’un signe moins en tant que zéro. Les nombres qui ne correspondent pas au type de données correspondant peuvent être analysés comme un nombre différent, sans message d’erreur. Les nombres à virgule flottante sont écrits sous forme décimale. Le point est utilisé comme séparateur décimal. Les entrées exponentielles sont prises en charge, tout comme ‘inf’, ‘+inf’, ‘-inf’, et ‘nan’. Une entrée de nombres à virgule flottante peut commencer ou se terminer par une virgule décimale. Pendant le formatage, la précision peut être perdue sur les nombres à virgule flottante. -Pendant l'analyse, il n'est pas strictement nécessaire de lire le nombre représentable de la machine le plus proche. +Pendant l’analyse, il n’est pas strictement nécessaire de lire le nombre représentable de la machine le plus proche. Les Dates sont écrites au format AAAA-MM-JJ et analysées dans le même format, mais avec tous les caractères comme séparateurs. Les Dates avec les heures sont écrites dans le format `YYYY-MM-DD hh:mm:ss` et analysé dans le même format, mais avec des caractères comme séparateurs. -Tout cela se produit dans le fuseau horaire du système au moment où le client ou le serveur démarre (selon lequel d'entre eux formate les données). Pour les dates avec des heures, l'heure d'été n'est pas spécifiée. Donc, si un vidage a des temps pendant l'heure d'été, le vidage ne correspond pas sans équivoque aux données, et l'analyse sélectionnera l'une des deux fois. -Lors d'une opération de lecture, les dates et dates incorrectes avec des heures peuvent être analysées avec un débordement naturel ou en tant que dates et heures nulles, sans message d'erreur. +Tout cela se produit dans le fuseau horaire du système au moment où le client ou le serveur démarre (selon lequel d’entre eux formate les données). Pour les dates avec des heures, l’heure d’été n’est pas spécifiée. Donc, si un vidage a des temps pendant l’heure d’été, le vidage ne correspond pas sans équivoque aux données, et l’analyse sélectionnera l’une des deux fois. +Lors d’une opération de lecture, les dates et dates incorrectes avec des heures peuvent être analysées avec un débordement naturel ou en tant que dates et heures nulles, sans message d’erreur. -À titre d'exception, l'analyse des dates avec des heures est également prise en charge au format d'horodatage Unix, si elle se compose exactement de 10 chiffres décimaux. Le résultat n'est pas dépendant du fuseau horaire. Les formats AAAA-MM-JJ hh:mm:ss et NNNNNNNNNN sont différenciés automatiquement. +À titre d’exception, l’analyse des dates avec des heures est également prise en charge au format d’horodatage Unix, si elle se compose exactement de 10 chiffres décimaux. Le résultat n’est pas dépendant du fuseau horaire. Les formats AAAA-MM-JJ hh:mm:ss et NNNNNNNNNN sont différenciés automatiquement. -Les chaînes sont sorties avec des caractères spéciaux échappés par une barre oblique inverse. Les séquences d'échappement suivantes sont utilisées pour la sortie: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\'`, `\\`. L'analyse prend également en charge les séquences `\a`, `\v`, et `\xHH` (séquences d'échappement hexadécimales) et `\c` séquences, où `c` est un caractère (ces séquences sont convertis à `c`). Ainsi, la lecture de données prend en charge les formats où un saut de ligne peut être écrit comme `\n` ou `\` ou comme un saut de ligne. Par exemple, la chaîne `Hello world` avec un saut de ligne entre les mots au lieu de l'espace peut être analysé dans l'une des variantes suivantes: +Les chaînes sont sorties avec des caractères spéciaux échappés par une barre oblique inverse. Les séquences d’échappement suivantes sont utilisées pour la sortie: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\'`, `\\`. L’analyse prend également en charge les séquences `\a`, `\v`, et `\xHH` (séquences d’échappement hexadécimales) et `\c` séquences, où `c` est un caractère (ces séquences sont convertis à `c`). Ainsi, la lecture de données prend en charge les formats où un saut de ligne peut être écrit comme `\n` ou `\` ou comme un saut de ligne. Par exemple, la chaîne `Hello world` avec un saut de ligne entre les mots au lieu de l’espace peut être analysé dans l’une des variantes suivantes: ``` text Hello\nworld @@ -102,17 +102,17 @@ Hello\ world ``` -La deuxième variante est prise en charge car MySQL l'utilise lors de l'écriture de vidages séparés par des tabulations. +La deuxième variante est prise en charge car MySQL l’utilise lors de l’écriture de vidages séparés par des tabulations. -L'ensemble minimum de caractères que vous devez échapper lors du passage de données au format TabSeparated: tab, saut de ligne (LF) et barre oblique inverse. +L’ensemble minimum de caractères que vous devez échapper lors du passage de données au format TabSeparated: tab, saut de ligne (LF) et barre oblique inverse. Seul un petit ensemble de symboles sont échappés. Vous pouvez facilement tomber sur une valeur de chaîne que votre terminal va ruiner en sortie. -Les tableaux sont écrits sous la forme d'une liste de valeurs séparées par des virgules entre crochets. Le nombre d'éléments dans le tableau sont formatés comme normalement. `Date` et `DateTime` les types sont écrits entre guillemets simples. Les chaînes sont écrites entre guillemets simples avec les mêmes règles d'échappement que ci-dessus. +Les tableaux sont écrits sous la forme d’une liste de valeurs séparées par des virgules entre crochets. Le nombre d’éléments dans le tableau sont formatés comme normalement. `Date` et `DateTime` les types sont écrits entre guillemets simples. Les chaînes sont écrites entre guillemets simples avec les mêmes règles d’échappement que ci-dessus. -[NULL](../sql_reference/syntax.md) est formaté en tant qu' `\N`. +[NULL](../sql-reference/syntax.md) est formaté en tant qu’ `\N`. -Chaque élément de [Imbriqué](../sql_reference/data_types/nested_data_structures/nested.md) structures est représenté sous forme de tableau. +Chaque élément de [Imbriqué](../sql-reference/data-types/nested-data-structures/nested.md) structures est représenté sous forme de tableau. Exemple: @@ -143,46 +143,46 @@ SELECT * FROM nestedt FORMAT TSV ## TabSeparatedRaw {#tabseparatedraw} Diffère de `TabSeparated` format en ce que les lignes sont écrites sans échappement. -Ce format n'est approprié que pour la sortie d'un résultat de requête, mais pas pour l'analyse (récupération des données à insérer dans une table). +Ce format n’est approprié que pour la sortie d’un résultat de requête, mais pas pour l’analyse (récupération des données à insérer dans une table). Ce format est également disponible sous le nom de `TSVRaw`. ## TabSeparatedWithNames {#tabseparatedwithnames} Diffère de la `TabSeparated` formater en ce que les noms de colonne sont écrits dans la première ligne. -Pendant l'analyse, la première ligne est complètement ignorée. Vous ne pouvez pas utiliser les noms de colonnes pour déterminer leur position ou vérifier leur exactitude. -(La prise en charge de l'analyse de la ligne d'en-tête peut être ajoutée à l'avenir.) +Pendant l’analyse, la première ligne est complètement ignorée. Vous ne pouvez pas utiliser les noms de colonnes pour déterminer leur position ou vérifier leur exactitude. +(La prise en charge de l’analyse de la ligne d’en-tête peut être ajoutée à l’avenir.) Ce format est également disponible sous le nom de `TSVWithNames`. ## TabSeparatedWithNamesAndTypes {#tabseparatedwithnamesandtypes} Diffère de la `TabSeparated` format que les noms de colonne sont écrits à la première ligne, tandis que les types de colonne sont dans la deuxième rangée. -Pendant l'analyse, les première et deuxième lignes sont complètement ignorées. +Pendant l’analyse, les première et deuxième lignes sont complètement ignorées. Ce format est également disponible sous le nom de `TSVWithNamesAndTypes`. ## Modèle {#format-template} -Ce format permet de spécifier une chaîne de format personnalisée avec des espaces réservés pour les valeurs avec une règle d'échappement spécifiée. +Ce format permet de spécifier une chaîne de format personnalisée avec des espaces réservés pour les valeurs avec une règle d’échappement spécifiée. -Il utilise les paramètres `format_template_resultset`, `format_template_row`, `format_template_rows_between_delimiter` and some settings of other formats (e.g. `output_format_json_quote_64bit_integers` lors de l'utilisation de `JSON` s'échapper, voir plus loin) +Il utilise les paramètres `format_template_resultset`, `format_template_row`, `format_template_rows_between_delimiter` and some settings of other formats (e.g. `output_format_json_quote_64bit_integers` lors de l’utilisation de `JSON` s’échapper, voir plus loin) -Paramètre `format_template_row` spécifie le chemin d'accès au fichier, qui contient une chaîne de format pour les lignes avec la syntaxe suivante: +Paramètre `format_template_row` spécifie le chemin d’accès au fichier, qui contient une chaîne de format pour les lignes avec la syntaxe suivante: `delimiter_1${column_1:serializeAs_1}delimiter_2${column_2:serializeAs_2} ... delimiter_N`, où `delimiter_i` est un délimiteur entre les valeurs (`$` symbole peut être échappé comme `$$`), -`column_i` est un nom ou un index d'une colonne dont les valeurs sont choisies ou inséré (si vide, alors la colonne sera ignoré), -`serializeAs_i` est une règle d'échappement pour les valeurs de colonne. Les règles d'échappement suivantes sont prises en charge: +`column_i` est un nom ou un index d’une colonne dont les valeurs sont choisies ou inséré (si vide, alors la colonne sera ignoré), +`serializeAs_i` est une règle d’échappement pour les valeurs de colonne. Les règles d’échappement suivantes sont prises en charge: - `CSV`, `JSON`, `XML` (de même pour les formats des mêmes noms) - `Escaped` (de la même manière à `TSV`) - `Quoted` (de la même manière à `Values`) -- `Raw` (sans s'échapper, de même pour `TSVRaw`) -- `None` (pas de règle d'échappement, voir plus loin) +- `Raw` (sans s’échapper, de même pour `TSVRaw`) +- `None` (pas de règle d’échappement, voir plus loin) -Si une règle d'échappement est omise, alors `None` sera utilisé. `XML` et `Raw` sont adaptés uniquement pour la sortie. +Si une règle d’échappement est omise, alors `None` sera utilisé. `XML` et `Raw` sont adaptés uniquement pour la sortie. Donc, pour la chaîne de format suivante: @@ -194,20 +194,20 @@ les valeurs de `SearchPhrase`, `c` et `price` colonnes, qui sont échappées com Le `format_template_rows_between_delimiter` paramètre spécifie délimiteur entre les lignes, qui est imprimé (ou attendu) après chaque ligne, sauf la dernière (`\n` par défaut) -Paramètre `format_template_resultset` spécifie le chemin d'accès au fichier, qui contient une chaîne de format pour resultset. Format string for resultset a la même syntaxe qu'une chaîne de format pour row et permet de spécifier un préfixe, un suffixe et un moyen d'imprimer des informations supplémentaires. Il contient les espaces réservés suivants au lieu des noms de colonnes: +Paramètre `format_template_resultset` spécifie le chemin d’accès au fichier, qui contient une chaîne de format pour resultset. Format string for resultset a la même syntaxe qu’une chaîne de format pour row et permet de spécifier un préfixe, un suffixe et un moyen d’imprimer des informations supplémentaires. Il contient les espaces réservés suivants au lieu des noms de colonnes: - `data` est les lignes avec des données dans `format_template_row` format, séparés par des `format_template_rows_between_delimiter`. Cet espace doit être le premier espace réservé dans la chaîne de format. -- `totals` est la ligne avec des valeurs totales dans `format_template_row` format (lors de L'utilisation avec des totaux) +- `totals` est la ligne avec des valeurs totales dans `format_template_row` format (lors de L’utilisation avec des totaux) - `min` est la ligne avec des valeurs minimales dans `format_template_row` format (lorsque les extrêmes sont définis sur 1) - `max` est la ligne avec des valeurs maximales en `format_template_row` format (lorsque les extrêmes sont définis sur 1) - `rows` le nombre total de lignes de sortie -- `rows_before_limit` est le nombre minimal de lignes qu'il y aurait eu sans limite. Sortie uniquement si la requête contient LIMIT. Si la requête contient GROUP BY, rows\_before\_limit\_at\_least est le nombre exact de lignes qu'il y aurait eu sans limite. -- `time` est le temps d'exécution de la requête en secondes +- `rows_before_limit` est le nombre minimal de lignes qu’il y aurait eu sans limite. Sortie uniquement si la requête contient LIMIT. Si la requête contient GROUP BY, rows\_before\_limit\_at\_least est le nombre exact de lignes qu’il y aurait eu sans limite. +- `time` est le temps d’exécution de la requête en secondes - `rows_read` est le nombre de lignes a été lu -- `bytes_read` est le nombre d'octets (non compressé) a été lu +- `bytes_read` est le nombre d’octets (non compressé) a été lu -Réservé `data`, `totals`, `min` et `max` ne doit pas avoir de règle d'échappement spécifiée (ou `None` doit être spécifié explicitement). Les espaces réservés restants peuvent avoir une règle d'échappement spécifiée. -Si l' `format_template_resultset` paramètre est une chaîne vide, `${data}` est utilisé comme valeur par défaut. +Réservé `data`, `totals`, `min` et `max` ne doit pas avoir de règle d’échappement spécifiée (ou `None` doit être spécifié explicitement). Les espaces réservés restants peuvent avoir une règle d’échappement spécifiée. +Si l’ `format_template_resultset` paramètre est une chaîne vide, `${data}` est utilisé comme valeur par défaut. Pour insérer des requêtes format permet de sauter certaines colonnes ou certains champs si préfixe ou suffixe (voir Exemple). Sélectionnez exemple: @@ -289,14 +289,14 @@ Some header\n${data}\nTotal rows: ${:CSV}\n Page views: ${PageViews:CSV}, User id: ${UserID:CSV}, Useless field: ${:CSV}, Duration: ${Duration:CSV}, Sign: ${Sign:CSV} ``` -`PageViews`, `UserID`, `Duration` et `Sign` à l'intérieur des espaces réservés sont des noms de colonnes dans la table. Les valeurs après `Useless field` en rangées et après `\nTotal rows:` dans le suffixe sera ignoré. -Tous les séparateurs dans les données d'entrée doivent être strictement égal à délimiteurs dans les chaînes de format. +`PageViews`, `UserID`, `Duration` et `Sign` à l’intérieur des espaces réservés sont des noms de colonnes dans la table. Les valeurs après `Useless field` en rangées et après `\nTotal rows:` dans le suffixe sera ignoré. +Tous les séparateurs dans les données d’entrée doivent être strictement égal à délimiteurs dans les chaînes de format. ## TemplateIgnoreSpaces {#templateignorespaces} -Ce format est adapté uniquement pour l'entrée. -Semblable à `Template`, mais ignore les espaces entre les séparateurs et les valeurs dans le flux d'entrée. Toutefois, si les chaînes de format contiennent des espaces, ces caractères seront attendus dans le flux d'entrée. Permet également de spécifier des espaces réservés vides (`${}` ou `${:None}`) pour diviser un délimiteur en parties séparées pour ignorer les espaces entre eux. Ces espaces réservés sont utilisés uniquement pour ignorer les caractères d'espace. -Il est possible de lire `JSON` l'utilisation de ce format, si les valeurs des colonnes ont le même ordre dans toutes les lignes. Par exemple, la requête suivante peut être utilisée pour insérer des données à partir d'un exemple de format de sortie [JSON](#json): +Ce format est adapté uniquement pour l’entrée. +Semblable à `Template`, mais ignore les espaces entre les séparateurs et les valeurs dans le flux d’entrée. Toutefois, si les chaînes de format contiennent des espaces, ces caractères seront attendus dans le flux d’entrée. Permet également de spécifier des espaces réservés vides (`${}` ou `${:None}`) pour diviser un délimiteur en parties séparées pour ignorer les espaces entre eux. Ces espaces réservés sont utilisés uniquement pour ignorer les caractères d’espace. +Il est possible de lire `JSON` l’utilisation de ce format, si les valeurs des colonnes ont le même ordre dans toutes les lignes. Par exemple, la requête suivante peut être utilisée pour insérer des données à partir d’un exemple de format de sortie [JSON](#json): ``` sql INSERT INTO table_name FORMAT TemplateIgnoreSpaces SETTINGS @@ -317,7 +317,7 @@ format_template_resultset = '/some/path/resultset.format', format_template_row = ## TSKV {#tskv} -Similaire à TabSeparated, mais affiche une valeur au format name = value. Les noms sont échappés de la même manière qu'au format TabSeparated, et le symbole = est également échappé. +Similaire à TabSeparated, mais affiche une valeur au format name = value. Les noms sont échappés de la même manière qu’au format TabSeparated, et le symbole = est également échappé. ``` text SearchPhrase= count()=8267016 @@ -332,7 +332,7 @@ SearchPhrase=curtain designs count()=1064 SearchPhrase=baku count()=1000 ``` -[NULL](../sql_reference/syntax.md) est formaté en tant qu' `\N`. +[NULL](../sql-reference/syntax.md) est formaté en tant qu’ `\N`. ``` sql SELECT * FROM t_null FORMAT TSKV @@ -342,46 +342,46 @@ SELECT * FROM t_null FORMAT TSKV x=1 y=\N ``` -Quand il y a un grand nombre de petites colonnes, ce format est inefficace, et il n'y a généralement pas de raison de l'utiliser. Néanmoins, ce n'est pas pire que JSONEachRow en termes d'efficacité. +Quand il y a un grand nombre de petites colonnes, ce format est inefficace, et il n’y a généralement pas de raison de l’utiliser. Néanmoins, ce n’est pas pire que JSONEachRow en termes d’efficacité. Both data output and parsing are supported in this format. For parsing, any order is supported for the values of different columns. It is acceptable for some values to be omitted – they are treated as equal to their default values. In this case, zeros and blank rows are used as default values. Complex values that could be specified in the table are not supported as defaults. -L'analyse permet la présence du champ supplémentaire `tskv` sans le signe égal ou de valeur. Ce champ est ignoré. +L’analyse permet la présence du champ supplémentaire `tskv` sans le signe égal ou de valeur. Ce champ est ignoré. ## CSV {#csv} Format des valeurs séparées par des virgules ([RFC](https://tools.ietf.org/html/rfc4180)). -Lors du formatage, les lignes sont entourées de guillemets doubles. Un guillemet double à l'intérieur d'une chaîne est affiché sous la forme de deux guillemets doubles dans une rangée. Il n'y a pas d'autres règles pour échapper les caractères. Date et date-heure sont entre guillemets. Les nombres sont produits sans guillemets. Les valeurs sont séparées par un caractère délimiteur, qui est `,` par défaut. Le caractère délimiteur est défini dans le paramètre [format\_csv\_delimiter](../operations/settings/settings.md#settings-format_csv_delimiter). Les lignes sont séparées à L'aide du saut de ligne Unix (LF). Les tableaux sont sérialisés au format CSV comme suit: tout d'abord, le tableau est sérialisé en une chaîne comme au format TabSeparated, puis la chaîne résultante est sortie au format CSV entre guillemets doubles. Les Tuples au format CSV sont sérialisés en tant que colonnes séparées (c'est-à-dire que leur imbrication dans le tuple est perdue). +Lors du formatage, les lignes sont entourées de guillemets doubles. Un guillemet double à l’intérieur d’une chaîne est affiché sous la forme de deux guillemets doubles dans une rangée. Il n’y a pas d’autres règles pour échapper les caractères. Date et date-heure sont entre guillemets. Les nombres sont produits sans guillemets. Les valeurs sont séparées par un caractère délimiteur, qui est `,` par défaut. Le caractère délimiteur est défini dans le paramètre [format\_csv\_delimiter](../operations/settings/settings.md#settings-format_csv_delimiter). Les lignes sont séparées à L’aide du saut de ligne Unix (LF). Les tableaux sont sérialisés au format CSV comme suit: tout d’abord, le tableau est sérialisé en une chaîne comme au format TabSeparated, puis la chaîne résultante est sortie au format CSV entre guillemets doubles. Les Tuples au format CSV sont sérialisés en tant que colonnes séparées (c’est-à-dire que leur imbrication dans le tuple est perdue). ``` bash $ clickhouse-client --format_csv_delimiter="|" --query="INSERT INTO test.csv FORMAT CSV" < data.csv ``` -\*Par défaut, le délimiteur est `,`. Voir la [format\_csv\_delimiter](../operations/settings/settings.md#settings-format_csv_delimiter) réglage pour plus d'informations. +\*Par défaut, le délimiteur est `,`. Voir la [format\_csv\_delimiter](../operations/settings/settings.md#settings-format_csv_delimiter) réglage pour plus d’informations. -Lors de l'analyse, toutes les valeurs peuvent être analysés avec ou sans guillemets. Les guillemets doubles et simples sont pris en charge. Les lignes peuvent également être organisées sans guillemets. Dans ce cas, ils sont analysés jusqu'au caractère délimiteur ou au saut de ligne (CR ou LF). En violation de la RFC, lors de l'analyse des lignes sans guillemets, les espaces et les onglets de début et de fin sont ignorés. Pour le saut de ligne, les types Unix (LF), Windows (CR LF) et Mac OS Classic (CR LF) sont tous pris en charge. +Lors de l’analyse, toutes les valeurs peuvent être analysés avec ou sans guillemets. Les guillemets doubles et simples sont pris en charge. Les lignes peuvent également être organisées sans guillemets. Dans ce cas, ils sont analysés jusqu’au caractère délimiteur ou au saut de ligne (CR ou LF). En violation de la RFC, lors de l’analyse des lignes sans guillemets, les espaces et les onglets de début et de fin sont ignorés. Pour le saut de ligne, les types Unix (LF), Windows (CR LF) et Mac OS Classic (CR LF) sont tous pris en charge. -Les valeurs d'entrée non cotées vides sont remplacées par des valeurs par défaut pour les colonnes respectives, si +Les valeurs d’entrée non cotées vides sont remplacées par des valeurs par défaut pour les colonnes respectives, si [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) est activé. -`NULL` est formaté en tant qu' `\N` ou `NULL` ou une chaîne vide non cotée (voir paramètres [input\_format\_csv\_unquoted\_null\_literal\_as\_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) et [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields)). +`NULL` est formaté en tant qu’ `\N` ou `NULL` ou une chaîne vide non cotée (voir paramètres [input\_format\_csv\_unquoted\_null\_literal\_as\_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) et [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields)). Le format CSV prend en charge la sortie des totaux et des extrêmes de la même manière que `TabSeparated`. ## CSVWithNames {#csvwithnames} -Imprime également la ligne d'en-tête, semblable à `TabSeparatedWithNames`. +Imprime également la ligne d’en-tête, semblable à `TabSeparatedWithNames`. ## CustomSeparated {#format-customseparated} -Semblable à [Modèle](#format-template), mais il imprime ou lit toutes les colonnes et utilise la règle d'échappement du paramètre `format_custom_escaping_rule` et délimiteurs de paramètres `format_custom_field_delimiter`, `format_custom_row_before_delimiter`, `format_custom_row_after_delimiter`, `format_custom_row_between_delimiter`, `format_custom_result_before_delimiter` et `format_custom_result_after_delimiter`, pas à partir de chaînes de format. +Semblable à [Modèle](#format-template), mais il imprime ou lit toutes les colonnes et utilise la règle d’échappement du paramètre `format_custom_escaping_rule` et délimiteurs de paramètres `format_custom_field_delimiter`, `format_custom_row_before_delimiter`, `format_custom_row_after_delimiter`, `format_custom_row_between_delimiter`, `format_custom_result_before_delimiter` et `format_custom_result_after_delimiter`, pas à partir de chaînes de format. Il y a aussi `CustomSeparatedIgnoreSpaces` le format, qui est similaire à `TemplateIgnoreSpaces`. ## JSON {#json} -Sorties de données au format JSON. Outre les tables de données, il génère également des noms et des types de colonnes, ainsi que des informations supplémentaires: le nombre total de lignes de sortie et le nombre de lignes qui auraient pu être sorties s'il n'y avait pas de limite. Exemple: +Sorties de données au format JSON. Outre les tables de données, il génère également des noms et des types de colonnes, ainsi que des informations supplémentaires: le nombre total de lignes de sortie et le nombre de lignes qui auraient pu être sorties s’il n’y avait pas de limite. Exemple: ``` sql SELECT SearchPhrase, count() AS c FROM test.hits GROUP BY SearchPhrase WITH TOTALS ORDER BY c DESC LIMIT 5 FORMAT JSON @@ -451,22 +451,22 @@ SELECT SearchPhrase, count() AS c FROM test.hits GROUP BY SearchPhrase WITH TOTA } ``` -Le JSON est compatible avec JavaScript. Pour ce faire, certains caractères sont en outre échappés: la barre oblique `/` s'est échappée comme l' `\/`; sauts de ligne alternatifs `U+2028` et `U+2029`, qui cassent certains navigateurs, sont échappés comme `\uXXXX`. Les caractères de contrôle ASCII sont échappés: retour arrière, flux de formulaire, saut de ligne, retour chariot et tabulation horizontale sont remplacés par `\b`, `\f`, `\n`, `\r`, `\t` , ainsi que les octets restants dans la plage 00-1F en utilisant `\uXXXX` sequences. Invalid UTF-8 sequences are changed to the replacement character � so the output text will consist of valid UTF-8 sequences. For compatibility with JavaScript, Int64 and UInt64 integers are enclosed in double-quotes by default. To remove the quotes, you can set the configuration parameter [output\_format\_json\_quote\_64bit\_integers](../operations/settings/settings.md#session_settings-output_format_json_quote_64bit_integers) à 0. +Le JSON est compatible avec JavaScript. Pour ce faire, certains caractères sont en outre échappés: la barre oblique `/` s’est échappée comme l’ `\/`; sauts de ligne alternatifs `U+2028` et `U+2029`, qui cassent certains navigateurs, sont échappés comme `\uXXXX`. Les caractères de contrôle ASCII sont échappés: retour arrière, flux de formulaire, saut de ligne, retour chariot et tabulation horizontale sont remplacés par `\b`, `\f`, `\n`, `\r`, `\t` , ainsi que les octets restants dans la plage 00-1F en utilisant `\uXXXX` sequences. Invalid UTF-8 sequences are changed to the replacement character � so the output text will consist of valid UTF-8 sequences. For compatibility with JavaScript, Int64 and UInt64 integers are enclosed in double-quotes by default. To remove the quotes, you can set the configuration parameter [output\_format\_json\_quote\_64bit\_integers](../operations/settings/settings.md#session_settings-output_format_json_quote_64bit_integers) à 0. `rows` – The total number of output rows. `rows_before_limit_at_least` Le nombre minimal de lignes aurait été sans limite. Sortie uniquement si la requête contient LIMIT. -Si la requête contient GROUP BY, rows\_before\_limit\_at\_least est le nombre exact de lignes qu'il y aurait eu sans limite. +Si la requête contient GROUP BY, rows\_before\_limit\_at\_least est le nombre exact de lignes qu’il y aurait eu sans limite. `totals` – Total values (when using WITH TOTALS). `extremes` – Extreme values (when extremes are set to 1). -Ce format n'est approprié que pour la sortie d'un résultat de requête, mais pas pour l'analyse (récupération des données à insérer dans une table). +Ce format n’est approprié que pour la sortie d’un résultat de requête, mais pas pour l’analyse (récupération des données à insérer dans une table). -Supports ClickHouse [NULL](../sql_reference/syntax.md) s'affiche à l'écran `null` dans la sortie JSON. +Supports ClickHouse [NULL](../sql-reference/syntax.md) s’affiche à l’écran `null` dans la sortie JSON. -Voir aussi l' [JSONEachRow](#jsoneachrow) format. +Voir aussi l’ [JSONEachRow](#jsoneachrow) format. ## JSONCompact {#jsoncompact} @@ -511,12 +511,12 @@ Exemple: } ``` -Ce format n'est approprié que pour la sortie d'un résultat de requête, mais pas pour l'analyse (récupération des données à insérer dans une table). -Voir aussi l' `JSONEachRow` format. +Ce format n’est approprié que pour la sortie d’un résultat de requête, mais pas pour l’analyse (récupération des données à insérer dans une table). +Voir aussi l’ `JSONEachRow` format. ## JSONEachRow {#jsoneachrow} -Lorsque vous utilisez ce format, ClickHouse affiche les lignes en tant qu'objets JSON séparés et délimités par des retours à la ligne, mais les données dans leur ensemble ne sont pas JSON valides. +Lorsque vous utilisez ce format, ClickHouse affiche les lignes en tant qu’objets JSON séparés et délimités par des retours à la ligne, mais les données dans leur ensemble ne sont pas JSON valides. ``` json {"SearchPhrase":"curtain designs","count()":"1064"} @@ -524,7 +524,7 @@ Lorsque vous utilisez ce format, ClickHouse affiche les lignes en tant qu'objets {"SearchPhrase":"","count()":"8267016"} ``` -Lors de l'insertion des données, vous devez fournir un objet JSON distinct pour chaque ligne. +Lors de l’insertion des données, vous devez fournir un objet JSON distinct pour chaque ligne. ### Insertion De Données {#inserting-data} @@ -534,14 +534,14 @@ INSERT INTO UserActivity FORMAT JSONEachRow {"PageViews":5, "UserID":"4324182021 Clickhouse permet: -- Toute commande de paires clé-valeur dans l'objet. +- Toute commande de paires clé-valeur dans l’objet. - Omettre certaines valeurs. -ClickHouse ignore les espaces entre les éléments et les virgules après les objets. Vous pouvez passer tous les objets en une seule ligne. Vous n'avez pas à les séparer avec des sauts de ligne. +ClickHouse ignore les espaces entre les éléments et les virgules après les objets. Vous pouvez passer tous les objets en une seule ligne. Vous n’avez pas à les séparer avec des sauts de ligne. **Valeurs omises traitement** -Clickhouse remplace les valeurs omises par les valeurs par défaut pour le [types de données](../sql_reference/data_types/index.md). +Clickhouse remplace les valeurs omises par les valeurs par défaut pour le [types de données](../sql-reference/data-types/index.md). Si `DEFAULT expr` clickhouse utilise différentes règles de substitution en fonction de [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) paramètre. @@ -559,11 +559,11 @@ CREATE TABLE IF NOT EXISTS example_table - Si `input_format_defaults_for_omitted_fields = 1`, alors la valeur par défaut pour `x` égal `0` mais la valeur par défaut de `a` égal `x * 2`. !!! note "Avertissement" - Lors de l'insertion de données avec `insert_sample_with_metadata = 1`, ClickHouse consomme plus de ressources de calcul, par rapport à l'insertion avec `insert_sample_with_metadata = 0`. + Lors de l’insertion de données avec `insert_sample_with_metadata = 1`, ClickHouse consomme plus de ressources de calcul, par rapport à l’insertion avec `insert_sample_with_metadata = 0`. ### La Sélection De Données {#selecting-data} -Envisager l' `UserActivity` table comme un exemple: +Envisager l’ `UserActivity` table comme un exemple: ``` text ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ @@ -579,14 +579,14 @@ Requête `SELECT * FROM UserActivity FORMAT JSONEachRow` retourner: {"UserID":"4324182021466249494","PageViews":6,"Duration":185,"Sign":1} ``` -Contrairement à l' [JSON](#json) format, il n'y a pas de substitution de séquences UTF-8 non valides. Les valeurs sont échappés de la même manière que pour `JSON`. +Contrairement à l’ [JSON](#json) format, il n’y a pas de substitution de séquences UTF-8 non valides. Les valeurs sont échappés de la même manière que pour `JSON`. !!! note "Note" - Tout ensemble d'octets peut être sortie dans les cordes. L'utilisation de la `JSONEachRow` formater si vous êtes sûr que les données de la table peuvent être formatées en tant que JSON sans perdre aucune information. + Tout ensemble d’octets peut être sortie dans les cordes. L’utilisation de la `JSONEachRow` formater si vous êtes sûr que les données de la table peuvent être formatées en tant que JSON sans perdre aucune information. -### Utilisation de Structures imbriquées {#jsoneachrow-nested} +### Utilisation De Structures imbriquées {#jsoneachrow-nested} -Si vous avez une table avec [Imbriqué](../sql_reference/data_types/nested_data_structures/nested.md) colonnes de type de données, vous pouvez insérer des données JSON avec la même structure. Activer cette fonctionnalité avec le [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) paramètre. +Si vous avez une table avec [Imbriqué](../sql-reference/data-types/nested-data-structures/nested.md) colonnes de type de données, vous pouvez insérer des données JSON avec la même structure. Activer cette fonctionnalité avec le [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) paramètre. Par exemple, considérez le tableau suivant: @@ -600,7 +600,7 @@ Comme vous pouvez le voir dans la `Nested` description du type de données, Clic INSERT INTO json_each_row_nested FORMAT JSONEachRow {"n.s": ["abc", "def"], "n.i": [1, 23]} ``` -Pour insérer des données en tant qu'objet JSON hiérarchique, définissez [input\_format\_import\_nested\_json=1](../operations/settings/settings.md#settings-input_format_import_nested_json). +Pour insérer des données en tant qu’objet JSON hiérarchique, définissez [input\_format\_import\_nested\_json=1](../operations/settings/settings.md#settings-input_format_import_nested_json). ``` json { @@ -645,22 +645,22 @@ SELECT * FROM json_each_row_nested ## Natif {#native} -Le format le plus efficace. Les données sont écrites et lues par des blocs au format binaire. Pour chaque bloc, le nombre de lignes, le nombre de colonnes, les noms et types de colonnes et les parties de colonnes de ce bloc sont enregistrés les uns après les autres. En d'autres termes, ce format est “columnar” – it doesn't convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. +Le format le plus efficace. Les données sont écrites et lues par des blocs au format binaire. Pour chaque bloc, le nombre de lignes, le nombre de colonnes, les noms et types de colonnes et les parties de colonnes de ce bloc sont enregistrés les uns après les autres. En d’autres termes, ce format est “columnar” – it doesn’t convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. -Vous pouvez utiliser ce format pour générer rapidement des vidages qui ne peuvent être lus que par le SGBD ClickHouse. Cela n'a pas de sens de travailler avec ce format vous-même. +Vous pouvez utiliser ce format pour générer rapidement des vidages qui ne peuvent être lus que par le SGBD ClickHouse. Cela n’a pas de sens de travailler avec ce format vous-même. ## NULL {#null} -Rien n'est sortie. Cependant, la requête est traitée et, lors de l'utilisation du client de ligne de commande, les données sont transmises au client. Ceci est utilisé pour les tests, y compris les tests de performance. -Évidemment, ce format n'est approprié que pour la sortie, pas pour l'analyse. +Rien n’est sortie. Cependant, la requête est traitée et, lors de l’utilisation du client de ligne de commande, les données sont transmises au client. Ceci est utilisé pour les tests, y compris les tests de performance. +Évidemment, ce format n’est approprié que pour la sortie, pas pour l’analyse. ## Joli {#pretty} -Affiche les données sous forme de tables Unicode-art, en utilisant également des séquences d'échappement ANSI pour définir les couleurs dans le terminal. +Affiche les données sous forme de tables Unicode-art, en utilisant également des séquences d’échappement ANSI pour définir les couleurs dans le terminal. Une grille complète de la table est dessinée, et chaque ligne occupe deux lignes dans le terminal. -Chaque bloc de résultat est sorti sous la forme d'une table séparée. Ceci est nécessaire pour que les blocs puissent être sortis sans résultats de mise en mémoire tampon (la mise en mémoire tampon serait nécessaire pour pré-calculer la largeur visible de toutes les valeurs). +Chaque bloc de résultat est sorti sous la forme d’une table séparée. Ceci est nécessaire pour que les blocs puissent être sortis sans résultats de mise en mémoire tampon (la mise en mémoire tampon serait nécessaire pour pré-calculer la largeur visible de toutes les valeurs). -[NULL](../sql_reference/syntax.md) est sortie `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) est sortie `ᴺᵁᴸᴸ`. Exemple (montré pour le [PrettyCompact](#prettycompact) format): @@ -687,9 +687,9 @@ SELECT 'String with \'quotes\' and \t character' AS Escaping_test ``` Pour éviter de déverser trop de données sur le terminal, seules les 10 000 premières lignes sont imprimées. Si le nombre de lignes est supérieur ou égal à 10 000, le message “Showed first 10 000” est imprimé. -Ce format n'est approprié que pour la sortie d'un résultat de requête, mais pas pour l'analyse (récupération des données à insérer dans une table). +Ce format n’est approprié que pour la sortie d’un résultat de requête, mais pas pour l’analyse (récupération des données à insérer dans une table). -Le joli format prend en charge la sortie des valeurs totales (lors de L'utilisation avec des totaux) et des extrêmes (lorsque ‘extremes’ est réglé sur 1). Dans ces cas, les valeurs totales et les valeurs extrêmes sont sorties après les données principales, dans des tableaux séparés. Exemple (montré pour le [PrettyCompact](#prettycompact) format): +Le joli format prend en charge la sortie des valeurs totales (lors de L’utilisation avec des totaux) et des extrêmes (lorsque ‘extremes’ est réglé sur 1). Dans ces cas, les valeurs totales et les valeurs extrêmes sont sorties après les données principales, dans des tableaux séparés. Exemple (montré pour le [PrettyCompact](#prettycompact) format): ``` sql SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact @@ -725,11 +725,11 @@ Ce format est utilisé par défaut dans le client de ligne de commande en mode i ## PrettyCompactMonoBlock {#prettycompactmonoblock} -Diffère de [PrettyCompact](#prettycompact) dans ce cas, jusqu'à 10 000 lignes sont mises en mémoire tampon, puis sorties en tant que table unique, pas par blocs. +Diffère de [PrettyCompact](#prettycompact) dans ce cas, jusqu’à 10 000 lignes sont mises en mémoire tampon, puis sorties en tant que table unique, pas par blocs. ## PrettyNoEscapes {#prettynoescapes} -Diffère de Pretty en ce que les séquences d'échappement ANSI ne sont pas utilisées. Ceci est nécessaire pour afficher ce format dans un navigateur, ainsi que pour utiliser le ‘watch’ utilitaire de ligne de commande. +Diffère de Pretty en ce que les séquences d’échappement ANSI ne sont pas utilisées. Ceci est nécessaire pour afficher ce format dans un navigateur, ainsi que pour utiliser le ‘watch’ utilitaire de ligne de commande. Exemple: @@ -737,7 +737,7 @@ Exemple: $ watch -n1 "clickhouse-client --query='SELECT event, value FROM system.events FORMAT PrettyCompactNoEscapes'" ``` -Vous pouvez utiliser L'interface HTTP pour afficher dans le navigateur. +Vous pouvez utiliser L’interface HTTP pour afficher dans le navigateur. ### Joliscompactnoescapes {#prettycompactnoescapes} @@ -749,7 +749,7 @@ Le même que le réglage précédent. ## PrettySpace {#prettyspace} -Diffère de [PrettyCompact](#prettycompact) dans cet espace (caractères d'espace) est utilisé à la place de la grille. +Diffère de [PrettyCompact](#prettycompact) dans cet espace (caractères d’espace) est utilisé à la place de la grille. ## RowBinary {#rowbinary} @@ -757,18 +757,18 @@ Formats et analyse les données par ligne au format binaire. Les lignes et les v Ce format est moins efficace que le format natif car il est basé sur des lignes. Les entiers utilisent une représentation little-endian de longueur fixe. Par exemple, UInt64 utilise 8 octets. -DateTime est représenté par UInt32 contenant L'horodatage Unix comme valeur. +DateTime est représenté par UInt32 contenant L’horodatage Unix comme valeur. Date est représenté comme un objet UInt16 qui contient le nombre de jours depuis 1970-01-01 comme valeur. La chaîne est représentée par une longueur varint (non signée [LEB128](https://en.wikipedia.org/wiki/LEB128)), suivie par les octets de la chaîne. -FixedString est représenté simplement comme une séquence d'octets. +FixedString est représenté simplement comme une séquence d’octets. -Le tableau est représenté sous la forme d'une longueur varint (non signée [LEB128](https://en.wikipedia.org/wiki/LEB128)), suivie par les éléments de la matrice. +Le tableau est représenté sous la forme d’une longueur varint (non signée [LEB128](https://en.wikipedia.org/wiki/LEB128)), suivie par les éléments de la matrice. -Pour [NULL](../sql_reference/syntax.md#null-literal) un soutien, un octet supplémentaire contenant 1 ou 0 est ajouté avant chaque [Nullable](../sql_reference/data_types/nullable.md) valeur. Si la valeur est 1, alors la valeur est `NULL` et cet octet est interprétée comme une valeur distincte. Si 0, la valeur après l'octet n'est pas `NULL`. +Pour [NULL](../sql-reference/syntax.md#null-literal) un soutien, un octet supplémentaire contenant 1 ou 0 est ajouté avant chaque [Nullable](../sql-reference/data-types/nullable.md) valeur. Si la valeur est 1, alors la valeur est `NULL` et cet octet est interprétée comme une valeur distincte. Si 0, la valeur après l’octet n’est pas `NULL`. ## Rowbinarywithnamesettypes {#rowbinarywithnamesandtypes} -Semblable à [RowBinary](#rowbinary) mais avec l'ajout de l'en-tête: +Semblable à [RowBinary](#rowbinary) mais avec l’ajout de l’en-tête: - [LEB128](https://en.wikipedia.org/wiki/LEB128)- nombre codé de colonnes (N) - N `String`s spécification des noms de colonnes @@ -776,19 +776,19 @@ Semblable à [RowBinary](#rowbinary) mais avec l'ajout de l'en-tête: ## Valeur {#data-format-values} -Imprime chaque ligne entre parenthèses. Les lignes sont séparées par des virgules. Il n'y a pas de virgule après la dernière ligne. Les valeurs entre parenthèses sont également séparées par des virgules. Les nombres sont produits dans un format décimal sans guillemets. Les tableaux sont affichés entre crochets. Les chaînes, les dates et les dates avec des heures sont affichées entre guillemets. Les règles d'échappement et l'analyse sont similaires à [TabSeparated](#tabseparated) format. Pendant le formatage, les espaces supplémentaires ne sont pas insérés, mais pendant l'analyse, ils sont autorisés et ignorés (sauf pour les espaces à l'intérieur des valeurs de tableau, qui ne sont pas autorisés). [NULL](../sql_reference/syntax.md) est représentée comme `NULL`. +Imprime chaque ligne entre parenthèses. Les lignes sont séparées par des virgules. Il n’y a pas de virgule après la dernière ligne. Les valeurs entre parenthèses sont également séparées par des virgules. Les nombres sont produits dans un format décimal sans guillemets. Les tableaux sont affichés entre crochets. Les chaînes, les dates et les dates avec des heures sont affichées entre guillemets. Les règles d’échappement et l’analyse sont similaires à [TabSeparated](#tabseparated) format. Pendant le formatage, les espaces supplémentaires ne sont pas insérés, mais pendant l’analyse, ils sont autorisés et ignorés (sauf pour les espaces à l’intérieur des valeurs de tableau, qui ne sont pas autorisés). [NULL](../sql-reference/syntax.md) est représentée comme `NULL`. The minimum set of characters that you need to escape when passing data in Values ​​format: single quotes and backslashes. -C'est le format qui est utilisé dans `INSERT INTO t VALUES ...`, mais vous pouvez également l'utiliser pour le formatage des résultats de requête. +C’est le format qui est utilisé dans `INSERT INTO t VALUES ...`, mais vous pouvez également l’utiliser pour le formatage des résultats de requête. Voir aussi: [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) et [input\_format\_values\_deduce\_templates\_of\_expressions](../operations/settings/settings.md#settings-input_format_values_deduce_templates_of_expressions) paramètre. ## Vertical {#vertical} -Imprime chaque valeur sur une ligne distincte avec le nom de colonne spécifié. Ce format est pratique pour imprimer une ou plusieurs lignes si chaque ligne est constituée d'un grand nombre de colonnes. +Imprime chaque valeur sur une ligne distincte avec le nom de colonne spécifié. Ce format est pratique pour imprimer une ou plusieurs lignes si chaque ligne est constituée d’un grand nombre de colonnes. -[NULL](../sql_reference/syntax.md) est sortie `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) est sortie `ᴺᵁᴸᴸ`. Exemple: @@ -816,15 +816,15 @@ test: string with 'quotes' and with some special characters ``` -Ce format n'est approprié que pour la sortie d'un résultat de requête, mais pas pour l'analyse (récupération des données à insérer dans une table). +Ce format n’est approprié que pour la sortie d’un résultat de requête, mais pas pour l’analyse (récupération des données à insérer dans une table). ## VerticalRaw {#verticalraw} -Semblable à [Vertical](#vertical), mais avec échapper désactivé. Ce format ne convient que pour la sortie des résultats de requête, pas pour l'analyse (recevoir des données et les insérer dans la table). +Semblable à [Vertical](#vertical), mais avec échapper désactivé. Ce format ne convient que pour la sortie des résultats de requête, pas pour l’analyse (recevoir des données et les insérer dans la table). ## XML {#xml} -Le format XML ne convient que pour la sortie, pas pour l'analyse. Exemple: +Le format XML ne convient que pour la sortie, pas pour l’analyse. Exemple: ``` xml @@ -888,18 +888,18 @@ Le format XML ne convient que pour la sortie, pas pour l'analyse. Exemple: ``` -Si le nom de colonne n'a pas un format acceptable, juste ‘field’ est utilisé comme le nom de l'élément. En général, la structure XML suit la structure JSON. +Si le nom de colonne n’a pas un format acceptable, juste ‘field’ est utilisé comme le nom de l’élément. En général, la structure XML suit la structure JSON. Just as for JSON, invalid UTF-8 sequences are changed to the replacement character � so the output text will consist of valid UTF-8 sequences. Dans les valeurs de chaîne, les caractères `<` et `&` sont échappés comme `<` et `&`. -Les tableaux sont produits comme `HelloWorld...`,et n-uplets d' `HelloWorld...`. +Les tableaux sont produits comme `HelloWorld...`,et n-uplets d’ `HelloWorld...`. ## CapnProto {#capnproto} -Cap'n Proto est un format de message binaire similaire aux tampons de protocole et Thrift, mais pas comme JSON ou MessagePack. +Cap’n Proto est un format de message binaire similaire aux tampons de protocole et Thrift, mais pas comme JSON ou MessagePack. -Les messages Cap'n Proto sont strictement typés et ne sont pas auto-descriptifs, ce qui signifie qu'ils ont besoin d'une description de schéma externe. Le schéma est appliqué à la volée et mise en cache pour chaque requête. +Les messages Cap’n Proto sont strictement typés et ne sont pas auto-descriptifs, ce qui signifie qu’ils ont besoin d’une description de schéma externe. Le schéma est appliqué à la volée et mise en cache pour chaque requête. ``` bash $ cat capnproto_messages.bin | clickhouse-client --query "INSERT INTO test.hits FORMAT CapnProto SETTINGS format_schema='schema:Message'" @@ -914,7 +914,7 @@ struct Message { } ``` -La désérialisation est efficace et n'augmente généralement pas la charge du système. +La désérialisation est efficace et n’augmente généralement pas la charge du système. Voir aussi [Schéma De Format](#formatschema). @@ -925,7 +925,7 @@ Protobuf-est un [Protocol Buffers](https://developers.google.com/protocol-buffer Ce format nécessite un schéma de format externe. Le schéma est mis en cache entre les requêtes. Clickhouse prend en charge les deux `proto2` et `proto3` syntaxe. Les champs répétés/optionnels/obligatoires sont pris en charge. -Exemples d'utilisation: +Exemples d’utilisation: ``` sql SELECT * FROM test.table FORMAT Protobuf SETTINGS format_schema = 'schemafile:MessageType' @@ -950,7 +950,7 @@ message MessageType { Pour trouver la correspondance entre les colonnes de table et les champs du type de message des tampons de protocole, ClickHouse compare leurs noms. Cette comparaison est insensible à la casse et les caractères `_` (trait de soulignement) et `.` (dot) sont considérés comme égaux. -Si les types d'une colonne et d'un champ de message des tampons de protocole sont différents, la conversion nécessaire est appliquée. +Si les types d’une colonne et d’un champ de message des tampons de protocole sont différents, la conversion nécessaire est appliquée. Les messages imbriqués sont pris en charge. Par exemple, pour le champ `z` dans le type de message suivant @@ -967,7 +967,7 @@ message MessageType { ``` ClickHouse tente de trouver une colonne nommée `x.y.z` (ou `x_y_z` ou `X.y_Z` et ainsi de suite). -Les messages imbriqués conviennent à l'entrée ou à la sortie d'un [structures de données imbriquées](../sql_reference/data_types/nested_data_structures/nested.md). +Les messages imbriqués conviennent à l’entrée ou à la sortie d’un [structures de données imbriquées](../sql-reference/data-types/nested-data-structures/nested.md). Valeurs par défaut définies dans un schéma protobuf comme ceci @@ -979,7 +979,7 @@ message MessageType { } ``` -ne sont pas appliquées; la [valeurs par défaut de la table](../sql_reference/statements/create.md#create-default-values) sont utilisés à leur place. +ne sont pas appliquées; la [valeurs par défaut de la table](../sql-reference/statements/create.md#create-default-values) sont utilisés à leur place. Clickhouse entrées et sorties messages protobuf dans le `length-delimited` format. Cela signifie avant que chaque message devrait être écrit sa longueur comme un [varint](https://developers.google.com/protocol-buffers/docs/encoding#varints). @@ -987,29 +987,29 @@ Voir aussi [comment lire / écrire des messages protobuf délimités par la long ## Avro {#data-format-avro} -[Apache Avro](http://avro.apache.org/) est un cadre de sérialisation de données orienté ligne développé dans le projet Hadoop D'Apache. +[Apache Avro](http://avro.apache.org/) est un cadre de sérialisation de données orienté ligne développé dans le projet Hadoop D’Apache. -ClickHouse Avro format prend en charge la lecture et l'écriture [Fichiers de données Avro](http://avro.apache.org/docs/current/spec.html#Object+Container+Files). +ClickHouse Avro format prend en charge la lecture et l’écriture [Fichiers de données Avro](http://avro.apache.org/docs/current/spec.html#Object+Container+Files). ### Types De Données Correspondant {#data_types-matching} -Le tableau ci-dessous montre les types de données pris en charge et comment ils correspondent à ClickHouse [types de données](../sql_reference/data_types/index.md) dans `INSERT` et `SELECT` requête. +Le tableau ci-dessous montre les types de données pris en charge et comment ils correspondent à ClickHouse [types de données](../sql-reference/data-types/index.md) dans `INSERT` et `SELECT` requête. | Type de données Avro `INSERT` | Type de données ClickHouse | Type de données Avro `SELECT` | |---------------------------------------------|---------------------------------------------------------------------------------------------------------------------|-------------------------------| -| `boolean`, `int`, `long`, `float`, `double` | [Int (8/16/32)](../sql_reference/data_types/int_uint.md), [UInt (8/16/32)](../sql_reference/data_types/int_uint.md) | `int` | -| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql_reference/data_types/int_uint.md), [UInt64](../sql_reference/data_types/int_uint.md) | `long` | -| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql_reference/data_types/float.md) | `float` | -| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql_reference/data_types/float.md) | `double` | -| `bytes`, `string`, `fixed`, `enum` | [Chaîne](../sql_reference/data_types/string.md) | `bytes` | -| `bytes`, `string`, `fixed` | [FixedString (N)](../sql_reference/data_types/fixedstring.md) | `fixed(N)` | -| `enum` | [Enum (8/16)](../sql_reference/data_types/enum.md) | `enum` | -| `array(T)` | [Array(T)](../sql_reference/data_types/array.md) | `array(T)` | -| `union(null, T)`, `union(T, null)` | [Nullable (T)](../sql_reference/data_types/date.md) | `union(null, T)` | -| `null` | [Les Valeurs Null(Nothing)](../sql_reference/data_types/special_data_types/nothing.md) | `null` | -| `int (date)` \* | [Date](../sql_reference/data_types/date.md) | `int (date)` \* | -| `long (timestamp-millis)` \* | [DateTime64 (3)](../sql_reference/data_types/datetime.md) | `long (timestamp-millis)` \* | -| `long (timestamp-micros)` \* | [DateTime64 (6)](../sql_reference/data_types/datetime.md) | `long (timestamp-micros)` \* | +| `boolean`, `int`, `long`, `float`, `double` | [Int (8/16/32)](../sql-reference/data-types/int-uint.md), [UInt (8/16/32)](../sql-reference/data-types/int-uint.md) | `int` | +| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql-reference/data-types/int-uint.md), [UInt64](../sql-reference/data-types/int-uint.md) | `long` | +| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql-reference/data-types/float.md) | `float` | +| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql-reference/data-types/float.md) | `double` | +| `bytes`, `string`, `fixed`, `enum` | [Chaîne](../sql-reference/data-types/string.md) | `bytes` | +| `bytes`, `string`, `fixed` | [FixedString (N)](../sql-reference/data-types/fixedstring.md) | `fixed(N)` | +| `enum` | [Enum (8/16)](../sql-reference/data-types/enum.md) | `enum` | +| `array(T)` | [Array(T)](../sql-reference/data-types/array.md) | `array(T)` | +| `union(null, T)`, `union(T, null)` | [Nullable (T)](../sql-reference/data-types/date.md) | `union(null, T)` | +| `null` | [Les Valeurs Null(Nothing)](../sql-reference/data-types/special-data-types/nothing.md) | `null` | +| `int (date)` \* | [Date](../sql-reference/data-types/date.md) | `int (date)` \* | +| `long (timestamp-millis)` \* | [DateTime64 (3)](../sql-reference/data-types/datetime.md) | `long (timestamp-millis)` \* | +| `long (timestamp-micros)` \* | [DateTime64 (6)](../sql-reference/data-types/datetime.md) | `long (timestamp-micros)` \* | \* [Types logiques Avro](http://avro.apache.org/docs/current/spec.html#Logical+Types) @@ -1019,18 +1019,18 @@ Types de données logiques Avro non pris en charge: `uuid`, `time-millis`, `time ### Insertion De Données {#inserting-data-1} -Pour insérer des données d'un fichier Avro dans la table ClickHouse: +Pour insérer des données d’un fichier Avro dans la table ClickHouse: ``` bash $ cat file.avro | clickhouse-client --query="INSERT INTO {some_table} FORMAT Avro" ``` -Le schéma racine du fichier Avro d'entrée doit être de `record` type. +Le schéma racine du fichier Avro d’entrée doit être de `record` type. Pour trouver la correspondance entre les colonnes de table et les champs du schéma Avro ClickHouse compare leurs noms. Cette comparaison est sensible à la casse. Les champs inutilisés sont ignorés. -Les types de données des colonnes de la table ClickHouse peuvent différer des champs correspondants des données Avro insérées. Lors de l'insertion de données, ClickHouse interprète les types de données selon le tableau ci-dessus, puis [jeter](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) les données au type de colonne correspondant. +Les types de données des colonnes de la table ClickHouse peuvent différer des champs correspondants des données Avro insérées. Lors de l’insertion de données, ClickHouse interprète les types de données selon le tableau ci-dessus, puis [jeter](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) les données au type de colonne correspondant. ### La Sélection De Données {#selecting-data-1} @@ -1051,11 +1051,11 @@ Sortie Avro fichier de compression et sync intervalle peut être configuré avec Avroconfluent prend en charge le décodage des messages Avro à objet unique couramment utilisés avec [Kafka](https://kafka.apache.org/) et [Confluentes Schéma De Registre](https://docs.confluent.io/current/schema-registry/index.html). -Chaque message Avro intègre un id de schéma qui peut être résolu dans le schéma réel à l'aide du registre de schéma. +Chaque message Avro intègre un id de schéma qui peut être résolu dans le schéma réel à l’aide du registre de schéma. Les schémas sont mis en cache une fois résolus. -L'URL du registre de schéma est configurée avec [format\_avro\_schema\_registry\_url](../operations/settings/settings.md#settings-format_avro_schema_registry_url) +L’URL du registre de schéma est configurée avec [format\_avro\_schema\_registry\_url](../operations/settings/settings.md#settings-format_avro_schema_registry_url) ### Types De Données Correspondant {#data_types-matching-1} @@ -1072,7 +1072,7 @@ $ kafkacat -b kafka-broker -C -t topic1 -o beginning -f '%s' -c 3 | clickhouse- 3 c ``` -Utiliser `AvroConfluent` avec [Kafka](../engines/table_engines/integrations/kafka.md): +Utiliser `AvroConfluent` avec [Kafka](../engines/table-engines/integrations/kafka.md): ``` sql CREATE TABLE topic1_stream @@ -1097,116 +1097,116 @@ SELECT * FROM topic1_stream; ## Parquet {#data-format-parquet} -[Apache Parquet](http://parquet.apache.org/) est un format de stockage colonnaire répandu dans L'écosystème Hadoop. ClickHouse prend en charge les opérations de lecture et d'écriture pour ce format. +[Apache Parquet](http://parquet.apache.org/) est un format de stockage colonnaire répandu dans L’écosystème Hadoop. ClickHouse prend en charge les opérations de lecture et d’écriture pour ce format. ### Types De Données Correspondant {#data_types-matching-2} -Le tableau ci-dessous montre les types de données pris en charge et comment ils correspondent à ClickHouse [types de données](../sql_reference/data_types/index.md) dans `INSERT` et `SELECT` requête. +Le tableau ci-dessous montre les types de données pris en charge et comment ils correspondent à ClickHouse [types de données](../sql-reference/data-types/index.md) dans `INSERT` et `SELECT` requête. | Type de données Parquet (`INSERT`) | Type de données ClickHouse | Type de données Parquet (`SELECT`) | |------------------------------------|-----------------------------------------------------------|------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | `UINT8` | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | `INT8` | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | `UINT16` | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | `INT16` | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | `UINT32` | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | `INT32` | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | `UINT64` | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | `INT64` | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | `FLOAT` | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | `DOUBLE` | -| `DATE32` | [Date](../sql_reference/data_types/date.md) | `UINT16` | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | `UINT32` | -| `STRING`, `BINARY` | [Chaîne](../sql_reference/data_types/string.md) | `STRING` | -| — | [FixedString](../sql_reference/data_types/fixedstring.md) | `STRING` | -| `DECIMAL` | [Décimal](../sql_reference/data_types/decimal.md) | `DECIMAL` | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | `UINT8` | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | `INT8` | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | `UINT16` | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | `INT16` | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | `UINT32` | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | `INT32` | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | `UINT64` | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | `INT64` | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | `FLOAT` | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | `DOUBLE` | +| `DATE32` | [Date](../sql-reference/data-types/date.md) | `UINT16` | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | `UINT32` | +| `STRING`, `BINARY` | [Chaîne](../sql-reference/data-types/string.md) | `STRING` | +| — | [FixedString](../sql-reference/data-types/fixedstring.md) | `STRING` | +| `DECIMAL` | [Décimal](../sql-reference/data-types/decimal.md) | `DECIMAL` | Clickhouse prend en charge la précision configurable de `Decimal` type. Le `INSERT` requête traite le Parquet `DECIMAL` tapez comme le ClickHouse `Decimal128` type. Types de données Parquet non pris en charge: `DATE32`, `TIME32`, `FIXED_SIZE_BINARY`, `JSON`, `UUID`, `ENUM`. -Les types de données des colonnes de table ClickHouse peuvent différer des champs correspondants des données de Parquet insérées. Lors de l'insertion de données, ClickHouse interprète les types de données selon le tableau ci-dessus, puis [jeter](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) les données de ce type de données qui est défini pour la colonne de la table ClickHouse. +Les types de données des colonnes de table ClickHouse peuvent différer des champs correspondants des données de Parquet insérées. Lors de l’insertion de données, ClickHouse interprète les types de données selon le tableau ci-dessus, puis [jeter](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) les données de ce type de données qui est défini pour la colonne de la table ClickHouse. -### Insertion et sélection de données {#inserting-and-selecting-data} +### Insertion Et sélection De données {#inserting-and-selecting-data} -Vous pouvez insérer des données Parquet à partir d'un fichier dans la table ClickHouse par la commande suivante: +Vous pouvez insérer des données Parquet à partir d’un fichier dans la table ClickHouse par la commande suivante: ``` bash $ cat {filename} | clickhouse-client --query="INSERT INTO {some_table} FORMAT Parquet" ``` -Vous pouvez sélectionner des données à partir d'une table de ClickHouse et les enregistrer dans un fichier au format Parquet par la commande suivante: +Vous pouvez sélectionner des données à partir d’une table de ClickHouse et les enregistrer dans un fichier au format Parquet par la commande suivante: ``` bash $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_file.pq} ``` -Pour échanger des données avec Hadoop, vous pouvez utiliser [Moteur de table HDFS](../engines/table_engines/integrations/hdfs.md). +Pour échanger des données avec Hadoop, vous pouvez utiliser [Moteur de table HDFS](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} -[Apache ORC](https://orc.apache.org/) est un format de stockage colonnaire répandu dans L'écosystème Hadoop. Vous ne pouvez insérer des données dans ce format à ClickHouse. +[Apache ORC](https://orc.apache.org/) est un format de stockage colonnaire répandu dans L’écosystème Hadoop. Vous ne pouvez insérer des données dans ce format à ClickHouse. ### Types De Données Correspondant {#data_types-matching-3} -Le tableau ci-dessous montre les types de données pris en charge et comment ils correspondent à ClickHouse [types de données](../sql_reference/data_types/index.md) dans `INSERT` requête. +Le tableau ci-dessous montre les types de données pris en charge et comment ils correspondent à ClickHouse [types de données](../sql-reference/data-types/index.md) dans `INSERT` requête. | Type de données ORC (`INSERT`) | Type de données ClickHouse | |--------------------------------|-----------------------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | -| `DATE32` | [Date](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [Chaîne](../sql_reference/data_types/string.md) | -| `DECIMAL` | [Décimal](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | +| `DATE32` | [Date](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [Chaîne](../sql-reference/data-types/string.md) | +| `DECIMAL` | [Décimal](../sql-reference/data-types/decimal.md) | -Clickhouse prend en charge la précision configurable de la `Decimal` type. Le `INSERT` requête traite de l'ORC `DECIMAL` tapez comme le ClickHouse `Decimal128` type. +Clickhouse prend en charge la précision configurable de la `Decimal` type. Le `INSERT` requête traite de l’ORC `DECIMAL` tapez comme le ClickHouse `Decimal128` type. Types de données ORC non pris en charge: `DATE32`, `TIME32`, `FIXED_SIZE_BINARY`, `JSON`, `UUID`, `ENUM`. -Les types de données des colonnes de la table ClickHouse ne doivent pas correspondre aux champs de données Orc correspondants. Lors de l'insertion de données, ClickHouse interprète les types de données selon le tableau ci-dessus, puis [jeter](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) les données du type de données défini pour la colonne clickhouse table. +Les types de données des colonnes de la table ClickHouse ne doivent pas correspondre aux champs de données Orc correspondants. Lors de l’insertion de données, ClickHouse interprète les types de données selon le tableau ci-dessus, puis [jeter](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) les données du type de données défini pour la colonne clickhouse table. ### Insertion De Données {#inserting-data-2} -Vous pouvez insérer des données ORC à partir d'un fichier dans la table ClickHouse par la commande suivante: +Vous pouvez insérer des données ORC à partir d’un fichier dans la table ClickHouse par la commande suivante: ``` bash $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -Pour échanger des données avec Hadoop, vous pouvez utiliser [Moteur de table HDFS](../engines/table_engines/integrations/hdfs.md). +Pour échanger des données avec Hadoop, vous pouvez utiliser [Moteur de table HDFS](../engines/table-engines/integrations/hdfs.md). ## Schéma De Format {#formatschema} Le nom du fichier contenant le schéma de format est défini par le paramètre `format_schema`. -Il est nécessaire de définir ce paramètre lorsqu'il est utilisé dans l'un des formats `Cap'n Proto` et `Protobuf`. -Le format de schéma est une combinaison d'un nom de fichier et le nom d'un type de message dans ce fichier, délimité par une virgule, +Il est nécessaire de définir ce paramètre lorsqu’il est utilisé dans l’un des formats `Cap'n Proto` et `Protobuf`. +Le format de schéma est une combinaison d’un nom de fichier et le nom d’un type de message dans ce fichier, délimité par une virgule, e.g. `schemafile.proto:MessageType`. -Si le fichier possède l'extension standard pour le format (par exemple, `.proto` pour `Protobuf`), +Si le fichier possède l’extension standard pour le format (par exemple, `.proto` pour `Protobuf`), il peut être omis et dans ce cas, le format de schéma ressemble `schemafile:MessageType`. Si vous entrez ou sortez des données via le [client](../interfaces/cli.md) dans le [mode interactif](../interfaces/cli.md#cli_usage) le nom de fichier spécifié dans le format de schéma peut contenir un chemin absolu, soit un chemin relatif au répertoire courant sur le client. -Si vous utilisez le client dans le [mode batch](../interfaces/cli.md#cli_usage), le chemin d'accès au schéma doit être relatif pour des raisons de sécurité. +Si vous utilisez le client dans le [mode batch](../interfaces/cli.md#cli_usage), le chemin d’accès au schéma doit être relatif pour des raisons de sécurité. Si vous entrez ou sortez des données via le [Interface HTTP](../interfaces/http.md) le nom de fichier spécifié dans le format de schéma -doit être situé dans le répertoire spécifié dans [format\_schema\_path](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) +doit être situé dans le répertoire spécifié dans [format\_schema\_path](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) dans la configuration du serveur. ## Sauter Les Erreurs {#skippingerrors} -Certains formats tels que `CSV`, `TabSeparated`, `TSKV`, `JSONEachRow`, `Template`, `CustomSeparated` et `Protobuf` pouvez ignorer brisé ligne si erreur d'analyse s'est produite et poursuivre l'analyse à partir du début de la ligne suivante. Voir [input\_format\_allow\_errors\_num](../operations/settings/settings.md#settings-input_format_allow_errors_num) et +Certains formats tels que `CSV`, `TabSeparated`, `TSKV`, `JSONEachRow`, `Template`, `CustomSeparated` et `Protobuf` pouvez ignorer brisé ligne si erreur d’analyse s’est produite et poursuivre l’analyse à partir du début de la ligne suivante. Voir [input\_format\_allow\_errors\_num](../operations/settings/settings.md#settings-input_format_allow_errors_num) et [input\_format\_allow\_errors\_ratio](../operations/settings/settings.md#settings-input_format_allow_errors_ratio) paramètre. Limitation: -- En cas d'erreur d'analyse `JSONEachRow` ignore toutes les données jusqu'à la nouvelle ligne (ou EOF), donc les lignes doivent être délimitées par `\n` pour compter les erreurs correctement. -- `Template` et `CustomSeparated` utilisez delimiter après la dernière colonne et delimiter entre les lignes pour trouver le début de la ligne suivante, donc sauter les erreurs ne fonctionne que si au moins l'une d'entre elles n'est pas vide. +- En cas d’erreur d’analyse `JSONEachRow` ignore toutes les données jusqu’à la nouvelle ligne (ou EOF), donc les lignes doivent être délimitées par `\n` pour compter les erreurs correctement. +- `Template` et `CustomSeparated` utilisez delimiter après la dernière colonne et delimiter entre les lignes pour trouver le début de la ligne suivante, donc sauter les erreurs ne fonctionne que si au moins l’une d’entre elles n’est pas vide. [Article Original](https://clickhouse.tech/docs/en/interfaces/formats/) diff --git a/docs/fr/interfaces/http.md b/docs/fr/interfaces/http.md index bd90f511841..0e6bb538a96 100644 --- a/docs/fr/interfaces/http.md +++ b/docs/fr/interfaces/http.md @@ -7,11 +7,11 @@ toc_title: Interface HTTP # Interface HTTP {#http-interface} -L'interface HTTP vous permet D'utiliser ClickHouse sur n'importe quelle plate-forme à partir de n'importe quel langage de programmation. Nous l'utilisons pour travailler à partir de Java et Perl, ainsi que des scripts shell. Dans d'autres départements, L'interface HTTP est utilisée à partir de Perl, Python et Go. L'interface HTTP est plus limitée que l'interface native, mais elle a une meilleure compatibilité. +L’interface HTTP vous permet D’utiliser ClickHouse sur n’importe quelle plate-forme à partir de n’importe quel langage de programmation. Nous l’utilisons pour travailler à partir de Java et Perl, ainsi que des scripts shell. Dans d’autres départements, L’interface HTTP est utilisée à partir de Perl, Python et Go. L’interface HTTP est plus limitée que l’interface native, mais elle a une meilleure compatibilité. Par défaut, clickhouse-server écoute HTTP sur le port 8123 (cela peut être modifié dans la configuration). -Si vous faites une requête GET / sans Paramètres, elle renvoie le code de réponse 200 et la chaîne définie dans [http\_server\_default\_response](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-http_server_default_response) valeur par défaut “Ok.” (avec un saut de ligne à la fin) +Si vous faites une requête GET / sans Paramètres, elle renvoie le code de réponse 200 et la chaîne définie dans [http\_server\_default\_response](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-http_server_default_response) valeur par défaut “Ok.” (avec un saut de ligne à la fin) ``` bash $ curl 'http://localhost:8123/' @@ -25,12 +25,12 @@ $ curl 'http://localhost:8123/ping' Ok. ``` -Envoyer la demande sous forme D'URL ‘query’ paramètre, ou comme un POSTE. Ou envoyer le début de la requête dans l' ‘query’ paramètre, et le reste dans le POST (nous expliquerons plus tard pourquoi cela est nécessaire). La taille de L'URL est limitée à 16 Ko, alors gardez cela à l'esprit lors de l'envoi de requêtes volumineuses. +Envoyer la demande sous forme D’URL ‘query’ paramètre, ou comme un POSTE. Ou envoyer le début de la requête dans l’ ‘query’ paramètre, et le reste dans le POST (nous expliquerons plus tard pourquoi cela est nécessaire). La taille de L’URL est limitée à 16 Ko, alors gardez cela à l’esprit lors de l’envoi de requêtes volumineuses. En cas de succès, vous recevez le code de réponse 200 et le résultat dans le corps de réponse. -Si une erreur se produit, vous recevez le code de réponse 500 et un texte de description de l'erreur dans le corps de la réponse. +Si une erreur se produit, vous recevez le code de réponse 500 et un texte de description de l’erreur dans le corps de la réponse. -Lorsque vous utilisez la méthode GET, ‘readonly’ est définie. En d'autres termes, pour les requêtes qui modifient les données, vous ne pouvez utiliser que la méthode POST. Vous pouvez envoyer la requête elle-même dans le corps du message ou dans le paramètre URL. +Lorsque vous utilisez la méthode GET, ‘readonly’ est définie. En d’autres termes, pour les requêtes qui modifient les données, vous ne pouvez utiliser que la méthode POST. Vous pouvez envoyer la requête elle-même dans le corps du message ou dans le paramètre URL. Exemple: @@ -54,7 +54,7 @@ X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","writ ``` Comme vous pouvez le voir, curl est un peu gênant en ce sens que les espaces doivent être échappés URL. -Bien que wget échappe à tout lui-même, nous ne recommandons pas de l'utiliser car il ne fonctionne pas bien sur HTTP 1.1 lors de l'utilisation de keep-alive et Transfer-Encoding: chunked. +Bien que wget échappe à tout lui-même, nous ne recommandons pas de l’utiliser car il ne fonctionne pas bien sur HTTP 1.1 lors de l’utilisation de keep-alive et Transfer-Encoding: chunked. ``` bash $ echo 'SELECT 1' | curl 'http://localhost:8123/' --data-binary @- @@ -77,7 +77,7 @@ ECT 1 , expected One of: SHOW TABLES, SHOW DATABASES, SELECT, INSERT, CREATE, ATTACH, RENAME, DROP, DETACH, USE, SET, OPTIMIZE., e.what() = DB::Exception ``` -Par défaut, les données sont renvoyées au format TabSeparated (pour plus d'informations, voir “Formats” section). +Par défaut, les données sont renvoyées au format TabSeparated (pour plus d’informations, voir “Formats” section). Vous utilisez la clause FORMAT de la requête pour demander tout autre format. ``` bash @@ -91,13 +91,13 @@ $ echo 'SELECT 1 FORMAT Pretty' | curl 'http://localhost:8123/?' --data-binary @ La méthode POST de transmission des données est nécessaire pour les requêtes INSERT. Dans ce cas, vous pouvez écrire le début de la requête dans le paramètre URL et utiliser POST pour transmettre les données à insérer. Les données à insérer pourraient être, par exemple, un vidage séparé par tabulation de MySQL. De cette façon, la requête INSERT remplace LOAD DATA LOCAL INFILE de MySQL. -Exemples: création d'une table: +Exemples: création d’une table: ``` bash $ echo 'CREATE TABLE t (a UInt8) ENGINE = Memory' | curl 'http://localhost:8123/' --data-binary @- ``` -Utilisation de la requête D'insertion familière pour l'insertion de données: +Utilisation de la requête D’insertion familière pour l’insertion de données: ``` bash $ echo 'INSERT INTO t VALUES (1),(2),(3)' | curl 'http://localhost:8123/' --data-binary @- @@ -109,19 +109,19 @@ Les données peuvent être envoyées séparément de la requête: $ echo '(4),(5),(6)' | curl 'http://localhost:8123/?query=INSERT%20INTO%20t%20VALUES' --data-binary @- ``` -Vous pouvez spécifier n'importe quel format de données. Le ‘Values’ le format est le même que ce qui est utilisé lors de L'écriture INSERT dans les valeurs t: +Vous pouvez spécifier n’importe quel format de données. Le ‘Values’ le format est le même que ce qui est utilisé lors de L’écriture INSERT dans les valeurs t: ``` bash $ echo '(7),(8),(9)' | curl 'http://localhost:8123/?query=INSERT%20INTO%20t%20FORMAT%20Values' --data-binary @- ``` -Pour insérer des données à partir d'un vidage séparé par des tabulations, spécifiez le format correspondant: +Pour insérer des données à partir d’un vidage séparé par des tabulations, spécifiez le format correspondant: ``` bash $ echo -ne '10\n11\n12\n' | curl 'http://localhost:8123/?query=INSERT%20INTO%20t%20FORMAT%20TabSeparated' --data-binary @- ``` -La lecture de la table des matières. Les données sont sorties dans un ordre aléatoire en raison d'un traitement de requête parallèle: +La lecture de la table des matières. Les données sont sorties dans un ordre aléatoire en raison d’un traitement de requête parallèle: ``` bash $ curl 'http://localhost:8123/?query=SELECT%20a%20FROM%20t' @@ -147,16 +147,16 @@ $ echo 'DROP TABLE t' | curl 'http://localhost:8123/' --data-binary @- Pour les requêtes réussies qui ne renvoient pas de table de données, un corps de réponse vide est renvoyé. -Vous pouvez utiliser le format de compression ClickHouse interne lors de la transmission de données. Les données compressées ont un format non standard, et vous devrez utiliser le spécial `clickhouse-compressor` programme de travail (il s'est installé avec le `clickhouse-client` paquet). Pour augmenter l'efficacité de l'insertion de données, vous pouvez désactiver la vérification de la somme de contrôle côté serveur en utilisant [http\_native\_compression\_disable\_checksumming\_on\_decompress](../operations/settings/settings.md#settings-http_native_compression_disable_checksumming_on_decompress) paramètre. +Vous pouvez utiliser le format de compression ClickHouse interne lors de la transmission de données. Les données compressées ont un format non standard, et vous devrez utiliser le spécial `clickhouse-compressor` programme de travail (il s’est installé avec le `clickhouse-client` paquet). Pour augmenter l’efficacité de l’insertion de données, vous pouvez désactiver la vérification de la somme de contrôle côté serveur en utilisant [http\_native\_compression\_disable\_checksumming\_on\_decompress](../operations/settings/settings.md#settings-http_native_compression_disable_checksumming_on_decompress) paramètre. -Si vous avez spécifié `compress=1` dans l'URL, le serveur compresse les données qu'il vous envoie. -Si vous avez spécifié `decompress=1` dans L'URL, le serveur décompresse les mêmes données que vous transmettez `POST` méthode. +Si vous avez spécifié `compress=1` dans l’URL, le serveur compresse les données qu’il vous envoie. +Si vous avez spécifié `decompress=1` dans L’URL, le serveur décompresse les mêmes données que vous transmettez `POST` méthode. -Vous pouvez également choisir d'utiliser [La compression HTTP](https://en.wikipedia.org/wiki/HTTP_compression). Pour envoyer un compressé `POST` demande, ajouter l'en-tête de requête `Content-Encoding: compression_method`. Pour que ClickHouse compresse la réponse, vous devez ajouter `Accept-Encoding: compression_method`. Supports ClickHouse `gzip`, `br`, et `deflate` [méthodes de compression](https://en.wikipedia.org/wiki/HTTP_compression#Content-Encoding_tokens). Pour activer la compression HTTP, vous devez utiliser le ClickHouse [enable\_http\_compression](../operations/settings/settings.md#settings-enable_http_compression) paramètre. Vous pouvez configurer le niveau de compression des données dans le [http\_zlib\_compression\_level](#settings-http_zlib_compression_level) pour toutes les méthodes de compression. +Vous pouvez également choisir d’utiliser [La compression HTTP](https://en.wikipedia.org/wiki/HTTP_compression). Pour envoyer un compressé `POST` demande, ajouter l’en-tête de requête `Content-Encoding: compression_method`. Pour que ClickHouse compresse la réponse, vous devez ajouter `Accept-Encoding: compression_method`. Supports ClickHouse `gzip`, `br`, et `deflate` [méthodes de compression](https://en.wikipedia.org/wiki/HTTP_compression#Content-Encoding_tokens). Pour activer la compression HTTP, vous devez utiliser le ClickHouse [enable\_http\_compression](../operations/settings/settings.md#settings-enable_http_compression) paramètre. Vous pouvez configurer le niveau de compression des données dans le [http\_zlib\_compression\_level](#settings-http_zlib_compression_level) pour toutes les méthodes de compression. -Vous pouvez l'utiliser pour réduire le trafic réseau lors de la transmission d'une grande quantité de données, ou pour créer des vidages qui sont immédiatement compressés. +Vous pouvez l’utiliser pour réduire le trafic réseau lors de la transmission d’une grande quantité de données, ou pour créer des vidages qui sont immédiatement compressés. -Exemples d'envoi de données avec compression: +Exemples d’envoi de données avec compression: ``` bash #Sending data to the server: @@ -169,7 +169,7 @@ $ echo "SELECT 1" | gzip -c | curl -sS --data-binary @- -H 'Content-Encoding: gz !!! note "Note" Certains clients HTTP peuvent décompresser les données du serveur par défaut (avec `gzip` et `deflate`) et vous pouvez obtenir des données décompressées même si vous utilisez les paramètres de compression correctement. -Vous pouvez utiliser l' ‘database’ Paramètre URL pour spécifier la base de données par défaut. +Vous pouvez utiliser l’ ‘database’ Paramètre URL pour spécifier la base de données par défaut. ``` bash $ echo 'SELECT number FROM numbers LIMIT 10' | curl 'http://localhost:8123/?database=system' --data-binary @- @@ -185,11 +185,11 @@ $ echo 'SELECT number FROM numbers LIMIT 10' | curl 'http://localhost:8123/?data 9 ``` -Par défaut, la base de données enregistrée dans les paramètres du serveur est utilisée comme base de données par défaut. Par défaut, c'est la base de données appelée ‘default’. Alternativement, vous pouvez toujours spécifier la base de données en utilisant un point avant le nom de la table. +Par défaut, la base de données enregistrée dans les paramètres du serveur est utilisée comme base de données par défaut. Par défaut, c’est la base de données appelée ‘default’. Alternativement, vous pouvez toujours spécifier la base de données en utilisant un point avant le nom de la table. -Le nom d'utilisateur et le mot de passe peuvent être indiqués de l'une des trois façons suivantes: +Le nom d’utilisateur et le mot de passe peuvent être indiqués de l’une des trois façons suivantes: -1. Utilisation de L'authentification de base HTTP. Exemple: +1. Utilisation de L’authentification de base HTTP. Exemple: @@ -197,7 +197,7 @@ Le nom d'utilisateur et le mot de passe peuvent être indiqués de l'une des tro $ echo 'SELECT 1' | curl 'http://user:password@localhost:8123/' -d @- ``` -1. Dans le ‘user’ et ‘password’ Les paramètres d'URL. Exemple: +1. Dans le ‘user’ et ‘password’ Les paramètres d’URL. Exemple: @@ -213,10 +213,10 @@ $ echo 'SELECT 1' | curl 'http://localhost:8123/?user=user&password=password' -d $ echo 'SELECT 1' | curl -H 'X-ClickHouse-User: user' -H 'X-ClickHouse-Key: password' 'http://localhost:8123/' -d @- ``` -Si le nom d'utilisateur n'est spécifié, le `default` le nom est utilisé. Si le mot de passe n'est spécifié, le mot de passe vide est utilisé. -Vous pouvez également utiliser les paramètres D'URL pour spécifier des paramètres pour le traitement d'une seule requête ou de profils entiers de paramètres. Exemple: http: / / localhost: 8123/?profil = web & max\_rows\_to\_read=1000000000 & query=sélectionner + 1 +Si le nom d’utilisateur n’est spécifié, le `default` le nom est utilisé. Si le mot de passe n’est spécifié, le mot de passe vide est utilisé. +Vous pouvez également utiliser les paramètres D’URL pour spécifier des paramètres pour le traitement d’une seule requête ou de profils entiers de paramètres. Exemple: http: / / localhost: 8123/?profil = web & max\_rows\_to\_read=1000000000 & query=sélectionner + 1 -Pour plus d'informations, voir le [Paramètre](../operations/settings/index.md) section. +Pour plus d’informations, voir le [Paramètre](../operations/settings/index.md) section. ``` bash $ echo 'SELECT number FROM system.numbers LIMIT 10' | curl 'http://localhost:8123/?' --data-binary @- @@ -232,11 +232,11 @@ $ echo 'SELECT number FROM system.numbers LIMIT 10' | curl 'http://localhost:812 9 ``` -Pour plus d'informations sur les autres paramètres, consultez la section “SET”. +Pour plus d’informations sur les autres paramètres, consultez la section “SET”. -De même, vous pouvez utiliser des sessions ClickHouse dans le protocole HTTP. Pour ce faire, vous devez ajouter l' `session_id` GET paramètre à la demande. Vous pouvez utiliser n'importe quelle chaîne comme ID de session. Par défaut, la session est terminée après 60 secondes d'inactivité. Pour modifier ce délai d'attente, de modifier la `default_session_timeout` dans la configuration du serveur, ou ajoutez le `session_timeout` GET paramètre à la demande. Pour vérifier l'état de la session, utilisez `session_check=1` paramètre. Une seule requête à la fois peut être exécutée dans une seule session. +De même, vous pouvez utiliser des sessions ClickHouse dans le protocole HTTP. Pour ce faire, vous devez ajouter l’ `session_id` GET paramètre à la demande. Vous pouvez utiliser n’importe quelle chaîne comme ID de session. Par défaut, la session est terminée après 60 secondes d’inactivité. Pour modifier ce délai d’attente, de modifier la `default_session_timeout` dans la configuration du serveur, ou ajoutez le `session_timeout` GET paramètre à la demande. Pour vérifier l’état de la session, utilisez `session_check=1` paramètre. Une seule requête à la fois peut être exécutée dans une seule session. -Vous pouvez recevoir des informations sur le déroulement d'une requête en `X-ClickHouse-Progress` en-têtes de réponse. Pour ce faire, activez [send\_progress\_in\_http\_headers](../operations/settings/settings.md#settings-send_progress_in_http_headers). Exemple de l'en-tête de séquence: +Vous pouvez recevoir des informations sur le déroulement d’une requête en `X-ClickHouse-Progress` en-têtes de réponse. Pour ce faire, activez [send\_progress\_in\_http\_headers](../operations/settings/settings.md#settings-send_progress_in_http_headers). Exemple de l’en-tête de séquence: ``` text X-ClickHouse-Progress: {"read_rows":"2752512","read_bytes":"240570816","total_rows_to_read":"8880128"} @@ -244,7 +244,7 @@ X-ClickHouse-Progress: {"read_rows":"5439488","read_bytes":"482285394","total_ro X-ClickHouse-Progress: {"read_rows":"8783786","read_bytes":"819092887","total_rows_to_read":"8880128"} ``` -Possibles champs d'en-tête: +Possibles champs d’en-tête: - `read_rows` — Number of rows read. - `read_bytes` — Volume of data read in bytes. @@ -252,18 +252,18 @@ Possibles champs d'en-tête: - `written_rows` — Number of rows written. - `written_bytes` — Volume of data written in bytes. -Les requêtes en cours d'exécution ne s'arrêtent pas automatiquement si la connexion HTTP est perdue. L'analyse et le formatage des données sont effectués côté serveur et l'utilisation du réseau peut s'avérer inefficace. -Facultatif ‘query\_id’ le paramètre peut être passé comme ID de requête (n'importe quelle chaîne). Pour plus d'informations, consultez la section “Settings, replace\_running\_query”. +Les requêtes en cours d’exécution ne s’arrêtent pas automatiquement si la connexion HTTP est perdue. L’analyse et le formatage des données sont effectués côté serveur et l’utilisation du réseau peut s’avérer inefficace. +Facultatif ‘query\_id’ le paramètre peut être passé comme ID de requête (n’importe quelle chaîne). Pour plus d’informations, consultez la section “Settings, replace\_running\_query”. -Facultatif ‘quota\_key’ le paramètre peut être passé comme clé de quota (n'importe quelle chaîne). Pour plus d'informations, consultez la section “Quotas”. +Facultatif ‘quota\_key’ le paramètre peut être passé comme clé de quota (n’importe quelle chaîne). Pour plus d’informations, consultez la section “Quotas”. -L'interface HTTP permet de transmettre des données externes (tables temporaires externes) pour l'interrogation. Pour plus d'informations, consultez la section “External data for query processing”. +L’interface HTTP permet de transmettre des données externes (tables temporaires externes) pour l’interrogation. Pour plus d’informations, consultez la section “External data for query processing”. ## Tampon De Réponse {#response-buffering} -Vous pouvez activer la mise en mémoire tampon des réponses côté serveur. Le `buffer_size` et `wait_end_of_query` Les paramètres D'URL sont fournis à cette fin. +Vous pouvez activer la mise en mémoire tampon des réponses côté serveur. Le `buffer_size` et `wait_end_of_query` Les paramètres D’URL sont fournis à cette fin. -`buffer_size` détermine le nombre d'octets dans le résultat de tampon dans la mémoire du serveur. Si un corps de résultat est supérieur à ce seuil, le tampon est écrit sur le canal HTTP et les données restantes sont envoyées directement au canal HTTP. +`buffer_size` détermine le nombre d’octets dans le résultat de tampon dans la mémoire du serveur. Si un corps de résultat est supérieur à ce seuil, le tampon est écrit sur le canal HTTP et les données restantes sont envoyées directement au canal HTTP. Pour vous assurer que la réponse entière est mise en mémoire tampon, définissez `wait_end_of_query=1`. Dans ce cas, les données ne sont pas stockées dans la mémoire tampon temporaire du serveur de fichiers. @@ -273,11 +273,11 @@ Exemple: $ curl -sS 'http://localhost:8123/?max_result_bytes=4000000&buffer_size=3000000&wait_end_of_query=1' -d 'SELECT toUInt8(number) FROM system.numbers LIMIT 9000000 FORMAT RowBinary' ``` -Utilisez la mise en mémoire tampon pour éviter les situations où une erreur de traitement de requête s'est produite après l'envoi du code de réponse et des en-têtes HTTP au client. Dans cette situation, un message d'erreur est écrit à la fin du corps de la réponse, et du côté client, l'erreur ne peut être détectée qu'à l'étape d'analyse. +Utilisez la mise en mémoire tampon pour éviter les situations où une erreur de traitement de requête s’est produite après l’envoi du code de réponse et des en-têtes HTTP au client. Dans cette situation, un message d’erreur est écrit à la fin du corps de la réponse, et du côté client, l’erreur ne peut être détectée qu’à l’étape d’analyse. -### Requêtes avec paramètres {#cli-queries-with-parameters} +### Requêtes Avec paramètres {#cli-queries-with-parameters} -Vous pouvez créer une requête avec paramètres et transmettre des valeurs des paramètres de la requête HTTP. Pour plus d'informations, voir [Requêtes avec des paramètres pour CLI](cli.md#cli-queries-with-parameters). +Vous pouvez créer une requête avec paramètres et transmettre des valeurs des paramètres de la requête HTTP. Pour plus d’informations, voir [Requêtes avec des paramètres pour CLI](cli.md#cli-queries-with-parameters). ### Exemple {#example} @@ -287,17 +287,17 @@ $ curl -sS "
?param_id=2¶m_phrase=test" -d "SELECT * FROM table WHER ## Interface HTTP prédéfinie {#predefined_http_interface} -ClickHouse prend en charge des requêtes spécifiques via L'interface HTTP. Par exemple, vous pouvez écrire des données dans un tableau comme suit: +ClickHouse prend en charge des requêtes spécifiques via L’interface HTTP. Par exemple, vous pouvez écrire des données dans un tableau comme suit: ``` bash $ echo '(4),(5),(6)' | curl 'http://localhost:8123/?query=INSERT%20INTO%20t%20VALUES' --data-binary @- ``` -ClickHouse prend également en charge L'Interface HTTP prédéfinie qui peut vous aider à une intégration plus facile avec des outils tiers tels que [Prometheus exportateur](https://github.com/percona-lab/clickhouse_exporter). +ClickHouse prend également en charge L’Interface HTTP prédéfinie qui peut vous aider à une intégration plus facile avec des outils tiers tels que [Prometheus exportateur](https://github.com/percona-lab/clickhouse_exporter). Exemple: -- Tout d'abord, ajoutez cette section au fichier de configuration du serveur: +- Tout d’abord, ajoutez cette section au fichier de configuration du serveur: @@ -313,7 +313,7 @@ Exemple: ``` -- Vous pouvez maintenant demander l'url directement pour les données au format Prometheus: +- Vous pouvez maintenant demander l’url directement pour les données au format Prometheus: @@ -359,7 +359,7 @@ curl -vvv 'http://localhost:8123/metrics' * Connection #0 to host localhost left intact ``` -Comme vous pouvez le voir dans l'exemple, si `` est configuré dans la configuration.fichier xml, ClickHouse fera correspondre les requêtes HTTP reçues au type prédéfini dans ``, puis ClickHouse exécutera la requête prédéfinie correspondante si la correspondance est réussie. +Comme vous pouvez le voir dans l’exemple, si `` est configuré dans la configuration.fichier xml, ClickHouse fera correspondre les requêtes HTTP reçues au type prédéfini dans ``, puis ClickHouse exécutera la requête prédéfinie correspondante si la correspondance est réussie. Maintenant `` pouvez configurer ``, ``, ``, `` et `` . @@ -367,7 +367,7 @@ Maintenant `` pouvez configurer ``, ` `` renvoie le contenu spécifié pour la requête de chemin racine. Le contenu de retour spécifique est configuré par `http_server_default_response` dans la configuration.XML. si non spécifié, le retour **OK.** -`http_server_default_response` n'est pas défini et une requête HTTP est envoyée à ClickHouse. Le résultat est comme suit: +`http_server_default_response` n’est pas défini et une requête HTTP est envoyée à ClickHouse. Le résultat est comme suit: ``` xml @@ -393,7 +393,7 @@ Maintenant `` pouvez configurer ``, ` ## ping\_handler {#ping_handler} -`` peut être utilisé pour sonder la santé du serveur clickhouse actuel. Lorsque le serveur HTTP ClickHouse est normal, l'accès à ClickHouse via `` sera de retour **OK.**. +`` peut être utilisé pour sonder la santé du serveur clickhouse actuel. Lorsque le serveur HTTP ClickHouse est normal, l’accès à ClickHouse via `` sera de retour **OK.**. Exemple: @@ -410,7 +410,7 @@ Ok. ## replicas\_status\_handler {#replicas_status_handler} -`` est utilisé pour détecter l'état du nœud de réplica et le retour **OK.** si le nœud réplique n'a pas de délai. S'il y a un retard, renvoyez le retard spécifique. La valeur de `` prend en charge la personnalisation. Si vous ne spécifiez pas ``, ClickHouse réglage par défaut `` être **/ replicas\_status**. +`` est utilisé pour détecter l’état du nœud de réplica et le retour **OK.** si le nœud réplique n’a pas de délai. S’il y a un retard, renvoyez le retard spécifique. La valeur de `` prend en charge la personnalisation. Si vous ne spécifiez pas ``, ClickHouse réglage par défaut `` être **/ replicas\_status**. Exemple: @@ -438,17 +438,17 @@ db.stats: Absolute delay: 22. Relative delay: 22. Vous pouvez configurer ``, ``, `` et `` dans ``. -`` est responsable de la correspondance de la partie méthode de la requête HTTP. `` entièrement conforme à la définition de [méthode](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) dans le protocole HTTP. C'est une option de configuration. S'il n'est pas défini dans le fichier de configuration, il ne correspond pas à la partie méthode de la requête HTTP +`` est responsable de la correspondance de la partie méthode de la requête HTTP. `` entièrement conforme à la définition de [méthode](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) dans le protocole HTTP. C’est une option de configuration. S’il n’est pas défini dans le fichier de configuration, il ne correspond pas à la partie méthode de la requête HTTP -`` est responsable de la correspondance de la partie url de la requête HTTP. Il est compatible avec [RE2](https://github.com/google/re2)s 'expressions régulières. C'est une option de configuration. S'il n'est pas défini dans le fichier de configuration, il ne correspond pas à la partie url de la requête HTTP +`` est responsable de la correspondance de la partie url de la requête HTTP. Il est compatible avec [RE2](https://github.com/google/re2)s ’expressions régulières. C’est une option de configuration. S’il n’est pas défini dans le fichier de configuration, il ne correspond pas à la partie url de la requête HTTP -`` est responsable de la correspondance de la partie d'en-tête de la requête HTTP. Il est compatible avec les expressions régulières de RE2. C'est une option de configuration. S'il n'est pas défini dans le fichier de configuration, il ne correspond pas à la partie d'en-tête de la requête HTTP +`` est responsable de la correspondance de la partie d’en-tête de la requête HTTP. Il est compatible avec les expressions régulières de RE2. C’est une option de configuration. S’il n’est pas défini dans le fichier de configuration, il ne correspond pas à la partie d’en-tête de la requête HTTP -`` la valeur est une requête prédéfinie de ``, qui est exécuté par ClickHouse lorsqu'une requête HTTP est mise en correspondance et que le résultat de la requête est renvoyé. C'est une configuration incontournable. +`` la valeur est une requête prédéfinie de ``, qui est exécuté par ClickHouse lorsqu’une requête HTTP est mise en correspondance et que le résultat de la requête est renvoyé. C’est une configuration incontournable. `` prend en charge les paramètres de réglage et les valeurs query\_params. -L'exemple suivant définit les valeurs de `max_threads` et `max_alter_threads` Paramètres, puis interroge la table système pour vérifier si ces paramètres ont été définis avec succès. +L’exemple suivant définit les valeurs de `max_threads` et `max_alter_threads` Paramètres, puis interroge la table système pour vérifier si ces paramètres ont été définis avec succès. Exemple: @@ -476,16 +476,16 @@ max_alter_threads 2 ``` !!! note "Note" - Dans un ``, un `` prend en charge un seul `` d'un type d'insertion. + Dans un ``, un `` prend en charge un seul `` d’un type d’insertion. ## dynamic\_query\_handler {#dynamic_query_handler} `` que `` augmenter `` . -Clickhouse extrait et exécute la valeur correspondant au `` valeur dans l'url de la requête HTTP. -ClickHouse réglage par défaut `` être `/query` . C'est une option de configuration. Si il n'y a pas de définition dans le fichier de configuration, le paramètre n'est pas passé. +Clickhouse extrait et exécute la valeur correspondant au `` valeur dans l’url de la requête HTTP. +ClickHouse réglage par défaut `` être `/query` . C’est une option de configuration. Si il n’y a pas de définition dans le fichier de configuration, le paramètre n’est pas passé. -Pour expérimenter cette fonctionnalité, l'exemple définit les valeurs de max\_threads et max\_alter\_threads et demande si les paramètres ont été définis avec succès. +Pour expérimenter cette fonctionnalité, l’exemple définit les valeurs de max\_threads et max\_alter\_threads et demande si les paramètres ont été définis avec succès. La différence est que dans ``, la requête est écrite dans le fichier de configuration. Mais dans ``, la requête est écrite sous la forme de param de la requête HTTP. Exemple: diff --git a/docs/fr/interfaces/index.md b/docs/fr/interfaces/index.md index d85ce9cdbe3..8c3e1c82403 100644 --- a/docs/fr/interfaces/index.md +++ b/docs/fr/interfaces/index.md @@ -13,16 +13,16 @@ ClickHouse fournit deux interfaces réseau (les deux peuvent être encapsulées - [HTTP](http.md) qui est documenté et facile à utiliser directement. - [Natif de TCP](tcp.md) qui a moins de frais généraux. -Dans la plupart des cas, il est recommandé d'utiliser un outil ou une bibliothèque approprié au lieu d'interagir directement avec ceux-ci. Officiellement pris en charge par Yandex sont les suivants: +Dans la plupart des cas, il est recommandé d’utiliser un outil ou une bibliothèque approprié au lieu d’interagir directement avec ceux-ci. Officiellement pris en charge par Yandex sont les suivants: - [Client de ligne de commande](cli.md) - [JDBC](jdbc.md) - [Pilote ODBC](odbc.md) -- [Bibliothèque client c++ ](cpp.md) +- [Bibliothèque client c++](cpp.md) Il existe également un large éventail de bibliothèques tierces pour travailler avec ClickHouse: -- [Bibliothèques clientes](third-party/client_libraries.md) +- [Bibliothèques clientes](third-party/client-libraries.md) - [Intégration](third-party/integrations.md) - [Les interfaces visuelles](third-party/gui.md) diff --git a/docs/fr/interfaces/mysql.md b/docs/fr/interfaces/mysql.md index ac57deefaba..c20d88ca905 100644 --- a/docs/fr/interfaces/mysql.md +++ b/docs/fr/interfaces/mysql.md @@ -7,13 +7,13 @@ toc_title: Interface MySQL # Interface MySQL {#mysql-interface} -ClickHouse prend en charge le protocole de fil MySQL. Il peut être activé par [mysql\_port](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) paramètre dans le fichier de configuration: +ClickHouse prend en charge le protocole de fil MySQL. Il peut être activé par [mysql\_port](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) paramètre dans le fichier de configuration: ``` xml 9004 ``` -Exemple de connexion à l'aide d'outil de ligne de commande `mysql`: +Exemple de connexion à l’aide d’outil de ligne de commande `mysql`: ``` bash $ mysql --protocol tcp -u default -P 9004 @@ -37,8 +37,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -Pour la compatibilité avec tous les clients MySQL, il est recommandé de spécifier le mot de passe utilisateur avec [double SHA1](../operations/settings/settings_users.md#password_double_sha1_hex) dans le fichier de configuration. -Si le mot de passe de l'utilisateur est spécifié [SHA256](../operations/settings/settings_users.md#password_sha256_hex), certains clients ne pourront pas s'authentifier (mysqljs et anciennes versions de l'outil de ligne de commande mysql). +Pour la compatibilité avec tous les clients MySQL, il est recommandé de spécifier le mot de passe utilisateur avec [double SHA1](../operations/settings/settings-users.md#password_double_sha1_hex) dans le fichier de configuration. +Si le mot de passe de l’utilisateur est spécifié [SHA256](../operations/settings/settings-users.md#password_sha256_hex), certains clients ne pourront pas s’authentifier (mysqljs et anciennes versions de l’outil de ligne de commande mysql). Restriction: diff --git a/docs/fr/interfaces/tcp.md b/docs/fr/interfaces/tcp.md index 45e89776547..3103b1c105f 100644 --- a/docs/fr/interfaces/tcp.md +++ b/docs/fr/interfaces/tcp.md @@ -7,6 +7,6 @@ toc_title: Interface Native (TCP) # Interface Native (TCP) {#native-interface-tcp} -Le protocole natif est utilisé dans le [client de ligne de commande](cli.md), pour la communication inter-serveur pendant le traitement de requête distribué, et également dans d'autres programmes C++. Malheureusement, le protocole clickhouse natif n'a pas encore de spécification formelle, mais il peut être rétro-conçu à partir du code source ClickHouse (démarrage [ici](https://github.com/ClickHouse/ClickHouse/tree/master/dbms/Client)) et/ou en interceptant et en analysant le trafic TCP. +Le protocole natif est utilisé dans le [client de ligne de commande](cli.md), pour la communication inter-serveur pendant le traitement de requête distribué, et également dans d’autres programmes C++. Malheureusement, le protocole clickhouse natif n’a pas encore de spécification formelle, mais il peut être rétro-conçu à partir du code source ClickHouse (démarrage [ici](https://github.com/ClickHouse/ClickHouse/tree/master/dbms/Client)) et/ou en interceptant et en analysant le trafic TCP. [Article Original](https://clickhouse.tech/docs/en/interfaces/tcp/) diff --git a/docs/fr/interfaces/third-party/client-libraries.md b/docs/fr/interfaces/third-party/client-libraries.md new file mode 100644 index 00000000000..ec2fe4e7002 --- /dev/null +++ b/docs/fr/interfaces/third-party/client-libraries.md @@ -0,0 +1,59 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 26 +toc_title: "Biblioth\xE8ques Clientes" +--- + +# Bibliothèques Clientes De développeurs Tiers {#client-libraries-from-third-party-developers} + +!!! warning "Avertissement" + Yandex ne **pas** maintenir les bibliothèques énumérées ci-dessous et n’ont pas fait de tests approfondis pour assurer leur qualité. + +- Python + - [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm) + - [clickhouse-chauffeur](https://github.com/mymarilyn/clickhouse-driver) + - [clickhouse-client](https://github.com/yurial/clickhouse-client) + - [aiochclient](https://github.com/maximdanilchenko/aiochclient) +- PHP + - [smi2 / phpclickhouse](https://packagist.org/packages/smi2/phpClickHouse) + - [8bitov / clickhouse-PHP-client](https://packagist.org/packages/8bitov/clickhouse-php-client) + - [bozerkins / clickhouse-client](https://packagist.org/packages/bozerkins/clickhouse-client) + - [simpod / clickhouse-client](https://packagist.org/packages/simpod/clickhouse-client) + - [seva-code/php-cliquez-maison-client](https://packagist.org/packages/seva-code/php-click-house-client) + - [Client Seasclick c++](https://github.com/SeasX/SeasClick) +- Aller + - [clickhouse](https://github.com/kshvakov/clickhouse/) + - [aller-clickhouse](https://github.com/roistat/go-clickhouse) + - [mailrugo-clickhouse](https://github.com/mailru/go-clickhouse) + - [golang-clickhouse](https://github.com/leprosus/golang-clickhouse) +- NodeJs + - [clickhouse (NodeJs)](https://github.com/TimonKK/clickhouse) + - [node-clickhouse](https://github.com/apla/node-clickhouse) +- Perl + - [perl-DBD-ClickHouse](https://github.com/elcamlost/perl-DBD-ClickHouse) + - [HTTP-ClickHouse](https://metacpan.org/release/HTTP-ClickHouse) + - [AnyEvent-ClickHouse](https://metacpan.org/release/AnyEvent-ClickHouse) +- Rubis + - [ClickHouse (Ruby)](https://github.com/shlima/click_house) + - [clickhouse-activerecord](https://github.com/PNixx/clickhouse-activerecord) +- R + - [clickhouse-r](https://github.com/hannesmuehleisen/clickhouse-r) + - [RClickhouse](https://github.com/IMSMWU/RClickhouse) +- Java + - [clickhouse-client-java](https://github.com/VirtusAI/clickhouse-client-java) + - [clickhouse-client](https://github.com/Ecwid/clickhouse-client) +- Scala + - [clickhouse-Scala-client](https://github.com/crobox/clickhouse-scala-client) +- Kotlin + - [AORM](https://github.com/TanVD/AORM) +- C\# + - [ClickHouse.Ado](https://github.com/killwort/ClickHouse-Net) + - [ClickHouse.Client](https://github.com/DarkWanderer/ClickHouse.Client) + - [ClickHouse.Net](https://github.com/ilyabreev/ClickHouse.Net) +- Elixir + - [clickhousex](https://github.com/appodeal/clickhousex/) +- Nim + - [nim-clickhouse](https://github.com/leonardoce/nim-clickhouse) + +[Article Original](https://clickhouse.tech/docs/en/interfaces/third-party/client_libraries/) diff --git a/docs/fr/interfaces/third-party/client_libraries.md b/docs/fr/interfaces/third-party/client_libraries.md deleted file mode 100644 index e4be3a53646..00000000000 --- a/docs/fr/interfaces/third-party/client_libraries.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 26 -toc_title: "Biblioth\xE8ques Clientes" ---- - -# Bibliothèques clientes de développeurs tiers {#client-libraries-from-third-party-developers} - -!!! warning "Avertissement" - Yandex ne **pas** maintenir les bibliothèques énumérées ci-dessous et n'ont pas fait de tests approfondis pour assurer leur qualité. - -- Python - - [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm) - - [clickhouse-chauffeur](https://github.com/mymarilyn/clickhouse-driver) - - [clickhouse-client](https://github.com/yurial/clickhouse-client) - - [aiochclient](https://github.com/maximdanilchenko/aiochclient) -- PHP - - [smi2 / phpclickhouse](https://packagist.org/packages/smi2/phpClickHouse) - - [8bitov / clickhouse-PHP-client](https://packagist.org/packages/8bitov/clickhouse-php-client) - - [bozerkins / clickhouse-client](https://packagist.org/packages/bozerkins/clickhouse-client) - - [simpod / clickhouse-client](https://packagist.org/packages/simpod/clickhouse-client) - - [seva-code/php-cliquez-maison-client](https://packagist.org/packages/seva-code/php-click-house-client) - - [Client Seasclick c++ ](https://github.com/SeasX/SeasClick) -- Aller - - [clickhouse](https://github.com/kshvakov/clickhouse/) - - [aller-clickhouse](https://github.com/roistat/go-clickhouse) - - [mailrugo-clickhouse](https://github.com/mailru/go-clickhouse) - - [golang-clickhouse](https://github.com/leprosus/golang-clickhouse) -- NodeJs - - [clickhouse (NodeJs)](https://github.com/TimonKK/clickhouse) - - [node-clickhouse](https://github.com/apla/node-clickhouse) -- Perl - - [perl-DBD-ClickHouse](https://github.com/elcamlost/perl-DBD-ClickHouse) - - [HTTP-ClickHouse](https://metacpan.org/release/HTTP-ClickHouse) - - [AnyEvent-ClickHouse](https://metacpan.org/release/AnyEvent-ClickHouse) -- Rubis - - [ClickHouse (Ruby)](https://github.com/shlima/click_house) - - [clickhouse-activerecord](https://github.com/PNixx/clickhouse-activerecord) -- R - - [clickhouse-r](https://github.com/hannesmuehleisen/clickhouse-r) - - [RClickhouse](https://github.com/IMSMWU/RClickhouse) -- Java - - [clickhouse-client-java](https://github.com/VirtusAI/clickhouse-client-java) - - [clickhouse-client](https://github.com/Ecwid/clickhouse-client) -- Scala - - [clickhouse-Scala-client](https://github.com/crobox/clickhouse-scala-client) -- Kotlin - - [AORM](https://github.com/TanVD/AORM) -- C\# - - [ClickHouse.Ado](https://github.com/killwort/ClickHouse-Net) - - [ClickHouse.Client](https://github.com/DarkWanderer/ClickHouse.Client) - - [ClickHouse.Net](https://github.com/ilyabreev/ClickHouse.Net) -- Elixir - - [clickhousex](https://github.com/appodeal/clickhousex/) -- Nim - - [nim-clickhouse](https://github.com/leonardoce/nim-clickhouse) - -[Article Original](https://clickhouse.tech/docs/en/interfaces/third-party/client_libraries/) diff --git a/docs/fr/interfaces/third-party/gui.md b/docs/fr/interfaces/third-party/gui.md index 1682c78fdbd..341784f582f 100644 --- a/docs/fr/interfaces/third-party/gui.md +++ b/docs/fr/interfaces/third-party/gui.md @@ -5,7 +5,7 @@ toc_priority: 28 toc_title: Les Interfaces Visuelles --- -# Interfaces visuelles de développeurs tiers {#visual-interfaces-from-third-party-developers} +# Interfaces Visuelles De développeurs Tiers {#visual-interfaces-from-third-party-developers} ## Open-Source {#open-source} @@ -15,10 +15,10 @@ Interface Web pour ClickHouse dans le [Tabix](https://github.com/tabixio/tabix) Caractéristique: -- Fonctionne avec ClickHouse directement à partir du navigateur, sans avoir besoin d'installer un logiciel supplémentaire. +- Fonctionne avec ClickHouse directement à partir du navigateur, sans avoir besoin d’installer un logiciel supplémentaire. - Éditeur de requête avec coloration syntaxique. -- L'Auto-complétion des commandes. -- Outils d'analyse graphique de l'exécution des requêtes. +- L’Auto-complétion des commandes. +- Outils d’analyse graphique de l’exécution des requêtes. - Options de jeu de couleurs. [Documentation Tabix](https://tabix.io/doc/). @@ -31,7 +31,7 @@ Caractéristique: - Générateur de requêtes avec coloration syntaxique. Affichez la réponse dans une table ou une vue JSON. - Exporter les résultats de la requête au format CSV ou JSON. -- Liste des processus avec des descriptions. Le mode d'écriture. Capacité à arrêter (`KILL`) processus. +- Liste des processus avec des descriptions. Le mode d’écriture. Capacité à arrêter (`KILL`) processus. - Base de données du graphique. Affiche toutes les tables et leurs colonnes avec des informations supplémentaires. - Une vue rapide de la taille de la colonne. - La configuration du serveur. @@ -40,7 +40,7 @@ Les fonctionnalités suivantes sont prévues pour le développement: - Gestion de base de données. - La gestion des utilisateurs. -- En temps réel l'analyse des données. +- En temps réel l’analyse des données. - Surveillance de Cluster. - La gestion de Cluster. - Suivi des tables répliquées et Kafka. @@ -97,7 +97,7 @@ Caractéristique: ### DataGrip {#datagrip} -[DataGrip](https://www.jetbrains.com/datagrip/) est un IDE de base de données de JetBrains avec un support dédié pour ClickHouse. Il est également intégré dans D'autres outils basés sur IntelliJ: PyCharm, IntelliJ IDEA, GoLand, PhpStorm et autres. +[DataGrip](https://www.jetbrains.com/datagrip/) est un IDE de base de données de JetBrains avec un support dédié pour ClickHouse. Il est également intégré dans D’autres outils basés sur IntelliJ: PyCharm, IntelliJ IDEA, GoLand, PhpStorm et autres. Caractéristique: @@ -110,7 +110,7 @@ Caractéristique: ### Yandex DataLens {#yandex-datalens} -[Yandex DataLens](https://cloud.yandex.ru/services/datalens) est un service de visualisation et d'analyse de données. +[Yandex DataLens](https://cloud.yandex.ru/services/datalens) est un service de visualisation et d’analyse de données. Caractéristique: @@ -122,7 +122,7 @@ Caractéristique: DataLens est [disponible gratuitement](https://cloud.yandex.com/docs/datalens/pricing) pour les projets à faible charge, même pour un usage commercial. - [Documentation DataLens](https://cloud.yandex.com/docs/datalens/). -- [Tutoriel](https://cloud.yandex.com/docs/solutions/datalens/data-from-ch-visualization) sur la visualisation des données à partir d'une base de données ClickHouse. +- [Tutoriel](https://cloud.yandex.com/docs/solutions/datalens/data-from-ch-visualization) sur la visualisation des données à partir d’une base de données ClickHouse. ### Logiciel Holistics {#holistics-software} @@ -138,8 +138,8 @@ Caractéristique: ### Looker {#looker} -[Looker](https://looker.com) est une plate-forme de données et un outil de business intelligence avec prise en charge de plus de 50 dialectes de base de données, y compris ClickHouse. Looker est disponible en tant que plate-forme SaaS et auto-hébergé. Les utilisateurs peuvent utiliser Looker via le navigateur pour explorer les données, créer des visualisations et des tableaux de bord, planifier des rapports et partager leurs idées avec des collègues. Looker fournit un riche ensemble d'outils pour intégrer ces fonctionnalités dans d'autres applications, et une API -pour intégrer les données avec d'autres applications. +[Looker](https://looker.com) est une plate-forme de données et un outil de business intelligence avec prise en charge de plus de 50 dialectes de base de données, y compris ClickHouse. Looker est disponible en tant que plate-forme SaaS et auto-hébergé. Les utilisateurs peuvent utiliser Looker via le navigateur pour explorer les données, créer des visualisations et des tableaux de bord, planifier des rapports et partager leurs idées avec des collègues. Looker fournit un riche ensemble d’outils pour intégrer ces fonctionnalités dans d’autres applications, et une API +pour intégrer les données avec d’autres applications. Caractéristique: diff --git a/docs/fr/interfaces/third-party/integrations.md b/docs/fr/interfaces/third-party/integrations.md index 565be2b9604..797b6971ad1 100644 --- a/docs/fr/interfaces/third-party/integrations.md +++ b/docs/fr/interfaces/third-party/integrations.md @@ -5,12 +5,12 @@ toc_priority: 27 toc_title: "Int\xE9gration" --- -# Bibliothèques d'intégration de développeurs tiers {#integration-libraries-from-third-party-developers} +# Bibliothèques d’intégration De développeurs Tiers {#integration-libraries-from-third-party-developers} !!! warning "Avertissement" - Yandex ne **pas** maintenir les outils et les bibliothèques énumérés ci-dessous et n'ont pas fait de tests approfondis pour assurer leur qualité. + Yandex ne **pas** maintenir les outils et les bibliothèques énumérés ci-dessous et n’ont pas fait de tests approfondis pour assurer leur qualité. -## Produits D'Infrastructure {#infrastructure-products} +## Produits D’Infrastructure {#infrastructure-products} - Systèmes de gestion de bases de données relationnelles - [MySQL](https://www.mysql.com) @@ -24,7 +24,7 @@ toc_title: "Int\xE9gration" - [clickhouse\_fdw](https://github.com/adjust/clickhouse_fdw) - [MSSQL](https://en.wikipedia.org/wiki/Microsoft_SQL_Server) - [ClickHouseMigrator](https://github.com/zlzforever/ClickHouseMigrator) -- Files d'attente de messages +- Files d’attente de messages - [Kafka](https://kafka.apache.org) - [clickhouse\_sinker](https://github.com/housepower/clickhouse_sinker) (utiliser [Allez client](https://github.com/kshvakov/clickhouse/)) - Objet de stockages @@ -42,7 +42,7 @@ toc_title: "Int\xE9gration" - [graphouse](https://github.com/yandex/graphouse) - [carbone-clickhouse](https://github.com/lomik/carbon-clickhouse) + - [graphite-clickhouse](https://github.com/lomik/graphite-clickhouse) - - [graphite-CH-optimizer](https://github.com/innogames/graphite-ch-optimizer) - optimise les partitions calées dans [\* GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) si les règles de [configuration de cumul](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) pourrait être appliquée + - [graphite-CH-optimizer](https://github.com/innogames/graphite-ch-optimizer) - optimise les partitions calées dans [\* GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) si les règles de [configuration de cumul](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) pourrait être appliquée - [Grafana](https://grafana.com/) - [clickhouse-grafana](https://github.com/Vertamedia/clickhouse-grafana) - [Prometheus](https://prometheus.io/) @@ -74,7 +74,7 @@ toc_title: "Int\xE9gration" - [sqlalchemy-clickhouse](https://github.com/cloudflare/sqlalchemy-clickhouse) (utiliser [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm)) - [Panda](https://pandas.pydata.org) - [pandahouse](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -82,7 +82,7 @@ toc_title: "Int\xE9gration" - [RClickhouse](https://github.com/IMSMWU/RClickhouse) (utiliser [clickhouse-cpp](https://github.com/artpaul/clickhouse-cpp)) - Java - [Hadoop](http://hadoop.apache.org) - - [clickhouse-HDFS-chargeur](https://github.com/jaykelin/clickhouse-hdfs-loader) (utiliser [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [clickhouse-HDFS-chargeur](https://github.com/jaykelin/clickhouse-hdfs-loader) (utiliser [JDBC](../../sql-reference/table-functions/jdbc.md)) - Scala - [Akka](https://akka.io) - [clickhouse-Scala-client](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/fr/interfaces/third-party/proxy.md b/docs/fr/interfaces/third-party/proxy.md index 154c0b8efc1..30a813d5515 100644 --- a/docs/fr/interfaces/third-party/proxy.md +++ b/docs/fr/interfaces/third-party/proxy.md @@ -5,7 +5,7 @@ toc_priority: 29 toc_title: Proxy --- -# Serveurs Proxy de développeurs tiers {#proxy-servers-from-third-party-developers} +# Serveurs Proxy De développeurs Tiers {#proxy-servers-from-third-party-developers} ## chproxy {#chproxy} @@ -21,7 +21,7 @@ Mis en œuvre dans Go. ## KittenHouse {#kittenhouse} -[KittenHouse](https://github.com/VKCOM/kittenhouse) est conçu pour être un proxy local entre ClickHouse et serveur d'applications dans le cas où il est impossible ou gênant d'insérer des données en mémoire tampon du côté de votre application. +[KittenHouse](https://github.com/VKCOM/kittenhouse) est conçu pour être un proxy local entre ClickHouse et serveur d’applications dans le cas où il est impossible ou gênant d’insérer des données en mémoire tampon du côté de votre application. Caractéristique: @@ -33,13 +33,13 @@ Mis en œuvre dans Go. ## ClickHouse-Vrac {#clickhouse-bulk} -[ClickHouse-Vrac](https://github.com/nikepan/clickhouse-bulk) est un collecteur simple D'insertion de ClickHouse. +[ClickHouse-Vrac](https://github.com/nikepan/clickhouse-bulk) est un collecteur simple D’insertion de ClickHouse. Caractéristique: - Groupez les demandes et envoyez-les par seuil ou intervalle. - Plusieurs serveurs distants. -- L'authentification de base. +- L’authentification de base. Mis en œuvre dans Go. diff --git a/docs/fr/introduction/adopters.md b/docs/fr/introduction/adopters.md index f03f0242c72..5b9caeb1e7f 100644 --- a/docs/fr/introduction/adopters.md +++ b/docs/fr/introduction/adopters.md @@ -8,9 +8,9 @@ toc_title: Adoptant # Clickhouse Adopteurs {#clickhouse-adopters} !!! warning "Avertissement" - La liste suivante des entreprises utilisant ClickHouse et leurs histoires de réussite est assemblé à partir de sources publiques, pourrait donc différer de la réalité actuelle. Nous vous serions reconnaissants si vous partager l'histoire de l'adoption de ClickHouse dans votre entreprise et [ajouter à la liste](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/introduction/adopters.md), mais assurez-vous que vous n'aurez aucun problème de NDA en le faisant. Fournir des mises à jour avec des publications d'autres entreprises est également utile. + La liste suivante des entreprises utilisant ClickHouse et leurs histoires de réussite est assemblé à partir de sources publiques, pourrait donc différer de la réalité actuelle. Nous vous serions reconnaissants si vous partager l’histoire de l’adoption de ClickHouse dans votre entreprise et [ajouter à la liste](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/introduction/adopters.md), mais assurez-vous que vous n’aurez aucun problème de NDA en le faisant. Fournir des mises à jour avec des publications d’autres entreprises est également utile. -| Entreprise | Industrie | Cas d'utilisation | La Taille De Cluster | (Onu)Taille Des Données Compressées\* | Référence | +| Entreprise | Industrie | Cas d’utilisation | La Taille De Cluster | (Onu)Taille Des Données Compressées\* | Référence | |-------------------------------------------------------------------------------|-------------------------------------|------------------------------|-----------------------------------------------------------------|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [2gis](https://2gis.ru) | Cartographie | Surveiller | — | — | [Parler en russe, juillet 2019](https://youtu.be/58sPkXfq6nw) | | [Aloha Navigateur](https://alohabrowser.com/) | Mobile App | Navigateur backend | — | — | [Diapositives en russe, mai 2019](https://github.com/yandex/clickhouse-presentations/blob/master/meetup22/aloha.pdf) | @@ -24,13 +24,13 @@ toc_title: Adoptant | `Dataliance/UltraPower` | Télécommunication | Analytics | — | — | [Diapositives en chinois, janvier 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/telecom.pdf) | | [CARTO](https://carto.com/) | Business Intelligence | GEO analytics | — | — | [Traitement géospatial avec Clickhouse](https://carto.com/blog/geospatial-processing-with-clickhouse/) | | [CERN](http://public.web.cern.ch/public/) | Recherche | Expérience | — | — | [Communiqué De Presse, avril 2012](https://www.yandex.com/company/press_center/press_releases/2012/2012-04-10/) | -| [Cisco](http://cisco.com/) | Réseau | L'analyse de trafic | — | — | [Lightning talk, octobre 2019](https://youtu.be/-hI1vDR2oPY?t=5057) | +| [Cisco](http://cisco.com/) | Réseau | L’analyse de trafic | — | — | [Lightning talk, octobre 2019](https://youtu.be/-hI1vDR2oPY?t=5057) | | [Citadelle Titres](https://www.citadelsecurities.com/) | Finance | — | — | — | [Contribution, Mars 2019](https://github.com/ClickHouse/ClickHouse/pull/4774) | | [Citymobil](https://city-mobil.ru) | Taxi | Analytics | — | — | [Billet de Blog en russe, mars 2020](https://habr.com/en/company/citymobil/blog/490660/) | | [ContentSquare](https://contentsquare.com) | Web analytics | Produit principal | — | — | [Billet de Blog, novembre 2018](http://souslecapot.net/2018/11/21/patrick-chatain-vp-engineering-chez-contentsquare-penser-davantage-amelioration-continue-que-revolution-constante/) | -| [Cloudflare](https://cloudflare.com) | CDN | L'analyse de trafic | 36 serveurs | — | [Billet de Blog, mai 2017](https://blog.cloudflare.com/how-cloudflare-analyzes-1m-dns-queries-per-second/), [Billet de Blog, mars 2018](https://blog.cloudflare.com/http-analytics-for-6m-requests-per-second-using-clickhouse/) | +| [Cloudflare](https://cloudflare.com) | CDN | L’analyse de trafic | 36 serveurs | — | [Billet de Blog, mai 2017](https://blog.cloudflare.com/how-cloudflare-analyzes-1m-dns-queries-per-second/), [Billet de Blog, mars 2018](https://blog.cloudflare.com/http-analytics-for-6m-requests-per-second-using-clickhouse/) | | [Corunet](https://coru.net/) | Analytics | Produit principal | — | — | [Diapositives en anglais, avril 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup21/predictive_models.pdf) | -| [CraiditX 氪信](https://creditx.com) | Les finances de l'IA | Analyse | — | — | [Diapositives en anglais, novembre 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/udf.pptx) | +| [CraiditX 氪信](https://creditx.com) | Les finances de l’IA | Analyse | — | — | [Diapositives en anglais, novembre 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/udf.pptx) | | [Criteo / Storetail](https://www.criteo.com/) | Détail | Produit principal | — | — | [Diapositives en anglais, octobre 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/3_storetail.pptx) | | [La Deutsche Bank](https://db.com) | Finance | BI Analytics | — | — | [Diapositives en anglais, octobre 2019](https://bigdatadays.ru/wp-content/uploads/2019/10/D2-H3-3_Yakunin-Goihburg.pdf) | | [Diva-e](https://www.diva-e.com) | Conseil Digital | Produit Principal | — | — | [Diapositives en anglais, septembre 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup29/ClickHouse-MeetUp-Unusual-Applications-sd-2019-09-17.pdf) | @@ -44,11 +44,11 @@ toc_title: Adoptant | [Données Kodiak](https://www.kodiakdata.com/) | Nuage | Produit principal | — | — | [Diapositives en Engish, avril 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup13/kodiak_data.pdf) | | [Kontur](https://kontur.ru) | Le Développement De Logiciels | Métrique | — | — | [Parler en russe, novembre 2018](https://www.youtube.com/watch?v=U4u4Bd0FtrY) | | [LifeStreet](https://lifestreet.com/) | Réseau publicitaire | Produit principal | 75 serveurs (3 répliques) | 5.27 FRP | [Billet de Blog en russe, février 2017](https://habr.com/en/post/322620/) | -| [Mail.ru Solutions Cloud](https://mcs.mail.ru/) | Les services de Cloud | Produit principal | — | — | [Exécution de L'Instance ClickHouse, en russe](https://mcs.mail.ru/help/db-create/clickhouse#) | +| [Mail.ru Solutions Cloud](https://mcs.mail.ru/) | Les services de Cloud | Produit principal | — | — | [Exécution de L’Instance ClickHouse, en russe](https://mcs.mail.ru/help/db-create/clickhouse#) | | [MessageBird](https://www.messagebird.com) | Télécommunication | Statistique | — | — | [Diapositives en anglais, novembre 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup20/messagebird.pdf) | | [MGID](https://www.mgid.com/) | Réseau publicitaire | Web-analytics | — | — | [Notre expérience dans la mise en œuvre de SGBD analytique ClickHouse, en russe](http://gs-studio.com/news-about-it/32777----clickhouse---c) | | [OneAPM](https://www.oneapm.com/) | Monitorings et analyse des données | Produit principal | — | — | [Diapositives en chinois, octobre 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/8.%20clickhouse在OneAPM的应用%20杜龙.pdf) | -| [Pragma L'Innovation](http://www.pragma-innovation.fr/) | Télémétrie et analyse Big Data | Produit principal | — | — | [Diapositives en anglais, octobre 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/4_pragma_innovation.pdf) | +| [Pragma L’Innovation](http://www.pragma-innovation.fr/) | Télémétrie et analyse Big Data | Produit principal | — | — | [Diapositives en anglais, octobre 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/4_pragma_innovation.pdf) | | [QINGCLOUD](https://www.qingcloud.com/) | Les services de Cloud | Produit principal | — | — | [Diapositives en chinois, octobre 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/4.%20Cloud%20%2B%20TSDB%20for%20ClickHouse%20张健%20QingCloud.pdf) | | [Qrator](https://qrator.net) | Protection DDoS | Produit principal | — | — | [Billet De Blog, Mars 2019](https://blog.qrator.net/en/clickhouse-ddos-mitigation_37/) | | [Beijing pour cent Information Technology Co., Ltd.](https://www.percent.cn/) | Analytics | Produit Principal | — | — | [Diapositives en chinois, juin 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/4.%20ClickHouse万亿数据双中心的设计与实践%20.pdf) | diff --git a/docs/fr/introduction/distinctive-features.md b/docs/fr/introduction/distinctive-features.md new file mode 100644 index 00000000000..68cc1655b4b --- /dev/null +++ b/docs/fr/introduction/distinctive-features.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 4 +toc_title: "particularit\xE9" +--- + +# Caractéristiques Distinctives De ClickHouse {#distinctive-features-of-clickhouse} + +## Vrai SGBD orienté Colonne {#true-column-oriented-dbms} + +Dans un vrai SGBD orienté colonne, aucune donnée supplémentaire n’est stockée avec les valeurs. Entre autres choses, cela signifie que les valeurs de longueur constante doivent être prises en charge, pour éviter de stocker leur longueur “number” à côté de ces valeurs. Par exemple, un milliard de valeurs de type UInt8 devrait consommer environ 1 Go non compressé, ou cela affecte fortement l’utilisation du processeur. Il est essentiel de stocker des données de manière compacte (sans “garbage”) même lorsqu’il n’est pas compressé, puisque la vitesse de décompression (utilisation du processeur) dépend principalement du volume de données non compressées. + +Il est à noter car il existe des systèmes qui peuvent stocker des valeurs de différentes colonnes séparément, mais qui ne peuvent pas traiter efficacement les requêtes analytiques en raison de leur optimisation pour d’autres scénarios. Les exemples sont HBase, BigTable, Cassandra et HyperTable. Dans ces systèmes, vous obtiendriez un débit d’environ cent mille lignes par seconde, mais pas des centaines de millions de lignes par seconde. + +Il est également intéressant de noter que ClickHouse est un système de gestion de base de données, pas une seule base de données. ClickHouse permet de créer des tables et des bases de données en cours d’exécution, de charger des données et d’exécuter des requêtes sans reconfigurer et redémarrer le serveur. + +## Compression De Données {#data-compression} + +Certains SGBD orientés colonne (InfiniDB CE et MonetDB) n’utilisent pas la compression de données. Cependant, la compression des données joue un rôle clé dans la réalisation d’excellentes performances. + +## Stockage De données Sur Disque {#disk-storage-of-data} + +Garder les données physiquement triées par clé primaire permet d’extraire des données pour ses valeurs spécifiques ou plages de valeurs avec une faible latence, moins de quelques dizaines de millisecondes. Certains SGBD orientés colonne (tels que SAP HANA et Google PowerDrill) ne peuvent fonctionner qu’en RAM. Cette approche encourage l’allocation d’un budget matériel plus important que ce qui est nécessaire pour l’analyse en temps réel. ClickHouse est conçu pour fonctionner sur des disques durs réguliers, ce qui signifie que le coût par Go de stockage de données est faible, mais SSD et RAM supplémentaire sont également entièrement utilisés si disponible. + +## Traitement parallèle Sur Plusieurs cœurs {#parallel-processing-on-multiple-cores} + +Les grandes requêtes sont parallélisées naturellement, en prenant toutes les ressources nécessaires disponibles sur le serveur actuel. + +## Traitement distribué Sur Plusieurs Serveurs {#distributed-processing-on-multiple-servers} + +Presque aucun des SGBD en colonnes mentionnés ci-dessus ne prend en charge le traitement des requêtes distribuées. +Dans ClickHouse, les données peuvent résider sur différents fragments. Chaque fragment peut être un groupe de répliques utilisées pour la tolérance aux pannes. Tous les fragments sont utilisés pour exécuter une requête en parallèle, de façon transparente pour l’utilisateur. + +## Prise En Charge SQL {#sql-support} + +ClickHouse prend en charge un langage de requête déclarative basé sur SQL qui est identique à la norme SQL dans de nombreux cas. +Les requêtes prises en charge incluent les clauses GROUP BY, ORDER BY, les sous-requêtes in FROM, IN et JOIN, ainsi que les sous-requêtes scalaires. +Les sous-requêtes dépendantes et les fonctions de fenêtre ne sont pas prises en charge. + +## Moteur Vectoriel {#vector-engine} + +Les données ne sont pas seulement stockées par des colonnes, mais sont traitées par des vecteurs (parties de colonnes), ce qui permet d’atteindre une efficacité élevée du processeur. + +## Données En Temps réel Des Mises à Jour {#real-time-data-updates} + +ClickHouse prend en charge les tables avec une clé primaire. Pour effectuer rapidement des requêtes sur la plage de la clé primaire, les données sont triées progressivement à l’aide de l’arborescence de fusion. Pour cette raison, les données peuvent être continuellement ajoutées à la table. Pas de verrouillage lorsque de nouvelles données sont ingérés. + +## Index {#index} + +Avoir une donnée physiquement triée par clé primaire permet d’extraire des données pour ses valeurs spécifiques ou plages de valeurs avec une faible latence, moins de quelques dizaines de millisecondes. + +## Convient Pour Les requêtes En Ligne {#suitable-for-online-queries} + +Faible latence signifie que les requêtes peuvent être traitées sans délai et sans essayer de préparer une réponse à l’avance, au même moment pendant le chargement de la page de l’interface utilisateur. En d’autres termes, en ligne. + +## Prise En Charge Des Calculs Approximatifs {#support-for-approximated-calculations} + +ClickHouse offre différentes façons d’échanger la précision pour la performance: + +1. Fonctions d’agrégation pour le calcul approximatif du nombre de valeurs distinctes, de médianes et de quantiles. +2. L’exécution d’une requête basée sur une partie (échantillon) de données et obtenir un pseudo résultat. Dans ce cas, proportionnellement, moins de données sont récupérées à partir du disque. +3. L’exécution d’une agrégation pour un nombre limité de clés aléatoires, au lieu de toutes les clés. Sous certaines conditions pour la distribution des clés dans les données, cela fournit un résultat raisonnablement précis tout en utilisant moins de ressources. + +## Prise En Charge De La réplication Et De l’intégrité Des données {#data-replication-and-data-integrity-support} + +ClickHouse utilise la réplication multi-maître asynchrone. Après avoir été écrit dans n’importe quelle réplique disponible, toutes les répliques restantes récupèrent leur copie en arrière-plan. Le système conserve des données identiques sur différentes répliques. La récupération après la plupart des échecs est effectuée automatiquement ou semi-automatiquement dans les cas complexes. + +Pour plus d’informations, consultez la section [Réplication des données](../engines/table-engines/mergetree-family/replication.md). + +## Caractéristiques De ClickHouse Qui Peuvent être considérées Comme Des inconvénients {#clickhouse-features-that-can-be-considered-disadvantages} + +1. Pas de transactions à part entière. +2. Manque de capacité à modifier ou supprimer des données déjà insérées avec un taux élevé et une faible latence. Des suppressions et des mises à jour par lots sont disponibles pour nettoyer ou modifier les données, par exemple pour [GDPR](https://gdpr-info.eu). +3. L’index clairsemé rend ClickHouse pas si approprié pour les requêtes ponctuelles récupérant des lignes simples par leurs clés. + +[Article Original](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/fr/introduction/distinctive_features.md b/docs/fr/introduction/distinctive_features.md deleted file mode 100644 index 2c825cac85a..00000000000 --- a/docs/fr/introduction/distinctive_features.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 4 -toc_title: "particularit\xE9" ---- - -# Caractéristiques distinctives de ClickHouse {#distinctive-features-of-clickhouse} - -## Vrai SGBD orienté colonne {#true-column-oriented-dbms} - -Dans un vrai SGBD orienté colonne, aucune donnée supplémentaire n'est stockée avec les valeurs. Entre autres choses, cela signifie que les valeurs de longueur constante doivent être prises en charge, pour éviter de stocker leur longueur “number” à côté de ces valeurs. Par exemple, un milliard de valeurs de type UInt8 devrait consommer environ 1 Go non compressé, ou cela affecte fortement l'utilisation du processeur. Il est essentiel de stocker des données de manière compacte (sans “garbage”) même lorsqu'il n'est pas compressé, puisque la vitesse de décompression (utilisation du processeur) dépend principalement du volume de données non compressées. - -Il est à noter car il existe des systèmes qui peuvent stocker des valeurs de différentes colonnes séparément, mais qui ne peuvent pas traiter efficacement les requêtes analytiques en raison de leur optimisation pour d'autres scénarios. Les exemples sont HBase, BigTable, Cassandra et HyperTable. Dans ces systèmes, vous obtiendriez un débit d'environ cent mille lignes par seconde, mais pas des centaines de millions de lignes par seconde. - -Il est également intéressant de noter que ClickHouse est un système de gestion de base de données, pas une seule base de données. ClickHouse permet de créer des tables et des bases de données en cours d'exécution, de charger des données et d'exécuter des requêtes sans reconfigurer et redémarrer le serveur. - -## Compression De Données {#data-compression} - -Certains SGBD orientés colonne (InfiniDB CE et MonetDB) n'utilisent pas la compression de données. Cependant, la compression des données joue un rôle clé dans la réalisation d'excellentes performances. - -## Stockage de données sur disque {#disk-storage-of-data} - -Garder les données physiquement triées par clé primaire permet d'extraire des données pour ses valeurs spécifiques ou plages de valeurs avec une faible latence, moins de quelques dizaines de millisecondes. Certains SGBD orientés colonne (tels que SAP HANA et Google PowerDrill) ne peuvent fonctionner qu'en RAM. Cette approche encourage l'allocation d'un budget matériel plus important que ce qui est nécessaire pour l'analyse en temps réel. ClickHouse est conçu pour fonctionner sur des disques durs réguliers, ce qui signifie que le coût par Go de stockage de données est faible, mais SSD et RAM supplémentaire sont également entièrement utilisés si disponible. - -## Traitement parallèle sur plusieurs cœurs {#parallel-processing-on-multiple-cores} - -Les grandes requêtes sont parallélisées naturellement, en prenant toutes les ressources nécessaires disponibles sur le serveur actuel. - -## Traitement distribué sur plusieurs serveurs {#distributed-processing-on-multiple-servers} - -Presque aucun des SGBD en colonnes mentionnés ci-dessus ne prend en charge le traitement des requêtes distribuées. -Dans ClickHouse, les données peuvent résider sur différents fragments. Chaque fragment peut être un groupe de répliques utilisées pour la tolérance aux pannes. Tous les fragments sont utilisés pour exécuter une requête en parallèle, de façon transparente pour l'utilisateur. - -## Prise en charge SQL {#sql-support} - -ClickHouse prend en charge un langage de requête déclarative basé sur SQL qui est identique à la norme SQL dans de nombreux cas. -Les requêtes prises en charge incluent les clauses GROUP BY, ORDER BY, les sous-requêtes in FROM, IN et JOIN, ainsi que les sous-requêtes scalaires. -Les sous-requêtes dépendantes et les fonctions de fenêtre ne sont pas prises en charge. - -## Moteur Vectoriel {#vector-engine} - -Les données ne sont pas seulement stockées par des colonnes, mais sont traitées par des vecteurs (parties de colonnes), ce qui permet d'atteindre une efficacité élevée du processeur. - -## Données en temps réel des Mises à jour {#real-time-data-updates} - -ClickHouse prend en charge les tables avec une clé primaire. Pour effectuer rapidement des requêtes sur la plage de la clé primaire, les données sont triées progressivement à l'aide de l'arborescence de fusion. Pour cette raison, les données peuvent être continuellement ajoutées à la table. Pas de verrouillage lorsque de nouvelles données sont ingérés. - -## Index {#index} - -Avoir une donnée physiquement triée par clé primaire permet d'extraire des données pour ses valeurs spécifiques ou plages de valeurs avec une faible latence, moins de quelques dizaines de millisecondes. - -## Convient pour les requêtes en ligne {#suitable-for-online-queries} - -Faible latence signifie que les requêtes peuvent être traitées sans délai et sans essayer de préparer une réponse à l'avance, au même moment pendant le chargement de la page de l'interface utilisateur. En d'autres termes, en ligne. - -## Prise en charge des calculs approximatifs {#support-for-approximated-calculations} - -ClickHouse offre différentes façons d'échanger la précision pour la performance: - -1. Fonctions d'agrégation pour le calcul approximatif du nombre de valeurs distinctes, de médianes et de quantiles. -2. L'exécution d'une requête basée sur une partie (échantillon) de données et obtenir un pseudo résultat. Dans ce cas, proportionnellement, moins de données sont récupérées à partir du disque. -3. L'exécution d'une agrégation pour un nombre limité de clés aléatoires, au lieu de toutes les clés. Sous certaines conditions pour la distribution des clés dans les données, cela fournit un résultat raisonnablement précis tout en utilisant moins de ressources. - -## Prise en charge de la réplication et de l'intégrité des données {#data-replication-and-data-integrity-support} - -ClickHouse utilise la réplication multi-maître asynchrone. Après avoir été écrit dans n'importe quelle réplique disponible, toutes les répliques restantes récupèrent leur copie en arrière-plan. Le système conserve des données identiques sur différentes répliques. La récupération après la plupart des échecs est effectuée automatiquement ou semi-automatiquement dans les cas complexes. - -Pour plus d'informations, consultez la section [Réplication des données](../engines/table_engines/mergetree_family/replication.md). - -## Caractéristiques de ClickHouse qui peuvent être considérées comme des inconvénients {#clickhouse-features-that-can-be-considered-disadvantages} - -1. Pas de transactions à part entière. -2. Manque de capacité à modifier ou supprimer des données déjà insérées avec un taux élevé et une faible latence. Des suppressions et des mises à jour par lots sont disponibles pour nettoyer ou modifier les données, par exemple pour [GDPR](https://gdpr-info.eu). -3. L'index clairsemé rend ClickHouse pas si approprié pour les requêtes ponctuelles récupérant des lignes simples par leurs clés. - -[Article Original](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/fr/introduction/history.md b/docs/fr/introduction/history.md index f40ae1eda52..707c3439e56 100644 --- a/docs/fr/introduction/history.md +++ b/docs/fr/introduction/history.md @@ -7,16 +7,16 @@ toc_title: Histoire # Histoire De ClickHouse {#clickhouse-history} -ClickHouse a été développé initialement au pouvoir [Yandex.Metrica](https://metrica.yandex.com/), [la deuxième plus grande plateforme d'analyse dans le monde](http://w3techs.com/technologies/overview/traffic_analysis/all) et continue à être le composant de base de ce système. Avec plus de 13 Billions d'enregistrements dans la base de données et plus de 20 milliards d'événements par jour, ClickHouse permet de générer des rapports personnalisés à la volée directement à partir de données non agrégées. Cet article couvre brièvement les objectifs de ClickHouse dans les premiers stades de son développement. +ClickHouse a été développé initialement au pouvoir [Yandex.Metrica](https://metrica.yandex.com/), [la deuxième plus grande plateforme d’analyse dans le monde](http://w3techs.com/technologies/overview/traffic_analysis/all) et continue à être le composant de base de ce système. Avec plus de 13 Billions d’enregistrements dans la base de données et plus de 20 milliards d’événements par jour, ClickHouse permet de générer des rapports personnalisés à la volée directement à partir de données non agrégées. Cet article couvre brièvement les objectifs de ClickHouse dans les premiers stades de son développement. -Yandex.Metrica construit des rapports personnalisés à la volée en fonction des hits et des sessions, avec des segments arbitraires définis par l'utilisateur. Faisant souvent requiert la construction d'agrégats complexes, tels que le nombre d'utilisateurs uniques. De nouvelles données pour la création d'un rapport arrivent en temps réel. +Yandex.Metrica construit des rapports personnalisés à la volée en fonction des hits et des sessions, avec des segments arbitraires définis par l’utilisateur. Faisant souvent requiert la construction d’agrégats complexes, tels que le nombre d’utilisateurs uniques. De nouvelles données pour la création d’un rapport arrivent en temps réel. -En avril 2014, Yandex.Metrica suivait environ 12 milliards d'événements (pages vues et clics) par jour. Tous ces événements doivent être stockés à créer des rapports personnalisés. Une seule requête peut exiger de la numérisation de millions de lignes en quelques centaines de millisecondes, ou des centaines de millions de lignes en quelques secondes. +En avril 2014, Yandex.Metrica suivait environ 12 milliards d’événements (pages vues et clics) par jour. Tous ces événements doivent être stockés à créer des rapports personnalisés. Une seule requête peut exiger de la numérisation de millions de lignes en quelques centaines de millisecondes, ou des centaines de millions de lignes en quelques secondes. -## Utilisation dans Yandex.Metrica et autres Services Yandex {#usage-in-yandex-metrica-and-other-yandex-services} +## Utilisation Dans Yandex.Metrica Et Autres Services Yandex {#usage-in-yandex-metrica-and-other-yandex-services} ClickHouse sert à des fins multiples dans Yandex.Metrica. -Sa tâche principale est de créer des rapports en mode en ligne en utilisant des données non agrégées. Il utilise un cluster de 374 serveurs qui stockent plus de 20,3 billions de lignes dans la base de données. Le volume de données compressées est d'environ 2 PB, sans tenir compte des doublons et des répliques. Le volume de données non compressées (au format TSV) serait d'environ 17 PB. +Sa tâche principale est de créer des rapports en mode en ligne en utilisant des données non agrégées. Il utilise un cluster de 374 serveurs qui stockent plus de 20,3 billions de lignes dans la base de données. Le volume de données compressées est d’environ 2 PB, sans tenir compte des doublons et des répliques. Le volume de données non compressées (au format TSV) serait d’environ 17 PB. ClickHouse joue également un rôle clé dans les processus suivants: @@ -24,33 +24,33 @@ ClickHouse joue également un rôle clé dans les processus suivants: - Traitement des données intermédiaires. - Création de rapports globaux avec Analytics. - Exécution de requêtes pour le débogage du Yandex.Moteur Metrica. -- Analyse des journaux de L'API et de l'interface utilisateur. +- Analyse des journaux de L’API et de l’interface utilisateur. -De nos jours, il existe plusieurs dizaines d'installations ClickHouse dans D'autres services et départements Yandex: recherche verticale, E-commerce, Publicité, business analytics, développement mobile, Services personnels et autres. +De nos jours, il existe plusieurs dizaines d’installations ClickHouse dans D’autres services et départements Yandex: recherche verticale, E-commerce, Publicité, business analytics, développement mobile, Services personnels et autres. -## Données agrégées et non agrégées {#aggregated-and-non-aggregated-data} +## Données agrégées Et Non agrégées {#aggregated-and-non-aggregated-data} Il y a une opinion répandue que pour calculer efficacement les statistiques, vous devez agréger les données car cela réduit le volume de données. -Mais l'agrégation de données est livré avec beaucoup de limitations: +Mais l’agrégation de données est livré avec beaucoup de limitations: -- Vous devez disposer d'une liste prédéfinie des rapports requis. -- L'utilisateur ne peut pas créer de rapports personnalisés. -- Lors de l'agrégation sur un grand nombre de clés distinctes, le volume de données est à peine réduit, l'agrégation est donc inutile. -- Pour un grand nombre de rapports, il y a trop de variations d'agrégation (explosion combinatoire). -- Lors de l'agrégation de clés avec une cardinalité élevée (telles que les URL), le volume de données n'est pas réduit de beaucoup (moins de deux fois). -- Pour cette raison, le volume de données avec l'agrégation peut augmenter au lieu de diminuer. +- Vous devez disposer d’une liste prédéfinie des rapports requis. +- L’utilisateur ne peut pas créer de rapports personnalisés. +- Lors de l’agrégation sur un grand nombre de clés distinctes, le volume de données est à peine réduit, l’agrégation est donc inutile. +- Pour un grand nombre de rapports, il y a trop de variations d’agrégation (explosion combinatoire). +- Lors de l’agrégation de clés avec une cardinalité élevée (telles que les URL), le volume de données n’est pas réduit de beaucoup (moins de deux fois). +- Pour cette raison, le volume de données avec l’agrégation peut augmenter au lieu de diminuer. - Les utilisateurs ne voient pas tous les rapports que nous générons pour eux. Une grande partie de ces calculs est inutile. -- L'intégrité logique des données peut être violée pour diverses agrégations. +- L’intégrité logique des données peut être violée pour diverses agrégations. -Si nous n'agrégeons rien et travaillons avec des données non agrégées, cela pourrait réduire le volume des calculs. +Si nous n’agrégeons rien et travaillons avec des données non agrégées, cela pourrait réduire le volume des calculs. -Cependant, avec l'agrégation, une partie importante du travail est déconnectée et achevée relativement calmement. En revanche, les calculs en ligne nécessitent un calcul aussi rapide que possible, car l'utilisateur attend le résultat. +Cependant, avec l’agrégation, une partie importante du travail est déconnectée et achevée relativement calmement. En revanche, les calculs en ligne nécessitent un calcul aussi rapide que possible, car l’utilisateur attend le résultat. -Yandex.Metrica dispose d'un système spécialisé d'agrégation des données appelé Metrage, qui a été utilisé pour la majorité des rapports. +Yandex.Metrica dispose d’un système spécialisé d’agrégation des données appelé Metrage, qui a été utilisé pour la majorité des rapports. À partir de 2009, Yandex.Metrica a également utilisé une base de données OLAP spécialisée pour les données non agrégées appelée OLAPServer, qui était auparavant utilisée pour le générateur de rapports. -OLAPServer a bien fonctionné pour les données non agrégées, mais il avait de nombreuses restrictions qui ne lui permettaient pas d'être utilisé pour tous les rapports comme souhaité. Ceux-ci comprenaient le manque de prise en charge des types de données (uniquement des nombres) et l'incapacité de mettre à jour progressivement les données en temps réel (cela ne pouvait être fait qu'en réécrivant les données quotidiennement). OLAPServer n'est pas un SGBD, mais une base de données spécialisée. +OLAPServer a bien fonctionné pour les données non agrégées, mais il avait de nombreuses restrictions qui ne lui permettaient pas d’être utilisé pour tous les rapports comme souhaité. Ceux-ci comprenaient le manque de prise en charge des types de données (uniquement des nombres) et l’incapacité de mettre à jour progressivement les données en temps réel (cela ne pouvait être fait qu’en réécrivant les données quotidiennement). OLAPServer n’est pas un SGBD, mais une base de données spécialisée. -L'objectif initial de ClickHouse était de supprimer les limites D'OLAPServer et de résoudre le problème du travail avec des données non agrégées pour tous les rapports, mais au fil des ans, il est devenu un système de gestion de base de données polyvalent adapté à un large éventail de tâches analytiques. +L’objectif initial de ClickHouse était de supprimer les limites D’OLAPServer et de résoudre le problème du travail avec des données non agrégées pour tous les rapports, mais au fil des ans, il est devenu un système de gestion de base de données polyvalent adapté à un large éventail de tâches analytiques. [Article Original](https://clickhouse.tech/docs/en/introduction/history/) diff --git a/docs/fr/introduction/performance.md b/docs/fr/introduction/performance.md index 3e94830d7c0..0c0852a961d 100644 --- a/docs/fr/introduction/performance.md +++ b/docs/fr/introduction/performance.md @@ -7,26 +7,26 @@ toc_title: Performance # Performance {#performance} -Selon les résultats des tests internes chez Yandex, ClickHouse affiche les meilleures performances (à la fois le débit le plus élevé pour les requêtes longues et la latence la plus faible pour les requêtes courtes) pour des scénarios d'exploitation comparables parmi les systèmes de sa classe disponibles pour les tests. Vous pouvez afficher les résultats du test sur un [page séparée](https://clickhouse.tech/benchmark/dbms/). +Selon les résultats des tests internes chez Yandex, ClickHouse affiche les meilleures performances (à la fois le débit le plus élevé pour les requêtes longues et la latence la plus faible pour les requêtes courtes) pour des scénarios d’exploitation comparables parmi les systèmes de sa classe disponibles pour les tests. Vous pouvez afficher les résultats du test sur un [page séparée](https://clickhouse.tech/benchmark/dbms/). De nombreux points de repère indépendants sont arrivés à des conclusions similaires. Ils ne sont pas difficiles à trouver en utilisant une recherche sur internet, ou vous pouvez voir [notre petite collection de liens](https://clickhouse.tech/#independent-benchmarks). -## Débit pour une seule grande requête {#throughput-for-a-single-large-query} +## Débit Pour Une Seule Grande requête {#throughput-for-a-single-large-query} -Le débit peut être mesuré en lignes par seconde ou en mégaoctets par seconde. Si les données sont placées dans le cache de page, une requête pas trop complexe est traitée sur du matériel moderne à une vitesse d'environ 2-10 GB / s de données non compressées sur un seul serveur (pour les cas les plus simples, la vitesse peut atteindre 30 GB/s). Si les données ne sont pas placées dans le cache de page, la vitesse dépend du sous-système de disque et du taux de compression des données. Par exemple, si le sous-système de disque permet de lire des données à 400 Mo/s et que le taux de compression des données est de 3, la vitesse devrait être d'environ 1,2 Go/s. Pour obtenir la vitesse en lignes par seconde, divisez la vitesse en octets par seconde par la taille totale des colonnes utilisées dans la requête. Par exemple, si 10 octets de colonnes sont extraites, la vitesse devrait être d'environ 100 à 200 millions de lignes par seconde. +Le débit peut être mesuré en lignes par seconde ou en mégaoctets par seconde. Si les données sont placées dans le cache de page, une requête pas trop complexe est traitée sur du matériel moderne à une vitesse d’environ 2-10 GB / s de données non compressées sur un seul serveur (pour les cas les plus simples, la vitesse peut atteindre 30 GB/s). Si les données ne sont pas placées dans le cache de page, la vitesse dépend du sous-système de disque et du taux de compression des données. Par exemple, si le sous-système de disque permet de lire des données à 400 Mo/s et que le taux de compression des données est de 3, la vitesse devrait être d’environ 1,2 Go/s. Pour obtenir la vitesse en lignes par seconde, divisez la vitesse en octets par seconde par la taille totale des colonnes utilisées dans la requête. Par exemple, si 10 octets de colonnes sont extraites, la vitesse devrait être d’environ 100 à 200 millions de lignes par seconde. -La vitesse de traitement augmente presque linéairement pour le traitement distribué, mais seulement si le nombre de lignes résultant de l'agrégation ou du tri n'est pas trop important. +La vitesse de traitement augmente presque linéairement pour le traitement distribué, mais seulement si le nombre de lignes résultant de l’agrégation ou du tri n’est pas trop important. ## Latence Lors Du Traitement Des Requêtes Courtes {#latency-when-processing-short-queries} -Si une requête utilise une clé primaire et ne sélectionne pas trop de colonnes et de lignes à traiter (des centaines de milliers), Vous pouvez vous attendre à moins de 50 millisecondes de latence (un seul chiffre de millisecondes dans le meilleur des cas) si les données sont placées dans le cache de page. Sinon, la latence est principalement dominée par le nombre de recherches. Si vous utilisez des lecteurs de disque rotatifs, pour un système qui n'est pas surchargé, la latence peut être estimée avec cette formule: `seek time (10 ms) * count of columns queried * count of data parts`. +Si une requête utilise une clé primaire et ne sélectionne pas trop de colonnes et de lignes à traiter (des centaines de milliers), Vous pouvez vous attendre à moins de 50 millisecondes de latence (un seul chiffre de millisecondes dans le meilleur des cas) si les données sont placées dans le cache de page. Sinon, la latence est principalement dominée par le nombre de recherches. Si vous utilisez des lecteurs de disque rotatifs, pour un système qui n’est pas surchargé, la latence peut être estimée avec cette formule: `seek time (10 ms) * count of columns queried * count of data parts`. -## Débit lors du traitement d'une grande quantité de requêtes courtes {#throughput-when-processing-a-large-quantity-of-short-queries} +## Débit Lors Du Traitement d’une Grande quantité De requêtes Courtes {#throughput-when-processing-a-large-quantity-of-short-queries} -Dans les mêmes conditions, ClickHouse peut traiter plusieurs centaines de requêtes par seconde sur un seul serveur (jusqu'à plusieurs milliers dans le meilleur des cas). Étant donné que ce scénario n'est pas typique pour les SGBD analytiques, nous vous recommandons d'attendre un maximum de 100 requêtes par seconde. +Dans les mêmes conditions, ClickHouse peut traiter plusieurs centaines de requêtes par seconde sur un seul serveur (jusqu’à plusieurs milliers dans le meilleur des cas). Étant donné que ce scénario n’est pas typique pour les SGBD analytiques, nous vous recommandons d’attendre un maximum de 100 requêtes par seconde. -## Performances Lors De L'Insertion De Données {#performance-when-inserting-data} +## Performances Lors De L’Insertion De Données {#performance-when-inserting-data} -Nous vous recommandons d'insérer des données dans des paquets d'au moins 1000 lignes, ou pas plus qu'une seule demande par seconde. Lors de l'insertion dans une table MergeTree à partir d'un dump séparé par des tabulations, la vitesse d'insertion peut être de 50 à 200 Mo/s. Si les lignes insérées ont une taille d'environ 1 KO, La vitesse sera de 50 000 à 200 000 lignes par seconde. Si les lignes sont petites, les performances peuvent être plus élevées en lignes par seconde (sur les données du système de bannière -`>` 500 000 lignes par seconde; sur les données de Graphite -`>` 1 000 000 lignes par seconde). Pour améliorer les performances, vous pouvez effectuer plusieurs requêtes D'insertion en parallèle, qui s'adaptent linéairement. +Nous vous recommandons d’insérer des données dans des paquets d’au moins 1000 lignes, ou pas plus qu’une seule demande par seconde. Lors de l’insertion dans une table MergeTree à partir d’un dump séparé par des tabulations, la vitesse d’insertion peut être de 50 à 200 Mo/s. Si les lignes insérées ont une taille d’environ 1 KO, La vitesse sera de 50 000 à 200 000 lignes par seconde. Si les lignes sont petites, les performances peuvent être plus élevées en lignes par seconde (sur les données du système de bannière -`>` 500 000 lignes par seconde; sur les données de Graphite -`>` 1 000 000 lignes par seconde). Pour améliorer les performances, vous pouvez effectuer plusieurs requêtes D’insertion en parallèle, qui s’adaptent linéairement. [Article Original](https://clickhouse.tech/docs/en/introduction/performance/) diff --git a/docs/fr/operations/access-rights.md b/docs/fr/operations/access-rights.md new file mode 100644 index 00000000000..8e0429be454 --- /dev/null +++ b/docs/fr/operations/access-rights.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 48 +toc_title: "Les Droits D'Acc\xE8s" +--- + +# Les Droits D’Accès {#access-rights} + +Les utilisateurs et les droits d’accès sont configurés dans la configuration utilisateur. Ce n’est généralement `users.xml`. + +Les utilisateurs sont enregistrés dans le `users` section. Voici un fragment de la `users.xml` fichier: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + + test + + + +``` + +Vous pouvez voir une déclaration de deux utilisateurs: `default`et`web`. Nous avons ajouté l’ `web` utilisateur séparément. + +Le `default` l’utilisateur est choisi dans les cas où le nom d’utilisateur n’est pas passé. Le `default` l’utilisateur est également utilisé pour le traitement des requêtes distribuées, si la configuration du serveur ou du cluster `user` et `password` (voir la section sur les [Distribué](../engines/table-engines/special/distributed.md) moteur). + +The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. + +Le mot de passe est spécifié en texte clair (non recommandé) ou en SHA-256. Le hash n’est pas salé. À cet égard, vous ne devez pas considérer ces mots de passe comme assurant la sécurité contre les attaques malveillantes potentielles. Au contraire, ils sont nécessaires pour la protection contre les employés. + +Une liste de réseaux est précisé que l’accès est autorisé à partir. Dans cet exemple, la liste des réseaux pour les utilisateurs est chargé à partir d’un fichier séparé (`/etc/metrika.xml`) contenant les `networks` substitution. Voici un fragment de: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +Vous pouvez définir cette liste de réseaux directement dans `users.xml` ou dans un fichier dans le `users.d` répertoire (pour plus d’informations, consultez la section “[Fichiers de Configuration](configuration-files.md#configuration_files)”). + +La configuration comprend des commentaires expliquant comment ouvrir l’accès de partout. + +Pour une utilisation en production, spécifiez uniquement `ip` (adresses IP et leurs masques), depuis l’utilisation `host` et `hoost_regexp` peut causer une latence supplémentaire. + +Ensuite, le profil des paramètres utilisateur est spécifié (voir la section “[Les paramètres des profils](settings/settings-profiles.md)”. Vous pouvez spécifier le profil par défaut, `default'`. Le profil peut avoir n’importe quel nom. Vous pouvez spécifier le même profil pour différents utilisateurs. La chose la plus importante que vous pouvez écrire dans les paramètres de profil `readonly=1` qui assure un accès en lecture seule. Spécifiez ensuite le quota à utiliser (voir la section “[Quota](quotas.md#quotas)”). Vous pouvez spécifier le quota par défaut: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. + +Dans le facultatif `` section, vous pouvez également spécifier une liste de bases de données que l’utilisateur peut accéder. Par défaut, toutes les bases de données sont disponibles pour l’utilisateur. Vous pouvez spécifier l’ `default` la base de données. Dans ce cas, l’utilisateur recevra l’accès à la base de données par défaut. + +Dans le facultatif `` section, vous pouvez également spécifier une liste de dictionnaires que l’utilisateur peut accéder. Par défaut, tous les dictionnaires sont disponibles pour l’utilisateur. + +L’accès à la `system` la base de données est toujours autorisée (puisque cette base de données est utilisée pour traiter les requêtes). + +L’utilisateur peut obtenir une liste de toutes les bases de données et tables en utilisant `SHOW` requêtes ou tables système, même si l’accès aux bases de données individuelles n’est pas autorisé. + +Accès de base de données n’est pas liée à la [ReadOnly](settings/permissions-for-queries.md#settings_readonly) paramètre. Vous ne pouvez pas accorder un accès complet à une base de données et `readonly` l’accès à un autre. + +[Article Original](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/fr/operations/access_rights.md b/docs/fr/operations/access_rights.md deleted file mode 100644 index e01f8428209..00000000000 --- a/docs/fr/operations/access_rights.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 48 -toc_title: "Les Droits D'Acc\xE8s" ---- - -# Les Droits D'Accès {#access-rights} - -Les utilisateurs et les droits d'accès sont configurés dans la configuration utilisateur. Ce n'est généralement `users.xml`. - -Les utilisateurs sont enregistrés dans le `users` section. Voici un fragment de la `users.xml` fichier: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - - test - - - -``` - -Vous pouvez voir une déclaration de deux utilisateurs: `default`et`web`. Nous avons ajouté l' `web` utilisateur séparément. - -Le `default` l'utilisateur est choisi dans les cas où le nom d'utilisateur n'est pas passé. Le `default` l'utilisateur est également utilisé pour le traitement des requêtes distribuées, si la configuration du serveur ou du cluster `user` et `password` (voir la section sur les [Distribué](../engines/table_engines/special/distributed.md) moteur). - -The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. - -Le mot de passe est spécifié en texte clair (non recommandé) ou en SHA-256. Le hash n'est pas salé. À cet égard, vous ne devez pas considérer ces mots de passe comme assurant la sécurité contre les attaques malveillantes potentielles. Au contraire, ils sont nécessaires pour la protection contre les employés. - -Une liste de réseaux est précisé que l'accès est autorisé à partir. Dans cet exemple, la liste des réseaux pour les utilisateurs est chargé à partir d'un fichier séparé (`/etc/metrika.xml`) contenant les `networks` substitution. Voici un fragment de: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -Vous pouvez définir cette liste de réseaux directement dans `users.xml` ou dans un fichier dans le `users.d` répertoire (pour plus d'informations, consultez la section “[Fichiers de Configuration](configuration_files.md#configuration_files)”). - -La configuration comprend des commentaires expliquant comment ouvrir l'accès de partout. - -Pour une utilisation en production, spécifiez uniquement `ip` (adresses IP et leurs masques), depuis l'utilisation `host` et `hoost_regexp` peut causer une latence supplémentaire. - -Ensuite, le profil des paramètres utilisateur est spécifié (voir la section “[Les paramètres des profils](settings/settings_profiles.md)”. Vous pouvez spécifier le profil par défaut, `default'`. Le profil peut avoir n'importe quel nom. Vous pouvez spécifier le même profil pour différents utilisateurs. La chose la plus importante que vous pouvez écrire dans les paramètres de profil `readonly=1` qui assure un accès en lecture seule. Spécifiez ensuite le quota à utiliser (voir la section “[Quota](quotas.md#quotas)”). Vous pouvez spécifier le quota par défaut: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. - -Dans le facultatif `` section, vous pouvez également spécifier une liste de bases de données que l'utilisateur peut accéder. Par défaut, toutes les bases de données sont disponibles pour l'utilisateur. Vous pouvez spécifier l' `default` la base de données. Dans ce cas, l'utilisateur recevra l'accès à la base de données par défaut. - -Dans le facultatif `` section, vous pouvez également spécifier une liste de dictionnaires que l'utilisateur peut accéder. Par défaut, tous les dictionnaires sont disponibles pour l'utilisateur. - -L'accès à la `system` la base de données est toujours autorisée (puisque cette base de données est utilisée pour traiter les requêtes). - -L'utilisateur peut obtenir une liste de toutes les bases de données et tables en utilisant `SHOW` requêtes ou tables système, même si l'accès aux bases de données individuelles n'est pas autorisé. - -Accès de base de données n'est pas liée à la [ReadOnly](settings/permissions_for_queries.md#settings_readonly) paramètre. Vous ne pouvez pas accorder un accès complet à une base de données et `readonly` l'accès à un autre. - -[Article Original](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/fr/operations/backup.md b/docs/fr/operations/backup.md index 6d66e5a609c..36e42e150b4 100644 --- a/docs/fr/operations/backup.md +++ b/docs/fr/operations/backup.md @@ -7,22 +7,22 @@ toc_title: "La Sauvegarde Des Donn\xE9es" # La Sauvegarde Des Données {#data-backup} -Alors [réplication](../engines/table_engines/mergetree_family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [vous ne pouvez pas simplement supprimer des tables avec un moteur de type MergeTree contenant plus de 50 Go de données](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Toutefois, ces garanties ne couvrent pas tous les cas possibles et peuvent être contournés. +Alors [réplication](../engines/table-engines/mergetree-family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [vous ne pouvez pas simplement supprimer des tables avec un moteur de type MergeTree contenant plus de 50 Go de données](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Toutefois, ces garanties ne couvrent pas tous les cas possibles et peuvent être contournés. -Afin d'atténuer efficacement les erreurs humaines possibles, vous devez préparer soigneusement une stratégie de sauvegarde et de restauration de vos données **préalablement**. +Afin d’atténuer efficacement les erreurs humaines possibles, vous devez préparer soigneusement une stratégie de sauvegarde et de restauration de vos données **préalablement**. -Chaque entreprise a différentes ressources disponibles et les exigences de l'entreprise, donc il n'y a pas de solution universelle pour les sauvegardes et restaurations ClickHouse qui s'adaptera à toutes les situations. Ce qui fonctionne pour un gigaoctet de données ne fonctionnera probablement pas pour des dizaines de pétaoctets. Il existe une variété d'approches possibles avec leurs propres avantages et inconvénients, qui sera discuté ci-dessous. C'est une bonne idée d'utiliser plusieurs approches au lieu d'un seul, afin de compenser leurs lacunes. +Chaque entreprise a différentes ressources disponibles et les exigences de l’entreprise, donc il n’y a pas de solution universelle pour les sauvegardes et restaurations ClickHouse qui s’adaptera à toutes les situations. Ce qui fonctionne pour un gigaoctet de données ne fonctionnera probablement pas pour des dizaines de pétaoctets. Il existe une variété d’approches possibles avec leurs propres avantages et inconvénients, qui sera discuté ci-dessous. C’est une bonne idée d’utiliser plusieurs approches au lieu d’un seul, afin de compenser leurs lacunes. !!! note "Note" - Gardez à l'esprit que si vous avez sauvegardé quelque chose et que vous n'avez jamais essayé de le restaurer, il est probable que la restauration ne fonctionnera pas correctement lorsque vous en avez réellement besoin (ou du moins cela prendra plus de temps que ce que les entreprises peuvent tolérer). Donc, quelle que soit l'approche de sauvegarde que vous choisissez, assurez-vous d'automatiser le processus de restauration et de le pratiquer sur un cluster clickhouse de rechange régulièrement. + Gardez à l’esprit que si vous avez sauvegardé quelque chose et que vous n’avez jamais essayé de le restaurer, il est probable que la restauration ne fonctionnera pas correctement lorsque vous en avez réellement besoin (ou du moins cela prendra plus de temps que ce que les entreprises peuvent tolérer). Donc, quelle que soit l’approche de sauvegarde que vous choisissez, assurez-vous d’automatiser le processus de restauration et de le pratiquer sur un cluster clickhouse de rechange régulièrement. ## Dupliquer Les Données Sources Ailleurs {#duplicating-source-data-somewhere-else} -Souvent, les données qui sont ingérées dans ClickHouse sont livrées via une sorte de file d'attente persistante, telle que [Apache Kafka](https://kafka.apache.org). Dans ce cas, il est possible de configurer un ensemble supplémentaire d'abonnés qui liront le même flux de données pendant qu'il est écrit dans ClickHouse et le stockeront dans un stockage à froid quelque part. La plupart des entreprises ont déjà un stockage à froid recommandé par défaut, qui pourrait être un magasin d'objets ou un système de fichiers distribué comme [HDFS](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html). +Souvent, les données qui sont ingérées dans ClickHouse sont livrées via une sorte de file d’attente persistante, telle que [Apache Kafka](https://kafka.apache.org). Dans ce cas, il est possible de configurer un ensemble supplémentaire d’abonnés qui liront le même flux de données pendant qu’il est écrit dans ClickHouse et le stockeront dans un stockage à froid quelque part. La plupart des entreprises ont déjà un stockage à froid recommandé par défaut, qui pourrait être un magasin d’objets ou un système de fichiers distribué comme [HDFS](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html). ## Instantanés Du Système De Fichiers {#filesystem-snapshots} -Certains systèmes de fichiers locaux fournissent des fonctionnalités d'instantané (par exemple, [ZFS](https://en.wikipedia.org/wiki/ZFS)), mais ils pourraient ne pas être le meilleur choix pour servir les requêtes actives. Une solution possible consiste à créer des répliques supplémentaires avec ce type de système de fichiers et à les exclure du [Distribué](../engines/table_engines/special/distributed.md) les tables qui sont utilisés pour `SELECT` requête. Les instantanés sur ces répliques seront hors de portée des requêtes qui modifient les données. En prime, ces répliques pourraient avoir des configurations matérielles spéciales avec plus de disques attachés par serveur, ce qui serait rentable. +Certains systèmes de fichiers locaux fournissent des fonctionnalités d’instantané (par exemple, [ZFS](https://en.wikipedia.org/wiki/ZFS)), mais ils pourraient ne pas être le meilleur choix pour servir les requêtes actives. Une solution possible consiste à créer des répliques supplémentaires avec ce type de système de fichiers et à les exclure du [Distribué](../engines/table-engines/special/distributed.md) les tables qui sont utilisés pour `SELECT` requête. Les instantanés sur ces répliques seront hors de portée des requêtes qui modifient les données. En prime, ces répliques pourraient avoir des configurations matérielles spéciales avec plus de disques attachés par serveur, ce qui serait rentable. ## clickhouse-copieur {#clickhouse-copier} @@ -32,9 +32,9 @@ Pour de plus petits volumes de données, un simple `INSERT INTO ... SELECT ...` ## Manipulations Avec Des Pièces {#manipulations-with-parts} -ClickHouse permet d'utiliser le `ALTER TABLE ... FREEZE PARTITION ...` requête pour créer une copie locale des partitions de table. Ceci est implémenté en utilisant des liens durs vers le `/var/lib/clickhouse/shadow/` dossier, donc il ne consomme généralement pas d'espace disque supplémentaire pour les anciennes données. Les copies créées des fichiers ne sont pas gérées par clickhouse server, vous pouvez donc les laisser là: vous aurez une sauvegarde simple qui ne nécessite aucun système externe supplémentaire, mais elle sera toujours sujette à des problèmes matériels. Pour cette raison, il est préférable de les copier à distance vers un autre emplacement, puis de supprimer les copies locales. Les systèmes de fichiers distribués et les magasins d'objets sont toujours une bonne option pour cela, mais les serveurs de fichiers attachés normaux avec une capacité suffisante peuvent également fonctionner (dans ce cas, le transfert se fera via le système de fichiers réseau ou peut-être [rsync](https://en.wikipedia.org/wiki/Rsync)). +ClickHouse permet d’utiliser le `ALTER TABLE ... FREEZE PARTITION ...` requête pour créer une copie locale des partitions de table. Ceci est implémenté en utilisant des liens durs vers le `/var/lib/clickhouse/shadow/` dossier, donc il ne consomme généralement pas d’espace disque supplémentaire pour les anciennes données. Les copies créées des fichiers ne sont pas gérées par clickhouse server, vous pouvez donc les laisser là: vous aurez une sauvegarde simple qui ne nécessite aucun système externe supplémentaire, mais elle sera toujours sujette à des problèmes matériels. Pour cette raison, il est préférable de les copier à distance vers un autre emplacement, puis de supprimer les copies locales. Les systèmes de fichiers distribués et les magasins d’objets sont toujours une bonne option pour cela, mais les serveurs de fichiers attachés normaux avec une capacité suffisante peuvent également fonctionner (dans ce cas, le transfert se fera via le système de fichiers réseau ou peut-être [rsync](https://en.wikipedia.org/wiki/Rsync)). -Pour plus d'informations sur les requêtes liées aux manipulations de [Modifier la documentation](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +Pour plus d’informations sur les requêtes liées aux manipulations de [Modifier la documentation](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). Un outil tiers est disponible pour automatiser cette approche: [clickhouse-sauvegarde](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/fr/operations/configuration-files.md b/docs/fr/operations/configuration-files.md new file mode 100644 index 00000000000..82ffbcd9ea7 --- /dev/null +++ b/docs/fr/operations/configuration-files.md @@ -0,0 +1,57 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 50 +toc_title: Fichiers De Configuration +--- + +# Fichiers De Configuration {#configuration_files} + +ClickHouse prend en charge la gestion de la configuration multi-fichiers. Le fichier de configuration du serveur principal est `/etc/clickhouse-server/config.xml`. Les autres fichiers doivent être dans le `/etc/clickhouse-server/config.d` répertoire. + +!!! note "Note" + Tous les fichiers de configuration doivent être au format XML. Aussi, ils doivent avoir le même élément racine, généralement ``. + +Certains paramètres spécifiés dans le fichier de configuration principal peuvent être remplacés dans d’autres fichiers de configuration. Le `replace` ou `remove` les attributs peuvent être spécifiés pour les éléments de ces fichiers de configuration. + +Si ni l’un ni l’autre n’est spécifié, il combine le contenu des éléments de manière récursive, remplaçant les valeurs des enfants en double. + +Si `replace` est spécifié, il remplace l’élément entier par celui spécifié. + +Si `remove` est spécifié, il supprime l’élément. + +La configuration peut également définir “substitutions”. Si un élément a le `incl` attribut, la substitution correspondante du fichier sera utilisée comme valeur. Par défaut, le chemin d’accès au fichier avec des substitutions est `/etc/metrika.xml`. Ceci peut être changé dans le [include\_from](server-configuration-parameters/settings.md#server_configuration_parameters-include_from) élément dans la configuration du serveur. Les valeurs de substitution sont spécifiées dans `/yandex/substitution_name` les éléments de ce fichier. Si une substitution spécifiée dans `incl` n’existe pas, il est enregistré dans le journal. Pour empêcher ClickHouse de consigner les substitutions manquantes, spécifiez `optional="true"` attribut (par exemple, les paramètres de [macro](server-configuration-parameters/settings.md)). + +Les Substitutions peuvent également être effectuées à partir de ZooKeeper. Pour ce faire, spécifiez l’attribut `from_zk = "/path/to/node"`. La valeur de l’élément est remplacé par le contenu du noeud au `/path/to/node` dans ZooKeeper. Vous pouvez également placer un sous-arbre XML entier sur le nœud ZooKeeper et il sera entièrement inséré dans l’élément source. + +Le `config.xml` le fichier peut spécifier une configuration distincte avec les paramètres utilisateur, les profils et les quotas. Le chemin relatif à cette configuration est défini dans `users_config` élément. Par défaut, il est `users.xml`. Si `users_config` est omis, les paramètres utilisateur, les profils et les quotas sont `config.xml`. + +La configuration des utilisateurs peut être divisée en fichiers séparés similaires à `config.xml` et `config.d/`. +Nom du répertoire est défini comme `users_config` sans `.xml` postfix concaténé avec `.d`. +Répertoire `users.d` est utilisé par défaut, comme `users_config` par défaut `users.xml`. +Par exemple, vous pouvez avoir séparé fichier de configuration pour chaque utilisateur comme ceci: + +``` bash +$ cat /etc/clickhouse-server/users.d/alice.xml +``` + +``` xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +Pour chaque fichier de configuration, le serveur génère également `file-preprocessed.xml` les fichiers lors du démarrage. Ces fichiers contiennent toutes les remplacements et des remplacements, et ils sont destinés à l’usage informatif. Si des substitutions ZooKeeper ont été utilisées dans les fichiers de configuration mais que ZooKeeper n’est pas disponible au démarrage du serveur, le serveur charge la configuration à partir du fichier prétraité. + +Le serveur suit les changements dans les fichiers de configuration, ainsi que les fichiers et les nœuds ZooKeeper utilisés lors des substitutions et des remplacements, et recharge les paramètres pour les utilisateurs et les clusters à la volée. Cela signifie que vous pouvez modifier le cluster, les utilisateurs et leurs paramètres sans redémarrer le serveur. + +[Article Original](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/fr/operations/configuration_files.md b/docs/fr/operations/configuration_files.md deleted file mode 100644 index 0322551ab63..00000000000 --- a/docs/fr/operations/configuration_files.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 50 -toc_title: Fichiers De Configuration ---- - -# Fichiers De Configuration {#configuration_files} - -ClickHouse prend en charge la gestion de la configuration multi-fichiers. Le fichier de configuration du serveur principal est `/etc/clickhouse-server/config.xml`. Les autres fichiers doivent être dans le `/etc/clickhouse-server/config.d` répertoire. - -!!! note "Note" - Tous les fichiers de configuration doivent être au format XML. Aussi, ils doivent avoir le même élément racine, généralement ``. - -Certains paramètres spécifiés dans le fichier de configuration principal peuvent être remplacés dans d'autres fichiers de configuration. Le `replace` ou `remove` les attributs peuvent être spécifiés pour les éléments de ces fichiers de configuration. - -Si ni l'un ni l'autre n'est spécifié, il combine le contenu des éléments de manière récursive, remplaçant les valeurs des enfants en double. - -Si `replace` est spécifié, il remplace l'élément entier par celui spécifié. - -Si `remove` est spécifié, il supprime l'élément. - -La configuration peut également définir “substitutions”. Si un élément a le `incl` attribut, la substitution correspondante du fichier sera utilisée comme valeur. Par défaut, le chemin d'accès au fichier avec des substitutions est `/etc/metrika.xml`. Ceci peut être changé dans le [include\_from](server_configuration_parameters/settings.md#server_configuration_parameters-include_from) élément dans la configuration du serveur. Les valeurs de substitution sont spécifiées dans `/yandex/substitution_name` les éléments de ce fichier. Si une substitution spécifiée dans `incl` n'existe pas, il est enregistré dans le journal. Pour empêcher ClickHouse de consigner les substitutions manquantes, spécifiez `optional="true"` attribut (par exemple, les paramètres de [macro](server_configuration_parameters/settings.md)). - -Les Substitutions peuvent également être effectuées à partir de ZooKeeper. Pour ce faire, spécifiez l'attribut `from_zk = "/path/to/node"`. La valeur de l'élément est remplacé par le contenu du noeud au `/path/to/node` dans ZooKeeper. Vous pouvez également placer un sous-arbre XML entier sur le nœud ZooKeeper et il sera entièrement inséré dans l'élément source. - -Le `config.xml` le fichier peut spécifier une configuration distincte avec les paramètres utilisateur, les profils et les quotas. Le chemin relatif à cette configuration est défini dans `users_config` élément. Par défaut, il est `users.xml`. Si `users_config` est omis, les paramètres utilisateur, les profils et les quotas sont `config.xml`. - -La configuration des utilisateurs peut être divisée en fichiers séparés similaires à `config.xml` et `config.d/`. -Nom du répertoire est défini comme `users_config` sans `.xml` postfix concaténé avec `.d`. -Répertoire `users.d` est utilisé par défaut, comme `users_config` par défaut `users.xml`. -Par exemple, vous pouvez avoir séparé fichier de configuration pour chaque utilisateur comme ceci: - -``` bash -$ cat /etc/clickhouse-server/users.d/alice.xml -``` - -``` xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -Pour chaque fichier de configuration, le serveur génère également `file-preprocessed.xml` les fichiers lors du démarrage. Ces fichiers contiennent toutes les remplacements et des remplacements, et ils sont destinés à l'usage informatif. Si des substitutions ZooKeeper ont été utilisées dans les fichiers de configuration mais que ZooKeeper n'est pas disponible au démarrage du serveur, le serveur charge la configuration à partir du fichier prétraité. - -Le serveur suit les changements dans les fichiers de configuration, ainsi que les fichiers et les nœuds ZooKeeper utilisés lors des substitutions et des remplacements, et recharge les paramètres pour les utilisateurs et les clusters à la volée. Cela signifie que vous pouvez modifier le cluster, les utilisateurs et leurs paramètres sans redémarrer le serveur. - -[Article Original](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/fr/operations/index.md b/docs/fr/operations/index.md index 92265ce9fcf..f680cbcf9ee 100644 --- a/docs/fr/operations/index.md +++ b/docs/fr/operations/index.md @@ -8,20 +8,20 @@ toc_title: Introduction # Opérations {#operations} -Le manuel d'exploitation de ClickHouse comprend les principales sections suivantes: +Le manuel d’exploitation de ClickHouse comprend les principales sections suivantes: - [Exigence](requirements.md) - [Surveiller](monitoring.md) - [Dépannage](troubleshooting.md) -- [Recommandations D'Utilisation](tips.md) +- [Recommandations D’Utilisation](tips.md) - [Procédure De Mise À Jour](update.md) -- [Les Droits D'Accès](access_rights.md) +- [Les Droits D’Accès](access-rights.md) - [La Sauvegarde Des Données](backup.md) -- [Fichiers De Configuration](configuration_files.md) +- [Fichiers De Configuration](configuration-files.md) - [Quota](quotas.md) -- [Les Tables Système](system_tables.md) -- [Paramètres De Configuration Du Serveur](server_configuration_parameters/index.md) -- [Comment Tester Votre Matériel Avec ClickHouse](performance_test.md) +- [Les Tables Système](system-tables.md) +- [Paramètres De Configuration Du Serveur](server-configuration-parameters/index.md) +- [Comment Tester Votre Matériel Avec ClickHouse](performance-test.md) - [Paramètre](settings/index.md) - [Utilitaire](utilities/index.md) diff --git a/docs/fr/operations/monitoring.md b/docs/fr/operations/monitoring.md index 851f3c73ce8..fc0eaaa4bc6 100644 --- a/docs/fr/operations/monitoring.md +++ b/docs/fr/operations/monitoring.md @@ -9,36 +9,36 @@ toc_title: Surveiller Vous pouvez surveiller: -- L'utilisation des ressources matérielles. +- L’utilisation des ressources matérielles. - Statistiques du serveur ClickHouse. -## L'Utilisation Des Ressources {#resource-utilization} +## L’Utilisation Des Ressources {#resource-utilization} -ClickHouse ne surveille pas l'état des ressources matérielles par lui-même. +ClickHouse ne surveille pas l’état des ressources matérielles par lui-même. Il est fortement recommandé de configurer la surveillance de: - Charge et température sur les processeurs. - Vous pouvez utiliser [dmesg](https://en.wikipedia.org/wiki/Dmesg), [turbostat](https://www.linux.org/docs/man8/turbostat.html) ou d'autres instruments. + Vous pouvez utiliser [dmesg](https://en.wikipedia.org/wiki/Dmesg), [turbostat](https://www.linux.org/docs/man8/turbostat.html) ou d’autres instruments. - Utilisation du système de stockage, de la RAM et du réseau. ## Métriques Du Serveur Clickhouse {#clickhouse-server-metrics} -Clickhouse server a des instruments embarqués pour la surveillance de l'auto-état. +Clickhouse server a des instruments embarqués pour la surveillance de l’auto-état. -Pour suivre les événements du serveur, utilisez les journaux du serveur. Voir la [enregistreur](server_configuration_parameters/settings.md#server_configuration_parameters-logger) section du fichier de configuration. +Pour suivre les événements du serveur, utilisez les journaux du serveur. Voir la [enregistreur](server-configuration-parameters/settings.md#server_configuration_parameters-logger) section du fichier de configuration. Clickhouse recueille: - Différentes mesures de la façon dont le serveur utilise les ressources de calcul. - Statistiques communes sur le traitement des requêtes. -Vous pouvez trouver des mesures dans le [système.métrique](../operations/system_tables.md#system_tables-metrics), [système.événement](../operations/system_tables.md#system_tables-events), et [système.asynchronous\_metrics](../operations/system_tables.md#system_tables-asynchronous_metrics) table. +Vous pouvez trouver des mesures dans le [système.métrique](../operations/system-tables.md#system_tables-metrics), [système.événement](../operations/system-tables.md#system_tables-events), et [système.asynchronous\_metrics](../operations/system-tables.md#system_tables-asynchronous_metrics) table. -Vous pouvez configurer ClickHouse pour exporter des métriques vers [Graphite](https://github.com/graphite-project). Voir la [Graphite section](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) dans le fichier de configuration du serveur ClickHouse. Avant de configurer l'exportation des métriques, vous devez configurer Graphite en suivant leur [guide](https://graphite.readthedocs.io/en/latest/install.html). +Vous pouvez configurer ClickHouse pour exporter des métriques vers [Graphite](https://github.com/graphite-project). Voir la [Graphite section](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) dans le fichier de configuration du serveur ClickHouse. Avant de configurer l’exportation des métriques, vous devez configurer Graphite en suivant leur [guide](https://graphite.readthedocs.io/en/latest/install.html). -De plus, vous pouvez surveiller la disponibilité du serveur via L'API HTTP. Envoyer la `HTTP GET` demande à `/ping`. Si le serveur est disponible, il répond avec `200 OK`. +De plus, vous pouvez surveiller la disponibilité du serveur via L’API HTTP. Envoyer la `HTTP GET` demande à `/ping`. Si le serveur est disponible, il répond avec `200 OK`. -Pour surveiller les serveurs dans une configuration de cluster, vous devez [max\_replica\_delay\_for\_distributed\_queries](settings/settings.md#settings-max_replica_delay_for_distributed_queries) paramètre et utiliser la ressource HTTP `/replicas_status`. Une demande de `/replicas_status` retourner `200 OK` si la réplique est disponible et n'est pas retardé derrière les autres réplicas. Si une réplique est retardée, elle revient `503 HTTP_SERVICE_UNAVAILABLE` avec des informations sur l'écart. +Pour surveiller les serveurs dans une configuration de cluster, vous devez [max\_replica\_delay\_for\_distributed\_queries](settings/settings.md#settings-max_replica_delay_for_distributed_queries) paramètre et utiliser la ressource HTTP `/replicas_status`. Une demande de `/replicas_status` retourner `200 OK` si la réplique est disponible et n’est pas retardé derrière les autres réplicas. Si une réplique est retardée, elle revient `503 HTTP_SERVICE_UNAVAILABLE` avec des informations sur l’écart. diff --git a/docs/fr/operations/optimizing_performance/index.md b/docs/fr/operations/optimizing-performance/index.md similarity index 100% rename from docs/fr/operations/optimizing_performance/index.md rename to docs/fr/operations/optimizing-performance/index.md diff --git a/docs/fr/operations/optimizing-performance/sampling-query-profiler.md b/docs/fr/operations/optimizing-performance/sampling-query-profiler.md new file mode 100644 index 00000000000..bebb4a1087f --- /dev/null +++ b/docs/fr/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 54 +toc_title: "Profilage De Requ\xEAte" +--- + +# Échantillonnage Du Profileur De Requête {#sampling-query-profiler} + +ClickHouse exécute un profileur d’échantillonnage qui permet d’analyser l’exécution des requêtes. En utilisant profiler, vous pouvez trouver des routines de code source qui ont utilisé le plus fréquemment lors de l’exécution de la requête. Vous pouvez suivre le temps CPU et le temps d’horloge murale passé, y compris le temps d’inactivité. + +Utilisation du générateur de profils: + +- Installation de la [trace\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) la section de la configuration du serveur. + + Cette section configure le [trace\_log](../../operations/system-tables.md#system_tables-trace_log) tableau système contenant les résultats du fonctionnement du profileur. Il est configuré par défaut. Rappelez-vous que les données de ce tableau est valable que pour un serveur en cours d’exécution. Après le redémarrage du serveur, ClickHouse ne nettoie pas la table et toute l’adresse de mémoire virtuelle stockée peut devenir invalide. + +- Installation de la [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) ou [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) paramètre. Les deux paramètres peuvent être utilisés simultanément. + + Ces paramètres vous permettent de configurer les minuteries du profileur. Comme il s’agit des paramètres de session, vous pouvez obtenir une fréquence d’échantillonnage différente pour l’ensemble du serveur, les utilisateurs individuels ou les profils d’utilisateurs, pour votre session interactive et pour chaque requête individuelle. + +La fréquence d’échantillonnage par défaut est d’un échantillon par seconde et le processeur et les minuteries réelles sont activés. Cette fréquence permet de collecter suffisamment d’informations sur le cluster ClickHouse. En même temps, en travaillant avec cette fréquence, profiler n’affecte pas les performances du serveur ClickHouse. Si vous avez besoin de profiler chaque requête individuelle, essayez d’utiliser une fréquence d’échantillonnage plus élevée. + +Pour analyser les `trace_log` système de table: + +- Installer le `clickhouse-common-static-dbg` paquet. Voir [Installer à partir de paquets DEB](../../getting-started/install.md#install-from-deb-packages). + +- Autoriser les fonctions d’introspection par [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) paramètre. + + Pour des raisons de sécurité, les fonctions d’introspection sont désactivées par défaut. + +- L’utilisation de la `addressToLine`, `addressToSymbol` et `demangle` [fonctions d’introspection](../../sql-reference/functions/introspection.md) pour obtenir les noms de fonctions et leurs positions dans le code ClickHouse. Pour obtenir un profil pour une requête, vous devez agréger les données du `trace_log` table. Vous pouvez agréger des données par des fonctions individuelles ou par l’ensemble des traces de la pile. + +Si vous avez besoin de visualiser `trace_log` info, essayez [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) et [speedscope](https://github.com/laplab/clickhouse-speedscope). + +## Exemple {#example} + +Dans cet exemple, nous: + +- Filtrage `trace_log` données par un identifiant de requête et la date actuelle. + +- Agrégation par trace de pile. + +- En utilisant les fonctions d’introspection, nous obtiendrons un rapport de: + + - Noms des symboles et des fonctions de code source correspondantes. + - Emplacements de code Source de ces fonctions. + + + +``` sql +SELECT + count(), + arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym +FROM system.trace_log +WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) +GROUP BY trace +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +{% include "examples/sampling_query_profiler_result.txt" %} +``` diff --git a/docs/fr/operations/optimizing_performance/sampling_query_profiler.md b/docs/fr/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 100644 index a4dd88b2203..00000000000 --- a/docs/fr/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 54 -toc_title: "Profilage De Requ\xEAte" ---- - -# Échantillonnage Du Profileur De Requête {#sampling-query-profiler} - -ClickHouse exécute un profileur d'échantillonnage qui permet d'analyser l'exécution des requêtes. En utilisant profiler, vous pouvez trouver des routines de code source qui ont utilisé le plus fréquemment lors de l'exécution de la requête. Vous pouvez suivre le temps CPU et le temps d'horloge murale passé, y compris le temps d'inactivité. - -Utilisation du générateur de profils: - -- Installation de la [trace\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) la section de la configuration du serveur. - - Cette section configure le [trace\_log](../../operations/system_tables.md#system_tables-trace_log) tableau système contenant les résultats du fonctionnement du profileur. Il est configuré par défaut. Rappelez-vous que les données de ce tableau est valable que pour un serveur en cours d'exécution. Après le redémarrage du serveur, ClickHouse ne nettoie pas la table et toute l'adresse de mémoire virtuelle stockée peut devenir invalide. - -- Installation de la [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) ou [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) paramètre. Les deux paramètres peuvent être utilisés simultanément. - - Ces paramètres vous permettent de configurer les minuteries du profileur. Comme il s'agit des paramètres de session, vous pouvez obtenir une fréquence d'échantillonnage différente pour l'ensemble du serveur, les utilisateurs individuels ou les profils d'utilisateurs, pour votre session interactive et pour chaque requête individuelle. - -La fréquence d'échantillonnage par défaut est d'un échantillon par seconde et le processeur et les minuteries réelles sont activés. Cette fréquence permet de collecter suffisamment d'informations sur le cluster ClickHouse. En même temps, en travaillant avec cette fréquence, profiler n'affecte pas les performances du serveur ClickHouse. Si vous avez besoin de profiler chaque requête individuelle, essayez d'utiliser une fréquence d'échantillonnage plus élevée. - -Pour analyser les `trace_log` système de table: - -- Installer le `clickhouse-common-static-dbg` paquet. Voir [Installer à partir de paquets DEB](../../getting_started/install.md#install-from-deb-packages). - -- Autoriser les fonctions d'introspection par [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) paramètre. - - Pour des raisons de sécurité, les fonctions d'introspection sont désactivées par défaut. - -- L'utilisation de la `addressToLine`, `addressToSymbol` et `demangle` [fonctions d'introspection](../../sql_reference/functions/introspection.md) pour obtenir les noms de fonctions et leurs positions dans le code ClickHouse. Pour obtenir un profil pour une requête, vous devez agréger les données du `trace_log` table. Vous pouvez agréger des données par des fonctions individuelles ou par l'ensemble des traces de la pile. - -Si vous avez besoin de visualiser `trace_log` info, essayez [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) et [speedscope](https://github.com/laplab/clickhouse-speedscope). - -## Exemple {#example} - -Dans cet exemple, nous: - -- Filtrage `trace_log` données par un identifiant de requête et la date actuelle. - -- Agrégation par trace de pile. - -- En utilisant les fonctions d'introspection, nous obtiendrons un rapport de: - - - Noms des symboles et des fonctions de code source correspondantes. - - Emplacements de code Source de ces fonctions. - - - -``` sql -SELECT - count(), - arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym -FROM system.trace_log -WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) -GROUP BY trace -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -{% include "examples/sampling_query_profiler_result.txt" %} -``` diff --git a/docs/fr/operations/performance-test.md b/docs/fr/operations/performance-test.md new file mode 100644 index 00000000000..cd4732e8f96 --- /dev/null +++ b/docs/fr/operations/performance-test.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 54 +toc_title: "Tester Le Mat\xE9riel" +--- + +# Comment Tester Votre Matériel Avec ClickHouse {#how-to-test-your-hardware-with-clickhouse} + +Avec cette instruction, vous pouvez exécuter le test de performance clickhouse de base sur n’importe quel serveur sans installation de paquets ClickHouse. + +1. Aller à “commits” page: https://github.com/ClickHouse/ClickHouse/commits/master + +2. Cliquez sur la première coche verte ou croix rouge avec vert “ClickHouse Build Check” et cliquez sur le “Details” lien de proximité “ClickHouse Build Check”. + +3. Copiez le lien à “clickhouse” binaire pour amd64 ou aarch64. + +4. ssh sur le serveur et le télécharger avec wget: + + + + # For amd64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse + # For aarch64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse + # Then do: + chmod a+x clickhouse + +1. Télécharger configs: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml + mkdir config.d + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml + +1. Télécharger des fichiers de référence: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh + chmod a+x benchmark-new.sh + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql + +1. Télécharger les données de test selon le [Yandex.Metrica dataset](../getting-started/example-datasets/metrica.md) instruction (“hits” tableau contenant 100 millions de lignes). + + + + wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz + tar xvf hits_100m_obfuscated_v1.tar.xz -C . + mv hits_100m_obfuscated_v1/* . + +1. Exécuter le serveur: + + + + ./clickhouse server + +1. Vérifiez les données: ssh au serveur dans un autre terminal + + + + ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" + 100000000 + +1. Modifier le benchmark-new.sh, changement “clickhouse-client” de “./clickhouse client” et d’ajouter “–max\_memory\_usage 100000000000” paramètre. + + + + mcedit benchmark-new.sh + +1. Exécutez le test: + + + + ./benchmark-new.sh hits_100m_obfuscated + +1. Envoyez les numéros et les informations sur votre configuration matérielle à clickhouse-feedback@yandex-team.com + +Tous les résultats sont publiés ici: https://clickhouse.tech / benchmark\_hardware.HTML diff --git a/docs/fr/operations/performance_test.md b/docs/fr/operations/performance_test.md deleted file mode 100644 index 9b4df8e7fd4..00000000000 --- a/docs/fr/operations/performance_test.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 54 -toc_title: "Tester Le Mat\xE9riel" ---- - -# Comment Tester Votre Matériel Avec ClickHouse {#how-to-test-your-hardware-with-clickhouse} - -Avec cette instruction, vous pouvez exécuter le test de performance clickhouse de base sur n'importe quel serveur sans installation de paquets ClickHouse. - -1. Aller à “commits” page: https://github.com/ClickHouse/ClickHouse/commits/master - -2. Cliquez sur la première coche verte ou croix rouge avec vert “ClickHouse Build Check” et cliquez sur le “Details” lien de proximité “ClickHouse Build Check”. - -3. Copiez le lien à “clickhouse” binaire pour amd64 ou aarch64. - -4. ssh sur le serveur et le télécharger avec wget: - - - - # For amd64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse - # For aarch64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse - # Then do: - chmod a+x clickhouse - -1. Télécharger configs: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml - mkdir config.d - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml - -1. Télécharger des fichiers de référence: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh - chmod a+x benchmark-new.sh - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql - -1. Télécharger les données de test selon le [Yandex.Metrica dataset](../getting_started/example_datasets/metrica.md) instruction (“hits” tableau contenant 100 millions de lignes). - - - - wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz - tar xvf hits_100m_obfuscated_v1.tar.xz -C . - mv hits_100m_obfuscated_v1/* . - -1. Exécuter le serveur: - - - - ./clickhouse server - -1. Vérifiez les données: ssh au serveur dans un autre terminal - - - - ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" - 100000000 - -1. Modifier le benchmark-new.sh, changement “clickhouse-client” de “./clickhouse client” et d'ajouter “–max\_memory\_usage 100000000000” paramètre. - - - - mcedit benchmark-new.sh - -1. Exécutez le test: - - - - ./benchmark-new.sh hits_100m_obfuscated - -1. Envoyez les numéros et les informations sur votre configuration matérielle à clickhouse-feedback@yandex-team.com - -Tous les résultats sont publiés ici: https://clickhouse.tech / benchmark\_hardware.HTML diff --git a/docs/fr/operations/quotas.md b/docs/fr/operations/quotas.md index d81ff33c403..95da8e13fc2 100644 --- a/docs/fr/operations/quotas.md +++ b/docs/fr/operations/quotas.md @@ -7,10 +7,10 @@ toc_title: Quota # Quota {#quotas} -Les Quotas permettent de limiter l'utilisation des ressources au cours d'une période de temps, ou tout simplement suivre l'utilisation des ressources. -Les Quotas sont configurés dans la configuration utilisateur. Ce n'est généralement ‘users.xml’. +Les Quotas permettent de limiter l’utilisation des ressources au cours d’une période de temps, ou tout simplement suivre l’utilisation des ressources. +Les Quotas sont configurés dans la configuration utilisateur. Ce n’est généralement ‘users.xml’. -Le système dispose également d'une fonctionnalité pour limiter la complexité d'une seule requête. Voir la section “Restrictions on query complexity”). +Le système dispose également d’une fonctionnalité pour limiter la complexité d’une seule requête. Voir la section “Restrictions on query complexity”). Contrairement aux restrictions de complexité des requêtes, les quotas: @@ -39,7 +39,7 @@ Regardons la section de la ‘users.xml’ fichier qui définit les quotas. ``` -Par défaut, le quota suit simplement la consommation de ressources pour chaque heure, sans limiter l'utilisation. +Par défaut, le quota suit simplement la consommation de ressources pour chaque heure, sans limiter l’utilisation. La consommation de ressources calculé pour chaque intervalle est sortie dans le journal du serveur après chaque demande. ``` xml @@ -68,9 +68,9 @@ La consommation de ressources calculé pour chaque intervalle est sortie dans le ``` -Pour l' ‘statbox’ quota, restrictions sont fixées pour toutes les heures et pour toutes les 24 heures (86 400 secondes). L'intervalle de temps est compté à partir d'un moment fixe défini par l'implémentation. En d'autres termes, l'intervalle de 24 heures ne commence pas nécessairement à minuit. +Pour l’ ‘statbox’ quota, restrictions sont fixées pour toutes les heures et pour toutes les 24 heures (86 400 secondes). L’intervalle de temps est compté à partir d’un moment fixe défini par l’implémentation. En d’autres termes, l’intervalle de 24 heures ne commence pas nécessairement à minuit. -Lorsque l'intervalle se termine, toutes les valeurs collectées sont effacées. Pour l'heure suivante, le calcul du quota recommence. +Lorsque l’intervalle se termine, toutes les valeurs collectées sont effacées. Pour l’heure suivante, le calcul du quota recommence. Voici les montants qui peuvent être restreint: @@ -105,7 +105,7 @@ Les Quotas peuvent utiliser le “quota key” fonctionnalité afin de rendre co Le quota est attribué aux utilisateurs dans le ‘users’ section de la configuration. Voir la section “Access rights”. -Pour le traitement des requêtes distribuées, les montants accumulés sont stockés sur le serveur demandeur. Donc, si l'utilisateur se rend sur un autre serveur, le quota y sera “start over”. +Pour le traitement des requêtes distribuées, les montants accumulés sont stockés sur le serveur demandeur. Donc, si l’utilisateur se rend sur un autre serveur, le quota y sera “start over”. Lorsque le serveur est redémarré, les quotas sont réinitialisés. diff --git a/docs/fr/operations/requirements.md b/docs/fr/operations/requirements.md index 56730105760..88b06e9c44e 100644 --- a/docs/fr/operations/requirements.md +++ b/docs/fr/operations/requirements.md @@ -9,38 +9,38 @@ toc_title: Exigence ## CPU {#cpu} -Pour l'installation à partir de paquets deb prédéfinis, utilisez un processeur avec l'architecture x86\_64 et la prise en charge des instructions SSE 4.2. Pour exécuter ClickHouse avec des processeurs qui ne prennent pas en charge SSE 4.2 ou qui ont une architecture AArch64 ou PowerPC64LE, vous devez créer ClickHouse à partir de sources. +Pour l’installation à partir de paquets deb prédéfinis, utilisez un processeur avec l’architecture x86\_64 et la prise en charge des instructions SSE 4.2. Pour exécuter ClickHouse avec des processeurs qui ne prennent pas en charge SSE 4.2 ou qui ont une architecture AArch64 ou PowerPC64LE, vous devez créer ClickHouse à partir de sources. -ClickHouse implémente le traitement parallèle des données et utilise toutes les ressources matérielles disponibles. Lors du choix d'un processeur, tenez compte du fait que ClickHouse fonctionne plus efficacement dans les configurations avec un grand nombre de cœurs mais une fréquence d'horloge plus faible que dans les configurations avec moins de cœurs et une fréquence d'horloge plus élevée. Par exemple, 16 cœurs avec 2600 MHz est préférable à 8 cœurs avec 3600 MHz. +ClickHouse implémente le traitement parallèle des données et utilise toutes les ressources matérielles disponibles. Lors du choix d’un processeur, tenez compte du fait que ClickHouse fonctionne plus efficacement dans les configurations avec un grand nombre de cœurs mais une fréquence d’horloge plus faible que dans les configurations avec moins de cœurs et une fréquence d’horloge plus élevée. Par exemple, 16 cœurs avec 2600 MHz est préférable à 8 cœurs avec 3600 MHz. -L'utilisation de **Turbo Boost** et **la technologie hyper-threading** technologies est recommandé. Il améliore sensiblement les performances avec une charge typique. +L’utilisation de **Turbo Boost** et **la technologie hyper-threading** technologies est recommandé. Il améliore sensiblement les performances avec une charge typique. ## RAM {#ram} -Nous vous recommandons d'utiliser un minimum de 4 Go de RAM afin d'effectuer des requêtes non triviales. Le serveur ClickHouse peut fonctionner avec une quantité beaucoup plus petite de RAM, mais il nécessite de la mémoire pour traiter les requêtes. +Nous vous recommandons d’utiliser un minimum de 4 Go de RAM afin d’effectuer des requêtes non triviales. Le serveur ClickHouse peut fonctionner avec une quantité beaucoup plus petite de RAM, mais il nécessite de la mémoire pour traiter les requêtes. Le volume de RAM requis dépend de: - La complexité des requêtes. - La quantité de données traitées dans les requêtes. -Pour calculer le volume de RAM requis, vous devez estimer la taille des données temporaires pour [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) et d'autres opérations que vous utilisez. +Pour calculer le volume de RAM requis, vous devez estimer la taille des données temporaires pour [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) et d’autres opérations que vous utilisez. -ClickHouse peut utiliser la mémoire externe pour les données temporaires. Voir [Groupe par dans la mémoire externe](../sql_reference/statements/select.md#select-group-by-in-external-memory) pour plus de détails. +ClickHouse peut utiliser la mémoire externe pour les données temporaires. Voir [Groupe par dans la mémoire externe](../sql-reference/statements/select.md#select-group-by-in-external-memory) pour plus de détails. -## Fichier D'Échange {#swap-file} +## Fichier D’Échange {#swap-file} -Désactiver le fichier d'échange pour les environnements de production. +Désactiver le fichier d’échange pour les environnements de production. ## Sous-Système De Stockage {#storage-subsystem} -Vous devez avoir 2 Go d'espace disque libre pour installer ClickHouse. +Vous devez avoir 2 Go d’espace disque libre pour installer ClickHouse. -Le volume de stockage requis pour vos données doit être calculé séparément. L'évaluation devrait inclure: +Le volume de stockage requis pour vos données doit être calculé séparément. L’évaluation devrait inclure: - Estimation du volume de données. - Vous pouvez prendre un échantillon des données et obtenir la taille moyenne d'une ligne. Ensuite, multipliez la valeur par le nombre de lignes que vous souhaitez stocker. + Vous pouvez prendre un échantillon des données et obtenir la taille moyenne d’une ligne. Ensuite, multipliez la valeur par le nombre de lignes que vous souhaitez stocker. - Le coefficient de compression des données. @@ -56,6 +56,6 @@ La bande passante du réseau est essentielle pour traiter les requêtes distribu ## Logiciel {#software} -ClickHouse est développé pour la famille de systèmes D'exploitation Linux. La distribution Linux recommandée est Ubuntu. Le `tzdata` paquet doit être installé dans le système. +ClickHouse est développé pour la famille de systèmes D’exploitation Linux. La distribution Linux recommandée est Ubuntu. Le `tzdata` paquet doit être installé dans le système. -ClickHouse peut également fonctionner dans d'autres familles de systèmes d'exploitation. Voir les détails dans le [Prise en main](../getting_started/index.md) section de la documentation. +ClickHouse peut également fonctionner dans d’autres familles de systèmes d’exploitation. Voir les détails dans le [Prise en main](../getting-started/index.md) section de la documentation. diff --git a/docs/fr/operations/server-configuration-parameters/index.md b/docs/fr/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..d72d3762209 --- /dev/null +++ b/docs/fr/operations/server-configuration-parameters/index.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Server Configuration Parameters +toc_priority: 54 +toc_title: Introduction +--- + +# Paramètres De Configuration Du Serveur {#server-settings} + +Cette section contient des descriptions des paramètres du serveur qui ne peuvent pas être modifiés au niveau de la session ou de la requête. + +Ces paramètres sont stockés dans la `config.xml` fichier sur le serveur ClickHouse. + +D’autres paramètres sont décrits dans le “[Paramètre](../settings/index.md#settings)” section. + +Avant d’étudier les paramètres, lire la [Fichiers de Configuration](../configuration-files.md#configuration_files) section et notez l’utilisation de substitutions (le `incl` et `optional` attribut). + +[Article Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/fr/operations/server-configuration-parameters/settings.md b/docs/fr/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..2e975934e39 --- /dev/null +++ b/docs/fr/operations/server-configuration-parameters/settings.md @@ -0,0 +1,872 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 57 +toc_title: "Les Param\xE8tres Du Serveur" +--- + +# Les Paramètres Du Serveur {#server-settings} + +## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} + +L’intervalle en secondes avant de recharger les dictionnaires intégrés. + +Clickhouse recharge les dictionnaires intégrés toutes les X secondes. Cela permet d’éditer des dictionnaires “on the fly” sans redémarrer le serveur. + +Valeur par défaut: 3600. + +**Exemple** + +``` xml +3600 +``` + +## compression {#server-settings-compression} + +Paramètres de compression de données pour [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-tables de moteur. + +!!! warning "Avertissement" + Ne l’utilisez pas si vous venez de commencer à utiliser ClickHouse. + +Modèle de Configuration: + +``` xml + + + ... + ... + ... + + ... + +``` + +`` Fields: + +- `min_part_size` – The minimum size of a data part. +- `min_part_size_ratio` – The ratio of the data part size to the table size. +- `method` – Compression method. Acceptable values: `lz4` ou `zstd`. + +Vous pouvez configurer plusieurs `` section. + +Actions lorsque les conditions sont remplies: + +- Si une partie de données correspond à un ensemble de conditions, ClickHouse utilise la méthode de compression spécifiée. +- Si une partie de données correspond à plusieurs ensembles de conditions, ClickHouse utilise le premier ensemble de conditions correspondant. + +Si aucune condition n’est remplie pour une partie de données, ClickHouse utilise `lz4` compression. + +**Exemple** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## default\_database {#default-database} + +La base de données par défaut. + +Pour obtenir une liste de bases de données, utilisez la [SHOW DATABASES](../../sql-reference/statements/show.md#show-databases) requête. + +**Exemple** + +``` xml +default +``` + +## default\_profile {#default-profile} + +Profil des paramètres par défaut. + +Les paramètres des profils sont situés dans le fichier spécifié dans le paramètre `user_config`. + +**Exemple** + +``` xml +default +``` + +## dictionaries\_config {#server_configuration_parameters-dictionaries_config} + +Chemin d’accès au fichier de configuration des dictionnaires externes. + +Chemin: + +- Spécifiez le chemin absolu ou le chemin relatif au fichier de configuration du serveur. +- Le chemin peut contenir des caractères génériques \* et ?. + +Voir aussi “[Dictionnaires externes](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)”. + +**Exemple** + +``` xml +*_dictionary.xml +``` + +## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} + +Chargement paresseux des dictionnaires. + +Si `true` chaque dictionnaire est créé lors de la première utilisation. Si la création du dictionnaire a échoué, la fonction qui utilisait le dictionnaire lève une exception. + +Si `false`, tous les dictionnaires sont créés lorsque le serveur démarre, et si il y a une erreur, le serveur s’arrête. + +La valeur par défaut est `true`. + +**Exemple** + +``` xml +true +``` + +## format\_schema\_path {#server_configuration_parameters-format_schema_path} + +Le chemin d’accès au répertoire avec des régimes pour l’entrée de données, tels que les schémas pour l’ [CapnProto](../../interfaces/formats.md#capnproto) format. + +**Exemple** + +``` xml + + format_schemas/ +``` + +## graphite {#server_configuration_parameters-graphite} + +Envoi de données à [Graphite](https://github.com/graphite-project). + +Paramètre: + +- host – The Graphite server. +- port – The port on the Graphite server. +- interval – The interval for sending, in seconds. +- timeout – The timeout for sending data, in seconds. +- root\_path – Prefix for keys. +- metrics – Sending data from the [système.métrique](../../operations/system-tables.md#system_tables-metrics) table. +- events – Sending deltas data accumulated for the time period from the [système.événement](../../operations/system-tables.md#system_tables-events) table. +- events\_cumulative – Sending cumulative data from the [système.événement](../../operations/system-tables.md#system_tables-events) table. +- asynchronous\_metrics – Sending data from the [système.asynchronous\_metrics](../../operations/system-tables.md#system_tables-asynchronous_metrics) table. + +Vous pouvez configurer plusieurs `` clause. Par exemple, vous pouvez l’utiliser pour envoyer des données différentes à différents intervalles. + +**Exemple** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## graphite\_rollup {#server_configuration_parameters-graphite-rollup} + +Paramètres pour l’amincissement des données pour le Graphite. + +Pour plus de détails, voir [GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md). + +**Exemple** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## http\_port/https\_port {#http-porthttps-port} + +Port de connexion au serveur via HTTP(S). + +Si `https_port` est spécifié, [openSSL](#server_configuration_parameters-openssl) doit être configuré. + +Si `http_port` est spécifié, la configuration OpenSSL est ignorée même si elle est définie. + +**Exemple** + +``` xml +0000 +``` + +## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} + +Page affichée par défaut lorsque vous accédez au serveur HTTP(S) ClickHouse. +La valeur par défaut est “Ok.” (avec un saut de ligne à la fin) + +**Exemple** + +Ouvrir `https://tabix.io/` lors de l’accès à `http://localhost: http_port`. + +``` xml + +
]]> +
+``` + +## include\_from {#server_configuration_parameters-include_from} + +Le chemin d’accès au fichier avec des substitutions. + +Pour plus d’informations, consultez la section “[Fichiers de Configuration](../configuration-files.md#configuration_files)”. + +**Exemple** + +``` xml +/etc/metrica.xml +``` + +## interserver\_http\_port {#interserver-http-port} + +Port pour l’échange de données entre les serveurs ClickHouse. + +**Exemple** + +``` xml +9009 +``` + +## interserver\_http\_host {#interserver-http-host} + +Le nom d’hôte qui peut être utilisé par d’autres serveurs pour accéder à ce serveur. + +Si elle est omise, elle est définie de la même manière que `hostname-f` commande. + +Utile pour rompre avec une interface réseau spécifique. + +**Exemple** + +``` xml +example.yandex.ru +``` + +## interserver\_http\_credentials {#server-settings-interserver-http-credentials} + +Le nom d’utilisateur et le mot de passe utilisés pour [réplication](../../engines/table-engines/mergetree-family/replication.md) avec les moteurs \* répliqués. Ces informations d’identification sont utilisées uniquement pour la communication entre les répliques et ne sont pas liées aux informations d’identification des clients ClickHouse. Le serveur vérifie ces informations d’identification pour la connexion de répliques et utilise les mêmes informations d’identification lors de la connexion à d’autres répliques. Donc, ces informations d’identification doivent être identiques pour tous les réplicas dans un cluster. +Par défaut, l’authentification n’est pas utilisé. + +Cette section contient les paramètres suivants: + +- `user` — username. +- `password` — password. + +**Exemple** + +``` xml + + admin + 222 + +``` + +## keep\_alive\_timeout {#keep-alive-timeout} + +Le nombre de secondes que ClickHouse attend pour les demandes entrantes avant de fermer la connexion. Par défaut est de 3 secondes. + +**Exemple** + +``` xml +3 +``` + +## listen\_host {#server_configuration_parameters-listen_host} + +Restriction sur les hôtes dont les demandes peuvent provenir. Si vous voulez que le serveur réponde à tous, spécifiez `::`. + +Exemple: + +``` xml +::1 +127.0.0.1 +``` + +## enregistreur {#server_configuration_parameters-logger} + +Paramètres de journalisation. + +Touches: + +- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. +- log – The log file. Contains all the entries according to `level`. +- errorlog – Error log file. +- size – Size of the file. Applies to `log`et`errorlog`. Une fois que le fichier atteint `size`, Archives ClickHouse et le renomme, et crée un nouveau fichier journal à sa place. +- count – The number of archived log files that ClickHouse stores. + +**Exemple** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +L’écriture dans le syslog est également prise en charge. Exemple de Config: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +Touches: + +- use\_syslog — Required setting if you want to write to the syslog. +- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. +- hostname — Optional. The name of the host that logs are sent from. +- facility — [Le mot clé syslog facility](https://en.wikipedia.org/wiki/Syslog#Facility) en majuscules avec la “LOG\_” préfixe: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` et ainsi de suite). + Valeur par défaut: `LOG_USER` si `address` est spécifié, `LOG_DAEMON otherwise.` +- format – Message format. Possible values: `bsd` et `syslog.` + +## macro {#macros} + +Substitutions de paramètres pour les tables répliquées. + +Peut être omis si les tables répliquées ne sont pas utilisées. + +Pour plus d’informations, consultez la section “[Création de tables répliquées](../../engines/table-engines/mergetree-family/replication.md)”. + +**Exemple** + +``` xml + +``` + +## mark\_cache\_size {#server-mark-cache-size} + +Taille approximative (en octets) du cache des marques utilisées par les [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) famille. + +Le cache est partagé pour le serveur et la mémoire est allouée au besoin. La taille du cache doit être d’au moins 5368709120. + +**Exemple** + +``` xml +5368709120 +``` + +## max\_concurrent\_queries {#max-concurrent-queries} + +Nombre maximal de demandes traitées simultanément. + +**Exemple** + +``` xml +100 +``` + +## max\_connections {#max-connections} + +Le nombre maximal de connexions entrantes. + +**Exemple** + +``` xml +4096 +``` + +## max\_open\_files {#max-open-files} + +Le nombre maximal de fichiers ouverts. + +Par défaut: `maximum`. + +Nous vous recommandons d’utiliser cette option sous Mac OS X depuis le `getrlimit()` la fonction renvoie une valeur incorrecte. + +**Exemple** + +``` xml +262144 +``` + +## max\_table\_size\_to\_drop {#max-table-size-to-drop} + +Restriction sur la suppression de tables. + +Si la taille d’un [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) table dépasse `max_table_size_to_drop` (en octets), vous ne pouvez pas le supprimer à l’aide d’une requête DROP. + +Si vous devez toujours supprimer la table sans redémarrer le serveur ClickHouse, créez le `/flags/force_drop_table` fichier et exécutez la requête DROP. + +Valeur par défaut: 50 Go. + +La valeur 0 signifie que vous pouvez supprimer toutes les tables sans aucune restriction. + +**Exemple** + +``` xml +0 +``` + +## merge\_tree {#server_configuration_parameters-merge_tree} + +Réglage fin des tables dans le [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +Pour plus d’informations, consultez MergeTreeSettings.h fichier d’en-tête. + +**Exemple** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +Configuration client/serveur SSL. + +Le Support pour SSL est fourni par le `libpoco` bibliothèque. L’interface est décrite dans le fichier [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +Clés pour les paramètres Serveur/client: + +- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. +- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` contient le certificat. +- caConfig – The path to the file or directory that contains trusted root certificates. +- verificationMode – The method for checking the node’s certificates. Details are in the description of the [Cadre](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) classe. Valeurs possibles: `none`, `relaxed`, `strict`, `once`. +- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. +- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| +- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Les valeurs acceptables: `true`, `false`. +- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. Ce paramètre est toujours recommandé car il permet d’éviter les problèmes à la fois si le serveur met en cache la session et si le client demande la mise en cache. Valeur par défaut: `${application.name}`. +- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. +- sessionTimeout – Time for caching the session on the server. +- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. +- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. +- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. +- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . +- disableProtocols – Protocols that are not allowed to use. +- preferServerCiphers – Preferred server ciphers on the client. + +**Exemple de paramètres:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## part\_log {#server_configuration_parameters-part-log} + +Journalisation des événements associés à [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). Par exemple, ajouter ou fusionner des données. Vous pouvez utiliser le journal pour simuler des algorithmes de fusion et comparer leurs caractéristiques. Vous pouvez visualiser le processus de fusion. + +Les requêtes sont enregistrées dans le [système.part\_log](../../operations/system-tables.md#system_tables-part-log) table, pas dans un fichier séparé. Vous pouvez configurer le nom de cette table dans le `table` paramètre (voir ci-dessous). + +Utilisez les paramètres suivants pour configurer la journalisation: + +- `database` – Name of the database. +- `table` – Name of the system table. +- `partition_by` – Sets a [partitionnement personnalisé clé](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +**Exemple** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## chemin {#server_configuration_parameters-path} + +Chemin d’accès au répertoire contenant des données. + +!!! note "Note" + La barre oblique de fin est obligatoire. + +**Exemple** + +``` xml +/var/lib/clickhouse/ +``` + +## query\_log {#server_configuration_parameters-query-log} + +Réglage de la journalisation des requêtes reçues avec [log\_queries=1](../settings/settings.md) paramètre. + +Les requêtes sont enregistrées dans le [système.query\_log](../../operations/system-tables.md#system_tables-query_log) table, pas dans un fichier séparé. Vous pouvez modifier le nom de la table dans le `table` paramètre (voir ci-dessous). + +Utilisez les paramètres suivants pour configurer la journalisation: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [partitionnement personnalisé clé](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) pour une table. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +Si la table n’existe pas, ClickHouse la créera. Si la structure du journal des requêtes a été modifiée lors de la mise à jour du serveur ClickHouse, la table avec l’ancienne structure est renommée et une nouvelle table est créée automatiquement. + +**Exemple** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## query\_thread\_log {#server_configuration_parameters-query-thread-log} + +Réglage de la journalisation des threads de requêtes reçues avec [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) paramètre. + +Les requêtes sont enregistrées dans le [système.query\_thread\_log](../../operations/system-tables.md#system_tables-query-thread-log) table, pas dans un fichier séparé. Vous pouvez modifier le nom de la table dans le `table` paramètre (voir ci-dessous). + +Utilisez les paramètres suivants pour configurer la journalisation: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [partitionnement personnalisé clé](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) pour un système de tableau. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +Si la table n’existe pas, ClickHouse la créera. Si la structure du journal des threads de requête a été modifiée lors de la mise à jour du serveur ClickHouse, la table avec l’ancienne structure est renommée et une nouvelle table est créée automatiquement. + +**Exemple** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## trace\_log {#server_configuration_parameters-trace_log} + +Paramètres pour le [trace\_log](../../operations/system-tables.md#system_tables-trace_log) opération de table de système. + +Paramètre: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [Partitionnement personnalisé clé](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) pour un système de tableau. +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +Le fichier de configuration du serveur par défaut `config.xml` contient la section Paramètres suivante: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## query\_masking\_rules {#query-masking-rules} + +Règles basées sur Regexp, qui seront appliquées aux requêtes ainsi qu’à tous les messages de journal avant de les stocker dans les journaux du serveur, +`system.query_log`, `system.text_log`, `system.processes` table, et dans les journaux envoyés au client. Qui permet à la prévention de +fuite de données sensibles à partir de requêtes SQL (comme les noms, e-mails, +identificateurs ou numéros de carte de crédit) aux journaux. + +**Exemple** + +``` xml + + + hide SSN + (^|\D)\d{3}-\d{2}-\d{4}($|\D) + 000-00-0000 + + +``` + +Config champs: +- `name` - nom de la règle (facultatif) +- `regexp` - Expression régulière compatible RE2 (obligatoire) +- `replace` - chaîne de substitution pour les données sensibles (facultatif, par défaut - six astérisques) + +Les règles de masquage sont appliquées à l’ensemble de la requête (pour éviter les fuites de données sensibles provenant de requêtes malformées / Non analysables). + +`system.events` table ont compteur `QueryMaskingRulesMatch` qui ont un nombre global de requête de masquage des règles de correspondances. + +Pour les requêtes distribuées chaque serveur doivent être configurés séparément, sinon, les sous-requêtes transmises à d’autres +les nœuds seront stockés sans masquage. + +## remote\_servers {#server-settings-remote-servers} + +Configuration des clusters utilisés par le [Distribué](../../engines/table-engines/special/distributed.md) moteur de table et par le `cluster` table de fonction. + +**Exemple** + +``` xml + +``` + +Pour la valeur de l’ `incl` attribut, voir la section “[Fichiers de Configuration](../configuration-files.md#configuration_files)”. + +**Voir Aussi** + +- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) + +## fuseau {#server_configuration_parameters-timezone} + +Le fuseau horaire du serveur. + +Spécifié comme identifiant IANA pour le fuseau horaire UTC ou l’emplacement géographique (par exemple, Afrique / Abidjan). + +Le fuseau horaire est nécessaire pour les conversions entre les formats String et DateTime lorsque les champs DateTime sont sortis au format texte (imprimés à l’écran ou dans un fichier) et lors de L’obtention de DateTime à partir d’une chaîne. En outre, le fuseau horaire est utilisé dans les fonctions qui fonctionnent avec l’heure et la date si elles ne reçoivent pas le fuseau horaire dans les paramètres d’entrée. + +**Exemple** + +``` xml +Europe/Moscow +``` + +## tcp\_port {#server_configuration_parameters-tcp_port} + +Port pour communiquer avec les clients via le protocole TCP. + +**Exemple** + +``` xml +9000 +``` + +## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} + +Port TCP pour une communication sécurisée avec les clients. Utilisez le avec [OpenSSL](#server_configuration_parameters-openssl) paramètre. + +**Valeurs possibles** + +Entier positif. + +**Valeur par défaut** + +``` xml +9440 +``` + +## mysql\_port {#server_configuration_parameters-mysql_port} + +Port pour communiquer avec les clients via le protocole MySQL. + +**Valeurs possibles** + +Entier positif. + +Exemple + +``` xml +9004 +``` + +## tmp\_path {#server-settings-tmp_path} + +Chemin d’accès aux données temporaires pour le traitement des requêtes volumineuses. + +!!! note "Note" + La barre oblique de fin est obligatoire. + +**Exemple** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## tmp\_policy {#server-settings-tmp-policy} + +La politique de [`storage_configuration`](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) pour stocker des fichiers temporaires. +Si cela n’est pas [`tmp_path`](#server-settings-tmp_path) est utilisé, sinon elle est ignorée. + +!!! note "Note" + - `move_factor` est ignoré +- `keep_free_space_bytes` est ignoré +- `max_data_part_size_bytes` est ignoré +- vous devez avoir exactement un volume dans cette politique + +## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} + +Taille du Cache (en octets) pour les données non compressées utilisées par les [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +Il y a un cache partagé pour le serveur. La mémoire est allouée à la demande. Le cache est utilisé si l’option [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) est activé. + +Le cache non compressé est avantageux pour les requêtes très courtes dans des cas individuels. + +**Exemple** + +``` xml +8589934592 +``` + +## user\_files\_path {#server_configuration_parameters-user_files_path} + +Le répertoire avec les fichiers utilisateur. Utilisé dans la fonction de table [fichier()](../../sql-reference/table-functions/file.md). + +**Exemple** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## users\_config {#users-config} + +Chemin d’accès au fichier qui contient: + +- Les configurations de l’utilisateur. +- Les droits d’accès. +- Les paramètres des profils. +- Les paramètres de Quota. + +**Exemple** + +``` xml +users.xml +``` + +## zookeeper {#server-settings_zookeeper} + +Contient des paramètres qui permettent à ClickHouse d’interagir avec [ZooKeeper](http://zookeeper.apache.org/) cluster. + +ClickHouse utilise ZooKeeper pour stocker les métadonnées des répliques lors de l’utilisation de tables répliquées. Si les tables répliquées ne sont pas utilisées, cette section de paramètres peut être omise. + +Cette section contient les paramètres suivants: + +- `node` — ZooKeeper endpoint. You can set multiple endpoints. + + Exemple: + + + +``` xml + + example_host + 2181 + +``` + + The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. + +- `session_timeout` — Maximum timeout for the client session in milliseconds. +- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) qui est utilisé comme racine pour les znodes utilisés par le serveur ClickHouse. Facultatif. +- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. + +**Exemple de configuration** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + 10000 + + /path/to/zookeeper/node + + user:password + +``` + +**Voir Aussi** + +- [Réplication](../../engines/table-engines/mergetree-family/replication.md) +- [Guide du programmeur ZooKeeper](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} + +Méthode de stockage pour les en-têtes de partie de données dans ZooKeeper. + +Ce paramètre s’applique uniquement à l’ `MergeTree` famille. Il peut être spécifié: + +- À l’échelle mondiale dans le [merge\_tree](#server_configuration_parameters-merge_tree) la section de la `config.xml` fichier. + + ClickHouse utilise le paramètre pour toutes les tables du serveur. Vous pouvez modifier le réglage à tout moment. Les tables existantes changent de comportement lorsque le paramètre change. + +- Pour chaque table. + + Lors de la création d’un tableau, indiquer la [moteur de réglage](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). Le comportement d’une table existante avec ce paramètre ne change pas, même si le paramètre global des changements. + +**Valeurs possibles** + +- 0 — Functionality is turned off. +- 1 — Functionality is turned on. + +Si `use_minimalistic_part_header_in_zookeeper = 1`, puis [répliqué](../../engines/table-engines/mergetree-family/replication.md) les tables stockent les en-têtes des parties de données de manière compacte à l’aide `znode`. Si la table contient plusieurs colonnes, cette méthode de stockage réduit considérablement le volume des données stockées dans Zookeeper. + +!!! attention "Attention" + Après l’application de `use_minimalistic_part_header_in_zookeeper = 1`, vous ne pouvez pas rétrograder le serveur ClickHouse vers une version qui ne prend pas en charge ce paramètre. Soyez prudent lors de la mise à niveau de ClickHouse sur les serveurs d’un cluster. Ne mettez pas à niveau tous les serveurs à la fois. Il est plus sûr de tester de nouvelles versions de ClickHouse dans un environnement de test, ou sur quelques serveurs d’un cluster. + + Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. + +**Valeur par défaut:** 0. + +## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} + +Désactive le cache DNS interne. Recommandé pour l’utilisation de ClickHouse dans les systèmes +avec des infrastructures en constante évolution telles que Kubernetes. + +**Valeur par défaut:** 0. + +## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} + +La période de mise à jour des adresses IP stockées dans le cache DNS interne de ClickHouse (en secondes). +La mise à jour est effectuée de manière asynchrone, dans un thread système séparé. + +**Valeur par défaut**: 15. + +[Article Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/fr/operations/server_configuration_parameters/index.md b/docs/fr/operations/server_configuration_parameters/index.md deleted file mode 100644 index 04581bc4f17..00000000000 --- a/docs/fr/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Server Configuration Parameters -toc_priority: 54 -toc_title: Introduction ---- - -# Paramètres de configuration du serveur {#server-settings} - -Cette section contient des descriptions des paramètres du serveur qui ne peuvent pas être modifiés au niveau de la session ou de la requête. - -Ces paramètres sont stockés dans la `config.xml` fichier sur le serveur ClickHouse. - -D'autres paramètres sont décrits dans le “[Paramètre](../settings/index.md#settings)” section. - -Avant d'étudier les paramètres, lire la [Fichiers de Configuration](../configuration_files.md#configuration_files) section et notez l'utilisation de substitutions (le `incl` et `optional` attribut). - -[Article Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/fr/operations/server_configuration_parameters/settings.md b/docs/fr/operations/server_configuration_parameters/settings.md deleted file mode 100644 index eda744c384b..00000000000 --- a/docs/fr/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,872 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 57 -toc_title: "Les Param\xE8tres Du Serveur" ---- - -# Les Paramètres Du Serveur {#server-settings} - -## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} - -L'intervalle en secondes avant de recharger les dictionnaires intégrés. - -Clickhouse recharge les dictionnaires intégrés toutes les X secondes. Cela permet d'éditer des dictionnaires “on the fly” sans redémarrer le serveur. - -Valeur par défaut: 3600. - -**Exemple** - -``` xml -3600 -``` - -## compression {#server-settings-compression} - -Paramètres de compression de données pour [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-tables de moteur. - -!!! warning "Avertissement" - Ne l'utilisez pas si vous venez de commencer à utiliser ClickHouse. - -Modèle de Configuration: - -``` xml - - - ... - ... - ... - - ... - -``` - -`` Fields: - -- `min_part_size` – The minimum size of a data part. -- `min_part_size_ratio` – The ratio of the data part size to the table size. -- `method` – Compression method. Acceptable values: `lz4` ou `zstd`. - -Vous pouvez configurer plusieurs `` section. - -Actions lorsque les conditions sont remplies: - -- Si une partie de données correspond à un ensemble de conditions, ClickHouse utilise la méthode de compression spécifiée. -- Si une partie de données correspond à plusieurs ensembles de conditions, ClickHouse utilise le premier ensemble de conditions correspondant. - -Si aucune condition n'est remplie pour une partie de données, ClickHouse utilise `lz4` compression. - -**Exemple** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## default\_database {#default-database} - -La base de données par défaut. - -Pour obtenir une liste de bases de données, utilisez la [SHOW DATABASES](../../sql_reference/statements/show.md#show-databases) requête. - -**Exemple** - -``` xml -default -``` - -## default\_profile {#default-profile} - -Profil des paramètres par défaut. - -Les paramètres des profils sont situés dans le fichier spécifié dans le paramètre `user_config`. - -**Exemple** - -``` xml -default -``` - -## dictionaries\_config {#server_configuration_parameters-dictionaries_config} - -Chemin d'accès au fichier de configuration des dictionnaires externes. - -Chemin: - -- Spécifiez le chemin absolu ou le chemin relatif au fichier de configuration du serveur. -- Le chemin peut contenir des caractères génériques \* et ?. - -Voir aussi “[Dictionnaires externes](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)”. - -**Exemple** - -``` xml -*_dictionary.xml -``` - -## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} - -Chargement paresseux des dictionnaires. - -Si `true` chaque dictionnaire est créé lors de la première utilisation. Si la création du dictionnaire a échoué, la fonction qui utilisait le dictionnaire lève une exception. - -Si `false`, tous les dictionnaires sont créés lorsque le serveur démarre, et si il y a une erreur, le serveur s'arrête. - -La valeur par défaut est `true`. - -**Exemple** - -``` xml -true -``` - -## format\_schema\_path {#server_configuration_parameters-format_schema_path} - -Le chemin d'accès au répertoire avec des régimes pour l'entrée de données, tels que les schémas pour l' [CapnProto](../../interfaces/formats.md#capnproto) format. - -**Exemple** - -``` xml - - format_schemas/ -``` - -## graphite {#server_configuration_parameters-graphite} - -Envoi de données à [Graphite](https://github.com/graphite-project). - -Paramètre: - -- host – The Graphite server. -- port – The port on the Graphite server. -- interval – The interval for sending, in seconds. -- timeout – The timeout for sending data, in seconds. -- root\_path – Prefix for keys. -- metrics – Sending data from the [système.métrique](../../operations/system_tables.md#system_tables-metrics) table. -- events – Sending deltas data accumulated for the time period from the [système.événement](../../operations/system_tables.md#system_tables-events) table. -- events\_cumulative – Sending cumulative data from the [système.événement](../../operations/system_tables.md#system_tables-events) table. -- asynchronous\_metrics – Sending data from the [système.asynchronous\_metrics](../../operations/system_tables.md#system_tables-asynchronous_metrics) table. - -Vous pouvez configurer plusieurs `` clause. Par exemple, vous pouvez l'utiliser pour envoyer des données différentes à différents intervalles. - -**Exemple** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## graphite\_rollup {#server_configuration_parameters-graphite-rollup} - -Paramètres pour l'amincissement des données pour le Graphite. - -Pour plus de détails, voir [GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md). - -**Exemple** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## http\_port/https\_port {#http-porthttps-port} - -Port de connexion au serveur via HTTP(S). - -Si `https_port` est spécifié, [openSSL](#server_configuration_parameters-openssl) doit être configuré. - -Si `http_port` est spécifié, la configuration OpenSSL est ignorée même si elle est définie. - -**Exemple** - -``` xml -0000 -``` - -## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} - -Page affichée par défaut lorsque vous accédez au serveur HTTP(S) ClickHouse. -La valeur par défaut est “Ok.” (avec un saut de ligne à la fin) - -**Exemple** - -Ouvrir `https://tabix.io/` lors de l'accès à `http://localhost: http_port`. - -``` xml - -
]]> -
-``` - -## include\_from {#server_configuration_parameters-include_from} - -Le chemin d'accès au fichier avec des substitutions. - -Pour plus d'informations, consultez la section “[Fichiers de Configuration](../configuration_files.md#configuration_files)”. - -**Exemple** - -``` xml -/etc/metrica.xml -``` - -## interserver\_http\_port {#interserver-http-port} - -Port pour l'échange de données entre les serveurs ClickHouse. - -**Exemple** - -``` xml -9009 -``` - -## interserver\_http\_host {#interserver-http-host} - -Le nom d'hôte qui peut être utilisé par d'autres serveurs pour accéder à ce serveur. - -Si elle est omise, elle est définie de la même manière que `hostname-f` commande. - -Utile pour rompre avec une interface réseau spécifique. - -**Exemple** - -``` xml -example.yandex.ru -``` - -## interserver\_http\_credentials {#server-settings-interserver-http-credentials} - -Le nom d'utilisateur et le mot de passe utilisés pour [réplication](../../engines/table_engines/mergetree_family/replication.md) avec les moteurs \* répliqués. Ces informations d'identification sont utilisées uniquement pour la communication entre les répliques et ne sont pas liées aux informations d'identification des clients ClickHouse. Le serveur vérifie ces informations d'identification pour la connexion de répliques et utilise les mêmes informations d'identification lors de la connexion à d'autres répliques. Donc, ces informations d'identification doivent être identiques pour tous les réplicas dans un cluster. -Par défaut, l'authentification n'est pas utilisé. - -Cette section contient les paramètres suivants: - -- `user` — username. -- `password` — password. - -**Exemple** - -``` xml - - admin - 222 - -``` - -## keep\_alive\_timeout {#keep-alive-timeout} - -Le nombre de secondes que ClickHouse attend pour les demandes entrantes avant de fermer la connexion. Par défaut est de 3 secondes. - -**Exemple** - -``` xml -3 -``` - -## listen\_host {#server_configuration_parameters-listen_host} - -Restriction sur les hôtes dont les demandes peuvent provenir. Si vous voulez que le serveur réponde à tous, spécifiez `::`. - -Exemple: - -``` xml -::1 -127.0.0.1 -``` - -## enregistreur {#server_configuration_parameters-logger} - -Paramètres de journalisation. - -Touches: - -- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. -- log – The log file. Contains all the entries according to `level`. -- errorlog – Error log file. -- size – Size of the file. Applies to `log`et`errorlog`. Une fois que le fichier atteint `size`, Archives ClickHouse et le renomme, et crée un nouveau fichier journal à sa place. -- count – The number of archived log files that ClickHouse stores. - -**Exemple** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -L'écriture dans le syslog est également prise en charge. Exemple de Config: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -Touches: - -- use\_syslog — Required setting if you want to write to the syslog. -- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. -- hostname — Optional. The name of the host that logs are sent from. -- facility — [Le mot clé syslog facility](https://en.wikipedia.org/wiki/Syslog#Facility) en majuscules avec la “LOG\_” préfixe: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` et ainsi de suite). - Valeur par défaut: `LOG_USER` si `address` est spécifié, `LOG_DAEMON otherwise.` -- format – Message format. Possible values: `bsd` et `syslog.` - -## macro {#macros} - -Substitutions de paramètres pour les tables répliquées. - -Peut être omis si les tables répliquées ne sont pas utilisées. - -Pour plus d'informations, consultez la section “[Création de tables répliquées](../../engines/table_engines/mergetree_family/replication.md)”. - -**Exemple** - -``` xml - -``` - -## mark\_cache\_size {#server-mark-cache-size} - -Taille approximative (en octets) du cache des marques utilisées par les [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) famille. - -Le cache est partagé pour le serveur et la mémoire est allouée au besoin. La taille du cache doit être d'au moins 5368709120. - -**Exemple** - -``` xml -5368709120 -``` - -## max\_concurrent\_queries {#max-concurrent-queries} - -Nombre maximal de demandes traitées simultanément. - -**Exemple** - -``` xml -100 -``` - -## max\_connections {#max-connections} - -Le nombre maximal de connexions entrantes. - -**Exemple** - -``` xml -4096 -``` - -## max\_open\_files {#max-open-files} - -Le nombre maximal de fichiers ouverts. - -Par défaut: `maximum`. - -Nous vous recommandons d'utiliser cette option sous Mac OS X depuis le `getrlimit()` la fonction renvoie une valeur incorrecte. - -**Exemple** - -``` xml -262144 -``` - -## max\_table\_size\_to\_drop {#max-table-size-to-drop} - -Restriction sur la suppression de tables. - -Si la taille d'un [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) table dépasse `max_table_size_to_drop` (en octets), vous ne pouvez pas le supprimer à l'aide d'une requête DROP. - -Si vous devez toujours supprimer la table sans redémarrer le serveur ClickHouse, créez le `/flags/force_drop_table` fichier et exécutez la requête DROP. - -Valeur par défaut: 50 Go. - -La valeur 0 signifie que vous pouvez supprimer toutes les tables sans aucune restriction. - -**Exemple** - -``` xml -0 -``` - -## merge\_tree {#server_configuration_parameters-merge_tree} - -Réglage fin des tables dans le [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -Pour plus d'informations, consultez MergeTreeSettings.h fichier d'en-tête. - -**Exemple** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -Configuration client/serveur SSL. - -Le Support pour SSL est fourni par le `libpoco` bibliothèque. L'interface est décrite dans le fichier [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -Clés pour les paramètres Serveur/client: - -- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. -- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` contient le certificat. -- caConfig – The path to the file or directory that contains trusted root certificates. -- verificationMode – The method for checking the node's certificates. Details are in the description of the [Cadre](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) classe. Valeurs possibles: `none`, `relaxed`, `strict`, `once`. -- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. -- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| -- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Les valeurs acceptables: `true`, `false`. -- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. Ce paramètre est toujours recommandé car il permet d'éviter les problèmes à la fois si le serveur met en cache la session et si le client demande la mise en cache. Valeur par défaut: `${application.name}`. -- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. -- sessionTimeout – Time for caching the session on the server. -- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. -- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. -- fips – Activates OpenSSL FIPS mode. Supported if the library's OpenSSL version supports FIPS. -- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . -- disableProtocols – Protocols that are not allowed to use. -- preferServerCiphers – Preferred server ciphers on the client. - -**Exemple de paramètres:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## part\_log {#server_configuration_parameters-part-log} - -Journalisation des événements associés à [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). Par exemple, ajouter ou fusionner des données. Vous pouvez utiliser le journal pour simuler des algorithmes de fusion et comparer leurs caractéristiques. Vous pouvez visualiser le processus de fusion. - -Les requêtes sont enregistrées dans le [système.part\_log](../../operations/system_tables.md#system_tables-part-log) table, pas dans un fichier séparé. Vous pouvez configurer le nom de cette table dans le `table` paramètre (voir ci-dessous). - -Utilisez les paramètres suivants pour configurer la journalisation: - -- `database` – Name of the database. -- `table` – Name of the system table. -- `partition_by` – Sets a [partitionnement personnalisé clé](../../engines/table_engines/mergetree_family/custom_partitioning_key.md). -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -**Exemple** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## chemin {#server_configuration_parameters-path} - -Chemin d'accès au répertoire contenant des données. - -!!! note "Note" - La barre oblique de fin est obligatoire. - -**Exemple** - -``` xml -/var/lib/clickhouse/ -``` - -## query\_log {#server_configuration_parameters-query-log} - -Réglage de la journalisation des requêtes reçues avec [log\_queries=1](../settings/settings.md) paramètre. - -Les requêtes sont enregistrées dans le [système.query\_log](../../operations/system_tables.md#system_tables-query_log) table, pas dans un fichier séparé. Vous pouvez modifier le nom de la table dans le `table` paramètre (voir ci-dessous). - -Utilisez les paramètres suivants pour configurer la journalisation: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [partitionnement personnalisé clé](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) pour une table. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -Si la table n'existe pas, ClickHouse la créera. Si la structure du journal des requêtes a été modifiée lors de la mise à jour du serveur ClickHouse, la table avec l'ancienne structure est renommée et une nouvelle table est créée automatiquement. - -**Exemple** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## query\_thread\_log {#server_configuration_parameters-query-thread-log} - -Réglage de la journalisation des threads de requêtes reçues avec [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) paramètre. - -Les requêtes sont enregistrées dans le [système.query\_thread\_log](../../operations/system_tables.md#system_tables-query-thread-log) table, pas dans un fichier séparé. Vous pouvez modifier le nom de la table dans le `table` paramètre (voir ci-dessous). - -Utilisez les paramètres suivants pour configurer la journalisation: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [partitionnement personnalisé clé](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) pour un système de tableau. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -Si la table n'existe pas, ClickHouse la créera. Si la structure du journal des threads de requête a été modifiée lors de la mise à jour du serveur ClickHouse, la table avec l'ancienne structure est renommée et une nouvelle table est créée automatiquement. - -**Exemple** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## trace\_log {#server_configuration_parameters-trace_log} - -Paramètres pour le [trace\_log](../../operations/system_tables.md#system_tables-trace_log) opération de table de système. - -Paramètre: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [Partitionnement personnalisé clé](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) pour un système de tableau. -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -Le fichier de configuration du serveur par défaut `config.xml` contient la section Paramètres suivante: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## query\_masking\_rules {#query-masking-rules} - -Règles basées sur Regexp, qui seront appliquées aux requêtes ainsi qu'à tous les messages de journal avant de les stocker dans les journaux du serveur, -`system.query_log`, `system.text_log`, `system.processes` table, et dans les journaux envoyés au client. Qui permet à la prévention de -fuite de données sensibles à partir de requêtes SQL (comme les noms, e-mails, -identificateurs ou numéros de carte de crédit) aux journaux. - -**Exemple** - -``` xml - - - hide SSN - (^|\D)\d{3}-\d{2}-\d{4}($|\D) - 000-00-0000 - - -``` - -Config champs: -- `name` - nom de la règle (facultatif) -- `regexp` - Expression régulière compatible RE2 (obligatoire) -- `replace` - chaîne de substitution pour les données sensibles (facultatif, par défaut - six astérisques) - -Les règles de masquage sont appliquées à l'ensemble de la requête (pour éviter les fuites de données sensibles provenant de requêtes malformées / Non analysables). - -`system.events` table ont compteur `QueryMaskingRulesMatch` qui ont un nombre global de requête de masquage des règles de correspondances. - -Pour les requêtes distribuées chaque serveur doivent être configurés séparément, sinon, les sous-requêtes transmises à d'autres -les nœuds seront stockés sans masquage. - -## remote\_servers {#server-settings-remote-servers} - -Configuration des clusters utilisés par le [Distribué](../../engines/table_engines/special/distributed.md) moteur de table et par le `cluster` table de fonction. - -**Exemple** - -``` xml - -``` - -Pour la valeur de l' `incl` attribut, voir la section “[Fichiers de Configuration](../configuration_files.md#configuration_files)”. - -**Voir Aussi** - -- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) - -## fuseau {#server_configuration_parameters-timezone} - -Le fuseau horaire du serveur. - -Spécifié comme identifiant IANA pour le fuseau horaire UTC ou l'emplacement géographique (par exemple, Afrique / Abidjan). - -Le fuseau horaire est nécessaire pour les conversions entre les formats String et DateTime lorsque les champs DateTime sont sortis au format texte (imprimés à l'écran ou dans un fichier) et lors de L'obtention de DateTime à partir d'une chaîne. En outre, le fuseau horaire est utilisé dans les fonctions qui fonctionnent avec l'heure et la date si elles ne reçoivent pas le fuseau horaire dans les paramètres d'entrée. - -**Exemple** - -``` xml -Europe/Moscow -``` - -## tcp\_port {#server_configuration_parameters-tcp_port} - -Port pour communiquer avec les clients via le protocole TCP. - -**Exemple** - -``` xml -9000 -``` - -## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} - -Port TCP pour une communication sécurisée avec les clients. Utilisez le avec [OpenSSL](#server_configuration_parameters-openssl) paramètre. - -**Valeurs possibles** - -Entier positif. - -**Valeur par défaut** - -``` xml -9440 -``` - -## mysql\_port {#server_configuration_parameters-mysql_port} - -Port pour communiquer avec les clients via le protocole MySQL. - -**Valeurs possibles** - -Entier positif. - -Exemple - -``` xml -9004 -``` - -## tmp\_path {#server-settings-tmp_path} - -Chemin d'accès aux données temporaires pour le traitement des requêtes volumineuses. - -!!! note "Note" - La barre oblique de fin est obligatoire. - -**Exemple** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## tmp\_policy {#server-settings-tmp-policy} - -La politique de [`storage_configuration`](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) pour stocker des fichiers temporaires. -Si cela n'est pas [`tmp_path`](#server-settings-tmp_path) est utilisé, sinon elle est ignorée. - -!!! note "Note" - - `move_factor` est ignoré -- `keep_free_space_bytes` est ignoré -- `max_data_part_size_bytes` est ignoré -- vous devez avoir exactement un volume dans cette politique - -## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} - -Taille du Cache (en octets) pour les données non compressées utilisées par les [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -Il y a un cache partagé pour le serveur. La mémoire est allouée à la demande. Le cache est utilisé si l'option [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) est activé. - -Le cache non compressé est avantageux pour les requêtes très courtes dans des cas individuels. - -**Exemple** - -``` xml -8589934592 -``` - -## user\_files\_path {#server_configuration_parameters-user_files_path} - -Le répertoire avec les fichiers utilisateur. Utilisé dans la fonction de table [fichier()](../../sql_reference/table_functions/file.md). - -**Exemple** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## users\_config {#users-config} - -Chemin d'accès au fichier qui contient: - -- Les configurations de l'utilisateur. -- Les droits d'accès. -- Les paramètres des profils. -- Les paramètres de Quota. - -**Exemple** - -``` xml -users.xml -``` - -## zookeeper {#server-settings_zookeeper} - -Contient des paramètres qui permettent à ClickHouse d'interagir avec [ZooKeeper](http://zookeeper.apache.org/) cluster. - -ClickHouse utilise ZooKeeper pour stocker les métadonnées des répliques lors de l'utilisation de tables répliquées. Si les tables répliquées ne sont pas utilisées, cette section de paramètres peut être omise. - -Cette section contient les paramètres suivants: - -- `node` — ZooKeeper endpoint. You can set multiple endpoints. - - Exemple: - - - -``` xml - - example_host - 2181 - -``` - - The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. - -- `session_timeout` — Maximum timeout for the client session in milliseconds. -- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) qui est utilisé comme racine pour les znodes utilisés par le serveur ClickHouse. Facultatif. -- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. - -**Exemple de configuration** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - 10000 - - /path/to/zookeeper/node - - user:password - -``` - -**Voir Aussi** - -- [Réplication](../../engines/table_engines/mergetree_family/replication.md) -- [Guide du programmeur ZooKeeper](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} - -Méthode de stockage pour les en-têtes de partie de données dans ZooKeeper. - -Ce paramètre s'applique uniquement à l' `MergeTree` famille. Il peut être spécifié: - -- À l'échelle mondiale dans le [merge\_tree](#server_configuration_parameters-merge_tree) la section de la `config.xml` fichier. - - ClickHouse utilise le paramètre pour toutes les tables du serveur. Vous pouvez modifier le réglage à tout moment. Les tables existantes changent de comportement lorsque le paramètre change. - -- Pour chaque table. - - Lors de la création d'un tableau, indiquer la [moteur de réglage](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). Le comportement d'une table existante avec ce paramètre ne change pas, même si le paramètre global des changements. - -**Valeurs possibles** - -- 0 — Functionality is turned off. -- 1 — Functionality is turned on. - -Si `use_minimalistic_part_header_in_zookeeper = 1`, puis [répliqué](../../engines/table_engines/mergetree_family/replication.md) les tables stockent les en-têtes des parties de données de manière compacte à l'aide `znode`. Si la table contient plusieurs colonnes, cette méthode de stockage réduit considérablement le volume des données stockées dans Zookeeper. - -!!! attention "Attention" - Après l'application de `use_minimalistic_part_header_in_zookeeper = 1`, vous ne pouvez pas rétrograder le serveur ClickHouse vers une version qui ne prend pas en charge ce paramètre. Soyez prudent lors de la mise à niveau de ClickHouse sur les serveurs d'un cluster. Ne mettez pas à niveau tous les serveurs à la fois. Il est plus sûr de tester de nouvelles versions de ClickHouse dans un environnement de test, ou sur quelques serveurs d'un cluster. - - Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. - -**Valeur par défaut:** 0. - -## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} - -Désactive le cache DNS interne. Recommandé pour l'utilisation de ClickHouse dans les systèmes -avec des infrastructures en constante évolution telles que Kubernetes. - -**Valeur par défaut:** 0. - -## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} - -La période de mise à jour des adresses IP stockées dans le cache DNS interne de ClickHouse (en secondes). -La mise à jour est effectuée de manière asynchrone, dans un thread système séparé. - -**Valeur par défaut**: 15. - -[Article Original](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/fr/operations/settings/constraints-on-settings.md b/docs/fr/operations/settings/constraints-on-settings.md new file mode 100644 index 00000000000..b7e9e2cf79d --- /dev/null +++ b/docs/fr/operations/settings/constraints-on-settings.md @@ -0,0 +1,75 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 62 +toc_title: "Contraintes sur les param\xE8tres" +--- + +# Contraintes Sur Les paramètres {#constraints-on-settings} + +Les contraintes sur les paramètres peuvent être définis dans le `profiles` la section de la `user.xml` fichier de configuration et interdire aux utilisateurs de modifier certains `SET` requête. +Les contraintes sont définies comme suit: + +``` xml + + + + + lower_boundary + + + upper_boundary + + + lower_boundary + upper_boundary + + + + + + + +``` + +Si l’utilisateur tente de violer les contraintes une exception est levée et le réglage n’est pas modifié. +Trois types de contraintes sont pris en charge: `min`, `max`, `readonly`. Le `min` et `max` les contraintes spécifient les limites supérieure et inférieure pour un paramètre numérique et peuvent être utilisées en combinaison. Le `readonly` contrainte spécifie que l’utilisateur ne peut pas modifier le paramètre correspondant à tous. + +**Exemple:** Laisser `users.xml` comprend des lignes: + +``` xml + + + 10000000000 + 0 + ... + + + 5000000000 + 20000000000 + + + + + + + +``` + +Les requêtes suivantes toutes les exceptions throw: + +``` sql +SET max_memory_usage=20000000001; +SET max_memory_usage=4999999999; +SET force_index_by_date=1; +``` + +``` text +Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be greater than 20000000000. +Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be less than 5000000000. +Code: 452, e.displayText() = DB::Exception: Setting force_index_by_date should not be changed. +``` + +**Note:** le `default` le profil a une manipulation particulière: toutes les contraintes définies pour `default` le profil devient les contraintes par défaut, de sorte qu’ils restreignent tous les utilisateurs jusqu’à ce qu’ils soient explicitement remplacés pour ces utilisateurs. + +[Article Original](https://clickhouse.tech/docs/en/operations/settings/constraints_on_settings/) diff --git a/docs/fr/operations/settings/constraints_on_settings.md b/docs/fr/operations/settings/constraints_on_settings.md deleted file mode 100644 index 18094f50294..00000000000 --- a/docs/fr/operations/settings/constraints_on_settings.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 62 -toc_title: "Contraintes sur les param\xE8tres" ---- - -# Contraintes sur les paramètres {#constraints-on-settings} - -Les contraintes sur les paramètres peuvent être définis dans le `profiles` la section de la `user.xml` fichier de configuration et interdire aux utilisateurs de modifier certains `SET` requête. -Les contraintes sont définies comme suit: - -``` xml - - - - - lower_boundary - - - upper_boundary - - - lower_boundary - upper_boundary - - - - - - - -``` - -Si l'utilisateur tente de violer les contraintes une exception est levée et le réglage n'est pas modifié. -Trois types de contraintes sont pris en charge: `min`, `max`, `readonly`. Le `min` et `max` les contraintes spécifient les limites supérieure et inférieure pour un paramètre numérique et peuvent être utilisées en combinaison. Le `readonly` contrainte spécifie que l'utilisateur ne peut pas modifier le paramètre correspondant à tous. - -**Exemple:** Laisser `users.xml` comprend des lignes: - -``` xml - - - 10000000000 - 0 - ... - - - 5000000000 - 20000000000 - - - - - - - -``` - -Les requêtes suivantes toutes les exceptions throw: - -``` sql -SET max_memory_usage=20000000001; -SET max_memory_usage=4999999999; -SET force_index_by_date=1; -``` - -``` text -Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be greater than 20000000000. -Code: 452, e.displayText() = DB::Exception: Setting max_memory_usage should not be less than 5000000000. -Code: 452, e.displayText() = DB::Exception: Setting force_index_by_date should not be changed. -``` - -**Note:** le `default` le profil a une manipulation particulière: toutes les contraintes définies pour `default` le profil devient les contraintes par défaut, de sorte qu'ils restreignent tous les utilisateurs jusqu'à ce qu'ils soient explicitement remplacés pour ces utilisateurs. - -[Article Original](https://clickhouse.tech/docs/en/operations/settings/constraints_on_settings/) diff --git a/docs/fr/operations/settings/index.md b/docs/fr/operations/settings/index.md index b29aa8c011b..1d10d57a2da 100644 --- a/docs/fr/operations/settings/index.md +++ b/docs/fr/operations/settings/index.md @@ -13,9 +13,9 @@ Les paramètres sont configurés en couches, de sorte que chaque couche suivante Façons de configurer les paramètres, par ordre de priorité: -- Paramètres dans l' `users.xml` fichier de configuration du serveur. +- Paramètres dans l’ `users.xml` fichier de configuration du serveur. - Situé dans l'élément ``. + Situé dans l’élément ``. - Les paramètres de la Session. @@ -25,7 +25,7 @@ Façons de configurer les paramètres, par ordre de priorité: - Les paramètres de requête. - Lorsque vous démarrez le client clickhouse console en mode non interactif, définissez le paramètre startup `--setting=value`. - - Lors de l'utilisation de L'API HTTP, passez les paramètres CGI (`URL?setting_1=value&setting_2=value...`). + - Lors de l’utilisation de L’API HTTP, passez les paramètres CGI (`URL?setting_1=value&setting_2=value...`). Les paramètres qui ne peuvent être effectués que dans le fichier de configuration du serveur ne sont pas couverts dans cette section. diff --git a/docs/fr/operations/settings/permissions-for-queries.md b/docs/fr/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..4d014a3937a --- /dev/null +++ b/docs/fr/operations/settings/permissions-for-queries.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 58 +toc_title: "Autorisations pour les requ\xEAtes" +--- + +# Autorisations Pour Les requêtes {#permissions_for_queries} + +Les requêtes dans ClickHouse peuvent être divisées en plusieurs types: + +1. Lire les requêtes de données: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. Écrire des requêtes de données: `INSERT`, `OPTIMIZE`. +3. Modifier les paramètres requête: `SET`, `USE`. +4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) requête: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +Les paramètres suivants règlent les autorisations utilisateur selon le type de requête: + +- [ReadOnly](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. +- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. + +`KILL QUERY` peut être réalisée avec tous les paramètres. + +## ReadOnly {#settings_readonly} + +Restreint les autorisations pour lire des données, écrire des données et modifier les requêtes de paramètres. + +Voyez comment les requêtes sont divisées en types [surtout](#permissions_for_queries). + +Valeurs possibles: + +- 0 — All queries are allowed. +- 1 — Only read data queries are allowed. +- 2 — Read data and change settings queries are allowed. + +Après le réglage de `readonly = 1` l’utilisateur ne peut pas changer `readonly` et `allow_ddl` les paramètres de la session en cours. + +Lors de l’utilisation de la `GET` méthode dans le [Interface HTTP](../../interfaces/http.md), `readonly = 1` est définie automatiquement. Pour modifier les données, utilisez `POST` méthode. + +Paramètre `readonly = 1` interdire à l’utilisateur de modifier tous les paramètres. Il y a un moyen d’interdire à l’utilisateur +de modifier uniquement des paramètres spécifiques, pour plus de détails, voir [contraintes sur les paramètres](constraints-on-settings.md). + +Valeur par défaut: 0 + +## allow\_ddl {#settings_allow_ddl} + +Permet ou interdit [DDL](https://en.wikipedia.org/wiki/Data_definition_language) requête. + +Voyez comment les requêtes sont divisées en types [surtout](#permissions_for_queries). + +Valeurs possibles: + +- 0 — DDL queries are not allowed. +- 1 — DDL queries are allowed. + +Vous ne pouvez pas exécuter `SET allow_ddl = 1` si `allow_ddl = 0` pour la session en cours. + +Valeur par défaut: 1 + +[Article Original](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/fr/operations/settings/permissions_for_queries.md b/docs/fr/operations/settings/permissions_for_queries.md deleted file mode 100644 index e2b515e8d34..00000000000 --- a/docs/fr/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 58 -toc_title: "Autorisations pour les requ\xEAtes" ---- - -# Autorisations pour les requêtes {#permissions_for_queries} - -Les requêtes dans ClickHouse peuvent être divisées en plusieurs types: - -1. Lire les requêtes de données: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. Écrire des requêtes de données: `INSERT`, `OPTIMIZE`. -3. Modifier les paramètres requête: `SET`, `USE`. -4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) requête: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -Les paramètres suivants règlent les autorisations utilisateur selon le type de requête: - -- [ReadOnly](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. -- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. - -`KILL QUERY` peut être réalisée avec tous les paramètres. - -## ReadOnly {#settings_readonly} - -Restreint les autorisations pour lire des données, écrire des données et modifier les requêtes de paramètres. - -Voyez comment les requêtes sont divisées en types [surtout](#permissions_for_queries). - -Valeurs possibles: - -- 0 — All queries are allowed. -- 1 — Only read data queries are allowed. -- 2 — Read data and change settings queries are allowed. - -Après le réglage de `readonly = 1` l'utilisateur ne peut pas changer `readonly` et `allow_ddl` les paramètres de la session en cours. - -Lors de l'utilisation de la `GET` méthode dans le [Interface HTTP](../../interfaces/http.md), `readonly = 1` est définie automatiquement. Pour modifier les données, utilisez `POST` méthode. - -Paramètre `readonly = 1` interdire à l'utilisateur de modifier tous les paramètres. Il y a un moyen d'interdire à l'utilisateur -de modifier uniquement des paramètres spécifiques, pour plus de détails, voir [contraintes sur les paramètres](constraints_on_settings.md). - -Valeur par défaut: 0 - -## allow\_ddl {#settings_allow_ddl} - -Permet ou interdit [DDL](https://en.wikipedia.org/wiki/Data_definition_language) requête. - -Voyez comment les requêtes sont divisées en types [surtout](#permissions_for_queries). - -Valeurs possibles: - -- 0 — DDL queries are not allowed. -- 1 — DDL queries are allowed. - -Vous ne pouvez pas exécuter `SET allow_ddl = 1` si `allow_ddl = 0` pour la session en cours. - -Valeur par défaut: 1 - -[Article Original](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/fr/operations/settings/query-complexity.md b/docs/fr/operations/settings/query-complexity.md new file mode 100644 index 00000000000..c7cd26e1c16 --- /dev/null +++ b/docs/fr/operations/settings/query-complexity.md @@ -0,0 +1,301 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 59 +toc_title: "Restrictions sur la complexit\xE9 des requ\xEAtes" +--- + +# Restrictions Sur La Complexité Des Requêtes {#restrictions-on-query-complexity} + +Les Restrictions sur la complexité des requêtes font partie des paramètres. +Ils sont utilisés pour fournir une exécution plus sûre à partir de l’interface utilisateur. +Presque toutes les restrictions ne s’appliquent qu’à `SELECT`. Pour le traitement des requêtes distribuées, des restrictions sont appliquées sur chaque serveur séparément. + +ClickHouse vérifie les restrictions pour les parties de données, pas pour chaque ligne. Cela signifie que vous pouvez dépasser la valeur de restriction de la taille de la partie données. + +Restrictions sur l’ “maximum amount of something” peut prendre la valeur 0, ce qui signifie “unrestricted”. +La plupart des restrictions ont également un ‘overflow\_mode’ paramètre signification que faire lorsque la limite est dépassée. +Il peut prendre deux valeurs: `throw` ou `break`. Les Restrictions sur l’agrégation (group\_by\_overflow\_mode) ont également la valeur `any`. + +`throw` – Throw an exception (default). + +`break` – Stop executing the query and return the partial result, as if the source data ran out. + +`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. + +## max\_memory\_usage {#settings_max_memory_usage} + +La quantité maximale de RAM à utiliser pour exécuter une requête sur un seul serveur. + +Dans le fichier de configuration par défaut, le maximum est de 10 Go. + +Le réglage ne tient pas compte du volume de mémoire disponible ou du volume total de mémoire sur la machine. +La restriction s’applique à une seule requête au sein d’un seul serveur. +Vous pouvez utiliser `SHOW PROCESSLIST` pour vérifier la consommation de mémoire pour chaque requête. +En outre, la consommation de mémoire maximale est suivie pour chaque requête et écrite dans le journal. + +L’utilisation de la mémoire n’est pas surveillée pour les membres de certaines fonctions d’agrégation. + +L’utilisation de la mémoire n’est pas totalement suivies pour les états des fonctions d’agrégation `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` de `String` et `Array` argument. + +La consommation de mémoire est également limitée par les paramètres `max_memory_usage_for_user` et `max_memory_usage_for_all_queries`. + +## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} + +Quantité maximale de RAM à utiliser pour exécuter les requêtes d’un utilisateur sur un seul serveur. + +Les valeurs par défaut sont définies dans [Paramètre.h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L288). Par défaut, le montant n’est pas limité (`max_memory_usage_for_user = 0`). + +Voir aussi la description de [max\_memory\_usage](#settings_max_memory_usage). + +## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} + +La quantité maximale de RAM à utiliser pour exécuter toutes les requêtes sur un seul serveur. + +Les valeurs par défaut sont définies dans [Paramètre.h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L289). Par défaut, le montant n’est pas limité (`max_memory_usage_for_all_queries = 0`). + +Voir aussi la description de [max\_memory\_usage](#settings_max_memory_usage). + +## max\_rows\_to\_read {#max-rows-to-read} + +Les restrictions suivantes peut être vérifiée sur chaque bloc (au lieu de sur chaque ligne). Autrement dit, les restrictions peuvent être brisées un peu. +Lors de l’exécution d’une requête dans plusieurs threads, les restrictions suivantes s’appliquent à chaque thread séparément. + +Un nombre maximum de lignes pouvant être lues à partir d’un tableau lors de l’exécution d’une requête. + +## max\_bytes\_to\_read {#max-bytes-to-read} + +Nombre maximal d’octets (données non compressées) pouvant être lus à partir d’une table lors de l’exécution d’une requête. + +## read\_overflow\_mode {#read-overflow-mode} + +Que faire lorsque le volume de lecture de données dépasse l’une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. + +## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} + +Un nombre maximum de clés uniques reçues de l’agrégation. Ce paramètre permet de limiter la consommation de mémoire lors de l’agrégation. + +## group\_by\_overflow\_mode {#group-by-overflow-mode} + +Que faire lorsque le nombre de clés uniques pour l’agrégation dépasse la limite: ‘throw’, ‘break’, ou ‘any’. Par défaut, les jeter. +À l’aide de la ‘any’ valeur vous permet d’exécuter une approximation de GROUP BY. La qualité de cette approximation dépend de la nature statistique des données. + +## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} + +Active ou désactive l’exécution de `GROUP BY` clauses dans la mémoire externe. Voir [Groupe par dans la mémoire externe](../../sql-reference/statements/select.md#select-group-by-in-external-memory). + +Valeurs possibles: + +- Volume maximal de RAM (en octets) pouvant être utilisé par le [GROUP BY](../../sql-reference/statements/select.md#select-group-by-clause) opération. +- 0 — `GROUP BY` dans la mémoire externe désactivé. + +Valeur par défaut: 0. + +## max\_rows\_to\_sort {#max-rows-to-sort} + +Un nombre maximum de lignes avant le tri. Cela vous permet de limiter la consommation de mémoire lors du tri. + +## max\_bytes\_to\_sort {#max-bytes-to-sort} + +Un nombre maximal d’octets avant le tri. + +## sort\_overflow\_mode {#sort-overflow-mode} + +Que faire si le nombre de lignes reçues avant le tri dépasse l’une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. + +## max\_result\_rows {#setting-max_result_rows} + +Limite sur le nombre de lignes dans le résultat. Également vérifié pour les sous-requêtes, et sur des serveurs distants lors de l’exécution de parties d’une requête distribuée. + +## max\_result\_bytes {#max-result-bytes} + +Limite sur le nombre d’octets dans le résultat. Le même que le réglage précédent. + +## result\_overflow\_mode {#result-overflow-mode} + +Que faire si le volume du résultat dépasse l’une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. + +Utiliser ‘break’ est similaire à L’utilisation de LIMIT. `Break` interrompt l’exécution seulement au niveau du bloc. Cela signifie que la quantité de lignes renvoyées est supérieure à [max\_result\_rows](#setting-max_result_rows) multiples de [max\_block\_size](settings.md#setting-max_block_size) et dépend de l’ [max\_threads](settings.md#settings-max_threads). + +Exemple: + +``` sql +SET max_threads = 3, max_block_size = 3333; +SET max_result_rows = 3334, result_overflow_mode = 'break'; + +SELECT * +FROM numbers_mt(100000) +FORMAT Null; +``` + +Résultat: + +``` text +6666 rows in set. ... +``` + +## max\_execution\_time {#max-execution-time} + +Durée maximale d’exécution de la requête en secondes. +Pour le moment, il n’est pas vérifié pour l’une des étapes de tri, ni lors de la fusion et de la finalisation des fonctions d’agrégat. + +## timeout\_overflow\_mode {#timeout-overflow-mode} + +Que faire si la requête est exécutée plus de ‘max\_execution\_time’: ‘throw’ ou ‘break’. Par défaut, les jeter. + +## min\_execution\_speed {#min-execution-speed} + +Vitesse d’exécution minimale en lignes par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d’exécution est inférieure, une exception est levée. + +## min\_execution\_speed\_bytes {#min-execution-speed-bytes} + +Un nombre minimum d’exécution d’octets par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d’exécution est inférieure, une exception est levée. + +## max\_execution\_speed {#max-execution-speed} + +Un nombre maximal d’exécution de lignes par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d’exécution est élevée, la vitesse d’exécution sera réduit. + +## max\_execution\_speed\_bytes {#max-execution-speed-bytes} + +Un nombre maximal d’exécution d’octets par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d’exécution est élevée, la vitesse d’exécution sera réduit. + +## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} + +Vérifie que la vitesse d’exécution n’est pas trop lent (pas moins de ‘min\_execution\_speed’), après l’expiration du temps spécifié en secondes. + +## max\_columns\_to\_read {#max-columns-to-read} + +Nombre maximal de colonnes pouvant être lues à partir d’une table dans une seule requête. Si une requête nécessite la lecture d’un plus grand nombre de colonnes, il lève une exception. + +## max\_temporary\_columns {#max-temporary-columns} + +Nombre maximal de colonnes temporaires qui doivent être conservées en RAM en même temps lors de l’exécution d’une requête, y compris les colonnes constantes. S’il y a plus de colonnes temporaires que cela, il lève une exception. + +## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} + +La même chose que ‘max\_temporary\_columns’ mais sans compter constante colonnes. +Notez que les colonnes constantes sont formées assez souvent lors de l’exécution d’une requête, mais elles nécessitent environ zéro ressource informatique. + +## max\_subquery\_depth {#max-subquery-depth} + +Profondeur maximale de sous-requêtes. Si les sous-requêtes sont plus profondes, une exception est levée. Par défaut, 100. + +## max\_pipeline\_depth {#max-pipeline-depth} + +Profondeur maximale du pipeline. Correspond au nombre de transformations que chaque bloc de données lors du traitement des requêtes. Compté dans les limites d’un seul serveur. Si la profondeur du pipeline est supérieure, une exception est levée. Par défaut, 1000. + +## max\_ast\_depth {#max-ast-depth} + +Profondeur maximale d’une requête arbre syntaxique. En cas de dépassement, une exception est levée. +À ce moment, il n’est pas vérifié pendant l’analyse, mais seulement après l’analyse de la requête. Autrement dit, un arbre syntaxique trop profond peut être créé pendant l’analyse, mais la requête échouera. Par défaut, 1000. + +## max\_ast\_elements {#max-ast-elements} + +Un nombre maximal d’éléments dans une requête arbre syntaxique. En cas de dépassement, une exception est levée. +De la même manière que le paramètre précédent, il est vérifié qu’après l’analyse de la requête. Par défaut, 50 000. + +## max\_rows\_in\_set {#max-rows-in-set} + +Nombre maximal de lignes pour un ensemble de données dans la clause in créée à partir d’une sous-requête. + +## max\_bytes\_in\_set {#max-bytes-in-set} + +Nombre maximal d’octets (données non compressées) utilisés par un ensemble de la clause in créé à partir d’une sous-requête. + +## set\_overflow\_mode {#set-overflow-mode} + +Que faire lorsque la quantité de données dépasse l’une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. + +## max\_rows\_in\_distinct {#max-rows-in-distinct} + +Un nombre maximum de lignes différentes lors de L’utilisation de DISTINCT. + +## max\_bytes\_in\_distinct {#max-bytes-in-distinct} + +Nombre maximal d’octets utilisés par une table de hachage lors de L’utilisation de DISTINCT. + +## distinct\_overflow\_mode {#distinct-overflow-mode} + +Que faire lorsque la quantité de données dépasse l’une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. + +## max\_rows\_to\_transfer {#max-rows-to-transfer} + +Nombre maximal de lignes pouvant être transmises à un serveur distant ou enregistrées dans une table temporaire lors de L’utilisation de GLOBAL IN. + +## max\_bytes\_to\_transfer {#max-bytes-to-transfer} + +Nombre maximal d’octets (données non compressées) pouvant être transmis à un serveur distant ou enregistrés dans une table temporaire lors de L’utilisation de GLOBAL IN. + +## transfer\_overflow\_mode {#transfer-overflow-mode} + +Que faire lorsque la quantité de données dépasse l’une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. + +## max\_rows\_in\_join {#settings-max_rows_in_join} + +Limite le nombre de lignes dans la table de hachage utilisée lors de la jonction de tables. + +Ce réglage s’applique à [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) les opérations et les [Rejoindre](../../engines/table-engines/special/join.md) tableau moteur. + +Si une requête contient plusieurs jointures, ClickHouse vérifie ce paramètre pour chaque résultat intermédiaire. + +ClickHouse peut procéder à différentes actions lorsque la limite est atteinte. L’utilisation de la [join\_overflow\_mode](#settings-join_overflow_mode) réglage pour choisir l’action. + +Valeurs possibles: + +- Entier positif. +- 0 — Unlimited number of rows. + +Valeur par défaut: 0. + +## max\_bytes\_in\_join {#settings-max_bytes_in_join} + +Limite la taille en octets de la table de hachage utilisée lors de l’assemblage de tables. + +Ce réglage s’applique à [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) les opérations et les [Rejoindre le moteur de table](../../engines/table-engines/special/join.md). + +Si la requête contient des jointures, ClickHouse vérifie ce paramètre pour chaque résultat intermédiaire. + +ClickHouse peut procéder à différentes actions lorsque la limite est atteinte. Utiliser [join\_overflow\_mode](#settings-join_overflow_mode) paramètres pour choisir l’action. + +Valeurs possibles: + +- Entier positif. +- 0 — Memory control is disabled. + +Valeur par défaut: 0. + +## join\_overflow\_mode {#settings-join_overflow_mode} + +Définit l’action que ClickHouse effectue lorsque l’une des limites de jointure suivantes est atteinte: + +- [max\_bytes\_in\_join](#settings-max_bytes_in_join) +- [max\_rows\_in\_join](#settings-max_rows_in_join) + +Valeurs possibles: + +- `THROW` — ClickHouse throws an exception and breaks operation. +- `BREAK` — ClickHouse breaks operation and doesn’t throw an exception. + +Valeur par défaut: `THROW`. + +**Voir Aussi** + +- [Clause de JOINTURE](../../sql-reference/statements/select.md#select-join) +- [Rejoindre le moteur de table](../../engines/table-engines/special/join.md) + +## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} + +Limite le nombre maximal de partitions dans un seul bloc inséré. + +- Entier positif. +- 0 — Unlimited number of partitions. + +Valeur par défaut: 100. + +**Détail** + +Lors de l’insertion de données, ClickHouse calcule le nombre de partitions dans le bloc inséré. Si le nombre de partitions est plus que `max_partitions_per_insert_block`, ClickHouse lève une exception avec le texte suivant: + +> “Too many partitions for single INSERT block (more than” + toString (max\_parts) + “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” + +[Article Original](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/fr/operations/settings/query_complexity.md b/docs/fr/operations/settings/query_complexity.md deleted file mode 100644 index 9c5e0e2d923..00000000000 --- a/docs/fr/operations/settings/query_complexity.md +++ /dev/null @@ -1,301 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 59 -toc_title: "Restrictions sur la complexit\xE9 des requ\xEAtes" ---- - -# Restrictions Sur La Complexité Des Requêtes {#restrictions-on-query-complexity} - -Les Restrictions sur la complexité des requêtes font partie des paramètres. -Ils sont utilisés pour fournir une exécution plus sûre à partir de l'interface utilisateur. -Presque toutes les restrictions ne s'appliquent qu'à `SELECT`. Pour le traitement des requêtes distribuées, des restrictions sont appliquées sur chaque serveur séparément. - -ClickHouse vérifie les restrictions pour les parties de données, pas pour chaque ligne. Cela signifie que vous pouvez dépasser la valeur de restriction de la taille de la partie données. - -Restrictions sur l' “maximum amount of something” peut prendre la valeur 0, ce qui signifie “unrestricted”. -La plupart des restrictions ont également un ‘overflow\_mode’ paramètre signification que faire lorsque la limite est dépassée. -Il peut prendre deux valeurs: `throw` ou `break`. Les Restrictions sur l'agrégation (group\_by\_overflow\_mode) ont également la valeur `any`. - -`throw` – Throw an exception (default). - -`break` – Stop executing the query and return the partial result, as if the source data ran out. - -`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don't add new keys to the set. - -## max\_memory\_usage {#settings_max_memory_usage} - -La quantité maximale de RAM à utiliser pour exécuter une requête sur un seul serveur. - -Dans le fichier de configuration par défaut, le maximum est de 10 Go. - -Le réglage ne tient pas compte du volume de mémoire disponible ou du volume total de mémoire sur la machine. -La restriction s'applique à une seule requête au sein d'un seul serveur. -Vous pouvez utiliser `SHOW PROCESSLIST` pour vérifier la consommation de mémoire pour chaque requête. -En outre, la consommation de mémoire maximale est suivie pour chaque requête et écrite dans le journal. - -L'utilisation de la mémoire n'est pas surveillée pour les membres de certaines fonctions d'agrégation. - -L'utilisation de la mémoire n'est pas totalement suivies pour les états des fonctions d'agrégation `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` de `String` et `Array` argument. - -La consommation de mémoire est également limitée par les paramètres `max_memory_usage_for_user` et `max_memory_usage_for_all_queries`. - -## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} - -Quantité maximale de RAM à utiliser pour exécuter les requêtes d'un utilisateur sur un seul serveur. - -Les valeurs par défaut sont définies dans [Paramètre.h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L288). Par défaut, le montant n'est pas limité (`max_memory_usage_for_user = 0`). - -Voir aussi la description de [max\_memory\_usage](#settings_max_memory_usage). - -## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} - -La quantité maximale de RAM à utiliser pour exécuter toutes les requêtes sur un seul serveur. - -Les valeurs par défaut sont définies dans [Paramètre.h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L289). Par défaut, le montant n'est pas limité (`max_memory_usage_for_all_queries = 0`). - -Voir aussi la description de [max\_memory\_usage](#settings_max_memory_usage). - -## max\_rows\_to\_read {#max-rows-to-read} - -Les restrictions suivantes peut être vérifiée sur chaque bloc (au lieu de sur chaque ligne). Autrement dit, les restrictions peuvent être brisées un peu. -Lors de l'exécution d'une requête dans plusieurs threads, les restrictions suivantes s'appliquent à chaque thread séparément. - -Un nombre maximum de lignes pouvant être lues à partir d'un tableau lors de l'exécution d'une requête. - -## max\_bytes\_to\_read {#max-bytes-to-read} - -Nombre maximal d'octets (données non compressées) pouvant être lus à partir d'une table lors de l'exécution d'une requête. - -## read\_overflow\_mode {#read-overflow-mode} - -Que faire lorsque le volume de lecture de données dépasse l'une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. - -## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} - -Un nombre maximum de clés uniques reçues de l'agrégation. Ce paramètre permet de limiter la consommation de mémoire lors de l'agrégation. - -## group\_by\_overflow\_mode {#group-by-overflow-mode} - -Que faire lorsque le nombre de clés uniques pour l'agrégation dépasse la limite: ‘throw’, ‘break’, ou ‘any’. Par défaut, les jeter. -À l'aide de la ‘any’ valeur vous permet d'exécuter une approximation de GROUP BY. La qualité de cette approximation dépend de la nature statistique des données. - -## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} - -Active ou désactive l'exécution de `GROUP BY` clauses dans la mémoire externe. Voir [Groupe par dans la mémoire externe](../../sql_reference/statements/select.md#select-group-by-in-external-memory). - -Valeurs possibles: - -- Volume maximal de RAM (en octets) pouvant être utilisé par le [GROUP BY](../../sql_reference/statements/select.md#select-group-by-clause) opération. -- 0 — `GROUP BY` dans la mémoire externe désactivé. - -Valeur par défaut: 0. - -## max\_rows\_to\_sort {#max-rows-to-sort} - -Un nombre maximum de lignes avant le tri. Cela vous permet de limiter la consommation de mémoire lors du tri. - -## max\_bytes\_to\_sort {#max-bytes-to-sort} - -Un nombre maximal d'octets avant le tri. - -## sort\_overflow\_mode {#sort-overflow-mode} - -Que faire si le nombre de lignes reçues avant le tri dépasse l'une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. - -## max\_result\_rows {#setting-max_result_rows} - -Limite sur le nombre de lignes dans le résultat. Également vérifié pour les sous-requêtes, et sur des serveurs distants lors de l'exécution de parties d'une requête distribuée. - -## max\_result\_bytes {#max-result-bytes} - -Limite sur le nombre d'octets dans le résultat. Le même que le réglage précédent. - -## result\_overflow\_mode {#result-overflow-mode} - -Que faire si le volume du résultat dépasse l'une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. - -Utiliser ‘break’ est similaire à L'utilisation de LIMIT. `Break` interrompt l'exécution seulement au niveau du bloc. Cela signifie que la quantité de lignes renvoyées est supérieure à [max\_result\_rows](#setting-max_result_rows) multiples de [max\_block\_size](settings.md#setting-max_block_size) et dépend de l' [max\_threads](settings.md#settings-max_threads). - -Exemple: - -``` sql -SET max_threads = 3, max_block_size = 3333; -SET max_result_rows = 3334, result_overflow_mode = 'break'; - -SELECT * -FROM numbers_mt(100000) -FORMAT Null; -``` - -Résultat: - -``` text -6666 rows in set. ... -``` - -## max\_execution\_time {#max-execution-time} - -Durée maximale d'exécution de la requête en secondes. -Pour le moment, il n'est pas vérifié pour l'une des étapes de tri, ni lors de la fusion et de la finalisation des fonctions d'agrégat. - -## timeout\_overflow\_mode {#timeout-overflow-mode} - -Que faire si la requête est exécutée plus de ‘max\_execution\_time’: ‘throw’ ou ‘break’. Par défaut, les jeter. - -## min\_execution\_speed {#min-execution-speed} - -Vitesse d'exécution minimale en lignes par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d'exécution est inférieure, une exception est levée. - -## min\_execution\_speed\_bytes {#min-execution-speed-bytes} - -Un nombre minimum d'exécution d'octets par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d'exécution est inférieure, une exception est levée. - -## max\_execution\_speed {#max-execution-speed} - -Un nombre maximal d'exécution de lignes par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d'exécution est élevée, la vitesse d'exécution sera réduit. - -## max\_execution\_speed\_bytes {#max-execution-speed-bytes} - -Un nombre maximal d'exécution d'octets par seconde. Vérifié sur chaque bloc de données quand ‘timeout\_before\_checking\_execution\_speed’ expirer. Si la vitesse d'exécution est élevée, la vitesse d'exécution sera réduit. - -## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} - -Vérifie que la vitesse d'exécution n'est pas trop lent (pas moins de ‘min\_execution\_speed’), après l'expiration du temps spécifié en secondes. - -## max\_columns\_to\_read {#max-columns-to-read} - -Nombre maximal de colonnes pouvant être lues à partir d'une table dans une seule requête. Si une requête nécessite la lecture d'un plus grand nombre de colonnes, il lève une exception. - -## max\_temporary\_columns {#max-temporary-columns} - -Nombre maximal de colonnes temporaires qui doivent être conservées en RAM en même temps lors de l'exécution d'une requête, y compris les colonnes constantes. S'il y a plus de colonnes temporaires que cela, il lève une exception. - -## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} - -La même chose que ‘max\_temporary\_columns’ mais sans compter constante colonnes. -Notez que les colonnes constantes sont formées assez souvent lors de l'exécution d'une requête, mais elles nécessitent environ zéro ressource informatique. - -## max\_subquery\_depth {#max-subquery-depth} - -Profondeur maximale de sous-requêtes. Si les sous-requêtes sont plus profondes, une exception est levée. Par défaut, 100. - -## max\_pipeline\_depth {#max-pipeline-depth} - -Profondeur maximale du pipeline. Correspond au nombre de transformations que chaque bloc de données lors du traitement des requêtes. Compté dans les limites d'un seul serveur. Si la profondeur du pipeline est supérieure, une exception est levée. Par défaut, 1000. - -## max\_ast\_depth {#max-ast-depth} - -Profondeur maximale d'une requête arbre syntaxique. En cas de dépassement, une exception est levée. -À ce moment, il n'est pas vérifié pendant l'analyse, mais seulement après l'analyse de la requête. Autrement dit, un arbre syntaxique trop profond peut être créé pendant l'analyse, mais la requête échouera. Par défaut, 1000. - -## max\_ast\_elements {#max-ast-elements} - -Un nombre maximal d'éléments dans une requête arbre syntaxique. En cas de dépassement, une exception est levée. -De la même manière que le paramètre précédent, il est vérifié qu'après l'analyse de la requête. Par défaut, 50 000. - -## max\_rows\_in\_set {#max-rows-in-set} - -Nombre maximal de lignes pour un ensemble de données dans la clause in créée à partir d'une sous-requête. - -## max\_bytes\_in\_set {#max-bytes-in-set} - -Nombre maximal d'octets (données non compressées) utilisés par un ensemble de la clause in créé à partir d'une sous-requête. - -## set\_overflow\_mode {#set-overflow-mode} - -Que faire lorsque la quantité de données dépasse l'une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. - -## max\_rows\_in\_distinct {#max-rows-in-distinct} - -Un nombre maximum de lignes différentes lors de L'utilisation de DISTINCT. - -## max\_bytes\_in\_distinct {#max-bytes-in-distinct} - -Nombre maximal d'octets utilisés par une table de hachage lors de L'utilisation de DISTINCT. - -## distinct\_overflow\_mode {#distinct-overflow-mode} - -Que faire lorsque la quantité de données dépasse l'une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. - -## max\_rows\_to\_transfer {#max-rows-to-transfer} - -Nombre maximal de lignes pouvant être transmises à un serveur distant ou enregistrées dans une table temporaire lors de L'utilisation de GLOBAL IN. - -## max\_bytes\_to\_transfer {#max-bytes-to-transfer} - -Nombre maximal d'octets (données non compressées) pouvant être transmis à un serveur distant ou enregistrés dans une table temporaire lors de L'utilisation de GLOBAL IN. - -## transfer\_overflow\_mode {#transfer-overflow-mode} - -Que faire lorsque la quantité de données dépasse l'une des limites: ‘throw’ ou ‘break’. Par défaut, les jeter. - -## max\_rows\_in\_join {#settings-max_rows_in_join} - -Limite le nombre de lignes dans la table de hachage utilisée lors de la jonction de tables. - -Ce réglage s'applique à [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) les opérations et les [Rejoindre](../../engines/table_engines/special/join.md) tableau moteur. - -Si une requête contient plusieurs jointures, ClickHouse vérifie ce paramètre pour chaque résultat intermédiaire. - -ClickHouse peut procéder à différentes actions lorsque la limite est atteinte. L'utilisation de la [join\_overflow\_mode](#settings-join_overflow_mode) réglage pour choisir l'action. - -Valeurs possibles: - -- Entier positif. -- 0 — Unlimited number of rows. - -Valeur par défaut: 0. - -## max\_bytes\_in\_join {#settings-max_bytes_in_join} - -Limite la taille en octets de la table de hachage utilisée lors de l'assemblage de tables. - -Ce réglage s'applique à [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) les opérations et les [Rejoindre le moteur de table](../../engines/table_engines/special/join.md). - -Si la requête contient des jointures, ClickHouse vérifie ce paramètre pour chaque résultat intermédiaire. - -ClickHouse peut procéder à différentes actions lorsque la limite est atteinte. Utiliser [join\_overflow\_mode](#settings-join_overflow_mode) paramètres pour choisir l'action. - -Valeurs possibles: - -- Entier positif. -- 0 — Memory control is disabled. - -Valeur par défaut: 0. - -## join\_overflow\_mode {#settings-join_overflow_mode} - -Définit l'action que ClickHouse effectue lorsque l'une des limites de jointure suivantes est atteinte: - -- [max\_bytes\_in\_join](#settings-max_bytes_in_join) -- [max\_rows\_in\_join](#settings-max_rows_in_join) - -Valeurs possibles: - -- `THROW` — ClickHouse throws an exception and breaks operation. -- `BREAK` — ClickHouse breaks operation and doesn't throw an exception. - -Valeur par défaut: `THROW`. - -**Voir Aussi** - -- [Clause de JOINTURE](../../sql_reference/statements/select.md#select-join) -- [Rejoindre le moteur de table](../../engines/table_engines/special/join.md) - -## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} - -Limite le nombre maximal de partitions dans un seul bloc inséré. - -- Entier positif. -- 0 — Unlimited number of partitions. - -Valeur par défaut: 100. - -**Détail** - -Lors de l'insertion de données, ClickHouse calcule le nombre de partitions dans le bloc inséré. Si le nombre de partitions est plus que `max_partitions_per_insert_block`, ClickHouse lève une exception avec le texte suivant: - -> “Too many partitions for single INSERT block (more than” + toString (max\_parts) + “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” - -[Article Original](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/fr/operations/settings/settings-profiles.md b/docs/fr/operations/settings/settings-profiles.md new file mode 100644 index 00000000000..93da554cee5 --- /dev/null +++ b/docs/fr/operations/settings/settings-profiles.md @@ -0,0 +1,71 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 61 +toc_title: "Les Param\xE8tres Des Profils" +--- + +# Les Paramètres Des Profils {#settings-profiles} + +Un profil de paramètres est une collection de paramètres regroupés sous le même nom. Chaque utilisateur de ClickHouse a un profil. +Pour appliquer tous les paramètres d’un profil, définissez `profile` paramètre. + +Exemple: + +Installer le `web` profil. + +``` sql +SET profile = 'web' +``` + +Les profils de paramètres sont déclarés dans le fichier de configuration utilisateur. Ce n’est généralement `users.xml`. + +Exemple: + +``` xml + + + + + + 8 + + + + + 1000000000 + 100000000000 + + 1000000 + any + + 1000000 + 1000000000 + + 100000 + 100000000 + break + + 600 + 1000000 + 15 + + 25 + 100 + 50 + + 2 + 25 + 50 + 100 + + 1 + + +``` + +L’exemple spécifie deux profils: `default` et `web`. Le `default` profil a un but particulier: il doit toujours être présent et est appliquée lors du démarrage du serveur. En d’autres termes, l’ `default` profil contient les paramètres par défaut. Le `web` profil est un profil régulier qui peut être défini à l’aide `SET` requête ou en utilisant un paramètre URL dans une requête HTTP. + +Paramètres les profils peuvent hériter les uns des autres. Pour utiliser l’héritage, indiquer un ou plusieurs `profile` paramètres avant les autres paramètres répertoriés dans le profil. Dans le cas où un paramètre est défini dans les différents profils, les dernières définie est utilisée. + +[Article Original](https://clickhouse.tech/docs/en/operations/settings/settings_profiles/) diff --git a/docs/fr/operations/settings/settings-users.md b/docs/fr/operations/settings/settings-users.md new file mode 100644 index 00000000000..6256c6002e5 --- /dev/null +++ b/docs/fr/operations/settings/settings-users.md @@ -0,0 +1,148 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 63 +toc_title: "Les Param\xE8tres De L'Utilisateur" +--- + +# Les Paramètres De L’Utilisateur {#user-settings} + +Le `users` la section de la `user.xml` le fichier de configuration contient les paramètres utilisateur. + +La Structure de la `users` section: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### nom\_utilisateur/mot de passe {#user-namepassword} + +Le mot de passe peut être spécifié en texte clair ou en SHA256 (format hexadécimal). + +- Pour attribuer un mot de passe en clair (**pas recommandé**), la placer dans un `password` élément. + + Exemple, `qwerty`. Le mot de passe peut être laissé en blanc. + + + +- Pour attribuer un mot de passe à l’aide de son hachage SHA256, placez-le dans un `password_sha256_hex` élément. + + Exemple, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + Exemple de génération d’un mot de passe à partir du shell: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + + La première ligne du résultat est le mot de passe. La deuxième ligne est le hachage SHA256 correspondant. + + + +- Pour la compatibilité avec les clients MySQL, le mot de passe peut être spécifié dans le hachage double SHA1. Le placer dans `password_double_sha1_hex` élément. + + Exemple, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + Exemple de génération d’un mot de passe à partir du shell: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + + La première ligne du résultat est le mot de passe. La deuxième ligne est le double hachage SHA1 correspondant. + +### nom\_utilisateur / réseaux {#user-namenetworks} + +Liste des réseaux à partir desquels L’utilisateur peut se connecter au serveur ClickHouse. + +Chaque élément de la liste peut avoir l’une des formes suivantes: + +- `` — IP address or network mask. + + Exemple: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Hostname. + + Exemple: `example01.host.ru`. + + Pour vérifier l’accès, une requête DNS est effectuée et toutes les adresses IP renvoyées sont comparées à l’adresse homologue. + +- `` — Regular expression for hostnames. + + Exemple, `^example\d\d-\d\d-\d\.host\.ru$` + + Pour vérifier l’accès, un [Requête DNS PTR](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) est effectuée pour l’adresse homologue, puis l’expression rationnelle spécifiée est appliquée. Ensuite, une autre requête DNS est effectuée pour les résultats de la requête PTR et toutes les adresses reçues sont comparées à l’adresse homologue. Nous recommandons fortement que regexp se termine avec $. + +Tous les résultats des requêtes DNS sont mis en cache jusqu’au redémarrage du serveur. + +**Exemple** + +Pour ouvrir l’accès de l’utilisateur à partir de n’importe quel réseau, spécifiez: + +``` xml +::/0 +``` + +!!! warning "Avertissement" + Il n’est pas sûr d’ouvrir l’accès à partir de n’importe quel réseau, sauf si vous avez un pare-feu correctement configuré ou si le serveur n’est pas directement connecté à Internet. + +Pour ouvrir l’accès uniquement à partir de localhost, spécifier: + +``` xml +::1 +127.0.0.1 +``` + +### nom\_utilisateur / profil {#user-nameprofile} + +Vous pouvez attribuer un profil des paramètres pour l’utilisateur. Les profils de paramètres sont configurés dans une section distincte du `users.xml` fichier. Pour plus d’informations, voir [Profils des paramètres](settings-profiles.md). + +### nom\_utilisateur / quota {#user-namequota} + +Les Quotas vous permettent de suivre ou de limiter l’utilisation des ressources sur une période donnée. Les Quotas sont configurés dans le `quotas` +la section de la `users.xml` fichier de configuration. + +Vous pouvez attribuer un jeu de quotas à l’utilisateur. Pour une description détaillée de la configuration des quotas, voir [Quota](../quotas.md#quotas). + +### nom\_utilisateur/bases de données {#user-namedatabases} + +Dans cette section, vous pouvez limiter les lignes renvoyées par ClickHouse pour `SELECT` requêtes faites par l’utilisateur actuel, implémentant ainsi la sécurité de base au niveau de la ligne. + +**Exemple** + +La configuration suivante force cet utilisateur `user1` ne peut voir les lignes de `table1` comme le résultat de `SELECT` requêtes, où la valeur de la `id` le champ est 1000. + +``` xml + + + + + id = 1000 + + + + +``` + +Le `filter` peut être n’importe quelle expression résultant en un [UInt8](../../sql-reference/data-types/int-uint.md)-le type de la valeur. Il contient généralement des comparaisons et des opérateurs logiques. Les lignes de `database_name.table1` où filtrer les résultats à 0 ne sont pas retournés pour cet utilisateur. Le filtrage est incompatible avec `PREWHERE` opérations et désactive `WHERE→PREWHERE` optimisation. + +[Article Original](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/fr/operations/settings/settings.md b/docs/fr/operations/settings/settings.md index 8de3ea3e7d5..9def3a8522e 100644 --- a/docs/fr/operations/settings/settings.md +++ b/docs/fr/operations/settings/settings.md @@ -9,16 +9,16 @@ toc_title: "Param\xE8tre" ## distributed\_product\_mode {#distributed-product-mode} -Modifie le comportement de [distribués sous-requêtes](../../sql_reference/statements/select.md). +Modifie le comportement de [distribués sous-requêtes](../../sql-reference/statements/select.md). ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table. Restriction: - Uniquement appliqué pour les sous-requêtes IN et JOIN. -- Uniquement si la section FROM utilise une table distribuée contenant plus d'un fragment. -- Si la sous-requête concerne un distribué tableau contenant plus d'un fragment. -- Pas utilisé pour une table [distant](../../sql_reference/table_functions/remote.md) fonction. +- Uniquement si la section FROM utilise une table distribuée contenant plus d’un fragment. +- Si la sous-requête concerne un distribué tableau contenant plus d’un fragment. +- Pas utilisé pour une table [distant](../../sql-reference/table-functions/remote.md) fonction. Valeurs possibles: @@ -47,43 +47,43 @@ Considérez les requêtes suivantes: 1. `SELECT count() FROM test_table WHERE date = '2018-10-10'` 2. `SELECT count() FROM (SELECT * FROM test_table) WHERE date = '2018-10-10'` -Si `enable_optimize_predicate_expression = 1`, alors le temps d'exécution de ces requêtes est égal car ClickHouse s'applique `WHERE` à la sous-requête lors du traitement. +Si `enable_optimize_predicate_expression = 1`, alors le temps d’exécution de ces requêtes est égal car ClickHouse s’applique `WHERE` à la sous-requête lors du traitement. -Si `enable_optimize_predicate_expression = 0` puis le temps d'exécution de la deuxième requête est beaucoup plus long, parce que le `WHERE` la clause s'applique à toutes les données après la sous-requête des finitions. +Si `enable_optimize_predicate_expression = 0` puis le temps d’exécution de la deuxième requête est beaucoup plus long, parce que le `WHERE` la clause s’applique à toutes les données après la sous-requête des finitions. ## fallback\_to\_stale\_replicas\_for\_distributed\_queries {#settings-fallback_to_stale_replicas_for_distributed_queries} -Force une requête à un réplica obsolète si les données mises à jour ne sont pas disponibles. Voir [Réplication](../../engines/table_engines/mergetree_family/replication.md). +Force une requête à un réplica obsolète si les données mises à jour ne sont pas disponibles. Voir [Réplication](../../engines/table-engines/mergetree-family/replication.md). ClickHouse sélectionne le plus pertinent parmi les répliques obsolètes de la table. -Utilisé lors de l'exécution `SELECT` à partir d'une table distribuée qui pointe vers des tables répliquées. +Utilisé lors de l’exécution `SELECT` à partir d’une table distribuée qui pointe vers des tables répliquées. Par défaut, 1 (activé). ## force\_index\_by\_date {#settings-force_index_by_date} -Désactive l'exécution de la requête si l'index ne peut pas être utilisé par jour. +Désactive l’exécution de la requête si l’index ne peut pas être utilisé par jour. Fonctionne avec les tables de la famille MergeTree. -Si `force_index_by_date=1`, Clickhouse vérifie si la requête a une condition de clé de date qui peut être utilisée pour restreindre les plages de données. S'il n'y a pas de condition appropriée, il lève une exception. Cependant, il ne vérifie pas si la condition réduit la quantité de données à lire. Par exemple, la condition `Date != ' 2000-01-01 '` est acceptable même lorsqu'il correspond à toutes les données de la table (c'est-à-dire que l'exécution de la requête nécessite une analyse complète). Pour plus d'informations sur les plages de données dans les tables MergeTree, voir [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +Si `force_index_by_date=1`, Clickhouse vérifie si la requête a une condition de clé de date qui peut être utilisée pour restreindre les plages de données. S’il n’y a pas de condition appropriée, il lève une exception. Cependant, il ne vérifie pas si la condition réduit la quantité de données à lire. Par exemple, la condition `Date != ' 2000-01-01 '` est acceptable même lorsqu’il correspond à toutes les données de la table (c’est-à-dire que l’exécution de la requête nécessite une analyse complète). Pour plus d’informations sur les plages de données dans les tables MergeTree, voir [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## force\_primary\_key {#force-primary-key} -Désactive l'exécution de la requête si l'indexation par la clé primaire n'est pas possible. +Désactive l’exécution de la requête si l’indexation par la clé primaire n’est pas possible. Fonctionne avec les tables de la famille MergeTree. -Si `force_primary_key=1`, Clickhouse vérifie si la requête a une condition de clé primaire qui peut être utilisée pour restreindre les plages de données. S'il n'y a pas de condition appropriée, il lève une exception. Cependant, il ne vérifie pas si la condition réduit la quantité de données à lire. Pour plus d'informations sur les plages de données dans les tables MergeTree, voir [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +Si `force_primary_key=1`, Clickhouse vérifie si la requête a une condition de clé primaire qui peut être utilisée pour restreindre les plages de données. S’il n’y a pas de condition appropriée, il lève une exception. Cependant, il ne vérifie pas si la condition réduit la quantité de données à lire. Pour plus d’informations sur les plages de données dans les tables MergeTree, voir [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## format\_schema {#format-schema} -Ce paramètre est utile lorsque vous utilisez des formats nécessitant une définition de schéma, tels que [Cap'n Proto](https://capnproto.org/) ou [Protobuf](https://developers.google.com/protocol-buffers/). La valeur dépend du format. +Ce paramètre est utile lorsque vous utilisez des formats nécessitant une définition de schéma, tels que [Cap’n Proto](https://capnproto.org/) ou [Protobuf](https://developers.google.com/protocol-buffers/). La valeur dépend du format. ## fsync\_metadata {#fsync-metadata} -Active ou désactive [fsync](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html) lors de l'écriture `.sql` fichier. Activé par défaut. +Active ou désactive [fsync](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html) lors de l’écriture `.sql` fichier. Activé par défaut. Il est logique de le désactiver si le serveur a des millions de tables minuscules qui sont constamment créées et détruites. @@ -91,7 +91,7 @@ Il est logique de le désactiver si le serveur a des millions de tables minuscul Active ou désactive la compression de données dans la réponse à une requête HTTP. -Pour plus d'informations, lire l' [Description de L'interface HTTP](../../interfaces/http.md). +Pour plus d’informations, lire l’ [Description de L’interface HTTP](../../interfaces/http.md). Valeurs possibles: @@ -112,7 +112,7 @@ Valeur par défaut: 3. Active ou désactive la vérification de la somme de contrôle lors de la décompression des données HTTP POST du client. Utilisé uniquement pour le format de compression natif ClickHouse (non utilisé avec `gzip` ou `deflate`). -Pour plus d'informations, lire l' [Description de L'interface HTTP](../../interfaces/http.md). +Pour plus d’informations, lire l’ [Description de L’interface HTTP](../../interfaces/http.md). Valeurs possibles: @@ -125,7 +125,7 @@ Valeur par défaut: 0. Active ou désactive `X-ClickHouse-Progress` - Têtes de réponse HTTP dans `clickhouse-server` réponse. -Pour plus d'informations, lire l' [Description de L'interface HTTP](../../interfaces/http.md). +Pour plus d’informations, lire l’ [Description de L’interface HTTP](../../interfaces/http.md). Valeurs possibles: @@ -136,7 +136,7 @@ Valeur par défaut: 0. ## max\_http\_get\_redirects {#setting-max_http_get_redirects} -Limite le nombre maximal de sauts de redirection HTTP GET pour [URL](../../engines/table_engines/special/url.md)-tables de moteur. Le paramètre s'applique aux deux types de tables: celles créées par [CREATE TABLE](../../query_language/create/#create-table-query) requête et par la [URL](../../sql_reference/table_functions/url.md) table de fonction. +Limite le nombre maximal de sauts de redirection HTTP GET pour [URL](../../engines/table-engines/special/url.md)-tables de moteur. Le paramètre s’applique aux deux types de tables: celles créées par [CREATE TABLE](../../query_language/create/#create-table-query) requête et par la [URL](../../sql-reference/table-functions/url.md) table de fonction. Valeurs possibles: @@ -147,32 +147,32 @@ Valeur par défaut: 0. ## input\_format\_allow\_errors\_num {#settings-input_format_allow_errors_num} -Définit le nombre maximal d'erreurs acceptables lors de la lecture à partir de formats de texte (CSV, TSV, etc.). +Définit le nombre maximal d’erreurs acceptables lors de la lecture à partir de formats de texte (CSV, TSV, etc.). La valeur par défaut est de 0. Toujours le coupler avec `input_format_allow_errors_ratio`. -Si une erreur s'est produite lors de la lecture de lignes mais que le compteur d'erreurs est toujours inférieur à `input_format_allow_errors_num`, ClickHouse ignore la ligne et passe à la suivante. +Si une erreur s’est produite lors de la lecture de lignes mais que le compteur d’erreurs est toujours inférieur à `input_format_allow_errors_num`, ClickHouse ignore la ligne et passe à la suivante. Si les deux `input_format_allow_errors_num` et `input_format_allow_errors_ratio` sont dépassés, ClickHouse lève une exception. ## input\_format\_allow\_errors\_ratio {#settings-input_format_allow_errors_ratio} -Définit le pourcentage maximal d'erreurs autorisées lors de la lecture à partir de formats de texte (CSV, TSV, etc.). -Le pourcentage d'erreurs est défini comme un nombre à virgule flottante compris entre 0 et 1. +Définit le pourcentage maximal d’erreurs autorisées lors de la lecture à partir de formats de texte (CSV, TSV, etc.). +Le pourcentage d’erreurs est défini comme un nombre à virgule flottante compris entre 0 et 1. La valeur par défaut est de 0. Toujours le coupler avec `input_format_allow_errors_num`. -Si une erreur s'est produite lors de la lecture de lignes mais que le compteur d'erreurs est toujours inférieur à `input_format_allow_errors_ratio`, ClickHouse ignore la ligne et passe à la suivante. +Si une erreur s’est produite lors de la lecture de lignes mais que le compteur d’erreurs est toujours inférieur à `input_format_allow_errors_ratio`, ClickHouse ignore la ligne et passe à la suivante. Si les deux `input_format_allow_errors_num` et `input_format_allow_errors_ratio` sont dépassés, ClickHouse lève une exception. ## input\_format\_values\_interpret\_expressions {#settings-input_format_values_interpret_expressions} -Active ou désactive L'analyseur SQL complet si l'analyseur de flux rapide ne peut pas analyser les données. Ce paramètre est utilisé uniquement pour la [Valeur](../../interfaces/formats.md#data-format-values) format lors de l'insertion des données. Pour plus d'informations sur l'analyse syntaxique, consultez [Syntaxe](../../sql_reference/syntax.md) section. +Active ou désactive L’analyseur SQL complet si l’analyseur de flux rapide ne peut pas analyser les données. Ce paramètre est utilisé uniquement pour la [Valeur](../../interfaces/formats.md#data-format-values) format lors de l’insertion des données. Pour plus d’informations sur l’analyse syntaxique, consultez [Syntaxe](../../sql-reference/syntax.md) section. Valeurs possibles: @@ -182,13 +182,13 @@ Valeurs possibles: - 1 — Enabled. - Dans ce cas, vous pouvez utiliser une expression SQL en tant que valeur, mais l'insertion de données est beaucoup plus lente de cette façon. Si vous insérez uniquement des données formatées, ClickHouse se comporte comme si la valeur de réglage était 0. + Dans ce cas, vous pouvez utiliser une expression SQL en tant que valeur, mais l’insertion de données est beaucoup plus lente de cette façon. Si vous insérez uniquement des données formatées, ClickHouse se comporte comme si la valeur de réglage était 0. Valeur par défaut: 1. -Exemple D'utilisation +Exemple D’utilisation -Insérez le [DateTime](../../sql_reference/data_types/datetime.md) tapez valeur avec les différents paramètres. +Insérez le [DateTime](../../sql-reference/data-types/datetime.md) tapez valeur avec les différents paramètres. ``` sql SET input_format_values_interpret_expressions = 0; @@ -222,15 +222,15 @@ Ok. ## input\_format\_values\_deduce\_templates\_of\_expressions {#settings-input_format_values_deduce_templates_of_expressions} -Active ou désactive la déduction de modèle pour une expression SQL dans [Valeur](../../interfaces/formats.md#data-format-values) format. Il permet d'analyser et d'interpréter les expressions dans `Values` beaucoup plus rapide si les expressions dans des lignes consécutives ont la même structure. ClickHouse va essayer de déduire le modèle d'une expression, analyser les lignes suivantes en utilisant ce modèle et évaluer l'expression sur un lot de lignes analysées avec succès. Pour la requête suivante: +Active ou désactive la déduction de modèle pour une expression SQL dans [Valeur](../../interfaces/formats.md#data-format-values) format. Il permet d’analyser et d’interpréter les expressions dans `Values` beaucoup plus rapide si les expressions dans des lignes consécutives ont la même structure. ClickHouse va essayer de déduire le modèle d’une expression, analyser les lignes suivantes en utilisant ce modèle et évaluer l’expression sur un lot de lignes analysées avec succès. Pour la requête suivante: ``` sql INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), (upper('Values')), ... ``` - si `input_format_values_interpret_expressions=1` et `format_values_deduce_templates_of_expressions=0` les expressions seront interprétées séparément pour chaque ligne (Ceci est très lent pour un grand nombre de lignes) -- si `input_format_values_interpret_expressions=0` et `format_values_deduce_templates_of_expressions=1` expressions dans les première, deuxième et troisième lignes seront analysées à l'aide du modèle `lower(String)` et interprété ensemble, l'expression est la quatrième ligne sera analysée avec un autre modèle (`upper(String)`) -- si `input_format_values_interpret_expressions=1` et `format_values_deduce_templates_of_expressions=1` - la même chose que dans le cas précédent, mais permet également d'interpréter les expressions séparément s'il n'est pas possible de déduire le modèle. +- si `input_format_values_interpret_expressions=0` et `format_values_deduce_templates_of_expressions=1` expressions dans les première, deuxième et troisième lignes seront analysées à l’aide du modèle `lower(String)` et interprété ensemble, l’expression est la quatrième ligne sera analysée avec un autre modèle (`upper(String)`) +- si `input_format_values_interpret_expressions=1` et `format_values_deduce_templates_of_expressions=1` - la même chose que dans le cas précédent, mais permet également d’interpréter les expressions séparément s’il n’est pas possible de déduire le modèle. Activé par défaut. @@ -244,13 +244,13 @@ Ce paramètre est utilisé uniquement lorsque `input_format_values_deduce_templa (..., abs(-1), ...), -- Int64 literal ``` -Lorsque ce paramètre est activé, ClickHouse vérifie le type réel de littéral et utilise un modèle d'expression du type correspondant. Dans certains cas, cela peut considérablement ralentir l'évaluation de l'expression dans `Values`. +Lorsque ce paramètre est activé, ClickHouse vérifie le type réel de littéral et utilise un modèle d’expression du type correspondant. Dans certains cas, cela peut considérablement ralentir l’évaluation de l’expression dans `Values`. When disabled, ClickHouse may use more general type for some literals (e.g. `Float64` ou `Int64` plutôt `UInt64` pour `42`), mais cela peut causer des problèmes de débordement et de précision. Activé par défaut. ## input\_format\_defaults\_for\_omitted\_fields {#session_settings-input_format_defaults_for_omitted_fields} -Lors de l'exécution de `INSERT` requêtes, remplacez les valeurs de colonne d'entrée omises par les valeurs par défaut des colonnes respectives. Cette option s'applique uniquement aux [JSONEachRow](../../interfaces/formats.md#jsoneachrow), [CSV](../../interfaces/formats.md#csv) et [TabSeparated](../../interfaces/formats.md#tabseparated) format. +Lors de l’exécution de `INSERT` requêtes, remplacez les valeurs de colonne d’entrée omises par les valeurs par défaut des colonnes respectives. Cette option s’applique uniquement aux [JSONEachRow](../../interfaces/formats.md#jsoneachrow), [CSV](../../interfaces/formats.md#csv) et [TabSeparated](../../interfaces/formats.md#tabseparated) format. !!! note "Note" Lorsque cette option est activée, les métadonnées de table étendues sont envoyées du serveur au client. Il consomme des ressources informatiques supplémentaires sur le serveur et peut réduire les performances. @@ -270,13 +270,13 @@ Désactivé par défaut. ## input\_format\_null\_as\_default {#settings-input-format-null-as-default} -Active ou désactive l'utilisation des valeurs par défaut si les données `NULL` mais le type de données de la colonne correspondante dans pas `Nullable(T)` (pour les formats de saisie de texte). +Active ou désactive l’utilisation des valeurs par défaut si les données `NULL` mais le type de données de la colonne correspondante dans pas `Nullable(T)` (pour les formats de saisie de texte). ## input\_format\_skip\_unknown\_fields {#settings-input-format-skip-unknown-fields} -Active ou désactive le saut d'insertion de données supplémentaires. +Active ou désactive le saut d’insertion de données supplémentaires. -Lors de l'écriture de données, ClickHouse lève une exception si les données d'entrée contiennent des colonnes qui n'existent pas dans la table cible. Si le saut est activé, ClickHouse n'insère pas de données supplémentaires et ne lance pas d'exception. +Lors de l’écriture de données, ClickHouse lève une exception si les données d’entrée contiennent des colonnes qui n’existent pas dans la table cible. Si le saut est activé, ClickHouse n’insère pas de données supplémentaires et ne lance pas d’exception. Formats pris en charge: @@ -294,7 +294,7 @@ Valeur par défaut: 0. ## input\_format\_import\_nested\_json {#settings-input_format_import_nested_json} -Active ou désactive l'insertion de données JSON avec des objets imbriqués. +Active ou désactive l’insertion de données JSON avec des objets imbriqués. Formats pris en charge: @@ -309,13 +309,13 @@ Valeur par défaut: 0. Voir aussi: -- [Utilisation de Structures imbriquées](../../interfaces/formats.md#jsoneachrow-nested) avec l' `JSONEachRow` format. +- [Utilisation de Structures imbriquées](../../interfaces/formats.md#jsoneachrow-nested) avec l’ `JSONEachRow` format. ## input\_format\_with\_names\_use\_header {#settings-input-format-with-names-use-header} -Active ou désactive la vérification de l'ordre des colonnes lors de l'insertion de données. +Active ou désactive la vérification de l’ordre des colonnes lors de l’insertion de données. -Pour améliorer les performances d'insertion, nous vous recommandons de désactiver cette vérification si vous êtes sûr que l'ordre des colonnes des données d'entrée est le même que dans la table cible. +Pour améliorer les performances d’insertion, nous vous recommandons de désactiver cette vérification si vous êtes sûr que l’ordre des colonnes des données d’entrée est le même que dans la table cible. Formats pris en charge: @@ -331,9 +331,9 @@ Valeur par défaut: 1. ## date\_time\_input\_format {#settings-date_time_input_format} -Permet de choisir un analyseur de la représentation textuelle de la date et de l'heure. +Permet de choisir un analyseur de la représentation textuelle de la date et de l’heure. -Le réglage ne s'applique pas à [fonctions date et heure](../../sql_reference/functions/date_time_functions.md). +Le réglage ne s’applique pas à [fonctions date et heure](../../sql-reference/functions/date-time-functions.md). Valeurs possibles: @@ -349,19 +349,19 @@ Valeur par défaut: `'basic'`. Voir aussi: -- [Type de données DateTime.](../../sql_reference/data_types/datetime.md) -- [Fonctions pour travailler avec des dates et des heures.](../../sql_reference/functions/date_time_functions.md) +- [Type de données DateTime.](../../sql-reference/data-types/datetime.md) +- [Fonctions pour travailler avec des dates et des heures.](../../sql-reference/functions/date-time-functions.md) ## join\_default\_strictness {#settings-join_default_strictness} -Définit la rigueur par défaut pour [JOIN clauses](../../sql_reference/statements/select.md#select-join). +Définit la rigueur par défaut pour [JOIN clauses](../../sql-reference/statements/select.md#select-join). Valeurs possibles: -- `ALL` — If the right table has several matching rows, ClickHouse creates a [Produit cartésien](https://en.wikipedia.org/wiki/Cartesian_product) à partir des lignes correspondantes. C'est normal `JOIN` comportement de SQL standard. +- `ALL` — If the right table has several matching rows, ClickHouse creates a [Produit cartésien](https://en.wikipedia.org/wiki/Cartesian_product) à partir des lignes correspondantes. C’est normal `JOIN` comportement de SQL standard. - `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of `ANY` et `ALL` sont les mêmes. - `ASOF` — For joining sequences with an uncertain match. -- `Empty string` — If `ALL` ou `ANY` n'est pas spécifié dans la requête, ClickHouse lève une exception. +- `Empty string` — If `ALL` ou `ANY` n’est pas spécifié dans la requête, ClickHouse lève une exception. Valeur par défaut: `ALL`. @@ -370,7 +370,7 @@ Valeur par défaut: `ALL`. Modifie le comportement des opérations de jointure avec `ANY` rigueur. !!! warning "Attention" - Ce paramètre s'applique uniquement pour `JOIN` opérations avec [Rejoindre](../../engines/table_engines/special/join.md) le moteur de tables. + Ce paramètre s’applique uniquement pour `JOIN` opérations avec [Rejoindre](../../engines/table-engines/special/join.md) le moteur de tables. Valeurs possibles: @@ -381,24 +381,24 @@ Valeur par défaut: 0. Voir aussi: -- [Clause de JOINTURE](../../sql_reference/statements/select.md#select-join) -- [Rejoindre le moteur de table](../../engines/table_engines/special/join.md) +- [Clause de JOINTURE](../../sql-reference/statements/select.md#select-join) +- [Rejoindre le moteur de table](../../engines/table-engines/special/join.md) - [join\_default\_strictness](#settings-join_default_strictness) ## join\_use\_nulls {#join_use_nulls} -Définit le type de [JOIN](../../sql_reference/statements/select.md) comportement. Lors de la fusion de tables, des cellules vides peuvent apparaître. ClickHouse les remplit différemment en fonction de ce paramètre. +Définit le type de [JOIN](../../sql-reference/statements/select.md) comportement. Lors de la fusion de tables, des cellules vides peuvent apparaître. ClickHouse les remplit différemment en fonction de ce paramètre. Valeurs possibles: - 0 — The empty cells are filled with the default value of the corresponding field type. -- 1 — `JOIN` se comporte de la même manière que dans SQL standard. Le type du champ correspondant est converti en [Nullable](../../sql_reference/data_types/nullable.md#data_type-nullable) et les cellules vides sont remplis avec [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` se comporte de la même manière que dans SQL standard. Le type du champ correspondant est converti en [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) et les cellules vides sont remplis avec [NULL](../../sql-reference/syntax.md). Valeur par défaut: 0. ## max\_block\_size {#setting-max_block_size} -Dans ClickHouse, les données sont traitées par Blocs (Ensembles de parties de colonne). Les cycles de traitement internes pour un seul bloc sont assez efficaces, mais il y a des dépenses notables sur chaque bloc. Le `max_block_size` le paramètre est une recommandation pour la taille du bloc (dans un nombre de lignes) à charger à partir des tables. La taille du bloc ne doit pas être trop petite, de sorte que les dépenses sur chaque bloc sont toujours perceptibles, mais pas trop grande pour que la requête avec limite qui est terminée après le premier bloc soit traitée rapidement. L'objectif est d'éviter de consommer trop de mémoire lors de l'extraction d'un grand nombre de colonnes dans plusieurs threads et de préserver au moins certains localité de cache. +Dans ClickHouse, les données sont traitées par Blocs (Ensembles de parties de colonne). Les cycles de traitement internes pour un seul bloc sont assez efficaces, mais il y a des dépenses notables sur chaque bloc. Le `max_block_size` le paramètre est une recommandation pour la taille du bloc (dans un nombre de lignes) à charger à partir des tables. La taille du bloc ne doit pas être trop petite, de sorte que les dépenses sur chaque bloc sont toujours perceptibles, mais pas trop grande pour que la requête avec limite qui est terminée après le premier bloc soit traitée rapidement. L’objectif est d’éviter de consommer trop de mémoire lors de l’extraction d’un grand nombre de colonnes dans plusieurs threads et de préserver au moins certains localité de cache. Valeur par défaut: de 65 536. @@ -406,13 +406,13 @@ Les blocs de la taille de `max_block_size` ne sont pas toujours chargées de la ## preferred\_block\_size\_bytes {#preferred-block-size-bytes} -Utilisé dans le même but que `max_block_size`, mais il définit la taille de bloc recommandée en octets en l'adaptant au nombre de lignes dans le bloc. +Utilisé dans le même but que `max_block_size`, mais il définit la taille de bloc recommandée en octets en l’adaptant au nombre de lignes dans le bloc. Cependant, la taille du bloc ne peut pas être supérieure à `max_block_size` rangée. Par défaut: 1 000 000. Cela ne fonctionne que lors de la lecture des moteurs MergeTree. ## merge\_tree\_min\_rows\_for\_concurrent\_read {#setting-merge-tree-min-rows-for-concurrent-read} -Si le nombre de lignes à lire à partir d'un fichier d'un [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) table dépasse `merge_tree_min_rows_for_concurrent_read` ensuite, ClickHouse essaie d'effectuer une lecture simultanée de ce fichier sur plusieurs threads. +Si le nombre de lignes à lire à partir d’un fichier d’un [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) table dépasse `merge_tree_min_rows_for_concurrent_read` ensuite, ClickHouse essaie d’effectuer une lecture simultanée de ce fichier sur plusieurs threads. Valeurs possibles: @@ -422,7 +422,7 @@ Valeur par défaut: 163840. ## merge\_tree\_min\_bytes\_for\_concurrent\_read {#setting-merge-tree-min-bytes-for-concurrent-read} -Si le nombre d'octets à lire à partir d'un fichier d'un [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)- table de moteur dépasse `merge_tree_min_bytes_for_concurrent_read` puis ClickHouse essaie de lire simultanément à partir de ce fichier dans plusieurs threads. +Si le nombre d’octets à lire à partir d’un fichier d’un [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)- table de moteur dépasse `merge_tree_min_bytes_for_concurrent_read` puis ClickHouse essaie de lire simultanément à partir de ce fichier dans plusieurs threads. Valeur Possible: @@ -452,7 +452,7 @@ Valeur par défaut: 0. ## merge\_tree\_coarse\_index\_granularité {#setting-merge-tree-coarse-index-granularity} -Lors de la recherche de données, ClickHouse vérifie les marques de données dans le fichier d'index. Si ClickHouse trouve que les clés requises sont dans une certaine plage, il divise cette plage en `merge_tree_coarse_index_granularity` subranges et recherche les clés requises récursivement. +Lors de la recherche de données, ClickHouse vérifie les marques de données dans le fichier d’index. Si ClickHouse trouve que les clés requises sont dans une certaine plage, il divise cette plage en `merge_tree_coarse_index_granularity` subranges et recherche les clés requises récursivement. Valeurs possibles: @@ -462,9 +462,9 @@ Valeur par défaut: 8. ## merge\_tree\_max\_rows\_to\_use\_cache {#setting-merge-tree-max-rows-to-use-cache} -Si ClickHouse devrait lire plus de `merge_tree_max_rows_to_use_cache` lignes dans une requête, il n'utilise pas le cache des blocs non compressés. +Si ClickHouse devrait lire plus de `merge_tree_max_rows_to_use_cache` lignes dans une requête, il n’utilise pas le cache des blocs non compressés. -Le cache des blocs non compressés stocke les données extraites pour les requêtes. ClickHouse utilise ce cache pour accélérer les réponses aux petites requêtes répétées. Ce paramètre protège le cache contre le saccage par les requêtes qui lisent une grande quantité de données. Le [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) le paramètre serveur définit la taille du cache des blocs non compressés. +Le cache des blocs non compressés stocke les données extraites pour les requêtes. ClickHouse utilise ce cache pour accélérer les réponses aux petites requêtes répétées. Ce paramètre protège le cache contre le saccage par les requêtes qui lisent une grande quantité de données. Le [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) le paramètre serveur définit la taille du cache des blocs non compressés. Valeurs possibles: @@ -474,9 +474,9 @@ Default value: 128 ✕ 8192. ## merge\_tree\_max\_bytes\_to\_use\_cache {#setting-merge-tree-max-bytes-to-use-cache} -Si ClickHouse devrait lire plus de `merge_tree_max_bytes_to_use_cache` octets dans une requête, il n'utilise pas le cache de non compressé blocs. +Si ClickHouse devrait lire plus de `merge_tree_max_bytes_to_use_cache` octets dans une requête, il n’utilise pas le cache de non compressé blocs. -Le cache des blocs non compressés stocke les données extraites pour les requêtes. ClickHouse utilise ce cache pour accélérer les réponses aux petites requêtes répétées. Ce paramètre protège le cache contre le saccage par les requêtes qui lisent une grande quantité de données. Le [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) le paramètre serveur définit la taille du cache des blocs non compressés. +Le cache des blocs non compressés stocke les données extraites pour les requêtes. ClickHouse utilise ce cache pour accélérer les réponses aux petites requêtes répétées. Ce paramètre protège le cache contre le saccage par les requêtes qui lisent une grande quantité de données. Le [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) le paramètre serveur définit la taille du cache des blocs non compressés. Valeur Possible: @@ -486,7 +486,7 @@ Valeur par défaut: 2013265920. ## min\_bytes\_to\_use\_direct\_io {#settings-min-bytes-to-use-direct-io} -Volume de données minimum requis pour utiliser l'accès direct aux E/S sur le disque de stockage. +Volume de données minimum requis pour utiliser l’accès direct aux E/S sur le disque de stockage. ClickHouse utilise ce paramètre lors de la lecture de données à partir de tables. Si le volume total de stockage de toutes les données à lire dépasse `min_bytes_to_use_direct_io` octets, puis ClickHouse lit les données du disque de stockage avec le `O_DIRECT` option. @@ -501,7 +501,7 @@ Valeur par défaut: 0. Configuration de la journalisation des requêtes. -Les requêtes envoyées à ClickHouse avec cette configuration sont enregistrées selon les règles du [query\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-log) paramètre de configuration du serveur. +Les requêtes envoyées à ClickHouse avec cette configuration sont enregistrées selon les règles du [query\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-log) paramètre de configuration du serveur. Exemple: @@ -513,7 +513,7 @@ log_queries=1 Configuration de la journalisation des threads de requête. -Les threads de requêtes exécutés par ClickHouse avec cette configuration sont journalisés selon les règles du [query\_thread\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) paramètre de configuration du serveur. +Les threads de requêtes exécutés par ClickHouse avec cette configuration sont journalisés selon les règles du [query\_thread\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) paramètre de configuration du serveur. Exemple: @@ -523,38 +523,38 @@ log_query_threads=1 ## max\_insert\_block\_size {#settings-max_insert_block_size} -La taille des blocs à former pour l'insertion dans une table. -Ce paramètre s'applique uniquement dans les cas où le serveur formes les blocs. -Par exemple, pour une insertion via L'interface HTTP, le serveur analyse le format de données et forme des blocs de la taille spécifiée. -Mais lors de l'utilisation de clickhouse-client, le client analyse les données ‘max\_insert\_block\_size’ le réglage sur le serveur n'affecte pas la taille des blocs insérés. -Le paramètre n'a pas non plus de but lors de L'utilisation D'INSERT SELECT, car les données sont insérées à l'aide des mêmes blocs qui sont formés après SELECT. +La taille des blocs à former pour l’insertion dans une table. +Ce paramètre s’applique uniquement dans les cas où le serveur formes les blocs. +Par exemple, pour une insertion via L’interface HTTP, le serveur analyse le format de données et forme des blocs de la taille spécifiée. +Mais lors de l’utilisation de clickhouse-client, le client analyse les données ‘max\_insert\_block\_size’ le réglage sur le serveur n’affecte pas la taille des blocs insérés. +Le paramètre n’a pas non plus de but lors de L’utilisation D’INSERT SELECT, car les données sont insérées à l’aide des mêmes blocs qui sont formés après SELECT. Valeur par défaut: 1 048 576 octets. -La valeur par défaut est légèrement supérieure à `max_block_size`. La raison en est que certains moteurs de table (`*MergeTree`) former une partie de données sur le disque pour chaque bloc inséré, qui est une entité assez grande. Pareillement, `*MergeTree` les tables trient les données lors de l'insertion et une taille de bloc suffisamment grande permet de trier plus de données dans la RAM. +La valeur par défaut est légèrement supérieure à `max_block_size`. La raison en est que certains moteurs de table (`*MergeTree`) former une partie de données sur le disque pour chaque bloc inséré, qui est une entité assez grande. Pareillement, `*MergeTree` les tables trient les données lors de l’insertion et une taille de bloc suffisamment grande permet de trier plus de données dans la RAM. ## max\_replica\_delay\_for\_distributed\_queries {#settings-max_replica_delay_for_distributed_queries} -Désactive les répliques en retard pour les requêtes distribuées. Voir [Réplication](../../engines/table_engines/mergetree_family/replication.md). +Désactive les répliques en retard pour les requêtes distribuées. Voir [Réplication](../../engines/table-engines/mergetree-family/replication.md). -Définit le temps en secondes. Si une réplique accuse plus de retard que la valeur définie, cette réplique n'est pas utilisée. +Définit le temps en secondes. Si une réplique accuse plus de retard que la valeur définie, cette réplique n’est pas utilisée. Valeur par défaut: 300. -Utilisé lors de l'exécution `SELECT` à partir d'une table distribuée qui pointe vers des tables répliquées. +Utilisé lors de l’exécution `SELECT` à partir d’une table distribuée qui pointe vers des tables répliquées. ## max\_threads {#settings-max_threads} -Nombre maximal de threads de traitement des requêtes, à l'exclusion des threads de récupération de données à partir de serveurs distants (voir ‘max\_distributed\_connections’ paramètre). +Nombre maximal de threads de traitement des requêtes, à l’exclusion des threads de récupération de données à partir de serveurs distants (voir ‘max\_distributed\_connections’ paramètre). -Ce paramètre s'applique aux threads qui effectuent les mêmes étapes du pipeline de traitement des requêtes en parallèle. -Par exemple, lors de la lecture d'une table, s'il est possible d'évaluer des expressions avec des fonctions, filtrer avec WHERE et pré-agréger pour GROUP BY en parallèle en utilisant au moins ‘max\_threads’ nombre de threads, puis ‘max\_threads’ sont utilisés. +Ce paramètre s’applique aux threads qui effectuent les mêmes étapes du pipeline de traitement des requêtes en parallèle. +Par exemple, lors de la lecture d’une table, s’il est possible d’évaluer des expressions avec des fonctions, filtrer avec WHERE et pré-agréger pour GROUP BY en parallèle en utilisant au moins ‘max\_threads’ nombre de threads, puis ‘max\_threads’ sont utilisés. Valeur par défaut: nombre de cœurs de processeur physiques. -Si moins d'une requête SELECT est normalement exécutée sur un serveur à la fois, définissez ce paramètre sur une valeur légèrement inférieure au nombre réel de cœurs de processeur. +Si moins d’une requête SELECT est normalement exécutée sur un serveur à la fois, définissez ce paramètre sur une valeur légèrement inférieure au nombre réel de cœurs de processeur. -Pour les requêtes qui sont terminées rapidement en raison d'une limite, vous pouvez définir une valeur inférieure ‘max\_threads’. Par exemple, si le nombre d'entrées se trouvent dans chaque bloc et max\_threads = 8, 8 blocs sont récupérées, même s'il aurait été suffisante pour lire un seul. +Pour les requêtes qui sont terminées rapidement en raison d’une limite, vous pouvez définir une valeur inférieure ‘max\_threads’. Par exemple, si le nombre d’entrées se trouvent dans chaque bloc et max\_threads = 8, 8 blocs sont récupérées, même s’il aurait été suffisante pour lire un seul. Le plus petit de la `max_threads` valeur, moins la mémoire est consommée. @@ -564,50 +564,50 @@ Nombre maximal de threads à exécuter `INSERT SELECT` requête. Valeurs possibles: -- 0 (or 1) — `INSERT SELECT` pas d'exécution parallèle. +- 0 (or 1) — `INSERT SELECT` pas d’exécution parallèle. - Entier positif. Plus grand que 1. Valeur par défaut: 0. -Parallèle `INSERT SELECT` n'a d'effet que si l' `SELECT` une partie est exécutée en parallèle, voir [max\_threads](#settings-max_threads) paramètre. +Parallèle `INSERT SELECT` n’a d’effet que si l’ `SELECT` une partie est exécutée en parallèle, voir [max\_threads](#settings-max_threads) paramètre. Des valeurs plus élevées conduiront à une utilisation de la mémoire plus élevée. ## max\_compress\_block\_size {#max-compress-block-size} -La taille maximale des blocs de données non compressées avant la compression pour l'écriture dans une table. Par défaut, 1 048 576 (1 MiB). Si la taille est réduite, le taux de compression est considérablement réduit, la vitesse de compression et de décompression augmente légèrement en raison de la localisation du cache, et la consommation de mémoire est réduite. Il n'y aucune raison de modifier ce paramètre. +La taille maximale des blocs de données non compressées avant la compression pour l’écriture dans une table. Par défaut, 1 048 576 (1 MiB). Si la taille est réduite, le taux de compression est considérablement réduit, la vitesse de compression et de décompression augmente légèrement en raison de la localisation du cache, et la consommation de mémoire est réduite. Il n’y aucune raison de modifier ce paramètre. -Ne confondez pas les blocs pour la compression (un morceau de mémoire constitué d'octets) avec des blocs pour le traitement des requêtes (Un ensemble de lignes d'une table). +Ne confondez pas les blocs pour la compression (un morceau de mémoire constitué d’octets) avec des blocs pour le traitement des requêtes (Un ensemble de lignes d’une table). ## min\_compress\_block\_size {#min-compress-block-size} -Pour [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)" table. Afin de réduire la latence lors du traitement des requêtes, un bloc est compressé lors de l'écriture de la marque suivante si sa taille est au moins ‘min\_compress\_block\_size’. Par défaut, 65 536. +Pour [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)" table. Afin de réduire la latence lors du traitement des requêtes, un bloc est compressé lors de l’écriture de la marque suivante si sa taille est au moins ‘min\_compress\_block\_size’. Par défaut, 65 536. La taille réelle du bloc, si les données non compressées sont inférieures à ‘max\_compress\_block\_size’ pas moins de cette valeur et pas moins que le volume de données pour une marque. Regardons un exemple. Supposons que ‘index\_granularity’ a 8192 lors de la création de la table. -Nous écrivons une colonne de type UInt32 (4 octets par valeur). Lors de l'écriture de 8192 lignes, le total sera de 32 KO de données. Puisque min\_compress\_block\_size = 65 536, un bloc compressé sera formé pour toutes les deux marques. +Nous écrivons une colonne de type UInt32 (4 octets par valeur). Lors de l’écriture de 8192 lignes, le total sera de 32 KO de données. Puisque min\_compress\_block\_size = 65 536, un bloc compressé sera formé pour toutes les deux marques. -Nous écrivons une colonne URL avec le type de chaîne (taille moyenne de 60 octets par valeur). Lors de l'écriture de 8192 lignes, la moyenne sera légèrement inférieure à 500 Ko de données. Comme il s'agit de plus de 65 536, un bloc compressé sera formé pour chaque marque. Dans ce cas, lors de la lecture de données du disque dans la plage d'une seule marque, les données supplémentaires ne seront pas décompressées. +Nous écrivons une colonne URL avec le type de chaîne (taille moyenne de 60 octets par valeur). Lors de l’écriture de 8192 lignes, la moyenne sera légèrement inférieure à 500 Ko de données. Comme il s’agit de plus de 65 536, un bloc compressé sera formé pour chaque marque. Dans ce cas, lors de la lecture de données du disque dans la plage d’une seule marque, les données supplémentaires ne seront pas décompressées. -Il n'y aucune raison de modifier ce paramètre. +Il n’y aucune raison de modifier ce paramètre. ## max\_query\_size {#settings-max_query_size} -La partie maximale d'une requête qui peut être prise en RAM pour l'analyse avec L'analyseur SQL. -La requête INSERT contient également des données pour INSERT qui sont traitées par un analyseur de flux séparé (qui consomme O (1) RAM), qui n'est pas inclus dans cette restriction. +La partie maximale d’une requête qui peut être prise en RAM pour l’analyse avec L’analyseur SQL. +La requête INSERT contient également des données pour INSERT qui sont traitées par un analyseur de flux séparé (qui consomme O (1) RAM), qui n’est pas inclus dans cette restriction. Valeur par défaut: 256 Ko. ## interactive\_delay {#interactive-delay} -Intervalle en microsecondes pour vérifier si l'exécution de la requête a été annulée et envoyer la progression. +Intervalle en microsecondes pour vérifier si l’exécution de la requête a été annulée et envoyer la progression. -Valeur par défaut: 100 000 (vérifie l'Annulation et envoie la progression dix fois par seconde). +Valeur par défaut: 100 000 (vérifie l’Annulation et envoie la progression dix fois par seconde). ## connect\_timeout, receive\_timeout, send\_timeout {#connect-timeout-receive-timeout-send-timeout} -Délais d'attente en secondes sur le socket utilisé pour communiquer avec le client. +Délais d’attente en secondes sur le socket utilisé pour communiquer avec le client. Valeur par défaut: 10, 300, 300. @@ -619,17 +619,17 @@ Valeur par défaut: 0 ## poll\_interval {#poll-interval} -Verrouillez une boucle d'attente pendant le nombre de secondes spécifié. +Verrouillez une boucle d’attente pendant le nombre de secondes spécifié. Valeur par défaut: 10. ## max\_distributed\_connections {#max-distributed-connections} -Nombre maximal de connexions simultanées avec des serveurs distants pour le traitement distribué d'une seule requête vers une seule table distribuée. Nous vous recommandons de définir une valeur au moins égale au nombre de serveurs dans le cluster. +Nombre maximal de connexions simultanées avec des serveurs distants pour le traitement distribué d’une seule requête vers une seule table distribuée. Nous vous recommandons de définir une valeur au moins égale au nombre de serveurs dans le cluster. Valeur par défaut: 1024. -Les paramètres suivants ne sont utilisés que lors de la création de tables distribuées (et lors du lancement d'un serveur), il n'y a donc aucune raison de les modifier lors de l'exécution. +Les paramètres suivants ne sont utilisés que lors de la création de tables distribuées (et lors du lancement d’un serveur), il n’y a donc aucune raison de les modifier lors de l’exécution. ## distributed\_connections\_pool\_size {#distributed-connections-pool-size} @@ -639,8 +639,8 @@ Valeur par défaut: 1024. ## connect\_timeout\_with\_failover\_ms {#connect-timeout-with-failover-ms} -Délai d'attente en millisecondes pour la connexion à un serveur distant pour un moteur de table distribué, si ‘shard’ et ‘replica’ les sections sont utilisées dans la définition du cluster. -En cas d'échec, plusieurs tentatives sont faites pour se connecter à diverses répliques. +Délai d’attente en millisecondes pour la connexion à un serveur distant pour un moteur de table distribué, si ‘shard’ et ‘replica’ les sections sont utilisées dans la définition du cluster. +En cas d’échec, plusieurs tentatives sont faites pour se connecter à diverses répliques. Valeur par défaut: 50. @@ -652,30 +652,30 @@ Valeur par défaut: 3. ## extrême {#extremes} -Indique s'il faut compter les valeurs extrêmes (les minimums et les maximums dans les colonnes d'un résultat de requête). Accepte 0 ou 1. Par défaut, 0 (désactivé). -Pour plus d'informations, consultez la section “Extreme values”. +Indique s’il faut compter les valeurs extrêmes (les minimums et les maximums dans les colonnes d’un résultat de requête). Accepte 0 ou 1. Par défaut, 0 (désactivé). +Pour plus d’informations, consultez la section “Extreme values”. ## use\_uncompressed\_cache {#setting-use_uncompressed_cache} -Indique s'il faut utiliser un cache de blocs non compressés. Accepte 0 ou 1. Par défaut, 0 (désactivé). -L'utilisation du cache non compressé (uniquement pour les tables de la famille MergeTree) peut réduire considérablement la latence et augmenter le débit lorsque vous travaillez avec un grand nombre de requêtes courtes. Activez ce paramètre pour les utilisateurs qui envoient des requêtes courtes fréquentes. Faites également attention à la [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. +Indique s’il faut utiliser un cache de blocs non compressés. Accepte 0 ou 1. Par défaut, 0 (désactivé). +L’utilisation du cache non compressé (uniquement pour les tables de la famille MergeTree) peut réduire considérablement la latence et augmenter le débit lorsque vous travaillez avec un grand nombre de requêtes courtes. Activez ce paramètre pour les utilisateurs qui envoient des requêtes courtes fréquentes. Faites également attention à la [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. -Pour les requêtes qui lisent au moins un volume de données assez important (un million de lignes ou plus), le cache non compressé est désactivé automatiquement pour économiser de l'espace pour les requêtes vraiment petites. Cela signifie que vous pouvez garder la ‘use\_uncompressed\_cache’ toujours la valeur 1. +Pour les requêtes qui lisent au moins un volume de données assez important (un million de lignes ou plus), le cache non compressé est désactivé automatiquement pour économiser de l’espace pour les requêtes vraiment petites. Cela signifie que vous pouvez garder la ‘use\_uncompressed\_cache’ toujours la valeur 1. ## replace\_running\_query {#replace-running-query} -Lors de l'utilisation de L'interface HTTP, le ‘query\_id’ le paramètre peut être passé. C'est n'importe quelle chaîne qui sert d'Identificateur de requête. -Si une requête d'un utilisateur avec le même ‘query\_id’ il existe déjà à ce moment, le comportement dépend de la ‘replace\_running\_query’ paramètre. +Lors de l’utilisation de L’interface HTTP, le ‘query\_id’ le paramètre peut être passé. C’est n’importe quelle chaîne qui sert d’Identificateur de requête. +Si une requête d’un utilisateur avec le même ‘query\_id’ il existe déjà à ce moment, le comportement dépend de la ‘replace\_running\_query’ paramètre. -`0` (default) – Throw an exception (don't allow the query to run if a query with the same ‘query\_id’ est déjà en cours d'exécution). +`0` (default) – Throw an exception (don’t allow the query to run if a query with the same ‘query\_id’ est déjà en cours d’exécution). `1` – Cancel the old query and start running the new one. -Yandex.Metrica utilise ce paramètre défini sur 1 pour implémenter des suggestions de conditions de segmentation. Après avoir entré le caractère suivant, si l'ancienne requête n'est pas encore terminée, elle doit être annulée. +Yandex.Metrica utilise ce paramètre défini sur 1 pour implémenter des suggestions de conditions de segmentation. Après avoir entré le caractère suivant, si l’ancienne requête n’est pas encore terminée, elle doit être annulée. ## stream\_flush\_interval\_ms {#stream-flush-interval-ms} -Fonctionne pour les tables avec des flux dans le cas d'une expiration, ou lorsqu'un thread génère [max\_insert\_block\_size](#settings-max_insert_block_size) rangée. +Fonctionne pour les tables avec des flux dans le cas d’une expiration, ou lorsqu’un thread génère [max\_insert\_block\_size](#settings-max_insert_block_size) rangée. La valeur par défaut est 7500. @@ -683,12 +683,12 @@ Plus la valeur est petite, plus les données sont vidées dans la table. Régler ## équilibrage {#settings-load_balancing} -Spécifie l'algorithme de sélection des réplicas utilisé pour le traitement des requêtes distribuées. +Spécifie l’algorithme de sélection des réplicas utilisé pour le traitement des requêtes distribuées. ClickHouse prend en charge les algorithmes suivants de choix des répliques: - [Aléatoire](#load_balancing-random) (par défaut) -- [Nom d'hôte le plus proche](#load_balancing-nearest_hostname) +- [Nom d’hôte le plus proche](#load_balancing-nearest_hostname) - [Afin](#load_balancing-in_order) - [Premier ou aléatoire](#load_balancing-first_or_random) @@ -698,22 +698,22 @@ ClickHouse prend en charge les algorithmes suivants de choix des répliques: load_balancing = random ``` -Le nombre d'erreurs est compté pour chaque réplique. La requête est envoyée au réplica avec le moins d'erreurs, et s'il y en a plusieurs, à n'importe qui d'entre eux. -Inconvénients: la proximité du serveur n'est pas prise en compte; si les répliques ont des données différentes, vous obtiendrez également des données différentes. +Le nombre d’erreurs est compté pour chaque réplique. La requête est envoyée au réplica avec le moins d’erreurs, et s’il y en a plusieurs, à n’importe qui d’entre eux. +Inconvénients: la proximité du serveur n’est pas prise en compte; si les répliques ont des données différentes, vous obtiendrez également des données différentes. -### Nom D'Hôte Le Plus Proche {#load_balancing-nearest_hostname} +### Nom D’Hôte Le Plus Proche {#load_balancing-nearest_hostname} ``` sql load_balancing = nearest_hostname ``` -The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server's hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). +The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server’s hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). -Par exemple, exemple01-01-1 et example01-01-2.yandex.ru sont différents dans une position, tandis que l'exemple01-01-1 et l'exemple01-02-2 diffèrent dans deux endroits. +Par exemple, exemple01-01-1 et example01-01-2.yandex.ru sont différents dans une position, tandis que l’exemple01-01-1 et l’exemple01-02-2 diffèrent dans deux endroits. Cette méthode peut sembler primitive, mais elle ne nécessite pas de données externes sur la topologie du réseau, et elle ne compare pas les adresses IP, ce qui serait compliqué pour nos adresses IPv6. -Ainsi, s'il existe des répliques équivalentes, la plus proche par son nom est préférée. -Nous pouvons également supposer que lors de l'envoi d'une requête au même serveur, en l'absence d'Échecs, une requête distribuée ira également aux mêmes serveurs. Ainsi, même si des données différentes sont placées sur les répliques, la requête retournera principalement les mêmes résultats. +Ainsi, s’il existe des répliques équivalentes, la plus proche par son nom est préférée. +Nous pouvons également supposer que lors de l’envoi d’une requête au même serveur, en l’absence d’Échecs, une requête distribuée ira également aux mêmes serveurs. Ainsi, même si des données différentes sont placées sur les répliques, la requête retournera principalement les mêmes résultats. ### Afin {#load_balancing-in_order} @@ -721,22 +721,22 @@ Nous pouvons également supposer que lors de l'envoi d'une requête au même ser load_balancing = in_order ``` -Répliques avec le même nombre d'erreurs sont accessibles dans le même ordre qu'ils sont définis dans la configuration. +Répliques avec le même nombre d’erreurs sont accessibles dans le même ordre qu’ils sont définis dans la configuration. Cette méthode est appropriée lorsque vous savez exactement quelle réplique est préférable. -### Premier ou aléatoire {#load_balancing-first_or_random} +### Premier Ou aléatoire {#load_balancing-first_or_random} ``` sql load_balancing = first_or_random ``` -Cet algorithme choisit la première réplique de l'ensemble ou une réplique aléatoire si la première n'est pas disponible. Il est efficace dans les configurations de topologie de réplication croisée, mais inutile dans d'autres configurations. +Cet algorithme choisit la première réplique de l’ensemble ou une réplique aléatoire si la première n’est pas disponible. Il est efficace dans les configurations de topologie de réplication croisée, mais inutile dans d’autres configurations. -Le `first_or_random` algorithme résout le problème de la `in_order` algorithme. Avec `in_order`, si une réplique tombe en panne, la suivante obtient une double charge tandis que les répliques restantes gèrent la quantité habituelle de trafic. Lors de l'utilisation de la `first_or_random` algorithme, la charge est répartie uniformément entre les répliques qui sont encore disponibles. +Le `first_or_random` algorithme résout le problème de la `in_order` algorithme. Avec `in_order`, si une réplique tombe en panne, la suivante obtient une double charge tandis que les répliques restantes gèrent la quantité habituelle de trafic. Lors de l’utilisation de la `first_or_random` algorithme, la charge est répartie uniformément entre les répliques qui sont encore disponibles. ## prefer\_localhost\_replica {#settings-prefer-localhost-replica} -Active / désactive préférable d'utiliser le réplica localhost lors du traitement des requêtes distribuées. +Active / désactive préférable d’utiliser le réplica localhost lors du traitement des requêtes distribuées. Valeurs possibles: @@ -760,29 +760,29 @@ Voir la section “WITH TOTALS modifier”. ## max\_parallel\_replicas {#settings-max_parallel_replicas} -Nombre maximal de répliques pour chaque fragment lors de l'exécution d'une requête. -Par souci de cohérence (pour obtenir différentes parties du même partage de données), Cette option ne fonctionne que lorsque la clé d'échantillonnage est définie. -Le retard de réplique n'est pas contrôlé. +Nombre maximal de répliques pour chaque fragment lors de l’exécution d’une requête. +Par souci de cohérence (pour obtenir différentes parties du même partage de données), Cette option ne fonctionne que lorsque la clé d’échantillonnage est définie. +Le retard de réplique n’est pas contrôlé. ## compiler {#compile} Activer la compilation des requêtes. Par défaut, 0 (désactivé). -La compilation n'est utilisée que pour une partie du pipeline de traitement des requêtes: pour la première étape de l'agrégation (GROUP BY). -Si cette partie du pipeline a été compilée, la requête peut s'exécuter plus rapidement en raison du déploiement de cycles courts et des appels de fonction d'agrégation intégrés. L'amélioration maximale des performances (jusqu'à quatre fois plus rapide dans de rares cas) est observée pour les requêtes avec plusieurs fonctions d'agrégat simples. Typiquement, le gain de performance est insignifiant. Dans de très rares cas, il peut ralentir l'exécution de la requête. +La compilation n’est utilisée que pour une partie du pipeline de traitement des requêtes: pour la première étape de l’agrégation (GROUP BY). +Si cette partie du pipeline a été compilée, la requête peut s’exécuter plus rapidement en raison du déploiement de cycles courts et des appels de fonction d’agrégation intégrés. L’amélioration maximale des performances (jusqu’à quatre fois plus rapide dans de rares cas) est observée pour les requêtes avec plusieurs fonctions d’agrégat simples. Typiquement, le gain de performance est insignifiant. Dans de très rares cas, il peut ralentir l’exécution de la requête. ## min\_count\_to\_compile {#min-count-to-compile} -Combien de fois utiliser potentiellement un morceau de code compilé avant d'exécuter la compilation. Par défaut, 3. +Combien de fois utiliser potentiellement un morceau de code compilé avant d’exécuter la compilation. Par défaut, 3. For testing, the value can be set to 0: compilation runs synchronously and the query waits for the end of the compilation process before continuing execution. For all other cases, use values ​​starting with 1. Compilation normally takes about 5-10 seconds. -Si la valeur est 1 ou plus, la compilation se produit de manière asynchrone dans un thread séparé. Le résultat sera utilisé dès qu'il sera prêt, y compris les requêtes en cours d'exécution. +Si la valeur est 1 ou plus, la compilation se produit de manière asynchrone dans un thread séparé. Le résultat sera utilisé dès qu’il sera prêt, y compris les requêtes en cours d’exécution. -Le code compilé est requis pour chaque combinaison différente de fonctions d'agrégat utilisées dans la requête et le type de clés dans la clause GROUP BY. -The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don't use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. +Le code compilé est requis pour chaque combinaison différente de fonctions d’agrégat utilisées dans la requête et le type de clés dans la clause GROUP BY. +The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don’t use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. ## output\_format\_json\_quote\_64bit\_integers {#session_settings-output_format_json_quote_64bit_integers} -Si la valeur est true, les entiers apparaissent entre guillemets lors de l'utilisation des formats JSON\* Int64 et UInt64 (pour la compatibilité avec la plupart des implémentations JavaScript); sinon, les entiers sont sortis sans les guillemets. +Si la valeur est true, les entiers apparaissent entre guillemets lors de l’utilisation des formats JSON\* Int64 et UInt64 (pour la compatibilité avec la plupart des implémentations JavaScript); sinon, les entiers sont sortis sans les guillemets. ## format\_csv\_delimiter {#settings-format_csv_delimiter} @@ -790,7 +790,7 @@ Caractère interprété comme un délimiteur dans les données CSV. Par défaut, ## input\_format\_csv\_unquoted\_null\_literal\_as\_null {#settings-input_format_csv_unquoted_null_literal_as_null} -Pour le format D'entrée CSV active ou désactive l'analyse des `NULL` comme littéral (synonyme de `\N`). +Pour le format D’entrée CSV active ou désactive l’analyse des `NULL` comme littéral (synonyme de `\N`). ## output\_format\_csv\_crlf\_end\_of\_line {#settings-output-format-csv-crlf-end-of-line} @@ -811,16 +811,16 @@ Valeur par défaut: 0. Quorum écrit -`INSERT` ne réussit que lorsque ClickHouse parvient à écrire correctement les données `insert_quorum` des répliques au cours de la `insert_quorum_timeout`. Si, pour une raison quelconque, le nombre de répliques avec succès écrit n'atteint pas le `insert_quorum`, l'écriture est considérée comme ayant échoué et ClickHouse supprimera le bloc inséré de toutes les répliques où les données ont déjà été écrites. +`INSERT` ne réussit que lorsque ClickHouse parvient à écrire correctement les données `insert_quorum` des répliques au cours de la `insert_quorum_timeout`. Si, pour une raison quelconque, le nombre de répliques avec succès écrit n’atteint pas le `insert_quorum`, l’écriture est considérée comme ayant échoué et ClickHouse supprimera le bloc inséré de toutes les répliques où les données ont déjà été écrites. -Toutes les répliques du quorum sont cohérentes, c'est-à-dire qu'elles contiennent des données de toutes les `INSERT` requête. Le `INSERT` la séquence est linéarisé. +Toutes les répliques du quorum sont cohérentes, c’est-à-dire qu’elles contiennent des données de toutes les `INSERT` requête. Le `INSERT` la séquence est linéarisé. Lors de la lecture des données écrites à partir du `insert_quorum`, vous pouvez utiliser le [select\_sequential\_consistency](#settings-select_sequential_consistency) option. Clickhouse génère une exception - Si le nombre de répliques au moment de la requête est inférieure à la `insert_quorum`. -- Lors d'une tentative d'écriture de données lorsque le bloc précédent n'a pas encore été inséré dans le `insert_quorum` des répliques. Cette situation peut se produire si l'utilisateur tente d'effectuer une `INSERT` avant le précédent avec le `insert_quorum` est terminé. +- Lors d’une tentative d’écriture de données lorsque le bloc précédent n’a pas encore été inséré dans le `insert_quorum` des répliques. Cette situation peut se produire si l’utilisateur tente d’effectuer une `INSERT` avant le précédent avec le `insert_quorum` est terminé. Voir aussi: @@ -829,7 +829,7 @@ Voir aussi: ## insert\_quorum\_timeout {#settings-insert_quorum-timeout} -Ecrire dans quorum timeout en secondes. Si le délai d'attente est passé et qu'aucune écriture n'a encore eu lieu, ClickHouse génère une exception et le client doit répéter la requête pour écrire le même bloc dans le même réplica ou tout autre réplica. +Ecrire dans quorum timeout en secondes. Si le délai d’attente est passé et qu’aucune écriture n’a encore eu lieu, ClickHouse génère une exception et le client doit répéter la requête pour écrire le même bloc dans le même réplica ou tout autre réplica. Valeur par défaut: 60 secondes. @@ -851,7 +851,7 @@ Valeur par défaut: 0. Utilisation -Lorsque la cohérence séquentielle est activée, ClickHouse permet au client d'exécuter `SELECT` requête uniquement pour les répliques qui contiennent des données de toutes les `INSERT` requêtes exécutées avec `insert_quorum`. Si le client fait référence à une réplique partielle, ClickHouse génère une exception. La requête SELECT n'inclut pas les données qui n'ont pas encore été écrites dans le quorum des répliques. +Lorsque la cohérence séquentielle est activée, ClickHouse permet au client d’exécuter `SELECT` requête uniquement pour les répliques qui contiennent des données de toutes les `INSERT` requêtes exécutées avec `insert_quorum`. Si le client fait référence à une réplique partielle, ClickHouse génère une exception. La requête SELECT n’inclut pas les données qui n’ont pas encore été écrites dans le quorum des répliques. Voir aussi: @@ -884,14 +884,14 @@ Valeur par défaut: 0. Utilisation -Par défaut, la déduplication n'est pas effectuée pour les vues matérialisées mais en amont, dans la table source. -Si un bloc inséré est ignoré en raison de la déduplication dans la table source, il n'y aura pas d'insertion dans les vues matérialisées attachées. Ce comportement existe pour permettre l'insertion de données hautement agrégées dans des vues matérialisées, dans les cas où les blocs insérés sont les mêmes après l'agrégation de vues matérialisées mais dérivés de différentes insertions dans la table source. -Dans le même temps, ce comportement “breaks” `INSERT` idempotence. Si un `INSERT` dans la table principale a été un succès et `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won't receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` permet de changer ce comportement. Lors d'une nouvelle tentative, une vue matérialisée recevra l'insertion répétée et effectuera une vérification de déduplication par elle-même, +Par défaut, la déduplication n’est pas effectuée pour les vues matérialisées mais en amont, dans la table source. +Si un bloc inséré est ignoré en raison de la déduplication dans la table source, il n’y aura pas d’insertion dans les vues matérialisées attachées. Ce comportement existe pour permettre l’insertion de données hautement agrégées dans des vues matérialisées, dans les cas où les blocs insérés sont les mêmes après l’agrégation de vues matérialisées mais dérivés de différentes insertions dans la table source. +Dans le même temps, ce comportement “breaks” `INSERT` idempotence. Si un `INSERT` dans la table principale a été un succès et `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won’t receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` permet de changer ce comportement. Lors d’une nouvelle tentative, une vue matérialisée recevra l’insertion répétée et effectuera une vérification de déduplication par elle-même, ignorant le résultat de la vérification pour la table source, et insérera des lignes perdues en raison de la première défaillance. ## max\_network\_bytes {#settings-max-network-bytes} -Limite le volume de données (en octets) qui est reçu ou transmis sur le réseau lors de l'exécution d'une requête. Ce paramètre s'applique à chaque individu requête. +Limite le volume de données (en octets) qui est reçu ou transmis sur le réseau lors de l’exécution d’une requête. Ce paramètre s’applique à chaque individu requête. Valeurs possibles: @@ -902,7 +902,7 @@ Valeur par défaut: 0. ## max\_network\_bandwidth {#settings-max-network-bandwidth} -Limite la vitesse de l'échange de données sur le réseau en octets par seconde. Ce paramètre s'applique à toutes les requêtes. +Limite la vitesse de l’échange de données sur le réseau en octets par seconde. Ce paramètre s’applique à toutes les requêtes. Valeurs possibles: @@ -913,7 +913,7 @@ Valeur par défaut: 0. ## max\_network\_bandwidth\_for\_user {#settings-max-network-bandwidth-for-user} -Limite la vitesse de l'échange de données sur le réseau en octets par seconde. Ce paramètre s'applique à toutes les requêtes exécutées simultanément par un seul utilisateur. +Limite la vitesse de l’échange de données sur le réseau en octets par seconde. Ce paramètre s’applique à toutes les requêtes exécutées simultanément par un seul utilisateur. Valeurs possibles: @@ -924,7 +924,7 @@ Valeur par défaut: 0. ## max\_network\_bandwidth\_for\_all\_users {#settings-max-network-bandwidth-for-all-users} -Limite la vitesse à laquelle les données sont échangées sur le réseau en octets par seconde. Ce paramètre s'applique à toutes les requêtes exécutées simultanément sur le serveur. +Limite la vitesse à laquelle les données sont échangées sur le réseau en octets par seconde. Ce paramètre s’applique à toutes les requêtes exécutées simultanément sur le serveur. Valeurs possibles: @@ -935,15 +935,15 @@ Valeur par défaut: 0. ## count\_distinct\_implementation {#settings-count_distinct_implementation} -Spécifie de l' `uniq*` les fonctions doivent être utilisées pour [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count) construction. +Spécifie de l’ `uniq*` les fonctions doivent être utilisées pour [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count) construction. Valeurs possibles: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqcombiné](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [uniqCombined64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [uniqHLL12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [uniqExact](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqcombiné](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [uniqCombined64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [uniqHLL12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [uniqExact](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) Valeur par défaut: `uniqExact`. @@ -951,7 +951,7 @@ Valeur par défaut: `uniqExact`. Active ou désactive le saut silencieux des fragments indisponibles. -Tesson est considéré comme indisponible si toutes ses répliques ne sont pas disponibles. Une réplique n'est pas disponible dans les cas suivants: +Tesson est considéré comme indisponible si toutes ses répliques ne sont pas disponibles. Une réplique n’est pas disponible dans les cas suivants: - ClickHouse ne peut pas se connecter à la réplique pour une raison quelconque. @@ -959,21 +959,21 @@ Tesson est considéré comme indisponible si toutes ses répliques ne sont pas d - La réplique ne peut pas être résolue via le DNS. - Si le nom d'hôte du réplica ne peut pas être résolu via DNS, il peut indiquer les situations suivantes: + Si le nom d’hôte du réplica ne peut pas être résolu via DNS, il peut indiquer les situations suivantes: - - L'hôte de la réplique n'a pas d'enregistrement DNS. Il peut se produire dans les systèmes avec DNS dynamique, par exemple, [Kubernetes](https://kubernetes.io), où les nœuds peuvent être insolubles pendant les temps d'arrêt, et ce n'est pas une erreur. + - L’hôte de la réplique n’a pas d’enregistrement DNS. Il peut se produire dans les systèmes avec DNS dynamique, par exemple, [Kubernetes](https://kubernetes.io), où les nœuds peuvent être insolubles pendant les temps d’arrêt, et ce n’est pas une erreur. - - Erreur de Configuration. Le fichier de configuration ClickHouse contient un mauvais nom d'hôte. + - Erreur de Configuration. Le fichier de configuration ClickHouse contient un mauvais nom d’hôte. Valeurs possibles: - 1 — skipping enabled. - Si un fragment n'est pas disponible, ClickHouse renvoie un résultat basé sur des données partielles et ne signale pas les problèmes de disponibilité des nœuds. + Si un fragment n’est pas disponible, ClickHouse renvoie un résultat basé sur des données partielles et ne signale pas les problèmes de disponibilité des nœuds. - 0 — skipping disabled. - Si un fragment n'est pas disponible, ClickHouse lève une exception. + Si un fragment n’est pas disponible, ClickHouse lève une exception. Valeur par défaut: 0. @@ -985,13 +985,13 @@ Valeur par défaut: 0 ## force\_optimize\_skip\_unused\_shards {#settings-force_optimize_skip_unused_shards} -Active ou désactive l'exécution de la requête si [`optimize_skip_unused_shards`](#settings-optimize_skip_unused_shards) activé et sauter des fragments inutilisés n'est pas possible. Si le saut n'est pas possible et le paramètre est activé, une exception sera levée. +Active ou désactive l’exécution de la requête si [`optimize_skip_unused_shards`](#settings-optimize_skip_unused_shards) activé et sauter des fragments inutilisés n’est pas possible. Si le saut n’est pas possible et le paramètre est activé, une exception sera levée. Valeurs possibles: - 0 - Désactivé (ne jette) -- 1-Désactiver l'exécution de la requête uniquement si la table a une clé de sharding -- 2-Désactiver l'exécution de la requête quelle que soit la clé de sharding est définie pour la table +- 1-Désactiver l’exécution de la requête uniquement si la table a une clé de sharding +- 2-Désactiver l’exécution de la requête quelle que soit la clé de sharding est définie pour la table Valeur par défaut: 0 @@ -1008,9 +1008,9 @@ Valeur par défaut: 0. ## optimize\_throw\_if\_noop {#setting-optimize_throw_if_noop} -Active ou désactive le lancement d'une exception si [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) la requête n'a pas effectué de fusion. +Active ou désactive le lancement d’une exception si [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) la requête n’a pas effectué de fusion. -Par défaut, `OPTIMIZE` retourne avec succès même s'il n'a rien fait. Ce paramètre vous permet de différencier ces situations et d'obtenir la raison dans un message d'exception. +Par défaut, `OPTIMIZE` retourne avec succès même s’il n’a rien fait. Ce paramètre vous permet de différencier ces situations et d’obtenir la raison dans un message d’exception. Valeurs possibles: @@ -1028,7 +1028,7 @@ Contrôle la vitesse à laquelle les erreurs dans les tables distribuées sont m Voir aussi: -- [Tableau moteur Distribués](../../engines/table_engines/special/distributed.md) +- [Tableau moteur Distribués](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_cap](#settings-distributed_replica_error_cap) ## distributed\_replica\_error\_cap {#settings-distributed_replica_error_cap} @@ -1036,16 +1036,16 @@ Voir aussi: - Type: unsigned int - Valeur par défaut: 1000 -Le nombre d'erreurs de chaque réplique est plafonné à cette valeur, empêchant une seule réplique d'accumuler trop d'erreurs. +Le nombre d’erreurs de chaque réplique est plafonné à cette valeur, empêchant une seule réplique d’accumuler trop d’erreurs. Voir aussi: -- [Tableau moteur Distribués](../../engines/table_engines/special/distributed.md) +- [Tableau moteur Distribués](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_half\_life](#settings-distributed_replica_error_half_life) ## distributed\_directory\_monitor\_sleep\_time\_ms {#distributed_directory_monitor_sleep_time_ms} -Intervalle de Base pour le [Distribué](../../engines/table_engines/special/distributed.md) tableau moteur à envoyer des données. L'intervalle réel augmente de façon exponentielle en cas d'erreurs. +Intervalle de Base pour le [Distribué](../../engines/table-engines/special/distributed.md) tableau moteur à envoyer des données. L’intervalle réel augmente de façon exponentielle en cas d’erreurs. Valeurs possibles: @@ -1055,7 +1055,7 @@ Valeur par défaut: 100 millisecondes. ## distributed\_directory\_monitor\_max\_sleep\_time\_ms {#distributed_directory_monitor_max_sleep_time_ms} -Intervalle maximal pour le [Distribué](../../engines/table_engines/special/distributed.md) tableau moteur à envoyer des données. Limite la croissance exponentielle de l'intervalle défini dans [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) paramètre. +Intervalle maximal pour le [Distribué](../../engines/table-engines/special/distributed.md) tableau moteur à envoyer des données. Limite la croissance exponentielle de l’intervalle défini dans [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) paramètre. Valeurs possibles: @@ -1065,9 +1065,9 @@ Valeur par défaut: 30000 millisecondes (30 secondes). ## distributed\_directory\_monitor\_batch\_inserts {#distributed_directory_monitor_batch_inserts} -Active / désactive l'envoi des données insérées par lots. +Active / désactive l’envoi des données insérées par lots. -Lorsque l'envoi par lots est activé, le [Distribué](../../engines/table_engines/special/distributed.md) tableau moteur essaie d'envoyer plusieurs fichiers de données insérées dans une seule opération au lieu de les envoyer séparément. L'envoi par lots améliore les performances du cluster en utilisant mieux les ressources du serveur et du réseau. +Lorsque l’envoi par lots est activé, le [Distribué](../../engines/table-engines/special/distributed.md) tableau moteur essaie d’envoyer plusieurs fichiers de données insérées dans une seule opération au lieu de les envoyer séparément. L’envoi par lots améliore les performances du cluster en utilisant mieux les ressources du serveur et du réseau. Valeurs possibles: @@ -1078,22 +1078,22 @@ Valeur par défaut: 0. ## os\_thread\_priority {#setting-os-thread-priority} -Définit la priorité ([beau](https://en.wikipedia.org/wiki/Nice_(Unix))) pour les threads qui exécutent des requêtes. Le planificateur du système d'exploitation considère cette priorité lors du choix du prochain thread à exécuter sur chaque noyau CPU disponible. +Définit la priorité ([beau](https://en.wikipedia.org/wiki/Nice_(Unix))) pour les threads qui exécutent des requêtes. Le planificateur du système d’exploitation considère cette priorité lors du choix du prochain thread à exécuter sur chaque noyau CPU disponible. !!! warning "Avertissement" - Pour utiliser ce paramètre, vous devez définir l' `CAP_SYS_NICE` capacité. Le `clickhouse-server` paquet configure lors de l'installation. Certains environnements virtuels ne vous permettent pas de définir `CAP_SYS_NICE` capacité. Dans ce cas, `clickhouse-server` affiche un message à ce sujet au début. + Pour utiliser ce paramètre, vous devez définir l’ `CAP_SYS_NICE` capacité. Le `clickhouse-server` paquet configure lors de l’installation. Certains environnements virtuels ne vous permettent pas de définir `CAP_SYS_NICE` capacité. Dans ce cas, `clickhouse-server` affiche un message à ce sujet au début. Valeurs possibles: - Vous pouvez définir des valeurs dans la gamme `[-20, 19]`. -Des valeurs plus faibles signifient une priorité plus élevée. Les discussions avec des bas `nice` les valeurs de priorité sont effectués plus fréquemment que les discussions avec des valeurs élevées. Les valeurs élevées sont préférables pour les requêtes non interactives de longue durée, car elles leur permettent d'abandonner rapidement des ressources au profit de requêtes interactives courtes lorsqu'elles arrivent. +Des valeurs plus faibles signifient une priorité plus élevée. Les discussions avec des bas `nice` les valeurs de priorité sont effectués plus fréquemment que les discussions avec des valeurs élevées. Les valeurs élevées sont préférables pour les requêtes non interactives de longue durée, car elles leur permettent d’abandonner rapidement des ressources au profit de requêtes interactives courtes lorsqu’elles arrivent. Valeur par défaut: 0. ## query\_profiler\_real\_time\_period\_ns {#query_profiler_real_time_period_ns} -Définit la période pour une horloge réelle de la [requête profiler](../../operations/optimizing_performance/sampling_query_profiler.md). La vraie minuterie d'horloge compte le temps d'horloge murale. +Définit la période pour une horloge réelle de la [requête profiler](../../operations/optimizing-performance/sampling-query-profiler.md). La vraie minuterie d’horloge compte le temps d’horloge murale. Valeurs possibles: @@ -1106,17 +1106,17 @@ Valeurs possibles: - 0 pour éteindre la minuterie. -Type: [UInt64](../../sql_reference/data_types/int_uint.md). +Type: [UInt64](../../sql-reference/data-types/int-uint.md). Valeur par défaut: 1000000000 nanosecondes (une fois par seconde). Voir aussi: -- Système de table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- Système de table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## query\_profiler\_cpu\_time\_period\_ns {#query_profiler_cpu_time_period_ns} -Définit la période pour une minuterie D'horloge CPU du [requête profiler](../../operations/optimizing_performance/sampling_query_profiler.md). Cette minuterie ne compte que le temps CPU. +Définit la période pour une minuterie D’horloge CPU du [requête profiler](../../operations/optimizing-performance/sampling-query-profiler.md). Cette minuterie ne compte que le temps CPU. Valeurs possibles: @@ -1129,17 +1129,17 @@ Valeurs possibles: - 0 pour éteindre la minuterie. -Type: [UInt64](../../sql_reference/data_types/int_uint.md). +Type: [UInt64](../../sql-reference/data-types/int-uint.md). Valeur par défaut: 1000000000 nanosecondes. Voir aussi: -- Système de table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- Système de table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## allow\_introspection\_functions {#settings-allow_introspection_functions} -Active des désactive [obscures fonctions](../../sql_reference/functions/introspection.md) pour le profilage de requête. +Active des désactive [obscures fonctions](../../sql-reference/functions/introspection.md) pour le profilage de requête. Valeurs possibles: @@ -1150,15 +1150,15 @@ Valeur par défaut: 0. **Voir Aussi** -- [Échantillonnage Du Profileur De Requête](../optimizing_performance/sampling_query_profiler.md) -- Système de table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- [Échantillonnage Du Profileur De Requête](../optimizing-performance/sampling-query-profiler.md) +- Système de table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## input\_format\_parallel\_parsing {#input-format-parallel-parsing} - Type: bool - Valeur par défaut: True -Activer l'analyse parallèle des formats de données en préservant l'ordre. Pris en charge uniquement pour les formats TSV, TKSV, CSV et jsoneachrow. +Activer l’analyse parallèle des formats de données en préservant l’ordre. Pris en charge uniquement pour les formats TSV, TKSV, CSV et jsoneachrow. ## min\_chunk\_bytes\_for\_parallel\_parsing {#min-chunk-bytes-for-parallel-parsing} @@ -1193,7 +1193,7 @@ Valeur par défaut: 32768 (32 Ko) ## format\_avro\_schema\_registry\_url {#settings-format_avro_schema_registry_url} -Définit L'URL de Registre de schéma Confluent à utiliser avec [AvroConfluent](../../interfaces/formats.md#data-format-avro-confluent) format +Définit L’URL de Registre de schéma Confluent à utiliser avec [AvroConfluent](../../interfaces/formats.md#data-format-avro-confluent) format Type: URL diff --git a/docs/fr/operations/settings/settings_profiles.md b/docs/fr/operations/settings/settings_profiles.md deleted file mode 100644 index 8a25c440d31..00000000000 --- a/docs/fr/operations/settings/settings_profiles.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 61 -toc_title: "Les Param\xE8tres Des Profils" ---- - -# Les Paramètres Des Profils {#settings-profiles} - -Un profil de paramètres est une collection de paramètres regroupés sous le même nom. Chaque utilisateur de ClickHouse a un profil. -Pour appliquer tous les paramètres d'un profil, définissez `profile` paramètre. - -Exemple: - -Installer le `web` profil. - -``` sql -SET profile = 'web' -``` - -Les profils de paramètres sont déclarés dans le fichier de configuration utilisateur. Ce n'est généralement `users.xml`. - -Exemple: - -``` xml - - - - - - 8 - - - - - 1000000000 - 100000000000 - - 1000000 - any - - 1000000 - 1000000000 - - 100000 - 100000000 - break - - 600 - 1000000 - 15 - - 25 - 100 - 50 - - 2 - 25 - 50 - 100 - - 1 - - -``` - -L'exemple spécifie deux profils: `default` et `web`. Le `default` profil a un but particulier: il doit toujours être présent et est appliquée lors du démarrage du serveur. En d'autres termes, l' `default` profil contient les paramètres par défaut. Le `web` profil est un profil régulier qui peut être défini à l'aide `SET` requête ou en utilisant un paramètre URL dans une requête HTTP. - -Paramètres les profils peuvent hériter les uns des autres. Pour utiliser l'héritage, indiquer un ou plusieurs `profile` paramètres avant les autres paramètres répertoriés dans le profil. Dans le cas où un paramètre est défini dans les différents profils, les dernières définie est utilisée. - -[Article Original](https://clickhouse.tech/docs/en/operations/settings/settings_profiles/) diff --git a/docs/fr/operations/settings/settings_users.md b/docs/fr/operations/settings/settings_users.md deleted file mode 100644 index 2565f820163..00000000000 --- a/docs/fr/operations/settings/settings_users.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 63 -toc_title: "Les Param\xE8tres De L'Utilisateur" ---- - -# Les Paramètres De L'Utilisateur {#user-settings} - -Le `users` la section de la `user.xml` le fichier de configuration contient les paramètres utilisateur. - -La Structure de la `users` section: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### nom\_utilisateur/mot de passe {#user-namepassword} - -Le mot de passe peut être spécifié en texte clair ou en SHA256 (format hexadécimal). - -- Pour attribuer un mot de passe en clair (**pas recommandé**), la placer dans un `password` élément. - - Exemple, `qwerty`. Le mot de passe peut être laissé en blanc. - - - -- Pour attribuer un mot de passe à l'aide de son hachage SHA256, placez-le dans un `password_sha256_hex` élément. - - Exemple, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - Exemple de génération d'un mot de passe à partir du shell: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - - La première ligne du résultat est le mot de passe. La deuxième ligne est le hachage SHA256 correspondant. - - - -- Pour la compatibilité avec les clients MySQL, le mot de passe peut être spécifié dans le hachage double SHA1. Le placer dans `password_double_sha1_hex` élément. - - Exemple, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - Exemple de génération d'un mot de passe à partir du shell: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - - La première ligne du résultat est le mot de passe. La deuxième ligne est le double hachage SHA1 correspondant. - -### nom\_utilisateur / réseaux {#user-namenetworks} - -Liste des réseaux à partir desquels L'utilisateur peut se connecter au serveur ClickHouse. - -Chaque élément de la liste peut avoir l'une des formes suivantes: - -- `` — IP address or network mask. - - Exemple: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Hostname. - - Exemple: `example01.host.ru`. - - Pour vérifier l'accès, une requête DNS est effectuée et toutes les adresses IP renvoyées sont comparées à l'adresse homologue. - -- `` — Regular expression for hostnames. - - Exemple, `^example\d\d-\d\d-\d\.host\.ru$` - - Pour vérifier l'accès, un [Requête DNS PTR](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) est effectuée pour l'adresse homologue, puis l'expression rationnelle spécifiée est appliquée. Ensuite, une autre requête DNS est effectuée pour les résultats de la requête PTR et toutes les adresses reçues sont comparées à l'adresse homologue. Nous recommandons fortement que regexp se termine avec $. - -Tous les résultats des requêtes DNS sont mis en cache jusqu'au redémarrage du serveur. - -**Exemple** - -Pour ouvrir l'accès de l'utilisateur à partir de n'importe quel réseau, spécifiez: - -``` xml -::/0 -``` - -!!! warning "Avertissement" - Il n'est pas sûr d'ouvrir l'accès à partir de n'importe quel réseau, sauf si vous avez un pare-feu correctement configuré ou si le serveur n'est pas directement connecté à Internet. - -Pour ouvrir l'accès uniquement à partir de localhost, spécifier: - -``` xml -::1 -127.0.0.1 -``` - -### nom\_utilisateur / profil {#user-nameprofile} - -Vous pouvez attribuer un profil des paramètres pour l'utilisateur. Les profils de paramètres sont configurés dans une section distincte du `users.xml` fichier. Pour plus d'informations, voir [Profils des paramètres](settings_profiles.md). - -### nom\_utilisateur / quota {#user-namequota} - -Les Quotas vous permettent de suivre ou de limiter l'utilisation des ressources sur une période donnée. Les Quotas sont configurés dans le `quotas` -la section de la `users.xml` fichier de configuration. - -Vous pouvez attribuer un jeu de quotas à l'utilisateur. Pour une description détaillée de la configuration des quotas, voir [Quota](../quotas.md#quotas). - -### nom\_utilisateur/bases de données {#user-namedatabases} - -Dans cette section, vous pouvez limiter les lignes renvoyées par ClickHouse pour `SELECT` requêtes faites par l'utilisateur actuel, implémentant ainsi la sécurité de base au niveau de la ligne. - -**Exemple** - -La configuration suivante force cet utilisateur `user1` ne peut voir les lignes de `table1` comme le résultat de `SELECT` requêtes, où la valeur de la `id` le champ est 1000. - -``` xml - - - - - id = 1000 - - - - -``` - -Le `filter` peut être n'importe quelle expression résultant en un [UInt8](../../sql_reference/data_types/int_uint.md)-le type de la valeur. Il contient généralement des comparaisons et des opérateurs logiques. Les lignes de `database_name.table1` où filtrer les résultats à 0 ne sont pas retournés pour cet utilisateur. Le filtrage est incompatible avec `PREWHERE` opérations et désactive `WHERE→PREWHERE` optimisation. - -[Article Original](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/fr/operations/system-tables.md b/docs/fr/operations/system-tables.md new file mode 100644 index 00000000000..878f0ac53a6 --- /dev/null +++ b/docs/fr/operations/system-tables.md @@ -0,0 +1,1097 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 52 +toc_title: "Les Tables Syst\xE8me" +--- + +# Les Tables Système {#system-tables} + +Les tables système sont utilisées pour implémenter une partie des fonctionnalités du système et pour fournir un accès à des informations sur le fonctionnement du système. +Vous ne pouvez pas supprimer une table système (mais vous pouvez effectuer un détachement). +Les tables système n’ont pas de fichiers avec des données sur le disque ou de fichiers avec des métadonnées. Le serveur crée toutes les tables système au démarrage. +Les tables système sont en lecture seule. +Ils sont situés dans la ‘system’ la base de données. + +## système.asynchronous\_metrics {#system_tables-asynchronous_metrics} + +Contient des mesures qui sont calculées périodiquement en arrière-plan. Par exemple, la quantité de RAM utilisée. + +Colonne: + +- `metric` ([Chaîne](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Float64](../sql-reference/data-types/float.md)) — Metric value. + +**Exemple** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**Voir Aussi** + +- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. +- [système.métrique](#system_tables-metrics) — Contains instantly calculated metrics. +- [système.événement](#system_tables-events) — Contains a number of events that have occurred. +- [système.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. + +## système.cluster {#system-clusters} + +Contient des informations sur les clusters disponibles dans le fichier de configuration et les serveurs en eux. + +Colonne: + +- `cluster` (String) — The cluster name. +- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. +- `shard_weight` (UInt32) — The relative weight of the shard when writing data. +- `replica_num` (UInt32) — The replica number in the shard, starting from 1. +- `host_name` (String) — The host name, as specified in the config. +- `host_address` (String) — The host IP address obtained from DNS. +- `port` (UInt16) — The port to use for connecting to the server. +- `user` (String) — The name of the user for connecting to the server. +- `errors_count` (UInt32) - nombre de fois que cet hôte n’a pas atteint le réplica. +- `estimated_recovery_time` (UInt32) - secondes restantes jusqu’à ce que le nombre d’erreurs de réplique soit remis à zéro et qu’il soit considéré comme revenu à la normale. + +Veuillez noter que `errors_count` est mise à jour une fois par requête à la grappe, mais `estimated_recovery_time` est recalculé sur-demande. Il pourrait donc y avoir un cas de non-zéro `errors_count` et zéro `estimated_recovery_time`, cette requête suivante sera nulle `errors_count` et essayez d’utiliser des répliques comme si elle ne comporte pas d’erreurs. + +**Voir aussi** + +- [Tableau moteur Distribués](../engines/table-engines/special/distributed.md) +- [paramètre distributed\_replica\_error\_cap](settings/settings.md#settings-distributed_replica_error_cap) +- [paramètre distributed\_replica\_error\_half\_life](settings/settings.md#settings-distributed_replica_error_half_life) + +## système.colonne {#system-columns} + +Contient des informations sur les colonnes de toutes les tables. + +Vous pouvez utiliser ce tableau pour obtenir des informations similaires à l’ [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table) requête, mais pour plusieurs tables à la fois. + +Le `system.columns` le tableau contient les colonnes suivantes (la colonne type est indiqué entre parenthèses): + +- `database` (String) — Database name. +- `table` (String) — Table name. +- `name` (String) — Column name. +- `type` (String) — Column type. +- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) pour la valeur par défaut, ou une chaîne vide si elle n’est pas définie. +- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. +- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. +- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. +- `marks_bytes` (UInt64) — The size of marks, in bytes. +- `comment` (String) — Comment on the column, or an empty string if it is not defined. +- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. +- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. +- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. +- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. + +## système.contributeur {#system-contributors} + +Contient des informations sur les donateurs. Tous les constributors dans un ordre aléatoire. L’ordre est aléatoire au moment de l’exécution de la requête. + +Colonne: + +- `name` (String) — Contributor (author) name from git log. + +**Exemple** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +Trouver vous-même dans le tableau, utilisez une requête: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## système.les bases de données {#system-databases} + +Cette table contient une seule colonne de chaîne appelée ‘name’ – the name of a database. +Chaque base de données que le serveur connaît a une entrée correspondante dans la table. +Cette table système est utilisée pour implémenter `SHOW DATABASES` requête. + +## système.detached\_parts {#system_tables-detached_parts} + +Contient des informations sur les pièces détachées de [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) table. Le `reason` colonne spécifie pourquoi la pièce a été détachée. Pour les pièces détachées par l’utilisateur, la raison est vide. De telles pièces peuvent être attachées avec [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) commande. Pour la description des autres colonnes, voir [système.partie](#system_tables-parts). Si le nom de pièce n’est pas valide, les valeurs de certaines colonnes peuvent être `NULL`. Ces pièces peuvent être supprimés avec [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). + +## système.dictionnaire {#system-dictionaries} + +Contient des informations sur les dictionnaires externes. + +Colonne: + +- `name` (String) — Dictionary name. +- `type` (String) — Dictionary type: Flat, Hashed, Cache. +- `origin` (String) — Path to the configuration file that describes the dictionary. +- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. +- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. +- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. +- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. +- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. +- `element_count` (UInt64) — The number of items stored in the dictionary. +- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). +- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. +- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn’t be created. +- `source` (String) — Text describing the data source for the dictionary. + +Notez que la quantité de mémoire utilisée par le dictionnaire n’est pas proportionnel au nombre d’articles qui s’y trouvent. Ainsi, pour les dictionnaires plats et mis en cache, toutes les cellules de mémoire sont pré-assignées, quelle que soit la capacité du dictionnaire. + +## système.événement {#system_tables-events} + +Contient des informations sur le nombre d’événements survenus dans le système. Par exemple, dans le tableau, vous pouvez trouver combien `SELECT` les requêtes ont été traitées depuis le démarrage du serveur ClickHouse. + +Colonne: + +- `event` ([Chaîne](../sql-reference/data-types/string.md)) — Event name. +- `value` ([UInt64](../sql-reference/data-types/int-uint.md)) — Number of events occurred. +- `description` ([Chaîne](../sql-reference/data-types/string.md)) — Event description. + +**Exemple** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Voir Aussi** + +- [système.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [système.métrique](#system_tables-metrics) — Contains instantly calculated metrics. +- [système.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. + +## système.fonction {#system-functions} + +Contient des informations sur les fonctions normales et agrégées. + +Colonne: + +- `name`(`String`) – The name of the function. +- `is_aggregate`(`UInt8`) — Whether the function is aggregate. + +## système.graphite\_retentions {#system-graphite-retentions} + +Contient des informations sur les paramètres [graphite\_rollup](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) qui sont utilisés dans les tableaux avec [\* GraphiteMergeTree](../engines/table-engines/mergetree-family/graphitemergetree.md) moteur. + +Colonne: + +- `config_name` (Chaîne) - `graphite_rollup` nom du paramètre. +- `regexp` (Chaîne) - un modèle pour le nom de la métrique. +- `function` (Chaîne) - le nom de la fonction d’agrégation. +- `age` (UInt64) - l’âge minimum des données en secondes. +- `precision` (UInt64) - comment définir précisément l’âge des données en secondes. +- `priority` (UInt16) - priorité de motif. +- `is_default` (UInt8) - indique si le motif est la valeur par défaut. +- `Tables.database` (Array (String)) - tableau de noms de tables de base de données qui utilisent `config_name` paramètre. +- `Tables.table` (Array (String)) - tableau de noms de tables qui utilisent `config_name` paramètre. + +## système.fusionner {#system-merges} + +Contient des informations sur les fusions et les mutations de pièces actuellement en cours pour les tables de la famille MergeTree. + +Colonne: + +- `database` (String) — The name of the database the table is in. +- `table` (String) — Table name. +- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. +- `progress` (Float64) — The percentage of completed work from 0 to 1. +- `num_parts` (UInt64) — The number of pieces to be merged. +- `result_part_name` (String) — The name of the part that will be formed as the result of merging. +- `is_mutation` (UInt8) - 1 si ce processus est une mutation partielle. +- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. +- `total_size_marks` (UInt64) — The total number of marks in the merged parts. +- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. +- `rows_read` (UInt64) — Number of rows read. +- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. +- `rows_written` (UInt64) — Number of rows written. + +## système.métrique {#system_tables-metrics} + +Contient des mesures qui peuvent être calculées instantanément, ou ont une valeur actuelle. Par exemple, le nombre de requêtes traitées ou en cours réplique de retard. Ce tableau est toujours à jour. + +Colonne: + +- `metric` ([Chaîne](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — Metric value. +- `description` ([Chaîne](../sql-reference/data-types/string.md)) — Metric description. + +La liste des mesures que vous pouvez trouver dans le [SGBD / commun / CurrentMetrics.rpc](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Common/CurrentMetrics.cpp) fichier source de ClickHouse. + +**Exemple** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Voir Aussi** + +- [système.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [système.événement](#system_tables-events) — Contains a number of events that occurred. +- [système.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. + +## système.metric\_log {#system_tables-metric_log} + +Contient l’historique des valeurs de métriques des tables `system.metrics` et `system.events` périodiquement vidé sur le disque. +Pour activer la collection d’historique des métriques `system.metric_log`, créer `/etc/clickhouse-server/config.d/metric_log.xml` avec le contenu suivant: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**Exemple** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**Voir aussi** + +- [système.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [système.événement](#system_tables-events) — Contains a number of events that occurred. +- [système.métrique](#system_tables-metrics) — Contains instantly calculated metrics. +- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. + +## système.nombre {#system-numbers} + +Cette table contient une seule colonne UInt64 nommée ‘number’ qui contient presque tous les nombres naturels à partir de zéro. +Vous pouvez utiliser cette table pour les tests, ou si vous avez besoin de faire une recherche de force brute. +Les lectures de cette table ne sont pas parallélisées. + +## système.numbers\_mt {#system-numbers-mt} + +Le même que ‘system.numbers’ mais les lectures sont parallélisées. Les nombres peuvent être retournés dans n’importe quel ordre. +Utilisé pour les tests. + +## système.un {#system-one} + +Cette table contient une seule ligne avec un ‘dummy’ Colonne UInt8 contenant la valeur 0. +Cette table est utilisée si une requête SELECT ne spécifie pas la clause FROM. +Ceci est similaire à la table double trouvée dans d’autres SGBD. + +## système.partie {#system_tables-parts} + +Contient des informations sur les parties de [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) table. + +Chaque ligne décrit une partie des données. + +Colonne: + +- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql-reference/statements/alter.md#query_language_queries_alter) requête. + + Format: + + - `YYYYMM` pour le partitionnement automatique par mois. + - `any_string` lors du partitionnement manuel. + +- `name` (`String`) – Name of the data part. + +- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. + +- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` par la granularité d’index (généralement 8192) (cet indice ne fonctionne pas pour la granularité adaptative). + +- `rows` (`UInt64`) – The number of rows. + +- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. + +- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `marks_bytes` (`UInt64`) – The size of the file with marks. + +- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| + +- `remove_time` (`DateTime`) – The time when the data part became inactive. + +- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. + +- `min_date` (`Date`) – The minimum value of the date key in the data part. + +- `max_date` (`Date`) – The maximum value of the date key in the data part. + +- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. + +- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. + +- `partition_id` (`String`) – ID of the partition. + +- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. + +- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. + +- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. + +- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. + +- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition) + +- `database` (`String`) – Name of the database. + +- `table` (`String`) – Name of the table. + +- `engine` (`String`) – Name of the table engine without parameters. + +- `path` (`String`) – Absolute path to the folder with data part files. + +- `disk` (`String`) – Name of a disk that stores the data part. + +- `hash_of_all_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) de fichiers compressés. + +- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) de fichiers non compressés (fichiers avec des marques, fichier d’index, etc.). + +- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) des données dans les fichiers compressés comme s’ils étaient non compressé. + +- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. + +- `marks_size` (`UInt64`) – Alias for `marks_bytes`. + +## système.part\_log {#system_tables-part-log} + +Le `system.part_log` la table est créée uniquement si [part\_log](server-configuration-parameters/settings.md#server_configuration_parameters-part-log) serveur paramètre est spécifié. + +Ce tableau contient des informations sur les événements survenus avec [les parties de données](../engines/table-engines/mergetree-family/custom-partitioning-key.md) dans le [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) table de famille, telles que l’ajout ou la fusion de données. + +Le `system.part_log` le tableau contient les colonnes suivantes: + +- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: + - `NEW_PART` — Inserting of a new data part. + - `MERGE_PARTS` — Merging of data parts. + - `DOWNLOAD_PART` — Downloading a data part. + - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — Mutating of a data part. + - `MOVE_PART` — Moving the data part from the one disk to another one. +- `event_date` (Date) — Event date. +- `event_time` (DateTime) — Event time. +- `duration_ms` (UInt64) — Duration. +- `database` (String) — Name of the database the data part is in. +- `table` (String) — Name of the table the data part is in. +- `part_name` (String) — Name of the data part. +- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ si le partitionnement est par `tuple()`. +- `rows` (UInt64) — The number of rows in the data part. +- `size_in_bytes` (UInt64) — Size of the data part in bytes. +- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). +- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. +- `read_rows` (UInt64) — The number of rows was read during the merge. +- `read_bytes` (UInt64) — The number of bytes was read during the merge. +- `error` (UInt16) — The code number of the occurred error. +- `exception` (String) — Text message of the occurred error. + +Le `system.part_log` la table est créée après la première insertion de données `MergeTree` table. + +## système.processus {#system_tables-processes} + +Cette table système est utilisée pour implémenter `SHOW PROCESSLIST` requête. + +Colonne: + +- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` utilisateur. Le champ contient le nom d’utilisateur pour une requête spécifique, pas pour une requête que cette requête lancée. +- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` sur le serveur du demandeur de requête. +- `elapsed` (Float64) – The time in seconds since request execution started. +- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. +- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query-complexity.md#settings_max_memory_usage) paramètre. +- `query` (String) – The query text. For `INSERT` il n’inclut pas les données à insérer. +- `query_id` (String) – Query ID, if defined. + +## système.text\_log {#system-tables-text-log} + +Contient des entrées de journalisation. Niveau de journalisation qui va à cette table peut être limité `text_log.level` paramètre de serveur. + +Colonne: + +- `event_date` (`Date`) - Date de l’entrée. +- `event_time` (`DateTime`) - Temps de l’entrée. +- `microseconds` (`UInt32`) - Microsecondes de l’entrée. +- `thread_name` (String) — Name of the thread from which the logging was done. +- `thread_id` (UInt64) — OS thread ID. +- `level` (`Enum8`) - Niveau d’entrée. + - `'Fatal' = 1` + - `'Critical' = 2` + - `'Error' = 3` + - `'Warning' = 4` + - `'Notice' = 5` + - `'Information' = 6` + - `'Debug' = 7` + - `'Trace' = 8` +- `query_id` (`String`)- ID de la requête. +- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) +- `message` (`String`) - Le message lui-même. +- `revision` (`UInt32`)- Révision ClickHouse. +- `source_file` (`LowCardinality(String)`)- Fichier Source à partir duquel la journalisation a été effectuée. +- `source_line` (`UInt64`)- Ligne Source à partir de laquelle la journalisation a été effectuée. + +## système.query\_log {#system_tables-query_log} + +Contient des informations sur l’exécution de requêtes. Pour chaque requête, vous pouvez voir l’Heure de début du traitement, la durée du traitement, les messages d’erreur et d’autres informations. + +!!! note "Note" + Le tableau ne contient pas les données d’entrée pour `INSERT` requête. + +Clickhouse crée cette table uniquement si [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) serveur paramètre est spécifié. Ce paramètre définit les règles de journalisation, tels que l’intervalle d’enregistrement ou le nom de la table, la requête sera connecté. + +Pour activer la journalisation des requêtes, définissez [log\_queries](settings/settings.md#settings-log-queries) paramètre 1. Pour plus de détails, voir le [Paramètre](settings/settings.md) section. + +Le `system.query_log` table enregistre deux types de requêtes: + +1. Requêtes initiales qui ont été exécutées directement par le client. +2. Requêtes enfants initiées par d’autres requêtes (pour l’exécution de requêtes distribuées). Pour ces types de requêtes, des informations sur les requêtes parentes sont affichées dans `initial_*` colonne. + +Colonne: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` des requêtes, le nombre de lignes. Pour les autres requêtes, la valeur de la colonne est 0. +- `written_bytes` (UInt64) — For `INSERT` des requêtes, le nombre d’octets écrits. Pour les autres requêtes, la valeur de la colonne est 0. +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP est exécuté. +- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) ou un autre nom de client TCP. +- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. +- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. +- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. +- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) ou une autre version du client TCP. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` la méthode a été utilisée. + - 2 — `POST` la méthode a été utilisée. +- `http_user_agent` (String) — The `UserAgent` en-tête passé dans la requête HTTP. +- `quota_key` (String) — The “quota key” spécifié dans le [quota](quotas.md) (voir `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [système.événement](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` colonne. +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` paramètre 1. +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` colonne. + +Chaque requête crée une ou deux lignes dans le `query_log` le tableau, en fonction de l’état de la requête: + +1. Si l’exécution de la requête est réussie, deux événements de type 1 et 2 sont créés (voir `type` colonne). +2. Si une erreur s’est produite pendant le traitement de la requête, deux événements avec les types 1 et 4 sont créés. +3. Si une erreur s’est produite avant le lancement de la requête, un seul événement de type 3 est créé. + +Par défaut, les journaux sont ajoutés à la table à des intervalles de 7,5 secondes. Vous pouvez définir cet intervalle dans la [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) configuration du serveur (voir `flush_interval_milliseconds` paramètre). Pour vider les journaux de force du tampon mémoire dans la table, utilisez le `SYSTEM FLUSH LOGS` requête. + +Lorsque la table est supprimée manuellement, il sera automatiquement créé à la volée. Notez que tous les précédents journaux seront supprimés. + +!!! note "Note" + La période de stockage des journaux est illimitée. Les journaux ne sont pas automatiquement supprimés de la table. Vous devez organiser vous-même la suppression des journaux obsolètes. + +Vous pouvez spécifier une clé de partitionnement arbitraire pour `system.query_log` la table dans le [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) configuration du serveur (voir `partition_by` paramètre). + +## système.query\_thread\_log {#system_tables-query-thread-log} + +La table contient des informations sur chaque thread d’exécution de requête. + +Clickhouse crée cette table uniquement si [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) serveur paramètre est spécifié. Ce paramètre définit les règles de journalisation, tels que l’intervalle d’enregistrement ou le nom de la table, la requête sera connecté. + +Pour activer la journalisation des requêtes, définissez [log\_query\_threads](settings/settings.md#settings-log-query-threads) paramètre 1. Pour plus de détails, voir le [Paramètre](settings/settings.md) section. + +Colonne: + +- `event_date` (Date) — the date when the thread has finished execution of the query. +- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` des requêtes, le nombre de lignes. Pour les autres requêtes, la valeur de la colonne est 0. +- `written_bytes` (UInt64) — For `INSERT` des requêtes, le nombre d’octets écrits. Pour les autres requêtes, la valeur de la colonne est 0. +- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. +- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. +- `thread_name` (String) — Name of the thread. +- `thread_number` (UInt32) — Internal thread ID. +- `os_thread_id` (Int32) — OS thread ID. +- `master_thread_id` (UInt64) — OS initial ID of initial thread. +- `query` (String) — Query string. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP est exécuté. +- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) ou un autre nom de client TCP. +- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. +- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. +- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. +- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) ou une autre version du client TCP. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` la méthode a été utilisée. + - 2 — `POST` la méthode a été utilisée. +- `http_user_agent` (String) — The `UserAgent` en-tête passé dans la requête HTTP. +- `quota_key` (String) — The “quota key” spécifié dans le [quota](quotas.md) (voir `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [système.événement](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` colonne. + +Par défaut, les journaux sont ajoutés à la table à des intervalles de 7,5 secondes. Vous pouvez définir cet intervalle dans la [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) configuration du serveur (voir `flush_interval_milliseconds` paramètre). Pour vider les journaux de force du tampon mémoire dans la table, utilisez le `SYSTEM FLUSH LOGS` requête. + +Lorsque la table est supprimée manuellement, il sera automatiquement créé à la volée. Notez que tous les précédents journaux seront supprimés. + +!!! note "Note" + La période de stockage des journaux est illimitée. Les journaux ne sont pas automatiquement supprimés de la table. Vous devez organiser vous-même la suppression des journaux obsolètes. + +Vous pouvez spécifier une clé de partitionnement arbitraire pour `system.query_thread_log` la table dans le [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) configuration du serveur (voir `partition_by` paramètre). + +## système.trace\_log {#system_tables-trace_log} + +Contient des traces de pile collectées par le profileur de requête d’échantillonnage. + +Clickhouse crée cette table lorsque le [trace\_log](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) la section de configuration du serveur est définie. Aussi l’ [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) et [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) paramètres doivent être définis. + +Pour analyser les journaux, utilisez `addressToLine`, `addressToSymbol` et `demangle` fonctions d’introspection. + +Colonne: + +- `event_date`([Date](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time`([DateTime](../sql-reference/data-types/datetime.md)) — Timestamp of sampling moment. + +- `revision`([UInt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + Lors de la connexion au serveur par `clickhouse-client`, vous voyez la chaîne similaire à `Connected to ClickHouse server version 19.18.1 revision 54429.`. Ce champ contient le `revision` mais pas le `version` d’un serveur. + +- `timer_type`([Enum8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` représente l’horloge murale. + - `CPU` représente le temps CPU. + +- `thread_number`([UInt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id`([Chaîne](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) système de table. + +- `trace`([Tableau (UInt64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**Exemple** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## système.réplique {#system_tables-replicas} + +Contient des informations et l’état des tables répliquées résidant sur le serveur local. +Ce tableau peut être utilisé pour la surveillance. La table contient une ligne pour chaque Répliqué\* table. + +Exemple: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +Colonne: + +- `database` (`String`) - Nom de base de données +- `table` (`String`)- Nom de la Table +- `engine` (`String`)- Nom du moteur de Table +- `is_leader` (`UInt8`) - Si la réplique est le chef de file. + Une seule réplique à la fois peut être le leader. Le leader est responsable de la sélection des fusions d’arrière-plan à effectuer. + Notez que les Écritures peuvent être effectuées sur n’importe quel réplica disponible et ayant une session dans ZK, qu’il s’agisse d’un leader. +- `can_become_leader` (`UInt8`)- Si la réplique peut être élue en tant que leader. +- `is_readonly` (`UInt8`) - Si la réplique est en mode lecture seule. + Ce mode est activé si la configuration n’a pas de sections avec ZooKeeper, si une erreur inconnue s’est produite lors de la réinitialisation des sessions dans ZooKeeper et lors de la réinitialisation des sessions dans ZooKeeper. +- `is_session_expired` (`UInt8`)- la session avec ZooKeeper a expiré. Fondamentalement le même que `is_readonly`. +- `future_parts` (`UInt32`)- Le nombre de parties de données qui apparaîtront à la suite D’insertions ou de fusions qui n’ont pas encore été effectuées. +- `parts_to_check` (`UInt32`) - Le nombre de parties des données dans la file d’attente pour la vérification. Une pièce est placée dans la file d’attente de vérification s’il y a un soupçon qu’elle pourrait être endommagée. +- `zookeeper_path` (`String`)- Chemin d’accès aux données de la table dans ZooKeeper. +- `replica_name` (`String`) - Réplique nom de la Gardienne. Différentes répliques d’une même table ont des noms différents. +- `replica_path` (`String`)- Chemin vers les données de réplique dans ZooKeeper. La même chose que la concaténation ‘zookeeper\_path/replicas/replica\_path’. +- `columns_version` (`Int32`)- Numéro de Version de la structure de la table. Indique combien de fois ALTER a été effectué. Si les répliques ont des versions différentes, cela signifie que certaines répliques n’ont pas encore Toutes les modifications. +- `queue_size` (`UInt32`),- La taille de la file d’attente pour les opérations en attente d’être exécuté. Les opérations comprennent l’insertion de blocs de données, les fusions et certaines autres actions. Il coïncide généralement avec `future_parts`. +- `inserts_in_queue` (`UInt32`) - Nombre d’insertions de blocs de données qui doivent être faits. Les Insertions sont généralement répliquées assez rapidement. Si ce nombre est grand, cela signifie que quelque chose est faux. +- `merges_in_queue` (`UInt32`) - Le nombre de fusions en attente d’être fait. Parfois, les fusions sont longues, donc cette valeur peut être supérieure à zéro pendant une longue période. +- `part_mutations_in_queue` (`UInt32`) - Le nombre de mutations en attente d’être fait. +- `queue_oldest_time` (`DateTime`) - Si `queue_size` supérieur à 0, indique quand l’opération la plus ancienne a été ajoutée à la file d’attente. +- `inserts_oldest_time` (`DateTime`) - Voir `queue_oldest_time` +- `merges_oldest_time` (`DateTime`) - Voir `queue_oldest_time` +- `part_mutations_oldest_time` (`DateTime`) - Voir `queue_oldest_time` + +Les 4 colonnes suivantes ont une valeur non nulle uniquement lorsqu’il y a une session active avec ZK. + +- `log_max_index` (`UInt64`) - Maximum nombre d’entrées dans le journal de l’activité générale. +- `log_pointer` (`UInt64`)- Numéro d’entrée Maximum dans le journal de l’activité générale que le réplica a copié dans sa file d’attente d’exécution, plus un. Si `log_pointer` est beaucoup plus petite que `log_max_index` quelque chose ne va pas. +- `last_queue_update` (`DateTime`) - Lorsque la file d’attente a été mise à jour la dernière fois. +- `absolute_delay` (`UInt64`)- Combien de décalage en secondes la réplique actuelle A. +- `total_replicas` (`UInt8`) - Le nombre total de répliques connues de ce tableau. +- `active_replicas` (`UInt8`) - Le nombre de répliques de cette table qui ont une session dans ZooKeeper (c’est-à-dire le nombre de répliques fonctionnelles). + +Si vous demandez toutes les colonnes, la table peut fonctionner un peu lentement, car plusieurs lectures de ZooKeeper sont faites pour chaque ligne. +Si vous ne demandez pas les 4 dernières colonnes (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), la table fonctionne rapidement. + +Par exemple, vous pouvez vérifier que tout fonctionne correctement comme ceci: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +Si cette requête ne retourne rien, cela signifie que tout va bien. + +## système.paramètre {#system-settings} + +Contient des informations sur les paramètres actuellement utilisés. +I. e. utilisé pour l’exécution de la requête que vous utilisez pour lire à partir du système.les paramètres de la table. + +Colonne: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. +- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [contraintes](settings/constraints-on-settings.md#constraints-on-settings)). +- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [contraintes](settings/constraints-on-settings.md#constraints-on-settings)). +- `readonly` (UInt8) — Can user change this setting (for more info, look into [contraintes](settings/constraints-on-settings.md#constraints-on-settings)). + +Exemple: + +``` sql +SELECT name, value +FROM system.settings +WHERE changed +``` + +``` text +┌─name───────────────────┬─value───────┐ +│ max_threads │ 8 │ +│ use_uncompressed_cache │ 0 │ +│ load_balancing │ random │ +│ max_memory_usage │ 10000000000 │ +└────────────────────────┴─────────────┘ +``` + +## système.merge\_tree\_settings {#system-merge_tree_settings} + +Contient des informations sur les paramètres pour `MergeTree` table. + +Colonne: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. + +## système.tableau\_moteurs {#system-table-engines} + +Contient une description des moteurs de table pris en charge par le serveur et leurs informations de support de fonctionnalité. + +Ce tableau contient les colonnes suivantes (le type de colonne est indiqué entre parenthèses): + +- `name` (String) — The name of table engine. +- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` clause. +- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [sauter les indices](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` et `SAMPLE_BY`. +- `supports_replication` (UInt8) — Flag that indicates if table engine supports [réplication des données](../engines/table-engines/mergetree-family/replication.md). +- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. + +Exemple: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**Voir aussi** + +- Famille MergeTree [les clauses de requête](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) +- Kafka [paramètre](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) +- Rejoindre [paramètre](../engines/table-engines/special/join.md#join-limitations-and-settings) + +## système.table {#system-tables} + +Contient les métadonnées de chaque table que le serveur connaît. Les tableaux détachés ne sont pas représentés dans `system.tables`. + +Ce tableau contient les colonnes suivantes (le type de colonne est indiqué entre parenthèses): + +- `database` (String) — The name of the database the table is in. + +- `name` (String) — Table name. + +- `engine` (String) — Table engine name (without parameters). + +- `is_temporary` (UInt8) - indicateur qui indique si la table est temporaire. + +- `data_path` (Chaîne) - chemin d’accès aux données de la table dans le système de fichiers. + +- `metadata_path` (Chaîne) - chemin d’accès aux métadonnées de la table dans le système de fichiers. + +- `metadata_modification_time` (DateTime) - Heure de la dernière modification des métadonnées de la table. + +- `dependencies_database` (Array (String)) - dépendances de base de données. + +- `dependencies_table` (Array (String)) - dépendances de Table ([MaterializedView](../engines/table-engines/special/materializedview.md) tables basées sur le tableau actuel). + +- `create_table_query` (Chaîne) - la requête qui a été utilisée pour créer la table. + +- `engine_full` (Chaîne) - paramètres du moteur de table. + +- `partition_key` (String) - l’expression de clé de partition spécifiée dans le tableau. + +- `sorting_key` (String) - l’expression de clé de tri spécifiée dans la table. + +- `primary_key` (String) - l’expression de clé primaire spécifiée dans la table. + +- `sampling_key` (String) - l’expression de clé d’échantillonnage spécifiée dans la table. + +- `storage_policy` (String) - La politique de stockage: + + - [MergeTree](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) + - [Distribué](../engines/table-engines/special/distributed.md#distributed) + +- `total_rows` (Nullable (UInt64)) - nombre Total de lignes, s’il est possible de déterminer rapidement le nombre exact de lignes dans la table, sinon `Null` (y compris underying `Buffer` table). + +- `total_bytes` (Nullable (UInt64)) - nombre Total d’octets, s’il est possible de déterminer rapidement le nombre exact d’octets pour la table sur le stockage, sinon `Null` (**ne pas** comprend tout de stockage sous-jacent). + + - If the table stores data on disk, returns used space on disk (i.e. compressed). + - Si la table stocke des données en mémoire, renvoie un nombre approximatif d’octets utilisés en mémoire. + +Le `system.tables` le tableau est utilisé dans `SHOW TABLES` implémentation de requête. + +## système.zookeeper {#system-zookeeper} + +La table n’existe pas si ZooKeeper n’est pas configuré. Permet de lire les données du cluster Zookeeper défini dans la configuration. +La requête doit avoir un ‘path’ condition d’égalité dans la clause WHERE. C’est le chemin dans ZooKeeper pour les enfants pour lesquels vous souhaitez obtenir des données. + +Requête `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` données de sortie pour tous les enfants `/clickhouse` nœud. +Pour générer des données pour tous les nœuds racine, écrivez path = ‘/’. +Si le chemin d’accès spécifié dans ‘path’ n’existe pas, une exception sera levée. + +Colonne: + +- `name` (String) — The name of the node. +- `path` (String) — The path to the node. +- `value` (String) — Node value. +- `dataLength` (Int32) — Size of the value. +- `numChildren` (Int32) — Number of descendants. +- `czxid` (Int64) — ID of the transaction that created the node. +- `mzxid` (Int64) — ID of the transaction that last changed the node. +- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. +- `ctime` (DateTime) — Time of node creation. +- `mtime` (DateTime) — Time of the last modification of the node. +- `version` (Int32) — Node version: the number of times the node was changed. +- `cversion` (Int32) — Number of added or removed descendants. +- `aversion` (Int32) — Number of changes to the ACL. +- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. + +Exemple: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## système.mutation {#system_tables-mutations} + +Le tableau contient des informations sur [mutation](../sql-reference/statements/alter.md#alter-mutations) des tables MergeTree et leur progression. Chaque commande de mutation est représentée par une seule ligne. Le tableau comporte les colonnes suivantes: + +**base de données**, **table** - Le nom de la base de données et de la table à laquelle la mutation a été appliquée. + +**mutation\_id** - Le numéro d’identification de la mutation. Pour les tables répliquées ces ID correspondent aux noms znode dans le `/mutations/` répertoire de la Gardienne. Pour les tables non compliquées, Les Id correspondent aux noms de fichiers dans le répertoire de données de la table. + +**commande** - La chaîne de commande mutation (la partie de la requête après `ALTER TABLE [db.]table`). + +**create\_time** - Quand cette commande de mutation a été soumise pour exécution. + +**block\_numbers.partition\_id**, **block\_numbers.nombre** - Une colonne imbriquée. Pour les mutations de tables répliquées, il contient un enregistrement pour chaque partition: l’ID de partition et le numéro de bloc acquis par la mutation (dans chaque partition, seules les parties contenant des blocs avec des nombres inférieurs au numéro de bloc acquis par la mutation dans cette partition seront mutées). Dans les tables non répliquées, les numéros de bloc de toutes les partitions forment une seule séquence. Cela signifie que pour les mutations de tables non répliquées, la colonne contiendra un enregistrement avec un seul numéro de bloc acquis par la mutation. + +**parts\_to\_do** - Le nombre de parties de données qui doivent être mutées pour que la mutation se termine. + +**\_done** - La mutation est faite? Notez que même si `parts_to_do = 0` il est possible qu’une mutation d’une table répliquée ne soit pas encore effectuée en raison d’un INSERT de longue durée qui créera une nouvelle partie de données qui devra être mutée. + +S’il y avait des problèmes avec la mutation de certaines parties, les colonnes suivantes contiennent des informations supplémentaires: + +**latest\_failed\_part** - Le nom de la partie la plus récente qui n’a pas pu être mutée. + +**latest\_fail\_time** - Le temps de la partie la plus récente mutation de l’échec. + +**latest\_fail\_reason** - Le message d’exception qui a provoqué l’échec de la mutation de pièce la plus récente. + +## système.disque {#system_tables-disks} + +Contient des informations sur les disques définis dans [configuration du serveur](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Colonne: + +- `name` ([Chaîne](../sql-reference/data-types/string.md)) — Name of a disk in the server configuration. +- `path` ([Chaîne](../sql-reference/data-types/string.md)) — Path to the mount point in the file system. +- `free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Free space on disk in bytes. +- `total_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Disk volume in bytes. +- `keep_free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` paramètre de configuration du disque. + +## système.storage\_policies {#system_tables-storage_policies} + +Contient des informations sur les stratégies de stockage et les volumes définis [configuration du serveur](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Colonne: + +- `policy_name` ([Chaîne](../sql-reference/data-types/string.md)) — Name of the storage policy. +- `volume_name` ([Chaîne](../sql-reference/data-types/string.md)) — Volume name defined in the storage policy. +- `volume_priority` ([UInt64](../sql-reference/data-types/int-uint.md)) — Volume order number in the configuration. +- `disks` ([Tableau(String)](../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. +- `max_data_part_size` ([UInt64](../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). +- `move_factor` ([Float64](../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. + +Si la stratégie de stockage contient plus d’un volume, les informations pour chaque volume sont stockées dans la ligne individuelle de la table. + +[Article Original](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/fr/operations/system_tables.md b/docs/fr/operations/system_tables.md deleted file mode 100644 index 99fe7e2a00e..00000000000 --- a/docs/fr/operations/system_tables.md +++ /dev/null @@ -1,1097 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 52 -toc_title: "Les Tables Syst\xE8me" ---- - -# Les Tables Système {#system-tables} - -Les tables système sont utilisées pour implémenter une partie des fonctionnalités du système et pour fournir un accès à des informations sur le fonctionnement du système. -Vous ne pouvez pas supprimer une table système (mais vous pouvez effectuer un détachement). -Les tables système n'ont pas de fichiers avec des données sur le disque ou de fichiers avec des métadonnées. Le serveur crée toutes les tables système au démarrage. -Les tables système sont en lecture seule. -Ils sont situés dans la ‘system’ la base de données. - -## système.asynchronous\_metrics {#system_tables-asynchronous_metrics} - -Contient des mesures qui sont calculées périodiquement en arrière-plan. Par exemple, la quantité de RAM utilisée. - -Colonne: - -- `metric` ([Chaîne](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Float64](../sql_reference/data_types/float.md)) — Metric value. - -**Exemple** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**Voir Aussi** - -- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. -- [système.métrique](#system_tables-metrics) — Contains instantly calculated metrics. -- [système.événement](#system_tables-events) — Contains a number of events that have occurred. -- [système.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. - -## système.cluster {#system-clusters} - -Contient des informations sur les clusters disponibles dans le fichier de configuration et les serveurs en eux. - -Colonne: - -- `cluster` (String) — The cluster name. -- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. -- `shard_weight` (UInt32) — The relative weight of the shard when writing data. -- `replica_num` (UInt32) — The replica number in the shard, starting from 1. -- `host_name` (String) — The host name, as specified in the config. -- `host_address` (String) — The host IP address obtained from DNS. -- `port` (UInt16) — The port to use for connecting to the server. -- `user` (String) — The name of the user for connecting to the server. -- `errors_count` (UInt32) - nombre de fois que cet hôte n'a pas atteint le réplica. -- `estimated_recovery_time` (UInt32) - secondes restantes jusqu'à ce que le nombre d'erreurs de réplique soit remis à zéro et qu'il soit considéré comme revenu à la normale. - -Veuillez noter que `errors_count` est mise à jour une fois par requête à la grappe, mais `estimated_recovery_time` est recalculé sur-demande. Il pourrait donc y avoir un cas de non-zéro `errors_count` et zéro `estimated_recovery_time`, cette requête suivante sera nulle `errors_count` et essayez d'utiliser des répliques comme si elle ne comporte pas d'erreurs. - -**Voir aussi** - -- [Tableau moteur Distribués](../engines/table_engines/special/distributed.md) -- [paramètre distributed\_replica\_error\_cap](settings/settings.md#settings-distributed_replica_error_cap) -- [paramètre distributed\_replica\_error\_half\_life](settings/settings.md#settings-distributed_replica_error_half_life) - -## système.colonne {#system-columns} - -Contient des informations sur les colonnes de toutes les tables. - -Vous pouvez utiliser ce tableau pour obtenir des informations similaires à l' [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table) requête, mais pour plusieurs tables à la fois. - -Le `system.columns` le tableau contient les colonnes suivantes (la colonne type est indiqué entre parenthèses): - -- `database` (String) — Database name. -- `table` (String) — Table name. -- `name` (String) — Column name. -- `type` (String) — Column type. -- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) pour la valeur par défaut, ou une chaîne vide si elle n'est pas définie. -- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. -- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. -- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. -- `marks_bytes` (UInt64) — The size of marks, in bytes. -- `comment` (String) — Comment on the column, or an empty string if it is not defined. -- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. -- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. -- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. -- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. - -## système.contributeur {#system-contributors} - -Contient des informations sur les donateurs. Tous les constributors dans un ordre aléatoire. L'ordre est aléatoire au moment de l'exécution de la requête. - -Colonne: - -- `name` (String) — Contributor (author) name from git log. - -**Exemple** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -Trouver vous-même dans le tableau, utilisez une requête: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## système.les bases de données {#system-databases} - -Cette table contient une seule colonne de chaîne appelée ‘name’ – the name of a database. -Chaque base de données que le serveur connaît a une entrée correspondante dans la table. -Cette table système est utilisée pour implémenter `SHOW DATABASES` requête. - -## système.detached\_parts {#system_tables-detached_parts} - -Contient des informations sur les pièces détachées de [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) table. Le `reason` colonne spécifie pourquoi la pièce a été détachée. Pour les pièces détachées par l'utilisateur, la raison est vide. De telles pièces peuvent être attachées avec [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) commande. Pour la description des autres colonnes, voir [système.partie](#system_tables-parts). Si le nom de pièce n'est pas valide, les valeurs de certaines colonnes peuvent être `NULL`. Ces pièces peuvent être supprimés avec [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). - -## système.dictionnaire {#system-dictionaries} - -Contient des informations sur les dictionnaires externes. - -Colonne: - -- `name` (String) — Dictionary name. -- `type` (String) — Dictionary type: Flat, Hashed, Cache. -- `origin` (String) — Path to the configuration file that describes the dictionary. -- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. -- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. -- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. -- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. -- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. -- `element_count` (UInt64) — The number of items stored in the dictionary. -- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). -- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. -- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn't be created. -- `source` (String) — Text describing the data source for the dictionary. - -Notez que la quantité de mémoire utilisée par le dictionnaire n'est pas proportionnel au nombre d'articles qui s'y trouvent. Ainsi, pour les dictionnaires plats et mis en cache, toutes les cellules de mémoire sont pré-assignées, quelle que soit la capacité du dictionnaire. - -## système.événement {#system_tables-events} - -Contient des informations sur le nombre d'événements survenus dans le système. Par exemple, dans le tableau, vous pouvez trouver combien `SELECT` les requêtes ont été traitées depuis le démarrage du serveur ClickHouse. - -Colonne: - -- `event` ([Chaîne](../sql_reference/data_types/string.md)) — Event name. -- `value` ([UInt64](../sql_reference/data_types/int_uint.md)) — Number of events occurred. -- `description` ([Chaîne](../sql_reference/data_types/string.md)) — Event description. - -**Exemple** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Voir Aussi** - -- [système.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [système.métrique](#system_tables-metrics) — Contains instantly calculated metrics. -- [système.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. - -## système.fonction {#system-functions} - -Contient des informations sur les fonctions normales et agrégées. - -Colonne: - -- `name`(`String`) – The name of the function. -- `is_aggregate`(`UInt8`) — Whether the function is aggregate. - -## système.graphite\_retentions {#system-graphite-retentions} - -Contient des informations sur les paramètres [graphite\_rollup](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) qui sont utilisés dans les tableaux avec [\* GraphiteMergeTree](../engines/table_engines/mergetree_family/graphitemergetree.md) moteur. - -Colonne: - -- `config_name` (Chaîne) - `graphite_rollup` nom du paramètre. -- `regexp` (Chaîne) - un modèle pour le nom de la métrique. -- `function` (Chaîne) - le nom de la fonction d'agrégation. -- `age` (UInt64) - l'âge minimum des données en secondes. -- `precision` (UInt64) - comment définir précisément l'âge des données en secondes. -- `priority` (UInt16) - priorité de motif. -- `is_default` (UInt8) - indique si le motif est la valeur par défaut. -- `Tables.database` (Array (String)) - tableau de noms de tables de base de données qui utilisent `config_name` paramètre. -- `Tables.table` (Array (String)) - tableau de noms de tables qui utilisent `config_name` paramètre. - -## système.fusionner {#system-merges} - -Contient des informations sur les fusions et les mutations de pièces actuellement en cours pour les tables de la famille MergeTree. - -Colonne: - -- `database` (String) — The name of the database the table is in. -- `table` (String) — Table name. -- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. -- `progress` (Float64) — The percentage of completed work from 0 to 1. -- `num_parts` (UInt64) — The number of pieces to be merged. -- `result_part_name` (String) — The name of the part that will be formed as the result of merging. -- `is_mutation` (UInt8) - 1 si ce processus est une mutation partielle. -- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. -- `total_size_marks` (UInt64) — The total number of marks in the merged parts. -- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. -- `rows_read` (UInt64) — Number of rows read. -- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. -- `rows_written` (UInt64) — Number of rows written. - -## système.métrique {#system_tables-metrics} - -Contient des mesures qui peuvent être calculées instantanément, ou ont une valeur actuelle. Par exemple, le nombre de requêtes traitées ou en cours réplique de retard. Ce tableau est toujours à jour. - -Colonne: - -- `metric` ([Chaîne](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — Metric value. -- `description` ([Chaîne](../sql_reference/data_types/string.md)) — Metric description. - -La liste des mesures que vous pouvez trouver dans le [SGBD / commun / CurrentMetrics.rpc](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Common/CurrentMetrics.cpp) fichier source de ClickHouse. - -**Exemple** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Voir Aussi** - -- [système.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [système.événement](#system_tables-events) — Contains a number of events that occurred. -- [système.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. - -## système.metric\_log {#system_tables-metric_log} - -Contient l'historique des valeurs de métriques des tables `system.metrics` et `system.events` périodiquement vidé sur le disque. -Pour activer la collection d'historique des métriques `system.metric_log`, créer `/etc/clickhouse-server/config.d/metric_log.xml` avec le contenu suivant: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**Exemple** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**Voir aussi** - -- [système.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [système.événement](#system_tables-events) — Contains a number of events that occurred. -- [système.métrique](#system_tables-metrics) — Contains instantly calculated metrics. -- [Surveiller](monitoring.md) — Base concepts of ClickHouse monitoring. - -## système.nombre {#system-numbers} - -Cette table contient une seule colonne UInt64 nommée ‘number’ qui contient presque tous les nombres naturels à partir de zéro. -Vous pouvez utiliser cette table pour les tests, ou si vous avez besoin de faire une recherche de force brute. -Les lectures de cette table ne sont pas parallélisées. - -## système.numbers\_mt {#system-numbers-mt} - -Le même que ‘system.numbers’ mais les lectures sont parallélisées. Les nombres peuvent être retournés dans n'importe quel ordre. -Utilisé pour les tests. - -## système.un {#system-one} - -Cette table contient une seule ligne avec un ‘dummy’ Colonne UInt8 contenant la valeur 0. -Cette table est utilisée si une requête SELECT ne spécifie pas la clause FROM. -Ceci est similaire à la table double trouvée dans d'autres SGBD. - -## système.partie {#system_tables-parts} - -Contient des informations sur les parties de [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) table. - -Chaque ligne décrit une partie des données. - -Colonne: - -- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql_reference/statements/alter.md#query_language_queries_alter) requête. - - Format: - - - `YYYYMM` pour le partitionnement automatique par mois. - - `any_string` lors du partitionnement manuel. - -- `name` (`String`) – Name of the data part. - -- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it's used in a table. Otherwise, it's deleted. Inactive data parts remain after merging. - -- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` par la granularité d'index (généralement 8192) (cet indice ne fonctionne pas pour la granularité adaptative). - -- `rows` (`UInt64`) – The number of rows. - -- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. - -- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `marks_bytes` (`UInt64`) – The size of the file with marks. - -- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| - -- `remove_time` (`DateTime`) – The time when the data part became inactive. - -- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. - -- `min_date` (`Date`) – The minimum value of the date key in the data part. - -- `max_date` (`Date`) – The maximum value of the date key in the data part. - -- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. - -- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. - -- `partition_id` (`String`) – ID of the partition. - -- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. - -- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. - -- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. - -- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. - -- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn't exist. For more details, see [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition) - -- `database` (`String`) – Name of the database. - -- `table` (`String`) – Name of the table. - -- `engine` (`String`) – Name of the table engine without parameters. - -- `path` (`String`) – Absolute path to the folder with data part files. - -- `disk` (`String`) – Name of a disk that stores the data part. - -- `hash_of_all_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) de fichiers compressés. - -- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) de fichiers non compressés (fichiers avec des marques, fichier d'index, etc.). - -- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) des données dans les fichiers compressés comme s'ils étaient non compressé. - -- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. - -- `marks_size` (`UInt64`) – Alias for `marks_bytes`. - -## système.part\_log {#system_tables-part-log} - -Le `system.part_log` la table est créée uniquement si [part\_log](server_configuration_parameters/settings.md#server_configuration_parameters-part-log) serveur paramètre est spécifié. - -Ce tableau contient des informations sur les événements survenus avec [les parties de données](../engines/table_engines/mergetree_family/custom_partitioning_key.md) dans le [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) table de famille, telles que l'ajout ou la fusion de données. - -Le `system.part_log` le tableau contient les colonnes suivantes: - -- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: - - `NEW_PART` — Inserting of a new data part. - - `MERGE_PARTS` — Merging of data parts. - - `DOWNLOAD_PART` — Downloading a data part. - - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — Mutating of a data part. - - `MOVE_PART` — Moving the data part from the one disk to another one. -- `event_date` (Date) — Event date. -- `event_time` (DateTime) — Event time. -- `duration_ms` (UInt64) — Duration. -- `database` (String) — Name of the database the data part is in. -- `table` (String) — Name of the table the data part is in. -- `part_name` (String) — Name of the data part. -- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ si le partitionnement est par `tuple()`. -- `rows` (UInt64) — The number of rows in the data part. -- `size_in_bytes` (UInt64) — Size of the data part in bytes. -- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). -- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. -- `read_rows` (UInt64) — The number of rows was read during the merge. -- `read_bytes` (UInt64) — The number of bytes was read during the merge. -- `error` (UInt16) — The code number of the occurred error. -- `exception` (String) — Text message of the occurred error. - -Le `system.part_log` la table est créée après la première insertion de données `MergeTree` table. - -## système.processus {#system_tables-processes} - -Cette table système est utilisée pour implémenter `SHOW PROCESSLIST` requête. - -Colonne: - -- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` utilisateur. Le champ contient le nom d'utilisateur pour une requête spécifique, pas pour une requête que cette requête lancée. -- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` sur le serveur du demandeur de requête. -- `elapsed` (Float64) – The time in seconds since request execution started. -- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. -- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query_complexity.md#settings_max_memory_usage) paramètre. -- `query` (String) – The query text. For `INSERT` il n'inclut pas les données à insérer. -- `query_id` (String) – Query ID, if defined. - -## système.text\_log {#system-tables-text-log} - -Contient des entrées de journalisation. Niveau de journalisation qui va à cette table peut être limité `text_log.level` paramètre de serveur. - -Colonne: - -- `event_date` (`Date`) - Date de l'entrée. -- `event_time` (`DateTime`) - Temps de l'entrée. -- `microseconds` (`UInt32`) - Microsecondes de l'entrée. -- `thread_name` (String) — Name of the thread from which the logging was done. -- `thread_id` (UInt64) — OS thread ID. -- `level` (`Enum8`) - Niveau d'entrée. - - `'Fatal' = 1` - - `'Critical' = 2` - - `'Error' = 3` - - `'Warning' = 4` - - `'Notice' = 5` - - `'Information' = 6` - - `'Debug' = 7` - - `'Trace' = 8` -- `query_id` (`String`)- ID de la requête. -- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) -- `message` (`String`) - Le message lui-même. -- `revision` (`UInt32`)- Révision ClickHouse. -- `source_file` (`LowCardinality(String)`)- Fichier Source à partir duquel la journalisation a été effectuée. -- `source_line` (`UInt64`)- Ligne Source à partir de laquelle la journalisation a été effectuée. - -## système.query\_log {#system_tables-query_log} - -Contient des informations sur l'exécution de requêtes. Pour chaque requête, vous pouvez voir l'Heure de début du traitement, la durée du traitement, les messages d'erreur et d'autres informations. - -!!! note "Note" - Le tableau ne contient pas les données d'entrée pour `INSERT` requête. - -Clickhouse crée cette table uniquement si [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) serveur paramètre est spécifié. Ce paramètre définit les règles de journalisation, tels que l'intervalle d'enregistrement ou le nom de la table, la requête sera connecté. - -Pour activer la journalisation des requêtes, définissez [log\_queries](settings/settings.md#settings-log-queries) paramètre 1. Pour plus de détails, voir le [Paramètre](settings/settings.md) section. - -Le `system.query_log` table enregistre deux types de requêtes: - -1. Requêtes initiales qui ont été exécutées directement par le client. -2. Requêtes enfants initiées par d'autres requêtes (pour l'exécution de requêtes distribuées). Pour ces types de requêtes, des informations sur les requêtes parentes sont affichées dans `initial_*` colonne. - -Colonne: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` des requêtes, le nombre de lignes. Pour les autres requêtes, la valeur de la colonne est 0. -- `written_bytes` (UInt64) — For `INSERT` des requêtes, le nombre d'octets écrits. Pour les autres requêtes, la valeur de la colonne est 0. -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [clickhouse-client](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP est exécuté. -- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) ou un autre nom de client TCP. -- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. -- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. -- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. -- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) ou une autre version du client TCP. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` la méthode a été utilisée. - - 2 — `POST` la méthode a été utilisée. -- `http_user_agent` (String) — The `UserAgent` en-tête passé dans la requête HTTP. -- `quota_key` (String) — The “quota key” spécifié dans le [quota](quotas.md) (voir `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [système.événement](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` colonne. -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` paramètre 1. -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` colonne. - -Chaque requête crée une ou deux lignes dans le `query_log` le tableau, en fonction de l'état de la requête: - -1. Si l'exécution de la requête est réussie, deux événements de type 1 et 2 sont créés (voir `type` colonne). -2. Si une erreur s'est produite pendant le traitement de la requête, deux événements avec les types 1 et 4 sont créés. -3. Si une erreur s'est produite avant le lancement de la requête, un seul événement de type 3 est créé. - -Par défaut, les journaux sont ajoutés à la table à des intervalles de 7,5 secondes. Vous pouvez définir cet intervalle dans la [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) configuration du serveur (voir `flush_interval_milliseconds` paramètre). Pour vider les journaux de force du tampon mémoire dans la table, utilisez le `SYSTEM FLUSH LOGS` requête. - -Lorsque la table est supprimée manuellement, il sera automatiquement créé à la volée. Notez que tous les précédents journaux seront supprimés. - -!!! note "Note" - La période de stockage des journaux est illimitée. Les journaux ne sont pas automatiquement supprimés de la table. Vous devez organiser vous-même la suppression des journaux obsolètes. - -Vous pouvez spécifier une clé de partitionnement arbitraire pour `system.query_log` la table dans le [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) configuration du serveur (voir `partition_by` paramètre). - -## système.query\_thread\_log {#system_tables-query-thread-log} - -La table contient des informations sur chaque thread d'exécution de requête. - -Clickhouse crée cette table uniquement si [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) serveur paramètre est spécifié. Ce paramètre définit les règles de journalisation, tels que l'intervalle d'enregistrement ou le nom de la table, la requête sera connecté. - -Pour activer la journalisation des requêtes, définissez [log\_query\_threads](settings/settings.md#settings-log-query-threads) paramètre 1. Pour plus de détails, voir le [Paramètre](settings/settings.md) section. - -Colonne: - -- `event_date` (Date) — the date when the thread has finished execution of the query. -- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` des requêtes, le nombre de lignes. Pour les autres requêtes, la valeur de la colonne est 0. -- `written_bytes` (UInt64) — For `INSERT` des requêtes, le nombre d'octets écrits. Pour les autres requêtes, la valeur de la colonne est 0. -- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. -- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. -- `thread_name` (String) — Name of the thread. -- `thread_number` (UInt32) — Internal thread ID. -- `os_thread_id` (Int32) — OS thread ID. -- `master_thread_id` (UInt64) — OS initial ID of initial thread. -- `query` (String) — Query string. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [clickhouse-client](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP est exécuté. -- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) ou un autre nom de client TCP. -- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. -- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. -- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) ou un autre client TCP. -- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) ou une autre version du client TCP. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` la méthode a été utilisée. - - 2 — `POST` la méthode a été utilisée. -- `http_user_agent` (String) — The `UserAgent` en-tête passé dans la requête HTTP. -- `quota_key` (String) — The “quota key” spécifié dans le [quota](quotas.md) (voir `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [système.événement](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` colonne. - -Par défaut, les journaux sont ajoutés à la table à des intervalles de 7,5 secondes. Vous pouvez définir cet intervalle dans la [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) configuration du serveur (voir `flush_interval_milliseconds` paramètre). Pour vider les journaux de force du tampon mémoire dans la table, utilisez le `SYSTEM FLUSH LOGS` requête. - -Lorsque la table est supprimée manuellement, il sera automatiquement créé à la volée. Notez que tous les précédents journaux seront supprimés. - -!!! note "Note" - La période de stockage des journaux est illimitée. Les journaux ne sont pas automatiquement supprimés de la table. Vous devez organiser vous-même la suppression des journaux obsolètes. - -Vous pouvez spécifier une clé de partitionnement arbitraire pour `system.query_thread_log` la table dans le [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) configuration du serveur (voir `partition_by` paramètre). - -## système.trace\_log {#system_tables-trace_log} - -Contient des traces de pile collectées par le profileur de requête d'échantillonnage. - -Clickhouse crée cette table lorsque le [trace\_log](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) la section de configuration du serveur est définie. Aussi l' [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) et [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) paramètres doivent être définis. - -Pour analyser les journaux, utilisez `addressToLine`, `addressToSymbol` et `demangle` fonctions d'introspection. - -Colonne: - -- `event_date`([Date](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time`([DateTime](../sql_reference/data_types/datetime.md)) — Timestamp of sampling moment. - -- `revision`([UInt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - Lors de la connexion au serveur par `clickhouse-client`, vous voyez la chaîne similaire à `Connected to ClickHouse server version 19.18.1 revision 54429.`. Ce champ contient le `revision` mais pas le `version` d'un serveur. - -- `timer_type`([Enum8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` représente l'horloge murale. - - `CPU` représente le temps CPU. - -- `thread_number`([UInt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id`([Chaîne](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) système de table. - -- `trace`([Tableau (UInt64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**Exemple** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## système.réplique {#system_tables-replicas} - -Contient des informations et l'état des tables répliquées résidant sur le serveur local. -Ce tableau peut être utilisé pour la surveillance. La table contient une ligne pour chaque Répliqué\* table. - -Exemple: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -Colonne: - -- `database` (`String`) - Nom de base de données -- `table` (`String`)- Nom de la Table -- `engine` (`String`)- Nom du moteur de Table -- `is_leader` (`UInt8`) - Si la réplique est le chef de file. - Une seule réplique à la fois peut être le leader. Le leader est responsable de la sélection des fusions d'arrière-plan à effectuer. - Notez que les Écritures peuvent être effectuées sur n'importe quel réplica disponible et ayant une session dans ZK, qu'il s'agisse d'un leader. -- `can_become_leader` (`UInt8`)- Si la réplique peut être élue en tant que leader. -- `is_readonly` (`UInt8`) - Si la réplique est en mode lecture seule. - Ce mode est activé si la configuration n'a pas de sections avec ZooKeeper, si une erreur inconnue s'est produite lors de la réinitialisation des sessions dans ZooKeeper et lors de la réinitialisation des sessions dans ZooKeeper. -- `is_session_expired` (`UInt8`)- la session avec ZooKeeper a expiré. Fondamentalement le même que `is_readonly`. -- `future_parts` (`UInt32`)- Le nombre de parties de données qui apparaîtront à la suite D'insertions ou de fusions qui n'ont pas encore été effectuées. -- `parts_to_check` (`UInt32`) - Le nombre de parties des données dans la file d'attente pour la vérification. Une pièce est placée dans la file d'attente de vérification s'il y a un soupçon qu'elle pourrait être endommagée. -- `zookeeper_path` (`String`)- Chemin d'accès aux données de la table dans ZooKeeper. -- `replica_name` (`String`) - Réplique nom de la Gardienne. Différentes répliques d'une même table ont des noms différents. -- `replica_path` (`String`)- Chemin vers les données de réplique dans ZooKeeper. La même chose que la concaténation ‘zookeeper\_path/replicas/replica\_path’. -- `columns_version` (`Int32`)- Numéro de Version de la structure de la table. Indique combien de fois ALTER a été effectué. Si les répliques ont des versions différentes, cela signifie que certaines répliques n'ont pas encore Toutes les modifications. -- `queue_size` (`UInt32`),- La taille de la file d'attente pour les opérations en attente d'être exécuté. Les opérations comprennent l'insertion de blocs de données, les fusions et certaines autres actions. Il coïncide généralement avec `future_parts`. -- `inserts_in_queue` (`UInt32`) - Nombre d'insertions de blocs de données qui doivent être faits. Les Insertions sont généralement répliquées assez rapidement. Si ce nombre est grand, cela signifie que quelque chose est faux. -- `merges_in_queue` (`UInt32`) - Le nombre de fusions en attente d'être fait. Parfois, les fusions sont longues, donc cette valeur peut être supérieure à zéro pendant une longue période. -- `part_mutations_in_queue` (`UInt32`) - Le nombre de mutations en attente d'être fait. -- `queue_oldest_time` (`DateTime`) - Si `queue_size` supérieur à 0, indique quand l'opération la plus ancienne a été ajoutée à la file d'attente. -- `inserts_oldest_time` (`DateTime`) - Voir `queue_oldest_time` -- `merges_oldest_time` (`DateTime`) - Voir `queue_oldest_time` -- `part_mutations_oldest_time` (`DateTime`) - Voir `queue_oldest_time` - -Les 4 colonnes suivantes ont une valeur non nulle uniquement lorsqu'il y a une session active avec ZK. - -- `log_max_index` (`UInt64`) - Maximum nombre d'entrées dans le journal de l'activité générale. -- `log_pointer` (`UInt64`)- Numéro d'entrée Maximum dans le journal de l'activité générale que le réplica a copié dans sa file d'attente d'exécution, plus un. Si `log_pointer` est beaucoup plus petite que `log_max_index` quelque chose ne va pas. -- `last_queue_update` (`DateTime`) - Lorsque la file d'attente a été mise à jour la dernière fois. -- `absolute_delay` (`UInt64`)- Combien de décalage en secondes la réplique actuelle A. -- `total_replicas` (`UInt8`) - Le nombre total de répliques connues de ce tableau. -- `active_replicas` (`UInt8`) - Le nombre de répliques de cette table qui ont une session dans ZooKeeper (c'est-à-dire le nombre de répliques fonctionnelles). - -Si vous demandez toutes les colonnes, la table peut fonctionner un peu lentement, car plusieurs lectures de ZooKeeper sont faites pour chaque ligne. -Si vous ne demandez pas les 4 dernières colonnes (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), la table fonctionne rapidement. - -Par exemple, vous pouvez vérifier que tout fonctionne correctement comme ceci: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -Si cette requête ne retourne rien, cela signifie que tout va bien. - -## système.paramètre {#system-settings} - -Contient des informations sur les paramètres actuellement utilisés. -I. e. utilisé pour l'exécution de la requête que vous utilisez pour lire à partir du système.les paramètres de la table. - -Colonne: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. -- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [contraintes](settings/constraints_on_settings.md#constraints-on-settings)). -- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [contraintes](settings/constraints_on_settings.md#constraints-on-settings)). -- `readonly` (UInt8) — Can user change this setting (for more info, look into [contraintes](settings/constraints_on_settings.md#constraints-on-settings)). - -Exemple: - -``` sql -SELECT name, value -FROM system.settings -WHERE changed -``` - -``` text -┌─name───────────────────┬─value───────┐ -│ max_threads │ 8 │ -│ use_uncompressed_cache │ 0 │ -│ load_balancing │ random │ -│ max_memory_usage │ 10000000000 │ -└────────────────────────┴─────────────┘ -``` - -## système.merge\_tree\_settings {#system-merge_tree_settings} - -Contient des informations sur les paramètres pour `MergeTree` table. - -Colonne: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. - -## système.tableau\_moteurs {#system-table-engines} - -Contient une description des moteurs de table pris en charge par le serveur et leurs informations de support de fonctionnalité. - -Ce tableau contient les colonnes suivantes (le type de colonne est indiqué entre parenthèses): - -- `name` (String) — The name of table engine. -- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` clause. -- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [sauter les indices](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` et `SAMPLE_BY`. -- `supports_replication` (UInt8) — Flag that indicates if table engine supports [réplication des données](../engines/table_engines/mergetree_family/replication.md). -- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. - -Exemple: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**Voir aussi** - -- Famille MergeTree [les clauses de requête](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) -- Kafka [paramètre](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) -- Rejoindre [paramètre](../engines/table_engines/special/join.md#join-limitations-and-settings) - -## système.table {#system-tables} - -Contient les métadonnées de chaque table que le serveur connaît. Les tableaux détachés ne sont pas représentés dans `system.tables`. - -Ce tableau contient les colonnes suivantes (le type de colonne est indiqué entre parenthèses): - -- `database` (String) — The name of the database the table is in. - -- `name` (String) — Table name. - -- `engine` (String) — Table engine name (without parameters). - -- `is_temporary` (UInt8) - indicateur qui indique si la table est temporaire. - -- `data_path` (Chaîne) - chemin d'accès aux données de la table dans le système de fichiers. - -- `metadata_path` (Chaîne) - chemin d'accès aux métadonnées de la table dans le système de fichiers. - -- `metadata_modification_time` (DateTime) - Heure de la dernière modification des métadonnées de la table. - -- `dependencies_database` (Array (String)) - dépendances de base de données. - -- `dependencies_table` (Array (String)) - dépendances de Table ([MaterializedView](../engines/table_engines/special/materializedview.md) tables basées sur le tableau actuel). - -- `create_table_query` (Chaîne) - la requête qui a été utilisée pour créer la table. - -- `engine_full` (Chaîne) - paramètres du moteur de table. - -- `partition_key` (String) - l'expression de clé de partition spécifiée dans le tableau. - -- `sorting_key` (String) - l'expression de clé de tri spécifiée dans la table. - -- `primary_key` (String) - l'expression de clé primaire spécifiée dans la table. - -- `sampling_key` (String) - l'expression de clé d'échantillonnage spécifiée dans la table. - -- `storage_policy` (String) - La politique de stockage: - - - [MergeTree](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) - - [Distribué](../engines/table_engines/special/distributed.md#distributed) - -- `total_rows` (Nullable (UInt64)) - nombre Total de lignes, s'il est possible de déterminer rapidement le nombre exact de lignes dans la table, sinon `Null` (y compris underying `Buffer` table). - -- `total_bytes` (Nullable (UInt64)) - nombre Total d'octets, s'il est possible de déterminer rapidement le nombre exact d'octets pour la table sur le stockage, sinon `Null` (**ne pas** comprend tout de stockage sous-jacent). - - - If the table stores data on disk, returns used space on disk (i.e. compressed). - - Si la table stocke des données en mémoire, renvoie un nombre approximatif d'octets utilisés en mémoire. - -Le `system.tables` le tableau est utilisé dans `SHOW TABLES` implémentation de requête. - -## système.zookeeper {#system-zookeeper} - -La table n'existe pas si ZooKeeper n'est pas configuré. Permet de lire les données du cluster Zookeeper défini dans la configuration. -La requête doit avoir un ‘path’ condition d'égalité dans la clause WHERE. C'est le chemin dans ZooKeeper pour les enfants pour lesquels vous souhaitez obtenir des données. - -Requête `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` données de sortie pour tous les enfants `/clickhouse` nœud. -Pour générer des données pour tous les nœuds racine, écrivez path = ‘/’. -Si le chemin d'accès spécifié dans ‘path’ n'existe pas, une exception sera levée. - -Colonne: - -- `name` (String) — The name of the node. -- `path` (String) — The path to the node. -- `value` (String) — Node value. -- `dataLength` (Int32) — Size of the value. -- `numChildren` (Int32) — Number of descendants. -- `czxid` (Int64) — ID of the transaction that created the node. -- `mzxid` (Int64) — ID of the transaction that last changed the node. -- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. -- `ctime` (DateTime) — Time of node creation. -- `mtime` (DateTime) — Time of the last modification of the node. -- `version` (Int32) — Node version: the number of times the node was changed. -- `cversion` (Int32) — Number of added or removed descendants. -- `aversion` (Int32) — Number of changes to the ACL. -- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. - -Exemple: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## système.mutation {#system_tables-mutations} - -Le tableau contient des informations sur [mutation](../sql_reference/statements/alter.md#alter-mutations) des tables MergeTree et leur progression. Chaque commande de mutation est représentée par une seule ligne. Le tableau comporte les colonnes suivantes: - -**base de données**, **table** - Le nom de la base de données et de la table à laquelle la mutation a été appliquée. - -**mutation\_id** - Le numéro d'identification de la mutation. Pour les tables répliquées ces ID correspondent aux noms znode dans le `/mutations/` répertoire de la Gardienne. Pour les tables non compliquées, Les Id correspondent aux noms de fichiers dans le répertoire de données de la table. - -**commande** - La chaîne de commande mutation (la partie de la requête après `ALTER TABLE [db.]table`). - -**create\_time** - Quand cette commande de mutation a été soumise pour exécution. - -**block\_numbers.partition\_id**, **block\_numbers.nombre** - Une colonne imbriquée. Pour les mutations de tables répliquées, il contient un enregistrement pour chaque partition: l'ID de partition et le numéro de bloc acquis par la mutation (dans chaque partition, seules les parties contenant des blocs avec des nombres inférieurs au numéro de bloc acquis par la mutation dans cette partition seront mutées). Dans les tables non répliquées, les numéros de bloc de toutes les partitions forment une seule séquence. Cela signifie que pour les mutations de tables non répliquées, la colonne contiendra un enregistrement avec un seul numéro de bloc acquis par la mutation. - -**parts\_to\_do** - Le nombre de parties de données qui doivent être mutées pour que la mutation se termine. - -**\_done** - La mutation est faite? Notez que même si `parts_to_do = 0` il est possible qu'une mutation d'une table répliquée ne soit pas encore effectuée en raison d'un INSERT de longue durée qui créera une nouvelle partie de données qui devra être mutée. - -S'il y avait des problèmes avec la mutation de certaines parties, les colonnes suivantes contiennent des informations supplémentaires: - -**latest\_failed\_part** - Le nom de la partie la plus récente qui n'a pas pu être mutée. - -**latest\_fail\_time** - Le temps de la partie la plus récente mutation de l'échec. - -**latest\_fail\_reason** - Le message d'exception qui a provoqué l'échec de la mutation de pièce la plus récente. - -## système.disque {#system_tables-disks} - -Contient des informations sur les disques définis dans [configuration du serveur](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Colonne: - -- `name` ([Chaîne](../sql_reference/data_types/string.md)) — Name of a disk in the server configuration. -- `path` ([Chaîne](../sql_reference/data_types/string.md)) — Path to the mount point in the file system. -- `free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Free space on disk in bytes. -- `total_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Disk volume in bytes. -- `keep_free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` paramètre de configuration du disque. - -## système.storage\_policies {#system_tables-storage_policies} - -Contient des informations sur les stratégies de stockage et les volumes définis [configuration du serveur](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Colonne: - -- `policy_name` ([Chaîne](../sql_reference/data_types/string.md)) — Name of the storage policy. -- `volume_name` ([Chaîne](../sql_reference/data_types/string.md)) — Volume name defined in the storage policy. -- `volume_priority` ([UInt64](../sql_reference/data_types/int_uint.md)) — Volume order number in the configuration. -- `disks` ([Tableau(String)](../sql_reference/data_types/array.md)) — Disk names, defined in the storage policy. -- `max_data_part_size` ([UInt64](../sql_reference/data_types/int_uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). -- `move_factor` ([Float64](../sql_reference/data_types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. - -Si la stratégie de stockage contient plus d'un volume, les informations pour chaque volume sont stockées dans la ligne individuelle de la table. - -[Article Original](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/fr/operations/tips.md b/docs/fr/operations/tips.md index 5122f21c0c1..7cc94af0a10 100644 --- a/docs/fr/operations/tips.md +++ b/docs/fr/operations/tips.md @@ -5,11 +5,11 @@ toc_priority: 58 toc_title: Recommandations D'Utilisation --- -# Recommandations D'Utilisation {#usage-recommendations} +# Recommandations D’Utilisation {#usage-recommendations} -## Gouverneur de mise à L'échelle du processeur {#cpu-scaling-governor} +## Gouverneur De Mise à L’échelle Du Processeur {#cpu-scaling-governor} -Utilisez toujours la `performance` mise à l'échelle gouverneur. Le `on-demand` gouverneur de mise à l'échelle fonctionne bien pire avec une demande constamment élevée. +Utilisez toujours la `performance` mise à l’échelle gouverneur. Le `on-demand` gouverneur de mise à l’échelle fonctionne bien pire avec une demande constamment élevée. ``` bash $ echo 'performance' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor @@ -17,14 +17,14 @@ $ echo 'performance' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_gov ## CPU Limitations {#cpu-limitations} -Les processeurs peuvent surchauffer. Utiliser `dmesg` pour voir si la fréquence D'horloge du processeur était limitée en raison de la surchauffe. +Les processeurs peuvent surchauffer. Utiliser `dmesg` pour voir si la fréquence D’horloge du processeur était limitée en raison de la surchauffe. La restriction peut également être définie en externe au niveau du centre de données. Vous pouvez utiliser `turbostat` à surveiller sous une charge. ## RAM {#ram} -Pour de petites quantités de données (jusqu'à ~200 GO en mode compressé), il est préférable d'utiliser autant de mémoire que le volume de données. -Pour de grandes quantités de données et lors du traitement de requêtes interactives (en ligne), vous devez utiliser une quantité raisonnable de RAM (128 Go ou plus) afin que le sous-ensemble de données chaudes s'intègre dans le cache des pages. -Même pour des volumes de données d'environ 50 To par serveur, l'utilisation de 128 Go de RAM améliore considérablement les performances des requêtes par rapport à 64 Go. +Pour de petites quantités de données (jusqu’à ~200 GO en mode compressé), il est préférable d’utiliser autant de mémoire que le volume de données. +Pour de grandes quantités de données et lors du traitement de requêtes interactives (en ligne), vous devez utiliser une quantité raisonnable de RAM (128 Go ou plus) afin que le sous-ensemble de données chaudes s’intègre dans le cache des pages. +Même pour des volumes de données d’environ 50 To par serveur, l’utilisation de 128 Go de RAM améliore considérablement les performances des requêtes par rapport à 64 Go. Ne désactivez pas de surcharge. Valeur `cat /proc/sys/vm/overcommit_memory` devrait être 0 ou 1. Exécuter @@ -41,12 +41,12 @@ $ echo 'never' | sudo tee /sys/kernel/mm/transparent_hugepage/enabled ``` Utiliser `perf top` pour regarder le temps passé dans le noyau pour la gestion de la mémoire. -Les pages énormes permanentes n'ont pas non plus besoin d'être allouées. +Les pages énormes permanentes n’ont pas non plus besoin d’être allouées. ## Sous-Système De Stockage {#storage-subsystem} -Si votre budget vous permet D'utiliser SSD, utilisez SSD. -Sinon, utilisez un disque dur. Disques durs SATA 7200 RPM fera l'affaire. +Si votre budget vous permet D’utiliser SSD, utilisez SSD. +Sinon, utilisez un disque dur. Disques durs SATA 7200 RPM fera l’affaire. Donner la préférence à un grand nombre de serveurs avec des disques durs locaux sur un plus petit nombre de serveurs avec un disque attaché étagères. Mais pour stocker des archives avec des requêtes rares, les étagères fonctionneront. @@ -54,12 +54,12 @@ Mais pour stocker des archives avec des requêtes rares, les étagères fonction ## RAID {#raid} Lorsque vous utilisez le disque dur, vous pouvez combiner leur RAID-10, RAID-5, RAID-6 ou RAID-50. -Pour Linux, le RAID logiciel est meilleur (avec `mdadm`). Nous ne recommandons pas d'utiliser LVM. +Pour Linux, le RAID logiciel est meilleur (avec `mdadm`). Nous ne recommandons pas d’utiliser LVM. Lors de la création de RAID-10, sélectionnez `far` disposition. Si votre budget le permet, choisissez RAID-10. Si vous avez plus de 4 disques, Utilisez RAID-6 (préféré) ou RAID-50, au lieu de RAID-5. -Lorsque vous utilisez RAID-5, RAID-6 ou RAID-50, augmentez toujours stripe\_cache\_size, car la valeur par défaut n'est généralement pas le meilleur choix. +Lorsque vous utilisez RAID-5, RAID-6 ou RAID-50, augmentez toujours stripe\_cache\_size, car la valeur par défaut n’est généralement pas le meilleur choix. ``` bash $ echo 4096 | sudo tee /sys/block/md2/md/stripe_cache_size @@ -71,43 +71,43 @@ Une taille de bloc de 1024 KO est suffisante pour toutes les configurations RAID Ne définissez jamais la taille du bloc trop petite ou trop grande. Vous pouvez utiliser RAID-0 sur SSD. -Quelle que soit L'utilisation du RAID, utilisez toujours la réplication pour la sécurité des données. +Quelle que soit L’utilisation du RAID, utilisez toujours la réplication pour la sécurité des données. -Activer NCQ avec une longue file d'attente. Pour HDD, choisissez le planificateur CFQ, et pour SSD, choisissez noop. Ne pas réduire le ‘readahead’ paramètre. -Pour le disque dur, activez le cache d'écriture. +Activer NCQ avec une longue file d’attente. Pour HDD, choisissez le planificateur CFQ, et pour SSD, choisissez noop. Ne pas réduire le ‘readahead’ paramètre. +Pour le disque dur, activez le cache d’écriture. ## Système De Fichiers {#file-system} -Ext4 est l'option la plus fiable. Définir les options de montage `noatime, nobarrier`. -XFS est également adapté, mais il n'a pas été aussi soigneusement testé avec ClickHouse. +Ext4 est l’option la plus fiable. Définir les options de montage `noatime, nobarrier`. +XFS est également adapté, mais il n’a pas été aussi soigneusement testé avec ClickHouse. La plupart des autres systèmes de fichiers devraient également fonctionner correctement. Les systèmes de fichiers avec allocation retardée fonctionnent mieux. ## Le Noyau Linux {#linux-kernel} -N'utilisez pas un noyau Linux obsolète. +N’utilisez pas un noyau Linux obsolète. ## Réseau {#network} Si vous utilisez IPv6, augmenter la taille du cache. -Le noyau Linux avant 3.2 avait une multitude de problèmes avec l'implémentation D'IPv6. +Le noyau Linux avant 3.2 avait une multitude de problèmes avec l’implémentation D’IPv6. Utilisez au moins un réseau de 10 Go, si possible. 1 Go fonctionnera également, mais ce sera bien pire pour patcher des répliques avec des dizaines de téraoctets de données, ou pour traiter des requêtes distribuées avec une grande quantité de données intermédiaires. ## ZooKeeper {#zookeeper} -Vous utilisez probablement déjà ZooKeeper à d'autres fins. Vous pouvez utiliser la même installation de ZooKeeper, si elle n'est pas déjà surchargée. +Vous utilisez probablement déjà ZooKeeper à d’autres fins. Vous pouvez utiliser la même installation de ZooKeeper, si elle n’est pas déjà surchargée. -It's best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. +It’s best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. -Vous ne devez jamais utiliser de scripts écrits manuellement pour transférer des données entre différents clusters ZooKeeper, car le résultat sera incorrect pour les nœuds séquentiels. Ne jamais utiliser de l' “zkcopy” utilitaire pour la même raison: https://github.com/ksprojects/zkcopy/issues/15 +Vous ne devez jamais utiliser de scripts écrits manuellement pour transférer des données entre différents clusters ZooKeeper, car le résultat sera incorrect pour les nœuds séquentiels. Ne jamais utiliser de l’ “zkcopy” utilitaire pour la même raison: https://github.com/ksprojects/zkcopy/issues/15 -Si vous souhaitez diviser un cluster Zookeeper existant en deux, le bon moyen est d'augmenter le nombre de ses répliques, puis de le reconfigurer en deux clusters indépendants. +Si vous souhaitez diviser un cluster Zookeeper existant en deux, le bon moyen est d’augmenter le nombre de ses répliques, puis de le reconfigurer en deux clusters indépendants. -N'exécutez pas ZooKeeper sur les mêmes serveurs que ClickHouse. Parce que ZooKeeper est très sensible à la latence et ClickHouse peut utiliser toutes les ressources système disponibles. +N’exécutez pas ZooKeeper sur les mêmes serveurs que ClickHouse. Parce que ZooKeeper est très sensible à la latence et ClickHouse peut utiliser toutes les ressources système disponibles. Avec les paramètres par défaut, ZooKeeper est une bombe à retardement: -> Le serveur ZooKeeper ne supprime pas les fichiers des anciens snapshots et journaux lors de l'utilisation de la configuration par défaut (voir autopurge), et c'est la responsabilité de l'opérateur. +> Le serveur ZooKeeper ne supprime pas les fichiers des anciens snapshots et journaux lors de l’utilisation de la configuration par défaut (voir autopurge), et c’est la responsabilité de l’opérateur. Cette bombe doit être désamorcée. diff --git a/docs/fr/operations/troubleshooting.md b/docs/fr/operations/troubleshooting.md index e334786194f..206f383ffe9 100644 --- a/docs/fr/operations/troubleshooting.md +++ b/docs/fr/operations/troubleshooting.md @@ -14,19 +14,19 @@ toc_title: "D\xE9pannage" ## Installation {#troubleshooting-installation-errors} -### Vous ne pouvez pas obtenir de paquets deb à partir du référentiel Clickhouse avec Apt-get {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} +### Vous Ne Pouvez Pas Obtenir De Paquets Deb à Partir Du référentiel Clickhouse Avec Apt-get {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} - Vérifiez les paramètres du pare-feu. -- Si vous ne pouvez pas accéder au référentiel pour quelque raison que ce soit, téléchargez les packages comme décrit dans [Prise en main](../getting_started/index.md) article et les installer manuellement en utilisant le `sudo dpkg -i ` commande. Vous aurez aussi besoin d' `tzdata` paquet. +- Si vous ne pouvez pas accéder au référentiel pour quelque raison que ce soit, téléchargez les packages comme décrit dans [Prise en main](../getting-started/index.md) article et les installer manuellement en utilisant le `sudo dpkg -i ` commande. Vous aurez aussi besoin d’ `tzdata` paquet. -## Connexion au serveur {#troubleshooting-accepts-no-connections} +## Connexion Au Serveur {#troubleshooting-accepts-no-connections} Problèmes possibles: -- Le serveur n'est pas en cours d'exécution. +- Le serveur n’est pas en cours d’exécution. - Paramètres de configuration inattendus ou incorrects. -### Le Serveur N'Est Pas En Cours D'Exécution {#server-is-not-running} +### Le Serveur N’Est Pas En Cours D’Exécution {#server-is-not-running} **Vérifiez si le serveur est runnnig** @@ -36,7 +36,7 @@ Commande: $ sudo service clickhouse-server status ``` -Si le serveur n'est pas en cours d'exécution, démarrez-le avec la commande: +Si le serveur n’est pas en cours d’exécution, démarrez-le avec la commande: ``` bash $ sudo service clickhouse-server start @@ -51,13 +51,13 @@ Si le serveur a démarré avec succès, vous devriez voir les chaînes: - ` Application: starting up.` — Server started. - ` Application: Ready for connections.` — Server is running and ready for connections. -Si `clickhouse-server` démarrage a échoué avec une erreur de configuration, vous devriez voir la `` chaîne avec une description de l'erreur. Exemple: +Si `clickhouse-server` démarrage a échoué avec une erreur de configuration, vous devriez voir la `` chaîne avec une description de l’erreur. Exemple: ``` text 2019.01.11 15:23:25.549505 [ 45 ] {} ExternalDictionaries: Failed reloading 'event2id' external dictionary: Poco::Exception. Code: 1000, e.code() = 111, e.displayText() = Connection refused, e.what() = Connection refused ``` -Si vous ne voyez pas d'erreur à la fin du fichier, parcourez le fichier entier à partir de la chaîne: +Si vous ne voyez pas d’erreur à la fin du fichier, parcourez le fichier entier à partir de la chaîne: ``` text Application: starting up. @@ -81,7 +81,7 @@ Revision: 54413 **Voir système.d les journaux** -Si vous ne trouvez aucune information utile dans `clickhouse-server` journaux ou il n'y a pas de journaux, vous pouvez afficher `system.d` journaux à l'aide de la commande: +Si vous ne trouvez aucune information utile dans `clickhouse-server` journaux ou il n’y a pas de journaux, vous pouvez afficher `system.d` journaux à l’aide de la commande: ``` bash $ sudo journalctl -u clickhouse-server @@ -93,7 +93,7 @@ $ sudo journalctl -u clickhouse-server $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml ``` -Cette commande démarre le serveur en tant qu'application interactive avec les paramètres standard du script de démarrage automatique. Dans ce mode `clickhouse-server` imprime tous les messages d'événement dans la console. +Cette commande démarre le serveur en tant qu’application interactive avec les paramètres standard du script de démarrage automatique. Dans ce mode `clickhouse-server` imprime tous les messages d’événement dans la console. ### Paramètres De Configuration {#configuration-parameters} @@ -105,37 +105,37 @@ Vérifier: - Paramètres du point de terminaison. - Vérifier [listen\_host](server_configuration_parameters/settings.md#server_configuration_parameters-listen_host) et [tcp\_port](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port) paramètre. + Vérifier [listen\_host](server-configuration-parameters/settings.md#server_configuration_parameters-listen_host) et [tcp\_port](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port) paramètre. Clickhouse server accepte les connexions localhost uniquement par défaut. - Paramètres du protocole HTTP. - Vérifiez les paramètres de protocole pour L'API HTTP. + Vérifiez les paramètres de protocole pour L’API HTTP. - Paramètres de connexion sécurisés. Vérifier: - - Le [tcp\_port\_secure](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) paramètre. - - Paramètres pour [SSL sertificates](server_configuration_parameters/settings.md#server_configuration_parameters-openssl). + - Le [tcp\_port\_secure](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) paramètre. + - Paramètres pour [SSL sertificates](server-configuration-parameters/settings.md#server_configuration_parameters-openssl). - Utilisez les paramètres appropriés lors de la connexion. Par exemple, l'utilisation de la `port_secure` paramètre avec `clickhouse_client`. + Utilisez les paramètres appropriés lors de la connexion. Par exemple, l’utilisation de la `port_secure` paramètre avec `clickhouse_client`. -- Les paramètres de l'utilisateur. +- Les paramètres de l’utilisateur. - Vous utilisez peut-être un mauvais nom d'utilisateur ou mot de passe. + Vous utilisez peut-être un mauvais nom d’utilisateur ou mot de passe. ## Traitement Des Requêtes {#troubleshooting-does-not-process-queries} -Si ClickHouse ne peut pas traiter la requête, il envoie une description d'erreur au client. Dans le `clickhouse-client` vous obtenez une description de l'erreur dans la console. Si vous utilisez L'interface HTTP, ClickHouse envoie la description de l'erreur dans le corps de la réponse. Exemple: +Si ClickHouse ne peut pas traiter la requête, il envoie une description d’erreur au client. Dans le `clickhouse-client` vous obtenez une description de l’erreur dans la console. Si vous utilisez L’interface HTTP, ClickHouse envoie la description de l’erreur dans le corps de la réponse. Exemple: ``` bash $ curl 'http://localhost:8123/' --data-binary "SELECT a" Code: 47, e.displayText() = DB::Exception: Unknown identifier: a. Note that there are no tables (FROM clause) in your query, context: required_names: 'a' source_tables: table_aliases: private_aliases: column_aliases: public_columns: 'a' masked_columns: array_join_columns: source_columns: , e.what() = DB::Exception ``` -Si vous commencez à `clickhouse-client` avec l' `stack-trace` paramètre, ClickHouse renvoie la trace de la pile du serveur avec la description d'une erreur. +Si vous commencez à `clickhouse-client` avec l’ `stack-trace` paramètre, ClickHouse renvoie la trace de la pile du serveur avec la description d’une erreur. Vous pouvez voir un message sur une connexion rompue. Dans ce cas, vous pouvez répéter la requête. Si la connexion se rompt chaque fois que vous effectuez la requête, vérifiez les journaux du serveur pour détecter les erreurs. @@ -143,4 +143,4 @@ Vous pouvez voir un message sur une connexion rompue. Dans ce cas, vous pouvez r Si vous voyez que ClickHouse fonctionne trop lentement, vous devez profiler la charge sur les ressources du serveur et le réseau pour vos requêtes. -Vous pouvez utiliser l'utilitaire clickhouse-benchmark pour profiler les requêtes. Il indique le nombre de requêtes traitées par seconde, le nombre de lignes traitées par seconde, et les percentiles de temps de traitement des requêtes. +Vous pouvez utiliser l’utilitaire clickhouse-benchmark pour profiler les requêtes. Il indique le nombre de requêtes traitées par seconde, le nombre de lignes traitées par seconde, et les percentiles de temps de traitement des requêtes. diff --git a/docs/fr/operations/update.md b/docs/fr/operations/update.md index 67aecbc9c1a..f8df4ff478f 100644 --- a/docs/fr/operations/update.md +++ b/docs/fr/operations/update.md @@ -17,4 +17,4 @@ $ sudo service clickhouse-server restart Si vous avez installé ClickHouse en utilisant autre chose que les paquets deb recommandés, utilisez la méthode de mise à jour appropriée. -ClickHouse ne prend pas en charge une mise à jour distribuée. L'opération doit être effectuée consécutivement sur chaque serveur séparé. Ne pas mettre à jour tous les serveurs d'un cluster simultanément, ou le cluster sera indisponible pendant un certain temps. +ClickHouse ne prend pas en charge une mise à jour distribuée. L’opération doit être effectuée consécutivement sur chaque serveur séparé. Ne pas mettre à jour tous les serveurs d’un cluster simultanément, ou le cluster sera indisponible pendant un certain temps. diff --git a/docs/fr/operations/utilities/clickhouse-benchmark.md b/docs/fr/operations/utilities/clickhouse-benchmark.md index ebf31a962e1..670aee97394 100644 --- a/docs/fr/operations/utilities/clickhouse-benchmark.md +++ b/docs/fr/operations/utilities/clickhouse-benchmark.md @@ -38,20 +38,20 @@ clickhouse-benchmark [keys] < queries_file - `-c N`, `--concurrency=N` — Number of queries that `clickhouse-benchmark` envoie simultanément. Valeur par défaut: 1. - `-d N`, `--delay=N` — Interval in seconds between intermediate reports (set 0 to disable reports). Default value: 1. -- `-h WORD`, `--host=WORD` — Server host. Default value: `localhost`. Pour l' [mode de comparaison](#clickhouse-benchmark-comparison-mode) vous pouvez utiliser plusieurs `-h` touches. +- `-h WORD`, `--host=WORD` — Server host. Default value: `localhost`. Pour l’ [mode de comparaison](#clickhouse-benchmark-comparison-mode) vous pouvez utiliser plusieurs `-h` touches. - `-p N`, `--port=N` — Server port. Default value: 9000. For the [mode de comparaison](#clickhouse-benchmark-comparison-mode) vous pouvez utiliser plusieurs `-p` touches. - `-i N`, `--iterations=N` — Total number of queries. Default value: 0. - `-r`, `--randomize` — Random order of queries execution if there is more then one input query. - `-s`, `--secure` — Using TLS connection. -- `-t N`, `--timelimit=N` — Time limit in seconds. `clickhouse-benchmark` arrête d'envoyer des requêtes lorsque le délai spécifié est atteint. Valeur par défaut: 0 (limite de temps désactivée). -- `--confidence=N` — Level of confidence for T-test. Possible values: 0 (80%), 1 (90%), 2 (95%), 3 (98%), 4 (99%), 5 (99.5%). Default value: 5. In the [mode de comparaison](#clickhouse-benchmark-comparison-mode) `clickhouse-benchmark` effectue les [Test T de L'étudiant indépendant à deux échantillons](https://en.wikipedia.org/wiki/Student%27s_t-test#Independent_two-sample_t-test) tester pour déterminer si les deux distributions ne sont pas différentes avec le niveau de confiance sélectionné. +- `-t N`, `--timelimit=N` — Time limit in seconds. `clickhouse-benchmark` arrête d’envoyer des requêtes lorsque le délai spécifié est atteint. Valeur par défaut: 0 (limite de temps désactivée). +- `--confidence=N` — Level of confidence for T-test. Possible values: 0 (80%), 1 (90%), 2 (95%), 3 (98%), 4 (99%), 5 (99.5%). Default value: 5. In the [mode de comparaison](#clickhouse-benchmark-comparison-mode) `clickhouse-benchmark` effectue les [Test T de L’étudiant indépendant à deux échantillons](https://en.wikipedia.org/wiki/Student%27s_t-test#Independent_two-sample_t-test) tester pour déterminer si les deux distributions ne sont pas différentes avec le niveau de confiance sélectionné. - `--cumulative` — Printing cumulative data instead of data per interval. - `--database=DATABASE_NAME` — ClickHouse database name. Default value: `default`. - `--json=FILEPATH` — JSON output. When the key is set, `clickhouse-benchmark` génère un rapport dans le fichier JSON spécifié. - `--user=USERNAME` — ClickHouse user name. Default value: `default`. - `--password=PSWD` — ClickHouse user password. Default value: empty string. -- `--stacktrace` — Stack traces output. When the key is set, `clickhouse-bencmark` affiche les traces d'exceptions de la pile. -- `--stage=WORD` — Query processing stage at server. ClickHouse stops query processing and returns answer to `clickhouse-benchmark` à l'étape spécifiée. Valeurs possibles: `complete`, `fetch_columns`, `with_mergeable_state`. Valeur par défaut: `complete`. +- `--stacktrace` — Stack traces output. When the key is set, `clickhouse-bencmark` affiche les traces d’exceptions de la pile. +- `--stage=WORD` — Query processing stage at server. ClickHouse stops query processing and returns answer to `clickhouse-benchmark` à l’étape spécifiée. Valeurs possibles: `complete`, `fetch_columns`, `with_mergeable_state`. Valeur par défaut: `complete`. - `--help` — Shows the help message. Si vous voulez appliquer des [paramètre](../../operations/settings/index.md) pour les requêtes, les passer comme une clé `--= SETTING_VALUE`. Exemple, `--max_memory_usage=1048576`. @@ -87,21 +87,21 @@ Dans le rapport, vous pouvez trouver: - Nombre de requêtes dans le `Queries executed:` champ. -- Le statut de chaîne de caractères contenant (dans l'ordre): +- Le statut de chaîne de caractères contenant (dans l’ordre): - Point de terminaison du serveur ClickHouse. - Nombre de requêtes traitées. - QPS: QPS: combien de requêtes serveur effectuées par seconde pendant une période spécifiée dans le `--delay` argument. - RPS: combien de lignes le serveur a lues par seconde pendant une période spécifiée dans `--delay` argument. - MiB/ s: combien de mebibytes serveur lus par seconde pendant une période spécifiée dans le `--delay` argument. - - résultat RPS: combien de lignes placées par le serveur au résultat d'une requête par seconde pendant une période spécifiée dans le `--delay` argument. - - MiB / s de résultat. combien de mibibytes placés par le serveur au résultat d'une requête par seconde pendant une période spécifiée dans `--delay` argument. + - résultat RPS: combien de lignes placées par le serveur au résultat d’une requête par seconde pendant une période spécifiée dans le `--delay` argument. + - MiB / s de résultat. combien de mibibytes placés par le serveur au résultat d’une requête par seconde pendant une période spécifiée dans `--delay` argument. -- Percentiles du temps d'exécution des requêtes. +- Percentiles du temps d’exécution des requêtes. -## Mode de comparaison {#clickhouse-benchmark-comparison-mode} +## Mode De Comparaison {#clickhouse-benchmark-comparison-mode} -`clickhouse-benchmark` peut comparer les performances pour deux serveurs clickhouse en cours d'exécution. +`clickhouse-benchmark` peut comparer les performances pour deux serveurs clickhouse en cours d’exécution. Pour utiliser le mode de comparaison, spécifiez les points de terminaison des deux serveurs par deux paires de `--host`, `--port` touches. Clés appariées ensemble par position dans la liste des arguments, la première `--host` est assorti avec le premier `--port` et ainsi de suite. `clickhouse-benchmark` établit les connexions aux serveurs, puis envoie des requêtes. Chaque requête adressée à un serveur sélectionné au hasard. Les résultats sont présentés pour chaque serveur séparément. diff --git a/docs/fr/operations/utilities/clickhouse-copier.md b/docs/fr/operations/utilities/clickhouse-copier.md index 31901b29baf..8e90aac104b 100644 --- a/docs/fr/operations/utilities/clickhouse-copier.md +++ b/docs/fr/operations/utilities/clickhouse-copier.md @@ -7,7 +7,7 @@ toc_title: clickhouse-copieur # clickhouse-copieur {#clickhouse-copier} -Copie les données des tables d'un cluster vers des tables d'un autre cluster (ou du même cluster). +Copie les données des tables d’un cluster vers des tables d’un autre cluster (ou du même cluster). Vous pouvez exécuter plusieurs `clickhouse-copier` instances sur différents serveurs pour effectuer le même travail. ZooKeeper est utilisé pour synchroniser les processus. @@ -16,7 +16,7 @@ Après le démarrage de, `clickhouse-copier`: - Se connecte à ZooKeeper et reçoit: - La copie de tâches. - - L'état de la copie d'emplois. + - L’état de la copie d’emplois. - Il effectue les travaux. @@ -26,9 +26,9 @@ Après le démarrage de, `clickhouse-copier`: Pour réduire le trafic réseau, nous vous recommandons de `clickhouse-copier` sur le même serveur où se trouvent les données source. -## Course clickhouse-copieur {#running-clickhouse-copier} +## Course Clickhouse-copieur {#running-clickhouse-copier} -L'utilitaire doit être exécuté manuellement: +L’utilitaire doit être exécuté manuellement: ``` bash $ clickhouse-copier copier --daemon --config zookeeper.xml --task-path /task/path --base-dir /path/to/dir @@ -43,7 +43,7 @@ Paramètre: - `task-upload-force` — Force upload `task-file` même si le nœud existe déjà. - `base-dir` — The path to logs and auxiliary files. When it starts, `clickhouse-copier` crée `clickhouse-copier_YYYYMMHHSS_` les sous-répertoires `$base-dir`. Si ce paramètre est omis, les répertoires sont créés dans le répertoire où `clickhouse-copier` a été lancé. -## Format de zookeeper.XML {#format-of-zookeeper-xml} +## Format De Zookeeper.XML {#format-of-zookeeper-xml} ``` xml @@ -62,7 +62,7 @@ Paramètre: ``` -## Configuration des tâches de copie {#configuration-of-copying-tasks} +## Configuration Des tâches De Copie {#configuration-of-copying-tasks} ``` xml diff --git a/docs/fr/operations/utilities/clickhouse-local.md b/docs/fr/operations/utilities/clickhouse-local.md index 6051825dda0..495f87eee57 100644 --- a/docs/fr/operations/utilities/clickhouse-local.md +++ b/docs/fr/operations/utilities/clickhouse-local.md @@ -7,16 +7,16 @@ toc_title: clickhouse-local # clickhouse-local {#clickhouse-local} -Le `clickhouse-local` programme vous permet d'effectuer un traitement rapide sur les fichiers locaux, sans avoir à déployer et configurer le serveur ClickHouse. +Le `clickhouse-local` programme vous permet d’effectuer un traitement rapide sur les fichiers locaux, sans avoir à déployer et configurer le serveur ClickHouse. -Accepte les données qui représentent des tables et les interroge en utilisant [Clickhouse dialecte SQL](../../sql_reference/index.md). +Accepte les données qui représentent des tables et les interroge en utilisant [Clickhouse dialecte SQL](../../sql-reference/index.md). -`clickhouse-local` utilise le même noyau que clickhouse server, de sorte qu'il prend en charge la plupart des fonctionnalités et le même ensemble de formats et de moteurs de table. +`clickhouse-local` utilise le même noyau que clickhouse server, de sorte qu’il prend en charge la plupart des fonctionnalités et le même ensemble de formats et de moteurs de table. -Par défaut `clickhouse-local` n'a pas accès aux données sur le même hôte, mais il prend en charge le chargement de la configuration du serveur à l'aide `--config-file` argument. +Par défaut `clickhouse-local` n’a pas accès aux données sur le même hôte, mais il prend en charge le chargement de la configuration du serveur à l’aide `--config-file` argument. !!! warning "Avertissement" - Il n'est pas recommandé de charger la configuration du serveur de production dans `clickhouse-local` parce que les données peuvent être endommagées en cas d'erreur humaine. + Il n’est pas recommandé de charger la configuration du serveur de production dans `clickhouse-local` parce que les données peuvent être endommagées en cas d’erreur humaine. ## Utilisation {#usage} diff --git a/docs/fr/sql-reference/aggregate-functions/combinators.md b/docs/fr/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..c7789d8b317 --- /dev/null +++ b/docs/fr/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,166 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 37 +toc_title: "Combinateurs de fonction d'agr\xE9gat" +--- + +# Combinateurs De Fonction D’Agrégat {#aggregate_functions_combinators} + +Le nom d’une fonction d’agrégat peut avoir un suffixe ajouté. Cela change la façon dont la fonction d’agrégation fonctionne. + +## -Si {#agg-functions-combinator-if} + +The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). + +Exemple: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` et ainsi de suite. + +Avec les fonctions d’agrégat conditionnel, vous pouvez calculer des agrégats pour plusieurs conditions à la fois, sans utiliser de sous-requêtes et `JOIN`s. Par exemple, dans Yandex.Metrica, les fonctions d’agrégat conditionnel sont utilisées pour implémenter la fonctionnalité de comparaison de segment. + +## -Tableau {#agg-functions-combinator-array} + +Le Tableau suffixe peut être ajouté à toute fonction d’agrégation. Dans ce cas, la fonction d’agrégation des arguments de la ‘Array(T)’ type (tableaux) au lieu de ‘T’ tapez les arguments. Si la fonction aggregate accepte plusieurs arguments, il doit s’agir de tableaux de longueurs égales. Lors du traitement des tableaux, la fonction d’agrégation fonctionne comme la fonction d’agrégation d’origine sur tous les éléments du tableau. + +Exemple 1: `sumArray(arr)` - Totalise tous les éléments de tous ‘arr’ tableau. Dans cet exemple, il aurait pu être écrit plus simplement: `sum(arraySum(arr))`. + +Exemple 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ tableau. Cela pourrait être fait d’une manière plus facile: `uniq(arrayJoin(arr))` mais ce n’est pas toujours possible d’ajouter des ‘arrayJoin’ pour une requête. + +\- Si et-tableau peut être combiné. Cependant, ‘Array’ doit venir en premier, puis ‘If’. Exemple: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. En raison de cet ordre, le ‘cond’ argument ne sera pas un tableau. + +## -État {#agg-functions-combinator-state} + +Si vous appliquez ce combinateur, la fonction d’agrégation ne renvoie pas la valeur résultante (par exemple le nombre de valeurs uniques pour [uniq](reference.md#agg_function-uniq) la fonction), mais un état intermédiaire de l’agrégation (pour `uniq`, c’est la table de hachage pour calculer le nombre de valeurs uniques). C’est un `AggregateFunction(...)` qui peuvent être utilisés pour un traitement ultérieur ou stockés dans un tableau pour terminer l’agrégation plus tard. + +Pour travailler avec ces états, utilisez: + +- [AggregatingMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) tableau moteur. +- [finalizeAggregation](../../sql-reference/functions/other-functions.md#function-finalizeaggregation) fonction. +- [runningAccumulate](../../sql-reference/functions/other-functions.md#function-runningaccumulate) fonction. +- [-Fusionner](#aggregate_functions_combinators_merge) combinator. +- [-MergeState](#aggregate_functions_combinators_mergestate) combinator. + +## -Fusionner {#aggregate_functions_combinators-merge} + +Si vous appliquez ce combinateur, la fonction d’agrégation prend l’état d’agrégation intermédiaire comme argument, combine les États pour terminer l’agrégation et renvoie la valeur résultante. + +## -MergeState {#aggregate_functions_combinators-mergestate} + +Fusionne les États d’agrégation intermédiaires de la même manière que le combinateur-Merge. Cependant, il ne renvoie pas la valeur résultante, mais un État d’agrégation intermédiaire, similaire au combinateur-State. + +## - ForEach {#agg-functions-combinator-foreach} + +Convertit une fonction d’agrégation pour les tables en une fonction d’agrégation pour les tableaux qui agrège les éléments de tableau correspondants et renvoie un tableau de résultats. Exemple, `sumForEach` pour les tableaux `[1, 2]`, `[3, 4, 5]`et`[6, 7]`renvoie le résultat `[10, 13, 5]` après avoir additionné les éléments de tableau correspondants. + +## - OrDefault {#agg-functions-combinator-ordefault} + +Remplit la valeur par défaut du type de retour de la fonction d’agrégation s’il n’y a rien à agréger. + +``` sql +SELECT avg(number), avgOrDefault(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrDefault(number)─┐ +│ nan │ 0 │ +└─────────────┴──────────────────────┘ +``` + +## - OrNull {#agg-functions-combinator-ornull} + +Remplir `null` si il n’y a rien à s’agréger. La colonne de retour sera nullable. + +``` sql +SELECT avg(number), avgOrNull(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrNull(number)─┐ +│ nan │ ᴺᵁᴸᴸ │ +└─────────────┴───────────────────┘ +``` + +\- OrDefault et-OrNull peuvent être combinés avec d’autres combinateurs. Il est utile lorsque la fonction d’agrégation n’accepte pas l’entrée vide. + +``` sql +SELECT avgOrNullIf(x, x > 10) +FROM +( + SELECT toDecimal32(1.23, 2) AS x +) +``` + +``` text +┌─avgOrNullIf(x, greater(x, 10))─┐ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────┘ +``` + +## -Resample {#agg-functions-combinator-resample} + +Permet de diviser les données en groupes, puis séparément agrège les données de ces groupes. Les groupes sont créés en divisant les valeurs d’une colonne en intervalles. + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**Paramètre** + +- `start` — Starting value of the whole required interval for `resampling_key` valeur. +- `stop` — Ending value of the whole required interval for `resampling_key` valeur. L’ensemble de l’intervalle ne comprend pas les `stop` valeur `[start, stop)`. +- `step` — Step for separating the whole interval into subintervals. The `aggFunction` est exécuté sur chacun de ces sous-intervalles indépendamment. +- `resampling_key` — Column whose values are used for separating data into intervals. +- `aggFunction_params` — `aggFunction` paramètre. + +**Valeurs renvoyées** + +- Tableau de `aggFunction` les résultats pour chaque subinterval. + +**Exemple** + +Envisager l’ `people` le tableau avec les données suivantes: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +Obtenons les noms des personnes dont l’âge se trouve dans les intervalles de `[30,60)` et `[60,75)`. Puisque nous utilisons la représentation entière pour l’âge, nous obtenons des âges dans le `[30, 59]` et `[60,74]` intervalle. + +Pour agréger des noms dans un tableau, nous utilisons [grouperay](reference.md#agg_function-grouparray) fonction d’agrégation. Il faut un argument. Dans notre cas, c’est l’ `name` colonne. Le `groupArrayResample` fonction devrait utiliser le `age` colonne pour agréger les noms par âge. Pour définir les intervalles requis, nous passons le `30, 75, 30` des arguments dans la `groupArrayResample` fonction. + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) FROM people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +Considérez les résultats. + +`Jonh` est hors de l’échantillon parce qu’il est trop jeune. D’autres personnes sont distribués selon les intervalles d’âge. + +Maintenant, nous allons compter le nombre total de personnes et leur salaire moyen dans les intervalles d’âge. + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/fr/sql-reference/aggregate-functions/index.md b/docs/fr/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..d279d4fe214 --- /dev/null +++ b/docs/fr/sql-reference/aggregate-functions/index.md @@ -0,0 +1,62 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Aggregate Functions +toc_priority: 33 +toc_title: Introduction +--- + +# Les Fonctions d’agrégation {#aggregate-functions} + +Les fonctions d’agrégation fonctionnent dans le [normal](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) comme prévu par les experts de la base de données. + +Clickhouse prend également en charge: + +- [Fonctions d’agrégat paramétriques](parametric-functions.md#aggregate_functions_parametric) qui acceptent d’autres paramètres en plus des colonnes. +- [Combinators](combinators.md#aggregate_functions_combinators), qui modifient le comportement des fonctions d’agrégation. + +## Le Traitement NULL {#null-processing} + +Au cours de l’agrégation, tous les `NULL`s sont ignorés. + +**Exemple:** + +Considérez ce tableau: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +Disons que vous devez totaliser les valeurs dans le `y` colonne: + +``` sql +SELECT sum(y) FROM t_null_big +``` + + ┌─sum(y)─┐ + │ 7 │ + └────────┘ + +Le `sum` la fonction d’interprète `NULL` comme `0`. En particulier, cela signifie que si la fonction reçoit en entrée d’une sélection où toutes les valeurs sont `NULL`, alors le résultat sera `0`, pas `NULL`. + +Maintenant, vous pouvez utiliser le `groupArray` fonction pour créer un tableau à partir `y` colonne: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` ne comprend pas `NULL` dans le tableau résultant. + +[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/fr/sql-reference/aggregate-functions/parametric-functions.md b/docs/fr/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..e16b38771de --- /dev/null +++ b/docs/fr/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,499 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 38 +toc_title: "Fonctions d'agr\xE9gat param\xE9triques" +--- + +# Fonctions D’Agrégat Paramétriques {#aggregate_functions_parametric} + +Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. + +## histogramme {#histogram} + +Calcule un histogramme adaptatif. Cela ne garantit pas des résultats précis. + +``` sql +histogram(number_of_bins)(values) +``` + +Les fonctions utilise [Un Algorithme D’Arbre De Décision Parallèle En Continu](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Les bordures des bacs d’histogramme sont ajustées au fur et à mesure que de nouvelles données entrent dans une fonction. Dans le cas courant, les largeurs des bacs ne sont pas égales. + +**Paramètre** + +`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. +`values` — [Expression](../syntax.md#syntax-expressions) résultant en valeurs d’entrée. + +**Valeurs renvoyées** + +- [Tableau](../../sql-reference/data-types/array.md) de [Tuple](../../sql-reference/data-types/tuple.md) de le format suivant: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — Lower bound of the bin. + - `upper` — Upper bound of the bin. + - `height` — Calculated height of the bin. + +**Exemple** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +Vous pouvez visualiser un histogramme avec la [bar](../../sql-reference/functions/other-functions.md#function-bar) fonction, par exemple: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +Dans ce cas, vous devez vous rappeler que vous ne connaissez pas les frontières de la corbeille d’histogramme. + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +Vérifie si la séquence contient une chaîne d’événements qui correspond au modèle. + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "Avertissement" + Les événements qui se produisent à la même seconde peuvent se situer dans la séquence dans un ordre indéfini affectant le résultat. + +**Paramètre** + +- `pattern` — Pattern string. See [Syntaxe du motif](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` et `DateTime`. Vous pouvez également utiliser les prises en charge [UInt](../../sql-reference/data-types/int-uint.md) types de données. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Vous pouvez passer jusqu’à 32 arguments de condition. La fonction ne prend en compte que les événements décrits dans ces conditions. Si la séquence contient des données qui ne sont pas décrites dans une condition, la fonction les ignore. + +**Valeurs renvoyées** + +- 1, si le profil correspond. +- 0, si le motif ne correspond pas. + +Type: `UInt8`. + + +**Syntaxe du motif** + +- `(?N)` — Matches the condition argument at position `N`. Les Conditions sont numérotées dans le `[1, 32]` gamme. Exemple, `(?1)` correspond à l’argument passé au `cond1` paramètre. + +- `.*` — Matches any number of events. You don’t need conditional arguments to match this element of the pattern. + +- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` correspond à des événements qui se produisent plus de 1800 secondes les uns des autres. Un nombre arbitraire d’événements peut se trouver entre ces événements. Vous pouvez utiliser l’ `>=`, `>`, `<`, `<=` opérateur. + +**Exemple** + +Considérer les données dans le `t` table: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +Effectuer la requête: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +La fonction a trouvé la chaîne d’événements où le numéro 2 suit le numéro 1. Il a sauté le numéro 3 entre eux, car le nombre n’est pas décrit comme un événement. Si nous voulons prendre ce nombre en compte lors de la recherche de l’événement de la chaîne donnée dans l’exemple, nous devrions en faire une condition. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +Dans ce cas, la fonction n’a pas pu trouver la chaîne d’événements correspondant au modèle, car l’événement pour le numéro 3 s’est produit entre 1 et 2. Si dans le même cas nous vérifions la condition pour le numéro 4, la séquence correspondrait au motif. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Voir Aussi** + +- [sequenceCount](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +Compte le nombre de chaînes d’événements correspondant au motif. La fonction recherche les chaînes d’événements qui ne se chevauchent pas. Il commence à rechercher la chaîne suivante après que la chaîne actuelle est appariée. + +!!! warning "Avertissement" + Les événements qui se produisent à la même seconde peuvent se situer dans la séquence dans un ordre indéfini affectant le résultat. + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**Paramètre** + +- `pattern` — Pattern string. See [Syntaxe du motif](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` et `DateTime`. Vous pouvez également utiliser les prises en charge [UInt](../../sql-reference/data-types/int-uint.md) types de données. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Vous pouvez passer jusqu’à 32 arguments de condition. La fonction ne prend en compte que les événements décrits dans ces conditions. Si la séquence contient des données qui ne sont pas décrites dans une condition, la fonction les ignore. + +**Valeurs renvoyées** + +- Nombre de chaînes d’événements qui ne se chevauchent pas et qui sont mises en correspondance. + +Type: `UInt64`. + +**Exemple** + +Considérer les données dans le `t` table: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +Comptez combien de fois le nombre 2 se produit après le nombre 1 avec n’importe quelle quantité d’autres nombres entre eux: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**Voir Aussi** + +- [sequenceMatch](#function-sequencematch) + +## fenêtrefunnel {#windowfunnel} + +Recherche les chaînes d’événements dans une fenêtre de temps coulissante et calcule le nombre maximum d’événements qui se sont produits à partir de la chaîne. + +La fonction fonctionne selon l’algorithme: + +- La fonction recherche les données qui déclenchent la première condition de la chaîne et définit le compteur d’événements sur 1. C’est le moment où la fenêtre coulissante commence. + +- Si les événements de la chaîne se produisent séquentiellement dans la fenêtre, le compteur est incrémenté. Si la séquence d’événements est perturbée, le compteur n’est pas incrémenté. + +- Si les données ont plusieurs chaînes d’événements à différents points d’achèvement, la fonction affichera uniquement la taille de la chaîne la plus longue. + +**Syntaxe** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**Paramètre** + +- `window` — Length of the sliding window in seconds. +- `mode` - C’est un argument facultatif. + - `'strict'` - Lorsque le `'strict'` est défini, le windowFunnel() applique des conditions uniquement pour les valeurs uniques. +- `timestamp` — Name of the column containing the timestamp. Data types supported: [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) et d’autres types entiers non signés (notez que même si timestamp prend en charge le `UInt64` type, sa valeur ne peut pas dépasser le maximum Int64, qui est 2^63 - 1). +- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valeur renvoyée** + +Nombre maximal de conditions déclenchées consécutives de la chaîne dans la fenêtre de temps de glissement. +Toutes les chaînes de la sélection sont analysés. + +Type: `Integer`. + +**Exemple** + +Déterminer si une période de temps est suffisant pour l’utilisateur de sélectionner un téléphone et d’acheter deux fois dans la boutique en ligne. + +Définissez la chaîne d’événements suivante: + +1. L’utilisateur s’est connecté à son compte sur le magasin (`eventID = 1003`). +2. L’utilisateur recherche un téléphone (`eventID = 1007, product = 'phone'`). +3. Toute commande de l’utilisateur (`eventID = 1009`). +4. L’Utilisateur a fait la commande à nouveau (`eventID = 1010`). + +Table d’entrée: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +Savoir dans quelle mesure l’utilisateur `user_id` pourrait passer à travers la chaîne dans une période en Janvier-Février de 2019. + +Requête: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +Résultat: + +``` text +┌─level─┬─c─┐ +│ 4 │ 1 │ +└───────┴───┘ +``` + +## rétention {#retention} + +La fonction prend comme arguments un ensemble de conditions de 1 à 32 arguments de type `UInt8` qui indiquent si une certaine condition est remplie pour l’événement. +Toute condition peut être spécifiée comme argument (comme dans [WHERE](../../sql-reference/statements/select.md#select-where)). + +Les conditions, à l’exception de la première, s’appliquent par paires: le résultat de la seconde sera vrai si la première et la deuxième sont remplies, le troisième si la première et la fird sont vraies, etc. + +**Syntaxe** + +``` sql +retention(cond1, cond2, ..., cond32); +``` + +**Paramètre** + +- `cond` — an expression that returns a `UInt8` résultat (1 ou 0). + +**Valeur renvoyée** + +Le tableau de 1 ou 0. + +- 1 — condition was met for the event. +- 0 — condition wasn’t met for the event. + +Type: `UInt8`. + +**Exemple** + +Prenons un exemple de calcul de la `retention` fonction pour déterminer le trafic du site. + +**1.** Сreate a table to illustrate an example. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +Table d’entrée: + +Requête: + +``` sql +SELECT * FROM retention_test +``` + +Résultat: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** Grouper les utilisateurs par ID unique `uid` à l’aide de la `retention` fonction. + +Requête: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +Résultat: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** Calculer le nombre total de visites par jour. + +Requête: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +Résultat: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +Où: + +- `r1`- le nombre de visiteurs uniques qui ont visité le site au cours du 2020-01-01 (le `cond1` condition). +- `r2`- le nombre de visiteurs uniques qui ont visité le site au cours d’une période donnée entre 2020-01-01 et 2020-01-02 (`cond1` et `cond2` condition). +- `r3`- le nombre de visiteurs uniques qui ont visité le site au cours d’une période donnée entre 2020-01-01 et 2020-01-03 (`cond1` et `cond3` condition). + +## uniqUpTo (N) (x) {#uniquptonx} + +Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. + +Recommandé pour une utilisation avec de petites Ns, jusqu’à 10. La valeur maximale de N est de 100. + +Pour l’état d’une fonction d’agrégation, il utilise la quantité de mémoire égale à 1 + N \* de la taille d’une valeur d’octets. +Pour les chaînes, il stocke un hachage non cryptographique de 8 octets. Soit le calcul est approchée pour les chaînes. + +La fonction fonctionne également pour plusieurs arguments. + +Cela fonctionne aussi vite que possible, sauf dans les cas où une grande valeur N est utilisée et le nombre de valeurs uniques est légèrement inférieur à N. + +Exemple d’utilisation: + +``` text +Problem: Generate a report that shows only keywords that produced at least 5 unique users. +Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) + +## sumMapFiltered(keys\_to\_keep) (clés, valeurs) {#summapfilteredkeys-to-keepkeys-values} + +Même comportement que [sumMap](reference.md#agg_functions-summap) sauf qu’un tableau de clés est passé en paramètre. Cela peut être particulièrement utile lorsque vous travaillez avec une forte cardinalité de touches. diff --git a/docs/fr/sql-reference/aggregate-functions/reference.md b/docs/fr/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..29704eb0d2f --- /dev/null +++ b/docs/fr/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1837 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 36 +toc_title: "R\xE9f\xE9rence" +--- + +# La Fonction De Référence {#function-reference} + +## compter {#agg_function-count} + +Compte le nombre de lignes ou de valeurs non NULL. + +ClickHouse prend en charge les syntaxes suivantes pour `count`: +- `count(expr)` ou `COUNT(DISTINCT expr)`. +- `count()` ou `COUNT(*)`. Le `count()` la syntaxe est spécifique à ClickHouse. + +**Paramètre** + +La fonction peut prendre: + +- Zéro des paramètres. +- Un [expression](../syntax.md#syntax-expressions). + +**Valeur renvoyée** + +- Si la fonction est appelée sans paramètres, il compte le nombre de lignes. +- Si l’ [expression](../syntax.md#syntax-expressions) est passé, alors la fonction compte combien de fois cette expression retournée not null. Si l’expression renvoie un [Nullable](../../sql-reference/data-types/nullable.md)- tapez la valeur, puis le résultat de `count` séjours pas `Nullable`. La fonction renvoie 0 si l’expression est retournée `NULL` pour toutes les lignes. + +Dans les deux cas le type de la valeur renvoyée est [UInt64](../../sql-reference/data-types/int-uint.md). + +**Détail** + +Clickhouse soutient le `COUNT(DISTINCT ...)` syntaxe. Le comportement de cette construction dépend de la [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) paramètre. Il définit lequel des [uniq\*](#agg_function-uniq) fonctions est utilisée pour effectuer l’opération. La valeur par défaut est la [uniqExact](#agg_function-uniqexact) fonction. + +Le `SELECT count() FROM table` la requête n’est pas optimisé, car le nombre d’entrées dans la table n’est pas stockée séparément. Il choisit une petite colonne de la table et compte le nombre de valeurs qu’il contient. + +**Exemple** + +Exemple 1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +Exemple 2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +Cet exemple montre que `count(DISTINCT num)` est effectuée par le `uniqExact` en fonction de l’ `count_distinct_implementation` valeur de réglage. + +## tout(x) {#agg_function-any} + +Sélectionne la première valeur rencontrée. +La requête peut être exécutée dans n’importe quel ordre, et même dans un ordre différent à chaque fois, de sorte que le résultat de cette fonction est indéterminée. +Pour obtenir un résultat déterminé, vous pouvez utiliser le ‘min’ ou ‘max’ fonction au lieu de ‘any’. + +Dans certains cas, vous pouvez compter sur l’ordre de l’exécution. Cela s’applique aux cas où SELECT provient d’une sous-requête qui utilise ORDER BY. + +Lorsqu’un `SELECT` la requête a l’ `GROUP BY` ou au moins une fonction d’agrégat, ClickHouse (contrairement à MySQL) exige que toutes les expressions du `SELECT`, `HAVING`, et `ORDER BY` clauses être calculée à partir de clés ou de fonctions d’agrégation. En d’autres termes, chaque colonne sélectionnée dans la table doit être utilisée soit dans les clés, soit dans les fonctions d’agrégation. Pour obtenir un comportement comme dans MySQL, vous pouvez mettre les autres colonnes dans le `any` fonction d’agrégation. + +## anyHeavy (x) {#anyheavyx} + +Sélectionne une valeur fréquente à l’aide [poids lourds](http://www.cs.umd.edu/~samir/498/karp.pdf) algorithme. S’il y a une valeur qui se produit plus de la moitié des cas dans chacun des threads d’exécution de la requête, cette valeur est renvoyée. Normalement, le résultat est non déterministe. + +``` sql +anyHeavy(column) +``` + +**Argument** + +- `column` – The column name. + +**Exemple** + +Prendre la [OnTime](../../getting-started/example-datasets/ontime.md) ensemble de données et sélectionnez n’importe quelle valeur `AirlineID` colonne. + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## anyLast (x) {#anylastx} + +Sélectionne la dernière valeur rencontrés. +Le résultat est tout aussi indéterminé que pour le `any` fonction. + +## groupBitAnd {#groupbitand} + +S’applique au niveau du BIT `AND` pour les séries de nombres. + +``` sql +groupBitAnd(expr) +``` + +**Paramètre** + +`expr` – An expression that results in `UInt*` type. + +**Valeur de retour** + +La valeur de la `UInt*` type. + +**Exemple** + +Des données de Test: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Requête: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +Où `num` est la colonne avec les données de test. + +Résultat: + +``` text +binary decimal +00000100 = 4 +``` + +## groupBitOr {#groupbitor} + +S’applique au niveau du BIT `OR` pour les séries de nombres. + +``` sql +groupBitOr(expr) +``` + +**Paramètre** + +`expr` – An expression that results in `UInt*` type. + +**Valeur de retour** + +La valeur de la `UInt*` type. + +**Exemple** + +Des données de Test: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Requête: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +Où `num` est la colonne avec les données de test. + +Résultat: + +``` text +binary decimal +01111101 = 125 +``` + +## groupBitXor {#groupbitxor} + +S’applique au niveau du BIT `XOR` pour les séries de nombres. + +``` sql +groupBitXor(expr) +``` + +**Paramètre** + +`expr` – An expression that results in `UInt*` type. + +**Valeur de retour** + +La valeur de la `UInt*` type. + +**Exemple** + +Des données de Test: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Requête: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +Où `num` est la colonne avec les données de test. + +Résultat: + +``` text +binary decimal +01101000 = 104 +``` + +## groupBitmap {#groupbitmap} + +Calculs Bitmap ou agrégés à partir d’une colonne entière non signée, retour cardinalité de type UInt64, si Ajouter suffixe-State, puis retour [objet bitmap](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmap(expr) +``` + +**Paramètre** + +`expr` – An expression that results in `UInt*` type. + +**Valeur de retour** + +La valeur de la `UInt64` type. + +**Exemple** + +Des données de Test: + +``` text +UserID +1 +1 +2 +3 +``` + +Requête: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +Résultat: + +``` text +num +3 +``` + +## min (x) {#agg_function-min} + +Calcule le minimum. + +## max (x) {#agg_function-max} + +Calcule le maximum. + +## argMin (arg, val) {#agg-function-argmin} + +Calcule la ‘arg’ valeur pour un minimum ‘val’ valeur. S’il y a plusieurs valeurs différentes de ‘arg’ pour des valeurs minimales de ‘val’ la première de ces valeurs rencontrées est de sortie. + +**Exemple:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## argMax(arg, val) {#agg-function-argmax} + +Calcule la ‘arg’ valeur pour un maximum ‘val’ valeur. S’il y a plusieurs valeurs différentes de ‘arg’ pour les valeurs maximales de ‘val’ la première de ces valeurs rencontrées est de sortie. + +## sum(x) {#agg_function-sum} + +Calcule la somme. +Ne fonctionne que pour les numéros. + +## sumWithOverflow (x) {#sumwithoverflowx} + +Calcule la somme des nombres, en utilisant le même type de données pour le résultat que pour les paramètres d’entrée. Si la somme dépasse la valeur maximale pour ce type de données, la fonction renvoie une erreur. + +Ne fonctionne que pour les numéros. + +## sumMap (clé, valeur) {#agg_functions-summap} + +Les totaux de la ‘value’ tableau selon les clés spécifiés dans le ‘key’ tableau. +Le nombre d’éléments dans ‘key’ et ‘value’ doit être identique pour chaque ligne totalisée. +Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. + +Exemple: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┘ +``` + +## skewPop {#skewpop} + +Calcule la [asymétrie](https://en.wikipedia.org/wiki/Skewness) d’une séquence. + +``` sql +skewPop(expr) +``` + +**Paramètre** + +`expr` — [Expression](../syntax.md#syntax-expressions) retour d’un nombre. + +**Valeur renvoyée** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Exemple** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## skewSamp {#skewsamp} + +Calcule la [asymétrie de l’échantillon](https://en.wikipedia.org/wiki/Skewness) d’une séquence. + +Il représente une estimation non biaisée de l’asymétrie d’une variable aléatoire si les valeurs passées forme de son échantillon. + +``` sql +skewSamp(expr) +``` + +**Paramètre** + +`expr` — [Expression](../syntax.md#syntax-expressions) retour d’un nombre. + +**Valeur renvoyée** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). Si `n <= 1` (`n` est la taille de l’échantillon), alors la fonction renvoie `nan`. + +**Exemple** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## kurtPop {#kurtpop} + +Calcule la [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) d’une séquence. + +``` sql +kurtPop(expr) +``` + +**Paramètre** + +`expr` — [Expression](../syntax.md#syntax-expressions) retour d’un nombre. + +**Valeur renvoyée** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Exemple** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## kurtSamp {#kurtsamp} + +Calcule la [l’échantillon le coefficient d’aplatissement](https://en.wikipedia.org/wiki/Kurtosis) d’une séquence. + +Il représente une estimation non biaisée de la kurtose d’une variable aléatoire si les valeurs passées forment son échantillon. + +``` sql +kurtSamp(expr) +``` + +**Paramètre** + +`expr` — [Expression](../syntax.md#syntax-expressions) retour d’un nombre. + +**Valeur renvoyée** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). Si `n <= 1` (`n` la taille de l’échantillon), alors la fonction renvoie `nan`. + +**Exemple** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## timeSeriesGroupSum(uid, horodatage, valeur) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` peut agréger différentes séries temporelles qui échantillonnent l’horodatage et non l’alignement. +Il utilisera une interpolation linéaire entre deux échantillons d’horodatage, puis additionnera les séries temporelles ensemble. + +- `uid` la série temporelle est elle unique, `UInt64`. +- `timestamp` est de type Int64 afin de prendre en charge la milliseconde ou la microseconde. +- `value` est la métrique. + +La fonction renvoie un tableau de tuples avec `(timestamp, aggregated_value)` pair. + +Avant d’utiliser cette fonction, assurez-vous `timestamp` est dans l’ordre croissant. + +Exemple: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +Et le résultat sera: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## timeSeriesGroupRateSum(uid, ts, val) {#agg-function-timeseriesgroupratesum} + +De même timeSeriesGroupRateSum, timeSeriesGroupRateSum calculera le taux de séries temporelles, puis additionnera les taux ensemble. +En outre, l’horodatage doit être dans l’ordre croissant avant d’utiliser cette fonction. + +Utilisez cette fonction, le résultat ci-dessus sera: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## avg (x) {#agg_function-avg} + +Calcule la moyenne. +Ne fonctionne que pour les numéros. +Le résultat est toujours Float64. + +## uniq {#agg_function-uniq} + +Calcule le nombre approximatif des différentes valeurs de l’argument. + +``` sql +uniq(x[, ...]) +``` + +**Paramètre** + +La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. + +**Valeur renvoyée** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)numéro de type. + +**Détails de mise en œuvre** + +Fonction: + +- Calcule un hachage pour tous les paramètres de l’agrégat, puis l’utilise dans les calculs. + +- Utilise un algorithme d’échantillonnage adaptatif. Pour l’état de calcul, La fonction utilise un échantillon de valeurs de hachage d’éléments jusqu’à 65536. + + This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. + +- Fournit le résultat de manière déterministe (cela ne dépend pas de l’ordre de traitement de la requête). + +Nous vous recommandons d’utiliser cette fonction dans presque tous les scénarios. + +**Voir Aussi** + +- [uniqcombiné](#agg_function-uniqcombined) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqcombiné {#agg_function-uniqcombined} + +Calcule le nombre approximatif de différentes valeurs d’argument. + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +Le `uniqCombined` la fonction est un bon choix pour calculer le nombre de valeurs différentes. + +**Paramètre** + +La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. + +`HLL_precision` est le logarithme en base 2 du nombre de cellules dans [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). Facultatif, vous pouvez utiliser la fonction comme `uniqCombined(x[, ...])`. La valeur par défaut pour `HLL_precision` est 17, qui est effectivement 96 Ko d’espace(2 ^ 17 cellules, 6 bits chacune). + +**Valeur renvoyée** + +- Nombre [UInt64](../../sql-reference/data-types/int-uint.md)numéro de type. + +**Détails de mise en œuvre** + +Fonction: + +- Calcule un hachage (hachage 64 bits pour `String` et 32 bits sinon) pour tous les paramètres dans l’agrégat, puis l’utilise dans les calculs. + +- Utilise une combinaison de trois algorithmes: tableau, table de hachage et HyperLogLog avec une table de correction d’erreur. + + For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. + +- Fournit le résultat de manière déterministe (cela ne dépend pas de l’ordre de traitement de la requête). + +!!! note "Note" + Comme il utilise le hachage 32 bits pour non-`String` type, le résultat aura une erreur très élevée pour les cardinalités significativement plus grandes que `UINT_MAX` (erreur va augmenter rapidement après quelques dizaines de milliards de valeurs distinctes), donc dans ce cas, vous devez utiliser [uniqCombined64](#agg_function-uniqcombined64) + +Par rapport à la [uniq](#agg_function-uniq) la fonction, la `uniqCombined`: + +- Consomme plusieurs fois moins de mémoire. +- Calcule avec plusieurs fois plus de précision. +- A généralement des performances légèrement inférieures. Dans certains scénarios, `uniqCombined` peut faire mieux que `uniq` par exemple, avec des requêtes distribuées qui transmettent un grand nombre d’agrégation des états sur le réseau. + +**Voir Aussi** + +- [uniq](#agg_function-uniq) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined64 {#agg_function-uniqcombined64} + +Même que [uniqcombiné](#agg_function-uniqcombined), mais utilise le hachage 64 bits pour tous les types de données. + +## uniqHLL12 {#agg_function-uniqhll12} + +Calcule le nombre approximatif de différentes valeurs d’argument, en utilisant [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) algorithme. + +``` sql +uniqHLL12(x[, ...]) +``` + +**Paramètre** + +La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. + +**Valeur renvoyée** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)numéro de type. + +**Détails de mise en œuvre** + +Fonction: + +- Calcule un hachage pour tous les paramètres de l’agrégat, puis l’utilise dans les calculs. + +- Utilise L’algorithme HyperLogLog pour approximer le nombre de valeurs d’argument différentes. + + 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). + +- Fournit le résultat déterminé (il ne dépend pas de l’ordre de traitement de la requête). + +Nous ne recommandons pas d’utiliser cette fonction. Dans la plupart des cas, l’utilisation de la [uniq](#agg_function-uniq) ou [uniqcombiné](#agg_function-uniqcombined) fonction. + +**Voir Aussi** + +- [uniq](#agg_function-uniq) +- [uniqcombiné](#agg_function-uniqcombined) +- [uniqExact](#agg_function-uniqexact) + +## uniqExact {#agg_function-uniqexact} + +Calcule le nombre exact de différentes valeurs d’argument. + +``` sql +uniqExact(x[, ...]) +``` + +L’utilisation de la `uniqExact` fonction si vous avez absolument besoin d’un résultat exact. Sinon l’utilisation de la [uniq](#agg_function-uniq) fonction. + +Le `uniqExact` la fonction utilise plus de mémoire que `uniq` parce que la taille de l’état a surabondance de croissance que le nombre de valeurs différentes augmente. + +**Paramètre** + +La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. + +**Voir Aussi** + +- [uniq](#agg_function-uniq) +- [uniqcombiné](#agg_function-uniqcombined) +- [uniqHLL12](#agg_function-uniqhll12) + +## groupArray(x), groupArray (max\_size) (x) {#agg_function-grouparray} + +Crée un tableau de valeurs de l’argument. +Les valeurs peuvent être ajoutées au tableau dans une (indéterminée) de commande. + +La deuxième version (avec le `max_size` paramètre) limite la taille du tableau résultant à `max_size` élément. +Exemple, `groupArray (1) (x)` est équivalent à `[any (x)]`. + +Dans certains cas, vous pouvez toujours compter sur l’ordre de l’exécution. Cela s’applique aux cas où `SELECT` provient d’une sous-requête qui utilise `ORDER BY`. + +## groupeparrayinsertat(valeur, position) {#grouparrayinsertatvalue-position} + +Insère une valeur dans le tableau à la position spécifiée. + +!!! note "Note" + Cette fonction utilise des positions à base zéro, contrairement aux positions à base unique classiques pour les tableaux SQL. + +Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. + +Paramètres facultatifs: + +- Valeur par défaut pour la substitution dans des positions vides. +- La longueur du tableau résultant. Cela vous permet de recevoir des tableaux de la même taille pour tous les agrégats clés. Lorsque vous utilisez ce paramètre, la valeur par défaut doit être spécifiée. + +## groupeparraymovingsum {#agg_function-grouparraymovingsum} + +Calcule la somme mobile des valeurs d’entrée. + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +La fonction peut prendre la taille de la fenêtre comme paramètre. Si spécifié, la fonction prend la taille de la fenêtre égal au nombre de lignes dans la colonne. + +**Paramètre** + +- `numbers_for_summing` — [Expression](../syntax.md#syntax-expressions) résultant en une valeur de type de données Numérique. +- `window_size` — Size of the calculation window. + +**Valeurs renvoyées** + +- Tableau de la même taille et de même type que les données d’entrée. + +**Exemple** + +La table d’échantillon: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Requête: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## groupArrayMovingAvg {#agg_function-grouparraymovingavg} + +Calcule la moyenne mobile des valeurs d’entrée. + +``` sql +groupArrayMovingAvg(numbers_for_summing) +groupArrayMovingAvg(window_size)(numbers_for_summing) +``` + +La fonction peut prendre la taille de la fenêtre comme paramètre. Si spécifié, la fonction prend la taille de la fenêtre égal au nombre de lignes dans la colonne. + +**Paramètre** + +- `numbers_for_summing` — [Expression](../syntax.md#syntax-expressions) résultant en une valeur de type de données Numérique. +- `window_size` — Size of the calculation window. + +**Valeurs renvoyées** + +- Tableau de la même taille et de même type que les données d’entrée. + +La fonction utilise [l’arrondi vers zéro](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). Il tronque les décimales insignifiantes pour le type de données résultant. + +**Exemple** + +La table d’échantillon `b`: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Requête: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## groupUniqArray(x), groupUniqArray (max\_size) (x) {#groupuniqarrayx-groupuniqarraymax-sizex} + +Crée un tableau à partir de différentes valeurs d’argument. La consommation de mémoire est la même que pour la `uniqExact` fonction. + +La deuxième version (avec le `max_size` paramètre) limite la taille du tableau résultant à `max_size` élément. +Exemple, `groupUniqArray(1)(x)` est équivalent à `[any(x)]`. + +## quantile {#quantile} + +Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. + +Cette fonction s’applique [réservoir d’échantillonnage](https://en.wikipedia.org/wiki/Reservoir_sampling) avec une taille de réservoir jusqu’à 8192 et un générateur de nombres aléatoires pour l’échantillonnage. Le résultat est non-déterministe. Pour obtenir un quantile exact, Utilisez le [quantileExact](#quantileexact) fonction. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantile(level)(expr) +``` + +Alias: `median`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [types de données](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). + +**Valeur renvoyée** + +- Approximative de quantiles de niveau spécifié. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) pour l’entrée de type de données numériques. +- [Date](../../sql-reference/data-types/date.md) si les valeurs d’entrée ont le `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) si les valeurs d’entrée ont le `DateTime` type. + +**Exemple** + +Table d’entrée: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Requête: + +``` sql +SELECT quantile(val) FROM t +``` + +Résultat: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## quantileDeterministic {#quantiledeterministic} + +Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. + +Cette fonction s’applique [réservoir d’échantillonnage](https://en.wikipedia.org/wiki/Reservoir_sampling) avec une taille de réservoir jusqu’à 8192 et un algorithme déterministe d’échantillonnage. Le résultat est déterministe. Pour obtenir un quantile exact, Utilisez le [quantileExact](#quantileexact) fonction. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +Alias: `medianDeterministic`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [types de données](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). +- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. + +**Valeur renvoyée** + +- Approximative de quantiles de niveau spécifié. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) pour l’entrée de type de données numériques. +- [Date](../../sql-reference/data-types/date.md) si les valeurs d’entrée ont le `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) si les valeurs d’entrée ont le `DateTime` type. + +**Exemple** + +Table d’entrée: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Requête: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +Résultat: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## quantileExact {#quantileexact} + +Exactement calcule l’ [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` de mémoire, où `n` est un nombre de valeurs qui ont été passées. Cependant, pour un petit nombre de valeurs, la fonction est très efficace. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantileExact(level)(expr) +``` + +Alias: `medianExact`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [types de données](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). + +**Valeur renvoyée** + +- Quantiles de niveau spécifié. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) pour l’entrée de type de données numériques. +- [Date](../../sql-reference/data-types/date.md) si les valeurs d’entrée ont le `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) si les valeurs d’entrée ont le `DateTime` type. + +**Exemple** + +Requête: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +Résultat: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## quantileExactWeighted {#quantileexactweighted} + +Exactement calcule l’ [quantile](https://en.wikipedia.org/wiki/Quantile) d’une séquence de données numériques, en tenant compte du poids de chaque élément. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). Vous pouvez utiliser cette fonction au lieu de `quantileExact` et spécifiez le poids 1. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +Alias: `medianExactWeighted`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [types de données](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. + +**Valeur renvoyée** + +- Quantiles de niveau spécifié. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) pour l’entrée de type de données numériques. +- [Date](../../sql-reference/data-types/date.md) si les valeurs d’entrée ont le `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) si les valeurs d’entrée ont le `DateTime` type. + +**Exemple** + +Table d’entrée: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +Requête: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +Résultat: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## quantileTiming {#quantiletiming} + +Avec la précision déterminée calcule le [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. + +Le résultat est déterministe (il ne dépend pas de l’ordre de traitement de la requête). La fonction est optimisée pour travailler avec des séquences qui décrivent des distributions comme les temps de chargement des pages web ou les temps de réponse du backend. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantileTiming(level)(expr) +``` + +Alias: `medianTiming`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). + +- `expr` — [Expression](../syntax.md#syntax-expressions) sur une colonne Valeurs renvoyant un [Flottant\*](../../sql-reference/data-types/float.md)numéro de type. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +**Exactitude** + +Le calcul est précis si: + +- Le nombre Total de valeurs ne dépasse pas 5670. +- Le nombre Total de valeurs dépasse 5670, mais le temps de chargement de la page est inférieur à 1024ms. + +Sinon, le résultat du calcul est arrondi au plus proche multiple de 16 ms. + +!!! note "Note" + Pour calculer les quantiles de temps de chargement de page, cette fonction est plus efficace et précise que [quantile](#quantile). + +**Valeur renvoyée** + +- Quantiles de niveau spécifié. + +Type: `Float32`. + +!!! note "Note" + Si aucune valeur n’est transmise à la fonction (lors de l’utilisation de `quantileTimingIf`), [Nan](../../sql-reference/data-types/float.md#data_type-float-nan-inf) est retourné. Le but est de différencier ces cas de cas qui aboutissent à zéro. Voir [Clause ORDER BY](../statements/select.md#select-order-by) pour des notes sur le tri `NaN` valeur. + +**Exemple** + +Table d’entrée: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +Requête: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +Résultat: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## quantileTimingWeighted {#quantiletimingweighted} + +Avec la précision déterminée calcule le [quantile](https://en.wikipedia.org/wiki/Quantile) d’une séquence de données numériques en fonction du poids de chaque élément de séquence. + +Le résultat est déterministe (il ne dépend pas de l’ordre de traitement de la requête). La fonction est optimisée pour travailler avec des séquences qui décrivent des distributions comme les temps de chargement des pages web ou les temps de réponse du backend. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +Alias: `medianTimingWeighted`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). + +- `expr` — [Expression](../syntax.md#syntax-expressions) sur une colonne Valeurs renvoyant un [Flottant\*](../../sql-reference/data-types/float.md)numéro de type. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Exactitude** + +Le calcul est précis si: + +- Le nombre Total de valeurs ne dépasse pas 5670. +- Le nombre Total de valeurs dépasse 5670, mais le temps de chargement de la page est inférieur à 1024ms. + +Sinon, le résultat du calcul est arrondi au plus proche multiple de 16 ms. + +!!! note "Note" + Pour calculer les quantiles de temps de chargement de page, cette fonction est plus efficace et précise que [quantile](#quantile). + +**Valeur renvoyée** + +- Quantiles de niveau spécifié. + +Type: `Float32`. + +!!! note "Note" + Si aucune valeur n’est transmise à la fonction (lors de l’utilisation de `quantileTimingIf`), [Nan](../../sql-reference/data-types/float.md#data_type-float-nan-inf) est retourné. Le but est de différencier ces cas de cas qui aboutissent à zéro. Voir [Clause ORDER BY](../statements/select.md#select-order-by) pour des notes sur le tri `NaN` valeur. + +**Exemple** + +Table d’entrée: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +Requête: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +Résultat: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## quantileTDigest {#quantiletdigest} + +Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) d’une séquence de données numériques utilisant [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algorithme. + +L’erreur maximale est de 1%. La consommation de mémoire est `log(n)`, où `n` est un certain nombre de valeurs. Le résultat dépend de l’ordre d’exécution de la requête et n’est pas déterministe. + +La performance de la fonction est inférieure à la performance de [quantile](#quantile) ou [quantileTiming](#quantiletiming). En termes de rapport entre la taille de L’état et la précision, cette fonction est bien meilleure que `quantile`. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantileTDigest(level)(expr) +``` + +Alias: `medianTDigest`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [types de données](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). + +**Valeur renvoyée** + +- Approximative de quantiles de niveau spécifié. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) pour l’entrée de type de données numériques. +- [Date](../../sql-reference/data-types/date.md) si les valeurs d’entrée ont le `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) si les valeurs d’entrée ont le `DateTime` type. + +**Exemple** + +Requête: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +Résultat: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## quantileTDigestWeighted {#quantiletdigestweighted} + +Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) d’une séquence de données numériques utilisant [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algorithme. La fonction prend en compte le poids de chaque séquence de membre. L’erreur maximale est de 1%. La consommation de mémoire est `log(n)`, où `n` est un certain nombre de valeurs. + +La performance de la fonction est inférieure à la performance de [quantile](#quantile) ou [quantileTiming](#quantiletiming). En termes de rapport entre la taille de L’état et la précision, cette fonction est bien meilleure que `quantile`. + +Le résultat dépend de l’ordre d’exécution de la requête et n’est pas déterministe. + +Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu’il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. + +**Syntaxe** + +``` sql +quantileTDigest(level)(expr) +``` + +Alias: `medianTDigest`. + +**Paramètre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [types de données](../../sql-reference/data-types/index.md#data_types), [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Valeur renvoyée** + +- Approximative de quantiles de niveau spécifié. + +Type: + +- [Float64](../../sql-reference/data-types/float.md) pour l’entrée de type de données numériques. +- [Date](../../sql-reference/data-types/date.md) si les valeurs d’entrée ont le `Date` type. +- [DateTime](../../sql-reference/data-types/datetime.md) si les valeurs d’entrée ont le `DateTime` type. + +**Exemple** + +Requête: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +Résultat: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**Voir Aussi** + +- [médian](#median) +- [les quantiles](#quantiles) + +## médian {#median} + +Le `median*` les fonctions sont les Alias pour le correspondant `quantile*` fonction. Ils calculent la médiane d’un échantillon de données numériques. + +Fonction: + +- `median` — Alias for [quantile](#quantile). +- `medianDeterministic` — Alias for [quantileDeterministic](#quantiledeterministic). +- `medianExact` — Alias for [quantileExact](#quantileexact). +- `medianExactWeighted` — Alias for [quantileExactWeighted](#quantileexactweighted). +- `medianTiming` — Alias for [quantileTiming](#quantiletiming). +- `medianTimingWeighted` — Alias for [quantileTimingWeighted](#quantiletimingweighted). +- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). +- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). + +**Exemple** + +Table d’entrée: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Requête: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +Résultat: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +Toutes les fonctions quantiles ont également des fonctions quantiles correspondantes: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Ces fonctions calculent tous les quantiles des niveaux listés en une seule passe et renvoient un tableau des valeurs résultantes. + +## varSamp (x) {#varsampx} + +Calcule le montant `Σ((x - x̅)^2) / (n - 1)`, où `n` est la taille de l’échantillon et `x̅`est la valeur moyenne de `x`. + +Il représente une estimation non biaisée de la variance d’une variable aléatoire si les valeurs passées forment son échantillon. + +Retourner `Float64`. Lorsque `n <= 1`, retourner `+∞`. + +## varPop (x) {#varpopx} + +Calcule le montant `Σ((x - x̅)^2) / n`, où `n` est la taille de l’échantillon et `x̅`est la valeur moyenne de `x`. + +En d’autres termes, dispersion pour un ensemble de valeurs. Retourner `Float64`. + +## stddevSamp (x) {#stddevsampx} + +Le résultat est égal à la racine carrée de `varSamp(x)`. + +## stddevPop (x) {#stddevpopx} + +Le résultat est égal à la racine carrée de `varPop(x)`. + +## topK (N) (x) {#topknx} + +Renvoie un tableau des valeurs approximativement les plus fréquentes dans la colonne spécifiée. Le tableau est trié par ordre décroissant de fréquence approximative des valeurs (et non par les valeurs elles-mêmes). + +Met en œuvre la [Gain De Place Filtré](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) algorithme d’analyse de TopK, basé sur l’algorithme de réduction et de combinaison de [Économie D’Espace Parallèle](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +Cette fonction ne fournit pas un résultat garanti. Dans certaines situations, des erreurs peuvent se produire et renvoyer des valeurs fréquentes qui ne sont pas les valeurs les plus fréquentes. + +Nous vous recommandons d’utiliser l’ `N < 10` valeur; performance est réduite avec grand `N` valeur. Valeur maximale de `N = 65536`. + +**Paramètre** + +- ‘N’ est le nombre d’éléments de retour. + +Si le paramètre est omis, la valeur par défaut 10 est utilisé. + +**Argument** + +- ’ x ’ – The value to calculate frequency. + +**Exemple** + +Prendre la [OnTime](../../getting-started/example-datasets/ontime.md) ensemble de données et sélectionnez les trois valeurs les plus fréquentes `AirlineID` colonne. + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## topKWeighted {#topkweighted} + +Semblable à `topK` mais prend un argument de type entier - `weight`. Chaque valeur est comptabilisée `weight` les temps de calcul de fréquence. + +**Syntaxe** + +``` sql +topKWeighted(N)(x, weight) +``` + +**Paramètre** + +- `N` — The number of elements to return. + +**Argument** + +- `x` – The value. +- `weight` — The weight. [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valeur renvoyée** + +Renvoie un tableau des valeurs avec la somme approximative maximale des poids. + +**Exemple** + +Requête: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +Résultat: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## covarSamp(x, y) {#covarsampx-y} + +Calcule la valeur de `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +Renvoie Float64. Lorsque `n <= 1`, returns +∞. + +## covarPop (x, y) {#covarpopx-y} + +Calcule la valeur de `Σ((x - x̅)(y - y̅)) / n`. + +## corr (x, y) {#corrx-y} + +Calcule le coefficient de corrélation de Pearson: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## categoricalInformationValue {#categoricalinformationvalue} + +Calcule la valeur de `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` pour chaque catégorie. + +``` sql +categoricalInformationValue(category1, category2, ..., tag) +``` + +Le résultat indique comment une caractéristique discrète (catégorique) `[category1, category2, ...]` contribuer à un modèle d’apprentissage qui prédit la valeur de `tag`. + +## simplelineearregression {#simplelinearregression} + +Effectue une régression linéaire simple (unidimensionnelle). + +``` sql +simpleLinearRegression(x, y) +``` + +Paramètre: + +- `x` — Column with dependent variable values. +- `y` — Column with explanatory variable values. + +Valeurs renvoyées: + +Constant `(a, b)` de la ligne `y = a*x + b`. + +**Exemple** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## stochasticLinearRegression {#agg_functions-stochasticlinearregression} + +Cette fonction implémente la régression linéaire stochastique. Il prend en charge les paramètres personnalisés pour le taux d’apprentissage, le coefficient de régularisation L2, la taille de mini-lot et a peu de méthodes pour mettre à jour les poids ([Adam](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (utilisé par défaut), [simple SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Élan](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### Paramètre {#agg_functions-stochasticlinearregression-parameters} + +Il y a 4 paramètres personnalisables. Ils sont passés à la fonction séquentiellement, mais il n’est pas nécessaire de passer tous les quatre-les valeurs par défaut seront utilisées, mais un bon modèle nécessite un réglage des paramètres. + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. `learning rate` est le coefficient sur la longueur de l’étape, lorsque l’étape de descente de gradient est effectuée. Un taux d’apprentissage trop élevé peut entraîner des poids infinis du modèle. Par défaut est `0.00001`. +2. `l2 regularization coefficient` ce qui peut aider à éviter le surajustement. Par défaut est `0.1`. +3. `mini-batch size` définit le nombre d’éléments, dont les gradients seront calculés et additionnés pour effectuer une étape de descente de gradient. La descente stochastique Pure utilise un élément, mais avoir de petits lots (environ 10 éléments) rend les étapes de gradient plus stables. Par défaut est `15`. +4. `method for updating weights` ils sont: `Adam` (par défaut), `SGD`, `Momentum`, `Nesterov`. `Momentum` et `Nesterov` nécessitent un peu plus de calculs et de mémoire, mais ils sont utiles en termes de vitesse de convergence et de stabilité des méthodes de gradient stochastique. + +### Utilisation {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` est utilisé en deux étapes: ajustement du modèle et prédiction sur de nouvelles données. Afin de correspondre le modèle et l’enregistrer son état pour utilisation ultérieure nous utilisons `-State` combinator, qui enregistre essentiellement l’état (poids du modèle, etc.). +Pour prédire nous utilisons la fonction [evalMLMethod](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod) qui prend un état comme un argument ainsi que des fonctionnalités à prévoir sur. + + + +**1.** Raccord + +Une telle requête peut être utilisé. + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +Ici, nous devons également insérer des données dans `train_data` table. Le nombre de paramètres n’est pas fixe, il dépend uniquement du nombre d’arguments, passés dans `linearRegressionState`. Ils doivent tous être des valeurs numériques. +Notez que la colonne avec la valeur cible (que nous aimerions apprendre à prédire) est insérée comme premier argument. + +**2.** Prédire + +Après avoir enregistré un État dans la table, nous pouvons l’utiliser plusieurs fois pour la prédiction, ou même fusionner avec d’autres États et créer de nouveaux modèles encore meilleurs. + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +La requête renvoie une colonne de valeurs prédites. Notez que le premier argument de `evalMLMethod` être `AggregateFunctionState` objet, sont ensuite des colonnes de fonctionnalités. + +`test_data` est un tableau comme `train_data` mais peut ne pas contenir de valeur cible. + +### Note {#agg_functions-stochasticlinearregression-notes} + +1. Pour fusionner deux modèles l’utilisateur peut créer une telle requête: + `sql SELECT state1 + state2 FROM your_models` + où `your_models` le tableau contient les deux modèles. Cette requête renvoie la nouvelle `AggregateFunctionState` objet. + +2. L’utilisateur peut récupérer les poids du modèle pour ses propres fins, sans enregistrer le modèle, si aucune `-State` combinator est utilisé. + `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` + Une telle requête s’adaptera au Modèle et retournera ses poids-d’abord sont des poids, qui correspondent aux paramètres du modèle, le dernier est un biais. Ainsi, dans l’exemple ci-dessus, la requête renvoie une colonne avec 3 valeurs. + +**Voir Aussi** + +- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) +- [Différence entre les régressions linéaires et logistiques](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} + +Cette fonction implémente la régression logistique stochastique. Il peut être utilisé pour le problème de classification binaire, prend en charge les mêmes paramètres personnalisés que stochasticLinearRegression et fonctionne de la même manière. + +### Paramètre {#agg_functions-stochasticlogisticregression-parameters} + +Les paramètres sont exactement les mêmes que dans stochasticLinearRegression: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +Pour plus d’informations, voir [paramètre](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. Raccord + + + + See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. + + Predicted labels have to be in \[-1, 1\]. + +1. Prédire + + + + Using saved state we can predict probability of object having label `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + + The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + + We can also set a bound of probability, which assigns elements to different labels. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + + Then the result will be labels. + + `test_data` is a table like `train_data` but may not contain target value. + +**Voir Aussi** + +- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) +- [Différence entre les régressions linéaires et logistiques.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## groupBitmapAnd {#groupbitmapand} + +Calculs le et d’une colonne bitmap, retour cardinalité de type UInt64, si Ajouter suffixe-État, puis retour [objet bitmap](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapAnd(expr) +``` + +**Paramètre** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. + +**Valeur de retour** + +La valeur de la `UInt64` type. + +**Exemple** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapAnd(z)─┐ +│ 3 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ +│ [6,8,10] │ +└──────────────────────────────────────────────────┘ +``` + +## groupBitmapOr {#groupbitmapor} + +Calculs le ou d’une colonne bitmap, retour cardinalité de type UInt64, si Ajouter suffixe-État, puis retour [objet bitmap](../../sql-reference/functions/bitmap-functions.md). C’est l’équivalent de `groupBitmapMerge`. + +``` sql +groupBitmapOr(expr) +``` + +**Paramètre** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. + +**Valeur de retour** + +La valeur de la `UInt64` type. + +**Exemple** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapOr(z)─┐ +│ 15 │ +└──────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ +│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ +└─────────────────────────────────────────────────┘ +``` + +## groupBitmapXor {#groupbitmapxor} + +Calculs le XOR d’une colonne bitmap, retour cardinalité de type UInt64, si Ajouter suffixe-État, puis retour [objet bitmap](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapOr(expr) +``` + +**Paramètre** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. + +**Valeur de retour** + +La valeur de la `UInt64` type. + +**Exemple** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapXor(z)─┐ +│ 10 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ +│ [1,3,5,6,8,10,11,13,14,15] │ +└──────────────────────────────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/fr/sql-reference/ansi.md b/docs/fr/sql-reference/ansi.md new file mode 120000 index 00000000000..3cf6bffed67 --- /dev/null +++ b/docs/fr/sql-reference/ansi.md @@ -0,0 +1 @@ +../../en/sql-reference/ansi.md \ No newline at end of file diff --git a/docs/fr/sql-reference/data-types/aggregatefunction.md b/docs/fr/sql-reference/data-types/aggregatefunction.md new file mode 100644 index 00000000000..0ec4c75a619 --- /dev/null +++ b/docs/fr/sql-reference/data-types/aggregatefunction.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 52 +toc_title: AggregateFunction (nom, types_of_arguments...) +--- + +# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [une vue matérialisée](../../sql-reference/statements/select.md#create-view). La manière courante de produire un État de fonction d’agrégat est d’appeler la fonction d’agrégat avec le `-State` suffixe. Pour obtenir le résultat final de l’agrégation dans l’avenir, vous devez utiliser la même fonction d’agrégation avec la `-Merge`suffixe. + +`AggregateFunction` — parametric data type. + +**Paramètre** + +- Nom de la fonction d’agrégation. + + If the function is parametric, specify its parameters too. + +- Types des arguments de la fonction d’agrégation. + +**Exemple** + +``` sql +CREATE TABLE t +( + column1 AggregateFunction(uniq, UInt64), + column2 AggregateFunction(anyIf, String, UInt8), + column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) +) ENGINE = ... +``` + +[uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq), anyIf ([tout](../../sql-reference/aggregate-functions/reference.md#agg_function-any)+[Si](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-if)) et [les quantiles](../../sql-reference/aggregate-functions/reference.md) les fonctions d’agrégation sont-elles prises en charge dans ClickHouse. + +## Utilisation {#usage} + +### Insertion De Données {#data-insertion} + +Pour insérer des données, utilisez `INSERT SELECT` avec le regroupement d’ `-State`- fonction. + +**Exemples de fonction** + +``` sql +uniqState(UserID) +quantilesState(0.5, 0.9)(SendTiming) +``` + +Contrairement aux fonctions correspondantes `uniq` et `quantiles`, `-State`- les fonctions renvoient l’état, au lieu de la valeur finale. En d’autres termes, ils renvoient une valeur de `AggregateFunction` type. + +Dans les résultats de `SELECT` requête, les valeurs de `AggregateFunction` type ont une représentation binaire spécifique à l’implémentation pour tous les formats de sortie ClickHouse. Si les données de vidage dans, par exemple, `TabSeparated` format avec `SELECT` requête, puis ce vidage peut être chargé en utilisant `INSERT` requête. + +### Sélection De Données {#data-selection} + +Lors de la sélection des données `AggregatingMergeTree` table, utilisez `GROUP BY` et les mêmes fonctions d’agrégat que lors de l’insertion de données, mais en utilisant `-Merge`suffixe. + +Une fonction d’agrégation avec `-Merge` suffixe prend un ensemble d’états, les combine, et renvoie le résultat complet de l’agrégation de données. + +Par exemple, les deux requêtes suivantes retournent le même résultat: + +``` sql +SELECT uniq(UserID) FROM table + +SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) +``` + +## Exemple D’Utilisation {#usage-example} + +Voir [AggregatingMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) Description du moteur. + +[Article Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/fr/sql-reference/data-types/array.md b/docs/fr/sql-reference/data-types/array.md new file mode 100644 index 00000000000..03138201763 --- /dev/null +++ b/docs/fr/sql-reference/data-types/array.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 51 +toc_title: Array(T) +--- + +# Array(t) {#data-type-array} + +Un tableau de `T`les éléments de type. `T` peut être n’importe quel type de données, y compris un tableau. + +## La création d’un Tableau {#creating-an-array} + +Vous pouvez utiliser une fonction pour créer un tableau: + +``` sql +array(T) +``` + +Vous pouvez également utiliser des crochets. + +``` sql +[] +``` + +Exemple de création d’un tableau: + +``` sql +SELECT array(1, 2) AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName(array(1, 2))─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴─────────────────────────┘ +``` + +``` sql +SELECT [1, 2] AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName([1, 2])─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴────────────────────┘ +``` + +## Utilisation De Types De Données {#working-with-data-types} + +Lors de la création d’un tableau à la volée, ClickHouse définit automatiquement le type d’argument comme le type de données le plus étroit pouvant stocker tous les arguments listés. S’il y a des [Nullable](nullable.md#data_type-nullable) ou littéral [NULL](../../sql-reference/syntax.md#null-literal) les valeurs, le type d’un élément de tableau devient également [Nullable](nullable.md). + +Si ClickHouse n’a pas pu déterminer le type de données, il génère une exception. Par exemple, cela se produit lorsque vous essayez de créer un tableau avec des chaînes et des nombres simultanément (`SELECT array(1, 'a')`). + +Exemples de détection automatique de type de données: + +``` sql +SELECT array(1, 2, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ +│ [1,2,NULL] │ Array(Nullable(UInt8)) │ +└────────────┴───────────────────────────────┘ +``` + +Si vous essayez de créer un tableau de types de données incompatibles, ClickHouse lève une exception: + +``` sql +SELECT array(1, 'a') +``` + +``` text +Received exception from server (version 1.1.54388): +Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. +``` + +[Article Original](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/fr/sql-reference/data-types/boolean.md b/docs/fr/sql-reference/data-types/boolean.md new file mode 100644 index 00000000000..450c738d8ef --- /dev/null +++ b/docs/fr/sql-reference/data-types/boolean.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 43 +toc_title: "Bool\xE9en" +--- + +# Les Valeurs Booléennes {#boolean-values} + +Il n’y a pas de type distinct pour les valeurs booléennes. Utilisez le type UInt8, limité aux valeurs 0 ou 1. + +[Article Original](https://clickhouse.tech/docs/en/data_types/boolean/) diff --git a/docs/fr/sql-reference/data-types/date.md b/docs/fr/sql-reference/data-types/date.md new file mode 100644 index 00000000000..bb8eef199d0 --- /dev/null +++ b/docs/fr/sql-reference/data-types/date.md @@ -0,0 +1,15 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 47 +toc_title: Date +--- + +# Date {#date} + +Date. Stocké en deux octets comme le nombre de jours depuis 1970-01-01 (non signé). Permet de stocker des valeurs juste après le début de L’époque Unix jusqu’au seuil supérieur défini par une constante au stade de la compilation (actuellement, c’est jusqu’à l’année 2106, mais l’année finale entièrement prise en charge est 2105). +La valeur minimale est sortie comme 0000-00-00. + +La valeur de date est stockée sans le fuseau horaire. + +[Article Original](https://clickhouse.tech/docs/en/data_types/date/) diff --git a/docs/fr/sql-reference/data-types/datetime.md b/docs/fr/sql-reference/data-types/datetime.md new file mode 100644 index 00000000000..6e71907978d --- /dev/null +++ b/docs/fr/sql-reference/data-types/datetime.md @@ -0,0 +1,129 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 48 +toc_title: DateTime +--- + +# Datetime {#data_type-datetime} + +Permet de stocker un instant dans le temps, qui peut être exprimé comme une date de calendrier et une heure d’une journée. + +Syntaxe: + +``` sql +DateTime([timezone]) +``` + +Plage de valeurs prise en charge: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. + +Résolution: 1 seconde. + +## Utilisation Remarques {#usage-remarks} + +Le point dans le temps est enregistré en tant que [Le timestamp Unix](https://en.wikipedia.org/wiki/Unix_time), quel que soit le fuseau horaire ou l’heure d’été. En outre, l’ `DateTime` type peut stocker le fuseau horaire qui est le même pour la colonne entière, qui affecte la façon dont les valeurs de la `DateTime` les valeurs de type sont affichées au format texte et comment les valeurs spécifiées en tant que chaînes sont analysées (‘2020-01-01 05:00:01’). Le fuseau horaire n’est pas stocké dans les lignes de la table (ou dans resultset), mais est stocké dans les métadonnées de la colonne. +Une liste des fuseaux horaires pris en charge peut être trouvée dans le [Base de données de fuseau horaire IANA](https://www.iana.org/time-zones). +Le `tzdata` paquet, contenant [Base de données de fuseau horaire IANA](https://www.iana.org/time-zones), doit être installé dans le système. L’utilisation de la `timedatectl list-timezones` commande pour lister les fuseaux horaires connus par un système local. + +Vous pouvez définir explicitement un fuseau horaire `DateTime`- tapez des colonnes lors de la création d’une table. Si le fuseau horaire n’est pas défini, ClickHouse utilise la valeur [fuseau](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) paramètre dans les paramètres du serveur ou les paramètres du système d’exploitation au moment du démarrage du serveur ClickHouse. + +Le [clickhouse-client](../../interfaces/cli.md) applique le fuseau horaire du serveur par défaut si un fuseau horaire n’est pas explicitement défini lors de l’initialisation du type de données. Pour utiliser le fuseau horaire du client, exécutez `clickhouse-client` avec l’ `--use_client_time_zone` paramètre. + +Clickhouse affiche les valeurs dans `YYYY-MM-DD hh:mm:ss` format de texte par défaut. Vous pouvez modifier la sortie avec le [formatDateTime](../../sql-reference/functions/date-time-functions.md#formatdatetime) fonction. + +Lorsque vous insérez des données dans ClickHouse, vous pouvez utiliser différents formats de chaînes de date et d’heure, en fonction de la valeur du [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) paramètre. + +## Exemple {#examples} + +**1.** Création d’une table avec un `DateTime`- tapez la colonne et insérez des données dedans: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime('Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog; +``` + +``` sql +INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); +``` + +``` sql +SELECT * FROM dt; +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +- Lors de l’insertion de datetime en tant qu’entier, il est traité comme un horodatage Unix (UTC). `1546300800` représenter `'2019-01-01 00:00:00'` L’UTC. Cependant, comme `timestamp` la colonne a `Europe/Moscow` (UTC+3) fuseau horaire spécifié, lors de la sortie en tant que chaîne, la valeur sera affichée comme `'2019-01-01 03:00:00'` +- Lors de l’insertion d’une valeur de chaîne en tant que datetime, elle est traitée comme étant dans le fuseau horaire de la colonne. `'2019-01-01 00:00:00'` sera considérée comme étant en `Europe/Moscow` fuseau horaire et enregistré sous `1546290000`. + +**2.** Le filtrage sur `DateTime` valeur + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +`DateTime` les valeurs de colonne peuvent être filtrées à l’aide d’une `WHERE` prédicat. Elle sera convertie `DateTime` automatiquement: + +``` sql +SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +└─────────────────────┴──────────┘ +``` + +**3.** Obtenir un fuseau horaire pour un `DateTime`colonne de type: + +``` sql +SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────column─┬─x─────────────────────────┐ +│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ +└─────────────────────┴───────────────────────────┘ +``` + +**4.** Conversion de fuseau horaire + +``` sql +SELECT +toDateTime(timestamp, 'Europe/London') as lon_time, +toDateTime(timestamp, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────lon_time──┬────────────mos_time─┐ +│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ +│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ +└─────────────────────┴─────────────────────┘ +``` + +## Voir Aussi {#see-also} + +- [Fonctions de conversion de Type](../../sql-reference/functions/type-conversion-functions.md) +- [Fonctions pour travailler avec des dates et des heures](../../sql-reference/functions/date-time-functions.md) +- [Fonctions pour travailler avec des tableaux](../../sql-reference/functions/array-functions.md) +- [Le `date_time_input_format` paramètre](../../operations/settings/settings.md#settings-date_time_input_format) +- [Le `timezone` paramètre de configuration du serveur](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [Opérateurs pour travailler avec des dates et des heures](../../sql-reference/operators.md#operators-datetime) +- [Le `Date` type de données](date.md) + +[Article Original](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/fr/sql-reference/data-types/datetime64.md b/docs/fr/sql-reference/data-types/datetime64.md new file mode 100644 index 00000000000..3df52a1866e --- /dev/null +++ b/docs/fr/sql-reference/data-types/datetime64.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 49 +toc_title: DateTime64 +--- + +# Datetime64 {#data_type-datetime64} + +Permet de stocker un instant dans le temps, qui peut être exprimé comme une date de calendrier et une heure d’un jour, avec une précision de sous-seconde définie + +Tick taille (précision): 10-précision deuxième + +Syntaxe: + +``` sql +DateTime64(precision, [timezone]) +``` + +En interne, stocke les données comme un certain nombre de ‘ticks’ depuis le début de l’époque (1970-01-01 00: 00: 00 UTC) comme Int64. La résolution des tiques est déterminée par le paramètre de précision. En outre, l’ `DateTime64` type peut stocker le fuseau horaire qui est le même pour la colonne entière, qui affecte la façon dont les valeurs de la `DateTime64` les valeurs de type sont affichées au format texte et comment les valeurs spécifiées en tant que chaînes sont analysées (‘2020-01-01 05:00:01.000’). Le fuseau horaire n’est pas stocké dans les lignes de la table (ou dans resultset), mais est stocké dans les métadonnées de la colonne. Voir les détails dans [DateTime](datetime.md). + +## Exemple {#examples} + +**1.** Création d’une table avec `DateTime64`- tapez la colonne et insérez des données dedans: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime64(3, 'Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog +``` + +``` sql +INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) +``` + +``` sql +SELECT * FROM dt +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00.000 │ 1 │ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +- Lors de l’insertion de datetime en tant qu’entier, il est traité comme un horodatage Unix (UTC) mis à l’échelle de manière appropriée. `1546300800000` (avec précision 3) représente `'2019-01-01 00:00:00'` L’UTC. Cependant, comme `timestamp` la colonne a `Europe/Moscow` (UTC+3) fuseau horaire spécifié, lors de la sortie sous forme de chaîne, la valeur sera affichée comme `'2019-01-01 03:00:00'` +- Lors de l’insertion d’une valeur de chaîne en tant que datetime, elle est traitée comme étant dans le fuseau horaire de la colonne. `'2019-01-01 00:00:00'` sera considérée comme étant en `Europe/Moscow` fuseau horaire et stocké comme `1546290000000`. + +**2.** Le filtrage sur `DateTime64` valeur + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +Contrairement `DateTime`, `DateTime64` les valeurs ne sont pas converties depuis `String` automatiquement + +**3.** Obtenir un fuseau horaire pour un `DateTime64`-le type de la valeur: + +``` sql +SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────────column─┬─x──────────────────────────────┐ +│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ +└─────────────────────────┴────────────────────────────────┘ +``` + +**4.** Conversion de fuseau horaire + +``` sql +SELECT +toDateTime64(timestamp, 3, 'Europe/London') as lon_time, +toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────────lon_time──┬────────────────mos_time─┐ +│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ +│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ +└─────────────────────────┴─────────────────────────┘ +``` + +## Voir Aussi {#see-also} + +- [Fonctions de conversion de Type](../../sql-reference/functions/type-conversion-functions.md) +- [Fonctions pour travailler avec des dates et des heures](../../sql-reference/functions/date-time-functions.md) +- [Fonctions pour travailler avec des tableaux](../../sql-reference/functions/array-functions.md) +- [Le `date_time_input_format` paramètre](../../operations/settings/settings.md#settings-date_time_input_format) +- [Le `timezone` paramètre de configuration du serveur](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [Opérateurs pour travailler avec des dates et des heures](../../sql-reference/operators.md#operators-datetime) +- [`Date` type de données](date.md) +- [`DateTime` type de données](datetime.md) diff --git a/docs/fr/sql-reference/data-types/decimal.md b/docs/fr/sql-reference/data-types/decimal.md new file mode 100644 index 00000000000..2881892f53a --- /dev/null +++ b/docs/fr/sql-reference/data-types/decimal.md @@ -0,0 +1,109 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 42 +toc_title: "D\xE9cimal" +--- + +# Décimal (P, S), Décimal32 (S), Décimal64 (S), Décimal128 (S) {#decimalp-s-decimal32s-decimal64s-decimal128s} + +Nombres à points fixes signés qui conservent la précision pendant les opérations d’addition, de soustraction et de multiplication. Pour la division, les chiffres les moins significatifs sont ignorés (non arrondis). + +## Paramètre {#parameters} + +- P-précision. Plage valide: \[1: 38 \]. Détermine le nombre de chiffres décimaux nombre peut avoir (fraction y compris). +- S - échelle. Plage valide: \[0: P \]. Détermine le nombre de chiffres décimaux fraction peut avoir. + +En fonction de P Paramètre Valeur décimal (P, S) est un synonyme de: +- P à partir de \[ 1: 9\] - Pour Décimal32 (S) +- P à partir de \[10: 18\] - pour Décimal64 (S) +- P à partir de \[19: 38\] - pour Décimal128 (S) + +## Plages De Valeurs décimales {#decimal-value-ranges} + +- Décimal32 (S) - ( -1 \* 10^(9 - S), 1 \* 10^(9-S) ) +- Décimal64 (S) - ( -1 \* 10^(18 - S), 1 \* 10^(18-S) ) +- Décimal128 (S) - ( -1 \* 10^(38 - S), 1 \* 10^(38-S) ) + +Par exemple, Decimal32(4) peut contenir des nombres de -99999.9999 à 99999.9999 avec 0,0001 étape. + +## Représentation Interne {#internal-representation} + +En interne, les données sont représentées comme des entiers signés normaux avec une largeur de bit respective. Les plages de valeurs réelles qui peuvent être stockées en mémoire sont un peu plus grandes que celles spécifiées ci-dessus, qui sont vérifiées uniquement lors de la conversion à partir d’une chaîne. + +Parce que les processeurs modernes ne prennent pas en charge les entiers 128 bits nativement, les opérations sur Decimal128 sont émulées. Pour cette raison, Decimal128 fonctionne significativement plus lentement que Decimal32 / Decimal64. + +## Opérations Et Type De résultat {#operations-and-result-type} + +Les opérations binaires sur le résultat décimal dans le type de résultat plus large (avec n’importe quel ordre d’arguments). + +- Décimal64 (S1) Decimal32 (S2) - \> Decimal64 (S) +- Décimal128 (S1) Decimal32 (S2) - \> Decimal128 (S) +- Décimal128 (S1) Decimal64 (S2) - \> Decimal128 (S) + +Règles pour l’échelle: + +- ajouter, soustraire: S = max (S1, S2). +- multuply: S = S1 + S2. +- diviser: S = S1. + +Pour des opérations similaires entre décimal et entier, le résultat est Décimal de la même taille qu’un argument. + +Les opérations entre Decimal et Float32 / Float64 ne sont pas définies. Si vous en avez besoin, vous pouvez explicitement lancer l’un des arguments en utilisant les builtins toDecimal32, toDecimal64, toDecimal128 ou toFloat32, toFloat64. Gardez à l’esprit que le résultat perdra de la précision et que la conversion de type est une opération coûteuse en calcul. + +Certaines fonctions sur le résultat de retour décimal comme Float64 (par exemple, var ou stddev). Les calculs intermédiaires peuvent toujours être effectués en décimal, ce qui peut conduire à des résultats différents entre les entrées Float64 et Decimal avec les mêmes valeurs. + +## Contrôles De débordement {#overflow-checks} + +Pendant les calculs sur Décimal, des débordements entiers peuvent se produire. Les chiffres excessifs dans une fraction sont éliminés (non arrondis). Les chiffres excessifs dans la partie entière conduiront à une exception. + +``` sql +SELECT toDecimal32(2, 4) AS x, x / 3 +``` + +``` text +┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ +│ 2.0000 │ 0.6666 │ +└────────┴──────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32(4.2, 8) AS x, x * x +``` + +``` text +DB::Exception: Scale is out of bounds. +``` + +``` sql +SELECT toDecimal32(4.2, 8) AS x, 6 * x +``` + +``` text +DB::Exception: Decimal math overflow. +``` + +Les contrôles de débordement entraînent un ralentissement des opérations. S’il est connu que les débordements ne sont pas possibles, il est logique de désactiver les contrôles en utilisant `decimal_check_overflow` paramètre. Lorsque des contrôles sont désactivés et le débordement se produit, le résultat sera faux: + +``` sql +SET decimal_check_overflow = 0; +SELECT toDecimal32(4.2, 8) AS x, 6 * x +``` + +``` text +┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ +│ 4.20000000 │ -17.74967296 │ +└────────────┴──────────────────────────────────┘ +``` + +Les contrôles de débordement se produisent non seulement sur les opérations arithmétiques mais aussi sur la comparaison de valeurs: + +``` sql +SELECT toDecimal32(1, 8) < 100 +``` + +``` text +DB::Exception: Can't compare. +``` + +[Article Original](https://clickhouse.tech/docs/en/data_types/decimal/) diff --git a/docs/fr/sql_reference/data_types/domains/index.md b/docs/fr/sql-reference/data-types/domains/index.md similarity index 100% rename from docs/fr/sql_reference/data_types/domains/index.md rename to docs/fr/sql-reference/data-types/domains/index.md diff --git a/docs/fr/sql-reference/data-types/domains/ipv4.md b/docs/fr/sql-reference/data-types/domains/ipv4.md new file mode 100644 index 00000000000..baa0cdd12c9 --- /dev/null +++ b/docs/fr/sql-reference/data-types/domains/ipv4.md @@ -0,0 +1,84 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 59 +toc_title: IPv4 +--- + +## IPv4 {#ipv4} + +`IPv4` est un domaine basé sur `UInt32` tapez et sert de remplacement typé pour stocker des valeurs IPv4. Il fournit un stockage compact avec le format d’entrée-sortie convivial et les informations de type de colonne sur l’inspection. + +### Utilisation De Base {#basic-usage} + +``` sql +CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY url; + +DESCRIBE TABLE hits; +``` + +``` text +┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ +│ url │ String │ │ │ │ │ +│ from │ IPv4 │ │ │ │ │ +└──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ +``` + +Ou vous pouvez utiliser le domaine IPv4 comme clé: + +``` sql +CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY from; +``` + +`IPv4` le domaine prend en charge le format d’entrée personnalisé en tant que chaînes IPv4: + +``` sql +INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '116.253.40.133')('https://clickhouse.tech', '183.247.232.58')('https://clickhouse.yandex/docs/en/', '116.106.34.242'); + +SELECT * FROM hits; +``` + +``` text +┌─url────────────────────────────────┬───────────from─┐ +│ https://clickhouse.tech/docs/en/ │ 116.106.34.242 │ +│ https://wikipedia.org │ 116.253.40.133 │ +│ https://clickhouse.tech │ 183.247.232.58 │ +└────────────────────────────────────┴────────────────┘ +``` + +Les valeurs sont stockées sous forme binaire compacte: + +``` sql +SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; +``` + +``` text +┌─toTypeName(from)─┬─hex(from)─┐ +│ IPv4 │ B7F7E83A │ +└──────────────────┴───────────┘ +``` + +Les valeurs de domaine ne sont pas implicitement convertibles en types autres que `UInt32`. +Si vous voulez convertir `IPv4` valeur à une chaîne, vous devez le faire explicitement avec `IPv4NumToString()` fonction: + +``` sql +SELECT toTypeName(s), IPv4NumToString(from) as s FROM hits LIMIT 1; +``` + + ┌─toTypeName(IPv4NumToString(from))─┬─s──────────────┐ + │ String │ 183.247.232.58 │ + └───────────────────────────────────┴────────────────┘ + +Ou coulé à un `UInt32` valeur: + +``` sql +SELECT toTypeName(i), CAST(from as UInt32) as i FROM hits LIMIT 1; +``` + +``` text +┌─toTypeName(CAST(from, 'UInt32'))─┬──────────i─┐ +│ UInt32 │ 3086477370 │ +└──────────────────────────────────┴────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/data_types/domains/ipv4) diff --git a/docs/fr/sql-reference/data-types/domains/ipv6.md b/docs/fr/sql-reference/data-types/domains/ipv6.md new file mode 100644 index 00000000000..d8262608757 --- /dev/null +++ b/docs/fr/sql-reference/data-types/domains/ipv6.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 60 +toc_title: IPv6 +--- + +## IPv6 {#ipv6} + +`IPv6` est un domaine basé sur `FixedString(16)` tapez et sert de remplacement typé pour stocker des valeurs IPv6. Il fournit un stockage compact avec le format d’entrée-sortie convivial et les informations de type de colonne sur l’inspection. + +### Utilisation De Base {#basic-usage} + +``` sql +CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY url; + +DESCRIBE TABLE hits; +``` + +``` text +┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ +│ url │ String │ │ │ │ │ +│ from │ IPv6 │ │ │ │ │ +└──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ +``` + +Ou vous pouvez utiliser `IPv6` domaine comme l’un des principaux: + +``` sql +CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY from; +``` + +`IPv6` le domaine prend en charge l’entrée personnalisée en tant que chaînes IPv6: + +``` sql +INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '2a02:aa08:e000:3100::2')('https://clickhouse.tech', '2001:44c8:129:2632:33:0:252:2')('https://clickhouse.yandex/docs/en/', '2a02:e980:1e::1'); + +SELECT * FROM hits; +``` + +``` text +┌─url────────────────────────────────┬─from──────────────────────────┐ +│ https://clickhouse.tech │ 2001:44c8:129:2632:33:0:252:2 │ +│ https://clickhouse.tech/docs/en/ │ 2a02:e980:1e::1 │ +│ https://wikipedia.org │ 2a02:aa08:e000:3100::2 │ +└────────────────────────────────────┴───────────────────────────────┘ +``` + +Les valeurs sont stockées sous forme binaire compacte: + +``` sql +SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; +``` + +``` text +┌─toTypeName(from)─┬─hex(from)────────────────────────┐ +│ IPv6 │ 200144C8012926320033000002520002 │ +└──────────────────┴──────────────────────────────────┘ +``` + +Les valeurs de domaine ne sont pas implicitement convertibles en types autres que `FixedString(16)`. +Si vous voulez convertir `IPv6` valeur à une chaîne, vous devez le faire explicitement avec `IPv6NumToString()` fonction: + +``` sql +SELECT toTypeName(s), IPv6NumToString(from) as s FROM hits LIMIT 1; +``` + +``` text +┌─toTypeName(IPv6NumToString(from))─┬─s─────────────────────────────┐ +│ String │ 2001:44c8:129:2632:33:0:252:2 │ +└───────────────────────────────────┴───────────────────────────────┘ +``` + +Ou coulé à un `FixedString(16)` valeur: + +``` sql +SELECT toTypeName(i), CAST(from as FixedString(16)) as i FROM hits LIMIT 1; +``` + +``` text +┌─toTypeName(CAST(from, 'FixedString(16)'))─┬─i───────┐ +│ FixedString(16) │ ��� │ +└───────────────────────────────────────────┴─────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/data_types/domains/ipv6) diff --git a/docs/fr/sql-reference/data-types/domains/overview.md b/docs/fr/sql-reference/data-types/domains/overview.md new file mode 100644 index 00000000000..390a0f5b34e --- /dev/null +++ b/docs/fr/sql-reference/data-types/domains/overview.md @@ -0,0 +1,32 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 58 +toc_title: "Aper\xE7u" +--- + +# Domaine {#domains} + +Les domaines sont des types spéciaux qui ajoutent des fonctionnalités supplémentaires au sommet du type de base existant, mais en laissant le format on-wire et on-disc du type de données sous-jacent intact. À l’heure actuelle, ClickHouse ne prend pas en charge les domaines définis par l’utilisateur. + +Vous pouvez utiliser des domaines partout type de base correspondant peut être utilisé, par exemple: + +- Créer une colonne d’un type de domaine +- Valeurs de lecture / écriture depuis / vers la colonne de domaine +- L’utiliser comme un indice si un type de base peut être utilisée comme un indice +- Fonctions d’appel avec des valeurs de colonne de domaine + +### Fonctionnalités supplémentaires Des Domaines {#extra-features-of-domains} + +- Nom de type de colonne explicite dans `SHOW CREATE TABLE` ou `DESCRIBE TABLE` +- Entrée du format convivial avec `INSERT INTO domain_table(domain_column) VALUES(...)` +- Sortie au format convivial pour `SELECT domain_column FROM domain_table` +- Chargement de données à partir d’une source externe dans un format convivial: `INSERT INTO domain_table FORMAT CSV ...` + +### Limitation {#limitations} + +- Impossible de convertir la colonne d’index du type de base en type de domaine via `ALTER TABLE`. +- Impossible de convertir implicitement des valeurs de chaîne en valeurs de domaine lors de l’insertion de données d’une autre colonne ou table. +- Le domaine n’ajoute aucune contrainte sur les valeurs stockées. + +[Article Original](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/fr/sql-reference/data-types/enum.md b/docs/fr/sql-reference/data-types/enum.md new file mode 100644 index 00000000000..1fa2cff6268 --- /dev/null +++ b/docs/fr/sql-reference/data-types/enum.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 50 +toc_title: Enum +--- + +# Enum {#enum} + +Type énuméré composé de valeurs nommées. + +Les valeurs nommées doivent être déclarées comme `'string' = integer` pair. ClickHouse ne stocke que des nombres, mais prend en charge les opérations avec les valeurs à travers leurs noms. + +Supports ClickHouse: + +- 8-bit `Enum`. Il peut contenir jusqu’à 256 valeurs énumérées dans le `[-128, 127]` gamme. +- 16 bits `Enum`. Il peut contenir jusqu’à 65 536 valeurs énumérées dans le `[-32768, 32767]` gamme. + +Clickhouse choisit automatiquement le type de `Enum` lorsque les données sont insérées. Vous pouvez également utiliser `Enum8` ou `Enum16` types pour être sûr de la taille de stockage. + +## Exemples D’Utilisation {#usage-examples} + +Ici, nous créons une table avec une `Enum8('hello' = 1, 'world' = 2)` type de colonne: + +``` sql +CREATE TABLE t_enum +( + x Enum('hello' = 1, 'world' = 2) +) +ENGINE = TinyLog +``` + +Colonne `x` ne peut stocker que les valeurs répertoriées dans la définition de type: `'hello'` ou `'world'`. Si vous essayez d’enregistrer une autre valeur, ClickHouse déclenchera une exception. Taille 8 bits pour cela `Enum` est choisi automatiquement. + +``` sql +INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') +``` + +``` text +Ok. +``` + +``` sql +INSERT INTO t_enum values('a') +``` + +``` text +Exception on client: +Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) +``` + +Lorsque vous interrogez des données de la table, ClickHouse affiche les valeurs de chaîne de `Enum`. + +``` sql +SELECT * FROM t_enum +``` + +``` text +┌─x─────┐ +│ hello │ +│ world │ +│ hello │ +└───────┘ +``` + +Si vous avez besoin de voir les équivalents numériques des lignes, vous devez `Enum` valeur en type entier. + +``` sql +SELECT CAST(x, 'Int8') FROM t_enum +``` + +``` text +┌─CAST(x, 'Int8')─┐ +│ 1 │ +│ 2 │ +│ 1 │ +└─────────────────┘ +``` + +Pour créer une valeur d’Enum dans une requête, vous devez également utiliser `CAST`. + +``` sql +SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) +``` + +``` text +┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ +│ Enum8('a' = 1, 'b' = 2) │ +└─────────────────────────────────────────────────────┘ +``` + +## Règles générales Et Utilisation {#general-rules-and-usage} + +Chacune des valeurs se voit attribuer un nombre dans la plage `-128 ... 127` pour `Enum8` ou dans la gamme `-32768 ... 32767` pour `Enum16`. Toutes les chaînes et les nombres doivent être différents. Une chaîne vide est autorisé. Si ce type est spécifié (dans une définition de table), les nombres peuvent être dans un ordre arbitraire. Toutefois, l’ordre n’a pas d’importance. + +Ni la chaîne ni la valeur numérique dans un `Enum` peut être [NULL](../../sql-reference/syntax.md). + +Un `Enum` peut être contenue dans [Nullable](nullable.md) type. Donc, si vous créez une table en utilisant la requête + +``` sql +CREATE TABLE t_enum_nullable +( + x Nullable( Enum8('hello' = 1, 'world' = 2) ) +) +ENGINE = TinyLog +``` + +il peut stocker non seulement des `'hello'` et `'world'`, mais `NULL`, ainsi. + +``` sql +INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) +``` + +Dans la mémoire RAM, un `Enum` la colonne est stockée dans la même manière que `Int8` ou `Int16` des valeurs numériques correspondantes. + +Lors de la lecture sous forme de texte, ClickHouse analyse la valeur sous forme de chaîne et recherche la chaîne correspondante à partir de l’ensemble des valeurs Enum. Si elle n’est pas trouvée, une exception est levée. Lors de la lecture au format texte, la chaîne est lue et la valeur numérique correspondante est recherchée. Une exception sera levée si il n’est pas trouvé. +Lors de l’écriture sous forme de texte, il écrit la valeur correspondante de la chaîne. Si les données de colonne contiennent des déchets (nombres qui ne proviennent pas de l’ensemble valide), une exception est levée. Lors de la lecture et de l’écriture sous forme binaire, cela fonctionne de la même manière que pour les types de données Int8 et Int16. +La valeur implicite par défaut est la valeur avec le numéro le plus bas. + +Lors `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` et ainsi de suite, les Énumérations se comportent de la même façon que les nombres correspondants. Par exemple, ORDER BY les trie numériquement. Les opérateurs d’égalité et de comparaison fonctionnent de la même manière sur les énumérations que sur les valeurs numériques sous-jacentes. + +Les valeurs Enum ne peuvent pas être comparées aux nombres. Les Enums peuvent être comparés à une chaîne constante. Si la chaîne comparée à n’est pas une valeur valide pour L’énumération, une exception sera levée. L’opérateur est pris en charge avec l’Enum sur le côté gauche, et un ensemble de chaînes sur le côté droit. Les chaînes sont les valeurs de L’énumération correspondante. + +Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. +Cependant, L’énumération a un naturel `toString` fonction qui renvoie sa valeur de chaîne. + +Les valeurs Enum sont également convertibles en types numériques en utilisant `toT` fonction, où T est un type numérique. Lorsque T correspond au type numérique sous-jacent de l’énumération, cette conversion est à coût nul. +Le type Enum peut être modifié sans coût en utilisant ALTER, si seulement l’ensemble des valeurs est modifié. Il est possible d’ajouter et de supprimer des membres de L’énumération en utilisant ALTER (la suppression n’est sûre que si la valeur supprimée n’a jamais été utilisée dans la table). À titre de sauvegarde, la modification de la valeur numérique d’un membre Enum précédemment défini lancera une exception. + +En utilisant ALTER, il est possible de changer un Enum8 en Enum16 ou vice versa, tout comme changer un Int8 en Int16. + +[Article Original](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/fr/sql-reference/data-types/fixedstring.md b/docs/fr/sql-reference/data-types/fixedstring.md new file mode 100644 index 00000000000..c146bfab421 --- /dev/null +++ b/docs/fr/sql-reference/data-types/fixedstring.md @@ -0,0 +1,63 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 45 +toc_title: FixedString (N) +--- + +# Fixedstring {#fixedstring} + +Une chaîne de longueur fixe de `N` octets (ni caractères ni points de code). + +Pour déclarer une colonne de `FixedString` tapez, utilisez la syntaxe suivante: + +``` sql + FixedString(N) +``` + +Où `N` est un nombre naturel. + +Le `FixedString` type est efficace lorsque les données ont la longueur de précisément `N` octet. Dans tous les autres cas, il est susceptible de réduire l’efficacité. + +Exemples de valeurs qui peuvent être stockées efficacement dans `FixedString`-tapé colonnes: + +- La représentation binaire des adresses IP (`FixedString(16)` pour IPv6). +- Language codes (ru\_RU, en\_US … ). +- Currency codes (USD, RUB … ). +- Représentation binaire des hachages (`FixedString(16)` pour MD5, `FixedString(32)` pour SHA256). + +Pour stocker les valeurs UUID, utilisez [UUID](uuid.md) type de données. + +Lors de l’insertion des données, ClickHouse: + +- Complète une chaîne avec des octets null si la chaîne contient moins de `N` octet. +- Jette le `Too large value for FixedString(N)` exception si la chaîne contient plus de `N` octet. + +Lors de la sélection des données, ClickHouse ne supprime pas les octets nuls à la fin de la chaîne. Si vous utilisez le `WHERE` clause, vous devez ajouter des octets null manuellement pour `FixedString` valeur. L’exemple suivant illustre l’utilisation de l’ `WHERE` la clause de `FixedString`. + +Considérons le tableau suivant avec le seul `FixedString(2)` colonne: + +``` text +┌─name──┐ +│ b │ +└───────┘ +``` + +Requête `SELECT * FROM FixedStringTable WHERE a = 'b'` ne renvoie aucune donnée en conséquence. Nous devrions compléter le modèle de filtre avec des octets nuls. + +``` sql +SELECT * FROM FixedStringTable +WHERE a = 'b\0' +``` + +``` text +┌─a─┐ +│ b │ +└───┘ +``` + +Ce comportement diffère de MySQL pour le `CHAR` type (où les chaînes sont remplies d’espaces et les espaces sont supprimés pour la sortie). + +À noter que la longueur de la `FixedString(N)` la valeur est constante. Le [longueur](../../sql-reference/functions/array-functions.md#array_functions-length) la fonction renvoie `N` même si l’ `FixedString(N)` la valeur est remplie uniquement avec des octets [vide](../../sql-reference/functions/string-functions.md#empty) la fonction renvoie `1` dans ce cas. + +[Article Original](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/fr/sql-reference/data-types/float.md b/docs/fr/sql-reference/data-types/float.md new file mode 100644 index 00000000000..096cd421851 --- /dev/null +++ b/docs/fr/sql-reference/data-types/float.md @@ -0,0 +1,87 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 41 +toc_title: Float32, Float64 +--- + +# Float32, Float64 {#float32-float64} + +[Les nombres à virgule flottante](https://en.wikipedia.org/wiki/IEEE_754). + +Les Types sont équivalents aux types de C: + +- `Float32` - `float` +- `Float64` - `double` + +Nous vous recommandons de stocker les données sous forme entière chaque fois que possible. Par exemple, convertissez des nombres de précision fixes en valeurs entières, telles que des montants monétaires ou des temps de chargement de page en millisecondes. + +## Utilisation De Nombres à Virgule Flottante {#using-floating-point-numbers} + +- Calculs avec des nombres à virgule flottante peut produire une erreur d’arrondi. + + + +``` sql +SELECT 1 - 0.9 +``` + +``` text +┌───────minus(1, 0.9)─┐ +│ 0.09999999999999998 │ +└─────────────────────┘ +``` + +- Le résultat du calcul dépend de la méthode de calcul (le type de processeur et de l’architecture du système informatique). +- Les calculs à virgule flottante peuvent entraîner des nombres tels que l’infini (`Inf`) et “not-a-number” (`NaN`). Cela doit être pris en compte lors du traitement des résultats de calculs. +- Lors de l’analyse de nombres à virgule flottante à partir de texte, le résultat peut ne pas être le nombre représentable par machine le plus proche. + +## NaN Et Inf {#data_type-float-nan-inf} + +Contrairement à SQL standard, ClickHouse prend en charge les catégories suivantes de nombres à virgule flottante: + +- `Inf` – Infinity. + + + +``` sql +SELECT 0.5 / 0 +``` + +``` text +┌─divide(0.5, 0)─┐ +│ inf │ +└────────────────┘ +``` + +- `-Inf` – Negative infinity. + + + +``` sql +SELECT -0.5 / 0 +``` + +``` text +┌─divide(-0.5, 0)─┐ +│ -inf │ +└─────────────────┘ +``` + +- `NaN` – Not a number. + + + +``` sql +SELECT 0 / 0 +``` + +``` text +┌─divide(0, 0)─┐ +│ nan │ +└──────────────┘ +``` + + See the rules for `NaN` sorting in the section [ORDER BY clause](../sql_reference/statements/select.md). + +[Article Original](https://clickhouse.tech/docs/en/data_types/float/) diff --git a/docs/fr/sql_reference/data_types/index.md b/docs/fr/sql-reference/data-types/index.md similarity index 100% rename from docs/fr/sql_reference/data_types/index.md rename to docs/fr/sql-reference/data-types/index.md diff --git a/docs/fr/sql_reference/data_types/int_uint.md b/docs/fr/sql-reference/data-types/int-uint.md similarity index 100% rename from docs/fr/sql_reference/data_types/int_uint.md rename to docs/fr/sql-reference/data-types/int-uint.md diff --git a/docs/fr/sql_reference/data_types/nested_data_structures/index.md b/docs/fr/sql-reference/data-types/nested-data-structures/index.md similarity index 100% rename from docs/fr/sql_reference/data_types/nested_data_structures/index.md rename to docs/fr/sql-reference/data-types/nested-data-structures/index.md diff --git a/docs/fr/sql-reference/data-types/nested-data-structures/nested.md b/docs/fr/sql-reference/data-types/nested-data-structures/nested.md new file mode 100644 index 00000000000..516d5113dd5 --- /dev/null +++ b/docs/fr/sql-reference/data-types/nested-data-structures/nested.md @@ -0,0 +1,106 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 57 +toc_title: "Imbriqu\xE9e(Type1 Nom1, Nom2 Type2, ...)" +--- + +# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) requête. Chaque ligne de table peut correspondre à n’importe quel nombre de lignes dans une structure de données imbriquée. + +Exemple: + +``` sql +CREATE TABLE test.visits +( + CounterID UInt32, + StartDate Date, + Sign Int8, + IsNew UInt8, + VisitID UInt64, + UserID UInt64, + ... + Goals Nested + ( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32 + ), + ... +) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) +``` + +Cet exemple déclare le `Goals` structure de données imbriquée, qui contient des données sur les conversions (objectifs atteints). Chaque ligne de la ‘visits’ table peut correspondre à zéro ou n’importe quel nombre de conversions. + +Un seul niveau d’imbrication est pris en charge. Les colonnes de structures imbriquées contenant des tableaux sont équivalentes à des tableaux multidimensionnels, elles ont donc un support limité (il n’y a pas de support pour stocker ces colonnes dans des tables avec le moteur MergeTree). + +Dans la plupart des cas, lorsque vous travaillez avec une structure de données imbriquée, ses colonnes sont spécifiées avec des noms de colonnes séparés par un point. Ces colonnes constituent un tableau de types correspondants. Tous les tableaux de colonnes d’une structure de données imbriquée unique ont la même longueur. + +Exemple: + +``` sql +SELECT + Goals.ID, + Goals.EventTime +FROM test.visits +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ +│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ +│ [1073752] │ ['2014-03-17 00:28:25'] │ +│ [1073752] │ ['2014-03-17 10:46:20'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ +│ [] │ [] │ +│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ +│ [] │ [] │ +│ [] │ [] │ +│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ +└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +Il est plus facile de penser à une structure de données imbriquée comme un ensemble de plusieurs tableaux de colonnes de la même longueur. + +Le seul endroit où une requête SELECT peut spécifier le nom d’une structure de données imbriquée entière au lieu de colonnes individuelles est la clause de jointure de tableau. Pour plus d’informations, voir “ARRAY JOIN clause”. Exemple: + +``` sql +SELECT + Goal.ID, + Goal.EventTime +FROM test.visits +ARRAY JOIN Goals AS Goal +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goal.ID─┬──────Goal.EventTime─┐ +│ 1073752 │ 2014-03-17 16:38:10 │ +│ 591325 │ 2014-03-17 16:38:48 │ +│ 591325 │ 2014-03-17 16:42:27 │ +│ 1073752 │ 2014-03-17 00:28:25 │ +│ 1073752 │ 2014-03-17 10:46:20 │ +│ 1073752 │ 2014-03-17 13:59:20 │ +│ 591325 │ 2014-03-17 22:17:55 │ +│ 591325 │ 2014-03-17 22:18:07 │ +│ 591325 │ 2014-03-17 22:18:51 │ +│ 1073752 │ 2014-03-17 11:37:06 │ +└─────────┴─────────────────────┘ +``` + +Vous ne pouvez pas effectuer SELECT pour une structure de données imbriquée entière. Vous ne pouvez lister explicitement que les colonnes individuelles qui en font partie. + +Pour une requête INSERT, vous devez passer tous les tableaux de colonnes composant d’une structure de données imbriquée séparément (comme s’il s’agissait de tableaux de colonnes individuels). Au cours de l’insertion, le système vérifie qu’ils ont la même longueur. + +Pour une requête DESCRIBE, les colonnes d’une structure de données imbriquée sont répertoriées séparément de la même manière. + +La requête ALTER pour les éléments d’une structure de données imbriquée a des limites. + +[Article Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/fr/sql-reference/data-types/nullable.md b/docs/fr/sql-reference/data-types/nullable.md new file mode 100644 index 00000000000..edf26b1ef35 --- /dev/null +++ b/docs/fr/sql-reference/data-types/nullable.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 54 +toc_title: Nullable +--- + +# Nullable(typename) {#data_type-nullable} + +Permet de stocker marqueur spécial ([NULL](../../sql-reference/syntax.md)) qui dénote “missing value” aux valeurs normales autorisées par `TypeName`. Par exemple, un `Nullable(Int8)` type colonne peut stocker `Int8` type de valeurs, et les lignes qui n’ont pas de valeur magasin `NULL`. + +Pour un `TypeName` vous ne pouvez pas utiliser les types de données composites [Tableau](array.md) et [Tuple](tuple.md). Les types de données composites peuvent contenir `Nullable` valeurs de type, telles que `Array(Nullable(Int8))`. + +A `Nullable` le champ type ne peut pas être inclus dans les index de table. + +`NULL` est la valeur par défaut pour tout `Nullable` type, sauf indication contraire dans la configuration du serveur ClickHouse. + +## Caractéristiques De Stockage {#storage-features} + +Stocker `Nullable` valeurs de type dans une colonne de table, ClickHouse utilise un fichier séparé avec `NULL` masques en plus du fichier normal avec des valeurs. Les entrées du fichier masks permettent à ClickHouse de faire la distinction entre `NULL` et une valeur par défaut du type de données correspondant pour chaque ligne de table. En raison d’un fichier supplémentaire, `Nullable` colonne consomme de l’espace de stockage supplémentaire par rapport à une normale similaire. + +!!! info "Note" + Utiliser `Nullable` affecte presque toujours négativement les performances, gardez cela à l’esprit lors de la conception de vos bases de données. + +## Exemple D’Utilisation {#usage-example} + +``` sql +CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog +``` + +``` sql +INSERT INTO t_null VALUES (1, NULL), (2, 3) +``` + +``` sql +SELECT x + y FROM t_null +``` + +``` text +┌─plus(x, y)─┐ +│ ᴺᵁᴸᴸ │ +│ 5 │ +└────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/fr/sql-reference/data-types/simpleaggregatefunction.md b/docs/fr/sql-reference/data-types/simpleaggregatefunction.md new file mode 120000 index 00000000000..76a7ef3b802 --- /dev/null +++ b/docs/fr/sql-reference/data-types/simpleaggregatefunction.md @@ -0,0 +1 @@ +../../../en/sql-reference/data-types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/fr/sql-reference/data-types/special-data-types/expression.md b/docs/fr/sql-reference/data-types/special-data-types/expression.md new file mode 100644 index 00000000000..e50bbe5c1f4 --- /dev/null +++ b/docs/fr/sql-reference/data-types/special-data-types/expression.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 58 +toc_title: Expression +--- + +# Expression {#expression} + +Les Expressions sont utilisées pour représenter des lambdas dans des fonctions d’ordre Élevé. + +[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/expression/) diff --git a/docs/fr/sql-reference/data-types/special-data-types/index.md b/docs/fr/sql-reference/data-types/special-data-types/index.md new file mode 100644 index 00000000000..682c8584405 --- /dev/null +++ b/docs/fr/sql-reference/data-types/special-data-types/index.md @@ -0,0 +1,14 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Special Data Types +toc_hidden: true +toc_priority: 55 +toc_title: "cach\xE9s" +--- + +# Types De Données Spéciaux {#special-data-types} + +Les valeurs de type de données spéciales ne peuvent pas être sérialisées pour l’enregistrement dans une table ou la sortie dans les résultats de la requête, mais peuvent être utilisées comme résultat intermédiaire lors de l’exécution de la requête. + +[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/) diff --git a/docs/fr/sql-reference/data-types/special-data-types/interval.md b/docs/fr/sql-reference/data-types/special-data-types/interval.md new file mode 100644 index 00000000000..7ae0dacfd32 --- /dev/null +++ b/docs/fr/sql-reference/data-types/special-data-types/interval.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 61 +toc_title: Intervalle +--- + +# Intervalle {#data-type-interval} + +Famille de types de données représentant des intervalles d’heure et de date. Les types de la [INTERVAL](../../../sql-reference/operators.md#operator-interval) opérateur. + +!!! warning "Avertissement" + `Interval` les valeurs de type de données ne peuvent pas être stockées dans les tables. + +Structure: + +- Intervalle de temps en tant que valeur entière non signée. +- Type de l’intervalle. + +Types d’intervalles pris en charge: + +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +Pour chaque type d’intervalle, il existe un type de données distinct. Par exemple, l’ `DAY` l’intervalle correspond au `IntervalDay` type de données: + +``` sql +SELECT toTypeName(INTERVAL 4 DAY) +``` + +``` text +┌─toTypeName(toIntervalDay(4))─┐ +│ IntervalDay │ +└──────────────────────────────┘ +``` + +## Utilisation Remarques {#data-type-interval-usage-remarks} + +Vous pouvez utiliser `Interval`-tapez des valeurs dans des opérations arithmétiques avec [Date](../../../sql-reference/data-types/date.md) et [DateTime](../../../sql-reference/data-types/datetime.md)-type de valeurs. Par exemple, vous pouvez ajouter 4 jours à l’heure actuelle: + +``` sql +SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY +``` + +``` text +┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ +│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ +└─────────────────────┴───────────────────────────────┘ +``` + +Les intervalles avec différents types ne peuvent pas être combinés. Vous ne pouvez pas utiliser des intervalles comme `4 DAY 1 HOUR`. Spécifiez des intervalles en unités inférieures ou égales à la plus petite unité de l’intervalle, par exemple, l’intervalle `1 day and an hour` l’intervalle peut être exprimée comme `25 HOUR` ou `90000 SECOND`. + +Vous ne pouvez pas effectuer d’opérations arithmétiques avec `Interval`- tapez des valeurs, mais vous pouvez ajouter des intervalles de différents types par conséquent aux valeurs dans `Date` ou `DateTime` types de données. Exemple: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +La requête suivante provoque une exception: + +``` sql +select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) +``` + +``` text +Received exception from server (version 19.14.1): +Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. +``` + +## Voir Aussi {#see-also} + +- [INTERVAL](../../../sql-reference/operators.md#operator-interval) opérateur +- [toInterval](../../../sql-reference/functions/type-conversion-functions.md#function-tointerval) type fonctions de conversion diff --git a/docs/fr/sql-reference/data-types/special-data-types/nothing.md b/docs/fr/sql-reference/data-types/special-data-types/nothing.md new file mode 100644 index 00000000000..047e2163b47 --- /dev/null +++ b/docs/fr/sql-reference/data-types/special-data-types/nothing.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 60 +toc_title: Rien +--- + +# Rien {#nothing} + +Le seul but de ce type de données est de représenter les cas où une valeur n’est pas prévu. Donc vous ne pouvez pas créer un `Nothing` type de valeur. + +Par exemple, littéral [NULL](../../../sql-reference/syntax.md#null-literal) a type de `Nullable(Nothing)`. Voir plus sur [Nullable](../../../sql-reference/data-types/nullable.md). + +Le `Nothing` type peut également être utilisé pour désigner des tableaux vides: + +``` sql +SELECT toTypeName(array()) +``` + +``` text +┌─toTypeName(array())─┐ +│ Array(Nothing) │ +└─────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/fr/sql-reference/data-types/special-data-types/set.md b/docs/fr/sql-reference/data-types/special-data-types/set.md new file mode 100644 index 00000000000..06707533726 --- /dev/null +++ b/docs/fr/sql-reference/data-types/special-data-types/set.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 59 +toc_title: "D\xE9finir" +--- + +# Définir {#set} + +Utilisé pour la moitié droite d’un [IN](../../../sql-reference/statements/select.md#select-in-operators) expression. + +[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/fr/sql-reference/data-types/string.md b/docs/fr/sql-reference/data-types/string.md new file mode 100644 index 00000000000..cd7d82cb98a --- /dev/null +++ b/docs/fr/sql-reference/data-types/string.md @@ -0,0 +1,20 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 44 +toc_title: "Cha\xEEne" +--- + +# Chaîne {#string} + +Les chaînes d’une longueur arbitraire. La longueur n’est pas limitée. La valeur peut contenir un ensemble arbitraire d’octets, y compris des octets nuls. +Le type de chaîne remplace les types VARCHAR, BLOB, CLOB et autres provenant d’autres SGBD. + +## Encodage {#encodings} + +ClickHouse n’a pas le concept d’encodages. Les chaînes peuvent contenir un ensemble arbitraire d’octets, qui sont stockés et sortis tels quels. +Si vous avez besoin de stocker des textes, nous vous recommandons d’utiliser L’encodage UTF-8. À tout le moins, si votre terminal utilise UTF-8 (comme recommandé), vous pouvez lire et écrire vos valeurs sans effectuer de conversions. +De même, certaines fonctions pour travailler avec des chaînes ont des variations distinctes qui fonctionnent sous l’hypothèse que la chaîne contient un ensemble d’octets représentant un texte codé en UTF-8. +Par exemple, l’ ‘length’ fonction calcule la longueur de la chaîne en octets, tandis que le ‘lengthUTF8’ la fonction calcule la longueur de la chaîne en points de code Unicode, en supposant que la valeur est encodée en UTF-8. + +[Article Original](https://clickhouse.tech/docs/en/data_types/string/) diff --git a/docs/fr/sql-reference/data-types/tuple.md b/docs/fr/sql-reference/data-types/tuple.md new file mode 100644 index 00000000000..3f054b5bea0 --- /dev/null +++ b/docs/fr/sql-reference/data-types/tuple.md @@ -0,0 +1,52 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 53 +toc_title: Tuple (T1, T2,...) +--- + +# Tuple(t1, T2, …) {#tuplet1-t2} + +Un n-uplet d’éléments, chacun ayant une personne [type](index.md#data_types). + +Les Tuples sont utilisés pour le regroupement temporaire de colonnes. Les colonnes peuvent être regroupées lorsqu’une expression IN est utilisée dans une requête et pour spécifier certains paramètres formels des fonctions lambda. Pour plus d’informations, voir les sections [Dans les opérateurs](../../sql-reference/statements/select.md) et [Des fonctions d’ordre supérieur](../../sql-reference/functions/higher-order-functions.md). + +Les Tuples peuvent être le résultat d’une requête. Dans ce cas, pour les formats de texte autres que JSON, les valeurs sont séparées par des virgules entre parenthèses. Dans les formats JSON, les tuples sont sortis sous forme de tableaux (entre crochets). + +## La création d’un Tuple {#creating-a-tuple} + +Vous pouvez utiliser une fonction pour créer un tuple: + +``` sql +tuple(T1, T2, ...) +``` + +Exemple de création d’un tuple: + +``` sql +SELECT tuple(1,'a') AS x, toTypeName(x) +``` + +``` text +┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ +│ (1,'a') │ Tuple(UInt8, String) │ +└─────────┴───────────────────────────┘ +``` + +## Utilisation De Types De Données {#working-with-data-types} + +Lors de la création d’un tuple à la volée, ClickHouse détecte automatiquement le type de chaque argument comme le minimum des types qui peuvent stocker la valeur de l’argument. Si l’argument est [NULL](../../sql-reference/syntax.md#null-literal) le type de l’élément tuple est [Nullable](nullable.md). + +Exemple de détection automatique de type de données: + +``` sql +SELECT tuple(1, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ +│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ +└──────────┴─────────────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/fr/sql-reference/data-types/uuid.md b/docs/fr/sql-reference/data-types/uuid.md new file mode 100644 index 00000000000..36371482dfa --- /dev/null +++ b/docs/fr/sql-reference/data-types/uuid.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 46 +toc_title: UUID +--- + +# UUID {#uuid-data-type} + +Un identifiant unique universel (UUID) est un numéro de 16 octets utilisé pour identifier les enregistrements. Pour plus d’informations sur L’UUID, voir [Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +L’exemple de valeur de type UUID est représenté ci-dessous: + +``` text +61f0c404-5cb3-11e7-907b-a6006ad3dba0 +``` + +Si vous ne spécifiez pas la valeur de la colonne UUID lors de l’insertion d’un nouvel enregistrement, la valeur UUID est remplie avec zéro: + +``` text +00000000-0000-0000-0000-000000000000 +``` + +## Comment Générer {#how-to-generate} + +Pour générer la valeur UUID, ClickHouse fournit [generateUUIDv4](../../sql-reference/functions/uuid-functions.md) fonction. + +## Exemple D’Utilisation {#usage-example} + +**Exemple 1** + +Cet exemple montre la création d’une table avec la colonne de type UUID et l’insertion d’une valeur dans la table. + +``` sql +CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog +``` + +``` sql +INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +└──────────────────────────────────────┴───────────┘ +``` + +**Exemple 2** + +Dans cet exemple, la valeur de la colonne UUID n’est pas spécifiée lors de l’insertion d’un nouvel enregistrement. + +``` sql +INSERT INTO t_uuid (y) VALUES ('Example 2') +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ +└──────────────────────────────────────┴───────────┘ +``` + +## Restriction {#restrictions} + +Le type de données UUID ne prend en charge que les fonctions qui [Chaîne](string.md) type de données prend également en charge (par exemple, [min](../../sql-reference/aggregate-functions/reference.md#agg_function-min), [Max](../../sql-reference/aggregate-functions/reference.md#agg_function-max), et [compter](../../sql-reference/aggregate-functions/reference.md#agg_function-count)). + +Le type de données UUID n’est pas pris en charge par les opérations arithmétiques (par exemple, [ABS](../../sql-reference/functions/arithmetic-functions.md#arithm_func-abs)) ou des fonctions d’agrégation, comme [somme](../../sql-reference/aggregate-functions/reference.md#agg_function-sum) et [avg](../../sql-reference/aggregate-functions/reference.md#agg_function-avg). + +[Article Original](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md new file mode 100644 index 00000000000..d0a968fc852 --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 45 +toc_title: "Dictionnaires hi\xE9rarchiques" +--- + +# Dictionnaires Hiérarchiques {#hierarchical-dictionaries} + +Clickhouse prend en charge les dictionnaires hiérarchiques avec un [touche numérique](external-dicts-dict-structure.md#ext_dict-numeric-key). + +Voici une structure hiérarchique: + +``` text +0 (Common parent) +│ +├── 1 (Russia) +│ │ +│ └── 2 (Moscow) +│ │ +│ └── 3 (Center) +│ +└── 4 (Great Britain) + │ + └── 5 (London) +``` + +Cette hiérarchie peut être exprimée comme la table de dictionnaire suivante. + +| id\_région | région\_parent | nom\_région | +|------------|----------------|--------------------| +| 1 | 0 | Russie | +| 2 | 1 | Moscou | +| 3 | 2 | Center | +| 4 | 0 | La Grande-Bretagne | +| 5 | 4 | Londres | + +Ce tableau contient une colonne `parent_region` qui contient la clé du parent le plus proche de l’élément. + +Clickhouse soutient le [hiérarchique](external-dicts-dict-structure.md#hierarchical-dict-attr) propriété pour [externe dictionnaire](index.md) attribut. Cette propriété vous permet de configurer le dictionnaire hiérarchique comme décrit ci-dessus. + +Le [dictGetHierarchy](../../../sql-reference/functions/ext-dict-functions.md#dictgethierarchy) la fonction vous permet d’obtenir la chaîne parent d’un élément. + +Pour notre exemple, la structure du dictionnaire peut être la suivante: + +``` xml + + + + region_id + + + + parent_region + UInt64 + 0 + true + + + + region_name + String + + + + + +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md new file mode 100644 index 00000000000..c566df7c96d --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md @@ -0,0 +1,373 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 41 +toc_title: "Stockage des dictionnaires en m\xE9moire" +--- + +# Stockage Des Dictionnaires En Mémoire {#dicts-external-dicts-dict-layout} + +Il existe une variété de façons de stocker les dictionnaires en mémoire. + +Nous vous recommandons [plat](#flat), [haché](#dicts-external_dicts_dict_layout-hashed) et [complex\_key\_hashed](#complex-key-hashed). qui fournissent la vitesse de traitement optimale. + +La mise en cache n’est pas recommandée en raison de performances potentiellement médiocres et de difficultés à sélectionner les paramètres optimaux. En savoir plus dans la section “[cache](#cache)”. + +Il existe plusieurs façons d’améliorer les performances du dictionnaire: + +- Appelez la fonction pour travailler avec le dictionnaire après `GROUP BY`. +- Marquer les attributs à extraire comme injectifs. Un attribut est appelé injectif si différentes valeurs d’attribut correspondent à différentes clés. Alors, quand `GROUP BY` utilise une fonction qui récupère une valeur d’attribut par la clé, cette fonction est automatiquement retirée de `GROUP BY`. + +ClickHouse génère une exception pour les erreurs avec les dictionnaires. Des exemples d’erreurs: + +- Le dictionnaire accessible n’a pas pu être chargé. +- Erreur de la requête d’une `cached` dictionnaire. + +Vous pouvez afficher la liste des dictionnaires externes et leurs statuts dans le `system.dictionaries` table. + +La configuration ressemble à ceci: + +``` xml + + + ... + + + + + + ... + + +``` + +Correspondant [DDL-requête](../../statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY (...) +... +LAYOUT(LAYOUT_TYPE(param value)) -- layout settings +... +``` + +## Façons De Stocker Des Dictionnaires En Mémoire {#ways-to-store-dictionaries-in-memory} + +- [plat](#flat) +- [haché](#dicts-external_dicts_dict_layout-hashed) +- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) +- [cache](#cache) +- [range\_hashed](#range-hashed) +- [complex\_key\_hashed](#complex-key-hashed) +- [complex\_key\_cache](#complex-key-cache) +- [ip\_trie](#ip-trie) + +### plat {#flat} + +Le dictionnaire est complètement stocké en mémoire sous la forme de tableaux plats. Combien de mémoire le dictionnaire utilise-t-il? Le montant est proportionnel à la taille de la plus grande clé (dans l’espace). + +La clé du dictionnaire a le `UInt64` type et la valeur est limitée à 500 000. Si une clé plus grande est découverte lors de la création du dictionnaire, ClickHouse lève une exception et ne crée pas le dictionnaire. + +Tous les types de sources sont pris en charge. Lors de la mise à jour, les données (à partir d’un fichier ou d’une table) sont lues dans leur intégralité. + +Cette méthode fournit les meilleures performances parmi toutes les méthodes disponibles de stockage du dictionnaire. + +Exemple de Configuration: + +``` xml + + + +``` + +ou + +``` sql +LAYOUT(FLAT()) +``` + +### haché {#dicts-external_dicts_dict_layout-hashed} + +Le dictionnaire est entièrement stockée en mémoire sous la forme d’une table de hachage. Le dictionnaire peut contenir n’importe quel nombre d’éléments avec tous les identificateurs Dans la pratique, le nombre de clés peut atteindre des dizaines de millions d’articles. + +Tous les types de sources sont pris en charge. Lors de la mise à jour, les données (à partir d’un fichier ou d’une table) sont lues dans leur intégralité. + +Exemple de Configuration: + +``` xml + + + +``` + +ou + +``` sql +LAYOUT(HASHED()) +``` + +### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} + +Semblable à `hashed`, mais utilise moins de mémoire en faveur de plus D’utilisation du processeur. + +Exemple de Configuration: + +``` xml + + + +``` + +``` sql +LAYOUT(SPARSE_HASHED()) +``` + +### complex\_key\_hashed {#complex-key-hashed} + +Ce type de stockage est pour une utilisation avec composite [touches](external-dicts-dict-structure.md). Semblable à `hashed`. + +Exemple de Configuration: + +``` xml + + + +``` + +``` sql +LAYOUT(COMPLEX_KEY_HASHED()) +``` + +### range\_hashed {#range-hashed} + +Le dictionnaire est stocké en mémoire sous la forme d’une table de hachage avec un tableau ordonné de gammes et leurs valeurs correspondantes. + +Cette méthode de stockage fonctionne de la même manière que hachée et permet d’utiliser des plages de date / heure (Type numérique arbitraire) en plus de la clé. + +Exemple: Le tableau contient des réductions pour chaque annonceur dans le format: + +``` text ++---------|-------------|-------------|------+ +| advertiser id | discount start date | discount end date | amount | ++===============+=====================+===================+========+ +| 123 | 2015-01-01 | 2015-01-15 | 0.15 | ++---------|-------------|-------------|------+ +| 123 | 2015-01-16 | 2015-01-31 | 0.25 | ++---------|-------------|-------------|------+ +| 456 | 2015-01-01 | 2015-01-15 | 0.05 | ++---------|-------------|-------------|------+ +``` + +Pour utiliser un échantillon pour les plages de dates, définissez `range_min` et `range_max` éléments dans le [structure](external-dicts-dict-structure.md). Ces éléments doivent contenir des éléments `name` et`type` (si `type` n’est pas spécifié, le type par défaut sera utilisé-Date). `type` peut être n’importe quel type numérique (Date / DateTime / UInt64 / Int32 / autres). + +Exemple: + +``` xml + + + Id + + + first + Date + + + last + Date + + ... +``` + +ou + +``` sql +CREATE DICTIONARY somedict ( + id UInt64, + first Date, + last Date +) +PRIMARY KEY id +LAYOUT(RANGE_HASHED()) +RANGE(MIN first MAX last) +``` + +Pour travailler avec ces dictionnaires, vous devez passer un argument supplémentaire à l’ `dictGetT` fonction, pour laquelle une plage est sélectionnée: + +``` sql +dictGetT('dict_name', 'attr_name', id, date) +``` + +Cette fonction retourne la valeur pour l’ `id`s et la plage de dates qui inclut la date passée. + +Détails de l’algorithme: + +- Si l’ `id` est introuvable ou une plage n’est pas trouvé pour l’ `id` il retourne la valeur par défaut pour le dictionnaire. +- S’il y a des plages qui se chevauchent, vous pouvez en utiliser. +- Si le délimiteur est `NULL` ou une date non valide (telle que 1900-01-01 ou 2039-01-01), la plage est laissée ouverte. La gamme peut être ouverte des deux côtés. + +Exemple de Configuration: + +``` xml + + + + ... + + + + + + + + Abcdef + + + StartTimeStamp + UInt64 + + + EndTimeStamp + UInt64 + + + XXXType + String + + + + + + +``` + +ou + +``` sql +CREATE DICTIONARY somedict( + Abcdef UInt64, + StartTimeStamp UInt64, + EndTimeStamp UInt64, + XXXType String DEFAULT '' +) +PRIMARY KEY Abcdef +RANGE(MIN StartTimeStamp MAX EndTimeStamp) +``` + +### cache {#cache} + +Le dictionnaire est stocké dans un cache qui a un nombre fixe de cellules. Ces cellules contiennent des éléments fréquemment utilisés. + +Lors de la recherche d’un dictionnaire, le cache est recherché en premier. Pour chaque bloc de données, toutes les clés qui ne sont pas trouvées dans le cache ou qui sont obsolètes sont demandées à la source en utilisant `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Les données reçues sont ensuite écrites dans le cache. + +Pour les dictionnaires de cache, l’expiration [vie](external-dicts-dict-lifetime.md) des données dans le cache peuvent être définies. Si plus de temps que `lifetime` passé depuis le chargement des données dans une cellule, la valeur de la cellule n’est pas utilisée et elle est demandée à nouveau la prochaine fois qu’elle doit être utilisée. +C’est la moins efficace de toutes les façons de stocker les dictionnaires. La vitesse du cache dépend fortement des paramètres corrects et que le scénario d’utilisation. Un dictionnaire de type de cache fonctionne bien uniquement lorsque les taux de réussite sont suffisamment élevés (recommandé 99% et plus). Vous pouvez afficher le taux de réussite moyen dans le `system.dictionaries` table. + +Pour améliorer les performances du cache, utilisez une sous-requête avec `LIMIT`, et appelez la fonction avec le dictionnaire en externe. + +Soutenu [source](external-dicts-dict-sources.md): MySQL, ClickHouse, exécutable, HTTP. + +Exemple de paramètres: + +``` xml + + + + 1000000000 + + +``` + +ou + +``` sql +LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) +``` + +Définissez une taille de cache suffisamment grande. Vous devez expérimenter pour sélectionner le nombre de cellules: + +1. Définissez une valeur. +2. Exécutez les requêtes jusqu’à ce que le cache soit complètement plein. +3. Évaluer la consommation de mémoire en utilisant le `system.dictionaries` table. +4. Augmentez ou diminuez le nombre de cellules jusqu’à ce que la consommation de mémoire requise soit atteinte. + +!!! warning "Avertissement" + N’utilisez pas ClickHouse comme source, car le traitement des requêtes avec des lectures aléatoires est lent. + +### complex\_key\_cache {#complex-key-cache} + +Ce type de stockage est pour une utilisation avec composite [touches](external-dicts-dict-structure.md). Semblable à `cache`. + +### ip\_trie {#ip-trie} + +Ce type de stockage permet de mapper des préfixes de réseau (adresses IP) à des métadonnées telles que ASN. + +Exemple: la table contient les préfixes de réseau et leur correspondant en tant que numéro et Code de pays: + +``` text + +-----------|-----|------+ + | prefix | asn | cca2 | + +=================+=======+========+ + | 202.79.32.0/20 | 17501 | NP | + +-----------|-----|------+ + | 2620:0:870::/48 | 3856 | US | + +-----------|-----|------+ + | 2a02:6b8:1::/48 | 13238 | RU | + +-----------|-----|------+ + | 2001:db8::/32 | 65536 | ZZ | + +-----------|-----|------+ +``` + +Lorsque vous utilisez ce type de mise en page, la structure doit avoir une clé composite. + +Exemple: + +``` xml + + + + prefix + String + + + + asn + UInt32 + + + + cca2 + String + ?? + + ... +``` + +ou + +``` sql +CREATE DICTIONARY somedict ( + prefix String, + asn UInt32, + cca2 String DEFAULT '??' +) +PRIMARY KEY prefix +``` + +La clé ne doit avoir qu’un seul attribut de type chaîne contenant un préfixe IP autorisé. Les autres types ne sont pas encore pris en charge. + +Pour les requêtes, vous devez utiliser les mêmes fonctions (`dictGetT` avec un n-uplet) comme pour les dictionnaires avec des clés composites: + +``` sql +dictGetT('dict_name', 'attr_name', tuple(ip)) +``` + +La fonction prend soit `UInt32` pour IPv4, ou `FixedString(16)` pour IPv6: + +``` sql +dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) +``` + +Les autres types ne sont pas encore pris en charge. La fonction renvoie l’attribut du préfixe correspondant à cette adresse IP. S’il y a chevauchement des préfixes, le plus spécifique est retourné. + +Les données sont stockées dans une `trie`. Il doit complètement s’intégrer dans la RAM. + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md new file mode 100644 index 00000000000..97ec3ce42ea --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 42 +toc_title: "Mises \xC0 Jour Du Dictionnaire" +--- + +# Mises À Jour Du Dictionnaire {#dictionary-updates} + +ClickHouse met périodiquement à jour les dictionnaires. L’intervalle de mise à jour pour les dictionnaires entièrement téléchargés et l’intervalle d’invalidation pour les dictionnaires `` tag en quelques secondes. + +Les mises à jour du dictionnaire (autres que le chargement pour la première utilisation) ne bloquent pas les requêtes. Lors des mises à jour, l’ancienne version d’un dictionnaire est utilisée. Si une erreur se produit pendant une mise à jour, l’erreur est écrite dans le journal du serveur et les requêtes continuent d’utiliser l’ancienne version des dictionnaires. + +Exemple de paramètres: + +``` xml + + ... + 300 + ... + +``` + +``` sql +CREATE DICTIONARY (...) +... +LIFETIME(300) +... +``` + +Paramètre `0` (`LIFETIME(0)`) empêche la mise à jour des dictionnaires. + +Vous pouvez définir un intervalle de temps pour les mises à niveau, et ClickHouse choisira un temps uniformément aléatoire dans cette plage. Ceci est nécessaire pour répartir la charge sur la source du dictionnaire lors de la mise à niveau sur un grand nombre de serveurs. + +Exemple de paramètres: + +``` xml + + ... + + 300 + 360 + + ... + +``` + +ou + +``` sql +LIFETIME(MIN 300 MAX 360) +``` + +Lors de la mise à niveau des dictionnaires, le serveur ClickHouse applique une logique différente selon le type de [source](external-dicts-dict-sources.md): + +- Pour un fichier texte, il vérifie l’heure de la modification. Si l’heure diffère de l’heure enregistrée précédemment, le dictionnaire est mis à jour. +- Pour les tables MyISAM, l’Heure de modification est vérifiée à l’aide d’un `SHOW TABLE STATUS` requête. +- Les dictionnaires d’autres sources sont mis à jour à chaque fois par défaut. + +Pour les sources MySQL (InnoDB), ODBC et ClickHouse, vous pouvez configurer une requête qui mettra à jour les dictionnaires uniquement s’ils ont vraiment changé, plutôt que chaque fois. Pour ce faire, suivez ces étapes: + +- La table de dictionnaire doit avoir un champ qui change toujours lorsque les données source sont mises à jour. +- Les paramètres de la source doivent spécifier une requête qui récupère le champ de modification. Le serveur ClickHouse interprète le résultat de la requête comme une ligne, et si cette ligne a changé par rapport à son état précédent, le dictionnaire est mis à jour. Spécifier la requête dans le `` champ dans les paramètres pour le [source](external-dicts-dict-sources.md). + +Exemple de paramètres: + +``` xml + + ... + + ... + SELECT update_time FROM dictionary_source where id = 1 + + ... + +``` + +ou + +``` sql +... +SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) +... +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md new file mode 100644 index 00000000000..d34d908fa79 --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md @@ -0,0 +1,624 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 43 +toc_title: Sources de dictionnaires externes +--- + +# Sources De Dictionnaires Externes {#dicts-external-dicts-dict-sources} + +Externe dictionnaire peut être connecté à partir de nombreuses sources différentes. + +Si dictionary est configuré à l’aide de xml-file, la configuration ressemble à ceci: + +``` xml + + + ... + + + + + + ... + + ... + +``` + +En cas de [DDL-requête](../../statements/create.md#create-dictionary-query), configuration égale ressemblera à: + +``` sql +CREATE DICTIONARY dict_name (...) +... +SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration +... +``` + +La source est configurée dans le `source` section. + +Pour les sources de types [Fichier Local](#dicts-external_dicts_dict_sources-local_file), [Fichier exécutable](#dicts-external_dicts_dict_sources-executable), [HTTP(s)](#dicts-external_dicts_dict_sources-http), [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) +les paramètres optionnels sont possibles: + +``` xml +@@ -53,6 +49,12 @@ optional settings are available: + + +``` + +ou + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +SETTINGS(format_csv_allow_single_quotes = 1) +``` + +Les Types de sources (`source_type`): + +- [Fichier Local](#dicts-external_dicts_dict_sources-local_file) +- [Fichier exécutable](#dicts-external_dicts_dict_sources-executable) +- [HTTP(S)](#dicts-external_dicts_dict_sources-http) +- DBMS + - [ODBC](#dicts-external_dicts_dict_sources-odbc) + - [MySQL](#dicts-external_dicts_dict_sources-mysql) + - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) + - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) + - [Redis](#dicts-external_dicts_dict_sources-redis) + +## Fichier Local {#dicts-external_dicts_dict_sources-local_file} + +Exemple de paramètres: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + +``` + +ou + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Définition des champs: + +- `path` – The absolute path to the file. +- `format` – The file format. All the formats described in “[Format](../../../interfaces/formats.md#formats)” sont pris en charge. + +## Fichier Exécutable {#dicts-external_dicts_dict_sources-executable} + +Travailler avec des fichiers exécutables en dépend [comment le dictionnaire est stocké dans la mémoire](external-dicts-dict-layout.md). Si le dictionnaire est stocké en utilisant `cache` et `complex_key_cache`, Clickhouse demande les clés nécessaires en envoyant une requête au STDIN du fichier exécutable. Sinon, ClickHouse démarre le fichier exécutable et traite sa sortie comme des données de dictionnaire. + +Exemple de paramètres: + +``` xml + + + cat /opt/dictionaries/os.tsv + TabSeparated + + +``` + +ou + +``` sql +SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Définition des champs: + +- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). +- `format` – The file format. All the formats described in “[Format](../../../interfaces/formats.md#formats)” sont pris en charge. + +## Http(s) {#dicts-external_dicts_dict_sources-http} + +Travailler avec un serveur HTTP (S) dépend de [comment le dictionnaire est stocké dans la mémoire](external-dicts-dict-layout.md). Si le dictionnaire est stocké en utilisant `cache` et `complex_key_cache`, Clickhouse demande les clés nécessaires en envoyant une demande via le `POST` méthode. + +Exemple de paramètres: + +``` xml + + + http://[::1]/os.tsv + TabSeparated + + user + password + + +
+ API-KEY + key +
+
+
+ +``` + +ou + +``` sql +SOURCE(HTTP( + url 'http://[::1]/os.tsv' + format 'TabSeparated' + credentials(user 'user' password 'password') + headers(header(name 'API-KEY' value 'key')) +)) +``` + +Pour que ClickHouse accède à une ressource HTTPS, vous devez [configurer openSSL](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-openssl) dans la configuration du serveur. + +Définition des champs: + +- `url` – The source URL. +- `format` – The file format. All the formats described in “[Format](../../../interfaces/formats.md#formats)” sont pris en charge. +- `credentials` – Basic HTTP authentication. Optional parameter. + - `user` – Username required for the authentication. + - `password` – Password required for the authentication. +- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. + - `header` – Single HTTP header entry. + - `name` – Identifiant name used for the header send on the request. + - `value` – Value set for a specific identifiant name. + +## ODBC {#dicts-external_dicts_dict_sources-odbc} + +Vous pouvez utiliser cette méthode pour connecter n’importe quelle base de données dotée d’un pilote ODBC. + +Exemple de paramètres: + +``` xml + + + DatabaseName + ShemaName.TableName
+ DSN=some_parameters + SQL_QUERY +
+ +``` + +ou + +``` sql +SOURCE(ODBC( + db 'DatabaseName' + table 'SchemaName.TableName' + connection_string 'DSN=some_parameters' + invalidate_query 'SQL_QUERY' +)) +``` + +Définition des champs: + +- `db` – Name of the database. Omit it if the database name is set in the `` paramètre. +- `table` – Name of the table and schema if exists. +- `connection_string` – Connection string. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Mise à jour des dictionnaires](external-dicts-dict-lifetime.md). + +ClickHouse reçoit des symboles de citation D’ODBC-driver et cite tous les paramètres des requêtes au pilote, il est donc nécessaire de définir le nom de la table en conséquence sur le cas du nom de la table dans la base de données. + +Si vous avez des problèmes avec des encodages lors de l’utilisation d’Oracle, consultez le [FAQ](../../../faq/general.md#oracle-odbc-encodings) article. + +### Vulnérabilité Connue De La fonctionnalité Du Dictionnaire ODBC {#known-vulnerability-of-the-odbc-dictionary-functionality} + +!!! attention "Attention" + Lors de la connexion à la base de données via le paramètre de connexion du pilote ODBC `Servername` peut être substitué. Dans ce cas, les valeurs de `USERNAME` et `PASSWORD` de `odbc.ini` sont envoyés au serveur distant et peuvent être compromis. + +**Exemple d’utilisation non sécurisée** + +Configurons unixODBC pour PostgreSQL. Le contenu de `/etc/odbc.ini`: + +``` text +[gregtest] +Driver = /usr/lib/psqlodbca.so +Servername = localhost +PORT = 5432 +DATABASE = test_db +#OPTION = 3 +USERNAME = test +PASSWORD = test +``` + +Si vous faites alors une requête telle que + +``` sql +SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); +``` + +Le pilote ODBC enverra des valeurs de `USERNAME` et `PASSWORD` de `odbc.ini` de `some-server.com`. + +### Exemple De Connexion Postgresql {#example-of-connecting-postgresql} + +Ubuntu OS. + +Installation d’unixODBC et du pilote ODBC pour PostgreSQL: + +``` bash +$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql +``` + +Configuration `/etc/odbc.ini` (ou `~/.odbc.ini`): + +``` text + [DEFAULT] + Driver = myconnection + + [myconnection] + Description = PostgreSQL connection to my_db + Driver = PostgreSQL Unicode + Database = my_db + Servername = 127.0.0.1 + UserName = username + Password = password + Port = 5432 + Protocol = 9.3 + ReadOnly = No + RowVersioning = No + ShowSystemTables = No + ConnSettings = +``` + +La configuration du dictionnaire dans ClickHouse: + +``` xml + + + table_name + + + + + DSN=myconnection + postgresql_table
+
+ + + 300 + 360 + + + + + + + id + + + some_column + UInt64 + 0 + + +
+
+``` + +ou + +``` sql +CREATE DICTIONARY table_name ( + id UInt64, + some_column UInt64 DEFAULT 0 +) +PRIMARY KEY id +SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) +LAYOUT(HASHED()) +LIFETIME(MIN 300 MAX 360) +``` + +Vous devrez peut-être modifier `odbc.ini` pour spécifier le chemin d’accès complet à la bibliothèque avec le conducteur `DRIVER=/usr/local/lib/psqlodbcw.so`. + +### Exemple De Connexion à MS SQL Server {#example-of-connecting-ms-sql-server} + +Ubuntu OS. + +Installation du pilote: : + +``` bash +$ sudo apt-get install tdsodbc freetds-bin sqsh +``` + +Configuration du pilote: + +``` bash + $ cat /etc/freetds/freetds.conf + ... + + [MSSQL] + host = 192.168.56.101 + port = 1433 + tds version = 7.0 + client charset = UTF-8 + + $ cat /etc/odbcinst.ini + ... + + [FreeTDS] + Description = FreeTDS + Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so + Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so + FileUsage = 1 + UsageCount = 5 + + $ cat ~/.odbc.ini + ... + + [MSSQL] + Description = FreeTDS + Driver = FreeTDS + Servername = MSSQL + Database = test + UID = test + PWD = test + Port = 1433 +``` + +Configuration du dictionnaire dans ClickHouse: + +``` xml + + + test + + + dict
+ DSN=MSSQL;UID=test;PWD=test +
+ + + + 300 + 360 + + + + + + + + + k + + + s + String + + + +
+
+``` + +ou + +``` sql +CREATE DICTIONARY test ( + k UInt64, + s String DEFAULT '' +) +PRIMARY KEY k +SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) +LAYOUT(FLAT()) +LIFETIME(MIN 300 MAX 360) +``` + +## DBMS {#dbms} + +### Mysql {#dicts-external_dicts_dict_sources-mysql} + +Exemple de paramètres: + +``` xml + + + 3306 + clickhouse + qwerty + + example01-1 + 1 + + + example01-2 + 1 + + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +ou + +``` sql +SOURCE(MYSQL( + port 3306 + user 'clickhouse' + password 'qwerty' + replica(host 'example01-1' priority 1) + replica(host 'example01-2' priority 1) + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +Définition des champs: + +- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). + +- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `replica` – Section of replica configurations. There can be multiple sections. + + - `replica/host` – The MySQL host. + - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. + +- `db` – Name of the database. + +- `table` – Name of the table. + +- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` clause dans MySQL, par exemple, `id > 10 AND id < 20`. Paramètre facultatif. + +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Mise à jour des dictionnaires](external-dicts-dict-lifetime.md). + +MySQL peut être connecté sur un hôte local via des sockets. Pour ce faire, définissez `host` et `socket`. + +Exemple de paramètres: + +``` xml + + + localhost + /path/to/socket/file.sock + clickhouse + qwerty + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +ou + +``` sql +SOURCE(MYSQL( + host 'localhost' + socket '/path/to/socket/file.sock' + user 'clickhouse' + password 'qwerty' + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +### Clickhouse {#dicts-external_dicts_dict_sources-clickhouse} + +Exemple de paramètres: + +``` xml + + + example01-01-1 + 9000 + default + + default + ids
+ id=10 +
+ +``` + +ou + +``` sql +SOURCE(CLICKHOUSE( + host 'example01-01-1' + port 9000 + user 'default' + password '' + db 'default' + table 'ids' + where 'id=10' +)) +``` + +Définition des champs: + +- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [Distribué](../../../engines/table-engines/special/distributed.md) table et entrez-le dans les configurations suivantes. +- `port` – The port on the ClickHouse server. +- `user` – Name of the ClickHouse user. +- `password` – Password of the ClickHouse user. +- `db` – Name of the database. +- `table` – Name of the table. +- `where` – The selection criteria. May be omitted. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Mise à jour des dictionnaires](external-dicts-dict-lifetime.md). + +### Mongodb {#dicts-external_dicts_dict_sources-mongodb} + +Exemple de paramètres: + +``` xml + + + localhost + 27017 + + + test + dictionary_source + + +``` + +ou + +``` sql +SOURCE(MONGO( + host 'localhost' + port 27017 + user '' + password '' + db 'test' + collection 'dictionary_source' +)) +``` + +Définition des champs: + +- `host` – The MongoDB host. +- `port` – The port on the MongoDB server. +- `user` – Name of the MongoDB user. +- `password` – Password of the MongoDB user. +- `db` – Name of the database. +- `collection` – Name of the collection. + +### Redis {#dicts-external_dicts_dict_sources-redis} + +Exemple de paramètres: + +``` xml + + + localhost + 6379 + simple + 0 + + +``` + +ou + +``` sql +SOURCE(REDIS( + host 'localhost' + port 6379 + storage_type 'simple' + db_index 0 +)) +``` + +Définition des champs: + +- `host` – The Redis host. +- `port` – The port on the Redis server. +- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` est pour les sources simples et pour les sources à clé unique hachées, `hash_map` est pour les sources hachées avec deux clés. Les sources À Distance et les sources de cache à clé complexe ne sont pas prises en charge. Peut être omis, la valeur par défaut est `simple`. +- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md new file mode 100644 index 00000000000..3e3b24442d7 --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 44 +toc_title: "Cl\xE9 et champs du dictionnaire" +--- + +# Clé Et Champs Du Dictionnaire {#dictionary-key-and-fields} + +Le `` la clause décrit la clé du dictionnaire et les champs disponibles pour les requêtes. + +Description XML: + +``` xml + + + + Id + + + + + + + ... + + + +``` + +Les attributs sont décrits dans les éléments: + +- `` — [La colonne de la clé](external-dicts-dict-structure.md#ext_dict_structure-key). +- `` — [Colonne de données](external-dicts-dict-structure.md#ext_dict_structure-attributes). Il peut y avoir un certain nombre d’attributs. + +Requête DDL: + +``` sql +CREATE DICTIONARY dict_name ( + Id UInt64, + -- attributes +) +PRIMARY KEY Id +... +``` + +Les attributs sont décrits dans le corps de la requête: + +- `PRIMARY KEY` — [La colonne de la clé](external-dicts-dict-structure.md#ext_dict_structure-key) +- `AttrName AttrType` — [Colonne de données](external-dicts-dict-structure.md#ext_dict_structure-attributes). Il peut y avoir un certain nombre d’attributs. + +## Clé {#ext_dict_structure-key} + +ClickHouse prend en charge les types de clés suivants: + +- Touche numérique. `UInt64`. Défini dans le `` tag ou en utilisant `PRIMARY KEY` mot. +- Clé Composite. Ensemble de valeurs de types différents. Défini dans la balise `` ou `PRIMARY KEY` mot. + +Une structure xml peut contenir `` ou ``. DDL-requête doit contenir unique `PRIMARY KEY`. + +!!! warning "Avertissement" + Vous ne devez pas décrire clé comme un attribut. + +### Touche Numérique {#ext_dict-numeric-key} + +Type: `UInt64`. + +Exemple de Configuration: + +``` xml + + Id + +``` + +Champs de Configuration: + +- `name` – The name of the column with keys. + +Pour DDL-requête: + +``` sql +CREATE DICTIONARY ( + Id UInt64, + ... +) +PRIMARY KEY Id +... +``` + +- `PRIMARY KEY` – The name of the column with keys. + +### Clé Composite {#composite-key} + +La clé peut être un `tuple` de tous les types de champs. Le [disposition](external-dicts-dict-layout.md) dans ce cas, doit être `complex_key_hashed` ou `complex_key_cache`. + +!!! tip "Conseil" + Une clé composite peut être constitué d’un seul élément. Cela permet d’utiliser une chaîne comme clé, par exemple. + +La structure de clé est définie dans l’élément ``. Les principaux champs sont spécifiés dans le même format que le dictionnaire [attribut](external-dicts-dict-structure.md). Exemple: + +``` xml + + + + field1 + String + + + field2 + UInt32 + + ... + +... +``` + +ou + +``` sql +CREATE DICTIONARY ( + field1 String, + field2 String + ... +) +PRIMARY KEY field1, field2 +... +``` + +Pour une requête à l’ `dictGet*` fonction, un tuple est passé comme clé. Exemple: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. + +## Attribut {#ext_dict_structure-attributes} + +Exemple de Configuration: + +``` xml + + ... + + Name + ClickHouseDataType + + rand64() + true + true + true + + +``` + +ou + +``` sql +CREATE DICTIONARY somename ( + Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID +) +``` + +Champs de Configuration: + +| Balise | Description | Requis | +|------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------| +| `name` | Nom de la colonne. | Oui | +| `type` | Type de données ClickHouse.
ClickHouse tente de convertir la valeur du dictionnaire vers le type de données spécifié. Par exemple, pour MySQL, le champ peut être `TEXT`, `VARCHAR`, ou `BLOB` dans la table source MySQL, mais il peut être téléchargé comme `String` à ClickHouse.
[Nullable](../../../sql-reference/data-types/nullable.md) n’est pas pris en charge. | Oui | +| `null_value` | Valeur par défaut pour un élément inexistant.
Dans l’exemple, c’est une chaîne vide. Vous ne pouvez pas utiliser `NULL` dans ce domaine. | Oui | +| `expression` | [Expression](../../syntax.md#syntax-expressions) que ClickHouse s’exécute sur la valeur.
L’expression peut être un nom de colonne dans la base de données SQL distante. Ainsi, vous pouvez l’utiliser pour créer un alias pour la colonne à distance.

Valeur par défaut: aucune expression. | Aucun | +| `hierarchical` | Si `true`, l’attribut contient la valeur d’un parent clé de la clé actuelle. Voir [Dictionnaires Hiérarchiques](external-dicts-dict-hierarchical.md).

Valeur par défaut: `false`. | Aucun | +| `injective` | Indicateur qui indique si le `id -> attribute` l’image est [injective](https://en.wikipedia.org/wiki/Injective_function).
Si `true`, ClickHouse peut automatiquement placer après le `GROUP BY` clause les requêtes aux dictionnaires avec injection. Habituellement, il réduit considérablement le montant de ces demandes.

Valeur par défaut: `false`. | Aucun | +| `is_object_id` | Indicateur qui indique si la requête est exécutée pour un document MongoDB par `ObjectID`.

Valeur par défaut: `false`. | Aucun | + +## Voir Aussi {#see-also} + +- [Fonctions pour travailler avec des dictionnaires externes](../../../sql-reference/functions/ext-dict-functions.md). + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md new file mode 100644 index 00000000000..deb27884afb --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md @@ -0,0 +1,53 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 40 +toc_title: Configuration D'un dictionnaire externe +--- + +# Configuration D’un Dictionnaire Externe {#dicts-external-dicts-dict} + +Si dictionary est configuré à l’aide d’un fichier xml, than dictionary configuration a la structure suivante: + +``` xml + + dict_name + + + + + + + + + + + + + + + + + +``` + +Correspondant [DDL-requête](../../statements/create.md#create-dictionary-query) a la structure suivante: + +``` sql +CREATE DICTIONARY dict_name +( + ... -- attributes +) +PRIMARY KEY ... -- complex or single key configuration +SOURCE(...) -- Source configuration +LAYOUT(...) -- Memory layout configuration +LIFETIME(...) -- Lifetime of dictionary in memory +``` + +- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. +- [source](external-dicts-dict-sources.md) — Source of the dictionary. +- [disposition](external-dicts-dict-layout.md) — Dictionary layout in memory. +- [structure](external-dicts-dict-structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. +- [vie](external-dicts-dict-lifetime.md) — Frequency of dictionary updates. + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts.md new file mode 100644 index 00000000000..23fc8ca9fa6 --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/external-dictionaries/external-dicts.md @@ -0,0 +1,56 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 39 +toc_title: "Description G\xE9n\xE9rale" +--- + +# Dictionnaires Externes {#dicts-external-dicts} + +Vous pouvez ajouter vos propres dictionnaires à partir de diverses sources de données. La source de données d’un dictionnaire peut être un texte local ou un fichier exécutable, une ressource HTTP(S) ou un autre SGBD. Pour plus d’informations, voir “[Sources pour les dictionnaires externes](external-dicts-dict-sources.md)”. + +ClickHouse: + +- Stocke entièrement ou partiellement les dictionnaires en RAM. +- Met à jour périodiquement les dictionnaires et charge dynamiquement les valeurs manquantes. En d’autres mots, les dictionnaires peuvent être chargés dynamiquement. +- Permet de créer des dictionnaires externes avec des fichiers xml ou [Les requêtes DDL](../../statements/create.md#create-dictionary-query). + +La configuration des dictionnaires externes peut être située dans un ou plusieurs fichiers xml. Le chemin d’accès à la configuration spécifiée dans le [dictionaries\_config](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_config) paramètre. + +Les dictionnaires peuvent être chargés au démarrage du serveur ou à la première utilisation, en fonction [dictionaries\_lazy\_load](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) paramètre. + +Le fichier de configuration du dictionnaire a le format suivant: + +``` xml + + An optional element with any content. Ignored by the ClickHouse server. + + + /etc/metrika.xml + + + + + + + + +``` + +Vous pouvez [configurer](external-dicts-dict.md) le nombre de dictionnaires dans le même fichier. + +[Requêtes DDL pour les dictionnaires](../../statements/create.md#create-dictionary-query) ne nécessite aucun enregistrement supplémentaire dans la configuration du serveur. Ils permettent de travailler avec des dictionnaires en tant qu’entités de première classe, comme des tables ou des vues. + +!!! attention "Attention" + Vous pouvez convertir les valeurs pour un petit dictionnaire en le décrivant dans un `SELECT` requête (voir la [transformer](../../../sql-reference/functions/other-functions.md) fonction). Cette fonctionnalité n’est pas liée aux dictionnaires externes. + +## Voir Aussi {#ext-dicts-see-also} + +- [Configuration D’un dictionnaire externe](external-dicts-dict.md) +- [Stockage des dictionnaires en mémoire](external-dicts-dict-layout.md) +- [Mises À Jour Du Dictionnaire](external-dicts-dict-lifetime.md) +- [Sources de dictionnaires externes](external-dicts-dict-sources.md) +- [Clé et champs du dictionnaire](external-dicts-dict-structure.md) +- [Fonctions pour travailler avec des dictionnaires externes](../../../sql-reference/functions/ext-dict-functions.md) + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/index.md b/docs/fr/sql-reference/dictionaries/external-dictionaries/index.md similarity index 100% rename from docs/fr/sql_reference/dictionaries/external_dictionaries/index.md rename to docs/fr/sql-reference/dictionaries/external-dictionaries/index.md diff --git a/docs/fr/sql-reference/dictionaries/index.md b/docs/fr/sql-reference/dictionaries/index.md new file mode 100644 index 00000000000..183c365afc1 --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Dictionaries +toc_priority: 35 +toc_title: Introduction +--- + +# Dictionnaire {#dictionaries} + +Un dictionnaire est une cartographie (`key -> attributes`) qui est pratique pour différents types de listes de référence. + +ClickHouse prend en charge des fonctions spéciales pour travailler avec des dictionnaires qui peuvent être utilisés dans les requêtes. Il est plus facile et plus efficace d’utiliser des dictionnaires avec des fonctions que par une `JOIN` avec des tableaux de référence. + +[NULL](../syntax.md#null) les valeurs ne peuvent pas être stockées dans un dictionnaire. + +Supports ClickHouse: + +- [Construit-dans les dictionnaires](internal-dicts.md#internal_dicts) avec un [ensemble de fonctions](../../sql-reference/functions/ym-dict-functions.md). +- [Plug-in (externe) dictionnaires](external-dictionaries/external-dicts.md) avec un [net de fonctions](../../sql-reference/functions/ext-dict-functions.md). + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/fr/sql-reference/dictionaries/internal-dicts.md b/docs/fr/sql-reference/dictionaries/internal-dicts.md new file mode 100644 index 00000000000..a835e62eba2 --- /dev/null +++ b/docs/fr/sql-reference/dictionaries/internal-dicts.md @@ -0,0 +1,55 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 39 +toc_title: Dictionnaires Internes +--- + +# Dictionnaires Internes {#internal_dicts} + +ClickHouse contient une fonction intégrée pour travailler avec une géobase. + +Cela vous permet de: + +- Utilisez L’ID d’une région pour obtenir son nom dans la langue souhaitée. +- Utilisez L’ID d’une région pour obtenir L’ID d’une ville, d’une région, d’un district fédéral, d’un pays ou d’un continent. +- Vérifiez si une région fait partie d’une autre région. +- Obtenez une chaîne de régions parentes. + +Toutes les fonctions prennent en charge “translocality,” la capacité d’utiliser simultanément différentes perspectives sur la propriété de la région. Pour plus d’informations, consultez la section “Functions for working with Yandex.Metrica dictionaries”. + +Les dictionnaires internes sont désactivés dans le package par défaut. +Pour les activer, décommentez les paramètres `path_to_regions_hierarchy_file` et `path_to_regions_names_files` dans le fichier de configuration du serveur. + +La géobase est chargée à partir de fichiers texte. + +Place de la `regions_hierarchy*.txt` les fichiers dans le `path_to_regions_hierarchy_file` répertoire. Ce paramètre de configuration doit contenir le chemin `regions_hierarchy.txt` fichier (la hiérarchie régionale par défaut), et les autres fichiers (`regions_hierarchy_ua.txt`) doit être situé dans le même répertoire. + +Mettre le `regions_names_*.txt` les fichiers dans le `path_to_regions_names_files` répertoire. + +Vous pouvez également créer ces fichiers vous-même. Le format de fichier est le suivant: + +`regions_hierarchy*.txt`: TabSeparated (pas d’en-tête), colonnes: + +- région de l’ID (`UInt32`) +- ID de région parent (`UInt32`) +- type de région (`UInt8`): 1-continent, 3-pays, 4-district fédéral, 5-région, 6-ville; les autres types n’ont pas de valeurs +- population (`UInt32`) — optional column + +`regions_names_*.txt`: TabSeparated (pas d’en-tête), colonnes: + +- région de l’ID (`UInt32`) +- nom de la région (`String`) — Can’t contain tabs or line feeds, even escaped ones. + +Un tableau plat est utilisé pour stocker dans la RAM. Pour cette raison, les ID ne devraient pas dépasser un million. + +Les dictionnaires peuvent être mis à jour sans redémarrer le serveur. Cependant, l’ensemble des dictionnaires n’est pas mis à jour. +Pour les mises à jour, les temps de modification du fichier sont vérifiés. Si un fichier a été modifié, le dictionnaire est mis à jour. +L’intervalle de vérification des modifications est configuré dans le `builtin_dictionaries_reload_interval` paramètre. +Les mises à jour du dictionnaire (autres que le chargement lors de la première utilisation) ne bloquent pas les requêtes. Lors des mises à jour, les requêtes utilisent les anciennes versions des dictionnaires. Si une erreur se produit pendant une mise à jour, l’erreur est écrite dans le journal du serveur et les requêtes continuent d’utiliser l’ancienne version des dictionnaires. + +Nous vous recommandons de mettre à jour périodiquement les dictionnaires avec la géobase. Lors d’une mise à jour, générez de nouveaux fichiers et écrivez-les dans un emplacement séparé. Lorsque tout est prêt, renommez - les en fichiers utilisés par le serveur. + +Il existe également des fonctions pour travailler avec les identifiants du système d’exploitation et Yandex.Moteurs de recherche Metrica, mais ils ne devraient pas être utilisés. + +[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/fr/sql-reference/functions/arithmetic-functions.md b/docs/fr/sql-reference/functions/arithmetic-functions.md new file mode 100644 index 00000000000..fa3cd3ab936 --- /dev/null +++ b/docs/fr/sql-reference/functions/arithmetic-functions.md @@ -0,0 +1,87 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 35 +toc_title: "Arithm\xE9tique" +--- + +# Fonctions arithmétiques {#arithmetic-functions} + +Pour toutes les fonctions arithmétiques, le type de résultat est calculé comme le plus petit type de nombre dans lequel le résultat correspond, s’il existe un tel type. Le minimum est pris simultanément sur la base du nombre de bits, s’il est signé, et s’il flotte. S’il n’y a pas assez de bits, le type de bits le plus élevé est pris. + +Exemple: + +``` sql +SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) +``` + +``` text +┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ +│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ +└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ +``` + +Les fonctions arithmétiques fonctionnent pour n’importe quelle paire de types de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 ou Float64. + +Le débordement est produit de la même manière qu’en C++. + +## plus (A, B), opérateur a + b {#plusa-b-a-b-operator} + +Calcule la somme des nombres. +Vous pouvez également ajouter des nombres entiers avec une date ou la date et l’heure. Dans le cas d’une date, Ajouter un entier signifie ajouter le nombre de jours correspondant. Pour une date avec l’heure, cela signifie ajouter le nombre de secondes correspondant. + +## moins (A, B), opérateur a - b {#minusa-b-a-b-operator} + +Calcule la différence. Le résultat est toujours signé. + +You can also calculate integer numbers from a date or date with time. The idea is the same – see above for ‘plus’. + +## la multiplication(a, b), a \* et b \* de l’opérateur {#multiplya-b-a-b-operator} + +Calcule le produit des nombres. + +## diviser (A, B), opérateur a / b {#dividea-b-a-b-operator} + +Calcule le quotient des nombres. Le type de résultat est toujours un type à virgule flottante. +Il n’est pas de division entière. Pour la division entière, utilisez le ‘intDiv’ fonction. +En divisant par zéro vous obtenez ‘inf’, ‘-inf’, ou ‘nan’. + +## intDiv (a, b) {#intdiva-b} + +Calcule le quotient des nombres. Divise en entiers, arrondi vers le bas (par la valeur absolue). +Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. + +## intDivOrZero(a, b) {#intdivorzeroa-b} + +Diffère de ‘intDiv’ en ce sens qu’il renvoie zéro en divisant par zéro ou en divisant un nombre négatif minimal par moins un. + +## opérateur modulo(A, B), A % B {#moduloa-b-a-b-operator} + +Calcule le reste après la division. +Si les arguments sont des nombres à virgule flottante, ils sont pré-convertis en entiers en supprimant la partie décimale. +Le reste est pris dans le même sens qu’en C++. La division tronquée est utilisée pour les nombres négatifs. +Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. + +## moduloOrZero (a, b) {#moduloorzeroa-b} + +Diffère de ‘modulo’ en ce sens qu’il renvoie zéro lorsque le diviseur est nul. + +## annuler (a), - un opérateur {#negatea-a-operator} + +Calcule un nombre avec le signe inverse. Le résultat est toujours signé. + +## abs(un) {#arithm_func-abs} + +Calcule la valeur absolue d’un nombre (un). Autrement dit, si un \< 0, Il renvoie-A. pour les types non signés, il ne fait rien. Pour les types entiers signés, il renvoie un nombre non signé. + +## pgcd(a, b) {#gcda-b} + +Renvoie le plus grand diviseur commun des nombres. +Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. + +## ppcm(a, b) {#lcma-b} + +Renvoie le multiple le moins commun des nombres. +Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/fr/sql-reference/functions/array-functions.md b/docs/fr/sql-reference/functions/array-functions.md new file mode 100644 index 00000000000..d68a3ee2a68 --- /dev/null +++ b/docs/fr/sql-reference/functions/array-functions.md @@ -0,0 +1,1057 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 46 +toc_title: Travailler avec des tableaux +--- + +# Fonctions Pour Travailler Avec Des Tableaux {#functions-for-working-with-arrays} + +## vide {#function-empty} + +Retourne 1 pour un tableau vide, ou 0 pour un non-vide. +Le type de résultat est UInt8. +La fonction fonctionne également pour les chaînes. + +## notEmpty {#function-notempty} + +Retourne 0 pour un tableau vide, ou 1 pour un non-vide. +Le type de résultat est UInt8. +La fonction fonctionne également pour les chaînes. + +## longueur {#array_functions-length} + +Retourne le nombre d’éléments dans le tableau. +Le type de résultat est UInt64. +La fonction fonctionne également pour les chaînes. + +## emptyArrayUInt8, emptyArrayUInt16, emptyArrayUInt32, emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} + +## emptyArrayInt8, emptyArrayInt16, emptyArrayInt32, emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} + +## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} + +## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} + +## emptyArrayString {#emptyarraystring} + +Accepte zéro argument et renvoie un tableau vide du type approprié. + +## emptyArrayToSingle {#emptyarraytosingle} + +Accepte un tableau vide et renvoie un élément de tableau qui est égal à la valeur par défaut. + +## plage (fin), Plage(début, fin \[, étape\]) {#rangeend-rangestart-end-step} + +Retourne un tableau de nombres du début à la fin-1 par étape. +Si l’argument `start` n’est pas spécifié, la valeur par défaut est 0. +Si l’argument `step` n’est pas spécifié, la valeur par défaut est 1. +Il se comporte presque comme pythonic `range`. Mais la différence est que tous les types d’arguments doivent être `UInt` nombre. +Juste au cas où, une exception est levée si des tableaux d’une longueur totale de plus de 100 000 000 d’éléments sont créés dans un bloc de données. + +## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} + +Crée un tableau à partir des arguments de la fonction. +Les arguments doivent être des constantes et avoir des types qui ont le plus petit type commun. Au moins un argument doit être passé, sinon il n’est pas clair quel type de tableau créer. Qui est, vous ne pouvez pas utiliser cette fonction pour créer un tableau vide (pour ce faire, utilisez la ‘emptyArray\*’ la fonction décrite ci-dessus). +Retourne un ‘Array(T)’ type de résultat, où ‘T’ est le plus petit type commun parmi les arguments passés. + +## arrayConcat {#arrayconcat} + +Combine des tableaux passés comme arguments. + +``` sql +arrayConcat(arrays) +``` + +**Paramètre** + +- `arrays` – Arbitrary number of arguments of [Tableau](../../sql-reference/data-types/array.md) type. + **Exemple** + + + +``` sql +SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,3,4,5,6] │ +└───────────────┘ +``` + +## arrayElement(arr, n), opérateur arr\[n\] {#arrayelementarr-n-operator-arrn} + +Récupérer l’élément avec l’index `n` à partir du tableau `arr`. `n` doit être n’importe quel type entier. +Les index dans un tableau commencent à partir d’un. +Les index négatifs sont pris en charge. Dans ce cas, il sélectionne l’élément correspondant numérotées à partir de la fin. Exemple, `arr[-1]` est le dernier élément du tableau. + +Si l’index est en dehors des limites d’un tableau, il renvoie une valeur (0 pour les nombres, une chaîne vide pour les cordes, etc.), sauf pour le cas avec un tableau non constant et un index constant 0 (dans ce cas, il y aura une erreur `Array indices are 1-based`). + +## a (arr, elem) {#hasarr-elem} + +Vérifie si le ‘arr’ tableau a la ‘elem’ élément. +Retourne 0 si l’élément n’est pas dans le tableau, ou 1 si elle l’est. + +`NULL` est traitée comme une valeur. + +``` sql +SELECT has([1, 2, NULL], NULL) +``` + +``` text +┌─has([1, 2, NULL], NULL)─┐ +│ 1 │ +└─────────────────────────┘ +``` + +## hasAll {#hasall} + +Vérifie si un tableau est un sous-ensemble de l’autre. + +``` sql +hasAll(set, subset) +``` + +**Paramètre** + +- `set` – Array of any type with a set of elements. +- `subset` – Array of any type with elements that should be tested to be a subset of `set`. + +**Les valeurs de retour** + +- `1`, si `set` contient tous les éléments de `subset`. +- `0`, autrement. + +**Propriétés particulières** + +- Un tableau vide est un sous-ensemble d’un tableau quelconque. +- `Null` traitée comme une valeur. +- Ordre des valeurs dans les deux tableaux n’a pas d’importance. + +**Exemple** + +`SELECT hasAll([], [])` retours 1. + +`SELECT hasAll([1, Null], [Null])` retours 1. + +`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` retours 1. + +`SELECT hasAll(['a', 'b'], ['a'])` retours 1. + +`SELECT hasAll([1], ['a'])` renvoie 0. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` renvoie 0. + +## hasAny {#hasany} + +Vérifie si deux tableaux ont une intersection par certains éléments. + +``` sql +hasAny(array1, array2) +``` + +**Paramètre** + +- `array1` – Array of any type with a set of elements. +- `array2` – Array of any type with a set of elements. + +**Les valeurs de retour** + +- `1`, si `array1` et `array2` avoir un élément similaire au moins. +- `0`, autrement. + +**Propriétés particulières** + +- `Null` traitée comme une valeur. +- Ordre des valeurs dans les deux tableaux n’a pas d’importance. + +**Exemple** + +`SELECT hasAny([1], [])` retourner `0`. + +`SELECT hasAny([Null], [Null, 1])` retourner `1`. + +`SELECT hasAny([-128, 1., 512], [1])` retourner `1`. + +`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` retourner `0`. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` retourner `1`. + +## indexOf (arr, x) {#indexofarr-x} + +Renvoie l’index de la première ‘x’ élément (à partir de 1) s’il est dans le tableau, ou 0 s’il ne l’est pas. + +Exemple: + +``` sql +SELECT indexOf([1, 3, NULL, NULL], NULL) +``` + +``` text +┌─indexOf([1, 3, NULL, NULL], NULL)─┐ +│ 3 │ +└───────────────────────────────────┘ +``` + +Ensemble d’éléments de `NULL` sont traités comme des valeurs normales. + +## countEqual (arr, x) {#countequalarr-x} + +Renvoie le nombre d’éléments dans le tableau égal à X. équivalent à arrayCount (elem - \> elem = x, arr). + +`NULL` les éléments sont traités comme des valeurs distinctes. + +Exemple: + +``` sql +SELECT countEqual([1, 2, NULL, NULL], NULL) +``` + +``` text +┌─countEqual([1, 2, NULL, NULL], NULL)─┐ +│ 2 │ +└──────────────────────────────────────┘ +``` + +## arrayEnumerate (arr) {#array_functions-arrayenumerate} + +Returns the array \[1, 2, 3, …, length (arr) \] + +Cette fonction est normalement utilisée avec ARRAY JOIN. Il permet de compter quelque chose une seule fois pour chaque tableau après l’application de la jointure de tableau. Exemple: + +``` sql +SELECT + count() AS Reaches, + countIf(num = 1) AS Hits +FROM test.hits +ARRAY JOIN + GoalsReached, + arrayEnumerate(GoalsReached) AS num +WHERE CounterID = 160656 +LIMIT 10 +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +Dans cet exemple, Reaches est le nombre de conversions (les chaînes reçues après l’application de la jointure de tableau), et Hits est le nombre de pages vues (chaînes avant la jointure de tableau). Dans ce cas particulier, vous pouvez obtenir le même résultat dans une voie plus facile: + +``` sql +SELECT + sum(length(GoalsReached)) AS Reaches, + count() AS Hits +FROM test.hits +WHERE (CounterID = 160656) AND notEmpty(GoalsReached) +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +Cette fonction peut également être utilisée dans les fonctions d’ordre supérieur. Par exemple, vous pouvez l’utiliser pour obtenir les indices de tableau pour les éléments qui correspondent à une condition. + +## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} + +Renvoie un tableau de la même taille que le tableau source, indiquant pour chaque élément Quelle est sa position parmi les éléments de même valeur. +Par exemple: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. + +Cette fonction est utile lors de L’utilisation de la jointure de tableau et de l’agrégation d’éléments de tableau. +Exemple: + +``` sql +SELECT + Goals.ID AS GoalID, + sum(Sign) AS Reaches, + sumIf(Sign, num = 1) AS Visits +FROM test.visits +ARRAY JOIN + Goals, + arrayEnumerateUniq(Goals.ID) AS num +WHERE CounterID = 160656 +GROUP BY GoalID +ORDER BY Reaches DESC +LIMIT 10 +``` + +``` text +┌──GoalID─┬─Reaches─┬─Visits─┐ +│ 53225 │ 3214 │ 1097 │ +│ 2825062 │ 3188 │ 1097 │ +│ 56600 │ 2803 │ 488 │ +│ 1989037 │ 2401 │ 365 │ +│ 2830064 │ 2396 │ 910 │ +│ 1113562 │ 2372 │ 373 │ +│ 3270895 │ 2262 │ 812 │ +│ 1084657 │ 2262 │ 345 │ +│ 56599 │ 2260 │ 799 │ +│ 3271094 │ 2256 │ 812 │ +└─────────┴─────────┴────────┘ +``` + +Dans cet exemple, chaque ID d’objectif a un calcul du nombre de conversions (chaque élément de la structure de données imbriquées objectifs est un objectif atteint, que nous appelons une conversion) et le nombre de sessions. Sans array JOIN, nous aurions compté le nombre de sessions comme sum(signe). Mais dans ce cas particulier, les lignes ont été multipliées par la structure des objectifs imbriqués, donc pour compter chaque session une fois après cela, nous appliquons une condition à la valeur de arrayEnumerateUniq(Goals.ID) fonction. + +La fonction arrayEnumerateUniq peut prendre plusieurs tableaux de la même taille que les arguments. Dans ce cas, l’unicité est considérée pour les tuples d’éléments dans les mêmes positions dans tous les tableaux. + +``` sql +SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,1,1,2,1] │ +└───────────────┘ +``` + +Ceci est nécessaire lors de L’utilisation de Array JOIN avec une structure de données imbriquée et une agrégation supplémentaire entre plusieurs éléments de cette structure. + +## arrayPopBack {#arraypopback} + +Supprime le dernier élément du tableau. + +``` sql +arrayPopBack(array) +``` + +**Paramètre** + +- `array` – Array. + +**Exemple** + +``` sql +SELECT arrayPopBack([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## arrayPopFront {#arraypopfront} + +Supprime le premier élément de la matrice. + +``` sql +arrayPopFront(array) +``` + +**Paramètre** + +- `array` – Array. + +**Exemple** + +``` sql +SELECT arrayPopFront([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [2,3] │ +└───────┘ +``` + +## arrayPushBack {#arraypushback} + +Ajoute un élément à la fin du tableau. + +``` sql +arrayPushBack(array, single_value) +``` + +**Paramètre** + +- `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 pour le type de données du tableau. Pour plus d’informations sur les types de données dans ClickHouse, voir “[Types de données](../../sql-reference/data-types/index.md#data_types)”. Peut être `NULL`. La fonction ajoute un `NULL` tableau, et le type d’éléments de tableau convertit en `Nullable`. + +**Exemple** + +``` sql +SELECT arrayPushBack(['a'], 'b') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayPushFront {#arraypushfront} + +Ajoute un élément au début du tableau. + +``` sql +arrayPushFront(array, single_value) +``` + +**Paramètre** + +- `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 pour le type de données du tableau. Pour plus d’informations sur les types de données dans ClickHouse, voir “[Types de données](../../sql-reference/data-types/index.md#data_types)”. Peut être `NULL`. La fonction ajoute un `NULL` tableau, et le type d’éléments de tableau convertit en `Nullable`. + +**Exemple** + +``` sql +SELECT arrayPushFront(['b'], 'a') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayResize {#arrayresize} + +Les changements de la longueur du tableau. + +``` sql +arrayResize(array, size[, extender]) +``` + +**Paramètre:** + +- `array` — Array. +- `size` — Required length of the array. + - Si `size` est inférieure à la taille d’origine du tableau, le tableau est tronqué à partir de la droite. +- Si `size` est plus grande que la taille initiale du tableau, le tableau est étendu vers la droite avec `extender` valeurs ou valeurs par défaut pour le type de données des éléments du tableau. +- `extender` — Value for extending an array. Can be `NULL`. + +**Valeur renvoyée:** + +Un tableau de longueur `size`. + +**Exemples d’appels** + +``` sql +SELECT arrayResize([1], 3) +``` + +``` text +┌─arrayResize([1], 3)─┐ +│ [1,0,0] │ +└─────────────────────┘ +``` + +``` sql +SELECT arrayResize([1], 3, NULL) +``` + +``` text +┌─arrayResize([1], 3, NULL)─┐ +│ [1,NULL,NULL] │ +└───────────────────────────┘ +``` + +## arraySlice {#arrayslice} + +Retourne une tranche du tableau. + +``` sql +arraySlice(array, offset[, length]) +``` + +**Paramètre** + +- `array` – Array of data. +- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. +- `length` - La longueur de la nécessaire tranche. Si vous spécifiez une valeur négative, la fonction renvoie un ouvert tranche `[offset, array_length - length)`. Si vous omettez la valeur, la fonction renvoie la tranche `[offset, the_end_of_array]`. + +**Exemple** + +``` sql +SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res +``` + +``` text +┌─res────────┐ +│ [2,NULL,4] │ +└────────────┘ +``` + +Éléments de tableau définis sur `NULL` sont traités comme des valeurs normales. + +## arraySort(\[func,\] arr, …) {#array_functions-sort} + +Trie les éléments de la `arr` tableau dans l’ordre croissant. Si l’ `func` fonction est spécifiée, l’ordre de tri est déterminé par le résultat de la `func` fonction appliquée aux éléments du tableau. Si `func` accepte plusieurs arguments, le `arraySort` la fonction est passé plusieurs tableaux que les arguments de `func` correspond à. Des exemples détaillés sont présentés à la fin de `arraySort` Description. + +Exemple de tri de valeurs entières: + +``` sql +SELECT arraySort([1, 3, 3, 0]); +``` + +``` text +┌─arraySort([1, 3, 3, 0])─┐ +│ [0,1,3,3] │ +└─────────────────────────┘ +``` + +Exemple de tri des valeurs de chaîne: + +``` sql +SELECT arraySort(['hello', 'world', '!']); +``` + +``` text +┌─arraySort(['hello', 'world', '!'])─┐ +│ ['!','hello','world'] │ +└────────────────────────────────────┘ +``` + +Considérez l’ordre de tri suivant pour le `NULL`, `NaN` et `Inf` valeur: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); +``` + +``` text +┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ +│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────────────────────────┘ +``` + +- `-Inf` les valeurs sont d’abord dans le tableau. +- `NULL` les valeurs sont les derniers dans le tableau. +- `NaN` les valeurs sont juste avant `NULL`. +- `Inf` les valeurs sont juste avant `NaN`. + +Notez que `arraySort` est un [fonction d’ordre supérieur](higher-order-functions.md). Vous pouvez passer d’une fonction lambda comme premier argument. Dans ce cas, l’ordre de classement est déterminé par le résultat de la fonction lambda appliquée aux éléments de la matrice. + +Considérons l’exemple suivant: + +``` sql +SELECT arraySort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,2,1] │ +└─────────┘ +``` + +For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` fonction trie les touches dans l’ordre croissant, le résultat est \[3, 2, 1\]. Ainsi, l’ `(x) –> -x` fonction lambda définit le [l’ordre décroissant](#array_functions-reverse-sort) dans un tri. + +La fonction lambda peut accepter plusieurs arguments. Dans ce cas, vous avez besoin de passer l’ `arraySort` fonction plusieurs tableaux de longueur identique à laquelle correspondront les arguments de la fonction lambda. Le tableau résultant sera composé d’éléments du premier tableau d’entrée; les éléments du(des) Tableau (s) d’entrée suivant (s) spécifient les clés de tri. Exemple: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Ici, les éléments qui sont passés dans le deuxième tableau (\[2, 1\]) définissent une clé de tri pour l’élément correspondant à partir du tableau source (\[‘hello’, ‘world’\]), qui est, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn’t use `x`, les valeurs réelles du tableau source n’affectent pas l’ordre dans le résultat. Si, ‘hello’ sera le deuxième élément du résultat, et ‘world’ sera le premier. + +D’autres exemples sont présentés ci-dessous. + +``` sql +SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +``` sql +SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +!!! note "Note" + Pour améliorer l’efficacité du tri, de la [Transformation schwartzienne](https://en.wikipedia.org/wiki/Schwartzian_transform) est utilisée. + +## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} + +Trie les éléments de la `arr` tableau dans l’ordre décroissant. Si l’ `func` la fonction est spécifiée, `arr` est trié en fonction du résultat de la `func` fonction appliquée aux éléments du tableau, puis le tableau trié est inversé. Si `func` accepte plusieurs arguments, le `arrayReverseSort` la fonction est passé plusieurs tableaux que les arguments de `func` correspond à. Des exemples détaillés sont présentés à la fin de `arrayReverseSort` Description. + +Exemple de tri de valeurs entières: + +``` sql +SELECT arrayReverseSort([1, 3, 3, 0]); +``` + +``` text +┌─arrayReverseSort([1, 3, 3, 0])─┐ +│ [3,3,1,0] │ +└────────────────────────────────┘ +``` + +Exemple de tri des valeurs de chaîne: + +``` sql +SELECT arrayReverseSort(['hello', 'world', '!']); +``` + +``` text +┌─arrayReverseSort(['hello', 'world', '!'])─┐ +│ ['world','hello','!'] │ +└───────────────────────────────────────────┘ +``` + +Considérez l’ordre de tri suivant pour le `NULL`, `NaN` et `Inf` valeur: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; +``` + +``` text +┌─res───────────────────────────────────┐ +│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────┘ +``` + +- `Inf` les valeurs sont d’abord dans le tableau. +- `NULL` les valeurs sont les derniers dans le tableau. +- `NaN` les valeurs sont juste avant `NULL`. +- `-Inf` les valeurs sont juste avant `NaN`. + +Notez que l’ `arrayReverseSort` est un [fonction d’ordre supérieur](higher-order-functions.md). Vous pouvez passer d’une fonction lambda comme premier argument. Exemple est montré ci-dessous. + +``` sql +SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [1,2,3] │ +└─────────┘ +``` + +Le tableau est trié de la façon suivante: + +1. Dans un premier temps, le tableau source (\[1, 2, 3\]) est trié en fonction du résultat de la fonction lambda appliquée aux éléments du tableau. Le résultat est un tableau \[3, 2, 1\]. +2. Tableau qui est obtenu à l’étape précédente, est renversé. Donc, le résultat final est \[1, 2, 3\]. + +La fonction lambda peut accepter plusieurs arguments. Dans ce cas, vous avez besoin de passer l’ `arrayReverseSort` fonction plusieurs tableaux de longueur identique à laquelle correspondront les arguments de la fonction lambda. Le tableau résultant sera composé d’éléments du premier tableau d’entrée; les éléments du(des) Tableau (s) d’entrée suivant (s) spécifient les clés de tri. Exemple: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +Dans cet exemple, le tableau est trié de la façon suivante: + +1. Au début, le tableau source (\[‘hello’, ‘world’\]) est triée selon le résultat de la fonction lambda appliquée aux éléments de tableaux. Les éléments qui sont passés dans le deuxième tableau (\[2, 1\]), définissent les clés de tri pour les éléments correspondants du tableau source. Le résultat est un tableau \[‘world’, ‘hello’\]. +2. Tableau trié lors de l’étape précédente, est renversé. Donc, le résultat final est \[‘hello’, ‘world’\]. + +D’autres exemples sont présentés ci-dessous. + +``` sql +SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; +``` + +``` text +┌─res─────┐ +│ [5,3,4] │ +└─────────┘ +``` + +``` sql +SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; +``` + +``` text +┌─res─────┐ +│ [4,3,5] │ +└─────────┘ +``` + +## arrayUniq(arr, …) {#arrayuniqarr} + +Si un argument est passé, il compte le nombre de différents éléments dans le tableau. +Si plusieurs arguments sont passés, il compte le nombre de tuples différents d’éléments aux positions correspondantes dans plusieurs tableaux. + +Si vous souhaitez obtenir une liste des éléments dans un tableau, vous pouvez utiliser arrayReduce(‘groupUniqArray’, arr). + +## arrayJoin (arr) {#array-functions-join} + +Une fonction spéciale. Voir la section [“ArrayJoin function”](array-join.md#functions_arrayjoin). + +## tableaudifférence {#arraydifference} + +Calcule la différence entre les éléments de tableau adjacents. Renvoie un tableau où le premier élément sera 0, le second est la différence entre `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). + +**Syntaxe** + +``` sql +arrayDifference(array) +``` + +**Paramètre** + +- `array` – [Tableau](https://clickhouse.yandex/docs/en/data_types/array/). + +**Valeurs renvoyées** + +Renvoie un tableau de différences entre les éléments adjacents. + +Type: [UInt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [Flottant\*](https://clickhouse.yandex/docs/en/data_types/float/). + +**Exemple** + +Requête: + +``` sql +SELECT arrayDifference([1, 2, 3, 4]) +``` + +Résultat: + +``` text +┌─arrayDifference([1, 2, 3, 4])─┐ +│ [0,1,1,1] │ +└───────────────────────────────┘ +``` + +Exemple de débordement dû au type de résultat Int64: + +Requête: + +``` sql +SELECT arrayDifference([0, 10000000000000000000]) +``` + +Résultat: + +``` text +┌─arrayDifference([0, 10000000000000000000])─┐ +│ [0,-8446744073709551616] │ +└────────────────────────────────────────────┘ +``` + +## arrayDistinct {#arraydistinct} + +Prend un tableau, retourne un tableau contenant les différents éléments seulement. + +**Syntaxe** + +``` sql +arrayDistinct(array) +``` + +**Paramètre** + +- `array` – [Tableau](https://clickhouse.yandex/docs/en/data_types/array/). + +**Valeurs renvoyées** + +Retourne un tableau contenant les éléments distincts. + +**Exemple** + +Requête: + +``` sql +SELECT arrayDistinct([1, 2, 2, 3, 1]) +``` + +Résultat: + +``` text +┌─arrayDistinct([1, 2, 2, 3, 1])─┐ +│ [1,2,3] │ +└────────────────────────────────┘ +``` + +## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} + +Renvoie un tableau de la même taille que le tableau source, indiquant où chaque élément apparaît en premier dans le tableau source. + +Exemple: + +``` sql +SELECT arrayEnumerateDense([10, 20, 10, 30]) +``` + +``` text +┌─arrayEnumerateDense([10, 20, 10, 30])─┐ +│ [1,2,1,3] │ +└───────────────────────────────────────┘ +``` + +## arrayIntersect (arr) {#array-functions-arrayintersect} + +Prend plusieurs tableaux, retourne un tableau avec des éléments présents dans tous les tableaux source. L’ordre des éléments dans le tableau résultant est le même que dans le premier tableau. + +Exemple: + +``` sql +SELECT + arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, + arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect +``` + +``` text +┌─no_intersect─┬─intersect─┐ +│ [] │ [1] │ +└──────────────┴───────────┘ +``` + +## arrayReduce {#arrayreduce} + +Applique une fonction d’agrégation aux éléments du tableau et renvoie son résultat. Le nom de la fonction d’agrégation est passé sous forme de chaîne entre guillemets simples `'max'`, `'sum'`. Lorsque vous utilisez des fonctions d’agrégat paramétriques, le paramètre est indiqué après le nom de la fonction entre parenthèses `'uniqUpTo(6)'`. + +**Syntaxe** + +``` sql +arrayReduce(agg_func, arr1, arr2, ..., arrN) +``` + +**Paramètre** + +- `agg_func` — The name of an aggregate function which should be a constant [chaîne](../../sql-reference/data-types/string.md). +- `arr` — Any number of [tableau](../../sql-reference/data-types/array.md) tapez les colonnes comme paramètres de la fonction d’agrégation. + +**Valeur renvoyée** + +**Exemple** + +``` sql +SELECT arrayReduce('max', [1, 2, 3]) +``` + +``` text +┌─arrayReduce('max', [1, 2, 3])─┐ +│ 3 │ +└───────────────────────────────┘ +``` + +Si une fonction d’agrégation prend plusieurs arguments, cette fonction doit être appliqué à plusieurs ensembles de même taille. + +``` sql +SELECT arrayReduce('maxIf', [3, 5], [1, 0]) +``` + +``` text +┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ +│ 3 │ +└──────────────────────────────────────┘ +``` + +Exemple avec une fonction d’agrégat paramétrique: + +``` sql +SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) +``` + +``` text +┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ +│ 4 │ +└─────────────────────────────────────────────────────────────┘ +``` + +## arrayReduceInRanges {#arrayreduceinranges} + +Applique une fonction d’agrégation d’éléments de tableau dans des plages et retourne un tableau contenant le résultat correspondant à chaque gamme. La fonction retourne le même résultat que plusieurs `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. + +**Syntaxe** + +``` sql +arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) +``` + +**Paramètre** + +- `agg_func` — The name of an aggregate function which should be a constant [chaîne](../../sql-reference/data-types/string.md). +- `ranges` — The ranges to aggretate which should be an [tableau](../../sql-reference/data-types/array.md) de [tuple](../../sql-reference/data-types/tuple.md) qui contient l’indice et la longueur de chaque plage. +- `arr` — Any number of [tableau](../../sql-reference/data-types/array.md) tapez les colonnes comme paramètres de la fonction d’agrégation. + +**Valeur renvoyée** + +**Exemple** + +``` sql +SELECT arrayReduceInRanges( + 'sum', + [(1, 5), (2, 3), (3, 4), (4, 4)], + [1000000, 200000, 30000, 4000, 500, 60, 7] +) AS res +``` + +``` text +┌─res─────────────────────────┐ +│ [1234500,234000,34560,4567] │ +└─────────────────────────────┘ +``` + +## arrayReverse(arr) {#arrayreverse} + +Retourne un tableau de la même taille que l’original tableau contenant les éléments dans l’ordre inverse. + +Exemple: + +``` sql +SELECT arrayReverse([1, 2, 3]) +``` + +``` text +┌─arrayReverse([1, 2, 3])─┐ +│ [3,2,1] │ +└─────────────────────────┘ +``` + +## inverse (arr) {#array-functions-reverse} + +Synonyme de [“arrayReverse”](#array_functions-arrayreverse) + +## arrayFlatten {#arrayflatten} + +Convertit un tableau de tableaux dans un tableau associatif. + +Fonction: + +- S’applique à toute profondeur de tableaux imbriqués. +- Ne change pas les tableaux qui sont déjà plats. + +Le tableau aplati contient tous les éléments de tous les tableaux source. + +**Syntaxe** + +``` sql +flatten(array_of_arrays) +``` + +Alias: `flatten`. + +**Paramètre** + +- `array_of_arrays` — [Tableau](../../sql-reference/data-types/array.md) de tableaux. Exemple, `[[1,2,3], [4,5]]`. + +**Exemple** + +``` sql +SELECT flatten([[[1]], [[2], [3]]]) +``` + +``` text +┌─flatten(array(array([1]), array([2], [3])))─┐ +│ [1,2,3] │ +└─────────────────────────────────────────────┘ +``` + +## arrayCompact {#arraycompact} + +Supprime les éléments en double consécutifs d’un tableau. L’ordre des valeurs de résultat est déterminée par l’ordre dans le tableau source. + +**Syntaxe** + +``` sql +arrayCompact(arr) +``` + +**Paramètre** + +`arr` — The [tableau](../../sql-reference/data-types/array.md) inspecter. + +**Valeur renvoyée** + +Le tableau sans doublon. + +Type: `Array`. + +**Exemple** + +Requête: + +``` sql +SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) +``` + +Résultat: + +``` text +┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ +│ [1,nan,nan,2,3] │ +└────────────────────────────────────────────┘ +``` + +## arrayZip {#arrayzip} + +Combine multiple Array type columns into one Array\[Tuple(…)\] column + +**Syntaxe** + +``` sql +arrayZip(arr1, arr2, ..., arrN) +``` + +**Paramètre** + +`arr` — Any number of [tableau](../../sql-reference/data-types/array.md) tapez les colonnes à combiner. + +**Valeur renvoyée** + +The result of Array\[Tuple(…)\] type after the combination of these arrays + +**Exemple** + +Requête: + +``` sql +SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); +``` + +Résultat: + +``` text +┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ +│ [('a','d'),('b','e'),('c','f')] │ +└────────────────────────────────────────────┘ +``` + +## arrayAUC {#arrayauc} + +Calculer AUC (zone sous la courbe, qui est un concept dans l’apprentissage automatique, voir plus de détails: https://en.wikipedia.org/wiki/Receiver\_operating\_characteristic\#Area\_under\_the\_curve). + +**Syntaxe** + +``` sql +arrayAUC(arr_scores, arr_labels) +``` + +**Paramètre** +- `arr_scores` — scores prediction model gives. +- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. + +**Valeur renvoyée** +Renvoie la valeur AUC avec le type Float64. + +**Exemple** +Requête: + +``` sql +select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) +``` + +Résultat: + +``` text +┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ +│ 0.75 │ +└────────────────────────────────────────---──┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/fr/sql-reference/functions/array-join.md b/docs/fr/sql-reference/functions/array-join.md new file mode 100644 index 00000000000..7ca16e59702 --- /dev/null +++ b/docs/fr/sql-reference/functions/array-join.md @@ -0,0 +1,37 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 61 +toc_title: arrayJoin +--- + +# fonction arrayJoin {#functions_arrayjoin} + +C’est un très inhabituelle de la fonction. + +Les fonctions normales ne modifient pas un ensemble de lignes, mais modifient simplement les valeurs de chaque ligne (map). +Les fonctions d’agrégation compriment un ensemble de lignes (plier ou réduire). +Le ‘arrayJoin’ la fonction prend chaque ligne et génère un ensemble de lignes (dépliante). + +Cette fonction prend un tableau comme argument et propage la ligne source à plusieurs lignes pour le nombre d’éléments dans le tableau. +Toutes les valeurs des colonnes sont simplement copiés, sauf les valeurs dans la colonne où cette fonction est appliquée; elle est remplacée par la valeur correspondante de tableau. + +Une requête peut utiliser plusieurs `arrayJoin` fonction. Dans ce cas, la transformation est effectuée plusieurs fois. + +Notez la syntaxe de jointure de tableau dans la requête SELECT, qui offre des possibilités plus larges. + +Exemple: + +``` sql +SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src +``` + +``` text +┌─dst─┬─\'Hello\'─┬─src─────┐ +│ 1 │ Hello │ [1,2,3] │ +│ 2 │ Hello │ [1,2,3] │ +│ 3 │ Hello │ [1,2,3] │ +└─────┴───────────┴─────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/array_join/) diff --git a/docs/fr/sql-reference/functions/bit-functions.md b/docs/fr/sql-reference/functions/bit-functions.md new file mode 100644 index 00000000000..bf79b8bf1a9 --- /dev/null +++ b/docs/fr/sql-reference/functions/bit-functions.md @@ -0,0 +1,255 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 48 +toc_title: Bit +--- + +# Peu De Fonctions {#bit-functions} + +Les fonctions Bit fonctionnent pour n’importe quelle paire de types de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 ou Float64. + +Le type de résultat est un entier avec des bits égaux aux bits maximum de ses arguments. Si au moins l’un des arguments est signé, le résultat est un signé nombre. Si un argument est un nombre à virgule flottante, Il est converti en Int64. + +## bitAnd (a, b) {#bitanda-b} + +## bitOr (a, b) {#bitora-b} + +## bitXor (a, b) {#bitxora-b} + +## bitNot (a) {#bitnota} + +## bitShiftLeft (A, b) {#bitshiftlefta-b} + +## bitShiftRight (A, b) {#bitshiftrighta-b} + +## bitRotateLeft (a, b) {#bitrotatelefta-b} + +## bitRotateRight (a, b) {#bitrotaterighta-b} + +## bitTest {#bittest} + +Prend tout entier et le convertit en [forme binaire](https://en.wikipedia.org/wiki/Binary_number) renvoie la valeur d’un bit à la position spécifiée. Le compte à rebours commence à partir de 0 de la droite vers la gauche. + +**Syntaxe** + +``` sql +SELECT bitTest(number, index) +``` + +**Paramètre** + +- `number` – integer number. +- `index` – position of bit. + +**Valeurs renvoyées** + +Renvoie une valeur de bit à la position spécifiée. + +Type: `UInt8`. + +**Exemple** + +Par exemple, le nombre 43 dans le système numérique de base-2 (binaire) est 101011. + +Requête: + +``` sql +SELECT bitTest(43, 1) +``` + +Résultat: + +``` text +┌─bitTest(43, 1)─┐ +│ 1 │ +└────────────────┘ +``` + +Un autre exemple: + +Requête: + +``` sql +SELECT bitTest(43, 2) +``` + +Résultat: + +``` text +┌─bitTest(43, 2)─┐ +│ 0 │ +└────────────────┘ +``` + +## bitTestAll {#bittestall} + +Renvoie le résultat de [logique de conjonction](https://en.wikipedia.org/wiki/Logical_conjunction) (Et opérateur) de tous les bits à des positions données. Le compte à rebours commence à partir de 0 de la droite vers la gauche. + +La conjonction pour les opérations bit à bit: + +0 AND 0 = 0 + +0 AND 1 = 0 + +1 AND 0 = 0 + +1 AND 1 = 1 + +**Syntaxe** + +``` sql +SELECT bitTestAll(number, index1, index2, index3, index4, ...) +``` + +**Paramètre** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) est vrai si et seulement si toutes ses positions sont remplies (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). + +**Valeurs renvoyées** + +Retourne le résultat de la conjonction logique. + +Type: `UInt8`. + +**Exemple** + +Par exemple, le nombre 43 dans le système numérique de base-2 (binaire) est 101011. + +Requête: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5) +``` + +Résultat: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5)─┐ +│ 1 │ +└────────────────────────────┘ +``` + +Un autre exemple: + +Requête: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5, 2) +``` + +Résultat: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ +│ 0 │ +└───────────────────────────────┘ +``` + +## bitTestAny {#bittestany} + +Renvoie le résultat de [disjonction logique](https://en.wikipedia.org/wiki/Logical_disjunction) (Ou opérateur) de tous les bits à des positions données. Le compte à rebours commence à partir de 0 de la droite vers la gauche. + +La disjonction pour les opérations binaires: + +0 OR 0 = 0 + +0 OR 1 = 1 + +1 OR 0 = 1 + +1 OR 1 = 1 + +**Syntaxe** + +``` sql +SELECT bitTestAny(number, index1, index2, index3, index4, ...) +``` + +**Paramètre** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. + +**Valeurs renvoyées** + +Renvoie le résultat de la disjuction logique. + +Type: `UInt8`. + +**Exemple** + +Par exemple, le nombre 43 dans le système numérique de base-2 (binaire) est 101011. + +Requête: + +``` sql +SELECT bitTestAny(43, 0, 2) +``` + +Résultat: + +``` text +┌─bitTestAny(43, 0, 2)─┐ +│ 1 │ +└──────────────────────┘ +``` + +Un autre exemple: + +Requête: + +``` sql +SELECT bitTestAny(43, 4, 2) +``` + +Résultat: + +``` text +┌─bitTestAny(43, 4, 2)─┐ +│ 0 │ +└──────────────────────┘ +``` + +## bitCount {#bitcount} + +Calcule le nombre de bits mis à un dans la représentation binaire d’un nombre. + +**Syntaxe** + +``` sql +bitCount(x) +``` + +**Paramètre** + +- `x` — [Entier](../../sql-reference/data-types/int-uint.md) ou [virgule flottante](../../sql-reference/data-types/float.md) nombre. La fonction utilise la représentation de la valeur en mémoire. Il permet de financer les nombres à virgule flottante. + +**Valeur renvoyée** + +- Nombre de bits défini sur un dans le numéro d’entrée. + +La fonction ne convertit pas la valeur d’entrée en un type plus grand ([l’extension du signe](https://en.wikipedia.org/wiki/Sign_extension)). Ainsi, par exemple, `bitCount(toUInt8(-1)) = 8`. + +Type: `UInt8`. + +**Exemple** + +Prenez par exemple le numéro 333. Sa représentation binaire: 0000000101001101. + +Requête: + +``` sql +SELECT bitCount(333) +``` + +Résultat: + +``` text +┌─bitCount(333)─┐ +│ 5 │ +└───────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/fr/sql-reference/functions/bitmap-functions.md b/docs/fr/sql-reference/functions/bitmap-functions.md new file mode 100644 index 00000000000..03930d94c14 --- /dev/null +++ b/docs/fr/sql-reference/functions/bitmap-functions.md @@ -0,0 +1,496 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 49 +toc_title: Bitmap +--- + +# Fonctions De Bitmap {#bitmap-functions} + +Les fonctions Bitmap fonctionnent pour le calcul de la valeur de L’objet de deux bitmaps, il s’agit de renvoyer un nouveau bitmap ou une cardinalité tout en utilisant le calcul de la formule, tel que and, or, xor, and not, etc. + +Il existe 2 types de méthodes de construction pour L’objet Bitmap. L’un doit être construit par la fonction d’agrégation groupBitmap avec-State, l’autre doit être construit par L’objet Array. Il est également de convertir L’objet Bitmap en objet tableau. + +RoaringBitmap est enveloppé dans une structure de données pendant le stockage réel des objets Bitmap. Lorsque la cardinalité est inférieure ou égale à 32, elle utilise Set objet. Lorsque la cardinalité est supérieure à 32, elle utilise l’objet RoaringBitmap. C’est pourquoi le stockage de faible cardinalité jeu est plus rapide. + +Pour plus d’informations sur RoaringBitmap, voir: [CRoaring](https://github.com/RoaringBitmap/CRoaring). + +## bitmapBuild {#bitmap_functions-bitmapbuild} + +Construire un bitmap à partir d’un tableau entier non signé. + +``` sql +bitmapBuild(array) +``` + +**Paramètre** + +- `array` – unsigned integer array. + +**Exemple** + +``` sql +SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) +``` + +``` text +┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ +│  │ AggregateFunction(groupBitmap, UInt8) │ +└─────┴──────────────────────────────────────────────┘ +``` + +## bitmapToArray {#bitmaptoarray} + +Convertir bitmap en tableau entier. + +``` sql +bitmapToArray(bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapSubsetInRange {#bitmap-functions-bitmapsubsetinrange} + +Retourne le sous-ensemble dans la plage spécifiée (n’inclut pas le range\_end). + +``` sql +bitmapSubsetInRange(bitmap, range_start, range_end) +``` + +**Paramètre** + +- `bitmap` – [Objet Bitmap](#bitmap_functions-bitmapbuild). +- `range_start` – range start point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `range_end` – range end point(excluded). Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +``` sql +SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +``` text +┌─res───────────────┐ +│ [30,31,32,33,100] │ +└───────────────────┘ +``` + +## bitmapSubsetLimit {#bitmapsubsetlimit} + +Crée un sous-ensemble de bitmap avec n éléments pris entre `range_start` et `cardinality_limit`. + +**Syntaxe** + +``` sql +bitmapSubsetLimit(bitmap, range_start, cardinality_limit) +``` + +**Paramètre** + +- `bitmap` – [Objet Bitmap](#bitmap_functions-bitmapbuild). +- `range_start` – The subset starting point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**Valeur renvoyée** + +Ensemble. + +Type: `Bitmap object`. + +**Exemple** + +Requête: + +``` sql +SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +Résultat: + +``` text +┌─res───────────────────────┐ +│ [30,31,32,33,100,200,500] │ +└───────────────────────────┘ +``` + +## bitmapContains {#bitmap_functions-bitmapcontains} + +Vérifie si le bitmap contient un élément. + +``` sql +bitmapContains(haystack, needle) +``` + +**Paramètre** + +- `haystack` – [Objet Bitmap](#bitmap_functions-bitmapbuild) où la fonction recherche. +- `needle` – Value that the function searches. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**Valeurs renvoyées** + +- 0 — If `haystack` ne contient pas de `needle`. +- 1 — If `haystack` contenir `needle`. + +Type: `UInt8`. + +**Exemple** + +``` sql +SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAny {#bitmaphasany} + +Vérifie si deux bitmaps ont une intersection par certains éléments. + +``` sql +bitmapHasAny(bitmap1, bitmap2) +``` + +Si vous êtes sûr que `bitmap2` contient strictement un élément, envisagez d’utiliser le [bitmapContains](#bitmap_functions-bitmapcontains) fonction. Cela fonctionne plus efficacement. + +**Paramètre** + +- `bitmap*` – bitmap object. + +**Les valeurs de retour** + +- `1`, si `bitmap1` et `bitmap2` avoir un élément similaire au moins. +- `0`, autrement. + +**Exemple** + +``` sql +SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAll {#bitmaphasall} + +Analogue à `hasAll(array, array)` renvoie 1 si le premier bitmap contient tous les éléments du second, 0 sinon. +Si le deuxième argument est un bitmap vide, alors renvoie 1. + +``` sql +bitmapHasAll(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 0 │ +└─────┘ +``` + +## bitmapCardinality {#bitmapcardinality} + +Retrun bitmap cardinalité de type UInt64. + +``` sql +bitmapCardinality(bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapMin {#bitmapmin} + +Retrun la plus petite valeur de type UInt64 dans l’ensemble, UINT32\_MAX si l’ensemble est vide. + + bitmapMin(bitmap) + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## bitmapMax {#bitmapmax} + +Retrun la plus grande valeur de type UInt64 dans l’ensemble, 0 si l’ensemble est vide. + + bitmapMax(bitmap) + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## bitmapTransform {#bitmaptransform} + +Transformer un tableau de valeurs d’une image à l’autre tableau de valeurs, le résultat est une nouvelle image. + + bitmapTransform(bitmap, from_array, to_array) + +**Paramètre** + +- `bitmap` – bitmap object. +- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. +- `to_array` – UInt32 array, its size shall be the same to from\_array. + +**Exemple** + +``` sql +SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res +``` + + ┌─res───────────────────┐ + │ [1,3,4,6,7,8,9,10,20] │ + └───────────────────────┘ + +## bitmapAnd {#bitmapand} + +Deux bitmap et calcul, le résultat est un nouveau bitmap. + +``` sql +bitmapAnd(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─┐ +│ [3] │ +└─────┘ +``` + +## bitmapOr {#bitmapor} + +Deux bitmap ou calcul, le résultat est un nouveau bitmap. + +``` sql +bitmapOr(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapXor {#bitmapxor} + +Deux bitmap xor calcul, le résultat est une nouvelle image. + +``` sql +bitmapXor(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,4,5] │ +└───────────┘ +``` + +## bitmapetnot {#bitmapandnot} + +Deux Bitmap andnot calcul, le résultat est un nouveau bitmap. + +``` sql +bitmapAndnot(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## bitmapetcardinalité {#bitmapandcardinality} + +Deux bitmap et calcul, retour cardinalité de type UInt64. + +``` sql +bitmapAndCardinality(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapOrCardinality {#bitmaporcardinality} + +Deux bitmap ou calcul, retour cardinalité de type UInt64. + +``` sql +bitmapOrCardinality(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapXorCardinality {#bitmapxorcardinality} + +Deux bitmap XOR calcul, retour cardinalité de type UInt64. + +``` sql +bitmapXorCardinality(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 4 │ +└─────┘ +``` + +## bitmapetnotcardinality {#bitmapandnotcardinality} + +Deux bitmap andnot calcul, retour cardinalité de type UInt64. + +``` sql +bitmapAndnotCardinality(bitmap,bitmap) +``` + +**Paramètre** + +- `bitmap` – bitmap object. + +**Exemple** + +``` sql +SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 2 │ +└─────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/fr/sql-reference/functions/comparison-functions.md b/docs/fr/sql-reference/functions/comparison-functions.md new file mode 100644 index 00000000000..134511914df --- /dev/null +++ b/docs/fr/sql-reference/functions/comparison-functions.md @@ -0,0 +1,37 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 36 +toc_title: Comparaison +--- + +# Fonctions De Comparaison {#comparison-functions} + +Les fonctions de comparaison renvoient toujours 0 ou 1 (Uint8). + +Les types suivants peuvent être comparés: + +- nombre +- cordes et cordes fixes +- date +- dates avec heures + +au sein de chaque groupe, mais pas entre différents groupes. + +Par exemple, vous ne pouvez pas comparer une date avec une chaîne. Vous devez utiliser une fonction pour convertir la chaîne en une date, ou vice versa. + +Les chaînes sont comparées par octets. Une courte chaîne est plus petite que toutes les chaînes qui commencent par elle et qui contiennent au moins un caractère de plus. + +## égal, A = B et a = = b opérateur {#function-equals} + +## notEquals, a ! opérateur= b et a \<\> b {#function-notequals} + +## moins, opérateur \< {#function-less} + +## de plus, \> opérateur {#function-greater} + +## lessOrEquals, \< = opérateur {#function-lessorequals} + +## greaterOrEquals, \> = opérateur {#function-greaterorequals} + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) diff --git a/docs/fr/sql-reference/functions/conditional-functions.md b/docs/fr/sql-reference/functions/conditional-functions.md new file mode 100644 index 00000000000..55c5109c6a9 --- /dev/null +++ b/docs/fr/sql-reference/functions/conditional-functions.md @@ -0,0 +1,207 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 43 +toc_title: 'Conditionnel ' +--- + +# Fonctions Conditionnelles {#conditional-functions} + +## si {#if} + +Contrôle la ramification conditionnelle. Contrairement à la plupart des systèmes, ClickHouse évalue toujours les deux expressions `then` et `else`. + +**Syntaxe** + +``` sql +SELECT if(cond, then, else) +``` + +Si la condition `cond` renvoie une valeur non nulle, retourne le résultat de l’expression `then` et le résultat de l’expression `else`, si présent, est ignoré. Si l’ `cond` est égal à zéro ou `NULL` alors le résultat de la `then` l’expression est ignorée et le résultat de `else` expression, si elle est présente, est renvoyée. + +**Paramètre** + +- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. +- `then` - L’expression à renvoyer si la condition est remplie. +- `else` - L’expression à renvoyer si la condition n’est pas remplie. + +**Valeurs renvoyées** + +La fonction s’exécute `then` et `else` expressions et retourne son résultat, selon que la condition `cond` fini par être zéro ou pas. + +**Exemple** + +Requête: + +``` sql +SELECT if(1, plus(2, 2), plus(2, 6)) +``` + +Résultat: + +``` text +┌─plus(2, 2)─┐ +│ 4 │ +└────────────┘ +``` + +Requête: + +``` sql +SELECT if(0, plus(2, 2), plus(2, 6)) +``` + +Résultat: + +``` text +┌─plus(2, 6)─┐ +│ 8 │ +└────────────┘ +``` + +- `then` et `else` doit avoir le type commun le plus bas. + +**Exemple:** + +Prendre cette `LEFT_RIGHT` table: + +``` sql +SELECT * +FROM LEFT_RIGHT + +┌─left─┬─right─┐ +│ ᴺᵁᴸᴸ │ 4 │ +│ 1 │ 3 │ +│ 2 │ 2 │ +│ 3 │ 1 │ +│ 4 │ ᴺᵁᴸᴸ │ +└──────┴───────┘ +``` + +La requête suivante compare `left` et `right` valeur: + +``` sql +SELECT + left, + right, + if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller +FROM LEFT_RIGHT +WHERE isNotNull(left) AND isNotNull(right) + +┌─left─┬─right─┬─is_smaller──────────────────────────┐ +│ 1 │ 3 │ left is smaller than right │ +│ 2 │ 2 │ right is greater or equal than left │ +│ 3 │ 1 │ right is greater or equal than left │ +└──────┴───────┴─────────────────────────────────────┘ +``` + +Note: `NULL` les valeurs ne sont pas utilisés dans cet exemple, vérifier [Valeurs nulles dans les conditions](#null-values-in-conditionals) section. + +## Opérateur Ternaire {#ternary-operator} + +Il fonctionne même comme `if` fonction. + +Syntaxe: `cond ? then : else` + +Retourner `then` si l’ `cond` renvoie la valeur vrai (supérieur à zéro), sinon renvoie `else`. + +- `cond` doit être de type de `UInt8`, et `then` et `else` doit avoir le type commun le plus bas. + +- `then` et `else` peut être `NULL` + +**Voir aussi** + +- [ifNotFinite](other-functions.md#ifnotfinite). + +## multiIf {#multiif} + +Permet d’écrire le [CASE](../operators.md#operator_case) opérateur plus compacte dans la requête. + +Syntaxe: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` + +**Paramètre:** + +- `cond_N` — The condition for the function to return `then_N`. +- `then_N` — The result of the function when executed. +- `else` — The result of the function if none of the conditions is met. + +La fonction accepte `2N+1` paramètre. + +**Valeurs renvoyées** + +La fonction renvoie l’une des valeurs `then_N` ou `else` selon les conditions `cond_N`. + +**Exemple** + +En utilisant à nouveau `LEFT_RIGHT` table. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─result──────────┐ +│ ᴺᵁᴸᴸ │ 4 │ Null value │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ left is greater │ +│ 4 │ ᴺᵁᴸᴸ │ Null value │ +└──────┴───────┴─────────────────┘ +``` + +## Utilisation Directe Des résultats Conditionnels {#using-conditional-results-directly} + +Les conditions entraînent toujours `0`, `1` ou `NULL`. Vous pouvez donc utiliser des résultats conditionnels directement comme ceci: + +``` sql +SELECT left < right AS is_small +FROM LEFT_RIGHT + +┌─is_small─┐ +│ ᴺᵁᴸᴸ │ +│ 1 │ +│ 0 │ +│ 0 │ +│ ᴺᵁᴸᴸ │ +└──────────┘ +``` + +## Valeurs Nulles Dans Les Conditions {#null-values-in-conditionals} + +Lorsque `NULL` les valeurs sont impliqués dans des conditions, le résultat sera également `NULL`. + +``` sql +SELECT + NULL < 1, + 2 < NULL, + NULL < NULL, + NULL = NULL + +┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ +│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└───────────────┴───────────────┴──────────────────┴────────────────────┘ +``` + +Donc, vous devriez construire vos requêtes avec soin si les types sont `Nullable`. + +L’exemple suivant le démontre en omettant d’ajouter la condition égale à `multiIf`. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─faulty_result────┐ +│ ᴺᵁᴸᴸ │ 4 │ Both equal │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ right is smaller │ +│ 4 │ ᴺᵁᴸᴸ │ Both equal │ +└──────┴───────┴──────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/fr/sql-reference/functions/date-time-functions.md b/docs/fr/sql-reference/functions/date-time-functions.md new file mode 100644 index 00000000000..7071f203a3a --- /dev/null +++ b/docs/fr/sql-reference/functions/date-time-functions.md @@ -0,0 +1,450 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 39 +toc_title: Travailler avec les Dates et les heures +--- + +# Fonctions Pour Travailler Avec Des Dates Et Des Heures {#functions-for-working-with-dates-and-times} + +Support des fuseaux horaires + +Toutes les fonctions pour travailler avec la date et l’heure qui ont une logique d’utilisation pour le fuseau horaire peut accepter un second fuseau horaire argument. Exemple: Asie / Ekaterinbourg. Dans ce cas, ils utilisent le fuseau horaire spécifié au lieu du fuseau horaire local (par défaut). + +``` sql +SELECT + toDateTime('2016-06-15 23:00:00') AS time, + toDate(time) AS date_local, + toDate(time, 'Asia/Yekaterinburg') AS date_yekat, + toString(time, 'US/Samoa') AS time_samoa +``` + +``` text +┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ +└─────────────────────┴────────────┴────────────┴─────────────────────┘ +``` + +Seuls les fuseaux horaires qui diffèrent de L’UTC par un nombre entier d’heures sont pris en charge. + +## toTimeZone {#totimezone} + +Convertir l’heure ou la date et de l’heure au fuseau horaire spécifié. + +## toYear {#toyear} + +Convertit une date ou une date avec l’heure en un numéro UInt16 contenant le numéro d’année (AD). + +## toQuarter {#toquarter} + +Convertit une date ou une date avec l’heure en un numéro UInt8 contenant le numéro de trimestre. + +## toMonth {#tomonth} + +Convertit une date ou une date avec l’heure en un numéro UInt8 contenant le numéro de mois (1-12). + +## toDayOfYear {#todayofyear} + +Convertit une date ou une date avec l’heure en un numéro UInt16 contenant le numéro du jour de l’année (1-366). + +## toDayOfMonth {#todayofmonth} + +Convertit une date ou une date avec le temps à un UInt8 contenant le numéro du jour du mois (1-31). + +## toDayOfWeek {#todayofweek} + +Convertit une date ou une date avec l’heure en un numéro UInt8 contenant le numéro du jour de la semaine (lundi est 1, et dimanche est 7). + +## toHour {#tohour} + +Convertit une date avec l’heure en un nombre UInt8 contenant le numéro de l’heure dans l’Heure de 24 heures (0-23). +This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). + +## toMinute {#tominute} + +Convertit une date avec l’heure en un numéro UInt8 contenant le numéro de la minute de l’heure (0-59). + +## toseconde {#tosecond} + +Convertit une date avec l’heure en un nombre UInt8 contenant le numéro de la seconde dans la minute (0-59). +Les secondes intercalaires ne sont pas comptabilisés. + +## toUnixTimestamp {#to-unix-timestamp} + +Pour L’argument DateTime: convertit la valeur en sa représentation numérique interne (horodatage Unix). +For String argument: analyse datetime from string en fonction du fuseau horaire (second argument optionnel, le fuseau horaire du serveur est utilisé par défaut) et renvoie l’horodatage unix correspondant. +Pour L’argument Date: le comportement n’est pas spécifié. + +**Syntaxe** + +``` sql +toUnixTimestamp(datetime) +toUnixTimestamp(str, [timezone]) +``` + +**Valeur renvoyée** + +- Renvoie l’horodatage unix. + +Type: `UInt32`. + +**Exemple** + +Requête: + +``` sql +SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp +``` + +Résultat: + +``` text +┌─unix_timestamp─┐ +│ 1509836867 │ +└────────────────┘ +``` + +## toStartOfYear {#tostartofyear} + +Arrondit une date ou une date avec l’heure jusqu’au premier jour de l’année. +Renvoie la date. + +## toStartOfISOYear {#tostartofisoyear} + +Arrondit une date ou une date avec l’heure jusqu’au premier jour de L’année ISO. +Renvoie la date. + +## toStartOfQuarter {#tostartofquarter} + +Arrondit une date ou une date avec l’heure jusqu’au premier jour du trimestre. +Le premier jour du trimestre, soit le 1er janvier, 1er avril, 1er juillet ou 1er octobre. +Renvoie la date. + +## toStartOfMonth {#tostartofmonth} + +Arrondit une date ou une date avec l’heure jusqu’au premier jour du mois. +Renvoie la date. + +!!! attention "Attention" + Le comportement de l’analyse des dates incorrectes est spécifique à l’implémentation. ClickHouse peut renvoyer la date zéro, lancer une exception ou faire “natural” débordement. + +## toMonday {#tomonday} + +Arrondit une date ou une date avec l’heure au lundi le plus proche. +Renvoie la date. + +## toStartOfWeek (t \[, mode\]) {#tostartofweektmode} + +Arrondit une date ou une date avec l’heure au dimanche ou au lundi le plus proche par mode. +Renvoie la date. +L’argument mode fonctionne exactement comme l’argument mode de toWeek(). Pour la syntaxe à argument unique, une valeur de mode de 0 est utilisée. + +## toStartOfDay {#tostartofday} + +Arrondit une date avec le temps au début de la journée. + +## toStartOfHour {#tostartofhour} + +Arrondit une date avec le temps au début de l " heure. + +## toStartOfMinute {#tostartofminute} + +Arrondit une date avec le temps au début de la minute. + +## toStartOfFiveMinute {#tostartoffiveminute} + +Arrondit à une date avec l’heure de début de l’intervalle de cinq minutes. + +## toStartOfTenMinutes {#tostartoftenminutes} + +Arrondit une date avec le temps au début de l " intervalle de dix minutes. + +## toStartOfFifteenMinutes {#tostartoffifteenminutes} + +Arrondit la date avec le temps jusqu’au début de l’intervalle de quinze minutes. + +## toStartOfInterval(time\_or\_data, intervalle x Unité \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} + +Ceci est une généralisation d’autres fonctions nommées `toStartOf*`. Exemple, +`toStartOfInterval(t, INTERVAL 1 year)` renvoie la même chose que `toStartOfYear(t)`, +`toStartOfInterval(t, INTERVAL 1 month)` renvoie la même chose que `toStartOfMonth(t)`, +`toStartOfInterval(t, INTERVAL 1 day)` renvoie la même chose que `toStartOfDay(t)`, +`toStartOfInterval(t, INTERVAL 15 minute)` renvoie la même chose que `toStartOfFifteenMinutes(t)` etc. + +## toTime {#totime} + +Convertit une date avec l’heure en une certaine date fixe, tout en préservant l’heure. + +## toRelativeYearNum {#torelativeyearnum} + +Convertit une date avec l’heure ou la date, le numéro de l’année, à partir d’un certain point fixe dans le passé. + +## toRelativeQuarterNum {#torelativequarternum} + +Convertit une date avec l’heure ou la date au numéro du trimestre, à partir d’un certain point fixe dans le passé. + +## toRelativeMonthNum {#torelativemonthnum} + +Convertit une date avec l’heure ou la date au numéro du mois, à partir d’un certain point fixe dans le passé. + +## toRelativeWeekNum {#torelativeweeknum} + +Convertit une date avec l’heure ou la date, le numéro de la semaine, à partir d’un certain point fixe dans le passé. + +## toRelativeDayNum {#torelativedaynum} + +Convertit une date avec l’heure ou la date au numéro du jour, à partir d’un certain point fixe dans le passé. + +## toRelativeHourNum {#torelativehournum} + +Convertit une date avec l’heure ou la date au nombre de l’heure, à partir d’un certain point fixe dans le passé. + +## toRelativeMinuteNum {#torelativeminutenum} + +Convertit une date avec l’heure ou la date au numéro de la minute, à partir d’un certain point fixe dans le passé. + +## toRelativeSecondNum {#torelativesecondnum} + +Convertit une date avec l’heure ou la date au numéro de la seconde, à partir d’un certain point fixe dans le passé. + +## toISOYear {#toisoyear} + +Convertit une date ou une date avec l’heure en un numéro UInt16 contenant le numéro D’année ISO. + +## toISOWeek {#toisoweek} + +Convertit une date ou une date avec l’heure en un numéro UInt8 contenant le numéro de semaine ISO. + +## toWeek (date \[, mode\]) {#toweekdatemode} + +Cette fonction renvoie le numéro de semaine pour date ou datetime. La forme à deux arguments de toWeek() vous permet de spécifier si la semaine commence le dimanche ou le lundi et si la valeur de retour doit être comprise entre 0 et 53 ou entre 1 et 53. Si l’argument mode est omis, le mode par défaut est 0. +`toISOWeek()`est une fonction de compatibilité équivalente à `toWeek(date,3)`. +Le tableau suivant décrit le fonctionnement de l’argument mode. + +| Mode | Premier jour de la semaine | Gamme | Week 1 is the first week … | +|------|----------------------------|-------|----------------------------------| +| 0 | Dimanche | 0-53 | avec un dimanche cette année | +| 1 | Lundi | 0-53 | avec 4 jours ou plus cette année | +| 2 | Dimanche | 1-53 | avec un dimanche cette année | +| 3 | Lundi | 1-53 | avec 4 jours ou plus cette année | +| 4 | Dimanche | 0-53 | avec 4 jours ou plus cette année | +| 5 | Lundi | 0-53 | avec un lundi cette année | +| 6 | Dimanche | 1-53 | avec 4 jours ou plus cette année | +| 7 | Lundi | 1-53 | avec un lundi cette année | +| 8 | Dimanche | 1-53 | contient Janvier 1 | +| 9 | Lundi | 1-53 | contient Janvier 1 | + +Pour les valeurs de mode avec une signification de “with 4 or more days this year,” les semaines sont numérotées selon ISO 8601: 1988: + +- Si la semaine contenant Janvier 1 A 4 jours ou plus dans la nouvelle année, il est Semaine 1. + +- Sinon, c’est la dernière semaine de l’année précédente, et la semaine prochaine est la semaine 1. + +Pour les valeurs de mode avec une signification de “contains January 1”, la semaine contient Janvier 1 est Semaine 1. Peu importe combien de jours dans la nouvelle année la semaine contenait, même si elle contenait seulement un jour. + +``` sql +toWeek(date, [, mode][, Timezone]) +``` + +**Paramètre** + +- `date` – Date or DateTime. +- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. +- `Timezone` – Optional parameter, it behaves like any other conversion function. + +**Exemple** + +``` sql +SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; +``` + +``` text +┌───────date─┬─week0─┬─week1─┬─week9─┐ +│ 2016-12-27 │ 52 │ 52 │ 1 │ +└────────────┴───────┴───────┴───────┘ +``` + +## toYearWeek (date \[, mode\]) {#toyearweekdatemode} + +Retourne l’année et la semaine pour une date. L’année dans le résultat peut être différente de l’année dans l’argument date pour la première et la dernière semaine de l’année. + +L’argument mode fonctionne exactement comme l’argument mode de toWeek(). Pour la syntaxe à argument unique, une valeur de mode de 0 est utilisée. + +`toISOYear()`est une fonction de compatibilité équivalente à `intDiv(toYearWeek(date,3),100)`. + +**Exemple** + +``` sql +SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; +``` + +``` text +┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ +│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ +└────────────┴───────────┴───────────┴───────────┘ +``` + +## maintenant {#now} + +Accepte zéro argument et renvoie l’heure actuelle à l’un des moments de l’exécution de la requête. +Cette fonction renvoie une constante, même si la requête a pris beaucoup de temps à compléter. + +## aujourd’ {#today} + +Accepte zéro argument et renvoie la date actuelle à l’un des moments de l’exécution de la requête. +Le même que ‘toDate(now())’. + +## hier {#yesterday} + +Accepte zéro argument et renvoie la date d’hier à l’un des moments de l’exécution de la requête. +Le même que ‘today() - 1’. + +## l’horaire de diffusion {#timeslot} + +Arrondit le temps à la demi-heure. +Cette fonction est spécifique à Yandex.Metrica, car une demi-heure est le temps minimum pour diviser une session en deux sessions si une balise de suivi affiche les pages vues consécutives d’un seul utilisateur qui diffèrent dans le temps de strictement plus que ce montant. Cela signifie que les tuples (l’ID de balise, l’ID utilisateur et l’intervalle de temps) peuvent être utilisés pour rechercher les pages vues incluses dans la session correspondante. + +## toYYYYMM {#toyyyymm} + +Convertit une date ou une date avec l’heure en un numéro UInt32 contenant le numéro d’année et de mois (AAAA \* 100 + MM). + +## toYYYYMMDD {#toyyyymmdd} + +Convertit une date ou une date avec l’heure en un numéro UInt32 contenant le numéro d’année et de mois (AAAA \* 10000 + MM \* 100 + JJ). + +## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} + +Convertit une date ou une date avec l’heure en un numéro UInt64 contenant le numéro d’année et de mois (AAAA \* 10000000000 + MM \* 100000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss). + +## addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} + +Fonction ajoute une date / DateTime intervalle à une Date / DateTime, puis retourner la Date / DateTime. Exemple: + +``` sql +WITH + toDate('2018-01-01') AS date, + toDateTime('2018-01-01 00:00:00') AS date_time +SELECT + addYears(date, 1) AS add_years_with_date, + addYears(date_time, 1) AS add_years_with_date_time +``` + +``` text +┌─add_years_with_date─┬─add_years_with_date_time─┐ +│ 2019-01-01 │ 2019-01-01 00:00:00 │ +└─────────────────────┴──────────────────────────┘ +``` + +## subtractYears, subtractMonths, subtractWeeks, subtractDays, subtractHours, subtractMinutes, subtractSeconds, subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} + +Fonction soustrayez un intervalle de Date / DateTime à une Date / DateTime, puis renvoyez la Date / DateTime. Exemple: + +``` sql +WITH + toDate('2019-01-01') AS date, + toDateTime('2019-01-01 00:00:00') AS date_time +SELECT + subtractYears(date, 1) AS subtract_years_with_date, + subtractYears(date_time, 1) AS subtract_years_with_date_time +``` + +``` text +┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ +│ 2018-01-01 │ 2018-01-01 00:00:00 │ +└──────────────────────────┴───────────────────────────────┘ +``` + +## dateDiff {#datediff} + +Renvoie la différence entre deux valeurs Date ou DateTime. + +**Syntaxe** + +``` sql +dateDiff('unit', startdate, enddate, [timezone]) +``` + +**Paramètre** + +- `unit` — Time unit, in which the returned value is expressed. [Chaîne](../syntax.md#syntax-string-literal). + + Supported values: + + | unit | + | ---- | + |second | + |minute | + |hour | + |day | + |week | + |month | + |quarter | + |year | + +- `startdate` — The first time value to compare. [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). + +- `enddate` — The second time value to compare. [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). + +- `timezone` — Optional parameter. If specified, it is applied to both `startdate` et `enddate`. Si non spécifié, fuseaux horaires de l’ `startdate` et `enddate` sont utilisés. Si elles ne sont pas identiques, le résultat n’est pas spécifié. + +**Valeur renvoyée** + +Différence entre `startdate` et `enddate` exprimé en `unit`. + +Type: `int`. + +**Exemple** + +Requête: + +``` sql +SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); +``` + +Résultat: + +``` text +┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ +│ 25 │ +└────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## intervalle de temps (StartTime, Duration, \[, Size\]) {#timeslotsstarttime-duration-size} + +Pour un intervalle de temps commençant à ‘StartTime’ et de poursuivre pour ‘Duration’ secondes, il renvoie un tableau de moments dans le temps, composé de points de cet intervalle arrondis vers le bas à la ‘Size’ en quelques secondes. ‘Size’ est un paramètre optionnel: une constante UInt32, définie sur 1800 par défaut. +Exemple, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. +Ceci est nécessaire pour rechercher les pages vues dans la session correspondante. + +## formatDateTime(Heure, Format \[, fuseau horaire\]) {#formatdatetime} + +Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. + +Modificateurs pris en charge pour le Format: +(“Example” colonne affiche le résultat de formatage pour le temps `2018-01-02 22:33:44`) + +| Modificateur | Description | Exemple | +|--------------|------------------------------------------------------------------------|------------| +| %C | année divisée par 100 et tronquée en entier (00-99) | 20 | +| %d | jour du mois, zero-rembourré (01-31) | 02 | +| %D | Date courte MM / JJ / AA, équivalente à %m / % d / % y | 01/02/18 | +| % e | jour du mois, rembourré dans l’espace ( 1-31) | 2 | +| %F | date courte AAAA-MM-JJ, équivalente à % Y - % m - % d | 2018-01-02 | +| %H | heure en format 24h (00-23) | 22 | +| %I | heure en format 12h (01-12) | 10 | +| %j | les jours de l’année (001-366) | 002 | +| %m | mois en nombre décimal (01-12) | 01 | +| %M | minute (00-59) | 33 | +| %et | caractère de nouvelle ligne (") | | +| %p | Désignation AM ou PM | PM | +| %R | 24 heures HH:MM temps, équivalent à %H: % M | 22:33 | +| %S | deuxième (00-59) | 44 | +| % t | horizontal-caractère de tabulation (’) | | +| %T | Format d’heure ISO 8601 (HH:MM:SS), équivalent à %H: % M:%S | 22:33:44 | +| % u | ISO 8601 jour de la semaine comme numéro avec Lundi comme 1 (1-7) | 2 | +| %V | Numéro de semaine ISO 8601 (01-53) | 01 | +| %W | jour de la semaine comme un nombre décimal avec dimanche comme 0 (0-6) | 2 | +| % y | Année, deux derniers chiffres (00-99) | 18 | +| %Y | An | 2018 | +| %% | signe | % | + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/fr/sql-reference/functions/encoding-functions.md b/docs/fr/sql-reference/functions/encoding-functions.md new file mode 100644 index 00000000000..5d946ab1f5b --- /dev/null +++ b/docs/fr/sql-reference/functions/encoding-functions.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 52 +toc_title: Encodage +--- + +# L’encodage Des Fonctions {#encoding-functions} + +## char {#char} + +Retourne la chaîne avec la longueur que le nombre d’arguments passés et chaque octet a la valeur de l’argument correspondant. Accepte plusieurs arguments de types numériques. Si la valeur de l’argument est hors de portée du type de données UInt8, elle est convertie en UInt8 avec arrondi et débordement possibles. + +**Syntaxe** + +``` sql +char(number_1, [number_2, ..., number_n]); +``` + +**Paramètre** + +- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../../sql-reference/data-types/int-uint.md), [Flottant](../../sql-reference/data-types/float.md). + +**Valeur renvoyée** + +- une chaîne d’octets. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello +``` + +Résultat: + +``` text +┌─hello─┐ +│ hello │ +└───────┘ +``` + +Vous pouvez construire une chaîne de codage arbitraire en passant les octets correspondants. Voici un exemple pour UTF-8: + +Requête: + +``` sql +SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; +``` + +Résultat: + +``` text +┌─hello──┐ +│ привет │ +└────────┘ +``` + +Requête: + +``` sql +SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; +``` + +Résultat: + +``` text +┌─hello─┐ +│ 你好 │ +└───────┘ +``` + +## Hex {#hex} + +Renvoie une chaîne contenant la représentation hexadécimale de l’argument. + +**Syntaxe** + +``` sql +hex(arg) +``` + +La fonction utilise des lettres majuscules `A-F` et ne pas utiliser de préfixes (comme `0x`) ou suffixes (comme `h`). + +Pour les arguments entiers, il imprime des chiffres hexadécimaux (“nibbles”) du plus significatif au moins significatif (big endian ou “human readable” ordre). Il commence par l’octet non nul le plus significatif (les octets de début zéro sont omis) mais imprime toujours les deux chiffres de chaque octet même si le chiffre de début est nul. + +Exemple: + +**Exemple** + +Requête: + +``` sql +SELECT hex(1); +``` + +Résultat: + +``` text +01 +``` + +Les valeurs de type `Date` et `DateTime` sont formatés comme des entiers correspondants (le nombre de jours depuis Epoch pour Date et la valeur de L’horodatage Unix pour DateTime). + +Pour `String` et `FixedString`, tous les octets sont simplement codés en deux nombres hexadécimaux. Zéro octets ne sont pas omis. + +Les valeurs des types virgule flottante et décimale sont codées comme leur représentation en mémoire. Comme nous soutenons l’architecture little endian, ils sont codés dans little endian. Zéro octets de début / fin ne sont pas omis. + +**Paramètre** + +- `arg` — A value to convert to hexadecimal. Types: [Chaîne](../../sql-reference/data-types/string.md), [UInt](../../sql-reference/data-types/int-uint.md), [Flottant](../../sql-reference/data-types/float.md), [Décimal](../../sql-reference/data-types/decimal.md), [Date](../../sql-reference/data-types/date.md) ou [DateTime](../../sql-reference/data-types/datetime.md). + +**Valeur renvoyée** + +- Une chaîne avec la représentation hexadécimale de l’argument. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); +``` + +Résultat: + +``` text +┌─hex_presentation─┐ +│ 00007041 │ +│ 00008041 │ +└──────────────────┘ +``` + +Requête: + +``` sql +SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); +``` + +Résultat: + +``` text +┌─hex_presentation─┐ +│ 0000000000002E40 │ +│ 0000000000003040 │ +└──────────────────┘ +``` + +## unhex (str) {#unhexstr} + +Accepte une chaîne contenant un nombre quelconque de chiffres hexadécimaux, et renvoie une chaîne contenant le correspondant octets. Prend en charge les lettres majuscules et minuscules A-F. Le nombre de chiffres hexadécimaux ne doit pas être pair. S’il est impair, le dernier chiffre est interprété comme la moitié la moins significative de l’octet 00-0F. Si la chaîne d’argument contient autre chose que des chiffres hexadécimaux, un résultat défini par l’implémentation est renvoyé (une exception n’est pas levée). +Si vous voulez convertir le résultat en un nombre, vous pouvez utiliser le ‘reverse’ et ‘reinterpretAsType’ fonction. + +## UUIDStringToNum (str) {#uuidstringtonumstr} + +Accepte une chaîne contenant 36 caractères dans le format `123e4567-e89b-12d3-a456-426655440000`, et le renvoie comme un ensemble d’octets dans un FixedString (16). + +## UUIDNumToString (str) {#uuidnumtostringstr} + +Accepte une valeur FixedString (16). Renvoie une chaîne contenant 36 caractères au format texte. + +## bitmaskToList(num) {#bitmasktolistnum} + +Accepte un entier. Renvoie une chaîne contenant la liste des puissances de deux qui totalisent le nombre source lorsqu’il est additionné. Ils sont séparés par des virgules sans espaces au format texte, dans l’ordre croissant. + +## bitmaskToArray(num) {#bitmasktoarraynum} + +Accepte un entier. Renvoie un tableau de nombres UInt64 contenant la liste des puissances de deux qui totalisent le nombre source lorsqu’il est additionné. Les numéros dans le tableau sont dans l’ordre croissant. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/fr/sql-reference/functions/ext-dict-functions.md b/docs/fr/sql-reference/functions/ext-dict-functions.md new file mode 100644 index 00000000000..d96cee94224 --- /dev/null +++ b/docs/fr/sql-reference/functions/ext-dict-functions.md @@ -0,0 +1,205 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 58 +toc_title: Travailler avec des dictionnaires externes +--- + +# Fonctions Pour Travailler Avec Des Dictionnaires Externes {#ext_dict_functions} + +Pour plus d’informations sur la connexion et la configuration de dictionnaires externes, voir [Dictionnaires externes](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +## dictGet {#dictget} + +Récupère une valeur d’un dictionnaire externe. + +``` sql +dictGet('dict_name', 'attr_name', id_expr) +dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Paramètre** + +- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d’un [UInt64](../../sql-reference/data-types/int-uint.md) ou [Tuple](../../sql-reference/data-types/tuple.md)- tapez la valeur en fonction de la configuration du dictionnaire. +- `default_value_expr` — Value returned if the dictionary doesn’t contain a row with the `id_expr` clé. [Expression](../syntax.md#syntax-expressions) renvoyer la valeur dans le type de données configuré pour `attr_name` attribut. + +**Valeur renvoyée** + +- Si ClickHouse analyse l’attribut avec succès dans le [l’attribut type de données](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), les fonctions renvoient la valeur du dictionnaire de l’attribut qui correspond à `id_expr`. + +- Si il n’y a pas la clé, correspondant à `id_expr` dans le dictionnaire, puis: + + - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. + +ClickHouse lève une exception si elle ne peut pas analyser la valeur de l’attribut ou si la valeur ne correspond pas au type de données d’attribut. + +**Exemple** + +Créer un fichier texte `ext-dict-text.csv` contenant les éléments suivants: + +``` text +1,1 +2,2 +``` + +La première colonne est `id` la deuxième colonne est `c1`. + +Configurer le dictionnaire externe: + +``` xml + + + ext-dict-test + + + /path-to/ext-dict-test.csv + CSV + + + + + + + + id + + + c1 + UInt32 + + + + 0 + + +``` + +Effectuer la requête: + +``` sql +SELECT + dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, + toTypeName(val) AS type +FROM system.numbers +LIMIT 3 +``` + +``` text +┌─val─┬─type───┐ +│ 1 │ UInt32 │ +│ 2 │ UInt32 │ +│ 20 │ UInt32 │ +└─────┴────────┘ +``` + +**Voir Aussi** + +- [Dictionnaires Externes](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) + +## dictHas {#dicthas} + +Vérifie si une clé est présente dans un dictionnaire. + +``` sql +dictHas('dict_name', id_expr) +``` + +**Paramètre** + +- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d’un [UInt64](../../sql-reference/data-types/int-uint.md)-le type de la valeur. + +**Valeur renvoyée** + +- 0, si il n’y a pas de clé. +- 1, si il y a une clé. + +Type: `UInt8`. + +## dictGetHierarchy {#dictgethierarchy} + +Crée un tableau contenant tous les parents d’une clé dans le [hiérarchique dictionnaire](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md). + +**Syntaxe** + +``` sql +dictGetHierarchy('dict_name', key) +``` + +**Paramètre** + +- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). +- `key` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d’un [UInt64](../../sql-reference/data-types/int-uint.md)-le type de la valeur. + +**Valeur renvoyée** + +- Les Parents pour la clé. + +Type: [Tableau (UInt64)](../../sql-reference/data-types/array.md). + +## dictisine {#dictisin} + +Vérifie l’ancêtre d’une clé à travers toute la chaîne hiérarchique dans le dictionnaire. + +``` sql +dictIsIn('dict_name', child_id_expr, ancestor_id_expr) +``` + +**Paramètre** + +- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). +- `child_id_expr` — Key to be checked. [Expression](../syntax.md#syntax-expressions) de retour d’un [UInt64](../../sql-reference/data-types/int-uint.md)-le type de la valeur. +- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` clé. [Expression](../syntax.md#syntax-expressions) de retour d’un [UInt64](../../sql-reference/data-types/int-uint.md)-le type de la valeur. + +**Valeur renvoyée** + +- 0, si `child_id_expr` n’est pas un enfant de `ancestor_id_expr`. +- 1, si `child_id_expr` est un enfant de `ancestor_id_expr` ou si `child_id_expr` est un `ancestor_id_expr`. + +Type: `UInt8`. + +## D’Autres Fonctions {#ext_dict_functions-other} + +ClickHouse prend en charge des fonctions spécialisées qui convertissent les valeurs d’attribut de dictionnaire en un type de données spécifique, quelle que soit la configuration du dictionnaire. + +Fonction: + +- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` +- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` +- `dictGetFloat32`, `dictGetFloat64` +- `dictGetDate` +- `dictGetDateTime` +- `dictGetUUID` +- `dictGetString` + +Toutes ces fonctions ont le `OrDefault` modification. Exemple, `dictGetDateOrDefault`. + +Syntaxe: + +``` sql +dictGet[Type]('dict_name', 'attr_name', id_expr) +dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Paramètre** + +- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d’un [UInt64](../../sql-reference/data-types/int-uint.md)-le type de la valeur. +- `default_value_expr` — Value which is returned if the dictionary doesn’t contain a row with the `id_expr` clé. [Expression](../syntax.md#syntax-expressions) renvoyer une valeur dans le type de données configuré pour `attr_name` attribut. + +**Valeur renvoyée** + +- Si ClickHouse analyse l’attribut avec succès dans le [l’attribut type de données](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), les fonctions renvoient la valeur du dictionnaire de l’attribut qui correspond à `id_expr`. + +- Si il n’est pas demandé `id_expr` dans le dictionnaire,: + + - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. + +ClickHouse lève une exception si elle ne peut pas analyser la valeur de l’attribut ou si la valeur ne correspond pas au type de données d’attribut. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/fr/sql-reference/functions/functions-for-nulls.md b/docs/fr/sql-reference/functions/functions-for-nulls.md new file mode 100644 index 00000000000..60d5356beb9 --- /dev/null +++ b/docs/fr/sql-reference/functions/functions-for-nulls.md @@ -0,0 +1,312 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 63 +toc_title: Travailler avec des arguments nullables +--- + +# Fonctions Pour Travailler Avec Des agrégats Nullables {#functions-for-working-with-nullable-aggregates} + +## isNull {#isnull} + +Vérifie si l’argument est [NULL](../syntax.md#null). + +``` sql +isNull(x) +``` + +**Paramètre** + +- `x` — A value with a non-compound data type. + +**Valeur renvoyée** + +- `1` si `x` être `NULL`. +- `0` si `x` n’est pas `NULL`. + +**Exemple** + +Table d’entrée + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Requête + +``` sql +SELECT x FROM t_null WHERE isNull(y) +``` + +``` text +┌─x─┐ +│ 1 │ +└───┘ +``` + +## isNotNull {#isnotnull} + +Vérifie si l’argument est [NULL](../syntax.md#null). + +``` sql +isNotNull(x) +``` + +**Paramètre:** + +- `x` — A value with a non-compound data type. + +**Valeur renvoyée** + +- `0` si `x` être `NULL`. +- `1` si `x` n’est pas `NULL`. + +**Exemple** + +Table d’entrée + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Requête + +``` sql +SELECT x FROM t_null WHERE isNotNull(y) +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## fusionner {#coalesce} + +Vérifie de gauche à droite si `NULL` les arguments ont été passés et renvoie le premier non-`NULL` argument. + +``` sql +coalesce(x,...) +``` + +**Paramètre:** + +- N’importe quel nombre de paramètres d’un type non composé. Tous les paramètres doivent être compatibles par type de données. + +**Valeurs renvoyées** + +- Le premier non-`NULL` argument. +- `NULL` si tous les arguments sont `NULL`. + +**Exemple** + +Considérez une liste de contacts qui peuvent spécifier plusieurs façons de contacter un client. + +``` text +┌─name─────┬─mail─┬─phone─────┬──icq─┐ +│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ +│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└──────────┴──────┴───────────┴──────┘ +``` + +Le `mail` et `phone` les champs sont de type Chaîne de caractères, mais la `icq` le terrain est `UInt32`, de sorte qu’il doit être converti en `String`. + +Obtenir la première méthode de contact pour le client à partir de la liste de contacts: + +``` sql +SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook +``` + +``` text +┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ +│ client 1 │ 123-45-67 │ +│ client 2 │ ᴺᵁᴸᴸ │ +└──────────┴──────────────────────────────────────────────────────┘ +``` + +## ifNull {#ifnull} + +Renvoie une valeur alternative si l’argument principal est `NULL`. + +``` sql +ifNull(x,alt) +``` + +**Paramètre:** + +- `x` — The value to check for `NULL`. +- `alt` — The value that the function returns if `x` être `NULL`. + +**Valeurs renvoyées** + +- Valeur `x`, si `x` n’est pas `NULL`. +- Valeur `alt`, si `x` être `NULL`. + +**Exemple** + +``` sql +SELECT ifNull('a', 'b') +``` + +``` text +┌─ifNull('a', 'b')─┐ +│ a │ +└──────────────────┘ +``` + +``` sql +SELECT ifNull(NULL, 'b') +``` + +``` text +┌─ifNull(NULL, 'b')─┐ +│ b │ +└───────────────────┘ +``` + +## nullIf {#nullif} + +Retourner `NULL` si les arguments sont égaux. + +``` sql +nullIf(x, y) +``` + +**Paramètre:** + +`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. + +**Valeurs renvoyées** + +- `NULL` si les arguments sont égaux. +- Le `x` valeur, si les arguments ne sont pas égaux. + +**Exemple** + +``` sql +SELECT nullIf(1, 1) +``` + +``` text +┌─nullIf(1, 1)─┐ +│ ᴺᵁᴸᴸ │ +└──────────────┘ +``` + +``` sql +SELECT nullIf(1, 2) +``` + +``` text +┌─nullIf(1, 2)─┐ +│ 1 │ +└──────────────┘ +``` + +## assumeNotNull {#assumenotnull} + +Résultats dans une valeur de type [Nullable](../../sql-reference/data-types/nullable.md) pour un non- `Nullable` si la valeur n’est pas `NULL`. + +``` sql +assumeNotNull(x) +``` + +**Paramètre:** + +- `x` — The original value. + +**Valeurs renvoyées** + +- La valeur d’origine du non-`Nullable` type, si elle n’est pas `NULL`. +- La valeur par défaut pour le non-`Nullable` Tapez si la valeur d’origine était `NULL`. + +**Exemple** + +Envisager l’ `t_null` table. + +``` sql +SHOW CREATE TABLE t_null +``` + +``` text +┌─statement─────────────────────────────────────────────────────────────────┐ +│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ +└───────────────────────────────────────────────────────────────────────────┘ +``` + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Appliquer le `assumeNotNull` la fonction de la `y` colonne. + +``` sql +SELECT assumeNotNull(y) FROM t_null +``` + +``` text +┌─assumeNotNull(y)─┐ +│ 0 │ +│ 3 │ +└──────────────────┘ +``` + +``` sql +SELECT toTypeName(assumeNotNull(y)) FROM t_null +``` + +``` text +┌─toTypeName(assumeNotNull(y))─┐ +│ Int8 │ +│ Int8 │ +└──────────────────────────────┘ +``` + +## toNullable {#tonullable} + +Convertit le type d’argument en `Nullable`. + +``` sql +toNullable(x) +``` + +**Paramètre:** + +- `x` — The value of any non-compound type. + +**Valeur renvoyée** + +- La valeur d’entrée avec un `Nullable` type. + +**Exemple** + +``` sql +SELECT toTypeName(10) +``` + +``` text +┌─toTypeName(10)─┐ +│ UInt8 │ +└────────────────┘ +``` + +``` sql +SELECT toTypeName(toNullable(10)) +``` + +``` text +┌─toTypeName(toNullable(10))─┐ +│ Nullable(UInt8) │ +└────────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/fr/sql-reference/functions/geo.md b/docs/fr/sql-reference/functions/geo.md new file mode 100644 index 00000000000..ec4a9a9cfb9 --- /dev/null +++ b/docs/fr/sql-reference/functions/geo.md @@ -0,0 +1,510 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 62 +toc_title: "Travailler avec des coordonn\xE9es g\xE9ographiques" +--- + +# Fonctions Pour Travailler Avec Des coordonnées géographiques {#functions-for-working-with-geographical-coordinates} + +## greatCircleDistance {#greatcircledistance} + +Calculer la distance entre deux points sur la surface de la Terre en utilisant [la formule du grand cercle](https://en.wikipedia.org/wiki/Great-circle_distance). + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**Les paramètres d’entrée** + +- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. +- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. +- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. +- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. + +Les valeurs positives correspondent à la latitude nord et à la longitude Est, et les valeurs négatives à la latitude Sud et à la longitude ouest. + +**Valeur renvoyée** + +La distance entre deux points sur la surface de la Terre, en mètres. + +Génère une exception lorsque les valeurs des paramètres d’entrée se situent en dehors de la plage. + +**Exemple** + +``` sql +SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) +``` + +``` text +┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ +│ 14132374.194975413 │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## pointInEllipses {#pointinellipses} + +Vérifie si le point appartient à au moins une des ellipses. +Coordonnées géométriques sont dans le système de coordonnées Cartésiennes. + +``` sql +pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) +``` + +**Les paramètres d’entrée** + +- `x, y` — Coordinates of a point on the plane. +- `xᵢ, yᵢ` — Coordinates of the center of the `i`-ème points de suspension. +- `aᵢ, bᵢ` — Axes of the `i`- e ellipse en unités de coordonnées x, Y. + +Les paramètres d’entrée doivent être `2+4⋅n`, où `n` est le nombre de points de suspension. + +**Valeurs renvoyées** + +`1` si le point est à l’intérieur d’au moins l’un des ellipses; `0`si elle ne l’est pas. + +**Exemple** + +``` sql +SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) +``` + +``` text +┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ +│ 1 │ +└─────────────────────────────────────────────────┘ +``` + +## pointtinpolygon {#pointinpolygon} + +Vérifie si le point appartient au polygone sur l’avion. + +``` sql +pointInPolygon((x, y), [(a, b), (c, d) ...], ...) +``` + +**Les valeurs d’entrée** + +- `(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 — [Tableau](../../sql-reference/data-types/array.md). Chaque sommet est représenté par une paire de coordonnées `(a, b)`. Les sommets doivent être spécifiés dans le sens horaire ou antihoraire. Le nombre minimum de sommets est 3. Le polygone doit être constante. +- La fonction prend également en charge les polygones avec des trous (découper des sections). Dans ce cas, ajoutez des polygones qui définissent les sections découpées en utilisant des arguments supplémentaires de la fonction. La fonction ne prend pas en charge les polygones non simplement connectés. + +**Valeurs renvoyées** + +`1` si le point est à l’intérieur du polygone, `0` si elle ne l’est pas. +Si le point est sur la limite du polygone, la fonction peut renvoyer 0 ou 1. + +**Exemple** + +``` sql +SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## geohashEncode {#geohashencode} + +Encode la latitude et la longitude en tant que chaîne geohash, voir (http://geohash.org/, https://en.wikipedia.org/wiki/Geohash). + +``` sql +geohashEncode(longitude, latitude, [precision]) +``` + +**Les valeurs d’entrée** + +- longitude longitude partie de la coordonnée que vous souhaitez encoder. Flottant dans la gamme`[-180°, 180°]` +- latitude latitude partie de la coordonnée que vous souhaitez encoder. Flottant dans la gamme `[-90°, 90°]` +- precision-facultatif, longueur de la chaîne codée résultante, par défaut `12`. Entier dans la gamme `[1, 12]`. Toute valeur inférieure à `1` ou supérieure à `12` silencieusement converti à `12`. + +**Valeurs renvoyées** + +- alphanumérique `String` de coordonnées codées (la version modifiée de l’alphabet de codage base32 est utilisée). + +**Exemple** + +``` sql +SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res +``` + +``` text +┌─res──────────┐ +│ ezs42d000000 │ +└──────────────┘ +``` + +## geohashDecode {#geohashdecode} + +Décode toute chaîne codée geohash en longitude et latitude. + +**Les valeurs d’entrée** + +- chaîne codée-chaîne codée geohash. + +**Valeurs renvoyées** + +- (longitude, latitude) - 2-n-uplet de `Float64` les valeurs de longitude et de latitude. + +**Exemple** + +``` sql +SELECT geohashDecode('ezs42') AS res +``` + +``` text +┌─res─────────────────────────────┐ +│ (-5.60302734375,42.60498046875) │ +└─────────────────────────────────┘ +``` + +## geoToH3 {#geotoh3} + +Retourner [H3](https://uber.github.io/h3/#/documentation/overview/introduction) point d’indice `(lon, lat)` avec une résolution spécifiée. + +[H3](https://uber.github.io/h3/#/documentation/overview/introduction) est un système d’indexation géographique où la surface de la Terre divisée en carreaux hexagonaux même. Ce système est hiérarchique, c’est-à-dire que chaque hexagone au niveau supérieur peut être divisé en sept, même mais plus petits, etc. + +Cet indice est principalement utilisé pour les emplacements de bucketing et d’autres manipulations géospatiales. + +**Syntaxe** + +``` sql +geoToH3(lon, lat, resolution) +``` + +**Paramètre** + +- `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). + +**Valeurs renvoyées** + +- Numéro d’indice hexagonal. +- 0 en cas d’erreur. + +Type: `UInt64`. + +**Exemple** + +Requête: + +``` sql +SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index +``` + +Résultat: + +``` text +┌────────────h3Index─┐ +│ 644325524701193974 │ +└────────────────────┘ +``` + +## geohashesInBox {#geohashesinbox} + +Renvoie un tableau de chaînes codées geohash de précision donnée qui tombent à l’intérieur et croisent les limites d’une boîte donnée, essentiellement une grille 2D aplatie en tableau. + +**Les valeurs d’entrée** + +- longitude\_min-longitude min, valeur flottante dans la plage `[-180°, 180°]` +- latitude\_min-latitude min, valeur flottante dans la plage `[-90°, 90°]` +- longitude\_max-longitude maximale, valeur flottante dans la plage `[-180°, 180°]` +- latitude\_max-latitude maximale, valeur flottante dans la plage `[-90°, 90°]` +- précision - geohash précision, `UInt8` dans la gamme `[1, 12]` + +Veuillez noter que tous les paramètres de coordonnées doit être du même type: soit `Float32` ou `Float64`. + +**Valeurs renvoyées** + +- gamme de précision de longues chaînes de geohash-boîtes couvrant la zone, vous ne devriez pas compter sur l’ordre des éléments. +- \[\] - tableau vide si *min* les valeurs de *latitude* et *longitude* ne sont pas moins de correspondant *Max* valeur. + +Veuillez noter que la fonction lancera une exception si le tableau résultant a plus de 10’000’000 éléments. + +**Exemple** + +``` sql +SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos +``` + +``` text +┌─thasos──────────────────────────────────────┐ +│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ +└─────────────────────────────────────────────┘ +``` + +## h3GetBaseCell {#h3getbasecell} + +Renvoie le numéro de cellule de base de l’index. + +**Syntaxe** + +``` sql +h3GetBaseCell(index) +``` + +**Paramètre** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Valeurs renvoyées** + +- Numéro de cellule de base hexagonale. Type: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT h3GetBaseCell(612916788725809151) as basecell +``` + +Résultat: + +``` text +┌─basecell─┐ +│ 12 │ +└──────────┘ +``` + +## h3HexAreaM2 {#h3hexaream2} + +Surface hexagonale Moyenne en mètres carrés à la résolution donnée. + +**Syntaxe** + +``` sql +h3HexAreaM2(resolution) +``` + +**Paramètre** + +- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Valeurs renvoyées** + +- Area in m². Type: [Float64](../../sql-reference/data-types/float.md). + +**Exemple** + +Requête: + +``` sql +SELECT h3HexAreaM2(13) as area +``` + +Résultat: + +``` text +┌─area─┐ +│ 43.9 │ +└──────┘ +``` + +## h3IndexesAreNeighbors {#h3indexesareneighbors} + +Renvoie si les H3Indexes fournis sont voisins ou non. + +**Syntaxe** + +``` sql +h3IndexesAreNeighbors(index1, index2) +``` + +**Paramètre** + +- `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). + +**Valeurs renvoyées** + +- Retourner `1` si les index sont voisins, `0` autrement. Type: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n +``` + +Résultat: + +``` text +┌─n─┐ +│ 1 │ +└───┘ +``` + +## h3enfants {#h3tochildren} + +Retourne un tableau avec les index enfants de l’index donné. + +**Syntaxe** + +``` sql +h3ToChildren(index, resolution) +``` + +**Paramètre** + +- `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). + +**Valeurs renvoyées** + +- Tableau avec les index H3 enfants. Tableau de type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT h3ToChildren(599405990164561919, 6) AS children +``` + +Résultat: + +``` text +┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## h3ToParent {#h3toparent} + +Renvoie l’index parent (plus grossier) contenant l’index donné. + +**Syntaxe** + +``` sql +h3ToParent(index, resolution) +``` + +**Paramètre** + +- `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). + +**Valeurs renvoyées** + +- Parent H3 index. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT h3ToParent(599405990164561919, 3) as parent +``` + +Résultat: + +``` text +┌─────────────parent─┐ +│ 590398848891879423 │ +└────────────────────┘ +``` + +## h3ToString {#h3tostring} + +Convertit la représentation H3Index de l’index en représentation de chaîne. + +``` sql +h3ToString(index) +``` + +**Paramètre** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Valeurs renvoyées** + +- Représentation en chaîne de l’index H3. Type: [Chaîne](../../sql-reference/data-types/string.md). + +**Exemple** + +Requête: + +``` sql +SELECT h3ToString(617420388352917503) as h3_string +``` + +Résultat: + +``` text +┌─h3_string───────┐ +│ 89184926cdbffff │ +└─────────────────┘ +``` + +## stringToH3 {#stringtoh3} + +Convertit la représentation de chaîne en représentation H3Index (UInt64). + +``` sql +stringToH3(index_str) +``` + +**Paramètre** + +- `index_str` — String representation of the H3 index. Type: [Chaîne](../../sql-reference/data-types/string.md). + +**Valeurs renvoyées** + +- Numéro d’indice hexagonal. Renvoie 0 en cas d’erreur. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT stringToH3('89184926cc3ffff') as index +``` + +Résultat: + +``` text +┌──────────────index─┐ +│ 617420388351344639 │ +└────────────────────┘ +``` + +## h3grésolution {#h3getresolution} + +Retourne la résolution de l’index. + +**Syntaxe** + +``` sql +h3GetResolution(index) +``` + +**Paramètre** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Valeurs renvoyées** + +- L’indice de la résolution. Gamme: `[0, 15]`. Type: [UInt8](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT h3GetResolution(617420388352917503) as res +``` + +Résultat: + +``` text +┌─res─┐ +│ 9 │ +└─────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/fr/sql-reference/functions/hash-functions.md b/docs/fr/sql-reference/functions/hash-functions.md new file mode 100644 index 00000000000..0b49f8b63ce --- /dev/null +++ b/docs/fr/sql-reference/functions/hash-functions.md @@ -0,0 +1,446 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 50 +toc_title: Hachage +--- + +# Les Fonctions De Hachage {#hash-functions} + +Les fonctions de hachage peuvent être utilisées pour le brassage pseudo-aléatoire déterministe des éléments. + +## halfMD5 {#hash-functions-halfmd5} + +[Interpréter](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) tous les paramètres d’entrée sous forme de chaînes et calcule le [MD5](https://en.wikipedia.org/wiki/MD5) la valeur de hachage pour chacun d’eux. Puis combine les hachages, prend les 8 premiers octets du hachage de la chaîne résultante, et les interprète comme `UInt64` dans l’ordre des octets big-endian. + +``` sql +halfMD5(par1, ...) +``` + +La fonction est relativement lente (5 millions de chaînes courtes par seconde par cœur de processeur). +Envisager l’utilisation de la [sipHash64](#hash_functions-siphash64) la fonction la place. + +**Paramètre** + +La fonction prend un nombre variable de paramètres d’entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql-reference/data-types/index.md). + +**Valeur Renvoyée** + +A [UInt64](../../sql-reference/data-types/int-uint.md) valeur de hachage du type de données. + +**Exemple** + +``` sql +SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type +``` + +``` text +┌────────halfMD5hash─┬─type───┐ +│ 186182704141653334 │ UInt64 │ +└────────────────────┴────────┘ +``` + +## MD5 {#hash_functions-md5} + +Calcule le MD5 à partir d’une chaîne et renvoie L’ensemble d’octets résultant en tant que FixedString(16). +Si vous n’avez pas besoin de MD5 en particulier, mais que vous avez besoin d’un hachage cryptographique 128 bits décent, utilisez le ‘sipHash128’ la fonction la place. +Si vous voulez obtenir le même résultat que la sortie de l’utilitaire md5sum, utilisez lower (hex(MD5 (s))). + +## sipHash64 {#hash_functions-siphash64} + +Produit un 64 bits [SipHash](https://131002.net/siphash/) la valeur de hachage. + +``` sql +sipHash64(par1,...) +``` + +C’est une fonction de hachage cryptographique. Il fonctionne au moins trois fois plus vite que le [MD5](#hash_functions-md5) fonction. + +Fonction [interpréter](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) tous les paramètres d’entrée sous forme de chaînes et calcule la valeur de hachage pour chacun d’eux. Puis combine les hachages par l’algorithme suivant: + +1. Après avoir haché tous les paramètres d’entrée, la fonction obtient le tableau de hachages. +2. La fonction prend le premier et le second éléments et calcule un hachage pour le tableau d’entre eux. +3. Ensuite, la fonction prend la valeur de hachage, calculée à l’étape précédente, et le troisième élément du tableau de hachage initial, et calcule un hachage pour le tableau d’entre eux. +4. L’étape précédente est répétée pour tous les éléments restants de la période initiale de hachage tableau. + +**Paramètre** + +La fonction prend un nombre variable de paramètres d’entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql-reference/data-types/index.md). + +**Valeur Renvoyée** + +A [UInt64](../../sql-reference/data-types/int-uint.md) valeur de hachage du type de données. + +**Exemple** + +``` sql +SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type +``` + +``` text +┌──────────────SipHash─┬─type───┐ +│ 13726873534472839665 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## sipHash128 {#hash_functions-siphash128} + +Calcule SipHash à partir d’une chaîne. +Accepte un argument de type chaîne. Renvoie FixedString (16). +Diffère de sipHash64 en ce que l’état de pliage xor final n’est effectué que jusqu’à 128 bits. + +## cityHash64 {#cityhash64} + +Produit un 64 bits [CityHash](https://github.com/google/cityhash) la valeur de hachage. + +``` sql +cityHash64(par1,...) +``` + +Ceci est une fonction de hachage non cryptographique rapide. Il utilise L’algorithme CityHash pour les paramètres de chaîne et la fonction de hachage rapide non cryptographique spécifique à l’implémentation pour les paramètres avec d’autres types de données. La fonction utilise le combinateur CityHash pour obtenir les résultats finaux. + +**Paramètre** + +La fonction prend un nombre variable de paramètres d’entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql-reference/data-types/index.md). + +**Valeur Renvoyée** + +A [UInt64](../../sql-reference/data-types/int-uint.md) valeur de hachage du type de données. + +**Exemple** + +Appelez exemple: + +``` sql +SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type +``` + +``` text +┌─────────────CityHash─┬─type───┐ +│ 12072650598913549138 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +L’exemple suivant montre comment calculer la somme de l’ensemble de la table avec précision jusqu’à la ligne de commande: + +``` sql +SELECT groupBitXor(cityHash64(*)) FROM table +``` + +## intHash32 {#inthash32} + +Calcule un code de hachage 32 bits à partir de n’importe quel type d’entier. +C’est une fonction de hachage non cryptographique relativement rapide de qualité moyenne pour les nombres. + +## intHash64 {#inthash64} + +Calcule un code de hachage 64 bits à partir de n’importe quel type d’entier. +Il fonctionne plus vite que intHash32. Qualité moyenne. + +## SHA1 {#sha1} + +## SHA224 {#sha224} + +## SHA256 {#sha256} + +Calcule SHA-1, SHA-224 ou SHA-256 à partir d’une chaîne et renvoie l’ensemble d’octets résultant en tant que FixedString(20), FixedString(28) ou FixedString(32). +La fonction fonctionne assez lentement (SHA-1 traite environ 5 millions de chaînes courtes par seconde par cœur de processeur, tandis que SHA-224 et SHA-256 traitent environ 2,2 millions). +Nous vous recommandons d’utiliser cette fonction uniquement dans les cas où vous avez besoin d’une fonction de hachage spécifique et que vous ne pouvez pas la sélectionner. +Même dans ces cas, nous vous recommandons d’appliquer la fonction hors ligne et de pré-calculer les valeurs lors de leur insertion dans la table, au lieu de l’appliquer dans SELECTS. + +## URLHash(url \[, N\]) {#urlhashurl-n} + +Une fonction de hachage non cryptographique rapide et de qualité décente pour une chaîne obtenue à partir d’une URL en utilisant un type de normalisation. +`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` ou `#` à la fin, si elle est présente. +`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` ou `#` à la fin, si elle est présente. +Les niveaux sont les mêmes que dans URLHierarchy. Cette fonction est spécifique à Yandex.Metrica. + +## farmHash64 {#farmhash64} + +Produit un 64 bits [FarmHash](https://github.com/google/farmhash) la valeur de hachage. + +``` sql +farmHash64(par1, ...) +``` + +La fonction utilise le `Hash64` la méthode de tous les [les méthodes disponibles](https://github.com/google/farmhash/blob/master/src/farmhash.h). + +**Paramètre** + +La fonction prend un nombre variable de paramètres d’entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql-reference/data-types/index.md). + +**Valeur Renvoyée** + +A [UInt64](../../sql-reference/data-types/int-uint.md) valeur de hachage du type de données. + +**Exemple** + +``` sql +SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type +``` + +``` text +┌─────────────FarmHash─┬─type───┐ +│ 17790458267262532859 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## javaHash {#hash_functions-javahash} + +Calculer [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) à partir d’une chaîne. Cette fonction de hachage n’est ni rapide ni de bonne qualité. La seule raison de l’utiliser est lorsque cet algorithme est déjà utilisé dans un autre système et que vous devez calculer exactement le même résultat. + +**Syntaxe** + +``` sql +SELECT javaHash(''); +``` + +**Valeur renvoyée** + +A `Int32` valeur de hachage du type de données. + +**Exemple** + +Requête: + +``` sql +SELECT javaHash('Hello, world!'); +``` + +Résultat: + +``` text +┌─javaHash('Hello, world!')─┐ +│ -1880044555 │ +└───────────────────────────┘ +``` + +## javaHashUTF16LE {#javahashutf16le} + +Calculer [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) à partir d’une chaîne, en supposant qu’elle contient des octets représentant une chaîne en encodage UTF-16LE. + +**Syntaxe** + +``` sql +javaHashUTF16LE(stringUtf16le) +``` + +**Paramètre** + +- `stringUtf16le` — a string in UTF-16LE encoding. + +**Valeur renvoyée** + +A `Int32` valeur de hachage du type de données. + +**Exemple** + +Requête correcte avec une chaîne codée UTF-16LE. + +Requête: + +``` sql +SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) +``` + +Résultat: + +``` text +┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ +│ 3556498 │ +└──────────────────────────────────────────────────────────────┘ +``` + +## hiveHash {#hash-functions-hivehash} + +Calculer `HiveHash` à partir d’une chaîne. + +``` sql +SELECT hiveHash(''); +``` + +C’est juste [JavaHash](#hash_functions-javahash) avec le bit de signe mis à zéro. Cette fonction est utilisée dans [Apache Hive](https://en.wikipedia.org/wiki/Apache_Hive) pour les versions antérieures à la version 3.0. Cette fonction de hachage n’est ni rapide ni de bonne qualité. La seule raison de l’utiliser est lorsque cet algorithme est déjà utilisé dans un autre système et que vous devez calculer exactement le même résultat. + +**Valeur renvoyée** + +A `Int32` valeur de hachage du type de données. + +Type: `hiveHash`. + +**Exemple** + +Requête: + +``` sql +SELECT hiveHash('Hello, world!'); +``` + +Résultat: + +``` text +┌─hiveHash('Hello, world!')─┐ +│ 267439093 │ +└───────────────────────────┘ +``` + +## metroHash64 {#metrohash64} + +Produit un 64 bits [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/) la valeur de hachage. + +``` sql +metroHash64(par1, ...) +``` + +**Paramètre** + +La fonction prend un nombre variable de paramètres d’entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql-reference/data-types/index.md). + +**Valeur Renvoyée** + +A [UInt64](../../sql-reference/data-types/int-uint.md) valeur de hachage du type de données. + +**Exemple** + +``` sql +SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type +``` + +``` text +┌────────────MetroHash─┬─type───┐ +│ 14235658766382344533 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## jumpConsistentHash {#jumpconsistenthash} + +Calcule JumpConsistentHash forme un UInt64. +Accepte deux arguments: une clé de type UInt64 et le nombre de compartiments. Renvoie Int32. +Pour plus d’informations, voir le lien: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) + +## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} + +Produit un [MurmurHash2](https://github.com/aappleby/smhasher) la valeur de hachage. + +``` sql +murmurHash2_32(par1, ...) +murmurHash2_64(par1, ...) +``` + +**Paramètre** + +Les deux fonctions prennent un nombre variable de paramètres d’entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql-reference/data-types/index.md). + +**Valeur Renvoyée** + +- Le `murmurHash2_32` fonction renvoie la valeur de hachage ayant le [UInt32](../../sql-reference/data-types/int-uint.md) type de données. +- Le `murmurHash2_64` fonction renvoie la valeur de hachage ayant le [UInt64](../../sql-reference/data-types/int-uint.md) type de données. + +**Exemple** + +``` sql +SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type +``` + +``` text +┌──────────MurmurHash2─┬─type───┐ +│ 11832096901709403633 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} + +Produit un [MurmurHash3](https://github.com/aappleby/smhasher) la valeur de hachage. + +``` sql +murmurHash3_32(par1, ...) +murmurHash3_64(par1, ...) +``` + +**Paramètre** + +Les deux fonctions prennent un nombre variable de paramètres d’entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql-reference/data-types/index.md). + +**Valeur Renvoyée** + +- Le `murmurHash3_32` la fonction retourne un [UInt32](../../sql-reference/data-types/int-uint.md) valeur de hachage du type de données. +- Le `murmurHash3_64` la fonction retourne un [UInt64](../../sql-reference/data-types/int-uint.md) valeur de hachage du type de données. + +**Exemple** + +``` sql +SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3─┬─type───┐ +│ 2152717 │ UInt32 │ +└─────────────┴────────┘ +``` + +## murmurHash3\_128 {#murmurhash3-128} + +Produit de 128 bits [MurmurHash3](https://github.com/aappleby/smhasher) la valeur de hachage. + +``` sql +murmurHash3_128( expr ) +``` + +**Paramètre** + +- `expr` — [Expression](../syntax.md#syntax-expressions) de retour d’un [Chaîne](../../sql-reference/data-types/string.md)-le type de la valeur. + +**Valeur Renvoyée** + +A [FixedString (16)](../../sql-reference/data-types/fixedstring.md) valeur de hachage du type de données. + +**Exemple** + +``` sql +SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3──────┬─type────────────┐ +│ 6�1�4"S5KT�~~q │ FixedString(16) │ +└──────────────────┴─────────────────┘ +``` + +## xxHash32, xxHash64 {#hash-functions-xxhash32} + +Calculer `xxHash` à partir d’une chaîne. Il est proposé en deux saveurs, 32 et 64 bits. + +``` sql +SELECT xxHash32(''); + +OR + +SELECT xxHash64(''); +``` + +**Valeur renvoyée** + +A `Uint32` ou `Uint64` valeur de hachage du type de données. + +Type: `xxHash`. + +**Exemple** + +Requête: + +``` sql +SELECT xxHash32('Hello, world!'); +``` + +Résultat: + +``` text +┌─xxHash32('Hello, world!')─┐ +│ 834093149 │ +└───────────────────────────┘ +``` + +**Voir Aussi** + +- [xxHash](http://cyan4973.github.io/xxHash/). + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/fr/sql-reference/functions/higher-order-functions.md b/docs/fr/sql-reference/functions/higher-order-functions.md new file mode 100644 index 00000000000..13128474efe --- /dev/null +++ b/docs/fr/sql-reference/functions/higher-order-functions.md @@ -0,0 +1,264 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 57 +toc_title: "D'Ordre Sup\xE9rieur" +--- + +# Fonctions d’ordre supérieur {#higher-order-functions} + +## `->` opérateur, fonction lambda (params, expr) {#operator-lambdaparams-expr-function} + +Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. + +Exemple: `x -> 2 * x, str -> str != Referer.` + +Les fonctions d’ordre supérieur ne peuvent accepter que les fonctions lambda comme argument fonctionnel. + +Une fonction lambda qui accepte plusieurs arguments peuvent être passés à une fonction d’ordre supérieur. Dans ce cas, la fonction d’ordre supérieur est passé plusieurs tableaux de longueur identique que ces arguments correspondent. + +Pour certaines fonctions, telles que [arrayCount](#higher_order_functions-array-count) ou [arraySum](#higher_order_functions-array-count) le premier argument (la fonction lambda) peut être omis. Dans ce cas, un mappage identique est supposé. + +Une fonction lambda ne peut pas être omise pour les fonctions suivantes: + +- [arrayMap](#higher_order_functions-array-map) +- [arrayFilter](#higher_order_functions-array-filter) +- [arrayFill](#higher_order_functions-array-fill) +- [arrayReverseFill](#higher_order_functions-array-reverse-fill) +- [arraySplit](#higher_order_functions-array-split) +- [arrayReverseSplit](#higher_order_functions-array-reverse-split) +- [arrayFirst](#higher_order_functions-array-first) +- [arrayFirstIndex](#higher_order_functions-array-first-index) + +### arrayMap(func, arr1, …) {#higher_order_functions-array-map} + +Renvoie un tableau obtenu à partir de l’application d’origine `func` fonction à chaque élément dans le `arr` tableau. + +Exemple: + +``` sql +SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,4,5] │ +└─────────┘ +``` + +L’exemple suivant montre comment créer un n-uplet d’éléments de différents tableaux: + +``` sql +SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res +``` + +``` text +┌─res─────────────────┐ +│ [(1,4),(2,5),(3,6)] │ +└─────────────────────┘ +``` + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayMap` fonction. + +### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} + +Renvoie un tableau contenant uniquement les éléments `arr1` pour ce qui `func` retourne autre chose que 0. + +Exemple: + +``` sql +SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res +``` + +``` text +┌─res───────────┐ +│ ['abc World'] │ +└───────────────┘ +``` + +``` sql +SELECT + arrayFilter( + (i, x) -> x LIKE '%World%', + arrayEnumerate(arr), + ['Hello', 'abc World'] AS arr) + AS res +``` + +``` text +┌─res─┐ +│ [2] │ +└─────┘ +``` + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFilter` fonction. + +### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} + +Analyse par le biais de `arr1` du premier élément au dernier élément et remplacer `arr1[i]` par `arr1[i - 1]` si `func` renvoie 0. Le premier élément de `arr1` ne sera pas remplacé. + +Exemple: + +``` sql +SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res──────────────────────────────┐ +│ [1,1,3,11,12,12,12,5,6,14,14,14] │ +└──────────────────────────────────┘ +``` + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFill` fonction. + +### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} + +Analyse par le biais de `arr1` du dernier élément au premier élément et remplacer `arr1[i]` par `arr1[i + 1]` si `func` renvoie 0. Le dernier élément de `arr1` ne sera pas remplacé. + +Exemple: + +``` sql +SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res────────────────────────────────┐ +│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ +└────────────────────────────────────┘ +``` + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayReverseFill` fonction. + +### arraySplit(func, arr1, …) {#higher_order_functions-array-split} + +Split `arr1` en plusieurs tableaux. Lorsque `func` retourne autre chose que 0, la matrice sera de split sur le côté gauche de l’élément. Le tableau ne sera pas partagé avant le premier élément. + +Exemple: + +``` sql +SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res─────────────┐ +│ [[1,2,3],[4,5]] │ +└─────────────────┘ +``` + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arraySplit` fonction. + +### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} + +Split `arr1` en plusieurs tableaux. Lorsque `func` retourne autre chose que 0, la matrice sera de split sur le côté droit de l’élément. Le tableau ne sera pas divisé après le dernier élément. + +Exemple: + +``` sql +SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res───────────────┐ +│ [[1],[2,3,4],[5]] │ +└───────────────────┘ +``` + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arraySplit` fonction. + +### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} + +Renvoie le nombre d’éléments dans l’arr tableau pour lequel func renvoie autre chose que 0. Si ‘func’ n’est pas spécifié, il renvoie le nombre d’éléments non nuls dans le tableau. + +### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} + +Renvoie 1 s’il existe au moins un élément ‘arr’ pour ce qui ‘func’ retourne autre chose que 0. Sinon, il renvoie 0. + +### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} + +Renvoie 1 si ‘func’ retourne autre chose que 0 pour tous les éléments de ‘arr’. Sinon, il renvoie 0. + +### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} + +Renvoie la somme de la ‘func’ valeur. Si la fonction est omise, elle retourne la somme des éléments du tableau. + +### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} + +Renvoie le premier élément du ‘arr1’ tableau pour lequel ‘func’ retourne autre chose que 0. + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFirst` fonction. + +### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} + +Renvoie l’index du premier élément de la ‘arr1’ tableau pour lequel ‘func’ retourne autre chose que 0. + +Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFirstIndex` fonction. + +### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} + +Retourne un tableau des sommes partielles d’éléments dans le tableau source (une somme). Si l’ `func` la fonction est spécifiée, les valeurs des éléments du tableau sont convertis par cette fonction avant l’addition. + +Exemple: + +``` sql +SELECT arrayCumSum([1, 1, 1, 1]) AS res +``` + +``` text +┌─res──────────┐ +│ [1, 2, 3, 4] │ +└──────────────┘ +``` + +### arrayCumSumNonNegative (arr) {#arraycumsumnonnegativearr} + +Même que `arrayCumSum`, renvoie un tableau des sommes partielles d’éléments dans le tableau source (une somme). Différent `arrayCumSum`, lorsque la valeur renvoyée contient une valeur inférieure à zéro, la valeur est remplacée par zéro et le calcul ultérieur est effectué avec des paramètres zéro. Exemple: + +``` sql +SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,0,1] │ +└───────────┘ +``` + +### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} + +Renvoie un tableau à la suite du tri des éléments de `arr1` dans l’ordre croissant. Si l’ `func` la fonction est spécifiée, l’ordre de classement est déterminé par le résultat de la fonction `func` appliquée aux éléments du tableau (tableaux) + +Le [Transformation schwartzienne](https://en.wikipedia.org/wiki/Schwartzian_transform) est utilisé pour améliorer l’efficacité du tri. + +Exemple: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Pour plus d’informations sur la `arraySort` la méthode, voir l’ [Fonctions pour travailler avec des tableaux](array-functions.md#array_functions-sort) section. + +### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} + +Renvoie un tableau à la suite du tri des éléments de `arr1` dans l’ordre décroissant. Si l’ `func` la fonction est spécifiée, l’ordre de classement est déterminé par le résultat de la fonction `func` appliquée aux éléments du tableau (tableaux). + +Exemple: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +Pour plus d’informations sur la `arrayReverseSort` la méthode, voir l’ [Fonctions pour travailler avec des tableaux](array-functions.md#array_functions-reverse-sort) section. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/fr/sql-reference/functions/in-functions.md b/docs/fr/sql-reference/functions/in-functions.md new file mode 100644 index 00000000000..2779caad651 --- /dev/null +++ b/docs/fr/sql-reference/functions/in-functions.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 60 +toc_title: "Mise en \u0153uvre de L'op\xE9rateur IN" +--- + +# Fonctions De Mise En œuvre De L’opérateur IN {#functions-for-implementing-the-in-operator} + +## in, notin, globalIn, globalNotIn {#in-functions} + +Voir la section [Dans les opérateurs](../statements/select.md#select-in-operators). + +## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} + +Une fonction qui permet de regrouper plusieurs colonnes. +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. +Les Tuples sont normalement utilisés comme valeurs intermédiaires pour un argument D’opérateurs IN, ou pour créer une liste de paramètres formels de fonctions lambda. Les Tuples ne peuvent pas être écrits sur une table. + +## tupleElement (tuple, n), opérateur X. N {#tupleelementtuple-n-operator-x-n} + +Une fonction qui permet d’obtenir une colonne à partir d’un tuple. +‘N’ est l’index de colonne, à partir de 1. N doit être une constante. ‘N’ doit être une constante. ‘N’ doit être un entier postif strict ne dépassant pas la taille du tuple. +Il n’y a aucun coût pour exécuter la fonction. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/fr/sql-reference/functions/index.md b/docs/fr/sql-reference/functions/index.md new file mode 100644 index 00000000000..6ef3ace8d9c --- /dev/null +++ b/docs/fr/sql-reference/functions/index.md @@ -0,0 +1,74 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Functions +toc_priority: 32 +toc_title: Introduction +--- + +# Fonction {#functions} + +Il y a au moins\* deux types de fonctions - des fonctions régulières (elles sont simplement appelées “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn’t depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). + +Dans cette section, nous discutons des fonctions classiques. Pour les fonctions d’agrégation, voir la section “Aggregate functions”. + +\* - Il existe un troisième type de fonction ‘arrayJoin’ la fonction appartient à; les fonctions de table peuvent également être mentionnées séparément.\* + +## Typage Fort {#strong-typing} + +Contrairement à SQL standard, ClickHouse a une forte typage. En d’autres termes, il ne fait pas de conversions implicites entre les types. Chaque fonction fonctionne pour un ensemble spécifique de types. Cela signifie que vous devez parfois utiliser des fonctions de conversion de type. + +## Élimination Des Sous-expressions Courantes {#common-subexpression-elimination} + +Toutes les expressions d’une requête qui ont le même AST (le même enregistrement ou le même résultat d’analyse syntaxique) sont considérées comme ayant des valeurs identiques. De telles expressions sont concaténées et exécutées une fois. Les sous-requêtes identiques sont également éliminées de cette façon. + +## Types De résultats {#types-of-results} + +Toutes les fonctions renvoient un seul retour comme résultat (pas plusieurs valeurs, et pas des valeurs nulles). Le type de résultat est généralement défini uniquement par les types d’arguments, pas par les valeurs. Les Exceptions sont la fonction tupleElement (l’opérateur A. N) et la fonction toFixedString. + +## Constant {#constants} + +Pour simplifier, certaines fonctions ne peuvent fonctionner qu’avec des constantes pour certains arguments. Par exemple, le bon argument de L’opérateur LIKE doit être une constante. +Presque toutes les fonctions renvoient une constante pour des arguments constants. L’exception est les fonctions qui génèrent des nombres aléatoires. +Le ‘now’ function renvoie des valeurs différentes pour les requêtes qui ont été exécutées à des moments différents, mais le résultat est considéré comme une constante, car la constance n’est importante que dans une seule requête. +Une expression constante est également considérée comme une constante (par exemple, la moitié droite de L’opérateur LIKE peut être construite à partir de plusieurs constantes). + +Les fonctions peuvent être implémentées de différentes manières pour des arguments constants et non constants (un code différent est exécuté). Mais les résultats pour une constante et pour une colonne vraie Ne contenant que la même valeur doivent correspondre les uns aux autres. + +## Le Traitement NULL {#null-processing} + +Les fonctions ont les comportements suivants: + +- Si au moins l’un des arguments de la fonction est `NULL` le résultat de la fonction est également `NULL`. +- Comportement spécial spécifié individuellement dans la description de chaque fonction. Dans le code source de ClickHouse, ces fonctions ont `UseDefaultImplementationForNulls=false`. + +## Constance {#constancy} + +Functions can’t change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. + +## Erreur De Manipulation {#error-handling} + +Certaines fonctions peuvent lancer une exception si les données ne sont pas valides. Dans ce cas, la requête est annulée et un message d’erreur est retourné au client. Pour le traitement distribué, lorsqu’une exception se produit sur l’un des serveurs, les autres serveurs aussi tenté d’interrompre la requête. + +## Évaluation Des Expressions d’argument {#evaluation-of-argument-expressions} + +Dans presque tous les langages de programmation, l’un des arguments peut pas être évalué pour certains opérateurs. Ce sont généralement les opérateurs `&&`, `||`, et `?:`. +Mais dans ClickHouse, les arguments des fonctions (opérateurs) sont toujours évalués. En effet, des parties entières de colonnes sont évaluées à la fois, au lieu de calculer chaque ligne séparément. + +## Exécution De Fonctions Pour Le Traitement De requêtes distribuées {#performing-functions-for-distributed-query-processing} + +Pour le traitement de requête distribué, autant d’étapes de traitement de requête que possible sont effectuées sur des serveurs distants, et le reste des étapes (fusion des résultats intermédiaires et tout ce qui suit) sont effectuées sur le serveur demandeur. + +Cela signifie que les fonctions peuvent être effectuées sur différents serveurs. +Par exemple, dans la requête `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` + +- si un `distributed_table` a au moins deux fragments, les fonctions ‘g’ et ‘h’ sont effectuées sur des serveurs distants, et la fonction ‘f’ est effectuée sur le serveur demandeur. +- si un `distributed_table` a un seul fragment, tous les ‘f’, ‘g’, et ‘h’ les fonctions sont exécutées sur le serveur de ce fragment. + +Le résultat d’une fonction habituellement ne dépendent pas le serveur sur lequel elle est exécutée. Cependant, parfois c’est important. +Par exemple, les fonctions qui fonctionnent avec des dictionnaires utilisent le dictionnaire qui existe sur le serveur sur lequel elles s’exécutent. +Un autre exemple est l’ `hostName` fonction, qui renvoie le nom du serveur sur lequel il s’exécute afin de `GROUP BY` par les serveurs dans un `SELECT` requête. + +Si une fonction dans une requête est effectuée sur le demandeur serveur, mais vous devez l’exécuter sur des serveurs distants, vous pouvez l’envelopper dans un ‘any’ fonction d’agrégation ou l’ajouter à une clé dans `GROUP BY`. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/fr/sql-reference/functions/introspection.md b/docs/fr/sql-reference/functions/introspection.md new file mode 100644 index 00000000000..423dc446dae --- /dev/null +++ b/docs/fr/sql-reference/functions/introspection.md @@ -0,0 +1,310 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 65 +toc_title: Introspection +--- + +# Fonctions D’Introspection {#introspection-functions} + +Vous pouvez utiliser les fonctions décrites dans ce chapitre pour introspecter [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) et [DWARF](https://en.wikipedia.org/wiki/DWARF) pour le profilage de requête. + +!!! warning "Avertissement" + Ces fonctions sont lentes et peuvent imposer des considérations de sécurité. + +Pour le bon fonctionnement des fonctions d’introspection: + +- Installer le `clickhouse-common-static-dbg` paquet. + +- Définir le [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) réglage sur 1. + + For security reasons introspection functions are disabled by default. + +Clickhouse enregistre les rapports du profileur [trace\_log](../../operations/system-tables.md#system_tables-trace_log) système de table. Assurez-vous que la table et le profileur sont correctement configurés. + +## addressToLine {#addresstoline} + +Convertit l’adresse de mémoire virtuelle dans le processus de serveur ClickHouse en nom de fichier et en numéro de ligne dans le code source de ClickHouse. + +Si vous utilisez des paquets clickhouse officiels, vous devez installer le `clickhouse-common-static-dbg` paquet. + +**Syntaxe** + +``` sql +addressToLine(address_of_binary_instruction) +``` + +**Paramètre** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**Valeur renvoyée** + +- Nom de fichier du code Source et le numéro de ligne dans ce fichier délimité par deux-points. + + For example, `/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199`, where `199` is a line number. + +- Nom d’un binaire, si la fonction n’a pas pu trouver les informations de débogage. + +- Chaîne vide, si l’adresse n’est pas valide. + +Type: [Chaîne](../../sql-reference/data-types/string.md). + +**Exemple** + +Activation des fonctions d’introspection: + +``` sql +SET allow_introspection_functions=1 +``` + +Sélection de la première chaîne de `trace_log` système de table: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-19 +event_time: 2019-11-19 18:57:23 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 421b6855-1858-45a5-8f37-f383409d6d72 +trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] +``` + +Le `trace` champ contient la trace de pile au moment de l’échantillonnage. + +Obtenir le nom de fichier du code source et le numéro de ligne pour une seule adresse: + +``` sql +SELECT addressToLine(94784076370703) \G +``` + +``` text +Row 1: +────── +addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 +``` + +Application de la fonction à la trace de la pile entière: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines +FROM system.trace_log +LIMIT 1 +\G +``` + +Le [arrayMap](higher-order-functions.md#higher_order_functions-array-map) permet de traiter chaque élément individuel de l’ `trace` tableau par la `addressToLine` fonction. Le résultat de ce traitement que vous voyez dans l’ `trace_source_code_lines` colonne de sortie. + +``` text +Row 1: +────── +trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so +/usr/lib/debug/usr/bin/clickhouse +/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 +/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.h:155 +/usr/include/c++/9/bits/atomic_base.h:551 +/usr/lib/debug/usr/bin/clickhouse +/lib/x86_64-linux-gnu/libpthread-2.27.so +/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 +``` + +## adressetosymbol {#addresstosymbol} + +Convertit l’adresse de mémoire virtuelle dans le processus de serveur ClickHouse en symbole à partir des fichiers d’objets ClickHouse. + +**Syntaxe** + +``` sql +addressToSymbol(address_of_binary_instruction) +``` + +**Paramètre** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**Valeur renvoyée** + +- Symbole des fichiers D’objets ClickHouse. +- Chaîne vide, si l’adresse n’est pas valide. + +Type: [Chaîne](../../sql-reference/data-types/string.md). + +**Exemple** + +Activation des fonctions d’introspection: + +``` sql +SET allow_introspection_functions=1 +``` + +Sélection de la première chaîne de `trace_log` système de table: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +Le `trace` champ contient la trace de pile au moment de l’échantillonnage. + +Obtenir un symbole pour une seule adresse: + +``` sql +SELECT addressToSymbol(94138803686098) \G +``` + +``` text +Row 1: +────── +addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +``` + +Application de la fonction à la trace de la pile entière: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols +FROM system.trace_log +LIMIT 1 +\G +``` + +Le [arrayMap](higher-order-functions.md#higher_order_functions-array-map) permet de traiter chaque élément individuel de l’ `trace` tableau par la `addressToSymbols` fonction. Le résultat de ce traitement que vous voyez dans l’ `trace_symbols` colonne de sortie. + +``` text +Row 1: +────── +trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE +_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb +_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb +_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE +_ZN2DB27AggregatingBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB28AsynchronousBlockInputStream9calculateEv +_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data +_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E +_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv +_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E +execute_native_thread_routine +start_thread +clone +``` + +## demangle {#demangle} + +Convertit un symbole que vous pouvez obtenir en utilisant le [adressetosymbol](#addresstosymbol) fonction au nom de la fonction c++. + +**Syntaxe** + +``` sql +demangle(symbol) +``` + +**Paramètre** + +- `symbol` ([Chaîne](../../sql-reference/data-types/string.md)) — Symbol from an object file. + +**Valeur renvoyée** + +- Nom de la fonction C++. +- Chaîne vide si un symbole n’est pas valide. + +Type: [Chaîne](../../sql-reference/data-types/string.md). + +**Exemple** + +Activation des fonctions d’introspection: + +``` sql +SET allow_introspection_functions=1 +``` + +Sélection de la première chaîne de `trace_log` système de table: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +Le `trace` champ contient la trace de pile au moment de l’échantillonnage. + +Obtenir un nom de fonction pour une seule adresse: + +``` sql +SELECT demangle(addressToSymbol(94138803686098)) \G +``` + +``` text +Row 1: +────── +demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +``` + +Application de la fonction à la trace de la pile entière: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions +FROM system.trace_log +LIMIT 1 +\G +``` + +Le [arrayMap](higher-order-functions.md#higher_order_functions-array-map) permet de traiter chaque élément individuel de l’ `trace` tableau par la `demangle` fonction. Le résultat de ce traitement que vous voyez dans l’ `trace_functions` colonne de sortie. + +``` text +Row 1: +────── +trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const +DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) +DB::AggregatingBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::AsynchronousBlockInputStream::calculate() +std::_Function_handler::_M_invoke(std::_Any_data const&) +ThreadPoolImpl::worker(std::_List_iterator) +ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const +ThreadPoolImpl::worker(std::_List_iterator) +execute_native_thread_routine +start_thread +clone +``` diff --git a/docs/fr/sql-reference/functions/ip-address-functions.md b/docs/fr/sql-reference/functions/ip-address-functions.md new file mode 100644 index 00000000000..b974e9a047c --- /dev/null +++ b/docs/fr/sql-reference/functions/ip-address-functions.md @@ -0,0 +1,248 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 55 +toc_title: Travailler avec des adresses IP +--- + +# Fonctions Pour Travailler Avec Des Adresses IP {#functions-for-working-with-ip-addresses} + +## IPv4NumToString (num) {#ipv4numtostringnum} + +Prend un numéro UInt32. Interprète comme une adresse IPv4 dans big endian. Renvoie une chaîne contenant l’adresse IPv4 correspondante au format A. B. C. d (Nombres séparés par des points sous forme décimale). + +## IPv4StringToNum (s) {#ipv4stringtonums} + +La fonction inverse de IPv4NumToString. Si L’adresse IPv4 a un format non valide, elle renvoie 0. + +## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} + +Similaire à IPv4NumToString, mais en utilisant xxx au lieu du dernier octet. + +Exemple: + +``` sql +SELECT + IPv4NumToStringClassC(ClientIP) AS k, + count() AS c +FROM test.hits +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─k──────────────┬─────c─┐ +│ 83.149.9.xxx │ 26238 │ +│ 217.118.81.xxx │ 26074 │ +│ 213.87.129.xxx │ 25481 │ +│ 83.149.8.xxx │ 24984 │ +│ 217.118.83.xxx │ 22797 │ +│ 78.25.120.xxx │ 22354 │ +│ 213.87.131.xxx │ 21285 │ +│ 78.25.121.xxx │ 20887 │ +│ 188.162.65.xxx │ 19694 │ +│ 83.149.48.xxx │ 17406 │ +└────────────────┴───────┘ +``` + +Depuis l’utilisation de ‘xxx’ est très inhabituel, cela peut être changé à l’avenir. Nous vous recommandons de ne pas compter sur le format exact de ce fragment. + +### IPv6NumToString (x) {#ipv6numtostringx} + +Accepte une valeur FixedString (16) contenant L’adresse IPv6 au format binaire. Renvoie une chaîne contenant cette adresse au format texte. +Les adresses IPv4 mappées IPv6 sont sorties au format:: ffff: 111.222.33.44. Exemple: + +``` sql +SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr +``` + +``` text +┌─addr─────────┐ +│ 2a02:6b8::11 │ +└──────────────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ +│ 2a02:2168:aaa:bbbb::2 │ 24695 │ +│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ +│ 2a02:6b8:0:fff::ff │ 16389 │ +│ 2a01:4f8:111:6666::2 │ 16016 │ +│ 2a02:2168:888:222::1 │ 15896 │ +│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ +│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ +│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ +│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ +│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ +└─────────────────────────────────────────┴───────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)─┬──────c─┐ +│ ::ffff:94.26.111.111 │ 747440 │ +│ ::ffff:37.143.222.4 │ 529483 │ +│ ::ffff:5.166.111.99 │ 317707 │ +│ ::ffff:46.38.11.77 │ 263086 │ +│ ::ffff:79.105.111.111 │ 186611 │ +│ ::ffff:93.92.111.88 │ 176773 │ +│ ::ffff:84.53.111.33 │ 158709 │ +│ ::ffff:217.118.11.22 │ 154004 │ +│ ::ffff:217.118.11.33 │ 148449 │ +│ ::ffff:217.118.11.44 │ 148243 │ +└────────────────────────────┴────────┘ +``` + +## IPv6StringToNum (s) {#ipv6stringtonums} + +La fonction inverse de IPv6NumToString. Si L’adresse IPv6 a un format non valide, elle renvoie une chaîne d’octets null. +HEX peut être en majuscules ou en minuscules. + +## IPv4ToIPv6 (x) {#ipv4toipv6x} + +Prend un `UInt32` nombre. Interprète comme une adresse IPv4 dans [big endian](https://en.wikipedia.org/wiki/Endianness). Retourne un `FixedString(16)` valeur contenant l’adresse IPv6 au format binaire. Exemple: + +``` sql +SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr +``` + +``` text +┌─addr───────────────┐ +│ ::ffff:192.168.0.1 │ +└────────────────────┘ +``` + +## cutIPv6 (x, bitsToCutForIPv6, bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} + +Accepte une valeur FixedString (16) contenant L’adresse IPv6 au format binaire. Renvoie une chaîne contenant l’adresse du nombre spécifié de bits retiré au format texte. Exemple: + +``` sql +WITH + IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, + IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 +SELECT + cutIPv6(ipv6, 2, 0), + cutIPv6(ipv4, 0, 2) +``` + +``` text +┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ +│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ +└─────────────────────────────────────┴─────────────────────┘ +``` + +## Ipv4cirtorange (ipv4, Cidr), {#ipv4cidrtorangeipv4-cidr} + +Accepte un IPv4 et une valeur UInt8 contenant [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Renvoie un tuple avec deux IPv4 contenant la plage inférieure et la plage supérieure du sous-réseau. + +``` sql +SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) +``` + +``` text +┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ +│ ('192.168.0.0','192.168.255.255') │ +└────────────────────────────────────────────┘ +``` + +## Ipv6cirtorange (ipv6, Cidr), {#ipv6cidrtorangeipv6-cidr} + +Accepte un IPv6 et une valeur UInt8 contenant le CIDR. Renvoie un tuple avec deux IPv6 contenant la plage inférieure et la plage supérieure du sous-réseau. + +``` sql +SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); +``` + +``` text +┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ +│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ +└────────────────────────────────────────────────────────────────────────┘ +``` + +## toipv4 (chaîne) {#toipv4string} + +Un alias `IPv4StringToNum()` cela prend une forme de chaîne D’adresse IPv4 et renvoie la valeur de [IPv4](../../sql-reference/data-types/domains/ipv4.md) type, qui est binaire égal à la valeur renvoyée par `IPv4StringToNum()`. + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + toTypeName(IPv4StringToNum(IPv4_string)), + toTypeName(toIPv4(IPv4_string)) +``` + +``` text +┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ +│ UInt32 │ IPv4 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + hex(IPv4StringToNum(IPv4_string)), + hex(toIPv4(IPv4_string)) +``` + +``` text +┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ +│ ABE1822D │ ABE1822D │ +└───────────────────────────────────┴──────────────────────────┘ +``` + +## toipv6 (chaîne) {#toipv6string} + +Un alias `IPv6StringToNum()` cela prend une forme de chaîne D’adresse IPv6 et renvoie la valeur de [IPv6](../../sql-reference/data-types/domains/ipv6.md) type, qui est binaire égal à la valeur renvoyée par `IPv6StringToNum()`. + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + toTypeName(IPv6StringToNum(IPv6_string)), + toTypeName(toIPv6(IPv6_string)) +``` + +``` text +┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ +│ FixedString(16) │ IPv6 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + hex(IPv6StringToNum(IPv6_string)), + hex(toIPv6(IPv6_string)) +``` + +``` text +┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ +│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ +└───────────────────────────────────┴──────────────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/fr/sql-reference/functions/json-functions.md b/docs/fr/sql-reference/functions/json-functions.md new file mode 100644 index 00000000000..09b04c5b7a6 --- /dev/null +++ b/docs/fr/sql-reference/functions/json-functions.md @@ -0,0 +1,231 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 56 +toc_title: Travailler avec JSON. +--- + +# Fonctions Pour Travailler Avec JSON {#functions-for-working-with-json} + +Dans Yandex.Metrica, JSON est transmis par les utilisateurs en tant que paramètres de session. Il y a quelques fonctions spéciales pour travailler avec ce JSON. (Bien que dans la plupart des cas, les JSONs soient en outre prétraités et les valeurs résultantes sont placées dans des colonnes séparées dans leur format traité.) Toutes ces fonctions sont basées sur des hypothèses fortes sur ce que le JSON peut être, mais elles essaient de faire le moins possible pour faire le travail. + +Les hypothèses suivantes sont apportées: + +1. Le nom du champ (argument de fonction) doit être une constante. +2. Le nom du champ est en quelque sorte codé canoniquement dans JSON. Exemple: `visitParamHas('{"abc":"def"}', 'abc') = 1`, mais `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` +3. Les champs sont recherchés à n’importe quel niveau d’imbrication, sans discrimination. S’il y a plusieurs champs correspondants, la première occurrence est utilisé. +4. Le JSON n’a pas de caractères d’espace en dehors des littéraux de chaîne. + +## visitParamHas(params, nom) {#visitparamhasparams-name} + +Vérifie s’il existe un champ avec ‘name’ nom. + +## visitParamExtractUInt(params, nom) {#visitparamextractuintparams-name} + +Analyse UInt64 à partir de la valeur du champ nommé ‘name’. Si c’est un champ de type chaîne, il tente d’analyser un numéro à partir du début de la chaîne. Si le champ n’existe pas, ou s’il existe mais ne contient pas de nombre, il renvoie 0. + +## visitParamExtractInt(params, name) {#visitparamextractintparams-name} + +Le même que pour Int64. + +## visitParamExtractFloat(params, nom) {#visitparamextractfloatparams-name} + +Le même que pour Float64. + +## visitParamExtractBool(params, nom) {#visitparamextractboolparams-name} + +Analyse d’une valeur vrai/faux. Le résultat est UInt8. + +## visitParamExtractRaw(params, nom) {#visitparamextractrawparams-name} + +Retourne la valeur d’un champ, y compris les séparateurs. + +Exemple: + +``` sql +visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' +visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' +``` + +## visitParamExtractString(params, nom) {#visitparamextractstringparams-name} + +Analyse la chaîne entre guillemets doubles. La valeur est sans échappement. Si l’échappement échoue, il renvoie une chaîne vide. + +Exemple: + +``` sql +visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' +visitParamExtractString('{"abc":"hello}', 'abc') = '' +``` + +Il n’y a actuellement aucun support pour les points de code dans le format `\uXXXX\uYYYY` qui ne proviennent pas du plan multilingue de base (ils sont convertis en CESU-8 au lieu de UTF-8). + +Les fonctions suivantes sont basées sur [simdjson](https://github.com/lemire/simdjson) conçu pour des exigences D’analyse JSON plus complexes. L’hypothèse 2 mentionnée ci-dessus s’applique toujours. + +## isValidJSON (json) {#isvalidjsonjson} + +Vérifie que la chaîne est un json valide. + +Exemple: + +``` sql +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} + +Si la valeur existe dans le document JSON, `1` sera retourné. + +Si la valeur n’existe pas, `0` sera retourné. + +Exemple: + +``` sql +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 +``` + +`indices_or_keys` est une liste de zéro ou plusieurs arguments chacun d’entre eux peut être une chaîne ou un entier. + +- String = membre d’objet d’accès par clé. +- Entier positif = accédez au n-ème membre / clé depuis le début. +- Entier négatif = accédez au n-ème membre / clé à partir de la fin. + +Minimum de l’indice de l’élément est 1. Ainsi, l’élément 0 n’existe pas. + +Vous pouvez utiliser des entiers pour accéder à la fois aux tableaux JSON et aux objets JSON. + +Ainsi, par exemple: + +``` sql +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' +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} + +Renvoie la longueur D’un tableau JSON ou d’un objet JSON. + +Si la valeur n’existe pas ou a un mauvais type, `0` sera retourné. + +Exemple: + +``` sql +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} + +De retour le type d’une valeur JSON. + +Si la valeur n’existe pas, `Null` sera retourné. + +Exemple: + +``` sql +SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' +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} + +## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} + +## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} + +## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} + +Analyse un JSON et extrait une valeur. Ces fonctions sont similaires à `visitParam` fonction. + +Si la valeur n’existe pas ou a un mauvais type, `0` sera retourné. + +Exemple: + +``` sql +SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 +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} + +Analyse un JSON et extrait une chaîne. Cette fonction est similaire à `visitParamExtractString` fonction. + +Si la valeur n’existe pas ou a un mauvais type, une chaîne vide est retournée. + +La valeur est sans échappement. Si l’échappement échoue, il renvoie une chaîne vide. + +Exemple: + +``` sql +SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' +SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' +SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' +``` + +## JSONExtract(json\[, indices\_or\_keys…\], Return\_type) {#jsonextractjson-indices-or-keys-return-type} + +Analyse un JSON et extrait une valeur du type de données clickhouse donné. + +C’est une généralisation de la précédente `JSONExtract` fonction. +Cela signifie +`JSONExtract(..., 'String')` retourne exactement le même que `JSONExtractString()`, +`JSONExtract(..., 'Float64')` retourne exactement le même que `JSONExtractFloat()`. + +Exemple: + +``` sql +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL +SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 +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} + +Analyser les paires clé-valeur à partir D’un JSON où les valeurs sont du type de données clickhouse donné. + +Exemple: + +``` sql +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} + +Retourne une partie de JSON. + +Si la pièce n’existe pas ou a un mauvais type, une chaîne vide est retournée. + +Exemple: + +``` sql +SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' +``` + +## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} + +Retourne un tableau avec des éléments de tableau JSON, chacun représenté comme une chaîne non analysée. + +Si la pièce n’existe pas ou n’est pas de tableau, un tableau vide sera retournée. + +Exemple: + +``` sql +SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/fr/sql-reference/functions/logical-functions.md b/docs/fr/sql-reference/functions/logical-functions.md new file mode 100644 index 00000000000..3ebe0bcaf10 --- /dev/null +++ b/docs/fr/sql-reference/functions/logical-functions.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 37 +toc_title: Logique +--- + +# Les Fonctions Logiques {#logical-functions} + +Les fonctions logiques acceptent tous les types numériques, mais renvoient un nombre UInt8 égal à 0 ou 1. + +Zéro comme argument est considéré “false,” alors que toute valeur non nulle est considérée comme “true”. + +## et, et opérateur {#and-and-operator} + +## ou, ou opérateur {#or-or-operator} + +## pas, pas opérateur {#not-not-operator} + +## xor {#xor} + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) diff --git a/docs/fr/sql-reference/functions/machine-learning-functions.md b/docs/fr/sql-reference/functions/machine-learning-functions.md new file mode 100644 index 00000000000..76e293c116a --- /dev/null +++ b/docs/fr/sql-reference/functions/machine-learning-functions.md @@ -0,0 +1,20 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 64 +toc_title: Fonctions D'Apprentissage Automatique +--- + +# Fonctions D’Apprentissage Automatique {#machine-learning-functions} + +## evalMLMethod (prédiction) {#machine_learning_methods-evalmlmethod} + +Prédiction utilisant des modèles de régression ajustés utilise `evalMLMethod` fonction. Voir le lien dans la `linearRegression`. + +### Régression Linéaire Stochastique {#stochastic-linear-regression} + +Le [stochasticLinearRegression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlinearregression) la fonction d’agrégat implémente une méthode de descente de gradient stochastique utilisant un modèle linéaire et une fonction de perte MSE. Utiliser `evalMLMethod` prédire sur de nouvelles données. + +### Régression Logistique Stochastique {#stochastic-logistic-regression} + +Le [stochasticLogisticRegression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlogisticregression) la fonction d’agrégation implémente la méthode de descente de gradient stochastique pour le problème de classification binaire. Utiliser `evalMLMethod` prédire sur de nouvelles données. diff --git a/docs/fr/sql-reference/functions/math-functions.md b/docs/fr/sql-reference/functions/math-functions.md new file mode 100644 index 00000000000..dd93bad5200 --- /dev/null +++ b/docs/fr/sql-reference/functions/math-functions.md @@ -0,0 +1,116 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 44 +toc_title: "Math\xE9matique" +--- + +# Fonctions mathématiques {#mathematical-functions} + +Toutes les fonctions renvoient un nombre Float64. La précision du résultat est proche de la précision maximale possible, mais le résultat peut ne pas coïncider avec le nombre représentable de la machine le plus proche du nombre réel correspondant. + +## e() {#e} + +Renvoie un nombre Float64 proche du nombre E. + +## pi() {#pi} + +Returns a Float64 number that is close to the number π. + +## exp (x) {#expx} + +Accepte un argument numérique et renvoie un Float64 nombre proche de l’exposant de l’argument. + +## log(x), ln (x) {#logx-lnx} + +Accepte un argument numérique et renvoie un nombre Float64 proche du logarithme naturel de l’argument. + +## exp2 (x) {#exp2x} + +Accepte un argument numérique et renvoie un nombre Float64 proche de 2 à la puissance de X. + +## log2 (x) {#log2x} + +Accepte un argument numérique et renvoie un Float64 nombre proximité du logarithme binaire de l’argument. + +## exp10 (x) {#exp10x} + +Accepte un argument numérique et renvoie un nombre Float64 proche de 10 à la puissance de X. + +## log10 (x) {#log10x} + +Accepte un argument numérique et renvoie un nombre Float64 proche du logarithme décimal de l’argument. + +## sqrt (x) {#sqrtx} + +Accepte un argument numérique et renvoie un Float64 nombre proche de la racine carrée de l’argument. + +## cbrt (x) {#cbrtx} + +Accepte un argument numérique et renvoie un Float64 nombre proche de la racine cubique de l’argument. + +## erf (x) {#erfx} + +Si ‘x’ is non-negative, then erf(x / σ√2) est la probabilité qu’une variable aléatoire ayant une distribution normale avec un écart type ‘σ’ prend la valeur qui est séparée de la valeur attendue par plus de ‘x’. + +Exemple (règle de trois sigma): + +``` sql +SELECT erf(3 / sqrt(2)) +``` + +``` text +┌─erf(divide(3, sqrt(2)))─┐ +│ 0.9973002039367398 │ +└─────────────────────────┘ +``` + +## erfc (x) {#erfcx} + +Accepte un argument numérique et renvoie un nombre Float64 proche de 1-erf (x), mais sans perte de précision pour ‘x’ valeur. + +## lgamma (x) {#lgammax} + +Le logarithme de la fonction gamma. + +## tgamma (x) {#tgammax} + +La fonction Gamma. + +## sin (x) {#sinx} + +Sine. + +## cos (x) {#cosx} + +Cosinus. + +## tan (x) {#tanx} + +Tangente. + +## asin (x) {#asinx} + +Le sinus d’arc. + +## acos (x) {#acosx} + +Le cosinus de l’arc. + +## atan (x) {#atanx} + +L’arc tangente. + +## pow(x, y), la puissance(x, y) {#powx-y-powerx-y} + +Prend deux arguments numériques x et Y. renvoie un nombre Float64 proche de x à la puissance de Y. + +## intExp2 {#intexp2} + +Accepte un argument numérique et renvoie un nombre UInt64 proche de 2 à la puissance de X. + +## intExp10 {#intexp10} + +Accepte un argument numérique et renvoie un nombre UInt64 proche de 10 à la puissance de X. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/fr/sql-reference/functions/other-functions.md b/docs/fr/sql-reference/functions/other-functions.md new file mode 100644 index 00000000000..e57f76f9f0f --- /dev/null +++ b/docs/fr/sql-reference/functions/other-functions.md @@ -0,0 +1,1079 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 66 +toc_title: Autre +--- + +# D’autres Fonctions {#other-functions} + +## hôte() {#hostname} + +Renvoie une chaîne avec le nom de l’hôte sur lequel cette fonction a été exécutée. Pour le traitement distribué, c’est le nom du serveur distant, si la fonction est exécutée sur un serveur distant. + +## FQDN {#fqdn} + +Retourne le nom de domaine pleinement qualifié. + +**Syntaxe** + +``` sql +fqdn(); +``` + +Cette fonction est insensible à la casse. + +**Valeur renvoyée** + +- Chaîne avec le nom de domaine complet. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT FQDN(); +``` + +Résultat: + +``` text +┌─FQDN()──────────────────────────┐ +│ clickhouse.ru-central1.internal │ +└─────────────────────────────────┘ +``` + +## basename {#basename} + +Extrait la partie finale d’une chaîne après la dernière barre oblique ou barre oblique inverse. Cette fonction est souvent utilisée pour extraire le nom de fichier d’un chemin. + +``` sql +basename( expr ) +``` + +**Paramètre** + +- `expr` — Expression resulting in a [Chaîne](../../sql-reference/data-types/string.md) type de valeur. Tous les antislashs doivent être échappés dans la valeur résultante. + +**Valeur Renvoyée** + +Une chaîne de caractères qui contient: + +- La partie finale d’une chaîne après la dernière barre oblique ou barre oblique inverse. + + If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. + +- La chaîne d’origine s’il n’y a pas de barres obliques ou de barres obliques inverses. + +**Exemple** + +``` sql +SELECT 'some/long/path/to/file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some\\long\\path\\to\\file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some-file-name' AS a, basename(a) +``` + +``` text +┌─a──────────────┬─basename('some-file-name')─┐ +│ some-file-name │ some-file-name │ +└────────────────┴────────────────────────────┘ +``` + +## visibleWidth (x) {#visiblewidthx} + +Calcule la largeur approximative lors de la sortie des valeurs vers la console au format texte (séparé par des tabulations). +Cette fonction est utilisée par le système pour implémenter de jolis formats. + +`NULL` est représenté comme une chaîne correspondant à `NULL` dans `Pretty` format. + +``` sql +SELECT visibleWidth(NULL) +``` + +``` text +┌─visibleWidth(NULL)─┐ +│ 4 │ +└────────────────────┘ +``` + +## toTypeName (x) {#totypenamex} + +Renvoie une chaîne contenant le nom du type de l’argument passé. + +Si `NULL` est passé à la fonction en entrée, puis il renvoie le `Nullable(Nothing)` type, ce qui correspond à un interne `NULL` représentation à ClickHouse. + +## la taille de bloc() {#function-blocksize} + +Récupère la taille du bloc. +Dans ClickHouse, les requêtes sont toujours exécutées sur des blocs (ensembles de parties de colonne). Cette fonction permet d’obtenir la taille du bloc pour lequel vous l’avez appelé. + +## matérialiser (x) {#materializex} + +Transforme une constante dans une colonne contenant une seule valeur. +Dans ClickHouse, les colonnes complètes et les constantes sont représentées différemment en mémoire. Les fonctions fonctionnent différemment pour les arguments constants et les arguments normaux (un code différent est exécuté), bien que le résultat soit presque toujours le même. Cette fonction sert à déboguer ce comportement. + +## ignore(…) {#ignore} + +Accepte tous les arguments, y compris `NULL`. Renvoie toujours 0. +Cependant, l’argument est toujours évalué. Cela peut être utilisé pour les benchmarks. + +## sommeil(secondes) {#sleepseconds} + +Dormir ‘seconds’ secondes sur chaque bloc de données. Vous pouvez spécifier un nombre entier ou un nombre à virgule flottante. + +## sleepEachRow (secondes) {#sleepeachrowseconds} + +Dormir ‘seconds’ secondes sur chaque ligne. Vous pouvez spécifier un nombre entier ou un nombre à virgule flottante. + +## currentDatabase() {#currentdatabase} + +Retourne le nom de la base de données actuelle. +Vous pouvez utiliser cette fonction dans les paramètres du moteur de table dans une requête CREATE TABLE où vous devez spécifier la base de données. + +## currentUser() {#other-function-currentuser} + +Renvoie la connexion de l’utilisateur actuel. La connexion de l’utilisateur, cette requête initiée, sera renvoyée en cas de requête distibuted. + +``` sql +SELECT currentUser(); +``` + +Alias: `user()`, `USER()`. + +**Valeurs renvoyées** + +- Connexion de l’utilisateur actuel. +- Connexion de l’utilisateur qui a lancé la requête en cas de requête distribuée. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT currentUser(); +``` + +Résultat: + +``` text +┌─currentUser()─┐ +│ default │ +└───────────────┘ +``` + +## isFinite (x) {#isfinitex} + +Accepte Float32 et Float64 et renvoie UInt8 égal à 1 si l’argument n’est pas infini et pas un NaN, sinon 0. + +## isInfinite (x) {#isinfinitex} + +Accepte Float32 et Float64 et renvoie UInt8 égal à 1 si l’argument est infini, sinon 0. Notez que 0 est retourné pour un NaN. + +## ifNotFinite {#ifnotfinite} + +Vérifie si la valeur à virgule flottante est finie. + +**Syntaxe** + + ifNotFinite(x,y) + +**Paramètre** + +- `x` — Value to be checked for infinity. Type: [Flottant\*](../../sql-reference/data-types/float.md). +- `y` — Fallback value. Type: [Flottant\*](../../sql-reference/data-types/float.md). + +**Valeur renvoyée** + +- `x` si `x` est finie. +- `y` si `x` n’est pas finie. + +**Exemple** + +Requête: + + SELECT 1/0 as infimum, ifNotFinite(infimum,42) + +Résultat: + + ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ + │ inf │ 42 │ + └─────────┴───────────────────────────────┘ + +Vous pouvez obtenir un résultat similaire en utilisant [opérateur ternaire](conditional-functions.md#ternary-operator): `isFinite(x) ? x : y`. + +## isNaN (x) {#isnanx} + +Accepte Float32 et Float64 et renvoie UInt8 égal à 1 si l’argument est un NaN, sinon 0. + +## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} + +Accepte les chaînes constantes: nom de la base de données, nom de la table et nom de la colonne. Renvoie une expression constante UInt8 égale à 1 s’il y a une colonne, sinon 0. Si le paramètre hostname est défini, le test s’exécutera sur un serveur distant. +La fonction renvoie une exception si la table n’existe pas. +Pour les éléments imbriqués structure des données, la fonction vérifie l’existence d’une colonne. Pour la structure de données imbriquée elle-même, la fonction renvoie 0. + +## bar {#function-bar} + +Permet de construire un diagramme unicode-art. + +`bar(x, min, max, width)` dessine une bande avec une largeur proportionnelle à `(x - min)` et égale à `width` les caractères lors de la `x = max`. + +Paramètre: + +- `x` — Size to display. +- `min, max` — Integer constants. The value must fit in `Int64`. +- `width` — Constant, positive integer, can be fractional. + +La bande dessinée avec précision à un huitième d’un symbole. + +Exemple: + +``` sql +SELECT + toHour(EventTime) AS h, + count() AS c, + bar(c, 0, 600000, 20) AS bar +FROM test.hits +GROUP BY h +ORDER BY h ASC +``` + +``` text +┌──h─┬──────c─┬─bar────────────────┐ +│ 0 │ 292907 │ █████████▋ │ +│ 1 │ 180563 │ ██████ │ +│ 2 │ 114861 │ ███▋ │ +│ 3 │ 85069 │ ██▋ │ +│ 4 │ 68543 │ ██▎ │ +│ 5 │ 78116 │ ██▌ │ +│ 6 │ 113474 │ ███▋ │ +│ 7 │ 170678 │ █████▋ │ +│ 8 │ 278380 │ █████████▎ │ +│ 9 │ 391053 │ █████████████ │ +│ 10 │ 457681 │ ███████████████▎ │ +│ 11 │ 493667 │ ████████████████▍ │ +│ 12 │ 509641 │ ████████████████▊ │ +│ 13 │ 522947 │ █████████████████▍ │ +│ 14 │ 539954 │ █████████████████▊ │ +│ 15 │ 528460 │ █████████████████▌ │ +│ 16 │ 539201 │ █████████████████▊ │ +│ 17 │ 523539 │ █████████████████▍ │ +│ 18 │ 506467 │ ████████████████▊ │ +│ 19 │ 520915 │ █████████████████▎ │ +│ 20 │ 521665 │ █████████████████▍ │ +│ 21 │ 542078 │ ██████████████████ │ +│ 22 │ 493642 │ ████████████████▍ │ +│ 23 │ 400397 │ █████████████▎ │ +└────┴────────┴────────────────────┘ +``` + +## transformer {#transform} + +Transforme une valeur en fonction explicitement définis cartographie de certains éléments à l’autre. +Il existe deux variantes de cette fonction: + +### de transformation(x, array\_from, array\_to, par défaut) {#transformx-array-from-array-to-default} + +`x` – What to transform. + +`array_from` – Constant array of values for converting. + +`array_to` – Constant array of values to convert the values in ‘from’ de. + +`default` – Which value to use if ‘x’ n’est pas égale à une des valeurs de ‘from’. + +`array_from` et `array_to` – Arrays of the same size. + +Type: + +`transform(T, Array(T), Array(U), U) -> U` + +`T` et `U` peuvent être des types numériques, chaîne ou Date ou DateTime. +Lorsque la même lettre est indiquée (T ou U), pour les types numériques, il se peut qu’il ne s’agisse pas de types correspondants, mais de types ayant un type commun. +Par exemple, le premier argument peut avoir le type Int64, tandis que le second a le type Array(UInt16). + +Si l’ ‘x’ la valeur est égale à l’un des éléments dans la ‘array\_from’ tableau, elle renvoie l’élément existant (qui est numéroté de même) de la ‘array\_to’ tableau. Sinon, elle renvoie ‘default’. S’il y a plusieurs éléments correspondants dans ‘array\_from’ il renvoie l’un des matches. + +Exemple: + +``` sql +SELECT + transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, + count() AS c +FROM test.hits +WHERE SearchEngineID != 0 +GROUP BY title +ORDER BY c DESC +``` + +``` text +┌─title─────┬──────c─┐ +│ Yandex │ 498635 │ +│ Google │ 229872 │ +│ Other │ 104472 │ +└───────────┴────────┘ +``` + +### de transformation(x, array\_from, array\_to) {#transformx-array-from-array-to} + +Diffère de la première variation en ce que le ‘default’ l’argument est omis. +Si l’ ‘x’ la valeur est égale à l’un des éléments dans la ‘array\_from’ tableau, elle renvoie l’élément correspondant (qui est numéroté de même) de la ‘array\_to’ tableau. Sinon, elle renvoie ‘x’. + +Type: + +`transform(T, Array(T), Array(T)) -> T` + +Exemple: + +``` sql +SELECT + transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, + count() AS c +FROM test.hits +GROUP BY domain(Referer) +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +┌─s──────────────┬───────c─┐ +│ │ 2906259 │ +│ www.yandex │ 867767 │ +│ ███████.ru │ 313599 │ +│ mail.yandex.ru │ 107147 │ +│ ██████.ru │ 100355 │ +│ █████████.ru │ 65040 │ +│ news.yandex.ru │ 64515 │ +│ ██████.net │ 59141 │ +│ example.com │ 57316 │ +└────────────────┴─────────┘ +``` + +## formatReadableSize (x) {#formatreadablesizex} + +Accepte la taille (nombre d’octets). Renvoie une taille arrondie avec un suffixe (KiB, MiB, etc.) comme une chaîne de caractères. + +Exemple: + +``` sql +SELECT + arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, + formatReadableSize(filesize_bytes) AS filesize +``` + +``` text +┌─filesize_bytes─┬─filesize───┐ +│ 1 │ 1.00 B │ +│ 1024 │ 1.00 KiB │ +│ 1048576 │ 1.00 MiB │ +│ 192851925 │ 183.92 MiB │ +└────────────────┴────────────┘ +``` + +## moins (a, b) {#leasta-b} + +Renvoie la plus petite valeur de a et b. + +## la plus grande(a, b) {#greatesta-b} + +Renvoie la plus grande valeur de a et B. + +## le temps de disponibilité() {#uptime} + +Renvoie la disponibilité du serveur en quelques secondes. + +## version() {#version} + +Renvoie la version du serveur sous forme de chaîne. + +## fuseau() {#timezone} + +Retourne le fuseau horaire du serveur. + +## blockNumber {#blocknumber} + +Renvoie le numéro de séquence du bloc de données où se trouve la ligne. + +## rowNumberInBlock {#function-rownumberinblock} + +Renvoie le numéro de séquence de la ligne dans le bloc de données. Différents blocs de données sont toujours recalculés. + +## rowNumberInAllBlocks() {#rownumberinallblocks} + +Renvoie le numéro de séquence de la ligne dans le bloc de données. Cette fonction ne prend en compte que les blocs de données affectés. + +## voisin {#neighbor} + +La fonction de fenêtre qui donne accès à une ligne à un décalage spécifié qui vient avant ou après la ligne actuelle d’une colonne donnée. + +**Syntaxe** + +``` sql +neighbor(column, offset[, default_value]) +``` + +Le résultat de la fonction dépend du touché des blocs de données et l’ordre des données dans le bloc. +Si vous créez une sous-requête avec ORDER BY et appelez la fonction depuis l’extérieur de la sous-requête, vous pouvez obtenir le résultat attendu. + +**Paramètre** + +- `column` — A column name or scalar expression. +- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql-reference/data-types/int-uint.md). +- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. + +**Valeurs renvoyées** + +- De la valeur pour `column` dans `offset` distance de la ligne actuelle si `offset` la valeur n’est pas en dehors des limites du bloc. +- La valeur par défaut pour `column` si `offset` la valeur est en dehors des limites du bloc. Si `default_value` est donné, alors il sera utilisé. + +Type: type de blocs de données affectés ou type de valeur par défaut. + +**Exemple** + +Requête: + +``` sql +SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; +``` + +Résultat: + +``` text +┌─number─┬─neighbor(number, 2)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 0 │ +│ 9 │ 0 │ +└────────┴─────────────────────┘ +``` + +Requête: + +``` sql +SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; +``` + +Résultat: + +``` text +┌─number─┬─neighbor(number, 2, 999)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 999 │ +│ 9 │ 999 │ +└────────┴──────────────────────────┘ +``` + +Cette fonction peut être utilisée pour calculer une année à valeur métrique: + +Requête: + +``` sql +WITH toDate('2018-01-01') AS start_date +SELECT + toStartOfMonth(start_date + (number * 32)) AS month, + toInt32(month) % 100 AS money, + neighbor(money, -12) AS prev_year, + round(prev_year / money, 2) AS year_over_year +FROM numbers(16) +``` + +Résultat: + +``` text +┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ +│ 2018-01-01 │ 32 │ 0 │ 0 │ +│ 2018-02-01 │ 63 │ 0 │ 0 │ +│ 2018-03-01 │ 91 │ 0 │ 0 │ +│ 2018-04-01 │ 22 │ 0 │ 0 │ +│ 2018-05-01 │ 52 │ 0 │ 0 │ +│ 2018-06-01 │ 83 │ 0 │ 0 │ +│ 2018-07-01 │ 13 │ 0 │ 0 │ +│ 2018-08-01 │ 44 │ 0 │ 0 │ +│ 2018-09-01 │ 75 │ 0 │ 0 │ +│ 2018-10-01 │ 5 │ 0 │ 0 │ +│ 2018-11-01 │ 36 │ 0 │ 0 │ +│ 2018-12-01 │ 66 │ 0 │ 0 │ +│ 2019-01-01 │ 97 │ 32 │ 0.33 │ +│ 2019-02-01 │ 28 │ 63 │ 2.25 │ +│ 2019-03-01 │ 56 │ 91 │ 1.62 │ +│ 2019-04-01 │ 87 │ 22 │ 0.25 │ +└────────────┴───────┴───────────┴────────────────┘ +``` + +## runningDifference(x) {#other_functions-runningdifference} + +Calculates the difference between successive row values ​​in the data block. +Renvoie 0 pour la première ligne et la différence par rapport à la rangée précédente pour chaque nouvelle ligne. + +Le résultat de la fonction dépend du touché des blocs de données et l’ordre des données dans le bloc. +Si vous créez une sous-requête avec ORDER BY et appelez la fonction depuis l’extérieur de la sous-requête, vous pouvez obtenir le résultat attendu. + +Exemple: + +``` sql +SELECT + EventID, + EventTime, + runningDifference(EventTime) AS delta +FROM +( + SELECT + EventID, + EventTime + FROM events + WHERE EventDate = '2016-11-24' + ORDER BY EventTime ASC + LIMIT 5 +) +``` + +``` text +┌─EventID─┬───────────EventTime─┬─delta─┐ +│ 1106 │ 2016-11-24 00:00:04 │ 0 │ +│ 1107 │ 2016-11-24 00:00:05 │ 1 │ +│ 1108 │ 2016-11-24 00:00:05 │ 0 │ +│ 1109 │ 2016-11-24 00:00:09 │ 4 │ +│ 1110 │ 2016-11-24 00:00:10 │ 1 │ +└─────────┴─────────────────────┴───────┘ +``` + +Veuillez noter que la taille du bloc affecte le résultat. Avec chaque nouveau bloc, le `runningDifference` l’état est réinitialisé. + +``` sql +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +┌─number─┬─diff─┐ +│ 65536 │ 0 │ +└────────┴──────┘ +``` + +``` sql +set max_block_size=100000 -- default value is 65536! + +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +``` + +## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} + +De même que pour [runningDifference](./other-functions.md#other_functions-runningdifference) la différence est la valeur de la première ligne, est retourné à la valeur de la première ligne, et chaque rangée suivante renvoie la différence de la rangée précédente. + +## MACNumToString (num) {#macnumtostringnum} + +Accepte un numéro UInt64. Interprète comme une adresse MAC dans big endian. Renvoie une chaîne contenant l’adresse MAC correspondante au format AA:BB:CC: DD:EE: FF (Nombres séparés par deux points sous forme hexadécimale). + +## MACStringToNum (s) {#macstringtonums} + +La fonction inverse de MACNumToString. Si l’adresse MAC a un format non valide, elle renvoie 0. + +## MACStringToOUI (s) {#macstringtoouis} + +Accepte une adresse MAC au format AA:BB:CC: DD:EE: FF (Nombres séparés par deux points sous forme hexadécimale). Renvoie les trois premiers octets sous la forme D’un nombre UInt64. Si l’adresse MAC a un format non valide, elle renvoie 0. + +## getSizeOfEnumType {#getsizeofenumtype} + +Retourne le nombre de champs dans [Enum](../../sql-reference/data-types/enum.md). + +``` sql +getSizeOfEnumType(value) +``` + +**Paramètre:** + +- `value` — Value of type `Enum`. + +**Valeurs renvoyées** + +- Le nombre de champs avec `Enum` les valeurs d’entrée. +- Une exception est levée si le type n’est pas `Enum`. + +**Exemple** + +``` sql +SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## blockSerializedSize {#blockserializedsize} + +Retourne la taille sur le disque (sans tenir compte de la compression). + +``` sql +blockSerializedSize(value[, value[, ...]]) +``` + +**Paramètre:** + +- `value` — Any value. + +**Valeurs renvoyées** + +- Le nombre d’octets qui seront écrites sur le disque pour le bloc de valeurs (sans compression). + +**Exemple** + +``` sql +SELECT blockSerializedSize(maxState(1)) as x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## toColumnTypeName {#tocolumntypename} + +Renvoie le nom de la classe qui représente le type de données de la colonne dans la RAM. + +``` sql +toColumnTypeName(value) +``` + +**Paramètre:** + +- `value` — Any type of value. + +**Valeurs renvoyées** + +- Une chaîne avec le nom de la classe utilisée pour représenter `value` type de données dans la mémoire RAM. + +**Exemple de la différence entre`toTypeName ' and ' toColumnTypeName`** + +``` sql +SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime │ +└─────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ Const(UInt32) │ +└───────────────────────────────────────────────────────────┘ +``` + +L’exemple montre que le `DateTime` type de données est stocké dans la mémoire comme `Const(UInt32)`. + +## dumpColumnStructure {#dumpcolumnstructure} + +Affiche une description détaillée des structures de données en RAM + +``` sql +dumpColumnStructure(value) +``` + +**Paramètre:** + +- `value` — Any type of value. + +**Valeurs renvoyées** + +- Une chaîne décrivant la structure utilisée pour représenter `value` type de données dans la mémoire RAM. + +**Exemple** + +``` sql +SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) +``` + +``` text +┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime, Const(size = 1, UInt32(size = 1)) │ +└──────────────────────────────────────────────────────────────┘ +``` + +## defaultValueOfArgumentType {#defaultvalueofargumenttype} + +Affiche la valeur par défaut du type de données. + +Ne pas inclure des valeurs par défaut pour les colonnes personnalisées définies par l’utilisateur. + +``` sql +defaultValueOfArgumentType(expression) +``` + +**Paramètre:** + +- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. + +**Valeurs renvoyées** + +- `0` pour les nombres. +- Chaîne vide pour les chaînes. +- `ᴺᵁᴸᴸ` pour [Nullable](../../sql-reference/data-types/nullable.md). + +**Exemple** + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ +│ 0 │ +└─────────────────────────────────────────────┘ +``` + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ +│ ᴺᵁᴸᴸ │ +└───────────────────────────────────────────────────────┘ +``` + +## reproduire {#other-functions-replicate} + +Crée un tableau avec une seule valeur. + +Utilisé pour la mise en œuvre interne de [arrayJoin](array-join.md#functions_arrayjoin). + +``` sql +SELECT replicate(x, arr); +``` + +**Paramètre:** + +- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. +- `x` — The value that the resulting array will be filled with. + +**Valeur renvoyée** + +Un tableau rempli de la valeur `x`. + +Type: `Array`. + +**Exemple** + +Requête: + +``` sql +SELECT replicate(1, ['a', 'b', 'c']) +``` + +Résultat: + +``` text +┌─replicate(1, ['a', 'b', 'c'])─┐ +│ [1,1,1] │ +└───────────────────────────────┘ +``` + +## filesystemAvailable {#filesystemavailable} + +Renvoie la quantité d’espace restant sur le système de fichiers où se trouvent les fichiers des bases de données. Il est toujours plus petit que l’espace libre total ([filesystemFree](#filesystemfree)) parce qu’un peu d’espace est réservé au système D’exploitation. + +**Syntaxe** + +``` sql +filesystemAvailable() +``` + +**Valeur renvoyée** + +- La quantité d’espace restant disponible en octets. + +Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; +``` + +Résultat: + +``` text +┌─Available space─┬─Type───┐ +│ 30.75 GiB │ UInt64 │ +└─────────────────┴────────┘ +``` + +## filesystemFree {#filesystemfree} + +Retourne montant total de l’espace libre sur le système de fichiers où les fichiers des bases de données. Voir aussi `filesystemAvailable` + +**Syntaxe** + +``` sql +filesystemFree() +``` + +**Valeur renvoyée** + +- Quantité d’espace libre en octets. + +Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; +``` + +Résultat: + +``` text +┌─Free space─┬─Type───┐ +│ 32.39 GiB │ UInt64 │ +└────────────┴────────┘ +``` + +## filesystemCapacity {#filesystemcapacity} + +Renvoie la capacité du système de fichiers en octets. Pour l’évaluation, la [chemin](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) le répertoire de données doit être configuré. + +**Syntaxe** + +``` sql +filesystemCapacity() +``` + +**Valeur renvoyée** + +- Informations de capacité du système de fichiers en octets. + +Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Exemple** + +Requête: + +``` sql +SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" +``` + +Résultat: + +``` text +┌─Capacity──┬─Type───┐ +│ 39.32 GiB │ UInt64 │ +└───────────┴────────┘ +``` + +## finalizeAggregation {#function-finalizeaggregation} + +Prend de l’état de la fonction d’agrégation. Renvoie le résultat de l’agrégation (état finalisé). + +## runningAccumulate {#function-runningaccumulate} + +Prend les membres de la fonction d’agrégation et renvoie une colonne avec des valeurs, sont le résultat de l’accumulation de ces états pour un ensemble de bloc de lignes, de la première à la ligne actuelle. +Par exemple, prend l’état de la fonction d’agrégat (exemple runningAccumulate(uniqState(UserID))), et pour chaque ligne de bloc, retourne le résultat de la fonction d’agrégat lors de la fusion des états de toutes les lignes précédentes et de la ligne actuelle. +Ainsi, le résultat de la fonction dépend de la partition des données aux blocs et de l’ordre des données dans le bloc. + +## joinGet {#joinget} + +La fonction vous permet d’extraire les données de la table de la même manière qu’à partir d’un [dictionnaire](../../sql-reference/dictionaries/index.md). + +Obtient les données de [Rejoindre](../../engines/table-engines/special/join.md#creating-a-table) tables utilisant la clé de jointure spécifiée. + +Ne prend en charge que les tables créées avec `ENGINE = Join(ANY, LEFT, )` déclaration. + +**Syntaxe** + +``` sql +joinGet(join_storage_table_name, `value_column`, join_keys) +``` + +**Paramètre** + +- `join_storage_table_name` — an [identificateur](../syntax.md#syntax-identifiers) indique l’endroit où la recherche est effectuée. L’identificateur est recherché dans la base de données par défaut (voir paramètre `default_database` dans le fichier de config). Pour remplacer la base de données par défaut, utilisez `USE db_name` ou spécifiez la base de données et la table via le séparateur `db_name.db_table` voir l’exemple. +- `value_column` — name of the column of the table that contains required data. +- `join_keys` — list of keys. + +**Valeur renvoyée** + +Retourne la liste des valeurs correspond à la liste des clés. + +Si certain n’existe pas dans la table source alors `0` ou `null` seront renvoyés basé sur [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) paramètre. + +Plus d’infos sur `join_use_nulls` dans [Opération de jointure](../../engines/table-engines/special/join.md). + +**Exemple** + +Table d’entrée: + +``` sql +CREATE DATABASE db_test +CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 +INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) +``` + +``` text +┌─id─┬─val─┐ +│ 4 │ 13 │ +│ 2 │ 12 │ +│ 1 │ 11 │ +└────┴─────┘ +``` + +Requête: + +``` sql +SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 +``` + +Résultat: + +``` text +┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ +│ 0 │ +│ 11 │ +│ 12 │ +│ 0 │ +└──────────────────────────────────────────────────┘ +``` + +## modelEvaluate(model\_name, …) {#function-modelevaluate} + +Évaluer le modèle externe. +Accepte un nom de modèle et le modèle de l’argumentation. Renvoie Float64. + +## throwIf (x \[, custom\_message\]) {#throwifx-custom-message} + +Lever une exception si l’argument est non nul. +custom\_message - est un paramètre optionnel: une chaîne constante, fournit un message d’erreur + +``` sql +SELECT throwIf(number = 3, 'Too many') FROM numbers(10); +``` + +``` text +↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): +Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. +``` + +## identité {#identity} + +Renvoie la même valeur qui a été utilisée comme argument. Utilisé pour le débogage et les tests, permet d’annuler l’utilisation de l’index et d’obtenir les performances de requête d’une analyse complète. Lorsque la requête est analysée pour une utilisation possible de l’index, l’analyseur ne regarde pas à l’intérieur `identity` fonction. + +**Syntaxe** + +``` sql +identity(x) +``` + +**Exemple** + +Requête: + +``` sql +SELECT identity(42) +``` + +Résultat: + +``` text +┌─identity(42)─┐ +│ 42 │ +└──────────────┘ +``` + +## randomPrintableASCII {#randomascii} + +Génère une chaîne avec un ensemble aléatoire de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caractères imprimables. + +**Syntaxe** + +``` sql +randomPrintableASCII(length) +``` + +**Paramètre** + +- `length` — Resulting string length. Positive integer. + + If you pass `length < 0`, behavior of the function is undefined. + +**Valeur renvoyée** + +- Chaîne avec un ensemble aléatoire de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caractères imprimables. + +Type: [Chaîne](../../sql-reference/data-types/string.md) + +**Exemple** + +``` sql +SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 +``` + +``` text +┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ +│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ +│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ +│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ +└────────┴────────────────────────────────┴──────────────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/fr/sql-reference/functions/random-functions.md b/docs/fr/sql-reference/functions/random-functions.md new file mode 100644 index 00000000000..f02a32ca0ac --- /dev/null +++ b/docs/fr/sql-reference/functions/random-functions.md @@ -0,0 +1,30 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 51 +toc_title: "La G\xE9n\xE9ration De Nombres Pseudo-Al\xE9atoires" +--- + +# Fonctions Pour générer Des Nombres pseudo-aléatoires {#functions-for-generating-pseudo-random-numbers} + +Des générateurs Non cryptographiques de nombres pseudo-aléatoires sont utilisés. + +Toutes les fonctions acceptent zéro argument ou un argument. +Si un argument est passé, il peut être de n’importe quel type, et sa valeur n’est utilisée pour rien. +Le seul but de cet argument est d’empêcher l’élimination des sous-expressions courantes, de sorte que deux instances différentes de la même fonction renvoient des colonnes différentes avec des nombres aléatoires différents. + +## Rand {#rand} + +Renvoie un nombre UInt32 pseudo-aléatoire, réparti uniformément entre tous les nombres de type UInt32. +Utilise un générateur congruentiel linéaire. + +## rand64 {#rand64} + +Renvoie un nombre UInt64 pseudo-aléatoire, réparti uniformément entre tous les nombres de type UInt64. +Utilise un générateur congruentiel linéaire. + +## randConstant {#randconstant} + +Renvoie un nombre UInt32 pseudo-aléatoire, la valeur est une pour différents blocs. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/fr/sql-reference/functions/rounding-functions.md b/docs/fr/sql-reference/functions/rounding-functions.md new file mode 100644 index 00000000000..5a96788acbc --- /dev/null +++ b/docs/fr/sql-reference/functions/rounding-functions.md @@ -0,0 +1,190 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 45 +toc_title: Arrondi +--- + +# Fonctions d’arrondi {#rounding-functions} + +## floor(x\[, N\]) {#floorx-n} + +Renvoie le plus grand nombre rond inférieur ou égal à `x`. Un nombre rond est un multiple de 1 / 10N, ou le nombre le plus proche du type de données approprié si 1 / 10N n’est pas exact. +‘N’ est une constante entière, paramètre facultatif. Par défaut, il est zéro, ce qui signifie arrondir à un entier. +‘N’ peut être négative. + +Exemple: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` + +`x` est n’importe quel type numérique. Le résultat est un nombre du même type. +Pour les arguments entiers, il est logique d’arrondir avec un négatif `N` valeur (pour non négatif `N`, la fonction ne fait rien). +Si l’arrondi provoque un débordement (par exemple, floor(-128, -1)), un résultat spécifique à l’implémentation est renvoyé. + +## ceil(x\[, n\]), plafond (x\[, n\]) {#ceilx-n-ceilingx-n} + +Renvoie le plus petit nombre rond supérieur ou égal à `x`. Dans tous les autres sens, il est le même que le `floor` fonction (voir ci-dessus). + +## trunc(x \[, N\]), truncate(x \[, N\]) {#truncx-n-truncatex-n} + +Renvoie le nombre rond avec la plus grande valeur absolue qui a une valeur absolue inférieure ou égale à `x`‘s. In every other way, it is the same as the ’floor’ fonction (voir ci-dessus). + +## round(x\[, N\]) {#rounding_functions-round} + +Arrondit une valeur à un nombre spécifié de décimales. + +La fonction renvoie le nombre plus proche de l’ordre spécifié. Dans le cas où un nombre donné a une distance égale aux nombres environnants, la fonction utilise l’arrondi de banquier pour les types de nombres flottants et arrondit à partir de zéro pour les autres types de nombres. + +``` sql +round(expression [, decimal_places]) +``` + +**Paramètre:** + +- `expression` — A number to be rounded. Can be any [expression](../syntax.md#syntax-expressions) retour du numérique [type de données](../../sql-reference/data-types/index.md#data_types). +- `decimal-places` — An integer value. + - Si `decimal-places > 0` alors la fonction arrondit la valeur à droite du point décimal. + - Si `decimal-places < 0` alors la fonction arrondit la valeur à gauche de la virgule décimale. + - Si `decimal-places = 0` alors la fonction arrondit la valeur à l’entier. Dans ce cas, l’argument peut être omis. + +**Valeur renvoyée:** + +Le nombre arrondi du même type que le nombre d’entrée. + +### Exemple {#examples} + +**Exemple d’utilisation** + +``` sql +SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 +``` + +``` text +┌───x─┬─round(divide(number, 2))─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +└─────┴──────────────────────────┘ +``` + +**Des exemples de l’arrondissement** + +Le résultat est arrondi au plus proche. + +``` text +round(3.2, 0) = 3 +round(4.1267, 2) = 4.13 +round(22,-1) = 20 +round(467,-2) = 500 +round(-467,-2) = -500 +``` + +Le Banquier arrondit. + +``` text +round(3.5) = 4 +round(4.5) = 4 +round(3.55, 1) = 3.6 +round(3.65, 1) = 3.6 +``` + +**Voir Aussi** + +- [roundBankers](#roundbankers) + +## roundBankers {#roundbankers} + +Arrondit un nombre à une position décimale spécifiée. + +- Si le nombre est arrondi à mi-chemin entre deux nombres, la fonction utilise l’arrondi. + + Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. + + It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. + +- Dans d’autres cas, la fonction arrondit les nombres à l’entier le plus proche. + +À l’aide de l’arrondi, vous pouvez réduire l’effet qu’arrondir les nombres sur les résultats d’additionner ou de soustraire ces chiffres. + +Par exemple, les nombres de somme 1.5, 2.5, 3.5, 4.5 avec des arrondis différents: + +- Pas d’arrondi: 1.5 + 2.5 + 3.5 + 4.5 = 12. +- Arrondi du banquier: 2 + 2 + 4 + 4 = 12. +- Arrondi à l’entier le plus proche: 2 + 3 + 4 + 5 = 14. + +**Syntaxe** + +``` sql +roundBankers(expression [, decimal_places]) +``` + +**Paramètre** + +- `expression` — A number to be rounded. Can be any [expression](../syntax.md#syntax-expressions) retour du numérique [type de données](../../sql-reference/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`. + - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. + +**Valeur renvoyée** + +Valeur arrondie par la méthode d’arrondi du banquier. + +### Exemple {#examples-1} + +**Exemple d’utilisation** + +Requête: + +``` sql + SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 +``` + +Résultat: + +``` text +┌───x─┬─b─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +│ 1.5 │ 2 │ +│ 2 │ 2 │ +│ 2.5 │ 2 │ +│ 3 │ 3 │ +│ 3.5 │ 4 │ +│ 4 │ 4 │ +│ 4.5 │ 4 │ +└─────┴───┘ +``` + +**Exemples d’arrondi bancaire** + +``` text +roundBankers(0.4) = 0 +roundBankers(-3.5) = -4 +roundBankers(4.5) = 4 +roundBankers(3.55, 1) = 3.6 +roundBankers(3.65, 1) = 3.6 +roundBankers(10.35, 1) = 10.4 +roundBankers(10.755, 2) = 11,76 +``` + +**Voir Aussi** + +- [rond](#rounding_functions-round) + +## roundToExp2 (num) {#roundtoexp2num} + +Accepte un certain nombre. Si le nombre est inférieur à un, elle renvoie 0. Sinon, il arrondit le nombre au degré le plus proche (entier non négatif) de deux. + +## roundDuration (num) {#rounddurationnum} + +Accepte un certain nombre. Si le nombre est inférieur à un, elle renvoie 0. Sinon, il arrondit le nombre vers le bas pour les nombres de l’ensemble: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Cette fonction est spécifique à Yandex.Metrica et utilisé pour la mise en œuvre du rapport sur la durée de la session. + +## roundAge (num) {#roundagenum} + +Accepte un certain nombre. Si le nombre est inférieur à 18, il renvoie 0. Sinon, il arrondit le nombre à un nombre de l’ensemble: 18, 25, 35, 45, 55. Cette fonction est spécifique à Yandex.Metrica et utilisé pour la mise en œuvre du rapport sur l’âge des utilisateurs. + +## roundDown(num, arr) {#rounddownnum-arr} + +Accepte un nombre et l’arrondit à un élément dans le tableau spécifié. Si la valeur est inférieure à la plus basse, la plus basse lié est retourné. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/fr/sql-reference/functions/splitting-merging-functions.md b/docs/fr/sql-reference/functions/splitting-merging-functions.md new file mode 100644 index 00000000000..747eafdabd6 --- /dev/null +++ b/docs/fr/sql-reference/functions/splitting-merging-functions.md @@ -0,0 +1,116 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 47 +toc_title: "Fractionnement et fusion de cha\xEEnes et de tableaux" +--- + +# Fonctions Pour Diviser Et Fusionner Des chaînes Et Des Tableaux {#functions-for-splitting-and-merging-strings-and-arrays} + +## splitByChar (séparateur, s) {#splitbycharseparator-s} + +Divise une chaîne en sous-chaînes séparées par un caractère spécifique. Il utilise une chaîne constante `separator` qui composé d’un seul caractère. +Retourne un tableau de certaines chaînes. Les sous-chaînes vides peuvent être sélectionnées si le séparateur se produit au début ou à la fin de la chaîne, ou s’il existe plusieurs séparateurs consécutifs. + +**Syntaxe** + +``` sql +splitByChar(, ) +``` + +**Paramètre** + +- `separator` — The separator which should contain exactly one character. [Chaîne](../../sql-reference/data-types/string.md). +- `s` — The string to split. [Chaîne](../../sql-reference/data-types/string.md). + +**Valeur renvoyée(s)** + +Retourne un tableau de certaines chaînes. Des sous-chaînes vides peuvent être sélectionnées lorsque: + +- Un séparateur se produit au début ou à la fin de la chaîne; +- Il existe plusieurs séparateurs consécutifs; +- La chaîne d’origine `s` est vide. + +Type: [Tableau](../../sql-reference/data-types/array.md) de [Chaîne](../../sql-reference/data-types/string.md). + +**Exemple** + +``` sql +SELECT splitByChar(',', '1,2,3,abcde') +``` + +``` text +┌─splitByChar(',', '1,2,3,abcde')─┐ +│ ['1','2','3','abcde'] │ +└─────────────────────────────────┘ +``` + +## splitByString(séparateur, s) {#splitbystringseparator-s} + +Divise une chaîne en sous-chaînes séparées par une chaîne. Il utilise une chaîne constante `separator` de plusieurs caractères comme séparateur. Si la chaîne `separator` est vide, il va diviser la chaîne `s` dans un tableau de caractères uniques. + +**Syntaxe** + +``` sql +splitByString(, ) +``` + +**Paramètre** + +- `separator` — The separator. [Chaîne](../../sql-reference/data-types/string.md). +- `s` — The string to split. [Chaîne](../../sql-reference/data-types/string.md). + +**Valeur renvoyée(s)** + +Retourne un tableau de certaines chaînes. Des sous-chaînes vides peuvent être sélectionnées lorsque: + +Type: [Tableau](../../sql-reference/data-types/array.md) de [Chaîne](../../sql-reference/data-types/string.md). + +- Un séparateur non vide se produit au début ou à la fin de la chaîne; +- Il existe plusieurs séparateurs consécutifs non vides; +- La chaîne d’origine `s` est vide tandis que le séparateur n’est pas vide. + +**Exemple** + +``` sql +SELECT splitByString(', ', '1, 2 3, 4,5, abcde') +``` + +``` text +┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ +│ ['1','2 3','4,5','abcde'] │ +└───────────────────────────────────────────┘ +``` + +``` sql +SELECT splitByString('', 'abcde') +``` + +``` text +┌─splitByString('', 'abcde')─┐ +│ ['a','b','c','d','e'] │ +└────────────────────────────┘ +``` + +## arrayStringConcat(arr \[, séparateur\]) {#arraystringconcatarr-separator} + +Concatène les chaînes répertoriées dans le tableau avec le séparateur.“séparateur” est un paramètre facultatif: une chaîne constante, définie à une chaîne vide par défaut. +Retourne une chaîne de caractères. + +## alphaTokens (s) {#alphatokenss} + +Sélectionne des sous-chaînes d’octets consécutifs dans les plages A-z et A-Z. retourne un tableau de sous-chaînes. + +**Exemple** + +``` sql +SELECT alphaTokens('abca1abc') +``` + +``` text +┌─alphaTokens('abca1abc')─┐ +│ ['abca','abc'] │ +└─────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/fr/sql-reference/functions/string-functions.md b/docs/fr/sql-reference/functions/string-functions.md new file mode 100644 index 00000000000..c49a2bf8402 --- /dev/null +++ b/docs/fr/sql-reference/functions/string-functions.md @@ -0,0 +1,489 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 40 +toc_title: "Travailler avec des cha\xEEnes" +--- + +# Fonctions Pour Travailler Avec Des chaînes {#functions-for-working-with-strings} + +## vide {#empty} + +Renvoie 1 pour une chaîne vide ou 0 pour une chaîne non vide. +Le type de résultat est UInt8. +Une chaîne est considérée comme non vide si elle contient au moins un octet, même s’il s’agit d’un espace ou d’un octet nul. +La fonction fonctionne également pour les tableaux. + +## notEmpty {#notempty} + +Renvoie 0 pour une chaîne vide ou 1 pour une chaîne non vide. +Le type de résultat est UInt8. +La fonction fonctionne également pour les tableaux. + +## longueur {#length} + +Renvoie la longueur d’une chaîne en octets (pas en caractères, et pas en points de code). +Le type de résultat est UInt64. +La fonction fonctionne également pour les tableaux. + +## lengthUTF8 {#lengthutf8} + +Renvoie la longueur d’une chaîne en points de code Unicode (pas en caractères), en supposant que la chaîne contient un ensemble d’octets qui composent le texte codé en UTF-8. Si cette hypothèse n’est pas remplie, elle renvoie un résultat (elle ne lance pas d’exception). +Le type de résultat est UInt64. + +## char\_length, CHAR\_LENGTH {#char-length} + +Renvoie la longueur d’une chaîne en points de code Unicode (pas en caractères), en supposant que la chaîne contient un ensemble d’octets qui composent le texte codé en UTF-8. Si cette hypothèse n’est pas remplie, elle renvoie un résultat (elle ne lance pas d’exception). +Le type de résultat est UInt64. + +## character\_length, CHARACTER\_LENGTH {#character-length} + +Renvoie la longueur d’une chaîne en points de code Unicode (pas en caractères), en supposant que la chaîne contient un ensemble d’octets qui composent le texte codé en UTF-8. Si cette hypothèse n’est pas remplie, elle renvoie un résultat (elle ne lance pas d’exception). +Le type de résultat est UInt64. + +## plus bas, lcase {#lower} + +Convertit les symboles latins ASCII dans une chaîne en minuscules. + +## supérieur, ucase {#upper} + +Convertit les symboles latins ASCII dans une chaîne en majuscules. + +## lowerUTF8 {#lowerutf8} + +Convertit une chaîne en minuscules, en supposant que la chaîne de caractères contient un ensemble d’octets qui composent un texte UTF-8. +Il ne détecte pas la langue. Donc, pour le turc, le résultat pourrait ne pas être exactement correct. +Si la longueur de la séquence d’octets UTF-8 est différente pour les majuscules et les minuscules d’un point de code, le résultat peut être incorrect pour ce point de code. +Si la chaîne contient un ensemble d’octets qui N’est pas UTF-8, le comportement n’est pas défini. + +## upperUTF8 {#upperutf8} + +Convertit une chaîne en majuscules, en supposant que la chaîne de caractères contient un ensemble d’octets qui composent un texte UTF-8. +Il ne détecte pas la langue. Donc, pour le turc, le résultat pourrait ne pas être exactement correct. +Si la longueur de la séquence d’octets UTF-8 est différente pour les majuscules et les minuscules d’un point de code, le résultat peut être incorrect pour ce point de code. +Si la chaîne contient un ensemble d’octets qui N’est pas UTF-8, le comportement n’est pas défini. + +## isValidUTF8 {#isvalidutf8} + +Renvoie 1, si l’ensemble d’octets est codé en UTF-8 valide, sinon 0. + +## toValidUTF8 {#tovalidutf8} + +Remplace les caractères UTF-8 non valides par `�` (U+FFFD) caractère. Tous les caractères non valides s’exécutant dans une rangée sont réduits en un seul caractère de remplacement. + +``` sql +toValidUTF8( input_string ) +``` + +Paramètre: + +- input\_string — Any set of bytes represented as the [Chaîne](../../sql-reference/data-types/string.md) type de données objet. + +Valeur renvoyée: chaîne UTF-8 valide. + +**Exemple** + +``` sql +SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') +``` + +``` text +┌─toValidUTF8('a����b')─┐ +│ a�b │ +└───────────────────────┘ +``` + +## répéter {#repeat} + +Répète une corde autant de fois que spécifié et concatène les valeurs répliquées comme une seule chaîne. + +**Syntaxe** + +``` sql +repeat(s, n) +``` + +**Paramètre** + +- `s` — The string to repeat. [Chaîne](../../sql-reference/data-types/string.md). +- `n` — The number of times to repeat the string. [UInt](../../sql-reference/data-types/int-uint.md). + +**Valeur renvoyée** + +La chaîne unique, qui contient la chaîne `s` répéter `n` temps. Si `n` \< 1, la fonction renvoie une chaîne vide. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT repeat('abc', 10) +``` + +Résultat: + +``` text +┌─repeat('abc', 10)──────────────┐ +│ abcabcabcabcabcabcabcabcabcabc │ +└────────────────────────────────┘ +``` + +## inverser {#reverse} + +Inverse la chaîne (comme une séquence d’octets). + +## reverseUTF8 {#reverseutf8} + +Inverse une séquence de points de code Unicode, en supposant que la chaîne contient un ensemble d’octets représentant un texte UTF-8. Sinon, il fait autre chose (il ne lance pas d’exception). + +## format(pattern, s0, s1, …) {#format} + +Formatage du motif constant avec la chaîne listée dans les arguments. `pattern` est un modèle de format Python simplifié. Chaîne de Format contient “replacement fields” entouré par des accolades `{}`. Tout ce qui n’est pas contenu dans les accolades est considéré comme du texte littéral, qui est copié inchangé dans la sortie. Si vous devez inclure un caractère d’Accolade dans le texte littéral, il peut être échappé en doublant: `{{ '{{' }}` et `{{ '}}' }}`. Les noms de champs peuvent être des nombres (à partir de zéro) ou vides (ils sont alors traités comme des nombres de conséquence). + +``` sql +SELECT format('{1} {0} {1}', 'World', 'Hello') +``` + +``` text +┌─format('{1} {0} {1}', 'World', 'Hello')─┐ +│ Hello World Hello │ +└─────────────────────────────────────────┘ +``` + +``` sql +SELECT format('{} {}', 'Hello', 'World') +``` + +``` text +┌─format('{} {}', 'Hello', 'World')─┐ +│ Hello World │ +└───────────────────────────────────┘ +``` + +## concat {#concat} + +Concatène les chaînes répertoriées dans les arguments, sans séparateur. + +**Syntaxe** + +``` sql +concat(s1, s2, ...) +``` + +**Paramètre** + +Valeurs de type String ou FixedString. + +**Valeurs renvoyées** + +Renvoie la chaîne qui résulte de la concaténation des arguments. + +Si l’une des valeurs d’argument est `NULL`, `concat` retourner `NULL`. + +**Exemple** + +Requête: + +``` sql +SELECT concat('Hello, ', 'World!') +``` + +Résultat: + +``` text +┌─concat('Hello, ', 'World!')─┐ +│ Hello, World! │ +└─────────────────────────────┘ +``` + +## concatAssumeInjective {#concatassumeinjective} + +Même que [concat](#concat) la différence est que vous devez vous assurer que `concat(s1, s2, ...) → sn` est injectif, il sera utilisé pour l’optimisation du groupe par. + +La fonction est nommée “injective” si elle renvoie toujours un résultat différent pour différentes valeurs d’arguments. En d’autres termes: des arguments différents ne donnent jamais un résultat identique. + +**Syntaxe** + +``` sql +concatAssumeInjective(s1, s2, ...) +``` + +**Paramètre** + +Valeurs de type String ou FixedString. + +**Valeurs renvoyées** + +Renvoie la chaîne qui résulte de la concaténation des arguments. + +Si l’une des valeurs d’argument est `NULL`, `concatAssumeInjective` retourner `NULL`. + +**Exemple** + +Table d’entrée: + +``` sql +CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; +INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); +SELECT * from key_val; +``` + +``` text +┌─key1────┬─key2─────┬─value─┐ +│ Hello, │ World │ 1 │ +│ Hello, │ World │ 2 │ +│ Hello, │ World! │ 3 │ +│ Hello │ , World! │ 2 │ +└─────────┴──────────┴───────┘ +``` + +Requête: + +``` sql +SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) +``` + +Résultat: + +``` text +┌─concat(key1, key2)─┬─sum(value)─┐ +│ Hello, World! │ 3 │ +│ Hello, World! │ 2 │ +│ Hello, World │ 3 │ +└────────────────────┴────────────┘ +``` + +## substring(s, offset, longueur), mid(s, offset, longueur), substr(s, offset, longueur) {#substring} + +Renvoie une sous-chaîne commençant par l’octet du ‘offset’ index ‘length’ octets de long. L’indexation des caractères commence à partir d’un (comme dans SQL standard). Le ‘offset’ et ‘length’ les arguments doivent être des constantes. + +## substringUTF8(s, offset, longueur) {#substringutf8} + +Le même que ‘substring’, mais pour les points de code Unicode. Fonctionne sous l’hypothèse que la chaîne contient un ensemble d’octets représentant un texte codé en UTF-8. Si cette hypothèse n’est pas remplie, elle renvoie un résultat (elle ne lance pas d’exception). + +## appendTrailingCharIfAbsent (s, c) {#appendtrailingcharifabsent} + +Si l’ ‘s’ la chaîne n’est pas vide et ne contient pas ‘c’ personnage à la fin, il ajoute le ‘c’ personnage à la fin. + +## convertCharset(s, à partir de, à) {#convertcharset} + +Retourne une chaîne de caractères ‘s’ qui a été converti à partir de l’encodage dans ‘from’ pour l’encodage dans ‘to’. + +## base64Encode(s) {#base64encode} + +Encodage ‘s’ chaîne dans base64 + +## base64Decode(s) {#base64decode} + +Décoder la chaîne codée en base64 ‘s’ dans la chaîne d’origine. En cas d’échec, une exception est levée. + +## tryBase64Decode(s) {#trybase64decode} + +Semblable à base64Decode, mais en cas d’erreur, une chaîne vide serait renvoyé. + +## endsWith (s, suffixe) {#endswith} + +Renvoie s’il faut se terminer par le suffixe spécifié. Retourne 1 si la chaîne se termine par le suffixe spécifié, sinon elle renvoie 0. + +## startsWith (STR, préfixe) {#startswith} + +Retourne 1 si la chaîne commence par le préfixe spécifié, sinon elle renvoie 0. + +``` sql +SELECT startsWith('Spider-Man', 'Spi'); +``` + +**Valeurs renvoyées** + +- 1, si la chaîne commence par le préfixe spécifié. +- 0, si la chaîne ne commence pas par le préfixe spécifié. + +**Exemple** + +Requête: + +``` sql +SELECT startsWith('Hello, world!', 'He'); +``` + +Résultat: + +``` text +┌─startsWith('Hello, world!', 'He')─┐ +│ 1 │ +└───────────────────────────────────┘ +``` + +## coupe {#trim} + +Supprime tous les caractères spécifiés du début ou de la fin d’une chaîne. +Par défaut supprime toutes les occurrences consécutives d’espaces communs (caractère ASCII 32) des deux extrémités d’une chaîne. + +**Syntaxe** + +``` sql +trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) +``` + +**Paramètre** + +- `trim_character` — specified characters for trim. [Chaîne](../../sql-reference/data-types/string.md). +- `input_string` — string for trim. [Chaîne](../../sql-reference/data-types/string.md). + +**Valeur renvoyée** + +Une chaîne sans caractères de début et (ou) de fin spécifiés. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT trim(BOTH ' ()' FROM '( Hello, world! )') +``` + +Résultat: + +``` text +┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ +│ Hello, world! │ +└───────────────────────────────────────────────┘ +``` + +## trimLeft {#trimleft} + +Supprime toutes les occurrences consécutives d’espaces communs (caractère ASCII 32) depuis le début d’une chaîne. Il ne supprime pas d’autres types de caractères d’espaces (tabulation, espace sans pause, etc.). + +**Syntaxe** + +``` sql +trimLeft(input_string) +``` + +Alias: `ltrim(input_string)`. + +**Paramètre** + +- `input_string` — string to trim. [Chaîne](../../sql-reference/data-types/string.md). + +**Valeur renvoyée** + +Une chaîne sans ouvrir les espaces communs. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT trimLeft(' Hello, world! ') +``` + +Résultat: + +``` text +┌─trimLeft(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## trimRight {#trimright} + +Supprime toutes les occurrences consécutives d’espaces communs (caractère ASCII 32) de la fin d’une chaîne. Il ne supprime pas d’autres types de caractères d’espaces (tabulation, espace sans pause, etc.). + +**Syntaxe** + +``` sql +trimRight(input_string) +``` + +Alias: `rtrim(input_string)`. + +**Paramètre** + +- `input_string` — string to trim. [Chaîne](../../sql-reference/data-types/string.md). + +**Valeur renvoyée** + +Une chaîne sans espaces communs de fin. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT trimRight(' Hello, world! ') +``` + +Résultat: + +``` text +┌─trimRight(' Hello, world! ')─┐ +│ Hello, world! │ +└──────────────────────────────────────┘ +``` + +## trimBoth {#trimboth} + +Supprime toutes les occurrences consécutives d’espaces communs (caractère ASCII 32) des deux extrémités d’une chaîne. Il ne supprime pas d’autres types de caractères d’espaces (tabulation, espace sans pause, etc.). + +**Syntaxe** + +``` sql +trimBoth(input_string) +``` + +Alias: `trim(input_string)`. + +**Paramètre** + +- `input_string` — string to trim. [Chaîne](../../sql-reference/data-types/string.md). + +**Valeur renvoyée** + +Une chaîne sans espaces communs de début et de fin. + +Type: `String`. + +**Exemple** + +Requête: + +``` sql +SELECT trimBoth(' Hello, world! ') +``` + +Résultat: + +``` text +┌─trimBoth(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## CRC32 (s) {#crc32} + +Renvoie la somme de contrôle CRC32 d’une chaîne, en utilisant le polynôme CRC-32-IEEE 802.3 et la valeur initiale `0xffffffff` (zlib mise en œuvre). + +Le type de résultat est UInt32. + +## CRC32IEEE (s) {#crc32ieee} + +Renvoie la somme de contrôle CRC32 d’une chaîne, en utilisant le polynôme CRC-32-IEEE 802.3. + +Le type de résultat est UInt32. + +## CRC64 (s) {#crc64} + +Renvoie la somme de contrôle CRC64 d’une chaîne, en utilisant le polynôme CRC-64-ECMA. + +Le type de résultat est UInt64. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/fr/sql-reference/functions/string-replace-functions.md b/docs/fr/sql-reference/functions/string-replace-functions.md new file mode 100644 index 00000000000..1550e20ed3f --- /dev/null +++ b/docs/fr/sql-reference/functions/string-replace-functions.md @@ -0,0 +1,94 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 42 +toc_title: "Pour remplacer dans les cha\xEEnes" +--- + +# Les Fonctions De Recherche Et De Remplacement Dans Les chaînes {#functions-for-searching-and-replacing-in-strings} + +## replaceOne(botte de foin, modèle, remplacement) {#replaceonehaystack-pattern-replacement} + +Remplace la première occurrence, si elle existe, ‘pattern’ sous-chaîne dans ‘haystack’ avec l’ ‘replacement’ substring. +Ci-après, ‘pattern’ et ‘replacement’ doivent être constantes. + +## replaceAll(botte de foin, motif, remplacement), Remplacer(botte de foin, motif, remplacement) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} + +Remplace toutes les occurrences du ‘pattern’ sous-chaîne dans ‘haystack’ avec l’ ‘replacement’ substring. + +## replaceRegexpOne(botte de foin, modèle, remplacement) {#replaceregexponehaystack-pattern-replacement} + +Remplacement en utilisant le ‘pattern’ expression régulière. Une expression régulière re2. +Remplace seulement la première occurrence, si elle existe. +Un motif peut être spécifié comme ‘replacement’. Ce modèle peut inclure des substitutions `\0-\9`. +Substitution `\0` inclut l’expression régulière entière. Substitution `\1-\9` correspond au sous-modèle numbers.To utilisez le `\` caractère dans un modèle, échappez-le en utilisant `\`. +Aussi garder à l’esprit qu’un littéral de chaîne nécessite une évasion. + +Exemple 1. Conversion de la date au format américain: + +``` sql +SELECT DISTINCT + EventDate, + replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res +FROM test.hits +LIMIT 7 +FORMAT TabSeparated +``` + +``` text +2014-03-17 03/17/2014 +2014-03-18 03/18/2014 +2014-03-19 03/19/2014 +2014-03-20 03/20/2014 +2014-03-21 03/21/2014 +2014-03-22 03/22/2014 +2014-03-23 03/23/2014 +``` + +Exemple 2. Copier une chaîne dix fois: + +``` sql +SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res +``` + +``` text +┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## replaceRegexpAll(botte de foin, modèle, remplacement) {#replaceregexpallhaystack-pattern-replacement} + +Cela fait la même chose, mais remplace toutes les occurrences. Exemple: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res +``` + +``` text +┌─res────────────────────────┐ +│ HHeelllloo,, WWoorrlldd!! │ +└────────────────────────────┘ +``` + +Par exception, si une expression régulière travaillé sur un vide sous-chaîne, le remplacement n’est pas effectué plus d’une fois. +Exemple: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res +``` + +``` text +┌─res─────────────────┐ +│ here: Hello, World! │ +└─────────────────────┘ +``` + +## regexpQuoteMeta (s) {#regexpquotemetas} + +La fonction ajoute une barre oblique inverse avant certains caractères prédéfinis dans la chaîne. +Les personnages prédéfinis: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, ‘\]’, ‘?’, ‘\*‘,’+‘,’{‘,’:‘,’-’. +Cette implémentation diffère légèrement de re2:: RE2:: QuoteMeta. Il échappe à zéro octet comme \\0 au lieu de 00 et il échappe uniquement les caractères requis. +Pour plus d’informations, voir le lien: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/fr/sql-reference/functions/string-search-functions.md b/docs/fr/sql-reference/functions/string-search-functions.md new file mode 100644 index 00000000000..5a4867dc874 --- /dev/null +++ b/docs/fr/sql-reference/functions/string-search-functions.md @@ -0,0 +1,379 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 41 +toc_title: "Pour Rechercher Des Cha\xEEnes" +--- + +# Fonctions De Recherche De chaînes {#functions-for-searching-strings} + +La recherche est sensible à la casse par défaut dans toutes ces fonctions. Il existe des variantes pour la recherche insensible à la casse. + +## position(botte de foin, aiguille), localiser( botte de foin, aiguille) {#position} + +Renvoie la position (en octets) de la sous-chaîne trouvée dans la chaîne, à partir de 1. + +Fonctionne sous l’hypothèse que la chaîne de caractères contient un ensemble d’octets représentant un octet texte codé. Si cette hypothèse n’est pas remplie et qu’un caractère ne peut pas être représenté à l’aide d’un seul octet, la fonction ne lance pas d’exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux octets, il utilisera deux octets et ainsi de suite. + +Pour une recherche insensible à la casse, utilisez la fonction [positioncaseinsensible](#positioncaseinsensitive). + +**Syntaxe** + +``` sql +position(haystack, needle) +``` + +Alias: `locate(haystack, needle)`. + +**Paramètre** + +- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). + +**Valeurs renvoyées** + +- Position de départ en octets (à partir de 1), si la sous-chaîne a été trouvée. +- 0, si la sous-chaîne n’a pas été trouvé. + +Type: `Integer`. + +**Exemple** + +Phrase “Hello, world!” contient un ensemble d’octets représentant un octet texte codé. La fonction renvoie un résultat attendu: + +Requête: + +``` sql +SELECT position('Hello, world!', '!') +``` + +Résultat: + +``` text +┌─position('Hello, world!', '!')─┐ +│ 13 │ +└────────────────────────────────┘ +``` + +La même phrase en russe contient des caractères qui ne peuvent pas être représentés en utilisant un seul octet. La fonction renvoie un résultat inattendu (utilisation [positionUTF8](#positionutf8) fonction pour le texte codé sur plusieurs octets): + +Requête: + +``` sql +SELECT position('Привет, мир!', '!') +``` + +Résultat: + +``` text +┌─position('Привет, мир!', '!')─┐ +│ 21 │ +└───────────────────────────────┘ +``` + +## positioncaseinsensible {#positioncaseinsensitive} + +Le même que [position](#position) renvoie la position (en octets) de la sous-chaîne trouvée dans la chaîne, à partir de 1. Utilisez la fonction pour une recherche insensible à la casse. + +Fonctionne sous l’hypothèse que la chaîne de caractères contient un ensemble d’octets représentant un octet texte codé. Si cette hypothèse n’est pas remplie et qu’un caractère ne peut pas être représenté à l’aide d’un seul octet, la fonction ne lance pas d’exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux octets, il utilisera deux octets et ainsi de suite. + +**Syntaxe** + +``` sql +positionCaseInsensitive(haystack, needle) +``` + +**Paramètre** + +- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). + +**Valeurs renvoyées** + +- Position de départ en octets (à partir de 1), si la sous-chaîne a été trouvée. +- 0, si la sous-chaîne n’a pas été trouvé. + +Type: `Integer`. + +**Exemple** + +Requête: + +``` sql +SELECT positionCaseInsensitive('Hello, world!', 'hello') +``` + +Résultat: + +``` text +┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ +│ 1 │ +└───────────────────────────────────────────────────┘ +``` + +## positionUTF8 {#positionutf8} + +Renvoie la position (en points Unicode) de la sous-chaîne trouvée dans la chaîne, à partir de 1. + +Fonctionne sous l’hypothèse que la chaîne contient un ensemble d’octets représentant un texte codé en UTF-8. Si cette hypothèse n’est pas remplie, la fonction ne lance pas d’exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux points Unicode, il en utilisera deux et ainsi de suite. + +Pour une recherche insensible à la casse, utilisez la fonction [positionCaseInsensitiveUTF8](#positioncaseinsensitiveutf8). + +**Syntaxe** + +``` sql +positionUTF8(haystack, needle) +``` + +**Paramètre** + +- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). + +**Valeurs renvoyées** + +- Position de départ dans les points Unicode (à partir de 1), si la sous-chaîne a été trouvée. +- 0, si la sous-chaîne n’a pas été trouvé. + +Type: `Integer`. + +**Exemple** + +Phrase “Hello, world!” en russe contient un ensemble de points Unicode représentant un texte codé à un seul point. La fonction renvoie un résultat attendu: + +Requête: + +``` sql +SELECT positionUTF8('Привет, мир!', '!') +``` + +Résultat: + +``` text +┌─positionUTF8('Привет, мир!', '!')─┐ +│ 12 │ +└───────────────────────────────────┘ +``` + +Phrase “Salut, étudiante!” où le caractère `é` peut être représenté en utilisant un point (`U+00E9`) ou deux points (`U+0065U+0301`) la fonction peut être retournée un résultat inattendu: + +Requête pour la lettre `é` qui est représenté un point Unicode `U+00E9`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +Résultat: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 17 │ +└────────────────────────────────────────┘ +``` + +Requête pour la lettre `é` qui est représenté deux points Unicode `U+0065U+0301`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +Résultat: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 18 │ +└────────────────────────────────────────┘ +``` + +## positionCaseInsensitiveUTF8 {#positioncaseinsensitiveutf8} + +Le même que [positionUTF8](#positionutf8) mais est sensible à la casse. Renvoie la position (en points Unicode) de la sous-chaîne trouvée dans la chaîne, à partir de 1. + +Fonctionne sous l’hypothèse que la chaîne contient un ensemble d’octets représentant un texte codé en UTF-8. Si cette hypothèse n’est pas remplie, la fonction ne lance pas d’exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux points Unicode, il en utilisera deux et ainsi de suite. + +**Syntaxe** + +``` sql +positionCaseInsensitiveUTF8(haystack, needle) +``` + +**Paramètre** + +- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). + +**Valeur renvoyée** + +- Position de départ dans les points Unicode (à partir de 1), si la sous-chaîne a été trouvée. +- 0, si la sous-chaîne n’a pas été trouvé. + +Type: `Integer`. + +**Exemple** + +Requête: + +``` sql +SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') +``` + +Résultat: + +``` text +┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ +│ 9 │ +└────────────────────────────────────────────────────┘ +``` + +## multirecherchallpositions {#multisearchallpositions} + +Le même que [position](string-search-functions.md#position) mais les retours `Array` des positions (en octets) des sous-chaînes correspondantes trouvées dans la chaîne. Les Positions sont indexées à partir de 1. + +La recherche est effectuée sur des séquences d’octets sans tenir compte de l’encodage et du classement des chaînes. + +- Pour une recherche ASCII insensible à la casse, utilisez la fonction `multiSearchAllPositionsCaseInsensitive`. +- Pour la recherche en UTF-8, Utilisez la fonction [multiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). +- Pour la recherche UTF-8 insensible à la casse, utilisez la fonction multiSearchAllPositionsCaseInsensitiveutf8. + +**Syntaxe** + +``` sql +multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) +``` + +**Paramètre** + +- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). + +**Valeurs renvoyées** + +- Tableau de positions de départ en octets (à partir de 1), si la sous-chaîne correspondante a été trouvée et 0 si elle n’est pas trouvée. + +**Exemple** + +Requête: + +``` sql +SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) +``` + +Résultat: + +``` text +┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ +│ [0,13,0] │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## multiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} + +Voir `multiSearchAllPositions`. + +## multiSearchFirstPosition(botte de foin, \[aiguille1, aiguille2, …, needleet\]) {#multisearchfirstposition} + +Le même que `position` mais renvoie le décalage le plus à gauche de la chaîne `haystack` et qui correspond à certains des aiguilles. + +Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. + +## multiSearchFirstIndex(botte de foin, \[aiguille1, aiguille2, …, needleet\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} + +Renvoie l’index `i` (à partir de 1) de l’aiguille trouvée la plus à gaucheje dans la chaîne `haystack` et 0 sinon. + +Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. + +## multiSearchAny(botte de foin, \[aiguille1, aiguille2, …, needleet\]) {#function-multisearchany} + +Renvoie 1, si au moins une aiguille de chaîneje correspond à la chaîne `haystack` et 0 sinon. + +Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. + +!!! note "Note" + Dans tous les `multiSearch*` fonctions le nombre d’aiguilles doit être d’au moins 28 en raison de la spécification de mise en œuvre. + +## match (botte de foin, motif) {#matchhaystack-pattern} + +Vérifie si la chaîne correspond au `pattern` expression régulière. Un `re2` expression régulière. Le [syntaxe](https://github.com/google/re2/wiki/Syntax) de la `re2` les expressions régulières sont plus limitées que la syntaxe des expressions régulières Perl. + +Renvoie 0 si elle ne correspond pas, ou 1 si elle correspond. + +Notez que le symbole antislash (`\`) est utilisé pour s’échapper dans l’expression régulière. Le même symbole est utilisé pour échapper dans les littéraux de chaîne. Donc, pour échapper au symbole dans une expression régulière, vous devez écrire deux barres obliques inverses ( \\ ) dans un littéral de chaîne. + +L’expression régulière travaille à la chaîne, comme si c’est un ensemble d’octets. L’expression régulière ne peut pas contenir d’octets nuls. +Pour que les modèles recherchent des sous-chaînes dans une chaîne, il est préférable D’utiliser LIKE ou ‘position’ depuis ils travaillent beaucoup plus vite. + +## multiMatchAny(botte de foin, \[motif1, modèle2, …, patternet\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} + +Le même que `match` mais renvoie 0 si aucune des expressions régulières sont appariés et 1 si l’un des modèles les matchs. Il utilise [hyperscan](https://github.com/intel/hyperscan) bibliothèque. Pour que les modèles recherchent des sous-chaînes dans une chaîne, il est préférable d’utiliser `multiSearchAny` comme cela fonctionne beaucoup plus vite. + +!!! note "Note" + La longueur de l’un des `haystack` la chaîne doit être inférieure à 232 octets sinon l’exception est levée. Cette restriction a lieu en raison de l’API hyperscan. + +## multiMatchAnyIndex(botte de foin, \[motif1, modèle2, …, patternet\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} + +Le même que `multiMatchAny` mais retourne un index qui correspond à la botte de foin. + +## multiMatchAllIndices(botte de foin, \[motif1, modèle2, …, patternet\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} + +Le même que `multiMatchAny`, mais renvoie le tableau de tous les indices qui correspondent à la botte de foin dans n’importe quel ordre. + +## multiFuzzyMatchAny(botte de foin, distance, \[motif1, modèle2, …, patternet\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} + +Le même que `multiMatchAny`, mais renvoie 1 si un motif correspond à la botte de foin dans une constante [distance d’édition](https://en.wikipedia.org/wiki/Edit_distance). Cette fonction est également en mode expérimental et peut être extrêmement lente. Pour plus d’informations, voir [documentation hyperscan](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). + +## multiFuzzyMatchAnyIndex(botte de foin, distance, \[motif1, modèle2, …, patternet\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} + +Le même que `multiFuzzyMatchAny`, mais renvoie tout index qui correspond à la botte de foin à une distance d’édition constante. + +## multiFuzzyMatchAllIndices(botte de foin, distance, \[motif1, modèle2, …, patternet\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} + +Le même que `multiFuzzyMatchAny`, mais renvoie le tableau de tous les indices dans n’importe quel ordre qui correspond à la botte de foin à une distance d’édition constante. + +!!! note "Note" + `multiFuzzyMatch*` les fonctions ne prennent pas en charge les expressions régulières UTF-8, et ces expressions sont traitées comme des octets en raison de la restriction hyperscan. + +!!! note "Note" + Pour désactiver toutes les fonctions qui utilisent hyperscan, utilisez le réglage `SET allow_hyperscan = 0;`. + +## extrait(botte de foin, motif) {#extracthaystack-pattern} + +Extraits d’un fragment d’une chaîne à l’aide d’une expression régulière. Si ‘haystack’ ne correspond pas à l’ ‘pattern’ regex, une chaîne vide est renvoyée. Si l’expression rationnelle ne contient pas de sous-modèles, elle prend le fragment qui correspond à l’expression rationnelle entière. Sinon, il prend le fragment qui correspond au premier sous-masque. + +## extractAll(botte de foin, motif) {#extractallhaystack-pattern} + +Extrait tous les fragments d’une chaîne à l’aide d’une expression régulière. Si ‘haystack’ ne correspond pas à l’ ‘pattern’ regex, une chaîne vide est renvoyée. Renvoie un tableau de chaînes composé de toutes les correspondances à l’expression rationnelle. En général, le comportement est le même que le ‘extract’ fonction (il prend le premier sous-masque, ou l’expression entière s’il n’y a pas de sous-masque). + +## comme (botte de foin, motif), botte de foin comme opérateur de motif {#function-like} + +Vérifie si une chaîne correspond à une expression régulière simple. +L’expression régulière peut contenir les métasymboles `%` et `_`. + +`%` indique n’importe quelle quantité d’octets (y compris zéro caractère). + +`_` indique un octet. + +Utilisez la barre oblique inverse (`\`) pour échapper aux métasymboles. Voir la note sur l’échappement dans la description du ‘match’ fonction. + +Pour les expressions régulières comme `%needle%`, le code est plus optimale et fonctionne aussi vite que le `position` fonction. +Pour d’autres expressions régulières, le code est le même que pour la ‘match’ fonction. + +## notLike (botte de foin, motif), botte de foin pas comme opérateur de motif {#function-notlike} + +La même chose que ‘like’ mais négative. + +## ngramDistance(botte de foin, aiguille) {#ngramdistancehaystack-needle} + +Calcule la distance de 4 grammes entre `haystack` et `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` ou `haystack` est plus de 32Kb, jette une exception. Si une partie de la non-constante `haystack` ou `needle` les chaînes sont plus que 32Kb, la distance est toujours un. + +Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. + +## ngramSearch(botte de foin, aiguille) {#ngramsearchhaystack-needle} + +Même que `ngramDistance` mais calcule la différence non symétrique entre `needle` et `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` n-grammes. Le plus proche d’un, le plus probable `needle` est dans le `haystack`. Peut être utile pour la recherche de chaîne floue. + +Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. + +!!! note "Note" + For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/fr/sql-reference/functions/type-conversion-functions.md b/docs/fr/sql-reference/functions/type-conversion-functions.md new file mode 100644 index 00000000000..143ba05d528 --- /dev/null +++ b/docs/fr/sql-reference/functions/type-conversion-functions.md @@ -0,0 +1,534 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 38 +toc_title: La Conversion De Type +--- + +# Fonctions De Conversion De Type {#type-conversion-functions} + +## Problèmes Courants Des Conversions numériques {#numeric-conversion-issues} + +Lorsque vous convertissez une valeur d’un type de données à un autre, vous devez vous rappeler que dans le cas courant, il s’agit d’une opération dangereuse qui peut entraîner une perte de données. Une perte de données peut se produire si vous essayez d’ajuster la valeur d’un type de données plus grand à un type de données plus petit, ou si vous convertissez des valeurs entre différents types de données. + +ClickHouse a le [même comportement que les programmes C++](https://en.cppreference.com/w/cpp/language/implicit_conversion). + +## toInt (8/16/32/64) {#toint8163264} + +Convertit une valeur d’entrée en [Int](../../sql-reference/data-types/int-uint.md) type de données. Cette fonction comprend: + +- `toInt8(expr)` — Results in the `Int8` type de données. +- `toInt16(expr)` — Results in the `Int16` type de données. +- `toInt32(expr)` — Results in the `Int32` type de données. +- `toInt64(expr)` — Results in the `Int64` type de données. + +**Paramètre** + +- `expr` — [Expression](../syntax.md#syntax-expressions) renvoyer un nombre ou une chaîne avec la représentation décimale d’un nombre. Les représentations binaires, octales et hexadécimales des nombres ne sont pas prises en charge. Les zéros principaux sont dépouillés. + +**Valeur renvoyée** + +Valeur entière dans le `Int8`, `Int16`, `Int32`, ou `Int64` type de données. + +Fonctions d’utilisation [l’arrondi vers zéro](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), ce qui signifie qu’ils tronquent des chiffres fractionnaires de nombres. + +Le comportement des fonctions pour le [NaN et Inf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) arguments est indéfini. Rappelez-vous sur [problèmes de conversion numérique](#numeric-conversion-issues), lorsque vous utilisez les fonctions. + +**Exemple** + +``` sql +SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) +``` + +``` text +┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ +│ -9223372036854775808 │ 32 │ 16 │ 8 │ +└──────────────────────┴─────────────┴───────────────┴─────────────┘ +``` + +## toInt (8/16/32/64)OrZero {#toint8163264orzero} + +Il prend un argument de type String et essaie de l’analyser en Int (8 \| 16 \| 32 \| 64). En cas d’échec, renvoie 0. + +**Exemple** + +``` sql +select toInt64OrZero('123123'), toInt8OrZero('123qwe123') +``` + +``` text +┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ +│ 123123 │ 0 │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toInt (8/16/32/64)OrNull {#toint8163264ornull} + +Il prend un argument de type String et essaie de l’analyser en Int (8 \| 16 \| 32 \| 64). En cas d’échec, renvoie NULL. + +**Exemple** + +``` sql +select toInt64OrNull('123123'), toInt8OrNull('123qwe123') +``` + +``` text +┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ +│ 123123 │ ᴺᵁᴸᴸ │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toUInt (8/16/32/64) {#touint8163264} + +Convertit une valeur d’entrée en [UInt](../../sql-reference/data-types/int-uint.md) type de données. Cette fonction comprend: + +- `toUInt8(expr)` — Results in the `UInt8` type de données. +- `toUInt16(expr)` — Results in the `UInt16` type de données. +- `toUInt32(expr)` — Results in the `UInt32` type de données. +- `toUInt64(expr)` — Results in the `UInt64` type de données. + +**Paramètre** + +- `expr` — [Expression](../syntax.md#syntax-expressions) renvoyer un nombre ou une chaîne avec la représentation décimale d’un nombre. Les représentations binaires, octales et hexadécimales des nombres ne sont pas prises en charge. Les zéros principaux sont dépouillés. + +**Valeur renvoyée** + +Valeur entière dans le `UInt8`, `UInt16`, `UInt32`, ou `UInt64` type de données. + +Fonctions d’utilisation [l’arrondi vers zéro](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), ce qui signifie qu’ils tronquent des chiffres fractionnaires de nombres. + +Le comportement des fonctions pour les agruments négatifs et pour le [NaN et Inf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) arguments est indéfini. Si vous passez une chaîne avec un nombre négatif, par exemple `'-32'`, ClickHouse soulève une exception. Rappelez-vous sur [problèmes de conversion numérique](#numeric-conversion-issues), lorsque vous utilisez les fonctions. + +**Exemple** + +``` sql +SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) +``` + +``` text +┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ +│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ +└─────────────────────┴───────────────┴────────────────┴──────────────┘ +``` + +## toUInt (8/16/32/64)OrZero {#touint8163264orzero} + +## toUInt (8/16/32/64)OrNull {#touint8163264ornull} + +## toFloat (32/64) {#tofloat3264} + +## toFloat (32/64)OrZero {#tofloat3264orzero} + +## toFloat (32/64) OrNull {#tofloat3264ornull} + +## jour {#todate} + +## toDateOrZero {#todateorzero} + +## toDateOrNull {#todateornull} + +## toDateTime {#todatetime} + +## toDateTimeOrZero {#todatetimeorzero} + +## toDateTimeOrNull {#todatetimeornull} + +## toDecimal (32/64/128) {#todecimal3264128} + +Convertir `value` à l’ [Décimal](../../sql-reference/data-types/decimal.md) type de données avec précision de `S`. Le `value` peut être un nombre ou une chaîne. Le `S` (l’échelle) paramètre spécifie le nombre de décimales. + +- `toDecimal32(value, S)` +- `toDecimal64(value, S)` +- `toDecimal128(value, S)` + +## toDecimal (32/64/128) OrNull {#todecimal3264128ornull} + +Convertit une chaîne d’entrée en [Nullable (Décimal (P, S))](../../sql-reference/data-types/decimal.md) valeur de type de données. Cette famille de fonctions comprennent: + +- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` type de données. +- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` type de données. +- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` type de données. + +Ces fonctions devraient être utilisées à la place de `toDecimal*()` fonctions, si vous préférez obtenir un `NULL` la valeur au lieu d’une exception dans le cas d’une valeur d’entrée erreur d’analyse. + +**Paramètre** + +- `expr` — [Expression](../syntax.md#syntax-expressions), retourne une valeur dans l’ [Chaîne](../../sql-reference/data-types/string.md) type de données. ClickHouse attend la représentation textuelle du nombre décimal. Exemple, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**Valeur renvoyée** + +Une valeur dans l’ `Nullable(Decimal(P,S))` type de données. La valeur contient: + +- Numéro `S` décimales, si ClickHouse interprète la chaîne d’entrée comme un nombre. +- `NULL` si ClickHouse ne peut pas interpréter la chaîne d’entrée comme un nombre ou si le nombre d’entrée contient plus de `S` décimale. + +**Exemple** + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ +│ -1.11100 │ Nullable(Decimal(9, 5)) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ +│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toDecimal (32/64/128)OrZero {#todecimal3264128orzero} + +Convertit une valeur d’entrée en [Decimal(P,S)](../../sql-reference/data-types/decimal.md) type de données. Cette famille de fonctions comprennent: + +- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` type de données. +- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` type de données. +- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` type de données. + +Ces fonctions devraient être utilisées à la place de `toDecimal*()` fonctions, si vous préférez obtenir un `0` la valeur au lieu d’une exception dans le cas d’une valeur d’entrée erreur d’analyse. + +**Paramètre** + +- `expr` — [Expression](../syntax.md#syntax-expressions), retourne une valeur dans l’ [Chaîne](../../sql-reference/data-types/string.md) type de données. ClickHouse attend la représentation textuelle du nombre décimal. Exemple, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**Valeur renvoyée** + +Une valeur dans l’ `Nullable(Decimal(P,S))` type de données. La valeur contient: + +- Numéro `S` décimales, si ClickHouse interprète la chaîne d’entrée comme un nombre. +- 0 avec `S` décimales, si ClickHouse ne peut pas interpréter la chaîne d’entrée comme un nombre ou si le nombre d’entrée contient plus de `S` décimale. + +**Exemple** + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ +│ -1.11100 │ Decimal(9, 5) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ +│ 0.00 │ Decimal(9, 2) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toString {#tostring} + +Fonctions de conversion entre des nombres, des chaînes (mais pas des chaînes fixes), des dates et des dates avec des heures. +Toutes ces fonctions acceptent un argument. + +Lors de la conversion vers ou à partir d’une chaîne, la valeur est formatée ou analysée en utilisant les mêmes règles que pour le format TabSeparated (et presque tous les autres formats de texte). Si la chaîne ne peut pas être analysée, une exception est levée et la demande est annulée. + +Lors de la conversion de dates en nombres ou vice versa, la date correspond au nombre de jours depuis le début de L’époque Unix. +Lors de la conversion de dates avec des heures en nombres ou vice versa, la date avec l’heure correspond au nombre de secondes depuis le début de L’époque Unix. + +Les formats date et date-avec-heure pour les fonctions toDate/toDateTime sont définis comme suit: + +``` text +YYYY-MM-DD +YYYY-MM-DD hh:mm:ss +``` + +À titre d’exception, si vous convertissez des types numériques UInt32, Int32, UInt64 ou Int64 à Date, et si le nombre est supérieur ou égal à 65536, le nombre est interprété comme un horodatage Unix (et non comme le nombre de jours) et est arrondi à la date. Cela permet de prendre en charge l’occurrence commune de l’écriture ‘toDate(unix\_timestamp)’, qui autrement serait une erreur et nécessiterait d’écrire le plus lourd ‘toDate(toDateTime(unix\_timestamp))’. + +La Conversion entre une date et une date avec l’heure est effectuée de manière naturelle: en ajoutant une heure nulle ou en supprimant l’heure. + +La Conversion entre types numériques utilise les mêmes règles que les affectations entre différents types numériques en C++. + +De plus, la fonction ToString de L’argument DateTime peut prendre un deuxième argument de chaîne contenant le nom du fuseau horaire. Exemple: `Asia/Yekaterinburg` Dans ce cas, l’heure est formatée en fonction du fuseau horaire spécifié. + +``` sql +SELECT + now() AS now_local, + toString(now(), 'Asia/Yekaterinburg') AS now_yekat +``` + +``` text +┌───────────now_local─┬─now_yekat───────────┐ +│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ +└─────────────────────┴─────────────────────┘ +``` + +Voir aussi l’ `toUnixTimestamp` fonction. + +## toFixedString (s, N) {#tofixedstrings-n} + +Convertit un argument de type String en un type FixedString (N) (une chaîne de longueur fixe N). N doit être une constante. +Si la chaîne a moins d’octets que N, elle est passée avec des octets null à droite. Si la chaîne a plus d’octets que N, une exception est levée. + +## toStringCutToZero(s) {#tostringcuttozeros} + +Accepte un argument String ou FixedString. Renvoie la chaîne avec le contenu tronqué au premier octet zéro trouvé. + +Exemple: + +``` sql +SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s─────────────┬─s_cut─┐ +│ foo\0\0\0\0\0 │ foo │ +└───────────────┴───────┘ +``` + +``` sql +SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s──────────┬─s_cut─┐ +│ foo\0bar\0 │ foo │ +└────────────┴───────┘ +``` + +## reinterpretAsUInt (8/16/32/64) {#reinterpretasuint8163264} + +## reinterpretAsInt (8/16/32/64) {#reinterpretasint8163264} + +## reinterpretAsFloat (32/64) {#reinterpretasfloat3264} + +## réinterprétasdate {#reinterpretasdate} + +## reinterpretAsDateTime {#reinterpretasdatetime} + +Ces fonctions acceptent une chaîne et interprètent les octets placés au début de la chaîne comme un nombre dans l’ordre de l’hôte (little endian). Si la chaîne n’est pas assez longue, les fonctions fonctionnent comme si la chaîne était remplie avec le nombre nécessaire d’octets nuls. Si la chaîne est plus longue que nécessaire, les octets supplémentaires sont ignorés. Une date est interprétée comme le nombre de jours depuis le début de l’Époque Unix, et une date avec le temps, est interprété comme le nombre de secondes écoulées depuis le début de l’Époque Unix. + +## reinterpretAsString {#type_conversion_functions-reinterpretAsString} + +Cette fonction accepte un nombre ou une date ou une date avec l’heure, et renvoie une chaîne contenant des octets représentant la valeur correspondante dans l’ordre de l’hôte (little endian). Les octets nuls sont supprimés de la fin. Par exemple, une valeur de type uint32 de 255 est une chaîne longue d’un octet. + +## reinterpretAsFixedString {#reinterpretasfixedstring} + +Cette fonction accepte un nombre ou une date ou une date avec l’heure, et renvoie une chaîne fixe contenant des octets représentant la valeur correspondante dans l’ordre de l’hôte (little endian). Les octets nuls sont supprimés de la fin. Par exemple, une valeur de type uint32 de 255 est une chaîne fixe longue d’un octet. + +## CAST (x, T) {#type_conversion_function-cast} + +Convertir ‘x’ à l’ ‘t’ type de données. La syntaxe CAST (X comme t) est également prise en charge. + +Exemple: + +``` sql +SELECT + '2016-06-15 23:00:00' AS timestamp, + CAST(timestamp AS DateTime) AS datetime, + CAST(timestamp AS Date) AS date, + CAST(timestamp, 'String') AS string, + CAST(timestamp, 'FixedString(22)') AS fixed_string +``` + +``` text +┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ +└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ +``` + +La Conversion en FixedString (N) ne fonctionne que pour les arguments de type String ou FixedString (N). + +Type conversion en [Nullable](../../sql-reference/data-types/nullable.md) et le dos est pris en charge. Exemple: + +``` sql +SELECT toTypeName(x) FROM t_null +``` + +``` text +┌─toTypeName(x)─┐ +│ Int8 │ +│ Int8 │ +└───────────────┘ +``` + +``` sql +SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null +``` + +``` text +┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ +│ Nullable(UInt16) │ +│ Nullable(UInt16) │ +└─────────────────────────────────────────┘ +``` + +## toInterval (année / trimestre / Mois / Semaine / Jour / Heure / Minute / Seconde) {#function-tointerval} + +Convertit un argument de type Number en [Intervalle](../../sql-reference/data-types/special-data-types/interval.md) type de données. + +**Syntaxe** + +``` sql +toIntervalSecond(number) +toIntervalMinute(number) +toIntervalHour(number) +toIntervalDay(number) +toIntervalWeek(number) +toIntervalMonth(number) +toIntervalQuarter(number) +toIntervalYear(number) +``` + +**Paramètre** + +- `number` — Duration of interval. Positive integer number. + +**Valeurs renvoyées** + +- La valeur de `Interval` type de données. + +**Exemple** + +``` sql +WITH + toDate('2019-01-01') AS date, + INTERVAL 1 WEEK AS interval_week, + toIntervalWeek(1) AS interval_to_week +SELECT + date + interval_week, + date + interval_to_week +``` + +``` text +┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ +│ 2019-01-08 │ 2019-01-08 │ +└───────────────────────────┴──────────────────────────────┘ +``` + +## parseDateTimeBestEffort {#parsedatetimebesteffort} + +Convertit une date et une heure dans le [Chaîne](../../sql-reference/data-types/string.md) la représentation de [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) type de données. + +La fonction d’analyse [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC 1123 - 5.2.14 RFC-822 date et heure Spécification](https://tools.ietf.org/html/rfc1123#page-55), ClickHouse et d’autres formats de date et d’heure. + +**Syntaxe** + +``` sql +parseDateTimeBestEffort(time_string [, time_zone]); +``` + +**Paramètre** + +- `time_string` — String containing a date and time to convert. [Chaîne](../../sql-reference/data-types/string.md). +- `time_zone` — Time zone. The function parses `time_string` selon le fuseau horaire. [Chaîne](../../sql-reference/data-types/string.md). + +**Formats non standard pris en charge** + +- Une chaîne contenant 9..10 chiffres [le timestamp unix](https://en.wikipedia.org/wiki/Unix_time). +- Une chaîne avec une date et une heure composant: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, etc. +- Une chaîne avec une date, mais pas de composant de temps: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` etc. +- Une chaîne avec un jour et une heure: `DD`, `DD hh`, `DD hh:mm`. Dans ce cas `YYYY-MM` sont substitués comme suit `2000-01`. +- Une chaîne qui inclut la date et l’heure ainsi que des informations de décalage de fuseau horaire: `YYYY-MM-DD hh:mm:ss ±h:mm`, etc. Exemple, `2020-12-12 17:36:00 -5:00`. + +Pour tous les formats avec séparateur, la fonction analyse les noms de mois exprimés par leur nom complet ou par les trois premières lettres d’un nom de mois. Exemple: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. + +**Valeur renvoyée** + +- `time_string` converti à l’ `DateTime` type de données. + +**Exemple** + +Requête: + +``` sql +SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') +AS parseDateTimeBestEffort; +``` + +Résultat: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2020-12-12 12:12:57 │ +└─────────────────────────┘ +``` + +Requête: + +``` sql +SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') +AS parseDateTimeBestEffort +``` + +Résultat: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-08-18 10:22:16 │ +└─────────────────────────┘ +``` + +Requête: + +``` sql +SELECT parseDateTimeBestEffort('1284101485') +AS parseDateTimeBestEffort +``` + +Résultat: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2015-07-07 12:04:41 │ +└─────────────────────────┘ +``` + +Requête: + +``` sql +SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') +AS parseDateTimeBestEffort +``` + +Résultat: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-12-12 10:12:12 │ +└─────────────────────────┘ +``` + +Requête: + +``` sql +SELECT parseDateTimeBestEffort('10 20:19') +``` + +Résultat: + +``` text +┌─parseDateTimeBestEffort('10 20:19')─┐ +│ 2000-01-10 20:19:00 │ +└─────────────────────────────────────┘ +``` + +**Voir Aussi** + +- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) +- [RFC 1123](https://tools.ietf.org/html/rfc1123) +- [jour](#todate) +- [toDateTime](#todatetime) + +## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} + +De même que pour [parseDateTimeBestEffort](#parsedatetimebesteffort) sauf qu’il renvoie null lorsqu’il rencontre un format de date qui ne peut pas être traité. + +## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} + +De même que pour [parseDateTimeBestEffort](#parsedatetimebesteffort) sauf qu’il renvoie une date zéro ou une date zéro lorsqu’il rencontre un format de date qui ne peut pas être traité. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/fr/sql-reference/functions/url-functions.md b/docs/fr/sql-reference/functions/url-functions.md new file mode 100644 index 00000000000..01c77611509 --- /dev/null +++ b/docs/fr/sql-reference/functions/url-functions.md @@ -0,0 +1,209 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 54 +toc_title: Travailler avec des URL +--- + +# Fonctions Pour Travailler Avec Des URL {#functions-for-working-with-urls} + +Toutes ces fonctions ne suivent pas la RFC. Ils sont simplifiés au maximum pour améliorer les performances. + +## Fonctions Qui Extraient Des Parties d’une URL {#functions-that-extract-parts-of-a-url} + +Si la partie pertinente n’est pas présente dans une URL, une chaîne vide est renvoyée. + +### protocole {#protocol} + +Extrait le protocole d’une URL. + +Examples of typical returned values: http, https, ftp, mailto, tel, magnet… + +### domaine {#domain} + +Extrait le nom d’hôte d’une URL. + +``` sql +domain(url) +``` + +**Paramètre** + +- `url` — URL. Type: [Chaîne](../../sql-reference/data-types/string.md). + +L’URL peut être spécifiée avec ou sans schéma. Exemple: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +Pour ces exemples, le `domain` la fonction renvoie les résultats suivants: + +``` text +some.svn-hosting.com +some.svn-hosting.com +yandex.com +``` + +**Valeurs renvoyées** + +- Nom d’hôte. Si ClickHouse peut analyser la chaîne d’entrée en tant QU’URL. +- Chaîne vide. Si ClickHouse ne peut pas analyser la chaîne d’entrée en tant QU’URL. + +Type: `String`. + +**Exemple** + +``` sql +SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ +│ some.svn-hosting.com │ +└────────────────────────────────────────────────────────┘ +``` + +### domainWithoutWWW {#domainwithoutwww} + +Renvoie le domaine et ne supprime pas plus d’un ‘www.’ dès le début de celui-ci, si présent. + +### topLevelDomain {#topleveldomain} + +Extrait le domaine de premier niveau d’une URL. + +``` sql +topLevelDomain(url) +``` + +**Paramètre** + +- `url` — URL. Type: [Chaîne](../../sql-reference/data-types/string.md). + +L’URL peut être spécifiée avec ou sans schéma. Exemple: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +**Valeurs renvoyées** + +- Nom de domaine. Si ClickHouse peut analyser la chaîne d’entrée en tant QU’URL. +- Chaîne vide. Si ClickHouse ne peut pas analyser la chaîne d’entrée en tant QU’URL. + +Type: `String`. + +**Exemple** + +``` sql +SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ +│ com │ +└────────────────────────────────────────────────────────────────────┘ +``` + +### firstSignificantSubdomain {#firstsignificantsubdomain} + +Renvoie la “first significant subdomain”. C’est un concept non standard spécifique à Yandex.Metrica. Le premier sous-domaine significatif est un domaine de deuxième niveau s’il est ‘com’, ‘net’, ‘org’, ou ‘co’. Sinon, il est un domaine de troisième niveau. Exemple, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. La liste des “insignificant” les domaines de deuxième niveau et d’autres détails de mise en œuvre peuvent changer à l’avenir. + +### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} + +Renvoie la partie du domaine qui inclut les sous-domaines de premier niveau “first significant subdomain” (voir l’explication ci-dessus). + +Exemple, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. + +### chemin {#path} + +Retourne le chemin d’accès. Exemple: `/top/news.html` Le chemin n’inclut pas la chaîne de requête. + +### pathFull {#pathfull} + +La même chose que ci-dessus, mais y compris la chaîne de requête et le fragment. Exemple: / top / nouvelles.le html?page = 2 \# commentaires + +### queryString {#querystring} + +Retourne la chaîne de requête. Exemple: page = 1 & lr=213. query-string n’inclut pas le point d’interrogation initial, ainsi que \# et tout ce qui suit \#. + +### fragment {#fragment} + +Renvoie l’identificateur de fragment. fragment n’inclut pas le symbole de hachage initial. + +### queryStringAndFragment {#querystringandfragment} + +Renvoie la chaîne de requête et l’Identificateur de fragment. Exemple: page = 1 \# 29390. + +### extractURLParameter (URL, nom) {#extracturlparameterurl-name} + +Renvoie la valeur de la ‘name’ paramètre dans l’URL, le cas échéant. Sinon, une chaîne vide. S’il y a beaucoup de paramètres avec ce nom, il renvoie la première occurrence. Cette fonction fonctionne en supposant que le nom du paramètre est codé dans L’URL exactement de la même manière que dans l’argument passé. + +### extractURLParameters (URL) {#extracturlparametersurl} + +Renvoie un tableau de chaînes name = value correspondant aux paramètres D’URL. Les valeurs ne sont en aucun cas décodées. + +### extractURLParameterNames (URL) {#extracturlparameternamesurl} + +Retourne un tableau de chaînes de noms correspondant aux noms des paramètres d’URL. Les valeurs ne sont en aucun cas décodées. + +### URLHierarchy (URL) {#urlhierarchyurl} + +Retourne un tableau contenant L’URL, tronquée à la fin par les symboles /,? dans le chemin et la chaîne de requête. Les caractères séparateurs consécutifs sont comptés comme un. La coupe est faite dans la position après tous les caractères de séparation consécutifs. + +### URLPathHierarchy (URL) {#urlpathhierarchyurl} + +La même chose que ci-dessus, mais sans le protocole et l’hôte dans le résultat. Le / les élément (racine) n’est pas inclus. Exemple: la fonction est utilisée pour implémenter l’arborescence des rapports de L’URL dans Yandex. Métrique. + +``` text +URLPathHierarchy('https://example.com/browse/CONV-6788') = +[ + '/browse/', + '/browse/CONV-6788' +] +``` + +### decodeURLComponent (URL) {#decodeurlcomponenturl} + +Renvoie L’URL décodée. +Exemple: + +``` sql +SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; +``` + +``` text +┌─DecodedURL─────────────────────────────┐ +│ http://127.0.0.1:8123/?query=SELECT 1; │ +└────────────────────────────────────────┘ +``` + +## Fonctions Qui Suppriment Une Partie D’une URL {#functions-that-remove-part-of-a-url} + +Si L’URL n’a rien de similaire, L’URL reste inchangée. + +### cutWWW {#cutwww} + +Supprime pas plus d’une ‘www.’ depuis le début du domaine de L’URL, s’il est présent. + +### cutQueryString {#cutquerystring} + +Supprime la chaîne de requête. Le point d’interrogation est également supprimé. + +### cutFragment {#cutfragment} + +Supprime l’identificateur de fragment. Le signe est également supprimé. + +### couperystringandfragment {#cutquerystringandfragment} + +Supprime la chaîne de requête et l’Identificateur de fragment. Le point d’interrogation et le signe numérique sont également supprimés. + +### cutURLParameter (URL, nom) {#cuturlparameterurl-name} + +Supprime le ‘name’ Paramètre URL, si présent. Cette fonction fonctionne en supposant que le nom du paramètre est codé dans L’URL exactement de la même manière que dans l’argument passé. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/fr/sql-reference/functions/uuid-functions.md b/docs/fr/sql-reference/functions/uuid-functions.md new file mode 100644 index 00000000000..80b44a2b1b4 --- /dev/null +++ b/docs/fr/sql-reference/functions/uuid-functions.md @@ -0,0 +1,122 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 53 +toc_title: Travailler avec UUID +--- + +# Fonctions Pour Travailler Avec UUID {#functions-for-working-with-uuid} + +Les fonctions pour travailler avec UUID sont listées ci-dessous. + +## generateUUIDv4 {#uuid-function-generate} + +Génère le [UUID](../../sql-reference/data-types/uuid.md) de [la version 4](https://tools.ietf.org/html/rfc4122#section-4.4). + +``` sql +generateUUIDv4() +``` + +**Valeur renvoyée** + +La valeur de type UUID. + +**Exemple d’utilisation** + +Cet exemple montre la création d’une table avec la colonne de type UUID et l’insertion d’une valeur dans la table. + +``` sql +CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog + +INSERT INTO t_uuid SELECT generateUUIDv4() + +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┐ +│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ +└──────────────────────────────────────┘ +``` + +## toUUID (x) {#touuid-x} + +Convertit la valeur de type de chaîne en type UUID. + +``` sql +toUUID(String) +``` + +**Valeur renvoyée** + +La valeur de type UUID. + +**Exemple d’utilisation** + +``` sql +SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid +``` + +``` text +┌─────────────────────────────────uuid─┐ +│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ +└──────────────────────────────────────┘ +``` + +## UUIDStringToNum {#uuidstringtonum} + +Accepte une chaîne contenant 36 caractères dans le format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, et le renvoie comme un ensemble d’octets dans un [FixedString (16)](../../sql-reference/data-types/fixedstring.md). + +``` sql +UUIDStringToNum(String) +``` + +**Valeur renvoyée** + +FixedString (16) + +**Exemples d’utilisation** + +``` sql +SELECT + '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, + UUIDStringToNum(uuid) AS bytes +``` + +``` text +┌─uuid─────────────────────────────────┬─bytes────────────┐ +│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ +└──────────────────────────────────────┴──────────────────┘ +``` + +## UUIDNumToString {#uuidnumtostring} + +Accepte un [FixedString (16)](../../sql-reference/data-types/fixedstring.md) valeur, et renvoie une chaîne contenant 36 caractères au format texte. + +``` sql +UUIDNumToString(FixedString(16)) +``` + +**Valeur renvoyée** + +Chaîne. + +**Exemple d’utilisation** + +``` sql +SELECT + 'a/<@];!~p{jTj={)' AS bytes, + UUIDNumToString(toFixedString(bytes, 16)) AS uuid +``` + +``` text +┌─bytes────────────┬─uuid─────────────────────────────────┐ +│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ +└──────────────────┴──────────────────────────────────────┘ +``` + +## Voir Aussi {#see-also} + +- [dictGetUUID](ext-dict-functions.md#ext_dict_functions-other) + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/fr/sql-reference/functions/ym-dict-functions.md b/docs/fr/sql-reference/functions/ym-dict-functions.md new file mode 100644 index 00000000000..ef3284b2af6 --- /dev/null +++ b/docs/fr/sql-reference/functions/ym-dict-functions.md @@ -0,0 +1,155 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 59 +toc_title: Travailler avec Yandex.Dictionnaires Metrica +--- + +# Fonctions Pour Travailler Avec Yandex.Dictionnaires Metrica {#functions-for-working-with-yandex-metrica-dictionaries} + +Pour que les fonctions ci-dessous fonctionnent, la configuration du serveur doit spécifier les chemins et les adresses pour obtenir tous les Yandex.Dictionnaires Metrica. Les dictionnaires sont chargés au premier appel de l’une de ces fonctions. Si les listes de référence ne peuvent pas être chargées, une exception est levée. + +Pour plus d’informations sur la création de listes de références, consultez la section “Dictionaries”. + +## Plusieurs Geobases {#multiple-geobases} + +ClickHouse soutient le travail avec plusieurs géobases alternatives (hiérarchies régionales) simultanément, afin de soutenir diverses perspectives sur les pays auxquels appartiennent certaines régions. + +Le ‘clickhouse-server’ config spécifie le fichier avec l’échelon régional::`/opt/geo/regions_hierarchy.txt` + +Outre ce fichier, il recherche également les fichiers à proximité qui ont le symbole \_ et tout suffixe ajouté au nom (avant l’extension de fichier). +Par exemple, il trouvera également le fichier `/opt/geo/regions_hierarchy_ua.txt` si présente. + +`ua` est appelée la clé du dictionnaire. Pour un dictionnaire sans suffixe, la clé est une chaîne vide. + +Tous les dictionnaires sont rechargés dans l’exécution (une fois toutes les secondes, comme défini dans le paramètre de configuration builtin\_dictionaries\_reload\_interval, ou une fois par heure par défaut). Cependant, la liste des dictionnaires disponibles est définie une fois, lorsque le serveur démarre. + +All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. +Exemple: + +``` sql +regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt +``` + +### regionToCity (id \[, geobase\]) {#regiontocityid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. + +### regionToArea (id \[, geobase\]) {#regiontoareaid-geobase} + +Convertit une région en une zone (tapez 5 dans la géobase). Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ +│ │ +│ Moscow and Moscow region │ +│ St. Petersburg and Leningrad region │ +│ Belgorod region │ +│ Ivanovsk region │ +│ Kaluga region │ +│ Kostroma region │ +│ Kursk region │ +│ Lipetsk region │ +│ Orlov region │ +│ Ryazan region │ +│ Smolensk region │ +│ Tambov region │ +│ Tver region │ +│ Tula region │ +└──────────────────────────────────────────────────────┘ +``` + +### regionToDistrict(id \[, geobase\]) {#regiontodistrictid-geobase} + +Convertit une région en district fédéral (type 4 dans la géobase). Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ +│ │ +│ Central federal district │ +│ Northwest federal district │ +│ South federal district │ +│ North Caucases federal district │ +│ Privolga federal district │ +│ Ural federal district │ +│ Siberian federal district │ +│ Far East federal district │ +│ Scotland │ +│ Faroe Islands │ +│ Flemish region │ +│ Brussels capital region │ +│ Wallonia │ +│ Federation of Bosnia and Herzegovina │ +└──────────────────────────────────────────────────────────┘ +``` + +### regionToCountry (id \[, geobase\]) {#regiontocountryid-geobase} + +Convertit une région en un pays. Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. +Exemple: `regionToCountry(toUInt32(213)) = 225` convertit Moscou (213) en Russie (225). + +### regionToContinent(id \[, géobase\]) {#regiontocontinentid-geobase} + +Convertit une région en continent. Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. +Exemple: `regionToContinent(toUInt32(213)) = 10001` convertit Moscou (213) en Eurasie (10001). + +### regionToTopContinent (\#regiontotopcontinent) {#regiontotopcontinent-regiontotopcontinent} + +Trouve le continent le plus élevé dans la hiérarchie de la région. + +**Syntaxe** + +``` sql +regionToTopContinent(id[, geobase]); +``` + +**Paramètre** + +- `id` — Region ID from the Yandex geobase. [UInt32](../../sql-reference/data-types/int-uint.md). +- `geobase` — Dictionary key. See [Plusieurs Geobases](#multiple-geobases). [Chaîne](../../sql-reference/data-types/string.md). Facultatif. + +**Valeur renvoyée** + +- Identifiant du continent de haut niveau (ce dernier lorsque vous grimpez dans la hiérarchie des régions). +- 0, si il n’y a aucun. + +Type: `UInt32`. + +### regionToPopulation (id \[, geobase\]) {#regiontopopulationid-geobase} + +Obtient la population d’une région. +La population peut être enregistrée dans des fichiers avec la géobase. Voir la section “External dictionaries”. +Si la population n’est pas enregistrée pour la région, elle renvoie 0. +Dans la géobase Yandex, la population peut être enregistrée pour les régions enfants, mais pas pour les régions parentes. + +### regionIn(lhs, rhs \[, géobase\]) {#regioninlhs-rhs-geobase} + +Vérifie si un ‘lhs’ région appartient à une ‘rhs’ région. Renvoie un nombre UInt8 égal à 1 s’il appartient, Ou 0 s’il n’appartient pas. +The relationship is reflexive – any region also belongs to itself. + +### regionHierarchy (id \[, geobase\]) {#regionhierarchyid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. +Exemple: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. + +### regionToName(id \[, lang\]) {#regiontonameid-lang} + +Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn’t exist, an empty string is returned. + +`ua` et `uk` les deux signifient ukrainien. + +[Article Original](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/fr/sql-reference/index.md b/docs/fr/sql-reference/index.md new file mode 100644 index 00000000000..daabdd19dbd --- /dev/null +++ b/docs/fr/sql-reference/index.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: SQL Reference +toc_hidden: true +toc_priority: 28 +toc_title: "cach\xE9s" +--- + +# Référence SQL {#sql-reference} + +- [SELECT](statements/select.md) +- [INSERT INTO](statements/insert-into.md) +- [CREATE](statements/create.md) +- [ALTER](statements/alter.md#query_language_queries_alter) +- [Autres types de requêtes](statements/misc.md) + +[Article Original](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/fr/sql-reference/operators.md b/docs/fr/sql-reference/operators.md new file mode 100644 index 00000000000..3aaa1060055 --- /dev/null +++ b/docs/fr/sql-reference/operators.md @@ -0,0 +1,278 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 37 +toc_title: "Op\xE9rateur" +--- + +# Opérateur {#operators} + +Tous les opérateurs sont transformés en leurs fonctions correspondantes à l’étape d’analyse des requêtes en fonction de leur priorité et de leur associativité. +Les groupes d’opérateurs sont listés par ordre de priorité (plus il est élevé dans la liste, plus tôt l’opérateur est connecté à ses arguments). + +## Des Opérateurs D’Accès {#access-operators} + +`a[N]` – Access to an element of an array. The `arrayElement(a, N)` fonction. + +`a.N` – Access to a tuple element. The `tupleElement(a, N)` fonction. + +## Opérateur De Négation Numérique {#numeric-negation-operator} + +`-a` – The `negate (a)` fonction. + +## Opérateurs De Multiplication Et De Division {#multiplication-and-division-operators} + +`a * b` – The `multiply (a, b)` fonction. + +`a / b` – The `divide(a, b)` fonction. + +`a % b` – The `modulo(a, b)` fonction. + +## Opérateurs d’Addition Et De Soustraction {#addition-and-subtraction-operators} + +`a + b` – The `plus(a, b)` fonction. + +`a - b` – The `minus(a, b)` fonction. + +## Opérateurs De Comparaison {#comparison-operators} + +`a = b` – The `equals(a, b)` fonction. + +`a == b` – The `equals(a, b)` fonction. + +`a != b` – The `notEquals(a, b)` fonction. + +`a <> b` – The `notEquals(a, b)` fonction. + +`a <= b` – The `lessOrEquals(a, b)` fonction. + +`a >= b` – The `greaterOrEquals(a, b)` fonction. + +`a < b` – The `less(a, b)` fonction. + +`a > b` – The `greater(a, b)` fonction. + +`a LIKE s` – The `like(a, b)` fonction. + +`a NOT LIKE s` – The `notLike(a, b)` fonction. + +`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. + +`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. + +## Opérateurs Pour Travailler Avec Des Ensembles De Données {#operators-for-working-with-data-sets} + +*Voir [Dans les opérateurs](statements/select.md#select-in-operators).* + +`a IN ...` – The `in(a, b)` fonction. + +`a NOT IN ...` – The `notIn(a, b)` fonction. + +`a GLOBAL IN ...` – The `globalIn(a, b)` fonction. + +`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` fonction. + +## Opérateurs Pour Travailler Avec Des Dates Et Des Heures {#operators-datetime} + +### EXTRACT {#operator-extract} + +``` sql +EXTRACT(part FROM date); +``` + +Extrait une partie d’une date donnée. Par exemple, vous pouvez récupérer un mois à partir d’une date donnée, ou d’une seconde à partir d’un moment. + +Le `part` paramètre spécifie la partie de la date à récupérer. Les valeurs suivantes sont disponibles: + +- `DAY` — The day of the month. Possible values: 1–31. +- `MONTH` — The number of a month. Possible values: 1–12. +- `YEAR` — The year. +- `SECOND` — The second. Possible values: 0–59. +- `MINUTE` — The minute. Possible values: 0–59. +- `HOUR` — The hour. Possible values: 0–23. + +Le `part` le paramètre est insensible à la casse. + +Le `date` paramètre spécifie la date ou l’heure à traiter. Soit [Date](../sql-reference/data-types/date.md) ou [DateTime](../sql-reference/data-types/datetime.md) le type est pris en charge. + +Exemple: + +``` sql +SELECT EXTRACT(DAY FROM toDate('2017-06-15')); +SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); +SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); +``` + +Dans l’exemple suivant, nous créons un tableau et de les insérer dans une valeur avec le `DateTime` type. + +``` sql +CREATE TABLE test.Orders +( + OrderId UInt64, + OrderName String, + OrderDate DateTime +) +ENGINE = Log; +``` + +``` sql +INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); +``` + +``` sql +SELECT + toYear(OrderDate) AS OrderYear, + toMonth(OrderDate) AS OrderMonth, + toDayOfMonth(OrderDate) AS OrderDay, + toHour(OrderDate) AS OrderHour, + toMinute(OrderDate) AS OrderMinute, + toSecond(OrderDate) AS OrderSecond +FROM test.Orders; +``` + +``` text +┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ +│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ +└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ +``` + +Vous pouvez voir plus d’exemples de [test](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). + +### INTERVAL {#operator-interval} + +Crée un [Intervalle](../sql-reference/data-types/special-data-types/interval.md)- valeur de type qui doit être utilisée dans les opérations arithmétiques avec [Date](../sql-reference/data-types/date.md) et [DateTime](../sql-reference/data-types/datetime.md)-type de valeurs. + +Types d’intervalles: +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +!!! warning "Avertissement" + Les intervalles avec différents types ne peuvent pas être combinés. Vous ne pouvez pas utiliser des expressions comme `INTERVAL 4 DAY 1 HOUR`. Exprimer des intervalles en unités plus petites ou égales à la plus petite unité de l’intervalle, par exemple `INTERVAL 25 HOUR`. Vous pouvez utiliser des opérations conséquentes comme dans l’exemple ci-dessous. + +Exemple: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +**Voir Aussi** + +- [Intervalle](../sql-reference/data-types/special-data-types/interval.md) type de données +- [toInterval](../sql-reference/functions/type-conversion-functions.md#function-tointerval) type fonctions de conversion + +## Opérateur De Négation Logique {#logical-negation-operator} + +`NOT a` – The `not(a)` fonction. + +## Logique ET De l’Opérateur {#logical-and-operator} + +`a AND b` – The`and(a, b)` fonction. + +## Logique Ou opérateur {#logical-or-operator} + +`a OR b` – The `or(a, b)` fonction. + +## Opérateur Conditionnel {#conditional-operator} + +`a ? b : c` – The `if(a, b, c)` fonction. + +Note: + +L’opérateur conditionnel calcule les valeurs de b et c, puis vérifie si la condition a est remplie, puis renvoie la valeur correspondante. Si `b` ou `C` est un [arrayJoin()](../sql-reference/functions/array-join.md#functions_arrayjoin) fonction, chaque ligne sera répliquée indépendamment de la “a” condition. + +## Expression Conditionnelle {#operator_case} + +``` sql +CASE [x] + WHEN a THEN b + [WHEN ... THEN ...] + [ELSE c] +END +``` + +Si `x` est spécifié, alors `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. + +Si il n’y a pas de `ELSE c` dans l’expression, la valeur par défaut est `NULL`. + +Le `transform` la fonction ne fonctionne pas avec `NULL`. + +## Opérateur De Concaténation {#concatenation-operator} + +`s1 || s2` – The `concat(s1, s2) function.` + +## Opérateur De Création Lambda {#lambda-creation-operator} + +`x -> expr` – The `lambda(x, expr) function.` + +Les opérateurs suivants n’ont pas de priorité, puisqu’ils sont des parenthèses: + +## Opérateur De Création De Tableau {#array-creation-operator} + +`[x1, ...]` – The `array(x1, ...) function.` + +## Opérateur De Création De Tuple {#tuple-creation-operator} + +`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` + +## Associativité {#associativity} + +Tous les opérateurs binaires ont associativité gauche. Exemple, `1 + 2 + 3` est transformé à `plus(plus(1, 2), 3)`. +Parfois, cela ne fonctionne pas de la façon que vous attendez. Exemple, `SELECT 4 > 2 > 3` résultat sera 0. + +Pour l’efficacité, le `and` et `or` les fonctions acceptent n’importe quel nombre d’arguments. Les chaînes de `AND` et `OR` les opérateurs sont transformés en un seul appel de ces fonctions. + +## La Vérification De `NULL` {#checking-for-null} + +Clickhouse soutient le `IS NULL` et `IS NOT NULL` opérateur. + +### IS NULL {#operator-is-null} + +- Pour [Nullable](../sql-reference/data-types/nullable.md) type de valeurs, l’ `IS NULL` opérateur retourne: + - `1` si la valeur est `NULL`. + - `0` autrement. +- Pour les autres valeurs, la `IS NULL` l’opérateur renvoie toujours `0`. + + + +``` sql +SELECT x+100 FROM t_null WHERE y IS NULL +``` + +``` text +┌─plus(x, 100)─┐ +│ 101 │ +└──────────────┘ +``` + +### IS NOT NULL {#is-not-null} + +- Pour [Nullable](../sql-reference/data-types/nullable.md) type de valeurs, l’ `IS NOT NULL` opérateur retourne: + - `0` si la valeur est `NULL`. + - `1` autrement. +- Pour les autres valeurs, la `IS NOT NULL` l’opérateur renvoie toujours `1`. + + + +``` sql +SELECT * FROM t_null WHERE y IS NOT NULL +``` + +``` text +┌─x─┬─y─┐ +│ 2 │ 3 │ +└───┴───┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/fr/sql-reference/statements/alter.md b/docs/fr/sql-reference/statements/alter.md new file mode 100644 index 00000000000..63121fe86d2 --- /dev/null +++ b/docs/fr/sql-reference/statements/alter.md @@ -0,0 +1,505 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 36 +toc_title: ALTER +--- + +## ALTER {#query_language_queries_alter} + +Le `ALTER` la requête est prise en charge uniquement pour `*MergeTree` des tables, ainsi que `Merge`et`Distributed`. La requête a plusieurs variantes. + +### Manipulations De Colonne {#column-manipulations} + +Modification de la structure de la table. + +``` sql +ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... +``` + +Dans la requête, spécifiez une liste d’une ou plusieurs actions séparées par des virgules. +Chaque action est une opération sur une colonne. + +Les actions suivantes sont prises en charge: + +- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. +- [DROP COLUMN](#alter_drop-column) — Deletes the column. +- [CLEAR COLUMN](#alter_clear-column) — Resets column values. +- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. +- [MODIFY COLUMN](#alter_modify-column) — Changes column’s type, default expression and TTL. + +Ces actions sont décrites en détail ci-dessous. + +#### ADD COLUMN {#alter_add-column} + +``` sql +ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] +``` + +Ajoute une nouvelle colonne à la table spécifiée `name`, `type`, [`codec`](create.md#codecs) et `default_expr` (voir la section [Expressions par défaut](create.md#create-default-values)). + +Si l’ `IF NOT EXISTS` la clause est incluse, la requête ne retournera pas d’erreur si la colonne existe déjà. Si vous spécifiez `AFTER name_after` (le nom d’une autre colonne), la colonne est ajoutée après celle spécifiée dans la liste des colonnes de la table. Sinon, la colonne est ajoutée à la fin de la table. Notez qu’il n’existe aucun moyen d’ajouter une colonne au début d’un tableau. Pour une chaîne d’actions, `name_after` peut être le nom d’une colonne est ajoutée dans l’une des actions précédentes. + +L’ajout d’une colonne modifie simplement la structure de la table, sans effectuer d’actions avec des données. Les données n’apparaissent pas sur le disque après la `ALTER`. Si les données sont manquantes pour une colonne lors de la lecture de la table, elles sont remplies avec des valeurs par défaut (en exécutant l’expression par défaut s’il y en a une, ou en utilisant des zéros ou des chaînes vides). La colonne apparaît sur le disque après la fusion des parties de données (voir [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)). + +Cette approche nous permet de compléter le `ALTER` requête instantanément, sans augmenter le volume de données anciennes. + +Exemple: + +``` sql +ALTER TABLE visits ADD COLUMN browser String AFTER user_id +``` + +#### DROP COLUMN {#alter_drop-column} + +``` sql +DROP COLUMN [IF EXISTS] name +``` + +Supprime la colonne avec le nom `name`. Si l’ `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d’erreur si la colonne n’existe pas. + +Supprime les données du système de fichiers. Comme cela supprime des fichiers entiers, la requête est terminée presque instantanément. + +Exemple: + +``` sql +ALTER TABLE visits DROP COLUMN browser +``` + +#### CLEAR COLUMN {#alter_clear-column} + +``` sql +CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name +``` + +Réinitialise toutes les données dans une colonne pour une partition spécifiée. En savoir plus sur la définition du nom de la partition dans la section [Comment spécifier l’expression de partition](#alter-how-to-specify-part-expr). + +Si l’ `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d’erreur si la colonne n’existe pas. + +Exemple: + +``` sql +ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() +``` + +#### COMMENT COLUMN {#alter_comment-column} + +``` sql +COMMENT COLUMN [IF EXISTS] name 'comment' +``` + +Ajoute un commentaire à la colonne. Si l’ `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d’erreur si la colonne n’existe pas. + +Chaque colonne peut avoir un commentaire. Si un commentaire existe déjà pour la colonne, un nouveau commentaire remplace le précédent commentaire. + +Les commentaires sont stockés dans le `comment_expression` colonne renvoyée par le [DESCRIBE TABLE](misc.md#misc-describe-table) requête. + +Exemple: + +``` sql +ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' +``` + +#### MODIFY COLUMN {#alter_modify-column} + +``` sql +MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] +``` + +Cette requête modifie le `name` les propriétés de la colonne: + +- Type + +- Expression par défaut + +- TTL + + For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). + +Si l’ `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d’erreur si la colonne n’existe pas. + +Lors de la modification du type, les valeurs sont converties comme si [toType](../../sql-reference/functions/type-conversion-functions.md) les fonctions ont été appliquées. Si seule l’expression par défaut est modifiée, la requête ne fait rien de complexe et est terminée presque instantanément. + +Exemple: + +``` sql +ALTER TABLE visits MODIFY COLUMN browser Array(String) +``` + +Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. + +Il y a plusieurs étapes de traitement: + +- Préparation de (nouveaux) fichiers temporaires avec des données modifiées. +- Renommer les anciens fichiers. +- Renommer les (nouveaux) fichiers temporaires en anciens noms. +- Suppression des anciens fichiers. + +Seule la première étape prend du temps. Si il y a un échec à ce stade, les données ne sont pas modifiées. +En cas d’échec au cours d’une des étapes successives, les données peuvent être restaurées manuellement. L’exception est si les anciens fichiers ont été supprimés du système de fichiers mais que les données des nouveaux fichiers n’ont pas été écrites sur le disque et ont été perdues. + +Le `ALTER` la requête de modification des colonnes est répliquée. Les instructions sont enregistrées dans ZooKeeper, puis chaque réplique les applique. Tout `ALTER` les requêtes sont exécutées dans le même ordre. La requête attend que les actions appropriées soient terminées sur les autres répliques. Cependant, une requête pour modifier des colonnes dans une table répliquée peut être interrompue, et toutes les actions seront effectuées de manière asynchrone. + +#### Modifier Les Limites De La requête {#alter-query-limitations} + +Le `ALTER` query vous permet de créer et de supprimer des éléments distincts (colonnes) dans des structures de données imbriquées, mais pas des structures de données imbriquées entières. Pour ajouter une structure de données imbriquée, vous pouvez ajouter des colonnes avec un nom comme `name.nested_name` et le type `Array(T)`. Une structure de données imbriquée est équivalente à plusieurs colonnes de tableau avec un nom qui a le même préfixe avant le point. + +Il n’y a pas de support pour supprimer des colonnes dans la clé primaire ou la clé d’échantillonnage (colonnes qui sont utilisées dans le `ENGINE` expression). La modification du type des colonnes incluses dans la clé primaire n’est possible que si cette modification n’entraîne pas la modification des données (par exemple, vous êtes autorisé à ajouter des valeurs à une énumération ou à modifier un type de `DateTime` de `UInt32`). + +Si l’ `ALTER` la requête n’est pas suffisante pour apporter les modifications de table dont vous avez besoin, vous pouvez créer une nouvelle table, y copier les données en utilisant le [INSERT SELECT](insert-into.md#insert_query_insert-select) requête, puis changer les tables en utilisant le [RENAME](misc.md#misc_operations-rename) requête et supprimer l’ancienne table. Vous pouvez utiliser l’ [clickhouse-copieur](../../operations/utilities/clickhouse-copier.md) comme une alternative à la `INSERT SELECT` requête. + +Le `ALTER` query bloque toutes les lectures et écritures pour la table. En d’autres termes, si une longue `SELECT` est en cours d’exécution au moment de la `ALTER` requête, la `ALTER` la requête va attendre qu’elle se termine. Dans le même temps, toutes les nouvelles requêtes à la même table attendre que ce `ALTER` est en cours d’exécution. + +Pour les tables qui ne stockent pas les données elles-mêmes (telles que `Merge` et `Distributed`), `ALTER` change simplement la structure de la table, et ne change pas la structure des tables subordonnées. Par exemple, lors de L’exécution de ALTER pour un `Distributed` table, vous devrez également exécuter `ALTER` pour les tables sur tous les serveurs distants. + +### Manipulations Avec Des Expressions Clés {#manipulations-with-key-expressions} + +La commande suivante est prise en charge: + +``` sql +MODIFY ORDER BY new_expression +``` + +Cela ne fonctionne que pour les tables du [`MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) de la famille (y compris les +[répliqué](../../engines/table-engines/mergetree-family/replication.md) table). La commande change l’ +[clé de tri](../../engines/table-engines/mergetree-family/mergetree.md) de la table +de `new_expression` (une expression ou un tuple d’expressions). Clé primaire reste le même. + +La commande est légère en ce sens qu’elle ne modifie que les métadonnées. Pour conserver la propriété cette partie de données +les lignes sont ordonnées par l’expression de clé de tri vous ne pouvez pas ajouter d’expressions contenant des colonnes existantes +à la clé de tri (seules les colonnes ajoutées par `ADD COLUMN` commande dans le même `ALTER` requête). + +### Manipulations Avec Des Indices De Saut De Données {#manipulations-with-data-skipping-indices} + +Cela ne fonctionne que pour les tables du [`*MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) de la famille (y compris les +[répliqué](../../engines/table-engines/mergetree-family/replication.md) table). Les opérations suivantes +sont disponibles: + +- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - Ajoute la description de l’index aux métadonnées des tables. + +- `ALTER TABLE [db].name DROP INDEX name` - Supprime la description de l’index des métadonnées des tables et supprime les fichiers d’index du disque. + +Ces commandes sont légères dans le sens où elles ne modifient que les métadonnées ou suppriment des fichiers. +En outre, ils sont répliqués (synchronisation des métadonnées des indices via ZooKeeper). + +### Manipulations Avec Contraintes {#manipulations-with-constraints} + +En voir plus sur [contraintes](create.md#constraints) + +Les contraintes peuvent être ajoutées ou supprimées à l’aide de la syntaxe suivante: + +``` sql +ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; +ALTER TABLE [db].name DROP CONSTRAINT constraint_name; +``` + +Les requêtes ajouteront ou supprimeront des métadonnées sur les contraintes de la table afin qu’elles soient traitées immédiatement. + +Contrainte de vérifier *ne sera pas exécuté* sur les données existantes si elle a été ajoutée. + +Toutes les modifications sur les tables répliquées sont diffusées sur ZooKeeper et seront donc appliquées sur d’autres répliques. + +### Manipulations Avec Des Partitions Et Des pièces {#alter_manipulations-with-partitions} + +Les opérations suivantes avec [partition](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) sont disponibles: + +- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` répertoire et de l’oublier. +- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. +- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` répertoire à la table. +- [REPLACE PARTITION](#alter_replace-partition) - Copie la partition de données d’une table à l’autre. +- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. +- [REPLACE PARTITION](#alter_replace-partition) - Copie la partition de données d’une table à l’autre et la remplace. +- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - déplace la partition de données d’une table à l’autre. +- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - Rétablit la valeur d’une colonne spécifiée dans une partition. +- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - Réinitialise l’index secondaire spécifié dans une partition. +- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. +- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. +- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. + + + +#### Détacher La PARTITION {\#alter\_detach-partition} {#detach-partition-alter-detach-partition} + +``` sql +ALTER TABLE table_name DETACH PARTITION partition_expr +``` + +Déplace toutes les données de la partition spécifiée vers `detached` répertoire. Le serveur oublie la partition de données détachée comme si elle n’existait pas. Le serveur ne connaîtra pas ces données tant que vous n’aurez pas [ATTACH](#alter_attach-partition) requête. + +Exemple: + +``` sql +ALTER TABLE visits DETACH PARTITION 201901 +``` + +Lisez à propos de la définition de l’expression de partition dans une section [Comment spécifier l’expression de partition](#alter-how-to-specify-part-expr). + +Une fois la requête exécutée, vous pouvez faire ce que vous voulez avec les données du `detached` directory — delete it from the file system, or just leave it. + +This query is replicated – it moves the data to the `detached` répertoire sur toutes les répliques. Notez que vous ne pouvez exécuter cette requête que sur un réplica leader. Pour savoir si une réplique est un leader, effectuez le `SELECT` requête à l’ [système.réplique](../../operations/system-tables.md#system_tables-replicas) table. Alternativement, il est plus facile de faire une `DETACH` requête sur toutes les répliques - toutes les répliques lancent une exception, à l’exception de la réplique leader. + +#### DROP PARTITION {#alter_drop-partition} + +``` sql +ALTER TABLE table_name DROP PARTITION partition_expr +``` + +Supprime la partition spécifiée de la table. Cette requête marque la partition comme inactive et supprime complètement les données, environ en 10 minutes. + +Lisez à propos de la définition de l’expression de partition dans une section [Comment spécifier l’expression de partition](#alter-how-to-specify-part-expr). + +The query is replicated – it deletes data on all replicas. + +#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} + +``` sql +ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr +``` + +Supprime la partie spécifiée ou toutes les parties de la partition spécifiée de `detached`. +En savoir plus sur la définition de l’expression de partition dans une section [Comment spécifier l’expression de partition](#alter-how-to-specify-part-expr). + +#### ATTACH PARTITION\|PART {#alter_attach-partition} + +``` sql +ALTER TABLE table_name ATTACH PARTITION|PART partition_expr +``` + +Ajoute des données à la table à partir du `detached` répertoire. Il est possible d’ajouter des données dans une partition entière ou pour une partie distincte. Exemple: + +``` sql +ALTER TABLE visits ATTACH PARTITION 201901; +ALTER TABLE visits ATTACH PART 201901_2_2_0; +``` + +En savoir plus sur la définition de l’expression de partition dans une section [Comment spécifier l’expression de partition](#alter-how-to-specify-part-expr). + +Cette requête est répliquée. L’initiateur de réplica vérifie s’il y a des données dans le `detached` répertoire. Si des données existent, la requête vérifie son intégrité. Si tout est correct, la requête ajoute les données à la table. Tous les autres réplicas téléchargent les données de l’initiateur de réplica. + +Ainsi, vous pouvez mettre des données à la `detached` répertoire sur une réplique, et utilisez le `ALTER ... ATTACH` requête pour l’ajouter à la table sur tous les réplicas. + +#### ATTACH PARTITION FROM {#alter_attach-partition-from} + +``` sql +ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 +``` + +Cette requête copie la partition de données du `table1` de `table2` ajoute des données de gratuit dans la `table2`. Notez que les données ne seront pas supprimées de `table1`. + +Pour que la requête s’exécute correctement, les conditions suivantes doivent être remplies: + +- Les deux tables doivent avoir la même structure. +- Les deux tables doivent avoir la même clé de partition. + +#### REPLACE PARTITION {#alter_replace-partition} + +``` sql +ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 +``` + +Cette requête copie la partition de données du `table1` de `table2` et remplace la partition existante dans le `table2`. Notez que les données ne seront pas supprimées de `table1`. + +Pour que la requête s’exécute correctement, les conditions suivantes doivent être remplies: + +- Les deux tables doivent avoir la même structure. +- Les deux tables doivent avoir la même clé de partition. + +#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} + +``` sql +ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest +``` + +Cette requête déplace la partition de données du `table_source` de `table_dest` avec la suppression des données de `table_source`. + +Pour que la requête s’exécute correctement, les conditions suivantes doivent être remplies: + +- Les deux tables doivent avoir la même structure. +- Les deux tables doivent avoir la même clé de partition. +- Les deux tables doivent appartenir à la même famille de moteurs. (répliqué ou non répliqué) +- Les deux tables doivent avoir la même stratégie de stockage. + +#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} + +``` sql +ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr +``` + +Réinitialise toutes les valeurs de la colonne spécifiée dans une partition. Si l’ `DEFAULT` la clause a été déterminée lors de la création d’une table, cette requête définit la valeur de la colonne à une valeur par défaut spécifiée. + +Exemple: + +``` sql +ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 +``` + +#### FREEZE PARTITION {#alter_freeze-partition} + +``` sql +ALTER TABLE table_name FREEZE [PARTITION partition_expr] +``` + +Cette requête crée une sauvegarde locale d’une partition spécifiée. Si l’ `PARTITION` la clause est omise, la requête crée la sauvegarde de toutes les partitions à la fois. + +!!! note "Note" + L’ensemble du processus de sauvegarde est effectuée sans arrêter le serveur. + +Notez que pour les tables de style ancien, vous pouvez spécifier le préfixe du nom de la partition (par exemple, ‘2019’)- ensuite, la requête crée la sauvegarde pour toutes les partitions correspondantes. Lisez à propos de la définition de l’expression de partition dans une section [Comment spécifier l’expression de partition](#alter-how-to-specify-part-expr). + +Au moment de l’exécution, pour un instantané de données, la requête crée des liens rigides vers des données de table. Les liens sont placés dans le répertoire `/var/lib/clickhouse/shadow/N/...`, où: + +- `/var/lib/clickhouse/` est le répertoire de travail clickhouse spécifié dans la configuration. +- `N` est le numéro incrémental de la sauvegarde. + +!!! note "Note" + Si vous utilisez [un ensemble de disques pour le stockage des données dans une table](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes), le `shadow/N` le répertoire apparaît sur chaque disque, stockant les parties de données correspondant `PARTITION` expression. + +La même structure de répertoires est créée à l’intérieur de la sauvegarde qu’à l’intérieur `/var/lib/clickhouse/`. La requête effectue ‘chmod’ pour tous les fichiers, interdisant d’écrire en eux. + +Après avoir créé la sauvegarde, vous pouvez copier les données depuis `/var/lib/clickhouse/shadow/` sur le serveur distant, puis supprimez-le du serveur local. Notez que l’ `ALTER t FREEZE PARTITION` la requête n’est pas répliqué. Il crée une sauvegarde locale uniquement sur le serveur local. + +La requête crée une sauvegarde presque instantanément (mais elle attend d’abord que les requêtes en cours à la table correspondante se terminent). + +`ALTER TABLE t FREEZE PARTITION` copie uniquement les données, pas les métadonnées de la table. Faire une sauvegarde des métadonnées de la table, copiez le fichier `/var/lib/clickhouse/metadata/database/table.sql` + +Pour restaurer des données à partir d’une sauvegarde, procédez comme suit: + +1. Créer la table si elle n’existe pas. Pour afficher la requête, utilisez la .fichier sql (remplacer `ATTACH` avec `CREATE`). +2. Copier les données de la `data/database/table/` répertoire à l’intérieur de la sauvegarde `/var/lib/clickhouse/data/database/table/detached/` répertoire. +3. Exécuter `ALTER TABLE t ATTACH PARTITION` les requêtes pour ajouter les données à une table. + +La restauration à partir d’une sauvegarde ne nécessite pas l’arrêt du serveur. + +Pour plus d’informations sur les sauvegardes et la restauration [La Sauvegarde Des Données](../../operations/backup.md) section. + +#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} + +``` sql +ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr +``` + +La requête fonctionne de manière similaire à `CLEAR COLUMN` mais il remet un index au lieu d’une colonne de données. + +#### FETCH PARTITION {#alter_fetch-partition} + +``` sql +ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' +``` + +Télécharge une partition depuis un autre serveur. Cette requête ne fonctionne que pour les tables répliquées. + +La requête effectue les opérations suivantes: + +1. Télécharge la partition à partir du fragment spécifié. Dans ‘path-in-zookeeper’ vous devez spécifier un chemin vers le fragment dans ZooKeeper. +2. Ensuite, la requête met les données téléchargées dans le `detached` répertoire de la `table_name` table. L’utilisation de la [ATTACH PARTITION\|PART](#alter_attach-partition) requête pour ajouter les données à la table. + +Exemple: + +``` sql +ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; +ALTER TABLE users ATTACH PARTITION 201902; +``` + +Notez que: + +- Le `ALTER ... FETCH PARTITION` la requête n’est pas répliqué. Il place la partition à la `detached` répertoire sur le serveur local. +- Le `ALTER TABLE ... ATTACH` la requête est répliquée. Il ajoute les données à toutes les répliques. Les données sont ajoutées à l’une des répliques `detached` répertoire, et aux autres-des répliques voisines. + +Avant le téléchargement, le système vérifie si la partition existe et si la structure de la table correspond. La réplique la plus appropriée est sélectionnée automatiquement parmi les répliques saines. + +Bien que la requête soit appelée `ALTER TABLE`, il ne modifie pas la structure de la table et ne modifie pas immédiatement les données disponibles dans la table. + +#### MOVE PARTITION\|PART {#alter_move-partition} + +Déplace des partitions ou des parties de données vers un autre volume ou disque pour `MergeTree`-tables de moteur. Voir [Utilisation de plusieurs périphériques de bloc pour le stockage de données](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes). + +``` sql +ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' +``` + +Le `ALTER TABLE t MOVE` requête: + +- Non répliqué, car différentes répliques peuvent avoir des stratégies de stockage différentes. +- Renvoie une erreur si le disque ou le volume n’est pas configuré. Query renvoie également une erreur si les conditions de déplacement des données, spécifiées dans la stratégie de stockage, ne peuvent pas être appliquées. +- Peut renvoyer une erreur dans le cas, lorsque les données à déplacer sont déjà déplacées par un processus en arrière-plan, simultané `ALTER TABLE t MOVE` requête ou à la suite de la fusion de données d’arrière-plan. Un utilisateur ne doit effectuer aucune action supplémentaire dans ce cas. + +Exemple: + +``` sql +ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' +ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' +``` + +#### Comment Définir L’Expression De La Partition {#alter-how-to-specify-part-expr} + +Vous pouvez spécifier l’expression de partition dans `ALTER ... PARTITION` requêtes de différentes manières: + +- Comme une valeur de l’ `partition` la colonne de la `system.parts` table. Exemple, `ALTER TABLE visits DETACH PARTITION 201901`. +- Comme expression de la colonne de la table. Les constantes et les expressions constantes sont prises en charge. Exemple, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. +- À l’aide de l’ID de partition. Partition ID est un identifiant de chaîne de la partition (lisible par l’homme, si possible) qui est utilisé comme noms de partitions dans le système de fichiers et dans ZooKeeper. L’ID de partition doit être spécifié dans `PARTITION ID` clause, entre guillemets simples. Exemple, `ALTER TABLE visits DETACH PARTITION ID '201901'`. +- Dans le [ALTER ATTACH PART](#alter_attach-partition) et [DROP DETACHED PART](#alter_drop-detached) requête, pour spécifier le nom d’une partie, utilisez le littéral de chaîne avec une valeur de `name` la colonne de la [système.detached\_parts](../../operations/system-tables.md#system_tables-detached_parts) table. Exemple, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. + +L’utilisation de guillemets lors de la spécification de la partition dépend du type d’expression de partition. Par exemple, pour la `String` type, vous devez spécifier son nom entre guillemets (`'`). Pour l’ `Date` et `Int*` types aucune citation n’est nécessaire. + +Pour les tables de style ancien, vous pouvez spécifier la partition sous forme de nombre `201901` ou une chaîne de caractères `'201901'`. La syntaxe des tables new-style est plus stricte avec les types (similaire à l’analyseur pour le format D’entrée des valeurs). + +Toutes les règles ci-dessus sont aussi valables pour la [OPTIMIZE](misc.md#misc_operations-optimize) requête. Si vous devez spécifier la seule partition lors de l’optimisation d’une table non partitionnée, définissez l’expression `PARTITION tuple()`. Exemple: + +``` sql +OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; +``` + +Les exemples de `ALTER ... PARTITION` les requêtes sont démontrées dans les tests [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) et [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). + +### Manipulations Avec Table TTL {#manipulations-with-table-ttl} + +Vous pouvez modifier [tableau TTL](../../engines/table-engines/mergetree-family/mergetree.md#mergetree-table-ttl) avec une demande du formulaire suivant: + +``` sql +ALTER TABLE table-name MODIFY TTL ttl-expression +``` + +### Synchronicité Des requêtes ALTER {#synchronicity-of-alter-queries} + +Pour les tables non réplicables, tous `ALTER` les requêtes sont exécutées simultanément. Pour les tables réplicables, la requête ajoute simplement des instructions pour les actions appropriées à `ZooKeeper` et les actions elles-mêmes sont effectuées dès que possible. Cependant, la requête peut attendre que ces actions soient terminées sur tous les réplicas. + +Pour `ALTER ... ATTACH|DETACH|DROP` les requêtes, vous pouvez utiliser le `replication_alter_partitions_sync` configuration pour configurer l’attente. +Valeurs possibles: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. + +### Mutation {#alter-mutations} + +Les Mutations sont une variante ALTER query qui permet de modifier ou de supprimer des lignes dans une table. Contrairement à la norme `UPDATE` et `DELETE` les requêtes qui sont destinées aux changements de données de point, les mutations sont destinées aux opérations lourdes qui modifient beaucoup de lignes dans une table. Pris en charge pour le `MergeTree` famille de moteurs de table, y compris les moteurs avec support de réplication. + +Les tables existantes sont prêtes pour les mutations telles quelles (aucune conversion nécessaire), mais après l’application de la première mutation à une table, son format de métadonnées devient incompatible avec les versions précédentes du serveur et il devient impossible de revenir à une version précédente. + +Commandes actuellement disponibles: + +``` sql +ALTER TABLE [db.]table DELETE WHERE filter_expr +``` + +Le `filter_expr` doit être de type `UInt8`. La requête supprime les lignes de la table pour lesquelles cette expression prend une valeur différente de zéro. + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr +``` + +Le `filter_expr` doit être de type `UInt8`. Cette requête met à jour les valeurs des colonnes spécifiées en les valeurs des expressions correspondantes dans les lignes pour lesquelles `filter_expr` prend une valeur non nulle. Les valeurs sont converties en type de colonne à l’aide `CAST` opérateur. La mise à jour des colonnes utilisées dans le calcul de la clé primaire ou de la clé de partition n’est pas prise en charge. + +``` sql +ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name +``` + +La requête reconstruit l’index secondaire `name` dans la partition `partition_name`. + +Une requête peut contenir plusieurs commandes séparées par des virgules. + +Pour les tables \* MergeTree, les mutations s’exécutent en réécrivant des parties de données entières. Il n’y a pas d’atomicité-les pièces sont substituées aux pièces mutées dès qu’elles sont prêtes et un `SELECT` la requête qui a commencé à s’exécuter pendant une mutation verra les données des parties qui ont déjà été mutées ainsi que les données des parties qui n’ont pas encore été mutées. + +Les Mutations sont totalement ordonnées par leur ordre de création et sont appliquées à chaque partie dans cet ordre. Les Mutations sont également partiellement ordonnées avec des insertions - les données insérées dans la table avant la soumission de la mutation seront mutées et les données insérées après ne seront pas mutées. Notez que les mutations ne bloquent en aucune façon les INSERTs. + +Une requête de mutation retourne immédiatement après l’ajout de l’entrée de mutation (dans le cas de tables répliquées à ZooKeeper, pour les tables non compliquées - au système de fichiers). La mutation elle-même s’exécute de manière asynchrone en utilisant les paramètres du profil système. Pour suivre l’avancement des mutations vous pouvez utiliser la [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) table. Une mutation qui a été soumise avec succès continuera à s’exécuter même si les serveurs ClickHouse sont redémarrés. Il n’y a aucun moyen de faire reculer la mutation une fois qu’elle est soumise, mais si la mutation est bloquée pour une raison quelconque, elle peut être annulée avec le [`KILL MUTATION`](misc.md#kill-mutation) requête. + +Les entrées pour les mutations finies ne sont pas supprimées immédiatement (le nombre d’entrées conservées est déterminé par `finished_mutations_to_keep` le moteur de stockage de paramètre). Les anciennes entrées de mutation sont supprimées. + +[Article Original](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/fr/sql-reference/statements/create.md b/docs/fr/sql-reference/statements/create.md new file mode 100644 index 00000000000..451acafe759 --- /dev/null +++ b/docs/fr/sql-reference/statements/create.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 35 +toc_title: CREATE +--- + +# Créer Des requêtes {#create-queries} + +## CREATE DATABASE {#query-language-create-database} + +Crée la base de données. + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] +``` + +### Clause {#clauses} + +- `IF NOT EXISTS` + + If the `db_name` database already exists, then ClickHouse doesn't create a new database and: + + - Doesn't throw an exception if clause is specified. + - Throws an exception if clause isn't specified. + +- `ON CLUSTER` + + ClickHouse creates the `db_name` database on all the servers of a specified cluster. + +- `ENGINE` + + - [MySQL](../engines/database_engines/mysql.md) + + Allows you to retrieve data from the remote MySQL server. + + By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). + +## CREATE TABLE {#create-table-query} + +Le `CREATE TABLE` la requête peut avoir plusieurs formes. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], + ... +) ENGINE = engine +``` + +Crée une table nommée ‘name’ dans le ‘db’ base de données ou la base de données actuelle si ‘db’ n’est pas définie, avec la structure spécifiée entre parenthèses et l’ ‘engine’ moteur. +La structure de la table est une liste de descriptions de colonnes. Si les index sont pris en charge par le moteur, ils sont indiqués comme paramètres pour le moteur de table. + +Une description de colonne est `name type` dans le cas le plus simple. Exemple: `RegionID UInt32`. +Des Expressions peuvent également être définies pour les valeurs par défaut (voir ci-dessous). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] +``` + +Crée une table avec la même structure qu’une autre table. Vous pouvez spécifier un moteur différent pour la table. Si le moteur n’est pas spécifié, le même moteur sera utilisé que pour la `db2.name2` table. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() +``` + +Crée une table avec la structure et les données renvoyées par [fonction de table](../table-functions/index.md). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... +``` + +Crée une table avec une structure comme le résultat de l’ `SELECT` une requête avec les ‘engine’ moteur, et le remplit avec des données de SELECT. + +Dans tous les cas, si `IF NOT EXISTS` est spécifié, la requête ne renvoie pas une erreur si la table existe déjà. Dans ce cas, la requête ne font rien. + +Il peut y avoir d’autres clauses après le `ENGINE` la clause dans la requête. Voir la documentation détaillée sur la façon de créer des tables dans les descriptions de [moteurs de table](../../engines/table-engines/index.md#table_engines). + +### Les Valeurs Par Défaut {#create-default-values} + +La description de colonne peut spécifier une expression pour une valeur par défaut, de l’une des manières suivantes:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. +Exemple: `URLDomain String DEFAULT domain(URL)`. + +Si une expression pour la valeur par défaut n’est pas définie, les valeurs par défaut seront définies sur zéros pour les nombres, chaînes vides pour les chaînes, tableaux vides pour les tableaux et `0000-00-00` pour les dates ou `0000-00-00 00:00:00` pour les dates avec le temps. Les valeurs NULL ne sont pas prises en charge. + +Si l’expression par défaut est définie, le type de colonne est facultatif. S’il n’y a pas de type explicitement défini, le type d’expression par défaut est utilisé. Exemple: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ type sera utilisé pour la ‘EventDate’ colonne. + +Si le type de données et l’expression par défaut sont définis explicitement, cette expression sera convertie au type spécifié à l’aide des fonctions de conversion de type. Exemple: `Hits UInt32 DEFAULT 0` signifie la même chose que `Hits UInt32 DEFAULT toUInt32(0)`. + +Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don’t contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. + +`DEFAULT expr` + +Valeur par défaut normale. Si la requête INSERT ne spécifie pas la colonne correspondante, elle sera remplie en calculant l’expression correspondante. + +`MATERIALIZED expr` + +Expression matérialisée. Une telle colonne ne peut pas être spécifiée pour INSERT, car elle est toujours calculée. +Pour un INSERT sans Liste de colonnes, ces colonnes ne sont pas prises en compte. +De plus, cette colonne n’est pas substituée lors de l’utilisation d’un astérisque dans une requête SELECT. C’est pour préserver l’invariant que le dump obtenu en utilisant `SELECT *` peut être inséré dans la table en utilisant INSERT sans spécifier la liste des colonnes. + +`ALIAS expr` + +Synonyme. Une telle colonne n’est pas du tout stockée dans la table. +Ses valeurs ne peuvent pas être insérées dans une table et elles ne sont pas substituées lors de l’utilisation d’un astérisque dans une requête SELECT. +Il peut être utilisé dans SELECTs si l’alias est développé pendant l’analyse des requêtes. + +Lorsque vous utilisez la requête ALTER pour ajouter de nouvelles colonnes, les anciennes données de ces colonnes ne sont pas écrites. Au lieu de cela, lors de la lecture d’anciennes données qui n’ont pas de valeurs pour les nouvelles colonnes, les expressions sont calculées à la volée par défaut. Cependant, si l’exécution des expressions nécessite différentes colonnes qui ne sont pas indiquées dans la requête, ces colonnes seront en outre lues, mais uniquement pour les blocs de données qui en ont besoin. + +Si vous ajoutez une nouvelle colonne à une table mais modifiez ultérieurement son expression par défaut, les valeurs utilisées pour les anciennes données changeront (pour les données où les valeurs n’ont pas été stockées sur le disque). Notez que lors de l’exécution de fusions d’arrière-plan, les données des colonnes manquantes dans l’une des parties de fusion sont écrites dans la partie fusionnée. + +Il n’est pas possible de définir des valeurs par défaut pour les éléments dans les structures de données. + +### Contraintes {#constraints} + +Avec les descriptions de colonnes des contraintes peuvent être définies: + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + ... + CONSTRAINT constraint_name_1 CHECK boolean_expr_1, + ... +) ENGINE = engine +``` + +`boolean_expr_1` pourrait par n’importe quelle expression booléenne. Si les contraintes sont définies pour la table, chacun d’eux sera vérifiée pour chaque ligne `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. + +L’ajout d’une grande quantité de contraintes peut affecter négativement les performances de big `INSERT` requête. + +### Expression TTL {#ttl-expression} + +Définit la durée de stockage des valeurs. Peut être spécifié uniquement pour les tables mergetree-family. Pour la description détaillée, voir [TTL pour les colonnes et les tableaux](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). + +### Codecs De Compression De Colonne {#codecs} + +Par défaut, ClickHouse applique le `lz4` méthode de compression. Pour `MergeTree`- famille de moteurs Vous pouvez modifier la méthode de compression par défaut dans le [compression](../../operations/server-configuration-parameters/settings.md#server-settings-compression) section d’une configuration de serveur. Vous pouvez également définir la méthode de compression pour chaque colonne `CREATE TABLE` requête. + +``` sql +CREATE TABLE codec_example +( + dt Date CODEC(ZSTD), + ts DateTime CODEC(LZ4HC), + float_value Float32 CODEC(NONE), + double_value Float64 CODEC(LZ4HC(9)) + value Float32 CODEC(Delta, ZSTD) +) +ENGINE = +... +``` + +Si un codec est spécifié, le codec par défaut ne s’applique pas. Les Codecs peuvent être combinés dans un pipeline, par exemple, `CODEC(Delta, ZSTD)`. Pour sélectionner la meilleure combinaison de codecs pour votre projet, passez des benchmarks similaires à ceux décrits dans Altinity [Nouveaux encodages pour améliorer L’efficacité du ClickHouse](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) article. + +!!! warning "Avertissement" + Vous ne pouvez pas décompresser les fichiers de base de données ClickHouse avec des utilitaires externes tels que `lz4`. Au lieu de cela, utilisez le spécial [clickhouse-compresseur](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) utilitaire. + +La Compression est prise en charge pour les moteurs de tableau suivants: + +- [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) famille. Prend en charge les codecs de compression de colonne et la sélection de la méthode de compression par défaut par [compression](../../operations/server-configuration-parameters/settings.md#server-settings-compression) paramètre. +- [Journal](../../engines/table-engines/log-family/log-family.md) famille. Utilise la `lz4` méthode de compression par défaut et prend en charge les codecs de compression de colonne. +- [Définir](../../engines/table-engines/special/set.md). Uniquement pris en charge la compression par défaut. +- [Rejoindre](../../engines/table-engines/special/join.md). Uniquement pris en charge la compression par défaut. + +ClickHouse prend en charge les codecs à usage commun et les codecs spécialisés. + +#### Codecs Spécialisés {#create-query-specialized-codecs} + +Ces codecs sont conçus pour rendre la compression plus efficace en utilisant des fonctionnalités spécifiques des données. Certains de ces codecs ne compressent pas les données eux-mêmes. Au lieu de cela, ils préparent les données pour un codec à usage commun, qui les compresse mieux que sans cette préparation. + +Spécialisé codecs: + +- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` sont utilisés pour stocker des valeurs delta, donc `delta_bytes` est la taille maximale des valeurs brutes. Possible `delta_bytes` valeurs: 1, 2, 4, 8. La valeur par défaut pour `delta_bytes` être `sizeof(type)` si égale à 1, 2, 4 ou 8. Dans tous les autres cas, c’est 1. +- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla: Une Base De Données De Séries Chronologiques Rapide, Évolutive Et En Mémoire](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla: Une Base De Données De Séries Chronologiques Rapide, Évolutive Et En Mémoire](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` et `DateTime`). À chaque étape de son algorithme, le codec prend un bloc de 64 valeurs, les place dans une matrice de 64x64 bits, le transpose, recadre les bits de valeurs inutilisés et renvoie le reste sous forme de séquence. Les bits inutilisés sont les bits, qui ne diffèrent pas entre les valeurs maximum et minimum dans la partie de données entière pour laquelle la compression est utilisée. + +`DoubleDelta` et `Gorilla` les codecs sont utilisés dans Gorilla TSDB comme composants de son algorithme de compression. L’approche Gorilla est efficace dans les scénarios où il y a une séquence de valeurs qui changent lentement avec leurs horodatages. Les horodatages sont effectivement compressés par le `DoubleDelta` codec, et les valeurs sont effectivement comprimé par le `Gorilla` codec. Par exemple, pour obtenir une table stockée efficacement, vous pouvez la créer dans la configuration suivante: + +``` sql +CREATE TABLE codec_example +( + timestamp DateTime CODEC(DoubleDelta), + slow_values Float32 CODEC(Gorilla) +) +ENGINE = MergeTree() +``` + +#### Codecs À Usage Commun {#create-query-common-purpose-codecs} + +Codec: + +- `NONE` — No compression. +- `LZ4` — Lossless [algorithme de compression de données](https://github.com/lz4/lz4) utilisé par défaut. Applique la compression rapide LZ4. +- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` s’applique le niveau par défaut. Niveaux possibles: \[1, 12\]. Plage de niveau recommandée: \[4, 9\]. +- `ZSTD[(level)]` — [Algorithme de compression ZSTD](https://en.wikipedia.org/wiki/Zstandard) avec configurables `level`. Niveaux possibles: \[1, 22\]. Valeur par défaut: 1. + +Des niveaux de compression élevés sont utiles pour les scénarios asymétriques, comme compresser une fois, décompresser à plusieurs reprises. Des niveaux plus élevés signifient une meilleure compression et une utilisation plus élevée du processeur. + +## Les Tables Temporaires {#temporary-tables} + +Clickhouse prend en charge les tables temporaires qui ont les caractéristiques suivantes: + +- Les tables temporaires disparaissent à la fin de la session, y compris si la connexion est perdue. +- Une table temporaire utilise uniquement le moteur de mémoire. +- La base de données ne peut pas être spécifiée pour une table temporaire. Il est créé en dehors des bases de données. +- Impossible de créer une table temporaire avec une requête DDL distribuée sur tous les serveurs de cluster (en utilisant `ON CLUSTER`): ce tableau n’existe que dans la session en cours. +- Si une table temporaire a le même nom qu’une autre et qu’une requête spécifie le nom de la table sans spécifier la base de données, la table temporaire sera utilisée. +- Pour le traitement des requêtes distribuées, les tables temporaires utilisées dans une requête sont transmises à des serveurs distants. + +Pour créer une table temporaire, utilisez la syntaxe suivante: + +``` sql +CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) +``` + +Dans la plupart des cas, les tables temporaires ne sont pas créées manuellement, mais lors de l’utilisation de données externes pour une requête ou pour `(GLOBAL) IN`. Pour plus d’informations, consultez les sections appropriées + +Il est possible d’utiliser des tables avec [Moteur = mémoire](../../engines/table-engines/special/memory.md) au lieu de tables temporaires. + +## Requêtes DDL distribuées (sur La Clause CLUSTER) {#distributed-ddl-queries-on-cluster-clause} + +Le `CREATE`, `DROP`, `ALTER`, et `RENAME` les requêtes prennent en charge l’exécution distribuée sur un cluster. +Par exemple, la requête suivante crée la `all_hits` `Distributed` tableau sur chaque ordinateur hôte `cluster`: + +``` sql +CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) +``` + +Pour exécuter ces requêtes correctement, chaque hôte doit avoir la même définition de cluster (pour simplifier la synchronisation des configs, vous pouvez utiliser des substitutions de ZooKeeper). Ils doivent également se connecter aux serveurs ZooKeeper. +La version locale de la requête sera finalement implémentée sur chaque hôte du cluster, même si certains hôtes ne sont actuellement pas disponibles. L’ordre d’exécution des requêtes au sein d’un seul hôte est garanti. + +## CREATE VIEW {#create-view} + +``` sql +CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... +``` + +Crée une vue. Il existe deux types de vues: normale et matérialisée. + +Les vues normales ne stockent aucune donnée, mais effectuent simplement une lecture à partir d’une autre table. En d’autres termes, une vue normale n’est rien de plus qu’une requête enregistrée. Lors de la lecture à partir d’une vue, cette requête enregistrée est utilisée comme sous-requête dans la clause FROM. + +Par exemple, supposons que vous avez créé une vue: + +``` sql +CREATE VIEW view AS SELECT ... +``` + +et écrit une requête: + +``` sql +SELECT a, b, c FROM view +``` + +Cette requête est entièrement équivalente à l’utilisation de la sous requête: + +``` sql +SELECT a, b, c FROM (SELECT ...) +``` + +Les vues matérialisées stockent les données transformées par la requête SELECT correspondante. + +Lors de la création d’une vue matérialisée sans `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. + +Lors de la création d’une vue matérialisée avec `TO [db].[table]` vous ne devez pas utiliser `POPULATE`. + +Une vue matérialisée est agencée comme suit: lors de l’insertion de données dans la table spécifiée dans SELECT, une partie des données insérées est convertie par cette requête SELECT, et le résultat est inséré dans la vue. + +Si vous spécifiez POPULATE, les données de table existantes sont insérées dans la vue lors de sa création, comme si `CREATE TABLE ... AS SELECT ...` . Sinon, la requête ne contient que les données insérées dans la table après la création de la vue. Nous ne recommandons pas D’utiliser POPULATE, car les données insérées dans la table lors de la création de la vue ne seront pas insérées dedans. + +A `SELECT` la requête peut contenir `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` est définie, les données sont agrégées lors de l’insertion, mais uniquement dans un seul paquet de données insérées. Les données ne seront pas agrégées davantage. L’exception concerne l’utilisation d’un moteur qui effectue indépendamment l’agrégation de données, par exemple `SummingMergeTree`. + +L’exécution de `ALTER` les requêtes sur les vues matérialisées n’ont pas été complètement développées, elles pourraient donc être gênantes. Si la vue matérialisée utilise la construction `TO [db.]name` vous pouvez `DETACH` la vue, exécutez `ALTER` pour la table cible, puis `ATTACH` précédemment détaché (`DETACH`) vue. + +Les vues ressemblent aux tables normales. Par exemple, ils sont répertoriés dans le résultat de la `SHOW TABLES` requête. + +Il n’y a pas de requête séparée pour supprimer des vues. Pour supprimer une vue, utilisez `DROP TABLE`. + +## CREATE DICTIONARY {#create-dictionary-query} + +``` sql +CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] +( + key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + attr1 type2 [DEFAULT|EXPRESSION expr3], + attr2 type2 [DEFAULT|EXPRESSION expr4] +) +PRIMARY KEY key1, key2 +SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) +LAYOUT(LAYOUT_NAME([param_name param_value])) +LIFETIME([MIN val1] MAX val2) +``` + +Crée [externe dictionnaire](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) avec le [structure](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md), [source](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md), [disposition](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) et [vie](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md). + +Structure de dictionnaire externe se compose d’attributs. Les attributs du dictionnaire sont spécifiés de la même manière que les colonnes du tableau. La seule propriété d’attribut requise est son type, toutes les autres propriétés peuvent avoir des valeurs par défaut. + +Selon le dictionnaire [disposition](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) un ou plusieurs attributs peuvent être spécifiés comme les clés de dictionnaire. + +Pour plus d’informations, voir [Dictionnaires Externes](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) section. + +[Article Original](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/fr/sql_reference/statements/index.md b/docs/fr/sql-reference/statements/index.md similarity index 100% rename from docs/fr/sql_reference/statements/index.md rename to docs/fr/sql-reference/statements/index.md diff --git a/docs/fr/sql-reference/statements/insert-into.md b/docs/fr/sql-reference/statements/insert-into.md new file mode 100644 index 00000000000..99e80bfb796 --- /dev/null +++ b/docs/fr/sql-reference/statements/insert-into.md @@ -0,0 +1,80 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 34 +toc_title: INSERT INTO +--- + +## INSERT {#insert} + +L’ajout de données. + +Format de requête de base: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... +``` + +La requête peut spécifier une liste de colonnes à insérer `[(c1, c2, c3)]`. Dans ce cas, le reste des colonnes sont remplis avec: + +- Les valeurs calculées à partir `DEFAULT` expressions spécifiées dans la définition de la table. +- Zéros et chaînes vides, si `DEFAULT` les expressions ne sont pas définies. + +Si [strict\_insert\_defaults=1](../../operations/settings/settings.md), les colonnes qui n’ont pas `DEFAULT` défini doit être répertorié dans la requête. + +Les données peuvent être transmises à L’INSERT dans n’importe quel [format](../../interfaces/formats.md#formats) soutenu par ClickHouse. Le format doit être spécifié explicitement dans la requête: + +``` sql +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: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... +``` + +ClickHouse supprime tous les espaces et un saut de ligne (s’il y en a un) avant les données. Lors de la formation d’une requête, nous recommandons de placer les données sur une nouvelle ligne après les opérateurs de requête (ceci est important si les données commencent par des espaces). + +Exemple: + +``` sql +INSERT INTO t FORMAT TabSeparated +11 Hello, world! +22 Qwerty +``` + +Vous pouvez insérer des données séparément de la requête à l’aide du client de ligne de commande ou de L’interface HTTP. Pour plus d’informations, consultez la section “[Interface](../../interfaces/index.md#interfaces)”. + +### Contraintes {#constraints} + +Si la table a [contraintes](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. + +### Insertion Des Résultats De `SELECT` {#insert_query_insert-select} + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... +``` + +Les colonnes sont mappées en fonction de leur position dans la clause SELECT. Cependant, leurs noms dans L’expression SELECT et la table pour INSERT peuvent différer. Si nécessaire, la coulée de type est effectuée. + +Aucun des formats de données à l’exception des Valeurs permettent de définir des valeurs d’expressions telles que `now()`, `1 + 2` et ainsi de suite. Le format des valeurs permet une utilisation limitée des expressions, mais ce n’est pas recommandé, car dans ce cas, un code inefficace est utilisé pour leur exécution. + +Les autres requêtes de modification des parties de données ne sont pas prises en charge: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. +Cependant, vous pouvez supprimer les anciennes données en utilisant `ALTER TABLE ... DROP PARTITION`. + +`FORMAT` la clause doit être spécifié à la fin de la requête si `SELECT` la clause contient la fonction de table [entrée()](../table-functions/input.md). + +### Considérations De Performance {#performance-considerations} + +`INSERT` trie les données d’entrée par la clé primaire et les divise en partitions par une clé de partition. Si vous insérez des données dans plusieurs partitions à la fois, cela peut réduire considérablement les performances de l’ `INSERT` requête. Pour éviter cela: + +- Ajoutez des données en lots assez importants, tels que 100 000 lignes à la fois. +- Groupez les données par une clé de partition avant de les télécharger sur ClickHouse. + +Les performances ne diminueront pas si: + +- Les données sont ajoutées en temps réel. +- Vous téléchargez des données qui sont généralement triées par heure. + +[Article Original](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/fr/sql-reference/statements/misc.md b/docs/fr/sql-reference/statements/misc.md new file mode 100644 index 00000000000..a25b61705e9 --- /dev/null +++ b/docs/fr/sql-reference/statements/misc.md @@ -0,0 +1,252 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 39 +toc_title: Autre +--- + +# Diverses Requêtes {#miscellaneous-queries} + +## ATTACH {#attach} + +Cette requête est exactement la même que `CREATE`, mais + +- Au lieu de la parole `CREATE` il utilise le mot `ATTACH`. +- La requête ne crée pas de données sur le disque, mais suppose que les données sont déjà aux endroits appropriés, et ajoute simplement des informations sur la table au serveur. + Après avoir exécuté une requête ATTACH, le serveur connaîtra l’existence de la table. + +Si la table a été précédemment détachée (`DETACH`), ce qui signifie que sa structure est connue, vous pouvez utiliser un raccourci sans définir la structure. + +``` sql +ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Cette requête est utilisée lors du démarrage du serveur. Le serveur stocke les métadonnées de la table sous forme de fichiers avec `ATTACH` requêtes, qu’il exécute simplement au lancement (à l’exception des tables système, qui sont explicitement créées sur le serveur). + +## CHECK TABLE {#check-table} + +Vérifie si les données de la table sont corrompues. + +``` sql +CHECK TABLE [db.]name +``` + +Le `CHECK TABLE` requête compare réelle des tailles de fichier avec les valeurs attendues qui sont stockés sur le serveur. Si le fichier tailles ne correspondent pas aux valeurs stockées, cela signifie que les données sont endommagées. Cela peut être causé, par exemple, par un plantage du système lors de l’exécution de la requête. + +La réponse de la requête contient `result` colonne avec une seule ligne. La ligne a une valeur de +[Booléen](../../sql-reference/data-types/boolean.md) type: + +- 0 - les données de la table sont corrompues. +- 1 - les données maintiennent l’intégrité. + +Le `CHECK TABLE` query prend en charge les moteurs de table suivants: + +- [Journal](../../engines/table-engines/log-family/log.md) +- [TinyLog](../../engines/table-engines/log-family/tinylog.md) +- [StripeLog](../../engines/table-engines/log-family/stripelog.md) +- [Famille MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) + +Effectué sur les tables avec un autre moteur de table provoque une exception. + +Les moteurs de la `*Log` la famille ne fournit pas de récupération automatique des données en cas d’échec. L’utilisation de la `CHECK TABLE` requête pour suivre la perte de données en temps opportun. + +Pour `MergeTree` moteurs de la famille, le `CHECK TABLE` query affiche un État de vérification pour chaque partie de données individuelle d’une table sur le serveur local. + +**Si les données sont corrompues** + +Si la table est corrompue, vous pouvez copier les données non corrompues dans une autre table. Pour ce faire: + +1. Créez une nouvelle table avec la même structure que la table endommagée. Pour ce faire exécutez la requête `CREATE TABLE AS `. +2. Définir le [max\_threads](../../operations/settings/settings.md#settings-max_threads) la valeur 1 pour traiter la requête suivante dans un seul thread. Pour ce faire, exécutez la requête `SET max_threads = 1`. +3. Exécuter la requête `INSERT INTO SELECT * FROM `. Cette demande copie les données non corrompues de la table endommagée vers une autre table. Seules les données avant la partie corrompue seront copiées. +4. Redémarrez l’ `clickhouse-client` pour réinitialiser l’ `max_threads` valeur. + +## DESCRIBE TABLE {#misc-describe-table} + +``` sql +DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Renvoie ce qui suit `String` les colonnes de type: + +- `name` — Column name. +- `type`— Column type. +- `default_type` — Clause that is used in [expression par défaut](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` ou `ALIAS`). Column contient une chaîne vide, si l’expression par défaut n’est pas spécifiée. +- `default_expression` — Value specified in the `DEFAULT` clause. +- `comment_expression` — Comment text. + +Les structures de données imbriquées sont sorties dans “expanded” format. Chaque colonne est affichée séparément, avec le nom après un point. + +## DETACH {#detach} + +Supprime les informations sur le ‘name’ table du serveur. Le serveur cesse de connaître l’existence de la table. + +``` sql +DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Cela ne supprime pas les données ou les métadonnées de la table. Lors du prochain lancement du serveur, le serveur Lira les métadonnées et découvrira à nouveau la table. +De même, un “detached” tableau peut être re-attaché en utilisant le `ATTACH` requête (à l’exception des tables système, qui n’ont pas de stocker les métadonnées pour eux). + +Il n’y a pas de `DETACH DATABASE` requête. + +## DROP {#drop} + +Cette requête a deux types: `DROP DATABASE` et `DROP TABLE`. + +``` sql +DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] +``` + +Supprime toutes les tables à l’intérieur de la ‘db’ la base de données, puis supprime le ‘db’ la base de données elle-même. +Si `IF EXISTS` est spécifié, il ne renvoie pas d’erreur si la base de données n’existe pas. + +``` sql +DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Supprime la table. +Si `IF EXISTS` est spécifié, il ne renvoie pas d’erreur si la table n’existe pas ou si la base de données n’existe pas. + + DROP DICTIONARY [IF EXISTS] [db.]name + +Delets le dictionnaire. +Si `IF EXISTS` est spécifié, il ne renvoie pas d’erreur si la table n’existe pas ou si la base de données n’existe pas. + +## EXISTS {#exists} + +``` sql +EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] +``` + +Renvoie un seul `UInt8`- type colonne, qui contient la valeur unique `0` si la table ou base de données n’existe pas, ou `1` si la table existe dans la base de données spécifiée. + +## KILL QUERY {#kill-query} + +``` sql +KILL QUERY [ON CLUSTER cluster] + WHERE + [SYNC|ASYNC|TEST] + [FORMAT format] +``` + +Tente de mettre fin de force aux requêtes en cours d’exécution. +Les requêtes à terminer sont sélectionnées dans le système.processus en utilisant les critères définis dans le `WHERE` la clause de la `KILL` requête. + +Exemple: + +``` sql +-- Forcibly terminates all queries with the specified query_id: +KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' + +-- Synchronously terminates all queries run by 'username': +KILL QUERY WHERE user='username' SYNC +``` + +Les utilisateurs en lecture seule peuvent uniquement arrêter leurs propres requêtes. + +Par défaut, la version asynchrone des requêtes est utilisé (`ASYNC`), qui n’attend pas la confirmation que les requêtes se sont arrêtées. + +La version synchrone (`SYNC`) attend que toutes les requêtes d’arrêter et affiche des informations sur chaque processus s’arrête. +La réponse contient l’ `kill_status` la colonne, qui peut prendre les valeurs suivantes: + +1. ‘finished’ – The query was terminated successfully. +2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. +3. The other values ​​explain why the query can’t be stopped. + +Une requête de test (`TEST`) vérifie uniquement les droits de l’utilisateur et affiche une liste de requêtes à arrêter. + +## KILL MUTATION {#kill-mutation} + +``` sql +KILL MUTATION [ON CLUSTER cluster] + WHERE + [TEST] + [FORMAT format] +``` + +Essaie d’annuler et supprimer [mutation](alter.md#alter-mutations) actuellement en cours d’exécution. Les Mutations à annuler sont sélectionnées parmi [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) tableau à l’aide du filtre spécifié par le `WHERE` la clause de la `KILL` requête. + +Une requête de test (`TEST`) vérifie uniquement les droits de l’utilisateur et affiche une liste de requêtes à arrêter. + +Exemple: + +``` sql +-- Cancel and remove all mutations of the single table: +KILL MUTATION WHERE database = 'default' AND table = 'table' + +-- Cancel the specific mutation: +KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' +``` + +The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). + +Les modifications déjà apportées par la mutation ne sont pas annulées. + +## OPTIMIZE {#misc_operations-optimize} + +``` sql +OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] +``` + +Cette requête tente d’initialiser une fusion non programmée de parties de données pour les tables avec un moteur de [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) famille. + +Le `OPTMIZE` la requête est également prise en charge pour [MaterializedView](../../engines/table-engines/special/materializedview.md) et la [Tampon](../../engines/table-engines/special/buffer.md) moteur. Les autres moteurs de table ne sont pas pris en charge. + +Lorsque `OPTIMIZE` est utilisé avec le [ReplicatedMergeTree](../../engines/table-engines/mergetree-family/replication.md) famille de moteurs de table, ClickHouse crée une tâche pour la fusion et attend l’exécution sur tous les nœuds (si le `replication_alter_partitions_sync` paramètre est activé). + +- Si `OPTIMIZE` n’effectue pas de fusion pour une raison quelconque, il ne notifie pas le client. Pour activer les notifications, utilisez [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) paramètre. +- Si vous spécifiez un `PARTITION`, seule la partition spécifiée est optimisé. [Comment définir l’expression de la partition](alter.md#alter-how-to-specify-part-expr). +- Si vous spécifiez `FINAL`, l’optimisation est effectuée, même lorsque toutes les données sont déjà dans une partie. +- Si vous spécifiez `DEDUPLICATE`, alors des lignes complètement identiques seront dédupliquées (toutes les colonnes sont comparées), cela n’a de sens que pour le moteur MergeTree. + +!!! warning "Avertissement" + `OPTIMIZE` ne peut pas réparer le “Too many parts” erreur. + +## RENAME {#misc_operations-rename} + +Renomme une ou plusieurs tables. + +``` sql +RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] +``` + +Toutes les tables sont renommées sous verrouillage global. Renommer des tables est une opération légère. Si vous avez indiqué une autre base de données après TO, la table sera déplacée vers cette base de données. Cependant, les répertoires contenant des bases de données doivent résider dans le même système de fichiers (sinon, une erreur est renvoyée). + +## SET {#query-set} + +``` sql +SET param = value +``` + +Assigner `value` à l’ `param` [paramètre](../../operations/settings/index.md) pour la session en cours. Vous ne pouvez pas modifier [les paramètres du serveur](../../operations/server-configuration-parameters/index.md) de cette façon. + +Vous pouvez également définir toutes les valeurs de certains paramètres de profil dans une seule requête. + +``` sql +SET profile = 'profile-name-from-the-settings-file' +``` + +Pour plus d’informations, voir [Paramètre](../../operations/settings/settings.md). + +## TRUNCATE {#truncate} + +``` sql +TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Supprime toutes les données d’une table. Lorsque la clause `IF EXISTS` est omis, la requête renvoie une erreur si la table n’existe pas. + +Le `TRUNCATE` la requête n’est pas prise en charge pour [Vue](../../engines/table-engines/special/view.md), [Fichier](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md) et [NULL](../../engines/table-engines/special/null.md) table des moteurs. + +## USE {#use} + +``` sql +USE db +``` + +Vous permet de définir la base de données actuelle pour la session. +La base de données actuelle est utilisée pour rechercher des tables si la base de données n’est pas explicitement définie dans la requête avec un point avant le nom de la table. +Cette requête ne peut pas être faite lors de l’utilisation du protocole HTTP, car il n’y a pas de concept de session. + +[Article Original](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/fr/sql-reference/statements/select.md b/docs/fr/sql-reference/statements/select.md new file mode 100644 index 00000000000..6eac762028a --- /dev/null +++ b/docs/fr/sql-reference/statements/select.md @@ -0,0 +1,610 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 33 +toc_title: SELECT +--- + +# Sélectionnez La Syntaxe Des requêtes {#select-queries-syntax} + +`SELECT` effectue la récupération des données. + +``` sql +[WITH expr_list|(subquery)] +SELECT [DISTINCT] expr_list +[FROM [db.]table | (subquery) | table_function] [FINAL] +[SAMPLE sample_coeff] +[ARRAY JOIN ...] +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list +[PREWHERE expr] +[WHERE expr] +[GROUP BY expr_list] [WITH TOTALS] +[HAVING expr] +[ORDER BY expr_list] +[LIMIT [offset_value, ]n BY columns] +[LIMIT [n, ]m] +[UNION ALL ...] +[INTO OUTFILE filename] +[FORMAT format] +``` + +Toutes les clauses sont facultatives, à l’exception de la liste d’expressions requise immédiatement après SELECT. +Les clauses ci-dessous sont décrites dans presque le même ordre que dans l’exécution de la requête convoyeur. + +Si la requête omet le `DISTINCT`, `GROUP BY` et `ORDER BY` les clauses et les `IN` et `JOIN` sous-requêtes, la requête sera complètement traitée en flux, en utilisant O (1) quantité de RAM. +Sinon, la requête peut consommer beaucoup de RAM si les restrictions appropriées ne sont pas spécifiées: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Pour plus d’informations, consultez la section “Settings”. Il est possible d’utiliser le tri externe (sauvegarde des tables temporaires sur un disque) et l’agrégation externe. `The system does not have "merge join"`. + +### AVEC La Clause {#with-clause} + +Cette section prend en charge les Expressions de Table courantes ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), avec quelques limitations: +1. Les requêtes récursives ne sont pas prises en charge +2. Lorsque la sous-requête est utilisée à l’intérieur avec section, son résultat doit être scalaire avec exactement une ligne +3. Les résultats d’Expression ne sont pas disponibles dans les sous requêtes +Les résultats des expressions de clause WITH peuvent être utilisés dans la clause SELECT. + +Exemple 1: Utilisation d’une expression constante comme “variable” + +``` sql +WITH '2019-08-01 15:23:00' as ts_upper_bound +SELECT * +FROM hits +WHERE + EventDate = toDate(ts_upper_bound) AND + EventTime <= ts_upper_bound +``` + +Exemple 2: Expulsion de la somme(octets) résultat de l’expression de clause SELECT de la liste de colonnes + +``` sql +WITH sum(bytes) as s +SELECT + formatReadableSize(s), + table +FROM system.parts +GROUP BY table +ORDER BY s +``` + +Exemple 3: Utilisation des résultats de la sous-requête scalaire + +``` sql +/* this example would return TOP 10 of most huge tables */ +WITH + ( + SELECT sum(bytes) + FROM system.parts + WHERE active + ) AS total_disk_usage +SELECT + (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, + table +FROM system.parts +GROUP BY table +ORDER BY table_disk_usage DESC +LIMIT 10 +``` + +Exemple 4: réutilisation de l’expression dans la sous-requête +Comme solution de contournement pour la limitation actuelle de l’utilisation de l’expression dans les sous-requêtes, Vous pouvez la dupliquer. + +``` sql +WITH ['hello'] AS hello +SELECT + hello, + * +FROM +( + WITH ['hello'] AS hello + SELECT hello +) +``` + +``` text +┌─hello─────┬─hello─────┐ +│ ['hello'] │ ['hello'] │ +└───────────┴───────────┘ +``` + +### De La Clause {#select-from} + +Si la clause FROM est omise, les données seront lues à partir `system.one` table. +Le `system.one` table contient exactement une ligne (cette table remplit le même but que la table double trouvée dans d’autres SGBD). + +Le `FROM` clause spécifie la source à partir de laquelle lire les données: + +- Table +- Sous-requête +- [Fonction de Table](../table-functions/index.md) + +`ARRAY JOIN` et le régulier `JOIN` peuvent également être inclus (voir ci-dessous). + +Au lieu d’une table, l’ `SELECT` sous-requête peut être spécifiée entre parenthèses. +Contrairement à SQL standard, un synonyme n’a pas besoin d’être spécifié après une sous-requête. + +Pour exécuter une requête, toutes les colonnes mentionnées dans la requête sont extraites de la table appropriée. Toutes les colonnes non nécessaires pour la requête externe sont rejetées des sous-requêtes. +Si une requête ne répertorie aucune colonne (par exemple, `SELECT count() FROM t`), une colonne est extraite de la table de toute façon (la plus petite est préférée), afin de calculer le nombre de lignes. + +#### Modificateur FINAL {#select-from-final} + +Applicable lors de la sélection de données à partir de tables [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-famille de moteurs autres que `GraphiteMergeTree`. Lorsque `FINAL` est spécifié, ClickHouse fusionne complètement les données avant de renvoyer le résultat et effectue ainsi toutes les transformations de données qui se produisent lors des fusions pour le moteur de table donné. + +Également pris en charge pour: +- [Répliqué](../../engines/table-engines/mergetree-family/replication.md) les versions de `MergeTree` moteur. +- [Vue](../../engines/table-engines/special/view.md), [Tampon](../../engines/table-engines/special/buffer.md), [Distribué](../../engines/table-engines/special/distributed.md), et [MaterializedView](../../engines/table-engines/special/materializedview.md) moteurs qui fonctionnent sur d’autres moteurs, à condition qu’ils aient été créés sur `MergeTree`-tables de moteur. + +Requêtes qui utilisent `FINAL` sont exécutés pas aussi vite que les requêtes similaires qui ne le font pas, car: + +- La requête est exécutée dans un seul thread et les données sont fusionnées lors de l’exécution de la requête. +- Les requêtes avec `FINAL` lire les colonnes de clé primaire en plus des colonnes spécifiées dans la requête. + +Dans la plupart des cas, évitez d’utiliser `FINAL`. + +### Exemple De Clause {#select-sample-clause} + +Le `SAMPLE` la clause permet un traitement de requête approximatif. + +Lorsque l’échantillonnage de données est activé, la requête n’est pas effectuée sur toutes les données, mais uniquement sur une certaine fraction de données (échantillon). Par exemple, si vous avez besoin de calculer des statistiques pour toutes les visites, il suffit d’exécuter la requête sur le 1/10 de la fraction de toutes les visites, puis multiplier le résultat par 10. + +Le traitement approximatif des requêtes peut être utile dans les cas suivants: + +- Lorsque vous avez des exigences de synchronisation strictes (comme \<100ms), mais que vous ne pouvez pas justifier le coût des ressources matérielles supplémentaires pour y répondre. +- Lorsque vos données brutes ne sont pas précises, l’approximation ne dégrade pas sensiblement la qualité. +- Les exigences commerciales ciblent des résultats approximatifs (pour la rentabilité, ou afin de commercialiser des résultats exacts aux utilisateurs premium). + +!!! note "Note" + Vous ne pouvez utiliser l’échantillonnage qu’avec les tables [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) famille, et seulement si l’expression d’échantillonnage a été spécifiée lors de la création de la table (voir [Moteur MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table)). + +Les caractéristiques de l’échantillonnage des données sont énumérées ci-dessous: + +- L’échantillonnage de données est un mécanisme déterministe. Le résultat de la même `SELECT .. SAMPLE` la requête est toujours le même. +- L’échantillonnage fonctionne de manière cohérente pour différentes tables. Pour les tables avec une seule clé d’échantillonnage, un échantillon avec le même coefficient sélectionne toujours le même sous-ensemble de données possibles. Par exemple, un exemple d’ID utilisateur prend des lignes avec le même sous-ensemble de tous les ID utilisateur possibles de différentes tables. Cela signifie que vous pouvez utiliser l’exemple dans les sous-requêtes dans la [IN](#select-in-operators) clause. En outre, vous pouvez joindre des échantillons en utilisant le [JOIN](#select-join) clause. +- L’échantillonnage permet de lire moins de données à partir d’un disque. Notez que vous devez spécifier l’échantillonnage clé correctement. Pour plus d’informations, voir [Création d’une Table MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). + +Pour l’ `SAMPLE` clause la syntaxe suivante est prise en charge: + +| SAMPLE Clause Syntax | Description | +|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `SAMPLE k` | Ici `k` est le nombre de 0 à 1.
La requête est exécutée sur `k` fraction des données. Exemple, `SAMPLE 0.1` exécute la requête sur 10% des données. [Lire plus](#select-sample-k) | +| `SAMPLE n` | Ici `n` est un entier suffisamment grand.
La requête est exécutée sur un échantillon d’au moins `n` lignes (mais pas significativement plus que cela). Exemple, `SAMPLE 10000000` exécute la requête sur un minimum de 10 000 000 lignes. [Lire plus](#select-sample-n) | +| `SAMPLE k OFFSET m` | Ici `k` et `m` sont les nombres de 0 à 1.
La requête est exécutée sur un échantillon de `k` fraction des données. Les données utilisées pour l’échantillon est compensée par `m` fraction. [Lire plus](#select-sample-offset) | + +#### SAMPLE K {#select-sample-k} + +Ici `k` est le nombre de 0 à 1 (les notations fractionnaires et décimales sont prises en charge). Exemple, `SAMPLE 1/2` ou `SAMPLE 0.5`. + +Dans un `SAMPLE k` clause, l’échantillon est prélevé à partir de la `k` fraction des données. L’exemple est illustré ci-dessous: + +``` sql +SELECT + Title, + count() * 10 AS PageViews +FROM hits_distributed +SAMPLE 0.1 +WHERE + CounterID = 34 +GROUP BY Title +ORDER BY PageViews DESC LIMIT 1000 +``` + +Dans cet exemple, la requête est exécutée sur un échantillon de 0,1 (10%) de données. Les valeurs des fonctions d’agrégat ne sont pas corrigées automatiquement, donc pour obtenir un résultat approximatif, la valeur `count()` est multiplié manuellement par 10. + +#### SAMPLE N {#select-sample-n} + +Ici `n` est un entier suffisamment grand. Exemple, `SAMPLE 10000000`. + +Dans ce cas, la requête est exécutée sur un échantillon d’au moins `n` lignes (mais pas significativement plus que cela). Exemple, `SAMPLE 10000000` exécute la requête sur un minimum de 10 000 000 lignes. + +Puisque l’unité minimale pour la lecture des données est un granule (sa taille est définie par le `index_granularity` de réglage), il est logique de définir un échantillon beaucoup plus grand que la taille du granule. + +Lors de l’utilisation de la `SAMPLE n` clause, vous ne savez pas quel pourcentage relatif de données a été traité. Donc, vous ne connaissez pas le coefficient par lequel les fonctions agrégées doivent être multipliées. L’utilisation de la `_sample_factor` colonne virtuelle pour obtenir le résultat approximatif. + +Le `_sample_factor` colonne contient des coefficients relatifs qui sont calculés dynamiquement. Cette colonne est créée automatiquement lorsque vous [créer](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table) une table avec la clé d’échantillonnage spécifiée. Les exemples d’utilisation de la `_sample_factor` colonne sont indiqués ci-dessous. + +Considérons la table `visits` qui contient des statistiques sur les visites de site. Le premier exemple montre comment calculer le nombre de pages vues: + +``` sql +SELECT sum(PageViews * _sample_factor) +FROM visits +SAMPLE 10000000 +``` + +L’exemple suivant montre comment calculer le nombre total de visites: + +``` sql +SELECT sum(_sample_factor) +FROM visits +SAMPLE 10000000 +``` + +L’exemple ci-dessous montre comment calculer la durée moyenne de la session. Notez que vous n’avez pas besoin d’utiliser le coefficient relatif pour calculer les valeurs moyennes. + +``` sql +SELECT avg(Duration) +FROM visits +SAMPLE 10000000 +``` + +#### SAMPLE K OFFSET M {#select-sample-offset} + +Ici `k` et `m` sont des nombres de 0 à 1. Des exemples sont présentés ci-dessous. + +**Exemple 1** + +``` sql +SAMPLE 1/10 +``` + +Dans cet exemple, l’échantillon représente 1 / 10e de toutes les données: + +`[++------------]` + +**Exemple 2** + +``` sql +SAMPLE 1/10 OFFSET 1/2 +``` + +Ici, un échantillon de 10% est prélevé à partir de la seconde moitié des données. + +`[------++------]` + +### Clause De Jointure De Tableau {#select-array-join-clause} + +Permet l’exécution de `JOIN` avec un tableau ou une structure de données imbriquée. L’intention est similaire à la [arrayJoin](../../sql-reference/functions/array-join.md#functions_arrayjoin) la fonction, mais sa fonctionnalité est plus large. + +``` sql +SELECT +FROM +[LEFT] ARRAY JOIN +[WHERE|PREWHERE ] +... +``` + +Vous pouvez spécifier qu’un seul `ARRAY JOIN` la clause dans une requête. + +L’ordre d’exécution de la requête est optimisé lors de l’exécution `ARRAY JOIN`. Bien `ARRAY JOIN` doit toujours être spécifié avant l’ `WHERE/PREWHERE` clause, il peut être effectué soit avant `WHERE/PREWHERE` (si le résultat est nécessaire dans cette clause), ou après l’avoir terminé (pour réduire le volume de calculs). L’ordre de traitement est contrôlée par l’optimiseur de requête. + +Types pris en charge de `ARRAY JOIN` sont énumérés ci-dessous: + +- `ARRAY JOIN` - Dans ce cas, des tableaux vides ne sont pas inclus dans le résultat de `JOIN`. +- `LEFT ARRAY JOIN` - Le résultat de `JOIN` contient des lignes avec des tableaux vides. La valeur d’un tableau vide est définie sur la valeur par défaut pour le type d’élément de tableau (généralement 0, chaîne vide ou NULL). + +Les exemples ci-dessous illustrent l’utilisation de la `ARRAY JOIN` et `LEFT ARRAY JOIN` clause. Créons une table avec un [Tableau](../../sql-reference/data-types/array.md) tapez colonne et insérez des valeurs dedans: + +``` sql +CREATE TABLE arrays_test +( + s String, + arr Array(UInt8) +) ENGINE = Memory; + +INSERT INTO arrays_test +VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); +``` + +``` text +┌─s───────────┬─arr─────┐ +│ Hello │ [1,2] │ +│ World │ [3,4,5] │ +│ Goodbye │ [] │ +└─────────────┴─────────┘ +``` + +L’exemple ci-dessous utilise la `ARRAY JOIN` clause: + +``` sql +SELECT s, arr +FROM arrays_test +ARRAY JOIN arr; +``` + +``` text +┌─s─────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +└───────┴─────┘ +``` + +L’exemple suivant utilise l’ `LEFT ARRAY JOIN` clause: + +``` sql +SELECT s, arr +FROM arrays_test +LEFT ARRAY JOIN arr; +``` + +``` text +┌─s───────────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +│ Goodbye │ 0 │ +└─────────────┴─────┘ +``` + +#### À L’Aide D’Alias {#using-aliases} + +Un alias peut être spécifié pour un tableau `ARRAY JOIN` clause. Dans ce cas, un élément de tableau peut être consulté par ce pseudonyme, mais le tableau lui-même est accessible par le nom d’origine. Exemple: + +``` sql +SELECT s, arr, a +FROM arrays_test +ARRAY JOIN arr AS a; +``` + +``` text +┌─s─────┬─arr─────┬─a─┐ +│ Hello │ [1,2] │ 1 │ +│ Hello │ [1,2] │ 2 │ +│ World │ [3,4,5] │ 3 │ +│ World │ [3,4,5] │ 4 │ +│ World │ [3,4,5] │ 5 │ +└───────┴─────────┴───┘ +``` + +En utilisant des alias, vous pouvez effectuer `ARRAY JOIN` avec un groupe externe. Exemple: + +``` sql +SELECT s, arr_external +FROM arrays_test +ARRAY JOIN [1, 2, 3] AS arr_external; +``` + +``` text +┌─s───────────┬─arr_external─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ Hello │ 3 │ +│ World │ 1 │ +│ World │ 2 │ +│ World │ 3 │ +│ Goodbye │ 1 │ +│ Goodbye │ 2 │ +│ Goodbye │ 3 │ +└─────────────┴──────────────┘ +``` + +Plusieurs tableaux peuvent être séparés par des virgules `ARRAY JOIN` clause. Dans ce cas, `JOIN` est effectuée avec eux simultanément (la somme directe, pas le produit cartésien). Notez que tous les tableaux doivent avoir la même taille. Exemple: + +``` sql +SELECT s, arr, a, num, mapped +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ +│ Hello │ [1,2] │ 1 │ 1 │ 2 │ +│ Hello │ [1,2] │ 2 │ 2 │ 3 │ +│ World │ [3,4,5] │ 3 │ 1 │ 4 │ +│ World │ [3,4,5] │ 4 │ 2 │ 5 │ +│ World │ [3,4,5] │ 5 │ 3 │ 6 │ +└───────┴─────────┴───┴─────┴────────┘ +``` + +L’exemple ci-dessous utilise la [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) fonction: + +``` sql +SELECT s, arr, a, num, arrayEnumerate(arr) +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ +│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ +│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ +│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ +│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ +│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ +└───────┴─────────┴───┴─────┴─────────────────────┘ +``` + +#### Jointure De Tableau Avec La Structure De données imbriquée {#array-join-with-nested-data-structure} + +`ARRAY`Rejoindre " fonctionne également avec [structures de données imbriquées](../../sql-reference/data-types/nested-data-structures/nested.md). Exemple: + +``` sql +CREATE TABLE nested_test +( + s String, + nest Nested( + x UInt8, + y UInt32) +) ENGINE = Memory; + +INSERT INTO nested_test +VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); +``` + +``` text +┌─s───────┬─nest.x──┬─nest.y─────┐ +│ Hello │ [1,2] │ [10,20] │ +│ World │ [3,4,5] │ [30,40,50] │ +│ Goodbye │ [] │ [] │ +└─────────┴─────────┴────────────┘ +``` + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +Lorsque vous spécifiez des noms de structures de données imbriquées dans `ARRAY JOIN` le sens est le même que `ARRAY JOIN` avec tous les éléments du tableau qui la compose. Des exemples sont énumérés ci-dessous: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`, `nest.y`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +Cette variation a également du sens: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─────┐ +│ Hello │ 1 │ [10,20] │ +│ Hello │ 2 │ [10,20] │ +│ World │ 3 │ [30,40,50] │ +│ World │ 4 │ [30,40,50] │ +│ World │ 5 │ [30,40,50] │ +└───────┴────────┴────────────┘ +``` + +Un alias peut être utilisé pour une structure de données imbriquée, afin de sélectionner `JOIN` le résultat ou le tableau source. Exemple: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest AS n; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ +└───────┴─────┴─────┴─────────┴────────────┘ +``` + +Exemple d’utilisation de l’ [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) fonction: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num +FROM nested_test +ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ +└───────┴─────┴─────┴─────────┴────────────┴─────┘ +``` + +### Clause De JOINTURE {#select-join} + +Rejoint les données dans la normale [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) sens. + +!!! info "Note" + Pas liées à [ARRAY JOIN](#select-array-join-clause). + +``` sql +SELECT +FROM +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN +(ON )|(USING ) ... +``` + +Les noms de table peuvent être spécifiés au lieu de `` et ``. Ceci est équivalent à la `SELECT * FROM table` sous-requête, sauf dans un cas particulier lorsque la table a [Rejoindre](../../engines/table-engines/special/join.md) engine – an array prepared for joining. + +#### Types Pris En Charge De `JOIN` {#select-join-types} + +- `INNER JOIN` (ou `JOIN`) +- `LEFT JOIN` (ou `LEFT OUTER JOIN`) +- `RIGHT JOIN` (ou `RIGHT OUTER JOIN`) +- `FULL JOIN` (ou `FULL OUTER JOIN`) +- `CROSS JOIN` (ou `,` ) + +Voir la norme [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) Description. + +#### Plusieurs REJOINDRE {#multiple-join} + +En effectuant des requêtes, ClickHouse réécrit les jointures multi-tables dans la séquence des jointures à deux tables. Par exemple, S’il y a quatre tables pour join clickhouse rejoint la première et la seconde, puis rejoint le résultat avec la troisième table, et à la dernière étape, il rejoint la quatrième. + +Si une requête contient l’ `WHERE` clickhouse essaie de pousser les filtres de cette clause à travers la jointure intermédiaire. S’il ne peut pas appliquer le filtre à chaque jointure intermédiaire, ClickHouse applique les filtres une fois toutes les jointures terminées. + +Nous recommandons l’ `JOIN ON` ou `JOIN USING` syntaxe pour créer des requêtes. Exemple: + +``` sql +SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a +``` + +Vous pouvez utiliser des listes de tables séparées par des virgules `FROM` clause. Exemple: + +``` sql +SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a +``` + +Ne mélangez pas ces syntaxes. + +ClickHouse ne supporte pas directement la syntaxe avec des virgules, Nous ne recommandons donc pas de les utiliser. L’algorithme tente de réécrire la requête en termes de `CROSS JOIN` et `INNER JOIN` clauses et procède ensuite au traitement des requêtes. Lors de la réécriture de la requête, ClickHouse tente d’optimiser les performances et la consommation de mémoire. Par défaut, ClickHouse traite les virgules comme `INNER JOIN` clause et convertit `INNER JOIN` de `CROSS JOIN` lorsque l’algorithme ne peut pas garantir que `INNER JOIN` retourne les données requises. + +#### Rigueur {#select-join-strictness} + +- `ALL` — If the right table has several matching rows, ClickHouse creates a [Produit cartésien](https://en.wikipedia.org/wiki/Cartesian_product) à partir des lignes correspondantes. C’est la norme `JOIN` comportement en SQL. +- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` et `ALL` les mots clés sont les mêmes. +- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` l’utilisation est décrite ci-dessous. + +**ASOF joindre L’utilisation** + +`ASOF JOIN` est utile lorsque vous devez joindre des enregistrements qui n’ont pas de correspondance exacte. + +Tables pour `ASOF JOIN` doit avoir une colonne de séquence ordonnée. Cette colonne ne peut pas être seule dans une table et doit être l’un des types de données: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`, et `DateTime`. + +Syntaxe `ASOF JOIN ... ON`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF LEFT JOIN table_2 +ON equi_cond AND closest_match_cond +``` + +Vous pouvez utiliser n’importe quel nombre de conditions d’égalité et exactement une condition de correspondance la plus proche. Exemple, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. + +Conditions prises en charge pour la correspondance la plus proche: `>`, `>=`, `<`, `<=`. + +Syntaxe `ASOF JOIN ... USING`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF JOIN table_2 +USING (equi_column1, ... equi_columnN, asof_column) +``` + +`ASOF JOIN` utiliser `equi_columnX` pour rejoindre sur l’égalité et `asof_column` pour rejoindre le match le plus proche avec le `table_1.asof_column >= table_2.asof_column` condition. Le `asof_column` colonne toujours la dernière dans le `USING` clause. + +Par exemple, considérez les tableaux suivants: + +\`\`\` texte +table\_1 table\_2 + +événement \| ev\_time \| user\_id événement \| ev\_time \| user\_id diff --git a/docs/fr/sql-reference/statements/show.md b/docs/fr/sql-reference/statements/show.md new file mode 100644 index 00000000000..23a21e6a82b --- /dev/null +++ b/docs/fr/sql-reference/statements/show.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 38 +toc_title: SHOW +--- + +# Afficher Les requêtes {#show-queries} + +## SHOW CREATE TABLE {#show-create-table} + +``` sql +SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Renvoie un seul `String`-type ‘statement’ column, which contains a single value – the `CREATE` requête utilisée pour créer l’objet spécifié. + +## SHOW DATABASES {#show-databases} + +``` sql +SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] +``` + +Imprime une liste de toutes les bases de données. +Cette requête est identique à `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. + +## SHOW PROCESSLIST {#show-processlist} + +``` sql +SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] +``` + +Sorties le contenu de la [système.processus](../../operations/system-tables.md#system_tables-processes) table, qui contient une liste de requêtes en cours de traitement en ce moment, à l’exception `SHOW PROCESSLIST` requête. + +Le `SELECT * FROM system.processes` requête renvoie des données sur toutes les requêtes en cours. + +Astuce (exécuter dans la console): + +``` bash +$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" +``` + +## SHOW TABLES {#show-tables} + +Affiche une liste de tableaux. + +``` sql +SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Si l’ `FROM` la clause n’est pas spécifié, la requête renvoie la liste des tables de la base de données actuelle. + +Vous pouvez obtenir les mêmes résultats que l’ `SHOW TABLES` requête de la façon suivante: + +``` sql +SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Exemple** + +La requête suivante sélectionne les deux premières lignes de la liste des tables `system` base de données, dont les noms contiennent `co`. + +``` sql +SHOW TABLES FROM system LIKE '%co%' LIMIT 2 +``` + +``` text +┌─name───────────────────────────┐ +│ aggregate_function_combinators │ +│ collations │ +└────────────────────────────────┘ +``` + +## SHOW DICTIONARIES {#show-dictionaries} + +Affiche une liste de [dictionnaires externes](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +``` sql +SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Si l’ `FROM` la clause n’est pas spécifié, la requête retourne la liste des dictionnaires de la base de données actuelle. + +Vous pouvez obtenir les mêmes résultats que l’ `SHOW DICTIONARIES` requête de la façon suivante: + +``` sql +SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Exemple** + +La requête suivante sélectionne les deux premières lignes de la liste des tables `system` base de données, dont les noms contiennent `reg`. + +``` sql +SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 +``` + +``` text +┌─name─────────┐ +│ regions │ +│ region_names │ +└──────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/fr/sql-reference/statements/system.md b/docs/fr/sql-reference/statements/system.md new file mode 100644 index 00000000000..1f064f830c0 --- /dev/null +++ b/docs/fr/sql-reference/statements/system.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 37 +toc_title: SYSTEM +--- + +# SYSTÈME De Requêtes {#query-language-system} + +- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) +- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) +- [DROP DNS CACHE](#query_language-system-drop-dns-cache) +- [DROP MARK CACHE](#query_language-system-drop-mark-cache) +- [FLUSH LOGS](#query_language-system-flush_logs) +- [RELOAD CONFIG](#query_language-system-reload-config) +- [SHUTDOWN](#query_language-system-shutdown) +- [KILL](#query_language-system-kill) +- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) +- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) +- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) +- [STOP MERGES](#query_language-system-stop-merges) +- [START MERGES](#query_language-system-start-merges) + +## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} + +Recharge tous les dictionnaires qui ont déjà été chargés avec succès. +Par défaut, les dictionnaires sont chargés paresseusement (voir [dictionaries\_lazy\_load](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), donc au lieu d’être chargés automatiquement au démarrage, ils sont initialisés lors du premier accès via la fonction dictGet ou sélectionnez dans les tables avec ENGINE = Dictionary . Le `SYSTEM RELOAD DICTIONARIES` query recharge ces dictionnaires (chargés). +Retourne toujours `Ok.` quel que soit le résultat de la mise à jour du dictionnaire. + +## Recharger Le Dictionnaire Dictionary\_name {#query_language-system-reload-dictionary} + +Recharge complètement un dictionnaire `dictionary_name`, quel que soit l’état du dictionnaire (LOADED / NOT\_LOADED / FAILED). +Retourne toujours `Ok.` quel que soit le résultat de la mise à jour du dictionnaire. +L’état du dictionnaire peut être vérifié en interrogeant le `system.dictionaries` table. + +``` sql +SELECT name, status FROM system.dictionaries; +``` + +## DROP DNS CACHE {#query_language-system-drop-dns-cache} + +Réinitialise le cache DNS interne de ClickHouse. Parfois (pour les anciennes versions de ClickHouse), il est nécessaire d’utiliser cette commande lors de la modification de l’infrastructure (modification de l’adresse IP d’un autre serveur ClickHouse ou du serveur utilisé par les dictionnaires). + +Pour une gestion du cache plus pratique (automatique), voir paramètres disable\_internal\_dns\_cache, dns\_cache\_update\_period. + +## DROP MARK CACHE {#query_language-system-drop-mark-cache} + +Réinitialise le cache de marque. Utilisé dans le développement de ClickHouse et des tests de performance. + +## FLUSH LOGS {#query_language-system-flush_logs} + +Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. + +## RELOAD CONFIG {#query_language-system-reload-config} + +Recharge la configuration de ClickHouse. Utilisé lorsque la configuration est stockée dans ZooKeeeper. + +## SHUTDOWN {#query_language-system-shutdown} + +Normalement ferme ClickHouse (comme `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) + +## KILL {#query_language-system-kill} + +Annule le processus de ClickHouse (comme `kill -9 {$ pid_clickhouse-server}`) + +## Gestion Des Tables Distribuées {#query-language-system-distributed} + +ClickHouse peut gérer [distribué](../../engines/table-engines/special/distributed.md) table. Lorsqu’un utilisateur insère des données dans ces tables, ClickHouse crée d’abord une file d’attente des données qui doivent être envoyées aux nœuds de cluster, puis l’envoie de manière asynchrone. Vous pouvez gérer le traitement des files d’attente avec [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed), et [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) requête. Vous pouvez également insérer de manière synchrone des données distribuées avec `insert_distributed_sync` paramètre. + +### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} + +Désactive la distribution de données en arrière-plan lors de l’insertion de données dans des tables distribuées. + +``` sql +SYSTEM STOP DISTRIBUTED SENDS [db.] +``` + +### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} + +Force ClickHouse à envoyer des données aux nœuds de cluster de manière synchrone. Si des nœuds ne sont pas disponibles, ClickHouse lève une exception et arrête l’exécution de la requête. Vous pouvez réessayer la requête jusqu’à ce qu’elle réussisse, ce qui se produira lorsque tous les nœuds seront de nouveau en ligne. + +``` sql +SYSTEM FLUSH DISTRIBUTED [db.] +``` + +### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} + +Active la distribution de données en arrière-plan lors de l’insertion de données dans des tables distribuées. + +``` sql +SYSTEM START DISTRIBUTED SENDS [db.] +``` + +### STOP MERGES {#query_language-system-stop-merges} + +Offre la possibilité d’arrêter les fusions d’arrière-plan pour les tables de la famille MergeTree: + +``` sql +SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +``` + +!!! note "Note" + `DETACH / ATTACH` table va commencer les fusions d’arrière-plan pour la table même dans le cas où les fusions ont été arrêtées pour toutes les tables MergeTree auparavant. + +### START MERGES {#query_language-system-start-merges} + +Offre la possibilité de démarrer des fusions en arrière-plan pour les tables de la famille MergeTree: + +``` sql +SYSTEM START MERGES [[db.]merge_tree_family_table_name] +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/fr/sql-reference/syntax.md b/docs/fr/sql-reference/syntax.md new file mode 100644 index 00000000000..8c50eb40b8f --- /dev/null +++ b/docs/fr/sql-reference/syntax.md @@ -0,0 +1,187 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 31 +toc_title: Syntaxe +--- + +# Syntaxe {#syntax} + +Il existe deux types d’analyseurs dans le système: L’analyseur SQL complet (un analyseur de descente récursif) et l’analyseur de format de données (un analyseur de flux rapide). +Dans tous les cas à l’exception de la `INSERT` requête, seul L’analyseur SQL complet est utilisé. +Le `INSERT` requête utilise les deux analyseurs: + +``` sql +INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') +``` + +Le `INSERT INTO t VALUES` fragment est analysé par l’analyseur complet, et les données `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` est analysé par l’analyseur de flux rapide. Vous pouvez également activer l’analyseur complet pour les données à l’aide de la [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) paramètre. Lorsque `input_format_values_interpret_expressions = 1`, ClickHouse essaie d’abord d’analyser les valeurs avec l’analyseur de flux rapide. S’il échoue, ClickHouse essaie d’utiliser l’analyseur complet pour les données, en le traitant comme un SQL [expression](#syntax-expressions). + +Les données peuvent avoir n’importe quel format. Lorsqu’une requête est reçue, le serveur calcule pas plus que [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) octets de la requête en RAM (par défaut, 1 Mo), et le reste est analysé en flux. +Cela signifie que le système n’a pas de problèmes avec de grandes `INSERT` requêtes, comme le fait MySQL. + +Lors de l’utilisation de la `Values` format dans un `INSERT` de la requête, il peut sembler que les données sont analysées de même que les expressions dans un `SELECT` requête, mais ce n’est pas vrai. Le `Values` le format est beaucoup plus limitée. + +Ensuite, nous allons couvrir l’analyseur complet. Pour plus d’informations sur les analyseurs de format, consultez [Format](../interfaces/formats.md) section. + +## Espace {#spaces} + +Il peut y avoir n’importe quel nombre de symboles d’espace entre les constructions syntaxiques (y compris le début et la fin d’une requête). Les symboles d’espace incluent l’espace, l’onglet, le saut de ligne, Le CR et le flux de formulaire. + +## Commentaire {#comments} + +Les commentaires de style SQL et C sont pris en charge. +Commentaires de style SQL: de `--` à la fin de la ligne. L’espace après `--` peut être omis. +Commentaires dans C-style: de `/*` de `*/`. Ces commentaires peuvent être multilignes. Les espaces ne sont pas requis ici non plus. + +## Mot {#syntax-keywords} + +Les mots clés sont insensibles à la casse lorsqu’ils correspondent à: + +- La norme SQL. Exemple, `SELECT`, `select` et `SeLeCt` sont toutes valides. +- Implémentation dans certains SGBD populaires (MySQL ou Postgres). Exemple, `DateTime` est la même que `datetime`. + +Si le nom du type de données est sensible à la casse peut être vérifié `system.data_type_families` table. + +Contrairement à SQL standard, tous les autres mots clés (y compris les noms de fonctions) sont **sensible à la casse**. + +Mots-clés ne sont pas réservés (ils sont simplement considérés comme des mots-clés dans le contexte correspondant). Si vous utilisez [identificateur](#syntax-identifiers) de même que les mots clés, les placer entre guillemets. Par exemple, la requête `SELECT "FROM" FROM table_name` est valide si la table `table_name` a colonne avec le nom de `"FROM"`. + +## Identificateur {#syntax-identifiers} + +Les identificateurs sont: + +- Noms de Cluster, de base de données, de table, de partition et de colonne. +- Fonction. +- Types de données. +- [Expression des alias](#syntax-expression_aliases). + +Les identificateurs peuvent être cités ou non cités. Il est recommandé d’utiliser des identificateurs sans guillemets. + +Non identificateurs doivent correspondre à l’expression régulière `^[a-zA-Z_][0-9a-zA-Z_]*$` et ne peut pas être égale à [mot](#syntax-keywords). Exemple: `x, _1, X_y__Z123_.` + +Si vous souhaitez utiliser les identifiants de la même manière que les mots-clés ou si vous souhaitez utiliser d’autres symboles dans les identifiants, citez-le en utilisant des guillemets doubles ou des backticks, par exemple, `"id"`, `` `id` ``. + +## Littéral {#literals} + +Il y a: Numérique, chaîne, composé et `NULL` littéral. + +### Numérique {#numeric} + +Un littéral numérique tente d’être analysé: + +- D’abord comme un nombre signé 64 bits, en utilisant le [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) fonction. +- En cas d’échec, en tant que nombre non signé 64 bits, [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) fonction. +- En cas d’échec, en tant que nombre à virgule flottante [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) fonction. +- Sinon, une erreur est renvoyée. + +La valeur correspondante aura le plus petit type dans lequel la valeur correspond. +Par exemple, 1 est analysé comme `UInt8`, mais 256 est analysé comme `UInt16`. Pour plus d’informations, voir [Types de données](../sql-reference/data-types/index.md). + +Exemple: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. + +### Chaîne {#syntax-string-literal} + +Seuls les littéraux de chaîne entre guillemets simples sont pris en charge. Le clos de caractères barre oblique inverse échappé. Les séquences d’échappement suivantes ont une valeur spéciale correspondante: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. Dans tous les autres cas, des séquences d’échappement au format `\c`, où `c` est un caractère, sont convertis à `c`. Cela signifie que vous pouvez utiliser les séquences `\'`et`\\`. La valeur aurez l’ [Chaîne](../sql-reference/data-types/string.md) type. + +L’ensemble minimum de caractères que vous devez échapper dans les littéraux de chaîne: `'` et `\`. Apostrophe peut être échappé avec l’apostrophe, les littéraux `'It\'s'` et `'It''s'` sont égaux. + +### Composé {#compound} + +Les Constructions sont prises en charge pour les tableaux: `[1, 2, 3]` et les tuples: `(1, 'Hello, world!', 2)`.. +En fait, ce ne sont pas des littéraux, mais des expressions avec l’opérateur de création de tableau et l’opérateur de création de tuple, respectivement. +Un tableau doit être composé d’au moins un élément, et un tuple doit avoir au moins deux éléments. +Les Tuples ont un but spécial pour l’usage dans le `IN` clause de a `SELECT` requête. Les Tuples peuvent être obtenus à la suite d’une requête, mais ils ne peuvent pas être enregistrées dans une base de données (à l’exception de [Mémoire](../engines/table-engines/special/memory.md) table). + +### NULL {#null-literal} + +Indique que la valeur est manquante. + +Afin de stocker `NULL` dans un champ de table, il doit être de la [Nullable](../sql-reference/data-types/nullable.md) type. + +Selon le format de données (entrée ou sortie), `NULL` peut avoir une représentation différente. Pour plus d’informations, consultez la documentation de [formats de données](../interfaces/formats.md#formats). + +Il y a beaucoup de nuances au traitement `NULL`. Par exemple, si au moins l’un des arguments d’une opération de comparaison est `NULL` le résultat de cette opération sera également `NULL`. Il en va de même pour la multiplication, l’addition et d’autres opérations. Pour plus d’informations, lisez la documentation pour chaque opération. + +Dans les requêtes, vous pouvez vérifier `NULL` à l’aide de la [IS NULL](operators.md#operator-is-null) et [IS NOT NULL](operators.md) opérateurs et les fonctions connexes `isNull` et `isNotNull`. + +## Fonction {#functions} + +Les fonctions sont écrites comme un identifiant avec une liste d’arguments (éventuellement vide) entre parenthèses. Contrairement au SQL standard, les crochets sont requis, même pour une liste d’arguments vide. Exemple: `now()`. +Il existe des fonctions régulières et agrégées (voir la section “Aggregate functions”). Certaines fonctions d’agrégat peut contenir deux listes d’arguments entre parenthèses. Exemple: `quantile (0.9) (x)`. Ces fonctions d’agrégation sont appelés “parametric” fonctions, et les arguments dans la première liste sont appelés “parameters”. La syntaxe des fonctions d’agrégation sans paramètres est la même que pour les fonctions régulières. + +## Opérateur {#operators} + +Les opérateurs sont convertis en leurs fonctions correspondantes lors de l’analyse des requêtes, en tenant compte de leur priorité et de leur associativité. +Par exemple, l’expression `1 + 2 * 3 + 4` est transformé à `plus(plus(1, multiply(2, 3)), 4)`. + +## Types De données Et Moteurs De Table De Base De données {#data_types-and-database-table-engines} + +Types de données et moteurs de table dans `CREATE` les requêtes sont écrites de la même manière que les identifiants ou les fonctions. En d’autres termes, ils peuvent ou non contenir une liste d’arguments entre parenthèses. Pour plus d’informations, voir les sections “Data types,” “Table engines,” et “CREATE”. + +## Expression Des Alias {#syntax-expression_aliases} + +Un alias est un nom défini par l’utilisateur pour une expression dans une requête. + +``` sql +expr AS alias +``` + +- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` clause sans utiliser le `AS` mot. + + For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. + + In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. + +- `expr` — Any expression supported by ClickHouse. + + For example, `SELECT column_name * 2 AS double FROM some_table`. + +- `alias` — Name for `expr`. Les alias doivent être conformes à la [identificateur](#syntax-identifiers) syntaxe. + + For example, `SELECT "table t".column_name FROM table_name AS "table t"`. + +### Notes Sur l’Utilisation De La {#notes-on-usage} + +Les alias sont globaux pour une requête ou d’une sous-requête et vous pouvez définir un alias dans n’importe quelle partie d’une requête de toute expression. Exemple, `SELECT (1 AS n) + 2, n`. + +Les alias ne sont pas visibles dans les sous-requêtes et entre les sous-requêtes. Par exemple, lors de l’exécution de la requête `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` Clickhouse génère l’exception `Unknown identifier: num`. + +Si un alias est défini pour les colonnes de `SELECT` la clause d’une sous-requête, ces colonnes sont visibles dans la requête externe. Exemple, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. + +Soyez prudent avec les Alias qui sont les mêmes que les noms de colonnes ou de tables. Considérons l’exemple suivant: + +``` sql +CREATE TABLE t +( + a Int, + b Int +) +ENGINE = TinyLog() +``` + +``` sql +SELECT + argMax(a, b), + sum(b) AS b +FROM t +``` + +``` text +Received exception from server (version 18.14.17): +Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. +``` + +Dans cet exemple, nous avons déclaré table `t` avec la colonne `b`. Ensuite, lors de la sélection des données, nous avons défini le `sum(b) AS b` alias. Comme les alias sont globaux, ClickHouse a substitué le littéral `b` dans l’expression `argMax(a, b)` avec l’expression `sum(b)`. Cette substitution a provoqué l’exception. + +## Astérisque {#asterisk} + +Dans un `SELECT` requête, un astérisque peut remplacer l’expression. Pour plus d’informations, consultez la section “SELECT”. + +## Expression {#syntax-expressions} + +Une expression est une fonction, un identifiant, un littéral, une application d’un opérateur, une expression entre parenthèses, une sous-requête ou un astérisque. Il peut également contenir un alias. +Une liste des expressions est une ou plusieurs expressions séparées par des virgules. +Les fonctions et les opérateurs, à leur tour, peuvent avoir des expressions comme arguments. + +[Article Original](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/fr/sql-reference/table-functions/file.md b/docs/fr/sql-reference/table-functions/file.md new file mode 100644 index 00000000000..51ae818e5df --- /dev/null +++ b/docs/fr/sql-reference/table-functions/file.md @@ -0,0 +1,121 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 37 +toc_title: fichier +--- + +# fichier {#file} + +Crée un tableau à partir d’un fichier. Cette fonction de table est similaire à [URL](url.md) et [hdfs](hdfs.md) ceux. + +``` sql +file(path, format, structure) +``` + +**Les paramètres d’entrée** + +- `path` — The relative path to the file from [user\_files\_path](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_files_path). Chemin d’accès à la prise en charge des fichiers suivant les globs en mode Lecture seule: `*`, `?`, `{abc,def}` et `{N..M}` où `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [format](../../interfaces/formats.md#formats) de le fichier. +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**Valeur renvoyée** + +Une table avec la structure spécifiée pour lire ou écrire des données dans le fichier spécifié. + +**Exemple** + +Paramètre `user_files_path` et le contenu du fichier `test.csv`: + +``` bash +$ grep user_files_path /etc/clickhouse-server/config.xml + /var/lib/clickhouse/user_files/ + +$ cat /var/lib/clickhouse/user_files/test.csv + 1,2,3 + 3,2,1 + 78,43,45 +``` + +Table de`test.csv` et la sélection des deux premières lignes de ce: + +``` sql +SELECT * +FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +``` sql +-- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file +SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 +``` + +**Globs dans le chemin** + +Plusieurs composants de chemin peuvent avoir des globs. Pour être traité, le fichier doit exister et correspondre à l’ensemble du modèle de chemin (pas seulement le suffixe ou le préfixe). + +- `*` — Substitutes any number of any characters except `/` y compris la chaîne vide. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +Les Constructions avec `{}` sont similaires à l’ [fonction de table à distance](../../sql-reference/table-functions/remote.md)). + +**Exemple** + +1. Supposons que nous ayons plusieurs fichiers avec les chemins relatifs suivants: + +- ‘some\_dir/some\_file\_1’ +- ‘some\_dir/some\_file\_2’ +- ‘some\_dir/some\_file\_3’ +- ‘another\_dir/some\_file\_1’ +- ‘another\_dir/some\_file\_2’ +- ‘another\_dir/some\_file\_3’ + +1. Interroger la quantité de lignes dans ces fichiers: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. Requête de la quantité de lignes dans tous les fichiers de ces deux répertoires: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "Avertissement" + Si votre liste de fichiers contient des plages de nombres avec des zéros en tête, utilisez la construction avec des accolades pour chaque chiffre séparément ou utilisez `?`. + +**Exemple** + +Interroger les données des fichiers nommés `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## Les Colonnes Virtuelles {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Voir Aussi** + +- [Les colonnes virtuelles](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/fr/sql-reference/table-functions/generate.md b/docs/fr/sql-reference/table-functions/generate.md new file mode 100644 index 00000000000..1b5d0ca8f26 --- /dev/null +++ b/docs/fr/sql-reference/table-functions/generate.md @@ -0,0 +1,45 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 47 +toc_title: generateRandom +--- + +# generateRandom {#generaterandom} + +Génère des données aléatoires avec un schéma donné. +Permet de remplir des tables de test avec des données. +Prend en charge tous les types de données qui peuvent être stockés dans la table sauf `LowCardinality` et `AggregateFunction`. + +``` sql +generateRandom('name TypeName[, name TypeName]...', [, 'random_seed'[, 'max_string_length'[, 'max_array_length']]]); +``` + +**Paramètre** + +- `name` — Name of corresponding column. +- `TypeName` — Type of corresponding column. +- `limit` — Number of rows to generate. +- `max_array_length` — Maximum array length for all generated arrays. Defaults to `10`. +- `max_string_length` — Maximum string length for all generated strings. Defaults to `10`. +- `random_seed` — Specify random seed manually to produce stable results. If NULL — seed is randomly generated. + +**Valeur Renvoyée** + +Un objet de table avec le schéma demandé. + +## Exemple D’Utilisation {#usage-example} + +``` sql +SELECT * FROM generateRandom('a Array(Int8), d Decimal32(4), c Tuple(DateTime64(3), UUID)', 1, 10, 2); +``` + +``` text +┌─a────────┬────────────d─┬─c──────────────────────────────────────────────────────────────────┐ +│ [77] │ -124167.6723 │ ('2061-04-17 21:59:44.573','3f72f405-ec3e-13c8-44ca-66ef335f7835') │ +│ [32,110] │ -141397.7312 │ ('1979-02-09 03:43:48.526','982486d1-5a5d-a308-e525-7bd8b80ffa73') │ +│ [68] │ -67417.0770 │ ('2080-03-12 14:17:31.269','110425e5-413f-10a6-05ba-fa6b3e929f15') │ +└──────────┴──────────────┴────────────────────────────────────────────────────────────────────┘ +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/generate/) diff --git a/docs/fr/sql-reference/table-functions/hdfs.md b/docs/fr/sql-reference/table-functions/hdfs.md new file mode 100644 index 00000000000..8df5d0cd94d --- /dev/null +++ b/docs/fr/sql-reference/table-functions/hdfs.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 45 +toc_title: hdfs +--- + +# hdfs {#hdfs} + +Crée une table à partir de fichiers dans HDFS. Cette fonction de table est similaire à [URL](url.md) et [fichier](file.md) ceux. + +``` sql +hdfs(URI, format, structure) +``` + +**Les paramètres d’entrée** + +- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` et `{N..M}` où `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [format](../../interfaces/formats.md#formats) de le fichier. +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**Valeur renvoyée** + +Une table avec la structure spécifiée pour lire ou écrire des données dans le fichier spécifié. + +**Exemple** + +Table de `hdfs://hdfs1:9000/test` et la sélection des deux premières lignes de ce: + +``` sql +SELECT * +FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +**Globs dans le chemin** + +Plusieurs composants de chemin peuvent avoir des globs. Pour être traité, le fichier doit exister et correspondre à l’ensemble du modèle de chemin (pas seulement le suffixe ou le préfixe). + +- `*` — Substitutes any number of any characters except `/` y compris la chaîne vide. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +Les Constructions avec `{}` sont similaires à l’ [fonction de table à distance](../../sql-reference/table-functions/remote.md)). + +**Exemple** + +1. Supposons que nous ayons plusieurs fichiers avec les URI suivants sur HDFS: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. Interroger la quantité de lignes dans ces fichiers: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. Requête de la quantité de lignes dans tous les fichiers de ces deux répertoires: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "Avertissement" + Si votre liste de fichiers contient des plages de nombres avec des zéros en tête, utilisez la construction avec des accolades pour chaque chiffre séparément ou utilisez `?`. + +**Exemple** + +Interroger les données des fichiers nommés `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## Les Colonnes Virtuelles {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Voir Aussi** + +- [Les colonnes virtuelles](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/fr/sql-reference/table-functions/index.md b/docs/fr/sql-reference/table-functions/index.md new file mode 100644 index 00000000000..2f71bd509c1 --- /dev/null +++ b/docs/fr/sql-reference/table-functions/index.md @@ -0,0 +1,38 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Table Functions +toc_priority: 34 +toc_title: Introduction +--- + +# Les Fonctions De Table {#table-functions} + +Les fonctions de Table sont des méthodes pour construire des tables. + +Vous pouvez utiliser les fonctions de table dans: + +- [FROM](../statements/select.md#select-from) la clause de la `SELECT` requête. + + The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. + +- [Créer une TABLE en tant que \< table\_function ()\>](../statements/create.md#create-table-query) requête. + + It's one of the methods of creating a table. + +!!! warning "Avertissement" + Vous ne pouvez pas utiliser les fonctions de table si [allow\_ddl](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) paramètre est désactivé. + +| Fonction | Description | +|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------| +| [fichier](file.md) | Crée un [Fichier](../../engines/table-engines/special/file.md)-moteur de table. | +| [fusionner](merge.md) | Crée un [Fusionner](../../engines/table-engines/special/merge.md)-moteur de table. | +| [nombre](numbers.md) | Crée une table avec une seule colonne remplie de nombres entiers. | +| [distant](remote.md) | Vous permet d’accéder à des serveurs distants sans [Distribué](../../engines/table-engines/special/distributed.md)-moteur de table. | +| [URL](url.md) | Crée un [URL](../../engines/table-engines/special/url.md)-moteur de table. | +| [mysql](mysql.md) | Crée un [MySQL](../../engines/table-engines/integrations/mysql.md)-moteur de table. | +| [jdbc](jdbc.md) | Crée un [JDBC](../../engines/table-engines/integrations/jdbc.md)-moteur de table. | +| [ODBC](odbc.md) | Crée un [ODBC](../../engines/table-engines/integrations/odbc.md)-moteur de table. | +| [hdfs](hdfs.md) | Crée un [HDFS](../../engines/table-engines/integrations/hdfs.md)-moteur de table. | + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/fr/sql_reference/table_functions/input.md b/docs/fr/sql-reference/table-functions/input.md similarity index 91% rename from docs/fr/sql_reference/table_functions/input.md rename to docs/fr/sql-reference/table-functions/input.md index 9e3ea01e35e..f6babf097a0 100644 --- a/docs/fr/sql_reference/table_functions/input.md +++ b/docs/fr/sql-reference/table-functions/input.md @@ -17,17 +17,17 @@ Cette fonction peut être utilisée uniquement dans `INSERT SELECT` requête et (par exemple, il peut être utilisé dans la sous-requête, etc.). Les données peuvent être envoyées de quelque manière que ce soit comme pour ordinaire `INSERT` requête et passé dans tout disponible [format](../../interfaces/formats.md#formats) -qui doit être spécifié à la fin de la requête (contrairement à l'ordinaire `INSERT SELECT`). +qui doit être spécifié à la fin de la requête (contrairement à l’ordinaire `INSERT SELECT`). La caractéristique principale de cette fonction est que lorsque le serveur reçoit des données du client il les convertit simultanément selon la liste des expressions dans le `SELECT` clause et insère dans la table cible. Table temporaire -avec toutes les données transférées n'est pas créé. +avec toutes les données transférées n’est pas créé. **Exemple** - Laissez le `test` le tableau a la structure suivante `(a String, b String)` et les données `data.csv` a une structure différente `(col1 String, col2 Date, col3 Int32)`. Requête pour insérer - les données de l' `data.csv` dans le `test` table avec conversion simultanée ressemble à ceci: + les données de l’ `data.csv` dans le `test` table avec conversion simultanée ressemble à ceci: diff --git a/docs/fr/sql-reference/table-functions/jdbc.md b/docs/fr/sql-reference/table-functions/jdbc.md new file mode 100644 index 00000000000..caebd4ef00f --- /dev/null +++ b/docs/fr/sql-reference/table-functions/jdbc.md @@ -0,0 +1,29 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 43 +toc_title: jdbc +--- + +# jdbc {#table-function-jdbc} + +`jdbc(jdbc_connection_uri, schema, table)` - retourne la table qui est connectée via le pilote JDBC. + +Ce tableau fonction nécessite séparé `clickhouse-jdbc-bridge` programme en cours d’exécution. +Il prend en charge les types Nullable (basé sur DDL de la table distante qui est interrogée). + +**Exemple** + +``` sql +SELECT * FROM jdbc('jdbc:mysql://localhost:3306/?user=root&password=root', 'schema', 'table') +``` + +``` sql +SELECT * FROM jdbc('mysql://localhost:3306/?user=root&password=root', 'schema', 'table') +``` + +``` sql +SELECT * FROM jdbc('datasource://mysql-local', 'schema', 'table') +``` + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/fr/sql-reference/table-functions/merge.md b/docs/fr/sql-reference/table-functions/merge.md new file mode 100644 index 00000000000..0e24a6eb882 --- /dev/null +++ b/docs/fr/sql-reference/table-functions/merge.md @@ -0,0 +1,14 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 38 +toc_title: fusionner +--- + +# fusionner {#merge} + +`merge(db_name, 'tables_regexp')` – Creates a temporary Merge table. For more information, see the section “Table engines, Merge”. + +La structure de la table est tirée de la première table rencontrée qui correspond à l’expression régulière. + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/merge/) diff --git a/docs/fr/sql-reference/table-functions/mysql.md b/docs/fr/sql-reference/table-functions/mysql.md new file mode 100644 index 00000000000..e3f8123e4d8 --- /dev/null +++ b/docs/fr/sql-reference/table-functions/mysql.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 42 +toc_title: mysql +--- + +# mysql {#mysql} + +Permettre `SELECT` requêtes à effectuer sur des données stockées sur un serveur MySQL distant. + +``` sql +mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +**Paramètre** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` les requêtes de `REPLACE INTO`. Si `replace_query=1` la requête est remplacé. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expression qui est ajoutée à la `INSERT` requête. + + Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. + + To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. + +Simple `WHERE` des clauses telles que `=, !=, >, >=, <, <=` sont actuellement exécutés sur le serveur MySQL. + +Le reste des conditions et le `LIMIT` les contraintes d’échantillonnage sont exécutées dans ClickHouse uniquement après la fin de la requête à MySQL. + +**Valeur Renvoyée** + +Un objet table avec les mêmes colonnes que la table MySQL d’origine. + +## Exemple D’Utilisation {#usage-example} + +Table dans MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Sélection des données de ClickHouse: + +``` sql +SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Voir Aussi {#see-also} + +- [Le ‘MySQL’ tableau moteur](../../engines/table-engines/integrations/mysql.md) +- [Utilisation de MySQL comme source de dictionnaire externe](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/fr/sql_reference/table_functions/numbers.md b/docs/fr/sql-reference/table-functions/numbers.md similarity index 100% rename from docs/fr/sql_reference/table_functions/numbers.md rename to docs/fr/sql-reference/table-functions/numbers.md diff --git a/docs/fr/sql-reference/table-functions/odbc.md b/docs/fr/sql-reference/table-functions/odbc.md new file mode 100644 index 00000000000..0cb9330ab1e --- /dev/null +++ b/docs/fr/sql-reference/table-functions/odbc.md @@ -0,0 +1,108 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 44 +toc_title: ODBC +--- + +# ODBC {#table-functions-odbc} + +Renvoie la table connectée via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +``` sql +odbc(connection_settings, external_database, external_table) +``` + +Paramètre: + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` fichier. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +Pour implémenter en toute sécurité les connexions ODBC, ClickHouse utilise un programme distinct `clickhouse-odbc-bridge`. Si le pilote ODBC est chargé directement depuis `clickhouse-server`, les problèmes de pilote peuvent planter le serveur ClickHouse. Clickhouse démarre automatiquement `clickhouse-odbc-bridge` lorsque cela est nécessaire. Le programme ODBC bridge est installé à partir du même package que `clickhouse-server`. + +Les champs avec l’ `NULL` les valeurs de la table externe sont converties en valeurs par défaut pour le type de données de base. Par exemple, si un champ de table MySQL distant a `INT NULL` type il est converti en 0 (la valeur par défaut pour ClickHouse `Int32` type de données). + +## Exemple d’utilisation {#usage-example} + +**Obtenir des données de L’installation MySQL locale via ODBC** + +Cet exemple est vérifié pour Ubuntu Linux 18.04 et MySQL server 5.7. + +Assurez-vous que unixODBC et MySQL Connector sont installés. + +Par défaut (si installé à partir de paquets), ClickHouse démarre en tant qu’utilisateur `clickhouse`. Ainsi, vous devez créer et configurer cet utilisateur dans le serveur MySQL. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +Puis configurez la connexion dans `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Vous pouvez vérifier la connexion en utilisant le `isql` utilitaire de l’installation unixODBC. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +Table dans MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Récupération des données de la table MySQL dans ClickHouse: + +``` sql +SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ 0 │ 2 │ 0 │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Voir Aussi {#see-also} + +- [Dictionnaires externes ODBC](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [Moteur de table ODBC](../../engines/table-engines/integrations/odbc.md). + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/fr/sql-reference/table-functions/remote.md b/docs/fr/sql-reference/table-functions/remote.md new file mode 100644 index 00000000000..c7c541a4afa --- /dev/null +++ b/docs/fr/sql-reference/table-functions/remote.md @@ -0,0 +1,83 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 40 +toc_title: distant +--- + +# à distance, remoteSecure {#remote-remotesecure} + +Vous permet d’accéder à des serveurs distants sans `Distributed` table. + +Signature: + +``` sql +remote('addresses_expr', db, table[, 'user'[, 'password']]) +remote('addresses_expr', db.table[, 'user'[, 'password']]) +``` + +`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` ou juste `host`. L’hôte peut être spécifié comme nom de serveur ou l’adresse IPv4 ou IPv6. Une adresse IPv6 est indiquée entre crochets. Le port est le port TCP sur le serveur distant. Si le port est omis, il utilise `tcp_port` à partir du fichier de configuration du serveur (par défaut, 9000). + +!!! important "Important" + Le port est requis pour une adresse IPv6. + +Exemple: + +``` text +example01-01-1 +example01-01-1:9000 +localhost +127.0.0.1 +[::]:9000 +[2a02:6b8:0:1111::11]:9000 +``` + +Plusieurs adresses séparées par des virgules. Dans ce cas, ClickHouse utilisera le traitement distribué, donc il enverra la requête à toutes les adresses spécifiées (comme les fragments avec des données différentes). + +Exemple: + +``` text +example01-01-1,example01-02-1 +``` + +Une partie de l’expression peut être spécifiée entre crochets. L’exemple précédent peut être écrite comme suit: + +``` text +example01-0{1,2}-1 +``` + +Les accolades peuvent contenir une plage de Nombres séparés par deux points (entiers non négatifs). Dans ce cas, la gamme est étendue à un ensemble de valeurs qui génèrent fragment d’adresses. Si le premier nombre commence par zéro, les valeurs sont formées avec le même alignement zéro. L’exemple précédent peut être écrite comme suit: + +``` text +example01-{01..02}-1 +``` + +Si vous avez plusieurs paires d’accolades, il génère le produit direct des ensembles correspondants. + +Les adresses et les parties d’adresses entre crochets peuvent être séparées par le symbole de tuyau (\|). Dans ce cas, les ensembles correspondants de adresses sont interprétés comme des répliques, et la requête sera envoyée à la première sain réplique. Cependant, les répliques sont itérées dans l’ordre actuellement défini dans [équilibrage](../../operations/settings/settings.md) paramètre. + +Exemple: + +``` text +example01-{01..02}-{1|2} +``` + +Cet exemple spécifie deux fragments qui ont chacun deux répliques. + +Le nombre d’adresses générées est limitée par une constante. En ce moment, c’est 1000 adresses. + +À l’aide de la `remote` la fonction de table est moins optimale que la création d’un `Distributed` table, car dans ce cas, la connexion au serveur est rétablie pour chaque requête. En outre, si des noms d’hôte, les noms sont résolus, et les erreurs ne sont pas comptés lors de travail avec diverses répliques. Lors du traitement d’un grand nombre de requêtes, créez toujours `Distributed` table à l’avance, et ne pas utiliser la `remote` table de fonction. + +Le `remote` table de fonction peut être utile dans les cas suivants: + +- Accès à un serveur spécifique pour la comparaison de données, le débogage et les tests. +- Requêtes entre différents clusters ClickHouse à des fins de recherche. +- Demandes distribuées peu fréquentes qui sont faites manuellement. +- Distribué demandes où l’ensemble des serveurs est redéfinie à chaque fois. + +Si l’utilisateur n’est pas spécifié, `default` est utilisée. +Si le mot de passe n’est spécifié, un mot de passe vide est utilisé. + +`remoteSecure` - la même chose que `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) de config ou 9440. + +[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/fr/sql_reference/table_functions/url.md b/docs/fr/sql-reference/table-functions/url.md similarity index 100% rename from docs/fr/sql_reference/table_functions/url.md rename to docs/fr/sql-reference/table-functions/url.md diff --git a/docs/fr/sql_reference/aggregate_functions/combinators.md b/docs/fr/sql_reference/aggregate_functions/combinators.md deleted file mode 100644 index 7dce4a46de3..00000000000 --- a/docs/fr/sql_reference/aggregate_functions/combinators.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 37 -toc_title: "Combinateurs de fonction d'agr\xE9gat" ---- - -# Combinateurs De Fonction D'Agrégat {#aggregate_functions_combinators} - -Le nom d'une fonction d'agrégat peut avoir un suffixe ajouté. Cela change la façon dont la fonction d'agrégation fonctionne. - -## -Si {#agg-functions-combinator-if} - -The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). - -Exemple: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` et ainsi de suite. - -Avec les fonctions d'agrégat conditionnel, vous pouvez calculer des agrégats pour plusieurs conditions à la fois, sans utiliser de sous-requêtes et `JOIN`s. Par exemple, dans Yandex.Metrica, les fonctions d'agrégat conditionnel sont utilisées pour implémenter la fonctionnalité de comparaison de segment. - -## -Tableau {#agg-functions-combinator-array} - -Le Tableau suffixe peut être ajouté à toute fonction d'agrégation. Dans ce cas, la fonction d'agrégation des arguments de la ‘Array(T)’ type (tableaux) au lieu de ‘T’ tapez les arguments. Si la fonction aggregate accepte plusieurs arguments, il doit s'agir de tableaux de longueurs égales. Lors du traitement des tableaux, la fonction d'agrégation fonctionne comme la fonction d'agrégation d'origine sur tous les éléments du tableau. - -Exemple 1: `sumArray(arr)` - Totalise tous les éléments de tous ‘arr’ tableau. Dans cet exemple, il aurait pu être écrit plus simplement: `sum(arraySum(arr))`. - -Exemple 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ tableau. Cela pourrait être fait d'une manière plus facile: `uniq(arrayJoin(arr))` mais ce n'est pas toujours possible d'ajouter des ‘arrayJoin’ pour une requête. - -\- Si et-tableau peut être combiné. Cependant, ‘Array’ doit venir en premier, puis ‘If’. Exemple: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. En raison de cet ordre, le ‘cond’ argument ne sera pas un tableau. - -## -État {#agg-functions-combinator-state} - -Si vous appliquez ce combinateur, la fonction d'agrégation ne renvoie pas la valeur résultante (par exemple le nombre de valeurs uniques pour [uniq](reference.md#agg_function-uniq) la fonction), mais un état intermédiaire de l'agrégation (pour `uniq`, c'est la table de hachage pour calculer le nombre de valeurs uniques). C'est un `AggregateFunction(...)` qui peuvent être utilisés pour un traitement ultérieur ou stockés dans un tableau pour terminer l'agrégation plus tard. - -Pour travailler avec ces états, utilisez: - -- [AggregatingMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) tableau moteur. -- [finalizeAggregation](../../sql_reference/functions/other_functions.md#function-finalizeaggregation) fonction. -- [runningAccumulate](../../sql_reference/functions/other_functions.md#function-runningaccumulate) fonction. -- [-Fusionner](#aggregate_functions_combinators_merge) combinator. -- [-MergeState](#aggregate_functions_combinators_mergestate) combinator. - -## -Fusionner {#aggregate_functions_combinators-merge} - -Si vous appliquez ce combinateur, la fonction d'agrégation prend l'état d'agrégation intermédiaire comme argument, combine les États pour terminer l'agrégation et renvoie la valeur résultante. - -## -MergeState {#aggregate_functions_combinators-mergestate} - -Fusionne les États d'agrégation intermédiaires de la même manière que le combinateur-Merge. Cependant, il ne renvoie pas la valeur résultante, mais un État d'agrégation intermédiaire, similaire au combinateur-State. - -## - ForEach {#agg-functions-combinator-foreach} - -Convertit une fonction d'agrégation pour les tables en une fonction d'agrégation pour les tableaux qui agrège les éléments de tableau correspondants et renvoie un tableau de résultats. Exemple, `sumForEach` pour les tableaux `[1, 2]`, `[3, 4, 5]`et`[6, 7]`renvoie le résultat `[10, 13, 5]` après avoir additionné les éléments de tableau correspondants. - -## - OrDefault {#agg-functions-combinator-ordefault} - -Remplit la valeur par défaut du type de retour de la fonction d'agrégation s'il n'y a rien à agréger. - -``` sql -SELECT avg(number), avgOrDefault(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrDefault(number)─┐ -│ nan │ 0 │ -└─────────────┴──────────────────────┘ -``` - -## - OrNull {#agg-functions-combinator-ornull} - -Remplir `null` si il n'y a rien à s'agréger. La colonne de retour sera nullable. - -``` sql -SELECT avg(number), avgOrNull(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrNull(number)─┐ -│ nan │ ᴺᵁᴸᴸ │ -└─────────────┴───────────────────┘ -``` - -\- OrDefault et-OrNull peuvent être combinés avec d'autres combinateurs. Il est utile lorsque la fonction d'agrégation n'accepte pas l'entrée vide. - -``` sql -SELECT avgOrNullIf(x, x > 10) -FROM -( - SELECT toDecimal32(1.23, 2) AS x -) -``` - -``` text -┌─avgOrNullIf(x, greater(x, 10))─┐ -│ ᴺᵁᴸᴸ │ -└────────────────────────────────┘ -``` - -## -Resample {#agg-functions-combinator-resample} - -Permet de diviser les données en groupes, puis séparément agrège les données de ces groupes. Les groupes sont créés en divisant les valeurs d'une colonne en intervalles. - -``` sql -Resample(start, end, step)(, resampling_key) -``` - -**Paramètre** - -- `start` — Starting value of the whole required interval for `resampling_key` valeur. -- `stop` — Ending value of the whole required interval for `resampling_key` valeur. L'ensemble de l'intervalle ne comprend pas les `stop` valeur `[start, stop)`. -- `step` — Step for separating the whole interval into subintervals. The `aggFunction` est exécuté sur chacun de ces sous-intervalles indépendamment. -- `resampling_key` — Column whose values are used for separating data into intervals. -- `aggFunction_params` — `aggFunction` paramètre. - -**Valeurs renvoyées** - -- Tableau de `aggFunction` les résultats pour chaque subinterval. - -**Exemple** - -Envisager l' `people` le tableau avec les données suivantes: - -``` text -┌─name───┬─age─┬─wage─┐ -│ John │ 16 │ 10 │ -│ Alice │ 30 │ 15 │ -│ Mary │ 35 │ 8 │ -│ Evelyn │ 48 │ 11.5 │ -│ David │ 62 │ 9.9 │ -│ Brian │ 60 │ 16 │ -└────────┴─────┴──────┘ -``` - -Obtenons les noms des personnes dont l'âge se trouve dans les intervalles de `[30,60)` et `[60,75)`. Puisque nous utilisons la représentation entière pour l'âge, nous obtenons des âges dans le `[30, 59]` et `[60,74]` intervalle. - -Pour agréger des noms dans un tableau, nous utilisons [grouperay](reference.md#agg_function-grouparray) fonction d'agrégation. Il faut un argument. Dans notre cas, c'est l' `name` colonne. Le `groupArrayResample` fonction devrait utiliser le `age` colonne pour agréger les noms par âge. Pour définir les intervalles requis, nous passons le `30, 75, 30` des arguments dans la `groupArrayResample` fonction. - -``` sql -SELECT groupArrayResample(30, 75, 30)(name, age) FROM people -``` - -``` text -┌─groupArrayResample(30, 75, 30)(name, age)─────┐ -│ [['Alice','Mary','Evelyn'],['David','Brian']] │ -└───────────────────────────────────────────────┘ -``` - -Considérez les résultats. - -`Jonh` est hors de l'échantillon parce qu'il est trop jeune. D'autres personnes sont distribués selon les intervalles d'âge. - -Maintenant, nous allons compter le nombre total de personnes et leur salaire moyen dans les intervalles d'âge. - -``` sql -SELECT - countResample(30, 75, 30)(name, age) AS amount, - avgResample(30, 75, 30)(wage, age) AS avg_wage -FROM people -``` - -``` text -┌─amount─┬─avg_wage──────────────────┐ -│ [3,2] │ [11.5,12.949999809265137] │ -└────────┴───────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/fr/sql_reference/aggregate_functions/index.md b/docs/fr/sql_reference/aggregate_functions/index.md deleted file mode 100644 index 4be1632a29e..00000000000 --- a/docs/fr/sql_reference/aggregate_functions/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Aggregate Functions -toc_priority: 33 -toc_title: Introduction ---- - -# Les fonctions d'agrégation {#aggregate-functions} - -Les fonctions d'agrégation fonctionnent dans le [normal](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) comme prévu par les experts de la base de données. - -Clickhouse prend également en charge: - -- [Fonctions d'agrégat paramétriques](parametric_functions.md#aggregate_functions_parametric) qui acceptent d'autres paramètres en plus des colonnes. -- [Combinators](combinators.md#aggregate_functions_combinators), qui modifient le comportement des fonctions d'agrégation. - -## Le traitement NULL {#null-processing} - -Au cours de l'agrégation, tous les `NULL`s sont ignorés. - -**Exemple:** - -Considérez ce tableau: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -Disons que vous devez totaliser les valeurs dans le `y` colonne: - -``` sql -SELECT sum(y) FROM t_null_big -``` - - ┌─sum(y)─┐ - │ 7 │ - └────────┘ - -Le `sum` la fonction d'interprète `NULL` comme `0`. En particulier, cela signifie que si la fonction reçoit en entrée d'une sélection où toutes les valeurs sont `NULL`, alors le résultat sera `0`, pas `NULL`. - -Maintenant, vous pouvez utiliser le `groupArray` fonction pour créer un tableau à partir `y` colonne: - -``` sql -SELECT groupArray(y) FROM t_null_big -``` - -``` text -┌─groupArray(y)─┐ -│ [2,2,3] │ -└───────────────┘ -``` - -`groupArray` ne comprend pas `NULL` dans le tableau résultant. - -[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/fr/sql_reference/aggregate_functions/parametric_functions.md b/docs/fr/sql_reference/aggregate_functions/parametric_functions.md deleted file mode 100644 index 7611c04b0de..00000000000 --- a/docs/fr/sql_reference/aggregate_functions/parametric_functions.md +++ /dev/null @@ -1,499 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 38 -toc_title: "Fonctions d'agr\xE9gat param\xE9triques" ---- - -# Fonctions D'Agrégat Paramétriques {#aggregate_functions_parametric} - -Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. - -## histogramme {#histogram} - -Calcule un histogramme adaptatif. Cela ne garantit pas des résultats précis. - -``` sql -histogram(number_of_bins)(values) -``` - -Les fonctions utilise [Un Algorithme D'Arbre De Décision Parallèle En Continu](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Les bordures des bacs d'histogramme sont ajustées au fur et à mesure que de nouvelles données entrent dans une fonction. Dans le cas courant, les largeurs des bacs ne sont pas égales. - -**Paramètre** - -`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. -`values` — [Expression](../syntax.md#syntax-expressions) résultant en valeurs d'entrée. - -**Valeurs renvoyées** - -- [Tableau](../../sql_reference/data_types/array.md) de [Tuple](../../sql_reference/data_types/tuple.md) de le format suivant: - - ``` - [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] - ``` - - - `lower` — Lower bound of the bin. - - `upper` — Upper bound of the bin. - - `height` — Calculated height of the bin. - -**Exemple** - -``` sql -SELECT histogram(5)(number + 1) -FROM ( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ -│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -Vous pouvez visualiser un histogramme avec la [bar](../../sql_reference/functions/other_functions.md#function-bar) fonction, par exemple: - -``` sql -WITH histogram(5)(rand() % 100) AS hist -SELECT - arrayJoin(hist).3 AS height, - bar(height, 0, 6, 5) AS bar -FROM -( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─height─┬─bar───┐ -│ 2.125 │ █▋ │ -│ 3.25 │ ██▌ │ -│ 5.625 │ ████▏ │ -│ 5.625 │ ████▏ │ -│ 3.375 │ ██▌ │ -└────────┴───────┘ -``` - -Dans ce cas, vous devez vous rappeler que vous ne connaissez pas les frontières de la corbeille d'histogramme. - -## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} - -Vérifie si la séquence contient une chaîne d'événements qui correspond au modèle. - -``` sql -sequenceMatch(pattern)(timestamp, cond1, cond2, ...) -``` - -!!! warning "Avertissement" - Les événements qui se produisent à la même seconde peuvent se situer dans la séquence dans un ordre indéfini affectant le résultat. - -**Paramètre** - -- `pattern` — Pattern string. See [Syntaxe du motif](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` et `DateTime`. Vous pouvez également utiliser les prises en charge [UInt](../../sql_reference/data_types/int_uint.md) types de données. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Vous pouvez passer jusqu'à 32 arguments de condition. La fonction ne prend en compte que les événements décrits dans ces conditions. Si la séquence contient des données qui ne sont pas décrites dans une condition, la fonction les ignore. - -**Valeurs renvoyées** - -- 1, si le profil correspond. -- 0, si le motif ne correspond pas. - -Type: `UInt8`. - - -**Syntaxe du motif** - -- `(?N)` — Matches the condition argument at position `N`. Les Conditions sont numérotées dans le `[1, 32]` gamme. Exemple, `(?1)` correspond à l'argument passé au `cond1` paramètre. - -- `.*` — Matches any number of events. You don't need conditional arguments to match this element of the pattern. - -- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` correspond à des événements qui se produisent plus de 1800 secondes les uns des autres. Un nombre arbitraire d'événements peut se trouver entre ces événements. Vous pouvez utiliser l' `>=`, `>`, `<`, `<=` opérateur. - -**Exemple** - -Considérer les données dans le `t` table: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -└──────┴────────┘ -``` - -Effectuer la requête: - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 1 │ -└───────────────────────────────────────────────────────────────────────┘ -``` - -La fonction a trouvé la chaîne d'événements où le numéro 2 suit le numéro 1. Il a sauté le numéro 3 entre eux, car le nombre n'est pas décrit comme un événement. Si nous voulons prendre ce nombre en compte lors de la recherche de l'événement de la chaîne donnée dans l'exemple, nous devrions en faire une condition. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ -│ 0 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -Dans ce cas, la fonction n'a pas pu trouver la chaîne d'événements correspondant au modèle, car l'événement pour le numéro 3 s'est produit entre 1 et 2. Si dans le même cas nous vérifions la condition pour le numéro 4, la séquence correspondrait au motif. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ -│ 1 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Voir Aussi** - -- [sequenceCount](#function-sequencecount) - -## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} - -Compte le nombre de chaînes d'événements correspondant au motif. La fonction recherche les chaînes d'événements qui ne se chevauchent pas. Il commence à rechercher la chaîne suivante après que la chaîne actuelle est appariée. - -!!! warning "Avertissement" - Les événements qui se produisent à la même seconde peuvent se situer dans la séquence dans un ordre indéfini affectant le résultat. - -``` sql -sequenceCount(pattern)(timestamp, cond1, cond2, ...) -``` - -**Paramètre** - -- `pattern` — Pattern string. See [Syntaxe du motif](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` et `DateTime`. Vous pouvez également utiliser les prises en charge [UInt](../../sql_reference/data_types/int_uint.md) types de données. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. Vous pouvez passer jusqu'à 32 arguments de condition. La fonction ne prend en compte que les événements décrits dans ces conditions. Si la séquence contient des données qui ne sont pas décrites dans une condition, la fonction les ignore. - -**Valeurs renvoyées** - -- Nombre de chaînes d'événements qui ne se chevauchent pas et qui sont mises en correspondance. - -Type: `UInt64`. - -**Exemple** - -Considérer les données dans le `t` table: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -│ 4 │ 1 │ -│ 5 │ 3 │ -│ 6 │ 2 │ -└──────┴────────┘ -``` - -Comptez combien de fois le nombre 2 se produit après le nombre 1 avec n'importe quelle quantité d'autres nombres entre eux: - -``` sql -SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 2 │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -**Voir Aussi** - -- [sequenceMatch](#function-sequencematch) - -## fenêtrefunnel {#windowfunnel} - -Recherche les chaînes d'événements dans une fenêtre de temps coulissante et calcule le nombre maximum d'événements qui se sont produits à partir de la chaîne. - -La fonction fonctionne selon l'algorithme: - -- La fonction recherche les données qui déclenchent la première condition de la chaîne et définit le compteur d'événements sur 1. C'est le moment où la fenêtre coulissante commence. - -- Si les événements de la chaîne se produisent séquentiellement dans la fenêtre, le compteur est incrémenté. Si la séquence d'événements est perturbée, le compteur n'est pas incrémenté. - -- Si les données ont plusieurs chaînes d'événements à différents points d'achèvement, la fonction affichera uniquement la taille de la chaîne la plus longue. - -**Syntaxe** - -``` sql -windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) -``` - -**Paramètre** - -- `window` — Length of the sliding window in seconds. -- `mode` - C'est un argument facultatif. - - `'strict'` - Lorsque le `'strict'` est défini, le windowFunnel() applique des conditions uniquement pour les valeurs uniques. -- `timestamp` — Name of the column containing the timestamp. Data types supported: [Date](../../sql_reference/data_types/date.md), [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) et d'autres types entiers non signés (notez que même si timestamp prend en charge le `UInt64` type, sa valeur ne peut pas dépasser le maximum Int64, qui est 2^63 - 1). -- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valeur renvoyée** - -Nombre maximal de conditions déclenchées consécutives de la chaîne dans la fenêtre de temps de glissement. -Toutes les chaînes de la sélection sont analysés. - -Type: `Integer`. - -**Exemple** - -Déterminer si une période de temps est suffisant pour l'utilisateur de sélectionner un téléphone et d'acheter deux fois dans la boutique en ligne. - -Définissez la chaîne d'événements suivante: - -1. L'utilisateur s'est connecté à son compte sur le magasin (`eventID = 1003`). -2. L'utilisateur recherche un téléphone (`eventID = 1007, product = 'phone'`). -3. Toute commande de l'utilisateur (`eventID = 1009`). -4. L'Utilisateur a fait la commande à nouveau (`eventID = 1010`). - -Table d'entrée: - -``` text -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -``` - -Savoir dans quelle mesure l'utilisateur `user_id` pourrait passer à travers la chaîne dans une période en Janvier-Février de 2019. - -Requête: - -``` sql -SELECT - level, - count() AS c -FROM -( - SELECT - user_id, - windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level - FROM trend - WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') - GROUP BY user_id -) -GROUP BY level -ORDER BY level ASC -``` - -Résultat: - -``` text -┌─level─┬─c─┐ -│ 4 │ 1 │ -└───────┴───┘ -``` - -## rétention {#retention} - -La fonction prend comme arguments un ensemble de conditions de 1 à 32 arguments de type `UInt8` qui indiquent si une certaine condition est remplie pour l'événement. -Toute condition peut être spécifiée comme argument (comme dans [WHERE](../../sql_reference/statements/select.md#select-where)). - -Les conditions, à l'exception de la première, s'appliquent par paires: le résultat de la seconde sera vrai si la première et la deuxième sont remplies, le troisième si la première et la fird sont vraies, etc. - -**Syntaxe** - -``` sql -retention(cond1, cond2, ..., cond32); -``` - -**Paramètre** - -- `cond` — an expression that returns a `UInt8` résultat (1 ou 0). - -**Valeur renvoyée** - -Le tableau de 1 ou 0. - -- 1 — condition was met for the event. -- 0 — condition wasn't met for the event. - -Type: `UInt8`. - -**Exemple** - -Prenons un exemple de calcul de la `retention` fonction pour déterminer le trafic du site. - -**1.** Сreate a table to illustrate an example. - -``` sql -CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; - -INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); -INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); -INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); -``` - -Table d'entrée: - -Requête: - -``` sql -SELECT * FROM retention_test -``` - -Résultat: - -``` text -┌───────date─┬─uid─┐ -│ 2020-01-01 │ 0 │ -│ 2020-01-01 │ 1 │ -│ 2020-01-01 │ 2 │ -│ 2020-01-01 │ 3 │ -│ 2020-01-01 │ 4 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-02 │ 0 │ -│ 2020-01-02 │ 1 │ -│ 2020-01-02 │ 2 │ -│ 2020-01-02 │ 3 │ -│ 2020-01-02 │ 4 │ -│ 2020-01-02 │ 5 │ -│ 2020-01-02 │ 6 │ -│ 2020-01-02 │ 7 │ -│ 2020-01-02 │ 8 │ -│ 2020-01-02 │ 9 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-03 │ 0 │ -│ 2020-01-03 │ 1 │ -│ 2020-01-03 │ 2 │ -│ 2020-01-03 │ 3 │ -│ 2020-01-03 │ 4 │ -│ 2020-01-03 │ 5 │ -│ 2020-01-03 │ 6 │ -│ 2020-01-03 │ 7 │ -│ 2020-01-03 │ 8 │ -│ 2020-01-03 │ 9 │ -│ 2020-01-03 │ 10 │ -│ 2020-01-03 │ 11 │ -│ 2020-01-03 │ 12 │ -│ 2020-01-03 │ 13 │ -│ 2020-01-03 │ 14 │ -└────────────┴─────┘ -``` - -**2.** Grouper les utilisateurs par ID unique `uid` à l'aide de la `retention` fonction. - -Requête: - -``` sql -SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r -FROM retention_test -WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') -GROUP BY uid -ORDER BY uid ASC -``` - -Résultat: - -``` text -┌─uid─┬─r───────┐ -│ 0 │ [1,1,1] │ -│ 1 │ [1,1,1] │ -│ 2 │ [1,1,1] │ -│ 3 │ [1,1,1] │ -│ 4 │ [1,1,1] │ -│ 5 │ [0,0,0] │ -│ 6 │ [0,0,0] │ -│ 7 │ [0,0,0] │ -│ 8 │ [0,0,0] │ -│ 9 │ [0,0,0] │ -│ 10 │ [0,0,0] │ -│ 11 │ [0,0,0] │ -│ 12 │ [0,0,0] │ -│ 13 │ [0,0,0] │ -│ 14 │ [0,0,0] │ -└─────┴─────────┘ -``` - -**3.** Calculer le nombre total de visites par jour. - -Requête: - -``` sql -SELECT - sum(r[1]) AS r1, - sum(r[2]) AS r2, - sum(r[3]) AS r3 -FROM -( - SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r - FROM retention_test - WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') - GROUP BY uid -) -``` - -Résultat: - -``` text -┌─r1─┬─r2─┬─r3─┐ -│ 5 │ 5 │ 5 │ -└────┴────┴────┘ -``` - -Où: - -- `r1`- le nombre de visiteurs uniques qui ont visité le site au cours du 2020-01-01 (le `cond1` condition). -- `r2`- le nombre de visiteurs uniques qui ont visité le site au cours d'une période donnée entre 2020-01-01 et 2020-01-02 (`cond1` et `cond2` condition). -- `r3`- le nombre de visiteurs uniques qui ont visité le site au cours d'une période donnée entre 2020-01-01 et 2020-01-03 (`cond1` et `cond3` condition). - -## uniqUpTo (N) (x) {#uniquptonx} - -Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. - -Recommandé pour une utilisation avec de petites Ns, jusqu'à 10. La valeur maximale de N est de 100. - -Pour l'état d'une fonction d'agrégation, il utilise la quantité de mémoire égale à 1 + N \* de la taille d'une valeur d'octets. -Pour les chaînes, il stocke un hachage non cryptographique de 8 octets. Soit le calcul est approchée pour les chaînes. - -La fonction fonctionne également pour plusieurs arguments. - -Cela fonctionne aussi vite que possible, sauf dans les cas où une grande valeur N est utilisée et le nombre de valeurs uniques est légèrement inférieur à N. - -Exemple d'utilisation: - -``` text -Problem: Generate a report that shows only keywords that produced at least 5 unique users. -Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) - -## sumMapFiltered(keys\_to\_keep) (clés, valeurs) {#summapfilteredkeys-to-keepkeys-values} - -Même comportement que [sumMap](reference.md#agg_functions-summap) sauf qu'un tableau de clés est passé en paramètre. Cela peut être particulièrement utile lorsque vous travaillez avec une forte cardinalité de touches. diff --git a/docs/fr/sql_reference/aggregate_functions/reference.md b/docs/fr/sql_reference/aggregate_functions/reference.md deleted file mode 100644 index 6a525bc37f6..00000000000 --- a/docs/fr/sql_reference/aggregate_functions/reference.md +++ /dev/null @@ -1,1837 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 36 -toc_title: "R\xE9f\xE9rence" ---- - -# La Fonction De Référence {#function-reference} - -## compter {#agg_function-count} - -Compte le nombre de lignes ou de valeurs non NULL. - -ClickHouse prend en charge les syntaxes suivantes pour `count`: -- `count(expr)` ou `COUNT(DISTINCT expr)`. -- `count()` ou `COUNT(*)`. Le `count()` la syntaxe est spécifique à ClickHouse. - -**Paramètre** - -La fonction peut prendre: - -- Zéro des paramètres. -- Un [expression](../syntax.md#syntax-expressions). - -**Valeur renvoyée** - -- Si la fonction est appelée sans paramètres, il compte le nombre de lignes. -- Si l' [expression](../syntax.md#syntax-expressions) est passé, alors la fonction compte combien de fois cette expression retournée not null. Si l'expression renvoie un [Nullable](../../sql_reference/data_types/nullable.md)- tapez la valeur, puis le résultat de `count` séjours pas `Nullable`. La fonction renvoie 0 si l'expression est retournée `NULL` pour toutes les lignes. - -Dans les deux cas le type de la valeur renvoyée est [UInt64](../../sql_reference/data_types/int_uint.md). - -**Détail** - -Clickhouse soutient le `COUNT(DISTINCT ...)` syntaxe. Le comportement de cette construction dépend de la [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) paramètre. Il définit lequel des [uniq\*](#agg_function-uniq) fonctions est utilisée pour effectuer l'opération. La valeur par défaut est la [uniqExact](#agg_function-uniqexact) fonction. - -Le `SELECT count() FROM table` la requête n'est pas optimisé, car le nombre d'entrées dans la table n'est pas stockée séparément. Il choisit une petite colonne de la table et compte le nombre de valeurs qu'il contient. - -**Exemple** - -Exemple 1: - -``` sql -SELECT count() FROM t -``` - -``` text -┌─count()─┐ -│ 5 │ -└─────────┘ -``` - -Exemple 2: - -``` sql -SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' -``` - -``` text -┌─name──────────────────────────┬─value─────┐ -│ count_distinct_implementation │ uniqExact │ -└───────────────────────────────┴───────────┘ -``` - -``` sql -SELECT count(DISTINCT num) FROM t -``` - -``` text -┌─uniqExact(num)─┐ -│ 3 │ -└────────────────┘ -``` - -Cet exemple montre que `count(DISTINCT num)` est effectuée par le `uniqExact` en fonction de l' `count_distinct_implementation` valeur de réglage. - -## tout(x) {#agg_function-any} - -Sélectionne la première valeur rencontrée. -La requête peut être exécutée dans n'importe quel ordre, et même dans un ordre différent à chaque fois, de sorte que le résultat de cette fonction est indéterminée. -Pour obtenir un résultat déterminé, vous pouvez utiliser le ‘min’ ou ‘max’ fonction au lieu de ‘any’. - -Dans certains cas, vous pouvez compter sur l'ordre de l'exécution. Cela s'applique aux cas où SELECT provient d'une sous-requête qui utilise ORDER BY. - -Lorsqu'un `SELECT` la requête a l' `GROUP BY` ou au moins une fonction d'agrégat, ClickHouse (contrairement à MySQL) exige que toutes les expressions du `SELECT`, `HAVING`, et `ORDER BY` clauses être calculée à partir de clés ou de fonctions d'agrégation. En d'autres termes, chaque colonne sélectionnée dans la table doit être utilisée soit dans les clés, soit dans les fonctions d'agrégation. Pour obtenir un comportement comme dans MySQL, vous pouvez mettre les autres colonnes dans le `any` fonction d'agrégation. - -## anyHeavy (x) {#anyheavyx} - -Sélectionne une valeur fréquente à l'aide [poids lourds](http://www.cs.umd.edu/~samir/498/karp.pdf) algorithme. S'il y a une valeur qui se produit plus de la moitié des cas dans chacun des threads d'exécution de la requête, cette valeur est renvoyée. Normalement, le résultat est non déterministe. - -``` sql -anyHeavy(column) -``` - -**Argument** - -- `column` – The column name. - -**Exemple** - -Prendre la [OnTime](../../getting_started/example_datasets/ontime.md) ensemble de données et sélectionnez n'importe quelle valeur `AirlineID` colonne. - -``` sql -SELECT anyHeavy(AirlineID) AS res -FROM ontime -``` - -``` text -┌───res─┐ -│ 19690 │ -└───────┘ -``` - -## anyLast (x) {#anylastx} - -Sélectionne la dernière valeur rencontrés. -Le résultat est tout aussi indéterminé que pour le `any` fonction. - -## groupBitAnd {#groupbitand} - -S'applique au niveau du BIT `AND` pour les séries de nombres. - -``` sql -groupBitAnd(expr) -``` - -**Paramètre** - -`expr` – An expression that results in `UInt*` type. - -**Valeur de retour** - -La valeur de la `UInt*` type. - -**Exemple** - -Des données de Test: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Requête: - -``` sql -SELECT groupBitAnd(num) FROM t -``` - -Où `num` est la colonne avec les données de test. - -Résultat: - -``` text -binary decimal -00000100 = 4 -``` - -## groupBitOr {#groupbitor} - -S'applique au niveau du BIT `OR` pour les séries de nombres. - -``` sql -groupBitOr(expr) -``` - -**Paramètre** - -`expr` – An expression that results in `UInt*` type. - -**Valeur de retour** - -La valeur de la `UInt*` type. - -**Exemple** - -Des données de Test: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Requête: - -``` sql -SELECT groupBitOr(num) FROM t -``` - -Où `num` est la colonne avec les données de test. - -Résultat: - -``` text -binary decimal -01111101 = 125 -``` - -## groupBitXor {#groupbitxor} - -S'applique au niveau du BIT `XOR` pour les séries de nombres. - -``` sql -groupBitXor(expr) -``` - -**Paramètre** - -`expr` – An expression that results in `UInt*` type. - -**Valeur de retour** - -La valeur de la `UInt*` type. - -**Exemple** - -Des données de Test: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Requête: - -``` sql -SELECT groupBitXor(num) FROM t -``` - -Où `num` est la colonne avec les données de test. - -Résultat: - -``` text -binary decimal -01101000 = 104 -``` - -## groupBitmap {#groupbitmap} - -Calculs Bitmap ou agrégés à partir d'une colonne entière non signée, retour cardinalité de type UInt64, si Ajouter suffixe-State, puis retour [objet bitmap](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmap(expr) -``` - -**Paramètre** - -`expr` – An expression that results in `UInt*` type. - -**Valeur de retour** - -La valeur de la `UInt64` type. - -**Exemple** - -Des données de Test: - -``` text -UserID -1 -1 -2 -3 -``` - -Requête: - -``` sql -SELECT groupBitmap(UserID) as num FROM t -``` - -Résultat: - -``` text -num -3 -``` - -## min (x) {#agg_function-min} - -Calcule le minimum. - -## max (x) {#agg_function-max} - -Calcule le maximum. - -## argMin (arg, val) {#agg-function-argmin} - -Calcule la ‘arg’ valeur pour un minimum ‘val’ valeur. S'il y a plusieurs valeurs différentes de ‘arg’ pour des valeurs minimales de ‘val’ la première de ces valeurs rencontrées est de sortie. - -**Exemple:** - -``` text -┌─user─────┬─salary─┐ -│ director │ 5000 │ -│ manager │ 3000 │ -│ worker │ 1000 │ -└──────────┴────────┘ -``` - -``` sql -SELECT argMin(user, salary) FROM salary -``` - -``` text -┌─argMin(user, salary)─┐ -│ worker │ -└──────────────────────┘ -``` - -## argMax(arg, val) {#agg-function-argmax} - -Calcule la ‘arg’ valeur pour un maximum ‘val’ valeur. S'il y a plusieurs valeurs différentes de ‘arg’ pour les valeurs maximales de ‘val’ la première de ces valeurs rencontrées est de sortie. - -## sum(x) {#agg_function-sum} - -Calcule la somme. -Ne fonctionne que pour les numéros. - -## sumWithOverflow (x) {#sumwithoverflowx} - -Calcule la somme des nombres, en utilisant le même type de données pour le résultat que pour les paramètres d'entrée. Si la somme dépasse la valeur maximale pour ce type de données, la fonction renvoie une erreur. - -Ne fonctionne que pour les numéros. - -## sumMap (clé, valeur) {#agg_functions-summap} - -Les totaux de la ‘value’ tableau selon les clés spécifiés dans le ‘key’ tableau. -Le nombre d'éléments dans ‘key’ et ‘value’ doit être identique pour chaque ligne totalisée. -Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. - -Exemple: - -``` sql -CREATE TABLE sum_map( - date Date, - timeslot DateTime, - statusMap Nested( - status UInt16, - requests UInt64 - ) -) ENGINE = Log; -INSERT INTO sum_map VALUES - ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); -SELECT - timeslot, - sumMap(statusMap.status, statusMap.requests) -FROM sum_map -GROUP BY timeslot -``` - -``` text -┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ -│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ -│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ -└─────────────────────┴──────────────────────────────────────────────┘ -``` - -## skewPop {#skewpop} - -Calcule la [asymétrie](https://en.wikipedia.org/wiki/Skewness) d'une séquence. - -``` sql -skewPop(expr) -``` - -**Paramètre** - -`expr` — [Expression](../syntax.md#syntax-expressions) retour d'un nombre. - -**Valeur renvoyée** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**Exemple** - -``` sql -SELECT skewPop(value) FROM series_with_value_column -``` - -## skewSamp {#skewsamp} - -Calcule la [asymétrie de l'échantillon](https://en.wikipedia.org/wiki/Skewness) d'une séquence. - -Il représente une estimation non biaisée de l'asymétrie d'une variable aléatoire si les valeurs passées forme de son échantillon. - -``` sql -skewSamp(expr) -``` - -**Paramètre** - -`expr` — [Expression](../syntax.md#syntax-expressions) retour d'un nombre. - -**Valeur renvoyée** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). Si `n <= 1` (`n` est la taille de l'échantillon), alors la fonction renvoie `nan`. - -**Exemple** - -``` sql -SELECT skewSamp(value) FROM series_with_value_column -``` - -## kurtPop {#kurtpop} - -Calcule la [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) d'une séquence. - -``` sql -kurtPop(expr) -``` - -**Paramètre** - -`expr` — [Expression](../syntax.md#syntax-expressions) retour d'un nombre. - -**Valeur renvoyée** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**Exemple** - -``` sql -SELECT kurtPop(value) FROM series_with_value_column -``` - -## kurtSamp {#kurtsamp} - -Calcule la [l'échantillon le coefficient d'aplatissement](https://en.wikipedia.org/wiki/Kurtosis) d'une séquence. - -Il représente une estimation non biaisée de la kurtose d'une variable aléatoire si les valeurs passées forment son échantillon. - -``` sql -kurtSamp(expr) -``` - -**Paramètre** - -`expr` — [Expression](../syntax.md#syntax-expressions) retour d'un nombre. - -**Valeur renvoyée** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). Si `n <= 1` (`n` la taille de l'échantillon), alors la fonction renvoie `nan`. - -**Exemple** - -``` sql -SELECT kurtSamp(value) FROM series_with_value_column -``` - -## timeSeriesGroupSum(uid, horodatage, valeur) {#agg-function-timeseriesgroupsum} - -`timeSeriesGroupSum` peut agréger différentes séries temporelles qui échantillonnent l'horodatage et non l'alignement. -Il utilisera une interpolation linéaire entre deux échantillons d'horodatage, puis additionnera les séries temporelles ensemble. - -- `uid` la série temporelle est elle unique, `UInt64`. -- `timestamp` est de type Int64 afin de prendre en charge la milliseconde ou la microseconde. -- `value` est la métrique. - -La fonction renvoie un tableau de tuples avec `(timestamp, aggregated_value)` pair. - -Avant d'utiliser cette fonction, assurez-vous `timestamp` est dans l'ordre croissant. - -Exemple: - -``` text -┌─uid─┬─timestamp─┬─value─┐ -│ 1 │ 2 │ 0.2 │ -│ 1 │ 7 │ 0.7 │ -│ 1 │ 12 │ 1.2 │ -│ 1 │ 17 │ 1.7 │ -│ 1 │ 25 │ 2.5 │ -│ 2 │ 3 │ 0.6 │ -│ 2 │ 8 │ 1.6 │ -│ 2 │ 12 │ 2.4 │ -│ 2 │ 18 │ 3.6 │ -│ 2 │ 24 │ 4.8 │ -└─────┴───────────┴───────┘ -``` - -``` sql -CREATE TABLE time_series( - uid UInt64, - timestamp Int64, - value Float64 -) ENGINE = Memory; -INSERT INTO time_series VALUES - (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), - (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); - -SELECT timeSeriesGroupSum(uid, timestamp, value) -FROM ( - SELECT * FROM time_series order by timestamp ASC -); -``` - -Et le résultat sera: - -``` text -[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] -``` - -## timeSeriesGroupRateSum(uid, ts, val) {#agg-function-timeseriesgroupratesum} - -De même timeSeriesGroupRateSum, timeSeriesGroupRateSum calculera le taux de séries temporelles, puis additionnera les taux ensemble. -En outre, l'horodatage doit être dans l'ordre croissant avant d'utiliser cette fonction. - -Utilisez cette fonction, le résultat ci-dessus sera: - -``` text -[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] -``` - -## avg (x) {#agg_function-avg} - -Calcule la moyenne. -Ne fonctionne que pour les numéros. -Le résultat est toujours Float64. - -## uniq {#agg_function-uniq} - -Calcule le nombre approximatif des différentes valeurs de l'argument. - -``` sql -uniq(x[, ...]) -``` - -**Paramètre** - -La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. - -**Valeur renvoyée** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)numéro de type. - -**Détails de mise en œuvre** - -Fonction: - -- Calcule un hachage pour tous les paramètres de l'agrégat, puis l'utilise dans les calculs. - -- Utilise un algorithme d'échantillonnage adaptatif. Pour l'état de calcul, La fonction utilise un échantillon de valeurs de hachage d'éléments jusqu'à 65536. - - This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. - -- Fournit le résultat de manière déterministe (cela ne dépend pas de l'ordre de traitement de la requête). - -Nous vous recommandons d'utiliser cette fonction dans presque tous les scénarios. - -**Voir Aussi** - -- [uniqcombiné](#agg_function-uniqcombined) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqcombiné {#agg_function-uniqcombined} - -Calcule le nombre approximatif de différentes valeurs d'argument. - -``` sql -uniqCombined(HLL_precision)(x[, ...]) -``` - -Le `uniqCombined` la fonction est un bon choix pour calculer le nombre de valeurs différentes. - -**Paramètre** - -La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. - -`HLL_precision` est le logarithme en base 2 du nombre de cellules dans [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). Facultatif, vous pouvez utiliser la fonction comme `uniqCombined(x[, ...])`. La valeur par défaut pour `HLL_precision` est 17, qui est effectivement 96 Ko d'espace(2 ^ 17 cellules, 6 bits chacune). - -**Valeur renvoyée** - -- Nombre [UInt64](../../sql_reference/data_types/int_uint.md)numéro de type. - -**Détails de mise en œuvre** - -Fonction: - -- Calcule un hachage (hachage 64 bits pour `String` et 32 bits sinon) pour tous les paramètres dans l'agrégat, puis l'utilise dans les calculs. - -- Utilise une combinaison de trois algorithmes: tableau, table de hachage et HyperLogLog avec une table de correction d'erreur. - - For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. - -- Fournit le résultat de manière déterministe (cela ne dépend pas de l'ordre de traitement de la requête). - -!!! note "Note" - Comme il utilise le hachage 32 bits pour non-`String` type, le résultat aura une erreur très élevée pour les cardinalités significativement plus grandes que `UINT_MAX` (erreur va augmenter rapidement après quelques dizaines de milliards de valeurs distinctes), donc dans ce cas, vous devez utiliser [uniqCombined64](#agg_function-uniqcombined64) - -Par rapport à la [uniq](#agg_function-uniq) la fonction, la `uniqCombined`: - -- Consomme plusieurs fois moins de mémoire. -- Calcule avec plusieurs fois plus de précision. -- A généralement des performances légèrement inférieures. Dans certains scénarios, `uniqCombined` peut faire mieux que `uniq` par exemple, avec des requêtes distribuées qui transmettent un grand nombre d'agrégation des états sur le réseau. - -**Voir Aussi** - -- [uniq](#agg_function-uniq) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined64 {#agg_function-uniqcombined64} - -Même que [uniqcombiné](#agg_function-uniqcombined), mais utilise le hachage 64 bits pour tous les types de données. - -## uniqHLL12 {#agg_function-uniqhll12} - -Calcule le nombre approximatif de différentes valeurs d'argument, en utilisant [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) algorithme. - -``` sql -uniqHLL12(x[, ...]) -``` - -**Paramètre** - -La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. - -**Valeur renvoyée** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)numéro de type. - -**Détails de mise en œuvre** - -Fonction: - -- Calcule un hachage pour tous les paramètres de l'agrégat, puis l'utilise dans les calculs. - -- Utilise L'algorithme HyperLogLog pour approximer le nombre de valeurs d'argument différentes. - - 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). - -- Fournit le résultat déterminé (il ne dépend pas de l'ordre de traitement de la requête). - -Nous ne recommandons pas d'utiliser cette fonction. Dans la plupart des cas, l'utilisation de la [uniq](#agg_function-uniq) ou [uniqcombiné](#agg_function-uniqcombined) fonction. - -**Voir Aussi** - -- [uniq](#agg_function-uniq) -- [uniqcombiné](#agg_function-uniqcombined) -- [uniqExact](#agg_function-uniqexact) - -## uniqExact {#agg_function-uniqexact} - -Calcule le nombre exact de différentes valeurs d'argument. - -``` sql -uniqExact(x[, ...]) -``` - -L'utilisation de la `uniqExact` fonction si vous avez absolument besoin d'un résultat exact. Sinon l'utilisation de la [uniq](#agg_function-uniq) fonction. - -Le `uniqExact` la fonction utilise plus de mémoire que `uniq` parce que la taille de l'état a surabondance de croissance que le nombre de valeurs différentes augmente. - -**Paramètre** - -La fonction prend un nombre variable de paramètres. Les paramètres peuvent être `Tuple`, `Array`, `Date`, `DateTime`, `String` ou des types numériques. - -**Voir Aussi** - -- [uniq](#agg_function-uniq) -- [uniqcombiné](#agg_function-uniqcombined) -- [uniqHLL12](#agg_function-uniqhll12) - -## groupArray(x), groupArray (max\_size) (x) {#agg_function-grouparray} - -Crée un tableau de valeurs de l'argument. -Les valeurs peuvent être ajoutées au tableau dans une (indéterminée) de commande. - -La deuxième version (avec le `max_size` paramètre) limite la taille du tableau résultant à `max_size` élément. -Exemple, `groupArray (1) (x)` est équivalent à `[any (x)]`. - -Dans certains cas, vous pouvez toujours compter sur l'ordre de l'exécution. Cela s'applique aux cas où `SELECT` provient d'une sous-requête qui utilise `ORDER BY`. - -## groupeparrayinsertat(valeur, position) {#grouparrayinsertatvalue-position} - -Insère une valeur dans le tableau à la position spécifiée. - -!!! note "Note" - Cette fonction utilise des positions à base zéro, contrairement aux positions à base unique classiques pour les tableaux SQL. - -Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. - -Paramètres facultatifs: - -- Valeur par défaut pour la substitution dans des positions vides. -- La longueur du tableau résultant. Cela vous permet de recevoir des tableaux de la même taille pour tous les agrégats clés. Lorsque vous utilisez ce paramètre, la valeur par défaut doit être spécifiée. - -## groupeparraymovingsum {#agg_function-grouparraymovingsum} - -Calcule la somme mobile des valeurs d'entrée. - -``` sql -groupArrayMovingSum(numbers_for_summing) -groupArrayMovingSum(window_size)(numbers_for_summing) -``` - -La fonction peut prendre la taille de la fenêtre comme paramètre. Si spécifié, la fonction prend la taille de la fenêtre égal au nombre de lignes dans la colonne. - -**Paramètre** - -- `numbers_for_summing` — [Expression](../syntax.md#syntax-expressions) résultant en une valeur de type de données Numérique. -- `window_size` — Size of the calculation window. - -**Valeurs renvoyées** - -- Tableau de la même taille et de même type que les données d'entrée. - -**Exemple** - -La table d'échantillon: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Requête: - -``` sql -SELECT - groupArrayMovingSum(int) AS I, - groupArrayMovingSum(float) AS F, - groupArrayMovingSum(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingSum(2)(int) AS I, - groupArrayMovingSum(2)(float) AS F, - groupArrayMovingSum(2)(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -## groupArrayMovingAvg {#agg_function-grouparraymovingavg} - -Calcule la moyenne mobile des valeurs d'entrée. - -``` sql -groupArrayMovingAvg(numbers_for_summing) -groupArrayMovingAvg(window_size)(numbers_for_summing) -``` - -La fonction peut prendre la taille de la fenêtre comme paramètre. Si spécifié, la fonction prend la taille de la fenêtre égal au nombre de lignes dans la colonne. - -**Paramètre** - -- `numbers_for_summing` — [Expression](../syntax.md#syntax-expressions) résultant en une valeur de type de données Numérique. -- `window_size` — Size of the calculation window. - -**Valeurs renvoyées** - -- Tableau de la même taille et de même type que les données d'entrée. - -La fonction utilise [l'arrondi vers zéro](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). Il tronque les décimales insignifiantes pour le type de données résultant. - -**Exemple** - -La table d'échantillon `b`: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Requête: - -``` sql -SELECT - groupArrayMovingAvg(int) AS I, - groupArrayMovingAvg(float) AS F, - groupArrayMovingAvg(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ -│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ -└───────────┴─────────────────────────────────────┴───────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingAvg(2)(int) AS I, - groupArrayMovingAvg(2)(float) AS F, - groupArrayMovingAvg(2)(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ -│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ -└───────────┴──────────────────────────────────┴───────────────────────┘ -``` - -## groupUniqArray(x), groupUniqArray (max\_size) (x) {#groupuniqarrayx-groupuniqarraymax-sizex} - -Crée un tableau à partir de différentes valeurs d'argument. La consommation de mémoire est la même que pour la `uniqExact` fonction. - -La deuxième version (avec le `max_size` paramètre) limite la taille du tableau résultant à `max_size` élément. -Exemple, `groupUniqArray(1)(x)` est équivalent à `[any(x)]`. - -## quantile {#quantile} - -Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. - -Cette fonction s'applique [réservoir d'échantillonnage](https://en.wikipedia.org/wiki/Reservoir_sampling) avec une taille de réservoir jusqu'à 8192 et un générateur de nombres aléatoires pour l'échantillonnage. Le résultat est non-déterministe. Pour obtenir un quantile exact, Utilisez le [quantileExact](#quantileexact) fonction. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantile(level)(expr) -``` - -Alias: `median`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [types de données](../../sql_reference/data_types/index.md#data_types), [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). - -**Valeur renvoyée** - -- Approximative de quantiles de niveau spécifié. - -Type: - -- [Float64](../../sql_reference/data_types/float.md) pour l'entrée de type de données numériques. -- [Date](../../sql_reference/data_types/date.md) si les valeurs d'entrée ont le `Date` type. -- [DateTime](../../sql_reference/data_types/datetime.md) si les valeurs d'entrée ont le `DateTime` type. - -**Exemple** - -Table d'entrée: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Requête: - -``` sql -SELECT quantile(val) FROM t -``` - -Résultat: - -``` text -┌─quantile(val)─┐ -│ 1.5 │ -└───────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## quantileDeterministic {#quantiledeterministic} - -Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. - -Cette fonction s'applique [réservoir d'échantillonnage](https://en.wikipedia.org/wiki/Reservoir_sampling) avec une taille de réservoir jusqu'à 8192 et un algorithme déterministe d'échantillonnage. Le résultat est déterministe. Pour obtenir un quantile exact, Utilisez le [quantileExact](#quantileexact) fonction. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantileDeterministic(level)(expr, determinator) -``` - -Alias: `medianDeterministic`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [types de données](../../sql_reference/data_types/index.md#data_types), [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). -- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. - -**Valeur renvoyée** - -- Approximative de quantiles de niveau spécifié. - -Type: - -- [Float64](../../sql_reference/data_types/float.md) pour l'entrée de type de données numériques. -- [Date](../../sql_reference/data_types/date.md) si les valeurs d'entrée ont le `Date` type. -- [DateTime](../../sql_reference/data_types/datetime.md) si les valeurs d'entrée ont le `DateTime` type. - -**Exemple** - -Table d'entrée: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Requête: - -``` sql -SELECT quantileDeterministic(val, 1) FROM t -``` - -Résultat: - -``` text -┌─quantileDeterministic(val, 1)─┐ -│ 1.5 │ -└───────────────────────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## quantileExact {#quantileexact} - -Exactement calcule l' [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` de mémoire, où `n` est un nombre de valeurs qui ont été passées. Cependant, pour un petit nombre de valeurs, la fonction est très efficace. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantileExact(level)(expr) -``` - -Alias: `medianExact`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [types de données](../../sql_reference/data_types/index.md#data_types), [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). - -**Valeur renvoyée** - -- Quantiles de niveau spécifié. - -Type: - -- [Float64](../../sql_reference/data_types/float.md) pour l'entrée de type de données numériques. -- [Date](../../sql_reference/data_types/date.md) si les valeurs d'entrée ont le `Date` type. -- [DateTime](../../sql_reference/data_types/datetime.md) si les valeurs d'entrée ont le `DateTime` type. - -**Exemple** - -Requête: - -``` sql -SELECT quantileExact(number) FROM numbers(10) -``` - -Résultat: - -``` text -┌─quantileExact(number)─┐ -│ 5 │ -└───────────────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## quantileExactWeighted {#quantileexactweighted} - -Exactement calcule l' [quantile](https://en.wikipedia.org/wiki/Quantile) d'une séquence de données numériques, en tenant compte du poids de chaque élément. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). Vous pouvez utiliser cette fonction au lieu de `quantileExact` et spécifiez le poids 1. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantileExactWeighted(level)(expr, weight) -``` - -Alias: `medianExactWeighted`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [types de données](../../sql_reference/data_types/index.md#data_types), [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. - -**Valeur renvoyée** - -- Quantiles de niveau spécifié. - -Type: - -- [Float64](../../sql_reference/data_types/float.md) pour l'entrée de type de données numériques. -- [Date](../../sql_reference/data_types/date.md) si les valeurs d'entrée ont le `Date` type. -- [DateTime](../../sql_reference/data_types/datetime.md) si les valeurs d'entrée ont le `DateTime` type. - -**Exemple** - -Table d'entrée: - -``` text -┌─n─┬─val─┐ -│ 0 │ 3 │ -│ 1 │ 2 │ -│ 2 │ 1 │ -│ 5 │ 4 │ -└───┴─────┘ -``` - -Requête: - -``` sql -SELECT quantileExactWeighted(n, val) FROM t -``` - -Résultat: - -``` text -┌─quantileExactWeighted(n, val)─┐ -│ 1 │ -└───────────────────────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## quantileTiming {#quantiletiming} - -Avec la précision déterminée calcule le [quantile](https://en.wikipedia.org/wiki/Quantile) des données numériques de la séquence. - -Le résultat est déterministe (il ne dépend pas de l'ordre de traitement de la requête). La fonction est optimisée pour travailler avec des séquences qui décrivent des distributions comme les temps de chargement des pages web ou les temps de réponse du backend. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantileTiming(level)(expr) -``` - -Alias: `medianTiming`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). - -- `expr` — [Expression](../syntax.md#syntax-expressions) sur une colonne Valeurs renvoyant un [Flottant\*](../../sql_reference/data_types/float.md)numéro de type. - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -**Exactitude** - -Le calcul est précis si: - -- Le nombre Total de valeurs ne dépasse pas 5670. -- Le nombre Total de valeurs dépasse 5670, mais le temps de chargement de la page est inférieur à 1024ms. - -Sinon, le résultat du calcul est arrondi au plus proche multiple de 16 ms. - -!!! note "Note" - Pour calculer les quantiles de temps de chargement de page, cette fonction est plus efficace et précise que [quantile](#quantile). - -**Valeur renvoyée** - -- Quantiles de niveau spécifié. - -Type: `Float32`. - -!!! note "Note" - Si aucune valeur n'est transmise à la fonction (lors de l'utilisation de `quantileTimingIf`), [Nan](../../sql_reference/data_types/float.md#data_type-float-nan-inf) est retourné. Le but est de différencier ces cas de cas qui aboutissent à zéro. Voir [Clause ORDER BY](../statements/select.md#select-order-by) pour des notes sur le tri `NaN` valeur. - -**Exemple** - -Table d'entrée: - -``` text -┌─response_time─┐ -│ 72 │ -│ 112 │ -│ 126 │ -│ 145 │ -│ 104 │ -│ 242 │ -│ 313 │ -│ 168 │ -│ 108 │ -└───────────────┘ -``` - -Requête: - -``` sql -SELECT quantileTiming(response_time) FROM t -``` - -Résultat: - -``` text -┌─quantileTiming(response_time)─┐ -│ 126 │ -└───────────────────────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## quantileTimingWeighted {#quantiletimingweighted} - -Avec la précision déterminée calcule le [quantile](https://en.wikipedia.org/wiki/Quantile) d'une séquence de données numériques en fonction du poids de chaque élément de séquence. - -Le résultat est déterministe (il ne dépend pas de l'ordre de traitement de la requête). La fonction est optimisée pour travailler avec des séquences qui décrivent des distributions comme les temps de chargement des pages web ou les temps de réponse du backend. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantileTimingWeighted(level)(expr, weight) -``` - -Alias: `medianTimingWeighted`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). - -- `expr` — [Expression](../syntax.md#syntax-expressions) sur une colonne Valeurs renvoyant un [Flottant\*](../../sql_reference/data_types/float.md)numéro de type. - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**Exactitude** - -Le calcul est précis si: - -- Le nombre Total de valeurs ne dépasse pas 5670. -- Le nombre Total de valeurs dépasse 5670, mais le temps de chargement de la page est inférieur à 1024ms. - -Sinon, le résultat du calcul est arrondi au plus proche multiple de 16 ms. - -!!! note "Note" - Pour calculer les quantiles de temps de chargement de page, cette fonction est plus efficace et précise que [quantile](#quantile). - -**Valeur renvoyée** - -- Quantiles de niveau spécifié. - -Type: `Float32`. - -!!! note "Note" - Si aucune valeur n'est transmise à la fonction (lors de l'utilisation de `quantileTimingIf`), [Nan](../../sql_reference/data_types/float.md#data_type-float-nan-inf) est retourné. Le but est de différencier ces cas de cas qui aboutissent à zéro. Voir [Clause ORDER BY](../statements/select.md#select-order-by) pour des notes sur le tri `NaN` valeur. - -**Exemple** - -Table d'entrée: - -``` text -┌─response_time─┬─weight─┐ -│ 68 │ 1 │ -│ 104 │ 2 │ -│ 112 │ 3 │ -│ 126 │ 2 │ -│ 138 │ 1 │ -│ 162 │ 1 │ -└───────────────┴────────┘ -``` - -Requête: - -``` sql -SELECT quantileTimingWeighted(response_time, weight) FROM t -``` - -Résultat: - -``` text -┌─quantileTimingWeighted(response_time, weight)─┐ -│ 112 │ -└───────────────────────────────────────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## quantileTDigest {#quantiletdigest} - -Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) d'une séquence de données numériques utilisant [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algorithme. - -L'erreur maximale est de 1%. La consommation de mémoire est `log(n)`, où `n` est un certain nombre de valeurs. Le résultat dépend de l'ordre d'exécution de la requête et n'est pas déterministe. - -La performance de la fonction est inférieure à la performance de [quantile](#quantile) ou [quantileTiming](#quantiletiming). En termes de rapport entre la taille de L'état et la précision, cette fonction est bien meilleure que `quantile`. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantileTDigest(level)(expr) -``` - -Alias: `medianTDigest`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [types de données](../../sql_reference/data_types/index.md#data_types), [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). - -**Valeur renvoyée** - -- Approximative de quantiles de niveau spécifié. - -Type: - -- [Float64](../../sql_reference/data_types/float.md) pour l'entrée de type de données numériques. -- [Date](../../sql_reference/data_types/date.md) si les valeurs d'entrée ont le `Date` type. -- [DateTime](../../sql_reference/data_types/datetime.md) si les valeurs d'entrée ont le `DateTime` type. - -**Exemple** - -Requête: - -``` sql -SELECT quantileTDigest(number) FROM numbers(10) -``` - -Résultat: - -``` text -┌─quantileTDigest(number)─┐ -│ 4.5 │ -└─────────────────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## quantileTDigestWeighted {#quantiletdigestweighted} - -Calcule une approximation [quantile](https://en.wikipedia.org/wiki/Quantile) d'une séquence de données numériques utilisant [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algorithme. La fonction prend en compte le poids de chaque séquence de membre. L'erreur maximale est de 1%. La consommation de mémoire est `log(n)`, où `n` est un certain nombre de valeurs. - -La performance de la fonction est inférieure à la performance de [quantile](#quantile) ou [quantileTiming](#quantiletiming). En termes de rapport entre la taille de L'état et la précision, cette fonction est bien meilleure que `quantile`. - -Le résultat dépend de l'ordre d'exécution de la requête et n'est pas déterministe. - -Lorsque vous utilisez plusieurs `quantile*` fonctionne avec différents niveaux dans une requête, les états internes ne sont pas combinées (qui est, la requête fonctionne moins efficacement qu'il le pouvait). Dans ce cas, utilisez la [les quantiles](#quantiles) fonction. - -**Syntaxe** - -``` sql -quantileTDigest(level)(expr) -``` - -Alias: `medianTDigest`. - -**Paramètre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` la valeur dans la plage de `[0.01, 0.99]`. Valeur par défaut: 0.5. À `level=0.5` la fonction calcule [médian](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [types de données](../../sql_reference/data_types/index.md#data_types), [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**Valeur renvoyée** - -- Approximative de quantiles de niveau spécifié. - -Type: - -- [Float64](../../sql_reference/data_types/float.md) pour l'entrée de type de données numériques. -- [Date](../../sql_reference/data_types/date.md) si les valeurs d'entrée ont le `Date` type. -- [DateTime](../../sql_reference/data_types/datetime.md) si les valeurs d'entrée ont le `DateTime` type. - -**Exemple** - -Requête: - -``` sql -SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) -``` - -Résultat: - -``` text -┌─quantileTDigestWeighted(number, 1)─┐ -│ 4.5 │ -└────────────────────────────────────┘ -``` - -**Voir Aussi** - -- [médian](#median) -- [les quantiles](#quantiles) - -## médian {#median} - -Le `median*` les fonctions sont les Alias pour le correspondant `quantile*` fonction. Ils calculent la médiane d'un échantillon de données numériques. - -Fonction: - -- `median` — Alias for [quantile](#quantile). -- `medianDeterministic` — Alias for [quantileDeterministic](#quantiledeterministic). -- `medianExact` — Alias for [quantileExact](#quantileexact). -- `medianExactWeighted` — Alias for [quantileExactWeighted](#quantileexactweighted). -- `medianTiming` — Alias for [quantileTiming](#quantiletiming). -- `medianTimingWeighted` — Alias for [quantileTimingWeighted](#quantiletimingweighted). -- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). -- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). - -**Exemple** - -Table d'entrée: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Requête: - -``` sql -SELECT medianDeterministic(val, 1) FROM t -``` - -Résultat: - -``` text -┌─medianDeterministic(val, 1)─┐ -│ 1.5 │ -└─────────────────────────────┘ -``` - -## quantiles(level1, level2, …)(x) {#quantiles} - -Toutes les fonctions quantiles ont également des fonctions quantiles correspondantes: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Ces fonctions calculent tous les quantiles des niveaux listés en une seule passe et renvoient un tableau des valeurs résultantes. - -## varSamp (x) {#varsampx} - -Calcule le montant `Σ((x - x̅)^2) / (n - 1)`, où `n` est la taille de l'échantillon et `x̅`est la valeur moyenne de `x`. - -Il représente une estimation non biaisée de la variance d'une variable aléatoire si les valeurs passées forment son échantillon. - -Retourner `Float64`. Lorsque `n <= 1`, retourner `+∞`. - -## varPop (x) {#varpopx} - -Calcule le montant `Σ((x - x̅)^2) / n`, où `n` est la taille de l'échantillon et `x̅`est la valeur moyenne de `x`. - -En d'autres termes, dispersion pour un ensemble de valeurs. Retourner `Float64`. - -## stddevSamp (x) {#stddevsampx} - -Le résultat est égal à la racine carrée de `varSamp(x)`. - -## stddevPop (x) {#stddevpopx} - -Le résultat est égal à la racine carrée de `varPop(x)`. - -## topK (N) (x) {#topknx} - -Renvoie un tableau des valeurs approximativement les plus fréquentes dans la colonne spécifiée. Le tableau est trié par ordre décroissant de fréquence approximative des valeurs (et non par les valeurs elles-mêmes). - -Met en œuvre la [Gain De Place Filtré](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) algorithme d'analyse de TopK, basé sur l'algorithme de réduction et de combinaison de [Économie D'Espace Parallèle](https://arxiv.org/pdf/1401.0702.pdf). - -``` sql -topK(N)(column) -``` - -Cette fonction ne fournit pas un résultat garanti. Dans certaines situations, des erreurs peuvent se produire et renvoyer des valeurs fréquentes qui ne sont pas les valeurs les plus fréquentes. - -Nous vous recommandons d'utiliser l' `N < 10` valeur; performance est réduite avec grand `N` valeur. Valeur maximale de `N = 65536`. - -**Paramètre** - -- ‘N’ est le nombre d'éléments de retour. - -Si le paramètre est omis, la valeur par défaut 10 est utilisé. - -**Argument** - -- ' x ' – The value to calculate frequency. - -**Exemple** - -Prendre la [OnTime](../../getting_started/example_datasets/ontime.md) ensemble de données et sélectionnez les trois valeurs les plus fréquentes `AirlineID` colonne. - -``` sql -SELECT topK(3)(AirlineID) AS res -FROM ontime -``` - -``` text -┌─res─────────────────┐ -│ [19393,19790,19805] │ -└─────────────────────┘ -``` - -## topKWeighted {#topkweighted} - -Semblable à `topK` mais prend un argument de type entier - `weight`. Chaque valeur est comptabilisée `weight` les temps de calcul de fréquence. - -**Syntaxe** - -``` sql -topKWeighted(N)(x, weight) -``` - -**Paramètre** - -- `N` — The number of elements to return. - -**Argument** - -- `x` – The value. -- `weight` — The weight. [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valeur renvoyée** - -Renvoie un tableau des valeurs avec la somme approximative maximale des poids. - -**Exemple** - -Requête: - -``` sql -SELECT topKWeighted(10)(number, number) FROM numbers(1000) -``` - -Résultat: - -``` text -┌─topKWeighted(10)(number, number)──────────┐ -│ [999,998,997,996,995,994,993,992,991,990] │ -└───────────────────────────────────────────┘ -``` - -## covarSamp(x, y) {#covarsampx-y} - -Calcule la valeur de `Σ((x - x̅)(y - y̅)) / (n - 1)`. - -Renvoie Float64. Lorsque `n <= 1`, returns +∞. - -## covarPop (x, y) {#covarpopx-y} - -Calcule la valeur de `Σ((x - x̅)(y - y̅)) / n`. - -## corr (x, y) {#corrx-y} - -Calcule le coefficient de corrélation de Pearson: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. - -## categoricalInformationValue {#categoricalinformationvalue} - -Calcule la valeur de `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` pour chaque catégorie. - -``` sql -categoricalInformationValue(category1, category2, ..., tag) -``` - -Le résultat indique comment une caractéristique discrète (catégorique) `[category1, category2, ...]` contribuer à un modèle d'apprentissage qui prédit la valeur de `tag`. - -## simplelineearregression {#simplelinearregression} - -Effectue une régression linéaire simple (unidimensionnelle). - -``` sql -simpleLinearRegression(x, y) -``` - -Paramètre: - -- `x` — Column with dependent variable values. -- `y` — Column with explanatory variable values. - -Valeurs renvoyées: - -Constant `(a, b)` de la ligne `y = a*x + b`. - -**Exemple** - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ -│ (1,0) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ -│ (1,3) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## stochasticLinearRegression {#agg_functions-stochasticlinearregression} - -Cette fonction implémente la régression linéaire stochastique. Il prend en charge les paramètres personnalisés pour le taux d'apprentissage, le coefficient de régularisation L2, la taille de mini-lot et a peu de méthodes pour mettre à jour les poids ([Adam](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (utilisé par défaut), [simple SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Élan](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). - -### Paramètre {#agg_functions-stochasticlinearregression-parameters} - -Il y a 4 paramètres personnalisables. Ils sont passés à la fonction séquentiellement, mais il n'est pas nécessaire de passer tous les quatre-les valeurs par défaut seront utilisées, mais un bon modèle nécessite un réglage des paramètres. - -``` text -stochasticLinearRegression(1.0, 1.0, 10, 'SGD') -``` - -1. `learning rate` est le coefficient sur la longueur de l'étape, lorsque l'étape de descente de gradient est effectuée. Un taux d'apprentissage trop élevé peut entraîner des poids infinis du modèle. Par défaut est `0.00001`. -2. `l2 regularization coefficient` ce qui peut aider à éviter le surajustement. Par défaut est `0.1`. -3. `mini-batch size` définit le nombre d'éléments, dont les gradients seront calculés et additionnés pour effectuer une étape de descente de gradient. La descente stochastique Pure utilise un élément, mais avoir de petits lots (environ 10 éléments) rend les étapes de gradient plus stables. Par défaut est `15`. -4. `method for updating weights` ils sont: `Adam` (par défaut), `SGD`, `Momentum`, `Nesterov`. `Momentum` et `Nesterov` nécessitent un peu plus de calculs et de mémoire, mais ils sont utiles en termes de vitesse de convergence et de stabilité des méthodes de gradient stochastique. - -### Utilisation {#agg_functions-stochasticlinearregression-usage} - -`stochasticLinearRegression` est utilisé en deux étapes: ajustement du modèle et prédiction sur de nouvelles données. Afin de correspondre le modèle et l'enregistrer son état pour utilisation ultérieure nous utilisons `-State` combinator, qui enregistre essentiellement l'état (poids du modèle, etc.). -Pour prédire nous utilisons la fonction [evalMLMethod](../functions/machine_learning_functions.md#machine_learning_methods-evalmlmethod) qui prend un état comme un argument ainsi que des fonctionnalités à prévoir sur. - - - -**1.** Raccord - -Une telle requête peut être utilisé. - -``` sql -CREATE TABLE IF NOT EXISTS train_data -( - param1 Float64, - param2 Float64, - target Float64 -) ENGINE = Memory; - -CREATE TABLE your_model ENGINE = Memory AS SELECT -stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) -AS state FROM train_data; -``` - -Ici, nous devons également insérer des données dans `train_data` table. Le nombre de paramètres n'est pas fixe, il dépend uniquement du nombre d'arguments, passés dans `linearRegressionState`. Ils doivent tous être des valeurs numériques. -Notez que la colonne avec la valeur cible (que nous aimerions apprendre à prédire) est insérée comme premier argument. - -**2.** Prédire - -Après avoir enregistré un État dans la table, nous pouvons l'utiliser plusieurs fois pour la prédiction, ou même fusionner avec d'autres États et créer de nouveaux modèles encore meilleurs. - -``` sql -WITH (SELECT state FROM your_model) AS model SELECT -evalMLMethod(model, param1, param2) FROM test_data -``` - -La requête renvoie une colonne de valeurs prédites. Notez que le premier argument de `evalMLMethod` être `AggregateFunctionState` objet, sont ensuite des colonnes de fonctionnalités. - -`test_data` est un tableau comme `train_data` mais peut ne pas contenir de valeur cible. - -### Note {#agg_functions-stochasticlinearregression-notes} - -1. Pour fusionner deux modèles l'utilisateur peut créer une telle requête: - `sql SELECT state1 + state2 FROM your_models` - où `your_models` le tableau contient les deux modèles. Cette requête renvoie la nouvelle `AggregateFunctionState` objet. - -2. L'utilisateur peut récupérer les poids du modèle pour ses propres fins, sans enregistrer le modèle, si aucune `-State` combinator est utilisé. - `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` - Une telle requête s'adaptera au Modèle et retournera ses poids-d'abord sont des poids, qui correspondent aux paramètres du modèle, le dernier est un biais. Ainsi, dans l'exemple ci-dessus, la requête renvoie une colonne avec 3 valeurs. - -**Voir Aussi** - -- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) -- [Différence entre les régressions linéaires et logistiques](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} - -Cette fonction implémente la régression logistique stochastique. Il peut être utilisé pour le problème de classification binaire, prend en charge les mêmes paramètres personnalisés que stochasticLinearRegression et fonctionne de la même manière. - -### Paramètre {#agg_functions-stochasticlogisticregression-parameters} - -Les paramètres sont exactement les mêmes que dans stochasticLinearRegression: -`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. -Pour plus d'informations, voir [paramètre](#agg_functions-stochasticlinearregression-parameters). - -``` text -stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') -``` - -1. Raccord - - - - See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. - - Predicted labels have to be in \[-1, 1\]. - -1. Prédire - - - - Using saved state we can predict probability of object having label `1`. - - ``` sql - WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) FROM test_data - ``` - - The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. - - We can also set a bound of probability, which assigns elements to different labels. - - ``` sql - SELECT ans < 1.1 AND ans > 0.5 FROM - (WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) AS ans FROM test_data) - ``` - - Then the result will be labels. - - `test_data` is a table like `train_data` but may not contain target value. - -**Voir Aussi** - -- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) -- [Différence entre les régressions linéaires et logistiques.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## groupBitmapAnd {#groupbitmapand} - -Calculs le et d'une colonne bitmap, retour cardinalité de type UInt64, si Ajouter suffixe-État, puis retour [objet bitmap](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapAnd(expr) -``` - -**Paramètre** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. - -**Valeur de retour** - -La valeur de la `UInt64` type. - -**Exemple** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapAnd(z)─┐ -│ 3 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ -│ [6,8,10] │ -└──────────────────────────────────────────────────┘ -``` - -## groupBitmapOr {#groupbitmapor} - -Calculs le ou d'une colonne bitmap, retour cardinalité de type UInt64, si Ajouter suffixe-État, puis retour [objet bitmap](../../sql_reference/functions/bitmap_functions.md). C'est l'équivalent de `groupBitmapMerge`. - -``` sql -groupBitmapOr(expr) -``` - -**Paramètre** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. - -**Valeur de retour** - -La valeur de la `UInt64` type. - -**Exemple** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapOr(z)─┐ -│ 15 │ -└──────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ -│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ -└─────────────────────────────────────────────────┘ -``` - -## groupBitmapXor {#groupbitmapxor} - -Calculs le XOR d'une colonne bitmap, retour cardinalité de type UInt64, si Ajouter suffixe-État, puis retour [objet bitmap](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapOr(expr) -``` - -**Paramètre** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` type. - -**Valeur de retour** - -La valeur de la `UInt64` type. - -**Exemple** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapXor(z)─┐ -│ 10 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ -│ [1,3,5,6,8,10,11,13,14,15] │ -└──────────────────────────────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/fr/sql_reference/ansi.md b/docs/fr/sql_reference/ansi.md deleted file mode 120000 index ee0f9c8cb7e..00000000000 --- a/docs/fr/sql_reference/ansi.md +++ /dev/null @@ -1 +0,0 @@ -../../en/sql_reference/ansi.md \ No newline at end of file diff --git a/docs/fr/sql_reference/data_types/aggregatefunction.md b/docs/fr/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index 99decd0ccd3..00000000000 --- a/docs/fr/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 52 -toc_title: AggregateFunction (nom, types_of_arguments...) ---- - -# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [une vue matérialisée](../../sql_reference/statements/select.md#create-view). La manière courante de produire un État de fonction d'agrégat est d'appeler la fonction d'agrégat avec le `-State` suffixe. Pour obtenir le résultat final de l'agrégation dans l'avenir, vous devez utiliser la même fonction d'agrégation avec la `-Merge`suffixe. - -`AggregateFunction` — parametric data type. - -**Paramètre** - -- Nom de la fonction d'agrégation. - - If the function is parametric, specify its parameters too. - -- Types des arguments de la fonction d'agrégation. - -**Exemple** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -[uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq), anyIf ([tout](../../sql_reference/aggregate_functions/reference.md#agg_function-any)+[Si](../../sql_reference/aggregate_functions/combinators.md#agg-functions-combinator-if)) et [les quantiles](../../sql_reference/aggregate_functions/reference.md) les fonctions d'agrégation sont-elles prises en charge dans ClickHouse. - -## Utilisation {#usage} - -### Insertion De Données {#data-insertion} - -Pour insérer des données, utilisez `INSERT SELECT` avec le regroupement d' `-State`- fonction. - -**Exemples de fonction** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -Contrairement aux fonctions correspondantes `uniq` et `quantiles`, `-State`- les fonctions renvoient l'état, au lieu de la valeur finale. En d'autres termes, ils renvoient une valeur de `AggregateFunction` type. - -Dans les résultats de `SELECT` requête, les valeurs de `AggregateFunction` type ont une représentation binaire spécifique à l'implémentation pour tous les formats de sortie ClickHouse. Si les données de vidage dans, par exemple, `TabSeparated` format avec `SELECT` requête, puis ce vidage peut être chargé en utilisant `INSERT` requête. - -### Sélection De Données {#data-selection} - -Lors de la sélection des données `AggregatingMergeTree` table, utilisez `GROUP BY` et les mêmes fonctions d'agrégat que lors de l'insertion de données, mais en utilisant `-Merge`suffixe. - -Une fonction d'agrégation avec `-Merge` suffixe prend un ensemble d'états, les combine, et renvoie le résultat complet de l'agrégation de données. - -Par exemple, les deux requêtes suivantes retournent le même résultat: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## Exemple D'Utilisation {#usage-example} - -Voir [AggregatingMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) Description du moteur. - -[Article Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/fr/sql_reference/data_types/array.md b/docs/fr/sql_reference/data_types/array.md deleted file mode 100644 index 80c0b7c0bf9..00000000000 --- a/docs/fr/sql_reference/data_types/array.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 51 -toc_title: Array(T) ---- - -# Array(t) {#data-type-array} - -Un tableau de `T`les éléments de type. `T` peut être n'importe quel type de données, y compris un tableau. - -## La création d'un Tableau {#creating-an-array} - -Vous pouvez utiliser une fonction pour créer un tableau: - -``` sql -array(T) -``` - -Vous pouvez également utiliser des crochets. - -``` sql -[] -``` - -Exemple de création d'un tableau: - -``` sql -SELECT array(1, 2) AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName(array(1, 2))─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴─────────────────────────┘ -``` - -``` sql -SELECT [1, 2] AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName([1, 2])─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴────────────────────┘ -``` - -## Utilisation De Types De Données {#working-with-data-types} - -Lors de la création d'un tableau à la volée, ClickHouse définit automatiquement le type d'argument comme le type de données le plus étroit pouvant stocker tous les arguments listés. S'il y a des [Nullable](nullable.md#data_type-nullable) ou littéral [NULL](../../sql_reference/syntax.md#null-literal) les valeurs, le type d'un élément de tableau devient également [Nullable](nullable.md). - -Si ClickHouse n'a pas pu déterminer le type de données, il génère une exception. Par exemple, cela se produit lorsque vous essayez de créer un tableau avec des chaînes et des nombres simultanément (`SELECT array(1, 'a')`). - -Exemples de détection automatique de type de données: - -``` sql -SELECT array(1, 2, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ -│ [1,2,NULL] │ Array(Nullable(UInt8)) │ -└────────────┴───────────────────────────────┘ -``` - -Si vous essayez de créer un tableau de types de données incompatibles, ClickHouse lève une exception: - -``` sql -SELECT array(1, 'a') -``` - -``` text -Received exception from server (version 1.1.54388): -Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. -``` - -[Article Original](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/fr/sql_reference/data_types/boolean.md b/docs/fr/sql_reference/data_types/boolean.md deleted file mode 100644 index 54c1311c375..00000000000 --- a/docs/fr/sql_reference/data_types/boolean.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 43 -toc_title: "Bool\xE9en" ---- - -# Les Valeurs Booléennes {#boolean-values} - -Il n'y a pas de type distinct pour les valeurs booléennes. Utilisez le type UInt8, limité aux valeurs 0 ou 1. - -[Article Original](https://clickhouse.tech/docs/en/data_types/boolean/) diff --git a/docs/fr/sql_reference/data_types/date.md b/docs/fr/sql_reference/data_types/date.md deleted file mode 100644 index ece3bc85c99..00000000000 --- a/docs/fr/sql_reference/data_types/date.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 47 -toc_title: Date ---- - -# Date {#date} - -Date. Stocké en deux octets comme le nombre de jours depuis 1970-01-01 (non signé). Permet de stocker des valeurs juste après le début de L'époque Unix jusqu'au seuil supérieur défini par une constante au stade de la compilation (actuellement, c'est jusqu'à l'année 2106, mais l'année finale entièrement prise en charge est 2105). -La valeur minimale est sortie comme 0000-00-00. - -La valeur de date est stockée sans le fuseau horaire. - -[Article Original](https://clickhouse.tech/docs/en/data_types/date/) diff --git a/docs/fr/sql_reference/data_types/datetime.md b/docs/fr/sql_reference/data_types/datetime.md deleted file mode 100644 index d66a4276d66..00000000000 --- a/docs/fr/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 48 -toc_title: DateTime ---- - -# Datetime {#data_type-datetime} - -Permet de stocker un instant dans le temps, qui peut être exprimé comme une date de calendrier et une heure d'une journée. - -Syntaxe: - -``` sql -DateTime([timezone]) -``` - -Plage de valeurs prise en charge: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. - -Résolution: 1 seconde. - -## Utilisation Remarques {#usage-remarks} - -Le point dans le temps est enregistré en tant que [Le timestamp Unix](https://en.wikipedia.org/wiki/Unix_time), quel que soit le fuseau horaire ou l'heure d'été. En outre, l' `DateTime` type peut stocker le fuseau horaire qui est le même pour la colonne entière, qui affecte la façon dont les valeurs de la `DateTime` les valeurs de type sont affichées au format texte et comment les valeurs spécifiées en tant que chaînes sont analysées (‘2020-01-01 05:00:01’). Le fuseau horaire n'est pas stocké dans les lignes de la table (ou dans resultset), mais est stocké dans les métadonnées de la colonne. -Une liste des fuseaux horaires pris en charge peut être trouvée dans le [Base de données de fuseau horaire IANA](https://www.iana.org/time-zones). -Le `tzdata` paquet, contenant [Base de données de fuseau horaire IANA](https://www.iana.org/time-zones), doit être installé dans le système. L'utilisation de la `timedatectl list-timezones` commande pour lister les fuseaux horaires connus par un système local. - -Vous pouvez définir explicitement un fuseau horaire `DateTime`- tapez des colonnes lors de la création d'une table. Si le fuseau horaire n'est pas défini, ClickHouse utilise la valeur [fuseau](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) paramètre dans les paramètres du serveur ou les paramètres du système d'exploitation au moment du démarrage du serveur ClickHouse. - -Le [clickhouse-client](../../interfaces/cli.md) applique le fuseau horaire du serveur par défaut si un fuseau horaire n'est pas explicitement défini lors de l'initialisation du type de données. Pour utiliser le fuseau horaire du client, exécutez `clickhouse-client` avec l' `--use_client_time_zone` paramètre. - -Clickhouse affiche les valeurs dans `YYYY-MM-DD hh:mm:ss` format de texte par défaut. Vous pouvez modifier la sortie avec le [formatDateTime](../../sql_reference/functions/date_time_functions.md#formatdatetime) fonction. - -Lorsque vous insérez des données dans ClickHouse, vous pouvez utiliser différents formats de chaînes de date et d'heure, en fonction de la valeur du [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) paramètre. - -## Exemple {#examples} - -**1.** Création d'une table avec un `DateTime`- tapez la colonne et insérez des données dedans: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime('Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog; -``` - -``` sql -INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); -``` - -``` sql -SELECT * FROM dt; -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -- Lors de l'insertion de datetime en tant qu'entier, il est traité comme un horodatage Unix (UTC). `1546300800` représenter `'2019-01-01 00:00:00'` L'UTC. Cependant, comme `timestamp` la colonne a `Europe/Moscow` (UTC+3) fuseau horaire spécifié, lors de la sortie en tant que chaîne, la valeur sera affichée comme `'2019-01-01 03:00:00'` -- Lors de l'insertion d'une valeur de chaîne en tant que datetime, elle est traitée comme étant dans le fuseau horaire de la colonne. `'2019-01-01 00:00:00'` sera considérée comme étant en `Europe/Moscow` fuseau horaire et enregistré sous `1546290000`. - -**2.** Le filtrage sur `DateTime` valeur - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -`DateTime` les valeurs de colonne peuvent être filtrées à l'aide d'une `WHERE` prédicat. Elle sera convertie `DateTime` automatiquement: - -``` sql -SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -└─────────────────────┴──────────┘ -``` - -**3.** Obtenir un fuseau horaire pour un `DateTime`colonne de type: - -``` sql -SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────column─┬─x─────────────────────────┐ -│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ -└─────────────────────┴───────────────────────────┘ -``` - -**4.** Conversion de fuseau horaire - -``` sql -SELECT -toDateTime(timestamp, 'Europe/London') as lon_time, -toDateTime(timestamp, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────lon_time──┬────────────mos_time─┐ -│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ -│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ -└─────────────────────┴─────────────────────┘ -``` - -## Voir Aussi {#see-also} - -- [Fonctions de conversion de Type](../../sql_reference/functions/type_conversion_functions.md) -- [Fonctions pour travailler avec des dates et des heures](../../sql_reference/functions/date_time_functions.md) -- [Fonctions pour travailler avec des tableaux](../../sql_reference/functions/array_functions.md) -- [Le `date_time_input_format` paramètre](../../operations/settings/settings.md#settings-date_time_input_format) -- [Le `timezone` paramètre de configuration du serveur](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Opérateurs pour travailler avec des dates et des heures](../../sql_reference/operators.md#operators-datetime) -- [Le `Date` type de données](date.md) - -[Article Original](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/fr/sql_reference/data_types/datetime64.md b/docs/fr/sql_reference/data_types/datetime64.md deleted file mode 100644 index f7ef13d7014..00000000000 --- a/docs/fr/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 49 -toc_title: DateTime64 ---- - -# Datetime64 {#data_type-datetime64} - -Permet de stocker un instant dans le temps, qui peut être exprimé comme une date de calendrier et une heure d'un jour, avec une précision de sous-seconde définie - -Tick taille (précision): 10-précision deuxième - -Syntaxe: - -``` sql -DateTime64(precision, [timezone]) -``` - -En interne, stocke les données comme un certain nombre de ‘ticks’ depuis le début de l'époque (1970-01-01 00: 00: 00 UTC) comme Int64. La résolution des tiques est déterminée par le paramètre de précision. En outre, l' `DateTime64` type peut stocker le fuseau horaire qui est le même pour la colonne entière, qui affecte la façon dont les valeurs de la `DateTime64` les valeurs de type sont affichées au format texte et comment les valeurs spécifiées en tant que chaînes sont analysées (‘2020-01-01 05:00:01.000’). Le fuseau horaire n'est pas stocké dans les lignes de la table (ou dans resultset), mais est stocké dans les métadonnées de la colonne. Voir les détails dans [DateTime](datetime.md). - -## Exemple {#examples} - -**1.** Création d'une table avec `DateTime64`- tapez la colonne et insérez des données dedans: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- Lors de l'insertion de datetime en tant qu'entier, il est traité comme un horodatage Unix (UTC) mis à l'échelle de manière appropriée. `1546300800000` (avec précision 3) représente `'2019-01-01 00:00:00'` L'UTC. Cependant, comme `timestamp` la colonne a `Europe/Moscow` (UTC+3) fuseau horaire spécifié, lors de la sortie sous forme de chaîne, la valeur sera affichée comme `'2019-01-01 03:00:00'` -- Lors de l'insertion d'une valeur de chaîne en tant que datetime, elle est traitée comme étant dans le fuseau horaire de la colonne. `'2019-01-01 00:00:00'` sera considérée comme étant en `Europe/Moscow` fuseau horaire et stocké comme `1546290000000`. - -**2.** Le filtrage sur `DateTime64` valeur - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -Contrairement `DateTime`, `DateTime64` les valeurs ne sont pas converties depuis `String` automatiquement - -**3.** Obtenir un fuseau horaire pour un `DateTime64`-le type de la valeur: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** Conversion de fuseau horaire - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## Voir Aussi {#see-also} - -- [Fonctions de conversion de Type](../../sql_reference/functions/type_conversion_functions.md) -- [Fonctions pour travailler avec des dates et des heures](../../sql_reference/functions/date_time_functions.md) -- [Fonctions pour travailler avec des tableaux](../../sql_reference/functions/array_functions.md) -- [Le `date_time_input_format` paramètre](../../operations/settings/settings.md#settings-date_time_input_format) -- [Le `timezone` paramètre de configuration du serveur](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Opérateurs pour travailler avec des dates et des heures](../../sql_reference/operators.md#operators-datetime) -- [`Date` type de données](date.md) -- [`DateTime` type de données](datetime.md) diff --git a/docs/fr/sql_reference/data_types/decimal.md b/docs/fr/sql_reference/data_types/decimal.md deleted file mode 100644 index 74a0ecfbe64..00000000000 --- a/docs/fr/sql_reference/data_types/decimal.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 42 -toc_title: "D\xE9cimal" ---- - -# Décimal (P, S), Décimal32 (S), Décimal64 (S), Décimal128 (S) {#decimalp-s-decimal32s-decimal64s-decimal128s} - -Nombres à points fixes signés qui conservent la précision pendant les opérations d'addition, de soustraction et de multiplication. Pour la division, les chiffres les moins significatifs sont ignorés (non arrondis). - -## Paramètre {#parameters} - -- P-précision. Plage valide: \[1: 38 \]. Détermine le nombre de chiffres décimaux nombre peut avoir (fraction y compris). -- S - échelle. Plage valide: \[0: P \]. Détermine le nombre de chiffres décimaux fraction peut avoir. - -En fonction de P Paramètre Valeur décimal (P, S) est un synonyme de: -- P à partir de \[ 1: 9\] - Pour Décimal32 (S) -- P à partir de \[10: 18\] - pour Décimal64 (S) -- P à partir de \[19: 38\] - pour Décimal128 (S) - -## Plages de valeurs décimales {#decimal-value-ranges} - -- Décimal32 (S) - ( -1 \* 10^(9 - S), 1 \* 10^(9-S) ) -- Décimal64 (S) - ( -1 \* 10^(18 - S), 1 \* 10^(18-S) ) -- Décimal128 (S) - ( -1 \* 10^(38 - S), 1 \* 10^(38-S) ) - -Par exemple, Decimal32(4) peut contenir des nombres de -99999.9999 à 99999.9999 avec 0,0001 étape. - -## Représentation interne {#internal-representation} - -En interne, les données sont représentées comme des entiers signés normaux avec une largeur de bit respective. Les plages de valeurs réelles qui peuvent être stockées en mémoire sont un peu plus grandes que celles spécifiées ci-dessus, qui sont vérifiées uniquement lors de la conversion à partir d'une chaîne. - -Parce que les processeurs modernes ne prennent pas en charge les entiers 128 bits nativement, les opérations sur Decimal128 sont émulées. Pour cette raison, Decimal128 fonctionne significativement plus lentement que Decimal32 / Decimal64. - -## Opérations et type de résultat {#operations-and-result-type} - -Les opérations binaires sur le résultat décimal dans le type de résultat plus large (avec n'importe quel ordre d'arguments). - -- Décimal64 (S1) Decimal32 (S2) - \> Decimal64 (S) -- Décimal128 (S1) Decimal32 (S2) - \> Decimal128 (S) -- Décimal128 (S1) Decimal64 (S2) - \> Decimal128 (S) - -Règles pour l'échelle: - -- ajouter, soustraire: S = max (S1, S2). -- multuply: S = S1 + S2. -- diviser: S = S1. - -Pour des opérations similaires entre décimal et entier, le résultat est Décimal de la même taille qu'un argument. - -Les opérations entre Decimal et Float32 / Float64 ne sont pas définies. Si vous en avez besoin, vous pouvez explicitement lancer l'un des arguments en utilisant les builtins toDecimal32, toDecimal64, toDecimal128 ou toFloat32, toFloat64. Gardez à l'esprit que le résultat perdra de la précision et que la conversion de type est une opération coûteuse en calcul. - -Certaines fonctions sur le résultat de retour décimal comme Float64 (par exemple, var ou stddev). Les calculs intermédiaires peuvent toujours être effectués en décimal, ce qui peut conduire à des résultats différents entre les entrées Float64 et Decimal avec les mêmes valeurs. - -## Contrôles de débordement {#overflow-checks} - -Pendant les calculs sur Décimal, des débordements entiers peuvent se produire. Les chiffres excessifs dans une fraction sont éliminés (non arrondis). Les chiffres excessifs dans la partie entière conduiront à une exception. - -``` sql -SELECT toDecimal32(2, 4) AS x, x / 3 -``` - -``` text -┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ -│ 2.0000 │ 0.6666 │ -└────────┴──────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, x * x -``` - -``` text -DB::Exception: Scale is out of bounds. -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -DB::Exception: Decimal math overflow. -``` - -Les contrôles de débordement entraînent un ralentissement des opérations. S'il est connu que les débordements ne sont pas possibles, il est logique de désactiver les contrôles en utilisant `decimal_check_overflow` paramètre. Lorsque des contrôles sont désactivés et le débordement se produit, le résultat sera faux: - -``` sql -SET decimal_check_overflow = 0; -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ -│ 4.20000000 │ -17.74967296 │ -└────────────┴──────────────────────────────────┘ -``` - -Les contrôles de débordement se produisent non seulement sur les opérations arithmétiques mais aussi sur la comparaison de valeurs: - -``` sql -SELECT toDecimal32(1, 8) < 100 -``` - -``` text -DB::Exception: Can't compare. -``` - -[Article Original](https://clickhouse.tech/docs/en/data_types/decimal/) diff --git a/docs/fr/sql_reference/data_types/domains/ipv4.md b/docs/fr/sql_reference/data_types/domains/ipv4.md deleted file mode 100644 index 391c06bf66f..00000000000 --- a/docs/fr/sql_reference/data_types/domains/ipv4.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 59 -toc_title: IPv4 ---- - -## IPv4 {#ipv4} - -`IPv4` est un domaine basé sur `UInt32` tapez et sert de remplacement typé pour stocker des valeurs IPv4. Il fournit un stockage compact avec le format d'entrée-sortie convivial et les informations de type de colonne sur l'inspection. - -### Utilisation De Base {#basic-usage} - -``` sql -CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY url; - -DESCRIBE TABLE hits; -``` - -``` text -┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ -│ url │ String │ │ │ │ │ -│ from │ IPv4 │ │ │ │ │ -└──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ -``` - -Ou vous pouvez utiliser le domaine IPv4 comme clé: - -``` sql -CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY from; -``` - -`IPv4` le domaine prend en charge le format d'entrée personnalisé en tant que chaînes IPv4: - -``` sql -INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '116.253.40.133')('https://clickhouse.tech', '183.247.232.58')('https://clickhouse.yandex/docs/en/', '116.106.34.242'); - -SELECT * FROM hits; -``` - -``` text -┌─url────────────────────────────────┬───────────from─┐ -│ https://clickhouse.tech/docs/en/ │ 116.106.34.242 │ -│ https://wikipedia.org │ 116.253.40.133 │ -│ https://clickhouse.tech │ 183.247.232.58 │ -└────────────────────────────────────┴────────────────┘ -``` - -Les valeurs sont stockées sous forme binaire compacte: - -``` sql -SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; -``` - -``` text -┌─toTypeName(from)─┬─hex(from)─┐ -│ IPv4 │ B7F7E83A │ -└──────────────────┴───────────┘ -``` - -Les valeurs de domaine ne sont pas implicitement convertibles en types autres que `UInt32`. -Si vous voulez convertir `IPv4` valeur à une chaîne, vous devez le faire explicitement avec `IPv4NumToString()` fonction: - -``` sql -SELECT toTypeName(s), IPv4NumToString(from) as s FROM hits LIMIT 1; -``` - - ┌─toTypeName(IPv4NumToString(from))─┬─s──────────────┐ - │ String │ 183.247.232.58 │ - └───────────────────────────────────┴────────────────┘ - -Ou coulé à un `UInt32` valeur: - -``` sql -SELECT toTypeName(i), CAST(from as UInt32) as i FROM hits LIMIT 1; -``` - -``` text -┌─toTypeName(CAST(from, 'UInt32'))─┬──────────i─┐ -│ UInt32 │ 3086477370 │ -└──────────────────────────────────┴────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/data_types/domains/ipv4) diff --git a/docs/fr/sql_reference/data_types/domains/ipv6.md b/docs/fr/sql_reference/data_types/domains/ipv6.md deleted file mode 100644 index 0946ac38ed3..00000000000 --- a/docs/fr/sql_reference/data_types/domains/ipv6.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 60 -toc_title: IPv6 ---- - -## IPv6 {#ipv6} - -`IPv6` est un domaine basé sur `FixedString(16)` tapez et sert de remplacement typé pour stocker des valeurs IPv6. Il fournit un stockage compact avec le format d'entrée-sortie convivial et les informations de type de colonne sur l'inspection. - -### Utilisation De Base {#basic-usage} - -``` sql -CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY url; - -DESCRIBE TABLE hits; -``` - -``` text -┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ -│ url │ String │ │ │ │ │ -│ from │ IPv6 │ │ │ │ │ -└──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ -``` - -Ou vous pouvez utiliser `IPv6` domaine comme l'un des principaux: - -``` sql -CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY from; -``` - -`IPv6` le domaine prend en charge l'entrée personnalisée en tant que chaînes IPv6: - -``` sql -INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '2a02:aa08:e000:3100::2')('https://clickhouse.tech', '2001:44c8:129:2632:33:0:252:2')('https://clickhouse.yandex/docs/en/', '2a02:e980:1e::1'); - -SELECT * FROM hits; -``` - -``` text -┌─url────────────────────────────────┬─from──────────────────────────┐ -│ https://clickhouse.tech │ 2001:44c8:129:2632:33:0:252:2 │ -│ https://clickhouse.tech/docs/en/ │ 2a02:e980:1e::1 │ -│ https://wikipedia.org │ 2a02:aa08:e000:3100::2 │ -└────────────────────────────────────┴───────────────────────────────┘ -``` - -Les valeurs sont stockées sous forme binaire compacte: - -``` sql -SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; -``` - -``` text -┌─toTypeName(from)─┬─hex(from)────────────────────────┐ -│ IPv6 │ 200144C8012926320033000002520002 │ -└──────────────────┴──────────────────────────────────┘ -``` - -Les valeurs de domaine ne sont pas implicitement convertibles en types autres que `FixedString(16)`. -Si vous voulez convertir `IPv6` valeur à une chaîne, vous devez le faire explicitement avec `IPv6NumToString()` fonction: - -``` sql -SELECT toTypeName(s), IPv6NumToString(from) as s FROM hits LIMIT 1; -``` - -``` text -┌─toTypeName(IPv6NumToString(from))─┬─s─────────────────────────────┐ -│ String │ 2001:44c8:129:2632:33:0:252:2 │ -└───────────────────────────────────┴───────────────────────────────┘ -``` - -Ou coulé à un `FixedString(16)` valeur: - -``` sql -SELECT toTypeName(i), CAST(from as FixedString(16)) as i FROM hits LIMIT 1; -``` - -``` text -┌─toTypeName(CAST(from, 'FixedString(16)'))─┬─i───────┐ -│ FixedString(16) │ ��� │ -└───────────────────────────────────────────┴─────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/data_types/domains/ipv6) diff --git a/docs/fr/sql_reference/data_types/domains/overview.md b/docs/fr/sql_reference/data_types/domains/overview.md deleted file mode 100644 index 0f977f79a4e..00000000000 --- a/docs/fr/sql_reference/data_types/domains/overview.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 58 -toc_title: "Aper\xE7u" ---- - -# Domaine {#domains} - -Les domaines sont des types spéciaux qui ajoutent des fonctionnalités supplémentaires au sommet du type de base existant, mais en laissant le format on-wire et on-disc du type de données sous-jacent intact. À l'heure actuelle, ClickHouse ne prend pas en charge les domaines définis par l'utilisateur. - -Vous pouvez utiliser des domaines partout type de base correspondant peut être utilisé, par exemple: - -- Créer une colonne d'un type de domaine -- Valeurs de lecture / écriture depuis / vers la colonne de domaine -- L'utiliser comme un indice si un type de base peut être utilisée comme un indice -- Fonctions d'appel avec des valeurs de colonne de domaine - -### Fonctionnalités supplémentaires des domaines {#extra-features-of-domains} - -- Nom de type de colonne explicite dans `SHOW CREATE TABLE` ou `DESCRIBE TABLE` -- Entrée du format convivial avec `INSERT INTO domain_table(domain_column) VALUES(...)` -- Sortie au format convivial pour `SELECT domain_column FROM domain_table` -- Chargement de données à partir d'une source externe dans un format convivial: `INSERT INTO domain_table FORMAT CSV ...` - -### Limitation {#limitations} - -- Impossible de convertir la colonne d'index du type de base en type de domaine via `ALTER TABLE`. -- Impossible de convertir implicitement des valeurs de chaîne en valeurs de domaine lors de l'insertion de données d'une autre colonne ou table. -- Le domaine n'ajoute aucune contrainte sur les valeurs stockées. - -[Article Original](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/fr/sql_reference/data_types/enum.md b/docs/fr/sql_reference/data_types/enum.md deleted file mode 100644 index dcfd6266749..00000000000 --- a/docs/fr/sql_reference/data_types/enum.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 50 -toc_title: Enum ---- - -# Enum {#enum} - -Type énuméré composé de valeurs nommées. - -Les valeurs nommées doivent être déclarées comme `'string' = integer` pair. ClickHouse ne stocke que des nombres, mais prend en charge les opérations avec les valeurs à travers leurs noms. - -Supports ClickHouse: - -- 8-bit `Enum`. Il peut contenir jusqu'à 256 valeurs énumérées dans le `[-128, 127]` gamme. -- 16 bits `Enum`. Il peut contenir jusqu'à 65 536 valeurs énumérées dans le `[-32768, 32767]` gamme. - -Clickhouse choisit automatiquement le type de `Enum` lorsque les données sont insérées. Vous pouvez également utiliser `Enum8` ou `Enum16` types pour être sûr de la taille de stockage. - -## Exemples D'Utilisation {#usage-examples} - -Ici, nous créons une table avec une `Enum8('hello' = 1, 'world' = 2)` type de colonne: - -``` sql -CREATE TABLE t_enum -( - x Enum('hello' = 1, 'world' = 2) -) -ENGINE = TinyLog -``` - -Colonne `x` ne peut stocker que les valeurs répertoriées dans la définition de type: `'hello'` ou `'world'`. Si vous essayez d'enregistrer une autre valeur, ClickHouse déclenchera une exception. Taille 8 bits pour cela `Enum` est choisi automatiquement. - -``` sql -INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') -``` - -``` text -Ok. -``` - -``` sql -INSERT INTO t_enum values('a') -``` - -``` text -Exception on client: -Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) -``` - -Lorsque vous interrogez des données de la table, ClickHouse affiche les valeurs de chaîne de `Enum`. - -``` sql -SELECT * FROM t_enum -``` - -``` text -┌─x─────┐ -│ hello │ -│ world │ -│ hello │ -└───────┘ -``` - -Si vous avez besoin de voir les équivalents numériques des lignes, vous devez `Enum` valeur en type entier. - -``` sql -SELECT CAST(x, 'Int8') FROM t_enum -``` - -``` text -┌─CAST(x, 'Int8')─┐ -│ 1 │ -│ 2 │ -│ 1 │ -└─────────────────┘ -``` - -Pour créer une valeur d'Enum dans une requête, vous devez également utiliser `CAST`. - -``` sql -SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) -``` - -``` text -┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ -│ Enum8('a' = 1, 'b' = 2) │ -└─────────────────────────────────────────────────────┘ -``` - -## Règles générales et utilisation {#general-rules-and-usage} - -Chacune des valeurs se voit attribuer un nombre dans la plage `-128 ... 127` pour `Enum8` ou dans la gamme `-32768 ... 32767` pour `Enum16`. Toutes les chaînes et les nombres doivent être différents. Une chaîne vide est autorisé. Si ce type est spécifié (dans une définition de table), les nombres peuvent être dans un ordre arbitraire. Toutefois, l'ordre n'a pas d'importance. - -Ni la chaîne ni la valeur numérique dans un `Enum` peut être [NULL](../../sql_reference/syntax.md). - -Un `Enum` peut être contenue dans [Nullable](nullable.md) type. Donc, si vous créez une table en utilisant la requête - -``` sql -CREATE TABLE t_enum_nullable -( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) -) -ENGINE = TinyLog -``` - -il peut stocker non seulement des `'hello'` et `'world'`, mais `NULL`, ainsi. - -``` sql -INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) -``` - -Dans la mémoire RAM, un `Enum` la colonne est stockée dans la même manière que `Int8` ou `Int16` des valeurs numériques correspondantes. - -Lors de la lecture sous forme de texte, ClickHouse analyse la valeur sous forme de chaîne et recherche la chaîne correspondante à partir de l'ensemble des valeurs Enum. Si elle n'est pas trouvée, une exception est levée. Lors de la lecture au format texte, la chaîne est lue et la valeur numérique correspondante est recherchée. Une exception sera levée si il n'est pas trouvé. -Lors de l'écriture sous forme de texte, il écrit la valeur correspondante de la chaîne. Si les données de colonne contiennent des déchets (nombres qui ne proviennent pas de l'ensemble valide), une exception est levée. Lors de la lecture et de l'écriture sous forme binaire, cela fonctionne de la même manière que pour les types de données Int8 et Int16. -La valeur implicite par défaut est la valeur avec le numéro le plus bas. - -Lors `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` et ainsi de suite, les Énumérations se comportent de la même façon que les nombres correspondants. Par exemple, ORDER BY les trie numériquement. Les opérateurs d'égalité et de comparaison fonctionnent de la même manière sur les énumérations que sur les valeurs numériques sous-jacentes. - -Les valeurs Enum ne peuvent pas être comparées aux nombres. Les Enums peuvent être comparés à une chaîne constante. Si la chaîne comparée à n'est pas une valeur valide pour L'énumération, une exception sera levée. L'opérateur est pris en charge avec l'Enum sur le côté gauche, et un ensemble de chaînes sur le côté droit. Les chaînes sont les valeurs de L'énumération correspondante. - -Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. -Cependant, L'énumération a un naturel `toString` fonction qui renvoie sa valeur de chaîne. - -Les valeurs Enum sont également convertibles en types numériques en utilisant `toT` fonction, où T est un type numérique. Lorsque T correspond au type numérique sous-jacent de l'énumération, cette conversion est à coût nul. -Le type Enum peut être modifié sans coût en utilisant ALTER, si seulement l'ensemble des valeurs est modifié. Il est possible d'ajouter et de supprimer des membres de L'énumération en utilisant ALTER (la suppression n'est sûre que si la valeur supprimée n'a jamais été utilisée dans la table). À titre de sauvegarde, la modification de la valeur numérique d'un membre Enum précédemment défini lancera une exception. - -En utilisant ALTER, il est possible de changer un Enum8 en Enum16 ou vice versa, tout comme changer un Int8 en Int16. - -[Article Original](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/fr/sql_reference/data_types/fixedstring.md b/docs/fr/sql_reference/data_types/fixedstring.md deleted file mode 100644 index 2b31f461099..00000000000 --- a/docs/fr/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 45 -toc_title: FixedString (N) ---- - -# Fixedstring {#fixedstring} - -Une chaîne de longueur fixe de `N` octets (ni caractères ni points de code). - -Pour déclarer une colonne de `FixedString` tapez, utilisez la syntaxe suivante: - -``` sql - FixedString(N) -``` - -Où `N` est un nombre naturel. - -Le `FixedString` type est efficace lorsque les données ont la longueur de précisément `N` octet. Dans tous les autres cas, il est susceptible de réduire l'efficacité. - -Exemples de valeurs qui peuvent être stockées efficacement dans `FixedString`-tapé colonnes: - -- La représentation binaire des adresses IP (`FixedString(16)` pour IPv6). -- Language codes (ru\_RU, en\_US … ). -- Currency codes (USD, RUB … ). -- Représentation binaire des hachages (`FixedString(16)` pour MD5, `FixedString(32)` pour SHA256). - -Pour stocker les valeurs UUID, utilisez [UUID](uuid.md) type de données. - -Lors de l'insertion des données, ClickHouse: - -- Complète une chaîne avec des octets null si la chaîne contient moins de `N` octet. -- Jette le `Too large value for FixedString(N)` exception si la chaîne contient plus de `N` octet. - -Lors de la sélection des données, ClickHouse ne supprime pas les octets nuls à la fin de la chaîne. Si vous utilisez le `WHERE` clause, vous devez ajouter des octets null manuellement pour `FixedString` valeur. L'exemple suivant illustre l'utilisation de l' `WHERE` la clause de `FixedString`. - -Considérons le tableau suivant avec le seul `FixedString(2)` colonne: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -Requête `SELECT * FROM FixedStringTable WHERE a = 'b'` ne renvoie aucune donnée en conséquence. Nous devrions compléter le modèle de filtre avec des octets nuls. - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -Ce comportement diffère de MySQL pour le `CHAR` type (où les chaînes sont remplies d'espaces et les espaces sont supprimés pour la sortie). - -À noter que la longueur de la `FixedString(N)` la valeur est constante. Le [longueur](../../sql_reference/functions/array_functions.md#array_functions-length) la fonction renvoie `N` même si l' `FixedString(N)` la valeur est remplie uniquement avec des octets [vide](../../sql_reference/functions/string_functions.md#empty) la fonction renvoie `1` dans ce cas. - -[Article Original](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/fr/sql_reference/data_types/float.md b/docs/fr/sql_reference/data_types/float.md deleted file mode 100644 index c7aac2adb58..00000000000 --- a/docs/fr/sql_reference/data_types/float.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 41 -toc_title: Float32, Float64 ---- - -# Float32, Float64 {#float32-float64} - -[Les nombres à virgule flottante](https://en.wikipedia.org/wiki/IEEE_754). - -Les Types sont équivalents aux types de C: - -- `Float32` - `float` -- `Float64` - `double` - -Nous vous recommandons de stocker les données sous forme entière chaque fois que possible. Par exemple, convertissez des nombres de précision fixes en valeurs entières, telles que des montants monétaires ou des temps de chargement de page en millisecondes. - -## Utilisation de nombres à virgule flottante {#using-floating-point-numbers} - -- Calculs avec des nombres à virgule flottante peut produire une erreur d'arrondi. - - - -``` sql -SELECT 1 - 0.9 -``` - -``` text -┌───────minus(1, 0.9)─┐ -│ 0.09999999999999998 │ -└─────────────────────┘ -``` - -- Le résultat du calcul dépend de la méthode de calcul (le type de processeur et de l'architecture du système informatique). -- Les calculs à virgule flottante peuvent entraîner des nombres tels que l'infini (`Inf`) et “not-a-number” (`NaN`). Cela doit être pris en compte lors du traitement des résultats de calculs. -- Lors de l'analyse de nombres à virgule flottante à partir de texte, le résultat peut ne pas être le nombre représentable par machine le plus proche. - -## NaN et Inf {#data_type-float-nan-inf} - -Contrairement à SQL standard, ClickHouse prend en charge les catégories suivantes de nombres à virgule flottante: - -- `Inf` – Infinity. - - - -``` sql -SELECT 0.5 / 0 -``` - -``` text -┌─divide(0.5, 0)─┐ -│ inf │ -└────────────────┘ -``` - -- `-Inf` – Negative infinity. - - - -``` sql -SELECT -0.5 / 0 -``` - -``` text -┌─divide(-0.5, 0)─┐ -│ -inf │ -└─────────────────┘ -``` - -- `NaN` – Not a number. - - - -``` sql -SELECT 0 / 0 -``` - -``` text -┌─divide(0, 0)─┐ -│ nan │ -└──────────────┘ -``` - - See the rules for `NaN` sorting in the section [ORDER BY clause](../sql_reference/statements/select.md). - -[Article Original](https://clickhouse.tech/docs/en/data_types/float/) diff --git a/docs/fr/sql_reference/data_types/nested_data_structures/nested.md b/docs/fr/sql_reference/data_types/nested_data_structures/nested.md deleted file mode 100644 index 298e8d25038..00000000000 --- a/docs/fr/sql_reference/data_types/nested_data_structures/nested.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 57 -toc_title: "Imbriqu\xE9e(Type1 Nom1, Nom2 Type2, ...)" ---- - -# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) requête. Chaque ligne de table peut correspondre à n'importe quel nombre de lignes dans une structure de données imbriquée. - -Exemple: - -``` sql -CREATE TABLE test.visits -( - CounterID UInt32, - StartDate Date, - Sign Int8, - IsNew UInt8, - VisitID UInt64, - UserID UInt64, - ... - Goals Nested - ( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32 - ), - ... -) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) -``` - -Cet exemple déclare le `Goals` structure de données imbriquée, qui contient des données sur les conversions (objectifs atteints). Chaque ligne de la ‘visits’ table peut correspondre à zéro ou n'importe quel nombre de conversions. - -Un seul niveau d'imbrication est pris en charge. Les colonnes de structures imbriquées contenant des tableaux sont équivalentes à des tableaux multidimensionnels, elles ont donc un support limité (il n'y a pas de support pour stocker ces colonnes dans des tables avec le moteur MergeTree). - -Dans la plupart des cas, lorsque vous travaillez avec une structure de données imbriquée, ses colonnes sont spécifiées avec des noms de colonnes séparés par un point. Ces colonnes constituent un tableau de types correspondants. Tous les tableaux de colonnes d'une structure de données imbriquée unique ont la même longueur. - -Exemple: - -``` sql -SELECT - Goals.ID, - Goals.EventTime -FROM test.visits -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ -│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ -│ [1073752] │ ['2014-03-17 00:28:25'] │ -│ [1073752] │ ['2014-03-17 10:46:20'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ -│ [] │ [] │ -│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ -│ [] │ [] │ -│ [] │ [] │ -│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ -└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -Il est plus facile de penser à une structure de données imbriquée comme un ensemble de plusieurs tableaux de colonnes de la même longueur. - -Le seul endroit où une requête SELECT peut spécifier le nom d'une structure de données imbriquée entière au lieu de colonnes individuelles est la clause de jointure de tableau. Pour plus d'informations, voir “ARRAY JOIN clause”. Exemple: - -``` sql -SELECT - Goal.ID, - Goal.EventTime -FROM test.visits -ARRAY JOIN Goals AS Goal -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goal.ID─┬──────Goal.EventTime─┐ -│ 1073752 │ 2014-03-17 16:38:10 │ -│ 591325 │ 2014-03-17 16:38:48 │ -│ 591325 │ 2014-03-17 16:42:27 │ -│ 1073752 │ 2014-03-17 00:28:25 │ -│ 1073752 │ 2014-03-17 10:46:20 │ -│ 1073752 │ 2014-03-17 13:59:20 │ -│ 591325 │ 2014-03-17 22:17:55 │ -│ 591325 │ 2014-03-17 22:18:07 │ -│ 591325 │ 2014-03-17 22:18:51 │ -│ 1073752 │ 2014-03-17 11:37:06 │ -└─────────┴─────────────────────┘ -``` - -Vous ne pouvez pas effectuer SELECT pour une structure de données imbriquée entière. Vous ne pouvez lister explicitement que les colonnes individuelles qui en font partie. - -Pour une requête INSERT, vous devez passer tous les tableaux de colonnes composant d'une structure de données imbriquée séparément (comme s'il s'agissait de tableaux de colonnes individuels). Au cours de l'insertion, le système vérifie qu'ils ont la même longueur. - -Pour une requête DESCRIBE, les colonnes d'une structure de données imbriquée sont répertoriées séparément de la même manière. - -La requête ALTER pour les éléments d'une structure de données imbriquée a des limites. - -[Article Original](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/fr/sql_reference/data_types/nullable.md b/docs/fr/sql_reference/data_types/nullable.md deleted file mode 100644 index 09bfd0cb9bb..00000000000 --- a/docs/fr/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 54 -toc_title: Nullable ---- - -# Nullable(typename) {#data_type-nullable} - -Permet de stocker marqueur spécial ([NULL](../../sql_reference/syntax.md)) qui dénote “missing value” aux valeurs normales autorisées par `TypeName`. Par exemple, un `Nullable(Int8)` type colonne peut stocker `Int8` type de valeurs, et les lignes qui n'ont pas de valeur magasin `NULL`. - -Pour un `TypeName` vous ne pouvez pas utiliser les types de données composites [Tableau](array.md) et [Tuple](tuple.md). Les types de données composites peuvent contenir `Nullable` valeurs de type, telles que `Array(Nullable(Int8))`. - -A `Nullable` le champ type ne peut pas être inclus dans les index de table. - -`NULL` est la valeur par défaut pour tout `Nullable` type, sauf indication contraire dans la configuration du serveur ClickHouse. - -## Caractéristiques De Stockage {#storage-features} - -Stocker `Nullable` valeurs de type dans une colonne de table, ClickHouse utilise un fichier séparé avec `NULL` masques en plus du fichier normal avec des valeurs. Les entrées du fichier masks permettent à ClickHouse de faire la distinction entre `NULL` et une valeur par défaut du type de données correspondant pour chaque ligne de table. En raison d'un fichier supplémentaire, `Nullable` colonne consomme de l'espace de stockage supplémentaire par rapport à une normale similaire. - -!!! info "Note" - Utiliser `Nullable` affecte presque toujours négativement les performances, gardez cela à l'esprit lors de la conception de vos bases de données. - -## Exemple D'Utilisation {#usage-example} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y FROM t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/fr/sql_reference/data_types/simpleaggregatefunction.md b/docs/fr/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 120000 index 02fad64d50e..00000000000 --- a/docs/fr/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/sql_reference/data_types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/fr/sql_reference/data_types/special_data_types/expression.md b/docs/fr/sql_reference/data_types/special_data_types/expression.md deleted file mode 100644 index 9435321af9f..00000000000 --- a/docs/fr/sql_reference/data_types/special_data_types/expression.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 58 -toc_title: Expression ---- - -# Expression {#expression} - -Les Expressions sont utilisées pour représenter des lambdas dans des fonctions d'ordre Élevé. - -[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/expression/) diff --git a/docs/fr/sql_reference/data_types/special_data_types/index.md b/docs/fr/sql_reference/data_types/special_data_types/index.md deleted file mode 100644 index 60a700d0d22..00000000000 --- a/docs/fr/sql_reference/data_types/special_data_types/index.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Special Data Types -toc_hidden: true -toc_priority: 55 -toc_title: "cach\xE9s" ---- - -# Types De Données Spéciaux {#special-data-types} - -Les valeurs de type de données spéciales ne peuvent pas être sérialisées pour l'enregistrement dans une table ou la sortie dans les résultats de la requête, mais peuvent être utilisées comme résultat intermédiaire lors de l'exécution de la requête. - -[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/) diff --git a/docs/fr/sql_reference/data_types/special_data_types/interval.md b/docs/fr/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index 0ca20cdc513..00000000000 --- a/docs/fr/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 61 -toc_title: Intervalle ---- - -# Intervalle {#data-type-interval} - -Famille de types de données représentant des intervalles d'heure et de date. Les types de la [INTERVAL](../../../sql_reference/operators.md#operator-interval) opérateur. - -!!! warning "Avertissement" - `Interval` les valeurs de type de données ne peuvent pas être stockées dans les tables. - -Structure: - -- Intervalle de temps en tant que valeur entière non signée. -- Type de l'intervalle. - -Types d'intervalles pris en charge: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -Pour chaque type d'intervalle, il existe un type de données distinct. Par exemple, l' `DAY` l'intervalle correspond au `IntervalDay` type de données: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## Utilisation Remarques {#data-type-interval-usage-remarks} - -Vous pouvez utiliser `Interval`-tapez des valeurs dans des opérations arithmétiques avec [Date](../../../sql_reference/data_types/date.md) et [DateTime](../../../sql_reference/data_types/datetime.md)-type de valeurs. Par exemple, vous pouvez ajouter 4 jours à l'heure actuelle: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -Les intervalles avec différents types ne peuvent pas être combinés. Vous ne pouvez pas utiliser des intervalles comme `4 DAY 1 HOUR`. Spécifiez des intervalles en unités inférieures ou égales à la plus petite unité de l'intervalle, par exemple, l'intervalle `1 day and an hour` l'intervalle peut être exprimée comme `25 HOUR` ou `90000 SECOND`. - -Vous ne pouvez pas effectuer d'opérations arithmétiques avec `Interval`- tapez des valeurs, mais vous pouvez ajouter des intervalles de différents types par conséquent aux valeurs dans `Date` ou `DateTime` types de données. Exemple: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -La requête suivante provoque une exception: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## Voir Aussi {#see-also} - -- [INTERVAL](../../../sql_reference/operators.md#operator-interval) opérateur -- [toInterval](../../../sql_reference/functions/type_conversion_functions.md#function-tointerval) type fonctions de conversion diff --git a/docs/fr/sql_reference/data_types/special_data_types/nothing.md b/docs/fr/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index 4a83629db00..00000000000 --- a/docs/fr/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 60 -toc_title: Rien ---- - -# Rien {#nothing} - -Le seul but de ce type de données est de représenter les cas où une valeur n'est pas prévu. Donc vous ne pouvez pas créer un `Nothing` type de valeur. - -Par exemple, littéral [NULL](../../../sql_reference/syntax.md#null-literal) a type de `Nullable(Nothing)`. Voir plus sur [Nullable](../../../sql_reference/data_types/nullable.md). - -Le `Nothing` type peut également être utilisé pour désigner des tableaux vides: - -``` sql -SELECT toTypeName(array()) -``` - -``` text -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/fr/sql_reference/data_types/special_data_types/set.md b/docs/fr/sql_reference/data_types/special_data_types/set.md deleted file mode 100644 index fde43421dab..00000000000 --- a/docs/fr/sql_reference/data_types/special_data_types/set.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 59 -toc_title: "D\xE9finir" ---- - -# Définir {#set} - -Utilisé pour la moitié droite d'un [IN](../../../sql_reference/statements/select.md#select-in-operators) expression. - -[Article Original](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/fr/sql_reference/data_types/string.md b/docs/fr/sql_reference/data_types/string.md deleted file mode 100644 index 375fcb44f38..00000000000 --- a/docs/fr/sql_reference/data_types/string.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 44 -toc_title: "Cha\xEEne" ---- - -# Chaîne {#string} - -Les chaînes d'une longueur arbitraire. La longueur n'est pas limitée. La valeur peut contenir un ensemble arbitraire d'octets, y compris des octets nuls. -Le type de chaîne remplace les types VARCHAR, BLOB, CLOB et autres provenant d'autres SGBD. - -## Encodage {#encodings} - -ClickHouse n'a pas le concept d'encodages. Les chaînes peuvent contenir un ensemble arbitraire d'octets, qui sont stockés et sortis tels quels. -Si vous avez besoin de stocker des textes, nous vous recommandons d'utiliser L'encodage UTF-8. À tout le moins, si votre terminal utilise UTF-8 (comme recommandé), vous pouvez lire et écrire vos valeurs sans effectuer de conversions. -De même, certaines fonctions pour travailler avec des chaînes ont des variations distinctes qui fonctionnent sous l'hypothèse que la chaîne contient un ensemble d'octets représentant un texte codé en UTF-8. -Par exemple, l' ‘length’ fonction calcule la longueur de la chaîne en octets, tandis que le ‘lengthUTF8’ la fonction calcule la longueur de la chaîne en points de code Unicode, en supposant que la valeur est encodée en UTF-8. - -[Article Original](https://clickhouse.tech/docs/en/data_types/string/) diff --git a/docs/fr/sql_reference/data_types/tuple.md b/docs/fr/sql_reference/data_types/tuple.md deleted file mode 100644 index 85ea5e8e02b..00000000000 --- a/docs/fr/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 53 -toc_title: Tuple (T1, T2,...) ---- - -# Tuple(t1, T2, …) {#tuplet1-t2} - -Un n-uplet d'éléments, chacun ayant une personne [type](index.md#data_types). - -Les Tuples sont utilisés pour le regroupement temporaire de colonnes. Les colonnes peuvent être regroupées lorsqu'une expression IN est utilisée dans une requête et pour spécifier certains paramètres formels des fonctions lambda. Pour plus d'informations, voir les sections [Dans les opérateurs](../../sql_reference/statements/select.md) et [Des fonctions d'ordre supérieur](../../sql_reference/functions/higher_order_functions.md). - -Les Tuples peuvent être le résultat d'une requête. Dans ce cas, pour les formats de texte autres que JSON, les valeurs sont séparées par des virgules entre parenthèses. Dans les formats JSON, les tuples sont sortis sous forme de tableaux (entre crochets). - -## La création d'un Tuple {#creating-a-tuple} - -Vous pouvez utiliser une fonction pour créer un tuple: - -``` sql -tuple(T1, T2, ...) -``` - -Exemple de création d'un tuple: - -``` sql -SELECT tuple(1,'a') AS x, toTypeName(x) -``` - -``` text -┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ -│ (1,'a') │ Tuple(UInt8, String) │ -└─────────┴───────────────────────────┘ -``` - -## Utilisation De Types De Données {#working-with-data-types} - -Lors de la création d'un tuple à la volée, ClickHouse détecte automatiquement le type de chaque argument comme le minimum des types qui peuvent stocker la valeur de l'argument. Si l'argument est [NULL](../../sql_reference/syntax.md#null-literal) le type de l'élément tuple est [Nullable](nullable.md). - -Exemple de détection automatique de type de données: - -``` sql -SELECT tuple(1, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ -│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ -└──────────┴─────────────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/fr/sql_reference/data_types/uuid.md b/docs/fr/sql_reference/data_types/uuid.md deleted file mode 100644 index 4ccf55ce349..00000000000 --- a/docs/fr/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 46 -toc_title: UUID ---- - -# UUID {#uuid-data-type} - -Un identifiant unique universel (UUID) est un numéro de 16 octets utilisé pour identifier les enregistrements. Pour plus d'informations sur L'UUID, voir [Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -L'exemple de valeur de type UUID est représenté ci-dessous: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -Si vous ne spécifiez pas la valeur de la colonne UUID lors de l'insertion d'un nouvel enregistrement, la valeur UUID est remplie avec zéro: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## Comment Générer {#how-to-generate} - -Pour générer la valeur UUID, ClickHouse fournit [generateUUIDv4](../../sql_reference/functions/uuid_functions.md) fonction. - -## Exemple D'Utilisation {#usage-example} - -**Exemple 1** - -Cet exemple montre la création d'une table avec la colonne de type UUID et l'insertion d'une valeur dans la table. - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**Exemple 2** - -Dans cet exemple, la valeur de la colonne UUID n'est pas spécifiée lors de l'insertion d'un nouvel enregistrement. - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## Restriction {#restrictions} - -Le type de données UUID ne prend en charge que les fonctions qui [Chaîne](string.md) type de données prend également en charge (par exemple, [min](../../sql_reference/aggregate_functions/reference.md#agg_function-min), [Max](../../sql_reference/aggregate_functions/reference.md#agg_function-max), et [compter](../../sql_reference/aggregate_functions/reference.md#agg_function-count)). - -Le type de données UUID n'est pas pris en charge par les opérations arithmétiques (par exemple, [ABS](../../sql_reference/functions/arithmetic_functions.md#arithm_func-abs)) ou des fonctions d'agrégation, comme [somme](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) et [avg](../../sql_reference/aggregate_functions/reference.md#agg_function-avg). - -[Article Original](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index d008472b339..00000000000 --- a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 39 -toc_title: "Description G\xE9n\xE9rale" ---- - -# Dictionnaires Externes {#dicts-external-dicts} - -Vous pouvez ajouter vos propres dictionnaires à partir de diverses sources de données. La source de données d'un dictionnaire peut être un texte local ou un fichier exécutable, une ressource HTTP(S) ou un autre SGBD. Pour plus d'informations, voir “[Sources pour les dictionnaires externes](external_dicts_dict_sources.md)”. - -ClickHouse: - -- Stocke entièrement ou partiellement les dictionnaires en RAM. -- Met à jour périodiquement les dictionnaires et charge dynamiquement les valeurs manquantes. En d'autres mots, les dictionnaires peuvent être chargés dynamiquement. -- Permet de créer des dictionnaires externes avec des fichiers xml ou [Les requêtes DDL](../../statements/create.md#create-dictionary-query). - -La configuration des dictionnaires externes peut être située dans un ou plusieurs fichiers xml. Le chemin d'accès à la configuration spécifiée dans le [dictionaries\_config](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_config) paramètre. - -Les dictionnaires peuvent être chargés au démarrage du serveur ou à la première utilisation, en fonction [dictionaries\_lazy\_load](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) paramètre. - -Le fichier de configuration du dictionnaire a le format suivant: - -``` xml - - An optional element with any content. Ignored by the ClickHouse server. - - - /etc/metrika.xml - - - - - - - - -``` - -Vous pouvez [configurer](external_dicts_dict.md) le nombre de dictionnaires dans le même fichier. - -[Requêtes DDL pour les dictionnaires](../../statements/create.md#create-dictionary-query) ne nécessite aucun enregistrement supplémentaire dans la configuration du serveur. Ils permettent de travailler avec des dictionnaires en tant qu'entités de première classe, comme des tables ou des vues. - -!!! attention "Attention" - Vous pouvez convertir les valeurs pour un petit dictionnaire en le décrivant dans un `SELECT` requête (voir la [transformer](../../../sql_reference/functions/other_functions.md) fonction). Cette fonctionnalité n'est pas liée aux dictionnaires externes. - -## Voir Aussi {#ext-dicts-see-also} - -- [Configuration D'un dictionnaire externe](external_dicts_dict.md) -- [Stockage des dictionnaires en mémoire](external_dicts_dict_layout.md) -- [Mises À Jour Du Dictionnaire](external_dicts_dict_lifetime.md) -- [Sources de dictionnaires externes](external_dicts_dict_sources.md) -- [Clé et champs du dictionnaire](external_dicts_dict_structure.md) -- [Fonctions pour travailler avec des dictionnaires externes](../../../sql_reference/functions/ext_dict_functions.md) - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index 01721ef1eb3..00000000000 --- a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 40 -toc_title: Configuration D'un dictionnaire externe ---- - -# Configuration D'un dictionnaire externe {#dicts-external-dicts-dict} - -Si dictionary est configuré à l'aide d'un fichier xml, than dictionary configuration a la structure suivante: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -Correspondant [DDL-requête](../../statements/create.md#create-dictionary-query) a la structure suivante: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. -- [source](external_dicts_dict_sources.md) — Source of the dictionary. -- [disposition](external_dicts_dict_layout.md) — Dictionary layout in memory. -- [structure](external_dicts_dict_structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. -- [vie](external_dicts_dict_lifetime.md) — Frequency of dictionary updates. - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index 30bfb97c52f..00000000000 --- a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 45 -toc_title: "Dictionnaires hi\xE9rarchiques" ---- - -# Dictionnaires Hiérarchiques {#hierarchical-dictionaries} - -Clickhouse prend en charge les dictionnaires hiérarchiques avec un [touche numérique](external_dicts_dict_structure.md#ext_dict-numeric-key). - -Voici une structure hiérarchique: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -Cette hiérarchie peut être exprimée comme la table de dictionnaire suivante. - -| id\_région | région\_parent | nom\_région | -|------------|----------------|--------------------| -| 1 | 0 | Russie | -| 2 | 1 | Moscou | -| 3 | 2 | Center | -| 4 | 0 | La Grande-Bretagne | -| 5 | 4 | Londres | - -Ce tableau contient une colonne `parent_region` qui contient la clé du parent le plus proche de l'élément. - -Clickhouse soutient le [hiérarchique](external_dicts_dict_structure.md#hierarchical-dict-attr) propriété pour [externe dictionnaire](index.md) attribut. Cette propriété vous permet de configurer le dictionnaire hiérarchique comme décrit ci-dessus. - -Le [dictGetHierarchy](../../../sql_reference/functions/ext_dict_functions.md#dictgethierarchy) la fonction vous permet d'obtenir la chaîne parent d'un élément. - -Pour notre exemple, la structure du dictionnaire peut être la suivante: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index 62a62a75160..00000000000 --- a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,373 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 41 -toc_title: "Stockage des dictionnaires en m\xE9moire" ---- - -# Stockage Des Dictionnaires En Mémoire {#dicts-external-dicts-dict-layout} - -Il existe une variété de façons de stocker les dictionnaires en mémoire. - -Nous vous recommandons [plat](#flat), [haché](#dicts-external_dicts_dict_layout-hashed) et [complex\_key\_hashed](#complex-key-hashed). qui fournissent la vitesse de traitement optimale. - -La mise en cache n'est pas recommandée en raison de performances potentiellement médiocres et de difficultés à sélectionner les paramètres optimaux. En savoir plus dans la section “[cache](#cache)”. - -Il existe plusieurs façons d'améliorer les performances du dictionnaire: - -- Appelez la fonction pour travailler avec le dictionnaire après `GROUP BY`. -- Marquer les attributs à extraire comme injectifs. Un attribut est appelé injectif si différentes valeurs d'attribut correspondent à différentes clés. Alors, quand `GROUP BY` utilise une fonction qui récupère une valeur d'attribut par la clé, cette fonction est automatiquement retirée de `GROUP BY`. - -ClickHouse génère une exception pour les erreurs avec les dictionnaires. Des exemples d'erreurs: - -- Le dictionnaire accessible n'a pas pu être chargé. -- Erreur de la requête d'une `cached` dictionnaire. - -Vous pouvez afficher la liste des dictionnaires externes et leurs statuts dans le `system.dictionaries` table. - -La configuration ressemble à ceci: - -``` xml - - - ... - - - - - - ... - - -``` - -Correspondant [DDL-requête](../../statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## Façons De Stocker Des Dictionnaires En Mémoire {#ways-to-store-dictionaries-in-memory} - -- [plat](#flat) -- [haché](#dicts-external_dicts_dict_layout-hashed) -- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) -- [cache](#cache) -- [range\_hashed](#range-hashed) -- [complex\_key\_hashed](#complex-key-hashed) -- [complex\_key\_cache](#complex-key-cache) -- [ip\_trie](#ip-trie) - -### plat {#flat} - -Le dictionnaire est complètement stocké en mémoire sous la forme de tableaux plats. Combien de mémoire le dictionnaire utilise-t-il? Le montant est proportionnel à la taille de la plus grande clé (dans l'espace). - -La clé du dictionnaire a le `UInt64` type et la valeur est limitée à 500 000. Si une clé plus grande est découverte lors de la création du dictionnaire, ClickHouse lève une exception et ne crée pas le dictionnaire. - -Tous les types de sources sont pris en charge. Lors de la mise à jour, les données (à partir d'un fichier ou d'une table) sont lues dans leur intégralité. - -Cette méthode fournit les meilleures performances parmi toutes les méthodes disponibles de stockage du dictionnaire. - -Exemple de Configuration: - -``` xml - - - -``` - -ou - -``` sql -LAYOUT(FLAT()) -``` - -### haché {#dicts-external_dicts_dict_layout-hashed} - -Le dictionnaire est entièrement stockée en mémoire sous la forme d'une table de hachage. Le dictionnaire peut contenir n'importe quel nombre d'éléments avec tous les identificateurs Dans la pratique, le nombre de clés peut atteindre des dizaines de millions d'articles. - -Tous les types de sources sont pris en charge. Lors de la mise à jour, les données (à partir d'un fichier ou d'une table) sont lues dans leur intégralité. - -Exemple de Configuration: - -``` xml - - - -``` - -ou - -``` sql -LAYOUT(HASHED()) -``` - -### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} - -Semblable à `hashed`, mais utilise moins de mémoire en faveur de plus D'utilisation du processeur. - -Exemple de Configuration: - -``` xml - - - -``` - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### complex\_key\_hashed {#complex-key-hashed} - -Ce type de stockage est pour une utilisation avec composite [touches](external_dicts_dict_structure.md). Semblable à `hashed`. - -Exemple de Configuration: - -``` xml - - - -``` - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### range\_hashed {#range-hashed} - -Le dictionnaire est stocké en mémoire sous la forme d'une table de hachage avec un tableau ordonné de gammes et leurs valeurs correspondantes. - -Cette méthode de stockage fonctionne de la même manière que hachée et permet d'utiliser des plages de date / heure (Type numérique arbitraire) en plus de la clé. - -Exemple: Le tableau contient des réductions pour chaque annonceur dans le format: - -``` text -+---------|-------------|-------------|------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------|-------------|-------------|------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------|-------------|-------------|------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------|-------------|-------------|------+ -``` - -Pour utiliser un échantillon pour les plages de dates, définissez `range_min` et `range_max` éléments dans le [structure](external_dicts_dict_structure.md). Ces éléments doivent contenir des éléments `name` et`type` (si `type` n'est pas spécifié, le type par défaut sera utilisé-Date). `type` peut être n'importe quel type numérique (Date / DateTime / UInt64 / Int32 / autres). - -Exemple: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -ou - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -Pour travailler avec ces dictionnaires, vous devez passer un argument supplémentaire à l' `dictGetT` fonction, pour laquelle une plage est sélectionnée: - -``` sql -dictGetT('dict_name', 'attr_name', id, date) -``` - -Cette fonction retourne la valeur pour l' `id`s et la plage de dates qui inclut la date passée. - -Détails de l'algorithme: - -- Si l' `id` est introuvable ou une plage n'est pas trouvé pour l' `id` il retourne la valeur par défaut pour le dictionnaire. -- S'il y a des plages qui se chevauchent, vous pouvez en utiliser. -- Si le délimiteur est `NULL` ou une date non valide (telle que 1900-01-01 ou 2039-01-01), la plage est laissée ouverte. La gamme peut être ouverte des deux côtés. - -Exemple de Configuration: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -ou - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### cache {#cache} - -Le dictionnaire est stocké dans un cache qui a un nombre fixe de cellules. Ces cellules contiennent des éléments fréquemment utilisés. - -Lors de la recherche d'un dictionnaire, le cache est recherché en premier. Pour chaque bloc de données, toutes les clés qui ne sont pas trouvées dans le cache ou qui sont obsolètes sont demandées à la source en utilisant `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Les données reçues sont ensuite écrites dans le cache. - -Pour les dictionnaires de cache, l'expiration [vie](external_dicts_dict_lifetime.md) des données dans le cache peuvent être définies. Si plus de temps que `lifetime` passé depuis le chargement des données dans une cellule, la valeur de la cellule n'est pas utilisée et elle est demandée à nouveau la prochaine fois qu'elle doit être utilisée. -C'est la moins efficace de toutes les façons de stocker les dictionnaires. La vitesse du cache dépend fortement des paramètres corrects et que le scénario d'utilisation. Un dictionnaire de type de cache fonctionne bien uniquement lorsque les taux de réussite sont suffisamment élevés (recommandé 99% et plus). Vous pouvez afficher le taux de réussite moyen dans le `system.dictionaries` table. - -Pour améliorer les performances du cache, utilisez une sous-requête avec `LIMIT`, et appelez la fonction avec le dictionnaire en externe. - -Soutenu [source](external_dicts_dict_sources.md): MySQL, ClickHouse, exécutable, HTTP. - -Exemple de paramètres: - -``` xml - - - - 1000000000 - - -``` - -ou - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -Définissez une taille de cache suffisamment grande. Vous devez expérimenter pour sélectionner le nombre de cellules: - -1. Définissez une valeur. -2. Exécutez les requêtes jusqu'à ce que le cache soit complètement plein. -3. Évaluer la consommation de mémoire en utilisant le `system.dictionaries` table. -4. Augmentez ou diminuez le nombre de cellules jusqu'à ce que la consommation de mémoire requise soit atteinte. - -!!! warning "Avertissement" - N'utilisez pas ClickHouse comme source, car le traitement des requêtes avec des lectures aléatoires est lent. - -### complex\_key\_cache {#complex-key-cache} - -Ce type de stockage est pour une utilisation avec composite [touches](external_dicts_dict_structure.md). Semblable à `cache`. - -### ip\_trie {#ip-trie} - -Ce type de stockage permet de mapper des préfixes de réseau (adresses IP) à des métadonnées telles que ASN. - -Exemple: la table contient les préfixes de réseau et leur correspondant en tant que numéro et Code de pays: - -``` text - +-----------|-----|------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------|-----|------+ - | 2620:0:870::/48 | 3856 | US | - +-----------|-----|------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------|-----|------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------|-----|------+ -``` - -Lorsque vous utilisez ce type de mise en page, la structure doit avoir une clé composite. - -Exemple: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -ou - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -La clé ne doit avoir qu'un seul attribut de type chaîne contenant un préfixe IP autorisé. Les autres types ne sont pas encore pris en charge. - -Pour les requêtes, vous devez utiliser les mêmes fonctions (`dictGetT` avec un n-uplet) comme pour les dictionnaires avec des clés composites: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -La fonction prend soit `UInt32` pour IPv4, ou `FixedString(16)` pour IPv6: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -Les autres types ne sont pas encore pris en charge. La fonction renvoie l'attribut du préfixe correspondant à cette adresse IP. S'il y a chevauchement des préfixes, le plus spécifique est retourné. - -Les données sont stockées dans une `trie`. Il doit complètement s'intégrer dans la RAM. - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index 2dcca4bfbbe..00000000000 --- a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 42 -toc_title: "Mises \xC0 Jour Du Dictionnaire" ---- - -# Mises À Jour Du Dictionnaire {#dictionary-updates} - -ClickHouse met périodiquement à jour les dictionnaires. L'intervalle de mise à jour pour les dictionnaires entièrement téléchargés et l'intervalle d'invalidation pour les dictionnaires `` tag en quelques secondes. - -Les mises à jour du dictionnaire (autres que le chargement pour la première utilisation) ne bloquent pas les requêtes. Lors des mises à jour, l'ancienne version d'un dictionnaire est utilisée. Si une erreur se produit pendant une mise à jour, l'erreur est écrite dans le journal du serveur et les requêtes continuent d'utiliser l'ancienne version des dictionnaires. - -Exemple de paramètres: - -``` xml - - ... - 300 - ... - -``` - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -Paramètre `0` (`LIFETIME(0)`) empêche la mise à jour des dictionnaires. - -Vous pouvez définir un intervalle de temps pour les mises à niveau, et ClickHouse choisira un temps uniformément aléatoire dans cette plage. Ceci est nécessaire pour répartir la charge sur la source du dictionnaire lors de la mise à niveau sur un grand nombre de serveurs. - -Exemple de paramètres: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -ou - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -Lors de la mise à niveau des dictionnaires, le serveur ClickHouse applique une logique différente selon le type de [source](external_dicts_dict_sources.md): - -- Pour un fichier texte, il vérifie l'heure de la modification. Si l'heure diffère de l'heure enregistrée précédemment, le dictionnaire est mis à jour. -- Pour les tables MyISAM, l'Heure de modification est vérifiée à l'aide d'un `SHOW TABLE STATUS` requête. -- Les dictionnaires d'autres sources sont mis à jour à chaque fois par défaut. - -Pour les sources MySQL (InnoDB), ODBC et ClickHouse, vous pouvez configurer une requête qui mettra à jour les dictionnaires uniquement s'ils ont vraiment changé, plutôt que chaque fois. Pour ce faire, suivez ces étapes: - -- La table de dictionnaire doit avoir un champ qui change toujours lorsque les données source sont mises à jour. -- Les paramètres de la source doivent spécifier une requête qui récupère le champ de modification. Le serveur ClickHouse interprète le résultat de la requête comme une ligne, et si cette ligne a changé par rapport à son état précédent, le dictionnaire est mis à jour. Spécifier la requête dans le `` champ dans les paramètres pour le [source](external_dicts_dict_sources.md). - -Exemple de paramètres: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -ou - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index f5027311e76..00000000000 --- a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,622 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 43 -toc_title: Sources de dictionnaires externes ---- - -# Sources De Dictionnaires Externes {#dicts-external-dicts-dict-sources} - -Externe dictionnaire peut être connecté à partir de nombreuses sources différentes. - -Si dictionary est configuré à l'aide de xml-file, la configuration ressemble à ceci: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -En cas de [DDL-requête](../../statements/create.md#create-dictionary-query), configuration égale ressemblera à: - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -La source est configurée dans le `source` section. - -Pour les sources de types [Fichier Local](#dicts-external_dicts_dict_sources-local_file), [Fichier exécutable](#dicts-external_dicts_dict_sources-executable), [HTTP(s)](#dicts-external_dicts_dict_sources-http), [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) -les paramètres optionnels sont possibles: - -``` xml -@@ -53,6 +49,12 @@ optional settings are available: - - -``` -ou -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -SETTINGS(format_csv_allow_single_quotes = 1) -``` - -Les Types de sources (`source_type`): - -- [Fichier Local](#dicts-external_dicts_dict_sources-local_file) -- [Fichier exécutable](#dicts-external_dicts_dict_sources-executable) -- [HTTP(S)](#dicts-external_dicts_dict_sources-http) -- DBMS - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) - - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) - - [Redis](#dicts-external_dicts_dict_sources-redis) - -## Fichier Local {#dicts-external_dicts_dict_sources-local_file} - -Exemple de paramètres: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -ou - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Définition des champs: - -- `path` – The absolute path to the file. -- `format` – The file format. All the formats described in “[Format](../../../interfaces/formats.md#formats)” sont pris en charge. - -## Fichier Exécutable {#dicts-external_dicts_dict_sources-executable} - -Travailler avec des fichiers exécutables en dépend [comment le dictionnaire est stocké dans la mémoire](external_dicts_dict_layout.md). Si le dictionnaire est stocké en utilisant `cache` et `complex_key_cache`, Clickhouse demande les clés nécessaires en envoyant une requête au STDIN du fichier exécutable. Sinon, ClickHouse démarre le fichier exécutable et traite sa sortie comme des données de dictionnaire. - -Exemple de paramètres: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -ou - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Définition des champs: - -- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). -- `format` – The file format. All the formats described in “[Format](../../../interfaces/formats.md#formats)” sont pris en charge. - -## Http(s) {#dicts-external_dicts_dict_sources-http} - -Travailler avec un serveur HTTP (S) dépend de [comment le dictionnaire est stocké dans la mémoire](external_dicts_dict_layout.md). Si le dictionnaire est stocké en utilisant `cache` et `complex_key_cache`, Clickhouse demande les clés nécessaires en envoyant une demande via le `POST` méthode. - -Exemple de paramètres: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -ou - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -Pour que ClickHouse accède à une ressource HTTPS, vous devez [configurer openSSL](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-openssl) dans la configuration du serveur. - -Définition des champs: - -- `url` – The source URL. -- `format` – The file format. All the formats described in “[Format](../../../interfaces/formats.md#formats)” sont pris en charge. -- `credentials` – Basic HTTP authentication. Optional parameter. - - `user` – Username required for the authentication. - - `password` – Password required for the authentication. -- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. - - `header` – Single HTTP header entry. - - `name` – Identifiant name used for the header send on the request. - - `value` – Value set for a specific identifiant name. - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -Vous pouvez utiliser cette méthode pour connecter n'importe quelle base de données dotée d'un pilote ODBC. - -Exemple de paramètres: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -ou - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -Définition des champs: - -- `db` – Name of the database. Omit it if the database name is set in the `` paramètre. -- `table` – Name of the table and schema if exists. -- `connection_string` – Connection string. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Mise à jour des dictionnaires](external_dicts_dict_lifetime.md). - -ClickHouse reçoit des symboles de citation D'ODBC-driver et cite tous les paramètres des requêtes au pilote, il est donc nécessaire de définir le nom de la table en conséquence sur le cas du nom de la table dans la base de données. - -Si vous avez des problèmes avec des encodages lors de l'utilisation d'Oracle, consultez le [FAQ](../../../faq/general.md#oracle-odbc-encodings) article. - -### Vulnérabilité connue de la fonctionnalité du dictionnaire ODBC {#known-vulnerability-of-the-odbc-dictionary-functionality} - -!!! attention "Attention" - Lors de la connexion à la base de données via le paramètre de connexion du pilote ODBC `Servername` peut être substitué. Dans ce cas, les valeurs de `USERNAME` et `PASSWORD` de `odbc.ini` sont envoyés au serveur distant et peuvent être compromis. - -**Exemple d'utilisation non sécurisée** - -Configurons unixODBC pour PostgreSQL. Le contenu de `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -Si vous faites alors une requête telle que - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -Le pilote ODBC enverra des valeurs de `USERNAME` et `PASSWORD` de `odbc.ini` de `some-server.com`. - -### Exemple De Connexion Postgresql {#example-of-connecting-postgresql} - -Ubuntu OS. - -Installation d'unixODBC et du pilote ODBC pour PostgreSQL: - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -Configuration `/etc/odbc.ini` (ou `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -La configuration du dictionnaire dans ClickHouse: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -ou - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) -``` - -Vous devrez peut-être modifier `odbc.ini` pour spécifier le chemin d'accès complet à la bibliothèque avec le conducteur `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### Exemple de connexion à MS SQL Server {#example-of-connecting-ms-sql-server} - -Ubuntu OS. - -Installation du pilote: : - -``` bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -Configuration du pilote: - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -Configuration du dictionnaire dans ClickHouse: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -ou - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## DBMS {#dbms} - -### Mysql {#dicts-external_dicts_dict_sources-mysql} - -Exemple de paramètres: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -ou - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -Définition des champs: - -- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). - -- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `replica` – Section of replica configurations. There can be multiple sections. - - - `replica/host` – The MySQL host. - - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. - -- `db` – Name of the database. - -- `table` – Name of the table. - -- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` clause dans MySQL, par exemple, `id > 10 AND id < 20`. Paramètre facultatif. - -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Mise à jour des dictionnaires](external_dicts_dict_lifetime.md). - -MySQL peut être connecté sur un hôte local via des sockets. Pour ce faire, définissez `host` et `socket`. - -Exemple de paramètres: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -ou - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### Clickhouse {#dicts-external_dicts_dict_sources-clickhouse} - -Exemple de paramètres: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -ou - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -Définition des champs: - -- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [Distribué](../../../engines/table_engines/special/distributed.md) table et entrez-le dans les configurations suivantes. -- `port` – The port on the ClickHouse server. -- `user` – Name of the ClickHouse user. -- `password` – Password of the ClickHouse user. -- `db` – Name of the database. -- `table` – Name of the table. -- `where` – The selection criteria. May be omitted. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Mise à jour des dictionnaires](external_dicts_dict_lifetime.md). - -### Mongodb {#dicts-external_dicts_dict_sources-mongodb} - -Exemple de paramètres: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -ou - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -Définition des champs: - -- `host` – The MongoDB host. -- `port` – The port on the MongoDB server. -- `user` – Name of the MongoDB user. -- `password` – Password of the MongoDB user. -- `db` – Name of the database. -- `collection` – Name of the collection. - -### Redis {#dicts-external_dicts_dict_sources-redis} - -Exemple de paramètres: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -ou - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -Définition des champs: - -- `host` – The Redis host. -- `port` – The port on the Redis server. -- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` est pour les sources simples et pour les sources à clé unique hachées, `hash_map` est pour les sources hachées avec deux clés. Les sources À Distance et les sources de cache à clé complexe ne sont pas prises en charge. Peut être omis, la valeur par défaut est `simple`. -- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index 2aed425c6da..00000000000 --- a/docs/fr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 44 -toc_title: "Cl\xE9 et champs du dictionnaire" ---- - -# Clé et champs du dictionnaire {#dictionary-key-and-fields} - -Le `` la clause décrit la clé du dictionnaire et les champs disponibles pour les requêtes. - -Description XML: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -Les attributs sont décrits dans les éléments: - -- `` — [La colonne de la clé](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [Colonne de données](external_dicts_dict_structure.md#ext_dict_structure-attributes). Il peut y avoir un certain nombre d'attributs. - -Requête DDL: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -Les attributs sont décrits dans le corps de la requête: - -- `PRIMARY KEY` — [La colonne de la clé](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [Colonne de données](external_dicts_dict_structure.md#ext_dict_structure-attributes). Il peut y avoir un certain nombre d'attributs. - -## Clé {#ext_dict_structure-key} - -ClickHouse prend en charge les types de clés suivants: - -- Touche numérique. `UInt64`. Défini dans le `` tag ou en utilisant `PRIMARY KEY` mot. -- Clé Composite. Ensemble de valeurs de types différents. Défini dans la balise `` ou `PRIMARY KEY` mot. - -Une structure xml peut contenir `` ou ``. DDL-requête doit contenir unique `PRIMARY KEY`. - -!!! warning "Avertissement" - Vous ne devez pas décrire clé comme un attribut. - -### Touche Numérique {#ext_dict-numeric-key} - -Type: `UInt64`. - -Exemple de Configuration: - -``` xml - - Id - -``` - -Champs de Configuration: - -- `name` – The name of the column with keys. - -Pour DDL-requête: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – The name of the column with keys. - -### Clé Composite {#composite-key} - -La clé peut être un `tuple` de tous les types de champs. Le [disposition](external_dicts_dict_layout.md) dans ce cas, doit être `complex_key_hashed` ou `complex_key_cache`. - -!!! tip "Conseil" - Une clé composite peut être constitué d'un seul élément. Cela permet d'utiliser une chaîne comme clé, par exemple. - -La structure de clé est définie dans l'élément ``. Les principaux champs sont spécifiés dans le même format que le dictionnaire [attribut](external_dicts_dict_structure.md). Exemple: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -ou - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -Pour une requête à l' `dictGet*` fonction, un tuple est passé comme clé. Exemple: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## Attribut {#ext_dict_structure-attributes} - -Exemple de Configuration: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -ou - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -Champs de Configuration: - -| Balise | Description | Requis | -|------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------| -| `name` | Nom de la colonne. | Oui | -| `type` | Type de données ClickHouse.
ClickHouse tente de convertir la valeur du dictionnaire vers le type de données spécifié. Par exemple, pour MySQL, le champ peut être `TEXT`, `VARCHAR`, ou `BLOB` dans la table source MySQL, mais il peut être téléchargé comme `String` à ClickHouse.
[Nullable](../../../sql_reference/data_types/nullable.md) n'est pas pris en charge. | Oui | -| `null_value` | Valeur par défaut pour un élément inexistant.
Dans l'exemple, c'est une chaîne vide. Vous ne pouvez pas utiliser `NULL` dans ce domaine. | Oui | -| `expression` | [Expression](../../syntax.md#syntax-expressions) que ClickHouse s'exécute sur la valeur.
L'expression peut être un nom de colonne dans la base de données SQL distante. Ainsi, vous pouvez l'utiliser pour créer un alias pour la colonne à distance.

Valeur par défaut: aucune expression. | Aucun | -| `hierarchical` | Si `true`, l'attribut contient la valeur d'un parent clé de la clé actuelle. Voir [Dictionnaires Hiérarchiques](external_dicts_dict_hierarchical.md).

Valeur par défaut: `false`. | Aucun | -| `injective` | Indicateur qui indique si le `id -> attribute` l'image est [injective](https://en.wikipedia.org/wiki/Injective_function).
Si `true`, ClickHouse peut automatiquement placer après le `GROUP BY` clause les requêtes aux dictionnaires avec injection. Habituellement, il réduit considérablement le montant de ces demandes.

Valeur par défaut: `false`. | Aucun | -| `is_object_id` | Indicateur qui indique si la requête est exécutée pour un document MongoDB par `ObjectID`.

Valeur par défaut: `false`. | Aucun | - -## Voir Aussi {#see-also} - -- [Fonctions pour travailler avec des dictionnaires externes](../../../sql_reference/functions/ext_dict_functions.md). - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/fr/sql_reference/dictionaries/index.md b/docs/fr/sql_reference/dictionaries/index.md deleted file mode 100644 index 68b484d46c4..00000000000 --- a/docs/fr/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Dictionaries -toc_priority: 35 -toc_title: Introduction ---- - -# Dictionnaire {#dictionaries} - -Un dictionnaire est une cartographie (`key -> attributes`) qui est pratique pour différents types de listes de référence. - -ClickHouse prend en charge des fonctions spéciales pour travailler avec des dictionnaires qui peuvent être utilisés dans les requêtes. Il est plus facile et plus efficace d'utiliser des dictionnaires avec des fonctions que par une `JOIN` avec des tableaux de référence. - -[NULL](../syntax.md#null) les valeurs ne peuvent pas être stockées dans un dictionnaire. - -Supports ClickHouse: - -- [Construit-dans les dictionnaires](internal_dicts.md#internal_dicts) avec un [ensemble de fonctions](../../sql_reference/functions/ym_dict_functions.md). -- [Plug-in (externe) dictionnaires](external_dictionaries/external_dicts.md) avec un [net de fonctions](../../sql_reference/functions/ext_dict_functions.md). - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/fr/sql_reference/dictionaries/internal_dicts.md b/docs/fr/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index bee5904dbdc..00000000000 --- a/docs/fr/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 39 -toc_title: Dictionnaires Internes ---- - -# Dictionnaires internes {#internal_dicts} - -ClickHouse contient une fonction intégrée pour travailler avec une géobase. - -Cela vous permet de: - -- Utilisez L'ID d'une région pour obtenir son nom dans la langue souhaitée. -- Utilisez L'ID d'une région pour obtenir L'ID d'une ville, d'une région, d'un district fédéral, d'un pays ou d'un continent. -- Vérifiez si une région fait partie d'une autre région. -- Obtenez une chaîne de régions parentes. - -Toutes les fonctions prennent en charge “translocality,” la capacité d'utiliser simultanément différentes perspectives sur la propriété de la région. Pour plus d'informations, consultez la section “Functions for working with Yandex.Metrica dictionaries”. - -Les dictionnaires internes sont désactivés dans le package par défaut. -Pour les activer, décommentez les paramètres `path_to_regions_hierarchy_file` et `path_to_regions_names_files` dans le fichier de configuration du serveur. - -La géobase est chargée à partir de fichiers texte. - -Place de la `regions_hierarchy*.txt` les fichiers dans le `path_to_regions_hierarchy_file` répertoire. Ce paramètre de configuration doit contenir le chemin `regions_hierarchy.txt` fichier (la hiérarchie régionale par défaut), et les autres fichiers (`regions_hierarchy_ua.txt`) doit être situé dans le même répertoire. - -Mettre le `regions_names_*.txt` les fichiers dans le `path_to_regions_names_files` répertoire. - -Vous pouvez également créer ces fichiers vous-même. Le format de fichier est le suivant: - -`regions_hierarchy*.txt`: TabSeparated (pas d'en-tête), colonnes: - -- région de l'ID (`UInt32`) -- ID de région parent (`UInt32`) -- type de région (`UInt8`): 1-continent, 3-pays, 4-district fédéral, 5-région, 6-ville; les autres types n'ont pas de valeurs -- population (`UInt32`) — optional column - -`regions_names_*.txt`: TabSeparated (pas d'en-tête), colonnes: - -- région de l'ID (`UInt32`) -- nom de la région (`String`) — Can't contain tabs or line feeds, even escaped ones. - -Un tableau plat est utilisé pour stocker dans la RAM. Pour cette raison, les ID ne devraient pas dépasser un million. - -Les dictionnaires peuvent être mis à jour sans redémarrer le serveur. Cependant, l'ensemble des dictionnaires n'est pas mis à jour. -Pour les mises à jour, les temps de modification du fichier sont vérifiés. Si un fichier a été modifié, le dictionnaire est mis à jour. -L'intervalle de vérification des modifications est configuré dans le `builtin_dictionaries_reload_interval` paramètre. -Les mises à jour du dictionnaire (autres que le chargement lors de la première utilisation) ne bloquent pas les requêtes. Lors des mises à jour, les requêtes utilisent les anciennes versions des dictionnaires. Si une erreur se produit pendant une mise à jour, l'erreur est écrite dans le journal du serveur et les requêtes continuent d'utiliser l'ancienne version des dictionnaires. - -Nous vous recommandons de mettre à jour périodiquement les dictionnaires avec la géobase. Lors d'une mise à jour, générez de nouveaux fichiers et écrivez-les dans un emplacement séparé. Lorsque tout est prêt, renommez - les en fichiers utilisés par le serveur. - -Il existe également des fonctions pour travailler avec les identifiants du système d'exploitation et Yandex.Moteurs de recherche Metrica, mais ils ne devraient pas être utilisés. - -[Article Original](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/fr/sql_reference/functions/arithmetic_functions.md b/docs/fr/sql_reference/functions/arithmetic_functions.md deleted file mode 100644 index 2eeea83297d..00000000000 --- a/docs/fr/sql_reference/functions/arithmetic_functions.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 35 -toc_title: "Arithm\xE9tique" ---- - -# Fonctions arithmétiques {#arithmetic-functions} - -Pour toutes les fonctions arithmétiques, le type de résultat est calculé comme le plus petit type de nombre dans lequel le résultat correspond, s'il existe un tel type. Le minimum est pris simultanément sur la base du nombre de bits, s'il est signé, et s'il flotte. S'il n'y a pas assez de bits, le type de bits le plus élevé est pris. - -Exemple: - -``` sql -SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) -``` - -``` text -┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ -│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ -└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ -``` - -Les fonctions arithmétiques fonctionnent pour n'importe quelle paire de types de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 ou Float64. - -Le débordement est produit de la même manière qu'en C++. - -## plus (A, B), opérateur a + b {#plusa-b-a-b-operator} - -Calcule la somme des nombres. -Vous pouvez également ajouter des nombres entiers avec une date ou la date et l'heure. Dans le cas d'une date, Ajouter un entier signifie ajouter le nombre de jours correspondant. Pour une date avec l'heure, cela signifie ajouter le nombre de secondes correspondant. - -## moins (A, B), opérateur a - b {#minusa-b-a-b-operator} - -Calcule la différence. Le résultat est toujours signé. - -You can also calculate integer numbers from a date or date with time. The idea is the same – see above for ‘plus’. - -## la multiplication(a, b), a \* et b \* de l'opérateur {#multiplya-b-a-b-operator} - -Calcule le produit des nombres. - -## diviser (A, B), opérateur a / b {#dividea-b-a-b-operator} - -Calcule le quotient des nombres. Le type de résultat est toujours un type à virgule flottante. -Il n'est pas de division entière. Pour la division entière, utilisez le ‘intDiv’ fonction. -En divisant par zéro vous obtenez ‘inf’, ‘-inf’, ou ‘nan’. - -## intDiv (a, b) {#intdiva-b} - -Calcule le quotient des nombres. Divise en entiers, arrondi vers le bas (par la valeur absolue). -Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. - -## intDivOrZero(a, b) {#intdivorzeroa-b} - -Diffère de ‘intDiv’ en ce sens qu'il renvoie zéro en divisant par zéro ou en divisant un nombre négatif minimal par moins un. - -## opérateur modulo(A, B), A % B {#moduloa-b-a-b-operator} - -Calcule le reste après la division. -Si les arguments sont des nombres à virgule flottante, ils sont pré-convertis en entiers en supprimant la partie décimale. -Le reste est pris dans le même sens qu'en C++. La division tronquée est utilisée pour les nombres négatifs. -Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. - -## moduloOrZero (a, b) {#moduloorzeroa-b} - -Diffère de ‘modulo’ en ce sens qu'il renvoie zéro lorsque le diviseur est nul. - -## annuler (a), - un opérateur {#negatea-a-operator} - -Calcule un nombre avec le signe inverse. Le résultat est toujours signé. - -## abs(un) {#arithm_func-abs} - -Calcule la valeur absolue d'un nombre (un). Autrement dit, si un \< 0, Il renvoie-A. pour les types non signés, il ne fait rien. Pour les types entiers signés, il renvoie un nombre non signé. - -## pgcd(a, b) {#gcda-b} - -Renvoie le plus grand diviseur commun des nombres. -Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. - -## ppcm(a, b) {#lcma-b} - -Renvoie le multiple le moins commun des nombres. -Une exception est levée en divisant par zéro ou en divisant un nombre négatif minimal par moins un. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/fr/sql_reference/functions/array_functions.md b/docs/fr/sql_reference/functions/array_functions.md deleted file mode 100644 index 9aefe83fae0..00000000000 --- a/docs/fr/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,1057 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 46 -toc_title: Travailler avec des tableaux ---- - -# Fonctions pour travailler avec des tableaux {#functions-for-working-with-arrays} - -## vide {#function-empty} - -Retourne 1 pour un tableau vide, ou 0 pour un non-vide. -Le type de résultat est UInt8. -La fonction fonctionne également pour les chaînes. - -## notEmpty {#function-notempty} - -Retourne 0 pour un tableau vide, ou 1 pour un non-vide. -Le type de résultat est UInt8. -La fonction fonctionne également pour les chaînes. - -## longueur {#array_functions-length} - -Retourne le nombre d'éléments dans le tableau. -Le type de résultat est UInt64. -La fonction fonctionne également pour les chaînes. - -## emptyArrayUInt8, emptyArrayUInt16, emptyArrayUInt32, emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## emptyArrayInt8, emptyArrayInt16, emptyArrayInt32, emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} - -## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} - -## emptyArrayString {#emptyarraystring} - -Accepte zéro argument et renvoie un tableau vide du type approprié. - -## emptyArrayToSingle {#emptyarraytosingle} - -Accepte un tableau vide et renvoie un élément de tableau qui est égal à la valeur par défaut. - -## plage (fin), Plage(début, fin \[, étape\]) {#rangeend-rangestart-end-step} - -Retourne un tableau de nombres du début à la fin-1 par étape. -Si l'argument `start` n'est pas spécifié, la valeur par défaut est 0. -Si l'argument `step` n'est pas spécifié, la valeur par défaut est 1. -Il se comporte presque comme pythonic `range`. Mais la différence est que tous les types d'arguments doivent être `UInt` nombre. -Juste au cas où, une exception est levée si des tableaux d'une longueur totale de plus de 100 000 000 d'éléments sont créés dans un bloc de données. - -## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} - -Crée un tableau à partir des arguments de la fonction. -Les arguments doivent être des constantes et avoir des types qui ont le plus petit type commun. Au moins un argument doit être passé, sinon il n'est pas clair quel type de tableau créer. Qui est, vous ne pouvez pas utiliser cette fonction pour créer un tableau vide (pour ce faire, utilisez la ‘emptyArray\*’ la fonction décrite ci-dessus). -Retourne un ‘Array(T)’ type de résultat, où ‘T’ est le plus petit type commun parmi les arguments passés. - -## arrayConcat {#arrayconcat} - -Combine des tableaux passés comme arguments. - -``` sql -arrayConcat(arrays) -``` - -**Paramètre** - -- `arrays` – Arbitrary number of arguments of [Tableau](../../sql_reference/data_types/array.md) type. - **Exemple** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,3,4,5,6] │ -└───────────────┘ -``` - -## arrayElement(arr, n), opérateur arr\[n\] {#arrayelementarr-n-operator-arrn} - -Récupérer l'élément avec l'index `n` à partir du tableau `arr`. `n` doit être n'importe quel type entier. -Les index dans un tableau commencent à partir d'un. -Les index négatifs sont pris en charge. Dans ce cas, il sélectionne l'élément correspondant numérotées à partir de la fin. Exemple, `arr[-1]` est le dernier élément du tableau. - -Si l'index est en dehors des limites d'un tableau, il renvoie une valeur (0 pour les nombres, une chaîne vide pour les cordes, etc.), sauf pour le cas avec un tableau non constant et un index constant 0 (dans ce cas, il y aura une erreur `Array indices are 1-based`). - -## a (arr, elem) {#hasarr-elem} - -Vérifie si le ‘arr’ tableau a la ‘elem’ élément. -Retourne 0 si l'élément n'est pas dans le tableau, ou 1 si elle l'est. - -`NULL` est traitée comme une valeur. - -``` sql -SELECT has([1, 2, NULL], NULL) -``` - -``` text -┌─has([1, 2, NULL], NULL)─┐ -│ 1 │ -└─────────────────────────┘ -``` - -## hasAll {#hasall} - -Vérifie si un tableau est un sous-ensemble de l'autre. - -``` sql -hasAll(set, subset) -``` - -**Paramètre** - -- `set` – Array of any type with a set of elements. -- `subset` – Array of any type with elements that should be tested to be a subset of `set`. - -**Les valeurs de retour** - -- `1`, si `set` contient tous les éléments de `subset`. -- `0`, autrement. - -**Propriétés particulières** - -- Un tableau vide est un sous-ensemble d'un tableau quelconque. -- `Null` traitée comme une valeur. -- Ordre des valeurs dans les deux tableaux n'a pas d'importance. - -**Exemple** - -`SELECT hasAll([], [])` retours 1. - -`SELECT hasAll([1, Null], [Null])` retours 1. - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` retours 1. - -`SELECT hasAll(['a', 'b'], ['a'])` retours 1. - -`SELECT hasAll([1], ['a'])` renvoie 0. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` renvoie 0. - -## hasAny {#hasany} - -Vérifie si deux tableaux ont une intersection par certains éléments. - -``` sql -hasAny(array1, array2) -``` - -**Paramètre** - -- `array1` – Array of any type with a set of elements. -- `array2` – Array of any type with a set of elements. - -**Les valeurs de retour** - -- `1`, si `array1` et `array2` avoir un élément similaire au moins. -- `0`, autrement. - -**Propriétés particulières** - -- `Null` traitée comme une valeur. -- Ordre des valeurs dans les deux tableaux n'a pas d'importance. - -**Exemple** - -`SELECT hasAny([1], [])` retourner `0`. - -`SELECT hasAny([Null], [Null, 1])` retourner `1`. - -`SELECT hasAny([-128, 1., 512], [1])` retourner `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` retourner `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` retourner `1`. - -## indexOf (arr, x) {#indexofarr-x} - -Renvoie l'index de la première ‘x’ élément (à partir de 1) s'il est dans le tableau, ou 0 s'il ne l'est pas. - -Exemple: - -``` sql -SELECT indexOf([1, 3, NULL, NULL], NULL) -``` - -``` text -┌─indexOf([1, 3, NULL, NULL], NULL)─┐ -│ 3 │ -└───────────────────────────────────┘ -``` - -Ensemble d'éléments de `NULL` sont traités comme des valeurs normales. - -## countEqual (arr, x) {#countequalarr-x} - -Renvoie le nombre d'éléments dans le tableau égal à X. équivalent à arrayCount (elem - \> elem = x, arr). - -`NULL` les éléments sont traités comme des valeurs distinctes. - -Exemple: - -``` sql -SELECT countEqual([1, 2, NULL, NULL], NULL) -``` - -``` text -┌─countEqual([1, 2, NULL, NULL], NULL)─┐ -│ 2 │ -└──────────────────────────────────────┘ -``` - -## arrayEnumerate (arr) {#array_functions-arrayenumerate} - -Returns the array \[1, 2, 3, …, length (arr) \] - -Cette fonction est normalement utilisée avec ARRAY JOIN. Il permet de compter quelque chose une seule fois pour chaque tableau après l'application de la jointure de tableau. Exemple: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -Dans cet exemple, Reaches est le nombre de conversions (les chaînes reçues après l'application de la jointure de tableau), et Hits est le nombre de pages vues (chaînes avant la jointure de tableau). Dans ce cas particulier, vous pouvez obtenir le même résultat dans une voie plus facile: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -Cette fonction peut également être utilisée dans les fonctions d'ordre supérieur. Par exemple, vous pouvez l'utiliser pour obtenir les indices de tableau pour les éléments qui correspondent à une condition. - -## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} - -Renvoie un tableau de la même taille que le tableau source, indiquant pour chaque élément Quelle est sa position parmi les éléments de même valeur. -Par exemple: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. - -Cette fonction est utile lors de L'utilisation de la jointure de tableau et de l'agrégation d'éléments de tableau. -Exemple: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - -``` text -┌──GoalID─┬─Reaches─┬─Visits─┐ -│ 53225 │ 3214 │ 1097 │ -│ 2825062 │ 3188 │ 1097 │ -│ 56600 │ 2803 │ 488 │ -│ 1989037 │ 2401 │ 365 │ -│ 2830064 │ 2396 │ 910 │ -│ 1113562 │ 2372 │ 373 │ -│ 3270895 │ 2262 │ 812 │ -│ 1084657 │ 2262 │ 345 │ -│ 56599 │ 2260 │ 799 │ -│ 3271094 │ 2256 │ 812 │ -└─────────┴─────────┴────────┘ -``` - -Dans cet exemple, chaque ID d'objectif a un calcul du nombre de conversions (chaque élément de la structure de données imbriquées objectifs est un objectif atteint, que nous appelons une conversion) et le nombre de sessions. Sans array JOIN, nous aurions compté le nombre de sessions comme sum(signe). Mais dans ce cas particulier, les lignes ont été multipliées par la structure des objectifs imbriqués, donc pour compter chaque session une fois après cela, nous appliquons une condition à la valeur de arrayEnumerateUniq(Goals.ID) fonction. - -La fonction arrayEnumerateUniq peut prendre plusieurs tableaux de la même taille que les arguments. Dans ce cas, l'unicité est considérée pour les tuples d'éléments dans les mêmes positions dans tous les tableaux. - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,1,1,2,1] │ -└───────────────┘ -``` - -Ceci est nécessaire lors de L'utilisation de Array JOIN avec une structure de données imbriquée et une agrégation supplémentaire entre plusieurs éléments de cette structure. - -## arrayPopBack {#arraypopback} - -Supprime le dernier élément du tableau. - -``` sql -arrayPopBack(array) -``` - -**Paramètre** - -- `array` – Array. - -**Exemple** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## arrayPopFront {#arraypopfront} - -Supprime le premier élément de la matrice. - -``` sql -arrayPopFront(array) -``` - -**Paramètre** - -- `array` – Array. - -**Exemple** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [2,3] │ -└───────┘ -``` - -## arrayPushBack {#arraypushback} - -Ajoute un élément à la fin du tableau. - -``` sql -arrayPushBack(array, single_value) -``` - -**Paramètre** - -- `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 pour le type de données du tableau. Pour plus d'informations sur les types de données dans ClickHouse, voir “[Types de données](../../sql_reference/data_types/index.md#data_types)”. Peut être `NULL`. La fonction ajoute un `NULL` tableau, et le type d'éléments de tableau convertit en `Nullable`. - -**Exemple** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayPushFront {#arraypushfront} - -Ajoute un élément au début du tableau. - -``` sql -arrayPushFront(array, single_value) -``` - -**Paramètre** - -- `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 pour le type de données du tableau. Pour plus d'informations sur les types de données dans ClickHouse, voir “[Types de données](../../sql_reference/data_types/index.md#data_types)”. Peut être `NULL`. La fonction ajoute un `NULL` tableau, et le type d'éléments de tableau convertit en `Nullable`. - -**Exemple** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayResize {#arrayresize} - -Les changements de la longueur du tableau. - -``` sql -arrayResize(array, size[, extender]) -``` - -**Paramètre:** - -- `array` — Array. -- `size` — Required length of the array. - - Si `size` est inférieure à la taille d'origine du tableau, le tableau est tronqué à partir de la droite. -- Si `size` est plus grande que la taille initiale du tableau, le tableau est étendu vers la droite avec `extender` valeurs ou valeurs par défaut pour le type de données des éléments du tableau. -- `extender` — Value for extending an array. Can be `NULL`. - -**Valeur renvoyée:** - -Un tableau de longueur `size`. - -**Exemples d'appels** - -``` sql -SELECT arrayResize([1], 3) -``` - -``` text -┌─arrayResize([1], 3)─┐ -│ [1,0,0] │ -└─────────────────────┘ -``` - -``` sql -SELECT arrayResize([1], 3, NULL) -``` - -``` text -┌─arrayResize([1], 3, NULL)─┐ -│ [1,NULL,NULL] │ -└───────────────────────────┘ -``` - -## arraySlice {#arrayslice} - -Retourne une tranche du tableau. - -``` sql -arraySlice(array, offset[, length]) -``` - -**Paramètre** - -- `array` – Array of data. -- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. -- `length` - La longueur de la nécessaire tranche. Si vous spécifiez une valeur négative, la fonction renvoie un ouvert tranche `[offset, array_length - length)`. Si vous omettez la valeur, la fonction renvoie la tranche `[offset, the_end_of_array]`. - -**Exemple** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - -``` text -┌─res────────┐ -│ [2,NULL,4] │ -└────────────┘ -``` - -Éléments de tableau définis sur `NULL` sont traités comme des valeurs normales. - -## arraySort(\[func,\] arr, …) {#array_functions-sort} - -Trie les éléments de la `arr` tableau dans l'ordre croissant. Si l' `func` fonction est spécifiée, l'ordre de tri est déterminé par le résultat de la `func` fonction appliquée aux éléments du tableau. Si `func` accepte plusieurs arguments, le `arraySort` la fonction est passé plusieurs tableaux que les arguments de `func` correspond à. Des exemples détaillés sont présentés à la fin de `arraySort` Description. - -Exemple de tri de valeurs entières: - -``` sql -SELECT arraySort([1, 3, 3, 0]); -``` - -``` text -┌─arraySort([1, 3, 3, 0])─┐ -│ [0,1,3,3] │ -└─────────────────────────┘ -``` - -Exemple de tri des valeurs de chaîne: - -``` sql -SELECT arraySort(['hello', 'world', '!']); -``` - -``` text -┌─arraySort(['hello', 'world', '!'])─┐ -│ ['!','hello','world'] │ -└────────────────────────────────────┘ -``` - -Considérez l'ordre de tri suivant pour le `NULL`, `NaN` et `Inf` valeur: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - -``` text -┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ -│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────────────────────────┘ -``` - -- `-Inf` les valeurs sont d'abord dans le tableau. -- `NULL` les valeurs sont les derniers dans le tableau. -- `NaN` les valeurs sont juste avant `NULL`. -- `Inf` les valeurs sont juste avant `NaN`. - -Notez que `arraySort` est un [fonction d'ordre supérieur](higher_order_functions.md). Vous pouvez passer d'une fonction lambda comme premier argument. Dans ce cas, l'ordre de classement est déterminé par le résultat de la fonction lambda appliquée aux éléments de la matrice. - -Considérons l'exemple suivant: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,2,1] │ -└─────────┘ -``` - -For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` fonction trie les touches dans l'ordre croissant, le résultat est \[3, 2, 1\]. Ainsi, l' `(x) –> -x` fonction lambda définit le [l'ordre décroissant](#array_functions-reverse-sort) dans un tri. - -La fonction lambda peut accepter plusieurs arguments. Dans ce cas, vous avez besoin de passer l' `arraySort` fonction plusieurs tableaux de longueur identique à laquelle correspondront les arguments de la fonction lambda. Le tableau résultant sera composé d'éléments du premier tableau d'entrée; les éléments du(des) Tableau (s) d'entrée suivant (s) spécifient les clés de tri. Exemple: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Ici, les éléments qui sont passés dans le deuxième tableau (\[2, 1\]) définissent une clé de tri pour l'élément correspondant à partir du tableau source (\[‘hello’, ‘world’\]), qui est, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn't use `x`, les valeurs réelles du tableau source n'affectent pas l'ordre dans le résultat. Si, ‘hello’ sera le deuxième élément du résultat, et ‘world’ sera le premier. - -D'autres exemples sont présentés ci-dessous. - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! note "Note" - Pour améliorer l'efficacité du tri, de la [Transformation schwartzienne](https://en.wikipedia.org/wiki/Schwartzian_transform) est utilisée. - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} - -Trie les éléments de la `arr` tableau dans l'ordre décroissant. Si l' `func` la fonction est spécifiée, `arr` est trié en fonction du résultat de la `func` fonction appliquée aux éléments du tableau, puis le tableau trié est inversé. Si `func` accepte plusieurs arguments, le `arrayReverseSort` la fonction est passé plusieurs tableaux que les arguments de `func` correspond à. Des exemples détaillés sont présentés à la fin de `arrayReverseSort` Description. - -Exemple de tri de valeurs entières: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - -``` text -┌─arrayReverseSort([1, 3, 3, 0])─┐ -│ [3,3,1,0] │ -└────────────────────────────────┘ -``` - -Exemple de tri des valeurs de chaîne: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - -``` text -┌─arrayReverseSort(['hello', 'world', '!'])─┐ -│ ['world','hello','!'] │ -└───────────────────────────────────────────┘ -``` - -Considérez l'ordre de tri suivant pour le `NULL`, `NaN` et `Inf` valeur: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` text -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- `Inf` les valeurs sont d'abord dans le tableau. -- `NULL` les valeurs sont les derniers dans le tableau. -- `NaN` les valeurs sont juste avant `NULL`. -- `-Inf` les valeurs sont juste avant `NaN`. - -Notez que l' `arrayReverseSort` est un [fonction d'ordre supérieur](higher_order_functions.md). Vous pouvez passer d'une fonction lambda comme premier argument. Exemple est montré ci-dessous. - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [1,2,3] │ -└─────────┘ -``` - -Le tableau est trié de la façon suivante: - -1. Dans un premier temps, le tableau source (\[1, 2, 3\]) est trié en fonction du résultat de la fonction lambda appliquée aux éléments du tableau. Le résultat est un tableau \[3, 2, 1\]. -2. Tableau qui est obtenu à l'étape précédente, est renversé. Donc, le résultat final est \[1, 2, 3\]. - -La fonction lambda peut accepter plusieurs arguments. Dans ce cas, vous avez besoin de passer l' `arrayReverseSort` fonction plusieurs tableaux de longueur identique à laquelle correspondront les arguments de la fonction lambda. Le tableau résultant sera composé d'éléments du premier tableau d'entrée; les éléments du(des) Tableau (s) d'entrée suivant (s) spécifient les clés de tri. Exemple: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -Dans cet exemple, le tableau est trié de la façon suivante: - -1. Au début, le tableau source (\[‘hello’, ‘world’\]) est triée selon le résultat de la fonction lambda appliquée aux éléments de tableaux. Les éléments qui sont passés dans le deuxième tableau (\[2, 1\]), définissent les clés de tri pour les éléments correspondants du tableau source. Le résultat est un tableau \[‘world’, ‘hello’\]. -2. Tableau trié lors de l'étape précédente, est renversé. Donc, le résultat final est \[‘hello’, ‘world’\]. - -D'autres exemples sont présentés ci-dessous. - -``` sql -SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; -``` - -``` text -┌─res─────┐ -│ [5,3,4] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` text -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#arrayuniqarr} - -Si un argument est passé, il compte le nombre de différents éléments dans le tableau. -Si plusieurs arguments sont passés, il compte le nombre de tuples différents d'éléments aux positions correspondantes dans plusieurs tableaux. - -Si vous souhaitez obtenir une liste des éléments dans un tableau, vous pouvez utiliser arrayReduce(‘groupUniqArray’, arr). - -## arrayJoin (arr) {#array-functions-join} - -Une fonction spéciale. Voir la section [“ArrayJoin function”](array_join.md#functions_arrayjoin). - -## tableaudifférence {#arraydifference} - -Calcule la différence entre les éléments de tableau adjacents. Renvoie un tableau où le premier élément sera 0, le second est la différence entre `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). - -**Syntaxe** - -``` sql -arrayDifference(array) -``` - -**Paramètre** - -- `array` – [Tableau](https://clickhouse.yandex/docs/en/data_types/array/). - -**Valeurs renvoyées** - -Renvoie un tableau de différences entre les éléments adjacents. - -Type: [UInt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [Flottant\*](https://clickhouse.yandex/docs/en/data_types/float/). - -**Exemple** - -Requête: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - -Résultat: - -``` text -┌─arrayDifference([1, 2, 3, 4])─┐ -│ [0,1,1,1] │ -└───────────────────────────────┘ -``` - -Exemple de débordement dû au type de résultat Int64: - -Requête: - -``` sql -SELECT arrayDifference([0, 10000000000000000000]) -``` - -Résultat: - -``` text -┌─arrayDifference([0, 10000000000000000000])─┐ -│ [0,-8446744073709551616] │ -└────────────────────────────────────────────┘ -``` - -## arrayDistinct {#arraydistinct} - -Prend un tableau, retourne un tableau contenant les différents éléments seulement. - -**Syntaxe** - -``` sql -arrayDistinct(array) -``` - -**Paramètre** - -- `array` – [Tableau](https://clickhouse.yandex/docs/en/data_types/array/). - -**Valeurs renvoyées** - -Retourne un tableau contenant les éléments distincts. - -**Exemple** - -Requête: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - -Résultat: - -``` text -┌─arrayDistinct([1, 2, 2, 3, 1])─┐ -│ [1,2,3] │ -└────────────────────────────────┘ -``` - -## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} - -Renvoie un tableau de la même taille que le tableau source, indiquant où chaque élément apparaît en premier dans le tableau source. - -Exemple: - -``` sql -SELECT arrayEnumerateDense([10, 20, 10, 30]) -``` - -``` text -┌─arrayEnumerateDense([10, 20, 10, 30])─┐ -│ [1,2,1,3] │ -└───────────────────────────────────────┘ -``` - -## arrayIntersect (arr) {#array-functions-arrayintersect} - -Prend plusieurs tableaux, retourne un tableau avec des éléments présents dans tous les tableaux source. L'ordre des éléments dans le tableau résultant est le même que dans le premier tableau. - -Exemple: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - -``` text -┌─no_intersect─┬─intersect─┐ -│ [] │ [1] │ -└──────────────┴───────────┘ -``` - -## arrayReduce {#arrayreduce} - -Applique une fonction d'agrégation aux éléments du tableau et renvoie son résultat. Le nom de la fonction d'agrégation est passé sous forme de chaîne entre guillemets simples `'max'`, `'sum'`. Lorsque vous utilisez des fonctions d'agrégat paramétriques, le paramètre est indiqué après le nom de la fonction entre parenthèses `'uniqUpTo(6)'`. - -**Syntaxe** - -``` sql -arrayReduce(agg_func, arr1, arr2, ..., arrN) -``` - -**Paramètre** - -- `agg_func` — The name of an aggregate function which should be a constant [chaîne](../../sql_reference/data_types/string.md). -- `arr` — Any number of [tableau](../../sql_reference/data_types/array.md) tapez les colonnes comme paramètres de la fonction d'agrégation. - -**Valeur renvoyée** - -**Exemple** - -``` sql -SELECT arrayReduce('max', [1, 2, 3]) -``` - -``` text -┌─arrayReduce('max', [1, 2, 3])─┐ -│ 3 │ -└───────────────────────────────┘ -``` - -Si une fonction d'agrégation prend plusieurs arguments, cette fonction doit être appliqué à plusieurs ensembles de même taille. - -``` sql -SELECT arrayReduce('maxIf', [3, 5], [1, 0]) -``` - -``` text -┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ -│ 3 │ -└──────────────────────────────────────┘ -``` - -Exemple avec une fonction d'agrégat paramétrique: - -``` sql -SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -``` - -``` text -┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ -│ 4 │ -└─────────────────────────────────────────────────────────────┘ -``` - -## arrayReduceInRanges {#arrayreduceinranges} - -Applique une fonction d'agrégation d'éléments de tableau dans des plages et retourne un tableau contenant le résultat correspondant à chaque gamme. La fonction retourne le même résultat que plusieurs `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. - -**Syntaxe** - -``` sql -arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) -``` - -**Paramètre** - -- `agg_func` — The name of an aggregate function which should be a constant [chaîne](../../sql_reference/data_types/string.md). -- `ranges` — The ranges to aggretate which should be an [tableau](../../sql_reference/data_types/array.md) de [tuple](../../sql_reference/data_types/tuple.md) qui contient l'indice et la longueur de chaque plage. -- `arr` — Any number of [tableau](../../sql_reference/data_types/array.md) tapez les colonnes comme paramètres de la fonction d'agrégation. - -**Valeur renvoyée** - -**Exemple** - -``` sql -SELECT arrayReduceInRanges( - 'sum', - [(1, 5), (2, 3), (3, 4), (4, 4)], - [1000000, 200000, 30000, 4000, 500, 60, 7] -) AS res -``` - -``` text -┌─res─────────────────────────┐ -│ [1234500,234000,34560,4567] │ -└─────────────────────────────┘ -``` - -## arrayReverse(arr) {#arrayreverse} - -Retourne un tableau de la même taille que l'original tableau contenant les éléments dans l'ordre inverse. - -Exemple: - -``` sql -SELECT arrayReverse([1, 2, 3]) -``` - -``` text -┌─arrayReverse([1, 2, 3])─┐ -│ [3,2,1] │ -└─────────────────────────┘ -``` - -## inverse (arr) {#array-functions-reverse} - -Synonyme de [“arrayReverse”](#array_functions-arrayreverse) - -## arrayFlatten {#arrayflatten} - -Convertit un tableau de tableaux dans un tableau associatif. - -Fonction: - -- S'applique à toute profondeur de tableaux imbriqués. -- Ne change pas les tableaux qui sont déjà plats. - -Le tableau aplati contient tous les éléments de tous les tableaux source. - -**Syntaxe** - -``` sql -flatten(array_of_arrays) -``` - -Alias: `flatten`. - -**Paramètre** - -- `array_of_arrays` — [Tableau](../../sql_reference/data_types/array.md) de tableaux. Exemple, `[[1,2,3], [4,5]]`. - -**Exemple** - -``` sql -SELECT flatten([[[1]], [[2], [3]]]) -``` - -``` text -┌─flatten(array(array([1]), array([2], [3])))─┐ -│ [1,2,3] │ -└─────────────────────────────────────────────┘ -``` - -## arrayCompact {#arraycompact} - -Supprime les éléments en double consécutifs d'un tableau. L'ordre des valeurs de résultat est déterminée par l'ordre dans le tableau source. - -**Syntaxe** - -``` sql -arrayCompact(arr) -``` - -**Paramètre** - -`arr` — The [tableau](../../sql_reference/data_types/array.md) inspecter. - -**Valeur renvoyée** - -Le tableau sans doublon. - -Type: `Array`. - -**Exemple** - -Requête: - -``` sql -SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) -``` - -Résultat: - -``` text -┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ -│ [1,nan,nan,2,3] │ -└────────────────────────────────────────────┘ -``` - -## arrayZip {#arrayzip} - -Combine multiple Array type columns into one Array\[Tuple(…)\] column - -**Syntaxe** - -``` sql -arrayZip(arr1, arr2, ..., arrN) -``` - -**Paramètre** - -`arr` — Any number of [tableau](../../sql_reference/data_types/array.md) tapez les colonnes à combiner. - -**Valeur renvoyée** - -The result of Array\[Tuple(…)\] type after the combination of these arrays - -**Exemple** - -Requête: - -``` sql -SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); -``` - -Résultat: - -``` text -┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ -│ [('a','d'),('b','e'),('c','f')] │ -└────────────────────────────────────────────┘ -``` - -## arrayAUC {#arrayauc} - -Calculer AUC (zone sous la courbe, qui est un concept dans l'apprentissage automatique, voir plus de détails: https://en.wikipedia.org/wiki/Receiver\_operating\_characteristic\#Area\_under\_the\_curve). - -**Syntaxe** - -``` sql -arrayAUC(arr_scores, arr_labels) -``` - -**Paramètre** -- `arr_scores` — scores prediction model gives. -- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. - -**Valeur renvoyée** -Renvoie la valeur AUC avec le type Float64. - -**Exemple** -Requête: - -``` sql -select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) -``` - -Résultat: - -``` text -┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ -│ 0.75 │ -└────────────────────────────────────────---──┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/fr/sql_reference/functions/array_join.md b/docs/fr/sql_reference/functions/array_join.md deleted file mode 100644 index f835950003d..00000000000 --- a/docs/fr/sql_reference/functions/array_join.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 61 -toc_title: arrayJoin ---- - -# fonction arrayJoin {#functions_arrayjoin} - -C'est un très inhabituelle de la fonction. - -Les fonctions normales ne modifient pas un ensemble de lignes, mais modifient simplement les valeurs de chaque ligne (map). -Les fonctions d'agrégation compriment un ensemble de lignes (plier ou réduire). -Le ‘arrayJoin’ la fonction prend chaque ligne et génère un ensemble de lignes (dépliante). - -Cette fonction prend un tableau comme argument et propage la ligne source à plusieurs lignes pour le nombre d'éléments dans le tableau. -Toutes les valeurs des colonnes sont simplement copiés, sauf les valeurs dans la colonne où cette fonction est appliquée; elle est remplacée par la valeur correspondante de tableau. - -Une requête peut utiliser plusieurs `arrayJoin` fonction. Dans ce cas, la transformation est effectuée plusieurs fois. - -Notez la syntaxe de jointure de tableau dans la requête SELECT, qui offre des possibilités plus larges. - -Exemple: - -``` sql -SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src -``` - -``` text -┌─dst─┬─\'Hello\'─┬─src─────┐ -│ 1 │ Hello │ [1,2,3] │ -│ 2 │ Hello │ [1,2,3] │ -│ 3 │ Hello │ [1,2,3] │ -└─────┴───────────┴─────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/array_join/) diff --git a/docs/fr/sql_reference/functions/bit_functions.md b/docs/fr/sql_reference/functions/bit_functions.md deleted file mode 100644 index 149b0084e16..00000000000 --- a/docs/fr/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 48 -toc_title: Bit ---- - -# Peu de fonctions {#bit-functions} - -Les fonctions Bit fonctionnent pour n'importe quelle paire de types de UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32 ou Float64. - -Le type de résultat est un entier avec des bits égaux aux bits maximum de ses arguments. Si au moins l'un des arguments est signé, le résultat est un signé nombre. Si un argument est un nombre à virgule flottante, Il est converti en Int64. - -## bitAnd (a, b) {#bitanda-b} - -## bitOr (a, b) {#bitora-b} - -## bitXor (a, b) {#bitxora-b} - -## bitNot (a) {#bitnota} - -## bitShiftLeft (A, b) {#bitshiftlefta-b} - -## bitShiftRight (A, b) {#bitshiftrighta-b} - -## bitRotateLeft (a, b) {#bitrotatelefta-b} - -## bitRotateRight (a, b) {#bitrotaterighta-b} - -## bitTest {#bittest} - -Prend tout entier et le convertit en [forme binaire](https://en.wikipedia.org/wiki/Binary_number) renvoie la valeur d'un bit à la position spécifiée. Le compte à rebours commence à partir de 0 de la droite vers la gauche. - -**Syntaxe** - -``` sql -SELECT bitTest(number, index) -``` - -**Paramètre** - -- `number` – integer number. -- `index` – position of bit. - -**Valeurs renvoyées** - -Renvoie une valeur de bit à la position spécifiée. - -Type: `UInt8`. - -**Exemple** - -Par exemple, le nombre 43 dans le système numérique de base-2 (binaire) est 101011. - -Requête: - -``` sql -SELECT bitTest(43, 1) -``` - -Résultat: - -``` text -┌─bitTest(43, 1)─┐ -│ 1 │ -└────────────────┘ -``` - -Un autre exemple: - -Requête: - -``` sql -SELECT bitTest(43, 2) -``` - -Résultat: - -``` text -┌─bitTest(43, 2)─┐ -│ 0 │ -└────────────────┘ -``` - -## bitTestAll {#bittestall} - -Renvoie le résultat de [logique de conjonction](https://en.wikipedia.org/wiki/Logical_conjunction) (Et opérateur) de tous les bits à des positions données. Le compte à rebours commence à partir de 0 de la droite vers la gauche. - -La conjonction pour les opérations bit à bit: - -0 AND 0 = 0 - -0 AND 1 = 0 - -1 AND 0 = 0 - -1 AND 1 = 1 - -**Syntaxe** - -``` sql -SELECT bitTestAll(number, index1, index2, index3, index4, ...) -``` - -**Paramètre** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) est vrai si et seulement si toutes ses positions sont remplies (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). - -**Valeurs renvoyées** - -Retourne le résultat de la conjonction logique. - -Type: `UInt8`. - -**Exemple** - -Par exemple, le nombre 43 dans le système numérique de base-2 (binaire) est 101011. - -Requête: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5) -``` - -Résultat: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5)─┐ -│ 1 │ -└────────────────────────────┘ -``` - -Un autre exemple: - -Requête: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5, 2) -``` - -Résultat: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ -│ 0 │ -└───────────────────────────────┘ -``` - -## bitTestAny {#bittestany} - -Renvoie le résultat de [disjonction logique](https://en.wikipedia.org/wiki/Logical_disjunction) (Ou opérateur) de tous les bits à des positions données. Le compte à rebours commence à partir de 0 de la droite vers la gauche. - -La disjonction pour les opérations binaires: - -0 OR 0 = 0 - -0 OR 1 = 1 - -1 OR 0 = 1 - -1 OR 1 = 1 - -**Syntaxe** - -``` sql -SELECT bitTestAny(number, index1, index2, index3, index4, ...) -``` - -**Paramètre** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. - -**Valeurs renvoyées** - -Renvoie le résultat de la disjuction logique. - -Type: `UInt8`. - -**Exemple** - -Par exemple, le nombre 43 dans le système numérique de base-2 (binaire) est 101011. - -Requête: - -``` sql -SELECT bitTestAny(43, 0, 2) -``` - -Résultat: - -``` text -┌─bitTestAny(43, 0, 2)─┐ -│ 1 │ -└──────────────────────┘ -``` - -Un autre exemple: - -Requête: - -``` sql -SELECT bitTestAny(43, 4, 2) -``` - -Résultat: - -``` text -┌─bitTestAny(43, 4, 2)─┐ -│ 0 │ -└──────────────────────┘ -``` - -## bitCount {#bitcount} - -Calcule le nombre de bits mis à un dans la représentation binaire d'un nombre. - -**Syntaxe** - -``` sql -bitCount(x) -``` - -**Paramètre** - -- `x` — [Entier](../../sql_reference/data_types/int_uint.md) ou [virgule flottante](../../sql_reference/data_types/float.md) nombre. La fonction utilise la représentation de la valeur en mémoire. Il permet de financer les nombres à virgule flottante. - -**Valeur renvoyée** - -- Nombre de bits défini sur un dans le numéro d'entrée. - -La fonction ne convertit pas la valeur d'entrée en un type plus grand ([l'extension du signe](https://en.wikipedia.org/wiki/Sign_extension)). Ainsi, par exemple, `bitCount(toUInt8(-1)) = 8`. - -Type: `UInt8`. - -**Exemple** - -Prenez par exemple le numéro 333. Sa représentation binaire: 0000000101001101. - -Requête: - -``` sql -SELECT bitCount(333) -``` - -Résultat: - -``` text -┌─bitCount(333)─┐ -│ 5 │ -└───────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/fr/sql_reference/functions/bitmap_functions.md b/docs/fr/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index ab464e3f7fa..00000000000 --- a/docs/fr/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,496 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 49 -toc_title: Bitmap ---- - -# Fonctions de Bitmap {#bitmap-functions} - -Les fonctions Bitmap fonctionnent pour le calcul de la valeur de L'objet de deux bitmaps, il s'agit de renvoyer un nouveau bitmap ou une cardinalité tout en utilisant le calcul de la formule, tel que and, or, xor, and not, etc. - -Il existe 2 types de méthodes de construction pour L'objet Bitmap. L'un doit être construit par la fonction d'agrégation groupBitmap avec-State, l'autre doit être construit par L'objet Array. Il est également de convertir L'objet Bitmap en objet tableau. - -RoaringBitmap est enveloppé dans une structure de données pendant le stockage réel des objets Bitmap. Lorsque la cardinalité est inférieure ou égale à 32, elle utilise Set objet. Lorsque la cardinalité est supérieure à 32, elle utilise l'objet RoaringBitmap. C'est pourquoi le stockage de faible cardinalité jeu est plus rapide. - -Pour plus d'informations sur RoaringBitmap, voir: [CRoaring](https://github.com/RoaringBitmap/CRoaring). - -## bitmapBuild {#bitmap_functions-bitmapbuild} - -Construire un bitmap à partir d'un tableau entier non signé. - -``` sql -bitmapBuild(array) -``` - -**Paramètre** - -- `array` – unsigned integer array. - -**Exemple** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) -``` - -``` text -┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ -│  │ AggregateFunction(groupBitmap, UInt8) │ -└─────┴──────────────────────────────────────────────┘ -``` - -## bitmapToArray {#bitmaptoarray} - -Convertir bitmap en tableau entier. - -``` sql -bitmapToArray(bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapSubsetInRange {#bitmap-functions-bitmapsubsetinrange} - -Retourne le sous-ensemble dans la plage spécifiée (n'inclut pas le range\_end). - -``` sql -bitmapSubsetInRange(bitmap, range_start, range_end) -``` - -**Paramètre** - -- `bitmap` – [Objet Bitmap](#bitmap_functions-bitmapbuild). -- `range_start` – range start point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `range_end` – range end point(excluded). Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -``` text -┌─res───────────────┐ -│ [30,31,32,33,100] │ -└───────────────────┘ -``` - -## bitmapSubsetLimit {#bitmapsubsetlimit} - -Crée un sous-ensemble de bitmap avec n éléments pris entre `range_start` et `cardinality_limit`. - -**Syntaxe** - -``` sql -bitmapSubsetLimit(bitmap, range_start, cardinality_limit) -``` - -**Paramètre** - -- `bitmap` – [Objet Bitmap](#bitmap_functions-bitmapbuild). -- `range_start` – The subset starting point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Valeur renvoyée** - -Ensemble. - -Type: `Bitmap object`. - -**Exemple** - -Requête: - -``` sql -SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -Résultat: - -``` text -┌─res───────────────────────┐ -│ [30,31,32,33,100,200,500] │ -└───────────────────────────┘ -``` - -## bitmapContains {#bitmap_functions-bitmapcontains} - -Vérifie si le bitmap contient un élément. - -``` sql -bitmapContains(haystack, needle) -``` - -**Paramètre** - -- `haystack` – [Objet Bitmap](#bitmap_functions-bitmapbuild) où la fonction recherche. -- `needle` – Value that the function searches. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**Valeurs renvoyées** - -- 0 — If `haystack` ne contient pas de `needle`. -- 1 — If `haystack` contenir `needle`. - -Type: `UInt8`. - -**Exemple** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAny {#bitmaphasany} - -Vérifie si deux bitmaps ont une intersection par certains éléments. - -``` sql -bitmapHasAny(bitmap1, bitmap2) -``` - -Si vous êtes sûr que `bitmap2` contient strictement un élément, envisagez d'utiliser le [bitmapContains](#bitmap_functions-bitmapcontains) fonction. Cela fonctionne plus efficacement. - -**Paramètre** - -- `bitmap*` – bitmap object. - -**Les valeurs de retour** - -- `1`, si `bitmap1` et `bitmap2` avoir un élément similaire au moins. -- `0`, autrement. - -**Exemple** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAll {#bitmaphasall} - -Analogue à `hasAll(array, array)` renvoie 1 si le premier bitmap contient tous les éléments du second, 0 sinon. -Si le deuxième argument est un bitmap vide, alors renvoie 1. - -``` sql -bitmapHasAll(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 0 │ -└─────┘ -``` - -## bitmapCardinality {#bitmapcardinality} - -Retrun bitmap cardinalité de type UInt64. - -``` sql -bitmapCardinality(bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapMin {#bitmapmin} - -Retrun la plus petite valeur de type UInt64 dans l'ensemble, UINT32\_MAX si l'ensemble est vide. - - bitmapMin(bitmap) - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapMax {#bitmapmax} - -Retrun la plus grande valeur de type UInt64 dans l'ensemble, 0 si l'ensemble est vide. - - bitmapMax(bitmap) - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## bitmapTransform {#bitmaptransform} - -Transformer un tableau de valeurs d'une image à l'autre tableau de valeurs, le résultat est une nouvelle image. - - bitmapTransform(bitmap, from_array, to_array) - -**Paramètre** - -- `bitmap` – bitmap object. -- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. -- `to_array` – UInt32 array, its size shall be the same to from\_array. - -**Exemple** - -``` sql -SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res -``` - - ┌─res───────────────────┐ - │ [1,3,4,6,7,8,9,10,20] │ - └───────────────────────┘ - -## bitmapAnd {#bitmapand} - -Deux bitmap et calcul, le résultat est un nouveau bitmap. - -``` sql -bitmapAnd(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─┐ -│ [3] │ -└─────┘ -``` - -## bitmapOr {#bitmapor} - -Deux bitmap ou calcul, le résultat est un nouveau bitmap. - -``` sql -bitmapOr(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapXor {#bitmapxor} - -Deux bitmap xor calcul, le résultat est une nouvelle image. - -``` sql -bitmapXor(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,4,5] │ -└───────────┘ -``` - -## bitmapetnot {#bitmapandnot} - -Deux Bitmap andnot calcul, le résultat est un nouveau bitmap. - -``` sql -bitmapAndnot(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## bitmapetcardinalité {#bitmapandcardinality} - -Deux bitmap et calcul, retour cardinalité de type UInt64. - -``` sql -bitmapAndCardinality(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapOrCardinality {#bitmaporcardinality} - -Deux bitmap ou calcul, retour cardinalité de type UInt64. - -``` sql -bitmapOrCardinality(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapXorCardinality {#bitmapxorcardinality} - -Deux bitmap XOR calcul, retour cardinalité de type UInt64. - -``` sql -bitmapXorCardinality(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 4 │ -└─────┘ -``` - -## bitmapetnotcardinality {#bitmapandnotcardinality} - -Deux bitmap andnot calcul, retour cardinalité de type UInt64. - -``` sql -bitmapAndnotCardinality(bitmap,bitmap) -``` - -**Paramètre** - -- `bitmap` – bitmap object. - -**Exemple** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 2 │ -└─────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/fr/sql_reference/functions/comparison_functions.md b/docs/fr/sql_reference/functions/comparison_functions.md deleted file mode 100644 index a532f69d9b3..00000000000 --- a/docs/fr/sql_reference/functions/comparison_functions.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 36 -toc_title: Comparaison ---- - -# Fonctions de comparaison {#comparison-functions} - -Les fonctions de comparaison renvoient toujours 0 ou 1 (Uint8). - -Les types suivants peuvent être comparés: - -- nombre -- cordes et cordes fixes -- date -- dates avec heures - -au sein de chaque groupe, mais pas entre différents groupes. - -Par exemple, vous ne pouvez pas comparer une date avec une chaîne. Vous devez utiliser une fonction pour convertir la chaîne en une date, ou vice versa. - -Les chaînes sont comparées par octets. Une courte chaîne est plus petite que toutes les chaînes qui commencent par elle et qui contiennent au moins un caractère de plus. - -## égal, A = B et a = = b opérateur {#function-equals} - -## notEquals, a ! opérateur= b et a \<\> b {#function-notequals} - -## moins, opérateur \< {#function-less} - -## de plus, \> opérateur {#function-greater} - -## lessOrEquals, \< = opérateur {#function-lessorequals} - -## greaterOrEquals, \> = opérateur {#function-greaterorequals} - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) diff --git a/docs/fr/sql_reference/functions/conditional_functions.md b/docs/fr/sql_reference/functions/conditional_functions.md deleted file mode 100644 index efe22799b49..00000000000 --- a/docs/fr/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,207 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 43 -toc_title: 'Conditionnel ' ---- - -# Fonctions conditionnelles {#conditional-functions} - -## si {#if} - -Contrôle la ramification conditionnelle. Contrairement à la plupart des systèmes, ClickHouse évalue toujours les deux expressions `then` et `else`. - -**Syntaxe** - -``` sql -SELECT if(cond, then, else) -``` - -Si la condition `cond` renvoie une valeur non nulle, retourne le résultat de l'expression `then` et le résultat de l'expression `else`, si présent, est ignoré. Si l' `cond` est égal à zéro ou `NULL` alors le résultat de la `then` l'expression est ignorée et le résultat de `else` expression, si elle est présente, est renvoyée. - -**Paramètre** - -- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. -- `then` - L'expression à renvoyer si la condition est remplie. -- `else` - L'expression à renvoyer si la condition n'est pas remplie. - -**Valeurs renvoyées** - -La fonction s'exécute `then` et `else` expressions et retourne son résultat, selon que la condition `cond` fini par être zéro ou pas. - -**Exemple** - -Requête: - -``` sql -SELECT if(1, plus(2, 2), plus(2, 6)) -``` - -Résultat: - -``` text -┌─plus(2, 2)─┐ -│ 4 │ -└────────────┘ -``` - -Requête: - -``` sql -SELECT if(0, plus(2, 2), plus(2, 6)) -``` - -Résultat: - -``` text -┌─plus(2, 6)─┐ -│ 8 │ -└────────────┘ -``` - -- `then` et `else` doit avoir le type commun le plus bas. - -**Exemple:** - -Prendre cette `LEFT_RIGHT` table: - -``` sql -SELECT * -FROM LEFT_RIGHT - -┌─left─┬─right─┐ -│ ᴺᵁᴸᴸ │ 4 │ -│ 1 │ 3 │ -│ 2 │ 2 │ -│ 3 │ 1 │ -│ 4 │ ᴺᵁᴸᴸ │ -└──────┴───────┘ -``` - -La requête suivante compare `left` et `right` valeur: - -``` sql -SELECT - left, - right, - if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller -FROM LEFT_RIGHT -WHERE isNotNull(left) AND isNotNull(right) - -┌─left─┬─right─┬─is_smaller──────────────────────────┐ -│ 1 │ 3 │ left is smaller than right │ -│ 2 │ 2 │ right is greater or equal than left │ -│ 3 │ 1 │ right is greater or equal than left │ -└──────┴───────┴─────────────────────────────────────┘ -``` - -Note: `NULL` les valeurs ne sont pas utilisés dans cet exemple, vérifier [Valeurs nulles dans les conditions](#null-values-in-conditionals) section. - -## Opérateur Ternaire {#ternary-operator} - -Il fonctionne même comme `if` fonction. - -Syntaxe: `cond ? then : else` - -Retourner `then` si l' `cond` renvoie la valeur vrai (supérieur à zéro), sinon renvoie `else`. - -- `cond` doit être de type de `UInt8`, et `then` et `else` doit avoir le type commun le plus bas. - -- `then` et `else` peut être `NULL` - -**Voir aussi** - -- [ifNotFinite](other_functions.md#ifnotfinite). - -## multiIf {#multiif} - -Permet d'écrire le [CASE](../operators.md#operator_case) opérateur plus compacte dans la requête. - -Syntaxe: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` - -**Paramètre:** - -- `cond_N` — The condition for the function to return `then_N`. -- `then_N` — The result of the function when executed. -- `else` — The result of the function if none of the conditions is met. - -La fonction accepte `2N+1` paramètre. - -**Valeurs renvoyées** - -La fonction renvoie l'une des valeurs `then_N` ou `else` selon les conditions `cond_N`. - -**Exemple** - -En utilisant à nouveau `LEFT_RIGHT` table. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─result──────────┐ -│ ᴺᵁᴸᴸ │ 4 │ Null value │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ left is greater │ -│ 4 │ ᴺᵁᴸᴸ │ Null value │ -└──────┴───────┴─────────────────┘ -``` - -## Utilisation directe des résultats conditionnels {#using-conditional-results-directly} - -Les conditions entraînent toujours `0`, `1` ou `NULL`. Vous pouvez donc utiliser des résultats conditionnels directement comme ceci: - -``` sql -SELECT left < right AS is_small -FROM LEFT_RIGHT - -┌─is_small─┐ -│ ᴺᵁᴸᴸ │ -│ 1 │ -│ 0 │ -│ 0 │ -│ ᴺᵁᴸᴸ │ -└──────────┘ -``` - -## Valeurs nulles dans les conditions {#null-values-in-conditionals} - -Lorsque `NULL` les valeurs sont impliqués dans des conditions, le résultat sera également `NULL`. - -``` sql -SELECT - NULL < 1, - 2 < NULL, - NULL < NULL, - NULL = NULL - -┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ -│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└───────────────┴───────────────┴──────────────────┴────────────────────┘ -``` - -Donc, vous devriez construire vos requêtes avec soin si les types sont `Nullable`. - -L'exemple suivant le démontre en omettant d'ajouter la condition égale à `multiIf`. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─faulty_result────┐ -│ ᴺᵁᴸᴸ │ 4 │ Both equal │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ right is smaller │ -│ 4 │ ᴺᵁᴸᴸ │ Both equal │ -└──────┴───────┴──────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/fr/sql_reference/functions/date_time_functions.md b/docs/fr/sql_reference/functions/date_time_functions.md deleted file mode 100644 index 58449316398..00000000000 --- a/docs/fr/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,450 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 39 -toc_title: Travailler avec les Dates et les heures ---- - -# Fonctions pour travailler avec des dates et des heures {#functions-for-working-with-dates-and-times} - -Support des fuseaux horaires - -Toutes les fonctions pour travailler avec la date et l'heure qui ont une logique d'utilisation pour le fuseau horaire peut accepter un second fuseau horaire argument. Exemple: Asie / Ekaterinbourg. Dans ce cas, ils utilisent le fuseau horaire spécifié au lieu du fuseau horaire local (par défaut). - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - -``` text -┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ -└─────────────────────┴────────────┴────────────┴─────────────────────┘ -``` - -Seuls les fuseaux horaires qui diffèrent de L'UTC par un nombre entier d'heures sont pris en charge. - -## toTimeZone {#totimezone} - -Convertir l'heure ou la date et de l'heure au fuseau horaire spécifié. - -## toYear {#toyear} - -Convertit une date ou une date avec l'heure en un numéro UInt16 contenant le numéro d'année (AD). - -## toQuarter {#toquarter} - -Convertit une date ou une date avec l'heure en un numéro UInt8 contenant le numéro de trimestre. - -## toMonth {#tomonth} - -Convertit une date ou une date avec l'heure en un numéro UInt8 contenant le numéro de mois (1-12). - -## toDayOfYear {#todayofyear} - -Convertit une date ou une date avec l'heure en un numéro UInt16 contenant le numéro du jour de l'année (1-366). - -## toDayOfMonth {#todayofmonth} - -Convertit une date ou une date avec le temps à un UInt8 contenant le numéro du jour du mois (1-31). - -## toDayOfWeek {#todayofweek} - -Convertit une date ou une date avec l'heure en un numéro UInt8 contenant le numéro du jour de la semaine (lundi est 1, et dimanche est 7). - -## toHour {#tohour} - -Convertit une date avec l'heure en un nombre UInt8 contenant le numéro de l'heure dans l'Heure de 24 heures (0-23). -This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). - -## toMinute {#tominute} - -Convertit une date avec l'heure en un numéro UInt8 contenant le numéro de la minute de l'heure (0-59). - -## toseconde {#tosecond} - -Convertit une date avec l'heure en un nombre UInt8 contenant le numéro de la seconde dans la minute (0-59). -Les secondes intercalaires ne sont pas comptabilisés. - -## toUnixTimestamp {#to-unix-timestamp} - -Pour L'argument DateTime: convertit la valeur en sa représentation numérique interne (horodatage Unix). -For String argument: analyse datetime from string en fonction du fuseau horaire (second argument optionnel, le fuseau horaire du serveur est utilisé par défaut) et renvoie l'horodatage unix correspondant. -Pour L'argument Date: le comportement n'est pas spécifié. - -**Syntaxe** - -``` sql -toUnixTimestamp(datetime) -toUnixTimestamp(str, [timezone]) -``` - -**Valeur renvoyée** - -- Renvoie l'horodatage unix. - -Type: `UInt32`. - -**Exemple** - -Requête: - -``` sql -SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp -``` - -Résultat: - -``` text -┌─unix_timestamp─┐ -│ 1509836867 │ -└────────────────┘ -``` - -## toStartOfYear {#tostartofyear} - -Arrondit une date ou une date avec l'heure jusqu'au premier jour de l'année. -Renvoie la date. - -## toStartOfISOYear {#tostartofisoyear} - -Arrondit une date ou une date avec l'heure jusqu'au premier jour de L'année ISO. -Renvoie la date. - -## toStartOfQuarter {#tostartofquarter} - -Arrondit une date ou une date avec l'heure jusqu'au premier jour du trimestre. -Le premier jour du trimestre, soit le 1er janvier, 1er avril, 1er juillet ou 1er octobre. -Renvoie la date. - -## toStartOfMonth {#tostartofmonth} - -Arrondit une date ou une date avec l'heure jusqu'au premier jour du mois. -Renvoie la date. - -!!! attention "Attention" - Le comportement de l'analyse des dates incorrectes est spécifique à l'implémentation. ClickHouse peut renvoyer la date zéro, lancer une exception ou faire “natural” débordement. - -## toMonday {#tomonday} - -Arrondit une date ou une date avec l'heure au lundi le plus proche. -Renvoie la date. - -## toStartOfWeek (t \[, mode\]) {#tostartofweektmode} - -Arrondit une date ou une date avec l'heure au dimanche ou au lundi le plus proche par mode. -Renvoie la date. -L'argument mode fonctionne exactement comme l'argument mode de toWeek(). Pour la syntaxe à argument unique, une valeur de mode de 0 est utilisée. - -## toStartOfDay {#tostartofday} - -Arrondit une date avec le temps au début de la journée. - -## toStartOfHour {#tostartofhour} - -Arrondit une date avec le temps au début de l " heure. - -## toStartOfMinute {#tostartofminute} - -Arrondit une date avec le temps au début de la minute. - -## toStartOfFiveMinute {#tostartoffiveminute} - -Arrondit à une date avec l'heure de début de l'intervalle de cinq minutes. - -## toStartOfTenMinutes {#tostartoftenminutes} - -Arrondit une date avec le temps au début de l " intervalle de dix minutes. - -## toStartOfFifteenMinutes {#tostartoffifteenminutes} - -Arrondit la date avec le temps jusqu'au début de l'intervalle de quinze minutes. - -## toStartOfInterval(time\_or\_data, intervalle x Unité \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -Ceci est une généralisation d'autres fonctions nommées `toStartOf*`. Exemple, -`toStartOfInterval(t, INTERVAL 1 year)` renvoie la même chose que `toStartOfYear(t)`, -`toStartOfInterval(t, INTERVAL 1 month)` renvoie la même chose que `toStartOfMonth(t)`, -`toStartOfInterval(t, INTERVAL 1 day)` renvoie la même chose que `toStartOfDay(t)`, -`toStartOfInterval(t, INTERVAL 15 minute)` renvoie la même chose que `toStartOfFifteenMinutes(t)` etc. - -## toTime {#totime} - -Convertit une date avec l'heure en une certaine date fixe, tout en préservant l'heure. - -## toRelativeYearNum {#torelativeyearnum} - -Convertit une date avec l'heure ou la date, le numéro de l'année, à partir d'un certain point fixe dans le passé. - -## toRelativeQuarterNum {#torelativequarternum} - -Convertit une date avec l'heure ou la date au numéro du trimestre, à partir d'un certain point fixe dans le passé. - -## toRelativeMonthNum {#torelativemonthnum} - -Convertit une date avec l'heure ou la date au numéro du mois, à partir d'un certain point fixe dans le passé. - -## toRelativeWeekNum {#torelativeweeknum} - -Convertit une date avec l'heure ou la date, le numéro de la semaine, à partir d'un certain point fixe dans le passé. - -## toRelativeDayNum {#torelativedaynum} - -Convertit une date avec l'heure ou la date au numéro du jour, à partir d'un certain point fixe dans le passé. - -## toRelativeHourNum {#torelativehournum} - -Convertit une date avec l'heure ou la date au nombre de l'heure, à partir d'un certain point fixe dans le passé. - -## toRelativeMinuteNum {#torelativeminutenum} - -Convertit une date avec l'heure ou la date au numéro de la minute, à partir d'un certain point fixe dans le passé. - -## toRelativeSecondNum {#torelativesecondnum} - -Convertit une date avec l'heure ou la date au numéro de la seconde, à partir d'un certain point fixe dans le passé. - -## toISOYear {#toisoyear} - -Convertit une date ou une date avec l'heure en un numéro UInt16 contenant le numéro D'année ISO. - -## toISOWeek {#toisoweek} - -Convertit une date ou une date avec l'heure en un numéro UInt8 contenant le numéro de semaine ISO. - -## toWeek (date \[, mode\]) {#toweekdatemode} - -Cette fonction renvoie le numéro de semaine pour date ou datetime. La forme à deux arguments de toWeek() vous permet de spécifier si la semaine commence le dimanche ou le lundi et si la valeur de retour doit être comprise entre 0 et 53 ou entre 1 et 53. Si l'argument mode est omis, le mode par défaut est 0. -`toISOWeek()`est une fonction de compatibilité équivalente à `toWeek(date,3)`. -Le tableau suivant décrit le fonctionnement de l'argument mode. - -| Mode | Premier jour de la semaine | Gamme | Week 1 is the first week … | -|------|----------------------------|-------|----------------------------------| -| 0 | Dimanche | 0-53 | avec un dimanche cette année | -| 1 | Lundi | 0-53 | avec 4 jours ou plus cette année | -| 2 | Dimanche | 1-53 | avec un dimanche cette année | -| 3 | Lundi | 1-53 | avec 4 jours ou plus cette année | -| 4 | Dimanche | 0-53 | avec 4 jours ou plus cette année | -| 5 | Lundi | 0-53 | avec un lundi cette année | -| 6 | Dimanche | 1-53 | avec 4 jours ou plus cette année | -| 7 | Lundi | 1-53 | avec un lundi cette année | -| 8 | Dimanche | 1-53 | contient Janvier 1 | -| 9 | Lundi | 1-53 | contient Janvier 1 | - -Pour les valeurs de mode avec une signification de “with 4 or more days this year,” les semaines sont numérotées selon ISO 8601: 1988: - -- Si la semaine contenant Janvier 1 A 4 jours ou plus dans la nouvelle année, il est Semaine 1. - -- Sinon, c'est la dernière semaine de l'année précédente, et la semaine prochaine est la semaine 1. - -Pour les valeurs de mode avec une signification de “contains January 1”, la semaine contient Janvier 1 est Semaine 1. Peu importe combien de jours dans la nouvelle année la semaine contenait, même si elle contenait seulement un jour. - -``` sql -toWeek(date, [, mode][, Timezone]) -``` - -**Paramètre** - -- `date` – Date or DateTime. -- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. -- `Timezone` – Optional parameter, it behaves like any other conversion function. - -**Exemple** - -``` sql -SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; -``` - -``` text -┌───────date─┬─week0─┬─week1─┬─week9─┐ -│ 2016-12-27 │ 52 │ 52 │ 1 │ -└────────────┴───────┴───────┴───────┘ -``` - -## toYearWeek (date \[, mode\]) {#toyearweekdatemode} - -Retourne l'année et la semaine pour une date. L'année dans le résultat peut être différente de l'année dans l'argument date pour la première et la dernière semaine de l'année. - -L'argument mode fonctionne exactement comme l'argument mode de toWeek(). Pour la syntaxe à argument unique, une valeur de mode de 0 est utilisée. - -`toISOYear()`est une fonction de compatibilité équivalente à `intDiv(toYearWeek(date,3),100)`. - -**Exemple** - -``` sql -SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; -``` - -``` text -┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ -│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ -└────────────┴───────────┴───────────┴───────────┘ -``` - -## maintenant {#now} - -Accepte zéro argument et renvoie l'heure actuelle à l'un des moments de l'exécution de la requête. -Cette fonction renvoie une constante, même si la requête a pris beaucoup de temps à compléter. - -## aujourd' {#today} - -Accepte zéro argument et renvoie la date actuelle à l'un des moments de l'exécution de la requête. -Le même que ‘toDate(now())’. - -## hier {#yesterday} - -Accepte zéro argument et renvoie la date d'hier à l'un des moments de l'exécution de la requête. -Le même que ‘today() - 1’. - -## l'horaire de diffusion {#timeslot} - -Arrondit le temps à la demi-heure. -Cette fonction est spécifique à Yandex.Metrica, car une demi-heure est le temps minimum pour diviser une session en deux sessions si une balise de suivi affiche les pages vues consécutives d'un seul utilisateur qui diffèrent dans le temps de strictement plus que ce montant. Cela signifie que les tuples (l'ID de balise, l'ID utilisateur et l'intervalle de temps) peuvent être utilisés pour rechercher les pages vues incluses dans la session correspondante. - -## toYYYYMM {#toyyyymm} - -Convertit une date ou une date avec l'heure en un numéro UInt32 contenant le numéro d'année et de mois (AAAA \* 100 + MM). - -## toYYYYMMDD {#toyyyymmdd} - -Convertit une date ou une date avec l'heure en un numéro UInt32 contenant le numéro d'année et de mois (AAAA \* 10000 + MM \* 100 + JJ). - -## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} - -Convertit une date ou une date avec l'heure en un numéro UInt64 contenant le numéro d'année et de mois (AAAA \* 10000000000 + MM \* 100000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss). - -## addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} - -Fonction ajoute une date / DateTime intervalle à une Date / DateTime, puis retourner la Date / DateTime. Exemple: - -``` sql -WITH - toDate('2018-01-01') AS date, - toDateTime('2018-01-01 00:00:00') AS date_time -SELECT - addYears(date, 1) AS add_years_with_date, - addYears(date_time, 1) AS add_years_with_date_time -``` - -``` text -┌─add_years_with_date─┬─add_years_with_date_time─┐ -│ 2019-01-01 │ 2019-01-01 00:00:00 │ -└─────────────────────┴──────────────────────────┘ -``` - -## subtractYears, subtractMonths, subtractWeeks, subtractDays, subtractHours, subtractMinutes, subtractSeconds, subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} - -Fonction soustrayez un intervalle de Date / DateTime à une Date / DateTime, puis renvoyez la Date / DateTime. Exemple: - -``` sql -WITH - toDate('2019-01-01') AS date, - toDateTime('2019-01-01 00:00:00') AS date_time -SELECT - subtractYears(date, 1) AS subtract_years_with_date, - subtractYears(date_time, 1) AS subtract_years_with_date_time -``` - -``` text -┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ -│ 2018-01-01 │ 2018-01-01 00:00:00 │ -└──────────────────────────┴───────────────────────────────┘ -``` - -## dateDiff {#datediff} - -Renvoie la différence entre deux valeurs Date ou DateTime. - -**Syntaxe** - -``` sql -dateDiff('unit', startdate, enddate, [timezone]) -``` - -**Paramètre** - -- `unit` — Time unit, in which the returned value is expressed. [Chaîne](../syntax.md#syntax-string-literal). - - Supported values: - - | unit | - | ---- | - |second | - |minute | - |hour | - |day | - |week | - |month | - |quarter | - |year | - -- `startdate` — The first time value to compare. [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). - -- `enddate` — The second time value to compare. [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). - -- `timezone` — Optional parameter. If specified, it is applied to both `startdate` et `enddate`. Si non spécifié, fuseaux horaires de l' `startdate` et `enddate` sont utilisés. Si elles ne sont pas identiques, le résultat n'est pas spécifié. - -**Valeur renvoyée** - -Différence entre `startdate` et `enddate` exprimé en `unit`. - -Type: `int`. - -**Exemple** - -Requête: - -``` sql -SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); -``` - -Résultat: - -``` text -┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ -│ 25 │ -└────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## intervalle de temps (StartTime, Duration, \[, Size\]) {#timeslotsstarttime-duration-size} - -Pour un intervalle de temps commençant à ‘StartTime’ et de poursuivre pour ‘Duration’ secondes, il renvoie un tableau de moments dans le temps, composé de points de cet intervalle arrondis vers le bas à la ‘Size’ en quelques secondes. ‘Size’ est un paramètre optionnel: une constante UInt32, définie sur 1800 par défaut. -Exemple, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. -Ceci est nécessaire pour rechercher les pages vues dans la session correspondante. - -## formatDateTime(Heure, Format \[, fuseau horaire\]) {#formatdatetime} - -Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. - -Modificateurs pris en charge pour le Format: -(“Example” colonne affiche le résultat de formatage pour le temps `2018-01-02 22:33:44`) - -| Modificateur | Description | Exemple | -|--------------|------------------------------------------------------------------------|------------| -| %C | année divisée par 100 et tronquée en entier (00-99) | 20 | -| %d | jour du mois, zero-rembourré (01-31) | 02 | -| %D | Date courte MM / JJ / AA, équivalente à %m / % d / % y | 01/02/18 | -| % e | jour du mois, rembourré dans l'espace ( 1-31) | 2 | -| %F | date courte AAAA-MM-JJ, équivalente à % Y - % m - % d | 2018-01-02 | -| %H | heure en format 24h (00-23) | 22 | -| %I | heure en format 12h (01-12) | 10 | -| %j | les jours de l'année (001-366) | 002 | -| %m | mois en nombre décimal (01-12) | 01 | -| %M | minute (00-59) | 33 | -| %et | caractère de nouvelle ligne (") | | -| %p | Désignation AM ou PM | PM | -| %R | 24 heures HH:MM temps, équivalent à %H: % M | 22:33 | -| %S | deuxième (00-59) | 44 | -| % t | horizontal-caractère de tabulation (') | | -| %T | Format d'heure ISO 8601 (HH:MM:SS), équivalent à %H: % M:%S | 22:33:44 | -| % u | ISO 8601 jour de la semaine comme numéro avec Lundi comme 1 (1-7) | 2 | -| %V | Numéro de semaine ISO 8601 (01-53) | 01 | -| %W | jour de la semaine comme un nombre décimal avec dimanche comme 0 (0-6) | 2 | -| % y | Année, deux derniers chiffres (00-99) | 18 | -| %Y | An | 2018 | -| %% | signe | % | - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/fr/sql_reference/functions/encoding_functions.md b/docs/fr/sql_reference/functions/encoding_functions.md deleted file mode 100644 index f0738d2c684..00000000000 --- a/docs/fr/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 52 -toc_title: Encodage ---- - -# L'encodage des fonctions {#encoding-functions} - -## char {#char} - -Retourne la chaîne avec la longueur que le nombre d'arguments passés et chaque octet a la valeur de l'argument correspondant. Accepte plusieurs arguments de types numériques. Si la valeur de l'argument est hors de portée du type de données UInt8, elle est convertie en UInt8 avec arrondi et débordement possibles. - -**Syntaxe** - -``` sql -char(number_1, [number_2, ..., number_n]); -``` - -**Paramètre** - -- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../../sql_reference/data_types/int_uint.md), [Flottant](../../sql_reference/data_types/float.md). - -**Valeur renvoyée** - -- une chaîne d'octets. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello -``` - -Résultat: - -``` text -┌─hello─┐ -│ hello │ -└───────┘ -``` - -Vous pouvez construire une chaîne de codage arbitraire en passant les octets correspondants. Voici un exemple pour UTF-8: - -Requête: - -``` sql -SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; -``` - -Résultat: - -``` text -┌─hello──┐ -│ привет │ -└────────┘ -``` - -Requête: - -``` sql -SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; -``` - -Résultat: - -``` text -┌─hello─┐ -│ 你好 │ -└───────┘ -``` - -## Hex {#hex} - -Renvoie une chaîne contenant la représentation hexadécimale de l'argument. - -**Syntaxe** - -``` sql -hex(arg) -``` - -La fonction utilise des lettres majuscules `A-F` et ne pas utiliser de préfixes (comme `0x`) ou suffixes (comme `h`). - -Pour les arguments entiers, il imprime des chiffres hexadécimaux (“nibbles”) du plus significatif au moins significatif (big endian ou “human readable” ordre). Il commence par l'octet non nul le plus significatif (les octets de début zéro sont omis) mais imprime toujours les deux chiffres de chaque octet même si le chiffre de début est nul. - -Exemple: - -**Exemple** - -Requête: - -``` sql -SELECT hex(1); -``` - -Résultat: - -``` text -01 -``` - -Les valeurs de type `Date` et `DateTime` sont formatés comme des entiers correspondants (le nombre de jours depuis Epoch pour Date et la valeur de L'horodatage Unix pour DateTime). - -Pour `String` et `FixedString`, tous les octets sont simplement codés en deux nombres hexadécimaux. Zéro octets ne sont pas omis. - -Les valeurs des types virgule flottante et décimale sont codées comme leur représentation en mémoire. Comme nous soutenons l'architecture little endian, ils sont codés dans little endian. Zéro octets de début / fin ne sont pas omis. - -**Paramètre** - -- `arg` — A value to convert to hexadecimal. Types: [Chaîne](../../sql_reference/data_types/string.md), [UInt](../../sql_reference/data_types/int_uint.md), [Flottant](../../sql_reference/data_types/float.md), [Décimal](../../sql_reference/data_types/decimal.md), [Date](../../sql_reference/data_types/date.md) ou [DateTime](../../sql_reference/data_types/datetime.md). - -**Valeur renvoyée** - -- Une chaîne avec la représentation hexadécimale de l'argument. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); -``` - -Résultat: - -``` text -┌─hex_presentation─┐ -│ 00007041 │ -│ 00008041 │ -└──────────────────┘ -``` - -Requête: - -``` sql -SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); -``` - -Résultat: - -``` text -┌─hex_presentation─┐ -│ 0000000000002E40 │ -│ 0000000000003040 │ -└──────────────────┘ -``` - -## unhex (str) {#unhexstr} - -Accepte une chaîne contenant un nombre quelconque de chiffres hexadécimaux, et renvoie une chaîne contenant le correspondant octets. Prend en charge les lettres majuscules et minuscules A-F. Le nombre de chiffres hexadécimaux ne doit pas être pair. S'il est impair, le dernier chiffre est interprété comme la moitié la moins significative de l'octet 00-0F. Si la chaîne d'argument contient autre chose que des chiffres hexadécimaux, un résultat défini par l'implémentation est renvoyé (une exception n'est pas levée). -Si vous voulez convertir le résultat en un nombre, vous pouvez utiliser le ‘reverse’ et ‘reinterpretAsType’ fonction. - -## UUIDStringToNum (str) {#uuidstringtonumstr} - -Accepte une chaîne contenant 36 caractères dans le format `123e4567-e89b-12d3-a456-426655440000`, et le renvoie comme un ensemble d'octets dans un FixedString (16). - -## UUIDNumToString (str) {#uuidnumtostringstr} - -Accepte une valeur FixedString (16). Renvoie une chaîne contenant 36 caractères au format texte. - -## bitmaskToList(num) {#bitmasktolistnum} - -Accepte un entier. Renvoie une chaîne contenant la liste des puissances de deux qui totalisent le nombre source lorsqu'il est additionné. Ils sont séparés par des virgules sans espaces au format texte, dans l'ordre croissant. - -## bitmaskToArray(num) {#bitmasktoarraynum} - -Accepte un entier. Renvoie un tableau de nombres UInt64 contenant la liste des puissances de deux qui totalisent le nombre source lorsqu'il est additionné. Les numéros dans le tableau sont dans l'ordre croissant. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/fr/sql_reference/functions/ext_dict_functions.md b/docs/fr/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index 126d400d7b1..00000000000 --- a/docs/fr/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 58 -toc_title: Travailler avec des dictionnaires externes ---- - -# Fonctions Pour Travailler Avec Des Dictionnaires Externes {#ext_dict_functions} - -Pour plus d'informations sur la connexion et la configuration de dictionnaires externes, voir [Dictionnaires externes](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -## dictGet {#dictget} - -Récupère une valeur d'un dictionnaire externe. - -``` sql -dictGet('dict_name', 'attr_name', id_expr) -dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Paramètre** - -- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d'un [UInt64](../../sql_reference/data_types/int_uint.md) ou [Tuple](../../sql_reference/data_types/tuple.md)- tapez la valeur en fonction de la configuration du dictionnaire. -- `default_value_expr` — Value returned if the dictionary doesn't contain a row with the `id_expr` clé. [Expression](../syntax.md#syntax-expressions) renvoyer la valeur dans le type de données configuré pour `attr_name` attribut. - -**Valeur renvoyée** - -- Si ClickHouse analyse l'attribut avec succès dans le [l'attribut type de données](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), les fonctions renvoient la valeur du dictionnaire de l'attribut qui correspond à `id_expr`. - -- Si il n'y a pas la clé, correspondant à `id_expr` dans le dictionnaire, puis: - - - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouse lève une exception si elle ne peut pas analyser la valeur de l'attribut ou si la valeur ne correspond pas au type de données d'attribut. - -**Exemple** - -Créer un fichier texte `ext-dict-text.csv` contenant les éléments suivants: - -``` text -1,1 -2,2 -``` - -La première colonne est `id` la deuxième colonne est `c1`. - -Configurer le dictionnaire externe: - -``` xml - - - ext-dict-test - - - /path-to/ext-dict-test.csv - CSV - - - - - - - - id - - - c1 - UInt32 - - - - 0 - - -``` - -Effectuer la requête: - -``` sql -SELECT - dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, - toTypeName(val) AS type -FROM system.numbers -LIMIT 3 -``` - -``` text -┌─val─┬─type───┐ -│ 1 │ UInt32 │ -│ 2 │ UInt32 │ -│ 20 │ UInt32 │ -└─────┴────────┘ -``` - -**Voir Aussi** - -- [Dictionnaires Externes](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) - -## dictHas {#dicthas} - -Vérifie si une clé est présente dans un dictionnaire. - -``` sql -dictHas('dict_name', id_expr) -``` - -**Paramètre** - -- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d'un [UInt64](../../sql_reference/data_types/int_uint.md)-le type de la valeur. - -**Valeur renvoyée** - -- 0, si il n'y a pas de clé. -- 1, si il y a une clé. - -Type: `UInt8`. - -## dictGetHierarchy {#dictgethierarchy} - -Crée un tableau contenant tous les parents d'une clé dans le [hiérarchique dictionnaire](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md). - -**Syntaxe** - -``` sql -dictGetHierarchy('dict_name', key) -``` - -**Paramètre** - -- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). -- `key` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d'un [UInt64](../../sql_reference/data_types/int_uint.md)-le type de la valeur. - -**Valeur renvoyée** - -- Les Parents pour la clé. - -Type: [Tableau (UInt64)](../../sql_reference/data_types/array.md). - -## dictisine {#dictisin} - -Vérifie l'ancêtre d'une clé à travers toute la chaîne hiérarchique dans le dictionnaire. - -``` sql -dictIsIn('dict_name', child_id_expr, ancestor_id_expr) -``` - -**Paramètre** - -- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). -- `child_id_expr` — Key to be checked. [Expression](../syntax.md#syntax-expressions) de retour d'un [UInt64](../../sql_reference/data_types/int_uint.md)-le type de la valeur. -- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` clé. [Expression](../syntax.md#syntax-expressions) de retour d'un [UInt64](../../sql_reference/data_types/int_uint.md)-le type de la valeur. - -**Valeur renvoyée** - -- 0, si `child_id_expr` n'est pas un enfant de `ancestor_id_expr`. -- 1, si `child_id_expr` est un enfant de `ancestor_id_expr` ou si `child_id_expr` est un `ancestor_id_expr`. - -Type: `UInt8`. - -## D'Autres Fonctions {#ext_dict_functions-other} - -ClickHouse prend en charge des fonctions spécialisées qui convertissent les valeurs d'attribut de dictionnaire en un type de données spécifique, quelle que soit la configuration du dictionnaire. - -Fonction: - -- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` -- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` -- `dictGetFloat32`, `dictGetFloat64` -- `dictGetDate` -- `dictGetDateTime` -- `dictGetUUID` -- `dictGetString` - -Toutes ces fonctions ont le `OrDefault` modification. Exemple, `dictGetDateOrDefault`. - -Syntaxe: - -``` sql -dictGet[Type]('dict_name', 'attr_name', id_expr) -dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Paramètre** - -- `dict_name` — Name of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [Chaîne littérale](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [Expression](../syntax.md#syntax-expressions) de retour d'un [UInt64](../../sql_reference/data_types/int_uint.md)-le type de la valeur. -- `default_value_expr` — Value which is returned if the dictionary doesn't contain a row with the `id_expr` clé. [Expression](../syntax.md#syntax-expressions) renvoyer une valeur dans le type de données configuré pour `attr_name` attribut. - -**Valeur renvoyée** - -- Si ClickHouse analyse l'attribut avec succès dans le [l'attribut type de données](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), les fonctions renvoient la valeur du dictionnaire de l'attribut qui correspond à `id_expr`. - -- Si il n'est pas demandé `id_expr` dans le dictionnaire,: - - - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouse lève une exception si elle ne peut pas analyser la valeur de l'attribut ou si la valeur ne correspond pas au type de données d'attribut. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/fr/sql_reference/functions/functions_for_nulls.md b/docs/fr/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 78c85b22de2..00000000000 --- a/docs/fr/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,312 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 63 -toc_title: Travailler avec des arguments nullables ---- - -# Fonctions pour travailler avec des agrégats nullables {#functions-for-working-with-nullable-aggregates} - -## isNull {#isnull} - -Vérifie si l'argument est [NULL](../syntax.md#null). - -``` sql -isNull(x) -``` - -**Paramètre** - -- `x` — A value with a non-compound data type. - -**Valeur renvoyée** - -- `1` si `x` être `NULL`. -- `0` si `x` n'est pas `NULL`. - -**Exemple** - -Table d'entrée - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Requête - -``` sql -SELECT x FROM t_null WHERE isNull(y) -``` - -``` text -┌─x─┐ -│ 1 │ -└───┘ -``` - -## isNotNull {#isnotnull} - -Vérifie si l'argument est [NULL](../syntax.md#null). - -``` sql -isNotNull(x) -``` - -**Paramètre:** - -- `x` — A value with a non-compound data type. - -**Valeur renvoyée** - -- `0` si `x` être `NULL`. -- `1` si `x` n'est pas `NULL`. - -**Exemple** - -Table d'entrée - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Requête - -``` sql -SELECT x FROM t_null WHERE isNotNull(y) -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## fusionner {#coalesce} - -Vérifie de gauche à droite si `NULL` les arguments ont été passés et renvoie le premier non-`NULL` argument. - -``` sql -coalesce(x,...) -``` - -**Paramètre:** - -- N'importe quel nombre de paramètres d'un type non composé. Tous les paramètres doivent être compatibles par type de données. - -**Valeurs renvoyées** - -- Le premier non-`NULL` argument. -- `NULL` si tous les arguments sont `NULL`. - -**Exemple** - -Considérez une liste de contacts qui peuvent spécifier plusieurs façons de contacter un client. - -``` text -┌─name─────┬─mail─┬─phone─────┬──icq─┐ -│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ -│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└──────────┴──────┴───────────┴──────┘ -``` - -Le `mail` et `phone` les champs sont de type Chaîne de caractères, mais la `icq` le terrain est `UInt32`, de sorte qu'il doit être converti en `String`. - -Obtenir la première méthode de contact pour le client à partir de la liste de contacts: - -``` sql -SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook -``` - -``` text -┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ -│ client 1 │ 123-45-67 │ -│ client 2 │ ᴺᵁᴸᴸ │ -└──────────┴──────────────────────────────────────────────────────┘ -``` - -## ifNull {#ifnull} - -Renvoie une valeur alternative si l'argument principal est `NULL`. - -``` sql -ifNull(x,alt) -``` - -**Paramètre:** - -- `x` — The value to check for `NULL`. -- `alt` — The value that the function returns if `x` être `NULL`. - -**Valeurs renvoyées** - -- Valeur `x`, si `x` n'est pas `NULL`. -- Valeur `alt`, si `x` être `NULL`. - -**Exemple** - -``` sql -SELECT ifNull('a', 'b') -``` - -``` text -┌─ifNull('a', 'b')─┐ -│ a │ -└──────────────────┘ -``` - -``` sql -SELECT ifNull(NULL, 'b') -``` - -``` text -┌─ifNull(NULL, 'b')─┐ -│ b │ -└───────────────────┘ -``` - -## nullIf {#nullif} - -Retourner `NULL` si les arguments sont égaux. - -``` sql -nullIf(x, y) -``` - -**Paramètre:** - -`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. - -**Valeurs renvoyées** - -- `NULL` si les arguments sont égaux. -- Le `x` valeur, si les arguments ne sont pas égaux. - -**Exemple** - -``` sql -SELECT nullIf(1, 1) -``` - -``` text -┌─nullIf(1, 1)─┐ -│ ᴺᵁᴸᴸ │ -└──────────────┘ -``` - -``` sql -SELECT nullIf(1, 2) -``` - -``` text -┌─nullIf(1, 2)─┐ -│ 1 │ -└──────────────┘ -``` - -## assumeNotNull {#assumenotnull} - -Résultats dans une valeur de type [Nullable](../../sql_reference/data_types/nullable.md) pour un non- `Nullable` si la valeur n'est pas `NULL`. - -``` sql -assumeNotNull(x) -``` - -**Paramètre:** - -- `x` — The original value. - -**Valeurs renvoyées** - -- La valeur d'origine du non-`Nullable` type, si elle n'est pas `NULL`. -- La valeur par défaut pour le non-`Nullable` Tapez si la valeur d'origine était `NULL`. - -**Exemple** - -Envisager l' `t_null` table. - -``` sql -SHOW CREATE TABLE t_null -``` - -``` text -┌─statement─────────────────────────────────────────────────────────────────┐ -│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ -└───────────────────────────────────────────────────────────────────────────┘ -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Appliquer le `assumeNotNull` la fonction de la `y` colonne. - -``` sql -SELECT assumeNotNull(y) FROM t_null -``` - -``` text -┌─assumeNotNull(y)─┐ -│ 0 │ -│ 3 │ -└──────────────────┘ -``` - -``` sql -SELECT toTypeName(assumeNotNull(y)) FROM t_null -``` - -``` text -┌─toTypeName(assumeNotNull(y))─┐ -│ Int8 │ -│ Int8 │ -└──────────────────────────────┘ -``` - -## toNullable {#tonullable} - -Convertit le type d'argument en `Nullable`. - -``` sql -toNullable(x) -``` - -**Paramètre:** - -- `x` — The value of any non-compound type. - -**Valeur renvoyée** - -- La valeur d'entrée avec un `Nullable` type. - -**Exemple** - -``` sql -SELECT toTypeName(10) -``` - -``` text -┌─toTypeName(10)─┐ -│ UInt8 │ -└────────────────┘ -``` - -``` sql -SELECT toTypeName(toNullable(10)) -``` - -``` text -┌─toTypeName(toNullable(10))─┐ -│ Nullable(UInt8) │ -└────────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/fr/sql_reference/functions/geo.md b/docs/fr/sql_reference/functions/geo.md deleted file mode 100644 index 2a929604a5b..00000000000 --- a/docs/fr/sql_reference/functions/geo.md +++ /dev/null @@ -1,510 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 62 -toc_title: "Travailler avec des coordonn\xE9es g\xE9ographiques" ---- - -# Fonctions pour travailler avec des coordonnées géographiques {#functions-for-working-with-geographical-coordinates} - -## greatCircleDistance {#greatcircledistance} - -Calculer la distance entre deux points sur la surface de la Terre en utilisant [la formule du grand cercle](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**Les paramètres d'entrée** - -- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. -- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. -- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. -- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. - -Les valeurs positives correspondent à la latitude nord et à la longitude Est, et les valeurs négatives à la latitude Sud et à la longitude ouest. - -**Valeur renvoyée** - -La distance entre deux points sur la surface de la Terre, en mètres. - -Génère une exception lorsque les valeurs des paramètres d'entrée se situent en dehors de la plage. - -**Exemple** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## pointInEllipses {#pointinellipses} - -Vérifie si le point appartient à au moins une des ellipses. -Coordonnées géométriques sont dans le système de coordonnées Cartésiennes. - -``` sql -pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) -``` - -**Les paramètres d'entrée** - -- `x, y` — Coordinates of a point on the plane. -- `xᵢ, yᵢ` — Coordinates of the center of the `i`-ème points de suspension. -- `aᵢ, bᵢ` — Axes of the `i`- e ellipse en unités de coordonnées x, Y. - -Les paramètres d'entrée doivent être `2+4⋅n`, où `n` est le nombre de points de suspension. - -**Valeurs renvoyées** - -`1` si le point est à l'intérieur d'au moins l'un des ellipses; `0`si elle ne l'est pas. - -**Exemple** - -``` sql -SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) -``` - -``` text -┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ -│ 1 │ -└─────────────────────────────────────────────────┘ -``` - -## pointtinpolygon {#pointinpolygon} - -Vérifie si le point appartient au polygone sur l'avion. - -``` sql -pointInPolygon((x, y), [(a, b), (c, d) ...], ...) -``` - -**Les valeurs d'entrée** - -- `(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 — [Tableau](../../sql_reference/data_types/array.md). Chaque sommet est représenté par une paire de coordonnées `(a, b)`. Les sommets doivent être spécifiés dans le sens horaire ou antihoraire. Le nombre minimum de sommets est 3. Le polygone doit être constante. -- La fonction prend également en charge les polygones avec des trous (découper des sections). Dans ce cas, ajoutez des polygones qui définissent les sections découpées en utilisant des arguments supplémentaires de la fonction. La fonction ne prend pas en charge les polygones non simplement connectés. - -**Valeurs renvoyées** - -`1` si le point est à l'intérieur du polygone, `0` si elle ne l'est pas. -Si le point est sur la limite du polygone, la fonction peut renvoyer 0 ou 1. - -**Exemple** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## geohashEncode {#geohashencode} - -Encode la latitude et la longitude en tant que chaîne geohash, voir (http://geohash.org/, https://en.wikipedia.org/wiki/Geohash). - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**Les valeurs d'entrée** - -- longitude longitude partie de la coordonnée que vous souhaitez encoder. Flottant dans la gamme`[-180°, 180°]` -- latitude latitude partie de la coordonnée que vous souhaitez encoder. Flottant dans la gamme `[-90°, 90°]` -- precision-facultatif, longueur de la chaîne codée résultante, par défaut `12`. Entier dans la gamme `[1, 12]`. Toute valeur inférieure à `1` ou supérieure à `12` silencieusement converti à `12`. - -**Valeurs renvoyées** - -- alphanumérique `String` de coordonnées codées (la version modifiée de l'alphabet de codage base32 est utilisée). - -**Exemple** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## geohashDecode {#geohashdecode} - -Décode toute chaîne codée geohash en longitude et latitude. - -**Les valeurs d'entrée** - -- chaîne codée-chaîne codée geohash. - -**Valeurs renvoyées** - -- (longitude, latitude) - 2-n-uplet de `Float64` les valeurs de longitude et de latitude. - -**Exemple** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## geoToH3 {#geotoh3} - -Retourner [H3](https://uber.github.io/h3/#/documentation/overview/introduction) point d'indice `(lon, lat)` avec une résolution spécifiée. - -[H3](https://uber.github.io/h3/#/documentation/overview/introduction) est un système d'indexation géographique où la surface de la Terre divisée en carreaux hexagonaux même. Ce système est hiérarchique, c'est-à-dire que chaque hexagone au niveau supérieur peut être divisé en sept, même mais plus petits, etc. - -Cet indice est principalement utilisé pour les emplacements de bucketing et d'autres manipulations géospatiales. - -**Syntaxe** - -``` sql -geoToH3(lon, lat, resolution) -``` - -**Paramètre** - -- `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). - -**Valeurs renvoyées** - -- Numéro d'indice hexagonal. -- 0 en cas d'erreur. - -Type: `UInt64`. - -**Exemple** - -Requête: - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -Résultat: - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## geohashesInBox {#geohashesinbox} - -Renvoie un tableau de chaînes codées geohash de précision donnée qui tombent à l'intérieur et croisent les limites d'une boîte donnée, essentiellement une grille 2D aplatie en tableau. - -**Les valeurs d'entrée** - -- longitude\_min-longitude min, valeur flottante dans la plage `[-180°, 180°]` -- latitude\_min-latitude min, valeur flottante dans la plage `[-90°, 90°]` -- longitude\_max-longitude maximale, valeur flottante dans la plage `[-180°, 180°]` -- latitude\_max-latitude maximale, valeur flottante dans la plage `[-90°, 90°]` -- précision - geohash précision, `UInt8` dans la gamme `[1, 12]` - -Veuillez noter que tous les paramètres de coordonnées doit être du même type: soit `Float32` ou `Float64`. - -**Valeurs renvoyées** - -- gamme de précision de longues chaînes de geohash-boîtes couvrant la zone, vous ne devriez pas compter sur l'ordre des éléments. -- \[\] - tableau vide si *min* les valeurs de *latitude* et *longitude* ne sont pas moins de correspondant *Max* valeur. - -Veuillez noter que la fonction lancera une exception si le tableau résultant a plus de 10'000'000 éléments. - -**Exemple** - -``` sql -SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos -``` - -``` text -┌─thasos──────────────────────────────────────┐ -│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ -└─────────────────────────────────────────────┘ -``` - -## h3GetBaseCell {#h3getbasecell} - -Renvoie le numéro de cellule de base de l'index. - -**Syntaxe** - -``` sql -h3GetBaseCell(index) -``` - -**Paramètre** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Valeurs renvoyées** - -- Numéro de cellule de base hexagonale. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT h3GetBaseCell(612916788725809151) as basecell -``` - -Résultat: - -``` text -┌─basecell─┐ -│ 12 │ -└──────────┘ -``` - -## h3HexAreaM2 {#h3hexaream2} - -Surface hexagonale Moyenne en mètres carrés à la résolution donnée. - -**Syntaxe** - -``` sql -h3HexAreaM2(resolution) -``` - -**Paramètre** - -- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Valeurs renvoyées** - -- Area in m². Type: [Float64](../../sql_reference/data_types/float.md). - -**Exemple** - -Requête: - -``` sql -SELECT h3HexAreaM2(13) as area -``` - -Résultat: - -``` text -┌─area─┐ -│ 43.9 │ -└──────┘ -``` - -## h3IndexesAreNeighbors {#h3indexesareneighbors} - -Renvoie si les H3Indexes fournis sont voisins ou non. - -**Syntaxe** - -``` sql -h3IndexesAreNeighbors(index1, index2) -``` - -**Paramètre** - -- `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). - -**Valeurs renvoyées** - -- Retourner `1` si les index sont voisins, `0` autrement. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n -``` - -Résultat: - -``` text -┌─n─┐ -│ 1 │ -└───┘ -``` - -## h3enfants {#h3tochildren} - -Retourne un tableau avec les index enfants de l'index donné. - -**Syntaxe** - -``` sql -h3ToChildren(index, resolution) -``` - -**Paramètre** - -- `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). - -**Valeurs renvoyées** - -- Tableau avec les index H3 enfants. Tableau de type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT h3ToChildren(599405990164561919, 6) AS children -``` - -Résultat: - -``` text -┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## h3ToParent {#h3toparent} - -Renvoie l'index parent (plus grossier) contenant l'index donné. - -**Syntaxe** - -``` sql -h3ToParent(index, resolution) -``` - -**Paramètre** - -- `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). - -**Valeurs renvoyées** - -- Parent H3 index. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT h3ToParent(599405990164561919, 3) as parent -``` - -Résultat: - -``` text -┌─────────────parent─┐ -│ 590398848891879423 │ -└────────────────────┘ -``` - -## h3ToString {#h3tostring} - -Convertit la représentation H3Index de l'index en représentation de chaîne. - -``` sql -h3ToString(index) -``` - -**Paramètre** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Valeurs renvoyées** - -- Représentation en chaîne de l'index H3. Type: [Chaîne](../../sql_reference/data_types/string.md). - -**Exemple** - -Requête: - -``` sql -SELECT h3ToString(617420388352917503) as h3_string -``` - -Résultat: - -``` text -┌─h3_string───────┐ -│ 89184926cdbffff │ -└─────────────────┘ -``` - -## stringToH3 {#stringtoh3} - -Convertit la représentation de chaîne en représentation H3Index (UInt64). - -``` sql -stringToH3(index_str) -``` - -**Paramètre** - -- `index_str` — String representation of the H3 index. Type: [Chaîne](../../sql_reference/data_types/string.md). - -**Valeurs renvoyées** - -- Numéro d'indice hexagonal. Renvoie 0 en cas d'erreur. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT stringToH3('89184926cc3ffff') as index -``` - -Résultat: - -``` text -┌──────────────index─┐ -│ 617420388351344639 │ -└────────────────────┘ -``` - -## h3grésolution {#h3getresolution} - -Retourne la résolution de l'index. - -**Syntaxe** - -``` sql -h3GetResolution(index) -``` - -**Paramètre** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Valeurs renvoyées** - -- L'indice de la résolution. Gamme: `[0, 15]`. Type: [UInt8](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT h3GetResolution(617420388352917503) as res -``` - -Résultat: - -``` text -┌─res─┐ -│ 9 │ -└─────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/fr/sql_reference/functions/hash_functions.md b/docs/fr/sql_reference/functions/hash_functions.md deleted file mode 100644 index 7996a3c1f13..00000000000 --- a/docs/fr/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,446 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 50 -toc_title: Hachage ---- - -# Les fonctions de hachage {#hash-functions} - -Les fonctions de hachage peuvent être utilisées pour le brassage pseudo-aléatoire déterministe des éléments. - -## halfMD5 {#hash-functions-halfmd5} - -[Interpréter](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) tous les paramètres d'entrée sous forme de chaînes et calcule le [MD5](https://en.wikipedia.org/wiki/MD5) la valeur de hachage pour chacun d'eux. Puis combine les hachages, prend les 8 premiers octets du hachage de la chaîne résultante, et les interprète comme `UInt64` dans l'ordre des octets big-endian. - -``` sql -halfMD5(par1, ...) -``` - -La fonction est relativement lente (5 millions de chaînes courtes par seconde par cœur de processeur). -Envisager l'utilisation de la [sipHash64](#hash_functions-siphash64) la fonction la place. - -**Paramètre** - -La fonction prend un nombre variable de paramètres d'entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql_reference/data_types/index.md). - -**Valeur Renvoyée** - -A [UInt64](../../sql_reference/data_types/int_uint.md) valeur de hachage du type de données. - -**Exemple** - -``` sql -SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type -``` - -``` text -┌────────halfMD5hash─┬─type───┐ -│ 186182704141653334 │ UInt64 │ -└────────────────────┴────────┘ -``` - -## MD5 {#hash_functions-md5} - -Calcule le MD5 à partir d'une chaîne et renvoie L'ensemble d'octets résultant en tant que FixedString(16). -Si vous n'avez pas besoin de MD5 en particulier, mais que vous avez besoin d'un hachage cryptographique 128 bits décent, utilisez le ‘sipHash128’ la fonction la place. -Si vous voulez obtenir le même résultat que la sortie de l'utilitaire md5sum, utilisez lower (hex(MD5 (s))). - -## sipHash64 {#hash_functions-siphash64} - -Produit un 64 bits [SipHash](https://131002.net/siphash/) la valeur de hachage. - -``` sql -sipHash64(par1,...) -``` - -C'est une fonction de hachage cryptographique. Il fonctionne au moins trois fois plus vite que le [MD5](#hash_functions-md5) fonction. - -Fonction [interpréter](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) tous les paramètres d'entrée sous forme de chaînes et calcule la valeur de hachage pour chacun d'eux. Puis combine les hachages par l'algorithme suivant: - -1. Après avoir haché tous les paramètres d'entrée, la fonction obtient le tableau de hachages. -2. La fonction prend le premier et le second éléments et calcule un hachage pour le tableau d'entre eux. -3. Ensuite, la fonction prend la valeur de hachage, calculée à l'étape précédente, et le troisième élément du tableau de hachage initial, et calcule un hachage pour le tableau d'entre eux. -4. L'étape précédente est répétée pour tous les éléments restants de la période initiale de hachage tableau. - -**Paramètre** - -La fonction prend un nombre variable de paramètres d'entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql_reference/data_types/index.md). - -**Valeur Renvoyée** - -A [UInt64](../../sql_reference/data_types/int_uint.md) valeur de hachage du type de données. - -**Exemple** - -``` sql -SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type -``` - -``` text -┌──────────────SipHash─┬─type───┐ -│ 13726873534472839665 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## sipHash128 {#hash_functions-siphash128} - -Calcule SipHash à partir d'une chaîne. -Accepte un argument de type chaîne. Renvoie FixedString (16). -Diffère de sipHash64 en ce que l'état de pliage xor final n'est effectué que jusqu'à 128 bits. - -## cityHash64 {#cityhash64} - -Produit un 64 bits [CityHash](https://github.com/google/cityhash) la valeur de hachage. - -``` sql -cityHash64(par1,...) -``` - -Ceci est une fonction de hachage non cryptographique rapide. Il utilise L'algorithme CityHash pour les paramètres de chaîne et la fonction de hachage rapide non cryptographique spécifique à l'implémentation pour les paramètres avec d'autres types de données. La fonction utilise le combinateur CityHash pour obtenir les résultats finaux. - -**Paramètre** - -La fonction prend un nombre variable de paramètres d'entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql_reference/data_types/index.md). - -**Valeur Renvoyée** - -A [UInt64](../../sql_reference/data_types/int_uint.md) valeur de hachage du type de données. - -**Exemple** - -Appelez exemple: - -``` sql -SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type -``` - -``` text -┌─────────────CityHash─┬─type───┐ -│ 12072650598913549138 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -L'exemple suivant montre comment calculer la somme de l'ensemble de la table avec précision jusqu'à la ligne de commande: - -``` sql -SELECT groupBitXor(cityHash64(*)) FROM table -``` - -## intHash32 {#inthash32} - -Calcule un code de hachage 32 bits à partir de n'importe quel type d'entier. -C'est une fonction de hachage non cryptographique relativement rapide de qualité moyenne pour les nombres. - -## intHash64 {#inthash64} - -Calcule un code de hachage 64 bits à partir de n'importe quel type d'entier. -Il fonctionne plus vite que intHash32. Qualité moyenne. - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -Calcule SHA-1, SHA-224 ou SHA-256 à partir d'une chaîne et renvoie l'ensemble d'octets résultant en tant que FixedString(20), FixedString(28) ou FixedString(32). -La fonction fonctionne assez lentement (SHA-1 traite environ 5 millions de chaînes courtes par seconde par cœur de processeur, tandis que SHA-224 et SHA-256 traitent environ 2,2 millions). -Nous vous recommandons d'utiliser cette fonction uniquement dans les cas où vous avez besoin d'une fonction de hachage spécifique et que vous ne pouvez pas la sélectionner. -Même dans ces cas, nous vous recommandons d'appliquer la fonction hors ligne et de pré-calculer les valeurs lors de leur insertion dans la table, au lieu de l'appliquer dans SELECTS. - -## URLHash(url \[, N\]) {#urlhashurl-n} - -Une fonction de hachage non cryptographique rapide et de qualité décente pour une chaîne obtenue à partir d'une URL en utilisant un type de normalisation. -`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` ou `#` à la fin, si elle est présente. -`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` ou `#` à la fin, si elle est présente. -Les niveaux sont les mêmes que dans URLHierarchy. Cette fonction est spécifique à Yandex.Metrica. - -## farmHash64 {#farmhash64} - -Produit un 64 bits [FarmHash](https://github.com/google/farmhash) la valeur de hachage. - -``` sql -farmHash64(par1, ...) -``` - -La fonction utilise le `Hash64` la méthode de tous les [les méthodes disponibles](https://github.com/google/farmhash/blob/master/src/farmhash.h). - -**Paramètre** - -La fonction prend un nombre variable de paramètres d'entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql_reference/data_types/index.md). - -**Valeur Renvoyée** - -A [UInt64](../../sql_reference/data_types/int_uint.md) valeur de hachage du type de données. - -**Exemple** - -``` sql -SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type -``` - -``` text -┌─────────────FarmHash─┬─type───┐ -│ 17790458267262532859 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## javaHash {#hash_functions-javahash} - -Calculer [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) à partir d'une chaîne. Cette fonction de hachage n'est ni rapide ni de bonne qualité. La seule raison de l'utiliser est lorsque cet algorithme est déjà utilisé dans un autre système et que vous devez calculer exactement le même résultat. - -**Syntaxe** - -``` sql -SELECT javaHash(''); -``` - -**Valeur renvoyée** - -A `Int32` valeur de hachage du type de données. - -**Exemple** - -Requête: - -``` sql -SELECT javaHash('Hello, world!'); -``` - -Résultat: - -``` text -┌─javaHash('Hello, world!')─┐ -│ -1880044555 │ -└───────────────────────────┘ -``` - -## javaHashUTF16LE {#javahashutf16le} - -Calculer [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) à partir d'une chaîne, en supposant qu'elle contient des octets représentant une chaîne en encodage UTF-16LE. - -**Syntaxe** - -``` sql -javaHashUTF16LE(stringUtf16le) -``` - -**Paramètre** - -- `stringUtf16le` — a string in UTF-16LE encoding. - -**Valeur renvoyée** - -A `Int32` valeur de hachage du type de données. - -**Exemple** - -Requête correcte avec une chaîne codée UTF-16LE. - -Requête: - -``` sql -SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) -``` - -Résultat: - -``` text -┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ -│ 3556498 │ -└──────────────────────────────────────────────────────────────┘ -``` - -## hiveHash {#hash-functions-hivehash} - -Calculer `HiveHash` à partir d'une chaîne. - -``` sql -SELECT hiveHash(''); -``` - -C'est juste [JavaHash](#hash_functions-javahash) avec le bit de signe mis à zéro. Cette fonction est utilisée dans [Apache Hive](https://en.wikipedia.org/wiki/Apache_Hive) pour les versions antérieures à la version 3.0. Cette fonction de hachage n'est ni rapide ni de bonne qualité. La seule raison de l'utiliser est lorsque cet algorithme est déjà utilisé dans un autre système et que vous devez calculer exactement le même résultat. - -**Valeur renvoyée** - -A `Int32` valeur de hachage du type de données. - -Type: `hiveHash`. - -**Exemple** - -Requête: - -``` sql -SELECT hiveHash('Hello, world!'); -``` - -Résultat: - -``` text -┌─hiveHash('Hello, world!')─┐ -│ 267439093 │ -└───────────────────────────┘ -``` - -## metroHash64 {#metrohash64} - -Produit un 64 bits [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/) la valeur de hachage. - -``` sql -metroHash64(par1, ...) -``` - -**Paramètre** - -La fonction prend un nombre variable de paramètres d'entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql_reference/data_types/index.md). - -**Valeur Renvoyée** - -A [UInt64](../../sql_reference/data_types/int_uint.md) valeur de hachage du type de données. - -**Exemple** - -``` sql -SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type -``` - -``` text -┌────────────MetroHash─┬─type───┐ -│ 14235658766382344533 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## jumpConsistentHash {#jumpconsistenthash} - -Calcule JumpConsistentHash forme un UInt64. -Accepte deux arguments: une clé de type UInt64 et le nombre de compartiments. Renvoie Int32. -Pour plus d'informations, voir le lien: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) - -## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} - -Produit un [MurmurHash2](https://github.com/aappleby/smhasher) la valeur de hachage. - -``` sql -murmurHash2_32(par1, ...) -murmurHash2_64(par1, ...) -``` - -**Paramètre** - -Les deux fonctions prennent un nombre variable de paramètres d'entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql_reference/data_types/index.md). - -**Valeur Renvoyée** - -- Le `murmurHash2_32` fonction renvoie la valeur de hachage ayant le [UInt32](../../sql_reference/data_types/int_uint.md) type de données. -- Le `murmurHash2_64` fonction renvoie la valeur de hachage ayant le [UInt64](../../sql_reference/data_types/int_uint.md) type de données. - -**Exemple** - -``` sql -SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type -``` - -``` text -┌──────────MurmurHash2─┬─type───┐ -│ 11832096901709403633 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} - -Produit un [MurmurHash3](https://github.com/aappleby/smhasher) la valeur de hachage. - -``` sql -murmurHash3_32(par1, ...) -murmurHash3_64(par1, ...) -``` - -**Paramètre** - -Les deux fonctions prennent un nombre variable de paramètres d'entrée. Les paramètres peuvent être tout de la [types de données pris en charge](../../sql_reference/data_types/index.md). - -**Valeur Renvoyée** - -- Le `murmurHash3_32` la fonction retourne un [UInt32](../../sql_reference/data_types/int_uint.md) valeur de hachage du type de données. -- Le `murmurHash3_64` la fonction retourne un [UInt64](../../sql_reference/data_types/int_uint.md) valeur de hachage du type de données. - -**Exemple** - -``` sql -SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3─┬─type───┐ -│ 2152717 │ UInt32 │ -└─────────────┴────────┘ -``` - -## murmurHash3\_128 {#murmurhash3-128} - -Produit de 128 bits [MurmurHash3](https://github.com/aappleby/smhasher) la valeur de hachage. - -``` sql -murmurHash3_128( expr ) -``` - -**Paramètre** - -- `expr` — [Expression](../syntax.md#syntax-expressions) de retour d'un [Chaîne](../../sql_reference/data_types/string.md)-le type de la valeur. - -**Valeur Renvoyée** - -A [FixedString (16)](../../sql_reference/data_types/fixedstring.md) valeur de hachage du type de données. - -**Exemple** - -``` sql -SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3──────┬─type────────────┐ -│ 6�1�4"S5KT�~~q │ FixedString(16) │ -└──────────────────┴─────────────────┘ -``` - -## xxHash32, xxHash64 {#hash-functions-xxhash32} - -Calculer `xxHash` à partir d'une chaîne. Il est proposé en deux saveurs, 32 et 64 bits. - -``` sql -SELECT xxHash32(''); - -OR - -SELECT xxHash64(''); -``` - -**Valeur renvoyée** - -A `Uint32` ou `Uint64` valeur de hachage du type de données. - -Type: `xxHash`. - -**Exemple** - -Requête: - -``` sql -SELECT xxHash32('Hello, world!'); -``` - -Résultat: - -``` text -┌─xxHash32('Hello, world!')─┐ -│ 834093149 │ -└───────────────────────────┘ -``` - -**Voir Aussi** - -- [xxHash](http://cyan4973.github.io/xxHash/). - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/fr/sql_reference/functions/higher_order_functions.md b/docs/fr/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index 4d6d31c42f7..00000000000 --- a/docs/fr/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 57 -toc_title: "D'Ordre Sup\xE9rieur" ---- - -# Fonctions d'ordre supérieur {#higher-order-functions} - -## `->` opérateur, fonction lambda (params, expr) {#operator-lambdaparams-expr-function} - -Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. - -Exemple: `x -> 2 * x, str -> str != Referer.` - -Les fonctions d'ordre supérieur ne peuvent accepter que les fonctions lambda comme argument fonctionnel. - -Une fonction lambda qui accepte plusieurs arguments peuvent être passés à une fonction d'ordre supérieur. Dans ce cas, la fonction d'ordre supérieur est passé plusieurs tableaux de longueur identique que ces arguments correspondent. - -Pour certaines fonctions, telles que [arrayCount](#higher_order_functions-array-count) ou [arraySum](#higher_order_functions-array-count) le premier argument (la fonction lambda) peut être omis. Dans ce cas, un mappage identique est supposé. - -Une fonction lambda ne peut pas être omise pour les fonctions suivantes: - -- [arrayMap](#higher_order_functions-array-map) -- [arrayFilter](#higher_order_functions-array-filter) -- [arrayFill](#higher_order_functions-array-fill) -- [arrayReverseFill](#higher_order_functions-array-reverse-fill) -- [arraySplit](#higher_order_functions-array-split) -- [arrayReverseSplit](#higher_order_functions-array-reverse-split) -- [arrayFirst](#higher_order_functions-array-first) -- [arrayFirstIndex](#higher_order_functions-array-first-index) - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -Renvoie un tableau obtenu à partir de l'application d'origine `func` fonction à chaque élément dans le `arr` tableau. - -Exemple: - -``` sql -SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,4,5] │ -└─────────┘ -``` - -L'exemple suivant montre comment créer un n-uplet d'éléments de différents tableaux: - -``` sql -SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res -``` - -``` text -┌─res─────────────────┐ -│ [(1,4),(2,5),(3,6)] │ -└─────────────────────┘ -``` - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayMap` fonction. - -### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} - -Renvoie un tableau contenant uniquement les éléments `arr1` pour ce qui `func` retourne autre chose que 0. - -Exemple: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - -``` text -┌─res───────────┐ -│ ['abc World'] │ -└───────────────┘ -``` - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - -``` text -┌─res─┐ -│ [2] │ -└─────┘ -``` - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFilter` fonction. - -### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} - -Analyse par le biais de `arr1` du premier élément au dernier élément et remplacer `arr1[i]` par `arr1[i - 1]` si `func` renvoie 0. Le premier élément de `arr1` ne sera pas remplacé. - -Exemple: - -``` sql -SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res──────────────────────────────┐ -│ [1,1,3,11,12,12,12,5,6,14,14,14] │ -└──────────────────────────────────┘ -``` - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFill` fonction. - -### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} - -Analyse par le biais de `arr1` du dernier élément au premier élément et remplacer `arr1[i]` par `arr1[i + 1]` si `func` renvoie 0. Le dernier élément de `arr1` ne sera pas remplacé. - -Exemple: - -``` sql -SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res────────────────────────────────┐ -│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ -└────────────────────────────────────┘ -``` - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayReverseFill` fonction. - -### arraySplit(func, arr1, …) {#higher_order_functions-array-split} - -Split `arr1` en plusieurs tableaux. Lorsque `func` retourne autre chose que 0, la matrice sera de split sur le côté gauche de l'élément. Le tableau ne sera pas partagé avant le premier élément. - -Exemple: - -``` sql -SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res─────────────┐ -│ [[1,2,3],[4,5]] │ -└─────────────────┘ -``` - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arraySplit` fonction. - -### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} - -Split `arr1` en plusieurs tableaux. Lorsque `func` retourne autre chose que 0, la matrice sera de split sur le côté droit de l'élément. Le tableau ne sera pas divisé après le dernier élément. - -Exemple: - -``` sql -SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res───────────────┐ -│ [[1],[2,3,4],[5]] │ -└───────────────────┘ -``` - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arraySplit` fonction. - -### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} - -Renvoie le nombre d'éléments dans l'arr tableau pour lequel func renvoie autre chose que 0. Si ‘func’ n'est pas spécifié, il renvoie le nombre d'éléments non nuls dans le tableau. - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -Renvoie 1 s'il existe au moins un élément ‘arr’ pour ce qui ‘func’ retourne autre chose que 0. Sinon, il renvoie 0. - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -Renvoie 1 si ‘func’ retourne autre chose que 0 pour tous les éléments de ‘arr’. Sinon, il renvoie 0. - -### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} - -Renvoie la somme de la ‘func’ valeur. Si la fonction est omise, elle retourne la somme des éléments du tableau. - -### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} - -Renvoie le premier élément du ‘arr1’ tableau pour lequel ‘func’ retourne autre chose que 0. - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFirst` fonction. - -### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} - -Renvoie l'index du premier élément de la ‘arr1’ tableau pour lequel ‘func’ retourne autre chose que 0. - -Notez que le premier argument (fonction lambda) ne peut pas être omis dans le `arrayFirstIndex` fonction. - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -Retourne un tableau des sommes partielles d'éléments dans le tableau source (une somme). Si l' `func` la fonction est spécifiée, les valeurs des éléments du tableau sont convertis par cette fonction avant l'addition. - -Exemple: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - -``` text -┌─res──────────┐ -│ [1, 2, 3, 4] │ -└──────────────┘ -``` - -### arrayCumSumNonNegative (arr) {#arraycumsumnonnegativearr} - -Même que `arrayCumSum`, renvoie un tableau des sommes partielles d'éléments dans le tableau source (une somme). Différent `arrayCumSum`, lorsque la valeur renvoyée contient une valeur inférieure à zéro, la valeur est remplacée par zéro et le calcul ultérieur est effectué avec des paramètres zéro. Exemple: - -``` sql -SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,0,1] │ -└───────────┘ -``` - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -Renvoie un tableau à la suite du tri des éléments de `arr1` dans l'ordre croissant. Si l' `func` la fonction est spécifiée, l'ordre de classement est déterminé par le résultat de la fonction `func` appliquée aux éléments du tableau (tableaux) - -Le [Transformation schwartzienne](https://en.wikipedia.org/wiki/Schwartzian_transform) est utilisé pour améliorer l'efficacité du tri. - -Exemple: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Pour plus d'informations sur la `arraySort` la méthode, voir l' [Fonctions pour travailler avec des tableaux](array_functions.md#array_functions-sort) section. - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -Renvoie un tableau à la suite du tri des éléments de `arr1` dans l'ordre décroissant. Si l' `func` la fonction est spécifiée, l'ordre de classement est déterminé par le résultat de la fonction `func` appliquée aux éléments du tableau (tableaux). - -Exemple: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -Pour plus d'informations sur la `arrayReverseSort` la méthode, voir l' [Fonctions pour travailler avec des tableaux](array_functions.md#array_functions-reverse-sort) section. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/fr/sql_reference/functions/in_functions.md b/docs/fr/sql_reference/functions/in_functions.md deleted file mode 100644 index d9f083250cc..00000000000 --- a/docs/fr/sql_reference/functions/in_functions.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 60 -toc_title: "Mise en \u0153uvre de L'op\xE9rateur IN" ---- - -# Fonctions de mise en œuvre de L'opérateur IN {#functions-for-implementing-the-in-operator} - -## in, notin, globalIn, globalNotIn {#in-functions} - -Voir la section [Dans les opérateurs](../statements/select.md#select-in-operators). - -## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} - -Une fonction qui permet de regrouper plusieurs colonnes. -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. -Les Tuples sont normalement utilisés comme valeurs intermédiaires pour un argument D'opérateurs IN, ou pour créer une liste de paramètres formels de fonctions lambda. Les Tuples ne peuvent pas être écrits sur une table. - -## tupleElement (tuple, n), opérateur X. N {#tupleelementtuple-n-operator-x-n} - -Une fonction qui permet d'obtenir une colonne à partir d'un tuple. -‘N’ est l'index de colonne, à partir de 1. N doit être une constante. ‘N’ doit être une constante. ‘N’ doit être un entier postif strict ne dépassant pas la taille du tuple. -Il n'y a aucun coût pour exécuter la fonction. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/fr/sql_reference/functions/index.md b/docs/fr/sql_reference/functions/index.md deleted file mode 100644 index f4e6bf7566a..00000000000 --- a/docs/fr/sql_reference/functions/index.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Functions -toc_priority: 32 -toc_title: Introduction ---- - -# Fonction {#functions} - -Il y a au moins\* deux types de fonctions - des fonctions régulières (elles sont simplement appelées “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn't depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). - -Dans cette section, nous discutons des fonctions classiques. Pour les fonctions d'agrégation, voir la section “Aggregate functions”. - -\* - Il existe un troisième type de fonction ‘arrayJoin’ la fonction appartient à; les fonctions de table peuvent également être mentionnées séparément.\* - -## Typage fort {#strong-typing} - -Contrairement à SQL standard, ClickHouse a une forte typage. En d'autres termes, il ne fait pas de conversions implicites entre les types. Chaque fonction fonctionne pour un ensemble spécifique de types. Cela signifie que vous devez parfois utiliser des fonctions de conversion de type. - -## Élimination des sous-expressions courantes {#common-subexpression-elimination} - -Toutes les expressions d'une requête qui ont le même AST (le même enregistrement ou le même résultat d'analyse syntaxique) sont considérées comme ayant des valeurs identiques. De telles expressions sont concaténées et exécutées une fois. Les sous-requêtes identiques sont également éliminées de cette façon. - -## Types de résultats {#types-of-results} - -Toutes les fonctions renvoient un seul retour comme résultat (pas plusieurs valeurs, et pas des valeurs nulles). Le type de résultat est généralement défini uniquement par les types d'arguments, pas par les valeurs. Les Exceptions sont la fonction tupleElement (l'opérateur A. N) et la fonction toFixedString. - -## Constant {#constants} - -Pour simplifier, certaines fonctions ne peuvent fonctionner qu'avec des constantes pour certains arguments. Par exemple, le bon argument de L'opérateur LIKE doit être une constante. -Presque toutes les fonctions renvoient une constante pour des arguments constants. L'exception est les fonctions qui génèrent des nombres aléatoires. -Le ‘now’ function renvoie des valeurs différentes pour les requêtes qui ont été exécutées à des moments différents, mais le résultat est considéré comme une constante, car la constance n'est importante que dans une seule requête. -Une expression constante est également considérée comme une constante (par exemple, la moitié droite de L'opérateur LIKE peut être construite à partir de plusieurs constantes). - -Les fonctions peuvent être implémentées de différentes manières pour des arguments constants et non constants (un code différent est exécuté). Mais les résultats pour une constante et pour une colonne vraie Ne contenant que la même valeur doivent correspondre les uns aux autres. - -## Le traitement NULL {#null-processing} - -Les fonctions ont les comportements suivants: - -- Si au moins l'un des arguments de la fonction est `NULL` le résultat de la fonction est également `NULL`. -- Comportement spécial spécifié individuellement dans la description de chaque fonction. Dans le code source de ClickHouse, ces fonctions ont `UseDefaultImplementationForNulls=false`. - -## Constance {#constancy} - -Functions can't change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. - -## Erreur de manipulation {#error-handling} - -Certaines fonctions peuvent lancer une exception si les données ne sont pas valides. Dans ce cas, la requête est annulée et un message d'erreur est retourné au client. Pour le traitement distribué, lorsqu'une exception se produit sur l'un des serveurs, les autres serveurs aussi tenté d'interrompre la requête. - -## Évaluation des expressions d'argument {#evaluation-of-argument-expressions} - -Dans presque tous les langages de programmation, l'un des arguments peut pas être évalué pour certains opérateurs. Ce sont généralement les opérateurs `&&`, `||`, et `?:`. -Mais dans ClickHouse, les arguments des fonctions (opérateurs) sont toujours évalués. En effet, des parties entières de colonnes sont évaluées à la fois, au lieu de calculer chaque ligne séparément. - -## Exécution de fonctions pour le traitement de requêtes distribuées {#performing-functions-for-distributed-query-processing} - -Pour le traitement de requête distribué, autant d'étapes de traitement de requête que possible sont effectuées sur des serveurs distants, et le reste des étapes (fusion des résultats intermédiaires et tout ce qui suit) sont effectuées sur le serveur demandeur. - -Cela signifie que les fonctions peuvent être effectuées sur différents serveurs. -Par exemple, dans la requête `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` - -- si un `distributed_table` a au moins deux fragments, les fonctions ‘g’ et ‘h’ sont effectuées sur des serveurs distants, et la fonction ‘f’ est effectuée sur le serveur demandeur. -- si un `distributed_table` a un seul fragment, tous les ‘f’, ‘g’, et ‘h’ les fonctions sont exécutées sur le serveur de ce fragment. - -Le résultat d'une fonction habituellement ne dépendent pas le serveur sur lequel elle est exécutée. Cependant, parfois c'est important. -Par exemple, les fonctions qui fonctionnent avec des dictionnaires utilisent le dictionnaire qui existe sur le serveur sur lequel elles s'exécutent. -Un autre exemple est l' `hostName` fonction, qui renvoie le nom du serveur sur lequel il s'exécute afin de `GROUP BY` par les serveurs dans un `SELECT` requête. - -Si une fonction dans une requête est effectuée sur le demandeur serveur, mais vous devez l'exécuter sur des serveurs distants, vous pouvez l'envelopper dans un ‘any’ fonction d'agrégation ou l'ajouter à une clé dans `GROUP BY`. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/fr/sql_reference/functions/introspection.md b/docs/fr/sql_reference/functions/introspection.md deleted file mode 100644 index 6205d096909..00000000000 --- a/docs/fr/sql_reference/functions/introspection.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 65 -toc_title: Introspection ---- - -# Fonctions D'Introspection {#introspection-functions} - -Vous pouvez utiliser les fonctions décrites dans ce chapitre pour introspecter [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) et [DWARF](https://en.wikipedia.org/wiki/DWARF) pour le profilage de requête. - -!!! warning "Avertissement" - Ces fonctions sont lentes et peuvent imposer des considérations de sécurité. - -Pour le bon fonctionnement des fonctions d'introspection: - -- Installer le `clickhouse-common-static-dbg` paquet. - -- Définir le [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) réglage sur 1. - - For security reasons introspection functions are disabled by default. - -Clickhouse enregistre les rapports du profileur [trace\_log](../../operations/system_tables.md#system_tables-trace_log) système de table. Assurez-vous que la table et le profileur sont correctement configurés. - -## addressToLine {#addresstoline} - -Convertit l'adresse de mémoire virtuelle dans le processus de serveur ClickHouse en nom de fichier et en numéro de ligne dans le code source de ClickHouse. - -Si vous utilisez des paquets clickhouse officiels, vous devez installer le `clickhouse-common-static-dbg` paquet. - -**Syntaxe** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**Paramètre** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**Valeur renvoyée** - -- Nom de fichier du code Source et le numéro de ligne dans ce fichier délimité par deux-points. - - For example, `/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199`, where `199` is a line number. - -- Nom d'un binaire, si la fonction n'a pas pu trouver les informations de débogage. - -- Chaîne vide, si l'adresse n'est pas valide. - -Type: [Chaîne](../../sql_reference/data_types/string.md). - -**Exemple** - -Activation des fonctions d'introspection: - -``` sql -SET allow_introspection_functions=1 -``` - -Sélection de la première chaîne de `trace_log` système de table: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -Le `trace` champ contient la trace de pile au moment de l'échantillonnage. - -Obtenir le nom de fichier du code source et le numéro de ligne pour une seule adresse: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 -``` - -Application de la fonction à la trace de la pile entière: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -Le [arrayMap](higher_order_functions.md#higher_order_functions-array-map) permet de traiter chaque élément individuel de l' `trace` tableau par la `addressToLine` fonction. Le résultat de ce traitement que vous voyez dans l' `trace_source_code_lines` colonne de sortie. - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## adressetosymbol {#addresstosymbol} - -Convertit l'adresse de mémoire virtuelle dans le processus de serveur ClickHouse en symbole à partir des fichiers d'objets ClickHouse. - -**Syntaxe** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**Paramètre** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**Valeur renvoyée** - -- Symbole des fichiers D'objets ClickHouse. -- Chaîne vide, si l'adresse n'est pas valide. - -Type: [Chaîne](../../sql_reference/data_types/string.md). - -**Exemple** - -Activation des fonctions d'introspection: - -``` sql -SET allow_introspection_functions=1 -``` - -Sélection de la première chaîne de `trace_log` système de table: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -Le `trace` champ contient la trace de pile au moment de l'échantillonnage. - -Obtenir un symbole pour une seule adresse: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -Application de la fonction à la trace de la pile entière: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -Le [arrayMap](higher_order_functions.md#higher_order_functions-array-map) permet de traiter chaque élément individuel de l' `trace` tableau par la `addressToSymbols` fonction. Le résultat de ce traitement que vous voyez dans l' `trace_symbols` colonne de sortie. - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## demangle {#demangle} - -Convertit un symbole que vous pouvez obtenir en utilisant le [adressetosymbol](#addresstosymbol) fonction au nom de la fonction c++. - -**Syntaxe** - -``` sql -demangle(symbol) -``` - -**Paramètre** - -- `symbol` ([Chaîne](../../sql_reference/data_types/string.md)) — Symbol from an object file. - -**Valeur renvoyée** - -- Nom de la fonction C++. -- Chaîne vide si un symbole n'est pas valide. - -Type: [Chaîne](../../sql_reference/data_types/string.md). - -**Exemple** - -Activation des fonctions d'introspection: - -``` sql -SET allow_introspection_functions=1 -``` - -Sélection de la première chaîne de `trace_log` système de table: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -Le `trace` champ contient la trace de pile au moment de l'échantillonnage. - -Obtenir un nom de fonction pour une seule adresse: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -Application de la fonction à la trace de la pile entière: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -Le [arrayMap](higher_order_functions.md#higher_order_functions-array-map) permet de traiter chaque élément individuel de l' `trace` tableau par la `demangle` fonction. Le résultat de ce traitement que vous voyez dans l' `trace_functions` colonne de sortie. - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/fr/sql_reference/functions/ip_address_functions.md b/docs/fr/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index 3c303e1a262..00000000000 --- a/docs/fr/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 55 -toc_title: Travailler avec des adresses IP ---- - -# Fonctions pour travailler avec des adresses IP {#functions-for-working-with-ip-addresses} - -## IPv4NumToString (num) {#ipv4numtostringnum} - -Prend un numéro UInt32. Interprète comme une adresse IPv4 dans big endian. Renvoie une chaîne contenant l'adresse IPv4 correspondante au format A. B. C. d (Nombres séparés par des points sous forme décimale). - -## IPv4StringToNum (s) {#ipv4stringtonums} - -La fonction inverse de IPv4NumToString. Si L'adresse IPv4 a un format non valide, elle renvoie 0. - -## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} - -Similaire à IPv4NumToString, mais en utilisant xxx au lieu du dernier octet. - -Exemple: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─k──────────────┬─────c─┐ -│ 83.149.9.xxx │ 26238 │ -│ 217.118.81.xxx │ 26074 │ -│ 213.87.129.xxx │ 25481 │ -│ 83.149.8.xxx │ 24984 │ -│ 217.118.83.xxx │ 22797 │ -│ 78.25.120.xxx │ 22354 │ -│ 213.87.131.xxx │ 21285 │ -│ 78.25.121.xxx │ 20887 │ -│ 188.162.65.xxx │ 19694 │ -│ 83.149.48.xxx │ 17406 │ -└────────────────┴───────┘ -``` - -Depuis l'utilisation de ‘xxx’ est très inhabituel, cela peut être changé à l'avenir. Nous vous recommandons de ne pas compter sur le format exact de ce fragment. - -### IPv6NumToString (x) {#ipv6numtostringx} - -Accepte une valeur FixedString (16) contenant L'adresse IPv6 au format binaire. Renvoie une chaîne contenant cette adresse au format texte. -Les adresses IPv4 mappées IPv6 sont sorties au format:: ffff: 111.222.33.44. Exemple: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - -``` text -┌─addr─────────┐ -│ 2a02:6b8::11 │ -└──────────────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ -│ 2a02:2168:aaa:bbbb::2 │ 24695 │ -│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ -│ 2a02:6b8:0:fff::ff │ 16389 │ -│ 2a01:4f8:111:6666::2 │ 16016 │ -│ 2a02:2168:888:222::1 │ 15896 │ -│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ -│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ -│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ -│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ -│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ -└─────────────────────────────────────────┴───────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)─┬──────c─┐ -│ ::ffff:94.26.111.111 │ 747440 │ -│ ::ffff:37.143.222.4 │ 529483 │ -│ ::ffff:5.166.111.99 │ 317707 │ -│ ::ffff:46.38.11.77 │ 263086 │ -│ ::ffff:79.105.111.111 │ 186611 │ -│ ::ffff:93.92.111.88 │ 176773 │ -│ ::ffff:84.53.111.33 │ 158709 │ -│ ::ffff:217.118.11.22 │ 154004 │ -│ ::ffff:217.118.11.33 │ 148449 │ -│ ::ffff:217.118.11.44 │ 148243 │ -└────────────────────────────┴────────┘ -``` - -## IPv6StringToNum (s) {#ipv6stringtonums} - -La fonction inverse de IPv6NumToString. Si L'adresse IPv6 a un format non valide, elle renvoie une chaîne d'octets null. -HEX peut être en majuscules ou en minuscules. - -## IPv4ToIPv6 (x) {#ipv4toipv6x} - -Prend un `UInt32` nombre. Interprète comme une adresse IPv4 dans [big endian](https://en.wikipedia.org/wiki/Endianness). Retourne un `FixedString(16)` valeur contenant l'adresse IPv6 au format binaire. Exemple: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - -``` text -┌─addr───────────────┐ -│ ::ffff:192.168.0.1 │ -└────────────────────┘ -``` - -## cutIPv6 (x, bitsToCutForIPv6, bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} - -Accepte une valeur FixedString (16) contenant L'adresse IPv6 au format binaire. Renvoie une chaîne contenant l'adresse du nombre spécifié de bits retiré au format texte. Exemple: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - -``` text -┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ -│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ -└─────────────────────────────────────┴─────────────────────┘ -``` - -## Ipv4cirtorange (ipv4, cidr), {#ipv4cidrtorangeipv4-cidr} - -Accepte un IPv4 et une valeur UInt8 contenant [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Renvoie un tuple avec deux IPv4 contenant la plage inférieure et la plage supérieure du sous-réseau. - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - -``` text -┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ -│ ('192.168.0.0','192.168.255.255') │ -└────────────────────────────────────────────┘ -``` - -## Ipv6cirtorange (ipv6, cidr), {#ipv6cidrtorangeipv6-cidr} - -Accepte un IPv6 et une valeur UInt8 contenant le CIDR. Renvoie un tuple avec deux IPv6 contenant la plage inférieure et la plage supérieure du sous-réseau. - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); -``` - -``` text -┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ -│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -## toipv4 (chaîne) {#toipv4string} - -Un alias `IPv4StringToNum()` cela prend une forme de chaîne D'adresse IPv4 et renvoie la valeur de [IPv4](../../sql_reference/data_types/domains/ipv4.md) type, qui est binaire égal à la valeur renvoyée par `IPv4StringToNum()`. - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - -``` text -┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ -│ UInt32 │ IPv4 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - -``` text -┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ -│ ABE1822D │ ABE1822D │ -└───────────────────────────────────┴──────────────────────────┘ -``` - -## toipv6 (chaîne) {#toipv6string} - -Un alias `IPv6StringToNum()` cela prend une forme de chaîne D'adresse IPv6 et renvoie la valeur de [IPv6](../../sql_reference/data_types/domains/ipv6.md) type, qui est binaire égal à la valeur renvoyée par `IPv6StringToNum()`. - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - -``` text -┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ -│ FixedString(16) │ IPv6 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - -``` text -┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ -│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ -└───────────────────────────────────┴──────────────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/fr/sql_reference/functions/json_functions.md b/docs/fr/sql_reference/functions/json_functions.md deleted file mode 100644 index ece6df40168..00000000000 --- a/docs/fr/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 56 -toc_title: Travailler avec JSON. ---- - -# Fonctions pour travailler avec JSON {#functions-for-working-with-json} - -Dans Yandex.Metrica, JSON est transmis par les utilisateurs en tant que paramètres de session. Il y a quelques fonctions spéciales pour travailler avec ce JSON. (Bien que dans la plupart des cas, les JSONs soient en outre prétraités et les valeurs résultantes sont placées dans des colonnes séparées dans leur format traité.) Toutes ces fonctions sont basées sur des hypothèses fortes sur ce que le JSON peut être, mais elles essaient de faire le moins possible pour faire le travail. - -Les hypothèses suivantes sont apportées: - -1. Le nom du champ (argument de fonction) doit être une constante. -2. Le nom du champ est en quelque sorte codé canoniquement dans JSON. Exemple: `visitParamHas('{"abc":"def"}', 'abc') = 1`, mais `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. Les champs sont recherchés à n'importe quel niveau d'imbrication, sans discrimination. S'il y a plusieurs champs correspondants, la première occurrence est utilisé. -4. Le JSON n'a pas de caractères d'espace en dehors des littéraux de chaîne. - -## visitParamHas(params, nom) {#visitparamhasparams-name} - -Vérifie s'il existe un champ avec ‘name’ nom. - -## visitParamExtractUInt(params, nom) {#visitparamextractuintparams-name} - -Analyse UInt64 à partir de la valeur du champ nommé ‘name’. Si c'est un champ de type chaîne, il tente d'analyser un numéro à partir du début de la chaîne. Si le champ n'existe pas, ou s'il existe mais ne contient pas de nombre, il renvoie 0. - -## visitParamExtractInt(params, name) {#visitparamextractintparams-name} - -Le même que pour Int64. - -## visitParamExtractFloat(params, nom) {#visitparamextractfloatparams-name} - -Le même que pour Float64. - -## visitParamExtractBool(params, nom) {#visitparamextractboolparams-name} - -Analyse d'une valeur vrai/faux. Le résultat est UInt8. - -## visitParamExtractRaw(params, nom) {#visitparamextractrawparams-name} - -Retourne la valeur d'un champ, y compris les séparateurs. - -Exemple: - -``` sql -visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' -visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' -``` - -## visitParamExtractString(params, nom) {#visitparamextractstringparams-name} - -Analyse la chaîne entre guillemets doubles. La valeur est sans échappement. Si l'échappement échoue, il renvoie une chaîne vide. - -Exemple: - -``` sql -visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' -visitParamExtractString('{"abc":"hello}', 'abc') = '' -``` - -Il n'y a actuellement aucun support pour les points de code dans le format `\uXXXX\uYYYY` qui ne proviennent pas du plan multilingue de base (ils sont convertis en CESU-8 au lieu de UTF-8). - -Les fonctions suivantes sont basées sur [simdjson](https://github.com/lemire/simdjson) conçu pour des exigences D'analyse JSON plus complexes. L'hypothèse 2 mentionnée ci-dessus s'applique toujours. - -## isValidJSON (json) {#isvalidjsonjson} - -Vérifie que la chaîne est un json valide. - -Exemple: - -``` sql -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} - -Si la valeur existe dans le document JSON, `1` sera retourné. - -Si la valeur n'existe pas, `0` sera retourné. - -Exemple: - -``` sql -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 -``` - -`indices_or_keys` est une liste de zéro ou plusieurs arguments chacun d'entre eux peut être une chaîne ou un entier. - -- String = membre d'objet d'accès par clé. -- Entier positif = accédez au n-ème membre / clé depuis le début. -- Entier négatif = accédez au n-ème membre / clé à partir de la fin. - -Minimum de l'indice de l'élément est 1. Ainsi, l'élément 0 n'existe pas. - -Vous pouvez utiliser des entiers pour accéder à la fois aux tableaux JSON et aux objets JSON. - -Ainsi, par exemple: - -``` sql -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' -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} - -Renvoie la longueur D'un tableau JSON ou d'un objet JSON. - -Si la valeur n'existe pas ou a un mauvais type, `0` sera retourné. - -Exemple: - -``` sql -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} - -De retour le type d'une valeur JSON. - -Si la valeur n'existe pas, `Null` sera retourné. - -Exemple: - -``` sql -SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' -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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -Analyse un JSON et extrait une valeur. Ces fonctions sont similaires à `visitParam` fonction. - -Si la valeur n'existe pas ou a un mauvais type, `0` sera retourné. - -Exemple: - -``` sql -SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 -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} - -Analyse un JSON et extrait une chaîne. Cette fonction est similaire à `visitParamExtractString` fonction. - -Si la valeur n'existe pas ou a un mauvais type, une chaîne vide est retournée. - -La valeur est sans échappement. Si l'échappement échoue, il renvoie une chaîne vide. - -Exemple: - -``` sql -SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' -SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' -SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' -``` - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -Analyse un JSON et extrait une valeur du type de données clickhouse donné. - -C'est une généralisation de la précédente `JSONExtract` fonction. -Cela signifie -`JSONExtract(..., 'String')` retourne exactement le même que `JSONExtractString()`, -`JSONExtract(..., 'Float64')` retourne exactement le même que `JSONExtractFloat()`. - -Exemple: - -``` sql -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL -SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 -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} - -Analyser les paires clé-valeur à partir D'un JSON où les valeurs sont du type de données clickhouse donné. - -Exemple: - -``` sql -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} - -Retourne une partie de JSON. - -Si la pièce n'existe pas ou a un mauvais type, une chaîne vide est retournée. - -Exemple: - -``` sql -SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' -``` - -## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} - -Retourne un tableau avec des éléments de tableau JSON, chacun représenté comme une chaîne non analysée. - -Si la pièce n'existe pas ou n'est pas de tableau, un tableau vide sera retournée. - -Exemple: - -``` sql -SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/fr/sql_reference/functions/logical_functions.md b/docs/fr/sql_reference/functions/logical_functions.md deleted file mode 100644 index e13dd4143d1..00000000000 --- a/docs/fr/sql_reference/functions/logical_functions.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 37 -toc_title: Logique ---- - -# Les fonctions logiques {#logical-functions} - -Les fonctions logiques acceptent tous les types numériques, mais renvoient un nombre UInt8 égal à 0 ou 1. - -Zéro comme argument est considéré “false,” alors que toute valeur non nulle est considérée comme “true”. - -## et, et opérateur {#and-and-operator} - -## ou, ou opérateur {#or-or-operator} - -## pas, pas opérateur {#not-not-operator} - -## xor {#xor} - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) diff --git a/docs/fr/sql_reference/functions/machine_learning_functions.md b/docs/fr/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index b3e8b7bd7c4..00000000000 --- a/docs/fr/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 64 -toc_title: Fonctions D'Apprentissage Automatique ---- - -# Fonctions D'Apprentissage Automatique {#machine-learning-functions} - -## evalMLMethod (prédiction) {#machine_learning_methods-evalmlmethod} - -Prédiction utilisant des modèles de régression ajustés utilise `evalMLMethod` fonction. Voir le lien dans la `linearRegression`. - -### Régression Linéaire Stochastique {#stochastic-linear-regression} - -Le [stochasticLinearRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlinearregression) la fonction d'agrégat implémente une méthode de descente de gradient stochastique utilisant un modèle linéaire et une fonction de perte MSE. Utiliser `evalMLMethod` prédire sur de nouvelles données. - -### Régression Logistique Stochastique {#stochastic-logistic-regression} - -Le [stochasticLogisticRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlogisticregression) la fonction d'agrégation implémente la méthode de descente de gradient stochastique pour le problème de classification binaire. Utiliser `evalMLMethod` prédire sur de nouvelles données. diff --git a/docs/fr/sql_reference/functions/math_functions.md b/docs/fr/sql_reference/functions/math_functions.md deleted file mode 100644 index 75d35b24fde..00000000000 --- a/docs/fr/sql_reference/functions/math_functions.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 44 -toc_title: "Math\xE9matique" ---- - -# Fonctions mathématiques {#mathematical-functions} - -Toutes les fonctions renvoient un nombre Float64. La précision du résultat est proche de la précision maximale possible, mais le résultat peut ne pas coïncider avec le nombre représentable de la machine le plus proche du nombre réel correspondant. - -## e() {#e} - -Renvoie un nombre Float64 proche du nombre E. - -## pi() {#pi} - -Returns a Float64 number that is close to the number π. - -## exp (x) {#expx} - -Accepte un argument numérique et renvoie un Float64 nombre proche de l'exposant de l'argument. - -## log(x), ln (x) {#logx-lnx} - -Accepte un argument numérique et renvoie un nombre Float64 proche du logarithme naturel de l'argument. - -## exp2 (x) {#exp2x} - -Accepte un argument numérique et renvoie un nombre Float64 proche de 2 à la puissance de X. - -## log2 (x) {#log2x} - -Accepte un argument numérique et renvoie un Float64 nombre proximité du logarithme binaire de l'argument. - -## exp10 (x) {#exp10x} - -Accepte un argument numérique et renvoie un nombre Float64 proche de 10 à la puissance de X. - -## log10 (x) {#log10x} - -Accepte un argument numérique et renvoie un nombre Float64 proche du logarithme décimal de l'argument. - -## sqrt (x) {#sqrtx} - -Accepte un argument numérique et renvoie un Float64 nombre proche de la racine carrée de l'argument. - -## cbrt (x) {#cbrtx} - -Accepte un argument numérique et renvoie un Float64 nombre proche de la racine cubique de l'argument. - -## erf (x) {#erfx} - -Si ‘x’ is non-negative, then erf(x / σ√2) est la probabilité qu'une variable aléatoire ayant une distribution normale avec un écart type ‘σ’ prend la valeur qui est séparée de la valeur attendue par plus de ‘x’. - -Exemple (règle de trois sigma): - -``` sql -SELECT erf(3 / sqrt(2)) -``` - -``` text -┌─erf(divide(3, sqrt(2)))─┐ -│ 0.9973002039367398 │ -└─────────────────────────┘ -``` - -## erfc (x) {#erfcx} - -Accepte un argument numérique et renvoie un nombre Float64 proche de 1-erf (x), mais sans perte de précision pour ‘x’ valeur. - -## lgamma (x) {#lgammax} - -Le logarithme de la fonction gamma. - -## tgamma (x) {#tgammax} - -La fonction Gamma. - -## sin (x) {#sinx} - -Sine. - -## cos (x) {#cosx} - -Cosinus. - -## tan (x) {#tanx} - -Tangente. - -## asin (x) {#asinx} - -Le sinus d'arc. - -## acos (x) {#acosx} - -Le cosinus de l'arc. - -## atan (x) {#atanx} - -L'arc tangente. - -## pow(x, y), la puissance(x, y) {#powx-y-powerx-y} - -Prend deux arguments numériques x et Y. renvoie un nombre Float64 proche de x à la puissance de Y. - -## intExp2 {#intexp2} - -Accepte un argument numérique et renvoie un nombre UInt64 proche de 2 à la puissance de X. - -## intExp10 {#intexp10} - -Accepte un argument numérique et renvoie un nombre UInt64 proche de 10 à la puissance de X. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/fr/sql_reference/functions/other_functions.md b/docs/fr/sql_reference/functions/other_functions.md deleted file mode 100644 index 99258bfd8ed..00000000000 --- a/docs/fr/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,1079 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 66 -toc_title: Autre ---- - -# D'autres fonctions {#other-functions} - -## hôte() {#hostname} - -Renvoie une chaîne avec le nom de l'hôte sur lequel cette fonction a été exécutée. Pour le traitement distribué, c'est le nom du serveur distant, si la fonction est exécutée sur un serveur distant. - -## FQDN {#fqdn} - -Retourne le nom de domaine pleinement qualifié. - -**Syntaxe** - -``` sql -fqdn(); -``` - -Cette fonction est insensible à la casse. - -**Valeur renvoyée** - -- Chaîne avec le nom de domaine complet. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT FQDN(); -``` - -Résultat: - -``` text -┌─FQDN()──────────────────────────┐ -│ clickhouse.ru-central1.internal │ -└─────────────────────────────────┘ -``` - -## basename {#basename} - -Extrait la partie finale d'une chaîne après la dernière barre oblique ou barre oblique inverse. Cette fonction est souvent utilisée pour extraire le nom de fichier d'un chemin. - -``` sql -basename( expr ) -``` - -**Paramètre** - -- `expr` — Expression resulting in a [Chaîne](../../sql_reference/data_types/string.md) type de valeur. Tous les antislashs doivent être échappés dans la valeur résultante. - -**Valeur Renvoyée** - -Une chaîne de caractères qui contient: - -- La partie finale d'une chaîne après la dernière barre oblique ou barre oblique inverse. - - If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. - -- La chaîne d'origine s'il n'y a pas de barres obliques ou de barres obliques inverses. - -**Exemple** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## visibleWidth (x) {#visiblewidthx} - -Calcule la largeur approximative lors de la sortie des valeurs vers la console au format texte (séparé par des tabulations). -Cette fonction est utilisée par le système pour implémenter de jolis formats. - -`NULL` est représenté comme une chaîne correspondant à `NULL` dans `Pretty` format. - -``` sql -SELECT visibleWidth(NULL) -``` - -``` text -┌─visibleWidth(NULL)─┐ -│ 4 │ -└────────────────────┘ -``` - -## toTypeName (x) {#totypenamex} - -Renvoie une chaîne contenant le nom du type de l'argument passé. - -Si `NULL` est passé à la fonction en entrée, puis il renvoie le `Nullable(Nothing)` type, ce qui correspond à un interne `NULL` représentation à ClickHouse. - -## la taille de bloc() {#function-blocksize} - -Récupère la taille du bloc. -Dans ClickHouse, les requêtes sont toujours exécutées sur des blocs (ensembles de parties de colonne). Cette fonction permet d'obtenir la taille du bloc pour lequel vous l'avez appelé. - -## matérialiser (x) {#materializex} - -Transforme une constante dans une colonne contenant une seule valeur. -Dans ClickHouse, les colonnes complètes et les constantes sont représentées différemment en mémoire. Les fonctions fonctionnent différemment pour les arguments constants et les arguments normaux (un code différent est exécuté), bien que le résultat soit presque toujours le même. Cette fonction sert à déboguer ce comportement. - -## ignore(…) {#ignore} - -Accepte tous les arguments, y compris `NULL`. Renvoie toujours 0. -Cependant, l'argument est toujours évalué. Cela peut être utilisé pour les benchmarks. - -## sommeil(secondes) {#sleepseconds} - -Dormir ‘seconds’ secondes sur chaque bloc de données. Vous pouvez spécifier un nombre entier ou un nombre à virgule flottante. - -## sleepEachRow (secondes) {#sleepeachrowseconds} - -Dormir ‘seconds’ secondes sur chaque ligne. Vous pouvez spécifier un nombre entier ou un nombre à virgule flottante. - -## currentDatabase() {#currentdatabase} - -Retourne le nom de la base de données actuelle. -Vous pouvez utiliser cette fonction dans les paramètres du moteur de table dans une requête CREATE TABLE où vous devez spécifier la base de données. - -## currentUser() {#other-function-currentuser} - -Renvoie la connexion de l'utilisateur actuel. La connexion de l'utilisateur, cette requête initiée, sera renvoyée en cas de requête distibuted. - -``` sql -SELECT currentUser(); -``` - -Alias: `user()`, `USER()`. - -**Valeurs renvoyées** - -- Connexion de l'utilisateur actuel. -- Connexion de l'utilisateur qui a lancé la requête en cas de requête distribuée. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT currentUser(); -``` - -Résultat: - -``` text -┌─currentUser()─┐ -│ default │ -└───────────────┘ -``` - -## isFinite (x) {#isfinitex} - -Accepte Float32 et Float64 et renvoie UInt8 égal à 1 si l'argument n'est pas infini et pas un NaN, sinon 0. - -## isInfinite (x) {#isinfinitex} - -Accepte Float32 et Float64 et renvoie UInt8 égal à 1 si l'argument est infini, sinon 0. Notez que 0 est retourné pour un NaN. - -## ifNotFinite {#ifnotfinite} - -Vérifie si la valeur à virgule flottante est finie. - -**Syntaxe** - - ifNotFinite(x,y) - -**Paramètre** - -- `x` — Value to be checked for infinity. Type: [Flottant\*](../../sql_reference/data_types/float.md). -- `y` — Fallback value. Type: [Flottant\*](../../sql_reference/data_types/float.md). - -**Valeur renvoyée** - -- `x` si `x` est finie. -- `y` si `x` n'est pas finie. - -**Exemple** - -Requête: - - SELECT 1/0 as infimum, ifNotFinite(infimum,42) - -Résultat: - - ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ - │ inf │ 42 │ - └─────────┴───────────────────────────────┘ - -Vous pouvez obtenir un résultat similaire en utilisant [opérateur ternaire](conditional_functions.md#ternary-operator): `isFinite(x) ? x : y`. - -## isNaN (x) {#isnanx} - -Accepte Float32 et Float64 et renvoie UInt8 égal à 1 si l'argument est un NaN, sinon 0. - -## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -Accepte les chaînes constantes: nom de la base de données, nom de la table et nom de la colonne. Renvoie une expression constante UInt8 égale à 1 s'il y a une colonne, sinon 0. Si le paramètre hostname est défini, le test s'exécutera sur un serveur distant. -La fonction renvoie une exception si la table n'existe pas. -Pour les éléments imbriqués structure des données, la fonction vérifie l'existence d'une colonne. Pour la structure de données imbriquée elle-même, la fonction renvoie 0. - -## bar {#function-bar} - -Permet de construire un diagramme unicode-art. - -`bar(x, min, max, width)` dessine une bande avec une largeur proportionnelle à `(x - min)` et égale à `width` les caractères lors de la `x = max`. - -Paramètre: - -- `x` — Size to display. -- `min, max` — Integer constants. The value must fit in `Int64`. -- `width` — Constant, positive integer, can be fractional. - -La bande dessinée avec précision à un huitième d'un symbole. - -Exemple: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - -``` text -┌──h─┬──────c─┬─bar────────────────┐ -│ 0 │ 292907 │ █████████▋ │ -│ 1 │ 180563 │ ██████ │ -│ 2 │ 114861 │ ███▋ │ -│ 3 │ 85069 │ ██▋ │ -│ 4 │ 68543 │ ██▎ │ -│ 5 │ 78116 │ ██▌ │ -│ 6 │ 113474 │ ███▋ │ -│ 7 │ 170678 │ █████▋ │ -│ 8 │ 278380 │ █████████▎ │ -│ 9 │ 391053 │ █████████████ │ -│ 10 │ 457681 │ ███████████████▎ │ -│ 11 │ 493667 │ ████████████████▍ │ -│ 12 │ 509641 │ ████████████████▊ │ -│ 13 │ 522947 │ █████████████████▍ │ -│ 14 │ 539954 │ █████████████████▊ │ -│ 15 │ 528460 │ █████████████████▌ │ -│ 16 │ 539201 │ █████████████████▊ │ -│ 17 │ 523539 │ █████████████████▍ │ -│ 18 │ 506467 │ ████████████████▊ │ -│ 19 │ 520915 │ █████████████████▎ │ -│ 20 │ 521665 │ █████████████████▍ │ -│ 21 │ 542078 │ ██████████████████ │ -│ 22 │ 493642 │ ████████████████▍ │ -│ 23 │ 400397 │ █████████████▎ │ -└────┴────────┴────────────────────┘ -``` - -## transformer {#transform} - -Transforme une valeur en fonction explicitement définis cartographie de certains éléments à l'autre. -Il existe deux variantes de cette fonction: - -### de transformation(x, array\_from, array\_to, par défaut) {#transformx-array-from-array-to-default} - -`x` – What to transform. - -`array_from` – Constant array of values for converting. - -`array_to` – Constant array of values to convert the values in ‘from’ de. - -`default` – Which value to use if ‘x’ n'est pas égale à une des valeurs de ‘from’. - -`array_from` et `array_to` – Arrays of the same size. - -Type: - -`transform(T, Array(T), Array(U), U) -> U` - -`T` et `U` peuvent être des types numériques, chaîne ou Date ou DateTime. -Lorsque la même lettre est indiquée (T ou U), pour les types numériques, il se peut qu'il ne s'agisse pas de types correspondants, mais de types ayant un type commun. -Par exemple, le premier argument peut avoir le type Int64, tandis que le second a le type Array(UInt16). - -Si l' ‘x’ la valeur est égale à l'un des éléments dans la ‘array\_from’ tableau, elle renvoie l'élément existant (qui est numéroté de même) de la ‘array\_to’ tableau. Sinon, elle renvoie ‘default’. S'il y a plusieurs éléments correspondants dans ‘array\_from’ il renvoie l'un des matches. - -Exemple: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - -``` text -┌─title─────┬──────c─┐ -│ Yandex │ 498635 │ -│ Google │ 229872 │ -│ Other │ 104472 │ -└───────────┴────────┘ -``` - -### de transformation(x, array\_from, array\_to) {#transformx-array-from-array-to} - -Diffère de la première variation en ce que le ‘default’ l'argument est omis. -Si l' ‘x’ la valeur est égale à l'un des éléments dans la ‘array\_from’ tableau, elle renvoie l'élément correspondant (qui est numéroté de même) de la ‘array\_to’ tableau. Sinon, elle renvoie ‘x’. - -Type: - -`transform(T, Array(T), Array(T)) -> T` - -Exemple: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -┌─s──────────────┬───────c─┐ -│ │ 2906259 │ -│ www.yandex │ 867767 │ -│ ███████.ru │ 313599 │ -│ mail.yandex.ru │ 107147 │ -│ ██████.ru │ 100355 │ -│ █████████.ru │ 65040 │ -│ news.yandex.ru │ 64515 │ -│ ██████.net │ 59141 │ -│ example.com │ 57316 │ -└────────────────┴─────────┘ -``` - -## formatReadableSize (x) {#formatreadablesizex} - -Accepte la taille (nombre d'octets). Renvoie une taille arrondie avec un suffixe (KiB, MiB, etc.) comme une chaîne de caractères. - -Exemple: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - -``` text -┌─filesize_bytes─┬─filesize───┐ -│ 1 │ 1.00 B │ -│ 1024 │ 1.00 KiB │ -│ 1048576 │ 1.00 MiB │ -│ 192851925 │ 183.92 MiB │ -└────────────────┴────────────┘ -``` - -## moins (a, b) {#leasta-b} - -Renvoie la plus petite valeur de a et b. - -## la plus grande(a, b) {#greatesta-b} - -Renvoie la plus grande valeur de a et B. - -## le temps de disponibilité() {#uptime} - -Renvoie la disponibilité du serveur en quelques secondes. - -## version() {#version} - -Renvoie la version du serveur sous forme de chaîne. - -## fuseau() {#timezone} - -Retourne le fuseau horaire du serveur. - -## blockNumber {#blocknumber} - -Renvoie le numéro de séquence du bloc de données où se trouve la ligne. - -## rowNumberInBlock {#function-rownumberinblock} - -Renvoie le numéro de séquence de la ligne dans le bloc de données. Différents blocs de données sont toujours recalculés. - -## rowNumberInAllBlocks() {#rownumberinallblocks} - -Renvoie le numéro de séquence de la ligne dans le bloc de données. Cette fonction ne prend en compte que les blocs de données affectés. - -## voisin {#neighbor} - -La fonction de fenêtre qui donne accès à une ligne à un décalage spécifié qui vient avant ou après la ligne actuelle d'une colonne donnée. - -**Syntaxe** - -``` sql -neighbor(column, offset[, default_value]) -``` - -Le résultat de la fonction dépend du touché des blocs de données et l'ordre des données dans le bloc. -Si vous créez une sous-requête avec ORDER BY et appelez la fonction depuis l'extérieur de la sous-requête, vous pouvez obtenir le résultat attendu. - -**Paramètre** - -- `column` — A column name or scalar expression. -- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql_reference/data_types/int_uint.md). -- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. - -**Valeurs renvoyées** - -- De la valeur pour `column` dans `offset` distance de la ligne actuelle si `offset` la valeur n'est pas en dehors des limites du bloc. -- La valeur par défaut pour `column` si `offset` la valeur est en dehors des limites du bloc. Si `default_value` est donné, alors il sera utilisé. - -Type: type de blocs de données affectés ou type de valeur par défaut. - -**Exemple** - -Requête: - -``` sql -SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; -``` - -Résultat: - -``` text -┌─number─┬─neighbor(number, 2)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 0 │ -│ 9 │ 0 │ -└────────┴─────────────────────┘ -``` - -Requête: - -``` sql -SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; -``` - -Résultat: - -``` text -┌─number─┬─neighbor(number, 2, 999)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 999 │ -│ 9 │ 999 │ -└────────┴──────────────────────────┘ -``` - -Cette fonction peut être utilisée pour calculer une année à valeur métrique: - -Requête: - -``` sql -WITH toDate('2018-01-01') AS start_date -SELECT - toStartOfMonth(start_date + (number * 32)) AS month, - toInt32(month) % 100 AS money, - neighbor(money, -12) AS prev_year, - round(prev_year / money, 2) AS year_over_year -FROM numbers(16) -``` - -Résultat: - -``` text -┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ -│ 2018-01-01 │ 32 │ 0 │ 0 │ -│ 2018-02-01 │ 63 │ 0 │ 0 │ -│ 2018-03-01 │ 91 │ 0 │ 0 │ -│ 2018-04-01 │ 22 │ 0 │ 0 │ -│ 2018-05-01 │ 52 │ 0 │ 0 │ -│ 2018-06-01 │ 83 │ 0 │ 0 │ -│ 2018-07-01 │ 13 │ 0 │ 0 │ -│ 2018-08-01 │ 44 │ 0 │ 0 │ -│ 2018-09-01 │ 75 │ 0 │ 0 │ -│ 2018-10-01 │ 5 │ 0 │ 0 │ -│ 2018-11-01 │ 36 │ 0 │ 0 │ -│ 2018-12-01 │ 66 │ 0 │ 0 │ -│ 2019-01-01 │ 97 │ 32 │ 0.33 │ -│ 2019-02-01 │ 28 │ 63 │ 2.25 │ -│ 2019-03-01 │ 56 │ 91 │ 1.62 │ -│ 2019-04-01 │ 87 │ 22 │ 0.25 │ -└────────────┴───────┴───────────┴────────────────┘ -``` - -## runningDifference(x) {#other_functions-runningdifference} - -Calculates the difference between successive row values ​​in the data block. -Renvoie 0 pour la première ligne et la différence par rapport à la rangée précédente pour chaque nouvelle ligne. - -Le résultat de la fonction dépend du touché des blocs de données et l'ordre des données dans le bloc. -Si vous créez une sous-requête avec ORDER BY et appelez la fonction depuis l'extérieur de la sous-requête, vous pouvez obtenir le résultat attendu. - -Exemple: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - -``` text -┌─EventID─┬───────────EventTime─┬─delta─┐ -│ 1106 │ 2016-11-24 00:00:04 │ 0 │ -│ 1107 │ 2016-11-24 00:00:05 │ 1 │ -│ 1108 │ 2016-11-24 00:00:05 │ 0 │ -│ 1109 │ 2016-11-24 00:00:09 │ 4 │ -│ 1110 │ 2016-11-24 00:00:10 │ 1 │ -└─────────┴─────────────────────┴───────┘ -``` - -Veuillez noter que la taille du bloc affecte le résultat. Avec chaque nouveau bloc, le `runningDifference` l'état est réinitialisé. - -``` sql -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -┌─number─┬─diff─┐ -│ 65536 │ 0 │ -└────────┴──────┘ -``` - -``` sql -set max_block_size=100000 -- default value is 65536! - -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -``` - -## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} - -De même que pour [runningDifference](./other_functions.md#other_functions-runningdifference) la différence est la valeur de la première ligne, est retourné à la valeur de la première ligne, et chaque rangée suivante renvoie la différence de la rangée précédente. - -## MACNumToString (num) {#macnumtostringnum} - -Accepte un numéro UInt64. Interprète comme une adresse MAC dans big endian. Renvoie une chaîne contenant l'adresse MAC correspondante au format AA:BB:CC: DD:EE: FF (Nombres séparés par deux points sous forme hexadécimale). - -## MACStringToNum (s) {#macstringtonums} - -La fonction inverse de MACNumToString. Si l'adresse MAC a un format non valide, elle renvoie 0. - -## MACStringToOUI (s) {#macstringtoouis} - -Accepte une adresse MAC au format AA:BB:CC: DD:EE: FF (Nombres séparés par deux points sous forme hexadécimale). Renvoie les trois premiers octets sous la forme D'un nombre UInt64. Si l'adresse MAC a un format non valide, elle renvoie 0. - -## getSizeOfEnumType {#getsizeofenumtype} - -Retourne le nombre de champs dans [Enum](../../sql_reference/data_types/enum.md). - -``` sql -getSizeOfEnumType(value) -``` - -**Paramètre:** - -- `value` — Value of type `Enum`. - -**Valeurs renvoyées** - -- Le nombre de champs avec `Enum` les valeurs d'entrée. -- Une exception est levée si le type n'est pas `Enum`. - -**Exemple** - -``` sql -SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## blockSerializedSize {#blockserializedsize} - -Retourne la taille sur le disque (sans tenir compte de la compression). - -``` sql -blockSerializedSize(value[, value[, ...]]) -``` - -**Paramètre:** - -- `value` — Any value. - -**Valeurs renvoyées** - -- Le nombre d'octets qui seront écrites sur le disque pour le bloc de valeurs (sans compression). - -**Exemple** - -``` sql -SELECT blockSerializedSize(maxState(1)) as x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## toColumnTypeName {#tocolumntypename} - -Renvoie le nom de la classe qui représente le type de données de la colonne dans la RAM. - -``` sql -toColumnTypeName(value) -``` - -**Paramètre:** - -- `value` — Any type of value. - -**Valeurs renvoyées** - -- Une chaîne avec le nom de la classe utilisée pour représenter `value` type de données dans la mémoire RAM. - -**Exemple de la différence entre`toTypeName ' and ' toColumnTypeName`** - -``` sql -SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime │ -└─────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ Const(UInt32) │ -└───────────────────────────────────────────────────────────┘ -``` - -L'exemple montre que le `DateTime` type de données est stocké dans la mémoire comme `Const(UInt32)`. - -## dumpColumnStructure {#dumpcolumnstructure} - -Affiche une description détaillée des structures de données en RAM - -``` sql -dumpColumnStructure(value) -``` - -**Paramètre:** - -- `value` — Any type of value. - -**Valeurs renvoyées** - -- Une chaîne décrivant la structure utilisée pour représenter `value` type de données dans la mémoire RAM. - -**Exemple** - -``` sql -SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) -``` - -``` text -┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime, Const(size = 1, UInt32(size = 1)) │ -└──────────────────────────────────────────────────────────────┘ -``` - -## defaultValueOfArgumentType {#defaultvalueofargumenttype} - -Affiche la valeur par défaut du type de données. - -Ne pas inclure des valeurs par défaut pour les colonnes personnalisées définies par l'utilisateur. - -``` sql -defaultValueOfArgumentType(expression) -``` - -**Paramètre:** - -- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. - -**Valeurs renvoyées** - -- `0` pour les nombres. -- Chaîne vide pour les chaînes. -- `ᴺᵁᴸᴸ` pour [Nullable](../../sql_reference/data_types/nullable.md). - -**Exemple** - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ -│ 0 │ -└─────────────────────────────────────────────┘ -``` - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ -│ ᴺᵁᴸᴸ │ -└───────────────────────────────────────────────────────┘ -``` - -## reproduire {#other-functions-replicate} - -Crée un tableau avec une seule valeur. - -Utilisé pour la mise en œuvre interne de [arrayJoin](array_join.md#functions_arrayjoin). - -``` sql -SELECT replicate(x, arr); -``` - -**Paramètre:** - -- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. -- `x` — The value that the resulting array will be filled with. - -**Valeur renvoyée** - -Un tableau rempli de la valeur `x`. - -Type: `Array`. - -**Exemple** - -Requête: - -``` sql -SELECT replicate(1, ['a', 'b', 'c']) -``` - -Résultat: - -``` text -┌─replicate(1, ['a', 'b', 'c'])─┐ -│ [1,1,1] │ -└───────────────────────────────┘ -``` - -## filesystemAvailable {#filesystemavailable} - -Renvoie la quantité d'espace restant sur le système de fichiers où se trouvent les fichiers des bases de données. Il est toujours plus petit que l'espace libre total ([filesystemFree](#filesystemfree)) parce qu'un peu d'espace est réservé au système D'exploitation. - -**Syntaxe** - -``` sql -filesystemAvailable() -``` - -**Valeur renvoyée** - -- La quantité d'espace restant disponible en octets. - -Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; -``` - -Résultat: - -``` text -┌─Available space─┬─Type───┐ -│ 30.75 GiB │ UInt64 │ -└─────────────────┴────────┘ -``` - -## filesystemFree {#filesystemfree} - -Retourne montant total de l'espace libre sur le système de fichiers où les fichiers des bases de données. Voir aussi `filesystemAvailable` - -**Syntaxe** - -``` sql -filesystemFree() -``` - -**Valeur renvoyée** - -- Quantité d'espace libre en octets. - -Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; -``` - -Résultat: - -``` text -┌─Free space─┬─Type───┐ -│ 32.39 GiB │ UInt64 │ -└────────────┴────────┘ -``` - -## filesystemCapacity {#filesystemcapacity} - -Renvoie la capacité du système de fichiers en octets. Pour l'évaluation, la [chemin](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) le répertoire de données doit être configuré. - -**Syntaxe** - -``` sql -filesystemCapacity() -``` - -**Valeur renvoyée** - -- Informations de capacité du système de fichiers en octets. - -Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Exemple** - -Requête: - -``` sql -SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" -``` - -Résultat: - -``` text -┌─Capacity──┬─Type───┐ -│ 39.32 GiB │ UInt64 │ -└───────────┴────────┘ -``` - -## finalizeAggregation {#function-finalizeaggregation} - -Prend de l'état de la fonction d'agrégation. Renvoie le résultat de l'agrégation (état finalisé). - -## runningAccumulate {#function-runningaccumulate} - -Prend les membres de la fonction d'agrégation et renvoie une colonne avec des valeurs, sont le résultat de l'accumulation de ces états pour un ensemble de bloc de lignes, de la première à la ligne actuelle. -Par exemple, prend l'état de la fonction d'agrégat (exemple runningAccumulate(uniqState(UserID))), et pour chaque ligne de bloc, retourne le résultat de la fonction d'agrégat lors de la fusion des états de toutes les lignes précédentes et de la ligne actuelle. -Ainsi, le résultat de la fonction dépend de la partition des données aux blocs et de l'ordre des données dans le bloc. - -## joinGet {#joinget} - -La fonction vous permet d'extraire les données de la table de la même manière qu'à partir d'un [dictionnaire](../../sql_reference/dictionaries/index.md). - -Obtient les données de [Rejoindre](../../engines/table_engines/special/join.md#creating-a-table) tables utilisant la clé de jointure spécifiée. - -Ne prend en charge que les tables créées avec `ENGINE = Join(ANY, LEFT, )` déclaration. - -**Syntaxe** - -``` sql -joinGet(join_storage_table_name, `value_column`, join_keys) -``` - -**Paramètre** - -- `join_storage_table_name` — an [identificateur](../syntax.md#syntax-identifiers) indique l'endroit où la recherche est effectuée. L'identificateur est recherché dans la base de données par défaut (voir paramètre `default_database` dans le fichier de config). Pour remplacer la base de données par défaut, utilisez `USE db_name` ou spécifiez la base de données et la table via le séparateur `db_name.db_table` voir l'exemple. -- `value_column` — name of the column of the table that contains required data. -- `join_keys` — list of keys. - -**Valeur renvoyée** - -Retourne la liste des valeurs correspond à la liste des clés. - -Si certain n'existe pas dans la table source alors `0` ou `null` seront renvoyés basé sur [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) paramètre. - -Plus d'infos sur `join_use_nulls` dans [Opération de jointure](../../engines/table_engines/special/join.md). - -**Exemple** - -Table d'entrée: - -``` sql -CREATE DATABASE db_test -CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 -INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) -``` - -``` text -┌─id─┬─val─┐ -│ 4 │ 13 │ -│ 2 │ 12 │ -│ 1 │ 11 │ -└────┴─────┘ -``` - -Requête: - -``` sql -SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 -``` - -Résultat: - -``` text -┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ -│ 0 │ -│ 11 │ -│ 12 │ -│ 0 │ -└──────────────────────────────────────────────────┘ -``` - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -Évaluer le modèle externe. -Accepte un nom de modèle et le modèle de l'argumentation. Renvoie Float64. - -## throwIf (x \[, custom\_message\]) {#throwifx-custom-message} - -Lever une exception si l'argument est non nul. -custom\_message - est un paramètre optionnel: une chaîne constante, fournit un message d'erreur - -``` sql -SELECT throwIf(number = 3, 'Too many') FROM numbers(10); -``` - -``` text -↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): -Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. -``` - -## identité {#identity} - -Renvoie la même valeur qui a été utilisée comme argument. Utilisé pour le débogage et les tests, permet d'annuler l'utilisation de l'index et d'obtenir les performances de requête d'une analyse complète. Lorsque la requête est analysée pour une utilisation possible de l'index, l'analyseur ne regarde pas à l'intérieur `identity` fonction. - -**Syntaxe** - -``` sql -identity(x) -``` - -**Exemple** - -Requête: - -``` sql -SELECT identity(42) -``` - -Résultat: - -``` text -┌─identity(42)─┐ -│ 42 │ -└──────────────┘ -``` - -## randomPrintableASCII {#randomascii} - -Génère une chaîne avec un ensemble aléatoire de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caractères imprimables. - -**Syntaxe** - -``` sql -randomPrintableASCII(length) -``` - -**Paramètre** - -- `length` — Resulting string length. Positive integer. - - If you pass `length < 0`, behavior of the function is undefined. - -**Valeur renvoyée** - -- Chaîne avec un ensemble aléatoire de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caractères imprimables. - -Type: [Chaîne](../../sql_reference/data_types/string.md) - -**Exemple** - -``` sql -SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 -``` - -``` text -┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ -│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ -│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ -│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ -└────────┴────────────────────────────────┴──────────────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/fr/sql_reference/functions/random_functions.md b/docs/fr/sql_reference/functions/random_functions.md deleted file mode 100644 index 92f15395bb1..00000000000 --- a/docs/fr/sql_reference/functions/random_functions.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 51 -toc_title: "La G\xE9n\xE9ration De Nombres Pseudo-Al\xE9atoires" ---- - -# Fonctions pour générer des nombres pseudo-aléatoires {#functions-for-generating-pseudo-random-numbers} - -Des générateurs Non cryptographiques de nombres pseudo-aléatoires sont utilisés. - -Toutes les fonctions acceptent zéro argument ou un argument. -Si un argument est passé, il peut être de n'importe quel type, et sa valeur n'est utilisée pour rien. -Le seul but de cet argument est d'empêcher l'élimination des sous-expressions courantes, de sorte que deux instances différentes de la même fonction renvoient des colonnes différentes avec des nombres aléatoires différents. - -## Rand {#rand} - -Renvoie un nombre UInt32 pseudo-aléatoire, réparti uniformément entre tous les nombres de type UInt32. -Utilise un générateur congruentiel linéaire. - -## rand64 {#rand64} - -Renvoie un nombre UInt64 pseudo-aléatoire, réparti uniformément entre tous les nombres de type UInt64. -Utilise un générateur congruentiel linéaire. - -## randConstant {#randconstant} - -Renvoie un nombre UInt32 pseudo-aléatoire, la valeur est une pour différents blocs. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/fr/sql_reference/functions/rounding_functions.md b/docs/fr/sql_reference/functions/rounding_functions.md deleted file mode 100644 index f2d20b0c4bf..00000000000 --- a/docs/fr/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 45 -toc_title: Arrondi ---- - -# Fonctions d'arrondi {#rounding-functions} - -## floor(x\[, N\]) {#floorx-n} - -Renvoie le plus grand nombre rond inférieur ou égal à `x`. Un nombre rond est un multiple de 1 / 10N, ou le nombre le plus proche du type de données approprié si 1 / 10N n'est pas exact. -‘N’ est une constante entière, paramètre facultatif. Par défaut, il est zéro, ce qui signifie arrondir à un entier. -‘N’ peut être négative. - -Exemple: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x` est n'importe quel type numérique. Le résultat est un nombre du même type. -Pour les arguments entiers, il est logique d'arrondir avec un négatif `N` valeur (pour non négatif `N`, la fonction ne fait rien). -Si l'arrondi provoque un débordement (par exemple, floor(-128, -1)), un résultat spécifique à l'implémentation est renvoyé. - -## ceil(x\[, n\]), plafond (x\[, n\]) {#ceilx-n-ceilingx-n} - -Renvoie le plus petit nombre rond supérieur ou égal à `x`. Dans tous les autres sens, il est le même que le `floor` fonction (voir ci-dessus). - -## trunc(x \[, N\]), truncate(x \[, N\]) {#truncx-n-truncatex-n} - -Renvoie le nombre rond avec la plus grande valeur absolue qui a une valeur absolue inférieure ou égale à `x`‘s. In every other way, it is the same as the ’floor’ fonction (voir ci-dessus). - -## round(x\[, N\]) {#rounding_functions-round} - -Arrondit une valeur à un nombre spécifié de décimales. - -La fonction renvoie le nombre plus proche de l'ordre spécifié. Dans le cas où un nombre donné a une distance égale aux nombres environnants, la fonction utilise l'arrondi de banquier pour les types de nombres flottants et arrondit à partir de zéro pour les autres types de nombres. - -``` sql -round(expression [, decimal_places]) -``` - -**Paramètre:** - -- `expression` — A number to be rounded. Can be any [expression](../syntax.md#syntax-expressions) retour du numérique [type de données](../../sql_reference/data_types/index.md#data_types). -- `decimal-places` — An integer value. - - Si `decimal-places > 0` alors la fonction arrondit la valeur à droite du point décimal. - - Si `decimal-places < 0` alors la fonction arrondit la valeur à gauche de la virgule décimale. - - Si `decimal-places = 0` alors la fonction arrondit la valeur à l'entier. Dans ce cas, l'argument peut être omis. - -**Valeur renvoyée:** - -Le nombre arrondi du même type que le nombre d'entrée. - -### Exemple {#examples} - -**Exemple d'utilisation** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - -``` text -┌───x─┬─round(divide(number, 2))─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -└─────┴──────────────────────────┘ -``` - -**Des exemples de l'arrondissement** - -Le résultat est arrondi au plus proche. - -``` text -round(3.2, 0) = 3 -round(4.1267, 2) = 4.13 -round(22,-1) = 20 -round(467,-2) = 500 -round(-467,-2) = -500 -``` - -Le Banquier arrondit. - -``` text -round(3.5) = 4 -round(4.5) = 4 -round(3.55, 1) = 3.6 -round(3.65, 1) = 3.6 -``` - -**Voir Aussi** - -- [roundBankers](#roundbankers) - -## roundBankers {#roundbankers} - -Arrondit un nombre à une position décimale spécifiée. - -- Si le nombre est arrondi à mi-chemin entre deux nombres, la fonction utilise l'arrondi. - - Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. - - It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. - -- Dans d'autres cas, la fonction arrondit les nombres à l'entier le plus proche. - -À l'aide de l'arrondi, vous pouvez réduire l'effet qu'arrondir les nombres sur les résultats d'additionner ou de soustraire ces chiffres. - -Par exemple, les nombres de somme 1.5, 2.5, 3.5, 4.5 avec des arrondis différents: - -- Pas d'arrondi: 1.5 + 2.5 + 3.5 + 4.5 = 12. -- Arrondi du banquier: 2 + 2 + 4 + 4 = 12. -- Arrondi à l'entier le plus proche: 2 + 3 + 4 + 5 = 14. - -**Syntaxe** - -``` sql -roundBankers(expression [, decimal_places]) -``` - -**Paramètre** - -- `expression` — A number to be rounded. Can be any [expression](../syntax.md#syntax-expressions) retour du numérique [type de données](../../sql_reference/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`. - - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. - -**Valeur renvoyée** - -Valeur arrondie par la méthode d'arrondi du banquier. - -### Exemple {#examples-1} - -**Exemple d'utilisation** - -Requête: - -``` sql - SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 -``` - -Résultat: - -``` text -┌───x─┬─b─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -│ 1.5 │ 2 │ -│ 2 │ 2 │ -│ 2.5 │ 2 │ -│ 3 │ 3 │ -│ 3.5 │ 4 │ -│ 4 │ 4 │ -│ 4.5 │ 4 │ -└─────┴───┘ -``` - -**Exemples d'arrondi bancaire** - -``` text -roundBankers(0.4) = 0 -roundBankers(-3.5) = -4 -roundBankers(4.5) = 4 -roundBankers(3.55, 1) = 3.6 -roundBankers(3.65, 1) = 3.6 -roundBankers(10.35, 1) = 10.4 -roundBankers(10.755, 2) = 11,76 -``` - -**Voir Aussi** - -- [rond](#rounding_functions-round) - -## roundToExp2 (num) {#roundtoexp2num} - -Accepte un certain nombre. Si le nombre est inférieur à un, elle renvoie 0. Sinon, il arrondit le nombre au degré le plus proche (entier non négatif) de deux. - -## roundDuration (num) {#rounddurationnum} - -Accepte un certain nombre. Si le nombre est inférieur à un, elle renvoie 0. Sinon, il arrondit le nombre vers le bas pour les nombres de l'ensemble: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Cette fonction est spécifique à Yandex.Metrica et utilisé pour la mise en œuvre du rapport sur la durée de la session. - -## roundAge (num) {#roundagenum} - -Accepte un certain nombre. Si le nombre est inférieur à 18, il renvoie 0. Sinon, il arrondit le nombre à un nombre de l'ensemble: 18, 25, 35, 45, 55. Cette fonction est spécifique à Yandex.Metrica et utilisé pour la mise en œuvre du rapport sur l'âge des utilisateurs. - -## roundDown(num, arr) {#rounddownnum-arr} - -Accepte un nombre et l'arrondit à un élément dans le tableau spécifié. Si la valeur est inférieure à la plus basse, la plus basse lié est retourné. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/fr/sql_reference/functions/splitting_merging_functions.md b/docs/fr/sql_reference/functions/splitting_merging_functions.md deleted file mode 100644 index 87ca53debc9..00000000000 --- a/docs/fr/sql_reference/functions/splitting_merging_functions.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 47 -toc_title: "Fractionnement et fusion de cha\xEEnes et de tableaux" ---- - -# Fonctions pour diviser et fusionner des chaînes et des tableaux {#functions-for-splitting-and-merging-strings-and-arrays} - -## splitByChar (séparateur, s) {#splitbycharseparator-s} - -Divise une chaîne en sous-chaînes séparées par un caractère spécifique. Il utilise une chaîne constante `separator` qui composé d'un seul caractère. -Retourne un tableau de certaines chaînes. Les sous-chaînes vides peuvent être sélectionnées si le séparateur se produit au début ou à la fin de la chaîne, ou s'il existe plusieurs séparateurs consécutifs. - -**Syntaxe** - -``` sql -splitByChar(, ) -``` - -**Paramètre** - -- `separator` — The separator which should contain exactly one character. [Chaîne](../../sql_reference/data_types/string.md). -- `s` — The string to split. [Chaîne](../../sql_reference/data_types/string.md). - -**Valeur renvoyée(s)** - -Retourne un tableau de certaines chaînes. Des sous-chaînes vides peuvent être sélectionnées lorsque: - -- Un séparateur se produit au début ou à la fin de la chaîne; -- Il existe plusieurs séparateurs consécutifs; -- La chaîne d'origine `s` est vide. - -Type: [Tableau](../../sql_reference/data_types/array.md) de [Chaîne](../../sql_reference/data_types/string.md). - -**Exemple** - -``` sql -SELECT splitByChar(',', '1,2,3,abcde') -``` - -``` text -┌─splitByChar(',', '1,2,3,abcde')─┐ -│ ['1','2','3','abcde'] │ -└─────────────────────────────────┘ -``` - -## splitByString(séparateur, s) {#splitbystringseparator-s} - -Divise une chaîne en sous-chaînes séparées par une chaîne. Il utilise une chaîne constante `separator` de plusieurs caractères comme séparateur. Si la chaîne `separator` est vide, il va diviser la chaîne `s` dans un tableau de caractères uniques. - -**Syntaxe** - -``` sql -splitByString(, ) -``` - -**Paramètre** - -- `separator` — The separator. [Chaîne](../../sql_reference/data_types/string.md). -- `s` — The string to split. [Chaîne](../../sql_reference/data_types/string.md). - -**Valeur renvoyée(s)** - -Retourne un tableau de certaines chaînes. Des sous-chaînes vides peuvent être sélectionnées lorsque: - -Type: [Tableau](../../sql_reference/data_types/array.md) de [Chaîne](../../sql_reference/data_types/string.md). - -- Un séparateur non vide se produit au début ou à la fin de la chaîne; -- Il existe plusieurs séparateurs consécutifs non vides; -- La chaîne d'origine `s` est vide tandis que le séparateur n'est pas vide. - -**Exemple** - -``` sql -SELECT splitByString(', ', '1, 2 3, 4,5, abcde') -``` - -``` text -┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ -│ ['1','2 3','4,5','abcde'] │ -└───────────────────────────────────────────┘ -``` - -``` sql -SELECT splitByString('', 'abcde') -``` - -``` text -┌─splitByString('', 'abcde')─┐ -│ ['a','b','c','d','e'] │ -└────────────────────────────┘ -``` - -## arrayStringConcat(arr \[, séparateur\]) {#arraystringconcatarr-separator} - -Concatène les chaînes répertoriées dans le tableau avec le séparateur."séparateur" est un paramètre facultatif: une chaîne constante, définie à une chaîne vide par défaut. -Retourne une chaîne de caractères. - -## alphaTokens (s) {#alphatokenss} - -Sélectionne des sous-chaînes d'octets consécutifs dans les plages A-z et A-Z. retourne un tableau de sous-chaînes. - -**Exemple** - -``` sql -SELECT alphaTokens('abca1abc') -``` - -``` text -┌─alphaTokens('abca1abc')─┐ -│ ['abca','abc'] │ -└─────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/fr/sql_reference/functions/string_functions.md b/docs/fr/sql_reference/functions/string_functions.md deleted file mode 100644 index 0201046529a..00000000000 --- a/docs/fr/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,489 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 40 -toc_title: "Travailler avec des cha\xEEnes" ---- - -# Fonctions pour travailler avec des chaînes {#functions-for-working-with-strings} - -## vide {#empty} - -Renvoie 1 pour une chaîne vide ou 0 pour une chaîne non vide. -Le type de résultat est UInt8. -Une chaîne est considérée comme non vide si elle contient au moins un octet, même s'il s'agit d'un espace ou d'un octet nul. -La fonction fonctionne également pour les tableaux. - -## notEmpty {#notempty} - -Renvoie 0 pour une chaîne vide ou 1 pour une chaîne non vide. -Le type de résultat est UInt8. -La fonction fonctionne également pour les tableaux. - -## longueur {#length} - -Renvoie la longueur d'une chaîne en octets (pas en caractères, et pas en points de code). -Le type de résultat est UInt64. -La fonction fonctionne également pour les tableaux. - -## lengthUTF8 {#lengthutf8} - -Renvoie la longueur d'une chaîne en points de code Unicode (pas en caractères), en supposant que la chaîne contient un ensemble d'octets qui composent le texte codé en UTF-8. Si cette hypothèse n'est pas remplie, elle renvoie un résultat (elle ne lance pas d'exception). -Le type de résultat est UInt64. - -## char\_length, CHAR\_LENGTH {#char-length} - -Renvoie la longueur d'une chaîne en points de code Unicode (pas en caractères), en supposant que la chaîne contient un ensemble d'octets qui composent le texte codé en UTF-8. Si cette hypothèse n'est pas remplie, elle renvoie un résultat (elle ne lance pas d'exception). -Le type de résultat est UInt64. - -## character\_length, CHARACTER\_LENGTH {#character-length} - -Renvoie la longueur d'une chaîne en points de code Unicode (pas en caractères), en supposant que la chaîne contient un ensemble d'octets qui composent le texte codé en UTF-8. Si cette hypothèse n'est pas remplie, elle renvoie un résultat (elle ne lance pas d'exception). -Le type de résultat est UInt64. - -## plus bas, lcase {#lower} - -Convertit les symboles latins ASCII dans une chaîne en minuscules. - -## supérieur, ucase {#upper} - -Convertit les symboles latins ASCII dans une chaîne en majuscules. - -## lowerUTF8 {#lowerutf8} - -Convertit une chaîne en minuscules, en supposant que la chaîne de caractères contient un ensemble d'octets qui composent un texte UTF-8. -Il ne détecte pas la langue. Donc, pour le turc, le résultat pourrait ne pas être exactement correct. -Si la longueur de la séquence d'octets UTF-8 est différente pour les majuscules et les minuscules d'un point de code, le résultat peut être incorrect pour ce point de code. -Si la chaîne contient un ensemble d'octets qui N'est pas UTF-8, le comportement n'est pas défini. - -## upperUTF8 {#upperutf8} - -Convertit une chaîne en majuscules, en supposant que la chaîne de caractères contient un ensemble d'octets qui composent un texte UTF-8. -Il ne détecte pas la langue. Donc, pour le turc, le résultat pourrait ne pas être exactement correct. -Si la longueur de la séquence d'octets UTF-8 est différente pour les majuscules et les minuscules d'un point de code, le résultat peut être incorrect pour ce point de code. -Si la chaîne contient un ensemble d'octets qui N'est pas UTF-8, le comportement n'est pas défini. - -## isValidUTF8 {#isvalidutf8} - -Renvoie 1, si l'ensemble d'octets est codé en UTF-8 valide, sinon 0. - -## toValidUTF8 {#tovalidutf8} - -Remplace les caractères UTF-8 non valides par `�` (U+FFFD) caractère. Tous les caractères non valides s'exécutant dans une rangée sont réduits en un seul caractère de remplacement. - -``` sql -toValidUTF8( input_string ) -``` - -Paramètre: - -- input\_string — Any set of bytes represented as the [Chaîne](../../sql_reference/data_types/string.md) type de données objet. - -Valeur renvoyée: chaîne UTF-8 valide. - -**Exemple** - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## répéter {#repeat} - -Répète une corde autant de fois que spécifié et concatène les valeurs répliquées comme une seule chaîne. - -**Syntaxe** - -``` sql -repeat(s, n) -``` - -**Paramètre** - -- `s` — The string to repeat. [Chaîne](../../sql_reference/data_types/string.md). -- `n` — The number of times to repeat the string. [UInt](../../sql_reference/data_types/int_uint.md). - -**Valeur renvoyée** - -La chaîne unique, qui contient la chaîne `s` répéter `n` temps. Si `n` \< 1, la fonction renvoie une chaîne vide. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT repeat('abc', 10) -``` - -Résultat: - -``` text -┌─repeat('abc', 10)──────────────┐ -│ abcabcabcabcabcabcabcabcabcabc │ -└────────────────────────────────┘ -``` - -## inverser {#reverse} - -Inverse la chaîne (comme une séquence d'octets). - -## reverseUTF8 {#reverseutf8} - -Inverse une séquence de points de code Unicode, en supposant que la chaîne contient un ensemble d'octets représentant un texte UTF-8. Sinon, il fait autre chose (il ne lance pas d'exception). - -## format(pattern, s0, s1, …) {#format} - -Formatage du motif constant avec la chaîne listée dans les arguments. `pattern` est un modèle de format Python simplifié. Chaîne de Format contient “replacement fields” entouré par des accolades `{}`. Tout ce qui n'est pas contenu dans les accolades est considéré comme du texte littéral, qui est copié inchangé dans la sortie. Si vous devez inclure un caractère d'Accolade dans le texte littéral, il peut être échappé en doublant: `{{ '{{' }}` et `{{ '}}' }}`. Les noms de champs peuvent être des nombres (à partir de zéro) ou vides (ils sont alors traités comme des nombres de conséquence). - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') -``` - -``` text -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ -``` - -``` sql -SELECT format('{} {}', 'Hello', 'World') -``` - -``` text -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## concat {#concat} - -Concatène les chaînes répertoriées dans les arguments, sans séparateur. - -**Syntaxe** - -``` sql -concat(s1, s2, ...) -``` - -**Paramètre** - -Valeurs de type String ou FixedString. - -**Valeurs renvoyées** - -Renvoie la chaîne qui résulte de la concaténation des arguments. - -Si l'une des valeurs d'argument est `NULL`, `concat` retourner `NULL`. - -**Exemple** - -Requête: - -``` sql -SELECT concat('Hello, ', 'World!') -``` - -Résultat: - -``` text -┌─concat('Hello, ', 'World!')─┐ -│ Hello, World! │ -└─────────────────────────────┘ -``` - -## concatAssumeInjective {#concatassumeinjective} - -Même que [concat](#concat) la différence est que vous devez vous assurer que `concat(s1, s2, ...) → sn` est injectif, il sera utilisé pour l'optimisation du groupe par. - -La fonction est nommée “injective” si elle renvoie toujours un résultat différent pour différentes valeurs d'arguments. En d'autres termes: des arguments différents ne donnent jamais un résultat identique. - -**Syntaxe** - -``` sql -concatAssumeInjective(s1, s2, ...) -``` - -**Paramètre** - -Valeurs de type String ou FixedString. - -**Valeurs renvoyées** - -Renvoie la chaîne qui résulte de la concaténation des arguments. - -Si l'une des valeurs d'argument est `NULL`, `concatAssumeInjective` retourner `NULL`. - -**Exemple** - -Table d'entrée: - -``` sql -CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; -INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); -SELECT * from key_val; -``` - -``` text -┌─key1────┬─key2─────┬─value─┐ -│ Hello, │ World │ 1 │ -│ Hello, │ World │ 2 │ -│ Hello, │ World! │ 3 │ -│ Hello │ , World! │ 2 │ -└─────────┴──────────┴───────┘ -``` - -Requête: - -``` sql -SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) -``` - -Résultat: - -``` text -┌─concat(key1, key2)─┬─sum(value)─┐ -│ Hello, World! │ 3 │ -│ Hello, World! │ 2 │ -│ Hello, World │ 3 │ -└────────────────────┴────────────┘ -``` - -## substring(s, offset, longueur), mid(s, offset, longueur), substr(s, offset, longueur) {#substring} - -Renvoie une sous-chaîne commençant par l'octet du ‘offset’ index ‘length’ octets de long. L'indexation des caractères commence à partir d'un (comme dans SQL standard). Le ‘offset’ et ‘length’ les arguments doivent être des constantes. - -## substringUTF8(s, offset, longueur) {#substringutf8} - -Le même que ‘substring’, mais pour les points de code Unicode. Fonctionne sous l'hypothèse que la chaîne contient un ensemble d'octets représentant un texte codé en UTF-8. Si cette hypothèse n'est pas remplie, elle renvoie un résultat (elle ne lance pas d'exception). - -## appendTrailingCharIfAbsent (s, c) {#appendtrailingcharifabsent} - -Si l' ‘s’ la chaîne n'est pas vide et ne contient pas ‘c’ personnage à la fin, il ajoute le ‘c’ personnage à la fin. - -## convertCharset(s, à partir de, à) {#convertcharset} - -Retourne une chaîne de caractères ‘s’ qui a été converti à partir de l'encodage dans ‘from’ pour l'encodage dans ‘to’. - -## base64Encode(s) {#base64encode} - -Encodage ‘s’ chaîne dans base64 - -## base64Decode(s) {#base64decode} - -Décoder la chaîne codée en base64 ‘s’ dans la chaîne d'origine. En cas d'échec, une exception est levée. - -## tryBase64Decode(s) {#trybase64decode} - -Semblable à base64Decode, mais en cas d'erreur, une chaîne vide serait renvoyé. - -## endsWith (s, suffixe) {#endswith} - -Renvoie s'il faut se terminer par le suffixe spécifié. Retourne 1 si la chaîne se termine par le suffixe spécifié, sinon elle renvoie 0. - -## startsWith (STR, préfixe) {#startswith} - -Retourne 1 si la chaîne commence par le préfixe spécifié, sinon elle renvoie 0. - -``` sql -SELECT startsWith('Spider-Man', 'Spi'); -``` - -**Valeurs renvoyées** - -- 1, si la chaîne commence par le préfixe spécifié. -- 0, si la chaîne ne commence pas par le préfixe spécifié. - -**Exemple** - -Requête: - -``` sql -SELECT startsWith('Hello, world!', 'He'); -``` - -Résultat: - -``` text -┌─startsWith('Hello, world!', 'He')─┐ -│ 1 │ -└───────────────────────────────────┘ -``` - -## coupe {#trim} - -Supprime tous les caractères spécifiés du début ou de la fin d'une chaîne. -Par défaut supprime toutes les occurrences consécutives d'espaces communs (caractère ASCII 32) des deux extrémités d'une chaîne. - -**Syntaxe** - -``` sql -trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) -``` - -**Paramètre** - -- `trim_character` — specified characters for trim. [Chaîne](../../sql_reference/data_types/string.md). -- `input_string` — string for trim. [Chaîne](../../sql_reference/data_types/string.md). - -**Valeur renvoyée** - -Une chaîne sans caractères de début et (ou) de fin spécifiés. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT trim(BOTH ' ()' FROM '( Hello, world! )') -``` - -Résultat: - -``` text -┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ -│ Hello, world! │ -└───────────────────────────────────────────────┘ -``` - -## trimLeft {#trimleft} - -Supprime toutes les occurrences consécutives d'espaces communs (caractère ASCII 32) depuis le début d'une chaîne. Il ne supprime pas d'autres types de caractères d'espaces (tabulation, espace sans pause, etc.). - -**Syntaxe** - -``` sql -trimLeft(input_string) -``` - -Alias: `ltrim(input_string)`. - -**Paramètre** - -- `input_string` — string to trim. [Chaîne](../../sql_reference/data_types/string.md). - -**Valeur renvoyée** - -Une chaîne sans ouvrir les espaces communs. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT trimLeft(' Hello, world! ') -``` - -Résultat: - -``` text -┌─trimLeft(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## trimRight {#trimright} - -Supprime toutes les occurrences consécutives d'espaces communs (caractère ASCII 32) de la fin d'une chaîne. Il ne supprime pas d'autres types de caractères d'espaces (tabulation, espace sans pause, etc.). - -**Syntaxe** - -``` sql -trimRight(input_string) -``` - -Alias: `rtrim(input_string)`. - -**Paramètre** - -- `input_string` — string to trim. [Chaîne](../../sql_reference/data_types/string.md). - -**Valeur renvoyée** - -Une chaîne sans espaces communs de fin. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT trimRight(' Hello, world! ') -``` - -Résultat: - -``` text -┌─trimRight(' Hello, world! ')─┐ -│ Hello, world! │ -└──────────────────────────────────────┘ -``` - -## trimBoth {#trimboth} - -Supprime toutes les occurrences consécutives d'espaces communs (caractère ASCII 32) des deux extrémités d'une chaîne. Il ne supprime pas d'autres types de caractères d'espaces (tabulation, espace sans pause, etc.). - -**Syntaxe** - -``` sql -trimBoth(input_string) -``` - -Alias: `trim(input_string)`. - -**Paramètre** - -- `input_string` — string to trim. [Chaîne](../../sql_reference/data_types/string.md). - -**Valeur renvoyée** - -Une chaîne sans espaces communs de début et de fin. - -Type: `String`. - -**Exemple** - -Requête: - -``` sql -SELECT trimBoth(' Hello, world! ') -``` - -Résultat: - -``` text -┌─trimBoth(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## CRC32 (s) {#crc32} - -Renvoie la somme de contrôle CRC32 d'une chaîne, en utilisant le polynôme CRC-32-IEEE 802.3 et la valeur initiale `0xffffffff` (zlib mise en œuvre). - -Le type de résultat est UInt32. - -## CRC32IEEE (s) {#crc32ieee} - -Renvoie la somme de contrôle CRC32 d'une chaîne, en utilisant le polynôme CRC-32-IEEE 802.3. - -Le type de résultat est UInt32. - -## CRC64 (s) {#crc64} - -Renvoie la somme de contrôle CRC64 d'une chaîne, en utilisant le polynôme CRC-64-ECMA. - -Le type de résultat est UInt64. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/fr/sql_reference/functions/string_replace_functions.md b/docs/fr/sql_reference/functions/string_replace_functions.md deleted file mode 100644 index 6b1a58db55b..00000000000 --- a/docs/fr/sql_reference/functions/string_replace_functions.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 42 -toc_title: "Pour remplacer dans les cha\xEEnes" ---- - -# Les fonctions de recherche et de remplacement dans les chaînes {#functions-for-searching-and-replacing-in-strings} - -## replaceOne(botte de foin, modèle, remplacement) {#replaceonehaystack-pattern-replacement} - -Remplace la première occurrence, si elle existe, ‘pattern’ sous-chaîne dans ‘haystack’ avec l' ‘replacement’ substring. -Ci-après, ‘pattern’ et ‘replacement’ doivent être constantes. - -## replaceAll(botte de foin, motif, remplacement), Remplacer(botte de foin, motif, remplacement) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} - -Remplace toutes les occurrences du ‘pattern’ sous-chaîne dans ‘haystack’ avec l' ‘replacement’ substring. - -## replaceRegexpOne(botte de foin, modèle, remplacement) {#replaceregexponehaystack-pattern-replacement} - -Remplacement en utilisant le ‘pattern’ expression régulière. Une expression régulière re2. -Remplace seulement la première occurrence, si elle existe. -Un motif peut être spécifié comme ‘replacement’. Ce modèle peut inclure des substitutions `\0-\9`. -Substitution `\0` inclut l'expression régulière entière. Substitution `\1-\9` correspond au sous-modèle numbers.To utilisez le `\` caractère dans un modèle, échappez-le en utilisant `\`. -Aussi garder à l'esprit qu'un littéral de chaîne nécessite une évasion. - -Exemple 1. Conversion de la date au format américain: - -``` sql -SELECT DISTINCT - EventDate, - replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res -FROM test.hits -LIMIT 7 -FORMAT TabSeparated -``` - -``` text -2014-03-17 03/17/2014 -2014-03-18 03/18/2014 -2014-03-19 03/19/2014 -2014-03-20 03/20/2014 -2014-03-21 03/21/2014 -2014-03-22 03/22/2014 -2014-03-23 03/23/2014 -``` - -Exemple 2. Copier une chaîne dix fois: - -``` sql -SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res -``` - -``` text -┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## replaceRegexpAll(botte de foin, modèle, remplacement) {#replaceregexpallhaystack-pattern-replacement} - -Cela fait la même chose, mais remplace toutes les occurrences. Exemple: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res -``` - -``` text -┌─res────────────────────────┐ -│ HHeelllloo,, WWoorrlldd!! │ -└────────────────────────────┘ -``` - -Par exception, si une expression régulière travaillé sur un vide sous-chaîne, le remplacement n'est pas effectué plus d'une fois. -Exemple: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res -``` - -``` text -┌─res─────────────────┐ -│ here: Hello, World! │ -└─────────────────────┘ -``` - -## regexpQuoteMeta (s) {#regexpquotemetas} - -La fonction ajoute une barre oblique inverse avant certains caractères prédéfinis dans la chaîne. -Les personnages prédéfinis: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, '\]', ‘?’, '\*‘,’+‘,’{‘,’:‘,’-'. -Cette implémentation diffère légèrement de re2:: RE2:: QuoteMeta. Il échappe à zéro octet comme \\0 au lieu de 00 et il échappe uniquement les caractères requis. -Pour plus d'informations, voir le lien: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/fr/sql_reference/functions/string_search_functions.md b/docs/fr/sql_reference/functions/string_search_functions.md deleted file mode 100644 index 2dfc66b287a..00000000000 --- a/docs/fr/sql_reference/functions/string_search_functions.md +++ /dev/null @@ -1,379 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 41 -toc_title: "Pour Rechercher Des Cha\xEEnes" ---- - -# Fonctions de recherche de chaînes {#functions-for-searching-strings} - -La recherche est sensible à la casse par défaut dans toutes ces fonctions. Il existe des variantes pour la recherche insensible à la casse. - -## position(botte de foin, aiguille), localiser( botte de foin, aiguille) {#position} - -Renvoie la position (en octets) de la sous-chaîne trouvée dans la chaîne, à partir de 1. - -Fonctionne sous l'hypothèse que la chaîne de caractères contient un ensemble d'octets représentant un octet texte codé. Si cette hypothèse n'est pas remplie et qu'un caractère ne peut pas être représenté à l'aide d'un seul octet, la fonction ne lance pas d'exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux octets, il utilisera deux octets et ainsi de suite. - -Pour une recherche insensible à la casse, utilisez la fonction [positioncaseinsensible](#positioncaseinsensitive). - -**Syntaxe** - -``` sql -position(haystack, needle) -``` - -Alias: `locate(haystack, needle)`. - -**Paramètre** - -- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). - -**Valeurs renvoyées** - -- Position de départ en octets (à partir de 1), si la sous-chaîne a été trouvée. -- 0, si la sous-chaîne n'a pas été trouvé. - -Type: `Integer`. - -**Exemple** - -Phrase “Hello, world!” contient un ensemble d'octets représentant un octet texte codé. La fonction renvoie un résultat attendu: - -Requête: - -``` sql -SELECT position('Hello, world!', '!') -``` - -Résultat: - -``` text -┌─position('Hello, world!', '!')─┐ -│ 13 │ -└────────────────────────────────┘ -``` - -La même phrase en russe contient des caractères qui ne peuvent pas être représentés en utilisant un seul octet. La fonction renvoie un résultat inattendu (utilisation [positionUTF8](#positionutf8) fonction pour le texte codé sur plusieurs octets): - -Requête: - -``` sql -SELECT position('Привет, мир!', '!') -``` - -Résultat: - -``` text -┌─position('Привет, мир!', '!')─┐ -│ 21 │ -└───────────────────────────────┘ -``` - -## positioncaseinsensible {#positioncaseinsensitive} - -Le même que [position](#position) renvoie la position (en octets) de la sous-chaîne trouvée dans la chaîne, à partir de 1. Utilisez la fonction pour une recherche insensible à la casse. - -Fonctionne sous l'hypothèse que la chaîne de caractères contient un ensemble d'octets représentant un octet texte codé. Si cette hypothèse n'est pas remplie et qu'un caractère ne peut pas être représenté à l'aide d'un seul octet, la fonction ne lance pas d'exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux octets, il utilisera deux octets et ainsi de suite. - -**Syntaxe** - -``` sql -positionCaseInsensitive(haystack, needle) -``` - -**Paramètre** - -- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). - -**Valeurs renvoyées** - -- Position de départ en octets (à partir de 1), si la sous-chaîne a été trouvée. -- 0, si la sous-chaîne n'a pas été trouvé. - -Type: `Integer`. - -**Exemple** - -Requête: - -``` sql -SELECT positionCaseInsensitive('Hello, world!', 'hello') -``` - -Résultat: - -``` text -┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ -│ 1 │ -└───────────────────────────────────────────────────┘ -``` - -## positionUTF8 {#positionutf8} - -Renvoie la position (en points Unicode) de la sous-chaîne trouvée dans la chaîne, à partir de 1. - -Fonctionne sous l'hypothèse que la chaîne contient un ensemble d'octets représentant un texte codé en UTF-8. Si cette hypothèse n'est pas remplie, la fonction ne lance pas d'exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux points Unicode, il en utilisera deux et ainsi de suite. - -Pour une recherche insensible à la casse, utilisez la fonction [positionCaseInsensitiveUTF8](#positioncaseinsensitiveutf8). - -**Syntaxe** - -``` sql -positionUTF8(haystack, needle) -``` - -**Paramètre** - -- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). - -**Valeurs renvoyées** - -- Position de départ dans les points Unicode (à partir de 1), si la sous-chaîne a été trouvée. -- 0, si la sous-chaîne n'a pas été trouvé. - -Type: `Integer`. - -**Exemple** - -Phrase “Hello, world!” en russe contient un ensemble de points Unicode représentant un texte codé à un seul point. La fonction renvoie un résultat attendu: - -Requête: - -``` sql -SELECT positionUTF8('Привет, мир!', '!') -``` - -Résultat: - -``` text -┌─positionUTF8('Привет, мир!', '!')─┐ -│ 12 │ -└───────────────────────────────────┘ -``` - -Phrase “Salut, étudiante!” où le caractère `é` peut être représenté en utilisant un point (`U+00E9`) ou deux points (`U+0065U+0301`) la fonction peut être retournée un résultat inattendu: - -Requête pour la lettre `é` qui est représenté un point Unicode `U+00E9`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Résultat: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 17 │ -└────────────────────────────────────────┘ -``` - -Requête pour la lettre `é` qui est représenté deux points Unicode `U+0065U+0301`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Résultat: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 18 │ -└────────────────────────────────────────┘ -``` - -## positionCaseInsensitiveUTF8 {#positioncaseinsensitiveutf8} - -Le même que [positionUTF8](#positionutf8) mais est sensible à la casse. Renvoie la position (en points Unicode) de la sous-chaîne trouvée dans la chaîne, à partir de 1. - -Fonctionne sous l'hypothèse que la chaîne contient un ensemble d'octets représentant un texte codé en UTF-8. Si cette hypothèse n'est pas remplie, la fonction ne lance pas d'exception et renvoie un résultat inattendu. Si le caractère peut être représenté en utilisant deux points Unicode, il en utilisera deux et ainsi de suite. - -**Syntaxe** - -``` sql -positionCaseInsensitiveUTF8(haystack, needle) -``` - -**Paramètre** - -- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). - -**Valeur renvoyée** - -- Position de départ dans les points Unicode (à partir de 1), si la sous-chaîne a été trouvée. -- 0, si la sous-chaîne n'a pas été trouvé. - -Type: `Integer`. - -**Exemple** - -Requête: - -``` sql -SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') -``` - -Résultat: - -``` text -┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ -│ 9 │ -└────────────────────────────────────────────────────┘ -``` - -## multirecherchallpositions {#multisearchallpositions} - -Le même que [position](string_search_functions.md#position) mais les retours `Array` des positions (en octets) des sous-chaînes correspondantes trouvées dans la chaîne. Les Positions sont indexées à partir de 1. - -La recherche est effectuée sur des séquences d'octets sans tenir compte de l'encodage et du classement des chaînes. - -- Pour une recherche ASCII insensible à la casse, utilisez la fonction `multiSearchAllPositionsCaseInsensitive`. -- Pour la recherche en UTF-8, Utilisez la fonction [multiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). -- Pour la recherche UTF-8 insensible à la casse, utilisez la fonction multiSearchAllPositionsCaseInsensitiveutf8. - -**Syntaxe** - -``` sql -multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) -``` - -**Paramètre** - -- `haystack` — string, in which substring will to be searched. [Chaîne](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Chaîne](../syntax.md#syntax-string-literal). - -**Valeurs renvoyées** - -- Tableau de positions de départ en octets (à partir de 1), si la sous-chaîne correspondante a été trouvée et 0 si elle n'est pas trouvée. - -**Exemple** - -Requête: - -``` sql -SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) -``` - -Résultat: - -``` text -┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ -│ [0,13,0] │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## multiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} - -Voir `multiSearchAllPositions`. - -## multiSearchFirstPosition(botte de foin, \[aiguille1, aiguille2, …, needleet\]) {#multisearchfirstposition} - -Le même que `position` mais renvoie le décalage le plus à gauche de la chaîne `haystack` et qui correspond à certains des aiguilles. - -Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. - -## multiSearchFirstIndex(botte de foin, \[aiguille1, aiguille2, …, needleet\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} - -Renvoie l'index `i` (à partir de 1) de l'aiguille trouvée la plus à gaucheje dans la chaîne `haystack` et 0 sinon. - -Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. - -## multiSearchAny(botte de foin, \[aiguille1, aiguille2, …, needleet\]) {#function-multisearchany} - -Renvoie 1, si au moins une aiguille de chaîneje correspond à la chaîne `haystack` et 0 sinon. - -Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. - -!!! note "Note" - Dans tous les `multiSearch*` fonctions le nombre d'aiguilles doit être d'au moins 28 en raison de la spécification de mise en œuvre. - -## match (botte de foin, motif) {#matchhaystack-pattern} - -Vérifie si la chaîne correspond au `pattern` expression régulière. Un `re2` expression régulière. Le [syntaxe](https://github.com/google/re2/wiki/Syntax) de la `re2` les expressions régulières sont plus limitées que la syntaxe des expressions régulières Perl. - -Renvoie 0 si elle ne correspond pas, ou 1 si elle correspond. - -Notez que le symbole antislash (`\`) est utilisé pour s'échapper dans l'expression régulière. Le même symbole est utilisé pour échapper dans les littéraux de chaîne. Donc, pour échapper au symbole dans une expression régulière, vous devez écrire deux barres obliques inverses ( \\ ) dans un littéral de chaîne. - -L'expression régulière travaille à la chaîne, comme si c'est un ensemble d'octets. L'expression régulière ne peut pas contenir d'octets nuls. -Pour que les modèles recherchent des sous-chaînes dans une chaîne, il est préférable D'utiliser LIKE ou ‘position’ depuis ils travaillent beaucoup plus vite. - -## multiMatchAny(botte de foin, \[motif1, modèle2, …, patternet\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} - -Le même que `match` mais renvoie 0 si aucune des expressions régulières sont appariés et 1 si l'un des modèles les matchs. Il utilise [hyperscan](https://github.com/intel/hyperscan) bibliothèque. Pour que les modèles recherchent des sous-chaînes dans une chaîne, il est préférable d'utiliser `multiSearchAny` comme cela fonctionne beaucoup plus vite. - -!!! note "Note" - La longueur de l'un des `haystack` la chaîne doit être inférieure à 232 octets sinon l'exception est levée. Cette restriction a lieu en raison de l'API hyperscan. - -## multiMatchAnyIndex(botte de foin, \[motif1, modèle2, …, patternet\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} - -Le même que `multiMatchAny` mais retourne un index qui correspond à la botte de foin. - -## multiMatchAllIndices(botte de foin, \[motif1, modèle2, …, patternet\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} - -Le même que `multiMatchAny`, mais renvoie le tableau de tous les indices qui correspondent à la botte de foin dans n'importe quel ordre. - -## multiFuzzyMatchAny(botte de foin, distance, \[motif1, modèle2, …, patternet\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} - -Le même que `multiMatchAny`, mais renvoie 1 si un motif correspond à la botte de foin dans une constante [distance d'édition](https://en.wikipedia.org/wiki/Edit_distance). Cette fonction est également en mode expérimental et peut être extrêmement lente. Pour plus d'informations, voir [documentation hyperscan](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). - -## multiFuzzyMatchAnyIndex(botte de foin, distance, \[motif1, modèle2, …, patternet\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} - -Le même que `multiFuzzyMatchAny`, mais renvoie tout index qui correspond à la botte de foin à une distance d'édition constante. - -## multiFuzzyMatchAllIndices(botte de foin, distance, \[motif1, modèle2, …, patternet\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} - -Le même que `multiFuzzyMatchAny`, mais renvoie le tableau de tous les indices dans n'importe quel ordre qui correspond à la botte de foin à une distance d'édition constante. - -!!! note "Note" - `multiFuzzyMatch*` les fonctions ne prennent pas en charge les expressions régulières UTF-8, et ces expressions sont traitées comme des octets en raison de la restriction hyperscan. - -!!! note "Note" - Pour désactiver toutes les fonctions qui utilisent hyperscan, utilisez le réglage `SET allow_hyperscan = 0;`. - -## extrait(botte de foin, motif) {#extracthaystack-pattern} - -Extraits d'un fragment d'une chaîne à l'aide d'une expression régulière. Si ‘haystack’ ne correspond pas à l' ‘pattern’ regex, une chaîne vide est renvoyée. Si l'expression rationnelle ne contient pas de sous-modèles, elle prend le fragment qui correspond à l'expression rationnelle entière. Sinon, il prend le fragment qui correspond au premier sous-masque. - -## extractAll(botte de foin, motif) {#extractallhaystack-pattern} - -Extrait tous les fragments d'une chaîne à l'aide d'une expression régulière. Si ‘haystack’ ne correspond pas à l' ‘pattern’ regex, une chaîne vide est renvoyée. Renvoie un tableau de chaînes composé de toutes les correspondances à l'expression rationnelle. En général, le comportement est le même que le ‘extract’ fonction (il prend le premier sous-masque, ou l'expression entière s'il n'y a pas de sous-masque). - -## comme (botte de foin, motif), botte de foin comme opérateur de motif {#function-like} - -Vérifie si une chaîne correspond à une expression régulière simple. -L'expression régulière peut contenir les métasymboles `%` et `_`. - -`%` indique n'importe quelle quantité d'octets (y compris zéro caractère). - -`_` indique un octet. - -Utilisez la barre oblique inverse (`\`) pour échapper aux métasymboles. Voir la note sur l'échappement dans la description du ‘match’ fonction. - -Pour les expressions régulières comme `%needle%`, le code est plus optimale et fonctionne aussi vite que le `position` fonction. -Pour d'autres expressions régulières, le code est le même que pour la ‘match’ fonction. - -## notLike (botte de foin, motif), botte de foin pas comme opérateur de motif {#function-notlike} - -La même chose que ‘like’ mais négative. - -## ngramDistance(botte de foin, aiguille) {#ngramdistancehaystack-needle} - -Calcule la distance de 4 grammes entre `haystack` et `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` ou `haystack` est plus de 32Kb, jette une exception. Si une partie de la non-constante `haystack` ou `needle` les chaînes sont plus que 32Kb, la distance est toujours un. - -Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. - -## ngramSearch(botte de foin, aiguille) {#ngramsearchhaystack-needle} - -Même que `ngramDistance` mais calcule la différence non symétrique entre `needle` et `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` n-grammes. Le plus proche d'un, le plus probable `needle` est dans le `haystack`. Peut être utile pour la recherche de chaîne floue. - -Pour une recherche insensible à la casse ou/et au format UTF-8, utilisez les fonctions `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. - -!!! note "Note" - For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/fr/sql_reference/functions/type_conversion_functions.md b/docs/fr/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index 7bb1d7c4a47..00000000000 --- a/docs/fr/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,534 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 38 -toc_title: La Conversion De Type ---- - -# Fonctions De Conversion De Type {#type-conversion-functions} - -## Problèmes courants des Conversions numériques {#numeric-conversion-issues} - -Lorsque vous convertissez une valeur d'un type de données à un autre, vous devez vous rappeler que dans le cas courant, il s'agit d'une opération dangereuse qui peut entraîner une perte de données. Une perte de données peut se produire si vous essayez d'ajuster la valeur d'un type de données plus grand à un type de données plus petit, ou si vous convertissez des valeurs entre différents types de données. - -ClickHouse a le [même comportement que les programmes C++ ](https://en.cppreference.com/w/cpp/language/implicit_conversion). - -## toInt (8/16/32/64) {#toint8163264} - -Convertit une valeur d'entrée en [Int](../../sql_reference/data_types/int_uint.md) type de données. Cette fonction comprend: - -- `toInt8(expr)` — Results in the `Int8` type de données. -- `toInt16(expr)` — Results in the `Int16` type de données. -- `toInt32(expr)` — Results in the `Int32` type de données. -- `toInt64(expr)` — Results in the `Int64` type de données. - -**Paramètre** - -- `expr` — [Expression](../syntax.md#syntax-expressions) renvoyer un nombre ou une chaîne avec la représentation décimale d'un nombre. Les représentations binaires, octales et hexadécimales des nombres ne sont pas prises en charge. Les zéros principaux sont dépouillés. - -**Valeur renvoyée** - -Valeur entière dans le `Int8`, `Int16`, `Int32`, ou `Int64` type de données. - -Fonctions d'utilisation [l'arrondi vers zéro](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), ce qui signifie qu'ils tronquent des chiffres fractionnaires de nombres. - -Le comportement des fonctions pour le [NaN et Inf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) arguments est indéfini. Rappelez-vous sur [problèmes de conversion numérique](#numeric-conversion-issues), lorsque vous utilisez les fonctions. - -**Exemple** - -``` sql -SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) -``` - -``` text -┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ -│ -9223372036854775808 │ 32 │ 16 │ 8 │ -└──────────────────────┴─────────────┴───────────────┴─────────────┘ -``` - -## toInt (8/16/32/64)OrZero {#toint8163264orzero} - -Il prend un argument de type String et essaie de l'analyser en Int (8 \| 16 \| 32 \| 64). En cas d'échec, renvoie 0. - -**Exemple** - -``` sql -select toInt64OrZero('123123'), toInt8OrZero('123qwe123') -``` - -``` text -┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ -│ 123123 │ 0 │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toInt (8/16/32/64)OrNull {#toint8163264ornull} - -Il prend un argument de type String et essaie de l'analyser en Int (8 \| 16 \| 32 \| 64). En cas d'échec, renvoie NULL. - -**Exemple** - -``` sql -select toInt64OrNull('123123'), toInt8OrNull('123qwe123') -``` - -``` text -┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ -│ 123123 │ ᴺᵁᴸᴸ │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toUInt (8/16/32/64) {#touint8163264} - -Convertit une valeur d'entrée en [UInt](../../sql_reference/data_types/int_uint.md) type de données. Cette fonction comprend: - -- `toUInt8(expr)` — Results in the `UInt8` type de données. -- `toUInt16(expr)` — Results in the `UInt16` type de données. -- `toUInt32(expr)` — Results in the `UInt32` type de données. -- `toUInt64(expr)` — Results in the `UInt64` type de données. - -**Paramètre** - -- `expr` — [Expression](../syntax.md#syntax-expressions) renvoyer un nombre ou une chaîne avec la représentation décimale d'un nombre. Les représentations binaires, octales et hexadécimales des nombres ne sont pas prises en charge. Les zéros principaux sont dépouillés. - -**Valeur renvoyée** - -Valeur entière dans le `UInt8`, `UInt16`, `UInt32`, ou `UInt64` type de données. - -Fonctions d'utilisation [l'arrondi vers zéro](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), ce qui signifie qu'ils tronquent des chiffres fractionnaires de nombres. - -Le comportement des fonctions pour les agruments négatifs et pour le [NaN et Inf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) arguments est indéfini. Si vous passez une chaîne avec un nombre négatif, par exemple `'-32'`, ClickHouse soulève une exception. Rappelez-vous sur [problèmes de conversion numérique](#numeric-conversion-issues), lorsque vous utilisez les fonctions. - -**Exemple** - -``` sql -SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) -``` - -``` text -┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ -│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ -└─────────────────────┴───────────────┴────────────────┴──────────────┘ -``` - -## toUInt (8/16/32/64)OrZero {#touint8163264orzero} - -## toUInt (8/16/32/64)OrNull {#touint8163264ornull} - -## toFloat (32/64) {#tofloat3264} - -## toFloat (32/64)OrZero {#tofloat3264orzero} - -## toFloat (32/64) OrNull {#tofloat3264ornull} - -## jour {#todate} - -## toDateOrZero {#todateorzero} - -## toDateOrNull {#todateornull} - -## toDateTime {#todatetime} - -## toDateTimeOrZero {#todatetimeorzero} - -## toDateTimeOrNull {#todatetimeornull} - -## toDecimal (32/64/128) {#todecimal3264128} - -Convertir `value` à l' [Décimal](../../sql_reference/data_types/decimal.md) type de données avec précision de `S`. Le `value` peut être un nombre ou une chaîne. Le `S` (l'échelle) paramètre spécifie le nombre de décimales. - -- `toDecimal32(value, S)` -- `toDecimal64(value, S)` -- `toDecimal128(value, S)` - -## toDecimal (32/64/128) OrNull {#todecimal3264128ornull} - -Convertit une chaîne d'entrée en [Nullable (Décimal (P, S))](../../sql_reference/data_types/decimal.md) valeur de type de données. Cette famille de fonctions comprennent: - -- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` type de données. -- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` type de données. -- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` type de données. - -Ces fonctions devraient être utilisées à la place de `toDecimal*()` fonctions, si vous préférez obtenir un `NULL` la valeur au lieu d'une exception dans le cas d'une valeur d'entrée erreur d'analyse. - -**Paramètre** - -- `expr` — [Expression](../syntax.md#syntax-expressions), retourne une valeur dans l' [Chaîne](../../sql_reference/data_types/string.md) type de données. ClickHouse attend la représentation textuelle du nombre décimal. Exemple, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**Valeur renvoyée** - -Une valeur dans l' `Nullable(Decimal(P,S))` type de données. La valeur contient: - -- Numéro `S` décimales, si ClickHouse interprète la chaîne d'entrée comme un nombre. -- `NULL` si ClickHouse ne peut pas interpréter la chaîne d'entrée comme un nombre ou si le nombre d'entrée contient plus de `S` décimale. - -**Exemple** - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ -│ -1.11100 │ Nullable(Decimal(9, 5)) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ -│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toDecimal (32/64/128)OrZero {#todecimal3264128orzero} - -Convertit une valeur d'entrée en [Decimal(P,S)](../../sql_reference/data_types/decimal.md) type de données. Cette famille de fonctions comprennent: - -- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` type de données. -- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` type de données. -- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` type de données. - -Ces fonctions devraient être utilisées à la place de `toDecimal*()` fonctions, si vous préférez obtenir un `0` la valeur au lieu d'une exception dans le cas d'une valeur d'entrée erreur d'analyse. - -**Paramètre** - -- `expr` — [Expression](../syntax.md#syntax-expressions), retourne une valeur dans l' [Chaîne](../../sql_reference/data_types/string.md) type de données. ClickHouse attend la représentation textuelle du nombre décimal. Exemple, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**Valeur renvoyée** - -Une valeur dans l' `Nullable(Decimal(P,S))` type de données. La valeur contient: - -- Numéro `S` décimales, si ClickHouse interprète la chaîne d'entrée comme un nombre. -- 0 avec `S` décimales, si ClickHouse ne peut pas interpréter la chaîne d'entrée comme un nombre ou si le nombre d'entrée contient plus de `S` décimale. - -**Exemple** - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ -│ -1.11100 │ Decimal(9, 5) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ -│ 0.00 │ Decimal(9, 2) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toString {#tostring} - -Fonctions de conversion entre des nombres, des chaînes (mais pas des chaînes fixes), des dates et des dates avec des heures. -Toutes ces fonctions acceptent un argument. - -Lors de la conversion vers ou à partir d'une chaîne, la valeur est formatée ou analysée en utilisant les mêmes règles que pour le format TabSeparated (et presque tous les autres formats de texte). Si la chaîne ne peut pas être analysée, une exception est levée et la demande est annulée. - -Lors de la conversion de dates en nombres ou vice versa, la date correspond au nombre de jours depuis le début de L'époque Unix. -Lors de la conversion de dates avec des heures en nombres ou vice versa, la date avec l'heure correspond au nombre de secondes depuis le début de L'époque Unix. - -Les formats date et date-avec-heure pour les fonctions toDate/toDateTime sont définis comme suit: - -``` text -YYYY-MM-DD -YYYY-MM-DD hh:mm:ss -``` - -À titre d'exception, si vous convertissez des types numériques UInt32, Int32, UInt64 ou Int64 à Date, et si le nombre est supérieur ou égal à 65536, le nombre est interprété comme un horodatage Unix (et non comme le nombre de jours) et est arrondi à la date. Cela permet de prendre en charge l'occurrence commune de l'écriture ‘toDate(unix\_timestamp)’, qui autrement serait une erreur et nécessiterait d'écrire le plus lourd ‘toDate(toDateTime(unix\_timestamp))’. - -La Conversion entre une date et une date avec l'heure est effectuée de manière naturelle: en ajoutant une heure nulle ou en supprimant l'heure. - -La Conversion entre types numériques utilise les mêmes règles que les affectations entre différents types numériques en C++. - -De plus, la fonction ToString de L'argument DateTime peut prendre un deuxième argument de chaîne contenant le nom du fuseau horaire. Exemple: `Asia/Yekaterinburg` Dans ce cas, l'heure est formatée en fonction du fuseau horaire spécifié. - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - -``` text -┌───────────now_local─┬─now_yekat───────────┐ -│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ -└─────────────────────┴─────────────────────┘ -``` - -Voir aussi l' `toUnixTimestamp` fonction. - -## toFixedString (s, N) {#tofixedstrings-n} - -Convertit un argument de type String en un type FixedString (N) (une chaîne de longueur fixe N). N doit être une constante. -Si la chaîne a moins d'octets que N, elle est passée avec des octets null à droite. Si la chaîne a plus d'octets que N, une exception est levée. - -## toStringCutToZero(s) {#tostringcuttozeros} - -Accepte un argument String ou FixedString. Renvoie la chaîne avec le contenu tronqué au premier octet zéro trouvé. - -Exemple: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s─────────────┬─s_cut─┐ -│ foo\0\0\0\0\0 │ foo │ -└───────────────┴───────┘ -``` - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s──────────┬─s_cut─┐ -│ foo\0bar\0 │ foo │ -└────────────┴───────┘ -``` - -## reinterpretAsUInt (8/16/32/64) {#reinterpretasuint8163264} - -## reinterpretAsInt (8/16/32/64) {#reinterpretasint8163264} - -## reinterpretAsFloat (32/64) {#reinterpretasfloat3264} - -## réinterprétasdate {#reinterpretasdate} - -## reinterpretAsDateTime {#reinterpretasdatetime} - -Ces fonctions acceptent une chaîne et interprètent les octets placés au début de la chaîne comme un nombre dans l'ordre de l'hôte (little endian). Si la chaîne n'est pas assez longue, les fonctions fonctionnent comme si la chaîne était remplie avec le nombre nécessaire d'octets nuls. Si la chaîne est plus longue que nécessaire, les octets supplémentaires sont ignorés. Une date est interprétée comme le nombre de jours depuis le début de l'Époque Unix, et une date avec le temps, est interprété comme le nombre de secondes écoulées depuis le début de l'Époque Unix. - -## reinterpretAsString {#type_conversion_functions-reinterpretAsString} - -Cette fonction accepte un nombre ou une date ou une date avec l'heure, et renvoie une chaîne contenant des octets représentant la valeur correspondante dans l'ordre de l'hôte (little endian). Les octets nuls sont supprimés de la fin. Par exemple, une valeur de type uint32 de 255 est une chaîne longue d'un octet. - -## reinterpretAsFixedString {#reinterpretasfixedstring} - -Cette fonction accepte un nombre ou une date ou une date avec l'heure, et renvoie une chaîne fixe contenant des octets représentant la valeur correspondante dans l'ordre de l'hôte (little endian). Les octets nuls sont supprimés de la fin. Par exemple, une valeur de type uint32 de 255 est une chaîne fixe longue d'un octet. - -## CAST (x, t) {#type_conversion_function-cast} - -Convertir ‘x’ à l' ‘t’ type de données. La syntaxe CAST (X comme t) est également prise en charge. - -Exemple: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - -``` text -┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ -└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ -``` - -La Conversion en FixedString (N) ne fonctionne que pour les arguments de type String ou FixedString (N). - -Type conversion en [Nullable](../../sql_reference/data_types/nullable.md) et le dos est pris en charge. Exemple: - -``` sql -SELECT toTypeName(x) FROM t_null -``` - -``` text -┌─toTypeName(x)─┐ -│ Int8 │ -│ Int8 │ -└───────────────┘ -``` - -``` sql -SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null -``` - -``` text -┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ -│ Nullable(UInt16) │ -│ Nullable(UInt16) │ -└─────────────────────────────────────────┘ -``` - -## toInterval (année / trimestre / Mois / Semaine / Jour / Heure / Minute / Seconde) {#function-tointerval} - -Convertit un argument de type Number en [Intervalle](../../sql_reference/data_types/special_data_types/interval.md) type de données. - -**Syntaxe** - -``` sql -toIntervalSecond(number) -toIntervalMinute(number) -toIntervalHour(number) -toIntervalDay(number) -toIntervalWeek(number) -toIntervalMonth(number) -toIntervalQuarter(number) -toIntervalYear(number) -``` - -**Paramètre** - -- `number` — Duration of interval. Positive integer number. - -**Valeurs renvoyées** - -- La valeur de `Interval` type de données. - -**Exemple** - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - -``` text -┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ -│ 2019-01-08 │ 2019-01-08 │ -└───────────────────────────┴──────────────────────────────┘ -``` - -## parseDateTimeBestEffort {#parsedatetimebesteffort} - -Convertit une date et une heure dans le [Chaîne](../../sql_reference/data_types/string.md) la représentation de [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) type de données. - -La fonction d'analyse [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC 1123 - 5.2.14 RFC-822 date et heure Spécification](https://tools.ietf.org/html/rfc1123#page-55), ClickHouse et d'autres formats de date et d'heure. - -**Syntaxe** - -``` sql -parseDateTimeBestEffort(time_string [, time_zone]); -``` - -**Paramètre** - -- `time_string` — String containing a date and time to convert. [Chaîne](../../sql_reference/data_types/string.md). -- `time_zone` — Time zone. The function parses `time_string` selon le fuseau horaire. [Chaîne](../../sql_reference/data_types/string.md). - -**Formats non standard pris en charge** - -- Une chaîne contenant 9..10 chiffres [le timestamp unix](https://en.wikipedia.org/wiki/Unix_time). -- Une chaîne avec une date et une heure composant: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, etc. -- Une chaîne avec une date, mais pas de composant de temps: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` etc. -- Une chaîne avec un jour et une heure: `DD`, `DD hh`, `DD hh:mm`. Dans ce cas `YYYY-MM` sont substitués comme suit `2000-01`. -- Une chaîne qui inclut la date et l'heure ainsi que des informations de décalage de fuseau horaire: `YYYY-MM-DD hh:mm:ss ±h:mm`, etc. Exemple, `2020-12-12 17:36:00 -5:00`. - -Pour tous les formats avec séparateur, la fonction analyse les noms de mois exprimés par leur nom complet ou par les trois premières lettres d'un nom de mois. Exemple: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. - -**Valeur renvoyée** - -- `time_string` converti à l' `DateTime` type de données. - -**Exemple** - -Requête: - -``` sql -SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') -AS parseDateTimeBestEffort; -``` - -Résultat: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2020-12-12 12:12:57 │ -└─────────────────────────┘ -``` - -Requête: - -``` sql -SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') -AS parseDateTimeBestEffort -``` - -Résultat: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-08-18 10:22:16 │ -└─────────────────────────┘ -``` - -Requête: - -``` sql -SELECT parseDateTimeBestEffort('1284101485') -AS parseDateTimeBestEffort -``` - -Résultat: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2015-07-07 12:04:41 │ -└─────────────────────────┘ -``` - -Requête: - -``` sql -SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') -AS parseDateTimeBestEffort -``` - -Résultat: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-12-12 10:12:12 │ -└─────────────────────────┘ -``` - -Requête: - -``` sql -SELECT parseDateTimeBestEffort('10 20:19') -``` - -Résultat: - -``` text -┌─parseDateTimeBestEffort('10 20:19')─┐ -│ 2000-01-10 20:19:00 │ -└─────────────────────────────────────┘ -``` - -**Voir Aussi** - -- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) -- [RFC 1123](https://tools.ietf.org/html/rfc1123) -- [jour](#todate) -- [toDateTime](#todatetime) - -## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} - -De même que pour [parseDateTimeBestEffort](#parsedatetimebesteffort) sauf qu'il renvoie null lorsqu'il rencontre un format de date qui ne peut pas être traité. - -## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} - -De même que pour [parseDateTimeBestEffort](#parsedatetimebesteffort) sauf qu'il renvoie une date zéro ou une date zéro lorsqu'il rencontre un format de date qui ne peut pas être traité. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/fr/sql_reference/functions/url_functions.md b/docs/fr/sql_reference/functions/url_functions.md deleted file mode 100644 index f8d7ef4ccd4..00000000000 --- a/docs/fr/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 54 -toc_title: Travailler avec des URL ---- - -# Fonctions pour travailler avec des URL {#functions-for-working-with-urls} - -Toutes ces fonctions ne suivent pas la RFC. Ils sont simplifiés au maximum pour améliorer les performances. - -## Fonctions qui extraient des parties d'une URL {#functions-that-extract-parts-of-a-url} - -Si la partie pertinente n'est pas présente dans une URL, une chaîne vide est renvoyée. - -### protocole {#protocol} - -Extrait le protocole d'une URL. - -Examples of typical returned values: http, https, ftp, mailto, tel, magnet… - -### domaine {#domain} - -Extrait le nom d'hôte d'une URL. - -``` sql -domain(url) -``` - -**Paramètre** - -- `url` — URL. Type: [Chaîne](../../sql_reference/data_types/string.md). - -L'URL peut être spécifiée avec ou sans schéma. Exemple: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -Pour ces exemples, le `domain` la fonction renvoie les résultats suivants: - -``` text -some.svn-hosting.com -some.svn-hosting.com -yandex.com -``` - -**Valeurs renvoyées** - -- Nom d'hôte. Si ClickHouse peut analyser la chaîne d'entrée en tant QU'URL. -- Chaîne vide. Si ClickHouse ne peut pas analyser la chaîne d'entrée en tant QU'URL. - -Type: `String`. - -**Exemple** - -``` sql -SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ -│ some.svn-hosting.com │ -└────────────────────────────────────────────────────────┘ -``` - -### domainWithoutWWW {#domainwithoutwww} - -Renvoie le domaine et ne supprime pas plus d'un ‘www.’ dès le début de celui-ci, si présent. - -### topLevelDomain {#topleveldomain} - -Extrait le domaine de premier niveau d'une URL. - -``` sql -topLevelDomain(url) -``` - -**Paramètre** - -- `url` — URL. Type: [Chaîne](../../sql_reference/data_types/string.md). - -L'URL peut être spécifiée avec ou sans schéma. Exemple: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -**Valeurs renvoyées** - -- Nom de domaine. Si ClickHouse peut analyser la chaîne d'entrée en tant QU'URL. -- Chaîne vide. Si ClickHouse ne peut pas analyser la chaîne d'entrée en tant QU'URL. - -Type: `String`. - -**Exemple** - -``` sql -SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ -│ com │ -└────────────────────────────────────────────────────────────────────┘ -``` - -### firstSignificantSubdomain {#firstsignificantsubdomain} - -Renvoie la “first significant subdomain”. C'est un concept non standard spécifique à Yandex.Metrica. Le premier sous-domaine significatif est un domaine de deuxième niveau s'il est ‘com’, ‘net’, ‘org’, ou ‘co’. Sinon, il est un domaine de troisième niveau. Exemple, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. La liste des “insignificant” les domaines de deuxième niveau et d'autres détails de mise en œuvre peuvent changer à l'avenir. - -### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} - -Renvoie la partie du domaine qui inclut les sous-domaines de premier niveau “first significant subdomain” (voir l'explication ci-dessus). - -Exemple, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### chemin {#path} - -Retourne le chemin d'accès. Exemple: `/top/news.html` Le chemin n'inclut pas la chaîne de requête. - -### pathFull {#pathfull} - -La même chose que ci-dessus, mais y compris la chaîne de requête et le fragment. Exemple: / top / nouvelles.le html?page = 2 \# commentaires - -### queryString {#querystring} - -Retourne la chaîne de requête. Exemple: page = 1 & lr=213. query-string n'inclut pas le point d'interrogation initial, ainsi que \# et tout ce qui suit \#. - -### fragment {#fragment} - -Renvoie l'identificateur de fragment. fragment n'inclut pas le symbole de hachage initial. - -### queryStringAndFragment {#querystringandfragment} - -Renvoie la chaîne de requête et l'Identificateur de fragment. Exemple: page = 1 \# 29390. - -### extractURLParameter (URL, nom) {#extracturlparameterurl-name} - -Renvoie la valeur de la ‘name’ paramètre dans l'URL, le cas échéant. Sinon, une chaîne vide. S'il y a beaucoup de paramètres avec ce nom, il renvoie la première occurrence. Cette fonction fonctionne en supposant que le nom du paramètre est codé dans L'URL exactement de la même manière que dans l'argument passé. - -### extractURLParameters (URL) {#extracturlparametersurl} - -Renvoie un tableau de chaînes name = value correspondant aux paramètres D'URL. Les valeurs ne sont en aucun cas décodées. - -### extractURLParameterNames (URL) {#extracturlparameternamesurl} - -Retourne un tableau de chaînes de noms correspondant aux noms des paramètres d'URL. Les valeurs ne sont en aucun cas décodées. - -### URLHierarchy (URL) {#urlhierarchyurl} - -Retourne un tableau contenant L'URL, tronquée à la fin par les symboles /,? dans le chemin et la chaîne de requête. Les caractères séparateurs consécutifs sont comptés comme un. La coupe est faite dans la position après tous les caractères de séparation consécutifs. - -### URLPathHierarchy (URL) {#urlpathhierarchyurl} - -La même chose que ci-dessus, mais sans le protocole et l'hôte dans le résultat. Le / les élément (racine) n'est pas inclus. Exemple: la fonction est utilisée pour implémenter l'arborescence des rapports de L'URL dans Yandex. Métrique. - -``` text -URLPathHierarchy('https://example.com/browse/CONV-6788') = -[ - '/browse/', - '/browse/CONV-6788' -] -``` - -### decodeURLComponent (URL) {#decodeurlcomponenturl} - -Renvoie L'URL décodée. -Exemple: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - -``` text -┌─DecodedURL─────────────────────────────┐ -│ http://127.0.0.1:8123/?query=SELECT 1; │ -└────────────────────────────────────────┘ -``` - -## Fonctions qui suppriment une partie D'une URL. {#functions-that-remove-part-of-a-url} - -Si L'URL n'a rien de similaire, L'URL reste inchangée. - -### cutWWW {#cutwww} - -Supprime pas plus d'une ‘www.’ depuis le début du domaine de L'URL, s'il est présent. - -### cutQueryString {#cutquerystring} - -Supprime la chaîne de requête. Le point d'interrogation est également supprimé. - -### cutFragment {#cutfragment} - -Supprime l'identificateur de fragment. Le signe est également supprimé. - -### couperystringandfragment {#cutquerystringandfragment} - -Supprime la chaîne de requête et l'Identificateur de fragment. Le point d'interrogation et le signe numérique sont également supprimés. - -### cutURLParameter (URL, nom) {#cuturlparameterurl-name} - -Supprime le ‘name’ Paramètre URL, si présent. Cette fonction fonctionne en supposant que le nom du paramètre est codé dans L'URL exactement de la même manière que dans l'argument passé. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/fr/sql_reference/functions/uuid_functions.md b/docs/fr/sql_reference/functions/uuid_functions.md deleted file mode 100644 index 43363235b9e..00000000000 --- a/docs/fr/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 53 -toc_title: Travailler avec UUID ---- - -# Fonctions pour travailler avec UUID {#functions-for-working-with-uuid} - -Les fonctions pour travailler avec UUID sont listées ci-dessous. - -## generateUUIDv4 {#uuid-function-generate} - -Génère le [UUID](../../sql_reference/data_types/uuid.md) de [la version 4](https://tools.ietf.org/html/rfc4122#section-4.4). - -``` sql -generateUUIDv4() -``` - -**Valeur renvoyée** - -La valeur de type UUID. - -**Exemple d'utilisation** - -Cet exemple montre la création d'une table avec la colonne de type UUID et l'insertion d'une valeur dans la table. - -``` sql -CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -INSERT INTO t_uuid SELECT generateUUIDv4() - -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## toUUID (x) {#touuid-x} - -Convertit la valeur de type de chaîne en type UUID. - -``` sql -toUUID(String) -``` - -**Valeur renvoyée** - -La valeur de type UUID. - -**Exemple d'utilisation** - -``` sql -SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid -``` - -``` text -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## UUIDStringToNum {#uuidstringtonum} - -Accepte une chaîne contenant 36 caractères dans le format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, et le renvoie comme un ensemble d'octets dans un [FixedString (16)](../../sql_reference/data_types/fixedstring.md). - -``` sql -UUIDStringToNum(String) -``` - -**Valeur renvoyée** - -FixedString (16) - -**Exemples d'utilisation** - -``` sql -SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes -``` - -``` text -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## UUIDNumToString {#uuidnumtostring} - -Accepte un [FixedString (16)](../../sql_reference/data_types/fixedstring.md) valeur, et renvoie une chaîne contenant 36 caractères au format texte. - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**Valeur renvoyée** - -Chaîne. - -**Exemple d'utilisation** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid -``` - -``` text -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## Voir aussi {#see-also} - -- [dictGetUUID](ext_dict_functions.md#ext_dict_functions-other) - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/fr/sql_reference/functions/ym_dict_functions.md b/docs/fr/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index 378beb4f45b..00000000000 --- a/docs/fr/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 59 -toc_title: Travailler avec Yandex.Dictionnaires Metrica ---- - -# Fonctions pour travailler avec Yandex.Dictionnaires Metrica {#functions-for-working-with-yandex-metrica-dictionaries} - -Pour que les fonctions ci-dessous fonctionnent, la configuration du serveur doit spécifier les chemins et les adresses pour obtenir tous les Yandex.Dictionnaires Metrica. Les dictionnaires sont chargés au premier appel de l'une de ces fonctions. Si les listes de référence ne peuvent pas être chargées, une exception est levée. - -Pour plus d'informations sur la création de listes de références, consultez la section “Dictionaries”. - -## Plusieurs geobases {#multiple-geobases} - -ClickHouse soutient le travail avec plusieurs géobases alternatives (hiérarchies régionales) simultanément, afin de soutenir diverses perspectives sur les pays auxquels appartiennent certaines régions. - -Le ‘clickhouse-server’ config spécifie le fichier avec l'échelon régional::`/opt/geo/regions_hierarchy.txt` - -Outre ce fichier, il recherche également les fichiers à proximité qui ont le symbole \_ et tout suffixe ajouté au nom (avant l'extension de fichier). -Par exemple, il trouvera également le fichier `/opt/geo/regions_hierarchy_ua.txt` si présente. - -`ua` est appelée la clé du dictionnaire. Pour un dictionnaire sans suffixe, la clé est une chaîne vide. - -Tous les dictionnaires sont rechargés dans l'exécution (une fois toutes les secondes, comme défini dans le paramètre de configuration builtin\_dictionaries\_reload\_interval, ou une fois par heure par défaut). Cependant, la liste des dictionnaires disponibles est définie une fois, lorsque le serveur démarre. - -All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. -Exemple: - -``` sql -regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt -``` - -### regionToCity (id \[, geobase\]) {#regiontocityid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. - -### regionToArea (id \[, geobase\]) {#regiontoareaid-geobase} - -Convertit une région en une zone (tapez 5 dans la géobase). Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ -│ │ -│ Moscow and Moscow region │ -│ St. Petersburg and Leningrad region │ -│ Belgorod region │ -│ Ivanovsk region │ -│ Kaluga region │ -│ Kostroma region │ -│ Kursk region │ -│ Lipetsk region │ -│ Orlov region │ -│ Ryazan region │ -│ Smolensk region │ -│ Tambov region │ -│ Tver region │ -│ Tula region │ -└──────────────────────────────────────────────────────┘ -``` - -### regionToDistrict(id \[, geobase\]) {#regiontodistrictid-geobase} - -Convertit une région en district fédéral (type 4 dans la géobase). Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ -│ │ -│ Central federal district │ -│ Northwest federal district │ -│ South federal district │ -│ North Caucases federal district │ -│ Privolga federal district │ -│ Ural federal district │ -│ Siberian federal district │ -│ Far East federal district │ -│ Scotland │ -│ Faroe Islands │ -│ Flemish region │ -│ Brussels capital region │ -│ Wallonia │ -│ Federation of Bosnia and Herzegovina │ -└──────────────────────────────────────────────────────────┘ -``` - -### regionToCountry (id \[, geobase\]) {#regiontocountryid-geobase} - -Convertit une région en un pays. Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. -Exemple: `regionToCountry(toUInt32(213)) = 225` convertit Moscou (213) en Russie (225). - -### regionToContinent(id \[, géobase\]) {#regiontocontinentid-geobase} - -Convertit une région en continent. Dans tous les autres cas, cette fonction est la même que ‘regionToCity’. -Exemple: `regionToContinent(toUInt32(213)) = 10001` convertit Moscou (213) en Eurasie (10001). - -### regionToTopContinent (\#regiontotopcontinent) {#regiontotopcontinent-regiontotopcontinent} - -Trouve le continent le plus élevé dans la hiérarchie de la région. - -**Syntaxe** - -``` sql -regionToTopContinent(id[, geobase]); -``` - -**Paramètre** - -- `id` — Region ID from the Yandex geobase. [UInt32](../../sql_reference/data_types/int_uint.md). -- `geobase` — Dictionary key. See [Plusieurs Geobases](#multiple-geobases). [Chaîne](../../sql_reference/data_types/string.md). Facultatif. - -**Valeur renvoyée** - -- Identifiant du continent de haut niveau (ce dernier lorsque vous grimpez dans la hiérarchie des régions). -- 0, si il n'y a aucun. - -Type: `UInt32`. - -### regionToPopulation (id \[, geobase\]) {#regiontopopulationid-geobase} - -Obtient la population d'une région. -La population peut être enregistrée dans des fichiers avec la géobase. Voir la section “External dictionaries”. -Si la population n'est pas enregistrée pour la région, elle renvoie 0. -Dans la géobase Yandex, la population peut être enregistrée pour les régions enfants, mais pas pour les régions parentes. - -### regionIn(lhs, rhs \[, géobase\]) {#regioninlhs-rhs-geobase} - -Vérifie si un ‘lhs’ région appartient à une ‘rhs’ région. Renvoie un nombre UInt8 égal à 1 s'il appartient, Ou 0 s'il n'appartient pas. -The relationship is reflexive – any region also belongs to itself. - -### regionHierarchy (id \[, geobase\]) {#regionhierarchyid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. -Exemple: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### regionToName(id \[, lang\]) {#regiontonameid-lang} - -Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn't exist, an empty string is returned. - -`ua` et `uk` les deux signifient ukrainien. - -[Article Original](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/fr/sql_reference/index.md b/docs/fr/sql_reference/index.md deleted file mode 100644 index bd29a0328e9..00000000000 --- a/docs/fr/sql_reference/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: SQL Reference -toc_hidden: true -toc_priority: 28 -toc_title: "cach\xE9s" ---- - -# Référence SQL {#sql-reference} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md#query_language_queries_alter) -- [Autres types de requêtes](statements/misc.md) - -[Article Original](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/fr/sql_reference/operators.md b/docs/fr/sql_reference/operators.md deleted file mode 100644 index 42537917ba5..00000000000 --- a/docs/fr/sql_reference/operators.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 37 -toc_title: "Op\xE9rateur" ---- - -# Opérateur {#operators} - -Tous les opérateurs sont transformés en leurs fonctions correspondantes à l'étape d'analyse des requêtes en fonction de leur priorité et de leur associativité. -Les groupes d'opérateurs sont listés par ordre de priorité (plus il est élevé dans la liste, plus tôt l'opérateur est connecté à ses arguments). - -## Des Opérateurs D'Accès {#access-operators} - -`a[N]` – Access to an element of an array. The `arrayElement(a, N)` fonction. - -`a.N` – Access to a tuple element. The `tupleElement(a, N)` fonction. - -## Opérateur De Négation Numérique {#numeric-negation-operator} - -`-a` – The `negate (a)` fonction. - -## Opérateurs de Multiplication et de Division {#multiplication-and-division-operators} - -`a * b` – The `multiply (a, b)` fonction. - -`a / b` – The `divide(a, b)` fonction. - -`a % b` – The `modulo(a, b)` fonction. - -## Opérateurs d'Addition et de soustraction {#addition-and-subtraction-operators} - -`a + b` – The `plus(a, b)` fonction. - -`a - b` – The `minus(a, b)` fonction. - -## Opérateurs De Comparaison {#comparison-operators} - -`a = b` – The `equals(a, b)` fonction. - -`a == b` – The `equals(a, b)` fonction. - -`a != b` – The `notEquals(a, b)` fonction. - -`a <> b` – The `notEquals(a, b)` fonction. - -`a <= b` – The `lessOrEquals(a, b)` fonction. - -`a >= b` – The `greaterOrEquals(a, b)` fonction. - -`a < b` – The `less(a, b)` fonction. - -`a > b` – The `greater(a, b)` fonction. - -`a LIKE s` – The `like(a, b)` fonction. - -`a NOT LIKE s` – The `notLike(a, b)` fonction. - -`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. - -`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. - -## Opérateurs Pour Travailler Avec Des Ensembles De Données {#operators-for-working-with-data-sets} - -*Voir [Dans les opérateurs](statements/select.md#select-in-operators).* - -`a IN ...` – The `in(a, b)` fonction. - -`a NOT IN ...` – The `notIn(a, b)` fonction. - -`a GLOBAL IN ...` – The `globalIn(a, b)` fonction. - -`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` fonction. - -## Opérateurs pour travailler avec des Dates et des heures {#operators-datetime} - -### EXTRACT {#operator-extract} - -``` sql -EXTRACT(part FROM date); -``` - -Extrait une partie d'une date donnée. Par exemple, vous pouvez récupérer un mois à partir d'une date donnée, ou d'une seconde à partir d'un moment. - -Le `part` paramètre spécifie la partie de la date à récupérer. Les valeurs suivantes sont disponibles: - -- `DAY` — The day of the month. Possible values: 1–31. -- `MONTH` — The number of a month. Possible values: 1–12. -- `YEAR` — The year. -- `SECOND` — The second. Possible values: 0–59. -- `MINUTE` — The minute. Possible values: 0–59. -- `HOUR` — The hour. Possible values: 0–23. - -Le `part` le paramètre est insensible à la casse. - -Le `date` paramètre spécifie la date ou l'heure à traiter. Soit [Date](../sql_reference/data_types/date.md) ou [DateTime](../sql_reference/data_types/datetime.md) le type est pris en charge. - -Exemple: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -Dans l'exemple suivant, nous créons un tableau et de les insérer dans une valeur avec le `DateTime` type. - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -Vous pouvez voir plus d'exemples de [test](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -Crée un [Intervalle](../sql_reference/data_types/special_data_types/interval.md)- valeur de type qui doit être utilisée dans les opérations arithmétiques avec [Date](../sql_reference/data_types/date.md) et [DateTime](../sql_reference/data_types/datetime.md)-type de valeurs. - -Types d'intervalles: -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -!!! warning "Avertissement" - Les intervalles avec différents types ne peuvent pas être combinés. Vous ne pouvez pas utiliser des expressions comme `INTERVAL 4 DAY 1 HOUR`. Exprimer des intervalles en unités plus petites ou égales à la plus petite unité de l'intervalle, par exemple `INTERVAL 25 HOUR`. Vous pouvez utiliser des opérations conséquentes comme dans l'exemple ci-dessous. - -Exemple: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**Voir Aussi** - -- [Intervalle](../sql_reference/data_types/special_data_types/interval.md) type de données -- [toInterval](../sql_reference/functions/type_conversion_functions.md#function-tointerval) type fonctions de conversion - -## Opérateur De Négation Logique {#logical-negation-operator} - -`NOT a` – The `not(a)` fonction. - -## Logique ET de l'Opérateur {#logical-and-operator} - -`a AND b` – The`and(a, b)` fonction. - -## Logique ou opérateur {#logical-or-operator} - -`a OR b` – The `or(a, b)` fonction. - -## Opérateur Conditionnel {#conditional-operator} - -`a ? b : c` – The `if(a, b, c)` fonction. - -Note: - -L'opérateur conditionnel calcule les valeurs de b et c, puis vérifie si la condition a est remplie, puis renvoie la valeur correspondante. Si `b` ou `C` est un [arrayJoin()](../sql_reference/functions/array_join.md#functions_arrayjoin) fonction, chaque ligne sera répliquée indépendamment de la “a” condition. - -## Expression Conditionnelle {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -Si `x` est spécifié, alors `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. - -Si il n'y a pas de `ELSE c` dans l'expression, la valeur par défaut est `NULL`. - -Le `transform` la fonction ne fonctionne pas avec `NULL`. - -## Opérateur De Concaténation {#concatenation-operator} - -`s1 || s2` – The `concat(s1, s2) function.` - -## Opérateur De Création Lambda {#lambda-creation-operator} - -`x -> expr` – The `lambda(x, expr) function.` - -Les opérateurs suivants n'ont pas de priorité, puisqu'ils sont des parenthèses: - -## Opérateur De Création De Tableau {#array-creation-operator} - -`[x1, ...]` – The `array(x1, ...) function.` - -## Opérateur De Création De Tuple {#tuple-creation-operator} - -`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` - -## Associativité {#associativity} - -Tous les opérateurs binaires ont associativité gauche. Exemple, `1 + 2 + 3` est transformé à `plus(plus(1, 2), 3)`. -Parfois, cela ne fonctionne pas de la façon que vous attendez. Exemple, `SELECT 4 > 2 > 3` résultat sera 0. - -Pour l'efficacité, le `and` et `or` les fonctions acceptent n'importe quel nombre d'arguments. Les chaînes de `AND` et `OR` les opérateurs sont transformés en un seul appel de ces fonctions. - -## La Vérification De `NULL` {#checking-for-null} - -Clickhouse soutient le `IS NULL` et `IS NOT NULL` opérateur. - -### IS NULL {#operator-is-null} - -- Pour [Nullable](../sql_reference/data_types/nullable.md) type de valeurs, l' `IS NULL` opérateur retourne: - - `1` si la valeur est `NULL`. - - `0` autrement. -- Pour les autres valeurs, la `IS NULL` l'opérateur renvoie toujours `0`. - - - -``` sql -SELECT x+100 FROM t_null WHERE y IS NULL -``` - -``` text -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ -``` - -### IS NOT NULL {#is-not-null} - -- Pour [Nullable](../sql_reference/data_types/nullable.md) type de valeurs, l' `IS NOT NULL` opérateur retourne: - - `0` si la valeur est `NULL`. - - `1` autrement. -- Pour les autres valeurs, la `IS NOT NULL` l'opérateur renvoie toujours `1`. - - - -``` sql -SELECT * FROM t_null WHERE y IS NOT NULL -``` - -``` text -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/fr/sql_reference/statements/alter.md b/docs/fr/sql_reference/statements/alter.md deleted file mode 100644 index 0a1c93e2863..00000000000 --- a/docs/fr/sql_reference/statements/alter.md +++ /dev/null @@ -1,505 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -Le `ALTER` la requête est prise en charge uniquement pour `*MergeTree` des tables, ainsi que `Merge`et`Distributed`. La requête a plusieurs variantes. - -### Manipulations De Colonne {#column-manipulations} - -Modification de la structure de la table. - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -Dans la requête, spécifiez une liste d'une ou plusieurs actions séparées par des virgules. -Chaque action est une opération sur une colonne. - -Les actions suivantes sont prises en charge: - -- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. -- [DROP COLUMN](#alter_drop-column) — Deletes the column. -- [CLEAR COLUMN](#alter_clear-column) — Resets column values. -- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. -- [MODIFY COLUMN](#alter_modify-column) — Changes column's type, default expression and TTL. - -Ces actions sont décrites en détail ci-dessous. - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -Ajoute une nouvelle colonne à la table spécifiée `name`, `type`, [`codec`](create.md#codecs) et `default_expr` (voir la section [Expressions par défaut](create.md#create-default-values)). - -Si l' `IF NOT EXISTS` la clause est incluse, la requête ne retournera pas d'erreur si la colonne existe déjà. Si vous spécifiez `AFTER name_after` (le nom d'une autre colonne), la colonne est ajoutée après celle spécifiée dans la liste des colonnes de la table. Sinon, la colonne est ajoutée à la fin de la table. Notez qu'il n'existe aucun moyen d'ajouter une colonne au début d'un tableau. Pour une chaîne d'actions, `name_after` peut être le nom d'une colonne est ajoutée dans l'une des actions précédentes. - -L'ajout d'une colonne modifie simplement la structure de la table, sans effectuer d'actions avec des données. Les données n'apparaissent pas sur le disque après la `ALTER`. Si les données sont manquantes pour une colonne lors de la lecture de la table, elles sont remplies avec des valeurs par défaut (en exécutant l'expression par défaut s'il y en a une, ou en utilisant des zéros ou des chaînes vides). La colonne apparaît sur le disque après la fusion des parties de données (voir [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)). - -Cette approche nous permet de compléter le `ALTER` requête instantanément, sans augmenter le volume de données anciennes. - -Exemple: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -Supprime la colonne avec le nom `name`. Si l' `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d'erreur si la colonne n'existe pas. - -Supprime les données du système de fichiers. Comme cela supprime des fichiers entiers, la requête est terminée presque instantanément. - -Exemple: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -Réinitialise toutes les données dans une colonne pour une partition spécifiée. En savoir plus sur la définition du nom de la partition dans la section [Comment spécifier l'expression de partition](#alter-how-to-specify-part-expr). - -Si l' `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d'erreur si la colonne n'existe pas. - -Exemple: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'comment' -``` - -Ajoute un commentaire à la colonne. Si l' `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d'erreur si la colonne n'existe pas. - -Chaque colonne peut avoir un commentaire. Si un commentaire existe déjà pour la colonne, un nouveau commentaire remplace le précédent commentaire. - -Les commentaires sont stockés dans le `comment_expression` colonne renvoyée par le [DESCRIBE TABLE](misc.md#misc-describe-table) requête. - -Exemple: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -Cette requête modifie le `name` les propriétés de la colonne: - -- Type - -- Expression par défaut - -- TTL - - For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). - -Si l' `IF EXISTS` la clause est spécifiée, la requête ne retournera pas d'erreur si la colonne n'existe pas. - -Lors de la modification du type, les valeurs sont converties comme si [toType](../../sql_reference/functions/type_conversion_functions.md) les fonctions ont été appliquées. Si seule l'expression par défaut est modifiée, la requête ne fait rien de complexe et est terminée presque instantanément. - -Exemple: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. - -Il y a plusieurs étapes de traitement: - -- Préparation de (nouveaux) fichiers temporaires avec des données modifiées. -- Renommer les anciens fichiers. -- Renommer les (nouveaux) fichiers temporaires en anciens noms. -- Suppression des anciens fichiers. - -Seule la première étape prend du temps. Si il y a un échec à ce stade, les données ne sont pas modifiées. -En cas d'échec au cours d'une des étapes successives, les données peuvent être restaurées manuellement. L'exception est si les anciens fichiers ont été supprimés du système de fichiers mais que les données des nouveaux fichiers n'ont pas été écrites sur le disque et ont été perdues. - -Le `ALTER` la requête de modification des colonnes est répliquée. Les instructions sont enregistrées dans ZooKeeper, puis chaque réplique les applique. Tout `ALTER` les requêtes sont exécutées dans le même ordre. La requête attend que les actions appropriées soient terminées sur les autres répliques. Cependant, une requête pour modifier des colonnes dans une table répliquée peut être interrompue, et toutes les actions seront effectuées de manière asynchrone. - -#### Modifier les limites de la requête {#alter-query-limitations} - -Le `ALTER` query vous permet de créer et de supprimer des éléments distincts (colonnes) dans des structures de données imbriquées, mais pas des structures de données imbriquées entières. Pour ajouter une structure de données imbriquée, vous pouvez ajouter des colonnes avec un nom comme `name.nested_name` et le type `Array(T)`. Une structure de données imbriquée est équivalente à plusieurs colonnes de tableau avec un nom qui a le même préfixe avant le point. - -Il n'y a pas de support pour supprimer des colonnes dans la clé primaire ou la clé d'échantillonnage (colonnes qui sont utilisées dans le `ENGINE` expression). La modification du type des colonnes incluses dans la clé primaire n'est possible que si cette modification n'entraîne pas la modification des données (par exemple, vous êtes autorisé à ajouter des valeurs à une énumération ou à modifier un type de `DateTime` de `UInt32`). - -Si l' `ALTER` la requête n'est pas suffisante pour apporter les modifications de table dont vous avez besoin, vous pouvez créer une nouvelle table, y copier les données en utilisant le [INSERT SELECT](insert_into.md#insert_query_insert-select) requête, puis changer les tables en utilisant le [RENAME](misc.md#misc_operations-rename) requête et supprimer l'ancienne table. Vous pouvez utiliser l' [clickhouse-copieur](../../operations/utilities/clickhouse-copier.md) comme une alternative à la `INSERT SELECT` requête. - -Le `ALTER` query bloque toutes les lectures et écritures pour la table. En d'autres termes, si une longue `SELECT` est en cours d'exécution au moment de la `ALTER` requête, la `ALTER` la requête va attendre qu'elle se termine. Dans le même temps, toutes les nouvelles requêtes à la même table attendre que ce `ALTER` est en cours d'exécution. - -Pour les tables qui ne stockent pas les données elles-mêmes (telles que `Merge` et `Distributed`), `ALTER` change simplement la structure de la table, et ne change pas la structure des tables subordonnées. Par exemple, lors de L'exécution de ALTER pour un `Distributed` table, vous devrez également exécuter `ALTER` pour les tables sur tous les serveurs distants. - -### Manipulations Avec Des Expressions Clés {#manipulations-with-key-expressions} - -La commande suivante est prise en charge: - -``` sql -MODIFY ORDER BY new_expression -``` - -Cela ne fonctionne que pour les tables du [`MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) de la famille (y compris les -[répliqué](../../engines/table_engines/mergetree_family/replication.md) table). La commande change l' -[clé de tri](../../engines/table_engines/mergetree_family/mergetree.md) de la table -de `new_expression` (une expression ou un tuple d'expressions). Clé primaire reste le même. - -La commande est légère en ce sens qu'elle ne modifie que les métadonnées. Pour conserver la propriété cette partie de données -les lignes sont ordonnées par l'expression de clé de tri vous ne pouvez pas ajouter d'expressions contenant des colonnes existantes -à la clé de tri (seules les colonnes ajoutées par `ADD COLUMN` commande dans le même `ALTER` requête). - -### Manipulations Avec Des Indices De Saut De Données {#manipulations-with-data-skipping-indices} - -Cela ne fonctionne que pour les tables du [`*MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) de la famille (y compris les -[répliqué](../../engines/table_engines/mergetree_family/replication.md) table). Les opérations suivantes -sont disponibles: - -- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - Ajoute la description de l'index aux métadonnées des tables. - -- `ALTER TABLE [db].name DROP INDEX name` - Supprime la description de l'index des métadonnées des tables et supprime les fichiers d'index du disque. - -Ces commandes sont légères dans le sens où elles ne modifient que les métadonnées ou suppriment des fichiers. -En outre, ils sont répliqués (synchronisation des métadonnées des indices via ZooKeeper). - -### Manipulations Avec Contraintes {#manipulations-with-constraints} - -En voir plus sur [contraintes](create.md#constraints) - -Les contraintes peuvent être ajoutées ou supprimées à l'aide de la syntaxe suivante: - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -Les requêtes ajouteront ou supprimeront des métadonnées sur les contraintes de la table afin qu'elles soient traitées immédiatement. - -Contrainte de vérifier *ne sera pas exécuté* sur les données existantes si elle a été ajoutée. - -Toutes les modifications sur les tables répliquées sont diffusées sur ZooKeeper et seront donc appliquées sur d'autres répliques. - -### Manipulations avec des Partitions et des pièces {#alter_manipulations-with-partitions} - -Les opérations suivantes avec [partition](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) sont disponibles: - -- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` répertoire et de l'oublier. -- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. -- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` répertoire à la table. -- [REPLACE PARTITION](#alter_replace-partition) - Copie la partition de données d'une table à l'autre. -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. -- [REPLACE PARTITION](#alter_replace-partition) - Copie la partition de données d'une table à l'autre et la remplace. -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - déplace la partition de données d'une table à l'autre. -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - Rétablit la valeur d'une colonne spécifiée dans une partition. -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - Réinitialise l'index secondaire spécifié dans une partition. -- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. -- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. -- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. - - - -#### Détacher la PARTITION {\#alter\_detach-partition} {#detach-partition-alter-detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -Déplace toutes les données de la partition spécifiée vers `detached` répertoire. Le serveur oublie la partition de données détachée comme si elle n'existait pas. Le serveur ne connaîtra pas ces données tant que vous n'aurez pas [ATTACH](#alter_attach-partition) requête. - -Exemple: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -Lisez à propos de la définition de l'expression de partition dans une section [Comment spécifier l'expression de partition](#alter-how-to-specify-part-expr). - -Une fois la requête exécutée, vous pouvez faire ce que vous voulez avec les données du `detached` directory — delete it from the file system, or just leave it. - -This query is replicated – it moves the data to the `detached` répertoire sur toutes les répliques. Notez que vous ne pouvez exécuter cette requête que sur un réplica leader. Pour savoir si une réplique est un leader, effectuez le `SELECT` requête à l' [système.réplique](../../operations/system_tables.md#system_tables-replicas) table. Alternativement, il est plus facile de faire une `DETACH` requête sur toutes les répliques - toutes les répliques lancent une exception, à l'exception de la réplique leader. - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -Supprime la partition spécifiée de la table. Cette requête marque la partition comme inactive et supprime complètement les données, environ en 10 minutes. - -Lisez à propos de la définition de l'expression de partition dans une section [Comment spécifier l'expression de partition](#alter-how-to-specify-part-expr). - -The query is replicated – it deletes data on all replicas. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -Supprime la partie spécifiée ou toutes les parties de la partition spécifiée de `detached`. -En savoir plus sur la définition de l'expression de partition dans une section [Comment spécifier l'expression de partition](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -Ajoute des données à la table à partir du `detached` répertoire. Il est possible d'ajouter des données dans une partition entière ou pour une partie distincte. Exemple: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -En savoir plus sur la définition de l'expression de partition dans une section [Comment spécifier l'expression de partition](#alter-how-to-specify-part-expr). - -Cette requête est répliquée. L'initiateur de réplica vérifie s'il y a des données dans le `detached` répertoire. Si des données existent, la requête vérifie son intégrité. Si tout est correct, la requête ajoute les données à la table. Tous les autres réplicas téléchargent les données de l'initiateur de réplica. - -Ainsi, vous pouvez mettre des données à la `detached` répertoire sur une réplique, et utilisez le `ALTER ... ATTACH` requête pour l'ajouter à la table sur tous les réplicas. - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -Cette requête copie la partition de données du `table1` de `table2` ajoute des données de gratuit dans la `table2`. Notez que les données ne seront pas supprimées de `table1`. - -Pour que la requête s'exécute correctement, les conditions suivantes doivent être remplies: - -- Les deux tables doivent avoir la même structure. -- Les deux tables doivent avoir la même clé de partition. - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -Cette requête copie la partition de données du `table1` de `table2` et remplace la partition existante dans le `table2`. Notez que les données ne seront pas supprimées de `table1`. - -Pour que la requête s'exécute correctement, les conditions suivantes doivent être remplies: - -- Les deux tables doivent avoir la même structure. -- Les deux tables doivent avoir la même clé de partition. - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -Cette requête déplace la partition de données du `table_source` de `table_dest` avec la suppression des données de `table_source`. - -Pour que la requête s'exécute correctement, les conditions suivantes doivent être remplies: - -- Les deux tables doivent avoir la même structure. -- Les deux tables doivent avoir la même clé de partition. -- Les deux tables doivent appartenir à la même famille de moteurs. (répliqué ou non répliqué) -- Les deux tables doivent avoir la même stratégie de stockage. - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -Réinitialise toutes les valeurs de la colonne spécifiée dans une partition. Si l' `DEFAULT` la clause a été déterminée lors de la création d'une table, cette requête définit la valeur de la colonne à une valeur par défaut spécifiée. - -Exemple: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -Cette requête crée une sauvegarde locale d'une partition spécifiée. Si l' `PARTITION` la clause est omise, la requête crée la sauvegarde de toutes les partitions à la fois. - -!!! note "Note" - L'ensemble du processus de sauvegarde est effectuée sans arrêter le serveur. - -Notez que pour les tables de style ancien, vous pouvez spécifier le préfixe du nom de la partition (par exemple, ‘2019’)- ensuite, la requête crée la sauvegarde pour toutes les partitions correspondantes. Lisez à propos de la définition de l'expression de partition dans une section [Comment spécifier l'expression de partition](#alter-how-to-specify-part-expr). - -Au moment de l'exécution, pour un instantané de données, la requête crée des liens rigides vers des données de table. Les liens sont placés dans le répertoire `/var/lib/clickhouse/shadow/N/...`, où: - -- `/var/lib/clickhouse/` est le répertoire de travail clickhouse spécifié dans la configuration. -- `N` est le numéro incrémental de la sauvegarde. - -!!! note "Note" - Si vous utilisez [un ensemble de disques pour le stockage des données dans une table](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes), le `shadow/N` le répertoire apparaît sur chaque disque, stockant les parties de données correspondant `PARTITION` expression. - -La même structure de répertoires est créée à l'intérieur de la sauvegarde qu'à l'intérieur `/var/lib/clickhouse/`. La requête effectue ‘chmod’ pour tous les fichiers, interdisant d'écrire en eux. - -Après avoir créé la sauvegarde, vous pouvez copier les données depuis `/var/lib/clickhouse/shadow/` sur le serveur distant, puis supprimez-le du serveur local. Notez que l' `ALTER t FREEZE PARTITION` la requête n'est pas répliqué. Il crée une sauvegarde locale uniquement sur le serveur local. - -La requête crée une sauvegarde presque instantanément (mais elle attend d'abord que les requêtes en cours à la table correspondante se terminent). - -`ALTER TABLE t FREEZE PARTITION` copie uniquement les données, pas les métadonnées de la table. Faire une sauvegarde des métadonnées de la table, copiez le fichier `/var/lib/clickhouse/metadata/database/table.sql` - -Pour restaurer des données à partir d'une sauvegarde, procédez comme suit: - -1. Créer la table si elle n'existe pas. Pour afficher la requête, utilisez la .fichier sql (remplacer `ATTACH` avec `CREATE`). -2. Copier les données de la `data/database/table/` répertoire à l'intérieur de la sauvegarde `/var/lib/clickhouse/data/database/table/detached/` répertoire. -3. Exécuter `ALTER TABLE t ATTACH PARTITION` les requêtes pour ajouter les données à une table. - -La restauration à partir d'une sauvegarde ne nécessite pas l'arrêt du serveur. - -Pour plus d'informations sur les sauvegardes et la restauration [La Sauvegarde Des Données](../../operations/backup.md) section. - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -La requête fonctionne de manière similaire à `CLEAR COLUMN` mais il remet un index au lieu d'une colonne de données. - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -Télécharge une partition depuis un autre serveur. Cette requête ne fonctionne que pour les tables répliquées. - -La requête effectue les opérations suivantes: - -1. Télécharge la partition à partir du fragment spécifié. Dans ‘path-in-zookeeper’ vous devez spécifier un chemin vers le fragment dans ZooKeeper. -2. Ensuite, la requête met les données téléchargées dans le `detached` répertoire de la `table_name` table. L'utilisation de la [ATTACH PARTITION\|PART](#alter_attach-partition) requête pour ajouter les données à la table. - -Exemple: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -Notez que: - -- Le `ALTER ... FETCH PARTITION` la requête n'est pas répliqué. Il place la partition à la `detached` répertoire sur le serveur local. -- Le `ALTER TABLE ... ATTACH` la requête est répliquée. Il ajoute les données à toutes les répliques. Les données sont ajoutées à l'une des répliques `detached` répertoire, et aux autres-des répliques voisines. - -Avant le téléchargement, le système vérifie si la partition existe et si la structure de la table correspond. La réplique la plus appropriée est sélectionnée automatiquement parmi les répliques saines. - -Bien que la requête soit appelée `ALTER TABLE`, il ne modifie pas la structure de la table et ne modifie pas immédiatement les données disponibles dans la table. - -#### MOVE PARTITION\|PART {#alter_move-partition} - -Déplace des partitions ou des parties de données vers un autre volume ou disque pour `MergeTree`-tables de moteur. Voir [Utilisation de plusieurs périphériques de bloc pour le stockage de données](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -Le `ALTER TABLE t MOVE` requête: - -- Non répliqué, car différentes répliques peuvent avoir des stratégies de stockage différentes. -- Renvoie une erreur si le disque ou le volume n'est pas configuré. Query renvoie également une erreur si les conditions de déplacement des données, spécifiées dans la stratégie de stockage, ne peuvent pas être appliquées. -- Peut renvoyer une erreur dans le cas, lorsque les données à déplacer sont déjà déplacées par un processus en arrière-plan, simultané `ALTER TABLE t MOVE` requête ou à la suite de la fusion de données d'arrière-plan. Un utilisateur ne doit effectuer aucune action supplémentaire dans ce cas. - -Exemple: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### Comment Définir L'Expression De La Partition {#alter-how-to-specify-part-expr} - -Vous pouvez spécifier l'expression de partition dans `ALTER ... PARTITION` requêtes de différentes manières: - -- Comme une valeur de l' `partition` la colonne de la `system.parts` table. Exemple, `ALTER TABLE visits DETACH PARTITION 201901`. -- Comme expression de la colonne de la table. Les constantes et les expressions constantes sont prises en charge. Exemple, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- À l'aide de l'ID de partition. Partition ID est un identifiant de chaîne de la partition (lisible par l'homme, si possible) qui est utilisé comme noms de partitions dans le système de fichiers et dans ZooKeeper. L'ID de partition doit être spécifié dans `PARTITION ID` clause, entre guillemets simples. Exemple, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- Dans le [ALTER ATTACH PART](#alter_attach-partition) et [DROP DETACHED PART](#alter_drop-detached) requête, pour spécifier le nom d'une partie, utilisez le littéral de chaîne avec une valeur de `name` la colonne de la [système.detached\_parts](../../operations/system_tables.md#system_tables-detached_parts) table. Exemple, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -L'utilisation de guillemets lors de la spécification de la partition dépend du type d'expression de partition. Par exemple, pour la `String` type, vous devez spécifier son nom entre guillemets (`'`). Pour l' `Date` et `Int*` types aucune citation n'est nécessaire. - -Pour les tables de style ancien, vous pouvez spécifier la partition sous forme de nombre `201901` ou une chaîne de caractères `'201901'`. La syntaxe des tables new-style est plus stricte avec les types (similaire à l'analyseur pour le format D'entrée des valeurs). - -Toutes les règles ci-dessus sont aussi valables pour la [OPTIMIZE](misc.md#misc_operations-optimize) requête. Si vous devez spécifier la seule partition lors de l'optimisation d'une table non partitionnée, définissez l'expression `PARTITION tuple()`. Exemple: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -Les exemples de `ALTER ... PARTITION` les requêtes sont démontrées dans les tests [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) et [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### Manipulations avec Table TTL {#manipulations-with-table-ttl} - -Vous pouvez modifier [tableau TTL](../../engines/table_engines/mergetree_family/mergetree.md#mergetree-table-ttl) avec une demande du formulaire suivant: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### Synchronicité des requêtes ALTER {#synchronicity-of-alter-queries} - -Pour les tables non réplicables, tous `ALTER` les requêtes sont exécutées simultanément. Pour les tables réplicables, la requête ajoute simplement des instructions pour les actions appropriées à `ZooKeeper` et les actions elles-mêmes sont effectuées dès que possible. Cependant, la requête peut attendre que ces actions soient terminées sur tous les réplicas. - -Pour `ALTER ... ATTACH|DETACH|DROP` les requêtes, vous pouvez utiliser le `replication_alter_partitions_sync` configuration pour configurer l'attente. -Valeurs possibles: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. - -### Mutation {#alter-mutations} - -Les Mutations sont une variante ALTER query qui permet de modifier ou de supprimer des lignes dans une table. Contrairement à la norme `UPDATE` et `DELETE` les requêtes qui sont destinées aux changements de données de point, les mutations sont destinées aux opérations lourdes qui modifient beaucoup de lignes dans une table. Pris en charge pour le `MergeTree` famille de moteurs de table, y compris les moteurs avec support de réplication. - -Les tables existantes sont prêtes pour les mutations telles quelles (aucune conversion nécessaire), mais après l'application de la première mutation à une table, son format de métadonnées devient incompatible avec les versions précédentes du serveur et il devient impossible de revenir à une version précédente. - -Commandes actuellement disponibles: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -Le `filter_expr` doit être de type `UInt8`. La requête supprime les lignes de la table pour lesquelles cette expression prend une valeur différente de zéro. - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -Le `filter_expr` doit être de type `UInt8`. Cette requête met à jour les valeurs des colonnes spécifiées en les valeurs des expressions correspondantes dans les lignes pour lesquelles `filter_expr` prend une valeur non nulle. Les valeurs sont converties en type de colonne à l'aide `CAST` opérateur. La mise à jour des colonnes utilisées dans le calcul de la clé primaire ou de la clé de partition n'est pas prise en charge. - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -La requête reconstruit l'index secondaire `name` dans la partition `partition_name`. - -Une requête peut contenir plusieurs commandes séparées par des virgules. - -Pour les tables \* MergeTree, les mutations s'exécutent en réécrivant des parties de données entières. Il n'y a pas d'atomicité-les pièces sont substituées aux pièces mutées dès qu'elles sont prêtes et un `SELECT` la requête qui a commencé à s'exécuter pendant une mutation verra les données des parties qui ont déjà été mutées ainsi que les données des parties qui n'ont pas encore été mutées. - -Les Mutations sont totalement ordonnées par leur ordre de création et sont appliquées à chaque partie dans cet ordre. Les Mutations sont également partiellement ordonnées avec des insertions - les données insérées dans la table avant la soumission de la mutation seront mutées et les données insérées après ne seront pas mutées. Notez que les mutations ne bloquent en aucune façon les INSERTs. - -Une requête de mutation retourne immédiatement après l'ajout de l'entrée de mutation (dans le cas de tables répliquées à ZooKeeper, pour les tables non compliquées - au système de fichiers). La mutation elle-même s'exécute de manière asynchrone en utilisant les paramètres du profil système. Pour suivre l'avancement des mutations vous pouvez utiliser la [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) table. Une mutation qui a été soumise avec succès continuera à s'exécuter même si les serveurs ClickHouse sont redémarrés. Il n'y a aucun moyen de faire reculer la mutation une fois qu'elle est soumise, mais si la mutation est bloquée pour une raison quelconque, elle peut être annulée avec le [`KILL MUTATION`](misc.md#kill-mutation) requête. - -Les entrées pour les mutations finies ne sont pas supprimées immédiatement (le nombre d'entrées conservées est déterminé par `finished_mutations_to_keep` le moteur de stockage de paramètre). Les anciennes entrées de mutation sont supprimées. - -[Article Original](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/fr/sql_reference/statements/create.md b/docs/fr/sql_reference/statements/create.md deleted file mode 100644 index 3cfb7a8bfa4..00000000000 --- a/docs/fr/sql_reference/statements/create.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 35 -toc_title: CREATE ---- - -# Créer des requêtes {#create-queries} - -## CREATE DATABASE {#query-language-create-database} - -Crée la base de données. - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] -``` - -### Clause {#clauses} - -- `IF NOT EXISTS` - - If the `db_name` database already exists, then ClickHouse doesn't create a new database and: - - - Doesn't throw an exception if clause is specified. - - Throws an exception if clause isn't specified. - -- `ON CLUSTER` - - ClickHouse creates the `db_name` database on all the servers of a specified cluster. - -- `ENGINE` - - - [MySQL](../engines/database_engines/mysql.md) - - Allows you to retrieve data from the remote MySQL server. - - By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). - -## CREATE TABLE {#create-table-query} - -Le `CREATE TABLE` la requête peut avoir plusieurs formes. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], - ... -) ENGINE = engine -``` - -Crée une table nommée ‘name’ dans le ‘db’ base de données ou la base de données actuelle si ‘db’ n'est pas définie, avec la structure spécifiée entre parenthèses et l' ‘engine’ moteur. -La structure de la table est une liste de descriptions de colonnes. Si les index sont pris en charge par le moteur, ils sont indiqués comme paramètres pour le moteur de table. - -Une description de colonne est `name type` dans le cas le plus simple. Exemple: `RegionID UInt32`. -Des Expressions peuvent également être définies pour les valeurs par défaut (voir ci-dessous). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -Crée une table avec la même structure qu'une autre table. Vous pouvez spécifier un moteur différent pour la table. Si le moteur n'est pas spécifié, le même moteur sera utilisé que pour la `db2.name2` table. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() -``` - -Crée une table avec la structure et les données renvoyées par [fonction de table](../table_functions/index.md). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -Crée une table avec une structure comme le résultat de l' `SELECT` une requête avec les ‘engine’ moteur, et le remplit avec des données de SELECT. - -Dans tous les cas, si `IF NOT EXISTS` est spécifié, la requête ne renvoie pas une erreur si la table existe déjà. Dans ce cas, la requête ne font rien. - -Il peut y avoir d'autres clauses après le `ENGINE` la clause dans la requête. Voir la documentation détaillée sur la façon de créer des tables dans les descriptions de [moteurs de table](../../engines/table_engines/index.md#table_engines). - -### Les Valeurs Par Défaut {#create-default-values} - -La description de colonne peut spécifier une expression pour une valeur par défaut, de l'une des manières suivantes:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. -Exemple: `URLDomain String DEFAULT domain(URL)`. - -Si une expression pour la valeur par défaut n'est pas définie, les valeurs par défaut seront définies sur zéros pour les nombres, chaînes vides pour les chaînes, tableaux vides pour les tableaux et `0000-00-00` pour les dates ou `0000-00-00 00:00:00` pour les dates avec le temps. Les valeurs NULL ne sont pas prises en charge. - -Si l'expression par défaut est définie, le type de colonne est facultatif. S'il n'y a pas de type explicitement défini, le type d'expression par défaut est utilisé. Exemple: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ type sera utilisé pour la ‘EventDate’ colonne. - -Si le type de données et l'expression par défaut sont définis explicitement, cette expression sera convertie au type spécifié à l'aide des fonctions de conversion de type. Exemple: `Hits UInt32 DEFAULT 0` signifie la même chose que `Hits UInt32 DEFAULT toUInt32(0)`. - -Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don't contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. - -`DEFAULT expr` - -Valeur par défaut normale. Si la requête INSERT ne spécifie pas la colonne correspondante, elle sera remplie en calculant l'expression correspondante. - -`MATERIALIZED expr` - -Expression matérialisée. Une telle colonne ne peut pas être spécifiée pour INSERT, car elle est toujours calculée. -Pour un INSERT sans Liste de colonnes, ces colonnes ne sont pas prises en compte. -De plus, cette colonne n'est pas substituée lors de l'utilisation d'un astérisque dans une requête SELECT. C'est pour préserver l'invariant que le dump obtenu en utilisant `SELECT *` peut être inséré dans la table en utilisant INSERT sans spécifier la liste des colonnes. - -`ALIAS expr` - -Synonyme. Une telle colonne n'est pas du tout stockée dans la table. -Ses valeurs ne peuvent pas être insérées dans une table et elles ne sont pas substituées lors de l'utilisation d'un astérisque dans une requête SELECT. -Il peut être utilisé dans SELECTs si l'alias est développé pendant l'analyse des requêtes. - -Lorsque vous utilisez la requête ALTER pour ajouter de nouvelles colonnes, les anciennes données de ces colonnes ne sont pas écrites. Au lieu de cela, lors de la lecture d'anciennes données qui n'ont pas de valeurs pour les nouvelles colonnes, les expressions sont calculées à la volée par défaut. Cependant, si l'exécution des expressions nécessite différentes colonnes qui ne sont pas indiquées dans la requête, ces colonnes seront en outre lues, mais uniquement pour les blocs de données qui en ont besoin. - -Si vous ajoutez une nouvelle colonne à une table mais modifiez ultérieurement son expression par défaut, les valeurs utilisées pour les anciennes données changeront (pour les données où les valeurs n'ont pas été stockées sur le disque). Notez que lors de l'exécution de fusions d'arrière-plan, les données des colonnes manquantes dans l'une des parties de fusion sont écrites dans la partie fusionnée. - -Il n'est pas possible de définir des valeurs par défaut pour les éléments dans les structures de données. - -### Contraintes {#constraints} - -Avec les descriptions de colonnes des contraintes peuvent être définies: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` pourrait par n'importe quelle expression booléenne. Si les contraintes sont définies pour la table, chacun d'eux sera vérifiée pour chaque ligne `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. - -L'ajout d'une grande quantité de contraintes peut affecter négativement les performances de big `INSERT` requête. - -### Expression TTL {#ttl-expression} - -Définit la durée de stockage des valeurs. Peut être spécifié uniquement pour les tables mergetree-family. Pour la description détaillée, voir [TTL pour les colonnes et les tableaux](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). - -### Codecs De Compression De Colonne {#codecs} - -Par défaut, ClickHouse applique le `lz4` méthode de compression. Pour `MergeTree`- famille de moteurs Vous pouvez modifier la méthode de compression par défaut dans le [compression](../../operations/server_configuration_parameters/settings.md#server-settings-compression) section d'une configuration de serveur. Vous pouvez également définir la méthode de compression pour chaque colonne `CREATE TABLE` requête. - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -Si un codec est spécifié, le codec par défaut ne s'applique pas. Les Codecs peuvent être combinés dans un pipeline, par exemple, `CODEC(Delta, ZSTD)`. Pour sélectionner la meilleure combinaison de codecs pour votre projet, passez des benchmarks similaires à ceux décrits dans Altinity [Nouveaux encodages pour améliorer L'efficacité du ClickHouse](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) article. - -!!! warning "Avertissement" - Vous ne pouvez pas décompresser les fichiers de base de données ClickHouse avec des utilitaires externes tels que `lz4`. Au lieu de cela, utilisez le spécial [clickhouse-compresseur](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) utilitaire. - -La Compression est prise en charge pour les moteurs de tableau suivants: - -- [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) famille. Prend en charge les codecs de compression de colonne et la sélection de la méthode de compression par défaut par [compression](../../operations/server_configuration_parameters/settings.md#server-settings-compression) paramètre. -- [Journal](../../engines/table_engines/log_family/log_family.md) famille. Utilise la `lz4` méthode de compression par défaut et prend en charge les codecs de compression de colonne. -- [Définir](../../engines/table_engines/special/set.md). Uniquement pris en charge la compression par défaut. -- [Rejoindre](../../engines/table_engines/special/join.md). Uniquement pris en charge la compression par défaut. - -ClickHouse prend en charge les codecs à usage commun et les codecs spécialisés. - -#### Codecs Spécialisés {#create-query-specialized-codecs} - -Ces codecs sont conçus pour rendre la compression plus efficace en utilisant des fonctionnalités spécifiques des données. Certains de ces codecs ne compressent pas les données eux-mêmes. Au lieu de cela, ils préparent les données pour un codec à usage commun, qui les compresse mieux que sans cette préparation. - -Spécialisé codecs: - -- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` sont utilisés pour stocker des valeurs delta, donc `delta_bytes` est la taille maximale des valeurs brutes. Possible `delta_bytes` valeurs: 1, 2, 4, 8. La valeur par défaut pour `delta_bytes` être `sizeof(type)` si égale à 1, 2, 4 ou 8. Dans tous les autres cas, c'est 1. -- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla: Une Base De Données De Séries Chronologiques Rapide, Évolutive Et En Mémoire](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla: Une Base De Données De Séries Chronologiques Rapide, Évolutive Et En Mémoire](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` et `DateTime`). À chaque étape de son algorithme, le codec prend un bloc de 64 valeurs, les place dans une matrice de 64x64 bits, le transpose, recadre les bits de valeurs inutilisés et renvoie le reste sous forme de séquence. Les bits inutilisés sont les bits, qui ne diffèrent pas entre les valeurs maximum et minimum dans la partie de données entière pour laquelle la compression est utilisée. - -`DoubleDelta` et `Gorilla` les codecs sont utilisés dans Gorilla TSDB comme composants de son algorithme de compression. L'approche Gorilla est efficace dans les scénarios où il y a une séquence de valeurs qui changent lentement avec leurs horodatages. Les horodatages sont effectivement compressés par le `DoubleDelta` codec, et les valeurs sont effectivement comprimé par le `Gorilla` codec. Par exemple, pour obtenir une table stockée efficacement, vous pouvez la créer dans la configuration suivante: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### Codecs À Usage Commun {#create-query-common-purpose-codecs} - -Codec: - -- `NONE` — No compression. -- `LZ4` — Lossless [algorithme de compression de données](https://github.com/lz4/lz4) utilisé par défaut. Applique la compression rapide LZ4. -- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` s'applique le niveau par défaut. Niveaux possibles: \[1, 12\]. Plage de niveau recommandée: \[4, 9\]. -- `ZSTD[(level)]` — [Algorithme de compression ZSTD](https://en.wikipedia.org/wiki/Zstandard) avec configurables `level`. Niveaux possibles: \[1, 22\]. Valeur par défaut: 1. - -Des niveaux de compression élevés sont utiles pour les scénarios asymétriques, comme compresser une fois, décompresser à plusieurs reprises. Des niveaux plus élevés signifient une meilleure compression et une utilisation plus élevée du processeur. - -## Les Tables Temporaires {#temporary-tables} - -Clickhouse prend en charge les tables temporaires qui ont les caractéristiques suivantes: - -- Les tables temporaires disparaissent à la fin de la session, y compris si la connexion est perdue. -- Une table temporaire utilise uniquement le moteur de mémoire. -- La base de données ne peut pas être spécifiée pour une table temporaire. Il est créé en dehors des bases de données. -- Impossible de créer une table temporaire avec une requête DDL distribuée sur tous les serveurs de cluster (en utilisant `ON CLUSTER`): ce tableau n'existe que dans la session en cours. -- Si une table temporaire a le même nom qu'une autre et qu'une requête spécifie le nom de la table sans spécifier la base de données, la table temporaire sera utilisée. -- Pour le traitement des requêtes distribuées, les tables temporaires utilisées dans une requête sont transmises à des serveurs distants. - -Pour créer une table temporaire, utilisez la syntaxe suivante: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -Dans la plupart des cas, les tables temporaires ne sont pas créées manuellement, mais lors de l'utilisation de données externes pour une requête ou pour `(GLOBAL) IN`. Pour plus d'informations, consultez les sections appropriées - -Il est possible d'utiliser des tables avec [Moteur = mémoire](../../engines/table_engines/special/memory.md) au lieu de tables temporaires. - -## Requêtes DDL distribuées (sur la clause CLUSTER) {#distributed-ddl-queries-on-cluster-clause} - -Le `CREATE`, `DROP`, `ALTER`, et `RENAME` les requêtes prennent en charge l'exécution distribuée sur un cluster. -Par exemple, la requête suivante crée la `all_hits` `Distributed` tableau sur chaque ordinateur hôte `cluster`: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -Pour exécuter ces requêtes correctement, chaque hôte doit avoir la même définition de cluster (pour simplifier la synchronisation des configs, vous pouvez utiliser des substitutions de ZooKeeper). Ils doivent également se connecter aux serveurs ZooKeeper. -La version locale de la requête sera finalement implémentée sur chaque hôte du cluster, même si certains hôtes ne sont actuellement pas disponibles. L'ordre d'exécution des requêtes au sein d'un seul hôte est garanti. - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -Crée une vue. Il existe deux types de vues: normale et matérialisée. - -Les vues normales ne stockent aucune donnée, mais effectuent simplement une lecture à partir d'une autre table. En d'autres termes, une vue normale n'est rien de plus qu'une requête enregistrée. Lors de la lecture à partir d'une vue, cette requête enregistrée est utilisée comme sous-requête dans la clause FROM. - -Par exemple, supposons que vous avez créé une vue: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -et écrit une requête: - -``` sql -SELECT a, b, c FROM view -``` - -Cette requête est entièrement équivalente à l'utilisation de la sous requête: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -Les vues matérialisées stockent les données transformées par la requête SELECT correspondante. - -Lors de la création d'une vue matérialisée sans `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. - -Lors de la création d'une vue matérialisée avec `TO [db].[table]` vous ne devez pas utiliser `POPULATE`. - -Une vue matérialisée est agencée comme suit: lors de l'insertion de données dans la table spécifiée dans SELECT, une partie des données insérées est convertie par cette requête SELECT, et le résultat est inséré dans la vue. - -Si vous spécifiez POPULATE, les données de table existantes sont insérées dans la vue lors de sa création, comme si `CREATE TABLE ... AS SELECT ...` . Sinon, la requête ne contient que les données insérées dans la table après la création de la vue. Nous ne recommandons pas D'utiliser POPULATE, car les données insérées dans la table lors de la création de la vue ne seront pas insérées dedans. - -A `SELECT` la requête peut contenir `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` est définie, les données sont agrégées lors de l'insertion, mais uniquement dans un seul paquet de données insérées. Les données ne seront pas agrégées davantage. L'exception concerne l'utilisation d'un moteur qui effectue indépendamment l'agrégation de données, par exemple `SummingMergeTree`. - -L'exécution de `ALTER` les requêtes sur les vues matérialisées n'ont pas été complètement développées, elles pourraient donc être gênantes. Si la vue matérialisée utilise la construction `TO [db.]name` vous pouvez `DETACH` la vue, exécutez `ALTER` pour la table cible, puis `ATTACH` précédemment détaché (`DETACH`) vue. - -Les vues ressemblent aux tables normales. Par exemple, ils sont répertoriés dans le résultat de la `SHOW TABLES` requête. - -Il n'y a pas de requête séparée pour supprimer des vues. Pour supprimer une vue, utilisez `DROP TABLE`. - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` - -Crée [externe dictionnaire](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) avec le [structure](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md), [source](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md), [disposition](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) et [vie](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md). - -Structure de dictionnaire externe se compose d'attributs. Les attributs du dictionnaire sont spécifiés de la même manière que les colonnes du tableau. La seule propriété d'attribut requise est son type, toutes les autres propriétés peuvent avoir des valeurs par défaut. - -Selon le dictionnaire [disposition](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) un ou plusieurs attributs peuvent être spécifiés comme les clés de dictionnaire. - -Pour plus d'informations, voir [Dictionnaires Externes](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) section. - -[Article Original](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/fr/sql_reference/statements/insert_into.md b/docs/fr/sql_reference/statements/insert_into.md deleted file mode 100644 index 621d543d577..00000000000 --- a/docs/fr/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 34 -toc_title: INSERT INTO ---- - -## INSERT {#insert} - -L'ajout de données. - -Format de requête de base: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -La requête peut spécifier une liste de colonnes à insérer `[(c1, c2, c3)]`. Dans ce cas, le reste des colonnes sont remplis avec: - -- Les valeurs calculées à partir `DEFAULT` expressions spécifiées dans la définition de la table. -- Zéros et chaînes vides, si `DEFAULT` les expressions ne sont pas définies. - -Si [strict\_insert\_defaults=1](../../operations/settings/settings.md), les colonnes qui n'ont pas `DEFAULT` défini doit être répertorié dans la requête. - -Les données peuvent être transmises à L'INSERT dans n'importe quel [format](../../interfaces/formats.md#formats) soutenu par ClickHouse. Le format doit être spécifié explicitement dans la requête: - -``` sql -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: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -ClickHouse supprime tous les espaces et un saut de ligne (s'il y en a un) avant les données. Lors de la formation d'une requête, nous recommandons de placer les données sur une nouvelle ligne après les opérateurs de requête (ceci est important si les données commencent par des espaces). - -Exemple: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -Vous pouvez insérer des données séparément de la requête à l'aide du client de ligne de commande ou de L'interface HTTP. Pour plus d'informations, consultez la section “[Interface](../../interfaces/index.md#interfaces)”. - -### Contraintes {#constraints} - -Si la table a [contraintes](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. - -### Insertion Des Résultats De `SELECT` {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -Les colonnes sont mappées en fonction de leur position dans la clause SELECT. Cependant, leurs noms dans L'expression SELECT et la table pour INSERT peuvent différer. Si nécessaire, la coulée de type est effectuée. - -Aucun des formats de données à l'exception des Valeurs permettent de définir des valeurs d'expressions telles que `now()`, `1 + 2` et ainsi de suite. Le format des valeurs permet une utilisation limitée des expressions, mais ce n'est pas recommandé, car dans ce cas, un code inefficace est utilisé pour leur exécution. - -Les autres requêtes de modification des parties de données ne sont pas prises en charge: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. -Cependant, vous pouvez supprimer les anciennes données en utilisant `ALTER TABLE ... DROP PARTITION`. - -`FORMAT` la clause doit être spécifié à la fin de la requête si `SELECT` la clause contient la fonction de table [entrée()](../table_functions/input.md). - -### Considérations De Performance {#performance-considerations} - -`INSERT` trie les données d'entrée par la clé primaire et les divise en partitions par une clé de partition. Si vous insérez des données dans plusieurs partitions à la fois, cela peut réduire considérablement les performances de l' `INSERT` requête. Pour éviter cela: - -- Ajoutez des données en lots assez importants, tels que 100 000 lignes à la fois. -- Groupez les données par une clé de partition avant de les télécharger sur ClickHouse. - -Les performances ne diminueront pas si: - -- Les données sont ajoutées en temps réel. -- Vous téléchargez des données qui sont généralement triées par heure. - -[Article Original](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/fr/sql_reference/statements/misc.md b/docs/fr/sql_reference/statements/misc.md deleted file mode 100644 index 4dfc42372a1..00000000000 --- a/docs/fr/sql_reference/statements/misc.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 39 -toc_title: Autre ---- - -# Diverses Requêtes {#miscellaneous-queries} - -## ATTACH {#attach} - -Cette requête est exactement la même que `CREATE`, mais - -- Au lieu de la parole `CREATE` il utilise le mot `ATTACH`. -- La requête ne crée pas de données sur le disque, mais suppose que les données sont déjà aux endroits appropriés, et ajoute simplement des informations sur la table au serveur. - Après avoir exécuté une requête ATTACH, le serveur connaîtra l'existence de la table. - -Si la table a été précédemment détachée (`DETACH`), ce qui signifie que sa structure est connue, vous pouvez utiliser un raccourci sans définir la structure. - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Cette requête est utilisée lors du démarrage du serveur. Le serveur stocke les métadonnées de la table sous forme de fichiers avec `ATTACH` requêtes, qu'il exécute simplement au lancement (à l'exception des tables système, qui sont explicitement créées sur le serveur). - -## CHECK TABLE {#check-table} - -Vérifie si les données de la table sont corrompues. - -``` sql -CHECK TABLE [db.]name -``` - -Le `CHECK TABLE` requête compare réelle des tailles de fichier avec les valeurs attendues qui sont stockés sur le serveur. Si le fichier tailles ne correspondent pas aux valeurs stockées, cela signifie que les données sont endommagées. Cela peut être causé, par exemple, par un plantage du système lors de l'exécution de la requête. - -La réponse de la requête contient `result` colonne avec une seule ligne. La ligne a une valeur de -[Booléen](../../sql_reference/data_types/boolean.md) type: - -- 0 - les données de la table sont corrompues. -- 1 - les données maintiennent l'intégrité. - -Le `CHECK TABLE` query prend en charge les moteurs de table suivants: - -- [Journal](../../engines/table_engines/log_family/log.md) -- [TinyLog](../../engines/table_engines/log_family/tinylog.md) -- [StripeLog](../../engines/table_engines/log_family/stripelog.md) -- [Famille MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) - -Effectué sur les tables avec un autre moteur de table provoque une exception. - -Les moteurs de la `*Log` la famille ne fournit pas de récupération automatique des données en cas d'échec. L'utilisation de la `CHECK TABLE` requête pour suivre la perte de données en temps opportun. - -Pour `MergeTree` moteurs de la famille, le `CHECK TABLE` query affiche un État de vérification pour chaque partie de données individuelle d'une table sur le serveur local. - -**Si les données sont corrompues** - -Si la table est corrompue, vous pouvez copier les données non corrompues dans une autre table. Pour ce faire: - -1. Créez une nouvelle table avec la même structure que la table endommagée. Pour ce faire exécutez la requête `CREATE TABLE AS `. -2. Définir le [max\_threads](../../operations/settings/settings.md#settings-max_threads) la valeur 1 pour traiter la requête suivante dans un seul thread. Pour ce faire, exécutez la requête `SET max_threads = 1`. -3. Exécuter la requête `INSERT INTO SELECT * FROM `. Cette demande copie les données non corrompues de la table endommagée vers une autre table. Seules les données avant la partie corrompue seront copiées. -4. Redémarrez l' `clickhouse-client` pour réinitialiser l' `max_threads` valeur. - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Renvoie ce qui suit `String` les colonnes de type: - -- `name` — Column name. -- `type`— Column type. -- `default_type` — Clause that is used in [expression par défaut](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` ou `ALIAS`). Column contient une chaîne vide, si l'expression par défaut n'est pas spécifiée. -- `default_expression` — Value specified in the `DEFAULT` clause. -- `comment_expression` — Comment text. - -Les structures de données imbriquées sont sorties dans “expanded” format. Chaque colonne est affichée séparément, avec le nom après un point. - -## DETACH {#detach} - -Supprime les informations sur le ‘name’ table du serveur. Le serveur cesse de connaître l'existence de la table. - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Cela ne supprime pas les données ou les métadonnées de la table. Lors du prochain lancement du serveur, le serveur Lira les métadonnées et découvrira à nouveau la table. -De même, un “detached” tableau peut être re-attaché en utilisant le `ATTACH` requête (à l'exception des tables système, qui n'ont pas de stocker les métadonnées pour eux). - -Il n'y a pas de `DETACH DATABASE` requête. - -## DROP {#drop} - -Cette requête a deux types: `DROP DATABASE` et `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -Supprime toutes les tables à l'intérieur de la ‘db’ la base de données, puis supprime le ‘db’ la base de données elle-même. -Si `IF EXISTS` est spécifié, il ne renvoie pas d'erreur si la base de données n'existe pas. - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Supprime la table. -Si `IF EXISTS` est spécifié, il ne renvoie pas d'erreur si la table n'existe pas ou si la base de données n'existe pas. - - DROP DICTIONARY [IF EXISTS] [db.]name - -Delets le dictionnaire. -Si `IF EXISTS` est spécifié, il ne renvoie pas d'erreur si la table n'existe pas ou si la base de données n'existe pas. - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -Renvoie un seul `UInt8`- type colonne, qui contient la valeur unique `0` si la table ou base de données n'existe pas, ou `1` si la table existe dans la base de données spécifiée. - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -Tente de mettre fin de force aux requêtes en cours d'exécution. -Les requêtes à terminer sont sélectionnées dans le système.processus en utilisant les critères définis dans le `WHERE` la clause de la `KILL` requête. - -Exemple: - -``` sql --- Forcibly terminates all queries with the specified query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Synchronously terminates all queries run by 'username': -KILL QUERY WHERE user='username' SYNC -``` - -Les utilisateurs en lecture seule peuvent uniquement arrêter leurs propres requêtes. - -Par défaut, la version asynchrone des requêtes est utilisé (`ASYNC`), qui n'attend pas la confirmation que les requêtes se sont arrêtées. - -La version synchrone (`SYNC`) attend que toutes les requêtes d'arrêter et affiche des informations sur chaque processus s'arrête. -La réponse contient l' `kill_status` la colonne, qui peut prendre les valeurs suivantes: - -1. ‘finished’ – The query was terminated successfully. -2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. -3. The other values ​​explain why the query can't be stopped. - -Une requête de test (`TEST`) vérifie uniquement les droits de l'utilisateur et affiche une liste de requêtes à arrêter. - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -Essaie d'annuler et supprimer [mutation](alter.md#alter-mutations) actuellement en cours d'exécution. Les Mutations à annuler sont sélectionnées parmi [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) tableau à l'aide du filtre spécifié par le `WHERE` la clause de la `KILL` requête. - -Une requête de test (`TEST`) vérifie uniquement les droits de l'utilisateur et affiche une liste de requêtes à arrêter. - -Exemple: - -``` sql --- Cancel and remove all mutations of the single table: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Cancel the specific mutation: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). - -Les modifications déjà apportées par la mutation ne sont pas annulées. - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -Cette requête tente d'initialiser une fusion non programmée de parties de données pour les tables avec un moteur de [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) famille. - -Le `OPTMIZE` la requête est également prise en charge pour [MaterializedView](../../engines/table_engines/special/materializedview.md) et la [Tampon](../../engines/table_engines/special/buffer.md) moteur. Les autres moteurs de table ne sont pas pris en charge. - -Lorsque `OPTIMIZE` est utilisé avec le [ReplicatedMergeTree](../../engines/table_engines/mergetree_family/replication.md) famille de moteurs de table, ClickHouse crée une tâche pour la fusion et attend l'exécution sur tous les nœuds (si le `replication_alter_partitions_sync` paramètre est activé). - -- Si `OPTIMIZE` n'effectue pas de fusion pour une raison quelconque, il ne notifie pas le client. Pour activer les notifications, utilisez [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) paramètre. -- Si vous spécifiez un `PARTITION`, seule la partition spécifiée est optimisé. [Comment définir l'expression de la partition](alter.md#alter-how-to-specify-part-expr). -- Si vous spécifiez `FINAL`, l'optimisation est effectuée, même lorsque toutes les données sont déjà dans une partie. -- Si vous spécifiez `DEDUPLICATE`, alors des lignes complètement identiques seront dédupliquées (toutes les colonnes sont comparées), cela n'a de sens que pour le moteur MergeTree. - -!!! warning "Avertissement" - `OPTIMIZE` ne peut pas réparer le “Too many parts” erreur. - -## RENAME {#misc_operations-rename} - -Renomme une ou plusieurs tables. - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -Toutes les tables sont renommées sous verrouillage global. Renommer des tables est une opération légère. Si vous avez indiqué une autre base de données après TO, la table sera déplacée vers cette base de données. Cependant, les répertoires contenant des bases de données doivent résider dans le même système de fichiers (sinon, une erreur est renvoyée). - -## SET {#query-set} - -``` sql -SET param = value -``` - -Assigner `value` à l' `param` [paramètre](../../operations/settings/index.md) pour la session en cours. Vous ne pouvez pas modifier [les paramètres du serveur](../../operations/server_configuration_parameters/index.md) de cette façon. - -Vous pouvez également définir toutes les valeurs de certains paramètres de profil dans une seule requête. - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -Pour plus d'informations, voir [Paramètre](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Supprime toutes les données d'une table. Lorsque la clause `IF EXISTS` est omis, la requête renvoie une erreur si la table n'existe pas. - -Le `TRUNCATE` la requête n'est pas prise en charge pour [Vue](../../engines/table_engines/special/view.md), [Fichier](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) et [NULL](../../engines/table_engines/special/null.md) table des moteurs. - -## USE {#use} - -``` sql -USE db -``` - -Vous permet de définir la base de données actuelle pour la session. -La base de données actuelle est utilisée pour rechercher des tables si la base de données n'est pas explicitement définie dans la requête avec un point avant le nom de la table. -Cette requête ne peut pas être faite lors de l'utilisation du protocole HTTP, car il n'y a pas de concept de session. - -[Article Original](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/fr/sql_reference/statements/select.md b/docs/fr/sql_reference/statements/select.md deleted file mode 100644 index 227313885f3..00000000000 --- a/docs/fr/sql_reference/statements/select.md +++ /dev/null @@ -1,610 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 33 -toc_title: SELECT ---- - -# Sélectionnez la syntaxe des requêtes {#select-queries-syntax} - -`SELECT` effectue la récupération des données. - -``` sql -[WITH expr_list|(subquery)] -SELECT [DISTINCT] expr_list -[FROM [db.]table | (subquery) | table_function] [FINAL] -[SAMPLE sample_coeff] -[ARRAY JOIN ...] -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list -[PREWHERE expr] -[WHERE expr] -[GROUP BY expr_list] [WITH TOTALS] -[HAVING expr] -[ORDER BY expr_list] -[LIMIT [offset_value, ]n BY columns] -[LIMIT [n, ]m] -[UNION ALL ...] -[INTO OUTFILE filename] -[FORMAT format] -``` - -Toutes les clauses sont facultatives, à l'exception de la liste d'expressions requise immédiatement après SELECT. -Les clauses ci-dessous sont décrites dans presque le même ordre que dans l'exécution de la requête convoyeur. - -Si la requête omet le `DISTINCT`, `GROUP BY` et `ORDER BY` les clauses et les `IN` et `JOIN` sous-requêtes, la requête sera complètement traitée en flux, en utilisant O (1) quantité de RAM. -Sinon, la requête peut consommer beaucoup de RAM si les restrictions appropriées ne sont pas spécifiées: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Pour plus d'informations, consultez la section “Settings”. Il est possible d'utiliser le tri externe (sauvegarde des tables temporaires sur un disque) et l'agrégation externe. `The system does not have "merge join"`. - -### AVEC la Clause {#with-clause} - -Cette section prend en charge les Expressions de Table courantes ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), avec quelques limitations: -1. Les requêtes récursives ne sont pas prises en charge -2. Lorsque la sous-requête est utilisée à l'intérieur avec section, son résultat doit être scalaire avec exactement une ligne -3. Les résultats d'Expression ne sont pas disponibles dans les sous requêtes -Les résultats des expressions de clause WITH peuvent être utilisés dans la clause SELECT. - -Exemple 1: Utilisation d'une expression constante comme “variable” - -``` sql -WITH '2019-08-01 15:23:00' as ts_upper_bound -SELECT * -FROM hits -WHERE - EventDate = toDate(ts_upper_bound) AND - EventTime <= ts_upper_bound -``` - -Exemple 2: Expulsion de la somme(octets) résultat de l'expression de clause SELECT de la liste de colonnes - -``` sql -WITH sum(bytes) as s -SELECT - formatReadableSize(s), - table -FROM system.parts -GROUP BY table -ORDER BY s -``` - -Exemple 3: Utilisation des résultats de la sous-requête scalaire - -``` sql -/* this example would return TOP 10 of most huge tables */ -WITH - ( - SELECT sum(bytes) - FROM system.parts - WHERE active - ) AS total_disk_usage -SELECT - (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, - table -FROM system.parts -GROUP BY table -ORDER BY table_disk_usage DESC -LIMIT 10 -``` - -Exemple 4: réutilisation de l'expression dans la sous-requête -Comme solution de contournement pour la limitation actuelle de l'utilisation de l'expression dans les sous-requêtes, Vous pouvez la dupliquer. - -``` sql -WITH ['hello'] AS hello -SELECT - hello, - * -FROM -( - WITH ['hello'] AS hello - SELECT hello -) -``` - -``` text -┌─hello─────┬─hello─────┐ -│ ['hello'] │ ['hello'] │ -└───────────┴───────────┘ -``` - -### De la Clause {#select-from} - -Si la clause FROM est omise, les données seront lues à partir `system.one` table. -Le `system.one` table contient exactement une ligne (cette table remplit le même but que la table double trouvée dans d'autres SGBD). - -Le `FROM` clause spécifie la source à partir de laquelle lire les données: - -- Table -- Sous-requête -- [Fonction de Table](../table_functions/index.md) - -`ARRAY JOIN` et le régulier `JOIN` peuvent également être inclus (voir ci-dessous). - -Au lieu d'une table, l' `SELECT` sous-requête peut être spécifiée entre parenthèses. -Contrairement à SQL standard, un synonyme n'a pas besoin d'être spécifié après une sous-requête. - -Pour exécuter une requête, toutes les colonnes mentionnées dans la requête sont extraites de la table appropriée. Toutes les colonnes non nécessaires pour la requête externe sont rejetées des sous-requêtes. -Si une requête ne répertorie aucune colonne (par exemple, `SELECT count() FROM t`), une colonne est extraite de la table de toute façon (la plus petite est préférée), afin de calculer le nombre de lignes. - -#### Modificateur FINAL {#select-from-final} - -Applicable lors de la sélection de données à partir de tables [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-famille de moteurs autres que `GraphiteMergeTree`. Lorsque `FINAL` est spécifié, ClickHouse fusionne complètement les données avant de renvoyer le résultat et effectue ainsi toutes les transformations de données qui se produisent lors des fusions pour le moteur de table donné. - -Également pris en charge pour: -- [Répliqué](../../engines/table_engines/mergetree_family/replication.md) les versions de `MergeTree` moteur. -- [Vue](../../engines/table_engines/special/view.md), [Tampon](../../engines/table_engines/special/buffer.md), [Distribué](../../engines/table_engines/special/distributed.md), et [MaterializedView](../../engines/table_engines/special/materializedview.md) moteurs qui fonctionnent sur d'autres moteurs, à condition qu'ils aient été créés sur `MergeTree`-tables de moteur. - -Requêtes qui utilisent `FINAL` sont exécutés pas aussi vite que les requêtes similaires qui ne le font pas, car: - -- La requête est exécutée dans un seul thread et les données sont fusionnées lors de l'exécution de la requête. -- Les requêtes avec `FINAL` lire les colonnes de clé primaire en plus des colonnes spécifiées dans la requête. - -Dans la plupart des cas, évitez d'utiliser `FINAL`. - -### Exemple de Clause {#select-sample-clause} - -Le `SAMPLE` la clause permet un traitement de requête approximatif. - -Lorsque l'échantillonnage de données est activé, la requête n'est pas effectuée sur toutes les données, mais uniquement sur une certaine fraction de données (échantillon). Par exemple, si vous avez besoin de calculer des statistiques pour toutes les visites, il suffit d'exécuter la requête sur le 1/10 de la fraction de toutes les visites, puis multiplier le résultat par 10. - -Le traitement approximatif des requêtes peut être utile dans les cas suivants: - -- Lorsque vous avez des exigences de synchronisation strictes (comme \<100ms), mais que vous ne pouvez pas justifier le coût des ressources matérielles supplémentaires pour y répondre. -- Lorsque vos données brutes ne sont pas précises, l'approximation ne dégrade pas sensiblement la qualité. -- Les exigences commerciales ciblent des résultats approximatifs (pour la rentabilité, ou afin de commercialiser des résultats exacts aux utilisateurs premium). - -!!! note "Note" - Vous ne pouvez utiliser l'échantillonnage qu'avec les tables [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) famille, et seulement si l'expression d'échantillonnage a été spécifiée lors de la création de la table (voir [Moteur MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table)). - -Les caractéristiques de l'échantillonnage des données sont énumérées ci-dessous: - -- L'échantillonnage de données est un mécanisme déterministe. Le résultat de la même `SELECT .. SAMPLE` la requête est toujours le même. -- L'échantillonnage fonctionne de manière cohérente pour différentes tables. Pour les tables avec une seule clé d'échantillonnage, un échantillon avec le même coefficient sélectionne toujours le même sous-ensemble de données possibles. Par exemple, un exemple d'ID utilisateur prend des lignes avec le même sous-ensemble de tous les ID utilisateur possibles de différentes tables. Cela signifie que vous pouvez utiliser l'exemple dans les sous-requêtes dans la [IN](#select-in-operators) clause. En outre, vous pouvez joindre des échantillons en utilisant le [JOIN](#select-join) clause. -- L'échantillonnage permet de lire moins de données à partir d'un disque. Notez que vous devez spécifier l'échantillonnage clé correctement. Pour plus d'informations, voir [Création d'une Table MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -Pour l' `SAMPLE` clause la syntaxe suivante est prise en charge: - -| SAMPLE Clause Syntax | Description | -|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `SAMPLE k` | Ici `k` est le nombre de 0 à 1.
La requête est exécutée sur `k` fraction des données. Exemple, `SAMPLE 0.1` exécute la requête sur 10% des données. [Lire plus](#select-sample-k) | -| `SAMPLE n` | Ici `n` est un entier suffisamment grand.
La requête est exécutée sur un échantillon d'au moins `n` lignes (mais pas significativement plus que cela). Exemple, `SAMPLE 10000000` exécute la requête sur un minimum de 10 000 000 lignes. [Lire plus](#select-sample-n) | -| `SAMPLE k OFFSET m` | Ici `k` et `m` sont les nombres de 0 à 1.
La requête est exécutée sur un échantillon de `k` fraction des données. Les données utilisées pour l'échantillon est compensée par `m` fraction. [Lire plus](#select-sample-offset) | - -#### SAMPLE K {#select-sample-k} - -Ici `k` est le nombre de 0 à 1 (les notations fractionnaires et décimales sont prises en charge). Exemple, `SAMPLE 1/2` ou `SAMPLE 0.5`. - -Dans un `SAMPLE k` clause, l'échantillon est prélevé à partir de la `k` fraction des données. L'exemple est illustré ci-dessous: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -Dans cet exemple, la requête est exécutée sur un échantillon de 0,1 (10%) de données. Les valeurs des fonctions d'agrégat ne sont pas corrigées automatiquement, donc pour obtenir un résultat approximatif, la valeur `count()` est multiplié manuellement par 10. - -#### SAMPLE N {#select-sample-n} - -Ici `n` est un entier suffisamment grand. Exemple, `SAMPLE 10000000`. - -Dans ce cas, la requête est exécutée sur un échantillon d'au moins `n` lignes (mais pas significativement plus que cela). Exemple, `SAMPLE 10000000` exécute la requête sur un minimum de 10 000 000 lignes. - -Puisque l'unité minimale pour la lecture des données est un granule (sa taille est définie par le `index_granularity` de réglage), il est logique de définir un échantillon beaucoup plus grand que la taille du granule. - -Lors de l'utilisation de la `SAMPLE n` clause, vous ne savez pas quel pourcentage relatif de données a été traité. Donc, vous ne connaissez pas le coefficient par lequel les fonctions agrégées doivent être multipliées. L'utilisation de la `_sample_factor` colonne virtuelle pour obtenir le résultat approximatif. - -Le `_sample_factor` colonne contient des coefficients relatifs qui sont calculés dynamiquement. Cette colonne est créée automatiquement lorsque vous [créer](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table) une table avec la clé d'échantillonnage spécifiée. Les exemples d'utilisation de la `_sample_factor` colonne sont indiqués ci-dessous. - -Considérons la table `visits` qui contient des statistiques sur les visites de site. Le premier exemple montre comment calculer le nombre de pages vues: - -``` sql -SELECT sum(PageViews * _sample_factor) -FROM visits -SAMPLE 10000000 -``` - -L'exemple suivant montre comment calculer le nombre total de visites: - -``` sql -SELECT sum(_sample_factor) -FROM visits -SAMPLE 10000000 -``` - -L'exemple ci-dessous montre comment calculer la durée moyenne de la session. Notez que vous n'avez pas besoin d'utiliser le coefficient relatif pour calculer les valeurs moyennes. - -``` sql -SELECT avg(Duration) -FROM visits -SAMPLE 10000000 -``` - -#### SAMPLE K OFFSET M {#select-sample-offset} - -Ici `k` et `m` sont des nombres de 0 à 1. Des exemples sont présentés ci-dessous. - -**Exemple 1** - -``` sql -SAMPLE 1/10 -``` - -Dans cet exemple, l'échantillon représente 1 / 10e de toutes les données: - -`[++------------]` - -**Exemple 2** - -``` sql -SAMPLE 1/10 OFFSET 1/2 -``` - -Ici, un échantillon de 10% est prélevé à partir de la seconde moitié des données. - -`[------++------]` - -### Clause de jointure de tableau {#select-array-join-clause} - -Permet l'exécution de `JOIN` avec un tableau ou une structure de données imbriquée. L'intention est similaire à la [arrayJoin](../../sql_reference/functions/array_join.md#functions_arrayjoin) la fonction, mais sa fonctionnalité est plus large. - -``` sql -SELECT -FROM -[LEFT] ARRAY JOIN -[WHERE|PREWHERE ] -... -``` - -Vous pouvez spécifier qu'un seul `ARRAY JOIN` la clause dans une requête. - -L'ordre d'exécution de la requête est optimisé lors de l'exécution `ARRAY JOIN`. Bien `ARRAY JOIN` doit toujours être spécifié avant l' `WHERE/PREWHERE` clause, il peut être effectué soit avant `WHERE/PREWHERE` (si le résultat est nécessaire dans cette clause), ou après l'avoir terminé (pour réduire le volume de calculs). L'ordre de traitement est contrôlée par l'optimiseur de requête. - -Types pris en charge de `ARRAY JOIN` sont énumérés ci-dessous: - -- `ARRAY JOIN` - Dans ce cas, des tableaux vides ne sont pas inclus dans le résultat de `JOIN`. -- `LEFT ARRAY JOIN` - Le résultat de `JOIN` contient des lignes avec des tableaux vides. La valeur d'un tableau vide est définie sur la valeur par défaut pour le type d'élément de tableau (généralement 0, chaîne vide ou NULL). - -Les exemples ci-dessous illustrent l'utilisation de la `ARRAY JOIN` et `LEFT ARRAY JOIN` clause. Créons une table avec un [Tableau](../../sql_reference/data_types/array.md) tapez colonne et insérez des valeurs dedans: - -``` sql -CREATE TABLE arrays_test -( - s String, - arr Array(UInt8) -) ENGINE = Memory; - -INSERT INTO arrays_test -VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); -``` - -``` text -┌─s───────────┬─arr─────┐ -│ Hello │ [1,2] │ -│ World │ [3,4,5] │ -│ Goodbye │ [] │ -└─────────────┴─────────┘ -``` - -L'exemple ci-dessous utilise la `ARRAY JOIN` clause: - -``` sql -SELECT s, arr -FROM arrays_test -ARRAY JOIN arr; -``` - -``` text -┌─s─────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -└───────┴─────┘ -``` - -L'exemple suivant utilise l' `LEFT ARRAY JOIN` clause: - -``` sql -SELECT s, arr -FROM arrays_test -LEFT ARRAY JOIN arr; -``` - -``` text -┌─s───────────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -│ Goodbye │ 0 │ -└─────────────┴─────┘ -``` - -#### À L'Aide D'Alias {#using-aliases} - -Un alias peut être spécifié pour un tableau `ARRAY JOIN` clause. Dans ce cas, un élément de tableau peut être consulté par ce pseudonyme, mais le tableau lui-même est accessible par le nom d'origine. Exemple: - -``` sql -SELECT s, arr, a -FROM arrays_test -ARRAY JOIN arr AS a; -``` - -``` text -┌─s─────┬─arr─────┬─a─┐ -│ Hello │ [1,2] │ 1 │ -│ Hello │ [1,2] │ 2 │ -│ World │ [3,4,5] │ 3 │ -│ World │ [3,4,5] │ 4 │ -│ World │ [3,4,5] │ 5 │ -└───────┴─────────┴───┘ -``` - -En utilisant des alias, vous pouvez effectuer `ARRAY JOIN` avec un groupe externe. Exemple: - -``` sql -SELECT s, arr_external -FROM arrays_test -ARRAY JOIN [1, 2, 3] AS arr_external; -``` - -``` text -┌─s───────────┬─arr_external─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ Hello │ 3 │ -│ World │ 1 │ -│ World │ 2 │ -│ World │ 3 │ -│ Goodbye │ 1 │ -│ Goodbye │ 2 │ -│ Goodbye │ 3 │ -└─────────────┴──────────────┘ -``` - -Plusieurs tableaux peuvent être séparés par des virgules `ARRAY JOIN` clause. Dans ce cas, `JOIN` est effectuée avec eux simultanément (la somme directe, pas le produit cartésien). Notez que tous les tableaux doivent avoir la même taille. Exemple: - -``` sql -SELECT s, arr, a, num, mapped -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ -│ Hello │ [1,2] │ 1 │ 1 │ 2 │ -│ Hello │ [1,2] │ 2 │ 2 │ 3 │ -│ World │ [3,4,5] │ 3 │ 1 │ 4 │ -│ World │ [3,4,5] │ 4 │ 2 │ 5 │ -│ World │ [3,4,5] │ 5 │ 3 │ 6 │ -└───────┴─────────┴───┴─────┴────────┘ -``` - -L'exemple ci-dessous utilise la [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) fonction: - -``` sql -SELECT s, arr, a, num, arrayEnumerate(arr) -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ -│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ -│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ -│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ -│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ -│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ -└───────┴─────────┴───┴─────┴─────────────────────┘ -``` - -#### Jointure de tableau avec la Structure de données imbriquée {#array-join-with-nested-data-structure} - -`ARRAY`Rejoindre " fonctionne également avec [structures de données imbriquées](../../sql_reference/data_types/nested_data_structures/nested.md). Exemple: - -``` sql -CREATE TABLE nested_test -( - s String, - nest Nested( - x UInt8, - y UInt32) -) ENGINE = Memory; - -INSERT INTO nested_test -VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); -``` - -``` text -┌─s───────┬─nest.x──┬─nest.y─────┐ -│ Hello │ [1,2] │ [10,20] │ -│ World │ [3,4,5] │ [30,40,50] │ -│ Goodbye │ [] │ [] │ -└─────────┴─────────┴────────────┘ -``` - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -Lorsque vous spécifiez des noms de structures de données imbriquées dans `ARRAY JOIN` le sens est le même que `ARRAY JOIN` avec tous les éléments du tableau qui la compose. Des exemples sont énumérés ci-dessous: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`, `nest.y`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -Cette variation a également du sens: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─────┐ -│ Hello │ 1 │ [10,20] │ -│ Hello │ 2 │ [10,20] │ -│ World │ 3 │ [30,40,50] │ -│ World │ 4 │ [30,40,50] │ -│ World │ 5 │ [30,40,50] │ -└───────┴────────┴────────────┘ -``` - -Un alias peut être utilisé pour une structure de données imbriquée, afin de sélectionner `JOIN` le résultat ou le tableau source. Exemple: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest AS n; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ -└───────┴─────┴─────┴─────────┴────────────┘ -``` - -Exemple d'utilisation de l' [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) fonction: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num -FROM nested_test -ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ -└───────┴─────┴─────┴─────────┴────────────┴─────┘ -``` - -### Clause de JOINTURE {#select-join} - -Rejoint les données dans la normale [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) sens. - -!!! info "Note" - Pas liées à [ARRAY JOIN](#select-array-join-clause). - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN -(ON )|(USING ) ... -``` - -Les noms de table peuvent être spécifiés au lieu de `` et ``. Ceci est équivalent à la `SELECT * FROM table` sous-requête, sauf dans un cas particulier lorsque la table a [Rejoindre](../../engines/table_engines/special/join.md) engine – an array prepared for joining. - -#### Types Pris En Charge De `JOIN` {#select-join-types} - -- `INNER JOIN` (ou `JOIN`) -- `LEFT JOIN` (ou `LEFT OUTER JOIN`) -- `RIGHT JOIN` (ou `RIGHT OUTER JOIN`) -- `FULL JOIN` (ou `FULL OUTER JOIN`) -- `CROSS JOIN` (ou `,` ) - -Voir la norme [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) Description. - -#### Plusieurs REJOINDRE {#multiple-join} - -En effectuant des requêtes, ClickHouse réécrit les jointures multi-tables dans la séquence des jointures à deux tables. Par exemple, S'il y a quatre tables pour join clickhouse rejoint la première et la seconde, puis rejoint le résultat avec la troisième table, et à la dernière étape, il rejoint la quatrième. - -Si une requête contient l' `WHERE` clickhouse essaie de pousser les filtres de cette clause à travers la jointure intermédiaire. S'il ne peut pas appliquer le filtre à chaque jointure intermédiaire, ClickHouse applique les filtres une fois toutes les jointures terminées. - -Nous recommandons l' `JOIN ON` ou `JOIN USING` syntaxe pour créer des requêtes. Exemple: - -``` sql -SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a -``` - -Vous pouvez utiliser des listes de tables séparées par des virgules `FROM` clause. Exemple: - -``` sql -SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a -``` - -Ne mélangez pas ces syntaxes. - -ClickHouse ne supporte pas directement la syntaxe avec des virgules, Nous ne recommandons donc pas de les utiliser. L'algorithme tente de réécrire la requête en termes de `CROSS JOIN` et `INNER JOIN` clauses et procède ensuite au traitement des requêtes. Lors de la réécriture de la requête, ClickHouse tente d'optimiser les performances et la consommation de mémoire. Par défaut, ClickHouse traite les virgules comme `INNER JOIN` clause et convertit `INNER JOIN` de `CROSS JOIN` lorsque l'algorithme ne peut pas garantir que `INNER JOIN` retourne les données requises. - -#### Rigueur {#select-join-strictness} - -- `ALL` — If the right table has several matching rows, ClickHouse creates a [Produit cartésien](https://en.wikipedia.org/wiki/Cartesian_product) à partir des lignes correspondantes. C'est la norme `JOIN` comportement en SQL. -- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` et `ALL` les mots clés sont les mêmes. -- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` l'utilisation est décrite ci-dessous. - -**ASOF joindre L'utilisation** - -`ASOF JOIN` est utile lorsque vous devez joindre des enregistrements qui n'ont pas de correspondance exacte. - -Tables pour `ASOF JOIN` doit avoir une colonne de séquence ordonnée. Cette colonne ne peut pas être seule dans une table et doit être l'un des types de données: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`, et `DateTime`. - -Syntaxe `ASOF JOIN ... ON`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF LEFT JOIN table_2 -ON equi_cond AND closest_match_cond -``` - -Vous pouvez utiliser n'importe quel nombre de conditions d'égalité et exactement une condition de correspondance la plus proche. Exemple, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. - -Conditions prises en charge pour la correspondance la plus proche: `>`, `>=`, `<`, `<=`. - -Syntaxe `ASOF JOIN ... USING`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF JOIN table_2 -USING (equi_column1, ... equi_columnN, asof_column) -``` - -`ASOF JOIN` utiliser `equi_columnX` pour rejoindre sur l'égalité et `asof_column` pour rejoindre le match le plus proche avec le `table_1.asof_column >= table_2.asof_column` condition. Le `asof_column` colonne toujours la dernière dans le `USING` clause. - -Par exemple, considérez les tableaux suivants: - -\`\`\` texte -table\_1 table\_2 - -événement \| ev\_time \| user\_id événement \| ev\_time \| user\_id diff --git a/docs/fr/sql_reference/statements/show.md b/docs/fr/sql_reference/statements/show.md deleted file mode 100644 index d609c5ea4ef..00000000000 --- a/docs/fr/sql_reference/statements/show.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 38 -toc_title: SHOW ---- - -# Afficher les requêtes {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Renvoie un seul `String`-type ‘statement’ column, which contains a single value – the `CREATE` requête utilisée pour créer l'objet spécifié. - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -Imprime une liste de toutes les bases de données. -Cette requête est identique à `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -Sorties le contenu de la [système.processus](../../operations/system_tables.md#system_tables-processes) table, qui contient une liste de requêtes en cours de traitement en ce moment, à l'exception `SHOW PROCESSLIST` requête. - -Le `SELECT * FROM system.processes` requête renvoie des données sur toutes les requêtes en cours. - -Astuce (exécuter dans la console): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -Affiche une liste de tableaux. - -``` sql -SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Si l' `FROM` la clause n'est pas spécifié, la requête renvoie la liste des tables de la base de données actuelle. - -Vous pouvez obtenir les mêmes résultats que l' `SHOW TABLES` requête de la façon suivante: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Exemple** - -La requête suivante sélectionne les deux premières lignes de la liste des tables `system` base de données, dont les noms contiennent `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -Affiche une liste de [dictionnaires externes](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Si l' `FROM` la clause n'est pas spécifié, la requête retourne la liste des dictionnaires de la base de données actuelle. - -Vous pouvez obtenir les mêmes résultats que l' `SHOW DICTIONARIES` requête de la façon suivante: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Exemple** - -La requête suivante sélectionne les deux premières lignes de la liste des tables `system` base de données, dont les noms contiennent `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/fr/sql_reference/statements/system.md b/docs/fr/sql_reference/statements/system.md deleted file mode 100644 index 0494f24f62b..00000000000 --- a/docs/fr/sql_reference/statements/system.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 37 -toc_title: SYSTEM ---- - -# SYSTÈME de Requêtes {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -Recharge tous les dictionnaires qui ont déjà été chargés avec succès. -Par défaut, les dictionnaires sont chargés paresseusement (voir [dictionaries\_lazy\_load](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), donc au lieu d'être chargés automatiquement au démarrage, ils sont initialisés lors du premier accès via la fonction dictGet ou sélectionnez dans les tables avec ENGINE = Dictionary . Le `SYSTEM RELOAD DICTIONARIES` query recharge ces dictionnaires (chargés). -Retourne toujours `Ok.` quel que soit le résultat de la mise à jour du dictionnaire. - -## Recharger le dictionnaire Dictionary\_name {#query_language-system-reload-dictionary} - -Recharge complètement un dictionnaire `dictionary_name`, quel que soit l'état du dictionnaire (LOADED / NOT\_LOADED / FAILED). -Retourne toujours `Ok.` quel que soit le résultat de la mise à jour du dictionnaire. -L'état du dictionnaire peut être vérifié en interrogeant le `system.dictionaries` table. - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -Réinitialise le cache DNS interne de ClickHouse. Parfois (pour les anciennes versions de ClickHouse), il est nécessaire d'utiliser cette commande lors de la modification de l'infrastructure (modification de l'adresse IP d'un autre serveur ClickHouse ou du serveur utilisé par les dictionnaires). - -Pour une gestion du cache plus pratique (automatique), voir paramètres disable\_internal\_dns\_cache, dns\_cache\_update\_period. - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -Réinitialise le cache de marque. Utilisé dans le développement de ClickHouse et des tests de performance. - -## FLUSH LOGS {#query_language-system-flush_logs} - -Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. - -## RELOAD CONFIG {#query_language-system-reload-config} - -Recharge la configuration de ClickHouse. Utilisé lorsque la configuration est stockée dans ZooKeeeper. - -## SHUTDOWN {#query_language-system-shutdown} - -Normalement ferme ClickHouse (comme `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -Annule le processus de ClickHouse (comme `kill -9 {$ pid_clickhouse-server}`) - -## Gestion Des Tables Distribuées {#query-language-system-distributed} - -ClickHouse peut gérer [distribué](../../engines/table_engines/special/distributed.md) table. Lorsqu'un utilisateur insère des données dans ces tables, ClickHouse crée d'abord une file d'attente des données qui doivent être envoyées aux nœuds de cluster, puis l'envoie de manière asynchrone. Vous pouvez gérer le traitement des files d'attente avec [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed), et [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) requête. Vous pouvez également insérer de manière synchrone des données distribuées avec `insert_distributed_sync` paramètre. - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -Désactive la distribution de données en arrière-plan lors de l'insertion de données dans des tables distribuées. - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -Force ClickHouse à envoyer des données aux nœuds de cluster de manière synchrone. Si des nœuds ne sont pas disponibles, ClickHouse lève une exception et arrête l'exécution de la requête. Vous pouvez réessayer la requête jusqu'à ce qu'elle réussisse, ce qui se produira lorsque tous les nœuds seront de nouveau en ligne. - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -Active la distribution de données en arrière-plan lors de l'insertion de données dans des tables distribuées. - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -Offre la possibilité d'arrêter les fusions d'arrière-plan pour les tables de la famille MergeTree: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "Note" - `DETACH / ATTACH` table va commencer les fusions d'arrière-plan pour la table même dans le cas où les fusions ont été arrêtées pour toutes les tables MergeTree auparavant. - -### START MERGES {#query_language-system-start-merges} - -Offre la possibilité de démarrer des fusions en arrière-plan pour les tables de la famille MergeTree: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/fr/sql_reference/syntax.md b/docs/fr/sql_reference/syntax.md deleted file mode 100644 index ba27e16dc8f..00000000000 --- a/docs/fr/sql_reference/syntax.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 31 -toc_title: Syntaxe ---- - -# Syntaxe {#syntax} - -Il existe deux types d'analyseurs dans le système: L'analyseur SQL complet (un analyseur de descente récursif) et l'analyseur de format de données (un analyseur de flux rapide). -Dans tous les cas à l'exception de la `INSERT` requête, seul L'analyseur SQL complet est utilisé. -Le `INSERT` requête utilise les deux analyseurs: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -Le `INSERT INTO t VALUES` fragment est analysé par l'analyseur complet, et les données `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` est analysé par l'analyseur de flux rapide. Vous pouvez également activer l'analyseur complet pour les données à l'aide de la [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) paramètre. Lorsque `input_format_values_interpret_expressions = 1`, ClickHouse essaie d'abord d'analyser les valeurs avec l'analyseur de flux rapide. S'il échoue, ClickHouse essaie d'utiliser l'analyseur complet pour les données, en le traitant comme un SQL [expression](#syntax-expressions). - -Les données peuvent avoir n'importe quel format. Lorsqu'une requête est reçue, le serveur calcule pas plus que [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) octets de la requête en RAM (par défaut, 1 Mo), et le reste est analysé en flux. -Cela signifie que le système n'a pas de problèmes avec de grandes `INSERT` requêtes, comme le fait MySQL. - -Lors de l'utilisation de la `Values` format dans un `INSERT` de la requête, il peut sembler que les données sont analysées de même que les expressions dans un `SELECT` requête, mais ce n'est pas vrai. Le `Values` le format est beaucoup plus limitée. - -Ensuite, nous allons couvrir l'analyseur complet. Pour plus d'informations sur les analyseurs de format, consultez [Format](../interfaces/formats.md) section. - -## Espace {#spaces} - -Il peut y avoir n'importe quel nombre de symboles d'espace entre les constructions syntaxiques (y compris le début et la fin d'une requête). Les symboles d'espace incluent l'espace, l'onglet, le saut de ligne, Le CR et le flux de formulaire. - -## Commentaire {#comments} - -Les commentaires de style SQL et C sont pris en charge. -Commentaires de style SQL: de `--` à la fin de la ligne. L'espace après `--` peut être omis. -Commentaires dans C-style: de `/*` de `*/`. Ces commentaires peuvent être multilignes. Les espaces ne sont pas requis ici non plus. - -## Mot {#syntax-keywords} - -Les mots clés sont insensibles à la casse lorsqu'ils correspondent à: - -- La norme SQL. Exemple, `SELECT`, `select` et `SeLeCt` sont toutes valides. -- Implémentation dans certains SGBD populaires (MySQL ou Postgres). Exemple, `DateTime` est la même que `datetime`. - -Si le nom du type de données est sensible à la casse peut être vérifié `system.data_type_families` table. - -Contrairement à SQL standard, tous les autres mots clés (y compris les noms de fonctions) sont **sensible à la casse**. - -Mots-clés ne sont pas réservés (ils sont simplement considérés comme des mots-clés dans le contexte correspondant). Si vous utilisez [identificateur](#syntax-identifiers) de même que les mots clés, les placer entre guillemets. Par exemple, la requête `SELECT "FROM" FROM table_name` est valide si la table `table_name` a colonne avec le nom de `"FROM"`. - -## Identificateur {#syntax-identifiers} - -Les identificateurs sont: - -- Noms de Cluster, de base de données, de table, de partition et de colonne. -- Fonction. -- Types de données. -- [Expression des alias](#syntax-expression_aliases). - -Les identificateurs peuvent être cités ou non cités. Il est recommandé d'utiliser des identificateurs sans guillemets. - -Non identificateurs doivent correspondre à l'expression régulière `^[a-zA-Z_][0-9a-zA-Z_]*$` et ne peut pas être égale à [mot](#syntax-keywords). Exemple: `x, _1, X_y__Z123_.` - -Si vous souhaitez utiliser les identifiants de la même manière que les mots-clés ou si vous souhaitez utiliser d'autres symboles dans les identifiants, citez-le en utilisant des guillemets doubles ou des backticks, par exemple, `"id"`, `` `id` ``. - -## Littéral {#literals} - -Il y a: Numérique, chaîne, composé et `NULL` littéral. - -### Numérique {#numeric} - -Un littéral numérique tente d'être analysé: - -- D'abord comme un nombre signé 64 bits, en utilisant le [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) fonction. -- En cas d'échec, en tant que nombre non signé 64 bits, [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) fonction. -- En cas d'échec, en tant que nombre à virgule flottante [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) fonction. -- Sinon, une erreur est renvoyée. - -La valeur correspondante aura le plus petit type dans lequel la valeur correspond. -Par exemple, 1 est analysé comme `UInt8`, mais 256 est analysé comme `UInt16`. Pour plus d'informations, voir [Types de données](../sql_reference/data_types/index.md). - -Exemple: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### Chaîne {#syntax-string-literal} - -Seuls les littéraux de chaîne entre guillemets simples sont pris en charge. Le clos de caractères barre oblique inverse échappé. Les séquences d'échappement suivantes ont une valeur spéciale correspondante: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. Dans tous les autres cas, des séquences d'échappement au format `\c`, où `c` est un caractère, sont convertis à `c`. Cela signifie que vous pouvez utiliser les séquences `\'`et`\\`. La valeur aurez l' [Chaîne](../sql_reference/data_types/string.md) type. - -L'ensemble minimum de caractères que vous devez échapper dans les littéraux de chaîne: `'` et `\`. Apostrophe peut être échappé avec l'apostrophe, les littéraux `'It\'s'` et `'It''s'` sont égaux. - -### Composé {#compound} - -Les Constructions sont prises en charge pour les tableaux: `[1, 2, 3]` et les tuples: `(1, 'Hello, world!', 2)`.. -En fait, ce ne sont pas des littéraux, mais des expressions avec l'opérateur de création de tableau et l'opérateur de création de tuple, respectivement. -Un tableau doit être composé d'au moins un élément, et un tuple doit avoir au moins deux éléments. -Les Tuples ont un but spécial pour l'usage dans le `IN` clause de a `SELECT` requête. Les Tuples peuvent être obtenus à la suite d'une requête, mais ils ne peuvent pas être enregistrées dans une base de données (à l'exception de [Mémoire](../engines/table_engines/special/memory.md) table). - -### NULL {#null-literal} - -Indique que la valeur est manquante. - -Afin de stocker `NULL` dans un champ de table, il doit être de la [Nullable](../sql_reference/data_types/nullable.md) type. - -Selon le format de données (entrée ou sortie), `NULL` peut avoir une représentation différente. Pour plus d'informations, consultez la documentation de [formats de données](../interfaces/formats.md#formats). - -Il y a beaucoup de nuances au traitement `NULL`. Par exemple, si au moins l'un des arguments d'une opération de comparaison est `NULL` le résultat de cette opération sera également `NULL`. Il en va de même pour la multiplication, l'addition et d'autres opérations. Pour plus d'informations, lisez la documentation pour chaque opération. - -Dans les requêtes, vous pouvez vérifier `NULL` à l'aide de la [IS NULL](operators.md#operator-is-null) et [IS NOT NULL](operators.md) opérateurs et les fonctions connexes `isNull` et `isNotNull`. - -## Fonction {#functions} - -Les fonctions sont écrites comme un identifiant avec une liste d'arguments (éventuellement vide) entre parenthèses. Contrairement au SQL standard, les crochets sont requis, même pour une liste d'arguments vide. Exemple: `now()`. -Il existe des fonctions régulières et agrégées (voir la section “Aggregate functions”). Certaines fonctions d'agrégat peut contenir deux listes d'arguments entre parenthèses. Exemple: `quantile (0.9) (x)`. Ces fonctions d'agrégation sont appelés “parametric” fonctions, et les arguments dans la première liste sont appelés “parameters”. La syntaxe des fonctions d'agrégation sans paramètres est la même que pour les fonctions régulières. - -## Opérateur {#operators} - -Les opérateurs sont convertis en leurs fonctions correspondantes lors de l'analyse des requêtes, en tenant compte de leur priorité et de leur associativité. -Par exemple, l'expression `1 + 2 * 3 + 4` est transformé à `plus(plus(1, multiply(2, 3)), 4)`. - -## Types de données et moteurs de Table de base de données {#data_types-and-database-table-engines} - -Types de données et moteurs de table dans `CREATE` les requêtes sont écrites de la même manière que les identifiants ou les fonctions. En d'autres termes, ils peuvent ou non contenir une liste d'arguments entre parenthèses. Pour plus d'informations, voir les sections “Data types,” “Table engines,” et “CREATE”. - -## Expression Des Alias {#syntax-expression_aliases} - -Un alias est un nom défini par l'utilisateur pour une expression dans une requête. - -``` sql -expr AS alias -``` - -- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` clause sans utiliser le `AS` mot. - - For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. - -- `expr` — Any expression supported by ClickHouse. - - For example, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — Name for `expr`. Les alias doivent être conformes à la [identificateur](#syntax-identifiers) syntaxe. - - For example, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### Notes sur l'Utilisation de la {#notes-on-usage} - -Les alias sont globaux pour une requête ou d'une sous-requête et vous pouvez définir un alias dans n'importe quelle partie d'une requête de toute expression. Exemple, `SELECT (1 AS n) + 2, n`. - -Les alias ne sont pas visibles dans les sous-requêtes et entre les sous-requêtes. Par exemple, lors de l'exécution de la requête `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` Clickhouse génère l'exception `Unknown identifier: num`. - -Si un alias est défini pour les colonnes de `SELECT` la clause d'une sous-requête, ces colonnes sont visibles dans la requête externe. Exemple, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -Soyez prudent avec les Alias qui sont les mêmes que les noms de colonnes ou de tables. Considérons l'exemple suivant: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -Dans cet exemple, nous avons déclaré table `t` avec la colonne `b`. Ensuite, lors de la sélection des données, nous avons défini le `sum(b) AS b` alias. Comme les alias sont globaux, ClickHouse a substitué le littéral `b` dans l'expression `argMax(a, b)` avec l'expression `sum(b)`. Cette substitution a provoqué l'exception. - -## Astérisque {#asterisk} - -Dans un `SELECT` requête, un astérisque peut remplacer l'expression. Pour plus d'informations, consultez la section “SELECT”. - -## Expression {#syntax-expressions} - -Une expression est une fonction, un identifiant, un littéral, une application d'un opérateur, une expression entre parenthèses, une sous-requête ou un astérisque. Il peut également contenir un alias. -Une liste des expressions est une ou plusieurs expressions séparées par des virgules. -Les fonctions et les opérateurs, à leur tour, peuvent avoir des expressions comme arguments. - -[Article Original](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/fr/sql_reference/table_functions/file.md b/docs/fr/sql_reference/table_functions/file.md deleted file mode 100644 index 3d330b1f20f..00000000000 --- a/docs/fr/sql_reference/table_functions/file.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 37 -toc_title: fichier ---- - -# fichier {#file} - -Crée un tableau à partir d'un fichier. Cette fonction de table est similaire à [URL](url.md) et [hdfs](hdfs.md) ceux. - -``` sql -file(path, format, structure) -``` - -**Les paramètres d'entrée** - -- `path` — The relative path to the file from [user\_files\_path](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-user_files_path). Chemin d'accès à la prise en charge des fichiers suivant les globs en mode Lecture seule: `*`, `?`, `{abc,def}` et `{N..M}` où `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [format](../../interfaces/formats.md#formats) de le fichier. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Valeur renvoyée** - -Une table avec la structure spécifiée pour lire ou écrire des données dans le fichier spécifié. - -**Exemple** - -Paramètre `user_files_path` et le contenu du fichier `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -Table de`test.csv` et la sélection des deux premières lignes de ce: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -``` sql --- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file -SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 -``` - -**Globs dans le chemin** - -Plusieurs composants de chemin peuvent avoir des globs. Pour être traité, le fichier doit exister et correspondre à l'ensemble du modèle de chemin (pas seulement le suffixe ou le préfixe). - -- `*` — Substitutes any number of any characters except `/` y compris la chaîne vide. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Les Constructions avec `{}` sont similaires à l' [fonction de table à distance](../../sql_reference/table_functions/remote.md)). - -**Exemple** - -1. Supposons que nous ayons plusieurs fichiers avec les chemins relatifs suivants: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. Interroger la quantité de lignes dans ces fichiers: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Requête de la quantité de lignes dans tous les fichiers de ces deux répertoires: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Avertissement" - Si votre liste de fichiers contient des plages de nombres avec des zéros en tête, utilisez la construction avec des accolades pour chaque chiffre séparément ou utilisez `?`. - -**Exemple** - -Interroger les données des fichiers nommés `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Les Colonnes Virtuelles {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Voir Aussi** - -- [Les colonnes virtuelles](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/fr/sql_reference/table_functions/generate.md b/docs/fr/sql_reference/table_functions/generate.md deleted file mode 100644 index a4ccc30ec88..00000000000 --- a/docs/fr/sql_reference/table_functions/generate.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 47 -toc_title: generateRandom ---- - -# generateRandom {#generaterandom} - -Génère des données aléatoires avec un schéma donné. -Permet de remplir des tables de test avec des données. -Prend en charge tous les types de données qui peuvent être stockés dans la table sauf `LowCardinality` et `AggregateFunction`. - -``` sql -generateRandom('name TypeName[, name TypeName]...', [, 'random_seed'[, 'max_string_length'[, 'max_array_length']]]); -``` - -**Paramètre** - -- `name` — Name of corresponding column. -- `TypeName` — Type of corresponding column. -- `limit` — Number of rows to generate. -- `max_array_length` — Maximum array length for all generated arrays. Defaults to `10`. -- `max_string_length` — Maximum string length for all generated strings. Defaults to `10`. -- `random_seed` — Specify random seed manually to produce stable results. If NULL — seed is randomly generated. - -**Valeur Renvoyée** - -Un objet de table avec le schéma demandé. - -## Exemple D'Utilisation {#usage-example} - -``` sql -SELECT * FROM generateRandom('a Array(Int8), d Decimal32(4), c Tuple(DateTime64(3), UUID)', 1, 10, 2); -``` - -``` text -┌─a────────┬────────────d─┬─c──────────────────────────────────────────────────────────────────┐ -│ [77] │ -124167.6723 │ ('2061-04-17 21:59:44.573','3f72f405-ec3e-13c8-44ca-66ef335f7835') │ -│ [32,110] │ -141397.7312 │ ('1979-02-09 03:43:48.526','982486d1-5a5d-a308-e525-7bd8b80ffa73') │ -│ [68] │ -67417.0770 │ ('2080-03-12 14:17:31.269','110425e5-413f-10a6-05ba-fa6b3e929f15') │ -└──────────┴──────────────┴────────────────────────────────────────────────────────────────────┘ -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/generate/) diff --git a/docs/fr/sql_reference/table_functions/hdfs.md b/docs/fr/sql_reference/table_functions/hdfs.md deleted file mode 100644 index 01607102276..00000000000 --- a/docs/fr/sql_reference/table_functions/hdfs.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 45 -toc_title: hdfs ---- - -# hdfs {#hdfs} - -Crée une table à partir de fichiers dans HDFS. Cette fonction de table est similaire à [URL](url.md) et [fichier](file.md) ceux. - -``` sql -hdfs(URI, format, structure) -``` - -**Les paramètres d'entrée** - -- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` et `{N..M}` où `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [format](../../interfaces/formats.md#formats) de le fichier. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Valeur renvoyée** - -Une table avec la structure spécifiée pour lire ou écrire des données dans le fichier spécifié. - -**Exemple** - -Table de `hdfs://hdfs1:9000/test` et la sélection des deux premières lignes de ce: - -``` sql -SELECT * -FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -**Globs dans le chemin** - -Plusieurs composants de chemin peuvent avoir des globs. Pour être traité, le fichier doit exister et correspondre à l'ensemble du modèle de chemin (pas seulement le suffixe ou le préfixe). - -- `*` — Substitutes any number of any characters except `/` y compris la chaîne vide. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -Les Constructions avec `{}` sont similaires à l' [fonction de table à distance](../../sql_reference/table_functions/remote.md)). - -**Exemple** - -1. Supposons que nous ayons plusieurs fichiers avec les URI suivants sur HDFS: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Interroger la quantité de lignes dans ces fichiers: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Requête de la quantité de lignes dans tous les fichiers de ces deux répertoires: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Avertissement" - Si votre liste de fichiers contient des plages de nombres avec des zéros en tête, utilisez la construction avec des accolades pour chaque chiffre séparément ou utilisez `?`. - -**Exemple** - -Interroger les données des fichiers nommés `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Les Colonnes Virtuelles {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Voir Aussi** - -- [Les colonnes virtuelles](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/fr/sql_reference/table_functions/index.md b/docs/fr/sql_reference/table_functions/index.md deleted file mode 100644 index 1a43dd298c1..00000000000 --- a/docs/fr/sql_reference/table_functions/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Table Functions -toc_priority: 34 -toc_title: Introduction ---- - -# Les Fonctions De Table {#table-functions} - -Les fonctions de Table sont des méthodes pour construire des tables. - -Vous pouvez utiliser les fonctions de table dans: - -- [FROM](../statements/select.md#select-from) la clause de la `SELECT` requête. - - The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. - -- [Créer une TABLE en tant que \< table\_function ()\>](../statements/create.md#create-table-query) requête. - - It's one of the methods of creating a table. - -!!! warning "Avertissement" - Vous ne pouvez pas utiliser les fonctions de table si [allow\_ddl](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) paramètre est désactivé. - -| Fonction | Description | -|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------| -| [fichier](file.md) | Crée un [Fichier](../../engines/table_engines/special/file.md)-moteur de table. | -| [fusionner](merge.md) | Crée un [Fusionner](../../engines/table_engines/special/merge.md)-moteur de table. | -| [nombre](numbers.md) | Crée une table avec une seule colonne remplie de nombres entiers. | -| [distant](remote.md) | Vous permet d'accéder à des serveurs distants sans [Distribué](../../engines/table_engines/special/distributed.md)-moteur de table. | -| [URL](url.md) | Crée un [URL](../../engines/table_engines/special/url.md)-moteur de table. | -| [mysql](mysql.md) | Crée un [MySQL](../../engines/table_engines/integrations/mysql.md)-moteur de table. | -| [jdbc](jdbc.md) | Crée un [JDBC](../../engines/table_engines/integrations/jdbc.md)-moteur de table. | -| [ODBC](odbc.md) | Crée un [ODBC](../../engines/table_engines/integrations/odbc.md)-moteur de table. | -| [hdfs](hdfs.md) | Crée un [HDFS](../../engines/table_engines/integrations/hdfs.md)-moteur de table. | - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/fr/sql_reference/table_functions/jdbc.md b/docs/fr/sql_reference/table_functions/jdbc.md deleted file mode 100644 index dcdd332b3fb..00000000000 --- a/docs/fr/sql_reference/table_functions/jdbc.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 43 -toc_title: jdbc ---- - -# jdbc {#table-function-jdbc} - -`jdbc(jdbc_connection_uri, schema, table)` - retourne la table qui est connectée via le pilote JDBC. - -Ce tableau fonction nécessite séparé `clickhouse-jdbc-bridge` programme en cours d'exécution. -Il prend en charge les types Nullable (basé sur DDL de la table distante qui est interrogée). - -**Exemple** - -``` sql -SELECT * FROM jdbc('jdbc:mysql://localhost:3306/?user=root&password=root', 'schema', 'table') -``` - -``` sql -SELECT * FROM jdbc('mysql://localhost:3306/?user=root&password=root', 'schema', 'table') -``` - -``` sql -SELECT * FROM jdbc('datasource://mysql-local', 'schema', 'table') -``` - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/fr/sql_reference/table_functions/merge.md b/docs/fr/sql_reference/table_functions/merge.md deleted file mode 100644 index 6e9bf8216d3..00000000000 --- a/docs/fr/sql_reference/table_functions/merge.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 38 -toc_title: fusionner ---- - -# fusionner {#merge} - -`merge(db_name, 'tables_regexp')` – Creates a temporary Merge table. For more information, see the section “Table engines, Merge”. - -La structure de la table est tirée de la première table rencontrée qui correspond à l'expression régulière. - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/merge/) diff --git a/docs/fr/sql_reference/table_functions/mysql.md b/docs/fr/sql_reference/table_functions/mysql.md deleted file mode 100644 index d5bc698fc30..00000000000 --- a/docs/fr/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 42 -toc_title: mysql ---- - -# mysql {#mysql} - -Permettre `SELECT` requêtes à effectuer sur des données stockées sur un serveur MySQL distant. - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**Paramètre** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` les requêtes de `REPLACE INTO`. Si `replace_query=1` la requête est remplacé. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` expression qui est ajoutée à la `INSERT` requête. - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -Simple `WHERE` des clauses telles que `=, !=, >, >=, <, <=` sont actuellement exécutés sur le serveur MySQL. - -Le reste des conditions et le `LIMIT` les contraintes d'échantillonnage sont exécutées dans ClickHouse uniquement après la fin de la requête à MySQL. - -**Valeur Renvoyée** - -Un objet table avec les mêmes colonnes que la table MySQL d'origine. - -## Exemple D'Utilisation {#usage-example} - -Table dans MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Sélection des données de ClickHouse: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Voir Aussi {#see-also} - -- [Le ‘MySQL’ tableau moteur](../../engines/table_engines/integrations/mysql.md) -- [Utilisation de MySQL comme source de dictionnaire externe](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/fr/sql_reference/table_functions/odbc.md b/docs/fr/sql_reference/table_functions/odbc.md deleted file mode 100644 index 3e30310476b..00000000000 --- a/docs/fr/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 44 -toc_title: ODBC ---- - -# ODBC {#table-functions-odbc} - -Renvoie la table connectée via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -Paramètre: - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` fichier. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -Pour implémenter en toute sécurité les connexions ODBC, ClickHouse utilise un programme distinct `clickhouse-odbc-bridge`. Si le pilote ODBC est chargé directement depuis `clickhouse-server`, les problèmes de pilote peuvent planter le serveur ClickHouse. Clickhouse démarre automatiquement `clickhouse-odbc-bridge` lorsque cela est nécessaire. Le programme ODBC bridge est installé à partir du même package que `clickhouse-server`. - -Les champs avec l' `NULL` les valeurs de la table externe sont converties en valeurs par défaut pour le type de données de base. Par exemple, si un champ de table MySQL distant a `INT NULL` type il est converti en 0 (la valeur par défaut pour ClickHouse `Int32` type de données). - -## Exemple d'utilisation {#usage-example} - -**Obtenir des données de L'installation MySQL locale via ODBC** - -Cet exemple est vérifié pour Ubuntu Linux 18.04 et MySQL server 5.7. - -Assurez-vous que unixODBC et MySQL Connector sont installés. - -Par défaut (si installé à partir de paquets), ClickHouse démarre en tant qu'utilisateur `clickhouse`. Ainsi, vous devez créer et configurer cet utilisateur dans le serveur MySQL. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Puis configurez la connexion dans `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Vous pouvez vérifier la connexion en utilisant le `isql` utilitaire de l'installation unixODBC. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -Table dans MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Récupération des données de la table MySQL dans ClickHouse: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Voir Aussi {#see-also} - -- [Dictionnaires externes ODBC](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [Moteur de table ODBC](../../engines/table_engines/integrations/odbc.md). - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/fr/sql_reference/table_functions/remote.md b/docs/fr/sql_reference/table_functions/remote.md deleted file mode 100644 index c618215d795..00000000000 --- a/docs/fr/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 40 -toc_title: distant ---- - -# à distance, remoteSecure {#remote-remotesecure} - -Vous permet d'accéder à des serveurs distants sans `Distributed` table. - -Signature: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` ou juste `host`. L'hôte peut être spécifié comme nom de serveur ou l'adresse IPv4 ou IPv6. Une adresse IPv6 est indiquée entre crochets. Le port est le port TCP sur le serveur distant. Si le port est omis, il utilise `tcp_port` à partir du fichier de configuration du serveur (par défaut, 9000). - -!!! important "Important" - Le port est requis pour une adresse IPv6. - -Exemple: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -Plusieurs adresses séparées par des virgules. Dans ce cas, ClickHouse utilisera le traitement distribué, donc il enverra la requête à toutes les adresses spécifiées (comme les fragments avec des données différentes). - -Exemple: - -``` text -example01-01-1,example01-02-1 -``` - -Une partie de l'expression peut être spécifiée entre crochets. L'exemple précédent peut être écrite comme suit: - -``` text -example01-0{1,2}-1 -``` - -Les accolades peuvent contenir une plage de Nombres séparés par deux points (entiers non négatifs). Dans ce cas, la gamme est étendue à un ensemble de valeurs qui génèrent fragment d'adresses. Si le premier nombre commence par zéro, les valeurs sont formées avec le même alignement zéro. L'exemple précédent peut être écrite comme suit: - -``` text -example01-{01..02}-1 -``` - -Si vous avez plusieurs paires d'accolades, il génère le produit direct des ensembles correspondants. - -Les adresses et les parties d'adresses entre crochets peuvent être séparées par le symbole de tuyau (\|). Dans ce cas, les ensembles correspondants de adresses sont interprétés comme des répliques, et la requête sera envoyée à la première sain réplique. Cependant, les répliques sont itérées dans l'ordre actuellement défini dans [équilibrage](../../operations/settings/settings.md) paramètre. - -Exemple: - -``` text -example01-{01..02}-{1|2} -``` - -Cet exemple spécifie deux fragments qui ont chacun deux répliques. - -Le nombre d'adresses générées est limitée par une constante. En ce moment, c'est 1000 adresses. - -À l'aide de la `remote` la fonction de table est moins optimale que la création d'un `Distributed` table, car dans ce cas, la connexion au serveur est rétablie pour chaque requête. En outre, si des noms d'hôte, les noms sont résolus, et les erreurs ne sont pas comptés lors de travail avec diverses répliques. Lors du traitement d'un grand nombre de requêtes, créez toujours `Distributed` table à l'avance, et ne pas utiliser la `remote` table de fonction. - -Le `remote` table de fonction peut être utile dans les cas suivants: - -- Accès à un serveur spécifique pour la comparaison de données, le débogage et les tests. -- Requêtes entre différents clusters ClickHouse à des fins de recherche. -- Demandes distribuées peu fréquentes qui sont faites manuellement. -- Distribué demandes où l'ensemble des serveurs est redéfinie à chaque fois. - -Si l'utilisateur n'est pas spécifié, `default` est utilisée. -Si le mot de passe n'est spécifié, un mot de passe vide est utilisé. - -`remoteSecure` - la même chose que `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) de config ou 9440. - -[Article Original](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/fr/whats-new/changelog/2017.md b/docs/fr/whats-new/changelog/2017.md new file mode 100644 index 00000000000..713f005125b --- /dev/null +++ b/docs/fr/whats-new/changelog/2017.md @@ -0,0 +1,268 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 79 +toc_title: '2017' +--- + +### Clickhouse Version 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} + +Cette version contient des corrections de bugs pour la version précédente 1.1.54318: + +- Correction d’un bug avec condition de concurrence possible dans la réplication qui pourrait conduire à la perte de données. Ce problème affecte les versions 1.1.54310 et 1.1.54318. Si vous utilisez l’une de ces versions avec des tables répliquées, la mise à jour est fortement recommandée. Ce problème apparaît dans les journaux dans les messages d’avertissement comme `Part ... from own log doesn't exist.` Le problème est pertinent même si vous ne voyez pas ces messages dans les journaux. + +### Clickhouse Version 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} + +Cette version contient des corrections de bugs pour la version précédente 1.1.54310: + +- Correction de suppressions de ligne incorrectes lors des fusions dans le moteur SummingMergeTree +- Correction d’une fuite de mémoire dans les moteurs mergetree non compliqués +- Correction de la dégradation des performances avec des inserts fréquents dans les moteurs MergeTree +- Correction d’un problème qui causait la file d’attente de réplication pour arrêter l’exécution +- Rotation fixe et archivage des journaux du serveur + +### Clickhouse Version 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} + +#### Nouveauté: {#new-features} + +- Clé de partitionnement personnalisée pour la famille MergeTree des moteurs de table. +- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) tableau moteur. +- Ajout du support pour le chargement [CatBoost](https://catboost.yandex/) modèles et les appliquer aux données stockées dans ClickHouse. +- Ajout du support pour les fuseaux horaires avec des décalages non entiers de UTC. +- Ajout du support pour les opérations arithmétiques avec des intervalles de temps. +- La plage de valeurs pour les types Date et DateTime est étendue à l’année 2105. +- Ajouté le `CREATE MATERIALIZED VIEW x TO y` requête (spécifie une table pour stocker les données d’une vue matérialisée). +- Ajouté le `ATTACH TABLE` requête sans arguments. +- La logique de traitement des colonnes imbriquées avec des noms se terminant par-Map dans une table SummingMergeTree a été extraite dans la fonction d’agrégat sumMap. Vous pouvez maintenant spécifier ces colonnes explicitement. +- La taille maximale du dictionnaire IP trie est augmentée à 128M entrées. +- Ajout de la fonction getSizeOfEnumType. +- Ajout de la fonction d’agrégat sumWithOverflow. +- Ajout du support pour le format D’entrée Cap’n Proto. +- Vous pouvez maintenant personnaliser le niveau de compression lors de l’utilisation de l’algorithme zstd. + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes} + +- Création de tables temporaires avec un moteur autre que la Mémoire n’est pas autorisé. +- La création explicite de tables avec le moteur View ou MaterializedView n’est pas autorisée. +- Lors de la création de la table, une nouvelle vérification vérifie que l’expression de clé d’échantillonnage est incluse dans la clé primaire. + +#### Corrections De Bugs: {#bug-fixes} + +- Correction des accrochages lors de l’insertion synchrone dans une table distribuée. +- Ajout et retrait non atomiques fixes de pièces dans des tables répliquées. +- Les données insérées dans une vue matérialisée ne sont pas soumises à une déduplication inutile. +- L’exécution d’une requête vers une table distribuée pour laquelle le réplica local est en retard et les réplicas distants ne sont pas disponibles n’entraîne plus d’erreur. +- Les utilisateurs n’ont pas besoin d’autorisations d’accès au `default` base de données pour créer des tables temporaires plus. +- Correction d’un plantage lors de la spécification du type de tableau sans arguments. +- Correction des interruptions lorsque le volume du disque contenant les journaux du serveur est plein. +- Correction d’un débordement dans la fonction toRelativeWeekNum pour la première semaine de L’époque Unix. + +#### Construire Des améliorations: {#build-improvements} + +- Plusieurs bibliothèques tierces (notamment Poco) ont été mises à jour et converties en sous-modules git. + +### Clickhouse Version 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} + +#### Nouveauté: {#new-features-1} + +- Prise en charge TLS dans le protocole natif (pour activer, définir `tcp_ssl_port` dans `config.xml` ). + +#### Corrections De Bugs: {#bug-fixes-1} + +- `ALTER` pour les tables répliquées essaie maintenant de commencer à s’exécuter dès que possible. +- Fixe plante lors de la lecture des données avec le paramètre `preferred_block_size_bytes=0.` +- Plantages fixes de `clickhouse-client` lorsque vous appuyez sur `Page Down` +- L’interprétation correcte de certaines requêtes complexes avec `GLOBAL IN` et `UNION ALL` +- `FREEZE PARTITION` fonctionne toujours atomiquement maintenant. +- Les requêtes POST vides renvoient maintenant une réponse avec le code 411. +- Correction d’erreurs d’interprétation pour des expressions comme `CAST(1 AS Nullable(UInt8)).` +- Correction d’une erreur lors de la lecture `Array(Nullable(String))` les colonnes de `MergeTree` table. +- Fixe s’écraser lors de l’analyse des requêtes comme `SELECT dummy AS dummy, dummy AS b` +- Les utilisateurs sont mis à jour correctement avec invalide `users.xml` +- Manipulation correcte lorsqu’un dictionnaire exécutable renvoie un code de réponse différent de zéro. + +### Clickhouse Version 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} + +#### Nouveauté: {#new-features-2} + +- Ajouté le `pointInPolygon` fonction pour travailler avec des coordonnées sur un plan de coordonnées. +- Ajouté le `sumMap` fonction d’agrégation pour calculer la somme des tableaux, similaire à `SummingMergeTree`. +- Ajouté le `trunc` fonction. Amélioration des performances des fonctions d’arrondi (`round`, `floor`, `ceil`, `roundToExp2`) et corrigé la logique de la façon dont ils fonctionnent. Changé la logique de la `roundToExp2` fonction pour les fractions et les nombres négatifs. +- Le fichier exécutable ClickHouse dépend maintenant moins de la version libc. Le même fichier exécutable ClickHouse peut fonctionner sur une grande variété de systèmes Linux. Il existe toujours une dépendance lors de l’utilisation de requêtes compilées (avec le paramètre `compile = 1` qui n’est pas utilisé par défaut). +- Réduit le temps nécessaire à la compilation dynamique des requêtes. + +#### Corrections De Bugs: {#bug-fixes-2} + +- Correction d’une erreur qui produisait parfois `part ... intersects previous part` messages et cohérence des répliques affaiblies. +- Correction d’une erreur qui a provoqué le verrouillage du serveur si ZooKeeper n’était pas disponible pendant l’arrêt. +- Suppression de la journalisation excessive lors de la restauration des répliques. +- Correction d’une erreur dans L’Union toute la mise en œuvre. +- Correction d’une erreur dans la fonction concat qui s’est produite si la première colonne d’un bloc a le type de tableau. +- La progression est maintenant affichée correctement dans le système.fusionne table. + +### Clickhouse Version 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} + +#### Nouveauté: {#new-features-3} + +- `SYSTEM` les requêtes pour l’administration du serveur: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. +- Ajout de fonctions pour travailler avec des tableaux: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. +- Ajouter `root` et `identity` paramètres pour la configuration de ZooKeeper. Cela vous permet d’isoler des utilisateurs individuels sur le même cluster ZooKeeper. +- Fonctions d’agrégation ajoutées `groupBitAnd`, `groupBitOr`, et `groupBitXor` (pour la compatibilité, ils sont également disponibles sous les noms de `BIT_AND`, `BIT_OR`, et `BIT_XOR`). +- Les dictionnaires externes peuvent être chargés à partir de MySQL en spécifiant un socket dans le système de fichiers. +- Les dictionnaires externes peuvent être chargés à partir de MySQL sur SSL (`ssl_cert`, `ssl_key`, `ssl_ca` paramètre). +- Ajouté le `max_network_bandwidth_for_user` paramètre pour limiter l’utilisation globale de la bande passante pour les requêtes par utilisateur. +- Soutien pour `DROP TABLE` pour les tables temporaires. +- Support pour la lecture `DateTime` valeurs au format d’horodatage Unix de `CSV` et `JSONEachRow` format. +- Les répliques en retard dans les requêtes distribuées sont maintenant exclues par défaut (le seuil par défaut est de 5 minutes). +- Le verrouillage FIFO est utilisé pendant ALTER: une requête ALTER n’est pas bloquée indéfiniment pour les requêtes en cours d’exécution en continu. +- Option à définir `umask` dans le fichier de configuration. +- Amélioration des performances pour les requêtes avec `DISTINCT` . + +#### Corrections De Bugs: {#bug-fixes-3} + +- Amélioration du processus de suppression des anciens nœuds dans ZooKeeper. Auparavant, les anciens nœuds n’étaient parfois pas supprimés s’il y avait des insertions très fréquentes, ce qui faisait que le serveur était lent à s’arrêter, entre autres choses. +- Correction de la randomisation lors du choix des hôtes pour la connexion à ZooKeeper. +- Correction de l’exclusion des répliques en retard dans les requêtes distribuées si la réplique est localhost. +- Correction d’une erreur où une partie des données dans un `ReplicatedMergeTree` table pourrait être cassé après l’exécution `ALTER MODIFY` sur un élément dans un `Nested` structure. +- Correction d’une erreur qui pourrait provoquer des requêtes SELECT “hang”. +- Améliorations apportées aux requêtes DDL distribuées. +- Correction de la requête `CREATE TABLE ... AS `. +- Résolu à l’impasse dans l’ `ALTER ... CLEAR COLUMN IN PARTITION` requête pour `Buffer` table. +- Correction de la valeur par défaut invalide pour `Enum` s (0 au lieu du minimum) lors de l’utilisation du `JSONEachRow` et `TSKV` format. +- Résolu l’apparition de processus zombies lors de l’utilisation d’un dictionnaire avec un `executable` source. +- Correction de segfault pour la requête HEAD. + +#### Workflow amélioré Pour développer Et Assembler ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse} + +- Vous pouvez utiliser `pbuilder` pour construire ClickHouse. +- Vous pouvez utiliser `libc++` plutôt `libstdc++` pour construit sur Linux. +- Ajout d’instructions pour l’utilisation d’outils d’analyse de code statique: `Coverage`, `clang-tidy`, `cppcheck`. + +#### Veuillez Noter Lors De La Mise à Niveau: {#please-note-when-upgrading} + +- Il y a maintenant une valeur par défaut plus élevée pour le paramètre MergeTree `max_bytes_to_merge_at_max_space_in_pool` (la taille totale maximale des parties de données à fusionner, en octets): elle est passée de 100 GiB à 150 GiB. Cela peut entraîner de grandes fusions s’exécutant après la mise à niveau du serveur, ce qui pourrait entraîner une charge accrue sur le sous-système de disque. Si l’espace libre disponible sur le serveur est inférieur au double de la quantité totale des fusions en cours d’exécution, toutes les autres fusions s’arrêteront, y compris les fusions de petites parties de données. Par conséquent, les requêtes D’insertion échoueront avec le message “Merges are processing significantly slower than inserts.” L’utilisation de la `SELECT * FROM system.merges` requête pour surveiller la situation. Vous pouvez également vérifier le `DiskSpaceReservedForMerge` métrique dans l’ `system.metrics` table, ou en Graphite. Vous n’avez rien à faire pour résoudre ce problème, car le problème se résoudra une fois les grandes fusions terminées. Si vous trouvez cela inacceptable, vous pouvez restaurer la valeur précédente pour le `max_bytes_to_merge_at_max_space_in_pool` paramètre. Pour ce faire, allez à l’ section dans config.xml, ensemble ``` ``107374182400 ``` et redémarrer le serveur. + +### Clickhouse Version 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} + +- C’est une version de correction de la précédente 1.1.54282 libération. Il corrige les fuites dans le répertoire des pièces dans ZooKeeper. + +### Clickhouse Version 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} + +Cette version contient des corrections de bugs pour la version précédente 1.1.54276: + +- Fixe `DB::Exception: Assertion violation: !_path.empty()` lors de l’insertion dans une table distribuée. +- Correction de l’analyse lors de l’insertion au format RowBinary si les données d’entrée commencent par’;’. +- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). + +### Clickhouse Version 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} + +#### Nouveauté: {#new-features-4} + +- Ajout d’une section facultative avec pour une requête SELECT. Exemple de requête: `WITH 1+1 AS a SELECT a, a*a` +- INSERT peut être effectué de manière synchrone dans une table distribuée: OK n’est retourné qu’une fois toutes les données enregistrées sur tous les fragments. Ceci est activé par le paramètre insert\_distributed\_sync = 1. +- Ajout du type de données UUID pour travailler avec des identifiants de 16 octets. +- Ajout D’alias de CHAR, FLOAT et d’autres types pour la compatibilité avec Tableau. +- Ajout des fonctions toYYYYMM, toYYYYMMDD et toYYYYMMDDhhmmss pour convertir le temps en nombres. +- Vous pouvez utiliser les adresses IP (avec le nom d’hôte) pour identifier les serveurs pour les requêtes DDL en cluster. +- Ajout du support pour les arguments non constants et les décalages négatifs dans la fonction `substring(str, pos, len).` +- Ajout du paramètre max\_size pour `groupArray(max_size)(column)` fonction d’agrégation, et optimisé ses performances. + +#### Les Principaux Changements: {#main-changes} + +- Améliorations de la sécurité: tous les fichiers du serveur sont créés avec des autorisations 0640 (peuvent être modifiés via paramètre de configuration). +- Amélioration des messages d’erreur pour les requêtes avec une syntaxe invalide. +- Réduction significative de la consommation de mémoire et amélioration des performances lors de la fusion de grandes sections de données MergeTree. +- Augmentation significative des performances des fusions de données pour le Remplacementmergetree engine. +- Amélioration des performances pour les insertions asynchrones à partir d’une table distribuée en combinant plusieurs insertions sources. Pour activer cette fonctionnalité, utilisez le paramètre distributed\_directory\_monitor\_batch\_inserts=1. + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-1} + +- Modification du format binaire des états agrégés de `groupArray(array_column)` fonctions pour les tableaux. + +#### Liste complète Des Modifications: {#complete-list-of-changes} + +- Ajouté le `output_format_json_quote_denormals` paramètre, qui permet la sortie des valeurs NaN et inf au format JSON. +- Allocation de flux optimisée lors de la lecture à partir d’une table distribuée. +- Les paramètres peuvent être configurés en mode Lecture seule si la valeur ne change pas. +- Ajout de la possibilité de récupérer des granules non entiers du moteur MergeTree afin de respecter les restrictions sur la taille de bloc spécifiée dans le paramètre preferred\_block\_size\_bytes. Le but est de réduire la consommation de RAM et d’augmenter la localisation du cache lors du traitement des requêtes à partir de tables avec de grandes colonnes. +- Utilisation efficace des index qui contiennent des expressions comme `toStartOfHour(x)` pour des conditions comme `toStartOfHour(x) op сonstexpr.` +- Ajout de nouveaux paramètres pour les moteurs MergeTree (la section merge\_tree dans config.XML): + - replicated\_deduplication\_window\_seconds définit le nombre de secondes autorisé pour la déduplication des insertions dans les tables répliquées. + - cleanup\_delay\_period définit la fréquence de démarrage du nettoyage pour supprimer les données obsolètes. + - replicated\_can\_become\_leader peut empêcher une réplique de devenir le leader (et d’affecter des fusions). +- Nettoyage accéléré pour supprimer les données obsolètes de ZooKeeper. +- Plusieurs améliorations et corrections pour les requêtes ddl en cluster. Un intérêt particulier est le nouveau paramètre distributed\_ddl\_task\_timeout, qui limite le temps d’attente d’une réponse des serveurs du cluster. Si une requête ddl n’a pas été effectuée sur tous les hôtes, une réponse contiendra une erreur de délai d’attente et une requête sera exécutée en mode asynchrone. +- Amélioration de l’affichage des traces de pile dans les journaux du serveur. +- Ajouté le “none” valeur pour la méthode de compression. +- Vous pouvez utiliser plusieurs sections dictionaries\_config dans config.XML. +- Il est possible de se connecter à MySQL via un socket dans le système de fichiers. +- Système.table de pièces a une nouvelle colonne avec des informations sur la taille des marques, en octets. + +#### Corrections De Bugs: {#bug-fixes-4} + +- Les tables distribuées utilisant une table de fusion fonctionnent maintenant correctement pour une requête SELECT avec une condition sur le `_table` champ. +- Correction d’une condition de course rare dans ReplicatedMergeTree lors de la vérification des pièces de données. +- Fixe le gel sur “leader election” lors du démarrage d’un serveur. +- Le paramètre max\_replica\_delay\_for\_distributed\_queries a été ignoré lors de l’utilisation d’une réplique locale de la source de données. Ce problème a été corrigé. +- Correction d’un comportement incorrect de `ALTER TABLE CLEAR COLUMN IN PARTITION` lorsque vous tentez de nettoyer une colonne non existante. +- Correction d’une exception dans la fonction multiIf lors de l’utilisation de tableaux ou de chaînes vides. +- Correction d’allocations de mémoire excessives lors de la désérialisation du format natif. +- Correction d’une mise à jour automatique incorrecte des dictionnaires Trie. +- Correction d’une exception lors de l’exécution de requêtes avec une clause GROUP BY à partir d’une table de fusion lors de l’utilisation D’un exemple. +- Correction d’un plantage de GROUP BY lors de l’utilisation de distributed\_aggregation\_memory\_efficient=1. +- Vous pouvez maintenant spécifier la base de données.table dans le côté droit de IN et JOIN. +- Trop de threads ont été utilisés pour l’agrégation parallèle. Ce problème a été corrigé. +- Correction de la façon dont le “if” fonction fonctionne avec des arguments FixedString. +- SELECT a mal fonctionné à partir d’une table distribuée pour les fragments avec un poids de 0. Ce problème a été corrigé. +- Exécuter `CREATE VIEW IF EXISTS no longer causes crashes.` +- Correction d’un comportement incorrect lorsque input\_format\_skip\_unknown\_fields = 1 est défini et qu’il existe des nombres négatifs. +- Correction d’une boucle infinie dans le `dictGetHierarchy()` fonction s’il y a des données non valides dans le dictionnaire. +- Fixe `Syntax error: unexpected (...)` erreurs lors de l’exécution de requêtes distribuées avec des sous-requêtes dans une clause IN ou JOIN et des tables de fusion. +- Correction d’une interprétation incorrecte D’une requête SELECT à partir de tables de dictionnaire. +- Correction de l’ “Cannot mremap” erreur lors de l’utilisation de tableaux dans In et JOIN clauses avec plus de 2 milliards d’éléments. +- Correction du basculement pour les dictionnaires avec MySQL comme source. + +#### Workflow amélioré Pour développer Et Assembler ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} + +- Construit peuvent être assemblés en Arcadie. +- Vous pouvez utiliser gcc 7 pour compiler ClickHouse. +- Les builds parallèles utilisant ccache + distcc sont plus rapides maintenant. + +### Clickhouse Version 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} + +#### Nouveauté: {#new-features-5} + +- DDL distribué (par exemple, `CREATE TABLE ON CLUSTER`) +- La réplication de la requête `ALTER TABLE CLEAR COLUMN IN PARTITION.` +- Le moteur pour les tables de dictionnaire (accès aux données du dictionnaire sous la forme d’une table). +- Moteur de base de données de dictionnaire (ce type de base de données a automatiquement des tables de dictionnaire disponibles pour tous les dictionnaires externes connectés). +- Vous pouvez vérifier les mises à jour du dictionnaire en envoyant une demande à la source. +- Noms de colonnes qualifiés +- Les identificateurs entre des guillemets doubles. +- Sessions dans L’interface HTTP. +- La requête OPTIMIZE pour une table répliquée peut s’exécuter non seulement sur le leader. + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-2} + +- Supprimé ensemble GLOBAL. + +#### Des Modifications Mineures: {#minor-changes} + +- Maintenant, après le déclenchement d’une alerte, le journal imprime la trace complète de la pile. +- Détendu la vérification du nombre de pièces de données endommagées/supplémentaires au démarrage (il y avait trop de faux positifs). + +#### Corrections De Bugs: {#bug-fixes-5} + +- Correction d’une mauvaise connexion “sticking” lors de l’insertion dans une table distribuée. +- GLOBAL in fonctionne maintenant pour une requête à partir d’une table de fusion qui regarde une table distribuée. +- Le nombre incorrect de cœurs a été détecté sur une machine virtuelle Google Compute Engine. Ce problème a été corrigé. +- Changements dans le fonctionnement d’une source exécutable de dictionnaires externes mis en cache. +- Correction de la comparaison des chaînes contenant des caractères nuls. +- Correction de la comparaison des champs de clé primaire Float32 avec des constantes. +- Auparavant, une estimation incorrecte de la taille d’un champ pouvait entraîner des allocations trop importantes. +- Correction d’un plantage lors de l’interrogation d’une colonne Nullable ajoutée à une table en utilisant ALTER. +- Correction d’un plantage lors du tri par une colonne Nullable, si le nombre de lignes est inférieur à la limite. +- Correction d’une commande par sous-requête composée uniquement de valeurs constantes. +- Auparavant, une table répliquée pouvait rester dans l’état non valide après l’échec d’une table de suppression. +- Les alias des sous-requêtes scalaires avec des résultats vides ne sont plus perdus. +- Maintenant, une requête qui a utilisé la compilation n’échoue pas avec une erreur si le fichier. so est endommagé. diff --git a/docs/fr/whats-new/changelog/2018.md b/docs/fr/whats-new/changelog/2018.md new file mode 100644 index 00000000000..be6112f108e --- /dev/null +++ b/docs/fr/whats-new/changelog/2018.md @@ -0,0 +1,1063 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 78 +toc_title: '2018' +--- + +## Clickhouse Version 18.16 {#clickhouse-release-18-16} + +### Clickhouse Version 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} + +#### Corrections De Bugs: {#bug-fixes} + +- Correction d’une erreur qui a conduit à des problèmes avec la mise à jour des dictionnaires avec la source ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- La compilation JIT des fonctions d’agrégat fonctionne maintenant avec des colonnes LowCardinality. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) + +#### Amélioration: {#improvements} + +- Ajouté le `low_cardinality_allow_in_native_format` paramètre enabled (activé, option par défaut). Lorsqu’elles sont désactivées, les colonnes LowCardinality seront converties en colonnes ordinaires pour les requêtes SELECT et les colonnes ordinaires seront attendues pour les requêtes INSERT. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) + +#### Construire Des améliorations: {#build-improvements} + +- Corrections pour les builds sur macOS et ARM. + +### Clickhouse Version 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} + +#### Nouveauté: {#new-features} + +- `DEFAULT` les expressions sont évaluées pour les champs manquants lors du chargement de données dans des formats d’entrée semi-structurés (`JSONEachRow`, `TSKV`). La fonction est activée avec le `insert_sample_with_metadata` paramètre. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) +- Le `ALTER TABLE` la requête a maintenant la `MODIFY ORDER BY` action pour changer la clé de tri lors de l’ajout ou de la suppression d’une colonne de table. Ceci est utile pour les tables dans la `MergeTree` famille qui effectuent des tâches supplémentaires lors de la fusion en fonction de cette clé de tri, telles que `SummingMergeTree`, `AggregatingMergeTree` et ainsi de suite. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) +- Pour les tableaux dans le `MergeTree` famille, maintenant vous pouvez spécifier une clé de tri différente (`ORDER BY`) et de l’indice de (`PRIMARY KEY`). La clé de tri peut être plus longue que l’index. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) +- Ajouté le `hdfs` fonction de table et le `HDFS` moteur de table pour l’importation et l’exportation de données vers HDFS. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) +- Ajout de fonctions pour travailler avec base64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) +- Vous pouvez maintenant utiliser un paramètre pour configurer la précision du `uniqCombined` fonction d’agrégation (sélectionnez le nombre de cellules HyperLogLog). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) +- Ajouté le `system.contributors` table qui contient les noms de tous ceux qui ont fait des commits dans ClickHouse. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) +- Ajout de la possibilité d’omettre la partition de l’ `ALTER TABLE ... FREEZE` requête en vue de sauvegarder toutes les partitions à la fois. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) +- Ajouter `dictGet` et `dictGetOrDefault` fonctions qui ne nécessitent pas de spécifier le type de valeur de retour. Le type est déterminé automatiquement à partir de la description du dictionnaire. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3564) +- Vous pouvez maintenant spécifier des commentaires pour une colonne dans la description de la table et la modifier en utilisant `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) +- La lecture est prise en charge pour `Join` tapez des tables avec des touches simples. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Vous pouvez maintenant spécifier les options `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, et `join_overflow_mode` lors de la création d’un `Join` type de table. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Ajouté le `joinGet` fonction qui permet d’utiliser un `Join` tapez table comme un dictionnaire. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Ajouté le `partition_key`, `sorting_key`, `primary_key`, et `sampling_key` les colonnes de la `system.tables` table afin de fournir des informations sur les clés de table. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Ajouté le `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, et `is_in_sampling_key` les colonnes de la `system.columns` table. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Ajouté le `min_time` et `max_time` les colonnes de la `system.parts` table. Ces colonnes sont remplies lorsque la clé de partitionnement est une expression composée de `DateTime` colonne. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) + +#### Corrections De Bugs: {#bug-fixes-1} + +- Corrections et améliorations des performances pour `LowCardinality` type de données. `GROUP BY` utiliser `LowCardinality(Nullable(...))`. Obtenir les valeurs de `extremes`. Traitement des fonctions d’ordre Élevé. `LEFT ARRAY JOIN`. Distribué `GROUP BY`. Fonctions qui renvoient `Array`. L’exécution de `ORDER BY`. Écrit à `Distributed` tableaux (nicelulu). Rétrocompatibilité pour `INSERT` requêtes provenant d’anciens clients qui implémentent `Native` protocole. Soutien pour `LowCardinality` pour `JOIN`. Amélioration des performances lorsque vous travaillez dans un flux unique. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) +- Correction de la façon dont le `select_sequential_consistency` l’option fonctionne. Auparavant, lorsque ce paramètre était activé, un résultat incomplet était parfois renvoyé après avoir commencé à écrire sur une nouvelle partition. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) +- Les bases de données sont correctement spécifiées lors de L’exécution de DDL `ON CLUSTER` les requêtes et `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Les bases de données sont correctement spécifiées pour les sous-requêtes à l’intérieur d’une vue. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Correction d’un bug dans `PREWHERE` avec `FINAL` pour `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) +- Maintenant, vous pouvez utiliser `KILL QUERY` pour annuler les requêtes qui n’ont pas encore démarré car elles attendent que la table soit verrouillée. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) +- Correction des calculs de date et d’heure si les horloges ont été déplacées à minuit (cela se produit en Iran, et est arrivé à Moscou de 1981 à 1983). Auparavant, cela a conduit à la réinitialisation de l’heure un jour plus tôt que nécessaire, et a également provoqué un formatage incorrect de la date et de l’heure au format texte. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) +- Correction de bugs dans certains cas, de `VIEW` et les sous-requêtes qui omettent la base de données. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Correction d’une condition de course lors de la lecture simultanée d’un `MATERIALIZED VIEW` et la suppression d’un `MATERIALIZED VIEW` en raison de ne pas verrouiller l’interne `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) +- Correction de l’erreur `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) +- Correction du traitement des requêtes lorsque le `compile_expressions` option est activée (elle est activée par défaut). Expressions constantes non déterministes comme le `now` fonction ne sont plus déplié. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) +- Correction d’un plantage lors de la spécification d’un argument d’échelle non constant dans `toDecimal32/64/128` fonction. +- Correction d’une erreur lors de l’insertion d’un tableau avec `NULL` éléments dans le `Values` formater dans une colonne de type `Array` sans `Nullable` (si `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) +- Fixe continue de journalisation des erreurs dans `DDLWorker` si la Gardienne n’est pas disponible. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) +- Correction du type de retour pour `quantile*` les fonctions de `Date` et `DateTime` les types d’arguments. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) +- Correction de l’ `WITH` clause si elle spécifie un alias simple sans expressions. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) +- Correction du traitement des requêtes avec des sous-requêtes nommées et des noms de colonnes qualifiés lorsque `enable_optimize_predicate_expression` est activé. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) +- Correction de l’erreur `Attempt to attach to nullptr thread group` lorsque vous travaillez avec des vues matérialisées. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) +- Correction d’un plantage lors du passage de certains arguments incorrects `arrayReverse` fonction. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- Correction du débordement de tampon dans le `extractURLParameter` fonction. Amélioration de la performance. Ajout d’un traitement correct des chaînes contenant zéro octet. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) +- Dépassement de tampon fixe dans le `lowerUTF8` et `upperUTF8` fonction. Retiré la possibilité d’exécuter ces fonctions sur `FixedString` tapez les arguments. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) +- Correction d’une condition de course rare lors de la suppression `MergeTree` table. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) +- Correction d’une condition de course lors de la lecture de `Buffer` tables et effectuer simultanément `ALTER` ou `DROP` sur les tables cibles. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) +- Correction d’un segfault si le `max_temporary_non_const_columns` limite a été dépassée. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### Amélioration: {#improvements-1} + +- Le serveur n’écrit pas les fichiers de configuration traités `/etc/clickhouse-server/` répertoire. Au lieu de cela, il les enregistre dans la `preprocessed_configs` répertoire à l’intérieur `path`. Cela signifie que l’ `/etc/clickhouse-server/` répertoire n’ont pas d’accès en écriture pour le `clickhouse` de l’utilisateur, ce qui améliore la sécurité. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) +- Le `min_merge_bytes_to_use_direct_io` l’option est définie sur 10 GiB par défaut. Une fusion qui forme de grandes parties de tables de la famille MergeTree sera effectuée dans `O_DIRECT` mode, qui empêche l’expulsion excessive du cache de page. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) +- Démarrage accéléré du serveur lorsqu’il y a un très grand nombre de tables. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) +- Ajout d’un pool de connexion et HTTP `Keep-Alive` pour les connexions entre les répliques. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) +- Si la syntaxe de la requête n’est pas `400 Bad Request` le code est renvoyé dans la `HTTP` interface (500 a été retourné précédemment). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) +- Le `join_default_strictness` l’option est définie sur `ALL` par défaut, pour la compatibilité. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) +- Suppression de la journalisation vers `stderr` à partir de la `re2` bibliothèque pour les expressions régulières non valides ou complexes. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) +- Ajouté pour la `Kafka` moteur de table: vérifie les abonnements avant de commencer à lire à partir de Kafka; le paramètre kafka\_max\_block\_size pour la table. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) +- Le `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, et `murmurHash3_64` fonctions maintenant travailler pour n’importe quel nombre d’arguments et des arguments sous la forme de tuples. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) +- Le `arrayReverse` fonction fonctionne maintenant avec tous les types de tableaux. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- Ajout d’un paramètre optionnel: la taille de l’emplacement pour le `timeSlots` fonction. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) +- Pour `FULL` et `RIGHT JOIN`, le `max_block_size` le paramètre est utilisé pour un flux de données non jointes à partir de la table de droite. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3699) +- Ajouté le `--secure` paramètre de ligne de commande dans `clickhouse-benchmark` et `clickhouse-performance-test` pour activer TLS. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) +- Conversion de Type lorsque la structure d’un `Buffer` type table ne correspond pas à la structure de la table de destination. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) +- Ajouté le `tcp_keep_alive_timeout` option pour activer les paquets persistant après une inactivité de l’intervalle de temps spécifié. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) +- Suppression des guillemets inutiles de valeurs pour la clé de partition dans le `system.parts` le tableau si il se compose d’une seule colonne. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) +- La fonction modulo fonctionne pour `Date` et `DateTime` types de données. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) +- Ajouté synonymes pour le `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, et `MID` fonction. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Certains noms de fonctions sont insensibles à la casse pour la compatibilité avec le standard SQL. Sucre syntaxique ajouté `SUBSTRING(expr FROM start FOR length)` pour la compatibilité avec SQL. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) +- Ajout de la possibilité de `mlock` pages mémoire correspondant à `clickhouse-server` code exécutable pour l’empêcher d’être forcé hors de la mémoire. Cette fonctionnalité est désactivée par défaut. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) +- Amélioration des performances lors de la lecture de `O_DIRECT` (avec l’ `min_bytes_to_use_direct_io` option activée). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) +- Amélioration de la performance de l’ `dictGet...OrDefault` fonction pour un argument clé constant et un argument par défaut non constant. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3563) +- Le `firstSignificantSubdomain` la fonction traite maintenant les domaines `gov`, `mil`, et `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Amélioration de la performance. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) +- Possibilité de spécifier des variables d’environnement personnalisées pour le démarrage `clickhouse-server` à l’aide de la `SYS-V init.d` script en définissant `CLICKHOUSE_PROGRAM_ENV` dans `/etc/default/clickhouse`. + [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) +- Code de retour Correct pour le script d’initialisation clickhouse-server. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) +- Le `system.metrics` la table a maintenant le `VersionInteger` métrique, et `system.build_options` a la ligne ajoutée `VERSION_INTEGER`, qui contient la forme numérique de la version ClickHouse, telle que `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) +- Retiré la possibilité de comparer la `Date` tapez avec un nombre pour éviter les erreurs potentielles comme `date = 2018-12-17`, où les citations autour de la date sont omises par erreur. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) +- Correction du comportement des fonctions avec État comme `rowNumberInAllBlocks`. Ils ont précédemment sorti un résultat qui était un nombre plus grand en raison du démarrage lors de l’analyse de la requête. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3729) +- Si l’ `force_restore_data` le fichier ne peut pas être supprimé, un message d’erreur est affiché. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3794) + +#### Construire Des améliorations: {#build-improvements-1} + +- Mise à jour le `jemalloc` bibliothèque, qui corrige une fuite de mémoire potentielle. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3557) +- Profilage avec `jemalloc` est activé par défaut pour les versions de débogage. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) +- Ajout de la possibilité d’exécuter des tests d’intégration lorsque `Docker` est installé sur le système. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) +- Ajout du test d’expression fuzz dans les requêtes SELECT. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) +- Ajout d’un test de stress pour les commits, qui effectue des tests fonctionnels en parallèle et dans un ordre aléatoire pour détecter plus de conditions de course. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) +- Amélioration de la méthode de démarrage de clickhouse-server dans une image Docker. [Elghazal Ahmed](https://github.com/ClickHouse/ClickHouse/pull/3663) +- Pour une image Docker, ajout du support pour l’initialisation des bases de données à l’aide de fichiers dans le `/docker-entrypoint-initdb.d` répertoire. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) +- Corrections pour les builds sur ARM. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes} + +- Retiré la possibilité de comparer la `Date` tapez avec un numéro. Plutôt `toDate('2018-12-18') = 17883`, vous devez utiliser la conversion de type explicite `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) + +## Clickhouse Version 18.14 {#clickhouse-release-18-14} + +### Clickhouse Version 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} + +#### Corrections De Bugs: {#bug-fixes-2} + +- Correction d’une erreur qui a conduit à des problèmes avec la mise à jour des dictionnaires avec la source ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- Les bases de données sont correctement spécifiées lors de L’exécution de DDL `ON CLUSTER` requête. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Correction d’un segfault si le `max_temporary_non_const_columns` limite a été dépassée. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### Construire Des améliorations: {#build-improvements-2} + +- Corrections pour les builds sur ARM. + +### Clickhouse Version 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} + +#### Corrections De Bugs: {#bug-fixes-3} + +- Correction d’une erreur dans `dictGet...` fonction pour les dictionnaires de type `range` si un des arguments est constante et l’autre ne l’est pas. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) +- Correction d’une erreur qui a causé des messages `netlink: '...': attribute type 1 has an invalid length` pour être imprimé dans le journal du noyau Linux, cela ne se passait que sur des versions assez fraîches du noyau Linux. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) +- Fixe erreur de segmentation en fonction `empty` pour l’argument de `FixedString` type. [Daniel, Dao Quang Minh](https://github.com/ClickHouse/ClickHouse/pull/3703) +- Correction d’une allocation de mémoire excessive lors de l’utilisation d’une grande valeur de `max_query_size` (a la mémoire de morceau de `max_query_size` octets a été préalloué à la fois). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) + +#### Construire Des Changements: {#build-changes} + +- Correction de la construction avec les bibliothèques LLVM/Clang de la version 7 à partir des paquets du système D’exploitation (ces bibliothèques sont utilisées pour la compilation de requêtes d’exécution). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### Clickhouse Version 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} + +#### Corrections De Bugs: {#bug-fixes-4} + +- Correction de cas où le processus de pont ODBC ne s’est pas terminé avec le processus du serveur principal. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) +- Insertion synchrone fixe dans le `Distributed` table avec une liste des colonnes qui diffère de la liste des colonnes de la table distante. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) +- Correction d’une condition de concurrence rare qui peut conduire à un crash lors de la suppression D’une table MergeTree. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Correction d’un blocage de requête dans le cas où la création de thread de requête échoue avec le `Resource temporarily unavailable` erreur. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Fixe de l’analyse de l’ `ENGINE` clause lorsque le `CREATE AS table` la syntaxe a été utilisée et `ENGINE` la clause a été spécifiée avant le `AS table` (l’erreur a entraîné en ignorant le moteur). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) + +### Clickhouse Version 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} + +#### Corrections De Bugs: {#bug-fixes-5} + +- La taille du bloc de mémoire a été surestimée lors de la désérialisation de la colonne de type `Array(String)` qui conduit à “Memory limit exceeded” erreur. Le problème est apparu dans la version 18.12.13. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) + +### Clickhouse Version 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} + +#### Corrections De Bugs: {#bug-fixes-6} + +- Fixe `ON CLUSTER` requêtes lorsque le cluster est configuré comme sécurisé (indicateur ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) + +#### Construire Des Changements: {#build-changes-1} + +- Correction de problèmes (llvm-7 du système, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### Clickhouse Version 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} + +#### Corrections De Bugs: {#bug-fixes-7} + +- Correction de l’ `Block structure mismatch in MergingSorted stream` erreur. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) +- Fixe `ON CLUSTER` requêtes dans le cas où les connexions sécurisées ont été activées dans la configuration du cluster (le `` drapeau). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) +- Correction d’une erreur dans les requêtes utilisées `SAMPLE`, `PREWHERE` et les colonnes alias. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) +- Correction d’un rare `unknown compression method` erreur lors de la `min_bytes_to_use_direct_io` le réglage a été activé. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) + +#### Amélioration Des Performances: {#performance-improvements} + +- Régression de performance fixe des requêtes avec `GROUP BY` de colonnes de type UInt16 ou Date lors de l’exécution sur les processeurs AMD EPYC. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) +- Correction de la régression des performances des requêtes qui traitent les chaînes longues. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) + +#### Construire Des améliorations: {#build-improvements-3} + +- Améliorations pour simplifier la construction Arcadia. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) + +### Clickhouse Version 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} + +#### Corrections De Bugs: {#bug-fixes-8} + +- Correction d’un plantage lors de la jonction de deux sous-requêtes sans nom. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) +- Fixe générant des requêtes incorrectes (avec un vide `WHERE` clause) lors de l’interrogation de bases de données externes. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) +- Correction en utilisant une valeur de délai d’attente incorrecte Dans les dictionnaires ODBC. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) + +### Clickhouse Version 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} + +#### Corrections De Bugs: {#bug-fixes-9} + +- Correction de l’erreur `Block structure mismatch in UNION stream: different number of columns` dans les requêtes LIMIT. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) +- Correction d’erreurs lors de la fusion de données dans des tables contenant des tableaux à l’intérieur de structures imbriquées. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) +- Correction de résultats de requête incorrects si le `merge_tree_uniform_read_distribution` paramètre est désactivé (il est activé par défaut). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) +- Correction d’une erreur sur les insertions à une table distribuée au format natif. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) + +### Clickhouse Version 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} + +- Le `compile_expressions` le paramètre (compilation JIT d’expressions) est désactivé par défaut. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) +- Le `enable_optimize_predicate_expression` paramètre est désactivé par défaut. + +### Clickhouse Version 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} + +#### Nouveauté: {#new-features-1} + +- Le `WITH CUBE` le modificateur `GROUP BY` (la syntaxe alternative `GROUP BY CUBE(...)` est également disponible). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) +- Ajouté le `formatDateTime` fonction. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) +- Ajouté le `JDBC` tableau moteur et `jdbc` fonction table (nécessite l’installation de clickhouse-JDBC-bridge). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- Ajout de fonctions pour travailler avec le numéro de semaine ISO: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, et `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) +- Maintenant, vous pouvez utiliser `Nullable` colonnes pour `MySQL` et `ODBC` table. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- Imbriquée structures de données peuvent être lues comme des objets imbriqués dans `JSONEachRow` format. Ajouté le `input_format_import_nested_json` paramètre. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) +- Le traitement parallèle est disponible pour beaucoup `MATERIALIZED VIEW`s lors de l’insertion de données. Voir la `parallel_view_processing` paramètre. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) +- Ajouté le `SYSTEM FLUSH LOGS` requête (vidage forcé des journaux sur les tables système telles que `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) +- Maintenant, vous pouvez utiliser prédéfinis `database` et `table` macros lors de la déclaration `Replicated` table. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) +- A ajouté la capacité de lire `Decimal` valeurs de type en notation d’ingénierie (indiquant des puissances de dix). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) + +#### Caractéristiques expérimentales: {#experimental-features} + +- Optimisation de la clause GROUP BY pour `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) +- Calcul optimisé des expressions pour `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) + +#### Amélioration: {#improvements-2} + +- Consommation de mémoire considérablement réduite pour les requêtes avec `ORDER BY` et `LIMIT`. Voir la `max_bytes_before_remerge_sort` paramètre. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- En l’absence de `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` est supposé. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) +- Qualifié astérisques fonctionner correctement dans les requêtes avec `JOIN`. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) +- Le `ODBC` table engine choisit correctement la méthode de citation des identifiants dans le dialecte SQL d’une base de données distante. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- Le `compile_expressions` le paramètre (compilation JIT des expressions) est activé par défaut. +- Correction du comportement pour la base de données/TABLE DROP simultanée si existe et créer une base de données/TABLE si N’existe pas. Auparavant, un `CREATE DATABASE ... IF NOT EXISTS` requête peut renvoyer le message d’erreur “File … already exists” et la `CREATE TABLE ... IF NOT EXISTS` et `DROP TABLE IF EXISTS` les requêtes peuvent revenir `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) +- Les expressions LIKE ET IN avec une moitié droite constante sont passées au serveur distant lors de l’interrogation à partir de tables MySQL ou ODBC. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- Les comparaisons avec des expressions constantes dans une clause WHERE sont transmises au serveur distant lors de l’interrogation à partir de tables MySQL et ODBC. Auparavant, seules les comparaisons avec les constantes étaient passées. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- Calcul Correct de la largeur de ligne dans le terminal pour `Pretty` formats, y compris les chaînes avec des hiéroglyphes. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3257). +- `ON CLUSTER` peut être spécifié pour `ALTER UPDATE` requête. +- Amélioration des performances de lecture des données `JSONEachRow` format. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) +- Ajouté synonymes pour le `LENGTH` et `CHARACTER_LENGTH` fonctions de compatibilité. Le `CONCAT` la fonction n’est plus sensible à la casse. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) +- Ajouté le `TIMESTAMP` synonyme de la `DateTime` type. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) +- Il y a toujours de l’espace réservé pour query\_id dans les journaux du serveur, même si la ligne de journal n’est pas liée à une requête. Cela facilite l’analyse des journaux de texte du serveur avec des outils tiers. +- La consommation de mémoire par une requête est enregistrée lorsqu’il dépasse le niveau suivant d’un nombre entier de gigaoctets. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- Ajout du mode de compatibilité pour le cas où la bibliothèque cliente qui utilise le protocole natif envoie moins de colonnes par erreur que ce que le serveur attend pour la requête D’insertion. Ce scénario était possible lors de l’utilisation de la bibliothèque clickhouse-cpp. Auparavant, ce scénario provoquait le plantage du serveur. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) +- Dans une expression WHERE définie par l’utilisateur `clickhouse-copier` vous pouvez maintenant utiliser un `partition_key` alias (pour un filtrage supplémentaire par partition de table source). Ceci est utile si le schéma de partitionnement change pendant la copie, mais ne change que légèrement. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) +- Le flux de travail du `Kafka` le moteur a été déplacé vers un pool de threads en arrière-plan afin de réduire automatiquement la vitesse de lecture des données à des charges élevées. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- Support pour la lecture `Tuple` et `Nested` valeurs de structures comme `struct` dans le `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) +- La liste des domaines de premier niveau pour les `firstSignificantSubdomain` la fonction inclut maintenant le domaine `biz`. [décaséale](https://github.com/ClickHouse/ClickHouse/pull/3219) +- Dans la configuration des dictionnaires externes, `null_value` est interprétée comme la valeur du type de données par défaut. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) +- Soutien pour le `intDiv` et `intDivOrZero` fonctions pour `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) +- Soutien pour le `Date`, `DateTime`, `UUID`, et `Decimal` types comme clé pour le `sumMap` fonction d’agrégation. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) +- Soutien pour le `Decimal` type de données dans les dictionnaires externes. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) +- Soutien pour le `Decimal` type de données dans `SummingMergeTree` table. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) +- Ajouté spécialisations pour `UUID` dans `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) +- Réduit le nombre de `open` et `close` les appels système lors de la lecture d’un `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) +- A `TRUNCATE TABLE` requête peut être exécutée sur n’importe quel réplica (la requête est transmise au chef de réplique). [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) + +#### Corrections De Bugs: {#bug-fixes-10} + +- Correction d’un problème avec `Dictionary` tables pour `range_hashed` dictionnaire. Cette erreur s’est produite dans la version 18.12.17. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) +- Correction d’une erreur lors du chargement `range_hashed` les dictionnaires (le message `Unsupported type Nullable (...)`). Cette erreur s’est produite dans la version 18.12.17. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- Corrigé des erreurs dans la `pointInPolygon` fonction due à l’accumulation de calculs inexacts pour les polygones avec un grand nombre de sommets situés à proximité les uns des autres. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) +- Si, après la fusion de parties de données, la somme de contrôle de la partie résultante diffère du résultat de la même fusion dans une autre réplique, le résultat de la fusion est supprimé et la partie de données est téléchargée à partir de l’autre réplique (c’est le comportement correct). Mais après avoir téléchargé la partie data, elle n’a pas pu être ajoutée à l’ensemble de travail en raison d’une erreur indiquant que la partie existe déjà (car la partie data a été supprimée avec un certain retard après la fusion). Cela a conduit à cycliques tente de télécharger les mêmes données. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) +- Correction d’un calcul incorrect de la consommation totale de mémoire par les requêtes (en raison d’un calcul incorrect, le `max_memory_usage_for_all_queries` le réglage n’a pas fonctionné correctement et le `MemoryTracking` métrique a une valeur incorrecte). Cette erreur s’est produite dans la version 18.12.13. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) +- Correction de la fonctionnalité de `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` Cette erreur s’est produite dans la version 18.12.13. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) +- Correction de la préparation inutile des structures de données pour `JOIN`s sur le serveur qui initie la requête si `JOIN` est effectué uniquement sur des serveurs distants. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) +- Correction de bugs dans le `Kafka` engine: blocages après les exceptions lors du démarrage de la lecture des données, et verrous à la fin [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- Pour `Kafka` tableaux, le facultatif `schema` le paramètre n’a pas été passé (le schéma du `Cap'n'Proto` format). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) +- Si L’ensemble des serveurs ZooKeeper a des serveurs qui acceptent la connexion mais la ferment immédiatement au lieu de répondre à la prise de contact, ClickHouse choisit de connecter un autre serveur. Auparavant, cela produisait l’erreur `Cannot read all data. Bytes read: 0. Bytes expected: 4.` et le serveur ne pouvait pas commencer. [8218cf3a](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) +- Si L’ensemble des serveurs ZooKeeper contient des serveurs pour lesquels la requête DNS renvoie une erreur, ces serveurs sont ignorés. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) +- Conversion de type fixe entre `Date` et `DateTime` lors de l’insertion de données dans le `VALUES` format (si `input_format_values_interpret_expressions = 1`). Auparavant, la conversion était effectuée entre la valeur numérique du nombre de jours dans Unix Epoch time et L’horodatage Unix, ce qui conduisait à des résultats inattendus. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) +- Conversion de type corrigée entre `Decimal` et des nombres entiers. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) +- Corrigé des erreurs dans la `enable_optimize_predicate_expression` paramètre. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) +- Correction d’une erreur D’analyse au format CSV avec des nombres à virgule flottante si un séparateur CSV non par défaut est utilisé, tel que `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) +- Correction de l’ `arrayCumSumNonNegative` fonction (il n’accumule pas de valeurs négatives si l’accumulateur est inférieur à zéro). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) +- Fixe comment `Merge` les tables de travail sur le dessus de `Distributed` tables lors de l’utilisation `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) +- Corrections de bugs dans l’ `ALTER UPDATE` requête. +- Correction de bugs dans le `odbc` fonction de table apparue dans la version 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) +- Correction du fonctionnement des fonctions d’agrégat avec `StateArray` combinators. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) +- Correction d’un crash lors de la division d’une `Decimal` valeur par zéro. [69dd6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) +- Sortie fixe des types pour les opérations utilisant `Decimal` et des arguments entiers. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) +- Correction du segfault pendant `GROUP BY` sur `Decimal128`. [3359ba06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) +- Le `log_query_threads` le paramètre (journalisation des informations sur chaque thread d’exécution de la requête) ne prend effet que si `log_queries` l’option (journalisation des informations sur les requêtes) est définie sur 1. Depuis le `log_query_threads` l’option est activée par défaut, les informations sur les threads ont déjà été enregistrées même si la journalisation des requêtes a été désactivée. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) +- Correction d’une erreur dans le fonctionnement distribué de la fonction d’agrégat quantiles (le message d’erreur `Not found column quantile...`). [292a8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) +- Correction du problème de compatibilité lorsque vous travaillez sur un cluster de serveurs de version 18.12.17 et de serveurs plus anciens en même temps. Pour les requêtes distribuées avec des clés GROUP BY de longueur fixe et non fixe, s’il y avait une grande quantité de données à agréger, les données renvoyées n’étaient pas toujours entièrement agrégées (deux lignes différentes contenaient les mêmes clés d’agrégation). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) +- Manipulation fixe des substitutions dans `clickhouse-performance-test` si la requête ne contient qu’une partie des substitutions déclaré dans le test. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) +- Correction d’une erreur lors de l’utilisation `FINAL` avec `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Correction d’une erreur lors de l’utilisation `PREWHERE` sur les colonnes qui ont été ajoutées pendant `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Ajout d’une vérification de l’absence de `arrayJoin` pour `DEFAULT` et `MATERIALIZED` expression. Précédemment, `arrayJoin` conduit à une erreur lors de l’insertion de données. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) +- Ajout d’une vérification de l’absence de `arrayJoin` dans un `PREWHERE` clause. Auparavant, cela a conduit à des messages comme `Size ... doesn't match` ou `Unknown compression method` lors de l’exécution de requêtes. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) +- Correction de segfault qui pourrait se produire dans de rares cas après l’optimisation qui a remplacé et chaînes des évaluations d’égalité avec l’expression IN correspondante. [liuyimin-bytedance](https://github.com/ClickHouse/ClickHouse/pull/3339) +- Corrections mineures à `clickhouse-benchmark`: auparavant, les informations client n’étaient pas envoyées au serveur; maintenant, le nombre de requêtes exécutées est calculé plus précisément lors de l’arrêt et pour limiter le nombre d’itérations. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-1} + +- Enlevé le `allow_experimental_decimal_type` option. Le `Decimal` type de données est disponible pour utilisation par défaut. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) + +## Clickhouse Version 18.12 {#clickhouse-release-18-12} + +### Clickhouse Version 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} + +#### Nouveauté: {#new-features-2} + +- `invalidate_query` (la possibilité de spécifier une requête pour vérifier si un dictionnaire externe doit être mis à jour) est implémentée pour `clickhouse` source. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) +- Ajout de la possibilité d’utiliser `UInt*`, `Int*`, et `DateTime` types de données (avec le `Date` le type) comme un `range_hashed` clé de dictionnaire externe qui définit les limites des plages. Maintenant `NULL` peut être utilisé pour désigner un intervalle ouvert. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) +- Le `Decimal` type prend maintenant en charge `var*` et `stddev*` les fonctions d’agrégation. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- Le `Decimal` type prend désormais en charge les fonctions mathématiques (`exp`, `sin` et ainsi de suite.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- Le `system.part_log` la table a maintenant le `partition_id` colonne. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Corrections De Bugs: {#bug-fixes-11} + +- `Merge` fonctionne maintenant correctement sur `Distributed` table. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) +- Incompatibilité fixe (dépendance inutile sur le `glibc` version) qui a rendu impossible l’exécution de ClickHouse sur `Ubuntu Precise` et les anciennes versions. L’incompatibilité est apparue dans la version 18.12.13. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) +- Corrigé des erreurs dans la `enable_optimize_predicate_expression` paramètre. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) +- Correction d’un problème mineur de rétrocompatibilité apparu lors de l’utilisation d’un cluster de répliques sur des versions antérieures au 18.12.13 et de la création simultanée d’une nouvelle réplique d’une table sur un serveur avec une version plus récente (indiquée dans le message `Can not clone replica, because the ... updated to new ClickHouse version`, ce qui est logique, mais ne devrait pas arriver). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-2} + +- Le `enable_optimize_predicate_expression` option est activée par défaut (ce qui est plutôt optimiste). Si des erreurs d’analyse de requête se produisent liées à la recherche des noms de colonnes, définissez `enable_optimize_predicate_expression` à 0. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) + +### Clickhouse Version 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} + +#### Nouveauté: {#new-features-3} + +- Ajout du support pour `ALTER UPDATE` requête. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) +- Ajouté le `allow_ddl` option, qui limite l’accès de L’utilisateur aux requêtes DDL. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) +- Ajouté le `min_merge_bytes_to_use_direct_io` option pour `MergeTree` moteurs, qui vous permet de définir un seuil pour la taille totale de la fusion (quand au-dessus du seuil, les fichiers de partie de données seront traités en utilisant O\_DIRECT). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) +- Le `system.merges` la table système contient maintenant `partition_id` colonne. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) + +#### Amélioration {#improvements-3} + +- Si une partie de données reste inchangée pendant la mutation, elle n’est pas téléchargée par les répliques. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) +- La saisie semi-automatique est disponible pour les noms de paramètres lorsque vous travaillez avec `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) + +#### Corrections De Bugs: {#bug-fixes-12} + +- Ajouter un chèque pour les montants des tableaux sont des éléments de `Nested` les champs de type lors de l’insertion. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) +- Correction d’une erreur de mise à jour des dictionnaires externes `ODBC` source et `hashed` stockage. Cette erreur s’est produite dans la version 18.12.13. +- Correction d’un plantage lors de la création d’une table temporaire à partir d’une requête `IN` condition. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) +- Correction d’une erreur dans les fonctions d’agrégation pour les tableaux peuvent avoir `NULL` élément. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) + +### Clickhouse Version 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} + +#### Nouveauté: {#new-features-4} + +- Ajouté le `DECIMAL(digits, scale)` type de données (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). Pour l’activer, utilisez le paramètre `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) +- Nouveau `WITH ROLLUP` le modificateur `GROUP BY` (syntaxe alternative: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) +- Dans les requêtes avec jointure, le caractère étoile se développe en une liste de colonnes dans toutes les tables, conformément à la norme SQL. Vous pouvez restaurer l’ancien comportement en paramètre `asterisk_left_columns_only` à 1 au niveau de la configuration utilisateur. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) +- Ajout du support pour joindre avec les fonctions de table. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- Saisie semi-automatique en appuyant sur Tab dans clickhouse-client. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) +- Ctrl + C dans clickhouse-client efface une requête qui a été entrée. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) +- Ajouté le `join_default_strictness` paramètre (valeurs: `"`, `'any'`, `'all'`). Cela vous permet de ne pas préciser `ANY` ou `ALL` pour `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) +- Chaque ligne du journal du serveur associée au traitement de la requête affiche L’ID de la requête. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Maintenant, vous pouvez obtenir des journaux d’exécution de requête dans clickhouse-client (utilisez le `send_logs_level` paramètre). Avec le traitement des requêtes distribuées, les journaux sont cascadés à partir de tous les serveurs. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Le `system.query_log` et `system.processes` (`SHOW PROCESSLIST` les tableaux ont maintenant des informations sur tous les paramètres modifiés lorsque vous exécutez une requête (la structure imbriquée de l’ `Settings` données). Ajouté le `log_query_settings` paramètre. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Le `system.query_log` et `system.processes` les tables affichent désormais des informations sur le nombre de threads participant à l’exécution de la requête (voir `thread_numbers` colonne). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Ajouter `ProfileEvents` compteurs qui mesurent le temps passé à lire et à écrire sur le réseau et à lire et à écrire sur le disque, le nombre d’erreurs réseau et le temps passé à attendre lorsque la bande passante réseau est limitée. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Ajouter `ProfileEvents`compteurs qui contiennent les métriques système de rusage (vous pouvez les utiliser pour obtenir des informations sur L’utilisation du processeur dans l’espace utilisateur et le noyau, les erreurs de page et les commutateurs de contexte), ainsi que les métriques taskstats (utilisez-les pour obtenir des informations sur le temps d’attente d’E/S, le temps D’attente du processeur et [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Le `ProfileEvents` les compteurs sont appliqués globalement et pour chaque requête, ainsi que pour chaque thread d’exécution de requête, ce qui vous permet de profiler la consommation de ressources par requête en détail. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Ajouté le `system.query_thread_log` table, qui contient des informations sur chaque thread d’exécution de requête. Ajouté le `log_query_threads` paramètre. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Le `system.metrics` et `system.events` les tables ont maintenant une documentation intégrée. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) +- Ajouté le `arrayEnumerateDense` fonction. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2975) +- Ajouté le `arrayCumSumNonNegative` et `arrayDifference` fonction. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) +- Ajouté le `retention` fonction d’agrégation. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) +- Vous pouvez maintenant ajouter (fusionner) des états de fonctions d’agrégat en utilisant l’opérateur plus et multiplier les états de fonctions d’agrégat par une constante non négative. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) +- Les Tables de la famille MergeTree ont maintenant la colonne virtuelle `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Caractéristiques expérimentales: {#experimental-features-1} + +- Ajouté le `LowCardinality(T)` type de données. Ce type de données crée automatiquement un dictionnaire local de valeurs et permet le traitement des données sans déballer le dictionnaire. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) +- Ajout d’un cache de fonctions compilées JIT et d’un compteur pour le nombre d’utilisations avant la compilation. Pour compiler des expressions JIT, activez `compile_expressions` paramètre. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) + +#### Amélioration: {#improvements-4} + +- Correction du problème avec l’accumulation illimitée du journal de réplication quand il y a des répliques abandonnées. Ajout d’un mode de récupération efficace pour les répliques avec un long décalage. +- Amélioration des performances de `GROUP BY` avec l’agrégation de plusieurs champs lorsque l’un d’eux est une chaîne et les autres sont de longueur fixe. +- Amélioration des performances lors de l’utilisation `PREWHERE` et avec transfert implicite d’expressions dans `PREWHERE`. +- Amélioration des performances d’analyse pour les formats de texte (`CSV`, `TSV`). [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) +- Amélioration des performances de lecture des chaînes et des tableaux dans les formats binaires. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2955) +- Augmentation des performances et réduction de la consommation de mémoire pour les requêtes `system.tables` et `system.columns` quand il y a un très grand nombre de tables sur un seul serveur. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) +- Correction d’un problème de performances dans le cas d’un grand flux de requêtes résultant en une erreur (la `_dl_addr` la fonction est visible dans `perf top` mais le serveur n’utilise pas beaucoup de CPU). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) +- Les Conditions sont converties dans la vue (lorsque `enable_optimize_predicate_expression` est activé). [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- Améliorations de la fonctionnalité pour le `UUID` type de données. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) +- Le `UUID` le type de données est pris en charge dans les dictionnaires-Alchemist. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) +- Le `visitParamExtractRaw` la fonction fonctionne correctement avec les structures imbriquées. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) +- Lorsque l’ `input_format_skip_unknown_fields` paramètre est activé, les champs d’objet dans `JSONEachRow` format sont ignorés correctement. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) +- Pour un `CASE` expression avec conditions, vous pouvez maintenant omettre `ELSE`, ce qui est équivalent à `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) +- Le délai d’attente de l’opération peut maintenant être configuré lorsque vous travaillez avec ZooKeeper. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) +- Vous pouvez spécifier un décalage pour `LIMIT n, m` comme `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- Vous pouvez utiliser l’ `SELECT TOP n` syntaxe comme alternative pour `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- Augmentation de la taille de la file d’attente pour écrire dans les tables `SystemLog parameter queue is full` l’erreur ne se produit pas aussi souvent. +- Le `windowFunnel` fonction d’agrégation prend désormais en charge les événements qui répondent à plusieurs conditions. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2801) +- Les colonnes dupliquées peuvent être utilisées dans un `USING` la clause de `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) +- `Pretty` formats maintenant avoir une limite sur l’alignement des colonnes de largeur. L’utilisation de la `output_format_pretty_max_column_pad_width` paramètre. Si une valeur est plus large, il sera toujours affichée dans son intégralité, mais les autres cellules dans le tableau ne sera pas trop large. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) +- Le `odbc` la fonction table vous permet maintenant de spécifier le nom de la base de données / schéma. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2885) +- Ajout de la possibilité d’utiliser un nom d’utilisateur spécifié dans le `clickhouse-client` fichier de configuration. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) +- Le `ZooKeeperExceptions` compteur a été divisé en trois compteurs: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, et `ZooKeeperOtherExceptions`. +- `ALTER DELETE` les requêtes fonctionnent pour les vues matérialisées. +- Ajouté randomisation lors de l’exécution du thread de nettoyage périodiquement pour `ReplicatedMergeTree` afin d’éviter les pics de charge périodiques lorsqu’il y a un très grand nombre de `ReplicatedMergeTree` table. +- Soutien pour `ATTACH TABLE ... ON CLUSTER` requête. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) + +#### Corrections De Bugs: {#bug-fixes-13} + +- Correction d’un problème avec `Dictionary` tables (jette le `Size of offsets doesn't match size of column` ou `Unknown compression method` exception). Ce bug est apparu dans la version 18.10.3. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) +- Correction d’un bug lors de la fusion `CollapsingMergeTree` tables si l’une des parties de données est vide (ces parties sont formées lors de la fusion ou `ALTER DELETE` si toutes les données ont été supprimées), et le `vertical` l’algorithme a été utilisé pour la fusion. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) +- Correction d’une condition de course pendant `DROP` ou `TRUNCATE` pour `Memory` tables simultanément `SELECT`, ce qui pourrait conduire à des pannes de serveur. Ce bug est apparu dans la version 1.1.54388. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) +- Correction de la possibilité de perte de données lors de l’insertion dans `Replicated` des tables, si la `Session is expired` l’erreur est renvoyée (la perte de données peut être détectée par le `ReplicatedDataLoss` métrique). Cette erreur s’est produite dans la version 1.1.54378. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) +- Correction d’un segfault pendant `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) +- Correction de l’erreur de recherche des noms de colonne lorsque le `WHERE` expression se compose entièrement d’un nom de colonne qualifié, tel que `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) +- Correction de l’ “Not found column” erreur survenue lors de l’exécution de requêtes distribuées si une seule colonne composée d’une expression avec une sous-requête est demandée à partir d’un serveur distant. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) +- Correction de l’ `Block structure mismatch in UNION stream: different number of columns` erreur qui s’est produite pour les requêtes distribuées si l’un des fragments est locale et l’autre ne l’est pas, et l’optimisation de la déplacer à `PREWHERE` est déclenchée. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) +- Correction de l’ `pointInPolygon` fonction pour certains cas de polygones non convexes. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) +- Correction du résultat incorrect lors de la comparaison `nan` avec des entiers. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) +- Correction d’une erreur dans le `zlib-ng` bibliothèque qui pourrait conduire à segfault dans de rares cas. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) +- Correction d’une fuite de mémoire lors de l’insertion dans une table avec `AggregateFunction` colonnes, si l’état de la fonction d’agrégat n’est pas simple (alloue la mémoire séparément), et si une seule demande d’insertion entraîne plusieurs petits blocs. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) +- Correction d’une condition de concurrence lors de la création et la suppression de la même `Buffer` ou `MergeTree` table en même temps. +- Correction de la possibilité d’un segfault lors de la comparaison des tuples constitués de certains types non triviaux, tels que les tuples. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) +- Correction de la possibilité d’un segfault lors de l’exécution de certains `ON CLUSTER` requête. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) +- Correction d’une erreur dans le `arrayDistinct` fonction pour `Nullable` les éléments du tableau. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) +- Le `enable_optimize_predicate_expression` option prend en charge correctement les cas avec `SELECT *`. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) +- Correction du segfault lors de la réinitialisation de la session ZooKeeper. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) +- Blocage potentiel fixe lorsque vous travaillez avec ZooKeeper. +- Correction d’un code incorrect pour ajouter des structures de données imbriquées dans un `SummingMergeTree`. +- Lors de l’allocation de mémoire pour les états de fonctions d’agrégat, l’alignement est correctement pris en compte, ce qui permet d’utiliser des opérations nécessitant un alignement lors de la mise en œuvre des états de fonctions d’agrégat. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) + +#### Correction De sécurité: {#security-fix} + +- Utilisation sûre des sources de données ODBC. L’Interaction avec les pilotes ODBC utilise un `clickhouse-odbc-bridge` processus. Les erreurs dans les pilotes ODBC tiers ne causent plus de problèmes de stabilité du serveur ou de vulnérabilités. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) +- Correction d’une validation incorrecte du chemin du fichier dans le `catBoostPool` table de fonction. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) +- Le contenu des tableaux du système (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, et `replication_queue`) sont filtrés en fonction de l’accès configuré de l’utilisateur aux bases de données (`allow_databases`). [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-3} + +- Dans les requêtes avec jointure, le caractère étoile se développe en une liste de colonnes dans toutes les tables, conformément à la norme SQL. Vous pouvez restaurer l’ancien comportement en paramètre `asterisk_left_columns_only` à 1 au niveau de la configuration utilisateur. + +#### Construire Des Changements: {#build-changes-2} + +- La plupart des tests d’intégration peuvent maintenant être exécutés par commit. +- Les contrôles de style de Code peuvent également être exécutés par commit. +- Le `memcpy` l’implémentation est choisie correctement lors de la construction sur CentOS7/Fedora. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) +- Lorsque vous utilisez clang pour construire, certains avertissements de `-Weverything` ont été ajoutées, en plus de la `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) +- Débogage de la construction utilise le `jemalloc` option de débogage. +- L’interface de la bibliothèque pour interagir avec ZooKeeper est déclarée abstraite. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) + +## Clickhouse Version 18.10 {#clickhouse-release-18-10} + +### Clickhouse Version 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} + +#### Nouveauté: {#new-features-5} + +- HTTPS peut être utilisé pour la réplication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) +- Ajout des fonctions `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, et `murmurHash3_128` en plus de l’existant `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) +- Prise en charge des types Nullable dans le pilote ODBC ClickHouse (`ODBCDriver2` le format de sortie). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) +- Soutien pour `UUID` dans les colonnes de clé. + +#### Amélioration: {#improvements-5} + +- Les Clusters peuvent être supprimés sans redémarrer le serveur lorsqu’ils sont supprimés des fichiers de configuration. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) +- Les dictionnaires externes peuvent être supprimés sans redémarrer le serveur lorsqu’ils sont supprimés des fichiers de configuration. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) +- Ajouter `SETTINGS` soutien pour le `Kafka` tableau moteur. [Alexander Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) +- Des améliorations pour l’ `UUID` type de données (pas encore terminée). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) +- Prise en charge des pièces vides après fusion dans le `SummingMergeTree`, `CollapsingMergeTree` et `VersionedCollapsingMergeTree` moteur. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) +- Les anciens enregistrements de mutations terminées sont supprimés (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) +- Ajouté le `system.merge_tree_settings` table. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) +- Le `system.tables` la table a maintenant des colonnes de dépendance: `dependencies_database` et `dependencies_table`. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) +- Ajouté le `max_partition_size_to_drop` option de configuration. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) +- Ajouté le `output_format_json_escape_forward_slashes` option. [Alexandre Botcharov](https://github.com/ClickHouse/ClickHouse/pull/2812) +- Ajouté le `max_fetch_partition_retries_count` paramètre. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) +- Ajouté le `prefer_localhost_replica` paramètre permettant de désactiver la préférence pour une réplique locale et d’accéder à une réplique locale sans interaction entre processus. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) +- Le `quantileExact` fonction d’agrégation retourne `nan` dans le cas de l’agrégation sur un vide `Float32` ou `Float64` définir. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) + +#### Corrections De Bugs: {#bug-fixes-14} + +- Suppression de l’échappement inutile des paramètres de chaîne de connexion pour ODBC, ce qui rendait impossible l’établissement d’une connexion. Cette erreur s’est produite dans la version 18.6.0. +- Fixe la logique de traitement `REPLACE PARTITION` les commandes dans la file d’attente de réplication. Si il y a deux `REPLACE` pour la même partition, la logique incorrecte pourrait entraîner l’un d’entre eux de rester dans la file d’attente de réplication et ne pas être exécuté. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) +- Correction d’un bug de fusion lorsque toutes les parties de données étaient vides (parties formées à partir d’une fusion ou `ALTER DELETE` si toutes les données ont été supprimées). Ce bug est apparu dans la version 18.1.0. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) +- Correction d’une erreur pour simultanées `Set` ou `Join`. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2823) +- Correction de l’ `Block structure mismatch in UNION stream: different number of columns` erreur qui s’est produite pour `UNION ALL` requêtes dans une sous-requête si l’un des `SELECT` les requêtes contiennent des noms de colonnes en double. [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) +- Correction d’une fuite de mémoire si une exception se produisait lors de la connexion à un serveur MySQL. +- Correction d’un code de réponse clickhouse-client incorrect en cas d’erreur de requête. +- Correction d’un comportement incorrect des vues matérialisées contenant DISTINCT. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) + +#### Modifications Incompatibles En arrière {#backward-incompatible-changes-4} + +- Suppression de la prise en charge des requêtes CHECK TABLE pour les tables distribuées. + +#### Construire Des Changements: {#build-changes-3} + +- L’allocateur a été remplacé: `jemalloc` est maintenant utilisé à la place de `tcmalloc`. Dans certains scénarios, cela augmente la vitesse jusqu’à 20%. Cependant, il y a des questions qui ont ralenti jusqu’à 20%. La consommation de mémoire a été réduite d’environ 10% dans certains scénarios, avec une meilleure stabilité. Avec des charges très compétitives, l’utilisation du processeur dans l’espace utilisateur et dans le système ne montre qu’une légère augmentation. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) +- L’utilisation de libressl à partir d’un sous-module. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) +- Utilisation d’unixodbc à partir d’un sous-module. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) +- L’utilisation de mariadb-connecteur-c à partir d’un sous-module. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) +- Ajout de fichiers de test fonctionnels au référentiel qui dépendent de la disponibilité des données de test (pour le moment, sans les données de test elles-mêmes). + +## Clickhouse Version 18.6 {#clickhouse-release-18-6} + +### Clickhouse Version 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} + +#### Nouveauté: {#new-features-6} + +- Ajout du support pour les expressions on pour la syntaxe JOIN ON: + `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` + L’expression doit être une chaîne d’égalités rejoint par l’opérateur ET. De chaque côté de l’égalité peut être une expression arbitraire sur les colonnes de l’une des tables. L’utilisation de noms de colonnes entièrement qualifiés est prise en charge (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) pour la bonne table. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) +- HTTPS peut être activé pour la réplication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) + +#### Amélioration: {#improvements-6} + +- Le serveur transmet le composant patch de sa version au client. Les données sur le composant de version de correctif sont `system.processes` et `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) + +## Clickhouse Version 18.5 {#clickhouse-release-18-5} + +### Clickhouse Version 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} + +#### Nouveauté: {#new-features-7} + +- Ajout de la fonction de hachage `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). + +#### Amélioration: {#improvements-7} + +- Maintenant, vous pouvez utiliser le `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) attribut pour définir des valeurs dans les fichiers de configuration à partir de variables d’environnement. +- Ajout de versions insensibles à la casse `coalesce`, `ifNull`, et `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). + +#### Corrections De Bugs: {#bug-fixes-15} + +- Correction d’un bug possible lors du démarrage d’une réplique [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). + +## Clickhouse Version 18.4 {#clickhouse-release-18-4} + +### Clickhouse Version 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} + +#### Nouveauté: {#new-features-8} + +- Tables système ajoutées: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). +- Ajout de la possibilité d’utiliser une fonction de table au lieu d’un tableau en argument d’une `remote` ou `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). +- Soutien pour `HTTP Basic` l’authentification dans le protocole de réplication [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). +- Le `has` fonction permet de rechercher une valeur numérique dans un tableau de `Enum` valeur [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). +- Prise en charge de l’ajout de séparateurs de messages arbitraires lors de la lecture de `Kafka` [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2701). + +#### Amélioration: {#improvements-8} + +- Le `ALTER TABLE t DELETE WHERE` la requête ne réécrit pas les parties de données qui n’ont pas été affectées par la condition WHERE [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). +- Le `use_minimalistic_checksums_in_zookeeper` option pour `ReplicatedMergeTree` des tables est activé par défaut. Ce paramètre a été ajouté dans la version 1.1.54378, 2018-04-16. Les Versions antérieures à 1.1.54378 ne peuvent plus être installées. +- La prise en charge de `KILL` et `OPTIMIZE` requêtes qui spécifient `ON CLUSTER` [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). + +#### Corrections De Bugs: {#bug-fixes-16} + +- Correction de l’erreur `Column ... is not under an aggregate function and not in GROUP BY` pour l’agrégation avec une expression. Ce bug est apparu dans la version 18.1.0. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) +- Correction d’un bug dans l’ `windowFunnel aggregate function` [L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). +- Correction d’un bug dans l’ `anyHeavy` fonction d’agrégation ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) +- Correction d’un crash du serveur lors de l’utilisation du `countArray()` fonction d’agrégation. + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-5} + +- Paramètres pour `Kafka` moteur a été changé de `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` de `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. Si vos tables utilisent `kafka_schema` ou `kafka_num_consumers` paramètres, vous devez modifier manuellement les fichiers de métadonnées `path/metadata/database/table.sql` et d’ajouter `kafka_row_delimiter` paramètre avec `''` valeur. + +## Clickhouse Version 18.1 {#clickhouse-release-18-1} + +### Clickhouse Version 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} + +#### Nouveauté: {#new-features-9} + +- Soutien pour le `ALTER TABLE t DELETE WHERE` requête pour les tables MergeTree non répliquées ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). +- Prise en charge des types arbitraires pour `uniq*` famille de fonctions agrégées ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). +- Prise en charge des types arbitraires dans les opérateurs de comparaison ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). +- Le `users.xml` fichier permet de définir un masque de sous-réseau au format `10.0.0.1/255.255.255.0`. Ceci est nécessaire pour utiliser des masques pour les réseaux IPv6 avec des zéros au milieu ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). +- Ajouté le `arrayDistinct` fonction ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). +- Le moteur SummingMergeTree peut maintenant fonctionner avec des colonnes de type AggregateFunction ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). + +#### Amélioration: {#improvements-9} + +- Modification du schéma de numérotation pour les versions de version. Maintenant, la première partie contient l’année de sortie (A. D., fuseau horaire de Moscou, moins 2000), la deuxième partie contient le nombre de changements majeurs (augmente pour la plupart des versions), et la troisième partie est la version patch. Les versions sont toujours rétrocompatibles, sauf indication contraire dans le changelog. +- Conversions plus rapides de nombres à virgule flottante en une chaîne ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2664)). +- Si certaines lignes ont été ignorées lors d’une insertion en raison d’erreurs d’analyse (ceci est possible avec `input_allow_errors_num` et `input_allow_errors_ratio` paramètres activé), le nombre de lignes ignorées est maintenant écrit dans le journal du serveur ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). + +#### Corrections De Bugs: {#bug-fixes-17} + +- Correction de la commande TRUNCATE pour les tables temporaires ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2624)). +- Correction d’une impasse rare dans la bibliothèque client ZooKeeper qui se produisait lorsqu’une erreur réseau se produisait lors de la lecture de la réponse ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). +- Correction d’une erreur lors d’une conversion en types Nullable ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). +- Correction du résultat incorrect de l’ `maxIntersection()` fonction lorsque les limites des intervalles de coïncidé ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). +- Correction d’une transformation incorrecte de la chaîne d’expression OR dans un argument de fonction ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). +- Fixe une dégradation des performances pour les requêtes contenant `IN (subquery)` expressions à l’intérieur d’une autre sous-requête ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). +- Fixe incompatibilité entre les serveurs avec des versions différentes requêtes distribuées qui utilisent un `CAST` fonction qui n’est pas en majuscules ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). +- Ajout de guillemets manquants d’identifiants pour les requêtes à un SGBD externe ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-6} + +- La conversion d’une chaîne contenant le nombre zéro en DateTime ne fonctionne pas. Exemple: `SELECT toDateTime('0')`. C’est aussi la raison pour laquelle `DateTime DEFAULT '0'` ne fonctionne pas dans les tableaux, ainsi que `0` dans les dictionnaires. Solution: remplacer `0` avec `0000-00-00 00:00:00`. + +## Clickhouse Version 1.1 {#clickhouse-release-1-1} + +### Clickhouse Version 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} + +#### Nouveauté: {#new-features-10} + +- Ajouté le `histogram` fonction d’agrégation ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). +- Maintenant `OPTIMIZE TABLE ... FINAL` peut être utilisé sans spécifier de partitions pour `ReplicatedMergeTree` ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2600)). + +#### Corrections De Bugs: {#bug-fixes-18} + +- Correction d’un problème avec un très petit délai d’attente pour les sockets (une seconde) pour la lecture et l’écriture lors de l’envoi et du téléchargement de données répliquées, ce qui rendait impossible le téléchargement de pièces plus grandes s’il y avait une charge sur le réseau ou le disque (cela entraînait des tentatives cycliques de téléchargement de pièces). Cette erreur s’est produite dans la version 1.1.54388. +- Correction de problèmes lors de l’utilisation de chroot dans ZooKeeper si vous avez inséré des blocs de données en double dans la table. +- Le `has` la fonction fonctionne maintenant correctement pour un tableau avec les valeurs null éléments ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). +- Le `system.tables` table fonctionne maintenant correctement lorsqu’il est utilisé dans les requêtes distribuées. Le `metadata_modification_time` et `engine_full` les colonnes sont maintenant non-virtuel. Correction d’une erreur qui s’est produite si seules ces colonnes étaient interrogées à partir de la table. +- Correction de la façon dont un vide `TinyLog` table fonctionne après l’insertion d’un bloc de données vide ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). +- Le `system.zookeeper` table fonctionne si la valeur du nœud dans ZooKeeper est NULL. + +### Clickhouse Version 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} + +#### Nouveauté: {#new-features-11} + +- Les requêtes peuvent être envoyées `multipart/form-data` format (dans le `query` champ), ce qui est utile si des données externes sont également envoyées pour le traitement de la requête ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). +- Ajout de la possibilité d’activer ou de désactiver le traitement des guillemets simples ou doubles lors de la lecture de données au format CSV. Vous pouvez configurer cela dans le `format_csv_allow_single_quotes` et `format_csv_allow_double_quotes` paramètre ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2574)). +- Maintenant `OPTIMIZE TABLE ... FINAL` peut être utilisé sans spécifier la partition pour les variantes non répliquées de `MergeTree` ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2599)). + +#### Amélioration: {#improvements-10} + +- Amélioration des performances, réduction de la consommation de mémoire et suivi correct de la consommation de mémoire avec l’utilisation de L’opérateur IN lorsqu’un index de table peut être utilisé ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). +- Retiré redondant vérification des sommes de contrôle lors de l’ajout d’une partie des données. Ceci est important lorsqu’il y a un grand nombre de répliques, car dans ces cas, le nombre total de contrôles était égal à n^2. +- Ajout du support pour `Array(Tuple(...))` arguments en faveur de la `arrayEnumerateUniq` fonction ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). +- Ajouter `Nullable` soutien pour le `runningDifference` fonction ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). +- Amélioration des performances d’analyse des requêtes lorsqu’il existe un très grand nombre d’expressions ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). +- Sélection plus rapide des parties de données à fusionner `ReplicatedMergeTree` table. Récupération plus rapide de la session ZooKeeper ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). +- Le `format_version.txt` fichier pour `MergeTree` tables est recréée si elle est manquante, ce qui est logique si ClickHouse est lancé après avoir copié la structure de répertoire sans fichiers ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). + +#### Corrections De Bugs: {#bug-fixes-19} + +- Correction d’un bug lorsque vous travaillez avec ZooKeeper qui pourrait rendre impossible la récupération de la session et des États en lecture seule des tables avant de redémarrer le serveur. +- Correction d’un bug lorsque vous travaillez avec ZooKeeper qui pourrait entraîner la suppression des anciens nœuds si la session est interrompue. +- Correction d’une erreur dans le `quantileTDigest` fonction pour les arguments Float (ce bug a été introduit dans la version 1.1.54388) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). +- Correction d’un bug dans l’index des tables MergeTree si la colonne de clé primaire est située à l’intérieur de la fonction de conversion des types entre des entiers signés et non signés de même taille ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). +- Fixe erreur de segmentation si `macros` sont utilisés mais ils ne sont pas dans le fichier de configuration ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). +- Correction du passage à la base de données par défaut lors de la reconnexion du client ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). +- Correction d’un bug qui se produisait lors de la `use_index_for_in_with_subqueries` paramètre a été désactivé. + +#### Correction De sécurité: {#security-fix-1} + +- L’envoi de fichiers n’est plus possible lorsqu’il est connecté à MySQL (`LOAD DATA LOCAL INFILE`). + +### Clickhouse Version 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} + +#### Nouveauté: {#new-features-12} + +- Soutien pour le `ALTER TABLE t DELETE WHERE` requête pour les tables répliquées. Ajouté le `system.mutations` tableau pour suivre la progression de ce type de requêtes. +- Soutien pour le `ALTER TABLE t [REPLACE|ATTACH] PARTITION` requête pour les tables \* MergeTree. +- Soutien pour le `TRUNCATE TABLE` requête ([L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) +- Plusieurs nouveaux `SYSTEM` requêtes pour les tables répliquées (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). +- Ajout de la possibilité d’écrire dans une table avec le moteur MySQL et la fonction de table correspondante ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). +- Ajouté le `url()` fonction de table et le `URL` tableau moteur ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). +- Ajouté le `windowFunnel` fonction d’agrégation ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). +- Nouveau `startsWith` et `endsWith` fonctions pour les chaînes ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). +- Le `numbers()` la fonction table vous permet maintenant de spécifier le décalage ([L’Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). +- Le mot de passe pour `clickhouse-client` peut être saisi de manière interactive. +- Les journaux du serveur peuvent maintenant être envoyés à syslog ([Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). +- Prise en charge de la connexion dans les dictionnaires avec une source de bibliothèque partagée ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). +- Prise en charge des délimiteurs CSV personnalisés ([Ivan Joukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) +- Ajouté le `date_time_input_format` paramètre. Si vous basculez ce paramètre sur `'best_effort'`, Les valeurs DateTime seront lues dans un large éventail de formats. +- Ajouté le `clickhouse-obfuscator` utilitaire pour l’obscurcissement des données. Exemple d’utilisation: publication des données utilisées dans les tests de performance. + +#### Caractéristiques expérimentales: {#experimental-features-2} + +- Ajout de la possibilité de calculer `and` arguments uniquement là où ils sont nécessaires ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) +- La compilation JIT en code natif est maintenant disponible pour certaines expressions ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). + +#### Corrections De Bugs: {#bug-fixes-20} + +- Les doublons n’apparaissent plus pour une requête avec `DISTINCT` et `ORDER BY`. +- Les requêtes avec `ARRAY JOIN` et `arrayFilter` ne renvoie plus un résultat incorrect. +- Correction d’une erreur lors de la lecture d’une colonne de tableau à partir d’une structure Imbriquée ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). +- Correction d’une erreur lors de l’analyse des requêtes avec une clause HAVING comme `HAVING tuple IN (...)`. +- Correction d’une erreur lors de l’analyse des requêtes avec récursive des alias. +- Correction d’une erreur lors de la lecture de ReplacingMergeTree avec une condition dans PREWHERE qui filtre Toutes les lignes ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). +- Les paramètres de profil utilisateur n’ont pas été appliqués lors de l’utilisation de sessions dans L’interface HTTP. +- Correction de la façon dont les paramètres sont appliqués à partir des paramètres de ligne de commande dans clickhouse-local. +- La bibliothèque client ZooKeeper utilise maintenant le délai d’attente de session reçu du serveur. +- Correction d’un bug dans la bibliothèque client ZooKeeper lorsque le client attendait la réponse du serveur plus longtemps que le délai d’attente. +- Correction de l’élagage des pièces pour les requêtes avec des conditions sur les colonnes de clé de partition ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). +- Les fusions sont maintenant possibles après `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). +- Le mappage de Type dans la fonction de table ODBC a été corrigé ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). +- Les comparaisons de Type ont été corrigées pour `DateTime` avec et sans le fuseau horaire ([Alexandre Botcharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). +- Correction de l’analyse syntaxique et du formatage `CAST` opérateur. +- Insertion fixe dans une vue matérialisée pour le moteur de table distribué ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). +- Correction d’une condition de concurrence lors de l’écriture de données `Kafka` moteur aux vues matérialisées ([Yangkuan Liu](https://github.com/ClickHouse/ClickHouse/pull/2448)). +- Correction de SSRF dans la fonction de table remote (). +- Comportement de sortie fixe de `clickhouse-client` en mode multi-lignes ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). + +#### Amélioration: {#improvements-11} + +- Les tâches d’arrière plan dans les tables répliquées sont maintenant effectuées dans un pool de threads plutôt que dans des threads séparés ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). +- Amélioration des performances de compression LZ4. +- Analyse plus rapide pour les requêtes avec un grand nombre de jointures et de sous-requêtes. +- Le cache DNS est maintenant mis à jour automatiquement lorsqu’il y a trop d’erreurs réseau. +- Les insertions de Table ne se produisent plus si l’insertion dans l’une des vues matérialisées n’est pas possible car elle comporte trop de parties. +- Correction de l’écart dans les compteurs d’événements `Query`, `SelectQuery`, et `InsertQuery`. +- Des Expressions comme `tuple IN (SELECT tuple)` sont autorisés si les types de tuple correspondent. +- Un serveur avec des tables répliquées peut démarrer même si vous n’avez pas configuré ZooKeeper. +- Lors du calcul du nombre de cœurs CPU disponibles, les limites sur les groupes cgroups sont maintenant prises en compte ([Atri Sharma](https://github.com/ClickHouse/ClickHouse/pull/2325)). +- Ajouté chown pour les répertoires de configuration dans le fichier de configuration systemd ([Mikhaïl Shirjaeva](https://github.com/ClickHouse/ClickHouse/pull/2421)). + +#### Construire Des Changements: {#build-changes-4} + +- Le compilateur gcc8 peut être utilisé pour les builds. +- Ajout de la possibilité de construire llvm à partir du sous-module. +- La version de la bibliothèque librdkafka a été mise à jour vers v0. 11. 4. +- Ajout de la possibilité d’utiliser la bibliothèque libcpuid du système. La version de la bibliothèque a été mise à jour à 0.4.0. +- Correction de la construction en utilisant la bibliothèque vectorclass ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). +- Cmake génère maintenant des fichiers pour ninja par défaut (comme lors de l’utilisation `-G Ninja`). +- Ajout de la possibilité d’utiliser la bibliothèque libtinfo au lieu de libtermcap ([Georgy Kondratiev](https://github.com/ClickHouse/ClickHouse/pull/2519)). +- Correction d’un conflit de fichier d’en-tête dans Fedora Rawhide ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-7} + +- Retiré échapper dans `Vertical` et `Pretty*` formats et supprimé le `VerticalRaw` format. +- Si des serveurs avec la version 1.1.54388 (ou plus récente) et des serveurs avec une version plus ancienne sont utilisés simultanément dans une requête distribuée et la requête a le `cast(x, 'Type')` expression sans `AS` mot clé et n’a pas le mot `cast` en majuscules, une exception sera levée avec un message du genre `Not found column cast(0, 'UInt8') in block`. Solution: mettez à jour le serveur sur l’ensemble du cluster. + +### Clickhouse Version 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} + +#### Corrections De Bugs: {#bug-fixes-21} + +- Correction d’une erreur qui, dans certains cas, provoquait le blocage des opérations de ZooKeeper. + +### Clickhouse Version 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} + +#### Corrections De Bugs: {#bug-fixes-22} + +- Correction d’un ralentissement de la file d’attente de réplication si une table a plusieurs répliques. + +### Clickhouse Version 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} + +#### Corrections De Bugs: {#bug-fixes-23} + +- Correction d’une fuite de nœuds dans ZooKeeper lorsque ClickHouse perd la connexion au serveur ZooKeeper. + +### Clickhouse Version 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} + +#### Nouveauté: {#new-features-13} + +- Ajout de la fonction table `file(path, format, structure)`. Un exemple de lecture d’octets depuis `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. + +#### Amélioration: {#improvements-12} + +- Les sous-requêtes peuvent être encapsulées `()` crochets pour améliorer la lisibilité des requêtes. Exemple: `(SELECT 1) UNION ALL (SELECT 1)`. +- Simple `SELECT` les requêtes de l’ `system.processes` le tableau ne sont pas inclus dans le `max_concurrent_queries` limite. + +#### Corrections De Bugs: {#bug-fixes-24} + +- Correction d’un comportement incorrect de la `IN` opérateur quand sélectionner à partir de `MATERIALIZED VIEW`. +- Correction d’un filtrage incorrect par index de partition dans des expressions comme `partition_key_column IN (...)`. +- Incapacité fixe à exécuter `OPTIMIZE` requête sur réplica non leader si `REANAME` a été effectuée sur la table. +- Correction de l’erreur d’autorisation lors de l’exécution `OPTIMIZE` ou `ALTER` requêtes sur une réplique non-leader. +- Fixe le gel de l’ `KILL QUERY`. +- Correction d’une erreur dans la bibliothèque client ZooKeeper qui a conduit à la perte de montres, le gel de la file d’attente DDL distribuée, et des ralentissements dans la file d’attente de réplication si un non vide `chroot` le préfixe est utilisé dans la configuration de ZooKeeper. + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-8} + +- Suppression du support pour les expressions comme `(a, b) IN (SELECT (a, b))` (vous pouvez utiliser l’expression équivalente `(a, b) IN (SELECT a, b)`). Dans les versions précédentes, ces expressions ont conduit à indéterminé `WHERE` filtrage ou causé des erreurs. + +### Clickhouse Version 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} + +#### Nouveauté: {#new-features-14} + +- Niveau d’enregistrement peut être modifié sans redémarrer le serveur. +- Ajouté le `SHOW CREATE DATABASE` requête. +- Le `query_id` peut être passé à `clickhouse-client` (elBroom). +- Nouveau paramètre: `max_network_bandwidth_for_all_users`. +- Ajout du support pour `ALTER TABLE ... PARTITION ...` pour `MATERIALIZED VIEW`. +- Ajout d’informations sur la taille des parties de données sous forme non compressée dans la table système. +- Prise en charge du chiffrement de serveur à serveur pour les tables distribuées (`1` dans la configuration de la réplique ``). +- Configuration du niveau de la table pour `ReplicatedMergeTree` la famille afin de minimiser la quantité de données stockées dans Zookeeper: : `use_minimalistic_checksums_in_zookeeper = 1` +- Configuration de l’ `clickhouse-client` invite. Par défaut, les noms de serveur sont maintenant affichés à l’invite. Le nom d’affichage du serveur peut être modifié. Il est également envoyé dans le `X-ClickHouse-Display-Name` En-tête HTTP (Kirill Shvakov). +- Séparés par des virgules multiples `topics` peut être spécifié pour l’ `Kafka` moteur (Tobias Adamson) +- Quand une requête est arrêtée par `KILL QUERY` ou `replace_running_query` le client reçoit l’ `Query was canceled` exception au lieu d’un résultat incomplète. + +#### Amélioration: {#improvements-13} + +- `ALTER TABLE ... DROP/DETACH PARTITION` les requêtes sont exécutées à l’avant de la file d’attente de réplication. +- `SELECT ... FINAL` et `OPTIMIZE ... FINAL` peut être utilisé même lorsque la table a une seule partie de données. +- A `query_log` la table est recréée à la volée si elle a été supprimée manuellement (Kirill Shvakov). +- Le `lengthUTF8` fonction fonctionne plus rapidement (zhang2014). +- Amélioration des performances des inserts synchrones dans `Distributed` table (`insert_distributed_sync = 1` lorsqu’il existe un très grand nombre de fragments. +- Le serveur accepte le `send_timeout` et `receive_timeout` les paramètres du client et les applique lors de la connexion au client (ils sont appliqués dans l’ordre inverse: le socket du serveur `send_timeout` est définie à l’ `receive_timeout` valeur reçue du client, et vice versa). +- Récupération de crash plus robuste pour une insertion asynchrone dans `Distributed` table. +- Le type de retour de la `countEqual` la fonction a changé à partir de `UInt32` de `UInt64` (谢磊). + +#### Corrections De Bugs: {#bug-fixes-25} + +- Correction d’une erreur avec `IN` lorsque le côté gauche de l’expression est `Nullable`. +- Les résultats corrects sont maintenant retournés lors de l’utilisation de tuples avec `IN` lorsque certains des composants tuple sont dans l’index de la table. +- Le `max_execution_time` limite fonctionne désormais correctement avec les requêtes distribuées. +- Correction d’erreurs lors du calcul de la taille des colonnes composites `system.columns` table. +- Correction d’une erreur lors de la création d’une table temporaire `CREATE TEMPORARY TABLE IF NOT EXISTS.` +- Erreurs corrigées dans `StorageKafka` (\#\#2075) +- Le serveur fixe se bloque à partir d’arguments non valides de certaines fonctions d’agrégat. +- Correction de l’erreur qui a empêché l’ `DETACH DATABASE` requête de l’arrêt des tâches d’arrière-plan pour `ReplicatedMergeTree` table. +- `Too many parts` l’état est moins susceptible de se produire lors de l’insertion dans agrégées des vues matérialisées (\#\#2084). +- Correction de la gestion récursive des substitutions dans la configuration si une substitution doit être suivie d’une autre substitution au même niveau. +- Correction de la syntaxe dans le fichier de métadonnées lors de la création d’un `VIEW` qui utilise une requête avec `UNION ALL`. +- `SummingMergeTree` fonctionne maintenant correctement pour la sommation des structures de données imbriquées avec une clé composite. +- Correction de la possibilité d’une condition de course lors du choix du leader pour `ReplicatedMergeTree` table. + +#### Construire Des Changements: {#build-changes-5} + +- La construction prend en charge `ninja` plutôt `make` et utilise `ninja` par défaut pour les versions de construction. +- Paquets renommés: `clickhouse-server-base` dans `clickhouse-common-static`; `clickhouse-server-common` dans `clickhouse-server`; `clickhouse-common-dbg` dans `clickhouse-common-static-dbg`. Pour installer, utilisez `clickhouse-server clickhouse-client`. Les paquets avec les anciens noms seront toujours chargés dans les dépôts pour une compatibilité descendante. + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-9} + +- Retiré de l’interprétation d’une expression si un tableau est spécifié sur le côté gauche. Auparavant, l’expression `arr IN (set)` a été interprété comme “at least one `arr` element belongs to the `set`”. Pour obtenir le même comportement dans la nouvelle version, écrire `arrayExists(x -> x IN (set), arr)`. +- Désactivé l’utilisation incorrecte de l’option socket `SO_REUSEPORT`, qui a été incorrectement activé par défaut dans la bibliothèque Poco. Notez que sous Linux il n’y a plus aucune raison de spécifier simultanément les adresses `::` et `0.0.0.0` for listen – use just `::`, qui permet d’écouter la connexion à la fois sur IPv4 et IPv6 (avec les paramètres de configuration du noyau par défaut). Vous pouvez également revenir au comportement des versions précédentes en spécifiant `1` dans la config. + +### Clickhouse Version 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} + +#### Nouveauté: {#new-features-15} + +- Ajouté le `system.macros` table et mise à jour automatique des macros lorsque le fichier de configuration est modifié. +- Ajouté le `SYSTEM RELOAD CONFIG` requête. +- Ajouté le `maxIntersections(left_col, right_col)` fonction d’agrégation, qui retourne le nombre maximal d’simultanément intersection d’intervalles `[left; right]`. Le `maxIntersectionsPosition(left, right)` fonction retourne le début de la “maximum” intervalle. ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). + +#### Amélioration: {#improvements-14} + +- Lors de l’insertion de données dans une `Replicated` tableau, moins de demandes sont faites à `ZooKeeper` (et la plupart des erreurs au niveau de l’utilisateur ont disparu de la `ZooKeeper` journal). +- Ajout de la possibilité de créer des alias pour les ensembles de données. Exemple: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. + +#### Corrections De Bugs: {#bug-fixes-26} + +- Correction de l’ `Illegal PREWHERE` erreur lors de la lecture des tables de fusion pour `Distributed`table. +- Ajout de correctifs qui vous permettent de démarrer clickhouse-server dans des conteneurs Docker IPv4 uniquement. +- Correction d’une condition de course lors de la lecture du système `system.parts_columns tables.` +- Suppression de la double mise en mémoire tampon lors d’un insert synchrone `Distributed` table, ce qui aurait pu provoquer la connexion à timeout. +- Correction d’un bug qui a causé des attentes trop longues pour une réplique indisponible avant de commencer un `SELECT` requête. +- Correction de dates incorrectes dans le `system.parts` table. +- Correction d’un bug qui rendait impossible l’insertion de données dans un `Replicated` le tableau si `chroot` était non vide dans la configuration du `ZooKeeper` cluster. +- Correction de l’algorithme de fusion verticale pour un `ORDER BY` table. +- Restauré la possibilité d’utiliser des dictionnaires dans les requêtes aux tables distantes, même si ces dictionnaires ne sont pas présents sur le serveur demandeur. Cette fonctionnalité a été perdue dans la version 1.1.54362. +- Restauré le comportement pour les requêtes comme `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` lorsque le côté droit de la `IN` devrait utiliser une télécommande `default.table` au lieu d’un local. Ce comportement a été rompu dans la version 1.1.54358. +- Suppression de la journalisation au niveau des erreurs `Not found column ... in block`. + +### Clickhouse Version 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} + +#### Nouveauté: {#new-features-16} + +- Agrégation sans `GROUP BY` pour un ensemble vide (comme `SELECT count(*) FROM table WHERE 0`) renvoie maintenant un résultat avec une ligne avec des valeurs null pour les fonctions d’agrégation, conformément à la norme SQL. Pour restaurer l’ancien comportement (renvoyer un résultat vide), définissez `empty_result_for_aggregation_by_empty_set` 1. +- Conversion de type ajouté pour `UNION ALL`. Différents noms d’alias sont autorisés dans `SELECT` les positions dans `UNION ALL` en conformité avec le standard SQL. +- Les expressions arbitraires sont prises en charge dans `LIMIT BY` clause. Auparavant, il était seulement possible d’utiliser des colonnes résultant de `SELECT`. +- Un indice de `MergeTree` tables est utilisé lorsque `IN` est appliqué à un n-uplet d’expressions à partir des colonnes de la clé primaire. Exemple: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). +- Ajouté le `clickhouse-copier` outil pour copier entre les clusters et remodeler les données (beta). +- Ajout de fonctions de hachage cohérentes: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. Ils peuvent être utilisés comme une clé de sharding afin de réduire la quantité de trafic réseau lors de remaniements ultérieurs. +- L’ajout de fonctions: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. +- Ajouté le `arrayCumSum` fonction (Javi Santana). +- Ajouté le `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, et `parseDateTimeBestEffortOrNull` fonctions pour lire le DateTime à partir d’une chaîne contenant du texte dans une grande variété de formats possibles. +- Les données peuvent être partiellement rechargées à partir de dictionnaires externes lors de la mise à jour (charger uniquement les enregistrements dans lesquels la valeur du champ spécifié supérieure à celle du téléchargement précédent) (Arsen Hakobyan). +- Ajouté le `cluster` table de fonction. Exemple: `cluster(cluster_name, db, table)`. Le `remote` la fonction table peut accepter le nom du cluster comme premier argument, s’il est spécifié comme identifiant. +- Le `remote` et `cluster` les fonctions de table peuvent être utilisées dans `INSERT` requête. +- Ajouté le `create_table_query` et `engine_full` colonnes virtuelles au `system.tables`table . Le `metadata_modification_time` la colonne est virtuel. +- Ajouté le `data_path` et `metadata_path` les colonnes à `system.tables`et`system.databases` tables, et a ajouté le `path` la colonne de la `system.parts` et `system.parts_columns` table. +- Ajout d’informations supplémentaires sur les fusions `system.part_log` table. +- Une clé de partitionnement arbitraire peut être utilisée pour `system.query_log` table (Kirill Shvakov). +- Le `SHOW TABLES` query affiche maintenant également des tables temporaires. Ajout de tables temporaires et `is_temporary` colonne de `system.tables` (zhang2014). +- Ajouter `DROP TEMPORARY TABLE` et `EXISTS TEMPORARY TABLE` les requêtes (zhang2014). +- Soutien pour `SHOW CREATE TABLE` pour les tables temporaires (zhang2014). +- Ajouté le `system_profile` paramètre de configuration pour les paramètres utilisés par les processus internes. +- Soutien pour le chargement `object_id` comme un attribut de `MongoDB` dictionnaires (Pavel Litvinenko). +- Lecture `null` comme valeur par défaut lors du chargement de données pour un dictionnaire externe `MongoDB` source (Pavel Litvinenko). +- Lecture `DateTime` les valeurs dans la `Values` formater à partir D’un horodatage Unix sans guillemets simples. +- Le basculement est pris en charge dans `remote` fonctions de table pour les cas où certaines répliques manquent la table demandée. +- Les paramètres de Configuration peuvent être remplacées dans la ligne de commande lorsque vous exécutez `clickhouse-server`. Exemple: `clickhouse-server -- --logger.level=information`. +- Mise en œuvre de la `empty` fonction à partir d’un `FixedString` argument: la fonction renvoie 1 si la chaîne est entièrement composée d’octets nuls (zhang2014). +- Ajouté le `listen_try`paramètre de configuration pour l’écoute d’au moins une des adresses listen sans quitter, si certaines adresses ne peuvent pas être écoutées (utile pour les systèmes avec prise en charge désactivée pour IPv4 ou IPv6). +- Ajouté le `VersionedCollapsingMergeTree` tableau moteur. +- Prise en charge des lignes et des types numériques arbitraires `library` source du dictionnaire. +- `MergeTree` les tableaux peuvent être utilisés sans une clé primaire (vous devez spécifier `ORDER BY tuple()`). +- A `Nullable` peut être de type `CAST` pour un non-`Nullable` type si l’argument n’est pas `NULL`. +- `RENAME TABLE` peut être effectuée pour `VIEW`. +- Ajouté le `throwIf` fonction. +- Ajouté le `odbc_default_field_size` option, qui vous permet d’étendre la taille maximale de la valeur chargée à partir D’une source ODBC (par défaut, il est 1024). +- Le `system.processes` table et `SHOW PROCESSLIST` ont maintenant la `is_cancelled` et `peak_memory_usage` colonne. + +#### Amélioration: {#improvements-15} + +- Les limites et quotas sur le résultat ne sont plus appliqués aux données intermédiaires pour `INSERT SELECT` les requêtes ou pour `SELECT` les sous-requêtes. +- Moins de faux déclencheurs de `force_restore_data` lors de la vérification de l’état de `Replicated` les tables lorsque le serveur démarre. +- Ajouté le `allow_distributed_ddl` option. +- Les fonctions non déterministes ne sont pas autorisées dans les expressions `MergeTree` table de clés. +- Fichiers avec des substitutions de `config.d` les répertoires sont chargés par ordre alphabétique. +- Amélioration de la performance de l’ `arrayElement` fonction dans le cas d’une constante tableau multidimensionnel avec un tableau vide comme l’un des éléments. Exemple: `[[1], []][x]`. +- Le serveur démarre plus rapidement maintenant lors de l’utilisation de fichiers de configuration avec de très grandes substitutions (par exemple, de très grandes listes de réseaux IP). +- Lors de l’exécution d’une requête, les fonctions de valeur de table s’exécutent une fois. Précédemment, `remote` et `mysql` les fonctions à valeur de table ont effectué la même requête deux fois pour récupérer la structure de la table à partir d’un serveur distant. +- Le `MkDocs` générateur de documentation est utilisé. +- Lorsque vous essayez de supprimer une colonne de table `DEFAULT`/`MATERIALIZED` les expressions des autres colonnes dépendent, une exception est levée (zhang2014). +- Ajout de la possibilité d’analyser une ligne vide dans des formats de texte comme le nombre 0 pour `Float` types de données. Cette fonctionnalité était auparavant disponible mais a été perdue dans la version 1.1.54342. +- `Enum` les valeurs peuvent être utilisés dans `min`, `max`, `sum` et quelques autres fonctions. Dans ces cas, il utilise des valeurs numériques correspondantes. Cette fonctionnalité était auparavant disponible mais a été perdue dans la version 1.1.54337. +- Ajouter `max_expanded_ast_elements` pour limiter la taille de L’AST après l’expansion récursive des alias. + +#### Corrections De Bugs: {#bug-fixes-27} + +- Correction de cas où des colonnes inutiles ont été supprimées des sous-requêtes par erreur, ou non supprimées des sous-requêtes contenant `UNION ALL`. +- Correction d’un bug dans les fusions pour `ReplacingMergeTree` table. +- Insertions synchrones fixes dans `Distributed` table (`insert_distributed_sync = 1`). +- Fixe erreur de segmentation pour certaines utilisations de `FULL` et `RIGHT JOIN` avec des colonnes en double dans les sous-requêtes. +- Fixe erreur de segmentation pour certaines utilisations de `replace_running_query` et `KILL QUERY`. +- Fixe l’ordre du `source` et `last_exception` les colonnes dans l’ `system.dictionaries` table. +- Correction d’un bug lors de l’ `DROP DATABASE` la requête n’a pas supprimé le fichier contenant des métadonnées. +- Correction de l’ `DROP DATABASE` requête pour `Dictionary` les bases de données. +- Fixe la faible précision de `uniqHLL12` et `uniqCombined` fonctions pour les cardinalités supérieures à 100 millions d’articles (Alex Bocharov). +- Correction du calcul des valeurs par défaut implicites si nécessaire pour calculer simultanément des expressions explicites par défaut dans `INSERT` les requêtes (zhang2014). +- Correction d’un cas rare lorsqu’une requête à un `MergeTree` la table n’a pas pu finir (chenxing-xc). +- Correction d’un plantage survenu lors de l’exécution d’un `CHECK` requête pour `Distributed` tables si tous les fragments sont locaux (chenxing.xc). +- Correction d’une légère régression des performances avec des fonctions qui utilisent des expressions régulières. +- Correction d’une régression de performance lors de la création de tableaux multidimensionnels à partir d’expressions complexes. +- Correction d’un bug qui pourrait causer un supplément `FORMAT` article à paraître dans un `.sql` fichier de métadonnées. +- Correction d’un bug qui a causé la `max_table_size_to_drop` limite à appliquer lorsque vous essayez de supprimer un `MATERIALIZED VIEW` en regardant une table explicitement spécifiée. +- Correction de l’incompatibilité avec les anciens clients (les anciens clients étaient parfois envoyés `DateTime('timezone')` type, dont ils ne comprennent pas). +- Correction d’un bug lors de la lecture `Nested` éléments de colonne de structures qui ont été ajoutés en utilisant `ALTER` mais qui sont vides pour les anciennes partitions, lorsque les conditions de ces colonnes a déménagé à `PREWHERE`. +- Correction d’un bug lors du filtrage des tables virtuelles `_table` colonnes dans les requêtes à `Merge` table. +- Correction d’un bug lors de l’utilisation `ALIAS` les colonnes en `Distributed` table. +- Correction d’un bug qui rendait la compilation dynamique impossible pour les requêtes avec des fonctions `quantile` famille. +- Correction d’une condition de concurrence dans le pipeline d’exécution de requête qui s’est produite dans de très rares cas lors de l’utilisation `Merge` avec un grand nombre de tables, et lors de l’utilisation `GLOBAL` les sous-requêtes. +- Correction d’un crash lors du passage de tableaux de tailles différentes pour un `arrayReduce` fonction lors de l’utilisation de fonctions d’agrégation à partir de plusieurs arguments. +- Interdit l’utilisation de requêtes avec `UNION ALL` dans un `MATERIALIZED VIEW`. +- Correction d’une erreur lors de l’initialisation du `part_log` table système au démarrage du serveur (par défaut, `part_log` est désactivée). + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-10} + +- Enlevé le `distributed_ddl_allow_replicated_alter` option. Ce comportement est activé par défaut. +- Enlevé le `strict_insert_defaults` paramètre. Si vous utilisez cette fonctionnalité, écrivez à `clickhouse-feedback@yandex-team.com`. +- Enlevé le `UnsortedMergeTree` moteur. + +### Clickhouse Version 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} + +- Ajout de la prise en charge des macros pour définir les noms de cluster dans les requêtes DDL distribuées et les constructeurs de tables distribuées: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. +- Maintenant requêtes comme `SELECT ... FROM table WHERE expr IN (subquery)` sont traitées à l’aide de la `table` index. +- Amélioration du traitement des doublons lors de l’insertion dans des tables répliquées, de sorte qu’ils ne ralentissent plus l’exécution de la file d’attente de réplication. + +### Clickhouse Version 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} + +Cette version contient des corrections de bugs pour la version précédente 1.1.54337: + +- Correction d’une régression dans 1.1.54337: si l’utilisateur par défaut a un accès en lecture seule, le serveur refuse de démarrer avec le message `Cannot create database in readonly mode`. +- Correction d’une régression dans 1.1.54337: sur les systèmes avec systemd, les journaux sont toujours écrits dans syslog quelle que soit la configuration; le script watchdog utilise toujours init.d. +- Correction d’une régression dans 1.1.54337: mauvaise configuration par défaut dans L’image Docker. +- Correction du comportement non déterministe de GraphiteMergeTree (vous pouvez le voir dans les messages de journal `Data after merge is not byte-identical to the data on another replicas`). +- Correction d’un bug qui peut conduire à des fusions incohérentes après optimiser la requête aux tables répliquées (vous pouvez le voir dans les messages de journal `Part ... intersects the previous part`). +- Les tables tampon fonctionnent maintenant correctement lorsque des colonnes matérialisées sont présentes dans la table de destination (par zhang2014). +- Correction d’un bug dans la mise en œuvre de NULL. + +### Clickhouse Version 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} + +#### Nouveauté: {#new-features-17} + +- Ajout du support pour le stockage de tableaux et de tuples multidimensionnels (`Tuple` type de données) dans les tableaux. +- Prise en charge des fonctions de table pour `DESCRIBE` et `INSERT` requête. Ajout du support pour les sous-requêtes dans `DESCRIBE`. Exemple: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. Soutien pour `INSERT INTO TABLE` outre `INSERT INTO`. +- Amélioration du support pour les fuseaux horaires. Le `DateTime` le type de données peut être annoté avec le fuseau horaire utilisé pour l’analyse et le formatage dans les formats de texte. Exemple: `DateTime('Europe/Moscow')`. Lorsque les fuseaux horaires sont spécifiés dans les fonctions `DateTime` arguments, le type de retour pour suivre le fuseau horaire, et la valeur sera affichée comme prévu. +- Ajout des fonctions `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. Le `toRelativeHour`/`Minute`/`Second` les fonctions peuvent prendre une valeur de type `Date` comme argument. Le `now` nom de la fonction est sensible à la casse. +- Ajouté le `toStartOfFifteenMinutes` fonction (Kirill Shvakov). +- Ajouté le `clickhouse format` outil de formatage des requêtes. +- Ajouté le `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` format. Les fichiers de schéma peuvent être situés uniquement dans le répertoire spécifié. +- Ajout du support pour les substitutions de configuration (`incl` et `conf.d`) pour la configuration de dictionnaires et de modèles externes (Pavel Yakunin). +- Ajout d’une colonne avec la documentation pour le `system.settings` table (Kirill Shvakov). +- Ajouté le `system.parts_columns` table avec des informations sur la taille des colonnes dans chaque partie `MergeTree` table. +- Ajouté le `system.models` tableau avec des informations sur chargé `CatBoost` machine de modèles d’apprentissage. +- Ajouté le `mysql` et `odbc` fonction de table et correspondant `MySQL` et `ODBC` moteurs de table pour accéder aux bases de données distantes. Cette fonctionnalité est en phase bêta. +- Ajout de la possibilité de passer un argument de type `AggregateFunction` pour l’ `groupArray` fonction d’agrégation (vous pouvez donc créer un tableau d’États d’une fonction d’agrégation). +- Suppression des restrictions sur diverses combinaisons de combinateurs de fonction d’agrégat. Par exemple, vous pouvez utiliser `avgForEachIf` ainsi que `avgIfForEach` les fonctions d’agrégation, qui ont des comportements différents. +- Le `-ForEach` fonction d’agrégation combinator est prolongée pour le cas des fonctions d’agrégation de plusieurs arguments. +- Ajout du support pour les fonctions d’agrégation de `Nullable` arguments même pour les cas où la fonction renvoie un non-`Nullable` résultat (ajouté avec la contribution de Silviu Caragea). Exemple: `groupArray`, `groupUniqArray`, `topK`. +- Ajouté le `max_client_network_bandwidth` pour `clickhouse-client` (Kirill Shvakov). +- Les utilisateurs avec le `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). +- Ajout du support pour l’utilisation de plusieurs consommateurs avec le `Kafka` moteur. Options de configuration étendues pour `Kafka` (Marek Vavruša). +- Ajouté le `intExp3` et `intExp4` fonction. +- Ajouté le `sumKahan` fonction d’agrégation. +- Ajout des fonctions to\* Number \* OrNull, où \* Number \* est un type numérique. +- Ajout du support pour `WITH` clauses pour un `INSERT SELECT` requête (auteur: zhang2014). +- Ajout des paramètres de: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. En particulier, ces paramètres sont utilisés pour télécharger des parties de données pour la réplication. La modification de ces paramètres permet un basculement plus rapide si le réseau est surchargé. +- Ajout du support pour `ALTER` pour les tables de type `Null` (Anastasiya Tsarkova). +- Le `reinterpretAsString` la fonction est étendue pour tous les types de données stockés de manière contiguë en mémoire. +- Ajouté le `--silent` option pour le `clickhouse-local` outil. Il supprime les informations d’exécution de requête d’impression dans stderr. +- Ajout du support pour la lecture des valeurs de type `Date` à partir du texte dans un format où le mois et / ou le jour du mois est spécifié en utilisant un seul chiffre au lieu de deux chiffres (oiseau Amos). + +#### Optimisations Des Performances: {#performance-optimizations} + +- Amélioration des performances des fonctions d’agrégation `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` à partir d’arguments de chaîne. +- Amélioration des performances des fonctions `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. +- Amélioration des performances de l’analyse et du formatage `Date` et `DateTime` tapez les valeurs au format texte. +- Amélioration des performances et de la précision de l’analyse des nombres à virgule flottante. +- Abaissé l’utilisation de la mémoire pour `JOIN` dans le cas où les parties gauche et droite ont des colonnes avec des noms identiques qui ne sont pas contenus dans `USING` . +- Amélioration des performances des fonctions d’agrégation `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` en réduisant la stabilité de calcul. Les anciennes fonctions sont disponibles sous les noms de `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. + +#### Corrections De Bugs: {#bug-fixes-28} + +- Déduplication de données fixe après l’exécution d’un `DROP` ou `DETACH PARTITION` requête. Dans la version précédente, la suppression d’une partition et l’insertion à nouveau des mêmes données ne fonctionnaient pas car les blocs insérés étaient considérés comme des doublons. +- Correction d’un bug qui pourrait conduire à une interprétation incorrecte de la `WHERE` la clause de `CREATE MATERIALIZED VIEW` les requêtes avec `POPULATE` . +- Correction d’un bug dans l’utilisation de l’ `root_path` paramètre dans l’ `zookeeper_servers` configuration. +- Correction des résultats inattendus du passage du `Date` argument `toStartOfDay` . +- Correction de l’ `addMonths` et `subtractMonths` fonctions et l’arithmétique pour `INTERVAL n MONTH` dans les cas où le résultat de l’année précédente. +- Ajout du support manquant pour le `UUID` type de données pour `DISTINCT` , `JOIN` , et `uniq` fonctions agrégées et dictionnaires externes (Evgeniy Ivanov). Soutien pour `UUID` est encore incomplète. +- Fixe `SummingMergeTree` comportement dans les cas où les lignes additionnées à zéro. +- Diverses corrections pour le `Kafka` engine (Marek Vavruša). +- Correction d’un comportement incorrect de la `Join` moteur de table (oiseau Amos). +- Correction d’un comportement d’allocateur incorrect sous FreeBSD et OS X. +- Le `extractAll` fonction prend désormais en charge les correspondances vides. +- Correction d’une erreur qui bloquait l’utilisation de `libressl` plutôt `openssl` . +- Correction de l’ `CREATE TABLE AS SELECT` requête à partir de tables temporaires. +- Correction de la non-atomicité de la mise à jour de la file d’attente de réplication. Cela peut entraîner la désynchronisation des répliques jusqu’au redémarrage du serveur. +- Correction d’un débordement possible dans `gcd` , `lcm` et `modulo` (`%` de l’opérateur) (Mak Skorokhod). +- `-preprocessed` les fichiers sont maintenant créés après modification `umask` (`umask` peut être changé dans le fichier de configuration). +- Correction d’un bug dans la vérification des antécédents des pièces (`MergeTreePartChecker` ) lors de l’utilisation d’une coutume clé de partition. +- Correction de l’analyse des tuples (valeurs du `Tuple` type de données) dans des formats de texte. +- Amélioration des messages d’erreur sur les types incompatibles transmis à `multiIf` , `array` et quelques autres fonctions. +- Repensé de soutien pour `Nullable` type. Correction de bugs qui peuvent conduire à un plantage du serveur. Correction de presque tous les autres bugs liés à `NULL` support: conversions de type incorrectes dans INSERT SELECT, support insuffisant pour Nullable dans HAVING et PREWHERE, `join_use_nulls` mode, Nullable types comme arguments de `OR` l’opérateur, etc. +- Correction de divers bugs liés à la sémantique interne des types de données. Exemples: sommation inutile de `Enum` tapez les champs dans `SummingMergeTree` ; l’alignement de la `Enum` types de `Pretty` formats, etc. +- Contrôles plus stricts pour les combinaisons autorisées de colonnes composites. +- Correction du débordement lors de la spécification d’un très grand paramètre pour le `FixedString` type de données. +- Correction d’un bug dans l’ `topK` fonction d’agrégation dans un cas générique. +- Ajout de la vérification manquante pour l’égalité des tailles de tableau dans les arguments de n-ARY variantes de fonctions d’agrégation avec un `-Array` combinator. +- Correction d’un bug dans `--pager` pour `clickhouse-client` (auteur: ks1322). +- Fixe la précision de la `exp10` fonction. +- Correction du comportement du `visitParamExtract` fonction pour une meilleure conformité avec la documentation. +- Correction du crash lorsque des types de données incorrects sont spécifiés. +- Correction du comportement de `DISTINCT` dans le cas lorsque toutes les colonnes sont des constantes. +- Correction du formatage de la requête dans le cas de l’utilisation du `tupleElement` fonction avec une expression constante complexe comme indice d’élément tuple. +- Correction d’un bug dans `Dictionary` tables pour `range_hashed` dictionnaire. +- Correction d’un bug qui conduit à des lignes excessives dans le résultat de `FULL` et `RIGHT JOIN` (Oiseau Amos). +- Correction d’un plantage du serveur lors de la création et de la suppression de fichiers temporaires `config.d` répertoires pendant le rechargement de la configuration. +- Correction de l’ `SYSTEM DROP DNS CACHE` requête: le cache a été vidé mais les adresses des nœuds de cluster n’ont pas été mises à jour. +- Correction du comportement de `MATERIALIZED VIEW` après l’exécution de `DETACH TABLE` for the table under the view (Marek Vavruša). + +#### Construire Des améliorations: {#build-improvements-4} + +- Le `pbuilder` l’outil est utilisé pour les versions. Le processus de construction est presque complètement indépendant de l’environnement hôte de construction. +- Une seule version est utilisée pour différentes versions du système d’exploitation. Les paquets et les binaires ont été rendus compatibles avec un large éventail de systèmes Linux. +- Ajouté le `clickhouse-test` paquet. Il peut être utilisé pour exécuter des tests fonctionnels. +- L’archive source peut maintenant être publié dans le référentiel. Il peut être utilisé pour reproduire la construction sans utiliser GitHub. +- Ajout d’une intégration limitée avec Travis CI. En raison des limites de temps de construction dans Travis, seule la construction de débogage est testée et un sous-ensemble limité de tests est exécuté. +- Ajout du support pour `Cap'n'Proto` dans la construction par défaut. +- Modification du format des sources de documentation à partir de `Restricted Text` de `Markdown`. +- Ajout du support pour `systemd` (Vladimir Smirnov). Il est désactivé par défaut en raison d’une incompatibilité avec certaines images du système D’exploitation et peut être activé manuellement. +- Pour la génération de code dynamique, `clang` et `lld` sont intégrées dans le `clickhouse` binaire. Ils peuvent également être invoqués comme `clickhouse clang` et `clickhouse lld` . +- Suppression de l’utilisation des extensions GNU du code. Permis à l’ `-Wextra` option. Lors de la construction avec `clang` la valeur par défaut est `libc++` plutôt `libstdc++`. +- Extrait `clickhouse_parsers` et `clickhouse_common_io` les bibliothèques pour accélérer les constructions des différents outils. + +#### Modifications Incompatibles En arrière: {#backward-incompatible-changes-11} + +- Le format des marques dans `Log` tapez les tables qui contiennent `Nullable` les colonnes ont été modifiées d’une manière incompatible avec l’arrière. Si vous avez ces tables, vous devez les convertir en `TinyLog` tapez avant de démarrer la nouvelle version du serveur. Pour ce faire, remplacez `ENGINE = Log` avec `ENGINE = TinyLog` dans le correspondant `.sql` fichier dans le `metadata` répertoire. Si votre table n’a pas `Nullable` les colonnes ou si le type de votre table n’est pas `Log`, alors vous n’avez pas besoin de faire quoi que ce soit. +- Enlevé le `experimental_allow_extended_storage_definition_syntax` paramètre. Maintenant cette fonctionnalité est activée par défaut. +- Le `runningIncome` fonction a été renommée en `runningDifferenceStartingWithFirstvalue` pour éviter toute confusion. +- Enlevé le `FROM ARRAY JOIN arr` syntaxe lorsque la jointure du tableau est spécifiée directement après FROM sans table (Amos Bird). +- Enlevé le `BlockTabSeparated` format utilisé uniquement à des fins de démonstration. +- Modification du format d’État pour les fonctions d’agrégation `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Si vous avez stocké des états de ces fonctions d’agrégat dans des tables (en utilisant `AggregateFunction` type de données ou vues matérialisées avec les états correspondants), écrivez svp à clickhouse-feedback@yandex-team.com. +- Dans les versions précédentes du serveur, il y avait une fonctionnalité non documentée: si une fonction d’agrégation dépend de paramètres, vous pouvez toujours la spécifier sans paramètres dans le type de données AggregateFunction. Exemple: `AggregateFunction(quantiles, UInt64)` plutôt `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. Cette fonctionnalité a été perdu. Bien qu’il ne soit pas documenté, nous prévoyons de le soutenir à nouveau dans les prochaines versions. +- Les types de données Enum ne peuvent pas être utilisés dans les fonctions d’agrégat min/max. Cette capacité sera rendu dans la prochaine version. + +#### Veuillez Noter Lors De La Mise à Niveau: {#please-note-when-upgrading} + +- Lorsque vous effectuez une mise à jour continue sur un cluster, au moment où certaines répliques exécutent L’ancienne version de ClickHouse et d’autres la nouvelle version, la réplication est temporairement arrêtée et le message `unknown parameter 'shard'` apparaît dans le journal. La réplication se poursuivra après la mise à jour de toutes les répliques du cluster. +- Si différentes versions de ClickHouse sont en cours d’exécution sur les serveurs de cluster, il est possible que les requêtes distribuées utilisant les fonctions suivantes aient des résultats incorrects: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Vous devez mettre à jour tous les nœuds de cluster. + +## [Changelog pour 2017](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/fr/whats-new/changelog/2019.md b/docs/fr/whats-new/changelog/2019.md new file mode 100644 index 00000000000..e7da17cc754 --- /dev/null +++ b/docs/fr/whats-new/changelog/2019.md @@ -0,0 +1,2074 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 77 +toc_title: '2019' +--- + +## Clickhouse Version V19. 17 {#clickhouse-release-v19-17} + +### Clickhouse Version V19. 17. 6. 36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} + +#### Bug Fix {#bug-fix} + +- Dépassement de tampon potentiel fixe en décompression. Un utilisateur malveillant peut transmettre des données compressées fabriquées qui pourraient provoquer une lecture après le tampon. Ce problème a été trouvé par Eldar Zaitov de l’équipe de sécurité de L’information Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction possible plantage du serveur (`std::terminate`) lorsque le serveur ne peut pas envoyer ou écrire des données au format JSON ou XML avec des valeurs de type string data (qui nécessitent une validation UTF-8) ou lors de la compression des données de résultat avec l’algorithme Brotli ou dans certains autres cas rares. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Dictionnaires fixes avec la source d’un clickhouse `VIEW`, maintenant la lecture de tels dictionnaires ne provoque pas l’erreur `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixe vérifier si un hôte client est autorisé par host\_regexp spécifié dans les utilisateurs.XML. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- `RENAME TABLE` pour une table distribuée renomme maintenant le dossier contenant les données insérées avant d’envoyer aux fragments. Cela résout un problème avec les renommages successifs `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- `range_hashed` les dictionnaires externes créés par des requêtes DDL autorisent désormais des plages de types numériques arbitraires. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alésapine](https://github.com/alesapin)) +- Fixe `INSERT INTO table SELECT ... FROM mysql(...)` table de fonction. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- Fixe erreur de segmentation dans `INSERT INTO TABLE FUNCTION file()` lors de l’insertion dans un fichier qui n’existe pas. Maintenant, dans ce cas, le fichier sera créé et insérez seraient traités. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Correction d’une erreur bitmapAnd lors de l’intersection d’un bitmap agrégé et d’un bitmap scalaire. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Correction de segfault quand `EXISTS` la requête a été utilisé sans `TABLE` ou `DICTIONARY` qualificatif, tout comme `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Type de retour fixe pour les fonctions `rand` et `randConstant` en cas d’argument nullable. Maintenant renvoient toujours `UInt32` et jamais `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixe `DROP DICTIONARY IF EXISTS db.dict` maintenant il ne lance pas d’exception si `db` n’existe pas. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- Si une table n’a pas été complètement abandonnée en raison d’un plantage du serveur, le serveur essaiera de la restaurer et de la charger [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- Correction d’une requête de comptage trivial pour une table distribuée s’il y a plus de deux tables locales de fragments. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Correction d’un bug qui conduisait à une course de données dans DB:: BlockStreamProfileInfo:: calculateRowsBeforeLimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- Fixe `ALTER table MOVE part` exécuté immédiatement après la fusion de la partie spécifiée, ce qui pourrait provoquer le déplacement d’une partie la partie fusionné. Maintenant, il déplace correctement la partie spécifiée. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Les Expressions pour les dictionnaires peuvent maintenant être spécifiées en tant que chaînes. Ceci est utile pour le calcul des attributs lors de l’extraction de données à partir de sources non-ClickHouse, car il permet d’utiliser une syntaxe non-ClickHouse pour ces expressions. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alésapine](https://github.com/alesapin)) +- Correction d’une course très rare dans `clickhouse-copier` en raison d’un débordement dans ZXid. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Correction du bug quand après la requête a échoué (en raison de “Too many simultaneous queries” par exemple) il ne lirait pas les informations des tables externes, et le + la requête suivante interpréterait cette information comme le début de la requête suivante provoquant une erreur comme `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Éviter la déréférence nulle après “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Restaurer la prise en charge de tous les paramètres régionaux ICU, ajouter la possibilité d’appliquer des collations pour les expressions constantes et ajouter le nom de la langue au système.tableau de collations. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alésapine](https://github.com/alesapin)) +- Nombre de flux pour lire à partir `StorageFile` et `StorageHDFS` est maintenant limitée, pour éviter de dépasser la limite de mémoire. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alésapine](https://github.com/alesapin)) +- Fixe `CHECK TABLE` requête pour `*MergeTree` les tables sans clé. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alésapine](https://github.com/alesapin)) +- Suppression du numéro de mutation d’un nom de pièce au cas où il n’y aurait pas de mutations. Cette suppression a amélioré la compatibilité avec les anciennes versions. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alésapine](https://github.com/alesapin)) +- Correction du bug que les mutations sont ignorées pour certaines parties attachées en raison de leur data\_version sont plus grandes que la version de mutation de table. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) +- Autoriser le démarrage du serveur avec des copies redondantes des pièces après les avoir déplacées vers un autre périphérique. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction de l’erreur “Sizes of columns doesn’t match” qui pourraient apparaître lors de l’utilisation de fonction d’agrégation des colonnes. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Maintenant, une exception sera levée en cas d’utilisation avec des liens à côté de LIMIT BY. Et maintenant, il est possible d’utiliser TOP avec LIMIT BY. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Correction du rechargement du dictionnaire s’il a `invalidate_query`, qui a arrêté les mises à jour et une exception sur les tentatives de mise à jour précédentes. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alésapine](https://github.com/alesapin)) + +### Clickhouse Version V19. 17. 4. 11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} + +#### Modification Incompatible En Arrière {#backward-incompatible-change} + +- Utilisation de column au lieu de AST pour stocker les résultats de la sous-requête scalaire pour de meilleures performances. Paramètre `enable_scalar_subquery_optimization` a été ajouté dans 19.17 et il a été activé par défaut. Cela conduit à des erreurs comme [ce](https://github.com/ClickHouse/ClickHouse/issues/7851) lors de la mise à niveau vers 19.17.2 ou 19.17.3 à partir des versions précédentes. Ce paramètre a été désactivé par défaut dans 19.17.4, pour permettre la mise à niveau à partir de 19.16 et des versions plus anciennes sans erreurs. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos Oiseau](https://github.com/amosbird)) + +#### Nouveauté {#new-feature} + +- Ajoutez la possibilité de créer des dictionnaires avec des requêtes DDL. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alésapine](https://github.com/alesapin)) +- Faire `bloom_filter` type de support d’index `LowCardinality` et `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ajouter une fonction `isValidJSON` pour vérifier que la chaîne est un json valide. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) +- Mettre `arrayCompact` fonction [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Mémo](https://github.com/Joeywzr)) +- Créé fonction `hex` pour les nombres Décimaux. Il fonctionne comme `hex(reinterpretAsString())`, mais ne supprime pas les derniers octets zéro. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) +- Ajouter `arrayFill` et `arrayReverseFill` fonctions, qui remplacent les éléments par d’autres éléments en avant / arrière d’eux dans le tableau. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) +- Ajouter `CRC32IEEE()`/`CRC64()` soutien [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) +- Mettre `char` fonction similaire à celle dans [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) +- Ajouter `bitmapTransform` fonction. Il transforme un tableau de valeurs d’une image bitmap dans un autre tableau de valeurs, le résultat est un nouveau bitmap [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) +- Mettre `javaHashUTF16LE()` fonction [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) +- Ajouter `_shard_num` colonne virtuelle pour le moteur distribué [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) + +#### Caractéristique Expérimentale {#experimental-feature} + +- Prise en charge des processeurs (nouveau pipeline d’exécution de requêtes) dans `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Bug Fix {#bug-fix-1} + +- Correction d’une analyse float incorrecte Dans `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un blocage rare qui peut se produire lorsque trace\_log est activé. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Empêcher la duplication des messages lors de la production de la table Kafka a tout MVS en sélectionnant [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) +- Soutien pour `Array(LowCardinality(Nullable(String)))` dans `IN`. Résoudre [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) +- Ajouter le traitement de `SQL_TINYINT` et `SQL_BIGINT` et correction de la gestion des `SQL_FLOAT` types de sources de données dans ODBC Bridge. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Correction de l’agrégation (`avg` et quantiles) sur des colonnes décimales vides [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Fixer `INSERT` en Distribué avec `MATERIALIZED` colonne [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Faire `MOVE PARTITION` fonctionne si certaines parties de la partition sont déjà sur le disque ou le volume de destination [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction d’un bug avec hardlinks ne pas être créé lors de mutations dans `ReplicatedMergeTree` dans des configurations multi-disques. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction d’un bug avec une mutation sur un MergeTree lorsque la partie entière reste inchangée et le meilleur espace est trouvé sur un autre disque [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction d’un bug avec `keep_free_space_ratio` ne pas être lu à partir de la configuration des disques [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction d’un bug avec la table ne contient que `Tuple` colonnes ou colonnes avec des chemins complexes. Fixer [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alésapine](https://github.com/alesapin)) +- Ne pas tenir compte de la mémoire pour le moteur tampon dans la limite max\_memory\_usage [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) +- Correction de l’utilisation finale de la marque dans `MergeTree` tableaux commandés par `tuple()`. Dans de rares cas cela pourrait conduire à `Can't adjust last granule` erreur lors de la sélection. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) +- Correction d’un bug dans les mutations qui ont un prédicat avec des actions qui nécessitent un contexte (par exemple des fonctions pour json), ce qui peut entraîner des plantages ou des exceptions étranges. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alésapine](https://github.com/alesapin)) +- Correction de l’inadéquation des noms de base de données et de table s’échappant dans `data/` et `shadow/` annuaire [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Correction d’un crash dans ce cas. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixer `Not found column in block` lors de la jointure sur l’expression avec jointure droite ou complète. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) +- Une tentative de plus pour corriger la boucle infinie dans `PrettySpace` format [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) +- Correction d’un bug dans `concat` fonction lorsque tous les arguments étaient `FixedString` de la même taille. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alésapine](https://github.com/alesapin)) +- Correction d’une exception en cas d’utilisation de 1 argument lors de la définition des stockages S3, URL et HDFS. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction de la portée de InterpreterSelectQuery pour les vues Avec requête [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) + +#### Amélioration {#improvement} + +- `Nullable` colonnes reconnues et valeurs NULL gérées correctement par ODBC-bridge [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- Ecrire le lot actuel pour distribué envoyer atomiquement [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) +- Lancez une exception si nous ne pouvons pas détecter la table pour le nom de la colonne dans la requête. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter `merge_max_block_size` réglage de `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) +- Les requêtes avec `HAVING` et sans `GROUP BY` supposons groupe par constante. Si, `SELECT 1 HAVING 1` maintenant retourne un résultat. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos Oiseau](https://github.com/amosbird)) +- Soutien à l’analyse `(X,)` comme tuple similaire à python. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos Oiseau](https://github.com/amosbird)) +- Faire `range` les comportements de fonction ressemblent presque à ceux de pythonic. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) +- Ajouter `constraints` les colonnes de la table `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) +- Meilleur format Null pour le gestionnaire tcp, de sorte qu’il est possible d’utiliser `select ignore() from table format Null` pour perf mesure via clickhouse-client [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos Oiseau](https://github.com/amosbird)) +- Les requêtes comme `CREATE TABLE ... AS (SELECT (1, 2))` sont analysés correctement [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) + +#### Amélioration Des Performances {#performance-improvement} + +- Les performances de l’agrégation sur les clés de chaîne courte sont améliorées. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [Amos Oiseau](https://github.com/amosbird)) +- Exécutez une autre passe d’analyse de syntaxe / expression pour obtenir des optimisations potentielles après que les prédicats constants sont pliés. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos Oiseau](https://github.com/amosbird)) +- Utilisez les méta informations de stockage pour évaluer trivial `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos Oiseau](https://github.com/amosbird), [alexeï-milovidov](https://github.com/alexey-milovidov)) +- Vectoriser le traitement `arrayReduce` semblable à Agrégateur `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Oiseau](https://github.com/amosbird)) +- Améliorations mineures des performances de `Kafka` consommation [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([Ivan](https://github.com/abyss7)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement} + +- Ajouter la prise en charge de la compilation croisée à L’architecture du processeur AARCH64. Refactoriser le code emballeur script. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([Ivan](https://github.com/abyss7)) +- Décompressez les chaînes d’outils darwin-x86\_64 et linux-aarch64 dans le volume Docker monté lors de la construction de paquets [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([Ivan](https://github.com/abyss7)) +- Mise à jour de L’Image Docker pour le Packager binaire [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([Ivan](https://github.com/abyss7)) +- Correction des erreurs de compilation sur macOS Catalina [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) +- Certains refactoring dans la logique d’analyse de requête: diviser la classe complexe en plusieurs classes simples. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix construire sans submodules [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) +- Mieux `add_globs` dans les fichiers CMake [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos Oiseau](https://github.com/amosbird)) +- Supprimer les chemins codés en dur dans `unwind` cible [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) +- Permettre d’utiliser le format mysql sans ssl [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) + +#### Autre {#other} + +- Ajout de la grammaire ANTLR4 pour le dialecte ClickHouse SQL [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +## Clickhouse Version V19. 16 {#clickhouse-release-v19-16} + +#### Clickhouse Version V19. 16. 14. 65, 2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} + +- Correction d’un bug dans les calculs par lots des opérations logiques ternaires sur plusieurs arguments (plus de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) Ce correctif a été rétroporté à la version 19.16 par une demande spéciale D’Altinity. + +#### Clickhouse Version V19. 16. 14. 65, 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} + +- Correction de l’incompatibilité des sous-requêtes distribuées avec les anciennes versions de CH. Fixer [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) + [(tabplubix)](https://github.com/tavplubix) +- Lors de l’exécution de `CREATE` requête, plier les expressions constantes dans les arguments du moteur de stockage. Remplacez le nom de base de données vide par la base de données actuelle. Fixer [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Corrigez également la vérification de l’adresse locale dans `ClickHouseDictionarySource`. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Maintenant fond fusionne dans `*MergeTree` la famille des moteurs de table préserve l’ordre de volume de la Politique de stockage avec plus de précision. + [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Empêcher la perte de données dans `Kafka` dans de rares cas, lorsque l’exception se produit après la lecture du suffixe mais avant la validation. Fixer [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Concerner: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Correction d’un bug menant à la résiliation du serveur lorsque vous essayez d’utiliser / drop `Kafka` tableau créé avec de mauvais paramètres. Fixer [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporer [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) +- Autoriser l’utilisation des `MaterializedView` avec les sous-requêtes ci-dessus `Kafka` table. + [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) + +#### Nouveauté {#new-feature-1} + +- Ajouter `deduplicate_blocks_in_dependent_materialized_views` option pour contrôler le comportement des insertions idempotent dans des tables avec des vues matérialisées. Cette nouvelle fonctionnalité a été ajoutée à la version de bugfix par une demande spéciale D’Altinity. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### Clickhouse Version V19. 16. 2. 2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} + +#### Modification Incompatible En Arrière {#backward-incompatible-change-1} + +- Ajouter une validation d’arité manquante pour count / counIf. + [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) + [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) +- Supprimer l’héritage `asterisk_left_columns_only` paramètre (il est désactivé par défaut). + [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem + Zuikov](https://github.com/4ertus2)) +- Les chaînes de Format pour le format de données de modèle sont maintenant spécifiées dans les fichiers. + [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) + +#### Nouveauté {#new-feature-2} + +- Introduisez uniqCombined64() pour calculer la cardinalité supérieure à UINT\_MAX. + [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), + [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat + Khuzhin](https://github.com/azat)) +- Soutenir les index de filtre Bloom sur les colonnes de tableau. + [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) + ([achimbab](https://github.com/achimbab)) +- Ajouter une fonction `getMacro(name)` cela renvoie une chaîne avec la valeur de `` + à partir de la configuration du serveur. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) + ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Définissez deux options de configuration pour un dictionnaire basé sur une source HTTP: `credentials` et + `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- Ajouter un nouveau ProfileEvent `Merge` cela compte le nombre de fusions d’arrière-plan lancées. + [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mikhail + Korotov](https://github.com/millb)) +- Ajouter la fonction fullHostName qui renvoie un nom de domaine complet. + [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) + [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) +- Ajouter une fonction `arraySplit` et `arrayReverseSplit` qui divise un tableau par “cut off” + condition. Ils sont utiles dans la gestion de la séquence temporelle. + [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) +- Ajoutez de nouvelles fonctions qui renvoient le tableau de tous les indices appariés dans la famille de fonctions multiMatch. + [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila + Kutenin](https://github.com/danlark1)) +- Ajouter un nouveau moteur de base de données `Lazy` qui est optimisé pour stocker un grand nombre de petits journaux + table. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nikita + Vasiliev](https://github.com/nikvas0)) +- Ajouter des fonctions d’agrégation groupBitmapAnd, - ou, - Xor pour les colonnes bitmap. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang + Yu](https://github.com/yuzhichang)) +- Ajouter des combinateurs de fonctions d’agrégat-OrNull et-OrDefault, qui renvoient null + ou des valeurs par défaut lorsqu’il n’y a rien à agréger. + [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) + ([hcz](https://github.com/hczhcz)) +- Introduire le format de données CustomSeparated qui prend en charge l’échappement personnalisé et + séparateur de règles. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) +- Soutien Redis comme source de dictionnaire externe. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton + Popov](https://github.com/CurtizJ)) + +#### Bug Fix {#bug-fix-2} + +- Correction d’un résultat de requête incorrect s’il a `WHERE IN (SELECT ...)` la section et `optimize_read_in_order` être + utiliser. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton + Popov](https://github.com/CurtizJ)) +- Plugin D’authentification MariaDB désactivé, qui dépend des fichiers en dehors du projet. + [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Iouri + Baranov](https://github.com/yurriy)) +- Correction d’une exception `Cannot convert column ... because it is constant but values of constants are different in source and result` ce qui pourrait rarement arriver lorsque les fonctions `now()`, `today()`, + `yesterday()`, `randConstant()` sont utilisés. + [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolaï + Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un problème d’utilisation de HTTP keep alive timeout au lieu de TCP keep alive timeout. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vassili + Nemkov](https://github.com/Enmk)) +- Correction d’un défaut de segmentation dans groupBitmapOr (problème [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). + [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang + Yu](https://github.com/yuzhichang)) +- Pour les vues matérialisées, le commit pour Kafka est appelé après l’écriture de toutes les données. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) +- Fixe de mal `duration_ms` valeur en `system.part_log` table. Il y a dix reprises. + [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Une solution rapide pour résoudre le crash dans la table LIVE VIEW et réactiver tous les tests LIVE VIEW. + [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Sérialiser correctement les valeurs NULL dans les index min / max des parties MergeTree. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Ne mettez pas de colonnes virtuelles à .métadonnées sql lorsque la table est créée en tant que `CREATE TABLE AS`. + [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([Ivan](https://github.com/abyss7)) +- Correction d’un défaut de segmentation dans `ATTACH PART` requête. + [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) + ([alésapine](https://github.com/alesapin)) +- Correction d’un mauvais résultat pour certaines requêtes données par l’optimisation de empty IN subqueries et empty + INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolaï + Kochetov](https://github.com/KochetovNicolai)) +- Correction D’une erreur AddressSanitizer dans la méthode LIVE VIEW getHeader (). + [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) + ([vzakaznikov](https://github.com/vzakaznikov)) + +#### Amélioration {#improvement-1} + +- Ajouter un message en cas d’attente queue\_wait\_max\_ms. + [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat + Khuzhin](https://github.com/azat)) +- Faites le réglage de `s3_min_upload_part_size` au niveau de la table. + [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Vérifiez TTL dans StorageFactory. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) + ([sundyli](https://github.com/sundy-li)) +- Squash blocs de gauche en fusion partielle join (optimisation). + [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem + Zuikov](https://github.com/4ertus2)) +- N’autorisez pas les fonctions non déterministes dans les mutations des moteurs de table répliqués, car + peut introduire des incohérences entre les répliques. + [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alexander + Kazakov](https://github.com/Akazz)) +- Désactivez le suivi de la mémoire lors de la conversion de trace de pile d’exception en chaîne. Il peut empêcher la perte + des messages d’erreur de type `Memory limit exceeded` sur le serveur, qui a causé la `Attempt to read after eof` exception sur le client. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) + ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Améliorations diverses du format. Résoudre + [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), + [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), + [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), + [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) + [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) + ([tavplubix](https://github.com/tavplubix)) +- ClickHouse ignore les valeurs du côté droit de L’opérateur IN qui ne sont pas convertibles vers la gauche + side type. Make it work properly for compound types – Array and Tuple. + [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Soutenir les inégalités manquantes pour ASOF JOIN. Il est possible de rejoindre une variante moins ou égale et stricte + plus grandes et moins de variantes pour la colonne ASOF dans la syntaxe ON. + [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem + Zuikov](https://github.com/4ertus2)) +- Optimiser la fusion partielle jointure. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) + ([Artem Zuikov](https://github.com/4ertus2)) +- N’utilisez pas plus de 98K de mémoire dans les fonctions uniqCombined. + [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), + [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat + Khuzhin](https://github.com/azat)) +- Rincer les parties de la table de jonction de droite sur le disque dans PartialMergeJoin (s’il n’y en a pas assez + mémoire). Chargez les données en arrière en cas de besoin. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) + ([Artem Zuikov](https://github.com/4ertus2)) + +#### Amélioration Des Performances {#performance-improvement-1} + +- Accélérez joinGet avec des arguments const en évitant la duplication des données. + [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos + Oiseau](https://github.com/amosbird)) +- De retour plus tôt si la sous-requête est vide. + [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) +- Optimiser l’analyse de l’expression SQL dans les valeurs. + [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) + ([tavplubix](https://github.com/tavplubix)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-1} + +- Désactivez certaines contribs pour la compilation croisée sur Mac OS. + [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([Ivan](https://github.com/abyss7)) +- Ajouter un lien manquant avec PocoXML pour clickhouse\_common\_io. + [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat + Khuzhin](https://github.com/azat)) +- Accepter plusieurs arguments de filtre de test dans clickhouse-test. + [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Activer musl et jemalloc pour ARM. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) + ([Amos Oiseau](https://github.com/amosbird)) +- Ajouter `--client-option` paramètre `clickhouse-test` pour passer des paramètres supplémentaires au client. + [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolaï + Kochetov](https://github.com/KochetovNicolai)) +- Préserver les configurations existantes lors de la mise à niveau du package rpm. + [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) + ([filimonov](https://github.com/filimonov)) +- Correction des erreurs détectées par PVS. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem + Zuikov](https://github.com/4ertus2)) +- Correction de la construction pour Darwin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) + ([Ivan](https://github.com/abyss7)) +- compatibilité glibc 2.29. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos + Oiseau](https://github.com/amosbird)) +- Assurez-vous que dh\_clean ne touche pas les fichiers sources potentiels. + [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos + Oiseau](https://github.com/amosbird)) +- Essayez d’éviter les conflits lors de la mise à jour à partir d’altinity rpm-le fichier de configuration est emballé séparément + dans clickhouse-serveur commun. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) + ([filimonov](https://github.com/filimonov)) +- Optimisez certains fichiers d’en-tête pour des reconstructions plus rapides. + [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), + [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Ajouter des tests de performance pour Date et DateTime. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vassili + Nemkov](https://github.com/Enmk)) +- Correction de certains tests contenant des mutations non déterministes. + [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alexander + Kazakov](https://github.com/Akazz)) +- Ajouter build avec MemorySanitizer à CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) + ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Évitez l’utilisation de valeurs non initialisées dans MetricsTransmitter. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat + Khuzhin](https://github.com/azat)) +- Correction de certains problèmes dans les champs trouvés par MemorySanitizer. + [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), + [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alexander + Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) + ([Amos Oiseau](https://github.com/amosbird)) +- Correction d’un comportement indéfini dans murmurhash32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos + Oiseau](https://github.com/amosbird)) +- Correction d’un comportement indéfini dans StoragesInfoStream. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) + ([tavplubix](https://github.com/tavplubix)) +- Correction du pliage d’expressions constantes pour les moteurs de base de données externes (MySQL, ODBC, JDBC). Dans les précédents + versions il ne fonctionnait pas pour plusieurs expressions constantes et ne fonctionnait pas du tout pour la Date, + DateTime et UUID. Cela corrige [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) + ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction D’une erreur de course de données ThreadSanitizer dans la vue en direct lors de l’accès à la variable no\_users\_thread. + [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Débarrassez-vous des symboles malloc dans libcommon + [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), + [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos + Oiseau](https://github.com/amosbird)) +- Ajoutez l’indicateur global ENABLE\_LIBRARIES pour désactiver toutes les bibliothèques. + [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) + ([proller](https://github.com/proller)) + +#### Nettoyage De Code {#code-cleanup} + +- Généraliser le référentiel de configuration pour préparer DDL pour les dictionnaires. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) + ([alésapine](https://github.com/alesapin)) +- Parser pour les dictionnaires DDL sans aucune sémantique. + [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) + ([alésapine](https://github.com/alesapin)) +- Divisez ParserCreateQuery en différents analyseurs plus petits. + [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) + ([alésapine](https://github.com/alesapin)) +- Petit refactoring et renommage près de dictionnaires externes. + [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) + ([alésapine](https://github.com/alesapin)) +- Refactorisez du code pour vous préparer au contrôle d’accès basé sur les rôles. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly + Baranov](https://github.com/vitlibar)) +- Quelques améliorations dans Databasecode ordinaire. + [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nikita + Vasiliev](https://github.com/nikvas0)) +- N’utilisez pas d’itérateurs dans les méthodes find() et emplace () des tables de hachage. + [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- Fix getMultipleValuesFromConfig dans le cas où le paramètre root n’est pas vide. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) + ([Mikhail Korotov](https://github.com/millb)) +- Supprimer un copier-coller (TemporaryFile et TemporaryFileStream) + [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem + Zuikov](https://github.com/4ertus2)) +- Amélioration de la lisibilité du code un peu (`MergeTreeData::getActiveContainingPart`). + [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Attendez tous les travaux planifiés, qui utilisent des objets locaux, si `ThreadPool::schedule(...)` jeter + exception. Renommer `ThreadPool::schedule(...)` de `ThreadPool::scheduleOrThrowOnError(...)` et + correction des commentaires pour rendre évident qu’il peut jeter. + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) + ([tavplubix](https://github.com/tavplubix)) + +## Version ClickHouse 19.15 {#clickhouse-release-19-15} + +### Clickhouse Version 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} + +#### Bug Fix {#bug-fix-3} + +- Ajout de la gestion de SQL\_TINYINT et SQL\_BIGINT, et correction de la gestion des types de sources de données SQL\_FLOAT dans ODBC Bridge. + [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Autorisé à avoir certaines parties sur le disque de destination ou le volume dans la PARTITION de déplacement. + [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Valeurs NULL fixes dans les colonnes nullables via ODBC-bridge. + [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- Insertion fixe dans un nœud non Local distribué avec des colonnes matérialisées. + [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Fonction fixe getMultipleValuesFromConfig. + [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) +- Correction d’un problème d’utilisation de HTTP keep alive timeout au lieu de TCP keep alive timeout. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) +- Attendez que tous les travaux se terminent à l’exception (corrige les segfaults rares). + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) +- Ne poussez pas vers MVs lors de l’insertion dans la table Kafka. + [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) +- Désactiver le suivi de la mémoire pour la pile d’exception. + [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un mauvais code dans la transformation de la requête pour la base de données externe. + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Évitez l’utilisation de valeurs non initialisées dans MetricsTransmitter. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) +- Ajout d’un exemple de configuration avec des macros pour les tests ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} + +#### Bug Fix {#bug-fix-4} + +- Correction de bad\_variant dans le dictionnaire haché. + ([alésapine](https://github.com/alesapin)) +- Correction d’un bug avec défaut de segmentation dans la requête de pièce jointe. + ([alésapine](https://github.com/alesapin)) +- Calcul du temps fixe en `MergeTreeData`. + ([Vladimir Chebotarev](https://github.com/excitoon)) +- Commit à Kafka explicitement après la finalisation de l’écriture. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) +- Sérialiser correctement les valeurs NULL dans les index min / max des parties MergeTree. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +### Clickhouse Version 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} + +#### Nouveauté {#new-feature-3} + +- Stockage à plusieurs niveaux: prise en charge de l’utilisation de plusieurs volumes de stockage pour les tables avec mergetree engine. Il est possible de stocker de nouvelles données sur SSD et de déplacer automatiquement les anciennes données sur le disque dur. ([exemple](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alésapine](https://github.com/alesapin)) +- Ajouter une fonction de table `input` pour lire les données entrantes dans `INSERT SELECT` requête. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonique1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) +- Ajouter un `sparse_hashed` mise en page du dictionnaire, qui est fonctionnellement équivalente à la `hashed` mise en page, mais est plus efficace en mémoire. Il utilise environ deux fois moins de mémoire au prix d’une récupération de valeur plus lente. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) +- Implémenter la capacité de définir la liste des utilisateurs pour l’accès aux dictionnaires. Seule la base de données connectée actuelle utilisant. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Ajouter `LIMIT` option pour `SHOW` requête. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- Ajouter `bitmapSubsetLimit(bitmap, range_start, limit)` fonction, qui renvoie le sous-ensemble du plus petit `limit` valeurs dans l’ensemble qui n’est pas inférieure à `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) +- Ajouter `bitmapMin` et `bitmapMax` fonction. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) +- Ajouter une fonction `repeat` liées à la [numéro-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([Flynn](https://github.com/ucasFL)) + +#### Caractéristique Expérimentale {#experimental-feature-1} + +- Implémentez (en mémoire) une variante de jointure de fusion qui ne change pas le pipeline actuel. Le résultat est partiellement trié par clé de fusion. Définir `partial_merge_join = 1` pour utiliser cette fonctionnalité. La Jointure de Fusion est toujours en développement. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter `S3` fonction de moteur et de table. Il est encore en développement (pas encore de support d’authentification). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) + +#### Amélioration {#improvement-2} + +- Chaque message lu à partir de Kafka est inséré atomiquement. Cela résout presque tous les problèmes connus avec Kafka engine. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([Ivan](https://github.com/abyss7)) +- Améliorations pour le basculement des requêtes distribuées. Raccourcir le temps de récupération, il est maintenant configurable et peut être vu dans `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) +- Supporte les valeurs numériques pour les énumérations directement dans `IN` section. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) +- Support (facultatif, désactivé par défaut) redirige sur le stockage D’URL. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) +- Ajouter un message d’information lorsque le client avec une ancienne version se connecte à un serveur. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- Supprimer la limite de temps de veille maximale pour l’envoi de données dans les tables distribuées [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) +- Ajouter la possibilité d’envoyer des événements de profil (compteurs) avec des valeurs cumulatives à graphite. Il peut être activé sous `` dans serveur `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) +- Ajouter automatiquement le type de fonte `T` de `LowCardinality(T)` lors de l’insertion de données dans la colonne de type `LowCardinality(T)` au format natif via HTTP. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ajout de la capacité à utiliser la fonction `hex` sans l’aide de `reinterpretAsString` pour `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-2} + +- Ajouter gdb-index au binaire clickhouse avec des informations de débogage. Il permettra d’accélérer le temps de démarrage de `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alésapine](https://github.com/alesapin)) +- Accélérez l’emballage deb avec dpkg-deb patché qui utilise `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alésapine](https://github.com/alesapin)) +- Définir `enable_fuzzing = 1` pour activer l’instrumentation libfuzzer de tout le code du projet. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) +- Ajouter Split build smoke test dans CI. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alésapine](https://github.com/alesapin)) +- Ajouter build avec MemorySanitizer à CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Remplacer `libsparsehash` avec `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) + +#### Bug Fix {#bug-fix-5} + +- Correction de la dégradation des performances de l’analyse d’index sur les clés complexes sur les grandes tables. Cela corrige \# 6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur logique provoquant segfaults lors de la sélection de Kafka sujet vide. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) +- Correction d’une connexion MySQL trop tôt fermer `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Retour du support pour les très anciens noyaux Linux (correction [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corriger les éventuelles pertes de données dans `insert select` requête en cas de bloc vide dans le flux d’entrée. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correctif pour la fonction `АrrayEnumerateUniqRanked` avec des tableaux vides dans params [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- Correction de requêtes complexes avec des jointures de tableau et des sous-requêtes globales. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) +- Fixer `Unknown identifier` erreur dans ORDER BY et GROUP BY avec plusieurs jointures [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixe `MSan` avertissement lors de l’exécution de la fonction avec `LowCardinality` argument. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Modification Incompatible En Arrière {#backward-incompatible-change-2} + +- Format de sérialisation modifié de bitmap \* états de fonction d’agrégation pour améliorer les performances. Les États sérialisés de bitmap \* des versions précédentes ne peuvent pas être lus. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) + +## Clickhouse Version 19.14 {#clickhouse-release-19-14} + +### Clickhouse Version 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} + +#### Bug Fix {#bug-fix-6} + +- Cette version contient également toutes les corrections de bugs de 19.11.12.69. +- Compatibilité fixe pour les requêtes distribuées entre 19.14 et les versions antérieures. Cela corrige [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} + +#### Bug Fix {#bug-fix-7} + +- Correctif pour la fonction `АrrayEnumerateUniqRanked` avec des tableaux vides dans params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- Nom de sous-requête fixe dans les requêtes avec `ARRAY JOIN` et `GLOBAL IN subquery` avec alias. Utilisez l’alias de sous-requête pour le nom de table externe s’il est spécifié. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-3} + +- Fixer [le battement](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) test `00715_fetch_merged_or_mutated_part_zookeeper` en le réécrivant dans un script shell car il doit attendre que des mutations s’appliquent. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) +- Correction de L’échec UBSan et MemSan en fonction `groupUniqArray` avec l’argument de tableau emtpy. Il a été causé par le placement de vide `PaddedPODArray` dans la table de hachage zéro cellule parce que le constructeur pour la valeur de cellule Zéro n’a pas été appelé. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos Oiseau](https://github.com/amosbird)) + +### Clickhouse Version 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} + +#### Nouveauté {#new-feature-4} + +- `WITH FILL` le modificateur `ORDER BY`. (suite de la [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- `WITH TIES` le modificateur `LIMIT`. (suite de la [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- Analyser non cotées `NULL` littéral comme NULL (si paramètre `format_csv_unquoted_null_literal_as_null=1`). Initialiser les champs null avec des valeurs par défaut si le type de données de ce champ n’est pas nullable (si `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) +- Prise en charge des caractères génériques dans les chemins des fonctions de table `file` et `hdfs`. Si le chemin contient des caractères génériques, la table sera en lecture seule. Exemple d’utilisation: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` et `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) +- Nouveau `system.metric_log` le tableau qui stocke les valeurs de `system.events` et `system.metrics` avec l’intervalle de temps spécifié. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Permettre d’écrire des journaux de texte ClickHouse à `system.text_log` table. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Afficher les symboles privés dans les traces de pile (cela se fait via l’analyse des tables de symboles des fichiers ELF). Ajout d’informations sur le numéro de fichier et de ligne dans les traces de pile si les informations de débogage sont présentes. Accélérer la recherche de nom de symbole avec des symboles d’indexation présents dans le programme. Ajout de nouvelles fonctions SQL pour l’introspection: `demangle` et `addressToLine`. Renommé fonction `symbolizeAddress` de `addressToSymbol` pour des raisons de cohérence. Fonction `addressToSymbol` retournera le nom mutilé pour des raisons de performance et vous devez appliquer `demangle`. Ajout d’un réglage `allow_introspection_functions` qui est désactivée par défaut. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fonction de Table `values` (le nom est sensible à la casse). Il permet de lire à partir de `VALUES` la liste proposée dans [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Exemple: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) +- Ajout d’une capacité de modifier les paramètres de stockage. Syntaxe: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alésapine](https://github.com/alesapin)) +- Support pour enlever des pièces détachées. Syntaxe: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) +- Les contraintes de Table. Permet d’ajouter une contrainte à la définition de la table qui sera vérifiée lors de l’insertion. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Soutien en cascade des vues matérialisées. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos Oiseau](https://github.com/amosbird)) +- Activez query profiler par défaut pour échantillonner chaque thread d’exécution de requête une fois par seconde. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Format d’entrée `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) +- Ajout de deux nouvelles fonctions: `sigmoid` et `tanh` (qui sont utiles pour les applications d’apprentissage automatique). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fonction `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` pour vérifier si un jeton est dans la botte de foin. Le jeton est une sous-chaîne de longueur maximale entre deux caractères ASCII non alphanumériques (ou limites de haystack). Le jeton doit être une chaîne constante. Pris en charge par tokenbf\_v1 spécialisation de l’index. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) +- Nouvelle fonction `neighbor(value, offset[, default_value])`. Permet d’atteindre la valeur prev / next dans la colonne d’un bloc de données. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Laquelle Le Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) +- Créé une fonction `currentUser()`, retour connexion de l’utilisateur autorisé. Ajout d’alias `user()` pour la compatibilité avec MySQL. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Laquelle Le Krash](https://github.com/alex-krash)) +- Nouvelles fonctions d’agrégation `quantilesExactInclusive` et `quantilesExactExclusive` qui étaient proposés dans [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) +- Fonction `bitmapRange(bitmap, range_begin, range_end)` qui renvoie un nouvel ensemble avec une plage spécifiée (ne pas inclure `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fonction `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` ce qui crée un tableau de chaînes de précision longues de geohash-boîtes couvrant la zone fournie. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) +- Implémenter la prise en charge de la requête INSERT avec `Kafka` table. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([Ivan](https://github.com/abyss7)) +- Ajout du support pour `_partition` et `_timestamp` colonnes virtuelles au moteur Kafka. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([Ivan](https://github.com/abyss7)) +- Possibilité de supprimer des données sensibles de `query_log`, journaux de serveur, liste de processus avec des règles basées sur regexp. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) + +#### Caractéristique Expérimentale {#experimental-feature-2} + +- Format de données d’entrée et de sortie `Template`. Il permet de spécifier une chaîne de format personnalisée pour l’entrée et la sortie. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) +- La mise en œuvre de `LIVE VIEW` tableaux qui ont été initialement proposés dans [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) préparés dans [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), puis mis à jour dans [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). Voir [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) pour une description détaillée. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) Note que `LIVE VIEW` fonction peut être supprimée dans les prochaines versions. + +#### Bug Fix {#bug-fix-8} + +- Cette version contient également toutes les corrections de bugs de 19.13 et 19.11. +- Correction d’un défaut de segmentation lorsque la table a des indices de saut et que la fusion verticale se produit. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alésapine](https://github.com/alesapin)) +- Correction de TTL par colonne avec des valeurs par défaut de colonne non triviales. Auparavant en cas de force TTL fusionner avec `OPTIMIZE ... FINAL` requête, les valeurs expirées ont été remplacées par des valeurs par défaut de type au lieu des valeurs par défaut de colonne spécifiées par l’utilisateur. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) +- Correction du problème de duplication des messages Kafka lors du redémarrage normal du serveur. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) +- Boucle infinie fixe lors de la lecture des messages Kafka. Ne pas mettre en pause/reprendre le consommateur sur l’abonnement du tout - sinon il peut être mis en pause indéfiniment dans certains scénarios. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([Ivan](https://github.com/abyss7)) +- Fixer `Key expression contains comparison between inconvertible types` exception dans `bitmapContains` fonction. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) +- Correction de segfault avec activé `optimize_skip_unused_shards` et clé de sharding manquante. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) +- Correction du mauvais code dans les mutations qui peuvent conduire à la corruption de la mémoire. Correction de segfault avec lecture de l’adresse `0x14c0` cela peut se produire en raison de simultané `DROP TABLE` et `SELECT` de `system.parts` ou `system.parts_columns`. Condition de course fixe dans la préparation des requêtes de mutation. Blocage fixe causé par `OPTIMIZE` des tables répliquées et des opérations de modification simultanées comme ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Suppression de la journalisation supplémentaire dans L’interface MySQL [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Renvoie la possibilité d’analyser les paramètres booléens depuis ‘true’ et ‘false’ dans le fichier de configuration. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alésapine](https://github.com/alesapin)) +- Correction d’un crash dans l’ `quantile` et `median` la fonction sur `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction possible résultat incomplet retourné par `SELECT` requête avec `WHERE` condition sur la clé primaire contient la conversion en type Float. Il a été causé par une vérification incorrecte de la monotonie dans `toFloat` fonction. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- Vérifier `max_expanded_ast_elements` réglage des mutations. Mutations claires après `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Correction des résultats de jointure pour les colonnes clés lorsqu’elles sont utilisées avec `join_use_nulls`. Attachez des valeurs NULL au lieu des valeurs par défaut des colonnes. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction des indices de saut avec Fusion verticale et modification. Correctif pour `Bad size of marks file` exception. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alésapine](https://github.com/alesapin)) +- Correction plantage rare dans `ALTER MODIFY COLUMN` et fusion verticale lorsque l’une des parties fusionnées/modifiées est vide (0 lignes) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug dans la conversion de `LowCardinality` types de `AggregateFunctionFactory`. Cela corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un comportement incorrect et de segfaults possibles dans `topK` et `topKWeighted` agrégé fonctions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) +- Code dangereux fixe autour `getIdentifier` fonction. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug dans le protocole de fil MySQL (est utilisé lors de la connexion à clickhouse forme client MySQL). Causé par un débordement de tampon de tas `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) +- Fuite de mémoire fixe dans `bitmapSubsetInRange` fonction. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) +- Correction d’un bug rare lorsque la mutation est exécutée après un changement de granularité. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alésapine](https://github.com/alesapin)) +- Autoriser le message protobuf avec tous les champs par défaut. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) +- Résoudre un bug avec `nullIf` fonction lorsque nous envoyer un `NULL` l’argument sur le deuxième argument. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Correction d’un bug rare avec une mauvaise allocation/désallocation de la mémoire dans des dictionnaires de cache de clés Complexes avec des champs de chaîne qui conduit à une consommation de mémoire infinie (ressemble à une fuite de mémoire). Bug se reproduit lorsque la taille de la chaîne était une puissance de deux à partir de huit (8, 16, 32, etc.). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alésapine](https://github.com/alesapin)) +- Correction de L’encodage Gorilla sur les petites séquences qui a provoqué une exception `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) +- Permet d’utiliser des types Non nullables dans les jointures avec `join_use_nulls` permettre. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) +- Désactiver `Poco::AbstractConfiguration` substitutions dans la requête dans `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Éviter l’impasse dans `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Utiliser `arrayReduce` pour des arguments constants peuvent conduire à segfault. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction des parties incohérentes qui peuvent apparaître si la réplique a été restaurée après `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- Correction du blocage dans `JSONExtractRaw` fonction. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug avec des indices de saut incorrects sérialisation et agrégation avec granularité adaptative. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alésapine](https://github.com/alesapin)) +- Fixer `WITH ROLLUP` et `WITH CUBE` les modificateurs de `GROUP BY` avec agrégation à deux niveaux. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Correction d’un bug avec l’écriture de marques d’indices secondaires avec une granularité adaptative. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alésapine](https://github.com/alesapin)) +- Correction de l’ordre d’initialisation lors du démarrage du serveur. Depuis `StorageMergeTree::background_task_handle` est initialisée dans `startup()` le `MergeTreeBlockOutputStream::write()` peut tenter de l’utiliser avant l’initialisation. Vérifiez simplement s’il est initialisé. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) +- Effacement du tampon de données de l’opération de lecture précédente terminée par une erreur. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) +- Correction d’un bug avec l’activation de la granularité adaptative lors de la création d’une nouvelle réplique pour la table répliquée\*MergeTree. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alésapine](https://github.com/alesapin)) +- Correction d’un crash possible lors du démarrage du serveur en cas d’exception `libunwind` au cours de l’exception à l’accès à uninitialized `ThreadStatus` structure. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Correction d’un crash dans l’ `yandexConsistentHash` fonction. Trouvé par fuzz test. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la possibilité de suspendre les requêtes lorsque le serveur est surchargé et que le pool de threads global devient presque complet. Cela a plus de chances de se produire sur les clusters avec un grand nombre de fragments (des centaines), car les requêtes distribuées allouent un thread par connexion à chaque fragment. Par exemple, ce problème peut se reproduire si un cluster de 330 fragments traite 30 requêtes distribuées simultanées. Ce problème affecte toutes les versions à partir de 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe la logique de `arrayEnumerateUniqRanked` fonction. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de segfault lors du décodage de la table des symboles. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos Oiseau](https://github.com/amosbird)) +- Correction d’une exception non pertinente dans la distribution de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Suppression de guillemets supplémentaires de description dans `system.settings` table. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Éviter l’impasse possible dans `TRUNCATE` de table Répliquée. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la lecture dans l’ordre de la clé de tri. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) +- Fixer `ALTER TABLE ... UPDATE` requête pour les tables avec `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug ouvert par [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (depuis 19.4.0). Reproduit dans les requêtes aux tables distribuées sur les tables MergeTree lorsque nous n’interrogeons aucune colonne (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alésapine](https://github.com/alesapin)) +- Dépassement fixe dans la division entière du type signé au type non signé. Le comportement était exactement comme dans le langage C ou c++ (règles de promotion entières) qui peut être surprenant. Veuillez noter que le débordement est toujours possible lors de la division d’un grand nombre signé en un grand nombre non signé ou vice-versa (mais ce cas est moins habituel). Le problème existait dans toutes les versions du serveur. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Limiter le temps de sommeil maximal pour l’étranglement lorsque `max_execution_speed` ou `max_execution_speed_bytes` est définie. Correction de fausses erreurs comme `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de problèmes d’utilisation `MATERIALIZED` colonnes et alias dans `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos Oiseau](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer `FormatFactory` comportement pour les flux d’entrée qui ne sont pas implémentés en tant que Processeur. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’une faute. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) +- Typo dans le message d’erreur (is - \> are). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) +- Correction d’une erreur lors de l’analyse de la liste des colonnes de la chaîne si le type contenait une virgule (Ce problème était pertinent pour `File`, `URL`, `HDFS` stockage) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) + +#### Correction De Sécurité {#security-fix} + +- Cette version contient également tous les correctifs de sécurité de bugs de 19.13 et 19.11. +- Correction de la possibilité d’une requête fabriquée pour provoquer un crash du serveur en raison d’un débordement de pile dans L’analyseur SQL. Correction de la possibilité de débordement de pile dans les tables de fusion et distribuées, les vues matérialisées et les conditions de sécurité au niveau des lignes impliquant des sous-requêtes. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Amélioration {#improvement-3} + +- Mise en œuvre correcte de la logique ternaire pour `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) +- Maintenant les valeurs et les lignes avec TTL expiré seront supprimées après `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` requête. Ajouté requêtes `SYSTEM STOP/START TTL MERGES` pour interdire / autoriser les fusions d’affectation avec TTL et filtrer les valeurs expirées dans toutes les fusions. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) +- Possibilité de changer l’emplacement du fichier d’historique ClickHouse pour le client à l’aide `CLICKHOUSE_HISTORY_FILE` env. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) +- Supprimer `dry_run` drapeau de `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Soutien `ASOF JOIN` avec `ON` section. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) +- Meilleure prise en charge des index de saut pour les mutations et la réplication. Soutien pour `MATERIALIZE/CLEAR INDEX ... IN PARTITION` requête. `UPDATE x = x` recalcule tous les indices qui utilisent la colonne `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) +- Permettre à `ATTACH` affichages en direct (par exemple, au démarrage du serveur), indépendamment de `allow_experimental_live_view` paramètre. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Pour les traces de pile recueillies par le profileur de requête, n’incluez pas les trames de pile générées par le profileur de requête lui-même. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant fonctions de table `values`, `file`, `url`, `hdfs` avoir un support pour les colonnes ALIAS. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Lancer une exception si `config.d` le fichier n’a pas l’élément racine correspondant comme fichier de configuration. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) +- Imprimer des informations supplémentaires dans le message d’exception pour `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) +- Lors de la détermination des éclats d’un `Distributed` table à couvrir par une requête de lecture (pour `optimize_skip_unused_shards` = 1) ClickHouse vérifie maintenant les conditions des deux `prewhere` et `where` clauses de l’instruction select. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) +- Permettre `SIMDJSON` pour les machines sans AVX2 mais avec SSE 4.2 et pclmul jeu d’instructions. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse peut fonctionner sur les systèmes de fichiers sans `O_DIRECT` soutien (tels que ZFS et BtrFS) sans réglage supplémentaire. [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Soutien pousser vers le bas prédicat pour la sous-requête finale. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mieux `JOIN ON` extraction des clés [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) +- Mise à jour `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Optimiser la sélection de la plus petite colonne pour `SELECT count()` requête. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos Oiseau](https://github.com/amosbird)) +- Ajouter `strict` paramètre `windowFunnel()`. Lorsque l’ `strict` est définie, le `windowFunnel()` applique des conditions uniquement pour les valeurs uniques. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) +- Interface plus sûre de `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) +- Options taille de ligne lors de l’exécution avec `--help` l’option correspond maintenant à la taille du terminal. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) +- Désactiver “read in order” optimisation pour l’agrégation, sans touches. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) +- Code D’état HTTP pour `INCORRECT_DATA` et `TYPE_MISMATCH` les codes d’erreur ont été modifiés par défaut `500 Internal Server Error` de `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) +- Déplacer Rejoindre objet de `ExpressionAction` dans `AnalyzedJoin`. `ExpressionAnalyzer` et `ExpressionAction` ne sais pas à propos de `Join` classe de plus. Sa logique est cachée par `AnalyzedJoin` iface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un blocage possible des requêtes distribuées lorsque l’un des fragments est localhost mais que la requête est envoyée via une connexion réseau. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Sémantique modifiée de plusieurs tables `RENAME` pour éviter les blocages possibles. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Serveur de compatibilité MySQL réécrit pour empêcher le chargement de la charge utile de paquet complet en mémoire. Diminution de la consommation de mémoire pour chaque connexion à environ `2 * DBMS_DEFAULT_BUFFER_SIZE` (tampons de lecture/écriture). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) +- Déplacez l’alias AST interprétant la logique hors de l’analyseur qui n’a rien à savoir sur la sémantique des requêtes. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) +- Analyse légèrement plus sûre de `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-copier`: Permet d’utiliser les `where_condition` de config avec `partition_key` alias dans la requête pour vérifier l’existence de la partition (auparavant, il était utilisé uniquement dans la lecture des requêtes de données). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) +- Ajout d’un argument de message Facultatif dans `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) +- L’exception du serveur obtenue lors de l’envoi des données d’insertion est également en cours de traitement dans le client. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) +- Ajout d’une métrique `DistributedFilesToInsert` cela montre le nombre total de fichiers dans le système de fichiers qui sont sélectionnés pour envoyer aux serveurs distants par des tables distribuées. Le nombre est additionné à travers tous les fragments. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Déplacer la plupart des jointures préparer la logique de `ExpressionAction/ExpressionAnalyzer` de `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix TSan [avertissement](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) +- De meilleurs messages d’information sur le manque de capacités Linux. Journalisation des erreurs fatales avec “fatal” niveau, cela le rendra plus facile à trouver dans `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Lorsque activer le dumping des données temporaires sur le disque pour limiter l’utilisation de la mémoire pendant `GROUP BY`, `ORDER BY` il n’a pas vérifier l’espace disque libre. Le correctif ajoute un nouveau paramètre `min_free_disk_space`, lorsque l’espace disque libre est plus petit que le seuil, la requête s’arrêtera et lancera `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimé rwlock récursif par thread. Cela n’a aucun sens, car les threads sont réutilisés entre les requêtes. `SELECT` la requête peut acquérir un verrou dans un thread, tenir un verrou d’un autre thread et quitter le premier thread. Dans le même temps, le premier fil peut être réutilisé par `DROP` requête. Cela mènera à la faux “Attempt to acquire exclusive lock recursively” message. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Split `ExpressionAnalyzer.appendJoin()`. Préparer une place dans `ExpressionAnalyzer` pour `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter `mysql_native_password` plugin d’authentification au serveur de compatibilité MySQL. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) +- Un moins grand nombre de `clock_gettime` appels; correction de la compatibilité ABI entre debug / release in `Allocator` (question insignifiante). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Déplacer `collectUsedColumns` de `ExpressionAnalyzer` de `SyntaxAnalyzer`. `SyntaxAnalyzer` faire `required_source_columns` lui-même maintenant. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter un paramètre `joined_subquery_requires_alias` pour exiger des alias pour les sous-sélections et les `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) +- Extrait `GetAggregatesVisitor` classe de `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) +- `system.query_log`: modifier le type de données de `type` colonne de `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- La liaison statique de `sha256_password` greffon d’authentification. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) +- Évitez la dépendance supplémentaire pour le paramètre `compile` travailler. Dans les versions précédentes, l’utilisateur peut obtenir une erreur comme `cannot open crti.o`, `unable to find library -lc` etc. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Plus de validation de l’entrée qui peut provenir d’une réplique malveillante. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant `clickhouse-obfuscator` le fichier est disponible dans `clickhouse-client` paquet. Dans les versions précédentes, il était disponible en tant que `clickhouse obfuscator` (avec des espaces). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) +- Blocage fixe lorsque nous avons au moins deux requêtes qui lisent au moins deux tables dans un ordre différent et une autre requête qui effectue une opération DDL sur l’une des tables. Correction d’une autre impasse très rare. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter `os_thread_ids` colonne de `system.processes` et `system.query_log` pour une meilleure mise possibilités. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Une solution de contournement pour les bogues D’extension PHP mysqlnd qui se produisent lorsque `sha256_password` est utilisé comme un plugin d’authentification par défaut (décrit dans [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) +- Supprimez la place inutile avec les colonnes de nullité modifiées. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) +- Définir la valeur par défaut de `queue_max_wait_ms` à zéro, parce que la valeur actuelle (cinq secondes) n’a aucun sens. Il y a de rares circonstances où ce paramètre a une utilité. Ajout des paramètres de `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` et `connection_pool_max_wait_ms` pour la désambiguïsation. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Extrait `SelectQueryExpressionAnalyzer` de `ExpressionAnalyzer`. Conservez le dernier pour les requêtes non-select. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) +- Suppression de la duplication des formats d’entrée et de sortie. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Autoriser l’utilisateur à remplacer `poll_interval` et `idle_connection_timeout` paramètres de connexion. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `MergeTree` a maintenant une option supplémentaire `ttl_only_drop_parts` (désactivé par défaut) pour éviter l’élagage partiel des pièces, afin qu’elles tombent complètement lorsque toutes les lignes d’une pièce sont expirées. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) +- Type vérifie les fonctions set index. Throw exception si la fonction a un mauvais type. Cela corrige le test fuzz avec UBSan. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Amélioration Des Performances {#performance-improvement-2} + +- Optimiser les requêtes avec `ORDER BY expressions` clause, où `expressions` ont coïncidé préfixe avec clé de tri dans `MergeTree` table. Cette optimisation est contrôlée par `optimize_read_in_order` paramètre. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) +- Permettre d’utiliser plusieurs threads pendant le chargement et le retrait des pièces. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Variante de lot implémentée de la mise à jour des états de fonction d’agrégat. Il peut conduire à des avantages de performance. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Utiliser `FastOps` bibliothèque de fonctions `exp`, `log`, `sigmoid`, `tanh`. FastOps est une bibliothèque mathématique vectorielle rapide de Michael Parakhin (Yandex CTO). Amélioration des performances de `exp` et `log` fonctions plus de 6 fois. Fonction `exp` et `log` de `Float32` l’argument retournera `Float32` (dans les versions précédentes, ils reviennent toujours `Float64`). Maintenant `exp(nan)` peut-retour `inf`. Le résultat de `exp` et `log` les fonctions peuvent ne pas être le nombre représentable de la machine le plus proche de la vraie réponse. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) Utilisation de la variante Danila Kutenin pour faire fonctionner les fasttops [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Désactiver l’optimisation de clé consécutive pour `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) +- Amélioration des performances de `simdjson` bibliothèque en se débarrassant de l’allocation dynamique dans `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) +- Pages de pré-défaut lors de l’allocation de mémoire avec `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) +- Correction d’un bug de performance dans `Decimal` comparaison. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-4} + +- Supprimer le compilateur (instanciation du modèle d’exécution) car nous avons gagné sur ses performances. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout d’un test de performance pour montrer la dégradation des performances dans gcc-9 de manière plus isolée. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout d’un tableau de fonction `numbers_mt`, qui est la version multithread `numbers`. Mise à jour des tests de performance avec des fonctions de hachage. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Mode de comparaison dans `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) +- Meilleur effort pour imprimer des traces de pile. Également ajouté `SIGPROF` comme un signal de débogage pour imprimer la trace de la pile d’un thread en cours d’exécution. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Chaque fonction dans son propre fichier, partie 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer doublé const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) +- Changements de formatage pour `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) +- Meilleure sous-requête pour la création de jointures dans `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) +- Supprimer une condition redondante (trouvée par PVS Studio). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) +- Séparer l’interface de table de hachage pour `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) +- Refactoring des paramètres. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alésapine](https://github.com/alesapin)) +- Ajouter des commentaires pour `set` fonctions d’index. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) +- Augmenter le score OOM dans la version de débogage sur Linux. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) +- HDFS HA fonctionne maintenant dans la construction de débogage. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) +- Ajout d’un test pour `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un test pour plusieurs vues matérialisées pour la table Kafka. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([Ivan](https://github.com/abyss7)) +- Faire mieux construire régime. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([Ivan](https://github.com/abyss7)) +- Fixe `test_external_dictionaries` intégration dans le cas où il a été exécuté sous un utilisateur non root. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Le bogue se reproduit lorsque la taille totale des paquets écrits dépasse `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) +- Ajout d’un test pour `RENAME` tableau condition de course [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Évitez la course de données sur les paramètres dans `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un test d’intégration pour gérer les erreurs par un dictionnaire de cache. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) +- Désactiver l’analyse des fichiers objet ELF sur Mac OS, car cela n’a aucun sens. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Essayez de rendre le générateur de changelog meilleur. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Additionneur `-Wshadow` passer à la GCC. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Suppression du code obsolète pour `mimalloc` soutien. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `zlib-ng` détermine les capacités x86 et enregistre ces informations dans les variables globales. Ceci est fait dans l’appel defalteInit, qui peut être fait par différents threads simultanément. Pour éviter les Écritures multithread, faites-le au démarrage de la bibliothèque. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) +- Test de régression pour un bug qui dans join qui a été corrigé dans [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) +- Rapport MSAN fixe. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du test TTL battement. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) +- Correction de fausse course de données dans `MergeTreeDataPart::is_frozen` champ. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Délais d’attente fixes dans le test fuzz. Dans la version précédente, il a réussi à trouver false hangup dans la requête `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouté debug contrôles `static_cast` des colonnes. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Prise en charge D’Oracle Linux dans les paquets RPM officiels. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Changé JSON perftests de `once` de `loop` type. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `odbc-bridge.cpp` définit `main()` donc, il ne devrait pas être inclus dans `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) +- Test de crash dans l’ `FULL|RIGHT JOIN` avec nulls dans les clés de la table de droite. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajout d’un test pour la limite d’extension des alias, juste au cas où. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Commutation de `boost::filesystem` de `std::filesystem` échéant. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout de paquets RPM au site web. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un test pour fixe `Unknown identifier` exception dans `IN` section. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) +- Simplifier `shared_ptr_helper` parce que les gens confrontés à des difficultés à le comprendre. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout de tests de performance pour le codec Gorilla et DoubleDelta fixe. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) +- Diviser le test d’intégration `test_dictionaries` dans 4 tests distincts. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction de L’avertissement PVS-Studio dans `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Permettre d’utiliser `library` dictionnaire source avec ASan. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout d’une option pour générer changelog à partir d’une liste de PRs. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Verrouiller le `TinyLog` de stockage lors de la lecture. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) +- Vérifiez les liens symboliques brisés dans CI. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Augmentez le délai pour “stack overflow” test car cela peut prendre beaucoup de temps dans la construction de débogage. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout d’une vérification pour les doubles espaces. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer `new/delete` suivi de la mémoire lors de la construction avec des désinfectants. Le suivi n’est pas clair. Il empêche uniquement les exceptions de limite de mémoire dans les tests. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) +- Activez la vérification des symboles non définis lors de la liaison. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([Ivan](https://github.com/abyss7)) +- Éviter la reconstruction `hyperscan` quotidien. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Rapport UBSan fixe dans `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ne permettez pas d’utiliser query profiler avec des désinfectants car il n’est pas compatible. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un test pour recharger un dictionnaire après échec par minuterie. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction de l’incohérence dans `PipelineExecutor::prepareProcessor` type d’argument. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ajout d’un test pour les mauvais URI. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouté plus de contrôles `CAST` fonction. Cela devrait obtenir plus d’informations sur la faille de segmentation dans le test flou. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ajouter `gcc-9` soutien à `docker/builder` conteneur qui construit l’image localement. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Test de la clé primaire avec `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) +- Correction des tests affectés par l’impression de traces de pile lente. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un cas de test pour crash in `groupUniqArray` fixe dans [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) +- Tests de mutations d’indices fixes. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) +- Dans le test de performance, ne lisez pas le journal des requêtes pour les requêtes que nous n’avons pas exécutées. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) +- La vue matérialisée peut maintenant être créée avec n’importe quel type de cardinalité faible quel que soit le paramètre concernant les types de cardinalité faible suspects. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) +- Mise à jour des tests pour `send_logs_level` paramètre. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction de la construction sous gcc-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) +- Correction de la construction avec libc++interne. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([Ivan](https://github.com/abyss7)) +- Correction de la construction partagée avec `rdkafka` bibliothèque [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) +- Correctifs pour Mac OS build (incomplet). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) +- Fixer “splitted” construire. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Autres correctifs: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos Oiseau](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([Ivan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) + +#### Modification Incompatible En Arrière {#backward-incompatible-change-3} + +- Suppression de la fonction de table rarement utilisée `catBoostPool` et de stockage `CatBoostPool`. Si vous avez utilisé cette fonction de table, veuillez écrire un courriel à `clickhouse-feedback@yandex-team.com`. Notez que L’intégration CatBoost reste et sera prise en charge. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Désactiver `ANY RIGHT JOIN` et `ANY FULL JOIN` par défaut. Définir `any_join_distinct_right_table_keys` réglage pour les activer. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) + +## Clickhouse Version 19.13 {#clickhouse-release-19-13} + +### Clickhouse Version 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} + +#### Bug Fix {#bug-fix-9} + +- Cette version contient également toutes les corrections de bugs de 19.11.12.69. + +### Clickhouse Version 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} + +#### Bug Fix {#bug-fix-10} + +- Cette version contient également toutes les corrections de bugs de 19.14.6.12. +- Correction d’un état incohérent possible de la table lors de l’exécution `DROP` requête pour la table répliquée alors que zookeeper n’est pas accessible. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Correction de la course de données dans StorageMerge [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug introduit dans query profiler qui conduit à recv sans fin de socket. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alésapine](https://github.com/alesapin)) +- Correction de l’utilisation excessive du processeur lors de l’exécution `JSONExtractRaw` la fonction sur une valeur booléenne. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corrige la régression tout en poussant vers la vue matérialisée. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([Ivan](https://github.com/abyss7)) +- Fonction de Table `url` la vulnérabilité avait-elle permis à l’attaquant d’injecter des en-têtes HTTP arbitraires dans la requête. Ce problème a été trouvé par [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fix inutile `AST` vérifier dans L’index de jeu. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) +- Fixe l’analyse de `AggregateFunction` valeurs ancrées dans la requête. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fixe mauvais comportement de `trim` les fonctions de la famille. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} + +#### Bug Fix {#bug-fix-11} + +- Cette version contient également tous les correctifs de sécurité de bugs de 19.11.9.52 et 19.11.10.54. +- Les données fixes de course `system.parts` table et `ALTER` requête. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’en-tête non apparié dans les flux se sont produits en cas de lecture à partir d’une table distribuée vide avec sample et prewhere. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un crash lors de l’utilisation de `IN` clause avec une sous-requête avec un tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Corrigé cas avec les mêmes noms de colonnes dans `GLOBAL JOIN ON` section. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un crash lors de la coulée de types à `Decimal` qui ne la supportent pas. Jetez exception à la place. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un crash dans `extractAll()` fonction. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) +- Transformation de requête pour `MySQL`, `ODBC`, `JDBC` fonctions de table fonctionne maintenant correctement pour `SELECT WHERE` requêtes avec plusieurs `AND` expression. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) +- Ajout de vérifications de déclaration précédentes pour L’intégration de MySQL 8. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) + +#### Correction De Sécurité {#security-fix-1} + +- Correction de deux vulnérabilités dans les codecs en phase de décompression (l’utilisateur malveillant peut fabriquer des données compressées qui conduiront à un débordement de tampon en décompression). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) + +### Clickhouse Version 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} + +#### Bug Fix {#bug-fix-12} + +- Fixer `ALTER TABLE ... UPDATE` requête pour les tables avec `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alésapine](https://github.com/alesapin)) +- Correction de NPE lors de l’utilisation de la clause IN avec une sous-requête avec un tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un problème que si un réplica périmé devient vivant, il peut encore avoir des parties de données qui ont été supprimés par la partition DROP. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un problème avec l’analyse CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- Course de données fixe dans le système.table de pièces et ALTER query. Cela corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du mauvais code dans les mutations qui peuvent conduire à la corruption de la mémoire. Correction de segfault avec lecture de l’adresse `0x14c0` cela peut se produire en raison de simultané `DROP TABLE` et `SELECT` de `system.parts` ou `system.parts_columns`. Condition de course fixe dans la préparation des requêtes de mutation. Blocage fixe causé par `OPTIMIZE` des tables répliquées et des opérations de modification simultanées comme ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction possible perte de données après `ALTER DELETE` requête sur la table avec l’index de saut. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Correction De Sécurité {#security-fix-2} + +- Si L’attaquant a un accès en écriture à ZooKeeper et est capable d’exécuter un serveur personnalisé disponible à partir du réseau où clickhouse s’exécute, il peut créer un serveur malveillant sur mesure qui agira comme réplique de ClickHouse et l’enregistrer dans ZooKeeper. Lorsqu’une autre réplique récupère une partie de données à partir d’une réplique malveillante, elle peut forcer clickhouse-server à écrire sur un chemin arbitraire sur le système de fichiers. Trouvé par Eldar Zaitov, équipe de sécurité de L’information chez Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} + +#### Nouveauté {#new-feature-5} + +- Échantillonnage du profileur au niveau de la requête. [Exemple](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) +- Permet de spécifier une liste de colonnes avec `COLUMNS('regexp')` expression qui fonctionne comme une variante plus sophistiquée de `*` astérisque. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `CREATE TABLE AS table_function()` est maintenant possible [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) +- Adam optimizer pour la descente de gradient stochastique est utilisé par défaut dans `stochasticLinearRegression()` et `stochasticLogisticRegression()` fonctions d’agrégation, car il montre une bonne qualité sans presque aucun réglage. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) +- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Andy Yang](https://github.com/andyyzh)) +- `RENAME` les requêtes fonctionnent maintenant avec tous les stockages. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([Ivan](https://github.com/abyss7)) +- Maintenant client de recevoir les journaux du serveur avec n’importe quel niveau de `send_logs_level` quel que soit le niveau de journal spécifié dans les paramètres du serveur. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) + +#### Modification Incompatible En Arrière {#backward-incompatible-change-4} + +- Paramètre `input_format_defaults_for_omitted_fields` est activé par défaut. Les insertions dans les tables distribuées ont besoin que ce paramètre soit le même sur le cluster (vous devez le définir avant de lancer la mise à jour). Il permet de calculer des expressions par défaut Complexes pour les champs omis dans `JSONEachRow` et `CSV*` format. Il devrait être le comportement attendu, mais peut conduire à négligeable différence de performances. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) + +#### Caractéristiques expérimentales {#experimental-features} + +- Nouveau pipeline de traitement des requêtes. Utiliser `experimental_use_processors=1` une option pour l’activer. Utilisez pour votre propre problème. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Bug Fix {#bug-fix-13} + +- L’intégration de Kafka a été corrigée dans cette version. +- Fixe `DoubleDelta` l’encodage de `Int64` pour les grands `DoubleDelta` les valeurs, l’amélioration de la `DoubleDelta` encodage de données aléatoires pour `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) +- Surestimation fixe de `max_rows_to_read` si le paramètre `merge_tree_uniform_read_distribution` est réglé sur 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Amélioration {#improvement-4} + +- Lève une exception si `config.d` le fichier n’a pas l’élément racine correspondant comme fichier de configuration [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) + +#### Amélioration Des Performances {#performance-improvement-3} + +- Optimiser `count()`. Maintenant, il utilise la plus petite colonne (si possible). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos Oiseau](https://github.com/amosbird)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-5} + +- Signaler l’utilisation de la mémoire dans les tests de performance. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) +- Correction de la construction avec externe `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([Ivan](https://github.com/abyss7)) +- Correction de la construction partagée avec `rdkafka` bibliothèque [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) + +## Clickhouse Version 19.11 {#clickhouse-release-19-11} + +### Version De ClickHouse 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} + +#### Bug Fix {#bug-fix-14} + +- Correction d’un crash rare dans `ALTER MODIFY COLUMN` et fusion verticale lorsque l’une des parties fusionnées/modifiées est vide (0 lignes). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alésapine](https://github.com/alesapin)) +- Mise à jour manuelle de `SIMDJSON`. Cela corrige l’inondation possible des fichiers stderr avec des messages de diagnostic JSON faux. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) +- Correction d’un bug avec `mrk` extension de fichier pour mutations ([alésapine](https://github.com/alesapin)) + +### Version De ClickHouse 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} + +#### Bug Fix {#bug-fix-15} + +- Correction de la dégradation des performances de l’analyse d’index sur les clés complexes sur les grandes tables. Cela corrige [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Évitez SIGSEGV rare lors de l’envoi de données dans des tables avec moteur distribué (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) +- Fixer `Unknown identifier` avec plusieurs jointures. Cela corrige [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) + +### Clickhouse Version 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} + +- Correction d’une erreur logique provoquant segfaults lors de la sélection de Kafka sujet vide. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) +- Correctif pour la fonction `АrrayEnumerateUniqRanked` avec des tableaux vides dans params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) + +### Clickhouse Version 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} + +#### Bug Fix {#bug-fix-16} + +- Stockez manuellement les décalages des messages Kafka pour pouvoir les valider tous à la fois pour toutes les partitions. Corrige la duplication potentielle dans “one consumer - many partitions” scénario. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([Ivan](https://github.com/abyss7)) + +### Clickhouse Version 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} + +- Améliorer la gestion des erreurs dans les dictionnaires de cache. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction d’un bug dans la fonction `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) +- Fixer `JSONExtract` fonction lors de l’extraction d’une `Tuple` de JSON. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction possible perte de données après `ALTER DELETE` requête sur la table avec l’index de saut. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) +- Test de performance fixe. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Parquet: Correction de la lecture des colonnes booléennes. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe mauvais comportement de `nullIf` fonction pour les arguments constants. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du problème de duplication des messages Kafka lors du redémarrage normal du serveur. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) +- Correction d’un problème quand long `ALTER UPDATE` ou `ALTER DELETE` peut empêcher régulière fusionne à exécuter. Empêcher les mutations de s’exécuter s’il n’y a pas assez de threads libres disponibles. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) +- Correction d’une erreur avec le traitement “timezone” dans le fichier de configuration du serveur. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction des tests kafka. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([Ivan](https://github.com/abyss7)) + +#### Correction De Sécurité {#security-fix-3} + +- Si L’attaquant a un accès en écriture à ZooKeeper et est capable d’exécuter un serveur personnalisé disponible à partir du réseau où clickhouse s’exécute, il peut créer un serveur malveillant personnalisé qui agira comme réplique de ClickHouse et l’enregistrer dans ZooKeeper. Lorsqu’une autre réplique récupère une partie de données à partir d’une réplique malveillante, elle peut forcer clickhouse-server à écrire sur un chemin arbitraire sur le système de fichiers. Trouvé par Eldar Zaitov, équipe de sécurité de L’information chez Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} + +#### Bug Fix {#bug-fix-17} + +- Fixer `ALTER TABLE ... UPDATE` requête pour les tables avec `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alésapine](https://github.com/alesapin)) +- Correction de NPE lors de l’utilisation de la clause IN avec une sous-requête avec un tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un problème que si un réplica périmé devient vivant, il peut encore avoir des parties de données qui ont été supprimés par la partition DROP. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un problème avec l’analyse CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- Course de données fixe dans le système.table de pièces et ALTER query. Cela corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du mauvais code dans les mutations qui peuvent conduire à la corruption de la mémoire. Correction de segfault avec lecture de l’adresse `0x14c0` cela peut se produire en raison de simultané `DROP TABLE` et `SELECT` de `system.parts` ou `system.parts_columns`. Condition de course fixe dans la préparation des requêtes de mutation. Blocage fixe causé par `OPTIMIZE` des tables répliquées et des opérations de modification simultanées comme ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} + +#### Bug Fix {#bug-fix-18} + +- L’intégration de Kafka a été corrigée dans cette version. +- Correction de segfault lors de l’utilisation `arrayReduce` pour les querelles constantes. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe `toFloat()` monotonie. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- Correction de segfault avec activé `optimize_skip_unused_shards` et clé de sharding manquante. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) +- Fixe la logique de `arrayEnumerateUniqRanked` fonction. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Suppression de la journalisation supplémentaire du gestionnaire MySQL. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un comportement incorrect et de segfaults possibles dans `topK` et `topKWeighted` agrégé fonctions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) +- N’exposez pas les colonnes virtuelles dans `system.columns` table. Ceci est nécessaire pour la compatibilité descendante. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug avec l’allocation de mémoire pour les champs de chaîne dans le dictionnaire de cache de clé complexe. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug avec l’activation de la granularité adaptative lors de la création d’une nouvelle réplique pour `Replicated*MergeTree` table. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alésapine](https://github.com/alesapin)) +- Correction de la boucle infinie lors de la lecture des messages Kafka. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) +- Correction de la possibilité d’une requête fabriquée pour provoquer un crash du serveur en raison d’un débordement de pile dans L’analyseur SQL et de la possibilité d’un débordement de pile dans `Merge` et `Distributed` table [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction D’une erreur D’encodage de gorille sur les petites séquences. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) + +#### Amélioration {#improvement-5} + +- Autoriser l’utilisateur à remplacer `poll_interval` et `idle_connection_timeout` paramètres de connexion. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} + +#### Bug Fix {#bug-fix-19} + +- Correction de la possibilité de suspendre les requêtes lorsque le serveur est surchargé. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de FPE dans la fonction yandexconsistenthash. Cela corrige [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug dans la conversion de `LowCardinality` types de `AggregateFunctionFactory`. Cela corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Corrigé de l’analyse de `bool` les paramètres de `true` et `false` chaînes de caractères dans les fichiers de configuration. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug rare avec des en-têtes de flux incompatibles dans les requêtes `Distributed` table de `MergeTree` table quand une partie de `WHERE` se déplace à `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alésapine](https://github.com/alesapin)) +- Dépassement fixe dans la division entière du type signé au type non signé. Cela corrige [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Modification Incompatible En Arrière {#backward-incompatible-change-5} + +- `Kafka` toujours en panne. + +### Clickhouse Version 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} + +#### Bug Fix {#bug-fix-20} + +- Correction d’un bug avec l’écriture de marques d’indices secondaires avec une granularité adaptative. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alésapine](https://github.com/alesapin)) +- Fixer `WITH ROLLUP` et `WITH CUBE` les modificateurs de `GROUP BY` avec agrégation à deux niveaux. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Correction du blocage dans `JSONExtractRaw` fonction. Fixe [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de segfault dans ExternalLoader::reloadOutdated (). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction du cas où le serveur peut fermer les sockets d’écoute mais ne pas arrêter et continuer à servir les requêtes restantes. Vous pouvez vous retrouver avec deux processus clickhouse-server en cours d’exécution. Parfois, le serveur peut renvoyer une erreur `bad_function_call` pour les requêtes restantes. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une condition inutile et incorrecte sur le champ de mise à jour pour le chargement initial des dictionnaires externes via ODBC, MySQL, ClickHouse et HTTP. Cela corrige [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une exception non pertinente dans la distribution de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un résultat non déterministe de “uniq” fonction agrégée dans des cas extrêmement rares. Le bug était présent dans toutes les versions de ClickHouse. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Segfault lorsque nous définissons un peu trop haut CIDR sur la fonction `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Correction d’une petite fuite de mémoire lorsque le serveur lance de nombreuses exceptions dans de nombreux contextes différents. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corrigez la situation lorsque le consommateur a été mis en pause avant l’abonnement et n’a pas repris après. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([Ivan](https://github.com/abyss7)) Notez que Kafka est cassé dans cette version. +- Effacement du tampon de données Kafka de l’opération de lecture précédente terminée par une erreur [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Notez que Kafka est cassé dans cette version. +- Depuis `StorageMergeTree::background_task_handle` est initialisée dans `startup()` le `MergeTreeBlockOutputStream::write()` peut tenter de l’utiliser avant l’initialisation. Vérifiez simplement s’il est initialisé. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-6} + +- Ajouté officiel `rpm` paquet. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alésapine](https://github.com/alesapin)) +- Ajouter une capacité à construire `.rpm` et `.tgz` les paquets avec `packager` script. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alésapine](https://github.com/alesapin)) +- Des correctifs pour “Arcadia” système de construction. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) + +#### Modification Incompatible En Arrière {#backward-incompatible-change-6} + +- `Kafka` est cassé dans cette version. + +### Clickhouse Version 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} + +#### Nouveauté {#new-feature-6} + +- Ajout du support pour les déclarations préparées. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alexander](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `DoubleDelta` et `Gorilla` codecs de colonne [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) +- Ajouter `os_thread_priority` paramètre qui permet de contrôler la “nice” valeur des threads de traitement de requête utilisés par le système d’exploitation pour ajuster la priorité de planification dynamique. Il exige `CAP_SYS_NICE` capacités à travailler. Cela met en œuvre [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre `_topic`, `_offset`, `_key` colonnes pour moteur Kafka [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([Ivan](https://github.com/abyss7)) Notez que Kafka est cassé dans cette version. +- Ajouter agrégat fonction combinateur `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) +- Les fonctions d’agrégation `groupArrayMovingSum(win_size)(x)` et `groupArrayMovingAvg(win_size)(x)`, qui calculent la somme mobile / avg avec ou sans limitation de taille de fenêtre. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) +- Ajouter synonim `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) +- Fonction Intergate H3 `geoToH3` de Uber. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Bug Fix {#bug-fix-21} + +- Implémentez le cache DNS avec une mise à jour asynchrone. Thread séparé résout tous les hôtes et met à jour le cache DNS avec la période (Paramètre `dns_cache_update_period`). Cela devrait aider, lorsque l’adresse ip des hôtes change fréquemment. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) +- Fixer erreur de segmentation dans `Delta` codec qui affecte les colonnes avec des valeurs inférieures à 32 bits. Le bug a conduit à la corruption de la mémoire aléatoire. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alésapine](https://github.com/alesapin)) +- Correction de segfault dans la fusion TTL avec des colonnes non physiques en bloc. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Correction d’un bug rare dans la vérification de la pièce avec `LowCardinality` colonne. Précédemment `checkDataPart` échoue toujours pour une partie avec `LowCardinality` colonne. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alésapine](https://github.com/alesapin)) +- Évitez de suspendre les connexions lorsque le pool de threads du serveur est plein. Il est important pour les connexions de `remote` fonction de table ou connexions à un fragment sans réplicas lorsqu’il y a un long délai de connexion. Cela corrige [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Prise en charge des arguments constants pour `evalMLModel` fonction. Cela corrige [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du problème lorsque ClickHouse détermine le fuseau horaire par défaut comme `UCT` plutôt `UTC`. Cela corrige [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe de type dépassement de tampon dans `visitParamExtractRaw`. Cela corrige [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant distribué `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` les requêtes seront exécutées directement sur la réplique leader. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alésapine](https://github.com/alesapin)) +- Fixer `coalesce` pour `ColumnConst` avec `ColumnNullable` + changements connexes. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixer le `ReadBufferFromKafkaConsumer` alors qu’il continue à lire de nouveaux messages après `commit()` même si elle a été interrompue avant [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([Ivan](https://github.com/abyss7)) +- Fixer `FULL` et `RIGHT` Joindre les résultats lors de l’adhésion sur `Nullable` clés dans la table de droite. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction Possible du sommeil infini des requêtes de faible priorité. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la condition de concurrence, qui fait que certaines requêtes peuvent ne pas apparaître dans query\_log après `SYSTEM FLUSH LOGS` requête. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Fixe `heap-use-after-free` Avertissement ASan dans ClusterCopier causé par la montre qui essaie d’utiliser l’objet copieur déjà supprimé. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixe de mal `StringRef` pointeur retourné par certaines implémentations de `IColumn::deserializeAndInsertFromArena`. Ce bogue n’a affecté que les tests unitaires. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Empêcher les colonnes de jointure de tableau source et intermédiaire de masquer les colonnes de même nom. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixer insérer et sélectionner la requête au moteur MySQL avec l’identifiant de style MySQL citant. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Maintenant `CHECK TABLE` query peut fonctionner avec la famille de moteurs MergeTree. Il renvoie l’état de contrôle et le message le cas échéant pour chaque partie (ou fichier dans le cas de moteurs plus simples). Aussi, correction d’un bug dans l’extraction d’une partie cassée. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alésapine](https://github.com/alesapin)) +- Correction de L’exécution SPLIT\_SHARED\_LIBRARIES [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) +- Correction de l’initialisation du fuseau horaire lorsque `/etc/localtime` est un lien symbolique comme `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- clickhouse-copieur: Fix utiliser-après livraison à l’arrêt [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) +- Mettre `simdjson`. Correction du problème que certains JSONs invalides avec zéro octets analysent avec succès. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de l’arrêt des SystemLogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) +- Correction de la suspension lorsque la condition dans invalidate\_query dépend d’un dictionnaire. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Amélioration {#improvement-6} + +- Autoriser les adresses insolubles dans la configuration du cluster. Ils seront considérés comme indisponibles et essayés de résoudre à chaque tentative de connexion. Ceci est particulièrement utile pour Kubernetes. Cela corrige [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fermez les connexions TCP inactives (avec un délai d’attente d’une heure par défaut). Ceci est particulièrement important pour les grands clusters avec plusieurs tables distribuées sur chaque serveur, car chaque serveur peut éventuellement conserver un pool de connexions à tous les autres serveurs, et après la concurrence maximale des requêtes, les connexions calent. Cela corrige [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Meilleure qualité de `topK` fonction. Modification du comportement de L’ensemble SavingSpace pour supprimer le dernier élément si le nouvel élément a un poids plus important. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Les fonctions D’URL pour travailler avec des domaines peuvent maintenant fonctionner pour les URL incomplètes sans schéma [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alésapine](https://github.com/alesapin)) +- Sommes de contrôle ajoutées à la `system.parts_columns` table. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Ajouter `Enum` type de données comme synonyme de `Enum8` ou `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) +- Variante de transposition de bits complète pour `T64` codec. Pourrait conduire à une meilleure compression avec `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) +- Condition sur `startsWith` fonction maintenant peut utilise la clé primaire. Cela corrige [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) et [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) +- Permettre d’utiliser `clickhouse-copier` avec la topologie de cluster de réplication croisée en permettant le nom de base de données vide. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) +- Utiliser `UTC` comme fuseau horaire par défaut sur un système sans `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` a été imprimé et le serveur ou le client a refusé de démarrer. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Retourné soutien à virgule flottante argument dans la fonction `quantileTiming` pour la compatibilité descendante. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Afficher quelle table est manquante colonne dans les messages d’erreur. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([Ivan](https://github.com/abyss7)) +- Interdire l’exécution d’une requête avec le même query\_id par divers utilisateurs [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) +- Code plus robuste pour envoyer des métriques au Graphite. Cela fonctionnera même pendant de longues périodes multiples `RENAME TABLE` opération. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Des messages d’erreur plus informatifs seront affichés lorsque ThreadPool ne peut pas planifier une tâche pour l’exécution. Cela corrige [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Inverser ngramSearch pour être plus intuitif [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) +- Ajouter l’analyse utilisateur dans HDFS engine builder [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) +- Mettre à jour la valeur par défaut de `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) +- Ajout d’une notion de paramètres obsolètes. Le paramètre obsolète `allow_experimental_low_cardinality_type` peut être utilisé avec aucun effet. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) + +#### Amélioration Des Performances {#performance-improvement-4} + +- Augmentez le nombre de flux à sélectionner dans la table de fusion pour une distribution plus uniforme des threads. Ajout d’un réglage `max_streams_multiplier_for_merge_tables`. Cela corrige [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-7} + +- Ajoutez un test de rétrocompatibilité pour l’interaction client-serveur avec différentes versions de clickhouse. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alésapine](https://github.com/alesapin)) +- Testez les informations de couverture dans chaque demande de validation et de tirage. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alésapine](https://github.com/alesapin)) +- Coopérez avec le désinfectant d’adresse pour soutenir nos allocateurs faits sur commande (`Arena` et `ArenaWithFreeLists`) pour une meilleure mise “use-after-free” erreur. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) +- Interrupteur à [Implémentation de LLVM libunwind](https://github.com/llvm-mirror/libunwind) pour la gestion des exceptions C++ et pour l’impression des traces de pile [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) +- Ajouter deux autres avertissements de-Weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Permettre de construire ClickHouse avec aseptisant mémoire. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Rapport ubsan fixe sur `bitTest` fonction dans fuzz test. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Docker: ajout de la possibilité d’initialiser une instance de ClickHouse qui nécessite une authentification. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) +- Mettre à jour librdkafka vers la version 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([Ivan](https://github.com/abyss7)) +- Ajoutez un délai d’attente global pour les tests d’intégration et désactivez certains d’entre eux dans le code des tests. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alésapine](https://github.com/alesapin)) +- Correction de quelques échecs ThreadSanitizer. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) +- Le `--no-undefined` option force l’éditeur de liens à vérifier l’existence de tous les noms externes lors de la liaison. Il est très utile de suivre les dépendances réelles entre les bibliothèques en mode de construction fractionnée. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([Ivan](https://github.com/abyss7)) +- Ajouté test de performance pour [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la compatibilité avec gcc-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout du support pour gcc-9. Cela corrige [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur lorsque libunwind peut être lié de manière incorrecte. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de quelques avertissements trouvés par PVS-Studio. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout du support initial pour `clang-tidy` analyseur statique. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Convertir les macros BSD / Linux endian( ‘be64toh’ et ‘htobe64’) aux équivalents Mac OS X [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fu Chen](https://github.com/fredchenbj)) +- Amélioration du guide des tests d’intégration. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction de la construction sur macosx + gcc9 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) +- Correction d’une faute de frappe difficile à repérer: aggreAGte - \> aggregate. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) +- Correction de la construction freebsd [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) +- Ajouter un lien vers la chaîne Youtube expérimentale au site web [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) +- CMake: ajouter une option pour les drapeaux de couverture: WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) +- Correction de la taille initiale de certains PODArray en ligne. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) +- clickhouse-serveur.postinst: correction de la détection du système d’exploitation pour centos 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) +- Ajout de la génération de paquets Arch linux. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Diviser commun / config.h par libs (SGBD) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) +- Des correctifs pour “Arcadia” créer une plate-forme [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) +- Correctifs pour la construction non conventionnelle (gcc9, pas de sous-modules) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) +- Exiger un type explicite dans unalignedStore car il a été prouvé qu’il était sujet aux bugs [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) +- Corrige la construction MacOS [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) +- Test de Performance concernant la nouvelle fonctionnalité JIT avec un ensemble de données plus grand, comme demandé ici [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Exécuter des tests avec État dans le test de stress [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alésapine](https://github.com/alesapin)) + +#### Modification Incompatible En Arrière {#backward-incompatible-change-7} + +- `Kafka` est cassé dans cette version. +- Permettre `adaptive_index_granularity` = 10 Mo par défaut pour les nouveaux `MergeTree` table. Si vous avez créé de nouvelles tables MergeTree sur la version 19.11+, il sera impossible de passer à des versions antérieures à 19.6. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alésapine](https://github.com/alesapin)) +- Suppression des dictionnaires intégrés obsolètes non documentés utilisés par Yandex.Metrica. Fonction `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` ne sont plus disponibles. Si vous utilisez ces fonctions, écrivez un courriel à clickhouse-feedback@yandex-team.com. Note: au dernier moment, nous avons décidé de garder ces fonctions pendant un certain temps. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +## Clickhouse Version 19.10 {#clickhouse-release-19-10} + +### Clickhouse Version 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} + +#### Nouveauté {#new-feature-7} + +- Ajouter un nouveau codec de colonne: `T64`. Fait pour les colonnes(U)IntX/EnumX/Data (Time)/DecimalX. Il devrait être bon pour les colonnes avec des valeurs de plage constantes ou petites. Codec lui-même permet agrandir ou réduire le type de données sans re-compression. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter un moteur de base de données `MySQL` qui permettent d’afficher toutes les tables dans le serveur MySQL distant [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([L’Hiver Zhang](https://github.com/zhang2014)) +- `bitmapContains` application. C’est 2x plus rapide que `bitmapHasAny` si le second bitmap contient un élément. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) +- Soutien pour `crc32` fonction (avec un comportement exactement comme dans MySQL ou PHP). Ne l’utilisez pas si vous avez besoin d’une fonction de hachage. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) +- Mettre `SYSTEM START/STOP DISTRIBUTED SENDS` requêtes pour contrôler les insertions asynchrones dans `Distributed` table. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([L’Hiver Zhang](https://github.com/zhang2014)) + +#### Bug Fix {#bug-fix-22} + +- Ignorer les limites d’exécution des requêtes et la taille maximale des pièces pour les limites de fusion lors de l’exécution des mutations. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) +- Correction d’un bug qui peut conduire à la déduplication de blocs normaux (extrêmement rare) et l’insertion de blocs en double (plus souvent). [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alésapine](https://github.com/alesapin)) +- Correction de la fonction `arrayEnumerateUniqRanked` pour les arguments avec des tableaux vides [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) +- Ne vous abonnez pas aux sujets Kafka sans l’intention d’interroger des messages. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([Ivan](https://github.com/abyss7)) +- Faire la mise en `join_use_nulls` n’obtenez aucun effet pour les types qui ne peuvent pas être à L’intérieur de Nullable [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fixe `Incorrect size of index granularity` erreur [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) +- Correction du flotteur en décimal convertir le débordement [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) +- Vider le tampon quand `WriteBufferFromHDFS`’s destructeur est appelé. Cela corrige l’écriture dans `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) + +#### Amélioration {#improvement-7} + +- Traiter les cellules vides dans `CSV` comme valeurs par défaut lorsque le paramètre `input_format_defaults_for_omitted_fields` est activé. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) +- Chargement Non bloquant des dictionnaires externes. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) +- Les délais d’attente réseau peuvent être modifiés dynamiquement pour les connexions déjà établies en fonction des paramètres. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) +- Utiliser “public\_suffix\_list” pour les fonctions `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. Il utilise une table de hachage parfaite générée par `gperf` avec une liste générée à partir du fichier: https://publicsuffix.org/list/public\_suffix\_list.dat. (par exemple, nous reconnaissons maintenant le domaine `ac.uk` comme non significatif). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Adopté `IPv6` type de données dans les tables système; colonnes unified client info dans `system.processes` et `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Utilisation de sessions pour les connexions avec le protocole de compatibilité MySQL. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) +- Support plus `ALTER` requête `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) +- Soutien `` section dans `clickhouse-local` fichier de configuration. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) +- Autoriser exécuter la requête avec `remote` fonction de table dans `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) + +#### Amélioration Des Performances {#performance-improvement-5} + +- Ajoutez la possibilité d’écrire la marque finale à la fin des colonnes MergeTree. Il permet d’éviter les lectures inutiles pour les clés qui sont hors de la plage de données de la table. Elle n’est activée que si la granularité d’index adaptatif est utilisée. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alésapine](https://github.com/alesapin)) +- Amélioration des performances des tables MergeTree sur les systèmes de fichiers très lents en réduisant `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la dégradation des performances en lecture à partir des tables MergeTree introduites dans la version 19.6. Corrections \# 5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-8} + +- Mettre `TestKeeper` en tant qu’implémentation de l’interface ZooKeeper utilisée pour les tests [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexeï-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) +- Désormais `.sql` les tests peuvent être exécutés isolés par le serveur, en parallèle, avec une base de données aléatoire. Il permet de les exécuter plus rapidement, d’ajouter de nouveaux tests avec des configurations de serveur personnalisées et de s’assurer que les différents tests ne s’affectent pas les uns les autres. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([Ivan](https://github.com/abyss7)) +- Supprimer `` et `` à partir de tests de performance [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fixe “select\_format” essai de performance pour `Pretty` format [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +## Clickhouse Version 19.9 {#clickhouse-release-19-9} + +### Clickhouse Version 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} + +#### Bug Fix {#bug-fix-23} + +- Correction de segfault dans le codec Delta qui affecte les colonnes avec des valeurs inférieures à 32 bits. Le bug a conduit à la corruption de la mémoire aléatoire. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug rare dans la vérification de la partie avec la colonne LowCardinality. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alésapine](https://github.com/alesapin)) +- Correction de segfault dans la fusion TTL avec des colonnes non physiques en bloc. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Correction du sommeil infini potentiel des requêtes de faible priorité. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la façon dont ClickHouse détermine le fuseau horaire par défaut comme UCT au lieu de UTC. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug sur l’exécution distribuée DROP/ALTER/TRUNCATE / OPTIMIZE sur les requêtes de CLUSTER sur la réplique suiveur avant la réplique leader. Maintenant, ils seront exécutés directement sur la réplique leader. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alésapine](https://github.com/alesapin)) +- Correction de la condition de concurrence, ce qui fait que certaines requêtes peuvent ne pas apparaître instantanément dans query\_log après la requête system FLUSH LOGS. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Ajout du support manquant pour les arguments constants à `evalMLModel` fonction. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} + +#### Nouveauté {#new-feature-8} + +- Imprimer des informations sur les pièces gelées dans `system.parts` table. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) +- Demander mot de passe du client sur clickhouse-client démarrer sur ats s’il n’est pas dans les arguments [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) +- Mettre `dictGet` et `dictGetOrDefault` fonctions pour les types Décimaux. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Amélioration {#improvement-8} + +- Debian init: ajout d’un délai d’arrêt du service [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) +- Ajouter un paramètre interdit par défaut pour créer une table avec des types suspects pour LowCardinality [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) +- Les fonctions de régression renvoient les poids du modèle lorsqu’elles ne sont pas utilisées comme État dans la fonction `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) +- Renommer et améliorer les méthodes de régression. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) +- Interfaces plus claires des chercheurs de chaînes. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) + +#### Bug Fix {#bug-fix-24} + +- Correction de la perte de données potentielle dans Kafka [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([Ivan](https://github.com/abyss7)) +- Correction d’une boucle infinie potentielle dans `PrettySpace` format lorsqu’il est appelé avec zéro colonnes [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) +- Correction d’un bug de débordement UInt32 dans les modèles linéaires. Autoriser le modèle EVAL ML pour l’argument du modèle non const. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `ALTER TABLE ... DROP INDEX IF EXISTS ...` ne devrait pas soulever une exception si l’index n’existe pas [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Fixer erreur de segmentation avec `bitmapHasAny` dans la sous-requête scalaire [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Correction d’une erreur lorsque le pool de connexions de réplication ne tente pas de résoudre l’hôte, même lorsque le cache DNS a été supprimé. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alésapine](https://github.com/alesapin)) +- Fixe `ALTER ... MODIFY TTL` sur ReplicatedMergeTree. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) +- Correction de L’insertion dans une table distribuée avec une colonne matérialisée [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) +- Correction d’un mauvais alloc lorsque truncate Join storage [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) +- Dans les versions récentes du paquet tzdata, certains fichiers sont maintenant des liens symboliques. Le mécanisme actuel de détection du fuseau horaire par défaut est cassé et donne des noms erronés pour certains fuseaux horaires. Maintenant, au moins, nous forçons le nom du fuseau horaire au contenu de TZ si fourni. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) +- Fixer certains cas extrêmement rares avec multivolnitsky searcher lorsque les aiguilles constantes en somme sont au moins 16KB long. L’algorithme a manqué ou écrasé les résultats précédents ce qui peut conduire au résultat incorrect de `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) +- Résolvez le problème lorsque les paramètres des requêtes ExternalData ne pouvaient pas utiliser les paramètres ClickHouse. Aussi, pour l’instant, paramètres `date_time_input_format` et `low_cardinality_allow_in_native_format` ne peut pas être utilisé en raison de l’ambiguïté des noms (en données externe, il peut être interprété comme format de tableau et dans la requête, il peut être un paramètre). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) +- Correction d’un bug lorsque des pièces ont été supprimées uniquement de FS sans les laisser tomber de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alésapine](https://github.com/alesapin)) +- Supprimer la journalisation de débogage du protocole MySQL [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ignorer ZNONODE pendant le traitement de la requête DDL [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Fix mix `UNION ALL` type de colonne de résultat. Il y avait des cas avec des données incohérentes et des types de colonnes de colonnes résultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- Lancer une exception sur des entiers erronés dans `dictGetT` fonctions au lieu de crash. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction de mauvais element\_count et load\_factor pour le dictionnaire haché dans `system.dictionaries` table. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-9} + +- Construction fixe Sans `Brotli` Prise en charge de la compression HTTP (`ENABLE_BROTLI=OFF` cmake variable). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) +- Inclure rugissement.h comme rugissant / rugissant.h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) +- Correction des avertissements gcc9 dans hyperscan(la directive \# line est mauvaise!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) +- Corrigez tous les avertissements lors de la compilation avec gcc-9. Correction de certains problèmes de contrib. Corrigez GCC9 ICE et soumettez-le à bugzilla. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) +- Liaison fixe avec lld [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer les spécialisations dans les dictionnaires [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) +- Amélioration des tests de performance pour le formatage et l’analyse des tables pour différents types de fichiers [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) +- Corrections pour l’exécution de test parallèle [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) +- Docker: utiliser les configs de clickhouse-test [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) +- Correction de la compilation Pour FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) +- Mise à niveau boost à 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) +- Fixer construire clickhouse comme sous-module [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) +- Améliorer les tests de performance JSONExtract [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) + +## Clickhouse Version 19.8 {#clickhouse-release-19-8} + +### Clickhouse Version 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} + +#### Nouveauté {#new-features} + +- Ajout de fonctions pour travailler avec JSON [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) +- Ajouter une fonction basename, avec un comportement similaire à une fonction basename, qui existe dans beaucoup de langues (`os.path.basename` en python, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Ajouter `LIMIT n, m BY` ou `LIMIT m OFFSET n BY` syntaxe pour définir le décalage de N pour la clause LIMIT BY. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) +- Ajouté nouveau type de données `SimpleAggregateFunction`, ce qui permet d’avoir des colonnes avec agrégation de lumière dans un `AggregatingMergeTree`. Cela ne peut être utilisé avec des fonctions simples comme `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) +- Ajout du support pour les arguments non constants dans la fonction `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) +- L’ajout de fonctions `skewPop`, `skewSamp`, `kurtPop` et `kurtSamp` pour calculer l’asymétrie de séquence, l’asymétrie de l’échantillon, la kurtose et la kurtose de l’échantillon respectivement. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) +- Soutien renommer opération pour `MaterializeView` stockage. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Serveur Ajouté qui permet de se connecter à ClickHouse en utilisant le client MySQL. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) +- Ajouter `toDecimal*OrZero` et `toDecimal*OrNull` fonction. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) +- Soutenir les types décimaux dans les fonctions: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) +- Ajouter `format` fonction. Formatage du motif constant (modèle de format Python simplifié) avec les chaînes listées dans les arguments. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) +- Ajouter `system.detached_parts` tableau contenant des informations sur les parties détachées de `MergeTree` table. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) +- Ajouter `ngramSearch` fonction pour calculer la différence non symétrique entre l’aiguille et la botte de foin. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) +- Mise en œuvre de méthodes d’apprentissage automatique de base (régression linéaire stochastique et régression logistique) à l’aide de l’interface des fonctions agrégées. A différentes stratégies pour mettre à jour les poids du modèle (descente de gradient simple, méthode momentum, méthode Nesterov). Prend également en charge les mini-lots de taille personnalisée. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) +- La mise en œuvre de `geohashEncode` et `geohashDecode` fonction. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) +- Fonction agrégée ajoutée `timeSeriesGroupSum` qui peut regrouper différentes séries de l’échantillon d’horodatage de l’alignement. Il utilisera une interpolation linéaire entre deux échantillons d’horodatage, puis additionnera les séries temporelles ensemble. Fonction agrégée ajoutée `timeSeriesGroupRateSum`, qui calcule le taux de séries chronologiques, puis additionne les taux ensemble. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Yangkuan Liu](https://github.com/LiuYangkuan)) +- L’ajout de fonctions `IPv4CIDRtoIPv4Range` et `IPv6CIDRtoIPv6Range` pour calculer les limites inférieures et supérieures pour une adresse IP dans le sous-réseau à l’aide D’un CIDR. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Ajouter un en-tête X-Clickhouse-Summary lorsque nous envoyons une requête en utilisant HTTP avec paramètre activé `send_progress_in_http_headers`. Renvoie les informations habituelles de X-ClickHouse-Progress, avec des informations supplémentaires telles que le nombre de lignes et d’octets insérés dans la requête. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Amélioration {#improvements} + +- Ajouter `max_parts_in_total` paramètre pour la famille de tables MergeTree (par défaut: 100 000) qui empêche la spécification dangereuse de la clé de partition \# 5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-obfuscator`: dériver la graine pour les colonnes individuelles en combinant la graine initiale avec le nom de la colonne, pas la position de la colonne. Ceci est destiné à transformer des ensembles de données avec plusieurs tables associées, de sorte que les tables restent joignables après la transformation. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- L’ajout de fonctions `JSONExtractRaw`, `JSONExtractKeyAndValues`. Renommé fonctions `jsonExtract` de `JSONExtract`. Quand quelque chose ne va pas, ces fonctions renvoient les valeurs correspondantes, pas `NULL`. Modifié la fonction `JSONExtract`, maintenant, il obtient le type de retour de son dernier paramètre et n’injecte pas nullables. Implémenté repli vers RapidJSON dans le cas où les instructions AVX2 ne sont pas disponibles. Bibliothèque Simdjson mise à jour vers une nouvelle version. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) +- Maintenant `if` et `multiIf` les fonctions ne dépendent pas de la condition `Nullable`, mais comptez sur les branches pour la compatibilité sql. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu](https://github.com/janplus)) +- `In` prédicat génère maintenant `Null` résultat de `Null` d’entrée comme l’ `Equal` fonction. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu](https://github.com/janplus)) +- Vérifiez la limite de temps chaque (flush\_interval / poll\_timeout) nombre de lignes de Kafka. Cela permet de casser la lecture de Kafka consumer plus fréquemment et de vérifier les délais pour les flux de niveau supérieur [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([Ivan](https://github.com/abyss7)) +- Lien rdkafka avec SASL fourni. Il devrait permettre d’utiliser l’authentification SASL SCRAM [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([Ivan](https://github.com/abyss7)) +- Version par lots de RowRefList pour toutes les jointures. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) +- clickhouse-server: messages d’erreur d’écoute plus informatifs. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) +- Soutien dictionnaires dans clickhouse-copieur pour les fonctions dans `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) +- Ajouter un nouveau paramètre `kafka_commit_every_batch` pour réglementer Kafka engager la Politique. + Il permet de définir le mode de validation: après chaque lot de messages personnels, ou après le bloc entier est écrit dans le stockage. C’est un compromis entre perdre des messages ou les lire deux fois dans certaines situations extrêmes. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([Ivan](https://github.com/abyss7)) +- Faire `windowFunnel` supporte d’autres types entiers non signés. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) +- Autoriser à ombrer la colonne virtuelle `_table` dans le moteur de Fusion. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([Ivan](https://github.com/abyss7)) +- Faire `sequenceMatch` les fonctions d’agrégation prennent en charge d’autres types entiers non signés [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) +- Meilleurs messages d’erreur si l’inadéquation de la somme de contrôle est probablement causée par des défaillances matérielles. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Vérifiez que les tables sous-jacentes prennent en charge l’échantillonnage pour `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([Ivan](https://github.com/abyss7)) +- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Améliorations du protocole de fil MySQL. Changement du nom du format en MySQLWire. Utiliser RAII pour appeler RSA\_free. Désactivation de SSL si le contexte ne peut pas être créé. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) +- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) +- Respectez les paramètres de requête dans les insertions asynchrones dans les tables distribuées. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) +- Renommé fonctions `leastSqr` de `simpleLinearRegression`, `LinearRegression` de `linearRegression`, `LogisticRegression` de `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Amélioration Des Performances {#performance-improvements} + +- Paralléliser le traitement des parties des tables MergeTree non répliquées dans la requête ALTER MODIFY. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) +- Optimisations dans l’extraction d’expressions régulières. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) +- N’ajoutez pas de colonne de clé de jointure droite pour joindre le résultat si elle est utilisée uniquement dans la section join on. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) +- Geler le tampon Kafka après la première réponse vide. Il évite les invocations multiples de `ReadBuffer::next()` pour un résultat vide dans certains flux d’analyse de ligne. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([Ivan](https://github.com/abyss7)) +- `concat` optimisation de la fonction pour plusieurs arguments. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) +- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) +- Mettez à niveau notre implémentation LZ4 avec reference one pour avoir une décompression plus rapide. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) +- Implémenté MSD radix sort (basé sur kxsort), et le tri partiel. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) + +#### Corrections De Bugs {#bug-fixes} + +- Correction des colonnes push require avec jointure [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Correction d’un bug, lorsque ClickHouse est exécuté par systemd, la commande `sudo service clickhouse-server forcerestart` ne fonctionne pas comme prévu. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) +- Correction des codes d’erreur http dans DataPartsExchange (le serveur HTTP interserver sur le port 9009 renvoie toujours le code 200, même en cas d’erreurs). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) +- Correction de SimpleAggregateFunction pour une chaîne plus longue que MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) +- Correction d’une erreur pour `Decimal` de `Nullable(Decimal)` conversion en en. Soutenir D’autres conversions décimales à décimales (y compris différentes échelles). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction FPU clobbering dans la bibliothèque simdjson qui conduisent à un mauvais calcul de `uniqHLL` et `uniqCombined` fonction agrégée et fonctions mathématiques telles que `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la gestion des cas const/nonconst mixtes dans les fonctions JSON. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fixer `retention` fonction. Maintenant, toutes les conditions qui satisfont dans une rangée de données sont ajoutées à l’état des données. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) +- Correction du type de résultat pour `quantileExact` avec des Décimales. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Documentation {#documentation} + +- Traduire la documentation pour `CollapsingMergeTree` pour les chinois. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) +- Traduire une documentation sur les moteurs de table en chinois. + [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) + [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) + ([jamais lee](https://github.com/neverlee)) + +#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements} + +- Correction de certains rapports de désinfectant qui montrent une utilisation probable après-livraison.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([Ivan](https://github.com/abyss7)) +- Déplacez les tests de performance hors de répertoires séparés pour plus de commodité. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de tests de performance incorrects. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alésapine](https://github.com/alesapin)) +- Ajout d’un outil pour calculer les sommes de contrôle causées par les retournements de bits pour déboguer les problèmes matériels. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Rendre le script runner plus utilisable. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) +- Ajouter petite instruction comment écrire des tests de performance. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alésapine](https://github.com/alesapin)) +- Ajout de la possibilité de faire des substitutions dans Créer, remplir et supprimer la requête dans les tests de performance [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) + +## Clickhouse Version 19.7 {#clickhouse-release-19-7} + +### Clickhouse Version 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} + +#### Bug Fix {#bug-fix-25} + +- Correction de la régression des performances dans certaines requêtes avec jointure. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([L’Hiver Zhang](https://github.com/zhang2014)) + +### Clickhouse Version 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} + +#### Nouveauté {#new-features-1} + +- Ajout de fonctions liées au bitmap `bitmapHasAny` et `bitmapHasAll` analogue à `hasAny` et `hasAll` fonctions pour les tableaux. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) + +#### Corrections De Bugs {#bug-fixes-1} + +- Fixer erreur de segmentation sur `minmax` INDEX avec valeur nulle. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) +- Marquez toutes les colonnes d’entrée dans LIMIT BY comme sortie requise. Il fixe ‘Not found column’ erreur dans certaines requêtes distribuées. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) +- Fixer “Column ‘0’ already exists” erreur dans `SELECT .. PREWHERE` sur la colonne avec défaut [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) +- Fixer `ALTER MODIFY TTL` requête sur `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) +- Ne plantez pas le serveur lorsque les consommateurs Kafka n’ont pas réussi à démarrer. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([Ivan](https://github.com/abyss7)) +- Les fonctions Bitmap fixes produisent un mauvais résultat. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Andy Yang](https://github.com/andyyzh)) +- Correction d’element\_count pour le dictionnaire haché (ne pas inclure les doublons) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) +- Utilisez le contenu de la variable d’environnement TZ comme nom pour le fuseau horaire. Il aide à détecter correctement le fuseau horaire par défaut dans certains cas.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) +- N’essayez pas de convertir les entiers dans `dictGetT` fonctions, car il ne fonctionne pas correctement. Jetez une exception à la place. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction des paramètres dans la requête HTTP ExternalData. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila + Kutenin](https://github.com/danlark1)) +- Correction d’un bug lorsque des pièces ont été supprimées uniquement de FS sans les laisser tomber de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alésapine](https://github.com/alesapin)) +- Correction d’un défaut de segmentation dans `bitmapHasAny` fonction. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Correction d’une erreur lorsque le pool de connexions de réplication ne tente pas de résoudre l’hôte, même lorsque le cache DNS a été supprimé. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alésapine](https://github.com/alesapin)) +- Fixe `DROP INDEX IF EXISTS` requête. Maintenant `ALTER TABLE ... DROP INDEX IF EXISTS ...` la requête ne déclenche pas d’exception si l’index fourni n’existe pas. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Correction de la colonne union all supertype. Il y avait des cas avec des données incohérentes et des types de colonnes de colonnes résultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- Ignorer ZNONODE pendant le traitement de la requête DDL. Avant si un autre nœud supprime le znode dans la file d’attente des tâches, celui qui + ne pas le traiter, mais déjà obtenir la liste des enfants, mettra fin au thread DDLWorker. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Correction de L’insertion dans la table Distributed() avec une colonne matérialisée. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) + +### Clickhouse Version 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} + +#### Nouveauté {#new-features-2} + +- Permet de limiter la plage d’un paramètre qui peut être spécifiée par l’utilisateur. + Ces contraintes peuvent être configurées dans le profil des paramètres utilisateur. + [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly + Baranov](https://github.com/vitlibar)) +- Ajouter une deuxième version de la fonction `groupUniqArray` avec une option de + `max_size` paramètre qui limite la taille du tableau résultant. Ce + le comportement est similaire à `groupArray(max_size)(x)` fonction. + [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- Pour les formats de fichier D’entrée TSVWithNames/CSVWithNames, l’ordre des colonnes peut maintenant être + déterminé à partir de l’en-tête du fichier. Ceci est contrôlé par + `input_format_with_names_use_header` paramètre. + [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) + ([Alexander](https://github.com/Akazz)) + +#### Corrections De Bugs {#bug-fixes-2} + +- Crash avec uncompressed\_cache + JOIN lors de la fusion (\#5197) + [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila + Kutenin](https://github.com/danlark1)) +- Erreur de Segmentation sur une requête clickhouse-client aux tables système. \#5066 + [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) + ([Ivan](https://github.com/abyss7)) +- Perte de données sur une charge lourde via KafkaEngine (\#4736) + [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) + ([Ivan](https://github.com/abyss7)) +- Correction d’une condition de concurrence de données très rare qui pourrait se produire lors de l’exécution d’une requête avec UNION impliquant au moins deux sélections du système.colonnes, système.tables système.les pièces, système d’.parts\_tables ou tables de la famille de fusion et effectuer des modifications simultanées des colonnes des tables associées. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Amélioration Des Performances {#performance-improvements-1} + +- Utilisez le tri radix pour trier par colonne numérique unique dans `ORDER BY` sans + `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), + [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) + ([Evgenii Pravda](https://github.com/kvinty), + [alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Documentation {#documentation-1} + +- Traduire la documentation de certains moteurs de table en chinois. + [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), + [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), + [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) + ([张风啸](https://github.com/AlexZFX)), + [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([jamais + Lee](https://github.com/neverlee)) + +#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-1} + +- Imprimer les caractères UTF-8 correctement dans `clickhouse-test`. + [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) + ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un paramètre de ligne de commande pour clickhouse-client pour toujours charger la suggestion + données. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) + ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Résolvez certains des avertissements PVS-Studio. + [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) + ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mise à jour LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila + Kutenin](https://github.com/danlark1)) +- Ajouter gperf pour construire des exigences pour la prochaine demande de tirage \# 5030. + [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) + ([proller](https://github.com/proller)) + +## Clickhouse Version 19.6 {#clickhouse-release-19-6} + +### Clickhouse Version 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} + +#### Corrections De Bugs {#bug-fixes-3} + +- Correction de l’état pushdown pour les requêtes des fonctions de table `mysql` et `odbc` et les moteurs de table correspondants. Cela corrige \#3540 et \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de l’impasse dans Zookeeper. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) +- Autoriser les décimales entre guillemets en CSV. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) +- Interdire la conversion de float Inf / NaN en décimales (exception de lancer). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction de la course de données dans la requête renommer. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Désactiver temporairement LFAlloc. L’utilisation de LFAlloc peut conduire à beaucoup de MAP\_FAILED dans l’allocation de UncompressedCache et, par conséquent, à des plantages de requêtes sur des serveurs chargés en haut. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) + +### Clickhouse Version 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} + +#### Nouveauté {#new-features-3} + +- Expressions TTL pour les colonnes et les tables. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) +- Ajout du support pour `brotli` compression pour les réponses HTTP (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mikhail](https://github.com/fandyushin)) +- Ajout d’une fonction nouvelle `isValidUTF8` pour vérifier si un ensemble d’octets est correctement codé en utf-8. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) +- Ajouter la nouvelle stratégie d’équilibrage de charge `first_or_random` qui envoie des requêtes au premier hôte spécifié et s’il est inaccessible, envoie des requêtes à des hôtes aléatoires de shard. Utile pour les configurations de topologie de réplication croisée. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) + +#### Caractéristiques Expérimentales {#experimental-features-1} + +- Ajouter un paramètre `index_granularity_bytes` (granularité d’index adaptatif) pour la famille de tables MergeTree\*. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alésapine](https://github.com/alesapin)) + +#### Amélioration {#improvements-1} + +- Ajout du support pour les arguments de taille et de longueur non constants et négatifs pour la fonction `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Désactivez push-down to right table dans LEFT join, left table dans RIGHT join et les deux tables dans full join. Cela corrige les mauvais résultats de jointure dans certains cas. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([Ivan](https://github.com/abyss7)) +- `clickhouse-copier`: configuration automatique de tâche de téléchargement de `--task-file` option [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) +- Ajout d’un gestionnaire de fautes de frappe pour l’usine de stockage et les fonctions de table factory. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) +- Support des astérisques et des astérisques qualifiés pour plusieurs jointures sans sous-requêtes [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) +- Rendre le message d’erreur de colonne manquant plus convivial. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Amélioration Des Performances {#performance-improvements-2} + +- Accélération significative de la jointure ASOF [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) + +#### Modifications Incompatibles En Arrière {#backward-incompatible-changes} + +- L’en-tête HTTP `Query-Id` a été renommé `X-ClickHouse-Query-Id` pour des raisons de cohérence. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mikhail](https://github.com/fandyushin)) + +#### Corrections De Bugs {#bug-fixes-4} + +- Déréférence du pointeur nul potentiel fixe dans `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) +- Correction d’une erreur sur la requête avec JOIN + ARRAY JOIN [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixe suspendu au début du serveur lorsqu’un dictionnaire dépend d’un autre dictionnaire via une base de données avec moteur=Dictionnaire. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) +- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un résultat potentiellement erroné pour `SELECT DISTINCT` avec `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’une condition de concurrence de données très rare qui pourrait se produire lors de l’exécution d’une requête avec UNION impliquant au moins deux sélections du système.colonnes, système.tables système.les pièces, système d’.parts\_tables ou tables de la famille de fusion et effectuer des modifications simultanées des colonnes des tables associées. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-2} + +- Correction des échecs de test lors de l’exécution de clickhouse-server sur un hôte différent [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) +- clickhouse-test: désactiver les séquences de contrôle de couleur dans un environnement non tty. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alésapine](https://github.com/alesapin)) +- clickhouse-test: Autoriser l’utilisation de toute base de données de test (supprimer `test.` qualification lorsque cela est possible) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) +- Correction des erreurs ubsan [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Yandex LFAlloc a été ajouté à ClickHouse pour allouer des données MarkCache et UncompressedCache de différentes manières pour attraper des segfaults plus fiables [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) +- Python util pour aider avec les rétroportages et les changelogs. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([Ivan](https://github.com/abyss7)) + +## Clickhouse Version 19.5 {#clickhouse-release-19-5} + +### Clickhouse Version 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} + +#### Corrections De Bugs {#bug-fixes-5} + +- Correction d’un crash possible dans les fonctions bitmap\* [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Andy Yang](https://github.com/andyyzh)) +- Correction d’une condition de concurrence de données très rare qui pourrait se produire lors de l’exécution d’une requête avec UNION impliquant au moins deux sélections du système.colonnes, système.tables système.les pièces, système d’.parts\_tables ou tables de la famille de fusion et effectuer des modifications simultanées des colonnes des tables associées. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. Cette erreur s’est produite si la colonne LowCardinality était la partie de la clé primaire. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Modification de la fonction de rétention: si une ligne satisfait à la fois la première et la nième condition, seule la première condition satisfaite est ajoutée à l’état des données. Maintenant, toutes les conditions qui satisfont dans une rangée de données sont ajoutées à l’état des données. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) + +### Clickhouse Version 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} + +#### Corrections De Bugs {#bug-fixes-6} + +- Type de réglage fixe `max_partitions_per_insert_block` de booléen à UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Mohammad Hossein Sekhavat](https://github.com/mhsekhavat)) + +### Clickhouse Version 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} + +#### Nouveauté {#new-features-4} + +- [Hyperscan](https://github.com/intel/hyperscan) plusieurs expressions rationnelles a été ajouté (fonctions `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) +- `multiSearchFirstPosition` la fonction a été ajoutée. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) +- Implémentez le filtre d’expression prédéfini par ligne pour les tables. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([Ivan](https://github.com/abyss7)) +- Un nouveau type d’indices de saut de données basés sur des filtres bloom (peut être utilisé pour `equal`, `in` et `like` fonction). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) +- Ajouter `ASOF JOIN` ce qui permet d’exécuter des requêtes, qui se joignent à la valeur la plus récente connue. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) +- Réécrire plusieurs `COMMA JOIN` de `CROSS JOIN`. Puis réécrire `INNER JOIN` si cela est possible. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Amélioration {#improvement-9} + +- `topK` et `topKWeighted` prend désormais en charge personnalisée `loadFactor` (corrige le problème [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) +- Permettre d’utiliser `parallel_replicas_count > 1` même pour les tables sans échantillonnage (le paramètre est simplement ignoré pour elles). Dans les versions précédentes, il a été conduit à l’exception. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) +- Soutien pour `CREATE OR REPLACE VIEW`. Permettent de créer un afficher ou définir une nouvelle définition dans un seul énoncé. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) +- `Buffer` tableau moteur prend désormais en charge `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Yangkuan Liu](https://github.com/LiuYangkuan)) +- Ajouter la possibilité de démarrer la table répliquée sans métadonnées dans zookeeper dans `readonly` mode. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alésapine](https://github.com/alesapin)) +- Correction du scintillement de la barre de progression dans clickhouse-client. Le problème était le plus perceptible lors de l’utilisation `FORMAT Null` avec des flux de requêtes. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Permettent de désactiver les fonctions avec `hyperscan` bibliothèque par utilisateur pour limiter l’utilisation potentiellement excessive et incontrôlée des ressources. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter le numéro de version se connectant à toutes les erreurs. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) +- Ajout d’une restriction à la `multiMatch` fonctions qui nécessite une taille de chaîne pour s’adapter à `unsigned int`. A également ajouté le nombre d’arguments limite à la `multiSearch` fonction. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) +- Amélioration de l’utilisation de l’espace scratch et de la gestion des erreurs dans Hyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) +- Remplir `system.graphite_detentions` à partir d’une table de config `*GraphiteMergeTree` le moteur de tables. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Renommer `trigramDistance` la fonction de `ngramDistance` et d’ajouter plus de fonctions avec `CaseInsensitive` et `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) +- Amélioration du calcul des indices de saut de données. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) +- Garder ordinaire, `DEFAULT`, `MATERIALIZED` et `ALIAS` colonnes dans une seule liste (corrige le problème [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +#### Bug Fix {#bug-fix-26} + +- Éviter `std::terminate` en cas d’échec d’allocation de mémoire. Maintenant `std::bad_alloc` exception est levée comme prévu. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corrige la lecture de capnproto à partir du tampon. Parfois, les fichiers N’ont pas été chargés avec succès par HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Correction d’erreur `Unknown log entry type: 0` après `OPTIMIZE TABLE FINAL` requête. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Oiseau](https://github.com/amosbird)) +- Mauvais arguments `hasAny` ou `hasAll` fonctions peut conduire à l’erreur de segmentation. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Blocage peut se produire lors de l’exécution `DROP DATABASE dictionary` requête. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corriger un comportement indéfini dans `median` et `quantile` fonction. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- Correction de la détection du niveau de compression lorsque `network_compression_method` en minuscules. Cassé dans v19. 1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- Correction de l’ignorance de `UTC` paramètre (corrige le problème [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- Fixer `histogram` comportement de la fonction avec `Distributed` table. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- Rapport Tsan fixe `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Rapport Tsan fixe sur l’arrêt en raison de la condition de concurrence dans l’utilisation des journaux système. Correction de l’utilisation potentielle-après-libre à l’arrêt lorsque part\_log est activé. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer revérifier les pièces dans `ReplicatedMergeTreeAlterThread` en cas d’erreur. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Les opérations arithmétiques sur les états de fonction d’agrégat intermédiaire ne fonctionnaient pas pour les arguments constants (tels que les résultats de sous-requête). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Toujours renvoyer les noms de colonne dans les métadonnées. Sinon il est impossible de créer une table avec une colonne nommée `index` (le serveur ne redémarre pas en raison de malformé `ATTACH` requête dans les métadonnées). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un crash dans l’ `ALTER ... MODIFY ORDER BY` sur `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- Fixer erreur de segmentation dans `JOIN ON` avec l’option `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Correction d’un bug avec l’ajout d’une ligne étrangère après avoir consommé un message protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction d’un arrêt brutal de `JOIN` sur la colonne non nullable vs nullable. Fixer `NULLs` dans la droite dans `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Condition de course fixe dans `SELECT` de `system.tables` si la table est renommée ou modifiée simultanément. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la course de données lors de la récupération d’une partie de données déjà obsolète. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la course de données rares qui peut se produire pendant `RENAME` table de la famille MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un défaut de segmentation en fonction `arrayIntersect`. Une erreur de Segmentation pourrait se produire si la fonction était appelée avec des arguments constants et ordinaires mixtes. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un crash dans l’ `FULL/RIGHT JOIN` lorsque nous rejoignons sur nullable vs non nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixer `No message received` exception lors de la récupération de pièces entre les répliques. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alésapine](https://github.com/alesapin)) +- Fixe `arrayIntersect` fonction mauvais résultat en cas de plusieurs valeurs répétées dans un seul tableau. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’une condition de course pendant `ALTER COLUMN` requêtes qui pourraient conduire à un plantage du serveur (corrige le problème [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- Correction d’un résultat incorrect dans `FULL/RIGHT JOIN` avec colonne const. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction des doublons dans `GLOBAL JOIN` avec asterisk. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) +- Paramètre correction de la déduction `ALTER MODIFY` de la colonne `CODEC` lorsque le type de colonne n’est pas spécifié. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alésapine](https://github.com/alesapin)) +- Fonction `cutQueryStringAndFragment()` et `queryStringAndFragment()` fonctionne maintenant correctement quand `URL` contient un fragment et aucune requête. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction d’un bug rare lors du réglage `min_bytes_to_use_direct_io` est supérieur à zéro, ce qui se produit lorsque le thread doit chercher en arrière dans le fichier de colonne. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alésapine](https://github.com/alesapin)) +- Correction de mauvais types d’arguments pour les fonctions d’agrégation avec `LowCardinality` arguments (corrige le problème [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’une qualification de nom incorrecte Dans `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) +- Fonction Fix `toISOWeek` résultat pour l’année 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer `DROP`, `TRUNCATE` et `OPTIMIZE` requêtes duplication, lorsqu’elles sont exécutées sur `ON CLUSTER` pour `ReplicatedMergeTree*` les tables de la famille. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alésapine](https://github.com/alesapin)) + +#### Modification Incompatible En Arrière {#backward-incompatible-change-8} + +- Renommer le paramètre `insert_sample_with_metadata` définir `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajout d’un réglage `max_partitions_per_insert_block` (avec la valeur 100 par défaut). Si le bloc inséré contient un plus grand nombre de partitions, une exception est levée. Mettre à 0 si vous souhaitez supprimer la limite (pas recommandé). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Les fonctions multi-recherche ont été renommées (`multiPosition` de `multiSearchAllPositions`, `multiSearch` de `multiSearchAny`, `firstMatch` de `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) + +#### Amélioration Des Performances {#performance-improvement-6} + +- Optimisez volnitsky searcher en inlining, donnant environ 5-10% d’amélioration de la recherche pour les requêtes avec de nombreuses aiguilles ou de nombreux bigrams similaires. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) +- Correction d’un problème de performance lors du réglage `use_uncompressed_cache` est supérieur à zéro, qui est apparu lorsque toutes les données lues contenues dans le cache. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alésapine](https://github.com/alesapin)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-10} + +- Durcissement debug build: mappages de mémoire plus granulaires et ASLR; ajouter une protection de mémoire pour le cache de marque et l’index. Cela permet de trouver plus de bugs de piétinement de mémoire dans le cas où ASan et MSan ne peuvent pas le faire. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout du support pour les variables cmake `ENABLE_PROTOBUF`, `ENABLE_PARQUET` et `ENABLE_BROTLI` ce qui permet d’activer / désactiver les fonctionnalités ci-dessus (comme nous pouvons le faire pour librdkafka, mysql, etc). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) +- Ajouter la possibilité d’Imprimer la liste des processus et stacktraces de tous les threads si certaines requêtes sont suspendues après l’exécution du test. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alésapine](https://github.com/alesapin)) +- Ajouter des tentatives sur `Connection loss` erreur dans `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alésapine](https://github.com/alesapin)) +- Ajouter freebsd build avec vagrant et construire avec thread sanitizer au script packager. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alésapine](https://github.com/alesapin)) +- Maintenant l’Utilisateur a demandé un mot de passe pour l’utilisateur `'default'` lors de l’installation. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) +- Supprimer l’avertissement dans `rdkafka` bibliothèque. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Permettre la capacité de construire sans ssl. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) +- Ajouter un moyen de lancer l’image clickhouse-server à partir d’un utilisateur personnalisé. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Mise à niveau contrib boost à 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) +- Désactiver l’utilisation de `mremap` lorsqu’il est compilé avec thread Sanitizer. Étonnamment, TSan n’intercepte pas `mremap` (bien qu’il ne intercepter `mmap`, `munmap`) qui conduit à des faux positifs. Rapport Tsan fixe dans les tests avec État. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter la vérification de test en utilisant le schéma de format via L’interface HTTP. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) + +## Clickhouse Version 19.4 {#clickhouse-release-19-4} + +### Clickhouse Version 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} + +#### Corrections De Bugs {#bug-fixes-7} + +- Éviter `std::terminate` en cas d’échec d’allocation de mémoire. Maintenant `std::bad_alloc` exception est levée comme prévu. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corrige la lecture de capnproto à partir du tampon. Parfois, les fichiers N’ont pas été chargés avec succès par HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Correction d’erreur `Unknown log entry type: 0` après `OPTIMIZE TABLE FINAL` requête. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Oiseau](https://github.com/amosbird)) +- Mauvais arguments `hasAny` ou `hasAll` fonctions peut conduire à l’erreur de segmentation. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Blocage peut se produire lors de l’exécution `DROP DATABASE dictionary` requête. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corriger un comportement indéfini dans `median` et `quantile` fonction. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- Correction de la détection du niveau de compression lorsque `network_compression_method` en minuscules. Cassé dans v19. 1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- Correction de l’ignorance de `UTC` paramètre (corrige le problème [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- Fixer `histogram` comportement de la fonction avec `Distributed` table. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- Rapport Tsan fixe `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Rapport Tsan fixe sur l’arrêt en raison de la condition de concurrence dans l’utilisation des journaux système. Correction de l’utilisation potentielle-après-libre à l’arrêt lorsque part\_log est activé. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer revérifier les pièces dans `ReplicatedMergeTreeAlterThread` en cas d’erreur. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Les opérations arithmétiques sur les états de fonction d’agrégat intermédiaire ne fonctionnaient pas pour les arguments constants (tels que les résultats de sous-requête). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Toujours renvoyer les noms de colonne dans les métadonnées. Sinon il est impossible de créer une table avec une colonne nommée `index` (le serveur ne redémarre pas en raison de malformé `ATTACH` requête dans les métadonnées). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un crash dans l’ `ALTER ... MODIFY ORDER BY` sur `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- Fixer erreur de segmentation dans `JOIN ON` avec l’option `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Correction d’un bug avec l’ajout d’une ligne étrangère après avoir consommé un message protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction d’un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Condition de course fixe dans `SELECT` de `system.tables` si la table est renommée ou modifiée simultanément. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la course de données lors de la récupération d’une partie de données déjà obsolète. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la course de données rares qui peut se produire pendant `RENAME` table de la famille MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un défaut de segmentation en fonction `arrayIntersect`. Une erreur de Segmentation pourrait se produire si la fonction était appelée avec des arguments constants et ordinaires mixtes. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixer `No message received` exception lors de la récupération de pièces entre les répliques. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alésapine](https://github.com/alesapin)) +- Fixe `arrayIntersect` fonction mauvais résultat en cas de plusieurs valeurs répétées dans un seul tableau. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’une condition de course pendant `ALTER COLUMN` requêtes qui pourraient conduire à un plantage du serveur (corrige le problème [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- Paramètre correction de la déduction `ALTER MODIFY` de la colonne `CODEC` lorsque le type de colonne n’est pas spécifié. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alésapine](https://github.com/alesapin)) +- Fonction `cutQueryStringAndFragment()` et `queryStringAndFragment()` fonctionne maintenant correctement quand `URL` contient un fragment et aucune requête. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction d’un bug rare lors du réglage `min_bytes_to_use_direct_io` est supérieur à zéro, ce qui se produit lorsque le thread doit chercher en arrière dans le fichier de colonne. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alésapine](https://github.com/alesapin)) +- Correction de mauvais types d’arguments pour les fonctions d’agrégation avec `LowCardinality` arguments (corrige le problème [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fonction Fix `toISOWeek` résultat pour l’année 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer `DROP`, `TRUNCATE` et `OPTIMIZE` requêtes duplication, lorsqu’elles sont exécutées sur `ON CLUSTER` pour `ReplicatedMergeTree*` les tables de la famille. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alésapine](https://github.com/alesapin)) + +#### Amélioration {#improvements-2} + +- Garder ordinaire, `DEFAULT`, `MATERIALIZED` et `ALIAS` colonnes dans une seule liste (corrige le problème [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +### Clickhouse Version 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} + +#### Corrections De Bugs {#bug-fixes-8} + +- Correction d’un crash dans l’ `FULL/RIGHT JOIN` lorsque nous rejoignons sur nullable vs non nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-11} + +- Ajouter un moyen de lancer l’image clickhouse-server à partir d’un utilisateur personnalisé. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### Clickhouse Version 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} + +#### Corrections De Bugs {#bug-fixes-9} + +- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### Clickhouse Version 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} + +#### Corrections De Bugs {#bug-fixes-10} + +- Correction des requêtes distantes qui contiennent les deux `LIMIT BY` et `LIMIT`. Auparavant, si `LIMIT BY` et `LIMIT` ont été utilisés pour la requête distante, `LIMIT` ça pourrait arriver avant `LIMIT BY`, ce qui a conduit à un résultat trop filtré. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) + +### Clickhouse Version 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} + +#### Nouveauté {#new-features-5} + +- Ajout d’un support complet pour `Protobuf` format (entrée et sortie, structures de données imbriquées). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ajout de fonctions bitmap avec des bitmaps rugissants. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Andy Yang](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) +- Support du format Parquet. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) +- La distance de n-gramme a été ajoutée pour la comparaison de chaîne floue. Il est similaire aux métriques Q-gram en langage R. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) +- Combinez des règles pour le cumul de graphite à partir de modèles d’agrégation et de rétention dédiés. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Ajouter `max_execution_speed` et `max_execution_speed_bytes` pour limiter l’utilisation des ressources. Ajouter `min_execution_speed_bytes` réglage pour compléter le `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Mise en œuvre de la fonction `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexeï-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) +- L’ajout de fonctions `arrayEnumerateDenseRanked` et `arrayEnumerateUniqRanked` (c’est comme `arrayEnumerateUniq` mais permet d’affiner la profondeur du tableau pour regarder à l’intérieur des tableaux multidimensionnels). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Corrections De Bugs {#bug-fixes-11} + +- Cette version contient également toutes les corrections de bugs de 19.3 et 19.1. +- Correction d’un bug dans les indices de saut de données: l’ordre des granules après L’insertion était incorrect. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) +- Fixe `set` indice pour `Nullable` et `LowCardinality` colonne. Avant d’, `set` index avec `Nullable` ou `LowCardinality` colonne a conduit à l’erreur `Data type must be deserialized with multiple streams` lors de la sélection. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Définir correctement update\_time sur full `executable` dictionnaire de mise à jour. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) +- Correction de la barre de progression cassée dans 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) +- Correction de valeurs incohérentes de MemoryTracker lorsque la région de mémoire a été réduite, dans certains cas. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un comportement indéfini dans ThreadPool. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un crash très rare avec le message `mutex lock failed: Invalid argument` cela peut se produire lorsqu’une table MergeTree a été supprimée simultanément avec un SELECT. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) +- Compatibilité du pilote ODBC avec `LowCardinality` type de données. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) +- FreeBSD: correction pour `AIOcontextPool: Found io_event with unknown id 0` erreur. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `system.part_log` table a été créée, indépendamment de la configuration. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du comportement indéfini dans `dictIsIn` fonction pour les dictionnaires de cache. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alésapine](https://github.com/alesapin)) +- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) +- Désactiver compile\_expressions par défaut jusqu’à ce que nous obtenions propre `llvm` contrib et peut le tester avec `clang` et `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alésapine](https://github.com/alesapin)) +- Empêcher `std::terminate` lorsque `invalidate_query` pour `clickhouse` externe dictionnaire source a retourné mauvais jeu de résultats (vide ou plusieurs lignes ou plusieurs colonnes). Correction d’un problème lors de l’ `invalidate_query` a été effectuée toutes les cinq secondes quel que soit le `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Éviter l’impasse lorsque le `invalidate_query` pour un dictionnaire avec `clickhouse` source était impliquant `system.dictionaries` table ou `Dictionaries` base de données (cas rare). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corrections pour CROSS JOIN avec vide où. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixe erreur de segmentation en fonction “replicate” lorsque l’argument constant est passé. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la fonction lambda avec l’optimiseur de prédicats. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Plusieurs jointures plusieurs correctifs. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Amélioration {#improvements-3} + +- Prend en charge les alias dans la section JOIN ON pour les colonnes de la table droite. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) +- Le résultat de plusieurs jointures nécessite des noms de résultats corrects à utiliser dans les sous-sélections. Remplacez les alias plats par des noms de source dans le résultat. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) +- Améliorer la logique push-down pour les instructions jointes. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([Ivan](https://github.com/abyss7)) + +#### Amélioration Des Performances {#performance-improvements-3} + +- Heuristiques améliorées de “move to PREWHERE” optimisation. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Utilisez des tables de recherche appropriées qui utilisent L’API de HashTable pour les clés 8 bits et 16 bits. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos Oiseau](https://github.com/amosbird)) +- Amélioration des performances de la comparaison de chaînes. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Nettoyage de la file D’attente DDL distribuée dans un thread séparé afin de ne pas ralentir la boucle principale qui traite les tâches DDL distribuées. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) +- Lorsque `min_bytes_to_use_direct_io` est défini sur 1, Tous les fichiers n’ont pas été ouverts avec le mode O\_DIRECT car la taille des données à lire était parfois sous-estimée par la taille d’un bloc compressé. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-12} + +- Ajout du support pour clang-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corrigé de mal `__asm__` instructions (encore une fois) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) +- Ajouter la possibilité de spécifier les paramètres pour `clickhouse-performance-test` à partir de la ligne de commande. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alésapine](https://github.com/alesapin)) +- Ajouter des tests de dictionnaires aux tests d’intégration. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alésapine](https://github.com/alesapin)) +- Ajout de requêtes du benchmark sur le site web à des tests de performance automatisés. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `xxhash.h` n’existe pas dans LZ4 externe car il s’agit d’un détail d’implémentation et ses symboles sont `XXH_NAMESPACE` macro. Lorsque lz4 est externe, xxHash doit aussi être externe, et les personnes à charge doivent y accéder. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) +- Correction d’un cas lorsque `quantileTiming` la fonction d’agrégation peut être appelée avec un argument négatif ou à virgule flottante (cela corrige le test fuzz avec un désinfectant de comportement indéfini). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’erreur d’orthographe. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) +- Correction de la compilation sur Mac. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) +- Corrections de construction Pour FreeBSD et diverses configurations de construction inhabituelles. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) + +## Clickhouse Version 19.3 {#clickhouse-release-19-3} + +### Clickhouse Version 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} + +#### Corrections De Bugs {#bug-fixes-12} + +- Correction d’un crash dans l’ `FULL/RIGHT JOIN` lorsque nous rejoignons sur nullable vs non nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-13} + +- Ajouter un moyen de lancer l’image clickhouse-server à partir d’un utilisateur personnalisé [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### Clickhouse Version 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} + +#### Corrections De Bugs {#bug-fixes-13} + +- Correction d’une erreur dans \#3920. Cette erreur se manifeste par une corruption aléatoire du cache (messages `Unknown codec family code`, `Cannot seek through file`) et de segmentation. Cette anomalie est apparue dans la version 19.1 et est présente dans les versions jusqu’à 19.1.10 et 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} + +#### Corrections De Bugs {#bug-fixes-14} + +- Quand il y a plus de 1000 threads dans un pool de threads, `std::terminate` peut se produire à la sortie thread. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant, il est possible de créer `ReplicatedMergeTree*` tables avec commentaires sur les colonnes sans valeurs par défaut et tables avec colonnes codecs Sans commentaires et valeurs par défaut. Corrigez également la comparaison des codecs. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alésapine](https://github.com/alesapin)) +- Correction d’un crash sur la jointure avec un tableau ou un tuple. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un crash dans clickhouse-copieur avec le message `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction du blocage à l’arrêt du serveur si des DDL distribués étaient utilisés. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) +- Des numéros de colonne incorrects ont été imprimés dans un message d’erreur concernant l’analyse de format de texte pour les colonnes dont le nombre est supérieur à 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-3} + +- Correction de la construction avec AVX activé. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Activer la comptabilité étendue et la comptabilité D’E / S basée sur une version bien connue au lieu du noyau sous lequel elle est compilée. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) +- Permet d’ignorer le paramètre core\_dump.size\_limit, avertissement au lieu de lancer si la limite définie échoue. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) +- Enlevé le `inline` les balises de `void readBinary(...)` dans `Field.cpp`. Également fusionné redondant `namespace DB` bloc. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) + +### Clickhouse Version 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} + +#### Corrections De Bugs {#bug-fixes-15} + +- Correction d’un bug avec de grandes requêtes d’insertion http traitement. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alésapine](https://github.com/alesapin)) +- Correction de l’incompatibilité avec les anciennes versions en raison d’une mauvaise implémentation de `send_logs_level` paramètre. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Incompatibilité arrière fixe de la fonction de table `remote` introduit avec des commentaires de colonne. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} + +#### Amélioration {#improvements-4} + +- La taille de l’index de la Table n’est pas prise en compte des limites de mémoire lors de `ATTACH TABLE` requête. Éviter la possibilité qu’un tableau ne peut pas être attachée après avoir été détaché. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Légèrement augmenté la limite sur la chaîne max et la taille du tableau reçu de ZooKeeper. Il permet de continuer à travailler avec une taille accrue de `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` sur la Gardienne. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Permettre de réparer la réplique abandonnée même si elle a déjà un grand nombre de nœuds dans sa file d’attente. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un argument requis à `SET` index (nombre maximum de lignes stockées). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Corrections De Bugs {#bug-fixes-16} + +- Fixe `WITH ROLLUP` résultat pour le groupe par un seul `LowCardinality` clé. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un bug dans l’index set (laissant tomber un granule s’il contient plus de `max_rows` rangée). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) +- Beaucoup de corrections de construction FreeBSD. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) +- Correction de la substitution des alias dans les requêtes avec une sous-requête contenant le même alias (problème [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-4} + +- Ajouter la possibilité d’exécuter `clickhouse-server` pour les tests sans état dans l’image docker. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) + +### Clickhouse Version 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} + +#### Nouveauté {#new-features-6} + +- Ajouté le `KILL MUTATION` instruction qui permet de supprimer les mutations qui sont pour certaines raisons coincé. Ajouter `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` champs à la `system.mutations` tableau pour faciliter le dépannage. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) +- Fonction agrégée ajoutée `entropy` qui calcule l’entropie de Shannon. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) +- Ajout de la possibilité d’envoyer des requêtes `INSERT INTO tbl VALUES (....` au serveur sans fractionnement sur `query` et `data` partie. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alésapine](https://github.com/alesapin)) +- Mise en œuvre générique de `arrayWithConstant` la fonction a été ajoutée. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre `NOT BETWEEN` opérateur de comparaison. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) +- Mettre `sumMapFiltered` afin de pouvoir limiter le nombre de clés pour lesquelles les valeurs seront additionnées par `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Ajout du support de `Nullable` types de `mysql` table de fonction. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) +- Prise en charge des expressions constantes arbitraires dans `LIMIT` clause. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) +- Ajouter `topKWeighted` fonction d’agrégation qui prend un argument supplémentaire avec un poids (entier non signé). [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Andrew Golman](https://github.com/andrewgolman)) +- `StorageJoin` maintenant prend en charge `join_any_take_last_row` paramètre qui permet d’écraser les valeurs existantes de la même clé. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos Oiseau](https://github.com/amosbird) +- Ajout de la fonction `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ajouter `RowBinaryWithNamesAndTypes` format. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) +- Ajouter `IPv4` et `IPv6` types de données. Implémentations plus efficaces de `IPv*` fonction. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) +- Ajout de la fonction `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ajouter `Protobuf` le format de sortie. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ajout du support brotli pour L’interface HTTP pour l’importation de données (INSERTs). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mikhail](https://github.com/fandyushin)) +- Ajout d’astuces pendant que l’utilisateur fait une faute de frappe dans le nom de la fonction ou tapez dans le client de ligne de commande. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) +- Ajouter `Query-Id` de du Serveur HTTP en-tête de Réponse. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mikhail](https://github.com/fandyushin)) + +#### Caractéristiques expérimentales {#experimental-features-2} + +- Ajouter `minmax` et `set` index de saut de données pour la famille de moteurs de table MergeTree. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- Conversion ajoutée de `CROSS JOIN` de `INNER JOIN` si cela est possible. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Corrections De Bugs {#bug-fixes-17} + +- Fixe `Not found column` pour les colonnes en double dans `JOIN ON` section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Faire `START REPLICATED SENDS` commande démarrer les envois répliqués. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- Fixe l’exécution des fonctions d’agrégat avec `Array(LowCardinality)` argument. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fixe mauvais comportement lors `INSERT ... SELECT ... FROM file(...)` requête et fichier a `CSVWithNames` ou `TSVWIthNames` le format et la première ligne de données est manquant. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un crash sur dictionnaire recharger si le dictionnaire n’est pas disponible. Ce bug est apparu dans 19.1.6. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- Fixe `ALL JOIN` avec des doublons dans la table de droite. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un défaut de segmentation avec `use_uncompressed_cache=1` et exception avec une mauvaise taille non compressée. Ce bug est apparu dans 19.1.6. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alésapine](https://github.com/alesapin)) +- Fixe `compile_expressions` bug avec comparaison de grandes dates (plus de int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alésapine](https://github.com/alesapin)) +- Boucle infinie fixe lors de la sélection de la fonction de table `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Désactiver temporairement l’optimisation des prédicats pour `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Fixe `Illegal instruction` erreur lors de l’utilisation des fonctions base64 sur les anciens processeurs. Cette erreur n’a été reproduite que lorsque ClickHouse a été compilé avec gcc-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe `No message received` erreur lors de l’interaction avec le pilote ODBC PostgreSQL via une connexion TLS. Corrige également segfault lors de l’utilisation du pilote MySQL ODBC. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un résultat incorrect lorsque `Date` et `DateTime` les arguments sont utilisés dans les branches de l’opérateur conditionnel (fonction `if`). Ajouté cas générique pour la fonction `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Les dictionnaires ClickHouse se chargent maintenant dans `clickhouse` processus. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe blocage lorsqu’ `SELECT` à partir d’une table avec `File` moteur a été rejugé après `No such file or directory` erreur. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Condition de course fixe lors de la sélection de `system.tables` peut donner `table doesn't exist` erreur. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-client` peut segfault à la sortie lors du chargement des données pour les suggestions de ligne de commande si elle a été exécutée en mode interactif. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug lors de l’exécution de mutations contenant `IN` les opérateurs produisaient des résultats incorrects. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- Correction d’une erreur: si une base de données avec `Dictionary` moteur, tous les dictionnaires forcés de charger au démarrage du serveur, et s’il y a un dictionnaire avec la source de ClickHouse de localhost, le dictionnaire ne peut pas charger. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur lorsque les journaux système sont tentés de créer à nouveau à l’arrêt du serveur. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Renvoyer correctement le bon type et gérer correctement les verrous `joinGet` fonction. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Oiseau](https://github.com/amosbird)) +- Ajouter `sumMapWithOverflow` fonction. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Fixe erreur de segmentation avec `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un bug avec incorrect `Date` et `DateTime` comparaison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- Correction d’un test de fuzz sous un désinfectant de comportement indéfini: ajout d’une vérification de type de paramètre pour `quantile*Weighted` la famille de fonctions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une condition de course rare lors de la suppression d’anciennes pièces de données peuvent échouer avec `File not found` erreur. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du paquet d’installation avec /etc/clickhouse-server/config manquant.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-5} + +- Paquet Debian: correct/etc/clickhouse-server / lien prétraité selon config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- Divers correctifs de construction Pour FreeBSD. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) +- Ajout de la possibilité de créer, remplir et déposer des tables dans perftest. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alésapine](https://github.com/alesapin)) +- Ajout d’un script pour vérifier les doublons comprend. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout de la possibilité d’exécuter des requêtes par index dans le test de performance. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alésapine](https://github.com/alesapin)) +- Paquet avec des symboles de débogage est suggéré d’être installé. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Refactoring de performance-test. Meilleure journalisation et gestion des signaux. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alésapine](https://github.com/alesapin)) +- Ajout de documents à Yandex anonymisé.Jeux de données Metrika. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alésapine](https://github.com/alesapin)) +- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) +- Ajout de documents sur deux ensembles de données dans s3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alésapine](https://github.com/alesapin)) +- Ajout d’un script qui crée le journal des modifications à partir de la description des requêtes d’extraction. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Ajout du module puppet pour Clickhouse. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- Ajout de documents pour un groupe de fonctions non documentées. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([L’Hiver Zhang](https://github.com/zhang2014)) +- ARM construire des correctifs. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) +- Tests de dictionnaire maintenant capables de s’exécuter à partir de `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) +- Maintenant `/etc/ssl` est utilisé comme répertoire par défaut avec les certificats SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout de la vérification SSE et AVX instruction au début. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) +- Le script d’initialisation attendra le serveur jusqu’au démarrage. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) + +#### Modifications Incompatibles En Arrière {#backward-incompatible-changes-1} + +- Retiré `allow_experimental_low_cardinality_type` paramètre. `LowCardinality` les types de données sont prêts pour la production. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Réduisez la taille du cache mark et la taille du cache non compressé en conséquence à la quantité de mémoire disponible. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) +- Ajouté le mot `INDEX` dans `CREATE TABLE` requête. Une colonne avec le nom `index` doivent être indiqués avec backticks ou des guillemets: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- `sumMap` désormais promouvoir le type de résultat au lieu de débordement. Vieux `sumMap` le comportement peut être obtenu en utilisant `sumMapWithOverflow` fonction. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) + +#### Amélioration Des Performances {#performance-improvements-4} + +- `std::sort` remplacé par `pdqsort` pour les requêtes sans `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) +- Maintenant, le serveur réutilise les threads du pool de threads global. Cela affecte les performances dans certains cas particuliers. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Amélioration {#improvements-5} + +- Implémentation du support AIO Pour FreeBSD. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `SELECT * FROM a JOIN b USING a, b` maintenant de retour `a` et `b` colonnes uniquement à partir de la table de gauche. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) +- Permettre `-C` option du client pour travailler comme `-c` option. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) +- Option `--password` utilisé sans valeur nécessite un mot de passe de stdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) +- Ajout de la mise en évidence des métacaractères Non échappés dans les littéraux de chaîne qui contiennent `LIKE` expressions ou expressions rationnelles. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout de l’annulation des requêtes HTTP en lecture seule si le socket client disparaît. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) +- Maintenant, le serveur signale la progression pour maintenir les connexions client en vie. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([Ivan](https://github.com/abyss7)) +- Message légèrement meilleur avec raison pour optimiser la requête avec `optimize_throw_if_noop` paramètre est activé. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout du support de `--version` option pour le serveur clickhouse. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) +- Ajouter `--help/-h` option pour `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) +- Ajout du support pour les sous-requêtes scalaires avec le résultat de l’état de la fonction d’agrégation. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Amélioration du temps d’arrêt du serveur et modifie le temps d’attente. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout d’informations sur le paramètre replicated\_can\_become\_leader au système.réplicas et ajouter la journalisation si la réplique ne sera pas essayer de devenir leader. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) + +## Clickhouse Version 19.1 {#clickhouse-release-19-1} + +### Clickhouse Version 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} + +- Correction d’une erreur `Column ... queried more than once` cela peut arriver si le réglage `asterisk_left_columns_only` est réglé sur 1 en cas d’utilisation `GLOBAL JOIN` avec `SELECT *` (cas rare). Le problème n’existe pas dans 19.3 et plus récent. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) + +### Clickhouse Version 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} + +Cette version contient exactement le même ensemble de patchs 19.3.7. + +### Clickhouse Version 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} + +Cette version contient exactement le même ensemble de patchs 19.3.6. + +## Clickhouse Version 19.1 {#clickhouse-release-19-1-1} + +### Clickhouse Version 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} + +#### Corrections De Bugs {#bug-fixes-18} + +- Correction de l’incompatibilité avec les anciennes versions en raison d’une mauvaise implémentation de `send_logs_level` paramètre. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Incompatibilité arrière fixe de la fonction de table `remote` introduit avec des commentaires de colonne. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} + +#### Corrections De Bugs {#bug-fixes-19} + +- Correction du paquet d’installation avec /etc/clickhouse-server/config manquant.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +## Clickhouse Version 19.1 {#clickhouse-release-19-1-2} + +### Clickhouse Version 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} + +#### Corrections De Bugs {#bug-fixes-20} + +- Renvoyer correctement le bon type et gérer correctement les verrous `joinGet` fonction. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Oiseau](https://github.com/amosbird)) +- Correction d’une erreur lorsque les journaux système sont tentés de créer à nouveau à l’arrêt du serveur. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur: si une base de données avec `Dictionary` moteur, tous les dictionnaires forcés de charger au démarrage du serveur, et s’il y a un dictionnaire avec la source de ClickHouse de localhost, le dictionnaire ne peut pas charger. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug lors de l’exécution de mutations contenant `IN` les opérateurs produisaient des résultats incorrects. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- `clickhouse-client` peut segfault à la sortie lors du chargement des données pour les suggestions de ligne de commande si elle a été exécutée en mode interactif. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Condition de course fixe lors de la sélection de `system.tables` peut donner `table doesn't exist` erreur. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe blocage lorsqu’ `SELECT` à partir d’une table avec `File` moteur a été rejugé après `No such file or directory` erreur. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un problème: les dictionnaires ClickHouse locaux sont chargés via TCP, mais devraient être chargés dans le processus. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe `No message received` erreur lors de l’interaction avec le pilote ODBC PostgreSQL via une connexion TLS. Corrige également segfault lors de l’utilisation du pilote MySQL ODBC. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Désactiver temporairement l’optimisation des prédicats pour `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Boucle infinie fixe lors de la sélection de la fonction de table `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe `compile_expressions` bug avec comparaison de grandes dates (plus de int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alésapine](https://github.com/alesapin)) +- Correction d’un défaut de segmentation avec `uncompressed_cache=1` et exception avec une mauvaise taille non compressée. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alésapine](https://github.com/alesapin)) +- Fixe `ALL JOIN` avec des doublons dans la table de droite. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixe mauvais comportement lors `INSERT ... SELECT ... FROM file(...)` requête et fichier a `CSVWithNames` ou `TSVWIthNames` le format et la première ligne de données est manquant. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe l’exécution des fonctions d’agrégat avec `Array(LowCardinality)` argument. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Paquet Debian: correct/etc/clickhouse-server / lien prétraité selon config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- Correction d’un test de fuzz sous un désinfectant de comportement indéfini: ajout d’une vérification de type de paramètre pour `quantile*Weighted` la famille de fonctions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Faire `START REPLICATED SENDS` commande démarrer les envois répliqués. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- Fixe `Not found column` pour les colonnes en double dans JOIN ON section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Maintenant `/etc/ssl` est utilisé comme répertoire par défaut avec les certificats SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un crash sur dictionnaire recharger si le dictionnaire n’est pas disponible. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- Correction d’un bug avec incorrect `Date` et `DateTime` comparaison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- Correction d’un résultat incorrect lorsque `Date` et `DateTime` les arguments sont utilisés dans les branches de l’opérateur conditionnel (fonction `if`). Ajouté cas générique pour la fonction `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +### Clickhouse Version 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} + +#### Nouveauté {#new-features-7} + +- Codecs de compression personnalisés par colonne pour les tables. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alésapine](https://github.com/alesapin), [L’Hiver Zhang](https://github.com/zhang2014), [Anatoli](https://github.com/Sindbag)) +- Ajout du codec de compression `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alésapine](https://github.com/alesapin)) +- Permettre à `ALTER` codecs de compression. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alésapine](https://github.com/alesapin)) +- L’ajout de fonctions `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` pour la compatibilité standard SQL. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) +- Soutien pour écrire dans `HDFS` des tables et des `hdfs` table de fonction. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alésapine](https://github.com/alesapin)) +- L’ajout de fonctions pour rechercher plusieurs chaines de grosse botte de foin: `multiPosition`, `multiSearch` ,`firstMatch` aussi avec `-UTF8`, `-CaseInsensitive`, et `-CaseInsensitiveUTF8` variantes. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) +- Taille des éclats inutilisés si `SELECT` filtres de requête par clé de sharding (réglage `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [Ivan](https://github.com/abyss7)) +- Permettre `Kafka` moteur à ignorer certains nombre d’erreurs d’analyse par bloc. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([Ivan](https://github.com/abyss7)) +- Ajout du support pour `CatBoost` évaluation des modèles multiclass. Fonction `modelEvaluate` retourne tuple avec des prédictions brutes par classe pour les modèles multiclasse. `libcatboostmodel.so` devrait être construit avec [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- L’ajout de fonctions `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) +- Ajouté les fonctions de hachage `xxHash64` et `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) +- Ajouter `gccMurmurHash` fonction de hachage (hachage Murmur aromatisé GCC) qui utilise la même graine de hachage que [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) +- Ajouté les fonctions de hachage `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) +- Ajout d’un tableau de fonction `remoteSecure`. Fonction fonctionne comme `remote`, mais il utilise une connexion sécurisée. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) + +#### Caractéristiques expérimentales {#experimental-features-3} + +- Ajout de plusieurs jointures émulation (`allow_experimental_multiple_joins_emulation` paramètre). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Corrections De Bugs {#bug-fixes-21} + +- Faire `compiled_expression_cache_size` réglage limité par défaut pour réduire la consommation de mémoire. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug qui a conduit à des interruptions dans les threads qui effectuent des modifications de tables répliquées et dans le thread qui met à jour la configuration de ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) +- Correction d’une condition de concurrence lors de l’exécution d’une tâche alter distribuée. La condition de concurrence a conduit à plus d’une réplique essayant d’exécuter la tâche et toutes les répliques sauf une échouant avec une erreur ZooKeeper. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) +- Correction d’un bug lors de l’ `from_zk` les éléments de configuration n’ont pas été actualisés après l’expiration d’une requête à ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) +- Correction d’un bug avec un mauvais préfixe pour les masques de sous-réseau IPv4. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alésapine](https://github.com/alesapin)) +- Correction d’un crash (`std::terminate`) dans de rares cas où un nouveau thread ne peut pas être créé en raison de ressources épuisées. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug quand dans `remote` exécution de la fonction de table lorsque des restrictions incorrectes ont été utilisées pour in `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alésapine](https://github.com/alesapin)) +- Correction d’une fuite de sockets netlink. Ils ont été placés dans un pool où ils n’ont jamais été supprimés et de nouvelles sockets ont été créées au début d’un nouveau thread lorsque toutes les sockets actuelles étaient en cours d’utilisation. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) +- Correction d’un bug avec fermeture `/proc/self/fd` répertoire plus tôt que tous les fds ont été lus à partir de `/proc` après la bifurcation `odbc-bridge` sous-processus. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alésapine](https://github.com/alesapin)) +- Correction de la chaîne à la conversion monotone UInt en cas d’utilisation de la chaîne dans la clé primaire. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Correction d’une erreur dans le calcul de la monotonie de la fonction de conversion entière. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixe erreur de segmentation dans `arrayEnumerateUniq`, `arrayEnumerateDense` fonctions en cas d’arguments non valides. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corriger UB dans StorageMerge. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos Oiseau](https://github.com/amosbird)) +- Correction de segfault dans les fonctions `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur: fonctions `round`, `floor`, `trunc`, `ceil` peut renvoyer un résultat faux lorsqu’il est exécuté sur un argument entier et une grande échelle négative. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug induit par ‘kill query sync’ ce qui conduit à une décharge de base. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) +- Correction d’un bug avec un long délai après la file d’attente de réplication vide. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alésapine](https://github.com/alesapin)) +- Correction d’une utilisation excessive de la mémoire en cas d’insertion dans la table avec `LowCardinality` clé primaire. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Fixe `LowCardinality` la sérialisation de `Native` format en cas de tableaux vides. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Correction d’un résultat incorrect lors de l’utilisation de la colonne numérique distinct by single LowCardinality. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Agrégation spécialisée fixe avec la clé LowCardinality (dans le cas où `compile` paramètre est activé). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Correction du transfert d’utilisateur et de mot de passe pour les requêtes de tables répliquées. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alésapine](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) +- Correction d’une condition de course très rare qui peut se produire lors de la liste des tables dans la base de données du dictionnaire lors du rechargement des dictionnaires. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un résultat incorrect lors de L’utilisation avec ROLLUP ou CUBE. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Sam Chou](https://github.com/reflection)) +- Alias de colonne fixe pour la requête avec `JOIN ON` syntaxe et tables distribuées. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Correction d’une erreur dans la mise en œuvre interne de `quantileTDigest` (trouvé par Artem Vakhrushev). Cette erreur ne se produit jamais dans ClickHouse et n’était pertinente que pour ceux qui utilisent directement clickhouse codebase comme bibliothèque. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Amélioration {#improvements-6} + +- Soutien pour `IF NOT EXISTS` dans `ALTER TABLE ADD COLUMN` les déclarations avec `IF EXISTS` dans `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) +- Fonction `parseDateTimeBestEffort`: prise en charge de formats `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` et similaires. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- `CapnProtoInputStream` maintenant soutenir les structures déchiquetées. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) +- Amélioration de la facilité d’utilisation: ajout d’une vérification que le processus du serveur est démarré à partir du propriétaire du répertoire de données. Ne pas autoriser le démarrage du serveur à partir de la racine si les données appartiennent à un utilisateur non root. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-V-galtsev](https://github.com/sergey-v-galtsev)) +- Meilleure logique de vérification des colonnes requises lors de l’analyse des requêtes avec des jointures. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) +- Diminution du nombre de connexions en cas de grand nombre de tables distribuées dans un seul serveur. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Appuyé ligne de totaux pour `WITH TOTALS` requête pour le pilote ODBC. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) +- Autorisé à utiliser `Enum`s comme entiers à l’intérieur de la fonction if. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([Ivan](https://github.com/abyss7)) +- Ajouter `low_cardinality_allow_in_native_format` paramètre. Si désactivé, ne pas utiliser `LowCadrinality` type de `Native` format. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Suppression de certains objets redondants du cache des expressions compilées pour réduire l’utilisation de la mémoire. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alésapine](https://github.com/alesapin)) +- Ajouter vérifier que `SET send_logs_level = 'value'` requête accepter la valeur appropriée. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) +- Vérification de type de données fixe dans les fonctions de conversion de type. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([L’Hiver Zhang](https://github.com/zhang2014)) + +#### Amélioration Des Performances {#performance-improvements-5} + +- Ajouter un paramètre MergeTree `use_minimalistic_part_header_in_zookeeper`. Si cette option est activée, les tables répliquées stockent les métadonnées de partie compacte dans un znode de partie unique. Cela peut réduire considérablement la taille de l’instantané ZooKeeper (surtout si les tables ont beaucoup de colonnes). Notez qu’après avoir activé ce paramètre, vous ne pourrez pas passer à une version qui ne le supporte pas. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) +- Ajouter une implémentation basée sur DFA pour les fonctions `sequenceMatch` et `sequenceCount` en cas de motif ne contient pas de temps. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Amélioration des performances pour la sérialisation des nombres entiers. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos Oiseau](https://github.com/amosbird)) +- Zéro gauche padding PODArray de sorte que -1 élément est toujours valide et mis à zéro. Il est utilisé pour le calcul sans branche des décalages. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos Oiseau](https://github.com/amosbird)) +- Revenir `jemalloc` version qui conduisent à la dégradation des performances. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Modifications Incompatibles En Arrière {#backward-incompatible-changes-2} + +- Fonctionnalité non documentée supprimée `ALTER MODIFY PRIMARY KEY` parce qu’il a été remplacé par le `ALTER MODIFY ORDER BY` commande. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) +- Retiré de la fonction `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Interdire l’utilisation de sous-requêtes scalaires avec le résultat de type `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([Ivan](https://github.com/abyss7)) + +#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-6} + +- Ajout du support pour PowerPC (`ppc64le`) construire. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) +- Les tests fonctionnels avec État sont exécutés sur un ensemble de données Public disponible. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur lorsque le serveur ne peut pas démarrer avec le `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` message dans Docker ou systemd-nspawn. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre `rdkafka` bibliothèque à V1.0. 0-RC5. Utilisé cppkafka au lieu de l’interface c brute. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([Ivan](https://github.com/abyss7)) +- Mettre `mariadb-client` bibliothèque. Correction d’un des problèmes trouvés par UBSan. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Quelques corrections pour UBSan construit. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout de tests par validation avec UBSan build. +- Ajout d’exécutions par validation de PVS-Studio static analyzer. +- Correction de bugs trouvés par PVS-Studio. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de problèmes de compatibilité glibc. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Déplacez les images Docker vers 18.10 et ajoutez un fichier de compatibilité pour glibc \> = 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alésapine](https://github.com/alesapin)) +- Ajouter une variable env si l’utilisateur ne veut pas chown répertoires dans l’image Docker du serveur. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alésapine](https://github.com/alesapin)) +- Activé la plupart des avertissements de `-Weverything` à clang. Permettre `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout de quelques avertissements supplémentaires disponibles uniquement dans clang 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Lien vers `libLLVM` plutôt que de libs LLVM individuels lors de l’utilisation de liens partagés. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) +- Ajout de variables de désinfection pour les images de test. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alésapine](https://github.com/alesapin)) +- `clickhouse-server` le paquet debian recommandera `libcap2-bin` package à utiliser `setcap` outil pour définir les capacités. Cette option est facultative. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Amélioration du temps de compilation, fixe comprend. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) +- Ajout de tests de performance pour les fonctions de hachage. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) +- Dépendances de bibliothèque cycliques fixes. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) +- Amélioration de la compilation avec une faible mémoire disponible. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) +- Ajout d’un script de test pour reproduire la dégradation des performances dans `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de fautes d’orthographe dans les commentaires et les littéraux de chaîne sous `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) +- Correction de fautes dans les commentaires. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) + +## [Changelog pour 2018](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/fr/whats-new/changelog/index.md b/docs/fr/whats-new/changelog/index.md new file mode 100644 index 00000000000..98847c8db12 --- /dev/null +++ b/docs/fr/whats-new/changelog/index.md @@ -0,0 +1,668 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_folder_title: Changelog +toc_priority: 74 +toc_title: '2020' +--- + +## Clickhouse Version V20. 3 {#clickhouse-release-v20-3} + +### Clickhouse Version V20. 3. 4. 10, 2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} + +#### Bug Fix {#bug-fix} + +- Cette version contient également toutes les corrections de bugs de 20.1.8.41 +- Fixer manquant `rows_before_limit_at_least` pour les requêtes sur http (avec pipeline de processeurs). Cela corrige [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### Clickhouse Version V20. 3. 3. 6, 2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} + +#### Bug Fix {#bug-fix-1} + +- Cette version contient également toutes les corrections de bugs de 20.1.7.38 +- Correction d’un bug dans une réplication qui ne permet pas la réplication de fonctionner si l’Utilisateur a exécuté des mutations sur la version précédente. Cela corrige [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alésapine](https://github.com/alesapin)). Il rend la version 20.3 rétrocompatible à nouveau. +- Ajouter un paramètre `use_compact_format_in_distributed_parts_names` qui permet d’écrire des fichiers pour `INSERT` les requêtes en `Distributed` tableau avec un format plus compact. Cela corrige [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alésapine](https://github.com/alesapin)). Il rend la version 20.3 rétrocompatible à nouveau. + +### Clickhouse Version V20. 3. 2. 1, 2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} + +#### Modification Incompatible En Arrière {#backward-incompatible-change} + +- Correction du problème `file name too long` lors de l’envoi de données pour `Distributed` tables pour un grand nombre de répliques. Correction du problème que les informations d’identification de réplique étaient exposées dans le journal du serveur. Le format du nom du répertoire sur le disque a été changé en `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) Après la mise à niveau vers la nouvelle version, vous ne pourrez pas rétrograder sans intervention manuelle, car l’ancienne version du serveur ne reconnaît pas le nouveau format de répertoire. Si vous souhaitez passer, vous devez renommer manuellement les répertoires correspondant à l’ancien format. Cette modification s’applique uniquement si vous avez utilisé asynchrone `INSERT`s `Distributed` table. Dans la version 20.3.3, nous allons introduire un paramètre qui vous permettra d’activer le nouveau format progressivement. +- Modification du format des entrées du journal de réplication pour les commandes de mutation. Vous devez attendre que les anciennes mutations soient traitées avant d’installer la nouvelle version. +- Implémentez un profileur de mémoire simple qui vide stacktraces vers `system.trace_log` chaque n octets au-dessus de la limite d’allocation douce [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([Ivan](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexeï-milovidov](https://github.com/alexey-milovidov)) La colonne de `system.trace_log` a été renommé de `timer_type` de `trace_type`. Cela nécessitera des changements dans les outils d’analyse des performances et de traitement flamegraph de tiers. +- Utilisez L’id de thread du système d’exploitation partout au lieu du numéro de thread interne. Cela corrige [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Vieux `clickhouse-client` impossible de recevoir les journaux envoyés par le serveur lorsque le paramètre `send_logs_level` est activé, car les noms et les types des messages de journal structurés ont été modifiés. D’autre part, différentes versions de serveur peuvent envoyer des journaux avec différents types les uns aux autres. Lorsque vous n’utilisez pas l’ `send_logs_level` réglage, vous ne devez pas soin. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer `indexHint` fonction [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer `findClusterIndex`, `findClusterValue` fonction. Cela corrige [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). Si vous utilisez ces fonctions, envoyez un courriel à `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant, il n’est pas permis de créer des colonnes ou ajouter des colonnes avec `SELECT` sous-requête comme expression par défaut. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alésapine](https://github.com/alesapin)) +- Exiger des alias pour les sous-requêtes dans la JOINTURE. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) +- Améliorer `ALTER MODIFY/ADD` les requêtes de la logique. Maintenant vous ne pouvez pas `ADD` colonne sans type, `MODIFY` l’expression par défaut ne change pas le type de colonne et `MODIFY` type ne perd pas la valeur d’expression par défaut. Fixer [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alésapine](https://github.com/alesapin)) +- Exiger que le serveur soit redémarré pour appliquer les modifications dans la configuration de journalisation. Il s’agit d’une solution de contournement temporaire pour éviter le bogue où le serveur se connecte à un fichier journal supprimé (voir [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Paramètre `experimental_use_processors` est activé par défaut. Ce paramètre active l’utilisation du nouveau pipeline de requêtes. C’est un refactoring interne et nous n’attendons aucun changement visible. Si vous voyez des problèmes, réglez-le sur Retour à zéro. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Nouveauté {#new-feature} + +- Ajouter `Avro` et `AvroConfluent` d’entrée/sortie de formats [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mises à jour multithread et non bloquantes des clés expirées dans `cache` dictionnaires (avec autorisation facultative pour lire les anciens). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Ajouter une requête `ALTER ... MATERIALIZE TTL`. Il exécute mutation qui force à supprimer les données expirées par TTL et recalcule les méta-informations sur TTL dans toutes les parties. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) +- Passez de HashJoin à MergeJoin (sur le disque) si nécessaire [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter `MOVE PARTITION` commande pour `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Le rechargement de la configuration de stockage du fichier de configuration à la volée. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Autorisé à changer `storage_policy` pas moins riche. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Ajout du support pour globs / jokers pour le stockage S3 et la fonction de table. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Mettre `bitAnd`, `bitOr`, `bitXor`, `bitNot` pour `FixedString(N)` type de données. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Ajout de la fonction `bitCount`. Cela corrige [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ikopylov](https://github.com/ikopylov)) +- Ajouter `generateRandom` fonction de table pour générer des lignes aléatoires avec un schéma donné. Permet de remplir une table de test arbitraire avec des données. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) +- `JSONEachRowFormat`: support cas particulier lorsque les objets enfermés dans un tableau de niveau supérieur. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) +- Il est maintenant possible de créer une colonne avec `DEFAULT` expression qui dépend d’une colonne avec défaut `ALIAS` expression. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alésapine](https://github.com/alesapin)) +- Autoriser à spécifier `--limit` plus que la taille des données source dans `clickhouse-obfuscator`. Les données se répéteront avec différentes graines aléatoires. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter `groupArraySample` fonction (similaire à `groupArray`) avec réservoir algorithme d’échantillonnage. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos Oiseau](https://github.com/amosbird)) +- Maintenant, vous pouvez surveiller la taille de la file d’attente de mise à jour dans `cache`/`complex_key_cache` dictionnaires via les métriques du système. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Autoriser L’utilisation de CRLF comme séparateur de ligne au format de sortie CSV avec réglage `output_format_csv_crlf_end_of_line` est réglé sur 1 [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) +- Mettre en œuvre plus de fonctions de la [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` et `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) +- Nouveau paramètre introduit: `max_parser_depth` pour contrôler la taille maximale de la pile et permettre de grandes requêtes complexes. Cela corrige [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) et [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) +- Ajouter un paramètre `force_optimize_skip_unused_shards` réglage sur lancer si le saut d’éclats inutilisés n’est pas possible [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) +- Permet de configurer plusieurs disques / volumes pour stocker des données pour l’envoi `Distributed` moteur [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) +- Politique de stockage de soutien (`` pour le stockage temporaire des données. [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) +- Ajouter `X-ClickHouse-Exception-Code` En-tête HTTP défini si une exception a été levée avant l’envoi de données. Cela met en œuvre [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) +- Ajout de la fonction `ifNotFinite`. C’est juste un sucre syntaxique: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter `last_successful_update_time` colonne en `system.dictionaries` table [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Ajouter `blockSerializedSize` fonction (taille sur disque sans compression) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) +- Ajouter une fonction `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) +- Tables système ajoutées `system.zeros` et `system.zeros_mt` ainsi que les fonctions de conte `zeros()` et `zeros_mt()`. Les Tables (et les fonctions de table) contiennent une seule colonne avec le nom `zero` et le type `UInt8`. Cette colonne contient des zéros. Il est nécessaire à des fins de test comme la méthode la plus rapide pour générer de nombreuses lignes. Cela corrige [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Caractéristique Expérimentale {#experimental-feature} + +- Ajouter un nouveau format compact de pièces dans `MergeTree`-table de famille dont toutes les colonnes sont stockées dans un fichier. Il aide à augmenter les performances des inserts petits et fréquents. L’ancien format (un fichier par colonne) s’appelle maintenant wide. Le format de stockage des données est contrôlé par les paramètres `min_bytes_for_wide_part` et `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) +- Prise en charge du stockage S3 pour `Log`, `TinyLog` et `StripeLog` table. [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) + +#### Bug Fix {#bug-fix-2} + +- Correction d’espaces incohérents dans les messages de journal. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug dans lequel les tableaux de tuples sans nom ont été aplatis en tant que structures imbriquées lors de la création de la table. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) +- Correction du problème lorsque “Too many open files” l’erreur peut se produire s’il y a trop de fichiers correspondant glob modèle dans `File` table ou `file` table de fonction. Maintenant, les fichiers sont ouverts paresseusement. Cela corrige [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- DROP table temporaire ne supprime plus que la table temporaire. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) +- Supprimer la partition obsolète lorsque nous éteignons le serveur ou détacher/joindre une table. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Pour savoir comment le disque par défaut calcule l’espace libre à partir de `data` répertoire. Correction du problème lorsque la quantité d’espace libre n’est pas calculée correctement si l’ `data` le répertoire est monté sur un appareil séparé (cas rare). Cela corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) +- Permettre virgule (croix) joindre avec IN () à l’intérieur. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) +- Permettre de réécrire CROSS to INNER JOIN s’il n’y a pas \[pas\] comme opérateur dans la section WHERE. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un résultat incorrect possible après `GROUP BY` avec le paramètre activé `distributed_aggregation_memory_efficient`. Fixer [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Les clés trouvées ont été comptées comme manquées dans les métriques des dictionnaires de cache. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Correction du protocole de réplication incompatibilité introduit dans [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alésapine](https://github.com/alesapin)) +- Condition de course fixe sur `queue_task_handle` au démarrage de `ReplicatedMergeTree` table. [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Jeton `NOT` ne fonctionne pas dans `SHOW TABLES NOT LIKE` requête [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Vérification de plage ajoutée à la fonction `h3EdgeLengthM`. Sans cette vérification, un débordement de tampon est possible. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug dans les calculs par lots des opérations logiques ternaires sur plusieurs arguments (plus de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) +- Correction d’une erreur D’optimisation de PREWHERE, qui pourrait conduire à des `Inconsistent number of columns got from MergeTreeRangeReader` exception. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) +- Fix inattendu `Timeout exceeded while reading from socket` exception, qui se produit aléatoirement sur une connexion sécurisée avant le délai d’expiration réellement dépassé et lorsque query profiler est activé. Également ajouter `connect_timeout_with_failover_secure_ms` paramètres (par défaut 100 ms), qui est similaire à `connect_timeout_with_failover_ms`, mais est utilisé pour les connexions sécurisées (parce que la liaison SSL est plus lente, que la connexion TCP ordinaire) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un bug avec la finalisation des mutations, lorsque la mutation peut se bloquer dans l’état avec `parts_to_do=0` et `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alésapine](https://github.com/alesapin)) +- Utilisez une nouvelle logique de jointure avec `partial_merge_join` paramètre. Il est possible de faire `ANY|ALL|SEMI LEFT` et `ALL INNER` les jointures avec `partial_merge_join=1` maintenant. [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) +- Shard pince maintenant les paramètres obtenus de l’initiateur aux constaints de la partition au lieu de lancer une exception. Ce correctif permet d’envoyer des requêtes à un serveur avec un autre contraintes. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fixe, problème de gestion de mémoire dans `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixer `toDecimal*OrNull()` famille de fonctions lorsqu’elle est appelée avec une chaîne `e`. Fixer [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) +- Assurez-vous que `FORMAT Null` n’envoie pas de données au client. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Correction d’un bug dans cet horodatage `LiveViewBlockInputStream` ne sera pas mis à jour. `LIVE VIEW` est une fonctionnalité expérimentale. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) +- Fixe `ALTER MODIFY TTL` mauvais comportement qui n’a pas permis de supprimer les anciennes expressions TTL. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Rapport UBSan fixe dans MergeTreeIndexSet. Cela corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du comportement de `match` et `extract` fonctions lorsque haystack a zéro octets. Le comportement était mauvais quand la botte de foin était constante. Cela corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Évitez de lancer de destructor dans la bibliothèque Apache Avro 3rd-party. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) +- Ne commettez pas un lot interrogé à partir de `Kafka` partiellement, car il peut conduire à des trous dans les données. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) +- Fixer `joinGet` avec les types de retour nullable. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos Oiseau](https://github.com/amosbird)) +- Correction de l’incompatibilité des données lorsqu’elles sont compressées avec `T64` codec. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Corriger les ID de type de données dans `T64` codec de compression qui conduit à une mauvaise (de)compression dans les versions affectées. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter un paramètre `enable_early_constant_folding` et le désactiver dans certains cas, cela conduit à des erreurs. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix Pushdown prédicat optimizer avec vue et activer le test [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Fixer erreur de segmentation dans `Merge` tables, cela peut arriver lors de la lecture de `File` stockage [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) +- Ajout d’une vérification de la stratégie de stockage dans `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. Sinon, cela pourrait rendre les données de la partie inaccessibles après le redémarrage et empêcher ClickHouse de démarrer. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix modifie s’il y a TTL défini pour la table. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) +- Correction de la condition de course qui peut se produire lorsque `SYSTEM RELOAD ALL DICTIONARIES` est exécuté pendant que certains dictionnaires sont modifiés / ajoutés / supprimés. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) +- Dans les versions précédentes `Memory` le moteur de base de données utilise un chemin de données vide, de sorte que les tables sont créées dans `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) +- Correction de messages de journal erronés sur le disque ou la stratégie par défaut manquant. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix not (has ()) pour l’index bloom\_filter des types de tableau. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) +- Permettre à première colonne(s) dans un tableau avec `Log` moteur alias [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([Ivan](https://github.com/abyss7)) +- Fixer l’ordre des plages pendant la lecture d’ `MergeTree` table dans un fil. Cela pourrait conduire à des exceptions `MergeTreeRangeReader` ou mauvais résultats de requête. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) +- Faire `reinterpretAsFixedString` retourner `FixedString` plutôt `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) +- Évitez les cas extrêmement rares où l’utilisateur peut se tromper message d’erreur (`Success` au lieu d’une description détaillée de l’erreur). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ne pas planter lors de l’utilisation de `Template` format avec modèle de ligne vide. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Les fichiers de métadonnées pour les tables système peuvent être créés au mauvais endroit [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix)) Fixer [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). +- Correction de la course de données sur exception\_ptr dans le dictionnaire de cache [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Ne pas lancer une exception pour la requête `ATTACH TABLE IF NOT EXISTS`. Auparavant, il a été lancé si la table existe déjà, malgré le `IF NOT EXISTS` clause. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) +- Correction manquant fermeture paren dans le message d’exception. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Éviter de message `Possible deadlock avoided` au démarrage de clickhouse-client en mode interactif. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du problème lorsque le remplissage à la fin de la valeur codée base64 peut être mal formé. Mettre à jour la bibliothèque base64. Cela corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), proche [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Empêcher la perte de données dans `Kafka` dans de rares cas, lorsque l’exception se produit après la lecture du suffixe mais avant la validation. Fixer [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) +- Correction d’une exception dans `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) +- Correction de plantage lorsqu’un utilisateur essaie d’ `ALTER MODIFY SETTING` pour Ancien formaté `MergeTree` famille de moteurs de table. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alésapine](https://github.com/alesapin)) +- Prise en charge des numéros UInt64 qui ne correspondent pas à Int64 dans les fonctions liées à JSON. Mettre à jour SIMDJSON à maîtriser. Cela corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Exécution fixe de prédicats inversés lorsque l’index fonctionnel non strictement monotinique est utilisé. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) +- N’essayez pas de plier `IN` constante dans `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos Oiseau](https://github.com/amosbird)) +- Correction d’un bug dans `ALTER DELETE` mutations qui conduit à la corruption d’index. Cela corrige [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) et [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). En outre fixer des conditions de course extrêmement rares dans `ReplicatedMergeTree` `ALTER` requête. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alésapine](https://github.com/alesapin)) +- Lorsque le réglage `compile_expressions` est activée, vous pouvez obtenir `unexpected column` dans `LLVMExecutableFunction` lorsque nous utilisons `Nullable` type [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Plusieurs correctifs pour `Kafka` moteur: 1) Correction des doublons qui apparaissaient pendant le rééquilibrage du groupe de consommateurs. 2) Correction rare ‘holes’ apparu lorsque les données ont été interrogées à partir de plusieurs partitions avec un sondage et validées partiellement (maintenant, nous traitons / validons toujours l’ensemble du bloc de messages interrogé). 3) corriger les vidages par taille de bloc (avant que seul le rinçage par Délai d’attente fonctionnait correctement). 4) meilleure procédure d’abonnement (avec rétroaction d’affectation). 5) Faites fonctionner les tests plus rapidement (avec des intervalles et des délais d’attente par défaut). En raison du fait que les données n’étaient pas vidées par la taille du bloc auparavant (comme il se doit selon la documentation), Ce PR peut entraîner une dégradation des performances avec les paramètres par défaut (en raison de vidages plus fréquents et plus petits qui sont moins optimaux). Si vous rencontrez le problème de performance après ce changement - veuillez augmenter `kafka_max_block_size` dans le tableau de la plus grande valeur ( par exemple `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Fixer [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) +- Fixer `Parameter out of bound` exception dans certaines requêtes après les optimisations PREWHERE. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) +- Correction du cas de la consistance mixte des arguments de la fonction `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Lors de l’exécution de `CREATE` requête, plier les expressions constantes dans les arguments du moteur de stockage. Remplacez le nom de base de données vide par la base de données actuelle. Fixer [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) +- Maintenant il n’est pas possible de créer ou d’ajouter des colonnes avec des alias cycliques simples comme `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug avec double mouvement qui peut corrompre la partie originale. Ceci est pertinent si vous utilisez `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Permettre `interval` identifiant pour analyser correctement sans backticks. Correction d’un problème lorsqu’une requête ne peut pas être exécutée même si le `interval` l’identifiant est entouré de backticks ou de guillemets doubles. Cela corrige [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Test de fuzz fixe et comportement incorrect de `bitTestAll`/`bitTestAny` fonction. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction plantage possible/mauvais nombre de lignes dans `LIMIT n WITH TIES` quand il y a beaucoup de lignes égales à n’ème ligne. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- Correction de mutations avec des parties écrites avec activé `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alésapine](https://github.com/alesapin)) +- Correction de la course de données à la destruction de `Poco::HTTPServer`. Cela peut se produire lorsque le serveur est démarré et immédiatement arrêté. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Correction d’un bug dans lequel un message d’erreur trompeur a été affiché lors de l’exécution `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) +- Fixe `Parameters are out of bound` exception dans de rares cas où nous avons une constante dans le `SELECT` clause quand nous avons un `ORDER BY` et un `LIMIT` clause. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Fix finalisation des mutations, quand déjà fait mutation peut avoir le statut `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alésapine](https://github.com/alesapin)) +- Empêcher l’exécution de `ALTER ADD INDEX` pour les tables MergeTree avec une ancienne syntaxe, car cela ne fonctionne pas. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) +- Pendant le démarrage du serveur, n’ACCÉDEZ PAS à la table, qui `LIVE VIEW` dépend de, donc le serveur sera en mesure de démarrer. Également supprimer `LIVE VIEW` dépendances lors du détachement `LIVE VIEW`. `LIVE VIEW` est une fonctionnalité expérimentale. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) +- Correction possible segfault dans `MergeTreeRangeReader`, lors de l’exécution `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) +- Correction d’éventuelles sommes de contrôle non appariées avec la colonne TTL. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Correction d’un bug lorsque les pièces n’étaient pas déplacées en arrière-plan par les règles TTL dans le cas où il n’y avait qu’un seul volume. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction du problème `Method createColumn() is not implemented for data type Set`. Cela corrige [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant, nous allons essayer de finaliser les mutations plus fréquemment. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alésapine](https://github.com/alesapin)) +- Fixer `intDiv` par moins une constante [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) +- Correction d’une condition de course possible dans `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un bug menant à la résiliation du serveur lorsque vous essayez d’utiliser / drop `Kafka` tableau créé avec de mauvais paramètres. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) +- Ajout d’une solution de contournement si le système d’exploitation renvoie un résultat erroné pour `timer_create` fonction. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’une erreur dans l’utilisation de `min_marks_for_seek` paramètre. Correction du message d’erreur lorsqu’il n’y a pas de clé de sharding dans la table distribuée et que nous essayons d’ignorer les fragments inutilisés. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) + +#### Amélioration {#improvement} + +- Mettre `ALTER MODIFY/DROP` requêtes au-dessus des mutations pour `ReplicatedMergeTree*` les moteurs de la famille. Maintenant `ALTERS` bloque uniquement à l’étape de mise à jour des métadonnées, et ne bloque pas après cela. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alésapine](https://github.com/alesapin)) +- Ajouter la possibilité de réécrire CROSS aux jointures internes avec `WHERE` section contenant des noms Non qialifiés. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) +- Faire `SHOW TABLES` et `SHOW DATABASES` les requêtes prennent en charge le `WHERE` les expressions et les `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) +- Ajout d’un paramètre `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) +- Après des changements récents Le client MySQL a commencé à imprimer des chaînes binaires en hexadécimal les rendant ainsi non lisibles ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). La solution de contournement dans ClickHouse est de marquer les colonnes de chaîne comme UTF-8, ce qui n’est pas toujours le cas, mais généralement le cas. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) +- Ajout du support des clés String et FixedString pour `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) +- Clés de chaîne de soutien dans les cartes SummingMergeTree [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) +- Signal terminaison du thread au pool de threads même si le thread a lancé une exception [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Permettent de mettre en `query_id` dans `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) +- N’autorisez pas les expressions étranges `ALTER TABLE ... PARTITION partition` requête. Cela répond à l’ [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Table `system.table_engines` fournit maintenant des informations sur le support des fonctionnalités (comme `supports_ttl` ou `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) +- Permettre `system.metric_log` par défaut. Il contiendra des lignes avec des valeurs de ProfileEvents, CurrentMetrics collectées avec “collect\_interval\_milliseconds” intervalle (une seconde par défaut). La table est très petite (généralement par ordre de mégaoctets) et la collecte de ces données par défaut est raisonnable. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([Ivan](https://github.com/abyss7)) +- Maintenant temporaire `LIVE VIEW` est créé par `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` plutôt `CREATE TEMPORARY LIVE VIEW ...` parce que la syntaxe précédente n’était pas conforme à `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) +- Ajouter text\_log.paramètre de configuration de niveau pour limiter les entrées `system.text_log` table [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) +- Permettre de mettre la partie téléchargée sur un disque / volume selon les règles TTL [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Pour les dictionnaires MySQL externes, autorisez à mutualiser le pool de connexions MySQL pour “share” parmi les dictionnaires. Cette option réduit considérablement le nombre de connexions aux serveurs MySQL. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Afficher le temps d’exécution de la requête le plus proche pour les quantiles dans `clickhouse-benchmark` sortie au lieu de valeurs interpolées. Il est préférable d’afficher les valeurs qui correspondent à l’exécution de certaines requêtes. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Possibilité d’ajouter une clé et un horodatage pour le message lors de l’insertion de données dans Kafka. Fixer [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) +- Si le serveur est exécuté à partir du terminal, mettez en surbrillance le numéro de thread, l’id de requête et la priorité du journal par couleurs. Ceci permet d’améliorer la lisibilité des messages de journal corrélés pour les développeurs. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Meilleur message d’exception lors du chargement des tables pour `Ordinary` la base de données. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre `arraySlice` pour les tableaux avec des états de fonction d’agrégat. Cela corrige [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Autoriser les fonctions constantes et les tableaux constants à utiliser sur le côté droit de L’opérateur IN. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) +- Si l’exception zookeeper s’est produite lors de la récupération des données du système.les répliques, l’afficher dans une colonne séparée. Cela met en œuvre [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer atomiquement les parties de données MergeTree sur destroy. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Prise en charge de la sécurité au niveau des lignes pour les tables distribuées. [\#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([Ivan](https://github.com/abyss7)) +- Now we recognize suffix (like KB, KiB…) in settings values. [\#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) +- Empêchez la mémoire lors de la construction du résultat d’une jointure importante. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajout de noms de clusters aux suggestions en mode interactif dans `clickhouse-client`. [\#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexeï-milovidov](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) ([Ivan](https://github.com/abyss7)) +- Ajout de la colonne `exception_code` dans `system.query_log` table. [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) +- Serveur de compatibilité MySQL activé sur le port `9004` par défaut dans le fichier de configuration du serveur. Fixe génération de mot de passe commande dans l’exemple de configuration. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) +- Empêcher l’abandon à l’arrêt si le système de fichiers est en lecture seule. Cela corrige [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Meilleur message d’exception lorsque la longueur est requise dans la requête HTTP POST. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter `_path` et `_file` les colonnes virtuelles à `HDFS` et `File` les moteurs et les `hdfs` et `file` les fonctions de table [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) +- Correction d’erreur `Cannot find column` lors de l’insertion dans `MATERIALIZED VIEW` dans le cas où une nouvelle colonne a été ajoutée à la table interne de la vue. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction de la progression sur le protocole client-serveur natif, en envoyant la progression après la mise à jour finale (comme les journaux). Cela peut être pertinent uniquement pour certains outils tiers qui utilisent le protocole natif. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) +- Ajouter une métrique système de suivi du nombre de connexions client à L’aide du protocole MySQL ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) +- A partir de Maintenant, les réponses HTTP auront `X-ClickHouse-Timezone` en-tête défini sur la même valeur de fuseau horaire que `SELECT timezone()` serait-rapport. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) + +#### Amélioration Des Performances {#performance-improvement} + +- Améliorer les performances de l’analyse de l’indice DANS [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) +- Code plus simple et plus efficace dans les fonctions logiques + nettoyage de code. Un suivi à [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) +- Amélioration globale de la performance (de l’ordre de 5%..200% pour les requêtes affectées) en assurant un aliasing encore plus strict avec les fonctionnalités c++20. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos Oiseau](https://github.com/amosbird)) +- Aliasing plus strict pour les boucles internes des fonctions de comparaison. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Aliasing plus strict pour les boucles internes des fonctions arithmétiques. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Une implémentation ~3 fois plus rapide pour ColumnVector::replicate (), via laquelle ColumnConst:: convertToFullColumn () est implémentée. Sera également utile dans les tests lors de la matérialisation des constantes. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) +- Une autre amélioration mineure des performances à `ColumnVector::replicate()` (cela accélère le `materialize` fonction et des fonctions d’ordre supérieur) une amélioration encore plus [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) +- Amélioration des performances de `stochasticLinearRegression` fonction d’agrégation. Ce patch est fourni par Intel. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Améliorer les performances de `reinterpretAsFixedString` fonction. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- N’envoyez pas de blocs au client pour `Null` format dans le pipeline de processeurs. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement} + +- La gestion des exceptions fonctionne maintenant correctement sur le sous-système Windows Pour Linux. Tu vois https://github.com/ClickHouse-Extras/libunwind/pull/3 cela corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) +- Remplacer `readline` avec `replxx` interactif, l’édition en ligne en `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([Ivan](https://github.com/abyss7)) +- Meilleur temps de construction et moins d’instanciations de modèle dans FunctionsComparison. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Intégration ajoutée avec `clang-tidy` in CI. Voir aussi [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant, nous lions ClickHouse dans CI en utilisant `lld` même pour `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alésapine](https://github.com/alesapin)) +- Permet de randomiser la planification des threads et d’insérer des problèmes lorsque `THREAD_FUZZER_*` variables d’environnement sont définies. Cela aide les tests. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Activer les sockets sécurisés dans les tests sans état [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) +- Rendre SPLIT\_SHARED\_LIBRARIES = OFF plus robuste [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) +- Faire “performance\_introspection\_and\_logging” test fiable au serveur aléatoire bloqué. Cela peut se produire dans L’environnement CI. Voir aussi [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Valider XML dans la vérification de style. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Condition de course fixe dans l’essai `00738_lock_for_inner_table`. Ce test reposait sur le sommeil. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer les tests de performance de type `once`. Ceci est nécessaire pour exécuter tous les tests de performance en mode de comparaison statistique (plus fiable). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout d’un test de performance pour les fonctions arithmétiques. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouté test de performance pour `sumMap` et `sumMapWithOverflow` les fonctions d’agrégation. Pour le suivi de la [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Assurez le style des codes D’erreur en vérifiant le style. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter un script pour l’historique des tests. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alésapine](https://github.com/alesapin)) +- Ajouter un avertissement GCC `-Wsuggest-override` pour localiser et réparer tous les endroits où `override` mot-clé doit être utilisé. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Ignorer le symbole faible sous Mac OS X car il doit être défini [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Utilisateur supprimé](https://github.com/ghost)) +- Normaliser le temps d’exécution de certaines requêtes dans les tests de performance. Ceci est fait en préparation pour exécuter tous les tests de performance en mode comparaison. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de certains tests pour prendre en charge pytest avec des tests de requête [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([Ivan](https://github.com/abyss7)) +- Activez SSL dans build avec MSan, afin que le serveur n’échoue pas au démarrage lors de l’exécution de tests sans état [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) +- Correction de la substitution de base de données dans les résultats des tests [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) +- Construire des correctifs pour diverses plates-formes [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) +- Ajout de la section disques à l’image Docker test stateless-with-coverage [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) +- Débarrassez-vous des fichiers in-source-tree lors de la construction avec GRPC [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos Oiseau](https://github.com/amosbird)) +- Temps de construction légèrement plus rapide en supprimant SessionCleaner du contexte. Rendre le code de SessionCleaner plus simple. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mise à jour de la vérification des requêtes suspendues dans le script clickhouse-test [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) +- Suppression de certains fichiers inutiles du référentiel. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Changement de type de math perftests de `once` de `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ajouter une image docker qui permet de créer un rapport HTML interactif du navigateur de code pour notre base de code. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alésapine](https://github.com/alesapin)) Voir [Navigateur De Code Woboq](https://clickhouse.tech/codebrowser/html_report///ClickHouse/src/src/index.html) +- Supprimer certains échecs de test sous MSan. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- SpeedUp “exception while insert” test. Ce test expire souvent dans la construction debug-with-coverage. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre `libcxx` et `libcxxabi` maîtriser. En préparation à [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du test flacky `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Nettoyer les drapeaux de l’éditeur de liens dupliqués. Assurez-vous que l’éditeur de liens ne pas rechercher un symbole inattendu. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos Oiseau](https://github.com/amosbird)) +- Ajouter `clickhouse-odbc` pilote dans les images de test. Cela permet de tester l’interaction de ClickHouse avec ClickHouse via son propre pilote ODBC. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) +- Correction de plusieurs bugs dans les tests unitaires. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alésapine](https://github.com/alesapin)) +- Permettre `-Wmissing-include-dirs` Avertissement GCC pour éliminer toutes les inclusions non existantes-principalement à la suite D’erreurs de script CMake [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Décrivez les raisons si query profiler ne peut pas fonctionner. C’est prévu pour [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre à jour OpenSSL vers le maître en amont. Correction du problème lorsque les connexions TLS peuvent échouer avec le message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` et `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. Le problème était présent dans la version 20.1. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre à jour Dockerfile pour le serveur [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) +- Corrections mineures dans le script build-gcc-from-sources [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) +- Remplacer `numbers` de `zeros` dans perftests où `number` la colonne n’est pas utilisée. Cela conduira à des résultats de test plus propres. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un problème de débordement de pile lors de l’utilisation de initializer\_list dans les constructeurs de colonnes. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Utilisateur supprimé](https://github.com/ghost)) +- Mise à niveau librdkafka à v1. 3. 0. Activer groupé `rdkafka` et `gsasl` bibliothèques sous Mac OS X. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) +- correction de construction sur GCC 9.2.0 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) + +## Clickhouse Version V20. 1 {#clickhouse-release-v20-1} + +### Clickhouse Version V20. 1. 8. 41, 2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} + +#### Bug Fix {#bug-fix-3} + +- Correction possible permanente `Cannot schedule a task` erreur (due à une exception non gérée dans `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). Cela corrige [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) +- Correction de la consommation excessive de mémoire dans `ALTER` les requêtes (mutations). Cela corrige [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) et [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug dans backquoting dans les dictionnaires externes DDL. Cela corrige [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alésapine](https://github.com/alesapin)) + +### Clickhouse Version V20. 1. 7. 38, 2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} + +#### Bug Fix {#bug-fix-4} + +- Correction de noms de fonctions internes incorrects pour `sumKahan` et `sumWithOverflow`. Je mène à l’exception en utilisant ces fonctions dans les requêtes distantes. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). Ce problème était dans toutes les versions de ClickHouse. +- Permettre `ALTER ON CLUSTER` de `Distributed` tables avec réplication interne. Cela corrige [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). Ce problème était dans toutes les versions de ClickHouse. +- Corriger les exceptions possibles `Size of filter doesn't match size of column` et `Invalid number of rows in Chunk` dans `MergeTreeRangeReader`. Ils pouvaient apparaître lors de l’exécution `PREWHERE` dans certains cas. Fixer [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) +- Correction du problème: le fuseau horaire n’a pas été conservé si vous écrivez une expression arithmétique simple comme `time + 1` (contrairement à une expression comme `time + INTERVAL 1 SECOND`). Cela corrige [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexeï-milovidov](https://github.com/alexey-milovidov)). Ce problème était dans toutes les versions de ClickHouse. +- Maintenant il n’est pas possible de créer ou d’ajouter des colonnes avec des alias cycliques simples comme `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alésapine](https://github.com/alesapin)) +- Correction du problème lorsque le remplissage à la fin de la valeur codée base64 peut être mal formé. Mettre à jour la bibliothèque base64. Cela corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), proche [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la course de données à la destruction de `Poco::HTTPServer`. Cela peut se produire lorsque le serveur est démarré et immédiatement arrêté. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Correction plantage possible/mauvais nombre de lignes dans `LIMIT n WITH TIES` quand il y a beaucoup de lignes égales à n’ème ligne. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- Correction d’éventuelles sommes de contrôle non appariées avec la colonne TTL. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Correction de plantage lorsqu’un utilisateur essaie d’ `ALTER MODIFY SETTING` pour Ancien formaté `MergeTree` famille de moteurs de table. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alésapine](https://github.com/alesapin)) +- Maintenant, nous allons essayer de finaliser les mutations plus fréquemment. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alésapine](https://github.com/alesapin)) +- Correction du protocole de réplication incompatibilité introduit dans [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alésapine](https://github.com/alesapin)) +- Fix not (has ()) pour l’index bloom\_filter des types de tableau. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) +- Correction du comportement de `match` et `extract` fonctions lorsque haystack a zéro octets. Le comportement était mauvais quand la botte de foin était constante. Cela corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-1} + +- La gestion des exceptions fonctionne maintenant correctement sur le sous-système Windows Pour Linux. Tu vois https://github.com/ClickHouse-Extras/libunwind/pull/3 cela corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) + +### Clickhouse Version V20. 1. 6. 30, 2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} + +#### Bug Fix {#bug-fix-5} + +- Correction de l’incompatibilité des données lorsqu’elles sont compressées avec `T64` codec. + [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) +- Correction de l’ordre des plages lors de la lecture de la table MergeTree dans un thread. Fixer [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). + [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) +- Correction possible segfault dans `MergeTreeRangeReader`, lors de l’exécution `PREWHERE`. Fixer [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). + [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) +- Fixer `reinterpretAsFixedString` retourner `FixedString` plutôt `String`. + [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) +- Fixer `joinGet` avec les types de retour nullable. Fixer [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) + [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) +- Correction du test fuzz et du comportement incorrect des fonctions bitTestAll/bitTestAny. + [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Corrigez le comportement des fonctions match et extract lorsque haystack a zéro octet. Le comportement était mauvais quand la botte de foin était constante. Fixer [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) + [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Exécution fixe de prédicats inversés lorsque l’index fonctionnel non strictement monotinique est utilisé. Fixer [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) + [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) +- Permettre à réécrire `CROSS` de `INNER JOIN` si il y a `[NOT] LIKE` opérateur `WHERE` section. Fixer [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) + [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) +- Autoriser la(Les) première (s) colonne (s) dans une table avec Log engine à être un alias. + [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) +- Autoriser la virgule rejoindre `IN()` à l’intérieur. Fixer [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). + [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) +- Améliorer `ALTER MODIFY/ADD` les requêtes de la logique. Maintenant vous ne pouvez pas `ADD` colonne sans type, `MODIFY` l’expression par défaut ne change pas le type de colonne et `MODIFY` type ne perd pas la valeur d’expression par défaut. Fixer [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). + [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) +- Fix finalisation des mutations, quand déjà fait mutation peut avoir le statut is\_done = 0. + [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) +- Soutien “Processors” pipeline pour le système.nombres et système.numbers\_mt. Cela corrige également le bug lorsque `max_execution_time` n’est pas respectée. + [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- Correction d’un mauvais comptage de `DictCacheKeysRequestedFound` métrique. + [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) +- Ajout d’une vérification de la stratégie de stockage dans `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` ce qui pourrait autrement rendre les données de la partie inaccessibles après le redémarrage et empêcher ClickHouse de démarrer. + [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) +- Rapport UBSan fixe dans `MergeTreeIndexSet`. Cela corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) + [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Correction possible datarace dans BlockIO. + [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- Soutien pour `UInt64` nombres qui ne correspondent pas à Int64 dans les fonctions liées à JSON. Mettre `SIMDJSON` maîtriser. Cela corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) + [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Résoudre le problème lorsque la quantité d’espace libre n’est pas calculée correctement si le répertoire de données est monté sur un appareil séparé. Pour le disque par défaut calculer l’espace libre à partir du sous-répertoire de données. Cela corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) + [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) +- Corrigez le problème lorsque les connexions TLS peuvent échouer avec le message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Mettre à jour OpenSSL vers le maître en amont. + [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Lors de l’exécution de `CREATE` requête, plier les expressions constantes dans les arguments du moteur de stockage. Remplacez le nom de base de données vide par la base de données actuelle. Fixer [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Corrigez également la vérification de l’adresse locale dans ClickHouseDictionarySource. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Fixer erreur de segmentation dans `StorageMerge`, ce qui peut arriver lors de la lecture de StorageFile. + [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) +- Empêcher la perte de données dans `Kafka` dans de rares cas, lorsque l’exception se produit après la lecture du suffixe mais avant la validation. Fixer [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Concerner: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Correction d’un bug menant à la résiliation du serveur lorsque vous essayez d’utiliser / drop `Kafka` tableau créé avec de mauvais paramètres. Fixer [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporer [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) + +#### Nouveauté {#new-feature-1} + +- Ajouter `deduplicate_blocks_in_dependent_materialized_views` option pour contrôler le comportement des insertions idempotent dans des tables avec des vues matérialisées. Cette nouvelle fonctionnalité a été ajoutée à la version de bugfix par une demande spéciale D’Altinity. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### Clickhouse Version V20. 1. 2. 4, 2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} + +#### Modification Incompatible En Arrière {#backward-incompatible-change-1} + +- Effectuer le réglage `merge_tree_uniform_read_distribution` obsolète. Le serveur reconnaît toujours ce paramètre, mais il n’a pas d’effet. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Type de retour modifié de la fonction `greatCircleDistance` de `Float32` parce que maintenant, le résultat du calcul est `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant, il est prévu que les paramètres de requête sont représentés dans “escaped” format. Par exemple, pour passer de la chaîne `ab` vous devez écrire `a\tb` ou `a\b` et, respectivement,, `a%5Ctb` ou `a%5C%09b` dans L’URL. Ceci est nécessaire pour ajouter la possibilité de passer NULL as `\N`. Cela corrige [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Permettre `use_minimalistic_part_header_in_zookeeper` réglage pour `ReplicatedMergeTree` par défaut. Cela permettra de réduire considérablement la quantité de données stockées dans ZooKeeper. Ce paramètre est pris en charge depuis la version 19.1 et nous l’utilisons déjà en production dans plusieurs services sans aucun problème depuis plus d’une demi-année. Désactivez ce paramètre si vous avez la possibilité de passer à des versions antérieures à 19.1. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Les indices de saut de données sont prêts pour la production et activés par défaut. Paramètre `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` et `allow_experimental_multiple_joins_emulation` sont maintenant obsolètes et ne rien faire. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter de nouveaux `ANY JOIN` logique pour `StorageJoin` compatible avec `JOIN` opération. Pour mettre à niveau sans changement de comportement vous devez ajouter `SETTINGS any_join_distinct_right_table_keys = 1` pour engine Join tables metadata ou recréer ces tables après la mise à niveau. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) +- Exiger que le serveur soit redémarré pour appliquer les modifications dans la configuration de journalisation. Il s’agit d’une solution de contournement temporaire pour éviter le bogue où le serveur se connecte à un fichier journal supprimé (voir [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### Nouveauté {#new-feature-2} + +- Ajout d’informations sur les chemins d’accès `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Ajouter la possibilité d’exécuter `SYSTEM RELOAD DICTIONARY` requête en `ON CLUSTER` mode. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Ajouter la possibilité d’exécuter `CREATE DICTIONARY` les requêtes en `ON CLUSTER` mode. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alésapine](https://github.com/alesapin)) +- Maintenant, le profil de l’utilisateur dans `users.xml` peut hériter de plusieurs profils. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Ajouter `system.stack_trace` table qui permet de regarder les traces de pile de tous les threads du serveur. Ceci est utile pour les développeurs d’introspecter l’état du serveur. Cela corrige [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter `DateTime64` type de données configurables sous-précision de seconde. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) +- Ajouter une fonction de table `clusterAllReplicas` ce qui permet d’interroger tous les nœuds dans le cluster. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari)) +- Ajouter une fonction d’agrégat `categoricalInformationValue` qui calcule la valeur d’information d’une fonction discrète. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) +- Accélérer l’analyse des fichiers de données dans `CSV`, `TSV` et `JSONEachRow` formater en le faisant en parallèle. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Ajouter une fonction `bankerRound` qui effectue l’arrondi. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) +- Soutenir plus de langues dans le dictionnaire intégré pour les noms de région: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Améliorer l’uniformité de `ANY JOIN` logique. Maintenant `t1 ANY LEFT JOIN t2` égal `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter un paramètre `any_join_distinct_right_table_keys` ce qui permet un vieux comportement pour `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter de nouveaux `SEMI` et `ANTI JOIN`. Vieux `ANY INNER JOIN` comportement maintenant disponible en `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter `Distributed` format pour `File` moteur et `file` fonction de table qui permet de lire à partir `.bin` fichiers générés par des insertions asynchrones dans `Distributed` table. [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ajouter un argument de colonne de réinitialisation facultatif pour `runningAccumulate` ce qui permet de réinitialiser les résultats d’agrégation pour chaque nouvelle valeur de clé. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) +- Ajouter la possibilité d’utiliser ClickHouse comme point de terminaison Prometheus. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) +- Ajouter une section `` dans `config.xml` qui restreint les hôtes autorisés pour les moteurs de table distants et les fonctions de table `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) +- Ajout de la fonction `greatCircleAngle` qui calcule la distance sur une sphère en degrés. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Rayon de la Terre modifié pour être cohérent avec la bibliothèque H3. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter `JSONCompactEachRow` et `JSONCompactEachRowWithNamesAndTypes` les formats d’entrée et de sortie. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) +- Ajout d’une fonctionnalité pour les moteurs de table liés aux fichiers et les fonctions de table (`File`, `S3`, `URL`, `HDFS`) qui permet de lire et d’écrire `gzip` fichiers basés sur un paramètre de moteur supplémentaire ou une extension de fichier. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) +- Ajouté le `randomASCII(length)` fonction, générant une chaîne avec un ensemble aléatoire de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caractères imprimables. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([Baïonnette](https://github.com/BayoNet)) +- Ajout de la fonction `JSONExtractArrayRaw` qui renvoie un tableau sur des éléments de tableau JSON non analysés de `JSON` chaîne. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) +- Ajouter `arrayZip` fonction qui permet de combiner plusieurs tableaux de longueurs égales dans un tableau de n-uplets. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Ajouter la possibilité de déplacer des données entre les disques selon configuré `TTL`-expressions pour `*MergeTree` famille de moteurs de table. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Ajout d’une nouvelle fonction d’agrégat `avgWeighted` qui permet de calculer la moyenne pondérée. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) +- Maintenant, l’analyse parallèle est activée par défaut pour `TSV`, `TSKV`, `CSV` et `JSONEachRow` format. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Ajouter plusieurs fonctions de géo `H3` bibliothèque: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` et `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) +- Ajout du support pour brotli (`br`) compression dans les stockages liés aux fichiers et les fonctions de table. Cela corrige [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter `groupBit*` fonctions pour l’ `SimpleAggregationFunction` type. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Bug Fix {#bug-fix-6} + +- Correction du renommage des tables avec `Distributed` moteur. Correction problème [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- Maintenant dictionnaires de soutien `EXPRESSION` pour les attributs dans une chaîne arbitraire en dialecte SQL non-ClickHouse. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alésapine](https://github.com/alesapin)) +- Réparation de `INSERT SELECT FROM mysql(...)` requête. Cela corrige [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) et [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- Correction d’erreur “Mismatch column sizes” lors de l’insertion par défaut `Tuple` de `JSONEachRow`. Cela corrige [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) +- Maintenant, une exception sera levée en cas d’utilisation `WITH TIES` parallèlement `LIMIT BY`. Ajoutez également la possibilité d’utiliser `TOP` avec `LIMIT BY`. Cela corrige [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Correction de la dépendance unintendent à partir de la nouvelle version de glibc dans `clickhouse-odbc-bridge` binaire. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos Oiseau](https://github.com/amosbird)) +- Correction d’un bug dans la fonction de contrôle de `*MergeTree` les moteurs de la famille. Maintenant, il n’échoue pas dans le cas où nous avons une quantité égale de lignes dans le dernier granule et la dernière marque (non finale). [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alésapine](https://github.com/alesapin)) +- Fixer l’insertion dans `Enum*` les colonnes après `ALTER` requête, lorsque le type numérique sous-jacent est égal au type spécifié par la table. Cela corrige [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) +- Négatif non constant autorisé “size” argument pour la fonction `substring`. Il n’a pas été autorisé par erreur. Cela corrige [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bogue d’analyse lorsque le nombre d’arguments transmis est erroné `(O|J)DBC` tableau moteur. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alésapine](https://github.com/alesapin)) +- Utilisation du nom de commande du processus clickhouse en cours d’exécution lors de l’envoi de journaux à syslog. Dans les versions précédentes, la chaîne vide était utilisée à la place du nom de la commande. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) +- Correction de la vérification des hôtes autorisés pour `localhost`. Ce PR corrige la solution fournie dans [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction plantage rare dans `argMin` et `argMax` fonctions pour les arguments de chaîne longue, lorsque result est utilisé dans `runningAccumulate` fonction. Cela corrige [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinosaure](https://github.com/769344359)) +- Correction de la surcommission de mémoire pour les tables avec `Buffer` moteur. [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) +- Correction d’un bug potentiel dans les fonctions qui peuvent prendre `NULL` comme l’un des arguments et retourner non-NULL. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Meilleurs calculs de métriques dans le pool de threads pour les processus `MergeTree` table des moteurs. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fonction Fix `IN` à l’intérieur de `WHERE` instruction lorsque le filtre de table de niveau ligne est présent. Fixer [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([Ivan](https://github.com/abyss7)) +- Maintenant, une exception est levée si la valeur intégrale n’est pas complètement analysée pour les valeurs des paramètres. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) +- Fix exception lorsque la fonction est utilisée dans la requête distribuée table avec plus de deux fragments. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Maintenant, bloom filter peut gérer des tableaux de longueur nulle et n’effectue pas de calculs redondants. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbab](https://github.com/achimbab)) +- Correction de la vérification si un hôte client est autorisé en faisant correspondre l’hôte client à `host_regexp` spécifié dans `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) +- Relax colonne ambiguë vérifier qui conduit à des faux positifs dans plusieurs `JOIN ON` section. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction possible plantage du serveur (`std::terminate`) lorsque le serveur ne peut pas envoyer ou écrire des données `JSON` ou `XML` format avec les valeurs de `String` type de données (qui nécessitent `UTF-8` validation) ou lors de la compression des données de résultat avec l’algorithme Brotli ou dans certains autres cas rares. Cela corrige [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la condition de course dans `StorageDistributedDirectoryMonitor` trouvé par CI. Cela corrige [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Maintenant fond fusionne dans `*MergeTree` la famille des moteurs de table préserve l’ordre de volume de la Politique de stockage avec plus de précision. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Maintenant moteur de table `Kafka` fonctionne correctement avec `Native` format. Cela corrige [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Formats fixes avec des en-têtes (comme `CSVWithNames`) qui lançaient une exception sur EOF pour le moteur de table `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Correction d’un bug avec making set from subquery dans la partie droite de `IN` section. Cela corrige [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) et [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Correction d’un crash possible lors de la lecture à partir du stockage `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction de la lecture des fichiers en `Parquet` format contenant des colonnes de type `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([maxulan](https://github.com/maxulan)) +- Correction d’erreur `Not found column` pour les requêtes distribuées avec `PREWHERE` condition dépendant de la clé d’échantillonnage si `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’erreur `Not found column` si la requête utilisée `PREWHERE` dépendant de l’alias de la table et le jeu de résultats était vide en raison de la condition de clé primaire. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Type de retour fixe pour les fonctions `rand` et `randConstant` en cas de `Nullable` argument. Maintenant renvoient toujours `UInt32` et jamais `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Désactivé prédicat-poussoir vers le bas pour `WITH FILL` expression. Cela corrige [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Fixe incorrect `count()` résultat `SummingMergeTree` lorsque `FINAL` la section est utilisée. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Correction d’un résultat incorrect possible pour les fonctions constantes à partir de serveurs distants. C’est arrivé pour les requêtes avec des fonctions comme `version()`, `uptime()`, etc. qui renvoie différentes valeurs constantes pour différents serveurs. Cela corrige [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’un bug compliqué dans l’optimisation des prédicats push-down qui conduit à de mauvais résultats. Cela résout beaucoup de problèmes sur l’optimisation des prédicats push-down. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Correction d’un crash dans l’ `CREATE TABLE .. AS dictionary` requête. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) +- Plusieurs améliorations grammaire ClickHouse dans `.g4` fichier. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) +- Correction d’un bug qui conduit à des plantages dans `JOIN`s avec tables avec moteur `Join`. Cela corrige [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) +- Corriger les dictionnaires redondants recharger sur `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) +- Limiter le nombre maximum de flux pour lire à partir `StorageFile` et `StorageHDFS`. Corrections https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug dans `ALTER ... MODIFY ... CODEC` requête, lorsque l’utilisateur spécifie à la fois l’expression par défaut et le codec. Fixer [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alésapine](https://github.com/alesapin)) +- Correction d’une erreur dans la fusion en arrière-plan des colonnes avec `SimpleAggregateFunction(LowCardinality)` type. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fonction d’enregistrement de type fixe `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) +- Maintenant le serveur ne plante pas `LEFT` ou `FULL JOIN` avec et Rejoindre moteur et non pris en charge `join_use_nulls` paramètre. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) +- Maintenant `DROP DICTIONARY IF EXISTS db.dict` la requête ne lance pas d’exception si `db` n’existe pas. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- Correction des plantages possibles dans les fonctions de la table (`file`, `mysql`, `remote`) causés par l’utilisation de la référence à enlever `IStorage` objet. Correction d’une analyse incorrecte des colonnes spécifiées lors de l’insertion dans la fonction de table. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) +- S’assurer du réseau avant de démarrer `clickhouse-server`. Cela corrige [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) +- Correction de la gestion des délais d’attente pour les connexions sécurisées, de sorte que les requêtes ne se bloquent pas indéfiniment. Cela corrige [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer `clickhouse-copier`conflit redondant entre les travailleurs concurrents. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Maintenant, les mutations ne sautent pas les parties attachées, même si leur version de mutation était plus grande que la version de mutation actuelle. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alésapine](https://github.com/alesapin)) +- Ignorer les copies redondantes de `*MergeTree` les parties de données après le déplacement vers un autre disque et le redémarrage du serveur. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction d’un crash dans l’ `FULL JOIN` avec `LowCardinality` dans `JOIN` clé. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) +- Interdit d’utiliser le nom de colonne plus d’une fois dans insert query comme `INSERT INTO tbl (x, y, x)`. Cela corrige [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alésapine](https://github.com/alesapin)) +- Ajout de secours pour la détection du nombre de cœurs de processeur physiques pour les processeurs inconnus (en utilisant le nombre de cœurs de processeur logiques). Cela corrige [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer `There's no column` erreur pour les colonnes matérialisées et alias. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction d’un crash sever lorsque `EXISTS` la requête a été utilisé sans `TABLE` ou `DICTIONARY` qualificatif. Tout comme `EXISTS t`. Cela corrige [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). Ce bug a été introduit dans la version 19.17. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un bug rare avec erreur `"Sizes of columns doesn't match"` qui pourraient apparaître lors de l’utilisation `SimpleAggregateFunction` colonne. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Correction d’un bug où l’utilisateur avec vide `allow_databases` vous avez accès à toutes les bases de données (et même pour `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) +- Correction du crash du client lorsque le serveur est déjà déconnecté du client. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Fixer `ORDER BY` comportement en cas de tri par préfixe de clé primaire et Suffixe de clé non primaire. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) +- Vérifiez si la colonne qualifiée est présente dans le tableau. Cela corrige [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) +- Correction du comportement avec `ALTER MOVE` exécuté immédiatement après la fin de la fusion se déplace superpart De spécifié. Fixer [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction d’un crash possible du serveur lors de l’utilisation `UNION` avec un nombre différent de colonnes. Fixer [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixer la taille de résultat pour la fonction substring `substr` avec une taille négative. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Maintenant le serveur n’exécute pas la mutation partielle dans `MergeTree` s’il n’y a pas assez de threads libres dans le pool d’arrière-plan. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) +- Correction d’une faute de frappe mineure sur le formatage `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) +- Correction des résultats incorrects du filtre bloom pour les nombres négatifs. Cela corrige [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Dépassement de tampon potentiel fixe en décompression. Un utilisateur malveillant peut transmettre des données compressées fabriquées qui provoqueront une lecture après le tampon. Ce problème a été trouvé par Eldar Zaitov de l’équipe de sécurité de L’information Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction d’un résultat incorrect en raison du débordement d’entiers dans `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Maintenant `OPTIMIZE TABLE` query n’attendra pas les répliques hors ligne pour effectuer l’opération. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) +- Fixe `ALTER TTL` analyseur pour `Replicated*MergeTree` table. [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction de la communication entre le serveur et le client, afin que le serveur lise les informations des tables temporaires après l’échec de la requête. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Fixer `bitmapAnd` erreur de fonction lors de l’intersection d’un bitmap agrégé et d’un bitmap scalaire. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Affiner la définition de `ZXid` selon le Guide du programmeur ZooKeeper qui corrige un bug dans `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- `odbc` fonction de table respecte maintenant `external_table_functions_use_nulls` paramètre. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) +- Correction d’un bug qui conduisait à une course de données rare. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- Maintenant `SYSTEM RELOAD DICTIONARY` recharge complètement un dictionnaire, en ignorant `update_field`. Cela corrige [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ajouter la possibilité de vérifier si le dictionnaire existe dans create query. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alésapine](https://github.com/alesapin)) +- Fixer `Float*` l’analyse en `Values` format. Cela corrige [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un crash lorsque nous ne pouvons pas réserver d’espace dans certaines opérations en arrière-plan de `*MergeTree` famille de moteurs de table. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Correction du crash de l’opération de fusion lorsque la table contient `SimpleAggregateFunction(LowCardinality)` colonne. Cela corrige [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) +- Restaurez la prise en charge de toutes les locales ICU et ajoutez la possibilité d’appliquer des collations pour les expressions constantes. Ajoutez également le nom de la langue à `system.collations` table. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alésapine](https://github.com/alesapin)) +- Correction d’un bug lorsque les dictionnaires externes avec zéro durée de vie minimale (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) ne pas mettre à jour en arrière-plan. [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alésapine](https://github.com/alesapin)) +- Correction d’un crash lorsque le dictionnaire externe avec la source de ClickHouse a une sous-requête dans la requête. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Correction d’une analyse incorrecte de l’extension de fichier dans la table avec le moteur `URL`. Cela corrige [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) +- Fixer `CHECK TABLE` requête pour `*MergeTree` les tables sans clé. Fixer [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alésapine](https://github.com/alesapin)) +- De conversion fixe de `Float64` au type MySQL. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) +- Maintenant, si la table n’a pas été complètement abandonnée en raison d’un plantage du serveur, le serveur va essayer de la restaurer et de la charger. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- Correction d’un crash dans la fonction de table `file` lors de l’insertion dans le fichier qui n’existe pas. Maintenant, dans ce cas, le fichier sera créé et insérez seraient traités. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Correction de l’impasse rare qui peut arriver quand `trace_log` est activé. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Ajouter la possibilité de travailler avec différents types en outre `Date` dans `RangeHashed` dictionnaire externe créé à partir de la requête DDL. Fixer [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alésapine](https://github.com/alesapin)) +- Correction d’un crash lorsque `now64()` est appelé avec un résultat d’une autre fonction. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) +- Correction d’un bug avec la détection de l’adresse IP du client pour les connexions via le protocole de fil mysql. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) +- Correction de la gestion du tableau vide dans `arraySplit` fonction. Cela corrige [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) +- Correction du problème lorsque `pid-file` d’un autre cours d’exécution `clickhouse-server` peut être supprimée. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) +- Correction du rechargement du dictionnaire s’il a `invalidate_query`, qui a arrêté les mises à jour et une exception sur les tentatives de mise à jour précédentes. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alésapine](https://github.com/alesapin)) +- Correction d’une erreur dans la fonction `arrayReduce` qui peut conduire à “double free” et erreur dans le combinateur de fonction d’agrégat `Resample` que peut provoquer la fuite de mémoire. Fonction agrégée ajoutée `aggThrow`. Cette fonction peut être utilisée à des fins de test. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Amélioration {#improvement-1} + +- Amélioration de la journalisation lorsque vous travaillez avec `S3` tableau moteur. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Imprimé message d’aide quand aucun argument n’est passé lors de l’appel `clickhouse-local`. Cela corrige [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) +- Ajouter un paramètre `mutations_sync` ce qui permet d’attendre `ALTER UPDATE/DELETE` les requêtes de manière synchrone. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alésapine](https://github.com/alesapin)) +- Autoriser à configurer relative `user_files_path` dans `config.xml` (de la manière similaire à `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) +- Ajouter une exception pour les types illégaux pour les fonctions de conversion avec `-OrZero` postfix. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Simplifier le format de l’en-tête de l’envoi des données à un serveur dans une requête distribuée. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) +- `Live View` refactoring du moteur de table. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) +- Ajoutez des vérifications supplémentaires pour les dictionnaires externes créés à partir de requêtes DDL. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alésapine](https://github.com/alesapin)) +- Correction d’erreur `Column ... already exists` lors de l’utilisation `FINAL` et `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Fixer [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Table maintenant le premier argument de `joinGet` la fonction peut être tableau identifiant. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos Oiseau](https://github.com/amosbird)) +- Autoriser l’utilisation des `MaterializedView` avec les sous-requêtes ci-dessus `Kafka` table. [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) +- Maintenant, l’arrière-plan se déplace entre les disques, exécutez le pool de threads seprate. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) +- `SYSTEM RELOAD DICTIONARY` s’exécute maintenant de manière synchrone. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) +- Les traces de pile affichent désormais des adresses physiques (décalages dans le fichier objet) au lieu des adresses de mémoire virtuelle (où le fichier objet a été chargé). Qui permet l’utilisation de `addr2line` lorsque binaire est indépendant de la position et ASLR est actif. Cela corrige [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Appuyer une nouvelle syntaxe pour la sécurité de niveau ligne filtres: `
`. Fixer [\#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [\#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([Ivan](https://github.com/abyss7)) +- Maintenant `cityHash` fonction peut travailler avec `Decimal` et `UUID` type. Fixer [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) +- Suppression de la granularité à index fixe (c’était 1024) des journaux système car elle est obsolète après l’implémentation de la granularité adaptative. [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Serveur de compatibilité MySQL activé lorsque ClickHouse est compilé sans SSL. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) +- Maintenant, les sommes de contrôle du serveur ont distribué des lots, ce qui donne des erreurs plus verbeuses en cas de données corrompues dans le lot. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) +- Soutien `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` et `ATTACH TABLE` pour `MySQL` moteur de base de données. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([L’Hiver Zhang](https://github.com/zhang2014)) +- Ajouter l’authentification dans la fonction de table S3 et le moteur de table. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Ajout de vérifier les pièces supplémentaires de `MergeTree` sur différents disques, afin de ne pas permettre de manquer des parties de données sur des disques indéfinis. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Activez la prise en charge SSL pour le client et le serveur Mac. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([Ivan](https://github.com/abyss7)) +- Maintenant, ClickHouse peut fonctionner en tant que serveur fédéré MySQL (voir https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- `clickhouse-client` maintenant seulement activer `bracketed-paste` lorsque multiquery est activé et multiline est désactivé. Cette correction (\#7757)\[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos Oiseau](https://github.com/amosbird)) +- Soutien `Array(Decimal)` dans `if` fonction. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) +- Soutien Décimales `arrayDifference`, `arrayCumSum` et `arrayCumSumNegative` fonction. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) +- Ajouter `lifetime` colonne de `system.dictionaries` table. [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) +- Vérification améliorée des pièces existantes sur différents disques pour `*MergeTree` table des moteurs. Adresse [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) +- L’intégration avec `AWS SDK` pour `S3` interactions qui permet d’utiliser toutes les fonctionnalités S3 hors de la boîte. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) +- Ajout du support pour les sous-requêtes dans `Live View` table. [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) +- Vérifier à l’aide de `Date` ou `DateTime` colonne de `TTL` des expressions a été supprimé. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Informations sur le disque ajouté `system.detached_parts` table. [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Maintenant paramètres `max_(table|partition)_size_to_drop` peut être modifié sans redémarrage de l’ordinateur. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Facilité d’utilisation légèrement meilleure des messages d’erreur. Demander à l’utilisateur de ne pas supprimer les lignes ci-dessous `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mieux lire les messages de `Kafka` moteur dans différents formats après [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([Ivan](https://github.com/abyss7)) +- Meilleure compatibilité avec les clients MySQL qui ne prennent pas en charge `sha2_password` greffon auth. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) +- Supporte plus de types de colonnes dans le serveur de compatibilité MySQL. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) +- Mettre `ORDER BY` optimisation pour les `Merge`, `Buffer` et `Materilized View` stockages avec sous-jacent `MergeTree` table. [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) +- Maintenant, nous utilisons toujours L’implémentation POSIX de `getrandom` pour avoir une meilleure compatibilité avec les anciens noyaux (\< 3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos Oiseau](https://github.com/amosbird)) +- Mieux vaut vérifier la destination valide dans une règle de déplacement TTL. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Mieux vérifie cassé insérer des lots pour `Distributed` tableau moteur. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) +- Ajouter une colonne avec un tableau de nom de pièces que les mutations doivent traiter à l’avenir `system.mutations` table. [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alésapine](https://github.com/alesapin)) +- Optimisation de tri de fusion parallèle pour les processeurs. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Paramètre `mark_cache_min_lifetime` est maintenant obsolète et ne fait rien. Dans les versions précédentes, mark cache peut croître en mémoire supérieure à `mark_cache_size` pour accommoder les données dans `mark_cache_min_lifetime` deuxième. Cela conduisait à la confusion et à une utilisation de la mémoire plus élevée que prévu, ce qui est particulièrement mauvais sur les systèmes à contraintes de mémoire. Si vous constatez une dégradation des performances après l’installation de cette version, vous devez `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Préparation à utiliser `tid` partout. Cela est nécessaire pour [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +#### Amélioration Des Performances {#performance-improvement-1} + +- Optimisations des performances dans le pipeline de processeurs. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Mises à jour non bloquantes des clés expirées dans les dictionnaires de cache (avec autorisation de lire les anciennes). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Compiler ClickHouse sans `-fno-omit-frame-pointer` globalement pour épargner un registre de plus. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos Oiseau](https://github.com/amosbird)) +- SpeedUp `greatCircleDistance` fonction et ajouter des tests de performance pour elle. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) +- Amélioration des performances de la fonction `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Amélioration des performances de `max`, `min`, `argMin`, `argMax` pour `DateTime64` type de données. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) +- Amélioration des performances de tri sans limite ou avec une grande limite et le tri externe. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Amélioration des performances du formatage des nombres à virgule flottante jusqu’à 6 fois. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Amélioration des performances de `modulo` fonction. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos Oiseau](https://github.com/amosbird)) +- Optimisé `ORDER BY` et la fusion avec une seule clé de colonne. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Meilleure mise en œuvre pour `arrayReduce`, `-Array` et `-State` combinators. [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos Oiseau](https://github.com/amosbird)) +- Maintenant `PREWHERE` doit être optimisé pour être au moins aussi efficace que l’ `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos Oiseau](https://github.com/amosbird)) +- Améliorer la façon dont `round` et `roundBankers` manipulation des nombres négatifs. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) +- Amélioration des performances de décodage `DoubleDelta` et `Gorilla` les codecs par environ de 30 à 40%. Cela corrige [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) +- Amélioration des performances de `base64` les fonctions connexes. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajout d’une fonction `geoDistance`. Il est similaire à `greatCircleDistance` mais utilise l’approximation au modèle ellipsoïde WGS-84. Les performances des deux fonctions sont presque les mêmes. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Plus rapide `min` et `max` fonctions d’agrégation pour les `Decimal` type de données. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) +- Vectoriser le traitement `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Oiseau](https://github.com/amosbird)) +- `if` les chaînes sont maintenant optimisés `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) +- Correction de la régression des performances de `Kafka` moteur de table introduit en 19.15. Cela corrige [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) +- Retiré “pie” génération de code qui `gcc` de paquets Debian apporte parfois par défaut. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Formats de données d’analyse parallèle [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Activer l’analyseur optimisé de `Values` avec des expressions par défaut (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) + +#### Construction / Test / Amélioration De L’Emballage {#buildtestingpackaging-improvement-2} + +- Construire des correctifs pour `ARM` et en un minimum de mode. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) +- Ajouter le fichier de couverture flush pour `clickhouse-server` lorsque std::atexit n’est pas appelé. Également légèrement amélioré la journalisation dans les tests sans état avec la couverture. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alésapine](https://github.com/alesapin)) +- Mettre à jour la bibliothèque LLVM dans contrib. Évitez D’utiliser LLVM à partir de paquets OS. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Faire empaqueté `curl` construire entièrement calme. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) +- Correction de quelques `MemorySanitizer` avertissement. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Utiliser `add_warning` et `no_warning` les macros dans `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([Ivan](https://github.com/abyss7)) +- Ajout du support de l’objet compatible Minio S3 (https://min.io/) pour de meilleurs tests d’intégration. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) +- Importer `libc` en-têtes à contrib. Il permet de rendre les builds plus cohérents sur différents systèmes (uniquement pour `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer `-fPIC` à partir de certaines bibliothèques. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Propre `CMakeLists.txt` pour le roulage. Tu vois https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Avertissements silencieux dans `CapNProto` bibliothèque. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Ajouter des tests de performance pour les tables de hachage optimisées par chaîne courte. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos Oiseau](https://github.com/amosbird)) +- Maintenant ClickHouse va construire sur `AArch64` même si `MADV_FREE` n’est pas disponible. Cela corrige [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos Oiseau](https://github.com/amosbird)) +- Mettre `zlib-ng` pour résoudre les problèmes de désinfectant de mémoire. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Activez la bibliothèque MySQL interne sur un système non Linux, car l’utilisation des paquets du système D’exploitation est très fragile et ne fonctionne généralement pas du tout. Cela corrige [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la construction sur certains systèmes après activation `libc++`. Cela annule et remplace [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Faire `Field` méthodes plus de type-sûr pour trouver plus d’erreurs. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Ajout de fichiers manquants à la `libc-headers` sous-module. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Corrigé de mal `JSON` citation dans la sortie de test de performance. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Maintenant, la trace de pile est affichée pour `std::exception` et `Poco::Exception`. Dans les versions précédentes, il était disponible uniquement pour `DB::Exception`. Cela améliore le diagnostic. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Le portage `clock_gettime` et `clock_nanosleep` pour les nouvelles versions glibc. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos Oiseau](https://github.com/amosbird)) +- Permettre `part_log` dans l’exemple config pour les développeurs. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la nature asynchrone du rechargement dans `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) +- Tests de performance codec fixe. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) +- Ajouter des scripts d’installation pour `.tgz` construire et documentation pour eux. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alésapine](https://github.com/alesapin)) +- Supprimé Vieux `ZSTD` test (il a été créé en 2016 pour reproduire le bug que la version pré 1.0 de ZSTD a eu). Cela corrige [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction de la construction sur Mac OS Catalina. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) +- Augmentation du nombre de lignes dans les tests de performance du codec pour rendre les résultats visibles. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) +- Dans les versions debug, traiter `LOGICAL_ERROR` exceptions comme Échecs d’assertion, de sorte qu’ils sont plus faciles à remarquer. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Rendre le test de performance lié aux formats plus déterministe. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre `lz4` pour corriger un échec MemorySanitizer. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Supprimer un faux positif MemorySanitizer connu dans la gestion des exceptions. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Mettre `gcc` et `g++` à la version 9 dans `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) +- Ajoutez un cas de test de performance pour tester cela `PREWHERE` est pire que `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos Oiseau](https://github.com/amosbird)) +- Progrès vers la fixation d’un test flacky. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Évitez le rapport MemorySanitizer pour les données de `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Mettre `libc++` la dernière version. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Construire la bibliothèque ICU à partir de sources. Cela corrige [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Commutation de `libressl` de `openssl`. ClickHouse devrait prendre en charge TLS 1.3 et SNI après ce changement. Cela corrige [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Rapport UBSan fixe lors de l’utilisation `chacha20_poly1305` de SSL (se produit sur la connexion à https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Correction du mode de fichier de mot de passe par défaut pour `.deb` des distributions linux. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) +- Expression améliorée pour obtenir `clickhouse-server` PID dans `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) +- Mise à jour contrib / googletest à v1. 10. 0. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Rapport ThreadSaninitizer fixe dans `base64` bibliothèque. Aussi mis à jour cette bibliothèque à la dernière version, mais cela n’a pas d’importance. Cela corrige [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Fixer `00600_replace_running_query` pour les transformateurs. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Supprimer le support pour `tcmalloc` faire `CMakeLists.txt` plus simple. [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Libérer gcc construit maintenant utiliser `libc++` plutôt `libstdc++`. Récemment `libc++` a été utilisé uniquement avec clang. Cela améliorera la cohérence des configurations de construction et la portabilité. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Activer la bibliothèque ICU pour construire avec MemorySanitizer. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Supprimer les avertissements de `CapNProto` bibliothèque. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Suppression de cas spéciaux de code pour `tcmalloc` parce que c’est plus pris en charge. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Dans la tâche de couverture CI, tuez le serveur gracieusement pour lui permettre d’enregistrer le rapport de couverture. Cela corrige les rapports de couverture incomplets que nous avons vus récemment. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alésapine](https://github.com/alesapin)) +- Tests de Performance pour tous les codecs contre `Float64` et `UInt64` valeur. [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) +- `termcap` est très obsolète et conduit à divers problèmes (F. G. manquant “up” cap et en écho `^J` au lieu de multi-ligne) . Faveur `terminfo` ou groupés `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos Oiseau](https://github.com/amosbird)) +- Fixer `test_storage_s3` test d’intégration. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Soutien `StorageFile(, null)` pour insérer un bloc dans un fichier de format donné sans écrire sur le disque. Ceci est requis pour les tests de performance. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos Oiseau](https://github.com/amosbird)) +- Argument supplémentaire en `--print-time` aux tests fonctionnels qui imprime le temps d’exécution par test. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ajouté assertions à `KeyCondition` lors de L’évaluation RPN. Cela corrigera l’avertissement de gcc-9. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Vider les options cmake dans les builds CI. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Ne générez pas d’informations de débogage pour certaines bibliothèques fat. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Faire `log_to_console.xml` connectez-vous toujours à stderr, que ce soit interactif ou non. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Suppression de certaines fonctionnalités inutilisées de `clickhouse-performance-test` outil. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Maintenant, nous allons également rechercher `lld-X` avec correspondant `clang-X` version. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alésapine](https://github.com/alesapin)) +- Amélioration de construction de Parquet. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([maxulan](https://github.com/maxulan)) +- Plus D’Avertissements GCC [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Package pour Arch Linux permet maintenant d’exécuter le serveur ClickHouse, et pas seulement le client. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixer le test avec les processeurs. Corrections de performances minuscules. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Mise à jour contrib/protobuf. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) +- En préparation du passage à c++20 comme une célébration du Nouvel An. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos Oiseau](https://github.com/amosbird)) + +#### Caractéristique Expérimentale {#experimental-feature-1} + +- Ajouté cadre expérimental `min_bytes_to_use_mmap_io`. Il permet de lire de gros fichiers sans copier les données du noyau vers l’espace utilisateur. Le paramètre est désactivé par défaut. Le seuil recommandé est d’environ 64 Mo, car mmap / munmap est lent. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexeï-milovidov](https://github.com/alexey-milovidov)) +- Quotas retravaillés dans le cadre du système de contrôle d’accès. Ajouté nouveau tableau `system.quotas` de nouvelles fonctions `currentQuota`, `currentQuotaKey`, nouvelle syntaxe SQL `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) +- Autoriser à sauter des paramètres inconnus avec des avertissements au lieu de lancer des exceptions. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) +- Stratégies de ligne retravaillées dans le cadre du système de contrôle d’accès. Ajouté nouveau tableau `system.row_policies`, nouvelle fonction `currentRowPolicies()`, nouvelle syntaxe SQL `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Correction De Sécurité {#security-fix} + +- Correction de la possibilité de lire la structure des répertoires dans les tables avec `File` tableau moteur. Cela corrige [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexeï-milovidov](https://github.com/alexey-milovidov)) + +## [Changelog pour 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/fr/whats_new/index.md b/docs/fr/whats-new/index.md similarity index 100% rename from docs/fr/whats_new/index.md rename to docs/fr/whats-new/index.md diff --git a/docs/fr/whats-new/roadmap.md b/docs/fr/whats-new/roadmap.md new file mode 100644 index 00000000000..87ee98be5ea --- /dev/null +++ b/docs/fr/whats-new/roadmap.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 74 +toc_title: Feuille de route +--- + +# Feuille De Route {#roadmap} + +## Q1 2020 {#q1-2020} + +- Contrôle d’accès par rôle + +## Q2 2020 {#q2-2020} + +- Intégration avec les services d’authentification externes +- Pools de ressources pour une répartition plus précise de la capacité du cluster entre les utilisateurs + +{## [Article Original](https://clickhouse.tech/docs/en/roadmap/) ##} diff --git a/docs/fr/whats-new/security-changelog.md b/docs/fr/whats-new/security-changelog.md new file mode 100644 index 00000000000..07bce67aa2f --- /dev/null +++ b/docs/fr/whats-new/security-changelog.md @@ -0,0 +1,76 @@ +--- +machine_translated: true +machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 +toc_priority: 76 +toc_title: "S\xE9curit\xE9 Changelog" +--- + +## Correction Dans La Version 19.14.3.3 De ClickHouse, 2019-09-10 {#fixed-in-clickhouse-release-19-14-3-3-2019-09-10} + +### CVE-2019-15024 {#cve-2019-15024} + +Аn attacker that has write access to ZooKeeper and who ican run a custom server available from the network where ClickHouse runs, can create a custom-built malicious server that will act as a ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from the malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. + +Crédits: Eldar Zaitov de L’équipe de sécurité de L’Information Yandex + +### CVE-2019-16535 {#cve-2019-16535} + +Аn OOB read, OOB write and integer underflow in decompression algorithms can be used to achieve RCE or DoS via native protocol. + +Crédits: Eldar Zaitov de L’équipe de sécurité de L’Information Yandex + +### CVE-2019-16536 {#cve-2019-16536} + +Le débordement de pile menant à DoS peut être déclenché par un client authentifié malveillant. + +Crédits: Eldar Zaitov de L’équipe de sécurité de L’Information Yandex + +## Correction De La Version 19.13.6.1 De ClickHouse, 2019-09-20 {#fixed-in-clickhouse-release-19-13-6-1-2019-09-20} + +### CVE-2019-18657 {#cve-2019-18657} + +Fonction de Table `url` la vulnérabilité avait-elle permis à l’attaquant d’injecter des en-têtes HTTP arbitraires dans la requête. + +Crédit: [Nikita Tikhomirov](https://github.com/NSTikhomirov) + +## Correction Dans La Version ClickHouse 18.12.13, 2018-09-10 {#fixed-in-clickhouse-release-18-12-13-2018-09-10} + +### CVE-2018-14672 {#cve-2018-14672} + +Les fonctions de chargement des modèles CatBoost permettaient de parcourir les chemins et de lire des fichiers arbitraires via des messages d’erreur. + +Crédits: Andrey Krasichkov de L’équipe de sécurité de L’Information Yandex + +## Correction Dans La Version 18.10.3 De ClickHouse, 2018-08-13 {#fixed-in-clickhouse-release-18-10-3-2018-08-13} + +### CVE-2018-14671 {#cve-2018-14671} + +unixODBC a permis de charger des objets partagés arbitraires à partir du système de fichiers, ce qui a conduit à une vulnérabilité D’exécution de Code À Distance. + +Crédits: Andrey Krasichkov et Evgeny Sidorov de Yandex Information Security Team + +## Correction Dans La Version 1.1.54388 De ClickHouse, 2018-06-28 {#fixed-in-clickhouse-release-1-1-54388-2018-06-28} + +### CVE-2018-14668 {#cve-2018-14668} + +“remote” la fonction de table a permis des symboles arbitraires dans “user”, “password” et “default\_database” champs qui ont conduit à des attaques de falsification de requêtes inter-protocoles. + +Crédits: Andrey Krasichkov de L’équipe de sécurité de L’Information Yandex + +## Correction Dans La Version 1.1.54390 De ClickHouse, 2018-07-06 {#fixed-in-clickhouse-release-1-1-54390-2018-07-06} + +### CVE-2018-14669 {#cve-2018-14669} + +Clickhouse client MySQL avait “LOAD DATA LOCAL INFILE” fonctionnalité activée permettant à une base de données MySQL malveillante de lire des fichiers arbitraires à partir du serveur clickhouse connecté. + +Crédits: Andrey Krasichkov et Evgeny Sidorov de Yandex Information Security Team + +## Correction Dans La Version 1.1.54131 De ClickHouse, 2017-01-10 {#fixed-in-clickhouse-release-1-1-54131-2017-01-10} + +### CVE-2018-14670 {#cve-2018-14670} + +Configuration incorrecte dans le paquet deb pourrait conduire à l’utilisation non autorisée de la base de données. + +Crédits: National Cyber Security Centre (NCSC) + +{## [Article Original](https://clickhouse.tech/docs/en/security_changelog/) ##} diff --git a/docs/fr/whats_new/changelog/2017.md b/docs/fr/whats_new/changelog/2017.md deleted file mode 100644 index aaf9b52f749..00000000000 --- a/docs/fr/whats_new/changelog/2017.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 79 -toc_title: '2017' ---- - -### Clickhouse version 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} - -Cette version contient des corrections de bugs pour la version précédente 1.1.54318: - -- Correction d'un bug avec condition de concurrence possible dans la réplication qui pourrait conduire à la perte de données. Ce problème affecte les versions 1.1.54310 et 1.1.54318. Si vous utilisez l'une de ces versions avec des tables répliquées, la mise à jour est fortement recommandée. Ce problème apparaît dans les journaux dans les messages d'avertissement comme `Part ... from own log doesn't exist.` Le problème est pertinent même si vous ne voyez pas ces messages dans les journaux. - -### Clickhouse version 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} - -Cette version contient des corrections de bugs pour la version précédente 1.1.54310: - -- Correction de suppressions de ligne incorrectes lors des fusions dans le moteur SummingMergeTree -- Correction d'une fuite de mémoire dans les moteurs mergetree non compliqués -- Correction de la dégradation des performances avec des inserts fréquents dans les moteurs MergeTree -- Correction d'un problème qui causait la file d'attente de réplication pour arrêter l'exécution -- Rotation fixe et archivage des journaux du serveur - -### Clickhouse version 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} - -#### Nouveauté: {#new-features} - -- Clé de partitionnement personnalisée pour la famille MergeTree des moteurs de table. -- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) tableau moteur. -- Ajout du support pour le chargement [CatBoost](https://catboost.yandex/) modèles et les appliquer aux données stockées dans ClickHouse. -- Ajout du support pour les fuseaux horaires avec des décalages non entiers de UTC. -- Ajout du support pour les opérations arithmétiques avec des intervalles de temps. -- La plage de valeurs pour les types Date et DateTime est étendue à l'année 2105. -- Ajouté le `CREATE MATERIALIZED VIEW x TO y` requête (spécifie une table pour stocker les données d'une vue matérialisée). -- Ajouté le `ATTACH TABLE` requête sans arguments. -- La logique de traitement des colonnes imbriquées avec des noms se terminant par-Map dans une table SummingMergeTree a été extraite dans la fonction d'agrégat sumMap. Vous pouvez maintenant spécifier ces colonnes explicitement. -- La taille maximale du dictionnaire IP trie est augmentée à 128M entrées. -- Ajout de la fonction getSizeOfEnumType. -- Ajout de la fonction d'agrégat sumWithOverflow. -- Ajout du support pour le format D'entrée Cap'n Proto. -- Vous pouvez maintenant personnaliser le niveau de compression lors de l'utilisation de l'algorithme zstd. - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes} - -- Création de tables temporaires avec un moteur autre que la Mémoire n'est pas autorisé. -- La création explicite de tables avec le moteur View ou MaterializedView n'est pas autorisée. -- Lors de la création de la table, une nouvelle vérification vérifie que l'expression de clé d'échantillonnage est incluse dans la clé primaire. - -#### Corrections de bugs: {#bug-fixes} - -- Correction des accrochages lors de l'insertion synchrone dans une table distribuée. -- Ajout et retrait non atomiques fixes de pièces dans des tables répliquées. -- Les données insérées dans une vue matérialisée ne sont pas soumises à une déduplication inutile. -- L'exécution d'une requête vers une table distribuée pour laquelle le réplica local est en retard et les réplicas distants ne sont pas disponibles n'entraîne plus d'erreur. -- Les utilisateurs n'ont pas besoin d'autorisations d'accès au `default` base de données pour créer des tables temporaires plus. -- Correction d'un plantage lors de la spécification du type de tableau sans arguments. -- Correction des interruptions lorsque le volume du disque contenant les journaux du serveur est plein. -- Correction d'un débordement dans la fonction toRelativeWeekNum pour la première semaine de L'époque Unix. - -#### Construire des améliorations: {#build-improvements} - -- Plusieurs bibliothèques tierces (notamment Poco) ont été mises à jour et converties en sous-modules git. - -### Clickhouse version 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} - -#### Nouveauté: {#new-features-1} - -- Prise en charge TLS dans le protocole natif (pour activer, définir `tcp_ssl_port` dans `config.xml` ). - -#### Corrections de bugs: {#bug-fixes-1} - -- `ALTER` pour les tables répliquées essaie maintenant de commencer à s'exécuter dès que possible. -- Fixe plante lors de la lecture des données avec le paramètre `preferred_block_size_bytes=0.` -- Plantages fixes de `clickhouse-client` lorsque vous appuyez sur `Page Down` -- L'interprétation correcte de certaines requêtes complexes avec `GLOBAL IN` et `UNION ALL` -- `FREEZE PARTITION` fonctionne toujours atomiquement maintenant. -- Les requêtes POST vides renvoient maintenant une réponse avec le code 411. -- Correction d'erreurs d'interprétation pour des expressions comme `CAST(1 AS Nullable(UInt8)).` -- Correction d'une erreur lors de la lecture `Array(Nullable(String))` les colonnes de `MergeTree` table. -- Fixe s'écraser lors de l'analyse des requêtes comme `SELECT dummy AS dummy, dummy AS b` -- Les utilisateurs sont mis à jour correctement avec invalide `users.xml` -- Manipulation correcte lorsqu'un dictionnaire exécutable renvoie un code de réponse différent de zéro. - -### Clickhouse version 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} - -#### Nouveauté: {#new-features-2} - -- Ajouté le `pointInPolygon` fonction pour travailler avec des coordonnées sur un plan de coordonnées. -- Ajouté le `sumMap` fonction d'agrégation pour calculer la somme des tableaux, similaire à `SummingMergeTree`. -- Ajouté le `trunc` fonction. Amélioration des performances des fonctions d'arrondi (`round`, `floor`, `ceil`, `roundToExp2`) et corrigé la logique de la façon dont ils fonctionnent. Changé la logique de la `roundToExp2` fonction pour les fractions et les nombres négatifs. -- Le fichier exécutable ClickHouse dépend maintenant moins de la version libc. Le même fichier exécutable ClickHouse peut fonctionner sur une grande variété de systèmes Linux. Il existe toujours une dépendance lors de l'utilisation de requêtes compilées (avec le paramètre `compile = 1` qui n'est pas utilisé par défaut). -- Réduit le temps nécessaire à la compilation dynamique des requêtes. - -#### Corrections de bugs: {#bug-fixes-2} - -- Correction d'une erreur qui produisait parfois `part ... intersects previous part` messages et cohérence des répliques affaiblies. -- Correction d'une erreur qui a provoqué le verrouillage du serveur si ZooKeeper n'était pas disponible pendant l'arrêt. -- Suppression de la journalisation excessive lors de la restauration des répliques. -- Correction d'une erreur dans L'Union toute la mise en œuvre. -- Correction d'une erreur dans la fonction concat qui s'est produite si la première colonne d'un bloc a le type de tableau. -- La progression est maintenant affichée correctement dans le système.fusionne table. - -### Clickhouse version 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} - -#### Nouveauté: {#new-features-3} - -- `SYSTEM` les requêtes pour l'administration du serveur: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. -- Ajout de fonctions pour travailler avec des tableaux: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. -- Ajouter `root` et `identity` paramètres pour la configuration de ZooKeeper. Cela vous permet d'isoler des utilisateurs individuels sur le même cluster ZooKeeper. -- Fonctions d'agrégation ajoutées `groupBitAnd`, `groupBitOr`, et `groupBitXor` (pour la compatibilité, ils sont également disponibles sous les noms de `BIT_AND`, `BIT_OR`, et `BIT_XOR`). -- Les dictionnaires externes peuvent être chargés à partir de MySQL en spécifiant un socket dans le système de fichiers. -- Les dictionnaires externes peuvent être chargés à partir de MySQL sur SSL (`ssl_cert`, `ssl_key`, `ssl_ca` paramètre). -- Ajouté le `max_network_bandwidth_for_user` paramètre pour limiter l'utilisation globale de la bande passante pour les requêtes par utilisateur. -- Soutien pour `DROP TABLE` pour les tables temporaires. -- Support pour la lecture `DateTime` valeurs au format d'horodatage Unix de `CSV` et `JSONEachRow` format. -- Les répliques en retard dans les requêtes distribuées sont maintenant exclues par défaut (le seuil par défaut est de 5 minutes). -- Le verrouillage FIFO est utilisé pendant ALTER: une requête ALTER n'est pas bloquée indéfiniment pour les requêtes en cours d'exécution en continu. -- Option à définir `umask` dans le fichier de configuration. -- Amélioration des performances pour les requêtes avec `DISTINCT` . - -#### Corrections de bugs: {#bug-fixes-3} - -- Amélioration du processus de suppression des anciens nœuds dans ZooKeeper. Auparavant, les anciens nœuds n'étaient parfois pas supprimés s'il y avait des insertions très fréquentes, ce qui faisait que le serveur était lent à s'arrêter, entre autres choses. -- Correction de la randomisation lors du choix des hôtes pour la connexion à ZooKeeper. -- Correction de l'exclusion des répliques en retard dans les requêtes distribuées si la réplique est localhost. -- Correction d'une erreur où une partie des données dans un `ReplicatedMergeTree` table pourrait être cassé après l'exécution `ALTER MODIFY` sur un élément dans un `Nested` structure. -- Correction d'une erreur qui pourrait provoquer des requêtes SELECT “hang”. -- Améliorations apportées aux requêtes DDL distribuées. -- Correction de la requête `CREATE TABLE ... AS `. -- Résolu à l'impasse dans l' `ALTER ... CLEAR COLUMN IN PARTITION` requête pour `Buffer` table. -- Correction de la valeur par défaut invalide pour `Enum` s (0 au lieu du minimum) lors de l'utilisation du `JSONEachRow` et `TSKV` format. -- Résolu l'apparition de processus zombies lors de l'utilisation d'un dictionnaire avec un `executable` source. -- Correction de segfault pour la requête HEAD. - -#### Workflow amélioré pour développer et assembler ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse} - -- Vous pouvez utiliser `pbuilder` pour construire ClickHouse. -- Vous pouvez utiliser `libc++` plutôt `libstdc++` pour construit sur Linux. -- Ajout d'instructions pour l'utilisation d'outils d'analyse de code statique: `Coverage`, `clang-tidy`, `cppcheck`. - -#### Veuillez noter lors de la mise à niveau: {#please-note-when-upgrading} - -- Il y a maintenant une valeur par défaut plus élevée pour le paramètre MergeTree `max_bytes_to_merge_at_max_space_in_pool` (la taille totale maximale des parties de données à fusionner, en octets): elle est passée de 100 GiB à 150 GiB. Cela peut entraîner de grandes fusions s'exécutant après la mise à niveau du serveur, ce qui pourrait entraîner une charge accrue sur le sous-système de disque. Si l'espace libre disponible sur le serveur est inférieur au double de la quantité totale des fusions en cours d'exécution, toutes les autres fusions s'arrêteront, y compris les fusions de petites parties de données. Par conséquent, les requêtes D'insertion échoueront avec le message “Merges are processing significantly slower than inserts.” L'utilisation de la `SELECT * FROM system.merges` requête pour surveiller la situation. Vous pouvez également vérifier le `DiskSpaceReservedForMerge` métrique dans l' `system.metrics` table, ou en Graphite. Vous n'avez rien à faire pour résoudre ce problème, car le problème se résoudra une fois les grandes fusions terminées. Si vous trouvez cela inacceptable, vous pouvez restaurer la valeur précédente pour le `max_bytes_to_merge_at_max_space_in_pool` paramètre. Pour ce faire, allez à l' section dans config.xml, ensemble ``` ``107374182400 ``` et redémarrer le serveur. - -### Clickhouse version 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} - -- C'est une version de correction de la précédente 1.1.54282 libération. Il corrige les fuites dans le répertoire des pièces dans ZooKeeper. - -### Clickhouse version 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} - -Cette version contient des corrections de bugs pour la version précédente 1.1.54276: - -- Fixe `DB::Exception: Assertion violation: !_path.empty()` lors de l'insertion dans une table distribuée. -- Correction de l'analyse lors de l'insertion au format RowBinary si les données d'entrée commencent par';'. -- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). - -### Clickhouse Version 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} - -#### Nouveauté: {#new-features-4} - -- Ajout d'une section facultative avec pour une requête SELECT. Exemple de requête: `WITH 1+1 AS a SELECT a, a*a` -- INSERT peut être effectué de manière synchrone dans une table distribuée: OK n'est retourné qu'une fois toutes les données enregistrées sur tous les fragments. Ceci est activé par le paramètre insert\_distributed\_sync = 1. -- Ajout du type de données UUID pour travailler avec des identifiants de 16 octets. -- Ajout D'alias de CHAR, FLOAT et d'autres types pour la compatibilité avec Tableau. -- Ajout des fonctions toYYYYMM, toYYYYMMDD et toYYYYMMDDhhmmss pour convertir le temps en nombres. -- Vous pouvez utiliser les adresses IP (avec le nom d'hôte) pour identifier les serveurs pour les requêtes DDL en cluster. -- Ajout du support pour les arguments non constants et les décalages négatifs dans la fonction `substring(str, pos, len).` -- Ajout du paramètre max\_size pour `groupArray(max_size)(column)` fonction d'agrégation, et optimisé ses performances. - -#### Les principaux changements: {#main-changes} - -- Améliorations de la sécurité: tous les fichiers du serveur sont créés avec des autorisations 0640 (peuvent être modifiés via paramètre de configuration). -- Amélioration des messages d'erreur pour les requêtes avec une syntaxe invalide. -- Réduction significative de la consommation de mémoire et amélioration des performances lors de la fusion de grandes sections de données MergeTree. -- Augmentation significative des performances des fusions de données pour le Remplacementmergetree engine. -- Amélioration des performances pour les insertions asynchrones à partir d'une table distribuée en combinant plusieurs insertions sources. Pour activer cette fonctionnalité, utilisez le paramètre distributed\_directory\_monitor\_batch\_inserts=1. - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-1} - -- Modification du format binaire des états agrégés de `groupArray(array_column)` fonctions pour les tableaux. - -#### Liste complète des modifications: {#complete-list-of-changes} - -- Ajouté le `output_format_json_quote_denormals` paramètre, qui permet la sortie des valeurs NaN et inf au format JSON. -- Allocation de flux optimisée lors de la lecture à partir d'une table distribuée. -- Les paramètres peuvent être configurés en mode Lecture seule si la valeur ne change pas. -- Ajout de la possibilité de récupérer des granules non entiers du moteur MergeTree afin de respecter les restrictions sur la taille de bloc spécifiée dans le paramètre preferred\_block\_size\_bytes. Le but est de réduire la consommation de RAM et d'augmenter la localisation du cache lors du traitement des requêtes à partir de tables avec de grandes colonnes. -- Utilisation efficace des index qui contiennent des expressions comme `toStartOfHour(x)` pour des conditions comme `toStartOfHour(x) op сonstexpr.` -- Ajout de nouveaux paramètres pour les moteurs MergeTree (la section merge\_tree dans config.XML): - - replicated\_deduplication\_window\_seconds définit le nombre de secondes autorisé pour la déduplication des insertions dans les tables répliquées. - - cleanup\_delay\_period définit la fréquence de démarrage du nettoyage pour supprimer les données obsolètes. - - replicated\_can\_become\_leader peut empêcher une réplique de devenir le leader (et d'affecter des fusions). -- Nettoyage accéléré pour supprimer les données obsolètes de ZooKeeper. -- Plusieurs améliorations et corrections pour les requêtes ddl en cluster. Un intérêt particulier est le nouveau paramètre distributed\_ddl\_task\_timeout, qui limite le temps d'attente d'une réponse des serveurs du cluster. Si une requête ddl n'a pas été effectuée sur tous les hôtes, une réponse contiendra une erreur de délai d'attente et une requête sera exécutée en mode asynchrone. -- Amélioration de l'affichage des traces de pile dans les journaux du serveur. -- Ajouté le “none” valeur pour la méthode de compression. -- Vous pouvez utiliser plusieurs sections dictionaries\_config dans config.XML. -- Il est possible de se connecter à MySQL via un socket dans le système de fichiers. -- Système.table de pièces a une nouvelle colonne avec des informations sur la taille des marques, en octets. - -#### Corrections de bugs: {#bug-fixes-4} - -- Les tables distribuées utilisant une table de fusion fonctionnent maintenant correctement pour une requête SELECT avec une condition sur le `_table` champ. -- Correction d'une condition de course rare dans ReplicatedMergeTree lors de la vérification des pièces de données. -- Fixe le gel sur “leader election” lors du démarrage d'un serveur. -- Le paramètre max\_replica\_delay\_for\_distributed\_queries a été ignoré lors de l'utilisation d'une réplique locale de la source de données. Ce problème a été corrigé. -- Correction d'un comportement incorrect de `ALTER TABLE CLEAR COLUMN IN PARTITION` lorsque vous tentez de nettoyer une colonne non existante. -- Correction d'une exception dans la fonction multiIf lors de l'utilisation de tableaux ou de chaînes vides. -- Correction d'allocations de mémoire excessives lors de la désérialisation du format natif. -- Correction d'une mise à jour automatique incorrecte des dictionnaires Trie. -- Correction d'une exception lors de l'exécution de requêtes avec une clause GROUP BY à partir d'une table de fusion lors de l'utilisation D'un exemple. -- Correction d'un plantage de GROUP BY lors de l'utilisation de distributed\_aggregation\_memory\_efficient=1. -- Vous pouvez maintenant spécifier la base de données.table dans le côté droit de IN et JOIN. -- Trop de threads ont été utilisés pour l'agrégation parallèle. Ce problème a été corrigé. -- Correction de la façon dont le “if” fonction fonctionne avec des arguments FixedString. -- SELECT a mal fonctionné à partir d'une table distribuée pour les fragments avec un poids de 0. Ce problème a été corrigé. -- Exécuter `CREATE VIEW IF EXISTS no longer causes crashes.` -- Correction d'un comportement incorrect lorsque input\_format\_skip\_unknown\_fields = 1 est défini et qu'il existe des nombres négatifs. -- Correction d'une boucle infinie dans le `dictGetHierarchy()` fonction s'il y a des données non valides dans le dictionnaire. -- Fixe `Syntax error: unexpected (...)` erreurs lors de l'exécution de requêtes distribuées avec des sous-requêtes dans une clause IN ou JOIN et des tables de fusion. -- Correction d'une interprétation incorrecte D'une requête SELECT à partir de tables de dictionnaire. -- Correction de l' “Cannot mremap” erreur lors de l'utilisation de tableaux dans In et JOIN clauses avec plus de 2 milliards d'éléments. -- Correction du basculement pour les dictionnaires avec MySQL comme source. - -#### Workflow amélioré pour développer et assembler ClickHouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} - -- Construit peuvent être assemblés en Arcadie. -- Vous pouvez utiliser gcc 7 pour compiler ClickHouse. -- Les builds parallèles utilisant ccache + distcc sont plus rapides maintenant. - -### Clickhouse version 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} - -#### Nouveauté: {#new-features-5} - -- DDL distribué (par exemple, `CREATE TABLE ON CLUSTER`) -- La réplication de la requête `ALTER TABLE CLEAR COLUMN IN PARTITION.` -- Le moteur pour les tables de dictionnaire (accès aux données du dictionnaire sous la forme d'une table). -- Moteur de base de données de dictionnaire (ce type de base de données a automatiquement des tables de dictionnaire disponibles pour tous les dictionnaires externes connectés). -- Vous pouvez vérifier les mises à jour du dictionnaire en envoyant une demande à la source. -- Noms de colonnes qualifiés -- Les identificateurs entre des guillemets doubles. -- Sessions dans L'interface HTTP. -- La requête OPTIMIZE pour une table répliquée peut s'exécuter non seulement sur le leader. - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-2} - -- Supprimé ensemble GLOBAL. - -#### Des modifications mineures: {#minor-changes} - -- Maintenant, après le déclenchement d'une alerte, le journal imprime la trace complète de la pile. -- Détendu la vérification du nombre de pièces de données endommagées/supplémentaires au démarrage (il y avait trop de faux positifs). - -#### Corrections de bugs: {#bug-fixes-5} - -- Correction d'une mauvaise connexion “sticking” lors de l'insertion dans une table distribuée. -- GLOBAL in fonctionne maintenant pour une requête à partir d'une table de fusion qui regarde une table distribuée. -- Le nombre incorrect de cœurs a été détecté sur une machine virtuelle Google Compute Engine. Ce problème a été corrigé. -- Changements dans le fonctionnement d'une source exécutable de dictionnaires externes mis en cache. -- Correction de la comparaison des chaînes contenant des caractères nuls. -- Correction de la comparaison des champs de clé primaire Float32 avec des constantes. -- Auparavant, une estimation incorrecte de la taille d'un champ pouvait entraîner des allocations trop importantes. -- Correction d'un plantage lors de l'interrogation d'une colonne Nullable ajoutée à une table en utilisant ALTER. -- Correction d'un plantage lors du tri par une colonne Nullable, si le nombre de lignes est inférieur à la limite. -- Correction d'une commande par sous-requête composée uniquement de valeurs constantes. -- Auparavant, une table répliquée pouvait rester dans l'état non valide après l'échec d'une table de suppression. -- Les alias des sous-requêtes scalaires avec des résultats vides ne sont plus perdus. -- Maintenant, une requête qui a utilisé la compilation n'échoue pas avec une erreur si le fichier. so est endommagé. diff --git a/docs/fr/whats_new/changelog/2018.md b/docs/fr/whats_new/changelog/2018.md deleted file mode 100644 index 3062f4f1d18..00000000000 --- a/docs/fr/whats_new/changelog/2018.md +++ /dev/null @@ -1,1063 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 78 -toc_title: '2018' ---- - -## Clickhouse version 18.16 {#clickhouse-release-18-16} - -### Clickhouse version 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} - -#### Corrections de bugs: {#bug-fixes} - -- Correction d'une erreur qui a conduit à des problèmes avec la mise à jour des dictionnaires avec la source ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- La compilation JIT des fonctions d'agrégat fonctionne maintenant avec des colonnes LowCardinality. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) - -#### Amélioration: {#improvements} - -- Ajouté le `low_cardinality_allow_in_native_format` paramètre enabled (activé, option par défaut). Lorsqu'elles sont désactivées, les colonnes LowCardinality seront converties en colonnes ordinaires pour les requêtes SELECT et les colonnes ordinaires seront attendues pour les requêtes INSERT. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) - -#### Construire des améliorations: {#build-improvements} - -- Corrections pour les builds sur macOS et ARM. - -### Clickhouse version 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} - -#### Nouveauté: {#new-features} - -- `DEFAULT` les expressions sont évaluées pour les champs manquants lors du chargement de données dans des formats d'entrée semi-structurés (`JSONEachRow`, `TSKV`). La fonction est activée avec le `insert_sample_with_metadata` paramètre. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) -- Le `ALTER TABLE` la requête a maintenant la `MODIFY ORDER BY` action pour changer la clé de tri lors de l'ajout ou de la suppression d'une colonne de table. Ceci est utile pour les tables dans la `MergeTree` famille qui effectuent des tâches supplémentaires lors de la fusion en fonction de cette clé de tri, telles que `SummingMergeTree`, `AggregatingMergeTree` et ainsi de suite. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) -- Pour les tableaux dans le `MergeTree` famille, maintenant vous pouvez spécifier une clé de tri différente (`ORDER BY`) et de l'indice de (`PRIMARY KEY`). La clé de tri peut être plus longue que l'index. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) -- Ajouté le `hdfs` fonction de table et le `HDFS` moteur de table pour l'importation et l'exportation de données vers HDFS. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) -- Ajout de fonctions pour travailler avec base64: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) -- Vous pouvez maintenant utiliser un paramètre pour configurer la précision du `uniqCombined` fonction d'agrégation (sélectionnez le nombre de cellules HyperLogLog). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) -- Ajouté le `system.contributors` table qui contient les noms de tous ceux qui ont fait des commits dans ClickHouse. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) -- Ajout de la possibilité d'omettre la partition de l' `ALTER TABLE ... FREEZE` requête en vue de sauvegarder toutes les partitions à la fois. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) -- Ajouter `dictGet` et `dictGetOrDefault` fonctions qui ne nécessitent pas de spécifier le type de valeur de retour. Le type est déterminé automatiquement à partir de la description du dictionnaire. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3564) -- Vous pouvez maintenant spécifier des commentaires pour une colonne dans la description de la table et la modifier en utilisant `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) -- La lecture est prise en charge pour `Join` tapez des tables avec des touches simples. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Vous pouvez maintenant spécifier les options `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, et `join_overflow_mode` lors de la création d'un `Join` type de table. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Ajouté le `joinGet` fonction qui permet d'utiliser un `Join` tapez table comme un dictionnaire. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Ajouté le `partition_key`, `sorting_key`, `primary_key`, et `sampling_key` les colonnes de la `system.tables` table afin de fournir des informations sur les clés de table. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Ajouté le `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, et `is_in_sampling_key` les colonnes de la `system.columns` table. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Ajouté le `min_time` et `max_time` les colonnes de la `system.parts` table. Ces colonnes sont remplies lorsque la clé de partitionnement est une expression composée de `DateTime` colonne. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) - -#### Corrections de bugs: {#bug-fixes-1} - -- Corrections et améliorations des performances pour `LowCardinality` type de données. `GROUP BY` utiliser `LowCardinality(Nullable(...))`. Obtenir les valeurs de `extremes`. Traitement des fonctions d'ordre Élevé. `LEFT ARRAY JOIN`. Distribué `GROUP BY`. Fonctions qui renvoient `Array`. L'exécution de `ORDER BY`. Écrit à `Distributed` tableaux (nicelulu). Rétrocompatibilité pour `INSERT` requêtes provenant d'anciens clients qui implémentent `Native` protocole. Soutien pour `LowCardinality` pour `JOIN`. Amélioration des performances lorsque vous travaillez dans un flux unique. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) -- Correction de la façon dont le `select_sequential_consistency` l'option fonctionne. Auparavant, lorsque ce paramètre était activé, un résultat incomplet était parfois renvoyé après avoir commencé à écrire sur une nouvelle partition. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) -- Les bases de données sont correctement spécifiées lors de L'exécution de DDL `ON CLUSTER` les requêtes et `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Les bases de données sont correctement spécifiées pour les sous-requêtes à l'intérieur d'une vue. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Correction d'un bug dans `PREWHERE` avec `FINAL` pour `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) -- Maintenant, vous pouvez utiliser `KILL QUERY` pour annuler les requêtes qui n'ont pas encore démarré car elles attendent que la table soit verrouillée. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) -- Correction des calculs de date et d'heure si les horloges ont été déplacées à minuit (cela se produit en Iran, et est arrivé à Moscou de 1981 à 1983). Auparavant, cela a conduit à la réinitialisation de l'heure un jour plus tôt que nécessaire, et a également provoqué un formatage incorrect de la date et de l'heure au format texte. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) -- Correction de bugs dans certains cas, de `VIEW` et les sous-requêtes qui omettent la base de données. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Correction d'une condition de course lors de la lecture simultanée d'un `MATERIALIZED VIEW` et la suppression d'un `MATERIALIZED VIEW` en raison de ne pas verrouiller l'interne `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) -- Correction de l'erreur `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) -- Correction du traitement des requêtes lorsque le `compile_expressions` option est activée (elle est activée par défaut). Expressions constantes non déterministes comme le `now` fonction ne sont plus déplié. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) -- Correction d'un plantage lors de la spécification d'un argument d'échelle non constant dans `toDecimal32/64/128` fonction. -- Correction d'une erreur lors de l'insertion d'un tableau avec `NULL` éléments dans le `Values` formater dans une colonne de type `Array` sans `Nullable` (si `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) -- Fixe continue de journalisation des erreurs dans `DDLWorker` si la Gardienne n'est pas disponible. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) -- Correction du type de retour pour `quantile*` les fonctions de `Date` et `DateTime` les types d'arguments. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) -- Correction de l' `WITH` clause si elle spécifie un alias simple sans expressions. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) -- Correction du traitement des requêtes avec des sous-requêtes nommées et des noms de colonnes qualifiés lorsque `enable_optimize_predicate_expression` est activé. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) -- Correction de l'erreur `Attempt to attach to nullptr thread group` lorsque vous travaillez avec des vues matérialisées. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) -- Correction d'un plantage lors du passage de certains arguments incorrects `arrayReverse` fonction. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- Correction du débordement de tampon dans le `extractURLParameter` fonction. Amélioration de la performance. Ajout d'un traitement correct des chaînes contenant zéro octet. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) -- Dépassement de tampon fixe dans le `lowerUTF8` et `upperUTF8` fonction. Retiré la possibilité d'exécuter ces fonctions sur `FixedString` tapez les arguments. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) -- Correction d'une condition de course rare lors de la suppression `MergeTree` table. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) -- Correction d'une condition de course lors de la lecture de `Buffer` tables et effectuer simultanément `ALTER` ou `DROP` sur les tables cibles. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) -- Correction d'un segfault si le `max_temporary_non_const_columns` limite a été dépassée. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### Amélioration: {#improvements-1} - -- Le serveur n'écrit pas les fichiers de configuration traités `/etc/clickhouse-server/` répertoire. Au lieu de cela, il les enregistre dans la `preprocessed_configs` répertoire à l'intérieur `path`. Cela signifie que l' `/etc/clickhouse-server/` répertoire n'ont pas d'accès en écriture pour le `clickhouse` de l'utilisateur, ce qui améliore la sécurité. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) -- Le `min_merge_bytes_to_use_direct_io` l'option est définie sur 10 GiB par défaut. Une fusion qui forme de grandes parties de tables de la famille MergeTree sera effectuée dans `O_DIRECT` mode, qui empêche l'expulsion excessive du cache de page. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) -- Démarrage accéléré du serveur lorsqu'il y a un très grand nombre de tables. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) -- Ajout d'un pool de connexion et HTTP `Keep-Alive` pour les connexions entre les répliques. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) -- Si la syntaxe de la requête n'est pas `400 Bad Request` le code est renvoyé dans la `HTTP` interface (500 a été retourné précédemment). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) -- Le `join_default_strictness` l'option est définie sur `ALL` par défaut, pour la compatibilité. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) -- Suppression de la journalisation vers `stderr` à partir de la `re2` bibliothèque pour les expressions régulières non valides ou complexes. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) -- Ajouté pour la `Kafka` moteur de table: vérifie les abonnements avant de commencer à lire à partir de Kafka; le paramètre kafka\_max\_block\_size pour la table. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) -- Le `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, et `murmurHash3_64` fonctions maintenant travailler pour n'importe quel nombre d'arguments et des arguments sous la forme de tuples. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) -- Le `arrayReverse` fonction fonctionne maintenant avec tous les types de tableaux. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- Ajout d'un paramètre optionnel: la taille de l'emplacement pour le `timeSlots` fonction. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) -- Pour `FULL` et `RIGHT JOIN`, le `max_block_size` le paramètre est utilisé pour un flux de données non jointes à partir de la table de droite. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3699) -- Ajouté le `--secure` paramètre de ligne de commande dans `clickhouse-benchmark` et `clickhouse-performance-test` pour activer TLS. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) -- Conversion de Type lorsque la structure d'un `Buffer` type table ne correspond pas à la structure de la table de destination. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) -- Ajouté le `tcp_keep_alive_timeout` option pour activer les paquets persistant après une inactivité de l'intervalle de temps spécifié. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) -- Suppression des guillemets inutiles de valeurs pour la clé de partition dans le `system.parts` le tableau si il se compose d'une seule colonne. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) -- La fonction modulo fonctionne pour `Date` et `DateTime` types de données. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) -- Ajouté synonymes pour le `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, et `MID` fonction. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Certains noms de fonctions sont insensibles à la casse pour la compatibilité avec le standard SQL. Sucre syntaxique ajouté `SUBSTRING(expr FROM start FOR length)` pour la compatibilité avec SQL. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) -- Ajout de la possibilité de `mlock` pages mémoire correspondant à `clickhouse-server` code exécutable pour l'empêcher d'être forcé hors de la mémoire. Cette fonctionnalité est désactivée par défaut. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) -- Amélioration des performances lors de la lecture de `O_DIRECT` (avec l' `min_bytes_to_use_direct_io` option activée). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) -- Amélioration de la performance de l' `dictGet...OrDefault` fonction pour un argument clé constant et un argument par défaut non constant. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3563) -- Le `firstSignificantSubdomain` la fonction traite maintenant les domaines `gov`, `mil`, et `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Amélioration de la performance. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) -- Possibilité de spécifier des variables d'environnement personnalisées pour le démarrage `clickhouse-server` à l'aide de la `SYS-V init.d` script en définissant `CLICKHOUSE_PROGRAM_ENV` dans `/etc/default/clickhouse`. - [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) -- Code de retour Correct pour le script d'initialisation clickhouse-server. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) -- Le `system.metrics` la table a maintenant le `VersionInteger` métrique, et `system.build_options` a la ligne ajoutée `VERSION_INTEGER`, qui contient la forme numérique de la version ClickHouse, telle que `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) -- Retiré la possibilité de comparer la `Date` tapez avec un nombre pour éviter les erreurs potentielles comme `date = 2018-12-17`, où les citations autour de la date sont omises par erreur. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) -- Correction du comportement des fonctions avec État comme `rowNumberInAllBlocks`. Ils ont précédemment sorti un résultat qui était un nombre plus grand en raison du démarrage lors de l'analyse de la requête. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3729) -- Si l' `force_restore_data` le fichier ne peut pas être supprimé, un message d'erreur est affiché. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3794) - -#### Construire des améliorations: {#build-improvements-1} - -- Mise à jour le `jemalloc` bibliothèque, qui corrige une fuite de mémoire potentielle. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3557) -- Profilage avec `jemalloc` est activé par défaut pour les versions de débogage. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) -- Ajout de la possibilité d'exécuter des tests d'intégration lorsque `Docker` est installé sur le système. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) -- Ajout du test d'expression fuzz dans les requêtes SELECT. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) -- Ajout d'un test de stress pour les commits, qui effectue des tests fonctionnels en parallèle et dans un ordre aléatoire pour détecter plus de conditions de course. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) -- Amélioration de la méthode de démarrage de clickhouse-server dans une image Docker. [Elghazal Ahmed](https://github.com/ClickHouse/ClickHouse/pull/3663) -- Pour une image Docker, ajout du support pour l'initialisation des bases de données à l'aide de fichiers dans le `/docker-entrypoint-initdb.d` répertoire. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) -- Corrections pour les builds sur ARM. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes} - -- Retiré la possibilité de comparer la `Date` tapez avec un numéro. Plutôt `toDate('2018-12-18') = 17883`, vous devez utiliser la conversion de type explicite `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) - -## Clickhouse version 18.14 {#clickhouse-release-18-14} - -### Clickhouse version 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} - -#### Corrections de bugs: {#bug-fixes-2} - -- Correction d'une erreur qui a conduit à des problèmes avec la mise à jour des dictionnaires avec la source ODBC. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- Les bases de données sont correctement spécifiées lors de L'exécution de DDL `ON CLUSTER` requête. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Correction d'un segfault si le `max_temporary_non_const_columns` limite a été dépassée. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### Construire des améliorations: {#build-improvements-2} - -- Corrections pour les builds sur ARM. - -### Clickhouse version 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} - -#### Corrections de bugs: {#bug-fixes-3} - -- Correction d'une erreur dans `dictGet...` fonction pour les dictionnaires de type `range` si un des arguments est constante et l'autre ne l'est pas. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) -- Correction d'une erreur qui a causé des messages `netlink: '...': attribute type 1 has an invalid length` pour être imprimé dans le journal du noyau Linux, cela ne se passait que sur des versions assez fraîches du noyau Linux. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) -- Fixe erreur de segmentation en fonction `empty` pour l'argument de `FixedString` type. [Daniel, Dao Quang Minh](https://github.com/ClickHouse/ClickHouse/pull/3703) -- Correction d'une allocation de mémoire excessive lors de l'utilisation d'une grande valeur de `max_query_size` (a la mémoire de morceau de `max_query_size` octets a été préalloué à la fois). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) - -#### Construire des changements: {#build-changes} - -- Correction de la construction avec les bibliothèques LLVM/Clang de la version 7 à partir des paquets du système D'exploitation (ces bibliothèques sont utilisées pour la compilation de requêtes d'exécution). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### Clickhouse version 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} - -#### Corrections de bugs: {#bug-fixes-4} - -- Correction de cas où le processus de pont ODBC ne s'est pas terminé avec le processus du serveur principal. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) -- Insertion synchrone fixe dans le `Distributed` table avec une liste des colonnes qui diffère de la liste des colonnes de la table distante. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) -- Correction d'une condition de concurrence rare qui peut conduire à un crash lors de la suppression D'une table MergeTree. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Correction d'un blocage de requête dans le cas où la création de thread de requête échoue avec le `Resource temporarily unavailable` erreur. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Fixe de l'analyse de l' `ENGINE` clause lorsque le `CREATE AS table` la syntaxe a été utilisée et `ENGINE` la clause a été spécifiée avant le `AS table` (l'erreur a entraîné en ignorant le moteur). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) - -### Clickhouse version 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} - -#### Corrections de bugs: {#bug-fixes-5} - -- La taille du bloc de mémoire a été surestimée lors de la désérialisation de la colonne de type `Array(String)` qui conduit à “Memory limit exceeded” erreur. Le problème est apparu dans la version 18.12.13. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) - -### Clickhouse version 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} - -#### Corrections de bugs: {#bug-fixes-6} - -- Fixe `ON CLUSTER` requêtes lorsque le cluster est configuré comme sécurisé (indicateur ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) - -#### Construire des changements: {#build-changes-1} - -- Correction de problèmes (llvm-7 du système, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### Clickhouse version 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} - -#### Corrections de bugs: {#bug-fixes-7} - -- Correction de l' `Block structure mismatch in MergingSorted stream` erreur. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) -- Fixe `ON CLUSTER` requêtes dans le cas où les connexions sécurisées ont été activées dans la configuration du cluster (le `` drapeau). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) -- Correction d'une erreur dans les requêtes utilisées `SAMPLE`, `PREWHERE` et les colonnes alias. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) -- Correction d'un rare `unknown compression method` erreur lors de la `min_bytes_to_use_direct_io` le réglage a été activé. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) - -#### Amélioration des performances: {#performance-improvements} - -- Régression de performance fixe des requêtes avec `GROUP BY` de colonnes de type UInt16 ou Date lors de l'exécution sur les processeurs AMD EPYC. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) -- Correction de la régression des performances des requêtes qui traitent les chaînes longues. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) - -#### Construire des améliorations: {#build-improvements-3} - -- Améliorations pour simplifier la construction Arcadia. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) - -### Clickhouse version 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} - -#### Corrections de bugs: {#bug-fixes-8} - -- Correction d'un plantage lors de la jonction de deux sous-requêtes sans nom. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) -- Fixe générant des requêtes incorrectes (avec un vide `WHERE` clause) lors de l'interrogation de bases de données externes. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) -- Correction en utilisant une valeur de délai d'attente incorrecte Dans les dictionnaires ODBC. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) - -### Clickhouse version 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} - -#### Corrections de bugs: {#bug-fixes-9} - -- Correction de l'erreur `Block structure mismatch in UNION stream: different number of columns` dans les requêtes LIMIT. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) -- Correction d'erreurs lors de la fusion de données dans des tables contenant des tableaux à l'intérieur de structures imbriquées. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) -- Correction de résultats de requête incorrects si le `merge_tree_uniform_read_distribution` paramètre est désactivé (il est activé par défaut). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) -- Correction d'une erreur sur les insertions à une table distribuée au format natif. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) - -### Clickhouse version 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} - -- Le `compile_expressions` le paramètre (compilation JIT d'expressions) est désactivé par défaut. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) -- Le `enable_optimize_predicate_expression` paramètre est désactivé par défaut. - -### Clickhouse version 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} - -#### Nouveauté: {#new-features-1} - -- Le `WITH CUBE` le modificateur `GROUP BY` (la syntaxe alternative `GROUP BY CUBE(...)` est également disponible). [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) -- Ajouté le `formatDateTime` fonction. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) -- Ajouté le `JDBC` tableau moteur et `jdbc` fonction table (nécessite l'installation de clickhouse-JDBC-bridge). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- Ajout de fonctions pour travailler avec le numéro de semaine ISO: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, et `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) -- Maintenant, vous pouvez utiliser `Nullable` colonnes pour `MySQL` et `ODBC` table. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- Imbriquée structures de données peuvent être lues comme des objets imbriqués dans `JSONEachRow` format. Ajouté le `input_format_import_nested_json` paramètre. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) -- Le traitement parallèle est disponible pour beaucoup `MATERIALIZED VIEW`s lors de l'insertion de données. Voir la `parallel_view_processing` paramètre. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) -- Ajouté le `SYSTEM FLUSH LOGS` requête (vidage forcé des journaux sur les tables système telles que `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) -- Maintenant, vous pouvez utiliser prédéfinis `database` et `table` macros lors de la déclaration `Replicated` table. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) -- A ajouté la capacité de lire `Decimal` valeurs de type en notation d'ingénierie (indiquant des puissances de dix). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) - -#### Caractéristiques expérimentales: {#experimental-features} - -- Optimisation de la clause GROUP BY pour `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) -- Calcul optimisé des expressions pour `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) - -#### Amélioration: {#improvements-2} - -- Consommation de mémoire considérablement réduite pour les requêtes avec `ORDER BY` et `LIMIT`. Voir la `max_bytes_before_remerge_sort` paramètre. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- En l'absence de `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` est supposé. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) -- Qualifié astérisques fonctionner correctement dans les requêtes avec `JOIN`. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) -- Le `ODBC` table engine choisit correctement la méthode de citation des identifiants dans le dialecte SQL d'une base de données distante. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- Le `compile_expressions` le paramètre (compilation JIT des expressions) est activé par défaut. -- Correction du comportement pour la base de données/TABLE DROP simultanée si existe et créer une base de données/TABLE si N'existe pas. Auparavant, un `CREATE DATABASE ... IF NOT EXISTS` requête peut renvoyer le message d'erreur “File … already exists” et la `CREATE TABLE ... IF NOT EXISTS` et `DROP TABLE IF EXISTS` les requêtes peuvent revenir `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) -- Les expressions LIKE ET IN avec une moitié droite constante sont passées au serveur distant lors de l'interrogation à partir de tables MySQL ou ODBC. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- Les comparaisons avec des expressions constantes dans une clause WHERE sont transmises au serveur distant lors de l'interrogation à partir de tables MySQL et ODBC. Auparavant, seules les comparaisons avec les constantes étaient passées. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- Calcul Correct de la largeur de ligne dans le terminal pour `Pretty` formats, y compris les chaînes avec des hiéroglyphes. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/3257). -- `ON CLUSTER` peut être spécifié pour `ALTER UPDATE` requête. -- Amélioration des performances de lecture des données `JSONEachRow` format. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) -- Ajouté synonymes pour le `LENGTH` et `CHARACTER_LENGTH` fonctions de compatibilité. Le `CONCAT` la fonction n'est plus sensible à la casse. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) -- Ajouté le `TIMESTAMP` synonyme de la `DateTime` type. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) -- Il y a toujours de l'espace réservé pour query\_id dans les journaux du serveur, même si la ligne de journal n'est pas liée à une requête. Cela facilite l'analyse des journaux de texte du serveur avec des outils tiers. -- La consommation de mémoire par une requête est enregistrée lorsqu'il dépasse le niveau suivant d'un nombre entier de gigaoctets. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- Ajout du mode de compatibilité pour le cas où la bibliothèque cliente qui utilise le protocole natif envoie moins de colonnes par erreur que ce que le serveur attend pour la requête D'insertion. Ce scénario était possible lors de l'utilisation de la bibliothèque clickhouse-cpp. Auparavant, ce scénario provoquait le plantage du serveur. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) -- Dans une expression WHERE définie par l'utilisateur `clickhouse-copier` vous pouvez maintenant utiliser un `partition_key` alias (pour un filtrage supplémentaire par partition de table source). Ceci est utile si le schéma de partitionnement change pendant la copie, mais ne change que légèrement. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) -- Le flux de travail du `Kafka` le moteur a été déplacé vers un pool de threads en arrière-plan afin de réduire automatiquement la vitesse de lecture des données à des charges élevées. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- Support pour la lecture `Tuple` et `Nested` valeurs de structures comme `struct` dans le `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) -- La liste des domaines de premier niveau pour les `firstSignificantSubdomain` la fonction inclut maintenant le domaine `biz`. [décaséale](https://github.com/ClickHouse/ClickHouse/pull/3219) -- Dans la configuration des dictionnaires externes, `null_value` est interprétée comme la valeur du type de données par défaut. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) -- Soutien pour le `intDiv` et `intDivOrZero` fonctions pour `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) -- Soutien pour le `Date`, `DateTime`, `UUID`, et `Decimal` types comme clé pour le `sumMap` fonction d'agrégation. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) -- Soutien pour le `Decimal` type de données dans les dictionnaires externes. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) -- Soutien pour le `Decimal` type de données dans `SummingMergeTree` table. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) -- Ajouté spécialisations pour `UUID` dans `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) -- Réduit le nombre de `open` et `close` les appels système lors de la lecture d'un `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) -- A `TRUNCATE TABLE` requête peut être exécutée sur n'importe quel réplica (la requête est transmise au chef de réplique). [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) - -#### Corrections de bugs: {#bug-fixes-10} - -- Correction d'un problème avec `Dictionary` tables pour `range_hashed` dictionnaire. Cette erreur s'est produite dans la version 18.12.17. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) -- Correction d'une erreur lors du chargement `range_hashed` les dictionnaires (le message `Unsupported type Nullable (...)`). Cette erreur s'est produite dans la version 18.12.17. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- Corrigé des erreurs dans la `pointInPolygon` fonction due à l'accumulation de calculs inexacts pour les polygones avec un grand nombre de sommets situés à proximité les uns des autres. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) -- Si, après la fusion de parties de données, la somme de contrôle de la partie résultante diffère du résultat de la même fusion dans une autre réplique, le résultat de la fusion est supprimé et la partie de données est téléchargée à partir de l'autre réplique (c'est le comportement correct). Mais après avoir téléchargé la partie data, elle n'a pas pu être ajoutée à l'ensemble de travail en raison d'une erreur indiquant que la partie existe déjà (car la partie data a été supprimée avec un certain retard après la fusion). Cela a conduit à cycliques tente de télécharger les mêmes données. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) -- Correction d'un calcul incorrect de la consommation totale de mémoire par les requêtes (en raison d'un calcul incorrect, le `max_memory_usage_for_all_queries` le réglage n'a pas fonctionné correctement et le `MemoryTracking` métrique a une valeur incorrecte). Cette erreur s'est produite dans la version 18.12.13. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) -- Correction de la fonctionnalité de `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` Cette erreur s'est produite dans la version 18.12.13. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) -- Correction de la préparation inutile des structures de données pour `JOIN`s sur le serveur qui initie la requête si `JOIN` est effectué uniquement sur des serveurs distants. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) -- Correction de bugs dans le `Kafka` engine: blocages après les exceptions lors du démarrage de la lecture des données, et verrous à la fin [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- Pour `Kafka` tableaux, le facultatif `schema` le paramètre n'a pas été passé (le schéma du `Cap'n'Proto` format). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) -- Si L'ensemble des serveurs ZooKeeper a des serveurs qui acceptent la connexion mais la ferment immédiatement au lieu de répondre à la prise de contact, ClickHouse choisit de connecter un autre serveur. Auparavant, cela produisait l'erreur `Cannot read all data. Bytes read: 0. Bytes expected: 4.` et le serveur ne pouvait pas commencer. [8218cf3a](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) -- Si L'ensemble des serveurs ZooKeeper contient des serveurs pour lesquels la requête DNS renvoie une erreur, ces serveurs sont ignorés. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) -- Conversion de type fixe entre `Date` et `DateTime` lors de l'insertion de données dans le `VALUES` format (si `input_format_values_interpret_expressions = 1`). Auparavant, la conversion était effectuée entre la valeur numérique du nombre de jours dans Unix Epoch time et L'horodatage Unix, ce qui conduisait à des résultats inattendus. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) -- Conversion de type corrigée entre `Decimal` et des nombres entiers. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) -- Corrigé des erreurs dans la `enable_optimize_predicate_expression` paramètre. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) -- Correction d'une erreur D'analyse au format CSV avec des nombres à virgule flottante si un séparateur CSV non par défaut est utilisé, tel que `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) -- Correction de l' `arrayCumSumNonNegative` fonction (il n'accumule pas de valeurs négatives si l'accumulateur est inférieur à zéro). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) -- Fixe comment `Merge` les tables de travail sur le dessus de `Distributed` tables lors de l'utilisation `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) -- Corrections de bugs dans l' `ALTER UPDATE` requête. -- Correction de bugs dans le `odbc` fonction de table apparue dans la version 18.12. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) -- Correction du fonctionnement des fonctions d'agrégat avec `StateArray` combinators. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) -- Correction d'un crash lors de la division d'une `Decimal` valeur par zéro. [69dd6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) -- Sortie fixe des types pour les opérations utilisant `Decimal` et des arguments entiers. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) -- Correction du segfault pendant `GROUP BY` sur `Decimal128`. [3359ba06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) -- Le `log_query_threads` le paramètre (journalisation des informations sur chaque thread d'exécution de la requête) ne prend effet que si `log_queries` l'option (journalisation des informations sur les requêtes) est définie sur 1. Depuis le `log_query_threads` l'option est activée par défaut, les informations sur les threads ont déjà été enregistrées même si la journalisation des requêtes a été désactivée. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) -- Correction d'une erreur dans le fonctionnement distribué de la fonction d'agrégat quantiles (le message d'erreur `Not found column quantile...`). [292a8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) -- Correction du problème de compatibilité lorsque vous travaillez sur un cluster de serveurs de version 18.12.17 et de serveurs plus anciens en même temps. Pour les requêtes distribuées avec des clés GROUP BY de longueur fixe et non fixe, s'il y avait une grande quantité de données à agréger, les données renvoyées n'étaient pas toujours entièrement agrégées (deux lignes différentes contenaient les mêmes clés d'agrégation). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) -- Manipulation fixe des substitutions dans `clickhouse-performance-test` si la requête ne contient qu'une partie des substitutions déclaré dans le test. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) -- Correction d'une erreur lors de l'utilisation `FINAL` avec `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Correction d'une erreur lors de l'utilisation `PREWHERE` sur les colonnes qui ont été ajoutées pendant `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Ajout d'une vérification de l'absence de `arrayJoin` pour `DEFAULT` et `MATERIALIZED` expression. Précédemment, `arrayJoin` conduit à une erreur lors de l'insertion de données. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) -- Ajout d'une vérification de l'absence de `arrayJoin` dans un `PREWHERE` clause. Auparavant, cela a conduit à des messages comme `Size ... doesn't match` ou `Unknown compression method` lors de l'exécution de requêtes. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) -- Correction de segfault qui pourrait se produire dans de rares cas après l'optimisation qui a remplacé et chaînes des évaluations d'égalité avec l'expression IN correspondante. [liuyimin-bytedance](https://github.com/ClickHouse/ClickHouse/pull/3339) -- Corrections mineures à `clickhouse-benchmark`: auparavant, les informations client n'étaient pas envoyées au serveur; maintenant, le nombre de requêtes exécutées est calculé plus précisément lors de l'arrêt et pour limiter le nombre d'itérations. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-1} - -- Enlevé le `allow_experimental_decimal_type` option. Le `Decimal` type de données est disponible pour utilisation par défaut. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) - -## Clickhouse Version 18.12 {#clickhouse-release-18-12} - -### Clickhouse version 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} - -#### Nouveauté: {#new-features-2} - -- `invalidate_query` (la possibilité de spécifier une requête pour vérifier si un dictionnaire externe doit être mis à jour) est implémentée pour `clickhouse` source. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) -- Ajout de la possibilité d'utiliser `UInt*`, `Int*`, et `DateTime` types de données (avec le `Date` le type) comme un `range_hashed` clé de dictionnaire externe qui définit les limites des plages. Maintenant `NULL` peut être utilisé pour désigner un intervalle ouvert. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) -- Le `Decimal` type prend maintenant en charge `var*` et `stddev*` les fonctions d'agrégation. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- Le `Decimal` type prend désormais en charge les fonctions mathématiques (`exp`, `sin` et ainsi de suite.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- Le `system.part_log` la table a maintenant le `partition_id` colonne. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Corrections de bugs: {#bug-fixes-11} - -- `Merge` fonctionne maintenant correctement sur `Distributed` table. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) -- Incompatibilité fixe (dépendance inutile sur le `glibc` version) qui a rendu impossible l'exécution de ClickHouse sur `Ubuntu Precise` et les anciennes versions. L'incompatibilité est apparue dans la version 18.12.13. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) -- Corrigé des erreurs dans la `enable_optimize_predicate_expression` paramètre. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) -- Correction d'un problème mineur de rétrocompatibilité apparu lors de l'utilisation d'un cluster de répliques sur des versions antérieures au 18.12.13 et de la création simultanée d'une nouvelle réplique d'une table sur un serveur avec une version plus récente (indiquée dans le message `Can not clone replica, because the ... updated to new ClickHouse version`, ce qui est logique, mais ne devrait pas arriver). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-2} - -- Le `enable_optimize_predicate_expression` option est activée par défaut (ce qui est plutôt optimiste). Si des erreurs d'analyse de requête se produisent liées à la recherche des noms de colonnes, définissez `enable_optimize_predicate_expression` à 0. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) - -### Clickhouse version 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} - -#### Nouveauté: {#new-features-3} - -- Ajout du support pour `ALTER UPDATE` requête. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) -- Ajouté le `allow_ddl` option, qui limite l'accès de L'utilisateur aux requêtes DDL. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) -- Ajouté le `min_merge_bytes_to_use_direct_io` option pour `MergeTree` moteurs, qui vous permet de définir un seuil pour la taille totale de la fusion (quand au-dessus du seuil, les fichiers de partie de données seront traités en utilisant O\_DIRECT). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) -- Le `system.merges` la table système contient maintenant `partition_id` colonne. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) - -#### Amélioration {#improvements-3} - -- Si une partie de données reste inchangée pendant la mutation, elle n'est pas téléchargée par les répliques. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) -- La saisie semi-automatique est disponible pour les noms de paramètres lorsque vous travaillez avec `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) - -#### Corrections de bugs: {#bug-fixes-12} - -- Ajouter un chèque pour les montants des tableaux sont des éléments de `Nested` les champs de type lors de l'insertion. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) -- Correction d'une erreur de mise à jour des dictionnaires externes `ODBC` source et `hashed` stockage. Cette erreur s'est produite dans la version 18.12.13. -- Correction d'un plantage lors de la création d'une table temporaire à partir d'une requête `IN` condition. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) -- Correction d'une erreur dans les fonctions d'agrégation pour les tableaux peuvent avoir `NULL` élément. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) - -### Clickhouse version 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} - -#### Nouveauté: {#new-features-4} - -- Ajouté le `DECIMAL(digits, scale)` type de données (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). Pour l'activer, utilisez le paramètre `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) -- Nouveau `WITH ROLLUP` le modificateur `GROUP BY` (syntaxe alternative: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) -- Dans les requêtes avec jointure, le caractère étoile se développe en une liste de colonnes dans toutes les tables, conformément à la norme SQL. Vous pouvez restaurer l'ancien comportement en paramètre `asterisk_left_columns_only` à 1 au niveau de la configuration utilisateur. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) -- Ajout du support pour joindre avec les fonctions de table. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- Saisie semi-automatique en appuyant sur Tab dans clickhouse-client. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) -- Ctrl + C dans clickhouse-client efface une requête qui a été entrée. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) -- Ajouté le `join_default_strictness` paramètre (valeurs: `"`, `'any'`, `'all'`). Cela vous permet de ne pas préciser `ANY` ou `ALL` pour `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) -- Chaque ligne du journal du serveur associée au traitement de la requête affiche L'ID de la requête. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Maintenant, vous pouvez obtenir des journaux d'exécution de requête dans clickhouse-client (utilisez le `send_logs_level` paramètre). Avec le traitement des requêtes distribuées, les journaux sont cascadés à partir de tous les serveurs. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Le `system.query_log` et `system.processes` (`SHOW PROCESSLIST` les tableaux ont maintenant des informations sur tous les paramètres modifiés lorsque vous exécutez une requête (la structure imbriquée de l' `Settings` données). Ajouté le `log_query_settings` paramètre. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Le `system.query_log` et `system.processes` les tables affichent désormais des informations sur le nombre de threads participant à l'exécution de la requête (voir `thread_numbers` colonne). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Ajouter `ProfileEvents` compteurs qui mesurent le temps passé à lire et à écrire sur le réseau et à lire et à écrire sur le disque, le nombre d'erreurs réseau et le temps passé à attendre lorsque la bande passante réseau est limitée. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Ajouter `ProfileEvents`compteurs qui contiennent les métriques système de rusage (vous pouvez les utiliser pour obtenir des informations sur L'utilisation du processeur dans l'espace utilisateur et le noyau, les erreurs de page et les commutateurs de contexte), ainsi que les métriques taskstats (utilisez-les pour obtenir des informations sur le temps d'attente d'E/S, le temps D'attente du processeur et [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Le `ProfileEvents` les compteurs sont appliqués globalement et pour chaque requête, ainsi que pour chaque thread d'exécution de requête, ce qui vous permet de profiler la consommation de ressources par requête en détail. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Ajouté le `system.query_thread_log` table, qui contient des informations sur chaque thread d'exécution de requête. Ajouté le `log_query_threads` paramètre. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Le `system.metrics` et `system.events` les tables ont maintenant une documentation intégrée. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) -- Ajouté le `arrayEnumerateDense` fonction. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2975) -- Ajouté le `arrayCumSumNonNegative` et `arrayDifference` fonction. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) -- Ajouté le `retention` fonction d'agrégation. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) -- Vous pouvez maintenant ajouter (fusionner) des états de fonctions d'agrégat en utilisant l'opérateur plus et multiplier les états de fonctions d'agrégat par une constante non négative. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) -- Les Tables de la famille MergeTree ont maintenant la colonne virtuelle `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Caractéristiques expérimentales: {#experimental-features-1} - -- Ajouté le `LowCardinality(T)` type de données. Ce type de données crée automatiquement un dictionnaire local de valeurs et permet le traitement des données sans déballer le dictionnaire. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) -- Ajout d'un cache de fonctions compilées JIT et d'un compteur pour le nombre d'utilisations avant la compilation. Pour compiler des expressions JIT, activez `compile_expressions` paramètre. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) - -#### Amélioration: {#improvements-4} - -- Correction du problème avec l'accumulation illimitée du journal de réplication quand il y a des répliques abandonnées. Ajout d'un mode de récupération efficace pour les répliques avec un long décalage. -- Amélioration des performances de `GROUP BY` avec l'agrégation de plusieurs champs lorsque l'un d'eux est une chaîne et les autres sont de longueur fixe. -- Amélioration des performances lors de l'utilisation `PREWHERE` et avec transfert implicite d'expressions dans `PREWHERE`. -- Amélioration des performances d'analyse pour les formats de texte (`CSV`, `TSV`). [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) -- Amélioration des performances de lecture des chaînes et des tableaux dans les formats binaires. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2955) -- Augmentation des performances et réduction de la consommation de mémoire pour les requêtes `system.tables` et `system.columns` quand il y a un très grand nombre de tables sur un seul serveur. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) -- Correction d'un problème de performances dans le cas d'un grand flux de requêtes résultant en une erreur (la `_dl_addr` la fonction est visible dans `perf top` mais le serveur n'utilise pas beaucoup de CPU). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) -- Les Conditions sont converties dans la vue (lorsque `enable_optimize_predicate_expression` est activé). [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- Améliorations de la fonctionnalité pour le `UUID` type de données. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) -- Le `UUID` le type de données est pris en charge dans les dictionnaires-Alchemist. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) -- Le `visitParamExtractRaw` la fonction fonctionne correctement avec les structures imbriquées. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) -- Lorsque l' `input_format_skip_unknown_fields` paramètre est activé, les champs d'objet dans `JSONEachRow` format sont ignorés correctement. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) -- Pour un `CASE` expression avec conditions, vous pouvez maintenant omettre `ELSE`, ce qui est équivalent à `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) -- Le délai d'attente de l'opération peut maintenant être configuré lorsque vous travaillez avec ZooKeeper. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) -- Vous pouvez spécifier un décalage pour `LIMIT n, m` comme `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- Vous pouvez utiliser l' `SELECT TOP n` syntaxe comme alternative pour `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- Augmentation de la taille de la file d'attente pour écrire dans les tables `SystemLog parameter queue is full` l'erreur ne se produit pas aussi souvent. -- Le `windowFunnel` fonction d'agrégation prend désormais en charge les événements qui répondent à plusieurs conditions. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2801) -- Les colonnes dupliquées peuvent être utilisées dans un `USING` la clause de `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) -- `Pretty` formats maintenant avoir une limite sur l'alignement des colonnes de largeur. L'utilisation de la `output_format_pretty_max_column_pad_width` paramètre. Si une valeur est plus large, il sera toujours affichée dans son intégralité, mais les autres cellules dans le tableau ne sera pas trop large. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) -- Le `odbc` la fonction table vous permet maintenant de spécifier le nom de la base de données / schéma. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2885) -- Ajout de la possibilité d'utiliser un nom d'utilisateur spécifié dans le `clickhouse-client` fichier de configuration. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) -- Le `ZooKeeperExceptions` compteur a été divisé en trois compteurs: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, et `ZooKeeperOtherExceptions`. -- `ALTER DELETE` les requêtes fonctionnent pour les vues matérialisées. -- Ajouté randomisation lors de l'exécution du thread de nettoyage périodiquement pour `ReplicatedMergeTree` afin d'éviter les pics de charge périodiques lorsqu'il y a un très grand nombre de `ReplicatedMergeTree` table. -- Soutien pour `ATTACH TABLE ... ON CLUSTER` requête. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) - -#### Corrections de bugs: {#bug-fixes-13} - -- Correction d'un problème avec `Dictionary` tables (jette le `Size of offsets doesn't match size of column` ou `Unknown compression method` exception). Ce bug est apparu dans la version 18.10.3. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) -- Correction d'un bug lors de la fusion `CollapsingMergeTree` tables si l'une des parties de données est vide (ces parties sont formées lors de la fusion ou `ALTER DELETE` si toutes les données ont été supprimées), et le `vertical` l'algorithme a été utilisé pour la fusion. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) -- Correction d'une condition de course pendant `DROP` ou `TRUNCATE` pour `Memory` tables simultanément `SELECT`, ce qui pourrait conduire à des pannes de serveur. Ce bug est apparu dans la version 1.1.54388. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) -- Correction de la possibilité de perte de données lors de l'insertion dans `Replicated` des tables, si la `Session is expired` l'erreur est renvoyée (la perte de données peut être détectée par le `ReplicatedDataLoss` métrique). Cette erreur s'est produite dans la version 1.1.54378. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) -- Correction d'un segfault pendant `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) -- Correction de l'erreur de recherche des noms de colonne lorsque le `WHERE` expression se compose entièrement d'un nom de colonne qualifié, tel que `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) -- Correction de l' “Not found column” erreur survenue lors de l'exécution de requêtes distribuées si une seule colonne composée d'une expression avec une sous-requête est demandée à partir d'un serveur distant. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) -- Correction de l' `Block structure mismatch in UNION stream: different number of columns` erreur qui s'est produite pour les requêtes distribuées si l'un des fragments est locale et l'autre ne l'est pas, et l'optimisation de la déplacer à `PREWHERE` est déclenchée. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) -- Correction de l' `pointInPolygon` fonction pour certains cas de polygones non convexes. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) -- Correction du résultat incorrect lors de la comparaison `nan` avec des entiers. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) -- Correction d'une erreur dans le `zlib-ng` bibliothèque qui pourrait conduire à segfault dans de rares cas. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) -- Correction d'une fuite de mémoire lors de l'insertion dans une table avec `AggregateFunction` colonnes, si l'état de la fonction d'agrégat n'est pas simple (alloue la mémoire séparément), et si une seule demande d'insertion entraîne plusieurs petits blocs. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) -- Correction d'une condition de concurrence lors de la création et la suppression de la même `Buffer` ou `MergeTree` table en même temps. -- Correction de la possibilité d'un segfault lors de la comparaison des tuples constitués de certains types non triviaux, tels que les tuples. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) -- Correction de la possibilité d'un segfault lors de l'exécution de certains `ON CLUSTER` requête. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) -- Correction d'une erreur dans le `arrayDistinct` fonction pour `Nullable` les éléments du tableau. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) -- Le `enable_optimize_predicate_expression` option prend en charge correctement les cas avec `SELECT *`. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) -- Correction du segfault lors de la réinitialisation de la session ZooKeeper. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) -- Blocage potentiel fixe lorsque vous travaillez avec ZooKeeper. -- Correction d'un code incorrect pour ajouter des structures de données imbriquées dans un `SummingMergeTree`. -- Lors de l'allocation de mémoire pour les états de fonctions d'agrégat, l'alignement est correctement pris en compte, ce qui permet d'utiliser des opérations nécessitant un alignement lors de la mise en œuvre des états de fonctions d'agrégat. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) - -#### Correction de sécurité: {#security-fix} - -- Utilisation sûre des sources de données ODBC. L'Interaction avec les pilotes ODBC utilise un `clickhouse-odbc-bridge` processus. Les erreurs dans les pilotes ODBC tiers ne causent plus de problèmes de stabilité du serveur ou de vulnérabilités. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) -- Correction d'une validation incorrecte du chemin du fichier dans le `catBoostPool` table de fonction. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) -- Le contenu des tableaux du système (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, et `replication_queue`) sont filtrés en fonction de l'accès configuré de l'utilisateur aux bases de données (`allow_databases`). [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-3} - -- Dans les requêtes avec jointure, le caractère étoile se développe en une liste de colonnes dans toutes les tables, conformément à la norme SQL. Vous pouvez restaurer l'ancien comportement en paramètre `asterisk_left_columns_only` à 1 au niveau de la configuration utilisateur. - -#### Construire des changements: {#build-changes-2} - -- La plupart des tests d'intégration peuvent maintenant être exécutés par commit. -- Les contrôles de style de Code peuvent également être exécutés par commit. -- Le `memcpy` l'implémentation est choisie correctement lors de la construction sur CentOS7/Fedora. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) -- Lorsque vous utilisez clang pour construire, certains avertissements de `-Weverything` ont été ajoutées, en plus de la `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) -- Débogage de la construction utilise le `jemalloc` option de débogage. -- L'interface de la bibliothèque pour interagir avec ZooKeeper est déclarée abstraite. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) - -## Clickhouse version 18.10 {#clickhouse-release-18-10} - -### Clickhouse version 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} - -#### Nouveauté: {#new-features-5} - -- HTTPS peut être utilisé pour la réplication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) -- Ajout des fonctions `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, et `murmurHash3_128` en plus de l'existant `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) -- Prise en charge des types Nullable dans le pilote ODBC ClickHouse (`ODBCDriver2` le format de sortie). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) -- Soutien pour `UUID` dans les colonnes de clé. - -#### Amélioration: {#improvements-5} - -- Les Clusters peuvent être supprimés sans redémarrer le serveur lorsqu'ils sont supprimés des fichiers de configuration. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) -- Les dictionnaires externes peuvent être supprimés sans redémarrer le serveur lorsqu'ils sont supprimés des fichiers de configuration. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) -- Ajouter `SETTINGS` soutien pour le `Kafka` tableau moteur. [Alexander Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) -- Des améliorations pour l' `UUID` type de données (pas encore terminée). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) -- Prise en charge des pièces vides après fusion dans le `SummingMergeTree`, `CollapsingMergeTree` et `VersionedCollapsingMergeTree` moteur. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) -- Les anciens enregistrements de mutations terminées sont supprimés (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) -- Ajouté le `system.merge_tree_settings` table. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) -- Le `system.tables` la table a maintenant des colonnes de dépendance: `dependencies_database` et `dependencies_table`. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) -- Ajouté le `max_partition_size_to_drop` option de configuration. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) -- Ajouté le `output_format_json_escape_forward_slashes` option. [Alexandre Botcharov](https://github.com/ClickHouse/ClickHouse/pull/2812) -- Ajouté le `max_fetch_partition_retries_count` paramètre. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) -- Ajouté le `prefer_localhost_replica` paramètre permettant de désactiver la préférence pour une réplique locale et d'accéder à une réplique locale sans interaction entre processus. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) -- Le `quantileExact` fonction d'agrégation retourne `nan` dans le cas de l'agrégation sur un vide `Float32` ou `Float64` définir. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) - -#### Corrections de bugs: {#bug-fixes-14} - -- Suppression de l'échappement inutile des paramètres de chaîne de connexion pour ODBC, ce qui rendait impossible l'établissement d'une connexion. Cette erreur s'est produite dans la version 18.6.0. -- Fixe la logique de traitement `REPLACE PARTITION` les commandes dans la file d'attente de réplication. Si il y a deux `REPLACE` pour la même partition, la logique incorrecte pourrait entraîner l'un d'entre eux de rester dans la file d'attente de réplication et ne pas être exécuté. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) -- Correction d'un bug de fusion lorsque toutes les parties de données étaient vides (parties formées à partir d'une fusion ou `ALTER DELETE` si toutes les données ont été supprimées). Ce bug est apparu dans la version 18.1.0. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) -- Correction d'une erreur pour simultanées `Set` ou `Join`. [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2823) -- Correction de l' `Block structure mismatch in UNION stream: different number of columns` erreur qui s'est produite pour `UNION ALL` requêtes dans une sous-requête si l'un des `SELECT` les requêtes contiennent des noms de colonnes en double. [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) -- Correction d'une fuite de mémoire si une exception se produisait lors de la connexion à un serveur MySQL. -- Correction d'un code de réponse clickhouse-client incorrect en cas d'erreur de requête. -- Correction d'un comportement incorrect des vues matérialisées contenant DISTINCT. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) - -#### Modifications incompatibles en arrière {#backward-incompatible-changes-4} - -- Suppression de la prise en charge des requêtes CHECK TABLE pour les tables distribuées. - -#### Construire des changements: {#build-changes-3} - -- L'allocateur a été remplacé: `jemalloc` est maintenant utilisé à la place de `tcmalloc`. Dans certains scénarios, cela augmente la vitesse jusqu'à 20%. Cependant, il y a des questions qui ont ralenti jusqu'à 20%. La consommation de mémoire a été réduite d'environ 10% dans certains scénarios, avec une meilleure stabilité. Avec des charges très compétitives, l'utilisation du processeur dans l'espace utilisateur et dans le système ne montre qu'une légère augmentation. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) -- L'utilisation de libressl à partir d'un sous-module. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) -- Utilisation d'unixodbc à partir d'un sous-module. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) -- L'utilisation de mariadb-connecteur-c à partir d'un sous-module. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) -- Ajout de fichiers de test fonctionnels au référentiel qui dépendent de la disponibilité des données de test (pour le moment, sans les données de test elles-mêmes). - -## Clickhouse version 18.6 {#clickhouse-release-18-6} - -### Clickhouse version 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} - -#### Nouveauté: {#new-features-6} - -- Ajout du support pour les expressions on pour la syntaxe JOIN ON: - `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` - L'expression doit être une chaîne d'égalités rejoint par l'opérateur ET. De chaque côté de l'égalité peut être une expression arbitraire sur les colonnes de l'une des tables. L'utilisation de noms de colonnes entièrement qualifiés est prise en charge (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) pour la bonne table. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) -- HTTPS peut être activé pour la réplication. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) - -#### Amélioration: {#improvements-6} - -- Le serveur transmet le composant patch de sa version au client. Les données sur le composant de version de correctif sont `system.processes` et `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) - -## Clickhouse version 18.5 {#clickhouse-release-18-5} - -### Clickhouse version 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} - -#### Nouveauté: {#new-features-7} - -- Ajout de la fonction de hachage `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). - -#### Amélioration: {#improvements-7} - -- Maintenant, vous pouvez utiliser le `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) attribut pour définir des valeurs dans les fichiers de configuration à partir de variables d'environnement. -- Ajout de versions insensibles à la casse `coalesce`, `ifNull`, et `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). - -#### Corrections de bugs: {#bug-fixes-15} - -- Correction d'un bug possible lors du démarrage d'une réplique [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). - -## Clickhouse version 18.4 {#clickhouse-release-18-4} - -### Clickhouse version 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} - -#### Nouveauté: {#new-features-8} - -- Tables système ajoutées: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). -- Ajout de la possibilité d'utiliser une fonction de table au lieu d'un tableau en argument d'une `remote` ou `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). -- Soutien pour `HTTP Basic` l'authentification dans le protocole de réplication [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). -- Le `has` fonction permet de rechercher une valeur numérique dans un tableau de `Enum` valeur [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). -- Prise en charge de l'ajout de séparateurs de messages arbitraires lors de la lecture de `Kafka` [Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2701). - -#### Amélioration: {#improvements-8} - -- Le `ALTER TABLE t DELETE WHERE` la requête ne réécrit pas les parties de données qui n'ont pas été affectées par la condition WHERE [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). -- Le `use_minimalistic_checksums_in_zookeeper` option pour `ReplicatedMergeTree` des tables est activé par défaut. Ce paramètre a été ajouté dans la version 1.1.54378, 2018-04-16. Les Versions antérieures à 1.1.54378 ne peuvent plus être installées. -- La prise en charge de `KILL` et `OPTIMIZE` requêtes qui spécifient `ON CLUSTER` [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). - -#### Corrections de bugs: {#bug-fixes-16} - -- Correction de l'erreur `Column ... is not under an aggregate function and not in GROUP BY` pour l'agrégation avec une expression. Ce bug est apparu dans la version 18.1.0. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) -- Correction d'un bug dans l' `windowFunnel aggregate function` [L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). -- Correction d'un bug dans l' `anyHeavy` fonction d'agrégation ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) -- Correction d'un crash du serveur lors de l'utilisation du `countArray()` fonction d'agrégation. - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-5} - -- Paramètres pour `Kafka` moteur a été changé de `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` de `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. Si vos tables utilisent `kafka_schema` ou `kafka_num_consumers` paramètres, vous devez modifier manuellement les fichiers de métadonnées `path/metadata/database/table.sql` et d'ajouter `kafka_row_delimiter` paramètre avec `''` valeur. - -## Clickhouse version 18.1 {#clickhouse-release-18-1} - -### Clickhouse version 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} - -#### Nouveauté: {#new-features-9} - -- Soutien pour le `ALTER TABLE t DELETE WHERE` requête pour les tables MergeTree non répliquées ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). -- Prise en charge des types arbitraires pour `uniq*` famille de fonctions agrégées ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). -- Prise en charge des types arbitraires dans les opérateurs de comparaison ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). -- Le `users.xml` fichier permet de définir un masque de sous-réseau au format `10.0.0.1/255.255.255.0`. Ceci est nécessaire pour utiliser des masques pour les réseaux IPv6 avec des zéros au milieu ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). -- Ajouté le `arrayDistinct` fonction ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). -- Le moteur SummingMergeTree peut maintenant fonctionner avec des colonnes de type AggregateFunction ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). - -#### Amélioration: {#improvements-9} - -- Modification du schéma de numérotation pour les versions de version. Maintenant, la première partie contient l'année de sortie (A. D., fuseau horaire de Moscou, moins 2000), la deuxième partie contient le nombre de changements majeurs (augmente pour la plupart des versions), et la troisième partie est la version patch. Les versions sont toujours rétrocompatibles, sauf indication contraire dans le changelog. -- Conversions plus rapides de nombres à virgule flottante en une chaîne ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2664)). -- Si certaines lignes ont été ignorées lors d'une insertion en raison d'erreurs d'analyse (ceci est possible avec `input_allow_errors_num` et `input_allow_errors_ratio` paramètres activé), le nombre de lignes ignorées est maintenant écrit dans le journal du serveur ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). - -#### Corrections de bugs: {#bug-fixes-17} - -- Correction de la commande TRUNCATE pour les tables temporaires ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2624)). -- Correction d'une impasse rare dans la bibliothèque client ZooKeeper qui se produisait lorsqu'une erreur réseau se produisait lors de la lecture de la réponse ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). -- Correction d'une erreur lors d'une conversion en types Nullable ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). -- Correction du résultat incorrect de l' `maxIntersection()` fonction lorsque les limites des intervalles de coïncidé ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). -- Correction d'une transformation incorrecte de la chaîne d'expression OR dans un argument de fonction ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). -- Fixe une dégradation des performances pour les requêtes contenant `IN (subquery)` expressions à l'intérieur d'une autre sous-requête ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). -- Fixe incompatibilité entre les serveurs avec des versions différentes requêtes distribuées qui utilisent un `CAST` fonction qui n'est pas en majuscules ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). -- Ajout de guillemets manquants d'identifiants pour les requêtes à un SGBD externe ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-6} - -- La conversion d'une chaîne contenant le nombre zéro en DateTime ne fonctionne pas. Exemple: `SELECT toDateTime('0')`. C'est aussi la raison pour laquelle `DateTime DEFAULT '0'` ne fonctionne pas dans les tableaux, ainsi que `0` dans les dictionnaires. Solution: remplacer `0` avec `0000-00-00 00:00:00`. - -## Clickhouse version 1.1 {#clickhouse-release-1-1} - -### Clickhouse version 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} - -#### Nouveauté: {#new-features-10} - -- Ajouté le `histogram` fonction d'agrégation ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). -- Maintenant `OPTIMIZE TABLE ... FINAL` peut être utilisé sans spécifier de partitions pour `ReplicatedMergeTree` ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2600)). - -#### Corrections de bugs: {#bug-fixes-18} - -- Correction d'un problème avec un très petit délai d'attente pour les sockets (une seconde) pour la lecture et l'écriture lors de l'envoi et du téléchargement de données répliquées, ce qui rendait impossible le téléchargement de pièces plus grandes s'il y avait une charge sur le réseau ou le disque (cela entraînait des tentatives cycliques de téléchargement de pièces). Cette erreur s'est produite dans la version 1.1.54388. -- Correction de problèmes lors de l'utilisation de chroot dans ZooKeeper si vous avez inséré des blocs de données en double dans la table. -- Le `has` la fonction fonctionne maintenant correctement pour un tableau avec les valeurs null éléments ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). -- Le `system.tables` table fonctionne maintenant correctement lorsqu'il est utilisé dans les requêtes distribuées. Le `metadata_modification_time` et `engine_full` les colonnes sont maintenant non-virtuel. Correction d'une erreur qui s'est produite si seules ces colonnes étaient interrogées à partir de la table. -- Correction de la façon dont un vide `TinyLog` table fonctionne après l'insertion d'un bloc de données vide ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). -- Le `system.zookeeper` table fonctionne si la valeur du nœud dans ZooKeeper est NULL. - -### Clickhouse version 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} - -#### Nouveauté: {#new-features-11} - -- Les requêtes peuvent être envoyées `multipart/form-data` format (dans le `query` champ), ce qui est utile si des données externes sont également envoyées pour le traitement de la requête ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). -- Ajout de la possibilité d'activer ou de désactiver le traitement des guillemets simples ou doubles lors de la lecture de données au format CSV. Vous pouvez configurer cela dans le `format_csv_allow_single_quotes` et `format_csv_allow_double_quotes` paramètre ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2574)). -- Maintenant `OPTIMIZE TABLE ... FINAL` peut être utilisé sans spécifier la partition pour les variantes non répliquées de `MergeTree` ([Amos Oiseau](https://github.com/ClickHouse/ClickHouse/pull/2599)). - -#### Amélioration: {#improvements-10} - -- Amélioration des performances, réduction de la consommation de mémoire et suivi correct de la consommation de mémoire avec l'utilisation de L'opérateur IN lorsqu'un index de table peut être utilisé ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). -- Retiré redondant vérification des sommes de contrôle lors de l'ajout d'une partie des données. Ceci est important lorsqu'il y a un grand nombre de répliques, car dans ces cas, le nombre total de contrôles était égal à n^2. -- Ajout du support pour `Array(Tuple(...))` arguments en faveur de la `arrayEnumerateUniq` fonction ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). -- Ajouter `Nullable` soutien pour le `runningDifference` fonction ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). -- Amélioration des performances d'analyse des requêtes lorsqu'il existe un très grand nombre d'expressions ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). -- Sélection plus rapide des parties de données à fusionner `ReplicatedMergeTree` table. Récupération plus rapide de la session ZooKeeper ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). -- Le `format_version.txt` fichier pour `MergeTree` tables est recréée si elle est manquante, ce qui est logique si ClickHouse est lancé après avoir copié la structure de répertoire sans fichiers ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). - -#### Corrections de bugs: {#bug-fixes-19} - -- Correction d'un bug lorsque vous travaillez avec ZooKeeper qui pourrait rendre impossible la récupération de la session et des États en lecture seule des tables avant de redémarrer le serveur. -- Correction d'un bug lorsque vous travaillez avec ZooKeeper qui pourrait entraîner la suppression des anciens nœuds si la session est interrompue. -- Correction d'une erreur dans le `quantileTDigest` fonction pour les arguments Float (ce bug a été introduit dans la version 1.1.54388) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). -- Correction d'un bug dans l'index des tables MergeTree si la colonne de clé primaire est située à l'intérieur de la fonction de conversion des types entre des entiers signés et non signés de même taille ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). -- Fixe erreur de segmentation si `macros` sont utilisés mais ils ne sont pas dans le fichier de configuration ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). -- Correction du passage à la base de données par défaut lors de la reconnexion du client ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). -- Correction d'un bug qui se produisait lors de la `use_index_for_in_with_subqueries` paramètre a été désactivé. - -#### Correction de sécurité: {#security-fix-1} - -- L'envoi de fichiers n'est plus possible lorsqu'il est connecté à MySQL (`LOAD DATA LOCAL INFILE`). - -### Clickhouse version 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} - -#### Nouveauté: {#new-features-12} - -- Soutien pour le `ALTER TABLE t DELETE WHERE` requête pour les tables répliquées. Ajouté le `system.mutations` tableau pour suivre la progression de ce type de requêtes. -- Soutien pour le `ALTER TABLE t [REPLACE|ATTACH] PARTITION` requête pour les tables \* MergeTree. -- Soutien pour le `TRUNCATE TABLE` requête ([L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) -- Plusieurs nouveaux `SYSTEM` requêtes pour les tables répliquées (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). -- Ajout de la possibilité d'écrire dans une table avec le moteur MySQL et la fonction de table correspondante ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). -- Ajouté le `url()` fonction de table et le `URL` tableau moteur ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). -- Ajouté le `windowFunnel` fonction d'agrégation ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). -- Nouveau `startsWith` et `endsWith` fonctions pour les chaînes ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). -- Le `numbers()` la fonction table vous permet maintenant de spécifier le décalage ([L'Hiver Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). -- Le mot de passe pour `clickhouse-client` peut être saisi de manière interactive. -- Les journaux du serveur peuvent maintenant être envoyés à syslog ([Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). -- Prise en charge de la connexion dans les dictionnaires avec une source de bibliothèque partagée ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). -- Prise en charge des délimiteurs CSV personnalisés ([Ivan Joukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) -- Ajouté le `date_time_input_format` paramètre. Si vous basculez ce paramètre sur `'best_effort'`, Les valeurs DateTime seront lues dans un large éventail de formats. -- Ajouté le `clickhouse-obfuscator` utilitaire pour l'obscurcissement des données. Exemple d'utilisation: publication des données utilisées dans les tests de performance. - -#### Caractéristiques expérimentales: {#experimental-features-2} - -- Ajout de la possibilité de calculer `and` arguments uniquement là où ils sont nécessaires ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) -- La compilation JIT en code natif est maintenant disponible pour certaines expressions ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). - -#### Corrections de bugs: {#bug-fixes-20} - -- Les doublons n'apparaissent plus pour une requête avec `DISTINCT` et `ORDER BY`. -- Les requêtes avec `ARRAY JOIN` et `arrayFilter` ne renvoie plus un résultat incorrect. -- Correction d'une erreur lors de la lecture d'une colonne de tableau à partir d'une structure Imbriquée ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). -- Correction d'une erreur lors de l'analyse des requêtes avec une clause HAVING comme `HAVING tuple IN (...)`. -- Correction d'une erreur lors de l'analyse des requêtes avec récursive des alias. -- Correction d'une erreur lors de la lecture de ReplacingMergeTree avec une condition dans PREWHERE qui filtre Toutes les lignes ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). -- Les paramètres de profil utilisateur n'ont pas été appliqués lors de l'utilisation de sessions dans L'interface HTTP. -- Correction de la façon dont les paramètres sont appliqués à partir des paramètres de ligne de commande dans clickhouse-local. -- La bibliothèque client ZooKeeper utilise maintenant le délai d'attente de session reçu du serveur. -- Correction d'un bug dans la bibliothèque client ZooKeeper lorsque le client attendait la réponse du serveur plus longtemps que le délai d'attente. -- Correction de l'élagage des pièces pour les requêtes avec des conditions sur les colonnes de clé de partition ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). -- Les fusions sont maintenant possibles après `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). -- Le mappage de Type dans la fonction de table ODBC a été corrigé ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). -- Les comparaisons de Type ont été corrigées pour `DateTime` avec et sans le fuseau horaire ([Alexandre Botcharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). -- Correction de l'analyse syntaxique et du formatage `CAST` opérateur. -- Insertion fixe dans une vue matérialisée pour le moteur de table distribué ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). -- Correction d'une condition de concurrence lors de l'écriture de données `Kafka` moteur aux vues matérialisées ([Yangkuan Liu](https://github.com/ClickHouse/ClickHouse/pull/2448)). -- Correction de SSRF dans la fonction de table remote (). -- Comportement de sortie fixe de `clickhouse-client` en mode multi-lignes ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). - -#### Amélioration: {#improvements-11} - -- Les tâches d'arrière plan dans les tables répliquées sont maintenant effectuées dans un pool de threads plutôt que dans des threads séparés ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). -- Amélioration des performances de compression LZ4. -- Analyse plus rapide pour les requêtes avec un grand nombre de jointures et de sous-requêtes. -- Le cache DNS est maintenant mis à jour automatiquement lorsqu'il y a trop d'erreurs réseau. -- Les insertions de Table ne se produisent plus si l'insertion dans l'une des vues matérialisées n'est pas possible car elle comporte trop de parties. -- Correction de l'écart dans les compteurs d'événements `Query`, `SelectQuery`, et `InsertQuery`. -- Des Expressions comme `tuple IN (SELECT tuple)` sont autorisés si les types de tuple correspondent. -- Un serveur avec des tables répliquées peut démarrer même si vous n'avez pas configuré ZooKeeper. -- Lors du calcul du nombre de cœurs CPU disponibles, les limites sur les groupes cgroups sont maintenant prises en compte ([Atri Sharma](https://github.com/ClickHouse/ClickHouse/pull/2325)). -- Ajouté chown pour les répertoires de configuration dans le fichier de configuration systemd ([Mikhaïl Shirjaeva](https://github.com/ClickHouse/ClickHouse/pull/2421)). - -#### Construire des changements: {#build-changes-4} - -- Le compilateur gcc8 peut être utilisé pour les builds. -- Ajout de la possibilité de construire llvm à partir du sous-module. -- La version de la bibliothèque librdkafka a été mise à jour vers v0. 11. 4. -- Ajout de la possibilité d'utiliser la bibliothèque libcpuid du système. La version de la bibliothèque a été mise à jour à 0.4.0. -- Correction de la construction en utilisant la bibliothèque vectorclass ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). -- Cmake génère maintenant des fichiers pour ninja par défaut (comme lors de l'utilisation `-G Ninja`). -- Ajout de la possibilité d'utiliser la bibliothèque libtinfo au lieu de libtermcap ([Georgy Kondratiev](https://github.com/ClickHouse/ClickHouse/pull/2519)). -- Correction d'un conflit de fichier d'en-tête dans Fedora Rawhide ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-7} - -- Retiré échapper dans `Vertical` et `Pretty*` formats et supprimé le `VerticalRaw` format. -- Si des serveurs avec la version 1.1.54388 (ou plus récente) et des serveurs avec une version plus ancienne sont utilisés simultanément dans une requête distribuée et la requête a le `cast(x, 'Type')` expression sans `AS` mot clé et n'a pas le mot `cast` en majuscules, une exception sera levée avec un message du genre `Not found column cast(0, 'UInt8') in block`. Solution: mettez à jour le serveur sur l'ensemble du cluster. - -### Clickhouse version 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} - -#### Corrections de bugs: {#bug-fixes-21} - -- Correction d'une erreur qui, dans certains cas, provoquait le blocage des opérations de ZooKeeper. - -### Clickhouse version 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} - -#### Corrections de bugs: {#bug-fixes-22} - -- Correction d'un ralentissement de la file d'attente de réplication si une table a plusieurs répliques. - -### Clickhouse version 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} - -#### Corrections de bugs: {#bug-fixes-23} - -- Correction d'une fuite de nœuds dans ZooKeeper lorsque ClickHouse perd la connexion au serveur ZooKeeper. - -### Clickhouse version 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} - -#### Nouveauté: {#new-features-13} - -- Ajout de la fonction table `file(path, format, structure)`. Un exemple de lecture d'octets depuis `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. - -#### Amélioration: {#improvements-12} - -- Les sous-requêtes peuvent être encapsulées `()` crochets pour améliorer la lisibilité des requêtes. Exemple: `(SELECT 1) UNION ALL (SELECT 1)`. -- Simple `SELECT` les requêtes de l' `system.processes` le tableau ne sont pas inclus dans le `max_concurrent_queries` limite. - -#### Corrections de bugs: {#bug-fixes-24} - -- Correction d'un comportement incorrect de la `IN` opérateur quand sélectionner à partir de `MATERIALIZED VIEW`. -- Correction d'un filtrage incorrect par index de partition dans des expressions comme `partition_key_column IN (...)`. -- Incapacité fixe à exécuter `OPTIMIZE` requête sur réplica non leader si `REANAME` a été effectuée sur la table. -- Correction de l'erreur d'autorisation lors de l'exécution `OPTIMIZE` ou `ALTER` requêtes sur une réplique non-leader. -- Fixe le gel de l' `KILL QUERY`. -- Correction d'une erreur dans la bibliothèque client ZooKeeper qui a conduit à la perte de montres, le gel de la file d'attente DDL distribuée, et des ralentissements dans la file d'attente de réplication si un non vide `chroot` le préfixe est utilisé dans la configuration de ZooKeeper. - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-8} - -- Suppression du support pour les expressions comme `(a, b) IN (SELECT (a, b))` (vous pouvez utiliser l'expression équivalente `(a, b) IN (SELECT a, b)`). Dans les versions précédentes, ces expressions ont conduit à indéterminé `WHERE` filtrage ou causé des erreurs. - -### Clickhouse version 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} - -#### Nouveauté: {#new-features-14} - -- Niveau d'enregistrement peut être modifié sans redémarrer le serveur. -- Ajouté le `SHOW CREATE DATABASE` requête. -- Le `query_id` peut être passé à `clickhouse-client` (elBroom). -- Nouveau paramètre: `max_network_bandwidth_for_all_users`. -- Ajout du support pour `ALTER TABLE ... PARTITION ...` pour `MATERIALIZED VIEW`. -- Ajout d'informations sur la taille des parties de données sous forme non compressée dans la table système. -- Prise en charge du chiffrement de serveur à serveur pour les tables distribuées (`1` dans la configuration de la réplique ``). -- Configuration du niveau de la table pour `ReplicatedMergeTree` la famille afin de minimiser la quantité de données stockées dans Zookeeper: : `use_minimalistic_checksums_in_zookeeper = 1` -- Configuration de l' `clickhouse-client` invite. Par défaut, les noms de serveur sont maintenant affichés à l'invite. Le nom d'affichage du serveur peut être modifié. Il est également envoyé dans le `X-ClickHouse-Display-Name` En-tête HTTP (Kirill Shvakov). -- Séparés par des virgules multiples `topics` peut être spécifié pour l' `Kafka` moteur (Tobias Adamson) -- Quand une requête est arrêtée par `KILL QUERY` ou `replace_running_query` le client reçoit l' `Query was canceled` exception au lieu d'un résultat incomplète. - -#### Amélioration: {#improvements-13} - -- `ALTER TABLE ... DROP/DETACH PARTITION` les requêtes sont exécutées à l'avant de la file d'attente de réplication. -- `SELECT ... FINAL` et `OPTIMIZE ... FINAL` peut être utilisé même lorsque la table a une seule partie de données. -- A `query_log` la table est recréée à la volée si elle a été supprimée manuellement (Kirill Shvakov). -- Le `lengthUTF8` fonction fonctionne plus rapidement (zhang2014). -- Amélioration des performances des inserts synchrones dans `Distributed` table (`insert_distributed_sync = 1` lorsqu'il existe un très grand nombre de fragments. -- Le serveur accepte le `send_timeout` et `receive_timeout` les paramètres du client et les applique lors de la connexion au client (ils sont appliqués dans l'ordre inverse: le socket du serveur `send_timeout` est définie à l' `receive_timeout` valeur reçue du client, et vice versa). -- Récupération de crash plus robuste pour une insertion asynchrone dans `Distributed` table. -- Le type de retour de la `countEqual` la fonction a changé à partir de `UInt32` de `UInt64` (谢磊). - -#### Corrections de bugs: {#bug-fixes-25} - -- Correction d'une erreur avec `IN` lorsque le côté gauche de l'expression est `Nullable`. -- Les résultats corrects sont maintenant retournés lors de l'utilisation de tuples avec `IN` lorsque certains des composants tuple sont dans l'index de la table. -- Le `max_execution_time` limite fonctionne désormais correctement avec les requêtes distribuées. -- Correction d'erreurs lors du calcul de la taille des colonnes composites `system.columns` table. -- Correction d'une erreur lors de la création d'une table temporaire `CREATE TEMPORARY TABLE IF NOT EXISTS.` -- Erreurs corrigées dans `StorageKafka` (\#\#2075) -- Le serveur fixe se bloque à partir d'arguments non valides de certaines fonctions d'agrégat. -- Correction de l'erreur qui a empêché l' `DETACH DATABASE` requête de l'arrêt des tâches d'arrière-plan pour `ReplicatedMergeTree` table. -- `Too many parts` l'état est moins susceptible de se produire lors de l'insertion dans agrégées des vues matérialisées (\#\#2084). -- Correction de la gestion récursive des substitutions dans la configuration si une substitution doit être suivie d'une autre substitution au même niveau. -- Correction de la syntaxe dans le fichier de métadonnées lors de la création d'un `VIEW` qui utilise une requête avec `UNION ALL`. -- `SummingMergeTree` fonctionne maintenant correctement pour la sommation des structures de données imbriquées avec une clé composite. -- Correction de la possibilité d'une condition de course lors du choix du leader pour `ReplicatedMergeTree` table. - -#### Construire des changements: {#build-changes-5} - -- La construction prend en charge `ninja` plutôt `make` et utilise `ninja` par défaut pour les versions de construction. -- Paquets renommés: `clickhouse-server-base` dans `clickhouse-common-static`; `clickhouse-server-common` dans `clickhouse-server`; `clickhouse-common-dbg` dans `clickhouse-common-static-dbg`. Pour installer, utilisez `clickhouse-server clickhouse-client`. Les paquets avec les anciens noms seront toujours chargés dans les dépôts pour une compatibilité descendante. - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-9} - -- Retiré de l'interprétation d'une expression si un tableau est spécifié sur le côté gauche. Auparavant, l'expression `arr IN (set)` a été interprété comme “at least one `arr` element belongs to the `set`”. Pour obtenir le même comportement dans la nouvelle version, écrire `arrayExists(x -> x IN (set), arr)`. -- Désactivé l'utilisation incorrecte de l'option socket `SO_REUSEPORT`, qui a été incorrectement activé par défaut dans la bibliothèque Poco. Notez que sous Linux il n'y a plus aucune raison de spécifier simultanément les adresses `::` et `0.0.0.0` for listen – use just `::`, qui permet d'écouter la connexion à la fois sur IPv4 et IPv6 (avec les paramètres de configuration du noyau par défaut). Vous pouvez également revenir au comportement des versions précédentes en spécifiant `1` dans la config. - -### Clickhouse version 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} - -#### Nouveauté: {#new-features-15} - -- Ajouté le `system.macros` table et mise à jour automatique des macros lorsque le fichier de configuration est modifié. -- Ajouté le `SYSTEM RELOAD CONFIG` requête. -- Ajouté le `maxIntersections(left_col, right_col)` fonction d'agrégation, qui retourne le nombre maximal d'simultanément intersection d'intervalles `[left; right]`. Le `maxIntersectionsPosition(left, right)` fonction retourne le début de la “maximum” intervalle. ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). - -#### Amélioration: {#improvements-14} - -- Lors de l'insertion de données dans une `Replicated` tableau, moins de demandes sont faites à `ZooKeeper` (et la plupart des erreurs au niveau de l'utilisateur ont disparu de la `ZooKeeper` journal). -- Ajout de la possibilité de créer des alias pour les ensembles de données. Exemple: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. - -#### Corrections de bugs: {#bug-fixes-26} - -- Correction de l' `Illegal PREWHERE` erreur lors de la lecture des tables de fusion pour `Distributed`table. -- Ajout de correctifs qui vous permettent de démarrer clickhouse-server dans des conteneurs Docker IPv4 uniquement. -- Correction d'une condition de course lors de la lecture du système `system.parts_columns tables.` -- Suppression de la double mise en mémoire tampon lors d'un insert synchrone `Distributed` table, ce qui aurait pu provoquer la connexion à timeout. -- Correction d'un bug qui a causé des attentes trop longues pour une réplique indisponible avant de commencer un `SELECT` requête. -- Correction de dates incorrectes dans le `system.parts` table. -- Correction d'un bug qui rendait impossible l'insertion de données dans un `Replicated` le tableau si `chroot` était non vide dans la configuration du `ZooKeeper` cluster. -- Correction de l'algorithme de fusion verticale pour un `ORDER BY` table. -- Restauré la possibilité d'utiliser des dictionnaires dans les requêtes aux tables distantes, même si ces dictionnaires ne sont pas présents sur le serveur demandeur. Cette fonctionnalité a été perdue dans la version 1.1.54362. -- Restauré le comportement pour les requêtes comme `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` lorsque le côté droit de la `IN` devrait utiliser une télécommande `default.table` au lieu d'un local. Ce comportement a été rompu dans la version 1.1.54358. -- Suppression de la journalisation au niveau des erreurs `Not found column ... in block`. - -### Clickhouse Version 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} - -#### Nouveauté: {#new-features-16} - -- Agrégation sans `GROUP BY` pour un ensemble vide (comme `SELECT count(*) FROM table WHERE 0`) renvoie maintenant un résultat avec une ligne avec des valeurs null pour les fonctions d'agrégation, conformément à la norme SQL. Pour restaurer l'ancien comportement (renvoyer un résultat vide), définissez `empty_result_for_aggregation_by_empty_set` 1. -- Conversion de type ajouté pour `UNION ALL`. Différents noms d'alias sont autorisés dans `SELECT` les positions dans `UNION ALL` en conformité avec le standard SQL. -- Les expressions arbitraires sont prises en charge dans `LIMIT BY` clause. Auparavant, il était seulement possible d'utiliser des colonnes résultant de `SELECT`. -- Un indice de `MergeTree` tables est utilisé lorsque `IN` est appliqué à un n-uplet d'expressions à partir des colonnes de la clé primaire. Exemple: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). -- Ajouté le `clickhouse-copier` outil pour copier entre les clusters et remodeler les données (beta). -- Ajout de fonctions de hachage cohérentes: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. Ils peuvent être utilisés comme une clé de sharding afin de réduire la quantité de trafic réseau lors de remaniements ultérieurs. -- L'ajout de fonctions: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. -- Ajouté le `arrayCumSum` fonction (Javi Santana). -- Ajouté le `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, et `parseDateTimeBestEffortOrNull` fonctions pour lire le DateTime à partir d'une chaîne contenant du texte dans une grande variété de formats possibles. -- Les données peuvent être partiellement rechargées à partir de dictionnaires externes lors de la mise à jour (charger uniquement les enregistrements dans lesquels la valeur du champ spécifié supérieure à celle du téléchargement précédent) (Arsen Hakobyan). -- Ajouté le `cluster` table de fonction. Exemple: `cluster(cluster_name, db, table)`. Le `remote` la fonction table peut accepter le nom du cluster comme premier argument, s'il est spécifié comme identifiant. -- Le `remote` et `cluster` les fonctions de table peuvent être utilisées dans `INSERT` requête. -- Ajouté le `create_table_query` et `engine_full` colonnes virtuelles au `system.tables`table . Le `metadata_modification_time` la colonne est virtuel. -- Ajouté le `data_path` et `metadata_path` les colonnes à `system.tables`et`system.databases` tables, et a ajouté le `path` la colonne de la `system.parts` et `system.parts_columns` table. -- Ajout d'informations supplémentaires sur les fusions `system.part_log` table. -- Une clé de partitionnement arbitraire peut être utilisée pour `system.query_log` table (Kirill Shvakov). -- Le `SHOW TABLES` query affiche maintenant également des tables temporaires. Ajout de tables temporaires et `is_temporary` colonne de `system.tables` (zhang2014). -- Ajouter `DROP TEMPORARY TABLE` et `EXISTS TEMPORARY TABLE` les requêtes (zhang2014). -- Soutien pour `SHOW CREATE TABLE` pour les tables temporaires (zhang2014). -- Ajouté le `system_profile` paramètre de configuration pour les paramètres utilisés par les processus internes. -- Soutien pour le chargement `object_id` comme un attribut de `MongoDB` dictionnaires (Pavel Litvinenko). -- Lecture `null` comme valeur par défaut lors du chargement de données pour un dictionnaire externe `MongoDB` source (Pavel Litvinenko). -- Lecture `DateTime` les valeurs dans la `Values` formater à partir D'un horodatage Unix sans guillemets simples. -- Le basculement est pris en charge dans `remote` fonctions de table pour les cas où certaines répliques manquent la table demandée. -- Les paramètres de Configuration peuvent être remplacées dans la ligne de commande lorsque vous exécutez `clickhouse-server`. Exemple: `clickhouse-server -- --logger.level=information`. -- Mise en œuvre de la `empty` fonction à partir d'un `FixedString` argument: la fonction renvoie 1 si la chaîne est entièrement composée d'octets nuls (zhang2014). -- Ajouté le `listen_try`paramètre de configuration pour l'écoute d'au moins une des adresses listen sans quitter, si certaines adresses ne peuvent pas être écoutées (utile pour les systèmes avec prise en charge désactivée pour IPv4 ou IPv6). -- Ajouté le `VersionedCollapsingMergeTree` tableau moteur. -- Prise en charge des lignes et des types numériques arbitraires `library` source du dictionnaire. -- `MergeTree` les tableaux peuvent être utilisés sans une clé primaire (vous devez spécifier `ORDER BY tuple()`). -- A `Nullable` peut être de type `CAST` pour un non-`Nullable` type si l'argument n'est pas `NULL`. -- `RENAME TABLE` peut être effectuée pour `VIEW`. -- Ajouté le `throwIf` fonction. -- Ajouté le `odbc_default_field_size` option, qui vous permet d'étendre la taille maximale de la valeur chargée à partir D'une source ODBC (par défaut, il est 1024). -- Le `system.processes` table et `SHOW PROCESSLIST` ont maintenant la `is_cancelled` et `peak_memory_usage` colonne. - -#### Amélioration: {#improvements-15} - -- Les limites et quotas sur le résultat ne sont plus appliqués aux données intermédiaires pour `INSERT SELECT` les requêtes ou pour `SELECT` les sous-requêtes. -- Moins de faux déclencheurs de `force_restore_data` lors de la vérification de l'état de `Replicated` les tables lorsque le serveur démarre. -- Ajouté le `allow_distributed_ddl` option. -- Les fonctions non déterministes ne sont pas autorisées dans les expressions `MergeTree` table de clés. -- Fichiers avec des substitutions de `config.d` les répertoires sont chargés par ordre alphabétique. -- Amélioration de la performance de l' `arrayElement` fonction dans le cas d'une constante tableau multidimensionnel avec un tableau vide comme l'un des éléments. Exemple: `[[1], []][x]`. -- Le serveur démarre plus rapidement maintenant lors de l'utilisation de fichiers de configuration avec de très grandes substitutions (par exemple, de très grandes listes de réseaux IP). -- Lors de l'exécution d'une requête, les fonctions de valeur de table s'exécutent une fois. Précédemment, `remote` et `mysql` les fonctions à valeur de table ont effectué la même requête deux fois pour récupérer la structure de la table à partir d'un serveur distant. -- Le `MkDocs` générateur de documentation est utilisé. -- Lorsque vous essayez de supprimer une colonne de table `DEFAULT`/`MATERIALIZED` les expressions des autres colonnes dépendent, une exception est levée (zhang2014). -- Ajout de la possibilité d'analyser une ligne vide dans des formats de texte comme le nombre 0 pour `Float` types de données. Cette fonctionnalité était auparavant disponible mais a été perdue dans la version 1.1.54342. -- `Enum` les valeurs peuvent être utilisés dans `min`, `max`, `sum` et quelques autres fonctions. Dans ces cas, il utilise des valeurs numériques correspondantes. Cette fonctionnalité était auparavant disponible mais a été perdue dans la version 1.1.54337. -- Ajouter `max_expanded_ast_elements` pour limiter la taille de L'AST après l'expansion récursive des alias. - -#### Corrections de bugs: {#bug-fixes-27} - -- Correction de cas où des colonnes inutiles ont été supprimées des sous-requêtes par erreur, ou non supprimées des sous-requêtes contenant `UNION ALL`. -- Correction d'un bug dans les fusions pour `ReplacingMergeTree` table. -- Insertions synchrones fixes dans `Distributed` table (`insert_distributed_sync = 1`). -- Fixe erreur de segmentation pour certaines utilisations de `FULL` et `RIGHT JOIN` avec des colonnes en double dans les sous-requêtes. -- Fixe erreur de segmentation pour certaines utilisations de `replace_running_query` et `KILL QUERY`. -- Fixe l'ordre du `source` et `last_exception` les colonnes dans l' `system.dictionaries` table. -- Correction d'un bug lors de l' `DROP DATABASE` la requête n'a pas supprimé le fichier contenant des métadonnées. -- Correction de l' `DROP DATABASE` requête pour `Dictionary` les bases de données. -- Fixe la faible précision de `uniqHLL12` et `uniqCombined` fonctions pour les cardinalités supérieures à 100 millions d'articles (Alex Bocharov). -- Correction du calcul des valeurs par défaut implicites si nécessaire pour calculer simultanément des expressions explicites par défaut dans `INSERT` les requêtes (zhang2014). -- Correction d'un cas rare lorsqu'une requête à un `MergeTree` la table n'a pas pu finir (chenxing-xc). -- Correction d'un plantage survenu lors de l'exécution d'un `CHECK` requête pour `Distributed` tables si tous les fragments sont locaux (chenxing.xc). -- Correction d'une légère régression des performances avec des fonctions qui utilisent des expressions régulières. -- Correction d'une régression de performance lors de la création de tableaux multidimensionnels à partir d'expressions complexes. -- Correction d'un bug qui pourrait causer un supplément `FORMAT` article à paraître dans un `.sql` fichier de métadonnées. -- Correction d'un bug qui a causé la `max_table_size_to_drop` limite à appliquer lorsque vous essayez de supprimer un `MATERIALIZED VIEW` en regardant une table explicitement spécifiée. -- Correction de l'incompatibilité avec les anciens clients (les anciens clients étaient parfois envoyés `DateTime('timezone')` type, dont ils ne comprennent pas). -- Correction d'un bug lors de la lecture `Nested` éléments de colonne de structures qui ont été ajoutés en utilisant `ALTER` mais qui sont vides pour les anciennes partitions, lorsque les conditions de ces colonnes a déménagé à `PREWHERE`. -- Correction d'un bug lors du filtrage des tables virtuelles `_table` colonnes dans les requêtes à `Merge` table. -- Correction d'un bug lors de l'utilisation `ALIAS` les colonnes en `Distributed` table. -- Correction d'un bug qui rendait la compilation dynamique impossible pour les requêtes avec des fonctions `quantile` famille. -- Correction d'une condition de concurrence dans le pipeline d'exécution de requête qui s'est produite dans de très rares cas lors de l'utilisation `Merge` avec un grand nombre de tables, et lors de l'utilisation `GLOBAL` les sous-requêtes. -- Correction d'un crash lors du passage de tableaux de tailles différentes pour un `arrayReduce` fonction lors de l'utilisation de fonctions d'agrégation à partir de plusieurs arguments. -- Interdit l'utilisation de requêtes avec `UNION ALL` dans un `MATERIALIZED VIEW`. -- Correction d'une erreur lors de l'initialisation du `part_log` table système au démarrage du serveur (par défaut, `part_log` est désactivée). - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-10} - -- Enlevé le `distributed_ddl_allow_replicated_alter` option. Ce comportement est activé par défaut. -- Enlevé le `strict_insert_defaults` paramètre. Si vous utilisez cette fonctionnalité, écrivez à `clickhouse-feedback@yandex-team.com`. -- Enlevé le `UnsortedMergeTree` moteur. - -### Clickhouse Version 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} - -- Ajout de la prise en charge des macros pour définir les noms de cluster dans les requêtes DDL distribuées et les constructeurs de tables distribuées: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. -- Maintenant requêtes comme `SELECT ... FROM table WHERE expr IN (subquery)` sont traitées à l'aide de la `table` index. -- Amélioration du traitement des doublons lors de l'insertion dans des tables répliquées, de sorte qu'ils ne ralentissent plus l'exécution de la file d'attente de réplication. - -### Clickhouse Version 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} - -Cette version contient des corrections de bugs pour la version précédente 1.1.54337: - -- Correction d'une régression dans 1.1.54337: si l'utilisateur par défaut a un accès en lecture seule, le serveur refuse de démarrer avec le message `Cannot create database in readonly mode`. -- Correction d'une régression dans 1.1.54337: sur les systèmes avec systemd, les journaux sont toujours écrits dans syslog quelle que soit la configuration; le script watchdog utilise toujours init.d. -- Correction d'une régression dans 1.1.54337: mauvaise configuration par défaut dans L'image Docker. -- Correction du comportement non déterministe de GraphiteMergeTree (vous pouvez le voir dans les messages de journal `Data after merge is not byte-identical to the data on another replicas`). -- Correction d'un bug qui peut conduire à des fusions incohérentes après optimiser la requête aux tables répliquées (vous pouvez le voir dans les messages de journal `Part ... intersects the previous part`). -- Les tables tampon fonctionnent maintenant correctement lorsque des colonnes matérialisées sont présentes dans la table de destination (par zhang2014). -- Correction d'un bug dans la mise en œuvre de NULL. - -### Clickhouse Version 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} - -#### Nouveauté: {#new-features-17} - -- Ajout du support pour le stockage de tableaux et de tuples multidimensionnels (`Tuple` type de données) dans les tableaux. -- Prise en charge des fonctions de table pour `DESCRIBE` et `INSERT` requête. Ajout du support pour les sous-requêtes dans `DESCRIBE`. Exemple: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. Soutien pour `INSERT INTO TABLE` outre `INSERT INTO`. -- Amélioration du support pour les fuseaux horaires. Le `DateTime` le type de données peut être annoté avec le fuseau horaire utilisé pour l'analyse et le formatage dans les formats de texte. Exemple: `DateTime('Europe/Moscow')`. Lorsque les fuseaux horaires sont spécifiés dans les fonctions `DateTime` arguments, le type de retour pour suivre le fuseau horaire, et la valeur sera affichée comme prévu. -- Ajout des fonctions `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. Le `toRelativeHour`/`Minute`/`Second` les fonctions peuvent prendre une valeur de type `Date` comme argument. Le `now` nom de la fonction est sensible à la casse. -- Ajouté le `toStartOfFifteenMinutes` fonction (Kirill Shvakov). -- Ajouté le `clickhouse format` outil de formatage des requêtes. -- Ajouté le `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` format. Les fichiers de schéma peuvent être situés uniquement dans le répertoire spécifié. -- Ajout du support pour les substitutions de configuration (`incl` et `conf.d`) pour la configuration de dictionnaires et de modèles externes (Pavel Yakunin). -- Ajout d'une colonne avec la documentation pour le `system.settings` table (Kirill Shvakov). -- Ajouté le `system.parts_columns` table avec des informations sur la taille des colonnes dans chaque partie `MergeTree` table. -- Ajouté le `system.models` tableau avec des informations sur chargé `CatBoost` machine de modèles d'apprentissage. -- Ajouté le `mysql` et `odbc` fonction de table et correspondant `MySQL` et `ODBC` moteurs de table pour accéder aux bases de données distantes. Cette fonctionnalité est en phase bêta. -- Ajout de la possibilité de passer un argument de type `AggregateFunction` pour l' `groupArray` fonction d'agrégation (vous pouvez donc créer un tableau d'États d'une fonction d'agrégation). -- Suppression des restrictions sur diverses combinaisons de combinateurs de fonction d'agrégat. Par exemple, vous pouvez utiliser `avgForEachIf` ainsi que `avgIfForEach` les fonctions d'agrégation, qui ont des comportements différents. -- Le `-ForEach` fonction d'agrégation combinator est prolongée pour le cas des fonctions d'agrégation de plusieurs arguments. -- Ajout du support pour les fonctions d'agrégation de `Nullable` arguments même pour les cas où la fonction renvoie un non-`Nullable` résultat (ajouté avec la contribution de Silviu Caragea). Exemple: `groupArray`, `groupUniqArray`, `topK`. -- Ajouté le `max_client_network_bandwidth` pour `clickhouse-client` (Kirill Shvakov). -- Les utilisateurs avec le `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). -- Ajout du support pour l'utilisation de plusieurs consommateurs avec le `Kafka` moteur. Options de configuration étendues pour `Kafka` (Marek Vavruša). -- Ajouté le `intExp3` et `intExp4` fonction. -- Ajouté le `sumKahan` fonction d'agrégation. -- Ajout des fonctions to\* Number \* OrNull, où \* Number \* est un type numérique. -- Ajout du support pour `WITH` clauses pour un `INSERT SELECT` requête (auteur: zhang2014). -- Ajout des paramètres de: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. En particulier, ces paramètres sont utilisés pour télécharger des parties de données pour la réplication. La modification de ces paramètres permet un basculement plus rapide si le réseau est surchargé. -- Ajout du support pour `ALTER` pour les tables de type `Null` (Anastasiya Tsarkova). -- Le `reinterpretAsString` la fonction est étendue pour tous les types de données stockés de manière contiguë en mémoire. -- Ajouté le `--silent` option pour le `clickhouse-local` outil. Il supprime les informations d'exécution de requête d'impression dans stderr. -- Ajout du support pour la lecture des valeurs de type `Date` à partir du texte dans un format où le mois et / ou le jour du mois est spécifié en utilisant un seul chiffre au lieu de deux chiffres (oiseau Amos). - -#### Optimisations des performances: {#performance-optimizations} - -- Amélioration des performances des fonctions d'agrégation `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` à partir d'arguments de chaîne. -- Amélioration des performances des fonctions `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. -- Amélioration des performances de l'analyse et du formatage `Date` et `DateTime` tapez les valeurs au format texte. -- Amélioration des performances et de la précision de l'analyse des nombres à virgule flottante. -- Abaissé l'utilisation de la mémoire pour `JOIN` dans le cas où les parties gauche et droite ont des colonnes avec des noms identiques qui ne sont pas contenus dans `USING` . -- Amélioration des performances des fonctions d'agrégation `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` en réduisant la stabilité de calcul. Les anciennes fonctions sont disponibles sous les noms de `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. - -#### Corrections de bugs: {#bug-fixes-28} - -- Déduplication de données fixe après l'exécution d'un `DROP` ou `DETACH PARTITION` requête. Dans la version précédente, la suppression d'une partition et l'insertion à nouveau des mêmes données ne fonctionnaient pas car les blocs insérés étaient considérés comme des doublons. -- Correction d'un bug qui pourrait conduire à une interprétation incorrecte de la `WHERE` la clause de `CREATE MATERIALIZED VIEW` les requêtes avec `POPULATE` . -- Correction d'un bug dans l'utilisation de l' `root_path` paramètre dans l' `zookeeper_servers` configuration. -- Correction des résultats inattendus du passage du `Date` argument `toStartOfDay` . -- Correction de l' `addMonths` et `subtractMonths` fonctions et l'arithmétique pour `INTERVAL n MONTH` dans les cas où le résultat de l'année précédente. -- Ajout du support manquant pour le `UUID` type de données pour `DISTINCT` , `JOIN` , et `uniq` fonctions agrégées et dictionnaires externes (Evgeniy Ivanov). Soutien pour `UUID` est encore incomplète. -- Fixe `SummingMergeTree` comportement dans les cas où les lignes additionnées à zéro. -- Diverses corrections pour le `Kafka` engine (Marek Vavruša). -- Correction d'un comportement incorrect de la `Join` moteur de table (oiseau Amos). -- Correction d'un comportement d'allocateur incorrect sous FreeBSD et OS X. -- Le `extractAll` fonction prend désormais en charge les correspondances vides. -- Correction d'une erreur qui bloquait l'utilisation de `libressl` plutôt `openssl` . -- Correction de l' `CREATE TABLE AS SELECT` requête à partir de tables temporaires. -- Correction de la non-atomicité de la mise à jour de la file d'attente de réplication. Cela peut entraîner la désynchronisation des répliques jusqu'au redémarrage du serveur. -- Correction d'un débordement possible dans `gcd` , `lcm` et `modulo` (`%` de l'opérateur) (Mak Skorokhod). -- `-preprocessed` les fichiers sont maintenant créés après modification `umask` (`umask` peut être changé dans le fichier de configuration). -- Correction d'un bug dans la vérification des antécédents des pièces (`MergeTreePartChecker` ) lors de l'utilisation d'une coutume clé de partition. -- Correction de l'analyse des tuples (valeurs du `Tuple` type de données) dans des formats de texte. -- Amélioration des messages d'erreur sur les types incompatibles transmis à `multiIf` , `array` et quelques autres fonctions. -- Repensé de soutien pour `Nullable` type. Correction de bugs qui peuvent conduire à un plantage du serveur. Correction de presque tous les autres bugs liés à `NULL` support: conversions de type incorrectes dans INSERT SELECT, support insuffisant pour Nullable dans HAVING et PREWHERE, `join_use_nulls` mode, Nullable types comme arguments de `OR` l'opérateur, etc. -- Correction de divers bugs liés à la sémantique interne des types de données. Exemples: sommation inutile de `Enum` tapez les champs dans `SummingMergeTree` ; l'alignement de la `Enum` types de `Pretty` formats, etc. -- Contrôles plus stricts pour les combinaisons autorisées de colonnes composites. -- Correction du débordement lors de la spécification d'un très grand paramètre pour le `FixedString` type de données. -- Correction d'un bug dans l' `topK` fonction d'agrégation dans un cas générique. -- Ajout de la vérification manquante pour l'égalité des tailles de tableau dans les arguments de n-ARY variantes de fonctions d'agrégation avec un `-Array` combinator. -- Correction d'un bug dans `--pager` pour `clickhouse-client` (auteur: ks1322). -- Fixe la précision de la `exp10` fonction. -- Correction du comportement du `visitParamExtract` fonction pour une meilleure conformité avec la documentation. -- Correction du crash lorsque des types de données incorrects sont spécifiés. -- Correction du comportement de `DISTINCT` dans le cas lorsque toutes les colonnes sont des constantes. -- Correction du formatage de la requête dans le cas de l'utilisation du `tupleElement` fonction avec une expression constante complexe comme indice d'élément tuple. -- Correction d'un bug dans `Dictionary` tables pour `range_hashed` dictionnaire. -- Correction d'un bug qui conduit à des lignes excessives dans le résultat de `FULL` et `RIGHT JOIN` (Oiseau Amos). -- Correction d'un plantage du serveur lors de la création et de la suppression de fichiers temporaires `config.d` répertoires pendant le rechargement de la configuration. -- Correction de l' `SYSTEM DROP DNS CACHE` requête: le cache a été vidé mais les adresses des nœuds de cluster n'ont pas été mises à jour. -- Correction du comportement de `MATERIALIZED VIEW` après l'exécution de `DETACH TABLE` for the table under the view (Marek Vavruša). - -#### Construire des améliorations: {#build-improvements-4} - -- Le `pbuilder` l'outil est utilisé pour les versions. Le processus de construction est presque complètement indépendant de l'environnement hôte de construction. -- Une seule version est utilisée pour différentes versions du système d'exploitation. Les paquets et les binaires ont été rendus compatibles avec un large éventail de systèmes Linux. -- Ajouté le `clickhouse-test` paquet. Il peut être utilisé pour exécuter des tests fonctionnels. -- L'archive source peut maintenant être publié dans le référentiel. Il peut être utilisé pour reproduire la construction sans utiliser GitHub. -- Ajout d'une intégration limitée avec Travis CI. En raison des limites de temps de construction dans Travis, seule la construction de débogage est testée et un sous-ensemble limité de tests est exécuté. -- Ajout du support pour `Cap'n'Proto` dans la construction par défaut. -- Modification du format des sources de documentation à partir de `Restricted Text` de `Markdown`. -- Ajout du support pour `systemd` (Vladimir Smirnov). Il est désactivé par défaut en raison d'une incompatibilité avec certaines images du système D'exploitation et peut être activé manuellement. -- Pour la génération de code dynamique, `clang` et `lld` sont intégrées dans le `clickhouse` binaire. Ils peuvent également être invoqués comme `clickhouse clang` et `clickhouse lld` . -- Suppression de l'utilisation des extensions GNU du code. Permis à l' `-Wextra` option. Lors de la construction avec `clang` la valeur par défaut est `libc++` plutôt `libstdc++`. -- Extrait `clickhouse_parsers` et `clickhouse_common_io` les bibliothèques pour accélérer les constructions des différents outils. - -#### Modifications incompatibles en arrière: {#backward-incompatible-changes-11} - -- Le format des marques dans `Log` tapez les tables qui contiennent `Nullable` les colonnes ont été modifiées d'une manière incompatible avec l'arrière. Si vous avez ces tables, vous devez les convertir en `TinyLog` tapez avant de démarrer la nouvelle version du serveur. Pour ce faire, remplacez `ENGINE = Log` avec `ENGINE = TinyLog` dans le correspondant `.sql` fichier dans le `metadata` répertoire. Si votre table n'a pas `Nullable` les colonnes ou si le type de votre table n'est pas `Log`, alors vous n'avez pas besoin de faire quoi que ce soit. -- Enlevé le `experimental_allow_extended_storage_definition_syntax` paramètre. Maintenant cette fonctionnalité est activée par défaut. -- Le `runningIncome` fonction a été renommée en `runningDifferenceStartingWithFirstvalue` pour éviter toute confusion. -- Enlevé le `FROM ARRAY JOIN arr` syntaxe lorsque la jointure du tableau est spécifiée directement après FROM sans table (Amos Bird). -- Enlevé le `BlockTabSeparated` format utilisé uniquement à des fins de démonstration. -- Modification du format d'État pour les fonctions d'agrégation `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Si vous avez stocké des états de ces fonctions d'agrégat dans des tables (en utilisant `AggregateFunction` type de données ou vues matérialisées avec les états correspondants), écrivez svp à clickhouse-feedback@yandex-team.com. -- Dans les versions précédentes du serveur, il y avait une fonctionnalité non documentée: si une fonction d'agrégation dépend de paramètres, vous pouvez toujours la spécifier sans paramètres dans le type de données AggregateFunction. Exemple: `AggregateFunction(quantiles, UInt64)` plutôt `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. Cette fonctionnalité a été perdu. Bien qu'il ne soit pas documenté, nous prévoyons de le soutenir à nouveau dans les prochaines versions. -- Les types de données Enum ne peuvent pas être utilisés dans les fonctions d'agrégat min/max. Cette capacité sera rendu dans la prochaine version. - -#### Veuillez noter lors de la mise à niveau: {#please-note-when-upgrading} - -- Lorsque vous effectuez une mise à jour continue sur un cluster, au moment où certaines répliques exécutent L'ancienne version de ClickHouse et d'autres la nouvelle version, la réplication est temporairement arrêtée et le message `unknown parameter 'shard'` apparaît dans le journal. La réplication se poursuivra après la mise à jour de toutes les répliques du cluster. -- Si différentes versions de ClickHouse sont en cours d'exécution sur les serveurs de cluster, il est possible que les requêtes distribuées utilisant les fonctions suivantes aient des résultats incorrects: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Vous devez mettre à jour tous les nœuds de cluster. - -## [Changelog pour 2017](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/fr/whats_new/changelog/2019.md b/docs/fr/whats_new/changelog/2019.md deleted file mode 100644 index 5c52d19ebae..00000000000 --- a/docs/fr/whats_new/changelog/2019.md +++ /dev/null @@ -1,2074 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 77 -toc_title: '2019' ---- - -## Clickhouse version v19. 17 {#clickhouse-release-v19-17} - -### Clickhouse version v19. 17. 6. 36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} - -#### Bug Fix {#bug-fix} - -- Dépassement de tampon potentiel fixe en décompression. Un utilisateur malveillant peut transmettre des données compressées fabriquées qui pourraient provoquer une lecture après le tampon. Ce problème a été trouvé par Eldar Zaitov de l'équipe de sécurité de L'information Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction possible plantage du serveur (`std::terminate`) lorsque le serveur ne peut pas envoyer ou écrire des données au format JSON ou XML avec des valeurs de type string data (qui nécessitent une validation UTF-8) ou lors de la compression des données de résultat avec l'algorithme Brotli ou dans certains autres cas rares. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Dictionnaires fixes avec la source d'un clickhouse `VIEW`, maintenant la lecture de tels dictionnaires ne provoque pas l'erreur `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixe vérifier si un hôte client est autorisé par host\_regexp spécifié dans les utilisateurs.XML. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- `RENAME TABLE` pour une table distribuée renomme maintenant le dossier contenant les données insérées avant d'envoyer aux fragments. Cela résout un problème avec les renommages successifs `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- `range_hashed` les dictionnaires externes créés par des requêtes DDL autorisent désormais des plages de types numériques arbitraires. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alésapine](https://github.com/alesapin)) -- Fixe `INSERT INTO table SELECT ... FROM mysql(...)` table de fonction. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- Fixe erreur de segmentation dans `INSERT INTO TABLE FUNCTION file()` lors de l'insertion dans un fichier qui n'existe pas. Maintenant, dans ce cas, le fichier sera créé et insérez seraient traités. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- Correction d'une erreur bitmapAnd lors de l'intersection d'un bitmap agrégé et d'un bitmap scalaire. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -- Correction de segfault quand `EXISTS` la requête a été utilisé sans `TABLE` ou `DICTIONARY` qualificatif, tout comme `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Type de retour fixe pour les fonctions `rand` et `randConstant` en cas d'argument nullable. Maintenant renvoient toujours `UInt32` et jamais `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixe `DROP DICTIONARY IF EXISTS db.dict` maintenant il ne lance pas d'exception si `db` n'existe pas. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- Si une table n'a pas été complètement abandonnée en raison d'un plantage du serveur, le serveur essaiera de la restaurer et de la charger [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- Correction d'une requête de comptage trivial pour une table distribuée s'il y a plus de deux tables locales de fragments. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- Correction d'un bug qui conduisait à une course de données dans DB:: BlockStreamProfileInfo:: calculateRowsBeforeLimit() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -- Fixe `ALTER table MOVE part` exécuté immédiatement après la fusion de la partie spécifiée, ce qui pourrait provoquer le déplacement d'une partie la partie fusionné. Maintenant, il déplace correctement la partie spécifiée. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Les Expressions pour les dictionnaires peuvent maintenant être spécifiées en tant que chaînes. Ceci est utile pour le calcul des attributs lors de l'extraction de données à partir de sources non-ClickHouse, car il permet d'utiliser une syntaxe non-ClickHouse pour ces expressions. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alésapine](https://github.com/alesapin)) -- Correction d'une course très rare dans `clickhouse-copier` en raison d'un débordement dans ZXid. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- Correction du bug quand après la requête a échoué (en raison de “Too many simultaneous queries” par exemple) il ne lirait pas les informations des tables externes, et le - la requête suivante interpréterait cette information comme le début de la requête suivante provoquant une erreur comme `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- Éviter la déréférence nulle après “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- Restaurer la prise en charge de tous les paramètres régionaux ICU, ajouter la possibilité d'appliquer des collations pour les expressions constantes et ajouter le nom de la langue au système.tableau de collations. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alésapine](https://github.com/alesapin)) -- Nombre de flux pour lire à partir `StorageFile` et `StorageHDFS` est maintenant limitée, pour éviter de dépasser la limite de mémoire. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alésapine](https://github.com/alesapin)) -- Fixe `CHECK TABLE` requête pour `*MergeTree` les tables sans clé. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alésapine](https://github.com/alesapin)) -- Suppression du numéro de mutation d'un nom de pièce au cas où il n'y aurait pas de mutations. Cette suppression a amélioré la compatibilité avec les anciennes versions. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alésapine](https://github.com/alesapin)) -- Correction du bug que les mutations sont ignorées pour certaines parties attachées en raison de leur data\_version sont plus grandes que la version de mutation de table. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) -- Autoriser le démarrage du serveur avec des copies redondantes des pièces après les avoir déplacées vers un autre périphérique. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction de l'erreur “Sizes of columns doesn’t match” qui pourraient apparaître lors de l'utilisation de fonction d'agrégation des colonnes. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- Maintenant, une exception sera levée en cas d'utilisation avec des liens à côté de LIMIT BY. Et maintenant, il est possible d'utiliser TOP avec LIMIT BY. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Correction du rechargement du dictionnaire s'il a `invalidate_query`, qui a arrêté les mises à jour et une exception sur les tentatives de mise à jour précédentes. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alésapine](https://github.com/alesapin)) - -### Clickhouse version v19. 17. 4. 11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} - -#### Modification Incompatible En Arrière {#backward-incompatible-change} - -- Utilisation de column au lieu de AST pour stocker les résultats de la sous-requête scalaire pour de meilleures performances. Paramètre `enable_scalar_subquery_optimization` a été ajouté dans 19.17 et il a été activé par défaut. Cela conduit à des erreurs comme [ce](https://github.com/ClickHouse/ClickHouse/issues/7851) lors de la mise à niveau vers 19.17.2 ou 19.17.3 à partir des versions précédentes. Ce paramètre a été désactivé par défaut dans 19.17.4, pour permettre la mise à niveau à partir de 19.16 et des versions plus anciennes sans erreurs. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos Oiseau](https://github.com/amosbird)) - -#### Nouveauté {#new-feature} - -- Ajoutez la possibilité de créer des dictionnaires avec des requêtes DDL. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alésapine](https://github.com/alesapin)) -- Faire `bloom_filter` type de support d'index `LowCardinality` et `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ajouter une fonction `isValidJSON` pour vérifier que la chaîne est un json valide. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) -- Mettre `arrayCompact` fonction [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Mémo](https://github.com/Joeywzr)) -- Créé fonction `hex` pour les nombres Décimaux. Il fonctionne comme `hex(reinterpretAsString())`, mais ne supprime pas les derniers octets zéro. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) -- Ajouter `arrayFill` et `arrayReverseFill` fonctions, qui remplacent les éléments par d'autres éléments en avant / arrière d'eux dans le tableau. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) -- Ajouter `CRC32IEEE()`/`CRC64()` soutien [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) -- Mettre `char` fonction similaire à celle dans [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) -- Ajouter `bitmapTransform` fonction. Il transforme un tableau de valeurs d'une image bitmap dans un autre tableau de valeurs, le résultat est un nouveau bitmap [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) -- Mettre `javaHashUTF16LE()` fonction [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) -- Ajouter `_shard_num` colonne virtuelle pour le moteur distribué [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) - -#### Caractéristique Expérimentale {#experimental-feature} - -- Prise en charge des processeurs (nouveau pipeline d'exécution de requêtes) dans `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Bug Fix {#bug-fix-1} - -- Correction d'une analyse float incorrecte Dans `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un blocage rare qui peut se produire lorsque trace\_log est activé. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- Empêcher la duplication des messages lors de la production de la table Kafka a tout MVS en sélectionnant [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) -- Soutien pour `Array(LowCardinality(Nullable(String)))` dans `IN`. Résoudre [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) -- Ajouter le traitement de `SQL_TINYINT` et `SQL_BIGINT` et correction de la gestion des `SQL_FLOAT` types de sources de données dans ODBC Bridge. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Correction de l'agrégation (`avg` et quantiles) sur des colonnes décimales vides [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) -- Fixer `INSERT` en Distribué avec `MATERIALIZED` colonne [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Faire `MOVE PARTITION` fonctionne si certaines parties de la partition sont déjà sur le disque ou le volume de destination [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction d'un bug avec hardlinks ne pas être créé lors de mutations dans `ReplicatedMergeTree` dans des configurations multi-disques. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction d'un bug avec une mutation sur un MergeTree lorsque la partie entière reste inchangée et le meilleur espace est trouvé sur un autre disque [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction d'un bug avec `keep_free_space_ratio` ne pas être lu à partir de la configuration des disques [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction d'un bug avec la table ne contient que `Tuple` colonnes ou colonnes avec des chemins complexes. Fixer [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alésapine](https://github.com/alesapin)) -- Ne pas tenir compte de la mémoire pour le moteur tampon dans la limite max\_memory\_usage [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) -- Correction de l'utilisation finale de la marque dans `MergeTree` tableaux commandés par `tuple()`. Dans de rares cas cela pourrait conduire à `Can't adjust last granule` erreur lors de la sélection. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) -- Correction d'un bug dans les mutations qui ont un prédicat avec des actions qui nécessitent un contexte (par exemple des fonctions pour json), ce qui peut entraîner des plantages ou des exceptions étranges. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alésapine](https://github.com/alesapin)) -- Correction de l'inadéquation des noms de base de données et de table s'échappant dans `data/` et `shadow/` annuaire [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Correction d'un crash dans ce cas. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixer `Not found column in block` lors de la jointure sur l'expression avec jointure droite ou complète. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) -- Une tentative de plus pour corriger la boucle infinie dans `PrettySpace` format [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) -- Correction d'un bug dans `concat` fonction lorsque tous les arguments étaient `FixedString` de la même taille. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alésapine](https://github.com/alesapin)) -- Correction d'une exception en cas d'utilisation de 1 argument lors de la définition des stockages S3, URL et HDFS. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction de la portée de InterpreterSelectQuery pour les vues Avec requête [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) - -#### Amélioration {#improvement} - -- `Nullable` colonnes reconnues et valeurs NULL gérées correctement par ODBC-bridge [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- Ecrire le lot actuel pour distribué envoyer atomiquement [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) -- Lancez une exception si nous ne pouvons pas détecter la table pour le nom de la colonne dans la requête. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter `merge_max_block_size` réglage de `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) -- Les requêtes avec `HAVING` et sans `GROUP BY` supposons groupe par constante. Si, `SELECT 1 HAVING 1` maintenant retourne un résultat. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos Oiseau](https://github.com/amosbird)) -- Soutien à l'analyse `(X,)` comme tuple similaire à python. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos Oiseau](https://github.com/amosbird)) -- Faire `range` les comportements de fonction ressemblent presque à ceux de pythonic. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) -- Ajouter `constraints` les colonnes de la table `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) -- Meilleur format Null pour le gestionnaire tcp, de sorte qu'il est possible d'utiliser `select ignore() from table format Null` pour perf mesure via clickhouse-client [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos Oiseau](https://github.com/amosbird)) -- Les requêtes comme `CREATE TABLE ... AS (SELECT (1, 2))` sont analysés correctement [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) - -#### Amélioration Des Performances {#performance-improvement} - -- Les performances de l'agrégation sur les clés de chaîne courte sont améliorées. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [Amos Oiseau](https://github.com/amosbird)) -- Exécutez une autre passe d'analyse de syntaxe / expression pour obtenir des optimisations potentielles après que les prédicats constants sont pliés. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos Oiseau](https://github.com/amosbird)) -- Utilisez les méta informations de stockage pour évaluer trivial `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos Oiseau](https://github.com/amosbird), [alexeï-milovidov](https://github.com/alexey-milovidov)) -- Vectoriser le traitement `arrayReduce` semblable à Agrégateur `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Oiseau](https://github.com/amosbird)) -- Améliorations mineures des performances de `Kafka` consommation [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([Ivan](https://github.com/abyss7)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement} - -- Ajouter la prise en charge de la compilation croisée à L'architecture du processeur AARCH64. Refactoriser le code emballeur script. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([Ivan](https://github.com/abyss7)) -- Décompressez les chaînes d'outils darwin-x86\_64 et linux-aarch64 dans le volume Docker monté lors de la construction de paquets [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([Ivan](https://github.com/abyss7)) -- Mise à jour de L'Image Docker pour le Packager binaire [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([Ivan](https://github.com/abyss7)) -- Correction des erreurs de compilation sur macOS Catalina [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) -- Certains refactoring dans la logique d'analyse de requête: diviser la classe complexe en plusieurs classes simples. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix construire sans submodules [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) -- Mieux `add_globs` dans les fichiers CMake [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos Oiseau](https://github.com/amosbird)) -- Supprimer les chemins codés en dur dans `unwind` cible [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) -- Permettre d'utiliser le format mysql sans ssl [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) - -#### Autre {#other} - -- Ajout de la grammaire ANTLR4 pour le dialecte ClickHouse SQL [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -## Clickhouse version v19. 16 {#clickhouse-release-v19-16} - -#### Clickhouse version v19. 16. 14. 65, 2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} - -- Correction d'un bug dans les calculs par lots des opérations logiques ternaires sur plusieurs arguments (plus de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) Ce correctif a été rétroporté à la version 19.16 par une demande spéciale D'Altinity. - -#### Clickhouse version v19. 16. 14. 65, 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} - -- Correction de l'incompatibilité des sous-requêtes distribuées avec les anciennes versions de CH. Fixer [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) - [(tabplubix)](https://github.com/tavplubix) -- Lors de l'exécution de `CREATE` requête, plier les expressions constantes dans les arguments du moteur de stockage. Remplacez le nom de base de données vide par la base de données actuelle. Fixer [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Corrigez également la vérification de l'adresse locale dans `ClickHouseDictionarySource`. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Maintenant fond fusionne dans `*MergeTree` la famille des moteurs de table préserve l'ordre de volume de la Politique de stockage avec plus de précision. - [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Empêcher la perte de données dans `Kafka` dans de rares cas, lorsque l'exception se produit après la lecture du suffixe mais avant la validation. Fixer [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Concerner: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -- Correction d'un bug menant à la résiliation du serveur lorsque vous essayez d'utiliser / drop `Kafka` tableau créé avec de mauvais paramètres. Fixer [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporer [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) -- Autoriser l'utilisation des `MaterializedView` avec les sous-requêtes ci-dessus `Kafka` table. - [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) - -#### Nouveauté {#new-feature-1} - -- Ajouter `deduplicate_blocks_in_dependent_materialized_views` option pour contrôler le comportement des insertions idempotent dans des tables avec des vues matérialisées. Cette nouvelle fonctionnalité a été ajoutée à la version de bugfix par une demande spéciale D'Altinity. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### Clickhouse version v19. 16. 2. 2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} - -#### Modification Incompatible En Arrière {#backward-incompatible-change-1} - -- Ajouter une validation d'arité manquante pour count / counIf. - [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) - [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) -- Supprimer l'héritage `asterisk_left_columns_only` paramètre (il est désactivé par défaut). - [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem - Zuikov](https://github.com/4ertus2)) -- Les chaînes de Format pour le format de données de modèle sont maintenant spécifiées dans les fichiers. - [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) - -#### Nouveauté {#new-feature-2} - -- Introduisez uniqCombined64() pour calculer la cardinalité supérieure à UINT\_MAX. - [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), - [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat - Khuzhin](https://github.com/azat)) -- Soutenir les index de filtre Bloom sur les colonnes de tableau. - [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) - ([achimbab](https://github.com/achimbab)) -- Ajouter une fonction `getMacro(name)` cela renvoie une chaîne avec la valeur de `` - à partir de la configuration du serveur. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) - ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Définissez deux options de configuration pour un dictionnaire basé sur une source HTTP: `credentials` et - `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- Ajouter un nouveau ProfileEvent `Merge` cela compte le nombre de fusions d'arrière-plan lancées. - [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mikhail - Korotov](https://github.com/millb)) -- Ajouter la fonction fullHostName qui renvoie un nom de domaine complet. - [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) - [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) -- Ajouter une fonction `arraySplit` et `arrayReverseSplit` qui divise un tableau par “cut off” - condition. Ils sont utiles dans la gestion de la séquence temporelle. - [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) -- Ajoutez de nouvelles fonctions qui renvoient le tableau de tous les indices appariés dans la famille de fonctions multiMatch. - [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila - Kutenin](https://github.com/danlark1)) -- Ajouter un nouveau moteur de base de données `Lazy` qui est optimisé pour stocker un grand nombre de petits journaux - table. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nikita - Vasiliev](https://github.com/nikvas0)) -- Ajouter des fonctions d'agrégation groupBitmapAnd, - ou, - Xor pour les colonnes bitmap. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang - Yu](https://github.com/yuzhichang)) -- Ajouter des combinateurs de fonctions d'agrégat-OrNull et-OrDefault, qui renvoient null - ou des valeurs par défaut lorsqu'il n'y a rien à agréger. - [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) - ([hcz](https://github.com/hczhcz)) -- Introduire le format de données CustomSeparated qui prend en charge l'échappement personnalisé et - séparateur de règles. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) -- Soutien Redis comme source de dictionnaire externe. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton - Popov](https://github.com/CurtizJ)) - -#### Bug Fix {#bug-fix-2} - -- Correction d'un résultat de requête incorrect s'il a `WHERE IN (SELECT ...)` la section et `optimize_read_in_order` être - utiliser. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton - Popov](https://github.com/CurtizJ)) -- Plugin D'authentification MariaDB désactivé, qui dépend des fichiers en dehors du projet. - [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Iouri - Baranov](https://github.com/yurriy)) -- Correction d'une exception `Cannot convert column ... because it is constant but values of constants are different in source and result` ce qui pourrait rarement arriver lorsque les fonctions `now()`, `today()`, - `yesterday()`, `randConstant()` sont utilisés. - [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolaï - Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un problème d'utilisation de HTTP keep alive timeout au lieu de TCP keep alive timeout. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vassili - Nemkov](https://github.com/Enmk)) -- Correction d'un défaut de segmentation dans groupBitmapOr (problème [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). - [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang - Yu](https://github.com/yuzhichang)) -- Pour les vues matérialisées, le commit pour Kafka est appelé après l'écriture de toutes les données. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) -- Fixe de mal `duration_ms` valeur en `system.part_log` table. Il y a dix reprises. - [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Une solution rapide pour résoudre le crash dans la table LIVE VIEW et réactiver tous les tests LIVE VIEW. - [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Sérialiser correctement les valeurs NULL dans les index min / max des parties MergeTree. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Ne mettez pas de colonnes virtuelles à .métadonnées sql lorsque la table est créée en tant que `CREATE TABLE AS`. - [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([Ivan](https://github.com/abyss7)) -- Correction d'un défaut de segmentation dans `ATTACH PART` requête. - [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) - ([alésapine](https://github.com/alesapin)) -- Correction d'un mauvais résultat pour certaines requêtes données par l'optimisation de empty IN subqueries et empty - INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolaï - Kochetov](https://github.com/KochetovNicolai)) -- Correction D'une erreur AddressSanitizer dans la méthode LIVE VIEW getHeader (). - [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) - ([vzakaznikov](https://github.com/vzakaznikov)) - -#### Amélioration {#improvement-1} - -- Ajouter un message en cas d'attente queue\_wait\_max\_ms. - [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat - Khuzhin](https://github.com/azat)) -- Faites le réglage de `s3_min_upload_part_size` au niveau de la table. - [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Vérifiez TTL dans StorageFactory. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) - ([sundyli](https://github.com/sundy-li)) -- Squash blocs de gauche en fusion partielle join (optimisation). - [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem - Zuikov](https://github.com/4ertus2)) -- N'autorisez pas les fonctions non déterministes dans les mutations des moteurs de table répliqués, car - peut introduire des incohérences entre les répliques. - [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alexander - Kazakov](https://github.com/Akazz)) -- Désactivez le suivi de la mémoire lors de la conversion de trace de pile d'exception en chaîne. Il peut empêcher la perte - des messages d'erreur de type `Memory limit exceeded` sur le serveur, qui a causé la `Attempt to read after eof` exception sur le client. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) - ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Améliorations diverses du format. Résoudre - [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), - [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), - [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), - [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) - [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) - ([tavplubix](https://github.com/tavplubix)) -- ClickHouse ignore les valeurs du côté droit de L'opérateur IN qui ne sont pas convertibles vers la gauche - side type. Make it work properly for compound types – Array and Tuple. - [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Soutenir les inégalités manquantes pour ASOF JOIN. Il est possible de rejoindre une variante moins ou égale et stricte - plus grandes et moins de variantes pour la colonne ASOF dans la syntaxe ON. - [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem - Zuikov](https://github.com/4ertus2)) -- Optimiser la fusion partielle jointure. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) - ([Artem Zuikov](https://github.com/4ertus2)) -- N'utilisez pas plus de 98K de mémoire dans les fonctions uniqCombined. - [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), - [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat - Khuzhin](https://github.com/azat)) -- Rincer les parties de la table de jonction de droite sur le disque dans PartialMergeJoin (s'il n'y en a pas assez - mémoire). Chargez les données en arrière en cas de besoin. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) - ([Artem Zuikov](https://github.com/4ertus2)) - -#### Amélioration Des Performances {#performance-improvement-1} - -- Accélérez joinGet avec des arguments const en évitant la duplication des données. - [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos - Oiseau](https://github.com/amosbird)) -- De retour plus tôt si la sous-requête est vide. - [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) -- Optimiser l'analyse de l'expression SQL dans les valeurs. - [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) - ([tavplubix](https://github.com/tavplubix)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-1} - -- Désactivez certaines contribs pour la compilation croisée sur Mac OS. - [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([Ivan](https://github.com/abyss7)) -- Ajouter un lien manquant avec PocoXML pour clickhouse\_common\_io. - [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat - Khuzhin](https://github.com/azat)) -- Accepter plusieurs arguments de filtre de test dans clickhouse-test. - [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Activer musl et jemalloc pour ARM. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) - ([Amos Oiseau](https://github.com/amosbird)) -- Ajouter `--client-option` paramètre `clickhouse-test` pour passer des paramètres supplémentaires au client. - [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolaï - Kochetov](https://github.com/KochetovNicolai)) -- Préserver les configurations existantes lors de la mise à niveau du package rpm. - [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) - ([filimonov](https://github.com/filimonov)) -- Correction des erreurs détectées par PVS. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem - Zuikov](https://github.com/4ertus2)) -- Correction de la construction pour Darwin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) - ([Ivan](https://github.com/abyss7)) -- compatibilité glibc 2.29. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos - Oiseau](https://github.com/amosbird)) -- Assurez-vous que dh\_clean ne touche pas les fichiers sources potentiels. - [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos - Oiseau](https://github.com/amosbird)) -- Essayez d'éviter les conflits lors de la mise à jour à partir d'altinity rpm-le fichier de configuration est emballé séparément - dans clickhouse-serveur commun. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) - ([filimonov](https://github.com/filimonov)) -- Optimisez certains fichiers d'en-tête pour des reconstructions plus rapides. - [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), - [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Ajouter des tests de performance pour Date et DateTime. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vassili - Nemkov](https://github.com/Enmk)) -- Correction de certains tests contenant des mutations non déterministes. - [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alexander - Kazakov](https://github.com/Akazz)) -- Ajouter build avec MemorySanitizer à CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) - ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Évitez l'utilisation de valeurs non initialisées dans MetricsTransmitter. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat - Khuzhin](https://github.com/azat)) -- Correction de certains problèmes dans les champs trouvés par MemorySanitizer. - [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), - [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alexander - Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) - ([Amos Oiseau](https://github.com/amosbird)) -- Correction d'un comportement indéfini dans murmurhash32. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos - Oiseau](https://github.com/amosbird)) -- Correction d'un comportement indéfini dans StoragesInfoStream. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) - ([tavplubix](https://github.com/tavplubix)) -- Correction du pliage d'expressions constantes pour les moteurs de base de données externes (MySQL, ODBC, JDBC). Dans les précédents - versions il ne fonctionnait pas pour plusieurs expressions constantes et ne fonctionnait pas du tout pour la Date, - DateTime et UUID. Cela corrige [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) - ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction D'une erreur de course de données ThreadSanitizer dans la vue en direct lors de l'accès à la variable no\_users\_thread. - [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Débarrassez-vous des symboles malloc dans libcommon - [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), - [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos - Oiseau](https://github.com/amosbird)) -- Ajoutez l'indicateur global ENABLE\_LIBRARIES pour désactiver toutes les bibliothèques. - [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) - ([proller](https://github.com/proller)) - -#### Nettoyage de Code {#code-cleanup} - -- Généraliser le référentiel de configuration pour préparer DDL pour les dictionnaires. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) - ([alésapine](https://github.com/alesapin)) -- Parser pour les dictionnaires DDL sans aucune sémantique. - [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) - ([alésapine](https://github.com/alesapin)) -- Divisez ParserCreateQuery en différents analyseurs plus petits. - [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) - ([alésapine](https://github.com/alesapin)) -- Petit refactoring et renommage près de dictionnaires externes. - [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) - ([alésapine](https://github.com/alesapin)) -- Refactorisez du code pour vous préparer au contrôle d'accès basé sur les rôles. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly - Baranov](https://github.com/vitlibar)) -- Quelques améliorations dans Databasecode ordinaire. - [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nikita - Vasiliev](https://github.com/nikvas0)) -- N'utilisez pas d'itérateurs dans les méthodes find() et emplace () des tables de hachage. - [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- Fix getMultipleValuesFromConfig dans le cas où le paramètre root n'est pas vide. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) - ([Mikhail Korotov](https://github.com/millb)) -- Supprimer un copier-coller (TemporaryFile et TemporaryFileStream) - [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem - Zuikov](https://github.com/4ertus2)) -- Amélioration de la lisibilité du code un peu (`MergeTreeData::getActiveContainingPart`). - [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Attendez tous les travaux planifiés, qui utilisent des objets locaux, si `ThreadPool::schedule(...)` jeter - exception. Renommer `ThreadPool::schedule(...)` de `ThreadPool::scheduleOrThrowOnError(...)` et - correction des commentaires pour rendre évident qu'il peut jeter. - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) - ([tavplubix](https://github.com/tavplubix)) - -## Version ClickHouse 19.15 {#clickhouse-release-19-15} - -### Clickhouse version 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} - -#### Bug Fix {#bug-fix-3} - -- Ajout de la gestion de SQL\_TINYINT et SQL\_BIGINT, et correction de la gestion des types de sources de données SQL\_FLOAT dans ODBC Bridge. - [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Autorisé à avoir certaines parties sur le disque de destination ou le volume dans la PARTITION de déplacement. - [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Valeurs NULL fixes dans les colonnes nullables via ODBC-bridge. - [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- Insertion fixe dans un nœud non Local distribué avec des colonnes matérialisées. - [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Fonction fixe getMultipleValuesFromConfig. - [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) -- Correction d'un problème d'utilisation de HTTP keep alive timeout au lieu de TCP keep alive timeout. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) -- Attendez que tous les travaux se terminent à l'exception (corrige les segfaults rares). - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) -- Ne poussez pas vers MVs lors de l'insertion dans la table Kafka. - [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([Ivan](https://github.com/abyss7)) -- Désactiver le suivi de la mémoire pour la pile d'exception. - [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un mauvais code dans la transformation de la requête pour la base de données externe. - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Évitez l'utilisation de valeurs non initialisées dans MetricsTransmitter. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) -- Ajout d'un exemple de configuration avec des macros pour les tests ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} - -#### Bug Fix {#bug-fix-4} - -- Correction de bad\_variant dans le dictionnaire haché. - ([alésapine](https://github.com/alesapin)) -- Correction d'un bug avec défaut de segmentation dans la requête de pièce jointe. - ([alésapine](https://github.com/alesapin)) -- Calcul du temps fixe en `MergeTreeData`. - ([Vladimir Chebotarev](https://github.com/excitoon)) -- Commit à Kafka explicitement après la finalisation de l'écriture. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([Ivan](https://github.com/abyss7)) -- Sérialiser correctement les valeurs NULL dans les index min / max des parties MergeTree. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -### Clickhouse version 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} - -#### Nouveauté {#new-feature-3} - -- Stockage à plusieurs niveaux: prise en charge de l'utilisation de plusieurs volumes de stockage pour les tables avec mergetree engine. Il est possible de stocker de nouvelles données sur SSD et de déplacer automatiquement les anciennes données sur le disque dur. ([exemple](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alésapine](https://github.com/alesapin)) -- Ajouter une fonction de table `input` pour lire les données entrantes dans `INSERT SELECT` requête. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonique1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) -- Ajouter un `sparse_hashed` mise en page du dictionnaire, qui est fonctionnellement équivalente à la `hashed` mise en page, mais est plus efficace en mémoire. Il utilise environ deux fois moins de mémoire au prix d'une récupération de valeur plus lente. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) -- Implémenter la capacité de définir la liste des utilisateurs pour l'accès aux dictionnaires. Seule la base de données connectée actuelle utilisant. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Ajouter `LIMIT` option pour `SHOW` requête. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- Ajouter `bitmapSubsetLimit(bitmap, range_start, limit)` fonction, qui renvoie le sous-ensemble du plus petit `limit` valeurs dans l'ensemble qui n'est pas inférieure à `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) -- Ajouter `bitmapMin` et `bitmapMax` fonction. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) -- Ajouter une fonction `repeat` liées à la [numéro-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([Flynn](https://github.com/ucasFL)) - -#### Caractéristique Expérimentale {#experimental-feature-1} - -- Implémentez (en mémoire) une variante de jointure de fusion qui ne change pas le pipeline actuel. Le résultat est partiellement trié par clé de fusion. Définir `partial_merge_join = 1` pour utiliser cette fonctionnalité. La Jointure de Fusion est toujours en développement. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter `S3` fonction de moteur et de table. Il est encore en développement (pas encore de support d'authentification). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) - -#### Amélioration {#improvement-2} - -- Chaque message lu à partir de Kafka est inséré atomiquement. Cela résout presque tous les problèmes connus avec Kafka engine. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([Ivan](https://github.com/abyss7)) -- Améliorations pour le basculement des requêtes distribuées. Raccourcir le temps de récupération, il est maintenant configurable et peut être vu dans `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) -- Supporte les valeurs numériques pour les énumérations directement dans `IN` section. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) -- Support (facultatif, désactivé par défaut) redirige sur le stockage D'URL. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) -- Ajouter un message d'information lorsque le client avec une ancienne version se connecte à un serveur. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- Supprimer la limite de temps de veille maximale pour l'envoi de données dans les tables distribuées [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) -- Ajouter la possibilité d'envoyer des événements de profil (compteurs) avec des valeurs cumulatives à graphite. Il peut être activé sous `` dans serveur `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) -- Ajouter automatiquement le type de fonte `T` de `LowCardinality(T)` lors de l'insertion de données dans la colonne de type `LowCardinality(T)` au format natif via HTTP. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ajout de la capacité à utiliser la fonction `hex` sans l'aide de `reinterpretAsString` pour `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-2} - -- Ajouter gdb-index au binaire clickhouse avec des informations de débogage. Il permettra d'accélérer le temps de démarrage de `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alésapine](https://github.com/alesapin)) -- Accélérez l'emballage deb avec dpkg-deb patché qui utilise `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alésapine](https://github.com/alesapin)) -- Définir `enable_fuzzing = 1` pour activer l'instrumentation libfuzzer de tout le code du projet. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) -- Ajouter Split build smoke test dans CI. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alésapine](https://github.com/alesapin)) -- Ajouter build avec MemorySanitizer à CI. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Remplacer `libsparsehash` avec `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) - -#### Bug Fix {#bug-fix-5} - -- Correction de la dégradation des performances de l'analyse d'index sur les clés complexes sur les grandes tables. Cela corrige \# 6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur logique provoquant segfaults lors de la sélection de Kafka sujet vide. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) -- Correction d'une connexion MySQL trop tôt fermer `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Retour du support pour les très anciens noyaux Linux (correction [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corriger les éventuelles pertes de données dans `insert select` requête en cas de bloc vide dans le flux d'entrée. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correctif pour la fonction `АrrayEnumerateUniqRanked` avec des tableaux vides dans params [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- Correction de requêtes complexes avec des jointures de tableau et des sous-requêtes globales. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) -- Fixer `Unknown identifier` erreur dans ORDER BY et GROUP BY avec plusieurs jointures [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixe `MSan` avertissement lors de l'exécution de la fonction avec `LowCardinality` argument. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Modification Incompatible En Arrière {#backward-incompatible-change-2} - -- Format de sérialisation modifié de bitmap \* états de fonction d'agrégation pour améliorer les performances. Les États sérialisés de bitmap \* des versions précédentes ne peuvent pas être lus. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) - -## Clickhouse version 19.14 {#clickhouse-release-19-14} - -### Clickhouse version 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} - -#### Bug Fix {#bug-fix-6} - -- Cette version contient également toutes les corrections de bugs de 19.11.12.69. -- Compatibilité fixe pour les requêtes distribuées entre 19.14 et les versions antérieures. Cela corrige [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} - -#### Bug Fix {#bug-fix-7} - -- Correctif pour la fonction `АrrayEnumerateUniqRanked` avec des tableaux vides dans params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- Nom de sous-requête fixe dans les requêtes avec `ARRAY JOIN` et `GLOBAL IN subquery` avec alias. Utilisez l'alias de sous-requête pour le nom de table externe s'il est spécifié. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([Ivan](https://github.com/abyss7)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-3} - -- Fixer [le battement](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) test `00715_fetch_merged_or_mutated_part_zookeeper` en le réécrivant dans un script shell car il doit attendre que des mutations s'appliquent. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) -- Correction de L'échec UBSan et MemSan en fonction `groupUniqArray` avec l'argument de tableau emtpy. Il a été causé par le placement de vide `PaddedPODArray` dans la table de hachage zéro cellule parce que le constructeur pour la valeur de cellule Zéro n'a pas été appelé. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos Oiseau](https://github.com/amosbird)) - -### Clickhouse version 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} - -#### Nouveauté {#new-feature-4} - -- `WITH FILL` le modificateur `ORDER BY`. (suite de la [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- `WITH TIES` le modificateur `LIMIT`. (suite de la [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- Analyser non cotées `NULL` littéral comme NULL (si paramètre `format_csv_unquoted_null_literal_as_null=1`). Initialiser les champs null avec des valeurs par défaut si le type de données de ce champ n'est pas nullable (si `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) -- Prise en charge des caractères génériques dans les chemins des fonctions de table `file` et `hdfs`. Si le chemin contient des caractères génériques, la table sera en lecture seule. Exemple d'utilisation: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` et `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) -- Nouveau `system.metric_log` le tableau qui stocke les valeurs de `system.events` et `system.metrics` avec l'intervalle de temps spécifié. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Permettre d'écrire des journaux de texte ClickHouse à `system.text_log` table. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Afficher les symboles privés dans les traces de pile (cela se fait via l'analyse des tables de symboles des fichiers ELF). Ajout d'informations sur le numéro de fichier et de ligne dans les traces de pile si les informations de débogage sont présentes. Accélérer la recherche de nom de symbole avec des symboles d'indexation présents dans le programme. Ajout de nouvelles fonctions SQL pour l'introspection: `demangle` et `addressToLine`. Renommé fonction `symbolizeAddress` de `addressToSymbol` pour des raisons de cohérence. Fonction `addressToSymbol` retournera le nom mutilé pour des raisons de performance et vous devez appliquer `demangle`. Ajout d'un réglage `allow_introspection_functions` qui est désactivée par défaut. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fonction de Table `values` (le nom est sensible à la casse). Il permet de lire à partir de `VALUES` la liste proposée dans [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Exemple: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) -- Ajout d'une capacité de modifier les paramètres de stockage. Syntaxe: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alésapine](https://github.com/alesapin)) -- Support pour enlever des pièces détachées. Syntaxe: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) -- Les contraintes de Table. Permet d'ajouter une contrainte à la définition de la table qui sera vérifiée lors de l'insertion. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Soutien en cascade des vues matérialisées. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos Oiseau](https://github.com/amosbird)) -- Activez query profiler par défaut pour échantillonner chaque thread d'exécution de requête une fois par seconde. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Format d'entrée `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) -- Ajout de deux nouvelles fonctions: `sigmoid` et `tanh` (qui sont utiles pour les applications d'apprentissage automatique). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fonction `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` pour vérifier si un jeton est dans la botte de foin. Le jeton est une sous-chaîne de longueur maximale entre deux caractères ASCII non alphanumériques (ou limites de haystack). Le jeton doit être une chaîne constante. Pris en charge par tokenbf\_v1 spécialisation de l'index. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) -- Nouvelle fonction `neighbor(value, offset[, default_value])`. Permet d'atteindre la valeur prev / next dans la colonne d'un bloc de données. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Laquelle Le Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) -- Créé une fonction `currentUser()`, retour connexion de l'utilisateur autorisé. Ajout d'alias `user()` pour la compatibilité avec MySQL. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Laquelle Le Krash](https://github.com/alex-krash)) -- Nouvelles fonctions d'agrégation `quantilesExactInclusive` et `quantilesExactExclusive` qui étaient proposés dans [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) -- Fonction `bitmapRange(bitmap, range_begin, range_end)` qui renvoie un nouvel ensemble avec une plage spécifiée (ne pas inclure `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) -- Fonction `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` ce qui crée un tableau de chaînes de précision longues de geohash-boîtes couvrant la zone fournie. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) -- Implémenter la prise en charge de la requête INSERT avec `Kafka` table. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([Ivan](https://github.com/abyss7)) -- Ajout du support pour `_partition` et `_timestamp` colonnes virtuelles au moteur Kafka. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([Ivan](https://github.com/abyss7)) -- Possibilité de supprimer des données sensibles de `query_log`, journaux de serveur, liste de processus avec des règles basées sur regexp. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) - -#### Caractéristique Expérimentale {#experimental-feature-2} - -- Format de données d'entrée et de sortie `Template`. Il permet de spécifier une chaîne de format personnalisée pour l'entrée et la sortie. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) -- La mise en œuvre de `LIVE VIEW` tableaux qui ont été initialement proposés dans [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) préparés dans [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), puis mis à jour dans [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). Voir [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) pour une description détaillée. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov)) Note que `LIVE VIEW` fonction peut être supprimée dans les prochaines versions. - -#### Bug Fix {#bug-fix-8} - -- Cette version contient également toutes les corrections de bugs de 19.13 et 19.11. -- Correction d'un défaut de segmentation lorsque la table a des indices de saut et que la fusion verticale se produit. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alésapine](https://github.com/alesapin)) -- Correction de TTL par colonne avec des valeurs par défaut de colonne non triviales. Auparavant en cas de force TTL fusionner avec `OPTIMIZE ... FINAL` requête, les valeurs expirées ont été remplacées par des valeurs par défaut de type au lieu des valeurs par défaut de colonne spécifiées par l'utilisateur. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) -- Correction du problème de duplication des messages Kafka lors du redémarrage normal du serveur. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) -- Boucle infinie fixe lors de la lecture des messages Kafka. Ne pas mettre en pause/reprendre le consommateur sur l'abonnement du tout - sinon il peut être mis en pause indéfiniment dans certains scénarios. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([Ivan](https://github.com/abyss7)) -- Fixer `Key expression contains comparison between inconvertible types` exception dans `bitmapContains` fonction. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) -- Correction de segfault avec activé `optimize_skip_unused_shards` et clé de sharding manquante. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) -- Correction du mauvais code dans les mutations qui peuvent conduire à la corruption de la mémoire. Correction de segfault avec lecture de l'adresse `0x14c0` cela peut se produire en raison de simultané `DROP TABLE` et `SELECT` de `system.parts` ou `system.parts_columns`. Condition de course fixe dans la préparation des requêtes de mutation. Blocage fixe causé par `OPTIMIZE` des tables répliquées et des opérations de modification simultanées comme ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Suppression de la journalisation supplémentaire dans L'interface MySQL [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Renvoie la possibilité d'analyser les paramètres booléens depuis ‘true’ et ‘false’ dans le fichier de configuration. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alésapine](https://github.com/alesapin)) -- Correction d'un crash dans l' `quantile` et `median` la fonction sur `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction possible résultat incomplet retourné par `SELECT` requête avec `WHERE` condition sur la clé primaire contient la conversion en type Float. Il a été causé par une vérification incorrecte de la monotonie dans `toFloat` fonction. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- Vérifier `max_expanded_ast_elements` réglage des mutations. Mutations claires après `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Correction des résultats de jointure pour les colonnes clés lorsqu'elles sont utilisées avec `join_use_nulls`. Attachez des valeurs NULL au lieu des valeurs par défaut des colonnes. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction des indices de saut avec Fusion verticale et modification. Correctif pour `Bad size of marks file` exception. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alésapine](https://github.com/alesapin)) -- Correction plantage rare dans `ALTER MODIFY COLUMN` et fusion verticale lorsque l'une des parties fusionnées/modifiées est vide (0 lignes) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug dans la conversion de `LowCardinality` types de `AggregateFunctionFactory`. Cela corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un comportement incorrect et de segfaults possibles dans `topK` et `topKWeighted` agrégé fonctions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) -- Code dangereux fixe autour `getIdentifier` fonction. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug dans le protocole de fil MySQL (est utilisé lors de la connexion à clickhouse forme client MySQL). Causé par un débordement de tampon de tas `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) -- Fuite de mémoire fixe dans `bitmapSubsetInRange` fonction. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) -- Correction d'un bug rare lorsque la mutation est exécutée après un changement de granularité. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alésapine](https://github.com/alesapin)) -- Autoriser le message protobuf avec tous les champs par défaut. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) -- Résoudre un bug avec `nullIf` fonction lorsque nous envoyer un `NULL` l'argument sur le deuxième argument. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Correction d'un bug rare avec une mauvaise allocation/désallocation de la mémoire dans des dictionnaires de cache de clés Complexes avec des champs de chaîne qui conduit à une consommation de mémoire infinie (ressemble à une fuite de mémoire). Bug se reproduit lorsque la taille de la chaîne était une puissance de deux à partir de huit (8, 16, 32, etc.). [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alésapine](https://github.com/alesapin)) -- Correction de L'encodage Gorilla sur les petites séquences qui a provoqué une exception `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) -- Permet d'utiliser des types Non nullables dans les jointures avec `join_use_nulls` permettre. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) -- Désactiver `Poco::AbstractConfiguration` substitutions dans la requête dans `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Éviter l'impasse dans `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Utiliser `arrayReduce` pour des arguments constants peuvent conduire à segfault. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction des parties incohérentes qui peuvent apparaître si la réplique a été restaurée après `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- Correction du blocage dans `JSONExtractRaw` fonction. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug avec des indices de saut incorrects sérialisation et agrégation avec granularité adaptative. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alésapine](https://github.com/alesapin)) -- Fixer `WITH ROLLUP` et `WITH CUBE` les modificateurs de `GROUP BY` avec agrégation à deux niveaux. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Correction d'un bug avec l'écriture de marques d'indices secondaires avec une granularité adaptative. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alésapine](https://github.com/alesapin)) -- Correction de l'ordre d'initialisation lors du démarrage du serveur. Depuis `StorageMergeTree::background_task_handle` est initialisée dans `startup()` le `MergeTreeBlockOutputStream::write()` peut tenter de l'utiliser avant l'initialisation. Vérifiez simplement s'il est initialisé. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) -- Effacement du tampon de données de l'opération de lecture précédente terminée par une erreur. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) -- Correction d'un bug avec l'activation de la granularité adaptative lors de la création d'une nouvelle réplique pour la table répliquée\*MergeTree. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alésapine](https://github.com/alesapin)) -- Correction d'un crash possible lors du démarrage du serveur en cas d'exception `libunwind` au cours de l'exception à l'accès à uninitialized `ThreadStatus` structure. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Correction d'un crash dans l' `yandexConsistentHash` fonction. Trouvé par fuzz test. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la possibilité de suspendre les requêtes lorsque le serveur est surchargé et que le pool de threads global devient presque complet. Cela a plus de chances de se produire sur les clusters avec un grand nombre de fragments (des centaines), car les requêtes distribuées allouent un thread par connexion à chaque fragment. Par exemple, ce problème peut se reproduire si un cluster de 330 fragments traite 30 requêtes distribuées simultanées. Ce problème affecte toutes les versions à partir de 19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe la logique de `arrayEnumerateUniqRanked` fonction. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de segfault lors du décodage de la table des symboles. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos Oiseau](https://github.com/amosbird)) -- Correction d'une exception non pertinente dans la distribution de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Suppression de guillemets supplémentaires de description dans `system.settings` table. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Éviter l'impasse possible dans `TRUNCATE` de table Répliquée. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la lecture dans l'ordre de la clé de tri. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) -- Fixer `ALTER TABLE ... UPDATE` requête pour les tables avec `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug ouvert par [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (depuis 19.4.0). Reproduit dans les requêtes aux tables distribuées sur les tables MergeTree lorsque nous n'interrogeons aucune colonne (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alésapine](https://github.com/alesapin)) -- Dépassement fixe dans la division entière du type signé au type non signé. Le comportement était exactement comme dans le langage C ou c++ (règles de promotion entières) qui peut être surprenant. Veuillez noter que le débordement est toujours possible lors de la division d'un grand nombre signé en un grand nombre non signé ou vice-versa (mais ce cas est moins habituel). Le problème existait dans toutes les versions du serveur. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Limiter le temps de sommeil maximal pour l'étranglement lorsque `max_execution_speed` ou `max_execution_speed_bytes` est définie. Correction de fausses erreurs comme `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de problèmes d'utilisation `MATERIALIZED` colonnes et alias dans `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos Oiseau](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer `FormatFactory` comportement pour les flux d'entrée qui ne sont pas implémentés en tant que Processeur. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'une faute. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) -- Typo dans le message d'erreur (is - \> are). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) -- Correction d'une erreur lors de l'analyse de la liste des colonnes de la chaîne si le type contenait une virgule (Ce problème était pertinent pour `File`, `URL`, `HDFS` stockage) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) - -#### Correction De Sécurité {#security-fix} - -- Cette version contient également tous les correctifs de sécurité de bugs de 19.13 et 19.11. -- Correction de la possibilité d'une requête fabriquée pour provoquer un crash du serveur en raison d'un débordement de pile dans L'analyseur SQL. Correction de la possibilité de débordement de pile dans les tables de fusion et distribuées, les vues matérialisées et les conditions de sécurité au niveau des lignes impliquant des sous-requêtes. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Amélioration {#improvement-3} - -- Mise en œuvre correcte de la logique ternaire pour `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) -- Maintenant les valeurs et les lignes avec TTL expiré seront supprimées après `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` requête. Ajouté requêtes `SYSTEM STOP/START TTL MERGES` pour interdire / autoriser les fusions d'affectation avec TTL et filtrer les valeurs expirées dans toutes les fusions. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) -- Possibilité de changer l'emplacement du fichier d'historique ClickHouse pour le client à l'aide `CLICKHOUSE_HISTORY_FILE` env. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) -- Supprimer `dry_run` drapeau de `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Soutien `ASOF JOIN` avec `ON` section. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) -- Meilleure prise en charge des index de saut pour les mutations et la réplication. Soutien pour `MATERIALIZE/CLEAR INDEX ... IN PARTITION` requête. `UPDATE x = x` recalcule tous les indices qui utilisent la colonne `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) -- Permettre à `ATTACH` affichages en direct (par exemple, au démarrage du serveur), indépendamment de `allow_experimental_live_view` paramètre. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Pour les traces de pile recueillies par le profileur de requête, n'incluez pas les trames de pile générées par le profileur de requête lui-même. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant fonctions de table `values`, `file`, `url`, `hdfs` avoir un support pour les colonnes ALIAS. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Lancer une exception si `config.d` le fichier n'a pas l'élément racine correspondant comme fichier de configuration. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) -- Imprimer des informations supplémentaires dans le message d'exception pour `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) -- Lors de la détermination des éclats d'un `Distributed` table à couvrir par une requête de lecture (pour `optimize_skip_unused_shards` = 1) ClickHouse vérifie maintenant les conditions des deux `prewhere` et `where` clauses de l'instruction select. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) -- Permettre `SIMDJSON` pour les machines sans AVX2 mais avec SSE 4.2 et pclmul jeu d'instructions. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse peut fonctionner sur les systèmes de fichiers sans `O_DIRECT` soutien (tels que ZFS et BtrFS) sans réglage supplémentaire. [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Soutien pousser vers le bas prédicat pour la sous-requête finale. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mieux `JOIN ON` extraction des clés [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) -- Mise à jour `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Optimiser la sélection de la plus petite colonne pour `SELECT count()` requête. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos Oiseau](https://github.com/amosbird)) -- Ajouter `strict` paramètre `windowFunnel()`. Lorsque l' `strict` est définie, le `windowFunnel()` applique des conditions uniquement pour les valeurs uniques. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) -- Interface plus sûre de `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) -- Options taille de ligne lors de l'exécution avec `--help` l'option correspond maintenant à la taille du terminal. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) -- Désactiver “read in order” optimisation pour l'agrégation, sans touches. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) -- Code D'état HTTP pour `INCORRECT_DATA` et `TYPE_MISMATCH` les codes d'erreur ont été modifiés par défaut `500 Internal Server Error` de `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) -- Déplacer Rejoindre objet de `ExpressionAction` dans `AnalyzedJoin`. `ExpressionAnalyzer` et `ExpressionAction` ne sais pas à propos de `Join` classe de plus. Sa logique est cachée par `AnalyzedJoin` iface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un blocage possible des requêtes distribuées lorsque l'un des fragments est localhost mais que la requête est envoyée via une connexion réseau. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Sémantique modifiée de plusieurs tables `RENAME` pour éviter les blocages possibles. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Serveur de compatibilité MySQL réécrit pour empêcher le chargement de la charge utile de paquet complet en mémoire. Diminution de la consommation de mémoire pour chaque connexion à environ `2 * DBMS_DEFAULT_BUFFER_SIZE` (tampons de lecture/écriture). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) -- Déplacez l'alias AST interprétant la logique hors de l'analyseur qui n'a rien à savoir sur la sémantique des requêtes. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) -- Analyse légèrement plus sûre de `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-copier`: Permet d'utiliser les `where_condition` de config avec `partition_key` alias dans la requête pour vérifier l'existence de la partition (auparavant, il était utilisé uniquement dans la lecture des requêtes de données). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) -- Ajout d'un argument de message Facultatif dans `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) -- L'exception du serveur obtenue lors de l'envoi des données d'insertion est également en cours de traitement dans le client. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) -- Ajout d'une métrique `DistributedFilesToInsert` cela montre le nombre total de fichiers dans le système de fichiers qui sont sélectionnés pour envoyer aux serveurs distants par des tables distribuées. Le nombre est additionné à travers tous les fragments. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Déplacer la plupart des jointures préparer la logique de `ExpressionAction/ExpressionAnalyzer` de `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix TSan [avertissement](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) -- De meilleurs messages d'information sur le manque de capacités Linux. Journalisation des erreurs fatales avec “fatal” niveau, cela le rendra plus facile à trouver dans `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Lorsque activer le dumping des données temporaires sur le disque pour limiter l'utilisation de la mémoire pendant `GROUP BY`, `ORDER BY` il n'a pas vérifier l'espace disque libre. Le correctif ajoute un nouveau paramètre `min_free_disk_space`, lorsque l'espace disque libre est plus petit que le seuil, la requête s'arrêtera et lancera `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimé rwlock récursif par thread. Cela n'a aucun sens, car les threads sont réutilisés entre les requêtes. `SELECT` la requête peut acquérir un verrou dans un thread, tenir un verrou d'un autre thread et quitter le premier thread. Dans le même temps, le premier fil peut être réutilisé par `DROP` requête. Cela mènera à la faux “Attempt to acquire exclusive lock recursively” message. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Split `ExpressionAnalyzer.appendJoin()`. Préparer une place dans `ExpressionAnalyzer` pour `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter `mysql_native_password` plugin d'authentification au serveur de compatibilité MySQL. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) -- Un moins grand nombre de `clock_gettime` appels; correction de la compatibilité ABI entre debug / release in `Allocator` (question insignifiante). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Déplacer `collectUsedColumns` de `ExpressionAnalyzer` de `SyntaxAnalyzer`. `SyntaxAnalyzer` faire `required_source_columns` lui-même maintenant. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter un paramètre `joined_subquery_requires_alias` pour exiger des alias pour les sous-sélections et les `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) -- Extrait `GetAggregatesVisitor` classe de `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) -- `system.query_log`: modifier le type de données de `type` colonne de `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- La liaison statique de `sha256_password` greffon d'authentification. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) -- Évitez la dépendance supplémentaire pour le paramètre `compile` travailler. Dans les versions précédentes, l'utilisateur peut obtenir une erreur comme `cannot open crti.o`, `unable to find library -lc` etc. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Plus de validation de l'entrée qui peut provenir d'une réplique malveillante. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant `clickhouse-obfuscator` le fichier est disponible dans `clickhouse-client` paquet. Dans les versions précédentes, il était disponible en tant que `clickhouse obfuscator` (avec des espaces). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) -- Blocage fixe lorsque nous avons au moins deux requêtes qui lisent au moins deux tables dans un ordre différent et une autre requête qui effectue une opération DDL sur l'une des tables. Correction d'une autre impasse très rare. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter `os_thread_ids` colonne de `system.processes` et `system.query_log` pour une meilleure mise possibilités. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Une solution de contournement pour les bogues D'extension PHP mysqlnd qui se produisent lorsque `sha256_password` est utilisé comme un plugin d'authentification par défaut (décrit dans [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) -- Supprimez la place inutile avec les colonnes de nullité modifiées. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) -- Définir la valeur par défaut de `queue_max_wait_ms` à zéro, parce que la valeur actuelle (cinq secondes) n'a aucun sens. Il y a de rares circonstances où ce paramètre a une utilité. Ajout des paramètres de `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` et `connection_pool_max_wait_ms` pour la désambiguïsation. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Extrait `SelectQueryExpressionAnalyzer` de `ExpressionAnalyzer`. Conservez le dernier pour les requêtes non-select. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) -- Suppression de la duplication des formats d'entrée et de sortie. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Autoriser l'utilisateur à remplacer `poll_interval` et `idle_connection_timeout` paramètres de connexion. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `MergeTree` a maintenant une option supplémentaire `ttl_only_drop_parts` (désactivé par défaut) pour éviter l'élagage partiel des pièces, afin qu'elles tombent complètement lorsque toutes les lignes d'une pièce sont expirées. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) -- Type vérifie les fonctions set index. Throw exception si la fonction a un mauvais type. Cela corrige le test fuzz avec UBSan. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Amélioration Des Performances {#performance-improvement-2} - -- Optimiser les requêtes avec `ORDER BY expressions` clause, où `expressions` ont coïncidé préfixe avec clé de tri dans `MergeTree` table. Cette optimisation est contrôlée par `optimize_read_in_order` paramètre. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) -- Permettre d'utiliser plusieurs threads pendant le chargement et le retrait des pièces. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Variante de lot implémentée de la mise à jour des états de fonction d'agrégat. Il peut conduire à des avantages de performance. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Utiliser `FastOps` bibliothèque de fonctions `exp`, `log`, `sigmoid`, `tanh`. FastOps est une bibliothèque mathématique vectorielle rapide de Michael Parakhin (Yandex CTO). Amélioration des performances de `exp` et `log` fonctions plus de 6 fois. Fonction `exp` et `log` de `Float32` l'argument retournera `Float32` (dans les versions précédentes, ils reviennent toujours `Float64`). Maintenant `exp(nan)` peut-retour `inf`. Le résultat de `exp` et `log` les fonctions peuvent ne pas être le nombre représentable de la machine le plus proche de la vraie réponse. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) Utilisation de la variante Danila Kutenin pour faire fonctionner les fasttops [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Désactiver l'optimisation de clé consécutive pour `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) -- Amélioration des performances de `simdjson` bibliothèque en se débarrassant de l'allocation dynamique dans `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) -- Pages de pré-défaut lors de l'allocation de mémoire avec `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) -- Correction d'un bug de performance dans `Decimal` comparaison. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-4} - -- Supprimer le compilateur (instanciation du modèle d'exécution) car nous avons gagné sur ses performances. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout d'un test de performance pour montrer la dégradation des performances dans gcc-9 de manière plus isolée. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout d'un tableau de fonction `numbers_mt`, qui est la version multithread `numbers`. Mise à jour des tests de performance avec des fonctions de hachage. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Mode de comparaison dans `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) -- Meilleur effort pour imprimer des traces de pile. Également ajouté `SIGPROF` comme un signal de débogage pour imprimer la trace de la pile d'un thread en cours d'exécution. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Chaque fonction dans son propre fichier, partie 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer doublé const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) -- Changements de formatage pour `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) -- Meilleure sous-requête pour la création de jointures dans `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) -- Supprimer une condition redondante (trouvée par PVS Studio). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) -- Séparer l'interface de table de hachage pour `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) -- Refactoring des paramètres. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alésapine](https://github.com/alesapin)) -- Ajouter des commentaires pour `set` fonctions d'index. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) -- Augmenter le score OOM dans la version de débogage sur Linux. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) -- HDFS HA fonctionne maintenant dans la construction de débogage. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) -- Ajout d'un test pour `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un test pour plusieurs vues matérialisées pour la table Kafka. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([Ivan](https://github.com/abyss7)) -- Faire mieux construire régime. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([Ivan](https://github.com/abyss7)) -- Fixe `test_external_dictionaries` intégration dans le cas où il a été exécuté sous un utilisateur non root. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Le bogue se reproduit lorsque la taille totale des paquets écrits dépasse `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) -- Ajout d'un test pour `RENAME` tableau condition de course [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Évitez la course de données sur les paramètres dans `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un test d'intégration pour gérer les erreurs par un dictionnaire de cache. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) -- Désactiver l'analyse des fichiers objet ELF sur Mac OS, car cela n'a aucun sens. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Essayez de rendre le générateur de changelog meilleur. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Additionneur `-Wshadow` passer à la GCC. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Suppression du code obsolète pour `mimalloc` soutien. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `zlib-ng` détermine les capacités x86 et enregistre ces informations dans les variables globales. Ceci est fait dans l'appel defalteInit, qui peut être fait par différents threads simultanément. Pour éviter les Écritures multithread, faites-le au démarrage de la bibliothèque. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) -- Test de régression pour un bug qui dans join qui a été corrigé dans [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) -- Rapport MSAN fixe. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du test TTL battement. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) -- Correction de fausse course de données dans `MergeTreeDataPart::is_frozen` champ. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Délais d'attente fixes dans le test fuzz. Dans la version précédente, il a réussi à trouver false hangup dans la requête `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouté debug contrôles `static_cast` des colonnes. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Prise en charge D'Oracle Linux dans les paquets RPM officiels. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Changé JSON perftests de `once` de `loop` type. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `odbc-bridge.cpp` définit `main()` donc, il ne devrait pas être inclus dans `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) -- Test de crash dans l' `FULL|RIGHT JOIN` avec nulls dans les clés de la table de droite. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajout d'un test pour la limite d'extension des alias, juste au cas où. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Commutation de `boost::filesystem` de `std::filesystem` échéant. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout de paquets RPM au site web. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un test pour fixe `Unknown identifier` exception dans `IN` section. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) -- Simplifier `shared_ptr_helper` parce que les gens confrontés à des difficultés à le comprendre. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout de tests de performance pour le codec Gorilla et DoubleDelta fixe. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) -- Diviser le test d'intégration `test_dictionaries` dans 4 tests distincts. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction de L'avertissement PVS-Studio dans `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Permettre d'utiliser `library` dictionnaire source avec ASan. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout d'une option pour générer changelog à partir d'une liste de PRs. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Verrouiller le `TinyLog` de stockage lors de la lecture. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) -- Vérifiez les liens symboliques brisés dans CI. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Augmentez le délai pour “stack overflow” test car cela peut prendre beaucoup de temps dans la construction de débogage. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout d'une vérification pour les doubles espaces. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer `new/delete` suivi de la mémoire lors de la construction avec des désinfectants. Le suivi n'est pas clair. Il empêche uniquement les exceptions de limite de mémoire dans les tests. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) -- Activez la vérification des symboles non définis lors de la liaison. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([Ivan](https://github.com/abyss7)) -- Éviter la reconstruction `hyperscan` quotidien. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Rapport UBSan fixe dans `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ne permettez pas d'utiliser query profiler avec des désinfectants car il n'est pas compatible. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un test pour recharger un dictionnaire après échec par minuterie. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction de l'incohérence dans `PipelineExecutor::prepareProcessor` type d'argument. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ajout d'un test pour les mauvais URI. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouté plus de contrôles `CAST` fonction. Cela devrait obtenir plus d'informations sur la faille de segmentation dans le test flou. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ajouter `gcc-9` soutien à `docker/builder` conteneur qui construit l'image localement. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Test de la clé primaire avec `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) -- Correction des tests affectés par l'impression de traces de pile lente. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un cas de test pour crash in `groupUniqArray` fixe dans [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) -- Tests de mutations d'indices fixes. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) -- Dans le test de performance, ne lisez pas le journal des requêtes pour les requêtes que nous n'avons pas exécutées. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) -- La vue matérialisée peut maintenant être créée avec n'importe quel type de cardinalité faible quel que soit le paramètre concernant les types de cardinalité faible suspects. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) -- Mise à jour des tests pour `send_logs_level` paramètre. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction de la construction sous gcc-8.2. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) -- Correction de la construction avec libc++interne. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([Ivan](https://github.com/abyss7)) -- Correction de la construction partagée avec `rdkafka` bibliothèque [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) -- Correctifs pour Mac OS build (incomplet). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) -- Fixer “splitted” construire. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Autres correctifs: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos Oiseau](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([Ivan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) - -#### Modification Incompatible En Arrière {#backward-incompatible-change-3} - -- Suppression de la fonction de table rarement utilisée `catBoostPool` et de stockage `CatBoostPool`. Si vous avez utilisé cette fonction de table, veuillez écrire un courriel à `clickhouse-feedback@yandex-team.com`. Notez que L'intégration CatBoost reste et sera prise en charge. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Désactiver `ANY RIGHT JOIN` et `ANY FULL JOIN` par défaut. Définir `any_join_distinct_right_table_keys` réglage pour les activer. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) - -## Clickhouse version 19.13 {#clickhouse-release-19-13} - -### Clickhouse version 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} - -#### Bug Fix {#bug-fix-9} - -- Cette version contient également toutes les corrections de bugs de 19.11.12.69. - -### Clickhouse version 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} - -#### Bug Fix {#bug-fix-10} - -- Cette version contient également toutes les corrections de bugs de 19.14.6.12. -- Correction d'un état incohérent possible de la table lors de l'exécution `DROP` requête pour la table répliquée alors que zookeeper n'est pas accessible. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Correction de la course de données dans StorageMerge [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug introduit dans query profiler qui conduit à recv sans fin de socket. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alésapine](https://github.com/alesapin)) -- Correction de l'utilisation excessive du processeur lors de l'exécution `JSONExtractRaw` la fonction sur une valeur booléenne. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corrige la régression tout en poussant vers la vue matérialisée. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([Ivan](https://github.com/abyss7)) -- Fonction de Table `url` la vulnérabilité avait-elle permis à l'attaquant d'injecter des en-têtes HTTP arbitraires dans la requête. Ce problème a été trouvé par [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fix inutile `AST` vérifier dans L'index de jeu. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) -- Fixe l'analyse de `AggregateFunction` valeurs ancrées dans la requête. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) -- Fixe mauvais comportement de `trim` les fonctions de la famille. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} - -#### Bug Fix {#bug-fix-11} - -- Cette version contient également tous les correctifs de sécurité de bugs de 19.11.9.52 et 19.11.10.54. -- Les données fixes de course `system.parts` table et `ALTER` requête. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'en-tête non apparié dans les flux se sont produits en cas de lecture à partir d'une table distribuée vide avec sample et prewhere. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un crash lors de l'utilisation de `IN` clause avec une sous-requête avec un tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Corrigé cas avec les mêmes noms de colonnes dans `GLOBAL JOIN ON` section. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un crash lors de la coulée de types à `Decimal` qui ne la supportent pas. Jetez exception à la place. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un crash dans `extractAll()` fonction. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) -- Transformation de requête pour `MySQL`, `ODBC`, `JDBC` fonctions de table fonctionne maintenant correctement pour `SELECT WHERE` requêtes avec plusieurs `AND` expression. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) -- Ajout de vérifications de déclaration précédentes pour L'intégration de MySQL 8. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) - -#### Correction De Sécurité {#security-fix-1} - -- Correction de deux vulnérabilités dans les codecs en phase de décompression (l'utilisateur malveillant peut fabriquer des données compressées qui conduiront à un débordement de tampon en décompression). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) - -### Clickhouse version 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} - -#### Bug Fix {#bug-fix-12} - -- Fixer `ALTER TABLE ... UPDATE` requête pour les tables avec `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alésapine](https://github.com/alesapin)) -- Correction de NPE lors de l'utilisation de la clause IN avec une sous-requête avec un tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un problème que si un réplica périmé devient vivant, il peut encore avoir des parties de données qui ont été supprimés par la partition DROP. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un problème avec l'analyse CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- Course de données fixe dans le système.table de pièces et ALTER query. Cela corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du mauvais code dans les mutations qui peuvent conduire à la corruption de la mémoire. Correction de segfault avec lecture de l'adresse `0x14c0` cela peut se produire en raison de simultané `DROP TABLE` et `SELECT` de `system.parts` ou `system.parts_columns`. Condition de course fixe dans la préparation des requêtes de mutation. Blocage fixe causé par `OPTIMIZE` des tables répliquées et des opérations de modification simultanées comme ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction possible perte de données après `ALTER DELETE` requête sur la table avec l'index de saut. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Correction De Sécurité {#security-fix-2} - -- Si L'attaquant a un accès en écriture à ZooKeeper et est capable d'exécuter un serveur personnalisé disponible à partir du réseau où clickhouse s'exécute, il peut créer un serveur malveillant sur mesure qui agira comme réplique de ClickHouse et l'enregistrer dans ZooKeeper. Lorsqu'une autre réplique récupère une partie de données à partir d'une réplique malveillante, elle peut forcer clickhouse-server à écrire sur un chemin arbitraire sur le système de fichiers. Trouvé par Eldar Zaitov, équipe de sécurité de L'information chez Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} - -#### Nouveauté {#new-feature-5} - -- Échantillonnage du profileur au niveau de la requête. [Exemple](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) -- Permet de spécifier une liste de colonnes avec `COLUMNS('regexp')` expression qui fonctionne comme une variante plus sophistiquée de `*` astérisque. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `CREATE TABLE AS table_function()` est maintenant possible [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) -- Adam optimizer pour la descente de gradient stochastique est utilisé par défaut dans `stochasticLinearRegression()` et `stochasticLogisticRegression()` fonctions d'agrégation, car il montre une bonne qualité sans presque aucun réglage. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) -- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Andy Yang](https://github.com/andyyzh)) -- `RENAME` les requêtes fonctionnent maintenant avec tous les stockages. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([Ivan](https://github.com/abyss7)) -- Maintenant client de recevoir les journaux du serveur avec n'importe quel niveau de `send_logs_level` quel que soit le niveau de journal spécifié dans les paramètres du serveur. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) - -#### Modification Incompatible En Arrière {#backward-incompatible-change-4} - -- Paramètre `input_format_defaults_for_omitted_fields` est activé par défaut. Les insertions dans les tables distribuées ont besoin que ce paramètre soit le même sur le cluster (vous devez le définir avant de lancer la mise à jour). Il permet de calculer des expressions par défaut Complexes pour les champs omis dans `JSONEachRow` et `CSV*` format. Il devrait être le comportement attendu, mais peut conduire à négligeable différence de performances. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) - -#### Caractéristiques expérimentales {#experimental-features} - -- Nouveau pipeline de traitement des requêtes. Utiliser `experimental_use_processors=1` une option pour l'activer. Utilisez pour votre propre problème. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Bug Fix {#bug-fix-13} - -- L'intégration de Kafka a été corrigée dans cette version. -- Fixe `DoubleDelta` l'encodage de `Int64` pour les grands `DoubleDelta` les valeurs, l'amélioration de la `DoubleDelta` encodage de données aléatoires pour `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) -- Surestimation fixe de `max_rows_to_read` si le paramètre `merge_tree_uniform_read_distribution` est réglé sur 0. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Amélioration {#improvement-4} - -- Lève une exception si `config.d` le fichier n'a pas l'élément racine correspondant comme fichier de configuration [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) - -#### Amélioration Des Performances {#performance-improvement-3} - -- Optimiser `count()`. Maintenant, il utilise la plus petite colonne (si possible). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos Oiseau](https://github.com/amosbird)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-5} - -- Signaler l'utilisation de la mémoire dans les tests de performance. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) -- Correction de la construction avec externe `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([Ivan](https://github.com/abyss7)) -- Correction de la construction partagée avec `rdkafka` bibliothèque [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([Ivan](https://github.com/abyss7)) - -## Clickhouse version 19.11 {#clickhouse-release-19-11} - -### Version de ClickHouse 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} - -#### Bug Fix {#bug-fix-14} - -- Correction d'un crash rare dans `ALTER MODIFY COLUMN` et fusion verticale lorsque l'une des parties fusionnées/modifiées est vide (0 lignes). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alésapine](https://github.com/alesapin)) -- Mise à jour manuelle de `SIMDJSON`. Cela corrige l'inondation possible des fichiers stderr avec des messages de diagnostic JSON faux. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) -- Correction d'un bug avec `mrk` extension de fichier pour mutations ([alésapine](https://github.com/alesapin)) - -### Version de ClickHouse 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} - -#### Bug Fix {#bug-fix-15} - -- Correction de la dégradation des performances de l'analyse d'index sur les clés complexes sur les grandes tables. Cela corrige [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Évitez SIGSEGV rare lors de l'envoi de données dans des tables avec moteur distribué (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) -- Fixer `Unknown identifier` avec plusieurs jointures. Cela corrige [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) - -### Clickhouse version 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} - -- Correction d'une erreur logique provoquant segfaults lors de la sélection de Kafka sujet vide. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([Ivan](https://github.com/abyss7)) -- Correctif pour la fonction `АrrayEnumerateUniqRanked` avec des tableaux vides dans params. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) - -### Clickhouse version 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} - -#### Bug Fix {#bug-fix-16} - -- Stockez manuellement les décalages des messages Kafka pour pouvoir les valider tous à la fois pour toutes les partitions. Corrige la duplication potentielle dans “one consumer - many partitions” scénario. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([Ivan](https://github.com/abyss7)) - -### Clickhouse version 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} - -- Améliorer la gestion des erreurs dans les dictionnaires de cache. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction d'un bug dans la fonction `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) -- Fixer `JSONExtract` fonction lors de l'extraction d'une `Tuple` de JSON. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction possible perte de données après `ALTER DELETE` requête sur la table avec l'index de saut. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) -- Test de performance fixe. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Parquet: Correction de la lecture des colonnes booléennes. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe mauvais comportement de `nullIf` fonction pour les arguments constants. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du problème de duplication des messages Kafka lors du redémarrage normal du serveur. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([Ivan](https://github.com/abyss7)) -- Correction d'un problème quand long `ALTER UPDATE` ou `ALTER DELETE` peut empêcher régulière fusionne à exécuter. Empêcher les mutations de s'exécuter s'il n'y a pas assez de threads libres disponibles. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) -- Correction d'une erreur avec le traitement “timezone” dans le fichier de configuration du serveur. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction des tests kafka. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([Ivan](https://github.com/abyss7)) - -#### Correction De Sécurité {#security-fix-3} - -- Si L'attaquant a un accès en écriture à ZooKeeper et est capable d'exécuter un serveur personnalisé disponible à partir du réseau où clickhouse s'exécute, il peut créer un serveur malveillant personnalisé qui agira comme réplique de ClickHouse et l'enregistrer dans ZooKeeper. Lorsqu'une autre réplique récupère une partie de données à partir d'une réplique malveillante, elle peut forcer clickhouse-server à écrire sur un chemin arbitraire sur le système de fichiers. Trouvé par Eldar Zaitov, équipe de sécurité de L'information chez Yandex. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} - -#### Bug Fix {#bug-fix-17} - -- Fixer `ALTER TABLE ... UPDATE` requête pour les tables avec `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alésapine](https://github.com/alesapin)) -- Correction de NPE lors de l'utilisation de la clause IN avec une sous-requête avec un tuple. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un problème que si un réplica périmé devient vivant, il peut encore avoir des parties de données qui ont été supprimés par la partition DROP. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un problème avec l'analyse CSV [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- Course de données fixe dans le système.table de pièces et ALTER query. Cela corrige [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du mauvais code dans les mutations qui peuvent conduire à la corruption de la mémoire. Correction de segfault avec lecture de l'adresse `0x14c0` cela peut se produire en raison de simultané `DROP TABLE` et `SELECT` de `system.parts` ou `system.parts_columns`. Condition de course fixe dans la préparation des requêtes de mutation. Blocage fixe causé par `OPTIMIZE` des tables répliquées et des opérations de modification simultanées comme ALTERs. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} - -#### Bug fix {#bug-fix-18} - -- L'intégration de Kafka a été corrigée dans cette version. -- Correction de segfault lors de l'utilisation `arrayReduce` pour les querelles constantes. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe `toFloat()` monotonie. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- Correction de segfault avec activé `optimize_skip_unused_shards` et clé de sharding manquante. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) -- Fixe la logique de `arrayEnumerateUniqRanked` fonction. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Suppression de la journalisation supplémentaire du gestionnaire MySQL. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un comportement incorrect et de segfaults possibles dans `topK` et `topKWeighted` agrégé fonctions. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) -- N'exposez pas les colonnes virtuelles dans `system.columns` table. Ceci est nécessaire pour la compatibilité descendante. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug avec l'allocation de mémoire pour les champs de chaîne dans le dictionnaire de cache de clé complexe. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug avec l'activation de la granularité adaptative lors de la création d'une nouvelle réplique pour `Replicated*MergeTree` table. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alésapine](https://github.com/alesapin)) -- Correction de la boucle infinie lors de la lecture des messages Kafka. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) -- Correction de la possibilité d'une requête fabriquée pour provoquer un crash du serveur en raison d'un débordement de pile dans L'analyseur SQL et de la possibilité d'un débordement de pile dans `Merge` et `Distributed` table [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction D'une erreur D'encodage de gorille sur les petites séquences. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) - -#### Amélioration {#improvement-5} - -- Autoriser l'utilisateur à remplacer `poll_interval` et `idle_connection_timeout` paramètres de connexion. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} - -#### Bug fix {#bug-fix-19} - -- Correction de la possibilité de suspendre les requêtes lorsque le serveur est surchargé. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de FPE dans la fonction yandexconsistenthash. Cela corrige [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug dans la conversion de `LowCardinality` types de `AggregateFunctionFactory`. Cela corrige [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Corrigé de l'analyse de `bool` les paramètres de `true` et `false` chaînes de caractères dans les fichiers de configuration. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug rare avec des en-têtes de flux incompatibles dans les requêtes `Distributed` table de `MergeTree` table quand une partie de `WHERE` se déplace à `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alésapine](https://github.com/alesapin)) -- Dépassement fixe dans la division entière du type signé au type non signé. Cela corrige [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Modification Incompatible En Arrière {#backward-incompatible-change-5} - -- `Kafka` toujours en panne. - -### Clickhouse version 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} - -#### Bug Fix {#bug-fix-20} - -- Correction d'un bug avec l'écriture de marques d'indices secondaires avec une granularité adaptative. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alésapine](https://github.com/alesapin)) -- Fixer `WITH ROLLUP` et `WITH CUBE` les modificateurs de `GROUP BY` avec agrégation à deux niveaux. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Correction du blocage dans `JSONExtractRaw` fonction. Fixe [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de segfault dans ExternalLoader::reloadOutdated (). [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction du cas où le serveur peut fermer les sockets d'écoute mais ne pas arrêter et continuer à servir les requêtes restantes. Vous pouvez vous retrouver avec deux processus clickhouse-server en cours d'exécution. Parfois, le serveur peut renvoyer une erreur `bad_function_call` pour les requêtes restantes. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une condition inutile et incorrecte sur le champ de mise à jour pour le chargement initial des dictionnaires externes via ODBC, MySQL, ClickHouse et HTTP. Cela corrige [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une exception non pertinente dans la distribution de `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un résultat non déterministe de “uniq” fonction agrégée dans des cas extrêmement rares. Le bug était présent dans toutes les versions de ClickHouse. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Segfault lorsque nous définissons un peu trop haut CIDR sur la fonction `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Correction d'une petite fuite de mémoire lorsque le serveur lance de nombreuses exceptions dans de nombreux contextes différents. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corrigez la situation lorsque le consommateur a été mis en pause avant l'abonnement et n'a pas repris après. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([Ivan](https://github.com/abyss7)) Notez que Kafka est cassé dans cette version. -- Effacement du tampon de données Kafka de l'opération de lecture précédente terminée par une erreur [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Notez que Kafka est cassé dans cette version. -- Depuis `StorageMergeTree::background_task_handle` est initialisée dans `startup()` le `MergeTreeBlockOutputStream::write()` peut tenter de l'utiliser avant l'initialisation. Vérifiez simplement s'il est initialisé. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([Ivan](https://github.com/abyss7)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-6} - -- Ajouté officiel `rpm` paquet. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alésapine](https://github.com/alesapin)) -- Ajouter une capacité à construire `.rpm` et `.tgz` les paquets avec `packager` script. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alésapine](https://github.com/alesapin)) -- Des correctifs pour “Arcadia” système de construction. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) - -#### Modification Incompatible En Arrière {#backward-incompatible-change-6} - -- `Kafka` est cassé dans cette version. - -### Clickhouse version 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} - -#### Nouveauté {#new-feature-6} - -- Ajout du support pour les déclarations préparées. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alexander](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `DoubleDelta` et `Gorilla` codecs de colonne [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) -- Ajouter `os_thread_priority` paramètre qui permet de contrôler la “nice” valeur des threads de traitement de requête utilisés par le système d'exploitation pour ajuster la priorité de planification dynamique. Il exige `CAP_SYS_NICE` capacités à travailler. Cela met en œuvre [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre `_topic`, `_offset`, `_key` colonnes pour moteur Kafka [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([Ivan](https://github.com/abyss7)) Notez que Kafka est cassé dans cette version. -- Ajouter agrégat fonction combinateur `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) -- Les fonctions d'agrégation `groupArrayMovingSum(win_size)(x)` et `groupArrayMovingAvg(win_size)(x)`, qui calculent la somme mobile / avg avec ou sans limitation de taille de fenêtre. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) -- Ajouter synonim `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) -- Fonction Intergate H3 `geoToH3` de Uber. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Bug Fix {#bug-fix-21} - -- Implémentez le cache DNS avec une mise à jour asynchrone. Thread séparé résout tous les hôtes et met à jour le cache DNS avec la période (Paramètre `dns_cache_update_period`). Cela devrait aider, lorsque l'adresse ip des hôtes change fréquemment. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) -- Fixer erreur de segmentation dans `Delta` codec qui affecte les colonnes avec des valeurs inférieures à 32 bits. Le bug a conduit à la corruption de la mémoire aléatoire. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alésapine](https://github.com/alesapin)) -- Correction de segfault dans la fusion TTL avec des colonnes non physiques en bloc. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Correction d'un bug rare dans la vérification de la pièce avec `LowCardinality` colonne. Précédemment `checkDataPart` échoue toujours pour une partie avec `LowCardinality` colonne. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alésapine](https://github.com/alesapin)) -- Évitez de suspendre les connexions lorsque le pool de threads du serveur est plein. Il est important pour les connexions de `remote` fonction de table ou connexions à un fragment sans réplicas lorsqu'il y a un long délai de connexion. Cela corrige [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Prise en charge des arguments constants pour `evalMLModel` fonction. Cela corrige [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du problème lorsque ClickHouse détermine le fuseau horaire par défaut comme `UCT` plutôt `UTC`. Cela corrige [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe de type dépassement de tampon dans `visitParamExtractRaw`. Cela corrige [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant distribué `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` les requêtes seront exécutées directement sur la réplique leader. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alésapine](https://github.com/alesapin)) -- Fixer `coalesce` pour `ColumnConst` avec `ColumnNullable` + changements connexes. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixer le `ReadBufferFromKafkaConsumer` alors qu'il continue à lire de nouveaux messages après `commit()` même si elle a été interrompue avant [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([Ivan](https://github.com/abyss7)) -- Fixer `FULL` et `RIGHT` Joindre les résultats lors de l'adhésion sur `Nullable` clés dans la table de droite. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction Possible du sommeil infini des requêtes de faible priorité. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la condition de concurrence, qui fait que certaines requêtes peuvent ne pas apparaître dans query\_log après `SYSTEM FLUSH LOGS` requête. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Fixe `heap-use-after-free` Avertissement ASan dans ClusterCopier causé par la montre qui essaie d'utiliser l'objet copieur déjà supprimé. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixe de mal `StringRef` pointeur retourné par certaines implémentations de `IColumn::deserializeAndInsertFromArena`. Ce bogue n'a affecté que les tests unitaires. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Empêcher les colonnes de jointure de tableau source et intermédiaire de masquer les colonnes de même nom. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixer insérer et sélectionner la requête au moteur MySQL avec l'identifiant de style MySQL citant. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Maintenant `CHECK TABLE` query peut fonctionner avec la famille de moteurs MergeTree. Il renvoie l'état de contrôle et le message le cas échéant pour chaque partie (ou fichier dans le cas de moteurs plus simples). Aussi, correction d'un bug dans l'extraction d'une partie cassée. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alésapine](https://github.com/alesapin)) -- Correction de L'exécution SPLIT\_SHARED\_LIBRARIES [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) -- Correction de l'initialisation du fuseau horaire lorsque `/etc/localtime` est un lien symbolique comme `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- clickhouse-copieur: Fix utiliser-après livraison à l'arrêt [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) -- Mettre `simdjson`. Correction du problème que certains JSONs invalides avec zéro octets analysent avec succès. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de l'arrêt des SystemLogs [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) -- Correction de la suspension lorsque la condition dans invalidate\_query dépend d'un dictionnaire. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Amélioration {#improvement-6} - -- Autoriser les adresses insolubles dans la configuration du cluster. Ils seront considérés comme indisponibles et essayés de résoudre à chaque tentative de connexion. Ceci est particulièrement utile pour Kubernetes. Cela corrige [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fermez les connexions TCP inactives (avec un délai d'attente d'une heure par défaut). Ceci est particulièrement important pour les grands clusters avec plusieurs tables distribuées sur chaque serveur, car chaque serveur peut éventuellement conserver un pool de connexions à tous les autres serveurs, et après la concurrence maximale des requêtes, les connexions calent. Cela corrige [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Meilleure qualité de `topK` fonction. Modification du comportement de L'ensemble SavingSpace pour supprimer le dernier élément si le nouvel élément a un poids plus important. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Les fonctions D'URL pour travailler avec des domaines peuvent maintenant fonctionner pour les URL incomplètes sans schéma [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alésapine](https://github.com/alesapin)) -- Sommes de contrôle ajoutées à la `system.parts_columns` table. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Ajouter `Enum` type de données comme synonyme de `Enum8` ou `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) -- Variante de transposition de bits complète pour `T64` codec. Pourrait conduire à une meilleure compression avec `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) -- Condition sur `startsWith` fonction maintenant peut utilise la clé primaire. Cela corrige [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) et [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) -- Permettre d'utiliser `clickhouse-copier` avec la topologie de cluster de réplication croisée en permettant le nom de base de données vide. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) -- Utiliser `UTC` comme fuseau horaire par défaut sur un système sans `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` a été imprimé et le serveur ou le client a refusé de démarrer. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Retourné soutien à virgule flottante argument dans la fonction `quantileTiming` pour la compatibilité descendante. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Afficher quelle table est manquante colonne dans les messages d'erreur. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([Ivan](https://github.com/abyss7)) -- Interdire l'exécution d'une requête avec le même query\_id par divers utilisateurs [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) -- Code plus robuste pour envoyer des métriques au Graphite. Cela fonctionnera même pendant de longues périodes multiples `RENAME TABLE` opération. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Des messages d'erreur plus informatifs seront affichés lorsque ThreadPool ne peut pas planifier une tâche pour l'exécution. Cela corrige [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Inverser ngramSearch pour être plus intuitif [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) -- Ajouter l'analyse utilisateur dans HDFS engine builder [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) -- Mettre à jour la valeur par défaut de `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) -- Ajout d'une notion de paramètres obsolètes. Le paramètre obsolète `allow_experimental_low_cardinality_type` peut être utilisé avec aucun effet. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) - -#### Amélioration Des Performances {#performance-improvement-4} - -- Augmentez le nombre de flux à sélectionner dans la table de fusion pour une distribution plus uniforme des threads. Ajout d'un réglage `max_streams_multiplier_for_merge_tables`. Cela corrige [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-7} - -- Ajoutez un test de rétrocompatibilité pour l'interaction client-serveur avec différentes versions de clickhouse. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alésapine](https://github.com/alesapin)) -- Testez les informations de couverture dans chaque demande de validation et de tirage. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alésapine](https://github.com/alesapin)) -- Coopérez avec le désinfectant d'adresse pour soutenir nos allocateurs faits sur commande (`Arena` et `ArenaWithFreeLists`) pour une meilleure mise “use-after-free” erreur. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) -- Interrupteur à [Implémentation de LLVM libunwind](https://github.com/llvm-mirror/libunwind) pour la gestion des exceptions C++ et pour l'impression des traces de pile [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) -- Ajouter deux autres avertissements de-Weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Permettre de construire ClickHouse avec aseptisant mémoire. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Rapport ubsan fixe sur `bitTest` fonction dans fuzz test. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Docker: ajout de la possibilité d'initialiser une instance de ClickHouse qui nécessite une authentification. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) -- Mettre à jour librdkafka vers la version 1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([Ivan](https://github.com/abyss7)) -- Ajoutez un délai d'attente global pour les tests d'intégration et désactivez certains d'entre eux dans le code des tests. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alésapine](https://github.com/alesapin)) -- Correction de quelques échecs ThreadSanitizer. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) -- Le `--no-undefined` option force l'éditeur de liens à vérifier l'existence de tous les noms externes lors de la liaison. Il est très utile de suivre les dépendances réelles entre les bibliothèques en mode de construction fractionnée. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([Ivan](https://github.com/abyss7)) -- Ajouté test de performance pour [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la compatibilité avec gcc-7. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout du support pour gcc-9. Cela corrige [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur lorsque libunwind peut être lié de manière incorrecte. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de quelques avertissements trouvés par PVS-Studio. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout du support initial pour `clang-tidy` analyseur statique. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Convertir les macros BSD / Linux endian( ‘be64toh’ et ‘htobe64’) aux équivalents Mac OS X [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fu Chen](https://github.com/fredchenbj)) -- Amélioration du guide des tests d'intégration. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction de la construction sur macosx + gcc9 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) -- Correction d'une faute de frappe difficile à repérer: aggreAGte - \> aggregate. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) -- Correction de la construction freebsd [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) -- Ajouter un lien vers la chaîne Youtube expérimentale au site web [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) -- CMake: ajouter une option pour les drapeaux de couverture: WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) -- Correction de la taille initiale de certains PODArray en ligne. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) -- clickhouse-serveur.postinst: correction de la détection du système d'exploitation pour centos 6 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) -- Ajout de la génération de paquets Arch linux. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Diviser commun / config.h par libs (SGBD) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) -- Des correctifs pour “Arcadia” créer une plate-forme [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) -- Correctifs pour la construction non conventionnelle (gcc9, pas de sous-modules) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) -- Exiger un type explicite dans unalignedStore car il a été prouvé qu'il était sujet aux bugs [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) -- Corrige la construction MacOS [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) -- Test de Performance concernant la nouvelle fonctionnalité JIT avec un ensemble de données plus grand, comme demandé ici [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Exécuter des tests avec État dans le test de stress [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alésapine](https://github.com/alesapin)) - -#### Modification Incompatible En Arrière {#backward-incompatible-change-7} - -- `Kafka` est cassé dans cette version. -- Permettre `adaptive_index_granularity` = 10 Mo par défaut pour les nouveaux `MergeTree` table. Si vous avez créé de nouvelles tables MergeTree sur la version 19.11+, il sera impossible de passer à des versions antérieures à 19.6. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alésapine](https://github.com/alesapin)) -- Suppression des dictionnaires intégrés obsolètes non documentés utilisés par Yandex.Metrica. Fonction `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` ne sont plus disponibles. Si vous utilisez ces fonctions, écrivez un courriel à clickhouse-feedback@yandex-team.com. Note: au dernier moment, nous avons décidé de garder ces fonctions pendant un certain temps. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -## Clickhouse version 19.10 {#clickhouse-release-19-10} - -### Clickhouse version 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} - -#### Nouveauté {#new-feature-7} - -- Ajouter un nouveau codec de colonne: `T64`. Fait pour les colonnes(U)IntX/EnumX/Data (Time)/DecimalX. Il devrait être bon pour les colonnes avec des valeurs de plage constantes ou petites. Codec lui-même permet agrandir ou réduire le type de données sans re-compression. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter un moteur de base de données `MySQL` qui permettent d'afficher toutes les tables dans le serveur MySQL distant [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([L'Hiver Zhang](https://github.com/zhang2014)) -- `bitmapContains` application. C'est 2x plus rapide que `bitmapHasAny` si le second bitmap contient un élément. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) -- Soutien pour `crc32` fonction (avec un comportement exactement comme dans MySQL ou PHP). Ne l'utilisez pas si vous avez besoin d'une fonction de hachage. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) -- Mettre `SYSTEM START/STOP DISTRIBUTED SENDS` requêtes pour contrôler les insertions asynchrones dans `Distributed` table. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([L'Hiver Zhang](https://github.com/zhang2014)) - -#### Bug Fix {#bug-fix-22} - -- Ignorer les limites d'exécution des requêtes et la taille maximale des pièces pour les limites de fusion lors de l'exécution des mutations. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) -- Correction d'un bug qui peut conduire à la déduplication de blocs normaux (extrêmement rare) et l'insertion de blocs en double (plus souvent). [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alésapine](https://github.com/alesapin)) -- Correction de la fonction `arrayEnumerateUniqRanked` pour les arguments avec des tableaux vides [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) -- Ne vous abonnez pas aux sujets Kafka sans l'intention d'interroger des messages. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([Ivan](https://github.com/abyss7)) -- Faire la mise en `join_use_nulls` n'obtenez aucun effet pour les types qui ne peuvent pas être à L'intérieur de Nullable [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fixe `Incorrect size of index granularity` erreur [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) -- Correction du flotteur en décimal convertir le débordement [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) -- Vider le tampon quand `WriteBufferFromHDFS`'s destructeur est appelé. Cela corrige l'écriture dans `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) - -#### Amélioration {#improvement-7} - -- Traiter les cellules vides dans `CSV` comme valeurs par défaut lorsque le paramètre `input_format_defaults_for_omitted_fields` est activé. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) -- Chargement Non bloquant des dictionnaires externes. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) -- Les délais d'attente réseau peuvent être modifiés dynamiquement pour les connexions déjà établies en fonction des paramètres. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) -- Utiliser “public\_suffix\_list” pour les fonctions `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. Il utilise une table de hachage parfaite générée par `gperf` avec une liste générée à partir du fichier: https://publicsuffix.org/list/public\_suffix\_list.dat. (par exemple, nous reconnaissons maintenant le domaine `ac.uk` comme non significatif). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Adopté `IPv6` type de données dans les tables système; colonnes unified client info dans `system.processes` et `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Utilisation de sessions pour les connexions avec le protocole de compatibilité MySQL. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) -- Support plus `ALTER` requête `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) -- Soutien `` section dans `clickhouse-local` fichier de configuration. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) -- Autoriser exécuter la requête avec `remote` fonction de table dans `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) - -#### Amélioration Des Performances {#performance-improvement-5} - -- Ajoutez la possibilité d'écrire la marque finale à la fin des colonnes MergeTree. Il permet d'éviter les lectures inutiles pour les clés qui sont hors de la plage de données de la table. Elle n'est activée que si la granularité d'index adaptatif est utilisée. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alésapine](https://github.com/alesapin)) -- Amélioration des performances des tables MergeTree sur les systèmes de fichiers très lents en réduisant `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la dégradation des performances en lecture à partir des tables MergeTree introduites dans la version 19.6. Corrections \# 5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-8} - -- Mettre `TestKeeper` en tant qu'implémentation de l'interface ZooKeeper utilisée pour les tests [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexeï-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) -- Désormais `.sql` les tests peuvent être exécutés isolés par le serveur, en parallèle, avec une base de données aléatoire. Il permet de les exécuter plus rapidement, d'ajouter de nouveaux tests avec des configurations de serveur personnalisées et de s'assurer que les différents tests ne s'affectent pas les uns les autres. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([Ivan](https://github.com/abyss7)) -- Supprimer `` et `` à partir de tests de performance [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fixe “select\_format” essai de performance pour `Pretty` format [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -## Clickhouse version 19.9 {#clickhouse-release-19-9} - -### Clickhouse version 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} - -#### Bug Fix {#bug-fix-23} - -- Correction de segfault dans le codec Delta qui affecte les colonnes avec des valeurs inférieures à 32 bits. Le bug a conduit à la corruption de la mémoire aléatoire. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug rare dans la vérification de la partie avec la colonne LowCardinality. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alésapine](https://github.com/alesapin)) -- Correction de segfault dans la fusion TTL avec des colonnes non physiques en bloc. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Correction du sommeil infini potentiel des requêtes de faible priorité. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la façon dont ClickHouse détermine le fuseau horaire par défaut comme UCT au lieu de UTC. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug sur l'exécution distribuée DROP/ALTER/TRUNCATE / OPTIMIZE sur les requêtes de CLUSTER sur la réplique suiveur avant la réplique leader. Maintenant, ils seront exécutés directement sur la réplique leader. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alésapine](https://github.com/alesapin)) -- Correction de la condition de concurrence, ce qui fait que certaines requêtes peuvent ne pas apparaître instantanément dans query\_log après la requête system FLUSH LOGS. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Ajout du support manquant pour les arguments constants à `evalMLModel` fonction. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} - -#### Nouveauté {#new-feature-8} - -- Imprimer des informations sur les pièces gelées dans `system.parts` table. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) -- Demander mot de passe du client sur clickhouse-client démarrer sur ats s'il n'est pas dans les arguments [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) -- Mettre `dictGet` et `dictGetOrDefault` fonctions pour les types Décimaux. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Amélioration {#improvement-8} - -- Debian init: ajout d'un délai d'arrêt du service [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) -- Ajouter un paramètre interdit par défaut pour créer une table avec des types suspects pour LowCardinality [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) -- Les fonctions de régression renvoient les poids du modèle lorsqu'elles ne sont pas utilisées comme État dans la fonction `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) -- Renommer et améliorer les méthodes de régression. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) -- Interfaces plus claires des chercheurs de chaînes. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) - -#### Bug Fix {#bug-fix-24} - -- Correction de la perte de données potentielle dans Kafka [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([Ivan](https://github.com/abyss7)) -- Correction d'une boucle infinie potentielle dans `PrettySpace` format lorsqu'il est appelé avec zéro colonnes [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) -- Correction d'un bug de débordement UInt32 dans les modèles linéaires. Autoriser le modèle EVAL ML pour l'argument du modèle non const. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `ALTER TABLE ... DROP INDEX IF EXISTS ...` ne devrait pas soulever une exception si l'index n'existe pas [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Fixer erreur de segmentation avec `bitmapHasAny` dans la sous-requête scalaire [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Correction d'une erreur lorsque le pool de connexions de réplication ne tente pas de résoudre l'hôte, même lorsque le cache DNS a été supprimé. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alésapine](https://github.com/alesapin)) -- Fixe `ALTER ... MODIFY TTL` sur ReplicatedMergeTree. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) -- Correction de L'insertion dans une table distribuée avec une colonne matérialisée [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) -- Correction d'un mauvais alloc lorsque truncate Join storage [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) -- Dans les versions récentes du paquet tzdata, certains fichiers sont maintenant des liens symboliques. Le mécanisme actuel de détection du fuseau horaire par défaut est cassé et donne des noms erronés pour certains fuseaux horaires. Maintenant, au moins, nous forçons le nom du fuseau horaire au contenu de TZ si fourni. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) -- Fixer certains cas extrêmement rares avec multivolnitsky searcher lorsque les aiguilles constantes en somme sont au moins 16KB long. L'algorithme a manqué ou écrasé les résultats précédents ce qui peut conduire au résultat incorrect de `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) -- Résolvez le problème lorsque les paramètres des requêtes ExternalData ne pouvaient pas utiliser les paramètres ClickHouse. Aussi, pour l'instant, paramètres `date_time_input_format` et `low_cardinality_allow_in_native_format` ne peut pas être utilisé en raison de l'ambiguïté des noms (en données externe, il peut être interprété comme format de tableau et dans la requête, il peut être un paramètre). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) -- Correction d'un bug lorsque des pièces ont été supprimées uniquement de FS sans les laisser tomber de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alésapine](https://github.com/alesapin)) -- Supprimer la journalisation de débogage du protocole MySQL [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ignorer ZNONODE pendant le traitement de la requête DDL [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Fix mix `UNION ALL` type de colonne de résultat. Il y avait des cas avec des données incohérentes et des types de colonnes de colonnes résultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- Lancer une exception sur des entiers erronés dans `dictGetT` fonctions au lieu de crash. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction de mauvais element\_count et load\_factor pour le dictionnaire haché dans `system.dictionaries` table. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-9} - -- Construction fixe Sans `Brotli` Prise en charge de la compression HTTP (`ENABLE_BROTLI=OFF` cmake variable). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) -- Inclure rugissement.h comme rugissant / rugissant.h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) -- Correction des avertissements gcc9 dans hyperscan(la directive \# line est mauvaise!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) -- Corrigez tous les avertissements lors de la compilation avec gcc-9. Correction de certains problèmes de contrib. Corrigez GCC9 ICE et soumettez-le à bugzilla. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) -- Liaison fixe avec lld [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer les spécialisations dans les dictionnaires [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) -- Amélioration des tests de performance pour le formatage et l'analyse des tables pour différents types de fichiers [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) -- Corrections pour l'exécution de test parallèle [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) -- Docker: utiliser les configs de clickhouse-test [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) -- Correction de la compilation Pour FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) -- Mise à niveau boost à 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) -- Fixer construire clickhouse comme sous-module [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) -- Améliorer les tests de performance JSONExtract [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) - -## Clickhouse version 19.8 {#clickhouse-release-19-8} - -### Clickhouse version 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} - -#### Nouveauté {#new-features} - -- Ajout de fonctions pour travailler avec JSON [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) -- Ajouter une fonction basename, avec un comportement similaire à une fonction basename, qui existe dans beaucoup de langues (`os.path.basename` en python, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Ajouter `LIMIT n, m BY` ou `LIMIT m OFFSET n BY` syntaxe pour définir le décalage de N pour la clause LIMIT BY. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) -- Ajouté nouveau type de données `SimpleAggregateFunction`, ce qui permet d'avoir des colonnes avec agrégation de lumière dans un `AggregatingMergeTree`. Cela ne peut être utilisé avec des fonctions simples comme `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) -- Ajout du support pour les arguments non constants dans la fonction `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) -- L'ajout de fonctions `skewPop`, `skewSamp`, `kurtPop` et `kurtSamp` pour calculer l'asymétrie de séquence, l'asymétrie de l'échantillon, la kurtose et la kurtose de l'échantillon respectivement. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) -- Soutien renommer opération pour `MaterializeView` stockage. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Serveur Ajouté qui permet de se connecter à ClickHouse en utilisant le client MySQL. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) -- Ajouter `toDecimal*OrZero` et `toDecimal*OrNull` fonction. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) -- Soutenir les types décimaux dans les fonctions: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) -- Ajouter `format` fonction. Formatage du motif constant (modèle de format Python simplifié) avec les chaînes listées dans les arguments. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) -- Ajouter `system.detached_parts` tableau contenant des informations sur les parties détachées de `MergeTree` table. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) -- Ajouter `ngramSearch` fonction pour calculer la différence non symétrique entre l'aiguille et la botte de foin. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) -- Mise en œuvre de méthodes d'apprentissage automatique de base (régression linéaire stochastique et régression logistique) à l'aide de l'interface des fonctions agrégées. A différentes stratégies pour mettre à jour les poids du modèle (descente de gradient simple, méthode momentum, méthode Nesterov). Prend également en charge les mini-lots de taille personnalisée. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) -- La mise en œuvre de `geohashEncode` et `geohashDecode` fonction. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) -- Fonction agrégée ajoutée `timeSeriesGroupSum` qui peut regrouper différentes séries de l'échantillon d'horodatage de l'alignement. Il utilisera une interpolation linéaire entre deux échantillons d'horodatage, puis additionnera les séries temporelles ensemble. Fonction agrégée ajoutée `timeSeriesGroupRateSum`, qui calcule le taux de séries chronologiques, puis additionne les taux ensemble. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Yangkuan Liu](https://github.com/LiuYangkuan)) -- L'ajout de fonctions `IPv4CIDRtoIPv4Range` et `IPv6CIDRtoIPv6Range` pour calculer les limites inférieures et supérieures pour une adresse IP dans le sous-réseau à l'aide D'un CIDR. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Ajouter un en-tête X-Clickhouse-Summary lorsque nous envoyons une requête en utilisant HTTP avec paramètre activé `send_progress_in_http_headers`. Renvoie les informations habituelles de X-ClickHouse-Progress, avec des informations supplémentaires telles que le nombre de lignes et d'octets insérés dans la requête. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Amélioration {#improvements} - -- Ajouter `max_parts_in_total` paramètre pour la famille de tables MergeTree (par défaut: 100 000) qui empêche la spécification dangereuse de la clé de partition \# 5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-obfuscator`: dériver la graine pour les colonnes individuelles en combinant la graine initiale avec le nom de la colonne, pas la position de la colonne. Ceci est destiné à transformer des ensembles de données avec plusieurs tables associées, de sorte que les tables restent joignables après la transformation. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- L'ajout de fonctions `JSONExtractRaw`, `JSONExtractKeyAndValues`. Renommé fonctions `jsonExtract` de `JSONExtract`. Quand quelque chose ne va pas, ces fonctions renvoient les valeurs correspondantes, pas `NULL`. Modifié la fonction `JSONExtract`, maintenant, il obtient le type de retour de son dernier paramètre et n'injecte pas nullables. Implémenté repli vers RapidJSON dans le cas où les instructions AVX2 ne sont pas disponibles. Bibliothèque Simdjson mise à jour vers une nouvelle version. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) -- Maintenant `if` et `multiIf` les fonctions ne dépendent pas de la condition `Nullable`, mais comptez sur les branches pour la compatibilité sql. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu](https://github.com/janplus)) -- `In` prédicat génère maintenant `Null` résultat de `Null` d'entrée comme l' `Equal` fonction. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu](https://github.com/janplus)) -- Vérifiez la limite de temps chaque (flush\_interval / poll\_timeout) nombre de lignes de Kafka. Cela permet de casser la lecture de Kafka consumer plus fréquemment et de vérifier les délais pour les flux de niveau supérieur [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([Ivan](https://github.com/abyss7)) -- Lien rdkafka avec SASL fourni. Il devrait permettre d'utiliser l'authentification SASL SCRAM [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([Ivan](https://github.com/abyss7)) -- Version par lots de RowRefList pour toutes les jointures. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) -- clickhouse-server: messages d'erreur d'écoute plus informatifs. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) -- Soutien dictionnaires dans clickhouse-copieur pour les fonctions dans `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) -- Ajouter un nouveau paramètre `kafka_commit_every_batch` pour réglementer Kafka engager la Politique. - Il permet de définir le mode de validation: après chaque lot de messages personnels, ou après le bloc entier est écrit dans le stockage. C'est un compromis entre perdre des messages ou les lire deux fois dans certaines situations extrêmes. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([Ivan](https://github.com/abyss7)) -- Faire `windowFunnel` supporte d'autres types entiers non signés. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) -- Autoriser à ombrer la colonne virtuelle `_table` dans le moteur de Fusion. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([Ivan](https://github.com/abyss7)) -- Faire `sequenceMatch` les fonctions d'agrégation prennent en charge d'autres types entiers non signés [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) -- Meilleurs messages d'erreur si l'inadéquation de la somme de contrôle est probablement causée par des défaillances matérielles. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Vérifiez que les tables sous-jacentes prennent en charge l'échantillonnage pour `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([Ivan](https://github.com/abyss7)) -- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Améliorations du protocole de fil MySQL. Changement du nom du format en MySQLWire. Utiliser RAII pour appeler RSA\_free. Désactivation de SSL si le contexte ne peut pas être créé. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) -- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) -- Respectez les paramètres de requête dans les insertions asynchrones dans les tables distribuées. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) -- Renommé fonctions `leastSqr` de `simpleLinearRegression`, `LinearRegression` de `linearRegression`, `LogisticRegression` de `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Amélioration Des Performances {#performance-improvements} - -- Paralléliser le traitement des parties des tables MergeTree non répliquées dans la requête ALTER MODIFY. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) -- Optimisations dans l'extraction d'expressions régulières. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) -- N'ajoutez pas de colonne de clé de jointure droite pour joindre le résultat si elle est utilisée uniquement dans la section join on. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) -- Geler le tampon Kafka après la première réponse vide. Il évite les invocations multiples de `ReadBuffer::next()` pour un résultat vide dans certains flux d'analyse de ligne. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([Ivan](https://github.com/abyss7)) -- `concat` optimisation de la fonction pour plusieurs arguments. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) -- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) -- Mettez à niveau notre implémentation LZ4 avec reference one pour avoir une décompression plus rapide. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) -- Implémenté MSD radix sort (basé sur kxsort), et le tri partiel. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) - -#### Corrections De Bugs {#bug-fixes} - -- Correction des colonnes push require avec jointure [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Correction d'un bug, lorsque ClickHouse est exécuté par systemd, la commande `sudo service clickhouse-server forcerestart` ne fonctionne pas comme prévu. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) -- Correction des codes d'erreur http dans DataPartsExchange (le serveur HTTP interserver sur le port 9009 renvoie toujours le code 200, même en cas d'erreurs). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) -- Correction de SimpleAggregateFunction pour une chaîne plus longue que MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) -- Correction d'une erreur pour `Decimal` de `Nullable(Decimal)` conversion en en. Soutenir D'autres conversions décimales à décimales (y compris différentes échelles). [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction FPU clobbering dans la bibliothèque simdjson qui conduisent à un mauvais calcul de `uniqHLL` et `uniqCombined` fonction agrégée et fonctions mathématiques telles que `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la gestion des cas const/nonconst mixtes dans les fonctions JSON. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fixer `retention` fonction. Maintenant, toutes les conditions qui satisfont dans une rangée de données sont ajoutées à l'état des données. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) -- Correction du type de résultat pour `quantileExact` avec des Décimales. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Documentation {#documentation} - -- Traduire la documentation pour `CollapsingMergeTree` pour les chinois. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) -- Traduire une documentation sur les moteurs de table en chinois. - [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) - [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) - ([jamais lee](https://github.com/neverlee)) - -#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements} - -- Correction de certains rapports de désinfectant qui montrent une utilisation probable après-livraison.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([Ivan](https://github.com/abyss7)) -- Déplacez les tests de performance hors de répertoires séparés pour plus de commodité. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de tests de performance incorrects. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alésapine](https://github.com/alesapin)) -- Ajout d'un outil pour calculer les sommes de contrôle causées par les retournements de bits pour déboguer les problèmes matériels. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Rendre le script runner plus utilisable. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) -- Ajouter petite instruction comment écrire des tests de performance. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alésapine](https://github.com/alesapin)) -- Ajout de la possibilité de faire des substitutions dans Créer, remplir et supprimer la requête dans les tests de performance [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) - -## Clickhouse version 19.7 {#clickhouse-release-19-7} - -### Clickhouse version 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} - -#### Bug Fix {#bug-fix-25} - -- Correction de la régression des performances dans certaines requêtes avec jointure. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([L'Hiver Zhang](https://github.com/zhang2014)) - -### Clickhouse version 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} - -#### Nouveauté {#new-features-1} - -- Ajout de fonctions liées au bitmap `bitmapHasAny` et `bitmapHasAll` analogue à `hasAny` et `hasAll` fonctions pour les tableaux. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) - -#### Corrections De Bugs {#bug-fixes-1} - -- Fixer erreur de segmentation sur `minmax` INDEX avec valeur nulle. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) -- Marquez toutes les colonnes d'entrée dans LIMIT BY comme sortie requise. Il fixe ‘Not found column’ erreur dans certaines requêtes distribuées. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) -- Fixer “Column ‘0’ already exists” erreur dans `SELECT .. PREWHERE` sur la colonne avec défaut [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) -- Fixer `ALTER MODIFY TTL` requête sur `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) -- Ne plantez pas le serveur lorsque les consommateurs Kafka n'ont pas réussi à démarrer. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([Ivan](https://github.com/abyss7)) -- Les fonctions Bitmap fixes produisent un mauvais résultat. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Andy Yang](https://github.com/andyyzh)) -- Correction d'element\_count pour le dictionnaire haché (ne pas inclure les doublons) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) -- Utilisez le contenu de la variable d'environnement TZ comme nom pour le fuseau horaire. Il aide à détecter correctement le fuseau horaire par défaut dans certains cas.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([Ivan](https://github.com/abyss7)) -- N'essayez pas de convertir les entiers dans `dictGetT` fonctions, car il ne fonctionne pas correctement. Jetez une exception à la place. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction des paramètres dans la requête HTTP ExternalData. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila - Kutenin](https://github.com/danlark1)) -- Correction d'un bug lorsque des pièces ont été supprimées uniquement de FS sans les laisser tomber de Zookeeper. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alésapine](https://github.com/alesapin)) -- Correction d'un défaut de segmentation dans `bitmapHasAny` fonction. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Correction d'une erreur lorsque le pool de connexions de réplication ne tente pas de résoudre l'hôte, même lorsque le cache DNS a été supprimé. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alésapine](https://github.com/alesapin)) -- Fixe `DROP INDEX IF EXISTS` requête. Maintenant `ALTER TABLE ... DROP INDEX IF EXISTS ...` la requête ne déclenche pas d'exception si l'index fourni n'existe pas. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Correction de la colonne union all supertype. Il y avait des cas avec des données incohérentes et des types de colonnes de colonnes résultantes. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- Ignorer ZNONODE pendant le traitement de la requête DDL. Avant si un autre nœud supprime le znode dans la file d'attente des tâches, celui qui - ne pas le traiter, mais déjà obtenir la liste des enfants, mettra fin au thread DDLWorker. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Correction de L'insertion dans la table Distributed() avec une colonne matérialisée. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) - -### Clickhouse version 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} - -#### Nouveauté {#new-features-2} - -- Permet de limiter la plage d'un paramètre qui peut être spécifiée par l'utilisateur. - Ces contraintes peuvent être configurées dans le profil des paramètres utilisateur. - [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly - Baranov](https://github.com/vitlibar)) -- Ajouter une deuxième version de la fonction `groupUniqArray` avec une option de - `max_size` paramètre qui limite la taille du tableau résultant. Ce - le comportement est similaire à `groupArray(max_size)(x)` fonction. - [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- Pour les formats de fichier D'entrée TSVWithNames/CSVWithNames, l'ordre des colonnes peut maintenant être - déterminé à partir de l'en-tête du fichier. Ceci est contrôlé par - `input_format_with_names_use_header` paramètre. - [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) - ([Alexander](https://github.com/Akazz)) - -#### Corrections De Bugs {#bug-fixes-2} - -- Crash avec uncompressed\_cache + JOIN lors de la fusion (\#5197) - [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila - Kutenin](https://github.com/danlark1)) -- Erreur de Segmentation sur une requête clickhouse-client aux tables système. \#5066 - [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) - ([Ivan](https://github.com/abyss7)) -- Perte de données sur une charge lourde via KafkaEngine (\#4736) - [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) - ([Ivan](https://github.com/abyss7)) -- Correction d'une condition de concurrence de données très rare qui pourrait se produire lors de l'exécution d'une requête avec UNION impliquant au moins deux sélections du système.colonnes, système.tables système.les pièces, système d'.parts\_tables ou tables de la famille de fusion et effectuer des modifications simultanées des colonnes des tables associées. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Amélioration Des Performances {#performance-improvements-1} - -- Utilisez le tri radix pour trier par colonne numérique unique dans `ORDER BY` sans - `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), - [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) - ([Evgenii Pravda](https://github.com/kvinty), - [alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Documentation {#documentation-1} - -- Traduire la documentation de certains moteurs de table en chinois. - [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), - [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), - [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) - ([张风啸](https://github.com/AlexZFX)), - [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([jamais - Lee](https://github.com/neverlee)) - -#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-1} - -- Imprimer les caractères UTF-8 correctement dans `clickhouse-test`. - [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) - ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un paramètre de ligne de commande pour clickhouse-client pour toujours charger la suggestion - données. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) - ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Résolvez certains des avertissements PVS-Studio. - [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) - ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mise à jour LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila - Kutenin](https://github.com/danlark1)) -- Ajouter gperf pour construire des exigences pour la prochaine demande de tirage \# 5030. - [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) - ([proller](https://github.com/proller)) - -## Clickhouse version 19.6 {#clickhouse-release-19-6} - -### Clickhouse version 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} - -#### Corrections De Bugs {#bug-fixes-3} - -- Correction de l'état pushdown pour les requêtes des fonctions de table `mysql` et `odbc` et les moteurs de table correspondants. Cela corrige \#3540 et \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de l'impasse dans Zookeeper. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) -- Autoriser les décimales entre guillemets en CSV. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) -- Interdire la conversion de float Inf / NaN en décimales (exception de lancer). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction de la course de données dans la requête renommer. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Désactiver temporairement LFAlloc. L'utilisation de LFAlloc peut conduire à beaucoup de MAP\_FAILED dans l'allocation de UncompressedCache et, par conséquent, à des plantages de requêtes sur des serveurs chargés en haut. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) - -### Clickhouse version 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} - -#### Nouveauté {#new-features-3} - -- Expressions TTL pour les colonnes et les tables. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) -- Ajout du support pour `brotli` compression pour les réponses HTTP (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mikhail](https://github.com/fandyushin)) -- Ajout d'une fonction nouvelle `isValidUTF8` pour vérifier si un ensemble d'octets est correctement codé en utf-8. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) -- Ajouter la nouvelle stratégie d'équilibrage de charge `first_or_random` qui envoie des requêtes au premier hôte spécifié et s'il est inaccessible, envoie des requêtes à des hôtes aléatoires de shard. Utile pour les configurations de topologie de réplication croisée. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) - -#### Caractéristiques Expérimentales {#experimental-features-1} - -- Ajouter un paramètre `index_granularity_bytes` (granularité d'index adaptatif) pour la famille de tables MergeTree\*. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alésapine](https://github.com/alesapin)) - -#### Amélioration {#improvements-1} - -- Ajout du support pour les arguments de taille et de longueur non constants et négatifs pour la fonction `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Désactivez push-down to right table dans LEFT join, left table dans RIGHT join et les deux tables dans full join. Cela corrige les mauvais résultats de jointure dans certains cas. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([Ivan](https://github.com/abyss7)) -- `clickhouse-copier`: configuration automatique de tâche de téléchargement de `--task-file` option [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) -- Ajout d'un gestionnaire de fautes de frappe pour l'usine de stockage et les fonctions de table factory. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) -- Support des astérisques et des astérisques qualifiés pour plusieurs jointures sans sous-requêtes [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) -- Rendre le message d'erreur de colonne manquant plus convivial. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Amélioration Des Performances {#performance-improvements-2} - -- Accélération significative de la jointure ASOF [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) - -#### Modifications Incompatibles En Arrière {#backward-incompatible-changes} - -- L'en-tête HTTP `Query-Id` a été renommé `X-ClickHouse-Query-Id` pour des raisons de cohérence. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mikhail](https://github.com/fandyushin)) - -#### Corrections De Bugs {#bug-fixes-4} - -- Déréférence du pointeur nul potentiel fixe dans `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) -- Correction d'une erreur sur la requête avec JOIN + ARRAY JOIN [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixe suspendu au début du serveur lorsqu'un dictionnaire dépend d'un autre dictionnaire via une base de données avec moteur=Dictionnaire. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) -- Partially fix distributed\_product\_mode = local. It's possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There's not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un résultat potentiellement erroné pour `SELECT DISTINCT` avec `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'une condition de concurrence de données très rare qui pourrait se produire lors de l'exécution d'une requête avec UNION impliquant au moins deux sélections du système.colonnes, système.tables système.les pièces, système d'.parts\_tables ou tables de la famille de fusion et effectuer des modifications simultanées des colonnes des tables associées. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-2} - -- Correction des échecs de test lors de l'exécution de clickhouse-server sur un hôte différent [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) -- clickhouse-test: désactiver les séquences de contrôle de couleur dans un environnement non tty. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alésapine](https://github.com/alesapin)) -- clickhouse-test: Autoriser l'utilisation de toute base de données de test (supprimer `test.` qualification lorsque cela est possible) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) -- Correction des erreurs ubsan [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Yandex LFAlloc a été ajouté à ClickHouse pour allouer des données MarkCache et UncompressedCache de différentes manières pour attraper des segfaults plus fiables [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) -- Python util pour aider avec les rétroportages et les changelogs. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([Ivan](https://github.com/abyss7)) - -## Clickhouse version 19.5 {#clickhouse-release-19-5} - -### Clickhouse version 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} - -#### Corrections de bugs {#bug-fixes-5} - -- Correction d'un crash possible dans les fonctions bitmap\* [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Andy Yang](https://github.com/andyyzh)) -- Correction d'une condition de concurrence de données très rare qui pourrait se produire lors de l'exécution d'une requête avec UNION impliquant au moins deux sélections du système.colonnes, système.tables système.les pièces, système d'.parts\_tables ou tables de la famille de fusion et effectuer des modifications simultanées des colonnes des tables associées. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. Cette erreur s'est produite si la colonne LowCardinality était la partie de la clé primaire. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Modification de la fonction de rétention: si une ligne satisfait à la fois la première et la nième condition, seule la première condition satisfaite est ajoutée à l'état des données. Maintenant, toutes les conditions qui satisfont dans une rangée de données sont ajoutées à l'état des données. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) - -### Clickhouse version 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} - -#### Corrections de bugs {#bug-fixes-6} - -- Type de réglage fixe `max_partitions_per_insert_block` de booléen à UInt64. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Mohammad Hossein Sekhavat](https://github.com/mhsekhavat)) - -### Clickhouse version 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} - -#### Nouveauté {#new-features-4} - -- [Hyperscan](https://github.com/intel/hyperscan) plusieurs expressions rationnelles a été ajouté (fonctions `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) -- `multiSearchFirstPosition` la fonction a été ajoutée. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) -- Implémentez le filtre d'expression prédéfini par ligne pour les tables. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([Ivan](https://github.com/abyss7)) -- Un nouveau type d'indices de saut de données basés sur des filtres bloom (peut être utilisé pour `equal`, `in` et `like` fonction). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) -- Ajouter `ASOF JOIN` ce qui permet d'exécuter des requêtes, qui se joignent à la valeur la plus récente connue. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) -- Réécrire plusieurs `COMMA JOIN` de `CROSS JOIN`. Puis réécrire `INNER JOIN` si cela est possible. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Amélioration {#improvement-9} - -- `topK` et `topKWeighted` prend désormais en charge personnalisée `loadFactor` (corrige le problème [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) -- Permettre d'utiliser `parallel_replicas_count > 1` même pour les tables sans échantillonnage (le paramètre est simplement ignoré pour elles). Dans les versions précédentes, il a été conduit à l'exception. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) -- Soutien pour `CREATE OR REPLACE VIEW`. Permettent de créer un afficher ou définir une nouvelle définition dans un seul énoncé. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) -- `Buffer` tableau moteur prend désormais en charge `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Yangkuan Liu](https://github.com/LiuYangkuan)) -- Ajouter la possibilité de démarrer la table répliquée sans métadonnées dans zookeeper dans `readonly` mode. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alésapine](https://github.com/alesapin)) -- Correction du scintillement de la barre de progression dans clickhouse-client. Le problème était le plus perceptible lors de l'utilisation `FORMAT Null` avec des flux de requêtes. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Permettent de désactiver les fonctions avec `hyperscan` bibliothèque par utilisateur pour limiter l'utilisation potentiellement excessive et incontrôlée des ressources. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter le numéro de version se connectant à toutes les erreurs. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) -- Ajout d'une restriction à la `multiMatch` fonctions qui nécessite une taille de chaîne pour s'adapter à `unsigned int`. A également ajouté le nombre d'arguments limite à la `multiSearch` fonction. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) -- Amélioration de l'utilisation de l'espace scratch et de la gestion des erreurs dans Hyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) -- Remplir `system.graphite_detentions` à partir d'une table de config `*GraphiteMergeTree` le moteur de tables. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Renommer `trigramDistance` la fonction de `ngramDistance` et d'ajouter plus de fonctions avec `CaseInsensitive` et `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) -- Amélioration du calcul des indices de saut de données. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) -- Garder ordinaire, `DEFAULT`, `MATERIALIZED` et `ALIAS` colonnes dans une seule liste (corrige le problème [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -#### Bug Fix {#bug-fix-26} - -- Éviter `std::terminate` en cas d'échec d'allocation de mémoire. Maintenant `std::bad_alloc` exception est levée comme prévu. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corrige la lecture de capnproto à partir du tampon. Parfois, les fichiers N'ont pas été chargés avec succès par HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Correction d'erreur `Unknown log entry type: 0` après `OPTIMIZE TABLE FINAL` requête. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Oiseau](https://github.com/amosbird)) -- Mauvais arguments `hasAny` ou `hasAll` fonctions peut conduire à l'erreur de segmentation. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Blocage peut se produire lors de l'exécution `DROP DATABASE dictionary` requête. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corriger un comportement indéfini dans `median` et `quantile` fonction. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- Correction de la détection du niveau de compression lorsque `network_compression_method` en minuscules. Cassé dans v19. 1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- Correction de l'ignorance de `UTC` paramètre (corrige le problème [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- Fixer `histogram` comportement de la fonction avec `Distributed` table. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- Rapport Tsan fixe `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Rapport Tsan fixe sur l'arrêt en raison de la condition de concurrence dans l'utilisation des journaux système. Correction de l'utilisation potentielle-après-libre à l'arrêt lorsque part\_log est activé. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer revérifier les pièces dans `ReplicatedMergeTreeAlterThread` en cas d'erreur. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Les opérations arithmétiques sur les états de fonction d'agrégat intermédiaire ne fonctionnaient pas pour les arguments constants (tels que les résultats de sous-requête). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Toujours renvoyer les noms de colonne dans les métadonnées. Sinon il est impossible de créer une table avec une colonne nommée `index` (le serveur ne redémarre pas en raison de malformé `ATTACH` requête dans les métadonnées). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un crash dans l' `ALTER ... MODIFY ORDER BY` sur `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- Fixer erreur de segmentation dans `JOIN ON` avec l'option `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Correction d'un bug avec l'ajout d'une ligne étrangère après avoir consommé un message protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction d'un arrêt brutal de `JOIN` sur la colonne non nullable vs nullable. Fixer `NULLs` dans la droite dans `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Condition de course fixe dans `SELECT` de `system.tables` si la table est renommée ou modifiée simultanément. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la course de données lors de la récupération d'une partie de données déjà obsolète. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la course de données rares qui peut se produire pendant `RENAME` table de la famille MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un défaut de segmentation en fonction `arrayIntersect`. Une erreur de Segmentation pourrait se produire si la fonction était appelée avec des arguments constants et ordinaires mixtes. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un crash dans l' `FULL/RIGHT JOIN` lorsque nous rejoignons sur nullable vs non nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixer `No message received` exception lors de la récupération de pièces entre les répliques. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alésapine](https://github.com/alesapin)) -- Fixe `arrayIntersect` fonction mauvais résultat en cas de plusieurs valeurs répétées dans un seul tableau. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'une condition de course pendant `ALTER COLUMN` requêtes qui pourraient conduire à un plantage du serveur (corrige le problème [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- Correction d'un résultat incorrect dans `FULL/RIGHT JOIN` avec colonne const. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction des doublons dans `GLOBAL JOIN` avec asterisk. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) -- Paramètre correction de la déduction `ALTER MODIFY` de la colonne `CODEC` lorsque le type de colonne n'est pas spécifié. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alésapine](https://github.com/alesapin)) -- Fonction `cutQueryStringAndFragment()` et `queryStringAndFragment()` fonctionne maintenant correctement quand `URL` contient un fragment et aucune requête. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction d'un bug rare lors du réglage `min_bytes_to_use_direct_io` est supérieur à zéro, ce qui se produit lorsque le thread doit chercher en arrière dans le fichier de colonne. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alésapine](https://github.com/alesapin)) -- Correction de mauvais types d'arguments pour les fonctions d'agrégation avec `LowCardinality` arguments (corrige le problème [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'une qualification de nom incorrecte Dans `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) -- Fonction Fix `toISOWeek` résultat pour l'année 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer `DROP`, `TRUNCATE` et `OPTIMIZE` requêtes duplication, lorsqu'elles sont exécutées sur `ON CLUSTER` pour `ReplicatedMergeTree*` les tables de la famille. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alésapine](https://github.com/alesapin)) - -#### Modification Incompatible En Arrière {#backward-incompatible-change-8} - -- Renommer le paramètre `insert_sample_with_metadata` définir `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajout d'un réglage `max_partitions_per_insert_block` (avec la valeur 100 par défaut). Si le bloc inséré contient un plus grand nombre de partitions, une exception est levée. Mettre à 0 si vous souhaitez supprimer la limite (pas recommandé). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Les fonctions multi-recherche ont été renommées (`multiPosition` de `multiSearchAllPositions`, `multiSearch` de `multiSearchAny`, `firstMatch` de `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) - -#### Amélioration Des Performances {#performance-improvement-6} - -- Optimisez volnitsky searcher en inlining, donnant environ 5-10% d'amélioration de la recherche pour les requêtes avec de nombreuses aiguilles ou de nombreux bigrams similaires. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) -- Correction d'un problème de performance lors du réglage `use_uncompressed_cache` est supérieur à zéro, qui est apparu lorsque toutes les données lues contenues dans le cache. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alésapine](https://github.com/alesapin)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-10} - -- Durcissement debug build: mappages de mémoire plus granulaires et ASLR; ajouter une protection de mémoire pour le cache de marque et l'index. Cela permet de trouver plus de bugs de piétinement de mémoire dans le cas où ASan et MSan ne peuvent pas le faire. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout du support pour les variables cmake `ENABLE_PROTOBUF`, `ENABLE_PARQUET` et `ENABLE_BROTLI` ce qui permet d'activer / désactiver les fonctionnalités ci-dessus (comme nous pouvons le faire pour librdkafka, mysql, etc). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) -- Ajouter la possibilité d'Imprimer la liste des processus et stacktraces de tous les threads si certaines requêtes sont suspendues après l'exécution du test. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alésapine](https://github.com/alesapin)) -- Ajouter des tentatives sur `Connection loss` erreur dans `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alésapine](https://github.com/alesapin)) -- Ajouter freebsd build avec vagrant et construire avec thread sanitizer au script packager. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alésapine](https://github.com/alesapin)) -- Maintenant l'Utilisateur a demandé un mot de passe pour l'utilisateur `'default'` lors de l'installation. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) -- Supprimer l'avertissement dans `rdkafka` bibliothèque. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Permettre la capacité de construire sans ssl. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) -- Ajouter un moyen de lancer l'image clickhouse-server à partir d'un utilisateur personnalisé. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Mise à niveau contrib boost à 1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) -- Désactiver l'utilisation de `mremap` lorsqu'il est compilé avec thread Sanitizer. Étonnamment, TSan n'intercepte pas `mremap` (bien qu'il ne intercepter `mmap`, `munmap`) qui conduit à des faux positifs. Rapport Tsan fixe dans les tests avec État. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter la vérification de test en utilisant le schéma de format via L'interface HTTP. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) - -## Clickhouse version 19.4 {#clickhouse-release-19-4} - -### Clickhouse version 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} - -#### Corrections De Bugs {#bug-fixes-7} - -- Éviter `std::terminate` en cas d'échec d'allocation de mémoire. Maintenant `std::bad_alloc` exception est levée comme prévu. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corrige la lecture de capnproto à partir du tampon. Parfois, les fichiers N'ont pas été chargés avec succès par HTTP. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Correction d'erreur `Unknown log entry type: 0` après `OPTIMIZE TABLE FINAL` requête. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Oiseau](https://github.com/amosbird)) -- Mauvais arguments `hasAny` ou `hasAll` fonctions peut conduire à l'erreur de segmentation. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Blocage peut se produire lors de l'exécution `DROP DATABASE dictionary` requête. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corriger un comportement indéfini dans `median` et `quantile` fonction. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- Correction de la détection du niveau de compression lorsque `network_compression_method` en minuscules. Cassé dans v19. 1. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- Correction de l'ignorance de `UTC` paramètre (corrige le problème [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- Fixer `histogram` comportement de la fonction avec `Distributed` table. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- Rapport Tsan fixe `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Rapport Tsan fixe sur l'arrêt en raison de la condition de concurrence dans l'utilisation des journaux système. Correction de l'utilisation potentielle-après-libre à l'arrêt lorsque part\_log est activé. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer revérifier les pièces dans `ReplicatedMergeTreeAlterThread` en cas d'erreur. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Les opérations arithmétiques sur les états de fonction d'agrégat intermédiaire ne fonctionnaient pas pour les arguments constants (tels que les résultats de sous-requête). [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Toujours renvoyer les noms de colonne dans les métadonnées. Sinon il est impossible de créer une table avec une colonne nommée `index` (le serveur ne redémarre pas en raison de malformé `ATTACH` requête dans les métadonnées). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un crash dans l' `ALTER ... MODIFY ORDER BY` sur `Distributed` table. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- Fixer erreur de segmentation dans `JOIN ON` avec l'option `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Correction d'un bug avec l'ajout d'une ligne étrangère après avoir consommé un message protobuf de Kafka. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction d'un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Condition de course fixe dans `SELECT` de `system.tables` si la table est renommée ou modifiée simultanément. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la course de données lors de la récupération d'une partie de données déjà obsolète. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la course de données rares qui peut se produire pendant `RENAME` table de la famille MergeTree. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un défaut de segmentation en fonction `arrayIntersect`. Une erreur de Segmentation pourrait se produire si la fonction était appelée avec des arguments constants et ordinaires mixtes. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixer `No message received` exception lors de la récupération de pièces entre les répliques. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alésapine](https://github.com/alesapin)) -- Fixe `arrayIntersect` fonction mauvais résultat en cas de plusieurs valeurs répétées dans un seul tableau. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'une condition de course pendant `ALTER COLUMN` requêtes qui pourraient conduire à un plantage du serveur (corrige le problème [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- Paramètre correction de la déduction `ALTER MODIFY` de la colonne `CODEC` lorsque le type de colonne n'est pas spécifié. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alésapine](https://github.com/alesapin)) -- Fonction `cutQueryStringAndFragment()` et `queryStringAndFragment()` fonctionne maintenant correctement quand `URL` contient un fragment et aucune requête. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction d'un bug rare lors du réglage `min_bytes_to_use_direct_io` est supérieur à zéro, ce qui se produit lorsque le thread doit chercher en arrière dans le fichier de colonne. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alésapine](https://github.com/alesapin)) -- Correction de mauvais types d'arguments pour les fonctions d'agrégation avec `LowCardinality` arguments (corrige le problème [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fonction Fix `toISOWeek` résultat pour l'année 1970. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer `DROP`, `TRUNCATE` et `OPTIMIZE` requêtes duplication, lorsqu'elles sont exécutées sur `ON CLUSTER` pour `ReplicatedMergeTree*` les tables de la famille. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alésapine](https://github.com/alesapin)) - -#### Amélioration {#improvements-2} - -- Garder ordinaire, `DEFAULT`, `MATERIALIZED` et `ALIAS` colonnes dans une seule liste (corrige le problème [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -### Clickhouse version 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} - -#### Corrections De Bugs {#bug-fixes-8} - -- Correction d'un crash dans l' `FULL/RIGHT JOIN` lorsque nous rejoignons sur nullable vs non nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-11} - -- Ajouter un moyen de lancer l'image clickhouse-server à partir d'un utilisateur personnalisé. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### Clickhouse version 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} - -#### Corrections De Bugs {#bug-fixes-9} - -- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### Clickhouse version 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} - -#### Corrections De Bugs {#bug-fixes-10} - -- Correction des requêtes distantes qui contiennent les deux `LIMIT BY` et `LIMIT`. Auparavant, si `LIMIT BY` et `LIMIT` ont été utilisés pour la requête distante, `LIMIT` ça pourrait arriver avant `LIMIT BY`, ce qui a conduit à un résultat trop filtré. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) - -### Clickhouse version 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} - -#### Nouveauté {#new-features-5} - -- Ajout d'un support complet pour `Protobuf` format (entrée et sortie, structures de données imbriquées). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ajout de fonctions bitmap avec des bitmaps rugissants. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Andy Yang](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) -- Support du format Parquet. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) -- La distance de n-gramme a été ajoutée pour la comparaison de chaîne floue. Il est similaire aux métriques Q-gram en langage R. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) -- Combinez des règles pour le cumul de graphite à partir de modèles d'agrégation et de rétention dédiés. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Ajouter `max_execution_speed` et `max_execution_speed_bytes` pour limiter l'utilisation des ressources. Ajouter `min_execution_speed_bytes` réglage pour compléter le `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Mise en œuvre de la fonction `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexeï-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) -- L'ajout de fonctions `arrayEnumerateDenseRanked` et `arrayEnumerateUniqRanked` (c'est comme `arrayEnumerateUniq` mais permet d'affiner la profondeur du tableau pour regarder à l'intérieur des tableaux multidimensionnels). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Corrections De Bugs {#bug-fixes-11} - -- Cette version contient également toutes les corrections de bugs de 19.3 et 19.1. -- Correction d'un bug dans les indices de saut de données: l'ordre des granules après L'insertion était incorrect. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) -- Fixe `set` indice pour `Nullable` et `LowCardinality` colonne. Avant d', `set` index avec `Nullable` ou `LowCardinality` colonne a conduit à l'erreur `Data type must be deserialized with multiple streams` lors de la sélection. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Définir correctement update\_time sur full `executable` dictionnaire de mise à jour. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) -- Correction de la barre de progression cassée dans 19.3. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) -- Correction de valeurs incohérentes de MemoryTracker lorsque la région de mémoire a été réduite, dans certains cas. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un comportement indéfini dans ThreadPool. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un crash très rare avec le message `mutex lock failed: Invalid argument` cela peut se produire lorsqu'une table MergeTree a été supprimée simultanément avec un SELECT. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) -- Compatibilité du pilote ODBC avec `LowCardinality` type de données. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) -- FreeBSD: correction pour `AIOcontextPool: Found io_event with unknown id 0` erreur. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `system.part_log` table a été créée, indépendamment de la configuration. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du comportement indéfini dans `dictIsIn` fonction pour les dictionnaires de cache. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alésapine](https://github.com/alesapin)) -- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) -- Désactiver compile\_expressions par défaut jusqu'à ce que nous obtenions propre `llvm` contrib et peut le tester avec `clang` et `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alésapine](https://github.com/alesapin)) -- Empêcher `std::terminate` lorsque `invalidate_query` pour `clickhouse` externe dictionnaire source a retourné mauvais jeu de résultats (vide ou plusieurs lignes ou plusieurs colonnes). Correction d'un problème lors de l' `invalidate_query` a été effectuée toutes les cinq secondes quel que soit le `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Éviter l'impasse lorsque le `invalidate_query` pour un dictionnaire avec `clickhouse` source était impliquant `system.dictionaries` table ou `Dictionaries` base de données (cas rare). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corrections pour CROSS JOIN avec vide où. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixe erreur de segmentation en fonction “replicate” lorsque l'argument constant est passé. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la fonction lambda avec l'optimiseur de prédicats. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Plusieurs jointures plusieurs correctifs. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Amélioration {#improvements-3} - -- Prend en charge les alias dans la section JOIN ON pour les colonnes de la table droite. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) -- Le résultat de plusieurs jointures nécessite des noms de résultats corrects à utiliser dans les sous-sélections. Remplacez les alias plats par des noms de source dans le résultat. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) -- Améliorer la logique push-down pour les instructions jointes. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([Ivan](https://github.com/abyss7)) - -#### Amélioration Des Performances {#performance-improvements-3} - -- Heuristiques améliorées de “move to PREWHERE” optimisation. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Utilisez des tables de recherche appropriées qui utilisent L'API de HashTable pour les clés 8 bits et 16 bits. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos Oiseau](https://github.com/amosbird)) -- Amélioration des performances de la comparaison de chaînes. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Nettoyage de la file D'attente DDL distribuée dans un thread séparé afin de ne pas ralentir la boucle principale qui traite les tâches DDL distribuées. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) -- Lorsque `min_bytes_to_use_direct_io` est défini sur 1, Tous les fichiers n'ont pas été ouverts avec le mode O\_DIRECT car la taille des données à lire était parfois sous-estimée par la taille d'un bloc compressé. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-12} - -- Ajout du support pour clang-9 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corrigé de mal `__asm__` instructions (encore une fois) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) -- Ajouter la possibilité de spécifier les paramètres pour `clickhouse-performance-test` à partir de la ligne de commande. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alésapine](https://github.com/alesapin)) -- Ajouter des tests de dictionnaires aux tests d'intégration. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alésapine](https://github.com/alesapin)) -- Ajout de requêtes du benchmark sur le site web à des tests de performance automatisés. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `xxhash.h` n'existe pas dans LZ4 externe car il s'agit d'un détail d'implémentation et ses symboles sont `XXH_NAMESPACE` macro. Lorsque lz4 est externe, xxHash doit aussi être externe, et les personnes à charge doivent y accéder. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) -- Correction d'un cas lorsque `quantileTiming` la fonction d'agrégation peut être appelée avec un argument négatif ou à virgule flottante (cela corrige le test fuzz avec un désinfectant de comportement indéfini). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'erreur d'orthographe. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) -- Correction de la compilation sur Mac. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) -- Corrections de construction Pour FreeBSD et diverses configurations de construction inhabituelles. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) - -## Clickhouse version 19.3 {#clickhouse-release-19-3} - -### Clickhouse version 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} - -#### Corrections De Bugs {#bug-fixes-12} - -- Correction d'un crash dans l' `FULL/RIGHT JOIN` lorsque nous rejoignons sur nullable vs non nullable. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un défaut de segmentation dans `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Correction de la lecture de `Array(LowCardinality)` colonne dans de rares cas où la colonne contenait une longue séquence de tableaux vides. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-13} - -- Ajouter un moyen de lancer l'image clickhouse-server à partir d'un utilisateur personnalisé [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### Clickhouse version 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} - -#### Corrections de bugs {#bug-fixes-13} - -- Correction d'une erreur dans \#3920. Cette erreur se manifeste par une corruption aléatoire du cache (messages `Unknown codec family code`, `Cannot seek through file`) et de segmentation. Cette anomalie est apparue dans la version 19.1 et est présente dans les versions jusqu'à 19.1.10 et 19.3.6. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} - -#### Corrections de bugs {#bug-fixes-14} - -- Quand il y a plus de 1000 threads dans un pool de threads, `std::terminate` peut se produire à la sortie thread. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant, il est possible de créer `ReplicatedMergeTree*` tables avec commentaires sur les colonnes sans valeurs par défaut et tables avec colonnes codecs Sans commentaires et valeurs par défaut. Corrigez également la comparaison des codecs. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alésapine](https://github.com/alesapin)) -- Correction d'un crash sur la jointure avec un tableau ou un tuple. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un crash dans clickhouse-copieur avec le message `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction du blocage à l'arrêt du serveur si des DDL distribués étaient utilisés. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) -- Des numéros de colonne incorrects ont été imprimés dans un message d'erreur concernant l'analyse de format de texte pour les colonnes dont le nombre est supérieur à 10. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-3} - -- Correction de la construction avec AVX activé. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Activer la comptabilité étendue et la comptabilité D'E / S basée sur une version bien connue au lieu du noyau sous lequel elle est compilée. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) -- Permet d'ignorer le paramètre core\_dump.size\_limit, avertissement au lieu de lancer si la limite définie échoue. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) -- Enlevé le `inline` les balises de `void readBinary(...)` dans `Field.cpp`. Également fusionné redondant `namespace DB` bloc. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) - -### Clickhouse version 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} - -#### Corrections de bugs {#bug-fixes-15} - -- Correction d'un bug avec de grandes requêtes d'insertion http traitement. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alésapine](https://github.com/alesapin)) -- Correction de l'incompatibilité avec les anciennes versions en raison d'une mauvaise implémentation de `send_logs_level` paramètre. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Incompatibilité arrière fixe de la fonction de table `remote` introduit avec des commentaires de colonne. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} - -#### Amélioration {#improvements-4} - -- La taille de l'index de la Table n'est pas prise en compte des limites de mémoire lors de `ATTACH TABLE` requête. Éviter la possibilité qu'un tableau ne peut pas être attachée après avoir été détaché. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Légèrement augmenté la limite sur la chaîne max et la taille du tableau reçu de ZooKeeper. Il permet de continuer à travailler avec une taille accrue de `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` sur la Gardienne. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Permettre de réparer la réplique abandonnée même si elle a déjà un grand nombre de nœuds dans sa file d'attente. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un argument requis à `SET` index (nombre maximum de lignes stockées). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Corrections De Bugs {#bug-fixes-16} - -- Fixe `WITH ROLLUP` résultat pour le groupe par un seul `LowCardinality` clé. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un bug dans l'index set (laissant tomber un granule s'il contient plus de `max_rows` rangée). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) -- Beaucoup de corrections de construction FreeBSD. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) -- Correction de la substitution des alias dans les requêtes avec une sous-requête contenant le même alias (problème [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-4} - -- Ajouter la possibilité d'exécuter `clickhouse-server` pour les tests sans état dans l'image docker. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) - -### Clickhouse version 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} - -#### Nouveauté {#new-features-6} - -- Ajouté le `KILL MUTATION` instruction qui permet de supprimer les mutations qui sont pour certaines raisons coincé. Ajouter `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` champs à la `system.mutations` tableau pour faciliter le dépannage. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) -- Fonction agrégée ajoutée `entropy` qui calcule l'entropie de Shannon. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) -- Ajout de la possibilité d'envoyer des requêtes `INSERT INTO tbl VALUES (....` au serveur sans fractionnement sur `query` et `data` partie. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alésapine](https://github.com/alesapin)) -- Mise en œuvre générique de `arrayWithConstant` la fonction a été ajoutée. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre `NOT BETWEEN` opérateur de comparaison. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) -- Mettre `sumMapFiltered` afin de pouvoir limiter le nombre de clés pour lesquelles les valeurs seront additionnées par `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Ajout du support de `Nullable` types de `mysql` table de fonction. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) -- Prise en charge des expressions constantes arbitraires dans `LIMIT` clause. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) -- Ajouter `topKWeighted` fonction d'agrégation qui prend un argument supplémentaire avec un poids (entier non signé). [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Andrew Golman](https://github.com/andrewgolman)) -- `StorageJoin` maintenant prend en charge `join_any_take_last_row` paramètre qui permet d'écraser les valeurs existantes de la même clé. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos Oiseau](https://github.com/amosbird) -- Ajout de la fonction `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ajouter `RowBinaryWithNamesAndTypes` format. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) -- Ajouter `IPv4` et `IPv6` types de données. Implémentations plus efficaces de `IPv*` fonction. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) -- Ajout de la fonction `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ajouter `Protobuf` le format de sortie. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ajout du support brotli pour L'interface HTTP pour l'importation de données (INSERTs). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mikhail](https://github.com/fandyushin)) -- Ajout d'astuces pendant que l'utilisateur fait une faute de frappe dans le nom de la fonction ou tapez dans le client de ligne de commande. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) -- Ajouter `Query-Id` de du Serveur HTTP en-tête de Réponse. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mikhail](https://github.com/fandyushin)) - -#### Caractéristiques expérimentales {#experimental-features-2} - -- Ajouter `minmax` et `set` index de saut de données pour la famille de moteurs de table MergeTree. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- Conversion ajoutée de `CROSS JOIN` de `INNER JOIN` si cela est possible. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Corrections De Bugs {#bug-fixes-17} - -- Fixe `Not found column` pour les colonnes en double dans `JOIN ON` section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Faire `START REPLICATED SENDS` commande démarrer les envois répliqués. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- Fixe l'exécution des fonctions d'agrégat avec `Array(LowCardinality)` argument. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fixe mauvais comportement lors `INSERT ... SELECT ... FROM file(...)` requête et fichier a `CSVWithNames` ou `TSVWIthNames` le format et la première ligne de données est manquant. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un crash sur dictionnaire recharger si le dictionnaire n'est pas disponible. Ce bug est apparu dans 19.1.6. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- Fixe `ALL JOIN` avec des doublons dans la table de droite. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un défaut de segmentation avec `use_uncompressed_cache=1` et exception avec une mauvaise taille non compressée. Ce bug est apparu dans 19.1.6. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alésapine](https://github.com/alesapin)) -- Fixe `compile_expressions` bug avec comparaison de grandes dates (plus de int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alésapine](https://github.com/alesapin)) -- Boucle infinie fixe lors de la sélection de la fonction de table `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Désactiver temporairement l'optimisation des prédicats pour `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Fixe `Illegal instruction` erreur lors de l'utilisation des fonctions base64 sur les anciens processeurs. Cette erreur n'a été reproduite que lorsque ClickHouse a été compilé avec gcc-8. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe `No message received` erreur lors de l'interaction avec le pilote ODBC PostgreSQL via une connexion TLS. Corrige également segfault lors de l'utilisation du pilote MySQL ODBC. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un résultat incorrect lorsque `Date` et `DateTime` les arguments sont utilisés dans les branches de l'opérateur conditionnel (fonction `if`). Ajouté cas générique pour la fonction `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Les dictionnaires ClickHouse se chargent maintenant dans `clickhouse` processus. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe blocage lorsqu' `SELECT` à partir d'une table avec `File` moteur a été rejugé après `No such file or directory` erreur. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Condition de course fixe lors de la sélection de `system.tables` peut donner `table doesn't exist` erreur. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-client` peut segfault à la sortie lors du chargement des données pour les suggestions de ligne de commande si elle a été exécutée en mode interactif. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug lors de l'exécution de mutations contenant `IN` les opérateurs produisaient des résultats incorrects. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- Correction d'une erreur: si une base de données avec `Dictionary` moteur, tous les dictionnaires forcés de charger au démarrage du serveur, et s'il y a un dictionnaire avec la source de ClickHouse de localhost, le dictionnaire ne peut pas charger. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur lorsque les journaux système sont tentés de créer à nouveau à l'arrêt du serveur. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Renvoyer correctement le bon type et gérer correctement les verrous `joinGet` fonction. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Oiseau](https://github.com/amosbird)) -- Ajouter `sumMapWithOverflow` fonction. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Fixe erreur de segmentation avec `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un bug avec incorrect `Date` et `DateTime` comparaison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- Correction d'un test de fuzz sous un désinfectant de comportement indéfini: ajout d'une vérification de type de paramètre pour `quantile*Weighted` la famille de fonctions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une condition de course rare lors de la suppression d'anciennes pièces de données peuvent échouer avec `File not found` erreur. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du paquet d'installation avec /etc/clickhouse-server/config manquant.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-5} - -- Paquet Debian: correct/etc/clickhouse-server / lien prétraité selon config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- Divers correctifs de construction Pour FreeBSD. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) -- Ajout de la possibilité de créer, remplir et déposer des tables dans perftest. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alésapine](https://github.com/alesapin)) -- Ajout d'un script pour vérifier les doublons comprend. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout de la possibilité d'exécuter des requêtes par index dans le test de performance. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alésapine](https://github.com/alesapin)) -- Paquet avec des symboles de débogage est suggéré d'être installé. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Refactoring de performance-test. Meilleure journalisation et gestion des signaux. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alésapine](https://github.com/alesapin)) -- Ajout de documents à Yandex anonymisé.Jeux de données Metrika. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alésapine](https://github.com/alesapin)) -- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) -- Ajout de documents sur deux ensembles de données dans s3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alésapine](https://github.com/alesapin)) -- Ajout d'un script qui crée le journal des modifications à partir de la description des requêtes d'extraction. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Ajout du module puppet pour Clickhouse. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- Ajout de documents pour un groupe de fonctions non documentées. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([L'Hiver Zhang](https://github.com/zhang2014)) -- ARM construire des correctifs. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) -- Tests de dictionnaire maintenant capables de s'exécuter à partir de `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) -- Maintenant `/etc/ssl` est utilisé comme répertoire par défaut avec les certificats SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout de la vérification SSE et AVX instruction au début. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) -- Le script d'initialisation attendra le serveur jusqu'au démarrage. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) - -#### Modifications Incompatibles En Arrière {#backward-incompatible-changes-1} - -- Retiré `allow_experimental_low_cardinality_type` paramètre. `LowCardinality` les types de données sont prêts pour la production. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Réduisez la taille du cache mark et la taille du cache non compressé en conséquence à la quantité de mémoire disponible. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) -- Ajouté le mot `INDEX` dans `CREATE TABLE` requête. Une colonne avec le nom `index` doivent être indiqués avec backticks ou des guillemets: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- `sumMap` désormais promouvoir le type de résultat au lieu de débordement. Vieux `sumMap` le comportement peut être obtenu en utilisant `sumMapWithOverflow` fonction. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) - -#### Amélioration Des Performances {#performance-improvements-4} - -- `std::sort` remplacé par `pdqsort` pour les requêtes sans `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) -- Maintenant, le serveur réutilise les threads du pool de threads global. Cela affecte les performances dans certains cas particuliers. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Amélioration {#improvements-5} - -- Implémentation du support AIO Pour FreeBSD. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `SELECT * FROM a JOIN b USING a, b` maintenant de retour `a` et `b` colonnes uniquement à partir de la table de gauche. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) -- Permettre `-C` option du client pour travailler comme `-c` option. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) -- Option `--password` utilisé sans valeur nécessite un mot de passe de stdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) -- Ajout de la mise en évidence des métacaractères Non échappés dans les littéraux de chaîne qui contiennent `LIKE` expressions ou expressions rationnelles. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout de l'annulation des requêtes HTTP en lecture seule si le socket client disparaît. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) -- Maintenant, le serveur signale la progression pour maintenir les connexions client en vie. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([Ivan](https://github.com/abyss7)) -- Message légèrement meilleur avec raison pour optimiser la requête avec `optimize_throw_if_noop` paramètre est activé. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout du support de `--version` option pour le serveur clickhouse. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) -- Ajouter `--help/-h` option pour `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) -- Ajout du support pour les sous-requêtes scalaires avec le résultat de l'état de la fonction d'agrégation. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Amélioration du temps d'arrêt du serveur et modifie le temps d'attente. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout d'informations sur le paramètre replicated\_can\_become\_leader au système.réplicas et ajouter la journalisation si la réplique ne sera pas essayer de devenir leader. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) - -## Clickhouse Version 19.1 {#clickhouse-release-19-1} - -### Clickhouse version 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} - -- Correction d'une erreur `Column ... queried more than once` cela peut arriver si le réglage `asterisk_left_columns_only` est réglé sur 1 en cas d'utilisation `GLOBAL JOIN` avec `SELECT *` (cas rare). Le problème n'existe pas dans 19.3 et plus récent. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) - -### Clickhouse version 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} - -Cette version contient exactement le même ensemble de patchs 19.3.7. - -### Clickhouse version 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} - -Cette version contient exactement le même ensemble de patchs 19.3.6. - -## Clickhouse Version 19.1 {#clickhouse-release-19-1-1} - -### Clickhouse version 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} - -#### Corrections de bugs {#bug-fixes-18} - -- Correction de l'incompatibilité avec les anciennes versions en raison d'une mauvaise implémentation de `send_logs_level` paramètre. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Incompatibilité arrière fixe de la fonction de table `remote` introduit avec des commentaires de colonne. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} - -#### Corrections De Bugs {#bug-fixes-19} - -- Correction du paquet d'installation avec /etc/clickhouse-server/config manquant.XML. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -## Clickhouse Version 19.1 {#clickhouse-release-19-1-2} - -### Clickhouse version 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} - -#### Corrections De Bugs {#bug-fixes-20} - -- Renvoyer correctement le bon type et gérer correctement les verrous `joinGet` fonction. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Oiseau](https://github.com/amosbird)) -- Correction d'une erreur lorsque les journaux système sont tentés de créer à nouveau à l'arrêt du serveur. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur: si une base de données avec `Dictionary` moteur, tous les dictionnaires forcés de charger au démarrage du serveur, et s'il y a un dictionnaire avec la source de ClickHouse de localhost, le dictionnaire ne peut pas charger. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug lors de l'exécution de mutations contenant `IN` les opérateurs produisaient des résultats incorrects. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- `clickhouse-client` peut segfault à la sortie lors du chargement des données pour les suggestions de ligne de commande si elle a été exécutée en mode interactif. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Condition de course fixe lors de la sélection de `system.tables` peut donner `table doesn't exist` erreur. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe blocage lorsqu' `SELECT` à partir d'une table avec `File` moteur a été rejugé après `No such file or directory` erreur. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un problème: les dictionnaires ClickHouse locaux sont chargés via TCP, mais devraient être chargés dans le processus. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe `No message received` erreur lors de l'interaction avec le pilote ODBC PostgreSQL via une connexion TLS. Corrige également segfault lors de l'utilisation du pilote MySQL ODBC. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Désactiver temporairement l'optimisation des prédicats pour `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Boucle infinie fixe lors de la sélection de la fonction de table `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe `compile_expressions` bug avec comparaison de grandes dates (plus de int16). [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alésapine](https://github.com/alesapin)) -- Correction d'un défaut de segmentation avec `uncompressed_cache=1` et exception avec une mauvaise taille non compressée. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alésapine](https://github.com/alesapin)) -- Fixe `ALL JOIN` avec des doublons dans la table de droite. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Fixe mauvais comportement lors `INSERT ... SELECT ... FROM file(...)` requête et fichier a `CSVWithNames` ou `TSVWIthNames` le format et la première ligne de données est manquant. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe l'exécution des fonctions d'agrégat avec `Array(LowCardinality)` argument. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Paquet Debian: correct/etc/clickhouse-server / lien prétraité selon config. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- Correction d'un test de fuzz sous un désinfectant de comportement indéfini: ajout d'une vérification de type de paramètre pour `quantile*Weighted` la famille de fonctions. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Faire `START REPLICATED SENDS` commande démarrer les envois répliqués. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- Fixe `Not found column` pour les colonnes en double dans JOIN ON section. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Maintenant `/etc/ssl` est utilisé comme répertoire par défaut avec les certificats SSL. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un crash sur dictionnaire recharger si le dictionnaire n'est pas disponible. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- Correction d'un bug avec incorrect `Date` et `DateTime` comparaison. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- Correction d'un résultat incorrect lorsque `Date` et `DateTime` les arguments sont utilisés dans les branches de l'opérateur conditionnel (fonction `if`). Ajouté cas générique pour la fonction `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -### Clickhouse version 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} - -#### Nouveauté {#new-features-7} - -- Codecs de compression personnalisés par colonne pour les tables. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alésapine](https://github.com/alesapin), [L'Hiver Zhang](https://github.com/zhang2014), [Anatoli](https://github.com/Sindbag)) -- Ajout du codec de compression `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alésapine](https://github.com/alesapin)) -- Permettre à `ALTER` codecs de compression. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alésapine](https://github.com/alesapin)) -- L'ajout de fonctions `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` pour la compatibilité standard SQL. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) -- Soutien pour écrire dans `HDFS` des tables et des `hdfs` table de fonction. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alésapine](https://github.com/alesapin)) -- L'ajout de fonctions pour rechercher plusieurs chaines de grosse botte de foin: `multiPosition`, `multiSearch` ,`firstMatch` aussi avec `-UTF8`, `-CaseInsensitive`, et `-CaseInsensitiveUTF8` variantes. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) -- Taille des éclats inutilisés si `SELECT` filtres de requête par clé de sharding (réglage `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [Ivan](https://github.com/abyss7)) -- Permettre `Kafka` moteur à ignorer certains nombre d'erreurs d'analyse par bloc. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([Ivan](https://github.com/abyss7)) -- Ajout du support pour `CatBoost` évaluation des modèles multiclass. Fonction `modelEvaluate` retourne tuple avec des prédictions brutes par classe pour les modèles multiclasse. `libcatboostmodel.so` devrait être construit avec [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- L'ajout de fonctions `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) -- Ajouté les fonctions de hachage `xxHash64` et `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) -- Ajouter `gccMurmurHash` fonction de hachage (hachage Murmur aromatisé GCC) qui utilise la même graine de hachage que [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) -- Ajouté les fonctions de hachage `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) -- Ajout d'un tableau de fonction `remoteSecure`. Fonction fonctionne comme `remote`, mais il utilise une connexion sécurisée. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) - -#### Caractéristiques expérimentales {#experimental-features-3} - -- Ajout de plusieurs jointures émulation (`allow_experimental_multiple_joins_emulation` paramètre). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Corrections De Bugs {#bug-fixes-21} - -- Faire `compiled_expression_cache_size` réglage limité par défaut pour réduire la consommation de mémoire. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug qui a conduit à des interruptions dans les threads qui effectuent des modifications de tables répliquées et dans le thread qui met à jour la configuration de ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) -- Correction d'une condition de concurrence lors de l'exécution d'une tâche alter distribuée. La condition de concurrence a conduit à plus d'une réplique essayant d'exécuter la tâche et toutes les répliques sauf une échouant avec une erreur ZooKeeper. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) -- Correction d'un bug lors de l' `from_zk` les éléments de configuration n'ont pas été actualisés après l'expiration d'une requête à ZooKeeper. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) -- Correction d'un bug avec un mauvais préfixe pour les masques de sous-réseau IPv4. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alésapine](https://github.com/alesapin)) -- Correction d'un crash (`std::terminate`) dans de rares cas où un nouveau thread ne peut pas être créé en raison de ressources épuisées. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug quand dans `remote` exécution de la fonction de table lorsque des restrictions incorrectes ont été utilisées pour in `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alésapine](https://github.com/alesapin)) -- Correction d'une fuite de sockets netlink. Ils ont été placés dans un pool où ils n'ont jamais été supprimés et de nouvelles sockets ont été créées au début d'un nouveau thread lorsque toutes les sockets actuelles étaient en cours d'utilisation. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) -- Correction d'un bug avec fermeture `/proc/self/fd` répertoire plus tôt que tous les fds ont été lus à partir de `/proc` après la bifurcation `odbc-bridge` sous-processus. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alésapine](https://github.com/alesapin)) -- Correction de la chaîne à la conversion monotone UInt en cas d'utilisation de la chaîne dans la clé primaire. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Correction d'une erreur dans le calcul de la monotonie de la fonction de conversion entière. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixe erreur de segmentation dans `arrayEnumerateUniq`, `arrayEnumerateDense` fonctions en cas d'arguments non valides. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corriger UB dans StorageMerge. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos Oiseau](https://github.com/amosbird)) -- Correction de segfault dans les fonctions `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur: fonctions `round`, `floor`, `trunc`, `ceil` peut renvoyer un résultat faux lorsqu'il est exécuté sur un argument entier et une grande échelle négative. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug induit par ‘kill query sync’ ce qui conduit à une décharge de base. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) -- Correction d'un bug avec un long délai après la file d'attente de réplication vide. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alésapine](https://github.com/alesapin)) -- Correction d'une utilisation excessive de la mémoire en cas d'insertion dans la table avec `LowCardinality` clé primaire. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Fixe `LowCardinality` la sérialisation de `Native` format en cas de tableaux vides. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Correction d'un résultat incorrect lors de l'utilisation de la colonne numérique distinct by single LowCardinality. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Agrégation spécialisée fixe avec la clé LowCardinality (dans le cas où `compile` paramètre est activé). [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Correction du transfert d'utilisateur et de mot de passe pour les requêtes de tables répliquées. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alésapine](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) -- Correction d'une condition de course très rare qui peut se produire lors de la liste des tables dans la base de données du dictionnaire lors du rechargement des dictionnaires. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un résultat incorrect lors de L'utilisation avec ROLLUP ou CUBE. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Sam Chou](https://github.com/reflection)) -- Alias de colonne fixe pour la requête avec `JOIN ON` syntaxe et tables distribuées. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Correction d'une erreur dans la mise en œuvre interne de `quantileTDigest` (trouvé par Artem Vakhrushev). Cette erreur ne se produit jamais dans ClickHouse et n'était pertinente que pour ceux qui utilisent directement clickhouse codebase comme bibliothèque. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Amélioration {#improvements-6} - -- Soutien pour `IF NOT EXISTS` dans `ALTER TABLE ADD COLUMN` les déclarations avec `IF EXISTS` dans `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) -- Fonction `parseDateTimeBestEffort`: prise en charge de formats `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` et similaires. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- `CapnProtoInputStream` maintenant soutenir les structures déchiquetées. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) -- Amélioration de la facilité d'utilisation: ajout d'une vérification que le processus du serveur est démarré à partir du propriétaire du répertoire de données. Ne pas autoriser le démarrage du serveur à partir de la racine si les données appartiennent à un utilisateur non root. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-V-galtsev](https://github.com/sergey-v-galtsev)) -- Meilleure logique de vérification des colonnes requises lors de l'analyse des requêtes avec des jointures. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) -- Diminution du nombre de connexions en cas de grand nombre de tables distribuées dans un seul serveur. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Appuyé ligne de totaux pour `WITH TOTALS` requête pour le pilote ODBC. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) -- Autorisé à utiliser `Enum`s comme entiers à l'intérieur de la fonction if. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([Ivan](https://github.com/abyss7)) -- Ajouter `low_cardinality_allow_in_native_format` paramètre. Si désactivé, ne pas utiliser `LowCadrinality` type de `Native` format. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Suppression de certains objets redondants du cache des expressions compilées pour réduire l'utilisation de la mémoire. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alésapine](https://github.com/alesapin)) -- Ajouter vérifier que `SET send_logs_level = 'value'` requête accepter la valeur appropriée. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) -- Vérification de type de données fixe dans les fonctions de conversion de type. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([L'Hiver Zhang](https://github.com/zhang2014)) - -#### Amélioration Des Performances {#performance-improvements-5} - -- Ajouter un paramètre MergeTree `use_minimalistic_part_header_in_zookeeper`. Si cette option est activée, les tables répliquées stockent les métadonnées de partie compacte dans un znode de partie unique. Cela peut réduire considérablement la taille de l'instantané ZooKeeper (surtout si les tables ont beaucoup de colonnes). Notez qu'après avoir activé ce paramètre, vous ne pourrez pas passer à une version qui ne le supporte pas. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) -- Ajouter une implémentation basée sur DFA pour les fonctions `sequenceMatch` et `sequenceCount` en cas de motif ne contient pas de temps. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Amélioration des performances pour la sérialisation des nombres entiers. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos Oiseau](https://github.com/amosbird)) -- Zéro gauche padding PODArray de sorte que -1 élément est toujours valide et mis à zéro. Il est utilisé pour le calcul sans branche des décalages. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos Oiseau](https://github.com/amosbird)) -- Revenir `jemalloc` version qui conduisent à la dégradation des performances. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Modifications Incompatibles En Arrière {#backward-incompatible-changes-2} - -- Fonctionnalité non documentée supprimée `ALTER MODIFY PRIMARY KEY` parce qu'il a été remplacé par le `ALTER MODIFY ORDER BY` commande. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) -- Retiré de la fonction `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Interdire l'utilisation de sous-requêtes scalaires avec le résultat de type `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([Ivan](https://github.com/abyss7)) - -#### Construire/Test/Emballage Améliorations {#buildtestingpackaging-improvements-6} - -- Ajout du support pour PowerPC (`ppc64le`) construire. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) -- Les tests fonctionnels avec État sont exécutés sur un ensemble de données Public disponible. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur lorsque le serveur ne peut pas démarrer avec le `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` message dans Docker ou systemd-nspawn. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre `rdkafka` bibliothèque à V1.0. 0-RC5. Utilisé cppkafka au lieu de l'interface c brute. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([Ivan](https://github.com/abyss7)) -- Mettre `mariadb-client` bibliothèque. Correction d'un des problèmes trouvés par UBSan. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Quelques corrections pour UBSan construit. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout de tests par validation avec UBSan build. -- Ajout d'exécutions par validation de PVS-Studio static analyzer. -- Correction de bugs trouvés par PVS-Studio. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de problèmes de compatibilité glibc. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Déplacez les images Docker vers 18.10 et ajoutez un fichier de compatibilité pour glibc \> = 2.28 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alésapine](https://github.com/alesapin)) -- Ajouter une variable env si l'utilisateur ne veut pas chown répertoires dans l'image Docker du serveur. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alésapine](https://github.com/alesapin)) -- Activé la plupart des avertissements de `-Weverything` à clang. Permettre `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout de quelques avertissements supplémentaires disponibles uniquement dans clang 8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Lien vers `libLLVM` plutôt que de libs LLVM individuels lors de l'utilisation de liens partagés. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) -- Ajout de variables de désinfection pour les images de test. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alésapine](https://github.com/alesapin)) -- `clickhouse-server` le paquet debian recommandera `libcap2-bin` package à utiliser `setcap` outil pour définir les capacités. Cette option est facultative. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Amélioration du temps de compilation, fixe comprend. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) -- Ajout de tests de performance pour les fonctions de hachage. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) -- Dépendances de bibliothèque cycliques fixes. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) -- Amélioration de la compilation avec une faible mémoire disponible. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) -- Ajout d'un script de test pour reproduire la dégradation des performances dans `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de fautes d'orthographe dans les commentaires et les littéraux de chaîne sous `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) -- Correction de fautes dans les commentaires. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) - -## [Changelog pour 2018](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/fr/whats_new/changelog/index.md b/docs/fr/whats_new/changelog/index.md deleted file mode 100644 index fe49ce8244c..00000000000 --- a/docs/fr/whats_new/changelog/index.md +++ /dev/null @@ -1,668 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_folder_title: Changelog -toc_priority: 74 -toc_title: '2020' ---- - -## Clickhouse version v20. 3 {#clickhouse-release-v20-3} - -### Clickhouse version v20. 3. 4. 10, 2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} - -#### Bug Fix {#bug-fix} - -- Cette version contient également toutes les corrections de bugs de 20.1.8.41 -- Fixer manquant `rows_before_limit_at_least` pour les requêtes sur http (avec pipeline de processeurs). Cela corrige [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### Clickhouse version v20. 3. 3. 6, 2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} - -#### Bug Fix {#bug-fix-1} - -- Cette version contient également toutes les corrections de bugs de 20.1.7.38 -- Correction d'un bug dans une réplication qui ne permet pas la réplication de fonctionner si l'Utilisateur a exécuté des mutations sur la version précédente. Cela corrige [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alésapine](https://github.com/alesapin)). Il rend la version 20.3 rétrocompatible à nouveau. -- Ajouter un paramètre `use_compact_format_in_distributed_parts_names` qui permet d'écrire des fichiers pour `INSERT` les requêtes en `Distributed` tableau avec un format plus compact. Cela corrige [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alésapine](https://github.com/alesapin)). Il rend la version 20.3 rétrocompatible à nouveau. - -### Clickhouse version v20. 3. 2. 1, 2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} - -#### Modification Incompatible En Arrière {#backward-incompatible-change} - -- Correction du problème `file name too long` lors de l'envoi de données pour `Distributed` tables pour un grand nombre de répliques. Correction du problème que les informations d'identification de réplique étaient exposées dans le journal du serveur. Le format du nom du répertoire sur le disque a été changé en `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) Après la mise à niveau vers la nouvelle version, vous ne pourrez pas rétrograder sans intervention manuelle, car l'ancienne version du serveur ne reconnaît pas le nouveau format de répertoire. Si vous souhaitez passer, vous devez renommer manuellement les répertoires correspondant à l'ancien format. Cette modification s'applique uniquement si vous avez utilisé asynchrone `INSERT`s `Distributed` table. Dans la version 20.3.3, nous allons introduire un paramètre qui vous permettra d'activer le nouveau format progressivement. -- Modification du format des entrées du journal de réplication pour les commandes de mutation. Vous devez attendre que les anciennes mutations soient traitées avant d'installer la nouvelle version. -- Implémentez un profileur de mémoire simple qui vide stacktraces vers `system.trace_log` chaque n octets au-dessus de la limite d'allocation douce [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([Ivan](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexeï-milovidov](https://github.com/alexey-milovidov)) La colonne de `system.trace_log` a été renommé de `timer_type` de `trace_type`. Cela nécessitera des changements dans les outils d'analyse des performances et de traitement flamegraph de tiers. -- Utilisez L'id de thread du système d'exploitation partout au lieu du numéro de thread interne. Cela corrige [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Vieux `clickhouse-client` impossible de recevoir les journaux envoyés par le serveur lorsque le paramètre `send_logs_level` est activé, car les noms et les types des messages de journal structurés ont été modifiés. D'autre part, différentes versions de serveur peuvent envoyer des journaux avec différents types les uns aux autres. Lorsque vous n'utilisez pas l' `send_logs_level` réglage, vous ne devez pas soin. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer `indexHint` fonction [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer `findClusterIndex`, `findClusterValue` fonction. Cela corrige [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). Si vous utilisez ces fonctions, envoyez un courriel à `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant, il n'est pas permis de créer des colonnes ou ajouter des colonnes avec `SELECT` sous-requête comme expression par défaut. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alésapine](https://github.com/alesapin)) -- Exiger des alias pour les sous-requêtes dans la JOINTURE. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) -- Améliorer `ALTER MODIFY/ADD` les requêtes de la logique. Maintenant vous ne pouvez pas `ADD` colonne sans type, `MODIFY` l'expression par défaut ne change pas le type de colonne et `MODIFY` type ne perd pas la valeur d'expression par défaut. Fixer [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alésapine](https://github.com/alesapin)) -- Exiger que le serveur soit redémarré pour appliquer les modifications dans la configuration de journalisation. Il s'agit d'une solution de contournement temporaire pour éviter le bogue où le serveur se connecte à un fichier journal supprimé (voir [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Paramètre `experimental_use_processors` est activé par défaut. Ce paramètre active l'utilisation du nouveau pipeline de requêtes. C'est un refactoring interne et nous n'attendons aucun changement visible. Si vous voyez des problèmes, réglez-le sur Retour à zéro. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Nouveauté {#new-feature} - -- Ajouter `Avro` et `AvroConfluent` d'entrée/sortie de formats [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mises à jour multithread et non bloquantes des clés expirées dans `cache` dictionnaires (avec autorisation facultative pour lire les anciens). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Ajouter une requête `ALTER ... MATERIALIZE TTL`. Il exécute mutation qui force à supprimer les données expirées par TTL et recalcule les méta-informations sur TTL dans toutes les parties. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) -- Passez de HashJoin à MergeJoin (sur le disque) si nécessaire [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter `MOVE PARTITION` commande pour `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Le rechargement de la configuration de stockage du fichier de configuration à la volée. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Autorisé à changer `storage_policy` pas moins riche. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Ajout du support pour globs / jokers pour le stockage S3 et la fonction de table. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Mettre `bitAnd`, `bitOr`, `bitXor`, `bitNot` pour `FixedString(N)` type de données. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Ajout de la fonction `bitCount`. Cela corrige [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ikopylov](https://github.com/ikopylov)) -- Ajouter `generateRandom` fonction de table pour générer des lignes aléatoires avec un schéma donné. Permet de remplir une table de test arbitraire avec des données. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) -- `JSONEachRowFormat`: support cas particulier lorsque les objets enfermés dans un tableau de niveau supérieur. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) -- Il est maintenant possible de créer une colonne avec `DEFAULT` expression qui dépend d'une colonne avec défaut `ALIAS` expression. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alésapine](https://github.com/alesapin)) -- Autoriser à spécifier `--limit` plus que la taille des données source dans `clickhouse-obfuscator`. Les données se répéteront avec différentes graines aléatoires. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter `groupArraySample` fonction (similaire à `groupArray`) avec réservoir algorithme d'échantillonnage. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos Oiseau](https://github.com/amosbird)) -- Maintenant, vous pouvez surveiller la taille de la file d'attente de mise à jour dans `cache`/`complex_key_cache` dictionnaires via les métriques du système. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Autoriser L'utilisation de CRLF comme séparateur de ligne au format de sortie CSV avec réglage `output_format_csv_crlf_end_of_line` est réglé sur 1 [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) -- Mettre en œuvre plus de fonctions de la [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` et `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) -- Nouveau paramètre introduit: `max_parser_depth` pour contrôler la taille maximale de la pile et permettre de grandes requêtes complexes. Cela corrige [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) et [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) -- Ajouter un paramètre `force_optimize_skip_unused_shards` réglage sur lancer si le saut d'éclats inutilisés n'est pas possible [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) -- Permet de configurer plusieurs disques / volumes pour stocker des données pour l'envoi `Distributed` moteur [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) -- Politique de stockage de soutien (`` pour le stockage temporaire des données. [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) -- Ajouter `X-ClickHouse-Exception-Code` En-tête HTTP défini si une exception a été levée avant l'envoi de données. Cela met en œuvre [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) -- Ajout de la fonction `ifNotFinite`. C'est juste un sucre syntaxique: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter `last_successful_update_time` colonne en `system.dictionaries` table [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Ajouter `blockSerializedSize` fonction (taille sur disque sans compression) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) -- Ajouter une fonction `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) -- Tables système ajoutées `system.zeros` et `system.zeros_mt` ainsi que les fonctions de conte `zeros()` et `zeros_mt()`. Les Tables (et les fonctions de table) contiennent une seule colonne avec le nom `zero` et le type `UInt8`. Cette colonne contient des zéros. Il est nécessaire à des fins de test comme la méthode la plus rapide pour générer de nombreuses lignes. Cela corrige [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Caractéristique Expérimentale {#experimental-feature} - -- Ajouter un nouveau format compact de pièces dans `MergeTree`-table de famille dont toutes les colonnes sont stockées dans un fichier. Il aide à augmenter les performances des inserts petits et fréquents. L'ancien format (un fichier par colonne) s'appelle maintenant wide. Le format de stockage des données est contrôlé par les paramètres `min_bytes_for_wide_part` et `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) -- Prise en charge du stockage S3 pour `Log`, `TinyLog` et `StripeLog` table. [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) - -#### Bug Fix {#bug-fix-2} - -- Correction d'espaces incohérents dans les messages de journal. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug dans lequel les tableaux de tuples sans nom ont été aplatis en tant que structures imbriquées lors de la création de la table. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) -- Correction du problème lorsque “Too many open files” l'erreur peut se produire s'il y a trop de fichiers correspondant glob modèle dans `File` table ou `file` table de fonction. Maintenant, les fichiers sont ouverts paresseusement. Cela corrige [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- DROP table temporaire ne supprime plus que la table temporaire. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) -- Supprimer la partition obsolète lorsque nous éteignons le serveur ou détacher/joindre une table. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Pour savoir comment le disque par défaut calcule l'espace libre à partir de `data` répertoire. Correction du problème lorsque la quantité d'espace libre n'est pas calculée correctement si l' `data` le répertoire est monté sur un appareil séparé (cas rare). Cela corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) -- Permettre virgule (croix) joindre avec IN () à l'intérieur. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) -- Permettre de réécrire CROSS to INNER JOIN s'il n'y a pas \[pas\] comme opérateur dans la section WHERE. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un résultat incorrect possible après `GROUP BY` avec le paramètre activé `distributed_aggregation_memory_efficient`. Fixer [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Les clés trouvées ont été comptées comme manquées dans les métriques des dictionnaires de cache. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Correction du protocole de réplication incompatibilité introduit dans [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alésapine](https://github.com/alesapin)) -- Condition de course fixe sur `queue_task_handle` au démarrage de `ReplicatedMergeTree` table. [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Jeton `NOT` ne fonctionne pas dans `SHOW TABLES NOT LIKE` requête [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Vérification de plage ajoutée à la fonction `h3EdgeLengthM`. Sans cette vérification, un débordement de tampon est possible. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug dans les calculs par lots des opérations logiques ternaires sur plusieurs arguments (plus de 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) -- Correction d'une erreur D'optimisation de PREWHERE, qui pourrait conduire à des `Inconsistent number of columns got from MergeTreeRangeReader` exception. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) -- Fix inattendu `Timeout exceeded while reading from socket` exception, qui se produit aléatoirement sur une connexion sécurisée avant le délai d'expiration réellement dépassé et lorsque query profiler est activé. Également ajouter `connect_timeout_with_failover_secure_ms` paramètres (par défaut 100 ms), qui est similaire à `connect_timeout_with_failover_ms`, mais est utilisé pour les connexions sécurisées (parce que la liaison SSL est plus lente, que la connexion TCP ordinaire) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un bug avec la finalisation des mutations, lorsque la mutation peut se bloquer dans l'état avec `parts_to_do=0` et `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alésapine](https://github.com/alesapin)) -- Utilisez une nouvelle logique de jointure avec `partial_merge_join` paramètre. Il est possible de faire `ANY|ALL|SEMI LEFT` et `ALL INNER` les jointures avec `partial_merge_join=1` maintenant. [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) -- Shard pince maintenant les paramètres obtenus de l'initiateur aux constaints de la partition au lieu de lancer une exception. Ce correctif permet d'envoyer des requêtes à un serveur avec un autre contraintes. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fixe, problème de gestion de mémoire dans `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixer `toDecimal*OrNull()` famille de fonctions lorsqu'elle est appelée avec une chaîne `e`. Fixer [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) -- Assurez-vous que `FORMAT Null` n'envoie pas de données au client. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Correction d'un bug dans cet horodatage `LiveViewBlockInputStream` ne sera pas mis à jour. `LIVE VIEW` est une fonctionnalité expérimentale. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) -- Fixe `ALTER MODIFY TTL` mauvais comportement qui n'a pas permis de supprimer les anciennes expressions TTL. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Rapport UBSan fixe dans MergeTreeIndexSet. Cela corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du comportement de `match` et `extract` fonctions lorsque haystack a zéro octets. Le comportement était mauvais quand la botte de foin était constante. Cela corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Évitez de lancer de destructor dans la bibliothèque Apache Avro 3rd-party. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) -- Ne commettez pas un lot interrogé à partir de `Kafka` partiellement, car il peut conduire à des trous dans les données. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) -- Fixer `joinGet` avec les types de retour nullable. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos Oiseau](https://github.com/amosbird)) -- Correction de l'incompatibilité des données lorsqu'elles sont compressées avec `T64` codec. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Corriger les ID de type de données dans `T64` codec de compression qui conduit à une mauvaise (de)compression dans les versions affectées. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter un paramètre `enable_early_constant_folding` et le désactiver dans certains cas, cela conduit à des erreurs. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix Pushdown prédicat optimizer avec vue et activer le test [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Fixer erreur de segmentation dans `Merge` tables, cela peut arriver lors de la lecture de `File` stockage [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) -- Ajout d'une vérification de la stratégie de stockage dans `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. Sinon, cela pourrait rendre les données de la partie inaccessibles après le redémarrage et empêcher ClickHouse de démarrer. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fix modifie s'il y a TTL défini pour la table. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) -- Correction de la condition de course qui peut se produire lorsque `SYSTEM RELOAD ALL DICTIONARIES` est exécuté pendant que certains dictionnaires sont modifiés / ajoutés / supprimés. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) -- Dans les versions précédentes `Memory` le moteur de base de données utilise un chemin de données vide, de sorte que les tables sont créées dans `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) -- Correction de messages de journal erronés sur le disque ou la stratégie par défaut manquant. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fix not (has ()) pour l'index bloom\_filter des types de tableau. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) -- Permettre à première colonne(s) dans un tableau avec `Log` moteur alias [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([Ivan](https://github.com/abyss7)) -- Fixer l'ordre des plages pendant la lecture d' `MergeTree` table dans un fil. Cela pourrait conduire à des exceptions `MergeTreeRangeReader` ou mauvais résultats de requête. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) -- Faire `reinterpretAsFixedString` retourner `FixedString` plutôt `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) -- Évitez les cas extrêmement rares où l'utilisateur peut se tromper message d'erreur (`Success` au lieu d'une description détaillée de l'erreur). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ne pas planter lors de l'utilisation de `Template` format avec modèle de ligne vide. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Les fichiers de métadonnées pour les tables système peuvent être créés au mauvais endroit [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix)) Fixer [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). -- Correction de la course de données sur exception\_ptr dans le dictionnaire de cache [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Ne pas lancer une exception pour la requête `ATTACH TABLE IF NOT EXISTS`. Auparavant, il a été lancé si la table existe déjà, malgré le `IF NOT EXISTS` clause. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) -- Correction manquant fermeture paren dans le message d'exception. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Éviter de message `Possible deadlock avoided` au démarrage de clickhouse-client en mode interactif. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du problème lorsque le remplissage à la fin de la valeur codée base64 peut être mal formé. Mettre à jour la bibliothèque base64. Cela corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), proche [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Empêcher la perte de données dans `Kafka` dans de rares cas, lorsque l'exception se produit après la lecture du suffixe mais avant la validation. Fixer [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) -- Correction d'une exception dans `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) -- Correction de plantage lorsqu'un utilisateur essaie d' `ALTER MODIFY SETTING` pour Ancien formaté `MergeTree` famille de moteurs de table. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alésapine](https://github.com/alesapin)) -- Prise en charge des numéros UInt64 qui ne correspondent pas à Int64 dans les fonctions liées à JSON. Mettre à jour SIMDJSON à maîtriser. Cela corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Exécution fixe de prédicats inversés lorsque l'index fonctionnel non strictement monotinique est utilisé. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) -- N'essayez pas de plier `IN` constante dans `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos Oiseau](https://github.com/amosbird)) -- Correction d'un bug dans `ALTER DELETE` mutations qui conduit à la corruption d'index. Cela corrige [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) et [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). En outre fixer des conditions de course extrêmement rares dans `ReplicatedMergeTree` `ALTER` requête. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alésapine](https://github.com/alesapin)) -- Lorsque le réglage `compile_expressions` est activée, vous pouvez obtenir `unexpected column` dans `LLVMExecutableFunction` lorsque nous utilisons `Nullable` type [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Plusieurs correctifs pour `Kafka` moteur: 1) Correction des doublons qui apparaissaient pendant le rééquilibrage du groupe de consommateurs. 2) Correction rare ‘holes’ apparu lorsque les données ont été interrogées à partir de plusieurs partitions avec un sondage et validées partiellement (maintenant, nous traitons / validons toujours l'ensemble du bloc de messages interrogé). 3) corriger les vidages par taille de bloc (avant que seul le rinçage par Délai d'attente fonctionnait correctement). 4) meilleure procédure d'abonnement (avec rétroaction d'affectation). 5) Faites fonctionner les tests plus rapidement (avec des intervalles et des délais d'attente par défaut). En raison du fait que les données n'étaient pas vidées par la taille du bloc auparavant (comme il se doit selon la documentation), Ce PR peut entraîner une dégradation des performances avec les paramètres par défaut (en raison de vidages plus fréquents et plus petits qui sont moins optimaux). Si vous rencontrez le problème de performance après ce changement - veuillez augmenter `kafka_max_block_size` dans le tableau de la plus grande valeur ( par exemple `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Fixer [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) -- Fixer `Parameter out of bound` exception dans certaines requêtes après les optimisations PREWHERE. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) -- Correction du cas de la consistance mixte des arguments de la fonction `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Lors de l'exécution de `CREATE` requête, plier les expressions constantes dans les arguments du moteur de stockage. Remplacez le nom de base de données vide par la base de données actuelle. Fixer [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) -- Maintenant il n'est pas possible de créer ou d'ajouter des colonnes avec des alias cycliques simples comme `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug avec double mouvement qui peut corrompre la partie originale. Ceci est pertinent si vous utilisez `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Permettre `interval` identifiant pour analyser correctement sans backticks. Correction d'un problème lorsqu'une requête ne peut pas être exécutée même si le `interval` l'identifiant est entouré de backticks ou de guillemets doubles. Cela corrige [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Test de fuzz fixe et comportement incorrect de `bitTestAll`/`bitTestAny` fonction. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction plantage possible/mauvais nombre de lignes dans `LIMIT n WITH TIES` quand il y a beaucoup de lignes égales à n'ème ligne. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -- Correction de mutations avec des parties écrites avec activé `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alésapine](https://github.com/alesapin)) -- Correction de la course de données à la destruction de `Poco::HTTPServer`. Cela peut se produire lorsque le serveur est démarré et immédiatement arrêté. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -- Correction d'un bug dans lequel un message d'erreur trompeur a été affiché lors de l'exécution `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) -- Fixe `Parameters are out of bound` exception dans de rares cas où nous avons une constante dans le `SELECT` clause quand nous avons un `ORDER BY` et un `LIMIT` clause. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Fix finalisation des mutations, quand déjà fait mutation peut avoir le statut `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alésapine](https://github.com/alesapin)) -- Empêcher l'exécution de `ALTER ADD INDEX` pour les tables MergeTree avec une ancienne syntaxe, car cela ne fonctionne pas. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) -- Pendant le démarrage du serveur, n'ACCÉDEZ PAS à la table, qui `LIVE VIEW` dépend de, donc le serveur sera en mesure de démarrer. Également supprimer `LIVE VIEW` dépendances lors du détachement `LIVE VIEW`. `LIVE VIEW` est une fonctionnalité expérimentale. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) -- Correction possible segfault dans `MergeTreeRangeReader`, lors de l'exécution `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) -- Correction d'éventuelles sommes de contrôle non appariées avec la colonne TTL. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -- Correction d'un bug lorsque les pièces n'étaient pas déplacées en arrière-plan par les règles TTL dans le cas où il n'y avait qu'un seul volume. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction du problème `Method createColumn() is not implemented for data type Set`. Cela corrige [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant, nous allons essayer de finaliser les mutations plus fréquemment. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alésapine](https://github.com/alesapin)) -- Fixer `intDiv` par moins une constante [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) -- Correction d'une condition de course possible dans `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un bug menant à la résiliation du serveur lorsque vous essayez d'utiliser / drop `Kafka` tableau créé avec de mauvais paramètres. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) -- Ajout d'une solution de contournement si le système d'exploitation renvoie un résultat erroné pour `timer_create` fonction. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'une erreur dans l'utilisation de `min_marks_for_seek` paramètre. Correction du message d'erreur lorsqu'il n'y a pas de clé de sharding dans la table distribuée et que nous essayons d'ignorer les fragments inutilisés. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) - -#### Amélioration {#improvement} - -- Mettre `ALTER MODIFY/DROP` requêtes au-dessus des mutations pour `ReplicatedMergeTree*` les moteurs de la famille. Maintenant `ALTERS` bloque uniquement à l'étape de mise à jour des métadonnées, et ne bloque pas après cela. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alésapine](https://github.com/alesapin)) -- Ajouter la possibilité de réécrire CROSS aux jointures internes avec `WHERE` section contenant des noms Non qialifiés. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) -- Faire `SHOW TABLES` et `SHOW DATABASES` les requêtes prennent en charge le `WHERE` les expressions et les `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) -- Ajout d'un paramètre `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) -- Après des changements récents Le client MySQL a commencé à imprimer des chaînes binaires en hexadécimal les rendant ainsi non lisibles ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). La solution de contournement dans ClickHouse est de marquer les colonnes de chaîne comme UTF-8, ce qui n'est pas toujours le cas, mais généralement le cas. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) -- Ajout du support des clés String et FixedString pour `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) -- Clés de chaîne de soutien dans les cartes SummingMergeTree [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) -- Signal terminaison du thread au pool de threads même si le thread a lancé une exception [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- Permettent de mettre en `query_id` dans `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) -- N'autorisez pas les expressions étranges `ALTER TABLE ... PARTITION partition` requête. Cela répond à l' [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Table `system.table_engines` fournit maintenant des informations sur le support des fonctionnalités (comme `supports_ttl` ou `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) -- Permettre `system.metric_log` par défaut. Il contiendra des lignes avec des valeurs de ProfileEvents, CurrentMetrics collectées avec “collect\_interval\_milliseconds” intervalle (une seconde par défaut). La table est très petite (généralement par ordre de mégaoctets) et la collecte de ces données par défaut est raisonnable. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([Ivan](https://github.com/abyss7)) -- Maintenant temporaire `LIVE VIEW` est créé par `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` plutôt `CREATE TEMPORARY LIVE VIEW ...` parce que la syntaxe précédente n'était pas conforme à `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) -- Ajouter text\_log.paramètre de configuration de niveau pour limiter les entrées `system.text_log` table [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) -- Permettre de mettre la partie téléchargée sur un disque / volume selon les règles TTL [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Pour les dictionnaires MySQL externes, autorisez à mutualiser le pool de connexions MySQL pour “share” parmi les dictionnaires. Cette option réduit considérablement le nombre de connexions aux serveurs MySQL. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Afficher le temps d'exécution de la requête le plus proche pour les quantiles dans `clickhouse-benchmark` sortie au lieu de valeurs interpolées. Il est préférable d'afficher les valeurs qui correspondent à l'exécution de certaines requêtes. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Possibilité d'ajouter une clé et un horodatage pour le message lors de l'insertion de données dans Kafka. Fixer [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) -- Si le serveur est exécuté à partir du terminal, mettez en surbrillance le numéro de thread, l'id de requête et la priorité du journal par couleurs. Ceci permet d'améliorer la lisibilité des messages de journal corrélés pour les développeurs. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Meilleur message d'exception lors du chargement des tables pour `Ordinary` la base de données. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre `arraySlice` pour les tableaux avec des états de fonction d'agrégat. Cela corrige [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Autoriser les fonctions constantes et les tableaux constants à utiliser sur le côté droit de L'opérateur IN. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) -- Si l'exception zookeeper s'est produite lors de la récupération des données du système.les répliques, l'afficher dans une colonne séparée. Cela met en œuvre [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer atomiquement les parties de données MergeTree sur destroy. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Prise en charge de la sécurité au niveau des lignes pour les tables distribuées. [\#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([Ivan](https://github.com/abyss7)) -- Now we recognize suffix (like KB, KiB…) in settings values. [\#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) -- Empêchez la mémoire lors de la construction du résultat d'une jointure importante. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajout de noms de clusters aux suggestions en mode interactif dans `clickhouse-client`. [\#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexeï-milovidov](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) ([Ivan](https://github.com/abyss7)) -- Ajout de la colonne `exception_code` dans `system.query_log` table. [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) -- Serveur de compatibilité MySQL activé sur le port `9004` par défaut dans le fichier de configuration du serveur. Fixe génération de mot de passe commande dans l'exemple de configuration. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) -- Empêcher l'abandon à l'arrêt si le système de fichiers est en lecture seule. Cela corrige [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Meilleur message d'exception lorsque la longueur est requise dans la requête HTTP POST. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter `_path` et `_file` les colonnes virtuelles à `HDFS` et `File` les moteurs et les `hdfs` et `file` les fonctions de table [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) -- Correction d'erreur `Cannot find column` lors de l'insertion dans `MATERIALIZED VIEW` dans le cas où une nouvelle colonne a été ajoutée à la table interne de la vue. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction de la progression sur le protocole client-serveur natif, en envoyant la progression après la mise à jour finale (comme les journaux). Cela peut être pertinent uniquement pour certains outils tiers qui utilisent le protocole natif. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) -- Ajouter une métrique système de suivi du nombre de connexions client à L'aide du protocole MySQL ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) -- A partir de Maintenant, les réponses HTTP auront `X-ClickHouse-Timezone` en-tête défini sur la même valeur de fuseau horaire que `SELECT timezone()` serait-rapport. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) - -#### Amélioration Des Performances {#performance-improvement} - -- Améliorer les performances de l'analyse de l'indice DANS [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) -- Code plus simple et plus efficace dans les fonctions logiques + nettoyage de code. Un suivi à [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) -- Amélioration globale de la performance (de l'ordre de 5%..200% pour les requêtes affectées) en assurant un aliasing encore plus strict avec les fonctionnalités c++20. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos Oiseau](https://github.com/amosbird)) -- Aliasing plus strict pour les boucles internes des fonctions de comparaison. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Aliasing plus strict pour les boucles internes des fonctions arithmétiques. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Une implémentation ~3 fois plus rapide pour ColumnVector::replicate (), via laquelle ColumnConst:: convertToFullColumn () est implémentée. Sera également utile dans les tests lors de la matérialisation des constantes. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) -- Une autre amélioration mineure des performances à `ColumnVector::replicate()` (cela accélère le `materialize` fonction et des fonctions d'ordre supérieur) une amélioration encore plus [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) -- Amélioration des performances de `stochasticLinearRegression` fonction d'agrégation. Ce patch est fourni par Intel. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Améliorer les performances de `reinterpretAsFixedString` fonction. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- N'envoyez pas de blocs au client pour `Null` format dans le pipeline de processeurs. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement} - -- La gestion des exceptions fonctionne maintenant correctement sur le sous-système Windows Pour Linux. Tu vois https://github.com/ClickHouse-Extras/libunwind/pull/3 cela corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) -- Remplacer `readline` avec `replxx` interactif, l'édition en ligne en `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([Ivan](https://github.com/abyss7)) -- Meilleur temps de construction et moins d'instanciations de modèle dans FunctionsComparison. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Intégration ajoutée avec `clang-tidy` in CI. Voir aussi [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant, nous lions ClickHouse dans CI en utilisant `lld` même pour `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alésapine](https://github.com/alesapin)) -- Permet de randomiser la planification des threads et d'insérer des problèmes lorsque `THREAD_FUZZER_*` variables d'environnement sont définies. Cela aide les tests. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Activer les sockets sécurisés dans les tests sans état [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) -- Rendre SPLIT\_SHARED\_LIBRARIES = OFF plus robuste [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) -- Faire “performance\_introspection\_and\_logging” test fiable au serveur aléatoire bloqué. Cela peut se produire dans L'environnement CI. Voir aussi [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Valider XML dans la vérification de style. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Condition de course fixe dans l'essai `00738_lock_for_inner_table`. Ce test reposait sur le sommeil. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer les tests de performance de type `once`. Ceci est nécessaire pour exécuter tous les tests de performance en mode de comparaison statistique (plus fiable). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout d'un test de performance pour les fonctions arithmétiques. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouté test de performance pour `sumMap` et `sumMapWithOverflow` les fonctions d'agrégation. Pour le suivi de la [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Assurez le style des codes D'erreur en vérifiant le style. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter un script pour l'historique des tests. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alésapine](https://github.com/alesapin)) -- Ajouter un avertissement GCC `-Wsuggest-override` pour localiser et réparer tous les endroits où `override` mot-clé doit être utilisé. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Ignorer le symbole faible sous Mac OS X car il doit être défini [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Utilisateur supprimé](https://github.com/ghost)) -- Normaliser le temps d'exécution de certaines requêtes dans les tests de performance. Ceci est fait en préparation pour exécuter tous les tests de performance en mode comparaison. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de certains tests pour prendre en charge pytest avec des tests de requête [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([Ivan](https://github.com/abyss7)) -- Activez SSL dans build avec MSan, afin que le serveur n'échoue pas au démarrage lors de l'exécution de tests sans état [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) -- Correction de la substitution de base de données dans les résultats des tests [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) -- Construire des correctifs pour diverses plates-formes [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) -- Ajout de la section disques à l'image Docker test stateless-with-coverage [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) -- Débarrassez-vous des fichiers in-source-tree lors de la construction avec GRPC [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos Oiseau](https://github.com/amosbird)) -- Temps de construction légèrement plus rapide en supprimant SessionCleaner du contexte. Rendre le code de SessionCleaner plus simple. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mise à jour de la vérification des requêtes suspendues dans le script clickhouse-test [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) -- Suppression de certains fichiers inutiles du référentiel. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Changement de type de math perftests de `once` de `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ajouter une image docker qui permet de créer un rapport HTML interactif du navigateur de code pour notre base de code. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alésapine](https://github.com/alesapin)) Voir [Navigateur De Code Woboq](https://clickhouse.tech/codebrowser/html_report///ClickHouse/src/src/index.html) -- Supprimer certains échecs de test sous MSan. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- SpeedUp “exception while insert” test. Ce test expire souvent dans la construction debug-with-coverage. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre `libcxx` et `libcxxabi` maîtriser. En préparation à [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du test flacky `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Nettoyer les drapeaux de l'éditeur de liens dupliqués. Assurez-vous que l'éditeur de liens ne pas rechercher un symbole inattendu. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos Oiseau](https://github.com/amosbird)) -- Ajouter `clickhouse-odbc` pilote dans les images de test. Cela permet de tester l'interaction de ClickHouse avec ClickHouse via son propre pilote ODBC. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) -- Correction de plusieurs bugs dans les tests unitaires. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alésapine](https://github.com/alesapin)) -- Permettre `-Wmissing-include-dirs` Avertissement GCC pour éliminer toutes les inclusions non existantes-principalement à la suite D'erreurs de script CMake [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Décrivez les raisons si query profiler ne peut pas fonctionner. C'est prévu pour [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre à jour OpenSSL vers le maître en amont. Correction du problème lorsque les connexions TLS peuvent échouer avec le message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` et `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. Le problème était présent dans la version 20.1. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre à jour Dockerfile pour le serveur [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) -- Corrections mineures dans le script build-gcc-from-sources [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) -- Remplacer `numbers` de `zeros` dans perftests où `number` la colonne n'est pas utilisée. Cela conduira à des résultats de test plus propres. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un problème de débordement de pile lors de l'utilisation de initializer\_list dans les constructeurs de colonnes. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Utilisateur supprimé](https://github.com/ghost)) -- Mise à niveau librdkafka à v1. 3. 0. Activer groupé `rdkafka` et `gsasl` bibliothèques sous Mac OS X. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) -- correction de construction sur GCC 9.2.0 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) - -## Clickhouse version v20. 1 {#clickhouse-release-v20-1} - -### Clickhouse version v20. 1. 8. 41, 2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} - -#### Bug Fix {#bug-fix-3} - -- Correction possible permanente `Cannot schedule a task` erreur (due à une exception non gérée dans `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). Cela corrige [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) -- Correction de la consommation excessive de mémoire dans `ALTER` les requêtes (mutations). Cela corrige [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) et [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug dans backquoting dans les dictionnaires externes DDL. Cela corrige [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alésapine](https://github.com/alesapin)) - -### Clickhouse version v20. 1. 7. 38, 2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} - -#### Bug Fix {#bug-fix-4} - -- Correction de noms de fonctions internes incorrects pour `sumKahan` et `sumWithOverflow`. Je mène à l'exception en utilisant ces fonctions dans les requêtes distantes. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). Ce problème était dans toutes les versions de ClickHouse. -- Permettre `ALTER ON CLUSTER` de `Distributed` tables avec réplication interne. Cela corrige [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). Ce problème était dans toutes les versions de ClickHouse. -- Corriger les exceptions possibles `Size of filter doesn't match size of column` et `Invalid number of rows in Chunk` dans `MergeTreeRangeReader`. Ils pouvaient apparaître lors de l'exécution `PREWHERE` dans certains cas. Fixer [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) -- Correction du problème: le fuseau horaire n'a pas été conservé si vous écrivez une expression arithmétique simple comme `time + 1` (contrairement à une expression comme `time + INTERVAL 1 SECOND`). Cela corrige [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexeï-milovidov](https://github.com/alexey-milovidov)). Ce problème était dans toutes les versions de ClickHouse. -- Maintenant il n'est pas possible de créer ou d'ajouter des colonnes avec des alias cycliques simples comme `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alésapine](https://github.com/alesapin)) -- Correction du problème lorsque le remplissage à la fin de la valeur codée base64 peut être mal formé. Mettre à jour la bibliothèque base64. Cela corrige [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), proche [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la course de données à la destruction de `Poco::HTTPServer`. Cela peut se produire lorsque le serveur est démarré et immédiatement arrêté. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -- Correction plantage possible/mauvais nombre de lignes dans `LIMIT n WITH TIES` quand il y a beaucoup de lignes égales à n'ème ligne. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -- Correction d'éventuelles sommes de contrôle non appariées avec la colonne TTL. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -- Correction de plantage lorsqu'un utilisateur essaie d' `ALTER MODIFY SETTING` pour Ancien formaté `MergeTree` famille de moteurs de table. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alésapine](https://github.com/alesapin)) -- Maintenant, nous allons essayer de finaliser les mutations plus fréquemment. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alésapine](https://github.com/alesapin)) -- Correction du protocole de réplication incompatibilité introduit dans [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alésapine](https://github.com/alesapin)) -- Fix not (has ()) pour l'index bloom\_filter des types de tableau. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) -- Correction du comportement de `match` et `extract` fonctions lorsque haystack a zéro octets. Le comportement était mauvais quand la botte de foin était constante. Cela corrige [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexeï-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-1} - -- La gestion des exceptions fonctionne maintenant correctement sur le sous-système Windows Pour Linux. Tu vois https://github.com/ClickHouse-Extras/libunwind/pull/3 cela corrige [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) - -### Clickhouse version v20. 1. 6. 30, 2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} - -#### Bug Fix {#bug-fix-5} - -- Correction de l'incompatibilité des données lorsqu'elles sont compressées avec `T64` codec. - [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) -- Correction de l'ordre des plages lors de la lecture de la table MergeTree dans un thread. Fixer [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). - [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) -- Correction possible segfault dans `MergeTreeRangeReader`, lors de l'exécution `PREWHERE`. Fixer [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). - [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) -- Fixer `reinterpretAsFixedString` retourner `FixedString` plutôt `String`. - [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) -- Fixer `joinGet` avec les types de retour nullable. Fixer [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) - [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) -- Correction du test fuzz et du comportement incorrect des fonctions bitTestAll/bitTestAny. - [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Corrigez le comportement des fonctions match et extract lorsque haystack a zéro octet. Le comportement était mauvais quand la botte de foin était constante. Fixer [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) - [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Exécution fixe de prédicats inversés lorsque l'index fonctionnel non strictement monotinique est utilisé. Fixer [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) - [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) -- Permettre à réécrire `CROSS` de `INNER JOIN` si il y a `[NOT] LIKE` opérateur `WHERE` section. Fixer [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) - [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) -- Autoriser la(Les) première (s) colonne (s) dans une table avec Log engine à être un alias. - [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) -- Autoriser la virgule rejoindre `IN()` à l'intérieur. Fixer [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). - [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) -- Améliorer `ALTER MODIFY/ADD` les requêtes de la logique. Maintenant vous ne pouvez pas `ADD` colonne sans type, `MODIFY` l'expression par défaut ne change pas le type de colonne et `MODIFY` type ne perd pas la valeur d'expression par défaut. Fixer [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). - [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) -- Fix finalisation des mutations, quand déjà fait mutation peut avoir le statut is\_done = 0. - [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) -- Soutien “Processors” pipeline pour le système.nombres et système.numbers\_mt. Cela corrige également le bug lorsque `max_execution_time` n'est pas respectée. - [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- Correction d'un mauvais comptage de `DictCacheKeysRequestedFound` métrique. - [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) -- Ajout d'une vérification de la stratégie de stockage dans `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` ce qui pourrait autrement rendre les données de la partie inaccessibles après le redémarrage et empêcher ClickHouse de démarrer. - [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) -- Rapport UBSan fixe dans `MergeTreeIndexSet`. Cela corrige [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) - [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Correction possible datarace dans BlockIO. - [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- Soutien pour `UInt64` nombres qui ne correspondent pas à Int64 dans les fonctions liées à JSON. Mettre `SIMDJSON` maîtriser. Cela corrige [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) - [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Résoudre le problème lorsque la quantité d'espace libre n'est pas calculée correctement si le répertoire de données est monté sur un appareil séparé. Pour le disque par défaut calculer l'espace libre à partir du sous-répertoire de données. Cela corrige [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) - [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) -- Corrigez le problème lorsque les connexions TLS peuvent échouer avec le message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Mettre à jour OpenSSL vers le maître en amont. - [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Lors de l'exécution de `CREATE` requête, plier les expressions constantes dans les arguments du moteur de stockage. Remplacez le nom de base de données vide par la base de données actuelle. Fixer [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Corrigez également la vérification de l'adresse locale dans ClickHouseDictionarySource. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Fixer erreur de segmentation dans `StorageMerge`, ce qui peut arriver lors de la lecture de StorageFile. - [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) -- Empêcher la perte de données dans `Kafka` dans de rares cas, lorsque l'exception se produit après la lecture du suffixe mais avant la validation. Fixer [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Concerner: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -- Correction d'un bug menant à la résiliation du serveur lorsque vous essayez d'utiliser / drop `Kafka` tableau créé avec de mauvais paramètres. Fixer [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporer [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) - -#### Nouveauté {#new-feature-1} - -- Ajouter `deduplicate_blocks_in_dependent_materialized_views` option pour contrôler le comportement des insertions idempotent dans des tables avec des vues matérialisées. Cette nouvelle fonctionnalité a été ajoutée à la version de bugfix par une demande spéciale D'Altinity. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### Clickhouse version v20. 1. 2. 4, 2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} - -#### Modification Incompatible En Arrière {#backward-incompatible-change-1} - -- Effectuer le réglage `merge_tree_uniform_read_distribution` obsolète. Le serveur reconnaît toujours ce paramètre, mais il n'a pas d'effet. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Type de retour modifié de la fonction `greatCircleDistance` de `Float32` parce que maintenant, le résultat du calcul est `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant, il est prévu que les paramètres de requête sont représentés dans “escaped” format. Par exemple, pour passer de la chaîne `ab` vous devez écrire `a\tb` ou `a\b` et, respectivement,, `a%5Ctb` ou `a%5C%09b` dans L'URL. Ceci est nécessaire pour ajouter la possibilité de passer NULL as `\N`. Cela corrige [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Permettre `use_minimalistic_part_header_in_zookeeper` réglage pour `ReplicatedMergeTree` par défaut. Cela permettra de réduire considérablement la quantité de données stockées dans ZooKeeper. Ce paramètre est pris en charge depuis la version 19.1 et nous l'utilisons déjà en production dans plusieurs services sans aucun problème depuis plus d'une demi-année. Désactivez ce paramètre si vous avez la possibilité de passer à des versions antérieures à 19.1. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Les indices de saut de données sont prêts pour la production et activés par défaut. Paramètre `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` et `allow_experimental_multiple_joins_emulation` sont maintenant obsolètes et ne rien faire. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter de nouveaux `ANY JOIN` logique pour `StorageJoin` compatible avec `JOIN` opération. Pour mettre à niveau sans changement de comportement vous devez ajouter `SETTINGS any_join_distinct_right_table_keys = 1` pour engine Join tables metadata ou recréer ces tables après la mise à niveau. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) -- Exiger que le serveur soit redémarré pour appliquer les modifications dans la configuration de journalisation. Il s'agit d'une solution de contournement temporaire pour éviter le bogue où le serveur se connecte à un fichier journal supprimé (voir [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### Nouveauté {#new-feature-2} - -- Ajout d'informations sur les chemins d'accès `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Ajouter la possibilité d'exécuter `SYSTEM RELOAD DICTIONARY` requête en `ON CLUSTER` mode. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Ajouter la possibilité d'exécuter `CREATE DICTIONARY` les requêtes en `ON CLUSTER` mode. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alésapine](https://github.com/alesapin)) -- Maintenant, le profil de l'utilisateur dans `users.xml` peut hériter de plusieurs profils. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Ajouter `system.stack_trace` table qui permet de regarder les traces de pile de tous les threads du serveur. Ceci est utile pour les développeurs d'introspecter l'état du serveur. Cela corrige [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter `DateTime64` type de données configurables sous-précision de seconde. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) -- Ajouter une fonction de table `clusterAllReplicas` ce qui permet d'interroger tous les nœuds dans le cluster. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari)) -- Ajouter une fonction d'agrégat `categoricalInformationValue` qui calcule la valeur d'information d'une fonction discrète. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) -- Accélérer l'analyse des fichiers de données dans `CSV`, `TSV` et `JSONEachRow` formater en le faisant en parallèle. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Ajouter une fonction `bankerRound` qui effectue l'arrondi. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) -- Soutenir plus de langues dans le dictionnaire intégré pour les noms de région: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Améliorer l'uniformité de `ANY JOIN` logique. Maintenant `t1 ANY LEFT JOIN t2` égal `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter un paramètre `any_join_distinct_right_table_keys` ce qui permet un vieux comportement pour `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter de nouveaux `SEMI` et `ANTI JOIN`. Vieux `ANY INNER JOIN` comportement maintenant disponible en `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter `Distributed` format pour `File` moteur et `file` fonction de table qui permet de lire à partir `.bin` fichiers générés par des insertions asynchrones dans `Distributed` table. [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ajouter un argument de colonne de réinitialisation facultatif pour `runningAccumulate` ce qui permet de réinitialiser les résultats d'agrégation pour chaque nouvelle valeur de clé. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) -- Ajouter la possibilité d'utiliser ClickHouse comme point de terminaison Prometheus. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) -- Ajouter une section `` dans `config.xml` qui restreint les hôtes autorisés pour les moteurs de table distants et les fonctions de table `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) -- Ajout de la fonction `greatCircleAngle` qui calcule la distance sur une sphère en degrés. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Rayon de la Terre modifié pour être cohérent avec la bibliothèque H3. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter `JSONCompactEachRow` et `JSONCompactEachRowWithNamesAndTypes` les formats d'entrée et de sortie. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) -- Ajout d'une fonctionnalité pour les moteurs de table liés aux fichiers et les fonctions de table (`File`, `S3`, `URL`, `HDFS`) qui permet de lire et d'écrire `gzip` fichiers basés sur un paramètre de moteur supplémentaire ou une extension de fichier. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) -- Ajouté le `randomASCII(length)` fonction, générant une chaîne avec un ensemble aléatoire de [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) caractères imprimables. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([Baïonnette](https://github.com/BayoNet)) -- Ajout de la fonction `JSONExtractArrayRaw` qui renvoie un tableau sur des éléments de tableau JSON non analysés de `JSON` chaîne. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) -- Ajouter `arrayZip` fonction qui permet de combiner plusieurs tableaux de longueurs égales dans un tableau de n-uplets. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Ajouter la possibilité de déplacer des données entre les disques selon configuré `TTL`-expressions pour `*MergeTree` famille de moteurs de table. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Ajout d'une nouvelle fonction d'agrégat `avgWeighted` qui permet de calculer la moyenne pondérée. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) -- Maintenant, l'analyse parallèle est activée par défaut pour `TSV`, `TSKV`, `CSV` et `JSONEachRow` format. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Ajouter plusieurs fonctions de géo `H3` bibliothèque: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` et `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) -- Ajout du support pour brotli (`br`) compression dans les stockages liés aux fichiers et les fonctions de table. Cela corrige [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter `groupBit*` fonctions pour l' `SimpleAggregationFunction` type. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Bug Fix {#bug-fix-6} - -- Correction du renommage des tables avec `Distributed` moteur. Correction problème [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- Maintenant dictionnaires de soutien `EXPRESSION` pour les attributs dans une chaîne arbitraire en dialecte SQL non-ClickHouse. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alésapine](https://github.com/alesapin)) -- Réparation de `INSERT SELECT FROM mysql(...)` requête. Cela corrige [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) et [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- Correction d'erreur “Mismatch column sizes” lors de l'insertion par défaut `Tuple` de `JSONEachRow`. Cela corrige [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) -- Maintenant, une exception sera levée en cas d'utilisation `WITH TIES` parallèlement `LIMIT BY`. Ajoutez également la possibilité d'utiliser `TOP` avec `LIMIT BY`. Cela corrige [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Correction de la dépendance unintendent à partir de la nouvelle version de glibc dans `clickhouse-odbc-bridge` binaire. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos Oiseau](https://github.com/amosbird)) -- Correction d'un bug dans la fonction de contrôle de `*MergeTree` les moteurs de la famille. Maintenant, il n'échoue pas dans le cas où nous avons une quantité égale de lignes dans le dernier granule et la dernière marque (non finale). [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alésapine](https://github.com/alesapin)) -- Fixer l'insertion dans `Enum*` les colonnes après `ALTER` requête, lorsque le type numérique sous-jacent est égal au type spécifié par la table. Cela corrige [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) -- Négatif non constant autorisé “size” argument pour la fonction `substring`. Il n'a pas été autorisé par erreur. Cela corrige [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bogue d'analyse lorsque le nombre d'arguments transmis est erroné `(O|J)DBC` tableau moteur. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alésapine](https://github.com/alesapin)) -- Utilisation du nom de commande du processus clickhouse en cours d'exécution lors de l'envoi de journaux à syslog. Dans les versions précédentes, la chaîne vide était utilisée à la place du nom de la commande. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) -- Correction de la vérification des hôtes autorisés pour `localhost`. Ce PR corrige la solution fournie dans [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction plantage rare dans `argMin` et `argMax` fonctions pour les arguments de chaîne longue, lorsque result est utilisé dans `runningAccumulate` fonction. Cela corrige [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinosaure](https://github.com/769344359)) -- Correction de la surcommission de mémoire pour les tables avec `Buffer` moteur. [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) -- Correction d'un bug potentiel dans les fonctions qui peuvent prendre `NULL` comme l'un des arguments et retourner non-NULL. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Meilleurs calculs de métriques dans le pool de threads pour les processus `MergeTree` table des moteurs. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fonction Fix `IN` à l'intérieur de `WHERE` instruction lorsque le filtre de table de niveau ligne est présent. Fixer [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([Ivan](https://github.com/abyss7)) -- Maintenant, une exception est levée si la valeur intégrale n'est pas complètement analysée pour les valeurs des paramètres. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) -- Fix exception lorsque la fonction est utilisée dans la requête distribuée table avec plus de deux fragments. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- Maintenant, bloom filter peut gérer des tableaux de longueur nulle et n'effectue pas de calculs redondants. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbab](https://github.com/achimbab)) -- Correction de la vérification si un hôte client est autorisé en faisant correspondre l'hôte client à `host_regexp` spécifié dans `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) -- Relax colonne ambiguë vérifier qui conduit à des faux positifs dans plusieurs `JOIN ON` section. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction possible plantage du serveur (`std::terminate`) lorsque le serveur ne peut pas envoyer ou écrire des données `JSON` ou `XML` format avec les valeurs de `String` type de données (qui nécessitent `UTF-8` validation) ou lors de la compression des données de résultat avec l'algorithme Brotli ou dans certains autres cas rares. Cela corrige [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la condition de course dans `StorageDistributedDirectoryMonitor` trouvé par CI. Cela corrige [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Maintenant fond fusionne dans `*MergeTree` la famille des moteurs de table préserve l'ordre de volume de la Politique de stockage avec plus de précision. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Maintenant moteur de table `Kafka` fonctionne correctement avec `Native` format. Cela corrige [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -- Formats fixes avec des en-têtes (comme `CSVWithNames`) qui lançaient une exception sur EOF pour le moteur de table `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -- Correction d'un bug avec making set from subquery dans la partie droite de `IN` section. Cela corrige [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) et [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Correction d'un crash possible lors de la lecture à partir du stockage `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction de la lecture des fichiers en `Parquet` format contenant des colonnes de type `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([maxulan](https://github.com/maxulan)) -- Correction d'erreur `Not found column` pour les requêtes distribuées avec `PREWHERE` condition dépendant de la clé d'échantillonnage si `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'erreur `Not found column` si la requête utilisée `PREWHERE` dépendant de l'alias de la table et le jeu de résultats était vide en raison de la condition de clé primaire. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Type de retour fixe pour les fonctions `rand` et `randConstant` en cas de `Nullable` argument. Maintenant renvoient toujours `UInt32` et jamais `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Désactivé prédicat-poussoir vers le bas pour `WITH FILL` expression. Cela corrige [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Fixe incorrect `count()` résultat `SummingMergeTree` lorsque `FINAL` la section est utilisée. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Correction d'un résultat incorrect possible pour les fonctions constantes à partir de serveurs distants. C'est arrivé pour les requêtes avec des fonctions comme `version()`, `uptime()`, etc. qui renvoie différentes valeurs constantes pour différents serveurs. Cela corrige [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'un bug compliqué dans l'optimisation des prédicats push-down qui conduit à de mauvais résultats. Cela résout beaucoup de problèmes sur l'optimisation des prédicats push-down. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Correction d'un crash dans l' `CREATE TABLE .. AS dictionary` requête. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) -- Plusieurs améliorations grammaire ClickHouse dans `.g4` fichier. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) -- Correction d'un bug qui conduit à des plantages dans `JOIN`s avec tables avec moteur `Join`. Cela corrige [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) -- Corriger les dictionnaires redondants recharger sur `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) -- Limiter le nombre maximum de flux pour lire à partir `StorageFile` et `StorageHDFS`. Corrections https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug dans `ALTER ... MODIFY ... CODEC` requête, lorsque l'utilisateur spécifie à la fois l'expression par défaut et le codec. Fixer [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alésapine](https://github.com/alesapin)) -- Correction d'une erreur dans la fusion en arrière-plan des colonnes avec `SimpleAggregateFunction(LowCardinality)` type. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fonction d'enregistrement de type fixe `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) -- Maintenant le serveur ne plante pas `LEFT` ou `FULL JOIN` avec et Rejoindre moteur et non pris en charge `join_use_nulls` paramètre. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) -- Maintenant `DROP DICTIONARY IF EXISTS db.dict` la requête ne lance pas d'exception si `db` n'existe pas. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- Correction des plantages possibles dans les fonctions de la table (`file`, `mysql`, `remote`) causés par l'utilisation de la référence à enlever `IStorage` objet. Correction d'une analyse incorrecte des colonnes spécifiées lors de l'insertion dans la fonction de table. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) -- S'assurer du réseau avant de démarrer `clickhouse-server`. Cela corrige [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) -- Correction de la gestion des délais d'attente pour les connexions sécurisées, de sorte que les requêtes ne se bloquent pas indéfiniment. Cela corrige [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer `clickhouse-copier`conflit redondant entre les travailleurs concurrents. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- Maintenant, les mutations ne sautent pas les parties attachées, même si leur version de mutation était plus grande que la version de mutation actuelle. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alésapine](https://github.com/alesapin)) -- Ignorer les copies redondantes de `*MergeTree` les parties de données après le déplacement vers un autre disque et le redémarrage du serveur. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction d'un crash dans l' `FULL JOIN` avec `LowCardinality` dans `JOIN` clé. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) -- Interdit d'utiliser le nom de colonne plus d'une fois dans insert query comme `INSERT INTO tbl (x, y, x)`. Cela corrige [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alésapine](https://github.com/alesapin)) -- Ajout de secours pour la détection du nombre de cœurs de processeur physiques pour les processeurs inconnus (en utilisant le nombre de cœurs de processeur logiques). Cela corrige [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer `There's no column` erreur pour les colonnes matérialisées et alias. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction d'un crash sever lorsque `EXISTS` la requête a été utilisé sans `TABLE` ou `DICTIONARY` qualificatif. Tout comme `EXISTS t`. Cela corrige [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). Ce bug a été introduit dans la version 19.17. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un bug rare avec erreur `"Sizes of columns doesn't match"` qui pourraient apparaître lors de l'utilisation `SimpleAggregateFunction` colonne. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- Correction d'un bug où l'utilisateur avec vide `allow_databases` vous avez accès à toutes les bases de données (et même pour `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) -- Correction du crash du client lorsque le serveur est déjà déconnecté du client. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- Fixer `ORDER BY` comportement en cas de tri par préfixe de clé primaire et Suffixe de clé non primaire. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) -- Vérifiez si la colonne qualifiée est présente dans le tableau. Cela corrige [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) -- Correction du comportement avec `ALTER MOVE` exécuté immédiatement après la fin de la fusion se déplace superpart De spécifié. Fixer [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction d'un crash possible du serveur lors de l'utilisation `UNION` avec un nombre différent de colonnes. Fixer [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fixer la taille de résultat pour la fonction substring `substr` avec une taille négative. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Maintenant le serveur n'exécute pas la mutation partielle dans `MergeTree` s'il n'y a pas assez de threads libres dans le pool d'arrière-plan. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) -- Correction d'une faute de frappe mineure sur le formatage `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) -- Correction des résultats incorrects du filtre bloom pour les nombres négatifs. Cela corrige [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Dépassement de tampon potentiel fixe en décompression. Un utilisateur malveillant peut transmettre des données compressées fabriquées qui provoqueront une lecture après le tampon. Ce problème a été trouvé par Eldar Zaitov de l'équipe de sécurité de L'information Yandex. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction d'un résultat incorrect en raison du débordement d'entiers dans `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Maintenant `OPTIMIZE TABLE` query n'attendra pas les répliques hors ligne pour effectuer l'opération. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) -- Fixe `ALTER TTL` analyseur pour `Replicated*MergeTree` table. [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction de la communication entre le serveur et le client, afin que le serveur lise les informations des tables temporaires après l'échec de la requête. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- Fixer `bitmapAnd` erreur de fonction lors de l'intersection d'un bitmap agrégé et d'un bitmap scalaire. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -- Affiner la définition de `ZXid` selon le Guide du programmeur ZooKeeper qui corrige un bug dans `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- `odbc` fonction de table respecte maintenant `external_table_functions_use_nulls` paramètre. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) -- Correction d'un bug qui conduisait à une course de données rare. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -- Maintenant `SYSTEM RELOAD DICTIONARY` recharge complètement un dictionnaire, en ignorant `update_field`. Cela corrige [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ajouter la possibilité de vérifier si le dictionnaire existe dans create query. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alésapine](https://github.com/alesapin)) -- Fixer `Float*` l'analyse en `Values` format. Cela corrige [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un crash lorsque nous ne pouvons pas réserver d'espace dans certaines opérations en arrière-plan de `*MergeTree` famille de moteurs de table. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Correction du crash de l'opération de fusion lorsque la table contient `SimpleAggregateFunction(LowCardinality)` colonne. Cela corrige [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) -- Restaurez la prise en charge de toutes les locales ICU et ajoutez la possibilité d'appliquer des collations pour les expressions constantes. Ajoutez également le nom de la langue à `system.collations` table. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alésapine](https://github.com/alesapin)) -- Correction d'un bug lorsque les dictionnaires externes avec zéro durée de vie minimale (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) ne pas mettre à jour en arrière-plan. [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alésapine](https://github.com/alesapin)) -- Correction d'un crash lorsque le dictionnaire externe avec la source de ClickHouse a une sous-requête dans la requête. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Correction d'une analyse incorrecte de l'extension de fichier dans la table avec le moteur `URL`. Cela corrige [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) -- Fixer `CHECK TABLE` requête pour `*MergeTree` les tables sans clé. Fixer [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alésapine](https://github.com/alesapin)) -- De conversion fixe de `Float64` au type MySQL. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) -- Maintenant, si la table n'a pas été complètement abandonnée en raison d'un plantage du serveur, le serveur va essayer de la restaurer et de la charger. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- Correction d'un crash dans la fonction de table `file` lors de l'insertion dans le fichier qui n'existe pas. Maintenant, dans ce cas, le fichier sera créé et insérez seraient traités. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- Correction de l'impasse rare qui peut arriver quand `trace_log` est activé. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- Ajouter la possibilité de travailler avec différents types en outre `Date` dans `RangeHashed` dictionnaire externe créé à partir de la requête DDL. Fixer [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alésapine](https://github.com/alesapin)) -- Correction d'un crash lorsque `now64()` est appelé avec un résultat d'une autre fonction. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) -- Correction d'un bug avec la détection de l'adresse IP du client pour les connexions via le protocole de fil mysql. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) -- Correction de la gestion du tableau vide dans `arraySplit` fonction. Cela corrige [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) -- Correction du problème lorsque `pid-file` d'un autre cours d'exécution `clickhouse-server` peut être supprimée. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) -- Correction du rechargement du dictionnaire s'il a `invalidate_query`, qui a arrêté les mises à jour et une exception sur les tentatives de mise à jour précédentes. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alésapine](https://github.com/alesapin)) -- Correction d'une erreur dans la fonction `arrayReduce` qui peut conduire à “double free” et erreur dans le combinateur de fonction d'agrégat `Resample` que peut provoquer la fuite de mémoire. Fonction agrégée ajoutée `aggThrow`. Cette fonction peut être utilisée à des fins de test. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Amélioration {#improvement-1} - -- Amélioration de la journalisation lorsque vous travaillez avec `S3` tableau moteur. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- Imprimé message d'aide quand aucun argument n'est passé lors de l'appel `clickhouse-local`. Cela corrige [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) -- Ajouter un paramètre `mutations_sync` ce qui permet d'attendre `ALTER UPDATE/DELETE` les requêtes de manière synchrone. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alésapine](https://github.com/alesapin)) -- Autoriser à configurer relative `user_files_path` dans `config.xml` (de la manière similaire à `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) -- Ajouter une exception pour les types illégaux pour les fonctions de conversion avec `-OrZero` postfix. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) -- Simplifier le format de l'en-tête de l'envoi des données à un serveur dans une requête distribuée. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) -- `Live View` refactoring du moteur de table. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) -- Ajoutez des vérifications supplémentaires pour les dictionnaires externes créés à partir de requêtes DDL. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alésapine](https://github.com/alesapin)) -- Correction d'erreur `Column ... already exists` lors de l'utilisation `FINAL` et `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Fixer [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Table maintenant le premier argument de `joinGet` la fonction peut être tableau identifiant. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos Oiseau](https://github.com/amosbird)) -- Autoriser l'utilisation des `MaterializedView` avec les sous-requêtes ci-dessus `Kafka` table. [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) -- Maintenant, l'arrière-plan se déplace entre les disques, exécutez le pool de threads seprate. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) -- `SYSTEM RELOAD DICTIONARY` s'exécute maintenant de manière synchrone. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) -- Les traces de pile affichent désormais des adresses physiques (décalages dans le fichier objet) au lieu des adresses de mémoire virtuelle (où le fichier objet a été chargé). Qui permet l'utilisation de `addr2line` lorsque binaire est indépendant de la position et ASLR est actif. Cela corrige [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Appuyer une nouvelle syntaxe pour la sécurité de niveau ligne filtres: `
`. Fixer [\#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [\#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([Ivan](https://github.com/abyss7)) -- Maintenant `cityHash` fonction peut travailler avec `Decimal` et `UUID` type. Fixer [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) -- Suppression de la granularité à index fixe (c'était 1024) des journaux système car elle est obsolète après l'implémentation de la granularité adaptative. [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Serveur de compatibilité MySQL activé lorsque ClickHouse est compilé sans SSL. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) -- Maintenant, les sommes de contrôle du serveur ont distribué des lots, ce qui donne des erreurs plus verbeuses en cas de données corrompues dans le lot. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) -- Soutien `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` et `ATTACH TABLE` pour `MySQL` moteur de base de données. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([L'Hiver Zhang](https://github.com/zhang2014)) -- Ajouter l'authentification dans la fonction de table S3 et le moteur de table. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Ajout de vérifier les pièces supplémentaires de `MergeTree` sur différents disques, afin de ne pas permettre de manquer des parties de données sur des disques indéfinis. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Activez la prise en charge SSL pour le client et le serveur Mac. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([Ivan](https://github.com/abyss7)) -- Maintenant, ClickHouse peut fonctionner en tant que serveur fédéré MySQL (voir https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- `clickhouse-client` maintenant seulement activer `bracketed-paste` lorsque multiquery est activé et multiline est désactivé. Cette correction (\#7757)\[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos Oiseau](https://github.com/amosbird)) -- Soutien `Array(Decimal)` dans `if` fonction. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) -- Soutien Décimales `arrayDifference`, `arrayCumSum` et `arrayCumSumNegative` fonction. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) -- Ajouter `lifetime` colonne de `system.dictionaries` table. [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) -- Vérification améliorée des pièces existantes sur différents disques pour `*MergeTree` table des moteurs. Adresse [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) -- L'intégration avec `AWS SDK` pour `S3` interactions qui permet d'utiliser toutes les fonctionnalités S3 hors de la boîte. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) -- Ajout du support pour les sous-requêtes dans `Live View` table. [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) -- Vérifier à l'aide de `Date` ou `DateTime` colonne de `TTL` des expressions a été supprimé. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Informations sur le disque ajouté `system.detached_parts` table. [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Maintenant paramètres `max_(table|partition)_size_to_drop` peut être modifié sans redémarrage de l'ordinateur. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- Facilité d'utilisation légèrement meilleure des messages d'erreur. Demander à l'utilisateur de ne pas supprimer les lignes ci-dessous `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mieux lire les messages de `Kafka` moteur dans différents formats après [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([Ivan](https://github.com/abyss7)) -- Meilleure compatibilité avec les clients MySQL qui ne prennent pas en charge `sha2_password` greffon auth. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) -- Supporte plus de types de colonnes dans le serveur de compatibilité MySQL. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) -- Mettre `ORDER BY` optimisation pour les `Merge`, `Buffer` et `Materilized View` stockages avec sous-jacent `MergeTree` table. [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) -- Maintenant, nous utilisons toujours L'implémentation POSIX de `getrandom` pour avoir une meilleure compatibilité avec les anciens noyaux (\< 3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos Oiseau](https://github.com/amosbird)) -- Mieux vaut vérifier la destination valide dans une règle de déplacement TTL. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Mieux vérifie cassé insérer des lots pour `Distributed` tableau moteur. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) -- Ajouter une colonne avec un tableau de nom de pièces que les mutations doivent traiter à l'avenir `system.mutations` table. [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alésapine](https://github.com/alesapin)) -- Optimisation de tri de fusion parallèle pour les processeurs. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Paramètre `mark_cache_min_lifetime` est maintenant obsolète et ne fait rien. Dans les versions précédentes, mark cache peut croître en mémoire supérieure à `mark_cache_size` pour accommoder les données dans `mark_cache_min_lifetime` deuxième. Cela conduisait à la confusion et à une utilisation de la mémoire plus élevée que prévu, ce qui est particulièrement mauvais sur les systèmes à contraintes de mémoire. Si vous constatez une dégradation des performances après l'installation de cette version, vous devez `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Préparation à utiliser `tid` partout. Cela est nécessaire pour [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -#### Amélioration Des Performances {#performance-improvement-1} - -- Optimisations des performances dans le pipeline de processeurs. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Mises à jour non bloquantes des clés expirées dans les dictionnaires de cache (avec autorisation de lire les anciennes). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Compiler ClickHouse sans `-fno-omit-frame-pointer` globalement pour épargner un registre de plus. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos Oiseau](https://github.com/amosbird)) -- SpeedUp `greatCircleDistance` fonction et ajouter des tests de performance pour elle. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) -- Amélioration des performances de la fonction `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Amélioration des performances de `max`, `min`, `argMin`, `argMax` pour `DateTime64` type de données. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) -- Amélioration des performances de tri sans limite ou avec une grande limite et le tri externe. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Amélioration des performances du formatage des nombres à virgule flottante jusqu'à 6 fois. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Amélioration des performances de `modulo` fonction. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos Oiseau](https://github.com/amosbird)) -- Optimisé `ORDER BY` et la fusion avec une seule clé de colonne. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Meilleure mise en œuvre pour `arrayReduce`, `-Array` et `-State` combinators. [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos Oiseau](https://github.com/amosbird)) -- Maintenant `PREWHERE` doit être optimisé pour être au moins aussi efficace que l' `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos Oiseau](https://github.com/amosbird)) -- Améliorer la façon dont `round` et `roundBankers` manipulation des nombres négatifs. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) -- Amélioration des performances de décodage `DoubleDelta` et `Gorilla` les codecs par environ de 30 à 40%. Cela corrige [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) -- Amélioration des performances de `base64` les fonctions connexes. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajout d'une fonction `geoDistance`. Il est similaire à `greatCircleDistance` mais utilise l'approximation au modèle ellipsoïde WGS-84. Les performances des deux fonctions sont presque les mêmes. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Plus rapide `min` et `max` fonctions d'agrégation pour les `Decimal` type de données. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) -- Vectoriser le traitement `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Oiseau](https://github.com/amosbird)) -- `if` les chaînes sont maintenant optimisés `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) -- Correction de la régression des performances de `Kafka` moteur de table introduit en 19.15. Cela corrige [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) -- Retiré “pie” génération de code qui `gcc` de paquets Debian apporte parfois par défaut. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Formats de données d'analyse parallèle [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Activer l'analyseur optimisé de `Values` avec des expressions par défaut (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) - -#### Construction / Test / Amélioration De L'Emballage {#buildtestingpackaging-improvement-2} - -- Construire des correctifs pour `ARM` et en un minimum de mode. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) -- Ajouter le fichier de couverture flush pour `clickhouse-server` lorsque std::atexit n'est pas appelé. Également légèrement amélioré la journalisation dans les tests sans état avec la couverture. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alésapine](https://github.com/alesapin)) -- Mettre à jour la bibliothèque LLVM dans contrib. Évitez D'utiliser LLVM à partir de paquets OS. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Faire empaqueté `curl` construire entièrement calme. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) -- Correction de quelques `MemorySanitizer` avertissement. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Utiliser `add_warning` et `no_warning` les macros dans `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([Ivan](https://github.com/abyss7)) -- Ajout du support de l'objet compatible Minio S3 (https://min.io/) pour de meilleurs tests d'intégration. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) -- Importer `libc` en-têtes à contrib. Il permet de rendre les builds plus cohérents sur différents systèmes (uniquement pour `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer `-fPIC` à partir de certaines bibliothèques. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Propre `CMakeLists.txt` pour le roulage. Tu vois https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Avertissements silencieux dans `CapNProto` bibliothèque. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Ajouter des tests de performance pour les tables de hachage optimisées par chaîne courte. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos Oiseau](https://github.com/amosbird)) -- Maintenant ClickHouse va construire sur `AArch64` même si `MADV_FREE` n'est pas disponible. Cela corrige [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos Oiseau](https://github.com/amosbird)) -- Mettre `zlib-ng` pour résoudre les problèmes de désinfectant de mémoire. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Activez la bibliothèque MySQL interne sur un système non Linux, car l'utilisation des paquets du système D'exploitation est très fragile et ne fonctionne généralement pas du tout. Cela corrige [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la construction sur certains systèmes après activation `libc++`. Cela annule et remplace [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Faire `Field` méthodes plus de type-sûr pour trouver plus d'erreurs. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Ajout de fichiers manquants à la `libc-headers` sous-module. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Corrigé de mal `JSON` citation dans la sortie de test de performance. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Maintenant, la trace de pile est affichée pour `std::exception` et `Poco::Exception`. Dans les versions précédentes, il était disponible uniquement pour `DB::Exception`. Cela améliore le diagnostic. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Le portage `clock_gettime` et `clock_nanosleep` pour les nouvelles versions glibc. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos Oiseau](https://github.com/amosbird)) -- Permettre `part_log` dans l'exemple config pour les développeurs. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la nature asynchrone du rechargement dans `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) -- Tests de performance codec fixe. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) -- Ajouter des scripts d'installation pour `.tgz` construire et documentation pour eux. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alésapine](https://github.com/alesapin)) -- Supprimé Vieux `ZSTD` test (il a été créé en 2016 pour reproduire le bug que la version pré 1.0 de ZSTD a eu). Cela corrige [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction de la construction sur Mac OS Catalina. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) -- Augmentation du nombre de lignes dans les tests de performance du codec pour rendre les résultats visibles. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) -- Dans les versions debug, traiter `LOGICAL_ERROR` exceptions comme Échecs d'assertion, de sorte qu'ils sont plus faciles à remarquer. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Rendre le test de performance lié aux formats plus déterministe. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre `lz4` pour corriger un échec MemorySanitizer. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Supprimer un faux positif MemorySanitizer connu dans la gestion des exceptions. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Mettre `gcc` et `g++` à la version 9 dans `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) -- Ajoutez un cas de test de performance pour tester cela `PREWHERE` est pire que `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos Oiseau](https://github.com/amosbird)) -- Progrès vers la fixation d'un test flacky. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Évitez le rapport MemorySanitizer pour les données de `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Mettre `libc++` la dernière version. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Construire la bibliothèque ICU à partir de sources. Cela corrige [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Commutation de `libressl` de `openssl`. ClickHouse devrait prendre en charge TLS 1.3 et SNI après ce changement. Cela corrige [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Rapport UBSan fixe lors de l'utilisation `chacha20_poly1305` de SSL (se produit sur la connexion à https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Correction du mode de fichier de mot de passe par défaut pour `.deb` des distributions linux. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) -- Expression améliorée pour obtenir `clickhouse-server` PID dans `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) -- Mise à jour contrib / googletest à v1. 10. 0. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- Rapport ThreadSaninitizer fixe dans `base64` bibliothèque. Aussi mis à jour cette bibliothèque à la dernière version, mais cela n'a pas d'importance. Cela corrige [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Fixer `00600_replace_running_query` pour les transformateurs. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Supprimer le support pour `tcmalloc` faire `CMakeLists.txt` plus simple. [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Libérer gcc construit maintenant utiliser `libc++` plutôt `libstdc++`. Récemment `libc++` a été utilisé uniquement avec clang. Cela améliorera la cohérence des configurations de construction et la portabilité. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Activer la bibliothèque ICU pour construire avec MemorySanitizer. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Supprimer les avertissements de `CapNProto` bibliothèque. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Suppression de cas spéciaux de code pour `tcmalloc` parce que c'est plus pris en charge. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Dans la tâche de couverture CI, tuez le serveur gracieusement pour lui permettre d'enregistrer le rapport de couverture. Cela corrige les rapports de couverture incomplets que nous avons vus récemment. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alésapine](https://github.com/alesapin)) -- Tests de Performance pour tous les codecs contre `Float64` et `UInt64` valeur. [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) -- `termcap` est très obsolète et conduit à divers problèmes (F. G. manquant “up” cap et en écho `^J` au lieu de multi-ligne) . Faveur `terminfo` ou groupés `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos Oiseau](https://github.com/amosbird)) -- Fixer `test_storage_s3` test d'intégration. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Soutien `StorageFile(, null)` pour insérer un bloc dans un fichier de format donné sans écrire sur le disque. Ceci est requis pour les tests de performance. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos Oiseau](https://github.com/amosbird)) -- Argument supplémentaire en `--print-time` aux tests fonctionnels qui imprime le temps d'exécution par test. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ajouté assertions à `KeyCondition` lors de L'évaluation RPN. Cela corrigera l'avertissement de gcc-9. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Vider les options cmake dans les builds CI. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Ne générez pas d'informations de débogage pour certaines bibliothèques fat. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Faire `log_to_console.xml` connectez-vous toujours à stderr, que ce soit interactif ou non. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Suppression de certaines fonctionnalités inutilisées de `clickhouse-performance-test` outil. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Maintenant, nous allons également rechercher `lld-X` avec correspondant `clang-X` version. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alésapine](https://github.com/alesapin)) -- Amélioration de construction de Parquet. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([maxulan](https://github.com/maxulan)) -- Plus D'Avertissements GCC [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Package pour Arch Linux permet maintenant d'exécuter le serveur ClickHouse, et pas seulement le client. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Fixer le test avec les processeurs. Corrections de performances minuscules. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Mise à jour contrib/protobuf. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) -- En préparation du passage à c++20 comme une célébration du Nouvel An. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos Oiseau](https://github.com/amosbird)) - -#### Caractéristique Expérimentale {#experimental-feature-1} - -- Ajouté cadre expérimental `min_bytes_to_use_mmap_io`. Il permet de lire de gros fichiers sans copier les données du noyau vers l'espace utilisateur. Le paramètre est désactivé par défaut. Le seuil recommandé est d'environ 64 Mo, car mmap / munmap est lent. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexeï-milovidov](https://github.com/alexey-milovidov)) -- Quotas retravaillés dans le cadre du système de contrôle d'accès. Ajouté nouveau tableau `system.quotas` de nouvelles fonctions `currentQuota`, `currentQuotaKey`, nouvelle syntaxe SQL `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) -- Autoriser à sauter des paramètres inconnus avec des avertissements au lieu de lancer des exceptions. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) -- Stratégies de ligne retravaillées dans le cadre du système de contrôle d'accès. Ajouté nouveau tableau `system.row_policies`, nouvelle fonction `currentRowPolicies()`, nouvelle syntaxe SQL `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Correction De Sécurité {#security-fix} - -- Correction de la possibilité de lire la structure des répertoires dans les tables avec `File` tableau moteur. Cela corrige [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexeï-milovidov](https://github.com/alexey-milovidov)) - -## [Changelog pour 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/fr/whats_new/roadmap.md b/docs/fr/whats_new/roadmap.md deleted file mode 100644 index af1b904ca36..00000000000 --- a/docs/fr/whats_new/roadmap.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 74 -toc_title: Feuille de route ---- - -# Feuille de route {#roadmap} - -## Q1 2020 {#q1-2020} - -- Contrôle d'accès par rôle - -## Q2 2020 {#q2-2020} - -- Intégration avec les services d'authentification externes -- Pools de ressources pour une répartition plus précise de la capacité du cluster entre les utilisateurs - -{## [Article Original](https://clickhouse.tech/docs/en/roadmap/) ##} diff --git a/docs/fr/whats_new/security_changelog.md b/docs/fr/whats_new/security_changelog.md deleted file mode 100644 index c5c7a5ec4f8..00000000000 --- a/docs/fr/whats_new/security_changelog.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: f865c9653f9df092694258e0ccdd733c339112f5 -toc_priority: 76 -toc_title: "S\xE9curit\xE9 Changelog" ---- - -## Correction dans la version 19.14.3.3 de ClickHouse, 2019-09-10 {#fixed-in-clickhouse-release-19-14-3-3-2019-09-10} - -### CVE-2019-15024 {#cve-2019-15024} - -Аn attacker that has write access to ZooKeeper and who ican run a custom server available from the network where ClickHouse runs, can create a custom-built malicious server that will act as a ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from the malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. - -Crédits: Eldar Zaitov de L'équipe de sécurité de L'Information Yandex - -### CVE-2019-16535 {#cve-2019-16535} - -Аn OOB read, OOB write and integer underflow in decompression algorithms can be used to achieve RCE or DoS via native protocol. - -Crédits: Eldar Zaitov de L'équipe de sécurité de L'Information Yandex - -### CVE-2019-16536 {#cve-2019-16536} - -Le débordement de pile menant à DoS peut être déclenché par un client authentifié malveillant. - -Crédits: Eldar Zaitov de L'équipe de sécurité de L'Information Yandex - -## Correction de la version 19.13.6.1 de ClickHouse, 2019-09-20 {#fixed-in-clickhouse-release-19-13-6-1-2019-09-20} - -### CVE-2019-18657 {#cve-2019-18657} - -Fonction de Table `url` la vulnérabilité avait-elle permis à l'attaquant d'injecter des en-têtes HTTP arbitraires dans la requête. - -Crédit: [Nikita Tikhomirov](https://github.com/NSTikhomirov) - -## Correction dans la version ClickHouse 18.12.13, 2018-09-10 {#fixed-in-clickhouse-release-18-12-13-2018-09-10} - -### CVE-2018-14672 {#cve-2018-14672} - -Les fonctions de chargement des modèles CatBoost permettaient de parcourir les chemins et de lire des fichiers arbitraires via des messages d'erreur. - -Crédits: Andrey Krasichkov de L'équipe de sécurité de L'Information Yandex - -## Correction dans la version 18.10.3 de ClickHouse, 2018-08-13 {#fixed-in-clickhouse-release-18-10-3-2018-08-13} - -### CVE-2018-14671 {#cve-2018-14671} - -unixODBC a permis de charger des objets partagés arbitraires à partir du système de fichiers, ce qui a conduit à une vulnérabilité D'exécution de Code À Distance. - -Crédits: Andrey Krasichkov et Evgeny Sidorov de Yandex Information Security Team - -## Correction dans la version 1.1.54388 de ClickHouse, 2018-06-28 {#fixed-in-clickhouse-release-1-1-54388-2018-06-28} - -### CVE-2018-14668 {#cve-2018-14668} - -“remote” la fonction de table a permis des symboles arbitraires dans “user”, “password” et “default\_database” champs qui ont conduit à des attaques de falsification de requêtes inter-protocoles. - -Crédits: Andrey Krasichkov de L'équipe de sécurité de L'Information Yandex - -## Correction dans la version 1.1.54390 de ClickHouse, 2018-07-06 {#fixed-in-clickhouse-release-1-1-54390-2018-07-06} - -### CVE-2018-14669 {#cve-2018-14669} - -Clickhouse client MySQL avait “LOAD DATA LOCAL INFILE” fonctionnalité activée permettant à une base de données MySQL malveillante de lire des fichiers arbitraires à partir du serveur clickhouse connecté. - -Crédits: Andrey Krasichkov et Evgeny Sidorov de Yandex Information Security Team - -## Correction dans la version 1.1.54131 de ClickHouse, 2017-01-10 {#fixed-in-clickhouse-release-1-1-54131-2017-01-10} - -### CVE-2018-14670 {#cve-2018-14670} - -Configuration incorrecte dans le paquet deb pourrait conduire à l'utilisation non autorisée de la base de données. - -Crédits: National Cyber Security Centre (NCSC) - -{## [Article Original](https://clickhouse.tech/docs/en/security_changelog/) ##} diff --git a/docs/ja/commercial/cloud.md b/docs/ja/commercial/cloud.md index 6510c9d3aac..e98d24bb528 100644 --- a/docs/ja/commercial/cloud.md +++ b/docs/ja/commercial/cloud.md @@ -12,7 +12,7 @@ machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 [Yandex管理サービスClickHouse](https://cloud.yandex.com/services/managed-clickhouse?utm_source=referrals&utm_medium=clickhouseofficialsite&utm_campaign=link3) 次の主な機能を提供します: -- 完全に管理されたzookeeperサービス [ClickHouse複製](../engines/table_engines/mergetree_family/replication.md) +- 完全に管理されたzookeeperサービス [ClickHouse複製](../engines/table-engines/mergetree-family/replication.md) - 複数ストレージタイプの選択 - 異なる可用性ゾーンのレプリカ - 暗号化と分離 diff --git a/docs/ja/development/architecture.md b/docs/ja/development/architecture.md index 9d446212905..e0f80efdf2b 100644 --- a/docs/ja/development/architecture.md +++ b/docs/ja/development/architecture.md @@ -120,9 +120,9 @@ Read/WriteBuffersはバイトのみを処理します。 からの機能があ 通常の関数と集約関数があります。 集計関数は、次のセクションを参照してください。 -Ordinary functions don't change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`ベクトル化されたクエリ実行を実装するためのデータです。 +Ordinary functions don’t change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`ベクトル化されたクエリ実行を実装するためのデータです。 -いくつかの雑多な機能があります [ブロックサイズ](../sql_reference/functions/other_functions.md#function-blocksize), [rowNumberInBlock](../sql_reference/functions/other_functions.md#function-rownumberinblock)、と [runningAccumulate](../sql_reference/functions/other_functions.md#function-runningaccumulate)、それはブロック処理を悪用し、行の独立性に違反します。 +いくつかの雑多な機能があります [ブロックサイズ](../sql-reference/functions/other-functions.md#function-blocksize), [rowNumberInBlock](../sql-reference/functions/other-functions.md#function-rownumberinblock)、と [runningAccumulate](../sql-reference/functions/other-functions.md#function-runningaccumulate)、それはブロック処理を悪用し、行の独立性に違反します。 ClickHouseには厳密な型指定があるため、暗黙の型変換はありません。 関数が型の特定の組み合わせをサポートしていない場合は、例外がスローされます。 ものの機能で作業する過負荷のもとに多くの異なる組み合わせます。 たとえば、 `plus` 機能(実装するには `+` 演算子)数値型の任意の組み合わせに対して機能します: `UInt8` + `Float32`, `UInt16` + `Int8`、というように。 また、いくつかの可変個引数関数は、任意の数の引数を受け入れることができます。 `concat` 機能。 @@ -177,7 +177,7 @@ INまたはJOIN節にサブクエリがあり、それぞれがaを使用する ときあなた `INSERT` データの束に `MergeTree` その束は主キーの順序でソートされ、新しい部分を形成します。 が背景のスレッドを定期的に、選択部分と統合して単一のソート部の部品点数が比較的低い。 それが呼び出される理由です `MergeTree`. もちろん、マージにつながる “write amplification”. すべての部分は不変です:作成され、削除されますが、変更されません。 SELECTが実行されると、テーブル(部品のセット)のスナップショットが保持されます。 マージした後、我々はまた、我々はいくつかのマージされた部分は、おそらく壊れていることを確認した場合、我々は、そのソース部分とそれを置き換えることがで -`MergeTree` LSMツリーが含まれていないためではありません “memtable” と “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity's sake, and because we are already inserting data in batches in our applications. +`MergeTree` LSMツリーが含まれていないためではありません “memtable” と “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity’s sake, and because we are already inserting data in batches in our applications. > MergeTreeテーブルには、一つの(プライマリ)インデックスしか持たせることができません。 たとえば、データを複数の物理的順序で格納したり、元のデータとともに事前に集計されたデータを使用して表現することもできます。 diff --git a/docs/ja/development/browse_code.md b/docs/ja/development/browse-code.md similarity index 100% rename from docs/ja/development/browse_code.md rename to docs/ja/development/browse-code.md diff --git a/docs/ja/development/build_cross_arm.md b/docs/ja/development/build-cross-arm.md similarity index 100% rename from docs/ja/development/build_cross_arm.md rename to docs/ja/development/build-cross-arm.md diff --git a/docs/ja/development/build-cross-osx.md b/docs/ja/development/build-cross-osx.md new file mode 100644 index 00000000000..81a94b65dee --- /dev/null +++ b/docs/ja/development/build-cross-osx.md @@ -0,0 +1,65 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 66 +toc_title: "Mac OS X\u7528\u306ELinux\u3067ClickHouse\u3092\u69CB\u7BC9\u3059\u308B\ + \u65B9\u6CD5" +--- + +# Mac OS X用のLinuxでClickHouseを構築する方法 {#how-to-build-clickhouse-on-linux-for-mac-os-x} + +これは、linuxマシンがあり、それを使ってビルドしたい場合のためのものです `clickhouse` OS X上で実行されるバイナリこれは、Linuxサーバー上で実行される継続的な統合チェックを目的としています。 Mac OS XでClickHouseを直接ビルドする場合は、次の手順に進んでください [別の命令](build-osx.md). + +Mac OS X用のクロスビルドは、以下に基づいています。 [ビルド手順](build.md)、最初にそれらに続きなさい。 + +# インストールclang-8 {#install-clang-8} + +以下の指示に従ってくださいhttps://apt.llvm.org/あなたのubuntuやdebianの設定のために. +例えば、コマンドバイオニックのような: + +``` bash +sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list +sudo apt-get install clang-8 +``` + +# クロスコンパイルツールセット {#install-cross-compilation-toolset} + +いっしょうにパスを設置 `cctools` として${CCTOOLS} + +``` bash +mkdir ${CCTOOLS} + +git clone https://github.com/tpoechtrager/apple-libtapi.git +cd apple-libtapi +INSTALLPREFIX=${CCTOOLS} ./build.sh +./install.sh +cd .. + +git clone https://github.com/tpoechtrager/cctools-port.git +cd cctools-port/cctools +./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin +make install +``` + +また、macos x sdkを作業ツリーにダウンロードする必要があります。 + +``` bash +cd ClickHouse +wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' +mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 +tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 +``` + +# クリックハウスを構築 {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-osx +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ + -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ + -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ + -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld +ninja -C build-osx +``` + +結果のバイナリはmach-o実行可能フォーマットを持ち、linuxでは実行できません。 diff --git a/docs/ja/development/build_osx.md b/docs/ja/development/build-osx.md similarity index 100% rename from docs/ja/development/build_osx.md rename to docs/ja/development/build-osx.md diff --git a/docs/ja/development/build_cross_osx.md b/docs/ja/development/build_cross_osx.md deleted file mode 100644 index cdbee0e7a61..00000000000 --- a/docs/ja/development/build_cross_osx.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 66 -toc_title: "Mac OS X\u7528\u306ELinux\u3067ClickHouse\u3092\u69CB\u7BC9\u3059\u308B\ - \u65B9\u6CD5" ---- - -# Mac OS X用のLinuxでClickHouseを構築する方法 {#how-to-build-clickhouse-on-linux-for-mac-os-x} - -これは、linuxマシンがあり、それを使ってビルドしたい場合のためのものです `clickhouse` OS X上で実行されるバイナリこれは、Linuxサーバー上で実行される継続的な統合チェックを目的としています。 Mac OS XでClickHouseを直接ビルドする場合は、次の手順に進んでください [別の命令](build_osx.md). - -Mac OS X用のクロスビルドは、以下に基づいています。 [ビルド手順](build.md)、最初にそれらに続きなさい。 - -# インストールclang-8 {#install-clang-8} - -以下の指示に従ってくださいhttps://apt.llvm.org/あなたのubuntuやdebianの設定のために. -例えば、コマンドバイオニックのような: - -``` bash -sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list -sudo apt-get install clang-8 -``` - -# クロスコンパイルツールセット {#install-cross-compilation-toolset} - -いっしょうにパスを設置 `cctools` として${CCTOOLS} - -``` bash -mkdir ${CCTOOLS} - -git clone https://github.com/tpoechtrager/apple-libtapi.git -cd apple-libtapi -INSTALLPREFIX=${CCTOOLS} ./build.sh -./install.sh -cd .. - -git clone https://github.com/tpoechtrager/cctools-port.git -cd cctools-port/cctools -./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin -make install -``` - -また、macos x sdkを作業ツリーにダウンロードする必要があります。 - -``` bash -cd ClickHouse -wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' -mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 -tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 -``` - -# クリックハウスを構築 {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-osx -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ - -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ - -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ - -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -ninja -C build-osx -``` - -結果のバイナリはmach-o実行可能フォーマットを持ち、linuxでは実行できません。 diff --git a/docs/ja/development/developer_instruction.md b/docs/ja/development/developer-instruction.md similarity index 100% rename from docs/ja/development/developer_instruction.md rename to docs/ja/development/developer-instruction.md diff --git a/docs/ja/development/style.md b/docs/ja/development/style.md index 93e4d8972aa..9980570ed37 100644 --- a/docs/ja/development/style.md +++ b/docs/ja/development/style.md @@ -211,7 +211,7 @@ for (Names::const_iterator it = column_names.begin(); it != column_names.end(); **1.** コードのすべての非自明な部分にコメントを追加してください。 -これは非常に重要です。 書面でのコメントだけを更新したいのですが--このコードに必要な、又は間違っています。 +これは非常に重要です。 書面でのコメントだけを更新したいのですが–このコードに必要な、又は間違っています。 ``` cpp /** Part of piece of memory, that can be used. diff --git a/docs/ja/development/tests.md b/docs/ja/development/tests.md index b6c5abea621..9abdc0595cd 100644 --- a/docs/ja/development/tests.md +++ b/docs/ja/development/tests.md @@ -30,7 +30,7 @@ toc_title: "ClickHouse\u30C6\u30B9\u30C8\u3092\u5B9F\u884C\u3059\u308B\u65B9\u6C いくつかのテストは `zookeeper`, `shard` または `long` 彼らの名前で。 `zookeeper` ZooKeeperを使用しているテストのためのものです。 `shard` そのテストのためです サーバーのリッスンが必要 `127.0.0.*`; `distributed` または `global` 同じを持っている -意味は... `long` 少し長く走るテストのためのものです。 あなたはできる +意味は… `long` 少し長く走るテストのためのものです。 あなたはできる 次のテストグループを無効にする `--no-zookeeper`, `--no-shard` と `--no-long` オプション、それぞれ。 diff --git a/docs/ja/engines/database-engines/index.md b/docs/ja/engines/database-engines/index.md new file mode 100644 index 00000000000..f895dae3bd6 --- /dev/null +++ b/docs/ja/engines/database-engines/index.md @@ -0,0 +1,21 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Database Engines +toc_priority: 27 +toc_title: "\u5C0E\u5165" +--- + +# データベース {#database-engines} + +データベースエンジンできる仕事です。 + +既定では、clickhouseはネイティブのデータベースエンジンを使用します。 [表エンジン](../../engines/table-engines/index.md) と [SQLダイアレクト](../../sql-reference/syntax.md). + +次のデータベースエンジンも使用できます: + +- [MySQL](mysql.md) + +- [怠け者](lazy.md) + +[元の記事](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/ja/engines/database_engines/lazy.md b/docs/ja/engines/database-engines/lazy.md similarity index 100% rename from docs/ja/engines/database_engines/lazy.md rename to docs/ja/engines/database-engines/lazy.md diff --git a/docs/ja/engines/database-engines/mysql.md b/docs/ja/engines/database-engines/mysql.md new file mode 100644 index 00000000000..f4c6c6bfb3e --- /dev/null +++ b/docs/ja/engines/database-engines/mysql.md @@ -0,0 +1,135 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 30 +toc_title: MySQL +--- + +# Mysql {#mysql} + +リモートmysqlサーバー上のデータベースに接続し、 `INSERT` と `SELECT` ClickHouseとMySQLの間でデータを交換するためのクエリ。 + +その `MySQL` データベースエンジンの翻訳のクエリのMySQLサーバーでの操作を行うことができなど `SHOW TABLES` または `SHOW CREATE TABLE`. + +次のクエリは実行できません: + +- `RENAME` +- `CREATE TABLE` +- `ALTER` + +## データベースの作成 {#creating-a-database} + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] +ENGINE = MySQL('host:port', 'database', 'user', 'password') +``` + +**エンジン変数** + +- `host:port` — MySQL server address. +- `database` — Remote database name. +- `user` — MySQL user. +- `password` — User password. + +## データ型のサポート {#data_types-support} + +| MySQL | クリックハウス | +|----------------------------------|--------------------------------------------------------------| +| UNSIGNED TINYINT | [UInt8](../../sql-reference/data-types/int-uint.md) | +| TINYINT | [Int8](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED SMALLINT | [UInt16](../../sql-reference/data-types/int-uint.md) | +| SMALLINT | [Int16](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql-reference/data-types/int-uint.md) | +| INT, MEDIUMINT | [Int32](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED BIGINT | [UInt64](../../sql-reference/data-types/int-uint.md) | +| BIGINT | [Int64](../../sql-reference/data-types/int-uint.md) | +| FLOAT | [Float32](../../sql-reference/data-types/float.md) | +| DOUBLE | [Float64](../../sql-reference/data-types/float.md) | +| DATE | [日付](../../sql-reference/data-types/date.md) | +| DATETIME, TIMESTAMP | [DateTime](../../sql-reference/data-types/datetime.md) | +| BINARY | [FixedString](../../sql-reference/data-types/fixedstring.md) | + +他のすべてのmysqlデータ型に変換され [文字列](../../sql-reference/data-types/string.md). + +[Nullable](../../sql-reference/data-types/nullable.md) サポートされます。 + +## 使用例 {#examples-of-use} + +MySQLのテーブル: + +``` text +mysql> USE test; +Database changed + +mysql> CREATE TABLE `mysql_table` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `float` FLOAT NOT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from mysql_table; ++------+-----+ +| int_id | value | ++------+-----+ +| 1 | 2 | ++------+-----+ +1 row in set (0,00 sec) +``` + +ClickHouseのデータベース、MySQLサーバとのデータ交換: + +``` sql +CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') +``` + +``` sql +SHOW DATABASES +``` + +``` text +┌─name─────┐ +│ default │ +│ mysql_db │ +│ system │ +└──────────┘ +``` + +``` sql +SHOW TABLES FROM mysql_db +``` + +``` text +┌─name─────────┐ +│ mysql_table │ +└──────────────┘ +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +└────────┴───────┘ +``` + +``` sql +INSERT INTO mysql_db.mysql_table VALUES (3,4) +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +│ 3 │ 4 │ +└────────┴───────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/ja/engines/database_engines/index.md b/docs/ja/engines/database_engines/index.md deleted file mode 100644 index 93a92e08fc4..00000000000 --- a/docs/ja/engines/database_engines/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Database Engines -toc_priority: 27 -toc_title: "\u5C0E\u5165" ---- - -# データベース {#database-engines} - -データベースエンジンできる仕事です。 - -既定では、clickhouseはネイティブのデータベースエンジンを使用します。 [表エンジン](../../engines/table_engines/index.md) と [SQLダイアレクト](../../sql_reference/syntax.md). - -次のデータベースエンジンも使用できます: - -- [MySQL](mysql.md) - -- [怠け者](lazy.md) - -[元の記事](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/ja/engines/database_engines/mysql.md b/docs/ja/engines/database_engines/mysql.md deleted file mode 100644 index 4fdb785698f..00000000000 --- a/docs/ja/engines/database_engines/mysql.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 30 -toc_title: MySQL ---- - -# Mysql {#mysql} - -リモートmysqlサーバー上のデータベースに接続し、 `INSERT` と `SELECT` ClickHouseとMySQLの間でデータを交換するためのクエリ。 - -その `MySQL` データベースエンジンの翻訳のクエリのMySQLサーバーでの操作を行うことができなど `SHOW TABLES` または `SHOW CREATE TABLE`. - -次のクエリは実行できません: - -- `RENAME` -- `CREATE TABLE` -- `ALTER` - -## データベースの作成 {#creating-a-database} - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] -ENGINE = MySQL('host:port', 'database', 'user', 'password') -``` - -**エンジン変数** - -- `host:port` — MySQL server address. -- `database` — Remote database name. -- `user` — MySQL user. -- `password` — User password. - -## データ型のサポート {#data_types-support} - -| MySQL | クリックハウス | -|----------------------------------|--------------------------------------------------------------| -| UNSIGNED TINYINT | [UInt8](../../sql_reference/data_types/int_uint.md) | -| TINYINT | [Int8](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED SMALLINT | [UInt16](../../sql_reference/data_types/int_uint.md) | -| SMALLINT | [Int16](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql_reference/data_types/int_uint.md) | -| INT, MEDIUMINT | [Int32](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED BIGINT | [UInt64](../../sql_reference/data_types/int_uint.md) | -| BIGINT | [Int64](../../sql_reference/data_types/int_uint.md) | -| FLOAT | [Float32](../../sql_reference/data_types/float.md) | -| DOUBLE | [Float64](../../sql_reference/data_types/float.md) | -| DATE | [日付](../../sql_reference/data_types/date.md) | -| DATETIME, TIMESTAMP | [DateTime](../../sql_reference/data_types/datetime.md) | -| BINARY | [FixedString](../../sql_reference/data_types/fixedstring.md) | - -他のすべてのmysqlデータ型に変換され [文字列](../../sql_reference/data_types/string.md). - -[Nullable](../../sql_reference/data_types/nullable.md) サポートされます。 - -## 使用例 {#examples-of-use} - -MySQLのテーブル: - -``` text -mysql> USE test; -Database changed - -mysql> CREATE TABLE `mysql_table` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `float` FLOAT NOT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from mysql_table; -+------+-----+ -| int_id | value | -+------+-----+ -| 1 | 2 | -+------+-----+ -1 row in set (0,00 sec) -``` - -ClickHouseのデータベース、MySQLサーバとのデータ交換: - -``` sql -CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') -``` - -``` sql -SHOW DATABASES -``` - -``` text -┌─name─────┐ -│ default │ -│ mysql_db │ -│ system │ -└──────────┘ -``` - -``` sql -SHOW TABLES FROM mysql_db -``` - -``` text -┌─name─────────┐ -│ mysql_table │ -└──────────────┘ -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -└────────┴───────┘ -``` - -``` sql -INSERT INTO mysql_db.mysql_table VALUES (3,4) -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -│ 3 │ 4 │ -└────────┴───────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/ja/engines/table-engines/index.md b/docs/ja/engines/table-engines/index.md new file mode 100644 index 00000000000..4dc7edf4b00 --- /dev/null +++ b/docs/ja/engines/table-engines/index.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Table Engines +toc_priority: 26 +toc_title: "\u5C0E\u5165" +--- + +# 表エンジン {#table_engines} + +表エンジン(表のタイプ: + +- どのようにデータが格納されている場所、それをどこに書き込むか、どこから読み込むか。 +- どのクエリがサポートされ、どのように。 +- 同時データアクセス。 +- インデックスが存在する場合の使用。 +- マルチスレッドリクエストの実行が可能かどうか。 +- データ複製パラメーター。 + +## エンジン家族 {#engine-families} + +### Mergetree {#mergetree} + +高負荷仕事のための最も普遍的な、機能テーブルエンジン。 本物件の共有によるこれらのエンジンには迅速にデータを挿入とその後のバックグラウンドデータを処となります。 `MergeTree` 家族のエンジンの支援データレプリケーション( [複製された\*](mergetree-family/replication.md) バージョンのエンジン)分割、その他の機能で対応していないその他のエンジンです。 + +家族のエンジン: + +- [MergeTree](mergetree-family/mergetree.md) +- [ツつィツ姪“ツつ”ツ債ツつケ](mergetree-family/replacingmergetree.md) +- [SummingMergeTree](mergetree-family/summingmergetree.md) +- [ツつィツ姪“ツつ”ツ債ツづュツつケ](mergetree-family/aggregatingmergetree.md) +- [CollapsingMergeTree](mergetree-family/collapsingmergetree.md) +- [VersionedCollapsingMergeTree](mergetree-family/versionedcollapsingmergetree.md) +- [グラフィットメールグツリー](mergetree-family/graphitemergetree.md) + +### ログ {#log} + +軽量 [エンジン](log-family/index.md) 最低の機能性を使って。 多くの小さなテーブル(約1万行まで)をすばやく作成し、後でそれらを全体として読み取る必要がある場合、これらは最も効果的です。 + +家族のエンジン: + +- [TinyLog](log-family/tinylog.md) +- [ストリップログ](log-family/stripelog.md) +- [ログ](log-family/log.md) + +### 統合エンジン {#integration-engines} + +エンジン用プリケーションデータストレージと処理システム。 + +家族のエンジン: + +- [カフカname](integrations/kafka.md) +- [MySQL](integrations/mysql.md) +- [ODBC](integrations/odbc.md) +- [JDBC](integrations/jdbc.md) +- [HDFS](integrations/hdfs.md) + +### 特殊エンジン {#special-engines} + +家族のエンジン: + +- [分散](special/distributed.md) +- [MaterializedView](special/materializedview.md) +- [辞書](special/dictionary.md) +- [マージ](special/merge.md) +- [ファイル](special/file.md) +- [ヌル](special/null.md) +- [セット](special/set.md) +- [参加](special/join.md) +- [URL](special/url.md) +- [ビュー](special/view.md) +- [メモリ](special/memory.md) +- [バッファ](special/buffer.md) + +## 仮想列 {#table_engines-virtual-columns} + +Virtual columnは、エンジンのソースコードで定義されているテーブルエンジンの属性です。 + +仮想列を指定しないでください。 `CREATE TABLE` クエリとあなたはそれらを見るこ `SHOW CREATE TABLE` と `DESCRIBE TABLE` クエリ結果。 仮想列も読み取り専用であるため、仮想列にデータを挿入することはできません。 + +仮想カラムからデータを選択するには、仮想カラムの名前を指定する必要があります。 `SELECT` クエリ。 `SELECT *` 仮想列から値を返しません。 + +テーブル仮想列のいずれかと同じ名前の列を持つテーブルを作成すると、仮想列にアクセスできなくなります。 これはお勧めしません。 競合を回避するために、通常、仮想列名にはアンダースコアが付加されます。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/ja/engines/table-engines/integrations/hdfs.md b/docs/ja/engines/table-engines/integrations/hdfs.md new file mode 100644 index 00000000000..f4dd7f2ce09 --- /dev/null +++ b/docs/ja/engines/table-engines/integrations/hdfs.md @@ -0,0 +1,123 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: HDFS +--- + +# HDFS {#table_engines-hdfs} + +このエンジンは、 [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) データの管理を可能にすることによって生態系 [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)クリックハウス経由。 このエンジンは同様です +に [ファイル](../special/file.md) と [URL](../special/url.md) エンジンが、Hadoop固有の機能を提供します。 + +## 使い方 {#usage} + +``` sql +ENGINE = HDFS(URI, format) +``` + +その `URI` parameterは、HDFSのファイルURI全体です。 +その `format` パラメータを指定するか、ファイルのファイルフォーマット 実行するには +`SELECT` クエリは、形式は、入力のためにサポートされ、実行する必要があります +`INSERT` queries – for output. The available formats are listed in the +[形式](../../../interfaces/formats.md#formats) セクション。 +のパス部分 `URI` グロブを含む可能性があります。 この場合、テーブルは読み取り専用になります。 + +**例えば:** + +**1.** セットアップ `hdfs_engine_table` テーブル: + +``` sql +CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') +``` + +**2.** Fillファイル: + +``` sql +INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) +``` + +**3.** データのクエリ: + +``` sql +SELECT * FROM hdfs_engine_table LIMIT 2 +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## 実装の詳細 {#implementation-details} + +- 読み書きできる並列 +- サポートなし: + - `ALTER` と `SELECT...SAMPLE` オペレーション + - インデックス。 + - 複製だ + +**パス内のグロブ** + +複数のパスコンポーネン のための処理中のファイルが存在するマッチのパスのパターンです。 ファイルのリストは、 `SELECT` (ないで `CREATE` 瞬間)。 + +- `*` — Substitutes any number of any characters except `/` 空の文字列を含む。 +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +構造との `{}` に類似していて下さい [リモート](../../../sql-reference/table-functions/remote.md) テーブル機能。 + +**例えば** + +1. HDFSに次のUriを持つTSV形式のファイルがいくつかあるとします: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. あはいくつかの方法が考えられているテーブルの構成は、すべてのファイル: + + + +``` sql +CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') +``` + +別の方法: + +``` sql +CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') +``` + +テーブルはすべてのファイルの両方のディレクトリ(すべてのファイルが満たすべき書式は、スキーマに記載のクエリ): + +``` sql +CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') +``` + +!!! warning "警告" + ファイルのリストに先行するゼロが付いた数値範囲が含まれている場合は、各桁ごとに中かっこで囲みます。 `?`. + +**例えば** + +このように作成されたテーブルとファイル名 `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') +``` + +## 仮想列 {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**また見なさい** + +- [仮想列](../index.md#table_engines-virtual_columns) + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/ja/engines/table_engines/integrations/index.md b/docs/ja/engines/table-engines/integrations/index.md similarity index 100% rename from docs/ja/engines/table_engines/integrations/index.md rename to docs/ja/engines/table-engines/integrations/index.md diff --git a/docs/ja/engines/table-engines/integrations/jdbc.md b/docs/ja/engines/table-engines/integrations/jdbc.md new file mode 100644 index 00000000000..07f69b1ed81 --- /dev/null +++ b/docs/ja/engines/table-engines/integrations/jdbc.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: JDBC +--- + +# JDBC {#table-engine-jdbc} + +ClickHouseが外部データベースに接続できるようにします [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). + +JDBC接続を実装するには、ClickHouseは別のプログラムを使用します [clickhouse-jdbc橋](https://github.com/alex-krash/clickhouse-jdbc-bridge) うにしてくれました。 + +このエンジンは、 [Nullable](../../../sql-reference/data-types/nullable.md) データ型。 + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name +( + columns list... +) +ENGINE = JDBC(dbms_uri, external_database, external_table) +``` + +**エンジン変数** + +- `dbms_uri` — URI of an external DBMS. + + 書式: `jdbc:://:/?user=&password=`. + MySQLの例: `jdbc:mysql://localhost:3306/?user=root&password=root`. + +- `external_database` — Database in an external DBMS. + +- `external_table` — Name of the table in `external_database`. + +## 使用例 {#usage-example} + +コンソールクライアントと直接接続してmysqlサーバーにテーブルを作成する: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ClickHouseサーバーでテーブルを作成し、そこからデータを選択する: + +``` sql +CREATE TABLE jdbc_table +( + `int_id` Int32, + `int_nullable` Nullable(Int32), + `float` Float32, + `float_nullable` Nullable(Float32) +) +ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') +``` + +``` sql +SELECT * +FROM jdbc_table +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## また見なさい {#see-also} + +- [JDBCテーブル関数](../../../sql-reference/table-functions/jdbc.md). + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/ja/engines/table-engines/integrations/kafka.md b/docs/ja/engines/table-engines/integrations/kafka.md new file mode 100644 index 00000000000..40725a95a6f --- /dev/null +++ b/docs/ja/engines/table-engines/integrations/kafka.md @@ -0,0 +1,176 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 32 +toc_title: "\u30AB\u30D5\u30ABname" +--- + +# カフカname {#kafka} + +このエンジンは [アパッチ-カフカ](http://kafka.apache.org/). + +カフカはあなたを可能にします: + +- データフローを公開または購読する。 +- 整理-フォールトトレラント保管します。 +- プロセスストリームが使用可能になるとき。 + +## テーブルの作成 {#table_engine-kafka-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = Kafka() +SETTINGS + kafka_broker_list = 'host:port', + kafka_topic_list = 'topic1,topic2,...', + kafka_group_name = 'group_name', + kafka_format = 'data_format'[,] + [kafka_row_delimiter = 'delimiter_symbol',] + [kafka_schema = '',] + [kafka_num_consumers = N,] + [kafka_skip_broken_messages = N] +``` + +必須パラメータ: + +- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). +- `kafka_topic_list` – A list of Kafka topics. +- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don’t want messages to be duplicated in the cluster, use the same group name everywhere. +- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` 機能、のような `JSONEachRow`. 詳細については、 [形式](../../../interfaces/formats.md) セクション。 + +任意変数: + +- `kafka_row_delimiter` – Delimiter character, which ends the message. +- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap’n Proto](https://capnproto.org/) スキーマファイルへのパスとルートの名前が必要です `schema.capnp:Message` オブジェクト。 +- `kafka_num_consumers` – The number of consumers per table. Default: `1`. 指定しこれからも、多くの消費者の場合、スループットの消費が不足しています。 の総数消費者を超えることはできませんパーティションの数の問題から一つだけの消費者割り当てることができた。 +- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. もし `kafka_skip_broken_messages = N` その後、エンジンはスキップ *N* 解析できないKafkaメッセージ(メッセージはデータの行と同じです)。 + +例: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + SELECT * FROM queue LIMIT 5; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', + kafka_topic_list = 'topic', + kafka_group_name = 'group1', + kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') + SETTINGS kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; +``` + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 用途では使用しないでください方法で新規プロジェクト. 可能であれば、古いプロジェクトを上記の方法に切り替えます。 + +``` sql +Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format + [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) +``` + +
+ +## 説明 {#description} + +届いたメッセージは自動的に追跡で、それぞれのメッセージグループでは数えます。 データを取得したい場合は、別のグループ名を持つテーブルのコピーを作成します。 + +グループは柔軟で、クラスター上で同期されます。 たとえば、クラスター内のテーブルの10のトピックと5つのコピーがある場合、各コピーは2つのトピックを取得します。 コピー数が変更されると、トピックは自動的にコピー全体に再配布されます。 これについての詳細を読むhttp://kafka.apache.org/intro。 + +`SELECT` は特に役立つメッセージを読む(以外のデバッグ)では、それぞれのメッセージでしか読み込むことができます。 ではより実践的な創出の実時間スレッドを実現します。 これを行うには: + +1. エンジンを使用してkafkaコンシューマーを作成し、データストリームとみなします。 +2. 目的の構造を持つテーブルを作成します。 +3. を実現しュに変換するデータからのエンジンを入れていたとして作成されます。 + +とき `MATERIALIZED VIEW` 入、エンジンでデータを収集しみいただけます。 これにより、Kafkaからメッセージを継続的に受信し、必要な形式に変換することができます `SELECT`. +このようにして、異なる詳細レベル(grouping-aggregation and without)を持つ複数のテーブルに書き込むことができます。 + +例えば: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + CREATE TABLE daily ( + day Date, + level String, + total UInt64 + ) ENGINE = SummingMergeTree(day, (day, level), 8192); + + CREATE MATERIALIZED VIEW consumer TO daily + AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total + FROM queue GROUP BY day, level; + + SELECT level, sum(total) FROM daily GROUP BY level; +``` + +受信したメッ [max\_insert\_block\_size](../../../operations/server-configuration-parameters/settings.md#settings-max_insert_block_size). ブロックが内に形成されなかった場合 [stream\_flush\_interval\_ms](../../../operations/server-configuration-parameters/settings.md) ミリ秒では、データはブロックの完全性に関係なくテーブルにフラッシュされます。 + +リクエストを受けた話題のデータは変更に変換ロジック、切り離しを実現ビュー: + +``` sql + DETACH TABLE consumer; + ATTACH TABLE consumer; +``` + +ターゲットテーブルを次のように変更する場合 `ALTER` お勧めいたしま字の材質ビューを避ける異なるターゲットテーブルのデータからの眺め。 + +## 設定 {#configuration} + +GraphiteMergeTreeと同様に、KafkaエンジンはClickHouse configファイルを使用した拡張構成をサポートしています。 使用できる設定キーは二つあります:global (`kafka`)とトピックレベル (`kafka_*`). グローバル構成が最初に適用され、トピックレベル構成が適用されます(存在する場合)。 + +``` xml + + + cgrp + smallest + + + + + 250 + 100000 + +``` + +可能な構成オプションの一覧については、 [librdkafka設定リファレンス](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). アンダースコアを使う (`_`)ClickHouse構成のドットの代わりに。 例えば, `check.crcs=true` されます `true`. + +## 仮想列 {#virtual-columns} + +- `_topic` — Kafka topic. +- `_key` — Key of the message. +- `_offset` — Offset of the message. +- `_timestamp` — Timestamp of the message. +- `_partition` — Partition of Kafka topic. + +**また見なさい** + +- [仮想列](../index.md#table_engines-virtual_columns) + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/ja/engines/table-engines/integrations/mysql.md b/docs/ja/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..fd6351b27a2 --- /dev/null +++ b/docs/ja/engines/table-engines/integrations/mysql.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: MySQL +--- + +# Mysql {#mysql} + +MySQLエンジンでは、次の操作を実行できます `SELECT` リモートMySQLサーバーに格納されているデータを照会します。 + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... +) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +の詳細な説明を参照してください [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) クエリ。 + +テーブル構造は元のmysqlテーブル構造とは異なる場合があります: + +- 列名は元のmysqlテーブルと同じでなければなりませんが、これらの列の一部だけを任意の順序で使用できます。 +- カラムの型は、元のmysqlテーブルの型と異なる場合があります。 クリックハウスは [キャスト](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) クリックハウスのデータ型への値。 + +**エンジン変数** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` へのクエリ `REPLACE INTO`. もし `replace_query=1` クエリは置換されます。 + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` に追加される式 `INSERT` クエリ。 + + 例えば: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`、どこ `on_duplicate_clause` は `UPDATE c2 = c2 + 1`. を見る [MySQLの文書](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) これを見つけるには `on_duplicate_clause` あなたはで使用することができ `ON DUPLICATE KEY` 句。 + + 指定するには `on_duplicate_clause` 合格する必要があります `0` に `replace_query` パラメータ。 あなたが同時に渡す場合 `replace_query = 1` と `on_duplicate_clause`、ClickHouseは例外を生成します。 + +シンプル `WHERE` 次のような句 `=, !=, >, >=, <, <=` MySQLサーバで実行されます。 + +残りの条件と `LIMIT` サンプリング制約は、MySQLへのクエリが終了した後にのみClickHouseで実行されます。 + +## 使用例 {#usage-example} + +MySQLのテーブル: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ClickHouseのテーブル、上記で作成したMySQLテーブルからデータを取得する: + +``` sql +CREATE TABLE mysql_table +( + `float_nullable` Nullable(Float32), + `int_id` Int32 +) +ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` sql +SELECT * FROM mysql_table +``` + +``` text +┌─float_nullable─┬─int_id─┐ +│ ᴺᵁᴸᴸ │ 1 │ +└────────────────┴────────┘ +``` + +## また見なさい {#see-also} + +- [その ‘mysql’ テーブル機能](../../../sql-reference/table-functions/mysql.md) +- [MySQLを外部辞書のソースとして使用する](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/ja/engines/table-engines/integrations/odbc.md b/docs/ja/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..691316daf0f --- /dev/null +++ b/docs/ja/engines/table-engines/integrations/odbc.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: ODBC +--- + +# ODBC {#table-engine-odbc} + +ClickHouseが外部データベースに接続できるようにします [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +ODBC接続を安全に実装するには、ClickHouseは別のプログラムを使用します `clickhouse-odbc-bridge`. ODBCドライバーが直接読み込まれている場合 `clickhouse-server` ドライバの問題でクラッシュのClickHouseサーバーです。 クリックハウスが自動的に起動 `clickhouse-odbc-bridge` それが必要なとき。 ODBCブリッジプログラムは、次のパッケージと同じパッケー `clickhouse-server`. + +このエンジンは、 [Nullable](../../../sql-reference/data-types/nullable.md) データ型。 + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +の詳細な説明を参照してください [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) クエリ。 + +のテーブル構造が異なるソースからテーブル構造: + +- 列名はソーステーブルと同じにする必要がありますが、これらの列の一部だけを任意の順序で使用できます。 +- 列の型は、ソーステーブルの型と異なる場合があります。 クリックハウスは [キャスト](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) クリックハウスのデータ型への値。 + +**エンジン変数** + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` ファイル。 +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +## 使用例 {#usage-example} + +**ODBC経由でローカルMySQLインストールからデータを取得** + +この例は、ubuntu linux18.04およびmysql server5.7で確認されています。 + +UnixODBCとMySQL Connectorがインストールされていることを確認します。 + +デフォルトでインストールされた場合、パッケージから),clickhouse開始してユーザー `clickhouse`. したがって、MySQLサーバでこのユーザを作成して設定する必要があります。 + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +次に、接続を設定します `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +を使用して接続を確認することができ `isql` unixODBCインストールからのユーティリティ。 + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +MySQLのテーブル: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ClickHouseのテーブル、MySQLテーブルからデータを取得する: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## また見なさい {#see-also} + +- [ODBC外部辞書](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [ODBCテーブル関数](../../../sql-reference/table-functions/odbc.md) + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/ja/engines/table_engines/log_family/index.md b/docs/ja/engines/table-engines/log-family/index.md similarity index 100% rename from docs/ja/engines/table_engines/log_family/index.md rename to docs/ja/engines/table-engines/log-family/index.md diff --git a/docs/ja/engines/table-engines/log-family/log-family.md b/docs/ja/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..e3abeda83ee --- /dev/null +++ b/docs/ja/engines/table-engines/log-family/log-family.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 31 +toc_title: "\u5C0E\u5165" +--- + +# 丸太エンジン家族 {#log-engine-family} + +これらのエンジンは、多くの小さなテーブル(最大約1万行)をすばやく作成し、後で全体として読む必要があるシナリオ用に開発されました。 + +家族のエンジン: + +- [ストリップログ](stripelog.md) +- [ログ](log.md) +- [TinyLog](tinylog.md) + +## 一般的なプロパティ {#common-properties} + +エンジン: + +- ディスク上のデータを格納します。 + +- 書き込み時にファイルの末尾にデータを追加します。 + +- 同時データアクセスのサポートロック。 + + の間 `INSERT` クエリのテーブルがロックされ、その他の質問を読み込みおよび書き込みデータの両方のテーブルを作成する データ書き込みクエリがない場合は、任意の数のデータ読み取りクエリを同時に実行できます。 + +- ないサポート [突然変異](../../../sql-reference/statements/alter.md#alter-mutations) オペレーション + +- 索引をサポートしない。 + + これは、 `SELECT` データ範囲のクエリは効率的ではありません。 + +- データを原子的に書き込まない。 + + 取得できるテーブルデータが破損した場合も破れ、書き込み操作は、例えば、異常サーバをシャットダウンしました。 + +## 違い {#differences} + +その `TinyLog` エンジンは家族の最も簡単で、最も貧しい機能性および最も低い効率を提供する。 その `TinyLog` エンジンをサポートしていない並列データの読み取りによる複数のスレッド)。 それは、並列読み取りをサポートするファミリ内の他のエンジンよりも遅いデータを読み取り、 `Log` エンジンは、各列を別々のファイルに格納するためです。 シンプルな低負荷シナリオで使用します。 + +その `Log` と `StripeLog` エンジンは平行データ読書を支える。 デー 各スレ その `Log` エンジンは、テーブルの各列に別々のファイルを使用します。 `StripeLog` すべてのデータファイルです。 その結果、 `StripeLog` エンジン用の少ない記述子に、経営システムが、 `Log` エンジンはデータを読むとき高性能を提供する。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/ja/engines/table-engines/log-family/log.md b/docs/ja/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..c5ad09f0bf3 --- /dev/null +++ b/docs/ja/engines/table-engines/log-family/log.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: "\u30ED\u30B0" +--- + +# ログ {#log} + +エンジンは、ログエンジンの家族に属します。 ログエンジ [丸太エンジン家族](log-family.md) 記事。 + +ログとは異なります [TinyLog](tinylog.md) その中での小さなファイル “marks” 列ファイルに常駐します。 これらのマークはすべてのデータブロックに書き込まれ、指定された行数をスキップするためにファイルの読み取りを開始する場所を示すオフセッ この読み取りを可能にする機能がありテーブルデータを複数のスレッド)。 +同時データアクセスの場合、読み取り操作は同時に実行でき、書き込み操作は読み取りをブロックします。 +ログのエンジンなスを作成します。 同様に、執筆する場合はテーブルに失敗したり、テーブルに破からの読み出しでエラーを返します。 ログのエンジンは適切な一時データ書き込み回のテーブルの試験-デモンストレーション。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/ja/engines/table-engines/log-family/stripelog.md b/docs/ja/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..ff39a5179b0 --- /dev/null +++ b/docs/ja/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,95 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 32 +toc_title: "\u30B9\u30C8\u30EA\u30C3\u30D7\u30ED\u30B0" +--- + +# ストリップログ {#stripelog} + +このエン ログエンジ [丸太エンジン家族](log-family.md) 記事。 + +少量のデータ(1万行未満)を含む多数のテーブルを作成する必要がある場合は、このエンジンをシナリオで使用します。 + +## テーブルの作成 {#table_engines-stripelog-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = StripeLog +``` + +の詳細な説明を参照してください [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) クエリ。 + +## データの書き込み {#table_engines-stripelog-writing-the-data} + +その `StripeLog` エンジンの店舗のすべての列を一つのファイルです。 それぞれの `INSERT` クエリ、ClickHouseは、列を一つずつ書き込み、テーブルファイルの最後にデータブロックを追加します。 + +各テーブルclickhouseに書き込み中のファイル: + +- `data.bin` — Data file. +- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. + +その `StripeLog` エンジンはサポートしません `ALTER UPDATE` と `ALTER DELETE` オペレーション + +## データの読み込み {#table_engines-stripelog-reading-the-data} + +ファイルをマークでclickhouseを並列化したデータです。 これは、 `SELECT` クエリは、予期しない順序で行を返します。 を使用 `ORDER BY` 行をソートする句。 + +## 使用例 {#table_engines-stripelog-example-of-use} + +テーブルの作成: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +データの挿入: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +私たちは二つの `INSERT` データブロックを作成するためのクエリ `data.bin` ファイル。 + +ClickHouse利用は、複数のスレッド選択時のデータです。 各スレッドを読み込み、別のデータブロックを返しますよ列として自立で終了します。 結果として、出力の行のブロックの順序は、ほとんどの場合、入力の同じブロックの順序と一致しません。 例えば: + +``` sql +SELECT * FROM stripe_log_table +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +┌───────────timestamp─┬─message_type─┬─message───────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +└─────────────────────┴──────────────┴───────────────────────────┘ +``` + +結果の並べ替え(デフォルトでは昇順): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/ja/engines/table-engines/log-family/tinylog.md b/docs/ja/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..2c9f7a2a338 --- /dev/null +++ b/docs/ja/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: TinyLog +--- + +# TinyLog {#tinylog} + +エンジンはログエンジンファミリに属します。 見る [丸太エンジン家族](log-family.md) ログエンジンとその違いの一般的な特性のために。 + +このテーブルエンジンは、通常、write-onceメソッドで使用されます。 たとえば、次のものを使用できます `TinyLog`-小さなバッチで処理される中間データのテーブルを入力します。 多数の小さなテーブルにデータを格納することは非効率的です。 + +クエリは単一のストリームで実行されます。 言い換えれば、このエンジンは比較的小さなテーブル(約1,000,000行まで)を対象としています。 小さなテーブルがたくさんある場合は、このテーブルエンジンを使用するのが理にかなっています。 [ログ](log.md) エンジン(少数のファイルは開く必要があります)。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/ja/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/ja/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..4d597526584 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,103 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: "\uFF82\u3064\uFF68\uFF82\u59EA\"\uFF82\u3064\"\uFF82\u50B5\uFF82\u3065\ + \uFF6D\uFF82\u3064\uFF79" +--- + +# ツつィツ姪“ツつ”ツ債ツづュツつケ {#aggregatingmergetree} + +エンジンは [MergeTree](mergetree.md#table_engines-mergetree)、データパーツのマージのロジックを変更する。 ClickHouseは、すべての行を同じ主キー(またはより正確には同じ)で置き換えます [ソートキー](mergetree.md))集計関数の状態の組み合わせを格納する単一の行(一つのデータ部門内)。 + +を使用することができ `AggregatingMergeTree` テーブルが増えた場合のデータ収集、集計を実現します。 + +エンジンプロセスの全てのカラム [AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md) タイプ。 + +使用するのが適切です `AggregatingMergeTree` 注文によって行数が減る場合。 + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[TTL expr] +[SETTINGS name=value, ...] +``` + +説明リクエストパラメータの参照 [要求の説明](../../../sql-reference/statements/create.md). + +**クエリ句** + +作成するとき `AggregatingMergeTree` テーブル同じ [句](mergetree.md) 作成するときと同じように、必須です。 `MergeTree` テーブル。 + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +すべてのパラメーターの意味は、次のようになります `MergeTree`. +
+ +## 選択して挿入 {#select-and-insert} + +データを挿入するには [INSERT SELECT](../../../sql-reference/statements/insert-into.md) aggregate-State-functionsを使用したクエリ。 +データを選択するとき `AggregatingMergeTree` テーブル、使用 `GROUP BY` 句とデータを挿入するときと同じ集約関数が、 `-Merge` 接尾辞。 + +の結果で `SELECT` クエリ、値の `AggregateFunction` タイプは、すべてのClickHouse出力形式に対して実装固有のバイナリ表現を持ちます。 たとえば、データをダンプする場合, `TabSeparated` フォーマット `SELECT` このダンプは、次のようにロードされます `INSERT` クエリ。 + +## 集約マテリアライズドビューの例 {#example-of-an-aggregated-materialized-view} + +`AggregatingMergeTree` マテリアライズドビュー `test.visits` テーブル: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +データを挿入する `test.visits` テーブル。 + +``` sql +INSERT INTO test.visits ... +``` + +データは、テーブルとビューの両方に挿入されます `test.basic` それは集約を実行します。 + +集計データを取得するには、次のようなクエリを実行する必要があります `SELECT ... GROUP BY ...` ビューから `test.basic`: + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/ja/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/ja/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..487ea73a289 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: CollapsingMergeTree +--- + +# Collapsingmergetree {#table_engine-collapsingmergetree} + +エンジンは [MergeTree](mergetree.md) 加算の論理行の崩壊データ部品の統合アルゴリズムです。 + +`CollapsingMergeTree` 並べ替えキー内のすべてのフィールドの場合、行のペアを非同期的に削除(折りたたみ)します (`ORDER BY`)は、特定のフィールドを除いて同等です `Sign` これは `1` と `-1` 値。 ペアのない行は保持されます。 詳細については、 [折りたたみ](#table_engine-collapsingmergetree-collapsing) 文書のセクション。 + +エンジンはかなり貯蔵の容積を減らし、効率をの高めるかもしれません `SELECT` 結果としてのクエリ。 + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +説明のクエリパラメータは、 [クエリの説明](../../../sql-reference/statements/create.md). + +**CollapsingMergeTreeパラメータ** + +- `sign` — Name of the column with the type of row: `1` は “state” 行, `-1` は “cancel” 行 + + Column data type — `Int8`. + +**クエリ句** + +作成するとき `CollapsingMergeTree` テーブル、同じ [クエリ句](mergetree.md#table_engine-mergetree-creating-a-table) 作成するときと同じように、必須です。 `MergeTree` テーブル。 + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +すべてのパラメーターを除く `sign` と同じ意味を持つ `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` — “state” 行, `-1` — “cancel” 行 + + Column Data Type — `Int8`. + +
+ +## 折りたたみ {#table_engine-collapsingmergetree-collapsing} + +### データ {#data} + +あるオブジェクトのデータを継続的に変更する必要がある状況を考えてみましょう。 これは、オブジェクトのための一つの行を持っており、任意の変更でそれを更新する論理的に聞こえるが、更新操作は、ストレージ内のデータの書き換え が必要な場合にデータを書き込むには、迅速に更新できませんが、きの変化をオブジェクトの順にしております。 + +特定の列を使用する `Sign`. もし `Sign = 1` これは、行がオブジェクトの状態であることを意味します。 “state” 行 もし `Sign = -1` これは、同じ属性を持つオブジェクトの状態の取り消しを意味し、それを呼び出しましょう “cancel” 行 + +例えば、しい計算のページのユーザーかサイトは、長くご愛用いただけると思いがあります。 ある時点で、ユーザーアクティビティの状態で次の行を書きます: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +しばらくして、ユーザーアクティビティの変更を登録し、次の二つの行を書き込みます。 + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +最初の行は、オブジェクト(user)の前の状態を取り消します。 取り消された状態の並べ替えキーフィールドをコピーします `Sign`. + +次の行には、現在の状態が含まれています。 + +ユーザーアクティビティの最後の状態だけが必要なので、行 + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +オブジェクトの無効な(古い)状態を崩壊させることを削除することができます。 `CollapsingMergeTree` これは、データ部分のマージ中に行います。 + +なぜ私たちは必要2行の各変更のために読む [Algorithm](#table_engine-collapsingmergetree-collapsing-algorithm) 段落。 + +**そのようなアプローチ** + +1. プログラムを書き込み、データ意のオブジェクトをキャンセルはできます。 “Cancel” 文字列はコピーのソートキーの分野において “state” 文字列とその逆 `Sign`. この増加の初期サイズでの保存が可能なデータを書き込む。 +2. 列の長い配列は、書き込みの負荷によるエンジンの効率を低下させます。 より簡単なデータ、より高い効率。 +3. その `SELECT` 結果は、オブジェクトの変更履歴の整合性に強く依存します。 挿入するデータを準備するときは正確です。 たとえば、セッションの深さなどの負でない指標の負の値などです。 + +### Algorithm {#table_engine-collapsingmergetree-collapsing-algorithm} + +ClickHouseがデータパーツをマージすると、同じソートキーを持つ連続した行の各グループ (`ORDER BY` これは、以下の二つの行に縮小されています。 `Sign = 1` (“state” 行)と別の `Sign = -1` (“cancel” 行)。 言い換えれば、エントリは崩壊する。 + +それぞれの結果のデータ部分clickhouse保存: + +1. 最初の “cancel” そして最後の “state” 行の数が “state” と “cancel” 行は一致し、最後の行はaです “state” 行 + +2. 最後の “state” 行、より多くのがある場合 “state” 行よりも “cancel” 行。 + +3. 最初の “cancel” 行、より多くのがある場合 “cancel” 行よりも “state” 行。 + +4. 他のすべてのケースでは、行はありません。 + +また、少なくとも2以上がある場合 “state” 行よりも “cancel” 行、または少なくとも2以上 “cancel” その後の行 “state” ただし、ClickHouseはこの状況を論理エラーとして扱い、サーバーログに記録します。 このエラーは、同じデータが複数回挿入された場合に発生します。 + +したがって、崩壊は統計の計算結果を変更すべきではありません。 +変更は徐々に崩壊し、最終的にはほぼすべてのオブジェクトの最後の状態だけが残った。 + +その `Sign` マージアルゴリズムは、同じソートキーを持つすべての行が同じ結果のデータ部分にあり、同じ物理サーバー上にあることを保証するものではないため、必須で ClickHouse過程 `SELECT` 複数のスレッドを持つクエリは、結果の行の順序を予測することはできません。 完全に取得する必要がある場合は、集計が必要です “collapsed” からのデータ `CollapsingMergeTree` テーブル。 + +折りたたみを完了するには、次のクエリを記述します `GROUP BY` この符号を考慮する句および集計関数。 たとえば、数量を計算するには、以下を使用します `sum(Sign)` 代わりに `count()`. 何かの合計を計算するには、次のようにします `sum(Sign * x)` 代わりに `sum(x)`、など、とも追加 `HAVING sum(Sign) > 0`. + +凝集体 `count`, `sum` と `avg` この方法で計算できます。 合計 `uniq` 算出できる場合にはオブジェクトは、少なくとも一つの状態はまだ崩れていない。 凝集体 `min` と `max` 以下の理由で計算できませんでした `CollapsingMergeTree` 折りたたまれた状態の値の履歴は保存されません。 + +集計せずにデータを抽出する必要がある場合(たとえば、最新の値が特定の条件に一致する行が存在するかどうかをチェックする場合)は、次のように `FINAL` のための修飾語 `FROM` 句。 このアプローチは大幅に少ない効率的です。 + +## 使用例 {#example-of-use} + +データ例: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +テーブルの作成: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +データの挿入: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +私たちは二つを使う `INSERT` 二つの異なるデータ部分を作成するクエリ。 また、データの挿入につクエリClickHouseを一つのデータ部分を行いませんが合併します。 + +データの取得: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +私たちは何を見て、どこで崩壊していますか? + +二つの `INSERT` クエリーを作成し、2つのデータ部品です。 その `SELECT` クエリは2つのスレッドで実行され、ランダムな行の順序が得られました。 データ部分のマージがまだなかったため、折りたたみは発生しません。 ClickHouseは予測できない未知の瞬間にデータ部分をマージします。 + +このようにして集計: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +集約を必要とせず、強制的に崩壊させたい場合は、以下を使用できます `FINAL` の修飾子 `FROM` 句。 + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +データを選択するこの方法は非常に非効率的です。 大きなテーブルには使用しないでください。 + +## 別のアプローチの例 {#example-of-another-approach} + +データ例: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ -5 │ -146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +アイデアは、マージが唯一のキーフィールドを考慮することです。 そして、 “Cancel” 行符号列を使用せずに合計すると、行の以前のバージョンを等しくする負の値を指定できます。 この方法では、データ型を変更する必要があります `PageViews`,`Duration` UInt8-\>Int16の負の値を格納します。 + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews Int16, + Duration Int16, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +アプローチをテストしよう: + +``` sql +insert into UAct values(4324182021466249494, 5, 146, 1); +insert into UAct values(4324182021466249494, -5, -146, -1); +insert into UAct values(4324182021466249494, 6, 185, 1); + +select * from UAct final; // avoid using final in production (just for a test or small tables) +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +``` sql +SELECT + UserID, + sum(PageViews) AS PageViews, + sum(Duration) AS Duration +FROM UAct +GROUP BY UserID +```text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +``` sqk +select count() FROM UAct +``` + +``` text +┌─count()─┐ +│ 3 │ +└─────────┘ +``` + +``` sql +optimize table UAct final; + +select * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/ja/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/ja/engines/table-engines/mergetree-family/custom-partitioning-key.md new file mode 100644 index 00000000000..029652b3873 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,127 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 32 +toc_title: "\u30AB\u30B9\u30BF\u30E0\u5206\u5272\u30AD\u30FC" +--- + +# カスタム分割キー {#custom-partitioning-key} + +パーティション分割は [MergeTree](mergetree.md) ファミリーテーブル [複製された](replication.md) テーブル)。 [マテリアライズ表示](../special/materializedview.md) に基づくMergeTreeテーブル支援を分割します。 + +パーティションが論理的に組み合わせの記録テーブルに指定された評価のポイントになります。 パーティションは、月別、日別、またはイベントタイプ別など、任意の基準によって設定できます。 各パーティションは別に保存される簡単操作のデータです。 アクセス時のデータclickhouseの最小サブセットのパーティションは可能です。 + +パーティションは `PARTITION BY expr` 節とき [テーブルの作成](mergetree.md#table_engine-mergetree-creating-a-table). これはパーティションキーにすることはでき表現からのテーブル列あります。 例えば、指定ョ月の表現を使用 `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour; +``` + +これはパーティションキーもできるタプルの表現を [主キー](mergetree.md#primary-keys-and-indexes-in-queries)). 例えば: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +この例では、現在の週に発生したイベントタイプによるパーティション分割を設定します。 + +テーブルに新しいデータを挿入すると、このデータは主キーでソートされた別の部分(チャンク)として格納されます。 挿入後10-15分で、同じパーティションのパーツがパート全体にマージされます。 + +!!! info "情報" + Mergeは、パーティショニング式と同じ値を持つデータパーツに対してのみ機能します。 これは **なんかを過度に粒状仕切り** (約千パーティション以上)。 それ以外の場合は、 `SELECT` クエリは、ファイルシステムとオープンファイル記述子のファイルの不当に大きな数のために不十分な実行します。 + +を使用 [システム。パーツ](../../../operations/system-tables.md#system_tables-parts) テーブルのテーブル部品およびパーテッション. たとえば、我々が持っていると仮定しましょう `visits` テーブルを分割する。 のは、実行してみましょう `SELECT` のための問い合わせ `system.parts` テーブル: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 1 │ +│ 201902 │ 201902_11_11_0 │ 1 │ +└───────────┴────────────────┴────────┘ +``` + +その `partition` 列にはパーティションの名前が含まれます。 この例には二つの区画があります: `201901` と `201902`. この列の値を使用して、パーティション名を指定できます。 [ALTER … PARTITION](#alter_manipulations-with-partitions) クエリ。 + +その `name` カラムの名前を格納して、パーティションのデータ部品です。 この列を使用して、パートの名前を指定することができます。 [ALTER ATTACH PART](#alter_attach-partition) クエリ。 + +最初の部分の名前を分解してみましょう: `201901_1_3_1`: + +- `201901` パーティション名です。 +- `1` データブロックの最小数です。 +- `3` データブロックの最大数です。 +- `1` チャンクレベル(マージツリーの深さ)です。 + +!!! info "情報" + 古いタイプのテーブルの部分には名前があります: `20190117_20190123_2_2_0` (最小日付-最大日付-最小ブロック番号-最大ブロック番号-レベル)。 + +その `active` コラムは部品の状態を示します。 `1` アクティブです; `0` 非アクティブです。 に不活性部品、例えば、ソース部品の残りの後の合併によります。 破損したデータ部分も非アクティブとして示されます。 + +この例でわかるように、同じパーティションのいくつかの分離された部分があります(たとえば, `201901_1_3_1` と `201901_1_9_2`). つまり、これらの部分はまだマージされていません。 ClickHouseは、挿入してから約15分後に、データの挿入された部分を定期的にマージします。 さらに、スケジュールされていないマージを実行するには [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) クエリ。 例えば: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 0 │ +│ 201902 │ 201902_4_11_2 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 0 │ +│ 201902 │ 201902_11_11_0 │ 0 │ +└───────────┴────────────────┴────────┘ +``` + +不活性パーツを削除する約10分後の統合. + +部品やパーティションのセットを表示する別の方法は、テーブルのディレクトリに移動することです: `/var/lib/clickhouse/data///`. 例えば: + +``` bash +/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +フォルダ ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ というように部品のディレクトリです。 各部に関する対応する分割データが含まれまで一定の月のテーブルこの例では、分割による。 + +その `detached` ディレクト [DETACH](#alter_detach-partition) クエリ。 破損した部分も削除されるのではなく、このディレクトリに移動されます。 サーバーはサーバーからの部品を使用しません `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql-reference/statements/alter.md#alter_attach-partition) クエリ。 + +オペレーティングサーバーでは、ファイルシステム上の部品またはそのデータのセットを手動で変更することはできません。 非複製のテーブル、これを実行する事ができます。サーバが停止中でないお勧めします。 レプリケートされたテーブルの場合、パートのセットは変更できません。 + +ClickHouseを使用すると、パーティションを削除したり、テーブル間でコピーしたり、バックアップを作成したりできます。 セクションのすべての操作の一覧を参照してください [パーティションとパーツの操作](../../../sql-reference/statements/alter.md#alter_manipulations-with-partitions). + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/ja/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/ja/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..a36b4271cb5 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: "\u30B0\u30E9\u30D5\u30A3\u30C3\u30C8\u30E1\u30FC\u30EB\u30B0\u30C4\u30EA\ + \u30FC" +--- + +# グラフィットメールグツリー {#graphitemergetree} + +このエン) [黒鉛](http://graphite.readthedocs.io/en/latest/index.html) データ。 GraphiteのデータストアとしてClickHouseを使用したい開発者にとっては役に立つかもしれません。 + +ロールアップが必要ない場合は、任意のclickhouseテーブルエンジンを使用してグラファイトデータを保存できますが、ロールアップが必要な場合は使用します `GraphiteMergeTree`. エンジンはストレージの量を減らし、Graphiteからのクエリの効率を高めます。 + +エンジンを継承性から [MergeTree](mergetree.md). + +## テーブルの作成 {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +の詳細な説明を参照してください [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) クエリ。 + +グラファイトデータのテーブルには、次のデータの列が必要です: + +- メトリック名(黒鉛センサ)。 データ型: `String`. + +- メトリックを測定する時間。 データ型: `DateTime`. + +- メトリックの値。 データ型:任意の数値。 + +- メトリックのバージョン。 データ型:任意の数値。 + + ClickHouseは、バージョンが同じであれば、最高のバージョンまたは最後に書かれた行を保存します。 その他の行は、データパーツのマージ中に削除されます。 + +これらの列の名前は、ロールアップ構成で設定する必要があります。 + +**GraphiteMergeTreeパラメータ** + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +**クエリ句** + +作成するとき `GraphiteMergeTree` テーブル、同じ [句](mergetree.md#table_engine-mergetree-creating-a-table) 作成するときと同じように、必須です。 `MergeTree` テーブル。 + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +すべてのパラメーターを除く `config_section` と同じ意味を持つ `MergeTree`. + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +
+ +## ロールアップ構成 {#rollup-configuration} + +ロールアップの設定は、次のように定義されます。 [graphite\_rollup](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) サーバー構成のパラメーター。 パラメータの名前は任意です。 複数の構成を作成し、それらを異なるテーブルに使用できます。 + +ロールアップ構成構造: + + required-columns + patterns + +### 必要な列 {#required-columns} + +- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. +- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. +- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. デフォルト値: `Value`. +- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. + +### パターン {#patterns} + +の構造 `patterns` セクション: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "注意" + パタ: + + 1. Patterns without `function` or `retention`. + 1. Patterns with both `function` and `retention`. + 1. Pattern `default`. + +行を処理するときに、clickhouseは次のルールをチェックします。 `pattern` セクション。 それぞれの `pattern` (を含む `default`)セクションには `function` 集計のパラメータ, `retention` 変数または両方。 このメトリック名が `regexp`、からのルール `pattern` セクション(またはセクション)が適用されます。 `default` セクションを使用します。 + +フィールドの `pattern` と `default` セクション: + +- `regexp`– A pattern for the metric name. +- `age` – The minimum age of the data in seconds. +- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). +- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. + +### 構成例 {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/ja/engines/table_engines/mergetree_family/index.md b/docs/ja/engines/table-engines/mergetree-family/index.md similarity index 100% rename from docs/ja/engines/table_engines/mergetree_family/index.md rename to docs/ja/engines/table-engines/mergetree-family/index.md diff --git a/docs/ja/engines/table-engines/mergetree-family/mergetree.md b/docs/ja/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..94d3192eef8 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,654 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 30 +toc_title: MergeTree +--- + +# Mergetree {#table_engines-mergetree} + +その `MergeTree` この家族 (`*MergeTree`)最も堅牢なクリックハウステーブルエンジンです。 + +のエンジン `MergeTree` ファミリは、非常に大量のデータをテーブルに挿入するために設計されています。 のデータが書き込まれ、テーブル部、そのルール適用のための統合のパーツです。 この方法は、挿入時にストレージ内のデータを継続的に書き換えるよりはるかに効率的です。 + +主な特長: + +- 店舗データを整理によりその有効なタイプを利用します。 + + これにより、データの検索を高速化する小さなスパース索引を作成できます。 + +- パーティションは、 [分割キー](custom-partitioning-key.md) が指定される。 + + ClickHouseは、同じ結果を持つ同じデータに対する一般的な操作よりも効果的なパーティションを持つ特定の操作をサポートします。 ClickHouseも自動的に遮断すると、パーティションデータのパーティショニングキーで指定されたクエリ。 この改善するためのクエリ。 + +- データ複製サポート。 + + の家族 `ReplicatedMergeTree` 表はデータ複製を提供します。 詳細については、 [データ複製](replication.md). + +- データ抜取りサポート。 + + 必要に応じて、テーブル内のデータサンプリング方法を設定できます。 + +!!! info "情報" + その [マージ](../special/merge.md) エンジンはに属しません `*MergeTree` 家族 + +## テーブルの作成 {#table_engine-mergetree-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 +) ENGINE = MergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] +[SETTINGS name=value, ...] +``` + +パラメータの詳細については、 [クエリの説明の作成](../../../sql-reference/statements/create.md). + +!!! note "メモ" + `INDEX` は、実験的な機能です [データスキップ索引](#table_engine-mergetree-data_skipping-indexes). + +### クエリ句 {#mergetree-query-clauses} + +- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. その `MergeTree` engineにはパラメータがありません。 + +- `PARTITION BY` — The [分割キー](custom-partitioning-key.md). + + 月単位でパーティション分割するには、 `toYYYYMM(date_column)` 式、どこ `date_column` 型の日付を持つ列を指定します [日付](../../../sql-reference/data-types/date.md). ここでのパーティション名には、 `"YYYYMM"` フォーマット。 + +- `ORDER BY` — The sorting key. + + 列または任意の式のタプル。 例えば: `ORDER BY (CounterID, EventDate)`. + +- `PRIMARY KEY` — The primary key if it [ソートキーとは異なります](#choosing-a-primary-key-that-differs-from-the-sorting-key). + + デフォルトでは、プライマリキーはソートキー(プライマリキーで指定)と同じです。 `ORDER BY` 句)。 したがって、ほとんどの場合、別の `PRIMARY KEY` 句。 + +- `SAMPLE BY` — An expression for sampling. + + サンプリング式を使用する場合は、主キーに含める必要があります。 例えば: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. + +- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [ディスクとボリューム間](#table_engine-mergetree-multiple-volumes). + + 式には次のものが必要です `Date` または `DateTime` 結果としての列。 例えば: + `TTL date + INTERVAL 1 DAY` + + ルールのタイプ `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` 式が満たされている場合(現在の時間に達した場合)、その部分を使用して実行するアクションを指定します。 (`TO DISK 'xxx'`)またはボリュームに (`TO VOLUME 'xxx'`). ルールのデフォルトの種類は削除です (`DELETE`). 複数のルールのリストは指定できますが、複数のルールが存在しないはずです `DELETE` ルール。 + + 詳細については、 [列とテーブルのttl](#table_engine-mergetree-ttl) + +- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: + + - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [データ記憶](#mergetree-data-storage). + - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [データ記憶](#mergetree-data-storage). + - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` 設定。 バージョン19.11以前は、 `index_granularity` 制限の微粒のサイズのための設定。 その `index_granularity_bytes` 設定の改善ClickHouse性能の選定からデータをテーブルの大きな行(数十、数百人のメガバイト). 大きな行を持つテーブルがある場合は、この設定を有効にしてテーブルの効率を向上させることができます `SELECT` クエリ。 + - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`、その後ZooKeeperは以下のデータを格納します。 詳細については、 [設定の説明](../../../operations/server-configuration-parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) で “Server configuration parameters”. + - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` バイトClickHouseを読み込みおよび書き込み、データの保存ディスクの直接のI/Oインターフェース (`O_DIRECT` オプション)。 もし `min_merge_bytes_to_use_direct_io = 0` その後、直接I/Oが無効になります。 デフォルト値: `10 * 1024 * 1024 * 1024` バイト。 + + - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). + - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don’t turn it off. + - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. + - `storage_policy` — Storage policy. See [複数ブロックデバイスを使用したデータ保存](#table_engine-mergetree-multiple-volumes). + +**セクション設定例** + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 +``` + +この例では、月単位でパーティション分割を設定します。 + +また、ユーザーidによるハッシュとしてサンプリング用の式を設定します。 これにより、それぞれのテーブルのデータを擬似乱数化することができます `CounterID` と `EventDate`. を定義した場合 [SAMPLE](../../../sql-reference/statements/select.md#select-sample-clause) 句データを選択すると、ClickHouseはユーザーのサブセットに対して均等に擬似乱数データサンプルを返します。 + +その `index_granularity` 8192がデフォルト値であるため、設定は省略できます。 + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 用途では使用しないでください方法で新規プロジェクト. 可能であれば、古いプロジェクトを上記の方法に切り替えます。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +**MergeTree()パラメータ** + +- `date-column` — The name of a column of the [日付](../../../sql-reference/data-types/date.md) タイプ。 ClickHouseを自動でパーティション月に基づきます。 パーティション名は `"YYYYMM"` フォーマット。 +- `sampling_expression` — An expression for sampling. +- `(primary, key)` — Primary key. Type: [タプル()](../../../sql-reference/data-types/tuple.md) +- `index_granularity` — The granularity of an index. The number of data rows between the “marks” インデックスの。 値8192は、ほとんどのタスクに適しています。 + +**例えば** + +``` sql +MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) +``` + +その `MergeTree` エンジンは、メインエンジン構成方法について上記の例と同様に構成される。 +
+ +## データ記憶 {#mergetree-data-storage} + +テーブルのデータ部品の分別によりその有効なタイプを利用します。 + +データがテーブルに挿入されると、別々のデータパーツが作成され、それぞれが主キーで辞書式に並べ替えられます。 たとえば、プライマリキーが次の場合 `(CounterID, Date)` パーツ内のデータは `CounterID`、およびそれぞれの中で `CounterID`、それは順序付けられます `Date`. + +データに属する別のパーティションが分離の異なる部品です。 その背景にclickhouse合併しデータのパーツを効率的に保管します。 パーツに属する別のパーティションがないます。 マージメカニズムは、同じ主キーを持つすべての行が同じデータ部分にあることを保証しません。 + +各データ部分は、論理的に顆粒に分割されます。 顆粒は、データを選択するときにclickhouseが読み取る最小の不可分のデータセットです。 clickhouseは行または値を分割しないため、各granule粒には常に整数の行が含まれます。 顆粒の最初の行は、行の主キーの値でマークされます。 各データ、clickhouseを作成しインデックスファイルを格納するのです。 各列について、主キーにあるかどうかにかかわらず、clickhouseには同じマークも格納されます。 これらのマークまたはデータを見つの直列のファイルです。 + +微粒のサイズはによって制限されます `index_granularity` と `index_granularity_bytes` テーブルエンジンの設定。 微粒の列の数はで置きます `[1, index_granularity]` 行のサイズに応じた範囲。 顆粒のサイズは超えることができます `index_granularity_bytes` 単一行のサイズが設定の値より大きい場合。 この場合、顆粒のサイズは行のサイズに等しくなります。 + +## クエリの主キーとインデックス {#primary-keys-and-indexes-in-queries} + +を取る `(CounterID, Date)` 例として主キー。 この場合、並べ替えとインデックスは次のように示されます: + + Whole data: [---------------------------------------------] + CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] + Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] + Marks: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 + Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 + +デー: + +- `CounterID in ('a', 'h')`、サーバーはマークの範囲のデータを読み取ります `[0, 3)` と `[6, 8)`. +- `CounterID IN ('a', 'h') AND Date = 3`、サーバーはマークの範囲のデータを読み取ります `[1, 3)` と `[7, 8)`. +- `Date = 3`、サーバーは、マークの範囲内のデータを読み取ります `[1, 10]`. + +上記の例としては常に使用するのがより効果的指標により、フルスキャン! + +に乏指数で追加するデータを読み込みます。 主キーの単一の範囲を読み取るとき `index_granularity * 2` 余分な列の各データブロック読み取ることができます。 + +疎指標できる作業は非常に多くのテーブル行において、多くの場合、指数はコンピュータのアプリです。 + +ClickHouseは一意の主キーを必要としません。 同じ主キーで複数の行を挿入できます。 + +### 主キーの選択 {#selecting-the-primary-key} + +主キーの列数は明示的に制限されていません。 データ構造によっては、主キーに多かれ少なかれ列を含めることができます。 この: + +- インデックスのパフォーマン + + プライマリキーが `(a, b)` 次に、別の列を追加します `c` 次の条件が満たされるとパフォーマンスが向上します: + + - 列に条件があるクエリがあります `c`. + - 長いデータ範囲(数倍長い `index_granularity`)の値が同じである場合 `(a, b)` 一般的です。 言い換えれば、別の列を追加すると、非常に長いデータ範囲をスキップできます。 + +- データ圧縮を改善する。 + + ClickHouseは主キーでデータをソートするので、一貫性が高いほど圧縮率が高くなります。 + +- 追加的なロジックが統合データ部分の [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) と [SummingMergeTree](summingmergetree.md) エンジン + + この場合、それは指定することは理にかなって *ソートキー* これは主キーとは異なります。 + +長いprimary keyに悪影響を及ぼす可能性は、挿入性能やメモリ消費が別の列に主キーに影響を与えないclickhouse性能 `SELECT` クエリ。 + +### ソートキーとは異なる主キーの選択 {#choosing-a-primary-key-that-differs-from-the-sorting-key} + +ソートキー(データ部分の行をソートする式)とは異なる主キー(各マークのインデックスファイルに書き込まれる値を持つ式)を指定することができます。 この場合、主キー式タプルは、並べ替えキー式タプルのプレフィックスである必要があります。 + +この機能は、 [SummingMergeTree](summingmergetree.md) と +[ツつィツ姪“ツつ”ツ債ツづュツつケ](aggregatingmergetree.md) テーブルエンジン。 これらのエンジンを使用する一般的なケースでは、テーブルには二種類の列があります: *寸法* と *対策*. 典型的なクエリは、任意のメジャー列の値を集計します `GROUP BY` そして次元によるろ過。 SummingMergeTreeとAggregatingMergeTreeは、並べ替えキーの同じ値を持つ行を集計するので、すべての次元を追加するのが自然です。 その結果、キー式は長い列のリストで構成され、このリストは新しく追加されたディメンションで頻繁に更新される必要があります。 + +この場合、主キーにいくつかの列だけを残して、効率的な範囲スキャンを提供し、残りのディメンション列を並べ替えキータプルに追加することが理に + +[ALTER](../../../sql-reference/statements/alter.md) 新しい列がテーブルとソートキーに同時に追加されると、既存のデータパーツを変更する必要がないため、ソートキーの操作は軽量です。 古いソートキーは新しいソートキーの接頭辞であり、新しく追加された列にデータがないため、データはテーブル変更の時点で古いソートキーと新しいソートキーの両方 + +### クエリでの索引とパーティションの使用 {#use-of-indexes-and-partitions-in-queries} + +のために `SELECT` ClickHouseは、インデックスを使用できるかどうかを分析します。 インデックスが使用できるのは、 `WHERE/PREWHERE` 句には、等式または不等式の比較演算を表す式(連結要素のいずれかとして、または完全に)があります。 `IN` または `LIKE` 主キーまたはパーティショニングキーに含まれる列または式、またはこれらの列の特定の部分反復関数、またはこれらの式の論理関係に固定プレフィッ + +したがって、主キーの一つまたは複数の範囲でクエリをすばやく実行することができます。 この例では、特定のトラッキングタグ、特定のタグおよび日付範囲、特定のタグおよび日付、日付範囲を持つ複数のタグなどに対して実行すると、クエ + +次のように構成されたエンジンを見てみましょう: + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 + +この場合、クエリで: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +ClickHouseの主キー指標のトリムで不正なデータを毎月パーティショニングキーパンフレット、ホームページの間仕切りする不適切な日。 + +上記のクエリのインデックスが使用されるときにも複雑な表現です。 テーブルからの読み取りがいを使用した指標できないっぱいたします。 + +以下の例では、インデックスは使用できません。 + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +確認clickhouseできるとの利用時の走行クエリに対して、使用の設定 [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) と [force\_primary\_key](../../../operations/settings/settings.md). + +の分割による月で読み込みのみこれらのデータブロックを含むからスピーチへのマークの範囲内で適切に取扱います。 この場合、データブロックには多くの日付(月全体まで)のデータが含まれることがあります。 ブロック内では、データは主キーによってソートされます。 このため、主キープレフィックスを指定しない日付条件のみを持つクエリを使用すると、単一の日付よりも多くのデータが読み取られます。 + +### 部分的に単調な主キーに対するインデックスの使用 {#use-of-index-for-partially-monotonic-primary-keys} + +たとえば、月の日数を考えてみましょう。 彼らは形成する [単調系列](https://en.wikipedia.org/wiki/Monotonic_function) 一ヶ月のために、しかし、より長期間単調ではありません。 これは部分的に単調なシーケンスです。 ユーザーが部分的に単調な主キーを持つテーブルを作成する場合、ClickHouseは通常どおりスパースインデックスを作成します。 ユーザーがこの種類のテーブルからデータを選択すると、ClickHouseはクエリ条件を分析します。 ユーザーは、インデックスの二つのマークの間のデータを取得したいと、これらのマークの両方が一ヶ月以内に落ちる場合、それはクエリとインデックスマーク + +クエリパラメーターの範囲内の主キーの値が単調順序を表さない場合、clickhouseはインデックスを使用できません。 この場合、clickhouseはフルスキャン方式を使用します。 + +ClickHouseは、月シーケンスの日数だけでなく、部分的に単調なシーケンスを表すプライマリキーについても、このロジックを使用します。 + +### データスキップインデックス(実験) {#table_engine-mergetree-data_skipping-indexes} + +インデックス宣言は、次の列セクションにあります `CREATE` クエリ。 + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +からのテーブルの場合 `*MergeTree` 家族データの飛び指標を指定できます。 + +これらのインデックスは、ブロックの指定された式に関する情報を集約します。 `granularity_value` 微粒(微粒のサイズはを使用して指定されます `index_granularity` テーブルエンジンの設定)。 次に、これらの集約は `SELECT` ディスクから読み取るデータの量を減らすためのクエリ `where` クエリは満たされません。 + +**例えば** + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +この例のインデックスをclickhouseで使用すると、次のクエリでディスクから読み取るデータの量を減らすことができます: + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### 使用可能なインデックスの種類 {#available-types-of-indices} + +- `minmax` + + 指定された式の極値を格納します(式が指定されている場合 `tuple` そして、それは各要素のための極端をの貯えます `tuple`)を使用して保存情報の飛びブロックのようなデータは、その有効なタイプを利用します。 + +- `set(max_rows)` + + 指定された式の一意の値を格納します。 `max_rows` 行, `max_rows=0` 意味 “no limits”). この値を使用して、 `WHERE` 式はデータブロックでは充足可能ではありません。 + +- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + 店a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) これには、データブロックのすべてのngramsが含まれます。 文字列でのみ動作します。 の最適化に使用することができます `equals`, `like` と `in` 式。 + + - `n` — ngram size, + - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). + - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. + - `random_seed` — The seed for Bloom filter hash functions. + +- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + 同じように `ngrambf_v1` しかし、ngramsの代わりにトークンを格納します。 トークンは、英数字以外の文字で区切られた順序です。 + +- `bloom_filter([false_positive])` — Stores a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) 指定された列の場合。 + + 任意 `false_positive` パラメーターは、フィルターから偽陽性の応答を受信する確率です。 可能な値:(0,1)。 デフォルト値:0.025. + + 対応データ型: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. + + 次の関数はそれを使用できます: [等しい](../../../sql-reference/functions/comparison-functions.md), [notEquals](../../../sql-reference/functions/comparison-functions.md), [で](../../../sql-reference/functions/in-functions.md), [notIn](../../../sql-reference/functions/in-functions.md), [持っている](../../../sql-reference/functions/array-functions.md). + + + +``` sql +INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 +INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 +``` + +#### 機能サポート {#functions-support} + +の条件 `WHERE` clauseには、列で操作する関数の呼び出しが含まれます。 列がインデックスの一部である場合、ClickHouseは関数の実行時にこのインデックスを使用しようとします。 ClickHouse支援の異なるサブセットの機能を使用。 + +その `set` indexは、すべての関数で使用できます。 他のインデックスの関数サブセットを以下の表に示します。 + +| 関数(演算子)/インデックス | 主キー | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | +|-------------------------------------------------------------------------------------------------------------|--------|--------|-------------|-------------|---------------| +| [equals(=,==))](../../../sql-reference/functions/comparison-functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notEquals(!=, \<\>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [のように](../../../sql-reference/functions/string-search-functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [notLike](../../../sql-reference/functions/string-search-functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [startsWith](../../../sql-reference/functions/string-functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [エンドスウィス](../../../sql-reference/functions/string-functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [マルチセアチャンネル](../../../sql-reference/functions/string-search-functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | +| [で](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notIn](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [less(\<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [グレーター(\>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [lessOrEquals(\<=)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [greaterOrEquals(\>=)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [空](../../../sql-reference/functions/array-functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [notEmpty](../../../sql-reference/functions/array-functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| ハストケンcity in germany | ✗ | ✗ | ✗ | ✔ | ✗ | + +Ngramサイズより小さい定数引数を持つ関数は、 `ngrambf_v1` クエリの最適化のため。 + +ブルでは偽陽性一致すので、 `ngrambf_v1`, `tokenbf_v1`、と `bloom_filter` インデックスは、関数の結果がfalseであると予想されるクエリの最適化には使用できません。: + +- 最適化することができる: + - `s LIKE '%test%'` + - `NOT s NOT LIKE '%test%'` + - `s = 1` + - `NOT s != 1` + - `startsWith(s, 'test')` +- 最適化できません: + - `NOT s LIKE '%test%'` + - `s NOT LIKE '%test%'` + - `NOT s = 1` + - `s != 1` + - `NOT startsWith(s, 'test')` + +## 同時データアクセス {#concurrent-data-access} + +同時テーブルアクセスでは、マルチバージョンを使用します。 つまり、テーブルが同時に読み取られて更新されると、クエリ時に現在のパーツのセットからデータが読み取られます。 長いロックはありません。 挿入は読み取り操作の方法では得られません。 + +テーブルからの読み取りは自動的に並列化されます。 + +## 列とテーブルのttl {#table_engine-mergetree-ttl} + +値の存続期間を決定します。 + +その `TTL` 句は、テーブル全体と個々の列ごとに設定することができます。 テーブルレベルのTTLで指定した論理の自動移動のデータディスクの間とします。 + +式は評価する必要があります [日付](../../../sql-reference/data-types/date.md) または [DateTime](../../../sql-reference/data-types/datetime.md) データ型。 + +例えば: + +``` sql +TTL time_column +TTL time_column + interval +``` + +定義する `interval`、使用 [時間間隔](../../../sql-reference/operators.md#operators-datetime) 演算子。 + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### 列ttl {#mergetree-column-ttl} + +列の値が期限切れになると、clickhouseは列のデータ型の既定値に置き換えます。 すべてのカラム値のデータ部分を切clickhouse削除するこのカラムからのデータにファイルシステム. + +その `TTL` キー列には句を使用できません。 + +例: + +TTLを使用したテーブルの作成 + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +既存のテーブルの列にttlを追加する + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +列のttlの変更 + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### テーブルttl {#mergetree-table-ttl} + +テーブルでの表現の除去に終了しました列、複数の表現を自動で部品の移動と [ディスク](#table_engine-mergetree-multiple-volumes). 時テーブルの行の有効期間ClickHouseをすべて削除して対応さい。 部品移動フィーチャの場合、部品のすべての行が移動式の基準を満たしている必要があります。 + +``` sql +TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... +``` + +TTLルールのタイプは、各TTL式に従います。 これは、式が満たされると実行されるアクションに影響します(現在の時間に達します): + +- `DELETE` 削除行を終了しました(デフォルトアクション); +- `TO DISK 'aaa'` -ディスクに部品を移動 `aaa`; +- `TO VOLUME 'bbb'` -ディスクに部品を移動 `bbb`. + +例: + +TTLを使用したテーブルの作成 + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH [DELETE], + d + INTERVAL 1 WEEK TO VOLUME 'aaa', + d + INTERVAL 2 WEEK TO DISK 'bbb'; +``` + +テーブルのttlの変更 + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**データの削除** + +データ切れのttlを取り除きclickhouse合併しデータの部品です。 + +時clickhouseるデータの期間は終了しましたので、行offスケジュール内スケジュールする必要がありません。 このようなマージの頻度を制御するには、次のように設定します [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). 値が低すぎる場合は、多くのリソースを消費する可能性のある多くのオフスケジュールマージを実行します。 + +あなたが実行する場合 `SELECT` 期限切れのデータを取得できます。 それを避けるために、を使用 [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) 前にクエリ `SELECT`. + +## 複数ブロックデバイスを使用したデータ保存 {#table_engine-mergetree-multiple-volumes} + +### 導入 {#introduction} + +`MergeTree` 家族のテーブルエンジンでデータを複数のブロックデバイス たとえば、特定のテーブルのデータが暗黙的に分割されている場合に便利です “hot” と “cold”. 最新のデータは定期的に要求されますが、必要な領域はわずかです。 それどころか、fat-tailed履歴データはまれに要求される。 複数のディスクが使用可能な場合は、 “hot” データは高速ディスク(たとえば、NVMe Ssdまたはメモリ内)にあります。 “cold” データ-比較的遅いもの(例えば、HDD)。 + +データ部分は最低の移動可能な単位のためのです `MergeTree`-エンジンテーブル。 ある部分に属するデータは、あるディスクに格納されます。 データ部分は背景のディスクの間で(ユーザーの設定に従って)、またによって動かすことができます [ALTER](../../../sql-reference/statements/alter.md#alter_move-partition) クエリ。 + +### 条件 {#terms} + +- Disk — Block device mounted to the filesystem. +- Default disk — Disk that stores the path specified in the [パス](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) サーバー設定。 +- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). +- Storage policy — Set of volumes and the rules for moving data between them. + +の名称を記載することから、システムテーブル, [システム。ストレージ\_policies](../../../operations/system-tables.md#system_tables-storage_policies) と [システム。ディスク](../../../operations/system-tables.md#system_tables-disks). テーブ `storage_policy` の設定 `MergeTree`-エンジン家族のテーブル。 + +### 設定 {#table_engine-mergetree-multiple-volumes-configure} + +ディスク、ボリューム、およびストレージポリシーは、 `` メインファイルのいずれかのタグ `config.xml` または、 `config.d` ディレクトリ。 + +構成の構造: + +``` xml + + + + /mnt/fast_ssd/clickhouse/ + + + /mnt/hdd1/clickhouse/ + 10485760 + + + /mnt/hdd2/clickhouse/ + 10485760 + + + ... + + + ... + +``` + +タグ: + +- `` — Disk name. Names must be different for all disks. +- `path` — path under which a server will store data (`data` と `shadow` フォルダ)で終了する必要があります。 ‘/’. +- `keep_free_space_bytes` — the amount of free disk space to be reserved. + +ディスク定義の順序は重要ではありません。 + +ストレージポリシ: + +``` xml + + ... + + + + + disk_name_from_disks_configuration + 1073741824 + + + + + + + 0.2 + + + + + + + + ... + +``` + +タグ: + +- `policy_name_N` — Policy name. Policy names must be unique. +- `volume_name_N` — Volume name. Volume names must be unique. +- `disk` — a disk within a volume. +- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. +- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). + +Cofigurationの例: + +``` xml + + ... + + + + + disk1 + disk2 + + + + + + + + fast_ssd + 1073741824 + + + disk1 + + + 0.2 + + + ... + +``` + +与えられた例では、 `hdd_in_order` ポリシーの実装 [ラウンドロビン](https://en.wikipedia.org/wiki/Round-robin_scheduling) アプローチ。 したがって、このポリシ (`single`)データパーツは、すべてのディスクに循環順序で格納されます。 こうした政策れぞれの知見について学ぶとともに有が複数ある場合は同様のディスク搭載のシステムがRAIDな設定を行います。 個々のディスクドライブはそれぞれ信頼できないため、複製係数が3以上になるように補正する必要があることに注意してください。 + +システムで使用可能なディスクの種類が異なる場合, `moving_from_ssd_to_hdd` ポリシーは代わりに使用できます。 ボリューム `hot` SSDディスクで構成されています (`fast_ssd`このボリュームに格納できるパーツの最大サイズは1GBです。 サイズが1GBより大きいすべての部品はで直接貯えられます `cold` HDDディスクを含むボリューム `disk1`. +また、一度ディスク `fast_ssd` 80%以上によって満たされて得ます、データはに移ります `disk1` 背景プロセ + +ストレージポリシー内のボリューム列挙の順序は重要です。 ボリュームがオーバーフィルされると、データは次のものに移動されます。 ディスク列挙の順序は、データが順番に格納されるため、重要です。 + +作成時にテーブルは、適用の設定を保存方針で: + +``` sql +CREATE TABLE table_with_non_default_policy ( + EventDate Date, + OrderID UInt64, + BannerID UInt64, + SearchPhrase String +) ENGINE = MergeTree +ORDER BY (OrderID, BannerID) +PARTITION BY toYYYYMM(EventDate) +SETTINGS storage_policy = 'moving_from_ssd_to_hdd' +``` + +その `default` ストレージポリシーは、ボリュームを一つだけ使用することを意味します。 ``. テーブルを作成すると、そのストレージポリシーは変更できません。 + +### 詳細 {#details} + +の場合 `MergeTree` テーブル、データがあるディスクには、異なる方法: + +- 挿入の結果として (`INSERT` クエリ)。 +- バックグラウンドマージ時 [突然変異](../../../sql-reference/statements/alter.md#alter-mutations). +- 別のレプリカか +- 仕切りの凍結の結果として [ALTER TABLE … FREEZE PARTITION](../../../sql-reference/statements/alter.md#alter_freeze-partition). + +すべてのこれらの場合を除き、突然変異とパーティションの凍結は、一部が保存され、大量のディスクに保存政策: + +1. パートを格納するのに十分なディスク領域を持つ最初のボリューム(定義の順序で) (`unreserved_space > current_part_size`)特定のサイズの部品を格納することができます (`max_data_part_size_bytes > current_part_size`)が選択されます。 +2. このボリューム内では、前のデータチャンクを格納するために使用されたディスクに続くディスクが選択され、パーツサイズよりも空き領域が多くなり (`unreserved_space - keep_free_space_bytes > current_part_size`). + +フードの下で、突然変異および仕切りの凍結は利用します [ハードリンク](https://en.wikipedia.org/wiki/Hard_link). ハードリンクとディスクには対応していないため、この場合、パーツの保管と同じディスクの初期ます。 + +バックグラウンドでは、空き領域の量に基づいて部品がボリューム間で移動されます (`move_factor` パラメータ)順序に従って、設定ファイルでボリュームが宣言されます。 +データは最後のものから最初のものに転送されません。 システムテーブルを使用できる [システム。part\_log](../../../operations/system-tables.md#system_tables-part-log) (フィールド `type = MOVE_PART`) [システム。パーツ](../../../operations/system-tables.md#system_tables-parts) (フィールド `path` と `disk`)背景の動きを監視する。 また、詳細な情報はサーバーログに記載されています。 + +ユーザーの力で移動中の一部またはパーティションから量別のクエリ [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql-reference/statements/alter.md#alter_move-partition)、バックグラウンド操作のすべての制限が考慮されます。 クエリは単独で移動を開始し、バックグラウンド操作が完了するのを待機しません。 十分な空き領域がない場合、または必要な条件のいずれかが満たされない場合、ユーザーはエラーメッセージが表示されます。 + +データの移動はデータの複製を妨げません。 そのため、異なる保管方針を指定することができ、同じテーブルの異なるレプリカ. + +バックグラウンドマージと突然変異の完了後、古い部分は一定時間後にのみ削除されます (`old_parts_lifetime`). +この間、他のボリュームやディスクに移動されることはありません。 したがって、部品が最終的に取り外されるまで、それらはまだ占有ディスクスペースの評価のために考慮される。 + +[元の記事](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/ja/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/ja/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..37df9077744 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: "\uFF82\u3064\uFF68\uFF82\u59EA\"\uFF82\u3064\"\uFF82\u50B5\uFF82\u3064\ + \uFF79" +--- + +# ツつィツ姪“ツつ”ツ債ツつケ {#replacingmergetree} + +エンジンは [MergeTree](mergetree.md#table_engines-mergetree) それは、同じ主キー値(またはより正確には同じ値)を持つ重複エントリを削除するという点で [ソートキー](mergetree.md) 値)。 + +データ重複除去は、マージ中にのみ行われます。 マージは未知の時間にバックグラウンドで行われるため、計画することはできません。 一部のデータは未処理のままです。 スケジュールされていないマージを実行するには `OPTIMIZE` クエリは、それを使用してカウントされません。 `OPTIMIZE` クエリは大量のデータを読み書きします。 + +したがって, `ReplacingMergeTree` に適した清算出重複データを背景に保存するための空間が保証するものではありませんが重複している。 + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +説明リクエストパラメータの参照 [要求の説明](../../../sql-reference/statements/create.md). + +**ReplacingMergeTreeパラメータ** + +- `ver` — column with version. Type `UInt*`, `Date` または `DateTime`. 省略可能なパラメータ。 + + マージ時, `ReplacingMergeTree` 同じ主キーを持つすべての行から一つだけを残します: + + - 選択の最後の場合 `ver` 設定されていません。 + - 最大バージョンでは、 `ver` 指定します。 + +**クエリ句** + +作成するとき `ReplacingMergeTree` テーブル同じ [句](mergetree.md) 作成するときと同じように、必須です。 `MergeTree` テーブル。 + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +すべてのパラメーターを除く `ver` と同じ意味を持つ `MergeTree`. + +- `ver` -バージョンの列。 省略可能なパラメータ。 説明は上記のテキストを参照してください。 + +
+ +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/ja/engines/table-engines/mergetree-family/replication.md b/docs/ja/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..6e2c6e354f1 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,218 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 31 +toc_title: "\u30C7\u30FC\u30BF\u8907\u88FD" +--- + +# データ複製 {#table_engines-replication} + +複製がサポートされる唯一のためのテーブルのmergetree家族: + +- レプリケートされたmergetree +- ツつィツ姪“ツつ”ツ債ツづュツつケツ-faq +- ツつィツ姪“ツつ”ツ債ツづュツつケツ-faq +- ツつィツ姪“ツつ”ツ債ツづュツつケツ-faq +- レプリケートされたcollapsingmergetree +- ReplicatedVersionedCollapsingMergetree +- ReplicatedGraphiteMergeTree + +複製は、サーバー全体ではなく、個々のテーブルのレベルで機能します。 サーバーでの店舗も複製、非複製のテーブルでも同時に行います。 + +複製はシャーディングに依存しません。 各シャードには独自の独立した複製があります。 + +圧縮データのための `INSERT` と `ALTER` クエリを複製(詳細については、ドキュメンテーションに [ALTER](../../../sql-reference/statements/alter.md#query_language_queries_alter)). + +`CREATE`, `DROP`, `ATTACH`, `DETACH` と `RENAME` クエリは単一サーバーで実行され、レプリケートされません: + +- その `CREATE TABLE` queryは、クエリが実行されるサーバー上に新しい複製可能テーブルを作成します。 このテーブルが既にあるその他のサーバーを加え新たなレプリカ. +- その `DROP TABLE` クエリは、クエリが実行されているサーバー上のレプリカを削除します。 +- その `RENAME` queryは、いずれかのレプリカでテーブルの名前を変更します。 つまり、複製のテーブルでの異なる名称の異なるレプリカ. + +ClickHouse用 [アパッチの飼育係](https://zookeeper.apache.org) レプリカのメタ情報を格納するため。 使用ZooKeeperバージョン3.4.5以降。 + +レプリケーションを使用するには、 [zookeeper](../../../operations/server-configuration-parameters/settings.md#server-settings_zookeeper) サーバー構成セクション. + +!!! attention "注意" + セキュリ クリックハウスは `digest` [ACLスキーム](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) ZooKeeperのセキュリティサブシステムの + +ZooKeeperクラスタのアドレス設定例: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +既存のzookeeperクラスターを指定すると、システムは独自のデータ用のディレクトリを使用します(レプリケート可能なテーブルを作成するときにディレクトリ + +ZooKeeperが設定ファイルに設定されていない場合は、複製されたテーブルを作成することはできず、既存の複製されたテーブルは読み取り専用になります。 + +ZooKeeperは使用されません `SELECT` レプリケーショ `SELECT` との質問を行ってい非再現します。 分散レプリケートテーブルを照会する場合、ClickHouseの動作は設定によって制御されます [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) と [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). + +それぞれの `INSERT` クエリー、契約時に応募を追加飼育係を務取引等 (より正確には、これはデータの挿入された各ブロックに対するものです。 `max_insert_block_size = 1048576` 行。)これは、 `INSERT` と比較して再現します。 しかし、推奨事項に従ってデータを複数のバッチで挿入する場合 `INSERT` 毎秒、それは問題を作成しない。 全体のClickHouseクラスターの使用のための調整一飼育係のクラスタでは、合計数百 `INSERTs` 秒あたり。 データ挿入のスループット(秒あたりの行数)は、レプリケートされていないデータと同じくらい高くなります。 + +のための非常に大きなクラスターで異なるクラスター飼育係の異なる破片. しかし、これはyandexで必要なことは証明されていません。metricaクラスター(約300台のサーバー)。 + +複製は非同期、マルチます。 `INSERT` クエリ(と同様 `ALTER`)利用可能な任意のサーバーに送信することができます。 クエリが実行されているサーバーにデータが挿入され、そのデータが他のサーバーにコピーされます。 非同期であるため、最近挿入されたデータが他のレプリカに何らかの遅延で表示されます。 レプリカの一部が使用できない場合、データは使用できるようになった時点で書き込まれます。 レプリカが使用可能な場合、待機時間は、圧縮されたデータのブロックをネットワーク経由で転送するのにかかる時間です。 + +既定では、挿入クエリは、単一のレプリカからのデータの書き込みの確認を待機します。 データが正常に単一のレプリカに書き込まれ、このレプリカを持つサーバーが存在しなくなると、格納されたデータは失われます。 複数のレプリカからデー `insert_quorum` オプション。 + +データの各ブロックは原子的に書き込まれます。 挿入クエリは、以下のブロックに分割されます `max_insert_block_size = 1048576` 行。 言い換えれば、 `INSERT` クエリは、それが原子的に作られ、1048576未満の行を持っています。 + +データブロックは重複除外されます。 同じデータブロック(同じ順序で同じ行を含む同じサイズのデータブロック)の複数書き込みの場合、ブロックは一度だけ書き込まれます。 この理由は、クライアントアプリケーションがデータがdbに書き込まれたかどうかを知らない場合のネットワーク障害の場合です。 `INSERT` クエリーするだけで簡単に繰り返します。 どのレプリカ挿入が同じデータで送信されたかは関係ありません。 `INSERTs` べき等である。 重複排除圧縮パラメータの制御 [merge\_tree](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-merge_tree) サーバー設定。 + +レプリケーショ さらなるデータ変換(マージ)は、すべてのレプリカで同じ方法で調整され、実行されます。 これにより、ネットワークの使用を最小限に抑えることができます。 (複製の主な目的は、異なるデータセンター内のデータを複製することです。) + +同じデータの任意の数のレプリカを持つことができます。 yandexの。metricaは、本番環境で二重の複製を使用します。 各サーバーはraid-5またはraid-6を使用し、場合によってはraid-10を使用します。 これは比較的信頼性が高く便利な解決策です。 + +システムは、レプリカ上のデータ同期性を監視し、障害発生後に回復することができます。 フェールオーバーは、自動(データのわずかな差異の場合)または半自動(データが大きく異なる場合、構成エラーを示す可能性があります)です。 + +## 複製テーブルの作成 {#creating-replicated-tables} + +その `Replicated` テーブルエンジン名に接頭辞が追加されます。 例えば:`ReplicatedMergeTree`. + +**複製\*マージツリーパラメータ** + +- `zoo_path` — The path to the table in ZooKeeper. +- `replica_name` — The replica name in ZooKeeper. + +例えば: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +
+ +非推奨構文の例 + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +
+ +その例としては、これらのパラメータを含むことができ換巻きていただけるボディーです。 置換された価値はから取られます ‘macros’ 設定ファイルのセクション。 例えば: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +の表の飼育係るべきで機能していませんが将来的には再現します。 テーブルの異なる資料は異なる。 +この場合、パスは次の部分で構成されます: + +`/clickhouse/tables/` は共通の接頭辞です。 の使用をお勧めしまうことです。 + +`{layer}-{shard}` シャード識別子です。 この例では、Yandexので、二つの部分で構成されています。Metricaクラスターの使用インターネット上のファイル転送sharding. ほとんどのタスクでは、{shard}置換だけを残すことができます。 + +`table_name` ZooKeeperのテーブルのノードの名前です。 テーブル名と同じにすることをお勧めします。 テーブル名とは対照的に、名前の変更クエリの後に変更されないため、明示的に定義されています。 +*HINT*:データベース名を追加することができます `table_name` 同様に。 例えば `db_name.table_name` + +レプリカ名は同じテーブルの別のレプリカを識別します。 この例のように、このサーバー名を使用できます。 名前は各シャード内で一意である必要があります。 + +置換を使用する代わりに、パラメーターを明示的に定義できます。 これは、テストや小さなクラスターの構成に便利です。 ただし、分散ddlクエリは使用できません (`ON CLUSTER`)この場合。 + +組み合わせによる方がクラスターの使用をお勧めいたしま換その可能性を低減するにはエラーになります。 + +実行する `CREATE TABLE` 各レプリカに対するクエリ。 このクエ + +テーブルに他のレプリカのデータがすでに含まれている後に新しいレプリカを追加すると、データはクエリの実行後に他のレプリカから新しいレプリ つまり、新しいレプリカは他のレプリカと同期します。 + +レプリカを削除するには `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. + +## 障害後の復旧 {#recovery-after-failures} + +場合飼育係が不可の場合、サーバは、複製のテーブルスイッチ読み取り専用モードになります。 システムは定期的にzookeeperに接続しようとします。 + +ZooKeeperが使用中に利用できない場合 `INSERT`、またはZooKeeperとやり取りするとエラーが発生し、例外がスローされます。 + +ZooKeeperに接続した後、システムはローカルファイルシステムのデータセットが期待されるデータセットと一致するかどうかをチェックします(ZooKeeperはこの情報 小さな不整合がある場合、システムはデータをレプリカと同期することで解決します。 + +システムが壊れたデータ部分(ファイルのサイズが間違っている)または認識されない部分(ファイルシステムに書き込まれたがzookeeperに記録されていな `detached` サブディレクトリ(削除されません)。 他の部分がコピーからのレプリカ. + +ClickHouseは大量のデータを自動的に削除するなどの破壊的な操作を実行しません。 + +サーバーが起動(またはzookeeperとの新しいセッションを確立)すると、すべてのファイルの量とサイズのみをチェックします。 ファイルサイズが一致しているが、バイトが途中で変更されている場合、これはすぐには検出されません。 `SELECT` クエリ。 クエリは、一致しないチェックサムまたは圧縮ブロックのサイズに関する例外をスローします。 この場合、データパーツは検証キューに追加され、必要に応じてレプリカからコピーされます。 + +データのローカルセットが予想されるセットと大きく異なる場合は、安全機構がトリガーされます。 サーバーはこれをログに入力し、起動を拒否します。 この理由は、シャード上のレプリカが別のシャード上のレプリカのように誤って構成された場合など、このケースが構成エラーを示している可能性がある しかし、しきい値をこの機構の設定かなり低く、こうした状況が起こる中で、失敗を回復しました。 この場合、データは半自動的に復元されます。 “pushing a button”. + +回復を開始するには、ノードを作成します `/path_to_table/replica_name/flags/force_restore_data` で飼育係とコンテンツ、またはコマンドを実行し復元すべての複製のテーブル: + +``` bash +sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +次に、サーバーを再起動します。 開始時に、サーバーはこれらのフラグを削除し、回復を開始します。 + +## 完全なデータの損失後の回復 {#recovery-after-complete-data-loss} + +すべてのデータやメタデータ消えたらサーバには、次の手順に従ってください復興: + +1. サーバーにclickhouseをインストール. シャード識別子とレプリカを含むコンフィグファイルで置換を正しく定義します。 +2. サーバー上で手動で複製する必要のある複雑でないテーブルがある場合は、ディレクトリ内のレプリカからデータをコピーします `/var/lib/clickhouse/data/db_name/table_name/`). +3. にあるテーブル定義のコピー `/var/lib/clickhouse/metadata/` レプリカから。 テーブル定義でシャードまたはレプリカ識別子が明示的に定義されている場合は、このレプリカに対応するように修正します。 (あるいは、サーバーを起動してすべての `ATTACH TABLE` にあったはずのクエリ。のsqlファイル `/var/lib/clickhouse/metadata/`.) +4. 回復を開始するには、zookeeperノードを作成します `/path_to_table/replica_name/flags/force_restore_data` 他のコンテンツ、またはコマンドを実行し復元すべての複製のテーブル: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +その後、サーバーを起動します(既に実行されている場合は再起動します)。 デー + +代替の回復オプションは削除に関する情報は失われたレプリカから飼育係 (`/path_to_table/replica_name`)、レプリカを再度作成します。 “[複製テーブルの作成](#creating-replicated-tables)”. + +リカバリ中のネットワーク帯域幅に制限はありません。 一度に多くのレプリカを復元する場合は、この点に留意してください。 + +## MergetreeからReplicatedmergetreeへの変換 {#converting-from-mergetree-to-replicatedmergetree} + +我々はこの用語を使用する: `MergeTree` のすべてのテーブルエンジンを参照するには `MergeTree family`、の場合と同じ `ReplicatedMergeTree`. + +あなたが持っていた場合 `MergeTree` したテーブルを手動で再現でき換で再現します。 すでに大量のデータを収集している場合は、これを行う必要があります `MergeTree` これで、レプリケーションを有効にします。 + +さまざまなレプリカでデータが異なる場合は、最初に同期するか、レプリカ以外のすべてのデータを削除します。 + +既存のmergetreeテーブルの名前を変更し、 `ReplicatedMergeTree` 古い名前のテーブル。 +古いテーブルからデータを移動する `detached` サブディレクトリ内のディレクトリを新しいテーブルデータ (`/var/lib/clickhouse/data/db_name/table_name/`). +その後、実行 `ALTER TABLE ATTACH PARTITION` 作業セットにこれらのデータ部分を追加するレプリカのいずれか。 + +## ReplicatedmergetreeからMergetreeへの変換 {#converting-from-replicatedmergetree-to-mergetree} + +別の名前のmergetreeテーブルを作成します。 ディレクトリからすべてのデータを `ReplicatedMergeTree` テーブルデータを新しいテーブルのデータディレクトリです。 次に、 `ReplicatedMergeTree` テーブルとサーバーを再起動します。 + +あなたが取り除きたいなら `ReplicatedMergeTree` サーバーを起動せずにテーブル: + +- 対応するものを削除する `.sql` メタデータディレク (`/var/lib/clickhouse/metadata/`). +- ZooKeeperの対応するパスを削除します (`/path_to_table/replica_name`). + +この後、サーバーを起動し、 `MergeTree` テーブル、そのディレクトリにデータを移動し、サーバーを再起動します。 + +## Zookeeperクラスター内のメタデータが失われたり破損した場合の回復 {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} + +ZooKeeper内のデータが失われたり破損したりした場合は、上記のように単純なテーブルに移動してデータを保存することができます。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/ja/engines/table-engines/mergetree-family/summingmergetree.md b/docs/ja/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..678f83a6502 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,141 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: SummingMergeTree +--- + +# Summingmergetree {#summingmergetree} + +エンジンは [MergeTree](mergetree.md#table_engines-mergetree). 違いは、データ部分をマージするとき `SummingMergeTree` テーブルClickHouseは、すべての行を同じ主キー(またはより正確には同じ)で置き換えます [ソートキー](mergetree.md))数値データ型を持つ列の集計値を含む行。 並べ替えキーが単一のキー値が多数の行に対応するように構成されている場合、これによりストレージボリュームが大幅に削減され、データ選択がスピードア + +私たちは使用するエンジンと一緒に `MergeTree`. 完全なデータを格納する `MergeTree` テーブル、および使用 `SummingMergeTree` レポートを準備するときなど、集計データを保存する場合。 このようなアプローチは、誤って構成された主キーのために貴重なデー + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = SummingMergeTree([columns]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +説明リクエストパラメータの参照 [要求の説明](../../../sql-reference/statements/create.md). + +**SummingMergeTreeのパラメータ** + +- `columns` -値が要約される列の名前を持つタプル。 省略可能なパラメータ。 + 列は数値型である必要があり、主キーに含めることはできません。 + + もし `columns` 指定されていない場合、ClickHouseは、プライマリキーに含まれていない数値データ型を持つすべての列の値を集計します。 + +**クエリ句** + +作成するとき `SummingMergeTree` テーブル同じ [句](mergetree.md) 作成するときと同じように、必須です。 `MergeTree` テーブル。 + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) +``` + +すべてのパラメーターを除く `columns` と同じ意味を持つ `MergeTree`. + +- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. + +
+ +## 使用例 {#usage-example} + +次の表を考えてみます: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +それにデータを挿入する: + +``` sql +INSERT INTO summtt Values(1,1),(1,2),(2,1) +``` + +ClickHouseは完全ではないすべての行を合計してもよい ([以下を参照](#data-processing))ので、我々は集計関数を使用します `sum` と `GROUP BY` クエリ内の句。 + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + +``` text +┌─key─┬─sum(value)─┐ +│ 2 │ 1 │ +│ 1 │ 3 │ +└─────┴────────────┘ +``` + +## データ処理 {#data-processing} + +データがテーブルに挿入されると、そのまま保存されます。 これは、同じプライマリキーを持つ行が合計され、結果のデータ部分ごとに行が置き換えられたときです。 + +ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`)集計関数 [合計()](../../../sql-reference/aggregate-functions/reference.md#agg_function-sum) と `GROUP BY` 上記の例で説明したように、クエリで句を使用する必要があります。 + +### 合計の共通ルール {#common-rules-for-summation} + +数値データ型の列の値が集計されます。 列のセットは、パラメータによって定義されます `columns`. + +合計のすべての列の値が0の場合、行は削除されます。 + +列が主キーに含まれておらず、まとめられていない場合は、既存の値から任意の値が選択されます。 + +主キーの列の値は集計されません。 + +### Aggregatefunction列の合計 {#the-summation-in-the-aggregatefunction-columns} + +列の場合 [AggregateFunctionタイプ](../../../sql-reference/data-types/aggregatefunction.md) クリックハウスは [ツつィツ姪“ツつ”ツ債ツづュツつケ](aggregatingmergetree.md) 機能に従って集約するエンジン。 + +### 入れ子構造 {#nested-structures} + +テーブルでネストしたデータ構造と加工"と言われています。 + +入れ子になったテーブルの名前が `Map` また、以下の条件を満たす少なくとも二つの列が含まれています: + +- 最初の列は数値です `(*Int*, Date, DateTime)` または文字列 `(String, FixedString)`、それを呼びましょう `key`, +- 他の列は算術演算です `(*Int*, Float32/64)`、それを呼びましょう `(values...)`, + +次に、このネストされたテーブルは、 `key => (values...)` 行をマージすると、二つのデータセットの要素は次のようにマージされます `key` 対応する `(values...)`. + +例: + +``` text +[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] +[(1, 100)] + [(1, 150)] -> [(1, 250)] +[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] +[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] +``` + +データを要求するときは、 [sumMap(キー,値)](../../../sql-reference/aggregate-functions/reference.md) の集約のための関数 `Map`. + +入れ子になったデータ構造の場合、合計の列のタプルに列を指定する必要はありません。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/ja/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/ja/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..e11da4d8a81 --- /dev/null +++ b/docs/ja/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,238 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: VersionedCollapsingMergeTree +--- + +# Versionedcollapsingmergetree {#versionedcollapsingmergetree} + +このエンジン: + +- では迅速書き込みオブジェクトとは常に変化しています。 +- バックグラウン これを大幅に削減量に保管します。 + +セクションを見る [折りたたみ](#table_engines_versionedcollapsingmergetree) 詳細については。 + +エンジンは [MergeTree](mergetree.md#table_engines-mergetree) 追加した論理崩壊行のアルゴリズムのための統合データ部品です。 `VersionedCollapsingMergeTree` と同じ目的を果たす [CollapsingMergeTree](collapsingmergetree.md) が異なる崩壊のアルゴリズムを挿入し、データを任意の順番で複数のスレッド)。 特に、 `Version` 列は、間違った順序で挿入されていても、行を適切に折りたたむのに役立ちます。 対照的に, `CollapsingMergeTree` 厳密に連続した挿入のみを許可します。 + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +説明のクエリパラメータの [クエリの説明](../../../sql-reference/statements/create.md). + +**エンジン変数** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Name of the column with the type of row: `1` は “state” 行, `-1` は “cancel” 行 + + 列データ型は次のようになります `Int8`. + +- `version` — Name of the column with the version of the object state. + + 列データ型は次のようになります `UInt*`. + +**クエリ句** + +作成するとき `VersionedCollapsingMergeTree` テーブル、同じ [句](mergetree.md) を作成するときに必要です。 `MergeTree` テーブル。 + +
+ +テーブルを作成する非推奨の方法 + +!!! attention "注意" + 用途では使用しないでください方法で新規プロジェクト. 可能であれば、古いプロジェクトを上記の方法に切り替えます。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +以下を除くすべてのパラメータ `sign` と `version` と同じ意味を持つ `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` は “state” 行, `-1` は “cancel” 行 + + Column Data Type — `Int8`. + +- `version` — Name of the column with the version of the object state. + + 列データ型は次のようになります `UInt*`. + +
+ +## 折りたたみ {#table_engines-versionedcollapsingmergetree} + +### データ {#data} + +あるオブジェクトのデータを継続的に変更する必要がある状況を考えてみましょう。 オブジェクトに対して一つの行を持ち、変更があるときはいつでも行を更新するのが妥当です。 ただし、dbmsでは、ストレージ内のデータの書き換えが必要なため、更新操作は高価で低速です。 データをすばやく書き込む必要がある場合は更新できませんが、オブジェクトに変更を順番に書き込むことができます。 + +を使用 `Sign` 行を書き込むときの列。 もし `Sign = 1` これは、行がオブジェクトの状態であることを意味します(それを呼び出しましょう “state” 行)。 もし `Sign = -1` これは、同じ属性を持つオブジェクトの状態の取り消しを示します( “cancel” 行)。 また、 `Version` 別の番号を持つオブジェクトの各状態を識別する必要がある列。 + +たとえば、ユーザーがいくつかのサイトで訪問したページの数と、そこにいた期間を計算したいとします。 ある時点で、ユーザーアクティビティの状態で次の行を書きます: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +ある時点で、ユーザーアクティビティの変更を登録し、次の二つの行を書き込みます。 + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +最初の行は、オブジェクト(user)の前の状態を取り消します。 でコピーのすべての分野を中止状態を除く `Sign`. + +次の行には、現在の状態が含まれています。 + +ユーザーアクティビティの最後の状態だけが必要なので、行 + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +オブジェクトの無効な(古い)状態を削除して、削除することができます。 `VersionedCollapsingMergeTree` これは、データ部分をマージ中に行います。 + +そんなしが必要であるが、行の変更を参照 [Algorithm](#table_engines-versionedcollapsingmergetree-algorithm). + +**使用上の注意** + +1. プログラムを書き込み、データ意のオブジェクトを解除します。 その “cancel” 文字列は、 “state” 反対の文字列 `Sign`. この増加の初期サイズでの保存が可能なデータを書き込む。 +2. 列の長い配列は、書き込みの負荷のためにエンジンの効率を低下させます。 データがより簡単になればなるほど、効率は向上します。 +3. `SELECT` 結果は、オブジェクト変更の履歴の一貫性に強く依存します。 挿入するデータを準備するときは正確です。 セッションの深さなどの非負の指標の負の値など、一貫性のないデータで予測不可能な結果を得ることができます。 + +### Algorithm {#table_engines-versionedcollapsingmergetree-algorithm} + +ClickHouseは、データパーツをマージするときに、同じ主キーとバージョンが異なる行の各ペアを削除します `Sign`. 行の順序は関係ありません。 + +ClickHouseがデータを挿入すると、主キーで行を並べ替えます。 この `Version` 列は主キーにはなく、ClickHouseはそれを主キーに暗黙的に最後のフィールドとして追加し、それを順序付けに使用します。 + +## データの選択 {#selecting-data} + +ClickHouseは、同じ主キーを持つすべての行が同じ結果のデータ部分にあるか、同じ物理サーバー上にあることを保証するものではありません。 これは、データの書き込みとそれに続くデータ部分のマージの両方に当てはまります。 さらに、ClickHouseプロセス `SELECT` 複数のスレッドを持つクエリは、結果の行の順序を予測することはできません。 これは、完全に取得する必要がある場合に集約が必要であることを意味します “collapsed” からのデータ `VersionedCollapsingMergeTree` テーブル。 + +折りたたみを完了するには、次のようにクエリを記述します `GROUP BY` この符号を考慮する句および集計関数。 たとえば、数量を計算するには、以下を使用します `sum(Sign)` 代わりに `count()`. 何かの合計を計算するには、次のようにします `sum(Sign * x)` 代わりに `sum(x)`、と追加 `HAVING sum(Sign) > 0`. + +凝集体 `count`, `sum` と `avg` この方法で計算できます。 合計 `uniq` オブジェクトに折りたたまれていない状態がある場合に計算できます。 凝集体 `min` と `max` 計算できないのは `VersionedCollapsingMergeTree` 折りたたまれた状態の値の履歴は保存されません。 + +データを抽出する必要がある場合 “collapsing” な集計(例えば、確認列が存在する最新の値に一致条件)を使用できます `FINAL` のための修飾語 `FROM` 句。 このアプローチは非効率で利用すべきではありませんの大きます。 + +## 使用例 {#example-of-use} + +データ例: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +テーブルの作成: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +データの挿入: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +私たちは二つを使う `INSERT` 二つの異なるデータ部分を作成するクエリ。 単一のクエリでデータを挿入すると、ClickHouseは単一のデータ部分を作成し、マージは実行しません。 + +データの取得: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +ここでは何が見え、折りたたまれた部分はどこにありますか? +二つのデータパーツを二つ作成しました `INSERT` クエリ。 その `SELECT` クエリは二つのスレッドで実行され、結果は行のランダムな順序です。 +デー clickhouseは、予測できない未知の時点でデータパーツをマージします。 + +これが集約が必要な理由です: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +集約を必要とせず、強制的に崩壊させたい場合は、 `FINAL` のための修飾語 `FROM` 句。 + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +これは、データを選択する非常に非効率的な方法です。 大きなテーブルには使用しないでください。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/ja/engines/table_engines/special/buffer.md b/docs/ja/engines/table-engines/special/buffer.md similarity index 100% rename from docs/ja/engines/table_engines/special/buffer.md rename to docs/ja/engines/table-engines/special/buffer.md diff --git a/docs/ja/engines/table-engines/special/dictionary.md b/docs/ja/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..d55390afde3 --- /dev/null +++ b/docs/ja/engines/table-engines/special/dictionary.md @@ -0,0 +1,97 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: "\u8F9E\u66F8" +--- + +# 辞書 {#dictionary} + +その `Dictionary` エンジンは表示します [辞書](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) クリックハウス表としてのデータ。 + +例として、次の辞書を考えてみましょう `products` 次の構成では: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +辞書データのクエリ: + +``` sql +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + +``` text +┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ +│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ +└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ +``` + +を使用することができ [dictGet\*](../../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions) この形式の辞書データを取得する関数です。 + +このビューがない便だが、rawデータ、または行う場合には、 `JOIN` オペレーション これらのケースでは、以下を使用できます。 `Dictionary` テーブル内のディクショナリデータを表示するエンジン。 + +構文: + +``` sql +CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` +``` + +使用例: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); +``` + + Ok + +テーブルに何があるかを見てみましょう。 + +``` sql +select * from products limit 1; +``` + +``` text +┌────product_id─┬─title───────────┐ +│ 152689 │ Some item │ +└───────────────┴─────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/ja/engines/table-engines/special/distributed.md b/docs/ja/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..0a17be8e7d9 --- /dev/null +++ b/docs/ja/engines/table-engines/special/distributed.md @@ -0,0 +1,152 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: "\u5206\u6563" +--- + +# 分散 {#distributed} + +**分散エンジンを持つテーブルは、自身がデータを保存しません** しかし、複数のサーバー上の分散クエリ処理を許可します。 +読書は自動的に平行である。 読み取り中に、リモートサーバー上のテーブルインデックスが使用されます。 + +の分散型エンジンを受け付けパラメータ: + +- サーバーの設定ファイル内のクラスター名 + +- リモートデータベースの名前 + +- リモートテーブルの名前 + +- シャーディングキー + +- (オプションで)ポリシー名は、非同期送信のための一時ファイルを格納するために使用される + + また見なさい: + + - `insert_distributed_sync` 設定 + - [MergeTree](../mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) 例のため + +例えば: + +``` sql +Distributed(logs, default, hits[, sharding_key[, policy_name]]) +``` + +データはすべてのサーバから読み込まれます。 ‘logs’ デフォルトのクラスター。ヒットテーブルに位置毎にサーバのクラスター +データは読み取られるだけでなく、リモートサーバーで部分的に処理されます(これが可能な限り)。 +たとえば、group byを使用するクエリの場合、データはリモートサーバー上で集計され、集計関数の中間状態がリクエスターサーバーに送信されます。 その後、データはさらに集約されます。 + +データベース名の代わりに、文字列を返す定数式を使用できます。 たとえば、次のようになります。 + +logs – The cluster name in the server’s config file. + +クラスターがセットのようなこ: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 1 + 9440 + + + + +``` + +ここでは、クラスターは名前で定義されます ‘logs’ それぞれ二つのレプリカを含む二つのシャードで構成されています。 +シャードは、データの異なる部分を含むサーバーを参照します(すべてのデータを読み取るには、すべてのシャードにアクセスする必要があります)。 +レプリカはサーバーを複製しています(すべてのデータを読み取るために、レプリカのいずれかのデータにアクセスできます)。 + +クラ + +パラメータ `host`, `port`、およびオプション `user`, `password`, `secure`, `compression` サーバーごとに指定します: +- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn’t start. If you change the DNS record, restart the server. +- `port` – The TCP port for messenger activity (‘tcp\_port’ 設定では、通常9000)に設定します。 それをhttp\_portと混同しないでください。 +- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [アクセス権](../../../operations/access-rights.md). +- `password` – The password for connecting to a remote server (not masked). Default value: empty string. +- `secure` -接続にsslを使用します。 `port` = 9440. サーバーがリッスンする 9440 と正しい証明書。 +- `compression` -データ圧縮を使用します。 デフォルト値:true。 + +When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing) 設定。 +サーバーとの接続が確立されていない場合は、短いタイムアウトで接続しようとします。 接続に失敗すると、すべてのレプリカに対して次のレプリカが選択されます。 すべてのレプリカに対して接続の試行が失敗した場合、その試行は同じ方法で何度も繰り返されます。 +リモートサーバーは接続を受け入れる可能性がありますが、動作しない可能性があります。 + +シャードのいずれかを指定できます(この場合、クエリ処理は分散ではなくリモートと呼ばれる必要があります)、または任意の数のシャードまで指定でき 各シャードでは、レプリカのいずれかから任意の数に指定することができます。 シャードごとに異なる数のレプリカを指定できます。 + +構成では、任意の数のクラスターを指定できます。 + +クラスタを表示するには、以下を使用します ‘system.clusters’ テーブル。 + +の分散型エンジン能にすることで、社会とクラスターのように現地サーバーです。 ただし、クラスターの構成はサーバー設定ファイルに書き込む必要があります(クラスターのすべてのサーバーではさらに優れています)。 + +The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don’t need to create a Distributed table – use the ‘remote’ 代わりにテーブル関数。 セクションを見る [テーブル関数](../../../sql-reference/table-functions/index.md). + +クラスターにデータを書き込む方法は二つあります: + +まず、どのサーバーにどのデータを書き込むかを定義し、各シャードで直接書き込みを実行できます。 つまり、分散テーブルのテーブルにinsertを実行します “looks at”. これは、主題領域の要件のために自明ではないシャーディングスキームを使用できるため、最も柔軟なソリューションです。 これも最適なソリューションからデータを書き込むことができるの異なる資料が完全に独立。 + +次に、分散テーブルでinsertを実行できます。 この場合、テーブルは挿入されたデータをサーバー自体に分散します。 分散テーブルに書き込むには、シャーディングキーセット(最後のパラメータ)が必要です。 さらに、単一のシャードしかない場合、書き込み操作はシャーディングキーを指定せずに動作します。 + +各シャードは設定ファイルで定義された重みを持つことができます。 デフォルトでは、重みは一つに等しいです。 データは、シャードウェイトに比例した量でシャード全体に分散されます。 たとえば、二つのシャードがあり、最初のものが9の重みを持ち、第二のものが10の重みを持つ場合、最初のシャードは9/19の行に送られ、第二のものは10/19 + +各破片は持つことができます ‘internal\_replication’ 設定ファイルで定義されたパラメータ。 + +このパラメータが設定されている場合 ‘true’ 書き込み操作は、最初の正常なレプリカを選択し、それにデータを書き込みます。 分散テーブルの場合は、この代替を使用します “looks at” 複製されたテーブル。 言い換えれば、データが書き込まれるテーブルがそれ自体を複製する場合です。 + +に設定されている場合 ‘false’ データはすべてのレプリカに書き込まれます。 本質的に、これは、分散テーブルがデータ自体を複製することを意味します。 レプリカの整合性はチェックされず、時間の経過とともにわずかに異なるデータが含まれるためです。 + +データの行が送信されるシャードを選択するには、シャーディング式が分析され、残りの部分がシャードの合計ウェイトで除算されます。 行は、残りの半分の間隔に対応するシャードに送られます ‘prev\_weight’ に ‘prev\_weights + weight’、どこ ‘prev\_weights’ 最小の数を持つシャードの合計重量です。 ‘weight’ このシャードの重さです。 たとえば、二つのシャードがあり、最初のシャードの重みが9で、二番目のシャードの重みが10である場合、行は\[0,9)の範囲から残りのシャードの最初のシャー + +シャーディング式には、整数を返す定数とテーブル列からの任意の式を指定できます。 たとえば、次の式を使用できます ‘rand()’ データのランダムな分布の場合、または ‘UserID’ ユーザーのIDを分割する残りの部分で配布する場合(単一のユーザーのデータは単一のシャードに存在し、ユーザーの実行と参加が簡単になります)。 列のいずれかが十分に均等に分散されていない場合は、ハッシュ関数でラップすることができます:intHash64(UserID)。 + +簡単なリマインダからの限定シshardingんを常に適しています。 中規模および大量のデータ(数十のサーバー)では機能しますが、非常に大量のデータ(数百のサーバー以上)では機能しません。 後者の場合はshardingスキームに必要なのではなく、エントリに配布します。 + +SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don’t have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. + +次の場合、シャーディングスキームについて心配する必要があります: + +- 特定のキーによるデータの結合(inまたはjoin)が必要なクエリが使用されます。 このキーによってデータがシャードされている場合は、グローバルinまたはグローバル結合の代わりにローカルinまたはjoinを使用できます。 +- 多数のサーバー(数百またはそれ以上)が使用され、多数の小さなクエリ(個々のクライアントのクエリ-ウェブサイト、広告主、またはパートナー)が使用されます。 小さなクエリがクラスタ全体に影響を与えないようにするには、単一のクライアントのデータを単一のシャードに配置することが理にかなっていま また、我々はyandexの中でやったように。metricaでは、biレベルのシャーディングを設定できます。 “layers” レイヤーが複数のシャードで構成されている場合。 単一のクライアントのデータは単一のレイヤーに配置されますが、必要に応じてシャードをレイヤーに追加することができ、データはその中にランダムに配 分散テーブルはレイヤごとに作成され、グローバルクエリ用に単一の共有分散テーブルが作成されます。 + +データは非同期に書き込まれます。 テーブルに挿入すると、データブロックはローカルファイルシステムに書き込まれます。 データはできるだけ早くバックグラウンドでリモートサーバーに送信されます。 データを送信する期間は、以下によって管理されます。 [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) と [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) 設定。 その `Distributed` エンジンを送信し、各ファイルを挿入したデータが別々にまでを一括送信ファイルの [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) 設定。 この設定の改善にクラスターの性能をより一層の活用地域のサーバやネットワーク資源です。 を確認しておきましょうか否かのデータが正常に送信されるチェックリストファイル(データまたは間に-をはさんだ)はテーブルディレクトリ: `/var/lib/clickhouse/data/database/table/`. + +分散テーブルへの挿入後にサーバーが存在しなくなった場合、または大まかな再起動(デバイス障害など)が発生した場合は、挿入されたデータが失われる可 破損したデータ部分がテーブルディレクトリで検出された場合、そのデータ部分は、 ‘broken’ サブディレクトリと、もはや使用。 + +Max\_parallel\_replicasオプションを有効にすると、単一のシャード内のすべてのレプリカでクエリ処理が並列化されます。 詳細については、以下を参照してください [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). + +## 仮想列 {#virtual-columns} + +- `_shard_num` — Contains the `shard_num` (から `system.clusters`). タイプ: [UInt32](../../../sql-reference/data-types/int-uint.md). + +!!! note "メモ" + それ以来 [`remote`](../../../sql-reference/table-functions/remote.md)/`cluster` テーブル機能の内部を一時のインスタンスと同じ分散型エンジン, `_shard_num` あまりにもそこに利用可能です。 + +**また見なさい** + +- [仮想列](index.md#table_engines-virtual_columns) + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/ja/engines/table_engines/special/external_data.md b/docs/ja/engines/table-engines/special/external-data.md similarity index 100% rename from docs/ja/engines/table_engines/special/external_data.md rename to docs/ja/engines/table-engines/special/external-data.md diff --git a/docs/ja/engines/table-engines/special/file.md b/docs/ja/engines/table-engines/special/file.md new file mode 100644 index 00000000000..e42ff99501c --- /dev/null +++ b/docs/ja/engines/table-engines/special/file.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u30D5\u30A1\u30A4\u30EB" +--- + +# ファイル {#table_engines-file} + +ファイルにテーブルエンジンのデータをファイルを使ったり、 [ファイル +形式](../../../interfaces/formats.md#formats) (TabSeparated、Nativeなど)。). + +使用例: + +- データからの輸出clickhouseるファイルです。 +- ある形式から別の形式にデータを変換します。 +- ディスク上のファイルを編集して、clickhouseのデータを更新する。 + +## Clickhouseサーバーでの使用状況 {#usage-in-clickhouse-server} + +``` sql +File(Format) +``` + +その `Format` パラメータを指定するか、ファイルのファイルフォーマット 実行するには +`SELECT` クエリは、形式は、入力のためにサポートされ、実行する必要があります +`INSERT` queries – for output. The available formats are listed in the +[形式](../../../interfaces/formats.md#formats) セクション。 + +クリックハウ`File`. で定義されたフォルダを使用します [パス](../../../operations/server-configuration-parameters/settings.md) サーバー構成での設定。 + +テーブルを作成するとき `File(Format)` で空のサブディレクトリとフォルダにまとめた。 データがそのテーブルに書き込まれると、 `data.Format` サブディレクト + +このサブフォルダとファイルをserver filesystemに手動で作成してから [ATTACH](../../../sql-reference/statements/misc.md) でテーブルの情報をマッチングの名前でデータベースバックエンドからファイルです。 + +!!! warning "警告" + ClickHouseはそのようなファイルの外部変更を追跡しないため、この機能には注意してください。 ClickHouseを介して同時に書き込みを行い、ClickHouseの外部に書き込みを行った結果は未定義です。 + +**例えば:** + +**1.** セットアップ `file_engine_table` テーブル: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +デフォルトでclickhouseフォルダを作成します `/var/lib/clickhouse/data/default/file_engine_table`. + +**2.** 手動で作成する `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` を含む: + +``` bash +$ cat data.TabSeparated +one 1 +two 2 +``` + +**3.** データのクエリ: + +``` sql +SELECT * FROM file_engine_table +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Clickhouseでの使用-ローカル {#usage-in-clickhouse-local} + +で [ツつ"ツづ按つオツ!](../../../operations/utilities/clickhouse-local.md) ファイルエンジ `Format`. デフォルトの入力/出力ストリームは、数値または人間が読める名前を使用して指定できます `0` または `stdin`, `1` または `stdout`. +**例えば:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## 実装の詳細 {#details-of-implementation} + +- 複数 `SELECT` クエリは同時に実行できますが、 `INSERT` クエリはお互いを待ちます。 +- 新しいファイルの作成に対応 `INSERT` クエリ。 +- ファイルが存在する場合, `INSERT` それに新しい値を追加します。 +- サポートなし: + - `ALTER` + - `SELECT ... SAMPLE` + - 指数 + - 複製 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/ja/engines/table-engines/special/generate.md b/docs/ja/engines/table-engines/special/generate.md new file mode 100644 index 00000000000..7a23ecac598 --- /dev/null +++ b/docs/ja/engines/table-engines/special/generate.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 46 +toc_title: GenerateRandom +--- + +# Generaterandom {#table_engines-generate} + +のgeneraterandomテーブルエンジンの生産ランダムなデータが与えられたテーブルのスキーマ. + +使用例: + +- 再現可能な大きいテーブルに住むテストの使用。 +- ファジングテストのランダム入力を生成します。 + +## Clickhouseサーバーでの使用状況 {#usage-in-clickhouse-server} + +``` sql +ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) +``` + +その `max_array_length` と `max_string_length` すべ +生成されたデータに対応する配列の列と文字列。 + +テーブル生成エンジンは `SELECT` クエリ。 + +対応して [データタイプ](../../../sql-reference/data-types/index.md) これは、以下を除いてテーブルに格納できます `LowCardinality` と `AggregateFunction`. + +**例えば:** + +**1.** セットアップ `generate_engine_table` テーブル: + +``` sql +CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) +``` + +**2.** データのクエリ: + +``` sql +SELECT * FROM generate_engine_table LIMIT 3 +``` + +``` text +┌─name─┬──────value─┐ +│ c4xJ │ 1412771199 │ +│ r │ 1791099446 │ +│ 7#$ │ 124312908 │ +└──────┴────────────┘ +``` + +## 実装の詳細 {#details-of-implementation} + +- サポートなし: + - `ALTER` + - `SELECT ... SAMPLE` + - `INSERT` + - 指数 + - 複製 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/ja/engines/table_engines/special/index.md b/docs/ja/engines/table-engines/special/index.md similarity index 100% rename from docs/ja/engines/table_engines/special/index.md rename to docs/ja/engines/table-engines/special/index.md diff --git a/docs/ja/engines/table-engines/special/join.md b/docs/ja/engines/table-engines/special/join.md new file mode 100644 index 00000000000..866ddd2a959 --- /dev/null +++ b/docs/ja/engines/table-engines/special/join.md @@ -0,0 +1,111 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u53C2\u52A0" +--- + +# 参加 {#join} + +Inを使用するための準備済みデータ構造 [JOIN](../../../sql-reference/statements/select.md#select-join) オペレーション + +## テーブルの作成 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], +) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) +``` + +の詳細な説明を参照してください [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) クエリ。 + +**エンジン変数** + +- `join_strictness` – [厳密に結合する](../../../sql-reference/statements/select.md#select-join-strictness). +- `join_type` – [結合タイプ](../../../sql-reference/statements/select.md#select-join-types). +- `k1[, k2, ...]` – Key columns from the `USING` その句 `JOIN` 操作はで行われる。 + +入力 `join_strictness` と `join_type` 引用符なしのパラメーター。, `Join(ANY, LEFT, col1)`. 彼らは `JOIN` テーブルが使用される操作。 パラメータが一致しない場合、ClickHouseは例外をスローせず、誤ったデータを返すことがあります。 + +## テーブルの使用法 {#table-usage} + +### 例えば {#example} + +左側のテーブルの作成: + +``` sql +CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog +``` + +``` sql +INSERT INTO id_val VALUES (1,11)(2,12)(3,13) +``` + +右側の作成 `Join` テーブル: + +``` sql +CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) +``` + +``` sql +INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) +``` + +テーブルの結合: + +``` sql +SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 +``` + +``` text +┌─id─┬─val─┬─id_val_join.val─┐ +│ 1 │ 11 │ 21 │ +│ 2 │ 12 │ ᴺᵁᴸᴸ │ +│ 3 │ 13 │ 23 │ +└────┴─────┴─────────────────┘ +``` + +代わりとして、データを取り出すことができます `Join` 結合キー値を指定するテーブル: + +``` sql +SELECT joinGet('id_val_join', 'val', toUInt32(1)) +``` + +``` text +┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ +│ 21 │ +└────────────────────────────────────────────┘ +``` + +### データの選択と挿入 {#selecting-and-inserting-data} + +を使用することができ `INSERT` データを追加するクエリ `Join`-エンジンテーブル。 テーブルが作成された場合 `ANY` 厳密さ、重複キーのデータは無視されます。 と `ALL` 厳密さは、すべての行が追加されます。 + +実行することはできません `SELECT` テーブルから直接クエリします。 代わりに、次のいずれかの方法を使用します: + +- テーブルをaの右側に置きます `JOIN` 句。 +- コールを [joinGet](../../../sql-reference/functions/other-functions.md#joinget) この関数を使用すると、テーブルからデータをディクショナリと同じ方法で抽出できます。 + +### 制限事項と設定 {#join-limitations-and-settings} + +テーブルを作成するときは、次の設定が適用されます: + +- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) +- [max\_rows\_in\_join](../../../operations/settings/query-complexity.md#settings-max_rows_in_join) +- [max\_bytes\_in\_join](../../../operations/settings/query-complexity.md#settings-max_bytes_in_join) +- [join\_overflow\_mode](../../../operations/settings/query-complexity.md#settings-join_overflow_mode) +- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) + +その `Join`-エンジンテーブルは使用できません `GLOBAL JOIN` オペレーション + +その `Join`-エンジンは、使用 [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) の設定 `CREATE TABLE` 声明。 と [SELECT](../../../sql-reference/statements/select.md) クエリは、使用を可能に `join_use_nulls` あまりにも。 あなたが持って異なる `join_use_nulls` 設定は、テーブルを結合エラーを得ることができます。 それは結合の種類に依存します。 使用するとき [joinGet](../../../sql-reference/functions/other-functions.md#joinget) 機能、同じを使用しなければなりません `join_use_nulls` の設定 `CRATE TABLE` と `SELECT` 文。 + +## データ記憶 {#data-storage} + +`Join` テーブルデータは常にRAMにあります。 を挿入する際、列表ClickHouseに書き込みデータブロックのディレクトリのディスクできるように復元され、サーバが再起動してしまいます。 + +場合はサーバが再起動誤り、データブロックのディスクがいます。 この場合、破損したデータを含むファイルを手動で削除する必要があります。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/ja/engines/table-engines/special/materializedview.md b/docs/ja/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..1e52922cae6 --- /dev/null +++ b/docs/ja/engines/table-engines/special/materializedview.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 43 +toc_title: MaterializedView +--- + +# Materializedview {#materializedview} + +マテリアライズドビューの実装に使用されます(詳細については、 [CREATE TABLE](../../../sql-reference/statements/create.md)). データを格納するために、ビューの作成時に指定された別のエンジンを使用します。 テーブルから読み取るときは、このエンジンを使用します。 + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/ja/engines/table_engines/special/memory.md b/docs/ja/engines/table-engines/special/memory.md similarity index 100% rename from docs/ja/engines/table_engines/special/memory.md rename to docs/ja/engines/table-engines/special/memory.md diff --git a/docs/ja/engines/table-engines/special/merge.md b/docs/ja/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..c88ec22cf3b --- /dev/null +++ b/docs/ja/engines/table-engines/special/merge.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: "\u30DE\u30FC\u30B8" +--- + +# マージ {#merge} + +その `Merge` エンジン(と混同しないように `MergeTree`)データ自体を格納しませんが、同時に他のテーブルの任意の数からの読み取りを可能にします。 +読書は自動的に平行である。 表への書き込みはサポートされません。 読み取り時には、実際に読み取られているテーブルのインデックスが存在する場合に使用されます。 +その `Merge` テーブルのデータベース名と正規表現です。 + +例えば: + +``` sql +Merge(hits, '^WatchLog') +``` + +データはテーブルから読み込まれます。 `hits` 正規表現に一致する名前を持つデータベース ‘`^WatchLog`’. + +データベース名の代わりに、文字列を返す定数式を使用できます。 例えば, `currentDatabase()`. + +Regular expressions — [re2unit description in lists](https://github.com/google/re2) (PCREのサブセットをサポート)、大文字と小文字を区別します。 +正規表現のエスケープシンボルに関する注意事項を参照してください。 “match” セクション。 + +読み込むテーブルを選択するとき、 `Merge` 正規表現と一致していても、テーブル自体は選択されません。 これはループを避けるためです。 +それは可能に作成二つ `Merge` お互いのデータを無限に読み取ろうとするテーブルですが、これは良い考えではありません。 + +使用する典型的な方法 `Merge` エンジンは多数を使用のためです `TinyLog` 単一のテーブルと同様にテーブル。 + +例2: + +古いテーブル(watchlog\_old)があり、データを新しいテーブル(watchlog\_new)に移動せずにパーティション分割を変更することにしたとしましょう。 + +``` sql +CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree(date, (UserId, EventType), 8192); +INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + +CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; +INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + +CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + +SELECT * +FROM WatchLog +``` + +``` text +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-01 │ 1 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-02 │ 2 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +``` + +## 仮想列 {#virtual-columns} + +- `_table` — Contains the name of the table from which data was read. Type: [文字列](../../../sql-reference/data-types/string.md). + + 定数条件を設定することができます `_table` で `WHERE/PREWHERE` 句(例えば, `WHERE _table='xyz'`). この場合、読み取り操作はそのテーブルに対してのみ実行されます。 `_table` は満足しているので、 `_table` 列は索引として機能します。 + +**また見なさい** + +- [仮想列](index.md#table_engines-virtual_columns) + +[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/ja/engines/table_engines/special/null.md b/docs/ja/engines/table-engines/special/null.md similarity index 100% rename from docs/ja/engines/table_engines/special/null.md rename to docs/ja/engines/table-engines/special/null.md diff --git a/docs/ja/engines/table_engines/special/set.md b/docs/ja/engines/table-engines/special/set.md similarity index 100% rename from docs/ja/engines/table_engines/special/set.md rename to docs/ja/engines/table-engines/special/set.md diff --git a/docs/ja/engines/table_engines/special/url.md b/docs/ja/engines/table-engines/special/url.md similarity index 100% rename from docs/ja/engines/table_engines/special/url.md rename to docs/ja/engines/table-engines/special/url.md diff --git a/docs/ja/engines/table_engines/special/view.md b/docs/ja/engines/table-engines/special/view.md similarity index 100% rename from docs/ja/engines/table_engines/special/view.md rename to docs/ja/engines/table-engines/special/view.md diff --git a/docs/ja/engines/table_engines/index.md b/docs/ja/engines/table_engines/index.md deleted file mode 100644 index 39ccd66eaa7..00000000000 --- a/docs/ja/engines/table_engines/index.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Table Engines -toc_priority: 26 -toc_title: "\u5C0E\u5165" ---- - -# 表エンジン {#table_engines} - -表エンジン(表のタイプ: - -- どのようにデータが格納されている場所、それをどこに書き込むか、どこから読み込むか。 -- どのクエリがサポートされ、どのように。 -- 同時データアクセス。 -- インデックスが存在する場合の使用。 -- マルチスレッドリクエストの実行が可能かどうか。 -- データ複製パラメーター。 - -## エンジン家族 {#engine-families} - -### Mergetree {#mergetree} - -高負荷仕事のための最も普遍的な、機能テーブルエンジン。 本物件の共有によるこれらのエンジンには迅速にデータを挿入とその後のバックグラウンドデータを処となります。 `MergeTree` 家族のエンジンの支援データレプリケーション( [複製された\*](mergetree_family/replication.md) バージョンのエンジン)分割、その他の機能で対応していないその他のエンジンです。 - -家族のエンジン: - -- [MergeTree](mergetree_family/mergetree.md) -- [ツつィツ姪"ツつ"ツ債ツつケ](mergetree_family/replacingmergetree.md) -- [SummingMergeTree](mergetree_family/summingmergetree.md) -- [ツつィツ姪"ツつ"ツ債ツづュツつケ](mergetree_family/aggregatingmergetree.md) -- [CollapsingMergeTree](mergetree_family/collapsingmergetree.md) -- [VersionedCollapsingMergeTree](mergetree_family/versionedcollapsingmergetree.md) -- [グラフィットメールグツリー](mergetree_family/graphitemergetree.md) - -### ログ {#log} - -軽量 [エンジン](log_family/index.md) 最低の機能性を使って。 多くの小さなテーブル(約1万行まで)をすばやく作成し、後でそれらを全体として読み取る必要がある場合、これらは最も効果的です。 - -家族のエンジン: - -- [TinyLog](log_family/tinylog.md) -- [ストリップログ](log_family/stripelog.md) -- [ログ](log_family/log.md) - -### 統合エンジン {#integration-engines} - -エンジン用プリケーションデータストレージと処理システム。 - -家族のエンジン: - -- [カフカname](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) -- [HDFS](integrations/hdfs.md) - -### 特殊エンジン {#special-engines} - -家族のエンジン: - -- [分散](special/distributed.md) -- [MaterializedView](special/materializedview.md) -- [辞書](special/dictionary.md) -- [マージ](special/merge.md) -- [ファイル](special/file.md) -- [ヌル](special/null.md) -- [セット](special/set.md) -- [参加](special/join.md) -- [URL](special/url.md) -- [ビュー](special/view.md) -- [メモリ](special/memory.md) -- [バッファ](special/buffer.md) - -## 仮想列 {#table_engines-virtual-columns} - -Virtual columnは、エンジンのソースコードで定義されているテーブルエンジンの属性です。 - -仮想列を指定しないでください。 `CREATE TABLE` クエリとあなたはそれらを見るこ `SHOW CREATE TABLE` と `DESCRIBE TABLE` クエリ結果。 仮想列も読み取り専用であるため、仮想列にデータを挿入することはできません。 - -仮想カラムからデータを選択するには、仮想カラムの名前を指定する必要があります。 `SELECT` クエリ。 `SELECT *` 仮想列から値を返しません。 - -テーブル仮想列のいずれかと同じ名前の列を持つテーブルを作成すると、仮想列にアクセスできなくなります。 これはお勧めしません。 競合を回避するために、通常、仮想列名にはアンダースコアが付加されます。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/ja/engines/table_engines/integrations/hdfs.md b/docs/ja/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index 501f9210748..00000000000 --- a/docs/ja/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: HDFS ---- - -# HDFS {#table_engines-hdfs} - -このエンジンは、 [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) データの管理を可能にすることによって生態系 [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)クリックハウス経由。 このエンジンは同様です -に [ファイル](../special/file.md) と [URL](../special/url.md) エンジンが、Hadoop固有の機能を提供します。 - -## 使い方 {#usage} - -``` sql -ENGINE = HDFS(URI, format) -``` - -その `URI` parameterは、HDFSのファイルURI全体です。 -その `format` パラメータを指定するか、ファイルのファイルフォーマット 実行するには -`SELECT` クエリは、形式は、入力のためにサポートされ、実行する必要があります -`INSERT` queries – for output. The available formats are listed in the -[形式](../../../interfaces/formats.md#formats) セクション。 -のパス部分 `URI` グロブを含む可能性があります。 この場合、テーブルは読み取り専用になります。 - -**例えば:** - -**1.** セットアップ `hdfs_engine_table` テーブル: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** Fillファイル: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** データのクエリ: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## 実装の詳細 {#implementation-details} - -- 読み書きできる並列 -- サポートなし: - - `ALTER` と `SELECT...SAMPLE` オペレーション - - インデックス。 - - 複製だ - -**パス内のグロブ** - -複数のパスコンポーネン のための処理中のファイルが存在するマッチのパスのパターンです。 ファイルのリストは、 `SELECT` (ないで `CREATE` 瞬間)。 - -- `*` — Substitutes any number of any characters except `/` 空の文字列を含む。 -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -構造との `{}` に類似していて下さい [リモート](../../../sql_reference/table_functions/remote.md) テーブル機能。 - -**例えば** - -1. HDFSに次のUriを持つTSV形式のファイルがいくつかあるとします: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. あはいくつかの方法が考えられているテーブルの構成は、すべてのファイル: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -別の方法: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -テーブルはすべてのファイルの両方のディレクトリ(すべてのファイルが満たすべき書式は、スキーマに記載のクエリ): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "警告" - ファイルのリストに先行するゼロが付いた数値範囲が含まれている場合は、各桁ごとに中かっこで囲みます。 `?`. - -**例えば** - -このように作成されたテーブルとファイル名 `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') -``` - -## 仮想列 {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**また見なさい** - -- [仮想列](../index.md#table_engines-virtual_columns) - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/ja/engines/table_engines/integrations/jdbc.md b/docs/ja/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index 994ef54e330..00000000000 --- a/docs/ja/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: JDBC ---- - -# JDBC {#table-engine-jdbc} - -ClickHouseが外部データベースに接続できるようにします [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -JDBC接続を実装するには、ClickHouseは別のプログラムを使用します [clickhouse-jdbc橋](https://github.com/alex-krash/clickhouse-jdbc-bridge) うにしてくれました。 - -このエンジンは、 [Nullable](../../../sql_reference/data_types/nullable.md) データ型。 - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -( - columns list... -) -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**エンジン変数** - -- `dbms_uri` — URI of an external DBMS. - - 書式: `jdbc:://:/?user=&password=`. - MySQLの例: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — Database in an external DBMS. - -- `external_table` — Name of the table in `external_database`. - -## 使用例 {#usage-example} - -コンソールクライアントと直接接続してmysqlサーバーにテーブルを作成する: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ClickHouseサーバーでテーブルを作成し、そこからデータを選択する: - -``` sql -CREATE TABLE jdbc_table -( - `int_id` Int32, - `int_nullable` Nullable(Int32), - `float` Float32, - `float_nullable` Nullable(Float32) -) -ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## また見なさい {#see-also} - -- [JDBCテーブル関数](../../../sql_reference/table_functions/jdbc.md). - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/ja/engines/table_engines/integrations/kafka.md b/docs/ja/engines/table_engines/integrations/kafka.md deleted file mode 100644 index 08145832183..00000000000 --- a/docs/ja/engines/table_engines/integrations/kafka.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 32 -toc_title: "\u30AB\u30D5\u30ABname" ---- - -# カフカname {#kafka} - -このエンジンは [アパッチ-カフカ](http://kafka.apache.org/). - -カフカはあなたを可能にします: - -- データフローを公開または購読する。 -- 整理-フォールトトレラント保管します。 -- プロセスストリームが使用可能になるとき。 - -## テーブルの作成 {#table_engine-kafka-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = Kafka() -SETTINGS - kafka_broker_list = 'host:port', - kafka_topic_list = 'topic1,topic2,...', - kafka_group_name = 'group_name', - kafka_format = 'data_format'[,] - [kafka_row_delimiter = 'delimiter_symbol',] - [kafka_schema = '',] - [kafka_num_consumers = N,] - [kafka_skip_broken_messages = N] -``` - -必須パラメータ: - -- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). -- `kafka_topic_list` – A list of Kafka topics. -- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don't want messages to be duplicated in the cluster, use the same group name everywhere. -- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` 機能、のような `JSONEachRow`. 詳細については、 [形式](../../../interfaces/formats.md) セクション。 - -任意変数: - -- `kafka_row_delimiter` – Delimiter character, which ends the message. -- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap'n Proto](https://capnproto.org/) スキーマファイルへのパスとルートの名前が必要です `schema.capnp:Message` オブジェクト。 -- `kafka_num_consumers` – The number of consumers per table. Default: `1`. 指定しこれからも、多くの消費者の場合、スループットの消費が不足しています。 の総数消費者を超えることはできませんパーティションの数の問題から一つだけの消費者割り当てることができた。 -- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. もし `kafka_skip_broken_messages = N` その後、エンジンはスキップ *N* 解析できないKafkaメッセージ(メッセージはデータの行と同じです)。 - -例: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - SELECT * FROM queue LIMIT 5; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') - SETTINGS kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; -``` - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 用途では使用しないでください方法で新規プロジェクト. 可能であれば、古いプロジェクトを上記の方法に切り替えます。 - -``` sql -Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format - [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) -``` - -
- -## 説明 {#description} - -届いたメッセージは自動的に追跡で、それぞれのメッセージグループでは数えます。 データを取得したい場合は、別のグループ名を持つテーブルのコピーを作成します。 - -グループは柔軟で、クラスター上で同期されます。 たとえば、クラスター内のテーブルの10のトピックと5つのコピーがある場合、各コピーは2つのトピックを取得します。 コピー数が変更されると、トピックは自動的にコピー全体に再配布されます。 これについての詳細を読むhttp://kafka.apache.org/intro。 - -`SELECT` は特に役立つメッセージを読む(以外のデバッグ)では、それぞれのメッセージでしか読み込むことができます。 ではより実践的な創出の実時間スレッドを実現します。 これを行うには: - -1. エンジンを使用してkafkaコンシューマーを作成し、データストリームとみなします。 -2. 目的の構造を持つテーブルを作成します。 -3. を実現しュに変換するデータからのエンジンを入れていたとして作成されます。 - -とき `MATERIALIZED VIEW` 入、エンジンでデータを収集しみいただけます。 これにより、Kafkaからメッセージを継続的に受信し、必要な形式に変換することができます `SELECT`. -このようにして、異なる詳細レベル(grouping-aggregation and without)を持つ複数のテーブルに書き込むことができます。 - -例えば: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - CREATE TABLE daily ( - day Date, - level String, - total UInt64 - ) ENGINE = SummingMergeTree(day, (day, level), 8192); - - CREATE MATERIALIZED VIEW consumer TO daily - AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total - FROM queue GROUP BY day, level; - - SELECT level, sum(total) FROM daily GROUP BY level; -``` - -受信したメッ [max\_insert\_block\_size](../../../operations/server_configuration_parameters/settings.md#settings-max_insert_block_size). ブロックが内に形成されなかった場合 [stream\_flush\_interval\_ms](../../../operations/server_configuration_parameters/settings.md) ミリ秒では、データはブロックの完全性に関係なくテーブルにフラッシュされます。 - -リクエストを受けた話題のデータは変更に変換ロジック、切り離しを実現ビュー: - -``` sql - DETACH TABLE consumer; - ATTACH TABLE consumer; -``` - -ターゲットテーブルを次のように変更する場合 `ALTER` お勧めいたしま字の材質ビューを避ける異なるターゲットテーブルのデータからの眺め。 - -## 設定 {#configuration} - -GraphiteMergeTreeと同様に、KafkaエンジンはClickHouse configファイルを使用した拡張構成をサポートしています。 使用できる設定キーは二つあります:global (`kafka`)とトピックレベル (`kafka_*`). グローバル構成が最初に適用され、トピックレベル構成が適用されます(存在する場合)。 - -``` xml - - - cgrp - smallest - - - - - 250 - 100000 - -``` - -可能な構成オプションの一覧については、 [librdkafka設定リファレンス](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). アンダースコアを使う (`_`)ClickHouse構成のドットの代わりに。 例えば, `check.crcs=true` されます `true`. - -## 仮想列 {#virtual-columns} - -- `_topic` — Kafka topic. -- `_key` — Key of the message. -- `_offset` — Offset of the message. -- `_timestamp` — Timestamp of the message. -- `_partition` — Partition of Kafka topic. - -**また見なさい** - -- [仮想列](../index.md#table_engines-virtual_columns) - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/ja/engines/table_engines/integrations/mysql.md b/docs/ja/engines/table_engines/integrations/mysql.md deleted file mode 100644 index 0f4582645eb..00000000000 --- a/docs/ja/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: MySQL ---- - -# Mysql {#mysql} - -MySQLエンジンでは、次の操作を実行できます `SELECT` リモートMySQLサーバーに格納されているデータを照会します。 - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... -) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -の詳細な説明を参照してください [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) クエリ。 - -テーブル構造は元のmysqlテーブル構造とは異なる場合があります: - -- 列名は元のmysqlテーブルと同じでなければなりませんが、これらの列の一部だけを任意の順序で使用できます。 -- カラムの型は、元のmysqlテーブルの型と異なる場合があります。 クリックハウスは [キャスト](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) クリックハウスのデータ型への値。 - -**エンジン変数** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` へのクエリ `REPLACE INTO`. もし `replace_query=1` クエリは置換されます。 - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` に追加される式 `INSERT` クエリ。 - - 例えば: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`、どこ `on_duplicate_clause` は `UPDATE c2 = c2 + 1`. を見る [MySQLの文書](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) これを見つけるには `on_duplicate_clause` あなたはで使用することができ `ON DUPLICATE KEY` 句。 - - 指定するには `on_duplicate_clause` 合格する必要があります `0` に `replace_query` パラメータ。 あなたが同時に渡す場合 `replace_query = 1` と `on_duplicate_clause`、ClickHouseは例外を生成します。 - -シンプル `WHERE` 次のような句 `=, !=, >, >=, <, <=` MySQLサーバで実行されます。 - -残りの条件と `LIMIT` サンプリング制約は、MySQLへのクエリが終了した後にのみClickHouseで実行されます。 - -## 使用例 {#usage-example} - -MySQLのテーブル: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ClickHouseのテーブル、上記で作成したMySQLテーブルからデータを取得する: - -``` sql -CREATE TABLE mysql_table -( - `float_nullable` Nullable(Float32), - `int_id` Int32 -) -ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` sql -SELECT * FROM mysql_table -``` - -``` text -┌─float_nullable─┬─int_id─┐ -│ ᴺᵁᴸᴸ │ 1 │ -└────────────────┴────────┘ -``` - -## また見なさい {#see-also} - -- [その ‘mysql’ テーブル機能](../../../sql_reference/table_functions/mysql.md) -- [MySQLを外部辞書のソースとして使用する](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/ja/engines/table_engines/integrations/odbc.md b/docs/ja/engines/table_engines/integrations/odbc.md deleted file mode 100644 index 600e502999f..00000000000 --- a/docs/ja/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: ODBC ---- - -# ODBC {#table-engine-odbc} - -ClickHouseが外部データベースに接続できるようにします [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -ODBC接続を安全に実装するには、ClickHouseは別のプログラムを使用します `clickhouse-odbc-bridge`. ODBCドライバーが直接読み込まれている場合 `clickhouse-server` ドライバの問題でクラッシュのClickHouseサーバーです。 クリックハウスが自動的に起動 `clickhouse-odbc-bridge` それが必要なとき。 ODBCブリッジプログラムは、次のパッケージと同じパッケー `clickhouse-server`. - -このエンジンは、 [Nullable](../../../sql_reference/data_types/nullable.md) データ型。 - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -の詳細な説明を参照してください [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) クエリ。 - -のテーブル構造が異なるソースからテーブル構造: - -- 列名はソーステーブルと同じにする必要がありますが、これらの列の一部だけを任意の順序で使用できます。 -- 列の型は、ソーステーブルの型と異なる場合があります。 クリックハウスは [キャスト](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) クリックハウスのデータ型への値。 - -**エンジン変数** - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` ファイル。 -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -## 使用例 {#usage-example} - -**ODBC経由でローカルMySQLインストールからデータを取得** - -この例は、ubuntu linux18.04およびmysql server5.7で確認されています。 - -UnixODBCとMySQL Connectorがインストールされていることを確認します。 - -デフォルトでインストールされた場合、パッケージから),clickhouse開始してユーザー `clickhouse`. したがって、MySQLサーバでこのユーザを作成して設定する必要があります。 - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -次に、接続を設定します `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -を使用して接続を確認することができ `isql` unixODBCインストールからのユーティリティ。 - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -MySQLのテーブル: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ClickHouseのテーブル、MySQLテーブルからデータを取得する: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## また見なさい {#see-also} - -- [ODBC外部辞書](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBCテーブル関数](../../../sql_reference/table_functions/odbc.md) - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/ja/engines/table_engines/log_family/log.md b/docs/ja/engines/table_engines/log_family/log.md deleted file mode 100644 index 2d3dce244f8..00000000000 --- a/docs/ja/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: "\u30ED\u30B0" ---- - -# ログ {#log} - -エンジンは、ログエンジンの家族に属します。 ログエンジ [丸太エンジン家族](log_family.md) 記事。 - -ログとは異なります [TinyLog](tinylog.md) その中での小さなファイル “marks” 列ファイルに常駐します。 これらのマークはすべてのデータブロックに書き込まれ、指定された行数をスキップするためにファイルの読み取りを開始する場所を示すオフセッ この読み取りを可能にする機能がありテーブルデータを複数のスレッド)。 -同時データアクセスの場合、読み取り操作は同時に実行でき、書き込み操作は読み取りをブロックします。 -ログのエンジンなスを作成します。 同様に、執筆する場合はテーブルに失敗したり、テーブルに破からの読み出しでエラーを返します。 ログのエンジンは適切な一時データ書き込み回のテーブルの試験-デモンストレーション。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/ja/engines/table_engines/log_family/log_family.md b/docs/ja/engines/table_engines/log_family/log_family.md deleted file mode 100644 index 9fbdeb11064..00000000000 --- a/docs/ja/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 31 -toc_title: "\u5C0E\u5165" ---- - -# 丸太エンジン家族 {#log-engine-family} - -これらのエンジンは、多くの小さなテーブル(最大約1万行)をすばやく作成し、後で全体として読む必要があるシナリオ用に開発されました。 - -家族のエンジン: - -- [ストリップログ](stripelog.md) -- [ログ](log.md) -- [TinyLog](tinylog.md) - -## 一般的なプロパティ {#common-properties} - -エンジン: - -- ディスク上のデータを格納します。 - -- 書き込み時にファイルの末尾にデータを追加します。 - -- 同時データアクセスのサポートロック。 - - の間 `INSERT` クエリのテーブルがロックされ、その他の質問を読み込みおよび書き込みデータの両方のテーブルを作成する データ書き込みクエリがない場合は、任意の数のデータ読み取りクエリを同時に実行できます。 - -- ないサポート [突然変異](../../../sql_reference/statements/alter.md#alter-mutations) オペレーション - -- 索引をサポートしない。 - - これは、 `SELECT` データ範囲のクエリは効率的ではありません。 - -- データを原子的に書き込まない。 - - 取得できるテーブルデータが破損した場合も破れ、書き込み操作は、例えば、異常サーバをシャットダウンしました。 - -## 違い {#differences} - -その `TinyLog` エンジンは家族の最も簡単で、最も貧しい機能性および最も低い効率を提供する。 その `TinyLog` エンジンをサポートしていない並列データの読み取りによる複数のスレッド)。 それは、並列読み取りをサポートするファミリ内の他のエンジンよりも遅いデータを読み取り、 `Log` エンジンは、各列を別々のファイルに格納するためです。 シンプルな低負荷シナリオで使用します。 - -その `Log` と `StripeLog` エンジンは平行データ読書を支える。 デー 各スレ その `Log` エンジンは、テーブルの各列に別々のファイルを使用します。 `StripeLog` すべてのデータファイルです。 その結果、 `StripeLog` エンジン用の少ない記述子に、経営システムが、 `Log` エンジンはデータを読むとき高性能を提供する。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/ja/engines/table_engines/log_family/stripelog.md b/docs/ja/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index 98d2c099ef7..00000000000 --- a/docs/ja/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 32 -toc_title: "\u30B9\u30C8\u30EA\u30C3\u30D7\u30ED\u30B0" ---- - -# ストリップログ {#stripelog} - -このエン ログエンジ [丸太エンジン家族](log_family.md) 記事。 - -少量のデータ(1万行未満)を含む多数のテーブルを作成する必要がある場合は、このエンジンをシナリオで使用します。 - -## テーブルの作成 {#table_engines-stripelog-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = StripeLog -``` - -の詳細な説明を参照してください [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) クエリ。 - -## データの書き込み {#table_engines-stripelog-writing-the-data} - -その `StripeLog` エンジンの店舗のすべての列を一つのファイルです。 それぞれの `INSERT` クエリ、ClickHouseは、列を一つずつ書き込み、テーブルファイルの最後にデータブロックを追加します。 - -各テーブルclickhouseに書き込み中のファイル: - -- `data.bin` — Data file. -- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. - -その `StripeLog` エンジンはサポートしません `ALTER UPDATE` と `ALTER DELETE` オペレーション - -## データの読み込み {#table_engines-stripelog-reading-the-data} - -ファイルをマークでclickhouseを並列化したデータです。 これは、 `SELECT` クエリは、予期しない順序で行を返します。 を使用 `ORDER BY` 行をソートする句。 - -## 使用例 {#table_engines-stripelog-example-of-use} - -テーブルの作成: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -データの挿入: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -私たちは二つの `INSERT` データブロックを作成するためのクエリ `data.bin` ファイル。 - -ClickHouse利用は、複数のスレッド選択時のデータです。 各スレッドを読み込み、別のデータブロックを返しますよ列として自立で終了します。 結果として、出力の行のブロックの順序は、ほとんどの場合、入力の同じブロックの順序と一致しません。 例えば: - -``` sql -SELECT * FROM stripe_log_table -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -┌───────────timestamp─┬─message_type─┬─message───────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -└─────────────────────┴──────────────┴───────────────────────────┘ -``` - -結果の並べ替え(デフォルトでは昇順): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/ja/engines/table_engines/log_family/tinylog.md b/docs/ja/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index e3237915cf2..00000000000 --- a/docs/ja/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: TinyLog ---- - -# TinyLog {#tinylog} - -エンジンはログエンジンファミリに属します。 見る [丸太エンジン家族](log_family.md) ログエンジンとその違いの一般的な特性のために。 - -このテーブルエンジンは、通常、write-onceメソッドで使用されます。 たとえば、次のものを使用できます `TinyLog`-小さなバッチで処理される中間データのテーブルを入力します。 多数の小さなテーブルにデータを格納することは非効率的です。 - -クエリは単一のストリームで実行されます。 言い換えれば、このエンジンは比較的小さなテーブル(約1,000,000行まで)を対象としています。 小さなテーブルがたくさんある場合は、このテーブルエンジンを使用するのが理にかなっています。 [ログ](log.md) エンジン(少数のファイルは開く必要があります)。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/ja/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/ja/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index c7ac73d902b..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: "\uFF82\u3064\uFF68\uFF82\u59EA\"\uFF82\u3064\"\uFF82\u50B5\uFF82\u3065\ - \uFF6D\uFF82\u3064\uFF79" ---- - -# ツつィツ姪"ツつ"ツ債ツづュツつケ {#aggregatingmergetree} - -エンジンは [MergeTree](mergetree.md#table_engines-mergetree)、データパーツのマージのロジックを変更する。 ClickHouseは、すべての行を同じ主キー(またはより正確には同じ)で置き換えます [ソートキー](mergetree.md))集計関数の状態の組み合わせを格納する単一の行(一つのデータ部門内)。 - -を使用することができ `AggregatingMergeTree` テーブルが増えた場合のデータ収集、集計を実現します。 - -エンジンプロセスの全てのカラム [AggregateFunction](../../../sql_reference/data_types/aggregatefunction.md) タイプ。 - -使用するのが適切です `AggregatingMergeTree` 注文によって行数が減る場合。 - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[TTL expr] -[SETTINGS name=value, ...] -``` - -説明リクエストパラメータの参照 [要求の説明](../../../sql_reference/statements/create.md). - -**クエリ句** - -作成するとき `AggregatingMergeTree` テーブル同じ [句](mergetree.md) 作成するときと同じように、必須です。 `MergeTree` テーブル。 - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -すべてのパラメーターの意味は、次のようになります `MergeTree`. -
- -## 選択して挿入 {#select-and-insert} - -データを挿入するには [INSERT SELECT](../../../sql_reference/statements/insert_into.md) aggregate-State-functionsを使用したクエリ。 -データを選択するとき `AggregatingMergeTree` テーブル、使用 `GROUP BY` 句とデータを挿入するときと同じ集約関数が、 `-Merge` 接尾辞。 - -の結果で `SELECT` クエリ、値の `AggregateFunction` タイプは、すべてのClickHouse出力形式に対して実装固有のバイナリ表現を持ちます。 たとえば、データをダンプする場合, `TabSeparated` フォーマット `SELECT` このダンプは、次のようにロードされます `INSERT` クエリ。 - -## 集約マテリアライズドビューの例 {#example-of-an-aggregated-materialized-view} - -`AggregatingMergeTree` マテリアライズドビュー `test.visits` テーブル: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -データを挿入する `test.visits` テーブル。 - -``` sql -INSERT INTO test.visits ... -``` - -データは、テーブルとビューの両方に挿入されます `test.basic` それは集約を実行します。 - -集計データを取得するには、次のようなクエリを実行する必要があります `SELECT ... GROUP BY ...` ビューから `test.basic`: - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/ja/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/ja/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index 65cc225eac7..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: CollapsingMergeTree ---- - -# Collapsingmergetree {#table_engine-collapsingmergetree} - -エンジンは [MergeTree](mergetree.md) 加算の論理行の崩壊データ部品の統合アルゴリズムです。 - -`CollapsingMergeTree` 並べ替えキー内のすべてのフィールドの場合、行のペアを非同期的に削除(折りたたみ)します (`ORDER BY`)は、特定のフィールドを除いて同等です `Sign` これは `1` と `-1` 値。 ペアのない行は保持されます。 詳細については、 [折りたたみ](#table_engine-collapsingmergetree-collapsing) 文書のセクション。 - -エンジンはかなり貯蔵の容積を減らし、効率をの高めるかもしれません `SELECT` 結果としてのクエリ。 - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -説明のクエリパラメータは、 [クエリの説明](../../../sql_reference/statements/create.md). - -**CollapsingMergeTreeパラメータ** - -- `sign` — Name of the column with the type of row: `1` は “state” 行, `-1` は “cancel” 行 - - Column data type — `Int8`. - -**クエリ句** - -作成するとき `CollapsingMergeTree` テーブル、同じ [クエリ句](mergetree.md#table_engine-mergetree-creating-a-table) 作成するときと同じように、必須です。 `MergeTree` テーブル。 - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -すべてのパラメーターを除く `sign` と同じ意味を持つ `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` — “state” 行, `-1` — “cancel” 行 - - Column Data Type — `Int8`. - -
- -## 折りたたみ {#table_engine-collapsingmergetree-collapsing} - -### データ {#data} - -あるオブジェクトのデータを継続的に変更する必要がある状況を考えてみましょう。 これは、オブジェクトのための一つの行を持っており、任意の変更でそれを更新する論理的に聞こえるが、更新操作は、ストレージ内のデータの書き換え が必要な場合にデータを書き込むには、迅速に更新できませんが、きの変化をオブジェクトの順にしております。 - -特定の列を使用する `Sign`. もし `Sign = 1` これは、行がオブジェクトの状態であることを意味します。 “state” 行 もし `Sign = -1` これは、同じ属性を持つオブジェクトの状態の取り消しを意味し、それを呼び出しましょう “cancel” 行 - -例えば、しい計算のページのユーザーかサイトは、長くご愛用いただけると思いがあります。 ある時点で、ユーザーアクティビティの状態で次の行を書きます: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -しばらくして、ユーザーアクティビティの変更を登録し、次の二つの行を書き込みます。 - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -最初の行は、オブジェクト(user)の前の状態を取り消します。 取り消された状態の並べ替えキーフィールドをコピーします `Sign`. - -次の行には、現在の状態が含まれています。 - -ユーザーアクティビティの最後の状態だけが必要なので、行 - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -オブジェクトの無効な(古い)状態を崩壊させることを削除することができます。 `CollapsingMergeTree` これは、データ部分のマージ中に行います。 - -なぜ私たちは必要2行の各変更のために読む [Algorithm](#table_engine-collapsingmergetree-collapsing-algorithm) 段落。 - -**そのようなアプローチ** - -1. プログラムを書き込み、データ意のオブジェクトをキャンセルはできます。 “Cancel” 文字列はコピーのソートキーの分野において “state” 文字列とその逆 `Sign`. この増加の初期サイズでの保存が可能なデータを書き込む。 -2. 列の長い配列は、書き込みの負荷によるエンジンの効率を低下させます。 より簡単なデータ、より高い効率。 -3. その `SELECT` 結果は、オブジェクトの変更履歴の整合性に強く依存します。 挿入するデータを準備するときは正確です。 たとえば、セッションの深さなどの負でない指標の負の値などです。 - -### Algorithm {#table_engine-collapsingmergetree-collapsing-algorithm} - -ClickHouseがデータパーツをマージすると、同じソートキーを持つ連続した行の各グループ (`ORDER BY` これは、以下の二つの行に縮小されています。 `Sign = 1` (“state” 行)と別の `Sign = -1` (“cancel” 行)。 言い換えれば、エントリは崩壊する。 - -それぞれの結果のデータ部分clickhouse保存: - -1. 最初の “cancel” そして最後の “state” 行の数が “state” と “cancel” 行は一致し、最後の行はaです “state” 行 - -2. 最後の “state” 行、より多くのがある場合 “state” 行よりも “cancel” 行。 - -3. 最初の “cancel” 行、より多くのがある場合 “cancel” 行よりも “state” 行。 - -4. 他のすべてのケースでは、行はありません。 - -また、少なくとも2以上がある場合 “state” 行よりも “cancel” 行、または少なくとも2以上 “cancel” その後の行 “state” ただし、ClickHouseはこの状況を論理エラーとして扱い、サーバーログに記録します。 このエラーは、同じデータが複数回挿入された場合に発生します。 - -したがって、崩壊は統計の計算結果を変更すべきではありません。 -変更は徐々に崩壊し、最終的にはほぼすべてのオブジェクトの最後の状態だけが残った。 - -その `Sign` マージアルゴリズムは、同じソートキーを持つすべての行が同じ結果のデータ部分にあり、同じ物理サーバー上にあることを保証するものではないため、必須で ClickHouse過程 `SELECT` 複数のスレッドを持つクエリは、結果の行の順序を予測することはできません。 完全に取得する必要がある場合は、集計が必要です “collapsed” からのデータ `CollapsingMergeTree` テーブル。 - -折りたたみを完了するには、次のクエリを記述します `GROUP BY` この符号を考慮する句および集計関数。 たとえば、数量を計算するには、以下を使用します `sum(Sign)` 代わりに `count()`. 何かの合計を計算するには、次のようにします `sum(Sign * x)` 代わりに `sum(x)`、など、とも追加 `HAVING sum(Sign) > 0`. - -凝集体 `count`, `sum` と `avg` この方法で計算できます。 合計 `uniq` 算出できる場合にはオブジェクトは、少なくとも一つの状態はまだ崩れていない。 凝集体 `min` と `max` 以下の理由で計算できませんでした `CollapsingMergeTree` 折りたたまれた状態の値の履歴は保存されません。 - -集計せずにデータを抽出する必要がある場合(たとえば、最新の値が特定の条件に一致する行が存在するかどうかをチェックする場合)は、次のように `FINAL` のための修飾語 `FROM` 句。 このアプローチは大幅に少ない効率的です。 - -## 使用例 {#example-of-use} - -データ例: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -テーブルの作成: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -データの挿入: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -私たちは二つを使う `INSERT` 二つの異なるデータ部分を作成するクエリ。 また、データの挿入につクエリClickHouseを一つのデータ部分を行いませんが合併します。 - -データの取得: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -私たちは何を見て、どこで崩壊していますか? - -二つの `INSERT` クエリーを作成し、2つのデータ部品です。 その `SELECT` クエリは2つのスレッドで実行され、ランダムな行の順序が得られました。 データ部分のマージがまだなかったため、折りたたみは発生しません。 ClickHouseは予測できない未知の瞬間にデータ部分をマージします。 - -このようにして集計: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -集約を必要とせず、強制的に崩壊させたい場合は、以下を使用できます `FINAL` の修飾子 `FROM` 句。 - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -データを選択するこの方法は非常に非効率的です。 大きなテーブルには使用しないでください。 - -## 別のアプローチの例 {#example-of-another-approach} - -データ例: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ -5 │ -146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -アイデアは、マージが唯一のキーフィールドを考慮することです。 そして、 “Cancel” 行符号列を使用せずに合計すると、行の以前のバージョンを等しくする負の値を指定できます。 この方法では、データ型を変更する必要があります `PageViews`,`Duration` UInt8-\>Int16の負の値を格納します。 - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews Int16, - Duration Int16, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -アプローチをテストしよう: - -``` sql -insert into UAct values(4324182021466249494, 5, 146, 1); -insert into UAct values(4324182021466249494, -5, -146, -1); -insert into UAct values(4324182021466249494, 6, 185, 1); - -select * from UAct final; // avoid using final in production (just for a test or small tables) -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -``` sql -SELECT - UserID, - sum(PageViews) AS PageViews, - sum(Duration) AS Duration -FROM UAct -GROUP BY UserID -```text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -``` sqk -select count() FROM UAct -``` - -``` text -┌─count()─┐ -│ 3 │ -└─────────┘ -``` - -``` sql -optimize table UAct final; - -select * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/ja/engines/table_engines/mergetree_family/custom_partitioning_key.md b/docs/ja/engines/table_engines/mergetree_family/custom_partitioning_key.md deleted file mode 100644 index ced7707e770..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 32 -toc_title: "\u30AB\u30B9\u30BF\u30E0\u5206\u5272\u30AD\u30FC" ---- - -# カスタム分割キー {#custom-partitioning-key} - -パーティション分割は [MergeTree](mergetree.md) ファミリーテーブル [複製された](replication.md) テーブル)。 [マテリアライズ表示](../special/materializedview.md) に基づくMergeTreeテーブル支援を分割します。 - -パーティションが論理的に組み合わせの記録テーブルに指定された評価のポイントになります。 パーティションは、月別、日別、またはイベントタイプ別など、任意の基準によって設定できます。 各パーティションは別に保存される簡単操作のデータです。 アクセス時のデータclickhouseの最小サブセットのパーティションは可能です。 - -パーティションは `PARTITION BY expr` 節とき [テーブルの作成](mergetree.md#table_engine-mergetree-creating-a-table). これはパーティションキーにすることはでき表現からのテーブル列あります。 例えば、指定ョ月の表現を使用 `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour; -``` - -これはパーティションキーもできるタプルの表現を [主キー](mergetree.md#primary-keys-and-indexes-in-queries)). 例えば: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -この例では、現在の週に発生したイベントタイプによるパーティション分割を設定します。 - -テーブルに新しいデータを挿入すると、このデータは主キーでソートされた別の部分(チャンク)として格納されます。 挿入後10-15分で、同じパーティションのパーツがパート全体にマージされます。 - -!!! info "情報" - Mergeは、パーティショニング式と同じ値を持つデータパーツに対してのみ機能します。 これは **なんかを過度に粒状仕切り** (約千パーティション以上)。 それ以外の場合は、 `SELECT` クエリは、ファイルシステムとオープンファイル記述子のファイルの不当に大きな数のために不十分な実行します。 - -を使用 [システム。パーツ](../../../operations/system_tables.md#system_tables-parts) テーブルのテーブル部品およびパーテッション. たとえば、我々が持っていると仮定しましょう `visits` テーブルを分割する。 のは、実行してみましょう `SELECT` のための問い合わせ `system.parts` テーブル: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 1 │ -│ 201902 │ 201902_11_11_0 │ 1 │ -└───────────┴────────────────┴────────┘ -``` - -その `partition` 列にはパーティションの名前が含まれます。 この例には二つの区画があります: `201901` と `201902`. この列の値を使用して、パーティション名を指定できます。 [ALTER … PARTITION](#alter_manipulations-with-partitions) クエリ。 - -その `name` カラムの名前を格納して、パーティションのデータ部品です。 この列を使用して、パートの名前を指定することができます。 [ALTER ATTACH PART](#alter_attach-partition) クエリ。 - -最初の部分の名前を分解してみましょう: `201901_1_3_1`: - -- `201901` パーティション名です。 -- `1` データブロックの最小数です。 -- `3` データブロックの最大数です。 -- `1` チャンクレベル(マージツリーの深さ)です。 - -!!! info "情報" - 古いタイプのテーブルの部分には名前があります: `20190117_20190123_2_2_0` (最小日付-最大日付-最小ブロック番号-最大ブロック番号-レベル)。 - -その `active` コラムは部品の状態を示します。 `1` アクティブです; `0` 非アクティブです。 に不活性部品、例えば、ソース部品の残りの後の合併によります。 破損したデータ部分も非アクティブとして示されます。 - -この例でわかるように、同じパーティションのいくつかの分離された部分があります(たとえば, `201901_1_3_1` と `201901_1_9_2`). つまり、これらの部分はまだマージされていません。 ClickHouseは、挿入してから約15分後に、データの挿入された部分を定期的にマージします。 さらに、スケジュールされていないマージを実行するには [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) クエリ。 例えば: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 0 │ -│ 201902 │ 201902_4_11_2 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 0 │ -│ 201902 │ 201902_11_11_0 │ 0 │ -└───────────┴────────────────┴────────┘ -``` - -不活性パーツを削除する約10分後の統合. - -部品やパーティションのセットを表示する別の方法は、テーブルのディレクトリに移動することです: `/var/lib/clickhouse/data///`. 例えば: - -``` bash -/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -フォルダ ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ というように部品のディレクトリです。 各部に関する対応する分割データが含まれまで一定の月のテーブルこの例では、分割による。 - -その `detached` ディレクト [DETACH](#alter_detach-partition) クエリ。 破損した部分も削除されるのではなく、このディレクトリに移動されます。 サーバーはサーバーからの部品を使用しません `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql_reference/statements/alter.md#alter_attach-partition) クエリ。 - -オペレーティングサーバーでは、ファイルシステム上の部品またはそのデータのセットを手動で変更することはできません。 非複製のテーブル、これを実行する事ができます。サーバが停止中でないお勧めします。 レプリケートされたテーブルの場合、パートのセットは変更できません。 - -ClickHouseを使用すると、パーティションを削除したり、テーブル間でコピーしたり、バックアップを作成したりできます。 セクションのすべての操作の一覧を参照してください [パーティションとパーツの操作](../../../sql_reference/statements/alter.md#alter_manipulations-with-partitions). - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/ja/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/ja/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index af5842b5b9e..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: "\u30B0\u30E9\u30D5\u30A3\u30C3\u30C8\u30E1\u30FC\u30EB\u30B0\u30C4\u30EA\ - \u30FC" ---- - -# グラフィットメールグツリー {#graphitemergetree} - -このエン) [黒鉛](http://graphite.readthedocs.io/en/latest/index.html) データ。 GraphiteのデータストアとしてClickHouseを使用したい開発者にとっては役に立つかもしれません。 - -ロールアップが必要ない場合は、任意のclickhouseテーブルエンジンを使用してグラファイトデータを保存できますが、ロールアップが必要な場合は使用します `GraphiteMergeTree`. エンジンはストレージの量を減らし、Graphiteからのクエリの効率を高めます。 - -エンジンを継承性から [MergeTree](mergetree.md). - -## テーブルの作成 {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -の詳細な説明を参照してください [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) クエリ。 - -グラファイトデータのテーブルには、次のデータの列が必要です: - -- メトリック名(黒鉛センサ)。 データ型: `String`. - -- メトリックを測定する時間。 データ型: `DateTime`. - -- メトリックの値。 データ型:任意の数値。 - -- メトリックのバージョン。 データ型:任意の数値。 - - ClickHouseは、バージョンが同じであれば、最高のバージョンまたは最後に書かれた行を保存します。 その他の行は、データパーツのマージ中に削除されます。 - -これらの列の名前は、ロールアップ構成で設定する必要があります。 - -**GraphiteMergeTreeパラメータ** - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -**クエリ句** - -作成するとき `GraphiteMergeTree` テーブル、同じ [句](mergetree.md#table_engine-mergetree-creating-a-table) 作成するときと同じように、必須です。 `MergeTree` テーブル。 - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -すべてのパラメーターを除く `config_section` と同じ意味を持つ `MergeTree`. - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -
- -## ロールアップ構成 {#rollup-configuration} - -ロールアップの設定は、次のように定義されます。 [graphite\_rollup](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) サーバー構成のパラメーター。 パラメータの名前は任意です。 複数の構成を作成し、それらを異なるテーブルに使用できます。 - -ロールアップ構成構造: - - required-columns - patterns - -### 必要な列 {#required-columns} - -- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. -- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. -- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. デフォルト値: `Value`. -- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. - -### パターン {#patterns} - -の構造 `patterns` セクション: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "注意" - パタ: - - 1. Patterns without `function` or `retention`. - 1. Patterns with both `function` and `retention`. - 1. Pattern `default`. - -行を処理するときに、clickhouseは次のルールをチェックします。 `pattern` セクション。 それぞれの `pattern` (を含む `default`)セクションには `function` 集計のパラメータ, `retention` 変数または両方。 このメトリック名が `regexp`、からのルール `pattern` セクション(またはセクション)が適用されます。 `default` セクションを使用します。 - -フィールドの `pattern` と `default` セクション: - -- `regexp`– A pattern for the metric name. -- `age` – The minimum age of the data in seconds. -- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). -- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. - -### 構成例 {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/ja/engines/table_engines/mergetree_family/mergetree.md b/docs/ja/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index 3b3c52e9c28..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,654 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 30 -toc_title: MergeTree ---- - -# Mergetree {#table_engines-mergetree} - -その `MergeTree` この家族 (`*MergeTree`)最も堅牢なクリックハウステーブルエンジンです。 - -のエンジン `MergeTree` ファミリは、非常に大量のデータをテーブルに挿入するために設計されています。 のデータが書き込まれ、テーブル部、そのルール適用のための統合のパーツです。 この方法は、挿入時にストレージ内のデータを継続的に書き換えるよりはるかに効率的です。 - -主な特長: - -- 店舗データを整理によりその有効なタイプを利用します。 - - これにより、データの検索を高速化する小さなスパース索引を作成できます。 - -- パーティションは、 [分割キー](custom_partitioning_key.md) が指定される。 - - ClickHouseは、同じ結果を持つ同じデータに対する一般的な操作よりも効果的なパーティションを持つ特定の操作をサポートします。 ClickHouseも自動的に遮断すると、パーティションデータのパーティショニングキーで指定されたクエリ。 この改善するためのクエリ。 - -- データ複製サポート。 - - の家族 `ReplicatedMergeTree` 表はデータ複製を提供します。 詳細については、 [データ複製](replication.md). - -- データ抜取りサポート。 - - 必要に応じて、テーブル内のデータサンプリング方法を設定できます。 - -!!! info "情報" - その [マージ](../special/merge.md) エンジンはに属しません `*MergeTree` 家族 - -## テーブルの作成 {#table_engine-mergetree-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 -) ENGINE = MergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] -[SETTINGS name=value, ...] -``` - -パラメータの詳細については、 [クエリの説明の作成](../../../sql_reference/statements/create.md). - -!!! note "メモ" - `INDEX` は、実験的な機能です [データスキップ索引](#table_engine-mergetree-data_skipping-indexes). - -### クエリ句 {#mergetree-query-clauses} - -- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. その `MergeTree` engineにはパラメータがありません。 - -- `PARTITION BY` — The [分割キー](custom_partitioning_key.md). - - 月単位でパーティション分割するには、 `toYYYYMM(date_column)` 式、どこ `date_column` 型の日付を持つ列を指定します [日付](../../../sql_reference/data_types/date.md). ここでのパーティション名には、 `"YYYYMM"` フォーマット。 - -- `ORDER BY` — The sorting key. - - 列または任意の式のタプル。 例えば: `ORDER BY (CounterID, EventDate)`. - -- `PRIMARY KEY` — The primary key if it [ソートキーとは異なります](#choosing-a-primary-key-that-differs-from-the-sorting-key). - - デフォルトでは、プライマリキーはソートキー(プライマリキーで指定)と同じです。 `ORDER BY` 句)。 したがって、ほとんどの場合、別の `PRIMARY KEY` 句。 - -- `SAMPLE BY` — An expression for sampling. - - サンプリング式を使用する場合は、主キーに含める必要があります。 例えば: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. - -- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [ディスクとボリューム間](#table_engine-mergetree-multiple-volumes). - - 式には次のものが必要です `Date` または `DateTime` 結果としての列。 例えば: - `TTL date + INTERVAL 1 DAY` - - ルールのタイプ `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` 式が満たされている場合(現在の時間に達した場合)、その部分を使用して実行するアクションを指定します。 (`TO DISK 'xxx'`)またはボリュームに (`TO VOLUME 'xxx'`). ルールのデフォルトの種類は削除です (`DELETE`). 複数のルールのリストは指定できますが、複数のルールが存在しないはずです `DELETE` ルール。 - - 詳細については、 [列とテーブルのttl](#table_engine-mergetree-ttl) - -- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: - - - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [データ記憶](#mergetree-data-storage). - - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [データ記憶](#mergetree-data-storage). - - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` 設定。 バージョン19.11以前は、 `index_granularity` 制限の微粒のサイズのための設定。 その `index_granularity_bytes` 設定の改善ClickHouse性能の選定からデータをテーブルの大きな行(数十、数百人のメガバイト). 大きな行を持つテーブルがある場合は、この設定を有効にしてテーブルの効率を向上させることができます `SELECT` クエリ。 - - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`、その後ZooKeeperは以下のデータを格納します。 詳細については、 [設定の説明](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) で “Server configuration parameters”. - - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` バイトClickHouseを読み込みおよび書き込み、データの保存ディスクの直接のI/Oインターフェース (`O_DIRECT` オプション)。 もし `min_merge_bytes_to_use_direct_io = 0` その後、直接I/Oが無効になります。 デフォルト値: `10 * 1024 * 1024 * 1024` バイト。 - - - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). - - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don't turn it off. - - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. - - `storage_policy` — Storage policy. See [複数ブロックデバイスを使用したデータ保存](#table_engine-mergetree-multiple-volumes). - -**セクション設定例** - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 -``` - -この例では、月単位でパーティション分割を設定します。 - -また、ユーザーidによるハッシュとしてサンプリング用の式を設定します。 これにより、それぞれのテーブルのデータを擬似乱数化することができます `CounterID` と `EventDate`. を定義した場合 [SAMPLE](../../../sql_reference/statements/select.md#select-sample-clause) 句データを選択すると、ClickHouseはユーザーのサブセットに対して均等に擬似乱数データサンプルを返します。 - -その `index_granularity` 8192がデフォルト値であるため、設定は省略できます。 - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 用途では使用しないでください方法で新規プロジェクト. 可能であれば、古いプロジェクトを上記の方法に切り替えます。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -**MergeTree()パラメータ** - -- `date-column` — The name of a column of the [日付](../../../sql_reference/data_types/date.md) タイプ。 ClickHouseを自動でパーティション月に基づきます。 パーティション名は `"YYYYMM"` フォーマット。 -- `sampling_expression` — An expression for sampling. -- `(primary, key)` — Primary key. Type: [タプル()](../../../sql_reference/data_types/tuple.md) -- `index_granularity` — The granularity of an index. The number of data rows between the “marks” インデックスの。 値8192は、ほとんどのタスクに適しています。 - -**例えば** - -``` sql -MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) -``` - -その `MergeTree` エンジンは、メインエンジン構成方法について上記の例と同様に構成される。 -
- -## データ記憶 {#mergetree-data-storage} - -テーブルのデータ部品の分別によりその有効なタイプを利用します。 - -データがテーブルに挿入されると、別々のデータパーツが作成され、それぞれが主キーで辞書式に並べ替えられます。 たとえば、プライマリキーが次の場合 `(CounterID, Date)` パーツ内のデータは `CounterID`、およびそれぞれの中で `CounterID`、それは順序付けられます `Date`. - -データに属する別のパーティションが分離の異なる部品です。 その背景にclickhouse合併しデータのパーツを効率的に保管します。 パーツに属する別のパーティションがないます。 マージメカニズムは、同じ主キーを持つすべての行が同じデータ部分にあることを保証しません。 - -各データ部分は、論理的に顆粒に分割されます。 顆粒は、データを選択するときにclickhouseが読み取る最小の不可分のデータセットです。 clickhouseは行または値を分割しないため、各granule粒には常に整数の行が含まれます。 顆粒の最初の行は、行の主キーの値でマークされます。 各データ、clickhouseを作成しインデックスファイルを格納するのです。 各列について、主キーにあるかどうかにかかわらず、clickhouseには同じマークも格納されます。 これらのマークまたはデータを見つの直列のファイルです。 - -微粒のサイズはによって制限されます `index_granularity` と `index_granularity_bytes` テーブルエンジンの設定。 微粒の列の数はで置きます `[1, index_granularity]` 行のサイズに応じた範囲。 顆粒のサイズは超えることができます `index_granularity_bytes` 単一行のサイズが設定の値より大きい場合。 この場合、顆粒のサイズは行のサイズに等しくなります。 - -## クエリの主キーとインデックス {#primary-keys-and-indexes-in-queries} - -を取る `(CounterID, Date)` 例として主キー。 この場合、並べ替えとインデックスは次のように示されます: - - Whole data: [---------------------------------------------] - CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] - Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] - Marks: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 - Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 - -デー: - -- `CounterID in ('a', 'h')`、サーバーはマークの範囲のデータを読み取ります `[0, 3)` と `[6, 8)`. -- `CounterID IN ('a', 'h') AND Date = 3`、サーバーはマークの範囲のデータを読み取ります `[1, 3)` と `[7, 8)`. -- `Date = 3`、サーバーは、マークの範囲内のデータを読み取ります `[1, 10]`. - -上記の例としては常に使用するのがより効果的指標により、フルスキャン! - -に乏指数で追加するデータを読み込みます。 主キーの単一の範囲を読み取るとき `index_granularity * 2` 余分な列の各データブロック読み取ることができます。 - -疎指標できる作業は非常に多くのテーブル行において、多くの場合、指数はコンピュータのアプリです。 - -ClickHouseは一意の主キーを必要としません。 同じ主キーで複数の行を挿入できます。 - -### 主キーの選択 {#selecting-the-primary-key} - -主キーの列数は明示的に制限されていません。 データ構造によっては、主キーに多かれ少なかれ列を含めることができます。 この: - -- インデックスのパフォーマン - - プライマリキーが `(a, b)` 次に、別の列を追加します `c` 次の条件が満たされるとパフォーマンスが向上します: - - - 列に条件があるクエリがあります `c`. - - 長いデータ範囲(数倍長い `index_granularity`)の値が同じである場合 `(a, b)` 一般的です。 言い換えれば、別の列を追加すると、非常に長いデータ範囲をスキップできます。 - -- データ圧縮を改善する。 - - ClickHouseは主キーでデータをソートするので、一貫性が高いほど圧縮率が高くなります。 - -- 追加的なロジックが統合データ部分の [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) と [SummingMergeTree](summingmergetree.md) エンジン - - この場合、それは指定することは理にかなって *ソートキー* これは主キーとは異なります。 - -長いprimary keyに悪影響を及ぼす可能性は、挿入性能やメモリ消費が別の列に主キーに影響を与えないclickhouse性能 `SELECT` クエリ。 - -### ソートキーとは異なる主キーの選択 {#choosing-a-primary-key-that-differs-from-the-sorting-key} - -ソートキー(データ部分の行をソートする式)とは異なる主キー(各マークのインデックスファイルに書き込まれる値を持つ式)を指定することができます。 この場合、主キー式タプルは、並べ替えキー式タプルのプレフィックスである必要があります。 - -この機能は、 [SummingMergeTree](summingmergetree.md) と -[ツつィツ姪"ツつ"ツ債ツづュツつケ](aggregatingmergetree.md) テーブルエンジン。 これらのエンジンを使用する一般的なケースでは、テーブルには二種類の列があります: *寸法* と *対策*. 典型的なクエリは、任意のメジャー列の値を集計します `GROUP BY` そして次元によるろ過。 SummingMergeTreeとAggregatingMergeTreeは、並べ替えキーの同じ値を持つ行を集計するので、すべての次元を追加するのが自然です。 その結果、キー式は長い列のリストで構成され、このリストは新しく追加されたディメンションで頻繁に更新される必要があります。 - -この場合、主キーにいくつかの列だけを残して、効率的な範囲スキャンを提供し、残りのディメンション列を並べ替えキータプルに追加することが理に - -[ALTER](../../../sql_reference/statements/alter.md) 新しい列がテーブルとソートキーに同時に追加されると、既存のデータパーツを変更する必要がないため、ソートキーの操作は軽量です。 古いソートキーは新しいソートキーの接頭辞であり、新しく追加された列にデータがないため、データはテーブル変更の時点で古いソートキーと新しいソートキーの両方 - -### クエリでの索引とパーティションの使用 {#use-of-indexes-and-partitions-in-queries} - -のために `SELECT` ClickHouseは、インデックスを使用できるかどうかを分析します。 インデックスが使用できるのは、 `WHERE/PREWHERE` 句には、等式または不等式の比較演算を表す式(連結要素のいずれかとして、または完全に)があります。 `IN` または `LIKE` 主キーまたはパーティショニングキーに含まれる列または式、またはこれらの列の特定の部分反復関数、またはこれらの式の論理関係に固定プレフィッ - -したがって、主キーの一つまたは複数の範囲でクエリをすばやく実行することができます。 この例では、特定のトラッキングタグ、特定のタグおよび日付範囲、特定のタグおよび日付、日付範囲を持つ複数のタグなどに対して実行すると、クエ - -次のように構成されたエンジンを見てみましょう: - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 - -この場合、クエリで: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -ClickHouseの主キー指標のトリムで不正なデータを毎月パーティショニングキーパンフレット、ホームページの間仕切りする不適切な日。 - -上記のクエリのインデックスが使用されるときにも複雑な表現です。 テーブルからの読み取りがいを使用した指標できないっぱいたします。 - -以下の例では、インデックスは使用できません。 - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -確認clickhouseできるとの利用時の走行クエリに対して、使用の設定 [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) と [force\_primary\_key](../../../operations/settings/settings.md). - -の分割による月で読み込みのみこれらのデータブロックを含むからスピーチへのマークの範囲内で適切に取扱います。 この場合、データブロックには多くの日付(月全体まで)のデータが含まれることがあります。 ブロック内では、データは主キーによってソートされます。 このため、主キープレフィックスを指定しない日付条件のみを持つクエリを使用すると、単一の日付よりも多くのデータが読み取られます。 - -### 部分的に単調な主キーに対するインデックスの使用 {#use-of-index-for-partially-monotonic-primary-keys} - -たとえば、月の日数を考えてみましょう。 彼らは形成する [単調系列](https://en.wikipedia.org/wiki/Monotonic_function) 一ヶ月のために、しかし、より長期間単調ではありません。 これは部分的に単調なシーケンスです。 ユーザーが部分的に単調な主キーを持つテーブルを作成する場合、ClickHouseは通常どおりスパースインデックスを作成します。 ユーザーがこの種類のテーブルからデータを選択すると、ClickHouseはクエリ条件を分析します。 ユーザーは、インデックスの二つのマークの間のデータを取得したいと、これらのマークの両方が一ヶ月以内に落ちる場合、それはクエリとインデックスマーク - -クエリパラメーターの範囲内の主キーの値が単調順序を表さない場合、clickhouseはインデックスを使用できません。 この場合、clickhouseはフルスキャン方式を使用します。 - -ClickHouseは、月シーケンスの日数だけでなく、部分的に単調なシーケンスを表すプライマリキーについても、このロジックを使用します。 - -### データスキップインデックス(実験) {#table_engine-mergetree-data_skipping-indexes} - -インデックス宣言は、次の列セクションにあります `CREATE` クエリ。 - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -からのテーブルの場合 `*MergeTree` 家族データの飛び指標を指定できます。 - -これらのインデックスは、ブロックの指定された式に関する情報を集約します。 `granularity_value` 微粒(微粒のサイズはを使用して指定されます `index_granularity` テーブルエンジンの設定)。 次に、これらの集約は `SELECT` ディスクから読み取るデータの量を減らすためのクエリ `where` クエリは満たされません。 - -**例えば** - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -この例のインデックスをclickhouseで使用すると、次のクエリでディスクから読み取るデータの量を減らすことができます: - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### 使用可能なインデックスの種類 {#available-types-of-indices} - -- `minmax` - - 指定された式の極値を格納します(式が指定されている場合 `tuple` そして、それは各要素のための極端をの貯えます `tuple`)を使用して保存情報の飛びブロックのようなデータは、その有効なタイプを利用します。 - -- `set(max_rows)` - - 指定された式の一意の値を格納します。 `max_rows` 行, `max_rows=0` 意味 “no limits”). この値を使用して、 `WHERE` 式はデータブロックでは充足可能ではありません。 - -- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - 店a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) これには、データブロックのすべてのngramsが含まれます。 文字列でのみ動作します。 の最適化に使用することができます `equals`, `like` と `in` 式。 - - - `n` — ngram size, - - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). - - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. - - `random_seed` — The seed for Bloom filter hash functions. - -- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - 同じように `ngrambf_v1` しかし、ngramsの代わりにトークンを格納します。 トークンは、英数字以外の文字で区切られた順序です。 - -- `bloom_filter([false_positive])` — Stores a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) 指定された列の場合。 - - 任意 `false_positive` パラメーターは、フィルターから偽陽性の応答を受信する確率です。 可能な値:(0,1)。 デフォルト値:0.025. - - 対応データ型: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. - - 次の関数はそれを使用できます: [等しい](../../../sql_reference/functions/comparison_functions.md), [notEquals](../../../sql_reference/functions/comparison_functions.md), [で](../../../sql_reference/functions/in_functions.md), [notIn](../../../sql_reference/functions/in_functions.md), [持っている](../../../sql_reference/functions/array_functions.md). - - - -``` sql -INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 -INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 -``` - -#### 機能サポート {#functions-support} - -の条件 `WHERE` clauseには、列で操作する関数の呼び出しが含まれます。 列がインデックスの一部である場合、ClickHouseは関数の実行時にこのインデックスを使用しようとします。 ClickHouse支援の異なるサブセットの機能を使用。 - -その `set` indexは、すべての関数で使用できます。 他のインデックスの関数サブセットを以下の表に示します。 - -| 関数(演算子)/インデックス | 主キー | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | -|-------------------------------------------------------------------------------------------------------------|--------|--------|-------------|-------------|---------------| -| [equals(=,==))](../../../sql_reference/functions/comparison_functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notEquals(!=, \<\>)](../../../sql_reference/functions/comparison_functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [のように](../../../sql_reference/functions/string_search_functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [notLike](../../../sql_reference/functions/string_search_functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [startsWith](../../../sql_reference/functions/string_functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [エンドスウィス](../../../sql_reference/functions/string_functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [マルチセアチャンネル](../../../sql_reference/functions/string_search_functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | -| [で](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notIn](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [less(\<)](../../../sql_reference/functions/comparison_functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [グレーター(\>)](../../../sql_reference/functions/comparison_functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [lessOrEquals(\<=)](../../../sql_reference/functions/comparison_functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [greaterOrEquals(\>=)](../../../sql_reference/functions/comparison_functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [空](../../../sql_reference/functions/array_functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [notEmpty](../../../sql_reference/functions/array_functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| ハストケンcity in germany | ✗ | ✗ | ✗ | ✔ | ✗ | - -Ngramサイズより小さい定数引数を持つ関数は、 `ngrambf_v1` クエリの最適化のため。 - -ブルでは偽陽性一致すので、 `ngrambf_v1`, `tokenbf_v1`、と `bloom_filter` インデックスは、関数の結果がfalseであると予想されるクエリの最適化には使用できません。: - -- 最適化することができる: - - `s LIKE '%test%'` - - `NOT s NOT LIKE '%test%'` - - `s = 1` - - `NOT s != 1` - - `startsWith(s, 'test')` -- 最適化できません: - - `NOT s LIKE '%test%'` - - `s NOT LIKE '%test%'` - - `NOT s = 1` - - `s != 1` - - `NOT startsWith(s, 'test')` - -## 同時データアクセス {#concurrent-data-access} - -同時テーブルアクセスでは、マルチバージョンを使用します。 つまり、テーブルが同時に読み取られて更新されると、クエリ時に現在のパーツのセットからデータが読み取られます。 長いロックはありません。 挿入は読み取り操作の方法では得られません。 - -テーブルからの読み取りは自動的に並列化されます。 - -## 列とテーブルのttl {#table_engine-mergetree-ttl} - -値の存続期間を決定します。 - -その `TTL` 句は、テーブル全体と個々の列ごとに設定することができます。 テーブルレベルのTTLで指定した論理の自動移動のデータディスクの間とします。 - -式は評価する必要があります [日付](../../../sql_reference/data_types/date.md) または [DateTime](../../../sql_reference/data_types/datetime.md) データ型。 - -例えば: - -``` sql -TTL time_column -TTL time_column + interval -``` - -定義する `interval`、使用 [時間間隔](../../../sql_reference/operators.md#operators-datetime) 演算子。 - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### 列ttl {#mergetree-column-ttl} - -列の値が期限切れになると、clickhouseは列のデータ型の既定値に置き換えます。 すべてのカラム値のデータ部分を切clickhouse削除するこのカラムからのデータにファイルシステム. - -その `TTL` キー列には句を使用できません。 - -例: - -TTLを使用したテーブルの作成 - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -既存のテーブルの列にttlを追加する - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -列のttlの変更 - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### テーブルttl {#mergetree-table-ttl} - -テーブルでの表現の除去に終了しました列、複数の表現を自動で部品の移動と [ディスク](#table_engine-mergetree-multiple-volumes). 時テーブルの行の有効期間ClickHouseをすべて削除して対応さい。 部品移動フィーチャの場合、部品のすべての行が移動式の基準を満たしている必要があります。 - -``` sql -TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... -``` - -TTLルールのタイプは、各TTL式に従います。 これは、式が満たされると実行されるアクションに影響します(現在の時間に達します): - -- `DELETE` 削除行を終了しました(デフォルトアクション); -- `TO DISK 'aaa'` -ディスクに部品を移動 `aaa`; -- `TO VOLUME 'bbb'` -ディスクに部品を移動 `bbb`. - -例: - -TTLを使用したテーブルの作成 - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH [DELETE], - d + INTERVAL 1 WEEK TO VOLUME 'aaa', - d + INTERVAL 2 WEEK TO DISK 'bbb'; -``` - -テーブルのttlの変更 - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**データの削除** - -データ切れのttlを取り除きclickhouse合併しデータの部品です。 - -時clickhouseるデータの期間は終了しましたので、行offスケジュール内スケジュールする必要がありません。 このようなマージの頻度を制御するには、次のように設定します [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). 値が低すぎる場合は、多くのリソースを消費する可能性のある多くのオフスケジュールマージを実行します。 - -あなたが実行する場合 `SELECT` 期限切れのデータを取得できます。 それを避けるために、を使用 [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) 前にクエリ `SELECT`. - -## 複数ブロックデバイスを使用したデータ保存 {#table_engine-mergetree-multiple-volumes} - -### 導入 {#introduction} - -`MergeTree` 家族のテーブルエンジンでデータを複数のブロックデバイス たとえば、特定のテーブルのデータが暗黙的に分割されている場合に便利です “hot” と “cold”. 最新のデータは定期的に要求されますが、必要な領域はわずかです。 それどころか、fat-tailed履歴データはまれに要求される。 複数のディスクが使用可能な場合は、 “hot” データは高速ディスク(たとえば、NVMe Ssdまたはメモリ内)にあります。 “cold” データ-比較的遅いもの(例えば、HDD)。 - -データ部分は最低の移動可能な単位のためのです `MergeTree`-エンジンテーブル。 ある部分に属するデータは、あるディスクに格納されます。 データ部分は背景のディスクの間で(ユーザーの設定に従って)、またによって動かすことができます [ALTER](../../../sql_reference/statements/alter.md#alter_move-partition) クエリ。 - -### 条件 {#terms} - -- Disk — Block device mounted to the filesystem. -- Default disk — Disk that stores the path specified in the [パス](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) サーバー設定。 -- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). -- Storage policy — Set of volumes and the rules for moving data between them. - -の名称を記載することから、システムテーブル, [システム。ストレージ\_policies](../../../operations/system_tables.md#system_tables-storage_policies) と [システム。ディスク](../../../operations/system_tables.md#system_tables-disks). テーブ `storage_policy` の設定 `MergeTree`-エンジン家族のテーブル。 - -### 設定 {#table_engine-mergetree-multiple-volumes-configure} - -ディスク、ボリューム、およびストレージポリシーは、 `` メインファイルのいずれかのタグ `config.xml` または、 `config.d` ディレクトリ。 - -構成の構造: - -``` xml - - - - /mnt/fast_ssd/clickhouse/ - - - /mnt/hdd1/clickhouse/ - 10485760 - - - /mnt/hdd2/clickhouse/ - 10485760 - - - ... - - - ... - -``` - -タグ: - -- `` — Disk name. Names must be different for all disks. -- `path` — path under which a server will store data (`data` と `shadow` フォルダ)で終了する必要があります。 ‘/’. -- `keep_free_space_bytes` — the amount of free disk space to be reserved. - -ディスク定義の順序は重要ではありません。 - -ストレージポリシ: - -``` xml - - ... - - - - - disk_name_from_disks_configuration - 1073741824 - - - - - - - 0.2 - - - - - - - - ... - -``` - -タグ: - -- `policy_name_N` — Policy name. Policy names must be unique. -- `volume_name_N` — Volume name. Volume names must be unique. -- `disk` — a disk within a volume. -- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume's disks. -- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). - -Cofigurationの例: - -``` xml - - ... - - - - - disk1 - disk2 - - - - - - - - fast_ssd - 1073741824 - - - disk1 - - - 0.2 - - - ... - -``` - -与えられた例では、 `hdd_in_order` ポリシーの実装 [ラウンドロビン](https://en.wikipedia.org/wiki/Round-robin_scheduling) アプローチ。 したがって、このポリシ (`single`)データパーツは、すべてのディスクに循環順序で格納されます。 こうした政策れぞれの知見について学ぶとともに有が複数ある場合は同様のディスク搭載のシステムがRAIDな設定を行います。 個々のディスクドライブはそれぞれ信頼できないため、複製係数が3以上になるように補正する必要があることに注意してください。 - -システムで使用可能なディスクの種類が異なる場合, `moving_from_ssd_to_hdd` ポリシーは代わりに使用できます。 ボリューム `hot` SSDディスクで構成されています (`fast_ssd`このボリュームに格納できるパーツの最大サイズは1GBです。 サイズが1GBより大きいすべての部品はで直接貯えられます `cold` HDDディスクを含むボリューム `disk1`. -また、一度ディスク `fast_ssd` 80%以上によって満たされて得ます、データはに移ります `disk1` 背景プロセ - -ストレージポリシー内のボリューム列挙の順序は重要です。 ボリュームがオーバーフィルされると、データは次のものに移動されます。 ディスク列挙の順序は、データが順番に格納されるため、重要です。 - -作成時にテーブルは、適用の設定を保存方針で: - -``` sql -CREATE TABLE table_with_non_default_policy ( - EventDate Date, - OrderID UInt64, - BannerID UInt64, - SearchPhrase String -) ENGINE = MergeTree -ORDER BY (OrderID, BannerID) -PARTITION BY toYYYYMM(EventDate) -SETTINGS storage_policy = 'moving_from_ssd_to_hdd' -``` - -その `default` ストレージポリシーは、ボリュームを一つだけ使用することを意味します。 ``. テーブルを作成すると、そのストレージポリシーは変更できません。 - -### 詳細 {#details} - -の場合 `MergeTree` テーブル、データがあるディスクには、異なる方法: - -- 挿入の結果として (`INSERT` クエリ)。 -- バックグラウンドマージ時 [突然変異](../../../sql_reference/statements/alter.md#alter-mutations). -- 別のレプリカか -- 仕切りの凍結の結果として [ALTER TABLE … FREEZE PARTITION](../../../sql_reference/statements/alter.md#alter_freeze-partition). - -すべてのこれらの場合を除き、突然変異とパーティションの凍結は、一部が保存され、大量のディスクに保存政策: - -1. パートを格納するのに十分なディスク領域を持つ最初のボリューム(定義の順序で) (`unreserved_space > current_part_size`)特定のサイズの部品を格納することができます (`max_data_part_size_bytes > current_part_size`)が選択されます。 -2. このボリューム内では、前のデータチャンクを格納するために使用されたディスクに続くディスクが選択され、パーツサイズよりも空き領域が多くなり (`unreserved_space - keep_free_space_bytes > current_part_size`). - -フードの下で、突然変異および仕切りの凍結は利用します [ハードリンク](https://en.wikipedia.org/wiki/Hard_link). ハードリンクとディスクには対応していないため、この場合、パーツの保管と同じディスクの初期ます。 - -バックグラウンドでは、空き領域の量に基づいて部品がボリューム間で移動されます (`move_factor` パラメータ)順序に従って、設定ファイルでボリュームが宣言されます。 -データは最後のものから最初のものに転送されません。 システムテーブルを使用できる [システム。part\_log](../../../operations/system_tables.md#system_tables-part-log) (フィールド `type = MOVE_PART`) [システム。パーツ](../../../operations/system_tables.md#system_tables-parts) (フィールド `path` と `disk`)背景の動きを監視する。 また、詳細な情報はサーバーログに記載されています。 - -ユーザーの力で移動中の一部またはパーティションから量別のクエリ [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql_reference/statements/alter.md#alter_move-partition)、バックグラウンド操作のすべての制限が考慮されます。 クエリは単独で移動を開始し、バックグラウンド操作が完了するのを待機しません。 十分な空き領域がない場合、または必要な条件のいずれかが満たされない場合、ユーザーはエラーメッセージが表示されます。 - -データの移動はデータの複製を妨げません。 そのため、異なる保管方針を指定することができ、同じテーブルの異なるレプリカ. - -バックグラウンドマージと突然変異の完了後、古い部分は一定時間後にのみ削除されます (`old_parts_lifetime`). -この間、他のボリュームやディスクに移動されることはありません。 したがって、部品が最終的に取り外されるまで、それらはまだ占有ディスクスペースの評価のために考慮される。 - -[元の記事](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/ja/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/ja/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index 11c157aed9b..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: "\uFF82\u3064\uFF68\uFF82\u59EA\"\uFF82\u3064\"\uFF82\u50B5\uFF82\u3064\ - \uFF79" ---- - -# ツつィツ姪"ツつ"ツ債ツつケ {#replacingmergetree} - -エンジンは [MergeTree](mergetree.md#table_engines-mergetree) それは、同じ主キー値(またはより正確には同じ値)を持つ重複エントリを削除するという点で [ソートキー](mergetree.md) 値)。 - -データ重複除去は、マージ中にのみ行われます。 マージは未知の時間にバックグラウンドで行われるため、計画することはできません。 一部のデータは未処理のままです。 スケジュールされていないマージを実行するには `OPTIMIZE` クエリは、それを使用してカウントされません。 `OPTIMIZE` クエリは大量のデータを読み書きします。 - -したがって, `ReplacingMergeTree` に適した清算出重複データを背景に保存するための空間が保証するものではありませんが重複している。 - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -説明リクエストパラメータの参照 [要求の説明](../../../sql_reference/statements/create.md). - -**ReplacingMergeTreeパラメータ** - -- `ver` — column with version. Type `UInt*`, `Date` または `DateTime`. 省略可能なパラメータ。 - - マージ時, `ReplacingMergeTree` 同じ主キーを持つすべての行から一つだけを残します: - - - 選択の最後の場合 `ver` 設定されていません。 - - 最大バージョンでは、 `ver` 指定します。 - -**クエリ句** - -作成するとき `ReplacingMergeTree` テーブル同じ [句](mergetree.md) 作成するときと同じように、必須です。 `MergeTree` テーブル。 - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -すべてのパラメーターを除く `ver` と同じ意味を持つ `MergeTree`. - -- `ver` -バージョンの列。 省略可能なパラメータ。 説明は上記のテキストを参照してください。 - -
- -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/ja/engines/table_engines/mergetree_family/replication.md b/docs/ja/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index f36af4208de..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 31 -toc_title: "\u30C7\u30FC\u30BF\u8907\u88FD" ---- - -# データ複製 {#table_engines-replication} - -複製がサポートされる唯一のためのテーブルのmergetree家族: - -- レプリケートされたmergetree -- ツつィツ姪"ツつ"ツ債ツづュツつケツ-faq -- ツつィツ姪"ツつ"ツ債ツづュツつケツ-faq -- ツつィツ姪"ツつ"ツ債ツづュツつケツ-faq -- レプリケートされたcollapsingmergetree -- ReplicatedVersionedCollapsingMergetree -- ReplicatedGraphiteMergeTree - -複製は、サーバー全体ではなく、個々のテーブルのレベルで機能します。 サーバーでの店舗も複製、非複製のテーブルでも同時に行います。 - -複製はシャーディングに依存しません。 各シャードには独自の独立した複製があります。 - -圧縮データのための `INSERT` と `ALTER` クエリを複製(詳細については、ドキュメンテーションに [ALTER](../../../sql_reference/statements/alter.md#query_language_queries_alter)). - -`CREATE`, `DROP`, `ATTACH`, `DETACH` と `RENAME` クエリは単一サーバーで実行され、レプリケートされません: - -- その `CREATE TABLE` queryは、クエリが実行されるサーバー上に新しい複製可能テーブルを作成します。 このテーブルが既にあるその他のサーバーを加え新たなレプリカ. -- その `DROP TABLE` クエリは、クエリが実行されているサーバー上のレプリカを削除します。 -- その `RENAME` queryは、いずれかのレプリカでテーブルの名前を変更します。 つまり、複製のテーブルでの異なる名称の異なるレプリカ. - -ClickHouse用 [アパッチの飼育係](https://zookeeper.apache.org) レプリカのメタ情報を格納するため。 使用ZooKeeperバージョン3.4.5以降。 - -レプリケーションを使用するには、 [zookeeper](../../../operations/server_configuration_parameters/settings.md#server-settings_zookeeper) サーバー構成セクション. - -!!! attention "注意" - セキュリ クリックハウスは `digest` [ACLスキーム](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) ZooKeeperのセキュリティサブシステムの - -ZooKeeperクラスタのアドレス設定例: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -既存のzookeeperクラスターを指定すると、システムは独自のデータ用のディレクトリを使用します(レプリケート可能なテーブルを作成するときにディレクトリ - -ZooKeeperが設定ファイルに設定されていない場合は、複製されたテーブルを作成することはできず、既存の複製されたテーブルは読み取り専用になります。 - -ZooKeeperは使用されません `SELECT` レプリケーショ `SELECT` との質問を行ってい非再現します。 分散レプリケートテーブルを照会する場合、ClickHouseの動作は設定によって制御されます [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) と [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). - -それぞれの `INSERT` クエリー、契約時に応募を追加飼育係を務取引等 (より正確には、これはデータの挿入された各ブロックに対するものです。 `max_insert_block_size = 1048576` 行。)これは、 `INSERT` と比較して再現します。 しかし、推奨事項に従ってデータを複数のバッチで挿入する場合 `INSERT` 毎秒、それは問題を作成しない。 全体のClickHouseクラスターの使用のための調整一飼育係のクラスタでは、合計数百 `INSERTs` 秒あたり。 データ挿入のスループット(秒あたりの行数)は、レプリケートされていないデータと同じくらい高くなります。 - -のための非常に大きなクラスターで異なるクラスター飼育係の異なる破片. しかし、これはyandexで必要なことは証明されていません。metricaクラスター(約300台のサーバー)。 - -複製は非同期、マルチます。 `INSERT` クエリ(と同様 `ALTER`)利用可能な任意のサーバーに送信することができます。 クエリが実行されているサーバーにデータが挿入され、そのデータが他のサーバーにコピーされます。 非同期であるため、最近挿入されたデータが他のレプリカに何らかの遅延で表示されます。 レプリカの一部が使用できない場合、データは使用できるようになった時点で書き込まれます。 レプリカが使用可能な場合、待機時間は、圧縮されたデータのブロックをネットワーク経由で転送するのにかかる時間です。 - -既定では、挿入クエリは、単一のレプリカからのデータの書き込みの確認を待機します。 データが正常に単一のレプリカに書き込まれ、このレプリカを持つサーバーが存在しなくなると、格納されたデータは失われます。 複数のレプリカからデー `insert_quorum` オプション。 - -データの各ブロックは原子的に書き込まれます。 挿入クエリは、以下のブロックに分割されます `max_insert_block_size = 1048576` 行。 言い換えれば、 `INSERT` クエリは、それが原子的に作られ、1048576未満の行を持っています。 - -データブロックは重複除外されます。 同じデータブロック(同じ順序で同じ行を含む同じサイズのデータブロック)の複数書き込みの場合、ブロックは一度だけ書き込まれます。 この理由は、クライアントアプリケーションがデータがdbに書き込まれたかどうかを知らない場合のネットワーク障害の場合です。 `INSERT` クエリーするだけで簡単に繰り返します。 どのレプリカ挿入が同じデータで送信されたかは関係ありません。 `INSERTs` べき等である。 重複排除圧縮パラメータの制御 [merge\_tree](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-merge_tree) サーバー設定。 - -レプリケーショ さらなるデータ変換(マージ)は、すべてのレプリカで同じ方法で調整され、実行されます。 これにより、ネットワークの使用を最小限に抑えることができます。 (複製の主な目的は、異なるデータセンター内のデータを複製することです。) - -同じデータの任意の数のレプリカを持つことができます。 yandexの。metricaは、本番環境で二重の複製を使用します。 各サーバーはraid-5またはraid-6を使用し、場合によってはraid-10を使用します。 これは比較的信頼性が高く便利な解決策です。 - -システムは、レプリカ上のデータ同期性を監視し、障害発生後に回復することができます。 フェールオーバーは、自動(データのわずかな差異の場合)または半自動(データが大きく異なる場合、構成エラーを示す可能性があります)です。 - -## 複製テーブルの作成 {#creating-replicated-tables} - -その `Replicated` テーブルエンジン名に接頭辞が追加されます。 例えば:`ReplicatedMergeTree`. - -**複製\*マージツリーパラメータ** - -- `zoo_path` — The path to the table in ZooKeeper. -- `replica_name` — The replica name in ZooKeeper. - -例えば: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -
- -非推奨構文の例 - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -
- -その例としては、これらのパラメータを含むことができ換巻きていただけるボディーです。 置換された価値はから取られます ‘macros’ 設定ファイルのセクション。 例えば: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -の表の飼育係るべきで機能していませんが将来的には再現します。 テーブルの異なる資料は異なる。 -この場合、パスは次の部分で構成されます: - -`/clickhouse/tables/` は共通の接頭辞です。 の使用をお勧めしまうことです。 - -`{layer}-{shard}` シャード識別子です。 この例では、Yandexので、二つの部分で構成されています。Metricaクラスターの使用インターネット上のファイル転送sharding. ほとんどのタスクでは、{shard}置換だけを残すことができます。 - -`table_name` ZooKeeperのテーブルのノードの名前です。 テーブル名と同じにすることをお勧めします。 テーブル名とは対照的に、名前の変更クエリの後に変更されないため、明示的に定義されています。 -*HINT*:データベース名を追加することができます `table_name` 同様に。 例えば `db_name.table_name` - -レプリカ名は同じテーブルの別のレプリカを識別します。 この例のように、このサーバー名を使用できます。 名前は各シャード内で一意である必要があります。 - -置換を使用する代わりに、パラメーターを明示的に定義できます。 これは、テストや小さなクラスターの構成に便利です。 ただし、分散ddlクエリは使用できません (`ON CLUSTER`)この場合。 - -組み合わせによる方がクラスターの使用をお勧めいたしま換その可能性を低減するにはエラーになります。 - -実行する `CREATE TABLE` 各レプリカに対するクエリ。 このクエ - -テーブルに他のレプリカのデータがすでに含まれている後に新しいレプリカを追加すると、データはクエリの実行後に他のレプリカから新しいレプリ つまり、新しいレプリカは他のレプリカと同期します。 - -レプリカを削除するには `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. - -## 障害後の復旧 {#recovery-after-failures} - -場合飼育係が不可の場合、サーバは、複製のテーブルスイッチ読み取り専用モードになります。 システムは定期的にzookeeperに接続しようとします。 - -ZooKeeperが使用中に利用できない場合 `INSERT`、またはZooKeeperとやり取りするとエラーが発生し、例外がスローされます。 - -ZooKeeperに接続した後、システムはローカルファイルシステムのデータセットが期待されるデータセットと一致するかどうかをチェックします(ZooKeeperはこの情報 小さな不整合がある場合、システムはデータをレプリカと同期することで解決します。 - -システムが壊れたデータ部分(ファイルのサイズが間違っている)または認識されない部分(ファイルシステムに書き込まれたがzookeeperに記録されていな `detached` サブディレクトリ(削除されません)。 他の部分がコピーからのレプリカ. - -ClickHouseは大量のデータを自動的に削除するなどの破壊的な操作を実行しません。 - -サーバーが起動(またはzookeeperとの新しいセッションを確立)すると、すべてのファイルの量とサイズのみをチェックします。 ファイルサイズが一致しているが、バイトが途中で変更されている場合、これはすぐには検出されません。 `SELECT` クエリ。 クエリは、一致しないチェックサムまたは圧縮ブロックのサイズに関する例外をスローします。 この場合、データパーツは検証キューに追加され、必要に応じてレプリカからコピーされます。 - -データのローカルセットが予想されるセットと大きく異なる場合は、安全機構がトリガーされます。 サーバーはこれをログに入力し、起動を拒否します。 この理由は、シャード上のレプリカが別のシャード上のレプリカのように誤って構成された場合など、このケースが構成エラーを示している可能性がある しかし、しきい値をこの機構の設定かなり低く、こうした状況が起こる中で、失敗を回復しました。 この場合、データは半自動的に復元されます。 “pushing a button”. - -回復を開始するには、ノードを作成します `/path_to_table/replica_name/flags/force_restore_data` で飼育係とコンテンツ、またはコマンドを実行し復元すべての複製のテーブル: - -``` bash -sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -次に、サーバーを再起動します。 開始時に、サーバーはこれらのフラグを削除し、回復を開始します。 - -## 完全なデータの損失後の回復 {#recovery-after-complete-data-loss} - -すべてのデータやメタデータ消えたらサーバには、次の手順に従ってください復興: - -1. サーバーにclickhouseをインストール. シャード識別子とレプリカを含むコンフィグファイルで置換を正しく定義します。 -2. サーバー上で手動で複製する必要のある複雑でないテーブルがある場合は、ディレクトリ内のレプリカからデータをコピーします `/var/lib/clickhouse/data/db_name/table_name/`). -3. にあるテーブル定義のコピー `/var/lib/clickhouse/metadata/` レプリカから。 テーブル定義でシャードまたはレプリカ識別子が明示的に定義されている場合は、このレプリカに対応するように修正します。 (あるいは、サーバーを起動してすべての `ATTACH TABLE` にあったはずのクエリ。のsqlファイル `/var/lib/clickhouse/metadata/`.) -4. 回復を開始するには、zookeeperノードを作成します `/path_to_table/replica_name/flags/force_restore_data` 他のコンテンツ、またはコマンドを実行し復元すべての複製のテーブル: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -その後、サーバーを起動します(既に実行されている場合は再起動します)。 デー - -代替の回復オプションは削除に関する情報は失われたレプリカから飼育係 (`/path_to_table/replica_name`)、レプリカを再度作成します。 “[複製テーブルの作成](#creating-replicated-tables)”. - -リカバリ中のネットワーク帯域幅に制限はありません。 一度に多くのレプリカを復元する場合は、この点に留意してください。 - -## MergetreeからReplicatedmergetreeへの変換 {#converting-from-mergetree-to-replicatedmergetree} - -我々はこの用語を使用する: `MergeTree` のすべてのテーブルエンジンを参照するには `MergeTree family`、の場合と同じ `ReplicatedMergeTree`. - -あなたが持っていた場合 `MergeTree` したテーブルを手動で再現でき換で再現します。 すでに大量のデータを収集している場合は、これを行う必要があります `MergeTree` これで、レプリケーションを有効にします。 - -さまざまなレプリカでデータが異なる場合は、最初に同期するか、レプリカ以外のすべてのデータを削除します。 - -既存のmergetreeテーブルの名前を変更し、 `ReplicatedMergeTree` 古い名前のテーブル。 -古いテーブルからデータを移動する `detached` サブディレクトリ内のディレクトリを新しいテーブルデータ (`/var/lib/clickhouse/data/db_name/table_name/`). -その後、実行 `ALTER TABLE ATTACH PARTITION` 作業セットにこれらのデータ部分を追加するレプリカのいずれか。 - -## ReplicatedmergetreeからMergetreeへの変換 {#converting-from-replicatedmergetree-to-mergetree} - -別の名前のmergetreeテーブルを作成します。 ディレクトリからすべてのデータを `ReplicatedMergeTree` テーブルデータを新しいテーブルのデータディレクトリです。 次に、 `ReplicatedMergeTree` テーブルとサーバーを再起動します。 - -あなたが取り除きたいなら `ReplicatedMergeTree` サーバーを起動せずにテーブル: - -- 対応するものを削除する `.sql` メタデータディレク (`/var/lib/clickhouse/metadata/`). -- ZooKeeperの対応するパスを削除します (`/path_to_table/replica_name`). - -この後、サーバーを起動し、 `MergeTree` テーブル、そのディレクトリにデータを移動し、サーバーを再起動します。 - -## Zookeeperクラスター内のメタデータが失われたり破損した場合の回復 {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} - -ZooKeeper内のデータが失われたり破損したりした場合は、上記のように単純なテーブルに移動してデータを保存することができます。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/ja/engines/table_engines/mergetree_family/summingmergetree.md b/docs/ja/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index 1cf967148d2..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: SummingMergeTree ---- - -# Summingmergetree {#summingmergetree} - -エンジンは [MergeTree](mergetree.md#table_engines-mergetree). 違いは、データ部分をマージするとき `SummingMergeTree` テーブルClickHouseは、すべての行を同じ主キー(またはより正確には同じ)で置き換えます [ソートキー](mergetree.md))数値データ型を持つ列の集計値を含む行。 並べ替えキーが単一のキー値が多数の行に対応するように構成されている場合、これによりストレージボリュームが大幅に削減され、データ選択がスピードア - -私たちは使用するエンジンと一緒に `MergeTree`. 完全なデータを格納する `MergeTree` テーブル、および使用 `SummingMergeTree` レポートを準備するときなど、集計データを保存する場合。 このようなアプローチは、誤って構成された主キーのために貴重なデー - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = SummingMergeTree([columns]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -説明リクエストパラメータの参照 [要求の説明](../../../sql_reference/statements/create.md). - -**SummingMergeTreeのパラメータ** - -- `columns` -値が要約される列の名前を持つタプル。 省略可能なパラメータ。 - 列は数値型である必要があり、主キーに含めることはできません。 - - もし `columns` 指定されていない場合、ClickHouseは、プライマリキーに含まれていない数値データ型を持つすべての列の値を集計します。 - -**クエリ句** - -作成するとき `SummingMergeTree` テーブル同じ [句](mergetree.md) 作成するときと同じように、必須です。 `MergeTree` テーブル。 - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 可能であれば、古いプロジェクトを上記の方法に切り替えてください。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) -``` - -すべてのパラメーターを除く `columns` と同じ意味を持つ `MergeTree`. - -- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. - -
- -## 使用例 {#usage-example} - -次の表を考えてみます: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -それにデータを挿入する: - -``` sql -INSERT INTO summtt Values(1,1),(1,2),(2,1) -``` - -ClickHouseは完全ではないすべての行を合計してもよい ([以下を参照](#data-processing))ので、我々は集計関数を使用します `sum` と `GROUP BY` クエリ内の句。 - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - -``` text -┌─key─┬─sum(value)─┐ -│ 2 │ 1 │ -│ 1 │ 3 │ -└─────┴────────────┘ -``` - -## データ処理 {#data-processing} - -データがテーブルに挿入されると、そのまま保存されます。 これは、同じプライマリキーを持つ行が合計され、結果のデータ部分ごとに行が置き換えられたときです。 - -ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`)集計関数 [合計()](../../../sql_reference/aggregate_functions/reference.md#agg_function-sum) と `GROUP BY` 上記の例で説明したように、クエリで句を使用する必要があります。 - -### 合計の共通ルール {#common-rules-for-summation} - -数値データ型の列の値が集計されます。 列のセットは、パラメータによって定義されます `columns`. - -合計のすべての列の値が0の場合、行は削除されます。 - -列が主キーに含まれておらず、まとめられていない場合は、既存の値から任意の値が選択されます。 - -主キーの列の値は集計されません。 - -### Aggregatefunction列の合計 {#the-summation-in-the-aggregatefunction-columns} - -列の場合 [AggregateFunctionタイプ](../../../sql_reference/data_types/aggregatefunction.md) クリックハウスは [ツつィツ姪"ツつ"ツ債ツづュツつケ](aggregatingmergetree.md) 機能に従って集約するエンジン。 - -### 入れ子構造 {#nested-structures} - -テーブルでネストしたデータ構造と加工"と言われています。 - -入れ子になったテーブルの名前が `Map` また、以下の条件を満たす少なくとも二つの列が含まれています: - -- 最初の列は数値です `(*Int*, Date, DateTime)` または文字列 `(String, FixedString)`、それを呼びましょう `key`, -- 他の列は算術演算です `(*Int*, Float32/64)`、それを呼びましょう `(values...)`, - -次に、このネストされたテーブルは、 `key => (values...)` 行をマージすると、二つのデータセットの要素は次のようにマージされます `key` 対応する `(values...)`. - -例: - -``` text -[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] -[(1, 100)] + [(1, 150)] -> [(1, 250)] -[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] -[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] -``` - -データを要求するときは、 [sumMap(キー,値)](../../../sql_reference/aggregate_functions/reference.md) の集約のための関数 `Map`. - -入れ子になったデータ構造の場合、合計の列のタプルに列を指定する必要はありません。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/ja/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/ja/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index a6d337f1eef..00000000000 --- a/docs/ja/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: VersionedCollapsingMergeTree ---- - -# Versionedcollapsingmergetree {#versionedcollapsingmergetree} - -このエンジン: - -- では迅速書き込みオブジェクトとは常に変化しています。 -- バックグラウン これを大幅に削減量に保管します。 - -セクションを見る [折りたたみ](#table_engines_versionedcollapsingmergetree) 詳細については。 - -エンジンは [MergeTree](mergetree.md#table_engines-mergetree) 追加した論理崩壊行のアルゴリズムのための統合データ部品です。 `VersionedCollapsingMergeTree` と同じ目的を果たす [CollapsingMergeTree](collapsingmergetree.md) が異なる崩壊のアルゴリズムを挿入し、データを任意の順番で複数のスレッド)。 特に、 `Version` 列は、間違った順序で挿入されていても、行を適切に折りたたむのに役立ちます。 対照的に, `CollapsingMergeTree` 厳密に連続した挿入のみを許可します。 - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -説明のクエリパラメータの [クエリの説明](../../../sql_reference/statements/create.md). - -**エンジン変数** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Name of the column with the type of row: `1` は “state” 行, `-1` は “cancel” 行 - - 列データ型は次のようになります `Int8`. - -- `version` — Name of the column with the version of the object state. - - 列データ型は次のようになります `UInt*`. - -**クエリ句** - -作成するとき `VersionedCollapsingMergeTree` テーブル、同じ [句](mergetree.md) を作成するときに必要です。 `MergeTree` テーブル。 - -
- -テーブルを作成する非推奨の方法 - -!!! attention "注意" - 用途では使用しないでください方法で新規プロジェクト. 可能であれば、古いプロジェクトを上記の方法に切り替えます。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -以下を除くすべてのパラメータ `sign` と `version` と同じ意味を持つ `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` は “state” 行, `-1` は “cancel” 行 - - Column Data Type — `Int8`. - -- `version` — Name of the column with the version of the object state. - - 列データ型は次のようになります `UInt*`. - -
- -## 折りたたみ {#table_engines-versionedcollapsingmergetree} - -### データ {#data} - -あるオブジェクトのデータを継続的に変更する必要がある状況を考えてみましょう。 オブジェクトに対して一つの行を持ち、変更があるときはいつでも行を更新するのが妥当です。 ただし、dbmsでは、ストレージ内のデータの書き換えが必要なため、更新操作は高価で低速です。 データをすばやく書き込む必要がある場合は更新できませんが、オブジェクトに変更を順番に書き込むことができます。 - -を使用 `Sign` 行を書き込むときの列。 もし `Sign = 1` これは、行がオブジェクトの状態であることを意味します(それを呼び出しましょう “state” 行)。 もし `Sign = -1` これは、同じ属性を持つオブジェクトの状態の取り消しを示します( “cancel” 行)。 また、 `Version` 別の番号を持つオブジェクトの各状態を識別する必要がある列。 - -たとえば、ユーザーがいくつかのサイトで訪問したページの数と、そこにいた期間を計算したいとします。 ある時点で、ユーザーアクティビティの状態で次の行を書きます: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -ある時点で、ユーザーアクティビティの変更を登録し、次の二つの行を書き込みます。 - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -最初の行は、オブジェクト(user)の前の状態を取り消します。 でコピーのすべての分野を中止状態を除く `Sign`. - -次の行には、現在の状態が含まれています。 - -ユーザーアクティビティの最後の状態だけが必要なので、行 - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -オブジェクトの無効な(古い)状態を削除して、削除することができます。 `VersionedCollapsingMergeTree` これは、データ部分をマージ中に行います。 - -そんなしが必要であるが、行の変更を参照 [Algorithm](#table_engines-versionedcollapsingmergetree-algorithm). - -**使用上の注意** - -1. プログラムを書き込み、データ意のオブジェクトを解除します。 その “cancel” 文字列は、 “state” 反対の文字列 `Sign`. この増加の初期サイズでの保存が可能なデータを書き込む。 -2. 列の長い配列は、書き込みの負荷のためにエンジンの効率を低下させます。 データがより簡単になればなるほど、効率は向上します。 -3. `SELECT` 結果は、オブジェクト変更の履歴の一貫性に強く依存します。 挿入するデータを準備するときは正確です。 セッションの深さなどの非負の指標の負の値など、一貫性のないデータで予測不可能な結果を得ることができます。 - -### Algorithm {#table_engines-versionedcollapsingmergetree-algorithm} - -ClickHouseは、データパーツをマージするときに、同じ主キーとバージョンが異なる行の各ペアを削除します `Sign`. 行の順序は関係ありません。 - -ClickHouseがデータを挿入すると、主キーで行を並べ替えます。 この `Version` 列は主キーにはなく、ClickHouseはそれを主キーに暗黙的に最後のフィールドとして追加し、それを順序付けに使用します。 - -## データの選択 {#selecting-data} - -ClickHouseは、同じ主キーを持つすべての行が同じ結果のデータ部分にあるか、同じ物理サーバー上にあることを保証するものではありません。 これは、データの書き込みとそれに続くデータ部分のマージの両方に当てはまります。 さらに、ClickHouseプロセス `SELECT` 複数のスレッドを持つクエリは、結果の行の順序を予測することはできません。 これは、完全に取得する必要がある場合に集約が必要であることを意味します “collapsed” からのデータ `VersionedCollapsingMergeTree` テーブル。 - -折りたたみを完了するには、次のようにクエリを記述します `GROUP BY` この符号を考慮する句および集計関数。 たとえば、数量を計算するには、以下を使用します `sum(Sign)` 代わりに `count()`. 何かの合計を計算するには、次のようにします `sum(Sign * x)` 代わりに `sum(x)`、と追加 `HAVING sum(Sign) > 0`. - -凝集体 `count`, `sum` と `avg` この方法で計算できます。 合計 `uniq` オブジェクトに折りたたまれていない状態がある場合に計算できます。 凝集体 `min` と `max` 計算できないのは `VersionedCollapsingMergeTree` 折りたたまれた状態の値の履歴は保存されません。 - -データを抽出する必要がある場合 “collapsing” な集計(例えば、確認列が存在する最新の値に一致条件)を使用できます `FINAL` のための修飾語 `FROM` 句。 このアプローチは非効率で利用すべきではありませんの大きます。 - -## 使用例 {#example-of-use} - -データ例: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -テーブルの作成: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -データの挿入: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -私たちは二つを使う `INSERT` 二つの異なるデータ部分を作成するクエリ。 単一のクエリでデータを挿入すると、ClickHouseは単一のデータ部分を作成し、マージは実行しません。 - -データの取得: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -ここでは何が見え、折りたたまれた部分はどこにありますか? -二つのデータパーツを二つ作成しました `INSERT` クエリ。 その `SELECT` クエリは二つのスレッドで実行され、結果は行のランダムな順序です。 -デー clickhouseは、予測できない未知の時点でデータパーツをマージします。 - -これが集約が必要な理由です: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -集約を必要とせず、強制的に崩壊させたい場合は、 `FINAL` のための修飾語 `FROM` 句。 - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -これは、データを選択する非常に非効率的な方法です。 大きなテーブルには使用しないでください。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/ja/engines/table_engines/special/dictionary.md b/docs/ja/engines/table_engines/special/dictionary.md deleted file mode 100644 index f2571ca09e8..00000000000 --- a/docs/ja/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: "\u8F9E\u66F8" ---- - -# 辞書 {#dictionary} - -その `Dictionary` エンジンは表示します [辞書](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) クリックハウス表としてのデータ。 - -例として、次の辞書を考えてみましょう `products` 次の構成では: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -辞書データのクエリ: - -``` sql -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - -``` text -┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ -│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ -└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ -``` - -を使用することができ [dictGet\*](../../../sql_reference/functions/ext_dict_functions.md#ext_dict_functions) この形式の辞書データを取得する関数です。 - -このビューがない便だが、rawデータ、または行う場合には、 `JOIN` オペレーション これらのケースでは、以下を使用できます。 `Dictionary` テーブル内のディクショナリデータを表示するエンジン。 - -構文: - -``` sql -CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` -``` - -使用例: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); -``` - - Ok - -テーブルに何があるかを見てみましょう。 - -``` sql -select * from products limit 1; -``` - -``` text -┌────product_id─┬─title───────────┐ -│ 152689 │ Some item │ -└───────────────┴─────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/ja/engines/table_engines/special/distributed.md b/docs/ja/engines/table_engines/special/distributed.md deleted file mode 100644 index 0e20cf08eb3..00000000000 --- a/docs/ja/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: "\u5206\u6563" ---- - -# 分散 {#distributed} - -**分散エンジンを持つテーブルは、自身がデータを保存しません** しかし、複数のサーバー上の分散クエリ処理を許可します。 -読書は自動的に平行である。 読み取り中に、リモートサーバー上のテーブルインデックスが使用されます。 - -の分散型エンジンを受け付けパラメータ: - -- サーバーの設定ファイル内のクラスター名 - -- リモートデータベースの名前 - -- リモートテーブルの名前 - -- シャーディングキー - -- (オプションで)ポリシー名は、非同期送信のための一時ファイルを格納するために使用される - - また見なさい: - - - `insert_distributed_sync` 設定 - - [MergeTree](../mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) 例のため - -例えば: - -``` sql -Distributed(logs, default, hits[, sharding_key[, policy_name]]) -``` - -データはすべてのサーバから読み込まれます。 ‘logs’ デフォルトのクラスター。ヒットテーブルに位置毎にサーバのクラスター -データは読み取られるだけでなく、リモートサーバーで部分的に処理されます(これが可能な限り)。 -たとえば、group byを使用するクエリの場合、データはリモートサーバー上で集計され、集計関数の中間状態がリクエスターサーバーに送信されます。 その後、データはさらに集約されます。 - -データベース名の代わりに、文字列を返す定数式を使用できます。 たとえば、次のようになります。 - -logs – The cluster name in the server's config file. - -クラスターがセットのようなこ: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 1 - 9440 - - - - -``` - -ここでは、クラスターは名前で定義されます ‘logs’ それぞれ二つのレプリカを含む二つのシャードで構成されています。 -シャードは、データの異なる部分を含むサーバーを参照します(すべてのデータを読み取るには、すべてのシャードにアクセスする必要があります)。 -レプリカはサーバーを複製しています(すべてのデータを読み取るために、レプリカのいずれかのデータにアクセスできます)。 - -クラ - -パラメータ `host`, `port`、およびオプション `user`, `password`, `secure`, `compression` サーバーごとに指定します: -- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn't start. If you change the DNS record, restart the server. -- `port` – The TCP port for messenger activity (‘tcp\_port’ 設定では、通常9000)に設定します。 それをhttp\_portと混同しないでください。 -- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [アクセス権](../../../operations/access_rights.md). -- `password` – The password for connecting to a remote server (not masked). Default value: empty string. -- `secure` -接続にsslを使用します。 `port` = 9440. サーバーがリッスンする 9440 と正しい証明書。 -- `compression` -データ圧縮を使用します。 デフォルト値:true。 - -When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing) 設定。 -サーバーとの接続が確立されていない場合は、短いタイムアウトで接続しようとします。 接続に失敗すると、すべてのレプリカに対して次のレプリカが選択されます。 すべてのレプリカに対して接続の試行が失敗した場合、その試行は同じ方法で何度も繰り返されます。 -リモートサーバーは接続を受け入れる可能性がありますが、動作しない可能性があります。 - -シャードのいずれかを指定できます(この場合、クエリ処理は分散ではなくリモートと呼ばれる必要があります)、または任意の数のシャードまで指定でき 各シャードでは、レプリカのいずれかから任意の数に指定することができます。 シャードごとに異なる数のレプリカを指定できます。 - -構成では、任意の数のクラスターを指定できます。 - -クラスタを表示するには、以下を使用します ‘system.clusters’ テーブル。 - -の分散型エンジン能にすることで、社会とクラスターのように現地サーバーです。 ただし、クラスターの構成はサーバー設定ファイルに書き込む必要があります(クラスターのすべてのサーバーではさらに優れています)。 - -The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don't need to create a Distributed table – use the ‘remote’ 代わりにテーブル関数。 セクションを見る [テーブル関数](../../../sql_reference/table_functions/index.md). - -クラスターにデータを書き込む方法は二つあります: - -まず、どのサーバーにどのデータを書き込むかを定義し、各シャードで直接書き込みを実行できます。 つまり、分散テーブルのテーブルにinsertを実行します “looks at”. これは、主題領域の要件のために自明ではないシャーディングスキームを使用できるため、最も柔軟なソリューションです。 これも最適なソリューションからデータを書き込むことができるの異なる資料が完全に独立。 - -次に、分散テーブルでinsertを実行できます。 この場合、テーブルは挿入されたデータをサーバー自体に分散します。 分散テーブルに書き込むには、シャーディングキーセット(最後のパラメータ)が必要です。 さらに、単一のシャードしかない場合、書き込み操作はシャーディングキーを指定せずに動作します。 - -各シャードは設定ファイルで定義された重みを持つことができます。 デフォルトでは、重みは一つに等しいです。 データは、シャードウェイトに比例した量でシャード全体に分散されます。 たとえば、二つのシャードがあり、最初のものが9の重みを持ち、第二のものが10の重みを持つ場合、最初のシャードは9/19の行に送られ、第二のものは10/19 - -各破片は持つことができます ‘internal\_replication’ 設定ファイルで定義されたパラメータ。 - -このパラメータが設定されている場合 ‘true’ 書き込み操作は、最初の正常なレプリカを選択し、それにデータを書き込みます。 分散テーブルの場合は、この代替を使用します “looks at” 複製されたテーブル。 言い換えれば、データが書き込まれるテーブルがそれ自体を複製する場合です。 - -に設定されている場合 ‘false’ データはすべてのレプリカに書き込まれます。 本質的に、これは、分散テーブルがデータ自体を複製することを意味します。 レプリカの整合性はチェックされず、時間の経過とともにわずかに異なるデータが含まれるためです。 - -データの行が送信されるシャードを選択するには、シャーディング式が分析され、残りの部分がシャードの合計ウェイトで除算されます。 行は、残りの半分の間隔に対応するシャードに送られます ‘prev\_weight’ に ‘prev\_weights + weight’、どこ ‘prev\_weights’ 最小の数を持つシャードの合計重量です。 ‘weight’ このシャードの重さです。 たとえば、二つのシャードがあり、最初のシャードの重みが9で、二番目のシャードの重みが10である場合、行は\[0,9)の範囲から残りのシャードの最初のシャー - -シャーディング式には、整数を返す定数とテーブル列からの任意の式を指定できます。 たとえば、次の式を使用できます ‘rand()’ データのランダムな分布の場合、または ‘UserID’ ユーザーのIDを分割する残りの部分で配布する場合(単一のユーザーのデータは単一のシャードに存在し、ユーザーの実行と参加が簡単になります)。 列のいずれかが十分に均等に分散されていない場合は、ハッシュ関数でラップすることができます:intHash64(UserID)。 - -簡単なリマインダからの限定シshardingんを常に適しています。 中規模および大量のデータ(数十のサーバー)では機能しますが、非常に大量のデータ(数百のサーバー以上)では機能しません。 後者の場合はshardingスキームに必要なのではなく、エントリに配布します。 - -SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don't have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. - -次の場合、シャーディングスキームについて心配する必要があります: - -- 特定のキーによるデータの結合(inまたはjoin)が必要なクエリが使用されます。 このキーによってデータがシャードされている場合は、グローバルinまたはグローバル結合の代わりにローカルinまたはjoinを使用できます。 -- 多数のサーバー(数百またはそれ以上)が使用され、多数の小さなクエリ(個々のクライアントのクエリ-ウェブサイト、広告主、またはパートナー)が使用されます。 小さなクエリがクラスタ全体に影響を与えないようにするには、単一のクライアントのデータを単一のシャードに配置することが理にかなっていま また、我々はyandexの中でやったように。metricaでは、biレベルのシャーディングを設定できます。 “layers” レイヤーが複数のシャードで構成されている場合。 単一のクライアントのデータは単一のレイヤーに配置されますが、必要に応じてシャードをレイヤーに追加することができ、データはその中にランダムに配 分散テーブルはレイヤごとに作成され、グローバルクエリ用に単一の共有分散テーブルが作成されます。 - -データは非同期に書き込まれます。 テーブルに挿入すると、データブロックはローカルファイルシステムに書き込まれます。 データはできるだけ早くバックグラウンドでリモートサーバーに送信されます。 データを送信する期間は、以下によって管理されます。 [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) と [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) 設定。 その `Distributed` エンジンを送信し、各ファイルを挿入したデータが別々にまでを一括送信ファイルの [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) 設定。 この設定の改善にクラスターの性能をより一層の活用地域のサーバやネットワーク資源です。 を確認しておきましょうか否かのデータが正常に送信されるチェックリストファイル(データまたは間に-をはさんだ)はテーブルディレクトリ: `/var/lib/clickhouse/data/database/table/`. - -分散テーブルへの挿入後にサーバーが存在しなくなった場合、または大まかな再起動(デバイス障害など)が発生した場合は、挿入されたデータが失われる可 破損したデータ部分がテーブルディレクトリで検出された場合、そのデータ部分は、 ‘broken’ サブディレクトリと、もはや使用。 - -Max\_parallel\_replicasオプションを有効にすると、単一のシャード内のすべてのレプリカでクエリ処理が並列化されます。 詳細については、以下を参照してください [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). - -## 仮想列 {#virtual-columns} - -- `_shard_num` — Contains the `shard_num` (から `system.clusters`). タイプ: [UInt32](../../../sql_reference/data_types/int_uint.md). - -!!! note "メモ" - それ以来 [`remote`](../../../sql_reference/table_functions/remote.md)/`cluster` テーブル機能の内部を一時のインスタンスと同じ分散型エンジン, `_shard_num` あまりにもそこに利用可能です。 - -**また見なさい** - -- [仮想列](index.md#table_engines-virtual_columns) - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/ja/engines/table_engines/special/file.md b/docs/ja/engines/table_engines/special/file.md deleted file mode 100644 index 5eec64c74ea..00000000000 --- a/docs/ja/engines/table_engines/special/file.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u30D5\u30A1\u30A4\u30EB" ---- - -# ファイル {#table_engines-file} - -ファイルにテーブルエンジンのデータをファイルを使ったり、 [ファイル -形式](../../../interfaces/formats.md#formats) (TabSeparated、Nativeなど)。). - -使用例: - -- データからの輸出clickhouseるファイルです。 -- ある形式から別の形式にデータを変換します。 -- ディスク上のファイルを編集して、clickhouseのデータを更新する。 - -## Clickhouseサーバーでの使用状況 {#usage-in-clickhouse-server} - -``` sql -File(Format) -``` - -その `Format` パラメータを指定するか、ファイルのファイルフォーマット 実行するには -`SELECT` クエリは、形式は、入力のためにサポートされ、実行する必要があります -`INSERT` queries – for output. The available formats are listed in the -[形式](../../../interfaces/formats.md#formats) セクション。 - -クリックハウ`File`. で定義されたフォルダを使用します [パス](../../../operations/server_configuration_parameters/settings.md) サーバー構成での設定。 - -テーブルを作成するとき `File(Format)` で空のサブディレクトリとフォルダにまとめた。 データがそのテーブルに書き込まれると、 `data.Format` サブディレクト - -このサブフォルダとファイルをserver filesystemに手動で作成してから [ATTACH](../../../sql_reference/statements/misc.md) でテーブルの情報をマッチングの名前でデータベースバックエンドからファイルです。 - -!!! warning "警告" - ClickHouseはそのようなファイルの外部変更を追跡しないため、この機能には注意してください。 ClickHouseを介して同時に書き込みを行い、ClickHouseの外部に書き込みを行った結果は未定義です。 - -**例えば:** - -**1.** セットアップ `file_engine_table` テーブル: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -デフォルトでclickhouseフォルダを作成します `/var/lib/clickhouse/data/default/file_engine_table`. - -**2.** 手動で作成する `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` を含む: - -``` bash -$ cat data.TabSeparated -one 1 -two 2 -``` - -**3.** データのクエリ: - -``` sql -SELECT * FROM file_engine_table -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Clickhouseでの使用-ローカル {#usage-in-clickhouse-local} - -で [ツつ"ツづ按つオツ!](../../../operations/utilities/clickhouse-local.md) ファイルエンジ `Format`. デフォルトの入力/出力ストリームは、数値または人間が読める名前を使用して指定できます `0` または `stdin`, `1` または `stdout`. -**例えば:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## 実装の詳細 {#details-of-implementation} - -- 複数 `SELECT` クエリは同時に実行できますが、 `INSERT` クエリはお互いを待ちます。 -- 新しいファイルの作成に対応 `INSERT` クエリ。 -- ファイルが存在する場合, `INSERT` それに新しい値を追加します。 -- サポートなし: - - `ALTER` - - `SELECT ... SAMPLE` - - 指数 - - 複製 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/ja/engines/table_engines/special/generate.md b/docs/ja/engines/table_engines/special/generate.md deleted file mode 100644 index 340808c4278..00000000000 --- a/docs/ja/engines/table_engines/special/generate.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 46 -toc_title: GenerateRandom ---- - -# Generaterandom {#table_engines-generate} - -のgeneraterandomテーブルエンジンの生産ランダムなデータが与えられたテーブルのスキーマ. - -使用例: - -- 再現可能な大きいテーブルに住むテストの使用。 -- ファジングテストのランダム入力を生成します。 - -## Clickhouseサーバーでの使用状況 {#usage-in-clickhouse-server} - -``` sql -ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) -``` - -その `max_array_length` と `max_string_length` すべ -生成されたデータに対応する配列の列と文字列。 - -テーブル生成エンジンは `SELECT` クエリ。 - -対応して [データタイプ](../../../sql_reference/data_types/index.md) これは、以下を除いてテーブルに格納できます `LowCardinality` と `AggregateFunction`. - -**例えば:** - -**1.** セットアップ `generate_engine_table` テーブル: - -``` sql -CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) -``` - -**2.** データのクエリ: - -``` sql -SELECT * FROM generate_engine_table LIMIT 3 -``` - -``` text -┌─name─┬──────value─┐ -│ c4xJ │ 1412771199 │ -│ r │ 1791099446 │ -│ 7#$ │ 124312908 │ -└──────┴────────────┘ -``` - -## 実装の詳細 {#details-of-implementation} - -- サポートなし: - - `ALTER` - - `SELECT ... SAMPLE` - - `INSERT` - - 指数 - - 複製 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/ja/engines/table_engines/special/join.md b/docs/ja/engines/table_engines/special/join.md deleted file mode 100644 index 2120ca61495..00000000000 --- a/docs/ja/engines/table_engines/special/join.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u53C2\u52A0" ---- - -# 参加 {#join} - -Inを使用するための準備済みデータ構造 [JOIN](../../../sql_reference/statements/select.md#select-join) オペレーション - -## テーブルの作成 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], -) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) -``` - -の詳細な説明を参照してください [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) クエリ。 - -**エンジン変数** - -- `join_strictness` – [厳密に結合する](../../../sql_reference/statements/select.md#select-join-strictness). -- `join_type` – [結合タイプ](../../../sql_reference/statements/select.md#select-join-types). -- `k1[, k2, ...]` – Key columns from the `USING` その句 `JOIN` 操作はで行われる。 - -入力 `join_strictness` と `join_type` 引用符なしのパラメーター。, `Join(ANY, LEFT, col1)`. 彼らは `JOIN` テーブルが使用される操作。 パラメータが一致しない場合、ClickHouseは例外をスローせず、誤ったデータを返すことがあります。 - -## テーブルの使用法 {#table-usage} - -### 例えば {#example} - -左側のテーブルの作成: - -``` sql -CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog -``` - -``` sql -INSERT INTO id_val VALUES (1,11)(2,12)(3,13) -``` - -右側の作成 `Join` テーブル: - -``` sql -CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) -``` - -``` sql -INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) -``` - -テーブルの結合: - -``` sql -SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 -``` - -``` text -┌─id─┬─val─┬─id_val_join.val─┐ -│ 1 │ 11 │ 21 │ -│ 2 │ 12 │ ᴺᵁᴸᴸ │ -│ 3 │ 13 │ 23 │ -└────┴─────┴─────────────────┘ -``` - -代わりとして、データを取り出すことができます `Join` 結合キー値を指定するテーブル: - -``` sql -SELECT joinGet('id_val_join', 'val', toUInt32(1)) -``` - -``` text -┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ -│ 21 │ -└────────────────────────────────────────────┘ -``` - -### データの選択と挿入 {#selecting-and-inserting-data} - -を使用することができ `INSERT` データを追加するクエリ `Join`-エンジンテーブル。 テーブルが作成された場合 `ANY` 厳密さ、重複キーのデータは無視されます。 と `ALL` 厳密さは、すべての行が追加されます。 - -実行することはできません `SELECT` テーブルから直接クエリします。 代わりに、次のいずれかの方法を使用します: - -- テーブルをaの右側に置きます `JOIN` 句。 -- コールを [joinGet](../../../sql_reference/functions/other_functions.md#joinget) この関数を使用すると、テーブルからデータをディクショナリと同じ方法で抽出できます。 - -### 制限事項と設定 {#join-limitations-and-settings} - -テーブルを作成するときは、次の設定が適用されます: - -- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) -- [max\_rows\_in\_join](../../../operations/settings/query_complexity.md#settings-max_rows_in_join) -- [max\_bytes\_in\_join](../../../operations/settings/query_complexity.md#settings-max_bytes_in_join) -- [join\_overflow\_mode](../../../operations/settings/query_complexity.md#settings-join_overflow_mode) -- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) - -その `Join`-エンジンテーブルは使用できません `GLOBAL JOIN` オペレーション - -その `Join`-エンジンは、使用 [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) の設定 `CREATE TABLE` 声明。 と [SELECT](../../../sql_reference/statements/select.md) クエリは、使用を可能に `join_use_nulls` あまりにも。 あなたが持って異なる `join_use_nulls` 設定は、テーブルを結合エラーを得ることができます。 それは結合の種類に依存します。 使用するとき [joinGet](../../../sql_reference/functions/other_functions.md#joinget) 機能、同じを使用しなければなりません `join_use_nulls` の設定 `CRATE TABLE` と `SELECT` 文。 - -## データ記憶 {#data-storage} - -`Join` テーブルデータは常にRAMにあります。 を挿入する際、列表ClickHouseに書き込みデータブロックのディレクトリのディスクできるように復元され、サーバが再起動してしまいます。 - -場合はサーバが再起動誤り、データブロックのディスクがいます。 この場合、破損したデータを含むファイルを手動で削除する必要があります。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/ja/engines/table_engines/special/materializedview.md b/docs/ja/engines/table_engines/special/materializedview.md deleted file mode 100644 index 213066fc557..00000000000 --- a/docs/ja/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 43 -toc_title: MaterializedView ---- - -# Materializedview {#materializedview} - -マテリアライズドビューの実装に使用されます(詳細については、 [CREATE TABLE](../../../sql_reference/statements/create.md)). データを格納するために、ビューの作成時に指定された別のエンジンを使用します。 テーブルから読み取るときは、このエンジンを使用します。 - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/ja/engines/table_engines/special/merge.md b/docs/ja/engines/table_engines/special/merge.md deleted file mode 100644 index be0ee5afbe6..00000000000 --- a/docs/ja/engines/table_engines/special/merge.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: "\u30DE\u30FC\u30B8" ---- - -# マージ {#merge} - -その `Merge` エンジン(と混同しないように `MergeTree`)データ自体を格納しませんが、同時に他のテーブルの任意の数からの読み取りを可能にします。 -読書は自動的に平行である。 表への書き込みはサポートされません。 読み取り時には、実際に読み取られているテーブルのインデックスが存在する場合に使用されます。 -その `Merge` テーブルのデータベース名と正規表現です。 - -例えば: - -``` sql -Merge(hits, '^WatchLog') -``` - -データはテーブルから読み込まれます。 `hits` 正規表現に一致する名前を持つデータベース ‘`^WatchLog`’. - -データベース名の代わりに、文字列を返す定数式を使用できます。 例えば, `currentDatabase()`. - -Regular expressions — [re2unit description in lists](https://github.com/google/re2) (PCREのサブセットをサポート)、大文字と小文字を区別します。 -正規表現のエスケープシンボルに関する注意事項を参照してください。 “match” セクション。 - -読み込むテーブルを選択するとき、 `Merge` 正規表現と一致していても、テーブル自体は選択されません。 これはループを避けるためです。 -それは可能に作成二つ `Merge` お互いのデータを無限に読み取ろうとするテーブルですが、これは良い考えではありません。 - -使用する典型的な方法 `Merge` エンジンは多数を使用のためです `TinyLog` 単一のテーブルと同様にテーブル。 - -例2: - -古いテーブル(watchlog\_old)があり、データを新しいテーブル(watchlog\_new)に移動せずにパーティション分割を変更することにしたとしましょう。 - -``` sql -CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree(date, (UserId, EventType), 8192); -INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - -CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; -INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - -CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - -SELECT * -FROM WatchLog -``` - -``` text -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-01 │ 1 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-02 │ 2 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -``` - -## 仮想列 {#virtual-columns} - -- `_table` — Contains the name of the table from which data was read. Type: [文字列](../../../sql_reference/data_types/string.md). - - 定数条件を設定することができます `_table` で `WHERE/PREWHERE` 句(例えば, `WHERE _table='xyz'`). この場合、読み取り操作はそのテーブルに対してのみ実行されます。 `_table` は満足しているので、 `_table` 列は索引として機能します。 - -**また見なさい** - -- [仮想列](index.md#table_engines-virtual_columns) - -[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/ja/faq/general.md b/docs/ja/faq/general.md index e50a7aa5081..e188f1ed41c 100644 --- a/docs/ja/faq/general.md +++ b/docs/ja/faq/general.md @@ -47,7 +47,7 @@ SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV ### ファイルエンジンテーブルの使用 {#using-a-file-engine-table} -見る [ファイル](../engines/table_engines/special/file.md). +見る [ファイル](../engines/table-engines/special/file.md). ### コマンドラインのリダイ {#using-command-line-redirection} diff --git a/docs/ja/getting_started/example_datasets/amplab_benchmark.md b/docs/ja/getting-started/example-datasets/amplab-benchmark.md similarity index 100% rename from docs/ja/getting_started/example_datasets/amplab_benchmark.md rename to docs/ja/getting-started/example-datasets/amplab-benchmark.md diff --git a/docs/ja/getting_started/example_datasets/criteo.md b/docs/ja/getting-started/example-datasets/criteo.md similarity index 100% rename from docs/ja/getting_started/example_datasets/criteo.md rename to docs/ja/getting-started/example-datasets/criteo.md diff --git a/docs/ja/getting-started/example-datasets/index.md b/docs/ja/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..f4bb5e33ad5 --- /dev/null +++ b/docs/ja/getting-started/example-datasets/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Example Datasets +toc_priority: 12 +toc_title: "\u5C0E\u5165" +--- + +# データセット例 {#example-datasets} + +この方法について説明し得る例データセットおよび輸入しclickhouse. +一部のデータセットの例ではクエリーもございます。 + +- [匿名のyandexの。metricaデータセット](metrica.md) +- [スタースキーマのベンチマーク](star-schema.md) +- [WikiStat](wikistat.md) +- [Criteoからのクリックログのテラバイト](criteo.md) +- [AMPLab Big Dataベンチマーク](amplab-benchmark.md) +- [ニューヨーク](nyc-taxi.md) +- [オンタイム](ontime.md) + +[元の記事](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/ja/getting-started/example-datasets/metrica.md b/docs/ja/getting-started/example-datasets/metrica.md new file mode 100644 index 00000000000..a53831afc89 --- /dev/null +++ b/docs/ja/getting-started/example-datasets/metrica.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 21 +toc_title: "Yandex\u306E\u3002Metrica\u30C7\u30FC\u30BF" +--- + +# 匿名のyandexの。metricaデータ {#anonymized-yandex-metrica-data} + +データセットのテーブルを含む匿名化されたデーター (`hits_v1`)および訪問 (`visits_v1`)Yandexの。メトリカ につなげていくかを学びますYandex.Metrica in [クリックハウスの歴史](../../introduction/history.md) セクション。 + +どちらのテーブルも圧縮形式でダウンロードできます `tsv.xz` ファイルに対して割. それに加えて、の拡張バージョン `hits` 100万行を含むテーブルは、TSVとして利用可能ですhttps://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz そして準備された仕切りとしてhttps://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz。 + +## 取得のテーブルから調の間仕切り {#obtaining-tables-from-prepared-partitions} + +ダウンロード、輸入のヒットテーブル: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar +tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +ダウンロードと読み込み: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar +tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## 圧縮されたtsvファイルからの表の取得 {#obtaining-tables-from-compressed-tsv-file} + +圧縮されたtsvファ: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +圧縮tsv-fileからの訪問のダウンロードとインポート: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## クエリ例 {#example-queries} + +[ClickHouseチュートリアル](../../getting-started/tutorial.md) は、Yandexのに基づいています。Metricaデータの推奨使うことができるようにこのデータやトランザクションデータだけを通してチュートリアルです。 + +これらのテーブルへのクエリの追加の例は、 [ステートフルテスト](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) ClickHouseの(彼らは名前が付けられています `test.hists` と `test.visits` そこ)。 diff --git a/docs/ja/getting_started/example_datasets/nyc_taxi.md b/docs/ja/getting-started/example-datasets/nyc-taxi.md similarity index 100% rename from docs/ja/getting_started/example_datasets/nyc_taxi.md rename to docs/ja/getting-started/example-datasets/nyc-taxi.md diff --git a/docs/ja/getting_started/example_datasets/ontime.md b/docs/ja/getting-started/example-datasets/ontime.md similarity index 100% rename from docs/ja/getting_started/example_datasets/ontime.md rename to docs/ja/getting-started/example-datasets/ontime.md diff --git a/docs/ja/getting_started/example_datasets/star_schema.md b/docs/ja/getting-started/example-datasets/star-schema.md similarity index 100% rename from docs/ja/getting_started/example_datasets/star_schema.md rename to docs/ja/getting-started/example-datasets/star-schema.md diff --git a/docs/ja/getting_started/example_datasets/wikistat.md b/docs/ja/getting-started/example-datasets/wikistat.md similarity index 100% rename from docs/ja/getting_started/example_datasets/wikistat.md rename to docs/ja/getting-started/example-datasets/wikistat.md diff --git a/docs/ja/getting-started/index.md b/docs/ja/getting-started/index.md new file mode 100644 index 00000000000..cf1cd049f89 --- /dev/null +++ b/docs/ja/getting-started/index.md @@ -0,0 +1,17 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Getting Started +toc_hidden: true +toc_priority: 8 +toc_title: "\u96A0\u3055\u308C\u305F" +--- + +# はじめに {#getting-started} + +あなたがclickhouseに慣れていないし、そのパフォーマンスのハンズオン感を取得したい場合は、まず、あなたが通過する必要があります [インストール処理](install.md). その後、あなたは: + +- [詳細なチュートリアルを通過](tutorial.md) +- [データセット例の実験](example-datasets/ontime.md) + +[元の記事](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/ja/getting-started/install.md b/docs/ja/getting-started/install.md new file mode 100644 index 00000000000..c9662254bf2 --- /dev/null +++ b/docs/ja/getting-started/install.md @@ -0,0 +1,184 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 11 +toc_title: "\u8A2D\u7F6E" +--- + +# 設置 {#installation} + +## システム要件 {#system-requirements} + +ClickHouseは、x86\_64、AArch64、またはPowerPC64LE CPUアーキテクチャを使用して、Linux、FreeBSD、またはMac OS X上で実行できます。 + +公式の事前構築されたバイナリは、通常、x86\_64用にコンパイルされ、sse4.2命令セットを利用するため、特に明記されていない限り、それをサポートす 現在のcpuがsse4.2をサポートしているかどう: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +走clickhouseにプロセッサーをサポートしていないsse4.2てaarch64はpowerpc64le建築き [ソースからのClickHouseのビルド](#from-sources) 適切な構成の調節を使って。 + +## 使用可能な設置方法 {#available-installation-options} + +### DEBパッケージから {#install-from-deb-packages} + +公式の事前コンパイルを使用することをお勧めします `deb` DebianやUbuntuのためのパッケージ. + +そこにこれらのコマンド置パッケージ: + +``` bash +{% include 'install/deb.sh' %} +``` + +でもダウンロードとインストールパッケージを手動で下からもアクセスできます。https://repo.clickhouse.tech/deb/stable/main/. + +最新のバージョンを使用する場合は、以下を置き換えます `stable` と `testing` (これはテスト環境に推奨されます)。 + +#### パッケージ {#packages} + +- `clickhouse-common-static` — Installs ClickHouse compiled binary files. +- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` とをインストールしデフォルトのサーバーの設定をします。 +- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` そして他の顧客関係した用具。 および設置お客様の設定ファイルです。 +- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. + +### RPMパッケージから {#from-rpm-packages} + +公式の事前コンパイルを使用することをお勧めします `rpm` パッケージCentOS,RedHat、その他のrpmベLinuxディストリビューション. + +まず、公式リポジトリを追加する必要があります: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 +``` + +最新のバージョンを使用する場合は、以下を置き換えます `stable` と `testing` (これはテスト環境に推奨されます)。 その `prestable` タグも時々利用可能です。 + +そこにこれらのコマンド置パッケージ: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +でもダウンロードとインストールパッケージを手動で下からもアクセスできます。https://repo.クリックハウス。テック/rpm/安定した/x86\_64. + +### Tgzアーカイブから {#from-tgz-archives} + +公式の事前コンパイルを使用することをお勧めします `tgz` すべてのLinuxディストリビュ `deb` または `rpm` パッケージは不可能です。 + +必要なバージョンは `curl` または `wget` リポジトリからhttps://repo.yandex.ru/clickhouse/tgz/。 +その後、アーカイブをダウンロードは開梱と設置と設置のためのイントロダクションです。 最新バージョンの例: + +``` bash +export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz + +tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz +sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz +sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-server-$LATEST_VERSION.tgz +sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh +sudo /etc/init.d/clickhouse-server start + +tar -xzvf clickhouse-client-$LATEST_VERSION.tgz +sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh +``` + +運用環境では、最新のものを使用することをお勧めします `stable`-バージョン。 その番号はGitHubページにありますhttps://github.com/ClickHouse/ClickHouse/tags 後置を使って `-stable`. + +### ドッカーの画像から {#from-docker-image} + +Dockerの中でClickHouseを実行するには、次のガイドに従います [Docker拠点](https://hub.docker.com/r/yandex/clickhouse-server/). これらの画像は、公式を使用 `deb` 中のパッケージ。 + +### ソースから {#from-sources} + +ClickHouseを手動でコンパイルするには、以下の手順に従います [Linux](../development/build.md) または [Mac OS X](../development/build-osx.md). + +できるコンパイルパッケージはインストールしていたプログラムを使用もインストールせずにパッケージ。 またビルを手動で無数の組み合わせで自分だけのsse4.2に必要構築のためのaarch64定する必要はありません。 + + Client: programs/clickhouse-client + Server: programs/clickhouse-server + +データとメタデータフォルダを作成する必要があります `chown` 目的のユーザーのためのそれら。 それらのパスは、server config(src/programs/server/config)で変更できます。xml)、デフォルトでは次のとおりです: + + /opt/clickhouse/data/default/ + /opt/clickhouse/metadata/default/ + +Gentooでは、次のものを使用できます `emerge clickhouse` ソースからClickHouseをインストールする。 + +## 起動 {#launch} + +サーバを起動デーモンとして、: + +``` bash +$ sudo service clickhouse-server start +``` + +あなたが持っていない場合 `service` コマンド、実行 + +``` bash +$ sudo /etc/init.d/clickhouse-server start +``` + +のログを参照してください `/var/log/clickhouse-server/` ディレクトリ。 + +サーバーが起動しない場合は、ファイル内の設定を確認してください `/etc/clickhouse-server/config.xml`. + +または手動で開始のサーバーからのコンソール: + +``` bash +$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +この場合、ログはコンソールに印刷され、開発中に便利です。 +設定ファイルがカレントディレクトリにある場合は、以下を指定する必要はありません。 `--config-file` パラメータ。 デフォルトでは、 `./config.xml`. + +ClickHouse対応アクセス制限を設定します。 彼らはに位置しています `users.xml` ファイル(次へ `config.xml`). +デフォルトでは、アクセスはどこからでも可能です。 `default` ユーザー、パスワードなし。 見る `user/default/networks`. +詳細については、以下を参照してください [“Configuration Files”](../operations/configuration-files.md). + +サーバーの起動後、コマンドラインクライアントを使用してサーバーに接続できます: + +``` bash +$ clickhouse-client +``` + +デフォルトでは、 `localhost:9000` ユーザーに代わって `default` パスワードなし。 また、以下を使用してリモートサーバーに接続することもできます `--host` 引数。 + +端末はutf-8エンコードを使用する必要があります。 +詳細については、以下を参照してください [“Command-line client”](../interfaces/cli.md). + +例えば: + +``` bash +$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**おめでとう、システムの作品!** + +継続実験をダウンロードでき、試験データセットやじ [tutorial](https://clickhouse.tech/tutorial.html). + +[元の記事](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/ja/getting-started/playground.md b/docs/ja/getting-started/playground.md new file mode 100644 index 00000000000..d6fbc3e3b75 --- /dev/null +++ b/docs/ja/getting-started/playground.md @@ -0,0 +1,48 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 14 +toc_title: "\u904A\u3073\u5834" +--- + +# ClickHouseの遊び場 {#clickhouse-playground} + +[ClickHouseの遊び場](https://play.clickhouse.tech?file=welcome) サーバーやクラスターを設定せずに、クエリを即座に実行することで、ClickHouseを試すことができます。 +複数の例ではデータセットの遊び場などのサンプルのクエリを表すclickhouse特徴です。 + +クエリは読み取り専用ユーザーとして実行されます。 では一部制限: + +- DDLクエリは許可されません +- 挿入クエリは許可されません + +次の設定も適用されます: +- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) +- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) +- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) +- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) + +ClickHouseの運動場はm2の経験を与える。小さい +[管理サービスclickhouse](https://cloud.yandex.com/services/managed-clickhouse) +インスタンス [Yandexの。クラウド](https://cloud.yandex.com/). +詳細については、 [クラウドプロバイダー](../commercial/cloud.md). + +ツつィツ姪“ツつ”ツ債ツつケ [HTTP API](../interfaces/http.md). +コミュニケーションが円滑にバックエンドがありclickhouseクラスターになサーバーサイド願います。 +ClickHouse HTTPS評価項目としても利用可能ですの一部が遊べない日々が続いていました。 + +できるクエリーの遊び場をhttpお客様は、例えば [カール](https://curl.haxx.se) または [wget](https://www.gnu.org/software/wget/)、または以下を使用して接続を設定する [JDBC](../interfaces/jdbc.md) または [ODBC](../interfaces/odbc.md) ドライバー +情報ソフトウェア製品を支えるclickhouse可能 [ここに](../interfaces/index.md). + +| パラメータ | 値 | +|:-----------|:----------------------------------------------| +| エンドポイ | https://play-api。クリックハウス。テック:8443 | +| ユーザ | `playground` | +| パスワード | `clickhouse` | + +このエンドポイントには安全な接続が必要です。 + +例えば: + +``` bash +curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" +``` diff --git a/docs/ja/getting-started/tutorial.md b/docs/ja/getting-started/tutorial.md new file mode 100644 index 00000000000..5e5e0e4e4ba --- /dev/null +++ b/docs/ja/getting-started/tutorial.md @@ -0,0 +1,665 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 12 +toc_title: Tutorial +--- + +# ClickHouseチュートリアル {#clickhouse-tutorial} + +## このチュートリアルから何を期待する? {#what-to-expect-from-this-tutorial} + +このチュートリアルでは、クリックハウスクラスタを設定する方法について説明します。 それは小さい、しかし耐障害性および拡張可能である。 次に、例のデータセットのいずれかを使用してデータを入力し、いくつかのデモクエリを実行します。 + +## 単一ノード設定 {#single-node-setup} + +分散環境の複雑さを延期するには、まず、単一のサーバーまたは仮想マシンにclickhouseを展開します。 clickhouseは通常からインストール [deb](install.md#install-from-deb-packages) または [rpm](install.md#from-rpm-packages) パッケージがあります [代替案](install.md#from-docker-image) の営業システムな支援します。 + +たとえば、次の項目を選択しました `deb` パッケージと実行: + +``` bash +{% include 'install/deb.sh' %} +``` + +インストールされたパッケージには何がありますか: + +- `clickhouse-client` パッケージ内容: [クリックハウス-顧客](../interfaces/cli.md) ケイClickHouseコンソールです。 +- `clickhouse-common` パッケージが含まれてClickHouse実行可能ファイルです。 +- `clickhouse-server` パッケージを含む設定ファイルを実行ClickHouseしています。 + +サーバ設定ファイルを置 `/etc/clickhouse-server/`. さらに進む前に、 `` 要素の `config.xml`. パスはデータストレージの場所を決定するので、ディスク容量の大きいボリュームに配置する必要があります。 `/var/lib/clickhouse/`. 設定を調整したい場合は、直接編集するのは便利ではありません `config.xml` ファイルは、将来のパッケージ更新で書き直される可能性があります。 のオーバーライドは、config要素の作成 [config内のファイル。dディレクトリ](../operations/configuration-files.md) として役立つ “patches” 設定する。xmlだ + +あなたが気づいたように, `clickhouse-server` パッケージのイ 更新後も自動的に再起動されることはありません。 サーバーを起動する方法は、initシステムによって異なります。: + +``` bash +sudo service clickhouse-server start +``` + +または + +``` bash +sudo /etc/init.d/clickhouse-server start +``` + +サーバーログのデフォルトの場所は、 `/var/log/clickhouse-server/`. サーバーはクライアント接続を処理する準備ができています。 `Ready for connections` メッセージ + +一度 `clickhouse-server` 稼働している、我々は使用することができます `clickhouse-client` サーバーに接続し、次のようなテストクエリを実行するには `SELECT "Hello, world!";`. + +
+ +索のヒントclickhouse-クライアント +対話モード: + +``` bash +clickhouse-client +clickhouse-client --host=... --port=... --user=... --password=... +``` + +複数行のクエリを有効にする: + +``` bash +clickhouse-client -m +clickhouse-client --multiline +``` + +バッチモードでのクエリの実行: + +``` bash +clickhouse-client --query='SELECT 1' +echo 'SELECT 1' | clickhouse-client +clickhouse-client <<< 'SELECT 1' +``` + +指定した形式のファイルからデータを挿入する: + +``` bash +clickhouse-client --query='INSERT INTO table VALUES' < data.txt +clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv +``` + +
+ +## インポートサンプル {#import-sample-dataset} + +今回は入社clickhouseサーバーサンプルデータです。 このチュートリアルでは、yandexの匿名化されたデータを使用します。metricaは、オープンソースになる前にclickhouseを運用方法で実行する最初のサービスです(詳細は [履歴セクション](../introduction/history.md)). あります [Yandexをインポートする複数の方法。Metricaデータセット](example-datasets/metrica.md)、そしてチュートリアルのために、我々は最も現実的なもので行くよ。 + +### 表データのダウンロードと抽出 {#download-and-extract-table-data} + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +``` + +抽出されたファイルのサイズは約10gbです。 + +### テーブルの作成 {#create-tables} + +ほとんどのデータベース管理システムclickhouse論理的にグテーブル “databases”. そこには `default` データベースが、我々は名前の新しいものを作成します `tutorial`: + +``` bash +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" +``` + +テーブルを作成するための構文は、データベースに比べて複雑です [参照](../sql-reference/statements/create.md). 一般的に `CREATE TABLE` 声明を設定するつもの: + +1. 作成するテーブルの名前。 +2. Table schema, i.e. list of columns and their [データ型](../sql-reference/data-types/index.md). +3. [表エンジン](../engines/table-engines/index.md) これは、このテーブルへのクエリが物理的にどのように実行されるかに関するすべての詳細を決定します。 + +Yandexの。Metricaはweb分析サービスであり、サンプルデータセットはその完全な機能をカバーしていません。: + +- `hits` とができるテーブルの各行動によるすべてのユーザーはすべてのwebサイトのサービスです。 +- `visits` はテーブルを含む組み立て済みセッションの代わりに個別に行動します。 + +これらのテーブルの実際のcreate tableクエリを見て、実行しましょう: + +``` sql +CREATE TABLE tutorial.hits_v1 +( + `WatchID` UInt64, + `JavaEnable` UInt8, + `Title` String, + `GoodEvent` Int16, + `EventTime` DateTime, + `EventDate` Date, + `CounterID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RegionID` UInt32, + `UserID` UInt64, + `CounterClass` Int8, + `OS` UInt8, + `UserAgent` UInt8, + `URL` String, + `Referer` String, + `URLDomain` String, + `RefererDomain` String, + `Refresh` UInt8, + `IsRobot` UInt8, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `FlashMinor2` String, + `NetMajor` UInt8, + `NetMinor` UInt8, + `UserAgentMajor` UInt16, + `UserAgentMinor` FixedString(2), + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `MobilePhone` UInt8, + `MobilePhoneModel` String, + `Params` String, + `IPNetworkID` UInt32, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `IsArtifical` UInt8, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `ClientTimeZone` Int16, + `ClientEventTime` DateTime, + `SilverlightVersion1` UInt8, + `SilverlightVersion2` UInt8, + `SilverlightVersion3` UInt32, + `SilverlightVersion4` UInt16, + `PageCharset` String, + `CodeVersion` UInt32, + `IsLink` UInt8, + `IsDownload` UInt8, + `IsNotBounce` UInt8, + `FUniqID` UInt64, + `HID` UInt32, + `IsOldCounter` UInt8, + `IsEvent` UInt8, + `IsParameter` UInt8, + `DontCountHits` UInt8, + `WithHash` UInt8, + `HitColor` FixedString(1), + `UTCEventTime` DateTime, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `WindowName` Int32, + `OpenerName` Int32, + `HistoryLength` Int16, + `BrowserLanguage` FixedString(2), + `BrowserCountry` FixedString(2), + `SocialNetwork` String, + `SocialAction` String, + `HTTPError` UInt16, + `SendTiming` Int32, + `DNSTiming` Int32, + `ConnectTiming` Int32, + `ResponseStartTiming` Int32, + `ResponseEndTiming` Int32, + `FetchTiming` Int32, + `RedirectTiming` Int32, + `DOMInteractiveTiming` Int32, + `DOMContentLoadedTiming` Int32, + `DOMCompleteTiming` Int32, + `LoadEventStartTiming` Int32, + `LoadEventEndTiming` Int32, + `NSToDOMContentLoadedTiming` Int32, + `FirstPaintTiming` Int32, + `RedirectCount` Int8, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `ParamPrice` Int64, + `ParamOrderID` String, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `GoalsReached` Array(UInt32), + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `RefererHash` UInt64, + `URLHash` UInt64, + `CLID` UInt32, + `YCLID` UInt64, + `ShareService` String, + `ShareURL` String, + `ShareTitle` String, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `IslandID` FixedString(16), + `RequestNum` UInt32, + `RequestTry` UInt8 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +``` sql +CREATE TABLE tutorial.visits_v1 +( + `CounterID` UInt32, + `StartDate` Date, + `Sign` Int8, + `IsNew` UInt8, + `VisitID` UInt64, + `UserID` UInt64, + `StartTime` DateTime, + `Duration` UInt32, + `UTCStartTime` DateTime, + `PageViews` Int32, + `Hits` Int32, + `IsBounce` UInt8, + `Referer` String, + `StartURL` String, + `RefererDomain` String, + `StartURLDomain` String, + `EndURL` String, + `LinkURL` String, + `IsDownload` UInt8, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `PlaceID` Int32, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `IsYandex` UInt8, + `GoalReachesDepth` Int32, + `GoalReachesURL` Int32, + `GoalReachesAny` Int32, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `MobilePhoneModel` String, + `ClientEventTime` DateTime, + `RegionID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `IPNetworkID` UInt32, + `SilverlightVersion3` UInt32, + `CodeVersion` UInt32, + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `UserAgentMajor` UInt16, + `UserAgentMinor` UInt16, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `SilverlightVersion2` UInt8, + `SilverlightVersion4` UInt16, + `FlashVersion3` UInt16, + `FlashVersion4` UInt16, + `ClientTimeZone` Int16, + `OS` UInt8, + `UserAgent` UInt8, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `NetMajor` UInt8, + `NetMinor` UInt8, + `MobilePhone` UInt8, + `SilverlightVersion1` UInt8, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `JavaEnable` UInt8, + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `BrowserLanguage` UInt16, + `BrowserCountry` UInt16, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `Params` Array(String), + `Goals` Nested( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32), + `WatchIDs` Array(UInt64), + `ParamSumPrice` Int64, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `ClickLogID` UInt64, + `ClickEventID` Int32, + `ClickGoodEvent` Int32, + `ClickEventTime` DateTime, + `ClickPriorityID` Int32, + `ClickPhraseID` Int32, + `ClickPageID` Int32, + `ClickPlaceID` Int32, + `ClickTypeID` Int32, + `ClickResourceID` Int32, + `ClickCost` UInt32, + `ClickClientIP` UInt32, + `ClickDomainID` UInt32, + `ClickURL` String, + `ClickAttempt` UInt8, + `ClickOrderID` UInt32, + `ClickBannerID` UInt32, + `ClickMarketCategoryID` UInt32, + `ClickMarketPP` UInt32, + `ClickMarketCategoryName` String, + `ClickMarketPPName` String, + `ClickAWAPSCampaignName` String, + `ClickPageName` String, + `ClickTargetType` UInt16, + `ClickTargetPhraseID` UInt64, + `ClickContextType` UInt8, + `ClickSelectType` Int8, + `ClickOptions` String, + `ClickGroupBannerID` Int32, + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `FirstVisit` DateTime, + `PredLastVisit` Date, + `LastVisit` Date, + `TotalVisits` UInt32, + `TraficSource` Nested( + ID Int8, + SearchEngineID UInt16, + AdvEngineID UInt8, + PlaceID UInt16, + SocialSourceNetworkID UInt8, + Domain String, + SearchPhrase String, + SocialSourcePage String), + `Attendance` FixedString(16), + `CLID` UInt32, + `YCLID` UInt64, + `NormalizedRefererHash` UInt64, + `SearchPhraseHash` UInt64, + `RefererDomainHash` UInt64, + `NormalizedStartURLHash` UInt64, + `StartURLDomainHash` UInt64, + `NormalizedEndURLHash` UInt64, + `TopLevelDomain` UInt64, + `URLScheme` UInt64, + `OpenstatServiceNameHash` UInt64, + `OpenstatCampaignIDHash` UInt64, + `OpenstatAdIDHash` UInt64, + `OpenstatSourceIDHash` UInt64, + `UTMSourceHash` UInt64, + `UTMMediumHash` UInt64, + `UTMCampaignHash` UInt64, + `UTMContentHash` UInt64, + `UTMTermHash` UInt64, + `FromHash` UInt64, + `WebVisorEnabled` UInt8, + `WebVisorActivity` UInt32, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `Market` Nested( + Type UInt8, + GoalID UInt32, + OrderID String, + OrderPrice Int64, + PP UInt32, + DirectPlaceID UInt32, + DirectOrderID UInt32, + DirectBannerID UInt32, + GoodID String, + GoodName String, + GoodQuantity Int32, + GoodPrice Int64), + `IslandID` FixedString(16) +) +ENGINE = CollapsingMergeTree(Sign) +PARTITION BY toYYYYMM(StartDate) +ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +ドできるようになりました。方のクエリのインタラクティブモードの `clickhouse-client` (事前にクエリを指定せずに端末で起動するだけです)またはいくつか試してみてください [代わりとなるインターフェース](../interfaces/index.md) あなたが望むなら。 + +ご覧の通り, `hits_v1` 使用します [基本的なMergeTreeエンジン](../engines/table-engines/mergetree-family/mergetree.md)、ながら `visits_v1` 使用します [折りたたみ](../engines/table-engines/mergetree-family/collapsingmergetree.md) バリアント。 + +### デー {#import-data} + +ClickHouseへのデータのインポートは、 [INSERT INTO](../sql-reference/statements/insert-into.md) 他の多くのSQLデータベースのような照会。 ただし、データは通常、次のいずれかで提供されます。 [対応するシリアル化形式](../interfaces/formats.md) 代わりに `VALUES` 句(これもサポートされています)。 + +以前にダウンロードしたファ: + +``` bash +clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv +clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv +``` + +ClickHouseには多くのものがあります [調整する設定](../operations/settings/index.md) そして、コンソールクライアントでそれらを指定する一つの方法は、引数を使用することです `--max_insert_block_size`. どのような設定が利用可能であるか、それらが何を意味するのか、そしてデフォルトが何であるかを理解する最も簡単な方法は、 `system.settings` テーブル: + +``` sql +SELECT name, value, changed, description +FROM system.settings +WHERE name LIKE '%max_insert_b%' +FORMAT TSV + +max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." +``` + +必要に応じ [OPTIMIZE](../query_language/misc/#misc_operations-optimize) インポート後のテーブル。 MergeTree-familyのエンジンで構成されたテーブルは、データストレージを最適化するために、常にバックグラウンドでデータ部分のマージを行います(または少なくとも これらのクエリのテーブルエンジンな保管の最適化現在の代わりについては後日、: + +``` bash +clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" +clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" +``` + +したがって、テーブルが一貫して新しいデータを受け取る場合は、そのままにして、マージをバックグラウンドで実行する方がよいでしょう。 + +テーブルインポートが成功したかどうかを確認できます: + +``` bash +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" +``` + +## クエリ例 {#example-queries} + +``` sql +SELECT + StartURL AS URL, + AVG(Duration) AS AvgDuration +FROM tutorial.visits_v1 +WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' +GROUP BY URL +ORDER BY AvgDuration DESC +LIMIT 10 +``` + +``` sql +SELECT + sum(Sign) AS visits, + sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, + (100. * goal_visits) / visits AS goal_percent +FROM tutorial.visits_v1 +WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') +``` + +## クラスターの展開 {#cluster-deployment} + +ClickHouseの集りは同種の集りである。 セットアップの手順: + +1. イclickhouseサーバーのすべての機械のクラスター +2. 構成ファイルでのクラスタ構成のセットアップ +3. 各インスタ +4. 作成する [分散テーブル](../engines/table-engines/special/distributed.md) + +[分散テーブル](../engines/table-engines/special/distributed.md) 実際には “view” 地元のテーブルのClickHouse。 SELECTクエリから分散型のテーブル実行が持つリソースを活用したすべてのクラスターの破片. を指定しますconfigs複数のクラスターを作成した複数のテーブルのビューを提供する別のクラスター + +ツつィツ姪“ツつ”ツ債ツづュツつケツづ債つアツつソツづァ: + +``` xml + + + + + example-perftest01j.yandex.ru + 9000 + + + + + example-perftest02j.yandex.ru + 9000 + + + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +さらなる実証しましょう新しい地域のテーブルと同じ `CREATE TABLE` 私たちが使用したクエリ `hits_v1`、しかし、異なるテーブル名: + +``` sql +CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... +``` + +クラスターのローカルテーブルにビューを提供する分散テーブルの作成: + +``` sql +CREATE TABLE tutorial.hits_all AS tutorial.hits_local +ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); +``` + +一般的な方法は、クラスターのすべてのマシンで同様の分散テーブルを作成することです。 クラスターの任意のマシンで分散クエリを実行できます。 また、特定のselectクエリを使用して一時分散テーブルを作成する代替オプションもあります [リモート](../sql-reference/table-functions/remote.md) テーブル機能。 + +逃げよう [INSERT SELECT](../sql-reference/statements/insert-into.md) 分散テーブルに分散テーブルを複数のサーバーに分散させます。 + +``` sql +INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; +``` + +!!! warning "気づく" + このアプローチは適しませんのshardingの大きます。 別のツールがあります [クリックハウスコピー機](../operations/utilities/clickhouse-copier.md) できるre-ザ-シャーを任意の大きます。 + +予想されるように、計算量の多いクエリは、3つのサーバーを使用する場合にn倍高速に実行されます。 + +この場合、3つのシャードを持つクラスターを使用し、それぞれに単一のレプリカが含まれています。 + +運用環境で復元性を提供するには、各シャードに、複数のアベイラビリティーゾーンまたはデータセンター(または少なくともラック)の間に2~3個のレプリカ clickhouseでは、レプリカの数に制限はありません。 + +レプリカを含むシャードのクラスタの設定例: + +``` xml + + ... + + + + example-perftest01j.yandex.ru + 9000 + + + example-perftest02j.yandex.ru + 9000 + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +ネイティブ複製を有効にする [ZooKeeper](http://zookeeper.apache.org/) は必須です。 ClickHouseは、すべてのレプリカでデータの整合性を管理し、障害後に自動的に復元手順を実行します。 ZooKeeperクラスターを別々のサーバーに展開することをお勧めします(ClickHouseを含む他のプロセスは実行されていません)。 + +!!! note "メモ" + いくつかの簡単なケースでは、アプリケーションコードからすべてのレプリカにデータを書き込むことでデータを複製できます。 このアプローチは **ない** 推奨、この場合、ClickHouseはすべてのレプリカでデータの整合性を保証することはできません。 従ってそれはあなたの適用の責任になります。 + +ZooKeeperの場所は設定ファイルで指定します: + +``` xml + + + zoo01.yandex.ru + 2181 + + + zoo02.yandex.ru + 2181 + + + zoo03.yandex.ru + 2181 + + +``` + +また、テーブル作成時に使用される各シャードとレプリカを識別するマクロを設定する必要があります: + +``` xml + + 01 + 01 + +``` + +がない場合にレプリカの瞬間に複製表を作成し、新しい最初のレプリカスのインスタンスが作成. がある場合でライブレプリカを新たなレプリカのクローンからデータを設定しています。 最初にすべての複製テーブルを作成し、それにデータを挿入するオプションがあります。 別のオプションを作れるレプリカを追加しその他の長期データを挿入出来ます。 + +``` sql +CREATE TABLE tutorial.hits_replica (...) +ENGINE = ReplcatedMergeTree( + '/clickhouse_perftest/tables/{shard}/hits', + '{replica}' +) +... +``` + +ここでは、 [レプリケートされたmergetree](../engines/table-engines/mergetree-family/replication.md) テーブルエンジン。 パラメータを指定飼育係のパスを含むザ-シャープ識別子のことです。 + +``` sql +INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; +``` + +複製はマルチマスターモードで動作します。 データは任意のレプリカにロードすることができ、システムは他のインスタンスと自動的に同期します。 複製は非同期で一定の瞬間にも、すべてのレプリカを含む場合があり、最近に挿入されます。 少なくとも一つのレプリカのようにするためのデータで測定す その同期データの修理整合性が活躍できます。 このアプローチでは、最近挿入されたデータの損失の可能性が低いことができます。 + +[元の記事](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/ja/getting_started/example_datasets/index.md b/docs/ja/getting_started/example_datasets/index.md deleted file mode 100644 index d2b439b3683..00000000000 --- a/docs/ja/getting_started/example_datasets/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Example Datasets -toc_priority: 12 -toc_title: "\u5C0E\u5165" ---- - -# データセット例 {#example-datasets} - -この方法について説明し得る例データセットおよび輸入しclickhouse. -一部のデータセットの例ではクエリーもございます。 - -- [匿名のyandexの。metricaデータセット](metrica.md) -- [スタースキーマのベンチマーク](star_schema.md) -- [WikiStat](wikistat.md) -- [Criteoからのクリックログのテラバイト](criteo.md) -- [AMPLab Big Dataベンチマーク](amplab_benchmark.md) -- [ニューヨーク](nyc_taxi.md) -- [オンタイム](ontime.md) - -[元の記事](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/ja/getting_started/example_datasets/metrica.md b/docs/ja/getting_started/example_datasets/metrica.md deleted file mode 100644 index 5fda04b7a03..00000000000 --- a/docs/ja/getting_started/example_datasets/metrica.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 21 -toc_title: "Yandex\u306E\u3002Metrica\u30C7\u30FC\u30BF" ---- - -# 匿名のyandexの。metricaデータ {#anonymized-yandex-metrica-data} - -データセットのテーブルを含む匿名化されたデーター (`hits_v1`)および訪問 (`visits_v1`)Yandexの。メトリカ につなげていくかを学びますYandex.Metrica in [クリックハウスの歴史](../../introduction/history.md) セクション。 - -どちらのテーブルも圧縮形式でダウンロードできます `tsv.xz` ファイルに対して割. それに加えて、の拡張バージョン `hits` 100万行を含むテーブルは、TSVとして利用可能ですhttps://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz そして準備された仕切りとしてhttps://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz。 - -## 取得のテーブルから調の間仕切り {#obtaining-tables-from-prepared-partitions} - -ダウンロード、輸入のヒットテーブル: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar -tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -ダウンロードと読み込み: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar -tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## 圧縮されたtsvファイルからの表の取得 {#obtaining-tables-from-compressed-tsv-file} - -圧縮されたtsvファ: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -圧縮tsv-fileからの訪問のダウンロードとインポート: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## クエリ例 {#example-queries} - -[ClickHouseチュートリアル](../../getting_started/tutorial.md) は、Yandexのに基づいています。Metricaデータの推奨使うことができるようにこのデータやトランザクションデータだけを通してチュートリアルです。 - -これらのテーブルへのクエリの追加の例は、 [ステートフルテスト](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) ClickHouseの(彼らは名前が付けられています `test.hists` と `test.visits` そこ)。 diff --git a/docs/ja/getting_started/index.md b/docs/ja/getting_started/index.md deleted file mode 100644 index 2801b8d08e5..00000000000 --- a/docs/ja/getting_started/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Getting Started -toc_hidden: true -toc_priority: 8 -toc_title: "\u96A0\u3055\u308C\u305F" ---- - -# はじめに {#getting-started} - -あなたがclickhouseに慣れていないし、そのパフォーマンスのハンズオン感を取得したい場合は、まず、あなたが通過する必要があります [インストール処理](install.md). その後、あなたは: - -- [詳細なチュートリアルを通過](tutorial.md) -- [データセット例の実験](example_datasets/ontime.md) - -[元の記事](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/ja/getting_started/install.md b/docs/ja/getting_started/install.md deleted file mode 100644 index c048268feca..00000000000 --- a/docs/ja/getting_started/install.md +++ /dev/null @@ -1,191 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 11 -toc_title: "\u8A2D\u7F6E" ---- - -# 設置 {#installation} - -## システム要件 {#system-requirements} - -ClickHouseは、x86\_64、AArch64、またはPowerPC64LE CPUアーキテクチャを使用して、Linux、FreeBSD、またはMac OS X上で実行できます。 - -公式の事前構築されたバイナリは、通常、x86\_64用にコンパイルされ、sse4.2命令セットを利用するため、特に明記されていない限り、それをサポートす 現在のcpuがsse4.2をサポートしているかどう: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -走clickhouseにプロセッサーをサポートしていないsse4.2てaarch64はpowerpc64le建築き [ソースからのClickHouseのビルド](#from-sources) 適切な構成の調節を使って。 - -## 使用可能な設置方法 {#available-installation-options} - -### DEBパッケージから {#install-from-deb-packages} - -公式の事前コンパイルを使用することをお勧めします `deb` DebianやUbuntuのためのパッケージ. - -イ公式パッケージの追加のyandexリポジトリに `/etc/apt/sources.list` または別の `/etc/apt/sources.list.d/clickhouse.list` ファイル: - - deb http://repo.clickhouse.tech/deb/stable/ main/ - -最新のバージョンを使用する場合は、以下を置き換えます `stable` と `testing` (これはテスト環境に推奨されます)。 - -そこにこれらのコマンド置パッケージ: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -でもダウンロードとインストールパッケージを手動で下からもアクセスできます。https://repo.yandex.ru/clickhouse/deb/stable/main/. - -#### パッケージ {#packages} - -- `clickhouse-common-static` — Installs ClickHouse compiled binary files. -- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` とをインストールしデフォルトのサーバーの設定をします。 -- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` そして他の顧客関係した用具。 および設置お客様の設定ファイルです。 -- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. - -### RPMパッケージから {#from-rpm-packages} - -公式の事前コンパイルを使用することをお勧めします `rpm` パッケージCentOS,RedHat、その他のrpmベLinuxディストリビューション. - -まず、公式リポジトリを追加する必要があります: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 -``` - -最新のバージョンを使用する場合は、以下を置き換えます `stable` と `testing` (これはテスト環境に推奨されます)。 その `prestable` タグも時々利用可能です。 - -そこにこれらのコマンド置パッケージ: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -でもダウンロードとインストールパッケージを手動で下からもアクセスできます。https://repo.クリックハウス。テック/rpm/安定した/x86\_64. - -### Tgzアーカイブから {#from-tgz-archives} - -公式の事前コンパイルを使用することをお勧めします `tgz` すべてのLinuxディストリビュ `deb` または `rpm` パッケージは不可能です。 - -必要なバージョンは `curl` または `wget` リポジトリからhttps://repo.yandex.ru/clickhouse/tgz/。 -その後、アーカイブをダウンロードは開梱と設置と設置のためのイントロダクションです。 最新バージョンの例: - -``` bash -export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz - -tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz -sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz -sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-server-$LATEST_VERSION.tgz -sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh -sudo /etc/init.d/clickhouse-server start - -tar -xzvf clickhouse-client-$LATEST_VERSION.tgz -sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh -``` - -運用環境では、最新のものを使用することをお勧めします `stable`-バージョン。 その番号はGitHubページにありますhttps://github.com/ClickHouse/ClickHouse/tags 後置を使って `-stable`. - -### ドッカーの画像から {#from-docker-image} - -Dockerの中でClickHouseを実行するには、次のガイドに従います [Docker拠点](https://hub.docker.com/r/yandex/clickhouse-server/). これらの画像は、公式を使用 `deb` 中のパッケージ。 - -### ソースから {#from-sources} - -ClickHouseを手動でコンパイルするには、以下の手順に従います [Linux](../development/build.md) または [Mac OS X](../development/build_osx.md). - -できるコンパイルパッケージはインストールしていたプログラムを使用もインストールせずにパッケージ。 またビルを手動で無数の組み合わせで自分だけのsse4.2に必要構築のためのaarch64定する必要はありません。 - - Client: programs/clickhouse-client - Server: programs/clickhouse-server - -データとメタデータフォルダを作成する必要があります `chown` 目的のユーザーのためのそれら。 それらのパスは、server config(src/programs/server/config)で変更できます。xml)、デフォルトでは次のとおりです: - - /opt/clickhouse/data/default/ - /opt/clickhouse/metadata/default/ - -Gentooでは、次のものを使用できます `emerge clickhouse` ソースからClickHouseをインストールする。 - -## 起動 {#launch} - -サーバを起動デーモンとして、: - -``` bash -$ sudo service clickhouse-server start -``` - -あなたが持っていない場合 `service` コマンド、実行 - -``` bash -$ sudo /etc/init.d/clickhouse-server start -``` - -のログを参照してください `/var/log/clickhouse-server/` ディレクトリ。 - -サーバーが起動しない場合は、ファイル内の設定を確認してください `/etc/clickhouse-server/config.xml`. - -または手動で開始のサーバーからのコンソール: - -``` bash -$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -この場合、ログはコンソールに印刷され、開発中に便利です。 -設定ファイルがカレントディレクトリにある場合は、以下を指定する必要はありません。 `--config-file` パラメータ。 デフォルトでは、 `./config.xml`. - -ClickHouse対応アクセス制限を設定します。 彼らはに位置しています `users.xml` ファイル(次へ `config.xml`). -デフォルトでは、アクセスはどこからでも可能です。 `default` ユーザー、パスワードなし。 見る `user/default/networks`. -詳細については、以下を参照してください [“Configuration Files”](../operations/configuration_files.md). - -サーバーの起動後、コマンドラインクライアントを使用してサーバーに接続できます: - -``` bash -$ clickhouse-client -``` - -デフォルトでは、 `localhost:9000` ユーザーに代わって `default` パスワードなし。 また、以下を使用してリモートサーバーに接続することもできます `--host` 引数。 - -端末はutf-8エンコードを使用する必要があります。 -詳細については、以下を参照してください [“Command-line client”](../interfaces/cli.md). - -例えば: - -``` bash -$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**おめでとう、システムの作品!** - -継続実験をダウンロードでき、試験データセットやじ [tutorial](https://clickhouse.tech/tutorial.html). - -[元の記事](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/ja/getting_started/playground.md b/docs/ja/getting_started/playground.md deleted file mode 100644 index 54bf1f1fbbb..00000000000 --- a/docs/ja/getting_started/playground.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 14 -toc_title: "\u904A\u3073\u5834" ---- - -# ClickHouseの遊び場 {#clickhouse-playground} - -[ClickHouseの遊び場](https://play.clickhouse.tech?file=welcome) サーバーやクラスターを設定せずに、クエリを即座に実行することで、ClickHouseを試すことができます。 -複数の例ではデータセットの遊び場などのサンプルのクエリを表すclickhouse特徴です。 - -クエリは読み取り専用ユーザーとして実行されます。 では一部制限: - -- DDLクエリは許可されません -- 挿入クエリは許可されません - -次の設定も適用されます: -- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) -- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) -- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) -- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) - -ClickHouseの運動場はm2の経験を与える。小さい -[管理サービスclickhouse](https://cloud.yandex.com/services/managed-clickhouse) -インスタンス [Yandexの。クラウド](https://cloud.yandex.com/). -詳細については、 [クラウドプロバイダー](../commercial/cloud.md). - -ツつィツ姪"ツつ"ツ債ツつケ [HTTP API](../interfaces/http.md). -コミュニケーションが円滑にバックエンドがありclickhouseクラスターになサーバーサイド願います。 -ClickHouse HTTPS評価項目としても利用可能ですの一部が遊べない日々が続いていました。 - -できるクエリーの遊び場をhttpお客様は、例えば [カール](https://curl.haxx.se) または [wget](https://www.gnu.org/software/wget/)、または以下を使用して接続を設定する [JDBC](../interfaces/jdbc.md) または [ODBC](../interfaces/odbc.md) ドライバー -情報ソフトウェア製品を支えるclickhouse可能 [ここに](../interfaces/index.md). - -| パラメータ | 値 | -|:-----------|:----------------------------------------------| -| エンドポイ | https://play-api。クリックハウス。テック:8443 | -| ユーザ | `playground` | -| パスワード | `clickhouse` | - -このエンドポイントには安全な接続が必要です。 - -例えば: - -``` bash -curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" -``` diff --git a/docs/ja/getting_started/tutorial.md b/docs/ja/getting_started/tutorial.md deleted file mode 100644 index 6c3ec545a46..00000000000 --- a/docs/ja/getting_started/tutorial.md +++ /dev/null @@ -1,671 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 12 -toc_title: Tutorial ---- - -# ClickHouseチュートリアル {#clickhouse-tutorial} - -## このチュートリアルから何を期待する? {#what-to-expect-from-this-tutorial} - -このチュートリアルでは、クリックハウスクラスタを設定する方法について説明します。 それは小さい、しかし耐障害性および拡張可能である。 次に、例のデータセットのいずれかを使用してデータを入力し、いくつかのデモクエリを実行します。 - -## 単一ノード設定 {#single-node-setup} - -分散環境の複雑さを延期するには、まず、単一のサーバーまたは仮想マシンにclickhouseを展開します。 clickhouseは通常からインストール [deb](index.md#install-from-deb-packages) または [rpm](index.md#from-rpm-packages) パッケージがあります [代替案](index.md#from-docker-image) の営業システムな支援します。 - -たとえば、次の項目を選択しました `deb` パッケージと実行: - -``` bash -sudo apt-get install dirmngr -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 - -echo "deb http://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list -sudo apt-get update - -sudo apt-get install -y clickhouse-server clickhouse-client -``` - -インストールされたパッケージには何がありますか: - -- `clickhouse-client` パッケージ内容: [クリックハウス-顧客](../interfaces/cli.md) ケイClickHouseコンソールです。 -- `clickhouse-common` パッケージが含まれてClickHouse実行可能ファイルです。 -- `clickhouse-server` パッケージを含む設定ファイルを実行ClickHouseしています。 - -サーバ設定ファイルを置 `/etc/clickhouse-server/`. さらに進む前に、 `` 要素の `config.xml`. パスはデータストレージの場所を決定するので、ディスク容量の大きいボリュームに配置する必要があります。 `/var/lib/clickhouse/`. 設定を調整したい場合は、直接編集するのは便利ではありません `config.xml` ファイルは、将来のパッケージ更新で書き直される可能性があります。 のオーバーライドは、config要素の作成 [config内のファイル。dディレクトリ](../operations/configuration_files.md) として役立つ “patches” 設定する。xmlだ - -あなたが気づいたように, `clickhouse-server` パッケージのイ 更新後も自動的に再起動されることはありません。 サーバーを起動する方法は、initシステムによって異なります。: - -``` bash -sudo service clickhouse-server start -``` - -または - -``` bash -sudo /etc/init.d/clickhouse-server start -``` - -サーバーログのデフォルトの場所は、 `/var/log/clickhouse-server/`. サーバーはクライアント接続を処理する準備ができています。 `Ready for connections` メッセージ - -一度 `clickhouse-server` 稼働している、我々は使用することができます `clickhouse-client` サーバーに接続し、次のようなテストクエリを実行するには `SELECT "Hello, world!";`. - -
- -索のヒントclickhouse-クライアント -対話モード: - -``` bash -clickhouse-client -clickhouse-client --host=... --port=... --user=... --password=... -``` - -複数行のクエリを有効にする: - -``` bash -clickhouse-client -m -clickhouse-client --multiline -``` - -バッチモードでのクエリの実行: - -``` bash -clickhouse-client --query='SELECT 1' -echo 'SELECT 1' | clickhouse-client -clickhouse-client <<< 'SELECT 1' -``` - -指定した形式のファイルからデータを挿入する: - -``` bash -clickhouse-client --query='INSERT INTO table VALUES' < data.txt -clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv -``` - -
- -## インポートサンプル {#import-sample-dataset} - -今回は入社clickhouseサーバーサンプルデータです。 このチュートリアルでは、yandexの匿名化されたデータを使用します。metricaは、オープンソースになる前にclickhouseを運用方法で実行する最初のサービスです(詳細は [履歴セクション](../introduction/history.md)). あります [Yandexをインポートする複数の方法。Metricaデータセット](example_datasets/metrica.md)、そしてチュートリアルのために、我々は最も現実的なもので行くよ。 - -### 表データのダウンロードと抽出 {#download-and-extract-table-data} - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -``` - -抽出されたファイルのサイズは約10gbです。 - -### テーブルの作成 {#create-tables} - -ほとんどのデータベース管理システムclickhouse論理的にグテーブル “databases”. そこには `default` データベースが、我々は名前の新しいものを作成します `tutorial`: - -``` bash -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" -``` - -テーブルを作成するための構文は、データベースに比べて複雑です [参照](../sql_reference/statements/create.md). 一般的に `CREATE TABLE` 声明を設定するつもの: - -1. 作成するテーブルの名前。 -2. Table schema, i.e. list of columns and their [データ型](../sql_reference/data_types/index.md). -3. [表エンジン](../engines/table_engines/index.md) これは、このテーブルへのクエリが物理的にどのように実行されるかに関するすべての詳細を決定します。 - -Yandexの。Metricaはweb分析サービスであり、サンプルデータセットはその完全な機能をカバーしていません。: - -- `hits` とができるテーブルの各行動によるすべてのユーザーはすべてのwebサイトのサービスです。 -- `visits` はテーブルを含む組み立て済みセッションの代わりに個別に行動します。 - -これらのテーブルの実際のcreate tableクエリを見て、実行しましょう: - -``` sql -CREATE TABLE tutorial.hits_v1 -( - `WatchID` UInt64, - `JavaEnable` UInt8, - `Title` String, - `GoodEvent` Int16, - `EventTime` DateTime, - `EventDate` Date, - `CounterID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RegionID` UInt32, - `UserID` UInt64, - `CounterClass` Int8, - `OS` UInt8, - `UserAgent` UInt8, - `URL` String, - `Referer` String, - `URLDomain` String, - `RefererDomain` String, - `Refresh` UInt8, - `IsRobot` UInt8, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `FlashMinor2` String, - `NetMajor` UInt8, - `NetMinor` UInt8, - `UserAgentMajor` UInt16, - `UserAgentMinor` FixedString(2), - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `MobilePhone` UInt8, - `MobilePhoneModel` String, - `Params` String, - `IPNetworkID` UInt32, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `IsArtifical` UInt8, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `ClientTimeZone` Int16, - `ClientEventTime` DateTime, - `SilverlightVersion1` UInt8, - `SilverlightVersion2` UInt8, - `SilverlightVersion3` UInt32, - `SilverlightVersion4` UInt16, - `PageCharset` String, - `CodeVersion` UInt32, - `IsLink` UInt8, - `IsDownload` UInt8, - `IsNotBounce` UInt8, - `FUniqID` UInt64, - `HID` UInt32, - `IsOldCounter` UInt8, - `IsEvent` UInt8, - `IsParameter` UInt8, - `DontCountHits` UInt8, - `WithHash` UInt8, - `HitColor` FixedString(1), - `UTCEventTime` DateTime, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `WindowName` Int32, - `OpenerName` Int32, - `HistoryLength` Int16, - `BrowserLanguage` FixedString(2), - `BrowserCountry` FixedString(2), - `SocialNetwork` String, - `SocialAction` String, - `HTTPError` UInt16, - `SendTiming` Int32, - `DNSTiming` Int32, - `ConnectTiming` Int32, - `ResponseStartTiming` Int32, - `ResponseEndTiming` Int32, - `FetchTiming` Int32, - `RedirectTiming` Int32, - `DOMInteractiveTiming` Int32, - `DOMContentLoadedTiming` Int32, - `DOMCompleteTiming` Int32, - `LoadEventStartTiming` Int32, - `LoadEventEndTiming` Int32, - `NSToDOMContentLoadedTiming` Int32, - `FirstPaintTiming` Int32, - `RedirectCount` Int8, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `ParamPrice` Int64, - `ParamOrderID` String, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `GoalsReached` Array(UInt32), - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `RefererHash` UInt64, - `URLHash` UInt64, - `CLID` UInt32, - `YCLID` UInt64, - `ShareService` String, - `ShareURL` String, - `ShareTitle` String, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `IslandID` FixedString(16), - `RequestNum` UInt32, - `RequestTry` UInt8 -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -``` sql -CREATE TABLE tutorial.visits_v1 -( - `CounterID` UInt32, - `StartDate` Date, - `Sign` Int8, - `IsNew` UInt8, - `VisitID` UInt64, - `UserID` UInt64, - `StartTime` DateTime, - `Duration` UInt32, - `UTCStartTime` DateTime, - `PageViews` Int32, - `Hits` Int32, - `IsBounce` UInt8, - `Referer` String, - `StartURL` String, - `RefererDomain` String, - `StartURLDomain` String, - `EndURL` String, - `LinkURL` String, - `IsDownload` UInt8, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `PlaceID` Int32, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `IsYandex` UInt8, - `GoalReachesDepth` Int32, - `GoalReachesURL` Int32, - `GoalReachesAny` Int32, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `MobilePhoneModel` String, - `ClientEventTime` DateTime, - `RegionID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `IPNetworkID` UInt32, - `SilverlightVersion3` UInt32, - `CodeVersion` UInt32, - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `UserAgentMajor` UInt16, - `UserAgentMinor` UInt16, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `SilverlightVersion2` UInt8, - `SilverlightVersion4` UInt16, - `FlashVersion3` UInt16, - `FlashVersion4` UInt16, - `ClientTimeZone` Int16, - `OS` UInt8, - `UserAgent` UInt8, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `NetMajor` UInt8, - `NetMinor` UInt8, - `MobilePhone` UInt8, - `SilverlightVersion1` UInt8, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `JavaEnable` UInt8, - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `BrowserLanguage` UInt16, - `BrowserCountry` UInt16, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `Params` Array(String), - `Goals` Nested( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32), - `WatchIDs` Array(UInt64), - `ParamSumPrice` Int64, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `ClickLogID` UInt64, - `ClickEventID` Int32, - `ClickGoodEvent` Int32, - `ClickEventTime` DateTime, - `ClickPriorityID` Int32, - `ClickPhraseID` Int32, - `ClickPageID` Int32, - `ClickPlaceID` Int32, - `ClickTypeID` Int32, - `ClickResourceID` Int32, - `ClickCost` UInt32, - `ClickClientIP` UInt32, - `ClickDomainID` UInt32, - `ClickURL` String, - `ClickAttempt` UInt8, - `ClickOrderID` UInt32, - `ClickBannerID` UInt32, - `ClickMarketCategoryID` UInt32, - `ClickMarketPP` UInt32, - `ClickMarketCategoryName` String, - `ClickMarketPPName` String, - `ClickAWAPSCampaignName` String, - `ClickPageName` String, - `ClickTargetType` UInt16, - `ClickTargetPhraseID` UInt64, - `ClickContextType` UInt8, - `ClickSelectType` Int8, - `ClickOptions` String, - `ClickGroupBannerID` Int32, - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `FirstVisit` DateTime, - `PredLastVisit` Date, - `LastVisit` Date, - `TotalVisits` UInt32, - `TraficSource` Nested( - ID Int8, - SearchEngineID UInt16, - AdvEngineID UInt8, - PlaceID UInt16, - SocialSourceNetworkID UInt8, - Domain String, - SearchPhrase String, - SocialSourcePage String), - `Attendance` FixedString(16), - `CLID` UInt32, - `YCLID` UInt64, - `NormalizedRefererHash` UInt64, - `SearchPhraseHash` UInt64, - `RefererDomainHash` UInt64, - `NormalizedStartURLHash` UInt64, - `StartURLDomainHash` UInt64, - `NormalizedEndURLHash` UInt64, - `TopLevelDomain` UInt64, - `URLScheme` UInt64, - `OpenstatServiceNameHash` UInt64, - `OpenstatCampaignIDHash` UInt64, - `OpenstatAdIDHash` UInt64, - `OpenstatSourceIDHash` UInt64, - `UTMSourceHash` UInt64, - `UTMMediumHash` UInt64, - `UTMCampaignHash` UInt64, - `UTMContentHash` UInt64, - `UTMTermHash` UInt64, - `FromHash` UInt64, - `WebVisorEnabled` UInt8, - `WebVisorActivity` UInt32, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `Market` Nested( - Type UInt8, - GoalID UInt32, - OrderID String, - OrderPrice Int64, - PP UInt32, - DirectPlaceID UInt32, - DirectOrderID UInt32, - DirectBannerID UInt32, - GoodID String, - GoodName String, - GoodQuantity Int32, - GoodPrice Int64), - `IslandID` FixedString(16) -) -ENGINE = CollapsingMergeTree(Sign) -PARTITION BY toYYYYMM(StartDate) -ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -ドできるようになりました。方のクエリのインタラクティブモードの `clickhouse-client` (事前にクエリを指定せずに端末で起動するだけです)またはいくつか試してみてください [代わりとなるインターフェース](../interfaces/index.md) あなたが望むなら。 - -ご覧の通り, `hits_v1` 使用します [基本的なMergeTreeエンジン](../engines/table_engines/mergetree_family/mergetree.md)、ながら `visits_v1` 使用します [折りたたみ](../engines/table_engines/mergetree_family/collapsingmergetree.md) バリアント。 - -### デー {#import-data} - -ClickHouseへのデータのインポートは、 [INSERT INTO](../sql_reference/statements/insert_into.md) 他の多くのSQLデータベースのような照会。 ただし、データは通常、次のいずれかで提供されます。 [対応するシリアル化形式](../interfaces/formats.md) 代わりに `VALUES` 句(これもサポートされています)。 - -以前にダウンロードしたファ: - -``` bash -clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv -clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv -``` - -ClickHouseには多くのものがあります [調整する設定](../operations/settings/index.md) そして、コンソールクライアントでそれらを指定する一つの方法は、引数を使用することです `--max_insert_block_size`. どのような設定が利用可能であるか、それらが何を意味するのか、そしてデフォルトが何であるかを理解する最も簡単な方法は、 `system.settings` テーブル: - -``` sql -SELECT name, value, changed, description -FROM system.settings -WHERE name LIKE '%max_insert_b%' -FORMAT TSV - -max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." -``` - -必要に応じ [OPTIMIZE](../query_language/misc/#misc_operations-optimize) インポート後のテーブル。 MergeTree-familyのエンジンで構成されたテーブルは、データストレージを最適化するために、常にバックグラウンドでデータ部分のマージを行います(または少なくとも これらのクエリのテーブルエンジンな保管の最適化現在の代わりについては後日、: - -``` bash -clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" -clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" -``` - -したがって、テーブルが一貫して新しいデータを受け取る場合は、そのままにして、マージをバックグラウンドで実行する方がよいでしょう。 - -テーブルインポートが成功したかどうかを確認できます: - -``` bash -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" -``` - -## クエリ例 {#example-queries} - -``` sql -SELECT - StartURL AS URL, - AVG(Duration) AS AvgDuration -FROM tutorial.visits_v1 -WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' -GROUP BY URL -ORDER BY AvgDuration DESC -LIMIT 10 -``` - -``` sql -SELECT - sum(Sign) AS visits, - sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, - (100. * goal_visits) / visits AS goal_percent -FROM tutorial.visits_v1 -WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') -``` - -## クラスターの展開 {#cluster-deployment} - -ClickHouseの集りは同種の集りである。 セットアップの手順: - -1. イclickhouseサーバーのすべての機械のクラスター -2. 構成ファイルでのクラスタ構成のセットアップ -3. 各インスタ -4. 作成する [分散テーブル](../engines/table_engines/special/distributed.md) - -[分散テーブル](../engines/table_engines/special/distributed.md) 実際には “view” 地元のテーブルのClickHouse。 SELECTクエリから分散型のテーブル実行が持つリソースを活用したすべてのクラスターの破片. を指定しますconfigs複数のクラスターを作成した複数のテーブルのビューを提供する別のクラスター - -ツつィツ姪"ツつ"ツ債ツづュツつケツづ債つアツつソツづァ: - -``` xml - - - - - example-perftest01j.yandex.ru - 9000 - - - - - example-perftest02j.yandex.ru - 9000 - - - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -さらなる実証しましょう新しい地域のテーブルと同じ `CREATE TABLE` 私たちが使用したクエリ `hits_v1`、しかし、異なるテーブル名: - -``` sql -CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... -``` - -クラスターのローカルテーブルにビューを提供する分散テーブルの作成: - -``` sql -CREATE TABLE tutorial.hits_all AS tutorial.hits_local -ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); -``` - -一般的な方法は、クラスターのすべてのマシンで同様の分散テーブルを作成することです。 クラスターの任意のマシンで分散クエリを実行できます。 また、特定のselectクエリを使用して一時分散テーブルを作成する代替オプションもあります [リモート](../sql_reference/table_functions/remote.md) テーブル機能。 - -逃げよう [INSERT SELECT](../sql_reference/statements/insert_into.md) 分散テーブルに分散テーブルを複数のサーバーに分散させます。 - -``` sql -INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; -``` - -!!! warning "気づく" - このアプローチは適しませんのshardingの大きます。 別のツールがあります [クリックハウスコピー機](../operations/utilities/clickhouse-copier.md) できるre-ザ-シャーを任意の大きます。 - -予想されるように、計算量の多いクエリは、3つのサーバーを使用する場合にn倍高速に実行されます。 - -この場合、3つのシャードを持つクラスターを使用し、それぞれに単一のレプリカが含まれています。 - -運用環境で復元性を提供するには、各シャードに、複数のアベイラビリティーゾーンまたはデータセンター(または少なくともラック)の間に2~3個のレプリカ clickhouseでは、レプリカの数に制限はありません。 - -レプリカを含むシャードのクラスタの設定例: - -``` xml - - ... - - - - example-perftest01j.yandex.ru - 9000 - - - example-perftest02j.yandex.ru - 9000 - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -ネイティブ複製を有効にする [ZooKeeper](http://zookeeper.apache.org/) は必須です。 ClickHouseは、すべてのレプリカでデータの整合性を管理し、障害後に自動的に復元手順を実行します。 ZooKeeperクラスターを別々のサーバーに展開することをお勧めします(ClickHouseを含む他のプロセスは実行されていません)。 - -!!! note "メモ" - いくつかの簡単なケースでは、アプリケーションコードからすべてのレプリカにデータを書き込むことでデータを複製できます。 このアプローチは **ない** 推奨、この場合、ClickHouseはすべてのレプリカでデータの整合性を保証することはできません。 従ってそれはあなたの適用の責任になります。 - -ZooKeeperの場所は設定ファイルで指定します: - -``` xml - - - zoo01.yandex.ru - 2181 - - - zoo02.yandex.ru - 2181 - - - zoo03.yandex.ru - 2181 - - -``` - -また、テーブル作成時に使用される各シャードとレプリカを識別するマクロを設定する必要があります: - -``` xml - - 01 - 01 - -``` - -がない場合にレプリカの瞬間に複製表を作成し、新しい最初のレプリカスのインスタンスが作成. がある場合でライブレプリカを新たなレプリカのクローンからデータを設定しています。 最初にすべての複製テーブルを作成し、それにデータを挿入するオプションがあります。 別のオプションを作れるレプリカを追加しその他の長期データを挿入出来ます。 - -``` sql -CREATE TABLE tutorial.hits_replica (...) -ENGINE = ReplcatedMergeTree( - '/clickhouse_perftest/tables/{shard}/hits', - '{replica}' -) -... -``` - -ここでは、 [レプリケートされたmergetree](../engines/table_engines/mergetree_family/replication.md) テーブルエンジン。 パラメータを指定飼育係のパスを含むザ-シャープ識別子のことです。 - -``` sql -INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; -``` - -複製はマルチマスターモードで動作します。 データは任意のレプリカにロードすることができ、システムは他のインスタンスと自動的に同期します。 複製は非同期で一定の瞬間にも、すべてのレプリカを含む場合があり、最近に挿入されます。 少なくとも一つのレプリカのようにするためのデータで測定す その同期データの修理整合性が活躍できます。 このアプローチでは、最近挿入されたデータの損失の可能性が低いことができます。 - -[元の記事](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/ja/guides/apply-catboost-model.md b/docs/ja/guides/apply-catboost-model.md new file mode 100644 index 00000000000..584feb390c7 --- /dev/null +++ b/docs/ja/guides/apply-catboost-model.md @@ -0,0 +1,239 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 41 +toc_title: "CatBoost\u30E2\u30C7\u30EB\u306E\u9069\u7528" +--- + +# ClickHouseでのCatboostモデルの適用 {#applying-catboost-model-in-clickhouse} + +[CatBoost](https://catboost.ai) では、このオープンソースの勾配向上の図書館が開発した [Yandex](https://yandex.com/company/) 機械学習のために。 + +この命令では、sqlからモデル推論を実行して、事前に学習したモデルをclickhouseに適用する方法を学習します。 + +ClickHouseでCatBoostモデルを適用するには: + +1. [テーブルの作成](#create-table). +2. [データをテーブルに挿入する](#insert-data-to-table). +3. [ClickhouseにCatBoostを統合](#integrate-catboost-into-clickhouse) (任意ステップ)。 +4. [SQLからモデル推論を実行する](#run-model-inference). + +CatBoostモデルのトレーニングの詳細については、 [訓練用モデル](https://catboost.ai/docs/features/training.html#training). + +## 前提条件 {#prerequisites} + +あなたが持っていない場合 [Docker](https://docs.docker.com/install/) しかし、インストールしてください。 + +!!! note "メモ" + [Docker](https://www.docker.com) であるソフトウェアプラットフォームを作成することができる容器を隔離するCatBoostとClickHouse設置からシステム。 + +CatBoostモデルを適用する前に: + +**1.** を引く [Dockerイメージ](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) レジストリから: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +このdocker画像を含むものを実行する必要がありますcatboostとclickhouse:コードでは、ランタイム時において、図書館、環境変数の設定ファイルです。 + +**2.** Dockerイメージが正常にプルされたことを確認します: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** この画像に基づいてDockerコンテナを起動します: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. テーブルの作成 {#create-table} + +トレーニングサンプルのclickhouseテーブルを作成するには: + +**1.** 開始ClickHouseコンソールがクライアントのインタラクティブモード: + +``` bash +$ clickhouse client +``` + +!!! note "メモ" + ClickHouseサーバーはすでにDockerコンテナ内で実行されています。 + +**2.** テーブルを作成しのコマンドを使用して: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** ClickHouseコンソールクライアン: + +``` sql +:) exit +``` + +## 2. データをテーブルに挿入する {#insert-data-to-table} + +データを挿入するには: + +**1.** 次のコマンドを実行します: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** 開始ClickHouseコンソールがクライアントのインタラクティブモード: + +``` bash +$ clickhouse client +``` + +**3.** データがアップロードされている: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++-------+ +``` + +## 3. ClickhouseにCatBoostを統合 {#integrate-catboost-into-clickhouse} + +!!! note "メモ" + **省略可能なステップ。** のDocker画像を含むものを実行する必要がありますCatBoostとClickHouse. + +CatBoostをClickHouseに統合するには: + +**1.** 評価ライブラリを構築します。 + +CatBoostモデルを評価する最速の方法はcompileです `libcatboostmodel.` ライブラリ。 に関する詳細については、図書館を参照 [CatBoost書](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** 新しいディレクトリを任意の場所に、任意の名前で作成します。, `data` 作成したライブラリをその中に入れます。 Dockerイメージにはすでにライブ `data/libcatboostmodel.so`. + +**3.** Configモデルの新しいディレクトリを任意の場所に、任意の名前で作成します。, `models`. + +**4.** 任意の名前のモデル構成ファイルを作成します。, `models/amazon_model.xml`. + +**5.** モデル構成の説明: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** CatBoostへのパスとモデル設定をClickHouse設定に追加します: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. SQLからモデル推論を実行する {#run-model-inference} + +試験モデルのclickhouseト `$ clickhouse client`. + +モデルが動作していることを確認しましょう: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "メモ" + 機能 [モデル値](../sql-reference/functions/other-functions.md#function-modelevaluate) マルチクラスモデルのクラスごとの生の予測を持つタプルを返します。 + +確率を予測してみましょう: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "メモ" + 詳細について [exp()](../sql-reference/functions/math-functions.md) 機能。 + +サンプルのloglossを計算してみましょう: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "メモ" + 詳細について [平均()](../sql-reference/aggregate-functions/reference.md#agg_function-avg) と [ログ()](../sql-reference/functions/math-functions.md) 機能。 + +[元の記事](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/ja/guides/apply_catboost_model.md b/docs/ja/guides/apply_catboost_model.md deleted file mode 100644 index 5f79e206ca9..00000000000 --- a/docs/ja/guides/apply_catboost_model.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 41 -toc_title: "CatBoost\u30E2\u30C7\u30EB\u306E\u9069\u7528" ---- - -# ClickHouseでのCatboostモデルの適用 {#applying-catboost-model-in-clickhouse} - -[CatBoost](https://catboost.ai) では、このオープンソースの勾配向上の図書館が開発した [Yandex](https://yandex.com/company/) 機械学習のために。 - -この命令では、sqlからモデル推論を実行して、事前に学習したモデルをclickhouseに適用する方法を学習します。 - -ClickHouseでCatBoostモデルを適用するには: - -1. [テーブルの作成](#create-table). -2. [データをテーブルに挿入する](#insert-data-to-table). -3. [ClickhouseにCatBoostを統合](#integrate-catboost-into-clickhouse) (任意ステップ)。 -4. [SQLからモデル推論を実行する](#run-model-inference). - -CatBoostモデルのトレーニングの詳細については、 [訓練用モデル](https://catboost.ai/docs/features/training.html#training). - -## 前提条件 {#prerequisites} - -あなたが持っていない場合 [Docker](https://docs.docker.com/install/) しかし、インストールしてください。 - -!!! note "メモ" - [Docker](https://www.docker.com) であるソフトウェアプラットフォームを作成することができる容器を隔離するCatBoostとClickHouse設置からシステム。 - -CatBoostモデルを適用する前に: - -**1.** を引く [Dockerイメージ](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) レジストリから: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -このdocker画像を含むものを実行する必要がありますcatboostとclickhouse:コードでは、ランタイム時において、図書館、環境変数の設定ファイルです。 - -**2.** Dockerイメージが正常にプルされたことを確認します: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** この画像に基づいてDockerコンテナを起動します: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. テーブルの作成 {#create-table} - -トレーニングサンプルのclickhouseテーブルを作成するには: - -**1.** 開始ClickHouseコンソールがクライアントのインタラクティブモード: - -``` bash -$ clickhouse client -``` - -!!! note "メモ" - ClickHouseサーバーはすでにDockerコンテナ内で実行されています。 - -**2.** テーブルを作成しのコマンドを使用して: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** ClickHouseコンソールクライアン: - -``` sql -:) exit -``` - -## 2. データをテーブルに挿入する {#insert-data-to-table} - -データを挿入するには: - -**1.** 次のコマンドを実行します: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** 開始ClickHouseコンソールがクライアントのインタラクティブモード: - -``` bash -$ clickhouse client -``` - -**3.** データがアップロードされている: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+-------+ -``` - -## 3. ClickhouseにCatBoostを統合 {#integrate-catboost-into-clickhouse} - -!!! note "メモ" - **省略可能なステップ。** のDocker画像を含むものを実行する必要がありますCatBoostとClickHouse. - -CatBoostをClickHouseに統合するには: - -**1.** 評価ライブラリを構築します。 - -CatBoostモデルを評価する最速の方法はcompileです `libcatboostmodel.` ライブラリ。 に関する詳細については、図書館を参照 [CatBoost書](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** 新しいディレクトリを任意の場所に、任意の名前で作成します。, `data` 作成したライブラリをその中に入れます。 Dockerイメージにはすでにライブ `data/libcatboostmodel.so`. - -**3.** Configモデルの新しいディレクトリを任意の場所に、任意の名前で作成します。, `models`. - -**4.** 任意の名前のモデル構成ファイルを作成します。, `models/amazon_model.xml`. - -**5.** モデル構成の説明: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** CatBoostへのパスとモデル設定をClickHouse設定に追加します: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. SQLからモデル推論を実行する {#run-model-inference} - -試験モデルのclickhouseト `$ clickhouse client`. - -モデルが動作していることを確認しましょう: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "メモ" - 機能 [モデル値](../sql_reference/functions/other_functions.md#function-modelevaluate) マルチクラスモデルのクラスごとの生の予測を持つタプルを返します。 - -確率を予測してみましょう: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "メモ" - 詳細について [exp()](../sql_reference/functions/math_functions.md) 機能。 - -サンプルのloglossを計算してみましょう: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "メモ" - 詳細について [平均()](../sql_reference/aggregate_functions/reference.md#agg_function-avg) と [ログ()](../sql_reference/functions/math_functions.md) 機能。 - -[元の記事](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/ja/guides/index.md b/docs/ja/guides/index.md index fcfc7ecd9d0..84eb460b56c 100644 --- a/docs/ja/guides/index.md +++ b/docs/ja/guides/index.md @@ -10,7 +10,7 @@ toc_title: "\u6982\u8981" ClickHouseを使用してさまざまなタスクを解決するのに役立つ詳細な手順のリスト: -- [ストリートビューを簡単にクラスタの設定](../getting_started/tutorial.md) -- [ClickHouseでのCatBoostモデルの適用](apply_catboost_model.md) +- [ストリートビューを簡単にクラスタの設定](../getting-started/tutorial.md) +- [ClickHouseでのCatBoostモデルの適用](apply-catboost-model.md) [元の記事](https://clickhouse.tech/docs/en/guides/) diff --git a/docs/ja/images/column_oriented.gif b/docs/ja/images/column-oriented.gif similarity index 100% rename from docs/ja/images/column_oriented.gif rename to docs/ja/images/column-oriented.gif diff --git a/docs/ja/images/logo.svg b/docs/ja/images/logo.svg index b5ab923ff65..17da9417e2d 100644 --- a/docs/ja/images/logo.svg +++ b/docs/ja/images/logo.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/docs/ja/images/row_oriented.gif b/docs/ja/images/row-oriented.gif similarity index 100% rename from docs/ja/images/row_oriented.gif rename to docs/ja/images/row-oriented.gif diff --git a/docs/ja/index.md b/docs/ja/index.md index 4dc166d7f5c..b892b277407 100644 --- a/docs/ja/index.md +++ b/docs/ja/index.md @@ -1,6 +1,6 @@ --- toc_priority: 3 -toc_title: 概観 +toc_title: "\u6982\u89B3" --- # ClickHouseとは? {#clickhousetoha} @@ -66,11 +66,11 @@ OLAPシナリオは、他の一般的なシナリオ(OLTPやKey-Valueアクセ **行指向DBMS** -![Row-oriented](images/row_oriented.gif#) +![Row-oriented](images/row-oriented.gif#) **列指向DBMS** -![Column-oriented](images/column_oriented.gif#) +![Column-oriented](images/column-oriented.gif#) 違いがわかりましたか? diff --git a/docs/ja/interfaces/cli.md b/docs/ja/interfaces/cli.md index b8dfef00634..1cccc83b47f 100644 --- a/docs/ja/interfaces/cli.md +++ b/docs/ja/interfaces/cli.md @@ -9,7 +9,7 @@ toc_title: "\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3" ClickHouseスネイティブコマンドラインのクライアント: `clickhouse-client`. クライアン 詳細については、 [設定](#interfaces_cli_configuration). -[設置](../getting_started/index.md) それから `clickhouse-client` パッケージとコマンドでそれを実行 `clickhouse-client`. +[設置](../getting-started/index.md) それから `clickhouse-client` パッケージとコマンドでそれを実行 `clickhouse-client`. ``` bash $ clickhouse-client @@ -89,7 +89,7 @@ $ clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = ``` - `name` — Placeholder identifier. In the console client it should be used in app parameters as `--param_ = value`. -- `data type` — [データ型](../sql_reference/data_types/index.md) アプリのパラメータ値の。 たとえば、次のようなデータ構造 `(integer, ('string', integer))` を持つことができ `Tuple(UInt8, Tuple(String, UInt8))` デー [整数](../sql_reference/data_types/int_uint.md) タイプ)。 +- `data type` — [データ型](../sql-reference/data-types/index.md) アプリのパラメータ値の。 たとえば、次のようなデータ構造 `(integer, ('string', integer))` を持つことができ `Tuple(UInt8, Tuple(String, UInt8))` デー [整数](../sql-reference/data-types/int-uint.md) タイプ)。 #### 例えば {#example} diff --git a/docs/ja/interfaces/formats.md b/docs/ja/interfaces/formats.md index c2784058a69..2513fa7279f 100644 --- a/docs/ja/interfaces/formats.md +++ b/docs/ja/interfaces/formats.md @@ -110,9 +110,9 @@ TabSeparated形式でデータを渡すときにエスケープする必要が 配列は、角かっこで囲まれたコンマ区切りの値のリストとして記述されます。 配列内の数値項目は通常どおりに書式設定されます。 `Date` と `DateTime` 型は一重引quotesで書き込まれます。 文字列は、上記と同じエスケープ規則で一重引quotesで書き込まれます。 -[NULL](../sql_reference/syntax.md) フォーマットとして `\N`. +[NULL](../sql-reference/syntax.md) フォーマットとして `\N`. -の各要素 [ネスト](../sql_reference/data_types/nested_data_structures/nested.md) 構造体は配列として表されます。 +の各要素 [ネスト](../sql-reference/data-types/nested-data-structures/nested.md) 構造体は配列として表されます。 例えば: @@ -332,7 +332,7 @@ SearchPhrase=curtain designs count()=1064 SearchPhrase=baku count()=1000 ``` -[NULL](../sql_reference/syntax.md) フォーマットとして `\N`. +[NULL](../sql-reference/syntax.md) フォーマットとして `\N`. ``` sql SELECT * FROM t_null FORMAT TSKV @@ -366,7 +366,7 @@ $ clickhouse-client --format_csv_delimiter="|" --query="INSERT INTO test.csv FOR [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) は有効です。 -`NULL` フォーマットとして `\N` または `NULL` または、引用符で囲まれていない空の文字列("設定"を参照 [input\_format\_csv\_unquoted\_null\_literal\_as\_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) と [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields)). +`NULL` フォーマットとして `\N` または `NULL` または、引用符で囲まれていない空の文字列(“設定”を参照 [input\_format\_csv\_unquoted\_null\_literal\_as\_null](../operations/settings/settings.md#settings-input_format_csv_unquoted_null_literal_as_null) と [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields)). CSV形式は、totalsとextremesの出力を次のようにサポートします `TabSeparated`. @@ -464,7 +464,7 @@ JSONはJavaScriptと互換性があります。 これを確実にするため この形式は、クエリ結果を出力する場合にのみ適切ですが、解析(テーブルに挿入するデータの取得)には適していません。 -ClickHouse支援 [NULL](../sql_reference/syntax.md) として表示されます `null` JSON出力で。 +ClickHouse支援 [NULL](../sql-reference/syntax.md) として表示されます `null` JSON出力で。 また、 [JSONEachRow](#jsoneachrow) フォーマット。 @@ -541,7 +541,7 @@ ClickHouseを無視した空間要素には、カンマの後にオブジェク **省略された値の処理** -ClickHouseは、省略された値を対応するデフォルト値に置き換えます [データ型](../sql_reference/data_types/index.md). +ClickHouseは、省略された値を対応するデフォルト値に置き換えます [データ型](../sql-reference/data-types/index.md). もし `DEFAULT expr` は、ClickHouseはに応じて異なる置換規則を使用して、指定されています [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) 設定。 @@ -586,7 +586,7 @@ CREATE TABLE IF NOT EXISTS example_table ### 入れ子構造の使用法 {#jsoneachrow-nested} -あなたがテーブルを持っている場合 [ネスト](../sql_reference/data_types/nested_data_structures/nested.md) データ型の列には、同じ構造でJSONデータを挿入することができます。 この機能を有効にするには [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) 設定。 +あなたがテーブルを持っている場合 [ネスト](../sql-reference/data-types/nested-data-structures/nested.md) データ型の列には、同じ構造でJSONデータを挿入することができます。 この機能を有効にするには [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) 設定。 たとえば、次の表を考えてみます: @@ -645,7 +645,7 @@ SELECT * FROM json_each_row_nested ## ネイティブ {#native} -最も効率的な形式。 データ書き込みおよび読み込みをブロックのバイナリ形式です。 各ブロックについて、行数、列数、列名と型、およびこのブロック内の列の一部が次々に記録されます。 つまり、この形式は次のとおりです “columnar” – it doesn't convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. +最も効率的な形式。 データ書き込みおよび読み込みをブロックのバイナリ形式です。 各ブロックについて、行数、列数、列名と型、およびこのブロック内の列の一部が次々に記録されます。 つまり、この形式は次のとおりです “columnar” – it doesn’t convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. この形式を使用すると、clickhouse dbmsでのみ読み取ることができるダンプをすばやく生成できます。 この形式を自分で操作するのは意味がありません。 @@ -660,7 +660,7 @@ SELECT * FROM json_each_row_nested テーブルの完全なグリッドが描画され、各行は端末内の二行を占めています。 各結果ブロックは、別のテーブルとして出力されます。 これは、結果をバッファリングせずにブロックを出力できるようにするために必要です(すべての値の可視幅を事前に計算するためにバッファリ -[NULL](../sql_reference/syntax.md) として出力されます `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) として出力されます `ᴺᵁᴸᴸ`. 例(以下に示す [PrettyCompact](#prettycompact) 書式): @@ -764,7 +764,7 @@ FixedStringは、単純にバイトのシーケンスとして表されます。 配列は、varintの長さ(符号なし)として表されます [LEB128](https://en.wikipedia.org/wiki/LEB128))、配列の連続した要素が続きます。 -のために [NULL](../sql_reference/syntax.md#null-literal) 支援、追加のバイトを含む1または0が追加される前に各 [Nullable](../sql_reference/data_types/nullable.md) 値。 1の場合、値は次のようになります `NULL` このバイトは別の値として解釈されます。 0の場合、バイトの後の値はそうではありません `NULL`. +のために [NULL](../sql-reference/syntax.md#null-literal) 支援、追加のバイトを含む1または0が追加される前に各 [Nullable](../sql-reference/data-types/nullable.md) 値。 1の場合、値は次のようになります `NULL` このバイトは別の値として解釈されます。 0の場合、バイトの後の値はそうではありません `NULL`. ## RowBinaryWithNamesAndTypes {#rowbinarywithnamesandtypes} @@ -776,7 +776,7 @@ FixedStringは、単純にバイトのシーケンスとして表されます。 ## 値 {#data-format-values} -版画毎に行ットに固定して使用します。 行はコンマで区切られます。 最後の行の後にコンマはありません。 角かっこ内の値もコンマで区切られます。 数字は引用符なしの小数点形式で出力されます。 配列は角かっこで囲まれて出力されます。 文字列、日付、および時刻を含む日付が引用符で囲まれて出力されます。 ルールのエスケープと解析は、 [タブ区切り](#tabseparated) フォーマット。 書式設定時には、余分なスペースは挿入されませんが、解析時には、それらは許可され、スキップされます(配列値内のスペースは許可されません)。 [NULL](../sql_reference/syntax.md) として表されます `NULL`. +版画毎に行ットに固定して使用します。 行はコンマで区切られます。 最後の行の後にコンマはありません。 角かっこ内の値もコンマで区切られます。 数字は引用符なしの小数点形式で出力されます。 配列は角かっこで囲まれて出力されます。 文字列、日付、および時刻を含む日付が引用符で囲まれて出力されます。 ルールのエスケープと解析は、 [タブ区切り](#tabseparated) フォーマット。 書式設定時には、余分なスペースは挿入されませんが、解析時には、それらは許可され、スキップされます(配列値内のスペースは許可されません)。 [NULL](../sql-reference/syntax.md) として表されます `NULL`. The minimum set of characters that you need to escape when passing data in Values ​​format: single quotes and backslashes. @@ -788,7 +788,7 @@ The minimum set of characters that you need to escape when passing data in Value 各値を、指定された列名とは別の行に出力します。 このフォーマットは、各行が多数の列で構成されている場合に、単一または少数の行だけを印刷する場合に便利です。 -[NULL](../sql_reference/syntax.md) として出力されます `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) として出力されます `ᴺᵁᴸᴸ`. 例えば: @@ -897,9 +897,9 @@ Just as for JSON, invalid UTF-8 sequences are changed to the replacement charact ## CapnProto {#capnproto} -Cap'n Protoは、プロトコルバッファやThriftに似たバイナリメッセージ形式ですが、JSONやMessagePackには似ていません。 +Cap’n Protoは、プロトコルバッファやThriftに似たバイナリメッセージ形式ですが、JSONやMessagePackには似ていません。 -Cap'n Protoメッセージは厳密に型付けされており、自己記述型ではありません。 スキーマはその場で適用され、クエリごとにキャッシュされます。 +Cap’n Protoメッセージは厳密に型付けされており、自己記述型ではありません。 スキーマはその場で適用され、クエリごとにキャッシュされます。 ``` bash $ cat capnproto_messages.bin | clickhouse-client --query "INSERT INTO test.hits FORMAT CapnProto SETTINGS format_schema='schema:Message'" @@ -967,7 +967,7 @@ message MessageType { ``` ClickHouseは、名前の付いた列を検索しようとします `x.y.z` (または `x_y_z` または `X.y_Z` など)。 -ネストしたメッセージを入力と出力 [入れ子のデータ構造](../sql_reference/data_types/nested_data_structures/nested.md). +ネストしたメッセージを入力と出力 [入れ子のデータ構造](../sql-reference/data-types/nested-data-structures/nested.md). このようなprotobufスキーマで定義されたデフォルト値 @@ -979,7 +979,7 @@ message MessageType { } ``` -適用されない。 [表のデフォルト](../sql_reference/statements/create.md#create-default-values) それらの代わりに使用されます。 +適用されない。 [表のデフォルト](../sql-reference/statements/create.md#create-default-values) それらの代わりに使用されます。 クリックハウスの入力および出力のprotobufメッセージ `length-delimited` フォーマット。 これは、すべてのメッセージがその長さを [varint](https://developers.google.com/protocol-buffers/docs/encoding#varints). @@ -993,23 +993,23 @@ ClickHouseアブロ形式の読み書きの支援 [Avroデータファイル](ht ### 一致するデータ型 {#data_types-matching} -下の表に、サポートされているデータの種類とどのように試合clickhouse [データ型](../sql_reference/data_types/index.md) で `INSERT` と `SELECT` クエリ。 +下の表に、サポートされているデータの種類とどのように試合clickhouse [データ型](../sql-reference/data-types/index.md) で `INSERT` と `SELECT` クエリ。 | Avroデータ型 `INSERT` | ClickHouseデータタイプ | Avroデータ型 `SELECT` | |---------------------------------------------|-------------------------------------------------------------------------------------------------------------------|------------------------------| -| `boolean`, `int`, `long`, `float`, `double` | [Int(8/16/32)](../sql_reference/data_types/int_uint.md), [UInt(8/16/32)](../sql_reference/data_types/int_uint.md) | `int` | -| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql_reference/data_types/int_uint.md), [UInt64](../sql_reference/data_types/int_uint.md) | `long` | -| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql_reference/data_types/float.md) | `float` | -| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql_reference/data_types/float.md) | `double` | -| `bytes`, `string`, `fixed`, `enum` | [文字列](../sql_reference/data_types/string.md) | `bytes` | -| `bytes`, `string`, `fixed` | [FixedString(N)](../sql_reference/data_types/fixedstring.md) | `fixed(N)` | -| `enum` | [Enum(8/16)](../sql_reference/data_types/enum.md) | `enum` | -| `array(T)` | [配列(t)](../sql_reference/data_types/array.md) | `array(T)` | -| `union(null, T)`, `union(T, null)` | [Nullable(T)](../sql_reference/data_types/date.md) | `union(null, T)` | -| `null` | [Nullable(何もなし)](../sql_reference/data_types/special_data_types/nothing.md) | `null` | -| `int (date)` \* | [日付](../sql_reference/data_types/date.md) | `int (date)` \* | -| `long (timestamp-millis)` \* | [DateTime64(3)](../sql_reference/data_types/datetime.md) | `long (timestamp-millis)` \* | -| `long (timestamp-micros)` \* | [DateTime64(6)](../sql_reference/data_types/datetime.md) | `long (timestamp-micros)` \* | +| `boolean`, `int`, `long`, `float`, `double` | [Int(8/16/32)](../sql-reference/data-types/int-uint.md), [UInt(8/16/32)](../sql-reference/data-types/int-uint.md) | `int` | +| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql-reference/data-types/int-uint.md), [UInt64](../sql-reference/data-types/int-uint.md) | `long` | +| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql-reference/data-types/float.md) | `float` | +| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql-reference/data-types/float.md) | `double` | +| `bytes`, `string`, `fixed`, `enum` | [文字列](../sql-reference/data-types/string.md) | `bytes` | +| `bytes`, `string`, `fixed` | [FixedString(N)](../sql-reference/data-types/fixedstring.md) | `fixed(N)` | +| `enum` | [Enum(8/16)](../sql-reference/data-types/enum.md) | `enum` | +| `array(T)` | [配列(t)](../sql-reference/data-types/array.md) | `array(T)` | +| `union(null, T)`, `union(T, null)` | [Nullable(T)](../sql-reference/data-types/date.md) | `union(null, T)` | +| `null` | [Nullable(何もなし)](../sql-reference/data-types/special-data-types/nothing.md) | `null` | +| `int (date)` \* | [日付](../sql-reference/data-types/date.md) | `int (date)` \* | +| `long (timestamp-millis)` \* | [DateTime64(3)](../sql-reference/data-types/datetime.md) | `long (timestamp-millis)` \* | +| `long (timestamp-micros)` \* | [DateTime64(6)](../sql-reference/data-types/datetime.md) | `long (timestamp-micros)` \* | \* [Avro論理型](http://avro.apache.org/docs/current/spec.html#Logical+Types) @@ -1072,7 +1072,7 @@ $ kafkacat -b kafka-broker -C -t topic1 -o beginning -f '%s' -c 3 | clickhouse- 3 c ``` -使用するには `AvroConfluent` と [カフカname](../engines/table_engines/integrations/kafka.md): +使用するには `AvroConfluent` と [カフカname](../engines/table-engines/integrations/kafka.md): ``` sql CREATE TABLE topic1_stream @@ -1101,25 +1101,25 @@ SELECT * FROM topic1_stream; ### 一致するデータ型 {#data_types-matching-2} -下の表に、サポートされているデータの種類とどのように試合clickhouse [データ型](../sql_reference/data_types/index.md) で `INSERT` と `SELECT` クエリ。 +下の表に、サポートされているデータの種類とどのように試合clickhouse [データ型](../sql-reference/data-types/index.md) で `INSERT` と `SELECT` クエリ。 | Parquetデータ型 (`INSERT`) | ClickHouseデータタイプ | Parquetデータ型 (`SELECT`) | |----------------------------|-----------------------------------------------------------|----------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | `UINT8` | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | `INT8` | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | `UINT16` | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | `INT16` | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | `UINT32` | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | `INT32` | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | `UINT64` | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | `INT64` | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | `FLOAT` | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | `DOUBLE` | -| `DATE32` | [日付](../sql_reference/data_types/date.md) | `UINT16` | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | `UINT32` | -| `STRING`, `BINARY` | [文字列](../sql_reference/data_types/string.md) | `STRING` | -| — | [FixedString](../sql_reference/data_types/fixedstring.md) | `STRING` | -| `DECIMAL` | [小数](../sql_reference/data_types/decimal.md) | `DECIMAL` | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | `UINT8` | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | `INT8` | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | `UINT16` | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | `INT16` | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | `UINT32` | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | `INT32` | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | `UINT64` | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | `INT64` | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | `FLOAT` | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | `DOUBLE` | +| `DATE32` | [日付](../sql-reference/data-types/date.md) | `UINT16` | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | `UINT32` | +| `STRING`, `BINARY` | [文字列](../sql-reference/data-types/string.md) | `STRING` | +| — | [FixedString](../sql-reference/data-types/fixedstring.md) | `STRING` | +| `DECIMAL` | [小数](../sql-reference/data-types/decimal.md) | `DECIMAL` | ClickHouseは構成可能の精密をの支えます `Decimal` タイプ。 その `INSERT` クエリは寄木細工を扱います `DECIMAL` クリックハウスとして入力 `Decimal128` タイプ。 @@ -1141,7 +1141,7 @@ $ cat {filename} | clickhouse-client --query="INSERT INTO {some_table} FORMAT Pa $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_file.pq} ``` -Hadoopとデータを交換するには、次のようにします [HDFSテーブルエンジン](../engines/table_engines/integrations/hdfs.md). +Hadoopとデータを交換するには、次のようにします [HDFSテーブルエンジン](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} @@ -1149,24 +1149,24 @@ Hadoopとデータを交換するには、次のようにします [HDFSテー ### 一致するデータ型 {#data_types-matching-3} -下の表に、サポートされているデータの種類とどのように試合clickhouse [データ型](../sql_reference/data_types/index.md) で `INSERT` クエリ。 +下の表に、サポートされているデータの種類とどのように試合clickhouse [データ型](../sql-reference/data-types/index.md) で `INSERT` クエリ。 | ORCデータ型 (`INSERT`) | ClickHouseデータタイプ | |------------------------|-----------------------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | -| `DATE32` | [日付](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [文字列](../sql_reference/data_types/string.md) | -| `DECIMAL` | [小数](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | +| `DATE32` | [日付](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [文字列](../sql-reference/data-types/string.md) | +| `DECIMAL` | [小数](../sql-reference/data-types/decimal.md) | ClickHouseはの構成可能の精密を支えます `Decimal` タイプ。 その `INSERT` クエリはORCを処理します `DECIMAL` クリックハウスとして入力 `Decimal128` タイプ。 @@ -1182,7 +1182,7 @@ ClickHouseテーブル列のデータ型は、対応するORCデータフィー $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -Hadoopとデータを交換するには、次のようにします [HDFSテーブルエンジン](../engines/table_engines/integrations/hdfs.md). +Hadoopとデータを交換するには、次のようにします [HDFSテーブルエンジン](../engines/table-engines/integrations/hdfs.md). ## 書式スキーマ {#formatschema} @@ -1195,10 +1195,10 @@ e.g. `schemafile.proto:MessageType`. データを入力するか、または出力すれば [お客様](../interfaces/cli.md) で [対話モード](../interfaces/cli.md#cli_usage)、フォーマットスキーマで指定されたファイル名 クライアン -でクライアントを使用する場合 [バッチモード](../interfaces/cli.md#cli_usage) は、パスのスキーマ"相対的"に指定する必要があります。 +でクライアントを使用する場合 [バッチモード](../interfaces/cli.md#cli_usage) は、パスのスキーマ“相対的”に指定する必要があります。 データを入力するか、または出力すれば [HTTPインター](../interfaces/http.md) フォーマットスキーマで指定したファイル名 -に指定されたディレクトリにあるはずです。 [format\_schema\_path](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) +に指定されたディレクトリにあるはずです。 [format\_schema\_path](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) サーバー構成で。 ## エラーのスキップ {#skippingerrors} diff --git a/docs/ja/interfaces/http.md b/docs/ja/interfaces/http.md index a794b3de269..71673d5f196 100644 --- a/docs/ja/interfaces/http.md +++ b/docs/ja/interfaces/http.md @@ -11,7 +11,7 @@ toc_title: "HTTP\u30A4\u30F3\u30BF\u30FC" デフォルトでは、clickhouse-serverはポート8123でhttpをリッスンします(これは設定で変更できます)。 -パラメータを指定せずにget/requestを実行すると、200個の応答コードと、以下で定義されている文字列が返されます [http\_server\_default\_response](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-http_server_default_response) デフォルト値 “Ok.” (最後にラインフィード付き) +パラメータを指定せずにget/requestを実行すると、200個の応答コードと、以下で定義されている文字列が返されます [http\_server\_default\_response](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-http_server_default_response) デフォルト値 “Ok.” (最後にラインフィード付き) ``` bash $ curl 'http://localhost:8123/' @@ -440,7 +440,7 @@ db.stats: Absolute delay: 22. Relative delay: 22. `` は、HTTPリクエストのメソッド部分のマッチングを担当します。 `` 定義にの十分に合致します [方法](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) HTTPプロトコルで。 これはオプションの設定です。 構成ファイルで定義されていない場合は、HTTP要求のメソッド部分と一致しません -`` HTTPリクエストのurl部分を照合する責任があります。 それはと互換性があります [RE2](https://github.com/google/re2)'の正規表現。 これはオプションの設定です。 構成ファイルで定義されていない場合は、HTTP要求のurl部分と一致しません +`` HTTPリクエストのurl部分を照合する責任があります。 それはと互換性があります [RE2](https://github.com/google/re2)’の正規表現。 これはオプションの設定です。 構成ファイルで定義されていない場合は、HTTP要求のurl部分と一致しません `` HTTPリクエストのヘッダ部分に一致させる責任があります。 これはRE2の正規表現と互換性があります。 これはオプションの設定です。 構成ファイルで定義されていない場合は、HTTP要求のヘッダー部分と一致しません diff --git a/docs/ja/interfaces/index.md b/docs/ja/interfaces/index.md index 544b39b8e57..0a40f3610be 100644 --- a/docs/ja/interfaces/index.md +++ b/docs/ja/interfaces/index.md @@ -8,7 +8,7 @@ toc_title: "\u5C0E\u5165" # 界面 {#interfaces} -ツつィツ姪"ツつ"ツ債ツづュツつケツづ債つアツつソツづァツつゥツづァ): +ツつィツ姪“ツつ”ツ債ツづュツつケツづ債つアツつソツづァツつゥツづァ): - [HTTP](http.md)、文書化され、直接使いやすいです。 - [ネイティブtcp](tcp.md) オーバーヘッドが少ない。 @@ -22,7 +22,7 @@ toc_title: "\u5C0E\u5165" また、clickhouseで作業するための幅広いサードパーティ製ライブラリもあります: -- [クライアント](third-party/client_libraries.md) +- [クライアント](third-party/client-libraries.md) - [統合](third-party/integrations.md) - [ビジュアル](third-party/gui.md) diff --git a/docs/ja/interfaces/jdbc.md b/docs/ja/interfaces/jdbc.md index c86882e7023..8ad05c955f6 100644 --- a/docs/ja/interfaces/jdbc.md +++ b/docs/ja/interfaces/jdbc.md @@ -9,7 +9,7 @@ toc_title: "JDBC\u30C9\u30E9\u30A4\u30D0" - **[公式ドライバー](https://github.com/ClickHouse/clickhouse-jdbc)** - サードパーティドライバ: - - [ツつィツ姪"ツつ"ツ債ツつケ](https://github.com/housepower/ClickHouse-Native-JDBC) + - [ツつィツ姪“ツつ”ツ債ツつケ](https://github.com/housepower/ClickHouse-Native-JDBC) - [clickhouse4j](https://github.com/blynkkk/clickhouse4j) [元の記事](https://clickhouse.tech/docs/en/interfaces/jdbc/) diff --git a/docs/ja/interfaces/mysql.md b/docs/ja/interfaces/mysql.md index 9582fb0880b..701f3994132 100644 --- a/docs/ja/interfaces/mysql.md +++ b/docs/ja/interfaces/mysql.md @@ -7,7 +7,7 @@ toc_title: "MySQL\u30A4\u30F3" # MySQLイン {#mysql-interface} -ツつィツ姪"ツつ"ツ債ツづュツつケ これは次の方法で有効にできます [mysql\_portgenericname](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) 設定ファイルでの設定: +ツつィツ姪“ツつ”ツ債ツづュツつケ これは次の方法で有効にできます [mysql\_portgenericname](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) 設定ファイルでの設定: ``` xml 9004 @@ -37,8 +37,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -すべてのmysqlクライアントとの互換性のために、ユーザーパスワードを [ダブルSHA1](../operations/settings/settings_users.md#password_double_sha1_hex) 構成ファイルで。 -ユー [SHA256](../operations/settings/settings_users.md#password_sha256_hex) いくつかのクライアントは認証できません(mysqljsと古いバージョンのコマンドラインツールmysql)。 +すべてのmysqlクライアントとの互換性のために、ユーザーパスワードを [ダブルSHA1](../operations/settings/settings-users.md#password_double_sha1_hex) 構成ファイルで。 +ユー [SHA256](../operations/settings/settings-users.md#password_sha256_hex) いくつかのクライアントは認証できません(mysqljsと古いバージョンのコマンドラインツールmysql)。 制限: diff --git a/docs/ja/interfaces/third-party/client_libraries.md b/docs/ja/interfaces/third-party/client-libraries.md similarity index 100% rename from docs/ja/interfaces/third-party/client_libraries.md rename to docs/ja/interfaces/third-party/client-libraries.md diff --git a/docs/ja/interfaces/third-party/integrations.md b/docs/ja/interfaces/third-party/integrations.md index 74d0a51e7de..dbd0054fab3 100644 --- a/docs/ja/interfaces/third-party/integrations.md +++ b/docs/ja/interfaces/third-party/integrations.md @@ -42,7 +42,7 @@ toc_title: "\u7D71\u5408" - [グラファウス](https://github.com/yandex/graphouse) - [カーボンクリックハウス](https://github.com/lomik/carbon-clickhouse) + - [黒鉛-clickhouse](https://github.com/lomik/graphite-clickhouse) - - [graphite-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) -staledパーティションを最適化します。 [\*グラフィットマージツリー](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) からのルールの場合 [ロールアップ構成](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) 適用できます + - [graphite-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) -staledパーティションを最適化します。 [\*グラフィットマージツリー](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) からのルールの場合 [ロールアップ構成](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) 適用できます - [グラファナ](https://grafana.com/) - [クリックハウス-グラファナ](https://github.com/Vertamedia/clickhouse-grafana) - [プロメテウス](https://prometheus.io/) @@ -74,7 +74,7 @@ toc_title: "\u7D71\u5408" - [sqlalchemy-clickhouse](https://github.com/cloudflare/sqlalchemy-clickhouse) (用途 [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm)) - [パンダ](https://pandas.pydata.org) - [パンダハウス](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -82,7 +82,7 @@ toc_title: "\u7D71\u5408" - [Rクリックハウス](https://github.com/IMSMWU/RClickhouse) (用途 [クリックハウス-cpp](https://github.com/artpaul/clickhouse-cpp)) - Java - [Hadoop](http://hadoop.apache.org) - - [クリックハウス-hdfs-ローダー](https://github.com/jaykelin/clickhouse-hdfs-loader) (用途 [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [クリックハウス-hdfs-ローダー](https://github.com/jaykelin/clickhouse-hdfs-loader) (用途 [JDBC](../../sql-reference/table-functions/jdbc.md)) - Scala - [Akka](https://akka.io) - [clickhouse-scala-クライアント](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/ja/introduction/distinctive-features.md b/docs/ja/introduction/distinctive-features.md new file mode 100644 index 00000000000..5cf44ee0002 --- /dev/null +++ b/docs/ja/introduction/distinctive-features.md @@ -0,0 +1,72 @@ +--- +toc_priority: 4 +toc_title: "\u7279\u5FB4\u7684\u306A\u6A5F\u80FD" +--- + +# ClickHouseの特徴 {#clickhousenote-zheng} + +## 真の列指向DBMS {#zhen-nolie-zhi-xiang-dbms} + +真の列指向DBMSでは、値に関する余分なデータは保存されません。 これは、固定長の値がサポートされ、「データ長」が格納されないことを意味します。 例として、10億個のUInt8型の値は、圧縮されていない状態で約1 GBを消費しますが、そうしないとCPU負荷に大きく影響します。 これは、データの展開速度(CPU使用率)が、主に非圧縮データのサイズに依存するため、データを(冗長なデータが含まれないように)コンパクトに格納することが非常に重要であるためです。 + +値を列ごとに保存できるシステムは他にもありますが、それらは「分析クエリの効果的な処理」以外のシナリオに最適化されているため、ClickHouseは注目に値します。 例えば、HBase、BigTable、Cassandra、およびHyperTableなどです。これらのシステムでは、毎秒数十万行のスループットが得られますが、毎秒数億行ではありません。 + +また、ClickHouseは単一のデータベースではなく、データベース管理システムであることに注意してください。 ClickHouseを使用すると、サーバーを再構成および再起動することなく、実行時にテーブルとデータベースを作成し、データを読み込み、クエリを実行できます。 + +## データ圧縮 {#detaya-suo} + +一部の列指向DBMS(InfiniDB CEおよびMonetDB)は、データ圧縮を使用しません。ただし、優れたパフォーマンスを実現するには、データ圧縮が重要な役割を果たします。 + +## データのディスクストレージ {#detanodeisukusutorezi} + +データを主キーで物理的に並べ替えておくと、特定の値または値範囲のデータを数十ミリ秒未満の低遅延で抽出できます。一部の列指向DBMS(SAP HANAやGoogle PowerDrillなど)は、RAMでのみ機能します。このアプローチでは、リアルタイム分析を行う上で、実際に必要なハードウェアよりも規模の大きな予算の割り当てが推奨されます。 これに対しClickHouseは、通常のハードドライブで動作するように設計されています。 つまり、データストレージのGBあたりのコストは低くなり、さらに利用可能なSSDや追加のRAMがあれば、それらもフルに使用されます。 + +## マルチコアでの並列処理 {#marutikoadenobing-lie-chu-li} + +大規模なクエリは、現在のサーバーで使用可能なすべての必要なリソースを使用して、自然な方法で並列化されます。 + +## 複数のサーバーでの分散処理 {#fu-shu-nosabadenofen-san-chu-li} + +前述の列指向DBMSのほとんどは、分散クエリ処理をサポートしていません。 ClickHouseでは、データを異なるシャードに置くことができます。各シャードは、フォールトトレランスに使用されるレプリカのグループにすることができます。クエリは、すべてのシャードで並行して処理されます。これはユーザーにとって透過的です。 + +## SQLのサポート {#sqlnosapoto} + +ClickHouseは、多くの場合、標準SQLと同一のSQLに基づく宣言的なクエリ言語をサポートしています。サポートされるクエリには、GROUP BY、ORDER BYや、FROM、IN、およびJOIN句中のサブクエリ、およびスカラーサブクエリが含まれます。従属サブクエリとウィンドウ関数はサポートされていません。 + +## ベクトルエンジン {#bekutoruenzin} + +データは列ごとに格納されるだけでなく、ベクトル(列の一部)によって処理されます。これにより、高いCPU効率を実現できます。 + +## リアルタイムのデータ更新 {#riarutaimunodetageng-xin} + +ClickHouseは、主キーを持つテーブルをサポートします。 主キーの範囲でクエリをすばやく実行するために、データはマージツリーを使用して随時並べ替えられます。これにより、データを継続的にテーブルに追加できます。新しいデータが取り込まれたときにロックは取得されません。 + +## インデックス {#indetukusu} + +データを主キーで物理的に並べ替えることにより、特定の値または値範囲のデータを数十ミリ秒未満の低遅延で抽出できます。 + +## オンラインクエリとの親和性 {#onrainkueritonoqin-he-xing} + +低レイテンシであるとは、UIページの読み込み中に、事前計算を伴わないでクエリを遅延なく処理できることを意味します。これはオンラインであるとも言えます。 + +## 近似計算のサポート {#jin-si-ji-suan-nosapoto} + +ClickHouseには、精度を犠牲にしてパフォーマンスを得るための様々な方法が用意されています。 + +1. ユニーク値、中央値、および分位数を近似計算のための集計関数。 +2. データの一部(サンプル)に基づいてクエリを実行し、近似結果を取得します。この場合、ディスクから取得されるデータは近似に比例して少なくなります。 +3. すべてのキーではなく、限られた数のランダムキーに対して集計を実行します。データ内のキー分布が特定の条件下であれば、使用するリソースが少なくなり、かなり正確な結果が得られます。 + +## データのレプリケーションとデータ整合性のサポート {#detanorepurikesiyontodetazheng-he-xing-nosapoto} + +非同期マルチマスターレプリケーションを使用します。使用可能なレプリカに書き込まれた後、データはバックグラウンドで残りのすべてのレプリカに配布されます。システムは、異なるレプリカで同一のデータを維持します。ほとんどの障害後の回復は、自動的に、複雑な場合には半自動的に実行されます。 + +詳細については、[データ複製](../engines/table-engines/mergetree-family/replication.md) セクションを参照してください。 + +## 欠点と考えられるClickHouseの機能 {#qian-dian-tokao-erareruclickhousenoji-neng} + +1. 本格的なトランザクションはありません。 +2. 既に挿入されたデータの変更または削除を、高頻度かつ低遅延に行う機能はありません。 [GDPR](https://gdpr-info.eu)に準拠するなど、データをクリーンアップまたは変更するために、バッチ削除およびバッチ更新が利用可能です。 +3. インデックスが疎であるため、ClickHouseは、キーで単一行を取得するようなクエリにはあまり適していません。 + +[Original article](https://clickhouse.yandex/docs/en/introduction/distinctive_features/) diff --git a/docs/ja/introduction/distinctive_features.md b/docs/ja/introduction/distinctive_features.md deleted file mode 100644 index 5c4b91759dc..00000000000 --- a/docs/ja/introduction/distinctive_features.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -toc_priority: 4 -toc_title: 特徴的な機能 ---- - -# ClickHouseの特徴 {#clickhousenote-zheng} - -## 真の列指向DBMS {#zhen-nolie-zhi-xiang-dbms} - -真の列指向DBMSでは、値に関する余分なデータは保存されません。 これは、固定長の値がサポートされ、「データ長」が格納されないことを意味します。 例として、10億個のUInt8型の値は、圧縮されていない状態で約1 GBを消費しますが、そうしないとCPU負荷に大きく影響します。 これは、データの展開速度(CPU使用率)が、主に非圧縮データのサイズに依存するため、データを(冗長なデータが含まれないように)コンパクトに格納することが非常に重要であるためです。 - -値を列ごとに保存できるシステムは他にもありますが、それらは「分析クエリの効果的な処理」以外のシナリオに最適化されているため、ClickHouseは注目に値します。 例えば、HBase、BigTable、Cassandra、およびHyperTableなどです。これらのシステムでは、毎秒数十万行のスループットが得られますが、毎秒数億行ではありません。 - -また、ClickHouseは単一のデータベースではなく、データベース管理システムであることに注意してください。 ClickHouseを使用すると、サーバーを再構成および再起動することなく、実行時にテーブルとデータベースを作成し、データを読み込み、クエリを実行できます。 - -## データ圧縮 {#detaya-suo} - -一部の列指向DBMS(InfiniDB CEおよびMonetDB)は、データ圧縮を使用しません。ただし、優れたパフォーマンスを実現するには、データ圧縮が重要な役割を果たします。 - -## データのディスクストレージ {#detanodeisukusutorezi} - -データを主キーで物理的に並べ替えておくと、特定の値または値範囲のデータを数十ミリ秒未満の低遅延で抽出できます。一部の列指向DBMS(SAP HANAやGoogle PowerDrillなど)は、RAMでのみ機能します。このアプローチでは、リアルタイム分析を行う上で、実際に必要なハードウェアよりも規模の大きな予算の割り当てが推奨されます。 これに対しClickHouseは、通常のハードドライブで動作するように設計されています。 つまり、データストレージのGBあたりのコストは低くなり、さらに利用可能なSSDや追加のRAMがあれば、それらもフルに使用されます。 - -## マルチコアでの並列処理 {#marutikoadenobing-lie-chu-li} - -大規模なクエリは、現在のサーバーで使用可能なすべての必要なリソースを使用して、自然な方法で並列化されます。 - -## 複数のサーバーでの分散処理 {#fu-shu-nosabadenofen-san-chu-li} - -前述の列指向DBMSのほとんどは、分散クエリ処理をサポートしていません。 ClickHouseでは、データを異なるシャードに置くことができます。各シャードは、フォールトトレランスに使用されるレプリカのグループにすることができます。クエリは、すべてのシャードで並行して処理されます。これはユーザーにとって透過的です。 - -## SQLのサポート {#sqlnosapoto} - -ClickHouseは、多くの場合、標準SQLと同一のSQLに基づく宣言的なクエリ言語をサポートしています。サポートされるクエリには、GROUP BY、ORDER BYや、FROM、IN、およびJOIN句中のサブクエリ、およびスカラーサブクエリが含まれます。従属サブクエリとウィンドウ関数はサポートされていません。 - -## ベクトルエンジン {#bekutoruenzin} - -データは列ごとに格納されるだけでなく、ベクトル(列の一部)によって処理されます。これにより、高いCPU効率を実現できます。 - -## リアルタイムのデータ更新 {#riarutaimunodetageng-xin} - -ClickHouseは、主キーを持つテーブルをサポートします。 主キーの範囲でクエリをすばやく実行するために、データはマージツリーを使用して随時並べ替えられます。これにより、データを継続的にテーブルに追加できます。新しいデータが取り込まれたときにロックは取得されません。 - -## インデックス {#indetukusu} - -データを主キーで物理的に並べ替えることにより、特定の値または値範囲のデータを数十ミリ秒未満の低遅延で抽出できます。 - -## オンラインクエリとの親和性 {#onrainkueritonoqin-he-xing} - -低レイテンシであるとは、UIページの読み込み中に、事前計算を伴わないでクエリを遅延なく処理できることを意味します。これはオンラインであるとも言えます。 - -## 近似計算のサポート {#jin-si-ji-suan-nosapoto} - -ClickHouseには、精度を犠牲にしてパフォーマンスを得るための様々な方法が用意されています。 - -1. ユニーク値、中央値、および分位数を近似計算のための集計関数。 -2. データの一部(サンプル)に基づいてクエリを実行し、近似結果を取得します。この場合、ディスクから取得されるデータは近似に比例して少なくなります。 -3. すべてのキーではなく、限られた数のランダムキーに対して集計を実行します。データ内のキー分布が特定の条件下であれば、使用するリソースが少なくなり、かなり正確な結果が得られます。 - -## データのレプリケーションとデータ整合性のサポート {#detanorepurikesiyontodetazheng-he-xing-nosapoto} - -非同期マルチマスターレプリケーションを使用します。使用可能なレプリカに書き込まれた後、データはバックグラウンドで残りのすべてのレプリカに配布されます。システムは、異なるレプリカで同一のデータを維持します。ほとんどの障害後の回復は、自動的に、複雑な場合には半自動的に実行されます。 - -詳細については、[データ複製](../engines/table_engines/mergetree_family/replication.md) セクションを参照してください。 - -## 欠点と考えられるClickHouseの機能 {#qian-dian-tokao-erareruclickhousenoji-neng} - -1. 本格的なトランザクションはありません。 -2. 既に挿入されたデータの変更または削除を、高頻度かつ低遅延に行う機能はありません。 [GDPR](https://gdpr-info.eu)に準拠するなど、データをクリーンアップまたは変更するために、バッチ削除およびバッチ更新が利用可能です。 -3. インデックスが疎であるため、ClickHouseは、キーで単一行を取得するようなクエリにはあまり適していません。 - -[Original article](https://clickhouse.yandex/docs/en/introduction/distinctive_features/) diff --git a/docs/ja/introduction/history.md b/docs/ja/introduction/history.md index d804cde90c4..af5dc40145d 100644 --- a/docs/ja/introduction/history.md +++ b/docs/ja/introduction/history.md @@ -1,6 +1,6 @@ --- toc_priority: 7 -toc_title: 歴史 +toc_title: "\u6B74\u53F2" --- # ClickHouseの歴史 {#clickhousenoli-shi} diff --git a/docs/ja/introduction/performance.md b/docs/ja/introduction/performance.md index 66ff8b2f4c0..d6404853ccd 100644 --- a/docs/ja/introduction/performance.md +++ b/docs/ja/introduction/performance.md @@ -1,6 +1,6 @@ --- toc_priority: 6 -toc_title: パフォーマンス +toc_title: "\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9" --- # パフォーマンス {#pahuomansu} diff --git a/docs/ja/operations/access-rights.md b/docs/ja/operations/access-rights.md new file mode 100644 index 00000000000..1c384f14f5d --- /dev/null +++ b/docs/ja/operations/access-rights.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 48 +toc_title: "\u30A2\u30AF\u30BB\u30B9\u6A29" +--- + +# アクセス権 {#access-rights} + +ユーザーとアクセス権は、ユーザー設定で設定されます。 これは通常 `users.xml`. + +ユーザーは `users` セクション。 ここでの断片です `users.xml` ファイル: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + + test + + + +``` + +する宣言からユーザー: `default`と`web`. 私達は加えました `web` ユーザー別途。 + +その `default` ユーザは、ユーザ名が渡されない場合に選択されます。 その `default` userは、サーバーまたはクラスターの構成が指定されていない場合は、分散クエリ処理にも使用されます。 `user` と `password` (上のセクションを参照 [分散](../engines/table-engines/special/distributed.md) エンジン)。 + +The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. + +パスワードは、クリアテキスト(非推奨)またはsha-256で指定します。 ハッシュは塩漬けじゃない この点に関し、すべきではないと考えるこれらのパスワードとして提供すことに対する潜在的悪意のある攻撃であった。 むしろ、従業員からの保護のために必要です。 + +アクセスを許可するネットワークのリストが指定されています。 この例では、両方のユーザーのネットワークの一覧が別のファイルから読み込まれます (`/etc/metrika.xml`)を含む `networks` 置換。 ここにそれの断片があります: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +このネットワークのリストを直接 `users.xml` またはファイル内の `users.d` ディレクトリ(詳細については、セクションを参照 “[設定ファイル](configuration-files.md#configuration_files)”). + +コンフィグを含むコメントする方法を説明するオープンアクセスいたしました。 + +生産の使用のために、指定して下さいただ `ip` 要素(IPアドレスとそのマスク)、 `host` と `hoost_regexp` が原因別の待ち時間をゼロにすることに + +次のユーザー設定プロファイルが指定の項を参照 “[設定プロファイル](settings/settings-profiles.md)”. 既定のプロファイルを指定できます, `default'`. プロファイルの名前は任意です。 異なるユーザーに同じプロファイルを指定できます。 最も重要なことが書ける設定プロフィール `readonly=1` 読み取り専用アクセスを保証します。 次に、使用するクォータを指定します(セクションを参照 “[クォータ](quotas.md#quotas)”). 既定のクォータを指定できます: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. + +オプションで `` 部を指定することもできますリストのデータベースのユーザーがアクセスできる デフォルトでは、すべてのデータベースのユーザーです。 を指定することができ `default` データベース この場合、ユーザーはデフォルトでデータベースにアクセスできます。 + +オプションで `` また、ユーザーがアクセスできる辞書のリストを指定することもできます。 デフォルトでは、すべての辞書はユーザーが使用できます。 + +へのアクセス `system` データベースは常に可(このデータベースを使用して処理クエリ). + +ユーザーの一覧を取得してデータベースやテーブルを用いてこれら `SHOW` クエリやシステムテーブルの場合でも、アクセス、個人データベースなのです。 + +データベースアクセスは、 [読み取り専用](settings/permissions-for-queries.md#settings_readonly) 設定。 できな助成金の全アクセスをデータベース `readonly` 別のものへのアクセス。 + +[元の記事](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/ja/operations/access_rights.md b/docs/ja/operations/access_rights.md deleted file mode 100644 index 03948996744..00000000000 --- a/docs/ja/operations/access_rights.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 48 -toc_title: "\u30A2\u30AF\u30BB\u30B9\u6A29" ---- - -# アクセス権 {#access-rights} - -ユーザーとアクセス権は、ユーザー設定で設定されます。 これは通常 `users.xml`. - -ユーザーは `users` セクション。 ここでの断片です `users.xml` ファイル: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - - test - - - -``` - -する宣言からユーザー: `default`と`web`. 私達は加えました `web` ユーザー別途。 - -その `default` ユーザは、ユーザ名が渡されない場合に選択されます。 その `default` userは、サーバーまたはクラスターの構成が指定されていない場合は、分散クエリ処理にも使用されます。 `user` と `password` (上のセクションを参照 [分散](../engines/table_engines/special/distributed.md) エンジン)。 - -The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. - -パスワードは、クリアテキスト(非推奨)またはsha-256で指定します。 ハッシュは塩漬けじゃない この点に関し、すべきではないと考えるこれらのパスワードとして提供すことに対する潜在的悪意のある攻撃であった。 むしろ、従業員からの保護のために必要です。 - -アクセスを許可するネットワークのリストが指定されています。 この例では、両方のユーザーのネットワークの一覧が別のファイルから読み込まれます (`/etc/metrika.xml`)を含む `networks` 置換。 ここにそれの断片があります: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -このネットワークのリストを直接 `users.xml` またはファイル内の `users.d` ディレクトリ(詳細については、セクションを参照 “[設定ファイル](configuration_files.md#configuration_files)”). - -コンフィグを含むコメントする方法を説明するオープンアクセスいたしました。 - -生産の使用のために、指定して下さいただ `ip` 要素(IPアドレスとそのマスク)、 `host` と `hoost_regexp` が原因別の待ち時間をゼロにすることに - -次のユーザー設定プロファイルが指定の項を参照 “[設定プロファイル](settings/settings_profiles.md)”. 既定のプロファイルを指定できます, `default'`. プロファイルの名前は任意です。 異なるユーザーに同じプロファイルを指定できます。 最も重要なことが書ける設定プロフィール `readonly=1` 読み取り専用アクセスを保証します。 次に、使用するクォータを指定します(セクションを参照 “[クォータ](quotas.md#quotas)”). 既定のクォータを指定できます: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. - -オプションで `` 部を指定することもできますリストのデータベースのユーザーがアクセスできる デフォルトでは、すべてのデータベースのユーザーです。 を指定することができ `default` データベース この場合、ユーザーはデフォルトでデータベースにアクセスできます。 - -オプションで `` また、ユーザーがアクセスできる辞書のリストを指定することもできます。 デフォルトでは、すべての辞書はユーザーが使用できます。 - -へのアクセス `system` データベースは常に可(このデータベースを使用して処理クエリ). - -ユーザーの一覧を取得してデータベースやテーブルを用いてこれら `SHOW` クエリやシステムテーブルの場合でも、アクセス、個人データベースなのです。 - -データベースアクセスは、 [読み取り専用](settings/permissions_for_queries.md#settings_readonly) 設定。 できな助成金の全アクセスをデータベース `readonly` 別のものへのアクセス。 - -[元の記事](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/ja/operations/backup.md b/docs/ja/operations/backup.md index c8166bbf3e6..799b377f3f3 100644 --- a/docs/ja/operations/backup.md +++ b/docs/ja/operations/backup.md @@ -7,7 +7,7 @@ toc_title: "\u30C7\u30FC\u30BF\u30D0\u30C3\u30AF" # データバック {#data-backup} -しばらく [複製](../engines/table_engines/mergetree_family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [50Gbを超えるデータを含むMergeTreeのようなエンジンでテーブルを削除することはできません](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). しかし、これらの保障措置がカバーしないすべてのケースで回避. +しばらく [複製](../engines/table-engines/mergetree-family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [50Gbを超えるデータを含むMergeTreeのようなエンジンでテーブルを削除することはできません](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). しかし、これらの保障措置がカバーしないすべてのケースで回避. 人為的なミスを効果的に軽減するには、データのバックアップと復元に関する戦略を慎重に準備する必要があります **事前に**. @@ -22,7 +22,7 @@ toc_title: "\u30C7\u30FC\u30BF\u30D0\u30C3\u30AF" ## ファイル {#filesystem-snapshots} -一部地域のファイルシステムをスナップショット機能(例えば, [ZFS](https://en.wikipedia.org/wiki/ZFS)ものではないのでいただける住ます。 可能な解決策は、この種のファイルシステムを使用して追加のレプリカを作成し、それらを [分散](../engines/table_engines/special/distributed.md) 使用されるテーブル `SELECT` クエリ。 スナップショットなどを複製するものでなければならないのクエリがデータを変更する. ボーナスパーツとして、これらのレプリカが特別なハードウェア構成によりディスクに付属のサーバ、コスト効果的です。 +一部地域のファイルシステムをスナップショット機能(例えば, [ZFS](https://en.wikipedia.org/wiki/ZFS)ものではないのでいただける住ます。 可能な解決策は、この種のファイルシステムを使用して追加のレプリカを作成し、それらを [分散](../engines/table-engines/special/distributed.md) 使用されるテーブル `SELECT` クエリ。 スナップショットなどを複製するものでなければならないのクエリがデータを変更する. ボーナスパーツとして、これらのレプリカが特別なハードウェア構成によりディスクに付属のサーバ、コスト効果的です。 ## クリックハウスコピー機 {#clickhouse-copier} @@ -34,7 +34,7 @@ toc_title: "\u30C7\u30FC\u30BF\u30D0\u30C3\u30AF" ClickHouseは使用を可能にします `ALTER TABLE ... FREEZE PARTITION ...` クエリをコピーのテーブル割. これは、ハードリンクを使用して実装されます `/var/lib/clickhouse/shadow/` フォルダで、通常は消費するエディスクスペースのための古いデータです。 作成されたファイルのコピーはClickHouseサーバーによって処理されないので、そこに残すことができます:追加の外部システムを必要としない単純なバックア このため、リモートで別の場所にコピーしてからローカルコピーを削除する方がよいでしょう。 分散ファイルシステムとオブジェクトストアはまだこのための良いオプションですが、十分な大きさの容量を持つ通常の添付ファイルサーバは、同 [rsync](https://en.wikipedia.org/wiki/Rsync)). -パーティション操作に関連するクエリの詳細については、 [変更文書](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +パーティション操作に関連するクエリの詳細については、 [変更文書](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). 第三者ツールを自動化するこのアプローチ: [clickhouse-バックアップ](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/ja/operations/configuration-files.md b/docs/ja/operations/configuration-files.md new file mode 100644 index 00000000000..c7a4b5ed8fb --- /dev/null +++ b/docs/ja/operations/configuration-files.md @@ -0,0 +1,57 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 50 +toc_title: "\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB" +--- + +# 設定ファイル {#configuration_files} + +ClickHouseは複数ファイル構成管理をサポートしています。 主サーバ設定ファイルで指定することがで `/etc/clickhouse-server/config.xml`. その他のファイルは `/etc/clickhouse-server/config.d` ディレクトリ。 + +!!! note "メモ" + すべての設定ファイルはxml形式である必要があります。 また、通常は同じルート要素を持つ必要があります ``. + +メイン構成ファイルで指定された一部の設定は、他の構成ファイルで上書きできます。 その `replace` または `remove` 属性は、これらの構成ファイルの要素に対して指定できます。 + +どちらも指定されていない場合は、重複する子の値を置き換えて、要素の内容を再帰的に結合します。 + +もし `replace` 指定された要素全体を指定された要素で置き換えます。 + +もし `remove` 指定した要素を削除します。 + +設定はまた定義できます “substitutions”. 要素が持っている場合 `incl` 属性は、ファイルから対応する置換は、値として使用されます。 デフォルトでは、置換を含むファイルへのパスは、 `/etc/metrika.xml`. これはで変えることができます [include\_from](server-configuration-parameters/settings.md#server_configuration_parameters-include_from) サーバー設定の要素。 置換値は、以下で指定されます `/yandex/substitution_name` このファイルの要素。 で指定された置換の場合 `incl` 存在しない、それはログに記録されます。 防ClickHouseからログイン失、置換、指定し `optional="true"` 属性(たとえば、 [マクロ](server-configuration-parameters/settings.md)). + +置換はまた、飼育係から行うことができます。 これを行うには、属性を指定します `from_zk = "/path/to/node"`. 要素の値は、次の場所にあるノードの内容に置き換えられます `/path/to/node` 飼育係で また、Xmlサブツリー全体をZooKeeperノードに置くこともでき、ソース要素に完全に挿入されます。 + +その `config.xml` ファイルを指定することで別のconfigユーザー設定、プロファイルに割り振ります。 この設定への相対パスは `users_config` 要素。 デフォルトでは、 `users.xml`. もし `users_config` ユーザー設定、プロファイル、およびクォータは、次の場所で直接指定されます `config.xml`. + +ユーザー構成は、次のような別々のファイルに分割できます `config.xml` と `config.d/`. +ディレクトリ名は、 `users_config` 設定なし `.xml` 後置は `.d`. +ディレク `users.d` デフォルトでは、 `users_config` デフォルトは `users.xml`. +たとえば、次のようにユーザーごとに別々の設定ファイルを作成できます: + +``` bash +$ cat /etc/clickhouse-server/users.d/alice.xml +``` + +``` xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +各設定ファイルについて、サーバーも生成します `file-preprocessed.xml` 起動時のファイル。 これらのファイルには、完了した置換と上書きがすべて含まれており、情報の使用を目的としています。 ZooKeeperの置換が設定ファイルで使用されたが、ZooKeeperがサーバーの起動時に利用できない場合、サーバーは前処理されたファイルから設定をロードします。 + +サーバーは、設定ファイルの変更を追跡するだけでなく、置換と上書きを実行するときに使用されたファイルとzookeeperノード、およびその場でユーザーとクラスタ つまり、サーバーを再起動することなく、クラスター、ユーザー、およびその設定を変更できます。 + +[元の記事](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/ja/operations/configuration_files.md b/docs/ja/operations/configuration_files.md deleted file mode 100644 index 6f84bd36d8f..00000000000 --- a/docs/ja/operations/configuration_files.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 50 -toc_title: "\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB" ---- - -# 設定ファイル {#configuration_files} - -ClickHouseは複数ファイル構成管理をサポートしています。 主サーバ設定ファイルで指定することがで `/etc/clickhouse-server/config.xml`. その他のファイルは `/etc/clickhouse-server/config.d` ディレクトリ。 - -!!! note "メモ" - すべての設定ファイルはxml形式である必要があります。 また、通常は同じルート要素を持つ必要があります ``. - -メイン構成ファイルで指定された一部の設定は、他の構成ファイルで上書きできます。 その `replace` または `remove` 属性は、これらの構成ファイルの要素に対して指定できます。 - -どちらも指定されていない場合は、重複する子の値を置き換えて、要素の内容を再帰的に結合します。 - -もし `replace` 指定された要素全体を指定された要素で置き換えます。 - -もし `remove` 指定した要素を削除します。 - -設定はまた定義できます “substitutions”. 要素が持っている場合 `incl` 属性は、ファイルから対応する置換は、値として使用されます。 デフォルトでは、置換を含むファイルへのパスは、 `/etc/metrika.xml`. これはで変えることができます [include\_from](server_configuration_parameters/settings.md#server_configuration_parameters-include_from) サーバー設定の要素。 置換値は、以下で指定されます `/yandex/substitution_name` このファイルの要素。 で指定された置換の場合 `incl` 存在しない、それはログに記録されます。 防ClickHouseからログイン失、置換、指定し `optional="true"` 属性(たとえば、 [マクロ](server_configuration_parameters/settings.md)). - -置換はまた、飼育係から行うことができます。 これを行うには、属性を指定します `from_zk = "/path/to/node"`. 要素の値は、次の場所にあるノードの内容に置き換えられます `/path/to/node` 飼育係で また、Xmlサブツリー全体をZooKeeperノードに置くこともでき、ソース要素に完全に挿入されます。 - -その `config.xml` ファイルを指定することで別のconfigユーザー設定、プロファイルに割り振ります。 この設定への相対パスは `users_config` 要素。 デフォルトでは、 `users.xml`. もし `users_config` ユーザー設定、プロファイル、およびクォータは、次の場所で直接指定されます `config.xml`. - -ユーザー構成は、次のような別々のファイルに分割できます `config.xml` と `config.d/`. -ディレクトリ名は、 `users_config` 設定なし `.xml` 後置は `.d`. -ディレク `users.d` デフォルトでは、 `users_config` デフォルトは `users.xml`. -たとえば、次のようにユーザーごとに別々の設定ファイルを作成できます: - -``` bash -$ cat /etc/clickhouse-server/users.d/alice.xml -``` - -``` xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -各設定ファイルについて、サーバーも生成します `file-preprocessed.xml` 起動時のファイル。 これらのファイルには、完了した置換と上書きがすべて含まれており、情報の使用を目的としています。 ZooKeeperの置換が設定ファイルで使用されたが、ZooKeeperがサーバーの起動時に利用できない場合、サーバーは前処理されたファイルから設定をロードします。 - -サーバーは、設定ファイルの変更を追跡するだけでなく、置換と上書きを実行するときに使用されたファイルとzookeeperノード、およびその場でユーザーとクラスタ つまり、サーバーを再起動することなく、クラスター、ユーザー、およびその設定を変更できます。 - -[元の記事](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/ja/operations/index.md b/docs/ja/operations/index.md index a25660e79a3..dc634fdcc8e 100644 --- a/docs/ja/operations/index.md +++ b/docs/ja/operations/index.md @@ -15,13 +15,13 @@ ClickHouse操作マニュアルの以下の主要部: - [トラブル](troubleshooting.md) - [使用の推奨事項](tips.md) - [更新手順](update.md) -- [アクセス権](access_rights.md) +- [アクセス権](access-rights.md) - [データバック](backup.md) -- [設定ファイル](configuration_files.md) +- [設定ファイル](configuration-files.md) - [クォータ](quotas.md) -- [システム表](system_tables.md) -- [サーバ設定パラメータ](server_configuration_parameters/index.md) -- [ClickHouseでハードウェアをテストする方法](performance_test.md) +- [システム表](system-tables.md) +- [サーバ設定パラメータ](server-configuration-parameters/index.md) +- [ClickHouseでハードウェアをテストする方法](performance-test.md) - [設定](settings/index.md) - [ユーティリ](utilities/index.md) diff --git a/docs/ja/operations/monitoring.md b/docs/ja/operations/monitoring.md index 9173bffd48f..99e63505a42 100644 --- a/docs/ja/operations/monitoring.md +++ b/docs/ja/operations/monitoring.md @@ -28,16 +28,16 @@ ClickHouseは、ハードウェアリソースの状態を単独で監視しま ClickHouseサーバーは自己状態の監視のための器械を埋め込んだ。 -追跡サーバのイベントサーバーを利用ます。 を見る [ロガー](server_configuration_parameters/settings.md#server_configuration_parameters-logger) 設定ファイルのセクション。 +追跡サーバのイベントサーバーを利用ます。 を見る [ロガー](server-configuration-parameters/settings.md#server_configuration_parameters-logger) 設定ファイルのセクション。 ClickHouseの収集: - 異なるメトリクスのサーバがどのように利用計算資源です。 - クエリ処理に関する一般的な統計。 -メトリックは次の場所にあります [システム。指標](../operations/system_tables.md#system_tables-metrics), [システム。イベント](../operations/system_tables.md#system_tables-events)、と [システム。asynchronous\_metrics](../operations/system_tables.md#system_tables-asynchronous_metrics) テーブル。 +メトリックは次の場所にあります [システム。指標](../operations/system-tables.md#system_tables-metrics), [システム。イベント](../operations/system-tables.md#system_tables-events)、と [システム。asynchronous\_metrics](../operations/system-tables.md#system_tables-asynchronous_metrics) テーブル。 -を設定することができclickhouse輸出の指標に [黒鉛](https://github.com/graphite-project). を見る [グラファイト部](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) クリックハウスサーバー設定ファイルで。 を設定する前に輸出のメトリックトに設定する必要があります黒鉛は以下の公式 [ガイド](https://graphite.readthedocs.io/en/latest/install.html). +を設定することができclickhouse輸出の指標に [黒鉛](https://github.com/graphite-project). を見る [グラファイト部](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) クリックハウスサーバー設定ファイルで。 を設定する前に輸出のメトリックトに設定する必要があります黒鉛は以下の公式 [ガイド](https://graphite.readthedocs.io/en/latest/install.html). さらに、http apiを使用してサーバーの可用性を監視できます。 を送信 `HTTP GET` への要求 `/ping`. サーバーが使用可能な場合は、次のように応答します `200 OK`. diff --git a/docs/ja/operations/optimizing_performance/index.md b/docs/ja/operations/optimizing-performance/index.md similarity index 100% rename from docs/ja/operations/optimizing_performance/index.md rename to docs/ja/operations/optimizing-performance/index.md diff --git a/docs/ja/operations/optimizing-performance/sampling-query-profiler.md b/docs/ja/operations/optimizing-performance/sampling-query-profiler.md new file mode 100644 index 00000000000..2610237cbd0 --- /dev/null +++ b/docs/ja/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: "Query\u30D7\u30ED\u30D5\u30A1\u30A4\u30EA\u30F3\u30B0" +--- + +# クエリプ {#sampling-query-profiler} + +ClickHouse運転サンプリングプロファイラでの分析クエリを実行します。 使用プロファイラでソースコードのルーチンを用いた最中に頻繁にクエリを実行します。 CPU時間とアイドル時間を含む壁時計の時間をトレースできます。 + +プロファイラを使用する: + +- この [trace\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) サーバー設定のセクション。 + + このセクションでは、 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) プロファイラーの機能の結果を含むシステムテーブル。 デフォルトで設定されています。 このデータをこのテーブルのみ有効なオペレーティングシステムサーバーです。 後、サーバを再起動ClickHouseないクリーンのテーブルに格納された仮想メモリアドレスが無効になります。 + +- この [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) または [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) 設定。 両方の設定を同時に使用できます。 + + これらの設定を許可する設定プロファイラータイマー. これらはセッション設定であるため、サーバー全体、個々のユーザーまたはユーザープロファイル、対話型セッション、および個々のクエリごとに異なるサンプリング + +デフォルトのサンプリング周波数はサンプルや、cpu、リアルタイマーが有効になっています。 この周波数により収集に関する情報を十分にclickhouse。 同時に、この頻度で作業しても、プロファイラーはclickhouseサーバーのパフォーマンスに影響しません。 が必要な場合にプロファイル毎に個別のクエリを利用するようにして高サンプリング周波数です。 + +分析するため `trace_log` システム表: + +- インストール `clickhouse-common-static-dbg` パッケージ。 見る [DEBパッケージからのイ](../../getting-started/install.md#install-from-deb-packages). + +- によってイントロスペクション機能を許可する [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) 設定。 + + セキュ + +- を使用 `addressToLine`, `addressToSymbol` と `demangle` [イントロスペクション関数](../../sql-reference/functions/introspection.md) ClickHouseコードで関数名とその位置を取得する。 いくつかのクエリのプロファイルを取得するには、 `trace_log` テーブル。 個々の関数またはスタックトレース全体でデータを集計できます。 + +あなたが視覚化する必要がある場合 `trace_log` 情報、試してみる [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) と [speedscope](https://github.com/laplab/clickhouse-speedscope). + +## 例えば {#example} + +この例では、: + +- フィルタ `trace_log` クエリ識別子と現在の日付によるデータ。 + +- スタックトレースによる集計。 + +- イントロスペクション関数を使用して、我々のレポートを取得します: + + - シンボルおよび対応するソースコード関数の名前。 + - これらの関数のソースコードの場所。 + + + +``` sql +SELECT + count(), + arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym +FROM system.trace_log +WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) +GROUP BY trace +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +{% include "examples/sampling_query_profiler_result.txt" %} +``` diff --git a/docs/ja/operations/optimizing_performance/sampling_query_profiler.md b/docs/ja/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 100644 index 99c1007fde9..00000000000 --- a/docs/ja/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: "Query\u30D7\u30ED\u30D5\u30A1\u30A4\u30EA\u30F3\u30B0" ---- - -# クエリプ {#sampling-query-profiler} - -ClickHouse運転サンプリングプロファイラでの分析クエリを実行します。 使用プロファイラでソースコードのルーチンを用いた最中に頻繁にクエリを実行します。 CPU時間とアイドル時間を含む壁時計の時間をトレースできます。 - -プロファイラを使用する: - -- この [trace\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) サーバー設定のセクション。 - - このセクションでは、 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) プロファイラーの機能の結果を含むシステムテーブル。 デフォルトで設定されています。 このデータをこのテーブルのみ有効なオペレーティングシステムサーバーです。 後、サーバを再起動ClickHouseないクリーンのテーブルに格納された仮想メモリアドレスが無効になります。 - -- この [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) または [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) 設定。 両方の設定を同時に使用できます。 - - これらの設定を許可する設定プロファイラータイマー. これらはセッション設定であるため、サーバー全体、個々のユーザーまたはユーザープロファイル、対話型セッション、および個々のクエリごとに異なるサンプリング - -デフォルトのサンプリング周波数はサンプルや、cpu、リアルタイマーが有効になっています。 この周波数により収集に関する情報を十分にclickhouse。 同時に、この頻度で作業しても、プロファイラーはclickhouseサーバーのパフォーマンスに影響しません。 が必要な場合にプロファイル毎に個別のクエリを利用するようにして高サンプリング周波数です。 - -分析するため `trace_log` システム表: - -- インストール `clickhouse-common-static-dbg` パッケージ。 見る [DEBパッケージからのイ](../../getting_started/install.md#install-from-deb-packages). - -- によってイントロスペクション機能を許可する [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) 設定。 - - セキュ - -- を使用 `addressToLine`, `addressToSymbol` と `demangle` [イントロスペクション関数](../../sql_reference/functions/introspection.md) ClickHouseコードで関数名とその位置を取得する。 いくつかのクエリのプロファイルを取得するには、 `trace_log` テーブル。 個々の関数またはスタックトレース全体でデータを集計できます。 - -あなたが視覚化する必要がある場合 `trace_log` 情報、試してみる [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) と [speedscope](https://github.com/laplab/clickhouse-speedscope). - -## 例えば {#example} - -この例では、: - -- フィルタ `trace_log` クエリ識別子と現在の日付によるデータ。 - -- スタックトレースによる集計。 - -- イントロスペクション関数を使用して、我々のレポートを取得します: - - - シンボルおよび対応するソースコード関数の名前。 - - これらの関数のソースコードの場所。 - - - -``` sql -SELECT - count(), - arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym -FROM system.trace_log -WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) -GROUP BY trace -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -{% include "examples/sampling_query_profiler_result.txt" %} -``` diff --git a/docs/ja/operations/performance-test.md b/docs/ja/operations/performance-test.md new file mode 100644 index 00000000000..f4ecddc217b --- /dev/null +++ b/docs/ja/operations/performance-test.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: "\u30CF\u30FC\u30C9\u30A6\u30A7\u30A2\u8A66\u9A13" +--- + +# ClickHouseでハードウェアをテストする方法 {#how-to-test-your-hardware-with-clickhouse} + +この命令を実行できますが基本的なclickhouse性能試験はサーバーなしでの設置clickhouseパッケージ。 + +1. に行く “commits” ページ:https://github.com/ClickHouse/ClickHouse/commits/master + +2. 最初の緑色のチェックマークまたは緑色の赤い十字をクリックします “ClickHouse Build Check” とをクリック “Details” リンク近く “ClickHouse Build Check”. + +3. リンクをコピーする “clickhouse” amd64またはaarch64のバイナリ。 + +4. サーバーにsshを実行し、wgetでダウンロードします: + + + + # For amd64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse + # For aarch64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse + # Then do: + chmod a+x clickhouse + +1. ダウンロードconfigs: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml + mkdir config.d + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml + +1. Benchmarkファイル: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh + chmod a+x benchmark-new.sh + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql + +1. ダウンロード試験データによると [Yandexの。Metricaデータセット](../getting-started/example-datasets/metrica.md) 指示 (“hits” 100万行を含むテーブル)。 + + + + wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz + tar xvf hits_100m_obfuscated_v1.tar.xz -C . + mv hits_100m_obfuscated_v1/* . + +1. サーバーの実行: + + + + ./clickhouse server + +1. データを確認する:別のターミナルのサーバーへのssh + + + + ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" + 100000000 + +1. 編集するbenchmark-new.sh,変更 “clickhouse-client” に “./clickhouse client” と追加 “–max\_memory\_usage 100000000000” パラメータ。 + + + + mcedit benchmark-new.sh + +1. ベンチマークの実行: + + + + ./benchmark-new.sh hits_100m_obfuscated + +1. ハードウェア構成に関する番号と情報を以下に送信しますclickhouse-feedback@yandex-team.com + +すべての結果はここに掲載されています:https://clickhouse。ツつィツ姪“ツつ”ツ債ツづュツつケhtml diff --git a/docs/ja/operations/performance_test.md b/docs/ja/operations/performance_test.md deleted file mode 100644 index e58aec13b4f..00000000000 --- a/docs/ja/operations/performance_test.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: "\u30CF\u30FC\u30C9\u30A6\u30A7\u30A2\u8A66\u9A13" ---- - -# ClickHouseでハードウェアをテストする方法 {#how-to-test-your-hardware-with-clickhouse} - -この命令を実行できますが基本的なclickhouse性能試験はサーバーなしでの設置clickhouseパッケージ。 - -1. に行く “commits” ページ:https://github.com/ClickHouse/ClickHouse/commits/master - -2. 最初の緑色のチェックマークまたは緑色の赤い十字をクリックします “ClickHouse Build Check” とをクリック “Details” リンク近く “ClickHouse Build Check”. - -3. リンクをコピーする “clickhouse” amd64またはaarch64のバイナリ。 - -4. サーバーにsshを実行し、wgetでダウンロードします: - - - - # For amd64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse - # For aarch64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse - # Then do: - chmod a+x clickhouse - -1. ダウンロードconfigs: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml - mkdir config.d - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml - -1. Benchmarkファイル: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh - chmod a+x benchmark-new.sh - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql - -1. ダウンロード試験データによると [Yandexの。Metricaデータセット](../getting_started/example_datasets/metrica.md) 指示 (“hits” 100万行を含むテーブル)。 - - - - wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz - tar xvf hits_100m_obfuscated_v1.tar.xz -C . - mv hits_100m_obfuscated_v1/* . - -1. サーバーの実行: - - - - ./clickhouse server - -1. データを確認する:別のターミナルのサーバーへのssh - - - - ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" - 100000000 - -1. 編集するbenchmark-new.sh,変更 “clickhouse-client” に “./clickhouse client” と追加 “–max\_memory\_usage 100000000000” パラメータ。 - - - - mcedit benchmark-new.sh - -1. ベンチマークの実行: - - - - ./benchmark-new.sh hits_100m_obfuscated - -1. ハードウェア構成に関する番号と情報を以下に送信しますclickhouse-feedback@yandex-team.com - -すべての結果はここに掲載されています:https://clickhouse。ツつィツ姪"ツつ"ツ債ツづュツつケhtml diff --git a/docs/ja/operations/requirements.md b/docs/ja/operations/requirements.md index 28a2308ab5f..ac7c35e2dea 100644 --- a/docs/ja/operations/requirements.md +++ b/docs/ja/operations/requirements.md @@ -24,9 +24,9 @@ ClickHouseは、並列処理を実装し、利用可能なすべてのハード - クエリの複雑さ。 - クエリで処理されるデータの量。 -計算に必要な量のram、推定値のサイズを一時的にデータのための [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) そしてあなたが使用する他の操作。 +計算に必要な量のram、推定値のサイズを一時的にデータのための [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) そしてあなたが使用する他の操作。 -ClickHouseは、一時的なデータに外部メモリを使用できます。 見る [外部メモリによるグループ化](../sql_reference/statements/select.md#select-group-by-in-external-memory) 詳細については。 +ClickHouseは、一時的なデータに外部メモリを使用できます。 見る [外部メモリによるグループ化](../sql-reference/statements/select.md#select-group-by-in-external-memory) 詳細については。 ## Swapファイル {#swap-file} @@ -58,4 +58,4 @@ ClickHouseをインストールするには2GBの空きディスク容量が必 ClickHouseが開発されたLinuxの家族システムです。 推奨されるLinuxの配布はUbuntuです。 その `tzdata` パッケージを設置する必要がある。 -ClickHouse働きかけることができ、その他業務システム。 の詳細を参照してください [はじめに](../getting_started/index.md) ドキュメントのセクション。 +ClickHouse働きかけることができ、その他業務システム。 の詳細を参照してください [はじめに](../getting-started/index.md) ドキュメントのセクション。 diff --git a/docs/ja/operations/server-configuration-parameters/index.md b/docs/ja/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..1b16e96c288 --- /dev/null +++ b/docs/ja/operations/server-configuration-parameters/index.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Server Configuration Parameters +toc_priority: 54 +toc_title: "\u5C0E\u5165" +--- + +# サーバ設定パラメータ {#server-settings} + +ここでの記述が含まれてサーバーの設定を変更することはできないのセッションor検索。 + +これらの設定は `config.xml` ClickHouseサーバー上のファイル。 + +その他の設定については、 “[設定](../settings/index.md#settings)” セクション。 + +設定を勉強する前に、 [設定ファイル](../configuration-files.md#configuration_files) の使用に注意してください。 `incl` と `optional` 属性)。 + +[元の記事](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/ja/operations/server-configuration-parameters/settings.md b/docs/ja/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..3af362aef52 --- /dev/null +++ b/docs/ja/operations/server-configuration-parameters/settings.md @@ -0,0 +1,872 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 57 +toc_title: "\u30B5\u30FC\u30D0\u30FC\u8A2D\u5B9A" +--- + +# サーバー設定 {#server-settings} + +## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} + +組み込みの辞書を再ロードする前の秒単位の間隔。 + +クリックハウスは、内蔵の辞書ごとにx秒をリロードします。 これにより、辞書の編集が可能になります “on the fly” サーバーを再起動せずに。 + +デフォルト値:3600. + +**例えば** + +``` xml +3600 +``` + +## 圧縮 {#server-settings-compression} + +以下のためのデータ圧縮設定 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-エンジンテーブル。 + +!!! warning "警告" + ClickHouseを使用し始めたばかりの場合は使用しないでください。 + +構成テンプレート: + +``` xml + + + ... + ... + ... + + ... + +``` + +`` フィールド: + +- `min_part_size` – The minimum size of a data part. +- `min_part_size_ratio` – The ratio of the data part size to the table size. +- `method` – Compression method. Acceptable values: `lz4` または `zstd`. + +複数を設定できます `` セクション。 + +条件が満たされたときの動作: + +- データパーツが条件セットと一致する場合、clickhouseは指定された圧縮方法を使用します。 +- データパートが複数の条件セットと一致する場合、clickhouseは最初に一致した条件セットを使用します。 + +デー `lz4` 圧縮。 + +**例えば** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## default\_database {#default-database} + +既定のデータベース。 + +データベースのリストを取得するには、 [SHOW DATABASES](../../sql-reference/statements/show.md#show-databases) クエリ。 + +**例えば** + +``` xml +default +``` + +## default\_profile {#default-profile} + +既定の設定プロファイル。 + +設定プロファイルはパラ `user_config`. + +**例えば** + +``` xml +default +``` + +## dictionaries\_config {#server_configuration_parameters-dictionaries_config} + +外部ディクショナリの設定ファイルへのパス。 + +パス: + +- サーバー設定ファイルに対する絶対パスまたは相対パスを指定します。 +- のパスを含むことができワイルドカード\*や?. + +また見なさい “[外部辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)”. + +**例えば** + +``` xml +*_dictionary.xml +``` + +## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} + +辞書の遅延ロード。 + +もし `true` その後、各辞書は最初の使用時に作成されます。 辞書の作成に失敗した場合、辞書を使用していた関数は例外をスローします。 + +もし `false` すべての辞書は、サーバーの起動時に作成され、エラーが発生した場合、サーバーはシャットダウンされます。 + +デフォルトは `true`. + +**例えば** + +``` xml +true +``` + +## format\_schema\_path {#server_configuration_parameters-format_schema_path} + +入力データのスキームを持つディレクトリへのパス。 [CapnProto](../../interfaces/formats.md#capnproto) フォーマット。 + +**例えば** + +``` xml + + format_schemas/ +``` + +## 黒鉛 {#server_configuration_parameters-graphite} + +データの送信先 [黒鉛](https://github.com/graphite-project). + +設定: + +- host – The Graphite server. +- port – The port on the Graphite server. +- interval – The interval for sending, in seconds. +- timeout – The timeout for sending data, in seconds. +- root\_path – Prefix for keys. +- metrics – Sending data from the [システム。指標](../../operations/system-tables.md#system_tables-metrics) テーブル。 +- events – Sending deltas data accumulated for the time period from the [システム。イベント](../../operations/system-tables.md#system_tables-events) テーブル。 +- events\_cumulative – Sending cumulative data from the [システム。イベント](../../operations/system-tables.md#system_tables-events) テーブル。 +- asynchronous\_metrics – Sending data from the [システム。asynchronous\_metrics](../../operations/system-tables.md#system_tables-asynchronous_metrics) テーブル。 + +複数を設定できます `` 句。 たとえば、異なる間隔で異なるデータを送信するためにこれを使用できます。 + +**例えば** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## graphite\_rollup {#server_configuration_parameters-graphite-rollup} + +グラファイトの間引きデータの設定。 + +詳細については、 [グラフィットメールグツリー](../../engines/table-engines/mergetree-family/graphitemergetree.md). + +**例えば** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## http\_port/https\_port {#http-porthttps-port} + +HTTP経由でサーバーに接続するためのポート。 + +もし `https_port` が指定される。, [openSSL](#server_configuration_parameters-openssl) 構成する必要があります。 + +もし `http_port` が指定されている場合、OpenSSL設定が設定されていても、その設定は無視される。 + +**例えば** + +``` xml +0000 +``` + +## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} + +ClickHouse HTTP(s)サーバーにアクセスするときにデフォルトで表示されるページ。 +デフォルト値は “Ok.” (最後にラインフィード付き) + +**例えば** + +開く `https://tabix.io/` アクセス時 `http://localhost: http_port`. + +``` xml + +
]]> +
+``` + +## include\_from {#server_configuration_parameters-include_from} + +置換を伴うファイルへのパス。 + +詳細については、以下を参照してください “[設定ファイル](../configuration-files.md#configuration_files)”. + +**例えば** + +``` xml +/etc/metrica.xml +``` + +## interserver\_http\_port {#interserver-http-port} + +ClickHouseサーバ間でデータを交換するためのポート。 + +**例えば** + +``` xml +9009 +``` + +## interserver\_http\_host {#interserver-http-host} + +このサーバーへのアクセスに他のサーバーが使用できるホスト名。 + +省略された場合、それは同じ方法で定義されます `hostname-f` 司令部 + +特定のネットワー + +**例えば** + +``` xml +example.yandex.ru +``` + +## interserver\_http\_credentials {#server-settings-interserver-http-credentials} + +認証に使用するユーザー名とパスワード [複製](../../engines/table-engines/mergetree-family/replication.md) レプリケートされた\*エンジン。 これらの資格情報は、レプリカ間の通信にのみ使用され、ClickHouseクライアントの資格情報とは無関係です。 サーバーにあるチェックにこれらの資格の接続にはレプリカと同じ資格を接続する場合はその他のレプリカ. なので、これらの資格を設定する同じすべてのレプリカ、クラスター +デフォルトでは、認証は使用されません。 + +このセクショ: + +- `user` — username. +- `password` — password. + +**例えば** + +``` xml + + admin + 222 + +``` + +## keep\_alive\_timeout {#keep-alive-timeout} + +接続を閉じる前に、clickhouseが着信要求を待機する秒数。 デフォルトは3秒です。 + +**例えば** + +``` xml +3 +``` + +## listen\_host {#server_configuration_parameters-listen_host} + +要求元のホストの制限。 したい場合はサーバーの回答をしているが、それらを指定し `::`. + +例: + +``` xml +::1 +127.0.0.1 +``` + +## ロガー {#server_configuration_parameters-logger} + +ログの設定。 + +キー: + +- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. +- log – The log file. Contains all the entries according to `level`. +- errorlog – Error log file. +- size – Size of the file. Applies to `log`と`errorlog`. ファイルが届くと `size`、ClickHouseのアーカイブと名前を変更し、その場所に新しいログファイルを作成します。 +- count – The number of archived log files that ClickHouse stores. + +**例えば** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +Syslogへの書き込みもサポートされています。 設定例: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +キー: + +- use\_syslog — Required setting if you want to write to the syslog. +- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. +- hostname — Optional. The name of the host that logs are sent from. +- facility — [Syslog機能キーワード](https://en.wikipedia.org/wiki/Syslog#Facility) 大文字で “LOG\_” 接頭辞: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`、というように)。 + デフォルト値: `LOG_USER` もし `address` が指定される。, `LOG_DAEMON otherwise.` +- format – Message format. Possible values: `bsd` と `syslog.` + +## マクロ {#macros} + +パラメータの置換のために再現します。 + +ければ省略することができ複製のテーブルは使用しておりません。 + +詳細については、以下を参照してください “[複製テーブルの作成](../../engines/table-engines/mergetree-family/replication.md)”. + +**例えば** + +``` xml + +``` + +## mark\_cache\_size {#server-mark-cache-size} + +約サイズ(バイトのキャッシュのマークの使用によりテーブルエンジンの [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) 家族 + +キャッシュの共有のサーバーメモリが割り当てられます。 キャッシュサイズは5368709120以上である必要があります。 + +**例えば** + +``` xml +5368709120 +``` + +## max\_concurrent\_queries {#max-concurrent-queries} + +同時に処理された要求の最大数。 + +**例えば** + +``` xml +100 +``` + +## max\_connections {#max-connections} + +受信接続の最大数。 + +**例えば** + +``` xml +4096 +``` + +## max\_open\_files {#max-open-files} + +開いているファイルの最大数。 + +デフォルトでは: `maximum`. + +Mac OS Xでこのオプションを使用することをお勧めします。 `getrlimit()` 関数は不正な値を返します。 + +**例えば** + +``` xml +262144 +``` + +## max\_table\_size\_to\_drop {#max-table-size-to-drop} + +テーブルの削除に関する制限。 + +のサイズ [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) テーブルを超え `max_table_size_to_drop` (バイト単位)、ドロップクエリを使用して削除することはできません。 + +それでもclickhouseサーバーを再起動せずにテーブルを削除する必要がある場合は、 `/flags/force_drop_table` ドロップクエリを実行します。 + +デフォルト値:50gb. + +値0は、制限なしにすべてのテーブルを削除できることを意味します。 + +**例えば** + +``` xml +0 +``` + +## merge\_tree {#server_configuration_parameters-merge_tree} + +のテーブルのための微調整 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +詳細については、“mergetreesettings”を参照してください。hヘッダファイル。 + +**例えば** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +SSLクライアント/サーバー構成。 + +SSLのサポートは、 `libpoco` ライブラリ。 ユーザーインターフェイスはファイルに記述 [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +サーバー/クライアント設定のキー: + +- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. +- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` 証明書が含まれています。 +- caConfig – The path to the file or directory that contains trusted root certificates. +- verificationMode – The method for checking the node’s certificates. Details are in the description of the [文脈](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) クラス。 可能な値: `none`, `relaxed`, `strict`, `once`. +- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. +- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| +- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. 許容値: `true`, `false`. +- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. このパラメータは常にお勧めです問題を避けることになるだろう両方の場合はサーバのキャッシュのセッションがクライアントの要望はキャッシュ. デフォルト値: `${application.name}`. +- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. +- sessionTimeout – Time for caching the session on the server. +- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. +- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. +- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. +- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . +- disableProtocols – Protocols that are not allowed to use. +- preferServerCiphers – Preferred server ciphers on the client. + +**設定例:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## part\_log {#server_configuration_parameters-part-log} + +関連付けられているログイベント [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). たとえば、データの追加やマージなどです。 利用できるログを統合アルゴリズムと比較しています。 マージプロセスを視覚化できます。 + +クエリはログに記録されます [システム。part\_log](../../operations/system-tables.md#system_tables-part-log) テーブル、別のファイルではありません。 このテーブルの名前を設定することができます `table` パラメータ(下記参照)。 + +以下のパラメータの設定ロギング: + +- `database` – Name of the database. +- `table` – Name of the system table. +- `partition_by` – Sets a [カスタム分割キー](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +**例えば** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## パス {#server_configuration_parameters-path} + +データを含むディレクトリへのパス。 + +!!! note "メモ" + 末尾のスラッシュは必須です。 + +**例えば** + +``` xml +/var/lib/clickhouse/ +``` + +## クエリーログ {#server_configuration_parameters-query-log} + +で受信したロギングクエリの設定 [log\_queries=1](../settings/settings.md) 設定。 + +クエリはログに記録されます [システム。クエリーログ](../../operations/system-tables.md#system_tables-query_log) テーブル、別のファイルではありません。 テーブルの名前を変更することができます `table` パラメータ(下記参照)。 + +以下のパラメータの設定ロギング: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [カスタム分割キー](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) テーブルのため。 +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +テーブルが存在しない場合、clickhouseはそれを作成します。 clickhouseサーバーが更新されたときにクエリログの構造が変更された場合、古い構造を持つテーブルの名前が変更され、新しいテーブルが自動的に作成されます。 + +**例えば** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## query\_thread\_log {#server_configuration_parameters-query-thread-log} + +受信したクエリのスレッドをログに記録する設定 [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) 設定。 + +クエリはログに記録されます [システム。query\_thread\_log](../../operations/system-tables.md#system_tables-query-thread-log) テーブル、別のファイルではありません。 テーブルの名前を変更することができます `table` パラメータ(下記参照)。 + +以下のパラメータの設定ロギング: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [カスタム分割キー](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) システムテーブルの場合。 +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +テーブルが存在しない場合、clickhouseはそれを作成します。 clickhouseサーバーの更新時にクエリスレッドログの構造が変更された場合、古い構造を持つテーブルの名前が変更され、新しいテーブルが自動的に作成されます。 + +**例えば** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## trace\_log {#server_configuration_parameters-trace_log} + +のための設定 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) システムテーブル操作。 + +パラメータ: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [カスタム分割キー](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) システムテーブルの場合。 +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +既定のサーバー設定ファイル `config.xml` 次の設定セクションを含みます: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## query\_masking\_rules {#query-masking-rules} + +サーバーログに保存する前に、クエリとすべてのログメッセージに適用される、regexpベースのルール, +`system.query_log`, `system.text_log`, `system.processes` テーブル、およびクライアントに送信されたログ。 これにより +SQLクエリからの機密データ漏えい(名前、電子メール、個人など) +ログへの識別子またはクレジットカード番号)。 + +**例えば** + +``` xml + + + hide SSN + (^|\D)\d{3}-\d{2}-\d{4}($|\D) + 000-00-0000 + + +``` + +設定フィールド: +- `name` -ルールの名前(オプション) +- `regexp` -RE2互換の正規表現(必須) +- `replace` -機密データのための置換文字列(デフォルトではオプション-sixアスタリスク) + +マスキングルールは、クエリ全体に適用されます(不正な形式の非解析可能なクエリからの機密データの漏洩を防ぐため)。 + +`system.events` テーブルに反対がある `QueryMaskingRulesMatch` クエリマスキングルールの総数が一致する。 + +分散クエリの場合、各サーバーを個別に構成する必要があります。 +ノードはマスクせずに保存されます。 + +## リモートサーバー {#server-settings-remote-servers} + +によって使用されるクラスターの構成 [分散](../../engines/table-engines/special/distributed.md) テーブルエンジンと `cluster` テーブル機能。 + +**例えば** + +``` xml + +``` + +の値について `incl` 属性、セクションを参照 “[設定ファイル](../configuration-files.md#configuration_files)”. + +**また見なさい** + +- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) + +## タイムゾーン {#server_configuration_parameters-timezone} + +サーバーのタイムゾーン。 + +UTCタイムゾーンまたは地理的位置(たとえば、Africa/Abidjan)のIANA識別子として指定します。 + +タイムゾーンは、datetimeフィールドがテキスト形式(画面またはファイルに印刷される)に出力される場合、および文字列からdatetimeを取得する場合に、文字列とdatetime さらに、タイムゾーンは、入力パラメータでタイムゾーンを受信しなかった場合、時刻と日付を扱う関数で使用されます。 + +**例えば** + +``` xml +Europe/Moscow +``` + +## tcp\_portgenericname {#server_configuration_parameters-tcp_port} + +TCPプロトコル経由でクライアントと通信するポート。 + +**例えば** + +``` xml +9000 +``` + +## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} + +クライアン それを使用する [OpenSSL](#server_configuration_parameters-openssl) 設定。 + +**可能な値** + +正の整数。 + +**デフォルト値** + +``` xml +9440 +``` + +## mysql\_portgenericname {#server_configuration_parameters-mysql_port} + +ポートと通信すmysqlプロトコルです。 + +**可能な値** + +正の整数。 + +例えば + +``` xml +9004 +``` + +## tmp\_path {#server-settings-tmp_path} + +大規模なクエリを処理するための一時データへのパス。 + +!!! note "メモ" + 末尾のスラッシュは必須です。 + +**例えば** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## tmp\_policy {#server-settings-tmp-policy} + +からのポリシー [`storage_configuration`](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) 一時ファイルを保存する。 +設定されていない場合 [`tmp_path`](#server-settings-tmp_path) それ以外の場合は無視されます。 + +!!! note "メモ" + - `move_factor` は無視されます +- `keep_free_space_bytes` は無視されます +- `max_data_part_size_bytes` は無視されます +-そのポリシーには正確に一つのボリュームが必要です + +## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} + +テーブルエンジンによって使用される非圧縮データのキャッシュサイズ(バイト単位)。 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +サーバーの共有キャッシュがあります。 メモ このオプ [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) は有効です。 + +圧縮されていないキャッシュは、個々のケースで非常に短いクエリに有利です。 + +**例えば** + +``` xml +8589934592 +``` + +## user\_files\_path {#server_configuration_parameters-user_files_path} + +ユー テーブル関数で使用されます [ファイル()](../../sql-reference/table-functions/file.md). + +**例えば** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## users\_config {#users-config} + +以下を含むファイルへのパス: + +- ユーザー構成。 +- アクセス権。 +- 設定プロファイル。 +- クォータの設定。 + +**例えば** + +``` xml +users.xml +``` + +## zookeeper {#server-settings_zookeeper} + +ClickHouseとの対話を許可する設定が含まれています [ZooKeeper](http://zookeeper.apache.org/) クラスター + +ClickHouse用飼育係の保存メタデータのレプリカの使用時に再現します。 場合は複製のテーブルを使用していないので、このパラメータを省略することができます。 + +このセクショ: + +- `node` — ZooKeeper endpoint. You can set multiple endpoints. + + 例えば: + + + +``` xml + + example_host + 2181 + +``` + + The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. + +- `session_timeout` — Maximum timeout for the client session in milliseconds. +- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) これは、ClickHouseサーバーで使用されるznodesのルートとして使用されます。 任意です。 +- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. + +**設定例** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + 10000 + + /path/to/zookeeper/node + + user:password + +``` + +**また見なさい** + +- [複製](../../engines/table-engines/mergetree-family/replication.md) +- [ZooKeeperプログラマーズガイド](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} + +ZooKeeperのデータパートヘッダーの保存方法。 + +この設定は、 `MergeTree` 家族 指定できます: + +- グローバルに [merge\_tree](#server_configuration_parameters-merge_tree) のセクション `config.xml` ファイル。 + + ClickHouseは、サーバー上のすべてのテーブルの設定を使用します。 設定はいつでも変更できます。 既存の表は、設定が変更されたときの動作を変更します。 + +- 各テーブルのため。 + + テーブルを作成するときは、対応する [エンジンの設定](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). この設定を持つ既存のテーブルの動作は、グローバル設定が変更されても変更されません。 + +**可能な値** + +- 0 — Functionality is turned off. +- 1 — Functionality is turned on. + +もし `use_minimalistic_part_header_in_zookeeper = 1`、その後 [複製された](../../engines/table-engines/mergetree-family/replication.md) テーブルのヘッダのデータ部品のコンパクトを `znode`. の場合はテーブルを含む多く、この保管方法を大幅に低減量のデータが保存されて飼育係. + +!!! attention "注意" + 適用後 `use_minimalistic_part_header_in_zookeeper = 1` ClickHouseサーバーをこの設定をサポートしないバージョンにダウングレードすることはできません。 するとアップグレード時に注意ClickHouseサーバーにクラスター なアップの全てのサーバーです。 テスト環境で、またはクラスターのほんの数台のサーバーで、新しいバージョンのClickHouseをテストする方が安全です。 + + Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. + +**デフォルト値:** 0. + +## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} + +内部dnsキャッシュを無効にします。 システムの作動のclickhouseのために推薦される +Kubernetesのような頻繁に変更の下部組織を使って。 + +**デフォルト値:** 0. + +## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} + +ClickHouse内部DNSキャッシュに保存されているIPアドレスの更新期間(秒単位)。 +更新は、別のシステムスレッドで非同期に実行されます。 + +**デフォルト値**: 15. + +[元の記事](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/ja/operations/server_configuration_parameters/index.md b/docs/ja/operations/server_configuration_parameters/index.md deleted file mode 100644 index db832cb78db..00000000000 --- a/docs/ja/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Server Configuration Parameters -toc_priority: 54 -toc_title: "\u5C0E\u5165" ---- - -# サーバ設定パラメータ {#server-settings} - -ここでの記述が含まれてサーバーの設定を変更することはできないのセッションor検索。 - -これらの設定は `config.xml` ClickHouseサーバー上のファイル。 - -その他の設定については、 “[設定](../settings/index.md#settings)” セクション。 - -設定を勉強する前に、 [設定ファイル](../configuration_files.md#configuration_files) の使用に注意してください。 `incl` と `optional` 属性)。 - -[元の記事](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/ja/operations/server_configuration_parameters/settings.md b/docs/ja/operations/server_configuration_parameters/settings.md deleted file mode 100644 index 82e1967eb4c..00000000000 --- a/docs/ja/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,872 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 57 -toc_title: "\u30B5\u30FC\u30D0\u30FC\u8A2D\u5B9A" ---- - -# サーバー設定 {#server-settings} - -## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} - -組み込みの辞書を再ロードする前の秒単位の間隔。 - -クリックハウスは、内蔵の辞書ごとにx秒をリロードします。 これにより、辞書の編集が可能になります “on the fly” サーバーを再起動せずに。 - -デフォルト値:3600. - -**例えば** - -``` xml -3600 -``` - -## 圧縮 {#server-settings-compression} - -以下のためのデータ圧縮設定 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-エンジンテーブル。 - -!!! warning "警告" - ClickHouseを使用し始めたばかりの場合は使用しないでください。 - -構成テンプレート: - -``` xml - - - ... - ... - ... - - ... - -``` - -`` フィールド: - -- `min_part_size` – The minimum size of a data part. -- `min_part_size_ratio` – The ratio of the data part size to the table size. -- `method` – Compression method. Acceptable values: `lz4` または `zstd`. - -複数を設定できます `` セクション。 - -条件が満たされたときの動作: - -- データパーツが条件セットと一致する場合、clickhouseは指定された圧縮方法を使用します。 -- データパートが複数の条件セットと一致する場合、clickhouseは最初に一致した条件セットを使用します。 - -デー `lz4` 圧縮。 - -**例えば** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## default\_database {#default-database} - -既定のデータベース。 - -データベースのリストを取得するには、 [SHOW DATABASES](../../sql_reference/statements/show.md#show-databases) クエリ。 - -**例えば** - -``` xml -default -``` - -## default\_profile {#default-profile} - -既定の設定プロファイル。 - -設定プロファイルはパラ `user_config`. - -**例えば** - -``` xml -default -``` - -## dictionaries\_config {#server_configuration_parameters-dictionaries_config} - -外部ディクショナリの設定ファイルへのパス。 - -パス: - -- サーバー設定ファイルに対する絶対パスまたは相対パスを指定します。 -- のパスを含むことができワイルドカード\*や?. - -また見なさい “[外部辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)”. - -**例えば** - -``` xml -*_dictionary.xml -``` - -## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} - -辞書の遅延ロード。 - -もし `true` その後、各辞書は最初の使用時に作成されます。 辞書の作成に失敗した場合、辞書を使用していた関数は例外をスローします。 - -もし `false` すべての辞書は、サーバーの起動時に作成され、エラーが発生した場合、サーバーはシャットダウンされます。 - -デフォルトは `true`. - -**例えば** - -``` xml -true -``` - -## format\_schema\_path {#server_configuration_parameters-format_schema_path} - -入力データのスキームを持つディレクトリへのパス。 [CapnProto](../../interfaces/formats.md#capnproto) フォーマット。 - -**例えば** - -``` xml - - format_schemas/ -``` - -## 黒鉛 {#server_configuration_parameters-graphite} - -データの送信先 [黒鉛](https://github.com/graphite-project). - -設定: - -- host – The Graphite server. -- port – The port on the Graphite server. -- interval – The interval for sending, in seconds. -- timeout – The timeout for sending data, in seconds. -- root\_path – Prefix for keys. -- metrics – Sending data from the [システム。指標](../../operations/system_tables.md#system_tables-metrics) テーブル。 -- events – Sending deltas data accumulated for the time period from the [システム。イベント](../../operations/system_tables.md#system_tables-events) テーブル。 -- events\_cumulative – Sending cumulative data from the [システム。イベント](../../operations/system_tables.md#system_tables-events) テーブル。 -- asynchronous\_metrics – Sending data from the [システム。asynchronous\_metrics](../../operations/system_tables.md#system_tables-asynchronous_metrics) テーブル。 - -複数を設定できます `` 句。 たとえば、異なる間隔で異なるデータを送信するためにこれを使用できます。 - -**例えば** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## graphite\_rollup {#server_configuration_parameters-graphite-rollup} - -グラファイトの間引きデータの設定。 - -詳細については、 [グラフィットメールグツリー](../../engines/table_engines/mergetree_family/graphitemergetree.md). - -**例えば** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## http\_port/https\_port {#http-porthttps-port} - -HTTP経由でサーバーに接続するためのポート。 - -もし `https_port` が指定される。, [openSSL](#server_configuration_parameters-openssl) 構成する必要があります。 - -もし `http_port` が指定されている場合、OpenSSL設定が設定されていても、その設定は無視される。 - -**例えば** - -``` xml -0000 -``` - -## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} - -ClickHouse HTTP(s)サーバーにアクセスするときにデフォルトで表示されるページ。 -デフォルト値は “Ok.” (最後にラインフィード付き) - -**例えば** - -開く `https://tabix.io/` アクセス時 `http://localhost: http_port`. - -``` xml - -
]]> -
-``` - -## include\_from {#server_configuration_parameters-include_from} - -置換を伴うファイルへのパス。 - -詳細については、以下を参照してください “[設定ファイル](../configuration_files.md#configuration_files)”. - -**例えば** - -``` xml -/etc/metrica.xml -``` - -## interserver\_http\_port {#interserver-http-port} - -ClickHouseサーバ間でデータを交換するためのポート。 - -**例えば** - -``` xml -9009 -``` - -## interserver\_http\_host {#interserver-http-host} - -このサーバーへのアクセスに他のサーバーが使用できるホスト名。 - -省略された場合、それは同じ方法で定義されます `hostname-f` 司令部 - -特定のネットワー - -**例えば** - -``` xml -example.yandex.ru -``` - -## interserver\_http\_credentials {#server-settings-interserver-http-credentials} - -認証に使用するユーザー名とパスワード [複製](../../engines/table_engines/mergetree_family/replication.md) レプリケートされた\*エンジン。 これらの資格情報は、レプリカ間の通信にのみ使用され、ClickHouseクライアントの資格情報とは無関係です。 サーバーにあるチェックにこれらの資格の接続にはレプリカと同じ資格を接続する場合はその他のレプリカ. なので、これらの資格を設定する同じすべてのレプリカ、クラスター -デフォルトでは、認証は使用されません。 - -このセクショ: - -- `user` — username. -- `password` — password. - -**例えば** - -``` xml - - admin - 222 - -``` - -## keep\_alive\_timeout {#keep-alive-timeout} - -接続を閉じる前に、clickhouseが着信要求を待機する秒数。 デフォルトは3秒です。 - -**例えば** - -``` xml -3 -``` - -## listen\_host {#server_configuration_parameters-listen_host} - -要求元のホストの制限。 したい場合はサーバーの回答をしているが、それらを指定し `::`. - -例: - -``` xml -::1 -127.0.0.1 -``` - -## ロガー {#server_configuration_parameters-logger} - -ログの設定。 - -キー: - -- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. -- log – The log file. Contains all the entries according to `level`. -- errorlog – Error log file. -- size – Size of the file. Applies to `log`と`errorlog`. ファイルが届くと `size`、ClickHouseのアーカイブと名前を変更し、その場所に新しいログファイルを作成します。 -- count – The number of archived log files that ClickHouse stores. - -**例えば** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -Syslogへの書き込みもサポートされています。 設定例: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -キー: - -- use\_syslog — Required setting if you want to write to the syslog. -- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. -- hostname — Optional. The name of the host that logs are sent from. -- facility — [Syslog機能キーワード](https://en.wikipedia.org/wiki/Syslog#Facility) 大文字で “LOG\_” 接頭辞: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`、というように)。 - デフォルト値: `LOG_USER` もし `address` が指定される。, `LOG_DAEMON otherwise.` -- format – Message format. Possible values: `bsd` と `syslog.` - -## マクロ {#macros} - -パラメータの置換のために再現します。 - -ければ省略することができ複製のテーブルは使用しておりません。 - -詳細については、以下を参照してください “[複製テーブルの作成](../../engines/table_engines/mergetree_family/replication.md)”. - -**例えば** - -``` xml - -``` - -## mark\_cache\_size {#server-mark-cache-size} - -約サイズ(バイトのキャッシュのマークの使用によりテーブルエンジンの [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) 家族 - -キャッシュの共有のサーバーメモリが割り当てられます。 キャッシュサイズは5368709120以上である必要があります。 - -**例えば** - -``` xml -5368709120 -``` - -## max\_concurrent\_queries {#max-concurrent-queries} - -同時に処理された要求の最大数。 - -**例えば** - -``` xml -100 -``` - -## max\_connections {#max-connections} - -受信接続の最大数。 - -**例えば** - -``` xml -4096 -``` - -## max\_open\_files {#max-open-files} - -開いているファイルの最大数。 - -デフォルトでは: `maximum`. - -Mac OS Xでこのオプションを使用することをお勧めします。 `getrlimit()` 関数は不正な値を返します。 - -**例えば** - -``` xml -262144 -``` - -## max\_table\_size\_to\_drop {#max-table-size-to-drop} - -テーブルの削除に関する制限。 - -のサイズ [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) テーブルを超え `max_table_size_to_drop` (バイト単位)、ドロップクエリを使用して削除することはできません。 - -それでもclickhouseサーバーを再起動せずにテーブルを削除する必要がある場合は、 `/flags/force_drop_table` ドロップクエリを実行します。 - -デフォルト値:50gb. - -値0は、制限なしにすべてのテーブルを削除できることを意味します。 - -**例えば** - -``` xml -0 -``` - -## merge\_tree {#server_configuration_parameters-merge_tree} - -のテーブルのための微調整 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -詳細については、"mergetreesettings"を参照してください。hヘッダファイル。 - -**例えば** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -SSLクライアント/サーバー構成。 - -SSLのサポートは、 `libpoco` ライブラリ。 ユーザーインターフェイスはファイルに記述 [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -サーバー/クライアント設定のキー: - -- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. -- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` 証明書が含まれています。 -- caConfig – The path to the file or directory that contains trusted root certificates. -- verificationMode – The method for checking the node's certificates. Details are in the description of the [文脈](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) クラス。 可能な値: `none`, `relaxed`, `strict`, `once`. -- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. -- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| -- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. 許容値: `true`, `false`. -- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. このパラメータは常にお勧めです問題を避けることになるだろう両方の場合はサーバのキャッシュのセッションがクライアントの要望はキャッシュ. デフォルト値: `${application.name}`. -- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. -- sessionTimeout – Time for caching the session on the server. -- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. -- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. -- fips – Activates OpenSSL FIPS mode. Supported if the library's OpenSSL version supports FIPS. -- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . -- disableProtocols – Protocols that are not allowed to use. -- preferServerCiphers – Preferred server ciphers on the client. - -**設定例:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## part\_log {#server_configuration_parameters-part-log} - -関連付けられているログイベント [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). たとえば、データの追加やマージなどです。 利用できるログを統合アルゴリズムと比較しています。 マージプロセスを視覚化できます。 - -クエリはログに記録されます [システム。part\_log](../../operations/system_tables.md#system_tables-part-log) テーブル、別のファイルではありません。 このテーブルの名前を設定することができます `table` パラメータ(下記参照)。 - -以下のパラメータの設定ロギング: - -- `database` – Name of the database. -- `table` – Name of the system table. -- `partition_by` – Sets a [カスタム分割キー](../../engines/table_engines/mergetree_family/custom_partitioning_key.md). -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -**例えば** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## パス {#server_configuration_parameters-path} - -データを含むディレクトリへのパス。 - -!!! note "メモ" - 末尾のスラッシュは必須です。 - -**例えば** - -``` xml -/var/lib/clickhouse/ -``` - -## クエリーログ {#server_configuration_parameters-query-log} - -で受信したロギングクエリの設定 [log\_queries=1](../settings/settings.md) 設定。 - -クエリはログに記録されます [システム。クエリーログ](../../operations/system_tables.md#system_tables-query_log) テーブル、別のファイルではありません。 テーブルの名前を変更することができます `table` パラメータ(下記参照)。 - -以下のパラメータの設定ロギング: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [カスタム分割キー](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) テーブルのため。 -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -テーブルが存在しない場合、clickhouseはそれを作成します。 clickhouseサーバーが更新されたときにクエリログの構造が変更された場合、古い構造を持つテーブルの名前が変更され、新しいテーブルが自動的に作成されます。 - -**例えば** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## query\_thread\_log {#server_configuration_parameters-query-thread-log} - -受信したクエリのスレッドをログに記録する設定 [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) 設定。 - -クエリはログに記録されます [システム。query\_thread\_log](../../operations/system_tables.md#system_tables-query-thread-log) テーブル、別のファイルではありません。 テーブルの名前を変更することができます `table` パラメータ(下記参照)。 - -以下のパラメータの設定ロギング: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [カスタム分割キー](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) システムテーブルの場合。 -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -テーブルが存在しない場合、clickhouseはそれを作成します。 clickhouseサーバーの更新時にクエリスレッドログの構造が変更された場合、古い構造を持つテーブルの名前が変更され、新しいテーブルが自動的に作成されます。 - -**例えば** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## trace\_log {#server_configuration_parameters-trace_log} - -のための設定 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) システムテーブル操作。 - -パラメータ: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [カスタム分割キー](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) システムテーブルの場合。 -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -既定のサーバー設定ファイル `config.xml` 次の設定セクションを含みます: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## query\_masking\_rules {#query-masking-rules} - -サーバーログに保存する前に、クエリとすべてのログメッセージに適用される、regexpベースのルール, -`system.query_log`, `system.text_log`, `system.processes` テーブル、およびクライアントに送信されたログ。 これにより -SQLクエリからの機密データ漏えい(名前、電子メール、個人など) -ログへの識別子またはクレジットカード番号)。 - -**例えば** - -``` xml - - - hide SSN - (^|\D)\d{3}-\d{2}-\d{4}($|\D) - 000-00-0000 - - -``` - -設定フィールド: -- `name` -ルールの名前(オプション) -- `regexp` -RE2互換の正規表現(必須) -- `replace` -機密データのための置換文字列(デフォルトではオプション-sixアスタリスク) - -マスキングルールは、クエリ全体に適用されます(不正な形式の非解析可能なクエリからの機密データの漏洩を防ぐため)。 - -`system.events` テーブルに反対がある `QueryMaskingRulesMatch` クエリマスキングルールの総数が一致する。 - -分散クエリの場合、各サーバーを個別に構成する必要があります。 -ノードはマスクせずに保存されます。 - -## リモートサーバー {#server-settings-remote-servers} - -によって使用されるクラスターの構成 [分散](../../engines/table_engines/special/distributed.md) テーブルエンジンと `cluster` テーブル機能。 - -**例えば** - -``` xml - -``` - -の値について `incl` 属性、セクションを参照 “[設定ファイル](../configuration_files.md#configuration_files)”. - -**また見なさい** - -- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) - -## タイムゾーン {#server_configuration_parameters-timezone} - -サーバーのタイムゾーン。 - -UTCタイムゾーンまたは地理的位置(たとえば、Africa/Abidjan)のIANA識別子として指定します。 - -タイムゾーンは、datetimeフィールドがテキスト形式(画面またはファイルに印刷される)に出力される場合、および文字列からdatetimeを取得する場合に、文字列とdatetime さらに、タイムゾーンは、入力パラメータでタイムゾーンを受信しなかった場合、時刻と日付を扱う関数で使用されます。 - -**例えば** - -``` xml -Europe/Moscow -``` - -## tcp\_portgenericname {#server_configuration_parameters-tcp_port} - -TCPプロトコル経由でクライアントと通信するポート。 - -**例えば** - -``` xml -9000 -``` - -## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} - -クライアン それを使用する [OpenSSL](#server_configuration_parameters-openssl) 設定。 - -**可能な値** - -正の整数。 - -**デフォルト値** - -``` xml -9440 -``` - -## mysql\_portgenericname {#server_configuration_parameters-mysql_port} - -ポートと通信すmysqlプロトコルです。 - -**可能な値** - -正の整数。 - -例えば - -``` xml -9004 -``` - -## tmp\_path {#server-settings-tmp_path} - -大規模なクエリを処理するための一時データへのパス。 - -!!! note "メモ" - 末尾のスラッシュは必須です。 - -**例えば** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## tmp\_policy {#server-settings-tmp-policy} - -からのポリシー [`storage_configuration`](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) 一時ファイルを保存する。 -設定されていない場合 [`tmp_path`](#server-settings-tmp_path) それ以外の場合は無視されます。 - -!!! note "メモ" - - `move_factor` は無視されます -- `keep_free_space_bytes` は無視されます -- `max_data_part_size_bytes` は無視されます --そのポリシーには正確に一つのボリュームが必要です - -## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} - -テーブルエンジンによって使用される非圧縮データのキャッシュサイズ(バイト単位)。 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -サーバーの共有キャッシュがあります。 メモ このオプ [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) は有効です。 - -圧縮されていないキャッシュは、個々のケースで非常に短いクエリに有利です。 - -**例えば** - -``` xml -8589934592 -``` - -## user\_files\_path {#server_configuration_parameters-user_files_path} - -ユー テーブル関数で使用されます [ファイル()](../../sql_reference/table_functions/file.md). - -**例えば** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## users\_config {#users-config} - -以下を含むファイルへのパス: - -- ユーザー構成。 -- アクセス権。 -- 設定プロファイル。 -- クォータの設定。 - -**例えば** - -``` xml -users.xml -``` - -## zookeeper {#server-settings_zookeeper} - -ClickHouseとの対話を許可する設定が含まれています [ZooKeeper](http://zookeeper.apache.org/) クラスター - -ClickHouse用飼育係の保存メタデータのレプリカの使用時に再現します。 場合は複製のテーブルを使用していないので、このパラメータを省略することができます。 - -このセクショ: - -- `node` — ZooKeeper endpoint. You can set multiple endpoints. - - 例えば: - - - -``` xml - - example_host - 2181 - -``` - - The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. - -- `session_timeout` — Maximum timeout for the client session in milliseconds. -- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) これは、ClickHouseサーバーで使用されるznodesのルートとして使用されます。 任意です。 -- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. - -**設定例** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - 10000 - - /path/to/zookeeper/node - - user:password - -``` - -**また見なさい** - -- [複製](../../engines/table_engines/mergetree_family/replication.md) -- [ZooKeeperプログラマーズガイド](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} - -ZooKeeperのデータパートヘッダーの保存方法。 - -この設定は、 `MergeTree` 家族 指定できます: - -- グローバルに [merge\_tree](#server_configuration_parameters-merge_tree) のセクション `config.xml` ファイル。 - - ClickHouseは、サーバー上のすべてのテーブルの設定を使用します。 設定はいつでも変更できます。 既存の表は、設定が変更されたときの動作を変更します。 - -- 各テーブルのため。 - - テーブルを作成するときは、対応する [エンジンの設定](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). この設定を持つ既存のテーブルの動作は、グローバル設定が変更されても変更されません。 - -**可能な値** - -- 0 — Functionality is turned off. -- 1 — Functionality is turned on. - -もし `use_minimalistic_part_header_in_zookeeper = 1`、その後 [複製された](../../engines/table_engines/mergetree_family/replication.md) テーブルのヘッダのデータ部品のコンパクトを `znode`. の場合はテーブルを含む多く、この保管方法を大幅に低減量のデータが保存されて飼育係. - -!!! attention "注意" - 適用後 `use_minimalistic_part_header_in_zookeeper = 1` ClickHouseサーバーをこの設定をサポートしないバージョンにダウングレードすることはできません。 するとアップグレード時に注意ClickHouseサーバーにクラスター なアップの全てのサーバーです。 テスト環境で、またはクラスターのほんの数台のサーバーで、新しいバージョンのClickHouseをテストする方が安全です。 - - Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. - -**デフォルト値:** 0. - -## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} - -内部dnsキャッシュを無効にします。 システムの作動のclickhouseのために推薦される -Kubernetesのような頻繁に変更の下部組織を使って。 - -**デフォルト値:** 0. - -## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} - -ClickHouse内部DNSキャッシュに保存されているIPアドレスの更新期間(秒単位)。 -更新は、別のシステムスレッドで非同期に実行されます。 - -**デフォルト値**: 15. - -[元の記事](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/ja/operations/settings/constraints_on_settings.md b/docs/ja/operations/settings/constraints-on-settings.md similarity index 100% rename from docs/ja/operations/settings/constraints_on_settings.md rename to docs/ja/operations/settings/constraints-on-settings.md diff --git a/docs/ja/operations/settings/permissions-for-queries.md b/docs/ja/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..c97ff0f88be --- /dev/null +++ b/docs/ja/operations/settings/permissions-for-queries.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 58 +toc_title: "\u30AF\u30A8\u30EA\u306E\u6A29\u9650" +--- + +# クエリの権限 {#permissions_for_queries} + +問合せclickhouse大きく分けて複数の種類: + +1. データを読み込むためのクエリー: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. データクエリの記述: `INSERT`, `OPTIMIZE`. +3. 設定の変更クエリ: `SET`, `USE`. +4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) クエリ: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +次の設定では、クエリの種類に応じてユーザー権限を調整します: + +- [読み取り専用](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. +- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. + +`KILL QUERY` 任意の設定で実行できます。 + +## 読み取り専用 {#settings_readonly} + +データの読み取り、データの書き込み、設定の変更の権限を制限します。 + +クエリを型に分割する方法を参照してください [上](#permissions_for_queries). + +可能な値: + +- 0 — All queries are allowed. +- 1 — Only read data queries are allowed. +- 2 — Read data and change settings queries are allowed. + +設定後 `readonly = 1`、ユーザーは変更できません `readonly` と `allow_ddl` 現在のセッションの設定。 + +を使用する場合 `GET` の方法 [HTTPインター](../../interfaces/http.md), `readonly = 1` 自動的に設定されます。 データを変更するには、 `POST` 方法。 + +設定 `readonly = 1` ユーザーによるすべての設定の変更を禁止します。 ユーザーを禁止する方法があります +特定の設定のみを変更するから、詳細については [設定の制約](constraints-on-settings.md). + +デフォルト値:0 + +## allow\_ddl {#settings_allow_ddl} + +許可または拒否 [DDL](https://en.wikipedia.org/wiki/Data_definition_language) クエリ。 + +クエリを型に分割する方法を参照してください [上](#permissions_for_queries). + +可能な値: + +- 0 — DDL queries are not allowed. +- 1 — DDL queries are allowed. + +あなたは実行できません `SET allow_ddl = 1` もし `allow_ddl = 0` 現在のセッションの場合。 + +デフォルト値:1 + +[元の記事](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/ja/operations/settings/permissions_for_queries.md b/docs/ja/operations/settings/permissions_for_queries.md deleted file mode 100644 index c69eccae696..00000000000 --- a/docs/ja/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 58 -toc_title: "\u30AF\u30A8\u30EA\u306E\u6A29\u9650" ---- - -# クエリの権限 {#permissions_for_queries} - -問合せclickhouse大きく分けて複数の種類: - -1. データを読み込むためのクエリー: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. データクエリの記述: `INSERT`, `OPTIMIZE`. -3. 設定の変更クエリ: `SET`, `USE`. -4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) クエリ: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -次の設定では、クエリの種類に応じてユーザー権限を調整します: - -- [読み取り専用](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. -- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. - -`KILL QUERY` 任意の設定で実行できます。 - -## 読み取り専用 {#settings_readonly} - -データの読み取り、データの書き込み、設定の変更の権限を制限します。 - -クエリを型に分割する方法を参照してください [上](#permissions_for_queries). - -可能な値: - -- 0 — All queries are allowed. -- 1 — Only read data queries are allowed. -- 2 — Read data and change settings queries are allowed. - -設定後 `readonly = 1`、ユーザーは変更できません `readonly` と `allow_ddl` 現在のセッションの設定。 - -を使用する場合 `GET` の方法 [HTTPインター](../../interfaces/http.md), `readonly = 1` 自動的に設定されます。 データを変更するには、 `POST` 方法。 - -設定 `readonly = 1` ユーザーによるすべての設定の変更を禁止します。 ユーザーを禁止する方法があります -特定の設定のみを変更するから、詳細については [設定の制約](constraints_on_settings.md). - -デフォルト値:0 - -## allow\_ddl {#settings_allow_ddl} - -許可または拒否 [DDL](https://en.wikipedia.org/wiki/Data_definition_language) クエリ。 - -クエリを型に分割する方法を参照してください [上](#permissions_for_queries). - -可能な値: - -- 0 — DDL queries are not allowed. -- 1 — DDL queries are allowed. - -あなたは実行できません `SET allow_ddl = 1` もし `allow_ddl = 0` 現在のセッションの場合。 - -デフォルト値:1 - -[元の記事](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/ja/operations/settings/query-complexity.md b/docs/ja/operations/settings/query-complexity.md new file mode 100644 index 00000000000..2ef666ae5f3 --- /dev/null +++ b/docs/ja/operations/settings/query-complexity.md @@ -0,0 +1,301 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 59 +toc_title: "\u30AF\u30A8\u30EA\u306E\u8907\u96D1\u3055\u306E\u5236\u9650" +--- + +# クエリの複雑さの制限 {#restrictions-on-query-complexity} + +クエリの複雑さの制限は、設定の一部です。 +これらをより安全な実行のユーザーインターフェースです。 +ほぼすべての制限が適用されます `SELECT`. 分散クエリ処理では、各サーバーに個別に制限が適用されます。 + +ClickHouseは、各行ではなく、データパーツの制限をチェックします。 これは、データ部分のサイズで制限の値を超えることができることを意味します。 + +の制限 “maximum amount of something” 値0を取ることができます。 “unrestricted”. +ほとんどの制限には、 ‘overflow\_mode’ 設定、制限を超えたときに何をすべきかを意味します。 +それは二つの値のいずれか: `throw` または `break`. 集計の制限(group\_by\_overflow\_mode)にも値があります `any`. + +`throw` – Throw an exception (default). + +`break` – Stop executing the query and return the partial result, as if the source data ran out. + +`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. + +## max\_memory\_usage {#settings_max_memory_usage} + +単一のサーバーでクエリを実行するために使用するramの最大量。 + +デフォルトの設定ファイルでは、最大値は10gbです。 + +この設定では、使用可能なメモリの量やマシン上のメモリの総量は考慮されません。 +この制限は、単一のサーバー内の単一のクエリに適用されます。 +を使用することができ `SHOW PROCESSLIST` 各クエリの現在のメモリ消費量を表示します。 +さらに、各クエリに対してピークのメモリ消費が追跡され、ログに書き込まれます。 + +特定の集計関数の状態に対するメモリ使用量は監視されません。 + +集計関数の状態に対するメモリ使用量は完全には追跡されません `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` から `String` と `Array` 引数。 + +メモリ消費もパラメータによって制限されます `max_memory_usage_for_user` と `max_memory_usage_for_all_queries`. + +## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} + +単一のサーバー上でユーザーのクエリを実行するために使用するramの最大量。 + +デフォルト値は [設定。h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L288). デフォルトでは、金額は制限されません (`max_memory_usage_for_user = 0`). + +の説明も参照してください [max\_memory\_usage](#settings_max_memory_usage). + +## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} + +単一のサーバー上ですべてのクエリを実行するために使用するramの最大量。 + +デフォルト値は [設定。h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L289). デフォルトでは、金額は制限されません (`max_memory_usage_for_all_queries = 0`). + +の説明も参照してください [max\_memory\_usage](#settings_max_memory_usage). + +## max\_rows\_to\_read {#max-rows-to-read} + +各行ではなく、各ブロックで次の制限を確認できます。 つまり、制限は少し壊れる可能性があります。 +複数のスレッドでクエリを実行する場合、次の制限が各スレッドに個別に適用されます。 + +クエリの実行時にテーブルから読み取ることができる最大行数。 + +## max\_bytes\_to\_read {#max-bytes-to-read} + +クエリの実行時にテーブルから読み取ることができる最大バイト数(圧縮されていないデータ)。 + +## read\_overflow\_mode {#read-overflow-mode} + +データの読み取り量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 + +## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} + +集約から受け取った一意のキーの最大数。 この設定では、集計時のメモリ消費量を制限できます。 + +## group\_by\_overflow\_mode {#group-by-overflow-mode} + +集計の一意のキーの数が制限を超えた場合の対処方法: ‘throw’, ‘break’、または ‘any’. デフォルトでは、投げる。 +を使用して ‘any’ valueを使用すると、GROUP BYの近似を実行できます。 この近似の品質は、データの統計的性質に依存します。 + +## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} + +の実行を有効または無効にします。 `GROUP BY` 外部メモリ内の句。 見る [外部メモリによるグループ化](../../sql-reference/statements/select.md#select-group-by-in-external-memory). + +可能な値: + +- シングルで使用できるramの最大ボリューム(バイト単位)。 [GROUP BY](../../sql-reference/statements/select.md#select-group-by-clause) オペレーション +- 0 — `GROUP BY` 外部メモリで無効。 + +デフォルト値:0. + +## max\_rows\_to\_sort {#max-rows-to-sort} + +並べ替え前の行の最大数。 これにより、ソート時のメモリ消費量を制限できます。 + +## max\_bytes\_to\_sort {#max-bytes-to-sort} + +ソート前の最大バイト数。 + +## sort\_overflow\_mode {#sort-overflow-mode} + +ソート前に受け取った行の数がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 + +## max\_result\_rows {#setting-max_result_rows} + +結果の行数を制限します。 またチェックサブクエリは、windowsアプリケーションの実行時にパーツの分散を返します。 + +## max\_result\_bytes {#max-result-bytes} + +結果のバイト数を制限します。 前の設定と同じです。 + +## result\_overflow\_mode {#result-overflow-mode} + +結果のボリュームがいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 + +を使用して ‘break’ LIMITを使用するのと似ています。 `Break` ブロックレベルでのみ実行を中断します。 これは、返される行の量が [max\_result\_rows](#setting-max_result_rows)、の倍数 [max\_block\_size](settings.md#setting-max_block_size) そして依存します [max\_threads](settings.md#settings-max_threads). + +例えば: + +``` sql +SET max_threads = 3, max_block_size = 3333; +SET max_result_rows = 3334, result_overflow_mode = 'break'; + +SELECT * +FROM numbers_mt(100000) +FORMAT Null; +``` + +結果: + +``` text +6666 rows in set. ... +``` + +## max\_execution\_time {#max-execution-time} + +クエリの最大実行時間(秒)。 +このとき、ソート段階のいずれか、または集計関数のマージおよびファイナライズ時にはチェックされません。 + +## timeout\_overflow\_mode {#timeout-overflow-mode} + +クエリがより長く実行される場合の対処方法 ‘max\_execution\_time’: ‘throw’ または ‘break’. デフォルトでは、投げる。 + +## min\_execution\_speed {#min-execution-speed} + +毎秒行の最小の実行速度。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が遅い場合は、例外がスローされます。 + +## min\_execution\_speed\_bytes {#min-execution-speed-bytes} + +実行バイト/秒の最小数。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が遅い場合は、例外がスローされます。 + +## max\_execution\_speed {#max-execution-speed} + +秒あたりの実行行の最大数。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が速い場合、実行速度が低下します。 + +## max\_execution\_speed\_bytes {#max-execution-speed-bytes} + +実行バイト/秒の最大数。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が速い場合、実行速度が低下します。 + +## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} + +実行速度が遅すぎないことをチェックする ‘min\_execution\_speed’指定された時間が経過した後、秒で)。 + +## max\_columns\_to\_read {#max-columns-to-read} + +単一のクエリでテーブルから読み取ることができる列の最大数。 クエリでより多くの列を読み取る必要がある場合は、例外がスローされます。 + +## max\_temporary\_columns {#max-temporary-columns} + +定数の列を含む、クエリを実行するときにramに同時に保持する必要がある一時的な列の最大数。 これよりも一時的な列が多い場合は、例外がスローされます。 + +## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} + +同じものとして ‘max\_temporary\_columns’ しかし、一定の列を数えずに。 +定数の列は、クエリを実行するときにかなり頻繁に形成されますが、計算リソースはほぼゼロになります。 + +## max\_subquery\_depth {#max-subquery-depth} + +サブクエリの最大ネスト深度。 サブクエリが深い場合は、例外がスローされます。 デフォルトでは、100。 + +## max\_pipeline\_depth {#max-pipeline-depth} + +パイプラインの最大深さ。 クエリ処理中に各データブロックが通過する変換の数に対応します。 単一のサーバーの制限内で数えられます。 パイプラインの深さが大きい場合は、例外がスローされます。 デフォルトでは、1000。 + +## max\_ast\_depth {#max-ast-depth} + +クエリ構文ツリーの最大ネスト深さ。 超過すると、例外がスローされます。 +現時点では、解析中にチェックされず、クエリを解析した後でのみチェックされます。 つまり、構文解析中に深すぎる構文木を作成することはできますが、クエリは失敗します。 デフォルトでは、1000。 + +## max\_ast\_elements {#max-ast-elements} + +クエリ構文ツリー内の要素の最大数。 超過すると、例外がスローされます。 +以前の設定と同じように、クエリを解析した後にのみチェックされます。 デフォルトでは、50,000。 + +## max\_rows\_in\_set {#max-rows-in-set} + +サブクエリから作成されたin句のデータ-セットの最大行数。 + +## max\_bytes\_inset {#max-bytes-in-set} + +サブクエリから作成されたin句のセットによって使用される最大バイト数(圧縮されていないデータ)。 + +## set\_overflow\_mode {#set-overflow-mode} + +データの量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 + +## max\_rows\_in\_distinct {#max-rows-in-distinct} + +DISTINCTを使用する場合の異なる行の最大数。 + +## max\_bytes\_in\_distinct {#max-bytes-in-distinct} + +DISTINCTを使用するときにハッシュテーブルで使用される最大バイト数。 + +## distinct\_overflow\_mode {#distinct-overflow-mode} + +データの量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 + +## max\_rows\_tokenトランスファー {#max-rows-to-transfer} + +リモートサーバーに渡すか、global inを使用するときに一時テーブルに保存できる行の最大数。 + +## max\_bytes\_to\_transfer {#max-bytes-to-transfer} + +リモートサーバーに渡すか、global inを使用するときに一時テーブルに保存できる最大バイト数(圧縮されていないデータ)。 + +## transfer\_overflow\_mode {#transfer-overflow-mode} + +データの量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 + +## max\_rows\_in\_join {#settings-max_rows_in_join} + +テーブルを結合するときに使用されるハッシュテーブルの行数を制限します。 + +この設定は以下に適用されます [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) 業務の [参加](../../engines/table-engines/special/join.md) テーブルエンジン。 + +クエリに複数の結合が含まれている場合、clickhouseは中間結果ごとにこの設定をチェックします。 + +ClickHouseは、制限に達したときにさまざまなアクションを実行できます。 を使用 [join\_overflow\_mode](#settings-join_overflow_mode) アクションを選択する設定。 + +可能な値: + +- 正の整数。 +- 0 — Unlimited number of rows. + +デフォルト値:0. + +## max\_bytes\_in\_join {#settings-max_bytes_in_join} + +制限サイズをバイトのハッシュテーブルが参加す。 + +この設定は以下に適用されます [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) 操作と [結合テーブルエンジン](../../engines/table-engines/special/join.md). + +クエリに結合が含まれている場合、clickhouseは中間結果ごとにこの設定をチェックします。 + +ClickHouseは、制限に達したときにさまざまなアクションを実行できます。 使用 [join\_overflow\_mode](#settings-join_overflow_mode) アクションを選択するための設定。 + +可能な値: + +- 正の整数。 +- 0 — Memory control is disabled. + +デフォルト値:0. + +## join\_overflow\_mode {#settings-join_overflow_mode} + +次の結合制限のいずれかに達したときにclickhouseが実行するアクションを定義します: + +- [max\_bytes\_in\_join](#settings-max_bytes_in_join) +- [max\_rows\_in\_join](#settings-max_rows_in_join) + +可能な値: + +- `THROW` — ClickHouse throws an exception and breaks operation. +- `BREAK` — ClickHouse breaks operation and doesn’t throw an exception. + +デフォルト値: `THROW`. + +**また見なさい** + +- [JOIN句](../../sql-reference/statements/select.md#select-join) +- [結合テーブルエンジン](../../engines/table-engines/special/join.md) + +## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} + +単一の挿入ブロック内のパーティションの最大数を制限します。 + +- 正の整数。 +- 0 — Unlimited number of partitions. + +デフォルト値:100。 + +**詳細** + +を挿入する際、データclickhouse計算パーティションの数に挿入されます。 パーティションの数が `max_partitions_per_insert_block`、ClickHouseは、次のテキストで例外をスローします: + +> “Too many partitions for single INSERT block (more than” +toString(max\_parts)+ “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” + +[元の記事](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/ja/operations/settings/query_complexity.md b/docs/ja/operations/settings/query_complexity.md deleted file mode 100644 index af498be5863..00000000000 --- a/docs/ja/operations/settings/query_complexity.md +++ /dev/null @@ -1,301 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 59 -toc_title: "\u30AF\u30A8\u30EA\u306E\u8907\u96D1\u3055\u306E\u5236\u9650" ---- - -# クエリの複雑さの制限 {#restrictions-on-query-complexity} - -クエリの複雑さの制限は、設定の一部です。 -これらをより安全な実行のユーザーインターフェースです。 -ほぼすべての制限が適用されます `SELECT`. 分散クエリ処理では、各サーバーに個別に制限が適用されます。 - -ClickHouseは、各行ではなく、データパーツの制限をチェックします。 これは、データ部分のサイズで制限の値を超えることができることを意味します。 - -の制限 “maximum amount of something” 値0を取ることができます。 “unrestricted”. -ほとんどの制限には、 ‘overflow\_mode’ 設定、制限を超えたときに何をすべきかを意味します。 -それは二つの値のいずれか: `throw` または `break`. 集計の制限(group\_by\_overflow\_mode)にも値があります `any`. - -`throw` – Throw an exception (default). - -`break` – Stop executing the query and return the partial result, as if the source data ran out. - -`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don't add new keys to the set. - -## max\_memory\_usage {#settings_max_memory_usage} - -単一のサーバーでクエリを実行するために使用するramの最大量。 - -デフォルトの設定ファイルでは、最大値は10gbです。 - -この設定では、使用可能なメモリの量やマシン上のメモリの総量は考慮されません。 -この制限は、単一のサーバー内の単一のクエリに適用されます。 -を使用することができ `SHOW PROCESSLIST` 各クエリの現在のメモリ消費量を表示します。 -さらに、各クエリに対してピークのメモリ消費が追跡され、ログに書き込まれます。 - -特定の集計関数の状態に対するメモリ使用量は監視されません。 - -集計関数の状態に対するメモリ使用量は完全には追跡されません `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` から `String` と `Array` 引数。 - -メモリ消費もパラメータによって制限されます `max_memory_usage_for_user` と `max_memory_usage_for_all_queries`. - -## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} - -単一のサーバー上でユーザーのクエリを実行するために使用するramの最大量。 - -デフォルト値は [設定。h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L288). デフォルトでは、金額は制限されません (`max_memory_usage_for_user = 0`). - -の説明も参照してください [max\_memory\_usage](#settings_max_memory_usage). - -## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} - -単一のサーバー上ですべてのクエリを実行するために使用するramの最大量。 - -デフォルト値は [設定。h](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Core/Settings.h#L289). デフォルトでは、金額は制限されません (`max_memory_usage_for_all_queries = 0`). - -の説明も参照してください [max\_memory\_usage](#settings_max_memory_usage). - -## max\_rows\_to\_read {#max-rows-to-read} - -各行ではなく、各ブロックで次の制限を確認できます。 つまり、制限は少し壊れる可能性があります。 -複数のスレッドでクエリを実行する場合、次の制限が各スレッドに個別に適用されます。 - -クエリの実行時にテーブルから読み取ることができる最大行数。 - -## max\_bytes\_to\_read {#max-bytes-to-read} - -クエリの実行時にテーブルから読み取ることができる最大バイト数(圧縮されていないデータ)。 - -## read\_overflow\_mode {#read-overflow-mode} - -データの読み取り量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 - -## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} - -集約から受け取った一意のキーの最大数。 この設定では、集計時のメモリ消費量を制限できます。 - -## group\_by\_overflow\_mode {#group-by-overflow-mode} - -集計の一意のキーの数が制限を超えた場合の対処方法: ‘throw’, ‘break’、または ‘any’. デフォルトでは、投げる。 -を使用して ‘any’ valueを使用すると、GROUP BYの近似を実行できます。 この近似の品質は、データの統計的性質に依存します。 - -## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} - -の実行を有効または無効にします。 `GROUP BY` 外部メモリ内の句。 見る [外部メモリによるグループ化](../../sql_reference/statements/select.md#select-group-by-in-external-memory). - -可能な値: - -- シングルで使用できるramの最大ボリューム(バイト単位)。 [GROUP BY](../../sql_reference/statements/select.md#select-group-by-clause) オペレーション -- 0 — `GROUP BY` 外部メモリで無効。 - -デフォルト値:0. - -## max\_rows\_to\_sort {#max-rows-to-sort} - -並べ替え前の行の最大数。 これにより、ソート時のメモリ消費量を制限できます。 - -## max\_bytes\_to\_sort {#max-bytes-to-sort} - -ソート前の最大バイト数。 - -## sort\_overflow\_mode {#sort-overflow-mode} - -ソート前に受け取った行の数がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 - -## max\_result\_rows {#setting-max_result_rows} - -結果の行数を制限します。 またチェックサブクエリは、windowsアプリケーションの実行時にパーツの分散を返します。 - -## max\_result\_bytes {#max-result-bytes} - -結果のバイト数を制限します。 前の設定と同じです。 - -## result\_overflow\_mode {#result-overflow-mode} - -結果のボリュームがいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 - -を使用して ‘break’ LIMITを使用するのと似ています。 `Break` ブロックレベルでのみ実行を中断します。 これは、返される行の量が [max\_result\_rows](#setting-max_result_rows)、の倍数 [max\_block\_size](settings.md#setting-max_block_size) そして依存します [max\_threads](settings.md#settings-max_threads). - -例えば: - -``` sql -SET max_threads = 3, max_block_size = 3333; -SET max_result_rows = 3334, result_overflow_mode = 'break'; - -SELECT * -FROM numbers_mt(100000) -FORMAT Null; -``` - -結果: - -``` text -6666 rows in set. ... -``` - -## max\_execution\_time {#max-execution-time} - -クエリの最大実行時間(秒)。 -このとき、ソート段階のいずれか、または集計関数のマージおよびファイナライズ時にはチェックされません。 - -## timeout\_overflow\_mode {#timeout-overflow-mode} - -クエリがより長く実行される場合の対処方法 ‘max\_execution\_time’: ‘throw’ または ‘break’. デフォルトでは、投げる。 - -## min\_execution\_speed {#min-execution-speed} - -毎秒行の最小の実行速度。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が遅い場合は、例外がスローされます。 - -## min\_execution\_speed\_bytes {#min-execution-speed-bytes} - -実行バイト/秒の最小数。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が遅い場合は、例外がスローされます。 - -## max\_execution\_speed {#max-execution-speed} - -秒あたりの実行行の最大数。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が速い場合、実行速度が低下します。 - -## max\_execution\_speed\_bytes {#max-execution-speed-bytes} - -実行バイト/秒の最大数。 チェックすべてのデータブロックの場合 ‘timeout\_before\_checking\_execution\_speed’ 期限が切れる 実行速度が速い場合、実行速度が低下します。 - -## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} - -実行速度が遅すぎないことをチェックする ‘min\_execution\_speed’指定された時間が経過した後、秒で)。 - -## max\_columns\_to\_read {#max-columns-to-read} - -単一のクエリでテーブルから読み取ることができる列の最大数。 クエリでより多くの列を読み取る必要がある場合は、例外がスローされます。 - -## max\_temporary\_columns {#max-temporary-columns} - -定数の列を含む、クエリを実行するときにramに同時に保持する必要がある一時的な列の最大数。 これよりも一時的な列が多い場合は、例外がスローされます。 - -## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} - -同じものとして ‘max\_temporary\_columns’ しかし、一定の列を数えずに。 -定数の列は、クエリを実行するときにかなり頻繁に形成されますが、計算リソースはほぼゼロになります。 - -## max\_subquery\_depth {#max-subquery-depth} - -サブクエリの最大ネスト深度。 サブクエリが深い場合は、例外がスローされます。 デフォルトでは、100。 - -## max\_pipeline\_depth {#max-pipeline-depth} - -パイプラインの最大深さ。 クエリ処理中に各データブロックが通過する変換の数に対応します。 単一のサーバーの制限内で数えられます。 パイプラインの深さが大きい場合は、例外がスローされます。 デフォルトでは、1000。 - -## max\_ast\_depth {#max-ast-depth} - -クエリ構文ツリーの最大ネスト深さ。 超過すると、例外がスローされます。 -現時点では、解析中にチェックされず、クエリを解析した後でのみチェックされます。 つまり、構文解析中に深すぎる構文木を作成することはできますが、クエリは失敗します。 デフォルトでは、1000。 - -## max\_ast\_elements {#max-ast-elements} - -クエリ構文ツリー内の要素の最大数。 超過すると、例外がスローされます。 -以前の設定と同じように、クエリを解析した後にのみチェックされます。 デフォルトでは、50,000。 - -## max\_rows\_in\_set {#max-rows-in-set} - -サブクエリから作成されたin句のデータ-セットの最大行数。 - -## max\_bytes\_inset {#max-bytes-in-set} - -サブクエリから作成されたin句のセットによって使用される最大バイト数(圧縮されていないデータ)。 - -## set\_overflow\_mode {#set-overflow-mode} - -データの量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 - -## max\_rows\_in\_distinct {#max-rows-in-distinct} - -DISTINCTを使用する場合の異なる行の最大数。 - -## max\_bytes\_in\_distinct {#max-bytes-in-distinct} - -DISTINCTを使用するときにハッシュテーブルで使用される最大バイト数。 - -## distinct\_overflow\_mode {#distinct-overflow-mode} - -データの量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 - -## max\_rows\_tokenトランスファー {#max-rows-to-transfer} - -リモートサーバーに渡すか、global inを使用するときに一時テーブルに保存できる行の最大数。 - -## max\_bytes\_to\_transfer {#max-bytes-to-transfer} - -リモートサーバーに渡すか、global inを使用するときに一時テーブルに保存できる最大バイト数(圧縮されていないデータ)。 - -## transfer\_overflow\_mode {#transfer-overflow-mode} - -データの量がいずれかの制限を超えた場合の対処方法: ‘throw’ または ‘break’. デフォルトでは、投げる。 - -## max\_rows\_in\_join {#settings-max_rows_in_join} - -テーブルを結合するときに使用されるハッシュテーブルの行数を制限します。 - -この設定は以下に適用されます [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) 業務の [参加](../../engines/table_engines/special/join.md) テーブルエンジン。 - -クエリに複数の結合が含まれている場合、clickhouseは中間結果ごとにこの設定をチェックします。 - -ClickHouseは、制限に達したときにさまざまなアクションを実行できます。 を使用 [join\_overflow\_mode](#settings-join_overflow_mode) アクションを選択する設定。 - -可能な値: - -- 正の整数。 -- 0 — Unlimited number of rows. - -デフォルト値:0. - -## max\_bytes\_in\_join {#settings-max_bytes_in_join} - -制限サイズをバイトのハッシュテーブルが参加す。 - -この設定は以下に適用されます [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) 操作と [結合テーブルエンジン](../../engines/table_engines/special/join.md). - -クエリに結合が含まれている場合、clickhouseは中間結果ごとにこの設定をチェックします。 - -ClickHouseは、制限に達したときにさまざまなアクションを実行できます。 使用 [join\_overflow\_mode](#settings-join_overflow_mode) アクションを選択するための設定。 - -可能な値: - -- 正の整数。 -- 0 — Memory control is disabled. - -デフォルト値:0. - -## join\_overflow\_mode {#settings-join_overflow_mode} - -次の結合制限のいずれかに達したときにclickhouseが実行するアクションを定義します: - -- [max\_bytes\_in\_join](#settings-max_bytes_in_join) -- [max\_rows\_in\_join](#settings-max_rows_in_join) - -可能な値: - -- `THROW` — ClickHouse throws an exception and breaks operation. -- `BREAK` — ClickHouse breaks operation and doesn't throw an exception. - -デフォルト値: `THROW`. - -**また見なさい** - -- [JOIN句](../../sql_reference/statements/select.md#select-join) -- [結合テーブルエンジン](../../engines/table_engines/special/join.md) - -## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} - -単一の挿入ブロック内のパーティションの最大数を制限します。 - -- 正の整数。 -- 0 — Unlimited number of partitions. - -デフォルト値:100。 - -**詳細** - -を挿入する際、データclickhouse計算パーティションの数に挿入されます。 パーティションの数が `max_partitions_per_insert_block`、ClickHouseは、次のテキストで例外をスローします: - -> “Too many partitions for single INSERT block (more than” +toString(max\_parts)+ “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” - -[元の記事](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/ja/operations/settings/settings_profiles.md b/docs/ja/operations/settings/settings-profiles.md similarity index 100% rename from docs/ja/operations/settings/settings_profiles.md rename to docs/ja/operations/settings/settings-profiles.md diff --git a/docs/ja/operations/settings/settings-users.md b/docs/ja/operations/settings/settings-users.md new file mode 100644 index 00000000000..c0e4473eecf --- /dev/null +++ b/docs/ja/operations/settings/settings-users.md @@ -0,0 +1,148 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 63 +toc_title: "\u30E6\u30FC\u30B6\u30FC\u8A2D\u5B9A" +--- + +# ユーザー設定 {#user-settings} + +その `users` のセクション `user.xml` 設定ファイルにユーザを設定します。 + +の構造 `users` セクション: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### user\_name/パスワード {#user-namepassword} + +パスワードは、平文またはsha256(hex形式)で指定できます。 + +- 平文でパスワードを割り当てるには (**推奨しない**)、それを置く `password` 要素。 + + 例えば, `qwerty`. パスワードは空白のままにできます。 + + + +- SHA256ハッシュを使用してパスワードを割り当てるには、 `password_sha256_hex` 要素。 + + 例えば, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + シェルからパスワードを生成する方法の例: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + + 結果の最初の行はパスワードです。 第二の行は、対応するsha256ハッシュです。 + + + +- MySQLクライアントとの互換性のために、passwordはダブルSHA1ハッシュで指定できます。 それを置く `password_double_sha1_hex` 要素。 + + 例えば, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + シェルからパスワードを生成する方法の例: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + + 結果の最初の行はパスワードです。 第二の行は、対応するダブルsha1ハッシュです。 + +### user\_name/networks {#user-namenetworks} + +ユーザーがclickhouseサーバーに接続できるネットワークのリスト。 + +リストの各要素には、次のいずれかの形式があります: + +- `` — IP address or network mask. + + 例: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Hostname. + + 例えば: `example01.host.ru`. + + アクセスを確認するには、dnsクエリが実行され、返されたすべてのipアドレスがピアアドレスと比較されます。 + +- `` — Regular expression for hostnames. + + 例えば, `^example\d\d-\d\d-\d\.host\.ru$` + + アクセスを確認するには、 [DNS PTRクエリ](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) ピアアドレスに対して実行され、指定された正規表現が適用されます。 次に、PTRクエリの結果に対して別のDNSクエリが実行され、すべての受信アドレスがピアアドレスと比較されます。 Regexpは$で終わることを強くお勧めします。 + +すべての結果のdnsの要求をキャッシュまでのサーバが再起動してしまいます。 + +**例** + +オープンアクセスのためのユーザーからネットワークのいずれかを指定し: + +``` xml +::/0 +``` + +!!! warning "警告" + この不安にオープンアクセスからネットワークを持っていない場合、ファイアウォールを適切に設定されたサーバーに直接接続されます。 + +オープンアクセスのみからlocalhostを指定し: + +``` xml +::1 +127.0.0.1 +``` + +### user\_name/プロファイル {#user-nameprofile} + +を割り当てることができる設定プロファイルをユーザーです。 設定プロファイルはの別のセクションで設定されます `users.xml` ファイル。 詳細については、 [設定のプロファイル](settings-profiles.md). + +### ユーザー名/クォータ {#user-namequota} + +クォータを使用すると、一定期間にわたってリソース使用量を追跡または制限できます。 クォータは、 `quotas` +のセクション `users.xml` 構成ファイル。 + +ユーザにクォータセットを割り当てることができます。 クォータ設定の詳細については、以下を参照してください [クォータ](../quotas.md#quotas). + +### user\_name/データベース {#user-namedatabases} + +このセクションでは、clickhouseによって返される行を制限することができます `SELECT` 現在のユーザーが行うクエリは、基本的な行レベルのセキュリティを実装します。 + +**例えば** + +以下の構成力がユーザー `user1` の行だけを見ることができます `table1` の結果として `SELECT` クエリ、ここでの値 `id` フィールドは1000です。 + +``` xml + + + + + id = 1000 + + + + +``` + +その `filter` 結果として得られる任意の式を指定できます [UInt8](../../sql-reference/data-types/int-uint.md)-タイプ値。 通常、比較演算子と論理演算子が含まれます。 からの行 `database_name.table1` このユーザーに対して0のフィルター結果は返されません。 フィルタリングは `PREWHERE` 操作および無効化 `WHERE→PREWHERE` 最適化。 + +[元の記事](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/ja/operations/settings/settings.md b/docs/ja/operations/settings/settings.md index 916677b1a4d..6e564dd0ba8 100644 --- a/docs/ja/operations/settings/settings.md +++ b/docs/ja/operations/settings/settings.md @@ -9,7 +9,7 @@ toc_title: "\u8A2D\u5B9A" ## distributed\_product\_mode {#distributed-product-mode} -の動作を変更します。 [分散サブクエリ](../../sql_reference/statements/select.md). +の動作を変更します。 [分散サブクエリ](../../sql-reference/statements/select.md). ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table. @@ -18,7 +18,7 @@ ClickHouse applies this setting when the query contains the product of distribut - INおよびJOINサブクエリにのみ適用されます。 - FROMセクションが複数のシャードを含む分散テーブルを使用する場合のみ。 - サブクエリが複数のシャードを含む分散テーブルに関係する場合。 -- テーブル値には使用されません [リモート](../../sql_reference/table_functions/remote.md) 機能。 +- テーブル値には使用されません [リモート](../../sql-reference/table-functions/remote.md) 機能。 可能な値: @@ -53,7 +53,7 @@ ClickHouse applies this setting when the query contains the product of distribut ## fallback\_to\_stale\_replicas\_for\_distributed\_queries {#settings-fallback_to_stale_replicas_for_distributed_queries} -更新されたデータが利用できない場合、クエリを古いレプリカに強制的に適用します。 見る [複製](../../engines/table_engines/mergetree_family/replication.md). +更新されたデータが利用できない場合、クエリを古いレプリカに強制的に適用します。 見る [複製](../../engines/table-engines/mergetree-family/replication.md). ClickHouseは、テーブルの古いレプリカから最も関連性の高いものを選択します。 @@ -67,7 +67,7 @@ ClickHouseは、テーブルの古いレプリカから最も関連性の高い MergeTreeファミリーのテーブルで動作します。 -もし `force_index_by_date=1` ClickHouseは、データ範囲の制限に使用できる日付キー条件がクエリにあるかどうかをチェックします。 適切な条件がない場合は、例外がスローされます。 ただし、読み取るデータの量が条件によって減少するかどうかはチェックされません。 たとえば、条件 `Date != ' 2000-01-01 '` テーブル内のすべてのデータに一致する場合でも許容されます(つまり、クエリを実行するにはフルスキャンが必要です)。 MergeTreeテーブルのデータ範囲の詳細については、次を参照してください [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +もし `force_index_by_date=1` ClickHouseは、データ範囲の制限に使用できる日付キー条件がクエリにあるかどうかをチェックします。 適切な条件がない場合は、例外がスローされます。 ただし、読み取るデータの量が条件によって減少するかどうかはチェックされません。 たとえば、条件 `Date != ' 2000-01-01 '` テーブル内のすべてのデータに一致する場合でも許容されます(つまり、クエリを実行するにはフルスキャンが必要です)。 MergeTreeテーブルのデータ範囲の詳細については、次を参照してください [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## force\_primary\_key {#force-primary-key} @@ -75,11 +75,11 @@ MergeTreeファミリーのテーブルで動作します。 MergeTreeファミリーのテーブルで動作します。 -もし `force_primary_key=1` ClickHouseは、データ範囲の制限に使用できる主キー条件がクエリにあるかどうかを確認します。 適切な条件がない場合は、例外がスローされます。 ただし、読み取るデータの量が条件によって減少するかどうかはチェックされません。 MergeTreeテーブルのデータ範囲の詳細については、 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +もし `force_primary_key=1` ClickHouseは、データ範囲の制限に使用できる主キー条件がクエリにあるかどうかを確認します。 適切な条件がない場合は、例外がスローされます。 ただし、読み取るデータの量が条件によって減少するかどうかはチェックされません。 MergeTreeテーブルのデータ範囲の詳細については、 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## format\_schema {#format-schema} -このパラメーターは、次のようなスキーマ定義を必要とする形式を使用する場合に便利です [Cap'n Proto](https://capnproto.org/) または [Protobuf](https://developers.google.com/protocol-buffers/). 値は形式によって異なります。 +このパラメーターは、次のようなスキーマ定義を必要とする形式を使用する場合に便利です [Cap’n Proto](https://capnproto.org/) または [Protobuf](https://developers.google.com/protocol-buffers/). 値は形式によって異なります。 ## fsync\_metadata {#fsync-metadata} @@ -136,7 +136,7 @@ HTTP要求に対する応答のデータ圧縮レベルを次の場合に設定 ## max\_http\_get\_redirects {#setting-max_http_get_redirects} -HTTP GETリダイレクトホップの最大数を制限する [URL](../../engines/table_engines/special/url.md)-エンジンテーブル。 この設定は、両方のタイプのテーブルに適用されます。 [CREATE TABLE](../../query_language/create/#create-table-query) クエリとによって [url](../../sql_reference/table_functions/url.md) テーブル機能。 +HTTP GETリダイレクトホップの最大数を制限する [URL](../../engines/table-engines/special/url.md)-エンジンテーブル。 この設定は、両方のタイプのテーブルに適用されます。 [CREATE TABLE](../../query_language/create/#create-table-query) クエリとによって [url](../../sql-reference/table-functions/url.md) テーブル機能。 可能な値: @@ -172,7 +172,7 @@ HTTP GETリダイレクトホップの最大数を制限する [URL](../../engin ## input\_format\_values\_interpret\_expressions {#settings-input_format_values_interpret_expressions} -を有効または無効にしのsqlのパーサの場合の高速ストリームのパーサで構文解析のデータです。 この設定は、 [値](../../interfaces/formats.md#data-format-values) データ挿入時のフォーマット。 構文の解析の詳細については、以下を参照してください [構文](../../sql_reference/syntax.md) セクション。 +を有効または無効にしのsqlのパーサの場合の高速ストリームのパーサで構文解析のデータです。 この設定は、 [値](../../interfaces/formats.md#data-format-values) データ挿入時のフォーマット。 構文の解析の詳細については、以下を参照してください [構文](../../sql-reference/syntax.md) セクション。 可能な値: @@ -188,7 +188,7 @@ HTTP GETリダイレクトホップの最大数を制限する [URL](../../engin 使用例 -を挿入 [DateTime](../../sql_reference/data_types/datetime.md) 異なる設定で値を入力します。 +を挿入 [DateTime](../../sql-reference/data-types/datetime.md) 異なる設定で値を入力します。 ``` sql SET input_format_values_interpret_expressions = 0; @@ -333,7 +333,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl 日付と時刻のテキスト表現のパーサーを選択できます。 -この設定は、以下には適用されません [日付と時刻の関数](../../sql_reference/functions/date_time_functions.md). +この設定は、以下には適用されません [日付と時刻の関数](../../sql-reference/functions/date-time-functions.md). 可能な値: @@ -349,12 +349,12 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl また見なさい: -- [DateTimeデータ型。](../../sql_reference/data_types/datetime.md) -- [日付と時刻を操作するための関数。](../../sql_reference/functions/date_time_functions.md) +- [DateTimeデータ型。](../../sql-reference/data-types/datetime.md) +- [日付と時刻を操作するための関数。](../../sql-reference/functions/date-time-functions.md) ## join\_default\_strictness {#settings-join_default_strictness} -デフォルトの厳密さを [結合句](../../sql_reference/statements/select.md#select-join). +デフォルトの厳密さを [結合句](../../sql-reference/statements/select.md#select-join). 可能な値: @@ -370,7 +370,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl Join操作の動作を次のもので変更する `ANY` 厳密さ !!! warning "注意" - この設定は、 `JOIN` との操作 [参加](../../engines/table_engines/special/join.md) エンジンテーブル。 + この設定は、 `JOIN` との操作 [参加](../../engines/table-engines/special/join.md) エンジンテーブル。 可能な値: @@ -381,18 +381,18 @@ Join操作の動作を次のもので変更する `ANY` 厳密さ また見なさい: -- [JOIN句](../../sql_reference/statements/select.md#select-join) -- [結合テーブルエンジン](../../engines/table_engines/special/join.md) +- [JOIN句](../../sql-reference/statements/select.md#select-join) +- [結合テーブルエンジン](../../engines/table-engines/special/join.md) - [join\_default\_strictness](#settings-join_default_strictness) ## join\_use\_nulls {#join_use_nulls} -のタイプを設定します。 [JOIN](../../sql_reference/statements/select.md) 行動。 際融合のテーブル、空細胞が表示される場合があります。 ClickHouseは、この設定に基づいて異なる塗りつぶします。 +のタイプを設定します。 [JOIN](../../sql-reference/statements/select.md) 行動。 際融合のテーブル、空細胞が表示される場合があります。 ClickHouseは、この設定に基づいて異なる塗りつぶします。 可能な値: - 0 — The empty cells are filled with the default value of the corresponding field type. -- 1 — `JOIN` 標準SQLと同じように動作します。 対応するフィールドの型は次のように変換されます [Nullable](../../sql_reference/data_types/nullable.md#data_type-nullable) 空のセルは [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` 標準SQLと同じように動作します。 対応するフィールドの型は次のように変換されます [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) 空のセルは [NULL](../../sql-reference/syntax.md). デフォルト値:0. @@ -412,7 +412,7 @@ ClickHouseでは、データはブロック(列部分のセット)によっ ## merge\_tree\_min\_rows\_for\_concurrent\_read {#setting-merge-tree-min-rows-for-concurrent-read} -Aのファイルから読み込まれる行の数 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) テーブルを超え `merge_tree_min_rows_for_concurrent_read` その後ClickHouseしようとして行な兼職の状況からの読み出しこのファイルに複数のスレッド)。 +Aのファイルから読み込まれる行の数 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) テーブルを超え `merge_tree_min_rows_for_concurrent_read` その後ClickHouseしようとして行な兼職の状況からの読み出しこのファイルに複数のスレッド)。 可能な値: @@ -422,7 +422,7 @@ Aのファイルから読み込まれる行の数 [MergeTree](../../engines/tabl ## merge\_tree\_min\_bytes\_for\_concurrent\_read {#setting-merge-tree-min-bytes-for-concurrent-read} -ファイルから読み込むバイト数 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-エンジンテーブル超え `merge_tree_min_bytes_for_concurrent_read` そのClickHouseを同時に読みこのファイルから複数のスレッド)。 +ファイルから読み込むバイト数 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-エンジンテーブル超え `merge_tree_min_bytes_for_concurrent_read` そのClickHouseを同時に読みこのファイルから複数のスレッド)。 可能な値: @@ -464,7 +464,7 @@ Aのファイルから読み込まれる行の数 [MergeTree](../../engines/tabl ClickHouseはより多くを読むべきであれば `merge_tree_max_rows_to_use_cache` あるクエリの行では、圧縮されていないブロックのキャッシュは使用されません。 -のキャッシュされた、圧縮解除されたブロックの店舗データを抽出したためます。 clickhouseこのキャッシュの高速化対応小の繰り返します。 この設定は、大量のデータを読み取るクエリによってキャッシュが破棄されるのを防ぎます。 その [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) サーバー設定は、非圧縮ブロックのキャッシュのサイズを定義します。 +のキャッシュされた、圧縮解除されたブロックの店舗データを抽出したためます。 clickhouseこのキャッシュの高速化対応小の繰り返します。 この設定は、大量のデータを読み取るクエリによってキャッシュが破棄されるのを防ぎます。 その [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) サーバー設定は、非圧縮ブロックのキャッシュのサイズを定義します。 可能な値: @@ -476,7 +476,7 @@ Default value: 128 ✕ 8192. ClickHouseはより多くを読むべきであれば `merge_tree_max_bytes_to_use_cache` バイトあるクエリでは、圧縮されていないブロックのキャッシュは使用されません。 -のキャッシュされた、圧縮解除されたブロックの店舗データを抽出したためます。 clickhouseこのキャッシュの高速化対応小の繰り返します。 この設定は、大量のデータを読み取るクエリによってキャッシュが破棄されるのを防ぎます。 その [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) サーバー設定は、非圧縮ブロックのキャッシュのサイズを定義します。 +のキャッシュされた、圧縮解除されたブロックの店舗データを抽出したためます。 clickhouseこのキャッシュの高速化対応小の繰り返します。 この設定は、大量のデータを読み取るクエリによってキャッシュが破棄されるのを防ぎます。 その [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) サーバー設定は、非圧縮ブロックのキャッシュのサイズを定義します。 可能な値: @@ -501,7 +501,7 @@ ClickHouseこの設定からデータを読み込むときます。 読み取ら クエリログの設定。 -この設定でclickhouseに送信されたクエリは、次のルールに従ってログに記録されます。 [クエリーログ](../server_configuration_parameters/settings.md#server_configuration_parameters-query-log) サーバー構成パラメータ。 +この設定でclickhouseに送信されたクエリは、次のルールに従ってログに記録されます。 [クエリーログ](../server-configuration-parameters/settings.md#server_configuration_parameters-query-log) サーバー構成パラメータ。 例えば: @@ -513,7 +513,7 @@ log_queries=1 クエリスレッドログの設定。 -この設定でclickhouseによって実行されたクエリのスレッドは、以下のルールに従ってログに記録されます [query\_thread\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) サーバー構成パラメータ。 +この設定でclickhouseによって実行されたクエリのスレッドは、以下のルールに従ってログに記録されます [query\_thread\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) サーバー構成パラメータ。 例えば: @@ -535,7 +535,7 @@ log_query_threads=1 ## max\_replica\_delay\_for\_distributed\_queries {#settings-max_replica_delay_for_distributed_queries} -分散クエリの遅延レプリカを無効にします。 見る [複製](../../engines/table_engines/mergetree_family/replication.md). +分散クエリの遅延レプリカを無効にします。 見る [複製](../../engines/table-engines/mergetree-family/replication.md). 時間を秒単位で設定します。 レプリカが設定値よりも遅れている場合、このレプリカは使用されません。 @@ -580,7 +580,7 @@ log_query_threads=1 ## min\_compress\_block\_size {#min-compress-block-size} -のために [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)"テーブル。 削減のため、遅延が処理クエリーのブロックの圧縮を書くとき、次のマークがそのサイズは少なくとも ‘min\_compress\_block\_size’. デフォルトでは、65,536。 +のために [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)"テーブル。 削減のため、遅延が処理クエリーのブロックの圧縮を書くとき、次のマークがそのサイズは少なくとも ‘min\_compress\_block\_size’. デフォルトでは、65,536。 圧縮されていないデータが以下の場合、ブロックの実際のサイズ ‘max\_compress\_block\_size’、この値よりも小さく、一つのマークのためのデータの量よりも小さくありません。 @@ -658,7 +658,7 @@ Cancels HTTP read-only queries (e.g. SELECT) when a client closes the connectio ## use\_uncompressed\_cache {#setting-use_uncompressed_cache} 非圧縮ブロックのキャッシュを使用するかどうか。 0または1を受け入れます。 デフォルトでは、0(無効)。 -圧縮されていないキャッシュ(mergetreeファミリーのテーブルのみ)を使用すると、多数の短いクエリを処理するときに待ち時間が大幅に短縮され、スループット この設定を有効にユーザーに送信頻繁に短います。 また、に注意を払う [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. +圧縮されていないキャッシュ(mergetreeファミリーのテーブルのみ)を使用すると、多数の短いクエリを処理するときに待ち時間が大幅に短縮され、スループット この設定を有効にユーザーに送信頻繁に短います。 また、に注意を払う [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. 少なくとも大量のデータ(百万行以上)を読み取るクエリの場合、圧縮されていないキャッシュは自動的に無効になり、本当に小さなクエリの容量を節 これは保つことができることを意味する ‘use\_uncompressed\_cache’ 常に1に設定します。 @@ -667,7 +667,7 @@ Cancels HTTP read-only queries (e.g. SELECT) when a client closes the connectio HTTPインターフェイスを使用する場合、 ‘query\_id’ 変数は渡すことができます。 これは、クエリ識別子として機能する任意の文字列です。 同じユーザーからのクエリが同じ場合 ‘query\_id’ この時点で既に存在している場合、その動作は ‘replace\_running\_query’ パラメータ。 -`0` (default) – Throw an exception (don't allow the query to run if a query with the same ‘query\_id’ すでに実行されている)。 +`0` (default) – Throw an exception (don’t allow the query to run if a query with the same ‘query\_id’ すでに実行されている)。 `1` – Cancel the old query and start running the new one. @@ -707,7 +707,7 @@ load_balancing = random load_balancing = nearest_hostname ``` -The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server's hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). +The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server’s hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). たとえば、example01-01-1とexample01-01-2.yandex.ru example01-01-1とexample01-02-2は二つの場所で異なりますが、一つの位置では異なります。 この方法はプリミティブに思えるかもしれませんが、ネットワークトポロジに関する外部データを必要とせず、ipv6アドレスでは複雑なipアドレスを @@ -778,7 +778,7 @@ For testing, the value can be set to 0: compilation runs synchronously and the q 値が1以上の場合、コンパイルは別のスレッドで非同期に行われます。 結果は、現在実行中のクエリを含め、準備が整ったらすぐに使用されます。 コンパイルされたコードは、クエリで使用される集計関数とgroup by句のキーのタイプの組み合わせごとに必要です。 -The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don't use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. +The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don’t use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. ## output\_format\_json\_quote\_64bit\_integers {#session_settings-output_format_json_quote_64bit_integers} @@ -886,7 +886,7 @@ ClickHouseは例外を生成します デフォルトで、重複排除圧縮を行わないための顕在化が行われは上流のソース。 ソーステーブルの重複排除により挿入されたブロックがスキップされた場合、マテリアライズドビューには挿入されません。 この動作は、マテリアライズドビューに高度に集計されたデータを挿入できるようにするために存在します。 -同時に、この動作 “breaks” `INSERT` 冪等性 もし `INSERT` メインテーブルに成功したと `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won't receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` この動作を変更できます。 再試行の際、マテリアライズドビューは繰り返しインサートを受け取り、重複排除チェックを単独で実行します, +同時に、この動作 “breaks” `INSERT` 冪等性 もし `INSERT` メインテーブルに成功したと `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won’t receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` この動作を変更できます。 再試行の際、マテリアライズドビューは繰り返しインサートを受け取り、重複排除チェックを単独で実行します, ソーステーブルのチェック結果を無視すると、最初の失敗のために失われた行が挿入されます。 ## max\_network\_bytes {#settings-max-network-bytes} @@ -935,15 +935,15 @@ ClickHouseは例外を生成します ## count\_distinct\_implementation {#settings-count_distinct_implementation} -どちらを指定するか `uniq*` 機能は実行するのに使用されるべきです [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count) 建設。 +どちらを指定するか `uniq*` 機能は実行するのに使用されるべきです [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count) 建設。 可能な値: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqCombined](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [uniqCombined64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [unihll12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [ユニキャック](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqCombined](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [uniqCombined64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [unihll12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [ユニキャック](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) デフォルト値: `uniqExact`. @@ -1008,7 +1008,7 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 ## optimize\_throw\_if\_noop {#setting-optimize_throw_if_noop} -例外のスローを有効または無効にします。 [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) クエリはマージを実行しませんでした。 +例外のスローを有効または無効にします。 [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) クエリはマージを実行しませんでした。 デフォルトでは, `OPTIMIZE` 何もしなかった場合でも正常に戻ります。 この設定では、これらの状況を区別し、例外メッセージの理由を取得できます。 @@ -1028,7 +1028,7 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 また見なさい: -- [分散テーブルエンジン](../../engines/table_engines/special/distributed.md) +- [分散テーブルエンジン](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_cap](#settings-distributed_replica_error_cap) ## distributed\_replica\_error\_cap {#settings-distributed_replica_error_cap} @@ -1040,12 +1040,12 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 また見なさい: -- [分散テーブルエンジン](../../engines/table_engines/special/distributed.md) +- [分散テーブルエンジン](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_half\_life](#settings-distributed_replica_error_half_life) ## distributed\_directory\_monitor\_sleep\_time\_ms {#distributed_directory_monitor_sleep_time_ms} -のための基礎間隔 [分散](../../engines/table_engines/special/distributed.md) データを送信する表エンジン。 実際の間隔は、エラーが発生した場合に指数関数的に増加します。 +のための基礎間隔 [分散](../../engines/table-engines/special/distributed.md) データを送信する表エンジン。 実際の間隔は、エラーが発生した場合に指数関数的に増加します。 可能な値: @@ -1055,7 +1055,7 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 ## distributed\_directory\_monitor\_max\_sleep\_time\_ms {#distributed_directory_monitor_max_sleep_time_ms} -のための最大間隔 [分散](../../engines/table_engines/special/distributed.md) データを送信する表エンジン。 インターバルセットの指数関数的な成長を制限する [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) 設定。 +のための最大間隔 [分散](../../engines/table-engines/special/distributed.md) データを送信する表エンジン。 インターバルセットの指数関数的な成長を制限する [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) 設定。 可能な値: @@ -1067,7 +1067,7 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 挿入されたデータのバッチでの送信を有効/無効にします。 -バッチ送信が有効になっている場合は、 [分散](../../engines/table_engines/special/distributed.md) テーブルエンジンをお送り複数のファイルの挿入データを移動するようになっていますの代わりに送信します。 一括送信の改善にクラスターの性能をより活用してサーバやネットワーク資源です。 +バッチ送信が有効になっている場合は、 [分散](../../engines/table-engines/special/distributed.md) テーブルエンジンをお送り複数のファイルの挿入データを移動するようになっていますの代わりに送信します。 一括送信の改善にクラスターの性能をより活用してサーバやネットワーク資源です。 可能な値: @@ -1093,7 +1093,7 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 ## query\_profiler\_real\_time\_period\_ns {#query_profiler_real_time_period_ns} -の実際のクロックタイマーの期間を設定します。 [クエリプロファイラ](../../operations/optimizing_performance/sampling_query_profiler.md). リアルクロックタイマーカウント壁時計の時間。 +の実際のクロックタイマーの期間を設定します。 [クエリプロファイラ](../../operations/optimizing-performance/sampling-query-profiler.md). リアルクロックタイマーカウント壁時計の時間。 可能な値: @@ -1106,17 +1106,17 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 - タイマーを消すための0。 -タイプ: [UInt64](../../sql_reference/data_types/int_uint.md). +タイプ: [UInt64](../../sql-reference/data-types/int-uint.md). デフォルト値:1000000000ナノ秒(秒)。 また見なさい: -- システム表 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- システム表 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## query\_profiler\_cpu\_time\_period\_ns {#query_profiler_cpu_time_period_ns} -のcpuクロックタイマーの期間を設定します。 [クエリプロファイラ](../../operations/optimizing_performance/sampling_query_profiler.md). このタ +のcpuクロックタイマーの期間を設定します。 [クエリプロファイラ](../../operations/optimizing-performance/sampling-query-profiler.md). このタ 可能な値: @@ -1129,17 +1129,17 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 - タイマーを消すための0。 -タイプ: [UInt64](../../sql_reference/data_types/int_uint.md). +タイプ: [UInt64](../../sql-reference/data-types/int-uint.md). デフォルト値:1000000000ナノ秒。 また見なさい: -- システム表 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- システム表 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## allow\_introspection\_functions {#settings-allow_introspection_functions} -ディスエーブルの有効 [introspections関数](../../sql_reference/functions/introspection.md) のためのクエリープロファイリング. +ディスエーブルの有効 [introspections関数](../../sql-reference/functions/introspection.md) のためのクエリープロファイリング. 可能な値: @@ -1150,8 +1150,8 @@ PREWHERE/WHEREでシャーディングキー条件を持つSELECTクエリの未 **また見なさい** -- [クエリプ](../optimizing_performance/sampling_query_profiler.md) -- システム表 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- [クエリプ](../optimizing-performance/sampling-query-profiler.md) +- システム表 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## input\_format\_parallel\_parallel\_paralsing {#input-format-parallel-parsing} diff --git a/docs/ja/operations/settings/settings_users.md b/docs/ja/operations/settings/settings_users.md deleted file mode 100644 index 5ab057efa54..00000000000 --- a/docs/ja/operations/settings/settings_users.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 63 -toc_title: "\u30E6\u30FC\u30B6\u30FC\u8A2D\u5B9A" ---- - -# ユーザー設定 {#user-settings} - -その `users` のセクション `user.xml` 設定ファイルにユーザを設定します。 - -の構造 `users` セクション: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### user\_name/パスワード {#user-namepassword} - -パスワードは、平文またはsha256(hex形式)で指定できます。 - -- 平文でパスワードを割り当てるには (**推奨しない**)、それを置く `password` 要素。 - - 例えば, `qwerty`. パスワードは空白のままにできます。 - - - -- SHA256ハッシュを使用してパスワードを割り当てるには、 `password_sha256_hex` 要素。 - - 例えば, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - シェルからパスワードを生成する方法の例: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - - 結果の最初の行はパスワードです。 第二の行は、対応するsha256ハッシュです。 - - - -- MySQLクライアントとの互換性のために、passwordはダブルSHA1ハッシュで指定できます。 それを置く `password_double_sha1_hex` 要素。 - - 例えば, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - シェルからパスワードを生成する方法の例: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - - 結果の最初の行はパスワードです。 第二の行は、対応するダブルsha1ハッシュです。 - -### user\_name/networks {#user-namenetworks} - -ユーザーがclickhouseサーバーに接続できるネットワークのリスト。 - -リストの各要素には、次のいずれかの形式があります: - -- `` — IP address or network mask. - - 例: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Hostname. - - 例えば: `example01.host.ru`. - - アクセスを確認するには、dnsクエリが実行され、返されたすべてのipアドレスがピアアドレスと比較されます。 - -- `` — Regular expression for hostnames. - - 例えば, `^example\d\d-\d\d-\d\.host\.ru$` - - アクセスを確認するには、 [DNS PTRクエリ](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) ピアアドレスに対して実行され、指定された正規表現が適用されます。 次に、PTRクエリの結果に対して別のDNSクエリが実行され、すべての受信アドレスがピアアドレスと比較されます。 Regexpは$で終わることを強くお勧めします。 - -すべての結果のdnsの要求をキャッシュまでのサーバが再起動してしまいます。 - -**例** - -オープンアクセスのためのユーザーからネットワークのいずれかを指定し: - -``` xml -::/0 -``` - -!!! warning "警告" - この不安にオープンアクセスからネットワークを持っていない場合、ファイアウォールを適切に設定されたサーバーに直接接続されます。 - -オープンアクセスのみからlocalhostを指定し: - -``` xml -::1 -127.0.0.1 -``` - -### user\_name/プロファイル {#user-nameprofile} - -を割り当てることができる設定プロファイルをユーザーです。 設定プロファイルはの別のセクションで設定されます `users.xml` ファイル。 詳細については、 [設定のプロファイル](settings_profiles.md). - -### ユーザー名/クォータ {#user-namequota} - -クォータを使用すると、一定期間にわたってリソース使用量を追跡または制限できます。 クォータは、 `quotas` -のセクション `users.xml` 構成ファイル。 - -ユーザにクォータセットを割り当てることができます。 クォータ設定の詳細については、以下を参照してください [クォータ](../quotas.md#quotas). - -### user\_name/データベース {#user-namedatabases} - -このセクションでは、clickhouseによって返される行を制限することができます `SELECT` 現在のユーザーが行うクエリは、基本的な行レベルのセキュリティを実装します。 - -**例えば** - -以下の構成力がユーザー `user1` の行だけを見ることができます `table1` の結果として `SELECT` クエリ、ここでの値 `id` フィールドは1000です。 - -``` xml - - - - - id = 1000 - - - - -``` - -その `filter` 結果として得られる任意の式を指定できます [UInt8](../../sql_reference/data_types/int_uint.md)-タイプ値。 通常、比較演算子と論理演算子が含まれます。 からの行 `database_name.table1` このユーザーに対して0のフィルター結果は返されません。 フィルタリングは `PREWHERE` 操作および無効化 `WHERE→PREWHERE` 最適化。 - -[元の記事](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/ja/operations/system-tables.md b/docs/ja/operations/system-tables.md new file mode 100644 index 00000000000..7e1714ba231 --- /dev/null +++ b/docs/ja/operations/system-tables.md @@ -0,0 +1,1097 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 52 +toc_title: "\u30B7\u30B9\u30C6\u30E0\u8868" +--- + +# システム表 {#system-tables} + +システムテーブルは、システムの機能の一部を実装し、システムの動作に関する情報へのアクセスを提供するために使用されます。 +システムテーブルは削除できません(ただし、デタッチを実行できます)。 +システムテーブ サーバーは起動時にすべてのシステムテーブルを作成します。 +システムテーブルは読み取り専用です。 +彼らはに位置しています ‘system’ データベース + +## システム。asynchronous\_metrics {#system_tables-asynchronous_metrics} + +バックグラウンドで定期的に計算される指標が含まれます。 例えば、使用中のramの量。 + +列: + +- `metric` ([文字列](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Float64](../sql-reference/data-types/float.md)) — Metric value. + +**例えば** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**また見なさい** + +- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. +- [システム。指標](#system_tables-metrics) — Contains instantly calculated metrics. +- [システム。イベント](#system_tables-events) — Contains a number of events that have occurred. +- [システム。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. + +## システム。クラスター {#system-clusters} + +についての情報が含まれてクラスターのコンフィグファイルをサーバーです。 + +列: + +- `cluster` (String) — The cluster name. +- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. +- `shard_weight` (UInt32) — The relative weight of the shard when writing data. +- `replica_num` (UInt32) — The replica number in the shard, starting from 1. +- `host_name` (String) — The host name, as specified in the config. +- `host_address` (String) — The host IP address obtained from DNS. +- `port` (UInt16) — The port to use for connecting to the server. +- `user` (String) — The name of the user for connecting to the server. +- `errors_count` (UInt32)-このホストがレプリカに到達できなかった回数。 +- `estimated_recovery_time` (UInt32)-レプリカエラーカウントがゼロになるまで残された秒数で、正常に戻ったと見なされます。 + +ご注意ください `errors_count` クエリごとにクラスターに一度updatedされますが、 `estimated_recovery_time` オンデマンドで再計算されます。 したがって、ゼロ以外の場合があります `errors_count` とゼロ `estimated_recovery_time`、その次のクエリはゼロ `errors_count` また、エラーがないかのようにreplicaを使用してみてください。 + +**また見なさい** + +- [分散テーブルエンジン](../engines/table-engines/special/distributed.md) +- [distributed\_replica\_error\_cap設定](settings/settings.md#settings-distributed_replica_error_cap) +- [distributed\_replica\_error\_half\_life設定](settings/settings.md#settings-distributed_replica_error_half_life) + +## システム。列 {#system-columns} + +すべてのテーブルの列に関する情報を含みます。 + +このテーブルを使用して、次のような情報を取得できます。 [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table) 一度に複数のテーブルのクエリ。 + +その `system.columns` テーブルを含む以下のカラムのカラムタイプはブラケット): + +- `database` (String) — Database name. +- `table` (String) — Table name. +- `name` (String) — Column name. +- `type` (String) — Column type. +- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`)デフォルト値の場合、または空の文字列が定義されていない場合。 +- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. +- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. +- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. +- `marks_bytes` (UInt64) — The size of marks, in bytes. +- `comment` (String) — Comment on the column, or an empty string if it is not defined. +- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. +- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. +- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. +- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. + +## システム。貢献者 {#system-contributors} + +を含むに関する情報提供者が保持しています。 ランダムな順序ですべてのconstributors。 順序は、クエリの実行時にランダムです。 + +列: + +- `name` (String) — Contributor (author) name from git log. + +**例えば** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +テーブルで自分自身を見つけるには、クエリを使用します: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## システム。データ {#system-databases} + +このテーブルを含む単一の文字列カラムと呼ばれ ‘name’ – the name of a database. +各データベースのサーバーについて知っていて対応するエントリの表に示す。 +このシステム表は実行のために使用されます `SHOW DATABASES` クエリ。 + +## システム。detached\_parts {#system_tables-detached_parts} + +についての情報が含まれて外部 [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) テーブル。 その `reason` カラムを指定理由の一部でした。 ユーザーがデタッチしたパーツの場合、理由は空です。 このような部品は [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) 司令部 の内容その他のカラムを参照 [システム。パーツ](#system_tables-parts). パート名が無効な場合、一部の列の値は次のようになります `NULL`. このような部分は、 [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). + +## システム。辞書 {#system-dictionaries} + +外部辞書に関する情報が含まれます。 + +列: + +- `name` (String) — Dictionary name. +- `type` (String) — Dictionary type: Flat, Hashed, Cache. +- `origin` (String) — Path to the configuration file that describes the dictionary. +- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. +- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. +- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. +- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. +- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. +- `element_count` (UInt64) — The number of items stored in the dictionary. +- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). +- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. +- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn’t be created. +- `source` (String) — Text describing the data source for the dictionary. + +辞書によって使用されるメモリの量は、それに格納されているアイテムの数に比例しないことに注意してください。 くフラットおよびキャッシュされた辞書のすべてのメモリー細胞により、予告なしにご指定済みを問わずどのように辞書を実現する + +## システム。イベント {#system_tables-events} + +システムで発生したイベントの数に関する情報が含まれています。 たとえば、テーブルでは、次のように多くの `SELECT` ClickHouseサーバーの起動後にクエリが処理されました。 + +列: + +- `event` ([文字列](../sql-reference/data-types/string.md)) — Event name. +- `value` ([UInt64](../sql-reference/data-types/int-uint.md)) — Number of events occurred. +- `description` ([文字列](../sql-reference/data-types/string.md)) — Event description. + +**例えば** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**また見なさい** + +- [システム。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [システム。指標](#system_tables-metrics) — Contains instantly calculated metrics. +- [システム。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. + +## システム。機能 {#system-functions} + +通常の関数と集計関数に関する情報が含まれます。 + +列: + +- `name`(`String`) – The name of the function. +- `is_aggregate`(`UInt8`) — Whether the function is aggregate. + +## システム。graphite\_retentions {#system-graphite-retentions} + +についての情報が含まれてパラメータ [graphite\_rollup](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) これは、次の表で使用されます [\*グラフィットマージツリー](../engines/table-engines/mergetree-family/graphitemergetree.md) エンジン + +列: + +- `config_name` (文字列) - `graphite_rollup` パラメータ名。 +- `regexp` (String)-メトリック名のパターン。 +- `function` (String)-集計関数の名前。 +- `age` (UInt64)-データの最小経過時間(秒)。 +- `precision` (UInt64)-どのように正確に秒単位でデータの年齢を定義します。 +- `priority` (UInt16)-パターンの優先順位。 +- `is_default` (UInt8)-パターンがデフォルトであるかどうか。 +- `Tables.database` (Array(String))-使用するデータベーステーブルの名前の配列 `config_name` パラメータ。 +- `Tables.table` (Array(String))-使用するテーブル名の配列 `config_name` パラメータ。 + +## システム。マージ {#system-merges} + +MergeTreeファミリーのテーブルのマージおよび現在処理中のパーツの変更に関する情報を格納します。 + +列: + +- `database` (String) — The name of the database the table is in. +- `table` (String) — Table name. +- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. +- `progress` (Float64) — The percentage of completed work from 0 to 1. +- `num_parts` (UInt64) — The number of pieces to be merged. +- `result_part_name` (String) — The name of the part that will be formed as the result of merging. +- `is_mutation` (UInt8)-1このプロセスが部分突然変異の場合。 +- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. +- `total_size_marks` (UInt64) — The total number of marks in the merged parts. +- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. +- `rows_read` (UInt64) — Number of rows read. +- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. +- `rows_written` (UInt64) — Number of rows written. + +## システム。指標 {#system_tables-metrics} + +瞬時に計算されるか、現在の値を持つことができる指標が含まれています。 たとえば、同時に処理されたクエリの数や現在のレプリカの遅延などです。 このテーブルは常に最新です。 + +列: + +- `metric` ([文字列](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — Metric value. +- `description` ([文字列](../sql-reference/data-types/string.md)) — Metric description. + +サポートされている指標のリストを以下に示します [dbms/Common/CurrentMetrics。cpp](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Common/CurrentMetrics.cpp) ClickHouseのソースファイル。 + +**例えば** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**また見なさい** + +- [システム。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [システム。イベント](#system_tables-events) — Contains a number of events that occurred. +- [システム。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. + +## システム。metric\_log {#system_tables-metric_log} + +表からのメトリック値の履歴を含む `system.metrics` と `system.events`、定期的にディスクにフラッシュ。 +メトリック履歴の収集をオンにするには `system.metric_log`,作成 `/etc/clickhouse-server/config.d/metric_log.xml` 以下の内容で: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**例えば** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**また見なさい** + +- [システム。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [システム。イベント](#system_tables-events) — Contains a number of events that occurred. +- [システム。指標](#system_tables-metrics) — Contains instantly calculated metrics. +- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. + +## システム。数字 {#system-numbers} + +このテーブルを一uint64カラム名 ‘number’ ゼロから始まるほぼすべての自然数が含まれています。 +このテーブルをテストに使用するか、ブルートフォース検索を実行する必要がある場合に使用できます。 +この表からの読み取りは並列化されません。 + +## システム。numbers\_mt {#system-numbers-mt} + +同じように ‘system.numbers’ しかし、読み込みは平行です。 数字は任意の順序で返すことができます。 +使用試験までを実施。 + +## システム。ワン {#system-one} + +このテーブルには、単一行と単一行が含まれます ‘dummy’ 値を含むUInt8列0. +このテーブルは、selectクエリがfrom句を指定しない場合に使用されます。 +これは、他のdbmsで見つかったデュアルテーブルに似ています。 + +## システム。パーツ {#system_tables-parts} + +の部分に関する情報が含まれます [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) テーブル。 + +各行は、一つのデータ部分を記述します。 + +列: + +- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql-reference/statements/alter.md#query_language_queries_alter) クエリ。 + + 形式: + + - `YYYYMM` 月別の自動パーティション分割の場合。 + - `any_string` 手動で分割する場合。 + +- `name` (`String`) – Name of the data part. + +- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. + +- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` インデックスの粒度(通常は8192)(このヒントは適応的な粒度では機能しません)。 + +- `rows` (`UInt64`) – The number of rows. + +- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. + +- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `marks_bytes` (`UInt64`) – The size of the file with marks. + +- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| + +- `remove_time` (`DateTime`) – The time when the data part became inactive. + +- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. + +- `min_date` (`Date`) – The minimum value of the date key in the data part. + +- `max_date` (`Date`) – The maximum value of the date key in the data part. + +- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. + +- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. + +- `partition_id` (`String`) – ID of the partition. + +- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. + +- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. + +- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. + +- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. + +- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition) + +- `database` (`String`) – Name of the database. + +- `table` (`String`) – Name of the table. + +- `engine` (`String`) – Name of the table engine without parameters. + +- `path` (`String`) – Absolute path to the folder with data part files. + +- `disk` (`String`) – Name of a disk that stores the data part. + +- `hash_of_all_files` (`String`) – [サイファシー128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) 圧縮されたファイルの。 + +- `hash_of_uncompressed_files` (`String`) – [サイファシー128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) 非圧縮ファイル(マーク付きファイル、インデックスファイルなど)). + +- `uncompressed_hash_of_compressed_files` (`String`) – [サイファシー128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) 圧縮されていないかのように圧縮されたファイル内のデータ。 + +- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. + +- `marks_size` (`UInt64`) – Alias for `marks_bytes`. + +## システム。part\_log {#system_tables-part-log} + +その `system.part_log` テーブルが作成されるのは、 [part\_log](server-configuration-parameters/settings.md#server_configuration_parameters-part-log) サーバー設定を指定します。 + +このテーブルには、 [データ部品](../engines/table-engines/mergetree-family/custom-partitioning-key.md) で [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) データの追加やマージなどのファミリテーブル。 + +その `system.part_log` テーブルを含む以下のカラム: + +- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: + - `NEW_PART` — Inserting of a new data part. + - `MERGE_PARTS` — Merging of data parts. + - `DOWNLOAD_PART` — Downloading a data part. + - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — Mutating of a data part. + - `MOVE_PART` — Moving the data part from the one disk to another one. +- `event_date` (Date) — Event date. +- `event_time` (DateTime) — Event time. +- `duration_ms` (UInt64) — Duration. +- `database` (String) — Name of the database the data part is in. +- `table` (String) — Name of the table the data part is in. +- `part_name` (String) — Name of the data part. +- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ パーティション分割が `tuple()`. +- `rows` (UInt64) — The number of rows in the data part. +- `size_in_bytes` (UInt64) — Size of the data part in bytes. +- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). +- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. +- `read_rows` (UInt64) — The number of rows was read during the merge. +- `read_bytes` (UInt64) — The number of bytes was read during the merge. +- `error` (UInt16) — The code number of the occurred error. +- `exception` (String) — Text message of the occurred error. + +その `system.part_log` テーブルは、最初にデータを挿入した後に作成されます。 `MergeTree` テーブル。 + +## システム。プロセス {#system_tables-processes} + +このシステム表は実行のために使用されます `SHOW PROCESSLIST` クエリ。 + +列: + +- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` ユーザー。 このフィールドには、特定のクエリのユーザー名が含まれています。 +- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` クエリリクエスターサーバーです。 +- `elapsed` (Float64) – The time in seconds since request execution started. +- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. +- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query-complexity.md#settings_max_memory_usage) 設定。 +- `query` (String) – The query text. For `INSERT`、それは挿入するデータが含まれていません。 +- `query_id` (String) – Query ID, if defined. + +## システム。text\_log {#system-tables-text-log} + +ログエントリを含む。 この表に行くロギングのレベルはで限られます `text_log.level` サーバー設定。 + +列: + +- `event_date` (`Date`)-エントリの日付。 +- `event_time` (`DateTime`)-エントリの時間。 +- `microseconds` (`UInt32`)-エントリのマイクロ秒。 +- `thread_name` (String) — Name of the thread from which the logging was done. +- `thread_id` (UInt64) — OS thread ID. +- `level` (`Enum8`)-エントリーレベル。 + - `'Fatal' = 1` + - `'Critical' = 2` + - `'Error' = 3` + - `'Warning' = 4` + - `'Notice' = 5` + - `'Information' = 6` + - `'Debug' = 7` + - `'Trace' = 8` +- `query_id` (`String`)-クエリのID。 +- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) +- `message` (`String`)-メッセージそのもの。 +- `revision` (`UInt32`)-ClickHouseリビジョン. +- `source_file` (`LowCardinality(String)`)-ロギングが行われたソースファイル。 +- `source_line` (`UInt64`)-ロギングが行われたソースライン。 + +## システム。クエリーログ {#system_tables-query_log} + +クエリの実行に関する情報が含まれます。 各クエリについて、処理の開始時間、処理時間、エラーメッセージおよびその他の情報を確認できます。 + +!!! note "メモ" + テーブルには以下の入力データは含まれません `INSERT` クエリ。 + +ClickHouseはこのテーブルを作成します。 [クエリーログ](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) サーバパラメータを指定します。 このパラメーターは、ロギング間隔やクエリがログに記録されるテーブルの名前などのロギングルールを設定します。 + +するクエリのロギングの設定を [log\_queries](settings/settings.md#settings-log-queries) 1へのパラメータ。 詳細については、 [設定](settings/settings.md) セクション。 + +その `system.query_log` テーブルレジスタ二種類のクエリ: + +1. クライアントによって直接実行された初期クエリ。 +2. 他のクエリによって開始された子クエリ(分散クエリ実行用)。 これらのタイプのクエリについては、親クエリに関する情報が表示されます。 `initial_*` 列。 + +列: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` クエリ、書き込まれた行の数。 他のクエリの場合、列の値は0です。 +- `written_bytes` (UInt64) — For `INSERT` クエリ、書き込まれたバイト数。 他のクエリの場合、列の値は0です。 +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [クリックハウス-顧客](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [クリックハウス-顧客](../interfaces/cli.md) または他のTCPクライアントが実行されます。 +- `client_name` (String) — The [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント名。 +- `client_revision` (UInt32) — Revision of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 +- `client_version_major` (UInt32) — Major version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 +- `client_version_minor` (UInt32) — Minor version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 +- `client_version_patch` (UInt32) — Patch component of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアン +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` 方法を用いた。 + - 2 — `POST` 方法を用いた。 +- `http_user_agent` (String) — The `UserAgent` HTTP要求で渡されるヘッダー。 +- `quota_key` (String) — The “quota key” で指定される [クォータ](quotas.md) 設定(参照 `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [システム。イベント](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` コラム +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` 1へのパラメータ。 +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` コラム + +それぞれのクエリでは、次の行が作成されます。 `query_log` クエリのステータスに応じたテーブル: + +1. クエリの実行が成功すると、タイプ1とタイプ2のイベントが作成されます。 `type` 列)。 +2. クエリ処理中にエラーが発生した場合は、タイプ1とタイプ4のイベントが作成されます。 +3. クエリを起動する前にエラーが発生した場合は、タイプ3の単一のイベントが作成されます。 + +デフォルトでは、7.5秒間隔でログがテーブルに追加されます。 この間隔を設定することができます [クエリーログ](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) サーバー設定(参照してください `flush_interval_milliseconds` パラメータ)。 フラッシュを強制的にログからのメモリバッファ、テーブルを使用 `SYSTEM FLUSH LOGS` クエリ。 + +テーブルが手動で削除されると、その場で自動的に作成されます。 以前のログはすべて削除されることに注意してください。 + +!!! note "メモ" + ログの保存期間は無制限です。 ログはテーブルから自動的に削除されません。 古いログの削除を自分で整理する必要があります。 + +任意のパーティション分割キーを指定できます。 `system.query_log` のテーブル [クエリーログ](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) サーバー設定(参照してください `partition_by` パラメータ)。 + +## システム。query\_thread\_log {#system_tables-query-thread-log} + +のテーブルについての情報が含まれてそれぞれの検索キーワード実行スレッド. + +ClickHouseはこのテーブルを作成します。 [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) サーバパラメータを指定します。 このパラメーターは、ロギング間隔やクエリがログに記録されるテーブルの名前などのロギングルールを設定します。 + +するクエリのロギングの設定を [log\_query\_threads](settings/settings.md#settings-log-query-threads) 1へのパラメータ。 詳細については、 [設定](settings/settings.md) セクション。 + +列: + +- `event_date` (Date) — the date when the thread has finished execution of the query. +- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` クエリ、書き込まれた行の数。 他のクエリの場合、列の値は0です。 +- `written_bytes` (UInt64) — For `INSERT` クエリ、書き込まれたバイト数。 他のクエリの場合、列の値は0です。 +- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. +- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. +- `thread_name` (String) — Name of the thread. +- `thread_number` (UInt32) — Internal thread ID. +- `os_thread_id` (Int32) — OS thread ID. +- `master_thread_id` (UInt64) — OS initial ID of initial thread. +- `query` (String) — Query string. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [クリックハウス-顧客](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [クリックハウス-顧客](../interfaces/cli.md) または他のTCPクライアントが実行されます。 +- `client_name` (String) — The [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント名。 +- `client_revision` (UInt32) — Revision of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 +- `client_version_major` (UInt32) — Major version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 +- `client_version_minor` (UInt32) — Minor version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 +- `client_version_patch` (UInt32) — Patch component of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアン +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` 方法を用いた。 + - 2 — `POST` 方法を用いた。 +- `http_user_agent` (String) — The `UserAgent` HTTP要求で渡されるヘッダー。 +- `quota_key` (String) — The “quota key” で指定される [クォータ](quotas.md) 設定(参照 `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [システム。イベント](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` コラム + +デフォルトでは、7.5秒間隔でログがテーブルに追加されます。 この間隔を設定することができます [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) サーバー設定(参照してください `flush_interval_milliseconds` パラメータ)。 フラッシュを強制的にログからのメモリバッファ、テーブルを使用 `SYSTEM FLUSH LOGS` クエリ。 + +テーブルが手動で削除されると、その場で自動的に作成されます。 以前のログはすべて削除されることに注意してください。 + +!!! note "メモ" + ログの保存期間は無制限です。 ログはテーブルから自動的に削除されません。 古いログの削除を自分で整理する必要があります。 + +任意のパーティション分割キーを指定できます。 `system.query_thread_log` のテーブル [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) サーバー設定(参照してください `partition_by` パラメータ)。 + +## システム。trace\_log {#system_tables-trace_log} + +サンプリングクエリプ + +ClickHouseはこのテーブルを作成します [trace\_log](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) サーバの設定が設定されます。 また、 [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) と [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) 設定は設定する必要があります。 + +ログを分析するには、以下を使用します `addressToLine`, `addressToSymbol` と `demangle` イントロスペクション関数。 + +列: + +- `event_date`([日付](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time`([DateTime](../sql-reference/data-types/datetime.md)) — Timestamp of sampling moment. + +- `revision`([UInt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + サーバーに接続する場合 `clickhouse-client`、あなたは次のような文字列が表示されます `Connected to ClickHouse server version 19.18.1 revision 54429.`. このフィールドには、 `revision`、しかしない `version` サーバーの。 + +- `timer_type`([Enum8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` 壁時計の時刻を表します。 + - `CPU` CPU時間を表します。 + +- `thread_number`([UInt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id`([文字列](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [クエリーログ](#system_tables-query_log) システムテーブル。 + +- `trace`([配列(uint64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**例えば** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## システム。レプリカ {#system_tables-replicas} + +情報および状況を再現しテーブル在住の地元のサーバーです。 +このテーブルは、監視に使用できます。 のテーブルが含まれて行毎に再現\*ます。 + +例えば: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +列: + +- `database` (`String`)-データベース名 +- `table` (`String`)-テーブル名 +- `engine` (`String`)-テーブルエンジン名 +- `is_leader` (`UInt8`)-レプリカがリーダーであるかどうか。 + リーダーは一度にひとつのレプリカのみです。 リーダーは実行するバックグラウンドマージの選択を担当します。 + 書き込みは、リーダーであるかどうかにかかわらず、利用可能であり、zkにセッションを持つ任意のレプリカに対して実行できます。 +- `can_become_leader` (`UInt8`)-レプリカをリーダーとして選出できるかどうか。 +- `is_readonly` (`UInt8`)-レプリカが読み取り専用モードであるかどうか。 + このモードは、zookeeperでセッションを再初期化するときに不明なエラーが発生した場合、およびzookeeperでのセッション再初期化中に、zookeeperとのセクションが設定さ +- `is_session_expired` (`UInt8`)-ZooKeeperとのセッションが終了しました。 基本的には `is_readonly`. +- `future_parts` (`UInt32`)-まだ行われていない挿入またはマージの結果として表示されるデータパーツの数。 +- `parts_to_check` (`UInt32`)-検証のためのキュー内のデータパーツの数。 破損している可能性があるという疑いがある場合、部品は検証キューに入れられます。 +- `zookeeper_path` (`String`)-ZooKeeperのテーブルデータへのパス。 +- `replica_name` (`String`)-飼育係のレプリカ名。 異なるレプリカと同じテーブルの異名をとります。 +- `replica_path` (`String`)-飼育係のレプリカデータへのパス。 連結と同じです ‘zookeeper\_path/replicas/replica\_path’. +- `columns_version` (`Int32`)-テーブル構造のバージョン番号。 ALTERが実行された回数を示します。 場合にレプリカは異なるバージョンで一部のレプリカさんのすべての変更はまだない。 +- `queue_size` (`UInt32`)-実行待ち操作のキューのサイズ。 業務などのブロックを挿入し、データ統合し、行動します。 それは通常 `future_parts`. +- `inserts_in_queue` (`UInt32`)-作成する必要があるデータブロックの挿入数。 挿入は、通常、かなり迅速に複製されます。 この数が大きい場合は、何かが間違っていることを意味します。 +- `merges_in_queue` (`UInt32`)-作成されるのを待機しているマージの数。 マージが時間がかかることがあるので、この値は長い間ゼロより大きくなることがあります。 +- `part_mutations_in_queue` (`UInt32`)-作られるのを待っている突然変異の数。 +- `queue_oldest_time` (`DateTime`)-If `queue_size` 0より大きい場合、最も古い操作がキューに追加された日時が表示されます。 +- `inserts_oldest_time` (`DateTime`)-見る `queue_oldest_time` +- `merges_oldest_time` (`DateTime`)-見る `queue_oldest_time` +- `part_mutations_oldest_time` (`DateTime`)-見る `queue_oldest_time` + +次の4列は、zkとのアクティブなセッションがある場合にのみ、ゼロ以外の値を持ちます。 + +- `log_max_index` (`UInt64`)-一般的な活動のログの最大エントリ番号。 +- `log_pointer` (`UInt64`)-レプリカが実行キューにコピーした一般的なアクティビティのログの最大エントリ番号。 もし `log_pointer` はるかに小さいよりも `log_max_index`、何かが間違っている。 +- `last_queue_update` (`DateTime`)-キューが前回updatedされたとき。 +- `absolute_delay` (`UInt64`)-どのように大きな遅れ秒で現在のレプリカがあります。 +- `total_replicas` (`UInt8`)-このテーブルの既知のレプリカの総数。 +- `active_replicas` (`UInt8`)-ZooKeeperでセッションを持つこのテーブルのレプリカの数(つまり、機能するレプリカの数)。 + +希望される場合は、すべての列は、テーブルが少しゆっくりと、くつかの読み込みから飼育係したがって行います。 +最後の4列(log\_max\_index、log\_pointer、total\_replicas、active\_replicas)を要求しないと、テーブルはすぐに動作します。 + +たとえば、次のようにすべてが正常に動作していることを確認できます: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +このクエリが何も返さない場合は、すべてが正常であることを意味します。 + +## システム。設定 {#system-settings} + +現在使用中の設定に関する情報が含まれます。 +つまり、システムからの読み取りに使用しているクエリを実行するために使用されます。設定テーブル. + +列: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. +- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [制約](settings/constraints-on-settings.md#constraints-on-settings)). +- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [制約](settings/constraints-on-settings.md#constraints-on-settings)). +- `readonly` (UInt8) — Can user change this setting (for more info, look into [制約](settings/constraints-on-settings.md#constraints-on-settings)). + +例えば: + +``` sql +SELECT name, value +FROM system.settings +WHERE changed +``` + +``` text +┌─name───────────────────┬─value───────┐ +│ max_threads │ 8 │ +│ use_uncompressed_cache │ 0 │ +│ load_balancing │ random │ +│ max_memory_usage │ 10000000000 │ +└────────────────────────┴─────────────┘ +``` + +## システム。merge\_tree\_settings {#system-merge_tree_settings} + +についての情報が含まれて設定 `MergeTree` テーブル。 + +列: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. + +## システム。table\_engines {#system-table-engines} + +を含むの記述のテーブルエンジンをサポートサーバーとその特徴を支援す。 + +このテーブル以下のカラムのカラムタイプはブラケット): + +- `name` (String) — The name of table engine. +- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` 句。 +- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [索引のスキップ](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` と `SAMPLE_BY`. +- `supports_replication` (UInt8) — Flag that indicates if table engine supports [データ複製](../engines/table-engines/mergetree-family/replication.md). +- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. + +例えば: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**また見なさい** + +- マージツリーファミリー [クエリ句](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) +- カフカname [設定](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) +- 参加 [設定](../engines/table-engines/special/join.md#join-limitations-and-settings) + +## システム。テーブル {#system-tables} + +を含むメタデータは各テーブルサーバーに知っています。 デタッチされたテーブルは `system.tables`. + +このテーブル以下のカラムのカラムタイプはブラケット): + +- `database` (String) — The name of the database the table is in. + +- `name` (String) — Table name. + +- `engine` (String) — Table engine name (without parameters). + +- `is_temporary` (UInt8)-テーブルが一時的かどうかを示すフラグ。 + +- `data_path` (文字列)-ファイルシステム内のテーブルデータへのパス。 + +- `metadata_path` (String)-ファイルシステム内のテーブルメタデータへのパス。 + +- `metadata_modification_time` (DateTime)-テーブルメタデータの最新の変更の時刻。 + +- `dependencies_database` (Array(String))-データベースの依存関係。 + +- `dependencies_table` (Array(String))-テーブルの依存関係 ([MaterializedView](../engines/table-engines/special/materializedview.md) 現在のテーブルに基づくテーブル)。 + +- `create_table_query` (String)-テーブルの作成に使用されたクエリ。 + +- `engine_full` (String)-テーブルエンジンのパラメータ。 + +- `partition_key` (String)-テーブルで指定されたパーティションキー式。 + +- `sorting_key` (String)-テーブルで指定された並べ替えキー式。 + +- `primary_key` (String)-テーブルで指定された主キー式。 + +- `sampling_key` (String)-テーブルで指定されたサンプリングキー式。 + +- `storage_policy` (文字列)-ストレージポリシー: + + - [MergeTree](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) + - [分散](../engines/table-engines/special/distributed.md#distributed) + +- `total_rows` (Nullable(UInt64))-テーブル内の正確な行数をすばやく決定できる場合は、行の総数。 `Null` (含むunderying `Buffer` テーブル)。 + +- `total_bytes` (Nullable(UInt64))-ストレージ上のテーブルの正確なバイト数を迅速に決定できる場合は、合計バイト数。 `Null` (**しない** を含みます)。 + + - If the table stores data on disk, returns used space on disk (i.e. compressed). + - テーブルがメモリにデータを格納する場合,メモリ内の使用バイトの近似数を返します. + +その `system.tables` テーブルは `SHOW TABLES` クエリの実装。 + +## システム。zookeeper {#system-zookeeper} + +ZooKeeperが設定されていない場合、テーブルは存在しません。 できるデータを読み込んで飼育係クラスタで定義され、config. +クエリには次のものが必要です ‘path’ WHERE句の等価条件です。 これは、データを取得したい子供のためのZooKeeperのパスです。 + +クエリ `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` すべての子のデータを出力します。 `/clickhouse` ノード +すべてのルートノードのデータを出力するには、path= ‘/’. +で指定されたパスの場合 ‘path’ 存在しない場合、例外がスローされます。 + +列: + +- `name` (String) — The name of the node. +- `path` (String) — The path to the node. +- `value` (String) — Node value. +- `dataLength` (Int32) — Size of the value. +- `numChildren` (Int32) — Number of descendants. +- `czxid` (Int64) — ID of the transaction that created the node. +- `mzxid` (Int64) — ID of the transaction that last changed the node. +- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. +- `ctime` (DateTime) — Time of node creation. +- `mtime` (DateTime) — Time of the last modification of the node. +- `version` (Int32) — Node version: the number of times the node was changed. +- `cversion` (Int32) — Number of added or removed descendants. +- `aversion` (Int32) — Number of changes to the ACL. +- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. + +例えば: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## システム。突然変異 {#system_tables-mutations} + +のテーブルについての情報が含まれて [突然変異](../sql-reference/statements/alter.md#alter-mutations) マージツリーテーブルとその進捗状況の。 各突然変異コマンドは、単一の行で表されます。 テーブルには次の列があります: + +**データ**, **テーブル** -突然変異が適用されたデータベースとテーブルの名前。 + +**mutation\_id** -変異のID。 のための複製のテーブルこのIdに対応すznode名の `/mutations/` ZooKeeperのディレクトリ。 複雑でないテーブルの場合、Idはテーブルのデータディレクトリ内のファイル名に対応します。 + +**コマンド** -突然変異コマンド文字列(後のクエリの一部 `ALTER TABLE [db.]table`). + +**create\_time** -この突然変異コマンドが実行のために提出されたとき。 + +**ブロック番号。partition\_id**, **ブロック番号。番号** -入れ子になった列。 つまり、パーティションIDと、そのパーティションの変更によって取得されたブロック番号より小さい数のブロックを含むパーティションのみが変更さ 非複製のテーブル、ブロック番号の全ての仕切りがひとつのシーケンスです。 こないということを意味している変異体再現し、テーブルの列として展開しているのが記録するとともにシングルブロック番号の取得による突然変異が原因です。 + +**parts\_to\_do** -突然変異が終了するために突然変異する必要があるデータ部分の数。 + +**is\_done** -変異は終わったのか? たとえそうであっても `parts_to_do = 0` レプリケートされたテーブルの変更は、変更する必要のある新しいデータ部分を作成する実行時間の長いINSERTのためにまだ行われていない可能性があり + +一部の部分の変更に問題があった場合、次の列には追加情報が含まれています: + +**latest\_failed\_part** -突然変異できなかった最新の部分の名前。 + +**latest\_fail\_time** -最も最近の部分変異失敗の時間。 + +**latest\_fail\_reason** -最も最近の部分の突然変異の失敗を引き起こした例外メッセージ。 + +## システム。ディスク {#system_tables-disks} + +についての情報が含まれてディスクの定義に [サーバー構成](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +列: + +- `name` ([文字列](../sql-reference/data-types/string.md)) — Name of a disk in the server configuration. +- `path` ([文字列](../sql-reference/data-types/string.md)) — Path to the mount point in the file system. +- `free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Free space on disk in bytes. +- `total_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Disk volume in bytes. +- `keep_free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` ディスク構成のパラメータ。 + +## システム。ストレージ\_policies {#system_tables-storage_policies} + +についての情報が含まれて保管方針の量を定義する [サーバー構成](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +列: + +- `policy_name` ([文字列](../sql-reference/data-types/string.md)) — Name of the storage policy. +- `volume_name` ([文字列](../sql-reference/data-types/string.md)) — Volume name defined in the storage policy. +- `volume_priority` ([UInt64](../sql-reference/data-types/int-uint.md)) — Volume order number in the configuration. +- `disks` ([配列(文字列)](../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. +- `max_data_part_size` ([UInt64](../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). +- `move_factor` ([Float64](../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. + +ストレージポリシーに複数のボリュームが含まれている場合、各ボリュームの情報はテーブルの個々の行に格納されます。 + +[元の記事](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/ja/operations/system_tables.md b/docs/ja/operations/system_tables.md deleted file mode 100644 index 6df12d9c907..00000000000 --- a/docs/ja/operations/system_tables.md +++ /dev/null @@ -1,1097 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 52 -toc_title: "\u30B7\u30B9\u30C6\u30E0\u8868" ---- - -# システム表 {#system-tables} - -システムテーブルは、システムの機能の一部を実装し、システムの動作に関する情報へのアクセスを提供するために使用されます。 -システムテーブルは削除できません(ただし、デタッチを実行できます)。 -システムテーブ サーバーは起動時にすべてのシステムテーブルを作成します。 -システムテーブルは読み取り専用です。 -彼らはに位置しています ‘system’ データベース - -## システム。asynchronous\_metrics {#system_tables-asynchronous_metrics} - -バックグラウンドで定期的に計算される指標が含まれます。 例えば、使用中のramの量。 - -列: - -- `metric` ([文字列](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Float64](../sql_reference/data_types/float.md)) — Metric value. - -**例えば** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**また見なさい** - -- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. -- [システム。指標](#system_tables-metrics) — Contains instantly calculated metrics. -- [システム。イベント](#system_tables-events) — Contains a number of events that have occurred. -- [システム。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. - -## システム。クラスター {#system-clusters} - -についての情報が含まれてクラスターのコンフィグファイルをサーバーです。 - -列: - -- `cluster` (String) — The cluster name. -- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. -- `shard_weight` (UInt32) — The relative weight of the shard when writing data. -- `replica_num` (UInt32) — The replica number in the shard, starting from 1. -- `host_name` (String) — The host name, as specified in the config. -- `host_address` (String) — The host IP address obtained from DNS. -- `port` (UInt16) — The port to use for connecting to the server. -- `user` (String) — The name of the user for connecting to the server. -- `errors_count` (UInt32)-このホストがレプリカに到達できなかった回数。 -- `estimated_recovery_time` (UInt32)-レプリカエラーカウントがゼロになるまで残された秒数で、正常に戻ったと見なされます。 - -ご注意ください `errors_count` クエリごとにクラスターに一度updatedされますが、 `estimated_recovery_time` オンデマンドで再計算されます。 したがって、ゼロ以外の場合があります `errors_count` とゼロ `estimated_recovery_time`、その次のクエリはゼロ `errors_count` また、エラーがないかのようにreplicaを使用してみてください。 - -**また見なさい** - -- [分散テーブルエンジン](../engines/table_engines/special/distributed.md) -- [distributed\_replica\_error\_cap設定](settings/settings.md#settings-distributed_replica_error_cap) -- [distributed\_replica\_error\_half\_life設定](settings/settings.md#settings-distributed_replica_error_half_life) - -## システム。列 {#system-columns} - -すべてのテーブルの列に関する情報を含みます。 - -このテーブルを使用して、次のような情報を取得できます。 [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table) 一度に複数のテーブルのクエリ。 - -その `system.columns` テーブルを含む以下のカラムのカラムタイプはブラケット): - -- `database` (String) — Database name. -- `table` (String) — Table name. -- `name` (String) — Column name. -- `type` (String) — Column type. -- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`)デフォルト値の場合、または空の文字列が定義されていない場合。 -- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. -- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. -- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. -- `marks_bytes` (UInt64) — The size of marks, in bytes. -- `comment` (String) — Comment on the column, or an empty string if it is not defined. -- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. -- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. -- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. -- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. - -## システム。貢献者 {#system-contributors} - -を含むに関する情報提供者が保持しています。 ランダムな順序ですべてのconstributors。 順序は、クエリの実行時にランダムです。 - -列: - -- `name` (String) — Contributor (author) name from git log. - -**例えば** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -テーブルで自分自身を見つけるには、クエリを使用します: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## システム。データ {#system-databases} - -このテーブルを含む単一の文字列カラムと呼ばれ ‘name’ – the name of a database. -各データベースのサーバーについて知っていて対応するエントリの表に示す。 -このシステム表は実行のために使用されます `SHOW DATABASES` クエリ。 - -## システム。detached\_parts {#system_tables-detached_parts} - -についての情報が含まれて外部 [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) テーブル。 その `reason` カラムを指定理由の一部でした。 ユーザーがデタッチしたパーツの場合、理由は空です。 このような部品は [ALTER TABLE ATTACH PARTITION\|PART](../query_language/query_language/alter/#alter_attach-partition) 司令部 の内容その他のカラムを参照 [システム。パーツ](#system_tables-parts). パート名が無効な場合、一部の列の値は次のようになります `NULL`. このような部分は、 [ALTER TABLE DROP DETACHED PART](../query_language/query_language/alter/#alter_drop-detached). - -## システム。辞書 {#system-dictionaries} - -外部辞書に関する情報が含まれます。 - -列: - -- `name` (String) — Dictionary name. -- `type` (String) — Dictionary type: Flat, Hashed, Cache. -- `origin` (String) — Path to the configuration file that describes the dictionary. -- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. -- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. -- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. -- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. -- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. -- `element_count` (UInt64) — The number of items stored in the dictionary. -- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). -- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. -- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn't be created. -- `source` (String) — Text describing the data source for the dictionary. - -辞書によって使用されるメモリの量は、それに格納されているアイテムの数に比例しないことに注意してください。 くフラットおよびキャッシュされた辞書のすべてのメモリー細胞により、予告なしにご指定済みを問わずどのように辞書を実現する - -## システム。イベント {#system_tables-events} - -システムで発生したイベントの数に関する情報が含まれています。 たとえば、テーブルでは、次のように多くの `SELECT` ClickHouseサーバーの起動後にクエリが処理されました。 - -列: - -- `event` ([文字列](../sql_reference/data_types/string.md)) — Event name. -- `value` ([UInt64](../sql_reference/data_types/int_uint.md)) — Number of events occurred. -- `description` ([文字列](../sql_reference/data_types/string.md)) — Event description. - -**例えば** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**また見なさい** - -- [システム。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [システム。指標](#system_tables-metrics) — Contains instantly calculated metrics. -- [システム。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. - -## システム。機能 {#system-functions} - -通常の関数と集計関数に関する情報が含まれます。 - -列: - -- `name`(`String`) – The name of the function. -- `is_aggregate`(`UInt8`) — Whether the function is aggregate. - -## システム。graphite\_retentions {#system-graphite-retentions} - -についての情報が含まれてパラメータ [graphite\_rollup](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) これは、次の表で使用されます [\*グラフィットマージツリー](../engines/table_engines/mergetree_family/graphitemergetree.md) エンジン - -列: - -- `config_name` (文字列) - `graphite_rollup` パラメータ名。 -- `regexp` (String)-メトリック名のパターン。 -- `function` (String)-集計関数の名前。 -- `age` (UInt64)-データの最小経過時間(秒)。 -- `precision` (UInt64)-どのように正確に秒単位でデータの年齢を定義します。 -- `priority` (UInt16)-パターンの優先順位。 -- `is_default` (UInt8)-パターンがデフォルトであるかどうか。 -- `Tables.database` (Array(String))-使用するデータベーステーブルの名前の配列 `config_name` パラメータ。 -- `Tables.table` (Array(String))-使用するテーブル名の配列 `config_name` パラメータ。 - -## システム。マージ {#system-merges} - -MergeTreeファミリーのテーブルのマージおよび現在処理中のパーツの変更に関する情報を格納します。 - -列: - -- `database` (String) — The name of the database the table is in. -- `table` (String) — Table name. -- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. -- `progress` (Float64) — The percentage of completed work from 0 to 1. -- `num_parts` (UInt64) — The number of pieces to be merged. -- `result_part_name` (String) — The name of the part that will be formed as the result of merging. -- `is_mutation` (UInt8)-1このプロセスが部分突然変異の場合。 -- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. -- `total_size_marks` (UInt64) — The total number of marks in the merged parts. -- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. -- `rows_read` (UInt64) — Number of rows read. -- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. -- `rows_written` (UInt64) — Number of rows written. - -## システム。指標 {#system_tables-metrics} - -瞬時に計算されるか、現在の値を持つことができる指標が含まれています。 たとえば、同時に処理されたクエリの数や現在のレプリカの遅延などです。 このテーブルは常に最新です。 - -列: - -- `metric` ([文字列](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — Metric value. -- `description` ([文字列](../sql_reference/data_types/string.md)) — Metric description. - -サポートされている指標のリストを以下に示します [dbms/Common/CurrentMetrics。cpp](https://github.com/ClickHouse/ClickHouse/blob/master/dbms/Common/CurrentMetrics.cpp) ClickHouseのソースファイル。 - -**例えば** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**また見なさい** - -- [システム。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [システム。イベント](#system_tables-events) — Contains a number of events that occurred. -- [システム。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. - -## システム。metric\_log {#system_tables-metric_log} - -表からのメトリック値の履歴を含む `system.metrics` と `system.events`、定期的にディスクにフラッシュ。 -メトリック履歴の収集をオンにするには `system.metric_log`,作成 `/etc/clickhouse-server/config.d/metric_log.xml` 以下の内容で: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**例えば** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**また見なさい** - -- [システム。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [システム。イベント](#system_tables-events) — Contains a number of events that occurred. -- [システム。指標](#system_tables-metrics) — Contains instantly calculated metrics. -- [監視](monitoring.md) — Base concepts of ClickHouse monitoring. - -## システム。数字 {#system-numbers} - -このテーブルを一uint64カラム名 ‘number’ ゼロから始まるほぼすべての自然数が含まれています。 -このテーブルをテストに使用するか、ブルートフォース検索を実行する必要がある場合に使用できます。 -この表からの読み取りは並列化されません。 - -## システム。numbers\_mt {#system-numbers-mt} - -同じように ‘system.numbers’ しかし、読み込みは平行です。 数字は任意の順序で返すことができます。 -使用試験までを実施。 - -## システム。ワン {#system-one} - -このテーブルには、単一行と単一行が含まれます ‘dummy’ 値を含むUInt8列0. -このテーブルは、selectクエリがfrom句を指定しない場合に使用されます。 -これは、他のdbmsで見つかったデュアルテーブルに似ています。 - -## システム。パーツ {#system_tables-parts} - -の部分に関する情報が含まれます [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) テーブル。 - -各行は、一つのデータ部分を記述します。 - -列: - -- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql_reference/statements/alter.md#query_language_queries_alter) クエリ。 - - 形式: - - - `YYYYMM` 月別の自動パーティション分割の場合。 - - `any_string` 手動で分割する場合。 - -- `name` (`String`) – Name of the data part. - -- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it's used in a table. Otherwise, it's deleted. Inactive data parts remain after merging. - -- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` インデックスの粒度(通常は8192)(このヒントは適応的な粒度では機能しません)。 - -- `rows` (`UInt64`) – The number of rows. - -- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. - -- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `marks_bytes` (`UInt64`) – The size of the file with marks. - -- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| - -- `remove_time` (`DateTime`) – The time when the data part became inactive. - -- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. - -- `min_date` (`Date`) – The minimum value of the date key in the data part. - -- `max_date` (`Date`) – The maximum value of the date key in the data part. - -- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. - -- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. - -- `partition_id` (`String`) – ID of the partition. - -- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. - -- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. - -- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. - -- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. - -- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn't exist. For more details, see [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition) - -- `database` (`String`) – Name of the database. - -- `table` (`String`) – Name of the table. - -- `engine` (`String`) – Name of the table engine without parameters. - -- `path` (`String`) – Absolute path to the folder with data part files. - -- `disk` (`String`) – Name of a disk that stores the data part. - -- `hash_of_all_files` (`String`) – [サイファシー128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) 圧縮されたファイルの。 - -- `hash_of_uncompressed_files` (`String`) – [サイファシー128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) 非圧縮ファイル(マーク付きファイル、インデックスファイルなど)). - -- `uncompressed_hash_of_compressed_files` (`String`) – [サイファシー128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) 圧縮されていないかのように圧縮されたファイル内のデータ。 - -- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. - -- `marks_size` (`UInt64`) – Alias for `marks_bytes`. - -## システム。part\_log {#system_tables-part-log} - -その `system.part_log` テーブルが作成されるのは、 [part\_log](server_configuration_parameters/settings.md#server_configuration_parameters-part-log) サーバー設定を指定します。 - -このテーブルには、 [データ部品](../engines/table_engines/mergetree_family/custom_partitioning_key.md) で [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) データの追加やマージなどのファミリテーブル。 - -その `system.part_log` テーブルを含む以下のカラム: - -- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: - - `NEW_PART` — Inserting of a new data part. - - `MERGE_PARTS` — Merging of data parts. - - `DOWNLOAD_PART` — Downloading a data part. - - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — Mutating of a data part. - - `MOVE_PART` — Moving the data part from the one disk to another one. -- `event_date` (Date) — Event date. -- `event_time` (DateTime) — Event time. -- `duration_ms` (UInt64) — Duration. -- `database` (String) — Name of the database the data part is in. -- `table` (String) — Name of the table the data part is in. -- `part_name` (String) — Name of the data part. -- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ パーティション分割が `tuple()`. -- `rows` (UInt64) — The number of rows in the data part. -- `size_in_bytes` (UInt64) — Size of the data part in bytes. -- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). -- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. -- `read_rows` (UInt64) — The number of rows was read during the merge. -- `read_bytes` (UInt64) — The number of bytes was read during the merge. -- `error` (UInt16) — The code number of the occurred error. -- `exception` (String) — Text message of the occurred error. - -その `system.part_log` テーブルは、最初にデータを挿入した後に作成されます。 `MergeTree` テーブル。 - -## システム。プロセス {#system_tables-processes} - -このシステム表は実行のために使用されます `SHOW PROCESSLIST` クエリ。 - -列: - -- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` ユーザー。 このフィールドには、特定のクエリのユーザー名が含まれています。 -- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` クエリリクエスターサーバーです。 -- `elapsed` (Float64) – The time in seconds since request execution started. -- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. -- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query_complexity.md#settings_max_memory_usage) 設定。 -- `query` (String) – The query text. For `INSERT`、それは挿入するデータが含まれていません。 -- `query_id` (String) – Query ID, if defined. - -## システム。text\_log {#system-tables-text-log} - -ログエントリを含む。 この表に行くロギングのレベルはで限られます `text_log.level` サーバー設定。 - -列: - -- `event_date` (`Date`)-エントリの日付。 -- `event_time` (`DateTime`)-エントリの時間。 -- `microseconds` (`UInt32`)-エントリのマイクロ秒。 -- `thread_name` (String) — Name of the thread from which the logging was done. -- `thread_id` (UInt64) — OS thread ID. -- `level` (`Enum8`)-エントリーレベル。 - - `'Fatal' = 1` - - `'Critical' = 2` - - `'Error' = 3` - - `'Warning' = 4` - - `'Notice' = 5` - - `'Information' = 6` - - `'Debug' = 7` - - `'Trace' = 8` -- `query_id` (`String`)-クエリのID。 -- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) -- `message` (`String`)-メッセージそのもの。 -- `revision` (`UInt32`)-ClickHouseリビジョン. -- `source_file` (`LowCardinality(String)`)-ロギングが行われたソースファイル。 -- `source_line` (`UInt64`)-ロギングが行われたソースライン。 - -## システム。クエリーログ {#system_tables-query_log} - -クエリの実行に関する情報が含まれます。 各クエリについて、処理の開始時間、処理時間、エラーメッセージおよびその他の情報を確認できます。 - -!!! note "メモ" - テーブルには以下の入力データは含まれません `INSERT` クエリ。 - -ClickHouseはこのテーブルを作成します。 [クエリーログ](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) サーバパラメータを指定します。 このパラメーターは、ロギング間隔やクエリがログに記録されるテーブルの名前などのロギングルールを設定します。 - -するクエリのロギングの設定を [log\_queries](settings/settings.md#settings-log-queries) 1へのパラメータ。 詳細については、 [設定](settings/settings.md) セクション。 - -その `system.query_log` テーブルレジスタ二種類のクエリ: - -1. クライアントによって直接実行された初期クエリ。 -2. 他のクエリによって開始された子クエリ(分散クエリ実行用)。 これらのタイプのクエリについては、親クエリに関する情報が表示されます。 `initial_*` 列。 - -列: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` クエリ、書き込まれた行の数。 他のクエリの場合、列の値は0です。 -- `written_bytes` (UInt64) — For `INSERT` クエリ、書き込まれたバイト数。 他のクエリの場合、列の値は0です。 -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [クリックハウス-顧客](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [クリックハウス-顧客](../interfaces/cli.md) または他のTCPクライアントが実行されます。 -- `client_name` (String) — The [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント名。 -- `client_revision` (UInt32) — Revision of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 -- `client_version_major` (UInt32) — Major version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 -- `client_version_minor` (UInt32) — Minor version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 -- `client_version_patch` (UInt32) — Patch component of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアン -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` 方法を用いた。 - - 2 — `POST` 方法を用いた。 -- `http_user_agent` (String) — The `UserAgent` HTTP要求で渡されるヘッダー。 -- `quota_key` (String) — The “quota key” で指定される [クォータ](quotas.md) 設定(参照 `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [システム。イベント](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` コラム -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` 1へのパラメータ。 -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` コラム - -それぞれのクエリでは、次の行が作成されます。 `query_log` クエリのステータスに応じたテーブル: - -1. クエリの実行が成功すると、タイプ1とタイプ2のイベントが作成されます。 `type` 列)。 -2. クエリ処理中にエラーが発生した場合は、タイプ1とタイプ4のイベントが作成されます。 -3. クエリを起動する前にエラーが発生した場合は、タイプ3の単一のイベントが作成されます。 - -デフォルトでは、7.5秒間隔でログがテーブルに追加されます。 この間隔を設定することができます [クエリーログ](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) サーバー設定(参照してください `flush_interval_milliseconds` パラメータ)。 フラッシュを強制的にログからのメモリバッファ、テーブルを使用 `SYSTEM FLUSH LOGS` クエリ。 - -テーブルが手動で削除されると、その場で自動的に作成されます。 以前のログはすべて削除されることに注意してください。 - -!!! note "メモ" - ログの保存期間は無制限です。 ログはテーブルから自動的に削除されません。 古いログの削除を自分で整理する必要があります。 - -任意のパーティション分割キーを指定できます。 `system.query_log` のテーブル [クエリーログ](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) サーバー設定(参照してください `partition_by` パラメータ)。 - -## システム。query\_thread\_log {#system_tables-query-thread-log} - -のテーブルについての情報が含まれてそれぞれの検索キーワード実行スレッド. - -ClickHouseはこのテーブルを作成します。 [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) サーバパラメータを指定します。 このパラメーターは、ロギング間隔やクエリがログに記録されるテーブルの名前などのロギングルールを設定します。 - -するクエリのロギングの設定を [log\_query\_threads](settings/settings.md#settings-log-query-threads) 1へのパラメータ。 詳細については、 [設定](settings/settings.md) セクション。 - -列: - -- `event_date` (Date) — the date when the thread has finished execution of the query. -- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` クエリ、書き込まれた行の数。 他のクエリの場合、列の値は0です。 -- `written_bytes` (UInt64) — For `INSERT` クエリ、書き込まれたバイト数。 他のクエリの場合、列の値は0です。 -- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. -- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. -- `thread_name` (String) — Name of the thread. -- `thread_number` (UInt32) — Internal thread ID. -- `os_thread_id` (Int32) — OS thread ID. -- `master_thread_id` (UInt64) — OS initial ID of initial thread. -- `query` (String) — Query string. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [クリックハウス-顧客](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [クリックハウス-顧客](../interfaces/cli.md) または他のTCPクライアントが実行されます。 -- `client_name` (String) — The [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント名。 -- `client_revision` (UInt32) — Revision of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 -- `client_version_major` (UInt32) — Major version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 -- `client_version_minor` (UInt32) — Minor version of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアント。 -- `client_version_patch` (UInt32) — Patch component of the [クリックハウス-顧客](../interfaces/cli.md) または別のTCPクライアン -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` 方法を用いた。 - - 2 — `POST` 方法を用いた。 -- `http_user_agent` (String) — The `UserAgent` HTTP要求で渡されるヘッダー。 -- `quota_key` (String) — The “quota key” で指定される [クォータ](quotas.md) 設定(参照 `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [システム。イベント](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` コラム - -デフォルトでは、7.5秒間隔でログがテーブルに追加されます。 この間隔を設定することができます [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) サーバー設定(参照してください `flush_interval_milliseconds` パラメータ)。 フラッシュを強制的にログからのメモリバッファ、テーブルを使用 `SYSTEM FLUSH LOGS` クエリ。 - -テーブルが手動で削除されると、その場で自動的に作成されます。 以前のログはすべて削除されることに注意してください。 - -!!! note "メモ" - ログの保存期間は無制限です。 ログはテーブルから自動的に削除されません。 古いログの削除を自分で整理する必要があります。 - -任意のパーティション分割キーを指定できます。 `system.query_thread_log` のテーブル [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) サーバー設定(参照してください `partition_by` パラメータ)。 - -## システム。trace\_log {#system_tables-trace_log} - -サンプリングクエリプ - -ClickHouseはこのテーブルを作成します [trace\_log](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) サーバの設定が設定されます。 また、 [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) と [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) 設定は設定する必要があります。 - -ログを分析するには、以下を使用します `addressToLine`, `addressToSymbol` と `demangle` イントロスペクション関数。 - -列: - -- `event_date`([日付](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time`([DateTime](../sql_reference/data_types/datetime.md)) — Timestamp of sampling moment. - -- `revision`([UInt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - サーバーに接続する場合 `clickhouse-client`、あなたは次のような文字列が表示されます `Connected to ClickHouse server version 19.18.1 revision 54429.`. このフィールドには、 `revision`、しかしない `version` サーバーの。 - -- `timer_type`([Enum8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` 壁時計の時刻を表します。 - - `CPU` CPU時間を表します。 - -- `thread_number`([UInt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id`([文字列](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [クエリーログ](#system_tables-query_log) システムテーブル。 - -- `trace`([配列(uint64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**例えば** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## システム。レプリカ {#system_tables-replicas} - -情報および状況を再現しテーブル在住の地元のサーバーです。 -このテーブルは、監視に使用できます。 のテーブルが含まれて行毎に再現\*ます。 - -例えば: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -列: - -- `database` (`String`)-データベース名 -- `table` (`String`)-テーブル名 -- `engine` (`String`)-テーブルエンジン名 -- `is_leader` (`UInt8`)-レプリカがリーダーであるかどうか。 - リーダーは一度にひとつのレプリカのみです。 リーダーは実行するバックグラウンドマージの選択を担当します。 - 書き込みは、リーダーであるかどうかにかかわらず、利用可能であり、zkにセッションを持つ任意のレプリカに対して実行できます。 -- `can_become_leader` (`UInt8`)-レプリカをリーダーとして選出できるかどうか。 -- `is_readonly` (`UInt8`)-レプリカが読み取り専用モードであるかどうか。 - このモードは、zookeeperでセッションを再初期化するときに不明なエラーが発生した場合、およびzookeeperでのセッション再初期化中に、zookeeperとのセクションが設定さ -- `is_session_expired` (`UInt8`)-ZooKeeperとのセッションが終了しました。 基本的には `is_readonly`. -- `future_parts` (`UInt32`)-まだ行われていない挿入またはマージの結果として表示されるデータパーツの数。 -- `parts_to_check` (`UInt32`)-検証のためのキュー内のデータパーツの数。 破損している可能性があるという疑いがある場合、部品は検証キューに入れられます。 -- `zookeeper_path` (`String`)-ZooKeeperのテーブルデータへのパス。 -- `replica_name` (`String`)-飼育係のレプリカ名。 異なるレプリカと同じテーブルの異名をとります。 -- `replica_path` (`String`)-飼育係のレプリカデータへのパス。 連結と同じです ‘zookeeper\_path/replicas/replica\_path’. -- `columns_version` (`Int32`)-テーブル構造のバージョン番号。 ALTERが実行された回数を示します。 場合にレプリカは異なるバージョンで一部のレプリカさんのすべての変更はまだない。 -- `queue_size` (`UInt32`)-実行待ち操作のキューのサイズ。 業務などのブロックを挿入し、データ統合し、行動します。 それは通常 `future_parts`. -- `inserts_in_queue` (`UInt32`)-作成する必要があるデータブロックの挿入数。 挿入は、通常、かなり迅速に複製されます。 この数が大きい場合は、何かが間違っていることを意味します。 -- `merges_in_queue` (`UInt32`)-作成されるのを待機しているマージの数。 マージが時間がかかることがあるので、この値は長い間ゼロより大きくなることがあります。 -- `part_mutations_in_queue` (`UInt32`)-作られるのを待っている突然変異の数。 -- `queue_oldest_time` (`DateTime`)-If `queue_size` 0より大きい場合、最も古い操作がキューに追加された日時が表示されます。 -- `inserts_oldest_time` (`DateTime`)-見る `queue_oldest_time` -- `merges_oldest_time` (`DateTime`)-見る `queue_oldest_time` -- `part_mutations_oldest_time` (`DateTime`)-見る `queue_oldest_time` - -次の4列は、zkとのアクティブなセッションがある場合にのみ、ゼロ以外の値を持ちます。 - -- `log_max_index` (`UInt64`)-一般的な活動のログの最大エントリ番号。 -- `log_pointer` (`UInt64`)-レプリカが実行キューにコピーした一般的なアクティビティのログの最大エントリ番号。 もし `log_pointer` はるかに小さいよりも `log_max_index`、何かが間違っている。 -- `last_queue_update` (`DateTime`)-キューが前回updatedされたとき。 -- `absolute_delay` (`UInt64`)-どのように大きな遅れ秒で現在のレプリカがあります。 -- `total_replicas` (`UInt8`)-このテーブルの既知のレプリカの総数。 -- `active_replicas` (`UInt8`)-ZooKeeperでセッションを持つこのテーブルのレプリカの数(つまり、機能するレプリカの数)。 - -希望される場合は、すべての列は、テーブルが少しゆっくりと、くつかの読み込みから飼育係したがって行います。 -最後の4列(log\_max\_index、log\_pointer、total\_replicas、active\_replicas)を要求しないと、テーブルはすぐに動作します。 - -たとえば、次のようにすべてが正常に動作していることを確認できます: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -このクエリが何も返さない場合は、すべてが正常であることを意味します。 - -## システム。設定 {#system-settings} - -現在使用中の設定に関する情報が含まれます。 -つまり、システムからの読み取りに使用しているクエリを実行するために使用されます。設定テーブル. - -列: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. -- `min` (Nullable(String)) — Get minimum allowed value (if any is set via [制約](settings/constraints_on_settings.md#constraints-on-settings)). -- `max` (Nullable(String)) — Get maximum allowed value (if any is set via [制約](settings/constraints_on_settings.md#constraints-on-settings)). -- `readonly` (UInt8) — Can user change this setting (for more info, look into [制約](settings/constraints_on_settings.md#constraints-on-settings)). - -例えば: - -``` sql -SELECT name, value -FROM system.settings -WHERE changed -``` - -``` text -┌─name───────────────────┬─value───────┐ -│ max_threads │ 8 │ -│ use_uncompressed_cache │ 0 │ -│ load_balancing │ random │ -│ max_memory_usage │ 10000000000 │ -└────────────────────────┴─────────────┘ -``` - -## システム。merge\_tree\_settings {#system-merge_tree_settings} - -についての情報が含まれて設定 `MergeTree` テーブル。 - -列: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. - -## システム。table\_engines {#system-table-engines} - -を含むの記述のテーブルエンジンをサポートサーバーとその特徴を支援す。 - -このテーブル以下のカラムのカラムタイプはブラケット): - -- `name` (String) — The name of table engine. -- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` 句。 -- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [索引のスキップ](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` と `SAMPLE_BY`. -- `supports_replication` (UInt8) — Flag that indicates if table engine supports [データ複製](../engines/table_engines/mergetree_family/replication.md). -- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. - -例えば: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**また見なさい** - -- マージツリーファミリー [クエリ句](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) -- カフカname [設定](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) -- 参加 [設定](../engines/table_engines/special/join.md#join-limitations-and-settings) - -## システム。テーブル {#system-tables} - -を含むメタデータは各テーブルサーバーに知っています。 デタッチされたテーブルは `system.tables`. - -このテーブル以下のカラムのカラムタイプはブラケット): - -- `database` (String) — The name of the database the table is in. - -- `name` (String) — Table name. - -- `engine` (String) — Table engine name (without parameters). - -- `is_temporary` (UInt8)-テーブルが一時的かどうかを示すフラグ。 - -- `data_path` (文字列)-ファイルシステム内のテーブルデータへのパス。 - -- `metadata_path` (String)-ファイルシステム内のテーブルメタデータへのパス。 - -- `metadata_modification_time` (DateTime)-テーブルメタデータの最新の変更の時刻。 - -- `dependencies_database` (Array(String))-データベースの依存関係。 - -- `dependencies_table` (Array(String))-テーブルの依存関係 ([MaterializedView](../engines/table_engines/special/materializedview.md) 現在のテーブルに基づくテーブル)。 - -- `create_table_query` (String)-テーブルの作成に使用されたクエリ。 - -- `engine_full` (String)-テーブルエンジンのパラメータ。 - -- `partition_key` (String)-テーブルで指定されたパーティションキー式。 - -- `sorting_key` (String)-テーブルで指定された並べ替えキー式。 - -- `primary_key` (String)-テーブルで指定された主キー式。 - -- `sampling_key` (String)-テーブルで指定されたサンプリングキー式。 - -- `storage_policy` (文字列)-ストレージポリシー: - - - [MergeTree](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) - - [分散](../engines/table_engines/special/distributed.md#distributed) - -- `total_rows` (Nullable(UInt64))-テーブル内の正確な行数をすばやく決定できる場合は、行の総数。 `Null` (含むunderying `Buffer` テーブル)。 - -- `total_bytes` (Nullable(UInt64))-ストレージ上のテーブルの正確なバイト数を迅速に決定できる場合は、合計バイト数。 `Null` (**しない** を含みます)。 - - - If the table stores data on disk, returns used space on disk (i.e. compressed). - - テーブルがメモリにデータを格納する場合,メモリ内の使用バイトの近似数を返します. - -その `system.tables` テーブルは `SHOW TABLES` クエリの実装。 - -## システム。zookeeper {#system-zookeeper} - -ZooKeeperが設定されていない場合、テーブルは存在しません。 できるデータを読み込んで飼育係クラスタで定義され、config. -クエリには次のものが必要です ‘path’ WHERE句の等価条件です。 これは、データを取得したい子供のためのZooKeeperのパスです。 - -クエリ `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` すべての子のデータを出力します。 `/clickhouse` ノード -すべてのルートノードのデータを出力するには、path= ‘/’. -で指定されたパスの場合 ‘path’ 存在しない場合、例外がスローされます。 - -列: - -- `name` (String) — The name of the node. -- `path` (String) — The path to the node. -- `value` (String) — Node value. -- `dataLength` (Int32) — Size of the value. -- `numChildren` (Int32) — Number of descendants. -- `czxid` (Int64) — ID of the transaction that created the node. -- `mzxid` (Int64) — ID of the transaction that last changed the node. -- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. -- `ctime` (DateTime) — Time of node creation. -- `mtime` (DateTime) — Time of the last modification of the node. -- `version` (Int32) — Node version: the number of times the node was changed. -- `cversion` (Int32) — Number of added or removed descendants. -- `aversion` (Int32) — Number of changes to the ACL. -- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. - -例えば: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## システム。突然変異 {#system_tables-mutations} - -のテーブルについての情報が含まれて [突然変異](../sql_reference/statements/alter.md#alter-mutations) マージツリーテーブルとその進捗状況の。 各突然変異コマンドは、単一の行で表されます。 テーブルには次の列があります: - -**データ**, **テーブル** -突然変異が適用されたデータベースとテーブルの名前。 - -**mutation\_id** -変異のID。 のための複製のテーブルこのIdに対応すznode名の `/mutations/` ZooKeeperのディレクトリ。 複雑でないテーブルの場合、Idはテーブルのデータディレクトリ内のファイル名に対応します。 - -**コマンド** -突然変異コマンド文字列(後のクエリの一部 `ALTER TABLE [db.]table`). - -**create\_time** -この突然変異コマンドが実行のために提出されたとき。 - -**ブロック番号。partition\_id**, **ブロック番号。番号** -入れ子になった列。 つまり、パーティションIDと、そのパーティションの変更によって取得されたブロック番号より小さい数のブロックを含むパーティションのみが変更さ 非複製のテーブル、ブロック番号の全ての仕切りがひとつのシーケンスです。 こないということを意味している変異体再現し、テーブルの列として展開しているのが記録するとともにシングルブロック番号の取得による突然変異が原因です。 - -**parts\_to\_do** -突然変異が終了するために突然変異する必要があるデータ部分の数。 - -**is\_done** -変異は終わったのか? たとえそうであっても `parts_to_do = 0` レプリケートされたテーブルの変更は、変更する必要のある新しいデータ部分を作成する実行時間の長いINSERTのためにまだ行われていない可能性があり - -一部の部分の変更に問題があった場合、次の列には追加情報が含まれています: - -**latest\_failed\_part** -突然変異できなかった最新の部分の名前。 - -**latest\_fail\_time** -最も最近の部分変異失敗の時間。 - -**latest\_fail\_reason** -最も最近の部分の突然変異の失敗を引き起こした例外メッセージ。 - -## システム。ディスク {#system_tables-disks} - -についての情報が含まれてディスクの定義に [サーバー構成](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -列: - -- `name` ([文字列](../sql_reference/data_types/string.md)) — Name of a disk in the server configuration. -- `path` ([文字列](../sql_reference/data_types/string.md)) — Path to the mount point in the file system. -- `free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Free space on disk in bytes. -- `total_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Disk volume in bytes. -- `keep_free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` ディスク構成のパラメータ。 - -## システム。ストレージ\_policies {#system_tables-storage_policies} - -についての情報が含まれて保管方針の量を定義する [サーバー構成](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -列: - -- `policy_name` ([文字列](../sql_reference/data_types/string.md)) — Name of the storage policy. -- `volume_name` ([文字列](../sql_reference/data_types/string.md)) — Volume name defined in the storage policy. -- `volume_priority` ([UInt64](../sql_reference/data_types/int_uint.md)) — Volume order number in the configuration. -- `disks` ([配列(文字列)](../sql_reference/data_types/array.md)) — Disk names, defined in the storage policy. -- `max_data_part_size` ([UInt64](../sql_reference/data_types/int_uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). -- `move_factor` ([Float64](../sql_reference/data_types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. - -ストレージポリシーに複数のボリュームが含まれている場合、各ボリュームの情報はテーブルの個々の行に格納されます。 - -[元の記事](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/ja/operations/tips.md b/docs/ja/operations/tips.md index 92a13d27f2c..e57d94b9b10 100644 --- a/docs/ja/operations/tips.md +++ b/docs/ja/operations/tips.md @@ -97,7 +97,7 @@ IPv6を使用している場合は、ルートキャッシュのサイズを大 おそらく既にzookeeperを他の目的で使用しているでしょう。 それがまだ過負荷になっていない場合は、zookeeperと同じインストールを使用できます。 -It's best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. +It’s best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. 異なるzookeeperクラスタ間でデータを転送するために手動で記述されたスクリプトを使用することはありません。 決して使用 “zkcopy” 同じ理由でユーティリティ:https://github.com/ksprojects/zkcopy/issues/15 diff --git a/docs/ja/operations/troubleshooting.md b/docs/ja/operations/troubleshooting.md index 91545454b9e..b4169a746b6 100644 --- a/docs/ja/operations/troubleshooting.md +++ b/docs/ja/operations/troubleshooting.md @@ -17,7 +17,7 @@ toc_title: "\u30C8\u30E9\u30D6\u30EB" ### Apt-getでClickhouseリポジトリからDebパッケージを取得できません {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} - ファイア -- できない場合はアクセスリポジトリのために、何らかの理由でダウンロードパッケージに記載のとおり [はじめに](../getting_started/index.md) を使用して手動でインストールします。 `sudo dpkg -i ` 司令部 また、必要になります `tzdata` パッケージ。 +- できない場合はアクセスリポジトリのために、何らかの理由でダウンロードパッケージに記載のとおり [はじめに](../getting-started/index.md) を使用して手動でインストールします。 `sudo dpkg -i ` 司令部 また、必要になります `tzdata` パッケージ。 ## サーバーへの接続 {#troubleshooting-accepts-no-connections} @@ -105,7 +105,7 @@ $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-se - エンドポイント設定。 - チェック [listen\_host](server_configuration_parameters/settings.md#server_configuration_parameters-listen_host) と [tcp\_portgenericname](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port) 設定。 + チェック [listen\_host](server-configuration-parameters/settings.md#server_configuration_parameters-listen_host) と [tcp\_portgenericname](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port) 設定。 ClickHouseサーバーを受け入れlocalhostの接続のみによるデフォルトです。 @@ -117,8 +117,8 @@ $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-se チェック: - - その [tcp\_port\_secure](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) 設定。 - - の設定 [SSL sertificates](server_configuration_parameters/settings.md#server_configuration_parameters-openssl). + - その [tcp\_port\_secure](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) 設定。 + - の設定 [SSL sertificates](server-configuration-parameters/settings.md#server_configuration_parameters-openssl). 適切なパラメータを接続 たとえば、以下を使用します `port_secure` 変数との `clickhouse_client`. diff --git a/docs/ja/operations/utilities/clickhouse-benchmark.md b/docs/ja/operations/utilities/clickhouse-benchmark.md index f51d5f5001e..eeb90b0a7b5 100644 --- a/docs/ja/operations/utilities/clickhouse-benchmark.md +++ b/docs/ja/operations/utilities/clickhouse-benchmark.md @@ -101,7 +101,7 @@ localhost:9000, queries 10, QPS: 6.772, RPS: 67904487.440, MiB/s: 518.070, resul ## 比較モード {#clickhouse-benchmark-comparison-mode} -`clickhouse-benchmark` ツつィツ姪"ツつ"ツ債ツづュツつケ +`clickhouse-benchmark` ツつィツ姪“ツつ”ツ債ツづュツつケ 利用の比較モードを指定し端のサーバーによるペア `--host`, `--port` 鍵を キーは、最初の引数リスト内の位置によって一致します `--host` は最初のものと一致します `--port` というように。 `clickhouse-benchmark` 両方のサーバーへの接続を確立し、クエリを送信します。 各クエリは、ランダムに選択されたサーバー宛。 結果は、サーバーごとに個別に表示されます。 diff --git a/docs/ja/operations/utilities/clickhouse-local.md b/docs/ja/operations/utilities/clickhouse-local.md index 07956919861..5f6bfc1c399 100644 --- a/docs/ja/operations/utilities/clickhouse-local.md +++ b/docs/ja/operations/utilities/clickhouse-local.md @@ -9,7 +9,7 @@ toc_title: "\uFF82\u3064\"\uFF82\u3065\u6309\u3064\uFF75\uFF82\uFF01" その `clickhouse-local` プログラムは、展開し、ClickHouseサーバーを構成することなく、ローカルファイルに高速処理を実行できます。 -データを受け入れを表すテーブル、クエリを利用して [クリックハウスsql方言](../../sql_reference/index.md). +データを受け入れを表すテーブル、クエリを利用して [クリックハウスsql方言](../../sql-reference/index.md). `clickhouse-local` ClickHouse serverと同じコアを使用するため、ほとんどの機能と同じフォーマットとテーブルエンジンをサポートします。 diff --git a/docs/ja/sql-reference/aggregate-functions/combinators.md b/docs/ja/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..37c7bd41c16 --- /dev/null +++ b/docs/ja/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,166 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u96C6\u8A08\u95A2\u6570\u306E\u30B3\u30F3\u30D3\u30CD\u30FC\u30BF" +--- + +# 集計関数のコンビネータ {#aggregate_functions_combinators} + +集計関数の名前には、それに接尾辞を付けることができます。 これにより、集計関数の動作方法が変更されます。 + +## -もし {#agg-functions-combinator-if} + +The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). + +例: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` というように。 + +条件付集計関数を使用すると、サブクエリを使用せずに複数の条件の集計を一度に計算できます。 `JOIN`例えば、Yandexの中。Metrica、条件付き集約関数は、セグメント比較機能を実装するために使用されます。 + +## -配列 {#agg-functions-combinator-array} + +-arrayサフィックスは、任意の集計関数に追加できます。 この場合、aggregate関数は次の引数を取ります ‘Array(T)’ 代わりにタイプ(配列) ‘T’ 型引数。 集計関数が複数の引数を受け入れる場合、これは同じ長さの配列でなければなりません。 配列を処理する場合、aggregate関数は、すべての配列要素にわたって元の集計関数と同様に機能します。 + +例1: `sumArray(arr)` -すべてのすべての要素を合計します ‘arr’ 配列だ この例では、より簡単に書かれている可能性があります: `sum(arraySum(arr))`. + +例2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ 配列だ これは簡単な方法で行うことができます: `uniq(arrayJoin(arr))` しかし、それは常に追加することはできません ‘arrayJoin’ クエリに。 + +-Ifと-配列を組み合わせることができます。 しかし, ‘Array’ 第一だから、その ‘If’. 例: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. この順序のために、 ‘cond’ 引数は配列ではありません。 + +## -状態 {#agg-functions-combinator-state} + +このコンビネーターを適用すると、集計関数は結果の値を返しません(たとえば、このコンビネーターの一意の値の数など)。 [uniq](reference.md#agg_function-uniq) の中間状態である。 `uniq`、これは一意の値の数を計算するためのハッシュテーブルです)。 これは `AggregateFunction(...)` これをさらなる処理に使用したり、テーブルに格納して後で集計を完了することができます。 + +これらの国は、利用: + +- [ツつィツ姪“ツつ”ツ債ツづュツつケ](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) テーブルエンジン。 +- [finalizeAggregation](../../sql-reference/functions/other-functions.md#function-finalizeaggregation) 機能。 +- [runningAccumulate](../../sql-reference/functions/other-functions.md#function-runningaccumulate) 機能。 +- [-マージ](#aggregate_functions_combinators_merge) コンビネータ +- [-MergeState](#aggregate_functions_combinators_mergestate) コンビネータ + +## -マージ {#aggregate_functions_combinators-merge} + +このコンビネーターを適用すると、aggregate関数は中間の集約状態を引数として受け取り、状態を結合して集計を終了し、結果の値を返します。 + +## -MergeState {#aggregate_functions_combinators-mergestate} + +-mergeコンビネータと同じ方法で中間の集約状態をマージします。 しかし、結果の値を返すのではなく、-stateコンビネータに似た中間の集約状態を返します。 + +## -ForEach {#agg-functions-combinator-foreach} + +テーブルの集計関数を、対応する配列項目を集約して結果の配列を返す配列の集計関数に変換します。 例えば, `sumForEach` 配列の場合 `[1, 2]`, `[3, 4, 5]`と`[6, 7]`結果を返します `[10, 13, 5]` 対応する配列項目を一緒に追加した後。 + +## -オルデフォルト {#agg-functions-combinator-ordefault} + +集約する値が何もない場合は、集計関数の戻り値のデフォルト値を設定します。 + +``` sql +SELECT avg(number), avgOrDefault(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrDefault(number)─┐ +│ nan │ 0 │ +└─────────────┴──────────────────────┘ +``` + +## -オルヌル {#agg-functions-combinator-ornull} + +塗りつぶし `null` 集計するものがない場合。 戻り列はnull可能になります。 + +``` sql +SELECT avg(number), avgOrNull(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrNull(number)─┐ +│ nan │ ᴺᵁᴸᴸ │ +└─────────────┴───────────────────┘ +``` + +-OrDefaultと-OrNullは他のコンビネータと組み合わせることができます。 これは、集計関数が空の入力を受け入れない場合に便利です。 + +``` sql +SELECT avgOrNullIf(x, x > 10) +FROM +( + SELECT toDecimal32(1.23, 2) AS x +) +``` + +``` text +┌─avgOrNullIf(x, greater(x, 10))─┐ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────┘ +``` + +## -リサンプル {#agg-functions-combinator-resample} + +データをグループに分割し、それらのグループのデータを個別に集計できます。 グループは、ある列の値を間隔に分割することによって作成されます。 + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**パラメータ** + +- `start` — Starting value of the whole required interval for `resampling_key` 値。 +- `stop` — Ending value of the whole required interval for `resampling_key` 値。 全体の間隔は含まれていません `stop` 値 `[start, stop)`. +- `step` — Step for separating the whole interval into subintervals. The `aggFunction` 実行されるそれぞれのsubintervals。 +- `resampling_key` — Column whose values are used for separating data into intervals. +- `aggFunction_params` — `aggFunction` パラメータ。 + +**戻り値** + +- の配列 `aggFunction` 各サブインターバルの結果。 + +**例えば** + +考慮する `people` テーブルのデータ: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +のは、その年齢の間隔にある人の名前を取得してみましょう `[30,60)` と `[60,75)`. 私たちは年齢の整数表現を使用しているので、私たちはで年齢を取得します `[30, 59]` と `[60,74]` 間隔。 + +配列内の名前を集約するには、次のものを使用します [グルーパー](reference.md#agg_function-grouparray) 集計関数。 それは一つの議論を取る。 私たちの場合、それは `name` コラム その `groupArrayResample` 関数は `age` 年齢別に名前を集計する列。 必要な間隔を定義するために、 `30, 75, 30` への引数 `groupArrayResample` 機能。 + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) FROM people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +結果を考慮する。 + +`Jonh` 彼は若すぎるので、サンプルの外です。 他の人は、指定された年齢区間に従って配布されます。 + +プラグインのインス数の合計人数とその平均賃金には、指定された年齢の間隔とします。 + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/ja/sql-reference/aggregate-functions/index.md b/docs/ja/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..09234931f1f --- /dev/null +++ b/docs/ja/sql-reference/aggregate-functions/index.md @@ -0,0 +1,62 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Aggregate Functions +toc_priority: 33 +toc_title: "\u5C0E\u5165" +--- + +# 集計関数 {#aggregate-functions} + +集計関数は、 [通常の](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) 方法として期待されデータベースの専門家です。 + +ClickHouseはまた支えます: + +- [パラメトリックに集計機能](parametric-functions.md#aggregate_functions_parametric) 列に加えて他のパラメータを受け入れる。 +- [Combinators](combinators.md#aggregate_functions_combinators)、集計関数の動作を変更します。 + +## NULLの場合の処理 {#null-processing} + +集計中、すべて `NULL`sはスキップされます。 + +**例:** + +この表を考慮する: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +の値を合計する必要があるとしましょう `y` 列: + +``` sql +SELECT sum(y) FROM t_null_big +``` + + ┌─sum(y)─┐ + │ 7 │ + └────────┘ + +その `sum` 関数の解釈 `NULL` として `0`. 特に、これは、関数がすべての値がある選択の入力を受け取った場合 `NULL` その後、結果は次のようになります `0`、ない `NULL`. + +今すぐ使用できます `groupArray` から配列を作成する関数 `y` 列: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` 含まれていません `NULL` 結果の配列です。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/ja/sql-reference/aggregate-functions/parametric-functions.md b/docs/ja/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..359fd8975a2 --- /dev/null +++ b/docs/ja/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,499 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: "\u30D1\u30E9\u30E1\u30C8\u30EA\u30C3\u30AF\u96C6\u8A08\u95A2\u6570" +--- + +# パラメトリック集計関数 {#aggregate_functions_parametric} + +Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. + +## ヒストグラム {#histogram} + +適応ヒストグラムを計算します。 正確な結果を保証するものではありません。 + +``` sql +histogram(number_of_bins)(values) +``` + +関数は以下を使用します [ストリーミングの並列決定木アルゴリズム](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). ヒストグラムビンの境界は、新しいデータが関数に入ると調整されます。 一般的なケースでは、ビンの幅は等しくありません。 + +**パラメータ** + +`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. +`values` — [式](../syntax.md#syntax-expressions) その結果、入力値が得られます。 + +**戻り値** + +- [配列](../../sql-reference/data-types/array.md) の [タプル](../../sql-reference/data-types/tuple.md) 次の形式の: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — Lower bound of the bin. + - `upper` — Upper bound of the bin. + - `height` — Calculated height of the bin. + +**例えば** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +ヒストグラムを視覚化することができます [バー](../../sql-reference/functions/other-functions.md#function-bar) たとえば、関数: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +この場合、ヒストグラムビンの境界線がわからないことを覚えておく必要があります。 + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +かどうかをチェックします配列を含むイベントのチェーンに一致するパターンです。 + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "警告" + 同じ秒で発生するイベントは、結果に影響を与える未定義の順序でシーケンス内に置くことができます。 + +**パラメータ** + +- `pattern` — Pattern string. See [パターン構文](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` と `DateTime`. も利用できますの対応 [UInt](../../sql-reference/data-types/int-uint.md) データ型。 + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最大32個の条件引数を渡すことができます。 この関数は、これらの条件で説明されているイベントのみを考慮します。 シーケンスに条件に記述されていないデータが含まれている場合、関数はそれらをスキップします。 + +**戻り値** + +- パターンが一致すれば、1。 +- 0、パターンが一致しない場合。 + +タイプ: `UInt8`. + + +**パターン構文** + +- `(?N)` — Matches the condition argument at position `N`. 条件には、 `[1, 32]` 範囲。 例えば, `(?1)` に渡された引数にマッチします。 `cond1` パラメータ。 + +- `.*` — Matches any number of events. You don’t need conditional arguments to match this element of the pattern. + +- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` 互いに1800秒を超えて発生するイベントに一致します。 任意の数は、当社が定めるインターネットを築くことです。 を使用することができ `>=`, `>`, `<`, `<=` 演算子。 + +**例** + +のデータを考慮して下さい `t` テーブル: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +クエリの実行: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +この関数は、番号2が番号1に続くイベントチェーンを見つけました。 数字はイベントとして記述されていないため、3番をスキップしました。 この例で与えられたイベントチェーンを検索するときにこの番号を考慮に入れたい場合は、その条件を作成する必要があります。 + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +この場合、関数は、3番のイベントが1と2の間で発生したため、パターンに一致するイベントチェーンを見つけることができませんでした。 同じケースで4の条件をチェックした場合、シーケンスはパターンに一致します。 + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**また見なさい** + +- [sequenceCount](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +パターンに一致するイベントチェーンの数を数えます。 この関数は、重複しないイベントチェーンを検索します。 現在のチェーンが一致した後、次のチェーンの検索を開始します。 + +!!! warning "警告" + 同じ秒で発生するイベントは、結果に影響を与える未定義の順序でシーケンス内に置くことができます。 + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**パラメータ** + +- `pattern` — Pattern string. See [パターン構文](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` と `DateTime`. も利用できますの対応 [UInt](../../sql-reference/data-types/int-uint.md) データ型。 + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最大32個の条件引数を渡すことができます。 この関数は、これらの条件で説明されているイベントのみを考慮します。 シーケンスに条件に記述されていないデータが含まれている場合、関数はそれらをスキップします。 + +**戻り値** + +- 一致する重複しないイベントチェーンの数。 + +タイプ: `UInt64`. + +**例えば** + +のデータを考慮して下さい `t` テーブル: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +数2は、それらの間の他の数字の任意の量と数1の後に発生した回数をカウント: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**また見なさい** + +- [sequenceMatch](#function-sequencematch) + +## windowfunnelcomment {#windowfunnel} + +スライドタイムウィンドウでイベントチェーンを検索し、チェーンから発生したイベントの最大数を計算します。 + +関数はアルゴリズムに従って動作します: + +- この関数は、チェーン内の最初の条件をトリガーするデータを検索し、イベントカウンターを1に設定します。 これは、スライドウィンドウが始まる瞬間です。 + +- だから、チェーンが順次内のウインドウのカウンタを増加されます。 イベントのシーケンスが中断された場合、カウンターは増分されません。 + +- データにさまざまな完了点で複数のイベントチェーンがある場合、関数は最長チェーンのサイズのみを出力します。 + +**構文** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**パラメータ** + +- `window` — Length of the sliding window in seconds. +- `mode` -省略可能な引数です。 + - `'strict'` -とき `'strict'` windowFunnel()は、一意の値に対してのみ条件を適用します。 +- `timestamp` — Name of the column containing the timestamp. Data types supported: [日付](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) その他の符号なし整数型(timestampがサポートしているにもかかわらず `UInt64` 値はInt64最大値を超えることはできません.2^63-1)。 +- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +スライディングタイムウィンドウ内のチェーンからの連続トリガー条件の最大数。 +選択内のすべてのチェーンが分析されます。 + +タイプ: `Integer`. + +**例えば** + +ユーザーが電話を選択してオンラインストアで二度購入するのに十分な期間が設定されているかどうかを判断します。 + +次の一連のイベントを設定します: + +1. ユーザーがストアのアカウントにログインした場合 (`eventID = 1003`). +2. ユーザーは電話を検索します (`eventID = 1007, product = 'phone'`). +3. ユーザーが注文した (`eventID = 1009`). +4. ユーザーが再び注文した (`eventID = 1010`). + +入力テーブル: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +ユーザーの距離を調べる `user_id` を介して得ることができるチェーンで期間で月-月の2019。 + +クエリ: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +結果: + +``` text +┌─level─┬─c─┐ +│ 4 │ 1 │ +└───────┴───┘ +``` + +## 保持 {#retention} + +関数は引数として1から32までの条件のセットを受け取ります。 `UInt8` るかどうかを示す一定の条件を満ためのイベントです。 +任意の条件を引数として指定することができます。 [WHERE](../../sql-reference/statements/select.md#select-where)). + +第一と第二が真であれば第二の結果は真であり、第一と第二が真であれば第三の結果は真である。 + +**構文** + +``` sql +retention(cond1, cond2, ..., cond32); +``` + +**パラメータ** + +- `cond` — an expression that returns a `UInt8` 結果(1または0)。 + +**戻り値** + +1または0の配列。 + +- 1 — condition was met for the event. +- 0 — condition wasn’t met for the event. + +タイプ: `UInt8`. + +**例えば** + +の計算の例を考えてみましょう `retention` サイトトラフィックを決定する機能。 + +**1.** Сreate a table to illustrate an example. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +入力テーブル: + +クエリ: + +``` sql +SELECT * FROM retention_test +``` + +結果: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** グループのユーザーによるユニークID `uid` を使用して `retention` 機能。 + +クエリ: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +結果: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** 一日あたりのサイト訪問の合計数を計算します。 + +クエリ: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +結果: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +どこに: + +- `r1`-2020-01-01の間にサイトを訪問したユニーク訪問者の数 `cond1` 条件)。 +- `r2`-2020-01-01から2020-01-02までの特定の期間にサイトを訪問したユニーク訪問者の数 (`cond1` と `cond2` 条件)。 +- `r3`-2020-01-01から2020-01-03までの特定の期間にサイトを訪問したユニーク訪問者の数 (`cond1` と `cond3` 条件)。 + +## uniqUpTo(N)(x) {#uniquptonx} + +Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. + +小さいnsの使用のために推薦される、10まで。 nの最大値は100です。 + +集計関数の状態については、1+n\*に等しいメモリの量をバイトの一つの値のサイズを使用しています。 +文字列の場合、8バイトの非暗号化ハッシュを格納します。 つまり、計算は文字列に対して近似されます。 + +この関数は、いくつかの引数でも機能します。 + +大きなn値が使用され、一意の値の数がnよりわずかに少ない場合を除いて、できるだけ速く動作します。 + +使用例: + +``` text +Problem: Generate a report that shows only keywords that produced at least 5 unique users. +Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) + +## sumMapFiltered(keys\_to\_keep)(キー、値) {#summapfilteredkeys-to-keepkeys-values} + +同じ動作として [sumMap](reference.md#agg_functions-summap) キーの配列がパラメータとして渡されることを除いて。 これは、キーの高い基数を扱うときに特に便利です。 diff --git a/docs/ja/sql-reference/aggregate-functions/reference.md b/docs/ja/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..5fecb1facd9 --- /dev/null +++ b/docs/ja/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1837 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: "\u53C2\u7167" +--- + +# 関数リファレンス {#function-reference} + +## カウント {#agg_function-count} + +行数またはnull以外の値をカウントします。 + +ClickHouseは以下の構文をサポートしています `count`: +- `count(expr)` または `COUNT(DISTINCT expr)`. +- `count()` または `COUNT(*)`. その `count()` 構文はClickHouse固有です。 + +**パラメータ** + +機能は取ることができます: + +- ゼロ変数。 +- ワン [式](../syntax.md#syntax-expressions). + +**戻り値** + +- 関数がパラメータなしで呼び出されると、行数がカウントされます。 +- この [式](../syntax.md#syntax-expressions) が渡されると、この関数は、この式がnullではなく返された回数をカウントします。 式がaを返す場合 [Nullable](../../sql-reference/data-types/nullable.md)-タイプ値、そして結果の `count` 滞在しない `Nullable`. 式が返された場合、関数は0を返します `NULL` すべての行について。 + +どちらの場合も、戻り値の型は次のようになります [UInt64](../../sql-reference/data-types/int-uint.md). + +**詳細** + +クリックハウスは `COUNT(DISTINCT ...)` 構文。 この構成の動作は、 [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) 設定。 それはどれをの定義します [uniq\*](#agg_function-uniq) 関数は、操作を実行するために使用されます。 デフォルトは [ユニキャック](#agg_function-uniqexact) 機能。 + +その `SELECT count() FROM table` テーブル内のエントリの数が別々に格納されていないため、クエリは最適化されません。 テーブルから小さな列を選択し、その中の値の数を数えます。 + +**例** + +例1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +例2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +この例では、 `count(DISTINCT num)` によって実行される。 `uniqExact` に従う機能 `count_distinct_implementation` 設定値。 + +## 任意(x) {#agg_function-any} + +最初に検出された値を選択します。 +クエリは、毎回異なる順序で実行することができるため、この関数の結果は不確定です。 +確定的な結果を得るには、 ‘min’ または ‘max’ 関数の代わりに ‘any’. + +場合によっては、実行順序に頼ることができます。 これは、order byを使用するサブクエリからのselectの場合に適用されます。 + +とき `SELECT` クエリには `GROUP BY` 句または少なくとも一つの集計関数、ClickHouse(MySQLとは対照的に)内のすべての式ということが必要です `SELECT`, `HAVING`、と `ORDER BY` 句は、キーまたは集計関数から計算されます。 つまり、テーブルから選択された各列は、キーまたは集計関数内で使用する必要があります。 MySQLのような動作を得るには、他の列を `any` 集計関数。 + +## anyHeavy(x) {#anyheavyx} + +頻繁に発生する値を選択します。 [ヘビーヒッターズ](http://www.cs.umd.edu/~samir/498/karp.pdf) アルゴリズムだ 各クエリの実行スレッドのケースの半分を超える値がある場合は、この値が返されます。 通常、結果は非決定的です。 + +``` sql +anyHeavy(column) +``` + +**引数** + +- `column` – The column name. + +**例えば** + +を取る [オンタイム](../../getting-started/example-datasets/ontime.md) データセットと選択頻繁に発生する値で `AirlineID` コラム + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## anyllast(x) {#anylastx} + +最後に検出された値を選択します。 +結果は、次の場合と同様に不確定です `any` 機能。 + +## groupBitAnd {#groupbitand} + +ビットごとの適用 `AND` 一連の数字のために。 + +``` sql +groupBitAnd(expr) +``` + +**パラメータ** + +`expr` – An expression that results in `UInt*` タイプ。 + +**戻り値** + +の値 `UInt*` タイプ。 + +**例えば** + +テストデータ: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +クエリ: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +どこに `num` テストデータの列です。 + +結果: + +``` text +binary decimal +00000100 = 4 +``` + +## groupBitOr {#groupbitor} + +ビットごとの適用 `OR` 一連の数字のために。 + +``` sql +groupBitOr(expr) +``` + +**パラメータ** + +`expr` – An expression that results in `UInt*` タイプ。 + +**戻り値** + +の値 `UInt*` タイプ。 + +**例えば** + +テストデータ: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +クエリ: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +どこに `num` テストデータの列です。 + +結果: + +``` text +binary decimal +01111101 = 125 +``` + +## groupBitXor {#groupbitxor} + +ビットごとの適用 `XOR` 一連の数字のために。 + +``` sql +groupBitXor(expr) +``` + +**パラメータ** + +`expr` – An expression that results in `UInt*` タイプ。 + +**戻り値** + +の値 `UInt*` タイプ。 + +**例えば** + +テストデータ: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +クエリ: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +どこに `num` テストデータの列です。 + +結果: + +``` text +binary decimal +01101000 = 104 +``` + +## groupBitmap {#groupbitmap} + +符号なし整数列からのビットマップ計算または集計計算を行い、uint64型のカーディナリティを返します。 [ビットマップ](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmap(expr) +``` + +**パラメータ** + +`expr` – An expression that results in `UInt*` タイプ。 + +**戻り値** + +の値 `UInt64` タイプ。 + +**例えば** + +テストデータ: + +``` text +UserID +1 +1 +2 +3 +``` + +クエリ: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +結果: + +``` text +num +3 +``` + +## 最小(x) {#agg_function-min} + +最小値を計算します。 + +## 最大(x) {#agg_function-max} + +最大値を計算します。 + +## argMin(arg,val) {#agg-function-argmin} + +を計算し ‘arg’ 最小値の値 ‘val’ 値。 いくつかの異なる値がある場合 ‘arg’ のための最小値 ‘val’ これらの値のうち、最初に検出された値が出力されます。 + +**例えば:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## argMax(arg,val) {#agg-function-argmax} + +を計算し ‘arg’ 最大値の値 ‘val’ 値。 いくつかの異なる値がある場合 ‘arg’ の最大値 ‘val’ これらの値のうち、最初に検出された値が出力されます。 + +## sum(x) {#agg_function-sum} + +合計を計算します。 +数字のためにのみ動作します。 + +## sumWithOverflow(x) {#sumwithoverflowx} + +入力パラメーターの結果と同じデータ型を使用して、数値の合計を計算します。 合計がこのデータ型の最大値を超えると、関数はエラーを返します。 + +数字のためにのみ動作します。 + +## sumMap(キー,値) {#agg_functions-summap} + +合計 ‘value’ 配列に指定されたキーに応じて ‘key’ 配列だ +の要素の数 ‘key’ と ‘value’ 合計される行ごとに同じでなければなりません。 +Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. + +例えば: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┘ +``` + +## skewPop {#skewpop} + +を計算します [歪み](https://en.wikipedia.org/wiki/Skewness) シーケンスの。 + +``` sql +skewPop(expr) +``` + +**パラメータ** + +`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 + +**戻り値** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**例えば** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## 串焼き {#skewsamp} + +を計算します [サンプルの歪度](https://en.wikipedia.org/wiki/Skewness) シーケンスの。 + +これは、渡された値がそのサンプルを形成する場合、確率変数の歪度の不偏推定値を表します。 + +``` sql +skewSamp(expr) +``` + +**パラメータ** + +`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 + +**戻り値** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). もし `n <= 1` (`n` はサンプルのサイズです)、関数は次の値を返します `nan`. + +**例えば** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## kurtPop {#kurtpop} + +を計算します [尖度](https://en.wikipedia.org/wiki/Kurtosis) シーケンスの。 + +``` sql +kurtPop(expr) +``` + +**パラメータ** + +`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 + +**戻り値** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**例えば** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## kurtSamp {#kurtsamp} + +を計算します [サンプル尖度](https://en.wikipedia.org/wiki/Kurtosis) のシーケンスです。 + +これは、渡された値がサンプルを形成する場合、確率変数の尖度の不偏推定値を表します。 + +``` sql +kurtSamp(expr) +``` + +**パラメータ** + +`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 + +**戻り値** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). もし `n <= 1` (`n` はサンプルのサイズです)、関数は次の値を返します `nan`. + +**例えば** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## timeSeriesGroupSum(uid,タイムスタンプ,値) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` 総異なる時系列のサンプルのタイムスタンプなアライメントを実施します。 +これは、二つのサンプルタイムスタンプ間の線形補間を使用して、一緒に時系列を合計します。 + +- `uid` タイムシリーズの一意のidです, `UInt64`. +- `timestamp` ミリ秒またはマイクロ秒をサポートするためにInt64型です。 +- `value` メトリックです。 + +この関数は、以下のタプルの配列を返します `(timestamp, aggregated_value)` のペアになっています。 + +この機能を使用する前に確認 `timestamp` は昇順です。 + +例えば: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +結果は次のようになります: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## timeSeriesGroupRateSum(uid,ts,val) {#agg-function-timeseriesgroupratesum} + +同様にtimeseriesgroupratesum、timeseriesgroupratesumは、時系列のレートを計算し、その後、一緒にレートを合計します。 +また、この関数を使用する前にタイムスタンプが昇順になるはずです。 + +この関数を使用すると、上記の結果は次のようになります: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## 平均(x) {#agg_function-avg} + +平均を計算します。 +数字のためにのみ動作します。 +結果は常にfloat64です。 + +## uniq {#agg_function-uniq} + +引数の異なる値のおおよその数を計算します。 + +``` sql +uniq(x[, ...]) +``` + +**パラメータ** + +この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 + +**戻り値** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ番号。 + +**実装の詳細** + +機能: + +- 集計内のすべてのパラメータのハッシュを計算し、それを計算に使用します。 + +- を使用して適応サンプリングアルゴリズムです。 計算状態の場合、関数は65536までの要素ハッシュ値のサンプルを使用します。 + + This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. + +- 結果を確定的に提供します(クエリ処理の順序に依存しません)。 + +使用をお勧めしますこの機能はほとんど全てのシナリオ. + +**また見なさい** + +- [uniqCombined](#agg_function-uniqcombined) +- [uniqCombined64](#agg_function-uniqcombined64) +- [unihll12](#agg_function-uniqhll12) +- [ユニキャック](#agg_function-uniqexact) + +## uniqCombined {#agg_function-uniqcombined} + +異なる引数値のおおよその数を計算します。 + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +その `uniqCombined` 関数は、異なる値の数を計算するのに適しています。 + +**パラメータ** + +この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 + +`HLL_precision` は、2のセル数の底の対数です [ハイパーログ](https://en.wikipedia.org/wiki/HyperLogLog). オプションで、次のように関数を使用できます `uniqCombined(x[, ...])`. のデフォルト値 `HLL_precision` は17で、これは効果的に96KiBのスペース(2^17セル、6ビットそれぞれ)です。 + +**戻り値** + +- を番号 [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ番号。 + +**実装の詳細** + +機能: + +- ハッシュを計算します(64ビットのハッシュ `String` それ以外の場合は32ビット)は、集計内のすべてのパラメータに対して、それを計算に使用します。 + +- 配列、ハッシュテーブル、およびhyperloglogとエラー修正テーブルの組み合わせを使用します。 + + For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. + +- 結果を確定的に提供します(クエリ処理の順序に依存しません)。 + +!!! note "メモ" + それは32ビットハッシュを使用しているので-`String` タイプすると、結果はカーディナリティのエラーが非常に大きくなります `UINT_MAX` (エラーは数十億の異なる値の後にすぐに発生します)、この場合は次のようにしてください [uniqCombined64](#agg_function-uniqcombined64) + +に比べて [uniq](#agg_function-uniq) 機能、を `uniqCombined`: + +- 数回少ないメモリを消費します。 +- 数倍高い精度で計算します。 +- 通常は若干低い性能を持っています。 一部のシナリオでは, `uniqCombined` より良い実行できる `uniq` たとえば、ネットワークを介して多数の集約状態を送信する分散クエリを使用します。 + +**また見なさい** + +- [uniq](#agg_function-uniq) +- [uniqCombined64](#agg_function-uniqcombined64) +- [unihll12](#agg_function-uniqhll12) +- [ユニキャック](#agg_function-uniqexact) + +## uniqCombined64 {#agg_function-uniqcombined64} + +と同じ [uniqCombined](#agg_function-uniqcombined) ただし、すべてのデータ型に64ビットハッシュを使用します。 + +## unihll12 {#agg_function-uniqhll12} + +を使用して、異なる引数値のおおよその数を計算します [ハイパーログ](https://en.wikipedia.org/wiki/HyperLogLog) アルゴリズムだ + +``` sql +uniqHLL12(x[, ...]) +``` + +**パラメータ** + +この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 + +**戻り値** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ番号。 + +**実装の詳細** + +機能: + +- 集計内のすべてのパラメータのハッシュを計算し、それを計算に使用します。 + +- HyperLogLogアルゴリズムを使用して、異なる引数値の数を近似します。 + + 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). + +- 確定的な結果を提供します(クエリ処理の順序に依存しません)。 + +この機能を使用することはお勧めしません。 ほとんどの場合、 [uniq](#agg_function-uniq) または [uniqCombined](#agg_function-uniqcombined) 機能。 + +**また見なさい** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [ユニキャック](#agg_function-uniqexact) + +## ユニキャック {#agg_function-uniqexact} + +異なる引数値の正確な数を計算します。 + +``` sql +uniqExact(x[, ...]) +``` + +を使用 `uniqExact` 機能あなたは絶対に正確な結果が必要な場合。 それ以外の場合は、 [uniq](#agg_function-uniq) 機能。 + +その `uniqExact` 機能の使用ます。 `uniq`、状態のサイズは、異なる値の数が増加するにつれて無制限の成長を有するからである。 + +**パラメータ** + +この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 + +**また見なさい** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [unihll12](#agg_function-uniqhll12) + +## groupArray(x),groupArray(max\_size)(x) {#agg_function-grouparray} + +引数の値の配列を作成します。 +値は、任意の(不確定な)順序で配列に追加できます。 + +第二のバージョン( `max_size` パラメータ)結果の配列のサイズを次のように制限します `max_size` 要素。 +例えば, `groupArray (1) (x)` に相当します `[any (x)]`. + +場合によっては、実行の順序に依拠することもできます。 これは、次の場合に適用されます `SELECT` 使用するサブクエリーから取得されます `ORDER BY`. + +## groupArrayInsertAt(値、位置) {#grouparrayinsertatvalue-position} + +指定した位置の配列に値を挿入します。 + +!!! note "メモ" + この関数はゼロベースの位置を使用します。 + +Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. + +任意変数: + +- 空の位置に置き換えるためのデフォルト値。 +- 結果の配列の長さ。 これにより、すべての集約キーで同じサイズの配列を受け取ることができます。 このパラメーターを使用する場合は、既定値を指定する必要があります。 + +## グルーパーレイモビングサムcity in new mexico usa {#agg_function-grouparraymovingsum} + +入力値の移動和を計算します。 + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +この機能できるウィンドウサイズとしてのパラメータとします。 指定しない場合、この関数は、列の行数と同じウィンドウサイズをとります。 + +**パラメータ** + +- `numbers_for_summing` — [式](../syntax.md#syntax-expressions) その結果、数値データ型の値が返されます。 +- `window_size` — Size of the calculation window. + +**戻り値** + +- 入力データと同じサイズおよびタイプの配列。 + +**例えば** + +サンプルテーブル: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +クエリ: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## groupparraymovingavg {#agg_function-grouparraymovingavg} + +入力値の移動平均を計算します。 + +``` sql +groupArrayMovingAvg(numbers_for_summing) +groupArrayMovingAvg(window_size)(numbers_for_summing) +``` + +この機能できるウィンドウサイズとしてのパラメータとします。 指定しない場合、この関数は、列の行数と同じウィンドウサイズをとります。 + +**パラメータ** + +- `numbers_for_summing` — [式](../syntax.md#syntax-expressions) その結果、数値データ型の値が返されます。 +- `window_size` — Size of the calculation window. + +**戻り値** + +- 入力データと同じサイズおよびタイプの配列。 + +この関数は [ゼロに向かって丸め](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). 結果のデータ型の小数点以下の桁を切り捨てます。 + +**例えば** + +サンプルテーブル `b`: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +クエリ: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## groupUniqArray(x),groupUniqArray(max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} + +異なる引数値から配列を作成します。 メモリ消費量は、 `uniqExact` 機能。 + +第二のバージョン( `max_size` パラメータ)結果の配列のサイズを次のように制限します `max_size` 要素。 +例えば, `groupUniqArray(1)(x)` に相当します `[any(x)]`. + +## 分位値 {#quantile} + +近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 + +この関数が適用されます [貯蔵所の見本抽出](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192までの貯蔵所のサイズおよび見本抽出のための乱数発電機を使って。 結果は非決定的です。 正確な分位値を取得するには、以下を使用します [quantileExact](#quantileexact) 機能。 + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantile(level)(expr) +``` + +エイリアス: `median`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [データ型](../../sql-reference/data-types/index.md#data_types), [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). + +**戻り値** + +- 指定したレベルの概算値。 + +タイプ: + +- [Float64](../../sql-reference/data-types/float.md) 数値データ型の入力。 +- [日付](../../sql-reference/data-types/date.md) 入力値が `Date` タイプ。 +- [DateTime](../../sql-reference/data-types/datetime.md) 入力値が `DateTime` タイプ。 + +**例えば** + +入力テーブル: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +クエリ: + +``` sql +SELECT quantile(val) FROM t +``` + +結果: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## quantiedeterministic {#quantiledeterministic} + +近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 + +この関数が適用されます [貯蔵所の見本抽出](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192までの貯蔵所のサイズおよび見本抽出の決定論のアルゴリズムを使って。 結果は決定的です。 正確な分位値を取得するには、以下を使用します [quantileExact](#quantileexact) 機能。 + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +エイリアス: `medianDeterministic`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [データ型](../../sql-reference/data-types/index.md#data_types), [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). +- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. + +**戻り値** + +- 指定したレベルの概算値。 + +タイプ: + +- [Float64](../../sql-reference/data-types/float.md) 数値データ型の入力。 +- [日付](../../sql-reference/data-types/date.md) 入力値が `Date` タイプ。 +- [DateTime](../../sql-reference/data-types/datetime.md) 入力値が `DateTime` タイプ。 + +**例えば** + +入力テーブル: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +クエリ: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +結果: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## quantileExact {#quantileexact} + +正確に計算する [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` メモリ、どこ `n` 渡された値の数です。 しかし、少数の値の場合、関数は非常に効果的です。 + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantileExact(level)(expr) +``` + +エイリアス: `medianExact`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [データ型](../../sql-reference/data-types/index.md#data_types), [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). + +**戻り値** + +- 指定されたレベルの分位値。 + +タイプ: + +- [Float64](../../sql-reference/data-types/float.md) 数値データ型の入力。 +- [日付](../../sql-reference/data-types/date.md) 入力値が `Date` タイプ。 +- [DateTime](../../sql-reference/data-types/datetime.md) 入力値が `DateTime` タイプ。 + +**例えば** + +クエリ: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +結果: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## quantileExactWeighted {#quantileexactweighted} + +正確に計算する [分位値](https://en.wikipedia.org/wiki/Quantile) 各要素の重みを考慮した数値データシーケンス。 + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). この関数は、次の代わりに使用できます `quantileExact` そして、重み1を指定します。 + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +エイリアス: `medianExactWeighted`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [データ型](../../sql-reference/data-types/index.md#data_types), [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. + +**戻り値** + +- 指定されたレベルの分位値。 + +タイプ: + +- [Float64](../../sql-reference/data-types/float.md) 数値データ型の入力。 +- [日付](../../sql-reference/data-types/date.md) 入力値が `Date` タイプ。 +- [DateTime](../../sql-reference/data-types/datetime.md) 入力値が `DateTime` タイプ。 + +**例えば** + +入力テーブル: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +クエリ: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +結果: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## クオンタイミング {#quantiletiming} + +決定された精度では、 [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 + +結果は決定的です(クエリ処理の順序に依存しません)。 この機能を最適化と配列における分布のような積載ウェブページではバックエンド対応。 + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantileTiming(level)(expr) +``` + +エイリアス: `medianTiming`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). + +- `expr` — [式](../syntax.md#syntax-expressions) aを返す列の値を超える [フロート\*](../../sql-reference/data-types/float.md)-タイプ番号。 + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +**精度** + +計算は次の場合に正確です: + +- 値の総数は5670を超えません。 +- 値の総数は5670を超えていますが、ページの読み込み時間は1024ms未満です。 + +それ以外の場合、計算の結果は16msの最も近い倍数に丸められます。 + +!!! note "メモ" + ページの読み込み時間の分位数を計算するために、この関数はより効果的で正確です [分位値](#quantile). + +**戻り値** + +- 指定されたレベルの分位値。 + +タイプ: `Float32`. + +!!! note "メモ" + 関数に値が渡されない場合(以下を使用する場合 `quantileTimingIf`), [ナン](../../sql-reference/data-types/float.md#data_type-float-nan-inf) 返されます。 この目的は、これらのケースをゼロになるケースと区別することです。 見る [ORDER BY句](../statements/select.md#select-order-by) ソートに関する注意事項 `NaN` 値。 + +**例えば** + +入力テーブル: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +クエリ: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +結果: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## quantitimingweighted {#quantiletimingweighted} + +決定された精度では、 [分位値](https://en.wikipedia.org/wiki/Quantile) 各シーケンスメンバの重みに応じた数値データシーケンス。 + +結果は決定的です(クエリ処理の順序に依存しません)。 この機能を最適化と配列における分布のような積載ウェブページではバックエンド対応。 + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +エイリアス: `medianTimingWeighted`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). + +- `expr` — [式](../syntax.md#syntax-expressions) aを返す列の値を超える [フロート\*](../../sql-reference/data-types/float.md)-タイプ番号。 + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**精度** + +計算は次の場合に正確です: + +- 値の総数は5670を超えません。 +- 値の総数は5670を超えていますが、ページの読み込み時間は1024ms未満です。 + +それ以外の場合、計算の結果は16msの最も近い倍数に丸められます。 + +!!! note "メモ" + ページの読み込み時間の分位数を計算するために、この関数はより効果的で正確です [分位値](#quantile). + +**戻り値** + +- 指定されたレベルの分位値。 + +タイプ: `Float32`. + +!!! note "メモ" + 関数に値が渡されない場合(以下を使用する場合 `quantileTimingIf`), [ナン](../../sql-reference/data-types/float.md#data_type-float-nan-inf) 返されます。 この目的は、これらのケースをゼロになるケースと区別することです。 見る [ORDER BY句](../statements/select.md#select-order-by) ソートに関する注意事項 `NaN` 値。 + +**例えば** + +入力テーブル: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +クエリ: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +結果: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## quantiletdigestcomment {#quantiletdigest} + +近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) を使用する数値データシーケンスの [t-ダイジェスト](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) アルゴリズムだ + +最大誤差は1%です。 メモリ消費量は `log(n)`、どこ `n` 値の数です。 結果は、クエリの実行順序によって異なり、非決定的です。 + +機能の性能は性能より低いですの [分位値](#quantile) または [クオンタイミング](#quantiletiming). 状態サイズと精度の比に関しては、この関数はよりもはるかに優れています `quantile`. + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantileTDigest(level)(expr) +``` + +エイリアス: `medianTDigest`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [データ型](../../sql-reference/data-types/index.md#data_types), [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). + +**戻り値** + +- 指定したレベルの概算値。 + +タイプ: + +- [Float64](../../sql-reference/data-types/float.md) 数値データ型の入力。 +- [日付](../../sql-reference/data-types/date.md) 入力値が `Date` タイプ。 +- [DateTime](../../sql-reference/data-types/datetime.md) 入力値が `DateTime` タイプ。 + +**例えば** + +クエリ: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +結果: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## quantileTDigestWeighted {#quantiletdigestweighted} + +近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) を使用する数値データシーケンスの [t-ダイジェスト](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) アルゴリズムだ この関数は、各シーケンスメンバーの重みを考慮に入れます。 最大誤差は1%です。 メモリ消費量は `log(n)`、どこ `n` 値の数です。 + +機能の性能は性能より低いですの [分位値](#quantile) または [クオンタイミング](#quantiletiming). 状態サイズと精度の比に関しては、この関数はよりもはるかに優れています `quantile`. + +結果は、クエリの実行順序によって異なり、非決定的です。 + +複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 + +**構文** + +``` sql +quantileTDigest(level)(expr) +``` + +エイリアス: `medianTDigest`. + +**パラメータ** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [データ型](../../sql-reference/data-types/index.md#data_types), [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**戻り値** + +- 指定したレベルの概算値。 + +タイプ: + +- [Float64](../../sql-reference/data-types/float.md) 数値データ型の入力。 +- [日付](../../sql-reference/data-types/date.md) 入力値が `Date` タイプ。 +- [DateTime](../../sql-reference/data-types/datetime.md) 入力値が `DateTime` タイプ。 + +**例えば** + +クエリ: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +結果: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**また見なさい** + +- [中央値](#median) +- [分位数](#quantiles) + +## 中央値 {#median} + +その `median*` 関数は、対応する関数のエイリアスです `quantile*` 機能。 数値データサンプルの中央値を計算します。 + +機能: + +- `median` — Alias for [分位値](#quantile). +- `medianDeterministic` — Alias for [quantiedeterministic](#quantiledeterministic). +- `medianExact` — Alias for [quantileExact](#quantileexact). +- `medianExactWeighted` — Alias for [quantileExactWeighted](#quantileexactweighted). +- `medianTiming` — Alias for [クオンタイミング](#quantiletiming). +- `medianTimingWeighted` — Alias for [quantitimingweighted](#quantiletimingweighted). +- `medianTDigest` — Alias for [quantiletdigestcomment](#quantiletdigest). +- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). + +**例えば** + +入力テーブル: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +クエリ: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +結果: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +すべての分位数関数には、対応する分位数関数もあります: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. これらの関数は、あるパスでリストされたレベルのすべての分位数を計算し、結果の値の配列を返します。 + +## varSamp(x) {#varsampx} + +金額を計算します `Σ((x - x̅)^2) / (n - 1)`、どこ `n` サンプルサイズは `x̅`の平均値です `x`. + +これは、渡された値がそのサンプルを形成する場合、確率変数の分散の不偏推定値を表します。 + +を返します `Float64`. とき `n <= 1`、戻り値 `+∞`. + +## varPop(x) {#varpopx} + +金額を計算します `Σ((x - x̅)^2) / n`、どこ `n` サンプルサイズは `x̅`の平均値です `x`. + +つまり、値のセットの分散。 を返します `Float64`. + +## stddevSamp(x) {#stddevsampx} + +結果はの平方根に等しい `varSamp(x)`. + +## stddevPop(x) {#stddevpopx} + +結果はの平方根に等しい `varPop(x)`. + +## topK(N)(x) {#topknx} + +指定された列のほぼ最も頻繁に使用される値の配列を返します。 結果の配列は、値のおおよその頻度の降順でソートされます(値そのものではありません)。 + +実装する [ろ過されたスペース節約](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) からのreduce-and-combineアルゴリズムに基づいてTopKを分析するアルゴリズム [パラレル省スペース](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +この関数は保証された結果を提供しません。 特定の状況では、エラーが発生し、最も頻度の高い値ではない頻繁な値が返されることがあります。 + +私達は使用を推薦します `N < 10` 価値;性能は大きいと減ります `N` 値。 の最大値 `N = 65536`. + +**パラメータ** + +- ‘N’ 返す要素の数です。 + +パラメーターを省略すると、既定値10が使用されます。 + +**引数** + +- ’ x ’ – The value to calculate frequency. + +**例えば** + +を取る [オンタイム](../../getting-started/example-datasets/ontime.md) データセットを選択し、最も頻繁に発生する三つの値を選択します。 `AirlineID` コラム + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## トップクイット {#topkweighted} + +に似て `topK` しかし、整数型の一つの追加の引数を取ります - `weight`. あらゆる価値は説明されます `weight` 頻度計算のための時間。 + +**構文** + +``` sql +topKWeighted(N)(x, weight) +``` + +**パラメータ** + +- `N` — The number of elements to return. + +**引数** + +- `x` – The value. +- `weight` — The weight. [UInt8](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +最大およその重みの合計を持つ値の配列を返します。 + +**例えば** + +クエリ: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +結果: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## covarSamp(x,y) {#covarsampx-y} + +の値を計算します `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +Float64を返します。 とき `n <= 1`, returns +∞. + +## covarPop(x,y) {#covarpopx-y} + +の値を計算します `Σ((x - x̅)(y - y̅)) / n`. + +## corr(x,y) {#corrx-y} + +ピアソン相関係数を計算します: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## categoricalInformationValue {#categoricalinformationvalue} + +の値を計算します `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` 各カテゴリの。 + +``` sql +categoricalInformationValue(category1, category2, ..., tag) +``` + +結果は、離散(カテゴリカル)フィーチャがどのようにして `[category1, category2, ...]` の値を予測する学習モデルに貢献する `tag`. + +## simplelearregression {#simplelinearregression} + +単純な(一次元的な)線形回帰を実行します。 + +``` sql +simpleLinearRegression(x, y) +``` + +パラメータ: + +- `x` — Column with dependent variable values. +- `y` — Column with explanatory variable values. + +戻り値: + +定数 `(a, b)` 結果の行の `y = a*x + b`. + +**例** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## stochasticLinearRegression {#agg_functions-stochasticlinearregression} + +この関数は、確率的線形回帰を実装します。 それは率、l2正則化係数、ミニバッチサイズを学ぶための注文変数を支え、重量を更新するための少数の方法を有する ([アダム](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (デフォルトで使用), [シンプルSGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [勢い](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [ネステロフ](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### パラメータ {#agg_functions-stochasticlinearregression-parameters} + +が4カスタマイズ可能パラメータ。 それらは関数に順番に渡されますが、すべての四つのデフォルト値を渡す必要はありませんが、良いモデルにはいくつかのパラメータ調整が必要で + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. `learning rate` 勾配降下ステップが実行されるときのステップ長の係数です。 大きすぎる学習率の原因となり無限の量のモデルです。 デフォルトは `0.00001`. +2. `l2 regularization coefficient` これは過食防止に役立つ可能性があります。 デフォルトは `0.1`. +3. `mini-batch size` グラデーションディセントのステップを実行するために、グラデーションを計算して合計する要素の数を設定します。 純粋な確率降下は一つの要素を使用しますが、小さなバッチ(約10の要素)を持つことで勾配ステップがより安定します。 デフォルトは `15`. +4. `method for updating weights`、彼らは: `Adam` (デフォルトでは), `SGD`, `Momentum`, `Nesterov`. `Momentum` と `Nesterov` もう少し計算とメモリが必要ですが、確率勾配法の収束と安定性の点で有用です。 + +### 使い方 {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` モデルのフィッティングと新しいデータの予測です。 モデルを適合させ、後で使用するためにその状態を保存するために、 `-State` 基本的に状態(モデルの重みなど)を保存するcombinator。 +予測するには、関数を使用します [evalMLMethod](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod) これは、状態を予測する機能と同様に引数として取ります。 + + + +**1.** 継手 + +このようなクエリを使用できます。 + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +ここでは、データを挿入する必要もあります `train_data` テーブル。 パラメータの数は固定されていません。 `linearRegressionState`. 彼らはすべての必要数値です。 +ターゲット値(予測することを学びたい)を持つ列が最初の引数として挿入されることに注意してください。 + +**2.** 予測 + +状態をテーブルに保存した後、予測に複数回使用したり、他の状態とマージして新しいモデルを作成したりすることもできます。 + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +クエリは予測値の列を返します。 その最初の引数に注意してください `evalMLMethod` は `AggregateFunctionState` オブジェクト、次はフィーチャの列です。 + +`test_data` のようなテーブルです `train_data` が含まれないことがあります。 + +### 備考 {#agg_functions-stochasticlinearregression-notes} + +1. 統合モデルにはユーザーの作成などのクエリ: + `sql SELECT state1 + state2 FROM your_models` + どこに `your_models` テーブルの両方のモデルです。 このクエリはnewを返します `AggregateFunctionState` オブジェクト。 + +2. ユーザーのフェッチのウエイトを作成したモデルとして独自の目的で保存しないモデルについていない場合 `-State` combinatorが使用されます。 + `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` + そのようなクエリはモデルに適合し、その重みを返します-最初はモデルのパラメータに対応する重みです。 したがって、上記の例では、クエリは3つの値を持つ列を返します。 + +**また見なさい** + +- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) +- [線形およびロジスティック回帰の違い](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} + +この関数は、確率論的ロジスティック回帰を実装します。 これは、バイナリ分類問題に使用することができ、stochasticlinearregressionと同じカスタムパラメータをサポートし、同じ方法で動作します。 + +### パラメータ {#agg_functions-stochasticlogisticregression-parameters} + +パラメーターは、stochasticlinearregressionとまったく同じです: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +詳細については、 [パラメータ](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. 継手 + + + + See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. + + Predicted labels have to be in \[-1, 1\]. + +1. 予測 + + + + Using saved state we can predict probability of object having label `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + + The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + + We can also set a bound of probability, which assigns elements to different labels. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + + Then the result will be labels. + + `test_data` is a table like `train_data` but may not contain target value. + +**また見なさい** + +- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) +- [線形およびロジスティック回帰の違い。](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## groupbitmapandgenericname {#groupbitmapand} + +ビットマップ列のandを計算し、型uint64のカーディナリティを返します。 [ビットマップ](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapAnd(expr) +``` + +**パラメータ** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` タイプ。 + +**戻り値** + +の値 `UInt64` タイプ。 + +**例えば** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapAnd(z)─┐ +│ 3 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ +│ [6,8,10] │ +└──────────────────────────────────────────────────┘ +``` + +## groupBitmapOr {#groupbitmapor} + +ビットマップ列のorを計算し、型uint64のカーディナリティを返します。 [ビットマップ](../../sql-reference/functions/bitmap-functions.md). これは `groupBitmapMerge`. + +``` sql +groupBitmapOr(expr) +``` + +**パラメータ** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` タイプ。 + +**戻り値** + +の値 `UInt64` タイプ。 + +**例えば** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapOr(z)─┐ +│ 15 │ +└──────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ +│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ +└─────────────────────────────────────────────────┘ +``` + +## groupBitmapXor {#groupbitmapxor} + +ビットマップ列のxorを計算し、uint64型のカーディナリティを返します。 [ビットマップ](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapOr(expr) +``` + +**パラメータ** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` タイプ。 + +**戻り値** + +の値 `UInt64` タイプ。 + +**例えば** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapXor(z)─┐ +│ 10 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ +│ [1,3,5,6,8,10,11,13,14,15] │ +└──────────────────────────────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/ja/sql-reference/ansi.md b/docs/ja/sql-reference/ansi.md new file mode 120000 index 00000000000..3cf6bffed67 --- /dev/null +++ b/docs/ja/sql-reference/ansi.md @@ -0,0 +1 @@ +../../en/sql-reference/ansi.md \ No newline at end of file diff --git a/docs/ja/sql-reference/data-types/aggregatefunction.md b/docs/ja/sql-reference/data-types/aggregatefunction.md new file mode 100644 index 00000000000..be38c914fed --- /dev/null +++ b/docs/ja/sql-reference/data-types/aggregatefunction.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 52 +toc_title: AggregateFunction(name,types_of_arguments)...) +--- + +# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [マテリアライズドビュー](../../sql-reference/statements/select.md#create-view). 集計関数の状態を生成する一般的な方法は、集計関数を呼び出すことです `-State` 接尾辞。 将来の集約の最終結果を得るには、同じ集計関数を使用する必要があります `-Merge`接尾辞。 + +`AggregateFunction` — parametric data type. + +**パラメータ** + +- 集計関数の名前。 + + If the function is parametric, specify its parameters too. + +- 集計関数の引数の型です。 + +**例えば** + +``` sql +CREATE TABLE t +( + column1 AggregateFunction(uniq, UInt64), + column2 AggregateFunction(anyIf, String, UInt8), + column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) +) ENGINE = ... +``` + +[uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq),アーニフ ([任意の](../../sql-reference/aggregate-functions/reference.md#agg_function-any)+[もし](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-if))と [分位数](../../sql-reference/aggregate-functions/reference.md) ClickHouseでサポートされている集計関数です。 + +## 使い方 {#usage} + +### データ挿入 {#data-insertion} + +データを挿入するには `INSERT SELECT` 総計を使って `-State`-機能。 + +**関数の例** + +``` sql +uniqState(UserID) +quantilesState(0.5, 0.9)(SendTiming) +``` + +対応する機能とは対照的に `uniq` と `quantiles`, `-State`-関数は、最終的な値の代わりに状態を返します。 言い換えれば、それらは次の値を返します `AggregateFunction` タイプ。 + +の結果で `SELECT` クエリ、値の `AggregateFunction` タイプは、すべてのClickHouse出力形式に対して実装固有のバイナリ表現を持ちます。 たとえば、データをダンプする場合, `TabSeparated` フォーマット `SELECT` このダンプは、次のようにロードされます `INSERT` クエリ。 + +### データ選択 {#data-selection} + +データを選択するとき `AggregatingMergeTree` テーブル、使用 `GROUP BY` 句とデータを挿入するときと同じ集約関数が、 `-Merge`接尾辞。 + +以下の集計関数 `-Merge` suffixは、状態のセットを取得し、それらを結合し、完全なデータ集約の結果を返します。 + +たとえば、次の二つのクエリは同じ結果を返します: + +``` sql +SELECT uniq(UserID) FROM table + +SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) +``` + +## 使用例 {#usage-example} + +見る [ツつィツ姪“ツつ”ツ債ツづュツつケ](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) エンジンの説明。 + +[元の記事](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/ja/sql-reference/data-types/array.md b/docs/ja/sql-reference/data-types/array.md new file mode 100644 index 00000000000..2b7e5833ddb --- /dev/null +++ b/docs/ja/sql-reference/data-types/array.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 51 +toc_title: "\u914D\u5217(T)" +--- + +# 配列(t) {#data-type-array} + +の配列 `T`-タイプのアイテム。 `T` 配列を含む任意のデータ型を指定できます。 + +## 配列の作成 {#creating-an-array} + +関数を使用して配列を作成できます: + +``` sql +array(T) +``` + +角括弧を使用することもできます。 + +``` sql +[] +``` + +配列の作成例: + +``` sql +SELECT array(1, 2) AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName(array(1, 2))─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴─────────────────────────┘ +``` + +``` sql +SELECT [1, 2] AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName([1, 2])─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴────────────────────┘ +``` + +## データ型の操作 {#working-with-data-types} + +その場で配列を作成するとき、clickhouseは自動的にすべてのリストされた引数を格納できる最も狭いデータ型として引数の型を定義します。 あれば [Nullable](nullable.md#data_type-nullable) またはリテラル [NULL](../../sql-reference/syntax.md#null-literal) 値は、配列要素の型も次のようになります [Nullable](nullable.md). + +ClickHouseでデータ型を特定できなかった場合は、例外が生成されます。 たとえば、文字列と数値を同時に持つ配列を作成しようとすると、これが発生します (`SELECT array(1, 'a')`). + +自動データ型検出の例: + +``` sql +SELECT array(1, 2, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ +│ [1,2,NULL] │ Array(Nullable(UInt8)) │ +└────────────┴───────────────────────────────┘ +``` + +互換性のないデータ型の配列を作成しようとすると、clickhouseは例外をスローします: + +``` sql +SELECT array(1, 'a') +``` + +``` text +Received exception from server (version 1.1.54388): +Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. +``` + +[元の記事](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/ja/sql_reference/data_types/boolean.md b/docs/ja/sql-reference/data-types/boolean.md similarity index 100% rename from docs/ja/sql_reference/data_types/boolean.md rename to docs/ja/sql-reference/data-types/boolean.md diff --git a/docs/ja/sql_reference/data_types/date.md b/docs/ja/sql-reference/data-types/date.md similarity index 100% rename from docs/ja/sql_reference/data_types/date.md rename to docs/ja/sql-reference/data-types/date.md diff --git a/docs/ja/sql-reference/data-types/datetime.md b/docs/ja/sql-reference/data-types/datetime.md new file mode 100644 index 00000000000..72dc34f647e --- /dev/null +++ b/docs/ja/sql-reference/data-types/datetime.md @@ -0,0 +1,129 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 48 +toc_title: DateTime +--- + +# Datetime {#data_type-datetime} + +カレンダーの日付と時刻として表現することができ、時間内にインスタントを格納することができます。 + +構文: + +``` sql +DateTime([timezone]) +``` + +サポートされる値の範囲: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. + +解像度:1秒。 + +## 使用上の注意 {#usage-remarks} + +のとして保存すると、 [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) タイムゾーンまたは夏時間に関係なく。 さらに、 `DateTime` タイプは、列全体で同じタイムゾーンを格納することができます。 `DateTime` 型の値は、テキスト形式で表示され、文字列として指定された値がどのように解析されますか (‘2020-01-01 05:00:01’). タイムゾーンはテーブルの行(またはresultset)に格納されず、列のメタデータに格納されます。 +リストの対応時間帯の [IANA時間帯のデータベース](https://www.iana.org/time-zones). +その `tzdata` パッケージ、含む [IANA時間帯のデータベース](https://www.iana.org/time-zones)、システムに取付けられているべきです。 を使用 `timedatectl list-timezones` ローカルシステ + +タイムゾーンを明示的に設定することができます `DateTime`-テーブルを作成するときに列を入力します。 タイムゾーンが設定されていない場合、ClickHouseはタイムゾーンの値を使用します。 [タイムゾーン](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) クリックハウスサーバーの起動時にサーバー設定またはオペレーティングシステム設定のパラメータ。 + +その [クリックハウス-顧客](../../interfaces/cli.md) データ型の初期化時にタイムゾーンが明示的に設定されていない場合は、既定でサーバーのタイムゾーンを適用します。 クライアントのタイムゾーンを使用するには `clickhouse-client` と `--use_client_time_zone` パラメータ。 + +ClickHouse出力値で `YYYY-MM-DD hh:mm:ss` デフォルトではテキスト形式。 出力を変更するには、次のようにします [formatDateTime](../../sql-reference/functions/date-time-functions.md#formatdatetime) 機能。 + +ClickHouseにデータを挿入するときは、日付と時刻の文字列の異なる形式を使用することができます。 [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) 設定。 + +## 例 {#examples} + +**1.** テーブルを作成する `DateTime`-列を入力してデータを挿入する: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime('Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog; +``` + +``` sql +INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); +``` + +``` sql +SELECT * FROM dt; +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +- Datetimeを整数として挿入すると、Unixタイムスタンプ(UTC)として扱われます。 `1546300800` を表します `'2019-01-01 00:00:00'` UTC。 しかし、として `timestamp` 列は `Europe/Moscow` (UTC+3)タイムゾーン指定、文字列として出力すると、値は次のように表示されます `'2019-01-01 03:00:00'` +- 文字列値をdatetimeとして挿入すると、列timezoneにあるものとして扱われます。 `'2019-01-01 00:00:00'` するものとして扱われる `Europe/Moscow` タイムゾーンとして保存 `1546290000`. + +**2.** フィルタリング `DateTime` 値 + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +`DateTime` 列の値は、文字列値を使用してフィルター処理できます。 `WHERE` 述語。 それはに変換されます `DateTime` 自動的に: + +``` sql +SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +└─────────────────────┴──────────┘ +``` + +**3.** Aのタイムゾーンを取得する `DateTime`-タイプ列: + +``` sql +SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────column─┬─x─────────────────────────┐ +│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ +└─────────────────────┴───────────────────────────┘ +``` + +**4.** タイムゾーン変換 + +``` sql +SELECT +toDateTime(timestamp, 'Europe/London') as lon_time, +toDateTime(timestamp, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────lon_time──┬────────────mos_time─┐ +│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ +│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ +└─────────────────────┴─────────────────────┘ +``` + +## また見なさい {#see-also} + +- [型変換機能](../../sql-reference/functions/type-conversion-functions.md) +- [日付と時刻を操作するための関数](../../sql-reference/functions/date-time-functions.md) +- [配列を操作するための関数](../../sql-reference/functions/array-functions.md) +- [その `date_time_input_format` 設定](../../operations/settings/settings.md#settings-date_time_input_format) +- [その `timezone` サーバ設定パラメータ](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [日付と時刻を操作する演算子](../../sql-reference/operators.md#operators-datetime) +- [その `Date` データ型](date.md) + +[元の記事](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/ja/sql-reference/data-types/datetime64.md b/docs/ja/sql-reference/data-types/datetime64.md new file mode 100644 index 00000000000..23d823ae2c5 --- /dev/null +++ b/docs/ja/sql-reference/data-types/datetime64.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 49 +toc_title: DateTime64 +--- + +# Datetime64 {#data_type-datetime64} + +定義されたサブ秒の精度で、カレンダーの日付と時刻として表現することができる時刻にインスタントを格納することができます + +目盛りサイズ(精度):10-精密 秒 + +構文: + +``` sql +DateTime64(precision, [timezone]) +``` + +内部的には、データを次の数として格納します ‘ticks’ エポックスタート(1970-01-01 00:00:00UTC)はInt64です。 目盛りの分解能は、precisionパラメーターによって決まります。 さらに、 `DateTime64` タイプは、列全体で同じタイムゾーンを格納することができます。 `DateTime64` 型の値は、テキスト形式で表示され、文字列として指定された値がどのように解析されますか (‘2020-01-01 05:00:01.000’). タイムゾーンはテーブルの行(またはresultset)に格納されず、列のメタデータに格納されます。 詳細はこちら [DateTime](datetime.md). + +## 例 {#examples} + +**1.** テーブルの作成 `DateTime64`-列を入力してデータを挿入する: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime64(3, 'Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog +``` + +``` sql +INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) +``` + +``` sql +SELECT * FROM dt +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00.000 │ 1 │ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +- Datetimeを整数として挿入すると、適切にスケーリングされたUnixタイムスタンプ(UTC)として扱われます。 `1546300800000` (精度3)を表します `'2019-01-01 00:00:00'` UTC。 しかし、として `timestamp` 列は `Europe/Moscow` (UTC+3)タイムゾーン指定、文字列として出力すると、値は次のように表示されます `'2019-01-01 03:00:00'` +- 文字列値をdatetimeとして挿入すると、列timezoneにあるものとして扱われます。 `'2019-01-01 00:00:00'` れる。 `Europe/Moscow` タイムゾーンとして保存 `1546290000000`. + +**2.** フィルタリング `DateTime64` 値 + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +とは異なり `DateTime`, `DateTime64` 値は変換されません `String` 自動的に + +**3.** Aのタイムゾーンを取得する `DateTime64`-タイプ値: + +``` sql +SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────────column─┬─x──────────────────────────────┐ +│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ +└─────────────────────────┴────────────────────────────────┘ +``` + +**4.** タイムゾーン変換 + +``` sql +SELECT +toDateTime64(timestamp, 3, 'Europe/London') as lon_time, +toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────────lon_time──┬────────────────mos_time─┐ +│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ +│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ +└─────────────────────────┴─────────────────────────┘ +``` + +## また見なさい {#see-also} + +- [タイプ変換関数](../../sql-reference/functions/type-conversion-functions.md) +- [日付と時刻を操作するための関数](../../sql-reference/functions/date-time-functions.md) +- [配列を操作するための関数](../../sql-reference/functions/array-functions.md) +- [その `date_time_input_format` 設定](../../operations/settings/settings.md#settings-date_time_input_format) +- [その `timezone` サーバ設定パラメータ](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [日付と時刻を操作する演算子](../../sql-reference/operators.md#operators-datetime) +- [`Date` データ型](date.md) +- [`DateTime` データ型](datetime.md) diff --git a/docs/ja/sql_reference/data_types/decimal.md b/docs/ja/sql-reference/data-types/decimal.md similarity index 100% rename from docs/ja/sql_reference/data_types/decimal.md rename to docs/ja/sql-reference/data-types/decimal.md diff --git a/docs/ja/sql_reference/data_types/domains/index.md b/docs/ja/sql-reference/data-types/domains/index.md similarity index 100% rename from docs/ja/sql_reference/data_types/domains/index.md rename to docs/ja/sql-reference/data-types/domains/index.md diff --git a/docs/ja/sql_reference/data_types/domains/ipv4.md b/docs/ja/sql-reference/data-types/domains/ipv4.md similarity index 100% rename from docs/ja/sql_reference/data_types/domains/ipv4.md rename to docs/ja/sql-reference/data-types/domains/ipv4.md diff --git a/docs/ja/sql_reference/data_types/domains/ipv6.md b/docs/ja/sql-reference/data-types/domains/ipv6.md similarity index 100% rename from docs/ja/sql_reference/data_types/domains/ipv6.md rename to docs/ja/sql-reference/data-types/domains/ipv6.md diff --git a/docs/ja/sql_reference/data_types/domains/overview.md b/docs/ja/sql-reference/data-types/domains/overview.md similarity index 100% rename from docs/ja/sql_reference/data_types/domains/overview.md rename to docs/ja/sql-reference/data-types/domains/overview.md diff --git a/docs/ja/sql-reference/data-types/enum.md b/docs/ja/sql-reference/data-types/enum.md new file mode 100644 index 00000000000..5bcfda3ac77 --- /dev/null +++ b/docs/ja/sql-reference/data-types/enum.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 50 +toc_title: "\u5217\u6319\u578B" +--- + +# 列挙型 {#enum} + +名前付きの値で構成される列挙型。 + +名前の値として宣言された `'string' = integer` ペア。 ClickHouseは数字のみを格納しますが、名前による値の操作をサポートします。 + +ClickHouse支援: + +- 8ビット `Enum`. それはで列挙可能な256までの値を含むことができます `[-128, 127]` 範囲。 +- 16ビット `Enum`. それはで列挙可能な65536まで値を含むことができます `[-32768, 32767]` 範囲。 + +ClickHouseは自動的に次のタイプを選択します `Enum` データが挿入されるとき。 また、 `Enum8` または `Enum16` ストレージのサイズを確認するタイプ。 + +## 使用例 {#usage-examples} + +ここでは、 `Enum8('hello' = 1, 'world' = 2)` タイプ列: + +``` sql +CREATE TABLE t_enum +( + x Enum('hello' = 1, 'world' = 2) +) +ENGINE = TinyLog +``` + +列 `x` 型定義にリストされている値のみを格納できます: `'hello'` または `'world'`. 他の値を保存しようとすると、ClickHouseは例外を発生させます。 このため8ビットサイズ `Enum` 自動的に選択されます。 + +``` sql +INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') +``` + +``` text +Ok. +``` + +``` sql +INSERT INTO t_enum values('a') +``` + +``` text +Exception on client: +Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) +``` + +テーブルからデータをクエリすると、clickhouseから文字列の値が出力されます `Enum`. + +``` sql +SELECT * FROM t_enum +``` + +``` text +┌─x─────┐ +│ hello │ +│ world │ +│ hello │ +└───────┘ +``` + +行に相当する数値を表示する必要がある場合は、次の行をキャストする必要があります `Enum` 整数型への値。 + +``` sql +SELECT CAST(x, 'Int8') FROM t_enum +``` + +``` text +┌─CAST(x, 'Int8')─┐ +│ 1 │ +│ 2 │ +│ 1 │ +└─────────────────┘ +``` + +クエリで列挙値を作成するには、次のものも使用する必要があります `CAST`. + +``` sql +SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) +``` + +``` text +┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ +│ Enum8('a' = 1, 'b' = 2) │ +└─────────────────────────────────────────────────────┘ +``` + +## 一般的なルールと使用法 {#general-rules-and-usage} + +各値には、範囲内の数値が割り当てられます `-128 ... 127` のために `Enum8` または範囲で `-32768 ... 32767` のために `Enum16`. すべての文字列と数字は異なる必要があります。 空の文字列が許可されます。 この型が(テーブル定義で)指定されている場合、数値は任意の順序で指定できます。 しかし、順序は重要ではありません。 + +文字列と数値のどちらも `Enum` できる。 [NULL](../../sql-reference/syntax.md). + +アン `Enum` に含まれることができる [Nullable](nullable.md) タイプ。 そのため、クエリを使用してテーブルを作成する場合 + +``` sql +CREATE TABLE t_enum_nullable +( + x Nullable( Enum8('hello' = 1, 'world' = 2) ) +) +ENGINE = TinyLog +``` + +それだけでなく、 `'hello'` と `'world'`、しかし `NULL` 同様に、。 + +``` sql +INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) +``` + +ラムでは、 `Enum` 列は次のように保存されます `Int8` または `Int16` 対応する数値の。 + +テキストフォームで読み取る場合、clickhouseは値を文字列として解析し、一連のenum値から対応する文字列を検索します。 見つからない場合は、例外がスローされます。 テキスト形式で読み込むと、文字列が読み込まれ、対応する数値が検索されます。 見つからない場合は、例外がスローされます。 +テキスト形式で書くときは、値を対応する文字列として書き込みます。 列データにガベージ(有効なセットに含まれていない数値)が含まれている場合は、例外がスローされます。 バイナリ形式で読み書きするときは、int8とint16のデータ型と同じように動作します。 +暗黙的なデフォルト値は、数値が最も小さい値です。 + +の間 `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` そして、Enumは対応する数字と同じように動作します。 たとえば、ORDER BYは数値的に並べ替えます。 等価演算子と比較演算子は、基になる数値と同じようにEnumでも機能します。 + +Enum値を数値と比較することはできません。 列挙型は、定数文字列と比較できます。 比較された文字列が列挙型の有効な値でない場合は、例外がスローされます。 IN演算子は、左側の列挙型と右側の文字列のセットでサポートされています。 文字列は、対応する列挙型の値です。 + +Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. +しかし、列挙型は自然を持っています `toString` 文字列値を返す関数。 + +また、enumの値は、以下を使用して数値型に変換できます。 `toT` ここで、Tは数値型です。 Tが列挙型の基になる数値型に対応する場合、この変換はゼロコストになります。 +値のセットのみが変更された場合、列挙型は、alterを使用してコストをかけずに変更できます。 alterを使用して列挙型のメンバーを追加および削除することができます(削除された値がテーブルで一度も使用されていない場合にのみ、削除は安全で セーフガードとして、以前に定義されたenumメンバの数値を変更すると例外がスローされます。 + +ALTERを使用すると、Int8をInt16に変更するのと同じように、Enum8をEnum16に変更することも、その逆も可能です。 + +[元の記事](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/ja/sql-reference/data-types/fixedstring.md b/docs/ja/sql-reference/data-types/fixedstring.md new file mode 100644 index 00000000000..fc043852657 --- /dev/null +++ b/docs/ja/sql-reference/data-types/fixedstring.md @@ -0,0 +1,63 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: FixedString(N) +--- + +# Fixedstring {#fixedstring} + +の固定長文字列 `N` バイト(文字もコードポイントもない)。 + +の列を宣言するには `FixedString` タイプ、次の構文を使用します: + +``` sql + FixedString(N) +``` + +どこに `N` 自然数です。 + +その `FixedString` 型は、データの長さが正確である場合に効率的です `N` バイト。 他のすべてのケースでは、効率を低下させる可能性があります。 + +効率的に格納できる値の例 `FixedString`-型指定された列: + +- IPアドレスのバイナリ表現 (`FixedString(16)` IPv6用)。 +- Language codes (ru\_RU, en\_US … ). +- Currency codes (USD, RUB … ). +- ハッシュのバイナリ表現 (`FixedString(16)` MD5の場合, `FixedString(32)` 用SHA256)。 + +UUID値を格納するには、以下を使用します [UUID](uuid.md) データ型。 + +データを挿入するときは、clickhouse: + +- 文字列が含まれていない場合、nullバイトの文字列を補完します `N` バイト。 +- スロー `Too large value for FixedString(N)` る場合の例外の文字列です。 `N` バイトまでとなります。 + +データを選択するとき、clickhouseは文字列の末尾にあるnullバイトを削除しません。 を使用する場合 `WHERE` この節では、nullバイトを手動で追加して、 `FixedString` 値。 次の例では、次の例を使用する方法を示します `WHERE` との節 `FixedString`. + +のは、単一の次の表を考えてみましょう `FixedString(2)` 列: + +``` text +┌─name──┐ +│ b │ +└───────┘ +``` + +クエリ `SELECT * FROM FixedStringTable WHERE a = 'b'` 結果としてデータを返さない。 このフィルターパターンはnullバイトまでとなります。 + +``` sql +SELECT * FROM FixedStringTable +WHERE a = 'b\0' +``` + +``` text +┌─a─┐ +│ b │ +└───┘ +``` + +この動作は、mysqlとは異なります `CHAR` タイプ(文字列は空白で埋められ、空白は出力用に削除されます)。 + +の長さに注意してください。 `FixedString(N)` 値が一定になります。 その [長さ](../../sql-reference/functions/array-functions.md#array_functions-length) 関数の戻り値 `N` 場合においても `FixedString(N)` 値はnullバイトでのみ入力されるが、 [空](../../sql-reference/functions/string-functions.md#empty) 関数の戻り値 `1` この場合。 + +[元の記事](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/ja/sql_reference/data_types/float.md b/docs/ja/sql-reference/data-types/float.md similarity index 100% rename from docs/ja/sql_reference/data_types/float.md rename to docs/ja/sql-reference/data-types/float.md diff --git a/docs/ja/sql_reference/data_types/index.md b/docs/ja/sql-reference/data-types/index.md similarity index 100% rename from docs/ja/sql_reference/data_types/index.md rename to docs/ja/sql-reference/data-types/index.md diff --git a/docs/ja/sql_reference/data_types/int_uint.md b/docs/ja/sql-reference/data-types/int-uint.md similarity index 100% rename from docs/ja/sql_reference/data_types/int_uint.md rename to docs/ja/sql-reference/data-types/int-uint.md diff --git a/docs/ja/sql_reference/data_types/nested_data_structures/index.md b/docs/ja/sql-reference/data-types/nested-data-structures/index.md similarity index 100% rename from docs/ja/sql_reference/data_types/nested_data_structures/index.md rename to docs/ja/sql-reference/data-types/nested-data-structures/index.md diff --git a/docs/ja/sql-reference/data-types/nested-data-structures/nested.md b/docs/ja/sql-reference/data-types/nested-data-structures/nested.md new file mode 100644 index 00000000000..f0b4a706c08 --- /dev/null +++ b/docs/ja/sql-reference/data-types/nested-data-structures/nested.md @@ -0,0 +1,106 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 57 +toc_title: "\u30CD\u30B9\u30C8(Name1\u30BF\u30A4\u30D71,Name2\u30BF\u30A4\u30D72,...)" +--- + +# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) クエリ。 各テーブル行は、入れ子になったデータ構造内の任意の数の行に対応できます。 + +例えば: + +``` sql +CREATE TABLE test.visits +( + CounterID UInt32, + StartDate Date, + Sign Int8, + IsNew UInt8, + VisitID UInt64, + UserID UInt64, + ... + Goals Nested + ( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32 + ), + ... +) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) +``` + +この例では、 `Goals` ネストされたデータ構造。 の各行 ‘visits’ 表は、ゼロまたは任意の数の変換に対応することができます。 + +単一の入れ子レベルのみがサポートされます。 配列を含むネストされた構造体の列は、多次元配列と同等であるため、サポートが制限されています(mergetreeエンジンを使用してこれらの列をテーブルに格 + +ほとんどの場合、入れ子になったデータ構造で作業する場合、その列はドットで区切られた列名で指定されます。 これらの列は、一致する型の配列を構成します。 単一の入れ子になったデータ構造のすべての列配列の長さは同じです。 + +例えば: + +``` sql +SELECT + Goals.ID, + Goals.EventTime +FROM test.visits +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ +│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ +│ [1073752] │ ['2014-03-17 00:28:25'] │ +│ [1073752] │ ['2014-03-17 10:46:20'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ +│ [] │ [] │ +│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ +│ [] │ [] │ +│ [] │ [] │ +│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ +└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +ネストされたデータ構造を、同じ長さの複数の列配列のセットと考えるのが最も簡単です。 + +SELECTクエリで、個々の列ではなくネストされたデータ構造全体の名前を指定できる唯一の場所は、ARRAY JOIN句です。 詳細については、 “ARRAY JOIN clause”. 例えば: + +``` sql +SELECT + Goal.ID, + Goal.EventTime +FROM test.visits +ARRAY JOIN Goals AS Goal +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goal.ID─┬──────Goal.EventTime─┐ +│ 1073752 │ 2014-03-17 16:38:10 │ +│ 591325 │ 2014-03-17 16:38:48 │ +│ 591325 │ 2014-03-17 16:42:27 │ +│ 1073752 │ 2014-03-17 00:28:25 │ +│ 1073752 │ 2014-03-17 10:46:20 │ +│ 1073752 │ 2014-03-17 13:59:20 │ +│ 591325 │ 2014-03-17 22:17:55 │ +│ 591325 │ 2014-03-17 22:18:07 │ +│ 591325 │ 2014-03-17 22:18:51 │ +│ 1073752 │ 2014-03-17 11:37:06 │ +└─────────┴─────────────────────┘ +``` + +ネストされたデータ構造全体のselectは実行できません。 明示的にリストできるのは、その一部である個々の列のみです。 + +挿入クエリでは、入れ子になったデータ構造のすべてのコンポーネント列配列を個別に渡す必要があります(個々の列配列と同様)。 挿入時に、システムは同じ長さを持つことをチェックします。 + +DESCRIBEクエリの場合、入れ子になったデータ構造内の列は、同じ方法で別々にリストされます。 + +入れ子になったデータ構造内の要素に対するalter queryには制限があります。 + +[元の記事](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/ja/sql-reference/data-types/nullable.md b/docs/ja/sql-reference/data-types/nullable.md new file mode 100644 index 00000000000..b10503f3cd7 --- /dev/null +++ b/docs/ja/sql-reference/data-types/nullable.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: Nullable +--- + +# Nullable(typename) {#data_type-nullable} + +特別なマーカーを保存できます ([NULL](../../sql-reference/syntax.md))それは意味する “missing value” 通常の値と並んで `TypeName`. たとえば、 `Nullable(Int8)` タイプ列は保存できます `Int8` 値を入力すると、値を持たない行が格納されます `NULL`. + +のための `TypeName` 複合データ型は使用できません [配列](array.md) と [タプル](tuple.md). 複合データタイプを含むことができ `Nullable` 以下のようなタイプの値 `Array(Nullable(Int8))`. + +A `Nullable` typeフィールドできない含まれてテーブルスを作成します。 + +`NULL` anyのデフォルト値を指定します。 `Nullable` ClickHouseサーバー構成で別途指定されている場合を除き、入力します。 + +## ストレージ機能 {#storage-features} + +保存する `Nullable` 型の値テーブルのカラムClickHouse用途別のファイル `NULL` 値を持つ通常のファイルに加えて、マスク。 マスクファイル内のエントリは、ClickHouseが `NULL` そして、各テーブルの行の対応するデータ型のデフォルト値。 追加のファイルのため, `Nullable` 列は、同様の通常の記憶領域と比較して追加の記憶領域を消費します。 + +!!! info "メモ" + を使用して `Nullable` ほとんどの場合、パフォーマンスに悪影響を及ぼします。 + +## 使用例 {#usage-example} + +``` sql +CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog +``` + +``` sql +INSERT INTO t_null VALUES (1, NULL), (2, 3) +``` + +``` sql +SELECT x + y FROM t_null +``` + +``` text +┌─plus(x, y)─┐ +│ ᴺᵁᴸᴸ │ +│ 5 │ +└────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/ja/sql-reference/data-types/simpleaggregatefunction.md b/docs/ja/sql-reference/data-types/simpleaggregatefunction.md new file mode 120000 index 00000000000..76a7ef3b802 --- /dev/null +++ b/docs/ja/sql-reference/data-types/simpleaggregatefunction.md @@ -0,0 +1 @@ +../../../en/sql-reference/data-types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/ja/sql_reference/data_types/special_data_types/expression.md b/docs/ja/sql-reference/data-types/special-data-types/expression.md similarity index 100% rename from docs/ja/sql_reference/data_types/special_data_types/expression.md rename to docs/ja/sql-reference/data-types/special-data-types/expression.md diff --git a/docs/ja/sql_reference/data_types/special_data_types/index.md b/docs/ja/sql-reference/data-types/special-data-types/index.md similarity index 100% rename from docs/ja/sql_reference/data_types/special_data_types/index.md rename to docs/ja/sql-reference/data-types/special-data-types/index.md diff --git a/docs/ja/sql-reference/data-types/special-data-types/interval.md b/docs/ja/sql-reference/data-types/special-data-types/interval.md new file mode 100644 index 00000000000..32c605751d1 --- /dev/null +++ b/docs/ja/sql-reference/data-types/special-data-types/interval.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 61 +toc_title: "\u9593\u9694" +--- + +# 間隔 {#data-type-interval} + +時刻と日付の間隔を表すデータ型のファミリ。 結果のタイプ [INTERVAL](../../../sql-reference/operators.md#operator-interval) オペレーター + +!!! warning "警告" + `Interval` データ型の値はテーブルに格納できません。 + +構造: + +- 符号なし整数値としての時間間隔。 +- 間隔のタイプ。 + +サポートさ: + +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +各区間タイプには、個別のデータタイプがあります。 たとえば、 `DAY` 間隔はに対応します `IntervalDay` データ型: + +``` sql +SELECT toTypeName(INTERVAL 4 DAY) +``` + +``` text +┌─toTypeName(toIntervalDay(4))─┐ +│ IntervalDay │ +└──────────────────────────────┘ +``` + +## 使用上の注意 {#data-type-interval-usage-remarks} + +を使用することができ `Interval`-との算術操作のタイプ値 [日付](../../../sql-reference/data-types/date.md) と [DateTime](../../../sql-reference/data-types/datetime.md)-タイプの値。 たとえば、現在の時刻に4日を追加できます: + +``` sql +SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY +``` + +``` text +┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ +│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ +└─────────────────────┴───────────────────────────────┘ +``` + +間隔の異なる種類できない。 次のような間隔は使用できません `4 DAY 1 HOUR`. 間隔は、間隔の最小単位(間隔など)より小さいか等しい単位で指定します `1 day and an hour` 間隔は次のように表現できます `25 HOUR` または `90000 SECOND`. + +あなたは算術演算を実行することはできません `Interval`-値を入力しますが、異なるタイプの間隔を追加することができます。 `Date` または `DateTime` データ型。 例えば: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +次のクエリでは、例外が発生します: + +``` sql +select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) +``` + +``` text +Received exception from server (version 19.14.1): +Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. +``` + +## また見なさい {#see-also} + +- [INTERVAL](../../../sql-reference/operators.md#operator-interval) 演算子 +- [toInterval](../../../sql-reference/functions/type-conversion-functions.md#function-tointerval) 型変換関数 diff --git a/docs/ja/sql-reference/data-types/special-data-types/nothing.md b/docs/ja/sql-reference/data-types/special-data-types/nothing.md new file mode 100644 index 00000000000..3e099d2d0e1 --- /dev/null +++ b/docs/ja/sql-reference/data-types/special-data-types/nothing.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 60 +toc_title: "\u4F55\u3082\u306A\u3044" +--- + +# 何もない {#nothing} + +このデータ型の唯一の目的は、値が予期されないケースを表すことです。 だから、作成することはできません `Nothing` タイプ値。 + +たとえば、リテラル [NULL](../../../sql-reference/syntax.md#null-literal) はタイプの `Nullable(Nothing)`. 詳細はこちら [Nullable](../../../sql-reference/data-types/nullable.md). + +その `Nothing` 型は、空の配列を示すためにも使用できます: + +``` sql +SELECT toTypeName(array()) +``` + +``` text +┌─toTypeName(array())─┐ +│ Array(Nothing) │ +└─────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/ja/sql-reference/data-types/special-data-types/set.md b/docs/ja/sql-reference/data-types/special-data-types/set.md new file mode 100644 index 00000000000..8192e13129e --- /dev/null +++ b/docs/ja/sql-reference/data-types/special-data-types/set.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 59 +toc_title: "\u30BB\u30C3\u30C8" +--- + +# セット {#set} + +の右半分のために使用される [IN](../../../sql-reference/statements/select.md#select-in-operators) 式。 + +[元の記事](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/ja/sql_reference/data_types/string.md b/docs/ja/sql-reference/data-types/string.md similarity index 100% rename from docs/ja/sql_reference/data_types/string.md rename to docs/ja/sql-reference/data-types/string.md diff --git a/docs/ja/sql-reference/data-types/tuple.md b/docs/ja/sql-reference/data-types/tuple.md new file mode 100644 index 00000000000..a6a5aa2ef35 --- /dev/null +++ b/docs/ja/sql-reference/data-types/tuple.md @@ -0,0 +1,52 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 53 +toc_title: "\u30BF\u30D7\u30EB(T1,T2,...)" +--- + +# Tuple(t1, T2, …) {#tuplet1-t2} + +要素のタプル。 [タイプ](index.md#data_types). + +タプルは、一時列のグループ化に使用されます。 列は、in式がクエリで使用されている場合、およびラムダ関数の特定の仮パラメータを指定するためにグループ化できます。 詳細については、以下を参照してください [演算子の場合](../../sql-reference/statements/select.md) と [高階関数](../../sql-reference/functions/higher-order-functions.md). + +タプルは、クエリの結果になります。 この場合、json以外のテキスト形式の場合、値は角かっこでカンマ区切りになります。 json形式では、タプルは配列として出力されます(角括弧内)。 + +## タプルの作成 {#creating-a-tuple} + +関数を使用してタプルを作成することができます: + +``` sql +tuple(T1, T2, ...) +``` + +タプルの作成例: + +``` sql +SELECT tuple(1,'a') AS x, toTypeName(x) +``` + +``` text +┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ +│ (1,'a') │ Tuple(UInt8, String) │ +└─────────┴───────────────────────────┘ +``` + +## データ型の操作 {#working-with-data-types} + +タプルをオンザフライで作成するとき、clickhouseは引数の値を格納できる型の最小値として各引数の型を自動的に検出します。 引数が [NULL](../../sql-reference/syntax.md#null-literal) タプル要素の型は次のとおりです [Nullable](nullable.md). + +自動データ型検出の例: + +``` sql +SELECT tuple(1, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ +│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ +└──────────┴─────────────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/ja/sql-reference/data-types/uuid.md b/docs/ja/sql-reference/data-types/uuid.md new file mode 100644 index 00000000000..6b1dc5e3237 --- /dev/null +++ b/docs/ja/sql-reference/data-types/uuid.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 46 +toc_title: UUID +--- + +# UUID {#uuid-data-type} + +Universally unique identifier(UUID)は、レコードを識別するために使用される16バイトの数値です。 UUIDの詳細については、以下を参照してください [Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +UUID型の値の例を以下に示します: + +``` text +61f0c404-5cb3-11e7-907b-a6006ad3dba0 +``` + +新しいレコードを挿入するときにuuid列の値を指定しない場合、uuidの値はゼロで埋められます: + +``` text +00000000-0000-0000-0000-000000000000 +``` + +## 生成する方法 {#how-to-generate} + +UUID値を生成するには、ClickHouseに次の値を指定します [generateUUIDv4](../../sql-reference/functions/uuid-functions.md) 機能。 + +## 使用例 {#usage-example} + +**例1** + +この例では、uuid型の列を使用してテーブルを作成し、テーブルに値を挿入する方法を示します。 + +``` sql +CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog +``` + +``` sql +INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +└──────────────────────────────────────┴───────────┘ +``` + +**例2** + +この例では、新しいレコードを挿入するときにuuid列の値が指定されていません。 + +``` sql +INSERT INTO t_uuid (y) VALUES ('Example 2') +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ +└──────────────────────────────────────┴───────────┘ +``` + +## 制限 {#restrictions} + +UUIDデータ型は、以下の関数のみをサポートします [文字列](string.md) データ型もサポートします(たとえば, [分](../../sql-reference/aggregate-functions/reference.md#agg_function-min), [最大](../../sql-reference/aggregate-functions/reference.md#agg_function-max)、と [カウント](../../sql-reference/aggregate-functions/reference.md#agg_function-count)). + +UUIDデータ型は、算術演算ではサポートされません(たとえば, [abs](../../sql-reference/functions/arithmetic-functions.md#arithm_func-abs) 以下のような)または集約関数 [合計](../../sql-reference/aggregate-functions/reference.md#agg_function-sum) と [平均](../../sql-reference/aggregate-functions/reference.md#agg_function-avg). + +[元の記事](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md new file mode 100644 index 00000000000..d04408bba42 --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: "\u968E\u5C64\u8F9E\u66F8" +--- + +# 階層辞書 {#hierarchical-dictionaries} + +クリックハウスは、 [数値キー](external-dicts-dict-structure.md#ext_dict-numeric-key). + +次の階層構造を見てください: + +``` text +0 (Common parent) +│ +├── 1 (Russia) +│ │ +│ └── 2 (Moscow) +│ │ +│ └── 3 (Center) +│ +└── 4 (Great Britain) + │ + └── 5 (London) +``` + +この階層として表現することができ、以下の辞書。 + +| region\_id | parent\_region | region\_name | +|------------|----------------|--------------| +| 1 | 0 | ロシア | +| 2 | 1 | モスクワ | +| 3 | 2 | 中央 | +| 4 | 0 | イギリス | +| 5 | 4 | ロンドン | + +この表には列が含まれます `parent_region` これには、要素の最も近い親のキーが含まれます。 + +クリックハウスは [階層](external-dicts-dict-structure.md#hierarchical-dict-attr) のための特性 [外部辞書](index.md) 属性。 このプロパティを使用すると、上記のような階層辞書を構成できます。 + +その [独裁主義体制](../../../sql-reference/functions/ext-dict-functions.md#dictgethierarchy) 関数を使用すると、要素の親チェーンを取得できます。 + +この例では、dictionaryの構造は次のようになります: + +``` xml + + + + region_id + + + + parent_region + UInt64 + 0 + true + + + + region_name + String + + + + + +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md new file mode 100644 index 00000000000..2ec176efbcf --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md @@ -0,0 +1,373 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 41 +toc_title: "\u8F9E\u66F8\u3092\u30E1\u30E2\u30EA\u306B\u4FDD\u5B58\u3059\u308B" +--- + +# 辞書をメモリに保存する {#dicts-external-dicts-dict-layout} + +辞書をメモリに保存するには、さまざまな方法があります。 + +私たちはお勧め [フラット](#flat), [ハッシュ](#dicts-external_dicts_dict_layout-hashed) と [complex\_key\_hashed](#complex-key-hashed). 最適の処理速度を提供するかどれが。 + +キャッシュ推奨されていないものになる可能性のある性能や困難の選定に最適なパラメータ。 セクションの続きを読む “[キャッシュ](#cache)”. + +辞書のパフォーマ: + +- 後に辞書を操作する関数を呼び出します `GROUP BY`. +- 射影として抽出する属性をマークします。 異なる属性値が異なるキーに対応する場合、属性はinjectiveと呼ばれます。 だからとき `GROUP BY` キーによって属性値をフェッチする関数を使用します。 `GROUP BY`. + +ClickHouseは、辞書のエラーの例外を生成します。 エラーの例: + +- アクセス中の辞書を読み込めませんでした。 +- エラーの照会 `cached` 辞書だ + +外部辞書のリストとそのステータスを表示することができます `system.dictionaries` テーブル。 + +構成は次のようになります: + +``` xml + + + ... + + + + + + ... + + +``` + +対応 [DDL-クエリ](../../statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY (...) +... +LAYOUT(LAYOUT_TYPE(param value)) -- layout settings +... +``` + +## 辞書をメモリに格納する方法 {#ways-to-store-dictionaries-in-memory} + +- [フラット](#flat) +- [ハッシュ](#dicts-external_dicts_dict_layout-hashed) +- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) +- [キャッシュ](#cache) +- [range\_hashed](#range-hashed) +- [complex\_key\_hashed](#complex-key-hashed) +- [complex\_key\_cache](#complex-key-cache) +- [ip\_trie](#ip-trie) + +### フラット {#flat} + +辞書は完全にフラット配列の形でメモリに格納されています。 辞書はどのくらいのメモリを使用しますか? この量は、最大のキーのサイズに比例します(使用されるスペース)。 + +辞書キーには、 `UInt64` 値は500,000に制限されます。 辞書を作成するときに大きなキーが検出された場合、ClickHouseは例外をスローし、辞書を作成しません。 + +すべてのタイプの源は支えられる。 更新時には、ファイルまたはテーブルからのデータが完全に読み取られます。 + +この方法は最高性能の中で利用可能なすべての方法を格納する辞書です。 + +構成例: + +``` xml + + + +``` + +または + +``` sql +LAYOUT(FLAT()) +``` + +### ハッシュ {#dicts-external_dicts_dict_layout-hashed} + +辞書は、ハッシュテーブルの形式でメモリに完全に格納されます。 辞書には、実際には任意の識別子を持つ任意の数の要素を含めることができ、キーの数は数千万のアイテムに達することができます。 + +すべてのタイプの源は支えられる。 更新時には、ファイルまたはテーブルからのデータが完全に読み取られます。 + +構成例: + +``` xml + + + +``` + +または + +``` sql +LAYOUT(HASHED()) +``` + +### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} + +に似て `hashed` が、使用メモリ賛以上のCPUます。 + +構成例: + +``` xml + + + +``` + +``` sql +LAYOUT(SPARSE_HASHED()) +``` + +### complex\_key\_hashed {#complex-key-hashed} + +このタイプの貯蔵は合成の使用のためです [キー](external-dicts-dict-structure.md). に似て `hashed`. + +構成例: + +``` xml + + + +``` + +``` sql +LAYOUT(COMPLEX_KEY_HASHED()) +``` + +### range\_hashed {#range-hashed} + +辞書は、範囲とそれに対応する値の順序付けられた配列を持つハッシュテーブルの形式でメモリに格納されます。 + +このストレージメソッドは、hashedと同じように機能し、キーに加えて日付/時刻(任意の数値型)の範囲を使用できます。 + +例:この表には、各広告主の割引の形式が含まれています: + +``` text ++---------|-------------|-------------|------+ +| advertiser id | discount start date | discount end date | amount | ++===============+=====================+===================+========+ +| 123 | 2015-01-01 | 2015-01-15 | 0.15 | ++---------|-------------|-------------|------+ +| 123 | 2015-01-16 | 2015-01-31 | 0.25 | ++---------|-------------|-------------|------+ +| 456 | 2015-01-01 | 2015-01-15 | 0.05 | ++---------|-------------|-------------|------+ +``` + +日付範囲のサンプルを使用するには、以下を定義します `range_min` と `range_max` の要素 [構造](external-dicts-dict-structure.md). これらの要素の要素が含まれている必要があ `name` と`type` (もし `type` デフォルトのタイプが使用されます-Date)。 `type` 任意の数値型(Date/DateTime/UInt64/Int32/others)を指定できます。 + +例えば: + +``` xml + + + Id + + + first + Date + + + last + Date + + ... +``` + +または + +``` sql +CREATE DICTIONARY somedict ( + id UInt64, + first Date, + last Date +) +PRIMARY KEY id +LAYOUT(RANGE_HASHED()) +RANGE(MIN first MAX last) +``` + +これらの辞書を操作するには、追加の引数を渡す必要があります `dictGetT` 範囲が選択される関数: + +``` sql +dictGetT('dict_name', 'attr_name', id, date) +``` + +この関数は、指定された値を返します `id`sと、渡された日付を含む日付範囲。 + +アルゴリズムの詳細: + +- この `id` が見つからないか、または範囲が見つからない。 `id`、辞書のデフォルト値を返します。 +- 範囲が重複している場合は、anyを使用できます。 +- 範囲区切り文字が次の場合 `NULL` または無効な日付(1900-01-01や2039-01-01など)では、範囲は開いたままになります。 範囲は両側で開きます。 + +構成例: + +``` xml + + + + ... + + + + + + + + Abcdef + + + StartTimeStamp + UInt64 + + + EndTimeStamp + UInt64 + + + XXXType + String + + + + + + +``` + +または + +``` sql +CREATE DICTIONARY somedict( + Abcdef UInt64, + StartTimeStamp UInt64, + EndTimeStamp UInt64, + XXXType String DEFAULT '' +) +PRIMARY KEY Abcdef +RANGE(MIN StartTimeStamp MAX EndTimeStamp) +``` + +### キャッシュ {#cache} + +辞書は、固定数のセルを持つキャッシュに格納されます。 これらの細胞を含む使用頻度の高います。 + +辞書を検索するときは、まずキャッシュが検索されます。 各ブロックのデータは、すべてのキーが見つからないのキャッシュ古いから要求されてソースを使用 `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. 受信したデータは、キャッシュに書き込まれます。 + +キャッシュ辞書の場合、有効期限 [寿命](external-dicts-dict-lifetime.md) キャッシュ内のデータの設定が可能です。 より多くの時間より `lifetime` セルにデータをロードしてから、セルの値は使用されず、次に使用する必要があるときに再要求されます。 +これは、辞書を格納するすべての方法の中で最も効果的ではありません。 キャッシュの速度は、正しい設定と使用シナリオに強く依存します。 キャッシュタイプの辞書は、ヒット率が十分に高い場合にのみうまく機能します(推奨99%以上)。 あなたは平均ヒット率を表示することができます `system.dictionaries` テーブル。 + +キャッシュパフォーマン `LIMIT`、および外部ディクショナリで関数を呼び出します。 + +サポート [ソース](external-dicts-dict-sources.md):MySQL、ClickHouse、実行可能ファイル、HTTP。 + +設定例: + +``` xml + + + + 1000000000 + + +``` + +または + +``` sql +LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) +``` + +十分なキャッシュサイズを設定します。 あなたは、セルの数を選択する実験する必要があります: + +1. 値を設定します。 +2. キャッシュが一杯になるまでクエリを実行します。 +3. を使用してメモリ消費量を評価する `system.dictionaries` テーブル。 +4. 必要なメモリ消費量に達するまで、セル数を増減します。 + +!!! warning "警告" + ランダムな読み取りでクエリを処理するのが遅いため、ソースとしてclickhouseを使用しないでください。 + +### complex\_key\_cache {#complex-key-cache} + +このタイプの貯蔵は合成の使用のためです [キー](external-dicts-dict-structure.md). に似て `cache`. + +### ip\_trie {#ip-trie} + +このタイプの貯蔵するマッピングするネットワーク接頭辞(ipアドレスへのメタデータなどのasn. + +例:テーブルを含むネットワークの接頭辞およびその対応としての数および国コード: + +``` text + +-----------|-----|------+ + | prefix | asn | cca2 | + +=================+=======+========+ + | 202.79.32.0/20 | 17501 | NP | + +-----------|-----|------+ + | 2620:0:870::/48 | 3856 | US | + +-----------|-----|------+ + | 2a02:6b8:1::/48 | 13238 | RU | + +-----------|-----|------+ + | 2001:db8::/32 | 65536 | ZZ | + +-----------|-----|------+ +``` + +このタイプのレイアウトを使用する場合、構造に複合キーが必要です。 + +例えば: + +``` xml + + + + prefix + String + + + + asn + UInt32 + + + + cca2 + String + ?? + + ... +``` + +または + +``` sql +CREATE DICTIONARY somedict ( + prefix String, + asn UInt32, + cca2 String DEFAULT '??' +) +PRIMARY KEY prefix +``` + +キーには、許可されたipプレフィックスを含む文字列型属性のみが必要です。 その他のタイプはサポートされていませんか。 + +クエリの場合は、同じ関数を使用する必要があります (`dictGetT` 複合キーを持つ辞書については、タプルを使用する: + +``` sql +dictGetT('dict_name', 'attr_name', tuple(ip)) +``` + +のいずれか `UInt32` IPv4の場合、または `FixedString(16)` IPv6の場合: + +``` sql +dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) +``` + +その他のタイプはサポートされていませんか。 この関数は、このipアドレスに対応するプレフィックスの属性を返します。 がある場合に重なる接頭辞であり、具体的には返却されます。 + +データは `trie`. それは完全にRAMに収まる必要があります。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md new file mode 100644 index 00000000000..90e13e01af6 --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 42 +toc_title: "\u8F9E\u66F8\u306E\u66F4\u65B0" +--- + +# 辞書の更新 {#dictionary-updates} + +ClickHouseは定期的に辞書を更新します。 完全にダウンロードされたディクショナリの更新間隔とキャッシュされたディクショナ `` 秒の札。 + +辞書の更新(最初の使用のための読み込み以外)は、クエリをブロックしません。 更新時には、古いバージョンの辞書が使用されます。 更新中にエラーが発生すると、エラーがサーバーログに書き込まれ、古いバージョンの辞書が引き続き使用されます。 + +設定例: + +``` xml + + ... + 300 + ... + +``` + +``` sql +CREATE DICTIONARY (...) +... +LIFETIME(300) +... +``` + +設定 `0` (`LIFETIME(0)`)辞書が更新されないようにします。 + +アップグレードの時間間隔を設定することができ、clickhouseはこの範囲内で一様にランダムな時間を選択します。 これは、多数のサーバーでアップグレードするときに、ディクショナリソースに負荷を分散するために必要です。 + +設定例: + +``` xml + + ... + + 300 + 360 + + ... + +``` + +または + +``` sql +LIFETIME(MIN 300 MAX 360) +``` + +ップする場合には辞書にclickhouseサーバーに適用の異なるロジックの種類によって [ソース](external-dicts-dict-sources.md): + +- テキストファイルの場合は、変更の時間をチェックします。 時間が以前に記録された時間と異なる場合、辞書は更新されます。 +- MyISAMテーブルの場合、変更時刻は次のようにしてチェックされます `SHOW TABLE STATUS` クエリ。 +- 他のソースからの辞書は、デフォルトで毎回updatedされます。 + +MySQL(InnoDB)、ODBC、ClickHouseのソースでは、辞書が実際に変更された場合にのみ、毎回ではなく、辞書を更新するクエリを設定できます。 これを行うには、次の手順に従います: + +- 辞書に表れてい分野に常に変化するソースデータを更新しました。 +- ソースの設定では、変更フィールドを取得するクエリを指定する必要があります。 クリックハウスサーバーは、クエリ結果を行として解釈し、この行が以前の状態に対して変更されている場合は、辞書が更新されます。 クエリを指定します。 `` の設定のフィールド [ソース](external-dicts-dict-sources.md). + +設定例: + +``` xml + + ... + + ... + SELECT update_time FROM dictionary_source where id = 1 + + ... + +``` + +または + +``` sql +... +SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) +... +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md new file mode 100644 index 00000000000..fc5f700e4b1 --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md @@ -0,0 +1,608 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 43 +toc_title: "\u5916\u90E8\u8F9E\u66F8\u306E\u30BD\u30FC\u30B9" +--- + +# 外部辞書のソース {#dicts-external-dicts-dict-sources} + +外部辞書は、さまざまなソースから接続できます。 + +辞書がxmlファイルを使用して設定されている場合、設定は次のようになります: + +``` xml + + + ... + + + + + + ... + + ... + +``` + +の場合 [DDL-クエリ](../../statements/create.md#create-dictionary-query)、等しい構成は次のようになります: + +``` sql +CREATE DICTIONARY dict_name (...) +... +SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration +... +``` + +ソースは、 `source` セクション。 + +ソースの種類 (`source_type`): + +- [Localファイル](#dicts-external_dicts_dict_sources-local_file) +- [実行可能ファイル](#dicts-external_dicts_dict_sources-executable) +- [HTTP(s)](#dicts-external_dicts_dict_sources-http) +- DBMS + - [ODBC](#dicts-external_dicts_dict_sources-odbc) + - [MySQL](#dicts-external_dicts_dict_sources-mysql) + - [クリックハウス](#dicts-external_dicts_dict_sources-clickhouse) + - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) + - [レディス](#dicts-external_dicts_dict_sources-redis) + +## Localファイル {#dicts-external_dicts_dict_sources-local_file} + +設定例: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + +``` + +または + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +フィールドの設定: + +- `path` – The absolute path to the file. +- `format` – The file format. All the formats described in “[形式](../../../interfaces/formats.md#formats)” サポートされます。 + +## 実行可能ファイル {#dicts-external_dicts_dict_sources-executable} + +実行可能ファイルの操作は [辞書がメモリにどのように格納されるか](external-dicts-dict-layout.md). 辞書が以下を使用して格納されている場合 `cache` と `complex_key_cache` ClickHouseは、実行可能ファイルのSTDINに要求を送信することによって、必要なキーを要求します。 その他、ClickHouse始まり実行可能ファイルを扱い、その出力としての辞書のデータです。 + +設定例: + +``` xml + + + cat /opt/dictionaries/os.tsv + TabSeparated + + +``` + +または + +``` sql +SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +フィールドの設定: + +- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). +- `format` – The file format. All the formats described in “[形式](../../../interfaces/formats.md#formats)” サポートされます。 + +## Http(s) {#dicts-external_dicts_dict_sources-http} + +HTTP(s)サーバーの操作は次の条件によって異なります [辞書がメモリにどのように格納されるか](external-dicts-dict-layout.md). 辞書が以下を使用して格納されている場合 `cache` と `complex_key_cache`、ClickHouse要求を送信することによって必要なキーを経由して `POST` 方法。 + +設定例: + +``` xml + + + http://[::1]/os.tsv + TabSeparated + + user + password + + +
+ API-KEY + key +
+
+
+ +``` + +または + +``` sql +SOURCE(HTTP( + url 'http://[::1]/os.tsv' + format 'TabSeparated' + credentials(user 'user' password 'password') + headers(header(name 'API-KEY' value 'key')) +)) +``` + +ClickHouseがHTTPSリソースにアクセスするには、次のことが必要です [openSSLを設定](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-openssl) サーバー構成で。 + +フィールドの設定: + +- `url` – The source URL. +- `format` – The file format. All the formats described in “[形式](../../../interfaces/formats.md#formats)” サポートされます。 +- `credentials` – Basic HTTP authentication. Optional parameter. + - `user` – Username required for the authentication. + - `password` – Password required for the authentication. +- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. + - `header` – Single HTTP header entry. + - `name` – Identifiant name used for the header send on the request. + - `value` – Value set for a specific identifiant name. + +## ODBC {#dicts-external_dicts_dict_sources-odbc} + +このメソッドを使用して、odbcドライバーを持つデータベースを接続できます。 + +設定例: + +``` xml + + + DatabaseName + ShemaName.TableName
+ DSN=some_parameters + SQL_QUERY +
+ +``` + +または + +``` sql +SOURCE(ODBC( + db 'DatabaseName' + table 'SchemaName.TableName' + connection_string 'DSN=some_parameters' + invalidate_query 'SQL_QUERY' +)) +``` + +フィールドの設定: + +- `db` – Name of the database. Omit it if the database name is set in the `` パラメータ。 +- `table` – Name of the table and schema if exists. +- `connection_string` – Connection string. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [辞書の更新](external-dicts-dict-lifetime.md). + +ClickHouseはODBCドライバからクォート記号を受け取り、クエリのすべての設定をドライバに引用するので、データベースのテーブル名に応じてテーブル名を設定する + +Oracleを使用しているときにエンコードに問題がある場合は、対応する [FAQ](../../../faq/general.md#oracle-odbc-encodings) 記事。 + +### ODBCディクショナリ機能の既知の脆弱性 {#known-vulnerability-of-the-odbc-dictionary-functionality} + +!!! attention "注意" + ODBC driver connectionパラメーターを使用してデータベースに接続する場合 `Servername` 置換することができる。 この場合、 `USERNAME` と `PASSWORD` から `odbc.ini` リモートサーバーに送信され、侵害される可能性があります。 + +**安全でない使用例** + +PostgreSQL用にunixODBCを設定してみましょう。 の内容 `/etc/odbc.ini`: + +``` text +[gregtest] +Driver = /usr/lib/psqlodbca.so +Servername = localhost +PORT = 5432 +DATABASE = test_db +#OPTION = 3 +USERNAME = test +PASSWORD = test +``` + +次に、次のようなクエリを作成します + +``` sql +SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); +``` + +ODBCドライバーの値を送信します `USERNAME` と `PASSWORD` から `odbc.ini` に `some-server.com`. + +### Postgresqlの接続例 {#example-of-connecting-postgresql} + +UbuntuのOS。 + +UnixODBCとPostgreSQL用のODBCドライバのインストール: + +``` bash +$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql +``` + +設定 `/etc/odbc.ini` (または `~/.odbc.ini`): + +``` text + [DEFAULT] + Driver = myconnection + + [myconnection] + Description = PostgreSQL connection to my_db + Driver = PostgreSQL Unicode + Database = my_db + Servername = 127.0.0.1 + UserName = username + Password = password + Port = 5432 + Protocol = 9.3 + ReadOnly = No + RowVersioning = No + ShowSystemTables = No + ConnSettings = +``` + +クリックハウスの辞書構成: + +``` xml + + + table_name + + + + + DSN=myconnection + postgresql_table
+
+ + + 300 + 360 + + + + + + + id + + + some_column + UInt64 + 0 + + +
+
+``` + +または + +``` sql +CREATE DICTIONARY table_name ( + id UInt64, + some_column UInt64 DEFAULT 0 +) +PRIMARY KEY id +SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) +LAYOUT(HASHED()) +LIFETIME(MIN 300 MAX 360) +``` + +編集が必要な場合があります `odbc.ini` ドライバを使用してライブラリへのフルパスを指定するには `DRIVER=/usr/local/lib/psqlodbcw.so`. + +### MS SQL Serverの接続例 {#example-of-connecting-ms-sql-server} + +UbuntuのOS。 + +設置のドライバー: : + +``` bash +$ sudo apt-get install tdsodbc freetds-bin sqsh +``` + +ドライバの設定: + +``` bash + $ cat /etc/freetds/freetds.conf + ... + + [MSSQL] + host = 192.168.56.101 + port = 1433 + tds version = 7.0 + client charset = UTF-8 + + $ cat /etc/odbcinst.ini + ... + + [FreeTDS] + Description = FreeTDS + Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so + Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so + FileUsage = 1 + UsageCount = 5 + + $ cat ~/.odbc.ini + ... + + [MSSQL] + Description = FreeTDS + Driver = FreeTDS + Servername = MSSQL + Database = test + UID = test + PWD = test + Port = 1433 +``` + +ClickHouseでの辞書の設定: + +``` xml + + + test + + + dict
+ DSN=MSSQL;UID=test;PWD=test +
+ + + + 300 + 360 + + + + + + + + + k + + + s + String + + + +
+
+``` + +または + +``` sql +CREATE DICTIONARY test ( + k UInt64, + s String DEFAULT '' +) +PRIMARY KEY k +SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) +LAYOUT(FLAT()) +LIFETIME(MIN 300 MAX 360) +``` + +## DBMS {#dbms} + +### Mysql {#dicts-external_dicts_dict_sources-mysql} + +設定例: + +``` xml + + + 3306 + clickhouse + qwerty + + example01-1 + 1 + + + example01-2 + 1 + + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +または + +``` sql +SOURCE(MYSQL( + port 3306 + user 'clickhouse' + password 'qwerty' + replica(host 'example01-1' priority 1) + replica(host 'example01-2' priority 1) + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +フィールドの設定: + +- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). + +- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `replica` – Section of replica configurations. There can be multiple sections. + + - `replica/host` – The MySQL host. + - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. + +- `db` – Name of the database. + +- `table` – Name of the table. + +- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` たとえば、MySQLの句, `id > 10 AND id < 20`. 省略可能なパラメータ。 + +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [辞書の更新](external-dicts-dict-lifetime.md). + +MySQLは、ローカルホスト上でソケット経由で接続できます。 これを行うには、 `host` と `socket`. + +設定例: + +``` xml + + + localhost + /path/to/socket/file.sock + clickhouse + qwerty + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +または + +``` sql +SOURCE(MYSQL( + host 'localhost' + socket '/path/to/socket/file.sock' + user 'clickhouse' + password 'qwerty' + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +### クリックハウス {#dicts-external_dicts_dict_sources-clickhouse} + +設定例: + +``` xml + + + example01-01-1 + 9000 + default + + default + ids
+ id=10 +
+ +``` + +または + +``` sql +SOURCE(CLICKHOUSE( + host 'example01-01-1' + port 9000 + user 'default' + password '' + db 'default' + table 'ids' + where 'id=10' +)) +``` + +フィールドの設定: + +- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [分散](../../../engines/table-engines/special/distributed.md) テーブルと後続の構成でそれを入力します。 +- `port` – The port on the ClickHouse server. +- `user` – Name of the ClickHouse user. +- `password` – Password of the ClickHouse user. +- `db` – Name of the database. +- `table` – Name of the table. +- `where` – The selection criteria. May be omitted. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [辞書の更新](external-dicts-dict-lifetime.md). + +### Mongodb {#dicts-external_dicts_dict_sources-mongodb} + +設定例: + +``` xml + + + localhost + 27017 + + + test + dictionary_source + + +``` + +または + +``` sql +SOURCE(MONGO( + host 'localhost' + port 27017 + user '' + password '' + db 'test' + collection 'dictionary_source' +)) +``` + +フィールドの設定: + +- `host` – The MongoDB host. +- `port` – The port on the MongoDB server. +- `user` – Name of the MongoDB user. +- `password` – Password of the MongoDB user. +- `db` – Name of the database. +- `collection` – Name of the collection. + +### レディス {#dicts-external_dicts_dict_sources-redis} + +設定例: + +``` xml + + + localhost + 6379 + simple + 0 + + +``` + +または + +``` sql +SOURCE(REDIS( + host 'localhost' + port 6379 + storage_type 'simple' + db_index 0 +)) +``` + +フィールドの設定: + +- `host` – The Redis host. +- `port` – The port on the Redis server. +- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` 単純なソースとハッシュされた単一のキーソース用です, `hash_map` は用ハッシュソースで二つのキー。 距源およびキャッシュ源の複雑な鍵サポートされていません。 省略することができ、デフォルト値は `simple`. +- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md new file mode 100644 index 00000000000..3d03b11aed9 --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 44 +toc_title: "\u8F9E\u66F8\u306E\u30AD\u30FC\u3068\u30D5\u30A3\u30FC\u30EB\u30C9" +--- + +# 辞書のキーとフィールド {#dictionary-key-and-fields} + +その `` 条項の辞書のキーや分野での利用ます。 + +XMLの説明: + +``` xml + + + + Id + + + + + + + ... + + + +``` + +属性は要素に記述されています: + +- `` — [キー列](external-dicts-dict-structure.md#ext_dict_structure-key). +- `` — [データ列](external-dicts-dict-structure.md#ext_dict_structure-attributes). 複数の属性を指定できます。 + +DDLクエリ: + +``` sql +CREATE DICTIONARY dict_name ( + Id UInt64, + -- attributes +) +PRIMARY KEY Id +... +``` + +属性はクエリ本文に記述されます: + +- `PRIMARY KEY` — [キー列](external-dicts-dict-structure.md#ext_dict_structure-key) +- `AttrName AttrType` — [データ列](external-dicts-dict-structure.md#ext_dict_structure-attributes). 複数の属性を指定できます。 + +## キー {#ext_dict_structure-key} + +ClickHouseは次の種類のキーをサポートしています: + +- 数値キー。 `UInt64`. で定義される `` タグまたは使用 `PRIMARY KEY` キーワード。 +- 複合キー。 異なるタイプの値のセット。 タグ内で定義されている `` または `PRIMARY KEY` キーワード。 + +Xmlの構造を含むことができま `` または ``. DDL-クエリにsingleを含める必要があります `PRIMARY KEY`. + +!!! warning "警告" + Keyを属性として記述することはできません。 + +### 数値キー {#ext_dict-numeric-key} + +タイプ: `UInt64`. + +構成例: + +``` xml + + Id + +``` + +設定フィールド: + +- `name` – The name of the column with keys. + +DDLクエリの場合: + +``` sql +CREATE DICTIONARY ( + Id UInt64, + ... +) +PRIMARY KEY Id +... +``` + +- `PRIMARY KEY` – The name of the column with keys. + +### 複合キー {#composite-key} + +キーは次のようになります `tuple` フィールドの任意のタイプから。 その [レイアウト](external-dicts-dict-layout.md) この場合、 `complex_key_hashed` または `complex_key_cache`. + +!!! tip "ヒント" + 複合キーは、単一の要素で構成できます。 これにより、たとえば文字列をキーとして使用することができます。 + +キー構造は要素で設定されます ``. キーフィールドは、ディクショナリと同じ形式で指定します [属性](external-dicts-dict-structure.md). 例えば: + +``` xml + + + + field1 + String + + + field2 + UInt32 + + ... + +... +``` + +または + +``` sql +CREATE DICTIONARY ( + field1 String, + field2 String + ... +) +PRIMARY KEY field1, field2 +... +``` + +クエリの場合 `dictGet*` 関数は、タプルがキーとして渡されます。 例えば: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. + +## 属性 {#ext_dict_structure-attributes} + +構成例: + +``` xml + + ... + + Name + ClickHouseDataType + + rand64() + true + true + true + + +``` + +または + +``` sql +CREATE DICTIONARY somename ( + Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID +) +``` + +設定フィールド: + +| タグ | 説明 | 必須 | +|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| +| `name` | 列名。 | はい。 | +| `type` | ClickHouseデータタイプ。
ClickHouseは、dictionaryから指定されたデータ型に値をキャストしようとします。 例えば、MySQLの場合、フィールドは次のようになります `TEXT`, `VARCHAR`、または `BLOB` MySQLソーステーブルでは、次のようにアップロードできます `String` クリックハウスで。
[Nullable](../../../sql-reference/data-types/nullable.md) サポートされていない。 | はい。 | +| `null_value` | 既存の要素以外の要素のデフォルト値。
この例では、空の文字列です。 使用できません `NULL` この分野で。 | はい。 | +| `expression` | [式](../../syntax.md#syntax-expressions) そのClickHouseはその値を実行します。
この式には、リモートsqlデータベースの列名を指定できます。 したがって、これを使用して、リモート列の別名を作成できます。

デフォルト値:式なし。 | いいえ。 | +| `hierarchical` | もし `true`、属性は、現在のキーの親キーの値が含まれています。 見る [階層辞書](external-dicts-dict-hierarchical.md).

デフォルト値: `false`. | いいえ。 | +| `injective` | このフラグは、 `id -> attribute` 画像は [射影](https://en.wikipedia.org/wiki/Injective_function).
もし `true`、ClickHouseはの後に自動的に置くことができます `GROUP BY` 句注入を伴う辞書への要求。 通常、そのような要求の量が大幅に削減されます。

デフォルト値: `false`. | いいえ。 | +| `is_object_id` | MongoDBドキュメントに対してクエリが実行されるかどうかを示すフラグ `ObjectID`.

デフォルト値: `false`. | いいえ。 | + +## また見なさい {#see-also} + +- [外部辞書を操作するための関数](../../../sql-reference/functions/ext-dict-functions.md). + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md new file mode 100644 index 00000000000..6b6fe09c0cd --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md @@ -0,0 +1,53 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u5916\u90E8\u30C7\u30A3\u30AF\u30B7\u30E7\u30CA\u30EA\u306E\u8A2D\u5B9A" +--- + +# 外部ディクショナリの設定 {#dicts-external-dicts-dict} + +Dictionaryがxmlファイルを使用して構成されている場合、than dictionary構成は次の構造を持ちます: + +``` xml + + dict_name + + + + + + + + + + + + + + + + + +``` + +対応 [DDL-クエリ](../../statements/create.md#create-dictionary-query) 次の構造を持っています: + +``` sql +CREATE DICTIONARY dict_name +( + ... -- attributes +) +PRIMARY KEY ... -- complex or single key configuration +SOURCE(...) -- Source configuration +LAYOUT(...) -- Memory layout configuration +LIFETIME(...) -- Lifetime of dictionary in memory +``` + +- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. +- [ソース](external-dicts-dict-sources.md) — Source of the dictionary. +- [レイアウト](external-dicts-dict-layout.md) — Dictionary layout in memory. +- [構造](external-dicts-dict-structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. +- [寿命](external-dicts-dict-lifetime.md) — Frequency of dictionary updates. + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts.md new file mode 100644 index 00000000000..30a538b9fd2 --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/external-dictionaries/external-dicts.md @@ -0,0 +1,56 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u4E00\u822C\u7684\u306A\u8AAC\u660E" +--- + +# 外部辞書 {#dicts-external-dicts} + +さまざまなデータソースから独自の辞書を追加できます。 ディクショナリのデータソースには、ローカルテキストまたは実行可能ファイル、http(s)リソース、または別のdbmsを指定できます。 詳細については、 “[外部辞書のソース](external-dicts-dict-sources.md)”. + +クリックハウス: + +- 完全または部分的にramに辞書を格納します。 +- 辞書を定期的に更新し、欠損値を動的に読み込みます。 つまり、辞書を動的に読み込むことができます。 +- Xmlファイルを使用して外部辞書を作成したり [DDLクエリ](../../statements/create.md#create-dictionary-query). + +外部辞書の設定は、一つ以上のxmlファイルに配置することができます。 設定へのパスは [dictionaries\_config](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_config) パラメータ。 + +辞書は、サーバーの起動時または最初の使用時にロードすることができます。 [dictionaries\_lazy\_load](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) 設定。 + +辞書構成ファイルの形式は次のとおりです: + +``` xml + + An optional element with any content. Ignored by the ClickHouse server. + + + /etc/metrika.xml + + + + + + + + +``` + +あなたはできる [設定](external-dicts-dict.md) 同じファイル内の任意の数の辞書。 + +[辞書のddlクエリ](../../statements/create.md#create-dictionary-query) サーバー構成に追加のレコードは必要ありません。 この仕事を辞書として第一級の体のように、テーブルやビュー。 + +!!! attention "注意" + 小さな辞書の値をaに記述することによって変換できます `SELECT` クエリ(参照 [変換](../../../sql-reference/functions/other-functions.md) 機能)。 この機能は外部辞書とは関係ありません。 + +## また見なさい {#ext-dicts-see-also} + +- [外部ディクショナリの設定](external-dicts-dict.md) +- [辞書をメモリに保存する](external-dicts-dict-layout.md) +- [辞書の更新](external-dicts-dict-lifetime.md) +- [外部辞書のソース](external-dicts-dict-sources.md) +- [辞書のキーとフィールド](external-dicts-dict-structure.md) +- [外部辞書を操作するための関数](../../../sql-reference/functions/ext-dict-functions.md) + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/index.md b/docs/ja/sql-reference/dictionaries/external-dictionaries/index.md similarity index 100% rename from docs/ja/sql_reference/dictionaries/external_dictionaries/index.md rename to docs/ja/sql-reference/dictionaries/external-dictionaries/index.md diff --git a/docs/ja/sql-reference/dictionaries/index.md b/docs/ja/sql-reference/dictionaries/index.md new file mode 100644 index 00000000000..25c32e3d445 --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Dictionaries +toc_priority: 35 +toc_title: "\u5C0E\u5165" +--- + +# 辞書 {#dictionaries} + +辞書はマッピングです (`key -> attributes`)それはさまざまなタイプの参照リストのために便利です。 + +ClickHouseは、クエリで使用できる辞書を操作するための特別な機能をサポートしています。 Aよりも関数で辞書を使用する方が簡単で効率的です `JOIN` 参照テーブルと。 + +[NULL](../syntax.md#null) 値を辞書に格納することはできません。 + +ClickHouse支援: + +- [内蔵の辞書](internal-dicts.md#internal_dicts) 特定の [関数のセット](../../sql-reference/functions/ym-dict-functions.md). +- [プラグイン(外部)辞書](external-dictionaries/external-dicts.md) と [機能のネット](../../sql-reference/functions/ext-dict-functions.md). + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/ja/sql-reference/dictionaries/internal-dicts.md b/docs/ja/sql-reference/dictionaries/internal-dicts.md new file mode 100644 index 00000000000..bc644f959d4 --- /dev/null +++ b/docs/ja/sql-reference/dictionaries/internal-dicts.md @@ -0,0 +1,55 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u5185\u90E8\u8F9E\u66F8" +--- + +# 内部辞書 {#internal_dicts} + +ClickHouseには、ジオベースを操作するための組み込み機能が含まれています。 + +ことができ: + +- 地域のidを使用して、目的の言語でその名前を取得します。 +- 地域のidを使用して、都市、地域、連邦区、国、または大陸のidを取得します。 +- 領域が別の領域の一部であるかどうかを確認します。 +- 親領域のチェーンを取得します。 + +すべての機能サポート “translocality,” 同時に地域の所有権に異なる視点を使用する機能。 詳細については、以下を参照してください “Functions for working with Yandex.Metrica dictionaries”. + +内部辞書は、既定のパッケージでは無効になっています。 +よって、strncasecmpのパラメータ `path_to_regions_hierarchy_file` と `path_to_regions_names_files` サーバー設定ファイルで。 + +Geobaseはテキストファイルからロードされます。 + +場所は `regions_hierarchy*.txt` へのファイル `path_to_regions_hierarchy_file` ディレクトリ。 この構成パラ `regions_hierarchy.txt` ファイル(デフォルトの地域階層)、およびその他のファイル (`regions_hierarchy_ua.txt`)同じディレクトリに配置する必要があります。 + +を置く `regions_names_*.txt` のファイル `path_to_regions_names_files` ディレクトリ。 + +を作ることもできますこれらのファイル。 ファイルフォーマットは以下: + +`regions_hierarchy*.txt`:TabSeparated(ヘッダーなし)、列: + +- 地域ID (`UInt32`) +- 親リージョンID (`UInt32`) +- 地域タイプ (`UInt8`):1-大陸,3-国,4-連邦区,5-地域,6-都市;その他のタイプには値がありません +- 人口 (`UInt32`) — optional column + +`regions_names_*.txt`:TabSeparated(ヘッダーなし)、列: + +- 地域ID (`UInt32`) +- 地域名 (`String`) — Can’t contain tabs or line feeds, even escaped ones. + +フラット配列は、ramに格納するために使用されます。 このため、idは百万を超えてはいけません。 + +辞書は、サーバーを再起動せずに更新できます。 ただし、使用可能な辞書のセットは更新されません。 +更新の場合、ファイルの修正時刻がチェックされます。 ファイルが変更された場合は、辞書が更新されます。 +変更をチェックする間隔は、 `builtin_dictionaries_reload_interval` パラメータ。 +辞書updates(最初の使用時の読み込み以外)は、クエリをブロックしません。 更新時には、クエリは古いバージョンの辞書を使用します。 更新中にエラーが発生すると、エラーがサーバーログに書き込まれ、古いバージョンの辞書が引き続き使用されます。 + +Geobaseで辞書を定期的に更新することをお勧めします。 更新中に、新しいファイルを生成し、別の場所に書き込みます。 すべての準備ができたら、サーバーが使用するファイルに名前を変更します。 + +また、os識別子とyandexを操作するための機能もあります。metricaの調査エンジン、しかしそれらは使用されるべきではない。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/ja/sql_reference/functions/arithmetic_functions.md b/docs/ja/sql-reference/functions/arithmetic-functions.md similarity index 100% rename from docs/ja/sql_reference/functions/arithmetic_functions.md rename to docs/ja/sql-reference/functions/arithmetic-functions.md diff --git a/docs/ja/sql-reference/functions/array-functions.md b/docs/ja/sql-reference/functions/array-functions.md new file mode 100644 index 00000000000..352142ab78b --- /dev/null +++ b/docs/ja/sql-reference/functions/array-functions.md @@ -0,0 +1,1057 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 46 +toc_title: "\u914D\u5217\u306E\u64CD\u4F5C" +--- + +# 配列を操作するための関数 {#functions-for-working-with-arrays} + +## 空 {#function-empty} + +空の配列の場合は1、空でない配列の場合は0を返します。 +結果の型はuint8です。 +この関数は文字列に対しても機能します。 + +## notEmpty {#function-notempty} + +空の配列の場合は0、空でない配列の場合は1を返します。 +結果の型はuint8です。 +この関数は文字列に対しても機能します。 + +## 長さ {#array_functions-length} + +配列内の項目の数を返します。 +結果の型はuint64です。 +この関数は文字列に対しても機能します。 + +## emptyArrayUInt8,emptyArrayUInt16,emptyArrayUInt32,emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} + +## emptyArrayInt8,emptyArrayInt16,emptyArrayInt32,emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} + +## emptyArrayFloat32,emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} + +## emptyArrayDate,emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} + +## constellation name(optional) {#emptyarraystring} + +ゼロ引数を受け取り、適切な型の空の配列を返します。 + +## emptyArrayToSingle {#emptyarraytosingle} + +空の配列を受け取り、デフォルト値と等しいワンエレメント配列を返します。 + +## 範囲(終了)、範囲(開始、終了\[、ステップ\]) {#rangeend-rangestart-end-step} + +開始から終了までの数字の配列を返します-1ステップごとに。 +これは、 `start` デフォルトは0です。 +これは、 `step` デフォルトは1です。 +それはpythonicのように動作します `range`. しかし、違いは、すべての引数の型が `UInt` ナンバーズ +場合によっては、データブロック内に100,000,000要素を超える長さの配列が作成された場合、例外がスローされます。 + +## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} + +関数の引数から配列を作成します。 +引数は定数でなければならず、最小の共通型を持つ型を持つ必要があります。 なぜなら、それ以外の場合は、どのタイプの配列を作成するかは明確ではないからです。 つまり、この関数を使用して空の配列を作成することはできません(これを行うには、 ‘emptyArray\*’ 上記の関数)。 +を返します。 ‘Array(T)’ タイプの結果、ここで ‘T’ 渡された引数のうち最小の共通型です。 + +## arrayConcat {#arrayconcat} + +引数として渡される配列を結合します。 + +``` sql +arrayConcat(arrays) +``` + +**パラメータ** + +- `arrays` – Arbitrary number of arguments of [配列](../../sql-reference/data-types/array.md) タイプ。 + **例えば** + + + +``` sql +SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,3,4,5,6] │ +└───────────────┘ +``` + +## arrayElement(arr,n),演算子arr\[n\] {#arrayelementarr-n-operator-arrn} + +インデックスを持つ要素を取得する `n` 配列から `arr`. `n` 任意の整数型でなければなりません。 +インデックス配列の開始からです。 +負の索引がサポートされます。 この場合、最後から番号が付けられた対応する要素を選択します。 例えば, `arr[-1]` 配列の最後の項目です。 + +インデックスが配列の境界の外にある場合、いくつかのデフォルト値(数値の場合は0、文字列の場合は空の文字列など)を返します。)、非定数配列と定数インデックス0の場合を除いて(この場合はエラーが発生します `Array indices are 1-based`). + +## has(arr,elem) {#hasarr-elem} + +この ‘arr’ 配列には ‘elem’ 要素。 +要素が配列にない場合は0、ない場合は1を返します。 + +`NULL` 値として処理されます。 + +``` sql +SELECT has([1, 2, NULL], NULL) +``` + +``` text +┌─has([1, 2, NULL], NULL)─┐ +│ 1 │ +└─────────────────────────┘ +``` + +## hasAll {#hasall} + +ある配列が別の配列のサブセットかどうかを調べます。 + +``` sql +hasAll(set, subset) +``` + +**パラメータ** + +- `set` – Array of any type with a set of elements. +- `subset` – Array of any type with elements that should be tested to be a subset of `set`. + +**戻り値** + +- `1`,もし `set` からのすべての要素を含みます `subset`. +- `0` そうでなければ + +**特有の性質** + +- 空の配列は、任意の配列のサブセットです。 +- `Null` 値として処理されます。 +- 両方の配列の値の順序は関係ありません。 + +**例** + +`SELECT hasAll([], [])` 戻り値1. + +`SELECT hasAll([1, Null], [Null])` 戻り値1. + +`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` 戻り値1. + +`SELECT hasAll(['a', 'b'], ['a'])` 戻り値1. + +`SELECT hasAll([1], ['a'])` 0を返します。 + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` 0を返します。 + +## hasAny {#hasany} + +るかどうかを判二つの配列が互いの交差点にある。 + +``` sql +hasAny(array1, array2) +``` + +**パラメータ** + +- `array1` – Array of any type with a set of elements. +- `array2` – Array of any type with a set of elements. + +**戻り値** + +- `1`,もし `array1` と `array2` 少なくとも同様の要素を持っている。 +- `0` そうでなければ + +**特有の性質** + +- `Null` 値として処理されます。 +- 両方の配列の値の順序は関係ありません。 + +**例** + +`SELECT hasAny([1], [])` を返します `0`. + +`SELECT hasAny([Null], [Null, 1])` を返します `1`. + +`SELECT hasAny([-128, 1., 512], [1])` を返します `1`. + +`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` を返します `0`. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` を返します `1`. + +## インデクサー(arr,x) {#indexofarr-x} + +最初のインデックスを返します ‘x’ 要素(配列内にある場合は1から開始)、そうでない場合は0。 + +例えば: + +``` sql +SELECT indexOf([1, 3, NULL, NULL], NULL) +``` + +``` text +┌─indexOf([1, 3, NULL, NULL], NULL)─┐ +│ 3 │ +└───────────────────────────────────┘ +``` + +に設定された要素 `NULL` 通常の値として扱われます。 + +## countEqual(arr,x) {#countequalarr-x} + +配列内のxと等しい要素の数を返します。arraycount(elem-\>elem=x,arr)と等価です。 + +`NULL` 要素は個別の値として処理されます。 + +例えば: + +``` sql +SELECT countEqual([1, 2, NULL, NULL], NULL) +``` + +``` text +┌─countEqual([1, 2, NULL, NULL], NULL)─┐ +│ 2 │ +└──────────────────────────────────────┘ +``` + +## arrayEnumerate(arr) {#array_functions-arrayenumerate} + +Returns the array \[1, 2, 3, …, length (arr) \] + +この関数は通常、array joinと共に使用されます。 この計数かけま配列に適用後の配列。 例えば: + +``` sql +SELECT + count() AS Reaches, + countIf(num = 1) AS Hits +FROM test.hits +ARRAY JOIN + GoalsReached, + arrayEnumerate(GoalsReached) AS num +WHERE CounterID = 160656 +LIMIT 10 +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +この例では、reachesは変換の数(配列結合を適用した後に受け取った文字列)であり、hitsはページビューの数(配列結合の前の文字列)です。 この特定のケースでは、同じ結果をより簡単な方法で得ることができます: + +``` sql +SELECT + sum(length(GoalsReached)) AS Reaches, + count() AS Hits +FROM test.hits +WHERE (CounterID = 160656) AND notEmpty(GoalsReached) +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +この関数は、高階関数でも使用できます。 たとえば、これを使用して、条件に一致する要素の配列インデックスを取得できます。 + +## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} + +ソース配列と同じサイズの配列を返し、各要素に対して同じ値を持つ要素間の位置を示します。 +例えば:arrayenumerateuniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. + +この関数は、配列要素の配列の結合と集約を使用する場合に便利です。 +例えば: + +``` sql +SELECT + Goals.ID AS GoalID, + sum(Sign) AS Reaches, + sumIf(Sign, num = 1) AS Visits +FROM test.visits +ARRAY JOIN + Goals, + arrayEnumerateUniq(Goals.ID) AS num +WHERE CounterID = 160656 +GROUP BY GoalID +ORDER BY Reaches DESC +LIMIT 10 +``` + +``` text +┌──GoalID─┬─Reaches─┬─Visits─┐ +│ 53225 │ 3214 │ 1097 │ +│ 2825062 │ 3188 │ 1097 │ +│ 56600 │ 2803 │ 488 │ +│ 1989037 │ 2401 │ 365 │ +│ 2830064 │ 2396 │ 910 │ +│ 1113562 │ 2372 │ 373 │ +│ 3270895 │ 2262 │ 812 │ +│ 1084657 │ 2262 │ 345 │ +│ 56599 │ 2260 │ 799 │ +│ 3271094 │ 2256 │ 812 │ +└─────────┴─────────┴────────┘ +``` + +この例では、各ゴールidには、コンバージョン数(ゴールネストされたデータ構造の各要素は、達成されたゴールであり、コンバージョンと呼ばれます)とセッション 配列の結合がなければ、セッション数をsum(sign)としてカウントします。 しかし、この特定のケースでは、行はネストされたgoals構造体で乗算されたので、この後に各セッションをカウントするために、arrayenumerateuniq()の値に条件を適用しまgoals.id)関数。 + +ArrayEnumerateUniq関数は、引数と同じサイズの複数の配列を取ることができます。 この場合、すべての配列の同じ位置にある要素のタプルに対して一意性が考慮されます。 + +``` sql +SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,1,1,2,1] │ +└───────────────┘ +``` + +これは、ネストされたデータ構造で配列結合を使用し、この構造内の複数の要素間でさらに集約する場合に必要です。 + +## arrayPopBack {#arraypopback} + +配列から最後の項目を削除します。 + +``` sql +arrayPopBack(array) +``` + +**パラメータ** + +- `array` – Array. + +**例えば** + +``` sql +SELECT arrayPopBack([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## arrayPopFront {#arraypopfront} + +配列から最初の項目を削除します。 + +``` sql +arrayPopFront(array) +``` + +**パラメータ** + +- `array` – Array. + +**例えば** + +``` sql +SELECT arrayPopFront([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [2,3] │ +└───────┘ +``` + +## arrayPushBack {#arraypushback} + +配列の末尾に一つの項目を追加します。 + +``` sql +arrayPushBack(array, single_value) +``` + +**パラメータ** + +- `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` 配列のデータ型の型。 ClickHouseのデータ型の詳細については、以下を参照してください “[データ型](../../sql-reference/data-types/index.md#data_types)”. できる。 `NULL`. この関数は、 `NULL` 配列への要素、および配列要素の型に変換します `Nullable`. + +**例えば** + +``` sql +SELECT arrayPushBack(['a'], 'b') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayPushFront {#arraypushfront} + +配列の先頭に一つの要素を追加します。 + +``` sql +arrayPushFront(array, single_value) +``` + +**パラメータ** + +- `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` 配列のデータ型の型。 ClickHouseのデータ型の詳細については、以下を参照してください “[データ型](../../sql-reference/data-types/index.md#data_types)”. できる。 `NULL`. この関数は、 `NULL` 配列への要素、および配列要素の型に変換します `Nullable`. + +**例えば** + +``` sql +SELECT arrayPushFront(['b'], 'a') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayResize {#arrayresize} + +配列の長さを変更します。 + +``` sql +arrayResize(array, size[, extender]) +``` + +**パラメータ:** + +- `array` — Array. +- `size` — Required length of the array. + - もし `size` 配列の元のサイズより小さい場合、配列は右から切り捨てられます。 +- もし `size` は配列の初期サイズより大きく、配列は次のように右に拡張されます `extender` 配列項目のデータ型の値または既定値。 +- `extender` — Value for extending an array. Can be `NULL`. + +**戻り値:** + +長さの配列 `size`. + +**通話の例** + +``` sql +SELECT arrayResize([1], 3) +``` + +``` text +┌─arrayResize([1], 3)─┐ +│ [1,0,0] │ +└─────────────────────┘ +``` + +``` sql +SELECT arrayResize([1], 3, NULL) +``` + +``` text +┌─arrayResize([1], 3, NULL)─┐ +│ [1,NULL,NULL] │ +└───────────────────────────┘ +``` + +## arraySlice {#arrayslice} + +配列のスライスを返します。 + +``` sql +arraySlice(array, offset[, length]) +``` + +**パラメータ** + +- `array` – Array of data. +- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. +- `length` -必要なスライスの長さ。 負の値を指定すると、関数は開いているスライスを返します `[offset, array_length - length)`. 値を省略すると、関数はスライスを返します `[offset, the_end_of_array]`. + +**例えば** + +``` sql +SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res +``` + +``` text +┌─res────────┐ +│ [2,NULL,4] │ +└────────────┘ +``` + +に設定された配列要素 `NULL` 通常の値として扱われます。 + +## arraySort(\[func,\] arr, …) {#array_functions-sort} + +の要素をソートします `arr` 昇順の配列。 この `func` の結果によって決定される。 `func` 関数は、配列の要素に適用されます。 もし `func` 複数の引数を受け取る。 `arraySort` 関数はいくつかの配列を渡されます。 `func` に対応します。 詳しい例は終わりにの示されています `arraySort` 説明。 + +整数値のソート例: + +``` sql +SELECT arraySort([1, 3, 3, 0]); +``` + +``` text +┌─arraySort([1, 3, 3, 0])─┐ +│ [0,1,3,3] │ +└─────────────────────────┘ +``` + +文字列値のソートの例: + +``` sql +SELECT arraySort(['hello', 'world', '!']); +``` + +``` text +┌─arraySort(['hello', 'world', '!'])─┐ +│ ['!','hello','world'] │ +└────────────────────────────────────┘ +``` + +次の並べ替え順序を考えてみましょう。 `NULL`, `NaN` と `Inf` 値: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); +``` + +``` text +┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ +│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────────────────────────┘ +``` + +- `-Inf` 値は配列の最初のものです。 +- `NULL` 値は配列の最後です。 +- `NaN` 値は直前です `NULL`. +- `Inf` 値は直前です `NaN`. + +それに注意 `arraySort` は [高階関数](higher-order-functions.md). 最初の引数としてラムダ関数を渡すことができます。 この場合、並べ替え順序は、配列の要素に適用されるlambda関数の結果によって決まります。 + +次の例を考えてみましょう: + +``` sql +SELECT arraySort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,2,1] │ +└─────────┘ +``` + +For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` 関数はキーを昇順にソートし、結果は\[3,2,1\]になります。 このように、 `(x) –> -x` ラムダ関数は、 [降順](#array_functions-reverse-sort) ソートで。 + +Lambda関数は複数の引数を受け取ることができます。 この場合、次のものを渡す必要があります `arraySort` 関数lambda関数の引数が対応する同じ長さのいくつかの配列。 結果の配列は最初の入力配列の要素で構成され、次の入力配列の要素はソートキーを指定します。 例えば: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +ここでは、第二の配列(\[2、1\])に渡される要素は、ソース配列から対応する要素のソートキーを定義します (\[‘hello’, ‘world’\])、それは, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn’t use `x` ソース配列の実際の値は、結果の順序には影響しません。 だから, ‘hello’ 結果の二番目の要素になります。 ‘world’ 最初になります。 + +その他の例を以下に示す。 + +``` sql +SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +``` sql +SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +!!! note "メモ" + 効率を分類することを改善するため [シュワルツ語変換](https://en.wikipedia.org/wiki/Schwartzian_transform) 使用される。 + +## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} + +の要素をソートします `arr` 降順での配列。 この `func` 機能は指定されます, `arr` の結果に従ってソートされます。 `func` 関数は、配列の要素に適用され、その後、ソートされた配列が反転されます。 もし `func` 複数の引数を受け取る。 `arrayReverseSort` 関数はいくつかの配列を渡されます。 `func` に対応します。 詳しい例は終わりにの示されています `arrayReverseSort` 説明。 + +整数値のソート例: + +``` sql +SELECT arrayReverseSort([1, 3, 3, 0]); +``` + +``` text +┌─arrayReverseSort([1, 3, 3, 0])─┐ +│ [3,3,1,0] │ +└────────────────────────────────┘ +``` + +文字列値のソートの例: + +``` sql +SELECT arrayReverseSort(['hello', 'world', '!']); +``` + +``` text +┌─arrayReverseSort(['hello', 'world', '!'])─┐ +│ ['world','hello','!'] │ +└───────────────────────────────────────────┘ +``` + +次の並べ替え順序を考えてみましょう。 `NULL`, `NaN` と `Inf` 値: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; +``` + +``` text +┌─res───────────────────────────────────┐ +│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────┘ +``` + +- `Inf` 値は配列の最初のものです。 +- `NULL` 値は配列の最後です。 +- `NaN` 値は直前です `NULL`. +- `-Inf` 値は直前です `NaN`. + +それに注意しなさい `arrayReverseSort` は [高階関数](higher-order-functions.md). 最初の引数としてラムダ関数を渡すことができます。 例を以下に示す。 + +``` sql +SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [1,2,3] │ +└─────────┘ +``` + +配列は次の方法でソートされます: + +1. 最初に、ソース配列(\[1、2、3\])は、配列の要素に適用されたラムダ関数の結果に従ってソートされます。 結果は配列\[3,2,1\]です。 +2. 前のステップで取得された配列は、逆になります。 したがって、最終的な結果は\[1,2,3\]です。 + +Lambda関数は複数の引数を受け取ることができます。 この場合、次のものを渡す必要があります `arrayReverseSort` 関数lambda関数の引数が対応する同じ長さのいくつかの配列。 結果の配列は最初の入力配列の要素で構成され、次の入力配列の要素はソートキーを指定します。 例えば: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +この例では、配列は次のようにソートされています: + +1. 最初に、ソース配列 (\[‘hello’, ‘world’\])は、配列の要素に適用されたラムダ関数の結果に従ってソートされます。 第二の配列(\[2、1\])に渡される要素は、ソース配列から対応する要素のソートキーを定義します。 結果は配列です \[‘world’, ‘hello’\]. +2. 前のステップでソートされた配列は、逆になります。 したがって、最終的な結果は \[‘hello’, ‘world’\]. + +その他の例を以下に示す。 + +``` sql +SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; +``` + +``` text +┌─res─────┐ +│ [5,3,4] │ +└─────────┘ +``` + +``` sql +SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; +``` + +``` text +┌─res─────┐ +│ [4,3,5] │ +└─────────┘ +``` + +## arrayUniq(arr, …) {#arrayuniqarr} + +一つの引数が渡された場合、それは、配列内の異なる要素の数をカウントします。 +複数の引数が渡されると、複数の配列内の対応する位置にある要素の異なるタプルの数がカウントされます。 + +配列内の一意の項目のリストを取得する場合は、arrayreduceを使用できます(‘groupUniqArray’、arr)。 + +## arrayJoin(arr) {#array-functions-join} + +特殊関数。 セクションを見る [“ArrayJoin function”](array-join.md#functions_arrayjoin). + +## arrayDifference {#arraydifference} + +隣接する配列要素間の差を計算します。 最初の要素が0になる配列を返します。 `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). + +**構文** + +``` sql +arrayDifference(array) +``` + +**パラメータ** + +- `array` – [配列](https://clickhouse.yandex/docs/en/data_types/array/). + +**戻り値** + +隣接する要素間の差異の配列を返します。 + +タイプ: [UInt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [フロート\*](https://clickhouse.yandex/docs/en/data_types/float/). + +**例えば** + +クエリ: + +``` sql +SELECT arrayDifference([1, 2, 3, 4]) +``` + +結果: + +``` text +┌─arrayDifference([1, 2, 3, 4])─┐ +│ [0,1,1,1] │ +└───────────────────────────────┘ +``` + +結果の型int64によるオーバーフローの例: + +クエリ: + +``` sql +SELECT arrayDifference([0, 10000000000000000000]) +``` + +結果: + +``` text +┌─arrayDifference([0, 10000000000000000000])─┐ +│ [0,-8446744073709551616] │ +└────────────────────────────────────────────┘ +``` + +## arrayDistinct {#arraydistinct} + +配列をとり、distinct要素のみを含む配列を返します。 + +**構文** + +``` sql +arrayDistinct(array) +``` + +**パラメータ** + +- `array` – [配列](https://clickhouse.yandex/docs/en/data_types/array/). + +**戻り値** + +Distinct要素を含む配列を返します。 + +**例えば** + +クエリ: + +``` sql +SELECT arrayDistinct([1, 2, 2, 3, 1]) +``` + +結果: + +``` text +┌─arrayDistinct([1, 2, 2, 3, 1])─┐ +│ [1,2,3] │ +└────────────────────────────────┘ +``` + +## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} + +ソース配列と同じサイズの配列を返し、各要素がソース配列のどこに最初に現れるかを示します。 + +例えば: + +``` sql +SELECT arrayEnumerateDense([10, 20, 10, 30]) +``` + +``` text +┌─arrayEnumerateDense([10, 20, 10, 30])─┐ +│ [1,2,1,3] │ +└───────────────────────────────────────┘ +``` + +## arrayIntersect(arr) {#array-functions-arrayintersect} + +複数の配列を取り、すべてのソース配列に存在する要素を持つ配列を返します。 結果の配列内の要素の順序は、最初の配列と同じです。 + +例えば: + +``` sql +SELECT + arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, + arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect +``` + +``` text +┌─no_intersect─┬─intersect─┐ +│ [] │ [1] │ +└──────────────┴───────────┘ +``` + +## arrayReduce {#arrayreduce} + +集計関数を配列要素に適用し、その結果を返します。 集約関数の名前は、一重引quotesで文字列として渡されます `'max'`, `'sum'`. パラメトリック集約関数を使用する場合、パラメータは関数名の後に括弧で囲んで示されます `'uniqUpTo(6)'`. + +**構文** + +``` sql +arrayReduce(agg_func, arr1, arr2, ..., arrN) +``` + +**パラメータ** + +- `agg_func` — The name of an aggregate function which should be a constant [文字列](../../sql-reference/data-types/string.md). +- `arr` — Any number of [配列](../../sql-reference/data-types/array.md) 集計関数のパラメーターとして列を入力します。 + +**戻り値** + +**例えば** + +``` sql +SELECT arrayReduce('max', [1, 2, 3]) +``` + +``` text +┌─arrayReduce('max', [1, 2, 3])─┐ +│ 3 │ +└───────────────────────────────┘ +``` + +集計関数が複数の引数を取る場合、この関数は同じサイズの複数の配列に適用する必要があります。 + +``` sql +SELECT arrayReduce('maxIf', [3, 5], [1, 0]) +``` + +``` text +┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ +│ 3 │ +└──────────────────────────────────────┘ +``` + +パラメトリック集計関数の使用例: + +``` sql +SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) +``` + +``` text +┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ +│ 4 │ +└─────────────────────────────────────────────────────────────┘ +``` + +## arrayreduceinrangesname {#arrayreduceinranges} + +指定された範囲の配列要素に集計関数を適用し、各範囲に対応する結果を含む配列を返します。 この関数は、同じ結果を複数として返します `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. + +**構文** + +``` sql +arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) +``` + +**パラメータ** + +- `agg_func` — The name of an aggregate function which should be a constant [文字列](../../sql-reference/data-types/string.md). +- `ranges` — The ranges to aggretate which should be an [配列](../../sql-reference/data-types/array.md) の [タプル](../../sql-reference/data-types/tuple.md) 各範囲のインデックスと長さを含む。 +- `arr` — Any number of [配列](../../sql-reference/data-types/array.md) 集計関数のパラメーターとして列を入力します。 + +**戻り値** + +**例えば** + +``` sql +SELECT arrayReduceInRanges( + 'sum', + [(1, 5), (2, 3), (3, 4), (4, 4)], + [1000000, 200000, 30000, 4000, 500, 60, 7] +) AS res +``` + +``` text +┌─res─────────────────────────┐ +│ [1234500,234000,34560,4567] │ +└─────────────────────────────┘ +``` + +## arrayReverse(arr) {#arrayreverse} + +要素を含む元の配列と同じサイズの配列を逆の順序で返します。 + +例えば: + +``` sql +SELECT arrayReverse([1, 2, 3]) +``` + +``` text +┌─arrayReverse([1, 2, 3])─┐ +│ [3,2,1] │ +└─────────────────────────┘ +``` + +## リバース(arr) {#array-functions-reverse} + +の同義語 [“arrayReverse”](#array_functions-arrayreverse) + +## arrayFlatten {#arrayflatten} + +配列の配列をフラット配列に変換します。 + +機能: + +- ネストされた配列の任意の深さに適用されます。 +- 既にフラットな配列は変更されません。 + +の平坦化された配列を含むすべての要素をすべてソース配列. + +**構文** + +``` sql +flatten(array_of_arrays) +``` + +エイリアス: `flatten`. + +**パラメータ** + +- `array_of_arrays` — [配列](../../sql-reference/data-types/array.md) 配列の。 例えば, `[[1,2,3], [4,5]]`. + +**例** + +``` sql +SELECT flatten([[[1]], [[2], [3]]]) +``` + +``` text +┌─flatten(array(array([1]), array([2], [3])))─┐ +│ [1,2,3] │ +└─────────────────────────────────────────────┘ +``` + +## arrayCompact {#arraycompact} + +配列から連続した重複する要素を削除します。 結果値の順序は、ソース配列の順序によって決まります。 + +**構文** + +``` sql +arrayCompact(arr) +``` + +**パラメータ** + +`arr` — The [配列](../../sql-reference/data-types/array.md) 検査する。 + +**戻り値** + +重複のない配列。 + +タイプ: `Array`. + +**例えば** + +クエリ: + +``` sql +SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) +``` + +結果: + +``` text +┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ +│ [1,nan,nan,2,3] │ +└────────────────────────────────────────────┘ +``` + +## arrayZip {#arrayzip} + +Combine multiple Array type columns into one Array\[Tuple(…)\] column + +**構文** + +``` sql +arrayZip(arr1, arr2, ..., arrN) +``` + +**パラメータ** + +`arr` — Any number of [配列](../../sql-reference/data-types/array.md) 結合する列を入力します。 + +**戻り値** + +The result of Array\[Tuple(…)\] type after the combination of these arrays + +**例えば** + +クエリ: + +``` sql +SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); +``` + +結果: + +``` text +┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ +│ [('a','d'),('b','e'),('c','f')] │ +└────────────────────────────────────────────┘ +``` + +## arrayAUC {#arrayauc} + +計算auc(機械学習の概念である曲線の下の面積は、詳細を参照してください:https://en.wikipedia.org/wiki/receiver\_operating\_characteristic\#area\_under\_the\_curve). + +**構文** + +``` sql +arrayAUC(arr_scores, arr_labels) +``` + +**パラメータ** +- `arr_scores` — scores prediction model gives. +- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. + +**戻り値** +Float64型のAUC値を返します。 + +**例えば** +クエリ: + +``` sql +select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) +``` + +結果: + +``` text +┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ +│ 0.75 │ +└────────────────────────────────────────---──┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/ja/sql_reference/functions/array_join.md b/docs/ja/sql-reference/functions/array-join.md similarity index 100% rename from docs/ja/sql_reference/functions/array_join.md rename to docs/ja/sql-reference/functions/array-join.md diff --git a/docs/ja/sql-reference/functions/bit-functions.md b/docs/ja/sql-reference/functions/bit-functions.md new file mode 100644 index 00000000000..d55a3a032fc --- /dev/null +++ b/docs/ja/sql-reference/functions/bit-functions.md @@ -0,0 +1,255 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 48 +toc_title: "\u30D3\u30C3\u30C8" +--- + +# ビット機能 {#bit-functions} + +ビット関数は、uint8、uint16、uint32、uint64、int8、int16、int32、int64、float32、またはfloat64のいずれかの種類のペアで機能します。 + +結果の型は、その引数の最大ビットに等しいビットを持つ整数です。 引数のうち少なくとも一方が署名されている場合、結果は署名された番号になります。 引数が浮動小数点数の場合、int64にキャストされます。 + +## bitAnd(a,b) {#bitanda-b} + +## bitOr(a,b) {#bitora-b} + +## bitXor(a,b) {#bitxora-b} + +## bitNot(a) {#bitnota} + +## ビットシフトレフト(a,b) {#bitshiftlefta-b} + +## ビットシフトライト(a,b) {#bitshiftrighta-b} + +## bitRotateLeft(a,b) {#bitrotatelefta-b} + +## bitRotateRight(a,b) {#bitrotaterighta-b} + +## 適者生存 {#bittest} + +任意の整数を受け取り、それを [バイナリ形式](https://en.wikipedia.org/wiki/Binary_number)、指定された位置にあるビットの値を返します。 カウントダウンは右から左に0から始まります。 + +**構文** + +``` sql +SELECT bitTest(number, index) +``` + +**パラメータ** + +- `number` – integer number. +- `index` – position of bit. + +**戻り値** + +指定された位置にあるbitの値を返します。 + +タイプ: `UInt8`. + +**例えば** + +たとえば、ベース43(バイナリ)数値システムの数値は101011です。 + +クエリ: + +``` sql +SELECT bitTest(43, 1) +``` + +結果: + +``` text +┌─bitTest(43, 1)─┐ +│ 1 │ +└────────────────┘ +``` + +別の例: + +クエリ: + +``` sql +SELECT bitTest(43, 2) +``` + +結果: + +``` text +┌─bitTest(43, 2)─┐ +│ 0 │ +└────────────────┘ +``` + +## bitTestAll {#bittestall} + +の結果を返します [論理結合](https://en.wikipedia.org/wiki/Logical_conjunction) 与えられた位置にあるすべてのビットの(and演算子)。 カウントダウンは右から左に0から始まります。 + +ビット演算のためのconjuction: + +0 AND 0 = 0 + +0 AND 1 = 0 + +1 AND 0 = 0 + +1 AND 1 = 1 + +**構文** + +``` sql +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` すべてのポジションがtrueの場合にのみtrue (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). + +**戻り値** + +論理conjuctionの結果を返します。 + +タイプ: `UInt8`. + +**例えば** + +たとえば、ベース43(バイナリ)数値システムの数値は101011です。 + +クエリ: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5) +``` + +結果: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5)─┐ +│ 1 │ +└────────────────────────────┘ +``` + +別の例: + +クエリ: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5, 2) +``` + +結果: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ +│ 0 │ +└───────────────────────────────┘ +``` + +## bitTestAny {#bittestany} + +の結果を返します [論理和](https://en.wikipedia.org/wiki/Logical_disjunction) 与えられた位置にあるすべてのビットの(または演算子)。 カウントダウンは右から左に0から始まります。 + +ビットごとの操作のための分離: + +0 OR 0 = 0 + +0 OR 1 = 1 + +1 OR 0 = 1 + +1 OR 1 = 1 + +**構文** + +``` sql +SELECT bitTestAny(number, index1, index2, index3, index4, ...) +``` + +**パラメータ** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. + +**戻り値** + +論理disjuctionの結果を返します。 + +タイプ: `UInt8`. + +**例えば** + +たとえば、ベース43(バイナリ)数値システムの数値は101011です。 + +クエリ: + +``` sql +SELECT bitTestAny(43, 0, 2) +``` + +結果: + +``` text +┌─bitTestAny(43, 0, 2)─┐ +│ 1 │ +└──────────────────────┘ +``` + +別の例: + +クエリ: + +``` sql +SELECT bitTestAny(43, 4, 2) +``` + +結果: + +``` text +┌─bitTestAny(43, 4, 2)─┐ +│ 0 │ +└──────────────────────┘ +``` + +## ビット数 {#bitcount} + +数値のバイナリ表現で設定されたビット数を計算します。 + +**構文** + +``` sql +bitCount(x) +``` + +**パラメータ** + +- `x` — [整数](../../sql-reference/data-types/int-uint.md) または [浮動小数点](../../sql-reference/data-types/float.md) 番号 この関数は、メモリ内の値表現を使用します。 浮動小数点数をサポートすることができます。 + +**戻り値** + +- 入力番号内のビット数を一つに設定します。 + +この関数は入力値を大きな型に変換しません ([記号の拡張子](https://en.wikipedia.org/wiki/Sign_extension)). 例えば, `bitCount(toUInt8(-1)) = 8`. + +タイプ: `UInt8`. + +**例えば** + +例えば、数333を取ります。 そのバイナリ表現:00000000101001101。 + +クエリ: + +``` sql +SELECT bitCount(333) +``` + +結果: + +``` text +┌─bitCount(333)─┐ +│ 5 │ +└───────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/ja/sql-reference/functions/bitmap-functions.md b/docs/ja/sql-reference/functions/bitmap-functions.md new file mode 100644 index 00000000000..c8e64848bca --- /dev/null +++ b/docs/ja/sql-reference/functions/bitmap-functions.md @@ -0,0 +1,496 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 49 +toc_title: Bitmap +--- + +# ビットマップ関数 {#bitmap-functions} + +ビットマップ関数は、二つのビットマップオブジェクトの値の計算のために働く、そのような、および、または、xor、およびない、などの式の計算を使用し + +ビットマップオブジェクトの構築方法には2種類あります。 一つは-stateを持つ集約関数groupbitmapによって構築されることであり、もう一つは配列オブジェクトによって構築されることである。 また、bitmapオブジェクトをarrayオブジェクトに変換します。 + +RoaringBitmapは、ビットマップオブジェクトの実際の格納中にデータ構造にラップされます。 基数が32以下の場合、Set objetが使用されます。 カーディナリティが32より大きい場合、Rooaringbitmapオブジェクトが使用されます。 そのため、低カーディナリティセットの保存が高速になります。 + +RoaringBitmapの詳細については、以下を参照してください: [鳴き声](https://github.com/RoaringBitmap/CRoaring). + +## bitmapBuild {#bitmap_functions-bitmapbuild} + +符号なし整数配列からビットマップを作成します。 + +``` sql +bitmapBuild(array) +``` + +**パラメータ** + +- `array` – unsigned integer array. + +**例えば** + +``` sql +SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) +``` + +``` text +┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ +│  │ AggregateFunction(groupBitmap, UInt8) │ +└─────┴──────────────────────────────────────────────┘ +``` + +## bitmapToArray {#bitmaptoarray} + +ビットマップを整数配列に変換します。 + +``` sql +bitmapToArray(bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapSubsetInRange {#bitmap-functions-bitmapsubsetinrange} + +指定された範囲のサブセットを返します(range\_endは含みません)。 + +``` sql +bitmapSubsetInRange(bitmap, range_start, range_end) +``` + +**パラメータ** + +- `bitmap` – [ビットマップ](#bitmap_functions-bitmapbuild). +- `range_start` – range start point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `range_end` – range end point(excluded). Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**例えば** + +``` sql +SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +``` text +┌─res───────────────┐ +│ [30,31,32,33,100] │ +└───────────────────┘ +``` + +## bitmapSubsetLimit {#bitmapsubsetlimit} + +ビットマップのサブセットを作成します。 `range_start` と `cardinality_limit`. + +**構文** + +``` sql +bitmapSubsetLimit(bitmap, range_start, cardinality_limit) +``` + +**パラメータ** + +- `bitmap` – [ビットマップ](#bitmap_functions-bitmapbuild). +- `range_start` – The subset starting point. Type: [UInt32](../../sql-reference/data-types/int-uint.md). +- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +サブセット。 + +タイプ: `Bitmap object`. + +**例えば** + +クエリ: + +``` sql +SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +結果: + +``` text +┌─res───────────────────────┐ +│ [30,31,32,33,100,200,500] │ +└───────────────────────────┘ +``` + +## bitmapContains {#bitmap_functions-bitmapcontains} + +かどうかをチェックしますビットマップを含む要素になります。 + +``` sql +bitmapContains(haystack, needle) +``` + +**パラメータ** + +- `haystack` – [ビットマップ](#bitmap_functions-bitmapbuild)、関数が検索する場所。 +- `needle` – Value that the function searches. Type: [UInt32](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- 0 — If `haystack` 含まない `needle`. +- 1 — If `haystack` 含む `needle`. + +タイプ: `UInt8`. + +**例えば** + +``` sql +SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAny {#bitmaphasany} + +るかどうかを判二つのビットマップしていることで交差点にある。 + +``` sql +bitmapHasAny(bitmap1, bitmap2) +``` + +あなたが確信している場合 `bitmap2` 一つの要素が含まれています。 [bitmapContains](#bitmap_functions-bitmapcontains) 機能。 これは、より効率的に動作します。 + +**パラメータ** + +- `bitmap*` – bitmap object. + +**戻り値** + +- `1`,もし `bitmap1` と `bitmap2` 少なくとも同様の要素を持っている。 +- `0` そうでなければ + +**例えば** + +``` sql +SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAll {#bitmaphasall} + +に類似した `hasAll(array, array)` 最初のビットマップに1番目のビットマップのすべての要素が含まれる場合は0を返します。 +二番目の引数が空のビットマップの場合、1を返します。 + +``` sql +bitmapHasAll(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 0 │ +└─────┘ +``` + +## bitmapCardinality {#bitmapcardinality} + +UInt64型のビットマップのカーディナリティを再度実行可能。 + +``` sql +bitmapCardinality(bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapmincomment {#bitmapmin} + +セット内のタイプuint64の最小値を再度取り消し、セットが空の場合はuint32\_max。 + + bitmapMin(bitmap) + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## bitmapMax {#bitmapmax} + +セット内のuint64型の最大値を取り消し、セットが空の場合は0になります。 + + bitmapMax(bitmap) + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## bitmapTransform {#bitmaptransform} + +ビットマップ内の値の配列を別の値の配列に変換すると、結果は新しいビットマップになります。 + + bitmapTransform(bitmap, from_array, to_array) + +**パラメータ** + +- `bitmap` – bitmap object. +- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. +- `to_array` – UInt32 array, its size shall be the same to from\_array. + +**例えば** + +``` sql +SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res +``` + + ┌─res───────────────────┐ + │ [1,3,4,6,7,8,9,10,20] │ + └───────────────────────┘ + +## bitmapAnd {#bitmapand} + +二つのビットマップと計算、結果は新しいビットマップです。 + +``` sql +bitmapAnd(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─┐ +│ [3] │ +└─────┘ +``` + +## bitmapOr {#bitmapor} + +二つのビットマップや計算、結果は新しいビットマップです。 + +``` sql +bitmapOr(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapXor {#bitmapxor} + +二つのビットマップxor計算、結果は新しいビットマップです。 + +``` sql +bitmapXor(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,4,5] │ +└───────────┘ +``` + +## bitmapAndnot {#bitmapandnot} + +二つのビットマップと計算ではなく、結果は新しいビットマップです。 + +``` sql +bitmapAndnot(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## bitmapAndCardinality {#bitmapandcardinality} + +二つのビットマップと計算、型uint64の戻り値のカーディナリティ。 + +``` sql +bitmapAndCardinality(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## ビットmapcardinality {#bitmaporcardinality} + +二つのビットマップまたは計算、型uint64の戻り値のカーディナリティ。 + +``` sql +bitmapOrCardinality(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapXorCardinality {#bitmapxorcardinality} + +二つのビットマップxor計算、型uint64の戻り値のカーディナリティ。 + +``` sql +bitmapXorCardinality(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 4 │ +└─────┘ +``` + +## bitmapAndnotCardinality {#bitmapandnotcardinality} + +二つのビットマップと計算ではなく、型uint64のカーディナリティを返します。 + +``` sql +bitmapAndnotCardinality(bitmap,bitmap) +``` + +**パラメータ** + +- `bitmap` – bitmap object. + +**例えば** + +``` sql +SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 2 │ +└─────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/ja/sql_reference/functions/comparison_functions.md b/docs/ja/sql-reference/functions/comparison-functions.md similarity index 100% rename from docs/ja/sql_reference/functions/comparison_functions.md rename to docs/ja/sql-reference/functions/comparison-functions.md diff --git a/docs/ja/sql-reference/functions/conditional-functions.md b/docs/ja/sql-reference/functions/conditional-functions.md new file mode 100644 index 00000000000..8dacc72d811 --- /dev/null +++ b/docs/ja/sql-reference/functions/conditional-functions.md @@ -0,0 +1,207 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 43 +toc_title: "\u6761\u4EF6\u4ED8\u304D " +--- + +# 条件関数 {#conditional-functions} + +## もし {#if} + +条件分岐を制御します。 と異なりほとんどのシステムclickhouse常に評価さの両方表現 `then` と `else`. + +**構文** + +``` sql +SELECT if(cond, then, else) +``` + +条件の場合 `cond` ゼロ以外の値として評価し、式の結果を返します `then`、および式の結果 `else`、存在する場合は、スキップされます。 この `cond` ゼロまたは `NULL` その後の結果 `then` 式はスキップされる。 `else` 式が存在する場合は、その式が返されます。 + +**パラメータ** + +- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. +- `then` -条件が満たされた場合に返される式。 +- `else` -条件が満たされていない場合に返される式。 + +**戻り値** + +関数が実行されます `then` と `else` 式とその結果を返します。 `cond` ゼロかどうかに終わった。 + +**例えば** + +クエリ: + +``` sql +SELECT if(1, plus(2, 2), plus(2, 6)) +``` + +結果: + +``` text +┌─plus(2, 2)─┐ +│ 4 │ +└────────────┘ +``` + +クエリ: + +``` sql +SELECT if(0, plus(2, 2), plus(2, 6)) +``` + +結果: + +``` text +┌─plus(2, 6)─┐ +│ 8 │ +└────────────┘ +``` + +- `then` と `else` 共通タイプが最も小さい。 + +**例えば:** + +これを取る `LEFT_RIGHT` テーブル: + +``` sql +SELECT * +FROM LEFT_RIGHT + +┌─left─┬─right─┐ +│ ᴺᵁᴸᴸ │ 4 │ +│ 1 │ 3 │ +│ 2 │ 2 │ +│ 3 │ 1 │ +│ 4 │ ᴺᵁᴸᴸ │ +└──────┴───────┘ +``` + +次のクエリは比較します `left` と `right` 値: + +``` sql +SELECT + left, + right, + if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller +FROM LEFT_RIGHT +WHERE isNotNull(left) AND isNotNull(right) + +┌─left─┬─right─┬─is_smaller──────────────────────────┐ +│ 1 │ 3 │ left is smaller than right │ +│ 2 │ 2 │ right is greater or equal than left │ +│ 3 │ 1 │ right is greater or equal than left │ +└──────┴───────┴─────────────────────────────────────┘ +``` + +メモ: `NULL` この例では値は使用されません。 [条件のnull値](#null-values-in-conditionals) セクション。 + +## 三項演算子 {#ternary-operator} + +この作品と同じ `if` 機能。 + +構文: `cond ? then : else` + +を返します `then` この `cond` true(ゼロより大きい)と評価され、それ以外の場合は `else`. + +- `cond` のタイプである必要があります `UInt8`、と `then` と `else` 共通タイプが最も小さい。 + +- `then` と `else` できる。 `NULL` + +**また見なさい** + +- [ifNotFinite](other-functions.md#ifnotfinite). + +## multif {#multiif} + +あなたが書くことができます [CASE](../operators.md#operator_case) クエリでよりコンパクトに演算子。 + +構文: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` + +**パラメータ:** + +- `cond_N` — The condition for the function to return `then_N`. +- `then_N` — The result of the function when executed. +- `else` — The result of the function if none of the conditions is met. + +この関数は、 `2N+1` パラメータ。 + +**戻り値** + +この関数は、いずれかの値を返します `then_N` または `else`、条件に応じて `cond_N`. + +**例えば** + +再度を使用して `LEFT_RIGHT` テーブル。 + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─result──────────┐ +│ ᴺᵁᴸᴸ │ 4 │ Null value │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ left is greater │ +│ 4 │ ᴺᵁᴸᴸ │ Null value │ +└──────┴───────┴─────────────────┘ +``` + +## 条件付き結果を直接使用する {#using-conditional-results-directly} + +条件は常に次のようになります `0`, `1` または `NULL`. できますので使用条件と結果が直接このような: + +``` sql +SELECT left < right AS is_small +FROM LEFT_RIGHT + +┌─is_small─┐ +│ ᴺᵁᴸᴸ │ +│ 1 │ +│ 0 │ +│ 0 │ +│ ᴺᵁᴸᴸ │ +└──────────┘ +``` + +## 条件のnull値 {#null-values-in-conditionals} + +とき `NULL` 値は条件文に含まれ、結果は次のようになります `NULL`. + +``` sql +SELECT + NULL < 1, + 2 < NULL, + NULL < NULL, + NULL = NULL + +┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ +│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└───────────────┴───────────────┴──────────────────┴────────────────────┘ +``` + +したがって、型が `Nullable`. + +次の例は、equals条件を追加できないことを示しています `multiIf`. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─faulty_result────┐ +│ ᴺᵁᴸᴸ │ 4 │ Both equal │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ right is smaller │ +│ 4 │ ᴺᵁᴸᴸ │ Both equal │ +└──────┴───────┴──────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/ja/sql-reference/functions/date-time-functions.md b/docs/ja/sql-reference/functions/date-time-functions.md new file mode 100644 index 00000000000..1a67977fb2d --- /dev/null +++ b/docs/ja/sql-reference/functions/date-time-functions.md @@ -0,0 +1,450 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u65E5\u4ED8\u3068\u6642\u523B\u306E\u64CD\u4F5C" +--- + +# 日付と時刻を操作するための関数 {#functions-for-working-with-dates-and-times} + +タイムゾーンのサポート + +タイムゾーンの論理的使用を持つ日付と時刻を操作するためのすべての関数は、二番目の省略可能なタイムゾーン引数を受け入れることができます。 例:アジア/エカテリンブルク。 この場合、ローカル(デフォルト)の代わりに指定されたタイムゾーンを使用します。 + +``` sql +SELECT + toDateTime('2016-06-15 23:00:00') AS time, + toDate(time) AS date_local, + toDate(time, 'Asia/Yekaterinburg') AS date_yekat, + toString(time, 'US/Samoa') AS time_samoa +``` + +``` text +┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ +└─────────────────────┴────────────┴────────────┴─────────────────────┘ +``` + +UTCと時間数が異なるタイムゾーンのみがサポートされます。 + +## トティメゾン {#totimezone} + +時刻または日付と時刻を指定したタイムゾーンに変換します。 + +## toYear {#toyear} + +時刻を含む日付または日付を年番号(ad)を含むuint16番号に変換します。 + +## toQuarter {#toquarter} + +時刻を含む日付または日付を、四半期番号を含むuint8番号に変換します。 + +## トモント県france.kgm {#tomonth} + +時刻を含む日付または日付を、月番号(1~12)を含むuint8番号に変換します。 + +## 今日の年 {#todayofyear} + +時刻を含む日付または日付を、その年の日付の番号(1-366)を含むuint16番号に変換します。 + +## toDayOfMonth {#todayofmonth} + +時刻を含む日付または日付を、その月の日の番号(1-31)を含むuint8番号に変換します。 + +## toDayOfWeek {#todayofweek} + +時刻を含む日付または日付を、曜日の番号を含むuint8番号に変換します(月曜日は1、日曜日は7)。 + +## tohourgenericname {#tohour} + +時刻を含む日付を、uint8の24時間(0-23)の時刻を含む数値に変換します。 +This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). + +## toMinute {#tominute} + +時刻を含む日付を、時刻の分(0~59)の数を含むuint8数値に変換します。 + +## ト秒 {#tosecond} + +Timeを含む日付をUInt8の数値に変換します(0~59)。 +うるう秒は説明されていません。 + +## toUnixTimestamp {#to-unix-timestamp} + +For DateTime argument:値を内部の数値表現(Unixタイムスタンプ)に変換します。 +文字列引数の場合:タイムゾーンに従って文字列からのdatetimeを解析します(オプションの第二引数、サーバーのタイムゾーンはデフォルトで使用されます)。 +日付の引数の場合:この動作は指定されていません。 + +**構文** + +``` sql +toUnixTimestamp(datetime) +toUnixTimestamp(str, [timezone]) +``` + +**戻り値** + +- Unixタイムスタンプを返す。 + +タイプ: `UInt32`. + +**例えば** + +クエリ: + +``` sql +SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp +``` + +結果: + +``` text +┌─unix_timestamp─┐ +│ 1509836867 │ +└────────────────┘ +``` + +## toStartOfYear {#tostartofyear} + +日付または日付のある時刻を年の最初の日に切り捨てます。 +日付を返します。 + +## tostartofisoyearcomment {#tostartofisoyear} + +日付または日付と時刻をiso暦年の最初の日に切り捨てます。 +日付を返します。 + +## toStartOfQuarter {#tostartofquarter} + +日付または日付のある時刻を四半期の最初の日に切り捨てます。 +四半期の最初の日はどちらかです1月,1四月,1七月,若しくは1十月. +日付を返します。 + +## toStartOfMonth {#tostartofmonth} + +日付または日付と時刻を月の最初の日に切り捨てます。 +日付を返します。 + +!!! attention "注意" + 間違った日付を解析する動作は実装固有です。 clickhouseはゼロの日付を返したり、例外をスローしたりします “natural” オーバーフロー + +## toMonday {#tomonday} + +日付または日付と時刻を最も近い月曜日に切り捨てます。 +日付を返します。 + +## toStartOfWeek(t\[,mode\]) {#tostartofweektmode} + +日付または日付と時刻を、モード別に最も近い日曜日または月曜日に切り捨てます。 +日付を返します。 +Mode引数は、toWeek()のmode引数とまったく同じように動作します。 単一引数の構文では、モード値0が使用されます。 + +## toStartOfDay {#tostartofday} + +時刻を含む日付をその日の始まりに切り捨てます。 + +## toStartOfHour {#tostartofhour} + +時刻を含む日付を時間の開始位置に切り捨てます。 + +## toStartOfMinute {#tostartofminute} + +日付と時刻が分の先頭に切り捨てられます。 + +## toStartOfFiveMinute {#tostartoffiveminute} + +日付と時刻を切り捨てます。 + +## トスタートオフテンミニュート {#tostartoftenminutes} + +日付と時刻を切り捨てます。 + +## トスタートオフィフテンミニュート {#tostartoffifteenminutes} + +日付と時刻を切り捨てます。 + +## toStartOfInterval(time\_or\_data,間隔xユニット\[,time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} + +これは、名前の付いた他の関数の一般化です `toStartOf*`. 例えば, +`toStartOfInterval(t, INTERVAL 1 year)` と同じを返します `toStartOfYear(t)`, +`toStartOfInterval(t, INTERVAL 1 month)` と同じを返します `toStartOfMonth(t)`, +`toStartOfInterval(t, INTERVAL 1 day)` と同じを返します `toStartOfDay(t)`, +`toStartOfInterval(t, INTERVAL 15 minute)` と同じを返します `toStartOfFifteenMinutes(t)` など。 + +## トタイム {#totime} + +時刻を保持しながら、時刻を含む日付を特定の固定日付に変換します。 + +## torelativeyearnumcomment {#torelativeyearnum} + +時刻または日付の日付を、過去の特定の固定小数点から始まる年の数に変換します。 + +## torelativequarternumcomment {#torelativequarternum} + +時刻または日付の日付を、過去の特定の固定小数点から開始して、四半期の数に変換します。 + +## torelativemonthnumcomment {#torelativemonthnum} + +時刻または日付を含む日付を、過去の特定の固定小数点から始まる月の数に変換します。 + +## torelativeweeknumcomment {#torelativeweeknum} + +時刻または日付を含む日付を、過去の特定の固定小数点から始まる週の数に変換します。 + +## torrelativedaynumcomment {#torelativedaynum} + +時刻または日付を含む日付を、過去の特定の固定小数点から始まる日の数に変換します。 + +## torrelativehournumgenericname {#torelativehournum} + +時刻または日付の日付を、過去の特定の固定小数点から始まる時間の数値に変換します。 + +## toRelativeMinuteNum {#torelativeminutenum} + +時刻または日付の日付を、過去の特定の固定小数点から始まる分の数値に変換します。 + +## torrelativesecondnumcomdnamescription {#torelativesecondnum} + +時刻または日付の日付を、過去の特定の固定小数点から開始して秒の数値に変換します。 + +## toISOYear {#toisoyear} + +時刻を含む日付または日付を、iso年番号を含むuint16番号に変換します。 + +## toISOWeek {#toisoweek} + +時刻を含む日付または日付を、iso週番号を含むuint8番号に変換します。 + +## toWeek(日付\[,モード\]) {#toweekdatemode} + +この関数は、dateまたはdatetimeの週番号を返します。 また、戻り値の範囲が0から53または1から53のどちらであるかを指定することができます。 引数modeを省略すると、デフォルトのモードは0になります。 +`toISOWeek()`は、以下と同等の互換性関数です `toWeek(date,3)`. +次の表では、mode引数の動作について説明します。 + +| モード | 週の最初の日 | 範囲 | Week 1 is the first week … | +|--------|--------------|------|----------------------------| +| 0 | 日曜日 | 0-53 | 今年の日曜日に | +| 1 | 月曜日 | 0-53 | 今年は4日以上 | +| 2 | 日曜日 | 1-53 | 今年の日曜日に | +| 3 | 月曜日 | 1-53 | 今年は4日以上 | +| 4 | 日曜日 | 0-53 | 今年は4日以上 | +| 5 | 月曜日 | 0-53 | 今年の月曜日と | +| 6 | 日曜日 | 1-53 | 今年は4日以上 | +| 7 | 月曜日 | 1-53 | 今年の月曜日と | +| 8 | 日曜日 | 1-53 | 含まれ月1 | +| 9 | 月曜日 | 1-53 | 含まれ月1 | + +意味のあるモード値の場合 “with 4 or more days this year,” 週はISO8601:1988に従って番号が付けられます: + +- 1月を含む週がある場合4新年の日,それは週です1. + +- それ以外の場合は、前年の最後の週であり、次の週は1週です。 + +意味のあるモード値の場合 “contains January 1” の週の月には1週間に1. たとえそれが一日だけ含まれていても、その週に含まれている新年の日数は関係ありません。 + +``` sql +toWeek(date, [, mode][, Timezone]) +``` + +**パラメータ** + +- `date` – Date or DateTime. +- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. +- `Timezone` – Optional parameter, it behaves like any other conversion function. + +**例えば** + +``` sql +SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; +``` + +``` text +┌───────date─┬─week0─┬─week1─┬─week9─┐ +│ 2016-12-27 │ 52 │ 52 │ 1 │ +└────────────┴───────┴───────┴───────┘ +``` + +## toeearweek(日付\[,モード\]) {#toyearweekdatemode} + +日付の年と週を返します。 結果の年は、その年の最初と最後の週の日付の引数の年とは異なる場合があります。 + +Mode引数は、toWeek()のmode引数とまったく同じように動作します。 単一引数の構文では、モード値0が使用されます。 + +`toISOYear()`は、以下と同等の互換性関数です `intDiv(toYearWeek(date,3),100)`. + +**例えば** + +``` sql +SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; +``` + +``` text +┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ +│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ +└────────────┴───────────┴───────────┴───────────┘ +``` + +## さて {#now} + +ゼロ引数を受け取り、リクエスト実行のいずれかの時点で現在の時刻を返します。 +この関数は、要求が完了するまでに長い時間がかかった場合でも、定数を返します。 + +## 今日 {#today} + +ゼロ引数を受け取り、リクエスト実行のいずれかの時点で現在の日付を返します。 +同じように ‘toDate(now())’. + +## 昨日 {#yesterday} + +ゼロの引数を受け取り、リクエストの実行のいずれかの時点で、昨日の日付を返します。 +同じように ‘today() - 1’. + +## タイムスロット {#timeslot} + +時間を半分時間に丸めます。 +この機能はyandexに固有です。トラッキングタグがこの量よりも厳密に時間が異なる単一のユーザーの連続したページビューを表示する場合、セッションを二つのセッションに分割す つまり、タプル(タグid、ユーザー id、およびタイムスロット)を使用して、対応するセッションに含まれるページビューを検索できます。 + +## toYYYYMM {#toyyyymm} + +時刻を含む日付または日付を、年と月の数値(yyyy\*100+mm)を含むuint32番号に変換します。 + +## toyyymmdd {#toyyyymmdd} + +時刻を含む日付または日付を、年と月の数値(yyyy\*10000+mm\*100+dd)を含むuint32番号に変換します。 + +## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} + +時刻付きの日付または日付を、年と月の数値を含むuint64番号に変換します(yyyy\*10000000000+mm\*100000000+dd\*1000000+hh\*10000+mm\*100+ss)。 + +## addYears,addMonths,addweks,addDays,addHours,addMinutes,addSeconds,addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} + +関数は、日付/日付時刻の間隔を日付/日付時刻に追加してから、日付/日付時刻を返します。 例えば: + +``` sql +WITH + toDate('2018-01-01') AS date, + toDateTime('2018-01-01 00:00:00') AS date_time +SELECT + addYears(date, 1) AS add_years_with_date, + addYears(date_time, 1) AS add_years_with_date_time +``` + +``` text +┌─add_years_with_date─┬─add_years_with_date_time─┐ +│ 2019-01-01 │ 2019-01-01 00:00:00 │ +└─────────────────────┴──────────────────────────┘ +``` + +## subtractYears,subtractMonths,subtractWeeks,subtractDays,subtractHours,subtractMinutes,subtractSeconds,subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} + +関数date/datetime間隔をdate/datetimeに減算し、date/datetimeを返します。 例えば: + +``` sql +WITH + toDate('2019-01-01') AS date, + toDateTime('2019-01-01 00:00:00') AS date_time +SELECT + subtractYears(date, 1) AS subtract_years_with_date, + subtractYears(date_time, 1) AS subtract_years_with_date_time +``` + +``` text +┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ +│ 2018-01-01 │ 2018-01-01 00:00:00 │ +└──────────────────────────┴───────────────────────────────┘ +``` + +## dateDiff {#datediff} + +日付または日付時刻値の差を返します。 + +**構文** + +``` sql +dateDiff('unit', startdate, enddate, [timezone]) +``` + +**パラメータ** + +- `unit` — Time unit, in which the returned value is expressed. [文字列](../syntax.md#syntax-string-literal). + + Supported values: + + | unit | + | ---- | + |second | + |minute | + |hour | + |day | + |week | + |month | + |quarter | + |year | + +- `startdate` — The first time value to compare. [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). + +- `enddate` — The second time value to compare. [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). + +- `timezone` — Optional parameter. If specified, it is applied to both `startdate` と `enddate`. 指定されていない場合は、 `startdate` と `enddate` 使用されます。 それらが同じでない場合、結果は不特定です。 + +**戻り値** + +の違い `startdate` と `enddate` で表現 `unit`. + +タイプ: `int`. + +**例えば** + +クエリ: + +``` sql +SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); +``` + +結果: + +``` text +┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ +│ 25 │ +└────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## timeSlots(StartTime,Duration,\[,Size\]) {#timeslotsstarttime-duration-size} + +で始まる時間間隔のために ‘StartTime’ そしてのために継続 ‘Duration’ 秒、この間隔からのポイントからなる時間内のモーメントの配列を返します。 ‘Size’ 数秒で。 ‘Size’ オプションのパラメーターです:既定では定数UInt32を1800に設定します。 +例えば, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. +これは、対応するセッションでページビューを検索するために必要です。 + +## formatDateTime(時間,フォーマット\[,タイムゾーン\]) {#formatdatetime} + +Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. + +形式のサポートされている修飾子: +(“Example” このページを正しく表示するフォーマット結果のための時間 `2018-01-02 22:33:44`) + +| 修飾子 | 説明 | 例えば | +|--------|----------------------------------------------------|------------| +| %C | 年を100で除算し、整数(00から99)に切り捨てられます) | 20 | +| %d | 月の日、ゼロ-パディング(01-31) | 02 | +| %D | %m/%d/%yに相当する短いmm/dd/yy日付 | 01/02/18 | +| %e | 月の日、スペース埋め(1-31) | 2 | +| %F | %Y-%m-%dに相当する短いYYYY-MM-DD日付 | 2018-01-02 | +| %H | 24時間形式(00-23)の時間) | 22 | +| %I | 時間で12h形式(01-12) | 10 | +| %j | 年の日(001-366) | 002 | +| %m | 月を小数(01-12)として指定します) | 01 | +| %M | 分(00-59) | 33 | +| %n | 改行文字(") | | +| %p | AMまたはPMの指定 | PM | +| %R | 24時間HH:MM時間、%Hに相当する:%M | 22:33 | +| %S | 二番目に(00-59) | 44 | +| %t | 水平タブ文字(’) | | +| %T | ISO8601時刻フォーマット(HH:MM:SS)、%H:%M:%Sに相当 | 22:33:44 | +| %u | ISO8601月曜日が1(1-7)の数値としての平日) | 2 | +| %V | ISO8601週番号(01-53) | 01 | +| %w | weekday as a decimal number with Sunday as0(0-6) | 2 | +| %y | 年,最後の二つの数字(00-99) | 18 | +| %Y | 年 | 2018 | +| %% | %記号 | % | + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/ja/sql-reference/functions/encoding-functions.md b/docs/ja/sql-reference/functions/encoding-functions.md new file mode 100644 index 00000000000..90cdda5f243 --- /dev/null +++ b/docs/ja/sql-reference/functions/encoding-functions.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 52 +toc_title: "\u30A8\u30F3\u30B3\u30FC\u30C9" +--- + +# エンコード関数 {#encoding-functions} + +## 文字 {#char} + +渡された引数の数として長さを持つ文字列を返し、各バイトは対応する引数の値を持ちます。 数値型の複数の引数を受け取ります。 引数の値がuint8データ型の範囲外である場合は、丸めとオーバーフローが可能な状態でuint8に変換されます。 + +**構文** + +``` sql +char(number_1, [number_2, ..., number_n]); +``` + +**パラメータ** + +- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../../sql-reference/data-types/int-uint.md), [フロート](../../sql-reference/data-types/float.md). + +**戻り値** + +- 指定されたバイトの文字列。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello +``` + +結果: + +``` text +┌─hello─┐ +│ hello │ +└───────┘ +``` + +を構築できます文字列の任意のエンコードに対応するバイトまでとなります。 utf-8の例を次に示します: + +クエリ: + +``` sql +SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; +``` + +結果: + +``` text +┌─hello──┐ +│ привет │ +└────────┘ +``` + +クエリ: + +``` sql +SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; +``` + +結果: + +``` text +┌─hello─┐ +│ 你好 │ +└───────┘ +``` + +## 六角 {#hex} + +引数の十六進表現を含む文字列を返します。 + +**構文** + +``` sql +hex(arg) +``` + +この関数は大文字を使用しています `A-F` 接頭辞(など)を使用しないでください `0x` または接尾辞(のような `h`). + +整数引数の場合は、六角数字を出力します (“nibbles”)最も重要なものから最も重要なもの(ビッグエンディアンまたは “human readable” 順序)。 最も重要な非ゼロバイト(先行ゼロバイトは省略されています)で始まりますが、先行桁がゼロであっても常に各バイトの両方の桁を出力します。 + +例えば: + +**例えば** + +クエリ: + +``` sql +SELECT hex(1); +``` + +結果: + +``` text +01 +``` + +タイプの値 `Date` と `DateTime` 対応する整数としてフォーマットされます(日付のエポックからの日数と、DateTimeのUnixタイムスタンプの値)。 + +のために `String` と `FixedString` すべてのバイトは、単に二進数として符号化される。 ゼロバイトは省略されません。 + +浮動小数点型と小数型の値は、メモリ内での表現としてエンコードされます。 支援においても少しエンディアン、建築、その符号化されたのでちょっとエンディアンです。※ ゼロ先行/末尾のバイトは省略されません。 + +**パラメータ** + +- `arg` — A value to convert to hexadecimal. Types: [文字列](../../sql-reference/data-types/string.md), [UInt](../../sql-reference/data-types/int-uint.md), [フロート](../../sql-reference/data-types/float.md), [小数](../../sql-reference/data-types/decimal.md), [日付](../../sql-reference/data-types/date.md) または [DateTime](../../sql-reference/data-types/datetime.md). + +**戻り値** + +- 引数の十六進表現を持つ文字列。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); +``` + +結果: + +``` text +┌─hex_presentation─┐ +│ 00007041 │ +│ 00008041 │ +└──────────────────┘ +``` + +クエリ: + +``` sql +SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); +``` + +結果: + +``` text +┌─hex_presentation─┐ +│ 0000000000002E40 │ +│ 0000000000003040 │ +└──────────────────┘ +``` + +## unhex(str)) {#unhexstr} + +任意の数の進数を含む文字列を受け取り、対応するバイトを含む文字列を返します。 十六進数の数字は偶数である必要はありません。 奇数の場合、最後の桁は、00-0fバイトの最下位半分として解釈されます。 引数stringに十六進数以外の桁数が含まれている場合、実装定義の結果が返されます(例外はスローされません)。 +結果を数値に変換したい場合は、 ‘reverse’ と ‘reinterpretAsType’ 機能。 + +## UUIDStringToNum(str)) {#uuidstringtonumstr} + +次の形式の36文字を含む文字列を受け取ります `123e4567-e89b-12d3-a456-426655440000`、およびFixedString(16)のバイトのセットとして返します。 + +## UUIDNumToString(str)) {#uuidnumtostringstr} + +FixedString(16)値を受け取ります。 テキスト形式で36文字を含む文字列を返します。 + +## ビットマスクトリスト(num) {#bitmasktolistnum} + +整数を受け入れます。 合計されたときにソース番号を合計する二つの累乗のリストを含む文字列を返します。 これらは、昇順で、テキスト形式のスペースなしでコンマ区切りです。 + +## ビットマスクアレール(num) {#bitmasktoarraynum} + +整数を受け入れます。 合計されたときにソース番号を合計する二つの累乗のリストを含むuint64数の配列を返します。 配列内の数字は昇順です。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/ja/sql-reference/functions/ext-dict-functions.md b/docs/ja/sql-reference/functions/ext-dict-functions.md new file mode 100644 index 00000000000..f0cee39c75e --- /dev/null +++ b/docs/ja/sql-reference/functions/ext-dict-functions.md @@ -0,0 +1,205 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 58 +toc_title: "\u5916\u90E8\u8F9E\u66F8\u306E\u64CD\u4F5C" +--- + +# 外部辞書を操作するための関数 {#ext_dict_functions} + +情報の接続や設定の外部辞書参照 [外部辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +## dictGet {#dictget} + +外部ディクショナリから値を取得します。 + +``` sql +dictGet('dict_name', 'attr_name', id_expr) +dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**パラメータ** + +- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql-reference/data-types/int-uint.md) または [タプル](../../sql-reference/data-types/tuple.md)-辞書構成に応じて値を入力します。 +- `default_value_expr` — Value returned if the dictionary doesn’t contain a row with the `id_expr` キー。 [式](../syntax.md#syntax-expressions) に設定されたデータ型の値を返します。 `attr_name` 属性。 + +**戻り値** + +- クリックハウスで属性が正常に解析された場合 [属性のデータ型](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes)、関数は、に対応する辞書属性の値を返します `id_expr`. + +- キーがない場合、対応する `id_expr`、辞書では、その後: + + - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. + +ClickHouseは、属性の値を解析できない場合、または値が属性データ型と一致しない場合に例外をスローします。 + +**例えば** + +テキストファイルの作成 `ext-dict-text.csv` 以下を含む: + +``` text +1,1 +2,2 +``` + +最初の列は次のとおりです `id`、第二の列は `c1`. + +外部ディクショナリの設定: + +``` xml + + + ext-dict-test + + + /path-to/ext-dict-test.csv + CSV + + + + + + + + id + + + c1 + UInt32 + + + + 0 + + +``` + +クエリの実行: + +``` sql +SELECT + dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, + toTypeName(val) AS type +FROM system.numbers +LIMIT 3 +``` + +``` text +┌─val─┬─type───┐ +│ 1 │ UInt32 │ +│ 2 │ UInt32 │ +│ 20 │ UInt32 │ +└─────┴────────┘ +``` + +**また見なさい** + +- [外部辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) + +## dictHas {#dicthas} + +キーが辞書に存在するかどうかを確認します。 + +``` sql +dictHas('dict_name', id_expr) +``` + +**パラメータ** + +- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ値。 + +**戻り値** + +- 0、キーがない場合。 +- 1、キーがある場合。 + +タイプ: `UInt8`. + +## 独裁主義体制 {#dictgethierarchy} + +キーのすべての親を含む配列を作成します。 [階層辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md). + +**構文** + +``` sql +dictGetHierarchy('dict_name', key) +``` + +**パラメータ** + +- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). +- `key` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ値。 + +**戻り値** + +- キーの親。 + +タイプ: [配列(uint64)](../../sql-reference/data-types/array.md). + +## ディクティシン {#dictisin} + +辞書内の階層チェーン全体を通じてキーの祖先をチェックします。 + +``` sql +dictIsIn('dict_name', child_id_expr, ancestor_id_expr) +``` + +**パラメータ** + +- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). +- `child_id_expr` — Key to be checked. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ値。 +- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` キー。 [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ値。 + +**戻り値** + +- 0,if `child_id_expr` の子ではありません `ancestor_id_expr`. +- 1、場合 `child_id_expr` の子です `ancestor_id_expr` または `child_id_expr` は `ancestor_id_expr`. + +タイプ: `UInt8`. + +## その他の機能 {#ext_dict_functions-other} + +ClickHouseは、辞書構成に関係なく、辞書属性値を特定のデータ型に変換する特殊な関数をサポートしています。 + +機能: + +- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` +- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` +- `dictGetFloat32`, `dictGetFloat64` +- `dictGetDate` +- `dictGetDateTime` +- `dictGetUUID` +- `dictGetString` + +これらの機能はすべて、 `OrDefault` 変更。 例えば, `dictGetDateOrDefault`. + +構文: + +``` sql +dictGet[Type]('dict_name', 'attr_name', id_expr) +dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**パラメータ** + +- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql-reference/data-types/int-uint.md)-タイプ値。 +- `default_value_expr` — Value which is returned if the dictionary doesn’t contain a row with the `id_expr` キー。 [式](../syntax.md#syntax-expressions) に設定されたデータ型の値を返します。 `attr_name` 属性。 + +**戻り値** + +- クリックハウスで属性が正常に解析された場合 [属性のデータ型](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes)、関数は、に対応する辞書属性の値を返します `id_expr`. + +- 要求がない場合 `id_expr` 辞書では、: + + - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. + +ClickHouseは、属性の値を解析できない場合、または値が属性データ型と一致しない場合に例外をスローします。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/ja/sql-reference/functions/functions-for-nulls.md b/docs/ja/sql-reference/functions/functions-for-nulls.md new file mode 100644 index 00000000000..3d4b21a6a2b --- /dev/null +++ b/docs/ja/sql-reference/functions/functions-for-nulls.md @@ -0,0 +1,312 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 63 +toc_title: "\u30CC\u30EB\u53EF\u80FD\u306A\u5F15\u6570\u306E\u64CD\u4F5C" +--- + +# Null可能な集計を操作するための関数 {#functions-for-working-with-nullable-aggregates} + +## isNull {#isnull} + +引数が [NULL](../syntax.md#null). + +``` sql +isNull(x) +``` + +**パラメータ** + +- `x` — A value with a non-compound data type. + +**戻り値** + +- `1` もし `x` は `NULL`. +- `0` もし `x` はない `NULL`. + +**例えば** + +入力テーブル + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +クエリ + +``` sql +SELECT x FROM t_null WHERE isNull(y) +``` + +``` text +┌─x─┐ +│ 1 │ +└───┘ +``` + +## isNotNull {#isnotnull} + +引数が [NULL](../syntax.md#null). + +``` sql +isNotNull(x) +``` + +**パラメータ:** + +- `x` — A value with a non-compound data type. + +**戻り値** + +- `0` もし `x` は `NULL`. +- `1` もし `x` はない `NULL`. + +**例えば** + +入力テーブル + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +クエリ + +``` sql +SELECT x FROM t_null WHERE isNotNull(y) +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## 合体 {#coalesce} + +左から右にチェックするかどうか `NULL` 引数が渡され、最初の非を返します-`NULL` 引数。 + +``` sql +coalesce(x,...) +``` + +**パラメータ:** + +- 非化合物タイプの任意の数のパラメーター。 すべてのパラメータに対応していることが必要となるデータ型になります。 + +**戻り値** + +- 最初の非-`NULL` 引数。 +- `NULL` すべての引数が `NULL`. + +**例えば** + +顧客に連絡する複数の方法を指定する可能性のある連絡先のリストを考えてみましょう。 + +``` text +┌─name─────┬─mail─┬─phone─────┬──icq─┐ +│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ +│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└──────────┴──────┴───────────┴──────┘ +``` + +その `mail` と `phone` フィールドの型はStringですが、 `icq` フィールドは `UInt32`、それはに変換する必要があります `String`. + +コンタクトリストから顧客の最初の利用可能なコンタクトメソッドを取得する: + +``` sql +SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook +``` + +``` text +┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ +│ client 1 │ 123-45-67 │ +│ client 2 │ ᴺᵁᴸᴸ │ +└──────────┴──────────────────────────────────────────────────────┘ +``` + +## ifNull {#ifnull} + +メイン引数がある場合は、代替値を返します `NULL`. + +``` sql +ifNull(x,alt) +``` + +**パラメータ:** + +- `x` — The value to check for `NULL`. +- `alt` — The value that the function returns if `x` は `NULL`. + +**戻り値** + +- を値 `x`,もし `x` はない `NULL`. +- を値 `alt`,もし `x` は `NULL`. + +**例えば** + +``` sql +SELECT ifNull('a', 'b') +``` + +``` text +┌─ifNull('a', 'b')─┐ +│ a │ +└──────────────────┘ +``` + +``` sql +SELECT ifNull(NULL, 'b') +``` + +``` text +┌─ifNull(NULL, 'b')─┐ +│ b │ +└───────────────────┘ +``` + +## nullifname {#nullif} + +を返します `NULL` 引数が等しい場合。 + +``` sql +nullIf(x, y) +``` + +**パラメータ:** + +`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. + +**戻り値** + +- `NULL` 引数が等しい場合。 +- その `x` 引数が等しくない場合の値。 + +**例えば** + +``` sql +SELECT nullIf(1, 1) +``` + +``` text +┌─nullIf(1, 1)─┐ +│ ᴺᵁᴸᴸ │ +└──────────────┘ +``` + +``` sql +SELECT nullIf(1, 2) +``` + +``` text +┌─nullIf(1, 2)─┐ +│ 1 │ +└──────────────┘ +``` + +## assumeNotNull {#assumenotnull} + +結果はtypeの値になります [Nullable](../../sql-reference/data-types/nullable.md) 非のために- `Nullable` 値がない場合、 `NULL`. + +``` sql +assumeNotNull(x) +``` + +**パラメータ:** + +- `x` — The original value. + +**戻り値** + +- 元の値から非-`Nullable` そうでない場合はタイプします `NULL`. +- のデフォルト値。-`Nullable` 元の値が `NULL`. + +**例えば** + +考慮する `t_null` テーブル。 + +``` sql +SHOW CREATE TABLE t_null +``` + +``` text +┌─statement─────────────────────────────────────────────────────────────────┐ +│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ +└───────────────────────────────────────────────────────────────────────────┘ +``` + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +を適用 `assumeNotNull` に機能 `y` コラム + +``` sql +SELECT assumeNotNull(y) FROM t_null +``` + +``` text +┌─assumeNotNull(y)─┐ +│ 0 │ +│ 3 │ +└──────────────────┘ +``` + +``` sql +SELECT toTypeName(assumeNotNull(y)) FROM t_null +``` + +``` text +┌─toTypeName(assumeNotNull(y))─┐ +│ Int8 │ +│ Int8 │ +└──────────────────────────────┘ +``` + +## toNullable {#tonullable} + +引数の型を次のように変換します `Nullable`. + +``` sql +toNullable(x) +``` + +**パラメータ:** + +- `x` — The value of any non-compound type. + +**戻り値** + +- Aの入力値 `Nullable` タイプ。 + +**例えば** + +``` sql +SELECT toTypeName(10) +``` + +``` text +┌─toTypeName(10)─┐ +│ UInt8 │ +└────────────────┘ +``` + +``` sql +SELECT toTypeName(toNullable(10)) +``` + +``` text +┌─toTypeName(toNullable(10))─┐ +│ Nullable(UInt8) │ +└────────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/ja/sql-reference/functions/geo.md b/docs/ja/sql-reference/functions/geo.md new file mode 100644 index 00000000000..6fe6c20dde8 --- /dev/null +++ b/docs/ja/sql-reference/functions/geo.md @@ -0,0 +1,510 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 62 +toc_title: "\u5730\u7406\u5EA7\u6A19\u306E\u64CD\u4F5C" +--- + +# 地理座標を操作するための関数 {#functions-for-working-with-geographical-coordinates} + +## グレートサークル距離 {#greatcircledistance} + +を使用して、地球の表面上の二つの点の間の距離を計算します [大円式](https://en.wikipedia.org/wiki/Great-circle_distance). + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**入力パラメータ** + +- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. +- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. +- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. +- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. + +正の値は北緯と東経に対応し、負の値は南緯と西経に対応します。 + +**戻り値** + +メートルで、地球の表面上の二つの点の間の距離。 + +入力パラメーター値が範囲外になったときに例外を生成します。 + +**例えば** + +``` sql +SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) +``` + +``` text +┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ +│ 14132374.194975413 │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## pointInEllipses {#pointinellipses} + +ポイントが楕円の少なくとも一つに属するかどうかをチェックします。 +座標は、デカルト座標系ではジオメトリです。 + +``` sql +pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) +``` + +**入力パラメータ** + +- `x, y` — Coordinates of a point on the plane. +- `xᵢ, yᵢ` — Coordinates of the center of the `i`-番目の省略記号。 +- `aᵢ, bᵢ` — Axes of the `i`-x、y座標の単位で番目の省略記号。 + +入力パラ `2+4⋅n`、どこ `n` 楕円の数です。 + +**戻り値** + +`1` ポイントは、楕円の少なくとも一つの内側にある場合; `0`そうでない場合。 + +**例えば** + +``` sql +SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) +``` + +``` text +┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ +│ 1 │ +└─────────────────────────────────────────────────┘ +``` + +## pointInPolygon {#pointinpolygon} + +るかどうかを判の点に属する多角形の面。 + +``` sql +pointInPolygon((x, y), [(a, b), (c, d) ...], ...) +``` + +**入力値** + +- `(x, y)` — Coordinates of a point on the plane. Data type — [タプル](../../sql-reference/data-types/tuple.md) — A tuple of two numbers. +- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [配列](../../sql-reference/data-types/array.md). 各頂点は、座標のペアで表されます `(a, b)`. 頂点は、時計回りまたは反時計回りの順序で指定する必要があります。 頂点の最小数は3です。 多角形は一定でなければなりません。 +- この機能は、穴(切り取られた部分)を持つ多角形もサポートします。 この場合、関数の追加の引数を使用してカットアウトセクションを定義するポリゴンを追加します。 この関数は、単純接続以外のポリゴンをサポートしません。 + +**戻り値** + +`1` ポイントがポリゴンの内側にある場合, `0` そうでない場合。 +ポイントがポリゴン境界上にある場合、関数は0または1を返します。 + +**例えば** + +``` sql +SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## geohashEncode {#geohashencode} + +緯度と経度をgeohash-stringとしてエンコードします。http://geohash.org/,https://en.wikipedia.org/wiki/geohash). + +``` sql +geohashEncode(longitude, latitude, [precision]) +``` + +**入力値** + +- 経度-エンコードしたい座標の経度の部分。 範囲の浮遊`[-180°, 180°]` +- latitude-エンコードする座標の緯度部分。 範囲の浮遊 `[-90°, 90°]` +- precision-オプション、結果としてエンコードされる文字列の長さ。 `12`. 範囲の整数 `[1, 12]`. より小さい任意の値 `1` またはより大きい `12` に変換される。 `12`. + +**戻り値** + +- 英数字 `String` エンコードされた座標(base32エンコードアルファベットの修正版が使用されます)。 + +**例えば** + +``` sql +SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res +``` + +``` text +┌─res──────────┐ +│ ezs42d000000 │ +└──────────────┘ +``` + +## geohashDecode {#geohashdecode} + +Geohashでエンコードされた文字列を経度と緯度にデコードします。 + +**入力値** + +- エンコードされた文字列-geohashエンコードされた文字列。 + +**戻り値** + +- (経度、緯度)-2-のタプル `Float64` 経度と緯度の値。 + +**例えば** + +``` sql +SELECT geohashDecode('ezs42') AS res +``` + +``` text +┌─res─────────────────────────────┐ +│ (-5.60302734375,42.60498046875) │ +└─────────────────────────────────┘ +``` + +## geoToH3 {#geotoh3} + +を返します [H3](https://uber.github.io/h3/#/documentation/overview/introduction) 点指数 `(lon, lat)` 指定決断を使って。 + +[H3](https://uber.github.io/h3/#/documentation/overview/introduction) 地理的指標システムであり、地球の表面は六角形のタイルに分割されています。 トップレベルの各六角形は、より小さいものに分割することができます。 + +このインデックスは、主にバケットの場所やその他の地理空間の操作に使用されます。 + +**構文** + +``` sql +geoToH3(lon, lat, resolution) +``` + +**パラメータ** + +- `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]`. タイプ: [UInt8](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- 六角形のインデックス番号。 +- エラーの場合は0。 + +タイプ: `UInt64`. + +**例えば** + +クエリ: + +``` sql +SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index +``` + +結果: + +``` text +┌────────────h3Index─┐ +│ 644325524701193974 │ +└────────────────────┘ +``` + +## geohashesInBox {#geohashesinbox} + +与えられたボックスの内側にあり、境界と交差する、与えられた精度のgeohashエンコードされた文字列の配列を返します。 + +**入力値** + +- longitude\_min-最小経度、範囲内の浮動小数点数 `[-180°, 180°]` +- latitude\_min-最小緯度、範囲内の浮動小数点数 `[-90°, 90°]` +- longitude\_max-最高の経度、範囲の浮遊価値 `[-180°, 180°]` +- latitude\_max-最大緯度、範囲内の浮動小数点数 `[-90°, 90°]` +- 精密-geohashの精密, `UInt8` 範囲内 `[1, 12]` + +すべての座標パラメータは同じタイプである必要があります。 `Float32` または `Float64`. + +**戻り値** + +- 提供された領域をカバーするgeohash-ボックスの精度の長い文字列の配列、あなたはアイテムの順序に頼るべきではありません。 +- \[\]-空の配列の場合 *分* の値 *緯度* と *経度* 対応するよりも小さくない *最大* 値。 + +結果の配列が10’000’000項目を超える場合、関数は例外をスローすることに注意してください。 + +**例えば** + +``` sql +SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos +``` + +``` text +┌─thasos──────────────────────────────────────┐ +│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ +└─────────────────────────────────────────────┘ +``` + +## h3GetBaseCell {#h3getbasecell} + +インデックスの基本セル番号を返します。 + +**構文** + +``` sql +h3GetBaseCell(index) +``` + +**パラメータ** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- 六角形ベースセル番号。 タイプ: [UInt8](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT h3GetBaseCell(612916788725809151) as basecell +``` + +結果: + +``` text +┌─basecell─┐ +│ 12 │ +└──────────┘ +``` + +## h3HexAreaM2 {#h3hexaream2} + +与えられた解像度で平方メートルの平均六角形の面積。 + +**構文** + +``` sql +h3HexAreaM2(resolution) +``` + +**パラメータ** + +- `resolution` — Index resolution. Range: `[0, 15]`. タイプ: [UInt8](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- Area in m². Type: [Float64](../../sql-reference/data-types/float.md). + +**例えば** + +クエリ: + +``` sql +SELECT h3HexAreaM2(13) as area +``` + +結果: + +``` text +┌─area─┐ +│ 43.9 │ +└──────┘ +``` + +## h3IndexesAreNeighbors {#h3indexesareneighbors} + +指定されたh3indexesが近傍であるかどうかを返します。 + +**構文** + +``` sql +h3IndexesAreNeighbors(index1, index2) +``` + +**パラメータ** + +- `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). + +**戻り値** + +- を返します `1` インデックスが隣接している場合, `0` そうでなければ タイプ: [UInt8](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n +``` + +結果: + +``` text +┌─n─┐ +│ 1 │ +└───┘ +``` + +## h3ToChildren {#h3tochildren} + +指定したインデックスの子インデックスを持つ配列を返します。 + +**構文** + +``` sql +h3ToChildren(index, resolution) +``` + +**パラメータ** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. タイプ: [UInt8](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- 子h3インデックスを持つ配列。 タイプの配列: [UInt64](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT h3ToChildren(599405990164561919, 6) AS children +``` + +結果: + +``` text +┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## h3親 {#h3toparent} + +を返します(粗)インデックスを含むとして指定されたインデックス. + +**構文** + +``` sql +h3ToParent(index, resolution) +``` + +**パラメータ** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. タイプ: [UInt8](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- 親のh3インデックス。 タイプ: [UInt64](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT h3ToParent(599405990164561919, 3) as parent +``` + +結果: + +``` text +┌─────────────parent─┐ +│ 590398848891879423 │ +└────────────────────┘ +``` + +## h3ToString {#h3tostring} + +インデックスのh3index表現を文字列表現に変換します。 + +``` sql +h3ToString(index) +``` + +**パラメータ** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- H3インデックスの文字列表現。 タイプ: [文字列](../../sql-reference/data-types/string.md). + +**例えば** + +クエリ: + +``` sql +SELECT h3ToString(617420388352917503) as h3_string +``` + +結果: + +``` text +┌─h3_string───────┐ +│ 89184926cdbffff │ +└─────────────────┘ +``` + +## stringToH3 {#stringtoh3} + +文字列表現をh3index(uint64)表現に変換します。 + +``` sql +stringToH3(index_str) +``` + +**パラメータ** + +- `index_str` — String representation of the H3 index. Type: [文字列](../../sql-reference/data-types/string.md). + +**戻り値** + +- 六角形のインデックス番号。 エラー時に0を返します。 タイプ: [UInt64](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT stringToH3('89184926cc3ffff') as index +``` + +結果: + +``` text +┌──────────────index─┐ +│ 617420388351344639 │ +└────────────────────┘ +``` + +## h3GetResolution {#h3getresolution} + +インデックスの解像度を返します。 + +**構文** + +``` sql +h3GetResolution(index) +``` + +**パラメータ** + +- `index` — Hexagon index number. Type: [UInt64](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +- インデックスの解決。 範囲: `[0, 15]`. タイプ: [UInt8](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT h3GetResolution(617420388352917503) as res +``` + +結果: + +``` text +┌─res─┐ +│ 9 │ +└─────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/ja/sql-reference/functions/hash-functions.md b/docs/ja/sql-reference/functions/hash-functions.md new file mode 100644 index 00000000000..463ddb251cd --- /dev/null +++ b/docs/ja/sql-reference/functions/hash-functions.md @@ -0,0 +1,446 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 50 +toc_title: "\u30CF\u30C3\u30B7\u30E5" +--- + +# ハッシュ関数 {#hash-functions} + +ハッシュ関数は、要素の決定論的な擬似ランダムシャッフルに使用できます。 + +## ハーフmd5 {#hash-functions-halfmd5} + +[解釈する](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) すべての入力パラメーターを文字列として計算します [MD5](https://en.wikipedia.org/wiki/MD5) それぞれのハッシュ値。 次に、ハッシュを結合し、結果の文字列のハッシュの最初の8バイトを取り、それらを次のように解釈します `UInt64` ビッグエンディアンのバイト順。 + +``` sql +halfMD5(par1, ...) +``` + +この関数は比較的遅い(プロセッサコアあたり5万個の短い文字列)。 +を使用することを検討 [サイファッシュ64](#hash_functions-siphash64) 代わりに機能。 + +**パラメータ** + +この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql-reference/data-types/index.md). + +**戻り値** + +A [UInt64](../../sql-reference/data-types/int-uint.md) データ型ハッシュ値。 + +**例えば** + +``` sql +SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type +``` + +``` text +┌────────halfMD5hash─┬─type───┐ +│ 186182704141653334 │ UInt64 │ +└────────────────────┴────────┘ +``` + +## MD5 {#hash_functions-md5} + +文字列からmd5を計算し、結果のバイトセットをfixedstring(16)として返します。 +特にmd5を必要としないが、適切な暗号化128ビットハッシュが必要な場合は、 ‘sipHash128’ 代わりに機能。 +Md5sumユーティリティによる出力と同じ結果を得たい場合は、lower(hex(MD5(s)))を使用します。 + +## サイファッシュ64 {#hash_functions-siphash64} + +64ビットを生成する [サイファッシュ](https://131002.net/siphash/) ハッシュ値。 + +``` sql +sipHash64(par1,...) +``` + +これは暗号化ハッシュ関数です。 それはより速い少なくとも三回働きます [MD5](#hash_functions-md5) 機能。 + +機能 [解釈する](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) すべての入力パラメータを文字列として計算し、それぞれのハッシュ値を計算します。 その融合ハッシュにより、次のアルゴリズム: + +1. すべての入力パラメータをハッシュした後、関数はハッシュの配列を取得します。 +2. 関数は、第一及び第二の要素を取り、それらの配列のためのハッシュを計算します。 +3. 次に、関数は、前のステップで計算されたハッシュ値と最初のハッシュ配列の第三の要素を取り、それらの配列のハッシュを計算します。 +4. 最初のハッシュ配列の残りのすべての要素について、前の手順が繰り返されます。 + +**パラメータ** + +この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql-reference/data-types/index.md). + +**戻り値** + +A [UInt64](../../sql-reference/data-types/int-uint.md) データ型ハッシュ値。 + +**例えば** + +``` sql +SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type +``` + +``` text +┌──────────────SipHash─┬─type───┐ +│ 13726873534472839665 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## サイファシー128 {#hash_functions-siphash128} + +文字列からサイファッシュを計算します。 +文字列型引数を受け取ります。 fixedstring(16)を返します。 +Siphash64とは異なり、最終的なxor折りたたみ状態は128ビットまでしか行われません。 + +## cityHash64 {#cityhash64} + +64ビットを生成する [CityHash](https://github.com/google/cityhash) ハッシュ値。 + +``` sql +cityHash64(par1,...) +``` + +これは高速な非暗号化ハッシュ関数です。 文字列パラメーターにはcityhashアルゴリズムを使用し、他のデータ型のパラメーターには実装固有の高速非暗号化ハッシュ関数を使用します。 この関数は、最終的な結果を得るためにcityhashコンビネータを使用します。 + +**パラメータ** + +この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql-reference/data-types/index.md). + +**戻り値** + +A [UInt64](../../sql-reference/data-types/int-uint.md) データ型ハッシュ値。 + +**例** + +呼び出しの例: + +``` sql +SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type +``` + +``` text +┌─────────────CityHash─┬─type───┐ +│ 12072650598913549138 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +次の例は、行順序までの精度でテーブル全体のチェックサムを計算する方法を示しています: + +``` sql +SELECT groupBitXor(cityHash64(*)) FROM table +``` + +## intHash32 {#inthash32} + +任意のタイプの整数から32ビットのハッシュコードを計算します。 +これは、数値の平均品質の比較的高速な非暗号化ハッシュ関数です。 + +## intHash64 {#inthash64} + +任意のタイプの整数から64ビットのハッシュコードを計算します。 +それはinthash32より速く働きます。 平均品質。 + +## SHA1 {#sha1} + +## SHA224 {#sha224} + +## SHA256 {#sha256} + +文字列からsha-1、sha-224、またはsha-256を計算し、結果のバイトセットをfixedstring(20)、fixedstring(28)、またはfixedstring(32)として返します。 +この関数はかなりゆっくりと動作します(sha-1はプロセッサコアあたり約5百万個の短い文字列を処理し、sha-224とsha-256は約2.2百万プロセス)。 +特定のハッシュ関数が必要で選択できない場合にのみ、この関数を使用することをお勧めします。 +このような場合でも、テーブルに値を挿入するときは、selectsに値を適用するのではなく、関数をオフラインで適用して事前計算することをお勧めします。 + +## URLHash(url\[,N\]) {#urlhashurl-n} + +いくつかのタイプの正規化を使用してurlから取得した文字列の高速でまともな品質の非暗号化ハッシュ関数。 +`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` または `#` 最後に、存在する場合。 +`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` または `#` 最後に、存在する場合。 +レベルはurlhierarchyと同じです。 この機能はyandexに固有です。メトリカ + +## farmHash64 {#farmhash64} + +64ビットを生成する [FarmHash](https://github.com/google/farmhash) ハッシュ値。 + +``` sql +farmHash64(par1, ...) +``` + +この関数は、 `Hash64` すべてからの方法 [利用可能な方法](https://github.com/google/farmhash/blob/master/src/farmhash.h). + +**パラメータ** + +この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql-reference/data-types/index.md). + +**戻り値** + +A [UInt64](../../sql-reference/data-types/int-uint.md) データ型ハッシュ値。 + +**例えば** + +``` sql +SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type +``` + +``` text +┌─────────────FarmHash─┬─type───┐ +│ 17790458267262532859 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## javaHash {#hash_functions-javahash} + +計算 [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) 文字列から。 このハッシュ関数は高速でも良い品質でもありません。 理由はただそれだけに使用する場合もこのアルゴリズムは実用化が始まっており他のシステムとしての計算は、全く同じ働きをします。 + +**構文** + +``` sql +SELECT javaHash(''); +``` + +**戻り値** + +A `Int32` データ型ハッシュ値。 + +**例えば** + +クエリ: + +``` sql +SELECT javaHash('Hello, world!'); +``` + +結果: + +``` text +┌─javaHash('Hello, world!')─┐ +│ -1880044555 │ +└───────────────────────────┘ +``` + +## javaHashUTF16LE {#javahashutf16le} + +計算 [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) 文字列から、UTF-16LEエンコーディングで文字列を表すバイトが含まれていると仮定します。 + +**構文** + +``` sql +javaHashUTF16LE(stringUtf16le) +``` + +**パラメータ** + +- `stringUtf16le` — a string in UTF-16LE encoding. + +**戻り値** + +A `Int32` データ型ハッシュ値。 + +**例えば** + +UTF-16LEでエンコードされた文字列で正しいクエリー。 + +クエリ: + +``` sql +SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) +``` + +結果: + +``` text +┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ +│ 3556498 │ +└──────────────────────────────────────────────────────────────┘ +``` + +## hiveHash {#hash-functions-hivehash} + +計算 `HiveHash` 文字列から。 + +``` sql +SELECT hiveHash(''); +``` + +これはちょうど [JavaHash](#hash_functions-javahash) サインビットをゼロにします。 この関数は、 [Apacheハイブ](https://en.wikipedia.org/wiki/Apache_Hive) 3.0より前のバージョンの場合。 このハッシュ関数は高速でも良い品質でもありません。 理由はただそれだけに使用する場合もこのアルゴリズムは実用化が始まっており他のシステムとしての計算は、全く同じ働きをします。 + +**戻り値** + +A `Int32` データ型ハッシュ値。 + +タイプ: `hiveHash`. + +**例えば** + +クエリ: + +``` sql +SELECT hiveHash('Hello, world!'); +``` + +結果: + +``` text +┌─hiveHash('Hello, world!')─┐ +│ 267439093 │ +└───────────────────────────┘ +``` + +## metroHash64 {#metrohash64} + +64ビットを生成する [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/) ハッシュ値。 + +``` sql +metroHash64(par1, ...) +``` + +**パラメータ** + +この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql-reference/data-types/index.md). + +**戻り値** + +A [UInt64](../../sql-reference/data-types/int-uint.md) データ型ハッシュ値。 + +**例えば** + +``` sql +SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type +``` + +``` text +┌────────────MetroHash─┬─type───┐ +│ 14235658766382344533 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## jumpConsistentHash {#jumpconsistenthash} + +JumpConsistentHashフォームUInt64を計算します。 +UInt64型のキーとバケットの数です。 Int32を返します。 +詳細については、リンク: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) + +## murmurHash2\_32,murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} + +を生成する [MurmurHash2](https://github.com/aappleby/smhasher) ハッシュ値。 + +``` sql +murmurHash2_32(par1, ...) +murmurHash2_64(par1, ...) +``` + +**パラメータ** + +どちらの関数も、入力パラメータの可変数を取ります。 パラメー [対応データ型](../../sql-reference/data-types/index.md). + +**戻り値** + +- その `murmurHash2_32` 関数は、ハッシュ値を返します [UInt32](../../sql-reference/data-types/int-uint.md) データ型。 +- その `murmurHash2_64` 関数は、ハッシュ値を返します [UInt64](../../sql-reference/data-types/int-uint.md) データ型。 + +**例えば** + +``` sql +SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type +``` + +``` text +┌──────────MurmurHash2─┬─type───┐ +│ 11832096901709403633 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## murmurHash3\_32,murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} + +を生成する [MurmurHash3](https://github.com/aappleby/smhasher) ハッシュ値。 + +``` sql +murmurHash3_32(par1, ...) +murmurHash3_64(par1, ...) +``` + +**パラメータ** + +どちらの関数も、入力パラメータの可変数を取ります。 パラメー [対応データ型](../../sql-reference/data-types/index.md). + +**戻り値** + +- その `murmurHash3_32` 関数は、 [UInt32](../../sql-reference/data-types/int-uint.md) データ型ハッシュ値。 +- その `murmurHash3_64` 関数は、 [UInt64](../../sql-reference/data-types/int-uint.md) データ型ハッシュ値。 + +**例えば** + +``` sql +SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3─┬─type───┐ +│ 2152717 │ UInt32 │ +└─────────────┴────────┘ +``` + +## murmurHash3\_128 {#murmurhash3-128} + +128ビットを生成する [MurmurHash3](https://github.com/aappleby/smhasher) ハッシュ値。 + +``` sql +murmurHash3_128( expr ) +``` + +**パラメータ** + +- `expr` — [式](../syntax.md#syntax-expressions) を返す [文字列](../../sql-reference/data-types/string.md)-タイプ値。 + +**戻り値** + +A [FixedString(16)](../../sql-reference/data-types/fixedstring.md) データ型ハッシュ値。 + +**例えば** + +``` sql +SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3──────┬─type────────────┐ +│ 6�1�4"S5KT�~~q │ FixedString(16) │ +└──────────────────┴─────────────────┘ +``` + +## xxHash32,xxHash64 {#hash-functions-xxhash32} + +計算 `xxHash` 文字列から。 これは、二つの味、32および64ビットで提案されています。 + +``` sql +SELECT xxHash32(''); + +OR + +SELECT xxHash64(''); +``` + +**戻り値** + +A `Uint32` または `Uint64` データ型ハッシュ値。 + +タイプ: `xxHash`. + +**例えば** + +クエリ: + +``` sql +SELECT xxHash32('Hello, world!'); +``` + +結果: + +``` text +┌─xxHash32('Hello, world!')─┐ +│ 834093149 │ +└───────────────────────────┘ +``` + +**また見なさい** + +- [xxHash](http://cyan4973.github.io/xxHash/). + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/ja/sql-reference/functions/higher-order-functions.md b/docs/ja/sql-reference/functions/higher-order-functions.md new file mode 100644 index 00000000000..3376b3e20d4 --- /dev/null +++ b/docs/ja/sql-reference/functions/higher-order-functions.md @@ -0,0 +1,264 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 57 +toc_title: "\u3088\u308A\u9AD8\u3044\u6B21\u6570" +--- + +# 高階関数 {#higher-order-functions} + +## `->` 演算子、ラムダ(params,expr)関数 {#operator-lambdaparams-expr-function} + +Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. + +例: `x -> 2 * x, str -> str != Referer.` + +高階関数は、関数の引数としてラムダ関数のみを受け入れることができます。 + +複数の引数を受け入れるラムダ関数は、高階関数に渡すことができます。 この場合、高次関数は、これらの引数が対応する同一の長さのいくつかの配列を渡されます。 + +いくつかの機能については、 [arrayCount](#higher_order_functions-array-count) または [arraySum](#higher_order_functions-array-count)、最初の引数(ラムダ関数)を省略することができます。 この場合、同一のマッピングが想定されます。 + +以下の関数ではラムダ関数を省略することはできません: + +- [arrayMap](#higher_order_functions-array-map) +- [arrayFilter](#higher_order_functions-array-filter) +- [arrayfillanguage](#higher_order_functions-array-fill) +- [arrayReverseFill](#higher_order_functions-array-reverse-fill) +- [arraySplit](#higher_order_functions-array-split) +- [arrayReverseSplit](#higher_order_functions-array-reverse-split) +- [arrayFirst](#higher_order_functions-array-first) +- [arrayFirstIndex](#higher_order_functions-array-first-index) + +### arrayMap(func, arr1, …) {#higher_order_functions-array-map} + +の元のアプリケーションから取得した配列を返します。 `func` の各要素への機能 `arr` 配列だ + +例: + +``` sql +SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,4,5] │ +└─────────┘ +``` + +次の例は、異なる配列から要素のタプルを作成する方法を示しています: + +``` sql +SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res +``` + +``` text +┌─res─────────────────┐ +│ [(1,4),(2,5),(3,6)] │ +└─────────────────────┘ +``` + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayMap` 機能。 + +### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} + +要素のみを含む配列を返します `arr1` そのために `func` 0以外の値を返します。 + +例: + +``` sql +SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res +``` + +``` text +┌─res───────────┐ +│ ['abc World'] │ +└───────────────┘ +``` + +``` sql +SELECT + arrayFilter( + (i, x) -> x LIKE '%World%', + arrayEnumerate(arr), + ['Hello', 'abc World'] AS arr) + AS res +``` + +``` text +┌─res─┐ +│ [2] │ +└─────┘ +``` + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFilter` 機能。 + +### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} + +スキャンスルー `arr1` 最初の要素から最後の要素まで `arr1[i]` によって `arr1[i - 1]` もし `func` 0を返します。 の最初の要素 `arr1` 交換されません。 + +例: + +``` sql +SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res──────────────────────────────┐ +│ [1,1,3,11,12,12,12,5,6,14,14,14] │ +└──────────────────────────────────┘ +``` + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFill` 機能。 + +### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} + +スキャンスルー `arr1` 最後の要素から最初の要素へと置き換えます `arr1[i]` によって `arr1[i + 1]` もし `func` 0を返します。 の最後の要素 `arr1` 交換されません。 + +例: + +``` sql +SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res────────────────────────────────┐ +│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ +└────────────────────────────────────┘ +``` + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayReverseFill` 機能。 + +### arraySplit(func, arr1, …) {#higher_order_functions-array-split} + +分割 `arr1` 複数の配列に変換します とき `func` 0以外のものを返すと、配列は要素の左側で分割されます。 配列は最初の要素の前に分割されません。 + +例: + +``` sql +SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res─────────────┐ +│ [[1,2,3],[4,5]] │ +└─────────────────┘ +``` + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arraySplit` 機能。 + +### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} + +分割 `arr1` 複数の配列に変換します とき `func` 0以外のものを返すと、配列は要素の右側で分割されます。 配列は最後の要素の後に分割されません。 + +例: + +``` sql +SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res───────────────┐ +│ [[1],[2,3,4],[5]] │ +└───────────────────┘ +``` + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arraySplit` 機能。 + +### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} + +Funcが0以外を返すarr配列内の要素の数を返します。 もし ‘func’ 指定されていない場合は、配列内の非ゼロ要素の数を返します。 + +### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} + +少なくとも1つの要素がある場合は1を返します ‘arr’ そのために ‘func’ 0以外の値を返します。 それ以外の場合は、0を返します。 + +### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} + +場合は1を返します ‘func’ すべての要素に対して0以外のものを返します ‘arr’. それ以外の場合は、0を返します。 + +### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} + +の合計を返します ‘func’ 値。 関数が省略された場合、それだけで配列要素の合計を返します。 + +### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} + +の最初の要素を返します ‘arr1’ そのための配列 ‘func’ 0以外の値を返します。 + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFirst` 機能。 + +### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} + +最初の要素のインデックスを返します ‘arr1’ そのための配列 ‘func’ 0以外の値を返します。 + +最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFirstIndex` 機能。 + +### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} + +ソース配列内の要素の部分和の配列(実行中の合計)を返します。 この `func` 関数が指定されると、配列要素の値が合計される前にこの関数によって変換されます。 + +例えば: + +``` sql +SELECT arrayCumSum([1, 1, 1, 1]) AS res +``` + +``` text +┌─res──────────┐ +│ [1, 2, 3, 4] │ +└──────────────┘ +``` + +### ツ環板篠ョツ嘉ッツ偲青ツエツδツ-ツアツイツ-ツエツス) {#arraycumsumnonnegativearr} + +と同じ `arrayCumSum`,ソース配列の要素の部分和の配列を返します(実行中の合計). 異なる `arrayCumSum`、その後、戻り値がゼロ未満の値が含まれている場合、値がゼロで置き換えられ、その後の計算は、ゼロのパラメータで実行されます。 例えば: + +``` sql +SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,0,1] │ +└───────────┘ +``` + +### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} + +の要素をソートした結果として配列を返します `arr1` 昇順で。 この `func` 関数が指定され、ソート順序は関数の結果によって決定されます `func` 配列(配列)の要素に適用されます) + +その [シュワルツ語変換](https://en.wikipedia.org/wiki/Schwartzian_transform) 分類の効率を改善するのに使用されています。 + +例えば: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +の詳細については、 `arraySort` 方法は、を参照してください [配列を操作するための関数](array-functions.md#array_functions-sort) セクション。 + +### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} + +の要素をソートした結果として配列を返します `arr1` 降順で。 この `func` 関数が指定され、ソート順序は関数の結果によって決定されます `func` 配列(配列)の要素に適用されます。 + +例えば: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +の詳細については、 `arrayReverseSort` 方法は、を参照してください [配列を操作するための関数](array-functions.md#array_functions-reverse-sort) セクション。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/ja/sql_reference/functions/in_functions.md b/docs/ja/sql-reference/functions/in-functions.md similarity index 100% rename from docs/ja/sql_reference/functions/in_functions.md rename to docs/ja/sql-reference/functions/in-functions.md diff --git a/docs/ja/sql-reference/functions/index.md b/docs/ja/sql-reference/functions/index.md new file mode 100644 index 00000000000..b8a2c6500dc --- /dev/null +++ b/docs/ja/sql-reference/functions/index.md @@ -0,0 +1,74 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Functions +toc_priority: 32 +toc_title: "\u5C0E\u5165" +--- + +# 機能 {#functions} + +少なくとも\*つのタイプの関数があります-通常の関数(これらは単に呼び出されます “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn’t depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). + +このセクションでは、定期的な機能を説明します。 のための集計関数の項をご参照ください “Aggregate functions”. + +\*-その機能の第三のタイプがあります ‘arrayJoin’ テーブルの機能も別々に言及することができます。\* + +## 強力なタイピング {#strong-typing} + +標準sqlとは対照的に、clickhouseは強力な型付けをしています。 言い換えれば、型間の暗黙の変換は行われません。 各関数は、特定のタイプのセットに対して機能します。 これは、時には型変換関数を使用する必要があることを意味します。 + +## 共通部分式の削除 {#common-subexpression-elimination} + +同じast(構文解析の同じレコードまたは同じ結果)を持つクエリ内のすべての式は、同じ値を持つとみなされます。 このような式は連結され、一度実行されます。 この方法では、同一のサブクエリも削除されます。 + +## 結果のタイプ {#types-of-results} + +すべての関数は、結果として単一の戻り値を返します(複数の値ではなく、ゼロの値ではありません)。 結果の型は、通常、値ではなく引数の型によってのみ定義されます。 例外は、tupleelement関数(a.n演算子)とtofixedstring関数です。 + +## 定数 {#constants} + +簡単にするために、特定の関数はいくつかの引数の定数のみで動作します。 たとえば、like演算子のright引数は定数でなければなりません。 +ほとんどすべての関数は定数引数の定数を返します。 例外は、乱数を生成する関数です。 +その ‘now’ 関数は、異なる時間に実行されたクエリに対して異なる値を返しますが、定数は単一のクエリ内でのみ重要であるため、結果は定数と見なされます。 +定数式も定数と見なされます(たとえば、like演算子の右半分は複数の定数から構築できます)。 + +関数は、定数と非定数引数(異なるコードが実行される)のために異なる方法で実装することができます。 しかし、定数と同じ値のみを含む真の列の結果は、互いに一致する必要があります。 + +## ヌル処理 {#null-processing} + +関数の動作は次のとおりです: + +- 関数の引数のうち少なくとも一つが `NULL`、機能結果はまたあります `NULL`. +- 各機能の説明で個別に指定される特別な動作。 のclickhouseソースコードは、これらの機能の `UseDefaultImplementationForNulls=false`. + +## 不変性 {#constancy} + +Functions can’t change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. + +## エラー処理 {#error-handling} + +データが無効な場合、一部の関数は例外をスローする可能性があります。 この場合、クエリは取り消され、エラーテキストがクライアントに返されます。 分散処理の場合、いずれかのサーバーで例外が発生すると、他のサーバーもクエリを中止しようとします。 + +## 引数式の評価 {#evaluation-of-argument-expressions} + +ほぼすべてのプログラミング言語の一つの引数が評価される。 これは通常、演算子です `&&`, `||`、と `?:`. +しかし、clickhouseでは、関数(演算子)の引数は常に評価されます。 これは、各行を別々に計算するのではなく、列の全部分が一度に評価されるためです。 + +## 分散クエリ処理のための関数の実行 {#performing-functions-for-distributed-query-processing} + +分散クエリ処理では、できるだけ多くのクエリ処理がリモートサーバーで実行され、その他のステージ(中間結果とそれ以降のすべてのステージ)はリクエスター + +つまり、異なるサーバーで機能を実行できます。 +たとえば、クエリでは `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` + +- もし `distributed_table` は、少なくとも二つのシャード、機能 ‘g’ と ‘h’ リモートサーバー上で実行される。 ‘f’ 要求元サーバーで実行されます。 +- もし `distributed_table` 一つだけシャード、すべてを持っています ‘f’, ‘g’、と ‘h’ 機能は、このシャードのサーバー上で実行されます。 + +関数の結果は、通常、実行されるサーバーに依存しません。 しかし、時にはこれが重要です。 +たとえば、辞書を操作する関数は、実行しているサーバー上に存在する辞書を使用します。 +別の例は、 `hostName` この関数は、実行されているサーバーの名前を返します。 `GROUP BY` aのサーバーによって `SELECT` クエリ。 + +クエリ内の関数がリクエストサーバー上で実行されているが、リモートサーバー上で実行する必要がある場合は、次のようにラップします。 ‘any’ 関数を集めるか、それをキーに追加します `GROUP BY`. + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/ja/sql-reference/functions/introspection.md b/docs/ja/sql-reference/functions/introspection.md new file mode 100644 index 00000000000..af7bd1a5b7e --- /dev/null +++ b/docs/ja/sql-reference/functions/introspection.md @@ -0,0 +1,310 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 65 +toc_title: "\u30A4\u30F3\u30C8\u30ED\u30B9\u30DA\u30AF\u30B7\u30E7\u30F3" +--- + +# イントロスペクション関数 {#introspection-functions} + +利用できる表示可能なプラグインで説明してこの章にintrospect [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) と [DWARF](https://en.wikipedia.org/wiki/DWARF) のためのクエリープロファイリング. + +!!! warning "警告" + これらの機能は、が必要となる場合があり安全に配慮し + +イントロスペクション機能を適切に動作させるため: + +- インストール `clickhouse-common-static-dbg` パッケージ。 + +- セットを [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) 1に設定します。 + + For security reasons introspection functions are disabled by default. + +ClickHouseはプロファイラーレポートを保存します [trace\_log](../../operations/system-tables.md#system_tables-trace_log) システムテーブル。 のテーブルプロファイラで設定されます。 + +## アドレスストリンcolor {#addresstoline} + +ClickHouseサーバープロセス内の仮想メモリアドレスを、ClickHouseソースコード内のファイル名と行番号に変換します。 + +公式のclickhouseのパッケージを使用すれば、取付ける必要があります `clickhouse-common-static-dbg` パッケージ。 + +**構文** + +``` sql +addressToLine(address_of_binary_instruction) +``` + +**パラメータ** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**戻り値** + +- コロンで区切られたこのファイル内のソースコードのファイル名と行番号。 + + For example, `/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199`, where `199` is a line number. + +- 関数がデバッグ情報を見つけることができなかった場合、バイナリの名前。 + +- アドレスが有効でない場合は、空の文字列。 + +タイプ: [文字列](../../sql-reference/data-types/string.md). + +**例えば** + +イントロスペクション機能の有効化: + +``` sql +SET allow_introspection_functions=1 +``` + +から最初の文字列を選択する `trace_log` システム表: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-19 +event_time: 2019-11-19 18:57:23 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 421b6855-1858-45a5-8f37-f383409d6d72 +trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] +``` + +その `trace` 分野のスタックトレースを瞬時にサンプリングします。 + +単一のアドレスのソースコードファイル名と行番号を取得する: + +``` sql +SELECT addressToLine(94784076370703) \G +``` + +``` text +Row 1: +────── +addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 +``` + +スタックトレース全体に関数を適用する: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines +FROM system.trace_log +LIMIT 1 +\G +``` + +その [arrayMap](higher-order-functions.md#higher_order_functions-array-map) 機能はの各々の個々の要素を処理することを割り当てます `trace` による配列 `addressToLine` 機能。 この処理の結果は、次のように表示されます。 `trace_source_code_lines` 出力の列。 + +``` text +Row 1: +────── +trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so +/usr/lib/debug/usr/bin/clickhouse +/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 +/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.h:155 +/usr/include/c++/9/bits/atomic_base.h:551 +/usr/lib/debug/usr/bin/clickhouse +/lib/x86_64-linux-gnu/libpthread-2.27.so +/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 +``` + +## addressToSymbol {#addresstosymbol} + +に変換する仮想メモリアドレス内clickhouseサーバプロセスのシンボルからclickhouseオブジェクトファイルです。 + +**構文** + +``` sql +addressToSymbol(address_of_binary_instruction) +``` + +**パラメータ** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**戻り値** + +- ClickHouseオブジェクトファイルからの記号。 +- アドレスが有効でない場合は、空の文字列。 + +タイプ: [文字列](../../sql-reference/data-types/string.md). + +**例えば** + +イントロスペクション機能の有効化: + +``` sql +SET allow_introspection_functions=1 +``` + +から最初の文字列を選択する `trace_log` システム表: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +その `trace` 分野のスタックトレースを瞬時にサンプリングします。 + +単一のアドレスのシンボルを取得する: + +``` sql +SELECT addressToSymbol(94138803686098) \G +``` + +``` text +Row 1: +────── +addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +``` + +スタックトレース全体に関数を適用する: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols +FROM system.trace_log +LIMIT 1 +\G +``` + +その [arrayMap](higher-order-functions.md#higher_order_functions-array-map) 機能はの各々の個々の要素を処理することを割り当てます `trace` による配列 `addressToSymbols` 機能。 この処理の結果は、次のように表示されます。 `trace_symbols` 出力の列。 + +``` text +Row 1: +────── +trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE +_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb +_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb +_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE +_ZN2DB27AggregatingBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB28AsynchronousBlockInputStream9calculateEv +_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data +_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E +_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv +_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E +execute_native_thread_routine +start_thread +clone +``` + +## デマングル {#demangle} + +を使用して取得できるシンボルを変換します。 [addressToSymbol](#addresstosymbol) C++の関数名に関数。 + +**構文** + +``` sql +demangle(symbol) +``` + +**パラメータ** + +- `symbol` ([文字列](../../sql-reference/data-types/string.md)) — Symbol from an object file. + +**戻り値** + +- C++関数の名前。 +- シンボルが有効でない場合は、空の文字列。 + +タイプ: [文字列](../../sql-reference/data-types/string.md). + +**例えば** + +イントロスペクション機能の有効化: + +``` sql +SET allow_introspection_functions=1 +``` + +から最初の文字列を選択する `trace_log` システム表: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +その `trace` 分野のスタックトレースを瞬時にサンプリングします。 + +単一アドレスの関数名の取得: + +``` sql +SELECT demangle(addressToSymbol(94138803686098)) \G +``` + +``` text +Row 1: +────── +demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +``` + +スタックトレース全体に関数を適用する: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions +FROM system.trace_log +LIMIT 1 +\G +``` + +その [arrayMap](higher-order-functions.md#higher_order_functions-array-map) 機能はの各々の個々の要素を処理することを割り当てます `trace` による配列 `demangle` 機能。 この処理の結果は、次のように表示されます。 `trace_functions` 出力の列。 + +``` text +Row 1: +────── +trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const +DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) +DB::AggregatingBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::AsynchronousBlockInputStream::calculate() +std::_Function_handler::_M_invoke(std::_Any_data const&) +ThreadPoolImpl::worker(std::_List_iterator) +ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const +ThreadPoolImpl::worker(std::_List_iterator) +execute_native_thread_routine +start_thread +clone +``` diff --git a/docs/ja/sql-reference/functions/ip-address-functions.md b/docs/ja/sql-reference/functions/ip-address-functions.md new file mode 100644 index 00000000000..9eca8d8e709 --- /dev/null +++ b/docs/ja/sql-reference/functions/ip-address-functions.md @@ -0,0 +1,248 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 55 +toc_title: "IP\u30A2\u30C9\u30EC\u30B9\u306E\u64CD\u4F5C" +--- + +# IPアドレスを操作するための機能 {#functions-for-working-with-ip-addresses} + +## IPv4NumToString(num) {#ipv4numtostringnum} + +UInt32番号を受け取ります。 ビッグエンディアンのIPv4アドレスとして解釈します。 対応するIPv4アドレスをA.B.C.dという形式で含む文字列を返します。 + +## IPv4StringToNum(s) {#ipv4stringtonums} + +IPv4NumToStringの逆関数. IPv4アドレスの形式が無効な場合は、0を返します。 + +## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} + +IPv4NumToStringに似ていますが、最後のオクテットの代わりにxxxを使用します。 + +例えば: + +``` sql +SELECT + IPv4NumToStringClassC(ClientIP) AS k, + count() AS c +FROM test.hits +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─k──────────────┬─────c─┐ +│ 83.149.9.xxx │ 26238 │ +│ 217.118.81.xxx │ 26074 │ +│ 213.87.129.xxx │ 25481 │ +│ 83.149.8.xxx │ 24984 │ +│ 217.118.83.xxx │ 22797 │ +│ 78.25.120.xxx │ 22354 │ +│ 213.87.131.xxx │ 21285 │ +│ 78.25.121.xxx │ 20887 │ +│ 188.162.65.xxx │ 19694 │ +│ 83.149.48.xxx │ 17406 │ +└────────────────┴───────┘ +``` + +使用して以来 ‘xxx’ 非常に珍しいです、これは将来変更されるかもしれません。 このフラグメントの正確なフォーマットに依存しないことをお勧めします。 + +### IPv6NumToString(x) {#ipv6numtostringx} + +バイナリ形式のipv6アドレスを含むfixedstring(16)値を受け入れます。 このアドレスを含む文字列をテキスト形式で返します。 +IPv6にマップされたIPv4アドレスは、::ffff:111.222.33.44の形式で出力されます。 例: + +``` sql +SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr +``` + +``` text +┌─addr─────────┐ +│ 2a02:6b8::11 │ +└──────────────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ +│ 2a02:2168:aaa:bbbb::2 │ 24695 │ +│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ +│ 2a02:6b8:0:fff::ff │ 16389 │ +│ 2a01:4f8:111:6666::2 │ 16016 │ +│ 2a02:2168:888:222::1 │ 15896 │ +│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ +│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ +│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ +│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ +│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ +└─────────────────────────────────────────┴───────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)─┬──────c─┐ +│ ::ffff:94.26.111.111 │ 747440 │ +│ ::ffff:37.143.222.4 │ 529483 │ +│ ::ffff:5.166.111.99 │ 317707 │ +│ ::ffff:46.38.11.77 │ 263086 │ +│ ::ffff:79.105.111.111 │ 186611 │ +│ ::ffff:93.92.111.88 │ 176773 │ +│ ::ffff:84.53.111.33 │ 158709 │ +│ ::ffff:217.118.11.22 │ 154004 │ +│ ::ffff:217.118.11.33 │ 148449 │ +│ ::ffff:217.118.11.44 │ 148243 │ +└────────────────────────────┴────────┘ +``` + +## IPv6StringToNum(s) {#ipv6stringtonums} + +IPv6NumToStringの逆関数. IPv6アドレスの形式が無効な場合は、nullバイトの文字列を返します。 +HEXは大文字または小文字にできます。 + +## IPv4ToIPv6(x) {#ipv4toipv6x} + +を取る `UInt32` 番号 IPv4アドレスとして解釈します。 [ビッグエンディアン](https://en.wikipedia.org/wiki/Endianness). Aを返します `FixedString(16)` バイナリ形式のIPv6アドレスを含む値。 例: + +``` sql +SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr +``` + +``` text +┌─addr───────────────┐ +│ ::ffff:192.168.0.1 │ +└────────────────────┘ +``` + +## cutIPv6(x,bitsToCutForIPv6,bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} + +バイナリ形式のipv6アドレスを含むfixedstring(16)値を受け入れます。 テキスト形式で削除された指定されたビット数のアドレスを含む文字列を返します。 例えば: + +``` sql +WITH + IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, + IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 +SELECT + cutIPv6(ipv6, 2, 0), + cutIPv6(ipv4, 0, 2) +``` + +``` text +┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ +│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ +└─────────────────────────────────────┴─────────────────────┘ +``` + +## IPv4CIDRToRange(ipv4,cidr), {#ipv4cidrtorangeipv4-cidr} + +IPv4とUInt8の値を受け取ります。 [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). 下位のサブネットの範囲と上位の範囲を含むIPv4を持つタプルを返します。 + +``` sql +SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) +``` + +``` text +┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ +│ ('192.168.0.0','192.168.255.255') │ +└────────────────────────────────────────────┘ +``` + +## IPv6CIDRToRange(ipv6,cidr), {#ipv6cidrtorangeipv6-cidr} + +Cidrを含むIPv6およびUInt8値を受け入れます。 IPv6の下位範囲と上位のサブネットを含むタプルを返します。 + +``` sql +SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); +``` + +``` text +┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ +│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ +└────────────────────────────────────────────────────────────────────────┘ +``` + +## toIPv4(文字列) {#toipv4string} + +別名を指定する `IPv4StringToNum()` これはIPv4アドレスの文字列形式をとり、その値を返します。 [IPv4](../../sql-reference/data-types/domains/ipv4.md) 返される値に等しいバイナリです `IPv4StringToNum()`. + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + toTypeName(IPv4StringToNum(IPv4_string)), + toTypeName(toIPv4(IPv4_string)) +``` + +``` text +┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ +│ UInt32 │ IPv4 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + hex(IPv4StringToNum(IPv4_string)), + hex(toIPv4(IPv4_string)) +``` + +``` text +┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ +│ ABE1822D │ ABE1822D │ +└───────────────────────────────────┴──────────────────────────┘ +``` + +## toIPv6(文字列) {#toipv6string} + +別名を指定する `IPv6StringToNum()` これはIPv6アドレスの文字列形式を取り、値をの戻します [IPv6](../../sql-reference/data-types/domains/ipv6.md) 返される値に等しいバイナリです `IPv6StringToNum()`. + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + toTypeName(IPv6StringToNum(IPv6_string)), + toTypeName(toIPv6(IPv6_string)) +``` + +``` text +┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ +│ FixedString(16) │ IPv6 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + hex(IPv6StringToNum(IPv6_string)), + hex(toIPv6(IPv6_string)) +``` + +``` text +┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ +│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ +└───────────────────────────────────┴──────────────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/ja/sql-reference/functions/json-functions.md b/docs/ja/sql-reference/functions/json-functions.md new file mode 100644 index 00000000000..9988bfa6a1e --- /dev/null +++ b/docs/ja/sql-reference/functions/json-functions.md @@ -0,0 +1,231 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 56 +toc_title: "JSON\u3067\u306E\u4F5C\u696D." +--- + +# JSONを操作するための関数 {#functions-for-working-with-json} + +Yandexの中。Metrica、JSONで送信したユーザーとしてセッションパラメータ。 このJSONを操作するための特別な関数がいくつかあります。 (ほとんどの場合、JSONsはさらに前処理され、結果の値は処理された形式で別々の列に格納されます。)これらの関数はすべて、JSONができることについての強い前提に基づいていますが、仕事を終わらせるためにできるだけ少なくしようとします。 + +以下の仮定が行われます: + +1. フィールド名(関数の引数)は定数でなければなりません。 +2. フィールド名は何とかcanonicallyで符号化されたjson. 例えば: `visitParamHas('{"abc":"def"}', 'abc') = 1`、しかし `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` +3. フィールドは、任意の入れ子レベルで無差別に検索されます。 一致するフィールドが複数ある場合は、最初のオカレンスが使用されます。 +4. JSONには、文字列リテラルの外側にスペース文字はありません。 + +## visitParamHas(パラメータ,名前) {#visitparamhasparams-name} + +フィールドがあるかどうかをチェック ‘name’ 名前だ + +## visitParamExtractUInt(パラメータ,名前) {#visitparamextractuintparams-name} + +指定されたフィールドの値からuint64を解析します ‘name’. これが文字列フィールドの場合、文字列の先頭から数値を解析しようとします。 フィールドが存在しないか、存在するが数値が含まれていない場合は、0を返します。 + +## visitParamExtractInt(パラメータ,名前) {#visitparamextractintparams-name} + +Int64の場合と同じです。 + +## visitParamExtractFloat(パラメーター,名前) {#visitparamextractfloatparams-name} + +Float64の場合と同じです。 + +## visitParamExtractBool(パラメーター,名前) {#visitparamextractboolparams-name} + +True/false値を解析します。 結果はUInt8です。 + +## visitParamExtractRaw(パラメータ,名前) {#visitparamextractrawparams-name} + +セパレータを含むフィールドの値を返します。 + +例: + +``` sql +visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' +visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' +``` + +## visitParamExtractString(パラメーター,名前) {#visitparamextractstringparams-name} + +文字列を二重引用符で解析します。 値はエスケープされません。 エスケープ解除に失敗した場合は、空の文字列を返します。 + +例: + +``` sql +visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' +visitParamExtractString('{"abc":"hello}', 'abc') = '' +``` + +現在、この形式のコードポイントはサポートされていません `\uXXXX\uYYYY` これは、(彼らはCESU-8の代わりにUTF-8に変換されます)基本的な多言語面からではありません。 + +次の関数は、以下に基づいています [simdjson](https://github.com/lemire/simdjson) より複雑なJSON解析要件のために設計。 上記の前提2は依然として適用されます。 + +## isValidJSON(json) {#isvalidjsonjson} + +渡された文字列が有効なjsonであることを確認します。 + +例: + +``` sql +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} + +JSONドキュメントに値が存在する場合, `1` は返却されます。 + +値が存在しない場合, `0` は返却されます。 + +例: + +``` sql +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 +``` + +`indices_or_keys` それぞれの引数は、文字列または整数のいずれかになります。 + +- 文字列=アクセスオブジェクトにより、会員に対す。 +- 正の整数=最初からn番目のメンバー/キーにアクセスします。 +- 負の整数=最後からn番目のメンバー/キーにアクセスします。 + +要素の最小インデックスは1です。 したがって、要素0は存在しません。 + +整数を使用して、json配列とjsonオブジェクトの両方にアクセスできます。 + +例えば: + +``` sql +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' +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} + +JSON配列またはJSONオブジェクトの長さを返します。 + +値が存在しないか、間違った型を持っている場合, `0` は返却されます。 + +例: + +``` sql +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} + +JSON値の型を返します。 + +値が存在しない場合, `Null` は返却されます。 + +例: + +``` sql +SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' +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} + +## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} + +## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} + +## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} + +JSONを解析し、値を抽出します。 これらの機能と類似 `visitParam` 機能。 + +値が存在しないか、間違った型を持っている場合, `0` は返却されます。 + +例: + +``` sql +SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 +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} + +JSONを解析し、文字列を抽出します。 この関数は次のようになります `visitParamExtractString` 機能。 + +値が存在しないか、間違った型を持っている場合は、空の文字列が返されます。 + +値はエスケープされません。 エスケープ解除に失敗した場合は、空の文字列を返します。 + +例: + +``` sql +SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' +SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' +SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' +``` + +## JSONExtract(json\[, indices\_or\_keys…\], Return\_type) {#jsonextractjson-indices-or-keys-return-type} + +JSONを解析し、指定されたClickHouseデータ型の値を抽出します。 + +これは以前の一般化です `JSONExtract` 機能。 +これは +`JSONExtract(..., 'String')` とまったく同じを返します `JSONExtractString()`, +`JSONExtract(..., 'Float64')` とまったく同じを返します `JSONExtractFloat()`. + +例: + +``` sql +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL +SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 +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} + +値が指定されたclickhouseデータ型のjsonからキーと値のペアを解析します。 + +例えば: + +``` sql +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} + +JSONの一部を返します。 + +パートが存在しないか、間違った型を持っている場合は、空の文字列が返されます。 + +例えば: + +``` sql +SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' +``` + +## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} + +それぞれが未解析の文字列として表されるjson配列の要素を持つ配列を返します。 + +その部分が存在しない場合、または配列でない場合は、空の配列が返されます。 + +例えば: + +``` sql +SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/ja/sql_reference/functions/logical_functions.md b/docs/ja/sql-reference/functions/logical-functions.md similarity index 100% rename from docs/ja/sql_reference/functions/logical_functions.md rename to docs/ja/sql-reference/functions/logical-functions.md diff --git a/docs/ja/sql-reference/functions/machine-learning-functions.md b/docs/ja/sql-reference/functions/machine-learning-functions.md new file mode 100644 index 00000000000..6002df908bd --- /dev/null +++ b/docs/ja/sql-reference/functions/machine-learning-functions.md @@ -0,0 +1,20 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 64 +toc_title: "\u6A5F\u68B0\u5B66\u7FD2\u306E\u6A5F\u80FD" +--- + +# 機械学習の機能 {#machine-learning-functions} + +## evalMLMethod(予測) {#machine_learning_methods-evalmlmethod} + +適合回帰モデルを使用した予測 `evalMLMethod` 機能。 リンクを見る `linearRegression`. + +### 確率的線形回帰 {#stochastic-linear-regression} + +その [stochasticLinearRegression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlinearregression) 集合関数は,線形モデルとMSE損失関数を用いた確率的勾配降下法を実装する。 使用 `evalMLMethod` 新しいデータを予測する。 + +### 確率論的ロジスティック回帰 {#stochastic-logistic-regression} + +その [stochasticLogisticRegression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlogisticregression) 集合関数は,二値分類問題に対して確率的勾配降下法を実装する。 使用 `evalMLMethod` 新しいデータを予測する。 diff --git a/docs/ja/sql_reference/functions/math_functions.md b/docs/ja/sql-reference/functions/math-functions.md similarity index 100% rename from docs/ja/sql_reference/functions/math_functions.md rename to docs/ja/sql-reference/functions/math-functions.md diff --git a/docs/ja/sql-reference/functions/other-functions.md b/docs/ja/sql-reference/functions/other-functions.md new file mode 100644 index 00000000000..a1b886e7009 --- /dev/null +++ b/docs/ja/sql-reference/functions/other-functions.md @@ -0,0 +1,1079 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 66 +toc_title: "\u305D\u306E\u4ED6" +--- + +# その他の機能 {#other-functions} + +## ホスト名() {#hostname} + +この関数が実行されたホストの名前を持つ文字列を返します。 分散処理の場合、機能がリモートサーバー上で実行される場合、これはリモートサーバーホストの名前です。 + +## FQDN {#fqdn} + +完全修飾ドメイン名を返します。 + +**構文** + +``` sql +fqdn(); +``` + +この関数は、大文字と小文字を区別しません。 + +**戻り値** + +- 完全修飾ドメイン名の文字列。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT FQDN(); +``` + +結果: + +``` text +┌─FQDN()──────────────────────────┐ +│ clickhouse.ru-central1.internal │ +└─────────────────────────────────┘ +``` + +## ベース名 {#basename} + +最後のスラッシュまたはバックスラッシュの後の文字列の末尾の部分を抽出します。 この関数は、パスからファイル名を抽出するためによく使用されます。 + +``` sql +basename( expr ) +``` + +**パラメータ** + +- `expr` — Expression resulting in a [文字列](../../sql-reference/data-types/string.md) タイプ値。 すべての円記号は、結果の値でエスケープする必要があります。 + +**戻り値** + +以下を含む文字列: + +- 最後のスラッシュまたはバックスラッシュの後の文字列の末尾の部分。 + + If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. + +- スラッシュまたはバックスラッシュがない場合は、元の文字列。 + +**例えば** + +``` sql +SELECT 'some/long/path/to/file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some\\long\\path\\to\\file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some-file-name' AS a, basename(a) +``` + +``` text +┌─a──────────────┬─basename('some-file-name')─┐ +│ some-file-name │ some-file-name │ +└────────────────┴────────────────────────────┘ +``` + +## visibleWidth(x) {#visiblewidthx} + +テキスト形式(タブ区切り)でコンソールに値を出力するときのおおよその幅を計算します。 +この関数は、システムがpretty形式を実装するために使用します。 + +`NULL` に対応する文字列として表される。 `NULL` で `Pretty` フォーマット。 + +``` sql +SELECT visibleWidth(NULL) +``` + +``` text +┌─visibleWidth(NULL)─┐ +│ 4 │ +└────────────────────┘ +``` + +## toTypeName(x) {#totypenamex} + +渡された引数の型名を含む文字列を返します。 + +もし `NULL` 入力として関数に渡され、その後、それが返されます `Nullable(Nothing)` 内部に対応するタイプ `NULL` ClickHouseでの表現。 + +## ブロックサイズ() {#function-blocksize} + +ブロックのサイズを取得します。 +ClickHouseでは、クエリは常にブロック(列部分のセット)で実行されます。 この関数は、それを呼び出したブロックのサイズを取得することができます。 + +## マテリアライズ(x) {#materializex} + +一つの値だけを含む完全な列に定数を変換します。 +ClickHouseでは、完全な列と定数はメモリ内で異なる方法で表されます。 関数は定数引数と通常の引数(異なるコードが実行される)では異なる動作をしますが、結果はほとんど常に同じです。 この関数は、この動作のデバッグ用です。 + +## ignore(…) {#ignore} + +以下を含む任意の引数を受け取る `NULL`. 常に0を返します。 +ただし、引数はまだ評価されます。 これはベンチマークに使用できます。 + +## スリープ(秒) {#sleepseconds} + +眠る ‘seconds’ 各データブロックの秒。 整数または浮動小数点数を指定できます。 + +## sleepEachRow(秒) {#sleepeachrowseconds} + +眠る ‘seconds’ 各行の秒。 整数または浮動小数点数を指定できます。 + +## currentDatabase() {#currentdatabase} + +現在のデータベースの名前を返します。 +この関数は、データベースを指定する必要があるcreate tableクエリのテーブルエンジンパラメーターで使用できます。 + +## currentUser() {#other-function-currentuser} + +現在のユーザーのログインを返します。 ユーザのログインは、そのクエリを開始し、ケースdistibutedクエリで返されます。 + +``` sql +SELECT currentUser(); +``` + +エイリアス: `user()`, `USER()`. + +**戻り値** + +- 現在のユーザーのログイン。 +- クエリを開始したユーザーのログイン。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT currentUser(); +``` + +結果: + +``` text +┌─currentUser()─┐ +│ default │ +└───────────────┘ +``` + +## isFinite(x) {#isfinitex} + +引数が無限でなくnanでない場合はfloat32とfloat64を受け取り、uint8を1に返します(それ以外の場合は0)。 + +## イシンフィナイト(x) {#isinfinitex} + +引数が無限の場合はfloat32とfloat64を受け取り、uint8を1に戻し、それ以外の場合は0を返します。 nanの場合は0が返されることに注意してください。 + +## ifNotFinite {#ifnotfinite} + +浮動小数点値が有限かどうかをチェックします。 + +**構文** + + ifNotFinite(x,y) + +**パラメータ** + +- `x` — Value to be checked for infinity. Type: [フロート\*](../../sql-reference/data-types/float.md). +- `y` — Fallback value. Type: [フロート\*](../../sql-reference/data-types/float.md). + +**戻り値** + +- `x` もし `x` 有限です。 +- `y` もし `x` 有限ではない。 + +**例えば** + +クエリ: + + SELECT 1/0 as infimum, ifNotFinite(infimum,42) + +結果: + + ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ + │ inf │ 42 │ + └─────────┴───────────────────────────────┘ + +同様の結果を得るには、次のようにします [三項演算子](conditional-functions.md#ternary-operator): `isFinite(x) ? x : y`. + +## isNaN(x) {#isnanx} + +引数がnanの場合はfloat32とfloat64を受け取り、uint8を1に返します。 + +## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} + +データベース名、テーブル名、列名などの定数文字列を受け入れます。 列がある場合はuint8定数式を1に、それ以外の場合は0を返します。 hostnameパラメーターを設定すると、テストはリモートサーバーで実行されます。 +テーブルが存在しない場合、関数は例外をスローします。 +入れ子になったデータ構造内の要素の場合、この関数は列の存在をチェックします。 入れ子になったデータ構造自体の場合、関数は0を返します。 + +## バー {#function-bar} + +ユニコードアート図を作成できます。 + +`bar(x, min, max, width)` に比例する幅を持つバンドを描画します `(x - min)` とに等しい `width` 文字の場合 `x = max`. + +パラメータ: + +- `x` — Size to display. +- `min, max` — Integer constants. The value must fit in `Int64`. +- `width` — Constant, positive integer, can be fractional. + +バンドは、シンボルの第八に精度で描かれています。 + +例えば: + +``` sql +SELECT + toHour(EventTime) AS h, + count() AS c, + bar(c, 0, 600000, 20) AS bar +FROM test.hits +GROUP BY h +ORDER BY h ASC +``` + +``` text +┌──h─┬──────c─┬─bar────────────────┐ +│ 0 │ 292907 │ █████████▋ │ +│ 1 │ 180563 │ ██████ │ +│ 2 │ 114861 │ ███▋ │ +│ 3 │ 85069 │ ██▋ │ +│ 4 │ 68543 │ ██▎ │ +│ 5 │ 78116 │ ██▌ │ +│ 6 │ 113474 │ ███▋ │ +│ 7 │ 170678 │ █████▋ │ +│ 8 │ 278380 │ █████████▎ │ +│ 9 │ 391053 │ █████████████ │ +│ 10 │ 457681 │ ███████████████▎ │ +│ 11 │ 493667 │ ████████████████▍ │ +│ 12 │ 509641 │ ████████████████▊ │ +│ 13 │ 522947 │ █████████████████▍ │ +│ 14 │ 539954 │ █████████████████▊ │ +│ 15 │ 528460 │ █████████████████▌ │ +│ 16 │ 539201 │ █████████████████▊ │ +│ 17 │ 523539 │ █████████████████▍ │ +│ 18 │ 506467 │ ████████████████▊ │ +│ 19 │ 520915 │ █████████████████▎ │ +│ 20 │ 521665 │ █████████████████▍ │ +│ 21 │ 542078 │ ██████████████████ │ +│ 22 │ 493642 │ ████████████████▍ │ +│ 23 │ 400397 │ █████████████▎ │ +└────┴────────┴────────────────────┘ +``` + +## 変換 {#transform} + +いくつかの要素の明示的に定義されたマッピングに従って値を他の要素に変換します。 +この関数には二つの違いがあります: + +### transform(x,array\_from,array\_to,デフォルト) {#transformx-array-from-array-to-default} + +`x` – What to transform. + +`array_from` – Constant array of values for converting. + +`array_to` – Constant array of values to convert the values in ‘from’ に。 + +`default` – Which value to use if ‘x’ 値のいずれにも等しくありません。 ‘from’. + +`array_from` と `array_to` – Arrays of the same size. + +タイプ: + +`transform(T, Array(T), Array(U), U) -> U` + +`T` と `U` 数値、文字列、または日付または日時の型を指定できます。 +同じ文字(tまたはu)が示されている場合、数値型の場合、これらは一致する型ではなく、共通の型を持つ型である可能性があります。 +たとえば、最初の引数はint64型を持つことができ、二番目の引数はarray(uint16)型を持つことができます。 + +この ‘x’ 値は、次のいずれかの要素に等しくなります。 ‘array\_from’ 配列の場合は、既存の要素(同じ番号が付けられています)を返します。 ‘array\_to’ 配列だ それ以外の場合は、 ‘default’. 一致する要素が複数ある場合 ‘array\_from’、それはマッチのいずれかを返します。 + +例えば: + +``` sql +SELECT + transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, + count() AS c +FROM test.hits +WHERE SearchEngineID != 0 +GROUP BY title +ORDER BY c DESC +``` + +``` text +┌─title─────┬──────c─┐ +│ Yandex │ 498635 │ +│ Google │ 229872 │ +│ Other │ 104472 │ +└───────────┴────────┘ +``` + +### トランスフォーム(x,array\_from,array\_to) {#transformx-array-from-array-to} + +最初のバリエーションとは異なります ‘default’ 引数は省略する。 +この ‘x’ 値は、次のいずれかの要素に等しくなります。 ‘array\_from’ 配列の場合は、マッチする要素(同じ番号を付けられた要素)を返します。 ‘array\_to’ 配列だ それ以外の場合は、 ‘x’. + +タイプ: + +`transform(T, Array(T), Array(T)) -> T` + +例えば: + +``` sql +SELECT + transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, + count() AS c +FROM test.hits +GROUP BY domain(Referer) +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +┌─s──────────────┬───────c─┐ +│ │ 2906259 │ +│ www.yandex │ 867767 │ +│ ███████.ru │ 313599 │ +│ mail.yandex.ru │ 107147 │ +│ ██████.ru │ 100355 │ +│ █████████.ru │ 65040 │ +│ news.yandex.ru │ 64515 │ +│ ██████.net │ 59141 │ +│ example.com │ 57316 │ +└────────────────┴─────────┘ +``` + +## formatReadableSize(x) {#formatreadablesizex} + +サイズ(バイト数)を受け入れます。 サフィックス(kib、mibなど)を含む丸められたサイズを返します。)文字列として。 + +例えば: + +``` sql +SELECT + arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, + formatReadableSize(filesize_bytes) AS filesize +``` + +``` text +┌─filesize_bytes─┬─filesize───┐ +│ 1 │ 1.00 B │ +│ 1024 │ 1.00 KiB │ +│ 1048576 │ 1.00 MiB │ +│ 192851925 │ 183.92 MiB │ +└────────────────┴────────────┘ +``` + +## 少なくとも(a,b) {#leasta-b} + +Aとbの最小値を返します。 + +## 最大(a,b) {#greatesta-b} + +Aとbの最大値を返します。 + +## アップタイム() {#uptime} + +サーバーの稼働時間を秒単位で返します。 + +## バージョン() {#version} + +サーバーのバージョンを文字列として返します。 + +## タイムゾーン() {#timezone} + +サーバーのタイムゾーンを返します。 + +## bloknumber {#blocknumber} + +行があるデータブロックのシーケンス番号を返します。 + +## rowNumberInBlock {#function-rownumberinblock} + +データブロック内の行の序数を返します。 異なるデータブロックは常に再計算されます。 + +## rowNumberInAllBlocks() {#rownumberinallblocks} + +データブロック内の行の序数を返します。 この機能のみを考慮した影響のデータブロックとなります。 + +## 隣人 {#neighbor} + +指定された列の現在の行の前または後に来る指定されたオフセットで行へのアクセスを提供するウィンドウ関数。 + +**構文** + +``` sql +neighbor(column, offset[, default_value]) +``` + +関数の結果は、影響を受けるデータブロックと、ブロック内のデータの順序によって異なります。 +ORDER BYを使用してサブクエリを作成し、サブクエリの外部から関数を呼び出すと、期待される結果を得ることができます。 + +**パラメータ** + +- `column` — A column name or scalar expression. +- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql-reference/data-types/int-uint.md). +- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. + +**戻り値** + +- の値 `column` で `offset` 現在の行からの距離 `offset` 値はブロック境界の外側ではありません。 +- のデフォルト値 `column` もし `offset` 値はブロック境界の外側です。 もし `default_value` 与えられ、それが使用されます。 + +型:影響を受けるデータブロックの種類または既定値の種類。 + +**例えば** + +クエリ: + +``` sql +SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; +``` + +結果: + +``` text +┌─number─┬─neighbor(number, 2)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 0 │ +│ 9 │ 0 │ +└────────┴─────────────────────┘ +``` + +クエリ: + +``` sql +SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; +``` + +結果: + +``` text +┌─number─┬─neighbor(number, 2, 999)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 999 │ +│ 9 │ 999 │ +└────────┴──────────────────────────┘ +``` + +この関数は、年間指標の値を計算するために使用できます: + +クエリ: + +``` sql +WITH toDate('2018-01-01') AS start_date +SELECT + toStartOfMonth(start_date + (number * 32)) AS month, + toInt32(month) % 100 AS money, + neighbor(money, -12) AS prev_year, + round(prev_year / money, 2) AS year_over_year +FROM numbers(16) +``` + +結果: + +``` text +┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ +│ 2018-01-01 │ 32 │ 0 │ 0 │ +│ 2018-02-01 │ 63 │ 0 │ 0 │ +│ 2018-03-01 │ 91 │ 0 │ 0 │ +│ 2018-04-01 │ 22 │ 0 │ 0 │ +│ 2018-05-01 │ 52 │ 0 │ 0 │ +│ 2018-06-01 │ 83 │ 0 │ 0 │ +│ 2018-07-01 │ 13 │ 0 │ 0 │ +│ 2018-08-01 │ 44 │ 0 │ 0 │ +│ 2018-09-01 │ 75 │ 0 │ 0 │ +│ 2018-10-01 │ 5 │ 0 │ 0 │ +│ 2018-11-01 │ 36 │ 0 │ 0 │ +│ 2018-12-01 │ 66 │ 0 │ 0 │ +│ 2019-01-01 │ 97 │ 32 │ 0.33 │ +│ 2019-02-01 │ 28 │ 63 │ 2.25 │ +│ 2019-03-01 │ 56 │ 91 │ 1.62 │ +│ 2019-04-01 │ 87 │ 22 │ 0.25 │ +└────────────┴───────┴───────────┴────────────────┘ +``` + +## ランニングダイファレンス(x) {#other_functions-runningdifference} + +Calculates the difference between successive row values ​​in the data block. +最初の行に対して0を返し、後続の各行に対して前の行との差を返します。 + +関数の結果は、影響を受けるデータブロックと、ブロック内のデータの順序によって異なります。 +ORDER BYを使用してサブクエリを作成し、サブクエリの外部から関数を呼び出すと、期待される結果を得ることができます。 + +例えば: + +``` sql +SELECT + EventID, + EventTime, + runningDifference(EventTime) AS delta +FROM +( + SELECT + EventID, + EventTime + FROM events + WHERE EventDate = '2016-11-24' + ORDER BY EventTime ASC + LIMIT 5 +) +``` + +``` text +┌─EventID─┬───────────EventTime─┬─delta─┐ +│ 1106 │ 2016-11-24 00:00:04 │ 0 │ +│ 1107 │ 2016-11-24 00:00:05 │ 1 │ +│ 1108 │ 2016-11-24 00:00:05 │ 0 │ +│ 1109 │ 2016-11-24 00:00:09 │ 4 │ +│ 1110 │ 2016-11-24 00:00:10 │ 1 │ +└─────────┴─────────────────────┴───────┘ +``` + +ご注意-ブロックサイズは結果に影響します。 それぞれの新しいブロックでは、 `runningDifference` 状態がリセットされます。 + +``` sql +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +┌─number─┬─diff─┐ +│ 65536 │ 0 │ +└────────┴──────┘ +``` + +``` sql +set max_block_size=100000 -- default value is 65536! + +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +``` + +## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} + +と同じ [runningDifference](./other-functions.md#other_functions-runningdifference)、差は、最初の行の値であり、最初の行の値を返し、後続の各行は、前の行からの差を返します。 + +## マクナムトストリング(num) {#macnumtostringnum} + +UInt64番号を受け取ります。 ビッグエンディアンのMACアドレスとして解釈します。 対応するMACアドレスをAA:BB:CC:DD:EE:FF形式で含む文字列を返します。 + +## MACStringToNum(s) {#macstringtonums} + +MACNumToStringの逆関数。 MACアドレスに無効な形式がある場合は、0を返します。 + +## MACStringToOUI(s) {#macstringtoouis} + +AA:BB:CC:DD:EE:FF形式のMACアドレスを受け付けます。 最初の三つのオクテットをUInt64の数値として返します。 MACアドレスに無効な形式がある場合は、0を返します。 + +## getSizeOfEnumType {#getsizeofenumtype} + +フィールドの数を返します [列挙型](../../sql-reference/data-types/enum.md). + +``` sql +getSizeOfEnumType(value) +``` + +**パラメータ:** + +- `value` — Value of type `Enum`. + +**戻り値** + +- を持つフィールドの数 `Enum` 入力値。 +- 型が型でない場合は、例外がスローされます `Enum`. + +**例えば** + +``` sql +SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## blockSerializedSize {#blockserializedsize} + +(圧縮を考慮せずに)ディスク上のサイズを返します。 + +``` sql +blockSerializedSize(value[, value[, ...]]) +``` + +**パラメータ:** + +- `value` — Any value. + +**戻り値** + +- 値のブロックのためにディスクに書き込まれるバイト数(圧縮なし)。 + +**例えば** + +``` sql +SELECT blockSerializedSize(maxState(1)) as x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## toColumnTypeName {#tocolumntypename} + +RAM内の列のデータ型を表すクラスの名前を返します。 + +``` sql +toColumnTypeName(value) +``` + +**パラメータ:** + +- `value` — Any type of value. + +**戻り値** + +- を表すために使用されるクラスの名前を持つ文字列 `value` RAMのデータ型。 + +**違いの例`toTypeName ' and ' toColumnTypeName`** + +``` sql +SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime │ +└─────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ Const(UInt32) │ +└───────────────────────────────────────────────────────────┘ +``` + +この例では、 `DateTime` データタイプはメモリに記憶として `Const(UInt32)`. + +## dumpColumnStructure {#dumpcolumnstructure} + +RAM内のデータ構造の詳細な説明を出力します + +``` sql +dumpColumnStructure(value) +``` + +**パラメータ:** + +- `value` — Any type of value. + +**戻り値** + +- を表すために使用される構造体を記述する文字列。 `value` RAMのデータ型。 + +**例えば** + +``` sql +SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) +``` + +``` text +┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime, Const(size = 1, UInt32(size = 1)) │ +└──────────────────────────────────────────────────────────────┘ +``` + +## defaultValueOfArgumentType {#defaultvalueofargumenttype} + +データ型の既定値を出力します。 + +ユーザーが設定したカスタム列の既定値は含まれません。 + +``` sql +defaultValueOfArgumentType(expression) +``` + +**パラメータ:** + +- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. + +**戻り値** + +- `0` 数字のために. +- 文字列の空の文字列。 +- `ᴺᵁᴸᴸ` のために [Nullable](../../sql-reference/data-types/nullable.md). + +**例えば** + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ +│ 0 │ +└─────────────────────────────────────────────┘ +``` + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ +│ ᴺᵁᴸᴸ │ +└───────────────────────────────────────────────────────┘ +``` + +## 複製 {#other-functions-replicate} + +単一の値を持つ配列を作成します。 + +内部実装のために使用される [arrayJoin](array-join.md#functions_arrayjoin). + +``` sql +SELECT replicate(x, arr); +``` + +**パラメータ:** + +- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. +- `x` — The value that the resulting array will be filled with. + +**戻り値** + +値で満たされた配列 `x`. + +タイプ: `Array`. + +**例えば** + +クエリ: + +``` sql +SELECT replicate(1, ['a', 'b', 'c']) +``` + +結果: + +``` text +┌─replicate(1, ['a', 'b', 'c'])─┐ +│ [1,1,1] │ +└───────────────────────────────┘ +``` + +## filesystemAvailable {#filesystemavailable} + +返金額の残存スペースのファイルシステムのファイルのデータベースはあります。 それは常に合計空き領域よりも小さいです ([filesystemFree](#filesystemfree) でもスペースはOS. + +**構文** + +``` sql +filesystemAvailable() +``` + +**戻り値** + +- バイト単位で使用可能な残りのスペースの量。 + +タイプ: [UInt64](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; +``` + +結果: + +``` text +┌─Available space─┬─Type───┐ +│ 30.75 GiB │ UInt64 │ +└─────────────────┴────────┘ +``` + +## filesystemFree {#filesystemfree} + +データベースのファイルがあるファイルシステム上の空き領域の合計を返します。 また見なさい `filesystemAvailable` + +**構文** + +``` sql +filesystemFree() +``` + +**戻り値** + +- バイト単位の空き領域の量。 + +タイプ: [UInt64](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; +``` + +結果: + +``` text +┌─Free space─┬─Type───┐ +│ 32.39 GiB │ UInt64 │ +└────────────┴────────┘ +``` + +## filesystemCapacity {#filesystemcapacity} + +ファイルシステムの容量をバイト単位で返します。 評価のために、 [パス](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) データディレク + +**構文** + +``` sql +filesystemCapacity() +``` + +**戻り値** + +- ファイルシステムの容量情報(バイト単位)。 + +タイプ: [UInt64](../../sql-reference/data-types/int-uint.md). + +**例えば** + +クエリ: + +``` sql +SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" +``` + +結果: + +``` text +┌─Capacity──┬─Type───┐ +│ 39.32 GiB │ UInt64 │ +└───────────┴────────┘ +``` + +## finalizeAggregation {#function-finalizeaggregation} + +集約関数の状態を取ります。 集計結果を返します(ファイナライズされた状態)。 + +## runningAccumulate {#function-runningaccumulate} + +集約関数の状態を取り、値を持つ列を返します,ブロックラインのセットのためにこれらの状態の蓄積の結果であります,最初から現在の行へ.これ +たとえば、集計関数の状態(例:runningaccumulate(uniqstate(userid)))を取り、ブロックの各行について、前のすべての行と現在の行の状態をマージしたときの集計関数の結果を返しま +したがって、関数の結果は、ブロックへのデータの分割とブロック内のデータの順序に依存します。 + +## joinGet {#joinget} + +この関数を使用すると、テーブルからのデータと同じ方法でデータを抽出できます [辞書](../../sql-reference/dictionaries/index.md). + +データの取得 [参加](../../engines/table-engines/special/join.md#creating-a-table) 指定された結合キーを使用するテーブル。 + +サポートされているのは、 `ENGINE = Join(ANY, LEFT, )` 声明。 + +**構文** + +``` sql +joinGet(join_storage_table_name, `value_column`, join_keys) +``` + +**パラメータ** + +- `join_storage_table_name` — an [識別子](../syntax.md#syntax-identifiers) 検索が実行される場所を示します。 識別子は既定のデータベースで検索されます(パラメータを参照 `default_database` の設定ファイル)。 デフォル `USE db_name` またはを指定しデータベースのテーブルのセパレータ `db_name.db_table`、例を参照してください。 +- `value_column` — name of the column of the table that contains required data. +- `join_keys` — list of keys. + +**戻り値** + +キーのリストに対応する値のリストを返します。 + +ソーステーブルに特定のものが存在しない場合 `0` または `null` に基づいて返されます [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) 設定。 + +詳細について `join_use_nulls` で [結合操作](../../engines/table-engines/special/join.md). + +**例えば** + +入力テーブル: + +``` sql +CREATE DATABASE db_test +CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 +INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) +``` + +``` text +┌─id─┬─val─┐ +│ 4 │ 13 │ +│ 2 │ 12 │ +│ 1 │ 11 │ +└────┴─────┘ +``` + +クエリ: + +``` sql +SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 +``` + +結果: + +``` text +┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ +│ 0 │ +│ 11 │ +│ 12 │ +│ 0 │ +└──────────────────────────────────────────────────┘ +``` + +## modelEvaluate(model\_name, …) {#function-modelevaluate} + +外部モデルを評価します。 +モデル名とモデル引数を受け取ります。 float64を返します。 + +## throwIf(x\[,custom\_message\]) {#throwifx-custom-message} + +引数がゼロ以外の場合は例外をスローします。 +custom\_message-オプションのパラメータです。 + +``` sql +SELECT throwIf(number = 3, 'Too many') FROM numbers(10); +``` + +``` text +↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): +Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. +``` + +## id {#identity} + +引数として使用されたのと同じ値を返します。 デバッグに使用され、試験が可能でャックのクエリーの性能を満たします。 がクエリーの分析のために利用できる可能性指標分析装置が外部サンプリング方式な見てみよう `identity` 機能。 + +**構文** + +``` sql +identity(x) +``` + +**例えば** + +クエリ: + +``` sql +SELECT identity(42) +``` + +結果: + +``` text +┌─identity(42)─┐ +│ 42 │ +└──────────────┘ +``` + +## randomprintableasii {#randomascii} + +のランダムなセットを持つ文字列を生成します [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) 印刷可能な文字。 + +**構文** + +``` sql +randomPrintableASCII(length) +``` + +**パラメータ** + +- `length` — Resulting string length. Positive integer. + + If you pass `length < 0`, behavior of the function is undefined. + +**戻り値** + +- のランダムなセットを持つ文字列 [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) 印刷可能な文字。 + +タイプ: [文字列](../../sql-reference/data-types/string.md) + +**例えば** + +``` sql +SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 +``` + +``` text +┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ +│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ +│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ +│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ +└────────┴────────────────────────────────┴──────────────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/ja/sql_reference/functions/random_functions.md b/docs/ja/sql-reference/functions/random-functions.md similarity index 100% rename from docs/ja/sql_reference/functions/random_functions.md rename to docs/ja/sql-reference/functions/random-functions.md diff --git a/docs/ja/sql-reference/functions/rounding-functions.md b/docs/ja/sql-reference/functions/rounding-functions.md new file mode 100644 index 00000000000..d899fe1df20 --- /dev/null +++ b/docs/ja/sql-reference/functions/rounding-functions.md @@ -0,0 +1,190 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: "\u4E38\u3081" +--- + +# 丸め関数 {#rounding-functions} + +## 床(x\[,N\]) {#floorx-n} + +次の値以下の最大ラウンド数を返します `x`. ラウンド数は1/10Nの倍数、または1/10Nが正確でない場合は適切なデータ型の最も近い数です。 +‘N’ 整数定数、オプションのパラメータです。 デフォルトではゼロで、整数に丸めることを意味します。 +‘N’ 負の可能性があります。 + +例: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` + +`x` 任意の数値型です。 結果は同じタイプの数です。 +整数引数の場合、負の値で丸めるのが理にかなっています `N` 値(非負の場合 `N`、関数は何もしません)。 +丸めによってオーバーフロー(たとえば、floor(-128,-1))が発生した場合は、実装固有の結果が返されます。 + +## ceil(x\[,N\]),ceiling(x\[,N\]) {#ceilx-n-ceilingx-n} + +次の値以上の最小の丸め数を返します `x`. 他のすべての方法では、それはと同じです `floor` 関数(上記参照)。 + +## trunc(x\[,N\]),truncate(x\[,N\]) {#truncx-n-truncatex-n} + +絶対値が以下の最大絶対値を持つラウンド数を返します `x`‘s. In every other way, it is the same as the ’floor’ 関数(上記参照)。 + +## ラウンド(x\[,N\]) {#rounding_functions-round} + +指定した小数点以下の桁数に値を丸めます。 + +この関数は、指定された順序の最も近い番号を返します。 与えられた数が周囲の数と等しい距離を持つ場合、関数は浮動小数点数型に対してバンカーの丸めを使用し、他の数値型に対してゼロから丸めます。 + +``` sql +round(expression [, decimal_places]) +``` + +**パラメータ:** + +- `expression` — A number to be rounded. Can be any [式](../syntax.md#syntax-expressions) 数値を返す [データ型](../../sql-reference/data-types/index.md#data_types). +- `decimal-places` — An integer value. + - もし `decimal-places > 0` 次に、この関数は値を小数点の右側に丸めます。 + - もし `decimal-places < 0` 次に、この関数は値を小数点の左側に丸めます。 + - もし `decimal-places = 0` 次に、この関数は値を整数に丸めます。 この場合、引数は省略できます。 + +**戻り値:** + +入力番号と同じタイプの丸められた数。 + +### 例 {#examples} + +**使用例** + +``` sql +SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 +``` + +``` text +┌───x─┬─round(divide(number, 2))─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +└─────┴──────────────────────────┘ +``` + +**丸めの例** + +最も近い数値に丸めます。 + +``` text +round(3.2, 0) = 3 +round(4.1267, 2) = 4.13 +round(22,-1) = 20 +round(467,-2) = 500 +round(-467,-2) = -500 +``` + +銀行の丸め。 + +``` text +round(3.5) = 4 +round(4.5) = 4 +round(3.55, 1) = 3.6 +round(3.65, 1) = 3.6 +``` + +**また見なさい** + +- [ラウンドバンカー](#roundbankers) + +## ラウンドバンカー {#roundbankers} + +数値を指定した小数点以下の桁数に丸めます。 + +- 丸め番号が二つの数字の中間にある場合、関数はバンカーの丸めを使用します。 + + Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. + + It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. + +- それ以外の場合、関数は数値を最も近い整数に丸めます。 + +バンカーの丸めを使用すると、丸め数値がこれらの数値の加算または減算の結果に与える影響を減らすことができます。 + +たとえば、異なる丸めの合計1.5、2.5、3.5、4.5: + +- 丸めなし: 1.5 + 2.5 + 3.5 + 4.5 = 12. +- 銀行の丸め: 2 + 2 + 4 + 4 = 12. +- 最も近い整数への丸め: 2 + 3 + 4 + 5 = 14. + +**構文** + +``` sql +roundBankers(expression [, decimal_places]) +``` + +**パラメータ** + +- `expression` — A number to be rounded. Can be any [式](../syntax.md#syntax-expressions) 数値を返す [データ型](../../sql-reference/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`. + - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. + +**戻り値** + +バンカーの丸めメソッドによって丸められた値。 + +### 例 {#examples-1} + +**使用例** + +クエリ: + +``` sql + SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 +``` + +結果: + +``` text +┌───x─┬─b─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +│ 1.5 │ 2 │ +│ 2 │ 2 │ +│ 2.5 │ 2 │ +│ 3 │ 3 │ +│ 3.5 │ 4 │ +│ 4 │ 4 │ +│ 4.5 │ 4 │ +└─────┴───┘ +``` + +**銀行の丸めの例** + +``` text +roundBankers(0.4) = 0 +roundBankers(-3.5) = -4 +roundBankers(4.5) = 4 +roundBankers(3.55, 1) = 3.6 +roundBankers(3.65, 1) = 3.6 +roundBankers(10.35, 1) = 10.4 +roundBankers(10.755, 2) = 11,76 +``` + +**また見なさい** + +- [ラウンド](#rounding_functions-round) + +## roundToExp2(num) {#roundtoexp2num} + +数値を受け取ります。 数値が小さい場合は0を返します。 それ以外の場合は、数値を最も近い(非負の全体)程度に丸めます。 + +## ラウンドデュレーション(num) {#rounddurationnum} + +数値を受け取ります。 数値が小さい場合は0を返します。 それ以外の場合は、数値をセットから数値に切り下げます: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. この機能はyandexに固有です。metricaとセッションの長さに関するレポートを実装するために使用。 + +## roundAge(num) {#roundagenum} + +数値を受け取ります。 数値が18未満の場合、0を返します。 それ以外の場合は、数値をセットから数値に切り下げます: 18, 25, 35, 45, 55. この機能はyandexに固有です。metricaとユーザーの年齢に関するレポートを実装するために使用。 + +## ラウンドダウン(num,arr) {#rounddownnum-arr} + +数値を受け取り、指定した配列内の要素に切り捨てます。 値が下限より小さい場合は、下限が返されます。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/ja/sql-reference/functions/splitting-merging-functions.md b/docs/ja/sql-reference/functions/splitting-merging-functions.md new file mode 100644 index 00000000000..75633433822 --- /dev/null +++ b/docs/ja/sql-reference/functions/splitting-merging-functions.md @@ -0,0 +1,117 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 47 +toc_title: "\u6587\u5B57\u5217\u3068\u914D\u5217\u306E\u5206\u5272\u3068\u30DE\u30FC\ + \u30B8" +--- + +# 文字列と配列の分割とマージのための関数 {#functions-for-splitting-and-merging-strings-and-arrays} + +## splitByChar(セパレータ,s) {#splitbycharseparator-s} + +文字列を、指定した文字で区切った部分文字列に分割します。 定数文字列を使用します `separator` その正確に一つの文字からなる。 +選択した部分文字列の配列を返します。 空の部分文字列は、文字列の先頭または末尾にセパレータがある場合、または複数の連続するセパレータがある場合に選択できます。 + +**構文** + +``` sql +splitByChar(, ) +``` + +**パラメータ** + +- `separator` — The separator which should contain exactly one character. [文字列](../../sql-reference/data-types/string.md). +- `s` — The string to split. [文字列](../../sql-reference/data-types/string.md). + +**戻り値(s)** + +選択した部分文字列の配列を返します。 空の部分文字列は、次の場合に選択できます: + +- 区切り記号は、文字列の先頭または末尾に表示されます; +- 複数の連続した区切り文字があります; +- 元の文字列 `s` 空です。 + +タイプ: [配列](../../sql-reference/data-types/array.md) の [文字列](../../sql-reference/data-types/string.md). + +**例えば** + +``` sql +SELECT splitByChar(',', '1,2,3,abcde') +``` + +``` text +┌─splitByChar(',', '1,2,3,abcde')─┐ +│ ['1','2','3','abcde'] │ +└─────────────────────────────────┘ +``` + +## splitByString(separator,s) {#splitbystringseparator-s} + +文字列を文字列で区切られた部分文字列に分割します。 定数文字列を使用します `separator` 区切り文字として複数の文字が使用されます。 文字列の場合 `separator` 空である場合は、文字列を分割します `s` 単一の文字の配列に変換します。 + +**構文** + +``` sql +splitByString(, ) +``` + +**パラメータ** + +- `separator` — The separator. [文字列](../../sql-reference/data-types/string.md). +- `s` — The string to split. [文字列](../../sql-reference/data-types/string.md). + +**戻り値(s)** + +選択した部分文字列の配列を返します。 空の部分文字列は、次の場合に選択できます: + +タイプ: [配列](../../sql-reference/data-types/array.md) の [文字列](../../sql-reference/data-types/string.md). + +- 空でない区切り文字は、文字列の先頭または末尾に作成されます; +- 複数の連続する空でない区切り記号があります; +- 元の文字列 `s` 区切り記号が空でない間は空です。 + +**例えば** + +``` sql +SELECT splitByString(', ', '1, 2 3, 4,5, abcde') +``` + +``` text +┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ +│ ['1','2 3','4,5','abcde'] │ +└───────────────────────────────────────────┘ +``` + +``` sql +SELECT splitByString('', 'abcde') +``` + +``` text +┌─splitByString('', 'abcde')─┐ +│ ['a','b','c','d','e'] │ +└────────────────────────────┘ +``` + +## arrayStringConcat(arr\[,separator\]) {#arraystringconcatarr-separator} + +配列にリストされている文字列を区切り文字と連結します。デフォルトでは空の文字列に設定されています。 +文字列を返します。 + +## alphaTokens(s) {#alphatokenss} + +範囲a-zおよびa-zから連続するバイトの部分文字列を選択します。 + +**例えば** + +``` sql +SELECT alphaTokens('abca1abc') +``` + +``` text +┌─alphaTokens('abca1abc')─┐ +│ ['abca','abc'] │ +└─────────────────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/ja/sql-reference/functions/string-functions.md b/docs/ja/sql-reference/functions/string-functions.md new file mode 100644 index 00000000000..d61b6dbde80 --- /dev/null +++ b/docs/ja/sql-reference/functions/string-functions.md @@ -0,0 +1,489 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u6587\u5B57\u5217\u306E\u64CD\u4F5C" +--- + +# 文字列を扱うための関数 {#functions-for-working-with-strings} + +## 空 {#empty} + +空の文字列の場合は1、空でない文字列の場合は0を返します。 +結果の型はuint8です。 +文字列が空白またはnullバイトであっても、少なくとも一つのバイトが含まれている場合、文字列は空ではないと見なされます。 +この関数は配列に対しても機能します。 + +## notEmpty {#notempty} + +空の文字列の場合は0、空でない文字列の場合は1を返します。 +結果の型はuint8です。 +この関数は配列に対しても機能します。 + +## 長さ {#length} + +文字列の長さをバイトで返します(コード-ポイントではなく、文字ではありません)。 +結果の型はuint64です。 +この関数は配列に対しても機能します。 + +## lengthUTF8 {#lengthutf8} + +文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、unicodeコードポイント(文字ではない)の文字列の長さを この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 +結果の型はuint64です。 + +## char\_length,CHAR\_LENGTH {#char-length} + +文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、unicodeコードポイント(文字ではない)の文字列の長さを この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 +結果の型はuint64です。 + +## character\_length,CHARACTER\_LENGTH {#character-length} + +文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、unicodeコードポイント(文字ではない)の文字列の長さを この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 +結果の型はuint64です。 + +## lower,lcase {#lower} + +文字列内のasciiラテン文字記号を小文字に変換します。 + +## アッパー,ucase {#upper} + +文字列内のasciiラテン文字記号を大文字に変換します。 + +## lowerUTF8 {#lowerutf8} + +文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、文字列を小文字に変換します。 +それは言語を検出しません。 そのためにトルコに結果が正確に正しい。 +コード-ポイントの大文字と小文字でutf-8バイト-シーケンスの長さが異なる場合、このコード-ポイントでは結果が正しくない可能性があります。 +文字列にutf-8でないバイトのセットが含まれている場合、その動作は未定義です。 + +## upperUTF8 {#upperutf8} + +文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれている場合、文字列を大文字に変換します。 +それは言語を検出しません。 そのためにトルコに結果が正確に正しい。 +コード-ポイントの大文字と小文字でutf-8バイト-シーケンスの長さが異なる場合、このコード-ポイントでは結果が正しくない可能性があります。 +文字列にutf-8でないバイトのセットが含まれている場合、その動作は未定義です。 + +## isValidUTF8 {#isvalidutf8} + +バイトのセットが有効なutf-8エンコードの場合は1を返し、それ以外の場合は0を返します。 + +## toValidUTF8 {#tovalidutf8} + +無効なutf-8文字を `�` (U+FFFD)文字。 すべての行で実行されている無効な文字は、置換文字に折りたたまれています。 + +``` sql +toValidUTF8( input_string ) +``` + +パラメータ: + +- input\_string — Any set of bytes represented as the [文字列](../../sql-reference/data-types/string.md) データ型オブジェクト。 + +戻り値:有効なutf-8文字列。 + +**例えば** + +``` sql +SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') +``` + +``` text +┌─toValidUTF8('a����b')─┐ +│ a�b │ +└───────────────────────┘ +``` + +## 繰り返す {#repeat} + +指定した回数だけ文字列を繰り返し、レプリケートされた値を単一の文字列として連結します。 + +**構文** + +``` sql +repeat(s, n) +``` + +**パラメータ** + +- `s` — The string to repeat. [文字列](../../sql-reference/data-types/string.md). +- `n` — The number of times to repeat the string. [UInt](../../sql-reference/data-types/int-uint.md). + +**戻り値** + +文字列を含む単一の文字列 `s` 繰り返す `n` 回。 もし `n` \<1、関数は、空の文字列を返します。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT repeat('abc', 10) +``` + +結果: + +``` text +┌─repeat('abc', 10)──────────────┐ +│ abcabcabcabcabcabcabcabcabcabc │ +└────────────────────────────────┘ +``` + +## 反転 {#reverse} + +文字列を逆にします(バイトのシーケンスとして)。 + +## reverseUTF8 {#reverseutf8} + +文字列にutf-8テキストを表すバイトのセットが含まれていると仮定して、unicodeコードポイントのシーケンスを逆にします。 それ以外の場合は、何か他のことをします(例外はスローされません)。 + +## format(pattern, s0, s1, …) {#format} + +引数にリストされている文字列で定数パターンを書式設定する。 `pattern` 単純なPython形式のパターンです。 書式文字列に含まれる “replacement fields” 中括弧で囲まれています `{}`. 中括弧に含まれていないものは、リテラルテキストと見なされ、出力には変更されません。 リテラルテキストに中かっこ文字を含める必要がある場合は、倍にすることでエスケープできます: `{{ '{{' }}` と `{{ '}}' }}`. フィールド名は数字(ゼロから始まる)または空(それらは結果番号として扱われます)。 + +``` sql +SELECT format('{1} {0} {1}', 'World', 'Hello') +``` + +``` text +┌─format('{1} {0} {1}', 'World', 'Hello')─┐ +│ Hello World Hello │ +└─────────────────────────────────────────┘ +``` + +``` sql +SELECT format('{} {}', 'Hello', 'World') +``` + +``` text +┌─format('{} {}', 'Hello', 'World')─┐ +│ Hello World │ +└───────────────────────────────────┘ +``` + +## concat {#concat} + +引数にリストされている文字列を区切り文字なしで連結します。 + +**構文** + +``` sql +concat(s1, s2, ...) +``` + +**パラメータ** + +String型またはFixedString型の値。 + +**戻り値** + +引数を連結した結果の文字列を返します。 + +引数の値のいずれかがある場合 `NULL`, `concat` を返します `NULL`. + +**例えば** + +クエリ: + +``` sql +SELECT concat('Hello, ', 'World!') +``` + +結果: + +``` text +┌─concat('Hello, ', 'World!')─┐ +│ Hello, World! │ +└─────────────────────────────┘ +``` + +## ツづツつソツづォツづアツ、ツ債。 {#concatassumeinjective} + +と同じ [concat](#concat) の差であることを確認する必要があり `concat(s1, s2, ...) → sn` injectiveは、GROUP BYの最適化に使用されます。 + +関数の名前は次のとおりです “injective” 引数の異なる値に対して常に異なる結果を返す場合。 言い換えれば異なる引数のない利回り同一の結果です。 + +**構文** + +``` sql +concatAssumeInjective(s1, s2, ...) +``` + +**パラメータ** + +String型またはFixedString型の値。 + +**戻り値** + +引数を連結した結果の文字列を返します。 + +引数の値のいずれかがある場合 `NULL`, `concatAssumeInjective` を返します `NULL`. + +**例えば** + +入力テーブル: + +``` sql +CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; +INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); +SELECT * from key_val; +``` + +``` text +┌─key1────┬─key2─────┬─value─┐ +│ Hello, │ World │ 1 │ +│ Hello, │ World │ 2 │ +│ Hello, │ World! │ 3 │ +│ Hello │ , World! │ 2 │ +└─────────┴──────────┴───────┘ +``` + +クエリ: + +``` sql +SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) +``` + +結果: + +``` text +┌─concat(key1, key2)─┬─sum(value)─┐ +│ Hello, World! │ 3 │ +│ Hello, World! │ 2 │ +│ Hello, World │ 3 │ +└────────────────────┴────────────┘ +``` + +## サブストリング(s,オフセット,長さ)、中(s,オフセット,長さ)、サブストリング(s,オフセット,長さ) {#substring} + +からのバイトで始まる部分文字列を返します。 ‘offset’ あるインデックス ‘length’ バイト長。 文字の索引付けは、(標準SQLのように)文字から始まります。 その ‘offset’ と ‘length’ 引数は定数である必要があります。 + +## substringUTF8(s,オフセット,長さ) {#substringutf8} + +同じように ‘substring’ しかし、Unicodeコードポイントの場合。 作品は、この文字列が含まれるセットを表すバイトのUTF-8で符号化されます。 この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 + +## appendTrailingCharIfAbsent(s,c) {#appendtrailingcharifabsent} + +この ‘s’ 文字列は空ではなく、空の文字列を含みません。 ‘c’ 最後の文字は、 ‘c’ 最後に文字。 + +## convertCharset(s,from,to) {#convertcharset} + +文字列を返します ‘s’ それはエンコーディングから変換された ‘from’ でのエンコーディングに ‘to’. + +## base64Encode(s) {#base64encode} + +エンコード ‘s’ base64への文字列 + +## base64Decode(s) {#base64decode} + +Base64エンコードされた文字列のデコード ‘s’ 元の文字列に。 失敗した場合には例外を発生させます。 + +## tryBase64Decode(s) {#trybase64decode} + +Base64Decodeに似ていますが、エラーの場合は空の文字列が返されます。 + +## endsWith(s,suffix) {#endswith} + +指定された接尾辞で終了するかどうかを返します。 文字列が指定された接尾辞で終わる場合は1を返し、それ以外の場合は0を返します。 + +## startsWith(str,プレフィックス) {#startswith} + +1を返しますか否かの文字列の開始を、指定された接頭辞、そうでない場合は0を返します。 + +``` sql +SELECT startsWith('Spider-Man', 'Spi'); +``` + +**戻り値** + +- 1、文字列が指定された接頭辞で始まる場合。 +- 文字列が指定された接頭辞で始まらない場合は0。 + +**例えば** + +クエリ: + +``` sql +SELECT startsWith('Hello, world!', 'He'); +``` + +結果: + +``` text +┌─startsWith('Hello, world!', 'He')─┐ +│ 1 │ +└───────────────────────────────────┘ +``` + +## トリム {#trim} + +文字列の先頭または末尾から指定されたすべての文字を削除します。 +デフォルトでは、文字列の両端から共通の空白(ascii文字32)が連続して出現するすべてを削除します。 + +**構文** + +``` sql +trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) +``` + +**パラメータ** + +- `trim_character` — specified characters for trim. [文字列](../../sql-reference/data-types/string.md). +- `input_string` — string for trim. [文字列](../../sql-reference/data-types/string.md). + +**戻り値** + +先頭および(または)末尾に指定された文字を含まない文字列。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT trim(BOTH ' ()' FROM '( Hello, world! )') +``` + +結果: + +``` text +┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ +│ Hello, world! │ +└───────────────────────────────────────────────┘ +``` + +## trimLeft {#trimleft} + +文字列の先頭から、共通の空白文字(ascii文字32)のすべての連続した出現を削除します。 他の種類の空白文字(タブ、改行なしなど)は削除されません。). + +**構文** + +``` sql +trimLeft(input_string) +``` + +エイリアス: `ltrim(input_string)`. + +**パラメータ** + +- `input_string` — string to trim. [文字列](../../sql-reference/data-types/string.md). + +**戻り値** + +共通の空白をリードしない文字列。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT trimLeft(' Hello, world! ') +``` + +結果: + +``` text +┌─trimLeft(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## trimRight {#trimright} + +文字列の末尾から共通の空白文字(ascii文字32)のすべての連続した出現を削除します。 他の種類の空白文字(タブ、改行なしなど)は削除されません。). + +**構文** + +``` sql +trimRight(input_string) +``` + +エイリアス: `rtrim(input_string)`. + +**パラメータ** + +- `input_string` — string to trim. [文字列](../../sql-reference/data-types/string.md). + +**戻り値** + +共通の空白を末尾に付けない文字列。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT trimRight(' Hello, world! ') +``` + +結果: + +``` text +┌─trimRight(' Hello, world! ')─┐ +│ Hello, world! │ +└──────────────────────────────────────┘ +``` + +## トリンボスcity in california usa {#trimboth} + +文字列の両端から共通の空白文字(ascii文字32)が連続して出現するすべてを削除します。 他の種類の空白文字(タブ、改行なしなど)は削除されません。). + +**構文** + +``` sql +trimBoth(input_string) +``` + +エイリアス: `trim(input_string)`. + +**パラメータ** + +- `input_string` — string to trim. [文字列](../../sql-reference/data-types/string.md). + +**戻り値** + +先頭と末尾の共通の空白を含まない文字列。 + +タイプ: `String`. + +**例えば** + +クエリ: + +``` sql +SELECT trimBoth(' Hello, world! ') +``` + +結果: + +``` text +┌─trimBoth(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## CRC32(s) {#crc32} + +CRC-32-IEEE802.3多項式と初期値を使用して、文字列のCRC32チェックサムを返します `0xffffffff` (zlibの実装)。 + +結果の型はuint32です。 + +## CRC32IEEE(s) {#crc32ieee} + +CRC-32-IEEE802.3多項式を使用して、文字列のCRC32チェックサムを返します。 + +結果の型はuint32です。 + +## CRC64(s) {#crc64} + +CRC-64-ECMA多項式を使用して、文字列のCRC64チェックサムを返します。 + +結果の型はuint64です。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/ja/sql-reference/functions/string-replace-functions.md b/docs/ja/sql-reference/functions/string-replace-functions.md new file mode 100644 index 00000000000..f89d15d6ad6 --- /dev/null +++ b/docs/ja/sql-reference/functions/string-replace-functions.md @@ -0,0 +1,94 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 42 +toc_title: "\u6587\u5B57\u5217\u3067\u7F6E\u63DB\u3059\u308B\u5834\u5408" +--- + +# 文字列の検索と置換のための関数 {#functions-for-searching-and-replacing-in-strings} + +## replaceOne(干し草の山,パターン,交換) {#replaceonehaystack-pattern-replacement} + +が存在する場合は、その最初のオカレンスを置き換えます。 ‘pattern’ の部分文字列 ‘haystack’ と ‘replacement’ サブストリング。 +以後, ‘pattern’ と ‘replacement’ 定数である必要があります。 + +## replaceAll(干し草の山、パターン、交換)、交換(干し草の山、パターン、交換) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} + +すべての出現を置き換えます。 ‘pattern’ の部分文字列 ‘haystack’ と ‘replacement’ サブストリング。 + +## replaceRegexpOne(haystack,pattern,replacement) {#replaceregexponehaystack-pattern-replacement} + +を使用して交換 ‘pattern’ 正規表現。 Re2正規表現。 +最初のオカレンスのみを置き換えます(存在する場合)。 +パターンは次のように指定できます ‘replacement’. このパタ `\0-\9`. +置換 `\0` 正規表現全体を含みます。 置換 `\1-\9` サブパターンに対応しますnumbers.To を使用 `\` テンプレート内の文字をエスケープします `\`. +また、文字列リテラルには余分なエスケープが必要です。 + +例1. 日付をアメリカ形式に変換する: + +``` sql +SELECT DISTINCT + EventDate, + replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res +FROM test.hits +LIMIT 7 +FORMAT TabSeparated +``` + +``` text +2014-03-17 03/17/2014 +2014-03-18 03/18/2014 +2014-03-19 03/19/2014 +2014-03-20 03/20/2014 +2014-03-21 03/21/2014 +2014-03-22 03/22/2014 +2014-03-23 03/23/2014 +``` + +例2. 文字列を十回コピーする: + +``` sql +SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res +``` + +``` text +┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## replaceRegexpAll(干し草の山,パターン,置換) {#replaceregexpallhaystack-pattern-replacement} + +これは同じことをしますが、すべての出現を置き換えます。 例えば: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res +``` + +``` text +┌─res────────────────────────┐ +│ HHeelllloo,, WWoorrlldd!! │ +└────────────────────────────┘ +``` + +例外として、正規表現が空の部分文字列で処理された場合、置換は複数回行われません。 +例えば: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res +``` + +``` text +┌─res─────────────────┐ +│ here: Hello, World! │ +└─────────────────────┘ +``` + +## regexpQuoteMeta(s) {#regexpquotemetas} + +この関数は、文字列内のいくつかの定義済み文字の前に円記号を追加します。 +定義済み文字: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, ‘\]’, ‘?’, ‘\*‘,’+‘,’{‘,’:‘,’-’. +この実装はre2::re2::quotemetaとは若干異なります。 ゼロバイトを\\0の代わりに\\00としてエスケープし、必要な文字だけをエスケープします。 +詳細については、リンク: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/ja/sql-reference/functions/string-search-functions.md b/docs/ja/sql-reference/functions/string-search-functions.md new file mode 100644 index 00000000000..37e69edb6ff --- /dev/null +++ b/docs/ja/sql-reference/functions/string-search-functions.md @@ -0,0 +1,379 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 41 +toc_title: "\u6587\u5B57\u5217\u3092\u691C\u7D22\u3059\u308B\u5834\u5408" +--- + +# 文字列を検索するための関数 {#functions-for-searching-strings} + +これらのすべての機能では、既定で検索では大文字と小文字が区別されます。 あるvariantのための大文字と小文字を区別しません。 + +## 位置(干し草の山、針)、位置(干し草の山、針) {#position} + +1から始まる、文字列内の見つかった部分文字列の位置(バイト)を返します。 + +作品は、この文字列が含まれるセットを表すバイトの単一のバイトの符号化されます。 この仮定が満たされておらず、単一のバイトを使用して文字を表現できない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのバイトを使用して表現できる場合は、二つのバイトなどを使用します。 + +大文字と小文字を区別しない検索では、次の関数を使用します [positionCaseInsensitive](#positioncaseinsensitive). + +**構文** + +``` sql +position(haystack, needle) +``` + +エイリアス: `locate(haystack, needle)`. + +**パラメータ** + +- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). + +**戻り値** + +- 部分文字列が見つかった場合、バイト単位で開始位置(1から数えます)。 +- 0、部分文字列が見つからなかった場合。 + +タイプ: `Integer`. + +**例** + +フレーズ “Hello, world!” を含むの設定を表すバイトの単一のバイトの符号化されます。 この関数は、期待される結果を返します: + +クエリ: + +``` sql +SELECT position('Hello, world!', '!') +``` + +結果: + +``` text +┌─position('Hello, world!', '!')─┐ +│ 13 │ +└────────────────────────────────┘ +``` + +ロシア語の同じ句には、単一のバイトを使用して表現できない文字が含まれています。 この関数は、予期しない結果を返します [positionUTF8](#positionutf8) マルチバイトエンコードテキストの機能): + +クエリ: + +``` sql +SELECT position('Привет, мир!', '!') +``` + +結果: + +``` text +┌─position('Привет, мир!', '!')─┐ +│ 21 │ +└───────────────────────────────┘ +``` + +## positionCaseInsensitive {#positioncaseinsensitive} + +同じように [位置](#position) 1から始まる、文字列内の見つかった部分文字列の位置(バイト)を返します。 大文字小文字を区別しない検索には、この関数を使用します。 + +作品は、この文字列が含まれるセットを表すバイトの単一のバイトの符号化されます。 この仮定が満たされておらず、単一のバイトを使用して文字を表現できない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのバイトを使用して表現できる場合は、二つのバイトなどを使用します。 + +**構文** + +``` sql +positionCaseInsensitive(haystack, needle) +``` + +**パラメータ** + +- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). + +**戻り値** + +- 部分文字列が見つかった場合、バイト単位で開始位置(1から数えます)。 +- 0、部分文字列が見つからなかった場合。 + +タイプ: `Integer`. + +**例えば** + +クエリ: + +``` sql +SELECT positionCaseInsensitive('Hello, world!', 'hello') +``` + +結果: + +``` text +┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ +│ 1 │ +└───────────────────────────────────────────────────┘ +``` + +## positionUTF8 {#positionutf8} + +文字列内の見つかった部分文字列の位置(unicodeポイント単位)を、1から開始して返します。 + +作品は、この文字列が含まれるセットを表すバイトのutf-8で符号化されます。 この仮定が満たされない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのunicodeポイントを使って表現できる場合は、二つのポイントを使います。 + +大文字と小文字を区別しない検索では、次の関数を使用します [位置caseinsensitiveutf8](#positioncaseinsensitiveutf8). + +**構文** + +``` sql +positionUTF8(haystack, needle) +``` + +**パラメータ** + +- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). + +**戻り値** + +- 部分文字列が見つかった場合、unicodeポイントの開始位置(1から数えます)。 +- 0、部分文字列が見つからなかった場合。 + +タイプ: `Integer`. + +**例** + +フレーズ “Hello, world!” ロシア語のUnicodeのポイントを表すシングルポイントで符号化されます。 この関数は、期待される結果を返します: + +クエリ: + +``` sql +SELECT positionUTF8('Привет, мир!', '!') +``` + +結果: + +``` text +┌─positionUTF8('Привет, мир!', '!')─┐ +│ 12 │ +└───────────────────────────────────┘ +``` + +フレーズ “Salut, étudiante!”、どこの文字 `é` 一つの点を使用して表すことができます (`U+00E9`)または二つのポイント (`U+0065U+0301` 関数は、いくつかの予想外の結果を返すことができます: + +手紙のためのクエリ `é`、一つのUnicodeポイントを表している `U+00E9`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +結果: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 17 │ +└────────────────────────────────────────┘ +``` + +手紙のためのクエリ `é` これは二つのユニコード点を表します `U+0065U+0301`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +結果: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 18 │ +└────────────────────────────────────────┘ +``` + +## 位置caseinsensitiveutf8 {#positioncaseinsensitiveutf8} + +同じように [positionUTF8](#positionutf8) ただし、大文字と小文字は区別されません。 文字列内の見つかった部分文字列の位置(Unicodeポイント単位)を、1から開始して返します。 + +作品は、この文字列が含まれるセットを表すバイトのutf-8で符号化されます。 この仮定が満たされない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのunicodeポイントを使って表現できる場合は、二つのポイントを使います。 + +**構文** + +``` sql +positionCaseInsensitiveUTF8(haystack, needle) +``` + +**パラメータ** + +- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). + +**戻り値** + +- 部分文字列が見つかった場合、unicodeポイントの開始位置(1から数えます)。 +- 0、部分文字列が見つからなかった場合。 + +タイプ: `Integer`. + +**例えば** + +クエリ: + +``` sql +SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') +``` + +結果: + +``` text +┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ +│ 9 │ +└────────────────────────────────────────────────────┘ +``` + +## マルチアーチャルポジション {#multisearchallpositions} + +同じように [位置](string-search-functions.md#position) しかし、返す `Array` 文字列内で見つかった対応する部分文字列の位置(バイト単位)。 位置は1から始まる索引付けされます。 + +検索は、文字列のエンコードおよび照合順序に関係なく、バイトのシーケンスで実行されます。 + +- 大文字と小文字を区別しないascii検索では、次の関数を使用します `multiSearchAllPositionsCaseInsensitive`. +- UTF-8で検索する場合は、次の関数を使用します [multiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). +- 大文字と小文字を区別しないutf-8検索の場合は、関数multitsearchallpositionscaseinsensitiveutf8を使用します。 + +**構文** + +``` sql +multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) +``` + +**パラメータ** + +- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). + +**戻り値** + +- 対応する部分文字列が見つかった場合は1から数え、見つからなかった場合は0のバイト単位の開始位置の配列。 + +**例えば** + +クエリ: + +``` sql +SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) +``` + +結果: + +``` text +┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ +│ [0,13,0] │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## multiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} + +見る `multiSearchAllPositions`. + +## マルチアーチファーストポジション(干し草の山,\[ニードル1、針2, …, needlen\]) {#multisearchfirstposition} + +同じように `position` しかし、文字列の左端のオフセットを返します `haystack` それは針のいくつかに一致します。 + +大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. + +## マルチアーチファーストインデックス(haystack,\[needle1、針2, …, needlen\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} + +インデックスを返す `i` (1から始まる)見つかった最も左の針の私は 文字列の中で `haystack` それ以外の場合は0。 + +大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. + +## ツつィツ姪“ツつ”ツ債ツづュツつケツ-faq1、針2, …, needlen\]) {#function-multisearchany} + +少なくとも一つの文字列の針場合、1を返します私は 文字列に一致します `haystack` それ以外の場合は0。 + +大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. + +!!! note "メモ" + すべて `multiSearch*` 機能は針の数2よりより少しべきです8 実装仕様のため。 + +## マッチ(干し草の山、パターン) {#matchhaystack-pattern} + +その文字列が `pattern` 正規表現。 A `re2` 正規表現。 その [構文](https://github.com/google/re2/wiki/Syntax) の `re2` 正規表現は、Perl正規表現の構文よりも制限されています。 + +一致しない場合は0、一致する場合は1を返します。 + +バックスラッシュ記号に注意してください (`\`)は、正規表現でエスケープするために使用されます。 同じ記号が文字列リテラルでエスケープするために使用されます。 したがって、正規表現でシンボルをエスケープするには、文字列リテラルに二つの円記号(\\)を記述する必要があります。 + +正規表現は、文字列がバイトのセットであるかのように動作します。 正規表現にnullバイトを含めることはできません。 +パターンが文字列内の部分文字列を検索するには、likeまたは ‘position’、彼らははるかに高速に動作するので。 + +## マルチャチャー(干し草の山、\[パターン1、パターン2, …, patternn\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} + +同じように `match` ただし、正規表現のどれも一致しない場合は0を返し、パターンのいずれかが一致する場合は1を返します。 それは使用します [hyperscan](https://github.com/intel/hyperscan) ライブラリ。 文字列の部分文字列を検索するパターンの場合は、次のように使用する方がよいでしょう `multiSearchAny` それははるかに速く動作するので。 + +!!! note "メモ" + の長さ `haystack` 文字列は2未満でなければなりません32 それ以外の場合は、例外がスローされます。 この制限は、hyperscan APIのために行われます。 + +## インデックスを作成します。1、パターン2, …, patternn\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} + +同じように `multiMatchAny`、しかし、haystackに一致する任意のインデックスを返します。 + +## ツつィツ姪“ツつ”ツ債ツづュツつケツ-ツ篠堕猟ソツ青ソツ仰1、パターン2, …, patternn\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} + +同じように `multiMatchAny` しかし、haystackに一致するすべての指標の配列を任意の順序で返します。 + +## マルチフザイマチャニ(干し草の山、距離、\[パターン1、パターン2, …, patternn\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} + +同じように `multiMatchAny` ただし、定数内のhaystackに一致するパターンがある場合は1を返します [距離を編集](https://en.wikipedia.org/wiki/Edit_distance). この機能は実験モードでもあり、非常に遅くなる可能性があります。 詳細については、 [hyperscanマニュアル](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). + +## インデックスを作成します。1、パターン2, …, patternn\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} + +同じように `multiFuzzyMatchAny` しかし、一定の編集距離内のhaystackに一致する任意のインデックスを返します。 + +## multiFuzzyMatchAllIndices(haystack、距離、\[パターン1、パターン2, …, patternn\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} + +同じように `multiFuzzyMatchAny` しかし、一定の編集距離内のhaystackに一致する任意の順序ですべてのインデックスの配列を返します。 + +!!! note "メモ" + `multiFuzzyMatch*` 関数はUTF-8の正規表現をサポートしておらず、hyperscanの制限により、このような式はバイトとして扱われます。 + +!!! note "メモ" + Hyperscanを使用するすべての機能をオフにするには、設定を使用します `SET allow_hyperscan = 0;`. + +## エキス(干し草の山、パターン) {#extracthaystack-pattern} + +正規表現を使用して文字列の断片を抽出します。 もし ‘haystack’ この ‘pattern’ 正規表現では、空の文字列が返されます。 正規表現にサブパターンが含まれていない場合は、正規表現全体に一致するフラグメントを取ります。 それ以外の場合は、最初のサブパターンに一致するフラグメントを取得します。 + +## extractAll(干し草の山,パターン) {#extractallhaystack-pattern} + +正規表現を使用して、文字列のすべてのフラグメントを抽出します。 もし ‘haystack’ この ‘pattern’ 正規表現では、空の文字列が返されます。 正規表現に対するすべての一致で構成される文字列の配列を返します。 一般に、この動作は、 ‘extract’ 関数(最初のサブパターン、またはサブパターンがない場合は式全体を取ります)。 + +## like(haystack,pattern),haystack LIKEパターン演算子 {#function-like} + +文字列が単純な正規表現に一致するかどうかを調べます。 +正規表現には、メタシンボルを含めることができます `%` と `_`. + +`%` 任意のバイト数(ゼロ文字を含む)を示します。 + +`_` 任意のバイトを示します。 + +バックスラッシュを使う (`\`)メタシンボルをエスケープするため。 の説明でエスケープの注意事項を参照してください。 ‘match’ 機能。 + +次のような正規表現の場合 `%needle%`、コードはより最適であり、高速として動作します `position` 機能。 +その他の正規表現の場合、コードは次のようになります。 ‘match’ 機能。 + +## ノットライク(干し草、パターン)、干し草は、パターン演算子が好きではありません {#function-notlike} + +同じものとして ‘like’、しかし否定的。 + +## ngramDistance(干し草の山,針) {#ngramdistancehaystack-needle} + +間の4グラムの距離を計算します `haystack` と `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` または `haystack` 32Kb以上で、例外をスローします。 いくつかの非定数の場合 `haystack` または `needle` 文字列は32Kb以上で、距離は常に一つです。 + +大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. + +## ngramSearch(干し草の山,針) {#ngramsearchhaystack-needle} + +と同じ `ngramDistance` しかし、非対称の違いを計算します `needle` と `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` nグラム。 一つに近いほど、より多くの可能性が高い `needle` にある `haystack`. あいまい文字列検索に便利です。 + +大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. + +!!! note "メモ" + For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/ja/sql-reference/functions/type-conversion-functions.md b/docs/ja/sql-reference/functions/type-conversion-functions.md new file mode 100644 index 00000000000..043f802c0b8 --- /dev/null +++ b/docs/ja/sql-reference/functions/type-conversion-functions.md @@ -0,0 +1,534 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: "\u30BF\u30A4\u30D7\u5909\u63DB" +--- + +# タイプ変換関数 {#type-conversion-functions} + +## 数値変換の一般的な問題 {#numeric-conversion-issues} + +値をあるデータ型から別のデータ型に変換するときは、一般的なケースでは、データの損失につながる危険な操作であることを覚えておく必要があります。 大きいデータ型の値を小さいデータ型にフィットさせる場合、または異なるデータ型の間で値を変換する場合、データ損失が発生する可能性があります。 + +クリックハウスには [C++プログラムと同じ動作](https://en.cppreference.com/w/cpp/language/implicit_conversion). + +## toInt(8/16/32/64) {#toint8163264} + +入力値を次の値に変換します。 [Int](../../sql-reference/data-types/int-uint.md) データ型。 この関数ファミ: + +- `toInt8(expr)` — Results in the `Int8` データ型。 +- `toInt16(expr)` — Results in the `Int16` データ型。 +- `toInt32(expr)` — Results in the `Int32` データ型。 +- `toInt64(expr)` — Results in the `Int64` データ型。 + +**パラメータ** + +- `expr` — [式](../syntax.md#syntax-expressions) 数値または数値の小数表現を含む文字列を返します。 数値のBinary、octal、およびhexadecimal表現はサポートされていません。 先頭のゼロは除去されます。 + +**戻り値** + +の整数値 `Int8`, `Int16`, `Int32`、または `Int64` データ型。 + +関数の使用 [ゼロに向かって丸め](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) つまり、数字の小数桁を切り捨てます。 + +のための機能の動作 [NaNおよびInf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) 引数は未定義です。 覚えておいて [数値変換の問題](#numeric-conversion-issues)、機能を使用する場合。 + +**例えば** + +``` sql +SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) +``` + +``` text +┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ +│ -9223372036854775808 │ 32 │ 16 │ 8 │ +└──────────────────────┴─────────────┴───────────────┴─────────────┘ +``` + +## toInt(8/16/32/64)OrZero {#toint8163264orzero} + +これは、string型の引数をとり、int型にそれを解析しようとします(8 \| 16 \| 32 \| 64). 失敗した場合は0を返します。 + +**例えば** + +``` sql +select toInt64OrZero('123123'), toInt8OrZero('123qwe123') +``` + +``` text +┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ +│ 123123 │ 0 │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toInt(8/16/32/64)OrNull {#toint8163264ornull} + +これは、string型の引数をとり、int型にそれを解析しようとします(8 \| 16 \| 32 \| 64). 失敗した場合はnullを返します。 + +**例えば** + +``` sql +select toInt64OrNull('123123'), toInt8OrNull('123qwe123') +``` + +``` text +┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ +│ 123123 │ ᴺᵁᴸᴸ │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toUInt(8/16/32/64) {#touint8163264} + +入力値を次の値に変換します。 [UInt](../../sql-reference/data-types/int-uint.md) データ型。 この関数ファミ: + +- `toUInt8(expr)` — Results in the `UInt8` データ型。 +- `toUInt16(expr)` — Results in the `UInt16` データ型。 +- `toUInt32(expr)` — Results in the `UInt32` データ型。 +- `toUInt64(expr)` — Results in the `UInt64` データ型。 + +**パラメータ** + +- `expr` — [式](../syntax.md#syntax-expressions) 数値または数値の小数表現を含む文字列を返します。 数値のBinary、octal、およびhexadecimal表現はサポートされていません。 先頭のゼロは除去されます。 + +**戻り値** + +の整数値 `UInt8`, `UInt16`, `UInt32`、または `UInt64` データ型。 + +関数の使用 [ゼロに向かって丸め](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) つまり、数字の小数桁を切り捨てます。 + +負のagrumentsのための関数の動作と [NaNおよびInf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) 引数は未定義です。 負の数の文字列を渡すと、次のようになります `'-32'`、ClickHouseは例外を発生させます。 覚えておいて [数値変換の問題](#numeric-conversion-issues)、機能を使用する場合。 + +**例えば** + +``` sql +SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) +``` + +``` text +┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ +│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ +└─────────────────────┴───────────────┴────────────────┴──────────────┘ +``` + +## toUInt(8/16/32/64)OrZero {#touint8163264orzero} + +## toUInt(8/16/32/64)OrNull {#touint8163264ornull} + +## toFloat(32/64) {#tofloat3264} + +## toFloat(32/64)OrZero {#tofloat3264orzero} + +## toFloat(32/64)OrNull {#tofloat3264ornull} + +## toDate {#todate} + +## toDateOrZero {#todateorzero} + +## toDateOrNull {#todateornull} + +## toDateTime {#todatetime} + +## toDateTimeOrZero {#todatetimeorzero} + +## toDateTimeOrNull {#todatetimeornull} + +## toDecimal(32/64/128) {#todecimal3264128} + +変換 `value` に [小数](../../sql-reference/data-types/decimal.md) 精度の高いデータ型 `S`. その `value` 数値または文字列を指定できます。 その `S` (スケール)パラメータ小数点以下の桁数を指定します。 + +- `toDecimal32(value, S)` +- `toDecimal64(value, S)` +- `toDecimal128(value, S)` + +## toDecimal(32/64/128)OrNull {#todecimal3264128ornull} + +入力文字列をaに変換します [Nullable(小数点(P,S)))](../../sql-reference/data-types/decimal.md) データ型の値。 このファミリの機能など: + +- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` データ型。 +- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` データ型。 +- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` データ型。 + +これらの関数は、次の代わりに使用します `toDecimal*()` を取得したい場合は、 `NULL` 入力値の解析エラーが発生した場合の例外の代わりに値を指定します。 + +**パラメータ** + +- `expr` — [式](../syntax.md#syntax-expressions)、値を返します [文字列](../../sql-reference/data-types/string.md) データ型。 ClickHouseは、小数のテキスト表現を想定しています。 例えば, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**戻り値** + +の値 `Nullable(Decimal(P,S))` データ型。 値は次のとおりです: + +- 数との `S` ClickHouseが入力文字列を数値として解釈する場合、小数点以下の桁数。 +- `NULL` ClickHouseが入力文字列を数値として解釈できない場合、または入力番号に `S` 小数点以下の桁数。 + +**例** + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ +│ -1.11100 │ Nullable(Decimal(9, 5)) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ +│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toDecimal(32/64/128)OrZero {#todecimal3264128orzero} + +入力値を次の値に変換します。 [小数点(p,s))](../../sql-reference/data-types/decimal.md) データ型。 このファミリの機能など: + +- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` データ型。 +- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` データ型。 +- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` データ型。 + +これらの関数は、次の代わりに使用します `toDecimal*()` を取得したい場合は、 `0` 入力値の解析エラーが発生した場合の例外の代わりに値を指定します。 + +**パラメータ** + +- `expr` — [式](../syntax.md#syntax-expressions)、値を返します [文字列](../../sql-reference/data-types/string.md) データ型。 ClickHouseは、小数のテキスト表現を想定しています。 例えば, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**戻り値** + +の値 `Nullable(Decimal(P,S))` データ型。 値は次のとおりです: + +- 数との `S` ClickHouseが入力文字列を数値として解釈する場合、小数点以下の桁数。 +- 0とともに `S` ClickHouseが入力文字列を数値として解釈できない場合、または入力番号に `S` 小数点以下の桁数。 + +**例えば** + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ +│ -1.11100 │ Decimal(9, 5) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ +│ 0.00 │ Decimal(9, 2) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toString {#tostring} + +数値、文字列(固定文字列ではない)、日付、および日付を時刻で変換するための関数。 +これら全ての機能を受け入れを一つの引数。 + +文字列に変換するとき、または文字列から変換するとき、値はtabseparated形式(および他のほとんどすべてのテキスト形式)と同じ規則を使用して書式設定ま 文字列を解析できない場合は、例外がスローされ、要求はキャンセルされます。 + +日付を数値またはその逆に変換する場合、日付はunixエポックの開始からの日数に対応します。 +時刻を含む日付を数値またはその逆に変換する場合、時刻を含む日付は、unixエポックの開始からの秒数に対応します。 + +ToDate/toDateTime関数の日時形式は、次のように定義されています: + +``` text +YYYY-MM-DD +YYYY-MM-DD hh:mm:ss +``` + +例外として、uint32、int32、uint64、またはint64の数値型からdateに変換し、その数値が65536以上の場合、その数値はunixタイムスタンプとして(日数ではなく)解釈さ これにより、一般的な執筆のサポートが可能になります ‘toDate(unix\_timestamp)’ それ以外の場合はエラーになり、より面倒な書き込みが必要になります ‘toDate(toDateTime(unix\_timestamp))’. + +時間を伴う日付と日付の間の変換は、ヌル時間を追加するか、時間を落とすことによって自然な方法で行われます。 + +数値型間の変換は、c++で異なる数値型間の代入と同じ規則を使用します。 + +さらに、datetime引数のtostring関数は、タイムゾーンの名前を含む第二の文字列引数を取ることができます。 例えば: `Asia/Yekaterinburg` この場合、時刻は指定されたタイムゾーンに従ってフォーマットされます。 + +``` sql +SELECT + now() AS now_local, + toString(now(), 'Asia/Yekaterinburg') AS now_yekat +``` + +``` text +┌───────────now_local─┬─now_yekat───────────┐ +│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ +└─────────────────────┴─────────────────────┘ +``` + +また、 `toUnixTimestamp` 機能。 + +## toFixedString(s,N) {#tofixedstrings-n} + +文字列型引数をfixedstring(n)型(固定長nの文字列)に変換します。 nは定数でなければなりません。 +文字列のバイト数がnより少ない場合は、右側にnullバイトが渡されます。 文字列のバイト数がnより多い場合は、例外がスローされます。 + +## tostringクットゼロ(s) {#tostringcuttozeros} + +文字列またはfixedstring引数を受け取ります。 最初のゼロ-バイトで切り捨てられたコンテンツを持つ文字列を返します。 + +例えば: + +``` sql +SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s─────────────┬─s_cut─┐ +│ foo\0\0\0\0\0 │ foo │ +└───────────────┴───────┘ +``` + +``` sql +SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s──────────┬─s_cut─┐ +│ foo\0bar\0 │ foo │ +└────────────┴───────┘ +``` + +## reinterpretAsUInt(8/16/32/64) {#reinterpretasuint8163264} + +## 再解釈(8/16/32/64) {#reinterpretasint8163264} + +## 再解釈(32/64) {#reinterpretasfloat3264} + +## 再解釈アスデート {#reinterpretasdate} + +## タスデータタイムの再解釈 {#reinterpretasdatetime} + +これらの関数は文字列を受け取り、文字列の先頭に置かれたバイトをホスト順(リトルエンディアン)の数値として解釈します。 文字列が十分な長さでない場合、関数は、文字列が必要な数のヌルバイトで埋められているかのように機能します。 文字列が必要以上に長い場合、余分なバイトは無視されます。 日付はunixエポックの開始からの日数として解釈され、時刻付きの日付はunixエポックの開始からの秒数として解釈されます。 + +## 文字列の再解釈 {#type_conversion_functions-reinterpretAsString} + +この関数は、時刻を含む数値または日付または日付を受け取り、対応する値をホスト順(リトルエンディアン)で表すバイトを含む文字列を返します。 nullバイトは、末尾から削除されます。 たとえば、uint32型の値255は、バイト長の文字列です。 + +## 再解釈された文字列 {#reinterpretasfixedstring} + +この関数は、時刻を含む数値または日付または日付を受け取り、対応する値をホスト順(リトルエンディアン)で表すバイトを含むfixedstringを返します。 nullバイトは、末尾から削除されます。 たとえば、uint32型の値255は、バイト長のfixedstringです。 + +## キャスト(x,t) {#type_conversion_function-cast} + +変換 ‘x’ に ‘t’ データ型。 構文CAST(x AS t)もサポートされています。 + +例えば: + +``` sql +SELECT + '2016-06-15 23:00:00' AS timestamp, + CAST(timestamp AS DateTime) AS datetime, + CAST(timestamp AS Date) AS date, + CAST(timestamp, 'String') AS string, + CAST(timestamp, 'FixedString(22)') AS fixed_string +``` + +``` text +┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ +└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ +``` + +FixedString(N)への変換は、String型またはFixedString(N)型の引数に対してのみ機能します。 + +タイプへの変換 [Nullable](../../sql-reference/data-types/nullable.md) そして背部は支えられます。 例えば: + +``` sql +SELECT toTypeName(x) FROM t_null +``` + +``` text +┌─toTypeName(x)─┐ +│ Int8 │ +│ Int8 │ +└───────────────┘ +``` + +``` sql +SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null +``` + +``` text +┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ +│ Nullable(UInt16) │ +│ Nullable(UInt16) │ +└─────────────────────────────────────────┘ +``` + +## toInterval(年/四半期\|月/週\|日/時/分/秒) {#function-tointerval} + +数値型の引数を [間隔](../../sql-reference/data-types/special-data-types/interval.md) データ型。 + +**構文** + +``` sql +toIntervalSecond(number) +toIntervalMinute(number) +toIntervalHour(number) +toIntervalDay(number) +toIntervalWeek(number) +toIntervalMonth(number) +toIntervalQuarter(number) +toIntervalYear(number) +``` + +**パラメータ** + +- `number` — Duration of interval. Positive integer number. + +**戻り値** + +- の値 `Interval` データ型。 + +**例えば** + +``` sql +WITH + toDate('2019-01-01') AS date, + INTERVAL 1 WEEK AS interval_week, + toIntervalWeek(1) AS interval_to_week +SELECT + date + interval_week, + date + interval_to_week +``` + +``` text +┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ +│ 2019-01-08 │ 2019-01-08 │ +└───────────────────────────┴──────────────────────────────┘ +``` + +## parseDateTimeBestEffort {#parsedatetimebesteffort} + +の日付と時刻を変換します。 [文字列](../../sql-reference/data-types/string.md) 表現する [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) データ型。 + +関数は解析します [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC1123-5.2.14RFC-822日付と時刻の指定](https://tools.ietf.org/html/rfc1123#page-55)、ClickHouseのと他のいくつかの日付と時刻の形式。 + +**構文** + +``` sql +parseDateTimeBestEffort(time_string [, time_zone]); +``` + +**パラメータ** + +- `time_string` — String containing a date and time to convert. [文字列](../../sql-reference/data-types/string.md). +- `time_zone` — Time zone. The function parses `time_string` タイムゾーンによると。 [文字列](../../sql-reference/data-types/string.md). + +**サポートされている非標準形式** + +- 9を含む文字列。.10桁 [unix timestamp](https://en.wikipedia.org/wiki/Unix_time). +- 日付と時刻コンポーネントを含む文字列: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`、等。 +- 日付を含む文字列で、時間の要素は含まれません: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` など。 +- 日と時間のある文字列: `DD`, `DD hh`, `DD hh:mm`. この場合 `YYYY-MM` として代入される。 `2000-01`. +- タイムゾーンオフセット情報と共に日付と時刻を含む文字列: `YYYY-MM-DD hh:mm:ss ±h:mm`、等。 例えば, `2020-12-12 17:36:00 -5:00`. + +Separatorを持つすべての形式について、この関数は、フルネームまたは月名の最初の三文字で表される月の名前を解析します。 例: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. + +**戻り値** + +- `time_string` に変換される。 `DateTime` データ型。 + +**例** + +クエリ: + +``` sql +SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') +AS parseDateTimeBestEffort; +``` + +結果: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2020-12-12 12:12:57 │ +└─────────────────────────┘ +``` + +クエリ: + +``` sql +SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') +AS parseDateTimeBestEffort +``` + +結果: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-08-18 10:22:16 │ +└─────────────────────────┘ +``` + +クエリ: + +``` sql +SELECT parseDateTimeBestEffort('1284101485') +AS parseDateTimeBestEffort +``` + +結果: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2015-07-07 12:04:41 │ +└─────────────────────────┘ +``` + +クエリ: + +``` sql +SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') +AS parseDateTimeBestEffort +``` + +結果: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-12-12 10:12:12 │ +└─────────────────────────┘ +``` + +クエリ: + +``` sql +SELECT parseDateTimeBestEffort('10 20:19') +``` + +結果: + +``` text +┌─parseDateTimeBestEffort('10 20:19')─┐ +│ 2000-01-10 20:19:00 │ +└─────────────────────────────────────┘ +``` + +**また見なさい** + +- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) +- [RFC 1123](https://tools.ietf.org/html/rfc1123) +- [toDate](#todate) +- [toDateTime](#todatetime) + +## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} + +と同じ [parseDateTimeBestEffort](#parsedatetimebesteffort) ただし、処理できない日付形式が検出された場合はnullを返します。 + +## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} + +と同じ [parseDateTimeBestEffort](#parsedatetimebesteffort) ただし、処理できない日付形式に遭遇した場合は、日付またはゼロの日時が返されます。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/ja/sql-reference/functions/url-functions.md b/docs/ja/sql-reference/functions/url-functions.md new file mode 100644 index 00000000000..413a0891c58 --- /dev/null +++ b/docs/ja/sql-reference/functions/url-functions.md @@ -0,0 +1,209 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 54 +toc_title: "Url\u306E\u64CD\u4F5C" +--- + +# Urlを操作するための関数 {#functions-for-working-with-urls} + +これらの関数はすべてrfcに従いません。 それらは改善された性能のために最大限に簡単である。 + +## URLの一部を抽出する関数 {#functions-that-extract-parts-of-a-url} + +関連する部分がurlに存在しない場合は、空の文字列が返されます。 + +### プロトコル {#protocol} + +URLからプロトコルを抽出します。 + +Examples of typical returned values: http, https, ftp, mailto, tel, magnet… + +### ドメイン {#domain} + +URLからホスト名を抽出します。 + +``` sql +domain(url) +``` + +**パラメータ** + +- `url` — URL. Type: [文字列](../../sql-reference/data-types/string.md). + +URLは、スキームの有無にかかわらず指定できます。 例: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +これらの例では、 `domain` 関数は、次の結果を返します: + +``` text +some.svn-hosting.com +some.svn-hosting.com +yandex.com +``` + +**戻り値** + +- ホスト名。 clickhouseが入力文字列をurlとして解析できる場合。 +- 空の文字列。 clickhouseが入力文字列をurlとして解析できない場合。 + +タイプ: `String`. + +**例えば** + +``` sql +SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ +│ some.svn-hosting.com │ +└────────────────────────────────────────────────────────┘ +``` + +### ドメインウィズなしwww {#domainwithoutwww} + +ドメインを返し、複数のドメインを削除します ‘www.’ それの初めから、存在する場合。 + +### topleveldomaincomment {#topleveldomain} + +URLからトップレベルドメインを抽出します。 + +``` sql +topLevelDomain(url) +``` + +**パラメータ** + +- `url` — URL. Type: [文字列](../../sql-reference/data-types/string.md). + +URLは、スキームの有無にかかわらず指定できます。 例: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +**戻り値** + +- ドメイン名。 clickhouseが入力文字列をurlとして解析できる場合。 +- 空の文字列。 clickhouseが入力文字列をurlとして解析できない場合。 + +タイプ: `String`. + +**例えば** + +``` sql +SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ +│ com │ +└────────────────────────────────────────────────────────────────────┘ +``` + +### 最初のサブドメイン {#firstsignificantsubdomain} + +を返します “first significant subdomain”. これはYandex固有の非標準的な概念です。メトリカ 最初の重要なサブドメインは、セカンドレベルドメインです。 ‘com’, ‘net’, ‘org’、または ‘co’. それ以外の場合は、サードレベルのドメインです。 例えば, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. のリスト “insignificant” 二次レベルドメインおよびその他の実施内容に変化する可能性があります。 + +### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} + +トップレベルのサブドメインを含むドメインの部分を返します。 “first significant subdomain” (上記の説明を参照)。 + +例えば, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. + +### パス {#path} + +パスを返します。 例えば: `/top/news.html` パスにはクエリ文字列は含まれません。 + +### pathFull {#pathfull} + +上記と同じですが、クエリ文字列とフラグメントを含みます。 例:/トップ/ニュース。html?ページ=2\#コメント + +### クエリ文字列 {#querystring} + +クエリ文字列を返します。 例:ページ=1&lr=213。 query-stringには、最初の疑問符と\#と\#後のすべてが含まれていません。 + +### 断片 {#fragment} + +フラグメント識別子を返します。 fragmentには、最初のハッシュ記号は含まれません。 + +### queryStringAndFragment {#querystringandfragment} + +クエリ文字列とフラグメント識別子を返します。 例:ページ=1\#29390. + +### extractURLParameter(URL,名前) {#extracturlparameterurl-name} + +の値を返します ‘name’ URL内にパラメータが存在する場合。 それ以外の場合は、空の文字列。 この名前のパラメータが多数ある場合は、最初のオカレンスが返されます。 この関数は、パラメータ名が渡された引数とまったく同じ方法でURLにエンコードされるという前提の下で機能します。 + +### extractURLParameters(URL) {#extracturlparametersurl} + +URLパラメータに対応するname=value文字列の配列を返します。 値は決してデコードされません。 + +### extractURLParameterNames(URL) {#extracturlparameternamesurl} + +URLパラメータの名前に対応する名前文字列の配列を返します。 値は決してデコードされません。 + +### URLHierarchy(URL) {#urlhierarchyurl} + +最後に/,?記号で切り捨てられたurlを含む配列を返します。 パスとクエリ文字列で。 連続セパレータ文字として数えます。 カットは、すべての連続した区切り文字の後の位置に作られています。 + +### URLPathHierarchy(URL) {#urlpathhierarchyurl} + +上記と同じですが、結果のプロトコルとホストはありません。 要素(ルート)は含まれません。 例:この関数は、ツリーを実装するために使用されるyandexのurlを報告します。 メトリック。 + +``` text +URLPathHierarchy('https://example.com/browse/CONV-6788') = +[ + '/browse/', + '/browse/CONV-6788' +] +``` + +### decodeURLComponent(URL) {#decodeurlcomponenturl} + +復号化されたurlを返します。 +例えば: + +``` sql +SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; +``` + +``` text +┌─DecodedURL─────────────────────────────┐ +│ http://127.0.0.1:8123/?query=SELECT 1; │ +└────────────────────────────────────────┘ +``` + +## URLの一部を削除する関数。 {#functions-that-remove-part-of-a-url} + +URLに類似したものがない場合、URLは変更されません。 + +### cutWWW {#cutwww} + +一つ以下を削除します ‘www.’ URLのドメインの先頭から、存在する場合。 + +### cutQueryString {#cutquerystring} + +クエリ文字列を削除します。 疑問符も削除されます。 + +### カットフラグメント {#cutfragment} + +フラグメント識別子を削除します。 番号記号も削除されます。 + +### cutQueryStringAndFragment {#cutquerystringandfragment} + +クエリ文字列とフラグメント識別子を削除します。 疑問符と番号記号も削除されます。 + +### cutURLParameter(URL,名前) {#cuturlparameterurl-name} + +削除する ‘name’ URLパラメーターがある場合。 この関数は、パラメータ名が渡された引数とまったく同じ方法でURLにエンコードされるという前提の下で機能します。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/ja/sql-reference/functions/uuid-functions.md b/docs/ja/sql-reference/functions/uuid-functions.md new file mode 100644 index 00000000000..d4b4271179e --- /dev/null +++ b/docs/ja/sql-reference/functions/uuid-functions.md @@ -0,0 +1,122 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 53 +toc_title: "UUID\u306E\u64CD\u4F5C" +--- + +# UUIDを操作するための関数 {#functions-for-working-with-uuid} + +UUIDを操作するための関数を以下に示します。 + +## generateUUIDv4 {#uuid-function-generate} + +を生成する。 [UUID](../../sql-reference/data-types/uuid.md) の [バージョン4](https://tools.ietf.org/html/rfc4122#section-4.4). + +``` sql +generateUUIDv4() +``` + +**戻り値** + +UUID型の値。 + +**使用例** + +この例では、uuid型の列を使用してテーブルを作成し、テーブルに値を挿入する方法を示します。 + +``` sql +CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog + +INSERT INTO t_uuid SELECT generateUUIDv4() + +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┐ +│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ +└──────────────────────────────────────┘ +``` + +## toUUID(x) {#touuid-x} + +文字列型の値をuuid型に変換します。 + +``` sql +toUUID(String) +``` + +**戻り値** + +UUID型の値。 + +**使用例** + +``` sql +SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid +``` + +``` text +┌─────────────────────────────────uuid─┐ +│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ +└──────────────────────────────────────┘ +``` + +## UUIDStringToNum {#uuidstringtonum} + +次の形式の36文字を含む文字列を受け取ります `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` そして、それをaのバイトのセットとして返します [FixedString(16)](../../sql-reference/data-types/fixedstring.md). + +``` sql +UUIDStringToNum(String) +``` + +**戻り値** + +FixedString(16) + +**使用例** + +``` sql +SELECT + '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, + UUIDStringToNum(uuid) AS bytes +``` + +``` text +┌─uuid─────────────────────────────────┬─bytes────────────┐ +│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ +└──────────────────────────────────────┴──────────────────┘ +``` + +## UUIDNumToString {#uuidnumtostring} + +を受け入れる [FixedString(16)](../../sql-reference/data-types/fixedstring.md) 値、およびテキスト形式で36文字を含む文字列を返します。 + +``` sql +UUIDNumToString(FixedString(16)) +``` + +**戻り値** + +文字列。 + +**使用例** + +``` sql +SELECT + 'a/<@];!~p{jTj={)' AS bytes, + UUIDNumToString(toFixedString(bytes, 16)) AS uuid +``` + +``` text +┌─bytes────────────┬─uuid─────────────────────────────────┐ +│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ +└──────────────────┴──────────────────────────────────────┘ +``` + +## また見なさい {#see-also} + +- [dictGetUUID](ext-dict-functions.md#ext_dict_functions-other) + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/ja/sql-reference/functions/ym-dict-functions.md b/docs/ja/sql-reference/functions/ym-dict-functions.md new file mode 100644 index 00000000000..9c0cc0f0fd2 --- /dev/null +++ b/docs/ja/sql-reference/functions/ym-dict-functions.md @@ -0,0 +1,156 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 59 +toc_title: "Yandex\u306E\u3067\u306E\u4F5C\u696D\u3002\u30E1\u30C8\u30EA\u30AB\u8F9E\ + \u66F8" +--- + +# Yandexで作業するための機能。メトリカ辞書 {#functions-for-working-with-yandex-metrica-dictionaries} + +以下の機能が機能するためには、サーバー設定はすべてのyandexを取得するためのパスとアドレスを指定する必要があります。メトリカ辞書。 辞書は、これらの関数の最初の呼び出し時にロードされます。 参照リストをロードできない場合は、例外がスローされます。 + +のための情報を参照リストの項をご参照ください “Dictionaries”. + +## 複数のジオベース {#multiple-geobases} + +ClickHouseは、複数の代替ジオベース(地域階層)を同時に使用して、特定の地域が属する国のさまざまな視点をサポートします。 + +その ‘clickhouse-server’ configは、地域階層を持つファイルを指定します::`/opt/geo/regions_hierarchy.txt` + +このファイルのほかに、それはまた、(ファイル拡張子の前に)\_シンボルと名前に追加任意の接尾辞を持っている近くのファイルを検索します。 +たとえば、ファイルも検索します `/opt/geo/regions_hierarchy_ua.txt`、もしあれば。 + +`ua` 辞書キーと呼ばれます。 接尾辞のない辞書の場合、キーは空の文字列です。 + +すべての辞書は実行時に再ロードされます(builtin\_dictionaries\_reload\_interval設定パラメータで定義されているすべての秒数、またはデフォルトで時間が一度)。 ただし、使用可能な辞書のリストは、サーバーの起動時に一度だけ定義されます。 + +All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. +例えば: + +``` sql +regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt +``` + +### ツつィツ姪“ツつ”ツ債ツづュツつケツ-faq\]) {#regiontocityid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. + +### regionToArea(id\[,geobase\]) {#regiontoareaid-geobase} + +領域を領域に変換します(ジオベースのタイプ5)。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ +│ │ +│ Moscow and Moscow region │ +│ St. Petersburg and Leningrad region │ +│ Belgorod region │ +│ Ivanovsk region │ +│ Kaluga region │ +│ Kostroma region │ +│ Kursk region │ +│ Lipetsk region │ +│ Orlov region │ +│ Ryazan region │ +│ Smolensk region │ +│ Tambov region │ +│ Tver region │ +│ Tula region │ +└──────────────────────────────────────────────────────┘ +``` + +### ツつィツ姪“ツつ”ツ債ツづュツつケツ-ツ篠堕猟ソツ青ソツ仰\]) {#regiontodistrictid-geobase} + +地域を連邦区(ジオベースのタイプ4)に変換します。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ +│ │ +│ Central federal district │ +│ Northwest federal district │ +│ South federal district │ +│ North Caucases federal district │ +│ Privolga federal district │ +│ Ural federal district │ +│ Siberian federal district │ +│ Far East federal district │ +│ Scotland │ +│ Faroe Islands │ +│ Flemish region │ +│ Brussels capital region │ +│ Wallonia │ +│ Federation of Bosnia and Herzegovina │ +└──────────────────────────────────────────────────────────┘ +``` + +### ツつィツ姪“ツつ”ツ債ツづュツつケツ-ツつイツ堕環談\]) {#regiontocountryid-geobase} + +地域を国に変換します。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. +例えば: `regionToCountry(toUInt32(213)) = 225` モスクワ(213)をロシア(225)に変換する。 + +### ツつィツ姪“ツつ”ツ債ツづュツつケツ-ツつイツ堕環談\]) {#regiontocontinentid-geobase} + +地域を大陸に変換します。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. +例えば: `regionToContinent(toUInt32(213)) = 10001` モスクワ(213)をユーラシア(10001)に変換する。 + +### regionToTopContinent(\#regiontotopcontinent) {#regiontotopcontinent-regiontotopcontinent} + +リージョンの階層で最上位の大陸を検索します。 + +**構文** + +``` sql +regionToTopContinent(id[, geobase]); +``` + +**パラメータ** + +- `id` — Region ID from the Yandex geobase. [UInt32](../../sql-reference/data-types/int-uint.md). +- `geobase` — Dictionary key. See [複数のジオベース](#multiple-geobases). [文字列](../../sql-reference/data-types/string.md). 任意です。 + +**戻り値** + +- トップレベルの大陸の識別子(後者は地域の階層を登るとき)。 +- 0、何もない場合。 + +タイプ: `UInt32`. + +### ツ環板篠ョツ嘉ッツ偲青エツδツ-ツエツスツ-ツシツ\]) {#regiontopopulationid-geobase} + +地域の人口を取得します。 +人口はgeobaseのファイルに記録することができます。 セクションを見る “External dictionaries”. +リージョンに対して母集団が記録されていない場合は、0を返します。 +Yandex geobaseでは、母集団は子地域に対して記録されますが、親地域に対しては記録されません。 + +### ツつィツ姪“ツつ”ツ債ツづュツつケツ-ツ篠堕猟ソツ青ソツ仰\]) {#regioninlhs-rhs-geobase} + +をチェックする。 ‘lhs’ リージョンは ‘rhs’ 地域。 UInt8が属している場合は1、属していない場合は0を返します。 +The relationship is reflexive – any region also belongs to itself. + +### ツ環板篠ョツ嘉ッツ偲青エツδツ-ツエツスツ-ツシツ\]) {#regionhierarchyid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. +例えば: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. + +### リージョン名(id\[,lang\]) {#regiontonameid-lang} + +Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn’t exist, an empty string is returned. + +`ua` と `uk` もうクです。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/ja/sql-reference/index.md b/docs/ja/sql-reference/index.md new file mode 100644 index 00000000000..421fbb89d21 --- /dev/null +++ b/docs/ja/sql-reference/index.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: SQL Reference +toc_hidden: true +toc_priority: 28 +toc_title: "\u96A0\u3055\u308C\u305F" +--- + +# SQL参照 {#sql-reference} + +- [SELECT](statements/select.md) +- [INSERT INTO](statements/insert-into.md) +- [CREATE](statements/create.md) +- [ALTER](statements/alter.md#query_language_queries_alter) +- [その他の種類のクエリ](statements/misc.md) + +[元の記事](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/ja/sql-reference/operators.md b/docs/ja/sql-reference/operators.md new file mode 100644 index 00000000000..f0e403eb025 --- /dev/null +++ b/docs/ja/sql-reference/operators.md @@ -0,0 +1,278 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u6F14\u7B97\u5B50" +--- + +# 演算子 {#operators} + +すべての演算子は、優先順位と結合性に従って、クエリの解析段階で対応する関数に変換されます。 +演算子のグループは優先順位の順にリストされます(リスト内の高いほど、演算子はその引数に接続されています)。 + +## アクセス事業者 {#access-operators} + +`a[N]` – Access to an element of an array. The `arrayElement(a, N)` 機能。 + +`a.N` – Access to a tuple element. The `tupleElement(a, N)` 機能。 + +## 数値の否定の演算子 {#numeric-negation-operator} + +`-a` – The `negate (a)` 機能。 + +## 乗算演算子と除算演算子 {#multiplication-and-division-operators} + +`a * b` – The `multiply (a, b)` 機能。 + +`a / b` – The `divide(a, b)` 機能。 + +`a % b` – The `modulo(a, b)` 機能。 + +## 加算および減算演算子 {#addition-and-subtraction-operators} + +`a + b` – The `plus(a, b)` 機能。 + +`a - b` – The `minus(a, b)` 機能。 + +## 比較演算子 {#comparison-operators} + +`a = b` – The `equals(a, b)` 機能。 + +`a == b` – The `equals(a, b)` 機能。 + +`a != b` – The `notEquals(a, b)` 機能。 + +`a <> b` – The `notEquals(a, b)` 機能。 + +`a <= b` – The `lessOrEquals(a, b)` 機能。 + +`a >= b` – The `greaterOrEquals(a, b)` 機能。 + +`a < b` – The `less(a, b)` 機能。 + +`a > b` – The `greater(a, b)` 機能。 + +`a LIKE s` – The `like(a, b)` 機能。 + +`a NOT LIKE s` – The `notLike(a, b)` 機能。 + +`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. + +`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. + +## データセットを操作する演算子 {#operators-for-working-with-data-sets} + +*見る [演算子の場合](statements/select.md#select-in-operators).* + +`a IN ...` – The `in(a, b)` 機能。 + +`a NOT IN ...` – The `notIn(a, b)` 機能。 + +`a GLOBAL IN ...` – The `globalIn(a, b)` 機能。 + +`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` 機能。 + +## 日付と時刻を操作する演算子 {#operators-datetime} + +### EXTRACT {#operator-extract} + +``` sql +EXTRACT(part FROM date); +``` + +指定した日付からパートを抽出します。 たとえば、指定した日付から月、または時刻から秒を取得できます。 + +その `part` パラメーター取得する日付の部分を指定します。 次の値を使用できます: + +- `DAY` — The day of the month. Possible values: 1–31. +- `MONTH` — The number of a month. Possible values: 1–12. +- `YEAR` — The year. +- `SECOND` — The second. Possible values: 0–59. +- `MINUTE` — The minute. Possible values: 0–59. +- `HOUR` — The hour. Possible values: 0–23. + +その `part` パラ + +その `date` パラメーター処理する日付または時刻を指定します。 どちらか [日付](../sql-reference/data-types/date.md) または [DateTime](../sql-reference/data-types/datetime.md) タイプに対応しています。 + +例: + +``` sql +SELECT EXTRACT(DAY FROM toDate('2017-06-15')); +SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); +SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); +``` + +次の例では、テーブルを作成し、その中に値を挿入します `DateTime` タイプ。 + +``` sql +CREATE TABLE test.Orders +( + OrderId UInt64, + OrderName String, + OrderDate DateTime +) +ENGINE = Log; +``` + +``` sql +INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); +``` + +``` sql +SELECT + toYear(OrderDate) AS OrderYear, + toMonth(OrderDate) AS OrderMonth, + toDayOfMonth(OrderDate) AS OrderDay, + toHour(OrderDate) AS OrderHour, + toMinute(OrderDate) AS OrderMinute, + toSecond(OrderDate) AS OrderSecond +FROM test.Orders; +``` + +``` text +┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ +│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ +└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ +``` + +より多くの例を見ることができる [テスト](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). + +### INTERVAL {#operator-interval} + +を作成します。 [間隔](../sql-reference/data-types/special-data-types/interval.md)-との算術演算で使用されるべきであるタイプ値 [日付](../sql-reference/data-types/date.md) と [DateTime](../sql-reference/data-types/datetime.md)-タイプの値。 + +間隔のタイプ: +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +!!! warning "警告" + 間隔の異なる種類できない。 次のような式は使用できません `INTERVAL 4 DAY 1 HOUR`. たとえば、区間の最小単位が小さいか等しい単位で区間を表します `INTERVAL 25 HOUR`. 以下の例のように、結果としての操作を使用できます。 + +例えば: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +**また見なさい** + +- [間隔](../sql-reference/data-types/special-data-types/interval.md) データ型 +- [toInterval](../sql-reference/functions/type-conversion-functions.md#function-tointerval) 型変換関数 + +## 論理否定演算子 {#logical-negation-operator} + +`NOT a` – The `not(a)` 機能。 + +## 論理and演算子 {#logical-and-operator} + +`a AND b` – The`and(a, b)` 機能。 + +## 論理or演算子 {#logical-or-operator} + +`a OR b` – The `or(a, b)` 機能。 + +## 条件演算子 {#conditional-operator} + +`a ? b : c` – The `if(a, b, c)` 機能。 + +メモ: + +条件演算子は、bとcの値を計算し、条件aが満たされているかどうかをチェックし、対応する値を返します。 もし `b` または `C` は [arrayJoin()](../sql-reference/functions/array-join.md#functions_arrayjoin) この関数は、各行は関係なくレプリケートされます。 “a” 条件。 + +## 条件式 {#operator_case} + +``` sql +CASE [x] + WHEN a THEN b + [WHEN ... THEN ...] + [ELSE c] +END +``` + +もし `x` が指定されたら、 `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. + +がない場合 `ELSE c` 式中の句は、デフォルト値は次のとおりです `NULL`. + +その `transform` 機能は動作しません `NULL`. + +## 連結演算子 {#concatenation-operator} + +`s1 || s2` – The `concat(s1, s2) function.` + +## ラムダ作成演算子 {#lambda-creation-operator} + +`x -> expr` – The `lambda(x, expr) function.` + +次の演算子は、角かっこであるため、優先順位がありません: + +## 配列作成演算子 {#array-creation-operator} + +`[x1, ...]` – The `array(x1, ...) function.` + +## タプル作成演算子 {#tuple-creation-operator} + +`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` + +## 結合性 {#associativity} + +すべての二項演算子は結合性を残しています。 例えば, `1 + 2 + 3` に変換される。 `plus(plus(1, 2), 3)`. +時にはこれはあなたが期待するように動作しません。 例えば, `SELECT 4 > 2 > 3` 結果は0になります。 + +効率のため、 `and` と `or` 関数は任意の数の引数を受け取ります。 対応する鎖の `AND` と `OR` 演算子は、これらの関数の単一の呼び出しに変換されます。 + +## のチェック `NULL` {#checking-for-null} + +クリックハウスは `IS NULL` と `IS NOT NULL` 演算子。 + +### IS NULL {#operator-is-null} + +- のために [Nullable](../sql-reference/data-types/nullable.md) タイプ値は、 `IS NULL` 演算子の戻り値: + - `1` 値が `NULL`. + - `0` そうでなければ +- その他の値については、 `IS NULL` 演算子は常に戻ります `0`. + + + +``` sql +SELECT x+100 FROM t_null WHERE y IS NULL +``` + +``` text +┌─plus(x, 100)─┐ +│ 101 │ +└──────────────┘ +``` + +### IS NOT NULL {#is-not-null} + +- のために [Nullable](../sql-reference/data-types/nullable.md) タイプ値は、 `IS NOT NULL` 演算子の戻り値: + - `0` 値が `NULL`. + - `1` そうでなければ +- その他の値については、 `IS NOT NULL` 演算子は常に戻ります `1`. + + + +``` sql +SELECT * FROM t_null WHERE y IS NOT NULL +``` + +``` text +┌─x─┬─y─┐ +│ 2 │ 3 │ +└───┴───┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/ja/sql-reference/statements/alter.md b/docs/ja/sql-reference/statements/alter.md new file mode 100644 index 00000000000..ad225541d8b --- /dev/null +++ b/docs/ja/sql-reference/statements/alter.md @@ -0,0 +1,505 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 36 +toc_title: ALTER +--- + +## ALTER {#query_language_queries_alter} + +その `ALTER` クエリーのみ対応して `*MergeTree` テーブルだけでなく、 `Merge`と`Distributed`. クエリに複数のバリエーションがあります。 + +### 列の操作 {#column-manipulations} + +テーブル構造の変更。 + +``` sql +ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... +``` + +クエリで、コンマ区切りのアクションのリストを指定します。 +各アクションは、列に対する操作です。 + +次の操作がサポートされます: + +- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. +- [DROP COLUMN](#alter_drop-column) — Deletes the column. +- [CLEAR COLUMN](#alter_clear-column) — Resets column values. +- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. +- [MODIFY COLUMN](#alter_modify-column) — Changes column’s type, default expression and TTL. + +これらの動作については、以下で詳述する。 + +#### ADD COLUMN {#alter_add-column} + +``` sql +ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] +``` + +指定したテーブルに新しい列を追加します `name`, `type`, [`codec`](create.md#codecs) と `default_expr` (セクションを参照 [既定の式](create.md#create-default-values)). + +この `IF NOT EXISTS` 句が含まれている場合、列がすでに存在する場合、クエリはエラーを返しません。 指定した場合 `AFTER name_after` (名前のカラムのカラムを追加したものを指定されたもののリストテーブル列あります。 そうしないと、カラムが追加されるのです。 場合がありますので注意してない方の追加カラムの最初に表示します。 アクションの連鎖のために, `name_after` 前のアクションのいずれかで追加される列の名前を指定できます。 + +列を追加すると、データでアクションを実行せずにテーブル構造が変更されます。 データは後にディスクに表示されません `ALTER`. テーブルから読み取るときに列のデータが欠落している場合は、デフォルト値(デフォルトの式がある場合はデフォルトの式を実行するか、ゼロまたは データパーツをマージした後、ディスク上に列が表示されます [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)). + +このアプローチにより、 `ALTER` 古いデータの量を増やすことなく、即座に照会します。 + +例えば: + +``` sql +ALTER TABLE visits ADD COLUMN browser String AFTER user_id +``` + +#### DROP COLUMN {#alter_drop-column} + +``` sql +DROP COLUMN [IF EXISTS] name +``` + +名前の列を削除します `name`. この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 + +ファイルシステ これはファイル全体を削除するので、クエリはほぼ即座に完了します。 + +例えば: + +``` sql +ALTER TABLE visits DROP COLUMN browser +``` + +#### CLEAR COLUMN {#alter_clear-column} + +``` sql +CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name +``` + +すべてリセットデータ列の指定されたパーティション 詳細設定、パーティションの名前の部 [パーティション式の指定方法](#alter-how-to-specify-part-expr). + +この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 + +例えば: + +``` sql +ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() +``` + +#### COMMENT COLUMN {#alter_comment-column} + +``` sql +COMMENT COLUMN [IF EXISTS] name 'comment' +``` + +列にコメントを追加します。 この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 + +それぞれの列ができています。 列にコメントが既に存在する場合、新しいコメントは前のコメントを上書きします。 + +コメントは `comment_expression` によって返される列 [DESCRIBE TABLE](misc.md#misc-describe-table) クエリ。 + +例えば: + +``` sql +ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' +``` + +#### MODIFY COLUMN {#alter_modify-column} + +``` sql +MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] +``` + +このクエリは、 `name` 列のプロパティ: + +- タイプ + +- 既定の式 + +- TTL + + For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). + +この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 + +タイプを変更すると、値は次のように変換されます。 [toType](../../sql-reference/functions/type-conversion-functions.md) 関数がそれらに適用された。 デフォルトの式だけが変更された場合、クエリは何も複雑ではなく、ほぼ即座に完了します。 + +例えば: + +``` sql +ALTER TABLE visits MODIFY COLUMN browser Array(String) +``` + +Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. + +いくつかの処理段階があります: + +- 変更されたデータを含む一時(新しい)ファイルの準備。 +- 古いファイルの名前を変更する。 +- 一時(新しい)ファイルの名前を古い名前に変更します。 +- 古いファイルを削除する。 + +最初の段階だけに時間がかかります。 この段階で障害が発生した場合、データは変更されません。 +連続したステージのいずれかで障害が発生した場合は、データを手動で復元できます。 古いファイルがファイルシステムから削除されたが、新しいファイルのデータは、ディスクに書き込まれませんでしたし、失われた場合は例外です。 + +その `ALTER` クエリの変更カラムがそのままに再現されています。 指示はZooKeeperに保存され、各レプリカはそれらを適用します。 すべて `ALTER` クエリは同じ順序で実行されます。 クエリは、他のレプリカで適切なアクションが完了するのを待機します。 ただし、レプリケートされたテーブルの列を変更するクエリは中断され、すべてのアクションは非同期に実行されます。 + +#### ALTER Queryの制限 {#alter-query-limitations} + +その `ALTER` クエリを作成および削除個別要素(カラム)をネストしたデータ構造が全体に入れ子データ構造です。 ネストされたデータ構造を追加するには、次のような名前の列を追加します `name.nested_name` そしてタイプ `Array(T)`. ネストされたデータ構造は、ドットの前に同じ接頭辞を持つ名前を持つ複数の配列列列と同等です。 + +主キーまたはサンプリングキーの列の削除はサポートされていません。 `ENGINE` 式)。 主キーに含まれる列の型を変更することは、この変更によってデータが変更されない場合にのみ可能です(たとえば、値を列挙型に追加したり、型を変更 `DateTime` に `UInt32`). + +この `ALTER` クエリは必要なテーブルの変更を行うのに十分ではありません。 [INSERT SELECT](insert-into.md#insert_query_insert-select) クエリを使用してテーブルを切り替えます。 [RENAME](misc.md#misc_operations-rename) 古いテーブルを照会して削除します。 を使用することができ [クリックハウスコピー機](../../operations/utilities/clickhouse-copier.md) に代わるものとして `INSERT SELECT` クエリ。 + +その `ALTER` クエリーのブロックすべてを読み込みと書き込んでいます。 言い換えれば、長い場合 `SELECT` の時に動いています `ALTER` クエリ、 `ALTER` クエリはそれが完了するのを待ちます。 同時に、同じテーブルに対するすべての新しいクエリは、 `ALTER` 走ってる + +データ自体を格納しないテーブルの場合 `Merge` と `Distributed`), `ALTER` テーブル構造を変更するだけで、下位テーブルの構造は変更されません。 たとえば、ALTERを実行している場合 `Distributed` テーブル、また、実行する必要があります `ALTER` テーブルのすべてすることができます。 + +### キー式による操作 {#manipulations-with-key-expressions} + +以下のコマン: + +``` sql +MODIFY ORDER BY new_expression +``` + +それはの表のためにだけ働きます [`MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) ファミリー(含む +[複製された](../../engines/table-engines/mergetree-family/replication.md) テーブル)。 このコマンドは、 +[ソートキー](../../engines/table-engines/mergetree-family/mergetree.md) テーブルの +に `new_expression` (式または式のタプル)。 主キーは同じままです。 + +このコマンドは、メタデータのみを変更するという意味で軽量です。 データ部分のプロパティを保持するには +既存の列を含む式を追加することはできません。 +ソートキーに(列のみが追加されました。 `ADD COLUMN` 同じでコマンド `ALTER` クエリ)。 + +### データスキップインデックスの操作 {#manipulations-with-data-skipping-indices} + +それはの表のためにだけ働きます [`*MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) ファミリー(含む +[複製された](../../engines/table-engines/mergetree-family/replication.md) テーブル)。 次の操作 +利用できます: + +- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` -付加価指数の説明をテーブルメタデータを指すものとします。 + +- `ALTER TABLE [db].name DROP INDEX name` -除去す指標の説明からテーブルメタデータを削除を行指数のファイルからディスク。 + +これらのコマ +また、その複製(同期指標のメタデータを通して飼育係). + +### 制約による操作 {#manipulations-with-constraints} + +るの詳細を参照してください [制約](create.md#constraints) + +次の構文を使用して制約を追加または削除できます: + +``` sql +ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; +ALTER TABLE [db].name DROP CONSTRAINT constraint_name; +``` + +クエリに追加または削除約メタデータの制約からテーブルで、速やかに処理します。 + +制約チェック *実行されません* 既存のデータが追加された場合。 + +変更後の内容の複製のテーブル放送への飼育係で適用されますその他のレプリカ. + +### パーティションとパーツの操作 {#alter_manipulations-with-partitions} + +以下の操作 [パーティシ](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) 利用できます: + +- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` ディレク +- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. +- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` テーブルへのディレクトリ。 +- [REPLACE PARTITION](#alter_replace-partition) -データパーティションをテーブル間でコピーします。 +- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. +- [REPLACE PARTITION](#alter_replace-partition) -コピーするデータを仕切りからテーブルにも置き換え. +- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition)-あるテーブルから別のテーブルにデータパーティションを移動します。 +- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) -パーティション内の指定された列の値をリセットします。 +- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) -リセットの指定された二次インデックス、パーティション +- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. +- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. +- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. + + + +#### デタッチパーティション{\#alter\_detach-partition} {#detach-partition-alter-detach-partition} + +``` sql +ALTER TABLE table_name DETACH PARTITION partition_expr +``` + +指定されたパーティションのすべてのデータを `detached` ディレクトリ。 サーバーのを忘れているのは、一戸建てのデータを分配していない場合は存在します。 サーバーはこのデータについて知りません。 [ATTACH](#alter_attach-partition) クエリ。 + +例えば: + +``` sql +ALTER TABLE visits DETACH PARTITION 201901 +``` + +セクションのpartition expressionの設定についての記事を読む [パーティション式の指定方法](#alter-how-to-specify-part-expr). + +クエリが実行された後、データを使用して必要な操作を行うことができます `detached` directory — delete it from the file system, or just leave it. + +This query is replicated – it moves the data to the `detached` すべての複製のディレクトリ。 このクエリはリーダーレプリカでのみ実行できます。 レプリカがリーダーかどうかを調べるには、以下を実行します `SELECT` にクエリ [システム。レプリカ](../../operations/system-tables.md#system_tables-replicas) テーブル。 また、作ることは容易です `DETACH` クエリはすべてのレプリカ-すべてのレプリカ、例外をスロー以外のリーダーレプリカ. + +#### DROP PARTITION {#alter_drop-partition} + +``` sql +ALTER TABLE table_name DROP PARTITION partition_expr +``` + +削除指定された分割テーブルから. このクエリのタグの仕切りとして休止または消去いたしますデータを完全に約10分です。 + +セクションのpartition expressionの設定についての記事を読む [パーティション式の指定方法](#alter-how-to-specify-part-expr). + +The query is replicated – it deletes data on all replicas. + +#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} + +``` sql +ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr +``` + +指定したパーティショ `detached`. +セクションのパーティション式の設定の詳細 [パーティション式の指定方法](#alter-how-to-specify-part-expr). + +#### ATTACH PARTITION\|PART {#alter_attach-partition} + +``` sql +ALTER TABLE table_name ATTACH PARTITION|PART partition_expr +``` + +テーブルにデータを追加します。 `detached` ディレクトリ。 パーティション全体または別のパートにデータを追加することができます。 例: + +``` sql +ALTER TABLE visits ATTACH PARTITION 201901; +ALTER TABLE visits ATTACH PART 201901_2_2_0; +``` + +セクションのパーティション式の設定の詳細 [パーティション式の指定方法](#alter-how-to-specify-part-expr). + +このクエリは複製されます。 のレプリカ-イニシエータチェックがあるか否かのデータを `detached` ディレクトリ。 データが存在する場合、クエリは整合性をチェックします。 すべてが正しい場合、クエリはデータをテーブルに追加します。 他のすべてのレプリカをダウンロードからデータのレプリカ-イニシエータです。 + +したがって、データを `detached` ディレクトリを使用します。 `ALTER ... ATTACH` すべてのレプリカのテーブルにクエリを追加します。 + +#### ATTACH PARTITION FROM {#alter_attach-partition-from} + +``` sql +ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 +``` + +このクエリは、データパーティションを `table1` に `table2` のexsistingにデータを加えます `table2`. データは削除されないことに注意してください `table1`. + +クエリを正常に実行するには、次の条件を満たす必要があります: + +- 両方のテーブルに同じ構造が必要です。 +- 両方の表に同じパーティション-キーが必要です。 + +#### REPLACE PARTITION {#alter_replace-partition} + +``` sql +ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 +``` + +このクエリは、データパーティションを `table1` に `table2` そしての既存の仕切りを取り替えます `table2`. データは削除されないことに注意してください `table1`. + +クエリを正常に実行するには、次の条件を満たす必要があります: + +- 両方のテーブルに同じ構造が必要です。 +- 両方の表に同じパーティション-キーが必要です。 + +#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} + +``` sql +ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest +``` + +このクエリは、データパーティションを `table_source` に `table_dest` からデータを削除すると `table_source`. + +クエリを正常に実行するには、次の条件を満たす必要があります: + +- 両方のテーブルに同じ構造が必要です。 +- 両方の表に同じパーティション-キーが必要です。 +- 両方のテーブルと同じでなければならエンジンです。 (複製または非レプリケート) +- 両方の表に同じストレージポリシーが必要です。 + +#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} + +``` sql +ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr +``` + +パーティショ この `DEFAULT` このクエリは、指定されたデフォルト値に列の値を設定し、テーブルを作成するときに句が決定された。 + +例えば: + +``` sql +ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 +``` + +#### FREEZE PARTITION {#alter_freeze-partition} + +``` sql +ALTER TABLE table_name FREEZE [PARTITION partition_expr] +``` + +このクエ この `PARTITION` 条項を省略して、クエリーを作成し、バックアップの仕切ります。 + +!!! note "メモ" + バックアップ処理全体は、サーバーを停止せずに実行されます。 + +古いスタイルのテーブルでは、パーティション名のプレフィックスを指定できます(例, ‘2019’)のクエリーを作成し、バックアップのためのすべてに対応する隔壁 セクションのpartition expressionの設定についての記事を読む [パーティション式の指定方法](#alter-how-to-specify-part-expr). + +実行時に、データスナップショットの場合、クエリはテーブルデータへのハードリンクを作成します。 ディレクト `/var/lib/clickhouse/shadow/N/...`、どこ: + +- `/var/lib/clickhouse/` 設定で指定されたClickHouseの作業ディレクトリです。 +- `N` バックアップの増分数です。 + +!!! note "メモ" + 使用する場合 [テーブル内のデータストレージのディスクのセット](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes)、を `shadow/N` ディレクトリが表示される毎にディスクデータを格納する部品と合わせによる `PARTITION` 式。 + +同じディレクトリ構造がバックアップ内に作成されます。 `/var/lib/clickhouse/`. クエリが実行されます ‘chmod’ すべてのファイルについて、それらへの書き込みを禁止。 + +バックアップを作成したら、次のデータをコピーできます `/var/lib/clickhouse/shadow/` リモートサーバーに移動し、ローカルサーバーから削除します。 それに注意しなさい `ALTER t FREEZE PARTITION` クエリは複製されません。 するための地元のバックアップ、現地サーバーです。 + +クエリをバックアップトで最初のでお待ちしておりますので、現在のクエリーに対応するテーブルに仕上げた。 + +`ALTER TABLE t FREEZE PARTITION` コピーのみのデータのないテーブルメタデータを指すものとします。 をバックアップテーブルメタデータ、コピー、ファイル `/var/lib/clickhouse/metadata/database/table.sql` + +バックアップからデータを復元するには: + +1. テーブルが存在しない場合はテーブルを作成します。 クエリを表示するには、を使用します。sqlファイル(置換 `ATTACH` それで `CREATE`). +2. からデータをコピーします `data/database/table/` バックアップの中のディレクトリ `/var/lib/clickhouse/data/database/table/detached/` ディレクトリ。 +3. 走れ。 `ALTER TABLE t ATTACH PARTITION` データをテーブルに追加するクエリ。 + +バックア + +バックアップおよびデータの復元の詳細については、次を参照 [データバック](../../operations/backup.md) セクション。 + +#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} + +``` sql +ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr +``` + +クエリは次のように動作します `CLEAR COLUMN` しかし、列データの代わりに索引をリセットします。 + +#### FETCH PARTITION {#alter_fetch-partition} + +``` sql +ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' +``` + +ダウンロードパーティションから別のサーバーです。 このクエリーだけを再現します。 + +クエリは次の処理を行います: + +1. 指定したシャードからパーティションをダウ で ‘path-in-zookeeper’ ZooKeeperでシャードへのパスを指定する必要があります。 +2. 次に、クエリはダウンロードされたデータを `detached` のディレクトリ `table_name` テーブル。 を使用 [ATTACH PARTITION\|PART](#alter_attach-partition) データをテーブルに追加するためのクエリ。 + +例えば: + +``` sql +ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; +ALTER TABLE users ATTACH PARTITION 201902; +``` + +それに注意: + +- その `ALTER ... FETCH PARTITION` クエリは複製されません。 それはに仕切りを置きます `detached` ディレクト +- その `ALTER TABLE ... ATTACH` クエリが複製されます。 すべてのレプリカにデータを追加します。 データは、次のいずれかのレプリカに追加されます。 `detached` ディレクトリ、および他の人に-近隣のレプリカから。 + +ダウンロードする前に、システムかどうかをチェックすると、パーティションが存在するとテーブル構造。 最も適切なレプリカは、正常なレプリカから自動的に選択されます。 + +クエリは呼び出されますが `ALTER TABLE` テーブル構造は変更されず、テーブルで使用できるデータもすぐには変更されません。 + +#### MOVE PARTITION\|PART {#alter_move-partition} + +別のボリュームまたはディ `MergeTree`-エンジンテーブル。 見る [複数ブロックデバイスを使用したデータ保存](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes). + +``` sql +ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' +``` + +その `ALTER TABLE t MOVE` クエリ: + +- な再現が異なるレプリカで保管。 +- 指定されたディスクまたはボリ また、ストレージポリシーで指定されたデータ移動の条件を適用できない場合は、エラーが返されます。 +- 移動するデータがバックグラウンドプロセスによって既に移動されている場合にエラーを返すことができます。 `ALTER TABLE t MOVE` クエリとして結果データの統合. この場合、ユーザーは追加の操作を行うべきではありません。 + +例えば: + +``` sql +ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' +ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' +``` + +#### パーティション式の設定方法 {#alter-how-to-specify-part-expr} + +パーティション式を指定するには `ALTER ... PARTITION` 異なる方法でクエリ: + +- からの値として `partition` の列 `system.parts` テーブル。 例えば, `ALTER TABLE visits DETACH PARTITION 201901`. +- テーブル列からの式として。 定数と定数式がサポートされています。 例えば, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. +- パーティションidの使用。 パーティションidは、ファイルシステムおよびzookeeper内のパーティションの名前として使用されるパーティションの文字列識別子です(可能であれば、人間が パーティションidを指定する必要があります。 `PARTITION ID` 一重引quotesでの句。 例えば, `ALTER TABLE visits DETACH PARTITION ID '201901'`. +- で [ALTER ATTACH PART](#alter_attach-partition) と [DROP DETACHED PART](#alter_drop-detached) クエリ、パートの名前を指定するには、文字列リテラルを使用します。 `name` の列 [システム。detached\_parts](../../operations/system-tables.md#system_tables-detached_parts) テーブル。 例えば, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. + +ご利用の引用符を指定する場合、パーティションのエントランスは目を引く壁面緑化を表現。 たとえば、 `String` その名前を引用符で指定する必要があります (`'`). のための `Date` と `Int*` タイプ引用符は必要ありません。 + +古いスタイルのテーブルの場合は、パーティションを数値として指定できます `201901` または文字列 `'201901'`. 新しいスタイルのテーブルの構文は、型が厳しくなります(VALUES入力フォーマットのパーサーと同様)。 + +上記のすべてのルールは、 [OPTIMIZE](misc.md#misc_operations-optimize) クエリ。 を指定する場合にのみ分配時の最適化、非仕切られたテーブルセットの表現 `PARTITION tuple()`. 例えば: + +``` sql +OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; +``` + +の例 `ALTER ... PARTITION` クエリはテストで実証されています [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) と [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). + +### テーブルttlによる操作 {#manipulations-with-table-ttl} + +変更することができ [テーブルTTL](../../engines/table-engines/mergetree-family/mergetree.md#mergetree-table-ttl) 次のフォームの要求で: + +``` sql +ALTER TABLE table-name MODIFY TTL ttl-expression +``` + +### ALTERクエリのシンクロニシティ {#synchronicity-of-alter-queries} + +非複製可能なテーブルの場合は、すべて `ALTER` クエリは同期的に実行されます。 のためのreplicatableテーブル、クエリーだけで追加指示のための適切な行動を `ZooKeeper`、そしてアクション自体はできるだけ早く実行されます。 しかし、クエリーが待機するためにこれらの行動は完了するすべてのレプリカ. + +のために `ALTER ... ATTACH|DETACH|DROP` クエリを使用することができます `replication_alter_partitions_sync` 待ちを設定する設定。 +可能な値: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. + +### 突然変異 {#alter-mutations} + +突然変異は、テーブル内の行を変更または削除できるようにするalter query variantです。 標準とは対照的に `UPDATE` と `DELETE` ポイントデータの変更を目的としたクエリ、突然変異は、テーブル内の多くの行を変更する重い操作を目的としています。 のために支えられる `MergeTree` 家族のテーブルエンジンなどのエンジンの複製です。 + +既存のテーブルはそのまま変異可能です(変換は必要ありません)が、最初の変更がテーブルに適用されると、そのメタデータ形式は以前のサーバーバージョンと + +現在使用可能なコマンド: + +``` sql +ALTER TABLE [db.]table DELETE WHERE filter_expr +``` + +その `filter_expr` 型でなければならな `UInt8`. クエリは、この式がゼロ以外の値をとるテーブルの行を削除します。 + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr +``` + +その `filter_expr` 型でなければならな `UInt8`. このクエリは、指定された列の値を、対応する式の値に更新します。 `filter_expr` ゼロ以外の値をとります。 値は列タイプにキャストされます。 `CAST` オペレーター プライマリキーまたはパーティションキーの計算で使用される列の更新はサポートされません。 + +``` sql +ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name +``` + +クエリを再建の二次指数 `name` パーティション内 `partition_name`. + +一つのクエリを含むことができ複数のコマンドをカンマで区切られています。 + +用\*mergetreeテーブル突然変異の実行による書き換え全体のデータ部品です。 atomicity-部品は準備ができているおよびaとすぐ変異する部品の代わりになりますありません `SELECT` 変異中に実行を開始したクエリには、まだ変更されていない部分のデータと共に既に変更されている部分のデータが表示されます。 + +突然変異は、作成順序によって完全に順序付けられ、その順序で各パートに適用されます。 突然変異が提出される前にテーブルに挿入されたデータは突然変異され、その後に挿入されたデータは突然変異されません。 この変異のないブロックを挿入します。 + +変更クエリは、変更エントリが追加された直後に返されます(レプリケートされたテーブルがzookeeperにある場合、非レプリケートされたテーブルがファイルシス の突然変異体の執行を非同利用システムの概要を設定します。 突然変異の進行状況を追跡するには、 [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) テーブル。 正常に送信された変更は、ClickHouseサーバーが再起動されても引き続き実行されます。 それが提出されると突然変異をロールバックする方法はありませんが、何らかの理由で突然変異が起こった場合、それをキャンセルすることができ [`KILL MUTATION`](misc.md#kill-mutation) クエリ。 + +終了した突然変異のためのエントリはすぐに削除されません(保存されたエントリの数は `finished_mutations_to_keep` ストレージエンジン変数)。 古い変異エントリが削除されます。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/ja/sql-reference/statements/create.md b/docs/ja/sql-reference/statements/create.md new file mode 100644 index 00000000000..e900e858a76 --- /dev/null +++ b/docs/ja/sql-reference/statements/create.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 35 +toc_title: CREATE +--- + +# クエリの作成 {#create-queries} + +## CREATE DATABASE {#query-language-create-database} + +データベースの作成。 + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] +``` + +### 句 {#clauses} + +- `IF NOT EXISTS` + + If the `db_name` database already exists, then ClickHouse doesn't create a new database and: + + - Doesn't throw an exception if clause is specified. + - Throws an exception if clause isn't specified. + +- `ON CLUSTER` + + ClickHouse creates the `db_name` database on all the servers of a specified cluster. + +- `ENGINE` + + - [MySQL](../engines/database_engines/mysql.md) + + Allows you to retrieve data from the remote MySQL server. + + By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). + +## CREATE TABLE {#create-table-query} + +その `CREATE TABLE` クエリには複数の形式を使用できます。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], + ... +) ENGINE = engine +``` + +名前の付いた表を作成します ‘name’ で ‘db’ データベースまたは ‘db’ は設定されていない。 ‘engine’ エンジン。 +テーブルの構造は、列の説明のリストです。 た場合の指数については、エンジンとして表示していパラメータテーブルのエンジンです。 + +列の説明は次のとおりです `name type` 最も単純なケースでは。 例えば: `RegionID UInt32`. +デフォルト値に対して式を定義することもできます(下記参照)。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] +``` + +別のテーブルと同じ構造のテーブルを作成します。 テーブルに別のエンジンを指定できます。 エンジンが指定されていない場合は、同じエンジンが `db2.name2` テーブル。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() +``` + +テーブルを作成しますの構造やデータによって返される [テーブル機能](../table-functions/index.md). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... +``` + +の結果のような構造を持つテーブルを作成します。 `SELECT` クエリ、 ‘engine’ エンジンは、SELECTからのデータでそれを埋めます。 + +すべての場合において、 `IF NOT EXISTS` テーブルが既に存在する場合、クエリはエラーを返しません。 この場合、クエリは何もしません。 + +後に他の節がある場合もあります `ENGINE` クエリ内の句。 テーブルの作成方法に関する詳細なドキュメントを参照してください [表エンジン](../../engines/table-engines/index.md#table_engines). + +### デフォルト値 {#create-default-values} + +列の説明では、次のいずれかの方法で、既定値の式を指定できます:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. +例えば: `URLDomain String DEFAULT domain(URL)`. + +デフォルト値の式が定義されていない場合、デフォルト値は数値の場合はゼロに、文字列の場合は空の文字列に、配列の場合は空の配列に設定され `0000-00-00` 日付または `0000-00-00 00:00:00` 時間の日付のため。 Nullはサポートされていません。 + +既定の式が定義されている場合、列の型は省略可能です。 明示的に定義された型がない場合は、既定の式の型が使用されます。 例えば: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ タイプは ‘EventDate’ コラム + +データ型と既定の式が明示的に定義されている場合、この式は型キャスト関数を使用して指定された型にキャストされます。 例えば: `Hits UInt32 DEFAULT 0` と同じことを意味します `Hits UInt32 DEFAULT toUInt32(0)`. + +Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don’t contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. + +`DEFAULT expr` + +通常のデフォルト値。 insertクエリで対応する列が指定されていない場合は、対応する式を計算して入力します。 + +`MATERIALIZED expr` + +マテリアライズド式。 このような列は、常に計算されるため、insertに指定することはできません。 +列のリストのないinsertの場合、これらの列は考慮されません。 +また、selectクエリでアスタリスクを使用する場合、この列は置換されません。 これは、ダンプが以下を使用して取得した不変量を保持するためです `SELECT *` 列のリストを指定せずにINSERTを使用してテーブルに戻すことができます。 + +`ALIAS expr` + +同義語。 このような列は、テーブルにはまったく格納されません。 +その値はテーブルに挿入することはできず、selectクエリでアスタリスクを使用するときは置換されません。 +クエリの解析中にエイリアスが展開されている場合は、selectで使用できます。 + +ALTER queryを使用して新しい列を追加する場合、これらの列の古いデータは書き込まれません。 代わりに、新しい列の値を持たない古いデータを読み取る場合、式は既定でオンザフライで計算されます。 ただし、式を実行するために、クエリで指定されていない異なる列が必要な場合、これらの列は追加で読み取られますが、必要なデータブロックに対し + +新しい列をテーブルに追加し、後でそのデフォルトの式を変更すると、古いデータに使用される値が変更されます(ディスクに値が格納されていないデー バックグラウンドマージを実行すると、マージパーツのいずれかにない列のデータがマージされたパーツに書き込まれます。 + +入れ子になったデータ構造の要素の既定値を設定することはできません。 + +### 制約 {#constraints} + +列と共に、説明の制約を定義することができます: + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + ... + CONSTRAINT constraint_name_1 CHECK boolean_expr_1, + ... +) ENGINE = engine +``` + +`boolean_expr_1` 任意のブール式でできます。 場合に制約の定義のテーブルのそれぞれチェック毎に行 `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. + +追加大量の制約になる可能性の性能を大 `INSERT` クエリ。 + +### TTL式 {#ttl-expression} + +値の保存時間を定義します。 mergetree-familyテーブルにのみ指定できます。 詳細な説明については、 [列とテーブルのttl](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). + +### 列圧縮コーデック {#codecs} + +デフォルトでは、clickhouseは `lz4` 圧縮方法。 のために `MergeTree`-エンジンファミリでは、デフォルトの圧縮方法を変更できます [圧縮](../../operations/server-configuration-parameters/settings.md#server-settings-compression) サーバー構成のセクション。 また、各列の圧縮方法を定義することもできます。 `CREATE TABLE` クエリ。 + +``` sql +CREATE TABLE codec_example +( + dt Date CODEC(ZSTD), + ts DateTime CODEC(LZ4HC), + float_value Float32 CODEC(NONE), + double_value Float64 CODEC(LZ4HC(9)) + value Float32 CODEC(Delta, ZSTD) +) +ENGINE = +... +``` + +コーデックが指定されている場合、既定のコーデックは適用されません。 コーデックの組合せでのパイプライン、例えば, `CODEC(Delta, ZSTD)`. の選定と大型ブリッジダイオードコーデックの組み合わせますプロジェクト、ベンチマークと同様に記載のAltinity [ClickHouseの効率を改善する新しいエンコーディング](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) 記事。 + +!!! warning "警告" + できない解凍clickhouseデータベースファイルを外部の事のように `lz4`. 代わりに、特別な [clickhouse-コンプレッサー](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) 効用だ + +圧縮できるようになりました以下のテーブルエンジン: + +- [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) 家族 列圧縮コーデックをサポートし、既定の圧縮方法を選択する [圧縮](../../operations/server-configuration-parameters/settings.md#server-settings-compression) 設定。 +- [ログ](../../engines/table-engines/log-family/log-family.md) 家族 使用します `lz4` 圧縮メソッドはデフォルト対応カラムの圧縮コーデック. +- [セット](../../engines/table-engines/special/set.md). 唯一のデフォルトの圧縮をサポート。 +- [参加](../../engines/table-engines/special/join.md). 唯一のデフォルトの圧縮をサポート。 + +ClickHouse支援共通の目的コーデックや専門のコーデック. + +#### 特殊コーデック {#create-query-specialized-codecs} + +これらのコーデックしていただくための圧縮により効果的な利用の特徴データです。 これらのコーデックの一部は、データ自身を圧縮しない。 その代わりに、それらのデータを共通の目的コーデックは、圧縮です。 + +特殊コーデック: + +- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` デルタ値を格納するために使用されます。 `delta_bytes` raw値の最大サイズです。 可能 `delta_bytes` 値:1,2,4,8. のデフォルト値 `delta_bytes` は `sizeof(type)` 1、2、4、または8に等しい場合。 それ以外の場合は1です。 +- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla:高速でスケーラブルなメモリ内の時系列データベース](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla:高速でスケーラブルなメモリ内の時系列データベース](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` と `DateTime`). アルゴリズムの各ステップで、codecは64値のブロックを取り、64x64ビット行列にそれらを入れ、それを転置し、未使用の値をトリミングし、残りをシーケ 未使用のビットは、圧縮が使用されるデータ部分全体の最大値と最小値の間で異ならないビットです。 + +`DoubleDelta` と `Gorilla` コーデックは、その圧縮アルゴリズムの構成要素としてゴリラTSDBで使用されています。 Gorillaのアプローチは、タイムスタンプで徐々に変化する値のシーケンスがある場合のシナリオで有効です。 タイムスタンプは、 `DoubleDelta` コーデックおよび値はによって効果的に圧縮されます `Gorilla` コーデック。 たとえば、効果的に格納されたテーブルを取得するには、次の構成でテーブルを作成します: + +``` sql +CREATE TABLE codec_example +( + timestamp DateTime CODEC(DoubleDelta), + slow_values Float32 CODEC(Gorilla) +) +ENGINE = MergeTree() +``` + +#### 一般的な目的のコーデック {#create-query-common-purpose-codecs} + +コーデック: + +- `NONE` — No compression. +- `LZ4` — Lossless [データ圧縮](https://github.com/lz4/lz4) 既定で使用されます。 LZ4高速圧縮を適用します。 +- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` 既定のレベルを適用します。 可能なレベル:\[1、12\]。 推奨レベル範囲:\[4、9\]。 +- `ZSTD[(level)]` — [ZSTD圧縮アルゴリズム](https://en.wikipedia.org/wiki/Zstandard) 構成可能を使って `level`. 可能なレベル:\[1、22\]。 デフォルト値:1。 + +圧縮レベルが高い場合は、圧縮回数、繰り返しの解凍などの非対称シナリオに役立ちます。 高いレベルは、より良い圧縮と高いcpu使用率を意味します。 + +## 一時テーブル {#temporary-tables} + +ClickHouseは次の特徴がある一時テーブルを支える: + +- 一時テーブルは、接続が失われた場合など、セッションが終了すると消えます。 +- 一時テーブルはメモリエンジンのみを使用します。 +- 一時テーブルにdbを指定することはできません。 データベースの外部で作成されます。 +- すべてのクラスタサーバー上に分散ddlクエリを使用して一時テーブルを作成することは不可能です `ON CLUSTER`):このテーブルは現在のセッションにのみ存在します。 +- テンポラリテーブルの名前が別のテーブルと同じ場合、クエリでdbを指定せずにテーブル名を指定すると、テンポラリテーブルが使用されます。 +- 分散クエリ処理では、クエリで使用される一時テーブルがリモートサーバーに渡されます。 + +一時テーブルを作成するには、次の構文を使用します: + +``` sql +CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) +``` + +ほとんどの場合、一時テーブルを手動で作成され、外部データを利用するためのクエリに対して、または配布 `(GLOBAL) IN`. 詳細は、該当するセクションを参照してください + +テーブルを使用することは可能です [エンジン=メモリ](../../engines/table-engines/special/memory.md) 一時テーブルの代わりに。 + +## 分散ddlクエリ(on cluster clause) {#distributed-ddl-queries-on-cluster-clause} + +その `CREATE`, `DROP`, `ALTER`、と `RENAME` クエリの支援の分散実行クラスター +たとえば、次のクエリを作成します `all_hits` `Distributed` 各ホストのテーブル `cluster`: + +``` sql +CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) +``` + +これらのクエリを正しく実行するには、各ホストが同じクラスタ定義を持っている必要があります(設定の同期を簡単にするために、zookeeperからの置換 彼らはまた、zookeeperサーバに接続する必要があります。 +クエリのローカルバージョンは、一部のホストが現在利用できない場合でも、最終的にクラスター内の各ホストに実装されます。 単一のホスト内でクエリを実行する順序は保証されます。 + +## CREATE VIEW {#create-view} + +``` sql +CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... +``` + +ビューを作成します。 通常とマテリアライズド:ビューの二つのタイプがあります。 + +通常のビューにはデータは保存されませんが、別のテーブルから読み取るだけです。 言い換えれば、通常のビューは、保存されたクエリに過ぎません。 ビューから読み取る場合、この保存されたクエリはfrom句のサブクエリとして使用されます。 + +たとえば、ビューを作成したとします: + +``` sql +CREATE VIEW view AS SELECT ... +``` + +とクエリを書かれた: + +``` sql +SELECT a, b, c FROM view +``` + +このクエリは、サブクエリの使用と完全に同じです: + +``` sql +SELECT a, b, c FROM (SELECT ...) +``` + +実現の景色でデータ変換に対応する選択を返します。 + +マテリアライズドビューを作成するとき `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. + +マテリアライズドビューを作成するとき `TO [db].[table]`、使用してはならない `POPULATE`. + +SELECTで指定されたテーブルにデータを挿入すると、挿入されたデータの一部がこのSELECTクエリによって変換され、結果がビューに挿入されます。 + +POPULATEを指定すると、作成時に既存のテーブルデータがビューに挿入されます。 `CREATE TABLE ... AS SELECT ...` . そうしないと、クエリーを含み、データを挿入し、表の作成後、作成した。 ビューの作成時にテーブルに挿入されたデータは挿入されないため、POPULATEを使用することはお勧めしません。 + +A `SELECT` クエ `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` が設定され、データは挿入中に集約されるが、挿入されたデータの単一パケット内にのみ存在する。 データはそれ以上集計されません。 例外は、次のようなデータの集計を個別に実行するエンジンを使用する場合です `SummingMergeTree`. + +の実行 `ALTER` クエリを実現眺めなが十分に整備されていないので、いかに不便です。 マテリアライズドビュ `TO [db.]name`、できます `DETACH` ビュー、実行 `ALTER` ターゲットテーブルの場合 `ATTACH` 以前に切り離さ (`DETACH`)ビュー。 + +ビューの外観は、通常のテーブルと同じです。 例えば、それらはの結果にリストされています `SHOW TABLES` クエリ。 + +ビューを削除するための別のクエリはありません。 ビューを削除するには `DROP TABLE`. + +## CREATE DICTIONARY {#create-dictionary-query} + +``` sql +CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] +( + key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + attr1 type2 [DEFAULT|EXPRESSION expr3], + attr2 type2 [DEFAULT|EXPRESSION expr4] +) +PRIMARY KEY key1, key2 +SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) +LAYOUT(LAYOUT_NAME([param_name param_value])) +LIFETIME([MIN val1] MAX val2) +``` + +作成 [外部辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) 与えられると [構造](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md), [ソース](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md), [レイアウト](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) と [寿命](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md). + +外部辞書構造の属性です。 ディクショナリ属性は、表の列と同様に指定します。 唯一の必須の属性は、そのタイプ、その他すべてのプロパティがデフォルト値がある。 + +辞書に応じて [レイアウト](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) 一つ以上の属性は、辞書キーとして指定することができます。 + +詳細については、 [外部辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) セクション。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/ja/sql_reference/statements/index.md b/docs/ja/sql-reference/statements/index.md similarity index 100% rename from docs/ja/sql_reference/statements/index.md rename to docs/ja/sql-reference/statements/index.md diff --git a/docs/ja/sql-reference/statements/insert-into.md b/docs/ja/sql-reference/statements/insert-into.md new file mode 100644 index 00000000000..aa08fe45b8a --- /dev/null +++ b/docs/ja/sql-reference/statements/insert-into.md @@ -0,0 +1,80 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 34 +toc_title: INSERT INTO +--- + +## INSERT {#insert} + +データの追加。 + +基本的なクエリ形式: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... +``` + +クエリでは、挿入する列のリストを指定できます `[(c1, c2, c3)]`. この場合、残りの列は次のように入力されます: + +- から計算された値 `DEFAULT` テーブル定義で指定された式。 +- ゼロと空の文字列の場合 `DEFAULT` 式は定義されていません。 + +もし [strict\_insert\_defaults=1](../../operations/settings/settings.md)、持っていない列 `DEFAULT` definedは、クエリに一覧表示する必要があります。 + +データは、任意の挿入物に渡すことができます [書式](../../interfaces/formats.md#formats) ClickHouseでサポートされている。 形式は、クエリで明示的に指定する必要があります: + +``` sql +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: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... +``` + +ClickHouseは、データの前にすべてのスペースと改行(存在する場合)を削除します。 クエリを作成するときは、クエリ演算子の後に新しい行にデータを置くことをお勧めします(データがスペースで始まる場合は重要です)。 + +例えば: + +``` sql +INSERT INTO t FORMAT TabSeparated +11 Hello, world! +22 Qwerty +``` + +挿入することができます。データから別のクエリのコマンドラインクライアント、httpインターフェース。 詳細については、以下を参照してください “[界面](../../interfaces/index.md#interfaces)”. + +### 制約 {#constraints} + +テーブルが [制約](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. + +### の結果を挿入する `SELECT` {#insert_query_insert-select} + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... +``` + +列は、select句内の位置に応じてマップされます。 ただし、select式とinsertのテーブルの名前は異なる場合があります。 必要に応じて、タイプ鋳造が行われる。 + +値以外のデータ形式では、次のような式に値を設定できません `now()`, `1 + 2`、というように。 この場合、非効率的なコードが実行に使用されるためです。 + +その他のクエリをデータ部品に対応していない: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. +ただし、次の方法で古いデータを削除できます `ALTER TABLE ... DROP PARTITION`. + +`FORMAT` 次の場合、クエリの最後に句を指定する必要があります `SELECT` テーブル関数を含む句 [入力()](../table-functions/input.md). + +### パフォーマン {#performance-considerations} + +`INSERT` 入力データを主キーでソートし、パーティションキーでパーティションに分割します。 た場合のデータを挿入し複数の仕切りは一度で大幅に低減できることの `INSERT` クエリ。 これを避けるには: + +- 一度に100,000行など、かなり大きなバッチでデータを追加します。 +- グループによるデータのパーティション鍵のアップロード前にでclickhouse. + +性能が減少することはありませんが: + +- データはリアルタイムで追加されます。 +- アップロードしたデータとは、通常はソートされました。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/ja/sql-reference/statements/misc.md b/docs/ja/sql-reference/statements/misc.md new file mode 100644 index 00000000000..eb8bed3df24 --- /dev/null +++ b/docs/ja/sql-reference/statements/misc.md @@ -0,0 +1,252 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 39 +toc_title: "\u305D\u306E\u4ED6" +--- + +# その他のクエリ {#miscellaneous-queries} + +## ATTACH {#attach} + +このクエリは `CREATE`、しかし + +- 単語の代わりに `CREATE` それは単語を使用します `ATTACH`. +- クエリはディスク上にデータを作成しませんが、データがすでに適切な場所にあるとみなし、テーブルに関する情報をサーバーに追加するだけです。 + 添付クエリを実行すると、サーバーはテーブルの存在を知ることになります。 + +テーブルが以前に分離されていた場合 (`DETACH`)、その構造が知られていることを意味し、構造を定義することなく省略形を使用することができます。 + +``` sql +ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] +``` + +このクエリは、サーバーの起動時に使用されます。 サーバーに店舗のテーブルメタデータとしてファイル `ATTACH` クエリは、起動時に実行されるだけです(サーバー上に明示的に作成されたシステムテーブルは例外です)。 + +## CHECK TABLE {#check-table} + +Trueの場合、ただちにパージを行うデータをテーブルが壊れる可能性があります。 + +``` sql +CHECK TABLE [db.]name +``` + +その `CHECK TABLE` queryは、実際のファイルサイズをサーバーに格納されている期待値と比較します。 ファイルサイズが格納された値と一致しない場合は、データが破損していることを意味します。 このが発生する可能性があります、例えば、システムがクラッシュ時のクエリを実行します。 + +のクエリーの応答を含む `result` 単一行の列。 行に値がのあります +[ブール値](../../sql-reference/data-types/boolean.md) タイプ: + +- 0-テーブル内のデータが破損しています。 +- 1-データは整合性を維持します。 + +その `CHECK TABLE` クエリは以下のテーブルエンジン: + +- [ログ](../../engines/table-engines/log-family/log.md) +- [TinyLog](../../engines/table-engines/log-family/tinylog.md) +- [ストリップログ](../../engines/table-engines/log-family/stripelog.md) +- [マージツリーファミリー](../../engines/table-engines/mergetree-family/mergetree.md) + +これは、テーブルが別のテーブルエンジンの原因となる例外です。 + +からのエンジン `*Log` 家族は失敗の自動データ回復を提供しない。 を使用 `CHECK TABLE` タイムリーにデータ損失を追跡するためのクエリ。 + +のために `MergeTree` 家族のエンジンは、 `CHECK TABLE` クエリを示すステータス確認のための個人データのテーブルに現地サーバーです。 + +**データが破損している場合** + +テーブルが破損している場合は、破損していないデータを別のテーブルにコピーできます。 これを行うには: + +1. 破損したテーブルと同じ構造の新しいテーブルを作成します。 このためクセスしてください `CREATE TABLE AS `. +2. セットを [max\_threads](../../operations/settings/settings.md#settings-max_threads) 単一のスレッドで次のクエリを処理するには、1の値を指定します。 これを行うにはクエリを実行します `SET max_threads = 1`. +3. クエリの実行 `INSERT INTO SELECT * FROM `. この要求にコピーする非破損データからの表-別表に示す。 破損した部分の前のデータのみがコピーされます。 +4. 再起動する `clickhouse-client` リセットするには `max_threads` 値。 + +## DESCRIBE TABLE {#misc-describe-table} + +``` sql +DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +以下を返します `String` タイプ列: + +- `name` — Column name. +- `type`— Column type. +- `default_type` — Clause that is used in [既定の式](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` または `ALIAS`). 既定の式が指定されていない場合、Columnには空の文字列が含まれます。 +- `default_expression` — Value specified in the `DEFAULT` 句。 +- `comment_expression` — Comment text. + +入れ子にされたデータ構造は “expanded” フォーマット。 各列は別々に表示され、名前はドットの後に続きます。 + +## DETACH {#detach} + +に関する情報を削除します。 ‘name’ サーバーからのテーブル。 サーバーはテーブルの存在を知ることをやめます。 + +``` sql +DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +テーブルのデータやメタデータは削除されません。 次のサーバーの起動時に、サーバーはメタデータを読み取り、再度テーブルについて調べます。 +同様に、 “detached” 表はを使用して再付けることができます `ATTACH` クエリ(メタデータが格納されていないシステムテーブルを除く)。 + +ありません `DETACH DATABASE` クエリ。 + +## DROP {#drop} + +このクエ: `DROP DATABASE` と `DROP TABLE`. + +``` sql +DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] +``` + +内部のすべてのテーブルを削除 ‘db’ データベース、その後削除 ‘db’ データベース自体。 +もし `IF EXISTS` データベースが存在しない場合、エラーは返されません。 + +``` sql +DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +テーブルを削除します。 +もし `IF EXISTS` テーブルが存在しない場合、またはデータベースが存在しない場合は、エラーを返しません。 + + DROP DICTIONARY [IF EXISTS] [db.]name + +辞書をdeletsします。 +もし `IF EXISTS` テーブルが存在しない場合、またはデータベースが存在しない場合は、エラーを返しません。 + +## EXISTS {#exists} + +``` sql +EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] +``` + +シングルを返します `UInt8`-単一の値を含むタイプの列 `0` テーブルまたはデータベースが存在しない場合、または `1` 指定されたデータベースにテーブルが存在する場合。 + +## KILL QUERY {#kill-query} + +``` sql +KILL QUERY [ON CLUSTER cluster] + WHERE + [SYNC|ASYNC|TEST] + [FORMAT format] +``` + +現在実行中のクエリを強制的に終了しようとします。 +終了するクエリは、システムから選択されます。プロセステーブルで定義された基準を使用して、 `WHERE` の句 `KILL` クエリ。 + +例: + +``` sql +-- Forcibly terminates all queries with the specified query_id: +KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' + +-- Synchronously terminates all queries run by 'username': +KILL QUERY WHERE user='username' SYNC +``` + +読み取り専用ユーザーは、自分のクエリのみを停止できます。 + +既定では、非同期バージョンのクエリが使用されます (`ASYNC`)、クエリが停止したことの確認を待つことはありません。 + +同期バージョン (`SYNC`)待機のためのすべての問い合わせに対応停止に関する情報を表示し各工程で停止します。 +応答には、 `kill_status` 次の値を取ることができる列: + +1. ‘finished’ – The query was terminated successfully. +2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. +3. The other values ​​explain why the query can’t be stopped. + +テストクエリ (`TEST`)ユーザーの権限のみをチェックし、停止するクエリのリストを表示します。 + +## KILL MUTATION {#kill-mutation} + +``` sql +KILL MUTATION [ON CLUSTER cluster] + WHERE + [TEST] + [FORMAT format] +``` + +キャンセルと削除を試みます [突然変異](alter.md#alter-mutations) これは現在実行中です。 取り消すべき突然変異はから選ばれます [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) テーブルのフィルタで指定された `WHERE` の句 `KILL` クエリ。 + +テストクエリ (`TEST`)ユーザーの権限のみをチェックし、停止するクエリのリストを表示します。 + +例: + +``` sql +-- Cancel and remove all mutations of the single table: +KILL MUTATION WHERE database = 'default' AND table = 'table' + +-- Cancel the specific mutation: +KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' +``` + +The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). + +突然変異によって既に行われた変更はロールバックされません。 + +## OPTIMIZE {#misc_operations-optimize} + +``` sql +OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] +``` + +このクエリを初期化予定外の統合データのパーツを使ったテーブルのテーブルエンジンからの [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) 家族 + +その `OPTMIZE` クエリもサポートされています [MaterializedView](../../engines/table-engines/special/materializedview.md) そして [バッファ](../../engines/table-engines/special/buffer.md) エンジン その他のテーブルエンジンなサポート。 + +とき `OPTIMIZE` とともに使用されます [レプリケートされたmergetree](../../engines/table-engines/mergetree-family/replication.md) テーブルエンジンのファミリ、ClickHouseはマージのためのタスクを作成し、すべてのノードでの実行を待ちます。 `replication_alter_partitions_sync` 設定が有効になっています)。 + +- もし `OPTIMIZE` 何らかの理由でマージを実行せず、クライアントに通知しません。 通知を有効にするには、以下を使用します [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) 設定。 +- を指定した場合 `PARTITION` 指定したパーティションのみが最適化されます。 [パーティション式の設定方法](alter.md#alter-how-to-specify-part-expr). +- 指定した場合 `FINAL`、最適化は、すべてのデータがすでに一つの部分にある場合でも行われる。 +- 指定した場合 `DEDUPLICATE`、その後、完全に同一の行が重複排除されます(すべての列が比較されます)、それだけでMergeTreeエンジンのために理にかなっています。 + +!!! warning "警告" + `OPTIMIZE` 修正できません “Too many parts” エラー。 + +## RENAME {#misc_operations-rename} + +テーブルの名前を変更します。 + +``` sql +RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] +``` + +すべてのテーブル名変更"グローバルチェンジにおけるロックしなければなりません。 テーブルの名前を変更するのは簡単な操作です。 場合は正しく表示す他のデータベースのテーブルに表示されるようになります。本データベースです。 しかし、そのディレクトリのデータベースに格納してある必要がある同一ファイルシステム(それ以外の場合、エラーを返す。 + +## SET {#query-set} + +``` sql +SET param = value +``` + +割り当て `value` に `param` [設定](../../operations/settings/index.md) 現在のセッションの場合。 変更はできません [サーバー設定](../../operations/server-configuration-parameters/index.md) こっちだ + +また、指定した設定プロファイルのすべての値を単一のクエリで設定することもできます。 + +``` sql +SET profile = 'profile-name-from-the-settings-file' +``` + +詳細については、 [設定](../../operations/settings/settings.md). + +## TRUNCATE {#truncate} + +``` sql +TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +表からすべてのデータを削除します。 ときに句 `IF EXISTS` テーブルが存在しない場合、クエリはエラーを返します。 + +その `TRUNCATE` queryはサポートされていません [ビュー](../../engines/table-engines/special/view.md), [ファイル](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md) と [ヌル](../../engines/table-engines/special/null.md) テーブルエンジン。 + +## USE {#use} + +``` sql +USE db +``` + +セッションの現在のデータベースを設定できます。 +現在のデータベース検索用テーブルの場合はデータベースが明示的に定義されたクエリードの前にテーブルの名前です。 +このクエリできません利用の場合は、httpプロトコルが存在しない概念です。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/ja/sql-reference/statements/select.md b/docs/ja/sql-reference/statements/select.md new file mode 100644 index 00000000000..ae18f50b1e0 --- /dev/null +++ b/docs/ja/sql-reference/statements/select.md @@ -0,0 +1,610 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 33 +toc_title: SELECT +--- + +# クエリ構文の選択 {#select-queries-syntax} + +`SELECT` データ検索を実行します。 + +``` sql +[WITH expr_list|(subquery)] +SELECT [DISTINCT] expr_list +[FROM [db.]table | (subquery) | table_function] [FINAL] +[SAMPLE sample_coeff] +[ARRAY JOIN ...] +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list +[PREWHERE expr] +[WHERE expr] +[GROUP BY expr_list] [WITH TOTALS] +[HAVING expr] +[ORDER BY expr_list] +[LIMIT [offset_value, ]n BY columns] +[LIMIT [n, ]m] +[UNION ALL ...] +[INTO OUTFILE filename] +[FORMAT format] +``` + +SELECT直後の必須の式リストを除き、すべての句はオプションです。 +以下の句は、クエリ実行コンベアとほぼ同じ順序で記述されています。 + +クエリが省略された場合、 `DISTINCT`, `GROUP BY` と `ORDER BY` 句および `IN` と `JOIN` サブクエリでは、クエリはO(1)量のRAMを使用して完全にストリーム処理されます。 +それ以外の場合、適切な制限が指定されていない場合、クエリは大量のramを消費する可能性があります: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. 詳細については、以下を参照してください “Settings”. 外部ソート(一時テーブルをディスクに保存する)と外部集約を使用することが可能です。 `The system does not have "merge join"`. + +### With句 {#with-clause} + +このセクション支援のための共通表現 ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL))、いくつかの制限があります: +1. 再帰的な問合せには対応していない +2. サブクエリがsection内で使用される場合、その結果は正確に一つの行を持つスカラーになります +3. 式の結果はサブクエリでは使用できません +WITH句の式の結果は、SELECT句の中で使用できます。 + +例1:定数式をasとして使用する “variable” + +``` sql +WITH '2019-08-01 15:23:00' as ts_upper_bound +SELECT * +FROM hits +WHERE + EventDate = toDate(ts_upper_bound) AND + EventTime <= ts_upper_bound +``` + +例2:select句の列リストからsum(bytes)式の結果を削除する + +``` sql +WITH sum(bytes) as s +SELECT + formatReadableSize(s), + table +FROM system.parts +GROUP BY table +ORDER BY s +``` + +例3:結果のスカラサブクエリ + +``` sql +/* this example would return TOP 10 of most huge tables */ +WITH + ( + SELECT sum(bytes) + FROM system.parts + WHERE active + ) AS total_disk_usage +SELECT + (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, + table +FROM system.parts +GROUP BY table +ORDER BY table_disk_usage DESC +LIMIT 10 +``` + +例4:サブクエリでの式の再利用 +サブクエリでの式の現在の使用制限の回避策として、複製することができます。 + +``` sql +WITH ['hello'] AS hello +SELECT + hello, + * +FROM +( + WITH ['hello'] AS hello + SELECT hello +) +``` + +``` text +┌─hello─────┬─hello─────┐ +│ ['hello'] │ ['hello'] │ +└───────────┴───────────┘ +``` + +### FROM句 {#select-from} + +FROM句が省略された場合、データは `system.one` テーブル。 +その `system.one` このテーブルは、他のDbmsで見つかったデュアルテーブルと同じ目的を果たします。 + +その `FROM` 句は、データを読み取るソースを指定します: + +- テーブル +- サブクエリ +- [テーブル機能](../table-functions/index.md) + +`ARRAY JOIN` そして、定期的に `JOIN` また、(下記参照)が含まれていてもよいです。 + +テーブルの代わりに、 `SELECT` サブクエリは、かっこで指定できます。 +標準sqlとは対照的に、サブクエリの後にシノニムを指定する必要はありません。 + +実行をクエリに対して、すべての列をクエリを取り出しに適します。 任意の列は不要のため、外部クエリはスローされ、サブクエリ. +クエリで列がリストされない場合(たとえば, `SELECT count() FROM t`)行の数を計算するために、いくつかの列がテーブルから抽出されます(最小の列が優先されます)。 + +#### 最終修飾子 {#select-from-final} + +が異なる場合は、それぞれの選定からデータをテーブルからの [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-エンジンファミリー以外 `GraphiteMergeTree`. とき `FINAL` 指定されている場合、ClickHouseは結果を返す前にデータを完全にマージするため、指定されたテーブルエンジンのマージ中に発生するすべてのデータ変換を実行し + +また、: +- [複製された](../../engines/table-engines/mergetree-family/replication.md) のバージョン `MergeTree` エンジン +- [ビュー](../../engines/table-engines/special/view.md), [バッファ](../../engines/table-engines/special/buffer.md), [分散](../../engines/table-engines/special/distributed.md)、と [MaterializedView](../../engines/table-engines/special/materializedview.md) 他のエンジンを操作するエンジンは、それらが上に作成された提供 `MergeTree`-エンジンテーブル。 + +使用するクエリ `FINAL` そうでない類似のクエリと同じくらい速く実行されません。: + +- クエリは単一のスレッドで実行され、クエリの実行中にデータがマージされます。 +- とのクエリ `FINAL` クエリで指定された列に加えて、主キー列を読み取ります。 + +ほとんどの場合、使用を避けます `FINAL`. + +### サンプル句 {#select-sample-clause} + +その `SAMPLE` 句は、近似クエリ処理を可能にします。 + +データサンプリングを有効にすると、すべてのデータに対してクエリは実行されず、特定のデータ(サンプル)に対してのみ実行されます。 たとえば、すべての訪問の統計を計算する必要がある場合は、すべての訪問の1/10分のクエリを実行し、その結果に10を掛けるだけで十分です。 + +近似クエリ処理は、次の場合に役立ちます: + +- 厳密なタイミング要件(\<100ms)がありますが、それらを満たすために追加のハードウェアリソースのコストを正当化できない場合。 +- 生データが正確でない場合、近似は品質を著しく低下させません。 +- ビジネス要件は、おおよその結果(費用対効果のため、または正確な結果をプレミアムユーザーに販売するため)を対象とします。 + +!!! note "メモ" + サンプリングを使用できるのは、次の表のみです [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) テーブル作成時にサンプリング式が指定された場合にのみ [MergeTreeエンジン](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table)). + +データサンプリングの機能を以下に示します: + +- データサンプリングは確定的なメカニズムです。 同じの結果 `SELECT .. SAMPLE` クエリは常に同じです。 +- サンプリン テーブルに単一のサンプリングキーは、サンプルと同じ係数を常に選択と同じサブセットのデータです。 たとえば、ユーザー idのサンプルでは、異なるテーブルのすべてのユーザー idのサブセットが同じ行になります。 これは、サブクエリでサンプルを使用できることを意味します [IN](#select-in-operators) 句。 また、以下を使用してサンプルを結合できます [JOIN](#select-join) 句。 +- サンプリングで読み下からのデータディスク。 サンプリングキーを正しく指定する必要があります。 詳細については、 [MergeTreeテーブルの作成](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). + +のための `SAMPLE` 句次の構文がサポートされています: + +| SAMPLE Clause Syntax | 説明 | +|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `SAMPLE k` | ここに `k` 0から1までの数値です。
クエリが実行される `k` データの割合。 例えば, `SAMPLE 0.1` データの10%に対してクエリを実行します。 [もっと読む](#select-sample-k) | +| `SAMPLE n` | ここに `n` は十分に大きい整数です。
クエリは、少なくとものサンプルで実行されます `n` 行(しかし、これ以上のものではない)。 例えば, `SAMPLE 10000000` 最小10,000,000行に対してクエリを実行します。 [もっと読む](#select-sample-n) | +| `SAMPLE k OFFSET m` | ここに `k` と `m` 0から1までの数字です。
クエリは次のサンプルで実行されます `k` データの割合。 に使用されるデータのサンプルと相殺することにより `m` 分数。 [もっと読む](#select-sample-offset) | + +#### SAMPLE K {#select-sample-k} + +ここに `k` は0から1までの数値です(小数表記と小数表記の両方がサポートされています)。 例えば, `SAMPLE 1/2` または `SAMPLE 0.5`. + +で `SAMPLE k` 句は、サンプルから取られます `k` データの割合。 例を以下に示します: + +``` sql +SELECT + Title, + count() * 10 AS PageViews +FROM hits_distributed +SAMPLE 0.1 +WHERE + CounterID = 34 +GROUP BY Title +ORDER BY PageViews DESC LIMIT 1000 +``` + +この例では、0.1(10%)のデータのサンプルでクエリが実行されます。 集計関数の値は自動的には修正されないので、おおよその結果を得るには値 `count()` 手動で10倍します。 + +#### SAMPLE N {#select-sample-n} + +ここに `n` は十分に大きい整数です。 例えば, `SAMPLE 10000000`. + +この場合、クエリは少なくともサンプルで実行されます `n` 行(しかし、これ以上のものではない)。 例えば, `SAMPLE 10000000` 最小10,000,000行に対してクエリを実行します。 + +データ読み取りのための最小単位は一つの顆粒であるため(そのサイズは `index_granularity` それは、顆粒のサイズよりもはるかに大きいサンプルを設定することは理にかなっています。 + +を使用する場合 `SAMPLE n` 句、データの相対パーセントが処理されたかわからない。 したがって、集計関数に掛ける係数はわかりません。 を使用 `_sample_factor` おおよその結果を得るための仮想列。 + +その `_sample_factor` 列には、動的に計算される相対係数が含まれます。 この列は、次の場合に自動的に作成されます [作成](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table) 指定したサンプリングキーを持つテーブル。 の使用例 `_sample_factor` 列は以下の通りです。 + +テーブルを考えてみましょう `visits` これには、サイト訪問に関する統計情報が含まれます。 最初の例は、ページビューの数を計算する方法を示しています: + +``` sql +SELECT sum(PageViews * _sample_factor) +FROM visits +SAMPLE 10000000 +``` + +次の例では、訪問回数の合計を計算する方法を示します: + +``` sql +SELECT sum(_sample_factor) +FROM visits +SAMPLE 10000000 +``` + +以下の例は、平均セッション期間を計算する方法を示しています。 相対係数を使用して平均値を計算する必要はありません。 + +``` sql +SELECT avg(Duration) +FROM visits +SAMPLE 10000000 +``` + +#### SAMPLE K OFFSET M {#select-sample-offset} + +ここに `k` と `m` は0から1までの数字です。 例を以下に示す。 + +**例1** + +``` sql +SAMPLE 1/10 +``` + +この例では、サンプルはすべてのデータの1/10thです: + +`[++------------]` + +**例2** + +``` sql +SAMPLE 1/10 OFFSET 1/2 +``` + +ここでは、データの後半から10%のサンプルを採取します。 + +`[------++------]` + +### 配列結合句 {#select-array-join-clause} + +実行を許可する `JOIN` 配列または入れ子になったデータ構造。 その意図は、 [arrayJoin](../../sql-reference/functions/array-join.md#functions_arrayjoin) 機能が、その機能はより広いです。 + +``` sql +SELECT +FROM +[LEFT] ARRAY JOIN +[WHERE|PREWHERE ] +... +``` + +単一のみを指定できます `ARRAY JOIN` クエリ内の句。 + +実行時にクエリの実行順序が最適化されます `ARRAY JOIN`. が `ARRAY JOIN` の前に必ず指定する必要があります。 `WHERE/PREWHERE` のいずれかを実行することができます。 `WHERE/PREWHERE` (結果がこの節で必要な場合)、またはそれを完了した後(計算量を減らすため)。 処理順序はクエリオプティマイザによって制御されます。 + +サポートされる種類の `ARRAY JOIN` は以下の通りです: + +- `ARRAY JOIN` -この場合、空の配列は結果に含まれません `JOIN`. +- `LEFT ARRAY JOIN` -結果の `JOIN` 空の配列を含む行を含みます。 空の配列の値は、配列要素タイプのデフォルト値に設定されます(通常は0、空の文字列またはNULL)。 + +以下の例は、以下の使用例を示しています。 `ARRAY JOIN` と `LEFT ARRAY JOIN` 句。 テーブルを作成してみましょう [配列](../../sql-reference/data-types/array.md) 列を入力して値を挿入します: + +``` sql +CREATE TABLE arrays_test +( + s String, + arr Array(UInt8) +) ENGINE = Memory; + +INSERT INTO arrays_test +VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); +``` + +``` text +┌─s───────────┬─arr─────┐ +│ Hello │ [1,2] │ +│ World │ [3,4,5] │ +│ Goodbye │ [] │ +└─────────────┴─────────┘ +``` + +以下の例では、 `ARRAY JOIN` 句: + +``` sql +SELECT s, arr +FROM arrays_test +ARRAY JOIN arr; +``` + +``` text +┌─s─────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +└───────┴─────┘ +``` + +次の例では、 `LEFT ARRAY JOIN` 句: + +``` sql +SELECT s, arr +FROM arrays_test +LEFT ARRAY JOIN arr; +``` + +``` text +┌─s───────────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +│ Goodbye │ 0 │ +└─────────────┴─────┘ +``` + +#### エイリアスの使用 {#using-aliases} + +配列のエイリアスを指定することができます。 `ARRAY JOIN` 句。 この場合、配列項目はこのエイリアスでアクセスできますが、配列自体は元の名前でアクセスされます。 例えば: + +``` sql +SELECT s, arr, a +FROM arrays_test +ARRAY JOIN arr AS a; +``` + +``` text +┌─s─────┬─arr─────┬─a─┐ +│ Hello │ [1,2] │ 1 │ +│ Hello │ [1,2] │ 2 │ +│ World │ [3,4,5] │ 3 │ +│ World │ [3,4,5] │ 4 │ +│ World │ [3,4,5] │ 5 │ +└───────┴─────────┴───┘ +``` + +別名を使用すると、次の操作を実行できます `ARRAY JOIN` 外部配列を使用する。 例えば: + +``` sql +SELECT s, arr_external +FROM arrays_test +ARRAY JOIN [1, 2, 3] AS arr_external; +``` + +``` text +┌─s───────────┬─arr_external─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ Hello │ 3 │ +│ World │ 1 │ +│ World │ 2 │ +│ World │ 3 │ +│ Goodbye │ 1 │ +│ Goodbye │ 2 │ +│ Goodbye │ 3 │ +└─────────────┴──────────────┘ +``` + +複数の配列をコンマで区切ることができます。 `ARRAY JOIN` 句。 この場合, `JOIN` それらと同時に実行されます(直積ではなく、直積)。 すべての配列は同じサイズでなければなりません。 例えば: + +``` sql +SELECT s, arr, a, num, mapped +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ +│ Hello │ [1,2] │ 1 │ 1 │ 2 │ +│ Hello │ [1,2] │ 2 │ 2 │ 3 │ +│ World │ [3,4,5] │ 3 │ 1 │ 4 │ +│ World │ [3,4,5] │ 4 │ 2 │ 5 │ +│ World │ [3,4,5] │ 5 │ 3 │ 6 │ +└───────┴─────────┴───┴─────┴────────┘ +``` + +以下の例では、 [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) 機能: + +``` sql +SELECT s, arr, a, num, arrayEnumerate(arr) +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ +│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ +│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ +│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ +│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ +│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ +└───────┴─────────┴───┴─────┴─────────────────────┘ +``` + +#### 配列の参加入れ子データ構造 {#array-join-with-nested-data-structure} + +`ARRAY`また、“参加”で動作します [入れ子のデータ構造](../../sql-reference/data-types/nested-data-structures/nested.md). 例えば: + +``` sql +CREATE TABLE nested_test +( + s String, + nest Nested( + x UInt8, + y UInt32) +) ENGINE = Memory; + +INSERT INTO nested_test +VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); +``` + +``` text +┌─s───────┬─nest.x──┬─nest.y─────┐ +│ Hello │ [1,2] │ [10,20] │ +│ World │ [3,4,5] │ [30,40,50] │ +│ Goodbye │ [] │ [] │ +└─────────┴─────────┴────────────┘ +``` + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +ネストされたデータ構造の名前を指定する場合 `ARRAY JOIN`、意味は同じです `ARRAY JOIN` それが構成されているすべての配列要素。 例を以下に示します: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`, `nest.y`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +この変化はまた意味を成している: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─────┐ +│ Hello │ 1 │ [10,20] │ +│ Hello │ 2 │ [10,20] │ +│ World │ 3 │ [30,40,50] │ +│ World │ 4 │ [30,40,50] │ +│ World │ 5 │ [30,40,50] │ +└───────┴────────┴────────────┘ +``` + +エイリアスは、ネストされたデータ構造のために使用することができます。 `JOIN` 結果またはソース配列。 例えば: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest AS n; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ +└───────┴─────┴─────┴─────────┴────────────┘ +``` + +使用例 [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) 機能: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num +FROM nested_test +ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ +└───────┴─────┴─────┴─────────┴────────────┴─────┘ +``` + +### JOIN句 {#select-join} + +通常のデータを結合します [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) センス + +!!! info "メモ" + 関連しない [ARRAY JOIN](#select-array-join-clause). + +``` sql +SELECT +FROM +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN +(ON )|(USING ) ... +``` + +テーブル名は次の代わりに指定できます `` と ``. これは、 `SELECT * FROM table` サブクエリは、テーブルが次のものを持つ特殊な場合を除きます。 [参加](../../engines/table-engines/special/join.md) engine – an array prepared for joining. + +#### サポートされる種類の `JOIN` {#select-join-types} + +- `INNER JOIN` (または `JOIN`) +- `LEFT JOIN` (または `LEFT OUTER JOIN`) +- `RIGHT JOIN` (または `RIGHT OUTER JOIN`) +- `FULL JOIN` (または `FULL OUTER JOIN`) +- `CROSS JOIN` (または `,` ) + +標準を参照してください [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) 説明。 + +#### 複数の結合 {#multiple-join} + +クエリを実行すると、clickhouseはマルチテーブル結合を二つのテーブル結合のシーケンスに書き換えます。 たとえば、clickhouseに参加するための四つのテーブルがある場合は、最初と二番目のテーブルを結合し、その結果を三番目のテーブルに結合し、最後のステップで + +クエリが含まれている場合、 `WHERE` 句、ClickHouseはこの句から中間結合を介してプッシュダウンフィルターを試行します。 各中間結合にフィルタを適用できない場合、ClickHouseはすべての結合が完了した後にフィルタを適用します。 + +私たちはお勧め `JOIN ON` または `JOIN USING` クエリを作成するための構文。 例えば: + +``` sql +SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a +``` + +テーブルのコンマ区切りリストを使用することができます `FROM` 句。 例えば: + +``` sql +SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a +``` + +これらの構文を混在させないでください。 + +ClickHouseはカンマで構文を直接サポートしていないので、使用することはお勧めしません。 このアルゴ `CROSS JOIN` と `INNER JOIN` クエリ処理に進みます。 クエリを書き換えるとき、ClickHouseはパフォーマンスとメモリ消費の最適化を試みます。 デフォルトでは、ClickHouseはコンマを `INNER JOIN` 句と変換 `INNER JOIN` に `CROSS JOIN` アルゴリズムが保証できない場合 `INNER JOIN` 必要なデータを返します。 + +#### 厳密さ {#select-join-strictness} + +- `ALL` — If the right table has several matching rows, ClickHouse creates a [デカルト積](https://en.wikipedia.org/wiki/Cartesian_product) 一致する行から。 これが標準です `JOIN` SQLでの動作。 +- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` と `ALL` キーワードは同じです。 +- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` 以下に使用方法を説明します。 + +**ASOF結合の使用** + +`ASOF JOIN` 完全一致のないレコードを結合する必要がある場合に便利です。 + +テーブルのため `ASOF JOIN` 順序列の列を持つ必要があります。 この列はテーブル内で単独で使用することはできません。: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`、と `DateTime`. + +構文 `ASOF JOIN ... ON`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF LEFT JOIN table_2 +ON equi_cond AND closest_match_cond +``` + +任意の数の等価条件と正確に最も近い一致条件を使用できます。 例えば, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. + +最も近い一致でサポートされる条件: `>`, `>=`, `<`, `<=`. + +構文 `ASOF JOIN ... USING`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF JOIN table_2 +USING (equi_column1, ... equi_columnN, asof_column) +``` + +`ASOF JOIN` 使用 `equi_columnX` 平等に参加するための `asof_column` との最も近い試合に参加するための `table_1.asof_column >= table_2.asof_column` 条件。 その `asof_column` 列は常に最後の列です `USING` 句。 + +たとえば、次の表を考えてみます: + +’テキスト +テーブル1テーブル2 + +イベント/ev\_time\|user\_idイベント/ev\_time\|user\_id diff --git a/docs/ja/sql-reference/statements/show.md b/docs/ja/sql-reference/statements/show.md new file mode 100644 index 00000000000..32d25a2c691 --- /dev/null +++ b/docs/ja/sql-reference/statements/show.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 38 +toc_title: SHOW +--- + +# クエリを表示 {#show-queries} + +## SHOW CREATE TABLE {#show-create-table} + +``` sql +SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +シングルを返します `String`-タイプ ‘statement’ column, which contains a single value – the `CREATE` 指定したオブジェク + +## SHOW DATABASES {#show-databases} + +``` sql +SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] +``` + +一覧の全てのデータベースです。 +このクエリは次と同じです `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. + +## SHOW PROCESSLIST {#show-processlist} + +``` sql +SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] +``` + +の内容を出力します [システム。プロセス](../../operations/system-tables.md#system_tables-processes) 現在処理中のクエリのリストを含むテーブル。 `SHOW PROCESSLIST` クエリ。 + +その `SELECT * FROM system.processes` クエリを返しますデータに現在のすべてのクエリ. + +ヒント(コンソールで実行): + +``` bash +$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" +``` + +## SHOW TABLES {#show-tables} + +テーブルのリストを表示します。 + +``` sql +SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +この `FROM` 句が指定されていない場合、クエリは現在のデータベースからテーブルの一覧を返します。 + +あなたは同じ結果を得ることができます `SHOW TABLES` 次の方法でクエリ: + +``` sql +SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**例えば** + +次のクエリは、テーブルのリストから最初の二つの行を選択します。 `system` 名前に含まれるデータベース `co`. + +``` sql +SHOW TABLES FROM system LIKE '%co%' LIMIT 2 +``` + +``` text +┌─name───────────────────────────┐ +│ aggregate_function_combinators │ +│ collations │ +└────────────────────────────────┘ +``` + +## SHOW DICTIONARIES {#show-dictionaries} + +リストをの表示します [外部辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +``` sql +SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +この `FROM` 句が指定されていない場合、クエリは現在のデータベースから辞書のリストを返します。 + +あなたは同じ結果を得ることができます `SHOW DICTIONARIES` 次の方法でクエリ: + +``` sql +SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**例えば** + +次のクエリは、テーブルのリストから最初の二つの行を選択します。 `system` 名前に含まれるデータベース `reg`. + +``` sql +SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 +``` + +``` text +┌─name─────────┐ +│ regions │ +│ region_names │ +└──────────────┘ +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/ja/sql-reference/statements/system.md b/docs/ja/sql-reference/statements/system.md new file mode 100644 index 00000000000..85f03de7190 --- /dev/null +++ b/docs/ja/sql-reference/statements/system.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: SYSTEM +--- + +# システムクエリ {#query-language-system} + +- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) +- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) +- [DROP DNS CACHE](#query_language-system-drop-dns-cache) +- [DROP MARK CACHE](#query_language-system-drop-mark-cache) +- [FLUSH LOGS](#query_language-system-flush_logs) +- [RELOAD CONFIG](#query_language-system-reload-config) +- [SHUTDOWN](#query_language-system-shutdown) +- [KILL](#query_language-system-kill) +- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) +- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) +- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) +- [STOP MERGES](#query_language-system-stop-merges) +- [START MERGES](#query_language-system-start-merges) + +## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} + +前に正常に読み込まれたすべての辞書を再読み込みします。 +デフォルトでは、辞書を取り込みの遅延を参照 [dictionaries\_lazy\_load](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load))、起動時に自動的にロードされるのではなく、dictGet関数を使用して最初のアクセス時に初期化されるか、ENGINE=Dictionaryテーブルから選択されます。 その `SYSTEM RELOAD DICTIONARIES` クエバなどの辞書(ロード). +常に戻る `Ok.` 辞書の更新の結果にかかわらず。 + +## 辞書dictionary\_nameを再読み込み {#query_language-system-reload-dictionary} + +辞書を完全に再読み込みする `dictionary_name` 辞書の状態にかかわらず(LOADED/NOT\_LOADED/FAILED)。 +常に戻る `Ok.` 辞書を更新した結果にかかわらず。 +ディクショナリのステータスは以下のクエリで確認できます。 `system.dictionaries` テーブル。 + +``` sql +SELECT name, status FROM system.dictionaries; +``` + +## DROP DNS CACHE {#query_language-system-drop-dns-cache} + +ClickHouseの内部DNSキャッシュをリセットします。 場合によっては(古いClickHouseバージョンの場合)、インフラストラクチャを変更するとき(別のClickHouseサーバーのIPアドレスまたは辞書で使用されるサーバーを変更する + +より便利な(自動)キャッシュ管理については、“disable\_internal\_dns\_cache,dns\_cache\_update\_periodパラメータ”を参照してください。 + +## DROP MARK CACHE {#query_language-system-drop-mark-cache} + +リセットをマークします。 clickhouseおよび性能試験の開発で使用される。 + +## FLUSH LOGS {#query_language-system-flush_logs} + +Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. + +## RELOAD CONFIG {#query_language-system-reload-config} + +ClickHouse構成を再読み込みします。 設定がZooKeeeperに格納されている場合に使用されます。 + +## SHUTDOWN {#query_language-system-shutdown} + +通常シャットダウンclickhouse(のような `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) + +## KILL {#query_language-system-kill} + +異常終了しclickhouse工程など `kill -9 {$ pid_clickhouse-server}`) + +## 分散テーブルの管理 {#query-language-system-distributed} + +ClickHouse管理 [分散](../../engines/table-engines/special/distributed.md) テーブル。 ユーザーがこれらのテーブルにデータを挿入すると、ClickHouseはまずクラスターノードに送信するデータのキューを作成し、次に非同期に送信します。 キューの処理を管理することができます [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed)、と [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) クエリ。 また、分散データを同期的に挿入することもできます。 `insert_distributed_sync` 設定。 + +### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} + +を無効にした背景データの分布を挿入する際、データを配布します。 + +``` sql +SYSTEM STOP DISTRIBUTED SENDS [db.] +``` + +### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} + +クラスタノードにデータを同期送信するようにclickhouseを強制します。 ノードが使用できない場合、clickhouseは例外をスローし、クエリの実行を停止します。 これは、すべてのノードがオンラインに戻ったときに発生します。 + +``` sql +SYSTEM FLUSH DISTRIBUTED [db.] +``` + +### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} + +を背景データの分布を挿入する際、データを配布します。 + +``` sql +SYSTEM START DISTRIBUTED SENDS [db.] +``` + +### STOP MERGES {#query_language-system-stop-merges} + +提供可能停止を背景に合併したテーブルのmergetree家族: + +``` sql +SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +``` + +!!! note "メモ" + `DETACH / ATTACH` テーブルは、以前にすべてのMergeTreeテーブルのマージが停止された場合でも、テーブルのバックグラウンドマージを開始します。 + +### START MERGES {#query_language-system-start-merges} + +の提供が開始背景に合併したテーブルのmergetree家族: + +``` sql +SYSTEM START MERGES [[db.]merge_tree_family_table_name] +``` + +[元の記事](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/ja/sql-reference/syntax.md b/docs/ja/sql-reference/syntax.md new file mode 100644 index 00000000000..006e7ed87c9 --- /dev/null +++ b/docs/ja/sql-reference/syntax.md @@ -0,0 +1,187 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 31 +toc_title: "\u69CB\u6587" +--- + +# 構文 {#syntax} + +システムには、完全なsqlパーサー(再帰的降下パーサー)とデータフォーマットパーサー(高速ストリームパーサー)の二種類のパーサーがあります。 +を除くすべての場合において `INSERT` クエリでは、完全なSQLパーサーのみが使用されます。 +その `INSERT` クエリの両方を使用のパーサ: + +``` sql +INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') +``` + +その `INSERT INTO t VALUES` フラグメントは完全なパーサーとデータによって解析されます `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` 高速ストリームパーサーによって解析されます。 データの完全なパーサーをオンにするには、次のコマンドを使用します [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) 設定。 とき `input_format_values_interpret_expressions = 1`、ClickHouseは最初に高速ストリームパーサーで値を解析しようとします。 失敗した場合、ClickHouseはデータの完全なパーサーを使用し、SQLのように扱います [式](#syntax-expressions). + +データには任意の形式を使用できます。 クエリが受信されると、サーバーは以下を計算します [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) RAM内の要求のバイト(デフォルトでは1MB)、残りはストリーム解析されます。 +これはシステムに大きいの問題がないことを意味します `INSERT` MySQLのようなクエリ。 + +を使用する場合 `Values` フォーマット `INSERT` クエリは、データがaの式と同じように解析されるように見えるかもしれません `SELECT` クエリが、これは真実ではありません。 その `Values` 形式は、はるかに限られています。 + +次に、完全なパーサーをカバーします。 情報の形式のパーサは、 [形式](../interfaces/formats.md) セクション。 + +## スペース {#spaces} + +構文構成(クエリの開始と終了を含む)の間には、任意の数のスペースシンボルが存在する可能性があります。 スペースシンボルには、スペース、タブ、改行、cr、フォームフィードがあります。 + +## コメント {#comments} + +SQL形式およびC形式のコメントがサポートされています。 +SQLスタイルのコメント:from `--` ラインの終わりまで。 後のスペース `--` 省略可能です。 +Cスタイルのコメント:from `/*` に `*/`. これらのコメントは複数行にできます。 ここでもスペースは必要ありません。 + +## キーワード {#syntax-keywords} + +キーワードが対応する場合、大文字と小文字は区別されません: + +- SQL標準。 例えば, `SELECT`, `select` と `SeLeCt` すべて有効です。 +- いくつかの一般的なdbms(mysqlまたはpostgres)での実装。 例えば, `DateTime` は同じとして `datetime`. + +データ型名が大文字小文字を区別するかどうかをチェックできます。 `system.data_type_families` テーブル。 + +標準sqlとは対照的に、他のすべてのキーワード(関数名を含む)は **大文字と小文字を区別する**. + +キーワードはこの数は予約されていません(そうとして構文解析キーワードに対応するコンテキスト. 使用する場合 [識別子](#syntax-identifiers) キーワードと同じで、引用符で囲みます。 たとえば、クエリ `SELECT "FROM" FROM table_name` テーブルの場合は有効です。 `table_name` 名前の列があります `"FROM"`. + +## 識別子 {#syntax-identifiers} + +識別子は: + +- クラスターデータベース、テーブル、パーティションおよびカラム名になってしまいます +- 機能。 +- データ型。 +- [式の別名](#syntax-expression_aliases). + +識別子は、引用符または非引用することができます。 非引用符付き識別子を使用することをお勧めします。 + +非引用識別子に一致しなければならなregex `^[a-zA-Z_][0-9a-zA-Z_]*$` とに等しくすることはできません [キーワード](#syntax-keywords). 例: `x, _1, X_y__Z123_.` + +キーワードと同じ識別子を使用する場合、または識別子に他の記号を使用する場合は、二重引用符またはバッククォートを使用して引用符を引用します。, `"id"`, `` `id` ``. + +## リテラル {#literals} + +以下があります:数値、文字列、複合および `NULL` リテラル + +### 数値 {#numeric} + +数値リテラルは解析を試みます: + +- 最初に64ビットの符号付き数値として、 [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) 機能。 +- 失敗した場合、64ビット符号なしの数値として、 [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) 機能。 +- 失敗した場合は、浮動小数点数として [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) 機能。 +- それ以外の場合は、エラーが返されます。 + +対応する値は、値が収まる最小の型を持ちます。 +たとえば、1は次のように解析されます `UInt8` しかし、256は次のように解析されます `UInt16`. 詳細については、 [データ型](../sql-reference/data-types/index.md). + +例: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. + +### 文字列 {#syntax-string-literal} + +単一引quotesの文字列リテラルのみがサポートされます。 囲まれた文字はバックスラッシュでエスケープできます。 以下のエスケープシーケンスに対応する特殊な値: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. 他のすべての場合において、エスケープシーケンスの形式 `\c`、どこ `c` は任意の文字です。 `c`. つまり、次のシーケンスを使用できます `\'`と`\\`. この値は、 [文字列](../sql-reference/data-types/string.md) タイプ。 + +文字列リテラルでエスケープする必要がある文字の最小セット: `'` と `\`. 単一引quoteは、単一引quoteでエスケープすることができます。 `'It\'s'` と `'It''s'` 等しい。 + +### 化合物 {#compound} + +配列では構文がサポートされます: `[1, 2, 3]` とタプル: `(1, 'Hello, world!', 2)`.. +実際には、これらはリテラルではなく、配列作成演算子とタプル作成演算子を持つ式です。 +配列によって構成された少なくとも一つの項目には、タプル以上あることが必要です。石二鳥の優れものだ。 +タプルに使用のための特別な目的があります `IN` aの句 `SELECT` クエリ。 タプルはクエリの結果として取得できますが、データベースに保存することはできません(ただし、 [メモリ](../engines/table-engines/special/memory.md) テーブル)。 + +### NULL {#null-literal} + +値が欠落していることを示します。 + +を格納するために `NULL` テーブルフィールドでは、テーブルフィールド [Nullable](../sql-reference/data-types/nullable.md) タイプ。 + +データ形式(入力または出力)に応じて), `NULL` 異なる表現を持つことがあります。 詳細については、以下の文書を参照してください [データ形式](../interfaces/formats.md#formats). + +処理には多くの微妙な違いがあります `NULL`. たとえば、比較操作の引数のうちの少なくとも一つが `NULL` この操作の結果も次のようになります `NULL`. 乗算、加算、およびその他の演算についても同様です。 詳細については、各操作のドキュメントを参照してください。 + +クエリでは、以下を確認できます `NULL` を使用して [IS NULL](operators.md#operator-is-null) と [IS NOT NULL](operators.md) 演算子と関連する関数 `isNull` と `isNotNull`. + +## 機能 {#functions} + +関数は、括弧内の引数のリスト(おそらく空)を持つ識別子のように書かれています。 標準sqlとは対照的に、空の引数リストであっても括弧が必要です。 例えば: `now()`. +通常の関数と集計関数があります(セクションを参照 “Aggregate functions”). 一部の集計関数を含むことができ二つのリストの引数ットに固定して使用します。 例えば: `quantile (0.9) (x)`. これらの集計関数が呼び出される “parametric” 関数と最初のリストの引数が呼び出されます “parameters”. パラメータを指定しない集計関数の構文は、通常の関数と同じです。 + +## 演算子 {#operators} + +演算子は、優先度と結合性を考慮して、クエリの解析中に対応する関数に変換されます。 +たとえば、次の式 `1 + 2 * 3 + 4` に変換される。 `plus(plus(1, multiply(2, 3)), 4)`. + +## データ型とデータベ {#data_types-and-database-table-engines} + +のデータ型とテーブルエンジン `CREATE` クエリは、識別子または関数と同じ方法で記述されます。 言い換えれば、それらは括弧内に引数リストを含んでいてもいなくてもよい。 詳細については、以下を参照してください “Data types,” “Table engines,” と “CREATE”. + +## 式の別名 {#syntax-expression_aliases} + +別名は、クエリ内の式のユーザー定義名です。 + +``` sql +expr AS alias +``` + +- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` 使用しない句 `AS` キーワード。 + + For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. + + In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. + +- `expr` — Any expression supported by ClickHouse. + + For example, `SELECT column_name * 2 AS double FROM some_table`. + +- `alias` — Name for `expr`. エイリアスはに従うべきです [識別子](#syntax-identifiers) 構文。 + + For example, `SELECT "table t".column_name FROM table_name AS "table t"`. + +### 使用上の注意 {#notes-on-usage} + +エイリアスは、クエリまたはサブクエリのグローバルであり、任意の式のクエリの任意の部分にエイリアスを定義できます。 例えば, `SELECT (1 AS n) + 2, n`. + +エイリアスは、サブクエリやサブクエリ間では表示されません。 たとえば、クエリの実行中などです `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouseは例外を生成します `Unknown identifier: num`. + +結果列に別名が定義されている場合 `SELECT` サブクエリの句は、これらの列は、外側のクエリで表示されます。 例えば, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. + +列名またはテーブル名と同じ別名には注意してください。 次の例を考えてみましょう: + +``` sql +CREATE TABLE t +( + a Int, + b Int +) +ENGINE = TinyLog() +``` + +``` sql +SELECT + argMax(a, b), + sum(b) AS b +FROM t +``` + +``` text +Received exception from server (version 18.14.17): +Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. +``` + +この例では、テーブルを宣言しました `t` コラムを使って `b`. 次に、データを選択するときに、 `sum(b) AS b` エイリアス としてエイリアスは、グローバルClickHouse置換されているリテラル `b` 式の中で `argMax(a, b)` 式を使って `sum(b)`. この置換によって例外が発生しました。 + +## アスタリスク {#asterisk} + +で `SELECT` クエリー、アスタリスクで置き換え異なるアイコンで表示されます。 詳細については、以下を参照してください “SELECT”. + +## 式 {#syntax-expressions} + +式は、関数、識別子、リテラル、演算子の適用、角かっこ内の式、サブクエリ、またはアスタリスクです。 別名を含めることもできます。 +式のリストは、コンマで区切られた式です。 +関数と演算子は、次に、引数として式を持つことができます。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/ja/sql-reference/table-functions/file.md b/docs/ja/sql-reference/table-functions/file.md new file mode 100644 index 00000000000..b1dca60b37e --- /dev/null +++ b/docs/ja/sql-reference/table-functions/file.md @@ -0,0 +1,121 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 37 +toc_title: "\u30D5\u30A1\u30A4\u30EB" +--- + +# ファイル {#file} + +ファイルからテーブルを作成します。 この表関数は次のようになります [url](url.md) と [hdfs](hdfs.md) もの。 + +``` sql +file(path, format, structure) +``` + +**入力パラメータ** + +- `path` — The relative path to the file from [user\_files\_path](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_files_path). 読み取り専用モードのglobsに続くファイルサポートのパス: `*`, `?`, `{abc,def}` と `{N..M}` どこに `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [書式](../../interfaces/formats.md#formats) ファイルの +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**戻り値** + +指定したファイルにデータを読み書きするための、指定した構造体を持つテーブル。 + +**例えば** + +設定 `user_files_path` そして、ファイルの内容 `test.csv`: + +``` bash +$ grep user_files_path /etc/clickhouse-server/config.xml + /var/lib/clickhouse/user_files/ + +$ cat /var/lib/clickhouse/user_files/test.csv + 1,2,3 + 3,2,1 + 78,43,45 +``` + +テーブルから`test.csv` そしてそれからの最初の二つの行の選択: + +``` sql +SELECT * +FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +``` sql +-- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file +SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 +``` + +**パス内のグロブ** + +複数のパスコンポーネン 処理されるためには、ファイルが存在し、パスパターン全体(接尾辞や接頭辞だけでなく)に一致する必要があります。 + +- `*` — Substitutes any number of any characters except `/` 空の文字列を含む。 +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +構造との `{}` に類似していて下さい [遠隔テーブル機能](../../sql-reference/table-functions/remote.md)). + +**例えば** + +1. 次の相対パスを持つ複数のファイルがあるとします: + +- ‘some\_dir/some\_file\_1’ +- ‘some\_dir/some\_file\_2’ +- ‘some\_dir/some\_file\_3’ +- ‘another\_dir/some\_file\_1’ +- ‘another\_dir/some\_file\_2’ +- ‘another\_dir/some\_file\_3’ + +1. これらのファイルの行数を照会します: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. クエリの量の行のすべてのファイルのディレクトリ: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "警告" + ファイルのリストに先行するゼロを持つ数値範囲が含まれている場合は、各桁のために中かっこで囲みます。 `?`. + +**例えば** + +クエリからのデータファイル名 `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## 仮想列 {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**また見なさい** + +- [仮想列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/ja/sql_reference/table_functions/generate.md b/docs/ja/sql-reference/table-functions/generate.md similarity index 100% rename from docs/ja/sql_reference/table_functions/generate.md rename to docs/ja/sql-reference/table-functions/generate.md diff --git a/docs/ja/sql-reference/table-functions/hdfs.md b/docs/ja/sql-reference/table-functions/hdfs.md new file mode 100644 index 00000000000..14eb07911a8 --- /dev/null +++ b/docs/ja/sql-reference/table-functions/hdfs.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 45 +toc_title: hdfs +--- + +# hdfs {#hdfs} + +HDFSのファイルからテーブルを作成します。 この表関数は次のようになります [url](url.md) と [ファイル](file.md) もの。 + +``` sql +hdfs(URI, format, structure) +``` + +**入力パラメータ** + +- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` と `{N..M}` どこに `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [書式](../../interfaces/formats.md#formats) ファイルの +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**戻り値** + +指定したファイルにデータを読み書きするための、指定した構造体を持つテーブル。 + +**例えば** + +テーブルから `hdfs://hdfs1:9000/test` そしてそれからの最初の二つの行の選択: + +``` sql +SELECT * +FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +**パス内のグロブ** + +複数のパスコンポーネン 処理されるためには、ファイルが存在し、パスパターン全体(接尾辞や接頭辞だけでなく)に一致する必要があります。 + +- `*` — Substitutes any number of any characters except `/` 空の文字列を含む。 +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +構造との `{}` に類似していて下さい [遠隔テーブル機能](../../sql-reference/table-functions/remote.md)). + +**例えば** + +1. HDFS上に次のUriを持ついくつかのファイルがあるとします: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. これらのファイルの行数を照会します: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. これら二つのディレ: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "警告" + ファイルのリストに先行するゼロを持つ数値範囲が含まれている場合は、各桁のために中かっこで囲みます。 `?`. + +**例えば** + +クエリからのデータファイル名 `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## 仮想列 {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**また見なさい** + +- [仮想列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/ja/sql-reference/table-functions/index.md b/docs/ja/sql-reference/table-functions/index.md new file mode 100644 index 00000000000..5899b704f37 --- /dev/null +++ b/docs/ja/sql-reference/table-functions/index.md @@ -0,0 +1,38 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Table Functions +toc_priority: 34 +toc_title: "\u5C0E\u5165" +--- + +# テーブル関数 {#table-functions} + +テーブル機能の方法を構築します。 + +テーブル関数は次の場所で使用できます: + +- [FROM](../statements/select.md#select-from) の句 `SELECT` クエリ。 + + The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. + +- [テーブルを\として作成](../statements/create.md#create-table-query) クエリ。 + + It's one of the methods of creating a table. + +!!! warning "警告" + テーブル関数を使用することはできません。 [allow\_ddl](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) 設定は無効です。 + +| 機能 | 説明 | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------| +| [ファイル](file.md) | を作成します。 [ファイル](../../engines/table-engines/special/file.md)-エンジンのテーブル。 | +| [マージ](merge.md) | を作成します。 [マージ](../../engines/table-engines/special/merge.md)-エンジンのテーブル。 | +| [数字](numbers.md) | 単一の列が整数で埋められたテーブルを作成します。 | +| [リモート](remote.md) | へ自由にアクセスできるリモートサーバーを作成することなく [分散](../../engines/table-engines/special/distributed.md)-エンジンのテーブル。 | +| [url](url.md) | を作成します。 [Url](../../engines/table-engines/special/url.md)-エンジンのテーブル。 | +| [mysql](mysql.md) | を作成します。 [MySQL](../../engines/table-engines/integrations/mysql.md)-エンジンのテーブル。 | +| [jdbc](jdbc.md) | を作成します。 [JDBC](../../engines/table-engines/integrations/jdbc.md)-エンジンのテーブル。 | +| [odbc](odbc.md) | を作成します。 [ODBC](../../engines/table-engines/integrations/odbc.md)-エンジンのテーブル。 | +| [hdfs](hdfs.md) | を作成します。 [HDFS](../../engines/table-engines/integrations/hdfs.md)-エンジンのテーブル。 | + +[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/ja/sql_reference/table_functions/input.md b/docs/ja/sql-reference/table-functions/input.md similarity index 100% rename from docs/ja/sql_reference/table_functions/input.md rename to docs/ja/sql-reference/table-functions/input.md diff --git a/docs/ja/sql_reference/table_functions/jdbc.md b/docs/ja/sql-reference/table-functions/jdbc.md similarity index 100% rename from docs/ja/sql_reference/table_functions/jdbc.md rename to docs/ja/sql-reference/table-functions/jdbc.md diff --git a/docs/ja/sql_reference/table_functions/merge.md b/docs/ja/sql-reference/table-functions/merge.md similarity index 100% rename from docs/ja/sql_reference/table_functions/merge.md rename to docs/ja/sql-reference/table-functions/merge.md diff --git a/docs/ja/sql-reference/table-functions/mysql.md b/docs/ja/sql-reference/table-functions/mysql.md new file mode 100644 index 00000000000..e4d73e4d5ab --- /dev/null +++ b/docs/ja/sql-reference/table-functions/mysql.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 42 +toc_title: mysql +--- + +# mysql {#mysql} + +許可 `SELECT` リモートMySQLサーバーに格納されているデータに対して実行されるクエリ。 + +``` sql +mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +**パラメータ** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` へのクエリ `REPLACE INTO`. もし `replace_query=1`、クエリが置き換えられます。 + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` に追加される式 `INSERT` クエリ。 + + Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. + + To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. + +シンプル `WHERE` 次のような句 `=, !=, >, >=, <, <=` 現在、MySQLサーバで実行されています。 + +残りの条件と `LIMIT` サンプリング制約は、MySQLへのクエリが終了した後にのみClickHouseで実行されます。 + +**戻り値** + +元のmysqlテーブルと同じカラムを持つテーブルオブジェクト。 + +## 使用例 {#usage-example} + +MySQLのテーブル: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ClickHouseからのデータの選択: + +``` sql +SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## また見なさい {#see-also} + +- [その ‘MySQL’ 表エンジン](../../engines/table-engines/integrations/mysql.md) +- [MySQLを外部辞書のソースとして使用する](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/ja/sql_reference/table_functions/numbers.md b/docs/ja/sql-reference/table-functions/numbers.md similarity index 100% rename from docs/ja/sql_reference/table_functions/numbers.md rename to docs/ja/sql-reference/table-functions/numbers.md diff --git a/docs/ja/sql-reference/table-functions/odbc.md b/docs/ja/sql-reference/table-functions/odbc.md new file mode 100644 index 00000000000..e354c3a2488 --- /dev/null +++ b/docs/ja/sql-reference/table-functions/odbc.md @@ -0,0 +1,108 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 44 +toc_title: odbc +--- + +# odbc {#table-functions-odbc} + +接続されたテーブルを返します。 [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +``` sql +odbc(connection_settings, external_database, external_table) +``` + +パラメータ: + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` ファイル。 +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +ODBC接続を安全に実装するには、ClickHouseは別のプログラムを使用します `clickhouse-odbc-bridge`. ODBCドライバーが直接読み込まれている場合 `clickhouse-server` ドライバの問題でクラッシュのClickHouseサーバーです。 クリックハウスが自動的に起動 `clickhouse-odbc-bridge` それが必要なとき。 ODBCブリッジプログラムは、次のパッケージと同じパッケー `clickhouse-server`. + +のフィールド `NULL` 外部テーブルの値は、基本データ型のデフォルト値に変換されます。 例えば、リモートMySQLテーブル分野の `INT NULL` タイプは0に変換されます(ClickHouseのデフォルト値 `Int32` データ型)。 + +## 使用例 {#usage-example} + +**PpsはインタラクティブのMySQLのインストール目盛** + +この例は、ubuntu linux18.04およびmysql server5.7で確認されています。 + +UnixODBCとMySQL Connectorがインストールされていることを確認します。 + +デフォルトでインストールされた場合、パッケージから),clickhouse開始してユーザー `clickhouse`. したがって、MySQLサーバでこのユーザを作成して設定する必要があります。 + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +次に、接続を設定します `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +チェックでき、接続を使用 `isql` unixODBCインストールからのユーティリティ。 + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +MySQLのテーブル: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ClickHouseのMySQLテーブルからデータを取得する: + +``` sql +SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ 0 │ 2 │ 0 │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## また見なさい {#see-also} + +- [ODBC外部辞書](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [ODBCテーブルエンジン](../../engines/table-engines/integrations/odbc.md). + +[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/ja/sql-reference/table-functions/remote.md b/docs/ja/sql-reference/table-functions/remote.md new file mode 100644 index 00000000000..f8648866c57 --- /dev/null +++ b/docs/ja/sql-reference/table-functions/remote.md @@ -0,0 +1,83 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 40 +toc_title: "\u30EA\u30E2\u30FC\u30C8" +--- + +# リモート,remoteSecure {#remote-remotesecure} + +へ自由にアクセスできるリモートサーバーを作成することなく `Distributed` テーブル。 + +署名: + +``` sql +remote('addresses_expr', db, table[, 'user'[, 'password']]) +remote('addresses_expr', db.table[, 'user'[, 'password']]) +``` + +`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port`、またはちょうど `host`. ホストは、サーバー名またはIPv4またはIPv6アドレスとして指定できます。 IPv6アドレスは角かっこで指定します。 ポートは、リモートサーバー上のTCPポートです。 ポートが省略された場合は、以下を使用します `tcp_port` サーバの設定ファイルから(デフォルトでは9000) + +!!! important "重要" + このポートはipv6アドレスに必要です。 + +例: + +``` text +example01-01-1 +example01-01-1:9000 +localhost +127.0.0.1 +[::]:9000 +[2a02:6b8:0:1111::11]:9000 +``` + +複数のアドレスをコンマ区切りにできます。 この場合、clickhouseは分散処理を使用するため、指定されたすべてのアドレス(異なるデータを持つシャードなど)にクエリを送信します。 + +例えば: + +``` text +example01-01-1,example01-02-1 +``` + +式の一部は、中括弧で指定できます。 前の例は次のように書くことができます: + +``` text +example01-0{1,2}-1 +``` + +中括弧は、二つのドット(負でない整数)で区切られた数の範囲を含めることができます。 この場合、範囲はシャードアドレスを生成する値のセットに拡張されます。 最初の数値がゼロから始まる場合、値は同じゼロ整列で形成されます。 前の例は次のように書くことができます: + +``` text +example01-{01..02}-1 +``` + +中括弧の複数のペアがある場合は、対応するセットの直接積が生成されます。 + +中括弧の中のアドレスとアドレスの一部は、パイプ記号(\|)で区切ることができます。 この場合、対応するアドレスのセットはレプリカとして解釈され、クエリは最初の正常なレプリカに送信されます。 ただし、レプリカは、現在設定されている順序で反復されます。 [load\_balancing](../../operations/settings/settings.md) 設定。 + +例えば: + +``` text +example01-{01..02}-{1|2} +``` + +この例では、指定さつする資料をそれぞれ二つのレプリカ. + +生成されるアドレスの数は定数によって制限されます。 今これは1000アドレスです。 + +を使用して `remote` テーブル関数が作成するよりも最適ではない `Distributed` この場合、サーバー接続はすべての要求に対して再確立されるためです。 さらに、ホスト名が設定されている場合、名前は解決され、さまざまなレプリカを操作するときにエラーはカウントされません。 多数のクエリを処理する場合は、常に `Distributed` テーブルは時間に先んじて、使用しないし `remote` テーブル機能。 + +その `remote` テーブル関数は、次の場合に便利です: + +- アクセスの特定のサーバーのためのデータとの比較、デバッグ、テスト実施をしておりました。 +- 研究目的のための様々なclickhouseクラスタ間のクエリ。 +- 手動で行われる頻度の低い分散要求。 +- サーバーのセットが毎回再定義される分散要求。 + +ユーザーが指定されていない場合, `default` 使用される。 +パスワードを指定しない場合は、空のパスワードが使用されます。 + +`remoteSecure` -と同じ `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) 設定または9440から。 + +[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/ja/sql_reference/table_functions/url.md b/docs/ja/sql-reference/table-functions/url.md similarity index 100% rename from docs/ja/sql_reference/table_functions/url.md rename to docs/ja/sql-reference/table-functions/url.md diff --git a/docs/ja/sql_reference/aggregate_functions/combinators.md b/docs/ja/sql_reference/aggregate_functions/combinators.md deleted file mode 100644 index 0aba4497269..00000000000 --- a/docs/ja/sql_reference/aggregate_functions/combinators.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u96C6\u8A08\u95A2\u6570\u306E\u30B3\u30F3\u30D3\u30CD\u30FC\u30BF" ---- - -# 集計関数のコンビネータ {#aggregate_functions_combinators} - -集計関数の名前には、それに接尾辞を付けることができます。 これにより、集計関数の動作方法が変更されます。 - -## -もし {#agg-functions-combinator-if} - -The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). - -例: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` というように。 - -条件付集計関数を使用すると、サブクエリを使用せずに複数の条件の集計を一度に計算できます。 `JOIN`例えば、Yandexの中。Metrica、条件付き集約関数は、セグメント比較機能を実装するために使用されます。 - -## -配列 {#agg-functions-combinator-array} - --arrayサフィックスは、任意の集計関数に追加できます。 この場合、aggregate関数は次の引数を取ります ‘Array(T)’ 代わりにタイプ(配列) ‘T’ 型引数。 集計関数が複数の引数を受け入れる場合、これは同じ長さの配列でなければなりません。 配列を処理する場合、aggregate関数は、すべての配列要素にわたって元の集計関数と同様に機能します。 - -例1: `sumArray(arr)` -すべてのすべての要素を合計します ‘arr’ 配列だ この例では、より簡単に書かれている可能性があります: `sum(arraySum(arr))`. - -例2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ 配列だ これは簡単な方法で行うことができます: `uniq(arrayJoin(arr))` しかし、それは常に追加することはできません ‘arrayJoin’ クエリに。 - --Ifと-配列を組み合わせることができます。 しかし, ‘Array’ 第一だから、その ‘If’. 例: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. この順序のために、 ‘cond’ 引数は配列ではありません。 - -## -状態 {#agg-functions-combinator-state} - -このコンビネーターを適用すると、集計関数は結果の値を返しません(たとえば、このコンビネーターの一意の値の数など)。 [uniq](reference.md#agg_function-uniq) の中間状態である。 `uniq`、これは一意の値の数を計算するためのハッシュテーブルです)。 これは `AggregateFunction(...)` これをさらなる処理に使用したり、テーブルに格納して後で集計を完了することができます。 - -これらの国は、利用: - -- [ツつィツ姪"ツつ"ツ債ツづュツつケ](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) テーブルエンジン。 -- [finalizeAggregation](../../sql_reference/functions/other_functions.md#function-finalizeaggregation) 機能。 -- [runningAccumulate](../../sql_reference/functions/other_functions.md#function-runningaccumulate) 機能。 -- [-マージ](#aggregate_functions_combinators_merge) コンビネータ -- [-MergeState](#aggregate_functions_combinators_mergestate) コンビネータ - -## -マージ {#aggregate_functions_combinators-merge} - -このコンビネーターを適用すると、aggregate関数は中間の集約状態を引数として受け取り、状態を結合して集計を終了し、結果の値を返します。 - -## -MergeState {#aggregate_functions_combinators-mergestate} - --mergeコンビネータと同じ方法で中間の集約状態をマージします。 しかし、結果の値を返すのではなく、-stateコンビネータに似た中間の集約状態を返します。 - -## -ForEach {#agg-functions-combinator-foreach} - -テーブルの集計関数を、対応する配列項目を集約して結果の配列を返す配列の集計関数に変換します。 例えば, `sumForEach` 配列の場合 `[1, 2]`, `[3, 4, 5]`と`[6, 7]`結果を返します `[10, 13, 5]` 対応する配列項目を一緒に追加した後。 - -## -オルデフォルト {#agg-functions-combinator-ordefault} - -集約する値が何もない場合は、集計関数の戻り値のデフォルト値を設定します。 - -``` sql -SELECT avg(number), avgOrDefault(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrDefault(number)─┐ -│ nan │ 0 │ -└─────────────┴──────────────────────┘ -``` - -## -オルヌル {#agg-functions-combinator-ornull} - -塗りつぶし `null` 集計するものがない場合。 戻り列はnull可能になります。 - -``` sql -SELECT avg(number), avgOrNull(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrNull(number)─┐ -│ nan │ ᴺᵁᴸᴸ │ -└─────────────┴───────────────────┘ -``` - --OrDefaultと-OrNullは他のコンビネータと組み合わせることができます。 これは、集計関数が空の入力を受け入れない場合に便利です。 - -``` sql -SELECT avgOrNullIf(x, x > 10) -FROM -( - SELECT toDecimal32(1.23, 2) AS x -) -``` - -``` text -┌─avgOrNullIf(x, greater(x, 10))─┐ -│ ᴺᵁᴸᴸ │ -└────────────────────────────────┘ -``` - -## -リサンプル {#agg-functions-combinator-resample} - -データをグループに分割し、それらのグループのデータを個別に集計できます。 グループは、ある列の値を間隔に分割することによって作成されます。 - -``` sql -Resample(start, end, step)(, resampling_key) -``` - -**パラメータ** - -- `start` — Starting value of the whole required interval for `resampling_key` 値。 -- `stop` — Ending value of the whole required interval for `resampling_key` 値。 全体の間隔は含まれていません `stop` 値 `[start, stop)`. -- `step` — Step for separating the whole interval into subintervals. The `aggFunction` 実行されるそれぞれのsubintervals。 -- `resampling_key` — Column whose values are used for separating data into intervals. -- `aggFunction_params` — `aggFunction` パラメータ。 - -**戻り値** - -- の配列 `aggFunction` 各サブインターバルの結果。 - -**例えば** - -考慮する `people` テーブルのデータ: - -``` text -┌─name───┬─age─┬─wage─┐ -│ John │ 16 │ 10 │ -│ Alice │ 30 │ 15 │ -│ Mary │ 35 │ 8 │ -│ Evelyn │ 48 │ 11.5 │ -│ David │ 62 │ 9.9 │ -│ Brian │ 60 │ 16 │ -└────────┴─────┴──────┘ -``` - -のは、その年齢の間隔にある人の名前を取得してみましょう `[30,60)` と `[60,75)`. 私たちは年齢の整数表現を使用しているので、私たちはで年齢を取得します `[30, 59]` と `[60,74]` 間隔。 - -配列内の名前を集約するには、次のものを使用します [グルーパー](reference.md#agg_function-grouparray) 集計関数。 それは一つの議論を取る。 私たちの場合、それは `name` コラム その `groupArrayResample` 関数は `age` 年齢別に名前を集計する列。 必要な間隔を定義するために、 `30, 75, 30` への引数 `groupArrayResample` 機能。 - -``` sql -SELECT groupArrayResample(30, 75, 30)(name, age) FROM people -``` - -``` text -┌─groupArrayResample(30, 75, 30)(name, age)─────┐ -│ [['Alice','Mary','Evelyn'],['David','Brian']] │ -└───────────────────────────────────────────────┘ -``` - -結果を考慮する。 - -`Jonh` 彼は若すぎるので、サンプルの外です。 他の人は、指定された年齢区間に従って配布されます。 - -プラグインのインス数の合計人数とその平均賃金には、指定された年齢の間隔とします。 - -``` sql -SELECT - countResample(30, 75, 30)(name, age) AS amount, - avgResample(30, 75, 30)(wage, age) AS avg_wage -FROM people -``` - -``` text -┌─amount─┬─avg_wage──────────────────┐ -│ [3,2] │ [11.5,12.949999809265137] │ -└────────┴───────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/ja/sql_reference/aggregate_functions/index.md b/docs/ja/sql_reference/aggregate_functions/index.md deleted file mode 100644 index d36ade9a637..00000000000 --- a/docs/ja/sql_reference/aggregate_functions/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Aggregate Functions -toc_priority: 33 -toc_title: "\u5C0E\u5165" ---- - -# 集計関数 {#aggregate-functions} - -集計関数は、 [通常の](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) 方法として期待されデータベースの専門家です。 - -ClickHouseはまた支えます: - -- [パラメトリックに集計機能](parametric_functions.md#aggregate_functions_parametric) 列に加えて他のパラメータを受け入れる。 -- [Combinators](combinators.md#aggregate_functions_combinators)、集計関数の動作を変更します。 - -## NULLの場合の処理 {#null-processing} - -集計中、すべて `NULL`sはスキップされます。 - -**例:** - -この表を考慮する: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -の値を合計する必要があるとしましょう `y` 列: - -``` sql -SELECT sum(y) FROM t_null_big -``` - - ┌─sum(y)─┐ - │ 7 │ - └────────┘ - -その `sum` 関数の解釈 `NULL` として `0`. 特に、これは、関数がすべての値がある選択の入力を受け取った場合 `NULL` その後、結果は次のようになります `0`、ない `NULL`. - -今すぐ使用できます `groupArray` から配列を作成する関数 `y` 列: - -``` sql -SELECT groupArray(y) FROM t_null_big -``` - -``` text -┌─groupArray(y)─┐ -│ [2,2,3] │ -└───────────────┘ -``` - -`groupArray` 含まれていません `NULL` 結果の配列です。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/ja/sql_reference/aggregate_functions/parametric_functions.md b/docs/ja/sql_reference/aggregate_functions/parametric_functions.md deleted file mode 100644 index 6d61ee95c46..00000000000 --- a/docs/ja/sql_reference/aggregate_functions/parametric_functions.md +++ /dev/null @@ -1,499 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: "\u30D1\u30E9\u30E1\u30C8\u30EA\u30C3\u30AF\u96C6\u8A08\u95A2\u6570" ---- - -# パラメトリック集計関数 {#aggregate_functions_parametric} - -Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. - -## ヒストグラム {#histogram} - -適応ヒストグラムを計算します。 正確な結果を保証するものではありません。 - -``` sql -histogram(number_of_bins)(values) -``` - -関数は以下を使用します [ストリーミングの並列決定木アルゴリズム](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). ヒストグラムビンの境界は、新しいデータが関数に入ると調整されます。 一般的なケースでは、ビンの幅は等しくありません。 - -**パラメータ** - -`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. -`values` — [式](../syntax.md#syntax-expressions) その結果、入力値が得られます。 - -**戻り値** - -- [配列](../../sql_reference/data_types/array.md) の [タプル](../../sql_reference/data_types/tuple.md) 次の形式の: - - ``` - [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] - ``` - - - `lower` — Lower bound of the bin. - - `upper` — Upper bound of the bin. - - `height` — Calculated height of the bin. - -**例えば** - -``` sql -SELECT histogram(5)(number + 1) -FROM ( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ -│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -ヒストグラムを視覚化することができます [バー](../../sql_reference/functions/other_functions.md#function-bar) たとえば、関数: - -``` sql -WITH histogram(5)(rand() % 100) AS hist -SELECT - arrayJoin(hist).3 AS height, - bar(height, 0, 6, 5) AS bar -FROM -( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─height─┬─bar───┐ -│ 2.125 │ █▋ │ -│ 3.25 │ ██▌ │ -│ 5.625 │ ████▏ │ -│ 5.625 │ ████▏ │ -│ 3.375 │ ██▌ │ -└────────┴───────┘ -``` - -この場合、ヒストグラムビンの境界線がわからないことを覚えておく必要があります。 - -## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} - -かどうかをチェックします配列を含むイベントのチェーンに一致するパターンです。 - -``` sql -sequenceMatch(pattern)(timestamp, cond1, cond2, ...) -``` - -!!! warning "警告" - 同じ秒で発生するイベントは、結果に影響を与える未定義の順序でシーケンス内に置くことができます。 - -**パラメータ** - -- `pattern` — Pattern string. See [パターン構文](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` と `DateTime`. も利用できますの対応 [UInt](../../sql_reference/data_types/int_uint.md) データ型。 - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最大32個の条件引数を渡すことができます。 この関数は、これらの条件で説明されているイベントのみを考慮します。 シーケンスに条件に記述されていないデータが含まれている場合、関数はそれらをスキップします。 - -**戻り値** - -- パターンが一致すれば、1。 -- 0、パターンが一致しない場合。 - -タイプ: `UInt8`. - - -**パターン構文** - -- `(?N)` — Matches the condition argument at position `N`. 条件には、 `[1, 32]` 範囲。 例えば, `(?1)` に渡された引数にマッチします。 `cond1` パラメータ。 - -- `.*` — Matches any number of events. You don't need conditional arguments to match this element of the pattern. - -- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` 互いに1800秒を超えて発生するイベントに一致します。 任意の数は、当社が定めるインターネットを築くことです。 を使用することができ `>=`, `>`, `<`, `<=` 演算子。 - -**例** - -のデータを考慮して下さい `t` テーブル: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -└──────┴────────┘ -``` - -クエリの実行: - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 1 │ -└───────────────────────────────────────────────────────────────────────┘ -``` - -この関数は、番号2が番号1に続くイベントチェーンを見つけました。 数字はイベントとして記述されていないため、3番をスキップしました。 この例で与えられたイベントチェーンを検索するときにこの番号を考慮に入れたい場合は、その条件を作成する必要があります。 - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ -│ 0 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -この場合、関数は、3番のイベントが1と2の間で発生したため、パターンに一致するイベントチェーンを見つけることができませんでした。 同じケースで4の条件をチェックした場合、シーケンスはパターンに一致します。 - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ -│ 1 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**また見なさい** - -- [sequenceCount](#function-sequencecount) - -## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} - -パターンに一致するイベントチェーンの数を数えます。 この関数は、重複しないイベントチェーンを検索します。 現在のチェーンが一致した後、次のチェーンの検索を開始します。 - -!!! warning "警告" - 同じ秒で発生するイベントは、結果に影響を与える未定義の順序でシーケンス内に置くことができます。 - -``` sql -sequenceCount(pattern)(timestamp, cond1, cond2, ...) -``` - -**パラメータ** - -- `pattern` — Pattern string. See [パターン構文](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` と `DateTime`. も利用できますの対応 [UInt](../../sql_reference/data_types/int_uint.md) データ型。 - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最大32個の条件引数を渡すことができます。 この関数は、これらの条件で説明されているイベントのみを考慮します。 シーケンスに条件に記述されていないデータが含まれている場合、関数はそれらをスキップします。 - -**戻り値** - -- 一致する重複しないイベントチェーンの数。 - -タイプ: `UInt64`. - -**例えば** - -のデータを考慮して下さい `t` テーブル: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -│ 4 │ 1 │ -│ 5 │ 3 │ -│ 6 │ 2 │ -└──────┴────────┘ -``` - -数2は、それらの間の他の数字の任意の量と数1の後に発生した回数をカウント: - -``` sql -SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 2 │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -**また見なさい** - -- [sequenceMatch](#function-sequencematch) - -## windowfunnelcomment {#windowfunnel} - -スライドタイムウィンドウでイベントチェーンを検索し、チェーンから発生したイベントの最大数を計算します。 - -関数はアルゴリズムに従って動作します: - -- この関数は、チェーン内の最初の条件をトリガーするデータを検索し、イベントカウンターを1に設定します。 これは、スライドウィンドウが始まる瞬間です。 - -- だから、チェーンが順次内のウインドウのカウンタを増加されます。 イベントのシーケンスが中断された場合、カウンターは増分されません。 - -- データにさまざまな完了点で複数のイベントチェーンがある場合、関数は最長チェーンのサイズのみを出力します。 - -**構文** - -``` sql -windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) -``` - -**パラメータ** - -- `window` — Length of the sliding window in seconds. -- `mode` -省略可能な引数です。 - - `'strict'` -とき `'strict'` windowFunnel()は、一意の値に対してのみ条件を適用します。 -- `timestamp` — Name of the column containing the timestamp. Data types supported: [日付](../../sql_reference/data_types/date.md), [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) その他の符号なし整数型(timestampがサポートしているにもかかわらず `UInt64` 値はInt64最大値を超えることはできません.2^63-1)。 -- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -スライディングタイムウィンドウ内のチェーンからの連続トリガー条件の最大数。 -選択内のすべてのチェーンが分析されます。 - -タイプ: `Integer`. - -**例えば** - -ユーザーが電話を選択してオンラインストアで二度購入するのに十分な期間が設定されているかどうかを判断します。 - -次の一連のイベントを設定します: - -1. ユーザーがストアのアカウントにログインした場合 (`eventID = 1003`). -2. ユーザーは電話を検索します (`eventID = 1007, product = 'phone'`). -3. ユーザーが注文した (`eventID = 1009`). -4. ユーザーが再び注文した (`eventID = 1010`). - -入力テーブル: - -``` text -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -``` - -ユーザーの距離を調べる `user_id` を介して得ることができるチェーンで期間で月-月の2019。 - -クエリ: - -``` sql -SELECT - level, - count() AS c -FROM -( - SELECT - user_id, - windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level - FROM trend - WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') - GROUP BY user_id -) -GROUP BY level -ORDER BY level ASC -``` - -結果: - -``` text -┌─level─┬─c─┐ -│ 4 │ 1 │ -└───────┴───┘ -``` - -## 保持 {#retention} - -関数は引数として1から32までの条件のセットを受け取ります。 `UInt8` るかどうかを示す一定の条件を満ためのイベントです。 -任意の条件を引数として指定することができます。 [WHERE](../../sql_reference/statements/select.md#select-where)). - -第一と第二が真であれば第二の結果は真であり、第一と第二が真であれば第三の結果は真である。 - -**構文** - -``` sql -retention(cond1, cond2, ..., cond32); -``` - -**パラメータ** - -- `cond` — an expression that returns a `UInt8` 結果(1または0)。 - -**戻り値** - -1または0の配列。 - -- 1 — condition was met for the event. -- 0 — condition wasn't met for the event. - -タイプ: `UInt8`. - -**例えば** - -の計算の例を考えてみましょう `retention` サイトトラフィックを決定する機能。 - -**1.** Сreate a table to illustrate an example. - -``` sql -CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; - -INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); -INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); -INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); -``` - -入力テーブル: - -クエリ: - -``` sql -SELECT * FROM retention_test -``` - -結果: - -``` text -┌───────date─┬─uid─┐ -│ 2020-01-01 │ 0 │ -│ 2020-01-01 │ 1 │ -│ 2020-01-01 │ 2 │ -│ 2020-01-01 │ 3 │ -│ 2020-01-01 │ 4 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-02 │ 0 │ -│ 2020-01-02 │ 1 │ -│ 2020-01-02 │ 2 │ -│ 2020-01-02 │ 3 │ -│ 2020-01-02 │ 4 │ -│ 2020-01-02 │ 5 │ -│ 2020-01-02 │ 6 │ -│ 2020-01-02 │ 7 │ -│ 2020-01-02 │ 8 │ -│ 2020-01-02 │ 9 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-03 │ 0 │ -│ 2020-01-03 │ 1 │ -│ 2020-01-03 │ 2 │ -│ 2020-01-03 │ 3 │ -│ 2020-01-03 │ 4 │ -│ 2020-01-03 │ 5 │ -│ 2020-01-03 │ 6 │ -│ 2020-01-03 │ 7 │ -│ 2020-01-03 │ 8 │ -│ 2020-01-03 │ 9 │ -│ 2020-01-03 │ 10 │ -│ 2020-01-03 │ 11 │ -│ 2020-01-03 │ 12 │ -│ 2020-01-03 │ 13 │ -│ 2020-01-03 │ 14 │ -└────────────┴─────┘ -``` - -**2.** グループのユーザーによるユニークID `uid` を使用して `retention` 機能。 - -クエリ: - -``` sql -SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r -FROM retention_test -WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') -GROUP BY uid -ORDER BY uid ASC -``` - -結果: - -``` text -┌─uid─┬─r───────┐ -│ 0 │ [1,1,1] │ -│ 1 │ [1,1,1] │ -│ 2 │ [1,1,1] │ -│ 3 │ [1,1,1] │ -│ 4 │ [1,1,1] │ -│ 5 │ [0,0,0] │ -│ 6 │ [0,0,0] │ -│ 7 │ [0,0,0] │ -│ 8 │ [0,0,0] │ -│ 9 │ [0,0,0] │ -│ 10 │ [0,0,0] │ -│ 11 │ [0,0,0] │ -│ 12 │ [0,0,0] │ -│ 13 │ [0,0,0] │ -│ 14 │ [0,0,0] │ -└─────┴─────────┘ -``` - -**3.** 一日あたりのサイト訪問の合計数を計算します。 - -クエリ: - -``` sql -SELECT - sum(r[1]) AS r1, - sum(r[2]) AS r2, - sum(r[3]) AS r3 -FROM -( - SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r - FROM retention_test - WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') - GROUP BY uid -) -``` - -結果: - -``` text -┌─r1─┬─r2─┬─r3─┐ -│ 5 │ 5 │ 5 │ -└────┴────┴────┘ -``` - -どこに: - -- `r1`-2020-01-01の間にサイトを訪問したユニーク訪問者の数 `cond1` 条件)。 -- `r2`-2020-01-01から2020-01-02までの特定の期間にサイトを訪問したユニーク訪問者の数 (`cond1` と `cond2` 条件)。 -- `r3`-2020-01-01から2020-01-03までの特定の期間にサイトを訪問したユニーク訪問者の数 (`cond1` と `cond3` 条件)。 - -## uniqUpTo(N)(x) {#uniquptonx} - -Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. - -小さいnsの使用のために推薦される、10まで。 nの最大値は100です。 - -集計関数の状態については、1+n\*に等しいメモリの量をバイトの一つの値のサイズを使用しています。 -文字列の場合、8バイトの非暗号化ハッシュを格納します。 つまり、計算は文字列に対して近似されます。 - -この関数は、いくつかの引数でも機能します。 - -大きなn値が使用され、一意の値の数がnよりわずかに少ない場合を除いて、できるだけ速く動作します。 - -使用例: - -``` text -Problem: Generate a report that shows only keywords that produced at least 5 unique users. -Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) - -## sumMapFiltered(keys\_to\_keep)(キー、値) {#summapfilteredkeys-to-keepkeys-values} - -同じ動作として [sumMap](reference.md#agg_functions-summap) キーの配列がパラメータとして渡されることを除いて。 これは、キーの高い基数を扱うときに特に便利です。 diff --git a/docs/ja/sql_reference/aggregate_functions/reference.md b/docs/ja/sql_reference/aggregate_functions/reference.md deleted file mode 100644 index fb0f2310100..00000000000 --- a/docs/ja/sql_reference/aggregate_functions/reference.md +++ /dev/null @@ -1,1837 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: "\u53C2\u7167" ---- - -# 関数リファレンス {#function-reference} - -## カウント {#agg_function-count} - -行数またはnull以外の値をカウントします。 - -ClickHouseは以下の構文をサポートしています `count`: -- `count(expr)` または `COUNT(DISTINCT expr)`. -- `count()` または `COUNT(*)`. その `count()` 構文はClickHouse固有です。 - -**パラメータ** - -機能は取ることができます: - -- ゼロ変数。 -- ワン [式](../syntax.md#syntax-expressions). - -**戻り値** - -- 関数がパラメータなしで呼び出されると、行数がカウントされます。 -- この [式](../syntax.md#syntax-expressions) が渡されると、この関数は、この式がnullではなく返された回数をカウントします。 式がaを返す場合 [Nullable](../../sql_reference/data_types/nullable.md)-タイプ値、そして結果の `count` 滞在しない `Nullable`. 式が返された場合、関数は0を返します `NULL` すべての行について。 - -どちらの場合も、戻り値の型は次のようになります [UInt64](../../sql_reference/data_types/int_uint.md). - -**詳細** - -クリックハウスは `COUNT(DISTINCT ...)` 構文。 この構成の動作は、 [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) 設定。 それはどれをの定義します [uniq\*](#agg_function-uniq) 関数は、操作を実行するために使用されます。 デフォルトは [ユニキャック](#agg_function-uniqexact) 機能。 - -その `SELECT count() FROM table` テーブル内のエントリの数が別々に格納されていないため、クエリは最適化されません。 テーブルから小さな列を選択し、その中の値の数を数えます。 - -**例** - -例1: - -``` sql -SELECT count() FROM t -``` - -``` text -┌─count()─┐ -│ 5 │ -└─────────┘ -``` - -例2: - -``` sql -SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' -``` - -``` text -┌─name──────────────────────────┬─value─────┐ -│ count_distinct_implementation │ uniqExact │ -└───────────────────────────────┴───────────┘ -``` - -``` sql -SELECT count(DISTINCT num) FROM t -``` - -``` text -┌─uniqExact(num)─┐ -│ 3 │ -└────────────────┘ -``` - -この例では、 `count(DISTINCT num)` によって実行される。 `uniqExact` に従う機能 `count_distinct_implementation` 設定値。 - -## 任意(x) {#agg_function-any} - -最初に検出された値を選択します。 -クエリは、毎回異なる順序で実行することができるため、この関数の結果は不確定です。 -確定的な結果を得るには、 ‘min’ または ‘max’ 関数の代わりに ‘any’. - -場合によっては、実行順序に頼ることができます。 これは、order byを使用するサブクエリからのselectの場合に適用されます。 - -とき `SELECT` クエリには `GROUP BY` 句または少なくとも一つの集計関数、ClickHouse(MySQLとは対照的に)内のすべての式ということが必要です `SELECT`, `HAVING`、と `ORDER BY` 句は、キーまたは集計関数から計算されます。 つまり、テーブルから選択された各列は、キーまたは集計関数内で使用する必要があります。 MySQLのような動作を得るには、他の列を `any` 集計関数。 - -## anyHeavy(x) {#anyheavyx} - -頻繁に発生する値を選択します。 [ヘビーヒッターズ](http://www.cs.umd.edu/~samir/498/karp.pdf) アルゴリズムだ 各クエリの実行スレッドのケースの半分を超える値がある場合は、この値が返されます。 通常、結果は非決定的です。 - -``` sql -anyHeavy(column) -``` - -**引数** - -- `column` – The column name. - -**例えば** - -を取る [オンタイム](../../getting_started/example_datasets/ontime.md) データセットと選択頻繁に発生する値で `AirlineID` コラム - -``` sql -SELECT anyHeavy(AirlineID) AS res -FROM ontime -``` - -``` text -┌───res─┐ -│ 19690 │ -└───────┘ -``` - -## anyllast(x) {#anylastx} - -最後に検出された値を選択します。 -結果は、次の場合と同様に不確定です `any` 機能。 - -## groupBitAnd {#groupbitand} - -ビットごとの適用 `AND` 一連の数字のために。 - -``` sql -groupBitAnd(expr) -``` - -**パラメータ** - -`expr` – An expression that results in `UInt*` タイプ。 - -**戻り値** - -の値 `UInt*` タイプ。 - -**例えば** - -テストデータ: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -クエリ: - -``` sql -SELECT groupBitAnd(num) FROM t -``` - -どこに `num` テストデータの列です。 - -結果: - -``` text -binary decimal -00000100 = 4 -``` - -## groupBitOr {#groupbitor} - -ビットごとの適用 `OR` 一連の数字のために。 - -``` sql -groupBitOr(expr) -``` - -**パラメータ** - -`expr` – An expression that results in `UInt*` タイプ。 - -**戻り値** - -の値 `UInt*` タイプ。 - -**例えば** - -テストデータ: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -クエリ: - -``` sql -SELECT groupBitOr(num) FROM t -``` - -どこに `num` テストデータの列です。 - -結果: - -``` text -binary decimal -01111101 = 125 -``` - -## groupBitXor {#groupbitxor} - -ビットごとの適用 `XOR` 一連の数字のために。 - -``` sql -groupBitXor(expr) -``` - -**パラメータ** - -`expr` – An expression that results in `UInt*` タイプ。 - -**戻り値** - -の値 `UInt*` タイプ。 - -**例えば** - -テストデータ: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -クエリ: - -``` sql -SELECT groupBitXor(num) FROM t -``` - -どこに `num` テストデータの列です。 - -結果: - -``` text -binary decimal -01101000 = 104 -``` - -## groupBitmap {#groupbitmap} - -符号なし整数列からのビットマップ計算または集計計算を行い、uint64型のカーディナリティを返します。 [ビットマップ](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmap(expr) -``` - -**パラメータ** - -`expr` – An expression that results in `UInt*` タイプ。 - -**戻り値** - -の値 `UInt64` タイプ。 - -**例えば** - -テストデータ: - -``` text -UserID -1 -1 -2 -3 -``` - -クエリ: - -``` sql -SELECT groupBitmap(UserID) as num FROM t -``` - -結果: - -``` text -num -3 -``` - -## 最小(x) {#agg_function-min} - -最小値を計算します。 - -## 最大(x) {#agg_function-max} - -最大値を計算します。 - -## argMin(arg,val) {#agg-function-argmin} - -を計算し ‘arg’ 最小値の値 ‘val’ 値。 いくつかの異なる値がある場合 ‘arg’ のための最小値 ‘val’ これらの値のうち、最初に検出された値が出力されます。 - -**例えば:** - -``` text -┌─user─────┬─salary─┐ -│ director │ 5000 │ -│ manager │ 3000 │ -│ worker │ 1000 │ -└──────────┴────────┘ -``` - -``` sql -SELECT argMin(user, salary) FROM salary -``` - -``` text -┌─argMin(user, salary)─┐ -│ worker │ -└──────────────────────┘ -``` - -## argMax(arg,val) {#agg-function-argmax} - -を計算し ‘arg’ 最大値の値 ‘val’ 値。 いくつかの異なる値がある場合 ‘arg’ の最大値 ‘val’ これらの値のうち、最初に検出された値が出力されます。 - -## sum(x) {#agg_function-sum} - -合計を計算します。 -数字のためにのみ動作します。 - -## sumWithOverflow(x) {#sumwithoverflowx} - -入力パラメーターの結果と同じデータ型を使用して、数値の合計を計算します。 合計がこのデータ型の最大値を超えると、関数はエラーを返します。 - -数字のためにのみ動作します。 - -## sumMap(キー,値) {#agg_functions-summap} - -合計 ‘value’ 配列に指定されたキーに応じて ‘key’ 配列だ -の要素の数 ‘key’ と ‘value’ 合計される行ごとに同じでなければなりません。 -Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. - -例えば: - -``` sql -CREATE TABLE sum_map( - date Date, - timeslot DateTime, - statusMap Nested( - status UInt16, - requests UInt64 - ) -) ENGINE = Log; -INSERT INTO sum_map VALUES - ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); -SELECT - timeslot, - sumMap(statusMap.status, statusMap.requests) -FROM sum_map -GROUP BY timeslot -``` - -``` text -┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ -│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ -│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ -└─────────────────────┴──────────────────────────────────────────────┘ -``` - -## skewPop {#skewpop} - -を計算します [歪み](https://en.wikipedia.org/wiki/Skewness) シーケンスの。 - -``` sql -skewPop(expr) -``` - -**パラメータ** - -`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 - -**戻り値** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**例えば** - -``` sql -SELECT skewPop(value) FROM series_with_value_column -``` - -## 串焼き {#skewsamp} - -を計算します [サンプルの歪度](https://en.wikipedia.org/wiki/Skewness) シーケンスの。 - -これは、渡された値がそのサンプルを形成する場合、確率変数の歪度の不偏推定値を表します。 - -``` sql -skewSamp(expr) -``` - -**パラメータ** - -`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 - -**戻り値** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). もし `n <= 1` (`n` はサンプルのサイズです)、関数は次の値を返します `nan`. - -**例えば** - -``` sql -SELECT skewSamp(value) FROM series_with_value_column -``` - -## kurtPop {#kurtpop} - -を計算します [尖度](https://en.wikipedia.org/wiki/Kurtosis) シーケンスの。 - -``` sql -kurtPop(expr) -``` - -**パラメータ** - -`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 - -**戻り値** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**例えば** - -``` sql -SELECT kurtPop(value) FROM series_with_value_column -``` - -## kurtSamp {#kurtsamp} - -を計算します [サンプル尖度](https://en.wikipedia.org/wiki/Kurtosis) のシーケンスです。 - -これは、渡された値がサンプルを形成する場合、確率変数の尖度の不偏推定値を表します。 - -``` sql -kurtSamp(expr) -``` - -**パラメータ** - -`expr` — [式](../syntax.md#syntax-expressions) 番号を返す。 - -**戻り値** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). もし `n <= 1` (`n` はサンプルのサイズです)、関数は次の値を返します `nan`. - -**例えば** - -``` sql -SELECT kurtSamp(value) FROM series_with_value_column -``` - -## timeSeriesGroupSum(uid,タイムスタンプ,値) {#agg-function-timeseriesgroupsum} - -`timeSeriesGroupSum` 総異なる時系列のサンプルのタイムスタンプなアライメントを実施します。 -これは、二つのサンプルタイムスタンプ間の線形補間を使用して、一緒に時系列を合計します。 - -- `uid` タイムシリーズの一意のidです, `UInt64`. -- `timestamp` ミリ秒またはマイクロ秒をサポートするためにInt64型です。 -- `value` メトリックです。 - -この関数は、以下のタプルの配列を返します `(timestamp, aggregated_value)` のペアになっています。 - -この機能を使用する前に確認 `timestamp` は昇順です。 - -例えば: - -``` text -┌─uid─┬─timestamp─┬─value─┐ -│ 1 │ 2 │ 0.2 │ -│ 1 │ 7 │ 0.7 │ -│ 1 │ 12 │ 1.2 │ -│ 1 │ 17 │ 1.7 │ -│ 1 │ 25 │ 2.5 │ -│ 2 │ 3 │ 0.6 │ -│ 2 │ 8 │ 1.6 │ -│ 2 │ 12 │ 2.4 │ -│ 2 │ 18 │ 3.6 │ -│ 2 │ 24 │ 4.8 │ -└─────┴───────────┴───────┘ -``` - -``` sql -CREATE TABLE time_series( - uid UInt64, - timestamp Int64, - value Float64 -) ENGINE = Memory; -INSERT INTO time_series VALUES - (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), - (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); - -SELECT timeSeriesGroupSum(uid, timestamp, value) -FROM ( - SELECT * FROM time_series order by timestamp ASC -); -``` - -結果は次のようになります: - -``` text -[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] -``` - -## timeSeriesGroupRateSum(uid,ts,val) {#agg-function-timeseriesgroupratesum} - -同様にtimeseriesgroupratesum、timeseriesgroupratesumは、時系列のレートを計算し、その後、一緒にレートを合計します。 -また、この関数を使用する前にタイムスタンプが昇順になるはずです。 - -この関数を使用すると、上記の結果は次のようになります: - -``` text -[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] -``` - -## 平均(x) {#agg_function-avg} - -平均を計算します。 -数字のためにのみ動作します。 -結果は常にfloat64です。 - -## uniq {#agg_function-uniq} - -引数の異なる値のおおよその数を計算します。 - -``` sql -uniq(x[, ...]) -``` - -**パラメータ** - -この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 - -**戻り値** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ番号。 - -**実装の詳細** - -機能: - -- 集計内のすべてのパラメータのハッシュを計算し、それを計算に使用します。 - -- を使用して適応サンプリングアルゴリズムです。 計算状態の場合、関数は65536までの要素ハッシュ値のサンプルを使用します。 - - This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. - -- 結果を確定的に提供します(クエリ処理の順序に依存しません)。 - -使用をお勧めしますこの機能はほとんど全てのシナリオ. - -**また見なさい** - -- [uniqCombined](#agg_function-uniqcombined) -- [uniqCombined64](#agg_function-uniqcombined64) -- [unihll12](#agg_function-uniqhll12) -- [ユニキャック](#agg_function-uniqexact) - -## uniqCombined {#agg_function-uniqcombined} - -異なる引数値のおおよその数を計算します。 - -``` sql -uniqCombined(HLL_precision)(x[, ...]) -``` - -その `uniqCombined` 関数は、異なる値の数を計算するのに適しています。 - -**パラメータ** - -この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 - -`HLL_precision` は、2のセル数の底の対数です [ハイパーログ](https://en.wikipedia.org/wiki/HyperLogLog). オプションで、次のように関数を使用できます `uniqCombined(x[, ...])`. のデフォルト値 `HLL_precision` は17で、これは効果的に96KiBのスペース(2^17セル、6ビットそれぞれ)です。 - -**戻り値** - -- を番号 [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ番号。 - -**実装の詳細** - -機能: - -- ハッシュを計算します(64ビットのハッシュ `String` それ以外の場合は32ビット)は、集計内のすべてのパラメータに対して、それを計算に使用します。 - -- 配列、ハッシュテーブル、およびhyperloglogとエラー修正テーブルの組み合わせを使用します。 - - For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. - -- 結果を確定的に提供します(クエリ処理の順序に依存しません)。 - -!!! note "メモ" - それは32ビットハッシュを使用しているので-`String` タイプすると、結果はカーディナリティのエラーが非常に大きくなります `UINT_MAX` (エラーは数十億の異なる値の後にすぐに発生します)、この場合は次のようにしてください [uniqCombined64](#agg_function-uniqcombined64) - -に比べて [uniq](#agg_function-uniq) 機能、を `uniqCombined`: - -- 数回少ないメモリを消費します。 -- 数倍高い精度で計算します。 -- 通常は若干低い性能を持っています。 一部のシナリオでは, `uniqCombined` より良い実行できる `uniq` たとえば、ネットワークを介して多数の集約状態を送信する分散クエリを使用します。 - -**また見なさい** - -- [uniq](#agg_function-uniq) -- [uniqCombined64](#agg_function-uniqcombined64) -- [unihll12](#agg_function-uniqhll12) -- [ユニキャック](#agg_function-uniqexact) - -## uniqCombined64 {#agg_function-uniqcombined64} - -と同じ [uniqCombined](#agg_function-uniqcombined) ただし、すべてのデータ型に64ビットハッシュを使用します。 - -## unihll12 {#agg_function-uniqhll12} - -を使用して、異なる引数値のおおよその数を計算します [ハイパーログ](https://en.wikipedia.org/wiki/HyperLogLog) アルゴリズムだ - -``` sql -uniqHLL12(x[, ...]) -``` - -**パラメータ** - -この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 - -**戻り値** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ番号。 - -**実装の詳細** - -機能: - -- 集計内のすべてのパラメータのハッシュを計算し、それを計算に使用します。 - -- HyperLogLogアルゴリズムを使用して、異なる引数値の数を近似します。 - - 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). - -- 確定的な結果を提供します(クエリ処理の順序に依存しません)。 - -この機能を使用することはお勧めしません。 ほとんどの場合、 [uniq](#agg_function-uniq) または [uniqCombined](#agg_function-uniqcombined) 機能。 - -**また見なさい** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [ユニキャック](#agg_function-uniqexact) - -## ユニキャック {#agg_function-uniqexact} - -異なる引数値の正確な数を計算します。 - -``` sql -uniqExact(x[, ...]) -``` - -を使用 `uniqExact` 機能あなたは絶対に正確な結果が必要な場合。 それ以外の場合は、 [uniq](#agg_function-uniq) 機能。 - -その `uniqExact` 機能の使用ます。 `uniq`、状態のサイズは、異なる値の数が増加するにつれて無制限の成長を有するからである。 - -**パラメータ** - -この関数は、可変個のパラメータを受け取ります。 変数は `Tuple`, `Array`, `Date`, `DateTime`, `String`、または数値型。 - -**また見なさい** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [unihll12](#agg_function-uniqhll12) - -## groupArray(x),groupArray(max\_size)(x) {#agg_function-grouparray} - -引数の値の配列を作成します。 -値は、任意の(不確定な)順序で配列に追加できます。 - -第二のバージョン( `max_size` パラメータ)結果の配列のサイズを次のように制限します `max_size` 要素。 -例えば, `groupArray (1) (x)` に相当します `[any (x)]`. - -場合によっては、実行の順序に依拠することもできます。 これは、次の場合に適用されます `SELECT` 使用するサブクエリーから取得されます `ORDER BY`. - -## groupArrayInsertAt(値、位置) {#grouparrayinsertatvalue-position} - -指定した位置の配列に値を挿入します。 - -!!! note "メモ" - この関数はゼロベースの位置を使用します。 - -Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. - -任意変数: - -- 空の位置に置き換えるためのデフォルト値。 -- 結果の配列の長さ。 これにより、すべての集約キーで同じサイズの配列を受け取ることができます。 このパラメーターを使用する場合は、既定値を指定する必要があります。 - -## グルーパーレイモビングサムcity in new mexico usa {#agg_function-grouparraymovingsum} - -入力値の移動和を計算します。 - -``` sql -groupArrayMovingSum(numbers_for_summing) -groupArrayMovingSum(window_size)(numbers_for_summing) -``` - -この機能できるウィンドウサイズとしてのパラメータとします。 指定しない場合、この関数は、列の行数と同じウィンドウサイズをとります。 - -**パラメータ** - -- `numbers_for_summing` — [式](../syntax.md#syntax-expressions) その結果、数値データ型の値が返されます。 -- `window_size` — Size of the calculation window. - -**戻り値** - -- 入力データと同じサイズおよびタイプの配列。 - -**例えば** - -サンプルテーブル: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -クエリ: - -``` sql -SELECT - groupArrayMovingSum(int) AS I, - groupArrayMovingSum(float) AS F, - groupArrayMovingSum(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingSum(2)(int) AS I, - groupArrayMovingSum(2)(float) AS F, - groupArrayMovingSum(2)(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -## groupparraymovingavg {#agg_function-grouparraymovingavg} - -入力値の移動平均を計算します。 - -``` sql -groupArrayMovingAvg(numbers_for_summing) -groupArrayMovingAvg(window_size)(numbers_for_summing) -``` - -この機能できるウィンドウサイズとしてのパラメータとします。 指定しない場合、この関数は、列の行数と同じウィンドウサイズをとります。 - -**パラメータ** - -- `numbers_for_summing` — [式](../syntax.md#syntax-expressions) その結果、数値データ型の値が返されます。 -- `window_size` — Size of the calculation window. - -**戻り値** - -- 入力データと同じサイズおよびタイプの配列。 - -この関数は [ゼロに向かって丸め](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). 結果のデータ型の小数点以下の桁を切り捨てます。 - -**例えば** - -サンプルテーブル `b`: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -クエリ: - -``` sql -SELECT - groupArrayMovingAvg(int) AS I, - groupArrayMovingAvg(float) AS F, - groupArrayMovingAvg(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ -│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ -└───────────┴─────────────────────────────────────┴───────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingAvg(2)(int) AS I, - groupArrayMovingAvg(2)(float) AS F, - groupArrayMovingAvg(2)(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ -│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ -└───────────┴──────────────────────────────────┴───────────────────────┘ -``` - -## groupUniqArray(x),groupUniqArray(max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} - -異なる引数値から配列を作成します。 メモリ消費量は、 `uniqExact` 機能。 - -第二のバージョン( `max_size` パラメータ)結果の配列のサイズを次のように制限します `max_size` 要素。 -例えば, `groupUniqArray(1)(x)` に相当します `[any(x)]`. - -## 分位値 {#quantile} - -近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 - -この関数が適用されます [貯蔵所の見本抽出](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192までの貯蔵所のサイズおよび見本抽出のための乱数発電機を使って。 結果は非決定的です。 正確な分位値を取得するには、以下を使用します [quantileExact](#quantileexact) 機能。 - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantile(level)(expr) -``` - -エイリアス: `median`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [データ型](../../sql_reference/data_types/index.md#data_types), [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). - -**戻り値** - -- 指定したレベルの概算値。 - -タイプ: - -- [Float64](../../sql_reference/data_types/float.md) 数値データ型の入力。 -- [日付](../../sql_reference/data_types/date.md) 入力値が `Date` タイプ。 -- [DateTime](../../sql_reference/data_types/datetime.md) 入力値が `DateTime` タイプ。 - -**例えば** - -入力テーブル: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -クエリ: - -``` sql -SELECT quantile(val) FROM t -``` - -結果: - -``` text -┌─quantile(val)─┐ -│ 1.5 │ -└───────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## quantiedeterministic {#quantiledeterministic} - -近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 - -この関数が適用されます [貯蔵所の見本抽出](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192までの貯蔵所のサイズおよび見本抽出の決定論のアルゴリズムを使って。 結果は決定的です。 正確な分位値を取得するには、以下を使用します [quantileExact](#quantileexact) 機能。 - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantileDeterministic(level)(expr, determinator) -``` - -エイリアス: `medianDeterministic`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [データ型](../../sql_reference/data_types/index.md#data_types), [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). -- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. - -**戻り値** - -- 指定したレベルの概算値。 - -タイプ: - -- [Float64](../../sql_reference/data_types/float.md) 数値データ型の入力。 -- [日付](../../sql_reference/data_types/date.md) 入力値が `Date` タイプ。 -- [DateTime](../../sql_reference/data_types/datetime.md) 入力値が `DateTime` タイプ。 - -**例えば** - -入力テーブル: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -クエリ: - -``` sql -SELECT quantileDeterministic(val, 1) FROM t -``` - -結果: - -``` text -┌─quantileDeterministic(val, 1)─┐ -│ 1.5 │ -└───────────────────────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## quantileExact {#quantileexact} - -正確に計算する [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` メモリ、どこ `n` 渡された値の数です。 しかし、少数の値の場合、関数は非常に効果的です。 - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantileExact(level)(expr) -``` - -エイリアス: `medianExact`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [データ型](../../sql_reference/data_types/index.md#data_types), [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). - -**戻り値** - -- 指定されたレベルの分位値。 - -タイプ: - -- [Float64](../../sql_reference/data_types/float.md) 数値データ型の入力。 -- [日付](../../sql_reference/data_types/date.md) 入力値が `Date` タイプ。 -- [DateTime](../../sql_reference/data_types/datetime.md) 入力値が `DateTime` タイプ。 - -**例えば** - -クエリ: - -``` sql -SELECT quantileExact(number) FROM numbers(10) -``` - -結果: - -``` text -┌─quantileExact(number)─┐ -│ 5 │ -└───────────────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## quantileExactWeighted {#quantileexactweighted} - -正確に計算する [分位値](https://en.wikipedia.org/wiki/Quantile) 各要素の重みを考慮した数値データシーケンス。 - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). この関数は、次の代わりに使用できます `quantileExact` そして、重み1を指定します。 - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantileExactWeighted(level)(expr, weight) -``` - -エイリアス: `medianExactWeighted`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [データ型](../../sql_reference/data_types/index.md#data_types), [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. - -**戻り値** - -- 指定されたレベルの分位値。 - -タイプ: - -- [Float64](../../sql_reference/data_types/float.md) 数値データ型の入力。 -- [日付](../../sql_reference/data_types/date.md) 入力値が `Date` タイプ。 -- [DateTime](../../sql_reference/data_types/datetime.md) 入力値が `DateTime` タイプ。 - -**例えば** - -入力テーブル: - -``` text -┌─n─┬─val─┐ -│ 0 │ 3 │ -│ 1 │ 2 │ -│ 2 │ 1 │ -│ 5 │ 4 │ -└───┴─────┘ -``` - -クエリ: - -``` sql -SELECT quantileExactWeighted(n, val) FROM t -``` - -結果: - -``` text -┌─quantileExactWeighted(n, val)─┐ -│ 1 │ -└───────────────────────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## クオンタイミング {#quantiletiming} - -決定された精度では、 [分位値](https://en.wikipedia.org/wiki/Quantile) 数値データシーケンス。 - -結果は決定的です(クエリ処理の順序に依存しません)。 この機能を最適化と配列における分布のような積載ウェブページではバックエンド対応。 - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantileTiming(level)(expr) -``` - -エイリアス: `medianTiming`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). - -- `expr` — [式](../syntax.md#syntax-expressions) aを返す列の値を超える [フロート\*](../../sql_reference/data_types/float.md)-タイプ番号。 - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -**精度** - -計算は次の場合に正確です: - -- 値の総数は5670を超えません。 -- 値の総数は5670を超えていますが、ページの読み込み時間は1024ms未満です。 - -それ以外の場合、計算の結果は16msの最も近い倍数に丸められます。 - -!!! note "メモ" - ページの読み込み時間の分位数を計算するために、この関数はより効果的で正確です [分位値](#quantile). - -**戻り値** - -- 指定されたレベルの分位値。 - -タイプ: `Float32`. - -!!! note "メモ" - 関数に値が渡されない場合(以下を使用する場合 `quantileTimingIf`), [ナン](../../sql_reference/data_types/float.md#data_type-float-nan-inf) 返されます。 この目的は、これらのケースをゼロになるケースと区別することです。 見る [ORDER BY句](../statements/select.md#select-order-by) ソートに関する注意事項 `NaN` 値。 - -**例えば** - -入力テーブル: - -``` text -┌─response_time─┐ -│ 72 │ -│ 112 │ -│ 126 │ -│ 145 │ -│ 104 │ -│ 242 │ -│ 313 │ -│ 168 │ -│ 108 │ -└───────────────┘ -``` - -クエリ: - -``` sql -SELECT quantileTiming(response_time) FROM t -``` - -結果: - -``` text -┌─quantileTiming(response_time)─┐ -│ 126 │ -└───────────────────────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## quantitimingweighted {#quantiletimingweighted} - -決定された精度では、 [分位値](https://en.wikipedia.org/wiki/Quantile) 各シーケンスメンバの重みに応じた数値データシーケンス。 - -結果は決定的です(クエリ処理の順序に依存しません)。 この機能を最適化と配列における分布のような積載ウェブページではバックエンド対応。 - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantileTimingWeighted(level)(expr, weight) -``` - -エイリアス: `medianTimingWeighted`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). - -- `expr` — [式](../syntax.md#syntax-expressions) aを返す列の値を超える [フロート\*](../../sql_reference/data_types/float.md)-タイプ番号。 - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**精度** - -計算は次の場合に正確です: - -- 値の総数は5670を超えません。 -- 値の総数は5670を超えていますが、ページの読み込み時間は1024ms未満です。 - -それ以外の場合、計算の結果は16msの最も近い倍数に丸められます。 - -!!! note "メモ" - ページの読み込み時間の分位数を計算するために、この関数はより効果的で正確です [分位値](#quantile). - -**戻り値** - -- 指定されたレベルの分位値。 - -タイプ: `Float32`. - -!!! note "メモ" - 関数に値が渡されない場合(以下を使用する場合 `quantileTimingIf`), [ナン](../../sql_reference/data_types/float.md#data_type-float-nan-inf) 返されます。 この目的は、これらのケースをゼロになるケースと区別することです。 見る [ORDER BY句](../statements/select.md#select-order-by) ソートに関する注意事項 `NaN` 値。 - -**例えば** - -入力テーブル: - -``` text -┌─response_time─┬─weight─┐ -│ 68 │ 1 │ -│ 104 │ 2 │ -│ 112 │ 3 │ -│ 126 │ 2 │ -│ 138 │ 1 │ -│ 162 │ 1 │ -└───────────────┴────────┘ -``` - -クエリ: - -``` sql -SELECT quantileTimingWeighted(response_time, weight) FROM t -``` - -結果: - -``` text -┌─quantileTimingWeighted(response_time, weight)─┐ -│ 112 │ -└───────────────────────────────────────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## quantiletdigestcomment {#quantiletdigest} - -近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) を使用する数値データシーケンスの [t-ダイジェスト](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) アルゴリズムだ - -最大誤差は1%です。 メモリ消費量は `log(n)`、どこ `n` 値の数です。 結果は、クエリの実行順序によって異なり、非決定的です。 - -機能の性能は性能より低いですの [分位値](#quantile) または [クオンタイミング](#quantiletiming). 状態サイズと精度の比に関しては、この関数はよりもはるかに優れています `quantile`. - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantileTDigest(level)(expr) -``` - -エイリアス: `medianTDigest`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [データ型](../../sql_reference/data_types/index.md#data_types), [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). - -**戻り値** - -- 指定したレベルの概算値。 - -タイプ: - -- [Float64](../../sql_reference/data_types/float.md) 数値データ型の入力。 -- [日付](../../sql_reference/data_types/date.md) 入力値が `Date` タイプ。 -- [DateTime](../../sql_reference/data_types/datetime.md) 入力値が `DateTime` タイプ。 - -**例えば** - -クエリ: - -``` sql -SELECT quantileTDigest(number) FROM numbers(10) -``` - -結果: - -``` text -┌─quantileTDigest(number)─┐ -│ 4.5 │ -└─────────────────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## quantileTDigestWeighted {#quantiletdigestweighted} - -近似値を計算します [分位値](https://en.wikipedia.org/wiki/Quantile) を使用する数値データシーケンスの [t-ダイジェスト](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) アルゴリズムだ この関数は、各シーケンスメンバーの重みを考慮に入れます。 最大誤差は1%です。 メモリ消費量は `log(n)`、どこ `n` 値の数です。 - -機能の性能は性能より低いですの [分位値](#quantile) または [クオンタイミング](#quantiletiming). 状態サイズと精度の比に関しては、この関数はよりもはるかに優れています `quantile`. - -結果は、クエリの実行順序によって異なり、非決定的です。 - -複数を使用する場合 `quantile*` クエリの異なるレベルを持つ関数は、内部状態が結合されていません(つまり、クエリはそれほど効率的ではありません)。 この場合は、 [分位数](#quantiles) 機能。 - -**構文** - -``` sql -quantileTDigest(level)(expr) -``` - -エイリアス: `medianTDigest`. - -**パラメータ** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` の範囲内の値 `[0.01, 0.99]`. デフォルト値:0.5. で `level=0.5` 機能は計算する [中央値](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [データ型](../../sql_reference/data_types/index.md#data_types), [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**戻り値** - -- 指定したレベルの概算値。 - -タイプ: - -- [Float64](../../sql_reference/data_types/float.md) 数値データ型の入力。 -- [日付](../../sql_reference/data_types/date.md) 入力値が `Date` タイプ。 -- [DateTime](../../sql_reference/data_types/datetime.md) 入力値が `DateTime` タイプ。 - -**例えば** - -クエリ: - -``` sql -SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) -``` - -結果: - -``` text -┌─quantileTDigestWeighted(number, 1)─┐ -│ 4.5 │ -└────────────────────────────────────┘ -``` - -**また見なさい** - -- [中央値](#median) -- [分位数](#quantiles) - -## 中央値 {#median} - -その `median*` 関数は、対応する関数のエイリアスです `quantile*` 機能。 数値データサンプルの中央値を計算します。 - -機能: - -- `median` — Alias for [分位値](#quantile). -- `medianDeterministic` — Alias for [quantiedeterministic](#quantiledeterministic). -- `medianExact` — Alias for [quantileExact](#quantileexact). -- `medianExactWeighted` — Alias for [quantileExactWeighted](#quantileexactweighted). -- `medianTiming` — Alias for [クオンタイミング](#quantiletiming). -- `medianTimingWeighted` — Alias for [quantitimingweighted](#quantiletimingweighted). -- `medianTDigest` — Alias for [quantiletdigestcomment](#quantiletdigest). -- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). - -**例えば** - -入力テーブル: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -クエリ: - -``` sql -SELECT medianDeterministic(val, 1) FROM t -``` - -結果: - -``` text -┌─medianDeterministic(val, 1)─┐ -│ 1.5 │ -└─────────────────────────────┘ -``` - -## quantiles(level1, level2, …)(x) {#quantiles} - -すべての分位数関数には、対応する分位数関数もあります: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. これらの関数は、あるパスでリストされたレベルのすべての分位数を計算し、結果の値の配列を返します。 - -## varSamp(x) {#varsampx} - -金額を計算します `Σ((x - x̅)^2) / (n - 1)`、どこ `n` サンプルサイズは `x̅`の平均値です `x`. - -これは、渡された値がそのサンプルを形成する場合、確率変数の分散の不偏推定値を表します。 - -を返します `Float64`. とき `n <= 1`、戻り値 `+∞`. - -## varPop(x) {#varpopx} - -金額を計算します `Σ((x - x̅)^2) / n`、どこ `n` サンプルサイズは `x̅`の平均値です `x`. - -つまり、値のセットの分散。 を返します `Float64`. - -## stddevSamp(x) {#stddevsampx} - -結果はの平方根に等しい `varSamp(x)`. - -## stddevPop(x) {#stddevpopx} - -結果はの平方根に等しい `varPop(x)`. - -## topK(N)(x) {#topknx} - -指定された列のほぼ最も頻繁に使用される値の配列を返します。 結果の配列は、値のおおよその頻度の降順でソートされます(値そのものではありません)。 - -実装する [ろ過されたスペース節約](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) からのreduce-and-combineアルゴリズムに基づいてTopKを分析するアルゴリズム [パラレル省スペース](https://arxiv.org/pdf/1401.0702.pdf). - -``` sql -topK(N)(column) -``` - -この関数は保証された結果を提供しません。 特定の状況では、エラーが発生し、最も頻度の高い値ではない頻繁な値が返されることがあります。 - -私達は使用を推薦します `N < 10` 価値;性能は大きいと減ります `N` 値。 の最大値 `N = 65536`. - -**パラメータ** - -- ‘N’ 返す要素の数です。 - -パラメーターを省略すると、既定値10が使用されます。 - -**引数** - -- ' x ' – The value to calculate frequency. - -**例えば** - -を取る [オンタイム](../../getting_started/example_datasets/ontime.md) データセットを選択し、最も頻繁に発生する三つの値を選択します。 `AirlineID` コラム - -``` sql -SELECT topK(3)(AirlineID) AS res -FROM ontime -``` - -``` text -┌─res─────────────────┐ -│ [19393,19790,19805] │ -└─────────────────────┘ -``` - -## トップクイット {#topkweighted} - -に似て `topK` しかし、整数型の一つの追加の引数を取ります - `weight`. あらゆる価値は説明されます `weight` 頻度計算のための時間。 - -**構文** - -``` sql -topKWeighted(N)(x, weight) -``` - -**パラメータ** - -- `N` — The number of elements to return. - -**引数** - -- `x` – The value. -- `weight` — The weight. [UInt8](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -最大およその重みの合計を持つ値の配列を返します。 - -**例えば** - -クエリ: - -``` sql -SELECT topKWeighted(10)(number, number) FROM numbers(1000) -``` - -結果: - -``` text -┌─topKWeighted(10)(number, number)──────────┐ -│ [999,998,997,996,995,994,993,992,991,990] │ -└───────────────────────────────────────────┘ -``` - -## covarSamp(x,y) {#covarsampx-y} - -の値を計算します `Σ((x - x̅)(y - y̅)) / (n - 1)`. - -Float64を返します。 とき `n <= 1`, returns +∞. - -## covarPop(x,y) {#covarpopx-y} - -の値を計算します `Σ((x - x̅)(y - y̅)) / n`. - -## corr(x,y) {#corrx-y} - -ピアソン相関係数を計算します: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. - -## categoricalInformationValue {#categoricalinformationvalue} - -の値を計算します `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` 各カテゴリの。 - -``` sql -categoricalInformationValue(category1, category2, ..., tag) -``` - -結果は、離散(カテゴリカル)フィーチャがどのようにして `[category1, category2, ...]` の値を予測する学習モデルに貢献する `tag`. - -## simplelearregression {#simplelinearregression} - -単純な(一次元的な)線形回帰を実行します。 - -``` sql -simpleLinearRegression(x, y) -``` - -パラメータ: - -- `x` — Column with dependent variable values. -- `y` — Column with explanatory variable values. - -戻り値: - -定数 `(a, b)` 結果の行の `y = a*x + b`. - -**例** - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ -│ (1,0) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ -│ (1,3) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## stochasticLinearRegression {#agg_functions-stochasticlinearregression} - -この関数は、確率的線形回帰を実装します。 それは率、l2正則化係数、ミニバッチサイズを学ぶための注文変数を支え、重量を更新するための少数の方法を有する ([アダム](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (デフォルトで使用), [シンプルSGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [勢い](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [ネステロフ](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). - -### パラメータ {#agg_functions-stochasticlinearregression-parameters} - -が4カスタマイズ可能パラメータ。 それらは関数に順番に渡されますが、すべての四つのデフォルト値を渡す必要はありませんが、良いモデルにはいくつかのパラメータ調整が必要で - -``` text -stochasticLinearRegression(1.0, 1.0, 10, 'SGD') -``` - -1. `learning rate` 勾配降下ステップが実行されるときのステップ長の係数です。 大きすぎる学習率の原因となり無限の量のモデルです。 デフォルトは `0.00001`. -2. `l2 regularization coefficient` これは過食防止に役立つ可能性があります。 デフォルトは `0.1`. -3. `mini-batch size` グラデーションディセントのステップを実行するために、グラデーションを計算して合計する要素の数を設定します。 純粋な確率降下は一つの要素を使用しますが、小さなバッチ(約10の要素)を持つことで勾配ステップがより安定します。 デフォルトは `15`. -4. `method for updating weights`、彼らは: `Adam` (デフォルトでは), `SGD`, `Momentum`, `Nesterov`. `Momentum` と `Nesterov` もう少し計算とメモリが必要ですが、確率勾配法の収束と安定性の点で有用です。 - -### 使い方 {#agg_functions-stochasticlinearregression-usage} - -`stochasticLinearRegression` モデルのフィッティングと新しいデータの予測です。 モデルを適合させ、後で使用するためにその状態を保存するために、 `-State` 基本的に状態(モデルの重みなど)を保存するcombinator。 -予測するには、関数を使用します [evalMLMethod](../functions/machine_learning_functions.md#machine_learning_methods-evalmlmethod) これは、状態を予測する機能と同様に引数として取ります。 - - - -**1.** 継手 - -このようなクエリを使用できます。 - -``` sql -CREATE TABLE IF NOT EXISTS train_data -( - param1 Float64, - param2 Float64, - target Float64 -) ENGINE = Memory; - -CREATE TABLE your_model ENGINE = Memory AS SELECT -stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) -AS state FROM train_data; -``` - -ここでは、データを挿入する必要もあります `train_data` テーブル。 パラメータの数は固定されていません。 `linearRegressionState`. 彼らはすべての必要数値です。 -ターゲット値(予測することを学びたい)を持つ列が最初の引数として挿入されることに注意してください。 - -**2.** 予測 - -状態をテーブルに保存した後、予測に複数回使用したり、他の状態とマージして新しいモデルを作成したりすることもできます。 - -``` sql -WITH (SELECT state FROM your_model) AS model SELECT -evalMLMethod(model, param1, param2) FROM test_data -``` - -クエリは予測値の列を返します。 その最初の引数に注意してください `evalMLMethod` は `AggregateFunctionState` オブジェクト、次はフィーチャの列です。 - -`test_data` のようなテーブルです `train_data` が含まれないことがあります。 - -### 備考 {#agg_functions-stochasticlinearregression-notes} - -1. 統合モデルにはユーザーの作成などのクエリ: - `sql SELECT state1 + state2 FROM your_models` - どこに `your_models` テーブルの両方のモデルです。 このクエリはnewを返します `AggregateFunctionState` オブジェクト。 - -2. ユーザーのフェッチのウエイトを作成したモデルとして独自の目的で保存しないモデルについていない場合 `-State` combinatorが使用されます。 - `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` - そのようなクエリはモデルに適合し、その重みを返します-最初はモデルのパラメータに対応する重みです。 したがって、上記の例では、クエリは3つの値を持つ列を返します。 - -**また見なさい** - -- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) -- [線形およびロジスティック回帰の違い](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} - -この関数は、確率論的ロジスティック回帰を実装します。 これは、バイナリ分類問題に使用することができ、stochasticlinearregressionと同じカスタムパラメータをサポートし、同じ方法で動作します。 - -### パラメータ {#agg_functions-stochasticlogisticregression-parameters} - -パラメーターは、stochasticlinearregressionとまったく同じです: -`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. -詳細については、 [パラメータ](#agg_functions-stochasticlinearregression-parameters). - -``` text -stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') -``` - -1. 継手 - - - - See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. - - Predicted labels have to be in \[-1, 1\]. - -1. 予測 - - - - Using saved state we can predict probability of object having label `1`. - - ``` sql - WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) FROM test_data - ``` - - The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. - - We can also set a bound of probability, which assigns elements to different labels. - - ``` sql - SELECT ans < 1.1 AND ans > 0.5 FROM - (WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) AS ans FROM test_data) - ``` - - Then the result will be labels. - - `test_data` is a table like `train_data` but may not contain target value. - -**また見なさい** - -- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) -- [線形およびロジスティック回帰の違い。](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## groupbitmapandgenericname {#groupbitmapand} - -ビットマップ列のandを計算し、型uint64のカーディナリティを返します。 [ビットマップ](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapAnd(expr) -``` - -**パラメータ** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` タイプ。 - -**戻り値** - -の値 `UInt64` タイプ。 - -**例えば** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapAnd(z)─┐ -│ 3 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ -│ [6,8,10] │ -└──────────────────────────────────────────────────┘ -``` - -## groupBitmapOr {#groupbitmapor} - -ビットマップ列のorを計算し、型uint64のカーディナリティを返します。 [ビットマップ](../../sql_reference/functions/bitmap_functions.md). これは `groupBitmapMerge`. - -``` sql -groupBitmapOr(expr) -``` - -**パラメータ** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` タイプ。 - -**戻り値** - -の値 `UInt64` タイプ。 - -**例えば** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapOr(z)─┐ -│ 15 │ -└──────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ -│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ -└─────────────────────────────────────────────────┘ -``` - -## groupBitmapXor {#groupbitmapxor} - -ビットマップ列のxorを計算し、uint64型のカーディナリティを返します。 [ビットマップ](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapOr(expr) -``` - -**パラメータ** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` タイプ。 - -**戻り値** - -の値 `UInt64` タイプ。 - -**例えば** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapXor(z)─┐ -│ 10 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ -│ [1,3,5,6,8,10,11,13,14,15] │ -└──────────────────────────────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/ja/sql_reference/ansi.md b/docs/ja/sql_reference/ansi.md deleted file mode 120000 index ee0f9c8cb7e..00000000000 --- a/docs/ja/sql_reference/ansi.md +++ /dev/null @@ -1 +0,0 @@ -../../en/sql_reference/ansi.md \ No newline at end of file diff --git a/docs/ja/sql_reference/data_types/aggregatefunction.md b/docs/ja/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index 8436f02198f..00000000000 --- a/docs/ja/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 52 -toc_title: AggregateFunction(name,types_of_arguments)...) ---- - -# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [マテリアライズドビュー](../../sql_reference/statements/select.md#create-view). 集計関数の状態を生成する一般的な方法は、集計関数を呼び出すことです `-State` 接尾辞。 将来の集約の最終結果を得るには、同じ集計関数を使用する必要があります `-Merge`接尾辞。 - -`AggregateFunction` — parametric data type. - -**パラメータ** - -- 集計関数の名前。 - - If the function is parametric, specify its parameters too. - -- 集計関数の引数の型です。 - -**例えば** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -[uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq),アーニフ ([任意の](../../sql_reference/aggregate_functions/reference.md#agg_function-any)+[もし](../../sql_reference/aggregate_functions/combinators.md#agg-functions-combinator-if))と [分位数](../../sql_reference/aggregate_functions/reference.md) ClickHouseでサポートされている集計関数です。 - -## 使い方 {#usage} - -### データ挿入 {#data-insertion} - -データを挿入するには `INSERT SELECT` 総計を使って `-State`-機能。 - -**関数の例** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -対応する機能とは対照的に `uniq` と `quantiles`, `-State`-関数は、最終的な値の代わりに状態を返します。 言い換えれば、それらは次の値を返します `AggregateFunction` タイプ。 - -の結果で `SELECT` クエリ、値の `AggregateFunction` タイプは、すべてのClickHouse出力形式に対して実装固有のバイナリ表現を持ちます。 たとえば、データをダンプする場合, `TabSeparated` フォーマット `SELECT` このダンプは、次のようにロードされます `INSERT` クエリ。 - -### データ選択 {#data-selection} - -データを選択するとき `AggregatingMergeTree` テーブル、使用 `GROUP BY` 句とデータを挿入するときと同じ集約関数が、 `-Merge`接尾辞。 - -以下の集計関数 `-Merge` suffixは、状態のセットを取得し、それらを結合し、完全なデータ集約の結果を返します。 - -たとえば、次の二つのクエリは同じ結果を返します: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## 使用例 {#usage-example} - -見る [ツつィツ姪"ツつ"ツ債ツづュツつケ](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) エンジンの説明。 - -[元の記事](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/ja/sql_reference/data_types/array.md b/docs/ja/sql_reference/data_types/array.md deleted file mode 100644 index c9bd9910bff..00000000000 --- a/docs/ja/sql_reference/data_types/array.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 51 -toc_title: "\u914D\u5217(T)" ---- - -# 配列(t) {#data-type-array} - -の配列 `T`-タイプのアイテム。 `T` 配列を含む任意のデータ型を指定できます。 - -## 配列の作成 {#creating-an-array} - -関数を使用して配列を作成できます: - -``` sql -array(T) -``` - -角括弧を使用することもできます。 - -``` sql -[] -``` - -配列の作成例: - -``` sql -SELECT array(1, 2) AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName(array(1, 2))─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴─────────────────────────┘ -``` - -``` sql -SELECT [1, 2] AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName([1, 2])─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴────────────────────┘ -``` - -## データ型の操作 {#working-with-data-types} - -その場で配列を作成するとき、clickhouseは自動的にすべてのリストされた引数を格納できる最も狭いデータ型として引数の型を定義します。 あれば [Nullable](nullable.md#data_type-nullable) またはリテラル [NULL](../../sql_reference/syntax.md#null-literal) 値は、配列要素の型も次のようになります [Nullable](nullable.md). - -ClickHouseでデータ型を特定できなかった場合は、例外が生成されます。 たとえば、文字列と数値を同時に持つ配列を作成しようとすると、これが発生します (`SELECT array(1, 'a')`). - -自動データ型検出の例: - -``` sql -SELECT array(1, 2, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ -│ [1,2,NULL] │ Array(Nullable(UInt8)) │ -└────────────┴───────────────────────────────┘ -``` - -互換性のないデータ型の配列を作成しようとすると、clickhouseは例外をスローします: - -``` sql -SELECT array(1, 'a') -``` - -``` text -Received exception from server (version 1.1.54388): -Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. -``` - -[元の記事](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/ja/sql_reference/data_types/datetime.md b/docs/ja/sql_reference/data_types/datetime.md deleted file mode 100644 index 5cb696f0564..00000000000 --- a/docs/ja/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 48 -toc_title: DateTime ---- - -# Datetime {#data_type-datetime} - -カレンダーの日付と時刻として表現することができ、時間内にインスタントを格納することができます。 - -構文: - -``` sql -DateTime([timezone]) -``` - -サポートされる値の範囲: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. - -解像度:1秒。 - -## 使用上の注意 {#usage-remarks} - -のとして保存すると、 [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) タイムゾーンまたは夏時間に関係なく。 さらに、 `DateTime` タイプは、列全体で同じタイムゾーンを格納することができます。 `DateTime` 型の値は、テキスト形式で表示され、文字列として指定された値がどのように解析されますか (‘2020-01-01 05:00:01’). タイムゾーンはテーブルの行(またはresultset)に格納されず、列のメタデータに格納されます。 -リストの対応時間帯の [IANA時間帯のデータベース](https://www.iana.org/time-zones). -その `tzdata` パッケージ、含む [IANA時間帯のデータベース](https://www.iana.org/time-zones)、システムに取付けられているべきです。 を使用 `timedatectl list-timezones` ローカルシステ - -タイムゾーンを明示的に設定することができます `DateTime`-テーブルを作成するときに列を入力します。 タイムゾーンが設定されていない場合、ClickHouseはタイムゾーンの値を使用します。 [タイムゾーン](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) クリックハウスサーバーの起動時にサーバー設定またはオペレーティングシステム設定のパラメータ。 - -その [クリックハウス-顧客](../../interfaces/cli.md) データ型の初期化時にタイムゾーンが明示的に設定されていない場合は、既定でサーバーのタイムゾーンを適用します。 クライアントのタイムゾーンを使用するには `clickhouse-client` と `--use_client_time_zone` パラメータ。 - -ClickHouse出力値で `YYYY-MM-DD hh:mm:ss` デフォルトではテキスト形式。 出力を変更するには、次のようにします [formatDateTime](../../sql_reference/functions/date_time_functions.md#formatdatetime) 機能。 - -ClickHouseにデータを挿入するときは、日付と時刻の文字列の異なる形式を使用することができます。 [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) 設定。 - -## 例 {#examples} - -**1.** テーブルを作成する `DateTime`-列を入力してデータを挿入する: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime('Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog; -``` - -``` sql -INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); -``` - -``` sql -SELECT * FROM dt; -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -- Datetimeを整数として挿入すると、Unixタイムスタンプ(UTC)として扱われます。 `1546300800` を表します `'2019-01-01 00:00:00'` UTC。 しかし、として `timestamp` 列は `Europe/Moscow` (UTC+3)タイムゾーン指定、文字列として出力すると、値は次のように表示されます `'2019-01-01 03:00:00'` -- 文字列値をdatetimeとして挿入すると、列timezoneにあるものとして扱われます。 `'2019-01-01 00:00:00'` するものとして扱われる `Europe/Moscow` タイムゾーンとして保存 `1546290000`. - -**2.** フィルタリング `DateTime` 値 - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -`DateTime` 列の値は、文字列値を使用してフィルター処理できます。 `WHERE` 述語。 それはに変換されます `DateTime` 自動的に: - -``` sql -SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -└─────────────────────┴──────────┘ -``` - -**3.** Aのタイムゾーンを取得する `DateTime`-タイプ列: - -``` sql -SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────column─┬─x─────────────────────────┐ -│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ -└─────────────────────┴───────────────────────────┘ -``` - -**4.** タイムゾーン変換 - -``` sql -SELECT -toDateTime(timestamp, 'Europe/London') as lon_time, -toDateTime(timestamp, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────lon_time──┬────────────mos_time─┐ -│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ -│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ -└─────────────────────┴─────────────────────┘ -``` - -## また見なさい {#see-also} - -- [型変換機能](../../sql_reference/functions/type_conversion_functions.md) -- [日付と時刻を操作するための関数](../../sql_reference/functions/date_time_functions.md) -- [配列を操作するための関数](../../sql_reference/functions/array_functions.md) -- [その `date_time_input_format` 設定](../../operations/settings/settings.md#settings-date_time_input_format) -- [その `timezone` サーバ設定パラメータ](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [日付と時刻を操作する演算子](../../sql_reference/operators.md#operators-datetime) -- [その `Date` データ型](date.md) - -[元の記事](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/ja/sql_reference/data_types/datetime64.md b/docs/ja/sql_reference/data_types/datetime64.md deleted file mode 100644 index d189ecf2b3b..00000000000 --- a/docs/ja/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 49 -toc_title: DateTime64 ---- - -# Datetime64 {#data_type-datetime64} - -定義されたサブ秒の精度で、カレンダーの日付と時刻として表現することができる時刻にインスタントを格納することができます - -目盛りサイズ(精度):10-精密 秒 - -構文: - -``` sql -DateTime64(precision, [timezone]) -``` - -内部的には、データを次の数として格納します ‘ticks’ エポックスタート(1970-01-01 00:00:00UTC)はInt64です。 目盛りの分解能は、precisionパラメーターによって決まります。 さらに、 `DateTime64` タイプは、列全体で同じタイムゾーンを格納することができます。 `DateTime64` 型の値は、テキスト形式で表示され、文字列として指定された値がどのように解析されますか (‘2020-01-01 05:00:01.000’). タイムゾーンはテーブルの行(またはresultset)に格納されず、列のメタデータに格納されます。 詳細はこちら [DateTime](datetime.md). - -## 例 {#examples} - -**1.** テーブルの作成 `DateTime64`-列を入力してデータを挿入する: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- Datetimeを整数として挿入すると、適切にスケーリングされたUnixタイムスタンプ(UTC)として扱われます。 `1546300800000` (精度3)を表します `'2019-01-01 00:00:00'` UTC。 しかし、として `timestamp` 列は `Europe/Moscow` (UTC+3)タイムゾーン指定、文字列として出力すると、値は次のように表示されます `'2019-01-01 03:00:00'` -- 文字列値をdatetimeとして挿入すると、列timezoneにあるものとして扱われます。 `'2019-01-01 00:00:00'` れる。 `Europe/Moscow` タイムゾーンとして保存 `1546290000000`. - -**2.** フィルタリング `DateTime64` 値 - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -とは異なり `DateTime`, `DateTime64` 値は変換されません `String` 自動的に - -**3.** Aのタイムゾーンを取得する `DateTime64`-タイプ値: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** タイムゾーン変換 - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## また見なさい {#see-also} - -- [タイプ変換関数](../../sql_reference/functions/type_conversion_functions.md) -- [日付と時刻を操作するための関数](../../sql_reference/functions/date_time_functions.md) -- [配列を操作するための関数](../../sql_reference/functions/array_functions.md) -- [その `date_time_input_format` 設定](../../operations/settings/settings.md#settings-date_time_input_format) -- [その `timezone` サーバ設定パラメータ](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [日付と時刻を操作する演算子](../../sql_reference/operators.md#operators-datetime) -- [`Date` データ型](date.md) -- [`DateTime` データ型](datetime.md) diff --git a/docs/ja/sql_reference/data_types/enum.md b/docs/ja/sql_reference/data_types/enum.md deleted file mode 100644 index 45705f0b608..00000000000 --- a/docs/ja/sql_reference/data_types/enum.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 50 -toc_title: "\u5217\u6319\u578B" ---- - -# 列挙型 {#enum} - -名前付きの値で構成される列挙型。 - -名前の値として宣言された `'string' = integer` ペア。 ClickHouseは数字のみを格納しますが、名前による値の操作をサポートします。 - -ClickHouse支援: - -- 8ビット `Enum`. それはで列挙可能な256までの値を含むことができます `[-128, 127]` 範囲。 -- 16ビット `Enum`. それはで列挙可能な65536まで値を含むことができます `[-32768, 32767]` 範囲。 - -ClickHouseは自動的に次のタイプを選択します `Enum` データが挿入されるとき。 また、 `Enum8` または `Enum16` ストレージのサイズを確認するタイプ。 - -## 使用例 {#usage-examples} - -ここでは、 `Enum8('hello' = 1, 'world' = 2)` タイプ列: - -``` sql -CREATE TABLE t_enum -( - x Enum('hello' = 1, 'world' = 2) -) -ENGINE = TinyLog -``` - -列 `x` 型定義にリストされている値のみを格納できます: `'hello'` または `'world'`. 他の値を保存しようとすると、ClickHouseは例外を発生させます。 このため8ビットサイズ `Enum` 自動的に選択されます。 - -``` sql -INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') -``` - -``` text -Ok. -``` - -``` sql -INSERT INTO t_enum values('a') -``` - -``` text -Exception on client: -Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) -``` - -テーブルからデータをクエリすると、clickhouseから文字列の値が出力されます `Enum`. - -``` sql -SELECT * FROM t_enum -``` - -``` text -┌─x─────┐ -│ hello │ -│ world │ -│ hello │ -└───────┘ -``` - -行に相当する数値を表示する必要がある場合は、次の行をキャストする必要があります `Enum` 整数型への値。 - -``` sql -SELECT CAST(x, 'Int8') FROM t_enum -``` - -``` text -┌─CAST(x, 'Int8')─┐ -│ 1 │ -│ 2 │ -│ 1 │ -└─────────────────┘ -``` - -クエリで列挙値を作成するには、次のものも使用する必要があります `CAST`. - -``` sql -SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) -``` - -``` text -┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ -│ Enum8('a' = 1, 'b' = 2) │ -└─────────────────────────────────────────────────────┘ -``` - -## 一般的なルールと使用法 {#general-rules-and-usage} - -各値には、範囲内の数値が割り当てられます `-128 ... 127` のために `Enum8` または範囲で `-32768 ... 32767` のために `Enum16`. すべての文字列と数字は異なる必要があります。 空の文字列が許可されます。 この型が(テーブル定義で)指定されている場合、数値は任意の順序で指定できます。 しかし、順序は重要ではありません。 - -文字列と数値のどちらも `Enum` できる。 [NULL](../../sql_reference/syntax.md). - -アン `Enum` に含まれることができる [Nullable](nullable.md) タイプ。 そのため、クエリを使用してテーブルを作成する場合 - -``` sql -CREATE TABLE t_enum_nullable -( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) -) -ENGINE = TinyLog -``` - -それだけでなく、 `'hello'` と `'world'`、しかし `NULL` 同様に、。 - -``` sql -INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) -``` - -ラムでは、 `Enum` 列は次のように保存されます `Int8` または `Int16` 対応する数値の。 - -テキストフォームで読み取る場合、clickhouseは値を文字列として解析し、一連のenum値から対応する文字列を検索します。 見つからない場合は、例外がスローされます。 テキスト形式で読み込むと、文字列が読み込まれ、対応する数値が検索されます。 見つからない場合は、例外がスローされます。 -テキスト形式で書くときは、値を対応する文字列として書き込みます。 列データにガベージ(有効なセットに含まれていない数値)が含まれている場合は、例外がスローされます。 バイナリ形式で読み書きするときは、int8とint16のデータ型と同じように動作します。 -暗黙的なデフォルト値は、数値が最も小さい値です。 - -の間 `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` そして、Enumは対応する数字と同じように動作します。 たとえば、ORDER BYは数値的に並べ替えます。 等価演算子と比較演算子は、基になる数値と同じようにEnumでも機能します。 - -Enum値を数値と比較することはできません。 列挙型は、定数文字列と比較できます。 比較された文字列が列挙型の有効な値でない場合は、例外がスローされます。 IN演算子は、左側の列挙型と右側の文字列のセットでサポートされています。 文字列は、対応する列挙型の値です。 - -Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. -しかし、列挙型は自然を持っています `toString` 文字列値を返す関数。 - -また、enumの値は、以下を使用して数値型に変換できます。 `toT` ここで、Tは数値型です。 Tが列挙型の基になる数値型に対応する場合、この変換はゼロコストになります。 -値のセットのみが変更された場合、列挙型は、alterを使用してコストをかけずに変更できます。 alterを使用して列挙型のメンバーを追加および削除することができます(削除された値がテーブルで一度も使用されていない場合にのみ、削除は安全で セーフガードとして、以前に定義されたenumメンバの数値を変更すると例外がスローされます。 - -ALTERを使用すると、Int8をInt16に変更するのと同じように、Enum8をEnum16に変更することも、その逆も可能です。 - -[元の記事](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/ja/sql_reference/data_types/fixedstring.md b/docs/ja/sql_reference/data_types/fixedstring.md deleted file mode 100644 index ae9a23581da..00000000000 --- a/docs/ja/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: FixedString(N) ---- - -# Fixedstring {#fixedstring} - -の固定長文字列 `N` バイト(文字もコードポイントもない)。 - -の列を宣言するには `FixedString` タイプ、次の構文を使用します: - -``` sql - FixedString(N) -``` - -どこに `N` 自然数です。 - -その `FixedString` 型は、データの長さが正確である場合に効率的です `N` バイト。 他のすべてのケースでは、効率を低下させる可能性があります。 - -効率的に格納できる値の例 `FixedString`-型指定された列: - -- IPアドレスのバイナリ表現 (`FixedString(16)` IPv6用)。 -- Language codes (ru\_RU, en\_US … ). -- Currency codes (USD, RUB … ). -- ハッシュのバイナリ表現 (`FixedString(16)` MD5の場合, `FixedString(32)` 用SHA256)。 - -UUID値を格納するには、以下を使用します [UUID](uuid.md) データ型。 - -データを挿入するときは、clickhouse: - -- 文字列が含まれていない場合、nullバイトの文字列を補完します `N` バイト。 -- スロー `Too large value for FixedString(N)` る場合の例外の文字列です。 `N` バイトまでとなります。 - -データを選択するとき、clickhouseは文字列の末尾にあるnullバイトを削除しません。 を使用する場合 `WHERE` この節では、nullバイトを手動で追加して、 `FixedString` 値。 次の例では、次の例を使用する方法を示します `WHERE` との節 `FixedString`. - -のは、単一の次の表を考えてみましょう `FixedString(2)` 列: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -クエリ `SELECT * FROM FixedStringTable WHERE a = 'b'` 結果としてデータを返さない。 このフィルターパターンはnullバイトまでとなります。 - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -この動作は、mysqlとは異なります `CHAR` タイプ(文字列は空白で埋められ、空白は出力用に削除されます)。 - -の長さに注意してください。 `FixedString(N)` 値が一定になります。 その [長さ](../../sql_reference/functions/array_functions.md#array_functions-length) 関数の戻り値 `N` 場合においても `FixedString(N)` 値はnullバイトでのみ入力されるが、 [空](../../sql_reference/functions/string_functions.md#empty) 関数の戻り値 `1` この場合。 - -[元の記事](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/ja/sql_reference/data_types/nested_data_structures/nested.md b/docs/ja/sql_reference/data_types/nested_data_structures/nested.md deleted file mode 100644 index 2bbf4ed73a7..00000000000 --- a/docs/ja/sql_reference/data_types/nested_data_structures/nested.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 57 -toc_title: "\u30CD\u30B9\u30C8(Name1\u30BF\u30A4\u30D71,Name2\u30BF\u30A4\u30D72,...)" ---- - -# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) クエリ。 各テーブル行は、入れ子になったデータ構造内の任意の数の行に対応できます。 - -例えば: - -``` sql -CREATE TABLE test.visits -( - CounterID UInt32, - StartDate Date, - Sign Int8, - IsNew UInt8, - VisitID UInt64, - UserID UInt64, - ... - Goals Nested - ( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32 - ), - ... -) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) -``` - -この例では、 `Goals` ネストされたデータ構造。 の各行 ‘visits’ 表は、ゼロまたは任意の数の変換に対応することができます。 - -単一の入れ子レベルのみがサポートされます。 配列を含むネストされた構造体の列は、多次元配列と同等であるため、サポートが制限されています(mergetreeエンジンを使用してこれらの列をテーブルに格 - -ほとんどの場合、入れ子になったデータ構造で作業する場合、その列はドットで区切られた列名で指定されます。 これらの列は、一致する型の配列を構成します。 単一の入れ子になったデータ構造のすべての列配列の長さは同じです。 - -例えば: - -``` sql -SELECT - Goals.ID, - Goals.EventTime -FROM test.visits -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ -│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ -│ [1073752] │ ['2014-03-17 00:28:25'] │ -│ [1073752] │ ['2014-03-17 10:46:20'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ -│ [] │ [] │ -│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ -│ [] │ [] │ -│ [] │ [] │ -│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ -└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -ネストされたデータ構造を、同じ長さの複数の列配列のセットと考えるのが最も簡単です。 - -SELECTクエリで、個々の列ではなくネストされたデータ構造全体の名前を指定できる唯一の場所は、ARRAY JOIN句です。 詳細については、 “ARRAY JOIN clause”. 例えば: - -``` sql -SELECT - Goal.ID, - Goal.EventTime -FROM test.visits -ARRAY JOIN Goals AS Goal -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goal.ID─┬──────Goal.EventTime─┐ -│ 1073752 │ 2014-03-17 16:38:10 │ -│ 591325 │ 2014-03-17 16:38:48 │ -│ 591325 │ 2014-03-17 16:42:27 │ -│ 1073752 │ 2014-03-17 00:28:25 │ -│ 1073752 │ 2014-03-17 10:46:20 │ -│ 1073752 │ 2014-03-17 13:59:20 │ -│ 591325 │ 2014-03-17 22:17:55 │ -│ 591325 │ 2014-03-17 22:18:07 │ -│ 591325 │ 2014-03-17 22:18:51 │ -│ 1073752 │ 2014-03-17 11:37:06 │ -└─────────┴─────────────────────┘ -``` - -ネストされたデータ構造全体のselectは実行できません。 明示的にリストできるのは、その一部である個々の列のみです。 - -挿入クエリでは、入れ子になったデータ構造のすべてのコンポーネント列配列を個別に渡す必要があります(個々の列配列と同様)。 挿入時に、システムは同じ長さを持つことをチェックします。 - -DESCRIBEクエリの場合、入れ子になったデータ構造内の列は、同じ方法で別々にリストされます。 - -入れ子になったデータ構造内の要素に対するalter queryには制限があります。 - -[元の記事](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/ja/sql_reference/data_types/nullable.md b/docs/ja/sql_reference/data_types/nullable.md deleted file mode 100644 index 79b06a832f4..00000000000 --- a/docs/ja/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: Nullable ---- - -# Nullable(typename) {#data_type-nullable} - -特別なマーカーを保存できます ([NULL](../../sql_reference/syntax.md))それは意味する “missing value” 通常の値と並んで `TypeName`. たとえば、 `Nullable(Int8)` タイプ列は保存できます `Int8` 値を入力すると、値を持たない行が格納されます `NULL`. - -のための `TypeName` 複合データ型は使用できません [配列](array.md) と [タプル](tuple.md). 複合データタイプを含むことができ `Nullable` 以下のようなタイプの値 `Array(Nullable(Int8))`. - -A `Nullable` typeフィールドできない含まれてテーブルスを作成します。 - -`NULL` anyのデフォルト値を指定します。 `Nullable` ClickHouseサーバー構成で別途指定されている場合を除き、入力します。 - -## ストレージ機能 {#storage-features} - -保存する `Nullable` 型の値テーブルのカラムClickHouse用途別のファイル `NULL` 値を持つ通常のファイルに加えて、マスク。 マスクファイル内のエントリは、ClickHouseが `NULL` そして、各テーブルの行の対応するデータ型のデフォルト値。 追加のファイルのため, `Nullable` 列は、同様の通常の記憶領域と比較して追加の記憶領域を消費します。 - -!!! info "メモ" - を使用して `Nullable` ほとんどの場合、パフォーマンスに悪影響を及ぼします。 - -## 使用例 {#usage-example} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y FROM t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/ja/sql_reference/data_types/simpleaggregatefunction.md b/docs/ja/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 120000 index 02fad64d50e..00000000000 --- a/docs/ja/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/sql_reference/data_types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/ja/sql_reference/data_types/special_data_types/interval.md b/docs/ja/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index affd9034376..00000000000 --- a/docs/ja/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 61 -toc_title: "\u9593\u9694" ---- - -# 間隔 {#data-type-interval} - -時刻と日付の間隔を表すデータ型のファミリ。 結果のタイプ [INTERVAL](../../../sql_reference/operators.md#operator-interval) オペレーター - -!!! warning "警告" - `Interval` データ型の値はテーブルに格納できません。 - -構造: - -- 符号なし整数値としての時間間隔。 -- 間隔のタイプ。 - -サポートさ: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -各区間タイプには、個別のデータタイプがあります。 たとえば、 `DAY` 間隔はに対応します `IntervalDay` データ型: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## 使用上の注意 {#data-type-interval-usage-remarks} - -を使用することができ `Interval`-との算術操作のタイプ値 [日付](../../../sql_reference/data_types/date.md) と [DateTime](../../../sql_reference/data_types/datetime.md)-タイプの値。 たとえば、現在の時刻に4日を追加できます: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -間隔の異なる種類できない。 次のような間隔は使用できません `4 DAY 1 HOUR`. 間隔は、間隔の最小単位(間隔など)より小さいか等しい単位で指定します `1 day and an hour` 間隔は次のように表現できます `25 HOUR` または `90000 SECOND`. - -あなたは算術演算を実行することはできません `Interval`-値を入力しますが、異なるタイプの間隔を追加することができます。 `Date` または `DateTime` データ型。 例えば: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -次のクエリでは、例外が発生します: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## また見なさい {#see-also} - -- [INTERVAL](../../../sql_reference/operators.md#operator-interval) 演算子 -- [toInterval](../../../sql_reference/functions/type_conversion_functions.md#function-tointerval) 型変換関数 diff --git a/docs/ja/sql_reference/data_types/special_data_types/nothing.md b/docs/ja/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index 8bd4b852d9f..00000000000 --- a/docs/ja/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 60 -toc_title: "\u4F55\u3082\u306A\u3044" ---- - -# 何もない {#nothing} - -このデータ型の唯一の目的は、値が予期されないケースを表すことです。 だから、作成することはできません `Nothing` タイプ値。 - -たとえば、リテラル [NULL](../../../sql_reference/syntax.md#null-literal) はタイプの `Nullable(Nothing)`. 詳細はこちら [Nullable](../../../sql_reference/data_types/nullable.md). - -その `Nothing` 型は、空の配列を示すためにも使用できます: - -``` sql -SELECT toTypeName(array()) -``` - -``` text -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/ja/sql_reference/data_types/special_data_types/set.md b/docs/ja/sql_reference/data_types/special_data_types/set.md deleted file mode 100644 index a9fb57e7249..00000000000 --- a/docs/ja/sql_reference/data_types/special_data_types/set.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 59 -toc_title: "\u30BB\u30C3\u30C8" ---- - -# セット {#set} - -の右半分のために使用される [IN](../../../sql_reference/statements/select.md#select-in-operators) 式。 - -[元の記事](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/ja/sql_reference/data_types/tuple.md b/docs/ja/sql_reference/data_types/tuple.md deleted file mode 100644 index 61492fe28f4..00000000000 --- a/docs/ja/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 53 -toc_title: "\u30BF\u30D7\u30EB(T1,T2,...)" ---- - -# Tuple(t1, T2, …) {#tuplet1-t2} - -要素のタプル。 [タイプ](index.md#data_types). - -タプルは、一時列のグループ化に使用されます。 列は、in式がクエリで使用されている場合、およびラムダ関数の特定の仮パラメータを指定するためにグループ化できます。 詳細については、以下を参照してください [演算子の場合](../../sql_reference/statements/select.md) と [高階関数](../../sql_reference/functions/higher_order_functions.md). - -タプルは、クエリの結果になります。 この場合、json以外のテキスト形式の場合、値は角かっこでカンマ区切りになります。 json形式では、タプルは配列として出力されます(角括弧内)。 - -## タプルの作成 {#creating-a-tuple} - -関数を使用してタプルを作成することができます: - -``` sql -tuple(T1, T2, ...) -``` - -タプルの作成例: - -``` sql -SELECT tuple(1,'a') AS x, toTypeName(x) -``` - -``` text -┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ -│ (1,'a') │ Tuple(UInt8, String) │ -└─────────┴───────────────────────────┘ -``` - -## データ型の操作 {#working-with-data-types} - -タプルをオンザフライで作成するとき、clickhouseは引数の値を格納できる型の最小値として各引数の型を自動的に検出します。 引数が [NULL](../../sql_reference/syntax.md#null-literal) タプル要素の型は次のとおりです [Nullable](nullable.md). - -自動データ型検出の例: - -``` sql -SELECT tuple(1, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ -│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ -└──────────┴─────────────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/ja/sql_reference/data_types/uuid.md b/docs/ja/sql_reference/data_types/uuid.md deleted file mode 100644 index 788e7ade8a1..00000000000 --- a/docs/ja/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 46 -toc_title: UUID ---- - -# UUID {#uuid-data-type} - -Universally unique identifier(UUID)は、レコードを識別するために使用される16バイトの数値です。 UUIDの詳細については、以下を参照してください [Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -UUID型の値の例を以下に示します: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -新しいレコードを挿入するときにuuid列の値を指定しない場合、uuidの値はゼロで埋められます: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## 生成する方法 {#how-to-generate} - -UUID値を生成するには、ClickHouseに次の値を指定します [generateUUIDv4](../../sql_reference/functions/uuid_functions.md) 機能。 - -## 使用例 {#usage-example} - -**例1** - -この例では、uuid型の列を使用してテーブルを作成し、テーブルに値を挿入する方法を示します。 - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**例2** - -この例では、新しいレコードを挿入するときにuuid列の値が指定されていません。 - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## 制限 {#restrictions} - -UUIDデータ型は、以下の関数のみをサポートします [文字列](string.md) データ型もサポートします(たとえば, [分](../../sql_reference/aggregate_functions/reference.md#agg_function-min), [最大](../../sql_reference/aggregate_functions/reference.md#agg_function-max)、と [カウント](../../sql_reference/aggregate_functions/reference.md#agg_function-count)). - -UUIDデータ型は、算術演算ではサポートされません(たとえば, [abs](../../sql_reference/functions/arithmetic_functions.md#arithm_func-abs) 以下のような)または集約関数 [合計](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) と [平均](../../sql_reference/aggregate_functions/reference.md#agg_function-avg). - -[元の記事](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index 0bee2e95916..00000000000 --- a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u4E00\u822C\u7684\u306A\u8AAC\u660E" ---- - -# 外部辞書 {#dicts-external-dicts} - -さまざまなデータソースから独自の辞書を追加できます。 ディクショナリのデータソースには、ローカルテキストまたは実行可能ファイル、http(s)リソース、または別のdbmsを指定できます。 詳細については、 “[外部辞書のソース](external_dicts_dict_sources.md)”. - -クリックハウス: - -- 完全または部分的にramに辞書を格納します。 -- 辞書を定期的に更新し、欠損値を動的に読み込みます。 つまり、辞書を動的に読み込むことができます。 -- Xmlファイルを使用して外部辞書を作成したり [DDLクエリ](../../statements/create.md#create-dictionary-query). - -外部辞書の設定は、一つ以上のxmlファイルに配置することができます。 設定へのパスは [dictionaries\_config](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_config) パラメータ。 - -辞書は、サーバーの起動時または最初の使用時にロードすることができます。 [dictionaries\_lazy\_load](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) 設定。 - -辞書構成ファイルの形式は次のとおりです: - -``` xml - - An optional element with any content. Ignored by the ClickHouse server. - - - /etc/metrika.xml - - - - - - - - -``` - -あなたはできる [設定](external_dicts_dict.md) 同じファイル内の任意の数の辞書。 - -[辞書のddlクエリ](../../statements/create.md#create-dictionary-query) サーバー構成に追加のレコードは必要ありません。 この仕事を辞書として第一級の体のように、テーブルやビュー。 - -!!! attention "注意" - 小さな辞書の値をaに記述することによって変換できます `SELECT` クエリ(参照 [変換](../../../sql_reference/functions/other_functions.md) 機能)。 この機能は外部辞書とは関係ありません。 - -## また見なさい {#ext-dicts-see-also} - -- [外部ディクショナリの設定](external_dicts_dict.md) -- [辞書をメモリに保存する](external_dicts_dict_layout.md) -- [辞書の更新](external_dicts_dict_lifetime.md) -- [外部辞書のソース](external_dicts_dict_sources.md) -- [辞書のキーとフィールド](external_dicts_dict_structure.md) -- [外部辞書を操作するための関数](../../../sql_reference/functions/ext_dict_functions.md) - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index 2d10818a085..00000000000 --- a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u5916\u90E8\u30C7\u30A3\u30AF\u30B7\u30E7\u30CA\u30EA\u306E\u8A2D\u5B9A" ---- - -# 外部ディクショナリの設定 {#dicts-external-dicts-dict} - -Dictionaryがxmlファイルを使用して構成されている場合、than dictionary構成は次の構造を持ちます: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -対応 [DDL-クエリ](../../statements/create.md#create-dictionary-query) 次の構造を持っています: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. -- [ソース](external_dicts_dict_sources.md) — Source of the dictionary. -- [レイアウト](external_dicts_dict_layout.md) — Dictionary layout in memory. -- [構造](external_dicts_dict_structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. -- [寿命](external_dicts_dict_lifetime.md) — Frequency of dictionary updates. - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index 9ca1ef49b30..00000000000 --- a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: "\u968E\u5C64\u8F9E\u66F8" ---- - -# 階層辞書 {#hierarchical-dictionaries} - -クリックハウスは、 [数値キー](external_dicts_dict_structure.md#ext_dict-numeric-key). - -次の階層構造を見てください: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -この階層として表現することができ、以下の辞書。 - -| region\_id | parent\_region | region\_name | -|------------|----------------|--------------| -| 1 | 0 | ロシア | -| 2 | 1 | モスクワ | -| 3 | 2 | 中央 | -| 4 | 0 | イギリス | -| 5 | 4 | ロンドン | - -この表には列が含まれます `parent_region` これには、要素の最も近い親のキーが含まれます。 - -クリックハウスは [階層](external_dicts_dict_structure.md#hierarchical-dict-attr) のための特性 [外部辞書](index.md) 属性。 このプロパティを使用すると、上記のような階層辞書を構成できます。 - -その [独裁主義体制](../../../sql_reference/functions/ext_dict_functions.md#dictgethierarchy) 関数を使用すると、要素の親チェーンを取得できます。 - -この例では、dictionaryの構造は次のようになります: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index cbfc661263e..00000000000 --- a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,373 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 41 -toc_title: "\u8F9E\u66F8\u3092\u30E1\u30E2\u30EA\u306B\u4FDD\u5B58\u3059\u308B" ---- - -# 辞書をメモリに保存する {#dicts-external-dicts-dict-layout} - -辞書をメモリに保存するには、さまざまな方法があります。 - -私たちはお勧め [フラット](#flat), [ハッシュ](#dicts-external_dicts_dict_layout-hashed) と [complex\_key\_hashed](#complex-key-hashed). 最適の処理速度を提供するかどれが。 - -キャッシュ推奨されていないものになる可能性のある性能や困難の選定に最適なパラメータ。 セクションの続きを読む “[キャッシュ](#cache)”. - -辞書のパフォーマ: - -- 後に辞書を操作する関数を呼び出します `GROUP BY`. -- 射影として抽出する属性をマークします。 異なる属性値が異なるキーに対応する場合、属性はinjectiveと呼ばれます。 だからとき `GROUP BY` キーによって属性値をフェッチする関数を使用します。 `GROUP BY`. - -ClickHouseは、辞書のエラーの例外を生成します。 エラーの例: - -- アクセス中の辞書を読み込めませんでした。 -- エラーの照会 `cached` 辞書だ - -外部辞書のリストとそのステータスを表示することができます `system.dictionaries` テーブル。 - -構成は次のようになります: - -``` xml - - - ... - - - - - - ... - - -``` - -対応 [DDL-クエリ](../../statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## 辞書をメモリに格納する方法 {#ways-to-store-dictionaries-in-memory} - -- [フラット](#flat) -- [ハッシュ](#dicts-external_dicts_dict_layout-hashed) -- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) -- [キャッシュ](#cache) -- [range\_hashed](#range-hashed) -- [complex\_key\_hashed](#complex-key-hashed) -- [complex\_key\_cache](#complex-key-cache) -- [ip\_trie](#ip-trie) - -### フラット {#flat} - -辞書は完全にフラット配列の形でメモリに格納されています。 辞書はどのくらいのメモリを使用しますか? この量は、最大のキーのサイズに比例します(使用されるスペース)。 - -辞書キーには、 `UInt64` 値は500,000に制限されます。 辞書を作成するときに大きなキーが検出された場合、ClickHouseは例外をスローし、辞書を作成しません。 - -すべてのタイプの源は支えられる。 更新時には、ファイルまたはテーブルからのデータが完全に読み取られます。 - -この方法は最高性能の中で利用可能なすべての方法を格納する辞書です。 - -構成例: - -``` xml - - - -``` - -または - -``` sql -LAYOUT(FLAT()) -``` - -### ハッシュ {#dicts-external_dicts_dict_layout-hashed} - -辞書は、ハッシュテーブルの形式でメモリに完全に格納されます。 辞書には、実際には任意の識別子を持つ任意の数の要素を含めることができ、キーの数は数千万のアイテムに達することができます。 - -すべてのタイプの源は支えられる。 更新時には、ファイルまたはテーブルからのデータが完全に読み取られます。 - -構成例: - -``` xml - - - -``` - -または - -``` sql -LAYOUT(HASHED()) -``` - -### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} - -に似て `hashed` が、使用メモリ賛以上のCPUます。 - -構成例: - -``` xml - - - -``` - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### complex\_key\_hashed {#complex-key-hashed} - -このタイプの貯蔵は合成の使用のためです [キー](external_dicts_dict_structure.md). に似て `hashed`. - -構成例: - -``` xml - - - -``` - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### range\_hashed {#range-hashed} - -辞書は、範囲とそれに対応する値の順序付けられた配列を持つハッシュテーブルの形式でメモリに格納されます。 - -このストレージメソッドは、hashedと同じように機能し、キーに加えて日付/時刻(任意の数値型)の範囲を使用できます。 - -例:この表には、各広告主の割引の形式が含まれています: - -``` text -+---------|-------------|-------------|------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------|-------------|-------------|------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------|-------------|-------------|------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------|-------------|-------------|------+ -``` - -日付範囲のサンプルを使用するには、以下を定義します `range_min` と `range_max` の要素 [構造](external_dicts_dict_structure.md). これらの要素の要素が含まれている必要があ `name` と`type` (もし `type` デフォルトのタイプが使用されます-Date)。 `type` 任意の数値型(Date/DateTime/UInt64/Int32/others)を指定できます。 - -例えば: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -または - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -これらの辞書を操作するには、追加の引数を渡す必要があります `dictGetT` 範囲が選択される関数: - -``` sql -dictGetT('dict_name', 'attr_name', id, date) -``` - -この関数は、指定された値を返します `id`sと、渡された日付を含む日付範囲。 - -アルゴリズムの詳細: - -- この `id` が見つからないか、または範囲が見つからない。 `id`、辞書のデフォルト値を返します。 -- 範囲が重複している場合は、anyを使用できます。 -- 範囲区切り文字が次の場合 `NULL` または無効な日付(1900-01-01や2039-01-01など)では、範囲は開いたままになります。 範囲は両側で開きます。 - -構成例: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -または - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### キャッシュ {#cache} - -辞書は、固定数のセルを持つキャッシュに格納されます。 これらの細胞を含む使用頻度の高います。 - -辞書を検索するときは、まずキャッシュが検索されます。 各ブロックのデータは、すべてのキーが見つからないのキャッシュ古いから要求されてソースを使用 `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. 受信したデータは、キャッシュに書き込まれます。 - -キャッシュ辞書の場合、有効期限 [寿命](external_dicts_dict_lifetime.md) キャッシュ内のデータの設定が可能です。 より多くの時間より `lifetime` セルにデータをロードしてから、セルの値は使用されず、次に使用する必要があるときに再要求されます。 -これは、辞書を格納するすべての方法の中で最も効果的ではありません。 キャッシュの速度は、正しい設定と使用シナリオに強く依存します。 キャッシュタイプの辞書は、ヒット率が十分に高い場合にのみうまく機能します(推奨99%以上)。 あなたは平均ヒット率を表示することができます `system.dictionaries` テーブル。 - -キャッシュパフォーマン `LIMIT`、および外部ディクショナリで関数を呼び出します。 - -サポート [ソース](external_dicts_dict_sources.md):MySQL、ClickHouse、実行可能ファイル、HTTP。 - -設定例: - -``` xml - - - - 1000000000 - - -``` - -または - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -十分なキャッシュサイズを設定します。 あなたは、セルの数を選択する実験する必要があります: - -1. 値を設定します。 -2. キャッシュが一杯になるまでクエリを実行します。 -3. を使用してメモリ消費量を評価する `system.dictionaries` テーブル。 -4. 必要なメモリ消費量に達するまで、セル数を増減します。 - -!!! warning "警告" - ランダムな読み取りでクエリを処理するのが遅いため、ソースとしてclickhouseを使用しないでください。 - -### complex\_key\_cache {#complex-key-cache} - -このタイプの貯蔵は合成の使用のためです [キー](external_dicts_dict_structure.md). に似て `cache`. - -### ip\_trie {#ip-trie} - -このタイプの貯蔵するマッピングするネットワーク接頭辞(ipアドレスへのメタデータなどのasn. - -例:テーブルを含むネットワークの接頭辞およびその対応としての数および国コード: - -``` text - +-----------|-----|------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------|-----|------+ - | 2620:0:870::/48 | 3856 | US | - +-----------|-----|------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------|-----|------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------|-----|------+ -``` - -このタイプのレイアウトを使用する場合、構造に複合キーが必要です。 - -例えば: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -または - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -キーには、許可されたipプレフィックスを含む文字列型属性のみが必要です。 その他のタイプはサポートされていませんか。 - -クエリの場合は、同じ関数を使用する必要があります (`dictGetT` 複合キーを持つ辞書については、タプルを使用する: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -のいずれか `UInt32` IPv4の場合、または `FixedString(16)` IPv6の場合: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -その他のタイプはサポートされていませんか。 この関数は、このipアドレスに対応するプレフィックスの属性を返します。 がある場合に重なる接頭辞であり、具体的には返却されます。 - -データは `trie`. それは完全にRAMに収まる必要があります。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index fbbc6b8fa97..00000000000 --- a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 42 -toc_title: "\u8F9E\u66F8\u306E\u66F4\u65B0" ---- - -# 辞書の更新 {#dictionary-updates} - -ClickHouseは定期的に辞書を更新します。 完全にダウンロードされたディクショナリの更新間隔とキャッシュされたディクショナ `` 秒の札。 - -辞書の更新(最初の使用のための読み込み以外)は、クエリをブロックしません。 更新時には、古いバージョンの辞書が使用されます。 更新中にエラーが発生すると、エラーがサーバーログに書き込まれ、古いバージョンの辞書が引き続き使用されます。 - -設定例: - -``` xml - - ... - 300 - ... - -``` - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -設定 `0` (`LIFETIME(0)`)辞書が更新されないようにします。 - -アップグレードの時間間隔を設定することができ、clickhouseはこの範囲内で一様にランダムな時間を選択します。 これは、多数のサーバーでアップグレードするときに、ディクショナリソースに負荷を分散するために必要です。 - -設定例: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -または - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -ップする場合には辞書にclickhouseサーバーに適用の異なるロジックの種類によって [ソース](external_dicts_dict_sources.md): - -- テキストファイルの場合は、変更の時間をチェックします。 時間が以前に記録された時間と異なる場合、辞書は更新されます。 -- MyISAMテーブルの場合、変更時刻は次のようにしてチェックされます `SHOW TABLE STATUS` クエリ。 -- 他のソースからの辞書は、デフォルトで毎回updatedされます。 - -MySQL(InnoDB)、ODBC、ClickHouseのソースでは、辞書が実際に変更された場合にのみ、毎回ではなく、辞書を更新するクエリを設定できます。 これを行うには、次の手順に従います: - -- 辞書に表れてい分野に常に変化するソースデータを更新しました。 -- ソースの設定では、変更フィールドを取得するクエリを指定する必要があります。 クリックハウスサーバーは、クエリ結果を行として解釈し、この行が以前の状態に対して変更されている場合は、辞書が更新されます。 クエリを指定します。 `` の設定のフィールド [ソース](external_dicts_dict_sources.md). - -設定例: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -または - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index 7876b1d00b0..00000000000 --- a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,608 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 43 -toc_title: "\u5916\u90E8\u8F9E\u66F8\u306E\u30BD\u30FC\u30B9" ---- - -# 外部辞書のソース {#dicts-external-dicts-dict-sources} - -外部辞書は、さまざまなソースから接続できます。 - -辞書がxmlファイルを使用して設定されている場合、設定は次のようになります: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -の場合 [DDL-クエリ](../../statements/create.md#create-dictionary-query)、等しい構成は次のようになります: - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -ソースは、 `source` セクション。 - -ソースの種類 (`source_type`): - -- [Localファイル](#dicts-external_dicts_dict_sources-local_file) -- [実行可能ファイル](#dicts-external_dicts_dict_sources-executable) -- [HTTP(s)](#dicts-external_dicts_dict_sources-http) -- DBMS - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [クリックハウス](#dicts-external_dicts_dict_sources-clickhouse) - - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) - - [レディス](#dicts-external_dicts_dict_sources-redis) - -## Localファイル {#dicts-external_dicts_dict_sources-local_file} - -設定例: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -または - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -フィールドの設定: - -- `path` – The absolute path to the file. -- `format` – The file format. All the formats described in “[形式](../../../interfaces/formats.md#formats)” サポートされます。 - -## 実行可能ファイル {#dicts-external_dicts_dict_sources-executable} - -実行可能ファイルの操作は [辞書がメモリにどのように格納されるか](external_dicts_dict_layout.md). 辞書が以下を使用して格納されている場合 `cache` と `complex_key_cache` ClickHouseは、実行可能ファイルのSTDINに要求を送信することによって、必要なキーを要求します。 その他、ClickHouse始まり実行可能ファイルを扱い、その出力としての辞書のデータです。 - -設定例: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -または - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -フィールドの設定: - -- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). -- `format` – The file format. All the formats described in “[形式](../../../interfaces/formats.md#formats)” サポートされます。 - -## Http(s) {#dicts-external_dicts_dict_sources-http} - -HTTP(s)サーバーの操作は次の条件によって異なります [辞書がメモリにどのように格納されるか](external_dicts_dict_layout.md). 辞書が以下を使用して格納されている場合 `cache` と `complex_key_cache`、ClickHouse要求を送信することによって必要なキーを経由して `POST` 方法。 - -設定例: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -または - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -ClickHouseがHTTPSリソースにアクセスするには、次のことが必要です [openSSLを設定](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-openssl) サーバー構成で。 - -フィールドの設定: - -- `url` – The source URL. -- `format` – The file format. All the formats described in “[形式](../../../interfaces/formats.md#formats)” サポートされます。 -- `credentials` – Basic HTTP authentication. Optional parameter. - - `user` – Username required for the authentication. - - `password` – Password required for the authentication. -- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. - - `header` – Single HTTP header entry. - - `name` – Identifiant name used for the header send on the request. - - `value` – Value set for a specific identifiant name. - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -このメソッドを使用して、odbcドライバーを持つデータベースを接続できます。 - -設定例: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -または - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -フィールドの設定: - -- `db` – Name of the database. Omit it if the database name is set in the `` パラメータ。 -- `table` – Name of the table and schema if exists. -- `connection_string` – Connection string. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [辞書の更新](external_dicts_dict_lifetime.md). - -ClickHouseはODBCドライバからクォート記号を受け取り、クエリのすべての設定をドライバに引用するので、データベースのテーブル名に応じてテーブル名を設定する - -Oracleを使用しているときにエンコードに問題がある場合は、対応する [FAQ](../../../faq/general.md#oracle-odbc-encodings) 記事。 - -### ODBCディクショナリ機能の既知の脆弱性 {#known-vulnerability-of-the-odbc-dictionary-functionality} - -!!! attention "注意" - ODBC driver connectionパラメーターを使用してデータベースに接続する場合 `Servername` 置換することができる。 この場合、 `USERNAME` と `PASSWORD` から `odbc.ini` リモートサーバーに送信され、侵害される可能性があります。 - -**安全でない使用例** - -PostgreSQL用にunixODBCを設定してみましょう。 の内容 `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -次に、次のようなクエリを作成します - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -ODBCドライバーの値を送信します `USERNAME` と `PASSWORD` から `odbc.ini` に `some-server.com`. - -### Postgresqlの接続例 {#example-of-connecting-postgresql} - -UbuntuのOS。 - -UnixODBCとPostgreSQL用のODBCドライバのインストール: - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -設定 `/etc/odbc.ini` (または `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -クリックハウスの辞書構成: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -または - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) -``` - -編集が必要な場合があります `odbc.ini` ドライバを使用してライブラリへのフルパスを指定するには `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### MS SQL Serverの接続例 {#example-of-connecting-ms-sql-server} - -UbuntuのOS。 - -設置のドライバー: : - -``` bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -ドライバの設定: - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -ClickHouseでの辞書の設定: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -または - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## DBMS {#dbms} - -### Mysql {#dicts-external_dicts_dict_sources-mysql} - -設定例: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -または - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -フィールドの設定: - -- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). - -- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `replica` – Section of replica configurations. There can be multiple sections. - - - `replica/host` – The MySQL host. - - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. - -- `db` – Name of the database. - -- `table` – Name of the table. - -- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` たとえば、MySQLの句, `id > 10 AND id < 20`. 省略可能なパラメータ。 - -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [辞書の更新](external_dicts_dict_lifetime.md). - -MySQLは、ローカルホスト上でソケット経由で接続できます。 これを行うには、 `host` と `socket`. - -設定例: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -または - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### クリックハウス {#dicts-external_dicts_dict_sources-clickhouse} - -設定例: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -または - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -フィールドの設定: - -- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [分散](../../../engines/table_engines/special/distributed.md) テーブルと後続の構成でそれを入力します。 -- `port` – The port on the ClickHouse server. -- `user` – Name of the ClickHouse user. -- `password` – Password of the ClickHouse user. -- `db` – Name of the database. -- `table` – Name of the table. -- `where` – The selection criteria. May be omitted. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [辞書の更新](external_dicts_dict_lifetime.md). - -### Mongodb {#dicts-external_dicts_dict_sources-mongodb} - -設定例: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -または - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -フィールドの設定: - -- `host` – The MongoDB host. -- `port` – The port on the MongoDB server. -- `user` – Name of the MongoDB user. -- `password` – Password of the MongoDB user. -- `db` – Name of the database. -- `collection` – Name of the collection. - -### レディス {#dicts-external_dicts_dict_sources-redis} - -設定例: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -または - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -フィールドの設定: - -- `host` – The Redis host. -- `port` – The port on the Redis server. -- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` 単純なソースとハッシュされた単一のキーソース用です, `hash_map` は用ハッシュソースで二つのキー。 距源およびキャッシュ源の複雑な鍵サポートされていません。 省略することができ、デフォルト値は `simple`. -- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index 07d639043a6..00000000000 --- a/docs/ja/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 44 -toc_title: "\u8F9E\u66F8\u306E\u30AD\u30FC\u3068\u30D5\u30A3\u30FC\u30EB\u30C9" ---- - -# 辞書のキーとフィールド {#dictionary-key-and-fields} - -その `` 条項の辞書のキーや分野での利用ます。 - -XMLの説明: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -属性は要素に記述されています: - -- `` — [キー列](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [データ列](external_dicts_dict_structure.md#ext_dict_structure-attributes). 複数の属性を指定できます。 - -DDLクエリ: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -属性はクエリ本文に記述されます: - -- `PRIMARY KEY` — [キー列](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [データ列](external_dicts_dict_structure.md#ext_dict_structure-attributes). 複数の属性を指定できます。 - -## キー {#ext_dict_structure-key} - -ClickHouseは次の種類のキーをサポートしています: - -- 数値キー。 `UInt64`. で定義される `` タグまたは使用 `PRIMARY KEY` キーワード。 -- 複合キー。 異なるタイプの値のセット。 タグ内で定義されている `` または `PRIMARY KEY` キーワード。 - -Xmlの構造を含むことができま `` または ``. DDL-クエリにsingleを含める必要があります `PRIMARY KEY`. - -!!! warning "警告" - Keyを属性として記述することはできません。 - -### 数値キー {#ext_dict-numeric-key} - -タイプ: `UInt64`. - -構成例: - -``` xml - - Id - -``` - -設定フィールド: - -- `name` – The name of the column with keys. - -DDLクエリの場合: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – The name of the column with keys. - -### 複合キー {#composite-key} - -キーは次のようになります `tuple` フィールドの任意のタイプから。 その [レイアウト](external_dicts_dict_layout.md) この場合、 `complex_key_hashed` または `complex_key_cache`. - -!!! tip "ヒント" - 複合キーは、単一の要素で構成できます。 これにより、たとえば文字列をキーとして使用することができます。 - -キー構造は要素で設定されます ``. キーフィールドは、ディクショナリと同じ形式で指定します [属性](external_dicts_dict_structure.md). 例えば: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -または - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -クエリの場合 `dictGet*` 関数は、タプルがキーとして渡されます。 例えば: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## 属性 {#ext_dict_structure-attributes} - -構成例: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -または - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -設定フィールド: - -| タグ | 説明 | 必須 | -|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| -| `name` | 列名。 | はい。 | -| `type` | ClickHouseデータタイプ。
ClickHouseは、dictionaryから指定されたデータ型に値をキャストしようとします。 例えば、MySQLの場合、フィールドは次のようになります `TEXT`, `VARCHAR`、または `BLOB` MySQLソーステーブルでは、次のようにアップロードできます `String` クリックハウスで。
[Nullable](../../../sql_reference/data_types/nullable.md) サポートされていない。 | はい。 | -| `null_value` | 既存の要素以外の要素のデフォルト値。
この例では、空の文字列です。 使用できません `NULL` この分野で。 | はい。 | -| `expression` | [式](../../syntax.md#syntax-expressions) そのClickHouseはその値を実行します。
この式には、リモートsqlデータベースの列名を指定できます。 したがって、これを使用して、リモート列の別名を作成できます。

デフォルト値:式なし。 | いいえ。 | -| `hierarchical` | もし `true`、属性は、現在のキーの親キーの値が含まれています。 見る [階層辞書](external_dicts_dict_hierarchical.md).

デフォルト値: `false`. | いいえ。 | -| `injective` | このフラグは、 `id -> attribute` 画像は [射影](https://en.wikipedia.org/wiki/Injective_function).
もし `true`、ClickHouseはの後に自動的に置くことができます `GROUP BY` 句注入を伴う辞書への要求。 通常、そのような要求の量が大幅に削減されます。

デフォルト値: `false`. | いいえ。 | -| `is_object_id` | MongoDBドキュメントに対してクエリが実行されるかどうかを示すフラグ `ObjectID`.

デフォルト値: `false`. | いいえ。 | - -## また見なさい {#see-also} - -- [外部辞書を操作するための関数](../../../sql_reference/functions/ext_dict_functions.md). - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/ja/sql_reference/dictionaries/index.md b/docs/ja/sql_reference/dictionaries/index.md deleted file mode 100644 index bd08b421555..00000000000 --- a/docs/ja/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Dictionaries -toc_priority: 35 -toc_title: "\u5C0E\u5165" ---- - -# 辞書 {#dictionaries} - -辞書はマッピングです (`key -> attributes`)それはさまざまなタイプの参照リストのために便利です。 - -ClickHouseは、クエリで使用できる辞書を操作するための特別な機能をサポートしています。 Aよりも関数で辞書を使用する方が簡単で効率的です `JOIN` 参照テーブルと。 - -[NULL](../syntax.md#null) 値を辞書に格納することはできません。 - -ClickHouse支援: - -- [内蔵の辞書](internal_dicts.md#internal_dicts) 特定の [関数のセット](../../sql_reference/functions/ym_dict_functions.md). -- [プラグイン(外部)辞書](external_dictionaries/external_dicts.md) と [機能のネット](../../sql_reference/functions/ext_dict_functions.md). - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/ja/sql_reference/dictionaries/internal_dicts.md b/docs/ja/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index 93e1b990819..00000000000 --- a/docs/ja/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u5185\u90E8\u8F9E\u66F8" ---- - -# 内部辞書 {#internal_dicts} - -ClickHouseには、ジオベースを操作するための組み込み機能が含まれています。 - -ことができ: - -- 地域のidを使用して、目的の言語でその名前を取得します。 -- 地域のidを使用して、都市、地域、連邦区、国、または大陸のidを取得します。 -- 領域が別の領域の一部であるかどうかを確認します。 -- 親領域のチェーンを取得します。 - -すべての機能サポート “translocality,” 同時に地域の所有権に異なる視点を使用する機能。 詳細については、以下を参照してください “Functions for working with Yandex.Metrica dictionaries”. - -内部辞書は、既定のパッケージでは無効になっています。 -よって、strncasecmpのパラメータ `path_to_regions_hierarchy_file` と `path_to_regions_names_files` サーバー設定ファイルで。 - -Geobaseはテキストファイルからロードされます。 - -場所は `regions_hierarchy*.txt` へのファイル `path_to_regions_hierarchy_file` ディレクトリ。 この構成パラ `regions_hierarchy.txt` ファイル(デフォルトの地域階層)、およびその他のファイル (`regions_hierarchy_ua.txt`)同じディレクトリに配置する必要があります。 - -を置く `regions_names_*.txt` のファイル `path_to_regions_names_files` ディレクトリ。 - -を作ることもできますこれらのファイル。 ファイルフォーマットは以下: - -`regions_hierarchy*.txt`:TabSeparated(ヘッダーなし)、列: - -- 地域ID (`UInt32`) -- 親リージョンID (`UInt32`) -- 地域タイプ (`UInt8`):1-大陸,3-国,4-連邦区,5-地域,6-都市;その他のタイプには値がありません -- 人口 (`UInt32`) — optional column - -`regions_names_*.txt`:TabSeparated(ヘッダーなし)、列: - -- 地域ID (`UInt32`) -- 地域名 (`String`) — Can't contain tabs or line feeds, even escaped ones. - -フラット配列は、ramに格納するために使用されます。 このため、idは百万を超えてはいけません。 - -辞書は、サーバーを再起動せずに更新できます。 ただし、使用可能な辞書のセットは更新されません。 -更新の場合、ファイルの修正時刻がチェックされます。 ファイルが変更された場合は、辞書が更新されます。 -変更をチェックする間隔は、 `builtin_dictionaries_reload_interval` パラメータ。 -辞書updates(最初の使用時の読み込み以外)は、クエリをブロックしません。 更新時には、クエリは古いバージョンの辞書を使用します。 更新中にエラーが発生すると、エラーがサーバーログに書き込まれ、古いバージョンの辞書が引き続き使用されます。 - -Geobaseで辞書を定期的に更新することをお勧めします。 更新中に、新しいファイルを生成し、別の場所に書き込みます。 すべての準備ができたら、サーバーが使用するファイルに名前を変更します。 - -また、os識別子とyandexを操作するための機能もあります。metricaの調査エンジン、しかしそれらは使用されるべきではない。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/ja/sql_reference/functions/array_functions.md b/docs/ja/sql_reference/functions/array_functions.md deleted file mode 100644 index bf3e70eac33..00000000000 --- a/docs/ja/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,1057 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 46 -toc_title: "\u914D\u5217\u306E\u64CD\u4F5C" ---- - -# 配列を操作するための関数 {#functions-for-working-with-arrays} - -## 空 {#function-empty} - -空の配列の場合は1、空でない配列の場合は0を返します。 -結果の型はuint8です。 -この関数は文字列に対しても機能します。 - -## notEmpty {#function-notempty} - -空の配列の場合は0、空でない配列の場合は1を返します。 -結果の型はuint8です。 -この関数は文字列に対しても機能します。 - -## 長さ {#array_functions-length} - -配列内の項目の数を返します。 -結果の型はuint64です。 -この関数は文字列に対しても機能します。 - -## emptyArrayUInt8,emptyArrayUInt16,emptyArrayUInt32,emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## emptyArrayInt8,emptyArrayInt16,emptyArrayInt32,emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## emptyArrayFloat32,emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} - -## emptyArrayDate,emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} - -## constellation name(optional) {#emptyarraystring} - -ゼロ引数を受け取り、適切な型の空の配列を返します。 - -## emptyArrayToSingle {#emptyarraytosingle} - -空の配列を受け取り、デフォルト値と等しいワンエレメント配列を返します。 - -## 範囲(終了)、範囲(開始、終了\[、ステップ\]) {#rangeend-rangestart-end-step} - -開始から終了までの数字の配列を返します-1ステップごとに。 -これは、 `start` デフォルトは0です。 -これは、 `step` デフォルトは1です。 -それはpythonicのように動作します `range`. しかし、違いは、すべての引数の型が `UInt` ナンバーズ -場合によっては、データブロック内に100,000,000要素を超える長さの配列が作成された場合、例外がスローされます。 - -## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} - -関数の引数から配列を作成します。 -引数は定数でなければならず、最小の共通型を持つ型を持つ必要があります。 なぜなら、それ以外の場合は、どのタイプの配列を作成するかは明確ではないからです。 つまり、この関数を使用して空の配列を作成することはできません(これを行うには、 ‘emptyArray\*’ 上記の関数)。 -を返します。 ‘Array(T)’ タイプの結果、ここで ‘T’ 渡された引数のうち最小の共通型です。 - -## arrayConcat {#arrayconcat} - -引数として渡される配列を結合します。 - -``` sql -arrayConcat(arrays) -``` - -**パラメータ** - -- `arrays` – Arbitrary number of arguments of [配列](../../sql_reference/data_types/array.md) タイプ。 - **例えば** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,3,4,5,6] │ -└───────────────┘ -``` - -## arrayElement(arr,n),演算子arr\[n\] {#arrayelementarr-n-operator-arrn} - -インデックスを持つ要素を取得する `n` 配列から `arr`. `n` 任意の整数型でなければなりません。 -インデックス配列の開始からです。 -負の索引がサポートされます。 この場合、最後から番号が付けられた対応する要素を選択します。 例えば, `arr[-1]` 配列の最後の項目です。 - -インデックスが配列の境界の外にある場合、いくつかのデフォルト値(数値の場合は0、文字列の場合は空の文字列など)を返します。)、非定数配列と定数インデックス0の場合を除いて(この場合はエラーが発生します `Array indices are 1-based`). - -## has(arr,elem) {#hasarr-elem} - -この ‘arr’ 配列には ‘elem’ 要素。 -要素が配列にない場合は0、ない場合は1を返します。 - -`NULL` 値として処理されます。 - -``` sql -SELECT has([1, 2, NULL], NULL) -``` - -``` text -┌─has([1, 2, NULL], NULL)─┐ -│ 1 │ -└─────────────────────────┘ -``` - -## hasAll {#hasall} - -ある配列が別の配列のサブセットかどうかを調べます。 - -``` sql -hasAll(set, subset) -``` - -**パラメータ** - -- `set` – Array of any type with a set of elements. -- `subset` – Array of any type with elements that should be tested to be a subset of `set`. - -**戻り値** - -- `1`,もし `set` からのすべての要素を含みます `subset`. -- `0` そうでなければ - -**特有の性質** - -- 空の配列は、任意の配列のサブセットです。 -- `Null` 値として処理されます。 -- 両方の配列の値の順序は関係ありません。 - -**例** - -`SELECT hasAll([], [])` 戻り値1. - -`SELECT hasAll([1, Null], [Null])` 戻り値1. - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` 戻り値1. - -`SELECT hasAll(['a', 'b'], ['a'])` 戻り値1. - -`SELECT hasAll([1], ['a'])` 0を返します。 - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` 0を返します。 - -## hasAny {#hasany} - -るかどうかを判二つの配列が互いの交差点にある。 - -``` sql -hasAny(array1, array2) -``` - -**パラメータ** - -- `array1` – Array of any type with a set of elements. -- `array2` – Array of any type with a set of elements. - -**戻り値** - -- `1`,もし `array1` と `array2` 少なくとも同様の要素を持っている。 -- `0` そうでなければ - -**特有の性質** - -- `Null` 値として処理されます。 -- 両方の配列の値の順序は関係ありません。 - -**例** - -`SELECT hasAny([1], [])` を返します `0`. - -`SELECT hasAny([Null], [Null, 1])` を返します `1`. - -`SELECT hasAny([-128, 1., 512], [1])` を返します `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` を返します `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` を返します `1`. - -## インデクサー(arr,x) {#indexofarr-x} - -最初のインデックスを返します ‘x’ 要素(配列内にある場合は1から開始)、そうでない場合は0。 - -例えば: - -``` sql -SELECT indexOf([1, 3, NULL, NULL], NULL) -``` - -``` text -┌─indexOf([1, 3, NULL, NULL], NULL)─┐ -│ 3 │ -└───────────────────────────────────┘ -``` - -に設定された要素 `NULL` 通常の値として扱われます。 - -## countEqual(arr,x) {#countequalarr-x} - -配列内のxと等しい要素の数を返します。arraycount(elem-\>elem=x,arr)と等価です。 - -`NULL` 要素は個別の値として処理されます。 - -例えば: - -``` sql -SELECT countEqual([1, 2, NULL, NULL], NULL) -``` - -``` text -┌─countEqual([1, 2, NULL, NULL], NULL)─┐ -│ 2 │ -└──────────────────────────────────────┘ -``` - -## arrayEnumerate(arr) {#array_functions-arrayenumerate} - -Returns the array \[1, 2, 3, …, length (arr) \] - -この関数は通常、array joinと共に使用されます。 この計数かけま配列に適用後の配列。 例えば: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -この例では、reachesは変換の数(配列結合を適用した後に受け取った文字列)であり、hitsはページビューの数(配列結合の前の文字列)です。 この特定のケースでは、同じ結果をより簡単な方法で得ることができます: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -この関数は、高階関数でも使用できます。 たとえば、これを使用して、条件に一致する要素の配列インデックスを取得できます。 - -## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} - -ソース配列と同じサイズの配列を返し、各要素に対して同じ値を持つ要素間の位置を示します。 -例えば:arrayenumerateuniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. - -この関数は、配列要素の配列の結合と集約を使用する場合に便利です。 -例えば: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - -``` text -┌──GoalID─┬─Reaches─┬─Visits─┐ -│ 53225 │ 3214 │ 1097 │ -│ 2825062 │ 3188 │ 1097 │ -│ 56600 │ 2803 │ 488 │ -│ 1989037 │ 2401 │ 365 │ -│ 2830064 │ 2396 │ 910 │ -│ 1113562 │ 2372 │ 373 │ -│ 3270895 │ 2262 │ 812 │ -│ 1084657 │ 2262 │ 345 │ -│ 56599 │ 2260 │ 799 │ -│ 3271094 │ 2256 │ 812 │ -└─────────┴─────────┴────────┘ -``` - -この例では、各ゴールidには、コンバージョン数(ゴールネストされたデータ構造の各要素は、達成されたゴールであり、コンバージョンと呼ばれます)とセッション 配列の結合がなければ、セッション数をsum(sign)としてカウントします。 しかし、この特定のケースでは、行はネストされたgoals構造体で乗算されたので、この後に各セッションをカウントするために、arrayenumerateuniq()の値に条件を適用しまgoals.id)関数。 - -ArrayEnumerateUniq関数は、引数と同じサイズの複数の配列を取ることができます。 この場合、すべての配列の同じ位置にある要素のタプルに対して一意性が考慮されます。 - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,1,1,2,1] │ -└───────────────┘ -``` - -これは、ネストされたデータ構造で配列結合を使用し、この構造内の複数の要素間でさらに集約する場合に必要です。 - -## arrayPopBack {#arraypopback} - -配列から最後の項目を削除します。 - -``` sql -arrayPopBack(array) -``` - -**パラメータ** - -- `array` – Array. - -**例えば** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## arrayPopFront {#arraypopfront} - -配列から最初の項目を削除します。 - -``` sql -arrayPopFront(array) -``` - -**パラメータ** - -- `array` – Array. - -**例えば** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [2,3] │ -└───────┘ -``` - -## arrayPushBack {#arraypushback} - -配列の末尾に一つの項目を追加します。 - -``` sql -arrayPushBack(array, single_value) -``` - -**パラメータ** - -- `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` 配列のデータ型の型。 ClickHouseのデータ型の詳細については、以下を参照してください “[データ型](../../sql_reference/data_types/index.md#data_types)”. できる。 `NULL`. この関数は、 `NULL` 配列への要素、および配列要素の型に変換します `Nullable`. - -**例えば** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayPushFront {#arraypushfront} - -配列の先頭に一つの要素を追加します。 - -``` sql -arrayPushFront(array, single_value) -``` - -**パラメータ** - -- `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` 配列のデータ型の型。 ClickHouseのデータ型の詳細については、以下を参照してください “[データ型](../../sql_reference/data_types/index.md#data_types)”. できる。 `NULL`. この関数は、 `NULL` 配列への要素、および配列要素の型に変換します `Nullable`. - -**例えば** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayResize {#arrayresize} - -配列の長さを変更します。 - -``` sql -arrayResize(array, size[, extender]) -``` - -**パラメータ:** - -- `array` — Array. -- `size` — Required length of the array. - - もし `size` 配列の元のサイズより小さい場合、配列は右から切り捨てられます。 -- もし `size` は配列の初期サイズより大きく、配列は次のように右に拡張されます `extender` 配列項目のデータ型の値または既定値。 -- `extender` — Value for extending an array. Can be `NULL`. - -**戻り値:** - -長さの配列 `size`. - -**通話の例** - -``` sql -SELECT arrayResize([1], 3) -``` - -``` text -┌─arrayResize([1], 3)─┐ -│ [1,0,0] │ -└─────────────────────┘ -``` - -``` sql -SELECT arrayResize([1], 3, NULL) -``` - -``` text -┌─arrayResize([1], 3, NULL)─┐ -│ [1,NULL,NULL] │ -└───────────────────────────┘ -``` - -## arraySlice {#arrayslice} - -配列のスライスを返します。 - -``` sql -arraySlice(array, offset[, length]) -``` - -**パラメータ** - -- `array` – Array of data. -- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. -- `length` -必要なスライスの長さ。 負の値を指定すると、関数は開いているスライスを返します `[offset, array_length - length)`. 値を省略すると、関数はスライスを返します `[offset, the_end_of_array]`. - -**例えば** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - -``` text -┌─res────────┐ -│ [2,NULL,4] │ -└────────────┘ -``` - -に設定された配列要素 `NULL` 通常の値として扱われます。 - -## arraySort(\[func,\] arr, …) {#array_functions-sort} - -の要素をソートします `arr` 昇順の配列。 この `func` の結果によって決定される。 `func` 関数は、配列の要素に適用されます。 もし `func` 複数の引数を受け取る。 `arraySort` 関数はいくつかの配列を渡されます。 `func` に対応します。 詳しい例は終わりにの示されています `arraySort` 説明。 - -整数値のソート例: - -``` sql -SELECT arraySort([1, 3, 3, 0]); -``` - -``` text -┌─arraySort([1, 3, 3, 0])─┐ -│ [0,1,3,3] │ -└─────────────────────────┘ -``` - -文字列値のソートの例: - -``` sql -SELECT arraySort(['hello', 'world', '!']); -``` - -``` text -┌─arraySort(['hello', 'world', '!'])─┐ -│ ['!','hello','world'] │ -└────────────────────────────────────┘ -``` - -次の並べ替え順序を考えてみましょう。 `NULL`, `NaN` と `Inf` 値: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - -``` text -┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ -│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────────────────────────┘ -``` - -- `-Inf` 値は配列の最初のものです。 -- `NULL` 値は配列の最後です。 -- `NaN` 値は直前です `NULL`. -- `Inf` 値は直前です `NaN`. - -それに注意 `arraySort` は [高階関数](higher_order_functions.md). 最初の引数としてラムダ関数を渡すことができます。 この場合、並べ替え順序は、配列の要素に適用されるlambda関数の結果によって決まります。 - -次の例を考えてみましょう: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,2,1] │ -└─────────┘ -``` - -For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` 関数はキーを昇順にソートし、結果は\[3,2,1\]になります。 このように、 `(x) –> -x` ラムダ関数は、 [降順](#array_functions-reverse-sort) ソートで。 - -Lambda関数は複数の引数を受け取ることができます。 この場合、次のものを渡す必要があります `arraySort` 関数lambda関数の引数が対応する同じ長さのいくつかの配列。 結果の配列は最初の入力配列の要素で構成され、次の入力配列の要素はソートキーを指定します。 例えば: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -ここでは、第二の配列(\[2、1\])に渡される要素は、ソース配列から対応する要素のソートキーを定義します (\[‘hello’, ‘world’\])、それは, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn't use `x` ソース配列の実際の値は、結果の順序には影響しません。 だから, ‘hello’ 結果の二番目の要素になります。 ‘world’ 最初になります。 - -その他の例を以下に示す。 - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! note "メモ" - 効率を分類することを改善するため [シュワルツ語変換](https://en.wikipedia.org/wiki/Schwartzian_transform) 使用される。 - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} - -の要素をソートします `arr` 降順での配列。 この `func` 機能は指定されます, `arr` の結果に従ってソートされます。 `func` 関数は、配列の要素に適用され、その後、ソートされた配列が反転されます。 もし `func` 複数の引数を受け取る。 `arrayReverseSort` 関数はいくつかの配列を渡されます。 `func` に対応します。 詳しい例は終わりにの示されています `arrayReverseSort` 説明。 - -整数値のソート例: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - -``` text -┌─arrayReverseSort([1, 3, 3, 0])─┐ -│ [3,3,1,0] │ -└────────────────────────────────┘ -``` - -文字列値のソートの例: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - -``` text -┌─arrayReverseSort(['hello', 'world', '!'])─┐ -│ ['world','hello','!'] │ -└───────────────────────────────────────────┘ -``` - -次の並べ替え順序を考えてみましょう。 `NULL`, `NaN` と `Inf` 値: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` text -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- `Inf` 値は配列の最初のものです。 -- `NULL` 値は配列の最後です。 -- `NaN` 値は直前です `NULL`. -- `-Inf` 値は直前です `NaN`. - -それに注意しなさい `arrayReverseSort` は [高階関数](higher_order_functions.md). 最初の引数としてラムダ関数を渡すことができます。 例を以下に示す。 - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [1,2,3] │ -└─────────┘ -``` - -配列は次の方法でソートされます: - -1. 最初に、ソース配列(\[1、2、3\])は、配列の要素に適用されたラムダ関数の結果に従ってソートされます。 結果は配列\[3,2,1\]です。 -2. 前のステップで取得された配列は、逆になります。 したがって、最終的な結果は\[1,2,3\]です。 - -Lambda関数は複数の引数を受け取ることができます。 この場合、次のものを渡す必要があります `arrayReverseSort` 関数lambda関数の引数が対応する同じ長さのいくつかの配列。 結果の配列は最初の入力配列の要素で構成され、次の入力配列の要素はソートキーを指定します。 例えば: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -この例では、配列は次のようにソートされています: - -1. 最初に、ソース配列 (\[‘hello’, ‘world’\])は、配列の要素に適用されたラムダ関数の結果に従ってソートされます。 第二の配列(\[2、1\])に渡される要素は、ソース配列から対応する要素のソートキーを定義します。 結果は配列です \[‘world’, ‘hello’\]. -2. 前のステップでソートされた配列は、逆になります。 したがって、最終的な結果は \[‘hello’, ‘world’\]. - -その他の例を以下に示す。 - -``` sql -SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; -``` - -``` text -┌─res─────┐ -│ [5,3,4] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` text -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#arrayuniqarr} - -一つの引数が渡された場合、それは、配列内の異なる要素の数をカウントします。 -複数の引数が渡されると、複数の配列内の対応する位置にある要素の異なるタプルの数がカウントされます。 - -配列内の一意の項目のリストを取得する場合は、arrayreduceを使用できます(‘groupUniqArray’、arr)。 - -## arrayJoin(arr) {#array-functions-join} - -特殊関数。 セクションを見る [“ArrayJoin function”](array_join.md#functions_arrayjoin). - -## arrayDifference {#arraydifference} - -隣接する配列要素間の差を計算します。 最初の要素が0になる配列を返します。 `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). - -**構文** - -``` sql -arrayDifference(array) -``` - -**パラメータ** - -- `array` – [配列](https://clickhouse.yandex/docs/en/data_types/array/). - -**戻り値** - -隣接する要素間の差異の配列を返します。 - -タイプ: [UInt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [フロート\*](https://clickhouse.yandex/docs/en/data_types/float/). - -**例えば** - -クエリ: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - -結果: - -``` text -┌─arrayDifference([1, 2, 3, 4])─┐ -│ [0,1,1,1] │ -└───────────────────────────────┘ -``` - -結果の型int64によるオーバーフローの例: - -クエリ: - -``` sql -SELECT arrayDifference([0, 10000000000000000000]) -``` - -結果: - -``` text -┌─arrayDifference([0, 10000000000000000000])─┐ -│ [0,-8446744073709551616] │ -└────────────────────────────────────────────┘ -``` - -## arrayDistinct {#arraydistinct} - -配列をとり、distinct要素のみを含む配列を返します。 - -**構文** - -``` sql -arrayDistinct(array) -``` - -**パラメータ** - -- `array` – [配列](https://clickhouse.yandex/docs/en/data_types/array/). - -**戻り値** - -Distinct要素を含む配列を返します。 - -**例えば** - -クエリ: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - -結果: - -``` text -┌─arrayDistinct([1, 2, 2, 3, 1])─┐ -│ [1,2,3] │ -└────────────────────────────────┘ -``` - -## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} - -ソース配列と同じサイズの配列を返し、各要素がソース配列のどこに最初に現れるかを示します。 - -例えば: - -``` sql -SELECT arrayEnumerateDense([10, 20, 10, 30]) -``` - -``` text -┌─arrayEnumerateDense([10, 20, 10, 30])─┐ -│ [1,2,1,3] │ -└───────────────────────────────────────┘ -``` - -## arrayIntersect(arr) {#array-functions-arrayintersect} - -複数の配列を取り、すべてのソース配列に存在する要素を持つ配列を返します。 結果の配列内の要素の順序は、最初の配列と同じです。 - -例えば: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - -``` text -┌─no_intersect─┬─intersect─┐ -│ [] │ [1] │ -└──────────────┴───────────┘ -``` - -## arrayReduce {#arrayreduce} - -集計関数を配列要素に適用し、その結果を返します。 集約関数の名前は、一重引quotesで文字列として渡されます `'max'`, `'sum'`. パラメトリック集約関数を使用する場合、パラメータは関数名の後に括弧で囲んで示されます `'uniqUpTo(6)'`. - -**構文** - -``` sql -arrayReduce(agg_func, arr1, arr2, ..., arrN) -``` - -**パラメータ** - -- `agg_func` — The name of an aggregate function which should be a constant [文字列](../../sql_reference/data_types/string.md). -- `arr` — Any number of [配列](../../sql_reference/data_types/array.md) 集計関数のパラメーターとして列を入力します。 - -**戻り値** - -**例えば** - -``` sql -SELECT arrayReduce('max', [1, 2, 3]) -``` - -``` text -┌─arrayReduce('max', [1, 2, 3])─┐ -│ 3 │ -└───────────────────────────────┘ -``` - -集計関数が複数の引数を取る場合、この関数は同じサイズの複数の配列に適用する必要があります。 - -``` sql -SELECT arrayReduce('maxIf', [3, 5], [1, 0]) -``` - -``` text -┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ -│ 3 │ -└──────────────────────────────────────┘ -``` - -パラメトリック集計関数の使用例: - -``` sql -SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -``` - -``` text -┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ -│ 4 │ -└─────────────────────────────────────────────────────────────┘ -``` - -## arrayreduceinrangesname {#arrayreduceinranges} - -指定された範囲の配列要素に集計関数を適用し、各範囲に対応する結果を含む配列を返します。 この関数は、同じ結果を複数として返します `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. - -**構文** - -``` sql -arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) -``` - -**パラメータ** - -- `agg_func` — The name of an aggregate function which should be a constant [文字列](../../sql_reference/data_types/string.md). -- `ranges` — The ranges to aggretate which should be an [配列](../../sql_reference/data_types/array.md) の [タプル](../../sql_reference/data_types/tuple.md) 各範囲のインデックスと長さを含む。 -- `arr` — Any number of [配列](../../sql_reference/data_types/array.md) 集計関数のパラメーターとして列を入力します。 - -**戻り値** - -**例えば** - -``` sql -SELECT arrayReduceInRanges( - 'sum', - [(1, 5), (2, 3), (3, 4), (4, 4)], - [1000000, 200000, 30000, 4000, 500, 60, 7] -) AS res -``` - -``` text -┌─res─────────────────────────┐ -│ [1234500,234000,34560,4567] │ -└─────────────────────────────┘ -``` - -## arrayReverse(arr) {#arrayreverse} - -要素を含む元の配列と同じサイズの配列を逆の順序で返します。 - -例えば: - -``` sql -SELECT arrayReverse([1, 2, 3]) -``` - -``` text -┌─arrayReverse([1, 2, 3])─┐ -│ [3,2,1] │ -└─────────────────────────┘ -``` - -## リバース(arr) {#array-functions-reverse} - -の同義語 [“arrayReverse”](#array_functions-arrayreverse) - -## arrayFlatten {#arrayflatten} - -配列の配列をフラット配列に変換します。 - -機能: - -- ネストされた配列の任意の深さに適用されます。 -- 既にフラットな配列は変更されません。 - -の平坦化された配列を含むすべての要素をすべてソース配列. - -**構文** - -``` sql -flatten(array_of_arrays) -``` - -エイリアス: `flatten`. - -**パラメータ** - -- `array_of_arrays` — [配列](../../sql_reference/data_types/array.md) 配列の。 例えば, `[[1,2,3], [4,5]]`. - -**例** - -``` sql -SELECT flatten([[[1]], [[2], [3]]]) -``` - -``` text -┌─flatten(array(array([1]), array([2], [3])))─┐ -│ [1,2,3] │ -└─────────────────────────────────────────────┘ -``` - -## arrayCompact {#arraycompact} - -配列から連続した重複する要素を削除します。 結果値の順序は、ソース配列の順序によって決まります。 - -**構文** - -``` sql -arrayCompact(arr) -``` - -**パラメータ** - -`arr` — The [配列](../../sql_reference/data_types/array.md) 検査する。 - -**戻り値** - -重複のない配列。 - -タイプ: `Array`. - -**例えば** - -クエリ: - -``` sql -SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) -``` - -結果: - -``` text -┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ -│ [1,nan,nan,2,3] │ -└────────────────────────────────────────────┘ -``` - -## arrayZip {#arrayzip} - -Combine multiple Array type columns into one Array\[Tuple(…)\] column - -**構文** - -``` sql -arrayZip(arr1, arr2, ..., arrN) -``` - -**パラメータ** - -`arr` — Any number of [配列](../../sql_reference/data_types/array.md) 結合する列を入力します。 - -**戻り値** - -The result of Array\[Tuple(…)\] type after the combination of these arrays - -**例えば** - -クエリ: - -``` sql -SELECT arrayZip(['a', 'b', 'c'], ['d', 'e', 'f']); -``` - -結果: - -``` text -┌─arrayZip(['a', 'b', 'c'], ['d', 'e', 'f'])─┐ -│ [('a','d'),('b','e'),('c','f')] │ -└────────────────────────────────────────────┘ -``` - -## arrayAUC {#arrayauc} - -計算auc(機械学習の概念である曲線の下の面積は、詳細を参照してください:https://en.wikipedia.org/wiki/receiver\_operating\_characteristic\#area\_under\_the\_curve). - -**構文** - -``` sql -arrayAUC(arr_scores, arr_labels) -``` - -**パラメータ** -- `arr_scores` — scores prediction model gives. -- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. - -**戻り値** -Float64型のAUC値を返します。 - -**例えば** -クエリ: - -``` sql -select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) -``` - -結果: - -``` text -┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ -│ 0.75 │ -└────────────────────────────────────────---──┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/ja/sql_reference/functions/bit_functions.md b/docs/ja/sql_reference/functions/bit_functions.md deleted file mode 100644 index d5d8c0ca769..00000000000 --- a/docs/ja/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 48 -toc_title: "\u30D3\u30C3\u30C8" ---- - -# ビット機能 {#bit-functions} - -ビット関数は、uint8、uint16、uint32、uint64、int8、int16、int32、int64、float32、またはfloat64のいずれかの種類のペアで機能します。 - -結果の型は、その引数の最大ビットに等しいビットを持つ整数です。 引数のうち少なくとも一方が署名されている場合、結果は署名された番号になります。 引数が浮動小数点数の場合、int64にキャストされます。 - -## bitAnd(a,b) {#bitanda-b} - -## bitOr(a,b) {#bitora-b} - -## bitXor(a,b) {#bitxora-b} - -## bitNot(a) {#bitnota} - -## ビットシフトレフト(a,b) {#bitshiftlefta-b} - -## ビットシフトライト(a,b) {#bitshiftrighta-b} - -## bitRotateLeft(a,b) {#bitrotatelefta-b} - -## bitRotateRight(a,b) {#bitrotaterighta-b} - -## 適者生存 {#bittest} - -任意の整数を受け取り、それを [バイナリ形式](https://en.wikipedia.org/wiki/Binary_number)、指定された位置にあるビットの値を返します。 カウントダウンは右から左に0から始まります。 - -**構文** - -``` sql -SELECT bitTest(number, index) -``` - -**パラメータ** - -- `number` – integer number. -- `index` – position of bit. - -**戻り値** - -指定された位置にあるbitの値を返します。 - -タイプ: `UInt8`. - -**例えば** - -たとえば、ベース43(バイナリ)数値システムの数値は101011です。 - -クエリ: - -``` sql -SELECT bitTest(43, 1) -``` - -結果: - -``` text -┌─bitTest(43, 1)─┐ -│ 1 │ -└────────────────┘ -``` - -別の例: - -クエリ: - -``` sql -SELECT bitTest(43, 2) -``` - -結果: - -``` text -┌─bitTest(43, 2)─┐ -│ 0 │ -└────────────────┘ -``` - -## bitTestAll {#bittestall} - -の結果を返します [論理結合](https://en.wikipedia.org/wiki/Logical_conjunction) 与えられた位置にあるすべてのビットの(and演算子)。 カウントダウンは右から左に0から始まります。 - -ビット演算のためのconjuction: - -0 AND 0 = 0 - -0 AND 1 = 0 - -1 AND 0 = 0 - -1 AND 1 = 1 - -**構文** - -``` sql -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` すべてのポジションがtrueの場合にのみtrue (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). - -**戻り値** - -論理conjuctionの結果を返します。 - -タイプ: `UInt8`. - -**例えば** - -たとえば、ベース43(バイナリ)数値システムの数値は101011です。 - -クエリ: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5) -``` - -結果: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5)─┐ -│ 1 │ -└────────────────────────────┘ -``` - -別の例: - -クエリ: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5, 2) -``` - -結果: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ -│ 0 │ -└───────────────────────────────┘ -``` - -## bitTestAny {#bittestany} - -の結果を返します [論理和](https://en.wikipedia.org/wiki/Logical_disjunction) 与えられた位置にあるすべてのビットの(または演算子)。 カウントダウンは右から左に0から始まります。 - -ビットごとの操作のための分離: - -0 OR 0 = 0 - -0 OR 1 = 1 - -1 OR 0 = 1 - -1 OR 1 = 1 - -**構文** - -``` sql -SELECT bitTestAny(number, index1, index2, index3, index4, ...) -``` - -**パラメータ** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. - -**戻り値** - -論理disjuctionの結果を返します。 - -タイプ: `UInt8`. - -**例えば** - -たとえば、ベース43(バイナリ)数値システムの数値は101011です。 - -クエリ: - -``` sql -SELECT bitTestAny(43, 0, 2) -``` - -結果: - -``` text -┌─bitTestAny(43, 0, 2)─┐ -│ 1 │ -└──────────────────────┘ -``` - -別の例: - -クエリ: - -``` sql -SELECT bitTestAny(43, 4, 2) -``` - -結果: - -``` text -┌─bitTestAny(43, 4, 2)─┐ -│ 0 │ -└──────────────────────┘ -``` - -## ビット数 {#bitcount} - -数値のバイナリ表現で設定されたビット数を計算します。 - -**構文** - -``` sql -bitCount(x) -``` - -**パラメータ** - -- `x` — [整数](../../sql_reference/data_types/int_uint.md) または [浮動小数点](../../sql_reference/data_types/float.md) 番号 この関数は、メモリ内の値表現を使用します。 浮動小数点数をサポートすることができます。 - -**戻り値** - -- 入力番号内のビット数を一つに設定します。 - -この関数は入力値を大きな型に変換しません ([記号の拡張子](https://en.wikipedia.org/wiki/Sign_extension)). 例えば, `bitCount(toUInt8(-1)) = 8`. - -タイプ: `UInt8`. - -**例えば** - -例えば、数333を取ります。 そのバイナリ表現:00000000101001101。 - -クエリ: - -``` sql -SELECT bitCount(333) -``` - -結果: - -``` text -┌─bitCount(333)─┐ -│ 5 │ -└───────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/ja/sql_reference/functions/bitmap_functions.md b/docs/ja/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index ddcef7b2093..00000000000 --- a/docs/ja/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,496 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 49 -toc_title: Bitmap ---- - -# ビットマップ関数 {#bitmap-functions} - -ビットマップ関数は、二つのビットマップオブジェクトの値の計算のために働く、そのような、および、または、xor、およびない、などの式の計算を使用し - -ビットマップオブジェクトの構築方法には2種類あります。 一つは-stateを持つ集約関数groupbitmapによって構築されることであり、もう一つは配列オブジェクトによって構築されることである。 また、bitmapオブジェクトをarrayオブジェクトに変換します。 - -RoaringBitmapは、ビットマップオブジェクトの実際の格納中にデータ構造にラップされます。 基数が32以下の場合、Set objetが使用されます。 カーディナリティが32より大きい場合、Rooaringbitmapオブジェクトが使用されます。 そのため、低カーディナリティセットの保存が高速になります。 - -RoaringBitmapの詳細については、以下を参照してください: [鳴き声](https://github.com/RoaringBitmap/CRoaring). - -## bitmapBuild {#bitmap_functions-bitmapbuild} - -符号なし整数配列からビットマップを作成します。 - -``` sql -bitmapBuild(array) -``` - -**パラメータ** - -- `array` – unsigned integer array. - -**例えば** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) -``` - -``` text -┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ -│  │ AggregateFunction(groupBitmap, UInt8) │ -└─────┴──────────────────────────────────────────────┘ -``` - -## bitmapToArray {#bitmaptoarray} - -ビットマップを整数配列に変換します。 - -``` sql -bitmapToArray(bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapSubsetInRange {#bitmap-functions-bitmapsubsetinrange} - -指定された範囲のサブセットを返します(range\_endは含みません)。 - -``` sql -bitmapSubsetInRange(bitmap, range_start, range_end) -``` - -**パラメータ** - -- `bitmap` – [ビットマップ](#bitmap_functions-bitmapbuild). -- `range_start` – range start point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `range_end` – range end point(excluded). Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**例えば** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -``` text -┌─res───────────────┐ -│ [30,31,32,33,100] │ -└───────────────────┘ -``` - -## bitmapSubsetLimit {#bitmapsubsetlimit} - -ビットマップのサブセットを作成します。 `range_start` と `cardinality_limit`. - -**構文** - -``` sql -bitmapSubsetLimit(bitmap, range_start, cardinality_limit) -``` - -**パラメータ** - -- `bitmap` – [ビットマップ](#bitmap_functions-bitmapbuild). -- `range_start` – The subset starting point. Type: [UInt32](../../sql_reference/data_types/int_uint.md). -- `cardinality_limit` – The subset cardinality upper limit. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -サブセット。 - -タイプ: `Bitmap object`. - -**例えば** - -クエリ: - -``` sql -SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -結果: - -``` text -┌─res───────────────────────┐ -│ [30,31,32,33,100,200,500] │ -└───────────────────────────┘ -``` - -## bitmapContains {#bitmap_functions-bitmapcontains} - -かどうかをチェックしますビットマップを含む要素になります。 - -``` sql -bitmapContains(haystack, needle) -``` - -**パラメータ** - -- `haystack` – [ビットマップ](#bitmap_functions-bitmapbuild)、関数が検索する場所。 -- `needle` – Value that the function searches. Type: [UInt32](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- 0 — If `haystack` 含まない `needle`. -- 1 — If `haystack` 含む `needle`. - -タイプ: `UInt8`. - -**例えば** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAny {#bitmaphasany} - -るかどうかを判二つのビットマップしていることで交差点にある。 - -``` sql -bitmapHasAny(bitmap1, bitmap2) -``` - -あなたが確信している場合 `bitmap2` 一つの要素が含まれています。 [bitmapContains](#bitmap_functions-bitmapcontains) 機能。 これは、より効率的に動作します。 - -**パラメータ** - -- `bitmap*` – bitmap object. - -**戻り値** - -- `1`,もし `bitmap1` と `bitmap2` 少なくとも同様の要素を持っている。 -- `0` そうでなければ - -**例えば** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAll {#bitmaphasall} - -に類似した `hasAll(array, array)` 最初のビットマップに1番目のビットマップのすべての要素が含まれる場合は0を返します。 -二番目の引数が空のビットマップの場合、1を返します。 - -``` sql -bitmapHasAll(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 0 │ -└─────┘ -``` - -## bitmapCardinality {#bitmapcardinality} - -UInt64型のビットマップのカーディナリティを再度実行可能。 - -``` sql -bitmapCardinality(bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapmincomment {#bitmapmin} - -セット内のタイプuint64の最小値を再度取り消し、セットが空の場合はuint32\_max。 - - bitmapMin(bitmap) - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapMax {#bitmapmax} - -セット内のuint64型の最大値を取り消し、セットが空の場合は0になります。 - - bitmapMax(bitmap) - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## bitmapTransform {#bitmaptransform} - -ビットマップ内の値の配列を別の値の配列に変換すると、結果は新しいビットマップになります。 - - bitmapTransform(bitmap, from_array, to_array) - -**パラメータ** - -- `bitmap` – bitmap object. -- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. -- `to_array` – UInt32 array, its size shall be the same to from\_array. - -**例えば** - -``` sql -SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res -``` - - ┌─res───────────────────┐ - │ [1,3,4,6,7,8,9,10,20] │ - └───────────────────────┘ - -## bitmapAnd {#bitmapand} - -二つのビットマップと計算、結果は新しいビットマップです。 - -``` sql -bitmapAnd(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─┐ -│ [3] │ -└─────┘ -``` - -## bitmapOr {#bitmapor} - -二つのビットマップや計算、結果は新しいビットマップです。 - -``` sql -bitmapOr(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapXor {#bitmapxor} - -二つのビットマップxor計算、結果は新しいビットマップです。 - -``` sql -bitmapXor(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,4,5] │ -└───────────┘ -``` - -## bitmapAndnot {#bitmapandnot} - -二つのビットマップと計算ではなく、結果は新しいビットマップです。 - -``` sql -bitmapAndnot(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## bitmapAndCardinality {#bitmapandcardinality} - -二つのビットマップと計算、型uint64の戻り値のカーディナリティ。 - -``` sql -bitmapAndCardinality(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## ビットmapcardinality {#bitmaporcardinality} - -二つのビットマップまたは計算、型uint64の戻り値のカーディナリティ。 - -``` sql -bitmapOrCardinality(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapXorCardinality {#bitmapxorcardinality} - -二つのビットマップxor計算、型uint64の戻り値のカーディナリティ。 - -``` sql -bitmapXorCardinality(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 4 │ -└─────┘ -``` - -## bitmapAndnotCardinality {#bitmapandnotcardinality} - -二つのビットマップと計算ではなく、型uint64のカーディナリティを返します。 - -``` sql -bitmapAndnotCardinality(bitmap,bitmap) -``` - -**パラメータ** - -- `bitmap` – bitmap object. - -**例えば** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 2 │ -└─────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/ja/sql_reference/functions/conditional_functions.md b/docs/ja/sql_reference/functions/conditional_functions.md deleted file mode 100644 index 4bb83bd44f7..00000000000 --- a/docs/ja/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,207 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 43 -toc_title: "\u6761\u4EF6\u4ED8\u304D " ---- - -# 条件関数 {#conditional-functions} - -## もし {#if} - -条件分岐を制御します。 と異なりほとんどのシステムclickhouse常に評価さの両方表現 `then` と `else`. - -**構文** - -``` sql -SELECT if(cond, then, else) -``` - -条件の場合 `cond` ゼロ以外の値として評価し、式の結果を返します `then`、および式の結果 `else`、存在する場合は、スキップされます。 この `cond` ゼロまたは `NULL` その後の結果 `then` 式はスキップされる。 `else` 式が存在する場合は、その式が返されます。 - -**パラメータ** - -- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. -- `then` -条件が満たされた場合に返される式。 -- `else` -条件が満たされていない場合に返される式。 - -**戻り値** - -関数が実行されます `then` と `else` 式とその結果を返します。 `cond` ゼロかどうかに終わった。 - -**例えば** - -クエリ: - -``` sql -SELECT if(1, plus(2, 2), plus(2, 6)) -``` - -結果: - -``` text -┌─plus(2, 2)─┐ -│ 4 │ -└────────────┘ -``` - -クエリ: - -``` sql -SELECT if(0, plus(2, 2), plus(2, 6)) -``` - -結果: - -``` text -┌─plus(2, 6)─┐ -│ 8 │ -└────────────┘ -``` - -- `then` と `else` 共通タイプが最も小さい。 - -**例えば:** - -これを取る `LEFT_RIGHT` テーブル: - -``` sql -SELECT * -FROM LEFT_RIGHT - -┌─left─┬─right─┐ -│ ᴺᵁᴸᴸ │ 4 │ -│ 1 │ 3 │ -│ 2 │ 2 │ -│ 3 │ 1 │ -│ 4 │ ᴺᵁᴸᴸ │ -└──────┴───────┘ -``` - -次のクエリは比較します `left` と `right` 値: - -``` sql -SELECT - left, - right, - if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller -FROM LEFT_RIGHT -WHERE isNotNull(left) AND isNotNull(right) - -┌─left─┬─right─┬─is_smaller──────────────────────────┐ -│ 1 │ 3 │ left is smaller than right │ -│ 2 │ 2 │ right is greater or equal than left │ -│ 3 │ 1 │ right is greater or equal than left │ -└──────┴───────┴─────────────────────────────────────┘ -``` - -メモ: `NULL` この例では値は使用されません。 [条件のnull値](#null-values-in-conditionals) セクション。 - -## 三項演算子 {#ternary-operator} - -この作品と同じ `if` 機能。 - -構文: `cond ? then : else` - -を返します `then` この `cond` true(ゼロより大きい)と評価され、それ以外の場合は `else`. - -- `cond` のタイプである必要があります `UInt8`、と `then` と `else` 共通タイプが最も小さい。 - -- `then` と `else` できる。 `NULL` - -**また見なさい** - -- [ifNotFinite](other_functions.md#ifnotfinite). - -## multif {#multiif} - -あなたが書くことができます [CASE](../operators.md#operator_case) クエリでよりコンパクトに演算子。 - -構文: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` - -**パラメータ:** - -- `cond_N` — The condition for the function to return `then_N`. -- `then_N` — The result of the function when executed. -- `else` — The result of the function if none of the conditions is met. - -この関数は、 `2N+1` パラメータ。 - -**戻り値** - -この関数は、いずれかの値を返します `then_N` または `else`、条件に応じて `cond_N`. - -**例えば** - -再度を使用して `LEFT_RIGHT` テーブル。 - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─result──────────┐ -│ ᴺᵁᴸᴸ │ 4 │ Null value │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ left is greater │ -│ 4 │ ᴺᵁᴸᴸ │ Null value │ -└──────┴───────┴─────────────────┘ -``` - -## 条件付き結果を直接使用する {#using-conditional-results-directly} - -条件は常に次のようになります `0`, `1` または `NULL`. できますので使用条件と結果が直接このような: - -``` sql -SELECT left < right AS is_small -FROM LEFT_RIGHT - -┌─is_small─┐ -│ ᴺᵁᴸᴸ │ -│ 1 │ -│ 0 │ -│ 0 │ -│ ᴺᵁᴸᴸ │ -└──────────┘ -``` - -## 条件のnull値 {#null-values-in-conditionals} - -とき `NULL` 値は条件文に含まれ、結果は次のようになります `NULL`. - -``` sql -SELECT - NULL < 1, - 2 < NULL, - NULL < NULL, - NULL = NULL - -┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ -│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└───────────────┴───────────────┴──────────────────┴────────────────────┘ -``` - -したがって、型が `Nullable`. - -次の例は、equals条件を追加できないことを示しています `multiIf`. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─faulty_result────┐ -│ ᴺᵁᴸᴸ │ 4 │ Both equal │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ right is smaller │ -│ 4 │ ᴺᵁᴸᴸ │ Both equal │ -└──────┴───────┴──────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/ja/sql_reference/functions/date_time_functions.md b/docs/ja/sql_reference/functions/date_time_functions.md deleted file mode 100644 index 6a076711e4a..00000000000 --- a/docs/ja/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,450 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u65E5\u4ED8\u3068\u6642\u523B\u306E\u64CD\u4F5C" ---- - -# 日付と時刻を操作するための関数 {#functions-for-working-with-dates-and-times} - -タイムゾーンのサポート - -タイムゾーンの論理的使用を持つ日付と時刻を操作するためのすべての関数は、二番目の省略可能なタイムゾーン引数を受け入れることができます。 例:アジア/エカテリンブルク。 この場合、ローカル(デフォルト)の代わりに指定されたタイムゾーンを使用します。 - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - -``` text -┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ -└─────────────────────┴────────────┴────────────┴─────────────────────┘ -``` - -UTCと時間数が異なるタイムゾーンのみがサポートされます。 - -## トティメゾン {#totimezone} - -時刻または日付と時刻を指定したタイムゾーンに変換します。 - -## toYear {#toyear} - -時刻を含む日付または日付を年番号(ad)を含むuint16番号に変換します。 - -## toQuarter {#toquarter} - -時刻を含む日付または日付を、四半期番号を含むuint8番号に変換します。 - -## トモント県france.kgm {#tomonth} - -時刻を含む日付または日付を、月番号(1~12)を含むuint8番号に変換します。 - -## 今日の年 {#todayofyear} - -時刻を含む日付または日付を、その年の日付の番号(1-366)を含むuint16番号に変換します。 - -## toDayOfMonth {#todayofmonth} - -時刻を含む日付または日付を、その月の日の番号(1-31)を含むuint8番号に変換します。 - -## toDayOfWeek {#todayofweek} - -時刻を含む日付または日付を、曜日の番号を含むuint8番号に変換します(月曜日は1、日曜日は7)。 - -## tohourgenericname {#tohour} - -時刻を含む日付を、uint8の24時間(0-23)の時刻を含む数値に変換します。 -This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). - -## toMinute {#tominute} - -時刻を含む日付を、時刻の分(0~59)の数を含むuint8数値に変換します。 - -## ト秒 {#tosecond} - -Timeを含む日付をUInt8の数値に変換します(0~59)。 -うるう秒は説明されていません。 - -## toUnixTimestamp {#to-unix-timestamp} - -For DateTime argument:値を内部の数値表現(Unixタイムスタンプ)に変換します。 -文字列引数の場合:タイムゾーンに従って文字列からのdatetimeを解析します(オプションの第二引数、サーバーのタイムゾーンはデフォルトで使用されます)。 -日付の引数の場合:この動作は指定されていません。 - -**構文** - -``` sql -toUnixTimestamp(datetime) -toUnixTimestamp(str, [timezone]) -``` - -**戻り値** - -- Unixタイムスタンプを返す。 - -タイプ: `UInt32`. - -**例えば** - -クエリ: - -``` sql -SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp -``` - -結果: - -``` text -┌─unix_timestamp─┐ -│ 1509836867 │ -└────────────────┘ -``` - -## toStartOfYear {#tostartofyear} - -日付または日付のある時刻を年の最初の日に切り捨てます。 -日付を返します。 - -## tostartofisoyearcomment {#tostartofisoyear} - -日付または日付と時刻をiso暦年の最初の日に切り捨てます。 -日付を返します。 - -## toStartOfQuarter {#tostartofquarter} - -日付または日付のある時刻を四半期の最初の日に切り捨てます。 -四半期の最初の日はどちらかです1月,1四月,1七月,若しくは1十月. -日付を返します。 - -## toStartOfMonth {#tostartofmonth} - -日付または日付と時刻を月の最初の日に切り捨てます。 -日付を返します。 - -!!! attention "注意" - 間違った日付を解析する動作は実装固有です。 clickhouseはゼロの日付を返したり、例外をスローしたりします “natural” オーバーフロー - -## toMonday {#tomonday} - -日付または日付と時刻を最も近い月曜日に切り捨てます。 -日付を返します。 - -## toStartOfWeek(t\[,mode\]) {#tostartofweektmode} - -日付または日付と時刻を、モード別に最も近い日曜日または月曜日に切り捨てます。 -日付を返します。 -Mode引数は、toWeek()のmode引数とまったく同じように動作します。 単一引数の構文では、モード値0が使用されます。 - -## toStartOfDay {#tostartofday} - -時刻を含む日付をその日の始まりに切り捨てます。 - -## toStartOfHour {#tostartofhour} - -時刻を含む日付を時間の開始位置に切り捨てます。 - -## toStartOfMinute {#tostartofminute} - -日付と時刻が分の先頭に切り捨てられます。 - -## toStartOfFiveMinute {#tostartoffiveminute} - -日付と時刻を切り捨てます。 - -## トスタートオフテンミニュート {#tostartoftenminutes} - -日付と時刻を切り捨てます。 - -## トスタートオフィフテンミニュート {#tostartoffifteenminutes} - -日付と時刻を切り捨てます。 - -## toStartOfInterval(time\_or\_data,間隔xユニット\[,time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -これは、名前の付いた他の関数の一般化です `toStartOf*`. 例えば, -`toStartOfInterval(t, INTERVAL 1 year)` と同じを返します `toStartOfYear(t)`, -`toStartOfInterval(t, INTERVAL 1 month)` と同じを返します `toStartOfMonth(t)`, -`toStartOfInterval(t, INTERVAL 1 day)` と同じを返します `toStartOfDay(t)`, -`toStartOfInterval(t, INTERVAL 15 minute)` と同じを返します `toStartOfFifteenMinutes(t)` など。 - -## トタイム {#totime} - -時刻を保持しながら、時刻を含む日付を特定の固定日付に変換します。 - -## torelativeyearnumcomment {#torelativeyearnum} - -時刻または日付の日付を、過去の特定の固定小数点から始まる年の数に変換します。 - -## torelativequarternumcomment {#torelativequarternum} - -時刻または日付の日付を、過去の特定の固定小数点から開始して、四半期の数に変換します。 - -## torelativemonthnumcomment {#torelativemonthnum} - -時刻または日付を含む日付を、過去の特定の固定小数点から始まる月の数に変換します。 - -## torelativeweeknumcomment {#torelativeweeknum} - -時刻または日付を含む日付を、過去の特定の固定小数点から始まる週の数に変換します。 - -## torrelativedaynumcomment {#torelativedaynum} - -時刻または日付を含む日付を、過去の特定の固定小数点から始まる日の数に変換します。 - -## torrelativehournumgenericname {#torelativehournum} - -時刻または日付の日付を、過去の特定の固定小数点から始まる時間の数値に変換します。 - -## toRelativeMinuteNum {#torelativeminutenum} - -時刻または日付の日付を、過去の特定の固定小数点から始まる分の数値に変換します。 - -## torrelativesecondnumcomdnamescription {#torelativesecondnum} - -時刻または日付の日付を、過去の特定の固定小数点から開始して秒の数値に変換します。 - -## toISOYear {#toisoyear} - -時刻を含む日付または日付を、iso年番号を含むuint16番号に変換します。 - -## toISOWeek {#toisoweek} - -時刻を含む日付または日付を、iso週番号を含むuint8番号に変換します。 - -## toWeek(日付\[,モード\]) {#toweekdatemode} - -この関数は、dateまたはdatetimeの週番号を返します。 また、戻り値の範囲が0から53または1から53のどちらであるかを指定することができます。 引数modeを省略すると、デフォルトのモードは0になります。 -`toISOWeek()`は、以下と同等の互換性関数です `toWeek(date,3)`. -次の表では、mode引数の動作について説明します。 - -| モード | 週の最初の日 | 範囲 | Week 1 is the first week … | -|--------|--------------|------|----------------------------| -| 0 | 日曜日 | 0-53 | 今年の日曜日に | -| 1 | 月曜日 | 0-53 | 今年は4日以上 | -| 2 | 日曜日 | 1-53 | 今年の日曜日に | -| 3 | 月曜日 | 1-53 | 今年は4日以上 | -| 4 | 日曜日 | 0-53 | 今年は4日以上 | -| 5 | 月曜日 | 0-53 | 今年の月曜日と | -| 6 | 日曜日 | 1-53 | 今年は4日以上 | -| 7 | 月曜日 | 1-53 | 今年の月曜日と | -| 8 | 日曜日 | 1-53 | 含まれ月1 | -| 9 | 月曜日 | 1-53 | 含まれ月1 | - -意味のあるモード値の場合 “with 4 or more days this year,” 週はISO8601:1988に従って番号が付けられます: - -- 1月を含む週がある場合4新年の日,それは週です1. - -- それ以外の場合は、前年の最後の週であり、次の週は1週です。 - -意味のあるモード値の場合 “contains January 1” の週の月には1週間に1. たとえそれが一日だけ含まれていても、その週に含まれている新年の日数は関係ありません。 - -``` sql -toWeek(date, [, mode][, Timezone]) -``` - -**パラメータ** - -- `date` – Date or DateTime. -- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. -- `Timezone` – Optional parameter, it behaves like any other conversion function. - -**例えば** - -``` sql -SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; -``` - -``` text -┌───────date─┬─week0─┬─week1─┬─week9─┐ -│ 2016-12-27 │ 52 │ 52 │ 1 │ -└────────────┴───────┴───────┴───────┘ -``` - -## toeearweek(日付\[,モード\]) {#toyearweekdatemode} - -日付の年と週を返します。 結果の年は、その年の最初と最後の週の日付の引数の年とは異なる場合があります。 - -Mode引数は、toWeek()のmode引数とまったく同じように動作します。 単一引数の構文では、モード値0が使用されます。 - -`toISOYear()`は、以下と同等の互換性関数です `intDiv(toYearWeek(date,3),100)`. - -**例えば** - -``` sql -SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; -``` - -``` text -┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ -│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ -└────────────┴───────────┴───────────┴───────────┘ -``` - -## さて {#now} - -ゼロ引数を受け取り、リクエスト実行のいずれかの時点で現在の時刻を返します。 -この関数は、要求が完了するまでに長い時間がかかった場合でも、定数を返します。 - -## 今日 {#today} - -ゼロ引数を受け取り、リクエスト実行のいずれかの時点で現在の日付を返します。 -同じように ‘toDate(now())’. - -## 昨日 {#yesterday} - -ゼロの引数を受け取り、リクエストの実行のいずれかの時点で、昨日の日付を返します。 -同じように ‘today() - 1’. - -## タイムスロット {#timeslot} - -時間を半分時間に丸めます。 -この機能はyandexに固有です。トラッキングタグがこの量よりも厳密に時間が異なる単一のユーザーの連続したページビューを表示する場合、セッションを二つのセッションに分割す つまり、タプル(タグid、ユーザー id、およびタイムスロット)を使用して、対応するセッションに含まれるページビューを検索できます。 - -## toYYYYMM {#toyyyymm} - -時刻を含む日付または日付を、年と月の数値(yyyy\*100+mm)を含むuint32番号に変換します。 - -## toyyymmdd {#toyyyymmdd} - -時刻を含む日付または日付を、年と月の数値(yyyy\*10000+mm\*100+dd)を含むuint32番号に変換します。 - -## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} - -時刻付きの日付または日付を、年と月の数値を含むuint64番号に変換します(yyyy\*10000000000+mm\*100000000+dd\*1000000+hh\*10000+mm\*100+ss)。 - -## addYears,addMonths,addweks,addDays,addHours,addMinutes,addSeconds,addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} - -関数は、日付/日付時刻の間隔を日付/日付時刻に追加してから、日付/日付時刻を返します。 例えば: - -``` sql -WITH - toDate('2018-01-01') AS date, - toDateTime('2018-01-01 00:00:00') AS date_time -SELECT - addYears(date, 1) AS add_years_with_date, - addYears(date_time, 1) AS add_years_with_date_time -``` - -``` text -┌─add_years_with_date─┬─add_years_with_date_time─┐ -│ 2019-01-01 │ 2019-01-01 00:00:00 │ -└─────────────────────┴──────────────────────────┘ -``` - -## subtractYears,subtractMonths,subtractWeeks,subtractDays,subtractHours,subtractMinutes,subtractSeconds,subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} - -関数date/datetime間隔をdate/datetimeに減算し、date/datetimeを返します。 例えば: - -``` sql -WITH - toDate('2019-01-01') AS date, - toDateTime('2019-01-01 00:00:00') AS date_time -SELECT - subtractYears(date, 1) AS subtract_years_with_date, - subtractYears(date_time, 1) AS subtract_years_with_date_time -``` - -``` text -┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ -│ 2018-01-01 │ 2018-01-01 00:00:00 │ -└──────────────────────────┴───────────────────────────────┘ -``` - -## dateDiff {#datediff} - -日付または日付時刻値の差を返します。 - -**構文** - -``` sql -dateDiff('unit', startdate, enddate, [timezone]) -``` - -**パラメータ** - -- `unit` — Time unit, in which the returned value is expressed. [文字列](../syntax.md#syntax-string-literal). - - Supported values: - - | unit | - | ---- | - |second | - |minute | - |hour | - |day | - |week | - |month | - |quarter | - |year | - -- `startdate` — The first time value to compare. [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). - -- `enddate` — The second time value to compare. [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). - -- `timezone` — Optional parameter. If specified, it is applied to both `startdate` と `enddate`. 指定されていない場合は、 `startdate` と `enddate` 使用されます。 それらが同じでない場合、結果は不特定です。 - -**戻り値** - -の違い `startdate` と `enddate` で表現 `unit`. - -タイプ: `int`. - -**例えば** - -クエリ: - -``` sql -SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); -``` - -結果: - -``` text -┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ -│ 25 │ -└────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## timeSlots(StartTime,Duration,\[,Size\]) {#timeslotsstarttime-duration-size} - -で始まる時間間隔のために ‘StartTime’ そしてのために継続 ‘Duration’ 秒、この間隔からのポイントからなる時間内のモーメントの配列を返します。 ‘Size’ 数秒で。 ‘Size’ オプションのパラメーターです:既定では定数UInt32を1800に設定します。 -例えば, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. -これは、対応するセッションでページビューを検索するために必要です。 - -## formatDateTime(時間,フォーマット\[,タイムゾーン\]) {#formatdatetime} - -Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. - -形式のサポートされている修飾子: -(“Example” このページを正しく表示するフォーマット結果のための時間 `2018-01-02 22:33:44`) - -| 修飾子 | 説明 | 例えば | -|--------|----------------------------------------------------|------------| -| %C | 年を100で除算し、整数(00から99)に切り捨てられます) | 20 | -| %d | 月の日、ゼロ-パディング(01-31) | 02 | -| %D | %m/%d/%yに相当する短いmm/dd/yy日付 | 01/02/18 | -| %e | 月の日、スペース埋め(1-31) | 2 | -| %F | %Y-%m-%dに相当する短いYYYY-MM-DD日付 | 2018-01-02 | -| %H | 24時間形式(00-23)の時間) | 22 | -| %I | 時間で12h形式(01-12) | 10 | -| %j | 年の日(001-366) | 002 | -| %m | 月を小数(01-12)として指定します) | 01 | -| %M | 分(00-59) | 33 | -| %n | 改行文字(") | | -| %p | AMまたはPMの指定 | PM | -| %R | 24時間HH:MM時間、%Hに相当する:%M | 22:33 | -| %S | 二番目に(00-59) | 44 | -| %t | 水平タブ文字(') | | -| %T | ISO8601時刻フォーマット(HH:MM:SS)、%H:%M:%Sに相当 | 22:33:44 | -| %u | ISO8601月曜日が1(1-7)の数値としての平日) | 2 | -| %V | ISO8601週番号(01-53) | 01 | -| %w | weekday as a decimal number with Sunday as0(0-6) | 2 | -| %y | 年,最後の二つの数字(00-99) | 18 | -| %Y | 年 | 2018 | -| %% | %記号 | % | - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/ja/sql_reference/functions/encoding_functions.md b/docs/ja/sql_reference/functions/encoding_functions.md deleted file mode 100644 index 4f0ce676fb8..00000000000 --- a/docs/ja/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 52 -toc_title: "\u30A8\u30F3\u30B3\u30FC\u30C9" ---- - -# エンコード関数 {#encoding-functions} - -## 文字 {#char} - -渡された引数の数として長さを持つ文字列を返し、各バイトは対応する引数の値を持ちます。 数値型の複数の引数を受け取ります。 引数の値がuint8データ型の範囲外である場合は、丸めとオーバーフローが可能な状態でuint8に変換されます。 - -**構文** - -``` sql -char(number_1, [number_2, ..., number_n]); -``` - -**パラメータ** - -- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../../sql_reference/data_types/int_uint.md), [フロート](../../sql_reference/data_types/float.md). - -**戻り値** - -- 指定されたバイトの文字列。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello -``` - -結果: - -``` text -┌─hello─┐ -│ hello │ -└───────┘ -``` - -を構築できます文字列の任意のエンコードに対応するバイトまでとなります。 utf-8の例を次に示します: - -クエリ: - -``` sql -SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; -``` - -結果: - -``` text -┌─hello──┐ -│ привет │ -└────────┘ -``` - -クエリ: - -``` sql -SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; -``` - -結果: - -``` text -┌─hello─┐ -│ 你好 │ -└───────┘ -``` - -## 六角 {#hex} - -引数の十六進表現を含む文字列を返します。 - -**構文** - -``` sql -hex(arg) -``` - -この関数は大文字を使用しています `A-F` 接頭辞(など)を使用しないでください `0x` または接尾辞(のような `h`). - -整数引数の場合は、六角数字を出力します (“nibbles”)最も重要なものから最も重要なもの(ビッグエンディアンまたは “human readable” 順序)。 最も重要な非ゼロバイト(先行ゼロバイトは省略されています)で始まりますが、先行桁がゼロであっても常に各バイトの両方の桁を出力します。 - -例えば: - -**例えば** - -クエリ: - -``` sql -SELECT hex(1); -``` - -結果: - -``` text -01 -``` - -タイプの値 `Date` と `DateTime` 対応する整数としてフォーマットされます(日付のエポックからの日数と、DateTimeのUnixタイムスタンプの値)。 - -のために `String` と `FixedString` すべてのバイトは、単に二進数として符号化される。 ゼロバイトは省略されません。 - -浮動小数点型と小数型の値は、メモリ内での表現としてエンコードされます。 支援においても少しエンディアン、建築、その符号化されたのでちょっとエンディアンです。※ ゼロ先行/末尾のバイトは省略されません。 - -**パラメータ** - -- `arg` — A value to convert to hexadecimal. Types: [文字列](../../sql_reference/data_types/string.md), [UInt](../../sql_reference/data_types/int_uint.md), [フロート](../../sql_reference/data_types/float.md), [小数](../../sql_reference/data_types/decimal.md), [日付](../../sql_reference/data_types/date.md) または [DateTime](../../sql_reference/data_types/datetime.md). - -**戻り値** - -- 引数の十六進表現を持つ文字列。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); -``` - -結果: - -``` text -┌─hex_presentation─┐ -│ 00007041 │ -│ 00008041 │ -└──────────────────┘ -``` - -クエリ: - -``` sql -SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); -``` - -結果: - -``` text -┌─hex_presentation─┐ -│ 0000000000002E40 │ -│ 0000000000003040 │ -└──────────────────┘ -``` - -## unhex(str)) {#unhexstr} - -任意の数の進数を含む文字列を受け取り、対応するバイトを含む文字列を返します。 十六進数の数字は偶数である必要はありません。 奇数の場合、最後の桁は、00-0fバイトの最下位半分として解釈されます。 引数stringに十六進数以外の桁数が含まれている場合、実装定義の結果が返されます(例外はスローされません)。 -結果を数値に変換したい場合は、 ‘reverse’ と ‘reinterpretAsType’ 機能。 - -## UUIDStringToNum(str)) {#uuidstringtonumstr} - -次の形式の36文字を含む文字列を受け取ります `123e4567-e89b-12d3-a456-426655440000`、およびFixedString(16)のバイトのセットとして返します。 - -## UUIDNumToString(str)) {#uuidnumtostringstr} - -FixedString(16)値を受け取ります。 テキスト形式で36文字を含む文字列を返します。 - -## ビットマスクトリスト(num) {#bitmasktolistnum} - -整数を受け入れます。 合計されたときにソース番号を合計する二つの累乗のリストを含む文字列を返します。 これらは、昇順で、テキスト形式のスペースなしでコンマ区切りです。 - -## ビットマスクアレール(num) {#bitmasktoarraynum} - -整数を受け入れます。 合計されたときにソース番号を合計する二つの累乗のリストを含むuint64数の配列を返します。 配列内の数字は昇順です。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/ja/sql_reference/functions/ext_dict_functions.md b/docs/ja/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index 8b9299cb524..00000000000 --- a/docs/ja/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 58 -toc_title: "\u5916\u90E8\u8F9E\u66F8\u306E\u64CD\u4F5C" ---- - -# 外部辞書を操作するための関数 {#ext_dict_functions} - -情報の接続や設定の外部辞書参照 [外部辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -## dictGet {#dictget} - -外部ディクショナリから値を取得します。 - -``` sql -dictGet('dict_name', 'attr_name', id_expr) -dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**パラメータ** - -- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql_reference/data_types/int_uint.md) または [タプル](../../sql_reference/data_types/tuple.md)-辞書構成に応じて値を入力します。 -- `default_value_expr` — Value returned if the dictionary doesn't contain a row with the `id_expr` キー。 [式](../syntax.md#syntax-expressions) に設定されたデータ型の値を返します。 `attr_name` 属性。 - -**戻り値** - -- クリックハウスで属性が正常に解析された場合 [属性のデータ型](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes)、関数は、に対応する辞書属性の値を返します `id_expr`. - -- キーがない場合、対応する `id_expr`、辞書では、その後: - - - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouseは、属性の値を解析できない場合、または値が属性データ型と一致しない場合に例外をスローします。 - -**例えば** - -テキストファイルの作成 `ext-dict-text.csv` 以下を含む: - -``` text -1,1 -2,2 -``` - -最初の列は次のとおりです `id`、第二の列は `c1`. - -外部ディクショナリの設定: - -``` xml - - - ext-dict-test - - - /path-to/ext-dict-test.csv - CSV - - - - - - - - id - - - c1 - UInt32 - - - - 0 - - -``` - -クエリの実行: - -``` sql -SELECT - dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, - toTypeName(val) AS type -FROM system.numbers -LIMIT 3 -``` - -``` text -┌─val─┬─type───┐ -│ 1 │ UInt32 │ -│ 2 │ UInt32 │ -│ 20 │ UInt32 │ -└─────┴────────┘ -``` - -**また見なさい** - -- [外部辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) - -## dictHas {#dicthas} - -キーが辞書に存在するかどうかを確認します。 - -``` sql -dictHas('dict_name', id_expr) -``` - -**パラメータ** - -- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ値。 - -**戻り値** - -- 0、キーがない場合。 -- 1、キーがある場合。 - -タイプ: `UInt8`. - -## 独裁主義体制 {#dictgethierarchy} - -キーのすべての親を含む配列を作成します。 [階層辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md). - -**構文** - -``` sql -dictGetHierarchy('dict_name', key) -``` - -**パラメータ** - -- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). -- `key` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ値。 - -**戻り値** - -- キーの親。 - -タイプ: [配列(uint64)](../../sql_reference/data_types/array.md). - -## ディクティシン {#dictisin} - -辞書内の階層チェーン全体を通じてキーの祖先をチェックします。 - -``` sql -dictIsIn('dict_name', child_id_expr, ancestor_id_expr) -``` - -**パラメータ** - -- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). -- `child_id_expr` — Key to be checked. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ値。 -- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` キー。 [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ値。 - -**戻り値** - -- 0,if `child_id_expr` の子ではありません `ancestor_id_expr`. -- 1、場合 `child_id_expr` の子です `ancestor_id_expr` または `child_id_expr` は `ancestor_id_expr`. - -タイプ: `UInt8`. - -## その他の機能 {#ext_dict_functions-other} - -ClickHouseは、辞書構成に関係なく、辞書属性値を特定のデータ型に変換する特殊な関数をサポートしています。 - -機能: - -- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` -- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` -- `dictGetFloat32`, `dictGetFloat64` -- `dictGetDate` -- `dictGetDateTime` -- `dictGetUUID` -- `dictGetString` - -これらの機能はすべて、 `OrDefault` 変更。 例えば, `dictGetDateOrDefault`. - -構文: - -``` sql -dictGet[Type]('dict_name', 'attr_name', id_expr) -dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**パラメータ** - -- `dict_name` — Name of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [文字列リテラル](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [式](../syntax.md#syntax-expressions) を返す [UInt64](../../sql_reference/data_types/int_uint.md)-タイプ値。 -- `default_value_expr` — Value which is returned if the dictionary doesn't contain a row with the `id_expr` キー。 [式](../syntax.md#syntax-expressions) に設定されたデータ型の値を返します。 `attr_name` 属性。 - -**戻り値** - -- クリックハウスで属性が正常に解析された場合 [属性のデータ型](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes)、関数は、に対応する辞書属性の値を返します `id_expr`. - -- 要求がない場合 `id_expr` 辞書では、: - - - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. - -ClickHouseは、属性の値を解析できない場合、または値が属性データ型と一致しない場合に例外をスローします。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/ja/sql_reference/functions/functions_for_nulls.md b/docs/ja/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 655eecd3df2..00000000000 --- a/docs/ja/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,312 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 63 -toc_title: "\u30CC\u30EB\u53EF\u80FD\u306A\u5F15\u6570\u306E\u64CD\u4F5C" ---- - -# Null可能な集計を操作するための関数 {#functions-for-working-with-nullable-aggregates} - -## isNull {#isnull} - -引数が [NULL](../syntax.md#null). - -``` sql -isNull(x) -``` - -**パラメータ** - -- `x` — A value with a non-compound data type. - -**戻り値** - -- `1` もし `x` は `NULL`. -- `0` もし `x` はない `NULL`. - -**例えば** - -入力テーブル - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -クエリ - -``` sql -SELECT x FROM t_null WHERE isNull(y) -``` - -``` text -┌─x─┐ -│ 1 │ -└───┘ -``` - -## isNotNull {#isnotnull} - -引数が [NULL](../syntax.md#null). - -``` sql -isNotNull(x) -``` - -**パラメータ:** - -- `x` — A value with a non-compound data type. - -**戻り値** - -- `0` もし `x` は `NULL`. -- `1` もし `x` はない `NULL`. - -**例えば** - -入力テーブル - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -クエリ - -``` sql -SELECT x FROM t_null WHERE isNotNull(y) -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## 合体 {#coalesce} - -左から右にチェックするかどうか `NULL` 引数が渡され、最初の非を返します-`NULL` 引数。 - -``` sql -coalesce(x,...) -``` - -**パラメータ:** - -- 非化合物タイプの任意の数のパラメーター。 すべてのパラメータに対応していることが必要となるデータ型になります。 - -**戻り値** - -- 最初の非-`NULL` 引数。 -- `NULL` すべての引数が `NULL`. - -**例えば** - -顧客に連絡する複数の方法を指定する可能性のある連絡先のリストを考えてみましょう。 - -``` text -┌─name─────┬─mail─┬─phone─────┬──icq─┐ -│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ -│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└──────────┴──────┴───────────┴──────┘ -``` - -その `mail` と `phone` フィールドの型はStringですが、 `icq` フィールドは `UInt32`、それはに変換する必要があります `String`. - -コンタクトリストから顧客の最初の利用可能なコンタクトメソッドを取得する: - -``` sql -SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook -``` - -``` text -┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ -│ client 1 │ 123-45-67 │ -│ client 2 │ ᴺᵁᴸᴸ │ -└──────────┴──────────────────────────────────────────────────────┘ -``` - -## ifNull {#ifnull} - -メイン引数がある場合は、代替値を返します `NULL`. - -``` sql -ifNull(x,alt) -``` - -**パラメータ:** - -- `x` — The value to check for `NULL`. -- `alt` — The value that the function returns if `x` は `NULL`. - -**戻り値** - -- を値 `x`,もし `x` はない `NULL`. -- を値 `alt`,もし `x` は `NULL`. - -**例えば** - -``` sql -SELECT ifNull('a', 'b') -``` - -``` text -┌─ifNull('a', 'b')─┐ -│ a │ -└──────────────────┘ -``` - -``` sql -SELECT ifNull(NULL, 'b') -``` - -``` text -┌─ifNull(NULL, 'b')─┐ -│ b │ -└───────────────────┘ -``` - -## nullifname {#nullif} - -を返します `NULL` 引数が等しい場合。 - -``` sql -nullIf(x, y) -``` - -**パラメータ:** - -`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. - -**戻り値** - -- `NULL` 引数が等しい場合。 -- その `x` 引数が等しくない場合の値。 - -**例えば** - -``` sql -SELECT nullIf(1, 1) -``` - -``` text -┌─nullIf(1, 1)─┐ -│ ᴺᵁᴸᴸ │ -└──────────────┘ -``` - -``` sql -SELECT nullIf(1, 2) -``` - -``` text -┌─nullIf(1, 2)─┐ -│ 1 │ -└──────────────┘ -``` - -## assumeNotNull {#assumenotnull} - -結果はtypeの値になります [Nullable](../../sql_reference/data_types/nullable.md) 非のために- `Nullable` 値がない場合、 `NULL`. - -``` sql -assumeNotNull(x) -``` - -**パラメータ:** - -- `x` — The original value. - -**戻り値** - -- 元の値から非-`Nullable` そうでない場合はタイプします `NULL`. -- のデフォルト値。-`Nullable` 元の値が `NULL`. - -**例えば** - -考慮する `t_null` テーブル。 - -``` sql -SHOW CREATE TABLE t_null -``` - -``` text -┌─statement─────────────────────────────────────────────────────────────────┐ -│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ -└───────────────────────────────────────────────────────────────────────────┘ -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -を適用 `assumeNotNull` に機能 `y` コラム - -``` sql -SELECT assumeNotNull(y) FROM t_null -``` - -``` text -┌─assumeNotNull(y)─┐ -│ 0 │ -│ 3 │ -└──────────────────┘ -``` - -``` sql -SELECT toTypeName(assumeNotNull(y)) FROM t_null -``` - -``` text -┌─toTypeName(assumeNotNull(y))─┐ -│ Int8 │ -│ Int8 │ -└──────────────────────────────┘ -``` - -## toNullable {#tonullable} - -引数の型を次のように変換します `Nullable`. - -``` sql -toNullable(x) -``` - -**パラメータ:** - -- `x` — The value of any non-compound type. - -**戻り値** - -- Aの入力値 `Nullable` タイプ。 - -**例えば** - -``` sql -SELECT toTypeName(10) -``` - -``` text -┌─toTypeName(10)─┐ -│ UInt8 │ -└────────────────┘ -``` - -``` sql -SELECT toTypeName(toNullable(10)) -``` - -``` text -┌─toTypeName(toNullable(10))─┐ -│ Nullable(UInt8) │ -└────────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/ja/sql_reference/functions/geo.md b/docs/ja/sql_reference/functions/geo.md deleted file mode 100644 index c61027f8bcd..00000000000 --- a/docs/ja/sql_reference/functions/geo.md +++ /dev/null @@ -1,510 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 62 -toc_title: "\u5730\u7406\u5EA7\u6A19\u306E\u64CD\u4F5C" ---- - -# 地理座標を操作するための関数 {#functions-for-working-with-geographical-coordinates} - -## グレートサークル距離 {#greatcircledistance} - -を使用して、地球の表面上の二つの点の間の距離を計算します [大円式](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**入力パラメータ** - -- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. -- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. -- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. -- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. - -正の値は北緯と東経に対応し、負の値は南緯と西経に対応します。 - -**戻り値** - -メートルで、地球の表面上の二つの点の間の距離。 - -入力パラメーター値が範囲外になったときに例外を生成します。 - -**例えば** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## pointInEllipses {#pointinellipses} - -ポイントが楕円の少なくとも一つに属するかどうかをチェックします。 -座標は、デカルト座標系ではジオメトリです。 - -``` sql -pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) -``` - -**入力パラメータ** - -- `x, y` — Coordinates of a point on the plane. -- `xᵢ, yᵢ` — Coordinates of the center of the `i`-番目の省略記号。 -- `aᵢ, bᵢ` — Axes of the `i`-x、y座標の単位で番目の省略記号。 - -入力パラ `2+4⋅n`、どこ `n` 楕円の数です。 - -**戻り値** - -`1` ポイントは、楕円の少なくとも一つの内側にある場合; `0`そうでない場合。 - -**例えば** - -``` sql -SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) -``` - -``` text -┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ -│ 1 │ -└─────────────────────────────────────────────────┘ -``` - -## pointInPolygon {#pointinpolygon} - -るかどうかを判の点に属する多角形の面。 - -``` sql -pointInPolygon((x, y), [(a, b), (c, d) ...], ...) -``` - -**入力値** - -- `(x, y)` — Coordinates of a point on the plane. Data type — [タプル](../../sql_reference/data_types/tuple.md) — A tuple of two numbers. -- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [配列](../../sql_reference/data_types/array.md). 各頂点は、座標のペアで表されます `(a, b)`. 頂点は、時計回りまたは反時計回りの順序で指定する必要があります。 頂点の最小数は3です。 多角形は一定でなければなりません。 -- この機能は、穴(切り取られた部分)を持つ多角形もサポートします。 この場合、関数の追加の引数を使用してカットアウトセクションを定義するポリゴンを追加します。 この関数は、単純接続以外のポリゴンをサポートしません。 - -**戻り値** - -`1` ポイントがポリゴンの内側にある場合, `0` そうでない場合。 -ポイントがポリゴン境界上にある場合、関数は0または1を返します。 - -**例えば** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## geohashEncode {#geohashencode} - -緯度と経度をgeohash-stringとしてエンコードします。http://geohash.org/,https://en.wikipedia.org/wiki/geohash). - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**入力値** - -- 経度-エンコードしたい座標の経度の部分。 範囲の浮遊`[-180°, 180°]` -- latitude-エンコードする座標の緯度部分。 範囲の浮遊 `[-90°, 90°]` -- precision-オプション、結果としてエンコードされる文字列の長さ。 `12`. 範囲の整数 `[1, 12]`. より小さい任意の値 `1` またはより大きい `12` に変換される。 `12`. - -**戻り値** - -- 英数字 `String` エンコードされた座標(base32エンコードアルファベットの修正版が使用されます)。 - -**例えば** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## geohashDecode {#geohashdecode} - -Geohashでエンコードされた文字列を経度と緯度にデコードします。 - -**入力値** - -- エンコードされた文字列-geohashエンコードされた文字列。 - -**戻り値** - -- (経度、緯度)-2-のタプル `Float64` 経度と緯度の値。 - -**例えば** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## geoToH3 {#geotoh3} - -を返します [H3](https://uber.github.io/h3/#/documentation/overview/introduction) 点指数 `(lon, lat)` 指定決断を使って。 - -[H3](https://uber.github.io/h3/#/documentation/overview/introduction) 地理的指標システムであり、地球の表面は六角形のタイルに分割されています。 トップレベルの各六角形は、より小さいものに分割することができます。 - -このインデックスは、主にバケットの場所やその他の地理空間の操作に使用されます。 - -**構文** - -``` sql -geoToH3(lon, lat, resolution) -``` - -**パラメータ** - -- `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]`. タイプ: [UInt8](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- 六角形のインデックス番号。 -- エラーの場合は0。 - -タイプ: `UInt64`. - -**例えば** - -クエリ: - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -結果: - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## geohashesInBox {#geohashesinbox} - -与えられたボックスの内側にあり、境界と交差する、与えられた精度のgeohashエンコードされた文字列の配列を返します。 - -**入力値** - -- longitude\_min-最小経度、範囲内の浮動小数点数 `[-180°, 180°]` -- latitude\_min-最小緯度、範囲内の浮動小数点数 `[-90°, 90°]` -- longitude\_max-最高の経度、範囲の浮遊価値 `[-180°, 180°]` -- latitude\_max-最大緯度、範囲内の浮動小数点数 `[-90°, 90°]` -- 精密-geohashの精密, `UInt8` 範囲内 `[1, 12]` - -すべての座標パラメータは同じタイプである必要があります。 `Float32` または `Float64`. - -**戻り値** - -- 提供された領域をカバーするgeohash-ボックスの精度の長い文字列の配列、あなたはアイテムの順序に頼るべきではありません。 -- \[\]-空の配列の場合 *分* の値 *緯度* と *経度* 対応するよりも小さくない *最大* 値。 - -結果の配列が10'000'000項目を超える場合、関数は例外をスローすることに注意してください。 - -**例えば** - -``` sql -SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos -``` - -``` text -┌─thasos──────────────────────────────────────┐ -│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ -└─────────────────────────────────────────────┘ -``` - -## h3GetBaseCell {#h3getbasecell} - -インデックスの基本セル番号を返します。 - -**構文** - -``` sql -h3GetBaseCell(index) -``` - -**パラメータ** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- 六角形ベースセル番号。 タイプ: [UInt8](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT h3GetBaseCell(612916788725809151) as basecell -``` - -結果: - -``` text -┌─basecell─┐ -│ 12 │ -└──────────┘ -``` - -## h3HexAreaM2 {#h3hexaream2} - -与えられた解像度で平方メートルの平均六角形の面積。 - -**構文** - -``` sql -h3HexAreaM2(resolution) -``` - -**パラメータ** - -- `resolution` — Index resolution. Range: `[0, 15]`. タイプ: [UInt8](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- Area in m². Type: [Float64](../../sql_reference/data_types/float.md). - -**例えば** - -クエリ: - -``` sql -SELECT h3HexAreaM2(13) as area -``` - -結果: - -``` text -┌─area─┐ -│ 43.9 │ -└──────┘ -``` - -## h3IndexesAreNeighbors {#h3indexesareneighbors} - -指定されたh3indexesが近傍であるかどうかを返します。 - -**構文** - -``` sql -h3IndexesAreNeighbors(index1, index2) -``` - -**パラメータ** - -- `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). - -**戻り値** - -- を返します `1` インデックスが隣接している場合, `0` そうでなければ タイプ: [UInt8](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n -``` - -結果: - -``` text -┌─n─┐ -│ 1 │ -└───┘ -``` - -## h3ToChildren {#h3tochildren} - -指定したインデックスの子インデックスを持つ配列を返します。 - -**構文** - -``` sql -h3ToChildren(index, resolution) -``` - -**パラメータ** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. タイプ: [UInt8](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- 子h3インデックスを持つ配列。 タイプの配列: [UInt64](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT h3ToChildren(599405990164561919, 6) AS children -``` - -結果: - -``` text -┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## h3親 {#h3toparent} - -を返します(粗)インデックスを含むとして指定されたインデックス. - -**構文** - -``` sql -h3ToParent(index, resolution) -``` - -**パラメータ** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. タイプ: [UInt8](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- 親のh3インデックス。 タイプ: [UInt64](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT h3ToParent(599405990164561919, 3) as parent -``` - -結果: - -``` text -┌─────────────parent─┐ -│ 590398848891879423 │ -└────────────────────┘ -``` - -## h3ToString {#h3tostring} - -インデックスのh3index表現を文字列表現に変換します。 - -``` sql -h3ToString(index) -``` - -**パラメータ** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- H3インデックスの文字列表現。 タイプ: [文字列](../../sql_reference/data_types/string.md). - -**例えば** - -クエリ: - -``` sql -SELECT h3ToString(617420388352917503) as h3_string -``` - -結果: - -``` text -┌─h3_string───────┐ -│ 89184926cdbffff │ -└─────────────────┘ -``` - -## stringToH3 {#stringtoh3} - -文字列表現をh3index(uint64)表現に変換します。 - -``` sql -stringToH3(index_str) -``` - -**パラメータ** - -- `index_str` — String representation of the H3 index. Type: [文字列](../../sql_reference/data_types/string.md). - -**戻り値** - -- 六角形のインデックス番号。 エラー時に0を返します。 タイプ: [UInt64](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT stringToH3('89184926cc3ffff') as index -``` - -結果: - -``` text -┌──────────────index─┐ -│ 617420388351344639 │ -└────────────────────┘ -``` - -## h3GetResolution {#h3getresolution} - -インデックスの解像度を返します。 - -**構文** - -``` sql -h3GetResolution(index) -``` - -**パラメータ** - -- `index` — Hexagon index number. Type: [UInt64](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -- インデックスの解決。 範囲: `[0, 15]`. タイプ: [UInt8](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT h3GetResolution(617420388352917503) as res -``` - -結果: - -``` text -┌─res─┐ -│ 9 │ -└─────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/ja/sql_reference/functions/hash_functions.md b/docs/ja/sql_reference/functions/hash_functions.md deleted file mode 100644 index 7b2eb3fc239..00000000000 --- a/docs/ja/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,446 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 50 -toc_title: "\u30CF\u30C3\u30B7\u30E5" ---- - -# ハッシュ関数 {#hash-functions} - -ハッシュ関数は、要素の決定論的な擬似ランダムシャッフルに使用できます。 - -## ハーフmd5 {#hash-functions-halfmd5} - -[解釈する](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) すべての入力パラメーターを文字列として計算します [MD5](https://en.wikipedia.org/wiki/MD5) それぞれのハッシュ値。 次に、ハッシュを結合し、結果の文字列のハッシュの最初の8バイトを取り、それらを次のように解釈します `UInt64` ビッグエンディアンのバイト順。 - -``` sql -halfMD5(par1, ...) -``` - -この関数は比較的遅い(プロセッサコアあたり5万個の短い文字列)。 -を使用することを検討 [サイファッシュ64](#hash_functions-siphash64) 代わりに機能。 - -**パラメータ** - -この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql_reference/data_types/index.md). - -**戻り値** - -A [UInt64](../../sql_reference/data_types/int_uint.md) データ型ハッシュ値。 - -**例えば** - -``` sql -SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type -``` - -``` text -┌────────halfMD5hash─┬─type───┐ -│ 186182704141653334 │ UInt64 │ -└────────────────────┴────────┘ -``` - -## MD5 {#hash_functions-md5} - -文字列からmd5を計算し、結果のバイトセットをfixedstring(16)として返します。 -特にmd5を必要としないが、適切な暗号化128ビットハッシュが必要な場合は、 ‘sipHash128’ 代わりに機能。 -Md5sumユーティリティによる出力と同じ結果を得たい場合は、lower(hex(MD5(s)))を使用します。 - -## サイファッシュ64 {#hash_functions-siphash64} - -64ビットを生成する [サイファッシュ](https://131002.net/siphash/) ハッシュ値。 - -``` sql -sipHash64(par1,...) -``` - -これは暗号化ハッシュ関数です。 それはより速い少なくとも三回働きます [MD5](#hash_functions-md5) 機能。 - -機能 [解釈する](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) すべての入力パラメータを文字列として計算し、それぞれのハッシュ値を計算します。 その融合ハッシュにより、次のアルゴリズム: - -1. すべての入力パラメータをハッシュした後、関数はハッシュの配列を取得します。 -2. 関数は、第一及び第二の要素を取り、それらの配列のためのハッシュを計算します。 -3. 次に、関数は、前のステップで計算されたハッシュ値と最初のハッシュ配列の第三の要素を取り、それらの配列のハッシュを計算します。 -4. 最初のハッシュ配列の残りのすべての要素について、前の手順が繰り返されます。 - -**パラメータ** - -この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql_reference/data_types/index.md). - -**戻り値** - -A [UInt64](../../sql_reference/data_types/int_uint.md) データ型ハッシュ値。 - -**例えば** - -``` sql -SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type -``` - -``` text -┌──────────────SipHash─┬─type───┐ -│ 13726873534472839665 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## サイファシー128 {#hash_functions-siphash128} - -文字列からサイファッシュを計算します。 -文字列型引数を受け取ります。 fixedstring(16)を返します。 -Siphash64とは異なり、最終的なxor折りたたみ状態は128ビットまでしか行われません。 - -## cityHash64 {#cityhash64} - -64ビットを生成する [CityHash](https://github.com/google/cityhash) ハッシュ値。 - -``` sql -cityHash64(par1,...) -``` - -これは高速な非暗号化ハッシュ関数です。 文字列パラメーターにはcityhashアルゴリズムを使用し、他のデータ型のパラメーターには実装固有の高速非暗号化ハッシュ関数を使用します。 この関数は、最終的な結果を得るためにcityhashコンビネータを使用します。 - -**パラメータ** - -この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql_reference/data_types/index.md). - -**戻り値** - -A [UInt64](../../sql_reference/data_types/int_uint.md) データ型ハッシュ値。 - -**例** - -呼び出しの例: - -``` sql -SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type -``` - -``` text -┌─────────────CityHash─┬─type───┐ -│ 12072650598913549138 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -次の例は、行順序までの精度でテーブル全体のチェックサムを計算する方法を示しています: - -``` sql -SELECT groupBitXor(cityHash64(*)) FROM table -``` - -## intHash32 {#inthash32} - -任意のタイプの整数から32ビットのハッシュコードを計算します。 -これは、数値の平均品質の比較的高速な非暗号化ハッシュ関数です。 - -## intHash64 {#inthash64} - -任意のタイプの整数から64ビットのハッシュコードを計算します。 -それはinthash32より速く働きます。 平均品質。 - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -文字列からsha-1、sha-224、またはsha-256を計算し、結果のバイトセットをfixedstring(20)、fixedstring(28)、またはfixedstring(32)として返します。 -この関数はかなりゆっくりと動作します(sha-1はプロセッサコアあたり約5百万個の短い文字列を処理し、sha-224とsha-256は約2.2百万プロセス)。 -特定のハッシュ関数が必要で選択できない場合にのみ、この関数を使用することをお勧めします。 -このような場合でも、テーブルに値を挿入するときは、selectsに値を適用するのではなく、関数をオフラインで適用して事前計算することをお勧めします。 - -## URLHash(url\[,N\]) {#urlhashurl-n} - -いくつかのタイプの正規化を使用してurlから取得した文字列の高速でまともな品質の非暗号化ハッシュ関数。 -`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` または `#` 最後に、存在する場合。 -`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` または `#` 最後に、存在する場合。 -レベルはurlhierarchyと同じです。 この機能はyandexに固有です。メトリカ - -## farmHash64 {#farmhash64} - -64ビットを生成する [FarmHash](https://github.com/google/farmhash) ハッシュ値。 - -``` sql -farmHash64(par1, ...) -``` - -この関数は、 `Hash64` すべてからの方法 [利用可能な方法](https://github.com/google/farmhash/blob/master/src/farmhash.h). - -**パラメータ** - -この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql_reference/data_types/index.md). - -**戻り値** - -A [UInt64](../../sql_reference/data_types/int_uint.md) データ型ハッシュ値。 - -**例えば** - -``` sql -SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type -``` - -``` text -┌─────────────FarmHash─┬─type───┐ -│ 17790458267262532859 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## javaHash {#hash_functions-javahash} - -計算 [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) 文字列から。 このハッシュ関数は高速でも良い品質でもありません。 理由はただそれだけに使用する場合もこのアルゴリズムは実用化が始まっており他のシステムとしての計算は、全く同じ働きをします。 - -**構文** - -``` sql -SELECT javaHash(''); -``` - -**戻り値** - -A `Int32` データ型ハッシュ値。 - -**例えば** - -クエリ: - -``` sql -SELECT javaHash('Hello, world!'); -``` - -結果: - -``` text -┌─javaHash('Hello, world!')─┐ -│ -1880044555 │ -└───────────────────────────┘ -``` - -## javaHashUTF16LE {#javahashutf16le} - -計算 [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) 文字列から、UTF-16LEエンコーディングで文字列を表すバイトが含まれていると仮定します。 - -**構文** - -``` sql -javaHashUTF16LE(stringUtf16le) -``` - -**パラメータ** - -- `stringUtf16le` — a string in UTF-16LE encoding. - -**戻り値** - -A `Int32` データ型ハッシュ値。 - -**例えば** - -UTF-16LEでエンコードされた文字列で正しいクエリー。 - -クエリ: - -``` sql -SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) -``` - -結果: - -``` text -┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ -│ 3556498 │ -└──────────────────────────────────────────────────────────────┘ -``` - -## hiveHash {#hash-functions-hivehash} - -計算 `HiveHash` 文字列から。 - -``` sql -SELECT hiveHash(''); -``` - -これはちょうど [JavaHash](#hash_functions-javahash) サインビットをゼロにします。 この関数は、 [Apacheハイブ](https://en.wikipedia.org/wiki/Apache_Hive) 3.0より前のバージョンの場合。 このハッシュ関数は高速でも良い品質でもありません。 理由はただそれだけに使用する場合もこのアルゴリズムは実用化が始まっており他のシステムとしての計算は、全く同じ働きをします。 - -**戻り値** - -A `Int32` データ型ハッシュ値。 - -タイプ: `hiveHash`. - -**例えば** - -クエリ: - -``` sql -SELECT hiveHash('Hello, world!'); -``` - -結果: - -``` text -┌─hiveHash('Hello, world!')─┐ -│ 267439093 │ -└───────────────────────────┘ -``` - -## metroHash64 {#metrohash64} - -64ビットを生成する [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/) ハッシュ値。 - -``` sql -metroHash64(par1, ...) -``` - -**パラメータ** - -この関数は、可変個の入力パラメータを受け取ります。 パラメー [対応データ型](../../sql_reference/data_types/index.md). - -**戻り値** - -A [UInt64](../../sql_reference/data_types/int_uint.md) データ型ハッシュ値。 - -**例えば** - -``` sql -SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type -``` - -``` text -┌────────────MetroHash─┬─type───┐ -│ 14235658766382344533 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## jumpConsistentHash {#jumpconsistenthash} - -JumpConsistentHashフォームUInt64を計算します。 -UInt64型のキーとバケットの数です。 Int32を返します。 -詳細については、リンク: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) - -## murmurHash2\_32,murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} - -を生成する [MurmurHash2](https://github.com/aappleby/smhasher) ハッシュ値。 - -``` sql -murmurHash2_32(par1, ...) -murmurHash2_64(par1, ...) -``` - -**パラメータ** - -どちらの関数も、入力パラメータの可変数を取ります。 パラメー [対応データ型](../../sql_reference/data_types/index.md). - -**戻り値** - -- その `murmurHash2_32` 関数は、ハッシュ値を返します [UInt32](../../sql_reference/data_types/int_uint.md) データ型。 -- その `murmurHash2_64` 関数は、ハッシュ値を返します [UInt64](../../sql_reference/data_types/int_uint.md) データ型。 - -**例えば** - -``` sql -SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type -``` - -``` text -┌──────────MurmurHash2─┬─type───┐ -│ 11832096901709403633 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## murmurHash3\_32,murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} - -を生成する [MurmurHash3](https://github.com/aappleby/smhasher) ハッシュ値。 - -``` sql -murmurHash3_32(par1, ...) -murmurHash3_64(par1, ...) -``` - -**パラメータ** - -どちらの関数も、入力パラメータの可変数を取ります。 パラメー [対応データ型](../../sql_reference/data_types/index.md). - -**戻り値** - -- その `murmurHash3_32` 関数は、 [UInt32](../../sql_reference/data_types/int_uint.md) データ型ハッシュ値。 -- その `murmurHash3_64` 関数は、 [UInt64](../../sql_reference/data_types/int_uint.md) データ型ハッシュ値。 - -**例えば** - -``` sql -SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3─┬─type───┐ -│ 2152717 │ UInt32 │ -└─────────────┴────────┘ -``` - -## murmurHash3\_128 {#murmurhash3-128} - -128ビットを生成する [MurmurHash3](https://github.com/aappleby/smhasher) ハッシュ値。 - -``` sql -murmurHash3_128( expr ) -``` - -**パラメータ** - -- `expr` — [式](../syntax.md#syntax-expressions) を返す [文字列](../../sql_reference/data_types/string.md)-タイプ値。 - -**戻り値** - -A [FixedString(16)](../../sql_reference/data_types/fixedstring.md) データ型ハッシュ値。 - -**例えば** - -``` sql -SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3──────┬─type────────────┐ -│ 6�1�4"S5KT�~~q │ FixedString(16) │ -└──────────────────┴─────────────────┘ -``` - -## xxHash32,xxHash64 {#hash-functions-xxhash32} - -計算 `xxHash` 文字列から。 これは、二つの味、32および64ビットで提案されています。 - -``` sql -SELECT xxHash32(''); - -OR - -SELECT xxHash64(''); -``` - -**戻り値** - -A `Uint32` または `Uint64` データ型ハッシュ値。 - -タイプ: `xxHash`. - -**例えば** - -クエリ: - -``` sql -SELECT xxHash32('Hello, world!'); -``` - -結果: - -``` text -┌─xxHash32('Hello, world!')─┐ -│ 834093149 │ -└───────────────────────────┘ -``` - -**また見なさい** - -- [xxHash](http://cyan4973.github.io/xxHash/). - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/ja/sql_reference/functions/higher_order_functions.md b/docs/ja/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index 3dac2bd98aa..00000000000 --- a/docs/ja/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 57 -toc_title: "\u3088\u308A\u9AD8\u3044\u6B21\u6570" ---- - -# 高階関数 {#higher-order-functions} - -## `->` 演算子、ラムダ(params,expr)関数 {#operator-lambdaparams-expr-function} - -Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. - -例: `x -> 2 * x, str -> str != Referer.` - -高階関数は、関数の引数としてラムダ関数のみを受け入れることができます。 - -複数の引数を受け入れるラムダ関数は、高階関数に渡すことができます。 この場合、高次関数は、これらの引数が対応する同一の長さのいくつかの配列を渡されます。 - -いくつかの機能については、 [arrayCount](#higher_order_functions-array-count) または [arraySum](#higher_order_functions-array-count)、最初の引数(ラムダ関数)を省略することができます。 この場合、同一のマッピングが想定されます。 - -以下の関数ではラムダ関数を省略することはできません: - -- [arrayMap](#higher_order_functions-array-map) -- [arrayFilter](#higher_order_functions-array-filter) -- [arrayfillanguage](#higher_order_functions-array-fill) -- [arrayReverseFill](#higher_order_functions-array-reverse-fill) -- [arraySplit](#higher_order_functions-array-split) -- [arrayReverseSplit](#higher_order_functions-array-reverse-split) -- [arrayFirst](#higher_order_functions-array-first) -- [arrayFirstIndex](#higher_order_functions-array-first-index) - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -の元のアプリケーションから取得した配列を返します。 `func` の各要素への機能 `arr` 配列だ - -例: - -``` sql -SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,4,5] │ -└─────────┘ -``` - -次の例は、異なる配列から要素のタプルを作成する方法を示しています: - -``` sql -SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res -``` - -``` text -┌─res─────────────────┐ -│ [(1,4),(2,5),(3,6)] │ -└─────────────────────┘ -``` - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayMap` 機能。 - -### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} - -要素のみを含む配列を返します `arr1` そのために `func` 0以外の値を返します。 - -例: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - -``` text -┌─res───────────┐ -│ ['abc World'] │ -└───────────────┘ -``` - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - -``` text -┌─res─┐ -│ [2] │ -└─────┘ -``` - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFilter` 機能。 - -### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} - -スキャンスルー `arr1` 最初の要素から最後の要素まで `arr1[i]` によって `arr1[i - 1]` もし `func` 0を返します。 の最初の要素 `arr1` 交換されません。 - -例: - -``` sql -SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res──────────────────────────────┐ -│ [1,1,3,11,12,12,12,5,6,14,14,14] │ -└──────────────────────────────────┘ -``` - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFill` 機能。 - -### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} - -スキャンスルー `arr1` 最後の要素から最初の要素へと置き換えます `arr1[i]` によって `arr1[i + 1]` もし `func` 0を返します。 の最後の要素 `arr1` 交換されません。 - -例: - -``` sql -SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res────────────────────────────────┐ -│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ -└────────────────────────────────────┘ -``` - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayReverseFill` 機能。 - -### arraySplit(func, arr1, …) {#higher_order_functions-array-split} - -分割 `arr1` 複数の配列に変換します とき `func` 0以外のものを返すと、配列は要素の左側で分割されます。 配列は最初の要素の前に分割されません。 - -例: - -``` sql -SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res─────────────┐ -│ [[1,2,3],[4,5]] │ -└─────────────────┘ -``` - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arraySplit` 機能。 - -### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} - -分割 `arr1` 複数の配列に変換します とき `func` 0以外のものを返すと、配列は要素の右側で分割されます。 配列は最後の要素の後に分割されません。 - -例: - -``` sql -SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res───────────────┐ -│ [[1],[2,3,4],[5]] │ -└───────────────────┘ -``` - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arraySplit` 機能。 - -### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} - -Funcが0以外を返すarr配列内の要素の数を返します。 もし ‘func’ 指定されていない場合は、配列内の非ゼロ要素の数を返します。 - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -少なくとも1つの要素がある場合は1を返します ‘arr’ そのために ‘func’ 0以外の値を返します。 それ以外の場合は、0を返します。 - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -場合は1を返します ‘func’ すべての要素に対して0以外のものを返します ‘arr’. それ以外の場合は、0を返します。 - -### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} - -の合計を返します ‘func’ 値。 関数が省略された場合、それだけで配列要素の合計を返します。 - -### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} - -の最初の要素を返します ‘arr1’ そのための配列 ‘func’ 0以外の値を返します。 - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFirst` 機能。 - -### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} - -最初の要素のインデックスを返します ‘arr1’ そのための配列 ‘func’ 0以外の値を返します。 - -最初の引数(ラムダ関数)を省略することはできないことに注意してください。 `arrayFirstIndex` 機能。 - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -ソース配列内の要素の部分和の配列(実行中の合計)を返します。 この `func` 関数が指定されると、配列要素の値が合計される前にこの関数によって変換されます。 - -例えば: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - -``` text -┌─res──────────┐ -│ [1, 2, 3, 4] │ -└──────────────┘ -``` - -### ツ環板篠ョツ嘉ッツ偲青ツエツδツ-ツアツイツ-ツエツス) {#arraycumsumnonnegativearr} - -と同じ `arrayCumSum`,ソース配列の要素の部分和の配列を返します(実行中の合計). 異なる `arrayCumSum`、その後、戻り値がゼロ未満の値が含まれている場合、値がゼロで置き換えられ、その後の計算は、ゼロのパラメータで実行されます。 例えば: - -``` sql -SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,0,1] │ -└───────────┘ -``` - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -の要素をソートした結果として配列を返します `arr1` 昇順で。 この `func` 関数が指定され、ソート順序は関数の結果によって決定されます `func` 配列(配列)の要素に適用されます) - -その [シュワルツ語変換](https://en.wikipedia.org/wiki/Schwartzian_transform) 分類の効率を改善するのに使用されています。 - -例えば: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -の詳細については、 `arraySort` 方法は、を参照してください [配列を操作するための関数](array_functions.md#array_functions-sort) セクション。 - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -の要素をソートした結果として配列を返します `arr1` 降順で。 この `func` 関数が指定され、ソート順序は関数の結果によって決定されます `func` 配列(配列)の要素に適用されます。 - -例えば: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -の詳細については、 `arrayReverseSort` 方法は、を参照してください [配列を操作するための関数](array_functions.md#array_functions-reverse-sort) セクション。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/ja/sql_reference/functions/index.md b/docs/ja/sql_reference/functions/index.md deleted file mode 100644 index 1094c1857cf..00000000000 --- a/docs/ja/sql_reference/functions/index.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Functions -toc_priority: 32 -toc_title: "\u5C0E\u5165" ---- - -# 機能 {#functions} - -少なくとも\*つのタイプの関数があります-通常の関数(これらは単に呼び出されます “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn't depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). - -このセクションでは、定期的な機能を説明します。 のための集計関数の項をご参照ください “Aggregate functions”. - -\*-その機能の第三のタイプがあります ‘arrayJoin’ テーブルの機能も別々に言及することができます。\* - -## 強力なタイピング {#strong-typing} - -標準sqlとは対照的に、clickhouseは強力な型付けをしています。 言い換えれば、型間の暗黙の変換は行われません。 各関数は、特定のタイプのセットに対して機能します。 これは、時には型変換関数を使用する必要があることを意味します。 - -## 共通部分式の削除 {#common-subexpression-elimination} - -同じast(構文解析の同じレコードまたは同じ結果)を持つクエリ内のすべての式は、同じ値を持つとみなされます。 このような式は連結され、一度実行されます。 この方法では、同一のサブクエリも削除されます。 - -## 結果のタイプ {#types-of-results} - -すべての関数は、結果として単一の戻り値を返します(複数の値ではなく、ゼロの値ではありません)。 結果の型は、通常、値ではなく引数の型によってのみ定義されます。 例外は、tupleelement関数(a.n演算子)とtofixedstring関数です。 - -## 定数 {#constants} - -簡単にするために、特定の関数はいくつかの引数の定数のみで動作します。 たとえば、like演算子のright引数は定数でなければなりません。 -ほとんどすべての関数は定数引数の定数を返します。 例外は、乱数を生成する関数です。 -その ‘now’ 関数は、異なる時間に実行されたクエリに対して異なる値を返しますが、定数は単一のクエリ内でのみ重要であるため、結果は定数と見なされます。 -定数式も定数と見なされます(たとえば、like演算子の右半分は複数の定数から構築できます)。 - -関数は、定数と非定数引数(異なるコードが実行される)のために異なる方法で実装することができます。 しかし、定数と同じ値のみを含む真の列の結果は、互いに一致する必要があります。 - -## ヌル処理 {#null-processing} - -関数の動作は次のとおりです: - -- 関数の引数のうち少なくとも一つが `NULL`、機能結果はまたあります `NULL`. -- 各機能の説明で個別に指定される特別な動作。 のclickhouseソースコードは、これらの機能の `UseDefaultImplementationForNulls=false`. - -## 不変性 {#constancy} - -Functions can't change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. - -## エラー処理 {#error-handling} - -データが無効な場合、一部の関数は例外をスローする可能性があります。 この場合、クエリは取り消され、エラーテキストがクライアントに返されます。 分散処理の場合、いずれかのサーバーで例外が発生すると、他のサーバーもクエリを中止しようとします。 - -## 引数式の評価 {#evaluation-of-argument-expressions} - -ほぼすべてのプログラミング言語の一つの引数が評価される。 これは通常、演算子です `&&`, `||`、と `?:`. -しかし、clickhouseでは、関数(演算子)の引数は常に評価されます。 これは、各行を別々に計算するのではなく、列の全部分が一度に評価されるためです。 - -## 分散クエリ処理のための関数の実行 {#performing-functions-for-distributed-query-processing} - -分散クエリ処理では、できるだけ多くのクエリ処理がリモートサーバーで実行され、その他のステージ(中間結果とそれ以降のすべてのステージ)はリクエスター - -つまり、異なるサーバーで機能を実行できます。 -たとえば、クエリでは `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` - -- もし `distributed_table` は、少なくとも二つのシャード、機能 ‘g’ と ‘h’ リモートサーバー上で実行される。 ‘f’ 要求元サーバーで実行されます。 -- もし `distributed_table` 一つだけシャード、すべてを持っています ‘f’, ‘g’、と ‘h’ 機能は、このシャードのサーバー上で実行されます。 - -関数の結果は、通常、実行されるサーバーに依存しません。 しかし、時にはこれが重要です。 -たとえば、辞書を操作する関数は、実行しているサーバー上に存在する辞書を使用します。 -別の例は、 `hostName` この関数は、実行されているサーバーの名前を返します。 `GROUP BY` aのサーバーによって `SELECT` クエリ。 - -クエリ内の関数がリクエストサーバー上で実行されているが、リモートサーバー上で実行する必要がある場合は、次のようにラップします。 ‘any’ 関数を集めるか、それをキーに追加します `GROUP BY`. - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/ja/sql_reference/functions/introspection.md b/docs/ja/sql_reference/functions/introspection.md deleted file mode 100644 index 78a1c6ae557..00000000000 --- a/docs/ja/sql_reference/functions/introspection.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 65 -toc_title: "\u30A4\u30F3\u30C8\u30ED\u30B9\u30DA\u30AF\u30B7\u30E7\u30F3" ---- - -# イントロスペクション関数 {#introspection-functions} - -利用できる表示可能なプラグインで説明してこの章にintrospect [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) と [DWARF](https://en.wikipedia.org/wiki/DWARF) のためのクエリープロファイリング. - -!!! warning "警告" - これらの機能は、が必要となる場合があり安全に配慮し - -イントロスペクション機能を適切に動作させるため: - -- インストール `clickhouse-common-static-dbg` パッケージ。 - -- セットを [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) 1に設定します。 - - For security reasons introspection functions are disabled by default. - -ClickHouseはプロファイラーレポートを保存します [trace\_log](../../operations/system_tables.md#system_tables-trace_log) システムテーブル。 のテーブルプロファイラで設定されます。 - -## アドレスストリンcolor {#addresstoline} - -ClickHouseサーバープロセス内の仮想メモリアドレスを、ClickHouseソースコード内のファイル名と行番号に変換します。 - -公式のclickhouseのパッケージを使用すれば、取付ける必要があります `clickhouse-common-static-dbg` パッケージ。 - -**構文** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**パラメータ** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**戻り値** - -- コロンで区切られたこのファイル内のソースコードのファイル名と行番号。 - - For example, `/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199`, where `199` is a line number. - -- 関数がデバッグ情報を見つけることができなかった場合、バイナリの名前。 - -- アドレスが有効でない場合は、空の文字列。 - -タイプ: [文字列](../../sql_reference/data_types/string.md). - -**例えば** - -イントロスペクション機能の有効化: - -``` sql -SET allow_introspection_functions=1 -``` - -から最初の文字列を選択する `trace_log` システム表: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -その `trace` 分野のスタックトレースを瞬時にサンプリングします。 - -単一のアドレスのソースコードファイル名と行番号を取得する: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 -``` - -スタックトレース全体に関数を適用する: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -その [arrayMap](higher_order_functions.md#higher_order_functions-array-map) 機能はの各々の個々の要素を処理することを割り当てます `trace` による配列 `addressToLine` 機能。 この処理の結果は、次のように表示されます。 `trace_source_code_lines` 出力の列。 - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../dbms/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## addressToSymbol {#addresstosymbol} - -に変換する仮想メモリアドレス内clickhouseサーバプロセスのシンボルからclickhouseオブジェクトファイルです。 - -**構文** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**パラメータ** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**戻り値** - -- ClickHouseオブジェクトファイルからの記号。 -- アドレスが有効でない場合は、空の文字列。 - -タイプ: [文字列](../../sql_reference/data_types/string.md). - -**例えば** - -イントロスペクション機能の有効化: - -``` sql -SET allow_introspection_functions=1 -``` - -から最初の文字列を選択する `trace_log` システム表: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -その `trace` 分野のスタックトレースを瞬時にサンプリングします。 - -単一のアドレスのシンボルを取得する: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -スタックトレース全体に関数を適用する: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -その [arrayMap](higher_order_functions.md#higher_order_functions-array-map) 機能はの各々の個々の要素を処理することを割り当てます `trace` による配列 `addressToSymbols` 機能。 この処理の結果は、次のように表示されます。 `trace_symbols` 出力の列。 - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## デマングル {#demangle} - -を使用して取得できるシンボルを変換します。 [addressToSymbol](#addresstosymbol) C++の関数名に関数。 - -**構文** - -``` sql -demangle(symbol) -``` - -**パラメータ** - -- `symbol` ([文字列](../../sql_reference/data_types/string.md)) — Symbol from an object file. - -**戻り値** - -- C++関数の名前。 -- シンボルが有効でない場合は、空の文字列。 - -タイプ: [文字列](../../sql_reference/data_types/string.md). - -**例えば** - -イントロスペクション機能の有効化: - -``` sql -SET allow_introspection_functions=1 -``` - -から最初の文字列を選択する `trace_log` システム表: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -その `trace` 分野のスタックトレースを瞬時にサンプリングします。 - -単一アドレスの関数名の取得: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -スタックトレース全体に関数を適用する: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -その [arrayMap](higher_order_functions.md#higher_order_functions-array-map) 機能はの各々の個々の要素を処理することを割り当てます `trace` による配列 `demangle` 機能。 この処理の結果は、次のように表示されます。 `trace_functions` 出力の列。 - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/ja/sql_reference/functions/ip_address_functions.md b/docs/ja/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index 1eca3b316fc..00000000000 --- a/docs/ja/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 55 -toc_title: "IP\u30A2\u30C9\u30EC\u30B9\u306E\u64CD\u4F5C" ---- - -# IPアドレスを操作するための機能 {#functions-for-working-with-ip-addresses} - -## IPv4NumToString(num) {#ipv4numtostringnum} - -UInt32番号を受け取ります。 ビッグエンディアンのIPv4アドレスとして解釈します。 対応するIPv4アドレスをA.B.C.dという形式で含む文字列を返します。 - -## IPv4StringToNum(s) {#ipv4stringtonums} - -IPv4NumToStringの逆関数. IPv4アドレスの形式が無効な場合は、0を返します。 - -## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} - -IPv4NumToStringに似ていますが、最後のオクテットの代わりにxxxを使用します。 - -例えば: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─k──────────────┬─────c─┐ -│ 83.149.9.xxx │ 26238 │ -│ 217.118.81.xxx │ 26074 │ -│ 213.87.129.xxx │ 25481 │ -│ 83.149.8.xxx │ 24984 │ -│ 217.118.83.xxx │ 22797 │ -│ 78.25.120.xxx │ 22354 │ -│ 213.87.131.xxx │ 21285 │ -│ 78.25.121.xxx │ 20887 │ -│ 188.162.65.xxx │ 19694 │ -│ 83.149.48.xxx │ 17406 │ -└────────────────┴───────┘ -``` - -使用して以来 ‘xxx’ 非常に珍しいです、これは将来変更されるかもしれません。 このフラグメントの正確なフォーマットに依存しないことをお勧めします。 - -### IPv6NumToString(x) {#ipv6numtostringx} - -バイナリ形式のipv6アドレスを含むfixedstring(16)値を受け入れます。 このアドレスを含む文字列をテキスト形式で返します。 -IPv6にマップされたIPv4アドレスは、::ffff:111.222.33.44の形式で出力されます。 例: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - -``` text -┌─addr─────────┐ -│ 2a02:6b8::11 │ -└──────────────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ -│ 2a02:2168:aaa:bbbb::2 │ 24695 │ -│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ -│ 2a02:6b8:0:fff::ff │ 16389 │ -│ 2a01:4f8:111:6666::2 │ 16016 │ -│ 2a02:2168:888:222::1 │ 15896 │ -│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ -│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ -│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ -│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ -│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ -└─────────────────────────────────────────┴───────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)─┬──────c─┐ -│ ::ffff:94.26.111.111 │ 747440 │ -│ ::ffff:37.143.222.4 │ 529483 │ -│ ::ffff:5.166.111.99 │ 317707 │ -│ ::ffff:46.38.11.77 │ 263086 │ -│ ::ffff:79.105.111.111 │ 186611 │ -│ ::ffff:93.92.111.88 │ 176773 │ -│ ::ffff:84.53.111.33 │ 158709 │ -│ ::ffff:217.118.11.22 │ 154004 │ -│ ::ffff:217.118.11.33 │ 148449 │ -│ ::ffff:217.118.11.44 │ 148243 │ -└────────────────────────────┴────────┘ -``` - -## IPv6StringToNum(s) {#ipv6stringtonums} - -IPv6NumToStringの逆関数. IPv6アドレスの形式が無効な場合は、nullバイトの文字列を返します。 -HEXは大文字または小文字にできます。 - -## IPv4ToIPv6(x) {#ipv4toipv6x} - -を取る `UInt32` 番号 IPv4アドレスとして解釈します。 [ビッグエンディアン](https://en.wikipedia.org/wiki/Endianness). Aを返します `FixedString(16)` バイナリ形式のIPv6アドレスを含む値。 例: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - -``` text -┌─addr───────────────┐ -│ ::ffff:192.168.0.1 │ -└────────────────────┘ -``` - -## cutIPv6(x,bitsToCutForIPv6,bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} - -バイナリ形式のipv6アドレスを含むfixedstring(16)値を受け入れます。 テキスト形式で削除された指定されたビット数のアドレスを含む文字列を返します。 例えば: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - -``` text -┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ -│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ -└─────────────────────────────────────┴─────────────────────┘ -``` - -## IPv4CIDRToRange(ipv4,cidr), {#ipv4cidrtorangeipv4-cidr} - -IPv4とUInt8の値を受け取ります。 [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). 下位のサブネットの範囲と上位の範囲を含むIPv4を持つタプルを返します。 - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - -``` text -┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ -│ ('192.168.0.0','192.168.255.255') │ -└────────────────────────────────────────────┘ -``` - -## IPv6CIDRToRange(ipv6,cidr), {#ipv6cidrtorangeipv6-cidr} - -Cidrを含むIPv6およびUInt8値を受け入れます。 IPv6の下位範囲と上位のサブネットを含むタプルを返します。 - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); -``` - -``` text -┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ -│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -## toIPv4(文字列) {#toipv4string} - -別名を指定する `IPv4StringToNum()` これはIPv4アドレスの文字列形式をとり、その値を返します。 [IPv4](../../sql_reference/data_types/domains/ipv4.md) 返される値に等しいバイナリです `IPv4StringToNum()`. - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - -``` text -┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ -│ UInt32 │ IPv4 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - -``` text -┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ -│ ABE1822D │ ABE1822D │ -└───────────────────────────────────┴──────────────────────────┘ -``` - -## toIPv6(文字列) {#toipv6string} - -別名を指定する `IPv6StringToNum()` これはIPv6アドレスの文字列形式を取り、値をの戻します [IPv6](../../sql_reference/data_types/domains/ipv6.md) 返される値に等しいバイナリです `IPv6StringToNum()`. - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - -``` text -┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ -│ FixedString(16) │ IPv6 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - -``` text -┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ -│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ -└───────────────────────────────────┴──────────────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/ja/sql_reference/functions/json_functions.md b/docs/ja/sql_reference/functions/json_functions.md deleted file mode 100644 index f3695a3bab9..00000000000 --- a/docs/ja/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 56 -toc_title: "JSON\u3067\u306E\u4F5C\u696D." ---- - -# JSONを操作するための関数 {#functions-for-working-with-json} - -Yandexの中。Metrica、JSONで送信したユーザーとしてセッションパラメータ。 このJSONを操作するための特別な関数がいくつかあります。 (ほとんどの場合、JSONsはさらに前処理され、結果の値は処理された形式で別々の列に格納されます。)これらの関数はすべて、JSONができることについての強い前提に基づいていますが、仕事を終わらせるためにできるだけ少なくしようとします。 - -以下の仮定が行われます: - -1. フィールド名(関数の引数)は定数でなければなりません。 -2. フィールド名は何とかcanonicallyで符号化されたjson. 例えば: `visitParamHas('{"abc":"def"}', 'abc') = 1`、しかし `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. フィールドは、任意の入れ子レベルで無差別に検索されます。 一致するフィールドが複数ある場合は、最初のオカレンスが使用されます。 -4. JSONには、文字列リテラルの外側にスペース文字はありません。 - -## visitParamHas(パラメータ,名前) {#visitparamhasparams-name} - -フィールドがあるかどうかをチェック ‘name’ 名前だ - -## visitParamExtractUInt(パラメータ,名前) {#visitparamextractuintparams-name} - -指定されたフィールドの値からuint64を解析します ‘name’. これが文字列フィールドの場合、文字列の先頭から数値を解析しようとします。 フィールドが存在しないか、存在するが数値が含まれていない場合は、0を返します。 - -## visitParamExtractInt(パラメータ,名前) {#visitparamextractintparams-name} - -Int64の場合と同じです。 - -## visitParamExtractFloat(パラメーター,名前) {#visitparamextractfloatparams-name} - -Float64の場合と同じです。 - -## visitParamExtractBool(パラメーター,名前) {#visitparamextractboolparams-name} - -True/false値を解析します。 結果はUInt8です。 - -## visitParamExtractRaw(パラメータ,名前) {#visitparamextractrawparams-name} - -セパレータを含むフィールドの値を返します。 - -例: - -``` sql -visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' -visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' -``` - -## visitParamExtractString(パラメーター,名前) {#visitparamextractstringparams-name} - -文字列を二重引用符で解析します。 値はエスケープされません。 エスケープ解除に失敗した場合は、空の文字列を返します。 - -例: - -``` sql -visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' -visitParamExtractString('{"abc":"hello}', 'abc') = '' -``` - -現在、この形式のコードポイントはサポートされていません `\uXXXX\uYYYY` これは、(彼らはCESU-8の代わりにUTF-8に変換されます)基本的な多言語面からではありません。 - -次の関数は、以下に基づいています [simdjson](https://github.com/lemire/simdjson) より複雑なJSON解析要件のために設計。 上記の前提2は依然として適用されます。 - -## isValidJSON(json) {#isvalidjsonjson} - -渡された文字列が有効なjsonであることを確認します。 - -例: - -``` sql -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} - -JSONドキュメントに値が存在する場合, `1` は返却されます。 - -値が存在しない場合, `0` は返却されます。 - -例: - -``` sql -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 -``` - -`indices_or_keys` それぞれの引数は、文字列または整数のいずれかになります。 - -- 文字列=アクセスオブジェクトにより、会員に対す。 -- 正の整数=最初からn番目のメンバー/キーにアクセスします。 -- 負の整数=最後からn番目のメンバー/キーにアクセスします。 - -要素の最小インデックスは1です。 したがって、要素0は存在しません。 - -整数を使用して、json配列とjsonオブジェクトの両方にアクセスできます。 - -例えば: - -``` sql -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' -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} - -JSON配列またはJSONオブジェクトの長さを返します。 - -値が存在しないか、間違った型を持っている場合, `0` は返却されます。 - -例: - -``` sql -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} - -JSON値の型を返します。 - -値が存在しない場合, `Null` は返却されます。 - -例: - -``` sql -SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' -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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -JSONを解析し、値を抽出します。 これらの機能と類似 `visitParam` 機能。 - -値が存在しないか、間違った型を持っている場合, `0` は返却されます。 - -例: - -``` sql -SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 -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} - -JSONを解析し、文字列を抽出します。 この関数は次のようになります `visitParamExtractString` 機能。 - -値が存在しないか、間違った型を持っている場合は、空の文字列が返されます。 - -値はエスケープされません。 エスケープ解除に失敗した場合は、空の文字列を返します。 - -例: - -``` sql -SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' -SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' -SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' -``` - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -JSONを解析し、指定されたClickHouseデータ型の値を抽出します。 - -これは以前の一般化です `JSONExtract` 機能。 -これは -`JSONExtract(..., 'String')` とまったく同じを返します `JSONExtractString()`, -`JSONExtract(..., 'Float64')` とまったく同じを返します `JSONExtractFloat()`. - -例: - -``` sql -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL -SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 -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} - -値が指定されたclickhouseデータ型のjsonからキーと値のペアを解析します。 - -例えば: - -``` sql -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} - -JSONの一部を返します。 - -パートが存在しないか、間違った型を持っている場合は、空の文字列が返されます。 - -例えば: - -``` sql -SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' -``` - -## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} - -それぞれが未解析の文字列として表されるjson配列の要素を持つ配列を返します。 - -その部分が存在しない場合、または配列でない場合は、空の配列が返されます。 - -例えば: - -``` sql -SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/ja/sql_reference/functions/machine_learning_functions.md b/docs/ja/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index 9c7bc3df243..00000000000 --- a/docs/ja/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 64 -toc_title: "\u6A5F\u68B0\u5B66\u7FD2\u306E\u6A5F\u80FD" ---- - -# 機械学習の機能 {#machine-learning-functions} - -## evalMLMethod(予測) {#machine_learning_methods-evalmlmethod} - -適合回帰モデルを使用した予測 `evalMLMethod` 機能。 リンクを見る `linearRegression`. - -### 確率的線形回帰 {#stochastic-linear-regression} - -その [stochasticLinearRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlinearregression) 集合関数は,線形モデルとMSE損失関数を用いた確率的勾配降下法を実装する。 使用 `evalMLMethod` 新しいデータを予測する。 - -### 確率論的ロジスティック回帰 {#stochastic-logistic-regression} - -その [stochasticLogisticRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlogisticregression) 集合関数は,二値分類問題に対して確率的勾配降下法を実装する。 使用 `evalMLMethod` 新しいデータを予測する。 diff --git a/docs/ja/sql_reference/functions/other_functions.md b/docs/ja/sql_reference/functions/other_functions.md deleted file mode 100644 index ae9bb898405..00000000000 --- a/docs/ja/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,1079 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 66 -toc_title: "\u305D\u306E\u4ED6" ---- - -# その他の機能 {#other-functions} - -## ホスト名() {#hostname} - -この関数が実行されたホストの名前を持つ文字列を返します。 分散処理の場合、機能がリモートサーバー上で実行される場合、これはリモートサーバーホストの名前です。 - -## FQDN {#fqdn} - -完全修飾ドメイン名を返します。 - -**構文** - -``` sql -fqdn(); -``` - -この関数は、大文字と小文字を区別しません。 - -**戻り値** - -- 完全修飾ドメイン名の文字列。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT FQDN(); -``` - -結果: - -``` text -┌─FQDN()──────────────────────────┐ -│ clickhouse.ru-central1.internal │ -└─────────────────────────────────┘ -``` - -## ベース名 {#basename} - -最後のスラッシュまたはバックスラッシュの後の文字列の末尾の部分を抽出します。 この関数は、パスからファイル名を抽出するためによく使用されます。 - -``` sql -basename( expr ) -``` - -**パラメータ** - -- `expr` — Expression resulting in a [文字列](../../sql_reference/data_types/string.md) タイプ値。 すべての円記号は、結果の値でエスケープする必要があります。 - -**戻り値** - -以下を含む文字列: - -- 最後のスラッシュまたはバックスラッシュの後の文字列の末尾の部分。 - - If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. - -- スラッシュまたはバックスラッシュがない場合は、元の文字列。 - -**例えば** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## visibleWidth(x) {#visiblewidthx} - -テキスト形式(タブ区切り)でコンソールに値を出力するときのおおよその幅を計算します。 -この関数は、システムがpretty形式を実装するために使用します。 - -`NULL` に対応する文字列として表される。 `NULL` で `Pretty` フォーマット。 - -``` sql -SELECT visibleWidth(NULL) -``` - -``` text -┌─visibleWidth(NULL)─┐ -│ 4 │ -└────────────────────┘ -``` - -## toTypeName(x) {#totypenamex} - -渡された引数の型名を含む文字列を返します。 - -もし `NULL` 入力として関数に渡され、その後、それが返されます `Nullable(Nothing)` 内部に対応するタイプ `NULL` ClickHouseでの表現。 - -## ブロックサイズ() {#function-blocksize} - -ブロックのサイズを取得します。 -ClickHouseでは、クエリは常にブロック(列部分のセット)で実行されます。 この関数は、それを呼び出したブロックのサイズを取得することができます。 - -## マテリアライズ(x) {#materializex} - -一つの値だけを含む完全な列に定数を変換します。 -ClickHouseでは、完全な列と定数はメモリ内で異なる方法で表されます。 関数は定数引数と通常の引数(異なるコードが実行される)では異なる動作をしますが、結果はほとんど常に同じです。 この関数は、この動作のデバッグ用です。 - -## ignore(…) {#ignore} - -以下を含む任意の引数を受け取る `NULL`. 常に0を返します。 -ただし、引数はまだ評価されます。 これはベンチマークに使用できます。 - -## スリープ(秒) {#sleepseconds} - -眠る ‘seconds’ 各データブロックの秒。 整数または浮動小数点数を指定できます。 - -## sleepEachRow(秒) {#sleepeachrowseconds} - -眠る ‘seconds’ 各行の秒。 整数または浮動小数点数を指定できます。 - -## currentDatabase() {#currentdatabase} - -現在のデータベースの名前を返します。 -この関数は、データベースを指定する必要があるcreate tableクエリのテーブルエンジンパラメーターで使用できます。 - -## currentUser() {#other-function-currentuser} - -現在のユーザーのログインを返します。 ユーザのログインは、そのクエリを開始し、ケースdistibutedクエリで返されます。 - -``` sql -SELECT currentUser(); -``` - -エイリアス: `user()`, `USER()`. - -**戻り値** - -- 現在のユーザーのログイン。 -- クエリを開始したユーザーのログイン。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT currentUser(); -``` - -結果: - -``` text -┌─currentUser()─┐ -│ default │ -└───────────────┘ -``` - -## isFinite(x) {#isfinitex} - -引数が無限でなくnanでない場合はfloat32とfloat64を受け取り、uint8を1に返します(それ以外の場合は0)。 - -## イシンフィナイト(x) {#isinfinitex} - -引数が無限の場合はfloat32とfloat64を受け取り、uint8を1に戻し、それ以外の場合は0を返します。 nanの場合は0が返されることに注意してください。 - -## ifNotFinite {#ifnotfinite} - -浮動小数点値が有限かどうかをチェックします。 - -**構文** - - ifNotFinite(x,y) - -**パラメータ** - -- `x` — Value to be checked for infinity. Type: [フロート\*](../../sql_reference/data_types/float.md). -- `y` — Fallback value. Type: [フロート\*](../../sql_reference/data_types/float.md). - -**戻り値** - -- `x` もし `x` 有限です。 -- `y` もし `x` 有限ではない。 - -**例えば** - -クエリ: - - SELECT 1/0 as infimum, ifNotFinite(infimum,42) - -結果: - - ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ - │ inf │ 42 │ - └─────────┴───────────────────────────────┘ - -同様の結果を得るには、次のようにします [三項演算子](conditional_functions.md#ternary-operator): `isFinite(x) ? x : y`. - -## isNaN(x) {#isnanx} - -引数がnanの場合はfloat32とfloat64を受け取り、uint8を1に返します。 - -## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -データベース名、テーブル名、列名などの定数文字列を受け入れます。 列がある場合はuint8定数式を1に、それ以外の場合は0を返します。 hostnameパラメーターを設定すると、テストはリモートサーバーで実行されます。 -テーブルが存在しない場合、関数は例外をスローします。 -入れ子になったデータ構造内の要素の場合、この関数は列の存在をチェックします。 入れ子になったデータ構造自体の場合、関数は0を返します。 - -## バー {#function-bar} - -ユニコードアート図を作成できます。 - -`bar(x, min, max, width)` に比例する幅を持つバンドを描画します `(x - min)` とに等しい `width` 文字の場合 `x = max`. - -パラメータ: - -- `x` — Size to display. -- `min, max` — Integer constants. The value must fit in `Int64`. -- `width` — Constant, positive integer, can be fractional. - -バンドは、シンボルの第八に精度で描かれています。 - -例えば: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - -``` text -┌──h─┬──────c─┬─bar────────────────┐ -│ 0 │ 292907 │ █████████▋ │ -│ 1 │ 180563 │ ██████ │ -│ 2 │ 114861 │ ███▋ │ -│ 3 │ 85069 │ ██▋ │ -│ 4 │ 68543 │ ██▎ │ -│ 5 │ 78116 │ ██▌ │ -│ 6 │ 113474 │ ███▋ │ -│ 7 │ 170678 │ █████▋ │ -│ 8 │ 278380 │ █████████▎ │ -│ 9 │ 391053 │ █████████████ │ -│ 10 │ 457681 │ ███████████████▎ │ -│ 11 │ 493667 │ ████████████████▍ │ -│ 12 │ 509641 │ ████████████████▊ │ -│ 13 │ 522947 │ █████████████████▍ │ -│ 14 │ 539954 │ █████████████████▊ │ -│ 15 │ 528460 │ █████████████████▌ │ -│ 16 │ 539201 │ █████████████████▊ │ -│ 17 │ 523539 │ █████████████████▍ │ -│ 18 │ 506467 │ ████████████████▊ │ -│ 19 │ 520915 │ █████████████████▎ │ -│ 20 │ 521665 │ █████████████████▍ │ -│ 21 │ 542078 │ ██████████████████ │ -│ 22 │ 493642 │ ████████████████▍ │ -│ 23 │ 400397 │ █████████████▎ │ -└────┴────────┴────────────────────┘ -``` - -## 変換 {#transform} - -いくつかの要素の明示的に定義されたマッピングに従って値を他の要素に変換します。 -この関数には二つの違いがあります: - -### transform(x,array\_from,array\_to,デフォルト) {#transformx-array-from-array-to-default} - -`x` – What to transform. - -`array_from` – Constant array of values for converting. - -`array_to` – Constant array of values to convert the values in ‘from’ に。 - -`default` – Which value to use if ‘x’ 値のいずれにも等しくありません。 ‘from’. - -`array_from` と `array_to` – Arrays of the same size. - -タイプ: - -`transform(T, Array(T), Array(U), U) -> U` - -`T` と `U` 数値、文字列、または日付または日時の型を指定できます。 -同じ文字(tまたはu)が示されている場合、数値型の場合、これらは一致する型ではなく、共通の型を持つ型である可能性があります。 -たとえば、最初の引数はint64型を持つことができ、二番目の引数はarray(uint16)型を持つことができます。 - -この ‘x’ 値は、次のいずれかの要素に等しくなります。 ‘array\_from’ 配列の場合は、既存の要素(同じ番号が付けられています)を返します。 ‘array\_to’ 配列だ それ以外の場合は、 ‘default’. 一致する要素が複数ある場合 ‘array\_from’、それはマッチのいずれかを返します。 - -例えば: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - -``` text -┌─title─────┬──────c─┐ -│ Yandex │ 498635 │ -│ Google │ 229872 │ -│ Other │ 104472 │ -└───────────┴────────┘ -``` - -### トランスフォーム(x,array\_from,array\_to) {#transformx-array-from-array-to} - -最初のバリエーションとは異なります ‘default’ 引数は省略する。 -この ‘x’ 値は、次のいずれかの要素に等しくなります。 ‘array\_from’ 配列の場合は、マッチする要素(同じ番号を付けられた要素)を返します。 ‘array\_to’ 配列だ それ以外の場合は、 ‘x’. - -タイプ: - -`transform(T, Array(T), Array(T)) -> T` - -例えば: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -┌─s──────────────┬───────c─┐ -│ │ 2906259 │ -│ www.yandex │ 867767 │ -│ ███████.ru │ 313599 │ -│ mail.yandex.ru │ 107147 │ -│ ██████.ru │ 100355 │ -│ █████████.ru │ 65040 │ -│ news.yandex.ru │ 64515 │ -│ ██████.net │ 59141 │ -│ example.com │ 57316 │ -└────────────────┴─────────┘ -``` - -## formatReadableSize(x) {#formatreadablesizex} - -サイズ(バイト数)を受け入れます。 サフィックス(kib、mibなど)を含む丸められたサイズを返します。)文字列として。 - -例えば: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - -``` text -┌─filesize_bytes─┬─filesize───┐ -│ 1 │ 1.00 B │ -│ 1024 │ 1.00 KiB │ -│ 1048576 │ 1.00 MiB │ -│ 192851925 │ 183.92 MiB │ -└────────────────┴────────────┘ -``` - -## 少なくとも(a,b) {#leasta-b} - -Aとbの最小値を返します。 - -## 最大(a,b) {#greatesta-b} - -Aとbの最大値を返します。 - -## アップタイム() {#uptime} - -サーバーの稼働時間を秒単位で返します。 - -## バージョン() {#version} - -サーバーのバージョンを文字列として返します。 - -## タイムゾーン() {#timezone} - -サーバーのタイムゾーンを返します。 - -## bloknumber {#blocknumber} - -行があるデータブロックのシーケンス番号を返します。 - -## rowNumberInBlock {#function-rownumberinblock} - -データブロック内の行の序数を返します。 異なるデータブロックは常に再計算されます。 - -## rowNumberInAllBlocks() {#rownumberinallblocks} - -データブロック内の行の序数を返します。 この機能のみを考慮した影響のデータブロックとなります。 - -## 隣人 {#neighbor} - -指定された列の現在の行の前または後に来る指定されたオフセットで行へのアクセスを提供するウィンドウ関数。 - -**構文** - -``` sql -neighbor(column, offset[, default_value]) -``` - -関数の結果は、影響を受けるデータブロックと、ブロック内のデータの順序によって異なります。 -ORDER BYを使用してサブクエリを作成し、サブクエリの外部から関数を呼び出すと、期待される結果を得ることができます。 - -**パラメータ** - -- `column` — A column name or scalar expression. -- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql_reference/data_types/int_uint.md). -- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. - -**戻り値** - -- の値 `column` で `offset` 現在の行からの距離 `offset` 値はブロック境界の外側ではありません。 -- のデフォルト値 `column` もし `offset` 値はブロック境界の外側です。 もし `default_value` 与えられ、それが使用されます。 - -型:影響を受けるデータブロックの種類または既定値の種類。 - -**例えば** - -クエリ: - -``` sql -SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; -``` - -結果: - -``` text -┌─number─┬─neighbor(number, 2)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 0 │ -│ 9 │ 0 │ -└────────┴─────────────────────┘ -``` - -クエリ: - -``` sql -SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; -``` - -結果: - -``` text -┌─number─┬─neighbor(number, 2, 999)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 999 │ -│ 9 │ 999 │ -└────────┴──────────────────────────┘ -``` - -この関数は、年間指標の値を計算するために使用できます: - -クエリ: - -``` sql -WITH toDate('2018-01-01') AS start_date -SELECT - toStartOfMonth(start_date + (number * 32)) AS month, - toInt32(month) % 100 AS money, - neighbor(money, -12) AS prev_year, - round(prev_year / money, 2) AS year_over_year -FROM numbers(16) -``` - -結果: - -``` text -┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ -│ 2018-01-01 │ 32 │ 0 │ 0 │ -│ 2018-02-01 │ 63 │ 0 │ 0 │ -│ 2018-03-01 │ 91 │ 0 │ 0 │ -│ 2018-04-01 │ 22 │ 0 │ 0 │ -│ 2018-05-01 │ 52 │ 0 │ 0 │ -│ 2018-06-01 │ 83 │ 0 │ 0 │ -│ 2018-07-01 │ 13 │ 0 │ 0 │ -│ 2018-08-01 │ 44 │ 0 │ 0 │ -│ 2018-09-01 │ 75 │ 0 │ 0 │ -│ 2018-10-01 │ 5 │ 0 │ 0 │ -│ 2018-11-01 │ 36 │ 0 │ 0 │ -│ 2018-12-01 │ 66 │ 0 │ 0 │ -│ 2019-01-01 │ 97 │ 32 │ 0.33 │ -│ 2019-02-01 │ 28 │ 63 │ 2.25 │ -│ 2019-03-01 │ 56 │ 91 │ 1.62 │ -│ 2019-04-01 │ 87 │ 22 │ 0.25 │ -└────────────┴───────┴───────────┴────────────────┘ -``` - -## ランニングダイファレンス(x) {#other_functions-runningdifference} - -Calculates the difference between successive row values ​​in the data block. -最初の行に対して0を返し、後続の各行に対して前の行との差を返します。 - -関数の結果は、影響を受けるデータブロックと、ブロック内のデータの順序によって異なります。 -ORDER BYを使用してサブクエリを作成し、サブクエリの外部から関数を呼び出すと、期待される結果を得ることができます。 - -例えば: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - -``` text -┌─EventID─┬───────────EventTime─┬─delta─┐ -│ 1106 │ 2016-11-24 00:00:04 │ 0 │ -│ 1107 │ 2016-11-24 00:00:05 │ 1 │ -│ 1108 │ 2016-11-24 00:00:05 │ 0 │ -│ 1109 │ 2016-11-24 00:00:09 │ 4 │ -│ 1110 │ 2016-11-24 00:00:10 │ 1 │ -└─────────┴─────────────────────┴───────┘ -``` - -ご注意-ブロックサイズは結果に影響します。 それぞれの新しいブロックでは、 `runningDifference` 状態がリセットされます。 - -``` sql -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -┌─number─┬─diff─┐ -│ 65536 │ 0 │ -└────────┴──────┘ -``` - -``` sql -set max_block_size=100000 -- default value is 65536! - -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -``` - -## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} - -と同じ [runningDifference](./other_functions.md#other_functions-runningdifference)、差は、最初の行の値であり、最初の行の値を返し、後続の各行は、前の行からの差を返します。 - -## マクナムトストリング(num) {#macnumtostringnum} - -UInt64番号を受け取ります。 ビッグエンディアンのMACアドレスとして解釈します。 対応するMACアドレスをAA:BB:CC:DD:EE:FF形式で含む文字列を返します。 - -## MACStringToNum(s) {#macstringtonums} - -MACNumToStringの逆関数。 MACアドレスに無効な形式がある場合は、0を返します。 - -## MACStringToOUI(s) {#macstringtoouis} - -AA:BB:CC:DD:EE:FF形式のMACアドレスを受け付けます。 最初の三つのオクテットをUInt64の数値として返します。 MACアドレスに無効な形式がある場合は、0を返します。 - -## getSizeOfEnumType {#getsizeofenumtype} - -フィールドの数を返します [列挙型](../../sql_reference/data_types/enum.md). - -``` sql -getSizeOfEnumType(value) -``` - -**パラメータ:** - -- `value` — Value of type `Enum`. - -**戻り値** - -- を持つフィールドの数 `Enum` 入力値。 -- 型が型でない場合は、例外がスローされます `Enum`. - -**例えば** - -``` sql -SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## blockSerializedSize {#blockserializedsize} - -(圧縮を考慮せずに)ディスク上のサイズを返します。 - -``` sql -blockSerializedSize(value[, value[, ...]]) -``` - -**パラメータ:** - -- `value` — Any value. - -**戻り値** - -- 値のブロックのためにディスクに書き込まれるバイト数(圧縮なし)。 - -**例えば** - -``` sql -SELECT blockSerializedSize(maxState(1)) as x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## toColumnTypeName {#tocolumntypename} - -RAM内の列のデータ型を表すクラスの名前を返します。 - -``` sql -toColumnTypeName(value) -``` - -**パラメータ:** - -- `value` — Any type of value. - -**戻り値** - -- を表すために使用されるクラスの名前を持つ文字列 `value` RAMのデータ型。 - -**違いの例`toTypeName ' and ' toColumnTypeName`** - -``` sql -SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime │ -└─────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ Const(UInt32) │ -└───────────────────────────────────────────────────────────┘ -``` - -この例では、 `DateTime` データタイプはメモリに記憶として `Const(UInt32)`. - -## dumpColumnStructure {#dumpcolumnstructure} - -RAM内のデータ構造の詳細な説明を出力します - -``` sql -dumpColumnStructure(value) -``` - -**パラメータ:** - -- `value` — Any type of value. - -**戻り値** - -- を表すために使用される構造体を記述する文字列。 `value` RAMのデータ型。 - -**例えば** - -``` sql -SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) -``` - -``` text -┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime, Const(size = 1, UInt32(size = 1)) │ -└──────────────────────────────────────────────────────────────┘ -``` - -## defaultValueOfArgumentType {#defaultvalueofargumenttype} - -データ型の既定値を出力します。 - -ユーザーが設定したカスタム列の既定値は含まれません。 - -``` sql -defaultValueOfArgumentType(expression) -``` - -**パラメータ:** - -- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. - -**戻り値** - -- `0` 数字のために. -- 文字列の空の文字列。 -- `ᴺᵁᴸᴸ` のために [Nullable](../../sql_reference/data_types/nullable.md). - -**例えば** - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ -│ 0 │ -└─────────────────────────────────────────────┘ -``` - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ -│ ᴺᵁᴸᴸ │ -└───────────────────────────────────────────────────────┘ -``` - -## 複製 {#other-functions-replicate} - -単一の値を持つ配列を作成します。 - -内部実装のために使用される [arrayJoin](array_join.md#functions_arrayjoin). - -``` sql -SELECT replicate(x, arr); -``` - -**パラメータ:** - -- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. -- `x` — The value that the resulting array will be filled with. - -**戻り値** - -値で満たされた配列 `x`. - -タイプ: `Array`. - -**例えば** - -クエリ: - -``` sql -SELECT replicate(1, ['a', 'b', 'c']) -``` - -結果: - -``` text -┌─replicate(1, ['a', 'b', 'c'])─┐ -│ [1,1,1] │ -└───────────────────────────────┘ -``` - -## filesystemAvailable {#filesystemavailable} - -返金額の残存スペースのファイルシステムのファイルのデータベースはあります。 それは常に合計空き領域よりも小さいです ([filesystemFree](#filesystemfree) でもスペースはOS. - -**構文** - -``` sql -filesystemAvailable() -``` - -**戻り値** - -- バイト単位で使用可能な残りのスペースの量。 - -タイプ: [UInt64](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; -``` - -結果: - -``` text -┌─Available space─┬─Type───┐ -│ 30.75 GiB │ UInt64 │ -└─────────────────┴────────┘ -``` - -## filesystemFree {#filesystemfree} - -データベースのファイルがあるファイルシステム上の空き領域の合計を返します。 また見なさい `filesystemAvailable` - -**構文** - -``` sql -filesystemFree() -``` - -**戻り値** - -- バイト単位の空き領域の量。 - -タイプ: [UInt64](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; -``` - -結果: - -``` text -┌─Free space─┬─Type───┐ -│ 32.39 GiB │ UInt64 │ -└────────────┴────────┘ -``` - -## filesystemCapacity {#filesystemcapacity} - -ファイルシステムの容量をバイト単位で返します。 評価のために、 [パス](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) データディレク - -**構文** - -``` sql -filesystemCapacity() -``` - -**戻り値** - -- ファイルシステムの容量情報(バイト単位)。 - -タイプ: [UInt64](../../sql_reference/data_types/int_uint.md). - -**例えば** - -クエリ: - -``` sql -SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" -``` - -結果: - -``` text -┌─Capacity──┬─Type───┐ -│ 39.32 GiB │ UInt64 │ -└───────────┴────────┘ -``` - -## finalizeAggregation {#function-finalizeaggregation} - -集約関数の状態を取ります。 集計結果を返します(ファイナライズされた状態)。 - -## runningAccumulate {#function-runningaccumulate} - -集約関数の状態を取り、値を持つ列を返します,ブロックラインのセットのためにこれらの状態の蓄積の結果であります,最初から現在の行へ.これ -たとえば、集計関数の状態(例:runningaccumulate(uniqstate(userid)))を取り、ブロックの各行について、前のすべての行と現在の行の状態をマージしたときの集計関数の結果を返しま -したがって、関数の結果は、ブロックへのデータの分割とブロック内のデータの順序に依存します。 - -## joinGet {#joinget} - -この関数を使用すると、テーブルからのデータと同じ方法でデータを抽出できます [辞書](../../sql_reference/dictionaries/index.md). - -データの取得 [参加](../../engines/table_engines/special/join.md#creating-a-table) 指定された結合キーを使用するテーブル。 - -サポートされているのは、 `ENGINE = Join(ANY, LEFT, )` 声明。 - -**構文** - -``` sql -joinGet(join_storage_table_name, `value_column`, join_keys) -``` - -**パラメータ** - -- `join_storage_table_name` — an [識別子](../syntax.md#syntax-identifiers) 検索が実行される場所を示します。 識別子は既定のデータベースで検索されます(パラメータを参照 `default_database` の設定ファイル)。 デフォル `USE db_name` またはを指定しデータベースのテーブルのセパレータ `db_name.db_table`、例を参照してください。 -- `value_column` — name of the column of the table that contains required data. -- `join_keys` — list of keys. - -**戻り値** - -キーのリストに対応する値のリストを返します。 - -ソーステーブルに特定のものが存在しない場合 `0` または `null` に基づいて返されます [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) 設定。 - -詳細について `join_use_nulls` で [結合操作](../../engines/table_engines/special/join.md). - -**例えば** - -入力テーブル: - -``` sql -CREATE DATABASE db_test -CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 -INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) -``` - -``` text -┌─id─┬─val─┐ -│ 4 │ 13 │ -│ 2 │ 12 │ -│ 1 │ 11 │ -└────┴─────┘ -``` - -クエリ: - -``` sql -SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 -``` - -結果: - -``` text -┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ -│ 0 │ -│ 11 │ -│ 12 │ -│ 0 │ -└──────────────────────────────────────────────────┘ -``` - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -外部モデルを評価します。 -モデル名とモデル引数を受け取ります。 float64を返します。 - -## throwIf(x\[,custom\_message\]) {#throwifx-custom-message} - -引数がゼロ以外の場合は例外をスローします。 -custom\_message-オプションのパラメータです。 - -``` sql -SELECT throwIf(number = 3, 'Too many') FROM numbers(10); -``` - -``` text -↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): -Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. -``` - -## id {#identity} - -引数として使用されたのと同じ値を返します。 デバッグに使用され、試験が可能でャックのクエリーの性能を満たします。 がクエリーの分析のために利用できる可能性指標分析装置が外部サンプリング方式な見てみよう `identity` 機能。 - -**構文** - -``` sql -identity(x) -``` - -**例えば** - -クエリ: - -``` sql -SELECT identity(42) -``` - -結果: - -``` text -┌─identity(42)─┐ -│ 42 │ -└──────────────┘ -``` - -## randomprintableasii {#randomascii} - -のランダムなセットを持つ文字列を生成します [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) 印刷可能な文字。 - -**構文** - -``` sql -randomPrintableASCII(length) -``` - -**パラメータ** - -- `length` — Resulting string length. Positive integer. - - If you pass `length < 0`, behavior of the function is undefined. - -**戻り値** - -- のランダムなセットを持つ文字列 [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) 印刷可能な文字。 - -タイプ: [文字列](../../sql_reference/data_types/string.md) - -**例えば** - -``` sql -SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 -``` - -``` text -┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ -│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ -│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ -│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ -└────────┴────────────────────────────────┴──────────────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/ja/sql_reference/functions/rounding_functions.md b/docs/ja/sql_reference/functions/rounding_functions.md deleted file mode 100644 index ab0bc719d5a..00000000000 --- a/docs/ja/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: "\u4E38\u3081" ---- - -# 丸め関数 {#rounding-functions} - -## 床(x\[,N\]) {#floorx-n} - -次の値以下の最大ラウンド数を返します `x`. ラウンド数は1/10Nの倍数、または1/10Nが正確でない場合は適切なデータ型の最も近い数です。 -‘N’ 整数定数、オプションのパラメータです。 デフォルトではゼロで、整数に丸めることを意味します。 -‘N’ 負の可能性があります。 - -例: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x` 任意の数値型です。 結果は同じタイプの数です。 -整数引数の場合、負の値で丸めるのが理にかなっています `N` 値(非負の場合 `N`、関数は何もしません)。 -丸めによってオーバーフロー(たとえば、floor(-128,-1))が発生した場合は、実装固有の結果が返されます。 - -## ceil(x\[,N\]),ceiling(x\[,N\]) {#ceilx-n-ceilingx-n} - -次の値以上の最小の丸め数を返します `x`. 他のすべての方法では、それはと同じです `floor` 関数(上記参照)。 - -## trunc(x\[,N\]),truncate(x\[,N\]) {#truncx-n-truncatex-n} - -絶対値が以下の最大絶対値を持つラウンド数を返します `x`‘s. In every other way, it is the same as the ’floor’ 関数(上記参照)。 - -## ラウンド(x\[,N\]) {#rounding_functions-round} - -指定した小数点以下の桁数に値を丸めます。 - -この関数は、指定された順序の最も近い番号を返します。 与えられた数が周囲の数と等しい距離を持つ場合、関数は浮動小数点数型に対してバンカーの丸めを使用し、他の数値型に対してゼロから丸めます。 - -``` sql -round(expression [, decimal_places]) -``` - -**パラメータ:** - -- `expression` — A number to be rounded. Can be any [式](../syntax.md#syntax-expressions) 数値を返す [データ型](../../sql_reference/data_types/index.md#data_types). -- `decimal-places` — An integer value. - - もし `decimal-places > 0` 次に、この関数は値を小数点の右側に丸めます。 - - もし `decimal-places < 0` 次に、この関数は値を小数点の左側に丸めます。 - - もし `decimal-places = 0` 次に、この関数は値を整数に丸めます。 この場合、引数は省略できます。 - -**戻り値:** - -入力番号と同じタイプの丸められた数。 - -### 例 {#examples} - -**使用例** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - -``` text -┌───x─┬─round(divide(number, 2))─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -└─────┴──────────────────────────┘ -``` - -**丸めの例** - -最も近い数値に丸めます。 - -``` text -round(3.2, 0) = 3 -round(4.1267, 2) = 4.13 -round(22,-1) = 20 -round(467,-2) = 500 -round(-467,-2) = -500 -``` - -銀行の丸め。 - -``` text -round(3.5) = 4 -round(4.5) = 4 -round(3.55, 1) = 3.6 -round(3.65, 1) = 3.6 -``` - -**また見なさい** - -- [ラウンドバンカー](#roundbankers) - -## ラウンドバンカー {#roundbankers} - -数値を指定した小数点以下の桁数に丸めます。 - -- 丸め番号が二つの数字の中間にある場合、関数はバンカーの丸めを使用します。 - - Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. - - It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. - -- それ以外の場合、関数は数値を最も近い整数に丸めます。 - -バンカーの丸めを使用すると、丸め数値がこれらの数値の加算または減算の結果に与える影響を減らすことができます。 - -たとえば、異なる丸めの合計1.5、2.5、3.5、4.5: - -- 丸めなし: 1.5 + 2.5 + 3.5 + 4.5 = 12. -- 銀行の丸め: 2 + 2 + 4 + 4 = 12. -- 最も近い整数への丸め: 2 + 3 + 4 + 5 = 14. - -**構文** - -``` sql -roundBankers(expression [, decimal_places]) -``` - -**パラメータ** - -- `expression` — A number to be rounded. Can be any [式](../syntax.md#syntax-expressions) 数値を返す [データ型](../../sql_reference/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`. - - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. - -**戻り値** - -バンカーの丸めメソッドによって丸められた値。 - -### 例 {#examples-1} - -**使用例** - -クエリ: - -``` sql - SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 -``` - -結果: - -``` text -┌───x─┬─b─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -│ 1.5 │ 2 │ -│ 2 │ 2 │ -│ 2.5 │ 2 │ -│ 3 │ 3 │ -│ 3.5 │ 4 │ -│ 4 │ 4 │ -│ 4.5 │ 4 │ -└─────┴───┘ -``` - -**銀行の丸めの例** - -``` text -roundBankers(0.4) = 0 -roundBankers(-3.5) = -4 -roundBankers(4.5) = 4 -roundBankers(3.55, 1) = 3.6 -roundBankers(3.65, 1) = 3.6 -roundBankers(10.35, 1) = 10.4 -roundBankers(10.755, 2) = 11,76 -``` - -**また見なさい** - -- [ラウンド](#rounding_functions-round) - -## roundToExp2(num) {#roundtoexp2num} - -数値を受け取ります。 数値が小さい場合は0を返します。 それ以外の場合は、数値を最も近い(非負の全体)程度に丸めます。 - -## ラウンドデュレーション(num) {#rounddurationnum} - -数値を受け取ります。 数値が小さい場合は0を返します。 それ以外の場合は、数値をセットから数値に切り下げます: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. この機能はyandexに固有です。metricaとセッションの長さに関するレポートを実装するために使用。 - -## roundAge(num) {#roundagenum} - -数値を受け取ります。 数値が18未満の場合、0を返します。 それ以外の場合は、数値をセットから数値に切り下げます: 18, 25, 35, 45, 55. この機能はyandexに固有です。metricaとユーザーの年齢に関するレポートを実装するために使用。 - -## ラウンドダウン(num,arr) {#rounddownnum-arr} - -数値を受け取り、指定した配列内の要素に切り捨てます。 値が下限より小さい場合は、下限が返されます。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/ja/sql_reference/functions/splitting_merging_functions.md b/docs/ja/sql_reference/functions/splitting_merging_functions.md deleted file mode 100644 index 7e21f5a97f3..00000000000 --- a/docs/ja/sql_reference/functions/splitting_merging_functions.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 47 -toc_title: "\u6587\u5B57\u5217\u3068\u914D\u5217\u306E\u5206\u5272\u3068\u30DE\u30FC\ - \u30B8" ---- - -# 文字列と配列の分割とマージのための関数 {#functions-for-splitting-and-merging-strings-and-arrays} - -## splitByChar(セパレータ,s) {#splitbycharseparator-s} - -文字列を、指定した文字で区切った部分文字列に分割します。 定数文字列を使用します `separator` その正確に一つの文字からなる。 -選択した部分文字列の配列を返します。 空の部分文字列は、文字列の先頭または末尾にセパレータがある場合、または複数の連続するセパレータがある場合に選択できます。 - -**構文** - -``` sql -splitByChar(, ) -``` - -**パラメータ** - -- `separator` — The separator which should contain exactly one character. [文字列](../../sql_reference/data_types/string.md). -- `s` — The string to split. [文字列](../../sql_reference/data_types/string.md). - -**戻り値(s)** - -選択した部分文字列の配列を返します。 空の部分文字列は、次の場合に選択できます: - -- 区切り記号は、文字列の先頭または末尾に表示されます; -- 複数の連続した区切り文字があります; -- 元の文字列 `s` 空です。 - -タイプ: [配列](../../sql_reference/data_types/array.md) の [文字列](../../sql_reference/data_types/string.md). - -**例えば** - -``` sql -SELECT splitByChar(',', '1,2,3,abcde') -``` - -``` text -┌─splitByChar(',', '1,2,3,abcde')─┐ -│ ['1','2','3','abcde'] │ -└─────────────────────────────────┘ -``` - -## splitByString(separator,s) {#splitbystringseparator-s} - -文字列を文字列で区切られた部分文字列に分割します。 定数文字列を使用します `separator` 区切り文字として複数の文字が使用されます。 文字列の場合 `separator` 空である場合は、文字列を分割します `s` 単一の文字の配列に変換します。 - -**構文** - -``` sql -splitByString(, ) -``` - -**パラメータ** - -- `separator` — The separator. [文字列](../../sql_reference/data_types/string.md). -- `s` — The string to split. [文字列](../../sql_reference/data_types/string.md). - -**戻り値(s)** - -選択した部分文字列の配列を返します。 空の部分文字列は、次の場合に選択できます: - -タイプ: [配列](../../sql_reference/data_types/array.md) の [文字列](../../sql_reference/data_types/string.md). - -- 空でない区切り文字は、文字列の先頭または末尾に作成されます; -- 複数の連続する空でない区切り記号があります; -- 元の文字列 `s` 区切り記号が空でない間は空です。 - -**例えば** - -``` sql -SELECT splitByString(', ', '1, 2 3, 4,5, abcde') -``` - -``` text -┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ -│ ['1','2 3','4,5','abcde'] │ -└───────────────────────────────────────────┘ -``` - -``` sql -SELECT splitByString('', 'abcde') -``` - -``` text -┌─splitByString('', 'abcde')─┐ -│ ['a','b','c','d','e'] │ -└────────────────────────────┘ -``` - -## arrayStringConcat(arr\[,separator\]) {#arraystringconcatarr-separator} - -配列にリストされている文字列を区切り文字と連結します。デフォルトでは空の文字列に設定されています。 -文字列を返します。 - -## alphaTokens(s) {#alphatokenss} - -範囲a-zおよびa-zから連続するバイトの部分文字列を選択します。 - -**例えば** - -``` sql -SELECT alphaTokens('abca1abc') -``` - -``` text -┌─alphaTokens('abca1abc')─┐ -│ ['abca','abc'] │ -└─────────────────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/ja/sql_reference/functions/string_functions.md b/docs/ja/sql_reference/functions/string_functions.md deleted file mode 100644 index 1e7948edf89..00000000000 --- a/docs/ja/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,489 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u6587\u5B57\u5217\u306E\u64CD\u4F5C" ---- - -# 文字列を扱うための関数 {#functions-for-working-with-strings} - -## 空 {#empty} - -空の文字列の場合は1、空でない文字列の場合は0を返します。 -結果の型はuint8です。 -文字列が空白またはnullバイトであっても、少なくとも一つのバイトが含まれている場合、文字列は空ではないと見なされます。 -この関数は配列に対しても機能します。 - -## notEmpty {#notempty} - -空の文字列の場合は0、空でない文字列の場合は1を返します。 -結果の型はuint8です。 -この関数は配列に対しても機能します。 - -## 長さ {#length} - -文字列の長さをバイトで返します(コード-ポイントではなく、文字ではありません)。 -結果の型はuint64です。 -この関数は配列に対しても機能します。 - -## lengthUTF8 {#lengthutf8} - -文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、unicodeコードポイント(文字ではない)の文字列の長さを この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 -結果の型はuint64です。 - -## char\_length,CHAR\_LENGTH {#char-length} - -文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、unicodeコードポイント(文字ではない)の文字列の長さを この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 -結果の型はuint64です。 - -## character\_length,CHARACTER\_LENGTH {#character-length} - -文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、unicodeコードポイント(文字ではない)の文字列の長さを この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 -結果の型はuint64です。 - -## lower,lcase {#lower} - -文字列内のasciiラテン文字記号を小文字に変換します。 - -## アッパー,ucase {#upper} - -文字列内のasciiラテン文字記号を大文字に変換します。 - -## lowerUTF8 {#lowerutf8} - -文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれていると仮定して、文字列を小文字に変換します。 -それは言語を検出しません。 そのためにトルコに結果が正確に正しい。 -コード-ポイントの大文字と小文字でutf-8バイト-シーケンスの長さが異なる場合、このコード-ポイントでは結果が正しくない可能性があります。 -文字列にutf-8でないバイトのセットが含まれている場合、その動作は未定義です。 - -## upperUTF8 {#upperutf8} - -文字列にutf-8でエンコードされたテキストを構成するバイトのセットが含まれている場合、文字列を大文字に変換します。 -それは言語を検出しません。 そのためにトルコに結果が正確に正しい。 -コード-ポイントの大文字と小文字でutf-8バイト-シーケンスの長さが異なる場合、このコード-ポイントでは結果が正しくない可能性があります。 -文字列にutf-8でないバイトのセットが含まれている場合、その動作は未定義です。 - -## isValidUTF8 {#isvalidutf8} - -バイトのセットが有効なutf-8エンコードの場合は1を返し、それ以外の場合は0を返します。 - -## toValidUTF8 {#tovalidutf8} - -無効なutf-8文字を `�` (U+FFFD)文字。 すべての行で実行されている無効な文字は、置換文字に折りたたまれています。 - -``` sql -toValidUTF8( input_string ) -``` - -パラメータ: - -- input\_string — Any set of bytes represented as the [文字列](../../sql_reference/data_types/string.md) データ型オブジェクト。 - -戻り値:有効なutf-8文字列。 - -**例えば** - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## 繰り返す {#repeat} - -指定した回数だけ文字列を繰り返し、レプリケートされた値を単一の文字列として連結します。 - -**構文** - -``` sql -repeat(s, n) -``` - -**パラメータ** - -- `s` — The string to repeat. [文字列](../../sql_reference/data_types/string.md). -- `n` — The number of times to repeat the string. [UInt](../../sql_reference/data_types/int_uint.md). - -**戻り値** - -文字列を含む単一の文字列 `s` 繰り返す `n` 回。 もし `n` \<1、関数は、空の文字列を返します。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT repeat('abc', 10) -``` - -結果: - -``` text -┌─repeat('abc', 10)──────────────┐ -│ abcabcabcabcabcabcabcabcabcabc │ -└────────────────────────────────┘ -``` - -## 反転 {#reverse} - -文字列を逆にします(バイトのシーケンスとして)。 - -## reverseUTF8 {#reverseutf8} - -文字列にutf-8テキストを表すバイトのセットが含まれていると仮定して、unicodeコードポイントのシーケンスを逆にします。 それ以外の場合は、何か他のことをします(例外はスローされません)。 - -## format(pattern, s0, s1, …) {#format} - -引数にリストされている文字列で定数パターンを書式設定する。 `pattern` 単純なPython形式のパターンです。 書式文字列に含まれる “replacement fields” 中括弧で囲まれています `{}`. 中括弧に含まれていないものは、リテラルテキストと見なされ、出力には変更されません。 リテラルテキストに中かっこ文字を含める必要がある場合は、倍にすることでエスケープできます: `{{ '{{' }}` と `{{ '}}' }}`. フィールド名は数字(ゼロから始まる)または空(それらは結果番号として扱われます)。 - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') -``` - -``` text -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ -``` - -``` sql -SELECT format('{} {}', 'Hello', 'World') -``` - -``` text -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## concat {#concat} - -引数にリストされている文字列を区切り文字なしで連結します。 - -**構文** - -``` sql -concat(s1, s2, ...) -``` - -**パラメータ** - -String型またはFixedString型の値。 - -**戻り値** - -引数を連結した結果の文字列を返します。 - -引数の値のいずれかがある場合 `NULL`, `concat` を返します `NULL`. - -**例えば** - -クエリ: - -``` sql -SELECT concat('Hello, ', 'World!') -``` - -結果: - -``` text -┌─concat('Hello, ', 'World!')─┐ -│ Hello, World! │ -└─────────────────────────────┘ -``` - -## ツづツつソツづォツづアツ、ツ債。 {#concatassumeinjective} - -と同じ [concat](#concat) の差であることを確認する必要があり `concat(s1, s2, ...) → sn` injectiveは、GROUP BYの最適化に使用されます。 - -関数の名前は次のとおりです “injective” 引数の異なる値に対して常に異なる結果を返す場合。 言い換えれば異なる引数のない利回り同一の結果です。 - -**構文** - -``` sql -concatAssumeInjective(s1, s2, ...) -``` - -**パラメータ** - -String型またはFixedString型の値。 - -**戻り値** - -引数を連結した結果の文字列を返します。 - -引数の値のいずれかがある場合 `NULL`, `concatAssumeInjective` を返します `NULL`. - -**例えば** - -入力テーブル: - -``` sql -CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; -INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); -SELECT * from key_val; -``` - -``` text -┌─key1────┬─key2─────┬─value─┐ -│ Hello, │ World │ 1 │ -│ Hello, │ World │ 2 │ -│ Hello, │ World! │ 3 │ -│ Hello │ , World! │ 2 │ -└─────────┴──────────┴───────┘ -``` - -クエリ: - -``` sql -SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) -``` - -結果: - -``` text -┌─concat(key1, key2)─┬─sum(value)─┐ -│ Hello, World! │ 3 │ -│ Hello, World! │ 2 │ -│ Hello, World │ 3 │ -└────────────────────┴────────────┘ -``` - -## サブストリング(s,オフセット,長さ)、中(s,オフセット,長さ)、サブストリング(s,オフセット,長さ) {#substring} - -からのバイトで始まる部分文字列を返します。 ‘offset’ あるインデックス ‘length’ バイト長。 文字の索引付けは、(標準SQLのように)文字から始まります。 その ‘offset’ と ‘length’ 引数は定数である必要があります。 - -## substringUTF8(s,オフセット,長さ) {#substringutf8} - -同じように ‘substring’ しかし、Unicodeコードポイントの場合。 作品は、この文字列が含まれるセットを表すバイトのUTF-8で符号化されます。 この仮定が満たされない場合、いくつかの結果が返されます(例外はスローされません)。 - -## appendTrailingCharIfAbsent(s,c) {#appendtrailingcharifabsent} - -この ‘s’ 文字列は空ではなく、空の文字列を含みません。 ‘c’ 最後の文字は、 ‘c’ 最後に文字。 - -## convertCharset(s,from,to) {#convertcharset} - -文字列を返します ‘s’ それはエンコーディングから変換された ‘from’ でのエンコーディングに ‘to’. - -## base64Encode(s) {#base64encode} - -エンコード ‘s’ base64への文字列 - -## base64Decode(s) {#base64decode} - -Base64エンコードされた文字列のデコード ‘s’ 元の文字列に。 失敗した場合には例外を発生させます。 - -## tryBase64Decode(s) {#trybase64decode} - -Base64Decodeに似ていますが、エラーの場合は空の文字列が返されます。 - -## endsWith(s,suffix) {#endswith} - -指定された接尾辞で終了するかどうかを返します。 文字列が指定された接尾辞で終わる場合は1を返し、それ以外の場合は0を返します。 - -## startsWith(str,プレフィックス) {#startswith} - -1を返しますか否かの文字列の開始を、指定された接頭辞、そうでない場合は0を返します。 - -``` sql -SELECT startsWith('Spider-Man', 'Spi'); -``` - -**戻り値** - -- 1、文字列が指定された接頭辞で始まる場合。 -- 文字列が指定された接頭辞で始まらない場合は0。 - -**例えば** - -クエリ: - -``` sql -SELECT startsWith('Hello, world!', 'He'); -``` - -結果: - -``` text -┌─startsWith('Hello, world!', 'He')─┐ -│ 1 │ -└───────────────────────────────────┘ -``` - -## トリム {#trim} - -文字列の先頭または末尾から指定されたすべての文字を削除します。 -デフォルトでは、文字列の両端から共通の空白(ascii文字32)が連続して出現するすべてを削除します。 - -**構文** - -``` sql -trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) -``` - -**パラメータ** - -- `trim_character` — specified characters for trim. [文字列](../../sql_reference/data_types/string.md). -- `input_string` — string for trim. [文字列](../../sql_reference/data_types/string.md). - -**戻り値** - -先頭および(または)末尾に指定された文字を含まない文字列。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT trim(BOTH ' ()' FROM '( Hello, world! )') -``` - -結果: - -``` text -┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ -│ Hello, world! │ -└───────────────────────────────────────────────┘ -``` - -## trimLeft {#trimleft} - -文字列の先頭から、共通の空白文字(ascii文字32)のすべての連続した出現を削除します。 他の種類の空白文字(タブ、改行なしなど)は削除されません。). - -**構文** - -``` sql -trimLeft(input_string) -``` - -エイリアス: `ltrim(input_string)`. - -**パラメータ** - -- `input_string` — string to trim. [文字列](../../sql_reference/data_types/string.md). - -**戻り値** - -共通の空白をリードしない文字列。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT trimLeft(' Hello, world! ') -``` - -結果: - -``` text -┌─trimLeft(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## trimRight {#trimright} - -文字列の末尾から共通の空白文字(ascii文字32)のすべての連続した出現を削除します。 他の種類の空白文字(タブ、改行なしなど)は削除されません。). - -**構文** - -``` sql -trimRight(input_string) -``` - -エイリアス: `rtrim(input_string)`. - -**パラメータ** - -- `input_string` — string to trim. [文字列](../../sql_reference/data_types/string.md). - -**戻り値** - -共通の空白を末尾に付けない文字列。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT trimRight(' Hello, world! ') -``` - -結果: - -``` text -┌─trimRight(' Hello, world! ')─┐ -│ Hello, world! │ -└──────────────────────────────────────┘ -``` - -## トリンボスcity in california usa {#trimboth} - -文字列の両端から共通の空白文字(ascii文字32)が連続して出現するすべてを削除します。 他の種類の空白文字(タブ、改行なしなど)は削除されません。). - -**構文** - -``` sql -trimBoth(input_string) -``` - -エイリアス: `trim(input_string)`. - -**パラメータ** - -- `input_string` — string to trim. [文字列](../../sql_reference/data_types/string.md). - -**戻り値** - -先頭と末尾の共通の空白を含まない文字列。 - -タイプ: `String`. - -**例えば** - -クエリ: - -``` sql -SELECT trimBoth(' Hello, world! ') -``` - -結果: - -``` text -┌─trimBoth(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## CRC32(s) {#crc32} - -CRC-32-IEEE802.3多項式と初期値を使用して、文字列のCRC32チェックサムを返します `0xffffffff` (zlibの実装)。 - -結果の型はuint32です。 - -## CRC32IEEE(s) {#crc32ieee} - -CRC-32-IEEE802.3多項式を使用して、文字列のCRC32チェックサムを返します。 - -結果の型はuint32です。 - -## CRC64(s) {#crc64} - -CRC-64-ECMA多項式を使用して、文字列のCRC64チェックサムを返します。 - -結果の型はuint64です。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/ja/sql_reference/functions/string_replace_functions.md b/docs/ja/sql_reference/functions/string_replace_functions.md deleted file mode 100644 index 27fe01a9f47..00000000000 --- a/docs/ja/sql_reference/functions/string_replace_functions.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 42 -toc_title: "\u6587\u5B57\u5217\u3067\u7F6E\u63DB\u3059\u308B\u5834\u5408" ---- - -# 文字列の検索と置換のための関数 {#functions-for-searching-and-replacing-in-strings} - -## replaceOne(干し草の山,パターン,交換) {#replaceonehaystack-pattern-replacement} - -が存在する場合は、その最初のオカレンスを置き換えます。 ‘pattern’ の部分文字列 ‘haystack’ と ‘replacement’ サブストリング。 -以後, ‘pattern’ と ‘replacement’ 定数である必要があります。 - -## replaceAll(干し草の山、パターン、交換)、交換(干し草の山、パターン、交換) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} - -すべての出現を置き換えます。 ‘pattern’ の部分文字列 ‘haystack’ と ‘replacement’ サブストリング。 - -## replaceRegexpOne(haystack,pattern,replacement) {#replaceregexponehaystack-pattern-replacement} - -を使用して交換 ‘pattern’ 正規表現。 Re2正規表現。 -最初のオカレンスのみを置き換えます(存在する場合)。 -パターンは次のように指定できます ‘replacement’. このパタ `\0-\9`. -置換 `\0` 正規表現全体を含みます。 置換 `\1-\9` サブパターンに対応しますnumbers.To を使用 `\` テンプレート内の文字をエスケープします `\`. -また、文字列リテラルには余分なエスケープが必要です。 - -例1. 日付をアメリカ形式に変換する: - -``` sql -SELECT DISTINCT - EventDate, - replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res -FROM test.hits -LIMIT 7 -FORMAT TabSeparated -``` - -``` text -2014-03-17 03/17/2014 -2014-03-18 03/18/2014 -2014-03-19 03/19/2014 -2014-03-20 03/20/2014 -2014-03-21 03/21/2014 -2014-03-22 03/22/2014 -2014-03-23 03/23/2014 -``` - -例2. 文字列を十回コピーする: - -``` sql -SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res -``` - -``` text -┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## replaceRegexpAll(干し草の山,パターン,置換) {#replaceregexpallhaystack-pattern-replacement} - -これは同じことをしますが、すべての出現を置き換えます。 例えば: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res -``` - -``` text -┌─res────────────────────────┐ -│ HHeelllloo,, WWoorrlldd!! │ -└────────────────────────────┘ -``` - -例外として、正規表現が空の部分文字列で処理された場合、置換は複数回行われません。 -例えば: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res -``` - -``` text -┌─res─────────────────┐ -│ here: Hello, World! │ -└─────────────────────┘ -``` - -## regexpQuoteMeta(s) {#regexpquotemetas} - -この関数は、文字列内のいくつかの定義済み文字の前に円記号を追加します。 -定義済み文字: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, '\]', ‘?’, '\*‘,’+‘,’{‘,’:‘,’-'. -この実装はre2::re2::quotemetaとは若干異なります。 ゼロバイトを\\0の代わりに\\00としてエスケープし、必要な文字だけをエスケープします。 -詳細については、リンク: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/ja/sql_reference/functions/string_search_functions.md b/docs/ja/sql_reference/functions/string_search_functions.md deleted file mode 100644 index 3487aefdeb5..00000000000 --- a/docs/ja/sql_reference/functions/string_search_functions.md +++ /dev/null @@ -1,379 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 41 -toc_title: "\u6587\u5B57\u5217\u3092\u691C\u7D22\u3059\u308B\u5834\u5408" ---- - -# 文字列を検索するための関数 {#functions-for-searching-strings} - -これらのすべての機能では、既定で検索では大文字と小文字が区別されます。 あるvariantのための大文字と小文字を区別しません。 - -## 位置(干し草の山、針)、位置(干し草の山、針) {#position} - -1から始まる、文字列内の見つかった部分文字列の位置(バイト)を返します。 - -作品は、この文字列が含まれるセットを表すバイトの単一のバイトの符号化されます。 この仮定が満たされておらず、単一のバイトを使用して文字を表現できない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのバイトを使用して表現できる場合は、二つのバイトなどを使用します。 - -大文字と小文字を区別しない検索では、次の関数を使用します [positionCaseInsensitive](#positioncaseinsensitive). - -**構文** - -``` sql -position(haystack, needle) -``` - -エイリアス: `locate(haystack, needle)`. - -**パラメータ** - -- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). - -**戻り値** - -- 部分文字列が見つかった場合、バイト単位で開始位置(1から数えます)。 -- 0、部分文字列が見つからなかった場合。 - -タイプ: `Integer`. - -**例** - -フレーズ “Hello, world!” を含むの設定を表すバイトの単一のバイトの符号化されます。 この関数は、期待される結果を返します: - -クエリ: - -``` sql -SELECT position('Hello, world!', '!') -``` - -結果: - -``` text -┌─position('Hello, world!', '!')─┐ -│ 13 │ -└────────────────────────────────┘ -``` - -ロシア語の同じ句には、単一のバイトを使用して表現できない文字が含まれています。 この関数は、予期しない結果を返します [positionUTF8](#positionutf8) マルチバイトエンコードテキストの機能): - -クエリ: - -``` sql -SELECT position('Привет, мир!', '!') -``` - -結果: - -``` text -┌─position('Привет, мир!', '!')─┐ -│ 21 │ -└───────────────────────────────┘ -``` - -## positionCaseInsensitive {#positioncaseinsensitive} - -同じように [位置](#position) 1から始まる、文字列内の見つかった部分文字列の位置(バイト)を返します。 大文字小文字を区別しない検索には、この関数を使用します。 - -作品は、この文字列が含まれるセットを表すバイトの単一のバイトの符号化されます。 この仮定が満たされておらず、単一のバイトを使用して文字を表現できない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのバイトを使用して表現できる場合は、二つのバイトなどを使用します。 - -**構文** - -``` sql -positionCaseInsensitive(haystack, needle) -``` - -**パラメータ** - -- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). - -**戻り値** - -- 部分文字列が見つかった場合、バイト単位で開始位置(1から数えます)。 -- 0、部分文字列が見つからなかった場合。 - -タイプ: `Integer`. - -**例えば** - -クエリ: - -``` sql -SELECT positionCaseInsensitive('Hello, world!', 'hello') -``` - -結果: - -``` text -┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ -│ 1 │ -└───────────────────────────────────────────────────┘ -``` - -## positionUTF8 {#positionutf8} - -文字列内の見つかった部分文字列の位置(unicodeポイント単位)を、1から開始して返します。 - -作品は、この文字列が含まれるセットを表すバイトのutf-8で符号化されます。 この仮定が満たされない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのunicodeポイントを使って表現できる場合は、二つのポイントを使います。 - -大文字と小文字を区別しない検索では、次の関数を使用します [位置caseinsensitiveutf8](#positioncaseinsensitiveutf8). - -**構文** - -``` sql -positionUTF8(haystack, needle) -``` - -**パラメータ** - -- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). - -**戻り値** - -- 部分文字列が見つかった場合、unicodeポイントの開始位置(1から数えます)。 -- 0、部分文字列が見つからなかった場合。 - -タイプ: `Integer`. - -**例** - -フレーズ “Hello, world!” ロシア語のUnicodeのポイントを表すシングルポイントで符号化されます。 この関数は、期待される結果を返します: - -クエリ: - -``` sql -SELECT positionUTF8('Привет, мир!', '!') -``` - -結果: - -``` text -┌─positionUTF8('Привет, мир!', '!')─┐ -│ 12 │ -└───────────────────────────────────┘ -``` - -フレーズ “Salut, étudiante!”、どこの文字 `é` 一つの点を使用して表すことができます (`U+00E9`)または二つのポイント (`U+0065U+0301` 関数は、いくつかの予想外の結果を返すことができます: - -手紙のためのクエリ `é`、一つのUnicodeポイントを表している `U+00E9`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -結果: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 17 │ -└────────────────────────────────────────┘ -``` - -手紙のためのクエリ `é` これは二つのユニコード点を表します `U+0065U+0301`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -結果: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 18 │ -└────────────────────────────────────────┘ -``` - -## 位置caseinsensitiveutf8 {#positioncaseinsensitiveutf8} - -同じように [positionUTF8](#positionutf8) ただし、大文字と小文字は区別されません。 文字列内の見つかった部分文字列の位置(Unicodeポイント単位)を、1から開始して返します。 - -作品は、この文字列が含まれるセットを表すバイトのutf-8で符号化されます。 この仮定が満たされない場合、関数は例外をスローせず、予期しない結果を返します。 文字が二つのunicodeポイントを使って表現できる場合は、二つのポイントを使います。 - -**構文** - -``` sql -positionCaseInsensitiveUTF8(haystack, needle) -``` - -**パラメータ** - -- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). - -**戻り値** - -- 部分文字列が見つかった場合、unicodeポイントの開始位置(1から数えます)。 -- 0、部分文字列が見つからなかった場合。 - -タイプ: `Integer`. - -**例えば** - -クエリ: - -``` sql -SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') -``` - -結果: - -``` text -┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ -│ 9 │ -└────────────────────────────────────────────────────┘ -``` - -## マルチアーチャルポジション {#multisearchallpositions} - -同じように [位置](string_search_functions.md#position) しかし、返す `Array` 文字列内で見つかった対応する部分文字列の位置(バイト単位)。 位置は1から始まる索引付けされます。 - -検索は、文字列のエンコードおよび照合順序に関係なく、バイトのシーケンスで実行されます。 - -- 大文字と小文字を区別しないascii検索では、次の関数を使用します `multiSearchAllPositionsCaseInsensitive`. -- UTF-8で検索する場合は、次の関数を使用します [multiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). -- 大文字と小文字を区別しないutf-8検索の場合は、関数multitsearchallpositionscaseinsensitiveutf8を使用します。 - -**構文** - -``` sql -multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) -``` - -**パラメータ** - -- `haystack` — string, in which substring will to be searched. [文字列](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [文字列](../syntax.md#syntax-string-literal). - -**戻り値** - -- 対応する部分文字列が見つかった場合は1から数え、見つからなかった場合は0のバイト単位の開始位置の配列。 - -**例えば** - -クエリ: - -``` sql -SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) -``` - -結果: - -``` text -┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ -│ [0,13,0] │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## multiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} - -見る `multiSearchAllPositions`. - -## マルチアーチファーストポジション(干し草の山,\[ニードル1、針2, …, needlen\]) {#multisearchfirstposition} - -同じように `position` しかし、文字列の左端のオフセットを返します `haystack` それは針のいくつかに一致します。 - -大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. - -## マルチアーチファーストインデックス(haystack,\[needle1、針2, …, needlen\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} - -インデックスを返す `i` (1から始まる)見つかった最も左の針の私は 文字列の中で `haystack` それ以外の場合は0。 - -大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. - -## ツつィツ姪"ツつ"ツ債ツづュツつケツ-faq1、針2, …, needlen\]) {#function-multisearchany} - -少なくとも一つの文字列の針場合、1を返します私は 文字列に一致します `haystack` それ以外の場合は0。 - -大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. - -!!! note "メモ" - すべて `multiSearch*` 機能は針の数2よりより少しべきです8 実装仕様のため。 - -## マッチ(干し草の山、パターン) {#matchhaystack-pattern} - -その文字列が `pattern` 正規表現。 A `re2` 正規表現。 その [構文](https://github.com/google/re2/wiki/Syntax) の `re2` 正規表現は、Perl正規表現の構文よりも制限されています。 - -一致しない場合は0、一致する場合は1を返します。 - -バックスラッシュ記号に注意してください (`\`)は、正規表現でエスケープするために使用されます。 同じ記号が文字列リテラルでエスケープするために使用されます。 したがって、正規表現でシンボルをエスケープするには、文字列リテラルに二つの円記号(\\)を記述する必要があります。 - -正規表現は、文字列がバイトのセットであるかのように動作します。 正規表現にnullバイトを含めることはできません。 -パターンが文字列内の部分文字列を検索するには、likeまたは ‘position’、彼らははるかに高速に動作するので。 - -## マルチャチャー(干し草の山、\[パターン1、パターン2, …, patternn\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} - -同じように `match` ただし、正規表現のどれも一致しない場合は0を返し、パターンのいずれかが一致する場合は1を返します。 それは使用します [hyperscan](https://github.com/intel/hyperscan) ライブラリ。 文字列の部分文字列を検索するパターンの場合は、次のように使用する方がよいでしょう `multiSearchAny` それははるかに速く動作するので。 - -!!! note "メモ" - の長さ `haystack` 文字列は2未満でなければなりません32 それ以外の場合は、例外がスローされます。 この制限は、hyperscan APIのために行われます。 - -## インデックスを作成します。1、パターン2, …, patternn\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} - -同じように `multiMatchAny`、しかし、haystackに一致する任意のインデックスを返します。 - -## ツつィツ姪"ツつ"ツ債ツづュツつケツ-ツ篠堕猟ソツ青ソツ仰1、パターン2, …, patternn\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} - -同じように `multiMatchAny` しかし、haystackに一致するすべての指標の配列を任意の順序で返します。 - -## マルチフザイマチャニ(干し草の山、距離、\[パターン1、パターン2, …, patternn\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} - -同じように `multiMatchAny` ただし、定数内のhaystackに一致するパターンがある場合は1を返します [距離を編集](https://en.wikipedia.org/wiki/Edit_distance). この機能は実験モードでもあり、非常に遅くなる可能性があります。 詳細については、 [hyperscanマニュアル](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). - -## インデックスを作成します。1、パターン2, …, patternn\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} - -同じように `multiFuzzyMatchAny` しかし、一定の編集距離内のhaystackに一致する任意のインデックスを返します。 - -## multiFuzzyMatchAllIndices(haystack、距離、\[パターン1、パターン2, …, patternn\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} - -同じように `multiFuzzyMatchAny` しかし、一定の編集距離内のhaystackに一致する任意の順序ですべてのインデックスの配列を返します。 - -!!! note "メモ" - `multiFuzzyMatch*` 関数はUTF-8の正規表現をサポートしておらず、hyperscanの制限により、このような式はバイトとして扱われます。 - -!!! note "メモ" - Hyperscanを使用するすべての機能をオフにするには、設定を使用します `SET allow_hyperscan = 0;`. - -## エキス(干し草の山、パターン) {#extracthaystack-pattern} - -正規表現を使用して文字列の断片を抽出します。 もし ‘haystack’ この ‘pattern’ 正規表現では、空の文字列が返されます。 正規表現にサブパターンが含まれていない場合は、正規表現全体に一致するフラグメントを取ります。 それ以外の場合は、最初のサブパターンに一致するフラグメントを取得します。 - -## extractAll(干し草の山,パターン) {#extractallhaystack-pattern} - -正規表現を使用して、文字列のすべてのフラグメントを抽出します。 もし ‘haystack’ この ‘pattern’ 正規表現では、空の文字列が返されます。 正規表現に対するすべての一致で構成される文字列の配列を返します。 一般に、この動作は、 ‘extract’ 関数(最初のサブパターン、またはサブパターンがない場合は式全体を取ります)。 - -## like(haystack,pattern),haystack LIKEパターン演算子 {#function-like} - -文字列が単純な正規表現に一致するかどうかを調べます。 -正規表現には、メタシンボルを含めることができます `%` と `_`. - -`%` 任意のバイト数(ゼロ文字を含む)を示します。 - -`_` 任意のバイトを示します。 - -バックスラッシュを使う (`\`)メタシンボルをエスケープするため。 の説明でエスケープの注意事項を参照してください。 ‘match’ 機能。 - -次のような正規表現の場合 `%needle%`、コードはより最適であり、高速として動作します `position` 機能。 -その他の正規表現の場合、コードは次のようになります。 ‘match’ 機能。 - -## ノットライク(干し草、パターン)、干し草は、パターン演算子が好きではありません {#function-notlike} - -同じものとして ‘like’、しかし否定的。 - -## ngramDistance(干し草の山,針) {#ngramdistancehaystack-needle} - -間の4グラムの距離を計算します `haystack` と `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` または `haystack` 32Kb以上で、例外をスローします。 いくつかの非定数の場合 `haystack` または `needle` 文字列は32Kb以上で、距離は常に一つです。 - -大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. - -## ngramSearch(干し草の山,針) {#ngramsearchhaystack-needle} - -と同じ `ngramDistance` しかし、非対称の違いを計算します `needle` と `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` nグラム。 一つに近いほど、より多くの可能性が高い `needle` にある `haystack`. あいまい文字列検索に便利です。 - -大文字と小文字を区別しない検索やutf-8形式の場合は、関数を使用します `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. - -!!! note "メモ" - For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/ja/sql_reference/functions/type_conversion_functions.md b/docs/ja/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index b9576df7784..00000000000 --- a/docs/ja/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,534 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: "\u30BF\u30A4\u30D7\u5909\u63DB" ---- - -# タイプ変換関数 {#type-conversion-functions} - -## 数値変換の一般的な問題 {#numeric-conversion-issues} - -値をあるデータ型から別のデータ型に変換するときは、一般的なケースでは、データの損失につながる危険な操作であることを覚えておく必要があります。 大きいデータ型の値を小さいデータ型にフィットさせる場合、または異なるデータ型の間で値を変換する場合、データ損失が発生する可能性があります。 - -クリックハウスには [C++プログラムと同じ動作](https://en.cppreference.com/w/cpp/language/implicit_conversion). - -## toInt(8/16/32/64) {#toint8163264} - -入力値を次の値に変換します。 [Int](../../sql_reference/data_types/int_uint.md) データ型。 この関数ファミ: - -- `toInt8(expr)` — Results in the `Int8` データ型。 -- `toInt16(expr)` — Results in the `Int16` データ型。 -- `toInt32(expr)` — Results in the `Int32` データ型。 -- `toInt64(expr)` — Results in the `Int64` データ型。 - -**パラメータ** - -- `expr` — [式](../syntax.md#syntax-expressions) 数値または数値の小数表現を含む文字列を返します。 数値のBinary、octal、およびhexadecimal表現はサポートされていません。 先頭のゼロは除去されます。 - -**戻り値** - -の整数値 `Int8`, `Int16`, `Int32`、または `Int64` データ型。 - -関数の使用 [ゼロに向かって丸め](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) つまり、数字の小数桁を切り捨てます。 - -のための機能の動作 [NaNおよびInf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) 引数は未定義です。 覚えておいて [数値変換の問題](#numeric-conversion-issues)、機能を使用する場合。 - -**例えば** - -``` sql -SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) -``` - -``` text -┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ -│ -9223372036854775808 │ 32 │ 16 │ 8 │ -└──────────────────────┴─────────────┴───────────────┴─────────────┘ -``` - -## toInt(8/16/32/64)OrZero {#toint8163264orzero} - -これは、string型の引数をとり、int型にそれを解析しようとします(8 \| 16 \| 32 \| 64). 失敗した場合は0を返します。 - -**例えば** - -``` sql -select toInt64OrZero('123123'), toInt8OrZero('123qwe123') -``` - -``` text -┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ -│ 123123 │ 0 │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toInt(8/16/32/64)OrNull {#toint8163264ornull} - -これは、string型の引数をとり、int型にそれを解析しようとします(8 \| 16 \| 32 \| 64). 失敗した場合はnullを返します。 - -**例えば** - -``` sql -select toInt64OrNull('123123'), toInt8OrNull('123qwe123') -``` - -``` text -┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ -│ 123123 │ ᴺᵁᴸᴸ │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toUInt(8/16/32/64) {#touint8163264} - -入力値を次の値に変換します。 [UInt](../../sql_reference/data_types/int_uint.md) データ型。 この関数ファミ: - -- `toUInt8(expr)` — Results in the `UInt8` データ型。 -- `toUInt16(expr)` — Results in the `UInt16` データ型。 -- `toUInt32(expr)` — Results in the `UInt32` データ型。 -- `toUInt64(expr)` — Results in the `UInt64` データ型。 - -**パラメータ** - -- `expr` — [式](../syntax.md#syntax-expressions) 数値または数値の小数表現を含む文字列を返します。 数値のBinary、octal、およびhexadecimal表現はサポートされていません。 先頭のゼロは除去されます。 - -**戻り値** - -の整数値 `UInt8`, `UInt16`, `UInt32`、または `UInt64` データ型。 - -関数の使用 [ゼロに向かって丸め](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero) つまり、数字の小数桁を切り捨てます。 - -負のagrumentsのための関数の動作と [NaNおよびInf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) 引数は未定義です。 負の数の文字列を渡すと、次のようになります `'-32'`、ClickHouseは例外を発生させます。 覚えておいて [数値変換の問題](#numeric-conversion-issues)、機能を使用する場合。 - -**例えば** - -``` sql -SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) -``` - -``` text -┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ -│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ -└─────────────────────┴───────────────┴────────────────┴──────────────┘ -``` - -## toUInt(8/16/32/64)OrZero {#touint8163264orzero} - -## toUInt(8/16/32/64)OrNull {#touint8163264ornull} - -## toFloat(32/64) {#tofloat3264} - -## toFloat(32/64)OrZero {#tofloat3264orzero} - -## toFloat(32/64)OrNull {#tofloat3264ornull} - -## toDate {#todate} - -## toDateOrZero {#todateorzero} - -## toDateOrNull {#todateornull} - -## toDateTime {#todatetime} - -## toDateTimeOrZero {#todatetimeorzero} - -## toDateTimeOrNull {#todatetimeornull} - -## toDecimal(32/64/128) {#todecimal3264128} - -変換 `value` に [小数](../../sql_reference/data_types/decimal.md) 精度の高いデータ型 `S`. その `value` 数値または文字列を指定できます。 その `S` (スケール)パラメータ小数点以下の桁数を指定します。 - -- `toDecimal32(value, S)` -- `toDecimal64(value, S)` -- `toDecimal128(value, S)` - -## toDecimal(32/64/128)OrNull {#todecimal3264128ornull} - -入力文字列をaに変換します [Nullable(小数点(P,S)))](../../sql_reference/data_types/decimal.md) データ型の値。 このファミリの機能など: - -- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` データ型。 -- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` データ型。 -- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` データ型。 - -これらの関数は、次の代わりに使用します `toDecimal*()` を取得したい場合は、 `NULL` 入力値の解析エラーが発生した場合の例外の代わりに値を指定します。 - -**パラメータ** - -- `expr` — [式](../syntax.md#syntax-expressions)、値を返します [文字列](../../sql_reference/data_types/string.md) データ型。 ClickHouseは、小数のテキスト表現を想定しています。 例えば, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**戻り値** - -の値 `Nullable(Decimal(P,S))` データ型。 値は次のとおりです: - -- 数との `S` ClickHouseが入力文字列を数値として解釈する場合、小数点以下の桁数。 -- `NULL` ClickHouseが入力文字列を数値として解釈できない場合、または入力番号に `S` 小数点以下の桁数。 - -**例** - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ -│ -1.11100 │ Nullable(Decimal(9, 5)) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ -│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toDecimal(32/64/128)OrZero {#todecimal3264128orzero} - -入力値を次の値に変換します。 [小数点(p,s))](../../sql_reference/data_types/decimal.md) データ型。 このファミリの機能など: - -- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` データ型。 -- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` データ型。 -- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` データ型。 - -これらの関数は、次の代わりに使用します `toDecimal*()` を取得したい場合は、 `0` 入力値の解析エラーが発生した場合の例外の代わりに値を指定します。 - -**パラメータ** - -- `expr` — [式](../syntax.md#syntax-expressions)、値を返します [文字列](../../sql_reference/data_types/string.md) データ型。 ClickHouseは、小数のテキスト表現を想定しています。 例えば, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**戻り値** - -の値 `Nullable(Decimal(P,S))` データ型。 値は次のとおりです: - -- 数との `S` ClickHouseが入力文字列を数値として解釈する場合、小数点以下の桁数。 -- 0とともに `S` ClickHouseが入力文字列を数値として解釈できない場合、または入力番号に `S` 小数点以下の桁数。 - -**例えば** - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ -│ -1.11100 │ Decimal(9, 5) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ -│ 0.00 │ Decimal(9, 2) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toString {#tostring} - -数値、文字列(固定文字列ではない)、日付、および日付を時刻で変換するための関数。 -これら全ての機能を受け入れを一つの引数。 - -文字列に変換するとき、または文字列から変換するとき、値はtabseparated形式(および他のほとんどすべてのテキスト形式)と同じ規則を使用して書式設定ま 文字列を解析できない場合は、例外がスローされ、要求はキャンセルされます。 - -日付を数値またはその逆に変換する場合、日付はunixエポックの開始からの日数に対応します。 -時刻を含む日付を数値またはその逆に変換する場合、時刻を含む日付は、unixエポックの開始からの秒数に対応します。 - -ToDate/toDateTime関数の日時形式は、次のように定義されています: - -``` text -YYYY-MM-DD -YYYY-MM-DD hh:mm:ss -``` - -例外として、uint32、int32、uint64、またはint64の数値型からdateに変換し、その数値が65536以上の場合、その数値はunixタイムスタンプとして(日数ではなく)解釈さ これにより、一般的な執筆のサポートが可能になります ‘toDate(unix\_timestamp)’ それ以外の場合はエラーになり、より面倒な書き込みが必要になります ‘toDate(toDateTime(unix\_timestamp))’. - -時間を伴う日付と日付の間の変換は、ヌル時間を追加するか、時間を落とすことによって自然な方法で行われます。 - -数値型間の変換は、c++で異なる数値型間の代入と同じ規則を使用します。 - -さらに、datetime引数のtostring関数は、タイムゾーンの名前を含む第二の文字列引数を取ることができます。 例えば: `Asia/Yekaterinburg` この場合、時刻は指定されたタイムゾーンに従ってフォーマットされます。 - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - -``` text -┌───────────now_local─┬─now_yekat───────────┐ -│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ -└─────────────────────┴─────────────────────┘ -``` - -また、 `toUnixTimestamp` 機能。 - -## toFixedString(s,N) {#tofixedstrings-n} - -文字列型引数をfixedstring(n)型(固定長nの文字列)に変換します。 nは定数でなければなりません。 -文字列のバイト数がnより少ない場合は、右側にnullバイトが渡されます。 文字列のバイト数がnより多い場合は、例外がスローされます。 - -## tostringクットゼロ(s) {#tostringcuttozeros} - -文字列またはfixedstring引数を受け取ります。 最初のゼロ-バイトで切り捨てられたコンテンツを持つ文字列を返します。 - -例えば: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s─────────────┬─s_cut─┐ -│ foo\0\0\0\0\0 │ foo │ -└───────────────┴───────┘ -``` - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s──────────┬─s_cut─┐ -│ foo\0bar\0 │ foo │ -└────────────┴───────┘ -``` - -## reinterpretAsUInt(8/16/32/64) {#reinterpretasuint8163264} - -## 再解釈(8/16/32/64) {#reinterpretasint8163264} - -## 再解釈(32/64) {#reinterpretasfloat3264} - -## 再解釈アスデート {#reinterpretasdate} - -## タスデータタイムの再解釈 {#reinterpretasdatetime} - -これらの関数は文字列を受け取り、文字列の先頭に置かれたバイトをホスト順(リトルエンディアン)の数値として解釈します。 文字列が十分な長さでない場合、関数は、文字列が必要な数のヌルバイトで埋められているかのように機能します。 文字列が必要以上に長い場合、余分なバイトは無視されます。 日付はunixエポックの開始からの日数として解釈され、時刻付きの日付はunixエポックの開始からの秒数として解釈されます。 - -## 文字列の再解釈 {#type_conversion_functions-reinterpretAsString} - -この関数は、時刻を含む数値または日付または日付を受け取り、対応する値をホスト順(リトルエンディアン)で表すバイトを含む文字列を返します。 nullバイトは、末尾から削除されます。 たとえば、uint32型の値255は、バイト長の文字列です。 - -## 再解釈された文字列 {#reinterpretasfixedstring} - -この関数は、時刻を含む数値または日付または日付を受け取り、対応する値をホスト順(リトルエンディアン)で表すバイトを含むfixedstringを返します。 nullバイトは、末尾から削除されます。 たとえば、uint32型の値255は、バイト長のfixedstringです。 - -## キャスト(x,t) {#type_conversion_function-cast} - -変換 ‘x’ に ‘t’ データ型。 構文CAST(x AS t)もサポートされています。 - -例えば: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - -``` text -┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ -└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ -``` - -FixedString(N)への変換は、String型またはFixedString(N)型の引数に対してのみ機能します。 - -タイプへの変換 [Nullable](../../sql_reference/data_types/nullable.md) そして背部は支えられます。 例えば: - -``` sql -SELECT toTypeName(x) FROM t_null -``` - -``` text -┌─toTypeName(x)─┐ -│ Int8 │ -│ Int8 │ -└───────────────┘ -``` - -``` sql -SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null -``` - -``` text -┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ -│ Nullable(UInt16) │ -│ Nullable(UInt16) │ -└─────────────────────────────────────────┘ -``` - -## toInterval(年/四半期\|月/週\|日/時/分/秒) {#function-tointerval} - -数値型の引数を [間隔](../../sql_reference/data_types/special_data_types/interval.md) データ型。 - -**構文** - -``` sql -toIntervalSecond(number) -toIntervalMinute(number) -toIntervalHour(number) -toIntervalDay(number) -toIntervalWeek(number) -toIntervalMonth(number) -toIntervalQuarter(number) -toIntervalYear(number) -``` - -**パラメータ** - -- `number` — Duration of interval. Positive integer number. - -**戻り値** - -- の値 `Interval` データ型。 - -**例えば** - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - -``` text -┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ -│ 2019-01-08 │ 2019-01-08 │ -└───────────────────────────┴──────────────────────────────┘ -``` - -## parseDateTimeBestEffort {#parsedatetimebesteffort} - -の日付と時刻を変換します。 [文字列](../../sql_reference/data_types/string.md) 表現する [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) データ型。 - -関数は解析します [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC1123-5.2.14RFC-822日付と時刻の指定](https://tools.ietf.org/html/rfc1123#page-55)、ClickHouseのと他のいくつかの日付と時刻の形式。 - -**構文** - -``` sql -parseDateTimeBestEffort(time_string [, time_zone]); -``` - -**パラメータ** - -- `time_string` — String containing a date and time to convert. [文字列](../../sql_reference/data_types/string.md). -- `time_zone` — Time zone. The function parses `time_string` タイムゾーンによると。 [文字列](../../sql_reference/data_types/string.md). - -**サポートされている非標準形式** - -- 9を含む文字列。.10桁 [unix timestamp](https://en.wikipedia.org/wiki/Unix_time). -- 日付と時刻コンポーネントを含む文字列: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`、等。 -- 日付を含む文字列で、時間の要素は含まれません: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` など。 -- 日と時間のある文字列: `DD`, `DD hh`, `DD hh:mm`. この場合 `YYYY-MM` として代入される。 `2000-01`. -- タイムゾーンオフセット情報と共に日付と時刻を含む文字列: `YYYY-MM-DD hh:mm:ss ±h:mm`、等。 例えば, `2020-12-12 17:36:00 -5:00`. - -Separatorを持つすべての形式について、この関数は、フルネームまたは月名の最初の三文字で表される月の名前を解析します。 例: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. - -**戻り値** - -- `time_string` に変換される。 `DateTime` データ型。 - -**例** - -クエリ: - -``` sql -SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') -AS parseDateTimeBestEffort; -``` - -結果: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2020-12-12 12:12:57 │ -└─────────────────────────┘ -``` - -クエリ: - -``` sql -SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') -AS parseDateTimeBestEffort -``` - -結果: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-08-18 10:22:16 │ -└─────────────────────────┘ -``` - -クエリ: - -``` sql -SELECT parseDateTimeBestEffort('1284101485') -AS parseDateTimeBestEffort -``` - -結果: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2015-07-07 12:04:41 │ -└─────────────────────────┘ -``` - -クエリ: - -``` sql -SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') -AS parseDateTimeBestEffort -``` - -結果: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-12-12 10:12:12 │ -└─────────────────────────┘ -``` - -クエリ: - -``` sql -SELECT parseDateTimeBestEffort('10 20:19') -``` - -結果: - -``` text -┌─parseDateTimeBestEffort('10 20:19')─┐ -│ 2000-01-10 20:19:00 │ -└─────────────────────────────────────┘ -``` - -**また見なさい** - -- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) -- [RFC 1123](https://tools.ietf.org/html/rfc1123) -- [toDate](#todate) -- [toDateTime](#todatetime) - -## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} - -と同じ [parseDateTimeBestEffort](#parsedatetimebesteffort) ただし、処理できない日付形式が検出された場合はnullを返します。 - -## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} - -と同じ [parseDateTimeBestEffort](#parsedatetimebesteffort) ただし、処理できない日付形式に遭遇した場合は、日付またはゼロの日時が返されます。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/ja/sql_reference/functions/url_functions.md b/docs/ja/sql_reference/functions/url_functions.md deleted file mode 100644 index a594708354f..00000000000 --- a/docs/ja/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 54 -toc_title: "Url\u306E\u64CD\u4F5C" ---- - -# Urlを操作するための関数 {#functions-for-working-with-urls} - -これらの関数はすべてrfcに従いません。 それらは改善された性能のために最大限に簡単である。 - -## URLの一部を抽出する関数 {#functions-that-extract-parts-of-a-url} - -関連する部分がurlに存在しない場合は、空の文字列が返されます。 - -### プロトコル {#protocol} - -URLからプロトコルを抽出します。 - -Examples of typical returned values: http, https, ftp, mailto, tel, magnet… - -### ドメイン {#domain} - -URLからホスト名を抽出します。 - -``` sql -domain(url) -``` - -**パラメータ** - -- `url` — URL. Type: [文字列](../../sql_reference/data_types/string.md). - -URLは、スキームの有無にかかわらず指定できます。 例: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -これらの例では、 `domain` 関数は、次の結果を返します: - -``` text -some.svn-hosting.com -some.svn-hosting.com -yandex.com -``` - -**戻り値** - -- ホスト名。 clickhouseが入力文字列をurlとして解析できる場合。 -- 空の文字列。 clickhouseが入力文字列をurlとして解析できない場合。 - -タイプ: `String`. - -**例えば** - -``` sql -SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ -│ some.svn-hosting.com │ -└────────────────────────────────────────────────────────┘ -``` - -### ドメインウィズなしwww {#domainwithoutwww} - -ドメインを返し、複数のドメインを削除します ‘www.’ それの初めから、存在する場合。 - -### topleveldomaincomment {#topleveldomain} - -URLからトップレベルドメインを抽出します。 - -``` sql -topLevelDomain(url) -``` - -**パラメータ** - -- `url` — URL. Type: [文字列](../../sql_reference/data_types/string.md). - -URLは、スキームの有無にかかわらず指定できます。 例: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -**戻り値** - -- ドメイン名。 clickhouseが入力文字列をurlとして解析できる場合。 -- 空の文字列。 clickhouseが入力文字列をurlとして解析できない場合。 - -タイプ: `String`. - -**例えば** - -``` sql -SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ -│ com │ -└────────────────────────────────────────────────────────────────────┘ -``` - -### 最初のサブドメイン {#firstsignificantsubdomain} - -を返します “first significant subdomain”. これはYandex固有の非標準的な概念です。メトリカ 最初の重要なサブドメインは、セカンドレベルドメインです。 ‘com’, ‘net’, ‘org’、または ‘co’. それ以外の場合は、サードレベルのドメインです。 例えば, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. のリスト “insignificant” 二次レベルドメインおよびその他の実施内容に変化する可能性があります。 - -### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} - -トップレベルのサブドメインを含むドメインの部分を返します。 “first significant subdomain” (上記の説明を参照)。 - -例えば, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### パス {#path} - -パスを返します。 例えば: `/top/news.html` パスにはクエリ文字列は含まれません。 - -### pathFull {#pathfull} - -上記と同じですが、クエリ文字列とフラグメントを含みます。 例:/トップ/ニュース。html?ページ=2\#コメント - -### クエリ文字列 {#querystring} - -クエリ文字列を返します。 例:ページ=1&lr=213。 query-stringには、最初の疑問符と\#と\#後のすべてが含まれていません。 - -### 断片 {#fragment} - -フラグメント識別子を返します。 fragmentには、最初のハッシュ記号は含まれません。 - -### queryStringAndFragment {#querystringandfragment} - -クエリ文字列とフラグメント識別子を返します。 例:ページ=1\#29390. - -### extractURLParameter(URL,名前) {#extracturlparameterurl-name} - -の値を返します ‘name’ URL内にパラメータが存在する場合。 それ以外の場合は、空の文字列。 この名前のパラメータが多数ある場合は、最初のオカレンスが返されます。 この関数は、パラメータ名が渡された引数とまったく同じ方法でURLにエンコードされるという前提の下で機能します。 - -### extractURLParameters(URL) {#extracturlparametersurl} - -URLパラメータに対応するname=value文字列の配列を返します。 値は決してデコードされません。 - -### extractURLParameterNames(URL) {#extracturlparameternamesurl} - -URLパラメータの名前に対応する名前文字列の配列を返します。 値は決してデコードされません。 - -### URLHierarchy(URL) {#urlhierarchyurl} - -最後に/,?記号で切り捨てられたurlを含む配列を返します。 パスとクエリ文字列で。 連続セパレータ文字として数えます。 カットは、すべての連続した区切り文字の後の位置に作られています。 - -### URLPathHierarchy(URL) {#urlpathhierarchyurl} - -上記と同じですが、結果のプロトコルとホストはありません。 要素(ルート)は含まれません。 例:この関数は、ツリーを実装するために使用されるyandexのurlを報告します。 メトリック。 - -``` text -URLPathHierarchy('https://example.com/browse/CONV-6788') = -[ - '/browse/', - '/browse/CONV-6788' -] -``` - -### decodeURLComponent(URL) {#decodeurlcomponenturl} - -復号化されたurlを返します。 -例えば: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - -``` text -┌─DecodedURL─────────────────────────────┐ -│ http://127.0.0.1:8123/?query=SELECT 1; │ -└────────────────────────────────────────┘ -``` - -## URLの一部を削除する関数。 {#functions-that-remove-part-of-a-url} - -URLに類似したものがない場合、URLは変更されません。 - -### cutWWW {#cutwww} - -一つ以下を削除します ‘www.’ URLのドメインの先頭から、存在する場合。 - -### cutQueryString {#cutquerystring} - -クエリ文字列を削除します。 疑問符も削除されます。 - -### カットフラグメント {#cutfragment} - -フラグメント識別子を削除します。 番号記号も削除されます。 - -### cutQueryStringAndFragment {#cutquerystringandfragment} - -クエリ文字列とフラグメント識別子を削除します。 疑問符と番号記号も削除されます。 - -### cutURLParameter(URL,名前) {#cuturlparameterurl-name} - -削除する ‘name’ URLパラメーターがある場合。 この関数は、パラメータ名が渡された引数とまったく同じ方法でURLにエンコードされるという前提の下で機能します。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/ja/sql_reference/functions/uuid_functions.md b/docs/ja/sql_reference/functions/uuid_functions.md deleted file mode 100644 index 65956e93ddd..00000000000 --- a/docs/ja/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 53 -toc_title: "UUID\u306E\u64CD\u4F5C" ---- - -# UUIDを操作するための関数 {#functions-for-working-with-uuid} - -UUIDを操作するための関数を以下に示します。 - -## generateUUIDv4 {#uuid-function-generate} - -を生成する。 [UUID](../../sql_reference/data_types/uuid.md) の [バージョン4](https://tools.ietf.org/html/rfc4122#section-4.4). - -``` sql -generateUUIDv4() -``` - -**戻り値** - -UUID型の値。 - -**使用例** - -この例では、uuid型の列を使用してテーブルを作成し、テーブルに値を挿入する方法を示します。 - -``` sql -CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -INSERT INTO t_uuid SELECT generateUUIDv4() - -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## toUUID(x) {#touuid-x} - -文字列型の値をuuid型に変換します。 - -``` sql -toUUID(String) -``` - -**戻り値** - -UUID型の値。 - -**使用例** - -``` sql -SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid -``` - -``` text -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## UUIDStringToNum {#uuidstringtonum} - -次の形式の36文字を含む文字列を受け取ります `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` そして、それをaのバイトのセットとして返します [FixedString(16)](../../sql_reference/data_types/fixedstring.md). - -``` sql -UUIDStringToNum(String) -``` - -**戻り値** - -FixedString(16) - -**使用例** - -``` sql -SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes -``` - -``` text -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## UUIDNumToString {#uuidnumtostring} - -を受け入れる [FixedString(16)](../../sql_reference/data_types/fixedstring.md) 値、およびテキスト形式で36文字を含む文字列を返します。 - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**戻り値** - -文字列。 - -**使用例** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid -``` - -``` text -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## また見なさい {#see-also} - -- [dictGetUUID](ext_dict_functions.md#ext_dict_functions-other) - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/ja/sql_reference/functions/ym_dict_functions.md b/docs/ja/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index 858ff9aa7a9..00000000000 --- a/docs/ja/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 59 -toc_title: "Yandex\u306E\u3067\u306E\u4F5C\u696D\u3002\u30E1\u30C8\u30EA\u30AB\u8F9E\ - \u66F8" ---- - -# Yandexで作業するための機能。メトリカ辞書 {#functions-for-working-with-yandex-metrica-dictionaries} - -以下の機能が機能するためには、サーバー設定はすべてのyandexを取得するためのパスとアドレスを指定する必要があります。メトリカ辞書。 辞書は、これらの関数の最初の呼び出し時にロードされます。 参照リストをロードできない場合は、例外がスローされます。 - -のための情報を参照リストの項をご参照ください “Dictionaries”. - -## 複数のジオベース {#multiple-geobases} - -ClickHouseは、複数の代替ジオベース(地域階層)を同時に使用して、特定の地域が属する国のさまざまな視点をサポートします。 - -その ‘clickhouse-server’ configは、地域階層を持つファイルを指定します::`/opt/geo/regions_hierarchy.txt` - -このファイルのほかに、それはまた、(ファイル拡張子の前に)\_シンボルと名前に追加任意の接尾辞を持っている近くのファイルを検索します。 -たとえば、ファイルも検索します `/opt/geo/regions_hierarchy_ua.txt`、もしあれば。 - -`ua` 辞書キーと呼ばれます。 接尾辞のない辞書の場合、キーは空の文字列です。 - -すべての辞書は実行時に再ロードされます(builtin\_dictionaries\_reload\_interval設定パラメータで定義されているすべての秒数、またはデフォルトで時間が一度)。 ただし、使用可能な辞書のリストは、サーバーの起動時に一度だけ定義されます。 - -All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. -例えば: - -``` sql -regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt -``` - -### ツつィツ姪"ツつ"ツ債ツづュツつケツ-faq\]) {#regiontocityid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. - -### regionToArea(id\[,geobase\]) {#regiontoareaid-geobase} - -領域を領域に変換します(ジオベースのタイプ5)。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ -│ │ -│ Moscow and Moscow region │ -│ St. Petersburg and Leningrad region │ -│ Belgorod region │ -│ Ivanovsk region │ -│ Kaluga region │ -│ Kostroma region │ -│ Kursk region │ -│ Lipetsk region │ -│ Orlov region │ -│ Ryazan region │ -│ Smolensk region │ -│ Tambov region │ -│ Tver region │ -│ Tula region │ -└──────────────────────────────────────────────────────┘ -``` - -### ツつィツ姪"ツつ"ツ債ツづュツつケツ-ツ篠堕猟ソツ青ソツ仰\]) {#regiontodistrictid-geobase} - -地域を連邦区(ジオベースのタイプ4)に変換します。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ -│ │ -│ Central federal district │ -│ Northwest federal district │ -│ South federal district │ -│ North Caucases federal district │ -│ Privolga federal district │ -│ Ural federal district │ -│ Siberian federal district │ -│ Far East federal district │ -│ Scotland │ -│ Faroe Islands │ -│ Flemish region │ -│ Brussels capital region │ -│ Wallonia │ -│ Federation of Bosnia and Herzegovina │ -└──────────────────────────────────────────────────────────┘ -``` - -### ツつィツ姪"ツつ"ツ債ツづュツつケツ-ツつイツ堕環談\]) {#regiontocountryid-geobase} - -地域を国に変換します。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. -例えば: `regionToCountry(toUInt32(213)) = 225` モスクワ(213)をロシア(225)に変換する。 - -### ツつィツ姪"ツつ"ツ債ツづュツつケツ-ツつイツ堕環談\]) {#regiontocontinentid-geobase} - -地域を大陸に変換します。 他のすべての方法では、この関数は次のようになります ‘regionToCity’. -例えば: `regionToContinent(toUInt32(213)) = 10001` モスクワ(213)をユーラシア(10001)に変換する。 - -### regionToTopContinent(\#regiontotopcontinent) {#regiontotopcontinent-regiontotopcontinent} - -リージョンの階層で最上位の大陸を検索します。 - -**構文** - -``` sql -regionToTopContinent(id[, geobase]); -``` - -**パラメータ** - -- `id` — Region ID from the Yandex geobase. [UInt32](../../sql_reference/data_types/int_uint.md). -- `geobase` — Dictionary key. See [複数のジオベース](#multiple-geobases). [文字列](../../sql_reference/data_types/string.md). 任意です。 - -**戻り値** - -- トップレベルの大陸の識別子(後者は地域の階層を登るとき)。 -- 0、何もない場合。 - -タイプ: `UInt32`. - -### ツ環板篠ョツ嘉ッツ偲青エツδツ-ツエツスツ-ツシツ\]) {#regiontopopulationid-geobase} - -地域の人口を取得します。 -人口はgeobaseのファイルに記録することができます。 セクションを見る “External dictionaries”. -リージョンに対して母集団が記録されていない場合は、0を返します。 -Yandex geobaseでは、母集団は子地域に対して記録されますが、親地域に対しては記録されません。 - -### ツつィツ姪"ツつ"ツ債ツづュツつケツ-ツ篠堕猟ソツ青ソツ仰\]) {#regioninlhs-rhs-geobase} - -をチェックする。 ‘lhs’ リージョンは ‘rhs’ 地域。 UInt8が属している場合は1、属していない場合は0を返します。 -The relationship is reflexive – any region also belongs to itself. - -### ツ環板篠ョツ嘉ッツ偲青エツδツ-ツエツスツ-ツシツ\]) {#regionhierarchyid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. -例えば: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### リージョン名(id\[,lang\]) {#regiontonameid-lang} - -Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn't exist, an empty string is returned. - -`ua` と `uk` もうクです。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/ja/sql_reference/index.md b/docs/ja/sql_reference/index.md deleted file mode 100644 index dfa46ab7510..00000000000 --- a/docs/ja/sql_reference/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: SQL Reference -toc_hidden: true -toc_priority: 28 -toc_title: "\u96A0\u3055\u308C\u305F" ---- - -# SQL参照 {#sql-reference} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md#query_language_queries_alter) -- [その他の種類のクエリ](statements/misc.md) - -[元の記事](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/ja/sql_reference/operators.md b/docs/ja/sql_reference/operators.md deleted file mode 100644 index 918c243ceba..00000000000 --- a/docs/ja/sql_reference/operators.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u6F14\u7B97\u5B50" ---- - -# 演算子 {#operators} - -すべての演算子は、優先順位と結合性に従って、クエリの解析段階で対応する関数に変換されます。 -演算子のグループは優先順位の順にリストされます(リスト内の高いほど、演算子はその引数に接続されています)。 - -## アクセス事業者 {#access-operators} - -`a[N]` – Access to an element of an array. The `arrayElement(a, N)` 機能。 - -`a.N` – Access to a tuple element. The `tupleElement(a, N)` 機能。 - -## 数値の否定の演算子 {#numeric-negation-operator} - -`-a` – The `negate (a)` 機能。 - -## 乗算演算子と除算演算子 {#multiplication-and-division-operators} - -`a * b` – The `multiply (a, b)` 機能。 - -`a / b` – The `divide(a, b)` 機能。 - -`a % b` – The `modulo(a, b)` 機能。 - -## 加算および減算演算子 {#addition-and-subtraction-operators} - -`a + b` – The `plus(a, b)` 機能。 - -`a - b` – The `minus(a, b)` 機能。 - -## 比較演算子 {#comparison-operators} - -`a = b` – The `equals(a, b)` 機能。 - -`a == b` – The `equals(a, b)` 機能。 - -`a != b` – The `notEquals(a, b)` 機能。 - -`a <> b` – The `notEquals(a, b)` 機能。 - -`a <= b` – The `lessOrEquals(a, b)` 機能。 - -`a >= b` – The `greaterOrEquals(a, b)` 機能。 - -`a < b` – The `less(a, b)` 機能。 - -`a > b` – The `greater(a, b)` 機能。 - -`a LIKE s` – The `like(a, b)` 機能。 - -`a NOT LIKE s` – The `notLike(a, b)` 機能。 - -`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. - -`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. - -## データセットを操作する演算子 {#operators-for-working-with-data-sets} - -*見る [演算子の場合](statements/select.md#select-in-operators).* - -`a IN ...` – The `in(a, b)` 機能。 - -`a NOT IN ...` – The `notIn(a, b)` 機能。 - -`a GLOBAL IN ...` – The `globalIn(a, b)` 機能。 - -`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` 機能。 - -## 日付と時刻を操作する演算子 {#operators-datetime} - -### EXTRACT {#operator-extract} - -``` sql -EXTRACT(part FROM date); -``` - -指定した日付からパートを抽出します。 たとえば、指定した日付から月、または時刻から秒を取得できます。 - -その `part` パラメーター取得する日付の部分を指定します。 次の値を使用できます: - -- `DAY` — The day of the month. Possible values: 1–31. -- `MONTH` — The number of a month. Possible values: 1–12. -- `YEAR` — The year. -- `SECOND` — The second. Possible values: 0–59. -- `MINUTE` — The minute. Possible values: 0–59. -- `HOUR` — The hour. Possible values: 0–23. - -その `part` パラ - -その `date` パラメーター処理する日付または時刻を指定します。 どちらか [日付](../sql_reference/data_types/date.md) または [DateTime](../sql_reference/data_types/datetime.md) タイプに対応しています。 - -例: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -次の例では、テーブルを作成し、その中に値を挿入します `DateTime` タイプ。 - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -より多くの例を見ることができる [テスト](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -を作成します。 [間隔](../sql_reference/data_types/special_data_types/interval.md)-との算術演算で使用されるべきであるタイプ値 [日付](../sql_reference/data_types/date.md) と [DateTime](../sql_reference/data_types/datetime.md)-タイプの値。 - -間隔のタイプ: -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -!!! warning "警告" - 間隔の異なる種類できない。 次のような式は使用できません `INTERVAL 4 DAY 1 HOUR`. たとえば、区間の最小単位が小さいか等しい単位で区間を表します `INTERVAL 25 HOUR`. 以下の例のように、結果としての操作を使用できます。 - -例えば: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**また見なさい** - -- [間隔](../sql_reference/data_types/special_data_types/interval.md) データ型 -- [toInterval](../sql_reference/functions/type_conversion_functions.md#function-tointerval) 型変換関数 - -## 論理否定演算子 {#logical-negation-operator} - -`NOT a` – The `not(a)` 機能。 - -## 論理and演算子 {#logical-and-operator} - -`a AND b` – The`and(a, b)` 機能。 - -## 論理or演算子 {#logical-or-operator} - -`a OR b` – The `or(a, b)` 機能。 - -## 条件演算子 {#conditional-operator} - -`a ? b : c` – The `if(a, b, c)` 機能。 - -メモ: - -条件演算子は、bとcの値を計算し、条件aが満たされているかどうかをチェックし、対応する値を返します。 もし `b` または `C` は [arrayJoin()](../sql_reference/functions/array_join.md#functions_arrayjoin) この関数は、各行は関係なくレプリケートされます。 “a” 条件。 - -## 条件式 {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -もし `x` が指定されたら、 `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. - -がない場合 `ELSE c` 式中の句は、デフォルト値は次のとおりです `NULL`. - -その `transform` 機能は動作しません `NULL`. - -## 連結演算子 {#concatenation-operator} - -`s1 || s2` – The `concat(s1, s2) function.` - -## ラムダ作成演算子 {#lambda-creation-operator} - -`x -> expr` – The `lambda(x, expr) function.` - -次の演算子は、角かっこであるため、優先順位がありません: - -## 配列作成演算子 {#array-creation-operator} - -`[x1, ...]` – The `array(x1, ...) function.` - -## タプル作成演算子 {#tuple-creation-operator} - -`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` - -## 結合性 {#associativity} - -すべての二項演算子は結合性を残しています。 例えば, `1 + 2 + 3` に変換される。 `plus(plus(1, 2), 3)`. -時にはこれはあなたが期待するように動作しません。 例えば, `SELECT 4 > 2 > 3` 結果は0になります。 - -効率のため、 `and` と `or` 関数は任意の数の引数を受け取ります。 対応する鎖の `AND` と `OR` 演算子は、これらの関数の単一の呼び出しに変換されます。 - -## のチェック `NULL` {#checking-for-null} - -クリックハウスは `IS NULL` と `IS NOT NULL` 演算子。 - -### IS NULL {#operator-is-null} - -- のために [Nullable](../sql_reference/data_types/nullable.md) タイプ値は、 `IS NULL` 演算子の戻り値: - - `1` 値が `NULL`. - - `0` そうでなければ -- その他の値については、 `IS NULL` 演算子は常に戻ります `0`. - - - -``` sql -SELECT x+100 FROM t_null WHERE y IS NULL -``` - -``` text -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ -``` - -### IS NOT NULL {#is-not-null} - -- のために [Nullable](../sql_reference/data_types/nullable.md) タイプ値は、 `IS NOT NULL` 演算子の戻り値: - - `0` 値が `NULL`. - - `1` そうでなければ -- その他の値については、 `IS NOT NULL` 演算子は常に戻ります `1`. - - - -``` sql -SELECT * FROM t_null WHERE y IS NOT NULL -``` - -``` text -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/ja/sql_reference/statements/alter.md b/docs/ja/sql_reference/statements/alter.md deleted file mode 100644 index cbcc66aaf5c..00000000000 --- a/docs/ja/sql_reference/statements/alter.md +++ /dev/null @@ -1,505 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -その `ALTER` クエリーのみ対応して `*MergeTree` テーブルだけでなく、 `Merge`と`Distributed`. クエリに複数のバリエーションがあります。 - -### 列の操作 {#column-manipulations} - -テーブル構造の変更。 - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -クエリで、コンマ区切りのアクションのリストを指定します。 -各アクションは、列に対する操作です。 - -次の操作がサポートされます: - -- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. -- [DROP COLUMN](#alter_drop-column) — Deletes the column. -- [CLEAR COLUMN](#alter_clear-column) — Resets column values. -- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. -- [MODIFY COLUMN](#alter_modify-column) — Changes column's type, default expression and TTL. - -これらの動作については、以下で詳述する。 - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -指定したテーブルに新しい列を追加します `name`, `type`, [`codec`](create.md#codecs) と `default_expr` (セクションを参照 [既定の式](create.md#create-default-values)). - -この `IF NOT EXISTS` 句が含まれている場合、列がすでに存在する場合、クエリはエラーを返しません。 指定した場合 `AFTER name_after` (名前のカラムのカラムを追加したものを指定されたもののリストテーブル列あります。 そうしないと、カラムが追加されるのです。 場合がありますので注意してない方の追加カラムの最初に表示します。 アクションの連鎖のために, `name_after` 前のアクションのいずれかで追加される列の名前を指定できます。 - -列を追加すると、データでアクションを実行せずにテーブル構造が変更されます。 データは後にディスクに表示されません `ALTER`. テーブルから読み取るときに列のデータが欠落している場合は、デフォルト値(デフォルトの式がある場合はデフォルトの式を実行するか、ゼロまたは データパーツをマージした後、ディスク上に列が表示されます [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)). - -このアプローチにより、 `ALTER` 古いデータの量を増やすことなく、即座に照会します。 - -例えば: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -名前の列を削除します `name`. この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 - -ファイルシステ これはファイル全体を削除するので、クエリはほぼ即座に完了します。 - -例えば: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -すべてリセットデータ列の指定されたパーティション 詳細設定、パーティションの名前の部 [パーティション式の指定方法](#alter-how-to-specify-part-expr). - -この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 - -例えば: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'comment' -``` - -列にコメントを追加します。 この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 - -それぞれの列ができています。 列にコメントが既に存在する場合、新しいコメントは前のコメントを上書きします。 - -コメントは `comment_expression` によって返される列 [DESCRIBE TABLE](misc.md#misc-describe-table) クエリ。 - -例えば: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -このクエリは、 `name` 列のプロパティ: - -- タイプ - -- 既定の式 - -- TTL - - For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). - -この `IF EXISTS` 句が指定されている場合、列が存在しない場合、クエリはエラーを返しません。 - -タイプを変更すると、値は次のように変換されます。 [toType](../../sql_reference/functions/type_conversion_functions.md) 関数がそれらに適用された。 デフォルトの式だけが変更された場合、クエリは何も複雑ではなく、ほぼ即座に完了します。 - -例えば: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. - -いくつかの処理段階があります: - -- 変更されたデータを含む一時(新しい)ファイルの準備。 -- 古いファイルの名前を変更する。 -- 一時(新しい)ファイルの名前を古い名前に変更します。 -- 古いファイルを削除する。 - -最初の段階だけに時間がかかります。 この段階で障害が発生した場合、データは変更されません。 -連続したステージのいずれかで障害が発生した場合は、データを手動で復元できます。 古いファイルがファイルシステムから削除されたが、新しいファイルのデータは、ディスクに書き込まれませんでしたし、失われた場合は例外です。 - -その `ALTER` クエリの変更カラムがそのままに再現されています。 指示はZooKeeperに保存され、各レプリカはそれらを適用します。 すべて `ALTER` クエリは同じ順序で実行されます。 クエリは、他のレプリカで適切なアクションが完了するのを待機します。 ただし、レプリケートされたテーブルの列を変更するクエリは中断され、すべてのアクションは非同期に実行されます。 - -#### ALTER Queryの制限 {#alter-query-limitations} - -その `ALTER` クエリを作成および削除個別要素(カラム)をネストしたデータ構造が全体に入れ子データ構造です。 ネストされたデータ構造を追加するには、次のような名前の列を追加します `name.nested_name` そしてタイプ `Array(T)`. ネストされたデータ構造は、ドットの前に同じ接頭辞を持つ名前を持つ複数の配列列列と同等です。 - -主キーまたはサンプリングキーの列の削除はサポートされていません。 `ENGINE` 式)。 主キーに含まれる列の型を変更することは、この変更によってデータが変更されない場合にのみ可能です(たとえば、値を列挙型に追加したり、型を変更 `DateTime` に `UInt32`). - -この `ALTER` クエリは必要なテーブルの変更を行うのに十分ではありません。 [INSERT SELECT](insert_into.md#insert_query_insert-select) クエリを使用してテーブルを切り替えます。 [RENAME](misc.md#misc_operations-rename) 古いテーブルを照会して削除します。 を使用することができ [クリックハウスコピー機](../../operations/utilities/clickhouse-copier.md) に代わるものとして `INSERT SELECT` クエリ。 - -その `ALTER` クエリーのブロックすべてを読み込みと書き込んでいます。 言い換えれば、長い場合 `SELECT` の時に動いています `ALTER` クエリ、 `ALTER` クエリはそれが完了するのを待ちます。 同時に、同じテーブルに対するすべての新しいクエリは、 `ALTER` 走ってる - -データ自体を格納しないテーブルの場合 `Merge` と `Distributed`), `ALTER` テーブル構造を変更するだけで、下位テーブルの構造は変更されません。 たとえば、ALTERを実行している場合 `Distributed` テーブル、また、実行する必要があります `ALTER` テーブルのすべてすることができます。 - -### キー式による操作 {#manipulations-with-key-expressions} - -以下のコマン: - -``` sql -MODIFY ORDER BY new_expression -``` - -それはの表のためにだけ働きます [`MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) ファミリー(含む -[複製された](../../engines/table_engines/mergetree_family/replication.md) テーブル)。 このコマンドは、 -[ソートキー](../../engines/table_engines/mergetree_family/mergetree.md) テーブルの -に `new_expression` (式または式のタプル)。 主キーは同じままです。 - -このコマンドは、メタデータのみを変更するという意味で軽量です。 データ部分のプロパティを保持するには -既存の列を含む式を追加することはできません。 -ソートキーに(列のみが追加されました。 `ADD COLUMN` 同じでコマンド `ALTER` クエリ)。 - -### データスキップインデックスの操作 {#manipulations-with-data-skipping-indices} - -それはの表のためにだけ働きます [`*MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) ファミリー(含む -[複製された](../../engines/table_engines/mergetree_family/replication.md) テーブル)。 次の操作 -利用できます: - -- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` -付加価指数の説明をテーブルメタデータを指すものとします。 - -- `ALTER TABLE [db].name DROP INDEX name` -除去す指標の説明からテーブルメタデータを削除を行指数のファイルからディスク。 - -これらのコマ -また、その複製(同期指標のメタデータを通して飼育係). - -### 制約による操作 {#manipulations-with-constraints} - -るの詳細を参照してください [制約](create.md#constraints) - -次の構文を使用して制約を追加または削除できます: - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -クエリに追加または削除約メタデータの制約からテーブルで、速やかに処理します。 - -制約チェック *実行されません* 既存のデータが追加された場合。 - -変更後の内容の複製のテーブル放送への飼育係で適用されますその他のレプリカ. - -### パーティションとパーツの操作 {#alter_manipulations-with-partitions} - -以下の操作 [パーティシ](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) 利用できます: - -- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` ディレク -- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. -- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` テーブルへのディレクトリ。 -- [REPLACE PARTITION](#alter_replace-partition) -データパーティションをテーブル間でコピーします。 -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. -- [REPLACE PARTITION](#alter_replace-partition) -コピーするデータを仕切りからテーブルにも置き換え. -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition)-あるテーブルから別のテーブルにデータパーティションを移動します。 -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) -パーティション内の指定された列の値をリセットします。 -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) -リセットの指定された二次インデックス、パーティション -- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. -- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. -- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. - - - -#### デタッチパーティション{\#alter\_detach-partition} {#detach-partition-alter-detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -指定されたパーティションのすべてのデータを `detached` ディレクトリ。 サーバーのを忘れているのは、一戸建てのデータを分配していない場合は存在します。 サーバーはこのデータについて知りません。 [ATTACH](#alter_attach-partition) クエリ。 - -例えば: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -セクションのpartition expressionの設定についての記事を読む [パーティション式の指定方法](#alter-how-to-specify-part-expr). - -クエリが実行された後、データを使用して必要な操作を行うことができます `detached` directory — delete it from the file system, or just leave it. - -This query is replicated – it moves the data to the `detached` すべての複製のディレクトリ。 このクエリはリーダーレプリカでのみ実行できます。 レプリカがリーダーかどうかを調べるには、以下を実行します `SELECT` にクエリ [システム。レプリカ](../../operations/system_tables.md#system_tables-replicas) テーブル。 また、作ることは容易です `DETACH` クエリはすべてのレプリカ-すべてのレプリカ、例外をスロー以外のリーダーレプリカ. - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -削除指定された分割テーブルから. このクエリのタグの仕切りとして休止または消去いたしますデータを完全に約10分です。 - -セクションのpartition expressionの設定についての記事を読む [パーティション式の指定方法](#alter-how-to-specify-part-expr). - -The query is replicated – it deletes data on all replicas. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -指定したパーティショ `detached`. -セクションのパーティション式の設定の詳細 [パーティション式の指定方法](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -テーブルにデータを追加します。 `detached` ディレクトリ。 パーティション全体または別のパートにデータを追加することができます。 例: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -セクションのパーティション式の設定の詳細 [パーティション式の指定方法](#alter-how-to-specify-part-expr). - -このクエリは複製されます。 のレプリカ-イニシエータチェックがあるか否かのデータを `detached` ディレクトリ。 データが存在する場合、クエリは整合性をチェックします。 すべてが正しい場合、クエリはデータをテーブルに追加します。 他のすべてのレプリカをダウンロードからデータのレプリカ-イニシエータです。 - -したがって、データを `detached` ディレクトリを使用します。 `ALTER ... ATTACH` すべてのレプリカのテーブルにクエリを追加します。 - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -このクエリは、データパーティションを `table1` に `table2` のexsistingにデータを加えます `table2`. データは削除されないことに注意してください `table1`. - -クエリを正常に実行するには、次の条件を満たす必要があります: - -- 両方のテーブルに同じ構造が必要です。 -- 両方の表に同じパーティション-キーが必要です。 - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -このクエリは、データパーティションを `table1` に `table2` そしての既存の仕切りを取り替えます `table2`. データは削除されないことに注意してください `table1`. - -クエリを正常に実行するには、次の条件を満たす必要があります: - -- 両方のテーブルに同じ構造が必要です。 -- 両方の表に同じパーティション-キーが必要です。 - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -このクエリは、データパーティションを `table_source` に `table_dest` からデータを削除すると `table_source`. - -クエリを正常に実行するには、次の条件を満たす必要があります: - -- 両方のテーブルに同じ構造が必要です。 -- 両方の表に同じパーティション-キーが必要です。 -- 両方のテーブルと同じでなければならエンジンです。 (複製または非レプリケート) -- 両方の表に同じストレージポリシーが必要です。 - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -パーティショ この `DEFAULT` このクエリは、指定されたデフォルト値に列の値を設定し、テーブルを作成するときに句が決定された。 - -例えば: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -このクエ この `PARTITION` 条項を省略して、クエリーを作成し、バックアップの仕切ります。 - -!!! note "メモ" - バックアップ処理全体は、サーバーを停止せずに実行されます。 - -古いスタイルのテーブルでは、パーティション名のプレフィックスを指定できます(例, ‘2019’)のクエリーを作成し、バックアップのためのすべてに対応する隔壁 セクションのpartition expressionの設定についての記事を読む [パーティション式の指定方法](#alter-how-to-specify-part-expr). - -実行時に、データスナップショットの場合、クエリはテーブルデータへのハードリンクを作成します。 ディレクト `/var/lib/clickhouse/shadow/N/...`、どこ: - -- `/var/lib/clickhouse/` 設定で指定されたClickHouseの作業ディレクトリです。 -- `N` バックアップの増分数です。 - -!!! note "メモ" - 使用する場合 [テーブル内のデータストレージのディスクのセット](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes)、を `shadow/N` ディレクトリが表示される毎にディスクデータを格納する部品と合わせによる `PARTITION` 式。 - -同じディレクトリ構造がバックアップ内に作成されます。 `/var/lib/clickhouse/`. クエリが実行されます ‘chmod’ すべてのファイルについて、それらへの書き込みを禁止。 - -バックアップを作成したら、次のデータをコピーできます `/var/lib/clickhouse/shadow/` リモートサーバーに移動し、ローカルサーバーから削除します。 それに注意しなさい `ALTER t FREEZE PARTITION` クエリは複製されません。 するための地元のバックアップ、現地サーバーです。 - -クエリをバックアップトで最初のでお待ちしておりますので、現在のクエリーに対応するテーブルに仕上げた。 - -`ALTER TABLE t FREEZE PARTITION` コピーのみのデータのないテーブルメタデータを指すものとします。 をバックアップテーブルメタデータ、コピー、ファイル `/var/lib/clickhouse/metadata/database/table.sql` - -バックアップからデータを復元するには: - -1. テーブルが存在しない場合はテーブルを作成します。 クエリを表示するには、を使用します。sqlファイル(置換 `ATTACH` それで `CREATE`). -2. からデータをコピーします `data/database/table/` バックアップの中のディレクトリ `/var/lib/clickhouse/data/database/table/detached/` ディレクトリ。 -3. 走れ。 `ALTER TABLE t ATTACH PARTITION` データをテーブルに追加するクエリ。 - -バックア - -バックアップおよびデータの復元の詳細については、次を参照 [データバック](../../operations/backup.md) セクション。 - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -クエリは次のように動作します `CLEAR COLUMN` しかし、列データの代わりに索引をリセットします。 - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -ダウンロードパーティションから別のサーバーです。 このクエリーだけを再現します。 - -クエリは次の処理を行います: - -1. 指定したシャードからパーティションをダウ で ‘path-in-zookeeper’ ZooKeeperでシャードへのパスを指定する必要があります。 -2. 次に、クエリはダウンロードされたデータを `detached` のディレクトリ `table_name` テーブル。 を使用 [ATTACH PARTITION\|PART](#alter_attach-partition) データをテーブルに追加するためのクエリ。 - -例えば: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -それに注意: - -- その `ALTER ... FETCH PARTITION` クエリは複製されません。 それはに仕切りを置きます `detached` ディレクト -- その `ALTER TABLE ... ATTACH` クエリが複製されます。 すべてのレプリカにデータを追加します。 データは、次のいずれかのレプリカに追加されます。 `detached` ディレクトリ、および他の人に-近隣のレプリカから。 - -ダウンロードする前に、システムかどうかをチェックすると、パーティションが存在するとテーブル構造。 最も適切なレプリカは、正常なレプリカから自動的に選択されます。 - -クエリは呼び出されますが `ALTER TABLE` テーブル構造は変更されず、テーブルで使用できるデータもすぐには変更されません。 - -#### MOVE PARTITION\|PART {#alter_move-partition} - -別のボリュームまたはディ `MergeTree`-エンジンテーブル。 見る [複数ブロックデバイスを使用したデータ保存](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -その `ALTER TABLE t MOVE` クエリ: - -- な再現が異なるレプリカで保管。 -- 指定されたディスクまたはボリ また、ストレージポリシーで指定されたデータ移動の条件を適用できない場合は、エラーが返されます。 -- 移動するデータがバックグラウンドプロセスによって既に移動されている場合にエラーを返すことができます。 `ALTER TABLE t MOVE` クエリとして結果データの統合. この場合、ユーザーは追加の操作を行うべきではありません。 - -例えば: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### パーティション式の設定方法 {#alter-how-to-specify-part-expr} - -パーティション式を指定するには `ALTER ... PARTITION` 異なる方法でクエリ: - -- からの値として `partition` の列 `system.parts` テーブル。 例えば, `ALTER TABLE visits DETACH PARTITION 201901`. -- テーブル列からの式として。 定数と定数式がサポートされています。 例えば, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- パーティションidの使用。 パーティションidは、ファイルシステムおよびzookeeper内のパーティションの名前として使用されるパーティションの文字列識別子です(可能であれば、人間が パーティションidを指定する必要があります。 `PARTITION ID` 一重引quotesでの句。 例えば, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- で [ALTER ATTACH PART](#alter_attach-partition) と [DROP DETACHED PART](#alter_drop-detached) クエリ、パートの名前を指定するには、文字列リテラルを使用します。 `name` の列 [システム。detached\_parts](../../operations/system_tables.md#system_tables-detached_parts) テーブル。 例えば, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -ご利用の引用符を指定する場合、パーティションのエントランスは目を引く壁面緑化を表現。 たとえば、 `String` その名前を引用符で指定する必要があります (`'`). のための `Date` と `Int*` タイプ引用符は必要ありません。 - -古いスタイルのテーブルの場合は、パーティションを数値として指定できます `201901` または文字列 `'201901'`. 新しいスタイルのテーブルの構文は、型が厳しくなります(VALUES入力フォーマットのパーサーと同様)。 - -上記のすべてのルールは、 [OPTIMIZE](misc.md#misc_operations-optimize) クエリ。 を指定する場合にのみ分配時の最適化、非仕切られたテーブルセットの表現 `PARTITION tuple()`. 例えば: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -の例 `ALTER ... PARTITION` クエリはテストで実証されています [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) と [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### テーブルttlによる操作 {#manipulations-with-table-ttl} - -変更することができ [テーブルTTL](../../engines/table_engines/mergetree_family/mergetree.md#mergetree-table-ttl) 次のフォームの要求で: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### ALTERクエリのシンクロニシティ {#synchronicity-of-alter-queries} - -非複製可能なテーブルの場合は、すべて `ALTER` クエリは同期的に実行されます。 のためのreplicatableテーブル、クエリーだけで追加指示のための適切な行動を `ZooKeeper`、そしてアクション自体はできるだけ早く実行されます。 しかし、クエリーが待機するためにこれらの行動は完了するすべてのレプリカ. - -のために `ALTER ... ATTACH|DETACH|DROP` クエリを使用することができます `replication_alter_partitions_sync` 待ちを設定する設定。 -可能な値: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. - -### 突然変異 {#alter-mutations} - -突然変異は、テーブル内の行を変更または削除できるようにするalter query variantです。 標準とは対照的に `UPDATE` と `DELETE` ポイントデータの変更を目的としたクエリ、突然変異は、テーブル内の多くの行を変更する重い操作を目的としています。 のために支えられる `MergeTree` 家族のテーブルエンジンなどのエンジンの複製です。 - -既存のテーブルはそのまま変異可能です(変換は必要ありません)が、最初の変更がテーブルに適用されると、そのメタデータ形式は以前のサーバーバージョンと - -現在使用可能なコマンド: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -その `filter_expr` 型でなければならな `UInt8`. クエリは、この式がゼロ以外の値をとるテーブルの行を削除します。 - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -その `filter_expr` 型でなければならな `UInt8`. このクエリは、指定された列の値を、対応する式の値に更新します。 `filter_expr` ゼロ以外の値をとります。 値は列タイプにキャストされます。 `CAST` オペレーター プライマリキーまたはパーティションキーの計算で使用される列の更新はサポートされません。 - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -クエリを再建の二次指数 `name` パーティション内 `partition_name`. - -一つのクエリを含むことができ複数のコマンドをカンマで区切られています。 - -用\*mergetreeテーブル突然変異の実行による書き換え全体のデータ部品です。 atomicity-部品は準備ができているおよびaとすぐ変異する部品の代わりになりますありません `SELECT` 変異中に実行を開始したクエリには、まだ変更されていない部分のデータと共に既に変更されている部分のデータが表示されます。 - -突然変異は、作成順序によって完全に順序付けられ、その順序で各パートに適用されます。 突然変異が提出される前にテーブルに挿入されたデータは突然変異され、その後に挿入されたデータは突然変異されません。 この変異のないブロックを挿入します。 - -変更クエリは、変更エントリが追加された直後に返されます(レプリケートされたテーブルがzookeeperにある場合、非レプリケートされたテーブルがファイルシス の突然変異体の執行を非同利用システムの概要を設定します。 突然変異の進行状況を追跡するには、 [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) テーブル。 正常に送信された変更は、ClickHouseサーバーが再起動されても引き続き実行されます。 それが提出されると突然変異をロールバックする方法はありませんが、何らかの理由で突然変異が起こった場合、それをキャンセルすることができ [`KILL MUTATION`](misc.md#kill-mutation) クエリ。 - -終了した突然変異のためのエントリはすぐに削除されません(保存されたエントリの数は `finished_mutations_to_keep` ストレージエンジン変数)。 古い変異エントリが削除されます。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/ja/sql_reference/statements/create.md b/docs/ja/sql_reference/statements/create.md deleted file mode 100644 index 95fac55bfc0..00000000000 --- a/docs/ja/sql_reference/statements/create.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 35 -toc_title: CREATE ---- - -# クエリの作成 {#create-queries} - -## CREATE DATABASE {#query-language-create-database} - -データベースの作成。 - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] -``` - -### 句 {#clauses} - -- `IF NOT EXISTS` - - If the `db_name` database already exists, then ClickHouse doesn't create a new database and: - - - Doesn't throw an exception if clause is specified. - - Throws an exception if clause isn't specified. - -- `ON CLUSTER` - - ClickHouse creates the `db_name` database on all the servers of a specified cluster. - -- `ENGINE` - - - [MySQL](../engines/database_engines/mysql.md) - - Allows you to retrieve data from the remote MySQL server. - - By default, ClickHouse uses its own [database engine](../engines/database_engines/index.md). - -## CREATE TABLE {#create-table-query} - -その `CREATE TABLE` クエリには複数の形式を使用できます。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], - ... -) ENGINE = engine -``` - -名前の付いた表を作成します ‘name’ で ‘db’ データベースまたは ‘db’ は設定されていない。 ‘engine’ エンジン。 -テーブルの構造は、列の説明のリストです。 た場合の指数については、エンジンとして表示していパラメータテーブルのエンジンです。 - -列の説明は次のとおりです `name type` 最も単純なケースでは。 例えば: `RegionID UInt32`. -デフォルト値に対して式を定義することもできます(下記参照)。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -別のテーブルと同じ構造のテーブルを作成します。 テーブルに別のエンジンを指定できます。 エンジンが指定されていない場合は、同じエンジンが `db2.name2` テーブル。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() -``` - -テーブルを作成しますの構造やデータによって返される [テーブル機能](../table_functions/index.md). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -の結果のような構造を持つテーブルを作成します。 `SELECT` クエリ、 ‘engine’ エンジンは、SELECTからのデータでそれを埋めます。 - -すべての場合において、 `IF NOT EXISTS` テーブルが既に存在する場合、クエリはエラーを返しません。 この場合、クエリは何もしません。 - -後に他の節がある場合もあります `ENGINE` クエリ内の句。 テーブルの作成方法に関する詳細なドキュメントを参照してください [表エンジン](../../engines/table_engines/index.md#table_engines). - -### デフォルト値 {#create-default-values} - -列の説明では、次のいずれかの方法で、既定値の式を指定できます:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. -例えば: `URLDomain String DEFAULT domain(URL)`. - -デフォルト値の式が定義されていない場合、デフォルト値は数値の場合はゼロに、文字列の場合は空の文字列に、配列の場合は空の配列に設定され `0000-00-00` 日付または `0000-00-00 00:00:00` 時間の日付のため。 Nullはサポートされていません。 - -既定の式が定義されている場合、列の型は省略可能です。 明示的に定義された型がない場合は、既定の式の型が使用されます。 例えば: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ タイプは ‘EventDate’ コラム - -データ型と既定の式が明示的に定義されている場合、この式は型キャスト関数を使用して指定された型にキャストされます。 例えば: `Hits UInt32 DEFAULT 0` と同じことを意味します `Hits UInt32 DEFAULT toUInt32(0)`. - -Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don't contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. - -`DEFAULT expr` - -通常のデフォルト値。 insertクエリで対応する列が指定されていない場合は、対応する式を計算して入力します。 - -`MATERIALIZED expr` - -マテリアライズド式。 このような列は、常に計算されるため、insertに指定することはできません。 -列のリストのないinsertの場合、これらの列は考慮されません。 -また、selectクエリでアスタリスクを使用する場合、この列は置換されません。 これは、ダンプが以下を使用して取得した不変量を保持するためです `SELECT *` 列のリストを指定せずにINSERTを使用してテーブルに戻すことができます。 - -`ALIAS expr` - -同義語。 このような列は、テーブルにはまったく格納されません。 -その値はテーブルに挿入することはできず、selectクエリでアスタリスクを使用するときは置換されません。 -クエリの解析中にエイリアスが展開されている場合は、selectで使用できます。 - -ALTER queryを使用して新しい列を追加する場合、これらの列の古いデータは書き込まれません。 代わりに、新しい列の値を持たない古いデータを読み取る場合、式は既定でオンザフライで計算されます。 ただし、式を実行するために、クエリで指定されていない異なる列が必要な場合、これらの列は追加で読み取られますが、必要なデータブロックに対し - -新しい列をテーブルに追加し、後でそのデフォルトの式を変更すると、古いデータに使用される値が変更されます(ディスクに値が格納されていないデー バックグラウンドマージを実行すると、マージパーツのいずれかにない列のデータがマージされたパーツに書き込まれます。 - -入れ子になったデータ構造の要素の既定値を設定することはできません。 - -### 制約 {#constraints} - -列と共に、説明の制約を定義することができます: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` 任意のブール式でできます。 場合に制約の定義のテーブルのそれぞれチェック毎に行 `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. - -追加大量の制約になる可能性の性能を大 `INSERT` クエリ。 - -### TTL式 {#ttl-expression} - -値の保存時間を定義します。 mergetree-familyテーブルにのみ指定できます。 詳細な説明については、 [列とテーブルのttl](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). - -### 列圧縮コーデック {#codecs} - -デフォルトでは、clickhouseは `lz4` 圧縮方法。 のために `MergeTree`-エンジンファミリでは、デフォルトの圧縮方法を変更できます [圧縮](../../operations/server_configuration_parameters/settings.md#server-settings-compression) サーバー構成のセクション。 また、各列の圧縮方法を定義することもできます。 `CREATE TABLE` クエリ。 - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -コーデックが指定されている場合、既定のコーデックは適用されません。 コーデックの組合せでのパイプライン、例えば, `CODEC(Delta, ZSTD)`. の選定と大型ブリッジダイオードコーデックの組み合わせますプロジェクト、ベンチマークと同様に記載のAltinity [ClickHouseの効率を改善する新しいエンコーディング](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) 記事。 - -!!! warning "警告" - できない解凍clickhouseデータベースファイルを外部の事のように `lz4`. 代わりに、特別な [clickhouse-コンプレッサー](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) 効用だ - -圧縮できるようになりました以下のテーブルエンジン: - -- [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) 家族 列圧縮コーデックをサポートし、既定の圧縮方法を選択する [圧縮](../../operations/server_configuration_parameters/settings.md#server-settings-compression) 設定。 -- [ログ](../../engines/table_engines/log_family/log_family.md) 家族 使用します `lz4` 圧縮メソッドはデフォルト対応カラムの圧縮コーデック. -- [セット](../../engines/table_engines/special/set.md). 唯一のデフォルトの圧縮をサポート。 -- [参加](../../engines/table_engines/special/join.md). 唯一のデフォルトの圧縮をサポート。 - -ClickHouse支援共通の目的コーデックや専門のコーデック. - -#### 特殊コーデック {#create-query-specialized-codecs} - -これらのコーデックしていただくための圧縮により効果的な利用の特徴データです。 これらのコーデックの一部は、データ自身を圧縮しない。 その代わりに、それらのデータを共通の目的コーデックは、圧縮です。 - -特殊コーデック: - -- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` デルタ値を格納するために使用されます。 `delta_bytes` raw値の最大サイズです。 可能 `delta_bytes` 値:1,2,4,8. のデフォルト値 `delta_bytes` は `sizeof(type)` 1、2、4、または8に等しい場合。 それ以外の場合は1です。 -- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla:高速でスケーラブルなメモリ内の時系列データベース](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla:高速でスケーラブルなメモリ内の時系列データベース](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` と `DateTime`). アルゴリズムの各ステップで、codecは64値のブロックを取り、64x64ビット行列にそれらを入れ、それを転置し、未使用の値をトリミングし、残りをシーケ 未使用のビットは、圧縮が使用されるデータ部分全体の最大値と最小値の間で異ならないビットです。 - -`DoubleDelta` と `Gorilla` コーデックは、その圧縮アルゴリズムの構成要素としてゴリラTSDBで使用されています。 Gorillaのアプローチは、タイムスタンプで徐々に変化する値のシーケンスがある場合のシナリオで有効です。 タイムスタンプは、 `DoubleDelta` コーデックおよび値はによって効果的に圧縮されます `Gorilla` コーデック。 たとえば、効果的に格納されたテーブルを取得するには、次の構成でテーブルを作成します: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### 一般的な目的のコーデック {#create-query-common-purpose-codecs} - -コーデック: - -- `NONE` — No compression. -- `LZ4` — Lossless [データ圧縮](https://github.com/lz4/lz4) 既定で使用されます。 LZ4高速圧縮を適用します。 -- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` 既定のレベルを適用します。 可能なレベル:\[1、12\]。 推奨レベル範囲:\[4、9\]。 -- `ZSTD[(level)]` — [ZSTD圧縮アルゴリズム](https://en.wikipedia.org/wiki/Zstandard) 構成可能を使って `level`. 可能なレベル:\[1、22\]。 デフォルト値:1。 - -圧縮レベルが高い場合は、圧縮回数、繰り返しの解凍などの非対称シナリオに役立ちます。 高いレベルは、より良い圧縮と高いcpu使用率を意味します。 - -## 一時テーブル {#temporary-tables} - -ClickHouseは次の特徴がある一時テーブルを支える: - -- 一時テーブルは、接続が失われた場合など、セッションが終了すると消えます。 -- 一時テーブルはメモリエンジンのみを使用します。 -- 一時テーブルにdbを指定することはできません。 データベースの外部で作成されます。 -- すべてのクラスタサーバー上に分散ddlクエリを使用して一時テーブルを作成することは不可能です `ON CLUSTER`):このテーブルは現在のセッションにのみ存在します。 -- テンポラリテーブルの名前が別のテーブルと同じ場合、クエリでdbを指定せずにテーブル名を指定すると、テンポラリテーブルが使用されます。 -- 分散クエリ処理では、クエリで使用される一時テーブルがリモートサーバーに渡されます。 - -一時テーブルを作成するには、次の構文を使用します: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -ほとんどの場合、一時テーブルを手動で作成され、外部データを利用するためのクエリに対して、または配布 `(GLOBAL) IN`. 詳細は、該当するセクションを参照してください - -テーブルを使用することは可能です [エンジン=メモリ](../../engines/table_engines/special/memory.md) 一時テーブルの代わりに。 - -## 分散ddlクエリ(on cluster clause) {#distributed-ddl-queries-on-cluster-clause} - -その `CREATE`, `DROP`, `ALTER`、と `RENAME` クエリの支援の分散実行クラスター -たとえば、次のクエリを作成します `all_hits` `Distributed` 各ホストのテーブル `cluster`: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -これらのクエリを正しく実行するには、各ホストが同じクラスタ定義を持っている必要があります(設定の同期を簡単にするために、zookeeperからの置換 彼らはまた、zookeeperサーバに接続する必要があります。 -クエリのローカルバージョンは、一部のホストが現在利用できない場合でも、最終的にクラスター内の各ホストに実装されます。 単一のホスト内でクエリを実行する順序は保証されます。 - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -ビューを作成します。 通常とマテリアライズド:ビューの二つのタイプがあります。 - -通常のビューにはデータは保存されませんが、別のテーブルから読み取るだけです。 言い換えれば、通常のビューは、保存されたクエリに過ぎません。 ビューから読み取る場合、この保存されたクエリはfrom句のサブクエリとして使用されます。 - -たとえば、ビューを作成したとします: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -とクエリを書かれた: - -``` sql -SELECT a, b, c FROM view -``` - -このクエリは、サブクエリの使用と完全に同じです: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -実現の景色でデータ変換に対応する選択を返します。 - -マテリアライズドビューを作成するとき `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. - -マテリアライズドビューを作成するとき `TO [db].[table]`、使用してはならない `POPULATE`. - -SELECTで指定されたテーブルにデータを挿入すると、挿入されたデータの一部がこのSELECTクエリによって変換され、結果がビューに挿入されます。 - -POPULATEを指定すると、作成時に既存のテーブルデータがビューに挿入されます。 `CREATE TABLE ... AS SELECT ...` . そうしないと、クエリーを含み、データを挿入し、表の作成後、作成した。 ビューの作成時にテーブルに挿入されたデータは挿入されないため、POPULATEを使用することはお勧めしません。 - -A `SELECT` クエ `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` が設定され、データは挿入中に集約されるが、挿入されたデータの単一パケット内にのみ存在する。 データはそれ以上集計されません。 例外は、次のようなデータの集計を個別に実行するエンジンを使用する場合です `SummingMergeTree`. - -の実行 `ALTER` クエリを実現眺めなが十分に整備されていないので、いかに不便です。 マテリアライズドビュ `TO [db.]name`、できます `DETACH` ビュー、実行 `ALTER` ターゲットテーブルの場合 `ATTACH` 以前に切り離さ (`DETACH`)ビュー。 - -ビューの外観は、通常のテーブルと同じです。 例えば、それらはの結果にリストされています `SHOW TABLES` クエリ。 - -ビューを削除するための別のクエリはありません。 ビューを削除するには `DROP TABLE`. - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` - -作成 [外部辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) 与えられると [構造](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md), [ソース](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md), [レイアウト](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) と [寿命](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md). - -外部辞書構造の属性です。 ディクショナリ属性は、表の列と同様に指定します。 唯一の必須の属性は、そのタイプ、その他すべてのプロパティがデフォルト値がある。 - -辞書に応じて [レイアウト](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) 一つ以上の属性は、辞書キーとして指定することができます。 - -詳細については、 [外部辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) セクション。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/ja/sql_reference/statements/insert_into.md b/docs/ja/sql_reference/statements/insert_into.md deleted file mode 100644 index f9e7922cd77..00000000000 --- a/docs/ja/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 34 -toc_title: INSERT INTO ---- - -## INSERT {#insert} - -データの追加。 - -基本的なクエリ形式: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -クエリでは、挿入する列のリストを指定できます `[(c1, c2, c3)]`. この場合、残りの列は次のように入力されます: - -- から計算された値 `DEFAULT` テーブル定義で指定された式。 -- ゼロと空の文字列の場合 `DEFAULT` 式は定義されていません。 - -もし [strict\_insert\_defaults=1](../../operations/settings/settings.md)、持っていない列 `DEFAULT` definedは、クエリに一覧表示する必要があります。 - -データは、任意の挿入物に渡すことができます [書式](../../interfaces/formats.md#formats) ClickHouseでサポートされている。 形式は、クエリで明示的に指定する必要があります: - -``` sql -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: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -ClickHouseは、データの前にすべてのスペースと改行(存在する場合)を削除します。 クエリを作成するときは、クエリ演算子の後に新しい行にデータを置くことをお勧めします(データがスペースで始まる場合は重要です)。 - -例えば: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -挿入することができます。データから別のクエリのコマンドラインクライアント、httpインターフェース。 詳細については、以下を参照してください “[界面](../../interfaces/index.md#interfaces)”. - -### 制約 {#constraints} - -テーブルが [制約](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. - -### の結果を挿入する `SELECT` {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -列は、select句内の位置に応じてマップされます。 ただし、select式とinsertのテーブルの名前は異なる場合があります。 必要に応じて、タイプ鋳造が行われる。 - -値以外のデータ形式では、次のような式に値を設定できません `now()`, `1 + 2`、というように。 この場合、非効率的なコードが実行に使用されるためです。 - -その他のクエリをデータ部品に対応していない: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. -ただし、次の方法で古いデータを削除できます `ALTER TABLE ... DROP PARTITION`. - -`FORMAT` 次の場合、クエリの最後に句を指定する必要があります `SELECT` テーブル関数を含む句 [入力()](../table_functions/input.md). - -### パフォーマン {#performance-considerations} - -`INSERT` 入力データを主キーでソートし、パーティションキーでパーティションに分割します。 た場合のデータを挿入し複数の仕切りは一度で大幅に低減できることの `INSERT` クエリ。 これを避けるには: - -- 一度に100,000行など、かなり大きなバッチでデータを追加します。 -- グループによるデータのパーティション鍵のアップロード前にでclickhouse. - -性能が減少することはありませんが: - -- データはリアルタイムで追加されます。 -- アップロードしたデータとは、通常はソートされました。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/ja/sql_reference/statements/misc.md b/docs/ja/sql_reference/statements/misc.md deleted file mode 100644 index 217f76d6621..00000000000 --- a/docs/ja/sql_reference/statements/misc.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 39 -toc_title: "\u305D\u306E\u4ED6" ---- - -# その他のクエリ {#miscellaneous-queries} - -## ATTACH {#attach} - -このクエリは `CREATE`、しかし - -- 単語の代わりに `CREATE` それは単語を使用します `ATTACH`. -- クエリはディスク上にデータを作成しませんが、データがすでに適切な場所にあるとみなし、テーブルに関する情報をサーバーに追加するだけです。 - 添付クエリを実行すると、サーバーはテーブルの存在を知ることになります。 - -テーブルが以前に分離されていた場合 (`DETACH`)、その構造が知られていることを意味し、構造を定義することなく省略形を使用することができます。 - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -このクエリは、サーバーの起動時に使用されます。 サーバーに店舗のテーブルメタデータとしてファイル `ATTACH` クエリは、起動時に実行されるだけです(サーバー上に明示的に作成されたシステムテーブルは例外です)。 - -## CHECK TABLE {#check-table} - -Trueの場合、ただちにパージを行うデータをテーブルが壊れる可能性があります。 - -``` sql -CHECK TABLE [db.]name -``` - -その `CHECK TABLE` queryは、実際のファイルサイズをサーバーに格納されている期待値と比較します。 ファイルサイズが格納された値と一致しない場合は、データが破損していることを意味します。 このが発生する可能性があります、例えば、システムがクラッシュ時のクエリを実行します。 - -のクエリーの応答を含む `result` 単一行の列。 行に値がのあります -[ブール値](../../sql_reference/data_types/boolean.md) タイプ: - -- 0-テーブル内のデータが破損しています。 -- 1-データは整合性を維持します。 - -その `CHECK TABLE` クエリは以下のテーブルエンジン: - -- [ログ](../../engines/table_engines/log_family/log.md) -- [TinyLog](../../engines/table_engines/log_family/tinylog.md) -- [ストリップログ](../../engines/table_engines/log_family/stripelog.md) -- [マージツリーファミリー](../../engines/table_engines/mergetree_family/mergetree.md) - -これは、テーブルが別のテーブルエンジンの原因となる例外です。 - -からのエンジン `*Log` 家族は失敗の自動データ回復を提供しない。 を使用 `CHECK TABLE` タイムリーにデータ損失を追跡するためのクエリ。 - -のために `MergeTree` 家族のエンジンは、 `CHECK TABLE` クエリを示すステータス確認のための個人データのテーブルに現地サーバーです。 - -**データが破損している場合** - -テーブルが破損している場合は、破損していないデータを別のテーブルにコピーできます。 これを行うには: - -1. 破損したテーブルと同じ構造の新しいテーブルを作成します。 このためクセスしてください `CREATE TABLE AS `. -2. セットを [max\_threads](../../operations/settings/settings.md#settings-max_threads) 単一のスレッドで次のクエリを処理するには、1の値を指定します。 これを行うにはクエリを実行します `SET max_threads = 1`. -3. クエリの実行 `INSERT INTO SELECT * FROM `. この要求にコピーする非破損データからの表-別表に示す。 破損した部分の前のデータのみがコピーされます。 -4. 再起動する `clickhouse-client` リセットするには `max_threads` 値。 - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -以下を返します `String` タイプ列: - -- `name` — Column name. -- `type`— Column type. -- `default_type` — Clause that is used in [既定の式](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` または `ALIAS`). 既定の式が指定されていない場合、Columnには空の文字列が含まれます。 -- `default_expression` — Value specified in the `DEFAULT` 句。 -- `comment_expression` — Comment text. - -入れ子にされたデータ構造は “expanded” フォーマット。 各列は別々に表示され、名前はドットの後に続きます。 - -## DETACH {#detach} - -に関する情報を削除します。 ‘name’ サーバーからのテーブル。 サーバーはテーブルの存在を知ることをやめます。 - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -テーブルのデータやメタデータは削除されません。 次のサーバーの起動時に、サーバーはメタデータを読み取り、再度テーブルについて調べます。 -同様に、 “detached” 表はを使用して再付けることができます `ATTACH` クエリ(メタデータが格納されていないシステムテーブルを除く)。 - -ありません `DETACH DATABASE` クエリ。 - -## DROP {#drop} - -このクエ: `DROP DATABASE` と `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -内部のすべてのテーブルを削除 ‘db’ データベース、その後削除 ‘db’ データベース自体。 -もし `IF EXISTS` データベースが存在しない場合、エラーは返されません。 - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -テーブルを削除します。 -もし `IF EXISTS` テーブルが存在しない場合、またはデータベースが存在しない場合は、エラーを返しません。 - - DROP DICTIONARY [IF EXISTS] [db.]name - -辞書をdeletsします。 -もし `IF EXISTS` テーブルが存在しない場合、またはデータベースが存在しない場合は、エラーを返しません。 - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -シングルを返します `UInt8`-単一の値を含むタイプの列 `0` テーブルまたはデータベースが存在しない場合、または `1` 指定されたデータベースにテーブルが存在する場合。 - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -現在実行中のクエリを強制的に終了しようとします。 -終了するクエリは、システムから選択されます。プロセステーブルで定義された基準を使用して、 `WHERE` の句 `KILL` クエリ。 - -例: - -``` sql --- Forcibly terminates all queries with the specified query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Synchronously terminates all queries run by 'username': -KILL QUERY WHERE user='username' SYNC -``` - -読み取り専用ユーザーは、自分のクエリのみを停止できます。 - -既定では、非同期バージョンのクエリが使用されます (`ASYNC`)、クエリが停止したことの確認を待つことはありません。 - -同期バージョン (`SYNC`)待機のためのすべての問い合わせに対応停止に関する情報を表示し各工程で停止します。 -応答には、 `kill_status` 次の値を取ることができる列: - -1. ‘finished’ – The query was terminated successfully. -2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. -3. The other values ​​explain why the query can't be stopped. - -テストクエリ (`TEST`)ユーザーの権限のみをチェックし、停止するクエリのリストを表示します。 - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -キャンセルと削除を試みます [突然変異](alter.md#alter-mutations) これは現在実行中です。 取り消すべき突然変異はから選ばれます [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) テーブルのフィルタで指定された `WHERE` の句 `KILL` クエリ。 - -テストクエリ (`TEST`)ユーザーの権限のみをチェックし、停止するクエリのリストを表示します。 - -例: - -``` sql --- Cancel and remove all mutations of the single table: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Cancel the specific mutation: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). - -突然変異によって既に行われた変更はロールバックされません。 - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -このクエリを初期化予定外の統合データのパーツを使ったテーブルのテーブルエンジンからの [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) 家族 - -その `OPTMIZE` クエリもサポートされています [MaterializedView](../../engines/table_engines/special/materializedview.md) そして [バッファ](../../engines/table_engines/special/buffer.md) エンジン その他のテーブルエンジンなサポート。 - -とき `OPTIMIZE` とともに使用されます [レプリケートされたmergetree](../../engines/table_engines/mergetree_family/replication.md) テーブルエンジンのファミリ、ClickHouseはマージのためのタスクを作成し、すべてのノードでの実行を待ちます。 `replication_alter_partitions_sync` 設定が有効になっています)。 - -- もし `OPTIMIZE` 何らかの理由でマージを実行せず、クライアントに通知しません。 通知を有効にするには、以下を使用します [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) 設定。 -- を指定した場合 `PARTITION` 指定したパーティションのみが最適化されます。 [パーティション式の設定方法](alter.md#alter-how-to-specify-part-expr). -- 指定した場合 `FINAL`、最適化は、すべてのデータがすでに一つの部分にある場合でも行われる。 -- 指定した場合 `DEDUPLICATE`、その後、完全に同一の行が重複排除されます(すべての列が比較されます)、それだけでMergeTreeエンジンのために理にかなっています。 - -!!! warning "警告" - `OPTIMIZE` 修正できません “Too many parts” エラー。 - -## RENAME {#misc_operations-rename} - -テーブルの名前を変更します。 - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -すべてのテーブル名変更"グローバルチェンジにおけるロックしなければなりません。 テーブルの名前を変更するのは簡単な操作です。 場合は正しく表示す他のデータベースのテーブルに表示されるようになります。本データベースです。 しかし、そのディレクトリのデータベースに格納してある必要がある同一ファイルシステム(それ以外の場合、エラーを返す。 - -## SET {#query-set} - -``` sql -SET param = value -``` - -割り当て `value` に `param` [設定](../../operations/settings/index.md) 現在のセッションの場合。 変更はできません [サーバー設定](../../operations/server_configuration_parameters/index.md) こっちだ - -また、指定した設定プロファイルのすべての値を単一のクエリで設定することもできます。 - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -詳細については、 [設定](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -表からすべてのデータを削除します。 ときに句 `IF EXISTS` テーブルが存在しない場合、クエリはエラーを返します。 - -その `TRUNCATE` queryはサポートされていません [ビュー](../../engines/table_engines/special/view.md), [ファイル](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) と [ヌル](../../engines/table_engines/special/null.md) テーブルエンジン。 - -## USE {#use} - -``` sql -USE db -``` - -セッションの現在のデータベースを設定できます。 -現在のデータベース検索用テーブルの場合はデータベースが明示的に定義されたクエリードの前にテーブルの名前です。 -このクエリできません利用の場合は、httpプロトコルが存在しない概念です。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/ja/sql_reference/statements/select.md b/docs/ja/sql_reference/statements/select.md deleted file mode 100644 index 7775b2f7cdc..00000000000 --- a/docs/ja/sql_reference/statements/select.md +++ /dev/null @@ -1,610 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 33 -toc_title: SELECT ---- - -# クエリ構文の選択 {#select-queries-syntax} - -`SELECT` データ検索を実行します。 - -``` sql -[WITH expr_list|(subquery)] -SELECT [DISTINCT] expr_list -[FROM [db.]table | (subquery) | table_function] [FINAL] -[SAMPLE sample_coeff] -[ARRAY JOIN ...] -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list -[PREWHERE expr] -[WHERE expr] -[GROUP BY expr_list] [WITH TOTALS] -[HAVING expr] -[ORDER BY expr_list] -[LIMIT [offset_value, ]n BY columns] -[LIMIT [n, ]m] -[UNION ALL ...] -[INTO OUTFILE filename] -[FORMAT format] -``` - -SELECT直後の必須の式リストを除き、すべての句はオプションです。 -以下の句は、クエリ実行コンベアとほぼ同じ順序で記述されています。 - -クエリが省略された場合、 `DISTINCT`, `GROUP BY` と `ORDER BY` 句および `IN` と `JOIN` サブクエリでは、クエリはO(1)量のRAMを使用して完全にストリーム処理されます。 -それ以外の場合、適切な制限が指定されていない場合、クエリは大量のramを消費する可能性があります: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. 詳細については、以下を参照してください “Settings”. 外部ソート(一時テーブルをディスクに保存する)と外部集約を使用することが可能です。 `The system does not have "merge join"`. - -### With句 {#with-clause} - -このセクション支援のための共通表現 ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL))、いくつかの制限があります: -1. 再帰的な問合せには対応していない -2. サブクエリがsection内で使用される場合、その結果は正確に一つの行を持つスカラーになります -3. 式の結果はサブクエリでは使用できません -WITH句の式の結果は、SELECT句の中で使用できます。 - -例1:定数式をasとして使用する “variable” - -``` sql -WITH '2019-08-01 15:23:00' as ts_upper_bound -SELECT * -FROM hits -WHERE - EventDate = toDate(ts_upper_bound) AND - EventTime <= ts_upper_bound -``` - -例2:select句の列リストからsum(bytes)式の結果を削除する - -``` sql -WITH sum(bytes) as s -SELECT - formatReadableSize(s), - table -FROM system.parts -GROUP BY table -ORDER BY s -``` - -例3:結果のスカラサブクエリ - -``` sql -/* this example would return TOP 10 of most huge tables */ -WITH - ( - SELECT sum(bytes) - FROM system.parts - WHERE active - ) AS total_disk_usage -SELECT - (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, - table -FROM system.parts -GROUP BY table -ORDER BY table_disk_usage DESC -LIMIT 10 -``` - -例4:サブクエリでの式の再利用 -サブクエリでの式の現在の使用制限の回避策として、複製することができます。 - -``` sql -WITH ['hello'] AS hello -SELECT - hello, - * -FROM -( - WITH ['hello'] AS hello - SELECT hello -) -``` - -``` text -┌─hello─────┬─hello─────┐ -│ ['hello'] │ ['hello'] │ -└───────────┴───────────┘ -``` - -### FROM句 {#select-from} - -FROM句が省略された場合、データは `system.one` テーブル。 -その `system.one` このテーブルは、他のDbmsで見つかったデュアルテーブルと同じ目的を果たします。 - -その `FROM` 句は、データを読み取るソースを指定します: - -- テーブル -- サブクエリ -- [テーブル機能](../table_functions/index.md) - -`ARRAY JOIN` そして、定期的に `JOIN` また、(下記参照)が含まれていてもよいです。 - -テーブルの代わりに、 `SELECT` サブクエリは、かっこで指定できます。 -標準sqlとは対照的に、サブクエリの後にシノニムを指定する必要はありません。 - -実行をクエリに対して、すべての列をクエリを取り出しに適します。 任意の列は不要のため、外部クエリはスローされ、サブクエリ. -クエリで列がリストされない場合(たとえば, `SELECT count() FROM t`)行の数を計算するために、いくつかの列がテーブルから抽出されます(最小の列が優先されます)。 - -#### 最終修飾子 {#select-from-final} - -が異なる場合は、それぞれの選定からデータをテーブルからの [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-エンジンファミリー以外 `GraphiteMergeTree`. とき `FINAL` 指定されている場合、ClickHouseは結果を返す前にデータを完全にマージするため、指定されたテーブルエンジンのマージ中に発生するすべてのデータ変換を実行し - -また、: -- [複製された](../../engines/table_engines/mergetree_family/replication.md) のバージョン `MergeTree` エンジン -- [ビュー](../../engines/table_engines/special/view.md), [バッファ](../../engines/table_engines/special/buffer.md), [分散](../../engines/table_engines/special/distributed.md)、と [MaterializedView](../../engines/table_engines/special/materializedview.md) 他のエンジンを操作するエンジンは、それらが上に作成された提供 `MergeTree`-エンジンテーブル。 - -使用するクエリ `FINAL` そうでない類似のクエリと同じくらい速く実行されません。: - -- クエリは単一のスレッドで実行され、クエリの実行中にデータがマージされます。 -- とのクエリ `FINAL` クエリで指定された列に加えて、主キー列を読み取ります。 - -ほとんどの場合、使用を避けます `FINAL`. - -### サンプル句 {#select-sample-clause} - -その `SAMPLE` 句は、近似クエリ処理を可能にします。 - -データサンプリングを有効にすると、すべてのデータに対してクエリは実行されず、特定のデータ(サンプル)に対してのみ実行されます。 たとえば、すべての訪問の統計を計算する必要がある場合は、すべての訪問の1/10分のクエリを実行し、その結果に10を掛けるだけで十分です。 - -近似クエリ処理は、次の場合に役立ちます: - -- 厳密なタイミング要件(\<100ms)がありますが、それらを満たすために追加のハードウェアリソースのコストを正当化できない場合。 -- 生データが正確でない場合、近似は品質を著しく低下させません。 -- ビジネス要件は、おおよその結果(費用対効果のため、または正確な結果をプレミアムユーザーに販売するため)を対象とします。 - -!!! note "メモ" - サンプリングを使用できるのは、次の表のみです [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) テーブル作成時にサンプリング式が指定された場合にのみ [MergeTreeエンジン](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table)). - -データサンプリングの機能を以下に示します: - -- データサンプリングは確定的なメカニズムです。 同じの結果 `SELECT .. SAMPLE` クエリは常に同じです。 -- サンプリン テーブルに単一のサンプリングキーは、サンプルと同じ係数を常に選択と同じサブセットのデータです。 たとえば、ユーザー idのサンプルでは、異なるテーブルのすべてのユーザー idのサブセットが同じ行になります。 これは、サブクエリでサンプルを使用できることを意味します [IN](#select-in-operators) 句。 また、以下を使用してサンプルを結合できます [JOIN](#select-join) 句。 -- サンプリングで読み下からのデータディスク。 サンプリングキーを正しく指定する必要があります。 詳細については、 [MergeTreeテーブルの作成](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -のための `SAMPLE` 句次の構文がサポートされています: - -| SAMPLE Clause Syntax | 説明 | -|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `SAMPLE k` | ここに `k` 0から1までの数値です。
クエリが実行される `k` データの割合。 例えば, `SAMPLE 0.1` データの10%に対してクエリを実行します。 [もっと読む](#select-sample-k) | -| `SAMPLE n` | ここに `n` は十分に大きい整数です。
クエリは、少なくとものサンプルで実行されます `n` 行(しかし、これ以上のものではない)。 例えば, `SAMPLE 10000000` 最小10,000,000行に対してクエリを実行します。 [もっと読む](#select-sample-n) | -| `SAMPLE k OFFSET m` | ここに `k` と `m` 0から1までの数字です。
クエリは次のサンプルで実行されます `k` データの割合。 に使用されるデータのサンプルと相殺することにより `m` 分数。 [もっと読む](#select-sample-offset) | - -#### SAMPLE K {#select-sample-k} - -ここに `k` は0から1までの数値です(小数表記と小数表記の両方がサポートされています)。 例えば, `SAMPLE 1/2` または `SAMPLE 0.5`. - -で `SAMPLE k` 句は、サンプルから取られます `k` データの割合。 例を以下に示します: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -この例では、0.1(10%)のデータのサンプルでクエリが実行されます。 集計関数の値は自動的には修正されないので、おおよその結果を得るには値 `count()` 手動で10倍します。 - -#### SAMPLE N {#select-sample-n} - -ここに `n` は十分に大きい整数です。 例えば, `SAMPLE 10000000`. - -この場合、クエリは少なくともサンプルで実行されます `n` 行(しかし、これ以上のものではない)。 例えば, `SAMPLE 10000000` 最小10,000,000行に対してクエリを実行します。 - -データ読み取りのための最小単位は一つの顆粒であるため(そのサイズは `index_granularity` それは、顆粒のサイズよりもはるかに大きいサンプルを設定することは理にかなっています。 - -を使用する場合 `SAMPLE n` 句、データの相対パーセントが処理されたかわからない。 したがって、集計関数に掛ける係数はわかりません。 を使用 `_sample_factor` おおよその結果を得るための仮想列。 - -その `_sample_factor` 列には、動的に計算される相対係数が含まれます。 この列は、次の場合に自動的に作成されます [作成](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table) 指定したサンプリングキーを持つテーブル。 の使用例 `_sample_factor` 列は以下の通りです。 - -テーブルを考えてみましょう `visits` これには、サイト訪問に関する統計情報が含まれます。 最初の例は、ページビューの数を計算する方法を示しています: - -``` sql -SELECT sum(PageViews * _sample_factor) -FROM visits -SAMPLE 10000000 -``` - -次の例では、訪問回数の合計を計算する方法を示します: - -``` sql -SELECT sum(_sample_factor) -FROM visits -SAMPLE 10000000 -``` - -以下の例は、平均セッション期間を計算する方法を示しています。 相対係数を使用して平均値を計算する必要はありません。 - -``` sql -SELECT avg(Duration) -FROM visits -SAMPLE 10000000 -``` - -#### SAMPLE K OFFSET M {#select-sample-offset} - -ここに `k` と `m` は0から1までの数字です。 例を以下に示す。 - -**例1** - -``` sql -SAMPLE 1/10 -``` - -この例では、サンプルはすべてのデータの1/10thです: - -`[++------------]` - -**例2** - -``` sql -SAMPLE 1/10 OFFSET 1/2 -``` - -ここでは、データの後半から10%のサンプルを採取します。 - -`[------++------]` - -### 配列結合句 {#select-array-join-clause} - -実行を許可する `JOIN` 配列または入れ子になったデータ構造。 その意図は、 [arrayJoin](../../sql_reference/functions/array_join.md#functions_arrayjoin) 機能が、その機能はより広いです。 - -``` sql -SELECT -FROM -[LEFT] ARRAY JOIN -[WHERE|PREWHERE ] -... -``` - -単一のみを指定できます `ARRAY JOIN` クエリ内の句。 - -実行時にクエリの実行順序が最適化されます `ARRAY JOIN`. が `ARRAY JOIN` の前に必ず指定する必要があります。 `WHERE/PREWHERE` のいずれかを実行することができます。 `WHERE/PREWHERE` (結果がこの節で必要な場合)、またはそれを完了した後(計算量を減らすため)。 処理順序はクエリオプティマイザによって制御されます。 - -サポートされる種類の `ARRAY JOIN` は以下の通りです: - -- `ARRAY JOIN` -この場合、空の配列は結果に含まれません `JOIN`. -- `LEFT ARRAY JOIN` -結果の `JOIN` 空の配列を含む行を含みます。 空の配列の値は、配列要素タイプのデフォルト値に設定されます(通常は0、空の文字列またはNULL)。 - -以下の例は、以下の使用例を示しています。 `ARRAY JOIN` と `LEFT ARRAY JOIN` 句。 テーブルを作成してみましょう [配列](../../sql_reference/data_types/array.md) 列を入力して値を挿入します: - -``` sql -CREATE TABLE arrays_test -( - s String, - arr Array(UInt8) -) ENGINE = Memory; - -INSERT INTO arrays_test -VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); -``` - -``` text -┌─s───────────┬─arr─────┐ -│ Hello │ [1,2] │ -│ World │ [3,4,5] │ -│ Goodbye │ [] │ -└─────────────┴─────────┘ -``` - -以下の例では、 `ARRAY JOIN` 句: - -``` sql -SELECT s, arr -FROM arrays_test -ARRAY JOIN arr; -``` - -``` text -┌─s─────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -└───────┴─────┘ -``` - -次の例では、 `LEFT ARRAY JOIN` 句: - -``` sql -SELECT s, arr -FROM arrays_test -LEFT ARRAY JOIN arr; -``` - -``` text -┌─s───────────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -│ Goodbye │ 0 │ -└─────────────┴─────┘ -``` - -#### エイリアスの使用 {#using-aliases} - -配列のエイリアスを指定することができます。 `ARRAY JOIN` 句。 この場合、配列項目はこのエイリアスでアクセスできますが、配列自体は元の名前でアクセスされます。 例えば: - -``` sql -SELECT s, arr, a -FROM arrays_test -ARRAY JOIN arr AS a; -``` - -``` text -┌─s─────┬─arr─────┬─a─┐ -│ Hello │ [1,2] │ 1 │ -│ Hello │ [1,2] │ 2 │ -│ World │ [3,4,5] │ 3 │ -│ World │ [3,4,5] │ 4 │ -│ World │ [3,4,5] │ 5 │ -└───────┴─────────┴───┘ -``` - -別名を使用すると、次の操作を実行できます `ARRAY JOIN` 外部配列を使用する。 例えば: - -``` sql -SELECT s, arr_external -FROM arrays_test -ARRAY JOIN [1, 2, 3] AS arr_external; -``` - -``` text -┌─s───────────┬─arr_external─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ Hello │ 3 │ -│ World │ 1 │ -│ World │ 2 │ -│ World │ 3 │ -│ Goodbye │ 1 │ -│ Goodbye │ 2 │ -│ Goodbye │ 3 │ -└─────────────┴──────────────┘ -``` - -複数の配列をコンマで区切ることができます。 `ARRAY JOIN` 句。 この場合, `JOIN` それらと同時に実行されます(直積ではなく、直積)。 すべての配列は同じサイズでなければなりません。 例えば: - -``` sql -SELECT s, arr, a, num, mapped -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ -│ Hello │ [1,2] │ 1 │ 1 │ 2 │ -│ Hello │ [1,2] │ 2 │ 2 │ 3 │ -│ World │ [3,4,5] │ 3 │ 1 │ 4 │ -│ World │ [3,4,5] │ 4 │ 2 │ 5 │ -│ World │ [3,4,5] │ 5 │ 3 │ 6 │ -└───────┴─────────┴───┴─────┴────────┘ -``` - -以下の例では、 [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) 機能: - -``` sql -SELECT s, arr, a, num, arrayEnumerate(arr) -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ -│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ -│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ -│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ -│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ -│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ -└───────┴─────────┴───┴─────┴─────────────────────┘ -``` - -#### 配列の参加入れ子データ構造 {#array-join-with-nested-data-structure} - -`ARRAY`また、"参加"で動作します [入れ子のデータ構造](../../sql_reference/data_types/nested_data_structures/nested.md). 例えば: - -``` sql -CREATE TABLE nested_test -( - s String, - nest Nested( - x UInt8, - y UInt32) -) ENGINE = Memory; - -INSERT INTO nested_test -VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); -``` - -``` text -┌─s───────┬─nest.x──┬─nest.y─────┐ -│ Hello │ [1,2] │ [10,20] │ -│ World │ [3,4,5] │ [30,40,50] │ -│ Goodbye │ [] │ [] │ -└─────────┴─────────┴────────────┘ -``` - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -ネストされたデータ構造の名前を指定する場合 `ARRAY JOIN`、意味は同じです `ARRAY JOIN` それが構成されているすべての配列要素。 例を以下に示します: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`, `nest.y`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -この変化はまた意味を成している: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─────┐ -│ Hello │ 1 │ [10,20] │ -│ Hello │ 2 │ [10,20] │ -│ World │ 3 │ [30,40,50] │ -│ World │ 4 │ [30,40,50] │ -│ World │ 5 │ [30,40,50] │ -└───────┴────────┴────────────┘ -``` - -エイリアスは、ネストされたデータ構造のために使用することができます。 `JOIN` 結果またはソース配列。 例えば: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest AS n; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ -└───────┴─────┴─────┴─────────┴────────────┘ -``` - -使用例 [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) 機能: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num -FROM nested_test -ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ -└───────┴─────┴─────┴─────────┴────────────┴─────┘ -``` - -### JOIN句 {#select-join} - -通常のデータを結合します [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) センス - -!!! info "メモ" - 関連しない [ARRAY JOIN](#select-array-join-clause). - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN -(ON )|(USING ) ... -``` - -テーブル名は次の代わりに指定できます `` と ``. これは、 `SELECT * FROM table` サブクエリは、テーブルが次のものを持つ特殊な場合を除きます。 [参加](../../engines/table_engines/special/join.md) engine – an array prepared for joining. - -#### サポートされる種類の `JOIN` {#select-join-types} - -- `INNER JOIN` (または `JOIN`) -- `LEFT JOIN` (または `LEFT OUTER JOIN`) -- `RIGHT JOIN` (または `RIGHT OUTER JOIN`) -- `FULL JOIN` (または `FULL OUTER JOIN`) -- `CROSS JOIN` (または `,` ) - -標準を参照してください [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) 説明。 - -#### 複数の結合 {#multiple-join} - -クエリを実行すると、clickhouseはマルチテーブル結合を二つのテーブル結合のシーケンスに書き換えます。 たとえば、clickhouseに参加するための四つのテーブルがある場合は、最初と二番目のテーブルを結合し、その結果を三番目のテーブルに結合し、最後のステップで - -クエリが含まれている場合、 `WHERE` 句、ClickHouseはこの句から中間結合を介してプッシュダウンフィルターを試行します。 各中間結合にフィルタを適用できない場合、ClickHouseはすべての結合が完了した後にフィルタを適用します。 - -私たちはお勧め `JOIN ON` または `JOIN USING` クエリを作成するための構文。 例えば: - -``` sql -SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a -``` - -テーブルのコンマ区切りリストを使用することができます `FROM` 句。 例えば: - -``` sql -SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a -``` - -これらの構文を混在させないでください。 - -ClickHouseはカンマで構文を直接サポートしていないので、使用することはお勧めしません。 このアルゴ `CROSS JOIN` と `INNER JOIN` クエリ処理に進みます。 クエリを書き換えるとき、ClickHouseはパフォーマンスとメモリ消費の最適化を試みます。 デフォルトでは、ClickHouseはコンマを `INNER JOIN` 句と変換 `INNER JOIN` に `CROSS JOIN` アルゴリズムが保証できない場合 `INNER JOIN` 必要なデータを返します。 - -#### 厳密さ {#select-join-strictness} - -- `ALL` — If the right table has several matching rows, ClickHouse creates a [デカルト積](https://en.wikipedia.org/wiki/Cartesian_product) 一致する行から。 これが標準です `JOIN` SQLでの動作。 -- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` と `ALL` キーワードは同じです。 -- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` 以下に使用方法を説明します。 - -**ASOF結合の使用** - -`ASOF JOIN` 完全一致のないレコードを結合する必要がある場合に便利です。 - -テーブルのため `ASOF JOIN` 順序列の列を持つ必要があります。 この列はテーブル内で単独で使用することはできません。: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`、と `DateTime`. - -構文 `ASOF JOIN ... ON`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF LEFT JOIN table_2 -ON equi_cond AND closest_match_cond -``` - -任意の数の等価条件と正確に最も近い一致条件を使用できます。 例えば, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. - -最も近い一致でサポートされる条件: `>`, `>=`, `<`, `<=`. - -構文 `ASOF JOIN ... USING`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF JOIN table_2 -USING (equi_column1, ... equi_columnN, asof_column) -``` - -`ASOF JOIN` 使用 `equi_columnX` 平等に参加するための `asof_column` との最も近い試合に参加するための `table_1.asof_column >= table_2.asof_column` 条件。 その `asof_column` 列は常に最後の列です `USING` 句。 - -たとえば、次の表を考えてみます: - -'テキスト -テーブル1テーブル2 - -イベント/ev\_time\|user\_idイベント/ev\_time\|user\_id diff --git a/docs/ja/sql_reference/statements/show.md b/docs/ja/sql_reference/statements/show.md deleted file mode 100644 index a3c564b3522..00000000000 --- a/docs/ja/sql_reference/statements/show.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 38 -toc_title: SHOW ---- - -# クエリを表示 {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -シングルを返します `String`-タイプ ‘statement’ column, which contains a single value – the `CREATE` 指定したオブジェク - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -一覧の全てのデータベースです。 -このクエリは次と同じです `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -の内容を出力します [システム。プロセス](../../operations/system_tables.md#system_tables-processes) 現在処理中のクエリのリストを含むテーブル。 `SHOW PROCESSLIST` クエリ。 - -その `SELECT * FROM system.processes` クエリを返しますデータに現在のすべてのクエリ. - -ヒント(コンソールで実行): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -テーブルのリストを表示します。 - -``` sql -SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -この `FROM` 句が指定されていない場合、クエリは現在のデータベースからテーブルの一覧を返します。 - -あなたは同じ結果を得ることができます `SHOW TABLES` 次の方法でクエリ: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**例えば** - -次のクエリは、テーブルのリストから最初の二つの行を選択します。 `system` 名前に含まれるデータベース `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -リストをの表示します [外部辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -この `FROM` 句が指定されていない場合、クエリは現在のデータベースから辞書のリストを返します。 - -あなたは同じ結果を得ることができます `SHOW DICTIONARIES` 次の方法でクエリ: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**例えば** - -次のクエリは、テーブルのリストから最初の二つの行を選択します。 `system` 名前に含まれるデータベース `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/ja/sql_reference/statements/system.md b/docs/ja/sql_reference/statements/system.md deleted file mode 100644 index a54514da2a3..00000000000 --- a/docs/ja/sql_reference/statements/system.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: SYSTEM ---- - -# システムクエリ {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -前に正常に読み込まれたすべての辞書を再読み込みします。 -デフォルトでは、辞書を取り込みの遅延を参照 [dictionaries\_lazy\_load](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load))、起動時に自動的にロードされるのではなく、dictGet関数を使用して最初のアクセス時に初期化されるか、ENGINE=Dictionaryテーブルから選択されます。 その `SYSTEM RELOAD DICTIONARIES` クエバなどの辞書(ロード). -常に戻る `Ok.` 辞書の更新の結果にかかわらず。 - -## 辞書dictionary\_nameを再読み込み {#query_language-system-reload-dictionary} - -辞書を完全に再読み込みする `dictionary_name` 辞書の状態にかかわらず(LOADED/NOT\_LOADED/FAILED)。 -常に戻る `Ok.` 辞書を更新した結果にかかわらず。 -ディクショナリのステータスは以下のクエリで確認できます。 `system.dictionaries` テーブル。 - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -ClickHouseの内部DNSキャッシュをリセットします。 場合によっては(古いClickHouseバージョンの場合)、インフラストラクチャを変更するとき(別のClickHouseサーバーのIPアドレスまたは辞書で使用されるサーバーを変更する - -より便利な(自動)キャッシュ管理については、"disable\_internal\_dns\_cache,dns\_cache\_update\_periodパラメータ"を参照してください。 - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -リセットをマークします。 clickhouseおよび性能試験の開発で使用される。 - -## FLUSH LOGS {#query_language-system-flush_logs} - -Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. - -## RELOAD CONFIG {#query_language-system-reload-config} - -ClickHouse構成を再読み込みします。 設定がZooKeeeperに格納されている場合に使用されます。 - -## SHUTDOWN {#query_language-system-shutdown} - -通常シャットダウンclickhouse(のような `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -異常終了しclickhouse工程など `kill -9 {$ pid_clickhouse-server}`) - -## 分散テーブルの管理 {#query-language-system-distributed} - -ClickHouse管理 [分散](../../engines/table_engines/special/distributed.md) テーブル。 ユーザーがこれらのテーブルにデータを挿入すると、ClickHouseはまずクラスターノードに送信するデータのキューを作成し、次に非同期に送信します。 キューの処理を管理することができます [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed)、と [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) クエリ。 また、分散データを同期的に挿入することもできます。 `insert_distributed_sync` 設定。 - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -を無効にした背景データの分布を挿入する際、データを配布します。 - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -クラスタノードにデータを同期送信するようにclickhouseを強制します。 ノードが使用できない場合、clickhouseは例外をスローし、クエリの実行を停止します。 これは、すべてのノードがオンラインに戻ったときに発生します。 - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -を背景データの分布を挿入する際、データを配布します。 - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -提供可能停止を背景に合併したテーブルのmergetree家族: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "メモ" - `DETACH / ATTACH` テーブルは、以前にすべてのMergeTreeテーブルのマージが停止された場合でも、テーブルのバックグラウンドマージを開始します。 - -### START MERGES {#query_language-system-start-merges} - -の提供が開始背景に合併したテーブルのmergetree家族: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[元の記事](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/ja/sql_reference/syntax.md b/docs/ja/sql_reference/syntax.md deleted file mode 100644 index a3706c2f855..00000000000 --- a/docs/ja/sql_reference/syntax.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 31 -toc_title: "\u69CB\u6587" ---- - -# 構文 {#syntax} - -システムには、完全なsqlパーサー(再帰的降下パーサー)とデータフォーマットパーサー(高速ストリームパーサー)の二種類のパーサーがあります。 -を除くすべての場合において `INSERT` クエリでは、完全なSQLパーサーのみが使用されます。 -その `INSERT` クエリの両方を使用のパーサ: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -その `INSERT INTO t VALUES` フラグメントは完全なパーサーとデータによって解析されます `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` 高速ストリームパーサーによって解析されます。 データの完全なパーサーをオンにするには、次のコマンドを使用します [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) 設定。 とき `input_format_values_interpret_expressions = 1`、ClickHouseは最初に高速ストリームパーサーで値を解析しようとします。 失敗した場合、ClickHouseはデータの完全なパーサーを使用し、SQLのように扱います [式](#syntax-expressions). - -データには任意の形式を使用できます。 クエリが受信されると、サーバーは以下を計算します [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) RAM内の要求のバイト(デフォルトでは1MB)、残りはストリーム解析されます。 -これはシステムに大きいの問題がないことを意味します `INSERT` MySQLのようなクエリ。 - -を使用する場合 `Values` フォーマット `INSERT` クエリは、データがaの式と同じように解析されるように見えるかもしれません `SELECT` クエリが、これは真実ではありません。 その `Values` 形式は、はるかに限られています。 - -次に、完全なパーサーをカバーします。 情報の形式のパーサは、 [形式](../interfaces/formats.md) セクション。 - -## スペース {#spaces} - -構文構成(クエリの開始と終了を含む)の間には、任意の数のスペースシンボルが存在する可能性があります。 スペースシンボルには、スペース、タブ、改行、cr、フォームフィードがあります。 - -## コメント {#comments} - -SQL形式およびC形式のコメントがサポートされています。 -SQLスタイルのコメント:from `--` ラインの終わりまで。 後のスペース `--` 省略可能です。 -Cスタイルのコメント:from `/*` に `*/`. これらのコメントは複数行にできます。 ここでもスペースは必要ありません。 - -## キーワード {#syntax-keywords} - -キーワードが対応する場合、大文字と小文字は区別されません: - -- SQL標準。 例えば, `SELECT`, `select` と `SeLeCt` すべて有効です。 -- いくつかの一般的なdbms(mysqlまたはpostgres)での実装。 例えば, `DateTime` は同じとして `datetime`. - -データ型名が大文字小文字を区別するかどうかをチェックできます。 `system.data_type_families` テーブル。 - -標準sqlとは対照的に、他のすべてのキーワード(関数名を含む)は **大文字と小文字を区別する**. - -キーワードはこの数は予約されていません(そうとして構文解析キーワードに対応するコンテキスト. 使用する場合 [識別子](#syntax-identifiers) キーワードと同じで、引用符で囲みます。 たとえば、クエリ `SELECT "FROM" FROM table_name` テーブルの場合は有効です。 `table_name` 名前の列があります `"FROM"`. - -## 識別子 {#syntax-identifiers} - -識別子は: - -- クラスターデータベース、テーブル、パーティションおよびカラム名になってしまいます -- 機能。 -- データ型。 -- [式の別名](#syntax-expression_aliases). - -識別子は、引用符または非引用することができます。 非引用符付き識別子を使用することをお勧めします。 - -非引用識別子に一致しなければならなregex `^[a-zA-Z_][0-9a-zA-Z_]*$` とに等しくすることはできません [キーワード](#syntax-keywords). 例: `x, _1, X_y__Z123_.` - -キーワードと同じ識別子を使用する場合、または識別子に他の記号を使用する場合は、二重引用符またはバッククォートを使用して引用符を引用します。, `"id"`, `` `id` ``. - -## リテラル {#literals} - -以下があります:数値、文字列、複合および `NULL` リテラル - -### 数値 {#numeric} - -数値リテラルは解析を試みます: - -- 最初に64ビットの符号付き数値として、 [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) 機能。 -- 失敗した場合、64ビット符号なしの数値として、 [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) 機能。 -- 失敗した場合は、浮動小数点数として [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) 機能。 -- それ以外の場合は、エラーが返されます。 - -対応する値は、値が収まる最小の型を持ちます。 -たとえば、1は次のように解析されます `UInt8` しかし、256は次のように解析されます `UInt16`. 詳細については、 [データ型](../sql_reference/data_types/index.md). - -例: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### 文字列 {#syntax-string-literal} - -単一引quotesの文字列リテラルのみがサポートされます。 囲まれた文字はバックスラッシュでエスケープできます。 以下のエスケープシーケンスに対応する特殊な値: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. 他のすべての場合において、エスケープシーケンスの形式 `\c`、どこ `c` は任意の文字です。 `c`. つまり、次のシーケンスを使用できます `\'`と`\\`. この値は、 [文字列](../sql_reference/data_types/string.md) タイプ。 - -文字列リテラルでエスケープする必要がある文字の最小セット: `'` と `\`. 単一引quoteは、単一引quoteでエスケープすることができます。 `'It\'s'` と `'It''s'` 等しい。 - -### 化合物 {#compound} - -配列では構文がサポートされます: `[1, 2, 3]` とタプル: `(1, 'Hello, world!', 2)`.. -実際には、これらはリテラルではなく、配列作成演算子とタプル作成演算子を持つ式です。 -配列によって構成された少なくとも一つの項目には、タプル以上あることが必要です。石二鳥の優れものだ。 -タプルに使用のための特別な目的があります `IN` aの句 `SELECT` クエリ。 タプルはクエリの結果として取得できますが、データベースに保存することはできません(ただし、 [メモリ](../engines/table_engines/special/memory.md) テーブル)。 - -### NULL {#null-literal} - -値が欠落していることを示します。 - -を格納するために `NULL` テーブルフィールドでは、テーブルフィールド [Nullable](../sql_reference/data_types/nullable.md) タイプ。 - -データ形式(入力または出力)に応じて), `NULL` 異なる表現を持つことがあります。 詳細については、以下の文書を参照してください [データ形式](../interfaces/formats.md#formats). - -処理には多くの微妙な違いがあります `NULL`. たとえば、比較操作の引数のうちの少なくとも一つが `NULL` この操作の結果も次のようになります `NULL`. 乗算、加算、およびその他の演算についても同様です。 詳細については、各操作のドキュメントを参照してください。 - -クエリでは、以下を確認できます `NULL` を使用して [IS NULL](operators.md#operator-is-null) と [IS NOT NULL](operators.md) 演算子と関連する関数 `isNull` と `isNotNull`. - -## 機能 {#functions} - -関数は、括弧内の引数のリスト(おそらく空)を持つ識別子のように書かれています。 標準sqlとは対照的に、空の引数リストであっても括弧が必要です。 例えば: `now()`. -通常の関数と集計関数があります(セクションを参照 “Aggregate functions”). 一部の集計関数を含むことができ二つのリストの引数ットに固定して使用します。 例えば: `quantile (0.9) (x)`. これらの集計関数が呼び出される “parametric” 関数と最初のリストの引数が呼び出されます “parameters”. パラメータを指定しない集計関数の構文は、通常の関数と同じです。 - -## 演算子 {#operators} - -演算子は、優先度と結合性を考慮して、クエリの解析中に対応する関数に変換されます。 -たとえば、次の式 `1 + 2 * 3 + 4` に変換される。 `plus(plus(1, multiply(2, 3)), 4)`. - -## データ型とデータベ {#data_types-and-database-table-engines} - -のデータ型とテーブルエンジン `CREATE` クエリは、識別子または関数と同じ方法で記述されます。 言い換えれば、それらは括弧内に引数リストを含んでいてもいなくてもよい。 詳細については、以下を参照してください “Data types,” “Table engines,” と “CREATE”. - -## 式の別名 {#syntax-expression_aliases} - -別名は、クエリ内の式のユーザー定義名です。 - -``` sql -expr AS alias -``` - -- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` 使用しない句 `AS` キーワード。 - - For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. - -- `expr` — Any expression supported by ClickHouse. - - For example, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — Name for `expr`. エイリアスはに従うべきです [識別子](#syntax-identifiers) 構文。 - - For example, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### 使用上の注意 {#notes-on-usage} - -エイリアスは、クエリまたはサブクエリのグローバルであり、任意の式のクエリの任意の部分にエイリアスを定義できます。 例えば, `SELECT (1 AS n) + 2, n`. - -エイリアスは、サブクエリやサブクエリ間では表示されません。 たとえば、クエリの実行中などです `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouseは例外を生成します `Unknown identifier: num`. - -結果列に別名が定義されている場合 `SELECT` サブクエリの句は、これらの列は、外側のクエリで表示されます。 例えば, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -列名またはテーブル名と同じ別名には注意してください。 次の例を考えてみましょう: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -この例では、テーブルを宣言しました `t` コラムを使って `b`. 次に、データを選択するときに、 `sum(b) AS b` エイリアス としてエイリアスは、グローバルClickHouse置換されているリテラル `b` 式の中で `argMax(a, b)` 式を使って `sum(b)`. この置換によって例外が発生しました。 - -## アスタリスク {#asterisk} - -で `SELECT` クエリー、アスタリスクで置き換え異なるアイコンで表示されます。 詳細については、以下を参照してください “SELECT”. - -## 式 {#syntax-expressions} - -式は、関数、識別子、リテラル、演算子の適用、角かっこ内の式、サブクエリ、またはアスタリスクです。 別名を含めることもできます。 -式のリストは、コンマで区切られた式です。 -関数と演算子は、次に、引数として式を持つことができます。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/ja/sql_reference/table_functions/file.md b/docs/ja/sql_reference/table_functions/file.md deleted file mode 100644 index 69b3f7199e7..00000000000 --- a/docs/ja/sql_reference/table_functions/file.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 37 -toc_title: "\u30D5\u30A1\u30A4\u30EB" ---- - -# ファイル {#file} - -ファイルからテーブルを作成します。 この表関数は次のようになります [url](url.md) と [hdfs](hdfs.md) もの。 - -``` sql -file(path, format, structure) -``` - -**入力パラメータ** - -- `path` — The relative path to the file from [user\_files\_path](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-user_files_path). 読み取り専用モードのglobsに続くファイルサポートのパス: `*`, `?`, `{abc,def}` と `{N..M}` どこに `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [書式](../../interfaces/formats.md#formats) ファイルの -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**戻り値** - -指定したファイルにデータを読み書きするための、指定した構造体を持つテーブル。 - -**例えば** - -設定 `user_files_path` そして、ファイルの内容 `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -テーブルから`test.csv` そしてそれからの最初の二つの行の選択: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -``` sql --- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file -SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 -``` - -**パス内のグロブ** - -複数のパスコンポーネン 処理されるためには、ファイルが存在し、パスパターン全体(接尾辞や接頭辞だけでなく)に一致する必要があります。 - -- `*` — Substitutes any number of any characters except `/` 空の文字列を含む。 -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -構造との `{}` に類似していて下さい [遠隔テーブル機能](../../sql_reference/table_functions/remote.md)). - -**例えば** - -1. 次の相対パスを持つ複数のファイルがあるとします: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. これらのファイルの行数を照会します: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. クエリの量の行のすべてのファイルのディレクトリ: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "警告" - ファイルのリストに先行するゼロを持つ数値範囲が含まれている場合は、各桁のために中かっこで囲みます。 `?`. - -**例えば** - -クエリからのデータファイル名 `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## 仮想列 {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**また見なさい** - -- [仮想列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/ja/sql_reference/table_functions/hdfs.md b/docs/ja/sql_reference/table_functions/hdfs.md deleted file mode 100644 index 17726208584..00000000000 --- a/docs/ja/sql_reference/table_functions/hdfs.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 45 -toc_title: hdfs ---- - -# hdfs {#hdfs} - -HDFSのファイルからテーブルを作成します。 この表関数は次のようになります [url](url.md) と [ファイル](file.md) もの。 - -``` sql -hdfs(URI, format, structure) -``` - -**入力パラメータ** - -- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` と `{N..M}` どこに `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [書式](../../interfaces/formats.md#formats) ファイルの -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**戻り値** - -指定したファイルにデータを読み書きするための、指定した構造体を持つテーブル。 - -**例えば** - -テーブルから `hdfs://hdfs1:9000/test` そしてそれからの最初の二つの行の選択: - -``` sql -SELECT * -FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -**パス内のグロブ** - -複数のパスコンポーネン 処理されるためには、ファイルが存在し、パスパターン全体(接尾辞や接頭辞だけでなく)に一致する必要があります。 - -- `*` — Substitutes any number of any characters except `/` 空の文字列を含む。 -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -構造との `{}` に類似していて下さい [遠隔テーブル機能](../../sql_reference/table_functions/remote.md)). - -**例えば** - -1. HDFS上に次のUriを持ついくつかのファイルがあるとします: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. これらのファイルの行数を照会します: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. これら二つのディレ: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "警告" - ファイルのリストに先行するゼロを持つ数値範囲が含まれている場合は、各桁のために中かっこで囲みます。 `?`. - -**例えば** - -クエリからのデータファイル名 `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## 仮想列 {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**また見なさい** - -- [仮想列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/ja/sql_reference/table_functions/index.md b/docs/ja/sql_reference/table_functions/index.md deleted file mode 100644 index 508317ffa90..00000000000 --- a/docs/ja/sql_reference/table_functions/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Table Functions -toc_priority: 34 -toc_title: "\u5C0E\u5165" ---- - -# テーブル関数 {#table-functions} - -テーブル機能の方法を構築します。 - -テーブル関数は次の場所で使用できます: - -- [FROM](../statements/select.md#select-from) の句 `SELECT` クエリ。 - - The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. - -- [テーブルを\として作成](../statements/create.md#create-table-query) クエリ。 - - It's one of the methods of creating a table. - -!!! warning "警告" - テーブル関数を使用することはできません。 [allow\_ddl](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) 設定は無効です。 - -| 機能 | 説明 | -|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------| -| [ファイル](file.md) | を作成します。 [ファイル](../../engines/table_engines/special/file.md)-エンジンのテーブル。 | -| [マージ](merge.md) | を作成します。 [マージ](../../engines/table_engines/special/merge.md)-エンジンのテーブル。 | -| [数字](numbers.md) | 単一の列が整数で埋められたテーブルを作成します。 | -| [リモート](remote.md) | へ自由にアクセスできるリモートサーバーを作成することなく [分散](../../engines/table_engines/special/distributed.md)-エンジンのテーブル。 | -| [url](url.md) | を作成します。 [Url](../../engines/table_engines/special/url.md)-エンジンのテーブル。 | -| [mysql](mysql.md) | を作成します。 [MySQL](../../engines/table_engines/integrations/mysql.md)-エンジンのテーブル。 | -| [jdbc](jdbc.md) | を作成します。 [JDBC](../../engines/table_engines/integrations/jdbc.md)-エンジンのテーブル。 | -| [odbc](odbc.md) | を作成します。 [ODBC](../../engines/table_engines/integrations/odbc.md)-エンジンのテーブル。 | -| [hdfs](hdfs.md) | を作成します。 [HDFS](../../engines/table_engines/integrations/hdfs.md)-エンジンのテーブル。 | - -[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/ja/sql_reference/table_functions/mysql.md b/docs/ja/sql_reference/table_functions/mysql.md deleted file mode 100644 index 2b64b9a1a17..00000000000 --- a/docs/ja/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 42 -toc_title: mysql ---- - -# mysql {#mysql} - -許可 `SELECT` リモートMySQLサーバーに格納されているデータに対して実行されるクエリ。 - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**パラメータ** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` へのクエリ `REPLACE INTO`. もし `replace_query=1`、クエリが置き換えられます。 - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` に追加される式 `INSERT` クエリ。 - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -シンプル `WHERE` 次のような句 `=, !=, >, >=, <, <=` 現在、MySQLサーバで実行されています。 - -残りの条件と `LIMIT` サンプリング制約は、MySQLへのクエリが終了した後にのみClickHouseで実行されます。 - -**戻り値** - -元のmysqlテーブルと同じカラムを持つテーブルオブジェクト。 - -## 使用例 {#usage-example} - -MySQLのテーブル: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ClickHouseからのデータの選択: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## また見なさい {#see-also} - -- [その ‘MySQL’ 表エンジン](../../engines/table_engines/integrations/mysql.md) -- [MySQLを外部辞書のソースとして使用する](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/ja/sql_reference/table_functions/odbc.md b/docs/ja/sql_reference/table_functions/odbc.md deleted file mode 100644 index be43586454c..00000000000 --- a/docs/ja/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 44 -toc_title: odbc ---- - -# odbc {#table-functions-odbc} - -接続されたテーブルを返します。 [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -パラメータ: - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` ファイル。 -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -ODBC接続を安全に実装するには、ClickHouseは別のプログラムを使用します `clickhouse-odbc-bridge`. ODBCドライバーが直接読み込まれている場合 `clickhouse-server` ドライバの問題でクラッシュのClickHouseサーバーです。 クリックハウスが自動的に起動 `clickhouse-odbc-bridge` それが必要なとき。 ODBCブリッジプログラムは、次のパッケージと同じパッケー `clickhouse-server`. - -のフィールド `NULL` 外部テーブルの値は、基本データ型のデフォルト値に変換されます。 例えば、リモートMySQLテーブル分野の `INT NULL` タイプは0に変換されます(ClickHouseのデフォルト値 `Int32` データ型)。 - -## 使用例 {#usage-example} - -**PpsはインタラクティブのMySQLのインストール目盛** - -この例は、ubuntu linux18.04およびmysql server5.7で確認されています。 - -UnixODBCとMySQL Connectorがインストールされていることを確認します。 - -デフォルトでインストールされた場合、パッケージから),clickhouse開始してユーザー `clickhouse`. したがって、MySQLサーバでこのユーザを作成して設定する必要があります。 - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -次に、接続を設定します `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -チェックでき、接続を使用 `isql` unixODBCインストールからのユーティリティ。 - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -MySQLのテーブル: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ClickHouseのMySQLテーブルからデータを取得する: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## また見なさい {#see-also} - -- [ODBC外部辞書](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBCテーブルエンジン](../../engines/table_engines/integrations/odbc.md). - -[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/ja/sql_reference/table_functions/remote.md b/docs/ja/sql_reference/table_functions/remote.md deleted file mode 100644 index 82ccc31d80a..00000000000 --- a/docs/ja/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 40 -toc_title: "\u30EA\u30E2\u30FC\u30C8" ---- - -# リモート,remoteSecure {#remote-remotesecure} - -へ自由にアクセスできるリモートサーバーを作成することなく `Distributed` テーブル。 - -署名: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port`、またはちょうど `host`. ホストは、サーバー名またはIPv4またはIPv6アドレスとして指定できます。 IPv6アドレスは角かっこで指定します。 ポートは、リモートサーバー上のTCPポートです。 ポートが省略された場合は、以下を使用します `tcp_port` サーバの設定ファイルから(デフォルトでは9000) - -!!! important "重要" - このポートはipv6アドレスに必要です。 - -例: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -複数のアドレスをコンマ区切りにできます。 この場合、clickhouseは分散処理を使用するため、指定されたすべてのアドレス(異なるデータを持つシャードなど)にクエリを送信します。 - -例えば: - -``` text -example01-01-1,example01-02-1 -``` - -式の一部は、中括弧で指定できます。 前の例は次のように書くことができます: - -``` text -example01-0{1,2}-1 -``` - -中括弧は、二つのドット(負でない整数)で区切られた数の範囲を含めることができます。 この場合、範囲はシャードアドレスを生成する値のセットに拡張されます。 最初の数値がゼロから始まる場合、値は同じゼロ整列で形成されます。 前の例は次のように書くことができます: - -``` text -example01-{01..02}-1 -``` - -中括弧の複数のペアがある場合は、対応するセットの直接積が生成されます。 - -中括弧の中のアドレスとアドレスの一部は、パイプ記号(\|)で区切ることができます。 この場合、対応するアドレスのセットはレプリカとして解釈され、クエリは最初の正常なレプリカに送信されます。 ただし、レプリカは、現在設定されている順序で反復されます。 [load\_balancing](../../operations/settings/settings.md) 設定。 - -例えば: - -``` text -example01-{01..02}-{1|2} -``` - -この例では、指定さつする資料をそれぞれ二つのレプリカ. - -生成されるアドレスの数は定数によって制限されます。 今これは1000アドレスです。 - -を使用して `remote` テーブル関数が作成するよりも最適ではない `Distributed` この場合、サーバー接続はすべての要求に対して再確立されるためです。 さらに、ホスト名が設定されている場合、名前は解決され、さまざまなレプリカを操作するときにエラーはカウントされません。 多数のクエリを処理する場合は、常に `Distributed` テーブルは時間に先んじて、使用しないし `remote` テーブル機能。 - -その `remote` テーブル関数は、次の場合に便利です: - -- アクセスの特定のサーバーのためのデータとの比較、デバッグ、テスト実施をしておりました。 -- 研究目的のための様々なclickhouseクラスタ間のクエリ。 -- 手動で行われる頻度の低い分散要求。 -- サーバーのセットが毎回再定義される分散要求。 - -ユーザーが指定されていない場合, `default` 使用される。 -パスワードを指定しない場合は、空のパスワードが使用されます。 - -`remoteSecure` -と同じ `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) 設定または9440から。 - -[元の記事](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/ja/whats-new/changelog/2017.md b/docs/ja/whats-new/changelog/2017.md new file mode 100644 index 00000000000..d1a444bd69e --- /dev/null +++ b/docs/ja/whats-new/changelog/2017.md @@ -0,0 +1,268 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 79 +toc_title: '2017' +--- + +### ClickHouseリリース1.1.54327、2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} + +このリリ: + +- 固定バグでレースの条件で接続文字列の構文は以下のようにこのデータが失われます。 この問題はバージョン1.1.54310および1.1.54318に影響します。 ご利用の場合これらのバージョンとの複製のテーブルを更新することが強く推奨されます。 この問題にログ警告メッセージのように `Part ... from own log doesn't exist.` この問題は、これらのメッセージがログに表示されない場合でも関連します。 + +### ClickHouseリリース1.1.54318、2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} + +このリリ: + +- SummingMergeTreeエンジンのマージ中に誤った行の削除が行われていた問題を修正しました +- 複雑でないmergetreeエンジンのメモリリークを修正しました +- MergeTreeエンジンで頻繁に挿入されるパフォーマンスの低下を修正 +- レプリケーションキューの実行を停止する問題を修正しました +- サーバーログの固定回転とアーカイブ + +### ClickHouseリリース1.1.54310、2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} + +#### 新しい機能: {#new-features} + +- カスタムパーティショニングキーのmergetree家族のテーブルエンジンです。 +- [カフカname](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) テーブルエンジン。 +- 読み込みのサポートを追加 [CatBoost](https://catboost.yandex/) モデルとそれらをClickHouseに格納されたデータに適用する。 +- UTCから非整数オフセットのタイムゾーンのサポートが追加されました。 +- 時間間隔による算術演算のサポートが追加されました。 +- Date型とDateTime型の値の範囲は、2105年に拡張されます。 +- を追加しました `CREATE MATERIALIZED VIEW x TO y` query(マテリアライズドビューのデータを格納するための既存のテーブルを指定します)。 +- を追加しました `ATTACH TABLE` 引数なしのクエリ。 +- SummingMergeTreeテーブルのマップで終わる名前を持つ入れ子になった列の処理ロジックが、sumMap集計関数に抽出されました。 これで、このような列を明示的に指定できます。 +- IP trie辞書の最大サイズは128Mのエントリに増加します。 +- GetSizeOfEnumType関数を追加しました。 +- SumWithOverflow集計関数を追加しました。 +- Cap’n Proto入力形式のサポートが追加されました。 +- では、今までのカスタマイズの圧縮レベル使用時のzstdアルゴリズムです。 + +#### 下位互換性のない変更: {#backward-incompatible-changes} + +- メモリ以外のエンジンを使用して一時テーブルを作成することはできません。 +- ビューまたはmaterializedviewエンジンでテーブルを明示的に作成することはできません。 +- 中表を作成し、新しいチェックを確認し、サンプリングキー表現が含まれ、その有効なタイプを利用します。 + +#### バグ修正: {#bug-fixes} + +- 分散テーブルに同期的に挿入するときのハングアップを修正しました。 +- レプリケートされたテーブル内の部品の追加と削除を修正しました。 +- マテリアライズドビューに挿入されたデータは、不要な重複排除を受けません。 +- ローカルレプリカが遅延し、リモートレプリカが使用できない分散テーブルへのクエリを実行しても、エラーは発生しません。 +- ユーザーにはアクセス許可は必要ありません。 `default` 一時テーブルを作成するデータベース。 +- 固定チを指定する場合は、配列型な論争することができます。 +- 固定hangups時のディスク容量を含むサーバのログします。 +- Unixエポックの最初の週のtoRelativeWeekNum関数のオーバーフローを修正しました。 + +#### ビルドの改善: {#build-improvements} + +- いくつかのサードパーティのライブラリ(特にpoco)が更新され、git submodulesに変換されました。 + +### ClickHouseリリース1.1.54304,2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} + +#### 新しい機能: {#new-features-1} + +- ネイティブプロトコルでのtlsサポート(有効にするには、 `tcp_ssl_port` で `config.xml` ). + +#### バグ修正: {#bug-fixes-1} + +- `ALTER` のための複製のテーブル現しようと走り出しています。 +- 固定波データを読み込むときに設定 `preferred_block_size_bytes=0.` +- の固定クラッシュ `clickhouse-client` 押すとき `Page Down` +- 特定の複雑なクエリの正しい解釈 `GLOBAL IN` と `UNION ALL` +- `FREEZE PARTITION` 常に今原子的に動作します。 +- 空のpost要求は、コード411で応答を返すようになりました。 +- のような式のための固定解釈エラー `CAST(1 AS Nullable(UInt8)).` +- 読み込み時のエラーを修正 `Array(Nullable(String))` からの列 `MergeTree` テーブル。 +- 固定表の構文解析時にクエリのように `SELECT dummy AS dummy, dummy AS b` +- ユーザーは無効で正しく更新されます `users.xml` +- 実行可能ディクショナリがゼロ以外の応答コードを返す場合の正しい処理。 + +### ClickHouseリリース1.1.54292、2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} + +#### 新しい機能: {#new-features-2} + +- を追加しました `pointInPolygon` 座標平面上の座標を操作するための関数。 +- を追加しました `sumMap` 次のような配列の合計を計算するための集約関数 `SummingMergeTree`. +- を追加しました `trunc` 機能。 丸め関数のパフォーマンスの向上 (`round`, `floor`, `ceil`, `roundToExp2` を正の論理をどのように。 のロジックを変更 `roundToExp2` 分数と負の数の関数。 +- ClickHouseの実行可能ファイルはlibcのバージョンにあまり依存しません。 同じClickHouseの実行可能ファイルは、Linuxシステムの多種多様で実行することができます。 コンパイルされたクエリを使用するときにはまだ依存関係があります(設定 `compile = 1` デフォルトでは使用されません)。 +- クエリの動的コンパイルに要する時間を短縮しました。 + +#### バグ修正: {#bug-fixes-2} + +- 時々生成エラーを修正しました `part ... intersects previous part` メッセージとレプリカの一貫性の低下。 +- 固定エラーの原因となったサーバをロックした場合飼育係できなかった時のシャットダウンしました。 +- レプリカの復元時に過剰なログを削除。 +- ユニオンすべての実装でエラーを修正しました。 +- ブロック内の最初の列に配列型がある場合に発生したconcat関数のエラーを修正しました。 +- の進捗を正しく表示されます。テーブルをマージする。 + +### ClickHouseリリース1.1.54289、2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} + +#### 新しい機能: {#new-features-3} + +- `SYSTEM` サーバ管理のクエリ: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. +- 配列を操作するための関数を追加: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. +- 追加 `root` と `identity` ZooKeeper設定のパラメーターです。 これにより、同じZooKeeperクラスター上の個々のユーザーを分離できます。 +- 集計関数の追加 `groupBitAnd`, `groupBitOr`、と `groupBitXor` (互換性のために、それらは名前の下にも利用可能です `BIT_AND`, `BIT_OR`、と `BIT_XOR`). +- 外部の辞書からロード可能でmysqlを指定するソケットのファイルシステム. +- 外部辞書はmysqlからssl経由でロードできます (`ssl_cert`, `ssl_key`, `ssl_ca` パラメータ)。 +- を追加しました `max_network_bandwidth_for_user` ユーザーごとのクエリの全体的な帯域幅の使用を制限する設定。 +- のサポート `DROP TABLE` 一時テーブルの場合。 +- 読書のためのサポート `DateTime` Unixのタイムスタンプ形式の値 `CSV` と `JSONEachRow` フォーマット。 +- 分散クエリの遅延レプリカは、既定で除外されるようになりました(既定のしきい値は5分)。 +- 継続的に実行されるクエリでは、alterクエリが無期限にブロックされることはありません。 +- 設定するオプション `umask` 設定ファイルで。 +- クエリのパフォーマンスの向上 `DISTINCT` . + +#### バグ修正: {#bug-fixes-3} + +- ZooKeeperの古いノードを削除するプロセスを改善しました。 以前は、非常に頻繁な挿入があった場合、古いノードが削除されなかったことがあり、サーバーのシャットダウンが遅くなっていました。 +- ZooKeeperへの接続のためのホストを選択する際に固定ランダム化。 +- レプリカがlocalhostの場合、分散クエリでの遅延レプリカの除外を修正しました。 +- Aのデータ部分エラーを修正しました `ReplicatedMergeTree` テーブ `ALTER MODIFY` aの要素に `Nested` 構造。 +- 選択クエリの原因となるエラーを修正しました “hang”. +- 分散ddlクエリの改善。 +- クエリを修正 `CREATE TABLE ... AS `. +- でデッドロックを解決しました `ALTER ... CLEAR COLUMN IN PARTITION` のためのクエリ `Buffer` テーブル。 +- の無効なデフォルト値を修正しました `Enum` s(最小値の代わりに0)を使用する場合、 `JSONEachRow` と `TSKV` フォーマット。 +- 解決の姿ゾンビプロセスが辞書を使いながら、 `executable` ソース。 +- ヘッドクエリのための固定segfault。 + +#### 改善ワークフローの開発と組み立てclickhouse: {#improved-workflow-for-developing-and-assembling-clickhouse} + +- を使用することができ `pbuilder` ClickHouseを構築する。 +- を使用することができ `libc++` 代わりに `libstdc++` Linux上のビルドの場合。 +- 静的コード分析ツールを使用するための手順を追加: `Coverage`, `clang-tidy`, `cppcheck`. + +#### ご注意ください: {#please-note-when-upgrading} + +- これで、mergetree設定のデフォルト値が大きくなりました `max_bytes_to_merge_at_max_space_in_pool` (マージするデータ部分の最大合計サイズ(バイト単位)):100GiBから150GiBに増加しました。 この結果、大型の合併-走行後のサーバグの原因になりの増加に負荷をディスクサブシステムです。 サーバー上で利用可能な空き領域が、実行中のマージの合計量の倍未満である場合、小さなデータ部分のマージを含め、他のすべてのマージが実行を停止します。 その結果、INSERTクエリはメッセージで失敗します “Merges are processing significantly slower than inserts.” を使用 `SELECT * FROM system.merges` 状況を監視するためのクエリ。 また点検できます `DiskSpaceReservedForMerge` のメトリック `system.metrics` テーブル、またはグラファイト。 大きなマージが完了すると問題は解決するので、これを修正するために何もする必要はありません。 これが受け入れられない場合は、以前の値を復元することができます `max_bytes_to_merge_at_max_space_in_pool` 設定。 これを行うには、 設定のセクション。xml、セット ``` ``107374182400 ``` サーバーを再起動します。 + +### ClickHouseリリース1.1.54284,2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} + +- これは以前の1.1.54282リリースのバグ修正リリースです。 それはzookeeperの部品ディレクトリに漏れを修正します。 + +### ClickHouseリリース1.1.54282、2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} + +このリリ: + +- 固定 `DB::Exception: Assertion violation: !_path.empty()` 分散テーブルに挿入するとき。 +- 入力データが’;’で始まる場合、rowbinary形式で挿入時の解析を修正しました。 +- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). + +### Clickhouseリリース1.1.54276,2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} + +#### 新しい機能: {#new-features-4} + +- 選択クエリのセクションでオプションを追加しました。 クエリ例: `WITH 1+1 AS a SELECT a, a*a` +- すべてのデータがすべてのシャードに保存された後にのみ、okが返されます。 これは、insert\_distributed\_sync=1の設定によって有効になります。 +- 16バイトの識別子を扱うためのuuidデータ型を追加しました。 +- タブローとの互換性のためにchar、floatおよび他のタイプのエイリアスを追加しました。 +- 時間を数値に変換する関数toyyyyymm、toyyyymmdd、およびtoyyyymmddhhmmssを追加しました。 +- IPアドレス(ホスト名と共に)を使用して、クラスタ化されたDDLクエリのサーバーを識別できます。 +- 関数内の非定数引数と負のオフセットのサポートが追加されました `substring(str, pos, len).` +- のmax\_sizeパラメーターを追加しました。 `groupArray(max_size)(column)` 集約関数、およびその性能を最適化しました。 + +#### 主な変更点: {#main-changes} + +- セキュリティの改善:すべてのサーバーファイルは0640権限で作成されます(変更できます 設定パラメータ)。 +- 無効な構文のクエリの改善されたエラーメッセージ。 +- 低メモリ消費をとした場合の性能改善の統合大分mergetreeデータです。 +- ReplacingMergeTreeエンジンのデータマージのパフォーマンスが大幅に向上しました。 +- 性能向上のための非同期に挿入しますから分散型のテーブルを組み合わせで複数のソースしました。 この機能を有効にするには、distributed\_directory\_monitor\_batch\_inserts=1という設定を使用します。 + +#### 下位互換性のない変更: {#backward-incompatible-changes-1} + +- の集約状態のバイナリ形式を変更しました `groupArray(array_column)` 配列の関数。 + +#### 変更の完全なリスト: {#complete-list-of-changes} + +- を追加しました `output_format_json_quote_denormals` これにより、nanとinfの値をJSON形式で出力することができます。 +- 最適化したストリーム配置の場合を読み込んで配布します。 +- 値が変更されない場合は、readonlyモードで設定を行うことができます。 +- Preferred\_block\_size\_bytes設定で指定されたブロックサイズの制限を満たすために、MergeTreeエンジンの非整数granules粒を取得する機能を追加しました。 のための消費量を削減RAMを増やキャッシュの地域が処理クエリーテーブルの大きい。 +- 次のような式を含むインデックスの効率的な使用 `toStartOfHour(x)` のような条件の場合 `toStartOfHour(x) op сonstexpr.` +- MergeTreeエンジンの新しい設定(configのmerge\_treeセクション)を追加しました。xml): + - replicated\_deduplication\_window\_secondsは、レプリケートされたテーブルの挿入の重複除外に使用できる秒数を設定します。 + - cleanup\_delay\_periodは、古いデータを削除するためにクリーンアップを開始する頻度を設定します。 + - replicated\_can\_become\_leaderでは、レプリカがリーダーにならないようにすることができます(マージの割り当て)。 +- 加速の清掃除時代遅れからのデータの飼育係. +- クラスタ化されたddlクエリの複数の改善と修正。 特に重要なのは、クラスタ内のサーバーからの応答を待つ時間を制限する新しい設定distributed\_ddl\_task\_timeoutです。 ddl要求がすべてのホストで実行されていない場合、応答にタイムアウトエラーが含まれ、要求は非同期モードで実行されます。 +- サーバーログにおけるスタックトレースの表示の改善。 +- を追加しました “none” 圧縮方法の値。 +- Configで複数のdictionaries\_configセクションを使用できます。xmlだ +- ファイルシステムのソケットを介してmysqlに接続することは可能です。 +- システム。部品表は、新しい列に関する情報はサイズメッセージが表示され、バイトです。 + +#### バグ修正: {#bug-fixes-4} + +- マージテーブルを使用する分散テーブルは、現在の条件と選択クエリのために正しく動作します `_table` フィールド。 +- ReplicatedMergeTreeでデータパーツをチェックする際の競合状態を修正しました。 +- 上の固定可能な凍結 “leader election” サーバーを起動するとき。 +- データソースのローカルレプリカを使用する場合、max\_replica\_delay\_for\_distributed\_queries設定は無視されました。 これは修正されました。 +- の誤った動作を修正しました `ALTER TABLE CLEAR COLUMN IN PARTITION` 既存の列以外の列をクリーンアップしようとした場合。 +- 空の配列または文字列を使用する場合、multif関数の例外を修正しました。 +- 固定の過剰なメモリ割当ての場合deserializingネイティブ形式です。 +- トライ辞書の不正な自動更新を修正しました。 +- 固定の例外実行時にクエリを処理するクラウドの場合、group by節からmergeテーブル使用時のサンプルです。 +- Distributed\_aggregation\_memory\_efficient=1を使用したときにGROUP BYがクラッシュする問題を修正しました。 +- これで、データベースを指定できます。inとjoinの右側にあるテーブル。 +- 並列集約に使用されるスレッドが多すぎます。 これは修正されました。 +- どのように固定 “if” 関数は、FixedString引数で動作します。 +- 重量が0のシャードの分散テーブルから誤って処理されたものを選択します。 これは修正されました。 +- 実行中 `CREATE VIEW IF EXISTS no longer causes crashes.` +- Input\_format\_skip\_unknown\_fields=1が設定され、負の数がある場合の動作が正しくない問題を修正しました。 +- の無限ループを修正しました `dictGetHierarchy()` 辞書に無効なデータがある場合は機能します。 +- 固定 `Syntax error: unexpected (...)` INまたはJOIN句およびMergeテーブル内のサブクエリを使用して分散クエリを実行するときのエラー。 +- 辞書テーブルからの選択クエリの誤った解釈を修正しました。 +- 修正された “Cannot mremap” 2億以上の要素を持つinおよびJOIN句で配列を使用するときにエラーが発生します。 +- ソースとしてmysqlと辞書のフェイルオーバーを修正しました。 + +#### 改善ワークフローの開発と組み立てclickhouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} + +- ビルドはarcadiaで組み立てることができます。 +- Gcc7を使用してClickHouseをコンパイルできます。 +- Ccache+distccを使用した並列ビルドの方が高速になりました。 + +### ClickHouseリリース1.1.54245,2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} + +#### 新しい機能: {#new-features-5} + +- 分散ddl(例, `CREATE TABLE ON CLUSTER`) +- 複製されたクエリ `ALTER TABLE CLEAR COLUMN IN PARTITION.` +- エンジンのための辞書のテーブル(アクセスの辞書データの形式で表)。 +- 辞書データベースエンジン(タイプのデータベースに自動的に辞書で使用可能なテーブルを接続外部辞書). +- ソースに要求を送信することによって、辞書の更新を確認できます。 +- 修飾された列名 +- 二重引用符を使用して識別子を引用する。 +- セッションを行うhttpのインタフェース。 +- レプリケートされたテーブルの最適化クエリは、リーダーだけでなく実行できます。 + +#### 下位互換性のない変更: {#backward-incompatible-changes-2} + +- 削除セットグローバル。 + +#### 軽微な変更: {#minor-changes} + +- アラートがトリガーされると、ログは完全なスタックトレースを出力します。 +- 起動時に破損/余分なデータパーツの数の検証を緩和しました(誤検出が多すぎます)。 + +#### バグ修正: {#bug-fixes-5} + +- 接続不良を修正しました “sticking” 分散テーブルに挿入するとき。 +- GLOBAL INは、分散テーブルを参照するMergeテーブルからのクエリに対して機能します。 +- Google Compute Engine仮想マシンでコアの数が正しくないことが検出されました。 これは修正されました。 +- キャッシュされた外部ディクショナリの実行可能ソースの動作の変更 +- ヌル文字を含む文字列の比較を修正しました。 +- 定数を持つfloat32主キーフィールドの比較を修正しました。 +- 従来、不正確な見積りのサイズの分野が過度に大きな分配すべき。 +- ALTERを使用してテーブルに追加されたNull許容列を照会するとクラッシュする問題を修正しました。 +- 行の数が制限よりも小さい場合、null可能な列でソートするとクラッシュする問題を修正しました。 +- 定数値のみで構成されるorder byサブクエリを修正しました。 +- については、従来、複製テーブルが残る無効な状態にした後、失敗した下表に示す。 +- 空の結果を持つスカラーサブクエリのエイリアスは失われなくなりました。 +- .soファイルが破損した場合、コンパイルを使用したクエリはエラーで失敗しません。 diff --git a/docs/ja/whats_new/changelog/2018.md b/docs/ja/whats-new/changelog/2018.md similarity index 100% rename from docs/ja/whats_new/changelog/2018.md rename to docs/ja/whats-new/changelog/2018.md diff --git a/docs/ja/whats-new/changelog/2019.md b/docs/ja/whats-new/changelog/2019.md new file mode 100644 index 00000000000..2d4a089280b --- /dev/null +++ b/docs/ja/whats-new/changelog/2019.md @@ -0,0 +1,2074 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_priority: 77 +toc_title: '2019' +--- + +## ClickHouseリリースv19.17 {#clickhouse-release-v19-17} + +### ClickHouseリリースv19.17.6.36,2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} + +#### バグ修正 {#bug-fix} + +- Decompressでバッファオーバーフローの可能性を修正 悪意のあるユーザーで製作した圧縮データが読み後のバッファです。 この問題は、Yandexの情報セキュリティチームのEldar Zaitovによって発見されました。 [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定可能なサーバのクラッシュ (`std::terminate`)サーバーがJsonまたはXML形式で文字列データ型(UTF-8検証が必要)の値を使用してデータを送信または書き込むことができない場合、またはBrotliアルゴリズムま [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- クリックハウスからのソースを持つ固定辞書 `VIEW` 今、そのような辞書を読んでもエラーは発生しません `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 固定照合するクライアントホストで許可されhost\_regexp指定されます。xmlだ [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- `RENAME TABLE` 分散表現に変更、フォルダが挿入されデータを送信する前に破片. これにより、連続した名前変更の問題が修正されます `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- `range_hashed` 外部辞書作成DDLわきの範囲は任意の数値です。 [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- 固定 `INSERT INTO table SELECT ... FROM mysql(...)` テーブル機能。 [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- 固定segfaultで `INSERT INTO TABLE FUNCTION file()` 存在しないファイルに挿入している間。 この場合、ファイルが作成され、insertが処理されます。 [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- 集計ビットマップとスカラビットマップとの交差時にビットマップとエラーを修正 [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([越黄](https://github.com/moon03432)) +- 固定segfault時 `EXISTS` クエリが使用されなかった `TABLE` または `DICTIONARY` 修飾子,ちょうどのような `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 関数の戻り値の型を修正 `rand` と `randConstant` nullable引数の場合。 Now関数は常に戻ります `UInt32` そして決して `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 固定 `DROP DICTIONARY IF EXISTS db.dict` 今は例外をスローしません `db` 存在しない [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- さん完全に落ちてしまったがサーバのクラッシュ、サーバへの復元とその負荷で [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- 複数のシャードローカルテーブルが存在する場合、分散テーブルの簡単なカウントクエリが修正されました。 [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- DB::BlockStreamProfileInfo::calculateRowsBeforeLimitのデータレースにつながるバグを修正しました() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- 固定 `ALTER table MOVE part` 実行直後の統合、指定された部分を引き起こす可動部を、指定された部分に統合します。 今度は、指定された部分を正しく移動します。 [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 辞書の式を文字列として指定できるようになりました。 これは、非clickhouseソースからデータを抽出する際に、それらの式に非clickhouse構文を使用できるため、属性の計算に役立ちます。 [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- で非常にまれなレースを修正しました `clickhouse-copier` ZXidのオーバーフローのため。 [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([丁象飛](https://github.com/dingxiangfei2009)) +- クエリが失敗した後にバグを修正しました(原因 “Too many simultaneous queries” たとえば、外部テーブル情報を読み込まず、 + 次の要求は、この情報を次のクエリの先頭と解釈し、次のようなエラーを引き起こします `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- 後にnull逆参照を避ける “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- すべてのicuロケールのサポートを復元し、定数式の照合順序を適用し、システムに言語名を追加する機能を追加します。照合テーブル。 [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- 読み込み元のストリームの数 `StorageFile` と `StorageHDFS` メモリ制限を超えないように制限されています。 [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- 固定 `CHECK TABLE` のためのクエリ `*MergeTree` キーのないテーブル。 [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- 変異がなかった場合には、部分名から突然変異番号を削除しました。 この除去との互換性を高め、古いバージョン. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- テーブルバージョンよりもdata\_versionが大きいため、一部のアタッチされたパーツに対して変異がスキップされる不具合を修正した。 [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) +- 別のデバイスに移動した後、部品の冗長コピーを使用してサーバーを起動できます。 [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- エラーを修正しました “Sizes of columns doesn’t match” これは、集計関数列を使用する場合に表示されます。 [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- LIMIT BYと一緒にWITH TIESを使用する場合は、例外がスローされます。 そして今、トップをLIMIT BYで使うことができます。 [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- それが持っている場合 `invalidate_query` これは、以前の更新試行時に更新といくつかの例外を停止しました。 [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) + +### ClickHouseリリースv19.17.4.11、2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} + +#### 下位互換性のない変更 {#backward-incompatible-change} + +- 使用カラムの代わりにastビスカラサブクエリの結果よりよい。 設定 `enable_scalar_subquery_optimization` 19.17で追加され、デフォルトで有効になりました。 繋がるようなエラー [この](https://github.com/ClickHouse/ClickHouse/issues/7851) 以前のバージョンから19.17.2または19.17.3にアップグレード中。 この設定はデフォルトで無効にで19.17.4、可能からのアップグレード19.16、以前のバージョンなします。 [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([アモスの鳥](https://github.com/amosbird)) + +#### 新しい機能 {#new-feature} + +- DDLクエリで辞書を作成する機能を追加します。 [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) +- 作る `bloom_filter` 索引をサポートするタイプ `LowCardinality` と `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 機能を追加 `isValidJSON` 渡された文字列が有効なjsonであることを確認する。 [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) +- 実装 `arrayCompact` 機能 [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([メモ](https://github.com/Joeywzr)) +- 作成された機能 `hex` 十進数のため。 それはのように働く `hex(reinterpretAsString())`、しかし、最後のゼロバイトを削除しません。 [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) +- 追加 `arrayFill` と `arrayReverseFill` 配列内のそれらの前後の他の要素によって要素を置き換える関数。 [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) +- 追加 `CRC32IEEE()`/`CRC64()` サポート [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) +- 実装 `char` 関数に似ています。 [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) +- 追加 `bitmapTransform` 機能。 これは、ビットマップ内の値の配列を別の値の配列に変換し、結果は新しいビットマップになります [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) +- 実装 `javaHashUTF16LE()` 機能 [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbabcomment](https://github.com/achimbab)) +- 追加 `_shard_num` 分散エンジンの仮想列 [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) + +#### 実験的特徴 {#experimental-feature} + +- 新しいクエリ実行パイプライン)のサポート `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### バグ修正 {#bug-fix-1} + +- 不正な浮動小数点解析の修正 `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- Trace\_logが有効になっているときに発生する稀なデッドロックを修正します。 [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([フィリモノフ](https://github.com/filimonov)) +- 防止のメッセージの複製を制作するカフカテーブルには、mvsの選択からで [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([イワン](https://github.com/abyss7)) +- のサポート `Array(LowCardinality(Nullable(String)))` で `IN`. 解決 [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbabcomment](https://github.com/achimbab)) +- の処理を追加 `SQL_TINYINT` と `SQL_BIGINT`、および修正の取り扱い `SQL_FLOAT` ODBCブリッジのデータソースの種類。 [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- 集約の修正 (`avg` 空の小数点以下桁数を超えた場合 [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) +- 修正 `INSERT` 分散に `MATERIALIZED` 列 [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- 作る `MOVE PARTITION` 仕事のパーツがあった場合にエントランスは目を引く壁面緑化依存度はさほど高くないものの、保存先ディスクまたは量 [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- ハードリンクがで突然変異の間に作成されるために失敗したバグを修正 `ReplicatedMergeTree` マルチディスク構成で。 [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 部分全体が変更されず、最高のスペースが別のディスク上に発見されているときmergetreeに変異を持つバグを修正しました [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) +- とのバグを修正 `keep_free_space_ratio` ディスク構成から読み取られない [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) +- テーブルのみを含むバグを修正 `Tuple` 複雑なパスを持つ列または列。 修正 [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) +- Max\_memory\_usage制限のバッファエンジンのメモリを考慮しない [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) +- で最終的なマークの使用状況を修正 `MergeTree` テーブルの順序付け `tuple()`. まれにそれはに導くことができます `Can't adjust last granule` 選択中にエラー。 [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([アントン-ポポフ](https://github.com/CurtizJ)) +- クラッシュや奇妙な例外につながる可能性があり、コンテキスト(jsonのための例の機能)を必要とするアクションと述語を持っている変異のバグを [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) +- データベース名とテーブル名の不一致を修正 `data/` と `shadow/` ディレク [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. この場合のクラッシュを修正。 [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正 `Not found column in block` RIGHTまたはFULL JOINでexpressionに参加するとき。 [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) +- 無限ループを修正するもう一つの試み `PrettySpace` 書式 [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) +- バグを修正 `concat` すべての引数が `FixedString` 同じサイズの。 [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) +- S3、URLおよびHDFSストレージを定義しながら、1引数を使用した場合の例外を修正しました。 [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) +- クエリでビューのinterpreterselectqueryのスコープを修正 [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) + +#### 改善 {#improvement} + +- `Nullable` ODBCブリッジによって正しく処理される列とNULL値 [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- 分散送信の現在のバッチをアトミックに書き込む [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) +- クエリで列名のテーブルを検出できない場合は、例外をスローします。 [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加 `merge_max_block_size` に設定する `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) +- とのクエリ `HAVING` とせずに `GROUP BY` 当グループによる定数です。 だから, `SELECT 1 HAVING 1` 今すぐ結果を返します。 [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([アモスの鳥](https://github.com/amosbird)) +- サポート解析 `(X,)` pythonに似たタプルとして。 [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([アモスの鳥](https://github.com/amosbird)) +- 作る `range` 関数の振る舞いはpythonicのようなものです。 [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) +- 追加 `constraints` テーブルへの列 `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) +- より良いnullの場合形式のtcpハンドラで利用可能 `select ignore() from table format Null` clickhouseによるperfの測定のため-顧客 [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([アモスの鳥](https://github.com/amosbird)) +- のようなクエリ `CREATE TABLE ... AS (SELECT (1, 2))` 正しく解析されます [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) + +#### 性能向上 {#performance-improvement} + +- 短い文字列キーに対する集約のパフォーマンスが向上しました。 [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [アモスの鳥](https://github.com/amosbird)) +- 構文/式分析の別のパスを実行して、定数述部が折り畳まれた後に潜在的な最適化を取得します。 [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([アモスの鳥](https://github.com/amosbird)) +- ストレージメタ情報を使用して簡単に評価する `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([アモスの鳥](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) +- ベクトル化処理 `arrayReduce` アグリゲータと同様です `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([アモスの鳥](https://github.com/amosbird)) +- の性能のマイナーな改善 `Kafka` 消費 [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([イワン](https://github.com/abyss7)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement} + +- クロスコンパイルのサポートをcpuアーキテクチャaarch64に追加します。 リファクタリング [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([イワン](https://github.com/abyss7)) +- パッケージのビルド時に、darwin-x86\_64およびlinux-aarch64ツールチェーンをマウントされたdockerボリュームに解凍する [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([イワン](https://github.com/abyss7)) +- 更新docker画像のバイナリーベル [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([イワン](https://github.com/abyss7)) +- MacOSのカタリナの固定コンパイルエラー [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) +- クエリ分析ロジックのリファクタリング:複雑なクラスを複数の単純なクラスに分割します。 [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) +- サブモジュールなしでビルドを修正 [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) +- より良い `add_globs` CMakeファイル内 [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([アモスの鳥](https://github.com/amosbird)) +- ハードコードされたパスの削除 `unwind` ターゲット [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) +- Sslなしでmysql形式を使用できるようにする [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) + +#### その他 {#other} + +- ClickHouse SQLダイアレクトのANTLR4文法を追加 [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouseリリースv19.16 {#clickhouse-release-v19-16} + +#### Clickhouseリリースv19.16.14.65,2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} + +- 複数の引数(10以上)の三元論理演算のバッチ計算のバグを修正しました。 [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz))このバグ修正は、Altinityからの特別な要求によってバージョン19.16にバックポートされました。 + +#### Clickhouseリリースv19.16.14.65,2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} + +- 古いchバージョンとの分散サブクエリの非互換性を修正しました。 修正 [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) + [(tabplubix)](https://github.com/tavplubix) +- 実行時期 `CREATE` クエリー、倍定表現のストレージエンジンの引数です。 空のデータベース名を現在のデータベ 修正 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). また、ローカルアドレスの確認を修正 `ClickHouseDictionarySource`. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- 今、背景には、マージ `*MergeTree` テーブルエンジンの家族の保存-保存政策に大量注文しております。 + [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- データを失うのを防ぐ `Kafka` まれに、接尾辞を読んだ後でコミットする前に例外が発生した場合。 修正 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). 関連: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(フィリモノフ)](https://github.com/filimonov) +- のを修正した。先サーバを終了しようとした場合に使用/drop `Kafka` テーブル作成されたパラメータ。 修正 [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). 組み込み [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(フィリモノフ)](https://github.com/filimonov) +- 使用を許可する `MaterializedView` 上記のサブクエリを使用する `Kafka` テーブル。 + [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([フィリモノフ](https://github.com/filimonov)) + +#### 新しい機能 {#new-feature-1} + +- 追加 `deduplicate_blocks_in_dependent_materialized_views` マテリアライズドビューを持つテーブルへの冪等挿入の動作を制御するオプション。 この新機能は、Altinityからの特別な要求によってbugfixリリースに追加されました。 + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### ClickHouseリリースv19.16.2.2、2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} + +#### 下位互換性のない変更 {#backward-incompatible-change-1} + +- Count/counIfに不足しているアリティ検証を追加します。 + [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) + [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) +- レガシーを削除 `asterisk_left_columns_only` 設定(デフォルトでは無効になっていました)。 + [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem + Zuikov](https://github.com/4ertus2)) +- フォーマット文字列のためのテンプレートデータの形式は指定のファイルです。 + [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) + +#### 新しい機能 {#new-feature-2} + +- Uint\_maxより大きい基数を計算するために、uniqCombined64()を導入します。 + [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), + [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat + Khuzhin](https://github.com/azat)) +- 支援bloom filterを指標配列に列あります。 + [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) + ([achimbabcomment](https://github.com/achimbab)) +- 関数を追加する `getMacro(name)` これは、対応する値を持つ文字列を返します `` + サーバー構成から。 [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- HTTPソースに基づいてディクショナリの設定オプションを設定する: `credentials` と + `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- 新しいprofileeventを追加する `Merge` これは、起動された背景のマージの数を数えます。 + [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([ミハイル + Korotov](https://github.com/millb)) +- 完全修飾ドメイン名を返すfullhostname関数を追加します。 + [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) + [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) +- 機能を追加 `arraySplit` と `arrayReverseSplit` これは配列を分割する “cut off” + 条件。 これらは、時系列の処理に役立ちます。 + [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) +- マッチしたすべてのインデックスの配列をmultimatchファミリの関数に返す新しい関数を追加します。 + [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([ダニラ + クテニン](https://github.com/danlark1)) +- 新規データベースエンジンの追加 `Lazy` それは多数の小さい丸太を貯えるために最大限に活用されます + テーブル。 [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([ニキータ + Vasilev](https://github.com/nikvas0)) +- ビットマップ列の集計関数groupbitmapand、-または、-xorを追加します。 [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang + ゆう](https://github.com/yuzhichang)) +- Nullを返す集計関数combinators-OrNullと-OrDefaultを追加します + または、集計するものがない場合のデフォルト値。 + [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) + ([hcz](https://github.com/hczhcz)) +- カスタ + 区切り文字ルール。 [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) +- 外部辞書のソースとしてサポートredis。 [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [アントン + ポポフ](https://github.com/CurtizJ)) + +#### バグ修正 {#bug-fix-2} + +- 修正誤ったクエリの結果の場合で `WHERE IN (SELECT ...)` セクションと `optimize_read_in_order` は + 使用される。 [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([アントン + ポポフ](https://github.com/CurtizJ)) +- プロジェクトの外のファイルに依存する無効mariadb認証プラグイン、。 + [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([ユーリ + Baranov](https://github.com/yurriy)) +- 例外を修正 `Cannot convert column ... because it is constant but values of constants are different in source and result` これは、関数が `now()`, `today()`, + `yesterday()`, `randConstant()` 使用されます。 + [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([ニコライ + Kochetov](https://github.com/KochetovNicolai)) +- 固定問題のhttp生き生きと保つタイムアウトの代わりにtcpのままにしておくタイムアウト. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([バシリー + Nemkov](https://github.com/Enmk)) +- GroupBitmapOrのセグメンテーション障害を修正しました(問題 [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). + [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang + ゆう](https://github.com/yuzhichang)) +- のための実現の為のためのカフカでとても間近に見ることができすべてのデータが書かれています。 + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([イワン](https://github.com/abyss7)) +- 固定間違った `duration_ms` 値の `system.part_log` テーブル。 それは十回オフだった。 + [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- 修正を解決するクラッシュライブビューテーブルの再可能なすべてのライブビュー。 + [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) + ([vzakaznikov](https://github.com/vzakaznikov)) +- MergeTreeパーツの最小/最大インデックスでNULL値を正しくシリアル化します。 + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- 仮想列を置かないでください。テーブル作成時のsqlメタデータ `CREATE TABLE AS`. + [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([イワン](https://github.com/abyss7)) +- セグメンテーショ `ATTACH PART` クエリ。 + [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) + ([alesapin](https://github.com/alesapin)) +- サブクエリの空と空の最適化によって与えられたいくつかのクエリの間違った結果を修正 + INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([ニコライ + Kochetov](https://github.com/KochetovNicolai)) +- ライブビューのgetheader()メソッドでaddresssanitizerエラーを修正します。 + [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) + ([vzakaznikov](https://github.com/vzakaznikov)) + +#### 改善 {#improvement-1} + +- Queue\_wait\_max\_ms待機が発生した場合にメッセージを追加します。 + [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat + Khuzhin](https://github.com/azat)) +- メイドの設定 `s3_min_upload_part_size` テーブルレベル。 + [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- StorageFactoryでTTLをチェックします。 [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) + ([sundyli](https://github.com/sundy-li)) +- 部分マージ結合(最適化)でスカッシュ左側のブロック。 + [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem + Zuikov](https://github.com/4ertus2)) +- レプリケートされたテーブルエンジンの変異時に非決定論的関数を許可しないでください。 + レプリカ間に不整合が生じる可能性があります。 + [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alexander + Kazakov](https://github.com/Akazz)) +- 無効メモリにトラッカーが変換の例外のスタックトレースを文字列になります。 それを防ぐことができ損失 + タイプのエラーメッセージ `Memory limit exceeded` サーバーでは、 `Attempt to read after eof` クライアントの例外。 [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) + ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- その他の形式の改善。 解決 + [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), + [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), + [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), + [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) + [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) + ([tavplubix](https://github.com/tavplubix)) +- ClickHouseは、左側に変換不可能なIN演算子の右側の値を無視します + side type. Make it work properly for compound types – Array and Tuple. + [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- ASOF JOINの欠落した不等式をサポートします。 以下または等しいバリアントと厳密に結合することが可能です + 構文上のASOF列の大きいと少ない変種。 + [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem + Zuikov](https://github.com/4ertus2)) +- 部分マージ結合を最適化します。 [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) + ([Artem Zuikov](https://github.com/4ertus2)) +- 使用しない以上98kのメモリでuniqcombined機能。 + [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), + [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat + Khuzhin](https://github.com/azat)) +- PartialMergeJoinのディスク上の右側の結合テーブルのフラッシュ部分(十分でない場合 + メモリ)。 負荷データが必要です。 [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) + ([Artem Zuikov](https://github.com/4ertus2)) + +#### 性能向上 {#performance-improvement-1} + +- データの重複を避けることによって、joingetをconst引数で高速化します。 + [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos + 鳥](https://github.com/amosbird)) +- サブクエリが空の場合は、earlyを返します。 + [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) +- 値のsql式の解析を最適化します。 + [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) + ([tavplubix](https://github.com/tavplubix)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-1} + +- 無効化あcontribsクロスコンパイルをmac os. + [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([イワン](https://github.com/abyss7)) +- Clickhouse\_common\_ioのPocoXMLとのリンクが見つかりませんを追加します。 + [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat + Khuzhin](https://github.com/azat)) +- Clickhouse-testで複数のテストフィルター引数を受け入れます。 + [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- ARMのmuslとjemallocを有効にします。 [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) + ([アモスの鳥](https://github.com/amosbird)) +- 追加 `--client-option` へのパラメータ `clickhouse-test` ための追加のパラメータです。 + [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([ニコライ + Kochetov](https://github.com/KochetovNicolai)) +- Rpmパッケージのアップグ + [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) + ([フィリモノフ](https://github.com/filimonov)) +- PVSによって検出されたエラーを修正。 [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem + Zuikov](https://github.com/4ertus2)) +- ダーウィンのためのビルドを修正. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) + ([イワン](https://github.com/abyss7)) +- glibc2.29互換性。 [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos + 鳥](https://github.com/amosbird)) +- Dh\_cleanがソースファイルに触れないようにします。 + [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos + 鳥](https://github.com/amosbird)) +- Altinity rpmから更新するときに競合を避けるようにしてください。 + clickhouse-server-commonにあります。 [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) + ([フィリモノフ](https://github.com/filimonov)) +- 最適なヘッダファイルにより再建. + [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), + [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- 日付と日時のパフォーマンステストを追加する。 [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([バシリー + Nemkov](https://github.com/Enmk)) +- 非決定性の変異を含むいくつかのテストを修正します。 + [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alexander + Kazakov](https://github.com/Akazz)) +- CIにMemorySanitizerでビルドを追加します。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) + ([Alexander Kuzmenkov](https://github.com/akuzm)) +- MetricsTransmitterでは、初期化されていない値の使用は避けてください。 + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat + Khuzhin](https://github.com/azat)) +- 固定のいくつかの問題分野によっmemorysanitizer. + [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), + [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alexander + Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) + ([アモスの鳥](https://github.com/amosbird)) +- Murmurhash32で未定義の動作を修正しました。 [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos + 鳥](https://github.com/amosbird)) +- StoragesInfoStreamの未定義の動作を修正しました。 [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) + ([tavplubix](https://github.com/tavplubix)) +- 外部データベースエンジン(mysql、odbc、jdbc)のために折り畳まれた固定定数式。 前に + バージョンな作業のための複数の定数で表現したで働くすべての日付, + DateTimeおよびUUID。 この修正 [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- No\_users\_thread変数にアクセスする際のライブビューでのThreadSanitizer data raceエラーの修正。 + [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Libcommonでmallocシンボルを取り除く + [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), + [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos + 鳥](https://github.com/amosbird)) +- 追加グローバル旗enable\_libraries無効化のためのすべての図書館です。 + [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) + ([proller](https://github.com/proller)) + +#### コードの整理 {#code-cleanup} + +- 構成リポジトリを一般化して、辞書のddlを準備します。 [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) + ([alesapin](https://github.com/alesapin)) +- 任意のセマンティックなしの辞書ddlのパーサー。 + [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) + ([alesapin](https://github.com/alesapin)) +- ParserCreateQueryをさまざまな小さなパーサーに分割します。 + [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) + ([alesapin](https://github.com/alesapin)) +- 小さなリファクタリングと外部辞書の近くに名前を変更します。 + [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) + ([alesapin](https://github.com/alesapin)) +- Refactor一部のコードの準備のための役割ベースのアクセス制御です。 [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([ヴィタリ + Baranov](https://github.com/vitlibar)) +- DatabaseOrdinaryコードのいくつかの改善点。 + [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([ニキータ + Vasilev](https://github.com/nikvas0)) +- ハッシュテーブルのfind()およびemplace()メソッドではイテレータを使用しないでください。 + [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alexander + Kuzmenkov](https://github.com/akuzm)) +- パラメータのルートが空でない場合にgetmultiplevaluesfromconfigを修正しました。 [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) + ([Mikhail Korotov](https://github.com/millb)) +- いくつかのコピー&ペーストを削除する(temporaryfileとtemporaryfilestream) + [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem + Zuikov](https://github.com/4ertus2)) +- コードの可読性を少し改善 (`MergeTreeData::getActiveContainingPart`). + [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- お待ちすべての予定の仕事をローカルオブジェクトの場合 `ThreadPool::schedule(...)` 投球 + 例外です。 名前変更 `ThreadPool::schedule(...)` に `ThreadPool::scheduleOrThrowOnError(...)` と + 固定のコメントを明らかな場合にスロー. + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) + ([tavplubix](https://github.com/tavplubix)) + +## ClickHouseリリース19.15 {#clickhouse-release-19-15} + +### ClickHouseリリース19.15.4.10、2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} + +#### バグ修正 {#bug-fix-3} + +- SQL\_TINYINTとSQL\_BIGINTの処理を追加し、ODBCブリッジでSQL\_FLOATデータソース型の処理を修正しました。 + [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- 移動パーティショ + [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- ODBCブリッジを介してnull可能な列のNULL値を修正しました。 + [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- マテリアライズ列を持つ分散非ローカルノードに固定挿入。 + [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- 固定機能getmultiplevaluesfromconfig。 + [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) +- 固定問題のhttp生き生きと保つタイムアウトの代わりにtcpのままにしておくタイムアウト. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) +- すべてのジョブが例外で終了するのを待ちます(まれなsegfaultsを修正します)。 + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) +- Kafkaテーブルに挿入するときにMVsにプッシュしないでください。 + [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([イワン](https://github.com/abyss7)) +- 無効メモリにトラッカーのための例外をスタックです。 + [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 外部データベ + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MetricsTransmitterでは、初期化されていない値の使用は避けてください。 + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) +- テスト用のマクロを追加しました例の設定 ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### クリックハウスリリース19.15.3.6,2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} + +#### バグ修正 {#bug-fix-4} + +- ハッシュ化された辞書のbad\_variantを修正しました。 + ([alesapin](https://github.com/alesapin)) +- 修正のバグと分割詳しくは動画内で、タグは付け部分を返します。 + ([alesapin](https://github.com/alesapin)) +- 固定時間の計算 `MergeTreeData`. + ([Vladimir Chebotarev](https://github.com/excitoon)) +- 執筆が確定した後、kafkaに明示的にコミットします。 + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([イワン](https://github.com/abyss7)) +- MergeTreeパーツの最小/最大インデックスでNULL値を正しくシリアル化します。 + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +### クリックハウスリリース19.15.2.2,2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} + +#### 新しい機能 {#new-feature-3} + +- 段階のストレージへのサポート使用数量のためのテーブルmergetreeエンジンです。 新鮮なデータをssdに保存し、古いデータを自動的にhddに移動することができます。 ([例えば](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) +- テーブル関数の追加 `input` 受信データを読むため `INSERT SELECT` クエリ。 [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([パラソリック1color](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([アントン-ポポフ](https://github.com/CurtizJ)) +- を追加 `sparse_hashed` 辞書のレイアウトは、機能的には `hashed` レイアウトが、より効率的なメモリです。 それはより遅い価値検索の費用でより少ない記憶として二度約使用する。 [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) +- 実施能力の定義の一覧をユーザーへのアクセスする事ができます。 使用する現在の接続データベースのみ。 [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 追加 `LIMIT` オプションへ `SHOW` クエリ。 [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- 追加 `bitmapSubsetLimit(bitmap, range_start, limit)` 最小のサブセットを返す関数 `limit` より小さくないセット内の値 `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) +- 追加 `bitmapMin` と `bitmapMax` 機能。 [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) +- 機能を追加 `repeat` に関連する [問題-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL)) + +#### 実験的特徴 {#experimental-feature-1} + +- 現在のパイプラインを変更しないマージ結合バリアントをメモリに実装します。 結果はマージキーで部分的にソートされます。 セット `partial_merge_join = 1` この機能を使用するには. マージ結合はまだ開発中です。 [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加 `S3` エンジンおよびテーブル機能。 まだ開発中です(まだ認証サポートはありません)。 [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) + +#### 改善 {#improvement-2} + +- 全てのメッセージから読み込むカフカを挿入し、原子. これは、カフカエンジンのほぼすべての既知の問題を解決します。 [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([イワン](https://github.com/abyss7)) +- 分散クエリのフェイルオーバーの改善。 回復時間を短くして下さい、またそれは今構成され、見ることができます `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) +- 列挙型の数値を直接サポート `IN` セクション。 \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([ディマルブ2000](https://github.com/dimarub2000)) +- サポート(オプション、障害者によるデフォルト)のリダイレクトurlに保管します。 [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) +- 追加情報をメッセージがクライアントよりも古いバージョンを接続するサーバーです。 [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- 分散テーブ [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) +- Graphiteに累積値を持つプロファイルイベント(カウンター)を送信する機能を追加。 で有効にすることができ下 `` サーバー内 `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) +- 自動キャストタイプの追加 `T` に `LowCardinality(T)` 型の列にデータを挿入している間 `LowCardinality(T)` HTTP経由でネイティブ形式で。 [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 機能を使用する機能を追加する `hex` 使用せずに `reinterpretAsString` のために `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-2} + +- デバッグ情報を含むclickhouseバイナリにgdb-indexを追加します。 それはスピードアップ起動時間の `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) +- パッチを当てたdpkg-debを使用してdebパッケージをスピードアップ `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) +- セット `enable_fuzzing = 1` すべてのプロジェクトコードのlibfuzzerの計測を有効にするには. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) +- CIに分割ビルド煙テストを追加します。 [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) +- CIにMemorySanitizerでビルドを追加します。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 置換 `libsparsehash` と `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) + +#### バグ修正 {#bug-fix-5} + +- 固定性能の劣化指標分析複雑なテンキーの大きます。 これは#6924を修正します。 [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- カフカ空のトピックから選択する際にsegfaultsを引き起こす論理的なエラーを修正。 [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([イワン](https://github.com/abyss7)) +- あまりにも早いmysql接続を閉じる `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- 非常に古いlinuxカーネルのサポートが返される(fix [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- で可能なデータ損失を修正 `insert select` 入力ストリーム内の空のブロックの場合のクエリ。 \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 関数の修正 `АrrayEnumerateUniqRanked` paramsで空の配列を使用する [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- 配列結合とグローバルサブクエリを使用した複雑なクエリの修正 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([イワン](https://github.com/abyss7)) +- 修正 `Unknown identifier` 複数のジョインを持つORDER BYおよびGROUP BYでのエラー [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定 `MSan` 関数の実行中の警告 `LowCardinality` 引数。 [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### 下位互換性のない変更 {#backward-incompatible-change-2} + +- 変更直列化形式のビットマップ\*集計機能状態の性能の向上を図ります。 以前のバージョンのbitmap\*のシリアル化状態は読み取りできません。 [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) + +## ClickHouseリリース19.14 {#clickhouse-release-19-14} + +### ClickHouseリリース19.14.7.15,2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} + +#### バグ修正 {#bug-fix-6} + +- このリリースも含む全てのバグ修正から19.11.12.69. +- 19.14以前のバージョン間の分散クエリの互換性を修正しました。 この修正 [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.14.6.12,2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} + +#### バグ修正 {#bug-fix-7} + +- 関数の修正 `АrrayEnumerateUniqRanked` paramsに空の配列があります。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- とクエリ内の固定サブクエリ名 `ARRAY JOIN` と `GLOBAL IN subquery` エイリアス付き。 外部テーブル名が指定されている場合は、サブクエリ別名を使用します。 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([イワン](https://github.com/abyss7)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-3} + +- 修正 [フラッピング](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) テスト `00715_fetch_merged_or_mutated_part_zookeeper` それは突然変異が適用されるのを待つ必要があるためです。 [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) +- 機能の固定ubsanおよびmemsanの失敗 `groupUniqArray` emtpy配列の引数を持つ。 それは空の配置によって引き起こされた `PaddedPODArray` へのハッシュテーブルのゼロの細胞でのコンストラクターゼの細胞値ませんでした。 [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([アモスの鳥](https://github.com/amosbird)) + +### ClickHouseリリース19.14.3.3,2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} + +#### 新しい機能 {#new-feature-4} + +- `WITH FILL` の修飾子 `ORDER BY`. (の継続 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([アントン-ポポフ](https://github.com/CurtizJ)) +- `WITH TIES` の修飾子 `LIMIT`. (の継続 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([アントン-ポポフ](https://github.com/CurtizJ)) +- パースクォートなし `NULL` リテラルとしてNULL(設定の場合 `format_csv_unquoted_null_literal_as_null=1`). このフィールドのデー `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) +- テーブル関数のパスのワイルドカードのサポート `file` と `hdfs`. 場合に経路を含むワイルドカード、テーブルが読み取り専用になります。 使用例: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` と `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) +- 新しい `system.metric_log` の値を格納するテーブル `system.events` と `system.metrics` 指定時間間隔を使って。 [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouseテキストログを書き込むことを許可する `system.text_log` テーブル。 [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ショー民間のシンボルスタックトレース(ターを通じて構文解析シンボルテーブルのelfファイル). 追加情報ファイルと行番号をスタックトレースの場合のデバッグ情報があります。 高速シンボル名のルックアップインデックスの記号が存在します。 イントロスペクション用の新しいsql関数を追加: `demangle` と `addressToLine`. 関数の名前を変更 `symbolizeAddress` に `addressToSymbol` 一貫性のために。 機能 `addressToSymbol` パフォーマンス上の理由から、マングルされた名前を返します。 `demangle`. 追加された設定 `allow_introspection_functions` デフォルトではオフになっています。 [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- テーブル機能 `values` (名前は大文字と小文字を区別しません)。 それは読むことを可能にする `VALUES` で提案されたリスト [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). 例えば: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([ディマルブ2000](https://github.com/dimarub2000)) +- ストレージの設定を変更する機能を追加しました。 構文: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) +- 取り外した部品の取り外しをサポート。 構文: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) +- テーブルの制約。 挿入時にチェックされるテーブル定義に制約を追加することができます。 [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 支援のためのカスケード型を実現します。 [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([アモスの鳥](https://github.com/amosbird)) +- On queryプロファイラのデフォルトでサンプル毎にクエリの実行スレッドだ。 [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 入力形式 `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) +- 二つの新機能を追加しました: `sigmoid` と `tanh` (これは機械学習アプリケーションに便利です)。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 機能 `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` 指定されたトークンがhaystackにあるかどうかを確認する。 トークンは、二つの非英数字ASCII文字(またはhaystackの境界)の間の最大長の部分文字列です。 トークンを入力する必要がある定数文字列になります。 支tokenbf\_v1指数の専門性を高めます。 [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) +- 新しい機能 `neighbor(value, offset[, default_value])`. データブロック内の列内の前/次の値に到達することができます。 [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) +- 関数の作成 `currentUser()`、承認されたユーザのログインを返す。 エイリアスを追加 `user()` MySQLとの互換性のために。 [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) +- 新しい集計関数 `quantilesExactInclusive` と `quantilesExactExclusive` これはで提案されました [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([ディマルブ2000](https://github.com/dimarub2000)) +- 機能 `bitmapRange(bitmap, range_begin, range_end)` これは、指定された範囲の新しいセットを返します( `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) +- 機能 `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` 提供された区域をカバーするgeohash箱の精密長い一連の配列を作成するかどれが。 [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) +- INSERTクエリのサポートを実装する `Kafka` テーブル。 [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([イワン](https://github.com/abyss7)) +- のサポートを追加 `_partition` と `_timestamp` カフカエンジンへの仮想列。 [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([イワン](https://github.com/abyss7)) +- から機密データを削除する可能性 `query_log`、サーバーログ、regexpベースのルールを持つプロセスリスト。 [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([フィリモノフ](https://github.com/filimonov)) + +#### 実験的特徴 {#experimental-feature-2} + +- 入力および出力データ形式 `Template`. これは、入力と出力のカスタム書式文字列を指定することができます。 [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) +- の実装 `LIVE VIEW` 最初に提案されたテーブル [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898)、準備される [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925)、その後で更新 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). 見る [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) 詳細な説明のため。 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov))ことに注意 `LIVE VIEW` 特集は削除される可能性があり、来できます。 + +#### バグ修正 {#bug-fix-8} + +- このリリースも含む全てのバグ修正から19.13と19.11. +- 固定の区分断層のテーブルはスキップ指標および垂直統合などが挙げられる。 [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) +- 非自明な列のデフォルトで列ごとのttlを修正しました。 以前は、force ttl mergeの場合は次のようになりました `OPTIMIZE ... FINAL` クエリー、終了しました値に置き換えられたタイプのデフォルトの代わりにユーザが指定した列のデフォルトする [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 通常のサーバーの再起動時にkafkaメッセージの重複の問題を修正。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([イワン](https://github.com/abyss7)) +- カフカメッセージを読むときに固定無限ループ。 それ以外の場合は、いくつかのシナリオで無期限に一時停止することがあります。 [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([イワン](https://github.com/abyss7)) +- 修正 `Key expression contains comparison between inconvertible types` での例外 `bitmapContains` 機能。 [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([ディマルブ2000](https://github.com/dimarub2000)) +- 有効にしてsegfaultを修正 `optimize_skip_unused_shards` シャーディングキーがない [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([アントン-ポポフ](https://github.com/CurtizJ)) +- メモリの破損につながる可能性があり、突然変異で間違ったコードを修正. アドレスの読み取りによる固定segfault `0x14c0` それは同時に起こったかもしれない `DROP TABLE` と `SELECT` から `system.parts` または `system.parts_columns`. 突然変異クエリの準備の競合状態を修正しました。 によるデッドロックを修正 `OPTIMIZE` レプリケートされたテーブルと同時変更操作のような変更。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MySQLインターフェイスで削除された余分な冗長ログ [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- からブール値の設定を解析する機能を返します ‘true’ と ‘false’ 設定ファイルで。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- でクラッシュを修正 `quantile` と `median` 関数オーバー `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) +- によって返された可能な不完全な結果を修正 `SELECT` クエリと `WHERE` 主キーの条件には、Float型への変換が含まれていました。 それは単調性の誤ったチェックによって引き起こされた `toFloat` 機能。 [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([ディマルブ2000](https://github.com/dimarub2000)) +- チェック `max_expanded_ast_elements` 突然変異のための設定。 後の明確な突然変異 `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([冬張](https://github.com/zhang2014)) +- と共に使用するときにキー列の結合結果を修正 `join_use_nulls`. 列の既定値の代わりにNullをアタッチします。 [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) +- 垂直マージと変更とスキップインデックスの修正。 修正のための `Bad size of marks file` 例外だ [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) +- でレアクラッシュを修正 `ALTER MODIFY COLUMN` マージ/変更された部分のいずれかが空(0行)のときに垂直マージ) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- の変換のバグを修正しました `LowCardinality` タイプ `AggregateFunctionFactory`. この修正 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 間違った動作と可能なsegfaultsを修正 `topK` と `topKWeighted` 集計関数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 周りの固定安全でないコード `getIdentifier` 機能。 [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 問題を修正しましたmysqlのワイヤーロを使用すると接続するclickhouse形mysqlクライアント). によって引き起こされる `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([ユーリーバラノフ](https://github.com/yurriy)) +- 固定メモリリーク `bitmapSubsetInRange` 機能。 [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) +- 粒度の変更後に突然変異が実行されたときに稀なバグを修正しました。 [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) +- きprotobufメッセージの全ての分野でのデフォルトです。 [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) +- バグを解決するには `nullIf` 私達がaを送る場合の機能 `NULL` 第二引数の引数。 [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 文字列フィールドを持つ複雑なキーキャッシュ辞書で間違ったメモリ割り当て/割り当て解除を使用して、まれなバグを修正しました(メモリリークのよ バグは、文字列サイズが八(8、16、32、等)から始まる二つの累乗だったときに再現します。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- 例外を引き起こした小さな配列に固定ゴリラエンコード `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) +- Nullableではない型をJOINsで使用できるようにする `join_use_nulls` 有効。 [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) +- 無効にする `Poco::AbstractConfiguration` クエリ内での置換 `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- デッドロックを回避 `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- を使用して `arrayReduce` 定数引数の場合、segfaultにつながる可能性があります。 [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- レプリカが後に復元された場合に表示される不整合な部分を修正 `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- 固定こつ `JSONExtractRaw` 機能。 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正のバグと誤ったスキップ指数の直列化を行い、その凝集と適応粒度. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) +- 修正 `WITH ROLLUP` と `WITH CUBE` の修飾子 `GROUP BY` 二レベルの集計。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([アントン-ポポフ](https://github.com/CurtizJ)) +- のを修正した。筆二次指標マーク適応型粒度. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- サーバーの起動中に初期化の順序を修正します。 それ以来 `StorageMergeTree::background_task_handle` で初期化される。 `startup()` その `MergeTreeBlockOutputStream::write()` 初期化の前に使用しようとするかもしれません。 すぐチェックインの場合は初期化されます。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([イワン](https://github.com/abyss7)) +- エラーで完了した前の読み取り操作からデータバッファーをクリアします。 [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([ニコライ](https://github.com/bopohaa)) +- 固定バを適応的粒度を新規作成時のレプリカのための複製\*mergetreeます。 [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- 例外が発生した場合のサーバーの起動時に可能なクラッシュを修正しました `libunwind` 初期化されていないアクセス時の例外時 `ThreadStatus` 構造。 [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- でクラッシュを修正 `yandexConsistentHash` 機能。 ファズテストによって発見。 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定の可能性を掛けのクエリがサーバが過負荷状態で運転され、グローバルスレッドプールが近い。 これは、分散クエリが各シャードに接続ごとにスレッドを割り当てるため、多数のシャード(数百)を持つクラスターで発生する可能性が高くなります。 たとえば、330個のシャードのクラスターが30個の同時分散クエリを処理している場合、この問題は再現されます。 この問題に影響するすべてのバージョンから19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定ロジックの `arrayEnumerateUniqRanked` 機能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- シンボルテーブルのデコード時にsegfaultを修正。 [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([アモスの鳥](https://github.com/amosbird)) +- のキャストで修正された無関係な例外 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- で説明の余分な引用を削除しました `system.settings` テーブル。 [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- デッドロックの回避 `TRUNCATE` 複製されたテーブルの。 [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ソートキーの順に読み取りを修正しました。 [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 修正 `ALTER TABLE ... UPDATE` とテーブルのクエリ `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- によって開かバグを修正 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (19.4.0以来)。 列をクエリしない場合は、MergeTreeテーブルを使用して分散テーブルへのクエリを再現します (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- 固定オーバーフローの整数部署名-タイプを符号なしタイプです。 この動作は、cまたはc++言語(整数昇格ルール)とまったく同じで、驚くかもしれません。 大きな符号付き数を大きな符号なし数に分割する場合、またはその逆の場合にはオーバーフローが可能であることに注意してください(ただし、その場合 の問題が全てのサーバーのバージョン [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- スロットリング時の最大スリープ時間を制限する `max_execution_speed` または `max_execution_speed_bytes` 設定されています。 固定偽のようなエラー `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 使用に関する問題を修正 `MATERIALIZED` の列とエイリアス `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([アモスの鳥](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正 `FormatFactory` プロセッサとして実装されていない入力ストリームの動作。 [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 修正されたタイプミス。 [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) +- エラーメッセージのタイプミス(is-\>are)。 [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) +- 固定誤差を解析カラムのリストから文字列の場合タイプが含まれるコンマ(この問題に関連する `File`, `URL`, `HDFS` ストレージ) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([ディマルブ2000](https://github.com/dimarub2000)) + +#### セキュリティ修正 {#security-fix} + +- このリリースも含む全てのバグのセキュリティ修正をか19.13と19.11. +- SQLパーサーのスタックオーバーフローによりサーバーがクラッシュする可能性がある問題を修正 固定の可能性スタックオーバーフローに統合、配布し、テーブルが現実の景色の件本件は、行レベルのセキュリティなサブクエリ. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 改善 {#improvement-3} + +- のための三元論理の正しい実装 `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) +- これで、ttlの有効期限が切れた値と行が削除されます。 `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` クエリ。 追加されたクエリ `SYSTEM STOP/START TTL MERGES` 可に/を割り当てを合併TTLおよびフィルター終了しました値をすべてが合併。 [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([アントン-ポポフ](https://github.com/CurtizJ)) +- クライアントのclickhouse履歴ファイルの場所を変更する可能性 `CLICKHOUSE_HISTORY_FILE` env [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([フィリモノフ](https://github.com/filimonov)) +- 削除 `dry_run` フラグから `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- サポート `ASOF JOIN` と `ON` セクション。 [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) +- 突然変異および複製のためのskip索引のよりよいサポート。 のサポート `MATERIALIZE/CLEAR INDEX ... IN PARTITION` クエリ。 `UPDATE x = x` 列を使用するすべてのインデックスの再計算 `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) +- 許可する `ATTACH` ライブビュー(たとえば、サーバーの起動時など) `allow_experimental_live_view` 設定。 [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- のためのスタックトレースに集まるエリプロファイラに含まれているものも含むスタックフレームが発生するqueryプロファイラです。 [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Nowテーブル関数 `values`, `file`, `url`, `hdfs` ALIAS列をサポートしている。 [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 次の場合に例外をスローする `config.d` ファイルには、対応するルート要素が設定ファイルとして存在しません。 [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([ディマルブ2000](https://github.com/dimarub2000)) +- 例外メッセージの余分な情報を印刷する `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) +- Aの破片を決定するとき `Distributed` 読み取りクエリによってカバーされるテーブル(for `optimize_skip_unused_shards` =1)ClickHouseは両方から条件をチェックします `prewhere` と `where` select文の句。 [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) +- 有効 `SIMDJSON` AVX2のないしかしSSE4.2およびPCLMULの命令セットの機械のため。 [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouseでファイルシステムな `O_DIRECT` 追加のチューニングなしでサポート(ZFSとBtrFSなど)。 [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 支援を押しであったが,最終的にサブクエリです。 [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([Tcheason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より良い `JOIN ON` キーの抽出 [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) +- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 最小の列の選択を最適化する `SELECT count()` クエリ。 [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([アモスの鳥](https://github.com/amosbird)) +- 追加 `strict` パラメータin `windowFunnel()`. とき `strict` は、 `windowFunnel()` 一意の値にのみ条件を適用します。 [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbabcomment](https://github.com/achimbab)) +- より安全なインタフェース `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) +- オプション行サイズ `--help` オプションに対応した端末のサイズです。 [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([ディマルブ2000](https://github.com/dimarub2000)) +- 無効にする “read in order” キーなしの集約の最適化。 [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([アントン-ポポフ](https://github.com/CurtizJ)) +- のhttpステータスコード `INCORRECT_DATA` と `TYPE_MISMATCH` エラーコードをデフォルトから変更 `500 Internal Server Error` に `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) +- 結合オブジェクトの移動元 `ExpressionAction` に `AnalyzedJoin`. `ExpressionAnalyzer` と `ExpressionAction` 知らない `Join` もはやクラス。 その論理は `AnalyzedJoin` フェイス [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定可能な行き詰まりの分散クエリーの資料はlocalhostでのクエリを送ネットワーク経由で接続します。 [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 複数のテーブルの意味を変更 `RENAME` 可能なデッドロックを避けるため。 [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 書き換えmysqlサーバーの互換性防止への負荷フルパケットペイロードに。 各接続のメモリ消費量の減少 `2 * DBMS_DEFAULT_BUFFER_SIZE` (読み取り/書き込みバッファ)。 [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([ユーリーバラノフ](https://github.com/yurriy)) +- クエリのセマンティクスについて何も知る必要のないast alias interpreting logicをパーサーから外します。 [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) +- もう少し安全な構文解析 `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-copier`:使用を許可する `where_condition` 設定から `partition_key` エイリアスクエリのためのチェック分配の存在についても同様とすでに使用されただけでデータを読み込むクエリ). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) +- 追加オプションのメッセージ引数 `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) +- クライアントでも挿入データの送信中にサーバー例外が発生しました。 [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([ディマルブ2000](https://github.com/dimarub2000)) +- メトリックを追加 `DistributedFilesToInsert` その総数のファイルをファイルシステムを送信リモートサーバーに配布します。 数はすべての破片を合計します。 [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ほとんどの結合を準備ロジックから移動する `ExpressionAction/ExpressionAnalyzer` に `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) +- TSanを修正 [警告](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) +- Linuxの機能の欠如に関するより良い情報メッセージ。 致命的なエラーのログ記録 “fatal” レベル、それはそれが簡単で見つけることになります `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ディスクへの一時データのダンプを有効にして、使用中のメモリ使用量を制限する場合 `GROUP BY`, `ORDER BY` でかチェックのディスクスペース。 修正は、新しい設定を追加します `min_free_disk_space`、ときに空きディスク領域それ小さいし、しきい値は、クエリが停止し、スローされます `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- スレッドによる再帰的なrwlockの削除。 スレッドはクエリ間で再利用されるため、意味がありません。 `SELECT` クエリがロックを取得するスレッド、ロックから別のスレッドの出口から。 同時に、最初のスレッドは次の方法で再利用できます `DROP` クエリ。 これはfalseにつながります “Attempt to acquire exclusive lock recursively” メッセージ [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 分割 `ExpressionAnalyzer.appendJoin()`. 場所を準備する `ExpressionAnalyzer` のために `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加 `mysql_native_password` MySQLの互換性サーバーへの認証プラグイン。 [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([ユーリーバラノフ](https://github.com/yurriy)) +- より少ない数の `clock_gettime` のデバッグ/リリース間のABIの互換性を修正しました `Allocator` (取るに足りない問題)。 [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 移動 `collectUsedColumns` から `ExpressionAnalyzer` に `SyntaxAnalyzer`. `SyntaxAnalyzer` 作る `required_source_columns` 今自体。 [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) +- 設定を追加 `joined_subquery_requires_alias` サブセレクトおよびテーブル関数のエイリアスを要求するには `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) +- 抽出 `GetAggregatesVisitor` クラスから `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) +- `system.query_log`:データタイプの変更 `type` コラムへの `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- 静的リンクの `sha256_password` 認証プラグイン。 [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([ユーリーバラノフ](https://github.com/yurriy)) +- 設定の余分な依存関係を避ける `compile` 働くため。 以前のバージョンでは `cannot open crti.o`, `unable to find library -lc` など。 [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 悪意のあるレプリカから来る可能性のある入力のより多くの検証。 [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- さて `clickhouse-obfuscator` ファイルは `clickhouse-client` パッケージ。 以前のバージョンでは、 `clickhouse obfuscator` (空白を含む)。 [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([ディマルブ2000](https://github.com/dimarub2000)) +- 固定行き詰まりが少なくとも二つのクエリの読み取り少なくとも二つのテーブルに異なる秩序や他のクエリを実行するddl操作の一つです。 固定も非常に珍しいデッドロックします。 [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `os_thread_ids` コラムへの `system.processes` と `system.query_log` のためのデバッグ可能です。 [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 次の場合に発生するphp mysqlnd拡張バグの回避策 `sha256_password` デフォルトの認証プラグインとして使用されます。 [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([ユーリーバラノフ](https://github.com/yurriy)) +- Nullability列が変更された不要な場所を削除します。 [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) +- 設定のデフォルト値 `queue_max_wait_ms` 現在の値(五秒)は意味をなさないので、ゼロに。 この設定を使用している場合は、まれな状況があります。 追加された設定 `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` と `connection_pool_max_wait_ms` 曖昧さ回避のために。 [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 抽出 `SelectQueryExpressionAnalyzer` から `ExpressionAnalyzer`. 選択されていないクエリの最後のクエリを保持します。 [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) +- 重複する入力および出力形式を削除しました。 [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- ユーザーの上書きを許可する `poll_interval` と `idle_connection_timeout` 接続時の設定。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `MergeTree` 現在、追加オプション `ttl_only_drop_parts` (デフォルトでは無効)パーツの部分的な枝刈りを避けるため、パーツ内のすべての行が期限切れになったときに完全に削除されます。 [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Catalonia\_comarques.Kgm](https://github.com/svladykin)) +- セットインデックス関数の型チェック。 関数が間違った型を持つ場合は例外をスローします。 これはubsanでファズテストを修正します。 [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### 性能向上 {#performance-improvement-2} + +- クエリを最適化する `ORDER BY expressions` 句、どこ `expressions` プレフィックスとソートキーが一致している `MergeTree` テーブル。 この最適化は `optimize_read_in_order` 設定。 [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 使用に応じることは、複数のスレッドの中で部品の搭載となります。 [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 集計関数の状態を更新するバッチバリアントを実装。 で与えられる実装になっていると性能です。 [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- を使用して `FastOps` 関数のライブラリ `exp`, `log`, `sigmoid`, `tanh`. FastOpsはマイケルParakhin(YandexのCTO)からの高速ベクトル数学ライブラリです。 改善された性能の `exp` と `log` 機能6回以上。 を機能 `exp` と `log` から `Float32` 引数戻ります `Float32` (以前のバージョンでは、常に戻ります `Float64`). さて `exp(nan)` 戻る可能性がある `inf`. 結果の `exp` と `log` 関数は、真の答えに最も近いマシン表現可能な番号ではないかもしれません。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov))働くfastopsを作るダニラKuteninの変形を使用して [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- の連続したキーの最適化を無効にする `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([azerbaijan.kgm](https://github.com/akuzm)) +- 改善された性能の `simdjson` の動的割り当てを取り除くことによって `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) +- メモリを割り当てるときの事前フォールトページ `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([azerbaijan.kgm](https://github.com/akuzm)) +- 固定性能のバグを修正 `Decimal` 比較。 [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-4} + +- コンパイラ(ランタイムテンプレートのインスタンス化)を削除します。 [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加の性能試験への性能の低下gcc-9により孤立した。 [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- テーブル機能を追加 `numbers_mt` のマルチスレッドバージョンです。 `numbers`. 更新性能試験のハッシュ機能 [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 比較モード `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([ディマルブ2000](https://github.com/dimarub2000)) +- スタックトレース印刷のための最善の努力。 また、追加 `SIGPROF` 実行中のスレッドのスタックトレースを出力するデバッグ信号として。 [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 独自のファイル、パート10のすべての機能。 [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 倍精度の定数を削除 `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([フィリモノフ](https://github.com/filimonov)) +- のための書式設定の変更 `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([azerbaijan.kgm](https://github.com/akuzm)) +- Join作成のためのより良いサブクエリ `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) +- 冗長な条件(pvs studioによって検出された)を削除します。 [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([azerbaijan.kgm](https://github.com/akuzm)) +- 別々のハッシュテーブルインタフェース `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([azerbaijan.kgm](https://github.com/akuzm)) +- 設定のリファクタリング。 [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) +- コメントの追加 `set` インデックス関数。 [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) +- 増oomスコアデバッグ版プログラムを利用しています。. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([azerbaijan.kgm](https://github.com/akuzm)) +- HDFS HAはデバッグビルドで動作します。 [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) +- にテストを追加しました `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kafkaテーブルのマテリアライズドビューのテストを追加します。 [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([イワン](https://github.com/abyss7)) +- よりよい造りの機構を作りなさい。 [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([イワン](https://github.com/abyss7)) +- 固定 `test_external_dictionaries` 非rootユーザーの下で実行された場合の統合。 [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 書き込まれたパケットの合計サイズが `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([ユーリーバラノフ](https://github.com/yurriy)) +- のテストを追加しました `RENAME` テーブルの競合状態 [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 設定のデータ競争をの避けて下さい `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- キャッ [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) +- Mac OSでELFオブジェクトファイルの解析を無効にする。 [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 変更ログジェネレータを改善しようとします。 [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `-Wshadow` GCCに切り替えます。 [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- の廃止されたコードを削除 `mimalloc` ます。 [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `zlib-ng` x86機能を決定し、この情報をグローバル変数に保存します。 これは、異なるスレッドによって同時に行うことができるdefalteInit呼び出しで行われます。 を避けるマルチスレッドに書き込み、図書館で起動します。 [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([azerbaijan.kgm](https://github.com/akuzm)) +- In結合で修正されたバグの回帰テスト [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) +- 固定msanレポート。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正フラッピングttlテスト。 [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 固定偽データレースで `MergeTreeDataPart::is_frozen` フィールド。 [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ファズテストでタイムアウトを修正しました。 以前のバージョ `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- デバッグチェックを追加 `static_cast` 列の。 [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 公式のrpmパッケージでのoracle linuxのサポート。 [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- からの変更json perftests `once` に `loop` タイプ。 [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `odbc-bridge.cpp` 定義 `main()` したがって、それは `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) +- クラッシュのテスト `FULL|RIGHT JOIN` 右側のテーブルのキーにヌルがあります。 [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) +- 念のためにエイリアスの拡張の制限のためのテストを追加しました。 [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- から切り替え `boost::filesystem` に `std::filesystem` 適切な場合。 [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加rpmパッケージです。 [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定のテストを追加する `Unknown identifier` での例外 `IN` セクション。 [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) +- 簡略化 `shared_ptr_helper` 人々はそれを理解困難に直面しているので。 [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定gorillaとdoubledeltaコーデックのパフォーマンステストを追加しました。 [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) +- 統合テストの分割 `test_dictionaries` 4つの別々のテストに。 [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) +- PVS-Studioの警告を修正する `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 使用を許可する `library` ASanの辞書ソース。 [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Prのリストからchangelogを生成するオプションを追加しました。 [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- をロック `TinyLog` 読む場合の貯蔵。 [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([azerbaijan.kgm](https://github.com/akuzm)) +- チェックを破symlinks ci. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- の増加のタイムアウト “stack overflow” デバッグビルドでは長い時間がかかるため、テストします。 [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 二重の空白のチェックを追加しました。 [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正 `new/delete` メモリ追跡ときビルドで消毒。 追跡は明確ではありません。 テストでのメモリ制限の例外を防止するだけです。 [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) +- リンク中に未定義のシンボルのチェックを有効にします。 [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([イワン](https://github.com/abyss7)) +- 再構築を避ける `hyperscan` 毎日です。 [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定ubsanレポートで `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 互換性がないため、クエリプロファイラーをサニタイザーで使用することはできません。 [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加試験のためのリロード辞書の後に失敗するタイマー. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) +- 矛盾を修正する `PipelineExecutor::prepareProcessor` 引数の型。 [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 追加の試験のための悪いuriです。 [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より多くのチェックを追加 `CAST` 機能。 こいつの間にか.ファジィテストです。 [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 追加 `gcc-9` サポートへの `docker/builder` ローカルで画像を構築するコンテナ。 [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) +- 主キーのテスト `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([ディマルブ2000](https://github.com/dimarub2000)) +- 固定試験の影響を受けゆっくりとしたスタックトレースの印刷もできます。 [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- クラッシュのテストケースを追加する `groupUniqArray` 固定で [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([azerbaijan.kgm](https://github.com/akuzm)) +- 固定インデックス突然変異テスト。 [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) +- パフォーマンステス [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([azerbaijan.kgm](https://github.com/akuzm)) +- マテリアライズドビューは、疑わしい低基数タイプに関する設定に関係なく、低基数タイプで作成できるようになりました。 [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) +- 更新されたテスト `send_logs_level` 設定。 [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Gcc-8.2でビルドを修正しました。 [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) +- 内部libc++でビルドを修正しました。 [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([イワン](https://github.com/abyss7)) +- 共有ビルドを修正する `rdkafka` ライブラリ [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([イワン](https://github.com/abyss7)) +- Mac OSビルドの修正(不完全)。 [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) +- 修正 “splitted” ビルド。 [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- その他のビルドの修正: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([アモスの鳥](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([イワン](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) + +#### 下位互換性のない変更 {#backward-incompatible-change-3} + +- 削除が使用されることが少なテーブル機能 `catBoostPool` および貯蔵 `CatBoostPool`. このテーブル機能を使用したら、電子メールをに書いて下さい `clickhouse-feedback@yandex-team.com`. CatBoost統合は引き続きサポートされることに注意してください。 [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 無効にする `ANY RIGHT JOIN` と `ANY FULL JOIN` デフォルトでは。 セット `any_join_distinct_right_table_keys` それらを有効にする設定。 [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) + +## クリックハウスリリース19.13 {#clickhouse-release-19-13} + +### クリックハウスリリース19.13.6.51,2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} + +#### バグ修正 {#bug-fix-9} + +- このリリースも含む全てのバグ修正から19.11.12.69. + +### ClickHouseリリース19.13.5.44、2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} + +#### バグ修正 {#bug-fix-10} + +- このリリースには、19.14.6.12のすべてのバグ修正も含まれています。 +- 実行中のテーブルの一貫性のない状態を修正 `DROP` クエリーのための複製テーブルが飼育係アクセスすることはできません。 [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- StorageMergeでのデータレースの修正 [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ソケットから無限のrecvにつながるクエリプロファイラで導入されたバグを修正。 [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) +- 実行中の過度のcpu使用率を修正 `JSONExtractRaw` ブール値に対する関数です。 [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) +- マテリアライズドビュ [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([イワン](https://github.com/abyss7)) +- テーブル機能 `url` この脆弱性により、攻撃者が要求に任意のHTTPヘッダーを挿入することができました。 この問題は、 [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 役に立たない修正 `AST` セットの索引のチェックイン。 [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) +- の固定解析 `AggregateFunction` クエリに埋め込まれた値。 [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) +- 固定間違った動作の `trim` 機能ファミリ。 [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.13.4.32、2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} + +#### バグ修正 {#bug-fix-11} + +- このリリースには、19.11.9.52と19.11.10.54のすべてのバグセキュリティ修正も含まれています。 +- 固定データレースで `system.parts` テーブルと `ALTER` クエリ。 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ストリームのヘッダーの不一致を修正したのは、sampleとprewhereで空の分散テーブルからの読み取りの場合でした。 [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 使用して固定クラッシュ `IN` タプルを含むサブクエリを含む句。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- 同じ列名のケースを修正 `GLOBAL JOIN ON` セクション。 [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定したときにクラッシュする場合が鋳造型 `Decimal` それをサポートしていません。 代わりに例外をスロー。 [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) +- で固定クラッシュ `extractAll()` 機能。 [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) +- 以下のためのクエリ変換 `MySQL`, `ODBC`, `JDBC` テーブル関数は現在、 `SELECT WHERE` 複数のクエリ `AND` 式。 [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([ディマルブ2000](https://github.com/dimarub2000)) +- MySQL8の統合のための追加された以前の宣言チェック。 [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([ラファエルdavid tinoco](https://github.com/rafaeldtinoco)) + +#### セキュリティ修正 {#security-fix-1} + +- 修二の脆弱性がコーデックに減圧相(悪意のあるユーザーが可能で圧縮データにつながるバッファオーバーフローの減圧). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouseリリース19.13.3.26、2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} + +#### バグ修正 {#bug-fix-12} + +- 修正 `ALTER TABLE ... UPDATE` とテーブルのクエリ `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- タプルを持つサブクエリでin句を使用するときにnpeを修正しました。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- 固定問題の場合はュレプリカになり、生存していてデータ部分が撤去されることによります。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- CSVを解析する問題を修正しました [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- システム内の固定データレース.パーツテーブルと変更クエリ。 この修正 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- メモリの破損につながる可能性があり、突然変異で間違ったコードを修正. アドレスの読み取りによる固定segfault `0x14c0` それは同時に起こったかもしれない `DROP TABLE` と `SELECT` から `system.parts` または `system.parts_columns`. 突然変異クエリの準備の競合状態を修正しました。 によるデッドロックを修正 `OPTIMIZE` レプリケートされたテーブルと同時変更操作のような変更。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 後に固定可能なデータ損失 `ALTER DELETE` 索引をスキップしてテーブルを照会します。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### セキュリティ修正 {#security-fix-2} + +- 攻撃者は、zookeeperへの書き込みアクセス権を持っており、clickhouseの実行ネットワークから利用できるカスタムサーバーを実行することができる場合,それはclickhouseのレ きものレプリカまでデータを取得すから悪意のあるレプリカで力clickhouse-サーバへの書き込みを任意のパスにファイルシステム. eldar zaitov、yandexの情報セキュリティチームによって発見された。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.13.2.19、2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} + +#### 新しい機能 {#new-feature-5} + +- サンプリングプロファイラーに照会です。 [例えば](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) +- 列のリストを指定できるようにする `COLUMNS('regexp')` より洗練された変種のように動作する表現 `*` アスタリスク [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CREATE TABLE AS table_function()` 可能になりました [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([ディマルブ2000](https://github.com/dimarub2000)) +- デフォルトでは、確率的勾配降下のためのadamオプティマイザが `stochasticLinearRegression()` と `stochasticLogisticRegression()` 集計機能を示すためのもので、良質なほとんど調整することがあります。 [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) +- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([アンディヤング](https://github.com/andyyzh)) +- `RENAME` 問合せで出てきますが、すべての倉庫. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([イワン](https://github.com/abyss7)) +- 現在お客様の受信ログからサーバに要求レベルに設定 `send_logs_level` サーバー設定で指定されたログレベルにかかわらず。 [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) + +#### 下位互換性のない変更 {#backward-incompatible-change-4} + +- を設定 `input_format_defaults_for_omitted_fields` デフォルトでは有効です。 分散テーブルの挿入では、この設定をクラスタで同じにする必要があります(更新をロールする前に設定する必要があります)。 省略されたフィールドの複雑な既定の式の計算を有効にします `JSONEachRow` と `CSV*` フォーマット。 この挙動があるが無視できる性能の差です。 [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([azerbaijan.kgm](https://github.com/akuzm)) + +#### 実験の特徴 {#experimental-features} + +- 新規クエリ処理パイプライン。 使用 `experimental_use_processors=1` それを有効にするオプション。 あなた自身の悩みのための使用。 [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### バグ修正 {#bug-fix-13} + +- Kafkaの統合は、このバージョンで修正されました。 +- 固定 `DoubleDelta` の符号化 `Int64` 大きいのため `DoubleDelta` 値、改善 `DoubleDelta` ランダムデータのエンコード `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) +- の固定過大評価 `max_rows_to_read` 設定の場合 `merge_tree_uniform_read_distribution` は0に設定されます。 [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 改善 {#improvement-4} + +- 次の場合に例外をスローする `config.d` ファイルを持っていないので対応するルート要素としての設定ファイル [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([ディマルブ2000](https://github.com/dimarub2000)) + +#### 性能向上 {#performance-improvement-3} + +- 最適化 `count()`. 今では(可能な場合)最小の列を使用しています。 [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([アモスの鳥](https://github.com/amosbird)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-5} + +- パフォーマンステス [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([azerbaijan.kgm](https://github.com/akuzm)) +- 外部でビルドを修正する `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([イワン](https://github.com/abyss7)) +- 共有ビルドを修正する `rdkafka` ライブラリ [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([イワン](https://github.com/abyss7)) + +## ClickHouseリリース19.11 {#clickhouse-release-19-11} + +### ClickHouseリリース19.11.13.74,2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} + +#### バグ修正 {#bug-fix-14} + +- 固定珍しいクラッシュ `ALTER MODIFY COLUMN` そして、マージ/変更された部分のいずれかが空(0行)のときに垂直マージ。 [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- の手動update `SIMDJSON`. これにより、偽のjson診断メッセージでstderrファイルが氾濫する可能性が修正されます。 [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) +- とのバグを修正 `mrk` 突然変異のファイル拡張子 ([alesapin](https://github.com/alesapin)) + +### ClickHouseリリース19.11.12.69、2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} + +#### バグ修正 {#bug-fix-15} + +- 固定性能の劣化指標分析複雑なテンキーの大きます。 この修正 [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- を避ける希少sigsegvを送信するデータテーブル分散型エンジン (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) +- 修正 `Unknown identifier` 複数の結合を持つ。 この修正 [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouseリリース19.11.11.57,2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} + +- カフカ空のトピックから選択する際にsegfaultsを引き起こす論理的なエラーを修正。 [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([イワン](https://github.com/abyss7)) +- 関数の修正 `АrrayEnumerateUniqRanked` paramsに空の配列があります。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) + +### ClickHouseリリース19.11.10.54,2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} + +#### バグ修正 {#bug-fix-16} + +- Kafkaメッセージのオフセットを手動で保存すると、すべてのパーティションに対して一度にコミットできます。 潜在的な重複を修正 “one consumer - many partitions” シナリオだ [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([イワン](https://github.com/abyss7)) + +### ClickHouseリリース19.11.9.52,2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} + +- キャッ [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) +- 機能のバグを修正 `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) +- 修正 `JSONExtract` 関数を抽出しながら `Tuple` JSONから。 [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) +- 後に固定可能なデータ損失 `ALTER DELETE` 索引をスキップしてテーブルを照会します。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) +- 固定性能テスト。 [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 寄木細工:ブール値列の読み取りを修正。 [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定間違った動作の `nullIf` 定数引数の関数。 [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([ギヨームタッセリー](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 通常のサーバーの再起動時にkafkaメッセージの重複の問題を修正。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([イワン](https://github.com/abyss7)) +- ときに長い問題を修正しました `ALTER UPDATE` または `ALTER DELETE` 通常のマージが実行されない場合があります。 利用可能な十分な空きスレッドがない場合、突然変異の実行を防ぎます。 [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) +- 処理によるエラーの修正 “timezone” サーバー構成ファイルで。 [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- カフカのテストを修正。 [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([イワン](https://github.com/abyss7)) + +#### セキュリティ修正 {#security-fix-3} + +- 攻撃者がzookeeperへの書き込みアクセス権を持ち、clickhouseが実行されるネットワークから利用可能なカスタムサーバーを実行できる場合、それはclickhouseレプリカとして きものレプリカまでデータを取得すから悪意のあるレプリカで力clickhouse-サーバへの書き込みを任意のパスにファイルシステム. eldar zaitov、yandexの情報セキュリティチームによって発見された。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.11.8.46,2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} + +#### バグ修正 {#bug-fix-17} + +- 修正 `ALTER TABLE ... UPDATE` とテーブルのクエリ `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- タプルを持つサブクエリでin句を使用するときにnpeを修正しました。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- 固定問題の場合はュレプリカになり、生存していてデータ部分が撤去されることによります。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- CSVを解析する問題を修正しました [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- システム内の固定データレース.パーツテーブルと変更クエリ。 この修正 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- メモリの破損につながる可能性があり、突然変異で間違ったコードを修正. アドレスの読み取りによる固定segfault `0x14c0` それは同時に起こったかもしれない `DROP TABLE` と `SELECT` から `system.parts` または `system.parts_columns`. 突然変異クエリの準備の競合状態を修正しました。 によるデッドロックを修正 `OPTIMIZE` レプリケートされたテーブルと同時変更操作のような変更。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.11.7.40,2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} + +#### バグ修正 {#bug-fix-18} + +- Kafkaの統合は、このバージョンで修正されました。 +- 使用しているときにsegfaultを修正 `arrayReduce` 定数の引数の場合。 [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定 `toFloat()` 単調性 [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([ディマルブ2000](https://github.com/dimarub2000)) +- 有効にしてsegfaultを修正 `optimize_skip_unused_shards` シャーディングキーがない [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) +- 固定ロジックの `arrayEnumerateUniqRanked` 機能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MySQLハンドラから余分な冗長ロギングを削除しました。 [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 間違った動作と可能なsegfaultsを修正 `topK` と `topKWeighted` 集計関数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) +- 仮想列を公開しないでください `system.columns` テーブル。 これは、下位互換性のために必要です。 [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 複雑なキーキャッシュ辞書の文字列フィールドのメモリ割り当てのバグを修正。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- Bug Fixとを可能に適応粒度の作成時に新たなレプリカのために `Replicated*MergeTree` テーブル。 [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- 修正の無限ループ読み込み時にカフカメッセージ [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) +- 固定の可能性に作製したクエリがサーバのクラッシュによるスタックオーバーフローアプリケーションのパーサの可能性スタックオーバーフロー `Merge` と `Distributed` テーブル [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定gorillaエンコードエラーの小型dnaの塩基配列を決定した。 [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) + +#### 改善 {#improvement-5} + +- ユーザーの上書きを許可する `poll_interval` と `idle_connection_timeout` 接続時の設定。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.11.5.28、2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} + +#### バグ修正 {#bug-fix-19} + +- 固定の可能性を掛けクエリの場合はサーバが過負荷状態で運転されています。 [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定fpeにyandexconsistenthashます。 この修正 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- の変換のバグを修正しました `LowCardinality` タイプ `AggregateFunctionFactory`. この修正 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 修正の解析 `bool` からの設定 `true` と `false` 構成ファイル内の文字列。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- クエリの互換性のないストリ `Distributed` テーブルオーバ `MergeTree` テーブルの一部 `WHERE` に移動します `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- 固定オーバーフローの整数部署名-タイプを符号なしタイプです。 この修正 [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 下位互換性のない変更 {#backward-incompatible-change-5} + +- `Kafka` まだ壊れてる + +### ClickHouseリリース19.11.4.24,2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} + +#### バグ修正 {#bug-fix-20} + +- のを修正した。筆二次指標マーク適応型粒度. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- 修正 `WITH ROLLUP` と `WITH CUBE` の修飾子 `GROUP BY` 二レベルの集計。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 固定こつ `JSONExtractRaw` 機能。 固定 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ExternalLoader::reloadOutdated()のセグフォルトを修正しました。 [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) +- 固定の場合はサーバが切れることがあり聞くソケットがセットのリスクマネジメントの継続け残ります。 ツつィツ姪“ツつ”ツ債ツづュツつケツづ債つアツつソツづァ サーバーがエラーを返す場合があります `bad_function_call` 残りのクエリの場合。 [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ODBC、MySQL、ClickHouseとHTTP経由で外部辞書の初期ロードのための更新フィールド上の固定役に立たないと間違った条件。 この修正 [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- のキャストで修正された無関係な例外 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 非決定性の結果を修正する “uniq” 極端なまれなケースでの集計関数。 バグはすべてのClickHouseバージョンに存在していました。 [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Segfault私たちは少し高すぎる設定CIDRに機能 `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 固定小さなメモリリークがサーバに捨てる多くの例外から多くの異なるコンテキストを共有します。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定の状態で消費者も一時停止前の契約とな再開します。 [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([イワン](https://github.com/abyss7) 注このカフカを砕このバージョン。 +- エラーで完了した前の読み取り操作からkafkaデータバッファーをクリアします [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([ニコライ](https://github.com/bopohaa) 注このカフカを砕このバージョン。 +- それ以来 `StorageMergeTree::background_task_handle` で初期化される。 `startup()` その `MergeTreeBlockOutputStream::write()` 初期化の前に使用しようとするかもしれません。 すぐチェックインの場合は初期化されます。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([イワン](https://github.com/abyss7)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-6} + +- 追加された公式 `rpm` パッケージ。 [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) +- ビルドする機能を追加する `.rpm` と `.tgz` パッケージと `packager` スクリプト [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) +- 以下のための修正 “Arcadia” ビルドシステム。 [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) + +#### 下位互換性のない変更 {#backward-incompatible-change-6} + +- `Kafka` このバージョンでは壊れている。 + +### ClickHouseリリース19.11.3.11,2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} + +#### 新しい機能 {#new-feature-6} + +- 準備文のサポートが追加されました。 [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alexander](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `DoubleDelta` と `Gorilla` 列コーデック [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) +- 追加 `os_thread_priority` を制御することを可能にする設定 “nice” OSが動的スケジューリング優先順位を調整するために使用するクエリ処理スレッドの値。 それは必要です `CAP_SYS_NICE` 動作する機能。 これは [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 実装 `_topic`, `_offset`, `_key` カフカエンジンの列 [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([イワン](https://github.com/abyss7) 注このカフカを砕このバージョン。 +- 集計関数コンビネータを追加 `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) +- 集計関数 `groupArrayMovingSum(win_size)(x)` と `groupArrayMovingAvg(win_size)(x)`、ウィンドウサイズの制限の有無にかかわらず、移動の合計/平均を計算します。 [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) +- Synonimを追加 `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) +- インターゲートh3機能 `geoToH3` ユーバーから. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### バグ修正 {#bug-fix-21} + +- 非同期updateでdnsキャッシュを実装します。 個別のスレッドで解決すべてのホストを更新dnsキャッシュが期間(設定 `dns_cache_update_period`). ホストのipが頻繁に変更されるときに役立ちます。 [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([アントン-ポポフ](https://github.com/CurtizJ)) +- Segfaultを修正する `Delta` 32ビットサイズ未満の値を持つ列に影響を与えるコーデック。 バグはランダムメモリの破損につながった。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- ブロック内の非物理列とttlマージでsegfaultを修正しました。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([アントン-ポポフ](https://github.com/CurtizJ)) +- との部分のチェックでまれなバグを修正 `LowCardinality` コラム 以前は `checkDataPart` 常に `LowCardinality` コラム [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- 回避掛けに接続した場合、サーバスレッドプールを行います。 それはからの接続のために重要です `remote` 長い接続タイムアウトがある場合、テーブル関数またはレプリカなしのシャードへの接続。 この修正 [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 定数引数のサポート `evalMLModel` 機能。 この修正 [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定に問題がclickhouse判断したデフォルトのタイムゾーンとして `UCT` 代わりに `UTC`. この修正 [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定バッファアンダーフローで `visitParamExtractRaw`. この修正 [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 今すぐ配布 `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` クエリはリーダーレプリカで直接実行されます。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- 修正 `coalesce` のために `ColumnConst` と `ColumnNullable` +関連する変更。 [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正する `ReadBufferFromKafkaConsumer` なで読む新しいメッセージ `commit()` たとえそれが以前に失速したとしても [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([イワン](https://github.com/abyss7)) +- 修正 `FULL` と `RIGHT` 結合時の結合結果 `Nullable` 右のテーブルのキー。 [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) +- 優先度の低いクエリの無限スリープの可能性のある修正。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- これにより、いくつかのクエリがquery\_logの後に表示されないことがあります `SYSTEM FLUSH LOGS` クエリ。 [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 固定 `heap-use-after-free` 阿讃注意ClusterCopierによる腕時計を利用するようにしてすでに削除され複写機のオブジェクトです。 [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 固定間違った `StringRef` の実装によって返されるポインタ `IColumn::deserializeAndInsertFromArena`. このバグは単体テストのみに影響しました。 [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 同じ名前の列をマスクするソースおよび中間配列の結合列を防ぎます。 [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) +- MySQLスタイル識別子の引用とMySQLエンジンへの挿入と選択クエリを修正しました。 [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([冬張](https://github.com/zhang2014)) +- さて `CHECK TABLE` queryは、MergeTreeエンジンファミリで動作します。 各パート(またはsimplierエンジンの場合はファイル)のチェックステータスとメッセージが返されます。 また、壊れた部分のフェッチのバグを修正しました。 [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) +- SPLIT\_SHARED\_LIBRARIESランタイムを修正 [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) +- 固定タイムゾーンの初期化 `/etc/localtime` シンボリックリン `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- clickhouse-コピー機:シャットダウン時に使用-after freeを修正 [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) +- 更新 `simdjson`. ゼロバイトを持ついくつかの無効なJSONsが正常に解析する問題を修正しました。 [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- SystemLogsのシャットダウンを修正 [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([アントン-ポポフ](https://github.com/CurtizJ)) +- Invalidate\_queryの条件が辞書に依存しているときにハングする問題を修正しました。 [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### 改善 {#improvement-6} + +- クラスター構成で解決できないアドレスを許可します。 彼らは利用できないとみなされ、すべての接続試行で解決しようとします。 これはkubernetesに特に便利です。 この修正 [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- アイドル状態のtcp接続を閉じる(デフォルトでは一時間待ち)。 これは、すべてのサーバーが他のすべてのサーバーへの接続プールを保持する可能性があり、ピーククエリの同時実行の後に接続が停止するためです。 この修正 [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より良い品質の `topK` 機能。 新しい要素の重みが大きい場合、最後の要素を削除するようにSavingSpace設定の動作を変更しました。 [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- URLの機能と作業領域は今では不完全なUrlなスキーム [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) +- に追加されたチェックサム `system.parts_columns` テーブル。 [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- 追加 `Enum` synonimとしてのデータ型 `Enum8` または `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([ディマルブ2000](https://github.com/dimarub2000)) +- フルビット転置変異体のための `T64` コーデック。 より良い圧縮につながる可能性がある `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) +- 条件に `startsWith` 機能は主キーを使用することができます。 この修正 [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) と [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([ディマルブ2000](https://github.com/dimarub2000)) +- 使用を許可する `clickhouse-copier` クロス-複製クラスタトポロジーを許可する空のデータベースの名前です。 [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) +- 使用 `UTC` システム上のデフォルトのタイムゾーンとして `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` 印刷され、サーバまたはクライアン [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 関数の浮動小数点引数のサポートを返しました `quantileTiming` 下位互換性のため。 [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- エラーメッセージの列がないテーブルを表示します。 [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([イワン](https://github.com/abyss7)) +- さまざまなユーザーが同じquery\_idで実行クエリを許可しない [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) +- より強固なコードの送信メトリクスをグラファイトを表してい それは長い倍数の間に働きます `RENAME TABLE` オペレーション [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- よりエラーメッセージが表示されますのでthreadpoolできない予定、タスクを実行します。 この修正 [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- NgramSearchを反転させると、より直感的になります [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) +- HDFS engine builderでのユーザー解析の追加 [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) +- 更新のデフォルト値 `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) +- 廃止された設定の概念を追加しました。 廃止された設定 `allow_experimental_low_cardinality_type` 効果なしで使用することができます。 [0f15c01c6802f7ce1a1494c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) + +#### 性能向上 {#performance-improvement-4} + +- 増加数の河川から選択するとmergeテーブルにより均一に分布す。 追加された設定 `max_streams_multiplier_for_merge_tables`. この修正 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-7} + +- Clickhouseの異なるバージョンとクライアン [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) +- テスト対象の情報を毎にコミットを引きます。 [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) +- カスタムアロケータをサポートするaddress sanitizerと連携 (`Arena` と `ArenaWithFreeLists`)より良いデバッグのための “use-after-free” エラー。 [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([azerbaijan.kgm](https://github.com/akuzm)) +- に切り替える [LLVM libunwindの実装](https://github.com/llvm-mirror/libunwind) C++例外処理およびスタックトレース印刷用 [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) +- さらに二つの警告を追加-weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- メモリ消毒剤とclickhouseを構築することができます。 [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定ubsanレポートについて `bitTest` ファズテストの機能。 [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Docker:認証を必要とするClickHouseインスタンスを初期化する可能性を追加しました。 [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) +- バージョン1.1.0にlibrdkafkaを更新 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([イワン](https://github.com/abyss7)) +- 追加グローバルタイムアウトのための統合の試験を無効にし試験ます。 [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) +- いくつかのthreadsanitizerの障害を修正します。 [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([azerbaijan.kgm](https://github.com/akuzm)) +- その `--no-undefined` オプション力、リンカーをチェックすべての外部の名の存在をリンク 分割ビルドモードでライブラリ間の実際の依存関係を追跡することは非常に便利です。 [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([イワン](https://github.com/abyss7)) +- のための追加された性能試験 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Gcc-7との互換性を修正しました。 [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Gcc-9のサポートが追加されました。 この修正 [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Libunwindが正しくリンクできない場合のエラーを修正。 [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- PVS-Studioによって検出されたいくつかの警告を修正しました。 [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加された初期サポート `clang-tidy` 静的な検光子。 [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- BSD/Linuxエンディアンマクロを変換する( ‘be64toh’ と ‘htobe64’)Mac OS Xに相当するもの [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([フーチェン](https://github.com/fredchenbj)) +- 統合テストガイドの改善。 [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Macosx+gcc9でのビルドの修正 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([フィリモノフ](https://github.com/filimonov)) +- 難しいタイプミスを修正:aggreagte-\>aggregate。 [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([azerbaijan.kgm](https://github.com/akuzm)) +- Freebsdビルドの修正 [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) +- 追加リンク実験youtubeチャンネルサイト [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) +- CMake:カバレッジフラグのオプションを追加:WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) +- いくつかのインラインpodarrayの初期サイズを修正。 [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([azerbaijan.kgm](https://github.com/akuzm)) +- clickhouse-サーバー.postinst:centos6のos検出を修正 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) +- 追加されたアーチlinuxパッケージ生成。 [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 共通/設定を分割します。h by libs(dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) +- 以下のための修正 “Arcadia” ムの構築 [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) +- 型にはまらないビルドの修正(gcc9、サブモジュールなし) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) +- バグが発生しやすいことが証明されているため、unalignedstoreで明示的な型を必要とします [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([azerbaijan.kgm](https://github.com/akuzm)) +- Macosのビルドを修正 [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([フィリモノフ](https://github.com/filimonov)) +- ここで要求されたより大きなデータセットを持つ新しいjit機能に関する性能試験 [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 走行状態での試験はストレステスト [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) + +#### 下位互換性のない変更 {#backward-incompatible-change-7} + +- `Kafka` このバージョンでは壊れている。 +- 有効 `adaptive_index_granularity` =新しいのためのデフォルトで10MB `MergeTree` テーブル。 バージョン19.11以降で新しいMergeTreeテーブルを作成した場合、19.6より前のバージョンへのダウングレードは不可能になります。 [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) +- Yandexのによって使用された廃止された文書化されていない埋め込まれた辞書を削除。メトリカ を機能 `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` もはや利用できません。 これらの機能を使用している場合は、電子メールをclickhouse-feedback@yandex-team.com。注:最後の瞬間に我々はしばらくの間、これらの機能を維持することを決めました。 [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouseリリース19.10 {#clickhouse-release-19-10} + +### クリックハウスリリース19.10.1.5,2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} + +#### 新しい機能 {#new-feature-7} + +- 新しい列コーデックを追加: `T64`. (U)IntX/EnumX/Data(Time)/DecimalX列用に作成されます。 定数値または小さい範囲値を持つ列に適しているはずです。 コーデック自体は、拡大または再圧縮せずにデータ型を縮小できます。 [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) +- データベースエンジ `MySQL` できる全てのテーブルをリモートMySQLサーバー [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([冬張](https://github.com/zhang2014)) +- `bitmapContains` 実装。 それは2xより速いです `bitmapHasAny` 第二のビットマップが一つの要素を含む場合。 [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) +- のサポート `crc32` 関数(MySQLやPHPとまったく同じ動作)。 ハッシュ関数が必要な場合は使用しないでください。 [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) +- 実装 `SYSTEM START/STOP DISTRIBUTED SENDS` 非同期挿入を制御するクエリ `Distributed` テーブル。 [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([冬張](https://github.com/zhang2014)) + +#### バグ修正 {#bug-fix-22} + +- マージ制限のクエリ実行制限および最大パーツサイズを無視する。 [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 通常のブロックの重複排除(非常にまれ)と重複ブロックの挿入(より頻繁に)につながる可能性のあるバグを修正しました。 [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) +- 機能の修正 `arrayEnumerateUniqRanked` 空の配列を持つ引数の場合 [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) +- な購読カフカ題なく意思をポーリングメッセージ. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([イワン](https://github.com/abyss7)) +- 設定を行う `join_use_nulls` Nullable内にできない型に対しては何の効果も得られません [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) +- 固定 `Incorrect size of index granularity` エラー [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([コラクススター](https://github.com/coraxster)) +- 小数変換オーバーフローを修正 [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([コラクススター](https://github.com/coraxster)) +- フラッシュバッファの場合 `WriteBufferFromHDFS`のデストラクタが呼び出されます。 これにより、 `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) + +#### 改善 {#improvement-7} + +- 空のセルを `CSV` としてデフォルト値を設定 `input_format_defaults_for_omitted_fields` は有効です。 [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([azerbaijan.kgm](https://github.com/akuzm)) +- 外部辞書の非ブロッキングロード。 [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) +- ネットワークタイムアウトできるダイナミックな変化のための既存の接続に従って設定します。 [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) +- を使用して “public\_suffix\_list” 機能のため `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. これは、 `gperf` ファイルから生成されたリスト:https://publicsuffix.org/list/public\_suffix\_list.dat(例えば、今我々はドメインを認識する `ac.uk` 有意ではない)。 [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 採用 `IPv6` システムテーブルのデータ型。 `system.processes` と `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MySQL互換性プロトコルとの接続にセッションを使用する。 \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([ユーリーバラノフ](https://github.com/yurriy)) +- サポートより `ALTER` クエリ `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) +- サポート `` のセクション `clickhouse-local` 設定ファイル。 [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) +- クエリの実行を許可する `remote` テーブル機能 `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) + +#### 性能向上 {#performance-improvement-5} + +- MergeTree列の最後に最後のマークを書き込む可能性を追加します。 これにより、テーブルデータ範囲外のキーの無駄な読み込みを回避できます。 適応インデックスの粒度が使用されている場合にのみ有効になります。 [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) +- 非常に遅いファイルシステム上のmergetreeテーブルのパフォーマンスの向上 `stat` シスコール [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定性能の劣化からの読み出しmergetreeテーブルで導入されたバージョン19.6. 修正\#5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-8} + +- 実装 `TestKeeper` テストに使用されるZooKeeperインタフェースの実装として [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) +- これからは `.sql` 試験走行ができるによって切り離されたサーバを並列には、ランダムなデータベースです。 それらをより速く実行し、カスタムサーバー構成で新しいテストを追加し、異なるテストが互いに影響しないことを確認します。 [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([イワン](https://github.com/abyss7)) +- 削除 `` と `` 性能テストから [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) +- 固定 “select\_format” 性能試験のための `Pretty` 形式 [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## クリックハウスリリース19.9 {#clickhouse-release-19-9} + +### クリックハウスリリース19.9.3.31,2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} + +#### バグ修正 {#bug-fix-23} + +- 32ビットサイズ未満の値を持つ列に影響を与えるデルタコーデックでsegfaultを修正しました。 バグはランダムメモリの破損につながった。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- LowCardinalityのコラムと部分の点検でまれな虫を修理して下さい。 [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- ブロック内の非物理列とttlマージでsegfaultを修正しました。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 低優先度のクエリの潜在的な無限の睡眠を修正しました。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定方法clickhouse判断したデフォルトのタイムゾーンとしてuctの代わりにutcです。 [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- のを修正した。約の実行の分散drop/alter/quick/最適化クラスターに関するお問い合わせフォロワレプリカの前にリーダーレプリカ. 今、彼らはリーダーのレプリカに直接実行されます。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- 固定レースの条件を回避することが可能となり、一部のクエリーのような画面が、表示されないでquery\_logぐにシステムのフラッシュログを返します。 [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 定数引数のサポートがないことを追加 `evalMLModel` 機能。 [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### クリックハウスリリース19.9.2.4,2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} + +#### 新しい機能 {#new-feature-8} + +- 凍結する部品についての印刷物情報 `system.parts` テーブル。 [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) +- 引数に設定されていない場合は、ttyでclickhouse-client startにクライアントパスワードを尋ねる [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) +- 実装 `dictGet` と `dictGetOrDefault` 小数タイプの関数。 [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 改善 {#improvement-8} + +- Debian init:サービス停止タイムアウトの追加 [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) +- 疑わしいタイプのテーブルを作成するには、デフォルトで禁止されている設定を追加します [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) +- 回帰機能を返却時の重量モデルとして用いられていない状態で機能 `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) +- 回帰方法の名前を変更して改善します。 [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) +- 明のインタフェースを文字列が揃. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) + +#### バグ修正 {#bug-fix-24} + +- カフカの潜在的なデータ損失を修正 [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([イワン](https://github.com/abyss7)) +- 潜在的な無限ループを修正 `PrettySpace` ゼロ列で呼び出されたときの形式 [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) +- 線形モデルのuint32オーバーフローバグを修正。 非constモデル引数のeval mlモデルを許可します。 [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `ALTER TABLE ... DROP INDEX IF EXISTS ...` なる例外を提供される場合指数が存在しない [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- セグメントフォールトを修正 `bitmapHasAny` スカラーサブクエリ [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- 固定の場合にはエラー複製を接続プールなリトライを解決するホストでも、dnsキャッシュした。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- 固定 `ALTER ... MODIFY TTL` レプリケートされたマーゲットリーで [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([アントン-ポポフ](https://github.com/CurtizJ)) +- マテリアライズ列を使用して分散テーブルに挿入を修正 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) +- Truncate Joinストレージの割り当ての問題を修正 [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([Tcheason](https://github.com/TCeason)) +- に最近のバージョンのパッケージtzdata一部のファイルsymlinksます。 現在の仕組みを検出するデフォルトのタイムゾーンの故障が考えられ、間違った名前に一部のタイムゾーン. 少なくとも、提供されていれば、タイムゾーン名をtzの内容に強制します。 [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([イワン](https://github.com/abyss7)) +- 一定の針が合計で少なくとも16kbの長さである場合、multivolnitsky searcherでいくつかの非常にまれなケースを修正します。 このアルゴリズムは、以前の結果を見逃したり上書きしたりして、誤った結果につながります `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) +- ExternalData要求の設定でClickHouseの設定を使用できない場合の問題を修正しました。 また、今のところ、設定 `date_time_input_format` と `low_cardinality_allow_in_native_format` 名前のあいまいさのために使用することはできません(外部データではテーブル形式と解釈でき、クエリでは設定にすることができます)。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) +- 部品は飼育係からそれらを落とすことなく、fsからのみ削除されたバグを修正。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- 削除デバッグログインからmysqlプロトコル [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- DDLクエリ処理中にZNONODEをスキップ [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- 修正ミックス `UNION ALL` 結果列の種類。 結果の列のデータ型および列の型が一致しない場合がありました。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- 間違った整数の例外をスローする `dictGetT` 機能の代わりにクラッシュ。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- ハッシュ化された辞書のための間違ったelement\_countとload\_factorを修正 `system.dictionaries` テーブル。 [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-9} + +- 固定ビルドなし `Brotli` HTTP圧縮のサポート (`ENABLE_BROTLI=OFF` cmake変数)。 [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) +- Roaringを含める。轟音/轟音としてh。h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) +- ハイパースキャンでgcc9の警告を修正(\#lineディレクティブは悪です!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) +- Gcc-9でコンパイルする際のすべての警告を修正。 いくつかのcontribの問題を修正しました。 Gcc9氷を修正しbugzillaに提出. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) +- Lldとのリンクを修正 [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 辞書で使用されていない特殊化を削除する [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) +- 向上性能試験のためのフォーマットと構文解析表の異なる種類のファイル [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) +- 並列テスト実行のための修正 [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) +- Docker:clickhouse-testからconfigsを使う [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) +- FreeBSD用のコンパイルを修正 [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) +- Boostを1.70にアップグレード [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) +- サブモジュールとしてビルドclickhouseを修正 [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) +- JSONExtractパフォーマンステストの改善 [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) + +## ClickHouseリリース19.8 {#clickhouse-release-19-8} + +### ClickHouseリリース19.8.3.8、2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} + +#### 新しい機能 {#new-features} + +- JSONで動作する機能を追加しました [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) +- 多くの言語に存在するbasename関数と同様の動作を持つ関数basenameを追加します (`os.path.basename` pythonでは, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 追加 `LIMIT n, m BY` または `LIMIT m OFFSET n BY` LIMIT BY句にnのオフセットを設定する構文。 [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 追加された新しいデータ型 `SimpleAggregateFunction` を持つことができます。 `AggregatingMergeTree`. これは、次のような単純な関数でのみ使用できます `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) +- 関数の非定数引数のサポートが追加されました `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) +- 機能追加 `skewPop`, `skewSamp`, `kurtPop` と `kurtSamp` シーケンスの歪度、標本の歪度、尖度、標本の尖度をそれぞれ計算します。 [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) +- 支援の名前変更操作のための `MaterializeView` ストレージ。 [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 追加のサーバで接続するclickhouse mysqlを使用してクライアント [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([ユーリーバラノフ](https://github.com/yurriy)) +- 追加 `toDecimal*OrZero` と `toDecimal*OrNull` 機能。 [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) +- 機能のサポート十進のタイプ: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`、medianExactWeighted。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加 `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) +- 追加 `format` 機能。 引数にリストされた文字列を含む定数パターン(簡略化されたPython形式のパターン)の書式設定。 [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) +- 追加 `system.detached_parts` テーブルの情報を含む外部 `MergeTree` テーブル。 [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([azerbaijan.kgm](https://github.com/akuzm)) +- 追加 `ngramSearch` 針と干し草の山の間の非対称差を計算する関数。 [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) +- 集約関数インタフェースを使用して、基本的な機械学習方法(確率線形回帰とロジスティック回帰)の実装。 モデルの重みを更新するための戦略が異なります(単純勾配降下、運動量法、nesterov法)。 また注文のサイズのミニバッチを支える。 [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) +- の実装 `geohashEncode` と `geohashDecode` 機能。 [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) +- 集計関数の追加 `timeSeriesGroupSum` る累積の異なる時系列のサンプルのタイムスタンプなアライメントを実施します。 これは、二つのサンプルタイムスタンプ間の線形補間を使用して、一緒に時系列を合計します。 集計関数の追加 `timeSeriesGroupRateSum` これは、時系列のレートを計算し、その後一緒にレートを合計します。 [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([楊関劉](https://github.com/LiuYangkuan)) +- 機能追加 `IPv4CIDRtoIPv4Range` と `IPv6CIDRtoIPv6Range` CIDRを使用してサブネット内のIPの下限と上限を計算する。 [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 有効な設定でhttpを使用してクエリを送信するときにx-clickhouse-summaryヘッダーを追加します `send_progress_in_http_headers`. X-ClickHouse-Progressの通常の情報を返し、クエリに挿入された行数やバイト数などの追加情報を返します。 [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([ギヨームタッセリー](https://github.com/YiuRULE)) + +#### 改善 {#improvements} + +- 追加 `max_parts_in_total` パーティションキー\#5166の安全でない指定を防ぐテーブルのMergeTreeファミリーの設定(デフォルト:100 000)。 [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-obfuscator`:derive種のため、個々のカラムを組み合わせ種の利用が重要であると考えられとカラム名、カラム位置にします。 ことを目的として変換するデータセットに複数の関連するテーブル、テーブルはJOINableに設定します。 [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 機能追加 `JSONExtractRaw`, `JSONExtractKeyAndValues`. 関数の名前を変更 `jsonExtract` に `JSONExtract`. 何かがうまくいかない場合、これらの関数は対応する値を返します。 `NULL`. 変更された機能 `JSONExtract` 今度は、最後のパラメータから戻り値の型を取得し、nullableを注入しません。 AVX2命令が利用できない場合にRapidJSONにフォールバックを実装しました。 新しいバージョンに更新Simdjsonライブラリ。 [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) +- さて `if` と `multiIf` 機能は条件に頼りません `Nullable` しかし、sqlの互換性のためにブランチに依存しています。 [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([建呉](https://github.com/janplus)) +- `In` 述語が生成されます `Null` 結果から `Null` のような入力 `Equal` 機能。 [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([建呉](https://github.com/janplus)) +- Kafkaからの行数ごとの時間制限(flush\_interval/poll\_timeout)をチェックします。 この読みからのカフカの消費者をより頻繁にチェックの時間制限のトップレベルの流れ [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([イワン](https://github.com/abyss7)) +- バンドルsaslとリンクrdkafka. sasl scram認証を使用できるようにする必要があります [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([イワン](https://github.com/abyss7)) +- すべてのジョインのrowreflistのバッチバージョン。 [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) +- clickhouse-サーバ:より有益なエラーメッセージを聞きます. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) +- Clickhouseのサポート辞書-機能のための複写機 `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) +- 新しい設定を追加 `kafka_commit_every_batch` カフカの政策を規制する。 + ることができる設定のコミットモード:バッチのメッセージの取り扱い、後のブロック全体に書きます。 このトレードオフの関係を失うメッセージやみ表示することを目的としていま倍もいる。 [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([イワン](https://github.com/abyss7)) +- 作る `windowFunnel` 他の符号なし整数型をサポート。 [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) +- 仮想列をシャドウする `_table` マージエンジンで。 [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([イワン](https://github.com/abyss7)) +- 作る `sequenceMatch` 集計関数は、他の符号なし整数型をサポート [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) +- より良いエラーメッセージの場合はチェックサムミスマッチは一によるものと考えられるハードウェアです。 [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- チェックすると配下のテーブル支援のためのサンプリング `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([イワン](https://github.com/abyss7)) +- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- MySQLワイヤプロトコルの改善。 フォーマットの名前をMySQLWireに変更しました。 RAIIをRSA\_freeを呼び出すために使用します。 コンテキス [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([ユーリーバラノフ](https://github.com/yurriy)) +- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) +- 分散テーブルへの非同期挿入のクエリ設定を考慮します。 [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([Tcheason](https://github.com/TCeason)) +- 関数の名前を変更 `leastSqr` に `simpleLinearRegression`, `LinearRegression` に `linearRegression`, `LogisticRegression` に `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### 性能の改善 {#performance-improvements} + +- ALTER MODIFYクエリの非レプリケートされたMergeTreeテーブルの一部の並列処理。 [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) +- 正規表現の抽出における最適化。 [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) +- 結果を結合するために右結合キー列を追加しないでください。 [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) +- 最初の空の応答の後にkafkaバッファをフリーズします。 それは多数のinvokationsをの避けます `ReadBuffer::next()` いくつかの行解析ストリームの空の結果。 [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([イワン](https://github.com/abyss7)) +- `concat` 複数の引数の関数の最適化。 [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) +- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) +- より速い解凍を持つように、lz4実装を参照してアップグレードします。 [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) +- MSD基数ソート(kxsortに基づく)、および部分ソートを実装しました。 [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) + +#### バグ修正 {#bug-fixes} + +- プッシュが結合で列を必要と修正 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([冬張](https://github.com/zhang2014)) +- バグを修正,clickhouseはsystemdによって実行されると,コマンド `sudo service clickhouse-server forcerestart` 期待通りに動作しませんでした。 [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) +- (9009ポート上のサーバー間のhttpサーバーは常に偶数エラーで、コード200を返しました)datapartsexchangeのhttpエラーコードを修正します。 [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) +- MAX\_SMALL\_STRING\_SIZEより長い文字列のSimpleAggregateFunctionを修正しました [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) +- のためのエラーを修正 `Decimal` に `Nullable(Decimal)` 変換で。 支援その他数を小数点の変換を含む異なる)を採用。 [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) +- 間違った計算につながるsimdjsonライブラリ内の固定fpu clobbering `uniqHLL` と `uniqCombined` 次のような集計関数と数学関数 `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- JSON関数でのconst/nonconstの混合ケースの処理を修正しました。 [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) +- 修正 `retention` 機能。 これで、データの行を満たすすべての条件がデータの状態に追加されます。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) +- 結果のタイプを修正する `quantileExact` 小数で。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 文書 {#documentation} + +- 以下のための文書を翻訳 `CollapsingMergeTree` 中国語に。 [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) +- テーブルエンジンに関する文書を中国語に翻訳します。 + [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) + [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) + ([決してリー](https://github.com/neverlee)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements} + +- ツづツつ、ツつシツつイツ猟.用ツつュツつセツつウツつ"ツ。[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([イワン](https://github.com/abyss7)) +- 移動性能試験の個別のディレクトリが便利です。 [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- パフォーマンステストの修正 [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) +- 追加ツールをチェックサムを計算によるビット切り替えデバッグハードウェアます。 [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- くランナーのスクリプトをより使用できます。 [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([フィリモノフ](https://github.com/filimonov)) +- パフォーマンステス [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) +- パフォーマンステストでのクエリの作成、入力、および削除での置換を行う機能を追加 [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) + +## クリックハウスリリース19.7 {#clickhouse-release-19-7} + +### ClickHouseリリース19.7.5.29,2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} + +#### バグ修正 {#bug-fix-25} + +- 固定能の回帰一部のクエリを処理するクラウドの場合。 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([冬張](https://github.com/zhang2014)) + +### クリックハウスリリース19.7.5.27,2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} + +#### 新しい機能 {#new-features-1} + +- ビットマップ関連の機能を追加 `bitmapHasAny` と `bitmapHasAll` に類似した `hasAny` と `hasAll` 配列の関数。 [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Catalonia\_comarques.Kgm](https://github.com/svladykin)) + +#### バグ修正 {#bug-fixes-1} + +- Segfaultをオンにする `minmax` Null値を持つインデックス。 [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) +- LIMITのすべての入力列を必要な出力としてマークします。 それは修正します ‘Not found column’ いくつかの分散クエリのエラー。 [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S.Pan](https://github.com/kvap)) +- 修正 “Column ‘0’ already exists” エラーで `SELECT .. PREWHERE` デフォルトの列 [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) +- 修正 `ALTER MODIFY TTL` 上のクエリ `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([アントン-ポポフ](https://github.com/CurtizJ)) +- Kafkaの消費者が起動に失敗したときにサーバをクラッシュさせないでください。 [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([イワン](https://github.com/abyss7)) +- 固定ビットマップ機能を誤った結果です。 [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([アンディヤング](https://github.com/andyyzh)) +- ハッシュ化された辞書のための修正element\_count(重複を含めないでください) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) +- タイムゾーンの名前として環境変数tzの内容を使用します。 すでに正しく検出デフォルトのタイムゾーンもあります。[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([イワン](https://github.com/abyss7)) +- 整数を変換しようとしないでください `dictGetT` それが正しく動作しないため、機能。 代わりに例外をスローします。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- ExternalData HTTP要求の設定を修正しました。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([ダニラ + クテニン](https://github.com/danlark1)) +- 部品は飼育係からそれらを落とすことなく、fsからのみ削除されたバグを修正。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- セグメンテーショ `bitmapHasAny` 機能。 [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- 固定の場合にはエラー複製を接続プールなリトライを解決するホストでも、dnsキャッシュした。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- 固定 `DROP INDEX IF EXISTS` クエリ。 さて `ALTER TABLE ... DROP INDEX IF EXISTS ...` 指定されたインデックスが存在しない場合、queryは例外を発生させません。 [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Union all supertype列を修正しました。 結果の列のデータ型および列の型が一致しない場合がありました。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- DDLクエリの処理中にZNONODEをスキップします。 別のノードがタスクキューのznodeを削除する前に、 + それを処理しませんでしたが、すでに子のリストを取得していますが、DDLWorkerスレッドを終了します。 [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- マテリアライズドカラムを使用して分散()テーブルに挿入を修正。 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) + +### ClickHouseリリース19.7.3.9,2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} + +#### 新しい機能 {#new-features-2} + +- ユーザーが指定できる設定の範囲を制限することができます。 + これらの制約は、ユーザー設定プロファイルで設定できます。 + [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([ヴィタリ + Baranov](https://github.com/vitlibar)) +- 関数の第二のバージョンを追加します `groupUniqArray` 任意を使って + `max_size` 結果の配列のサイズを制限するパラメーター。 この + 動作は次のようになります `groupArray(max_size)(x)` 機能。 + [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- TSVWithNames/CSVWithNames入力ファイル形式の場合、列の順序は次のようになります + ファイルヘッダーから決定。 これは、 + `input_format_with_names_use_header` パラメータ。 + [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) + ([Alexander](https://github.com/Akazz)) + +#### バグ修正 {#bug-fixes-2} + +- マージ中にuncompressed\_cache+joinでクラッシュ(\#5197) + [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([ダニラ + クテニン](https://github.com/danlark1)) +- Segmentation faultにclickhouse-クライアントがクエリーのシステムです。 \#5066 + [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) + ([イワン](https://github.com/abyss7)) +- KafkaEngine経由で重い負荷のデータ損失(#4736) + [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) + ([イワン](https://github.com/abyss7)) +- 固定非常に珍しいデータ競合状態が起こるのを実行する際にクエリとeuのすべての関少なくとも二つから選択します。列、システム。テーブル、システム。部品、システム。マージファミリのparts\_tablesまたはテーブルと、関連するテーブルの列の変更を同時に実行する。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 性能の改善 {#performance-improvements-1} + +- の単一の数値列によるソートに基数ソートを使用します `ORDER BY` なし + `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), + [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) + ([Evgenii Pravda](https://github.com/kvinty), + [alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 文書 {#documentation-1} + +- 翻訳書類の一部のテーブルエンジン。 + [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), + [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), + [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) + ([张风啸](https://github.com/AlexZFX)), + [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([しない + リー](https://github.com/neverlee)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-1} + +- UTF-8文字を正しく印刷する `clickhouse-test`. + [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加コマンドラインパラメータclickhouse-クライアントに常に負荷の提案 + データ。 [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- いくつかのpvs-studioの警告を解決します。 + [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 更新lz4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([ダニラ + クテニン](https://github.com/danlark1)) +- 今後のプル要求#5030の要件を構築するためにgperfを追加します。 + [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) + ([proller](https://github.com/proller)) + +## ClickHouseリリース19.6 {#clickhouse-release-19-6} + +### クリックハウスリリース19.6.3.18,2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} + +#### バグ修正 {#bug-fixes-3} + +- テーブル関数からのクエリの条件プッシュダウンで修正 `mysql` と `odbc` と対応するテーブルエンジン。 これは#3540と#2384を修正します。 [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Zookeeperのデッドロックを修正します。 [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlcname](https://github.com/github1youlc)) +- CSVで引用小数を許可します。 [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) +- Float Inf/NaNからDecimalsへの変換を禁止します(例外をスローします)。 [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) +- リネームクエリでデータレースを修正。 [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([冬張](https://github.com/zhang2014)) +- 一時的にlfallocを無効にします。 lfallocの使用は、uncompressedcacheを割り当てる際に多くのmap\_failedにつながり、その結果、高負荷のサーバーでのクエリのクラッシュにつながる可能性があります。 [cfdba93comment](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) + +### ClickHouseリリース19.6.2.11、2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} + +#### 新しい機能 {#new-features-3} + +- 列およびテーブルのttl式。 [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([アントン-ポポフ](https://github.com/CurtizJ)) +- のサポートを追加 `brotli` HTTPレスポンスの圧縮(Accept-Encoding:br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([ミハイル](https://github.com/fandyushin)) +- 新しい機能を追加 `isValidUTF8` バイトのセットが正しくutf-8エンコードされているかどう [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) +- 新しい負荷分散ポリシーの追加 `first_or_random` 送信されるクエリを最初に指定されたホストの場合は利用できな送信をクエリーダ主催のチャームのボー. クロスレプリケーショ [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) + +#### 実験の特徴 {#experimental-features-1} + +- 設定を追加 `index_granularity_bytes` (アダプティブインデックス粒度)MergeTree\*テーブルファミリの場合。 [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) + +#### 改善 {#improvements-1} + +- 関数の非定数および負のサイズと長さの引数のサポートが追加されました `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 左結合ではプッシュダウンから右テーブル、右結合では左テーブル、フル結合では両方のテーブルを無効にします。 このおかしくなる問題を修正に入実績もあります。 [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([イワン](https://github.com/abyss7)) +- `clickhouse-copier`:タスク設定の自動アップロード `--task-file` オプション [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) +- 追加の誤字ハンドラに保存工場とテーブル機能の工場です。 [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) +- サブクエリなしで複数のジョインのアスタリスクと修飾アスタリスクをサポート [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) +- く不カラムのエラーメッセージよりユーザーにも優しい。 [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 性能の改善 {#performance-improvements-2} + +- ASOF結合の大幅な高速化 [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) + +#### 下位互換性のない変更 {#backward-incompatible-changes} + +- HTTPヘッダ `Query-Id` に改名された `X-ClickHouse-Query-Id` 一貫性のために。 [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([ミハイル](https://github.com/fandyushin)) + +#### バグ修正 {#bug-fixes-4} + +- 固定された潜在的なnullポインタの逆参照 `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) +- JOIN+ARRAY JOINによるクエリのエラーを修正 [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定掛けの開始にサーバーが辞書により他の辞書を介してデータベースエンジン=辞書で調べました。 [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) +- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) +- のための潜在的に間違った結果を修正 `SELECT DISTINCT` と `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定非常に珍しいデータ競合状態が起こるのを実行する際にクエリとeuのすべての関少なくとも二つから選択します。列、システム。テーブル、システム。部品、システム。マージファミリのparts\_tablesまたはテーブルと、関連するテーブルの列の変更を同時に実行する。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-2} + +- 別のホストでclickhouse-serverを実行しているときのテストの失敗を修正 [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) +- clickhouse-テスト:非tty環境でカラーコントロールシーケンスを無効にします。 [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) +- clickhouse-test:任意のテストデータベースの使用を許可する(削除する `test.` それが可能な資格) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) +- Ubsanエラーの修正 [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Yandex LFAllocがClickHouseに追加され、MarkCacheとUncompressedCacheデータをさまざまな方法で割り当てて、より信頼性の高いsegfaultをキャッチしました [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) +- バックポートとチェンジログを支援するためのpython util。 [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([イワン](https://github.com/abyss7)) + +## ClickHouseリリース19.5 {#clickhouse-release-19-5} + +### ClickHouseリリース19.5.4.22、2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} + +#### バグ修正 {#bug-fixes-5} + +- ビットマップ\*機能のクラッシュを修正 [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([アンディヤング](https://github.com/andyyzh)) +- 固定非常に珍しいデータ競合状態が起こるのを実行する際にクエリとeuのすべての関少なくとも二つから選択します。列、システム。テーブル、システム。部品、システム。マージファミリのparts\_tablesまたはテーブルと、関連するテーブルの列の変更を同時に実行する。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定エラー `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. このエラーは、LowCardinality列が主キーの一部であった場合に発生しました。 \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 保持機能の変更:行が最初の条件とn番目の条件の両方を満たす場合、最初の満足条件のみがデータ状態に追加されます。 これで、データの行を満たすすべての条件がデータの状態に追加されます。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) + +### ClickHouseリリース19.5.3.8,2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} + +#### バグ修正 {#bug-fixes-6} + +- 設定の固定タイプ `max_partitions_per_insert_block` ブール値からUInt64へ。 [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Mohammad Hostsein Sekhavat](https://github.com/mhsekhavat)) + +### ClickHouseリリース19.5.2.6,2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} + +#### 新しい機能 {#new-features-4} + +- [Hyperscan](https://github.com/intel/hyperscan) 複数の正規表現マッチングが追加されました(関数 `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) +- `multiSearchFirstPosition` 機能が追加されました。 [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) +- の実施を所定の表現フィルター配列です。 [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([イワン](https://github.com/abyss7)) +- 新しいタイプのデータを飛び指標に基づくブル(使用可能 `equal`, `in` と `like` 機能)。 [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) +- 追加 `ASOF JOIN` これにより、既知の最新の値に結合するクエリを実行できます。 [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) +- 複数の書き換え `COMMA JOIN` に `CROSS JOIN`. 次にそれらを書き換える `INNER JOIN` 可能であれば。 [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 改善 {#improvement-9} + +- `topK` と `topKWeighted` 今サポートカスタム `loadFactor` (修正の問題 [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([キリル丹心](https://github.com/kirillDanshin)) +- 使用を許可する `parallel_replicas_count > 1` サンプリングされていないテーブルの場合でも(設定は単に無視されます)。 以前のバージョンでは、例外が発生しました。 [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) +- のサポート `CREATE OR REPLACE VIEW`. ビューの作成または単一のステートメントでの新しい定義の設定を許可します。 [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) +- `Buffer` テーブルエンジン `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([楊関劉](https://github.com/LiuYangkuan)) +- Zookeeperのメタデータなしで複製テーブルを開始する機能を追加 `readonly` モード。 [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) +- Clickhouse-clientのプログレスバーのフリッカーを修正しました。 この問題は、 `FORMAT Null` ストリーミングクエ [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 機能を無効にするには `hyperscan` ユーザーごとにライブラリを使用して、過度かつ無制限のリソース使用量を制限します。 [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加バージョン番号でログインしてすべてのエラー. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) +- に制限を追加しました `multiMatch` 文字列サイズを必要とする関数 `unsigned int`. また、引数の数の制限を追加しました。 `multiSearch` 機能。 [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) +- 改善の利用をゼロスペースおよびエラー処理にhyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) +- 塗りつぶし `system.graphite_detentions` テーブルの設定から `*GraphiteMergeTree` エンジンテーブル。 [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- 名前変更 `trigramDistance` 機能への `ngramDistance` と追加より機能で `CaseInsensitive` と `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) +- データスキップインデックス計算の改善。 [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) +- 普通に保つ, `DEFAULT`, `MATERIALIZED` と `ALIAS` 単一のリストの列(修正の問題 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +#### バグ修正 {#bug-fix-26} + +- 避ける `std::terminate` メモリ割り当てに失敗した場合。 さて `std::bad_alloc` 期待どおりに例外がスローされます。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- バッファからcapnprotoの読み取りを修正します。 時にファイルなロードに成功するhttp. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ウラジスラフ](https://github.com/smirnov-vs)) +- エラーの修正 `Unknown log entry type: 0` 後に `OPTIMIZE TABLE FINAL` クエリ。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([アモスの鳥](https://github.com/amosbird)) +- 間違った引数へ `hasAny` または `hasAll` 関数はsegfaultにつながる可能性があります。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 行き詰まりが発生する恐れがあるとしながら実行 `DROP DATABASE dictionary` クエリ。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 未定義の動作を修正する `median` と `quantile` 機能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- ときに圧縮レベル検出を修正 `network_compression_method` 小文字で。 V19.1で壊れた。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- の固定無知 `UTC` 設定(修正の問題 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- 修正 `histogram` 関数の振る舞い `Distributed` テーブル。 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- 固定tsanレポート `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- システムログ使用時の競合状態によるシャットダウン時のtsanレポートを修正。 part\_logが有効になっているときにシャットダウン時に固定された潜在的な使用後無料。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- パーツの再チェックを修正 `ReplicatedMergeTreeAlterThread` エラーの場合。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 中間集計関数状態に対する算術演算は、定数引数(サブクエリ結果など)に対して機能していませんでした。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 常にメタデータの列名を引用します。 それ以外の場合は、列という名前の表を作成することは不可能です `index` (サーバーは不正な形式のために再起動しません `ATTACH` メタデータ内のクエリ)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- でクラッシュを修正 `ALTER ... MODIFY ORDER BY` に `Distributed` テーブル。 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Tcheason](https://github.com/TCeason)) +- Segfaultを修正する `JOIN ON` 有効にした場合 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([冬張](https://github.com/zhang2014)) +- カフカからprotobufメッセージを消費した後、余分な行を追加するとバグを修正しました。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- のクラッシュを修正 `JOIN` nullable列とnullable列ではありません。 修正 `NULLs` 右キーで `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) +- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- 固定競合状態で `SELECT` から `system.tables` テーブルが同時に名前変更または変更された場合。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 既に廃止されたデータ部分をフェッチする際のデータレースを修正。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 中に発生することができます `RENAME` MergeTree家族のテーブル。 [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 機能の固定細分化の欠陥 `arrayIntersect`. Segmentation faultう場合は関数と呼ばれたとの混合の定数、通常の引数になります。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- でクラッシュを修正 `FULL/RIGHT JOIN` 私たちはnullable対nullableではないに参加するとき. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正 `No message received` レプリカ間のパーツの取得中の例外。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- 固定 `arrayIntersect` 単一の配列のいくつかの繰り返しの値の場合に機能間違った結果。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 同時実行中の競合状態の修正 `ALTER COLUMN` クエリを生み出しうるサーバストレスとソーシャル-サポート問題の修正 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- 誤った結果を修正 `FULL/RIGHT JOIN` constの列を持つ。 [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) +- 重複を修正する `GLOBAL JOIN` アスタリスク付き。 [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正パラメータ控除で `ALTER MODIFY` 列の `CODEC` 列の型が指定されていない場合。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- 機能 `cutQueryStringAndFragment()` と `queryStringAndFragment()` 今すぐ正しく動作します `URL` くれないのを返します。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- 設定時にまれなバグを修正 `min_bytes_to_use_direct_io` これは、スレッドが列ファイル内で逆方向にシークする必要があるときに発生します。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- 集計関数の誤った引数の型を修正する `LowCardinality` 引数(修正の問題 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 間違った名前の修飾を修正 `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正機能 `toISOWeek` 1970年の結果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正 `DROP`, `TRUNCATE` と `OPTIMIZE` 実行されたときのクエリの重複 `ON CLUSTER` のために `ReplicatedMergeTree*` テーブルの家族。 [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### 下位互換性のない変更 {#backward-incompatible-change-8} + +- 名前変更の設定 `insert_sample_with_metadata` 設定する `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加された設定 `max_partitions_per_insert_block` (デフォルトでは値100)。 場合に挿入したブロックを含むより多くのパーティション例外がスローされます。 制限を削除する場合は0に設定します(推奨されません)。 [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- マルチサーチ機能の名称を変更 (`multiPosition` に `multiSearchAllPositions`, `multiSearch` に `multiSearchAny`, `firstMatch` に `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) + +#### 性能向上 {#performance-improvement-6} + +- 多くの針または多くの同様のbigramsとのクエリのために約5-10%の検索改善を与え、インライン化することによってvolnitsky検索を最適化します。 [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) +- 設定時のパフォーマンス問題を修正 `use_uncompressed_cache` がゼロより大き登場したときのすべてのデータに含まれる。 [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-10} + +- マークキャッシュとインデックスのメモリ保護を追加します。 これによりメモリの揃い踏みのバグの場合には豆やmsanできます。 [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cmake変数のサポートの追加 `ENABLE_PROTOBUF`, `ENABLE_PARQUET` と `ENABLE_BROTLI` これにより、上記の機能を有効/無効にすることができます(librdkafka、mysqlなどでも同じことができます)。 [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) +- 追加ダイレクトに刷版を出力するプロセス一覧表示およびstacktracesのすべてのスレッドの場合一部のクエリで吊るされているだけなので後の試験です。 [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) +- 再試行の追加 `Connection loss` エラーで `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) +- Freebsdのビルドとスレッドのサニタイザを使ったビルドをパッケージャスクリプトに追加します。 [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) +- 現在ユーザーのためのパスワードユーザー `'default'` 取付けの間。 [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) +- の警告を抑制する `rdkafka` ライブラリ。 [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sslなしで構築する能力を許可します。 [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) +- カスタムユーザーからclickhouse-serverイメージを起動する方法を追加します。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Contrib boostを1.69にアップグレードします。 [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) +- 使用を無効にする `mremap` きめにスレッドに指消毒剤. 驚いたことに、TSanは傍受しません `mremap` (それは傍受しますが `mmap`, `munmap`)それは偽陽性につながります. ステートフルテストで修正TSanレポート。 [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加試験にチェックを使用形式スキーマによhttpインターフェース。 [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) + +## クリックハウスリリース19.4 {#clickhouse-release-19-4} + +### ClickHouseリリース19.4.4.33,2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} + +#### バグ修正 {#bug-fixes-7} + +- 避ける `std::terminate` メモリ割り当てに失敗した場合。 さて `std::bad_alloc` 期待どおりに例外がスローされます。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- バッファからcapnprotoの読み取りを修正します。 時にファイルなロードに成功するhttp. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ウラジスラフ](https://github.com/smirnov-vs)) +- エラーの修正 `Unknown log entry type: 0` 後に `OPTIMIZE TABLE FINAL` クエリ。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([アモスの鳥](https://github.com/amosbird)) +- 間違った引数へ `hasAny` または `hasAll` 関数はsegfaultにつながる可能性があります。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 行き詰まりが発生する恐れがあるとしながら実行 `DROP DATABASE dictionary` クエリ。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 未定義の動作を修正する `median` と `quantile` 機能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- ときに圧縮レベル検出を修正 `network_compression_method` 小文字で。 V19.1で壊れた。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- の固定無知 `UTC` 設定(修正の問題 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- 修正 `histogram` 関数の振る舞い `Distributed` テーブル。 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- 固定tsanレポート `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- システムログ使用時の競合状態によるシャットダウン時のtsanレポートを修正。 part\_logが有効になっているときにシャットダウン時に固定された潜在的な使用後無料。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- パーツの再チェックを修正 `ReplicatedMergeTreeAlterThread` エラーの場合。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 中間集計関数状態に対する算術演算は、定数引数(サブクエリ結果など)に対して機能していませんでした。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 常にメタデータの列名を引用します。 それ以外の場合は、列という名前の表を作成することは不可能です `index` (サーバーは不正な形式のために再起動しません `ATTACH` メタデータ内のクエリ)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- でクラッシュを修正 `ALTER ... MODIFY ORDER BY` に `Distributed` テーブル。 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Tcheason](https://github.com/TCeason)) +- Segfaultを修正する `JOIN ON` 有効にした場合 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([冬張](https://github.com/zhang2014)) +- カフカからprotobufメッセージを消費した後、余分な行を追加するとバグを修正しました。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- 固定競合状態で `SELECT` から `system.tables` テーブルが同時に名前変更または変更された場合。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 既に廃止されたデータ部分をフェッチする際のデータレースを修正。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 中に発生することができます `RENAME` MergeTree家族のテーブル。 [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 機能の固定細分化の欠陥 `arrayIntersect`. Segmentation faultう場合は関数と呼ばれたとの混合の定数、通常の引数になります。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 修正 `No message received` レプリカ間のパーツの取得中の例外。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- 固定 `arrayIntersect` 単一の配列のいくつかの繰り返しの値の場合に機能間違った結果。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 同時実行中の競合状態の修正 `ALTER COLUMN` クエリを生み出しうるサーバストレスとソーシャル-サポート問題の修正 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修正パラメータ控除で `ALTER MODIFY` 列の `CODEC` 列の型が指定されていない場合。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- 機能 `cutQueryStringAndFragment()` と `queryStringAndFragment()` 今すぐ正しく動作します `URL` くれないのを返します。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- 設定時にまれなバグを修正 `min_bytes_to_use_direct_io` これは、スレッドが列ファイル内で逆方向にシークする必要があるときに発生します。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- 集計関数の誤った引数の型を修正する `LowCardinality` 引数(修正の問題 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 修正機能 `toISOWeek` 1970年の結果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正 `DROP`, `TRUNCATE` と `OPTIMIZE` 実行されたときのクエリの重複 `ON CLUSTER` のために `ReplicatedMergeTree*` テーブルの家族。 [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### 改善 {#improvements-2} + +- 普通に保つ, `DEFAULT`, `MATERIALIZED` と `ALIAS` 単一のリストの列(修正の問題 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +### ClickHouseリリース19.4.3.11,2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} + +#### バグ修正 {#bug-fixes-8} + +- でクラッシュを修正 `FULL/RIGHT JOIN` 私たちはnullable対nullableではないに参加するとき. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-11} + +- カスタムユーザーからclickhouse-serverイメージを起動する方法を追加します。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### クリックハウスリリース19.4.2.7,2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} + +#### バグ修正 {#bug-fixes-9} + +- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### クリックハウスリリース19.4.1.3,2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} + +#### バグ修正 {#bug-fixes-10} + +- 両方を含む固定リモートクエリ `LIMIT BY` と `LIMIT`. 以前は、 `LIMIT BY` と `LIMIT` リモートクエリに使用された, `LIMIT` 前に起こる可能性が `LIMIT BY` るもの濾過します。 [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S.Pan](https://github.com/kvap)) + +### ClickHouseリリース19.4.0.49,2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} + +#### 新しい機能 {#new-features-5} + +- 追加の完全なサポート `Protobuf` フォーマット(入出力、ネストされたデータ構造)。 [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) +- ビットマップを追加しました。 [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([アンディヤング](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) +- 寄木細工の形式のサポート。 [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) +- ファジィ文字列の比較のために、n-gram距離が追加されました。 これは、r言語のq-gramメトリックに似ています。 [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) +- 結合ルールのための黒鉛rollupから専用の凝集-保持。 [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- 追加 `max_execution_speed` と `max_execution_speed_bytes` リソースの使用を制限する。 追加 `min_execution_speed_bytes` 補完する設定 `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([冬張](https://github.com/zhang2014)) +- 機能実装 `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) +- 機能追加 `arrayEnumerateDenseRanked` と `arrayEnumerateUniqRanked` (それはのようなものだ `arrayEnumerateUniq` しかし、多次元配列の内部を調べるために配列の深さを微調整することができます)。 [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) + +#### バグ修正 {#bug-fixes-11} + +- このリリースも含む全てのバグ修正から19.3 19.1. +- データスキップインデックスのバグを修正:挿入後の顆粒の順序が間違っていた。 [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) +- 固定 `set` インデックス `Nullable` と `LowCardinality` 列。 その前に, `set` 索引とともに `Nullable` または `LowCardinality` 列ledにエラー `Data type must be deserialized with multiple streams` 選択中。 [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 完全にupdate\_timeを正しく設定する `executable` 辞書の更新。 [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) +- 19.3で壊れたプログレスバーを修正。 [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([フィリモノフ](https://github.com/filimonov)) +- 特定のケースで、メモリ領域をシュリンクしたときのmemorytrackerの値の不一致を修正しました。 [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ThreadPoolでの未定義の動作を修正しました。 [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- メッセージで非常にまれなクラッシュを修正 `mutex lock failed: Invalid argument` これは、MergeTreeテーブルがSELECTと同時に削除されたときに発生する可能性があります。 [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) +- ODBCドライバとの互換性 `LowCardinality` データ型。 [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) +- FreeBSD:Fixup for `AIOcontextPool: Found io_event with unknown id 0` エラー。 [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `system.part_log` テーブルは構成に関係なく作成されました。 [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 未定義の動作を修正する `dictIsIn` キャッシュ辞書の関数。 [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) +- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) +- デフォルトでcompile\_expressionsを無効にします。 `llvm` contribはそれをとのテストし、 `clang` と `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) +- 防ぐ `std::terminate` とき `invalidate_query` のために `clickhouse` 外部辞書ソースが間違った結果セット(空または複数の行または複数の列)を返しました。 ときに問題を修正しました `invalidate_query` にかかわらず、五秒ごとに実行されました `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ときにデッドロックを避ける `invalidate_query` 辞書のために `clickhouse` ソースが関与していた `system.dictionaries` テーブルまたは `Dictionaries` データベース(まれなケース)。 [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- クロスのための修正は、空のwhereに参加します。 [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) +- 機能の固定segfault “replicate” 定数引数が渡されるとき。 [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定ラムダ機能と述語オプティマイザ. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([冬張](https://github.com/zhang2014)) +- 複数のフィックスを結合します。 [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 改善 {#improvements-3} + +- 支援のエイリアスに参加でき課右テーブル列あります。 [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) +- 複数の結合の結果は、サブセレクトで使用される正しい結果名が必要です。 平置き換えエイリアスとソース名ます。 [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) +- 結合文のプッシュダウンロジックを改善します。 [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([イワン](https://github.com/abyss7)) + +#### 性能の改善 {#performance-improvements-3} + +- 改善されたヒューリスティック “move to PREWHERE” 最適化。 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 8ビットおよび16ビットのキーにhashtableのapiを使用する適切なルックアップテーブルを使用します。 [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([アモスの鳥](https://github.com/amosbird)) +- 文字列比較のパフォーマンスの向上。 [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 分散ddlタスクを処理するメインループが遅くならないように、別のスレッドで分散ddlキューをクリーンアップします。 [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) +- とき `min_bytes_to_use_direct_io` 読み込むデータサイズが圧縮されたブロックのサイズによって過小評価されることがあるため、すべてのファイルがO\_DIRECTモードで開かれたわけでは [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-12} + +- Clang-9のサポートを追加 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 間違った修正 `__asm__` 指示(再び) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) +- 設定を指定する機能を追加する `clickhouse-performance-test` コマンドラインから。 [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) +- 統合テストに辞書テストを追加します。 [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) +- 追加のクエリからのベンチマークのサイトを自動化性能試験までを実施。 [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `xxhash.h` それは実装の詳細であり、そのシンボルは次の名前空間であるため、外部lz4には存在しません `XXH_NAMESPACE` マクロ Lz4が外部の場合、xxHashも外部になければならず、扶養家族はそれにリンクする必要があります。 [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) +- 次の場合にケースを修正 `quantileTiming` 集約関数は、負の引数または浮動小数点引数で呼び出すことができます(これは、未定義の動作消滅器でfuzzテストを修正します)。 [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- スペルエラー訂正。 [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2unit description in lists](https://github.com/sdk2)) +- Macでのコンパイルの修正。 [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) +- FreeBSDおよび様々な異常なビルド設定のためのビルドの修正。 [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) + +## クリックハウスリリース19.3 {#clickhouse-release-19-3} + +### ClickHouseリリース19.3.9.1,2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} + +#### バグ修正 {#bug-fixes-12} + +- でクラッシュを修正 `FULL/RIGHT JOIN` 私たちはnullable対nullableではないに参加するとき. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-13} + +- カスタムユーザーからclickhouse-serverイメージを起動する方法を追加する [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### ClickHouseリリース19.3.7,2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} + +#### バグ修正 {#bug-fixes-13} + +- #3920で修正されたエラー。 このエラ `Unknown codec family code`, `Cannot seek through file` とsegfaults。 このバグはバージョン19.1で最初に登場し、19.1.10および19.3.6までのバージョンに存在します。 [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.3.6,2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} + +#### バグ修正 {#bug-fixes-14} + +- スレッドプールに1000を超えるスレッドがある場合, `std::terminate` が起こるためのスレッド終了します。 [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 今では作成することが可能です `ReplicatedMergeTree*` コメントとデフォルトのない列のコメントを持つ表。 また、コーデックの比較を修正。 [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) +- 配列またはタプルとの結合にクラッシュを修正しました。 [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) +- メッセージとclickhouse-コピー機で固定クラッシュ `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定電話を切るサーバー停止の場合は分散ddlsを使用した。 [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) +- 10より大きい列のテキスト形式の解析に関するエラーメッセージで、誤った列番号が出力されました。 [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-3} + +- AVXを有効にした固定ビルド。 [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- コンパイルされるカーネルの代わりに、既知のバージョンに基づいて拡張会計とio会計を有効にします。 [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) +- Core\_dumpの設定をスキップできるようにします。size\_limit、制限セットが失敗した場合はスローの代わりに警告します。 [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) +- 削除された `inline` タグの `void readBinary(...)` で `Field.cpp`. また、冗長マージ `namespace DB` ブロック。 [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) + +### クリックハウスリリース19.3.5,2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} + +#### バグ修正 {#bug-fixes-15} + +- 大規模なhttp挿入クエリ処理のバグを修正しました。 [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) +- の間違った実装による古いバージョンとの固定後方の非互換性 `send_logs_level` 設定。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- テーブル機能の後方互換性を修正しました `remote` 列のコメントと共に導入。 [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.3.4,2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} + +#### 改善 {#improvements-4} + +- テーブル-インデックスをさせていただく事があり占めのメモリの制限を行うと `ATTACH TABLE` クエリ。 デタッチされた後にテーブルを添付できない可能性を回避しました。 [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ZooKeeperから受け取った最大文字列と配列サイズの上限をわずかに上げました。 でも引き続き増加しのサイズ `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` 飼育係に。 [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- すでにキューに多数のノードがある場合でも、放棄されたレプリカを修復できます。 [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 必要な引数を一つ追加する `SET` インデックス(最大保存行数)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### バグ修正 {#bug-fixes-16} + +- 固定 `WITH ROLLUP` 単一のグループの結果 `LowCardinality` キー。 [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 固定バグの設定指数を落と顆粒が含まれている場合以 `max_rows` 行)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) +- 多くのfreebsdビルドの修正。 [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) +- 固定エイリアス置換にクエリサブクエリを含む同じエイリアス(発行 [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-4} + +- 実行する機能を追加 `clickhouse-server` dockerイメージのステートレステストの場合。 [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) + +### クリックハウスリリース19.3.3,2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} + +#### 新しい機能 {#new-features-6} + +- を追加しました `KILL MUTATION` いくつかの理由である突然変異を除去することを可能にする声明。 追加 `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` フィールドに `system.mutations` テーブルやtroubleshooting. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) +- 集計関数の追加 `entropy` シャノンのエントロピーを計算します [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) +- クエリを送信する機能を追加 `INSERT INTO tbl VALUES (....` 分割せずにサーバーに `query` と `data` パーツだ [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) +- の一般的な実装 `arrayWithConstant` 機能が追加されました。 [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 実装 `NOT BETWEEN` 比較演算子です。 [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([ドミトリー-ナウモフ](https://github.com/nezed)) +- 実装 `sumMapFiltered` 値が合計されるキーの数を制限できるようにするには `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- のサポートを追加 `Nullable` タイプ `mysql` テーブル機能。 [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) +- 任意の定数式のサポート `LIMIT` 句。 [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) +- 追加 `topKWeighted` (符号なし整数)重みを持つ追加の引数を取る集約関数。 [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([アンドリュー golman](https://github.com/andrewgolman)) +- `StorageJoin` 今サポート `join_any_take_last_row` 同じキーの既存の値を上書きできるようにする設定。 [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([アモスの鳥](https://github.com/amosbird) +- 機能追加 `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) +- 追加 `RowBinaryWithNamesAndTypes` フォーマット。 [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V.Kozlyuk](https://github.com/DarkWanderer)) +- 追加 `IPv4` と `IPv6` データ型。 より効果的な実装 `IPv*` 機能。 [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) +- 機能追加 `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) +- 追加 `Protobuf` 出力形式。 [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) +- 追加brotli支援のためのhttpインタフェースデータインポート(挿入します). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([ミハイル](https://github.com/fandyushin)) +- ユーザーが関数名にタイプミスをしたり、コマンドラインクライアン [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) +- 追加 `Query-Id` サーバーのHTTP応答ヘッダーへ。 [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([ミハイル](https://github.com/fandyushin)) + +#### 実験の特徴 {#experimental-features-2} + +- 追加 `minmax` と `set` データ飛指標MergeTreeテーブルエンジンです。 [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- の追加された変換 `CROSS JOIN` に `INNER JOIN` 可能であれば。 [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) + +#### バグ修正 {#bug-fixes-17} + +- 固定 `Not found column` 重複する列の場合 `JOIN ON` セクション。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- 作る `START REPLICATED SENDS` コマンド開始レプリケート送信。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- 固定集計関数の実行 `Array(LowCardinality)` 引数。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 修正された間違った行動 `INSERT ... SELECT ... FROM file(...)` クエリとファイルは `CSVWithNames` または `TSVWIthNames` フォーマットと最初のデータ行がありません。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 辞書が利用できない場合辞書リロードに固定クラッシュ。 このバグは19.1.6で登場しました。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- 固定 `ALL JOIN` 右のテーブルに重複しています。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定細分化の欠陥との `use_uncompressed_cache=1` そして、間違った非圧縮サイズの例外。 このバグは19.1.6で登場しました。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- 固定 `compile_expressions` 大きな(int16以上の)日付の比較を伴うバグ。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- テーブル関数から選択する固定無限ループ `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 述語の最適化を一時的に無効にする `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([冬張](https://github.com/zhang2014)) +- 固定 `Illegal instruction` 古いCpuでbase64関数を使用するときにエラーが発生しました。 このエラーは、ClickHouseがgcc-8でコンパイルされた場合にのみ再現されています。 [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定 `No message received` エラーが発生との交流PostgreSQL ODBCドライバーを通してTLS接続します。 MySQLのODBCドライバを使用する場合にも、segfaultを修正します。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定間違った結果 `Date` と `DateTime` 引数は、条件付き演算子(関数)の分岐で使用されます `if`). 機能のための追加された汎用ケース `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- クリックハウス辞書は今内ロード `clickhouse` プロセス。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定デッドロック時 `SELECT` テーブルから `File` エンジンは後に再試行されました `No such file or directory` エラー。 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定レース条件から選択すると `system.tables` を与える `table doesn't exist` エラー。 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-client` でsegfault出口がデータを読み込むためのコマンドラインの提案いたインタラクティブモードになります。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 変異の実行が含むバグを修正しました `IN` 演算子は、誤った結果を生成していた。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- 固定エラー:データベースがある場合 `Dictionary` エンジン、サーバーの起動時に強制的にロードされるすべての辞書、およびlocalhostからのClickHouseソースを持つ辞書がある場合、辞書はロードできません。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定エラー時のシステムログのようにして作成時サーバをシャットダウンしました。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 正しい型を正しく返し、適切にロックを処理する `joinGet` 機能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([アモスの鳥](https://github.com/amosbird)) +- 追加 `sumMapWithOverflow` 機能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- 固定segfaultと `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) +- 間違ったとのバグを修正 `Date` と `DateTime` 比較。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- 未定義の動作の下で固定ファズテストサニタイザ:追加されたパラメータの型チェック `quantile*Weighted` 機能の系列。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 古いデータパーツの削除が失敗することがある稀な競合状態を修正しました `File not found` エラー。 [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- /etc/clickhouse-server/configが見つからないインストールパッケージを修正xmlだ [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-5} + +- Debianパッケージ:設定に従って/etc/clickhouse-server/preprocessedリンクを修正します。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- FreeBSDのための様々なビルドの修正. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) +- Perftestでテーブルを作成、入力、削除する機能を追加しました。 [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) +- 重複をチェックするスクリプトを追加しました。 [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- パフォーマンステス [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) +- パッケージはデバッグシンボルとを示唆を設置することができます。 [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- パフォーマンステストのリファクタリング。 より良いロギングと信号の処理。 [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) +- 匿名のyandexにドキュメントを追加しました。メトリカのデータセット。 [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) +- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) +- 追加docsつのデータセットにs3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) +- プル要求の説明からchangelogを作成するスクリプトを追加しました。 [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Clickhouseの人形モジュールを追加しました。 [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- 文書化されていない関数のグループのドキュメントを追加しました。 [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([冬張](https://github.com/zhang2014)) +- ARMビルドの修正。 [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) +- 辞書テストを実行できるようになりました `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) +- さて `/etc/ssl` はデフォルトとして使用されると、ディレクトリにSSL証明書 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 開始時にsseおよびavx命令の確認を追加しました。 [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) +- Initスクリプトは開始までサーバを待機します。 [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) + +#### 下位互換性のない変更 {#backward-incompatible-changes-1} + +- 削除 `allow_experimental_low_cardinality_type` 設定。 `LowCardinality` デー [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 削減マークのキャッシュされた、圧縮解除されたキャッシュサイズに従ってメインメニューを開きます。 [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([ロパチンコンスタンチン](https://github.com/k-lopatin) +- キーワードを追加 `INDEX` で `CREATE TABLE` クエリ。 名前のある列 `index` バッククォートまたは二重引用符で囲む必要があります: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- `sumMap` を推進する結果の型の代わりにオーバーフロー. 古いの `sumMap` 動作は、以下を使用して取得できます `sumMapWithOverflow` 機能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) + +#### 性能の改善 {#performance-improvements-4} + +- `std::sort` に置き換え `pdqsort` なしのクエリの場合 `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) +- 現在サーバーの再利用にスレッドからグローバルスレッドプールがあります。 この影響性能の一部のコーナー。 [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 改善 {#improvements-5} + +- FreeBSDのAIOサポートを実装しました。 [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `SELECT * FROM a JOIN b USING a, b` 今すぐ戻る `a` と `b` 左側のテーブルからの列のみ。 [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) +- 許可 `-C` オプションクライアントとして `-c` オプション。 [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) +- Nowオプション `--password` 使用せずに値を必要とパスワードからstdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) +- エスケープされていないメタ文字を含む文字列リテラルで強調表示するようにした `LIKE` 式または正規表現。 [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- クライアントソケッ [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) +- 現在サーバーの進捗報告書くクライアント接続の待機を開始。 [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([イワン](https://github.com/abyss7)) +- 最適化クエリの理由がわずかに良いメッセージ `optimize_throw_if_noop` 設定は有効です。 [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- のサポートを追加 `--version` clickhouseサーバーのための選択。 [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([ロパチンコンスタンチン](https://github.com/k-lopatin)) +- 追加 `--help/-h` オプションへ `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([ユーリーバラノフ](https://github.com/yurriy)) +- るためのサポートを追加しましたスカラサブクエリと集計関数の状態ます。 [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 向上サーバー停止時間の変更を待ってます。 [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Replicated\_can\_become\_leader設定に関する情報をsystemに追加しました。レトロギングの場合、レプリカなくなります。 [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) + +## クリックハウスリリース19.1 {#clickhouse-release-19-1} + +### ClickHouseリリース19.1.14、2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} + +- 固定エラー `Column ... queried more than once` それは起こるかもしれません設定 `asterisk_left_columns_only` 使用する場合は1に設定します `GLOBAL JOIN` と `SELECT *` (まれなケース)。 この問題は19.3以降には存在しません。 [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) + +### クリックハウスリリース19.1.13,2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} + +このリリースには、19.3.7とまったく同じパッチが含まれています。 + +### ClickHouseリリース19.1.10、2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} + +このリリースには、19.3.6とまったく同じパッチが含まれています。 + +## クリックハウスリリース19.1 {#clickhouse-release-19-1-1} + +### ClickHouseリリース19.1.9,2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} + +#### バグ修正 {#bug-fixes-18} + +- の間違った実装による古いバージョンとの固定後方の非互換性 `send_logs_level` 設定。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- テーブル機能の後方互換性を修正しました `remote` 列のコメントと共に導入。 [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### クリックハウスリリース19.1.8,2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} + +#### バグ修正 {#bug-fixes-19} + +- /etc/clickhouse-server/configが見つからないインストールパッケージを修正xmlだ [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +## クリックハウスリリース19.1 {#clickhouse-release-19-1-2} + +### クリックハウスリリース19.1.7,2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} + +#### バグ修正 {#bug-fixes-20} + +- 正しい型を正しく返し、適切にロックを処理する `joinGet` 機能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([アモスの鳥](https://github.com/amosbird)) +- 固定エラー時のシステムログのようにして作成時サーバをシャットダウンしました。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定エラー:データベースがある場合 `Dictionary` エンジン、サーバーの起動時に強制的にロードされるすべての辞書、およびlocalhostからのClickHouseソースを持つ辞書がある場合、辞書はロードできません。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 変異の実行が含むバグを修正しました `IN` 演算子は、誤った結果を生成していた。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- `clickhouse-client` でsegfault出口がデータを読み込むためのコマンドラインの提案いたインタラクティブモードになります。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定レース条件から選択すると `system.tables` を与える `table doesn't exist` エラー。 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定デッドロック時 `SELECT` テーブルから `File` エンジンは後に再試行されました `No such file or directory` エラー。 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定問題:地方clickhouse辞書読み込まれtcpが負荷以内です。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定 `No message received` エラーが発生との交流PostgreSQL ODBCドライバーを通してTLS接続します。 MySQLのODBCドライバを使用する場合にも、segfaultを修正します。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 述語の最適化を一時的に無効にする `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([冬張](https://github.com/zhang2014)) +- テーブル関数から選択する固定無限ループ `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定 `compile_expressions` 大きな(int16以上の)日付の比較を伴うバグ。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- 固定細分化の欠陥との `uncompressed_cache=1` そして、間違った非圧縮サイズの例外。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- 固定 `ALL JOIN` 右のテーブルに重複しています。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正された間違った行動 `INSERT ... SELECT ... FROM file(...)` クエリとファイルは `CSVWithNames` または `TSVWIthNames` フォーマットと最初のデータ行がありません。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定集計関数の実行 `Array(LowCardinality)` 引数。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Debianパッケージ:設定に従って/etc/clickhouse-server/preprocessedリンクを修正します。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- 未定義の動作の下で固定ファズテストサニタイザ:追加されたパラメータの型チェック `quantile*Weighted` 機能の系列。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 作る `START REPLICATED SENDS` コマンド開始レプリケート送信。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- 固定 `Not found column` セクションの結合で重複する列の場合。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- さて `/etc/ssl` はデフォルトとして使用されると、ディレクトリにSSL証明書 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 辞書が利用できない場合辞書リロードに固定クラッシュ。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- 間違ったとのバグを修正 `Date` と `DateTime` 比較。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- 固定間違った結果 `Date` と `DateTime` 引数は、条件付き演算子(関数)の分岐で使用されます `if`). 機能のための追加された汎用ケース `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouseリリース19.1.6,2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} + +#### 新しい機能 {#new-features-7} + +- 表の列ごとのカスタム圧縮コーデック。 [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [冬張](https://github.com/zhang2014), [アナトリー](https://github.com/Sindbag)) +- 圧縮コーデックを追加 `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) +- 許可する `ALTER` 圧縮コーデック。 [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) +- 機能追加 `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` SQL標準の互換性のために。 [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) +- 書き込みのサポート `HDFS` テーブルと `hdfs` テーブル機能。 [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) +- 大きな干し草の山から複数の定数文字列を検索する機能を追加しました: `multiPosition`, `multiSearch` ,`firstMatch` また `-UTF8`, `-CaseInsensitive`、と `-CaseInsensitiveUTF8` バリアント。 [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) +- 未使用の破片の切り取ること `SELECT` シャーディングキーによるクエリフィ `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [イワン](https://github.com/abyss7)) +- 許可 `Kafka` エンジンを無視するいくつかの構文解析誤りのブロックです。 [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([イワン](https://github.com/abyss7)) +- のサポートを追加 `CatBoost` マルチクラスモデルの評価。 機能 `modelEvaluate` マルチクラスモデルのクラスごとの生の予測を持つタプルを返します。 `libcatboostmodel.so` で構築する必要があります [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 機能追加 `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) +- ハッシュ機能を追加 `xxHash64` と `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([フィリモノフ](https://github.com/filimonov)) +- 追加 `gccMurmurHash` 同じハッシュシードを使用するハッシュ関数(GCC風味のつぶやきハッシュ) [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) +- ハッシュ機能を追加 `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) +- テーブル機能を追加 `remoteSecure`. 機能として動作 `remote` しかし、安全な接続を使用しています。 [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) + +#### 実験の特徴 {#experimental-features-3} + +- 複数の結合エミュレーションを追加 (`allow_experimental_multiple_joins_emulation` 設定)。 [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) + +#### バグ修正 {#bug-fixes-21} + +- 作る `compiled_expression_cache_size` 設定により限定のデフォルトの低メモリを消費する。 [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) +- レプリケートされたテーブルの変更を実行するスレッドと、zookeeperから設定を更新するスレッドのバグを修正しました。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) +- 分散alterタスクを実行する際の競合状態を修正しました。 レース条件以上のレプリカを実行しようとしたところ、すべてのレプリカのものを除く失敗との飼育係エラーになります。 [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) +- 次の場合にバグを修正する `from_zk` config要素はないのにリフレッシュした後、求め飼育係わる。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) +- IPv4サブネッ [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) +- 固定クラッシュ (`std::terminate`)まれに、リソースが枯渇したために新しいスレッドを作成できない場合。 [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ときにバグを修正 `remote` 間違った制限がinに使用されたときのテーブル関数の実行 `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) +- Netlinkソケットのリークを修正します。 これらのソケットはプール内に置かれ、削除されることはなく、現在のすべてのソケットが使用されているときに、新しいソケットが新しいスレッド [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) +- 閉じるとバグを修正 `/proc/self/fd` すべてのfdsが読み込まれたディレクトリ `/proc` フォーク後 `odbc-bridge` サブプロセス。 [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) +- 主キーの使用文字列の場合にはuint単調変換するための固定文字列。 [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([冬張](https://github.com/zhang2014)) +- 整数変換関数の単調性の計算におけるエラーを修正しました。 [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定segfaultで `arrayEnumerateUniq`, `arrayEnumerateDense` いくつかの無効な引数の場合の関数。 [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- StorageMergeでUBを修正. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([アモスの鳥](https://github.com/amosbird)) +- 機能の固定segfault `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定エラー:機能 `round`, `floor`, `trunc`, `ceil` を返すことが偽の結果が実行される整数の引数と大きな負のです。 [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- によって誘導されるバグを修正 ‘kill query sync’ これはコアダンプにつながります。 [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) +- のを修正した。長の遅延の後に空の複製します。 [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) +- テーブルに挿入する場合の過度のメモリ使用量を修正しました `LowCardinality` 主キー。 [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 固定 `LowCardinality` のためのシリアル化 `Native` 空の配列の場合の形式。 [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 単一のlowcardinality数値列によってdistinctを使用している間、不正な結果を修正しました。 [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 低カーディナリティキーを使用した特殊な集計を修正しました(以下の場合 `compile` 設定が有効になっています)。 [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 固定ユーザとパスワードを転送のための複製のテーブルのクエリ. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) +- 固定非常に珍しい競合状態とされるようにすることが一覧表の辞書データベースをリロードを生成する事ができます。 [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ロールアップまたはcubeで使用されたときの不正な結果を修正しました。 [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([サム-チョウ](https://github.com/reflection)) +- クエリの固定列エイリアス `JOIN ON` 構文と分散テーブル。 [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([冬張](https://github.com/zhang2014)) +- の内部実装における固定エラー `quantileTDigest` (アルテムVakhrushevによって発見)。 このエラーはClickHouseでは決して起こらず、ClickHouseコードベースをライブラリとして直接使用する人にのみ関連していました。 [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 改善 {#improvements-6} + +- のサポート `IF NOT EXISTS` で `ALTER TABLE ADD COLUMN` と一緒に文 `IF EXISTS` で `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) +- 機能 `parseDateTimeBestEffort`:形式のサポート `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` と似ています。 [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CapnProtoInputStream` 今サポートギザギザの構造。 [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) +- ユーザビリティ向上に追加チェックがサーバプロセスからのデータディレクトリはオーナーを想定しています。 できない開始のサーバーからのルートデータが得られない場合には所属非rootユーザーです。 [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-v-galtsev](https://github.com/sergey-v-galtsev)) +- 結合によるクエリの分析中に必要な列をチェックするロジックの改善。 [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) +- 単一のサーバーに多数の分散テーブルがある場合の接続数を減らしました。 [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([冬張](https://github.com/zhang2014)) +- サポートされている合計行 `WITH TOTALS` ODBCドライバのクエリ。 [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) +- 使用を許可する `Enum`関数の中の整数としてのs。 [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([イワン](https://github.com/abyss7)) +- 追加 `low_cardinality_allow_in_native_format` 設定。 無効の場合は、使用しないでください `LowCadrinality` タイプイン `Native` フォーマット。 [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 削除の冗長化物からの集計表現のキャッシュの低メモリ使用量 [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) +- チェックを追加する `SET send_logs_level = 'value'` クエリーを受け適切な値です。 [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) +- タイプ変換関数で固定されたデータ型のチェック。 [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([冬張](https://github.com/zhang2014)) + +#### 性能の改善 {#performance-improvements-5} + +- マージツリー設定の追加 `use_minimalistic_part_header_in_zookeeper`. 有効になっている場合、複製のテーブル店舗のコンパクト部分のメタデータの一部znode. これは著しく低下するので、飼育係スナップショットサイズ(場合には、あらゆるテーブルのカラム). この設定を有効にすると、それをサポートしていないバージョンにダウングレードすることはできません。 [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) +- Dfaベースの関数の実装を追加します。 `sequenceMatch` と `sequenceCount` patternに時間が含まれていない場合。 [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- 整数のシリアル化のパフォーマンスの向上。 [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([アモスの鳥](https://github.com/amosbird)) +- Zero left padding PODArrayので、-1要素は常に有効でゼロになります。 これは、オフセットの分岐のない計算に使用されます。 [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([アモスの鳥](https://github.com/amosbird)) +- 元に戻す `jemalloc` パフォーマン [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 下位互換性のない変更 {#backward-incompatible-changes-2} + +- 文書化されていない機能を削除 `ALTER MODIFY PRIMARY KEY` それがによって取って代わられたので `ALTER MODIFY ORDER BY` 司令部 [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) +- 削除機能 `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- タイプの結果を持つスカラーサブクエリの使用を禁止する `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([イワン](https://github.com/abyss7)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-6} + +- PowerPCのサポートを追加 (`ppc64le`)ビルド. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) +- ステートフル機能試験を実般に利用可能データセットである。 [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- サーバーが起動できない場合のエラーを修正しました `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` Dockerまたはsystemd-nspawn内のメッセージ。 [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 更新 `rdkafka` v1.0.0-RC5へのライブラリ。 生のCインターフェイスの代わりにcppkafkaを使用します。 [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([イワン](https://github.com/abyss7)) +- 更新 `mariadb-client` ライブラリ。 UBSanで見つかった問題のいずれかを修正しました。 [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- UBSanビルドのいくつかの修正。 [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- UBSanビルドによるテストのコミットごとの実行を追加しました。 +- PVS-Studio static analyzerのコミットごとの実行を追加しました。 +- PVS-Studioによって発見されたバグを修正しました。 [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定glibc互換性の問題。 [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Dockerイメージを18.10に移動し、glibc\>=2.28の互換性ファイルを追加します [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) +- 追加環境変数の場合はユーザーを行わないchownディレクトリをサーバー dockerイメージです。 [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) +- からの警告のほとんどを有効に `-Weverything` クラングで。 有効 `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 唯一のクラングで利用可能ないくつかのより多くの警告を追加しました8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- リンク先 `libLLVM` 共有リンクを使用する場合は、個々のLLVMライブラリではなく。 [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) +- テスト画像のための追加された消毒剤の変数。 [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) +- `clickhouse-server` debianパッケージは `libcap2-bin` 使用するパッケージ `setcap` 機能を設定するためのツール。 これは任意です。 [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 改善されたコンパイル時間、固定includesむ。 [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) +- ハッシュ関数のパフォーマンステス [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([フィリモノフ](https://github.com/filimonov)) +- 固定巡回ライブラリ依存。 [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) +- 低利用可能なメモリとコンパイルの改善。 [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) +- 追加試験スクリプトの再現性能の劣化 `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 下のコメントや文字列リテラルのスペルミスを修正 `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([マイハー](https://github.com/maiha)) +- コメントの誤字を修正しました。 [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) + +## [2018年の変更履歴](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/ja/whats-new/changelog/index.md b/docs/ja/whats-new/changelog/index.md new file mode 100644 index 00000000000..71a322d31ba --- /dev/null +++ b/docs/ja/whats-new/changelog/index.md @@ -0,0 +1,668 @@ +--- +machine_translated: true +machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 +toc_folder_title: Changelog +toc_priority: 74 +toc_title: '2020' +--- + +## ClickHouseリリースv20.3 {#clickhouse-release-v20-3} + +### ClickHouseリリリースv20.3.4.10,2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} + +#### バグ修正 {#bug-fix} + +- このリリースも含む全てのバグ修正から20.1.8.41 +- 不足している修正 `rows_before_limit_at_least` プロセッサパイプラインを使用したhttpクエリの場合。 この修正 [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### ClickHouseリリリースv20.3.3.6,2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} + +#### バグ修正 {#bug-fix-1} + +- このリリースも含む全てのバグ修正から20.1.7.38 +- ユーザーが以前のバージョンで突然変異を実行した場合、複製が機能しないレプリケーションのバグを修正しました。 この修正 [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). こ版20.3後方互換。 +- 設定を追加 `use_compact_format_in_distributed_parts_names` これにより、 `INSERT` へのクエリ `Distributed` よりコンパクトな形式のテーブル。 この修正 [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). こ版20.3後方互換。 + +### ClickHouseリリリースv20.3.2.1,2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} + +#### 下位互換性のない変更 {#backward-incompatible-change} + +- 問題を修正しました `file name too long` データを送信するとき `Distributed` 多数のレプリカのテーブル。 レプリカの資格情報がサーバーログに表示される問題を修正しました。 ディスク上のディレクトリ名の形式が `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb))新しいバージョンにアップグレードした後、古いサーバーのバージョンが新しいディレクトリ形式を認識しないため、手動の介入なしにダウングレードするこ ダウングレードする場合は、対応するディレクトリの名前を手動で古い形式に変更する必要があります。 この変更は、非同期を使用した場合にのみ関連します `INSERT`にs `Distributed` テーブル。 バージョン20.3.3では、新しいフォーマットを徐々に有効にするための設定を紹介します。 +- 変更コマンドのレプリケーションログエントリの形式を変更。 新しいバージョンをイ +- Stacktracesをダンプするシンプルなメモリプロファイラを実装する `system.trace_log` 毎N文字以上のソフト配分を制限 [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([イワン](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov))の列 `system.trace_log` から改名されました `timer_type` に `trace_type`. この変更が必要な第三者機関の性能解析およびflamegraph処理ツールです。 +- 内部スレッド番号の代わりにosスレッドidを使用します。 この修正 [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) 古い `clickhouse-client` サーバーから送信されるログを受信できない `send_logs_level` これは、構造化ログメッセージの名前と種類が変更されたためです。 一方、異なるサーバーバージョンでは、異なるタイプのログを相互に送信できます。 あなたが使用しないとき `send_logs_level` 設定、あなたは気にしないでください。 [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 削除 `indexHint` 機能 [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 削除 `findClusterIndex`, `findClusterValue` 機能。 この修正 [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). これらの機能を使用していた場合は、メールを送信します `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- これで、列を作成したり、列を追加したりすることはできません `SELECT` 既定の式としてサブクエリ。 [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) +- JOIN内のサブクエリのエイリアスが必要です。 [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) +- 改善された `ALTER MODIFY/ADD` クエリロジック。 今はできません `ADD` タイプのない列, `MODIFY` デフォルトの式では、列の型は変更されません。 `MODIFY` 型は既定の式の値を緩めません。 修正 [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) +- ログ設定の変更を適用するには、サーバーを再起動する必要があります。 これは、サーバーが削除されたログファイルにログを記録するバグを回避するための一時的な回避策です。 [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- を設定 `experimental_use_processors` デフォルトでは有効です。 この設定をご利用の新しいクエリのパイプライン これは内部リファクタリングであり、目に見える変更は期待していません。 問題が表示される場合は、ゼロをバックアップするように設定します。 [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 新しい機能 {#new-feature} + +- 追加 `Avro` と `AvroConfluent` 入力/出力形式 [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 期限切れのキーのマルチスレッドおよび非ブロック更新 `cache` 辞書(古いものを読むための任意の許可を持つ)。 [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- クエリの追加 `ALTER ... MATERIALIZE TTL`. TTLによって期限切れのデータを強制的に削除し、すべての部分でTTLに関するメタ情報を再計算する突然変異を実行します。 [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 必要に応じて、hashjoinからmergejoin(ディスク上)に切り替えます [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加 `MOVE PARTITION` コマンド `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 設定ファイルからストレージ設定をリロードする。 [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 変更できる `storage_policy` あまり豊かではないものに。 [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) +- S3ストレージとテーブル機能のglobs/wildcardsのサポートを追加しました。 [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 実装 `bitAnd`, `bitOr`, `bitXor`, `bitNot` のために `FixedString(N)` データ型。 [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 機能追加 `bitCount`. この修正 [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ikopylov](https://github.com/ikopylov)) +- 追加 `generateRandom` テーブル機能をランダム行に指定されたschema. 任意のテストテーブルにデータを設定できます。 [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([イリヤ-ヤツィシン](https://github.com/qoega)) +- `JSONEachRowFormat` 支援特別の場合オブジェ囲まれたトップレベルの配列になります。 [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) +- これで、列を作成することができます `DEFAULT` デフォルトの列に依存する式 `ALIAS` 式。 [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) +- 指定できるようにする `--limit` ソースデータサイズよりも `clickhouse-obfuscator`. データは異なるランダムシードで繰り返されます。 [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `groupArraySample` 機能(に類似した `groupArray` とreserviorサンプリングアルゴリズムです。 [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([アモスの鳥](https://github.com/amosbird)) +- これで、更新キューのサイズを監視することができます `cache`/`complex_key_cache` システム指標による辞書。 [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- CSV出力形式の行区切りとしてCRLFを使用できるようにする `output_format_csv_crlf_end_of_line` は1に設定されます [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) +- より多くの機能を実装する [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` と `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([ニコ-マンデリー](https://github.com/nmandery)) +- 新しい設定を導入: `max_parser_depth` 最大スタックサイズを制御し、大規模な複雑なクエリを許可する。 この修正 [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) と [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) +- 設定を追加する `force_optimize_skip_unused_shards` 未使用のシャードをスキップできない場合にスローする設定 [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) +- この設定は複数のディスク/量のデータを格納するための送付 `Distributed` エンジン [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) +- 支援の保管方針 (``)一時的なデータを貯えるため。 [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) +- 追加 `X-ClickHouse-Exception-Code` データを送信する前に例外がスローされた場合に設定されるHTTPヘッダー。 これは [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) +- 機能追加 `ifNotFinite`. それは単なる統語的な砂糖です: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `last_successful_update_time` コラムの `system.dictionaries` テーブル [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- 追加 `blockSerializedSize` 機能(圧縮なしのディスク上のサイズ) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) +- 機能を追加 `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) +- 追加されたシステム表 `system.zeros` と `system.zeros_mt` だけでなく、物語機能 `zeros()` と `zeros_mt()`. テーブル(テーブル機能を含む単一カラム名 `zero` とタイプ `UInt8`. この列にはゼロがあります。 これは、多くの行を生成する最速の方法としてテスト目的に必要です。 この修正 [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### 実験的特徴 {#experimental-feature} + +- 部品の新しいコンパクトな形式を追加 `MergeTree`-すべての列が一つのファイルに格納されている家族のテーブル。 それは小さく、頻繁な挿入物の性能を高めるのを助ける。 古いフォーマット(列ごとに一つのファイル)がwideと呼ばれます。 データ格納形式は設定によって制御 `min_bytes_for_wide_part` と `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([アントン-ポポフ](https://github.com/CurtizJ)) +- S3ストレージのサポート `Log`, `TinyLog` と `StripeLog` テーブル。 [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) + +#### バグ修正 {#bug-fix-2} + +- ログメッセージの不整合な空白を修正しました。 [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- テーブル作成時に、名前のないタプルの配列がネストされた構造としてフラット化されたバグを修正。 [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2comment](https://github.com/achulkov2)) +- ときに問題を修正しました “Too many open files” エラーが発生する恐れがあると多数の場合はファイルのマッチングglobパターン `File` テーブルまたは `file` テーブル機能。 今すぐファイルが遅延開かれます。 この修正 [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- DROP TEMPORARY TABLEは現在、一時テーブルのみを削除します。 [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) +- 削除した旧式の仕切りした時停止のサーバーは取り外し、添付を表示します。 [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- のためにどのようにデフォルトのディスクを算定し、自由空間から `data` サブディレクトリ。 空き容量が正しく計算されない場合の問題を修正しました。 `data` ディレクト この修正 [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) +- カンマ(クロス)は、内部の()に参加することができます。 [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) +- WHERE節に演算子のようなものがある場合は、INNER JOINにクロスを書き換えることができます。 [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) +- 後に可能な誤った結果を修正 `GROUP BY` 有効に設定 `distributed_aggregation_memory_efficient`. 修正 [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 見つかりキーのカウントとして見るメトリクスのキャッシュを生成する事ができます。 [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- レプリケーションプロト [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- 上の固定レース条件 `queue_task_handle` の起動時に `ReplicatedMergeTree` テーブル。 [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- その他の通貨 `NOT` で動作しませんでした `SHOW TABLES NOT LIKE` クエリ [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 機能に範囲チェックを追加しました `h3EdgeLengthM`. このチェッ [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 複数の引数(10以上)の三元論理演算のバッチ計算のバグを修正しました。 [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) +- Prewhere最適化のエラーを修正しました。 `Inconsistent number of columns got from MergeTreeRangeReader` 例外だ [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 予期しない修正 `Timeout exceeded while reading from socket` 例外は、ランダムに起きにセキュア接続前にタイムアウト実を超えた場queryプロファイラが有効になります。 また、追加 `connect_timeout_with_failover_secure_ms` 設定(デフォルトは100ミリ秒)です。 `connect_timeout_with_failover_ms` ただし、セキュアな接続に使用されます(SSLハンドシェイクが通常のTCP接続よりも遅いため) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) +- バグを修正しました。 `parts_to_do=0` と `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) +- 新しい任意の結合ロジックを使用する `partial_merge_join` 設定。 それは作ることが可能です `ANY|ALL|SEMI LEFT` と `ALL INNER` との結合 `partial_merge_join=1` 今だ [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) +- シャードは、例外をスローするのではなく、イニシエータから取得した設定をシャードのconstaintsにクランプします。 この修正では、別の制約を持つシャードにクエリを送信できます。 [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) +- 固定メモリ管理の問題 `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修正 `toDecimal*OrNull()` 文字列で呼び出されたときの関数群 `e`. 修正 [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) +- う `FORMAT Null` クライアントにデータを送信しません。 [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- そのタイムスタンプを修正 `LiveViewBlockInputStream` 更新されません。 `LIVE VIEW` 実験的特徴です [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) +- 固定 `ALTER MODIFY TTL` 古いTTL式を削除することを許さなかった誤った動作。 [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) +- MergeTreeIndexSet内のUBSanレポートを修正しました。 この修正 [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- の動作を修正しました `match` と `extract` haystackにゼロバイトがある場合の関数。 Haystackが一定の場合、その動作は間違っていました。 この修正 [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Apache Avro3rd-partyライブラリのデストラクターから投げを避けます。 [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) +- ポーリングされたバッチをコミットしない `Kafka` 部分的には、データの穴につながる可能性があります。 [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([フィリモノフ](https://github.com/filimonov)) +- 修正 `joinGet` null可能な戻り値の型を指定します。 https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([アモスの鳥](https://github.com/amosbird)) +- 圧縮時にデータの非互換性を修正する `T64` コーデック。 [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2))データ型idの修正 `T64` 影響を受けるバージョンで間違った(de)圧縮につながる圧縮コーデック。 [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) +- 設定を追加 `enable_early_constant_folding` 無効にするのである。 [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正プッシュダウ述語オプティマイザとビューの試験 [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([冬張](https://github.com/zhang2014)) +- Segfaultを修正する `Merge` から読み取るときに発生する可能性があります `File` ストレージ [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) +- ストレージポリシーのチェックを追加 `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. そうでない場合はこのデータの一部になり、再起動後の防止ClickHouse。 [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) +- テーブルにttlが設定されている場合に変更を修正します。 [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([アントン-ポポフ](https://github.com/CurtizJ)) +- ときに発生する可能性が競合状態を修正 `SYSTEM RELOAD ALL DICTIONARIES` いくつかの辞書が変更/追加/削除されている間に実行されます。 [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) +- 以前のバージョンでは `Memory` データベースエンジ `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) +- デフォル [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 配列型のbloom\_filterインデックスのnot(has())を修正しました。 [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbabcomment](https://github.com/achimbab)) +- テーブルの最初の列を許可する `Log` エンジンは別名である [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([イワン](https://github.com/abyss7)) +- から読み込み中の範囲の順序を修正 `MergeTree` 一つのスレッドのテーブル。 それは例外につながる可能性があります `MergeTreeRangeReader` または間違ったクエリ結果。 [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 作る `reinterpretAsFixedString` 戻るには `FixedString` 代わりに `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) +- を避ける非常に珍しい場合には、ユーザーで間違ったエラーメッセージ (`Success` 詳細なエラーの説明の代わりに)。 [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 使用するとき衝突しないで下さい `Template` 空の行テンプレートを使用した形式。 [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- システムテーブルのメタデータファイ [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix))修正 [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). +- キャッシュ辞書でexception\_ptrのデータレースを修正 [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- クエリの例外をスローしない `ATTACH TABLE IF NOT EXISTS`. 以前は、テーブルが既に存在する場合にスローされました。 `IF NOT EXISTS` 句。 [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 例外メッセージで行方不明の閉じる括弧を修正しました。 [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- メッセージの回避 `Possible deadlock avoided` インタラクティブモードでのclickhouse-クライアントの起動時に。 [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Base64でエンコードされた値の末尾にパディングが不正な形式になる場合がある問題を修正しました。 更新base64ライブラリ。 この修正 [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491)、閉じます [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- データを失うのを防ぐ `Kafka` まれに、接尾辞を読んだ後でコミットする前に例外が発生した場合。 修正 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([フィリモノフ](https://github.com/filimonov)) +- 固定例外で `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) +- ユーザーが `ALTER MODIFY SETTING` 古いformatedのため `MergeTree` テーブルエンジン家族。 [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- JSON関連の関数でInt64に収まらないUInt64の数値のサポート。 SIMDJSONをmasterに更新します。 この修正 [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 非厳密に単調な関数索引が使用されている場合の逆述語の実行を修正しました。 [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) +- 折ることを試みてはいけない `IN` 定数の `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([アモスの鳥](https://github.com/amosbird)) +- バグを修正 `ALTER DELETE` インデックスの破損につながる変異。 この修正 [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) と [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). さらに、非常にまれな競合状態を修正 `ReplicatedMergeTree` `ALTER` クエリ。 [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) +- ときは設定 `compile_expressions` が有効になっている場合は、 `unexpected column` で `LLVMExecutableFunction` 私達が使用する時 `Nullable` タイプ [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 以下のための複数の修正 `Kafka` エンジン:1)消費者グループのリバランス中に表示された重複を修正します。 2)修正レア ‘holes’ 登場時のデータをポーリングから割と世論調査および為の一部(現在の私たちは常にプロセス/コミット全体のポーリングブロックメッセージ). 3)固定フラッシュによるブロックサイズ(前のみにフラッシングによるタイムアウトした作業と同様に扱う。 4)より契約手続(入力フィードバック. 5)テストをより速く動作させる(デフォルトの間隔とタイムアウト)。 データは以前はブロックサイズでフラッシュされていなかったため(ドキュメントによると)、PRはデフォルト設定でパフォーマンスが低下する可能性 その変更後にパフォーマンスの問題が発生した場合-増加してください `kafka_max_block_size` より大きな値へのテーブル(例えば `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). 修正 [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([フィリモノフ](https://github.com/filimonov)) +- 修正 `Parameter out of bound` PREWHERE最適化の後のいくつかのクエリの例外。 [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) +- 関数の引数の混合constの場合を修正しました `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 実行時期 `CREATE` クエリー、倍定表現のストレージエンジンの引数です。 空のデータベース名を現在のデータベ 修正 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) +- 次のような単純な循環エイリアスを持つ列を作成または追加することはできません `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- 元の部分が破損する可能性があるダブル移動のバグを修正しました。 これは、 `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 許可 `interval` バッククォートなしで正しく解析する識別子。 場合でも、クエリを実行できない問題を修正しました。 `interval` 識別子は、バッククォートまたは二重引用符で囲まれています。 この修正 [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定ファズテストとの不正な動作 `bitTestAll`/`bitTestAny` 機能。 [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 可能なクラッシュ/間違った行数を修正 `LIMIT n WITH TIES` n行目に等しい行がたくさんあるとき。 [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- Enabledで書かれたパーツによる修正 `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) +- の破壊でデータレースを修正 `Poco::HTTPServer`. どこの場合のサーバを起動直ちに停止しております。 [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 実行中に誤解を招くエラーメッセージが表示されたバグを修正 `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2comment](https://github.com/achulkov2)) +- 固定 `Parameters are out of bound` 私たちが定数を持っているいくつかのまれなケースでは例外 `SELECT` 私たちが持っているときの句 `ORDER BY` と `LIMIT` 句。 [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 既に完了した突然変異がステータスを持つことができるとき `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) +- 実行を防ぐ `ALTER ADD INDEX` 古い構文のMergeTreeテーブルでは、動作しないためです。 [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) +- サーバーの起動中にテーブルにアクセスしない。 `LIVE VIEW` 依存するので、サーバーは起動できます。 また、削除 `LIVE VIEW` デタッチ時の依存関係 `LIVE VIEW`. `LIVE VIEW` 実験的特徴です [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) +- で可能なsegfaultを修正 `MergeTreeRangeReader`,実行中 `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 列ttlsによるチェックサムの不一致を修正しました。 [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([アントン-ポポフ](https://github.com/CurtizJ)) +- ボリュームが一つしかない場合にttlルールによってパーツがバックグラウンドで移動されないバグを修正しました。 [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 問題を修正しました `Method createColumn() is not implemented for data type Set`. この修正 [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 今度は、突然変異をより頻繁に確定しようとします。 [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- 修正 `intDiv` マイナス一つの定数による [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) +- 可能な競合状態を修正 `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- のを修正した。先サーバを終了しようとした場合に使用/drop `Kafka` テーブル作成されたパラメータ。 [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([フィリモノフ](https://github.com/filimonov)) +- OSが間違った結果を返す場合の回避策を追加 `timer_create` 機能。 [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- の使用で修正されたエラー `min_marks_for_seek` パラメータ。 固定のエラーメッセージがない場合shardingキーテーブルの配布に努めのスキップ未使用の破片. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) + +#### 改善 {#improvement} + +- 実装 `ALTER MODIFY/DROP` 以下のための突然変異の上にクエリ `ReplicatedMergeTree*` エンジンファミリー さて `ALTERS` メタデータ更新ステージでのみブロックし、その後はブロックしません。 [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) +- 内部結合にcrossを書き換える機能を追加する `WHERE` シリアル化されていない名前のセクション。 [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) +- 作る `SHOW TABLES` と `SHOW DATABASES` クエリは、 `WHERE` 式と `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) +- 設定を追加しました `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) +- 最近の変更後、mysqlクライアントはバイナリ文字列をhexで印刷し始め、読みにくくなりました ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). ClickHouseの回避策は、文字列の列をUTF-8としてマークすることです。 [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([ユーリーバラノフ](https://github.com/yurriy)) +- 文字列とfixedstringキーのサポートを追加する `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) +- SummingMergeTreeマップでの文字列キーのサポート [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) +- スレッドが例外をスローした場合でも、スレッドプールへのスレッドの信号終端 [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([丁象飛](https://github.com/dingxiangfei2009)) +- 設定を許可する `query_id` で `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 奇妙な表現を許可しない `ALTER TABLE ... PARTITION partition` クエリ。 このアドレス [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- テーブル `system.table_engines` 機能のサポートに関する情報を提供します `supports_ttl` または `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) +- 有効 `system.metric_log` デフォルトでは。 これには、ProfileEventsの値を持つ行が含まれます。 “collect\_interval\_milliseconds” 間隔(デフォルトでは秒)。 テーブルは非常に小さく(通常はメガバイトの順で)、デフォルトでこのデータを収集することは妥当です。 [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([イワン](https://github.com/abyss7)) +- 今すぐ一時的 `LIVE VIEW` によって作成されます `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` 代わりに `CREATE TEMPORARY LIVE VIEW ...` 前の構文は、次の構文と一致していなかったためです `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) +- Text\_logを追加します。行くエントリを制限するレベル構成パラメータ `system.text_log` テーブル [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) +- を入れてダウンロード部にディスク/量によるttlル [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 外部mysqlディクショナリの場合、mysql接続プールをmutualizeすることができます “share” それらの間で辞書。 このオプションは、MySQLサーバーへの接続数を大幅に削減します。 [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- 最も近いクエリの実行時間内の変位値を表示する `clickhouse-benchmark` 内挿された値の代わりに出力します。 いくつかのクエリの実行時間に対応する値を表示する方がよいでしょう。 [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kafkaにデータを挿入するときにメッセージのキーとタイムスタンプを追加する可能性。 修正 [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([フィリモノフ](https://github.com/filimonov)) +- 場合はサーバはターミナルから、ハイライトのスレッド号、クエリをidでログインを優先する色をします。 ここは改善の可読性の相関のログメッセージのステータスです。 [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より良い例外のメッセージ読み込み中にテーブル `Ordinary` データベース [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 実装 `arraySlice` 集約関数の状態を持つ配列の場合。 この修正 [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- IN演算子の右側で定数関数と定数配列を使用できます。 [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([アントン-ポポフ](https://github.com/CurtizJ)) +- システムのデータを取得している間にzookeeperの例外が発生した場合。レプリカは、別の列に表示します。 これは [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](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) ([Mikhail Korotov](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) ([alexey-milovidov](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)) +- 追加された列 `exception_code` で `system.query_log` テーブル。 [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) +- ポート上の有効mysql互換性サーバ `9004` デフォルトのサーバー設定ファイル。 設定の例の固定パスワード生成コマンド。 [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([ユーリーバラノフ](https://github.com/yurriy)) +- 防止に停止した場合のファイルシステムが読み取り専用になります。 この修正 [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- HTTP POSTクエリで長さが必要な場合は、より良い例外メッセージ。 [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `_path` と `_file` 仮想列へ `HDFS` と `File` エンジンと `hdfs` と `file` テーブル関数 [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) +- エラーの修正 `Cannot find column` 挿入している間 `MATERIALIZED VIEW` 新しい列がビューの内部テーブルに追加された場合。 [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- ネイティブクライアントサーバープロトコルを介して、最終更新後の送信の進行状況を修正(ログなど)。 この問題にのみ一部の第三者ツールを使用するネイティブプロトコルです。 [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) +- 追加システムの指標を追跡する多数のクライアント接続の待機を開始mysqlを使用してプロトコル ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) +- これからは、httpレスポンスには `X-ClickHouse-Timezone` 同じタイムゾーン値に設定されたヘッダ `SELECT timezone()` 報告する [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) + +#### 性能向上 {#performance-improvement} + +- INとの指標の分析のパフォーマンスを向上させる [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 論理関数+コードのクリーンアップで、よりシンプルで効率的なコード。 フォローアップへ [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) +- 全体的なパフォーマンスの向上(5%の範囲で。.200%の影響のクエリをもっと厳しいエイリアシングとc++20特徴です。 [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([アモスの鳥](https://github.com/amosbird)) +- 比較関数の内部ループのためのより厳密なエイリアシング。 [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 算術関数の内部ループのより厳密なエイリアシング。 [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ColumnVector::replicate()の実装は、ColumnConst::convertToFullColumn()が実装されています。 また、定数を具体化する際のテストにも役立ちます。 [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) +- 別のマイナーな性能向上へ `ColumnVector::replicate()` (これは `materialize` 機能および高位機能)へのそれ以上の改善 [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) +- 改善された性能の `stochasticLinearRegression` 集計関数。 このパッチはIntelによって提供されます。 [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 性能をの改善して下さい `reinterpretAsFixedString` 機能。 [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ブロックをクライアントに送信しない `Null` フォーマットプロセッサのパイプライン [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement} + +- 例外処理は現在、linux用のwindowsサブシステム上で正しく動作します。 見るhttps://github.com/clickhouse-extras/libunwind/pull/3 この修正 [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) +- 置換 `readline` と `replxx` インタラクティブライン編集 `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([イワン](https://github.com/abyss7)) +- FunctionsComparisonでより良いビルド時間と少ないテンプレートインスタンス化。 [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- との統合を追加しました `clang-tidy` CIで。 また見なさい [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 今、私たちはリンクを使用して、ciでclickhouse `lld` のために `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) +- するとランダムスレッドのスケジューリングに挿入しな障害の場合 `THREAD_FUZZER_*` 環境変数が設定されます。 これはテストを助ける。 [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ステートレステストでsecure socketsを有効にす [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) +- SPLIT\_SHARED\_LIBRARIES=OFFをより堅牢にする [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) +- 作る “performance\_introspection\_and\_logging” 試験信頼性の高いランダムにサーバーの付かない。 これはCI環境で発生する可能性があります。 また見なさい [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- スタイルチェックでxmlを検証する。 [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- テストの競合状態を修正 `00738_lock_for_inner_table`. このテストは睡眠に頼った。 [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 除去性能試験の種類 `once`. このに必要なすべての性能試験の統計比較モード(信頼性の高い). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 算術関数のパフォーマンステストを追加。 [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- のための追加された性能試験 `sumMap` と `sumMapWithOverflow` 集計関数。 フォローアップのための [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 確保のスタイルerrorcodesスタイルにチェック。 [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加スクリプトのための試験。 [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) +- GCC警告を追加する `-Wsuggest-override` すべての場所を見つけて修正するには `override` キーワー [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Mac OS Xの下で弱い記号を無視するのは、定義する必要があるためです [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([削除されたユーザ](https://github.com/ghost)) +- パフォーマンステストでの一部のクエリの実行時間の正規化。 この準備の性能試験との比較モードになります。 [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- クエリテストでpytestをサポートするテストを修正 [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([イワン](https://github.com/abyss7)) +- をsslの構築とmsan、サーバーな起動時に走行時の状態試験 [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) +- テスト結果でのデータベース置換の修正 [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([イリヤ-ヤツィシン](https://github.com/qoega)) +- の構築に対する修正その他ー [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) +- 追加ディスク部無国籍-と-カバレッジ-テストdocker画像 [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) +- GRPCでビルドするときに、ソースツリー内のファイルを取り除く [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([アモスの鳥](https://github.com/amosbird)) +- 少し早く構築時間を取り除いsessioncleanerからのコンテキスト sessioncleanerのコードをよりシンプルにする。 [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Clickhouseテストスクリプトでハングクエリのチェックを更新 [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) +- リポジトリか [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- から数学perftestsの変更タイプ `once` に `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 追加docker画像を構築ィコードのブラウザのhtmlレポート当社のコードベース. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin))見る [Woboqコードブラウザ](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) +- MSanの下でいくつかのテストの失敗を抑制. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- スピードアップ “exception while insert” テスト。 このテス [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 更新 `libcxx` と `libcxxabi` マスターに。 準備のために [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- フラッキーテストの修正 `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 清掃は複製リンカのフラグがあります。 リンカーが予期しないシンボルを検索しないことを確認します。 [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([アモスの鳥](https://github.com/amosbird)) +- 追加 `clickhouse-odbc` テスト画像にドライバ。 これは、独自のODBCドライバを経由してClickHouseとClickHouseの相互作用をテストすることができます。 [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([フィリモノフ](https://github.com/filimonov)) +- 単体テストでいくつかのバグを修正。 [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) +- 有効 `-Wmissing-include-dirs` CMakeスクリプトエラーの結果として、すべての既存のインクルードを排除するGCC警告 [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- クエリプ これは [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Opensslを上流のマスターに更新します。 メッセージでTLS接続が失敗する問題を修正しました `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` と `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. この問題はバージョン20.1に存在していました。 [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- サーバーのdockerfileの更新 [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) +- ビルド-gcc-from-sourcesスクリプトのマイナーな修正 [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) +- 置換 `numbers` に `zeros` どこperftestsで `number` 列は使用されません。 これはよりきれいなテスト結果につながります。 [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 固定しスタックオーバーフローされる際に問題が起きた場合、利用initializer\_list列コンストラクタ. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([削除されたユーザ](https://github.com/ghost)) +- Libdkafkaをv1.3.0にアップグレードします。 バンドル有効 `rdkafka` と `gsasl` Mac OS X上のライブラリ [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) +- GCC9.2.0でのビルド修正 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) + +## ClickHouseリリースv20.1 {#clickhouse-release-v20-1} + +### ClickHouseリリリースv20.1.8.41,2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} + +#### バグ修正 {#bug-fix-3} + +- 可能永久修正 `Cannot schedule a task` エラー(ハンドルされていない例外が原因で `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). この修正 [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) +- 過度のメモリ消費を修正 `ALTER` クエリ(突然変異)。 この修正 [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) と [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) +- 外部辞書のddlにバッククォートのバグを修正しました。 この修正 [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) + +### ClickHouseリリリースv20.1.7.38,2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} + +#### バグ修正 {#bug-fix-4} + +- 固定誤った内部関数名のための `sumKahan` と `sumWithOverflow`. 先頭に立って例外がこの機能をリモートます。 [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). この問題はすべてClickHouseのリリースにありました。 +- 許可 `ALTER ON CLUSTER` の `Distributed` 内部レプリケーショ この修正 [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([品生2](https://github.com/shinoi2)). この問題はすべてClickHouseのリリースにありました。 +- 可能な例外を修正 `Size of filter doesn't match size of column` と `Invalid number of rows in Chunk` で `MergeTreeRangeReader`. 実行中に表示される可能性があります `PREWHERE` いくつかのケースでは。 修正 [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 次のような単純な算術式を書くと、タイムゾーンが保持されないという問題を修正しました `time + 1` (次のような表現とは対照的に `time + INTERVAL 1 SECOND`). この修正 [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). この問題はすべてClickHouseのリリースにありました。 +- 次のような単純な循環エイリアスを持つ列を作成または追加することはできません `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- Base64でエンコードされた値の末尾にパディングが不正な形式になる場合がある問題を修正しました。 更新base64ライブラリ。 この修正 [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491)、閉じます [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- の破壊でデータレースを修正 `Poco::HTTPServer`. どこの場合のサーバを起動直ちに停止しております。 [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 可能なクラッシュ/間違った行数を修正 `LIMIT n WITH TIES` n行目に等しい行がたくさんあるとき。 [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- 列ttlsによるチェックサムの不一致を修正しました。 [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([アントン-ポポフ](https://github.com/CurtizJ)) +- ユーザーが `ALTER MODIFY SETTING` 古いformatedのため `MergeTree` テーブルエンジン家族。 [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- 今度は、突然変異をより頻繁に確定しようとします。 [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- レプリケーションプロト [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- 配列型のbloom\_filterインデックスのnot(has())を修正しました。 [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbabcomment](https://github.com/achimbab)) +- の動作を修正しました `match` と `extract` haystackにゼロバイトがある場合の関数。 Haystackが一定の場合、その動作は間違っていました。 この修正 [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-1} + +- 例外処理は現在、linux用のwindowsサブシステム上で正しく動作します。 見るhttps://github.com/clickhouse-extras/libunwind/pull/3 この修正 [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) + +### ClickHouseリリリースv20.1.6.30,2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} + +#### バグ修正 {#bug-fix-5} + +- 圧縮時にデータの非互換性を修正する `T64` コーデック。 + [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) +- 一つのスレッドでmergetreeテーブルから読み込み中の範囲の順序を修正しました。 修正 [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). + [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) +- で可能なsegfaultを修正 `MergeTreeRangeReader`,実行中 `PREWHERE`. 修正 [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). + [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) +- 修正 `reinterpretAsFixedString` 戻るには `FixedString` 代わりに `String`. + [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) +- 修正 `joinGet` null可能な戻り値の型を指定します。 修正 [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) + [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(アモスバード)](https://github.com/amosbird) +- ファズテストとbittestall/bittestany関数の不正な動作を修正しました。 + [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) +- Haystackにゼロバイトがある場合、match関数とextract関数の動作を修正しました。 Haystackが一定の場合、その動作は間違っていました。 修正 [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) + [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) +- 非厳密に単調な関数索引が使用されている場合の逆述語の実行を修正しました。 修正 [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) + [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) +- 書き換えを許可する `CROSS` に `INNER JOIN` もしあれば `[NOT] LIKE` 演算子in `WHERE` セクション。 修正 [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) + [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4tus2)](https://github.com/4ertus2) +- ログエンジンを持つテーブルの最初の列をエイリアスにする。 + [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) +- カンマの結合を許可する `IN()` 中に 修正 [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). + [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4tus2)](https://github.com/4ertus2) +- 改善する `ALTER MODIFY/ADD` クエリロジック。 今はできません `ADD` タイプのない列, `MODIFY` デフォルトの式では、列の型は変更されません。 `MODIFY` 型は既定の式の値を緩めません。 修正 [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). + [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) +- 既に行われた変異は、ステータスis\_done=0を持つことができたときに、突然変異の終了を修正。 + [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) +- サポート “Processors” システムのため数字とシステム.numbers\_mt. これはまたバグを修正します `max_execution_time` 尊重されていません。 + [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- の間違ったカウントを修正 `DictCacheKeysRequestedFound` メトリック。 + [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) +- ストレージポリシーのチェックを追加 `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` 合がデータの一部になり、再起動後の防止ClickHouse。 + [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(エキシーン)](https://github.com/excitoon) +- 固定ubsanレポートで `MergeTreeIndexSet`. この修正 [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) + [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) +- BlockIOで可能なdataraceを修正. + [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- のサポート `UInt64` JSON関連の関数のInt64に収まらない数値。 更新 `SIMDJSON` マスターに。 この修正 [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) + [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) +- 具合を修正しましたが、金額のフリースペースが正しく計算されませんが、データディレクトリに取り付けには別の装置です。 デフォルトのディスクの計算には無料のスペースからデータのサブディレクトリの. この修正 [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) + [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(ミルブ)](https://github.com/millb) +- メッセージでtls接続が失敗する場合の問題を修正しました `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Opensslを上流のマスターに更新します。 + [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) +- 実行時期 `CREATE` クエリー、倍定表現のストレージエンジンの引数です。 空のデータベース名を現在のデータベ 修正 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). また、ClickHouseDictionarySourceのローカルアドレスのチェックを修正しました。 + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Segfaultを修正する `StorageMerge` これは、StorageFileから読み込むときに発生します。 + [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) +- データを失うのを防ぐ `Kafka` まれに、接尾辞を読んだ後でコミットする前に例外が発生した場合。 修正 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). 関連: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(フィリモノフ)](https://github.com/filimonov) +- のを修正した。先サーバを終了しようとした場合に使用/drop `Kafka` テーブル作成されたパラメータ。 修正 [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). 組み込み [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(フィリモノフ)](https://github.com/filimonov) + +#### 新しい機能 {#new-feature-1} + +- 追加 `deduplicate_blocks_in_dependent_materialized_views` マテリアライズドビューを持つテーブルへの冪等挿入の動作を制御するオプション。 この新機能は、Altinityからの特別な要求によってbugfixリリースに追加されました。 + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### ClickHouseリリースv20.1.2.4,2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} + +#### 下位互換性のない変更 {#backward-incompatible-change-1} + +- 設定を行う `merge_tree_uniform_read_distribution` 廃止されました。 サーバーはこの設定を認識しますが、効果はありません。 [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 関数の戻り値の型を変更しました `greatCircleDistance` に `Float32` なぜなら今計算の結果は `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- これで、クエリパラメータが “escaped” フォーマット。 たとえば、文字列を渡すには `ab` あなたは `a\tb` または `a\b` とそれぞれ, `a%5Ctb` または `a%5C%09b` URLで。 これは、NULLを渡す可能性を追加するために必要です `\N`. この修正 [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 有効 `use_minimalistic_part_header_in_zookeeper` のための設定 `ReplicatedMergeTree` デフォルトでは。 このことを大幅に削減量のデータが保存されて飼育係. この設定はバージョン19.1以降でサポートされており、半年以上問題なく複数のサービスで本番環境で使用されています。 19.1より古いバージョンにダウングレードできる場合は、この設定を無効にします。 [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- データの飛び設計生産準備、デフォルトで有効です. 設定 `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` と `allow_experimental_multiple_joins_emulation` 今は時代遅れであり、何もしません。 [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 新規追加 `ANY JOIN` のための論理 `StorageJoin` と一貫した `JOIN` オペレーション 動作を変更せずにアップグレードするには、 `SETTINGS any_join_distinct_right_table_keys = 1` エンジンにテーブルを追加のメタデータを再現これらのテーブル後のアップグレードを開始します。 [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) +- ログ設定の変更を適用するには、サーバーを再起動する必要があります。 これは、サーバーが削除されたログファイルにログを記録するバグを回避するための一時的な回避策です。 [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### 新しい機能 {#new-feature-2} + +- パーツパスに関する情報を追加 `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 実行する機能を追加 `SYSTEM RELOAD DICTIONARY` でクエリ `ON CLUSTER` モード。 [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([ギヨームタッセリー](https://github.com/YiuRULE)) +- 実行する機能を追加 `CREATE DICTIONARY` でのクエリ `ON CLUSTER` モード。 [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) +- 今、ユーザーのプロフィール `users.xml` 継承した複数のデータ。 [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- 追加 `system.stack_trace` テーブルで眺めるスタックトレースのすべてのサーバスレッド)。 これは、開発者がサーバーの状態をイントロスペクトするのに便利です。 この修正 [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `DateTime64` 設定可能な秒未満の精度を持つデータ型。 [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) +- テーブル関数の追加 `clusterAllReplicas` ることのできるクエリのすべてのノードのクラスター [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([キラン-スンカリ](https://github.com/kiransunkari)) +- 集計関数の追加 `categoricalInformationValue` これは、離散フィーチャの情報値を計算します。 [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) +- データファイルの解析を高速化 `CSV`, `TSV` と `JSONEachRow` それを並行して行うことによって書式。 [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 機能を追加 `bankerRound` これは、銀行の丸めを実行します。 [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) +- 地域名の埋め込み辞書でより多くの言語をサポート: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- の一貫性の改善 `ANY JOIN` ロジック。 さて `t1 ANY LEFT JOIN t2` 等しい `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- 設定を追加 `any_join_distinct_right_table_keys` これは古い動作を可能にします `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- 新規追加 `SEMI` と `ANTI JOIN`. 古い `ANY INNER JOIN` 行動として `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加 `Distributed` の形式 `File` エンジンと `file` から読むことを可能にするテーブル機能 `.bin` によって生成されたファイル `Distributed` テーブル。 [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- オプションのreset column引数を追加する `runningAccumulate` これにより、各新しいキー値の集計結果をリセットできます。 [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) +- PrometheusエンドポイントとしてClickHouseを使用する機能を追加します。 [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) +- セクションを追加 `` で `config.xml` の制約が許されたアイテムのリモートテーブルエンジンとテーブル機能 `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) +- 機能追加 `greatCircleAngle` これは度で球の距離を計算します。 [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 地球の半径をh3ライブラリと一致するように変更しました。 [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `JSONCompactEachRow` と `JSONCompactEachRowWithNamesAndTypes` 入力と出力の形式。 [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) +- ファイル関連のテーブルエンジンとテーブル関数の機能を追加 (`File`, `S3`, `URL`, `HDFS`)読み書きすることができます `gzip` ファイルに基づく追加のエンジンのパラメータまたはファイル拡張子. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) +- を追加しました `randomASCII(length)` のランダムなセットを持つ文字列を生成する関数 [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) 印刷可能な文字。 [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([バヨネット](https://github.com/BayoNet)) +- 機能追加 `JSONExtractArrayRaw` これは、解析されていないjson配列要素の配列を返します `JSON` 文字列。 [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) +- 追加 `arrayZip` 等しい長さの複数の配列をタプルの一つの配列に結合することを可能にする関数。 [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([冬張](https://github.com/zhang2014)) +- 設定に従ってディスク間でデータを移動する機能を追加 `TTL`-のための式 `*MergeTree` テーブルエンジン家族。 [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 新しい集計関数を追加 `avgWeighted` 加重平均を計算することができます。 [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) +- デフォルトでは、並列解析が有効になりました `TSV`, `TSKV`, `CSV` と `JSONEachRow` フォーマット。 [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- からいくつかの地理機能を追加 `H3` ライブラリ: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` と `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([コンスタンチン-マランチェフ](https://github.com/hombit)) +- Brotliのサポートを追加しました (`br` ファイル関連のストレージとテーブルの機能で)圧縮。 この修正 [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加 `groupBit*` のための機能 `SimpleAggregationFunction` タイプ。 [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([ギヨームタッセリー](https://github.com/YiuRULE)) + +#### バグ修正 {#bug-fix-6} + +- とテーブルの名前の変更を修正 `Distributed` エンジン。 修正の問題 [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- 今辞書サポート `EXPRESSION` 非ClickHouse SQLダイアレクト内の任意の文字列の属性の場合。 [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- 壊れた修正 `INSERT SELECT FROM mysql(...)` クエリ。 この修正 [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) と [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- エラーの修正 “Mismatch column sizes” デフォルトを挿入する `Tuple` から `JSONEachRow`. この修正 [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) +- これで、usingの場合に例外がスローされます `WITH TIES` 一緒に `LIMIT BY`. また、使用する機能を追加 `TOP` と `LIMIT BY`. この修正 [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- 新鮮なglibcバージョンからの意図しない依存関係を修正 `clickhouse-odbc-bridge` バイナリ [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([アモスの鳥](https://github.com/amosbird)) +- のチェック機能のバグを修正 `*MergeTree` エンジンファミリー 最後の顆粒と最後のマーク(最終ではない)に等しい量の行がある場合、今度は失敗しません。 [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) +- に挿入を修正 `Enum*` 後の列 `ALTER` 基になる数値型がテーブル指定された型と等しい場合のクエリです。 この修正 [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 許可される非定数負 “size” 関数の引数 `substring`. それは誤って許可されませんでした。 この修正 [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 引数の数が間違って渡されたときにバグを解析する修正 `(O|J)DBC` テーブルエンジン。 [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) +- Syslogにログを送信するときに、実行中のclickhouseプロセスのコマンド名を使用します。 以前のバージョ [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) +- 許可されたホストの修正チェック `localhost`. このPRでは、 [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- でレアクラッシュを修正 `argMin` と `argMax` resultが使用されているときの長い文字列引数の関数 `runningAccumulate` 機能。 この修正 [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([恐竜](https://github.com/769344359)) +- とテーブルのメモリオーバーコミットを修正 `Buffer` エンジン。 [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) +- 取ることができる機能の潜在的なバグを修正 `NULL` 引数の一つとして、非NULLを返します。 [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より良いメトリクス計算のスレッドプールを対象としたバックグラウンドプロセス `MergeTree` テーブルエンジン。 [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修正機能 `IN` 中 `WHERE` 決が行レベルテーブルフィルターがあります。 修正 [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([イワン](https://github.com/abyss7)) +- これで、設定値の整数値が完全に解析されない場合、例外がスローされます。 [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) +- 複数のローカルシャードを持つ分散テーブルへのクエリで集計関数を使用すると例外が修正されました。 [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Bloom filterは長さゼロの配列を扱うことができ、冗長な計算を実行しません。 [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbabcomment](https://github.com/achimbab)) +- クライアン `host_regexp` で指定される `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) +- 複数の偽陽性につながるあいまいな列チェックを緩和する `JOIN ON` セクション。 [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定可能なサーバのクラッシュ (`std::terminate`)サーバーがデータを送信または書き込みできない場合 `JSON` または `XML` の値を持つ形式 `String` データ型(必要なデータ型 `UTF-8` 検証)またはBrotliアルゴリズムまたは他のまれなケースで結果データを圧縮するとき。 この修正 [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 競合状態の修正 `StorageDistributedDirectoryMonitor` CIによって発見。 この修正 [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 今、背景には、マージ `*MergeTree` テーブルエンジンの家族の保存-保存政策に大量注文しております。 [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Nowテーブルエンジン `Kafka` で適切に動作します `Native` フォーマット。 この修正 [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([フィリモノフ](https://github.com/filimonov)) +- ヘッダーを持つ固定形式(のような `CSVWithNames` テーブルエンジンのEOFについて例外を投げていた `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([フィリモノフ](https://github.com/filimonov)) +- の右側の部分にサブクエリからセットを作るとバグを修正しました `IN` セクション。 この修正 [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) と [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- ストレージか `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- でファイルの固定読み取り `Parquet` 型の列を含む形式 `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([マクスラン](https://github.com/maxulan)) +- エラーの修正 `Not found column` 分散クエリの場合 `PREWHERE` サンプリングキーに依存する条件 `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- エラーの修正 `Not found column` クエリを使用した場合 `PREWHERE` テーブルのエイリアスに依存し、主キー条件のために結果セットは空でした。 [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 関数の戻り値の型を修正 `rand` と `randConstant` の場合 `Nullable` 引数。 Now関数は常に戻ります `UInt32` そして決して `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 無効述語プッシュダウンのための `WITH FILL` 式。 この修正 [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([冬張](https://github.com/zhang2014)) +- 固定間違った `count()` 結果のための `SummingMergeTree` とき `FINAL` セクションを使用します。 [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- 固定可能な誤った結果常に機能することができます。 そのためのクエリ機能 `version()`, `uptime()`、等。 サーバーごとに異なる定数値を返します。 この修正 [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 間違った結果につながるプッシュダウン述語の最適化の複雑なバグを修正します。 これにより、プッシュダウン述語の最適化に多くの問題が修正されます。 [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([冬張](https://github.com/zhang2014)) +- でクラッシュを修正 `CREATE TABLE .. AS dictionary` クエリ。 [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) +- いくつかの改善clickhouse文法で `.g4` ファイル。 [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([タイヤン-リ](https://github.com/taiyang-li)) +- でクラッシュにつながるバグを修正 `JOIN`エンジン付きテーブル付きs `Join`. この修正 [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) +- 冗長辞書のリロードを修正 `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) +- 読み込み元のストリームの最大数を制限する `StorageFile` と `StorageHDFS`. 修正https://github.com/ClickHouse/ClickHouse/issues/7650。 [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- バグを修正 `ALTER ... MODIFY ... CODEC` クエリがユーザーの両方を指定しデフォルトの表現-コーデック. 修正 [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) +- 列のバックグラウンドマージでエラーを修正 `SimpleAggregateFunction(LowCardinality)` タイプ。 [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 固定型チェックイン機能 `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) +- 今、サーバーがクラッシュしない `LEFT` または `FULL JOIN` と参加エンジンと非サポート `join_use_nulls` 設定。 [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) +- さて `DROP DICTIONARY IF EXISTS db.dict` クエリが例外をスローしない場合 `db` 存在しない [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- テーブル関数のクラッシュの修正 (`file`, `mysql`, `remote`)削除への参照の使用によって引き起こされる `IStorage` オブジェクト。 テーブル関数への挿入時に指定された列の不正な解析を修正しました。 [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) +- をネットワークとなる前に `clickhouse-server`. この修正 [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) +- 安全な接続のためのタイムアウト処理を修正しました。 この修正 [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正 `clickhouse-copier`’並行作業者間の冗長な競合。 [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([丁象飛](https://github.com/dingxiangfei2009)) +- たとえその変異バージョンが現在の変異バージョ [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- の冗長コピーを無視する。 `*MergeTree` 別のディスクに移動してサーバーを再起動した後のデータ部分。 [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- でクラッシュを修正 `FULL JOIN` と `LowCardinality` で `JOIN` キー。 [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) +- Insertクエリで列名を複数回使用することは禁じられています `INSERT INTO tbl (x, y, x)`. この修正 [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) +- 検出のためのフォールバックを追加しました(論理cpuコアの数を使用して)未知のcpuのための物理cpuコアの数。 この修正 [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正 `There's no column` 誤差を実現し、エイリアス列あります。 [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定断つクラッシュ時 `EXISTS` クエリが使用されなかった `TABLE` または `DICTIONARY` 修飾子。 ただのような `EXISTS t`. この修正 [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). このバグはバージョン19.17で導入されました。 [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- エラーでまれなバグを修正 `"Sizes of columns doesn't match"` これは、 `SimpleAggregateFunction` コラム [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- 空のユーザーバグを修正 `allow_databases` すべてのデータベース(同じ `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) +- 固定顧客のクラッシュがサーバーで接続しています。 [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- 修正 `ORDER BY` 主キー接頭辞と非主キー接尾辞によるソートの場合の動作。 [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([アントン-ポポフ](https://github.com/CurtizJ)) +- テーブルに修飾列が存在するかどうかを確認します。 この修正 [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定された動作と `ALTER MOVE` merge finishが指定したスーパーパーを移動した直後に実行されます。 修正 [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 使用中のサーバーのクラッシュを修正 `UNION` 異なる数の列を持つ。 修正 [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 固定サイズの結果、部分文字列のための機能 `substr` 負のサイズ。 [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 今、サーバーは `MergeTree` が足りないときは無料のスレッドの背景プールがあります。 [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) +- 書式設定にマイナータイプミスを修正 `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) +- 固定間違ったブルームフィルタの負の数の結果。 この修正 [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([冬張](https://github.com/zhang2014)) +- Decompressでバッファオーバーフローの可能性を修正 悪意のあるユーザーで製作した圧縮データが読み後のバッファです。 この問題は、Yandexの情報セキュリティチームのEldar Zaitovによって発見されました。 [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 整数のオーバーフローのために誤った結果を修正 `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- さて `OPTIMIZE TABLE` クエリを待ちませんがオフラインのレプリカを行います。 [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) +- 固定 `ALTER TTL` のためのパーサ `Replicated*MergeTree` テーブル。 [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) +- サーバとクライアン [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- 修正 `bitmapAnd` 機能エラーが交差に集約ビットマップおよびスカラービットマップ. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([越黄](https://github.com/moon03432)) +- 定義をの精製して下さい `ZXid` バグを修正するZooKeeperプログラマーズガイドによると `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([丁象飛](https://github.com/dingxiangfei2009)) +- `odbc` テーブル関数は今 `external_table_functions_use_nulls` 設定。 [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) +- 稀なデータレースにつながるバグを修正しました。 [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- さて `SYSTEM RELOAD DICTIONARY` 辞書を完全にリロードし、無視します `update_field`. この修正 [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Create queryに辞書が存在するかどうかを確認する機能を追加します。 [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) +- 修正 `Float*` 解析 `Values` フォーマット。 この修正 [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- 私たちはいくつかのバックグ `*MergeTree` テーブルエンジン家族。 [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 固定クラッシュの統合運用がテーブル `SimpleAggregateFunction(LowCardinality)` コラム この修正 [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) +- すべてのicuロケールのサポートを復元し、定数式の照合順序を適用する機能を追加します。 また、言語名を追加する `system.collations` テーブル。 [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- ゼロ最小限の寿命を持つ外部辞書バグを修正しました (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)` バックグラウンドで更新しない。 [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) +- 固定したときにクラッシュする場合が外部辞書でclickhouseソースがサブクエリに返します。 [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- エンジンでテーブル内のファイル拡張子の誤った解析を修正 `URL`. この修正 [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) +- 修正 `CHECK TABLE` のためのクエリ `*MergeTree` キーのないテーブル。 修正 [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- 固定変換の `Float64` MySQLのタイプに。 [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([ユーリーバラノフ](https://github.com/yurriy)) +- 今ればいけない完全に落ちてしまったがサーバのクラッシュ、サーバーへの復元とその負荷ます。 [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- テーブル機能のクラッシュを修正 `file` 存在しないファイルに挿入している間。 この場合、ファイルが作成され、insertが処理されます。 [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- ときに発生する可能性がまれなデッドロックを修正 `trace_log` 有効になっています。 [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([フィリモノフ](https://github.com/filimonov)) +- ほかに異なるタイプで動作する機能を追加 `Date` で `RangeHashed` DDLクエリから作成された外部ディクショナリ。 修正 [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- ときの修正クラッシュ `now64()` 別の関数の結果で呼び出されます。 [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) +- 固定バグ検出クライアントip接続を通じてmysqlワイヤプロトコルです。 [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) +- 空の配列の処理を修正 `arraySplit` 機能。 この修正 [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) +- ときに問題を修正しました `pid-file` 別のランニングの `clickhouse-server` 削除される可能性があります。 [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) +- それが持っている場合 `invalidate_query` これは、以前の更新試行時に更新といくつかの例外を停止しました。 [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) +- 関数のエラーを修正しました `arrayReduce` それはにつながる可能性 “double free” そして、集計関数combinatorのエラー `Resample` それはメモリリークの原因となります。 集計関数の追加 `aggThrow`. この関数は、テスト目的で使用できます。 [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 改善 {#improvement-1} + +- での作業時に改善されたロギング `S3` テーブルエンジン。 [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- 印刷ヘルプメッセージがない場合引数が渡された通話の場合 `clickhouse-local`. この修正 [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) +- 設定を追加 `mutations_sync` 待つことができます `ALTER UPDATE/DELETE` 同期クエリ。 [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) +- 相対セットアップを許可する `user_files_path` で `config.xml` (同様の方法で `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) +- 変換関数の不正な型の例外を追加するには `-OrZero` 後置。 [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) +- 分散クエリでシャードに送信するデータのヘッダーの形式を簡素化します。 [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) +- `Live View` テーブルエンジンリファクタリング。 [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) +- DDLクエリから作成された外部ディクショナリのチェックを追加します。 [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) +- エラーの修正 `Column ... already exists` 使用している間 `FINAL` と `SAMPLE` together, e.g. `select count() from table final sample 1/2`. 修正 [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 今の最初の引数を表 `joinGet` 関数はテーブル識別子にすることができます。 [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([アモスの鳥](https://github.com/amosbird)) +- 使用を許可する `MaterializedView` 上記のサブクエリを使用する `Kafka` テーブル。 [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([フィリモノフ](https://github.com/filimonov)) +- これで、ディスク間の背景移動が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) ([Vitaly Baranov](https://github.com/vitlibar)) +- スタックトレース表示の物理アドレス(オフセットオブジェクトファイルの代わりに仮想メモリのアドレスのオブジェクトファイルが読み込まれ). それは使用をの可能にします `addr2line` binaryが独立した位置でASLRがアクティブな場合。 この修正 [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](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)) +- さて `cityHash` 機能で動作することができ `Decimal` と `UUID` タイプ。 修正 [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) +- アダプティブ粒度の実装後に廃止されたため、システムログから固定インデックス粒度(1024)が削除されました。 [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 有効なmysqlサーバーの互換性がclickhouseはめずにボタンを使用します。 [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([ユーリーバラノフ](https://github.com/yurriy)) +- これにより、バッチ内のデータが破損した場合の詳細なエラーが発生します。 [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) +- サポート `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` と `ATTACH TABLE` のために `MySQL` データベースエンジ [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([冬張](https://github.com/zhang2014)) +- S3テーブル機能とテーブルエンジンに認証を追加します。 [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 追加されたチェックの余分な部品 `MergeTree` 異なるディスクでは、未定義のディスクでデータ部分を見逃さないようにするためです。 [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) +- を、sslをサポートのためにmacをクライアントとサーバーです。 [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([イワン](https://github.com/abyss7)) +- 今clickhouseできる作品としてmysql連携サーバを参照https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- `clickhouse-client` 今だけ有効にする `bracketed-paste` マルチクエリがオンで、マルチラインがオフの場合。 この修正(\#7757)\[https://github.com/ClickHouse/ClickHouse/issues/7757\]。 [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([アモスの鳥](https://github.com/amosbird)) +- サポート `Array(Decimal)` で `if` 機能。 [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) +- サポート小数で `arrayDifference`, `arrayCumSum` と `arrayCumSumNegative` 機能。 [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) +- 追加 `lifetime` コラムへの `system.dictionaries` テーブル。 [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) +- 改良されたチェックインのための既存の部品の異なるハードディスク `*MergeTree` テーブルエンジン。 アドレス [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) +- との統合 `AWS SDK` のために `S3` 箱から出してすべてのS3の機能を使用することができます相互作用。 [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) +- サブクエリのサポートが追加されました `Live View` テーブル。 [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) +- 使用のための点検 `Date` または `DateTime` からの列 `TTL` 式は削除されました。 [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) +- ディスクに関する情報が追加された `system.detached_parts` テーブル。 [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 今すぐ設定 `max_(table|partition)_size_to_drop` 再起動せずに変更することができます。 [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- エラーメッ ユーザーに以下の行を削除しないように依頼する `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より良いメッセージを読むら `Kafka` 後の様々な形式のエンジン [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([イワン](https://github.com/abyss7)) +- サポートしていないmysqlクライアントとの互換性の向上 `sha2_password` authプラグイン。 [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([ユーリーバラノフ](https://github.com/yurriy)) +- 支援の列タイプのmysqlサーバーの互換性. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([ユーリーバラノフ](https://github.com/yurriy)) +- 実装 `ORDER BY` 最適化のための `Merge`, `Buffer` と `Materilized View` 下になるとストレージ `MergeTree` テーブル。 [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([アントン-ポポフ](https://github.com/CurtizJ)) +- 今、私たちは常にposixの実装を使用します `getrandom` 古いカーネル(\<3.17)との互換性を改善する。 [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([アモスの鳥](https://github.com/amosbird)) +- 移動ttlルールの有効な宛先をよりよくチェックします。 [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 壊れた挿入のバッチのためのよりよい点検 `Distributed` テーブルエンジン。 [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) +- 将来突然変異が処理されなければならない部品名の配列を持つ列を追加する `system.mutations` テーブル。 [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) +- 並列マージプロセッサのソート最適化。 [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 設定 `mark_cache_min_lifetime` 今は時代遅れで、何もしません。 以前のバージョンでは、マークキャッシュはメモリ内で `mark_cache_size` 内のデータを収容するために、 `mark_cache_min_lifetime` 秒。 それは、メモリ制約のあるシステムでは特に悪いことです。 このリリースをインストールした後にパフォーマンスが低下する場合は、 `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 使用する準備 `tid` どこにでも これは次の場合に必要です [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### 性能向上 {#performance-improvement-1} + +- 性能の最適化、プロセッサのパイプライン [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 非ブロック更新の有効期限が切れたキーキャッシュの辞書(許可を読古い。 [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- クリック `-fno-omit-frame-pointer` 世界的に余裕一するものとする。 [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([アモスの鳥](https://github.com/amosbird)) +- スピードアップ `greatCircleDistance` それのための性能試験を機能し、加えて下さい。 [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) +- 機能のパフォーマンスの向上 `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 改善された性能の `max`, `min`, `argMin`, `argMax` のために `DateTime64` データ型。 [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) +- 大きい限界および外的な分類の限界のないまたは分類の改善された性能。 [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 6回までの浮動小数点数の書式設定のパフォーマンスが向上しました。 [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 改善された性能の `modulo` 機能。 [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([アモスの鳥](https://github.com/amosbird)) +- 最適化 `ORDER BY` 単一の列キーとのマージ。 [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より良い実装 `arrayReduce`, `-Array` と `-State` コンビネーター [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([アモスの鳥](https://github.com/amosbird)) +- さて `PREWHERE` 少なくとも次のように最適化する必要があります `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([アモスの鳥](https://github.com/amosbird)) +- 方法を改善する `round` と `roundBankers` 負の数を扱う。 [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) +- デコード性能の向上 `DoubleDelta` と `Gorilla` 大体30-40%のコーデック。 この修正 [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) +- 改善された性能の `base64` 関連機能。 [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 機能を追加しました `geoDistance`. それは類似していますに `greatCircleDistance` しかし、WGS-84楕円体モデルに近似を使用します。 両方の機能のパフォーマンスは同じに近いです。 [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- より速く `min` と `max` 以下のための集計関数 `Decimal` データ型。 [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) +- ベクトル化処理 `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([アモスの鳥](https://github.com/amosbird)) +- `if` 鎖は今最大限に活用されます `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) +- パフォーマンスの回帰の修正 `Kafka` 19.15で導入されたテーブルエンジン。 この修正 [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([フィリモノフ](https://github.com/filimonov)) +- 削除 “pie” コード生成 `gcc` からDebianパッケージの時となります。 [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- データ形式の並列解析 [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- 最適化されたパーサーの有効化 `Values` デフォルトでの式の使用 (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) + +#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-2} + +- ビルドの修正 `ARM` そして、最小限のモードで。 [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) +- 追加取材ファイルのフラッシュ用 `clickhouse-server` std::atexitが呼び出されないとき。 も若干の改善にログイン状態試験。 [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) +- ContribのLLVMライブラリを更新します。 OSパッケージからのLLVMの使用を避けます。 [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- バンドルする `curl` 完全に静かなビルド。 [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) +- いくつかを修正 `MemorySanitizer` 警告。 [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 使用 `add_warning` と `no_warning` マクロ `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([イワン](https://github.com/abyss7)) +- Minio S3互換オブジェクトのサポートを追加(https://min.io/)より良い統合テストのために。 [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) +- インポート `libc` contribへのヘッダー。 ることができる作をより一貫性のあるさまざまなシステムのみ `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 削除 `-fPIC` いくつかの図書館から。 [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- クリーン `CMakeLists.txt` カールのため。 見るhttps://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- サイレント警告 `CapNProto` ライブラリ。 [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 追加の性能試験のため短い文字列を最適化ハッシュテーブル [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([アモスの鳥](https://github.com/amosbird)) +- 今clickhouseは上に構築されます `AArch64` たとえ `MADV_FREE` は利用できません。 この修正 [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([アモスの鳥](https://github.com/amosbird)) +- 更新 `zlib-ng` メモリ消毒の問題を修正するには. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- OSパッケージの使用は非常に脆弱で、通常はまったく動作しないため、Linux以外のシステムで内部MySQLライブラリを有効にします。 この修正 [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定構築システムによっては後に可能 `libc++`. これは [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 作る `Field` 方法によりtype-安全なものがあります。。 [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- に不足しているファイルを追加 `libc-headers` サブモジュール [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 間違った修正 `JSON` パフォーマンステスト出力の引用。 [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- スタックトレースが表示されます `std::exception` と `Poco::Exception`. 以前のバージョンでは、 `DB::Exception`. これは診断を改善します。 [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 移植 `clock_gettime` と `clock_nanosleep` 新しいglibc版のため。 [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([アモスの鳥](https://github.com/amosbird)) +- 有効 `part_log` 開発者のための例の設定で。 [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- リロードの非同期の性質を修正 `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) +- 固定コーデック性能テスト。 [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) +- インストールスクリプト `.tgz` それらのビルドとドキュメント。 [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) +- 古いものを削除 `ZSTD` テスト(2016年に作成され、ZSTDの1.0バージョンが持っていたバグを再現しました)。 この修正 [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mac OSカタリナ上の固定ビルド。 [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) +- 増加数行のコーデックの性能試験を果たしますのでご連絡ください [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) +- デバッグビルドでは、 `LOGICAL_ERROR` アサーションの失敗としての例外は、気付きやすくなります。 [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 形式関連のパフォーマンステストをより確定的にします。 [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 更新 `lz4` メモリを修正するには市民の失敗。 [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 例外処理で既知のmemorysanitizer false positiveを抑制します。 [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 更新 `gcc` と `g++` バージョン9へ `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) +- 追加の性能試験場合試験 `PREWHERE` より悪いです `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([アモスの鳥](https://github.com/amosbird)) +- ツつィツ姪“ツつ”ツ債ツづュツつケ [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- からのデータのmemorysanitizerレポートを避けます `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 更新 `libc++` 最新バージョンへ。 [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ソースからのビルドicuライブラリ。 この修正 [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- から切り替え `libressl` に `openssl`. ClickHouseは、この変更後にTLS1.3とSNIをサポートする必要があります。 この修正 [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 固定ubsanレポートを使用する場合 `chacha20_poly1305` SSLから(接続時に発生するhttps://yandex.ru/)。 [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- デフォルトのパスワードファイ `.deb` linuxディストリビュート。 [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) +- 取得のための改善された表現 `clickhouse-server` PID `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) +- Contrib/googletestをv1.10.0に更新しました。 [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- 。固定スレッドサニアイナイザレポートで `base64` ライブラリ。 また、このライブラリを最新バージョンに更新しましたが、問題はありません。 この修正 [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 修正 `00600_replace_running_query` プロセッサの場合。 [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- サポートの削除 `tcmalloc` 作るため `CMakeLists.txt` もっと簡単に [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- リリースgccは今使用ビルド `libc++` 代わりに `libstdc++`. 最近 `libc++` clangでのみ使用されました。 これにより、ビルド構成の一貫性と移植性が向上します。 [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MemorySanitizerでビルドするためのICUライブラリを有効にします。 [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 抑制する警告から `CapNProto` ライブラリ。 [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- のためのコードの特別なケースを削除 `tcmalloc` サポートされなくなったからです [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- CIカバレッジタスクでは、カバレッジレポートを保存できるようにサーバーを正常に終了します。 これは、我々が最近見てきた不完全な報道レポートを修正します。 [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) +- すべてのコーデックのパフォーマ `Float64` と `UInt64` 値。 [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) +- `termcap` 非常に非難され、さまざまな問題につながる(f.g.missing “up” 帽子およびエコー `^J` マルチラインの代わりに)。 お願い `terminfo` またはバンドル `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([アモスの鳥](https://github.com/amosbird)) +- 修正 `test_storage_s3` 統合テスト。 [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- サポート `StorageFile(, null)` 挿入をブロックを所定のフォーマットでなくファイルを実際に書き込みます。 これは必要な性能試験までを実施。 [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([アモスの鳥](https://github.com/amosbird)) +- 追加された引数 `--print-time` テストごとに実行時間を出力する機能テスト。 [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- にアサートを追加しました `KeyCondition` RPNを評価しながら。 これにより、gcc-9からの警告が修正されます。 [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ダンプcmakeのオプションci構造を作成する環境が整いました [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 一部のfatライブラリのデバッグ情報を生成しません。 [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 作る `log_to_console.xml` それは対話的であるかどうかにかかわらず、常にstderrにログインします。 [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 除去も未使用の特徴から `clickhouse-performance-test` ツール。 [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 今我々はまた検索する `lld-X` 対応を使って `clang-X` バージョン。 [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) +- 寄木細工のビルドの改善。 [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([マクスラン](https://github.com/maxulan)) +- より多くのgccの警告 [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- パッケージアーチlinuxすることはできなくなるようで走clickhouseサーバーになります。 [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) +- プロセッサでテストを修正。 小さな性能の修正。 [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- 更新contrib/protobuf. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V.Kornilov](https://github.com/matwey)) +- 新年のお祝いとしてc++20への切り替えの準備で。 “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([アモスの鳥](https://github.com/amosbird)) + +#### 実験的特徴 {#experimental-feature-1} + +- 実験的な設定を追加しました `min_bytes_to_use_mmap_io`. ることができるreadビッグファイルのコピーをせずにデータをカーネルを使うこと. の設定が無効になってデフォルトです。 推奨しきい値は、mmap/munmapが遅いため、約64MBです。 [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- アクセス制御システムの一部としてのクォータの変更。 新しいテーブルを追加 `system.quotas`、新しい機能 `currentQuota`, `currentQuotaKey`、新しいSQL構文 `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) +- を飛び未設定警告の代わりに投げることができます。 [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) +- アクセス制御システムの一部としての行ポリシーの変更。 新しいテーブルを追加 `system.row_policies`、新しい機能 `currentRowPolicies()`、新しいSQL構文 `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### セキュリティ修正 {#security-fix} + +- テーブル内のディレクトリ構造を読み取る可能性を修正 `File` テーブルエンジン。 この修正 [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## [2019年の変更履歴](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/ja/whats_new/index.md b/docs/ja/whats-new/index.md similarity index 100% rename from docs/ja/whats_new/index.md rename to docs/ja/whats-new/index.md diff --git a/docs/ja/whats_new/roadmap.md b/docs/ja/whats-new/roadmap.md similarity index 100% rename from docs/ja/whats_new/roadmap.md rename to docs/ja/whats-new/roadmap.md diff --git a/docs/ja/whats_new/security_changelog.md b/docs/ja/whats-new/security-changelog.md similarity index 100% rename from docs/ja/whats_new/security_changelog.md rename to docs/ja/whats-new/security-changelog.md diff --git a/docs/ja/whats_new/changelog/2017.md b/docs/ja/whats_new/changelog/2017.md deleted file mode 100644 index ba53fbcf9d3..00000000000 --- a/docs/ja/whats_new/changelog/2017.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 79 -toc_title: '2017' ---- - -### ClickHouseリリース1.1.54327、2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} - -このリリ: - -- 固定バグでレースの条件で接続文字列の構文は以下のようにこのデータが失われます。 この問題はバージョン1.1.54310および1.1.54318に影響します。 ご利用の場合これらのバージョンとの複製のテーブルを更新することが強く推奨されます。 この問題にログ警告メッセージのように `Part ... from own log doesn't exist.` この問題は、これらのメッセージがログに表示されない場合でも関連します。 - -### ClickHouseリリース1.1.54318、2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} - -このリリ: - -- SummingMergeTreeエンジンのマージ中に誤った行の削除が行われていた問題を修正しました -- 複雑でないmergetreeエンジンのメモリリークを修正しました -- MergeTreeエンジンで頻繁に挿入されるパフォーマンスの低下を修正 -- レプリケーションキューの実行を停止する問題を修正しました -- サーバーログの固定回転とアーカイブ - -### ClickHouseリリース1.1.54310、2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} - -#### 新しい機能: {#new-features} - -- カスタムパーティショニングキーのmergetree家族のテーブルエンジンです。 -- [カフカname](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) テーブルエンジン。 -- 読み込みのサポートを追加 [CatBoost](https://catboost.yandex/) モデルとそれらをClickHouseに格納されたデータに適用する。 -- UTCから非整数オフセットのタイムゾーンのサポートが追加されました。 -- 時間間隔による算術演算のサポートが追加されました。 -- Date型とDateTime型の値の範囲は、2105年に拡張されます。 -- を追加しました `CREATE MATERIALIZED VIEW x TO y` query(マテリアライズドビューのデータを格納するための既存のテーブルを指定します)。 -- を追加しました `ATTACH TABLE` 引数なしのクエリ。 -- SummingMergeTreeテーブルのマップで終わる名前を持つ入れ子になった列の処理ロジックが、sumMap集計関数に抽出されました。 これで、このような列を明示的に指定できます。 -- IP trie辞書の最大サイズは128Mのエントリに増加します。 -- GetSizeOfEnumType関数を追加しました。 -- SumWithOverflow集計関数を追加しました。 -- Cap'n Proto入力形式のサポートが追加されました。 -- では、今までのカスタマイズの圧縮レベル使用時のzstdアルゴリズムです。 - -#### 下位互換性のない変更: {#backward-incompatible-changes} - -- メモリ以外のエンジンを使用して一時テーブルを作成することはできません。 -- ビューまたはmaterializedviewエンジンでテーブルを明示的に作成することはできません。 -- 中表を作成し、新しいチェックを確認し、サンプリングキー表現が含まれ、その有効なタイプを利用します。 - -#### バグ修正: {#bug-fixes} - -- 分散テーブルに同期的に挿入するときのハングアップを修正しました。 -- レプリケートされたテーブル内の部品の追加と削除を修正しました。 -- マテリアライズドビューに挿入されたデータは、不要な重複排除を受けません。 -- ローカルレプリカが遅延し、リモートレプリカが使用できない分散テーブルへのクエリを実行しても、エラーは発生しません。 -- ユーザーにはアクセス許可は必要ありません。 `default` 一時テーブルを作成するデータベース。 -- 固定チを指定する場合は、配列型な論争することができます。 -- 固定hangups時のディスク容量を含むサーバのログします。 -- Unixエポックの最初の週のtoRelativeWeekNum関数のオーバーフローを修正しました。 - -#### ビルドの改善: {#build-improvements} - -- いくつかのサードパーティのライブラリ(特にpoco)が更新され、git submodulesに変換されました。 - -### ClickHouseリリース1.1.54304,2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} - -#### 新しい機能: {#new-features-1} - -- ネイティブプロトコルでのtlsサポート(有効にするには、 `tcp_ssl_port` で `config.xml` ). - -#### バグ修正: {#bug-fixes-1} - -- `ALTER` のための複製のテーブル現しようと走り出しています。 -- 固定波データを読み込むときに設定 `preferred_block_size_bytes=0.` -- の固定クラッシュ `clickhouse-client` 押すとき `Page Down` -- 特定の複雑なクエリの正しい解釈 `GLOBAL IN` と `UNION ALL` -- `FREEZE PARTITION` 常に今原子的に動作します。 -- 空のpost要求は、コード411で応答を返すようになりました。 -- のような式のための固定解釈エラー `CAST(1 AS Nullable(UInt8)).` -- 読み込み時のエラーを修正 `Array(Nullable(String))` からの列 `MergeTree` テーブル。 -- 固定表の構文解析時にクエリのように `SELECT dummy AS dummy, dummy AS b` -- ユーザーは無効で正しく更新されます `users.xml` -- 実行可能ディクショナリがゼロ以外の応答コードを返す場合の正しい処理。 - -### ClickHouseリリース1.1.54292、2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} - -#### 新しい機能: {#new-features-2} - -- を追加しました `pointInPolygon` 座標平面上の座標を操作するための関数。 -- を追加しました `sumMap` 次のような配列の合計を計算するための集約関数 `SummingMergeTree`. -- を追加しました `trunc` 機能。 丸め関数のパフォーマンスの向上 (`round`, `floor`, `ceil`, `roundToExp2` を正の論理をどのように。 のロジックを変更 `roundToExp2` 分数と負の数の関数。 -- ClickHouseの実行可能ファイルはlibcのバージョンにあまり依存しません。 同じClickHouseの実行可能ファイルは、Linuxシステムの多種多様で実行することができます。 コンパイルされたクエリを使用するときにはまだ依存関係があります(設定 `compile = 1` デフォルトでは使用されません)。 -- クエリの動的コンパイルに要する時間を短縮しました。 - -#### バグ修正: {#bug-fixes-2} - -- 時々生成エラーを修正しました `part ... intersects previous part` メッセージとレプリカの一貫性の低下。 -- 固定エラーの原因となったサーバをロックした場合飼育係できなかった時のシャットダウンしました。 -- レプリカの復元時に過剰なログを削除。 -- ユニオンすべての実装でエラーを修正しました。 -- ブロック内の最初の列に配列型がある場合に発生したconcat関数のエラーを修正しました。 -- の進捗を正しく表示されます。テーブルをマージする。 - -### ClickHouseリリース1.1.54289、2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} - -#### 新しい機能: {#new-features-3} - -- `SYSTEM` サーバ管理のクエリ: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. -- 配列を操作するための関数を追加: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. -- 追加 `root` と `identity` ZooKeeper設定のパラメーターです。 これにより、同じZooKeeperクラスター上の個々のユーザーを分離できます。 -- 集計関数の追加 `groupBitAnd`, `groupBitOr`、と `groupBitXor` (互換性のために、それらは名前の下にも利用可能です `BIT_AND`, `BIT_OR`、と `BIT_XOR`). -- 外部の辞書からロード可能でmysqlを指定するソケットのファイルシステム. -- 外部辞書はmysqlからssl経由でロードできます (`ssl_cert`, `ssl_key`, `ssl_ca` パラメータ)。 -- を追加しました `max_network_bandwidth_for_user` ユーザーごとのクエリの全体的な帯域幅の使用を制限する設定。 -- のサポート `DROP TABLE` 一時テーブルの場合。 -- 読書のためのサポート `DateTime` Unixのタイムスタンプ形式の値 `CSV` と `JSONEachRow` フォーマット。 -- 分散クエリの遅延レプリカは、既定で除外されるようになりました(既定のしきい値は5分)。 -- 継続的に実行されるクエリでは、alterクエリが無期限にブロックされることはありません。 -- 設定するオプション `umask` 設定ファイルで。 -- クエリのパフォーマンスの向上 `DISTINCT` . - -#### バグ修正: {#bug-fixes-3} - -- ZooKeeperの古いノードを削除するプロセスを改善しました。 以前は、非常に頻繁な挿入があった場合、古いノードが削除されなかったことがあり、サーバーのシャットダウンが遅くなっていました。 -- ZooKeeperへの接続のためのホストを選択する際に固定ランダム化。 -- レプリカがlocalhostの場合、分散クエリでの遅延レプリカの除外を修正しました。 -- Aのデータ部分エラーを修正しました `ReplicatedMergeTree` テーブ `ALTER MODIFY` aの要素に `Nested` 構造。 -- 選択クエリの原因となるエラーを修正しました “hang”. -- 分散ddlクエリの改善。 -- クエリを修正 `CREATE TABLE ... AS `. -- でデッドロックを解決しました `ALTER ... CLEAR COLUMN IN PARTITION` のためのクエリ `Buffer` テーブル。 -- の無効なデフォルト値を修正しました `Enum` s(最小値の代わりに0)を使用する場合、 `JSONEachRow` と `TSKV` フォーマット。 -- 解決の姿ゾンビプロセスが辞書を使いながら、 `executable` ソース。 -- ヘッドクエリのための固定segfault。 - -#### 改善ワークフローの開発と組み立てclickhouse: {#improved-workflow-for-developing-and-assembling-clickhouse} - -- を使用することができ `pbuilder` ClickHouseを構築する。 -- を使用することができ `libc++` 代わりに `libstdc++` Linux上のビルドの場合。 -- 静的コード分析ツールを使用するための手順を追加: `Coverage`, `clang-tidy`, `cppcheck`. - -#### ご注意ください: {#please-note-when-upgrading} - -- これで、mergetree設定のデフォルト値が大きくなりました `max_bytes_to_merge_at_max_space_in_pool` (マージするデータ部分の最大合計サイズ(バイト単位)):100GiBから150GiBに増加しました。 この結果、大型の合併-走行後のサーバグの原因になりの増加に負荷をディスクサブシステムです。 サーバー上で利用可能な空き領域が、実行中のマージの合計量の倍未満である場合、小さなデータ部分のマージを含め、他のすべてのマージが実行を停止します。 その結果、INSERTクエリはメッセージで失敗します “Merges are processing significantly slower than inserts.” を使用 `SELECT * FROM system.merges` 状況を監視するためのクエリ。 また点検できます `DiskSpaceReservedForMerge` のメトリック `system.metrics` テーブル、またはグラファイト。 大きなマージが完了すると問題は解決するので、これを修正するために何もする必要はありません。 これが受け入れられない場合は、以前の値を復元することができます `max_bytes_to_merge_at_max_space_in_pool` 設定。 これを行うには、 設定のセクション。xml、セット ``` ``107374182400 ``` サーバーを再起動します。 - -### ClickHouseリリース1.1.54284,2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} - -- これは以前の1.1.54282リリースのバグ修正リリースです。 それはzookeeperの部品ディレクトリに漏れを修正します。 - -### ClickHouseリリース1.1.54282、2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} - -このリリ: - -- 固定 `DB::Exception: Assertion violation: !_path.empty()` 分散テーブルに挿入するとき。 -- 入力データが';'で始まる場合、rowbinary形式で挿入時の解析を修正しました。 -- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). - -### Clickhouseリリース1.1.54276,2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} - -#### 新しい機能: {#new-features-4} - -- 選択クエリのセクションでオプションを追加しました。 クエリ例: `WITH 1+1 AS a SELECT a, a*a` -- すべてのデータがすべてのシャードに保存された後にのみ、okが返されます。 これは、insert\_distributed\_sync=1の設定によって有効になります。 -- 16バイトの識別子を扱うためのuuidデータ型を追加しました。 -- タブローとの互換性のためにchar、floatおよび他のタイプのエイリアスを追加しました。 -- 時間を数値に変換する関数toyyyyymm、toyyyymmdd、およびtoyyyymmddhhmmssを追加しました。 -- IPアドレス(ホスト名と共に)を使用して、クラスタ化されたDDLクエリのサーバーを識別できます。 -- 関数内の非定数引数と負のオフセットのサポートが追加されました `substring(str, pos, len).` -- のmax\_sizeパラメーターを追加しました。 `groupArray(max_size)(column)` 集約関数、およびその性能を最適化しました。 - -#### 主な変更点: {#main-changes} - -- セキュリティの改善:すべてのサーバーファイルは0640権限で作成されます(変更できます 設定パラメータ)。 -- 無効な構文のクエリの改善されたエラーメッセージ。 -- 低メモリ消費をとした場合の性能改善の統合大分mergetreeデータです。 -- ReplacingMergeTreeエンジンのデータマージのパフォーマンスが大幅に向上しました。 -- 性能向上のための非同期に挿入しますから分散型のテーブルを組み合わせで複数のソースしました。 この機能を有効にするには、distributed\_directory\_monitor\_batch\_inserts=1という設定を使用します。 - -#### 下位互換性のない変更: {#backward-incompatible-changes-1} - -- の集約状態のバイナリ形式を変更しました `groupArray(array_column)` 配列の関数。 - -#### 変更の完全なリスト: {#complete-list-of-changes} - -- を追加しました `output_format_json_quote_denormals` これにより、nanとinfの値をJSON形式で出力することができます。 -- 最適化したストリーム配置の場合を読み込んで配布します。 -- 値が変更されない場合は、readonlyモードで設定を行うことができます。 -- Preferred\_block\_size\_bytes設定で指定されたブロックサイズの制限を満たすために、MergeTreeエンジンの非整数granules粒を取得する機能を追加しました。 のための消費量を削減RAMを増やキャッシュの地域が処理クエリーテーブルの大きい。 -- 次のような式を含むインデックスの効率的な使用 `toStartOfHour(x)` のような条件の場合 `toStartOfHour(x) op сonstexpr.` -- MergeTreeエンジンの新しい設定(configのmerge\_treeセクション)を追加しました。xml): - - replicated\_deduplication\_window\_secondsは、レプリケートされたテーブルの挿入の重複除外に使用できる秒数を設定します。 - - cleanup\_delay\_periodは、古いデータを削除するためにクリーンアップを開始する頻度を設定します。 - - replicated\_can\_become\_leaderでは、レプリカがリーダーにならないようにすることができます(マージの割り当て)。 -- 加速の清掃除時代遅れからのデータの飼育係. -- クラスタ化されたddlクエリの複数の改善と修正。 特に重要なのは、クラスタ内のサーバーからの応答を待つ時間を制限する新しい設定distributed\_ddl\_task\_timeoutです。 ddl要求がすべてのホストで実行されていない場合、応答にタイムアウトエラーが含まれ、要求は非同期モードで実行されます。 -- サーバーログにおけるスタックトレースの表示の改善。 -- を追加しました “none” 圧縮方法の値。 -- Configで複数のdictionaries\_configセクションを使用できます。xmlだ -- ファイルシステムのソケットを介してmysqlに接続することは可能です。 -- システム。部品表は、新しい列に関する情報はサイズメッセージが表示され、バイトです。 - -#### バグ修正: {#bug-fixes-4} - -- マージテーブルを使用する分散テーブルは、現在の条件と選択クエリのために正しく動作します `_table` フィールド。 -- ReplicatedMergeTreeでデータパーツをチェックする際の競合状態を修正しました。 -- 上の固定可能な凍結 “leader election” サーバーを起動するとき。 -- データソースのローカルレプリカを使用する場合、max\_replica\_delay\_for\_distributed\_queries設定は無視されました。 これは修正されました。 -- の誤った動作を修正しました `ALTER TABLE CLEAR COLUMN IN PARTITION` 既存の列以外の列をクリーンアップしようとした場合。 -- 空の配列または文字列を使用する場合、multif関数の例外を修正しました。 -- 固定の過剰なメモリ割当ての場合deserializingネイティブ形式です。 -- トライ辞書の不正な自動更新を修正しました。 -- 固定の例外実行時にクエリを処理するクラウドの場合、group by節からmergeテーブル使用時のサンプルです。 -- Distributed\_aggregation\_memory\_efficient=1を使用したときにGROUP BYがクラッシュする問題を修正しました。 -- これで、データベースを指定できます。inとjoinの右側にあるテーブル。 -- 並列集約に使用されるスレッドが多すぎます。 これは修正されました。 -- どのように固定 “if” 関数は、FixedString引数で動作します。 -- 重量が0のシャードの分散テーブルから誤って処理されたものを選択します。 これは修正されました。 -- 実行中 `CREATE VIEW IF EXISTS no longer causes crashes.` -- Input\_format\_skip\_unknown\_fields=1が設定され、負の数がある場合の動作が正しくない問題を修正しました。 -- の無限ループを修正しました `dictGetHierarchy()` 辞書に無効なデータがある場合は機能します。 -- 固定 `Syntax error: unexpected (...)` INまたはJOIN句およびMergeテーブル内のサブクエリを使用して分散クエリを実行するときのエラー。 -- 辞書テーブルからの選択クエリの誤った解釈を修正しました。 -- 修正された “Cannot mremap” 2億以上の要素を持つinおよびJOIN句で配列を使用するときにエラーが発生します。 -- ソースとしてmysqlと辞書のフェイルオーバーを修正しました。 - -#### 改善ワークフローの開発と組み立てclickhouse: {#improved-workflow-for-developing-and-assembling-clickhouse-1} - -- ビルドはarcadiaで組み立てることができます。 -- Gcc7を使用してClickHouseをコンパイルできます。 -- Ccache+distccを使用した並列ビルドの方が高速になりました。 - -### ClickHouseリリース1.1.54245,2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} - -#### 新しい機能: {#new-features-5} - -- 分散ddl(例, `CREATE TABLE ON CLUSTER`) -- 複製されたクエリ `ALTER TABLE CLEAR COLUMN IN PARTITION.` -- エンジンのための辞書のテーブル(アクセスの辞書データの形式で表)。 -- 辞書データベースエンジン(タイプのデータベースに自動的に辞書で使用可能なテーブルを接続外部辞書). -- ソースに要求を送信することによって、辞書の更新を確認できます。 -- 修飾された列名 -- 二重引用符を使用して識別子を引用する。 -- セッションを行うhttpのインタフェース。 -- レプリケートされたテーブルの最適化クエリは、リーダーだけでなく実行できます。 - -#### 下位互換性のない変更: {#backward-incompatible-changes-2} - -- 削除セットグローバル。 - -#### 軽微な変更: {#minor-changes} - -- アラートがトリガーされると、ログは完全なスタックトレースを出力します。 -- 起動時に破損/余分なデータパーツの数の検証を緩和しました(誤検出が多すぎます)。 - -#### バグ修正: {#bug-fixes-5} - -- 接続不良を修正しました “sticking” 分散テーブルに挿入するとき。 -- GLOBAL INは、分散テーブルを参照するMergeテーブルからのクエリに対して機能します。 -- Google Compute Engine仮想マシンでコアの数が正しくないことが検出されました。 これは修正されました。 -- キャッシュされた外部ディクショナリの実行可能ソースの動作の変更 -- ヌル文字を含む文字列の比較を修正しました。 -- 定数を持つfloat32主キーフィールドの比較を修正しました。 -- 従来、不正確な見積りのサイズの分野が過度に大きな分配すべき。 -- ALTERを使用してテーブルに追加されたNull許容列を照会するとクラッシュする問題を修正しました。 -- 行の数が制限よりも小さい場合、null可能な列でソートするとクラッシュする問題を修正しました。 -- 定数値のみで構成されるorder byサブクエリを修正しました。 -- については、従来、複製テーブルが残る無効な状態にした後、失敗した下表に示す。 -- 空の結果を持つスカラーサブクエリのエイリアスは失われなくなりました。 -- .soファイルが破損した場合、コンパイルを使用したクエリはエラーで失敗しません。 diff --git a/docs/ja/whats_new/changelog/2019.md b/docs/ja/whats_new/changelog/2019.md deleted file mode 100644 index 47351882033..00000000000 --- a/docs/ja/whats_new/changelog/2019.md +++ /dev/null @@ -1,2074 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_priority: 77 -toc_title: '2019' ---- - -## ClickHouseリリースv19.17 {#clickhouse-release-v19-17} - -### ClickHouseリリースv19.17.6.36,2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} - -#### バグ修正 {#bug-fix} - -- Decompressでバッファオーバーフローの可能性を修正 悪意のあるユーザーで製作した圧縮データが読み後のバッファです。 この問題は、Yandexの情報セキュリティチームのEldar Zaitovによって発見されました。 [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定可能なサーバのクラッシュ (`std::terminate`)サーバーがJsonまたはXML形式で文字列データ型(UTF-8検証が必要)の値を使用してデータを送信または書き込むことができない場合、またはBrotliアルゴリズムま [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- クリックハウスからのソースを持つ固定辞書 `VIEW` 今、そのような辞書を読んでもエラーは発生しません `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 固定照合するクライアントホストで許可されhost\_regexp指定されます。xmlだ [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- `RENAME TABLE` 分散表現に変更、フォルダが挿入されデータを送信する前に破片. これにより、連続した名前変更の問題が修正されます `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- `range_hashed` 外部辞書作成DDLわきの範囲は任意の数値です。 [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -- 固定 `INSERT INTO table SELECT ... FROM mysql(...)` テーブル機能。 [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- 固定segfaultで `INSERT INTO TABLE FUNCTION file()` 存在しないファイルに挿入している間。 この場合、ファイルが作成され、insertが処理されます。 [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- 集計ビットマップとスカラビットマップとの交差時にビットマップとエラーを修正 [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([越黄](https://github.com/moon03432)) -- 固定segfault時 `EXISTS` クエリが使用されなかった `TABLE` または `DICTIONARY` 修飾子,ちょうどのような `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 関数の戻り値の型を修正 `rand` と `randConstant` nullable引数の場合。 Now関数は常に戻ります `UInt32` そして決して `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 固定 `DROP DICTIONARY IF EXISTS db.dict` 今は例外をスローしません `db` 存在しない [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- さん完全に落ちてしまったがサーバのクラッシュ、サーバへの復元とその負荷で [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- 複数のシャードローカルテーブルが存在する場合、分散テーブルの簡単なカウントクエリが修正されました。 [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- DB::BlockStreamProfileInfo::calculateRowsBeforeLimitのデータレースにつながるバグを修正しました() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -- 固定 `ALTER table MOVE part` 実行直後の統合、指定された部分を引き起こす可動部を、指定された部分に統合します。 今度は、指定された部分を正しく移動します。 [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 辞書の式を文字列として指定できるようになりました。 これは、非clickhouseソースからデータを抽出する際に、それらの式に非clickhouse構文を使用できるため、属性の計算に役立ちます。 [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -- で非常にまれなレースを修正しました `clickhouse-copier` ZXidのオーバーフローのため。 [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([丁象飛](https://github.com/dingxiangfei2009)) -- クエリが失敗した後にバグを修正しました(原因 “Too many simultaneous queries” たとえば、外部テーブル情報を読み込まず、 - 次の要求は、この情報を次のクエリの先頭と解釈し、次のようなエラーを引き起こします `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- 後にnull逆参照を避ける “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- すべてのicuロケールのサポートを復元し、定数式の照合順序を適用し、システムに言語名を追加する機能を追加します。照合テーブル。 [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -- 読み込み元のストリームの数 `StorageFile` と `StorageHDFS` メモリ制限を超えないように制限されています。 [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -- 固定 `CHECK TABLE` のためのクエリ `*MergeTree` キーのないテーブル。 [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -- 変異がなかった場合には、部分名から突然変異番号を削除しました。 この除去との互換性を高め、古いバージョン. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -- テーブルバージョンよりもdata\_versionが大きいため、一部のアタッチされたパーツに対して変異がスキップされる不具合を修正した。 [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) -- 別のデバイスに移動した後、部品の冗長コピーを使用してサーバーを起動できます。 [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- エラーを修正しました “Sizes of columns doesn’t match” これは、集計関数列を使用する場合に表示されます。 [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- LIMIT BYと一緒にWITH TIESを使用する場合は、例外がスローされます。 そして今、トップをLIMIT BYで使うことができます。 [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- それが持っている場合 `invalidate_query` これは、以前の更新試行時に更新といくつかの例外を停止しました。 [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) - -### ClickHouseリリースv19.17.4.11、2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} - -#### 下位互換性のない変更 {#backward-incompatible-change} - -- 使用カラムの代わりにastビスカラサブクエリの結果よりよい。 設定 `enable_scalar_subquery_optimization` 19.17で追加され、デフォルトで有効になりました。 繋がるようなエラー [この](https://github.com/ClickHouse/ClickHouse/issues/7851) 以前のバージョンから19.17.2または19.17.3にアップグレード中。 この設定はデフォルトで無効にで19.17.4、可能からのアップグレード19.16、以前のバージョンなします。 [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([アモスの鳥](https://github.com/amosbird)) - -#### 新しい機能 {#new-feature} - -- DDLクエリで辞書を作成する機能を追加します。 [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) -- 作る `bloom_filter` 索引をサポートするタイプ `LowCardinality` と `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 機能を追加 `isValidJSON` 渡された文字列が有効なjsonであることを確認する。 [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) -- 実装 `arrayCompact` 機能 [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([メモ](https://github.com/Joeywzr)) -- 作成された機能 `hex` 十進数のため。 それはのように働く `hex(reinterpretAsString())`、しかし、最後のゼロバイトを削除しません。 [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) -- 追加 `arrayFill` と `arrayReverseFill` 配列内のそれらの前後の他の要素によって要素を置き換える関数。 [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) -- 追加 `CRC32IEEE()`/`CRC64()` サポート [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) -- 実装 `char` 関数に似ています。 [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) -- 追加 `bitmapTransform` 機能。 これは、ビットマップ内の値の配列を別の値の配列に変換し、結果は新しいビットマップになります [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) -- 実装 `javaHashUTF16LE()` 機能 [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbabcomment](https://github.com/achimbab)) -- 追加 `_shard_num` 分散エンジンの仮想列 [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) - -#### 実験的特徴 {#experimental-feature} - -- 新しいクエリ実行パイプライン)のサポート `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### バグ修正 {#bug-fix-1} - -- 不正な浮動小数点解析の修正 `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- Trace\_logが有効になっているときに発生する稀なデッドロックを修正します。 [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([フィリモノフ](https://github.com/filimonov)) -- 防止のメッセージの複製を制作するカフカテーブルには、mvsの選択からで [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([イワン](https://github.com/abyss7)) -- のサポート `Array(LowCardinality(Nullable(String)))` で `IN`. 解決 [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbabcomment](https://github.com/achimbab)) -- の処理を追加 `SQL_TINYINT` と `SQL_BIGINT`、および修正の取り扱い `SQL_FLOAT` ODBCブリッジのデータソースの種類。 [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- 集約の修正 (`avg` 空の小数点以下桁数を超えた場合 [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) -- 修正 `INSERT` 分散に `MATERIALIZED` 列 [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- 作る `MOVE PARTITION` 仕事のパーツがあった場合にエントランスは目を引く壁面緑化依存度はさほど高くないものの、保存先ディスクまたは量 [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- ハードリンクがで突然変異の間に作成されるために失敗したバグを修正 `ReplicatedMergeTree` マルチディスク構成で。 [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 部分全体が変更されず、最高のスペースが別のディスク上に発見されているときmergetreeに変異を持つバグを修正しました [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) -- とのバグを修正 `keep_free_space_ratio` ディスク構成から読み取られない [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) -- テーブルのみを含むバグを修正 `Tuple` 複雑なパスを持つ列または列。 修正 [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) -- Max\_memory\_usage制限のバッファエンジンのメモリを考慮しない [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) -- で最終的なマークの使用状況を修正 `MergeTree` テーブルの順序付け `tuple()`. まれにそれはに導くことができます `Can't adjust last granule` 選択中にエラー。 [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([アントン-ポポフ](https://github.com/CurtizJ)) -- クラッシュや奇妙な例外につながる可能性があり、コンテキスト(jsonのための例の機能)を必要とするアクションと述語を持っている変異のバグを [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) -- データベース名とテーブル名の不一致を修正 `data/` と `shadow/` ディレク [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. この場合のクラッシュを修正。 [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正 `Not found column in block` RIGHTまたはFULL JOINでexpressionに参加するとき。 [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) -- 無限ループを修正するもう一つの試み `PrettySpace` 書式 [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) -- バグを修正 `concat` すべての引数が `FixedString` 同じサイズの。 [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) -- S3、URLおよびHDFSストレージを定義しながら、1引数を使用した場合の例外を修正しました。 [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) -- クエリでビューのinterpreterselectqueryのスコープを修正 [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) - -#### 改善 {#improvement} - -- `Nullable` ODBCブリッジによって正しく処理される列とNULL値 [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- 分散送信の現在のバッチをアトミックに書き込む [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) -- クエリで列名のテーブルを検出できない場合は、例外をスローします。 [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加 `merge_max_block_size` に設定する `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) -- とのクエリ `HAVING` とせずに `GROUP BY` 当グループによる定数です。 だから, `SELECT 1 HAVING 1` 今すぐ結果を返します。 [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([アモスの鳥](https://github.com/amosbird)) -- サポート解析 `(X,)` pythonに似たタプルとして。 [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([アモスの鳥](https://github.com/amosbird)) -- 作る `range` 関数の振る舞いはpythonicのようなものです。 [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) -- 追加 `constraints` テーブルへの列 `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) -- より良いnullの場合形式のtcpハンドラで利用可能 `select ignore() from table format Null` clickhouseによるperfの測定のため-顧客 [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([アモスの鳥](https://github.com/amosbird)) -- のようなクエリ `CREATE TABLE ... AS (SELECT (1, 2))` 正しく解析されます [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) - -#### 性能向上 {#performance-improvement} - -- 短い文字列キーに対する集約のパフォーマンスが向上しました。 [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [アモスの鳥](https://github.com/amosbird)) -- 構文/式分析の別のパスを実行して、定数述部が折り畳まれた後に潜在的な最適化を取得します。 [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([アモスの鳥](https://github.com/amosbird)) -- ストレージメタ情報を使用して簡単に評価する `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([アモスの鳥](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) -- ベクトル化処理 `arrayReduce` アグリゲータと同様です `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([アモスの鳥](https://github.com/amosbird)) -- の性能のマイナーな改善 `Kafka` 消費 [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([イワン](https://github.com/abyss7)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement} - -- クロスコンパイルのサポートをcpuアーキテクチャaarch64に追加します。 リファクタリング [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([イワン](https://github.com/abyss7)) -- パッケージのビルド時に、darwin-x86\_64およびlinux-aarch64ツールチェーンをマウントされたdockerボリュームに解凍する [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([イワン](https://github.com/abyss7)) -- 更新docker画像のバイナリーベル [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([イワン](https://github.com/abyss7)) -- MacOSのカタリナの固定コンパイルエラー [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) -- クエリ分析ロジックのリファクタリング:複雑なクラスを複数の単純なクラスに分割します。 [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) -- サブモジュールなしでビルドを修正 [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) -- より良い `add_globs` CMakeファイル内 [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([アモスの鳥](https://github.com/amosbird)) -- ハードコードされたパスの削除 `unwind` ターゲット [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) -- Sslなしでmysql形式を使用できるようにする [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) - -#### その他 {#other} - -- ClickHouse SQLダイアレクトのANTLR4文法を追加 [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouseリリースv19.16 {#clickhouse-release-v19-16} - -#### Clickhouseリリースv19.16.14.65,2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} - -- 複数の引数(10以上)の三元論理演算のバッチ計算のバグを修正しました。 [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz))このバグ修正は、Altinityからの特別な要求によってバージョン19.16にバックポートされました。 - -#### Clickhouseリリースv19.16.14.65,2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} - -- 古いchバージョンとの分散サブクエリの非互換性を修正しました。 修正 [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) - [(tabplubix)](https://github.com/tavplubix) -- 実行時期 `CREATE` クエリー、倍定表現のストレージエンジンの引数です。 空のデータベース名を現在のデータベ 修正 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). また、ローカルアドレスの確認を修正 `ClickHouseDictionarySource`. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- 今、背景には、マージ `*MergeTree` テーブルエンジンの家族の保存-保存政策に大量注文しております。 - [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- データを失うのを防ぐ `Kafka` まれに、接尾辞を読んだ後でコミットする前に例外が発生した場合。 修正 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). 関連: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(フィリモノフ)](https://github.com/filimonov) -- のを修正した。先サーバを終了しようとした場合に使用/drop `Kafka` テーブル作成されたパラメータ。 修正 [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). 組み込み [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(フィリモノフ)](https://github.com/filimonov) -- 使用を許可する `MaterializedView` 上記のサブクエリを使用する `Kafka` テーブル。 - [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([フィリモノフ](https://github.com/filimonov)) - -#### 新しい機能 {#new-feature-1} - -- 追加 `deduplicate_blocks_in_dependent_materialized_views` マテリアライズドビューを持つテーブルへの冪等挿入の動作を制御するオプション。 この新機能は、Altinityからの特別な要求によってbugfixリリースに追加されました。 - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### ClickHouseリリースv19.16.2.2、2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} - -#### 下位互換性のない変更 {#backward-incompatible-change-1} - -- Count/counIfに不足しているアリティ検証を追加します。 - [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) - [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) -- レガシーを削除 `asterisk_left_columns_only` 設定(デフォルトでは無効になっていました)。 - [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem - Zuikov](https://github.com/4ertus2)) -- フォーマット文字列のためのテンプレートデータの形式は指定のファイルです。 - [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) - -#### 新しい機能 {#new-feature-2} - -- Uint\_maxより大きい基数を計算するために、uniqCombined64()を導入します。 - [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), - [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat - Khuzhin](https://github.com/azat)) -- 支援bloom filterを指標配列に列あります。 - [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) - ([achimbabcomment](https://github.com/achimbab)) -- 関数を追加する `getMacro(name)` これは、対応する値を持つ文字列を返します `` - サーバー構成から。 [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- HTTPソースに基づいてディクショナリの設定オプションを設定する: `credentials` と - `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- 新しいprofileeventを追加する `Merge` これは、起動された背景のマージの数を数えます。 - [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([ミハイル - Korotov](https://github.com/millb)) -- 完全修飾ドメイン名を返すfullhostname関数を追加します。 - [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) - [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) -- 機能を追加 `arraySplit` と `arrayReverseSplit` これは配列を分割する “cut off” - 条件。 これらは、時系列の処理に役立ちます。 - [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) -- マッチしたすべてのインデックスの配列をmultimatchファミリの関数に返す新しい関数を追加します。 - [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([ダニラ - クテニン](https://github.com/danlark1)) -- 新規データベースエンジンの追加 `Lazy` それは多数の小さい丸太を貯えるために最大限に活用されます - テーブル。 [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([ニキータ - Vasilev](https://github.com/nikvas0)) -- ビットマップ列の集計関数groupbitmapand、-または、-xorを追加します。 [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang - ゆう](https://github.com/yuzhichang)) -- Nullを返す集計関数combinators-OrNullと-OrDefaultを追加します - または、集計するものがない場合のデフォルト値。 - [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) - ([hcz](https://github.com/hczhcz)) -- カスタ - 区切り文字ルール。 [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) -- 外部辞書のソースとしてサポートredis。 [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [アントン - ポポフ](https://github.com/CurtizJ)) - -#### バグ修正 {#bug-fix-2} - -- 修正誤ったクエリの結果の場合で `WHERE IN (SELECT ...)` セクションと `optimize_read_in_order` は - 使用される。 [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([アントン - ポポフ](https://github.com/CurtizJ)) -- プロジェクトの外のファイルに依存する無効mariadb認証プラグイン、。 - [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([ユーリ - Baranov](https://github.com/yurriy)) -- 例外を修正 `Cannot convert column ... because it is constant but values of constants are different in source and result` これは、関数が `now()`, `today()`, - `yesterday()`, `randConstant()` 使用されます。 - [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([ニコライ - Kochetov](https://github.com/KochetovNicolai)) -- 固定問題のhttp生き生きと保つタイムアウトの代わりにtcpのままにしておくタイムアウト. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([バシリー - Nemkov](https://github.com/Enmk)) -- GroupBitmapOrのセグメンテーション障害を修正しました(問題 [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). - [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang - ゆう](https://github.com/yuzhichang)) -- のための実現の為のためのカフカでとても間近に見ることができすべてのデータが書かれています。 - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([イワン](https://github.com/abyss7)) -- 固定間違った `duration_ms` 値の `system.part_log` テーブル。 それは十回オフだった。 - [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- 修正を解決するクラッシュライブビューテーブルの再可能なすべてのライブビュー。 - [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) - ([vzakaznikov](https://github.com/vzakaznikov)) -- MergeTreeパーツの最小/最大インデックスでNULL値を正しくシリアル化します。 - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- 仮想列を置かないでください。テーブル作成時のsqlメタデータ `CREATE TABLE AS`. - [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([イワン](https://github.com/abyss7)) -- セグメンテーショ `ATTACH PART` クエリ。 - [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) - ([alesapin](https://github.com/alesapin)) -- サブクエリの空と空の最適化によって与えられたいくつかのクエリの間違った結果を修正 - INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([ニコライ - Kochetov](https://github.com/KochetovNicolai)) -- ライブビューのgetheader()メソッドでaddresssanitizerエラーを修正します。 - [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) - ([vzakaznikov](https://github.com/vzakaznikov)) - -#### 改善 {#improvement-1} - -- Queue\_wait\_max\_ms待機が発生した場合にメッセージを追加します。 - [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat - Khuzhin](https://github.com/azat)) -- メイドの設定 `s3_min_upload_part_size` テーブルレベル。 - [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- StorageFactoryでTTLをチェックします。 [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) - ([sundyli](https://github.com/sundy-li)) -- 部分マージ結合(最適化)でスカッシュ左側のブロック。 - [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem - Zuikov](https://github.com/4ertus2)) -- レプリケートされたテーブルエンジンの変異時に非決定論的関数を許可しないでください。 - レプリカ間に不整合が生じる可能性があります。 - [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([Alexander - Kazakov](https://github.com/Akazz)) -- 無効メモリにトラッカーが変換の例外のスタックトレースを文字列になります。 それを防ぐことができ損失 - タイプのエラーメッセージ `Memory limit exceeded` サーバーでは、 `Attempt to read after eof` クライアントの例外。 [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) - ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- その他の形式の改善。 解決 - [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), - [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), - [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), - [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) - [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) - ([tavplubix](https://github.com/tavplubix)) -- ClickHouseは、左側に変換不可能なIN演算子の右側の値を無視します - side type. Make it work properly for compound types – Array and Tuple. - [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- ASOF JOINの欠落した不等式をサポートします。 以下または等しいバリアントと厳密に結合することが可能です - 構文上のASOF列の大きいと少ない変種。 - [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem - Zuikov](https://github.com/4ertus2)) -- 部分マージ結合を最適化します。 [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) - ([Artem Zuikov](https://github.com/4ertus2)) -- 使用しない以上98kのメモリでuniqcombined機能。 - [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), - [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat - Khuzhin](https://github.com/azat)) -- PartialMergeJoinのディスク上の右側の結合テーブルのフラッシュ部分(十分でない場合 - メモリ)。 負荷データが必要です。 [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) - ([Artem Zuikov](https://github.com/4ertus2)) - -#### 性能向上 {#performance-improvement-1} - -- データの重複を避けることによって、joingetをconst引数で高速化します。 - [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos - 鳥](https://github.com/amosbird)) -- サブクエリが空の場合は、earlyを返します。 - [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) -- 値のsql式の解析を最適化します。 - [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) - ([tavplubix](https://github.com/tavplubix)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-1} - -- 無効化あcontribsクロスコンパイルをmac os. - [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([イワン](https://github.com/abyss7)) -- Clickhouse\_common\_ioのPocoXMLとのリンクが見つかりませんを追加します。 - [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat - Khuzhin](https://github.com/azat)) -- Clickhouse-testで複数のテストフィルター引数を受け入れます。 - [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- ARMのmuslとjemallocを有効にします。 [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) - ([アモスの鳥](https://github.com/amosbird)) -- 追加 `--client-option` へのパラメータ `clickhouse-test` ための追加のパラメータです。 - [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([ニコライ - Kochetov](https://github.com/KochetovNicolai)) -- Rpmパッケージのアップグ - [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) - ([フィリモノフ](https://github.com/filimonov)) -- PVSによって検出されたエラーを修正。 [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem - Zuikov](https://github.com/4ertus2)) -- ダーウィンのためのビルドを修正. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) - ([イワン](https://github.com/abyss7)) -- glibc2.29互換性。 [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos - 鳥](https://github.com/amosbird)) -- Dh\_cleanがソースファイルに触れないようにします。 - [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos - 鳥](https://github.com/amosbird)) -- Altinity rpmから更新するときに競合を避けるようにしてください。 - clickhouse-server-commonにあります。 [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) - ([フィリモノフ](https://github.com/filimonov)) -- 最適なヘッダファイルにより再建. - [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), - [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- 日付と日時のパフォーマンステストを追加する。 [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([バシリー - Nemkov](https://github.com/Enmk)) -- 非決定性の変異を含むいくつかのテストを修正します。 - [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([Alexander - Kazakov](https://github.com/Akazz)) -- CIにMemorySanitizerでビルドを追加します。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) - ([Alexander Kuzmenkov](https://github.com/akuzm)) -- MetricsTransmitterでは、初期化されていない値の使用は避けてください。 - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat - Khuzhin](https://github.com/azat)) -- 固定のいくつかの問題分野によっmemorysanitizer. - [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), - [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([Alexander - Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) - ([アモスの鳥](https://github.com/amosbird)) -- Murmurhash32で未定義の動作を修正しました。 [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos - 鳥](https://github.com/amosbird)) -- StoragesInfoStreamの未定義の動作を修正しました。 [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) - ([tavplubix](https://github.com/tavplubix)) -- 外部データベースエンジン(mysql、odbc、jdbc)のために折り畳まれた固定定数式。 前に - バージョンな作業のための複数の定数で表現したで働くすべての日付, - DateTimeおよびUUID。 この修正 [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- No\_users\_thread変数にアクセスする際のライブビューでのThreadSanitizer data raceエラーの修正。 - [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Libcommonでmallocシンボルを取り除く - [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), - [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos - 鳥](https://github.com/amosbird)) -- 追加グローバル旗enable\_libraries無効化のためのすべての図書館です。 - [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) - ([proller](https://github.com/proller)) - -#### コードの整理 {#code-cleanup} - -- 構成リポジトリを一般化して、辞書のddlを準備します。 [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) - ([alesapin](https://github.com/alesapin)) -- 任意のセマンティックなしの辞書ddlのパーサー。 - [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) - ([alesapin](https://github.com/alesapin)) -- ParserCreateQueryをさまざまな小さなパーサーに分割します。 - [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) - ([alesapin](https://github.com/alesapin)) -- 小さなリファクタリングと外部辞書の近くに名前を変更します。 - [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) - ([alesapin](https://github.com/alesapin)) -- Refactor一部のコードの準備のための役割ベースのアクセス制御です。 [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([ヴィタリ - Baranov](https://github.com/vitlibar)) -- DatabaseOrdinaryコードのいくつかの改善点。 - [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([ニキータ - Vasilev](https://github.com/nikvas0)) -- ハッシュテーブルのfind()およびemplace()メソッドではイテレータを使用しないでください。 - [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([Alexander - Kuzmenkov](https://github.com/akuzm)) -- パラメータのルートが空でない場合にgetmultiplevaluesfromconfigを修正しました。 [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) - ([Mikhail Korotov](https://github.com/millb)) -- いくつかのコピー&ペーストを削除する(temporaryfileとtemporaryfilestream) - [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem - Zuikov](https://github.com/4ertus2)) -- コードの可読性を少し改善 (`MergeTreeData::getActiveContainingPart`). - [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- お待ちすべての予定の仕事をローカルオブジェクトの場合 `ThreadPool::schedule(...)` 投球 - 例外です。 名前変更 `ThreadPool::schedule(...)` に `ThreadPool::scheduleOrThrowOnError(...)` と - 固定のコメントを明らかな場合にスロー. - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) - ([tavplubix](https://github.com/tavplubix)) - -## ClickHouseリリース19.15 {#clickhouse-release-19-15} - -### ClickHouseリリース19.15.4.10、2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} - -#### バグ修正 {#bug-fix-3} - -- SQL\_TINYINTとSQL\_BIGINTの処理を追加し、ODBCブリッジでSQL\_FLOATデータソース型の処理を修正しました。 - [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- 移動パーティショ - [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- ODBCブリッジを介してnull可能な列のNULL値を修正しました。 - [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- マテリアライズ列を持つ分散非ローカルノードに固定挿入。 - [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- 固定機能getmultiplevaluesfromconfig。 - [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) -- 固定問題のhttp生き生きと保つタイムアウトの代わりにtcpのままにしておくタイムアウト. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) -- すべてのジョブが例外で終了するのを待ちます(まれなsegfaultsを修正します)。 - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) -- Kafkaテーブルに挿入するときにMVsにプッシュしないでください。 - [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([イワン](https://github.com/abyss7)) -- 無効メモリにトラッカーのための例外をスタックです。 - [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 外部データベ - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MetricsTransmitterでは、初期化されていない値の使用は避けてください。 - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) -- テスト用のマクロを追加しました例の設定 ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### クリックハウスリリース19.15.3.6,2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} - -#### バグ修正 {#bug-fix-4} - -- ハッシュ化された辞書のbad\_variantを修正しました。 - ([alesapin](https://github.com/alesapin)) -- 修正のバグと分割詳しくは動画内で、タグは付け部分を返します。 - ([alesapin](https://github.com/alesapin)) -- 固定時間の計算 `MergeTreeData`. - ([Vladimir Chebotarev](https://github.com/excitoon)) -- 執筆が確定した後、kafkaに明示的にコミットします。 - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([イワン](https://github.com/abyss7)) -- MergeTreeパーツの最小/最大インデックスでNULL値を正しくシリアル化します。 - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -### クリックハウスリリース19.15.2.2,2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} - -#### 新しい機能 {#new-feature-3} - -- 段階のストレージへのサポート使用数量のためのテーブルmergetreeエンジンです。 新鮮なデータをssdに保存し、古いデータを自動的にhddに移動することができます。 ([例えば](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) -- テーブル関数の追加 `input` 受信データを読むため `INSERT SELECT` クエリ。 [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([パラソリック1color](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([アントン-ポポフ](https://github.com/CurtizJ)) -- を追加 `sparse_hashed` 辞書のレイアウトは、機能的には `hashed` レイアウトが、より効率的なメモリです。 それはより遅い価値検索の費用でより少ない記憶として二度約使用する。 [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) -- 実施能力の定義の一覧をユーザーへのアクセスする事ができます。 使用する現在の接続データベースのみ。 [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 追加 `LIMIT` オプションへ `SHOW` クエリ。 [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- 追加 `bitmapSubsetLimit(bitmap, range_start, limit)` 最小のサブセットを返す関数 `limit` より小さくないセット内の値 `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) -- 追加 `bitmapMin` と `bitmapMax` 機能。 [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) -- 機能を追加 `repeat` に関連する [問題-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL)) - -#### 実験的特徴 {#experimental-feature-1} - -- 現在のパイプラインを変更しないマージ結合バリアントをメモリに実装します。 結果はマージキーで部分的にソートされます。 セット `partial_merge_join = 1` この機能を使用するには. マージ結合はまだ開発中です。 [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加 `S3` エンジンおよびテーブル機能。 まだ開発中です(まだ認証サポートはありません)。 [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) - -#### 改善 {#improvement-2} - -- 全てのメッセージから読み込むカフカを挿入し、原子. これは、カフカエンジンのほぼすべての既知の問題を解決します。 [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([イワン](https://github.com/abyss7)) -- 分散クエリのフェイルオーバーの改善。 回復時間を短くして下さい、またそれは今構成され、見ることができます `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) -- 列挙型の数値を直接サポート `IN` セクション。 \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([ディマルブ2000](https://github.com/dimarub2000)) -- サポート(オプション、障害者によるデフォルト)のリダイレクトurlに保管します。 [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) -- 追加情報をメッセージがクライアントよりも古いバージョンを接続するサーバーです。 [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- 分散テーブ [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) -- Graphiteに累積値を持つプロファイルイベント(カウンター)を送信する機能を追加。 で有効にすることができ下 `` サーバー内 `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) -- 自動キャストタイプの追加 `T` に `LowCardinality(T)` 型の列にデータを挿入している間 `LowCardinality(T)` HTTP経由でネイティブ形式で。 [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 機能を使用する機能を追加する `hex` 使用せずに `reinterpretAsString` のために `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-2} - -- デバッグ情報を含むclickhouseバイナリにgdb-indexを追加します。 それはスピードアップ起動時間の `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) -- パッチを当てたdpkg-debを使用してdebパッケージをスピードアップ `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) -- セット `enable_fuzzing = 1` すべてのプロジェクトコードのlibfuzzerの計測を有効にするには. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) -- CIに分割ビルド煙テストを追加します。 [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) -- CIにMemorySanitizerでビルドを追加します。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 置換 `libsparsehash` と `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) - -#### バグ修正 {#bug-fix-5} - -- 固定性能の劣化指標分析複雑なテンキーの大きます。 これは#6924を修正します。 [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- カフカ空のトピックから選択する際にsegfaultsを引き起こす論理的なエラーを修正。 [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([イワン](https://github.com/abyss7)) -- あまりにも早いmysql接続を閉じる `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- 非常に古いlinuxカーネルのサポートが返される(fix [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- で可能なデータ損失を修正 `insert select` 入力ストリーム内の空のブロックの場合のクエリ。 \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 関数の修正 `АrrayEnumerateUniqRanked` paramsで空の配列を使用する [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- 配列結合とグローバルサブクエリを使用した複雑なクエリの修正 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([イワン](https://github.com/abyss7)) -- 修正 `Unknown identifier` 複数のジョインを持つORDER BYおよびGROUP BYでのエラー [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定 `MSan` 関数の実行中の警告 `LowCardinality` 引数。 [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### 下位互換性のない変更 {#backward-incompatible-change-2} - -- 変更直列化形式のビットマップ\*集計機能状態の性能の向上を図ります。 以前のバージョンのbitmap\*のシリアル化状態は読み取りできません。 [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) - -## ClickHouseリリース19.14 {#clickhouse-release-19-14} - -### ClickHouseリリース19.14.7.15,2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} - -#### バグ修正 {#bug-fix-6} - -- このリリースも含む全てのバグ修正から19.11.12.69. -- 19.14以前のバージョン間の分散クエリの互換性を修正しました。 この修正 [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.14.6.12,2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} - -#### バグ修正 {#bug-fix-7} - -- 関数の修正 `АrrayEnumerateUniqRanked` paramsに空の配列があります。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- とクエリ内の固定サブクエリ名 `ARRAY JOIN` と `GLOBAL IN subquery` エイリアス付き。 外部テーブル名が指定されている場合は、サブクエリ別名を使用します。 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([イワン](https://github.com/abyss7)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-3} - -- 修正 [フラッピング](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) テスト `00715_fetch_merged_or_mutated_part_zookeeper` それは突然変異が適用されるのを待つ必要があるためです。 [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) -- 機能の固定ubsanおよびmemsanの失敗 `groupUniqArray` emtpy配列の引数を持つ。 それは空の配置によって引き起こされた `PaddedPODArray` へのハッシュテーブルのゼロの細胞でのコンストラクターゼの細胞値ませんでした。 [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([アモスの鳥](https://github.com/amosbird)) - -### ClickHouseリリース19.14.3.3,2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} - -#### 新しい機能 {#new-feature-4} - -- `WITH FILL` の修飾子 `ORDER BY`. (の継続 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([アントン-ポポフ](https://github.com/CurtizJ)) -- `WITH TIES` の修飾子 `LIMIT`. (の継続 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([アントン-ポポフ](https://github.com/CurtizJ)) -- パースクォートなし `NULL` リテラルとしてNULL(設定の場合 `format_csv_unquoted_null_literal_as_null=1`). このフィールドのデー `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) -- テーブル関数のパスのワイルドカードのサポート `file` と `hdfs`. 場合に経路を含むワイルドカード、テーブルが読み取り専用になります。 使用例: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` と `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) -- 新しい `system.metric_log` の値を格納するテーブル `system.events` と `system.metrics` 指定時間間隔を使って。 [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouseテキストログを書き込むことを許可する `system.text_log` テーブル。 [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ショー民間のシンボルスタックトレース(ターを通じて構文解析シンボルテーブルのelfファイル). 追加情報ファイルと行番号をスタックトレースの場合のデバッグ情報があります。 高速シンボル名のルックアップインデックスの記号が存在します。 イントロスペクション用の新しいsql関数を追加: `demangle` と `addressToLine`. 関数の名前を変更 `symbolizeAddress` に `addressToSymbol` 一貫性のために。 機能 `addressToSymbol` パフォーマンス上の理由から、マングルされた名前を返します。 `demangle`. 追加された設定 `allow_introspection_functions` デフォルトではオフになっています。 [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- テーブル機能 `values` (名前は大文字と小文字を区別しません)。 それは読むことを可能にする `VALUES` で提案されたリスト [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). 例えば: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([ディマルブ2000](https://github.com/dimarub2000)) -- ストレージの設定を変更する機能を追加しました。 構文: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) -- 取り外した部品の取り外しをサポート。 構文: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) -- テーブルの制約。 挿入時にチェックされるテーブル定義に制約を追加することができます。 [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 支援のためのカスケード型を実現します。 [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([アモスの鳥](https://github.com/amosbird)) -- On queryプロファイラのデフォルトでサンプル毎にクエリの実行スレッドだ。 [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 入力形式 `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) -- 二つの新機能を追加しました: `sigmoid` と `tanh` (これは機械学習アプリケーションに便利です)。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 機能 `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` 指定されたトークンがhaystackにあるかどうかを確認する。 トークンは、二つの非英数字ASCII文字(またはhaystackの境界)の間の最大長の部分文字列です。 トークンを入力する必要がある定数文字列になります。 支tokenbf\_v1指数の専門性を高めます。 [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) -- 新しい機能 `neighbor(value, offset[, default_value])`. データブロック内の列内の前/次の値に到達することができます。 [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) -- 関数の作成 `currentUser()`、承認されたユーザのログインを返す。 エイリアスを追加 `user()` MySQLとの互換性のために。 [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) -- 新しい集計関数 `quantilesExactInclusive` と `quantilesExactExclusive` これはで提案されました [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([ディマルブ2000](https://github.com/dimarub2000)) -- 機能 `bitmapRange(bitmap, range_begin, range_end)` これは、指定された範囲の新しいセットを返します( `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) -- 機能 `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` 提供された区域をカバーするgeohash箱の精密長い一連の配列を作成するかどれが。 [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) -- INSERTクエリのサポートを実装する `Kafka` テーブル。 [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([イワン](https://github.com/abyss7)) -- のサポートを追加 `_partition` と `_timestamp` カフカエンジンへの仮想列。 [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([イワン](https://github.com/abyss7)) -- から機密データを削除する可能性 `query_log`、サーバーログ、regexpベースのルールを持つプロセスリスト。 [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([フィリモノフ](https://github.com/filimonov)) - -#### 実験的特徴 {#experimental-feature-2} - -- 入力および出力データ形式 `Template`. これは、入力と出力のカスタム書式文字列を指定することができます。 [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) -- の実装 `LIVE VIEW` 最初に提案されたテーブル [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898)、準備される [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925)、その後で更新 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). 見る [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) 詳細な説明のため。 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov))ことに注意 `LIVE VIEW` 特集は削除される可能性があり、来できます。 - -#### バグ修正 {#bug-fix-8} - -- このリリースも含む全てのバグ修正から19.13と19.11. -- 固定の区分断層のテーブルはスキップ指標および垂直統合などが挙げられる。 [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) -- 非自明な列のデフォルトで列ごとのttlを修正しました。 以前は、force ttl mergeの場合は次のようになりました `OPTIMIZE ... FINAL` クエリー、終了しました値に置き換えられたタイプのデフォルトの代わりにユーザが指定した列のデフォルトする [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 通常のサーバーの再起動時にkafkaメッセージの重複の問題を修正。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([イワン](https://github.com/abyss7)) -- カフカメッセージを読むときに固定無限ループ。 それ以外の場合は、いくつかのシナリオで無期限に一時停止することがあります。 [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([イワン](https://github.com/abyss7)) -- 修正 `Key expression contains comparison between inconvertible types` での例外 `bitmapContains` 機能。 [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([ディマルブ2000](https://github.com/dimarub2000)) -- 有効にしてsegfaultを修正 `optimize_skip_unused_shards` シャーディングキーがない [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([アントン-ポポフ](https://github.com/CurtizJ)) -- メモリの破損につながる可能性があり、突然変異で間違ったコードを修正. アドレスの読み取りによる固定segfault `0x14c0` それは同時に起こったかもしれない `DROP TABLE` と `SELECT` から `system.parts` または `system.parts_columns`. 突然変異クエリの準備の競合状態を修正しました。 によるデッドロックを修正 `OPTIMIZE` レプリケートされたテーブルと同時変更操作のような変更。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MySQLインターフェイスで削除された余分な冗長ログ [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- からブール値の設定を解析する機能を返します ‘true’ と ‘false’ 設定ファイルで。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- でクラッシュを修正 `quantile` と `median` 関数オーバー `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) -- によって返された可能な不完全な結果を修正 `SELECT` クエリと `WHERE` 主キーの条件には、Float型への変換が含まれていました。 それは単調性の誤ったチェックによって引き起こされた `toFloat` 機能。 [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([ディマルブ2000](https://github.com/dimarub2000)) -- チェック `max_expanded_ast_elements` 突然変異のための設定。 後の明確な突然変異 `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([冬張](https://github.com/zhang2014)) -- と共に使用するときにキー列の結合結果を修正 `join_use_nulls`. 列の既定値の代わりにNullをアタッチします。 [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) -- 垂直マージと変更とスキップインデックスの修正。 修正のための `Bad size of marks file` 例外だ [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) -- でレアクラッシュを修正 `ALTER MODIFY COLUMN` マージ/変更された部分のいずれかが空(0行)のときに垂直マージ) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- の変換のバグを修正しました `LowCardinality` タイプ `AggregateFunctionFactory`. この修正 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 間違った動作と可能なsegfaultsを修正 `topK` と `topKWeighted` 集計関数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 周りの固定安全でないコード `getIdentifier` 機能。 [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 問題を修正しましたmysqlのワイヤーロを使用すると接続するclickhouse形mysqlクライアント). によって引き起こされる `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([ユーリーバラノフ](https://github.com/yurriy)) -- 固定メモリリーク `bitmapSubsetInRange` 機能。 [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) -- 粒度の変更後に突然変異が実行されたときに稀なバグを修正しました。 [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) -- きprotobufメッセージの全ての分野でのデフォルトです。 [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) -- バグを解決するには `nullIf` 私達がaを送る場合の機能 `NULL` 第二引数の引数。 [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 文字列フィールドを持つ複雑なキーキャッシュ辞書で間違ったメモリ割り当て/割り当て解除を使用して、まれなバグを修正しました(メモリリークのよ バグは、文字列サイズが八(8、16、32、等)から始まる二つの累乗だったときに再現します。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- 例外を引き起こした小さな配列に固定ゴリラエンコード `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) -- Nullableではない型をJOINsで使用できるようにする `join_use_nulls` 有効。 [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) -- 無効にする `Poco::AbstractConfiguration` クエリ内での置換 `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- デッドロックを回避 `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- を使用して `arrayReduce` 定数引数の場合、segfaultにつながる可能性があります。 [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- レプリカが後に復元された場合に表示される不整合な部分を修正 `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- 固定こつ `JSONExtractRaw` 機能。 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正のバグと誤ったスキップ指数の直列化を行い、その凝集と適応粒度. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) -- 修正 `WITH ROLLUP` と `WITH CUBE` の修飾子 `GROUP BY` 二レベルの集計。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([アントン-ポポフ](https://github.com/CurtizJ)) -- のを修正した。筆二次指標マーク適応型粒度. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- サーバーの起動中に初期化の順序を修正します。 それ以来 `StorageMergeTree::background_task_handle` で初期化される。 `startup()` その `MergeTreeBlockOutputStream::write()` 初期化の前に使用しようとするかもしれません。 すぐチェックインの場合は初期化されます。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([イワン](https://github.com/abyss7)) -- エラーで完了した前の読み取り操作からデータバッファーをクリアします。 [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([ニコライ](https://github.com/bopohaa)) -- 固定バを適応的粒度を新規作成時のレプリカのための複製\*mergetreeます。 [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- 例外が発生した場合のサーバーの起動時に可能なクラッシュを修正しました `libunwind` 初期化されていないアクセス時の例外時 `ThreadStatus` 構造。 [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- でクラッシュを修正 `yandexConsistentHash` 機能。 ファズテストによって発見。 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定の可能性を掛けのクエリがサーバが過負荷状態で運転され、グローバルスレッドプールが近い。 これは、分散クエリが各シャードに接続ごとにスレッドを割り当てるため、多数のシャード(数百)を持つクラスターで発生する可能性が高くなります。 たとえば、330個のシャードのクラスターが30個の同時分散クエリを処理している場合、この問題は再現されます。 この問題に影響するすべてのバージョンから19.2. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定ロジックの `arrayEnumerateUniqRanked` 機能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- シンボルテーブルのデコード時にsegfaultを修正。 [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([アモスの鳥](https://github.com/amosbird)) -- のキャストで修正された無関係な例外 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- で説明の余分な引用を削除しました `system.settings` テーブル。 [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- デッドロックの回避 `TRUNCATE` 複製されたテーブルの。 [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ソートキーの順に読み取りを修正しました。 [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 修正 `ALTER TABLE ... UPDATE` とテーブルのクエリ `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- によって開かバグを修正 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (19.4.0以来)。 列をクエリしない場合は、MergeTreeテーブルを使用して分散テーブルへのクエリを再現します (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- 固定オーバーフローの整数部署名-タイプを符号なしタイプです。 この動作は、cまたはc++言語(整数昇格ルール)とまったく同じで、驚くかもしれません。 大きな符号付き数を大きな符号なし数に分割する場合、またはその逆の場合にはオーバーフローが可能であることに注意してください(ただし、その場合 の問題が全てのサーバーのバージョン [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- スロットリング時の最大スリープ時間を制限する `max_execution_speed` または `max_execution_speed_bytes` 設定されています。 固定偽のようなエラー `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 使用に関する問題を修正 `MATERIALIZED` の列とエイリアス `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([アモスの鳥](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正 `FormatFactory` プロセッサとして実装されていない入力ストリームの動作。 [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 修正されたタイプミス。 [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) -- エラーメッセージのタイプミス(is-\>are)。 [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) -- 固定誤差を解析カラムのリストから文字列の場合タイプが含まれるコンマ(この問題に関連する `File`, `URL`, `HDFS` ストレージ) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([ディマルブ2000](https://github.com/dimarub2000)) - -#### セキュリティ修正 {#security-fix} - -- このリリースも含む全てのバグのセキュリティ修正をか19.13と19.11. -- SQLパーサーのスタックオーバーフローによりサーバーがクラッシュする可能性がある問題を修正 固定の可能性スタックオーバーフローに統合、配布し、テーブルが現実の景色の件本件は、行レベルのセキュリティなサブクエリ. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 改善 {#improvement-3} - -- のための三元論理の正しい実装 `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) -- これで、ttlの有効期限が切れた値と行が削除されます。 `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` クエリ。 追加されたクエリ `SYSTEM STOP/START TTL MERGES` 可に/を割り当てを合併TTLおよびフィルター終了しました値をすべてが合併。 [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([アントン-ポポフ](https://github.com/CurtizJ)) -- クライアントのclickhouse履歴ファイルの場所を変更する可能性 `CLICKHOUSE_HISTORY_FILE` env [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([フィリモノフ](https://github.com/filimonov)) -- 削除 `dry_run` フラグから `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- サポート `ASOF JOIN` と `ON` セクション。 [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) -- 突然変異および複製のためのskip索引のよりよいサポート。 のサポート `MATERIALIZE/CLEAR INDEX ... IN PARTITION` クエリ。 `UPDATE x = x` 列を使用するすべてのインデックスの再計算 `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) -- 許可する `ATTACH` ライブビュー(たとえば、サーバーの起動時など) `allow_experimental_live_view` 設定。 [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- のためのスタックトレースに集まるエリプロファイラに含まれているものも含むスタックフレームが発生するqueryプロファイラです。 [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Nowテーブル関数 `values`, `file`, `url`, `hdfs` ALIAS列をサポートしている。 [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 次の場合に例外をスローする `config.d` ファイルには、対応するルート要素が設定ファイルとして存在しません。 [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([ディマルブ2000](https://github.com/dimarub2000)) -- 例外メッセージの余分な情報を印刷する `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) -- Aの破片を決定するとき `Distributed` 読み取りクエリによってカバーされるテーブル(for `optimize_skip_unused_shards` =1)ClickHouseは両方から条件をチェックします `prewhere` と `where` select文の句。 [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) -- 有効 `SIMDJSON` AVX2のないしかしSSE4.2およびPCLMULの命令セットの機械のため。 [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouseでファイルシステムな `O_DIRECT` 追加のチューニングなしでサポート(ZFSとBtrFSなど)。 [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 支援を押しであったが,最終的にサブクエリです。 [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([Tcheason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より良い `JOIN ON` キーの抽出 [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) -- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 最小の列の選択を最適化する `SELECT count()` クエリ。 [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([アモスの鳥](https://github.com/amosbird)) -- 追加 `strict` パラメータin `windowFunnel()`. とき `strict` は、 `windowFunnel()` 一意の値にのみ条件を適用します。 [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbabcomment](https://github.com/achimbab)) -- より安全なインタフェース `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) -- オプション行サイズ `--help` オプションに対応した端末のサイズです。 [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([ディマルブ2000](https://github.com/dimarub2000)) -- 無効にする “read in order” キーなしの集約の最適化。 [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([アントン-ポポフ](https://github.com/CurtizJ)) -- のhttpステータスコード `INCORRECT_DATA` と `TYPE_MISMATCH` エラーコードをデフォルトから変更 `500 Internal Server Error` に `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) -- 結合オブジェクトの移動元 `ExpressionAction` に `AnalyzedJoin`. `ExpressionAnalyzer` と `ExpressionAction` 知らない `Join` もはやクラス。 その論理は `AnalyzedJoin` フェイス [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定可能な行き詰まりの分散クエリーの資料はlocalhostでのクエリを送ネットワーク経由で接続します。 [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 複数のテーブルの意味を変更 `RENAME` 可能なデッドロックを避けるため。 [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 書き換えmysqlサーバーの互換性防止への負荷フルパケットペイロードに。 各接続のメモリ消費量の減少 `2 * DBMS_DEFAULT_BUFFER_SIZE` (読み取り/書き込みバッファ)。 [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([ユーリーバラノフ](https://github.com/yurriy)) -- クエリのセマンティクスについて何も知る必要のないast alias interpreting logicをパーサーから外します。 [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) -- もう少し安全な構文解析 `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-copier`:使用を許可する `where_condition` 設定から `partition_key` エイリアスクエリのためのチェック分配の存在についても同様とすでに使用されただけでデータを読み込むクエリ). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) -- 追加オプションのメッセージ引数 `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) -- クライアントでも挿入データの送信中にサーバー例外が発生しました。 [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([ディマルブ2000](https://github.com/dimarub2000)) -- メトリックを追加 `DistributedFilesToInsert` その総数のファイルをファイルシステムを送信リモートサーバーに配布します。 数はすべての破片を合計します。 [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ほとんどの結合を準備ロジックから移動する `ExpressionAction/ExpressionAnalyzer` に `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) -- TSanを修正 [警告](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) -- Linuxの機能の欠如に関するより良い情報メッセージ。 致命的なエラーのログ記録 “fatal” レベル、それはそれが簡単で見つけることになります `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ディスクへの一時データのダンプを有効にして、使用中のメモリ使用量を制限する場合 `GROUP BY`, `ORDER BY` でかチェックのディスクスペース。 修正は、新しい設定を追加します `min_free_disk_space`、ときに空きディスク領域それ小さいし、しきい値は、クエリが停止し、スローされます `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- スレッドによる再帰的なrwlockの削除。 スレッドはクエリ間で再利用されるため、意味がありません。 `SELECT` クエリがロックを取得するスレッド、ロックから別のスレッドの出口から。 同時に、最初のスレッドは次の方法で再利用できます `DROP` クエリ。 これはfalseにつながります “Attempt to acquire exclusive lock recursively” メッセージ [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 分割 `ExpressionAnalyzer.appendJoin()`. 場所を準備する `ExpressionAnalyzer` のために `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加 `mysql_native_password` MySQLの互換性サーバーへの認証プラグイン。 [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([ユーリーバラノフ](https://github.com/yurriy)) -- より少ない数の `clock_gettime` のデバッグ/リリース間のABIの互換性を修正しました `Allocator` (取るに足りない問題)。 [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 移動 `collectUsedColumns` から `ExpressionAnalyzer` に `SyntaxAnalyzer`. `SyntaxAnalyzer` 作る `required_source_columns` 今自体。 [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) -- 設定を追加 `joined_subquery_requires_alias` サブセレクトおよびテーブル関数のエイリアスを要求するには `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) -- 抽出 `GetAggregatesVisitor` クラスから `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) -- `system.query_log`:データタイプの変更 `type` コラムへの `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- 静的リンクの `sha256_password` 認証プラグイン。 [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([ユーリーバラノフ](https://github.com/yurriy)) -- 設定の余分な依存関係を避ける `compile` 働くため。 以前のバージョンでは `cannot open crti.o`, `unable to find library -lc` など。 [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 悪意のあるレプリカから来る可能性のある入力のより多くの検証。 [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- さて `clickhouse-obfuscator` ファイルは `clickhouse-client` パッケージ。 以前のバージョンでは、 `clickhouse obfuscator` (空白を含む)。 [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([ディマルブ2000](https://github.com/dimarub2000)) -- 固定行き詰まりが少なくとも二つのクエリの読み取り少なくとも二つのテーブルに異なる秩序や他のクエリを実行するddl操作の一つです。 固定も非常に珍しいデッドロックします。 [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `os_thread_ids` コラムへの `system.processes` と `system.query_log` のためのデバッグ可能です。 [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 次の場合に発生するphp mysqlnd拡張バグの回避策 `sha256_password` デフォルトの認証プラグインとして使用されます。 [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([ユーリーバラノフ](https://github.com/yurriy)) -- Nullability列が変更された不要な場所を削除します。 [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) -- 設定のデフォルト値 `queue_max_wait_ms` 現在の値(五秒)は意味をなさないので、ゼロに。 この設定を使用している場合は、まれな状況があります。 追加された設定 `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` と `connection_pool_max_wait_ms` 曖昧さ回避のために。 [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 抽出 `SelectQueryExpressionAnalyzer` から `ExpressionAnalyzer`. 選択されていないクエリの最後のクエリを保持します。 [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) -- 重複する入力および出力形式を削除しました。 [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- ユーザーの上書きを許可する `poll_interval` と `idle_connection_timeout` 接続時の設定。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `MergeTree` 現在、追加オプション `ttl_only_drop_parts` (デフォルトでは無効)パーツの部分的な枝刈りを避けるため、パーツ内のすべての行が期限切れになったときに完全に削除されます。 [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Catalonia\_comarques.Kgm](https://github.com/svladykin)) -- セットインデックス関数の型チェック。 関数が間違った型を持つ場合は例外をスローします。 これはubsanでファズテストを修正します。 [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### 性能向上 {#performance-improvement-2} - -- クエリを最適化する `ORDER BY expressions` 句、どこ `expressions` プレフィックスとソートキーが一致している `MergeTree` テーブル。 この最適化は `optimize_read_in_order` 設定。 [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 使用に応じることは、複数のスレッドの中で部品の搭載となります。 [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 集計関数の状態を更新するバッチバリアントを実装。 で与えられる実装になっていると性能です。 [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- を使用して `FastOps` 関数のライブラリ `exp`, `log`, `sigmoid`, `tanh`. FastOpsはマイケルParakhin(YandexのCTO)からの高速ベクトル数学ライブラリです。 改善された性能の `exp` と `log` 機能6回以上。 を機能 `exp` と `log` から `Float32` 引数戻ります `Float32` (以前のバージョンでは、常に戻ります `Float64`). さて `exp(nan)` 戻る可能性がある `inf`. 結果の `exp` と `log` 関数は、真の答えに最も近いマシン表現可能な番号ではないかもしれません。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov))働くfastopsを作るダニラKuteninの変形を使用して [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- の連続したキーの最適化を無効にする `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([azerbaijan.kgm](https://github.com/akuzm)) -- 改善された性能の `simdjson` の動的割り当てを取り除くことによって `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) -- メモリを割り当てるときの事前フォールトページ `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([azerbaijan.kgm](https://github.com/akuzm)) -- 固定性能のバグを修正 `Decimal` 比較。 [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-4} - -- コンパイラ(ランタイムテンプレートのインスタンス化)を削除します。 [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加の性能試験への性能の低下gcc-9により孤立した。 [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- テーブル機能を追加 `numbers_mt` のマルチスレッドバージョンです。 `numbers`. 更新性能試験のハッシュ機能 [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 比較モード `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([ディマルブ2000](https://github.com/dimarub2000)) -- スタックトレース印刷のための最善の努力。 また、追加 `SIGPROF` 実行中のスレッドのスタックトレースを出力するデバッグ信号として。 [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 独自のファイル、パート10のすべての機能。 [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 倍精度の定数を削除 `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([フィリモノフ](https://github.com/filimonov)) -- のための書式設定の変更 `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([azerbaijan.kgm](https://github.com/akuzm)) -- Join作成のためのより良いサブクエリ `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) -- 冗長な条件(pvs studioによって検出された)を削除します。 [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([azerbaijan.kgm](https://github.com/akuzm)) -- 別々のハッシュテーブルインタフェース `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([azerbaijan.kgm](https://github.com/akuzm)) -- 設定のリファクタリング。 [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) -- コメントの追加 `set` インデックス関数。 [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) -- 増oomスコアデバッグ版プログラムを利用しています。. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([azerbaijan.kgm](https://github.com/akuzm)) -- HDFS HAはデバッグビルドで動作します。 [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) -- にテストを追加しました `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kafkaテーブルのマテリアライズドビューのテストを追加します。 [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([イワン](https://github.com/abyss7)) -- よりよい造りの機構を作りなさい。 [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([イワン](https://github.com/abyss7)) -- 固定 `test_external_dictionaries` 非rootユーザーの下で実行された場合の統合。 [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 書き込まれたパケットの合計サイズが `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([ユーリーバラノフ](https://github.com/yurriy)) -- のテストを追加しました `RENAME` テーブルの競合状態 [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 設定のデータ競争をの避けて下さい `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- キャッ [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) -- Mac OSでELFオブジェクトファイルの解析を無効にする。 [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 変更ログジェネレータを改善しようとします。 [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `-Wshadow` GCCに切り替えます。 [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- の廃止されたコードを削除 `mimalloc` ます。 [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `zlib-ng` x86機能を決定し、この情報をグローバル変数に保存します。 これは、異なるスレッドによって同時に行うことができるdefalteInit呼び出しで行われます。 を避けるマルチスレッドに書き込み、図書館で起動します。 [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([azerbaijan.kgm](https://github.com/akuzm)) -- In結合で修正されたバグの回帰テスト [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) -- 固定msanレポート。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正フラッピングttlテスト。 [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 固定偽データレースで `MergeTreeDataPart::is_frozen` フィールド。 [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ファズテストでタイムアウトを修正しました。 以前のバージョ `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- デバッグチェックを追加 `static_cast` 列の。 [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 公式のrpmパッケージでのoracle linuxのサポート。 [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- からの変更json perftests `once` に `loop` タイプ。 [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `odbc-bridge.cpp` 定義 `main()` したがって、それは `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) -- クラッシュのテスト `FULL|RIGHT JOIN` 右側のテーブルのキーにヌルがあります。 [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) -- 念のためにエイリアスの拡張の制限のためのテストを追加しました。 [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- から切り替え `boost::filesystem` に `std::filesystem` 適切な場合。 [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加rpmパッケージです。 [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定のテストを追加する `Unknown identifier` での例外 `IN` セクション。 [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) -- 簡略化 `shared_ptr_helper` 人々はそれを理解困難に直面しているので。 [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定gorillaとdoubledeltaコーデックのパフォーマンステストを追加しました。 [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) -- 統合テストの分割 `test_dictionaries` 4つの別々のテストに。 [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) -- PVS-Studioの警告を修正する `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 使用を許可する `library` ASanの辞書ソース。 [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Prのリストからchangelogを生成するオプションを追加しました。 [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- をロック `TinyLog` 読む場合の貯蔵。 [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([azerbaijan.kgm](https://github.com/akuzm)) -- チェックを破symlinks ci. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- の増加のタイムアウト “stack overflow” デバッグビルドでは長い時間がかかるため、テストします。 [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 二重の空白のチェックを追加しました。 [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正 `new/delete` メモリ追跡ときビルドで消毒。 追跡は明確ではありません。 テストでのメモリ制限の例外を防止するだけです。 [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) -- リンク中に未定義のシンボルのチェックを有効にします。 [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([イワン](https://github.com/abyss7)) -- 再構築を避ける `hyperscan` 毎日です。 [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定ubsanレポートで `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 互換性がないため、クエリプロファイラーをサニタイザーで使用することはできません。 [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加試験のためのリロード辞書の後に失敗するタイマー. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) -- 矛盾を修正する `PipelineExecutor::prepareProcessor` 引数の型。 [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 追加の試験のための悪いuriです。 [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より多くのチェックを追加 `CAST` 機能。 こいつの間にか.ファジィテストです。 [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 追加 `gcc-9` サポートへの `docker/builder` ローカルで画像を構築するコンテナ。 [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) -- 主キーのテスト `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([ディマルブ2000](https://github.com/dimarub2000)) -- 固定試験の影響を受けゆっくりとしたスタックトレースの印刷もできます。 [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- クラッシュのテストケースを追加する `groupUniqArray` 固定で [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([azerbaijan.kgm](https://github.com/akuzm)) -- 固定インデックス突然変異テスト。 [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) -- パフォーマンステス [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([azerbaijan.kgm](https://github.com/akuzm)) -- マテリアライズドビューは、疑わしい低基数タイプに関する設定に関係なく、低基数タイプで作成できるようになりました。 [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) -- 更新されたテスト `send_logs_level` 設定。 [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Gcc-8.2でビルドを修正しました。 [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) -- 内部libc++でビルドを修正しました。 [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([イワン](https://github.com/abyss7)) -- 共有ビルドを修正する `rdkafka` ライブラリ [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([イワン](https://github.com/abyss7)) -- Mac OSビルドの修正(不完全)。 [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) -- 修正 “splitted” ビルド。 [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- その他のビルドの修正: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([アモスの鳥](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([イワン](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) - -#### 下位互換性のない変更 {#backward-incompatible-change-3} - -- 削除が使用されることが少なテーブル機能 `catBoostPool` および貯蔵 `CatBoostPool`. このテーブル機能を使用したら、電子メールをに書いて下さい `clickhouse-feedback@yandex-team.com`. CatBoost統合は引き続きサポートされることに注意してください。 [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 無効にする `ANY RIGHT JOIN` と `ANY FULL JOIN` デフォルトでは。 セット `any_join_distinct_right_table_keys` それらを有効にする設定。 [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) - -## クリックハウスリリース19.13 {#clickhouse-release-19-13} - -### クリックハウスリリース19.13.6.51,2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} - -#### バグ修正 {#bug-fix-9} - -- このリリースも含む全てのバグ修正から19.11.12.69. - -### ClickHouseリリース19.13.5.44、2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} - -#### バグ修正 {#bug-fix-10} - -- このリリースには、19.14.6.12のすべてのバグ修正も含まれています。 -- 実行中のテーブルの一貫性のない状態を修正 `DROP` クエリーのための複製テーブルが飼育係アクセスすることはできません。 [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- StorageMergeでのデータレースの修正 [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ソケットから無限のrecvにつながるクエリプロファイラで導入されたバグを修正。 [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) -- 実行中の過度のcpu使用率を修正 `JSONExtractRaw` ブール値に対する関数です。 [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) -- マテリアライズドビュ [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([イワン](https://github.com/abyss7)) -- テーブル機能 `url` この脆弱性により、攻撃者が要求に任意のHTTPヘッダーを挿入することができました。 この問題は、 [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 役に立たない修正 `AST` セットの索引のチェックイン。 [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) -- の固定解析 `AggregateFunction` クエリに埋め込まれた値。 [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) -- 固定間違った動作の `trim` 機能ファミリ。 [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.13.4.32、2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} - -#### バグ修正 {#bug-fix-11} - -- このリリースには、19.11.9.52と19.11.10.54のすべてのバグセキュリティ修正も含まれています。 -- 固定データレースで `system.parts` テーブルと `ALTER` クエリ。 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ストリームのヘッダーの不一致を修正したのは、sampleとprewhereで空の分散テーブルからの読み取りの場合でした。 [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 使用して固定クラッシュ `IN` タプルを含むサブクエリを含む句。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- 同じ列名のケースを修正 `GLOBAL JOIN ON` セクション。 [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定したときにクラッシュする場合が鋳造型 `Decimal` それをサポートしていません。 代わりに例外をスロー。 [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) -- で固定クラッシュ `extractAll()` 機能。 [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) -- 以下のためのクエリ変換 `MySQL`, `ODBC`, `JDBC` テーブル関数は現在、 `SELECT WHERE` 複数のクエリ `AND` 式。 [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([ディマルブ2000](https://github.com/dimarub2000)) -- MySQL8の統合のための追加された以前の宣言チェック。 [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([ラファエルdavid tinoco](https://github.com/rafaeldtinoco)) - -#### セキュリティ修正 {#security-fix-1} - -- 修二の脆弱性がコーデックに減圧相(悪意のあるユーザーが可能で圧縮データにつながるバッファオーバーフローの減圧). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouseリリース19.13.3.26、2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} - -#### バグ修正 {#bug-fix-12} - -- 修正 `ALTER TABLE ... UPDATE` とテーブルのクエリ `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- タプルを持つサブクエリでin句を使用するときにnpeを修正しました。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- 固定問題の場合はュレプリカになり、生存していてデータ部分が撤去されることによります。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- CSVを解析する問題を修正しました [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- システム内の固定データレース.パーツテーブルと変更クエリ。 この修正 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- メモリの破損につながる可能性があり、突然変異で間違ったコードを修正. アドレスの読み取りによる固定segfault `0x14c0` それは同時に起こったかもしれない `DROP TABLE` と `SELECT` から `system.parts` または `system.parts_columns`. 突然変異クエリの準備の競合状態を修正しました。 によるデッドロックを修正 `OPTIMIZE` レプリケートされたテーブルと同時変更操作のような変更。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 後に固定可能なデータ損失 `ALTER DELETE` 索引をスキップしてテーブルを照会します。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### セキュリティ修正 {#security-fix-2} - -- 攻撃者は、zookeeperへの書き込みアクセス権を持っており、clickhouseの実行ネットワークから利用できるカスタムサーバーを実行することができる場合,それはclickhouseのレ きものレプリカまでデータを取得すから悪意のあるレプリカで力clickhouse-サーバへの書き込みを任意のパスにファイルシステム. eldar zaitov、yandexの情報セキュリティチームによって発見された。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.13.2.19、2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} - -#### 新しい機能 {#new-feature-5} - -- サンプリングプロファイラーに照会です。 [例えば](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) -- 列のリストを指定できるようにする `COLUMNS('regexp')` より洗練された変種のように動作する表現 `*` アスタリスク [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CREATE TABLE AS table_function()` 可能になりました [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([ディマルブ2000](https://github.com/dimarub2000)) -- デフォルトでは、確率的勾配降下のためのadamオプティマイザが `stochasticLinearRegression()` と `stochasticLogisticRegression()` 集計機能を示すためのもので、良質なほとんど調整することがあります。 [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) -- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([アンディヤング](https://github.com/andyyzh)) -- `RENAME` 問合せで出てきますが、すべての倉庫. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([イワン](https://github.com/abyss7)) -- 現在お客様の受信ログからサーバに要求レベルに設定 `send_logs_level` サーバー設定で指定されたログレベルにかかわらず。 [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) - -#### 下位互換性のない変更 {#backward-incompatible-change-4} - -- を設定 `input_format_defaults_for_omitted_fields` デフォルトでは有効です。 分散テーブルの挿入では、この設定をクラスタで同じにする必要があります(更新をロールする前に設定する必要があります)。 省略されたフィールドの複雑な既定の式の計算を有効にします `JSONEachRow` と `CSV*` フォーマット。 この挙動があるが無視できる性能の差です。 [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([azerbaijan.kgm](https://github.com/akuzm)) - -#### 実験の特徴 {#experimental-features} - -- 新規クエリ処理パイプライン。 使用 `experimental_use_processors=1` それを有効にするオプション。 あなた自身の悩みのための使用。 [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### バグ修正 {#bug-fix-13} - -- Kafkaの統合は、このバージョンで修正されました。 -- 固定 `DoubleDelta` の符号化 `Int64` 大きいのため `DoubleDelta` 値、改善 `DoubleDelta` ランダムデータのエンコード `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) -- の固定過大評価 `max_rows_to_read` 設定の場合 `merge_tree_uniform_read_distribution` は0に設定されます。 [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 改善 {#improvement-4} - -- 次の場合に例外をスローする `config.d` ファイルを持っていないので対応するルート要素としての設定ファイル [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([ディマルブ2000](https://github.com/dimarub2000)) - -#### 性能向上 {#performance-improvement-3} - -- 最適化 `count()`. 今では(可能な場合)最小の列を使用しています。 [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([アモスの鳥](https://github.com/amosbird)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-5} - -- パフォーマンステス [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([azerbaijan.kgm](https://github.com/akuzm)) -- 外部でビルドを修正する `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([イワン](https://github.com/abyss7)) -- 共有ビルドを修正する `rdkafka` ライブラリ [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([イワン](https://github.com/abyss7)) - -## ClickHouseリリース19.11 {#clickhouse-release-19-11} - -### ClickHouseリリース19.11.13.74,2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} - -#### バグ修正 {#bug-fix-14} - -- 固定珍しいクラッシュ `ALTER MODIFY COLUMN` そして、マージ/変更された部分のいずれかが空(0行)のときに垂直マージ。 [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- の手動update `SIMDJSON`. これにより、偽のjson診断メッセージでstderrファイルが氾濫する可能性が修正されます。 [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) -- とのバグを修正 `mrk` 突然変異のファイル拡張子 ([alesapin](https://github.com/alesapin)) - -### ClickHouseリリース19.11.12.69、2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} - -#### バグ修正 {#bug-fix-15} - -- 固定性能の劣化指標分析複雑なテンキーの大きます。 この修正 [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- を避ける希少sigsegvを送信するデータテーブル分散型エンジン (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) -- 修正 `Unknown identifier` 複数の結合を持つ。 この修正 [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouseリリース19.11.11.57,2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} - -- カフカ空のトピックから選択する際にsegfaultsを引き起こす論理的なエラーを修正。 [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([イワン](https://github.com/abyss7)) -- 関数の修正 `АrrayEnumerateUniqRanked` paramsに空の配列があります。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) - -### ClickHouseリリース19.11.10.54,2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} - -#### バグ修正 {#bug-fix-16} - -- Kafkaメッセージのオフセットを手動で保存すると、すべてのパーティションに対して一度にコミットできます。 潜在的な重複を修正 “one consumer - many partitions” シナリオだ [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([イワン](https://github.com/abyss7)) - -### ClickHouseリリース19.11.9.52,2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} - -- キャッ [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) -- 機能のバグを修正 `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) -- 修正 `JSONExtract` 関数を抽出しながら `Tuple` JSONから。 [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) -- 後に固定可能なデータ損失 `ALTER DELETE` 索引をスキップしてテーブルを照会します。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) -- 固定性能テスト。 [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 寄木細工:ブール値列の読み取りを修正。 [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定間違った動作の `nullIf` 定数引数の関数。 [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([ギヨームタッセリー](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 通常のサーバーの再起動時にkafkaメッセージの重複の問題を修正。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([イワン](https://github.com/abyss7)) -- ときに長い問題を修正しました `ALTER UPDATE` または `ALTER DELETE` 通常のマージが実行されない場合があります。 利用可能な十分な空きスレッドがない場合、突然変異の実行を防ぎます。 [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) -- 処理によるエラーの修正 “timezone” サーバー構成ファイルで。 [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- カフカのテストを修正。 [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([イワン](https://github.com/abyss7)) - -#### セキュリティ修正 {#security-fix-3} - -- 攻撃者がzookeeperへの書き込みアクセス権を持ち、clickhouseが実行されるネットワークから利用可能なカスタムサーバーを実行できる場合、それはclickhouseレプリカとして きものレプリカまでデータを取得すから悪意のあるレプリカで力clickhouse-サーバへの書き込みを任意のパスにファイルシステム. eldar zaitov、yandexの情報セキュリティチームによって発見された。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.11.8.46,2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} - -#### バグ修正 {#bug-fix-17} - -- 修正 `ALTER TABLE ... UPDATE` とテーブルのクエリ `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- タプルを持つサブクエリでin句を使用するときにnpeを修正しました。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- 固定問題の場合はュレプリカになり、生存していてデータ部分が撤去されることによります。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- CSVを解析する問題を修正しました [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- システム内の固定データレース.パーツテーブルと変更クエリ。 この修正 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- メモリの破損につながる可能性があり、突然変異で間違ったコードを修正. アドレスの読み取りによる固定segfault `0x14c0` それは同時に起こったかもしれない `DROP TABLE` と `SELECT` から `system.parts` または `system.parts_columns`. 突然変異クエリの準備の競合状態を修正しました。 によるデッドロックを修正 `OPTIMIZE` レプリケートされたテーブルと同時変更操作のような変更。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.11.7.40,2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} - -#### バグ修正 {#bug-fix-18} - -- Kafkaの統合は、このバージョンで修正されました。 -- 使用しているときにsegfaultを修正 `arrayReduce` 定数の引数の場合。 [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定 `toFloat()` 単調性 [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([ディマルブ2000](https://github.com/dimarub2000)) -- 有効にしてsegfaultを修正 `optimize_skip_unused_shards` シャーディングキーがない [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) -- 固定ロジックの `arrayEnumerateUniqRanked` 機能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MySQLハンドラから余分な冗長ロギングを削除しました。 [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 間違った動作と可能なsegfaultsを修正 `topK` と `topKWeighted` 集計関数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) -- 仮想列を公開しないでください `system.columns` テーブル。 これは、下位互換性のために必要です。 [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 複雑なキーキャッシュ辞書の文字列フィールドのメモリ割り当てのバグを修正。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- Bug Fixとを可能に適応粒度の作成時に新たなレプリカのために `Replicated*MergeTree` テーブル。 [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- 修正の無限ループ読み込み時にカフカメッセージ [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) -- 固定の可能性に作製したクエリがサーバのクラッシュによるスタックオーバーフローアプリケーションのパーサの可能性スタックオーバーフロー `Merge` と `Distributed` テーブル [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定gorillaエンコードエラーの小型dnaの塩基配列を決定した。 [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) - -#### 改善 {#improvement-5} - -- ユーザーの上書きを許可する `poll_interval` と `idle_connection_timeout` 接続時の設定。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.11.5.28、2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} - -#### バグ修正 {#bug-fix-19} - -- 固定の可能性を掛けクエリの場合はサーバが過負荷状態で運転されています。 [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定fpeにyandexconsistenthashます。 この修正 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- の変換のバグを修正しました `LowCardinality` タイプ `AggregateFunctionFactory`. この修正 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 修正の解析 `bool` からの設定 `true` と `false` 構成ファイル内の文字列。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- クエリの互換性のないストリ `Distributed` テーブルオーバ `MergeTree` テーブルの一部 `WHERE` に移動します `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- 固定オーバーフローの整数部署名-タイプを符号なしタイプです。 この修正 [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 下位互換性のない変更 {#backward-incompatible-change-5} - -- `Kafka` まだ壊れてる - -### ClickHouseリリース19.11.4.24,2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} - -#### バグ修正 {#bug-fix-20} - -- のを修正した。筆二次指標マーク適応型粒度. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- 修正 `WITH ROLLUP` と `WITH CUBE` の修飾子 `GROUP BY` 二レベルの集計。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 固定こつ `JSONExtractRaw` 機能。 固定 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ExternalLoader::reloadOutdated()のセグフォルトを修正しました。 [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) -- 固定の場合はサーバが切れることがあり聞くソケットがセットのリスクマネジメントの継続け残ります。 ツつィツ姪"ツつ"ツ債ツづュツつケツづ債つアツつソツづァ サーバーがエラーを返す場合があります `bad_function_call` 残りのクエリの場合。 [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ODBC、MySQL、ClickHouseとHTTP経由で外部辞書の初期ロードのための更新フィールド上の固定役に立たないと間違った条件。 この修正 [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- のキャストで修正された無関係な例外 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 非決定性の結果を修正する “uniq” 極端なまれなケースでの集計関数。 バグはすべてのClickHouseバージョンに存在していました。 [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Segfault私たちは少し高すぎる設定CIDRに機能 `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 固定小さなメモリリークがサーバに捨てる多くの例外から多くの異なるコンテキストを共有します。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定の状態で消費者も一時停止前の契約とな再開します。 [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([イワン](https://github.com/abyss7) 注このカフカを砕このバージョン。 -- エラーで完了した前の読み取り操作からkafkaデータバッファーをクリアします [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([ニコライ](https://github.com/bopohaa) 注このカフカを砕このバージョン。 -- それ以来 `StorageMergeTree::background_task_handle` で初期化される。 `startup()` その `MergeTreeBlockOutputStream::write()` 初期化の前に使用しようとするかもしれません。 すぐチェックインの場合は初期化されます。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([イワン](https://github.com/abyss7)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-6} - -- 追加された公式 `rpm` パッケージ。 [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) -- ビルドする機能を追加する `.rpm` と `.tgz` パッケージと `packager` スクリプト [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) -- 以下のための修正 “Arcadia” ビルドシステム。 [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) - -#### 下位互換性のない変更 {#backward-incompatible-change-6} - -- `Kafka` このバージョンでは壊れている。 - -### ClickHouseリリース19.11.3.11,2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} - -#### 新しい機能 {#new-feature-6} - -- 準備文のサポートが追加されました。 [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([Alexander](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `DoubleDelta` と `Gorilla` 列コーデック [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) -- 追加 `os_thread_priority` を制御することを可能にする設定 “nice” OSが動的スケジューリング優先順位を調整するために使用するクエリ処理スレッドの値。 それは必要です `CAP_SYS_NICE` 動作する機能。 これは [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 実装 `_topic`, `_offset`, `_key` カフカエンジンの列 [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([イワン](https://github.com/abyss7) 注このカフカを砕このバージョン。 -- 集計関数コンビネータを追加 `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) -- 集計関数 `groupArrayMovingSum(win_size)(x)` と `groupArrayMovingAvg(win_size)(x)`、ウィンドウサイズの制限の有無にかかわらず、移動の合計/平均を計算します。 [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) -- Synonimを追加 `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) -- インターゲートh3機能 `geoToH3` ユーバーから. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### バグ修正 {#bug-fix-21} - -- 非同期updateでdnsキャッシュを実装します。 個別のスレッドで解決すべてのホストを更新dnsキャッシュが期間(設定 `dns_cache_update_period`). ホストのipが頻繁に変更されるときに役立ちます。 [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([アントン-ポポフ](https://github.com/CurtizJ)) -- Segfaultを修正する `Delta` 32ビットサイズ未満の値を持つ列に影響を与えるコーデック。 バグはランダムメモリの破損につながった。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- ブロック内の非物理列とttlマージでsegfaultを修正しました。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([アントン-ポポフ](https://github.com/CurtizJ)) -- との部分のチェックでまれなバグを修正 `LowCardinality` コラム 以前は `checkDataPart` 常に `LowCardinality` コラム [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- 回避掛けに接続した場合、サーバスレッドプールを行います。 それはからの接続のために重要です `remote` 長い接続タイムアウトがある場合、テーブル関数またはレプリカなしのシャードへの接続。 この修正 [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 定数引数のサポート `evalMLModel` 機能。 この修正 [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定に問題がclickhouse判断したデフォルトのタイムゾーンとして `UCT` 代わりに `UTC`. この修正 [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定バッファアンダーフローで `visitParamExtractRaw`. この修正 [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 今すぐ配布 `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` クエリはリーダーレプリカで直接実行されます。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- 修正 `coalesce` のために `ColumnConst` と `ColumnNullable` +関連する変更。 [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正する `ReadBufferFromKafkaConsumer` なで読む新しいメッセージ `commit()` たとえそれが以前に失速したとしても [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([イワン](https://github.com/abyss7)) -- 修正 `FULL` と `RIGHT` 結合時の結合結果 `Nullable` 右のテーブルのキー。 [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) -- 優先度の低いクエリの無限スリープの可能性のある修正。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- これにより、いくつかのクエリがquery\_logの後に表示されないことがあります `SYSTEM FLUSH LOGS` クエリ。 [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 固定 `heap-use-after-free` 阿讃注意ClusterCopierによる腕時計を利用するようにしてすでに削除され複写機のオブジェクトです。 [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 固定間違った `StringRef` の実装によって返されるポインタ `IColumn::deserializeAndInsertFromArena`. このバグは単体テストのみに影響しました。 [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 同じ名前の列をマスクするソースおよび中間配列の結合列を防ぎます。 [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) -- MySQLスタイル識別子の引用とMySQLエンジンへの挿入と選択クエリを修正しました。 [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([冬張](https://github.com/zhang2014)) -- さて `CHECK TABLE` queryは、MergeTreeエンジンファミリで動作します。 各パート(またはsimplierエンジンの場合はファイル)のチェックステータスとメッセージが返されます。 また、壊れた部分のフェッチのバグを修正しました。 [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) -- SPLIT\_SHARED\_LIBRARIESランタイムを修正 [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) -- 固定タイムゾーンの初期化 `/etc/localtime` シンボリックリン `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- clickhouse-コピー機:シャットダウン時に使用-after freeを修正 [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) -- 更新 `simdjson`. ゼロバイトを持ついくつかの無効なJSONsが正常に解析する問題を修正しました。 [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- SystemLogsのシャットダウンを修正 [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([アントン-ポポフ](https://github.com/CurtizJ)) -- Invalidate\_queryの条件が辞書に依存しているときにハングする問題を修正しました。 [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### 改善 {#improvement-6} - -- クラスター構成で解決できないアドレスを許可します。 彼らは利用できないとみなされ、すべての接続試行で解決しようとします。 これはkubernetesに特に便利です。 この修正 [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- アイドル状態のtcp接続を閉じる(デフォルトでは一時間待ち)。 これは、すべてのサーバーが他のすべてのサーバーへの接続プールを保持する可能性があり、ピーククエリの同時実行の後に接続が停止するためです。 この修正 [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より良い品質の `topK` 機能。 新しい要素の重みが大きい場合、最後の要素を削除するようにSavingSpace設定の動作を変更しました。 [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- URLの機能と作業領域は今では不完全なUrlなスキーム [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) -- に追加されたチェックサム `system.parts_columns` テーブル。 [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- 追加 `Enum` synonimとしてのデータ型 `Enum8` または `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([ディマルブ2000](https://github.com/dimarub2000)) -- フルビット転置変異体のための `T64` コーデック。 より良い圧縮につながる可能性がある `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) -- 条件に `startsWith` 機能は主キーを使用することができます。 この修正 [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) と [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([ディマルブ2000](https://github.com/dimarub2000)) -- 使用を許可する `clickhouse-copier` クロス-複製クラスタトポロジーを許可する空のデータベースの名前です。 [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) -- 使用 `UTC` システム上のデフォルトのタイムゾーンとして `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` 印刷され、サーバまたはクライアン [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 関数の浮動小数点引数のサポートを返しました `quantileTiming` 下位互換性のため。 [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- エラーメッセージの列がないテーブルを表示します。 [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([イワン](https://github.com/abyss7)) -- さまざまなユーザーが同じquery\_idで実行クエリを許可しない [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) -- より強固なコードの送信メトリクスをグラファイトを表してい それは長い倍数の間に働きます `RENAME TABLE` オペレーション [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- よりエラーメッセージが表示されますのでthreadpoolできない予定、タスクを実行します。 この修正 [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- NgramSearchを反転させると、より直感的になります [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) -- HDFS engine builderでのユーザー解析の追加 [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) -- 更新のデフォルト値 `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) -- 廃止された設定の概念を追加しました。 廃止された設定 `allow_experimental_low_cardinality_type` 効果なしで使用することができます。 [0f15c01c6802f7ce1a1494c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) - -#### 性能向上 {#performance-improvement-4} - -- 増加数の河川から選択するとmergeテーブルにより均一に分布す。 追加された設定 `max_streams_multiplier_for_merge_tables`. この修正 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-7} - -- Clickhouseの異なるバージョンとクライアン [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) -- テスト対象の情報を毎にコミットを引きます。 [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) -- カスタムアロケータをサポートするaddress sanitizerと連携 (`Arena` と `ArenaWithFreeLists`)より良いデバッグのための “use-after-free” エラー。 [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([azerbaijan.kgm](https://github.com/akuzm)) -- に切り替える [LLVM libunwindの実装](https://github.com/llvm-mirror/libunwind) C++例外処理およびスタックトレース印刷用 [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) -- さらに二つの警告を追加-weverything [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- メモリ消毒剤とclickhouseを構築することができます。 [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定ubsanレポートについて `bitTest` ファズテストの機能。 [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Docker:認証を必要とするClickHouseインスタンスを初期化する可能性を追加しました。 [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) -- バージョン1.1.0にlibrdkafkaを更新 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([イワン](https://github.com/abyss7)) -- 追加グローバルタイムアウトのための統合の試験を無効にし試験ます。 [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) -- いくつかのthreadsanitizerの障害を修正します。 [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([azerbaijan.kgm](https://github.com/akuzm)) -- その `--no-undefined` オプション力、リンカーをチェックすべての外部の名の存在をリンク 分割ビルドモードでライブラリ間の実際の依存関係を追跡することは非常に便利です。 [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([イワン](https://github.com/abyss7)) -- のための追加された性能試験 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Gcc-7との互換性を修正しました。 [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Gcc-9のサポートが追加されました。 この修正 [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Libunwindが正しくリンクできない場合のエラーを修正。 [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- PVS-Studioによって検出されたいくつかの警告を修正しました。 [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加された初期サポート `clang-tidy` 静的な検光子。 [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- BSD/Linuxエンディアンマクロを変換する( ‘be64toh’ と ‘htobe64’)Mac OS Xに相当するもの [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([フーチェン](https://github.com/fredchenbj)) -- 統合テストガイドの改善。 [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Macosx+gcc9でのビルドの修正 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([フィリモノフ](https://github.com/filimonov)) -- 難しいタイプミスを修正:aggreagte-\>aggregate。 [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([azerbaijan.kgm](https://github.com/akuzm)) -- Freebsdビルドの修正 [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) -- 追加リンク実験youtubeチャンネルサイト [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) -- CMake:カバレッジフラグのオプションを追加:WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) -- いくつかのインラインpodarrayの初期サイズを修正。 [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([azerbaijan.kgm](https://github.com/akuzm)) -- clickhouse-サーバー.postinst:centos6のos検出を修正 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) -- 追加されたアーチlinuxパッケージ生成。 [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 共通/設定を分割します。h by libs(dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) -- 以下のための修正 “Arcadia” ムの構築 [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) -- 型にはまらないビルドの修正(gcc9、サブモジュールなし) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) -- バグが発生しやすいことが証明されているため、unalignedstoreで明示的な型を必要とします [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([azerbaijan.kgm](https://github.com/akuzm)) -- Macosのビルドを修正 [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([フィリモノフ](https://github.com/filimonov)) -- ここで要求されたより大きなデータセットを持つ新しいjit機能に関する性能試験 [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 走行状態での試験はストレステスト [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) - -#### 下位互換性のない変更 {#backward-incompatible-change-7} - -- `Kafka` このバージョンでは壊れている。 -- 有効 `adaptive_index_granularity` =新しいのためのデフォルトで10MB `MergeTree` テーブル。 バージョン19.11以降で新しいMergeTreeテーブルを作成した場合、19.6より前のバージョンへのダウングレードは不可能になります。 [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) -- Yandexのによって使用された廃止された文書化されていない埋め込まれた辞書を削除。メトリカ を機能 `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` もはや利用できません。 これらの機能を使用している場合は、電子メールをclickhouse-feedback@yandex-team.com。注:最後の瞬間に我々はしばらくの間、これらの機能を維持することを決めました。 [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouseリリース19.10 {#clickhouse-release-19-10} - -### クリックハウスリリース19.10.1.5,2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} - -#### 新しい機能 {#new-feature-7} - -- 新しい列コーデックを追加: `T64`. (U)IntX/EnumX/Data(Time)/DecimalX列用に作成されます。 定数値または小さい範囲値を持つ列に適しているはずです。 コーデック自体は、拡大または再圧縮せずにデータ型を縮小できます。 [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) -- データベースエンジ `MySQL` できる全てのテーブルをリモートMySQLサーバー [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([冬張](https://github.com/zhang2014)) -- `bitmapContains` 実装。 それは2xより速いです `bitmapHasAny` 第二のビットマップが一つの要素を含む場合。 [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) -- のサポート `crc32` 関数(MySQLやPHPとまったく同じ動作)。 ハッシュ関数が必要な場合は使用しないでください。 [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) -- 実装 `SYSTEM START/STOP DISTRIBUTED SENDS` 非同期挿入を制御するクエリ `Distributed` テーブル。 [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([冬張](https://github.com/zhang2014)) - -#### バグ修正 {#bug-fix-22} - -- マージ制限のクエリ実行制限および最大パーツサイズを無視する。 [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 通常のブロックの重複排除(非常にまれ)と重複ブロックの挿入(より頻繁に)につながる可能性のあるバグを修正しました。 [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) -- 機能の修正 `arrayEnumerateUniqRanked` 空の配列を持つ引数の場合 [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) -- な購読カフカ題なく意思をポーリングメッセージ. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([イワン](https://github.com/abyss7)) -- 設定を行う `join_use_nulls` Nullable内にできない型に対しては何の効果も得られません [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) -- 固定 `Incorrect size of index granularity` エラー [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([コラクススター](https://github.com/coraxster)) -- 小数変換オーバーフローを修正 [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([コラクススター](https://github.com/coraxster)) -- フラッシュバッファの場合 `WriteBufferFromHDFS`のデストラクタが呼び出されます。 これにより、 `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) - -#### 改善 {#improvement-7} - -- 空のセルを `CSV` としてデフォルト値を設定 `input_format_defaults_for_omitted_fields` は有効です。 [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([azerbaijan.kgm](https://github.com/akuzm)) -- 外部辞書の非ブロッキングロード。 [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) -- ネットワークタイムアウトできるダイナミックな変化のための既存の接続に従って設定します。 [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) -- を使用して “public\_suffix\_list” 機能のため `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. これは、 `gperf` ファイルから生成されたリスト:https://publicsuffix.org/list/public\_suffix\_list.dat(例えば、今我々はドメインを認識する `ac.uk` 有意ではない)。 [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 採用 `IPv6` システムテーブルのデータ型。 `system.processes` と `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MySQL互換性プロトコルとの接続にセッションを使用する。 \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([ユーリーバラノフ](https://github.com/yurriy)) -- サポートより `ALTER` クエリ `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) -- サポート `` のセクション `clickhouse-local` 設定ファイル。 [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) -- クエリの実行を許可する `remote` テーブル機能 `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) - -#### 性能向上 {#performance-improvement-5} - -- MergeTree列の最後に最後のマークを書き込む可能性を追加します。 これにより、テーブルデータ範囲外のキーの無駄な読み込みを回避できます。 適応インデックスの粒度が使用されている場合にのみ有効になります。 [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) -- 非常に遅いファイルシステム上のmergetreeテーブルのパフォーマンスの向上 `stat` シスコール [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定性能の劣化からの読み出しmergetreeテーブルで導入されたバージョン19.6. 修正\#5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-8} - -- 実装 `TestKeeper` テストに使用されるZooKeeperインタフェースの実装として [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) -- これからは `.sql` 試験走行ができるによって切り離されたサーバを並列には、ランダムなデータベースです。 それらをより速く実行し、カスタムサーバー構成で新しいテストを追加し、異なるテストが互いに影響しないことを確認します。 [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([イワン](https://github.com/abyss7)) -- 削除 `` と `` 性能テストから [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) -- 固定 “select\_format” 性能試験のための `Pretty` 形式 [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## クリックハウスリリース19.9 {#clickhouse-release-19-9} - -### クリックハウスリリース19.9.3.31,2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} - -#### バグ修正 {#bug-fix-23} - -- 32ビットサイズ未満の値を持つ列に影響を与えるデルタコーデックでsegfaultを修正しました。 バグはランダムメモリの破損につながった。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- LowCardinalityのコラムと部分の点検でまれな虫を修理して下さい。 [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- ブロック内の非物理列とttlマージでsegfaultを修正しました。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 低優先度のクエリの潜在的な無限の睡眠を修正しました。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定方法clickhouse判断したデフォルトのタイムゾーンとしてuctの代わりにutcです。 [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- のを修正した。約の実行の分散drop/alter/quick/最適化クラスターに関するお問い合わせフォロワレプリカの前にリーダーレプリカ. 今、彼らはリーダーのレプリカに直接実行されます。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- 固定レースの条件を回避することが可能となり、一部のクエリーのような画面が、表示されないでquery\_logぐにシステムのフラッシュログを返します。 [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 定数引数のサポートがないことを追加 `evalMLModel` 機能。 [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### クリックハウスリリース19.9.2.4,2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} - -#### 新しい機能 {#new-feature-8} - -- 凍結する部品についての印刷物情報 `system.parts` テーブル。 [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) -- 引数に設定されていない場合は、ttyでclickhouse-client startにクライアントパスワードを尋ねる [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) -- 実装 `dictGet` と `dictGetOrDefault` 小数タイプの関数。 [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 改善 {#improvement-8} - -- Debian init:サービス停止タイムアウトの追加 [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) -- 疑わしいタイプのテーブルを作成するには、デフォルトで禁止されている設定を追加します [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) -- 回帰機能を返却時の重量モデルとして用いられていない状態で機能 `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) -- 回帰方法の名前を変更して改善します。 [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) -- 明のインタフェースを文字列が揃. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) - -#### バグ修正 {#bug-fix-24} - -- カフカの潜在的なデータ損失を修正 [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([イワン](https://github.com/abyss7)) -- 潜在的な無限ループを修正 `PrettySpace` ゼロ列で呼び出されたときの形式 [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) -- 線形モデルのuint32オーバーフローバグを修正。 非constモデル引数のeval mlモデルを許可します。 [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `ALTER TABLE ... DROP INDEX IF EXISTS ...` なる例外を提供される場合指数が存在しない [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- セグメントフォールトを修正 `bitmapHasAny` スカラーサブクエリ [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- 固定の場合にはエラー複製を接続プールなリトライを解決するホストでも、dnsキャッシュした。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- 固定 `ALTER ... MODIFY TTL` レプリケートされたマーゲットリーで [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([アントン-ポポフ](https://github.com/CurtizJ)) -- マテリアライズ列を使用して分散テーブルに挿入を修正 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) -- Truncate Joinストレージの割り当ての問題を修正 [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([Tcheason](https://github.com/TCeason)) -- に最近のバージョンのパッケージtzdata一部のファイルsymlinksます。 現在の仕組みを検出するデフォルトのタイムゾーンの故障が考えられ、間違った名前に一部のタイムゾーン. 少なくとも、提供されていれば、タイムゾーン名をtzの内容に強制します。 [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([イワン](https://github.com/abyss7)) -- 一定の針が合計で少なくとも16kbの長さである場合、multivolnitsky searcherでいくつかの非常にまれなケースを修正します。 このアルゴリズムは、以前の結果を見逃したり上書きしたりして、誤った結果につながります `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) -- ExternalData要求の設定でClickHouseの設定を使用できない場合の問題を修正しました。 また、今のところ、設定 `date_time_input_format` と `low_cardinality_allow_in_native_format` 名前のあいまいさのために使用することはできません(外部データではテーブル形式と解釈でき、クエリでは設定にすることができます)。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) -- 部品は飼育係からそれらを落とすことなく、fsからのみ削除されたバグを修正。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- 削除デバッグログインからmysqlプロトコル [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- DDLクエリ処理中にZNONODEをスキップ [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- 修正ミックス `UNION ALL` 結果列の種類。 結果の列のデータ型および列の型が一致しない場合がありました。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- 間違った整数の例外をスローする `dictGetT` 機能の代わりにクラッシュ。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- ハッシュ化された辞書のための間違ったelement\_countとload\_factorを修正 `system.dictionaries` テーブル。 [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-9} - -- 固定ビルドなし `Brotli` HTTP圧縮のサポート (`ENABLE_BROTLI=OFF` cmake変数)。 [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) -- Roaringを含める。轟音/轟音としてh。h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) -- ハイパースキャンでgcc9の警告を修正(\#lineディレクティブは悪です!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) -- Gcc-9でコンパイルする際のすべての警告を修正。 いくつかのcontribの問題を修正しました。 Gcc9氷を修正しbugzillaに提出. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) -- Lldとのリンクを修正 [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 辞書で使用されていない特殊化を削除する [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) -- 向上性能試験のためのフォーマットと構文解析表の異なる種類のファイル [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) -- 並列テスト実行のための修正 [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) -- Docker:clickhouse-testからconfigsを使う [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) -- FreeBSD用のコンパイルを修正 [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) -- Boostを1.70にアップグレード [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) -- サブモジュールとしてビルドclickhouseを修正 [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) -- JSONExtractパフォーマンステストの改善 [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) - -## ClickHouseリリース19.8 {#clickhouse-release-19-8} - -### ClickHouseリリース19.8.3.8、2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} - -#### 新しい機能 {#new-features} - -- JSONで動作する機能を追加しました [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) -- 多くの言語に存在するbasename関数と同様の動作を持つ関数basenameを追加します (`os.path.basename` pythonでは, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 追加 `LIMIT n, m BY` または `LIMIT m OFFSET n BY` LIMIT BY句にnのオフセットを設定する構文。 [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 追加された新しいデータ型 `SimpleAggregateFunction` を持つことができます。 `AggregatingMergeTree`. これは、次のような単純な関数でのみ使用できます `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) -- 関数の非定数引数のサポートが追加されました `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) -- 機能追加 `skewPop`, `skewSamp`, `kurtPop` と `kurtSamp` シーケンスの歪度、標本の歪度、尖度、標本の尖度をそれぞれ計算します。 [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) -- 支援の名前変更操作のための `MaterializeView` ストレージ。 [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 追加のサーバで接続するclickhouse mysqlを使用してクライアント [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([ユーリーバラノフ](https://github.com/yurriy)) -- 追加 `toDecimal*OrZero` と `toDecimal*OrNull` 機能。 [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) -- 機能のサポート十進のタイプ: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`、medianExactWeighted。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加 `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) -- 追加 `format` 機能。 引数にリストされた文字列を含む定数パターン(簡略化されたPython形式のパターン)の書式設定。 [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) -- 追加 `system.detached_parts` テーブルの情報を含む外部 `MergeTree` テーブル。 [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([azerbaijan.kgm](https://github.com/akuzm)) -- 追加 `ngramSearch` 針と干し草の山の間の非対称差を計算する関数。 [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) -- 集約関数インタフェースを使用して、基本的な機械学習方法(確率線形回帰とロジスティック回帰)の実装。 モデルの重みを更新するための戦略が異なります(単純勾配降下、運動量法、nesterov法)。 また注文のサイズのミニバッチを支える。 [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) -- の実装 `geohashEncode` と `geohashDecode` 機能。 [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) -- 集計関数の追加 `timeSeriesGroupSum` る累積の異なる時系列のサンプルのタイムスタンプなアライメントを実施します。 これは、二つのサンプルタイムスタンプ間の線形補間を使用して、一緒に時系列を合計します。 集計関数の追加 `timeSeriesGroupRateSum` これは、時系列のレートを計算し、その後一緒にレートを合計します。 [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([楊関劉](https://github.com/LiuYangkuan)) -- 機能追加 `IPv4CIDRtoIPv4Range` と `IPv6CIDRtoIPv6Range` CIDRを使用してサブネット内のIPの下限と上限を計算する。 [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 有効な設定でhttpを使用してクエリを送信するときにx-clickhouse-summaryヘッダーを追加します `send_progress_in_http_headers`. X-ClickHouse-Progressの通常の情報を返し、クエリに挿入された行数やバイト数などの追加情報を返します。 [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([ギヨームタッセリー](https://github.com/YiuRULE)) - -#### 改善 {#improvements} - -- 追加 `max_parts_in_total` パーティションキー\#5166の安全でない指定を防ぐテーブルのMergeTreeファミリーの設定(デフォルト:100 000)。 [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-obfuscator`:derive種のため、個々のカラムを組み合わせ種の利用が重要であると考えられとカラム名、カラム位置にします。 ことを目的として変換するデータセットに複数の関連するテーブル、テーブルはJOINableに設定します。 [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 機能追加 `JSONExtractRaw`, `JSONExtractKeyAndValues`. 関数の名前を変更 `jsonExtract` に `JSONExtract`. 何かがうまくいかない場合、これらの関数は対応する値を返します。 `NULL`. 変更された機能 `JSONExtract` 今度は、最後のパラメータから戻り値の型を取得し、nullableを注入しません。 AVX2命令が利用できない場合にRapidJSONにフォールバックを実装しました。 新しいバージョンに更新Simdjsonライブラリ。 [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) -- さて `if` と `multiIf` 機能は条件に頼りません `Nullable` しかし、sqlの互換性のためにブランチに依存しています。 [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([建呉](https://github.com/janplus)) -- `In` 述語が生成されます `Null` 結果から `Null` のような入力 `Equal` 機能。 [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([建呉](https://github.com/janplus)) -- Kafkaからの行数ごとの時間制限(flush\_interval/poll\_timeout)をチェックします。 この読みからのカフカの消費者をより頻繁にチェックの時間制限のトップレベルの流れ [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([イワン](https://github.com/abyss7)) -- バンドルsaslとリンクrdkafka. sasl scram認証を使用できるようにする必要があります [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([イワン](https://github.com/abyss7)) -- すべてのジョインのrowreflistのバッチバージョン。 [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) -- clickhouse-サーバ:より有益なエラーメッセージを聞きます. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) -- Clickhouseのサポート辞書-機能のための複写機 `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) -- 新しい設定を追加 `kafka_commit_every_batch` カフカの政策を規制する。 - ることができる設定のコミットモード:バッチのメッセージの取り扱い、後のブロック全体に書きます。 このトレードオフの関係を失うメッセージやみ表示することを目的としていま倍もいる。 [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([イワン](https://github.com/abyss7)) -- 作る `windowFunnel` 他の符号なし整数型をサポート。 [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) -- 仮想列をシャドウする `_table` マージエンジンで。 [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([イワン](https://github.com/abyss7)) -- 作る `sequenceMatch` 集計関数は、他の符号なし整数型をサポート [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) -- より良いエラーメッセージの場合はチェックサムミスマッチは一によるものと考えられるハードウェアです。 [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- チェックすると配下のテーブル支援のためのサンプリング `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([イワン](https://github.com/abyss7)) -- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- MySQLワイヤプロトコルの改善。 フォーマットの名前をMySQLWireに変更しました。 RAIIをRSA\_freeを呼び出すために使用します。 コンテキス [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([ユーリーバラノフ](https://github.com/yurriy)) -- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) -- 分散テーブルへの非同期挿入のクエリ設定を考慮します。 [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([Tcheason](https://github.com/TCeason)) -- 関数の名前を変更 `leastSqr` に `simpleLinearRegression`, `LinearRegression` に `linearRegression`, `LogisticRegression` に `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### 性能の改善 {#performance-improvements} - -- ALTER MODIFYクエリの非レプリケートされたMergeTreeテーブルの一部の並列処理。 [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) -- 正規表現の抽出における最適化。 [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) -- 結果を結合するために右結合キー列を追加しないでください。 [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) -- 最初の空の応答の後にkafkaバッファをフリーズします。 それは多数のinvokationsをの避けます `ReadBuffer::next()` いくつかの行解析ストリームの空の結果。 [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([イワン](https://github.com/abyss7)) -- `concat` 複数の引数の関数の最適化。 [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) -- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) -- より速い解凍を持つように、lz4実装を参照してアップグレードします。 [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) -- MSD基数ソート(kxsortに基づく)、および部分ソートを実装しました。 [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) - -#### バグ修正 {#bug-fixes} - -- プッシュが結合で列を必要と修正 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([冬張](https://github.com/zhang2014)) -- バグを修正,clickhouseはsystemdによって実行されると,コマンド `sudo service clickhouse-server forcerestart` 期待通りに動作しませんでした。 [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) -- (9009ポート上のサーバー間のhttpサーバーは常に偶数エラーで、コード200を返しました)datapartsexchangeのhttpエラーコードを修正します。 [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) -- MAX\_SMALL\_STRING\_SIZEより長い文字列のSimpleAggregateFunctionを修正しました [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) -- のためのエラーを修正 `Decimal` に `Nullable(Decimal)` 変換で。 支援その他数を小数点の変換を含む異なる)を採用。 [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) -- 間違った計算につながるsimdjsonライブラリ内の固定fpu clobbering `uniqHLL` と `uniqCombined` 次のような集計関数と数学関数 `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- JSON関数でのconst/nonconstの混合ケースの処理を修正しました。 [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) -- 修正 `retention` 機能。 これで、データの行を満たすすべての条件がデータの状態に追加されます。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) -- 結果のタイプを修正する `quantileExact` 小数で。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 文書 {#documentation} - -- 以下のための文書を翻訳 `CollapsingMergeTree` 中国語に。 [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) -- テーブルエンジンに関する文書を中国語に翻訳します。 - [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) - [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) - ([決してリー](https://github.com/neverlee)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements} - -- ツづツつ、ツつシツつイツ猟.用ツつュツつセツつウツつ"ツ。[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([イワン](https://github.com/abyss7)) -- 移動性能試験の個別のディレクトリが便利です。 [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- パフォーマンステストの修正 [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) -- 追加ツールをチェックサムを計算によるビット切り替えデバッグハードウェアます。 [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- くランナーのスクリプトをより使用できます。 [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([フィリモノフ](https://github.com/filimonov)) -- パフォーマンステス [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) -- パフォーマンステストでのクエリの作成、入力、および削除での置換を行う機能を追加 [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) - -## クリックハウスリリース19.7 {#clickhouse-release-19-7} - -### ClickHouseリリース19.7.5.29,2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} - -#### バグ修正 {#bug-fix-25} - -- 固定能の回帰一部のクエリを処理するクラウドの場合。 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([冬張](https://github.com/zhang2014)) - -### クリックハウスリリース19.7.5.27,2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} - -#### 新しい機能 {#new-features-1} - -- ビットマップ関連の機能を追加 `bitmapHasAny` と `bitmapHasAll` に類似した `hasAny` と `hasAll` 配列の関数。 [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Catalonia\_comarques.Kgm](https://github.com/svladykin)) - -#### バグ修正 {#bug-fixes-1} - -- Segfaultをオンにする `minmax` Null値を持つインデックス。 [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) -- LIMITのすべての入力列を必要な出力としてマークします。 それは修正します ‘Not found column’ いくつかの分散クエリのエラー。 [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S.Pan](https://github.com/kvap)) -- 修正 “Column ‘0’ already exists” エラーで `SELECT .. PREWHERE` デフォルトの列 [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) -- 修正 `ALTER MODIFY TTL` 上のクエリ `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([アントン-ポポフ](https://github.com/CurtizJ)) -- Kafkaの消費者が起動に失敗したときにサーバをクラッシュさせないでください。 [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([イワン](https://github.com/abyss7)) -- 固定ビットマップ機能を誤った結果です。 [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([アンディヤング](https://github.com/andyyzh)) -- ハッシュ化された辞書のための修正element\_count(重複を含めないでください) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) -- タイムゾーンの名前として環境変数tzの内容を使用します。 すでに正しく検出デフォルトのタイムゾーンもあります。[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([イワン](https://github.com/abyss7)) -- 整数を変換しようとしないでください `dictGetT` それが正しく動作しないため、機能。 代わりに例外をスローします。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- ExternalData HTTP要求の設定を修正しました。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([ダニラ - クテニン](https://github.com/danlark1)) -- 部品は飼育係からそれらを落とすことなく、fsからのみ削除されたバグを修正。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- セグメンテーショ `bitmapHasAny` 機能。 [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- 固定の場合にはエラー複製を接続プールなリトライを解決するホストでも、dnsキャッシュした。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- 固定 `DROP INDEX IF EXISTS` クエリ。 さて `ALTER TABLE ... DROP INDEX IF EXISTS ...` 指定されたインデックスが存在しない場合、queryは例外を発生させません。 [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Union all supertype列を修正しました。 結果の列のデータ型および列の型が一致しない場合がありました。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- DDLクエリの処理中にZNONODEをスキップします。 別のノードがタスクキューのznodeを削除する前に、 - それを処理しませんでしたが、すでに子のリストを取得していますが、DDLWorkerスレッドを終了します。 [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- マテリアライズドカラムを使用して分散()テーブルに挿入を修正。 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) - -### ClickHouseリリース19.7.3.9,2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} - -#### 新しい機能 {#new-features-2} - -- ユーザーが指定できる設定の範囲を制限することができます。 - これらの制約は、ユーザー設定プロファイルで設定できます。 - [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([ヴィタリ - Baranov](https://github.com/vitlibar)) -- 関数の第二のバージョンを追加します `groupUniqArray` 任意を使って - `max_size` 結果の配列のサイズを制限するパラメーター。 この - 動作は次のようになります `groupArray(max_size)(x)` 機能。 - [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- TSVWithNames/CSVWithNames入力ファイル形式の場合、列の順序は次のようになります - ファイルヘッダーから決定。 これは、 - `input_format_with_names_use_header` パラメータ。 - [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) - ([Alexander](https://github.com/Akazz)) - -#### バグ修正 {#bug-fixes-2} - -- マージ中にuncompressed\_cache+joinでクラッシュ(\#5197) - [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([ダニラ - クテニン](https://github.com/danlark1)) -- Segmentation faultにclickhouse-クライアントがクエリーのシステムです。 \#5066 - [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) - ([イワン](https://github.com/abyss7)) -- KafkaEngine経由で重い負荷のデータ損失(#4736) - [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) - ([イワン](https://github.com/abyss7)) -- 固定非常に珍しいデータ競合状態が起こるのを実行する際にクエリとeuのすべての関少なくとも二つから選択します。列、システム。テーブル、システム。部品、システム。マージファミリのparts\_tablesまたはテーブルと、関連するテーブルの列の変更を同時に実行する。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 性能の改善 {#performance-improvements-1} - -- の単一の数値列によるソートに基数ソートを使用します `ORDER BY` なし - `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), - [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) - ([Evgenii Pravda](https://github.com/kvinty), - [alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 文書 {#documentation-1} - -- 翻訳書類の一部のテーブルエンジン。 - [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), - [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), - [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) - ([张风啸](https://github.com/AlexZFX)), - [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([しない - リー](https://github.com/neverlee)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-1} - -- UTF-8文字を正しく印刷する `clickhouse-test`. - [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加コマンドラインパラメータclickhouse-クライアントに常に負荷の提案 - データ。 [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- いくつかのpvs-studioの警告を解決します。 - [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 更新lz4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([ダニラ - クテニン](https://github.com/danlark1)) -- 今後のプル要求#5030の要件を構築するためにgperfを追加します。 - [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) - ([proller](https://github.com/proller)) - -## ClickHouseリリース19.6 {#clickhouse-release-19-6} - -### クリックハウスリリース19.6.3.18,2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} - -#### バグ修正 {#bug-fixes-3} - -- テーブル関数からのクエリの条件プッシュダウンで修正 `mysql` と `odbc` と対応するテーブルエンジン。 これは#3540と#2384を修正します。 [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Zookeeperのデッドロックを修正します。 [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlcname](https://github.com/github1youlc)) -- CSVで引用小数を許可します。 [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) -- Float Inf/NaNからDecimalsへの変換を禁止します(例外をスローします)。 [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) -- リネームクエリでデータレースを修正。 [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([冬張](https://github.com/zhang2014)) -- 一時的にlfallocを無効にします。 lfallocの使用は、uncompressedcacheを割り当てる際に多くのmap\_failedにつながり、その結果、高負荷のサーバーでのクエリのクラッシュにつながる可能性があります。 [cfdba93comment](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) - -### ClickHouseリリース19.6.2.11、2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} - -#### 新しい機能 {#new-features-3} - -- 列およびテーブルのttl式。 [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([アントン-ポポフ](https://github.com/CurtizJ)) -- のサポートを追加 `brotli` HTTPレスポンスの圧縮(Accept-Encoding:br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([ミハイル](https://github.com/fandyushin)) -- 新しい機能を追加 `isValidUTF8` バイトのセットが正しくutf-8エンコードされているかどう [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) -- 新しい負荷分散ポリシーの追加 `first_or_random` 送信されるクエリを最初に指定されたホストの場合は利用できな送信をクエリーダ主催のチャームのボー. クロスレプリケーショ [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) - -#### 実験の特徴 {#experimental-features-1} - -- 設定を追加 `index_granularity_bytes` (アダプティブインデックス粒度)MergeTree\*テーブルファミリの場合。 [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) - -#### 改善 {#improvements-1} - -- 関数の非定数および負のサイズと長さの引数のサポートが追加されました `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 左結合ではプッシュダウンから右テーブル、右結合では左テーブル、フル結合では両方のテーブルを無効にします。 このおかしくなる問題を修正に入実績もあります。 [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([イワン](https://github.com/abyss7)) -- `clickhouse-copier`:タスク設定の自動アップロード `--task-file` オプション [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) -- 追加の誤字ハンドラに保存工場とテーブル機能の工場です。 [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) -- サブクエリなしで複数のジョインのアスタリスクと修飾アスタリスクをサポート [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) -- く不カラムのエラーメッセージよりユーザーにも優しい。 [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 性能の改善 {#performance-improvements-2} - -- ASOF結合の大幅な高速化 [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) - -#### 下位互換性のない変更 {#backward-incompatible-changes} - -- HTTPヘッダ `Query-Id` に改名された `X-ClickHouse-Query-Id` 一貫性のために。 [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([ミハイル](https://github.com/fandyushin)) - -#### バグ修正 {#bug-fixes-4} - -- 固定された潜在的なnullポインタの逆参照 `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) -- JOIN+ARRAY JOINによるクエリのエラーを修正 [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定掛けの開始にサーバーが辞書により他の辞書を介してデータベースエンジン=辞書で調べました。 [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) -- Partially fix distributed\_product\_mode = local. It's possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There's not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) -- のための潜在的に間違った結果を修正 `SELECT DISTINCT` と `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定非常に珍しいデータ競合状態が起こるのを実行する際にクエリとeuのすべての関少なくとも二つから選択します。列、システム。テーブル、システム。部品、システム。マージファミリのparts\_tablesまたはテーブルと、関連するテーブルの列の変更を同時に実行する。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-2} - -- 別のホストでclickhouse-serverを実行しているときのテストの失敗を修正 [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) -- clickhouse-テスト:非tty環境でカラーコントロールシーケンスを無効にします。 [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) -- clickhouse-test:任意のテストデータベースの使用を許可する(削除する `test.` それが可能な資格) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) -- Ubsanエラーの修正 [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Yandex LFAllocがClickHouseに追加され、MarkCacheとUncompressedCacheデータをさまざまな方法で割り当てて、より信頼性の高いsegfaultをキャッチしました [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) -- バックポートとチェンジログを支援するためのpython util。 [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([イワン](https://github.com/abyss7)) - -## ClickHouseリリース19.5 {#clickhouse-release-19-5} - -### ClickHouseリリース19.5.4.22、2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} - -#### バグ修正 {#bug-fixes-5} - -- ビットマップ\*機能のクラッシュを修正 [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([アンディヤング](https://github.com/andyyzh)) -- 固定非常に珍しいデータ競合状態が起こるのを実行する際にクエリとeuのすべての関少なくとも二つから選択します。列、システム。テーブル、システム。部品、システム。マージファミリのparts\_tablesまたはテーブルと、関連するテーブルの列の変更を同時に実行する。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定エラー `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. このエラーは、LowCardinality列が主キーの一部であった場合に発生しました。 \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 保持機能の変更:行が最初の条件とn番目の条件の両方を満たす場合、最初の満足条件のみがデータ状態に追加されます。 これで、データの行を満たすすべての条件がデータの状態に追加されます。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) - -### ClickHouseリリース19.5.3.8,2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} - -#### バグ修正 {#bug-fixes-6} - -- 設定の固定タイプ `max_partitions_per_insert_block` ブール値からUInt64へ。 [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Mohammad Hostsein Sekhavat](https://github.com/mhsekhavat)) - -### ClickHouseリリース19.5.2.6,2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} - -#### 新しい機能 {#new-features-4} - -- [Hyperscan](https://github.com/intel/hyperscan) 複数の正規表現マッチングが追加されました(関数 `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) -- `multiSearchFirstPosition` 機能が追加されました。 [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) -- の実施を所定の表現フィルター配列です。 [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([イワン](https://github.com/abyss7)) -- 新しいタイプのデータを飛び指標に基づくブル(使用可能 `equal`, `in` と `like` 機能)。 [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) -- 追加 `ASOF JOIN` これにより、既知の最新の値に結合するクエリを実行できます。 [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) -- 複数の書き換え `COMMA JOIN` に `CROSS JOIN`. 次にそれらを書き換える `INNER JOIN` 可能であれば。 [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 改善 {#improvement-9} - -- `topK` と `topKWeighted` 今サポートカスタム `loadFactor` (修正の問題 [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([キリル丹心](https://github.com/kirillDanshin)) -- 使用を許可する `parallel_replicas_count > 1` サンプリングされていないテーブルの場合でも(設定は単に無視されます)。 以前のバージョンでは、例外が発生しました。 [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) -- のサポート `CREATE OR REPLACE VIEW`. ビューの作成または単一のステートメントでの新しい定義の設定を許可します。 [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) -- `Buffer` テーブルエンジン `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([楊関劉](https://github.com/LiuYangkuan)) -- Zookeeperのメタデータなしで複製テーブルを開始する機能を追加 `readonly` モード。 [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) -- Clickhouse-clientのプログレスバーのフリッカーを修正しました。 この問題は、 `FORMAT Null` ストリーミングクエ [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 機能を無効にするには `hyperscan` ユーザーごとにライブラリを使用して、過度かつ無制限のリソース使用量を制限します。 [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加バージョン番号でログインしてすべてのエラー. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) -- に制限を追加しました `multiMatch` 文字列サイズを必要とする関数 `unsigned int`. また、引数の数の制限を追加しました。 `multiSearch` 機能。 [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) -- 改善の利用をゼロスペースおよびエラー処理にhyperscan. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) -- 塗りつぶし `system.graphite_detentions` テーブルの設定から `*GraphiteMergeTree` エンジンテーブル。 [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- 名前変更 `trigramDistance` 機能への `ngramDistance` と追加より機能で `CaseInsensitive` と `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) -- データスキップインデックス計算の改善。 [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) -- 普通に保つ, `DEFAULT`, `MATERIALIZED` と `ALIAS` 単一のリストの列(修正の問題 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -#### バグ修正 {#bug-fix-26} - -- 避ける `std::terminate` メモリ割り当てに失敗した場合。 さて `std::bad_alloc` 期待どおりに例外がスローされます。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- バッファからcapnprotoの読み取りを修正します。 時にファイルなロードに成功するhttp. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ウラジスラフ](https://github.com/smirnov-vs)) -- エラーの修正 `Unknown log entry type: 0` 後に `OPTIMIZE TABLE FINAL` クエリ。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([アモスの鳥](https://github.com/amosbird)) -- 間違った引数へ `hasAny` または `hasAll` 関数はsegfaultにつながる可能性があります。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 行き詰まりが発生する恐れがあるとしながら実行 `DROP DATABASE dictionary` クエリ。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 未定義の動作を修正する `median` と `quantile` 機能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- ときに圧縮レベル検出を修正 `network_compression_method` 小文字で。 V19.1で壊れた。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- の固定無知 `UTC` 設定(修正の問題 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- 修正 `histogram` 関数の振る舞い `Distributed` テーブル。 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- 固定tsanレポート `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- システムログ使用時の競合状態によるシャットダウン時のtsanレポートを修正。 part\_logが有効になっているときにシャットダウン時に固定された潜在的な使用後無料。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- パーツの再チェックを修正 `ReplicatedMergeTreeAlterThread` エラーの場合。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 中間集計関数状態に対する算術演算は、定数引数(サブクエリ結果など)に対して機能していませんでした。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 常にメタデータの列名を引用します。 それ以外の場合は、列という名前の表を作成することは不可能です `index` (サーバーは不正な形式のために再起動しません `ATTACH` メタデータ内のクエリ)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- でクラッシュを修正 `ALTER ... MODIFY ORDER BY` に `Distributed` テーブル。 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Tcheason](https://github.com/TCeason)) -- Segfaultを修正する `JOIN ON` 有効にした場合 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([冬張](https://github.com/zhang2014)) -- カフカからprotobufメッセージを消費した後、余分な行を追加するとバグを修正しました。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- のクラッシュを修正 `JOIN` nullable列とnullable列ではありません。 修正 `NULLs` 右キーで `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) -- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- 固定競合状態で `SELECT` から `system.tables` テーブルが同時に名前変更または変更された場合。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 既に廃止されたデータ部分をフェッチする際のデータレースを修正。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 中に発生することができます `RENAME` MergeTree家族のテーブル。 [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 機能の固定細分化の欠陥 `arrayIntersect`. Segmentation faultう場合は関数と呼ばれたとの混合の定数、通常の引数になります。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- でクラッシュを修正 `FULL/RIGHT JOIN` 私たちはnullable対nullableではないに参加するとき. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正 `No message received` レプリカ間のパーツの取得中の例外。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- 固定 `arrayIntersect` 単一の配列のいくつかの繰り返しの値の場合に機能間違った結果。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 同時実行中の競合状態の修正 `ALTER COLUMN` クエリを生み出しうるサーバストレスとソーシャル-サポート問題の修正 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- 誤った結果を修正 `FULL/RIGHT JOIN` constの列を持つ。 [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) -- 重複を修正する `GLOBAL JOIN` アスタリスク付き。 [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正パラメータ控除で `ALTER MODIFY` 列の `CODEC` 列の型が指定されていない場合。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- 機能 `cutQueryStringAndFragment()` と `queryStringAndFragment()` 今すぐ正しく動作します `URL` くれないのを返します。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- 設定時にまれなバグを修正 `min_bytes_to_use_direct_io` これは、スレッドが列ファイル内で逆方向にシークする必要があるときに発生します。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- 集計関数の誤った引数の型を修正する `LowCardinality` 引数(修正の問題 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 間違った名前の修飾を修正 `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正機能 `toISOWeek` 1970年の結果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正 `DROP`, `TRUNCATE` と `OPTIMIZE` 実行されたときのクエリの重複 `ON CLUSTER` のために `ReplicatedMergeTree*` テーブルの家族。 [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### 下位互換性のない変更 {#backward-incompatible-change-8} - -- 名前変更の設定 `insert_sample_with_metadata` 設定する `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加された設定 `max_partitions_per_insert_block` (デフォルトでは値100)。 場合に挿入したブロックを含むより多くのパーティション例外がスローされます。 制限を削除する場合は0に設定します(推奨されません)。 [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- マルチサーチ機能の名称を変更 (`multiPosition` に `multiSearchAllPositions`, `multiSearch` に `multiSearchAny`, `firstMatch` に `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) - -#### 性能向上 {#performance-improvement-6} - -- 多くの針または多くの同様のbigramsとのクエリのために約5-10%の検索改善を与え、インライン化することによってvolnitsky検索を最適化します。 [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) -- 設定時のパフォーマンス問題を修正 `use_uncompressed_cache` がゼロより大き登場したときのすべてのデータに含まれる。 [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-10} - -- マークキャッシュとインデックスのメモリ保護を追加します。 これによりメモリの揃い踏みのバグの場合には豆やmsanできます。 [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cmake変数のサポートの追加 `ENABLE_PROTOBUF`, `ENABLE_PARQUET` と `ENABLE_BROTLI` これにより、上記の機能を有効/無効にすることができます(librdkafka、mysqlなどでも同じことができます)。 [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) -- 追加ダイレクトに刷版を出力するプロセス一覧表示およびstacktracesのすべてのスレッドの場合一部のクエリで吊るされているだけなので後の試験です。 [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) -- 再試行の追加 `Connection loss` エラーで `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) -- Freebsdのビルドとスレッドのサニタイザを使ったビルドをパッケージャスクリプトに追加します。 [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) -- 現在ユーザーのためのパスワードユーザー `'default'` 取付けの間。 [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) -- の警告を抑制する `rdkafka` ライブラリ。 [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sslなしで構築する能力を許可します。 [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) -- カスタムユーザーからclickhouse-serverイメージを起動する方法を追加します。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Contrib boostを1.69にアップグレードします。 [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) -- 使用を無効にする `mremap` きめにスレッドに指消毒剤. 驚いたことに、TSanは傍受しません `mremap` (それは傍受しますが `mmap`, `munmap`)それは偽陽性につながります. ステートフルテストで修正TSanレポート。 [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加試験にチェックを使用形式スキーマによhttpインターフェース。 [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) - -## クリックハウスリリース19.4 {#clickhouse-release-19-4} - -### ClickHouseリリース19.4.4.33,2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} - -#### バグ修正 {#bug-fixes-7} - -- 避ける `std::terminate` メモリ割り当てに失敗した場合。 さて `std::bad_alloc` 期待どおりに例外がスローされます。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- バッファからcapnprotoの読み取りを修正します。 時にファイルなロードに成功するhttp. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([ウラジスラフ](https://github.com/smirnov-vs)) -- エラーの修正 `Unknown log entry type: 0` 後に `OPTIMIZE TABLE FINAL` クエリ。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([アモスの鳥](https://github.com/amosbird)) -- 間違った引数へ `hasAny` または `hasAll` 関数はsegfaultにつながる可能性があります。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 行き詰まりが発生する恐れがあるとしながら実行 `DROP DATABASE dictionary` クエリ。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 未定義の動作を修正する `median` と `quantile` 機能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- ときに圧縮レベル検出を修正 `network_compression_method` 小文字で。 V19.1で壊れた。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- の固定無知 `UTC` 設定(修正の問題 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- 修正 `histogram` 関数の振る舞い `Distributed` テーブル。 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- 固定tsanレポート `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- システムログ使用時の競合状態によるシャットダウン時のtsanレポートを修正。 part\_logが有効になっているときにシャットダウン時に固定された潜在的な使用後無料。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- パーツの再チェックを修正 `ReplicatedMergeTreeAlterThread` エラーの場合。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 中間集計関数状態に対する算術演算は、定数引数(サブクエリ結果など)に対して機能していませんでした。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 常にメタデータの列名を引用します。 それ以外の場合は、列という名前の表を作成することは不可能です `index` (サーバーは不正な形式のために再起動しません `ATTACH` メタデータ内のクエリ)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- でクラッシュを修正 `ALTER ... MODIFY ORDER BY` に `Distributed` テーブル。 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([Tcheason](https://github.com/TCeason)) -- Segfaultを修正する `JOIN ON` 有効にした場合 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([冬張](https://github.com/zhang2014)) -- カフカからprotobufメッセージを消費した後、余分な行を追加するとバグを修正しました。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- 固定競合状態で `SELECT` から `system.tables` テーブルが同時に名前変更または変更された場合。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 既に廃止されたデータ部分をフェッチする際のデータレースを修正。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 中に発生することができます `RENAME` MergeTree家族のテーブル。 [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 機能の固定細分化の欠陥 `arrayIntersect`. Segmentation faultう場合は関数と呼ばれたとの混合の定数、通常の引数になります。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 修正 `No message received` レプリカ間のパーツの取得中の例外。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- 固定 `arrayIntersect` 単一の配列のいくつかの繰り返しの値の場合に機能間違った結果。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 同時実行中の競合状態の修正 `ALTER COLUMN` クエリを生み出しうるサーバストレスとソーシャル-サポート問題の修正 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修正パラメータ控除で `ALTER MODIFY` 列の `CODEC` 列の型が指定されていない場合。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- 機能 `cutQueryStringAndFragment()` と `queryStringAndFragment()` 今すぐ正しく動作します `URL` くれないのを返します。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- 設定時にまれなバグを修正 `min_bytes_to_use_direct_io` これは、スレッドが列ファイル内で逆方向にシークする必要があるときに発生します。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- 集計関数の誤った引数の型を修正する `LowCardinality` 引数(修正の問題 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 修正機能 `toISOWeek` 1970年の結果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正 `DROP`, `TRUNCATE` と `OPTIMIZE` 実行されたときのクエリの重複 `ON CLUSTER` のために `ReplicatedMergeTree*` テーブルの家族。 [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### 改善 {#improvements-2} - -- 普通に保つ, `DEFAULT`, `MATERIALIZED` と `ALIAS` 単一のリストの列(修正の問題 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -### ClickHouseリリース19.4.3.11,2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} - -#### バグ修正 {#bug-fixes-8} - -- でクラッシュを修正 `FULL/RIGHT JOIN` 私たちはnullable対nullableではないに参加するとき. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-11} - -- カスタムユーザーからclickhouse-serverイメージを起動する方法を追加します。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### クリックハウスリリース19.4.2.7,2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} - -#### バグ修正 {#bug-fixes-9} - -- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### クリックハウスリリース19.4.1.3,2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} - -#### バグ修正 {#bug-fixes-10} - -- 両方を含む固定リモートクエリ `LIMIT BY` と `LIMIT`. 以前は、 `LIMIT BY` と `LIMIT` リモートクエリに使用された, `LIMIT` 前に起こる可能性が `LIMIT BY` るもの濾過します。 [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S.Pan](https://github.com/kvap)) - -### ClickHouseリリース19.4.0.49,2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} - -#### 新しい機能 {#new-features-5} - -- 追加の完全なサポート `Protobuf` フォーマット(入出力、ネストされたデータ構造)。 [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) -- ビットマップを追加しました。 [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([アンディヤング](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) -- 寄木細工の形式のサポート。 [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) -- ファジィ文字列の比較のために、n-gram距離が追加されました。 これは、r言語のq-gramメトリックに似ています。 [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) -- 結合ルールのための黒鉛rollupから専用の凝集-保持。 [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- 追加 `max_execution_speed` と `max_execution_speed_bytes` リソースの使用を制限する。 追加 `min_execution_speed_bytes` 補完する設定 `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([冬張](https://github.com/zhang2014)) -- 機能実装 `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) -- 機能追加 `arrayEnumerateDenseRanked` と `arrayEnumerateUniqRanked` (それはのようなものだ `arrayEnumerateUniq` しかし、多次元配列の内部を調べるために配列の深さを微調整することができます)。 [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) - -#### バグ修正 {#bug-fixes-11} - -- このリリースも含む全てのバグ修正から19.3 19.1. -- データスキップインデックスのバグを修正:挿入後の顆粒の順序が間違っていた。 [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) -- 固定 `set` インデックス `Nullable` と `LowCardinality` 列。 その前に, `set` 索引とともに `Nullable` または `LowCardinality` 列ledにエラー `Data type must be deserialized with multiple streams` 選択中。 [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 完全にupdate\_timeを正しく設定する `executable` 辞書の更新。 [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) -- 19.3で壊れたプログレスバーを修正。 [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([フィリモノフ](https://github.com/filimonov)) -- 特定のケースで、メモリ領域をシュリンクしたときのmemorytrackerの値の不一致を修正しました。 [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ThreadPoolでの未定義の動作を修正しました。 [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- メッセージで非常にまれなクラッシュを修正 `mutex lock failed: Invalid argument` これは、MergeTreeテーブルがSELECTと同時に削除されたときに発生する可能性があります。 [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) -- ODBCドライバとの互換性 `LowCardinality` データ型。 [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) -- FreeBSD:Fixup for `AIOcontextPool: Found io_event with unknown id 0` エラー。 [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `system.part_log` テーブルは構成に関係なく作成されました。 [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 未定義の動作を修正する `dictIsIn` キャッシュ辞書の関数。 [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) -- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) -- デフォルトでcompile\_expressionsを無効にします。 `llvm` contribはそれをとのテストし、 `clang` と `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) -- 防ぐ `std::terminate` とき `invalidate_query` のために `clickhouse` 外部辞書ソースが間違った結果セット(空または複数の行または複数の列)を返しました。 ときに問題を修正しました `invalidate_query` にかかわらず、五秒ごとに実行されました `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ときにデッドロックを避ける `invalidate_query` 辞書のために `clickhouse` ソースが関与していた `system.dictionaries` テーブルまたは `Dictionaries` データベース(まれなケース)。 [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- クロスのための修正は、空のwhereに参加します。 [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) -- 機能の固定segfault “replicate” 定数引数が渡されるとき。 [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定ラムダ機能と述語オプティマイザ. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([冬張](https://github.com/zhang2014)) -- 複数のフィックスを結合します。 [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 改善 {#improvements-3} - -- 支援のエイリアスに参加でき課右テーブル列あります。 [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) -- 複数の結合の結果は、サブセレクトで使用される正しい結果名が必要です。 平置き換えエイリアスとソース名ます。 [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) -- 結合文のプッシュダウンロジックを改善します。 [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([イワン](https://github.com/abyss7)) - -#### 性能の改善 {#performance-improvements-3} - -- 改善されたヒューリスティック “move to PREWHERE” 最適化。 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 8ビットおよび16ビットのキーにhashtableのapiを使用する適切なルックアップテーブルを使用します。 [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([アモスの鳥](https://github.com/amosbird)) -- 文字列比較のパフォーマンスの向上。 [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 分散ddlタスクを処理するメインループが遅くならないように、別のスレッドで分散ddlキューをクリーンアップします。 [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) -- とき `min_bytes_to_use_direct_io` 読み込むデータサイズが圧縮されたブロックのサイズによって過小評価されることがあるため、すべてのファイルがO\_DIRECTモードで開かれたわけでは [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-12} - -- Clang-9のサポートを追加 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 間違った修正 `__asm__` 指示(再び) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) -- 設定を指定する機能を追加する `clickhouse-performance-test` コマンドラインから。 [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) -- 統合テストに辞書テストを追加します。 [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) -- 追加のクエリからのベンチマークのサイトを自動化性能試験までを実施。 [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `xxhash.h` それは実装の詳細であり、そのシンボルは次の名前空間であるため、外部lz4には存在しません `XXH_NAMESPACE` マクロ Lz4が外部の場合、xxHashも外部になければならず、扶養家族はそれにリンクする必要があります。 [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) -- 次の場合にケースを修正 `quantileTiming` 集約関数は、負の引数または浮動小数点引数で呼び出すことができます(これは、未定義の動作消滅器でfuzzテストを修正します)。 [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- スペルエラー訂正。 [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2unit description in lists](https://github.com/sdk2)) -- Macでのコンパイルの修正。 [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) -- FreeBSDおよび様々な異常なビルド設定のためのビルドの修正。 [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) - -## クリックハウスリリース19.3 {#clickhouse-release-19-3} - -### ClickHouseリリース19.3.9.1,2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} - -#### バグ修正 {#bug-fixes-12} - -- でクラッシュを修正 `FULL/RIGHT JOIN` 私たちはnullable対nullableではないに参加するとき. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- セグメンテーショ `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- 固定読み取りから `Array(LowCardinality)` 列に空の配列の長いシーケンスが含まれている場合はまれです。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-13} - -- カスタムユーザーからclickhouse-serverイメージを起動する方法を追加する [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### ClickHouseリリース19.3.7,2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} - -#### バグ修正 {#bug-fixes-13} - -- #3920で修正されたエラー。 このエラ `Unknown codec family code`, `Cannot seek through file` とsegfaults。 このバグはバージョン19.1で最初に登場し、19.1.10および19.3.6までのバージョンに存在します。 [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.3.6,2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} - -#### バグ修正 {#bug-fixes-14} - -- スレッドプールに1000を超えるスレッドがある場合, `std::terminate` が起こるためのスレッド終了します。 [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 今では作成することが可能です `ReplicatedMergeTree*` コメントとデフォルトのない列のコメントを持つ表。 また、コーデックの比較を修正。 [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) -- 配列またはタプルとの結合にクラッシュを修正しました。 [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) -- メッセージとclickhouse-コピー機で固定クラッシュ `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定電話を切るサーバー停止の場合は分散ddlsを使用した。 [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) -- 10より大きい列のテキスト形式の解析に関するエラーメッセージで、誤った列番号が出力されました。 [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-3} - -- AVXを有効にした固定ビルド。 [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- コンパイルされるカーネルの代わりに、既知のバージョンに基づいて拡張会計とio会計を有効にします。 [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) -- Core\_dumpの設定をスキップできるようにします。size\_limit、制限セットが失敗した場合はスローの代わりに警告します。 [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) -- 削除された `inline` タグの `void readBinary(...)` で `Field.cpp`. また、冗長マージ `namespace DB` ブロック。 [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) - -### クリックハウスリリース19.3.5,2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} - -#### バグ修正 {#bug-fixes-15} - -- 大規模なhttp挿入クエリ処理のバグを修正しました。 [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) -- の間違った実装による古いバージョンとの固定後方の非互換性 `send_logs_level` 設定。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- テーブル機能の後方互換性を修正しました `remote` 列のコメントと共に導入。 [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.3.4,2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} - -#### 改善 {#improvements-4} - -- テーブル-インデックスをさせていただく事があり占めのメモリの制限を行うと `ATTACH TABLE` クエリ。 デタッチされた後にテーブルを添付できない可能性を回避しました。 [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ZooKeeperから受け取った最大文字列と配列サイズの上限をわずかに上げました。 でも引き続き増加しのサイズ `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` 飼育係に。 [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- すでにキューに多数のノードがある場合でも、放棄されたレプリカを修復できます。 [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 必要な引数を一つ追加する `SET` インデックス(最大保存行数)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### バグ修正 {#bug-fixes-16} - -- 固定 `WITH ROLLUP` 単一のグループの結果 `LowCardinality` キー。 [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 固定バグの設定指数を落と顆粒が含まれている場合以 `max_rows` 行)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) -- 多くのfreebsdビルドの修正。 [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) -- 固定エイリアス置換にクエリサブクエリを含む同じエイリアス(発行 [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-4} - -- 実行する機能を追加 `clickhouse-server` dockerイメージのステートレステストの場合。 [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) - -### クリックハウスリリース19.3.3,2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} - -#### 新しい機能 {#new-features-6} - -- を追加しました `KILL MUTATION` いくつかの理由である突然変異を除去することを可能にする声明。 追加 `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` フィールドに `system.mutations` テーブルやtroubleshooting. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) -- 集計関数の追加 `entropy` シャノンのエントロピーを計算します [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) -- クエリを送信する機能を追加 `INSERT INTO tbl VALUES (....` 分割せずにサーバーに `query` と `data` パーツだ [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) -- の一般的な実装 `arrayWithConstant` 機能が追加されました。 [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 実装 `NOT BETWEEN` 比較演算子です。 [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([ドミトリー-ナウモフ](https://github.com/nezed)) -- 実装 `sumMapFiltered` 値が合計されるキーの数を制限できるようにするには `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- のサポートを追加 `Nullable` タイプ `mysql` テーブル機能。 [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) -- 任意の定数式のサポート `LIMIT` 句。 [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) -- 追加 `topKWeighted` (符号なし整数)重みを持つ追加の引数を取る集約関数。 [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([アンドリュー golman](https://github.com/andrewgolman)) -- `StorageJoin` 今サポート `join_any_take_last_row` 同じキーの既存の値を上書きできるようにする設定。 [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([アモスの鳥](https://github.com/amosbird) -- 機能追加 `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) -- 追加 `RowBinaryWithNamesAndTypes` フォーマット。 [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V.Kozlyuk](https://github.com/DarkWanderer)) -- 追加 `IPv4` と `IPv6` データ型。 より効果的な実装 `IPv*` 機能。 [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) -- 機能追加 `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) -- 追加 `Protobuf` 出力形式。 [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) -- 追加brotli支援のためのhttpインタフェースデータインポート(挿入します). [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([ミハイル](https://github.com/fandyushin)) -- ユーザーが関数名にタイプミスをしたり、コマンドラインクライアン [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) -- 追加 `Query-Id` サーバーのHTTP応答ヘッダーへ。 [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([ミハイル](https://github.com/fandyushin)) - -#### 実験の特徴 {#experimental-features-2} - -- 追加 `minmax` と `set` データ飛指標MergeTreeテーブルエンジンです。 [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- の追加された変換 `CROSS JOIN` に `INNER JOIN` 可能であれば。 [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) - -#### バグ修正 {#bug-fixes-17} - -- 固定 `Not found column` 重複する列の場合 `JOIN ON` セクション。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- 作る `START REPLICATED SENDS` コマンド開始レプリケート送信。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- 固定集計関数の実行 `Array(LowCardinality)` 引数。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 修正された間違った行動 `INSERT ... SELECT ... FROM file(...)` クエリとファイルは `CSVWithNames` または `TSVWIthNames` フォーマットと最初のデータ行がありません。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 辞書が利用できない場合辞書リロードに固定クラッシュ。 このバグは19.1.6で登場しました。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- 固定 `ALL JOIN` 右のテーブルに重複しています。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定細分化の欠陥との `use_uncompressed_cache=1` そして、間違った非圧縮サイズの例外。 このバグは19.1.6で登場しました。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- 固定 `compile_expressions` 大きな(int16以上の)日付の比較を伴うバグ。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- テーブル関数から選択する固定無限ループ `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 述語の最適化を一時的に無効にする `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([冬張](https://github.com/zhang2014)) -- 固定 `Illegal instruction` 古いCpuでbase64関数を使用するときにエラーが発生しました。 このエラーは、ClickHouseがgcc-8でコンパイルされた場合にのみ再現されています。 [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定 `No message received` エラーが発生との交流PostgreSQL ODBCドライバーを通してTLS接続します。 MySQLのODBCドライバを使用する場合にも、segfaultを修正します。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定間違った結果 `Date` と `DateTime` 引数は、条件付き演算子(関数)の分岐で使用されます `if`). 機能のための追加された汎用ケース `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- クリックハウス辞書は今内ロード `clickhouse` プロセス。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定デッドロック時 `SELECT` テーブルから `File` エンジンは後に再試行されました `No such file or directory` エラー。 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定レース条件から選択すると `system.tables` を与える `table doesn't exist` エラー。 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-client` でsegfault出口がデータを読み込むためのコマンドラインの提案いたインタラクティブモードになります。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 変異の実行が含むバグを修正しました `IN` 演算子は、誤った結果を生成していた。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- 固定エラー:データベースがある場合 `Dictionary` エンジン、サーバーの起動時に強制的にロードされるすべての辞書、およびlocalhostからのClickHouseソースを持つ辞書がある場合、辞書はロードできません。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定エラー時のシステムログのようにして作成時サーバをシャットダウンしました。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 正しい型を正しく返し、適切にロックを処理する `joinGet` 機能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([アモスの鳥](https://github.com/amosbird)) -- 追加 `sumMapWithOverflow` 機能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- 固定segfaultと `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) -- 間違ったとのバグを修正 `Date` と `DateTime` 比較。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- 未定義の動作の下で固定ファズテストサニタイザ:追加されたパラメータの型チェック `quantile*Weighted` 機能の系列。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 古いデータパーツの削除が失敗することがある稀な競合状態を修正しました `File not found` エラー。 [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- /etc/clickhouse-server/configが見つからないインストールパッケージを修正xmlだ [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-5} - -- Debianパッケージ:設定に従って/etc/clickhouse-server/preprocessedリンクを修正します。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- FreeBSDのための様々なビルドの修正. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) -- Perftestでテーブルを作成、入力、削除する機能を追加しました。 [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) -- 重複をチェックするスクリプトを追加しました。 [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- パフォーマンステス [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) -- パッケージはデバッグシンボルとを示唆を設置することができます。 [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- パフォーマンステストのリファクタリング。 より良いロギングと信号の処理。 [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) -- 匿名のyandexにドキュメントを追加しました。メトリカのデータセット。 [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) -- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) -- 追加docsつのデータセットにs3. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) -- プル要求の説明からchangelogを作成するスクリプトを追加しました。 [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Clickhouseの人形モジュールを追加しました。 [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- 文書化されていない関数のグループのドキュメントを追加しました。 [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([冬張](https://github.com/zhang2014)) -- ARMビルドの修正。 [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) -- 辞書テストを実行できるようになりました `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) -- さて `/etc/ssl` はデフォルトとして使用されると、ディレクトリにSSL証明書 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 開始時にsseおよびavx命令の確認を追加しました。 [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) -- Initスクリプトは開始までサーバを待機します。 [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) - -#### 下位互換性のない変更 {#backward-incompatible-changes-1} - -- 削除 `allow_experimental_low_cardinality_type` 設定。 `LowCardinality` デー [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 削減マークのキャッシュされた、圧縮解除されたキャッシュサイズに従ってメインメニューを開きます。 [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([ロパチンコンスタンチン](https://github.com/k-lopatin) -- キーワードを追加 `INDEX` で `CREATE TABLE` クエリ。 名前のある列 `index` バッククォートまたは二重引用符で囲む必要があります: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- `sumMap` を推進する結果の型の代わりにオーバーフロー. 古いの `sumMap` 動作は、以下を使用して取得できます `sumMapWithOverflow` 機能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) - -#### 性能の改善 {#performance-improvements-4} - -- `std::sort` に置き換え `pdqsort` なしのクエリの場合 `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) -- 現在サーバーの再利用にスレッドからグローバルスレッドプールがあります。 この影響性能の一部のコーナー。 [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 改善 {#improvements-5} - -- FreeBSDのAIOサポートを実装しました。 [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `SELECT * FROM a JOIN b USING a, b` 今すぐ戻る `a` と `b` 左側のテーブルからの列のみ。 [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) -- 許可 `-C` オプションクライアントとして `-c` オプション。 [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) -- Nowオプション `--password` 使用せずに値を必要とパスワードからstdin. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) -- エスケープされていないメタ文字を含む文字列リテラルで強調表示するようにした `LIKE` 式または正規表現。 [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- クライアントソケッ [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) -- 現在サーバーの進捗報告書くクライアント接続の待機を開始。 [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([イワン](https://github.com/abyss7)) -- 最適化クエリの理由がわずかに良いメッセージ `optimize_throw_if_noop` 設定は有効です。 [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- のサポートを追加 `--version` clickhouseサーバーのための選択。 [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([ロパチンコンスタンチン](https://github.com/k-lopatin)) -- 追加 `--help/-h` オプションへ `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([ユーリーバラノフ](https://github.com/yurriy)) -- るためのサポートを追加しましたスカラサブクエリと集計関数の状態ます。 [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 向上サーバー停止時間の変更を待ってます。 [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Replicated\_can\_become\_leader設定に関する情報をsystemに追加しました。レトロギングの場合、レプリカなくなります。 [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) - -## クリックハウスリリース19.1 {#clickhouse-release-19-1} - -### ClickHouseリリース19.1.14、2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} - -- 固定エラー `Column ... queried more than once` それは起こるかもしれません設定 `asterisk_left_columns_only` 使用する場合は1に設定します `GLOBAL JOIN` と `SELECT *` (まれなケース)。 この問題は19.3以降には存在しません。 [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) - -### クリックハウスリリース19.1.13,2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} - -このリリースには、19.3.7とまったく同じパッチが含まれています。 - -### ClickHouseリリース19.1.10、2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} - -このリリースには、19.3.6とまったく同じパッチが含まれています。 - -## クリックハウスリリース19.1 {#clickhouse-release-19-1-1} - -### ClickHouseリリース19.1.9,2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} - -#### バグ修正 {#bug-fixes-18} - -- の間違った実装による古いバージョンとの固定後方の非互換性 `send_logs_level` 設定。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- テーブル機能の後方互換性を修正しました `remote` 列のコメントと共に導入。 [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### クリックハウスリリース19.1.8,2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} - -#### バグ修正 {#bug-fixes-19} - -- /etc/clickhouse-server/configが見つからないインストールパッケージを修正xmlだ [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -## クリックハウスリリース19.1 {#clickhouse-release-19-1-2} - -### クリックハウスリリース19.1.7,2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} - -#### バグ修正 {#bug-fixes-20} - -- 正しい型を正しく返し、適切にロックを処理する `joinGet` 機能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([アモスの鳥](https://github.com/amosbird)) -- 固定エラー時のシステムログのようにして作成時サーバをシャットダウンしました。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定エラー:データベースがある場合 `Dictionary` エンジン、サーバーの起動時に強制的にロードされるすべての辞書、およびlocalhostからのClickHouseソースを持つ辞書がある場合、辞書はロードできません。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 変異の実行が含むバグを修正しました `IN` 演算子は、誤った結果を生成していた。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- `clickhouse-client` でsegfault出口がデータを読み込むためのコマンドラインの提案いたインタラクティブモードになります。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定レース条件から選択すると `system.tables` を与える `table doesn't exist` エラー。 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定デッドロック時 `SELECT` テーブルから `File` エンジンは後に再試行されました `No such file or directory` エラー。 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定問題:地方clickhouse辞書読み込まれtcpが負荷以内です。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定 `No message received` エラーが発生との交流PostgreSQL ODBCドライバーを通してTLS接続します。 MySQLのODBCドライバを使用する場合にも、segfaultを修正します。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 述語の最適化を一時的に無効にする `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([冬張](https://github.com/zhang2014)) -- テーブル関数から選択する固定無限ループ `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定 `compile_expressions` 大きな(int16以上の)日付の比較を伴うバグ。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- 固定細分化の欠陥との `uncompressed_cache=1` そして、間違った非圧縮サイズの例外。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- 固定 `ALL JOIN` 右のテーブルに重複しています。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正された間違った行動 `INSERT ... SELECT ... FROM file(...)` クエリとファイルは `CSVWithNames` または `TSVWIthNames` フォーマットと最初のデータ行がありません。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定集計関数の実行 `Array(LowCardinality)` 引数。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Debianパッケージ:設定に従って/etc/clickhouse-server/preprocessedリンクを修正します。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- 未定義の動作の下で固定ファズテストサニタイザ:追加されたパラメータの型チェック `quantile*Weighted` 機能の系列。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 作る `START REPLICATED SENDS` コマンド開始レプリケート送信。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- 固定 `Not found column` セクションの結合で重複する列の場合。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- さて `/etc/ssl` はデフォルトとして使用されると、ディレクトリにSSL証明書 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 辞書が利用できない場合辞書リロードに固定クラッシュ。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- 間違ったとのバグを修正 `Date` と `DateTime` 比較。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- 固定間違った結果 `Date` と `DateTime` 引数は、条件付き演算子(関数)の分岐で使用されます `if`). 機能のための追加された汎用ケース `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouseリリース19.1.6,2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} - -#### 新しい機能 {#new-features-7} - -- 表の列ごとのカスタム圧縮コーデック。 [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [冬張](https://github.com/zhang2014), [アナトリー](https://github.com/Sindbag)) -- 圧縮コーデックを追加 `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) -- 許可する `ALTER` 圧縮コーデック。 [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) -- 機能追加 `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` SQL標準の互換性のために。 [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) -- 書き込みのサポート `HDFS` テーブルと `hdfs` テーブル機能。 [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) -- 大きな干し草の山から複数の定数文字列を検索する機能を追加しました: `multiPosition`, `multiSearch` ,`firstMatch` また `-UTF8`, `-CaseInsensitive`、と `-CaseInsensitiveUTF8` バリアント。 [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) -- 未使用の破片の切り取ること `SELECT` シャーディングキーによるクエリフィ `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [イワン](https://github.com/abyss7)) -- 許可 `Kafka` エンジンを無視するいくつかの構文解析誤りのブロックです。 [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([イワン](https://github.com/abyss7)) -- のサポートを追加 `CatBoost` マルチクラスモデルの評価。 機能 `modelEvaluate` マルチクラスモデルのクラスごとの生の予測を持つタプルを返します。 `libcatboostmodel.so` で構築する必要があります [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 機能追加 `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) -- ハッシュ機能を追加 `xxHash64` と `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([フィリモノフ](https://github.com/filimonov)) -- 追加 `gccMurmurHash` 同じハッシュシードを使用するハッシュ関数(GCC風味のつぶやきハッシュ) [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) -- ハッシュ機能を追加 `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) -- テーブル機能を追加 `remoteSecure`. 機能として動作 `remote` しかし、安全な接続を使用しています。 [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) - -#### 実験の特徴 {#experimental-features-3} - -- 複数の結合エミュレーションを追加 (`allow_experimental_multiple_joins_emulation` 設定)。 [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) - -#### バグ修正 {#bug-fixes-21} - -- 作る `compiled_expression_cache_size` 設定により限定のデフォルトの低メモリを消費する。 [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) -- レプリケートされたテーブルの変更を実行するスレッドと、zookeeperから設定を更新するスレッドのバグを修正しました。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) -- 分散alterタスクを実行する際の競合状態を修正しました。 レース条件以上のレプリカを実行しようとしたところ、すべてのレプリカのものを除く失敗との飼育係エラーになります。 [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) -- 次の場合にバグを修正する `from_zk` config要素はないのにリフレッシュした後、求め飼育係わる。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) -- IPv4サブネッ [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) -- 固定クラッシュ (`std::terminate`)まれに、リソースが枯渇したために新しいスレッドを作成できない場合。 [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ときにバグを修正 `remote` 間違った制限がinに使用されたときのテーブル関数の実行 `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) -- Netlinkソケットのリークを修正します。 これらのソケットはプール内に置かれ、削除されることはなく、現在のすべてのソケットが使用されているときに、新しいソケットが新しいスレッド [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) -- 閉じるとバグを修正 `/proc/self/fd` すべてのfdsが読み込まれたディレクトリ `/proc` フォーク後 `odbc-bridge` サブプロセス。 [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) -- 主キーの使用文字列の場合にはuint単調変換するための固定文字列。 [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([冬張](https://github.com/zhang2014)) -- 整数変換関数の単調性の計算におけるエラーを修正しました。 [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定segfaultで `arrayEnumerateUniq`, `arrayEnumerateDense` いくつかの無効な引数の場合の関数。 [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- StorageMergeでUBを修正. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([アモスの鳥](https://github.com/amosbird)) -- 機能の固定segfault `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定エラー:機能 `round`, `floor`, `trunc`, `ceil` を返すことが偽の結果が実行される整数の引数と大きな負のです。 [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- によって誘導されるバグを修正 ‘kill query sync’ これはコアダンプにつながります。 [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) -- のを修正した。長の遅延の後に空の複製します。 [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) -- テーブルに挿入する場合の過度のメモリ使用量を修正しました `LowCardinality` 主キー。 [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 固定 `LowCardinality` のためのシリアル化 `Native` 空の配列の場合の形式。 [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 単一のlowcardinality数値列によってdistinctを使用している間、不正な結果を修正しました。 [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 低カーディナリティキーを使用した特殊な集計を修正しました(以下の場合 `compile` 設定が有効になっています)。 [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 固定ユーザとパスワードを転送のための複製のテーブルのクエリ. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) -- 固定非常に珍しい競合状態とされるようにすることが一覧表の辞書データベースをリロードを生成する事ができます。 [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ロールアップまたはcubeで使用されたときの不正な結果を修正しました。 [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([サム-チョウ](https://github.com/reflection)) -- クエリの固定列エイリアス `JOIN ON` 構文と分散テーブル。 [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([冬張](https://github.com/zhang2014)) -- の内部実装における固定エラー `quantileTDigest` (アルテムVakhrushevによって発見)。 このエラーはClickHouseでは決して起こらず、ClickHouseコードベースをライブラリとして直接使用する人にのみ関連していました。 [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 改善 {#improvements-6} - -- のサポート `IF NOT EXISTS` で `ALTER TABLE ADD COLUMN` と一緒に文 `IF EXISTS` で `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) -- 機能 `parseDateTimeBestEffort`:形式のサポート `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` と似ています。 [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CapnProtoInputStream` 今サポートギザギザの構造。 [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) -- ユーザビリティ向上に追加チェックがサーバプロセスからのデータディレクトリはオーナーを想定しています。 できない開始のサーバーからのルートデータが得られない場合には所属非rootユーザーです。 [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-v-galtsev](https://github.com/sergey-v-galtsev)) -- 結合によるクエリの分析中に必要な列をチェックするロジックの改善。 [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) -- 単一のサーバーに多数の分散テーブルがある場合の接続数を減らしました。 [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([冬張](https://github.com/zhang2014)) -- サポートされている合計行 `WITH TOTALS` ODBCドライバのクエリ。 [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) -- 使用を許可する `Enum`関数の中の整数としてのs。 [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([イワン](https://github.com/abyss7)) -- 追加 `low_cardinality_allow_in_native_format` 設定。 無効の場合は、使用しないでください `LowCadrinality` タイプイン `Native` フォーマット。 [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 削除の冗長化物からの集計表現のキャッシュの低メモリ使用量 [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) -- チェックを追加する `SET send_logs_level = 'value'` クエリーを受け適切な値です。 [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) -- タイプ変換関数で固定されたデータ型のチェック。 [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([冬張](https://github.com/zhang2014)) - -#### 性能の改善 {#performance-improvements-5} - -- マージツリー設定の追加 `use_minimalistic_part_header_in_zookeeper`. 有効になっている場合、複製のテーブル店舗のコンパクト部分のメタデータの一部znode. これは著しく低下するので、飼育係スナップショットサイズ(場合には、あらゆるテーブルのカラム). この設定を有効にすると、それをサポートしていないバージョンにダウングレードすることはできません。 [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) -- Dfaベースの関数の実装を追加します。 `sequenceMatch` と `sequenceCount` patternに時間が含まれていない場合。 [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- 整数のシリアル化のパフォーマンスの向上。 [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([アモスの鳥](https://github.com/amosbird)) -- Zero left padding PODArrayので、-1要素は常に有効でゼロになります。 これは、オフセットの分岐のない計算に使用されます。 [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([アモスの鳥](https://github.com/amosbird)) -- 元に戻す `jemalloc` パフォーマン [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 下位互換性のない変更 {#backward-incompatible-changes-2} - -- 文書化されていない機能を削除 `ALTER MODIFY PRIMARY KEY` それがによって取って代わられたので `ALTER MODIFY ORDER BY` 司令部 [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) -- 削除機能 `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- タイプの結果を持つスカラーサブクエリの使用を禁止する `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([イワン](https://github.com/abyss7)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvements-6} - -- PowerPCのサポートを追加 (`ppc64le`)ビルド. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) -- ステートフル機能試験を実般に利用可能データセットである。 [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- サーバーが起動できない場合のエラーを修正しました `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` Dockerまたはsystemd-nspawn内のメッセージ。 [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 更新 `rdkafka` v1.0.0-RC5へのライブラリ。 生のCインターフェイスの代わりにcppkafkaを使用します。 [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([イワン](https://github.com/abyss7)) -- 更新 `mariadb-client` ライブラリ。 UBSanで見つかった問題のいずれかを修正しました。 [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- UBSanビルドのいくつかの修正。 [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- UBSanビルドによるテストのコミットごとの実行を追加しました。 -- PVS-Studio static analyzerのコミットごとの実行を追加しました。 -- PVS-Studioによって発見されたバグを修正しました。 [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定glibc互換性の問題。 [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Dockerイメージを18.10に移動し、glibc\>=2.28の互換性ファイルを追加します [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) -- 追加環境変数の場合はユーザーを行わないchownディレクトリをサーバー dockerイメージです。 [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) -- からの警告のほとんどを有効に `-Weverything` クラングで。 有効 `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 唯一のクラングで利用可能ないくつかのより多くの警告を追加しました8. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- リンク先 `libLLVM` 共有リンクを使用する場合は、個々のLLVMライブラリではなく。 [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) -- テスト画像のための追加された消毒剤の変数。 [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) -- `clickhouse-server` debianパッケージは `libcap2-bin` 使用するパッケージ `setcap` 機能を設定するためのツール。 これは任意です。 [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 改善されたコンパイル時間、固定includesむ。 [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) -- ハッシュ関数のパフォーマンステス [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([フィリモノフ](https://github.com/filimonov)) -- 固定巡回ライブラリ依存。 [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) -- 低利用可能なメモリとコンパイルの改善。 [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) -- 追加試験スクリプトの再現性能の劣化 `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 下のコメントや文字列リテラルのスペルミスを修正 `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([マイハー](https://github.com/maiha)) -- コメントの誤字を修正しました。 [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) - -## [2018年の変更履歴](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/ja/whats_new/changelog/index.md b/docs/ja/whats_new/changelog/index.md deleted file mode 100644 index 0d90862ee11..00000000000 --- a/docs/ja/whats_new/changelog/index.md +++ /dev/null @@ -1,668 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: d734a8e46ddd7465886ba4133bff743c55190626 -toc_folder_title: Changelog -toc_priority: 74 -toc_title: '2020' ---- - -## ClickHouseリリースv20.3 {#clickhouse-release-v20-3} - -### ClickHouseリリリースv20.3.4.10,2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} - -#### バグ修正 {#bug-fix} - -- このリリースも含む全てのバグ修正から20.1.8.41 -- 不足している修正 `rows_before_limit_at_least` プロセッサパイプラインを使用したhttpクエリの場合。 この修正 [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### ClickHouseリリリースv20.3.3.6,2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} - -#### バグ修正 {#bug-fix-1} - -- このリリースも含む全てのバグ修正から20.1.7.38 -- ユーザーが以前のバージョンで突然変異を実行した場合、複製が機能しないレプリケーションのバグを修正しました。 この修正 [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). こ版20.3後方互換。 -- 設定を追加 `use_compact_format_in_distributed_parts_names` これにより、 `INSERT` へのクエリ `Distributed` よりコンパクトな形式のテーブル。 この修正 [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). こ版20.3後方互換。 - -### ClickHouseリリリースv20.3.2.1,2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} - -#### 下位互換性のない変更 {#backward-incompatible-change} - -- 問題を修正しました `file name too long` データを送信するとき `Distributed` 多数のレプリカのテーブル。 レプリカの資格情報がサーバーログに表示される問題を修正しました。 ディスク上のディレクトリ名の形式が `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb))新しいバージョンにアップグレードした後、古いサーバーのバージョンが新しいディレクトリ形式を認識しないため、手動の介入なしにダウングレードするこ ダウングレードする場合は、対応するディレクトリの名前を手動で古い形式に変更する必要があります。 この変更は、非同期を使用した場合にのみ関連します `INSERT`にs `Distributed` テーブル。 バージョン20.3.3では、新しいフォーマットを徐々に有効にするための設定を紹介します。 -- 変更コマンドのレプリケーションログエントリの形式を変更。 新しいバージョンをイ -- Stacktracesをダンプするシンプルなメモリプロファイラを実装する `system.trace_log` 毎N文字以上のソフト配分を制限 [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([イワン](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov))の列 `system.trace_log` から改名されました `timer_type` に `trace_type`. この変更が必要な第三者機関の性能解析およびflamegraph処理ツールです。 -- 内部スレッド番号の代わりにosスレッドidを使用します。 この修正 [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) 古い `clickhouse-client` サーバーから送信されるログを受信できない `send_logs_level` これは、構造化ログメッセージの名前と種類が変更されたためです。 一方、異なるサーバーバージョンでは、異なるタイプのログを相互に送信できます。 あなたが使用しないとき `send_logs_level` 設定、あなたは気にしないでください。 [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 削除 `indexHint` 機能 [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 削除 `findClusterIndex`, `findClusterValue` 機能。 この修正 [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). これらの機能を使用していた場合は、メールを送信します `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- これで、列を作成したり、列を追加したりすることはできません `SELECT` 既定の式としてサブクエリ。 [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) -- JOIN内のサブクエリのエイリアスが必要です。 [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) -- 改善された `ALTER MODIFY/ADD` クエリロジック。 今はできません `ADD` タイプのない列, `MODIFY` デフォルトの式では、列の型は変更されません。 `MODIFY` 型は既定の式の値を緩めません。 修正 [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) -- ログ設定の変更を適用するには、サーバーを再起動する必要があります。 これは、サーバーが削除されたログファイルにログを記録するバグを回避するための一時的な回避策です。 [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- を設定 `experimental_use_processors` デフォルトでは有効です。 この設定をご利用の新しいクエリのパイプライン これは内部リファクタリングであり、目に見える変更は期待していません。 問題が表示される場合は、ゼロをバックアップするように設定します。 [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 新しい機能 {#new-feature} - -- 追加 `Avro` と `AvroConfluent` 入力/出力形式 [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 期限切れのキーのマルチスレッドおよび非ブロック更新 `cache` 辞書(古いものを読むための任意の許可を持つ)。 [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- クエリの追加 `ALTER ... MATERIALIZE TTL`. TTLによって期限切れのデータを強制的に削除し、すべての部分でTTLに関するメタ情報を再計算する突然変異を実行します。 [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 必要に応じて、hashjoinからmergejoin(ディスク上)に切り替えます [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加 `MOVE PARTITION` コマンド `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 設定ファイルからストレージ設定をリロードする。 [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 変更できる `storage_policy` あまり豊かではないものに。 [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) -- S3ストレージとテーブル機能のglobs/wildcardsのサポートを追加しました。 [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 実装 `bitAnd`, `bitOr`, `bitXor`, `bitNot` のために `FixedString(N)` データ型。 [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 機能追加 `bitCount`. この修正 [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ikopylov](https://github.com/ikopylov)) -- 追加 `generateRandom` テーブル機能をランダム行に指定されたschema. 任意のテストテーブルにデータを設定できます。 [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([イリヤ-ヤツィシン](https://github.com/qoega)) -- `JSONEachRowFormat` 支援特別の場合オブジェ囲まれたトップレベルの配列になります。 [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) -- これで、列を作成することができます `DEFAULT` デフォルトの列に依存する式 `ALIAS` 式。 [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) -- 指定できるようにする `--limit` ソースデータサイズよりも `clickhouse-obfuscator`. データは異なるランダムシードで繰り返されます。 [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `groupArraySample` 機能(に類似した `groupArray` とreserviorサンプリングアルゴリズムです。 [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([アモスの鳥](https://github.com/amosbird)) -- これで、更新キューのサイズを監視することができます `cache`/`complex_key_cache` システム指標による辞書。 [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- CSV出力形式の行区切りとしてCRLFを使用できるようにする `output_format_csv_crlf_end_of_line` は1に設定されます [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) -- より多くの機能を実装する [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` と `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([ニコ-マンデリー](https://github.com/nmandery)) -- 新しい設定を導入: `max_parser_depth` 最大スタックサイズを制御し、大規模な複雑なクエリを許可する。 この修正 [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) と [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) -- 設定を追加する `force_optimize_skip_unused_shards` 未使用のシャードをスキップできない場合にスローする設定 [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) -- この設定は複数のディスク/量のデータを格納するための送付 `Distributed` エンジン [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) -- 支援の保管方針 (``)一時的なデータを貯えるため。 [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) -- 追加 `X-ClickHouse-Exception-Code` データを送信する前に例外がスローされた場合に設定されるHTTPヘッダー。 これは [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) -- 機能追加 `ifNotFinite`. それは単なる統語的な砂糖です: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `last_successful_update_time` コラムの `system.dictionaries` テーブル [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- 追加 `blockSerializedSize` 機能(圧縮なしのディスク上のサイズ) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) -- 機能を追加 `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) -- 追加されたシステム表 `system.zeros` と `system.zeros_mt` だけでなく、物語機能 `zeros()` と `zeros_mt()`. テーブル(テーブル機能を含む単一カラム名 `zero` とタイプ `UInt8`. この列にはゼロがあります。 これは、多くの行を生成する最速の方法としてテスト目的に必要です。 この修正 [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### 実験的特徴 {#experimental-feature} - -- 部品の新しいコンパクトな形式を追加 `MergeTree`-すべての列が一つのファイルに格納されている家族のテーブル。 それは小さく、頻繁な挿入物の性能を高めるのを助ける。 古いフォーマット(列ごとに一つのファイル)がwideと呼ばれます。 データ格納形式は設定によって制御 `min_bytes_for_wide_part` と `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([アントン-ポポフ](https://github.com/CurtizJ)) -- S3ストレージのサポート `Log`, `TinyLog` と `StripeLog` テーブル。 [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) - -#### バグ修正 {#bug-fix-2} - -- ログメッセージの不整合な空白を修正しました。 [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- テーブル作成時に、名前のないタプルの配列がネストされた構造としてフラット化されたバグを修正。 [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2comment](https://github.com/achulkov2)) -- ときに問題を修正しました “Too many open files” エラーが発生する恐れがあると多数の場合はファイルのマッチングglobパターン `File` テーブルまたは `file` テーブル機能。 今すぐファイルが遅延開かれます。 この修正 [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- DROP TEMPORARY TABLEは現在、一時テーブルのみを削除します。 [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) -- 削除した旧式の仕切りした時停止のサーバーは取り外し、添付を表示します。 [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- のためにどのようにデフォルトのディスクを算定し、自由空間から `data` サブディレクトリ。 空き容量が正しく計算されない場合の問題を修正しました。 `data` ディレクト この修正 [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) -- カンマ(クロス)は、内部の()に参加することができます。 [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) -- WHERE節に演算子のようなものがある場合は、INNER JOINにクロスを書き換えることができます。 [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) -- 後に可能な誤った結果を修正 `GROUP BY` 有効に設定 `distributed_aggregation_memory_efficient`. 修正 [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 見つかりキーのカウントとして見るメトリクスのキャッシュを生成する事ができます。 [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- レプリケーションプロト [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -- 上の固定レース条件 `queue_task_handle` の起動時に `ReplicatedMergeTree` テーブル。 [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- その他の通貨 `NOT` で動作しませんでした `SHOW TABLES NOT LIKE` クエリ [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 機能に範囲チェックを追加しました `h3EdgeLengthM`. このチェッ [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 複数の引数(10以上)の三元論理演算のバッチ計算のバグを修正しました。 [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) -- Prewhere最適化のエラーを修正しました。 `Inconsistent number of columns got from MergeTreeRangeReader` 例外だ [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 予期しない修正 `Timeout exceeded while reading from socket` 例外は、ランダムに起きにセキュア接続前にタイムアウト実を超えた場queryプロファイラが有効になります。 また、追加 `connect_timeout_with_failover_secure_ms` 設定(デフォルトは100ミリ秒)です。 `connect_timeout_with_failover_ms` ただし、セキュアな接続に使用されます(SSLハンドシェイクが通常のTCP接続よりも遅いため) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) -- バグを修正しました。 `parts_to_do=0` と `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) -- 新しい任意の結合ロジックを使用する `partial_merge_join` 設定。 それは作ることが可能です `ANY|ALL|SEMI LEFT` と `ALL INNER` との結合 `partial_merge_join=1` 今だ [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) -- シャードは、例外をスローするのではなく、イニシエータから取得した設定をシャードのconstaintsにクランプします。 この修正では、別の制約を持つシャードにクエリを送信できます。 [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) -- 固定メモリ管理の問題 `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修正 `toDecimal*OrNull()` 文字列で呼び出されたときの関数群 `e`. 修正 [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) -- う `FORMAT Null` クライアントにデータを送信しません。 [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- そのタイムスタンプを修正 `LiveViewBlockInputStream` 更新されません。 `LIVE VIEW` 実験的特徴です [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) -- 固定 `ALTER MODIFY TTL` 古いTTL式を削除することを許さなかった誤った動作。 [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) -- MergeTreeIndexSet内のUBSanレポートを修正しました。 この修正 [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- の動作を修正しました `match` と `extract` haystackにゼロバイトがある場合の関数。 Haystackが一定の場合、その動作は間違っていました。 この修正 [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Apache Avro3rd-partyライブラリのデストラクターから投げを避けます。 [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) -- ポーリングされたバッチをコミットしない `Kafka` 部分的には、データの穴につながる可能性があります。 [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([フィリモノフ](https://github.com/filimonov)) -- 修正 `joinGet` null可能な戻り値の型を指定します。 https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([アモスの鳥](https://github.com/amosbird)) -- 圧縮時にデータの非互換性を修正する `T64` コーデック。 [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2))データ型idの修正 `T64` 影響を受けるバージョンで間違った(de)圧縮につながる圧縮コーデック。 [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) -- 設定を追加 `enable_early_constant_folding` 無効にするのである。 [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正プッシュダウ述語オプティマイザとビューの試験 [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([冬張](https://github.com/zhang2014)) -- Segfaultを修正する `Merge` から読み取るときに発生する可能性があります `File` ストレージ [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) -- ストレージポリシーのチェックを追加 `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. そうでない場合はこのデータの一部になり、再起動後の防止ClickHouse。 [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) -- テーブルにttlが設定されている場合に変更を修正します。 [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([アントン-ポポフ](https://github.com/CurtizJ)) -- ときに発生する可能性が競合状態を修正 `SYSTEM RELOAD ALL DICTIONARIES` いくつかの辞書が変更/追加/削除されている間に実行されます。 [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) -- 以前のバージョンでは `Memory` データベースエンジ `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) -- デフォル [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 配列型のbloom\_filterインデックスのnot(has())を修正しました。 [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbabcomment](https://github.com/achimbab)) -- テーブルの最初の列を許可する `Log` エンジンは別名である [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([イワン](https://github.com/abyss7)) -- から読み込み中の範囲の順序を修正 `MergeTree` 一つのスレッドのテーブル。 それは例外につながる可能性があります `MergeTreeRangeReader` または間違ったクエリ結果。 [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 作る `reinterpretAsFixedString` 戻るには `FixedString` 代わりに `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) -- を避ける非常に珍しい場合には、ユーザーで間違ったエラーメッセージ (`Success` 詳細なエラーの説明の代わりに)。 [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 使用するとき衝突しないで下さい `Template` 空の行テンプレートを使用した形式。 [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- システムテーブルのメタデータファイ [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix))修正 [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). -- キャッシュ辞書でexception\_ptrのデータレースを修正 [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- クエリの例外をスローしない `ATTACH TABLE IF NOT EXISTS`. 以前は、テーブルが既に存在する場合にスローされました。 `IF NOT EXISTS` 句。 [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 例外メッセージで行方不明の閉じる括弧を修正しました。 [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- メッセージの回避 `Possible deadlock avoided` インタラクティブモードでのclickhouse-クライアントの起動時に。 [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Base64でエンコードされた値の末尾にパディングが不正な形式になる場合がある問題を修正しました。 更新base64ライブラリ。 この修正 [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491)、閉じます [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- データを失うのを防ぐ `Kafka` まれに、接尾辞を読んだ後でコミットする前に例外が発生した場合。 修正 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([フィリモノフ](https://github.com/filimonov)) -- 固定例外で `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) -- ユーザーが `ALTER MODIFY SETTING` 古いformatedのため `MergeTree` テーブルエンジン家族。 [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -- JSON関連の関数でInt64に収まらないUInt64の数値のサポート。 SIMDJSONをmasterに更新します。 この修正 [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 非厳密に単調な関数索引が使用されている場合の逆述語の実行を修正しました。 [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) -- 折ることを試みてはいけない `IN` 定数の `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([アモスの鳥](https://github.com/amosbird)) -- バグを修正 `ALTER DELETE` インデックスの破損につながる変異。 この修正 [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) と [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). さらに、非常にまれな競合状態を修正 `ReplicatedMergeTree` `ALTER` クエリ。 [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) -- ときは設定 `compile_expressions` が有効になっている場合は、 `unexpected column` で `LLVMExecutableFunction` 私達が使用する時 `Nullable` タイプ [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 以下のための複数の修正 `Kafka` エンジン:1)消費者グループのリバランス中に表示された重複を修正します。 2)修正レア ‘holes’ 登場時のデータをポーリングから割と世論調査および為の一部(現在の私たちは常にプロセス/コミット全体のポーリングブロックメッセージ). 3)固定フラッシュによるブロックサイズ(前のみにフラッシングによるタイムアウトした作業と同様に扱う。 4)より契約手続(入力フィードバック. 5)テストをより速く動作させる(デフォルトの間隔とタイムアウト)。 データは以前はブロックサイズでフラッシュされていなかったため(ドキュメントによると)、PRはデフォルト設定でパフォーマンスが低下する可能性 その変更後にパフォーマンスの問題が発生した場合-増加してください `kafka_max_block_size` より大きな値へのテーブル(例えば `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). 修正 [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([フィリモノフ](https://github.com/filimonov)) -- 修正 `Parameter out of bound` PREWHERE最適化の後のいくつかのクエリの例外。 [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) -- 関数の引数の混合constの場合を修正しました `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 実行時期 `CREATE` クエリー、倍定表現のストレージエンジンの引数です。 空のデータベース名を現在のデータベ 修正 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) -- 次のような単純な循環エイリアスを持つ列を作成または追加することはできません `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -- 元の部分が破損する可能性があるダブル移動のバグを修正しました。 これは、 `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 許可 `interval` バッククォートなしで正しく解析する識別子。 場合でも、クエリを実行できない問題を修正しました。 `interval` 識別子は、バッククォートまたは二重引用符で囲まれています。 この修正 [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定ファズテストとの不正な動作 `bitTestAll`/`bitTestAny` 機能。 [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 可能なクラッシュ/間違った行数を修正 `LIMIT n WITH TIES` n行目に等しい行がたくさんあるとき。 [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -- Enabledで書かれたパーツによる修正 `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) -- の破壊でデータレースを修正 `Poco::HTTPServer`. どこの場合のサーバを起動直ちに停止しております。 [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 実行中に誤解を招くエラーメッセージが表示されたバグを修正 `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2comment](https://github.com/achulkov2)) -- 固定 `Parameters are out of bound` 私たちが定数を持っているいくつかのまれなケースでは例外 `SELECT` 私たちが持っているときの句 `ORDER BY` と `LIMIT` 句。 [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 既に完了した突然変異がステータスを持つことができるとき `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) -- 実行を防ぐ `ALTER ADD INDEX` 古い構文のMergeTreeテーブルでは、動作しないためです。 [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) -- サーバーの起動中にテーブルにアクセスしない。 `LIVE VIEW` 依存するので、サーバーは起動できます。 また、削除 `LIVE VIEW` デタッチ時の依存関係 `LIVE VIEW`. `LIVE VIEW` 実験的特徴です [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) -- で可能なsegfaultを修正 `MergeTreeRangeReader`,実行中 `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 列ttlsによるチェックサムの不一致を修正しました。 [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([アントン-ポポフ](https://github.com/CurtizJ)) -- ボリュームが一つしかない場合にttlルールによってパーツがバックグラウンドで移動されないバグを修正しました。 [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 問題を修正しました `Method createColumn() is not implemented for data type Set`. この修正 [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 今度は、突然変異をより頻繁に確定しようとします。 [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -- 修正 `intDiv` マイナス一つの定数による [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) -- 可能な競合状態を修正 `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- のを修正した。先サーバを終了しようとした場合に使用/drop `Kafka` テーブル作成されたパラメータ。 [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([フィリモノフ](https://github.com/filimonov)) -- OSが間違った結果を返す場合の回避策を追加 `timer_create` 機能。 [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- の使用で修正されたエラー `min_marks_for_seek` パラメータ。 固定のエラーメッセージがない場合shardingキーテーブルの配布に努めのスキップ未使用の破片. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) - -#### 改善 {#improvement} - -- 実装 `ALTER MODIFY/DROP` 以下のための突然変異の上にクエリ `ReplicatedMergeTree*` エンジンファミリー さて `ALTERS` メタデータ更新ステージでのみブロックし、その後はブロックしません。 [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) -- 内部結合にcrossを書き換える機能を追加する `WHERE` シリアル化されていない名前のセクション。 [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) -- 作る `SHOW TABLES` と `SHOW DATABASES` クエリは、 `WHERE` 式と `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) -- 設定を追加しました `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) -- 最近の変更後、mysqlクライアントはバイナリ文字列をhexで印刷し始め、読みにくくなりました ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). ClickHouseの回避策は、文字列の列をUTF-8としてマークすることです。 [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([ユーリーバラノフ](https://github.com/yurriy)) -- 文字列とfixedstringキーのサポートを追加する `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) -- SummingMergeTreeマップでの文字列キーのサポート [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) -- スレッドが例外をスローした場合でも、スレッドプールへのスレッドの信号終端 [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([丁象飛](https://github.com/dingxiangfei2009)) -- 設定を許可する `query_id` で `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 奇妙な表現を許可しない `ALTER TABLE ... PARTITION partition` クエリ。 このアドレス [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- テーブル `system.table_engines` 機能のサポートに関する情報を提供します `supports_ttl` または `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) -- 有効 `system.metric_log` デフォルトでは。 これには、ProfileEventsの値を持つ行が含まれます。 “collect\_interval\_milliseconds” 間隔(デフォルトでは秒)。 テーブルは非常に小さく(通常はメガバイトの順で)、デフォルトでこのデータを収集することは妥当です。 [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([イワン](https://github.com/abyss7)) -- 今すぐ一時的 `LIVE VIEW` によって作成されます `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` 代わりに `CREATE TEMPORARY LIVE VIEW ...` 前の構文は、次の構文と一致していなかったためです `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) -- Text\_logを追加します。行くエントリを制限するレベル構成パラメータ `system.text_log` テーブル [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) -- を入れてダウンロード部にディスク/量によるttlル [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 外部mysqlディクショナリの場合、mysql接続プールをmutualizeすることができます “share” それらの間で辞書。 このオプションは、MySQLサーバーへの接続数を大幅に削減します。 [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- 最も近いクエリの実行時間内の変位値を表示する `clickhouse-benchmark` 内挿された値の代わりに出力します。 いくつかのクエリの実行時間に対応する値を表示する方がよいでしょう。 [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kafkaにデータを挿入するときにメッセージのキーとタイムスタンプを追加する可能性。 修正 [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([フィリモノフ](https://github.com/filimonov)) -- 場合はサーバはターミナルから、ハイライトのスレッド号、クエリをidでログインを優先する色をします。 ここは改善の可読性の相関のログメッセージのステータスです。 [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より良い例外のメッセージ読み込み中にテーブル `Ordinary` データベース [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 実装 `arraySlice` 集約関数の状態を持つ配列の場合。 この修正 [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- IN演算子の右側で定数関数と定数配列を使用できます。 [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([アントン-ポポフ](https://github.com/CurtizJ)) -- システムのデータを取得している間にzookeeperの例外が発生した場合。レプリカは、別の列に表示します。 これは [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](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) ([Mikhail Korotov](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) ([alexey-milovidov](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)) -- 追加された列 `exception_code` で `system.query_log` テーブル。 [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) -- ポート上の有効mysql互換性サーバ `9004` デフォルトのサーバー設定ファイル。 設定の例の固定パスワード生成コマンド。 [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([ユーリーバラノフ](https://github.com/yurriy)) -- 防止に停止した場合のファイルシステムが読み取り専用になります。 この修正 [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- HTTP POSTクエリで長さが必要な場合は、より良い例外メッセージ。 [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `_path` と `_file` 仮想列へ `HDFS` と `File` エンジンと `hdfs` と `file` テーブル関数 [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) -- エラーの修正 `Cannot find column` 挿入している間 `MATERIALIZED VIEW` 新しい列がビューの内部テーブルに追加された場合。 [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- ネイティブクライアントサーバープロトコルを介して、最終更新後の送信の進行状況を修正(ログなど)。 この問題にのみ一部の第三者ツールを使用するネイティブプロトコルです。 [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) -- 追加システムの指標を追跡する多数のクライアント接続の待機を開始mysqlを使用してプロトコル ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) -- これからは、httpレスポンスには `X-ClickHouse-Timezone` 同じタイムゾーン値に設定されたヘッダ `SELECT timezone()` 報告する [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) - -#### 性能向上 {#performance-improvement} - -- INとの指標の分析のパフォーマンスを向上させる [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 論理関数+コードのクリーンアップで、よりシンプルで効率的なコード。 フォローアップへ [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) -- 全体的なパフォーマンスの向上(5%の範囲で。.200%の影響のクエリをもっと厳しいエイリアシングとc++20特徴です。 [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([アモスの鳥](https://github.com/amosbird)) -- 比較関数の内部ループのためのより厳密なエイリアシング。 [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 算術関数の内部ループのより厳密なエイリアシング。 [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ColumnVector::replicate()の実装は、ColumnConst::convertToFullColumn()が実装されています。 また、定数を具体化する際のテストにも役立ちます。 [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) -- 別のマイナーな性能向上へ `ColumnVector::replicate()` (これは `materialize` 機能および高位機能)へのそれ以上の改善 [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) -- 改善された性能の `stochasticLinearRegression` 集計関数。 このパッチはIntelによって提供されます。 [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 性能をの改善して下さい `reinterpretAsFixedString` 機能。 [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ブロックをクライアントに送信しない `Null` フォーマットプロセッサのパイプライン [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement} - -- 例外処理は現在、linux用のwindowsサブシステム上で正しく動作します。 見るhttps://github.com/clickhouse-extras/libunwind/pull/3 この修正 [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) -- 置換 `readline` と `replxx` インタラクティブライン編集 `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([イワン](https://github.com/abyss7)) -- FunctionsComparisonでより良いビルド時間と少ないテンプレートインスタンス化。 [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- との統合を追加しました `clang-tidy` CIで。 また見なさい [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 今、私たちはリンクを使用して、ciでclickhouse `lld` のために `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) -- するとランダムスレッドのスケジューリングに挿入しな障害の場合 `THREAD_FUZZER_*` 環境変数が設定されます。 これはテストを助ける。 [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ステートレステストでsecure socketsを有効にす [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) -- SPLIT\_SHARED\_LIBRARIES=OFFをより堅牢にする [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) -- 作る “performance\_introspection\_and\_logging” 試験信頼性の高いランダムにサーバーの付かない。 これはCI環境で発生する可能性があります。 また見なさい [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- スタイルチェックでxmlを検証する。 [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- テストの競合状態を修正 `00738_lock_for_inner_table`. このテストは睡眠に頼った。 [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 除去性能試験の種類 `once`. このに必要なすべての性能試験の統計比較モード(信頼性の高い). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 算術関数のパフォーマンステストを追加。 [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- のための追加された性能試験 `sumMap` と `sumMapWithOverflow` 集計関数。 フォローアップのための [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 確保のスタイルerrorcodesスタイルにチェック。 [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加スクリプトのための試験。 [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) -- GCC警告を追加する `-Wsuggest-override` すべての場所を見つけて修正するには `override` キーワー [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Mac OS Xの下で弱い記号を無視するのは、定義する必要があるためです [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([削除されたユーザ](https://github.com/ghost)) -- パフォーマンステストでの一部のクエリの実行時間の正規化。 この準備の性能試験との比較モードになります。 [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- クエリテストでpytestをサポートするテストを修正 [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([イワン](https://github.com/abyss7)) -- をsslの構築とmsan、サーバーな起動時に走行時の状態試験 [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) -- テスト結果でのデータベース置換の修正 [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([イリヤ-ヤツィシン](https://github.com/qoega)) -- の構築に対する修正その他ー [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) -- 追加ディスク部無国籍-と-カバレッジ-テストdocker画像 [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) -- GRPCでビルドするときに、ソースツリー内のファイルを取り除く [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([アモスの鳥](https://github.com/amosbird)) -- 少し早く構築時間を取り除いsessioncleanerからのコンテキスト sessioncleanerのコードをよりシンプルにする。 [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Clickhouseテストスクリプトでハングクエリのチェックを更新 [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) -- リポジトリか [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- から数学perftestsの変更タイプ `once` に `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 追加docker画像を構築ィコードのブラウザのhtmlレポート当社のコードベース. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin))見る [Woboqコードブラウザ](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) -- MSanの下でいくつかのテストの失敗を抑制. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- スピードアップ “exception while insert” テスト。 このテス [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 更新 `libcxx` と `libcxxabi` マスターに。 準備のために [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- フラッキーテストの修正 `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 清掃は複製リンカのフラグがあります。 リンカーが予期しないシンボルを検索しないことを確認します。 [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([アモスの鳥](https://github.com/amosbird)) -- 追加 `clickhouse-odbc` テスト画像にドライバ。 これは、独自のODBCドライバを経由してClickHouseとClickHouseの相互作用をテストすることができます。 [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([フィリモノフ](https://github.com/filimonov)) -- 単体テストでいくつかのバグを修正。 [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) -- 有効 `-Wmissing-include-dirs` CMakeスクリプトエラーの結果として、すべての既存のインクルードを排除するGCC警告 [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- クエリプ これは [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Opensslを上流のマスターに更新します。 メッセージでTLS接続が失敗する問題を修正しました `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` と `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. この問題はバージョン20.1に存在していました。 [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- サーバーのdockerfileの更新 [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) -- ビルド-gcc-from-sourcesスクリプトのマイナーな修正 [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) -- 置換 `numbers` に `zeros` どこperftestsで `number` 列は使用されません。 これはよりきれいなテスト結果につながります。 [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 固定しスタックオーバーフローされる際に問題が起きた場合、利用initializer\_list列コンストラクタ. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([削除されたユーザ](https://github.com/ghost)) -- Libdkafkaをv1.3.0にアップグレードします。 バンドル有効 `rdkafka` と `gsasl` Mac OS X上のライブラリ [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) -- GCC9.2.0でのビルド修正 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) - -## ClickHouseリリースv20.1 {#clickhouse-release-v20-1} - -### ClickHouseリリリースv20.1.8.41,2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} - -#### バグ修正 {#bug-fix-3} - -- 可能永久修正 `Cannot schedule a task` エラー(ハンドルされていない例外が原因で `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). この修正 [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) -- 過度のメモリ消費を修正 `ALTER` クエリ(突然変異)。 この修正 [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) と [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) -- 外部辞書のddlにバッククォートのバグを修正しました。 この修正 [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) - -### ClickHouseリリリースv20.1.7.38,2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} - -#### バグ修正 {#bug-fix-4} - -- 固定誤った内部関数名のための `sumKahan` と `sumWithOverflow`. 先頭に立って例外がこの機能をリモートます。 [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). この問題はすべてClickHouseのリリースにありました。 -- 許可 `ALTER ON CLUSTER` の `Distributed` 内部レプリケーショ この修正 [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([品生2](https://github.com/shinoi2)). この問題はすべてClickHouseのリリースにありました。 -- 可能な例外を修正 `Size of filter doesn't match size of column` と `Invalid number of rows in Chunk` で `MergeTreeRangeReader`. 実行中に表示される可能性があります `PREWHERE` いくつかのケースでは。 修正 [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 次のような単純な算術式を書くと、タイムゾーンが保持されないという問題を修正しました `time + 1` (次のような表現とは対照的に `time + INTERVAL 1 SECOND`). この修正 [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). この問題はすべてClickHouseのリリースにありました。 -- 次のような単純な循環エイリアスを持つ列を作成または追加することはできません `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -- Base64でエンコードされた値の末尾にパディングが不正な形式になる場合がある問題を修正しました。 更新base64ライブラリ。 この修正 [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491)、閉じます [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- の破壊でデータレースを修正 `Poco::HTTPServer`. どこの場合のサーバを起動直ちに停止しております。 [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 可能なクラッシュ/間違った行数を修正 `LIMIT n WITH TIES` n行目に等しい行がたくさんあるとき。 [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -- 列ttlsによるチェックサムの不一致を修正しました。 [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([アントン-ポポフ](https://github.com/CurtizJ)) -- ユーザーが `ALTER MODIFY SETTING` 古いformatedのため `MergeTree` テーブルエンジン家族。 [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -- 今度は、突然変異をより頻繁に確定しようとします。 [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -- レプリケーションプロト [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -- 配列型のbloom\_filterインデックスのnot(has())を修正しました。 [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbabcomment](https://github.com/achimbab)) -- の動作を修正しました `match` と `extract` haystackにゼロバイトがある場合の関数。 Haystackが一定の場合、その動作は間違っていました。 この修正 [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-1} - -- 例外処理は現在、linux用のwindowsサブシステム上で正しく動作します。 見るhttps://github.com/clickhouse-extras/libunwind/pull/3 この修正 [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) - -### ClickHouseリリリースv20.1.6.30,2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} - -#### バグ修正 {#bug-fix-5} - -- 圧縮時にデータの非互換性を修正する `T64` コーデック。 - [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) -- 一つのスレッドでmergetreeテーブルから読み込み中の範囲の順序を修正しました。 修正 [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). - [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) -- で可能なsegfaultを修正 `MergeTreeRangeReader`,実行中 `PREWHERE`. 修正 [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). - [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) -- 修正 `reinterpretAsFixedString` 戻るには `FixedString` 代わりに `String`. - [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) -- 修正 `joinGet` null可能な戻り値の型を指定します。 修正 [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) - [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(アモスバード)](https://github.com/amosbird) -- ファズテストとbittestall/bittestany関数の不正な動作を修正しました。 - [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) -- Haystackにゼロバイトがある場合、match関数とextract関数の動作を修正しました。 Haystackが一定の場合、その動作は間違っていました。 修正 [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) - [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) -- 非厳密に単調な関数索引が使用されている場合の逆述語の実行を修正しました。 修正 [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) - [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) -- 書き換えを許可する `CROSS` に `INNER JOIN` もしあれば `[NOT] LIKE` 演算子in `WHERE` セクション。 修正 [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) - [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4tus2)](https://github.com/4ertus2) -- ログエンジンを持つテーブルの最初の列をエイリアスにする。 - [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) -- カンマの結合を許可する `IN()` 中に 修正 [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). - [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4tus2)](https://github.com/4ertus2) -- 改善する `ALTER MODIFY/ADD` クエリロジック。 今はできません `ADD` タイプのない列, `MODIFY` デフォルトの式では、列の型は変更されません。 `MODIFY` 型は既定の式の値を緩めません。 修正 [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). - [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) -- 既に行われた変異は、ステータスis\_done=0を持つことができたときに、突然変異の終了を修正。 - [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) -- サポート “Processors” システムのため数字とシステム.numbers\_mt. これはまたバグを修正します `max_execution_time` 尊重されていません。 - [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- の間違ったカウントを修正 `DictCacheKeysRequestedFound` メトリック。 - [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) -- ストレージポリシーのチェックを追加 `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` 合がデータの一部になり、再起動後の防止ClickHouse。 - [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(エキシーン)](https://github.com/excitoon) -- 固定ubsanレポートで `MergeTreeIndexSet`. この修正 [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) - [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) -- BlockIOで可能なdataraceを修正. - [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- のサポート `UInt64` JSON関連の関数のInt64に収まらない数値。 更新 `SIMDJSON` マスターに。 この修正 [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) - [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) -- 具合を修正しましたが、金額のフリースペースが正しく計算されませんが、データディレクトリに取り付けには別の装置です。 デフォルトのディスクの計算には無料のスペースからデータのサブディレクトリの. この修正 [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) - [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(ミルブ)](https://github.com/millb) -- メッセージでtls接続が失敗する場合の問題を修正しました `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Opensslを上流のマスターに更新します。 - [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(アレクセイ-ミロビドフ)](https://github.com/alexey-milovidov) -- 実行時期 `CREATE` クエリー、倍定表現のストレージエンジンの引数です。 空のデータベース名を現在のデータベ 修正 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). また、ClickHouseDictionarySourceのローカルアドレスのチェックを修正しました。 - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Segfaultを修正する `StorageMerge` これは、StorageFileから読み込むときに発生します。 - [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) -- データを失うのを防ぐ `Kafka` まれに、接尾辞を読んだ後でコミットする前に例外が発生した場合。 修正 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). 関連: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(フィリモノフ)](https://github.com/filimonov) -- のを修正した。先サーバを終了しようとした場合に使用/drop `Kafka` テーブル作成されたパラメータ。 修正 [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). 組み込み [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(フィリモノフ)](https://github.com/filimonov) - -#### 新しい機能 {#new-feature-1} - -- 追加 `deduplicate_blocks_in_dependent_materialized_views` マテリアライズドビューを持つテーブルへの冪等挿入の動作を制御するオプション。 この新機能は、Altinityからの特別な要求によってbugfixリリースに追加されました。 - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### ClickHouseリリースv20.1.2.4,2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} - -#### 下位互換性のない変更 {#backward-incompatible-change-1} - -- 設定を行う `merge_tree_uniform_read_distribution` 廃止されました。 サーバーはこの設定を認識しますが、効果はありません。 [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 関数の戻り値の型を変更しました `greatCircleDistance` に `Float32` なぜなら今計算の結果は `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- これで、クエリパラメータが “escaped” フォーマット。 たとえば、文字列を渡すには `ab` あなたは `a\tb` または `a\b` とそれぞれ, `a%5Ctb` または `a%5C%09b` URLで。 これは、NULLを渡す可能性を追加するために必要です `\N`. この修正 [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 有効 `use_minimalistic_part_header_in_zookeeper` のための設定 `ReplicatedMergeTree` デフォルトでは。 このことを大幅に削減量のデータが保存されて飼育係. この設定はバージョン19.1以降でサポートされており、半年以上問題なく複数のサービスで本番環境で使用されています。 19.1より古いバージョンにダウングレードできる場合は、この設定を無効にします。 [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- データの飛び設計生産準備、デフォルトで有効です. 設定 `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` と `allow_experimental_multiple_joins_emulation` 今は時代遅れであり、何もしません。 [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 新規追加 `ANY JOIN` のための論理 `StorageJoin` と一貫した `JOIN` オペレーション 動作を変更せずにアップグレードするには、 `SETTINGS any_join_distinct_right_table_keys = 1` エンジンにテーブルを追加のメタデータを再現これらのテーブル後のアップグレードを開始します。 [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) -- ログ設定の変更を適用するには、サーバーを再起動する必要があります。 これは、サーバーが削除されたログファイルにログを記録するバグを回避するための一時的な回避策です。 [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### 新しい機能 {#new-feature-2} - -- パーツパスに関する情報を追加 `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 実行する機能を追加 `SYSTEM RELOAD DICTIONARY` でクエリ `ON CLUSTER` モード。 [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([ギヨームタッセリー](https://github.com/YiuRULE)) -- 実行する機能を追加 `CREATE DICTIONARY` でのクエリ `ON CLUSTER` モード。 [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) -- 今、ユーザーのプロフィール `users.xml` 継承した複数のデータ。 [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- 追加 `system.stack_trace` テーブルで眺めるスタックトレースのすべてのサーバスレッド)。 これは、開発者がサーバーの状態をイントロスペクトするのに便利です。 この修正 [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `DateTime64` 設定可能な秒未満の精度を持つデータ型。 [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) -- テーブル関数の追加 `clusterAllReplicas` ることのできるクエリのすべてのノードのクラスター [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([キラン-スンカリ](https://github.com/kiransunkari)) -- 集計関数の追加 `categoricalInformationValue` これは、離散フィーチャの情報値を計算します。 [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) -- データファイルの解析を高速化 `CSV`, `TSV` と `JSONEachRow` それを並行して行うことによって書式。 [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 機能を追加 `bankerRound` これは、銀行の丸めを実行します。 [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) -- 地域名の埋め込み辞書でより多くの言語をサポート: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- の一貫性の改善 `ANY JOIN` ロジック。 さて `t1 ANY LEFT JOIN t2` 等しい `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- 設定を追加 `any_join_distinct_right_table_keys` これは古い動作を可能にします `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- 新規追加 `SEMI` と `ANTI JOIN`. 古い `ANY INNER JOIN` 行動として `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加 `Distributed` の形式 `File` エンジンと `file` から読むことを可能にするテーブル機能 `.bin` によって生成されたファイル `Distributed` テーブル。 [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- オプションのreset column引数を追加する `runningAccumulate` これにより、各新しいキー値の集計結果をリセットできます。 [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) -- PrometheusエンドポイントとしてClickHouseを使用する機能を追加します。 [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) -- セクションを追加 `` で `config.xml` の制約が許されたアイテムのリモートテーブルエンジンとテーブル機能 `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) -- 機能追加 `greatCircleAngle` これは度で球の距離を計算します。 [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 地球の半径をh3ライブラリと一致するように変更しました。 [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `JSONCompactEachRow` と `JSONCompactEachRowWithNamesAndTypes` 入力と出力の形式。 [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) -- ファイル関連のテーブルエンジンとテーブル関数の機能を追加 (`File`, `S3`, `URL`, `HDFS`)読み書きすることができます `gzip` ファイルに基づく追加のエンジンのパラメータまたはファイル拡張子. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) -- を追加しました `randomASCII(length)` のランダムなセットを持つ文字列を生成する関数 [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) 印刷可能な文字。 [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([バヨネット](https://github.com/BayoNet)) -- 機能追加 `JSONExtractArrayRaw` これは、解析されていないjson配列要素の配列を返します `JSON` 文字列。 [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) -- 追加 `arrayZip` 等しい長さの複数の配列をタプルの一つの配列に結合することを可能にする関数。 [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([冬張](https://github.com/zhang2014)) -- 設定に従ってディスク間でデータを移動する機能を追加 `TTL`-のための式 `*MergeTree` テーブルエンジン家族。 [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 新しい集計関数を追加 `avgWeighted` 加重平均を計算することができます。 [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) -- デフォルトでは、並列解析が有効になりました `TSV`, `TSKV`, `CSV` と `JSONEachRow` フォーマット。 [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- からいくつかの地理機能を追加 `H3` ライブラリ: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` と `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([コンスタンチン-マランチェフ](https://github.com/hombit)) -- Brotliのサポートを追加しました (`br` ファイル関連のストレージとテーブルの機能で)圧縮。 この修正 [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加 `groupBit*` のための機能 `SimpleAggregationFunction` タイプ。 [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([ギヨームタッセリー](https://github.com/YiuRULE)) - -#### バグ修正 {#bug-fix-6} - -- とテーブルの名前の変更を修正 `Distributed` エンジン。 修正の問題 [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- 今辞書サポート `EXPRESSION` 非ClickHouse SQLダイアレクト内の任意の文字列の属性の場合。 [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -- 壊れた修正 `INSERT SELECT FROM mysql(...)` クエリ。 この修正 [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) と [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- エラーの修正 “Mismatch column sizes” デフォルトを挿入する `Tuple` から `JSONEachRow`. この修正 [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) -- これで、usingの場合に例外がスローされます `WITH TIES` 一緒に `LIMIT BY`. また、使用する機能を追加 `TOP` と `LIMIT BY`. この修正 [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- 新鮮なglibcバージョンからの意図しない依存関係を修正 `clickhouse-odbc-bridge` バイナリ [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([アモスの鳥](https://github.com/amosbird)) -- のチェック機能のバグを修正 `*MergeTree` エンジンファミリー 最後の顆粒と最後のマーク(最終ではない)に等しい量の行がある場合、今度は失敗しません。 [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) -- に挿入を修正 `Enum*` 後の列 `ALTER` 基になる数値型がテーブル指定された型と等しい場合のクエリです。 この修正 [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 許可される非定数負 “size” 関数の引数 `substring`. それは誤って許可されませんでした。 この修正 [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 引数の数が間違って渡されたときにバグを解析する修正 `(O|J)DBC` テーブルエンジン。 [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) -- Syslogにログを送信するときに、実行中のclickhouseプロセスのコマンド名を使用します。 以前のバージョ [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) -- 許可されたホストの修正チェック `localhost`. このPRでは、 [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- でレアクラッシュを修正 `argMin` と `argMax` resultが使用されているときの長い文字列引数の関数 `runningAccumulate` 機能。 この修正 [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([恐竜](https://github.com/769344359)) -- とテーブルのメモリオーバーコミットを修正 `Buffer` エンジン。 [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) -- 取ることができる機能の潜在的なバグを修正 `NULL` 引数の一つとして、非NULLを返します。 [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より良いメトリクス計算のスレッドプールを対象としたバックグラウンドプロセス `MergeTree` テーブルエンジン。 [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修正機能 `IN` 中 `WHERE` 決が行レベルテーブルフィルターがあります。 修正 [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([イワン](https://github.com/abyss7)) -- これで、設定値の整数値が完全に解析されない場合、例外がスローされます。 [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) -- 複数のローカルシャードを持つ分散テーブルへのクエリで集計関数を使用すると例外が修正されました。 [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- Bloom filterは長さゼロの配列を扱うことができ、冗長な計算を実行しません。 [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbabcomment](https://github.com/achimbab)) -- クライアン `host_regexp` で指定される `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) -- 複数の偽陽性につながるあいまいな列チェックを緩和する `JOIN ON` セクション。 [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定可能なサーバのクラッシュ (`std::terminate`)サーバーがデータを送信または書き込みできない場合 `JSON` または `XML` の値を持つ形式 `String` データ型(必要なデータ型 `UTF-8` 検証)またはBrotliアルゴリズムまたは他のまれなケースで結果データを圧縮するとき。 この修正 [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 競合状態の修正 `StorageDistributedDirectoryMonitor` CIによって発見。 この修正 [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 今、背景には、マージ `*MergeTree` テーブルエンジンの家族の保存-保存政策に大量注文しております。 [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Nowテーブルエンジン `Kafka` で適切に動作します `Native` フォーマット。 この修正 [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([フィリモノフ](https://github.com/filimonov)) -- ヘッダーを持つ固定形式(のような `CSVWithNames` テーブルエンジンのEOFについて例外を投げていた `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([フィリモノフ](https://github.com/filimonov)) -- の右側の部分にサブクエリからセットを作るとバグを修正しました `IN` セクション。 この修正 [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) と [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- ストレージか `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- でファイルの固定読み取り `Parquet` 型の列を含む形式 `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([マクスラン](https://github.com/maxulan)) -- エラーの修正 `Not found column` 分散クエリの場合 `PREWHERE` サンプリングキーに依存する条件 `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- エラーの修正 `Not found column` クエリを使用した場合 `PREWHERE` テーブルのエイリアスに依存し、主キー条件のために結果セットは空でした。 [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 関数の戻り値の型を修正 `rand` と `randConstant` の場合 `Nullable` 引数。 Now関数は常に戻ります `UInt32` そして決して `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 無効述語プッシュダウンのための `WITH FILL` 式。 この修正 [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([冬張](https://github.com/zhang2014)) -- 固定間違った `count()` 結果のための `SummingMergeTree` とき `FINAL` セクションを使用します。 [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- 固定可能な誤った結果常に機能することができます。 そのためのクエリ機能 `version()`, `uptime()`、等。 サーバーごとに異なる定数値を返します。 この修正 [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 間違った結果につながるプッシュダウン述語の最適化の複雑なバグを修正します。 これにより、プッシュダウン述語の最適化に多くの問題が修正されます。 [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([冬張](https://github.com/zhang2014)) -- でクラッシュを修正 `CREATE TABLE .. AS dictionary` クエリ。 [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) -- いくつかの改善clickhouse文法で `.g4` ファイル。 [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([タイヤン-リ](https://github.com/taiyang-li)) -- でクラッシュにつながるバグを修正 `JOIN`エンジン付きテーブル付きs `Join`. この修正 [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) -- 冗長辞書のリロードを修正 `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) -- 読み込み元のストリームの最大数を制限する `StorageFile` と `StorageHDFS`. 修正https://github.com/ClickHouse/ClickHouse/issues/7650。 [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -- バグを修正 `ALTER ... MODIFY ... CODEC` クエリがユーザーの両方を指定しデフォルトの表現-コーデック. 修正 [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) -- 列のバックグラウンドマージでエラーを修正 `SimpleAggregateFunction(LowCardinality)` タイプ。 [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 固定型チェックイン機能 `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) -- 今、サーバーがクラッシュしない `LEFT` または `FULL JOIN` と参加エンジンと非サポート `join_use_nulls` 設定。 [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) -- さて `DROP DICTIONARY IF EXISTS db.dict` クエリが例外をスローしない場合 `db` 存在しない [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- テーブル関数のクラッシュの修正 (`file`, `mysql`, `remote`)削除への参照の使用によって引き起こされる `IStorage` オブジェクト。 テーブル関数への挿入時に指定された列の不正な解析を修正しました。 [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) -- をネットワークとなる前に `clickhouse-server`. この修正 [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) -- 安全な接続のためのタイムアウト処理を修正しました。 この修正 [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正 `clickhouse-copier`'並行作業者間の冗長な競合。 [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([丁象飛](https://github.com/dingxiangfei2009)) -- たとえその変異バージョンが現在の変異バージョ [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -- の冗長コピーを無視する。 `*MergeTree` 別のディスクに移動してサーバーを再起動した後のデータ部分。 [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- でクラッシュを修正 `FULL JOIN` と `LowCardinality` で `JOIN` キー。 [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) -- Insertクエリで列名を複数回使用することは禁じられています `INSERT INTO tbl (x, y, x)`. この修正 [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) -- 検出のためのフォールバックを追加しました(論理cpuコアの数を使用して)未知のcpuのための物理cpuコアの数。 この修正 [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正 `There's no column` 誤差を実現し、エイリアス列あります。 [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定断つクラッシュ時 `EXISTS` クエリが使用されなかった `TABLE` または `DICTIONARY` 修飾子。 ただのような `EXISTS t`. この修正 [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). このバグはバージョン19.17で導入されました。 [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- エラーでまれなバグを修正 `"Sizes of columns doesn't match"` これは、 `SimpleAggregateFunction` コラム [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- 空のユーザーバグを修正 `allow_databases` すべてのデータベース(同じ `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) -- 固定顧客のクラッシュがサーバーで接続しています。 [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- 修正 `ORDER BY` 主キー接頭辞と非主キー接尾辞によるソートの場合の動作。 [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([アントン-ポポフ](https://github.com/CurtizJ)) -- テーブルに修飾列が存在するかどうかを確認します。 この修正 [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定された動作と `ALTER MOVE` merge finishが指定したスーパーパーを移動した直後に実行されます。 修正 [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 使用中のサーバーのクラッシュを修正 `UNION` 異なる数の列を持つ。 修正 [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 固定サイズの結果、部分文字列のための機能 `substr` 負のサイズ。 [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 今、サーバーは `MergeTree` が足りないときは無料のスレッドの背景プールがあります。 [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) -- 書式設定にマイナータイプミスを修正 `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) -- 固定間違ったブルームフィルタの負の数の結果。 この修正 [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([冬張](https://github.com/zhang2014)) -- Decompressでバッファオーバーフローの可能性を修正 悪意のあるユーザーで製作した圧縮データが読み後のバッファです。 この問題は、Yandexの情報セキュリティチームのEldar Zaitovによって発見されました。 [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 整数のオーバーフローのために誤った結果を修正 `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- さて `OPTIMIZE TABLE` クエリを待ちませんがオフラインのレプリカを行います。 [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) -- 固定 `ALTER TTL` のためのパーサ `Replicated*MergeTree` テーブル。 [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) -- サーバとクライアン [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- 修正 `bitmapAnd` 機能エラーが交差に集約ビットマップおよびスカラービットマップ. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([越黄](https://github.com/moon03432)) -- 定義をの精製して下さい `ZXid` バグを修正するZooKeeperプログラマーズガイドによると `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([丁象飛](https://github.com/dingxiangfei2009)) -- `odbc` テーブル関数は今 `external_table_functions_use_nulls` 設定。 [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) -- 稀なデータレースにつながるバグを修正しました。 [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -- さて `SYSTEM RELOAD DICTIONARY` 辞書を完全にリロードし、無視します `update_field`. この修正 [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Create queryに辞書が存在するかどうかを確認する機能を追加します。 [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) -- 修正 `Float*` 解析 `Values` フォーマット。 この修正 [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- 私たちはいくつかのバックグ `*MergeTree` テーブルエンジン家族。 [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 固定クラッシュの統合運用がテーブル `SimpleAggregateFunction(LowCardinality)` コラム この修正 [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) -- すべてのicuロケールのサポートを復元し、定数式の照合順序を適用する機能を追加します。 また、言語名を追加する `system.collations` テーブル。 [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -- ゼロ最小限の寿命を持つ外部辞書バグを修正しました (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)` バックグラウンドで更新しない。 [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) -- 固定したときにクラッシュする場合が外部辞書でclickhouseソースがサブクエリに返します。 [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- エンジンでテーブル内のファイル拡張子の誤った解析を修正 `URL`. この修正 [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) -- 修正 `CHECK TABLE` のためのクエリ `*MergeTree` キーのないテーブル。 修正 [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -- 固定変換の `Float64` MySQLのタイプに。 [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([ユーリーバラノフ](https://github.com/yurriy)) -- 今ればいけない完全に落ちてしまったがサーバのクラッシュ、サーバーへの復元とその負荷ます。 [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- テーブル機能のクラッシュを修正 `file` 存在しないファイルに挿入している間。 この場合、ファイルが作成され、insertが処理されます。 [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- ときに発生する可能性がまれなデッドロックを修正 `trace_log` 有効になっています。 [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([フィリモノフ](https://github.com/filimonov)) -- ほかに異なるタイプで動作する機能を追加 `Date` で `RangeHashed` DDLクエリから作成された外部ディクショナリ。 修正 [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -- ときの修正クラッシュ `now64()` 別の関数の結果で呼び出されます。 [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) -- 固定バグ検出クライアントip接続を通じてmysqlワイヤプロトコルです。 [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) -- 空の配列の処理を修正 `arraySplit` 機能。 この修正 [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) -- ときに問題を修正しました `pid-file` 別のランニングの `clickhouse-server` 削除される可能性があります。 [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) -- それが持っている場合 `invalidate_query` これは、以前の更新試行時に更新といくつかの例外を停止しました。 [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) -- 関数のエラーを修正しました `arrayReduce` それはにつながる可能性 “double free” そして、集計関数combinatorのエラー `Resample` それはメモリリークの原因となります。 集計関数の追加 `aggThrow`. この関数は、テスト目的で使用できます。 [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 改善 {#improvement-1} - -- での作業時に改善されたロギング `S3` テーブルエンジン。 [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- 印刷ヘルプメッセージがない場合引数が渡された通話の場合 `clickhouse-local`. この修正 [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) -- 設定を追加 `mutations_sync` 待つことができます `ALTER UPDATE/DELETE` 同期クエリ。 [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) -- 相対セットアップを許可する `user_files_path` で `config.xml` (同様の方法で `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) -- 変換関数の不正な型の例外を追加するには `-OrZero` 後置。 [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) -- 分散クエリでシャードに送信するデータのヘッダーの形式を簡素化します。 [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) -- `Live View` テーブルエンジンリファクタリング。 [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) -- DDLクエリから作成された外部ディクショナリのチェックを追加します。 [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) -- エラーの修正 `Column ... already exists` 使用している間 `FINAL` と `SAMPLE` together, e.g. `select count() from table final sample 1/2`. 修正 [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 今の最初の引数を表 `joinGet` 関数はテーブル識別子にすることができます。 [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([アモスの鳥](https://github.com/amosbird)) -- 使用を許可する `MaterializedView` 上記のサブクエリを使用する `Kafka` テーブル。 [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([フィリモノフ](https://github.com/filimonov)) -- これで、ディスク間の背景移動が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) ([Vitaly Baranov](https://github.com/vitlibar)) -- スタックトレース表示の物理アドレス(オフセットオブジェクトファイルの代わりに仮想メモリのアドレスのオブジェクトファイルが読み込まれ). それは使用をの可能にします `addr2line` binaryが独立した位置でASLRがアクティブな場合。 この修正 [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](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)) -- さて `cityHash` 機能で動作することができ `Decimal` と `UUID` タイプ。 修正 [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) -- アダプティブ粒度の実装後に廃止されたため、システムログから固定インデックス粒度(1024)が削除されました。 [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 有効なmysqlサーバーの互換性がclickhouseはめずにボタンを使用します。 [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([ユーリーバラノフ](https://github.com/yurriy)) -- これにより、バッチ内のデータが破損した場合の詳細なエラーが発生します。 [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) -- サポート `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` と `ATTACH TABLE` のために `MySQL` データベースエンジ [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([冬張](https://github.com/zhang2014)) -- S3テーブル機能とテーブルエンジンに認証を追加します。 [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 追加されたチェックの余分な部品 `MergeTree` 異なるディスクでは、未定義のディスクでデータ部分を見逃さないようにするためです。 [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) -- を、sslをサポートのためにmacをクライアントとサーバーです。 [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([イワン](https://github.com/abyss7)) -- 今clickhouseできる作品としてmysql連携サーバを参照https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- `clickhouse-client` 今だけ有効にする `bracketed-paste` マルチクエリがオンで、マルチラインがオフの場合。 この修正(\#7757)\[https://github.com/ClickHouse/ClickHouse/issues/7757\]。 [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([アモスの鳥](https://github.com/amosbird)) -- サポート `Array(Decimal)` で `if` 機能。 [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) -- サポート小数で `arrayDifference`, `arrayCumSum` と `arrayCumSumNegative` 機能。 [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) -- 追加 `lifetime` コラムへの `system.dictionaries` テーブル。 [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) -- 改良されたチェックインのための既存の部品の異なるハードディスク `*MergeTree` テーブルエンジン。 アドレス [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) -- との統合 `AWS SDK` のために `S3` 箱から出してすべてのS3の機能を使用することができます相互作用。 [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) -- サブクエリのサポートが追加されました `Live View` テーブル。 [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) -- 使用のための点検 `Date` または `DateTime` からの列 `TTL` 式は削除されました。 [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) -- ディスクに関する情報が追加された `system.detached_parts` テーブル。 [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 今すぐ設定 `max_(table|partition)_size_to_drop` 再起動せずに変更することができます。 [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- エラーメッ ユーザーに以下の行を削除しないように依頼する `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より良いメッセージを読むら `Kafka` 後の様々な形式のエンジン [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([イワン](https://github.com/abyss7)) -- サポートしていないmysqlクライアントとの互換性の向上 `sha2_password` authプラグイン。 [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([ユーリーバラノフ](https://github.com/yurriy)) -- 支援の列タイプのmysqlサーバーの互換性. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([ユーリーバラノフ](https://github.com/yurriy)) -- 実装 `ORDER BY` 最適化のための `Merge`, `Buffer` と `Materilized View` 下になるとストレージ `MergeTree` テーブル。 [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([アントン-ポポフ](https://github.com/CurtizJ)) -- 今、私たちは常にposixの実装を使用します `getrandom` 古いカーネル(\<3.17)との互換性を改善する。 [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([アモスの鳥](https://github.com/amosbird)) -- 移動ttlルールの有効な宛先をよりよくチェックします。 [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 壊れた挿入のバッチのためのよりよい点検 `Distributed` テーブルエンジン。 [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) -- 将来突然変異が処理されなければならない部品名の配列を持つ列を追加する `system.mutations` テーブル。 [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) -- 並列マージプロセッサのソート最適化。 [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 設定 `mark_cache_min_lifetime` 今は時代遅れで、何もしません。 以前のバージョンでは、マークキャッシュはメモリ内で `mark_cache_size` 内のデータを収容するために、 `mark_cache_min_lifetime` 秒。 それは、メモリ制約のあるシステムでは特に悪いことです。 このリリースをインストールした後にパフォーマンスが低下する場合は、 `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 使用する準備 `tid` どこにでも これは次の場合に必要です [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### 性能向上 {#performance-improvement-1} - -- 性能の最適化、プロセッサのパイプライン [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 非ブロック更新の有効期限が切れたキーキャッシュの辞書(許可を読古い。 [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- クリック `-fno-omit-frame-pointer` 世界的に余裕一するものとする。 [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([アモスの鳥](https://github.com/amosbird)) -- スピードアップ `greatCircleDistance` それのための性能試験を機能し、加えて下さい。 [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) -- 機能のパフォーマンスの向上 `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 改善された性能の `max`, `min`, `argMin`, `argMax` のために `DateTime64` データ型。 [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) -- 大きい限界および外的な分類の限界のないまたは分類の改善された性能。 [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 6回までの浮動小数点数の書式設定のパフォーマンスが向上しました。 [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 改善された性能の `modulo` 機能。 [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([アモスの鳥](https://github.com/amosbird)) -- 最適化 `ORDER BY` 単一の列キーとのマージ。 [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より良い実装 `arrayReduce`, `-Array` と `-State` コンビネーター [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([アモスの鳥](https://github.com/amosbird)) -- さて `PREWHERE` 少なくとも次のように最適化する必要があります `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([アモスの鳥](https://github.com/amosbird)) -- 方法を改善する `round` と `roundBankers` 負の数を扱う。 [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) -- デコード性能の向上 `DoubleDelta` と `Gorilla` 大体30-40%のコーデック。 この修正 [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) -- 改善された性能の `base64` 関連機能。 [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 機能を追加しました `geoDistance`. それは類似していますに `greatCircleDistance` しかし、WGS-84楕円体モデルに近似を使用します。 両方の機能のパフォーマンスは同じに近いです。 [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- より速く `min` と `max` 以下のための集計関数 `Decimal` データ型。 [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) -- ベクトル化処理 `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([アモスの鳥](https://github.com/amosbird)) -- `if` 鎖は今最大限に活用されます `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) -- パフォーマンスの回帰の修正 `Kafka` 19.15で導入されたテーブルエンジン。 この修正 [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([フィリモノフ](https://github.com/filimonov)) -- 削除 “pie” コード生成 `gcc` からDebianパッケージの時となります。 [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- データ形式の並列解析 [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- 最適化されたパーサーの有効化 `Values` デフォルトでの式の使用 (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) - -#### ビルド/テスト/パッケージの改善 {#buildtestingpackaging-improvement-2} - -- ビルドの修正 `ARM` そして、最小限のモードで。 [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) -- 追加取材ファイルのフラッシュ用 `clickhouse-server` std::atexitが呼び出されないとき。 も若干の改善にログイン状態試験。 [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) -- ContribのLLVMライブラリを更新します。 OSパッケージからのLLVMの使用を避けます。 [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- バンドルする `curl` 完全に静かなビルド。 [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) -- いくつかを修正 `MemorySanitizer` 警告。 [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 使用 `add_warning` と `no_warning` マクロ `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([イワン](https://github.com/abyss7)) -- Minio S3互換オブジェクトのサポートを追加(https://min.io/)より良い統合テストのために。 [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) -- インポート `libc` contribへのヘッダー。 ることができる作をより一貫性のあるさまざまなシステムのみ `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 削除 `-fPIC` いくつかの図書館から。 [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- クリーン `CMakeLists.txt` カールのため。 見るhttps://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- サイレント警告 `CapNProto` ライブラリ。 [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 追加の性能試験のため短い文字列を最適化ハッシュテーブル [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([アモスの鳥](https://github.com/amosbird)) -- 今clickhouseは上に構築されます `AArch64` たとえ `MADV_FREE` は利用できません。 この修正 [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([アモスの鳥](https://github.com/amosbird)) -- 更新 `zlib-ng` メモリ消毒の問題を修正するには. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- OSパッケージの使用は非常に脆弱で、通常はまったく動作しないため、Linux以外のシステムで内部MySQLライブラリを有効にします。 この修正 [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定構築システムによっては後に可能 `libc++`. これは [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 作る `Field` 方法によりtype-安全なものがあります。。 [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- に不足しているファイルを追加 `libc-headers` サブモジュール [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 間違った修正 `JSON` パフォーマンステスト出力の引用。 [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- スタックトレースが表示されます `std::exception` と `Poco::Exception`. 以前のバージョンでは、 `DB::Exception`. これは診断を改善します。 [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 移植 `clock_gettime` と `clock_nanosleep` 新しいglibc版のため。 [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([アモスの鳥](https://github.com/amosbird)) -- 有効 `part_log` 開発者のための例の設定で。 [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- リロードの非同期の性質を修正 `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) -- 固定コーデック性能テスト。 [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) -- インストールスクリプト `.tgz` それらのビルドとドキュメント。 [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) -- 古いものを削除 `ZSTD` テスト(2016年に作成され、ZSTDの1.0バージョンが持っていたバグを再現しました)。 この修正 [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mac OSカタリナ上の固定ビルド。 [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) -- 増加数行のコーデックの性能試験を果たしますのでご連絡ください [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) -- デバッグビルドでは、 `LOGICAL_ERROR` アサーションの失敗としての例外は、気付きやすくなります。 [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 形式関連のパフォーマンステストをより確定的にします。 [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 更新 `lz4` メモリを修正するには市民の失敗。 [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 例外処理で既知のmemorysanitizer false positiveを抑制します。 [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 更新 `gcc` と `g++` バージョン9へ `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) -- 追加の性能試験場合試験 `PREWHERE` より悪いです `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([アモスの鳥](https://github.com/amosbird)) -- ツつィツ姪"ツつ"ツ債ツづュツつケ [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- からのデータのmemorysanitizerレポートを避けます `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 更新 `libc++` 最新バージョンへ。 [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ソースからのビルドicuライブラリ。 この修正 [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- から切り替え `libressl` に `openssl`. ClickHouseは、この変更後にTLS1.3とSNIをサポートする必要があります。 この修正 [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 固定ubsanレポートを使用する場合 `chacha20_poly1305` SSLから(接続時に発生するhttps://yandex.ru/)。 [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- デフォルトのパスワードファイ `.deb` linuxディストリビュート。 [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) -- 取得のための改善された表現 `clickhouse-server` PID `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) -- Contrib/googletestをv1.10.0に更新しました。 [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- 。固定スレッドサニアイナイザレポートで `base64` ライブラリ。 また、このライブラリを最新バージョンに更新しましたが、問題はありません。 この修正 [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 修正 `00600_replace_running_query` プロセッサの場合。 [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- サポートの削除 `tcmalloc` 作るため `CMakeLists.txt` もっと簡単に [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- リリースgccは今使用ビルド `libc++` 代わりに `libstdc++`. 最近 `libc++` clangでのみ使用されました。 これにより、ビルド構成の一貫性と移植性が向上します。 [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MemorySanitizerでビルドするためのICUライブラリを有効にします。 [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 抑制する警告から `CapNProto` ライブラリ。 [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- のためのコードの特別なケースを削除 `tcmalloc` サポートされなくなったからです [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- CIカバレッジタスクでは、カバレッジレポートを保存できるようにサーバーを正常に終了します。 これは、我々が最近見てきた不完全な報道レポートを修正します。 [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) -- すべてのコーデックのパフォーマ `Float64` と `UInt64` 値。 [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) -- `termcap` 非常に非難され、さまざまな問題につながる(f.g.missing “up” 帽子およびエコー `^J` マルチラインの代わりに)。 お願い `terminfo` またはバンドル `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([アモスの鳥](https://github.com/amosbird)) -- 修正 `test_storage_s3` 統合テスト。 [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- サポート `StorageFile(, null)` 挿入をブロックを所定のフォーマットでなくファイルを実際に書き込みます。 これは必要な性能試験までを実施。 [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([アモスの鳥](https://github.com/amosbird)) -- 追加された引数 `--print-time` テストごとに実行時間を出力する機能テスト。 [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- にアサートを追加しました `KeyCondition` RPNを評価しながら。 これにより、gcc-9からの警告が修正されます。 [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ダンプcmakeのオプションci構造を作成する環境が整いました [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 一部のfatライブラリのデバッグ情報を生成しません。 [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 作る `log_to_console.xml` それは対話的であるかどうかにかかわらず、常にstderrにログインします。 [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 除去も未使用の特徴から `clickhouse-performance-test` ツール。 [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 今我々はまた検索する `lld-X` 対応を使って `clang-X` バージョン。 [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) -- 寄木細工のビルドの改善。 [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([マクスラン](https://github.com/maxulan)) -- より多くのgccの警告 [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- パッケージアーチlinuxすることはできなくなるようで走clickhouseサーバーになります。 [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) -- プロセッサでテストを修正。 小さな性能の修正。 [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- 更新contrib/protobuf. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V.Kornilov](https://github.com/matwey)) -- 新年のお祝いとしてc++20への切り替えの準備で。 “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([アモスの鳥](https://github.com/amosbird)) - -#### 実験的特徴 {#experimental-feature-1} - -- 実験的な設定を追加しました `min_bytes_to_use_mmap_io`. ることができるreadビッグファイルのコピーをせずにデータをカーネルを使うこと. の設定が無効になってデフォルトです。 推奨しきい値は、mmap/munmapが遅いため、約64MBです。 [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- アクセス制御システムの一部としてのクォータの変更。 新しいテーブルを追加 `system.quotas`、新しい機能 `currentQuota`, `currentQuotaKey`、新しいSQL構文 `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) -- を飛び未設定警告の代わりに投げることができます。 [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) -- アクセス制御システムの一部としての行ポリシーの変更。 新しいテーブルを追加 `system.row_policies`、新しい機能 `currentRowPolicies()`、新しいSQL構文 `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### セキュリティ修正 {#security-fix} - -- テーブル内のディレクトリ構造を読み取る可能性を修正 `File` テーブルエンジン。 この修正 [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## [2019年の変更履歴](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/redirects.txt b/docs/redirects.txt index 1a9455355db..df406d89eb3 100644 --- a/docs/redirects.txt +++ b/docs/redirects.txt @@ -1,49 +1,94 @@ -agg_functions/combinators.md query_language/agg_functions/combinators.md -agg_functions/index.md query_language/agg_functions/index.md -agg_functions/parametric_functions.md query_language/agg_functions/parametric_functions.md -agg_functions/reference.md query_language/agg_functions/reference.md -changelog/2017.md whats_new/changelog/2017.md -changelog/2018.md whats_new/changelog/2018.md -changelog/2019.md whats_new/changelog/2019.md -changelog/index.md whats_new/changelog/index.md -data_types/array.md sql_reference/data_types/array.md -data_types/boolean.md sql_reference/data_types/boolean.md -data_types/date.md sql_reference/data_types/date.md -data_types/datetime.md sql_reference/data_types/datetime.md -data_types/datetime64.md sql_reference/data_types/datetime64.md -data_types/decimal.md sql_reference/data_types/decimal.md -data_types/domains/ipv4.md sql_reference/data_types/domains/ipv4.md -data_types/domains/ipv6.md sql_reference/data_types/domains/ipv6.md -data_types/domains/overview.md sql_reference/data_types/domains/overview.md -data_types/enum.md sql_reference/data_types/enum.md -data_types/fixedstring.md sql_reference/data_types/fixedstring.md -data_types/float.md sql_reference/data_types/float.md -data_types/index.md sql_reference/data_types/index.md -data_types/int_uint.md sql_reference/data_types/int_uint.md -data_types/nested_data_structures/aggregatefunction.md sql_reference/data_types/aggregatefunction.md -data_types/nested_data_structures/index.md sql_reference/data_types/nested_data_structures/index.md -data_types/nested_data_structures/nested.md sql_reference/data_types/nested_data_structures/nested.md -data_types/nullable.md sql_reference/data_types/nullable.md -data_types/special_data_types/expression.md sql_reference/data_types/special_data_types/expression.md -data_types/special_data_types/index.md sql_reference/data_types/special_data_types/index.md -data_types/special_data_types/interval.md sql_reference/data_types/special_data_types/interval.md -data_types/special_data_types/nothing.md sql_reference/data_types/special_data_types/nothing.md -data_types/special_data_types/set.md sql_reference/data_types/special_data_types/set.md -data_types/string.md sql_reference/data_types/string.md -data_types/tuple.md sql_reference/data_types/tuple.md -data_types/uuid.md sql_reference/data_types/uuid.md -database_engines/index.md engines/database_engines/index.md -database_engines/lazy.md engines/database_engines/lazy.md -database_engines/mysql.md engines/database_engines/mysql.md -dicts/external_dicts.md query_language/dicts/external_dicts.md -dicts/external_dicts_dict.md query_language/dicts/external_dicts_dict.md -dicts/external_dicts_dict_layout.md query_language/dicts/external_dicts_dict_layout.md -dicts/external_dicts_dict_lifetime.md query_language/dicts/external_dicts_dict_lifetime.md -dicts/external_dicts_dict_sources.md query_language/dicts/external_dicts_dict_sources.md -dicts/external_dicts_dict_structure.md query_language/dicts/external_dicts_dict_structure.md -dicts/index.md query_language/dicts/index.md -dicts/internal_dicts.md query_language/dicts/internal_dicts.md -extended_roadmap.md whats_new/extended_roadmap.md +agg_functions/combinators.md query-language/agg-functions/combinators.md +agg_functions/index.md query-language/agg-functions/index.md +agg_functions/parametric_functions.md query-language/agg-functions/parametric-functions.md +agg_functions/reference.md query-language/agg-functions/reference.md +changelog/2017.md whats-new/changelog/2017.md +changelog/2018.md whats-new/changelog/2018.md +changelog/2019.md whats-new/changelog/2019.md +changelog/index.md whats-new/changelog/index.md +data_types/array.md sql-reference/data-types/array.md +data_types/boolean.md sql-reference/data-types/boolean.md +data_types/date.md sql-reference/data-types/date.md +data_types/datetime.md sql-reference/data-types/datetime.md +data_types/datetime64.md sql-reference/data-types/datetime64.md +data_types/decimal.md sql-reference/data-types/decimal.md +data_types/domains/ipv4.md sql-reference/data-types/domains/ipv4.md +data_types/domains/ipv6.md sql-reference/data-types/domains/ipv6.md +data_types/domains/overview.md sql-reference/data-types/domains/overview.md +data_types/enum.md sql-reference/data-types/enum.md +data_types/fixedstring.md sql-reference/data-types/fixedstring.md +data_types/float.md sql-reference/data-types/float.md +data_types/index.md sql-reference/data-types/index.md +data_types/int_uint.md sql-reference/data-types/int-uint.md +data_types/nested_data_structures/aggregatefunction.md sql-reference/data-types/aggregatefunction.md +data_types/nested_data_structures/index.md sql-reference/data-types/nested-data-structures/index.md +data_types/nested_data_structures/nested.md sql-reference/data-types/nested-data-structures/nested.md +data_types/nullable.md sql-reference/data-types/nullable.md +data_types/special_data_types/expression.md sql-reference/data-types/special-data-types/expression.md +data_types/special_data_types/index.md sql-reference/data-types/special-data-types/index.md +data_types/special_data_types/interval.md sql-reference/data-types/special-data-types/interval.md +data_types/special_data_types/nothing.md sql-reference/data-types/special-data-types/nothing.md +data_types/special_data_types/set.md sql-reference/data-types/special-data-types/set.md +data_types/string.md sql-reference/data-types/string.md +data_types/tuple.md sql-reference/data-types/tuple.md +data_types/uuid.md sql-reference/data-types/uuid.md +database_engines/index.md engines/database-engines/index.md +database_engines/lazy.md engines/database-engines/lazy.md +database_engines/mysql.md engines/database-engines/mysql.md +development/browse_code.md development/browse-code.md +development/build_cross_arm.md development/build-cross-arm.md +development/build_cross_osx.md development/build-cross-osx.md +development/build_osx.md development/build-osx.md +development/developer_instruction.md development/developer-instruction.md +dicts/external_dicts.md query-language/dicts/external-dicts.md +dicts/external_dicts_dict.md query-language/dicts/external-dicts-dict.md +dicts/external_dicts_dict_layout.md query-language/dicts/external-dicts-dict-layout.md +dicts/external_dicts_dict_lifetime.md query-language/dicts/external-dicts-dict-lifetime.md +dicts/external_dicts_dict_sources.md query-language/dicts/external-dicts-dict-sources.md +dicts/external_dicts_dict_structure.md query-language/dicts/external-dicts-dict-structure.md +dicts/index.md query-language/dicts/index.md +dicts/internal_dicts.md query-language/dicts/internal-dicts.md +engines/database_engines/index.md engines/database-engines/index.md +engines/database_engines/lazy.md engines/database-engines/lazy.md +engines/database_engines/mysql.md engines/database-engines/mysql.md +engines/table_engines/index.md engines/table-engines/index.md +engines/table_engines/integrations/hdfs.md engines/table-engines/integrations/hdfs.md +engines/table_engines/integrations/index.md engines/table-engines/integrations/index.md +engines/table_engines/integrations/jdbc.md engines/table-engines/integrations/jdbc.md +engines/table_engines/integrations/kafka.md engines/table-engines/integrations/kafka.md +engines/table_engines/integrations/mysql.md engines/table-engines/integrations/mysql.md +engines/table_engines/integrations/odbc.md engines/table-engines/integrations/odbc.md +engines/table_engines/log_family/index.md engines/table-engines/log-family/index.md +engines/table_engines/log_family/log.md engines/table-engines/log-family/log.md +engines/table_engines/log_family/log_family.md engines/table-engines/log-family/log-family.md +engines/table_engines/log_family/stripelog.md engines/table-engines/log-family/stripelog.md +engines/table_engines/log_family/tinylog.md engines/table-engines/log-family/tinylog.md +engines/table_engines/mergetree_family/aggregatingmergetree.md engines/table-engines/mergetree-family/aggregatingmergetree.md +engines/table_engines/mergetree_family/collapsingmergetree.md engines/table-engines/mergetree-family/collapsingmergetree.md +engines/table_engines/mergetree_family/custom_partitioning_key.md engines/table-engines/mergetree-family/custom-partitioning-key.md +engines/table_engines/mergetree_family/graphitemergetree.md engines/table-engines/mergetree-family/graphitemergetree.md +engines/table_engines/mergetree_family/index.md engines/table-engines/mergetree-family/index.md +engines/table_engines/mergetree_family/mergetree.md engines/table-engines/mergetree-family/mergetree.md +engines/table_engines/mergetree_family/replacingmergetree.md engines/table-engines/mergetree-family/replacingmergetree.md +engines/table_engines/mergetree_family/replication.md engines/table-engines/mergetree-family/replication.md +engines/table_engines/mergetree_family/summingmergetree.md engines/table-engines/mergetree-family/summingmergetree.md +engines/table_engines/mergetree_family/versionedcollapsingmergetree.md engines/table-engines/mergetree-family/versionedcollapsingmergetree.md +engines/table_engines/special/buffer.md engines/table-engines/special/buffer.md +engines/table_engines/special/dictionary.md engines/table-engines/special/dictionary.md +engines/table_engines/special/distributed.md engines/table-engines/special/distributed.md +engines/table_engines/special/external_data.md engines/table-engines/special/external-data.md +engines/table_engines/special/file.md engines/table-engines/special/file.md +engines/table_engines/special/generate.md engines/table-engines/special/generate.md +engines/table_engines/special/index.md engines/table-engines/special/index.md +engines/table_engines/special/join.md engines/table-engines/special/join.md +engines/table_engines/special/materializedview.md engines/table-engines/special/materializedview.md +engines/table_engines/special/memory.md engines/table-engines/special/memory.md +engines/table_engines/special/merge.md engines/table-engines/special/merge.md +engines/table_engines/special/null.md engines/table-engines/special/null.md +engines/table_engines/special/set.md engines/table-engines/special/set.md +engines/table_engines/special/url.md engines/table-engines/special/url.md +engines/table_engines/special/view.md engines/table-engines/special/view.md +extended_roadmap.md whats-new/extended-roadmap.md formats.md interfaces/formats.md formats/capnproto.md interfaces/formats.md formats/csv.md interfaces/formats.md @@ -68,201 +113,337 @@ formats/values.md interfaces/formats.md formats/vertical.md interfaces/formats.md formats/verticalraw.md interfaces/formats.md formats/xml.md interfaces/formats.md -functions/arithmetic_functions.md query_language/functions/arithmetic_functions.md -functions/array_functions.md query_language/functions/array_functions.md -functions/array_join.md query_language/functions/array_join.md -functions/bit_functions.md query_language/functions/bit_functions.md -functions/bitmap_functions.md query_language/functions/bitmap_functions.md -functions/comparison_functions.md query_language/functions/comparison_functions.md -functions/conditional_functions.md query_language/functions/conditional_functions.md -functions/date_time_functions.md query_language/functions/date_time_functions.md -functions/encoding_functions.md query_language/functions/encoding_functions.md -functions/ext_dict_functions.md query_language/functions/ext_dict_functions.md -functions/hash_functions.md query_language/functions/hash_functions.md -functions/higher_order_functions.md query_language/functions/higher_order_functions.md -functions/in_functions.md query_language/functions/in_functions.md -functions/index.md query_language/functions/index.md -functions/ip_address_functions.md query_language/functions/ip_address_functions.md -functions/json_functions.md query_language/functions/json_functions.md -functions/logical_functions.md query_language/functions/logical_functions.md -functions/math_functions.md query_language/functions/math_functions.md -functions/other_functions.md query_language/functions/other_functions.md -functions/random_functions.md query_language/functions/random_functions.md -functions/rounding_functions.md query_language/functions/rounding_functions.md -functions/splitting_merging_functions.md query_language/functions/splitting_merging_functions.md -functions/string_functions.md query_language/functions/string_functions.md -functions/string_replace_functions.md query_language/functions/string_replace_functions.md -functions/string_search_functions.md query_language/functions/string_search_functions.md -functions/type_conversion_functions.md query_language/functions/type_conversion_functions.md -functions/url_functions.md query_language/functions/url_functions.md -functions/ym_dict_functions.md query_language/functions/ym_dict_functions.md +functions/arithmetic_functions.md query-language/functions/arithmetic-functions.md +functions/array_functions.md query-language/functions/array-functions.md +functions/array_join.md query-language/functions/array-join.md +functions/bit_functions.md query-language/functions/bit-functions.md +functions/bitmap_functions.md query-language/functions/bitmap-functions.md +functions/comparison_functions.md query-language/functions/comparison-functions.md +functions/conditional_functions.md query-language/functions/conditional-functions.md +functions/date_time_functions.md query-language/functions/date-time-functions.md +functions/encoding_functions.md query-language/functions/encoding-functions.md +functions/ext_dict_functions.md query-language/functions/ext-dict-functions.md +functions/hash_functions.md query-language/functions/hash-functions.md +functions/higher_order_functions.md query-language/functions/higher-order-functions.md +functions/in_functions.md query-language/functions/in-functions.md +functions/index.md query-language/functions/index.md +functions/ip_address_functions.md query-language/functions/ip-address-functions.md +functions/json_functions.md query-language/functions/json-functions.md +functions/logical_functions.md query-language/functions/logical-functions.md +functions/math_functions.md query-language/functions/math-functions.md +functions/other_functions.md query-language/functions/other-functions.md +functions/random_functions.md query-language/functions/random-functions.md +functions/rounding_functions.md query-language/functions/rounding-functions.md +functions/splitting_merging_functions.md query-language/functions/splitting-merging-functions.md +functions/string_functions.md query-language/functions/string-functions.md +functions/string_replace_functions.md query-language/functions/string-replace-functions.md +functions/string_search_functions.md query-language/functions/string-search-functions.md +functions/type_conversion_functions.md query-language/functions/type-conversion-functions.md +functions/url_functions.md query-language/functions/url-functions.md +functions/ym_dict_functions.md query-language/functions/ym-dict-functions.md +getting_started/example_datasets/amplab_benchmark.md getting-started/example-datasets/amplab-benchmark.md +getting_started/example_datasets/criteo.md getting-started/example-datasets/criteo.md +getting_started/example_datasets/index.md getting-started/example-datasets/index.md +getting_started/example_datasets/metrica.md getting-started/example-datasets/metrica.md +getting_started/example_datasets/nyc_taxi.md getting-started/example-datasets/nyc-taxi.md +getting_started/example_datasets/ontime.md getting-started/example-datasets/ontime.md +getting_started/example_datasets/star_schema.md getting-started/example-datasets/star-schema.md +getting_started/example_datasets/wikistat.md getting-started/example-datasets/wikistat.md +getting_started/index.md getting-started/index.md +getting_started/install.md getting-started/install.md +getting_started/playground.md getting-started/playground.md +getting_started/tutorial.md getting-started/tutorial.md +guides/apply_catboost_model.md guides/apply-catboost-model.md +images/column_oriented.gif images/column-oriented.gif +images/row_oriented.gif images/row-oriented.gif interfaces/http_interface.md interfaces/http.md -interfaces/third-party_client_libraries.md interfaces/third-party/client_libraries.md +interfaces/third-party/client_libraries.md interfaces/third-party/client-libraries.md +interfaces/third-party_client_libraries.md interfaces/third-party/client-libraries.md interfaces/third-party_gui.md interfaces/third-party/gui.md -introduction/features_considered_disadvantages.md introduction/distinctive_features.md +introduction/distinctive_features.md introduction/distinctive-features.md +introduction/features_considered_disadvantages.md introduction/distinctive-features.md introduction/possible_silly_questions.md faq/general.md introduction/ya_metrika_task.md introduction/history.md -operations/performance/sampling_query_profiler.md operations/optimizing_performance/sampling_query_profiler.md -operations/server_settings/index.md operations/server_configuration_parameters/index.md -operations/server_settings/settings.md operations/server_configuration_parameters/settings.md -operations/table_engines/aggregatingmergetree.md engines/table_engines/mergetree_family/aggregatingmergetree.md -operations/table_engines/buffer.md engines/table_engines/special/buffer.md -operations/table_engines/collapsingmergetree.md engines/table_engines/mergetree_family/collapsingmergetree.md -operations/table_engines/custom_partitioning_key.md engines/table_engines/mergetree_family/custom_partitioning_key.md -operations/table_engines/dictionary.md engines/table_engines/special/dictionary.md -operations/table_engines/distributed.md engines/table_engines/special/distributed.md -operations/table_engines/external_data.md engines/table_engines/special/external_data.md -operations/table_engines/file.md engines/table_engines/special/file.md -operations/table_engines/generate.md engines/table_engines/special/generate.md -operations/table_engines/graphitemergetree.md engines/table_engines/mergetree_family/graphitemergetree.md -operations/table_engines/hdfs.md engines/table_engines/integrations/hdfs.md -operations/table_engines/index.md engines/table_engines/index.md -operations/table_engines/jdbc.md engines/table_engines/integrations/jdbc.md -operations/table_engines/join.md engines/table_engines/special/join.md -operations/table_engines/kafka.md engines/table_engines/integrations/kafka.md -operations/table_engines/log.md engines/table_engines/log_family/log.md -operations/table_engines/log_family.md engines/table_engines/log_family/log_family.md -operations/table_engines/materializedview.md engines/table_engines/special/materializedview.md -operations/table_engines/memory.md engines/table_engines/special/memory.md -operations/table_engines/merge.md engines/table_engines/special/merge.md -operations/table_engines/mergetree.md engines/table_engines/mergetree_family/mergetree.md -operations/table_engines/mysql.md engines/table_engines/integrations/mysql.md -operations/table_engines/null.md engines/table_engines/special/null.md -operations/table_engines/odbc.md engines/table_engines/integrations/odbc.md -operations/table_engines/replacingmergetree.md engines/table_engines/mergetree_family/replacingmergetree.md -operations/table_engines/replication.md engines/table_engines/mergetree_family/replication.md -operations/table_engines/set.md engines/table_engines/special/set.md -operations/table_engines/stripelog.md engines/table_engines/log_family/stripelog.md -operations/table_engines/summingmergetree.md engines/table_engines/mergetree_family/summingmergetree.md -operations/table_engines/tinylog.md engines/table_engines/log_family/tinylog.md -operations/table_engines/url.md engines/table_engines/special/url.md -operations/table_engines/versionedcollapsingmergetree.md engines/table_engines/mergetree_family/versionedcollapsingmergetree.md -operations/table_engines/view.md engines/table_engines/special/view.md +operations/access_rights.md operations/access-rights.md +operations/configuration_files.md operations/configuration-files.md +operations/optimizing_performance/index.md operations/optimizing-performance/index.md +operations/optimizing_performance/sampling_query_profiler.md operations/optimizing-performance/sampling-query-profiler.md +operations/performance/sampling_query_profiler.md operations/optimizing-performance/sampling-query-profiler.md +operations/performance_test.md operations/performance-test.md +operations/server_configuration_parameters/index.md operations/server-configuration-parameters/index.md +operations/server_configuration_parameters/settings.md operations/server-configuration-parameters/settings.md +operations/server_settings/index.md operations/server-configuration-parameters/index.md +operations/server_settings/settings.md operations/server-configuration-parameters/settings.md +operations/settings/constraints_on_settings.md operations/settings/constraints-on-settings.md +operations/settings/permissions_for_queries.md operations/settings/permissions-for-queries.md +operations/settings/query_complexity.md operations/settings/query-complexity.md +operations/settings/settings_profiles.md operations/settings/settings-profiles.md +operations/settings/settings_users.md operations/settings/settings-users.md +operations/system_tables.md operations/system-tables.md +operations/table_engines/aggregatingmergetree.md engines/table-engines/mergetree-family/aggregatingmergetree.md +operations/table_engines/buffer.md engines/table-engines/special/buffer.md +operations/table_engines/collapsingmergetree.md engines/table-engines/mergetree-family/collapsingmergetree.md +operations/table_engines/custom_partitioning_key.md engines/table-engines/mergetree-family/custom-partitioning-key.md +operations/table_engines/dictionary.md engines/table-engines/special/dictionary.md +operations/table_engines/distributed.md engines/table-engines/special/distributed.md +operations/table_engines/external_data.md engines/table-engines/special/external-data.md +operations/table_engines/file.md engines/table-engines/special/file.md +operations/table_engines/generate.md engines/table-engines/special/generate.md +operations/table_engines/graphitemergetree.md engines/table-engines/mergetree-family/graphitemergetree.md +operations/table_engines/hdfs.md engines/table-engines/integrations/hdfs.md +operations/table_engines/index.md engines/table-engines/index.md +operations/table_engines/jdbc.md engines/table-engines/integrations/jdbc.md +operations/table_engines/join.md engines/table-engines/special/join.md +operations/table_engines/kafka.md engines/table-engines/integrations/kafka.md +operations/table_engines/log.md engines/table-engines/log-family/log.md +operations/table_engines/log_family.md engines/table-engines/log-family/log-family.md +operations/table_engines/materializedview.md engines/table-engines/special/materializedview.md +operations/table_engines/memory.md engines/table-engines/special/memory.md +operations/table_engines/merge.md engines/table-engines/special/merge.md +operations/table_engines/mergetree.md engines/table-engines/mergetree-family/mergetree.md +operations/table_engines/mysql.md engines/table-engines/integrations/mysql.md +operations/table_engines/null.md engines/table-engines/special/null.md +operations/table_engines/odbc.md engines/table-engines/integrations/odbc.md +operations/table_engines/replacingmergetree.md engines/table-engines/mergetree-family/replacingmergetree.md +operations/table_engines/replication.md engines/table-engines/mergetree-family/replication.md +operations/table_engines/set.md engines/table-engines/special/set.md +operations/table_engines/stripelog.md engines/table-engines/log-family/stripelog.md +operations/table_engines/summingmergetree.md engines/table-engines/mergetree-family/summingmergetree.md +operations/table_engines/tinylog.md engines/table-engines/log-family/tinylog.md +operations/table_engines/url.md engines/table-engines/special/url.md +operations/table_engines/versionedcollapsingmergetree.md engines/table-engines/mergetree-family/versionedcollapsingmergetree.md +operations/table_engines/view.md engines/table-engines/special/view.md operations/utils/clickhouse-benchmark.md operations/utilities/clickhouse-benchmark.md operations/utils/clickhouse-copier.md operations/utilities/clickhouse-copier.md operations/utils/clickhouse-local.md operations/utilities/clickhouse-local.md operations/utils/index.md operations/utilities/index.md -query_language/agg_functions/combinators.md sql_reference/aggregate_functions/combinators.md -query_language/agg_functions/index.md sql_reference/aggregate_functions/index.md -query_language/agg_functions/parametric_functions.md sql_reference/aggregate_functions/parametric_functions.md -query_language/agg_functions/reference.md sql_reference/aggregate_functions/reference.md -query_language/alter.md sql_reference/statements/alter.md -query_language/create.md sql_reference/statements/create.md -query_language/dicts/external_dicts.md sql_reference/dictionaries/external_dictionaries/external_dicts.md -query_language/dicts/external_dicts_dict.md sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md -query_language/dicts/external_dicts_dict_hierarchical.md sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md -query_language/dicts/external_dicts_dict_layout.md sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md -query_language/dicts/external_dicts_dict_lifetime.md sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md -query_language/dicts/external_dicts_dict_sources.md sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md -query_language/dicts/external_dicts_dict_structure.md sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md -query_language/dicts/index.md sql_reference/dictionaries/index.md -query_language/dicts/internal_dicts.md sql_reference/dictionaries/internal_dicts.md -query_language/functions/arithmetic_functions.md sql_reference/functions/arithmetic_functions.md -query_language/functions/array_functions.md sql_reference/functions/array_functions.md -query_language/functions/array_join.md sql_reference/functions/array_join.md -query_language/functions/bit_functions.md sql_reference/functions/bit_functions.md -query_language/functions/bitmap_functions.md sql_reference/functions/bitmap_functions.md -query_language/functions/comparison_functions.md sql_reference/functions/comparison_functions.md -query_language/functions/conditional_functions.md sql_reference/functions/conditional_functions.md -query_language/functions/date_time_functions.md sql_reference/functions/date_time_functions.md -query_language/functions/encoding_functions.md sql_reference/functions/encoding_functions.md -query_language/functions/ext_dict_functions.md sql_reference/functions/ext_dict_functions.md -query_language/functions/functions_for_nulls.md sql_reference/functions/functions_for_nulls.md -query_language/functions/geo.md sql_reference/functions/geo.md -query_language/functions/hash_functions.md sql_reference/functions/hash_functions.md -query_language/functions/higher_order_functions.md sql_reference/functions/higher_order_functions.md -query_language/functions/in_functions.md sql_reference/functions/in_functions.md -query_language/functions/index.md sql_reference/functions/index.md -query_language/functions/introspection.md sql_reference/functions/introspection.md -query_language/functions/ip_address_functions.md sql_reference/functions/ip_address_functions.md -query_language/functions/json_functions.md sql_reference/functions/json_functions.md -query_language/functions/logical_functions.md sql_reference/functions/logical_functions.md -query_language/functions/machine_learning_functions.md sql_reference/functions/machine_learning_functions.md -query_language/functions/math_functions.md sql_reference/functions/math_functions.md -query_language/functions/other_functions.md sql_reference/functions/other_functions.md -query_language/functions/random_functions.md sql_reference/functions/random_functions.md -query_language/functions/rounding_functions.md sql_reference/functions/rounding_functions.md -query_language/functions/splitting_merging_functions.md sql_reference/functions/splitting_merging_functions.md -query_language/functions/string_functions.md sql_reference/functions/string_functions.md -query_language/functions/string_replace_functions.md sql_reference/functions/string_replace_functions.md -query_language/functions/string_search_functions.md sql_reference/functions/string_search_functions.md -query_language/functions/type_conversion_functions.md sql_reference/functions/type_conversion_functions.md -query_language/functions/url_functions.md sql_reference/functions/url_functions.md -query_language/functions/uuid_functions.md sql_reference/functions/uuid_functions.md -query_language/functions/ym_dict_functions.md sql_reference/functions/ym_dict_functions.md -query_language/index.md sql_reference/index.md -query_language/insert_into.md sql_reference/statements/insert_into.md -query_language/misc.md sql_reference/statements/misc.md -query_language/operators.md sql_reference/operators.md -query_language/queries.md query_language.md -query_language/select.md sql_reference/statements/select.md -query_language/show.md sql_reference/statements/show.md -query_language/syntax.md sql_reference/syntax.md -query_language/system.md sql_reference/statements/system.md -query_language/table_functions/file.md sql_reference/table_functions/file.md -query_language/table_functions/generate.md sql_reference/table_functions/generate.md -query_language/table_functions/hdfs.md sql_reference/table_functions/hdfs.md -query_language/table_functions/index.md sql_reference/table_functions/index.md -query_language/table_functions/input.md sql_reference/table_functions/input.md -query_language/table_functions/jdbc.md sql_reference/table_functions/jdbc.md -query_language/table_functions/merge.md sql_reference/table_functions/merge.md -query_language/table_functions/mysql.md sql_reference/table_functions/mysql.md -query_language/table_functions/numbers.md sql_reference/table_functions/numbers.md -query_language/table_functions/odbc.md sql_reference/table_functions/odbc.md -query_language/table_functions/remote.md sql_reference/table_functions/remote.md -query_language/table_functions/url.md sql_reference/table_functions/url.md -roadmap.md whats_new/roadmap.md -security_changelog.md whats_new/security_changelog.md -system_tables.md operations/system_tables.md -system_tables/system.asynchronous_metrics.md operations/system_tables.md -system_tables/system.clusters.md operations/system_tables.md -system_tables/system.columns.md operations/system_tables.md -system_tables/system.databases.md operations/system_tables.md -system_tables/system.dictionaries.md operations/system_tables.md -system_tables/system.events.md operations/system_tables.md -system_tables/system.functions.md operations/system_tables.md -system_tables/system.merges.md operations/system_tables.md -system_tables/system.metrics.md operations/system_tables.md -system_tables/system.numbers.md operations/system_tables.md -system_tables/system.numbers_mt.md operations/system_tables.md -system_tables/system.one.md operations/system_tables.md -system_tables/system.parts.md operations/system_tables.md -system_tables/system.processes.md operations/system_tables.md -system_tables/system.replicas.md operations/system_tables.md -system_tables/system.settings.md operations/system_tables.md -system_tables/system.tables.md operations/system_tables.md -system_tables/system.zookeeper.md operations/system_tables.md -table_engines.md operations/table_engines.md -table_engines/aggregatingmergetree.md operations/table_engines/aggregatingmergetree.md -table_engines/buffer.md operations/table_engines/buffer.md -table_engines/collapsingmergetree.md operations/table_engines/collapsingmergetree.md -table_engines/custom_partitioning_key.md operations/table_engines/custom_partitioning_key.md -table_engines/dictionary.md operations/table_engines/dictionary.md -table_engines/distributed.md operations/table_engines/distributed.md -table_engines/external_data.md operations/table_engines/external_data.md -table_engines/file.md operations/table_engines/file.md -table_engines/graphitemergetree.md operations/table_engines/graphitemergetree.md -table_engines/index.md operations/table_engines/index.md -table_engines/join.md operations/table_engines/join.md -table_engines/kafka.md operations/table_engines/kafka.md -table_engines/log.md operations/table_engines/log.md -table_engines/materializedview.md operations/table_engines/materializedview.md -table_engines/memory.md operations/table_engines/memory.md -table_engines/merge.md operations/table_engines/merge.md -table_engines/mergetree.md operations/table_engines/mergetree.md -table_engines/mysql.md operations/table_engines/mysql.md -table_engines/null.md operations/table_engines/null.md -table_engines/replacingmergetree.md operations/table_engines/replacingmergetree.md -table_engines/replication.md operations/table_engines/replication.md -table_engines/set.md operations/table_engines/set.md -table_engines/summingmergetree.md operations/table_engines/summingmergetree.md -table_engines/tinylog.md operations/table_engines/tinylog.md -table_engines/view.md operations/table_engines/view.md -table_functions/file.md query_language/table_functions/file.md -table_functions/index.md query_language/table_functions/index.md -table_functions/merge.md query_language/table_functions/merge.md -table_functions/numbers.md query_language/table_functions/numbers.md -table_functions/remote.md query_language/table_functions/remote.md +query_language/agg_functions/combinators.md sql-reference/aggregate-functions/combinators.md +query_language/agg_functions/index.md sql-reference/aggregate-functions/index.md +query_language/agg_functions/parametric_functions.md sql-reference/aggregate-functions/parametric-functions.md +query_language/agg_functions/reference.md sql-reference/aggregate-functions/reference.md +query_language/alter.md sql-reference/statements/alter.md +query_language/create.md sql-reference/statements/create.md +query_language/dicts/external_dicts.md sql-reference/dictionaries/external-dictionaries/external-dicts.md +query_language/dicts/external_dicts_dict.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md +query_language/dicts/external_dicts_dict_hierarchical.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md +query_language/dicts/external_dicts_dict_layout.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md +query_language/dicts/external_dicts_dict_lifetime.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md +query_language/dicts/external_dicts_dict_sources.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md +query_language/dicts/external_dicts_dict_structure.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md +query_language/dicts/index.md sql-reference/dictionaries/index.md +query_language/dicts/internal_dicts.md sql-reference/dictionaries/internal-dicts.md +query_language/functions/arithmetic_functions.md sql-reference/functions/arithmetic-functions.md +query_language/functions/array_functions.md sql-reference/functions/array-functions.md +query_language/functions/array_join.md sql-reference/functions/array-join.md +query_language/functions/bit_functions.md sql-reference/functions/bit-functions.md +query_language/functions/bitmap_functions.md sql-reference/functions/bitmap-functions.md +query_language/functions/comparison_functions.md sql-reference/functions/comparison-functions.md +query_language/functions/conditional_functions.md sql-reference/functions/conditional-functions.md +query_language/functions/date_time_functions.md sql-reference/functions/date-time-functions.md +query_language/functions/encoding_functions.md sql-reference/functions/encoding-functions.md +query_language/functions/ext_dict_functions.md sql-reference/functions/ext-dict-functions.md +query_language/functions/functions_for_nulls.md sql-reference/functions/functions-for-nulls.md +query_language/functions/geo.md sql-reference/functions/geo.md +query_language/functions/hash_functions.md sql-reference/functions/hash-functions.md +query_language/functions/higher_order_functions.md sql-reference/functions/higher-order-functions.md +query_language/functions/in_functions.md sql-reference/functions/in-functions.md +query_language/functions/index.md sql-reference/functions/index.md +query_language/functions/introspection.md sql-reference/functions/introspection.md +query_language/functions/ip_address_functions.md sql-reference/functions/ip-address-functions.md +query_language/functions/json_functions.md sql-reference/functions/json-functions.md +query_language/functions/logical_functions.md sql-reference/functions/logical-functions.md +query_language/functions/machine_learning_functions.md sql-reference/functions/machine-learning-functions.md +query_language/functions/math_functions.md sql-reference/functions/math-functions.md +query_language/functions/other_functions.md sql-reference/functions/other-functions.md +query_language/functions/random_functions.md sql-reference/functions/random-functions.md +query_language/functions/rounding_functions.md sql-reference/functions/rounding-functions.md +query_language/functions/splitting_merging_functions.md sql-reference/functions/splitting-merging-functions.md +query_language/functions/string_functions.md sql-reference/functions/string-functions.md +query_language/functions/string_replace_functions.md sql-reference/functions/string-replace-functions.md +query_language/functions/string_search_functions.md sql-reference/functions/string-search-functions.md +query_language/functions/type_conversion_functions.md sql-reference/functions/type-conversion-functions.md +query_language/functions/url_functions.md sql-reference/functions/url-functions.md +query_language/functions/uuid_functions.md sql-reference/functions/uuid-functions.md +query_language/functions/ym_dict_functions.md sql-reference/functions/ym-dict-functions.md +query_language/index.md sql-reference/index.md +query_language/insert_into.md sql-reference/statements/insert-into.md +query_language/misc.md sql-reference/statements/misc.md +query_language/operators.md sql-reference/operators.md +query_language/queries.md query-language.md +query_language/select.md sql-reference/statements/select.md +query_language/show.md sql-reference/statements/show.md +query_language/syntax.md sql-reference/syntax.md +query_language/system.md sql-reference/statements/system.md +query_language/table_functions/file.md sql-reference/table-functions/file.md +query_language/table_functions/generate.md sql-reference/table-functions/generate.md +query_language/table_functions/hdfs.md sql-reference/table-functions/hdfs.md +query_language/table_functions/index.md sql-reference/table-functions/index.md +query_language/table_functions/input.md sql-reference/table-functions/input.md +query_language/table_functions/jdbc.md sql-reference/table-functions/jdbc.md +query_language/table_functions/merge.md sql-reference/table-functions/merge.md +query_language/table_functions/mysql.md sql-reference/table-functions/mysql.md +query_language/table_functions/numbers.md sql-reference/table-functions/numbers.md +query_language/table_functions/odbc.md sql-reference/table-functions/odbc.md +query_language/table_functions/remote.md sql-reference/table-functions/remote.md +query_language/table_functions/url.md sql-reference/table-functions/url.md +roadmap.md whats-new/roadmap.md +security_changelog.md whats-new/security-changelog.md +sql_reference/aggregate_functions/combinators.md sql-reference/aggregate-functions/combinators.md +sql_reference/aggregate_functions/index.md sql-reference/aggregate-functions/index.md +sql_reference/aggregate_functions/parametric_functions.md sql-reference/aggregate-functions/parametric-functions.md +sql_reference/aggregate_functions/reference.md sql-reference/aggregate-functions/reference.md +sql_reference/ansi.md sql-reference/ansi.md +sql_reference/data_types/aggregatefunction.md sql-reference/data-types/aggregatefunction.md +sql_reference/data_types/array.md sql-reference/data-types/array.md +sql_reference/data_types/boolean.md sql-reference/data-types/boolean.md +sql_reference/data_types/date.md sql-reference/data-types/date.md +sql_reference/data_types/datetime.md sql-reference/data-types/datetime.md +sql_reference/data_types/datetime64.md sql-reference/data-types/datetime64.md +sql_reference/data_types/decimal.md sql-reference/data-types/decimal.md +sql_reference/data_types/domains/index.md sql-reference/data-types/domains/index.md +sql_reference/data_types/domains/ipv4.md sql-reference/data-types/domains/ipv4.md +sql_reference/data_types/domains/ipv6.md sql-reference/data-types/domains/ipv6.md +sql_reference/data_types/domains/overview.md sql-reference/data-types/domains/overview.md +sql_reference/data_types/enum.md sql-reference/data-types/enum.md +sql_reference/data_types/fixedstring.md sql-reference/data-types/fixedstring.md +sql_reference/data_types/float.md sql-reference/data-types/float.md +sql_reference/data_types/index.md sql-reference/data-types/index.md +sql_reference/data_types/int_uint.md sql-reference/data-types/int-uint.md +sql_reference/data_types/nested_data_structures/index.md sql-reference/data-types/nested-data-structures/index.md +sql_reference/data_types/nested_data_structures/nested.md sql-reference/data-types/nested-data-structures/nested.md +sql_reference/data_types/nullable.md sql-reference/data-types/nullable.md +sql_reference/data_types/simpleaggregatefunction.md sql-reference/data-types/simpleaggregatefunction.md +sql_reference/data_types/special_data_types/expression.md sql-reference/data-types/special-data-types/expression.md +sql_reference/data_types/special_data_types/index.md sql-reference/data-types/special-data-types/index.md +sql_reference/data_types/special_data_types/interval.md sql-reference/data-types/special-data-types/interval.md +sql_reference/data_types/special_data_types/nothing.md sql-reference/data-types/special-data-types/nothing.md +sql_reference/data_types/special_data_types/set.md sql-reference/data-types/special-data-types/set.md +sql_reference/data_types/string.md sql-reference/data-types/string.md +sql_reference/data_types/tuple.md sql-reference/data-types/tuple.md +sql_reference/data_types/uuid.md sql-reference/data-types/uuid.md +sql_reference/dictionaries/external_dictionaries/external_dicts.md sql-reference/dictionaries/external-dictionaries/external-dicts.md +sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md +sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md +sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md +sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md +sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md +sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md +sql_reference/dictionaries/external_dictionaries/index.md sql-reference/dictionaries/external-dictionaries/index.md +sql_reference/dictionaries/index.md sql-reference/dictionaries/index.md +sql_reference/dictionaries/internal_dicts.md sql-reference/dictionaries/internal-dicts.md +sql_reference/functions/arithmetic_functions.md sql-reference/functions/arithmetic-functions.md +sql_reference/functions/array_functions.md sql-reference/functions/array-functions.md +sql_reference/functions/array_join.md sql-reference/functions/array-join.md +sql_reference/functions/bit_functions.md sql-reference/functions/bit-functions.md +sql_reference/functions/bitmap_functions.md sql-reference/functions/bitmap-functions.md +sql_reference/functions/comparison_functions.md sql-reference/functions/comparison-functions.md +sql_reference/functions/conditional_functions.md sql-reference/functions/conditional-functions.md +sql_reference/functions/date_time_functions.md sql-reference/functions/date-time-functions.md +sql_reference/functions/encoding_functions.md sql-reference/functions/encoding-functions.md +sql_reference/functions/ext_dict_functions.md sql-reference/functions/ext-dict-functions.md +sql_reference/functions/functions_for_nulls.md sql-reference/functions/functions-for-nulls.md +sql_reference/functions/geo.md sql-reference/functions/geo.md +sql_reference/functions/hash_functions.md sql-reference/functions/hash-functions.md +sql_reference/functions/higher_order_functions.md sql-reference/functions/higher-order-functions.md +sql_reference/functions/in_functions.md sql-reference/functions/in-functions.md +sql_reference/functions/index.md sql-reference/functions/index.md +sql_reference/functions/introspection.md sql-reference/functions/introspection.md +sql_reference/functions/ip_address_functions.md sql-reference/functions/ip-address-functions.md +sql_reference/functions/json_functions.md sql-reference/functions/json-functions.md +sql_reference/functions/logical_functions.md sql-reference/functions/logical-functions.md +sql_reference/functions/machine_learning_functions.md sql-reference/functions/machine-learning-functions.md +sql_reference/functions/math_functions.md sql-reference/functions/math-functions.md +sql_reference/functions/other_functions.md sql-reference/functions/other-functions.md +sql_reference/functions/random_functions.md sql-reference/functions/random-functions.md +sql_reference/functions/rounding_functions.md sql-reference/functions/rounding-functions.md +sql_reference/functions/splitting_merging_functions.md sql-reference/functions/splitting-merging-functions.md +sql_reference/functions/string_functions.md sql-reference/functions/string-functions.md +sql_reference/functions/string_replace_functions.md sql-reference/functions/string-replace-functions.md +sql_reference/functions/string_search_functions.md sql-reference/functions/string-search-functions.md +sql_reference/functions/type_conversion_functions.md sql-reference/functions/type-conversion-functions.md +sql_reference/functions/url_functions.md sql-reference/functions/url-functions.md +sql_reference/functions/uuid_functions.md sql-reference/functions/uuid-functions.md +sql_reference/functions/ym_dict_functions.md sql-reference/functions/ym-dict-functions.md +sql_reference/index.md sql-reference/index.md +sql_reference/operators.md sql-reference/operators.md +sql_reference/statements/alter.md sql-reference/statements/alter.md +sql_reference/statements/create.md sql-reference/statements/create.md +sql_reference/statements/index.md sql-reference/statements/index.md +sql_reference/statements/insert_into.md sql-reference/statements/insert-into.md +sql_reference/statements/misc.md sql-reference/statements/misc.md +sql_reference/statements/select.md sql-reference/statements/select.md +sql_reference/statements/show.md sql-reference/statements/show.md +sql_reference/statements/system.md sql-reference/statements/system.md +sql_reference/syntax.md sql-reference/syntax.md +sql_reference/table_functions/file.md sql-reference/table-functions/file.md +sql_reference/table_functions/generate.md sql-reference/table-functions/generate.md +sql_reference/table_functions/hdfs.md sql-reference/table-functions/hdfs.md +sql_reference/table_functions/index.md sql-reference/table-functions/index.md +sql_reference/table_functions/input.md sql-reference/table-functions/input.md +sql_reference/table_functions/jdbc.md sql-reference/table-functions/jdbc.md +sql_reference/table_functions/merge.md sql-reference/table-functions/merge.md +sql_reference/table_functions/mysql.md sql-reference/table-functions/mysql.md +sql_reference/table_functions/numbers.md sql-reference/table-functions/numbers.md +sql_reference/table_functions/odbc.md sql-reference/table-functions/odbc.md +sql_reference/table_functions/remote.md sql-reference/table-functions/remote.md +sql_reference/table_functions/url.md sql-reference/table-functions/url.md +system_tables.md operations/system-tables.md +system_tables/system.asynchronous_metrics.md operations/system-tables.md +system_tables/system.clusters.md operations/system-tables.md +system_tables/system.columns.md operations/system-tables.md +system_tables/system.databases.md operations/system-tables.md +system_tables/system.dictionaries.md operations/system-tables.md +system_tables/system.events.md operations/system-tables.md +system_tables/system.functions.md operations/system-tables.md +system_tables/system.merges.md operations/system-tables.md +system_tables/system.metrics.md operations/system-tables.md +system_tables/system.numbers.md operations/system-tables.md +system_tables/system.numbers_mt.md operations/system-tables.md +system_tables/system.one.md operations/system-tables.md +system_tables/system.parts.md operations/system-tables.md +system_tables/system.processes.md operations/system-tables.md +system_tables/system.replicas.md operations/system-tables.md +system_tables/system.settings.md operations/system-tables.md +system_tables/system.tables.md operations/system-tables.md +system_tables/system.zookeeper.md operations/system-tables.md +table_engines.md operations/table-engines.md +table_engines/aggregatingmergetree.md operations/table-engines/aggregatingmergetree.md +table_engines/buffer.md operations/table-engines/buffer.md +table_engines/collapsingmergetree.md operations/table-engines/collapsingmergetree.md +table_engines/custom_partitioning_key.md operations/table-engines/custom-partitioning-key.md +table_engines/dictionary.md operations/table-engines/dictionary.md +table_engines/distributed.md operations/table-engines/distributed.md +table_engines/external_data.md operations/table-engines/external-data.md +table_engines/file.md operations/table-engines/file.md +table_engines/graphitemergetree.md operations/table-engines/graphitemergetree.md +table_engines/index.md operations/table-engines/index.md +table_engines/join.md operations/table-engines/join.md +table_engines/kafka.md operations/table-engines/kafka.md +table_engines/log.md operations/table-engines/log.md +table_engines/materializedview.md operations/table-engines/materializedview.md +table_engines/memory.md operations/table-engines/memory.md +table_engines/merge.md operations/table-engines/merge.md +table_engines/mergetree.md operations/table-engines/mergetree.md +table_engines/mysql.md operations/table-engines/mysql.md +table_engines/null.md operations/table-engines/null.md +table_engines/replacingmergetree.md operations/table-engines/replacingmergetree.md +table_engines/replication.md operations/table-engines/replication.md +table_engines/set.md operations/table-engines/set.md +table_engines/summingmergetree.md operations/table-engines/summingmergetree.md +table_engines/tinylog.md operations/table-engines/tinylog.md +table_engines/view.md operations/table-engines/view.md +table_functions/file.md query-language/table-functions/file.md +table_functions/index.md query-language/table-functions/index.md +table_functions/merge.md query-language/table-functions/merge.md +table_functions/numbers.md query-language/table-functions/numbers.md +table_functions/remote.md query-language/table-functions/remote.md utils.md operations/utils.md utils/clickhouse-copier.md operations/utils/clickhouse-copier.md utils/clickhouse-local.md operations/utils/clickhouse-local.md +whats_new/changelog/2017.md whats-new/changelog/2017.md +whats_new/changelog/2018.md whats-new/changelog/2018.md +whats_new/changelog/2019.md whats-new/changelog/2019.md +whats_new/changelog/index.md whats-new/changelog/index.md +whats_new/index.md whats-new/index.md +whats_new/roadmap.md whats-new/roadmap.md +whats_new/security_changelog.md whats-new/security-changelog.md diff --git a/docs/ru/commercial/cloud.md b/docs/ru/commercial/cloud.md index 9716f4f1cd2..6cbc0e6743b 100644 --- a/docs/ru/commercial/cloud.md +++ b/docs/ru/commercial/cloud.md @@ -7,7 +7,7 @@ [Yandex Managed Service for ClickHouse](https://cloud.yandex.ru/services/managed-clickhouse?utm_source=referrals&utm_medium=clickhouseofficialsite&utm_campaign=link3) предоставляет следующие ключевые возможности: -- Полностью управляемый сервис ZooKeeper для [репликации ClickHouse](../engines/table_engines/mergetree_family/replication.md) +- Полностью управляемый сервис ZooKeeper для [репликации ClickHouse](../engines/table-engines/mergetree-family/replication.md) - Выбор типа хранилища - Реплики в разных зонах доступности - Шифрование и изоляция diff --git a/docs/ru/commercial/index.md b/docs/ru/commercial/index.md index dc78f6f4899..6bc3c781161 100644 --- a/docs/ru/commercial/index.md +++ b/docs/ru/commercial/index.md @@ -1,7 +1,9 @@ --- -toc_folder_title: Коммерческие услуги +toc_folder_title: "\u041A\u043E\u043C\u043C\u0435\u0440\u0447\u0435\u0441\u043A\u0438\ + \u0435 \u0443\u0441\u043B\u0443\u0433\u0438" toc_priority: 70 -toc_title: Коммерческие услуги +toc_title: "\u041A\u043E\u043C\u043C\u0435\u0440\u0447\u0435\u0441\u043A\u0438\u0435\ + \ \u0443\u0441\u043B\u0443\u0433\u0438" --- diff --git a/docs/ru/development/browse_code.md b/docs/ru/development/browse-code.md similarity index 100% rename from docs/ru/development/browse_code.md rename to docs/ru/development/browse-code.md diff --git a/docs/ru/development/build-cross-arm.md b/docs/ru/development/build-cross-arm.md new file mode 120000 index 00000000000..134f128a40c --- /dev/null +++ b/docs/ru/development/build-cross-arm.md @@ -0,0 +1 @@ +../../en/development/build-cross-arm.md \ No newline at end of file diff --git a/docs/ru/development/build-cross-osx.md b/docs/ru/development/build-cross-osx.md new file mode 120000 index 00000000000..bcc10df574c --- /dev/null +++ b/docs/ru/development/build-cross-osx.md @@ -0,0 +1 @@ +../../en/development/build-cross-osx.md \ No newline at end of file diff --git a/docs/ru/development/build-osx.md b/docs/ru/development/build-osx.md new file mode 120000 index 00000000000..8e172b919d8 --- /dev/null +++ b/docs/ru/development/build-osx.md @@ -0,0 +1 @@ +../../en/development/build-osx.md \ No newline at end of file diff --git a/docs/ru/development/build_cross_arm.md b/docs/ru/development/build_cross_arm.md deleted file mode 120000 index 983a9872dc1..00000000000 --- a/docs/ru/development/build_cross_arm.md +++ /dev/null @@ -1 +0,0 @@ -../../en/development/build_cross_arm.md \ No newline at end of file diff --git a/docs/ru/development/build_cross_osx.md b/docs/ru/development/build_cross_osx.md deleted file mode 120000 index 72e64e8631f..00000000000 --- a/docs/ru/development/build_cross_osx.md +++ /dev/null @@ -1 +0,0 @@ -../../en/development/build_cross_osx.md \ No newline at end of file diff --git a/docs/ru/development/build_osx.md b/docs/ru/development/build_osx.md deleted file mode 120000 index f9adaf24584..00000000000 --- a/docs/ru/development/build_osx.md +++ /dev/null @@ -1 +0,0 @@ -../../en/development/build_osx.md \ No newline at end of file diff --git a/docs/ru/development/developer_instruction.md b/docs/ru/development/developer-instruction.md similarity index 100% rename from docs/ru/development/developer_instruction.md rename to docs/ru/development/developer-instruction.md diff --git a/docs/ru/development/style.md b/docs/ru/development/style.md index d922e1edd22..b7fff2753dc 100644 --- a/docs/ru/development/style.md +++ b/docs/ru/development/style.md @@ -706,7 +706,7 @@ auto s = std::string{"Hello"}; **4.** ОС - Linux, Mac OS X или FreeBSD. -**5.** Код пишется под процессоры с архитектурой x86_64, AArch64 и ppc64le. +**5.** Код пишется под процессоры с архитектурой x86\_64, AArch64 и ppc64le. **6.** Используются флаги компиляции `-Wall -Wextra -Werror` и `-Weverything` с некоторыми исключениями. diff --git a/docs/ru/engines/database-engines/index.md b/docs/ru/engines/database-engines/index.md new file mode 100644 index 00000000000..79be85518e2 --- /dev/null +++ b/docs/ru/engines/database-engines/index.md @@ -0,0 +1,9 @@ +# Движки баз данных {#dvizhki-baz-dannykh} + +Движки баз данных обеспечивают работу с таблицами. + +По умолчанию ClickHouse использует собственный движок баз данных, который поддерживает конфигурируемые [движки таблиц](../../engines/database-engines/index.md) и [диалект SQL](../../engines/database-engines/index.md). + +Также можно использовать следующие движки баз данных: + +- [MySQL](mysql.md) diff --git a/docs/ru/engines/database_engines/lazy.md b/docs/ru/engines/database-engines/lazy.md similarity index 100% rename from docs/ru/engines/database_engines/lazy.md rename to docs/ru/engines/database-engines/lazy.md diff --git a/docs/ru/engines/database-engines/mysql.md b/docs/ru/engines/database-engines/mysql.md new file mode 100644 index 00000000000..e293cb6ec77 --- /dev/null +++ b/docs/ru/engines/database-engines/mysql.md @@ -0,0 +1,126 @@ +# MySQL {#mysql} + +Позволяет подключаться к базам данных на удалённом MySQL сервере и выполнять запросы `INSERT` и `SELECT` для обмена данными между ClickHouse и MySQL. + +Движок баз данных `MySQL` транслирует запросы при передаче на сервер MySQL, что позволяет выполнять и другие виды запросов, например `SHOW TABLES` или `SHOW CREATE TABLE`. + +Не поддерживаемые виды запросов: + +- `RENAME` +- `CREATE TABLE` +- `ALTER` + +## Создание базы данных {#sozdanie-bazy-dannykh} + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] +ENGINE = MySQL('host:port', ['database' | database], 'user', 'password') +``` + +**Параметры движка** + +- `host:port` — адрес сервера MySQL. +- `database` — имя базы данных на удалённом сервере. +- `user` — пользователь MySQL. +- `password` — пароль пользователя. + +## Поддержка типов данных {#podderzhka-tipov-dannykh} + +| MySQL | ClickHouse | +|----------------------------------|--------------------------------------------------------| +| UNSIGNED TINYINT | [UInt8](../../engines/database-engines/mysql.md) | +| TINYINT | [Int8](../../engines/database-engines/mysql.md) | +| UNSIGNED SMALLINT | [UInt16](../../engines/database-engines/mysql.md) | +| SMALLINT | [Int16](../../engines/database-engines/mysql.md) | +| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../engines/database-engines/mysql.md) | +| INT, MEDIUMINT | [Int32](../../engines/database-engines/mysql.md) | +| UNSIGNED BIGINT | [UInt64](../../engines/database-engines/mysql.md) | +| BIGINT | [Int64](../../engines/database-engines/mysql.md) | +| FLOAT | [Float32](../../engines/database-engines/mysql.md) | +| DOUBLE | [Float64](../../engines/database-engines/mysql.md) | +| DATE | [Date](../../engines/database-engines/mysql.md) | +| DATETIME, TIMESTAMP | [DateTime](../../engines/database-engines/mysql.md) | +| BINARY | [FixedString](../../engines/database-engines/mysql.md) | + +Все прочие типы данных преобразуются в [String](../../engines/database-engines/mysql.md). + +[Nullable](../../engines/database-engines/mysql.md) поддержан. + +## Примеры использования {#primery-ispolzovaniia} + +Таблица в MySQL: + +``` text +mysql> USE test; +Database changed + +mysql> CREATE TABLE `mysql_table` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `float` FLOAT NOT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from mysql_table; ++--------+-------+ +| int_id | value | ++--------+-------+ +| 1 | 2 | ++--------+-------+ +1 row in set (0,00 sec) +``` + +База данных в ClickHouse, позволяющая обмениваться данными с сервером MySQL: + +``` sql +CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') +``` + +``` sql +SHOW DATABASES +``` + +``` text +┌─name─────┐ +│ default │ +│ mysql_db │ +│ system │ +└──────────┘ +``` + +``` sql +SHOW TABLES FROM mysql_db +``` + +``` text +┌─name─────────┐ +│ mysql_table │ +└──────────────┘ +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +└────────┴───────┘ +``` + +``` sql +INSERT INTO mysql_db.mysql_table VALUES (3,4) +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +│ 3 │ 4 │ +└────────┴───────┘ +``` diff --git a/docs/ru/engines/database_engines/index.md b/docs/ru/engines/database_engines/index.md deleted file mode 100644 index 75086eaf678..00000000000 --- a/docs/ru/engines/database_engines/index.md +++ /dev/null @@ -1,9 +0,0 @@ -# Движки баз данных {#dvizhki-baz-dannykh} - -Движки баз данных обеспечивают работу с таблицами. - -По умолчанию ClickHouse использует собственный движок баз данных, который поддерживает конфигурируемые [движки таблиц](../../engines/database_engines/index.md) и [диалект SQL](../../engines/database_engines/index.md). - -Также можно использовать следующие движки баз данных: - -- [MySQL](mysql.md) diff --git a/docs/ru/engines/database_engines/mysql.md b/docs/ru/engines/database_engines/mysql.md deleted file mode 100644 index 1dbcb67e8f1..00000000000 --- a/docs/ru/engines/database_engines/mysql.md +++ /dev/null @@ -1,126 +0,0 @@ -# MySQL {#mysql} - -Позволяет подключаться к базам данных на удалённом MySQL сервере и выполнять запросы `INSERT` и `SELECT` для обмена данными между ClickHouse и MySQL. - -Движок баз данных `MySQL` транслирует запросы при передаче на сервер MySQL, что позволяет выполнять и другие виды запросов, например `SHOW TABLES` или `SHOW CREATE TABLE`. - -Не поддерживаемые виды запросов: - -- `RENAME` -- `CREATE TABLE` -- `ALTER` - -## Создание базы данных {#sozdanie-bazy-dannykh} - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] -ENGINE = MySQL('host:port', ['database' | database], 'user', 'password') -``` - -**Параметры движка** - -- `host:port` — адрес сервера MySQL. -- `database` — имя базы данных на удалённом сервере. -- `user` — пользователь MySQL. -- `password` — пароль пользователя. - -## Поддержка типов данных {#podderzhka-tipov-dannykh} - -| MySQL | ClickHouse | -|----------------------------------|---------------------------------------------| -| UNSIGNED TINYINT | [UInt8](../../engines/database_engines/mysql.md) | -| TINYINT | [Int8](../../engines/database_engines/mysql.md) | -| UNSIGNED SMALLINT | [UInt16](../../engines/database_engines/mysql.md) | -| SMALLINT | [Int16](../../engines/database_engines/mysql.md) | -| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../engines/database_engines/mysql.md) | -| INT, MEDIUMINT | [Int32](../../engines/database_engines/mysql.md) | -| UNSIGNED BIGINT | [UInt64](../../engines/database_engines/mysql.md) | -| BIGINT | [Int64](../../engines/database_engines/mysql.md) | -| FLOAT | [Float32](../../engines/database_engines/mysql.md) | -| DOUBLE | [Float64](../../engines/database_engines/mysql.md) | -| DATE | [Date](../../engines/database_engines/mysql.md) | -| DATETIME, TIMESTAMP | [DateTime](../../engines/database_engines/mysql.md) | -| BINARY | [FixedString](../../engines/database_engines/mysql.md) | - -Все прочие типы данных преобразуются в [String](../../engines/database_engines/mysql.md). - -[Nullable](../../engines/database_engines/mysql.md) поддержан. - -## Примеры использования {#primery-ispolzovaniia} - -Таблица в MySQL: - -``` text -mysql> USE test; -Database changed - -mysql> CREATE TABLE `mysql_table` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `float` FLOAT NOT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from mysql_table; -+--------+-------+ -| int_id | value | -+--------+-------+ -| 1 | 2 | -+--------+-------+ -1 row in set (0,00 sec) -``` - -База данных в ClickHouse, позволяющая обмениваться данными с сервером MySQL: - -``` sql -CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') -``` - -``` sql -SHOW DATABASES -``` - -``` text -┌─name─────┐ -│ default │ -│ mysql_db │ -│ system │ -└──────────┘ -``` - -``` sql -SHOW TABLES FROM mysql_db -``` - -``` text -┌─name─────────┐ -│ mysql_table │ -└──────────────┘ -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -└────────┴───────┘ -``` - -``` sql -INSERT INTO mysql_db.mysql_table VALUES (3,4) -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -│ 3 │ 4 │ -└────────┴───────┘ -``` diff --git a/docs/ru/engines/index.md b/docs/ru/engines/index.md index a3d85155cbb..333e65dcb7b 100644 --- a/docs/ru/engines/index.md +++ b/docs/ru/engines/index.md @@ -1,5 +1,5 @@ --- -toc_folder_title: Движки +toc_folder_title: "\u0414\u0432\u0438\u0436\u043A\u0438" toc_priority: 25 --- diff --git a/docs/ru/engines/table-engines/index.md b/docs/ru/engines/table-engines/index.md new file mode 100644 index 00000000000..39db5ffd12f --- /dev/null +++ b/docs/ru/engines/table-engines/index.md @@ -0,0 +1,76 @@ +# Движки таблиц {#table_engines} + +Движок таблицы (тип таблицы) определяет: + +- Как и где хранятся данные, куда их писать и откуда читать. +- Какие запросы поддерживаются и каким образом. +- Конкурентный доступ к данным. +- Использование индексов, если есть. +- Возможно ли многопоточное выполнение запроса. +- Параметры репликации данных. + +## Семейства движков {#semeistva-dvizhkov} + +### MergeTree {#mergetree} + +Наиболее универсальные и функциональные движки таблиц для задач с высокой загрузкой. Общим свойством этих движков является быстрая вставка данных с последующей фоновой обработкой данных. Движки `*MergeTree` поддерживают репликацию данных (в [Replicated\*](mergetree-family/replication.md) версиях движков), партиционирование, и другие возможности не поддержанные для других движков. + +Движки семейства: + +- [MergeTree](mergetree-family/mergetree.md) +- [ReplacingMergeTree](mergetree-family/replacingmergetree.md) +- [SummingMergeTree](mergetree-family/summingmergetree.md) +- [AggregatingMergeTree](mergetree-family/aggregatingmergetree.md) +- [CollapsingMergeTree](mergetree-family/collapsingmergetree.md) +- [VersionedCollapsingMergeTree](mergetree-family/versionedcollapsingmergetree.md) +- [GraphiteMergeTree](mergetree-family/graphitemergetree.md) + +### Log {#log} + +Простые [движки](log-family/index.md) с минимальной функциональностью. Они наиболее эффективны, когда вам нужно быстро записать много небольших таблиц (до примерно 1 миллиона строк) и прочитать их позже целиком. + +Движки семейства: + +- [TinyLog](log-family/tinylog.md) +- [StripeLog](log-family/stripelog.md) +- [Log](log-family/log.md) + +### Движки для интеграции {#dvizhki-dlia-integratsii} + +Движки для связи с другими системами хранения и обработки данных. + +Движки семейства: + +- [Kafka](integrations/kafka.md) +- [MySQL](integrations/mysql.md) +- [ODBC](integrations/odbc.md) +- [JDBC](integrations/jdbc.md) + +### Специальные движки {#spetsialnye-dvizhki} + +Движки семейства: + +- [Distributed](special/distributed.md) +- [MaterializedView](special/materializedview.md) +- [Dictionary](special/dictionary.md) +- [Merge](special/merge.md) +- [File](special/file.md) +- [Null](special/null.md) +- [Set](special/set.md) +- [Join](special/join.md) +- [URL](special/url.md) +- [View](special/view.md) +- [Memory](special/memory.md) +- [Buffer](special/buffer.md) + +## Виртуальные столбцы {#table_engines-virtual-columns} + +Виртуальный столбец — это неотъемлемый атрибут движка таблиц, определенный в исходном коде движка. + +Виртуальные столбцы не надо указывать в запросе `CREATE TABLE` и их не отображаются в результатах запросов `SHOW CREATE TABLE` и `DESCRIBE TABLE`. Также виртуальные столбцы доступны только для чтения, поэтому вы не можете вставлять в них данные. + +Чтобы получить данные из виртуального столбца, необходимо указать его название в запросе `SELECT`. `SELECT *` не отображает данные из виртуальных столбцов. + +При создании таблицы со столбцом, имя которого совпадает с именем одного из виртуальных столбцов таблицы, виртуальный столбец становится недоступным. Не делайте так. Чтобы помочь избежать конфликтов, имена виртуальных столбцов обычно предваряются подчеркиванием. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/) diff --git a/docs/ru/engines/table-engines/integrations/hdfs.md b/docs/ru/engines/table-engines/integrations/hdfs.md new file mode 100644 index 00000000000..1926ca1ee33 --- /dev/null +++ b/docs/ru/engines/table-engines/integrations/hdfs.md @@ -0,0 +1,112 @@ +# HDFS {#table_engines-hdfs} + +Управляет данными в HDFS. Данный движок похож на движки [File](../special/file.md) и [URL](../special/url.md). + +## Использование движка {#ispolzovanie-dvizhka} + +``` sql +ENGINE = HDFS(URI, format) +``` + +В параметр `URI` нужно передавать полный URI файла в HDFS. +Параметр `format` должен быть таким, который ClickHouse может использовать и в запросах `INSERT`, и в запросах `SELECT`. Полный список поддерживаемых форматов смотрите в разделе [Форматы](../../../interfaces/formats.md#formats). +Часть URI с путем файла может содержать шаблоны. В этом случае таблица может использоваться только для чтения. + +**Пример:** + +**1.** Создадим на сервере таблицу `hdfs_engine_table`: + +``` sql +CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') +``` + +**2.** Заполним файл: + +``` sql +INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) +``` + +**3.** Запросим данные: + +``` sql +SELECT * FROM hdfs_engine_table LIMIT 2 +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Детали реализации {#detali-realizatsii} + +- Поддерживается многопоточное чтение и запись. +- Не поддерживается: + - использование операций `ALTER` и `SELECT...SAMPLE`; + - индексы; + - репликация. + +**Шаблоны в пути** + +Шаблоны могут содержаться в нескольких компонентах пути. Обрабатываются только существующие файлы, название которых целиком удовлетворяет шаблону (не только суффиксом или префиксом). + +- `*` — Заменяет любое количество любых символов кроме `/`, включая отсутствие символов. +- `?` — Заменяет ровно один любой символ. +- `{some_string,another_string,yet_another_one}` — Заменяет любую из строк `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Заменяет любое число в интервале от `N` до `M` включительно (может содержать ведущие нули). + +Конструкция с `{}` аналогична табличной функции [remote](../../../engines/table-engines/integrations/hdfs.md). + +**Пример** + +1. Предположим, у нас есть несколько файлов со следующими URI в HDFS: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. Есть несколько возможностей создать таблицу, состояющую из этих шести файлов: + + + +``` sql +CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') +``` + +Другой способ: + +``` sql +CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') +``` + +Таблица, состоящая из всех файлов в обеих директориях (все файлы должны удовлетворять формату и схеме, указанной в запросе): + +``` sql +CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') +``` + +!!! warning "Warning" + Если список файлов содержит числовые интервалы с ведущими нулями, используйте конструкцию с фигурными скобочками для каждой цифры или используйте `?`. + +**Example** + +Создадим таблицу с именами `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') +``` + +## Виртуальные столбцы {#virtualnye-stolbtsy} + +- `_path` — Путь к файлу. +- `_file` — Имя файла. + +**Смотрите также** + +- [Виртуальные столбцы](index.md#table_engines-virtual_columns) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/hdfs/) diff --git a/docs/ru/engines/table-engines/integrations/index.md b/docs/ru/engines/table-engines/integrations/index.md new file mode 100644 index 00000000000..dd005919ad1 --- /dev/null +++ b/docs/ru/engines/table-engines/integrations/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Integrations +toc_priority: 30 +--- + + diff --git a/docs/ru/engines/table-engines/integrations/jdbc.md b/docs/ru/engines/table-engines/integrations/jdbc.md new file mode 100644 index 00000000000..1f50e1ff770 --- /dev/null +++ b/docs/ru/engines/table-engines/integrations/jdbc.md @@ -0,0 +1,87 @@ +# JDBC {#jdbc} + +Позволяет ClickHouse подключаться к внешним базам данных с помощью [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). + +Для реализации соединения по JDBC ClickHouse использует отдельную программу [clickhouse-jdbc-bridge](https://github.com/alex-krash/clickhouse-jdbc-bridge), которая должна запускаться как демон. + +Движок поддерживает тип данных [Nullable](../../../engines/table-engines/integrations/jdbc.md). + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name +ENGINE = JDBC(dbms_uri, external_database, external_table) +``` + +**Параметры движка** + +- `dbms_uri` — URI внешней СУБД. + + Формат: `jdbc:://:/?user=&password=`. + + Пример для MySQL: `jdbc:mysql://localhost:3306/?user=root&password=root`. + +- `external_database` — база данных во внешней СУБД. + +- `external_table` — таблица в `external_database`. + +## Пример использования {#primer-ispolzovaniia} + +Создадим таблицу в на сервере MySQL с помощью консольного клиента MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++--------+--------------+-------+----------------+ +| int_id | int_nullable | float | float_nullable | ++--------+--------------+-------+----------------+ +| 1 | NULL | 2 | NULL | ++--------+--------------+-------+----------------+ +1 row in set (0,00 sec) +``` + +Создадим таблицу на сервере ClickHouse и получим из неё данные: + +``` sql +CREATE TABLE jdbc_table ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') +``` + +``` sql +DESCRIBE TABLE jdbc_table +``` + +``` text +┌─name───────────────┬─type───────────────┬─default_type─┬─default_expression─┐ +│ int_id │ Int32 │ │ │ +│ int_nullable │ Nullable(Int32) │ │ │ +│ float │ Float32 │ │ │ +│ float_nullable │ Nullable(Float32) │ │ │ +└────────────────────┴────────────────────┴──────────────┴────────────────────┘ +``` + +``` sql +SELECT * +FROM jdbc_table +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Смотрите также {#smotrite-takzhe} + +- [Табличная функция JDBC](../../../engines/table-engines/integrations/jdbc.md). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/jdbc/) diff --git a/docs/ru/engines/table_engines/integrations/kafka.md b/docs/ru/engines/table-engines/integrations/kafka.md similarity index 100% rename from docs/ru/engines/table_engines/integrations/kafka.md rename to docs/ru/engines/table-engines/integrations/kafka.md diff --git a/docs/ru/engines/table-engines/integrations/mysql.md b/docs/ru/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..9891fe79959 --- /dev/null +++ b/docs/ru/engines/table-engines/integrations/mysql.md @@ -0,0 +1,98 @@ +# MySQL {#mysql} + +Движок MySQL позволяет выполнять запросы `SELECT` над данными, хранящимися на удалённом MySQL сервере. + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... +) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table-engines/integrations/mysql.md#create-table-query). + +Структура таблицы может отличаться от исходной структуры таблицы MySQL: + +- Имена столбцов должны быть такими же, как в исходной таблице MySQL, но вы можете использовать только некоторые из этих столбцов и в любом порядке. +- Типы столбцов могут отличаться от типов в исходной таблице MySQL. ClickHouse пытается [приводить](../../../engines/table-engines/integrations/mysql.md#type_conversion_function-cast) значения к типам данных ClickHouse. + +**Параметры движка** + +- `host:port` — адрес сервера MySQL. + +- `database` — имя базы данных на удалённом сервере. + +- `table` — имя таблицы на удалённом сервере. + +- `user` — пользователь MySQL. + +- `password` — пароль пользователя. + +- `replace_query` — флаг, отвечающий за преобразование запросов `INSERT INTO` в `REPLACE INTO`. Если `replace_query=1`, то запрос заменяется. + +- `on_duplicate_clause` — выражение `ON DUPLICATE KEY on_duplicate_clause`, добавляемое к запросу `INSERT`. + + Пример: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, где `on_duplicate_clause` это `UPDATE c2 = c2 + 1`. Чтобы узнать какие `on_duplicate_clause` можно использовать с секцией `ON DUPLICATE KEY` обратитесь к [документации MySQL](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html). + + Чтобы указать `on_duplicate_clause` необходимо передать `0` в параметр `replace_query`. Если одновременно передать `replace_query = 1` и `on_duplicate_clause`, то ClickHouse сгенерирует исключение. + +Простые условия `WHERE` такие как `=, !=, >, >=, <, =` выполняются на стороне сервера MySQL. + +Остальные условия и ограничение выборки `LIMIT` будут выполнены в ClickHouse только после выполнения запроса к MySQL. + +## Пример использования {#primer-ispolzovaniia} + +Таблица в MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++--------+--------------+-------+----------------+ +| int_id | int_nullable | float | float_nullable | ++--------+--------------+-------+----------------+ +| 1 | NULL | 2 | NULL | ++--------+--------------+-------+----------------+ +1 row in set (0,00 sec) +``` + +Таблица в ClickHouse, которая получает данные из созданной ранее таблицы MySQL: + +``` sql +CREATE TABLE mysql_table +( + `float_nullable` Nullable(Float32), + `int_id` Int32 +) +ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` sql +SELECT * FROM mysql_table +``` + +``` text +┌─float_nullable─┬─int_id─┐ +│ ᴺᵁᴸᴸ │ 1 │ +└────────────────┴────────┘ +``` + +## Смотрите также {#smotrite-takzhe} + +- [Табличная функция ‘mysql’](../../../engines/table-engines/integrations/mysql.md) +- [Использование MySQL в качестве источника для внешнего словаря](../../../engines/table-engines/integrations/mysql.md#dicts-external_dicts_dict_sources-mysql) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/mysql/) diff --git a/docs/ru/engines/table-engines/integrations/odbc.md b/docs/ru/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..aecdbbf038d --- /dev/null +++ b/docs/ru/engines/table-engines/integrations/odbc.md @@ -0,0 +1,125 @@ +# ODBC {#table-engine-odbc} + +Позволяет ClickHouse подключаться к внешним базам данных с помощью [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +Чтобы использование ODBC было безопасным, ClickHouse использует отдельную программу `clickhouse-odbc-bridge`. Если драйвер ODBC подгружать непосредственно из `clickhouse-server`, то проблемы с драйвером могут привести к аварийной остановке сервера ClickHouse. ClickHouse автоматически запускает `clickhouse-odbc-bridge` по мере необходимости. Программа устанавливается из того же пакета, что и `clickhouse-server`. + +Движок поддерживает тип данных [Nullable](../../../engines/table-engines/integrations/odbc.md). + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table-engines/integrations/odbc.md#create-table-query). + +Структура таблицы может отличаться от структуры исходной таблицы в удалённой СУБД: + +- Имена столбцов должны быть такими же, как в исходной таблице, но вы можете использовать только некоторые из этих столбцов и в любом порядке. +- Типы столбцов могут отличаться от типов аналогичных столбцов в исходной таблице. ClickHouse пытается [приводить](../../../engines/table-engines/integrations/odbc.md#type_conversion_function-cast) значения к типам данных ClickHouse. + +**Параметры движка** + +- `connection_settings` — название секции с настройками соединения в файле `odbc.ini`. +- `external_database` — имя базы данных во внешней СУБД. +- `external_table` — имя таблицы в `external_database`. + +## Пример использования {#primer-ispolzovaniia} + +**Извлечение данных из локальной установки MySQL через ODBC** + +Этот пример проверялся в Ubuntu Linux 18.04 для MySQL server 5.7. + +Убедитесь, что unixODBC и MySQL Connector установлены. + +По умолчанию (если установлен из пакетов) ClickHouse запускается от имени пользователя `clickhouse`. Таким образом, вам нужно создать и настроить этого пользователя на сервере MySQL. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +Теперь настроим соединение в `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Вы можете проверить соединение с помощью утилиты `isql` из установки unixODBC. + +``` bash +$ isql -v mysqlconn ++---------------------------------------+ +| Connected! | +| | +... +``` + +Таблица в MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++--------+--------------+-------+----------------+ +| int_id | int_nullable | float | float_nullable | ++--------+--------------+-------+----------------+ +| 1 | NULL | 2 | NULL | ++--------+--------------+-------+----------------+ +1 row in set (0,00 sec) +``` + +Таблица в ClickHouse, которая получает данные из таблицы MySQL: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## Смотрите также {#smotrite-takzhe} + +- [Внешние словари ODBC](../../../engines/table-engines/integrations/odbc.md#dicts-external_dicts_dict_sources-odbc) +- [Табличная функция odbc](../../../engines/table-engines/integrations/odbc.md) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/odbc/) diff --git a/docs/ru/engines/table-engines/log-family/index.md b/docs/ru/engines/table-engines/log-family/index.md new file mode 100644 index 00000000000..a5d93c4c7c3 --- /dev/null +++ b/docs/ru/engines/table-engines/log-family/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Log Family +toc_priority: 29 +--- + + diff --git a/docs/ru/engines/table-engines/log-family/log-family.md b/docs/ru/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..e5156c95f9e --- /dev/null +++ b/docs/ru/engines/table-engines/log-family/log-family.md @@ -0,0 +1,39 @@ +# Семейство Log {#semeistvo-log} + +Движки разработаны для сценариев, когда необходимо быстро записывать много таблиц с небольшим объёмом данных (менее 1 миллиона строк), а затем читать их целиком. + +Движки семейства: + +- [StripeLog](stripelog.md) +- [Log](log.md) +- [TinyLog](tinylog.md) + +## Общие свойства {#obshchie-svoistva} + +Движки: + +- Хранят данные на диске. + +- Добавляют данные в конец файла при записи. + +- Поддерживают блокировки для конкурентного доступа к данным. + + Во время запросов `INSERT` таблица блокируется, а другие запросы на чтение и запись ожидают разблокировки таблицы. Если запросов на запись данных нет, то можно выполнять любое количество конкуретных запросов на чтение. + +- Не поддерживают операции [мутации](../../../engines/table-engines/log-family/log-family.md#alter-mutations). + +- Не поддерживают индексы. + + Это означает, что запросы `SELECT` не эффективны для выборки диапазонов данных. + +- Записывают данные не атомарно. + + Вы можете получить таблицу с повреждёнными данными, если что-то прервёт операцию записи (например, аварийное завершение работы сервера). + +## Отличия {#otlichiia} + +Движок `TinyLog` самый простой в семье и обеспечивает самые низкие функциональность и эффективность. Движок `TinyLog` не поддерживает параллельного чтения данных в несколько потоков. Движок читает данные медленнее, чем оба других движка с параллельным чтением, и использует почти столько же дескрипторов, сколько и движок `Log`, поскольку хранит каждый столбец в отдельном файле. Его можно использовать в простых сценариях с низкой нагрузкой. + +Движки `Log` и `StripeLog` поддерживают параллельное чтение. При чтении данных, ClickHouse использует множество потоков. Каждый поток обрабатывает отдельный блок данных. Движок `Log` сохраняет каждый столбец таблицы в отдельном файле. Движок `StripeLog` хранит все данные в одном файле. Таким образом, движок `StripeLog` использует меньше дескрипторов в операционной системе, а движок `Log` обеспечивает более эффективное считывание данных. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/log_family/) diff --git a/docs/ru/engines/table-engines/log-family/log.md b/docs/ru/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..84474b3f40a --- /dev/null +++ b/docs/ru/engines/table-engines/log-family/log.md @@ -0,0 +1,9 @@ +# Log {#log} + +Движок относится к семейству движков Log. Смотрите общие свойства и различия движков в статье [Семейство Log](log-family.md). + +Отличается от [TinyLog](tinylog.md) тем, что вместе с файлами столбцов лежит небольшой файл «засечек». Засечки пишутся на каждый блок данных и содержат смещение - с какого места нужно читать файл, чтобы пропустить заданное количество строк. Это позволяет читать данные из таблицы в несколько потоков. +При конкурентном доступе к данным, чтения могут выполняться одновременно, а записи блокируют чтения и друг друга. +Движок Log не поддерживает индексы. Также, если при записи в таблицу произошёл сбой, то таблица станет битой, и чтения из неё будут возвращать ошибку. Движок Log подходит для временных данных, write-once таблиц, а также для тестовых и демонстрационных целей. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/log/) diff --git a/docs/ru/engines/table-engines/log-family/stripelog.md b/docs/ru/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..d129cc055da --- /dev/null +++ b/docs/ru/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,88 @@ +# StripeLog {#stripelog} + +Движок относится к семейству движков Log. Смотрите общие свойства и различия движков в статье [Семейство Log](log-family.md). + +Движок разработан для сценариев, когда необходимо записывать много таблиц с небольшим объёмом данных (менее 1 миллиона строк). + +## Создание таблицы {#table_engines-stripelog-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = StripeLog +``` + +Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table-engines/log-family/stripelog.md#create-table-query). + +## Запись данных {#table_engines-stripelog-writing-the-data} + +Движок `StripeLog` хранит все столбцы в одном файле. При каждом запросе `INSERT`, ClickHouse добавляет блок данных в конец файла таблицы, записывая столбцы один за другим. + +Для каждой таблицы ClickHouse записывает файлы: + +- `data.bin` — файл с данными. +- `index.mrk` — файл с метками. Метки содержат смещения для каждого столбца каждого вставленного блока данных. + +Движок `StripeLog` не поддерживает запросы `ALTER UPDATE` и `ALTER DELETE`. + +## Чтение данных {#table_engines-stripelog-reading-the-data} + +Файл с метками позволяет ClickHouse распараллеливать чтение данных. Это означает, что запрос `SELECT` возвращает строки в непредсказуемом порядке. Используйте секцию `ORDER BY` для сортировки строк. + +## Пример использования {#table_engines-stripelog-example-of-use} + +Создание таблицы: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +Вставка данных: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +Мы использовали два запроса `INSERT` для создания двух блоков данных внутри файла `data.bin`. + +ClickHouse использует несколько потоков при выборе данных. Каждый поток считывает отдельный блок данных и возвращает результирующие строки независимо по мере завершения. В результате порядок блоков строк в выходных данных в большинстве случаев не совпадает с порядком тех же блоков во входных данных. Например: + +``` sql +SELECT * FROM stripe_log_table +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +┌───────────timestamp─┬─message_type─┬─message───────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +└─────────────────────┴──────────────┴───────────────────────────┘ +``` + +Сортировка результатов (по умолчанию по возрастанию): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/stripelog/) diff --git a/docs/ru/engines/table-engines/log-family/tinylog.md b/docs/ru/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..f9374272fbf --- /dev/null +++ b/docs/ru/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,9 @@ +# TinyLog {#tinylog} + +Движок относится к семейству движков Log. Смотрите общие свойства и различия движков в статье [Семейство Log](log-family.md). + +Типичный способ использования этой движка — это write-once: сначала данные один раз записываются, а затем читаются столько раз, сколько это необходимо. Например, можно использовать таблицы с движком `TinyLog` для хранения промежуточных данных, которые обрабатываются небольшими блоками. Учтите, что хранить данные в большом количестве мелких таблиц неэффективно. + +Запросы выполняются в один поток. То есть, этот движок предназначен для сравнительно маленьких таблиц (до 1 000 000 строк). Этот движок таблиц имеет смысл использовать в том случае, когда у вас есть много маленьких таблиц, так как он проще, чем движок [Log](log.md) (требуется открывать меньше файлов). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/tinylog/) diff --git a/docs/ru/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/ru/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..3e18f890af7 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,95 @@ +# AggregatingMergeTree {#aggregatingmergetree} + +Движок наследует функциональность [MergeTree](mergetree.md#table_engines-mergetree), изменяя логику слияния кусков данных. Все строки с одинаковым первичным ключом (точнее, с одинаковым [ключом сортировки](mergetree.md)) ClickHouse заменяет на одну (в пределах одного куска данных), которая хранит объединение состояний агрегатных функций. + +Таблицы типа `AggregatingMergeTree` могут использоваться для инкрементальной агрегации данных, в том числе, для агрегирующих материализованных представлений. + +Движок обрабатывает все столбцы типа [AggregateFunction](../../../engines/table-engines/mergetree-family/aggregatingmergetree.md). + +Использование `AggregatingMergeTree` оправдано только в том случае, когда это уменьшает количество строк на порядки. + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Описание параметров запроса смотрите в [описании запроса](../../../engines/table-engines/mergetree-family/aggregatingmergetree.md). + +**Секции запроса** + +При создании таблицы `AggregatingMergeTree` используются те же [секции](mergetree.md), что и при создании таблицы `MergeTree`. + +
+ +Устаревший способ создания таблицы + +!!! attention "Attention" + Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +Все параметры имеют то же значение, что в и `MergeTree`. +
+ +## SELECT/INSERT данных {#selectinsert-dannykh} + +Для вставки данных используйте `INSERT SELECT` с агрегатными `-State`-функциями. + +При выборке данных из таблицы `AggregatingMergeTree`, используйте `GROUP BY` и те же агрегатные функции, что и при вставке данных, но с суффиксом `-Merge`. + +В запросах `SELECT` значения типа `AggregateFunction` выводятся во всех форматах, которые поддерживает ClickHouse, в виде implementation-specific бинарных данных. Если с помощью `SELECT` выполнить дамп данных, например, в формат `TabSeparated`, то потом этот дамп можно загрузить обратно с помощью запроса `INSERT`. + +## Пример агрегирущего материализованного представления {#primer-agregirushchego-materializovannogo-predstavleniia} + +Создаём материализованное представление типа `AggregatingMergeTree`, следящее за таблицей `test.visits`: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +Вставляем данные в таблицу `test.visits`: + +``` sql +INSERT INTO test.visits ... +``` + +Данные окажутся и в таблице и в представлении `test.basic`, которое выполнит агрегацию. + +Чтобы получить агрегированные данные, выполним запрос вида `SELECT ... GROUP BY ...` из представления `test.basic`: + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/aggregatingmergetree/) diff --git a/docs/ru/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/ru/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..3dea5dde822 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,305 @@ +# CollapsingMergeTree {#table_engine-collapsingmergetree} + +Движок наследует функциональность от [MergeTree](mergetree.md) и добавляет в алгоритм слияния кусков данных логику сворачивания (удаления) строк. + +`CollapsingMergeTree` асинхронно удаляет (сворачивает) пары строк, если все поля в ключе сортировки (`ORDER BY`) эквивалентны, за исключением специального поля `Sign`, которое может принимать значения `1` и `-1`. Строки без пары сохраняются. Подробнее смотрите в разделе [Сворачивание (удаление) строк](#table_engine-collapsingmergetree-collapsing). + +Движок может значительно уменьшить объём хранения и, как следствие, повысить эффективность запросов `SELECT`. + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Подробности про `CREATE TABLE` смотрите в [описании запроса](../../../engines/table-engines/mergetree-family/collapsingmergetree.md). + +**Параметры CollapsingMergeTree** + +- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. + + Тип данных столбца — `Int8`. + +**Секции запроса** + +При создании таблицы с движком `CollapsingMergeTree` используются те же [секции запроса](mergetree.md#table_engine-mergetree-creating-a-table) что и при создании таблицы с движком `MergeTree`. + +
+ +Устаревший способ создания таблицы + +!!! attention "Attention" + Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +Все параметры, кроме `ver` имеют то же значение, что и в `MergeTree`. + +- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. + + Тип данных столбца — `Int8`. + +
+ +## Сворачивание (удаление) строк {#table_engine-collapsingmergetree-collapsing} + +### Данные {#dannye} + +Рассмотрим ситуацию, когда необходимо сохранять постоянно изменяющиеся данные для какого-либо объекта. Кажется логичным иметь одну строку для объекта и обновлять её при любом изменении, однако операция обновления является дорогостоящей и медленной для СУБД, поскольку требует перезаписи данных в хранилище. Если необходимо быстро записать данные, обновление не допустимо, но можно записать изменения объекта последовательно как описано ниже. + +Используйте специальный столбец `Sign`. Если `Sign = 1`, то это означает, что строка является состоянием объекта, назовём её строкой состояния. Если `Sign = -1`, то это означает отмену состояния объекта с теми же атрибутами, назовём её строкой отмены состояния. + +Например, мы хотим рассчитать, сколько страниц проверили пользователи на каком-то сайте и как долго они там находились. В какой-то момент времени мы пишем следующую строку с состоянием действий пользователя: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Через некоторое время мы регистрируем изменение активности пользователя и записываем его следующими двумя строками. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Первая строка отменяет предыдущее состояние объекта (пользователя). Она должен повторять все поля из ключа сортировки для отменённого состояния за исключением `Sign`. + +Вторая строка содержит текущее состояние. + +Поскольку нам нужно только последнее состояние активности пользователя, строки + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +можно удалить, сворачивая (удаляя) устаревшее состояние объекта. `CollapsingMergeTree` выполняет это при слиянии кусков данных. + +Зачем нужны две строки для каждого изменения описано в разделе [Алгоритм](#table_engine-collapsingmergetree-collapsing-algorithm). + +**Особенности подхода** + +1. Программа, которая записывает данные, должна помнить состояние объекта, чтобы иметь возможность отменить его. Строка отмены состояния должна содержать копию полей сортировочного ключа предыдущей строки состояния с противоположным значением `Sign`. Это увеличивает начальный размер хранилища, но позволяет быстро записывать данные. +2. Длинные растущие массивы в Столбцах снижают эффективность работы движка за счёт нагрузки на запись. Чем проще данные, тем выше эффективность. +3. Результаты запроса `SELECT` сильно зависят от согласованности истории изменений объекта. Будьте точны при подготовке данных для вставки. Можно получить непредсказуемые результаты для несогласованных данных, например отрицательные значения для неотрицательных метрик, таких как глубина сеанса. + +### Алгоритм {#table_engine-collapsingmergetree-collapsing-algorithm} + +Во время объединения кусков данных, каждая группа последовательных строк с одинаковым сортировочным ключом (`ORDER BY`) уменьшается до не более чем двух строк, одна из которых имеет `Sign = 1` (строка состояния), а другая строка с `Sign = -1` (строка отмены состояния). Другими словами, записи сворачиваются. + +Для каждого результирующего куска данных ClickHouse сохраняет: + + 1. Первую строку отмены состояния и последнюю строку состояния, если количество строк обоих видов совпадает. + + 2. Последнюю строку состояния, если строк состояния на одну больше, чем строк отмены состояния. + + 3. Первую строку отмены состояния, если их на одну больше, чем строк состояния. + + 4. Ни в одну из строк во всех остальных случаях. + + Слияние продолжается, но ClickHouse рассматривает эту ситуацию как логическую ошибку и записывает её в журнал сервера. Эта ошибка может возникать, если одни и те же данные вставлялись несколько раз. + +Как видно, от сворачивания не должны меняться результаты расчётов статистик. +Изменения постепенно сворачиваются так, что остаются лишь последнее состояние почти каждого объекта. + +Столбец `Sign` необходим, поскольку алгоритм слияния не гарантирует, что все строки с одинаковым ключом сортировки будут находиться в одном результирующем куске данных и даже на одном физическом сервере. ClickHouse выполняет запросы `SELECT` несколькими потоками, и он не может предсказать порядок строк в результате. Если необходимо получить полностью свёрнутые данные из таблицы `CollapsingMergeTree`, то необходимо агрегирование. + +Для завершения свертывания добавьте в запрос секцию`GROUP BY` и агрегатные функции, которые учитывают знак. Например, для расчета количества используйте `sum(Sign)` вместо`count()`. Чтобы вычислить сумму чего-либо, используйте `sum(Sign * x)` вместо`sum(х)`, и так далее, а также добавьте `HAVING sum(Sign) > 0` . + +Таким образом можно вычислять агрегации `count`, `sum` и `avg`. Если объект имеет хотя бы одно не свёрнутое состояние, то может быть вычислена агрегация `uniq`. Агрегации `min` и `max` невозможно вычислить, поскольку `CollapsingMergeTree` не сохраняет историю значений свернутых состояний. + +Если необходимо выбирать данные без агрегации (например, проверить наличие строк, последние значения которых удовлетворяют некоторым условиям), можно использовать модификатор `FINAL` для секции `FROM`. Это вариант существенно менее эффективен. + +## Пример использования {#primer-ispolzovaniia} + +Исходные данные: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Создание таблицы: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Insertion of the data: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +Мы используем два запроса `INSERT` для создания двух различных кусков данных. Если вставить данные одним запросом, ClickHouse создаёт один кусок данных и никогда не будет выполнять слияние. + +Получение данных: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Что мы видим и где сворачивание? + +Двумя запросами `INSERT`, мы создали два куска данных. Запрос `SELECT` был выполнен в 2 потока, и мы получили случайный порядок строк. Сворачивание не произошло, так как слияние кусков данных еще не произошло. ClickHouse объединяет куски данных в неизвестный момент времени, который мы не можем предсказать. + +Таким образом, нам нужна агрегация: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +Если нам не нужна агрегация, но мы хотим принудительно выполнить свёртку данных, можно использовать модификатор `FINAL` для секции `FROM`. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Такой способ выбора данных очень неэффективен. Не используйте его для больших таблиц. + +## Пример другого подхода {#primer-drugogo-podkhoda} + +Исходные данные: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ -5 │ -146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Идея состоит в том, что слияния при сворачивании учитывают только ключевые поля, поэтому в отменяющей строке можно указать отрицательные значения, которые нивелируют предыдущую версию записи при суммировании без учета поля Sign. +Для этого подхода необходимо изменить тип данных `PageViews`, `Duration` для хранения отрицательных значений UInt8 -\> Int16. + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews Int16, + Duration Int16, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Тестируем подход: + +``` sql +insert into UAct values(4324182021466249494, 5, 146, 1); +insert into UAct values(4324182021466249494, -5, -146, -1); +insert into UAct values(4324182021466249494, 6, 185, 1); + +select * from UAct final; // старайтесь не использовать final (он подходит только для тестов и маленьких таблиц) +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +``` sql +SELECT + UserID, + sum(PageViews) AS PageViews, + sum(Duration) AS Duration +FROM UAct +GROUP BY UserID +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +``` sql +select count() FROM UAct +``` + +``` text +┌─count()─┐ +│ 3 │ +└─────────┘ +``` + +``` sql +optimize table UAct final; + +select * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/collapsingmergetree/) 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 new file mode 100644 index 00000000000..4306e954c2b --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,126 @@ +# Произвольный ключ партиционирования {#proizvolnyi-kliuch-partitsionirovaniia} + +Партиционирование данных доступно для таблиц семейства [MergeTree](mergetree.md) (включая [реплицированные таблицы](replication.md)). Таблицы [MaterializedView](../special/materializedview.md), созданные на основе таблиц MergeTree, также поддерживают партиционирование. + +Партиция – это набор записей в таблице, объединенных по какому-либо критерию. Например, партиция может быть по месяцу, по дню или по типу события. Данные для разных партиций хранятся отдельно. Это позволяет оптимизировать работу с данными, так как при обработке запросов будет использоваться только необходимое подмножество из всевозможных данных. Например, при получении данных за определенный месяц, ClickHouse будет считывать данные только за этот месяц. + +Ключ партиционирования задается при [создании таблицы](mergetree.md#table_engine-mergetree-creating-a-table), в секции `PARTITION BY expr`. Ключ может представлять собой произвольное выражение из столбцов таблицы. Например, чтобы задать партиционирования по месяцам, можно использовать выражение `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour +``` + +Ключом партиционирования также может быть кортеж из выражений (аналогично [первичному ключу](mergetree.md#primary-keys-and-indexes-in-queries)). Например: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +В этом примере задано партиционирование по типам событий, произошедших в течение текущей недели. + +Каждая партиция состоит из отдельных фрагментов или так называемых *кусков данных*. Каждый кусок отсортирован по первичному ключу. При вставке данных в таблицу каждая отдельная запись сохраняется в виде отдельного куска. Через некоторое время после вставки (обычно до 10 минут), ClickHouse выполняет в фоновом режиме слияние данных — в результате куски для одной и той же партиции будут объединены в более крупный кусок. + +!!! info "Info" + Не рекомендуется делать слишком гранулированное партиционирование – то есть задавать партиции по столбцу, в котором будет слишком большой разброс значений (речь идет о порядке более тысячи партиций). Это приведет к скоплению большого числа файлов и файловых дескрипторов в системе, что может значительно снизить производительность запросов `SELECT`. + +Чтобы получить набор кусков и партиций таблицы, можно воспользоваться системной таблицей [system.parts](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#system_tables-parts). В качестве примера рассмотрим таблицу `visits`, в которой задано партиционирование по месяцам. Выполним `SELECT` для таблицы `system.parts`: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 1 │ +│ 201902 │ 201902_11_11_0 │ 1 │ +└───────────┴────────────────┴────────┘ +``` + +Столбец `partition` содержит имена всех партиций таблицы. Таблица `visits` из нашего примера содержит две партиции: `201901` и `201902`. Используйте значения из этого столбца в запросах [ALTER … PARTITION](#alter_manipulations-with-partitions). + +Столбец `name` содержит названия кусков партиций. Значения из этого столбца можно использовать в запросах [ALTER ATTACH PART](#alter_attach-partition). + +Столбец `active` отображает состояние куска. `1` означает, что кусок активен; `0` – неактивен. К неактивным можно отнести куски, оставшиеся после слияния данных. Поврежденные куски также отображаются как неактивные. Неактивные куски удаляются приблизительно через 10 минут после того, как было выполнено слияние. + +Рассмотрим детальнее имя первого куска `201901_1_3_1`: + +- `201901` имя партиции; +- `1` – минимальный номер блока данных; +- `3` – максимальный номер блока данных; +- `1` – уровень куска (глубина дерева слияний, которыми этот кусок образован). + +!!! info "Info" + Названия кусков для таблиц старого типа образуются следующим образом: `20190117_20190123_2_2_0` (минимальная дата \_ максимальная дата \_ номер минимального блока \_ номер максимального блока \_ уровень). + +Как видно из примера выше, таблица содержит несколько отдельных кусков для одной и той же партиции (например, куски `201901_1_3_1` и `201901_1_9_2` принадлежат партиции `201901`). Это означает, что эти куски еще не были объединены – в файловой системе они хранятся отдельно. После того как будет выполнено автоматическое слияние данных (выполняется примерно спустя 10 минут после вставки данных), исходные куски будут объединены в один более крупный кусок и помечены как неактивные. + +Вы можете запустить внеочередное слияние данных с помощью запроса [OPTIMIZE](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#misc_operations-optimize). Пример: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 0 │ +│ 201902 │ 201902_4_11_2 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 0 │ +│ 201902 │ 201902_11_11_0 │ 0 │ +└───────────┴────────────────┴────────┘ +``` + +Неактивные куски будут удалены примерно через 10 минут после слияния. + +Другой способ посмотреть набор кусков и партиций – зайти в директорию с данными таблицы: `/var/lib/clickhouse/data///`. Например: + +``` bash +/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ и т. д. – это директории кусков партиции. Каждый кусок содержит данные только для соответствующего месяца (таблица в данном примере содержит партиционирование по месяцам). + +Директория `detached` содержит куски, отсоединенные от таблицы с помощью запроса [DETACH](#alter_detach-partition). Поврежденные куски также попадают в эту директорию – они не удаляются с сервера. + +Сервер не использует куски из директории `detached`. Вы можете в любое время добавлять, удалять, модифицировать данные в директории detached - сервер не будет об этом знать, пока вы не сделаете запрос [ATTACH](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#alter_attach-partition). + +Следует иметь в виду, что при работающем сервере нельзя вручную изменять набор кусков на файловой системе, так как сервер не будет знать об этом. +Для нереплицируемых таблиц, вы можете это делать при остановленном сервере, однако это не рекомендуется. +Для реплицируемых таблиц, набор кусков нельзя менять в любом случае. + +ClickHouse позволяет производить различные манипуляции с кусками: удалять, копировать из одной таблицы в другую или создавать их резервные копии. Подробнее см. в разделе [Манипуляции с партициями и кусками](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#alter_manipulations-with-partitions). + +[Оригинальная статья:](https://clickhouse.tech/docs/ru/operations/table_engines/custom_partitioning_key/) diff --git a/docs/ru/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/ru/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..4e99cf1a6e5 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,169 @@ +# GraphiteMergeTree {#graphitemergetree} + +Движок предназначен для прореживания и агрегирования/усреднения (rollup) данных [Graphite](http://graphite.readthedocs.io/en/latest/index.html). Он может быть интересен разработчикам, которые хотят использовать ClickHouse как хранилище данных для Graphite. + +Если rollup не требуется, то для хранения данных Graphite можно использовать любой движок таблиц ClickHouse, в противном случае используйте `GraphiteMergeTree`. Движок уменьшает объём хранения и повышает эффективность запросов от Graphite. + +Движок наследует свойства от [MergeTree](mergetree.md). + +## Создание таблицы {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Смотрите описание запроса [CREATE TABLE](../../../engines/table-engines/mergetree-family/graphitemergetree.md#create-table-query). + +В таблице должны быть столбцы для следующих данных: + +- Название метрики (сенсора Graphite). Тип данных: `String`. + +- Время измерения метрики. Тип данных `DateTime`. + +- Значение метрики. Тип данных: любой числовой. + +- Версия метрики. Тип данных: любой числовой. + + ClickHouse сохраняет строки с последней версией или последнюю записанную строку, если версии совпадают. Другие строки удаляются при слиянии кусков данных. + +Имена этих столбцов должны быть заданы в конфигурации rollup. + +**Параметры GraphiteMergeTree** + +- `config_section` — имя раздела в конфигурационном файле, в котором находятся правила rollup. + +**Секции запроса** + +При создании таблицы `GraphiteMergeTree` используются те же [секции](mergetree.md#table_engine-mergetree-creating-a-table) запроса, что и при создании таблицы `MergeTree`. + +
+ +Устаревший способ создания таблицы + +!!! attention "Attention" + Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +Все параметры, кроме `config_section` имеют то же значение, что в `MergeTree`. + +- `config_section` — имя раздела в конфигурационном файле, в котором находятся правила rollup. + +
+ +## Конфигурация Rollup {#rollup-configuration} + +Настройки прореживания данных задаются параметром [graphite\_rollup](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) в конфигурации сервера . Имя параметра может быть любым. Можно создать несколько конфигураций и использовать их для разных таблиц. + +Структура конфигурации rollup: + +``` text +required-columns +patterns +``` + +### Требуемые столбцы (required-columns) {#required-columns} + +- `path_column_name` — столбец, в котором хранится название метрики (сенсор Graphite). Значение по умолчанию: `Path`. +- `time_column_name` — столбец, в котором хранится время измерения метрики. Значение по умолчанию: `Time`. +- `value_column_name` — столбец со значением метрики в момент времени, установленный в `time_column_name`. Значение по умолчанию: `Value`. +- `version_column_name` — столбец, в котором хранится версия метрики. Значение по умолчанию: `Timestamp`. + +### Правила (patterns) {#patterns} + +Структура раздела `patterns`: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "Внимание" + Правила должны быть строго упорядочены: + + 1. Правила без `function` или `retention`. + 1. Правила одновремено содержащие `function` и `retention`. + 1. Правило `default`. + +При обработке строки ClickHouse проверяет правила в разделе `pattern`. Каждый `pattern` (включая `default`) может содержать параметр агрегации `function`, параметр `retention`, или оба параметра одновременно. Если имя метрики соответствует шаблону `regexp`, то применяются правила `pattern`, в противном случае правило `default`. + +Поля для разделов `pattern` и `default`: + +- `regexp` – шаблон имени метрики. +- `age` – минимальный возраст данных в секундах. +- `precision` – точность определения возраста данных в секундах. Должен быть делителем для 86400 (количество секунд в сутках). +- `function` – имя агрегирующей функции, которую следует применить к данным, чей возраст оказался в интервале `[age, age + precision]`. + +### Пример конфигурации {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/graphitemergetree/) diff --git a/docs/ru/engines/table-engines/mergetree-family/index.md b/docs/ru/engines/table-engines/mergetree-family/index.md new file mode 100644 index 00000000000..9e989d807da --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: MergeTree Family +toc_priority: 28 +--- + + diff --git a/docs/ru/engines/table-engines/mergetree-family/mergetree.md b/docs/ru/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..cd8ecfece01 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,637 @@ +# MergeTree {#table_engines-mergetree} + +Движок `MergeTree`, а также другие движки этого семейства (`*MergeTree`) — это наиболее функциональные движки таблиц ClickHouse. + +Основная идея, заложенная в основу движков семейства `MergeTree` следующая. Когда у вас есть огромное количество данных, которые должны быть вставлены в таблицу, вы должны быстро записать их по частям, а затем объединить части по некоторым правилам в фоновом режиме. Этот метод намного эффективнее, чем постоянная перезапись данных в хранилище при вставке. + +Основные возможности: + +- Хранит данные, отсортированные по первичному ключу. + + Это позволяет создавать разреженный индекс небольшого объёма, который позволяет быстрее находить данные. + +- Позволяет оперировать партициями, если задан [ключ партиционирования](custom-partitioning-key.md). + + ClickHouse поддерживает отдельные операции с партициями, которые работают эффективнее, чем общие операции с этим же результатом над этими же данными. Также, ClickHouse автоматически отсекает данные по партициям там, где ключ партиционирования указан в запросе. Это также увеличивает эффективность выполнения запросов. + +- Поддерживает репликацию данных. + + Для этого используется семейство таблиц `ReplicatedMergeTree`. Подробнее читайте в разделе [Репликация данных](replication.md). + +- Поддерживает сэмплирование данных. + + При необходимости можно задать способ сэмплирования данных в таблице. + +!!! info "Info" + Движок [Merge](../special/merge.md) не относится к семейству `*MergeTree`. + +## Создание таблицы {#table_engine-mergetree-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 +) ENGINE = MergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] +[SETTINGS name=value, ...] +``` + +Описание параметров смотрите в [описании запроса CREATE](../../../engines/table-engines/mergetree-family/mergetree.md). + +!!! note "Note" + `INDEX` — экспериментальная возможность, смотрите [Индексы пропуска данных](#table_engine-mergetree-data_skipping-indexes). + +### Секции запроса {#mergetree-query-clauses} + +- `ENGINE` — имя и параметры движка. `ENGINE = MergeTree()`. `MergeTree` не имеет параметров. + +- `PARTITION BY` — [ключ партиционирования](custom-partitioning-key.md). + + Для партиционирования по месяцам используйте выражение `toYYYYMM(date_column)`, где `date_column` — столбец с датой типа [Date](../../../engines/table_engines/mergetree_family/mergetree.md). В этом случае имена партиций имеют формат `"YYYYMM"`. + +- `ORDER BY` — ключ сортировки. + + Кортеж столбцов или произвольных выражений. Пример: `ORDER BY (CounterID, EventDate)`. + +- `PRIMARY KEY` — первичный ключ, если он [отличается от ключа сортировки](#pervichnyi-kliuch-otlichnyi-ot-kliucha-sortirovki). + + По умолчанию первичный ключ совпадает с ключом сортировки (который задаётся секцией `ORDER BY`.) Поэтому в большинстве случаев секцию `PRIMARY KEY` отдельно указывать не нужно. + +- `SAMPLE BY` — выражение для сэмплирования. + + Если используется выражение для сэмплирования, то первичный ключ должен содержать его. Пример: + + `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. + +- `TTL` — список правил, определяющих длительности хранения строк, а также задающих правила перемещения частей на определённые тома или диски. + + Выражение должно возвращать столбец `Date` или `DateTime`. Пример: `TTL date + INTERVAL 1 DAY`. + + Тип правила `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` указывает действие, которое будет выполнено с частью, удаление строк (прореживание), перемещение (при выполнении условия для всех строк части) на определённый диск (`TO DISK 'xxx'`) или том (`TO VOLUME 'xxx'`). Поведение по умолчанию соответствует удалению строк (`DELETE`). В списке правил может быть указано только одно выражение с поведением `DELETE`. + + Дополнительные сведения смотрите в разделе [TTL для столбцов и таблиц](#table_engine-mergetree-ttl) + +- `SETTINGS` — дополнительные параметры, регулирующие поведение `MergeTree`: + + - `index_granularity` — максимальное количество строк данных между засечками индекса. По умолчанию — 8192. Смотрите [Хранение данных](#mergetree-data-storage). + - `index_granularity_bytes` — максимальный размер гранул данных в байтах. По умолчанию — 10Mb. Чтобы ограничить размер гранул только количеством строк, установите значение 0 (не рекомендовано). Смотрите [Хранение данных](#mergetree-data-storage). + - `enable_mixed_granularity_parts` — включает или выключает переход к ограничению размера гранул с помощью настройки `index_granularity_bytes`. До версии 19.11, размер гранул ограничивался только настройкой `index_granularity`. Настройка `index_granularity_bytes` улучшает производительность ClickHouse при выборке данных из таблиц с большими (десятки и сотни мегабайтов) строками. Если у вас есть таблицы с большими строками, можно включить эту настройку, чтобы повысить эффективность запросов `SELECT`. + - `use_minimalistic_part_header_in_zookeeper` — Способ хранения заголовков кусков данных в ZooKeeper. Если `use_minimalistic_part_header_in_zookeeper = 1`, то ZooKeeper хранит меньше данных. Подробнее читайте в [описании настройки](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) в разделе "Конфигурационные параметры сервера". + - `min_merge_bytes_to_use_direct_io` — минимальный объём данных при слиянии, необходимый для прямого (небуферизованного) чтения/записи (direct I/O) на диск. При слиянии частей данных ClickHouse вычисляет общий объём хранения всех данных, подлежащих слиянию. Если общий объём хранения всех данных для чтения превышает `min_bytes_to_use_direct_io` байт, тогда ClickHouse использует флаг `O_DIRECT` при чтении данных с диска. Если `min_merge_bytes_to_use_direct_io = 0`, тогда прямой ввод-вывод отключен. Значение по умолчанию: `10 * 1024 * 1024 * 1024` байтов. + + - `merge_with_ttl_timeout` — минимальное время в секундах перед повторным слиянием с TTL. По умолчанию — 86400 (1 день). + - `write_final_mark` — включает или отключает запись последней засечки индекса в конце куска данных, указывающей за последний байт. По умолчанию — 1. Не отключайте её. + - `merge_max_block_size` — Максимальное количество строк в блоке для операций слияния. Значение по умолчанию: 8192. + - `storage_policy` — политика хранения данных. Смотрите [Хранение данных таблицы на нескольких блочных устройствах](#table_engine-mergetree-multiple-volumes). + +**Пример задания секций** + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 +``` + +В примере мы устанавливаем партиционирование по месяцам. + +Также мы задаем выражение для сэмплирования в виде хэша по идентификатору посетителя. Это позволяет псевдослучайным образом перемешать данные в таблице для каждого `CounterID` и `EventDate`. Если при выборке данных задать секцию [SAMPLE](../../../engines/table-engines/mergetree-family/mergetree.md#select-sample-clause), то ClickHouse вернёт равномерно-псевдослучайную выборку данных для подмножества посетителей. + +`index_granularity` можно было не указывать, поскольку 8192 — это значение по умолчанию. + +
+ +Устаревший способ создания таблицы + +!!! attention "Attention" + Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ, описанный выше. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +**Параметры MergeTree()** + +- `date-column` — имя столбца с типом [Date](../../../engines/table-engines/mergetree-family/mergetree.md). На основе этого столбца ClickHouse автоматически создаёт партиции по месяцам. Имена партиций имеют формат `"YYYYMM"`. +- `sampling_expression` — выражение для сэмплирования. +- `(primary, key)` — первичный ключ. Тип — [Tuple()](../../../engines/table-engines/mergetree-family/mergetree.md) +- `index_granularity` — гранулярность индекса. Число строк данных между «засечками» индекса. Для большинства задач подходит значение 8192. + +**Пример** + +``` sql +MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) +``` + +Движок `MergeTree` сконфигурирован таким же образом, как и в примере выше для основного способа конфигурирования движка. + +
+ +## Хранение данных {#mergetree-data-storage} + +Таблица состоит из *кусков* данных (data parts), отсортированных по первичному ключу. + +При вставке в таблицу создаются отдельные куски данных, каждый из которых лексикографически отсортирован по первичному ключу. Например, если первичный ключ — `(CounterID, Date)`, то данные в куске будут лежать в порядке `CounterID`, а для каждого `CounterID` в порядке `Date`. + +Данные, относящиеся к разным партициям, разбиваются на разные куски. В фоновом режиме ClickHouse выполняет слияния (merge) кусков данных для более эффективного хранения. Куски, относящиеся к разным партициям не объединяются. Механизм слияния не гарантирует, что все строки с одинаковым первичным ключом окажутся в одном куске. + +Каждый кусок данных логически делится на гранулы. Гранула — это минимальный неделимый набор данных, который ClickHouse считывает при выборке данных. ClickHouse не разбивает строки и значения и гранула всегда содержит целое число строк. Первая строка гранулы помечается значением первичного ключа для этой строки (засечка). Для каждого куска данных ClickHouse создаёт файл с засечками (индексный файл). Для каждого столбца, независимо от того, входит он в первичный ключ или нет, ClickHouse также сохраняет эти же засечки. Засечки используются для поиска данных напрямую в файлах столбцов. + +Размер гранул оганичен настройками движка `index_granularity` и `index_granularity_bytes`. Количество строк в грануле лежит в диапазоне `[1, index_granularity]`, в зависимости от размера строк. Размер гранулы может превышать `index_granularity_bytes` в том случае, когда размер единственной строки в грануле превышает значение настройки. В этом случае, размер гранулы равен размеру строки. + +## Первичные ключи и индексы в запросах {#primary-keys-and-indexes-in-queries} + +Рассмотрим первичный ключ — `(CounterID, Date)`. В этом случае сортировку и индекс можно проиллюстрировать следующим образом: + +``` text +Whole data: [-------------------------------------------------------------------------] +CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] +Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] +Marks: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 +Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 +``` + +Если в запросе к данным указать: + +- `CounterID IN ('a', 'h')`, то сервер читает данные в диапазонах засечек `[0, 3)` и `[6, 8)`. +- `CounterID IN ('a', 'h') AND Date = 3`, то сервер читает данные в диапазонах засечек `[1, 3)` и `[7, 8)`. +- `Date = 3`, то сервер читает данные в диапазоне засечек `[1, 10]`. + +Примеры выше показывают, что использование индекса всегда эффективнее, чем full scan. + +Разреженный индекс допускает чтение лишних строк. При чтении одного диапазона первичного ключа, может быть прочитано до `index_granularity * 2` лишних строк в каждом блоке данных. + +Разреженный индекс почти всегда помещаеся в оперативную память и позволяет работать с очень большим количеством строк в таблицах. + +ClickHouse не требует уникального первичного ключа. Можно вставить много строк с одинаковым первичным ключом. + +### Выбор первичного ключа {#vybor-pervichnogo-kliucha} + +Количество столбцов в первичном ключе не ограничено явным образом. В зависимости от структуры данных в первичный ключ можно включать больше или меньше столбцов. Это может: + +- Увеличить эффективность индекса. + + Пусть первичный ключ — `(a, b)`, тогда добавление ещё одного столбца `c` повысит эффективность, если выполнены условия: + + - Есть запросы с условием на столбец `c`. + - Часто встречаются достаточно длинные (в несколько раз больше `index_granularity`) диапазоны данных с одинаковыми значениями `(a, b)`. Иначе говоря, когда добавление ещё одного столбца позволит пропускать достаточно длинные диапазоны данных. + +- Улучшить сжатие данных. + + ClickHouse сортирует данные по первичному ключу, поэтому чем выше однородность, тем лучше сжатие. + +- Обеспечить дополнительную логику при слиянии кусков данных в движках [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) и [SummingMergeTree](summingmergetree.md). + + В этом случае имеет смысл указать отдельный *ключ сортировки*, отличающийся от первичного ключа. + +Длинный первичный ключ будет негативно влиять на производительность вставки и потребление памяти, однако на производительность ClickHouse при запросах `SELECT` лишние столбцы в первичном ключе не влияют. + +### Первичный ключ, отличный от ключа сортировки {#pervichnyi-kliuch-otlichnyi-ot-kliucha-sortirovki} + +Существует возможность задать первичный ключ (выражение, значения которого будут записаны в индексный файл для +каждой засечки), отличный от ключа сортировки (выражение, по которому будут упорядочены строки в кусках +данных). Кортеж выражения первичного ключа при этом должен быть префиксом кортежа выражения ключа +сортировки. + +Данная возможность особенно полезна при использовании движков [SummingMergeTree](summingmergetree.md) +и [AggregatingMergeTree](aggregatingmergetree.md). В типичном сценарии использования этих движков таблица +содержит столбцы двух типов: *измерения* (dimensions) и *меры* (measures). Типичные запросы агрегируют +значения столбцов-мер с произвольной группировкой и фильтрацией по измерениям. Так как `SummingMergeTree` +и `AggregatingMergeTree` производят фоновую агрегацию строк с одинаковым значением ключа сортировки, приходится +добавлять в него все столбцы-измерения. В результате выражение ключа содержит большой список столбцов, +который приходится постоянно расширять при добавлении новых измерений. + +В этом сценарии имеет смысл оставить в первичном ключе всего несколько столбцов, которые обеспечат эффективную фильтрацию по индексу, а остальные столбцы-измерения добавить в выражение ключа сортировки. + +[ALTER ключа сортировки](../../../engines/table-engines/mergetree-family/mergetree.md) — лёгкая операция, так как при одновременном добавлении нового столбца в таблицу и ключ сортировки не нужно изменять данные кусков (они остаются упорядоченными и по новому выражению ключа). + +### Использование индексов и партиций в запросах {#ispolzovanie-indeksov-i-partitsii-v-zaprosakh} + +Для запросов `SELECT` ClickHouse анализирует возможность использования индекса. Индекс может использоваться, если в секции `WHERE/PREWHERE`, в качестве одного из элементов конъюнкции, или целиком, есть выражение, представляющее операции сравнения на равенства, неравенства, а также `IN` или `LIKE` с фиксированным префиксом, над столбцами или выражениями, входящими в первичный ключ или ключ партиционирования, либо над некоторыми частично монотонными функциями от этих столбцов, а также логические связки над такими выражениями. + +Таким образом, обеспечивается возможность быстро выполнять запросы по одному или многим диапазонам первичного ключа. Например, в указанном примере будут быстро работать запросы для конкретного счётчика; для конкретного счётчика и диапазона дат; для конкретного счётчика и даты, для нескольких счётчиков и диапазона дат и т. п. + +Рассмотрим движок сконфигурированный следующим образом: + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 +``` + +В этом случае в запросах: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +ClickHouse будет использовать индекс по первичному ключу для отсечения не подходящих данных, а также ключ партиционирования по месяцам для отсечения партиций, которые находятся в не подходящих диапазонах дат. + +Запросы выше показывают, что индекс используется даже для сложных выражений. Чтение из таблицы организовано так, что использование индекса не может быть медленнее, чем full scan. + +В примере ниже индекс не может использоваться. + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +Чтобы проверить, сможет ли ClickHouse использовать индекс при выполнении запроса, используйте настройки [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) и [force\_primary\_key](../../../operations/settings/settings.md#settings-force_primary_key). + +Ключ партиционирования по месяцам обеспечивает чтение только тех блоков данных, которые содержат даты из нужного диапазона. При этом блок данных может содержать данные за многие даты (до целого месяца). В пределах одного блока данные упорядочены по первичному ключу, который может не содержать дату в качестве первого столбца. В связи с этим, при использовании запроса с указанием условия только на дату, но не на префикс первичного ключа, будет читаться данных больше, чем за одну дату. + +### Использование индекса для частично-монотонных первичных ключей {#ispolzovanie-indeksa-dlia-chastichno-monotonnykh-pervichnykh-kliuchei} + +Рассмотрим, например, дни месяца. Они образуют последовательность [монотонную](https://ru.wikipedia.org/wiki/Монотонная_последовательность) в течение одного месяца, но не монотонную на более длительных периодах. Это частично-монотонная последовательность. Если пользователь создаёт таблицу с частично-монотонным первичным ключом, ClickHouse как обычно создаёт разреженный индекс. Когда пользователь выбирает данные из такого рода таблиц, ClickHouse анализирует условия запроса. Если пользователь хочет получить данные между двумя метками индекса, и обе эти метки находятся внутри одного месяца, ClickHouse может использовать индекс в данном конкретном случае, поскольку он может рассчитать расстояние между параметрами запроса и индексными метками. + +ClickHouse не может использовать индекс, если значения первичного ключа в диапазоне параметров запроса не представляют собой монотонную последовательность. В этом случае ClickHouse использует метод полного сканирования. + +ClickHouse использует эту логику не только для последовательностей дней месяца, но и для любого частично-монотонного первичного ключа. + +### Индексы пропуска данных (экспериментальная функциональность) {#table_engine-mergetree-data_skipping-indexes} + +Объявление индексов при определении столбцов в запросе `CREATE`. + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +Для таблиц семейства `*MergeTree` можно задать дополнительные индексы в секции столбцов. + +Индексы агрегируют для заданного выражения некоторые данные, а потом при `SELECT` запросе используют для пропуска блоков данных (пропускаемый блок состоит из гранул данных в количестве равном гранулярности данного индекса), на которых секция `WHERE` не может быть выполнена, тем самым уменьшая объём данных читаемых с диска. + +**Пример** + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +Эти индексы смогут использоваться для оптимизации следующих запросов + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### Доступные индексы {#dostupnye-indeksy} + +- `minmax` — Хранит минимум и максимум выражения (если выражение - `tuple`, то для каждого элемента `tuple`), используя их для пропуска блоков аналогично первичному ключу. + +- `set(max_rows)` — Хранит уникальные значения выражения на блоке в количестве не более `max_rows` (если `max_rows = 0`, то ограничений нет), используя их для пропуска блоков, оценивая выполнимость `WHERE` выражения на хранимых данных. + +- `bloom_filter([false_positive])` — [фильтр Блума](https://en.wikipedia.org/wiki/Bloom_filter) для указанных стоблцов. + + Необязательный параметр `false_positive` — это вероятность получения ложноположительного срабатывания. Возможные значения: (0, 1). Значение по умолчанию: 0.025. + + Поддержанные типы данных: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`. + + Фильтром могут пользоваться функции: [equals](../../../engines/table_engines/mergetree_family/mergetree.md), [notEquals](../../../engines/table_engines/mergetree_family/mergetree.md), [in](../../../engines/table_engines/mergetree_family/mergetree.md), [notIn](../../../engines/table_engines/mergetree_family/mergetree.md). + +**Примеры** + +``` sql +INDEX b (u64 * length(str), i32 + f64 * 100, date, str) TYPE minmax GRANULARITY 4 +INDEX b (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +``` + +#### Поддержка для функций {#podderzhka-dlia-funktsii} + +Условия в секции `WHERE` содержат вызовы функций, оперирующих со столбцами. Если столбец - часть индекса, ClickHouse пытается использовать индекс при выполнении функции. Для разных видов индексов, ClickHouse поддерживает различные наборы функций, которые могут использоваться индексами. + +Индекс `set` используется со всеми функциями. Наборы функций для остальных индексов представлены в таблице ниже. + +| Function (operator) / Index | primary key | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | +|----------------------------------------------------------------------------------------------------------------|-------------|--------|-------------|-------------|---------------| +| [equals (=, ==)](../../../engines/table-engines/mergetree-family/mergetree.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notEquals(!=, \<\>)](../../../engines/table-engines/mergetree-family/mergetree.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [like](../../../engines/table-engines/mergetree-family/mergetree.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [notLike](../../../engines/table-engines/mergetree-family/mergetree.md#function-notlike) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [startsWith](../../../engines/table-engines/mergetree-family/mergetree.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [endsWith](../../../engines/table-engines/mergetree-family/mergetree.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [multiSearchAny](../../../engines/table-engines/mergetree-family/mergetree.md#function-multisearchany) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [in](../../../engines/table-engines/mergetree-family/mergetree.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notIn](../../../engines/table-engines/mergetree-family/mergetree.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [less (\<)](../../../engines/table-engines/mergetree-family/mergetree.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [greater (\>)](../../../engines/table-engines/mergetree-family/mergetree.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [lessOrEquals (\<=)](../../../engines/table-engines/mergetree-family/mergetree.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [greaterOrEquals (\>=)](../../../engines/table-engines/mergetree-family/mergetree.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [empty](../../../engines/table-engines/mergetree-family/mergetree.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [notEmpty](../../../engines/table-engines/mergetree-family/mergetree.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | + +Функции с постоянным агрументом, который меньше, чем размер ngram не могут использовать индекс `ngrambf_v1` для оптимизации запроса. + +Фильтры Блума могут иметь ложнопозитивные срабатывания, следовательно индексы `ngrambf_v1`, `tokenbf_v1` и `bloom_filter` невозможно использовать для оптимизации запросов, в которых результат функции предполается false, например: + +- Можно оптимизировать: + - `s LIKE '%test%'` + - `NOT s NOT LIKE '%test%'` + - `s = 1` + - `NOT s != 1` + - `startsWith(s, 'test')` +- Нельзя оптимизировать: + - `NOT s LIKE '%test%'` + - `s NOT LIKE '%test%'` + - `NOT s = 1` + - `s != 1` + - `NOT startsWith(s, 'test')` + +## Конкурентный доступ к данным {#konkurentnyi-dostup-k-dannym} + +Для конкурентного доступа к таблице используется мультиверсионность. То есть, при одновременном чтении и обновлении таблицы, данные будут читаться из набора кусочков, актуального на момент запроса. Длинных блокировок нет. Вставки никак не мешают чтениям. + +Чтения из таблицы автоматически распараллеливаются. + +## TTL для столбцов и таблиц {#table_engine-mergetree-ttl} + +Определяет время жизни значений, а также правила перемещения данных на другой диск или том. + +Секция `TTL` может быть установлена как для всей таблицы, так и для каждого отдельного столбца. Правила `TTL` для таблицы позволяют указать целевые диски или тома для фонового перемещения на них частей данных. + +Выражения должны возвращать тип [Date](../../../engines/table-engines/mergetree-family/mergetree.md) или [DateTime](../../../engines/table-engines/mergetree-family/mergetree.md). + +Для задания времени жизни столбца, например: + +``` sql +TTL time_column +TTL time_column + interval +``` + +Чтобы задать `interval`, используйте операторы [интервала времени](../../../engines/table-engines/mergetree-family/mergetree.md#operators-datetime). + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### TTL столбца {#mergetree-column-ttl} + +Когда срок действия значений в столбце истечет, ClickHouse заменит их значениями по умолчанию для типа данных столбца. Если срок действия всех значений столбцов в части данных истек, ClickHouse удаляет столбец из куска данных в файловой системе. + +Секцию `TTL` нельзя использовать для ключевых столбцов. + +Примеры: + +Создание таблицы с TTL + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +Добавление TTL на колонку существующей таблицы + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +Изменение TTL у колонки + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### TTL таблицы {#mergetree-table-ttl} + +Для таблицы можно задать одно выражение для устаревания данных, а также несколько выражений, по срабатывании которых данные переместятся на [некоторый диск или том](#table_engine-mergetree-multiple-volumes). Когда некоторые данные в таблице устаревают, ClickHouse удаляет все соответствующие строки. + +``` sql +TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... +``` + +За каждым TTL выражением может следовать тип действия, которое выполняется после достижения времени, соответствующего результату TTL выражения: + +- `DELETE` - удалить данные (действие по умолчанию); +- `TO DISK 'aaa'` - переместить данные на диск `aaa`; +- `TO VOLUME 'bbb'` - переместить данные на том `bbb`. + +Примеры: + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH [DELETE], + d + INTERVAL 1 WEEK TO VOLUME 'aaa', + d + INTERVAL 2 WEEK TO DISK 'bbb'; +``` + +Изменение TTL + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**Удаление данных** + +Данные с истекшим TTL удаляются, когда ClickHouse мёржит куски данных. + +Когда ClickHouse видит, что некоторые данные устарели, он выполняет внеплановые мёржи. Для управление частотой подобных мёржей, можно задать настройку [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). Если её значение слишком низкое, придется выполнять много внеплановых мёржей, которые могут начать потреблять значительную долю ресурсов сервера. + +Если вы выполните запрос `SELECT` между слияниями вы можете получить устаревшие данные. Чтобы избежать этого используйте запрос [OPTIMIZE](../../../engines/table-engines/mergetree-family/mergetree.md#misc_operations-optimize) перед `SELECT`. + +## Хранение данных таблицы на нескольких блочных устройствах {#table_engine-mergetree-multiple-volumes} + +### Введение {#vvedenie} + +Движки таблиц семейства `MergeTree` могут хранить данные на нескольких блочных устройствах. Это может оказаться полезным, например, при неявном разделении данных одной таблицы на «горячие» и «холодные». Наиболее свежая часть занимает малый объём и запрашивается регулярно, а большой хвост исторических данных запрашивается редко. При наличии в системе нескольких дисков, «горячая» часть данных может быть размещена на быстрых дисках (например, на NVMe SSD или в памяти), а холодная на более медленных (например, HDD). + +Минимальной перемещаемой единицей для `MergeTree` является кусок данных (data part). Данные одного куска могут находится только на одном диске. Куски могут перемещаться между дисками в фоне, согласно пользовательским настройкам, а также с помощью запросов [ALTER](../../../engines/table-engines/mergetree-family/mergetree.md#alter_move-partition). + +### Термины {#terminy} + +- Диск — примонтированное в файловой системе блочное устройство. +- Диск по умолчанию — диск, на котором находится путь, указанный в конфигурационной настройке сервера [path](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path). +- Том (Volume) — упорядоченный набор равноценных дисков (схоже с [JBOD](https://ru.wikipedia.org/wiki/JBOD)) +- Политика хранения (StoragePolicy) — множество томов с правилами перемещения данных между ними. + +У всех описанных сущностей при создании указываются имена, можно найти в системных таблицах [system.storage\_policies](../../../engines/table-engines/mergetree-family/mergetree.md#system_tables-storage_policies) и [system.disks](../../../engines/table-engines/mergetree-family/mergetree.md#system_tables-disks). Имя политики хранения можно указать в настройке `storage_policy` движков таблиц семейства `MergeTree`. + +### Конфигурация {#table_engine-mergetree-multiple-volumes-configure} + +Диски, тома и политики хранения задаются внутри тега `` в основном файле `config.xml` или в отдельном файле в директории `config.d`. + +Структура конфигурации: + +``` xml + + + + /mnt/fast_ssd/clickhouse/ + + + /mnt/hdd1/clickhouse/ + 10485760 + + + /mnt/hdd2/clickhouse/ + 10485760 + + + ... + + + ... + +``` + +Теги: + +- `` — имя диска. Имена должны быть разными для всех дисков. +- `path` — путь по которому будут храниться данные сервера (каталоги `data` и `shadow`), должен быть терминирован `/`. +- `keep_free_space_bytes` — размер зарезервированного свободного места на диске. + +Порядок задания дисков не имеет значения. + +Общий вид конфигурации политик хранения: + +``` xml + + ... + + + + + disk_name_from_disks_configuration + 1073741824 + + + + + + + 0.2 + + + + + + + + ... + +``` + +Тэги: + +- `policy_name_N` — название политики. Названия политик должны быть уникальны. +- `volume_name_N` — название тома. Названия томов должны быть уникальны. +- `disk` — диск, находящийся внутри тома. +- `max_data_part_size_bytes` — максимальный размер куска данных, который может находится на любом из дисков этого тома. +- `move_factor` — доля свободного места, при превышении которого данные начинают перемещаться на следующий том, если он есть (по умолчанию 0.1). + +Примеры конфигураций: + +``` xml + + ... + + + + + disk1 + disk2 + + + + + + + + fast_ssd + 1073741824 + + + disk1 + + + 0.2 + + + ... + +``` + +В приведенном примере, политика `hdd_in_order` реализует прицип [round-robin](https://ru.wikipedia.org/wiki/Round-robin_(%D0%B0%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC)). Так как в политике есть всего один том (`single`), то все записи производятся на его диски по круговому циклу. Такая политика может быть полезна при наличии в системе нескольких похожих дисков, но при этом не сконфигурирован RAID. Учтите, что каждый отдельный диск ненадёжен и чтобы не потерять важные данные это необходимо скомпенсировать за счет хранения данных в трёх копиях. + +Если система содержит диски различных типов, то может пригодиться политика `moving_from_ssd_to_hdd`. В томе `hot` находится один SSD-диск (`fast_ssd`), а также задается ограничение на максимальный размер куска, который может храниться на этом томе (1GB). Все куски такой таблицы больше 1GB будут записываться сразу на том `cold`, в котором содержится один HDD-диск `disk1`. Также, при заполнении диска `fast_ssd` более чем на 80% данные будут переносится на диск `disk1` фоновым процессом. + +Порядок томов в политиках хранения важен, при достижении условий на переполнение тома данные переносятся на следующий. Порядок дисков в томах так же важен, данные пишутся по очереди на каждый из них. + +После задания конфигурации политик хранения их можно использовать, как настройку при создании таблиц: + +``` sql +CREATE TABLE table_with_non_default_policy ( + EventDate Date, + OrderID UInt64, + BannerID UInt64, + SearchPhrase String +) ENGINE = MergeTree +ORDER BY (OrderID, BannerID) +PARTITION BY toYYYYMM(EventDate) +SETTINGS storage_policy = 'moving_from_ssd_to_hdd' +``` + +По умолчанию используется политика хранения `default` в которой есть один том и один диск, указанный в ``. В данный момент менять политику хранения после создания таблицы нельзя. + +### Особенности работы {#osobennosti-raboty} + +В таблицах `MergeTree` данные попадают на диск несколькими способами: + +- В результате вставки (запрос `INSERT`). +- В фоновых операциях слияний и [мутаций](../../../engines/table-engines/mergetree-family/mergetree.md#alter-mutations). +- При скачивании данных с другой реплики. +- В результате заморозки партиций [ALTER TABLE … FREEZE PARTITION](../../../engines/table-engines/mergetree-family/mergetree.md#alter_freeze-partition). + +Во всех случаях, кроме мутаций и заморозки партиций, при записи куска выбирается том и диск в соответствии с указанной конфигурацией хранилища: + +1. Выбирается первый по порядку том, на котором есть свободное место для записи куска (`unreserved_space > current_part_size`) и который позволяет записывать куски требуемого размера `max_data_part_size_bytes > current_part_size`. +2. Внутри тома выбирается следующий диск после того, на который была предыдущая запись и на котором свободного места больше чем размер куска (`unreserved_space - keep_free_space_bytes > current_part_size`) + +Мутации и запросы заморозки партиций в реализации используют [жесткие ссылки](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) пользователь может принудительно перенести кусок или партицию с одного раздела на другой. При этом учитываются все ограничения, указанные для фоновых операций. Запрос самостоятельно инициирует процесс перемещения не дожидаясь фоновых операций. В случае недостатка места или неудовлетворения ограничениям пользователь получит сообщение об ошибке. + +Перемещения данных не взаимодействуют с репликацией данных, поэтому на разных репликах одной и той же таблицы могут быть указаны разные политики хранения. + +После выполнения фоновых слияний или мутаций старые куски не удаляются сразу, а через некоторое время (табличная настройка `old_parts_lifetime`). Также они не перемещаются на другие тома или диски, поэтому до момента удаления они продолжают учитываться при подсчёте занятого дискового пространства. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/ru/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/ru/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..6e3e1224997 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,61 @@ +# ReplacingMergeTree {#replacingmergetree} + +Движок отличается от [MergeTree](mergetree.md#table_engines-mergetree) тем, что выполняет удаление дублирующихся записей с одинаковым значением первичного ключа (точнее, с одинаковым значением [ключа сортировки](mergetree.md)). + +Дедупликация данных производится лишь во время слияний. Слияние происходят в фоне в неизвестный момент времени, на который вы не можете ориентироваться. Некоторая часть данных может остаться необработанной. Хотя вы можете вызвать внеочередное слияние с помощью запроса `OPTIMIZE`, на это не стоит рассчитывать, так как запрос `OPTIMIZE` приводит к чтению и записи большого объёма данных. + +Таким образом, `ReplacingMergeTree` подходит для фоновой чистки дублирующихся данных в целях экономии места, но не даёт гарантии отсутствия дубликатов. + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Описание параметров запроса смотрите в [описании запроса](../../../engines/table-engines/mergetree-family/replacingmergetree.md). + +**Параметры ReplacingMergeTree** + +- `ver` — столбец с версией, тип `UInt*`, `Date` или `DateTime`. Необязательный параметр. + + При слиянии, из всех строк с одинаковым значением первичного ключа `ReplacingMergeTree` оставляет только одну: + + - Последнюю в выборке, если `ver` не задан. + - С максимальной версией, если `ver` задан. + +**Секции запроса** + +При создании таблицы `ReplacingMergeTree` используются те же [секции](mergetree.md), что и при создании таблицы `MergeTree`. + +
+ +Устаревший способ создания таблицы + +!!! attention "Attention" + Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +Все параметры, кроме `ver` имеют то же значение, что в и `MergeTree`. + +- `ver` — столбец с версией. Необязательный параметр. Описание смотрите выше по тексту. + +
+ +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/replacingmergetree/) diff --git a/docs/ru/engines/table-engines/mergetree-family/replication.md b/docs/ru/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..ace4e355b38 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,211 @@ +# Репликация данных {#table_engines-replication} + +Репликация поддерживается только для таблиц семейства MergeTree: + +- ReplicatedMergeTree +- ReplicatedSummingMergeTree +- ReplicatedReplacingMergeTree +- ReplicatedAggregatingMergeTree +- ReplicatedCollapsingMergeTree +- ReplicatedVersionedCollapsingMergeTree +- ReplicatedGraphiteMergeTree + +Репликация работает на уровне отдельных таблиц, а не всего сервера. То есть, на сервере могут быть расположены одновременно реплицируемые и не реплицируемые таблицы. + +Репликация не зависит от шардирования. На каждом шарде репликация работает независимо. + +Реплицируются сжатые данные запросов `INSERT`, `ALTER` (см. подробности в описании запроса [ALTER](../../../engines/table-engines/mergetree-family/replication.md#query_language_queries_alter)). + +Запросы `CREATE`, `DROP`, `ATTACH`, `DETACH` и `RENAME` выполняются на одном сервере и не реплицируются: + +- Запрос `CREATE TABLE` создаёт новую реплицируемую таблицу на том сервере, где его выполнили. Если таблица уже существует на других серверах, запрос добавляет новую реплику. +- `DROP TABLE` удаляет реплику, расположенную на том сервере, где выполняется запрос. +- Запрос `RENAME` переименовывает таблицу на одной реплик. Другими словами, реплицируемые таблицы на разных репликах могут называться по-разному. + +ClickHouse хранит метаинформацию о репликах в [Apache ZooKeeper](https://zookeeper.apache.org). Используйте ZooKeeper 3.4.5 или новее. + +Для использовании репликации, установите параметры в секции [zookeeper](../../../operations/server-configuration-parameters/settings.md#server-settings_zookeeper) конфигурации сервера. + +!!! attention "Внимание" + Не пренебрегайте настройками безопасности. ClickHouse поддерживает [ACL схему](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) `digest` подсистемы безопасности ZooKeeper. + +Пример указания адресов кластера ZooKeeper: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +Можно указать любой имеющийся у вас ZooKeeper-кластер - система будет использовать в нём одну директорию для своих данных (директория указывается при создании реплицируемой таблицы). + +Если в конфигурационном файле не настроен ZooKeeper, то вы не сможете создать реплицируемые таблицы, а уже имеющиеся реплицируемые таблицы будут доступны в режиме только на чтение. + +При запросах `SELECT`, ZooKeeper не используется, т.е. репликация не влияет на производительность `SELECT` и запросы работают так же быстро, как и для нереплицируемых таблиц. При запросах к распределенным реплицированным таблицам поведение ClickHouse регулируется настройками [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) and [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md). + +При каждом запросе `INSERT`, делается около десятка записей в ZooKeeper в рамках нескольких транзакций. (Чтобы быть более точным, это для каждого вставленного блока данных; запрос INSERT содержит один блок или один блок на `max_insert_block_size = 1048576` строк.) Это приводит к некоторому увеличению задержек при `INSERT`, по сравнению с нереплицируемыми таблицами. Но если придерживаться обычных рекомендаций - вставлять данные пачками не более одного `INSERT` в секунду, то это не составляет проблем. На всём кластере ClickHouse, использующим для координации один кластер ZooKeeper, может быть в совокупности несколько сотен `INSERT` в секунду. Пропускная способность при вставке данных (количество строчек в секунду) такая же высокая, как для нереплицируемых таблиц. + +Для очень больших кластеров, можно использовать разные кластеры ZooKeeper для разных шардов. Впрочем, на кластере Яндекс.Метрики (примерно 300 серверов) такой необходимости не возникает. + +Репликация асинхронная, мульти-мастер. Запросы `INSERT` и `ALTER` можно направлять на любой доступный сервер. Данные вставятся на сервер, где выполнен запрос, а затем скопируются на остальные серверы. В связи с асинхронностью, только что вставленные данные появляются на остальных репликах с небольшой задержкой. Если часть реплик недоступна, данные на них запишутся тогда, когда они станут доступны. Если реплика доступна, то задержка составляет столько времени, сколько требуется для передачи блока сжатых данных по сети. + +По умолчанию, запрос INSERT ждёт подтверждения записи только от одной реплики. Если данные были успешно записаны только на одну реплику, и сервер с этой репликой перестал существовать, то записанные данные будут потеряны. Вы можете включить подтверждение записи от нескольких реплик, используя настройку `insert_quorum`. + +Каждый блок данных записывается атомарно. Запрос INSERT разбивается на блоки данных размером до `max_insert_block_size = 1048576` строк. То есть, если в запросе `INSERT` менее 1048576 строк, то он делается атомарно. + +Блоки данных дедуплицируются. При многократной записи одного и того же блока данных (блоков данных одинакового размера, содержащих одни и те же строчки в одном и том же порядке), блок будет записан только один раз. Это сделано для того, чтобы в случае сбоя в сети, когда клиентское приложение не может понять, были ли данные записаны в БД, можно было просто повторить запрос `INSERT`. При этом не имеет значения, на какую реплику будут отправлены INSERT-ы с одинаковыми данными. Запрос `INSERT` идемпотентный. Параметры дедуплицирования регулируются настройками сервера [merge\_tree](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-merge_tree) + +При репликации, по сети передаются только исходные вставляемые данные. Дальнейшие преобразования данных (слияния) координируются и делаются на всех репликах одинаковым образом. За счёт этого минимизируется использование сети, и благодаря этому, репликация хорошо работает при расположении реплик в разных дата-центрах. (Стоит заметить, что дублирование данных в разных дата-центрах, по сути, является основной задачей репликации). + +Количество реплик одних и тех же данных может быть произвольным. В Яндекс.Метрике в продакшене используется двукратная репликация. На каждом сервере используется RAID-5 или RAID-6, в некоторых случаях RAID-10. Это является сравнительно надёжным и удобным для эксплуатации решением. + +Система следит за синхронностью данных на репликах и умеет восстанавливаться после сбоя. Восстановление после сбоя автоматическое (в случае небольших различий в данных) или полуавтоматическое (когда данные отличаются слишком сильно, что может свидетельствовать об ошибке конфигурации). + +## Создание реплицируемых таблиц {#creating-replicated-tables} + +В начало имени движка таблицы добавляется `Replicated`. Например, `ReplicatedMergeTree`. + +**Параметры Replicated\*MergeTree** + +- `zoo_path` — путь к таблице в ZooKeeper. +- `replica_name` — имя реплики в ZooKeeper. + +Пример: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +
+ +Пример в устаревшем синтаксисе + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +
+ +Как видно в примере, эти параметры могут содержать подстановки в фигурных скобках. Подставляемые значения достаются из конфигурационного файла, из секции `macros`. Пример: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +Путь к таблице в ZooKeeper должен быть разным для каждой реплицируемой таблицы. В том числе, для таблиц на разных шардах, должны быть разные пути. +В данном случае, путь состоит из следующих частей: + +`/clickhouse/tables/` — общий префикс. Рекомендуется использовать именно его. + +`{layer}-{shard}` — идентификатор шарда. В данном примере он состоит из двух частей, так как на кластере Яндекс.Метрики используется двухуровневое шардирование. Для большинства задач, оставьте только подстановку {shard}, которая будет раскрываться в идентификатор шарда. + +`table_name` - имя узла для таблицы в ZooKeeper. Разумно делать его таким же, как имя таблицы. Оно указывается явно, так как, в отличие от имени таблицы, оно не меняется после запроса RENAME. +*Подсказка*: можно также указать имя базы данных перед `table_name`, например `db_name.table_name` + +Имя реплики — то, что идентифицирует разные реплики одной и той же таблицы. Можно использовать для него имя сервера, как показано в примере. Впрочем, достаточно, чтобы имя было уникально лишь в пределах каждого шарда. + +Можно не использовать подстановки, а указать соответствующие параметры явно. Это может быть удобным для тестирования и при настройке маленьких кластеров. Однако в этом случае нельзя пользоваться распределенными DDL-запросами (`ON CLUSTER`). + +При работе с большими кластерами мы рекомендуем использовать подстановки, они уменьшают вероятность ошибки. + +Выполните запрос `CREATE TABLE` на каждой реплике. Запрос создаёт новую реплицируемую таблицу, или добавляет новую реплику к имеющимся. + +Если вы добавляете новую реплику после того, как таблица на других репликах уже содержит некоторые данные, то после выполнения запроса, данные на новую реплику будут скачаны с других реплик. То есть, новая реплика синхронизирует себя с остальными. + +Для удаления реплики, выполните запрос `DROP TABLE`. При этом, удаляется только одна реплика — расположенная на том сервере, где вы выполняете запрос. + +## Восстановление после сбоя {#vosstanovlenie-posle-sboia} + +Если при старте сервера, недоступен ZooKeeper, реплицируемые таблицы переходят в режим только для чтения. Система будет пытаться периодически установить соединение с ZooKeeper. + +Если при `INSERT` недоступен ZooKeeper, или происходит ошибка при взаимодействии с ним, будет выкинуто исключение. + +При подключении к ZooKeeper, система проверяет соответствие между имеющимся в локальной файловой системе набором данных и ожидаемым набором данных (информация о котором хранится в ZooKeeper). Если имеются небольшие несоответствия, то система устраняет их, синхронизируя данные с реплик. + +Обнаруженные битые куски данных (с файлами несоответствующего размера) или неизвестные куски (куски, записанные в файловую систему, но информация о которых не была записана в ZooKeeper) переносятся в поддиректорию detached (не удаляются). Недостающие куски скачиваются с реплик. + +Стоит заметить, что ClickHouse не делает самостоятельно никаких деструктивных действий типа автоматического удаления большого количества данных. + +При старте сервера (или создании новой сессии с ZooKeeper), проверяется только количество и размеры всех файлов. Если у файлов совпадают размеры, но изменены байты где-то посередине, то это обнаруживается не сразу, а только при попытке их прочитать при каком-либо запросе `SELECT`. Запрос кинет исключение о несоответствующей чексумме или размере сжатого блока. В этом случае, куски данных добавляются в очередь на проверку, и при необходимости, скачиваются с реплик. + +Если обнаруживается, что локальный набор данных слишком сильно отличается от ожидаемого, то срабатывает защитный механизм. Сервер сообщает об этом в лог и отказывается запускаться. Это сделано, так как такой случай может свидетельствовать об ошибке конфигурации - например, если реплика одного шарда была случайно сконфигурирована, как реплика другого шарда. Тем не менее, пороги защитного механизма поставлены довольно низкими, и такая ситуация может возникнуть и при обычном восстановлении после сбоя. В этом случае, восстановление делается полуавтоматически - «по кнопке». + +Для запуска восстановления, создайте в ZooKeeper узел `/path_to_table/replica_name/flags/force_restore_data` с любым содержимым или выполните команду для восстановления всех реплицируемых таблиц: + +``` bash +$ sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +Затем запустите сервер. При старте, сервер удалит эти флаги и запустит восстановление. + +## Восстановление в случае потери всех данных {#vosstanovlenie-v-sluchae-poteri-vsekh-dannykh} + +Если на одном из серверов исчезли все данные и метаданные, восстановление делается следующим образом: + +1. Установите на сервер ClickHouse. Корректно пропишите подстановки в конфигурационном файле, отвечающие за идентификатор шарда и реплики, если вы их используете. +2. Если у вас были нереплицируемые таблицы, которые должны быть вручную продублированы на серверах, скопируйте их данные (в директории `/var/lib/clickhouse/data/db_name/table_name/`) с реплики. +3. Скопируйте с реплики определения таблиц, находящиеся в `/var/lib/clickhouse/metadata/`. Если в определениях таблиц, идентификатор шарда или реплики, прописаны в явном виде - исправьте их, чтобы они соответствовали данной реплике. (Альтернативный вариант - запустить сервер и сделать самостоятельно все запросы `ATTACH TABLE`, которые должны были бы быть в соответствующих .sql файлах в `/var/lib/clickhouse/metadata/`.) +4. Создайте в ZooKeeper узел `/path_to_table/replica_name/flags/force_restore_data` с любым содержимым или выполните команду для восстановления всех реплицируемых таблиц: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +Затем запустите сервер (перезапустите, если уже запущен). Данные будут скачаны с реплик. + +В качестве альтернативного варианта восстановления, вы можете удалить из ZooKeeper информацию о потерянной реплике (`/path_to_table/replica_name`), и затем создать реплику заново, как написано в разделе [Создание реплицированных таблиц](#creating-replicated-tables) . + +Отсутствует ограничение на использование сетевой полосы при восстановлении. Имейте это ввиду, если восстанавливаете сразу много реплик. + +## Преобразование из MergeTree в ReplicatedMergeTree {#preobrazovanie-iz-mergetree-v-replicatedmergetree} + +Здесь и далее, под `MergeTree` подразумеваются все движки таблиц семейства `MergeTree`, так же для `ReplicatedMergeTree`. + +Если у вас была таблица типа `MergeTree`, репликация которой делалась вручную, вы можете преобразовать её в реплицируемую таблицу. Это может понадобиться лишь в случаях, когда вы уже успели накопить большое количество данных в таблице типа `MergeTree`, а сейчас хотите включить репликацию. + +Если на разных репликах данные отличаются, то сначала синхронизируйте их, либо удалите эти данные на всех репликах кроме одной. + +Переименуйте имеющуюся MergeTree таблицу, затем создайте со старым именем таблицу типа `ReplicatedMergeTree`. +Перенесите данные из старой таблицы в поддиректорию detached в директории с данными новой таблицы (`/var/lib/clickhouse/data/db_name/table_name/`). +Затем добавьте эти куски данных в рабочий набор с помощью выполнения запросов `ALTER TABLE ATTACH PARTITION` на одной из реплик. + +## Преобразование из ReplicatedMergeTree в MergeTree {#preobrazovanie-iz-replicatedmergetree-v-mergetree} + +Создайте таблицу типа MergeTree с другим именем. Перенесите в её директорию с данными все данные из директории с данными таблицы типа `ReplicatedMergeTree`. Затем удалите таблицу типа `ReplicatedMergeTree` и перезапустите сервер. + +Если вы хотите избавиться от таблицы `ReplicatedMergeTree`, не запуская сервер, то + +- удалите соответствующий файл `.sql` в директории с метаданными (`/var/lib/clickhouse/metadata/`); +- удалите соответствующий путь в ZooKeeper (`/path_to_table/replica_name`); + +После этого, вы можете запустить сервер, создать таблицу типа `MergeTree`, перенести данные в её директорию, и перезапустить сервер. + +## Восстановление в случае потери или повреждения метаданных на ZooKeeper кластере {#vosstanovlenie-v-sluchae-poteri-ili-povrezhdeniia-metadannykh-na-zookeeper-klastere} + +Если данные в ZooKeeper оказались утеряны или повреждены, то вы можете сохранить данные, переместив их в нереплицируемую таблицу, как описано в пункте выше. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/replication/) diff --git a/docs/ru/engines/table-engines/mergetree-family/summingmergetree.md b/docs/ru/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..01cc1aae574 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,134 @@ +# SummingMergeTree {#summingmergetree} + +Движок наследует функциональность [MergeTree](mergetree.md#table_engines-mergetree). Отличие заключается в том, что для таблиц `SummingMergeTree` при слиянии кусков данных ClickHouse все строки с одинаковым первичным ключом (точнее, с одинаковым [ключом сортировки](mergetree.md)) заменяет на одну, которая хранит только суммы значений из столбцов с цифровым типом данных. Если ключ сортировки подобран таким образом, что одному значению ключа соответствует много строк, это значительно уменьшает объём хранения и ускоряет последующую выборку данных. + +Мы рекомендуем использовать движок в паре с `MergeTree`. В `MergeTree` храните полные данные, а `SummingMergeTree` используйте для хранения агрегированных данных, например, при подготовке отчетов. Такой подход позволит не утратить ценные данные из-за неправильно выбранного первичного ключа. + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = SummingMergeTree([columns]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Описание параметров запроса смотрите в [описании запроса](../../../engines/table-engines/mergetree-family/summingmergetree.md). + +**Параметры SummingMergeTree** + +- `columns` — кортеж с именами столбцов, в которых будут суммироваться данные. Необязательный параметр. + Столбцы должны иметь числовой тип и не должны входить в первичный ключ. + + Если `columns` не задан, то ClickHouse суммирует значения во всех столбцах с числовым типом данных, не входящих в первичный ключ. + +**Секции запроса** + +При создании таблицы `SummingMergeTree` используются те же [секции](mergetree.md) запроса, что и при создании таблицы `MergeTree`. + +
+ +Устаревший способ создания таблицы + +!!! attention "Attention" + Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) +``` + +Все параметры, кроме `columns` имеют то же значение, что в и `MergeTree`. + +- `columns` — кортеж с именами столбцов для суммирования данных. Необязательный параметр. Описание смотрите выше по тексту. + +
+ +## Пример использования {#primer-ispolzovaniia} + +Рассмотрим следующую таблицу: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +Добавим в неё данные: + +``` sql +INSERT INTO summtt Values(1,1),(1,2),(2,1) +``` + +ClickHouse может не полностью просуммировать все строки ([смотрите ниже по тексту](#obrabotka-dannykh)), поэтому при запросе мы используем агрегатную функцию `sum` и секцию `GROUP BY`. + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + +``` text +┌─key─┬─sum(value)─┐ +│ 2 │ 1 │ +│ 1 │ 3 │ +└─────┴────────────┘ +``` + +## Обработка данных {#obrabotka-dannykh} + +При вставке данных в таблицу они сохраняются как есть. Периодически ClickHouse выполняет слияние вставленных кусков данных и именно в этот момент производится суммирование и замена многих строк с одинаковым первичным ключом на одну для каждого результирующего куска данных. + +ClickHouse может слить куски данных таким образом, что не все строки с одинаковым первичным ключом окажутся в одном финальном куске, т.е. суммирование будет не полным. Поэтому, при выборке данных (`SELECT`) необходимо использовать агрегатную функцию [sum()](../../../engines/table-engines/mergetree-family/summingmergetree.md#agg_function-sum) и секцию `GROUP BY` как описано в примере выше. + +### Общие правила суммирования {#obshchie-pravila-summirovaniia} + +Суммируются значения в столбцах с числовым типом данных. Набор столбцов определяется параметром `columns`. + +Если значения во всех столбцах для суммирования оказались нулевыми, то строчка удаляется. + +Для столбцов, не входящих в первичный ключ и не суммирующихся, выбирается произвольное значение из имеющихся. + +Значения для столбцов, входящих в первичный ключ, не суммируются. + +### Суммирование в столбцах AggregateFunction {#summirovanie-v-stolbtsakh-aggregatefunction} + +Для столбцов типа [AggregateFunction](../../../engines/table-engines/mergetree-family/summingmergetree.md#data_type-aggregatefunction) ClickHouse выполняет агрегацию согласно заданной функции, повторяя поведение движка [AggregatingMergeTree](aggregatingmergetree.md). + +### Вложенные структуры {#vlozhennye-struktury} + +Таблица может иметь вложенные структуры данных, которые обрабатываются особым образом. + +Если название вложенной таблицы заканчивается на `Map` и она содержит не менее двух столбцов, удовлетворяющих критериям: + +- первый столбец - числовой `(*Int*, Date, DateTime)`, назовем его условно `key`, +- остальные столбцы - арифметические `(*Int*, Float32/64)`, условно `(values...)`, + +то вложенная таблица воспринимается как отображение `key => (values...)` и при слиянии её строк выполняется слияние элементов двух множеств по `key` со сложением соответствующих `(values...)`. + +Примеры: + +``` text +[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] +[(1, 100)] + [(1, 150)] -> [(1, 250)] +[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] +[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] +``` + +При запросе данных используйте функцию [sumMap(key, value)](../../../engines/table-engines/mergetree-family/summingmergetree.md) для агрегации `Map`. + +Для вложенной структуры данных не нужно указывать её столбцы в кортеже столбцов для суммирования. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/summingmergetree/) diff --git a/docs/ru/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/ru/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..d90d9555e02 --- /dev/null +++ b/docs/ru/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,231 @@ +# VersionedCollapsingMergeTree {#versionedcollapsingmergetree} + +Движок: + +- Позволяет быстро записывать постоянно изменяющиеся состояния объектов. +- Удаляет старые состояния объектов в фоновом режиме. Это значительно сокращает объём хранения. + +Подробнее читайте в разделе [Collapsing](#table_engines_versionedcollapsingmergetree). + +Движок наследует функциональность от [MergeTree](mergetree.md#table_engines-mergetree) и добавляет в алгоритм слияния кусков данных логику сворачивания (удаления) строк. `VersionedCollapsingMergeTree` предназначен для тех же задач, что и [CollapsingMergeTree](collapsingmergetree.md), но использует другой алгоритм свёртывания, который позволяет вставлять данные в любом порядке в несколько потоков. В частности, столбец `Version` помогает свернуть строки правильно, даже если они вставлены в неправильном порядке. `CollapsingMergeTree` требует строго последовательную вставку данных. + +## Создание таблицы {#sozdanie-tablitsy} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Подробности про `CREATE TABLE` смотрите в [описании запроса](../../../engines/table-engines/mergetree-family/versionedcollapsingmergetree.md). + +**Параметры движка** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. + + Тип данных столбца должен быть `Int8`. + +- `version` — имя столбца с версией состояния объекта. + + Тип данных столбца должен быть `UInt*`. + +**Секции запроса** + +При создании таблицы `VersionedСollapsingMergeTree` используются те же [секции](mergetree.md) запроса, что и при создании таблицы `MergeTree` . + +
+ +Устаревший способ создания таблицы + +!!! warning "Внимание" + Не используйте этот метод в новых проектах. По возможности переключите старые проекты на метод, описанный выше. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +Все параметры, за исключением `sign` и `version` имеют то же значение, что и в `MergeTree`. + +- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. + + Тип данных столбца — `Int8`. + +- `version` — имя столбца с версией состояния объекта. + + Тип данных столбца должен быть `UInt*`. + +
+ +## Сворачивание (удаление) строк {#table_engines-versionedcollapsingmergetree} + +### Данные {#dannye} + +Рассмотрим ситуацию, когда необходимо сохранять постоянно изменяющиеся данные для какого-либо объекта. Разумно иметь одну строку для объекта и обновлять эту строку при каждом изменении. Однако операция обновления является дорогостоящей и медленной для СУБД, поскольку требует перезаписи данных в хранилище. Обновление неприемлемо, если требуется быстро записывать данные, но можно записывать изменения в объект последовательно следующим образом. + +Используйте столбец `Sign` при записи строки. Если `Sign = 1`, то это означает, что строка является состоянием объекта, назовём её строкой состояния. Если `Sign = -1`, то это означает отмену состояния объекта с теми же атрибутами, назовём её строкой отмены состояния. Также используйте столбец `Version`, который должен идентифицировать каждое состояние объекта отдельным номером. + +Например, мы хотим рассчитать, сколько страниц пользователи посетили на каком-либо сайте и как долго они там находились. В какой-то момент времени мы записываем следующую строку состояния пользовательской активности: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Через некоторое время мы регистрируем изменение активности пользователя и записываем его следующими двумя строками. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Первая строка отменяет предыдущее состояние объекта (пользователя). Она должна копировать все поля отменяемого состояния за исключением `Sign`. + +Вторая строка содержит текущее состояние. + +Поскольку нам нужно только последнее состояние активности пользователя, строки + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +можно удалить, сворачивая (удаляя) устаревшее состояние объекта. `VersionedCollapsingMergeTree` делает это при слиянии кусков данных. + +Чтобы узнать, зачем нам нужны две строки для каждого изменения, см. раздел [Алгоритм](#table_engines-versionedcollapsingmergetree-algorithm). + +**Примечания по использованию** + +1. Программа, которая записывает данные, должна помнить состояние объекта, чтобы иметь возможность отменить его. Строка отмены состояния должна быть копией предыдущей строки состояния с противоположным значением `Sign`. Это увеличивает начальный размер хранилища, но позволяет быстро записывать данные. +2. Длинные растущие массивы в столбцах снижают эффективность работы движка за счёт нагрузки на запись. Чем проще данные, тем выше эффективность. +3. `SELECT` результаты сильно зависят от согласованности истории изменений объекта. Будьте точны при подготовке данных для вставки. Вы можете получить непредсказуемые результаты с несогласованными данными, такими как отрицательные значения для неотрицательных метрик, таких как глубина сеанса. + +### Алгоритм {#table_engines-versionedcollapsingmergetree-algorithm} + +Когда ClickHouse объединяет куски данных, он удаляет каждую пару строк, которые имеют один и тот же первичный ключ и версию и разный `Sign`. Порядок строк не имеет значения. + +Когда ClickHouse вставляет данные, он упорядочивает строки по первичному ключу. Если столбец `Version` не находится в первичном ключе, ClickHouse добавляет его к первичному ключу неявно как последнее поле и использует для сортировки. + +## Выборка данных {#vyborka-dannykh} + +ClickHouse не гарантирует, что все строки с одинаковым первичным ключом будут находиться в одном результирующем куске данных или даже на одном физическом сервере. Это справедливо как для записи данных, так и для последующего слияния кусков данных. Кроме того, ClickHouse обрабатывает запросы `SELECT` несколькими потоками, и не может предсказать порядок строк в конечной выборке. Это означает, что если необходимо получить полностью «свернутые» данные из таблицы `VersionedCollapsingMergeTree`, то требуется агрегирование. + +Для завершения свертывания добавьте в запрос секцию `GROUP BY` и агрегатные функции, которые учитывают знак. Например, для расчета количества используйте `sum(Sign)` вместо`count()`. Чтобы вычислить сумму чего-либо, используйте `sum(Sign * x)` вместо`sum(х)`, а также добавьте `HAVING sum(Sign) > 0` . + +Таким образом можно вычислять агрегации `count`, `sum` и `avg`. Агрегация `uniq` может вычисляться, если объект имеет хотя бы одно не свернутое состояние. Невозможно вычислить агрегации `min` и `max` поскольку`VersionedCollapsingMergeTree` не сохраняет историю значений для свернутых состояний. + +Если необходимо выбирать данные без агрегации (например, проверить наличие строк, последние значения которых удовлетворяют некоторым условиям), можно использовать модификатор `FINAL` для секции `FROM`. Такой подход неэффективен и не должен использоваться с большими таблицами. + +## Пример использования {#primer-ispolzovaniia} + +Данные для примера: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Создание таблицы: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +Вставка данных: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +Мы используем два запроса `INSERT` для создания двух различных кусков данных. Если мы вставляем данные с помощью одного запроса, ClickHouse создаёт один кусок данных и не будет выполнять слияние. + +Получение данных: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Что мы видим и где сворачивание? +Мы создали два куска данных, используя два запроса `INSERT`. Запрос `SELECT` был выполнен в два потока, и результатом является случайный порядок строк. +Свертывание не произошло, поскольку части данных еще не были объединены. ClickHouse объединяет части данных в неизвестный момент времени, который мы не можем предсказать. + +Поэтому нам нужна агрегация: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +Если нам не нужна агрегация, но мы хотим принудительно выполнить свёртку данных, то можно использовать модификатор `FINAL` для секции `FROM`. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Это очень неэффективный способ выбора данных. Не используйте его для больших таблиц. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/ru/engines/table_engines/special/buffer.md b/docs/ru/engines/table-engines/special/buffer.md similarity index 100% rename from docs/ru/engines/table_engines/special/buffer.md rename to docs/ru/engines/table-engines/special/buffer.md diff --git a/docs/ru/engines/table-engines/special/dictionary.md b/docs/ru/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..b35c8cecc8f --- /dev/null +++ b/docs/ru/engines/table-engines/special/dictionary.md @@ -0,0 +1,88 @@ +# Dictionary {#dictionary} + +Движок `Dictionary` отображает данные [словаря](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) как таблицу ClickHouse. + +Рассмотрим для примера словарь `products` со следующей конфигурацией: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +Запрос данных словаря: + +``` sql +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + +``` text +┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ +│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ +└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ +``` + +В таком виде данные из словаря можно получить при помощи функций [dictGet\*](../../../engines/table-engines/special/dictionary.md#ext_dict_functions). + +Такое представление неудобно, когда нам необходимо получить данные в чистом виде, а также при выполнении операции `JOIN`. Для этих случаев можно использовать движок `Dictionary`, который отобразит данные словаря в таблицу. + +Синтаксис: + +``` sql +CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` +``` + +Пример использования: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); +``` + +Проверим что у нас в таблице? + +``` sql +select * from products limit 1; +``` + +``` text +┌────product_id─┬─title───────────┐ +│ 152689 │ Some item │ +└───────────────┴─────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/dictionary/) diff --git a/docs/ru/engines/table-engines/special/distributed.md b/docs/ru/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..11fa9f9f146 --- /dev/null +++ b/docs/ru/engines/table-engines/special/distributed.md @@ -0,0 +1,116 @@ +# Distributed {#distributed} + +**Движок Distributed не хранит данные самостоятельно**, а позволяет обрабатывать запросы распределённо, на нескольких серверах. +Чтение автоматически распараллеливается. При чтении будут использованы индексы таблиц на удалённых серверах, если есть. +Движок Distributed принимает параметры: имя кластера в конфигурационном файле сервера, имя удалённой базы данных, имя удалённой таблицы, а также (не обязательно) ключ шардирования. +Пример: + +``` sql +Distributed(logs, default, hits[, sharding_key]) +``` + +данные будут читаться со всех серверов кластера logs, из таблицы default.hits, расположенной на каждом сервере кластера. +Данные не только читаются, но и частично (настолько, насколько это возможно) обрабатываются на удалённых серверах. +Например, при запросе с GROUP BY, данные будут агрегированы на удалённых серверах, промежуточные состояния агрегатных функций будут отправлены на запросивший сервер; затем данные будут доагрегированы. + +Вместо имени базы данных может использоваться константное выражение, возвращающее строку. Например, currentDatabase(). + +logs - имя кластера в конфигурационном файле сервера. + +Кластеры задаются следующим образом: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 9000 + + + + +``` + +Здесь задан кластер с именем logs, состоящий из двух шардов, каждый из которых состоит из двух реплик. +Шардами называются серверы, содержащие разные части данных (чтобы прочитать все данные, нужно идти на все шарды). +Репликами называются дублирующие серверы (чтобы прочитать данные, можно идти за данными на любую из реплик). + +Имя кластера не должно содержать точки. + +В качестве параметров для каждого сервера указываются `host`, `port` и, не обязательно, `user`, `password`, `secure`, `compression`: +- `host` - адрес удалённого сервера. Может быть указан домен, или IPv4 или IPv6 адрес. В случае указания домена, при старте сервера делается DNS запрос, и результат запоминается на всё время работы сервера. Если DNS запрос неуспешен, то сервер не запускается. Если вы изменяете DNS-запись, перезапустите сервер. +- `port` - TCP-порт для межсерверного взаимодействия (в конфиге - tcp\_port, обычно 9000). Не перепутайте с http\_port. +- `user` - имя пользователя для соединения с удалённым сервером. по умолчанию - default. Этот пользователь должен иметь доступ для соединения с указанным сервером. Доступы настраиваются в файле users.xml, подробнее смотрите в разделе [Права доступа](../../../operations/access-rights.md). +- `password` - пароль для соединения с удалённым сервером, в открытом виде. по умолчанию - пустая строка. +- `secure` - Использовать шифрованное соединение ssl, Обычно используется с портом `port` = 9440. Сервер должен слушать порт 9440 с корректными настройками сертификатов. +- `compression` - Использовать сжатие данных. По умолчанию: true. + +При указании реплик, для каждого из шардов, при чтении, будет выбрана одна из доступных реплик. Можно настроить алгоритм балансировки нагрузки (то есть, предпочтения, на какую из реплик идти) - см. настройку [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing). +Если соединение с сервером не установлено, то будет произведена попытка соединения с небольшим таймаутом. Если соединиться не удалось, то будет выбрана следующая реплика, и так для всех реплик. Если попытка соединения для всех реплик не удалась, то будут снова произведены попытки соединения по кругу, и так несколько раз. +Это работает в пользу отказоустойчивости, хотя и не обеспечивает полную отказоустойчивость: удалённый сервер может принять соединение, но не работать, или плохо работать. + +Можно указать от одного шарда (в таком случае, обработку запроса стоит называть удалённой, а не распределённой) до произвольного количества шардов. В каждом шарде можно указать от одной до произвольного числа реплик. Можно указать разное число реплик для каждого шарда. + +Вы можете прописать сколько угодно кластеров в конфигурации. + +Для просмотра имеющихся кластеров, вы можете использовать системную таблицу system.clusters. + +Движок Distributed позволяет работать с кластером, как с локальным сервером. При этом, кластер является неэластичным: вы должны прописать его конфигурацию в конфигурационный файл сервера (лучше всех серверов кластера). + +Как видно, движок Distributed требует прописывания кластера в конфигурационный файл; кластера из конфигурационного файла обновляются налету, без перезапуска сервера. Если вам необходимо каждый раз отправлять запрос на неизвестный набор шардов и реплик, вы можете не создавать Distributed таблицу, а воспользоваться табличной функцией remote. Смотрите раздел [Табличные функции](../../../engines/table-engines/special/distributed.md). + +Есть два способа записывать данные на кластер: + +Во-первых, вы можете самостоятельно определять, на какие серверы какие данные записывать, и выполнять запись непосредственно на каждый шард. То есть, делать INSERT в те таблицы, на которые «смотрит» распределённая таблица. Это наиболее гибкое решение поскольку вы можете использовать любую схему шардирования, которая может быть нетривиальной из-за требований предметной области. +Также это является наиболее оптимальным решением, так как данные могут записываться на разные шарды полностью независимо. + +Во-вторых, вы можете делать INSERT в Distributed таблицу. В этом случае, таблица будет сама распределять вставляемые данные по серверам. Для того, чтобы писать в Distributed таблицу, у неё должен быть задан ключ шардирования (последний параметр). Также, если шард всего-лишь один, то запись работает и без указания ключа шардирования (так как в этом случае он не имеет смысла). + +У каждого шарда в конфигурационном файле может быть задан «вес» (weight). По умолчанию, вес равен единице. Данные будут распределяться по шардам в количестве, пропорциональном весу шарда. Например, если есть два шарда, и у первого выставлен вес 9, а у второго 10, то на первый будет отправляться 9 / 19 доля строк, а на второй - 10 / 19. + +У каждого шарда в конфигурационном файле может быть указан параметр internal\_replication. + +Если он выставлен в true, то для записи будет выбираться первая живая реплика и данные будут писаться на неё. Этот вариант следует использовать, если Distributed таблица «смотрит» на реплицируемые таблицы. То есть, если таблица, в которую будут записаны данные, будет сама заниматься их репликацией. + +Если он выставлен в false (по умолчанию), то данные будут записываться на все реплики. По сути, это означает, что Distributed таблица занимается репликацией данных самостоятельно. Это хуже, чем использование реплицируемых таблиц, так как не контролируется консистентность реплик, и они со временем будут содержать немного разные данные. + +Для выбора шарда, на который отправляется строка данных, вычисляется выражение шардирования, и берётся его остаток от деления на суммарный вес шардов. Строка отправляется на шард, соответствующий полуинтервалу остатков от prev\_weights до prev\_weights + weight, где prev\_weights - сумма весов шардов с меньшим номером, а weight - вес этого шарда. Например, если есть два шарда, и у первого выставлен вес 9, а у второго 10, то строка будет отправляться на первый шард для остатков из диапазона \[0, 9), а на второй - для остатков из диапазона \[9, 19). + +Выражением шардирование может быть произвольное выражение от констант и столбцов таблицы, возвращающее целое число. Например, вы можете использовать выражение rand() для случайного распределения данных, или UserID - для распределения по остатку от деления идентификатора посетителя (тогда данные одного посетителя будут расположены на одном шарде, что упростит выполнение IN и JOIN по посетителям). Если распределение какого-либо столбца недостаточно равномерное, вы можете обернуть его в хэш функцию: intHash64(UserID). + +Простой остаток от деления является довольно ограниченным решением для шардирования и подходит не для всех случаев. Он подходит для среднего и большого объёма данных (десятки серверов), но не для очень больших объёмов данных (сотни серверов и больше). В последнем случае, лучше использовать схему шардирования, продиктованную требованиями предметной области, и не использовать возможность записи в Distributed таблицы. + +Запросы SELECT отправляются на все шарды, и работают независимо от того, каким образом данные распределены по шардам (они могут быть распределены полностью случайно). При добавлении нового шарда, можно не переносить на него старые данные, а записывать новые данные с большим весом - данные будут распределены слегка неравномерно, но запросы будут работать корректно и достаточно эффективно. + +Беспокоиться о схеме шардирования имеет смысл в следующих случаях: +- используются запросы, требующие соединение данных (IN, JOIN) по определённому ключу - тогда если данные шардированы по этому ключу, то можно использовать локальные IN, JOIN вместо GLOBAL IN, GLOBAL JOIN, что кардинально более эффективно. +- используется большое количество серверов (сотни и больше) и большое количество маленьких запросов (запросы отдельных клиентов - сайтов, рекламодателей, партнёров) - тогда, для того, чтобы маленькие запросы не затрагивали весь кластер, имеет смысл располагать данные одного клиента на одном шарде, или (вариант, который используется в Яндекс.Метрике) сделать двухуровневое шардирование: разбить весь кластер на «слои», где слой может состоять из нескольких шардов; данные для одного клиента располагаются на одном слое, но в один слой можно по мере необходимости добавлять шарды, в рамках которых данные распределены произвольным образом; создаются распределённые таблицы на каждый слой и одна общая распределённая таблица для глобальных запросов. + +Запись данных осуществляется полностью асинхронно. При вставке в таблицу, блок данных сначала записывается в файловую систему. Затем, в фоновом режиме отправляются на удалённые серверы при первой возможности. Период отправки регулируется настройками [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) и [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms). Движок таблиц `Distributed` отправляет каждый файл со вставленными данными отдельно, но можно включить пакетную отправку данных настройкой [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts). Эта настройка улучшает производительность кластера за счет более оптимального использования ресурсов сервера-отправителя и сети. Необходимо проверять, что данные отправлены успешно, для этого проверьте список файлов (данных, ожидающих отправки) в каталоге таблицы `/var/lib/clickhouse/data/database/table/`. + +Если после INSERT-а в Distributed таблицу, сервер перестал существовать или был грубо перезапущен (например, в следствие аппаратного сбоя), то записанные данные могут быть потеряны. Если в директории таблицы обнаружен повреждённый кусок данных, то он переносится в поддиректорию broken и больше не используется. + +При выставлении опции max\_parallel\_replicas выполнение запроса распараллеливается по всем репликам внутри одного шарда. Подробнее смотрите раздел [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/distributed/) diff --git a/docs/ru/engines/table_engines/special/external_data.md b/docs/ru/engines/table-engines/special/external-data.md similarity index 100% rename from docs/ru/engines/table_engines/special/external_data.md rename to docs/ru/engines/table-engines/special/external-data.md diff --git a/docs/ru/engines/table-engines/special/file.md b/docs/ru/engines/table-engines/special/file.md new file mode 100644 index 00000000000..907988a47aa --- /dev/null +++ b/docs/ru/engines/table-engines/special/file.md @@ -0,0 +1,79 @@ +# File(Format) {#table_engines-file} + +Управляет данными в одном файле на диске в указанном формате. + +Примеры применения: + +- Выгрузка данных из ClickHouse в файл. +- Преобразование данных из одного формата в другой. +- Обновление данных в ClickHouse редактированием файла на диске. + +## Использование движка в сервере ClickHouse {#ispolzovanie-dvizhka-v-servere-clickhouse} + +``` sql +File(Format) +``` + +`Format` должен быть таким, который ClickHouse может использовать и в запросах `INSERT` и в запросах `SELECT`. Полный список поддерживаемых форматов смотрите в разделе [Форматы](../../../interfaces/formats.md#formats). + +Сервер ClickHouse не позволяет указать путь к файлу, с которым будет работать `File`. Используется путь к хранилищу, определенный параметром [path](../../../operations/server-configuration-parameters/settings.md) в конфигурации сервера. + +При создании таблицы с помощью `File(Format)` сервер ClickHouse создает в хранилище каталог с именем таблицы, а после добавления в таблицу данных помещает туда файл `data.Format`. + +Можно вручную создать в хранилище каталог таблицы, поместить туда файл, затем на сервере ClickHouse добавить ([ATTACH](../../../engines/table-engines/special/file.md)) информацию о таблице, соответствующей имени каталога и прочитать из файла данные. + +!!! warning "Warning" + Будьте аккуратны с этой функциональностью, поскольку сервер ClickHouse не отслеживает внешние изменения данных. Если в файл будет производиться запись одновременно со стороны сервера ClickHouse и с внешней стороны, то результат непредсказуем. + +**Пример:** + +**1.** Создадим на сервере таблицу `file_engine_table`: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +В конфигурации по умолчанию сервер ClickHouse создаст каталог `/var/lib/clickhouse/data/default/file_engine_table`. + +**2.** Вручную создадим файл `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` с содержимым: + +``` bash +$cat data.TabSeparated +one 1 +two 2 +``` + +**3.** Запросим данные: + +``` sql +SELECT * FROM file_engine_table +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Использование движка в Clickhouse-local {#ispolzovanie-dvizhka-v-clickhouse-local} + +В [clickhouse-local](../../../engines/table-engines/special/file.md) движок в качестве параметра принимает не только формат, но и путь к файлу. В том числе можно указать стандартные потоки ввода/вывода цифровым или буквенным обозначением `0` или `stdin`, `1` или `stdout`. + +**Пример:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## Детали реализации {#detali-realizatsii} + +- Поддерживается одновременное выполнение множества запросов `SELECT`, запросы `INSERT` могут выполняться только последовательно. +- Поддерживается создание ещё не существующего файла при запросе `INSERT`. +- Для существующих файлов `INSERT` записывает в конец файла. +- Не поддерживается: + - использование операций `ALTER` и `SELECT...SAMPLE`; + - индексы; + - репликация. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/file/) diff --git a/docs/ru/engines/table-engines/special/generate.md b/docs/ru/engines/table-engines/special/generate.md new file mode 120000 index 00000000000..04af4b109a7 --- /dev/null +++ b/docs/ru/engines/table-engines/special/generate.md @@ -0,0 +1 @@ +../../../../en/engines/table-engines/special/generate.md \ No newline at end of file diff --git a/docs/ru/engines/table-engines/special/index.md b/docs/ru/engines/table-engines/special/index.md new file mode 100644 index 00000000000..b1789f34347 --- /dev/null +++ b/docs/ru/engines/table-engines/special/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Special +toc_priority: 31 +--- + + diff --git a/docs/ru/engines/table-engines/special/join.md b/docs/ru/engines/table-engines/special/join.md new file mode 100644 index 00000000000..a5ed68f0959 --- /dev/null +++ b/docs/ru/engines/table-engines/special/join.md @@ -0,0 +1,104 @@ +# Join {#join} + +Подготовленная структура данных для использования в операциях [JOIN](../../../engines/table-engines/special/join.md#select-join). + +## Создание таблицы {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], +) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) +``` + +Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table-engines/special/join.md#create-table-query). + +**Параметры движка** + +- `join_strictness` – [строгость JOIN](../../../engines/table-engines/special/join.md#select-join-strictness). +- `join_type` – [тип JOIN](../../../engines/table-engines/special/join.md#select-join-types). +- `k1[, k2, ...]` – ключевые столбцы секции `USING` с которыми выполняется операция `JOIN`. + +Вводите параметры `join_strictness` и `join_type` без кавычек, например, `Join(ANY, LEFT, col1)`. Они должны быть такими же как и в той операции `JOIN`, в которой таблица будет использоваться. Если параметры не совпадают, ClickHouse не генерирует исключение и может возвращать неверные данные. + +## Использование таблицы {#ispolzovanie-tablitsy} + +### Пример {#primer} + +Создание левой таблицы: + +``` sql +CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog +``` + +``` sql +INSERT INTO id_val VALUES (1,11)(2,12)(3,13) +``` + +Создание правой таблицы с движком `Join`: + +``` sql +CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) +``` + +``` sql +INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) +``` + +Объединение таблиц: + +``` sql +SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 +``` + +``` text +┌─id─┬─val─┬─id_val_join.val─┐ +│ 1 │ 11 │ 21 │ +│ 2 │ 12 │ ᴺᵁᴸᴸ │ +│ 3 │ 13 │ 23 │ +└────┴─────┴─────────────────┘ +``` + +В качестве альтернативы, можно извлечь данные из таблицы `Join`, указав значение ключа объединения: + +``` sql +SELECT joinGet('id_val_join', 'val', toUInt32(1)) +``` + +``` text +┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ +│ 21 │ +└────────────────────────────────────────────┘ +``` + +### Выборка и вставка данных {#vyborka-i-vstavka-dannykh} + +Для добавления данных в таблицы с движком `Join` используйте запрос `INSERT`. Если таблица создавалась со строгостью `ANY`, то данные с повторяющимися ключами игнорируются. Если задавалась строгость `ALL`, то добавляются все строки. + +Из таблиц нельзя выбрать данные с помощью запроса `SELECT`. Вместо этого, используйте один из следующих методов: + +- Используйте таблицу как правую в секции `JOIN`. +- Используйте функцию [joinGet](../../../engines/table-engines/special/join.md#joinget), которая позволяет извлекать данные из таблицы таким же образом как из словаря. + +### Ограничения и настройки {#join-limitations-and-settings} + +При создании таблицы, применяются следующие параметры : + +- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) +- [max\_rows\_in\_join](../../../operations/settings/query-complexity.md#settings-max_rows_in_join) +- [max\_bytes\_in\_join](../../../operations/settings/query-complexity.md#settings-max_bytes_in_join) +- [join\_overflow\_mode](../../../operations/settings/query-complexity.md#settings-join_overflow_mode) +- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) + +Таблицы с движком `Join` нельзя использовать в операциях `GLOBAL JOIN`. + +Движок `Join` позволяет использовать параметр [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) в запросе `CREATE TABLE`, который также можно использовать в запросе [SELECT](../../../engines/table-engines/special/join.md). Если у вас разные настройки `join_use_nulls`, вы можете получить сообщение об ошибке при объединении таблиц. Это зависит от типа соединения. Когда вы используете функцию [joinGet](../../../engines/table-engines/special/join.md#joinget), вам необходимо использовать один и тот же параметр `join_use_nulls` в запросах `CRATE TABLE` и `SELECT`. + +## Хранение данных {#khranenie-dannykh} + +Данные таблиц `Join` всегда находятся в RAM. При вставке строк в таблицу ClickHouse записывает блоки данных в каталог на диске, чтобы их можно было восстановить при перезапуске сервера. + +При аварийном перезапуске сервера блок данных на диске может быть потерян или повреждён. В последнем случае, может потребоваться вручную удалить файл с повреждёнными данными. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/join/) diff --git a/docs/ru/engines/table-engines/special/materializedview.md b/docs/ru/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..08a2b4a3c07 --- /dev/null +++ b/docs/ru/engines/table-engines/special/materializedview.md @@ -0,0 +1,5 @@ +# MaterializedView {#materializedview} + +Используется для реализации материализованных представлений (подробнее см. запрос [CREATE TABLE](../../../engines/table-engines/special/materializedview.md)). Для хранения данных, использует другой движок, который был указан при создании представления. При чтении из таблицы, просто использует этот движок. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/materializedview/) diff --git a/docs/ru/engines/table_engines/special/memory.md b/docs/ru/engines/table-engines/special/memory.md similarity index 100% rename from docs/ru/engines/table_engines/special/memory.md rename to docs/ru/engines/table-engines/special/memory.md diff --git a/docs/ru/engines/table-engines/special/merge.md b/docs/ru/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..4f6e1751591 --- /dev/null +++ b/docs/ru/engines/table-engines/special/merge.md @@ -0,0 +1,63 @@ +# Merge {#merge} + +Движок `Merge` (не путайте с движком `MergeTree`) не хранит данные самостоятельно, а позволяет читать одновременно из произвольного количества других таблиц. +Чтение автоматически распараллеливается. Запись в таблицу не поддерживается. При чтении будут использованы индексы тех таблиц, из которых реально идёт чтение, если они существуют. +Движок `Merge` принимает параметры: имя базы данных и регулярное выражение для таблиц. + +Пример: + +``` sql +Merge(hits, '^WatchLog') +``` + +Данные будут читаться из таблиц в базе `hits`, имена которых соответствуют регулярному выражению ‘`^WatchLog`’. + +Вместо имени базы данных может использоваться константное выражение, возвращающее строку. Например, `currentDatabase()`. + +Регулярные выражения — [re2](https://github.com/google/re2) (поддерживает подмножество PCRE), регистрозависимые. +Смотрите замечание об экранировании в регулярных выражениях в разделе «match». + +При выборе таблиц для чтения, сама `Merge`-таблица не будет выбрана, даже если попадает под регулярное выражение, чтобы не возникло циклов. +Впрочем, вы можете создать две `Merge`-таблицы, которые будут пытаться бесконечно читать данные друг друга, но делать этого не нужно. + +Типичный способ использования движка `Merge` — работа с большим количеством таблиц типа `TinyLog`, как с одной. + +Пример 2: + +Пусть есть старая таблица `WatchLog_old`. Необходимо изменить партиционирование без перемещения данных в новую таблицу `WatchLog_new`. При этом в выборке должны участвовать данные обеих таблиц. + +``` sql +CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree(date, (UserId, EventType), 8192); +INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + +CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; +INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + +CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + +SELECT * +FROM WatchLog +``` + +``` text +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-01 │ 1 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-02 │ 2 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +``` + +## Виртуальные столбцы {#virtualnye-stolbtsy} + +- `_table` — содержит имя таблицы, из которой данные были прочитаны. Тип — [String](../../../engines/table-engines/special/merge.md). + + В секции `WHERE/PREWHERE` можно установить константное условие на столбец `_table` (например, `WHERE _table='xyz'`). В этом случае операции чтения выполняются только для тех таблиц, для которых выполняется условие на значение `_table`, таким образом, столбец `_table` работает как индекс. + +**Смотрите также** + +- [Виртуальные столбцы](index.md#table_engines-virtual_columns) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/merge/) diff --git a/docs/ru/engines/table_engines/special/null.md b/docs/ru/engines/table-engines/special/null.md similarity index 100% rename from docs/ru/engines/table_engines/special/null.md rename to docs/ru/engines/table-engines/special/null.md diff --git a/docs/ru/engines/table_engines/special/set.md b/docs/ru/engines/table-engines/special/set.md similarity index 100% rename from docs/ru/engines/table_engines/special/set.md rename to docs/ru/engines/table-engines/special/set.md diff --git a/docs/ru/engines/table_engines/special/url.md b/docs/ru/engines/table-engines/special/url.md similarity index 100% rename from docs/ru/engines/table_engines/special/url.md rename to docs/ru/engines/table-engines/special/url.md diff --git a/docs/ru/engines/table_engines/special/view.md b/docs/ru/engines/table-engines/special/view.md similarity index 100% rename from docs/ru/engines/table_engines/special/view.md rename to docs/ru/engines/table-engines/special/view.md diff --git a/docs/ru/engines/table_engines/index.md b/docs/ru/engines/table_engines/index.md deleted file mode 100644 index fdf9cd50bf6..00000000000 --- a/docs/ru/engines/table_engines/index.md +++ /dev/null @@ -1,76 +0,0 @@ -# Движки таблиц {#table_engines} - -Движок таблицы (тип таблицы) определяет: - -- Как и где хранятся данные, куда их писать и откуда читать. -- Какие запросы поддерживаются и каким образом. -- Конкурентный доступ к данным. -- Использование индексов, если есть. -- Возможно ли многопоточное выполнение запроса. -- Параметры репликации данных. - -## Семейства движков {#semeistva-dvizhkov} - -### MergeTree {#mergetree} - -Наиболее универсальные и функциональные движки таблиц для задач с высокой загрузкой. Общим свойством этих движков является быстрая вставка данных с последующей фоновой обработкой данных. Движки `*MergeTree` поддерживают репликацию данных (в [Replicated\*](mergetree_family/replication.md) версиях движков), партиционирование, и другие возможности не поддержанные для других движков. - -Движки семейства: - -- [MergeTree](mergetree_family/mergetree.md) -- [ReplacingMergeTree](mergetree_family/replacingmergetree.md) -- [SummingMergeTree](mergetree_family/summingmergetree.md) -- [AggregatingMergeTree](mergetree_family/aggregatingmergetree.md) -- [CollapsingMergeTree](mergetree_family/collapsingmergetree.md) -- [VersionedCollapsingMergeTree](mergetree_family/versionedcollapsingmergetree.md) -- [GraphiteMergeTree](mergetree_family/graphitemergetree.md) - -### Log {#log} - -Простые [движки](log_family/index.md) с минимальной функциональностью. Они наиболее эффективны, когда вам нужно быстро записать много небольших таблиц (до примерно 1 миллиона строк) и прочитать их позже целиком. - -Движки семейства: - -- [TinyLog](log_family/tinylog.md) -- [StripeLog](log_family/stripelog.md) -- [Log](log_family/log.md) - -### Движки для интеграции {#dvizhki-dlia-integratsii} - -Движки для связи с другими системами хранения и обработки данных. - -Движки семейства: - -- [Kafka](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) - -### Специальные движки {#spetsialnye-dvizhki} - -Движки семейства: - -- [Distributed](special/distributed.md) -- [MaterializedView](special/materializedview.md) -- [Dictionary](special/dictionary.md) -- [Merge](special/merge.md) -- [File](special/file.md) -- [Null](special/null.md) -- [Set](special/set.md) -- [Join](special/join.md) -- [URL](special/url.md) -- [View](special/view.md) -- [Memory](special/memory.md) -- [Buffer](special/buffer.md) - -## Виртуальные столбцы {#table_engines-virtual-columns} - -Виртуальный столбец — это неотъемлемый атрибут движка таблиц, определенный в исходном коде движка. - -Виртуальные столбцы не надо указывать в запросе `CREATE TABLE` и их не отображаются в результатах запросов `SHOW CREATE TABLE` и `DESCRIBE TABLE`. Также виртуальные столбцы доступны только для чтения, поэтому вы не можете вставлять в них данные. - -Чтобы получить данные из виртуального столбца, необходимо указать его название в запросе `SELECT`. `SELECT *` не отображает данные из виртуальных столбцов. - -При создании таблицы со столбцом, имя которого совпадает с именем одного из виртуальных столбцов таблицы, виртуальный столбец становится недоступным. Не делайте так. Чтобы помочь избежать конфликтов, имена виртуальных столбцов обычно предваряются подчеркиванием. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/) diff --git a/docs/ru/engines/table_engines/integrations/hdfs.md b/docs/ru/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index 26b97a99f77..00000000000 --- a/docs/ru/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,112 +0,0 @@ -# HDFS {#table_engines-hdfs} - -Управляет данными в HDFS. Данный движок похож на движки [File](../special/file.md) и [URL](../special/url.md). - -## Использование движка {#ispolzovanie-dvizhka} - -``` sql -ENGINE = HDFS(URI, format) -``` - -В параметр `URI` нужно передавать полный URI файла в HDFS. -Параметр `format` должен быть таким, который ClickHouse может использовать и в запросах `INSERT`, и в запросах `SELECT`. Полный список поддерживаемых форматов смотрите в разделе [Форматы](../../../interfaces/formats.md#formats). -Часть URI с путем файла может содержать шаблоны. В этом случае таблица может использоваться только для чтения. - -**Пример:** - -**1.** Создадим на сервере таблицу `hdfs_engine_table`: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** Заполним файл: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** Запросим данные: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Детали реализации {#detali-realizatsii} - -- Поддерживается многопоточное чтение и запись. -- Не поддерживается: - - использование операций `ALTER` и `SELECT...SAMPLE`; - - индексы; - - репликация. - -**Шаблоны в пути** - -Шаблоны могут содержаться в нескольких компонентах пути. Обрабатываются только существующие файлы, название которых целиком удовлетворяет шаблону (не только суффиксом или префиксом). - -- `*` — Заменяет любое количество любых символов кроме `/`, включая отсутствие символов. -- `?` — Заменяет ровно один любой символ. -- `{some_string,another_string,yet_another_one}` — Заменяет любую из строк `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Заменяет любое число в интервале от `N` до `M` включительно (может содержать ведущие нули). - -Конструкция с `{}` аналогична табличной функции [remote](../../../engines/table_engines/integrations/hdfs.md). - -**Пример** - -1. Предположим, у нас есть несколько файлов со следующими URI в HDFS: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Есть несколько возможностей создать таблицу, состояющую из этих шести файлов: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -Другой способ: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -Таблица, состоящая из всех файлов в обеих директориях (все файлы должны удовлетворять формату и схеме, указанной в запросе): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "Warning" - Если список файлов содержит числовые интервалы с ведущими нулями, используйте конструкцию с фигурными скобочками для каждой цифры или используйте `?`. - -**Example** - -Создадим таблицу с именами `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') -``` - -## Виртуальные столбцы {#virtualnye-stolbtsy} - -- `_path` — Путь к файлу. -- `_file` — Имя файла. - -**Смотрите также** - -- [Виртуальные столбцы](index.md#table_engines-virtual_columns) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/hdfs/) diff --git a/docs/ru/engines/table_engines/integrations/index.md b/docs/ru/engines/table_engines/integrations/index.md deleted file mode 100644 index 716d00cdd98..00000000000 --- a/docs/ru/engines/table_engines/integrations/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Integrations -toc_priority: 30 ---- - diff --git a/docs/ru/engines/table_engines/integrations/jdbc.md b/docs/ru/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index ae461a539be..00000000000 --- a/docs/ru/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,87 +0,0 @@ -# JDBC {#jdbc} - -Позволяет ClickHouse подключаться к внешним базам данных с помощью [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -Для реализации соединения по JDBC ClickHouse использует отдельную программу [clickhouse-jdbc-bridge](https://github.com/alex-krash/clickhouse-jdbc-bridge), которая должна запускаться как демон. - -Движок поддерживает тип данных [Nullable](../../../engines/table_engines/integrations/jdbc.md). - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**Параметры движка** - -- `dbms_uri` — URI внешней СУБД. - - Формат: `jdbc:://:/?user=&password=`. - - Пример для MySQL: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — база данных во внешней СУБД. - -- `external_table` — таблица в `external_database`. - -## Пример использования {#primer-ispolzovaniia} - -Создадим таблицу в на сервере MySQL с помощью консольного клиента MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+--------+--------------+-------+----------------+ -| int_id | int_nullable | float | float_nullable | -+--------+--------------+-------+----------------+ -| 1 | NULL | 2 | NULL | -+--------+--------------+-------+----------------+ -1 row in set (0,00 sec) -``` - -Создадим таблицу на сервере ClickHouse и получим из неё данные: - -``` sql -CREATE TABLE jdbc_table ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -DESCRIBE TABLE jdbc_table -``` - -``` text -┌─name───────────────┬─type───────────────┬─default_type─┬─default_expression─┐ -│ int_id │ Int32 │ │ │ -│ int_nullable │ Nullable(Int32) │ │ │ -│ float │ Float32 │ │ │ -│ float_nullable │ Nullable(Float32) │ │ │ -└────────────────────┴────────────────────┴──────────────┴────────────────────┘ -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Смотрите также {#smotrite-takzhe} - -- [Табличная функция JDBC](../../../engines/table_engines/integrations/jdbc.md). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/jdbc/) diff --git a/docs/ru/engines/table_engines/integrations/mysql.md b/docs/ru/engines/table_engines/integrations/mysql.md deleted file mode 100644 index 7260b182c6d..00000000000 --- a/docs/ru/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,98 +0,0 @@ -# MySQL {#mysql} - -Движок MySQL позволяет выполнять запросы `SELECT` над данными, хранящимися на удалённом MySQL сервере. - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... -) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table_engines/integrations/mysql.md#create-table-query). - -Структура таблицы может отличаться от исходной структуры таблицы MySQL: - -- Имена столбцов должны быть такими же, как в исходной таблице MySQL, но вы можете использовать только некоторые из этих столбцов и в любом порядке. -- Типы столбцов могут отличаться от типов в исходной таблице MySQL. ClickHouse пытается [приводить](../../../engines/table_engines/integrations/mysql.md#type_conversion_function-cast) значения к типам данных ClickHouse. - -**Параметры движка** - -- `host:port` — адрес сервера MySQL. - -- `database` — имя базы данных на удалённом сервере. - -- `table` — имя таблицы на удалённом сервере. - -- `user` — пользователь MySQL. - -- `password` — пароль пользователя. - -- `replace_query` — флаг, отвечающий за преобразование запросов `INSERT INTO` в `REPLACE INTO`. Если `replace_query=1`, то запрос заменяется. - -- `on_duplicate_clause` — выражение `ON DUPLICATE KEY on_duplicate_clause`, добавляемое к запросу `INSERT`. - - Пример: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, где `on_duplicate_clause` это `UPDATE c2 = c2 + 1`. Чтобы узнать какие `on_duplicate_clause` можно использовать с секцией `ON DUPLICATE KEY` обратитесь к [документации MySQL](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html). - - Чтобы указать `on_duplicate_clause` необходимо передать `0` в параметр `replace_query`. Если одновременно передать `replace_query = 1` и `on_duplicate_clause`, то ClickHouse сгенерирует исключение. - -Простые условия `WHERE` такие как `=, !=, >, >=, <, =` выполняются на стороне сервера MySQL. - -Остальные условия и ограничение выборки `LIMIT` будут выполнены в ClickHouse только после выполнения запроса к MySQL. - -## Пример использования {#primer-ispolzovaniia} - -Таблица в MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+--------+--------------+-------+----------------+ -| int_id | int_nullable | float | float_nullable | -+--------+--------------+-------+----------------+ -| 1 | NULL | 2 | NULL | -+--------+--------------+-------+----------------+ -1 row in set (0,00 sec) -``` - -Таблица в ClickHouse, которая получает данные из созданной ранее таблицы MySQL: - -``` sql -CREATE TABLE mysql_table -( - `float_nullable` Nullable(Float32), - `int_id` Int32 -) -ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` sql -SELECT * FROM mysql_table -``` - -``` text -┌─float_nullable─┬─int_id─┐ -│ ᴺᵁᴸᴸ │ 1 │ -└────────────────┴────────┘ -``` - -## Смотрите также {#smotrite-takzhe} - -- [Табличная функция ‘mysql’](../../../engines/table_engines/integrations/mysql.md) -- [Использование MySQL в качестве источника для внешнего словаря](../../../engines/table_engines/integrations/mysql.md#dicts-external_dicts_dict_sources-mysql) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/mysql/) diff --git a/docs/ru/engines/table_engines/integrations/odbc.md b/docs/ru/engines/table_engines/integrations/odbc.md deleted file mode 100644 index 6124a928315..00000000000 --- a/docs/ru/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,125 +0,0 @@ -# ODBC {#table-engine-odbc} - -Позволяет ClickHouse подключаться к внешним базам данных с помощью [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -Чтобы использование ODBC было безопасным, ClickHouse использует отдельную программу `clickhouse-odbc-bridge`. Если драйвер ODBC подгружать непосредственно из `clickhouse-server`, то проблемы с драйвером могут привести к аварийной остановке сервера ClickHouse. ClickHouse автоматически запускает `clickhouse-odbc-bridge` по мере необходимости. Программа устанавливается из того же пакета, что и `clickhouse-server`. - -Движок поддерживает тип данных [Nullable](../../../engines/table_engines/integrations/odbc.md). - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table_engines/integrations/odbc.md#create-table-query). - -Структура таблицы может отличаться от структуры исходной таблицы в удалённой СУБД: - -- Имена столбцов должны быть такими же, как в исходной таблице, но вы можете использовать только некоторые из этих столбцов и в любом порядке. -- Типы столбцов могут отличаться от типов аналогичных столбцов в исходной таблице. ClickHouse пытается [приводить](../../../engines/table_engines/integrations/odbc.md#type_conversion_function-cast) значения к типам данных ClickHouse. - -**Параметры движка** - -- `connection_settings` — название секции с настройками соединения в файле `odbc.ini`. -- `external_database` — имя базы данных во внешней СУБД. -- `external_table` — имя таблицы в `external_database`. - -## Пример использования {#primer-ispolzovaniia} - -**Извлечение данных из локальной установки MySQL через ODBC** - -Этот пример проверялся в Ubuntu Linux 18.04 для MySQL server 5.7. - -Убедитесь, что unixODBC и MySQL Connector установлены. - -По умолчанию (если установлен из пакетов) ClickHouse запускается от имени пользователя `clickhouse`. Таким образом, вам нужно создать и настроить этого пользователя на сервере MySQL. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Теперь настроим соединение в `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Вы можете проверить соединение с помощью утилиты `isql` из установки unixODBC. - -``` bash -$ isql -v mysqlconn -+---------------------------------------+ -| Connected! | -| | -... -``` - -Таблица в MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+--------+--------------+-------+----------------+ -| int_id | int_nullable | float | float_nullable | -+--------+--------------+-------+----------------+ -| 1 | NULL | 2 | NULL | -+--------+--------------+-------+----------------+ -1 row in set (0,00 sec) -``` - -Таблица в ClickHouse, которая получает данные из таблицы MySQL: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## Смотрите также {#smotrite-takzhe} - -- [Внешние словари ODBC](../../../engines/table_engines/integrations/odbc.md#dicts-external_dicts_dict_sources-odbc) -- [Табличная функция odbc](../../../engines/table_engines/integrations/odbc.md) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/odbc/) diff --git a/docs/ru/engines/table_engines/log_family/index.md b/docs/ru/engines/table_engines/log_family/index.md deleted file mode 100644 index a64371200a6..00000000000 --- a/docs/ru/engines/table_engines/log_family/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Log Family -toc_priority: 29 ---- - diff --git a/docs/ru/engines/table_engines/log_family/log.md b/docs/ru/engines/table_engines/log_family/log.md deleted file mode 100644 index 9f112f3f6b9..00000000000 --- a/docs/ru/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,9 +0,0 @@ -# Log {#log} - -Движок относится к семейству движков Log. Смотрите общие свойства и различия движков в статье [Семейство Log](log_family.md). - -Отличается от [TinyLog](tinylog.md) тем, что вместе с файлами столбцов лежит небольшой файл «засечек». Засечки пишутся на каждый блок данных и содержат смещение - с какого места нужно читать файл, чтобы пропустить заданное количество строк. Это позволяет читать данные из таблицы в несколько потоков. -При конкурентном доступе к данным, чтения могут выполняться одновременно, а записи блокируют чтения и друг друга. -Движок Log не поддерживает индексы. Также, если при записи в таблицу произошёл сбой, то таблица станет битой, и чтения из неё будут возвращать ошибку. Движок Log подходит для временных данных, write-once таблиц, а также для тестовых и демонстрационных целей. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/log/) diff --git a/docs/ru/engines/table_engines/log_family/log_family.md b/docs/ru/engines/table_engines/log_family/log_family.md deleted file mode 100644 index f132c2e8d33..00000000000 --- a/docs/ru/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,39 +0,0 @@ -# Семейство Log {#semeistvo-log} - -Движки разработаны для сценариев, когда необходимо быстро записывать много таблиц с небольшим объёмом данных (менее 1 миллиона строк), а затем читать их целиком. - -Движки семейства: - -- [StripeLog](stripelog.md) -- [Log](log.md) -- [TinyLog](tinylog.md) - -## Общие свойства {#obshchie-svoistva} - -Движки: - -- Хранят данные на диске. - -- Добавляют данные в конец файла при записи. - -- Поддерживают блокировки для конкурентного доступа к данным. - - Во время запросов `INSERT` таблица блокируется, а другие запросы на чтение и запись ожидают разблокировки таблицы. Если запросов на запись данных нет, то можно выполнять любое количество конкуретных запросов на чтение. - -- Не поддерживают операции [мутации](../../../engines/table_engines/log_family/log_family.md#alter-mutations). - -- Не поддерживают индексы. - - Это означает, что запросы `SELECT` не эффективны для выборки диапазонов данных. - -- Записывают данные не атомарно. - - Вы можете получить таблицу с повреждёнными данными, если что-то прервёт операцию записи (например, аварийное завершение работы сервера). - -## Отличия {#otlichiia} - -Движок `TinyLog` самый простой в семье и обеспечивает самые низкие функциональность и эффективность. Движок `TinyLog` не поддерживает параллельного чтения данных в несколько потоков. Движок читает данные медленнее, чем оба других движка с параллельным чтением, и использует почти столько же дескрипторов, сколько и движок `Log`, поскольку хранит каждый столбец в отдельном файле. Его можно использовать в простых сценариях с низкой нагрузкой. - -Движки `Log` и `StripeLog` поддерживают параллельное чтение. При чтении данных, ClickHouse использует множество потоков. Каждый поток обрабатывает отдельный блок данных. Движок `Log` сохраняет каждый столбец таблицы в отдельном файле. Движок `StripeLog` хранит все данные в одном файле. Таким образом, движок `StripeLog` использует меньше дескрипторов в операционной системе, а движок `Log` обеспечивает более эффективное считывание данных. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/log_family/) diff --git a/docs/ru/engines/table_engines/log_family/stripelog.md b/docs/ru/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index 4eb4d4620de..00000000000 --- a/docs/ru/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,88 +0,0 @@ -# StripeLog {#stripelog} - -Движок относится к семейству движков Log. Смотрите общие свойства и различия движков в статье [Семейство Log](log_family.md). - -Движок разработан для сценариев, когда необходимо записывать много таблиц с небольшим объёмом данных (менее 1 миллиона строк). - -## Создание таблицы {#table_engines-stripelog-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = StripeLog -``` - -Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table_engines/log_family/stripelog.md#create-table-query). - -## Запись данных {#table_engines-stripelog-writing-the-data} - -Движок `StripeLog` хранит все столбцы в одном файле. При каждом запросе `INSERT`, ClickHouse добавляет блок данных в конец файла таблицы, записывая столбцы один за другим. - -Для каждой таблицы ClickHouse записывает файлы: - -- `data.bin` — файл с данными. -- `index.mrk` — файл с метками. Метки содержат смещения для каждого столбца каждого вставленного блока данных. - -Движок `StripeLog` не поддерживает запросы `ALTER UPDATE` и `ALTER DELETE`. - -## Чтение данных {#table_engines-stripelog-reading-the-data} - -Файл с метками позволяет ClickHouse распараллеливать чтение данных. Это означает, что запрос `SELECT` возвращает строки в непредсказуемом порядке. Используйте секцию `ORDER BY` для сортировки строк. - -## Пример использования {#table_engines-stripelog-example-of-use} - -Создание таблицы: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -Вставка данных: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -Мы использовали два запроса `INSERT` для создания двух блоков данных внутри файла `data.bin`. - -ClickHouse использует несколько потоков при выборе данных. Каждый поток считывает отдельный блок данных и возвращает результирующие строки независимо по мере завершения. В результате порядок блоков строк в выходных данных в большинстве случаев не совпадает с порядком тех же блоков во входных данных. Например: - -``` sql -SELECT * FROM stripe_log_table -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -┌───────────timestamp─┬─message_type─┬─message───────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -└─────────────────────┴──────────────┴───────────────────────────┘ -``` - -Сортировка результатов (по умолчанию по возрастанию): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/stripelog/) diff --git a/docs/ru/engines/table_engines/log_family/tinylog.md b/docs/ru/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index d6dafb63504..00000000000 --- a/docs/ru/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,9 +0,0 @@ -# TinyLog {#tinylog} - -Движок относится к семейству движков Log. Смотрите общие свойства и различия движков в статье [Семейство Log](log_family.md). - -Типичный способ использования этой движка — это write-once: сначала данные один раз записываются, а затем читаются столько раз, сколько это необходимо. Например, можно использовать таблицы с движком `TinyLog` для хранения промежуточных данных, которые обрабатываются небольшими блоками. Учтите, что хранить данные в большом количестве мелких таблиц неэффективно. - -Запросы выполняются в один поток. То есть, этот движок предназначен для сравнительно маленьких таблиц (до 1 000 000 строк). Этот движок таблиц имеет смысл использовать в том случае, когда у вас есть много маленьких таблиц, так как он проще, чем движок [Log](log.md) (требуется открывать меньше файлов). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/tinylog/) diff --git a/docs/ru/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/ru/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index 8fdf063f569..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,95 +0,0 @@ -# AggregatingMergeTree {#aggregatingmergetree} - -Движок наследует функциональность [MergeTree](mergetree.md#table_engines-mergetree), изменяя логику слияния кусков данных. Все строки с одинаковым первичным ключом (точнее, с одинаковым [ключом сортировки](mergetree.md)) ClickHouse заменяет на одну (в пределах одного куска данных), которая хранит объединение состояний агрегатных функций. - -Таблицы типа `AggregatingMergeTree` могут использоваться для инкрементальной агрегации данных, в том числе, для агрегирующих материализованных представлений. - -Движок обрабатывает все столбцы типа [AggregateFunction](../../../engines/table_engines/mergetree_family/aggregatingmergetree.md). - -Использование `AggregatingMergeTree` оправдано только в том случае, когда это уменьшает количество строк на порядки. - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Описание параметров запроса смотрите в [описании запроса](../../../engines/table_engines/mergetree_family/aggregatingmergetree.md). - -**Секции запроса** - -При создании таблицы `AggregatingMergeTree` используются те же [секции](mergetree.md), что и при создании таблицы `MergeTree`. - -
- -Устаревший способ создания таблицы - -!!! attention "Attention" - Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -Все параметры имеют то же значение, что в и `MergeTree`. -
- -## SELECT/INSERT данных {#selectinsert-dannykh} - -Для вставки данных используйте `INSERT SELECT` с агрегатными `-State`-функциями. - -При выборке данных из таблицы `AggregatingMergeTree`, используйте `GROUP BY` и те же агрегатные функции, что и при вставке данных, но с суффиксом `-Merge`. - -В запросах `SELECT` значения типа `AggregateFunction` выводятся во всех форматах, которые поддерживает ClickHouse, в виде implementation-specific бинарных данных. Если с помощью `SELECT` выполнить дамп данных, например, в формат `TabSeparated`, то потом этот дамп можно загрузить обратно с помощью запроса `INSERT`. - -## Пример агрегирущего материализованного представления {#primer-agregirushchego-materializovannogo-predstavleniia} - -Создаём материализованное представление типа `AggregatingMergeTree`, следящее за таблицей `test.visits`: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -Вставляем данные в таблицу `test.visits`: - -``` sql -INSERT INTO test.visits ... -``` - -Данные окажутся и в таблице и в представлении `test.basic`, которое выполнит агрегацию. - -Чтобы получить агрегированные данные, выполним запрос вида `SELECT ... GROUP BY ...` из представления `test.basic`: - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/aggregatingmergetree/) diff --git a/docs/ru/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/ru/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index 5179ac06fa5..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,305 +0,0 @@ -# CollapsingMergeTree {#table_engine-collapsingmergetree} - -Движок наследует функциональность от [MergeTree](mergetree.md) и добавляет в алгоритм слияния кусков данных логику сворачивания (удаления) строк. - -`CollapsingMergeTree` асинхронно удаляет (сворачивает) пары строк, если все поля в ключе сортировки (`ORDER BY`) эквивалентны, за исключением специального поля `Sign`, которое может принимать значения `1` и `-1`. Строки без пары сохраняются. Подробнее смотрите в разделе [Сворачивание (удаление) строк](#table_engine-collapsingmergetree-collapsing). - -Движок может значительно уменьшить объём хранения и, как следствие, повысить эффективность запросов `SELECT`. - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Подробности про `CREATE TABLE` смотрите в [описании запроса](../../../engines/table_engines/mergetree_family/collapsingmergetree.md). - -**Параметры CollapsingMergeTree** - -- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. - - Тип данных столбца — `Int8`. - -**Секции запроса** - -При создании таблицы с движком `CollapsingMergeTree` используются те же [секции запроса](mergetree.md#table_engine-mergetree-creating-a-table) что и при создании таблицы с движком `MergeTree`. - -
- -Устаревший способ создания таблицы - -!!! attention "Attention" - Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -Все параметры, кроме `ver` имеют то же значение, что и в `MergeTree`. - -- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. - - Тип данных столбца — `Int8`. - -
- -## Сворачивание (удаление) строк {#table_engine-collapsingmergetree-collapsing} - -### Данные {#dannye} - -Рассмотрим ситуацию, когда необходимо сохранять постоянно изменяющиеся данные для какого-либо объекта. Кажется логичным иметь одну строку для объекта и обновлять её при любом изменении, однако операция обновления является дорогостоящей и медленной для СУБД, поскольку требует перезаписи данных в хранилище. Если необходимо быстро записать данные, обновление не допустимо, но можно записать изменения объекта последовательно как описано ниже. - -Используйте специальный столбец `Sign`. Если `Sign = 1`, то это означает, что строка является состоянием объекта, назовём её строкой состояния. Если `Sign = -1`, то это означает отмену состояния объекта с теми же атрибутами, назовём её строкой отмены состояния. - -Например, мы хотим рассчитать, сколько страниц проверили пользователи на каком-то сайте и как долго они там находились. В какой-то момент времени мы пишем следующую строку с состоянием действий пользователя: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Через некоторое время мы регистрируем изменение активности пользователя и записываем его следующими двумя строками. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Первая строка отменяет предыдущее состояние объекта (пользователя). Она должен повторять все поля из ключа сортировки для отменённого состояния за исключением `Sign`. - -Вторая строка содержит текущее состояние. - -Поскольку нам нужно только последнее состояние активности пользователя, строки - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -можно удалить, сворачивая (удаляя) устаревшее состояние объекта. `CollapsingMergeTree` выполняет это при слиянии кусков данных. - -Зачем нужны две строки для каждого изменения описано в разделе [Алгоритм](#table_engine-collapsingmergetree-collapsing-algorithm). - -**Особенности подхода** - -1. Программа, которая записывает данные, должна помнить состояние объекта, чтобы иметь возможность отменить его. Строка отмены состояния должна содержать копию полей сортировочного ключа предыдущей строки состояния с противоположным значением `Sign`. Это увеличивает начальный размер хранилища, но позволяет быстро записывать данные. -2. Длинные растущие массивы в Столбцах снижают эффективность работы движка за счёт нагрузки на запись. Чем проще данные, тем выше эффективность. -3. Результаты запроса `SELECT` сильно зависят от согласованности истории изменений объекта. Будьте точны при подготовке данных для вставки. Можно получить непредсказуемые результаты для несогласованных данных, например отрицательные значения для неотрицательных метрик, таких как глубина сеанса. - -### Алгоритм {#table_engine-collapsingmergetree-collapsing-algorithm} - -Во время объединения кусков данных, каждая группа последовательных строк с одинаковым сортировочным ключом (`ORDER BY`) уменьшается до не более чем двух строк, одна из которых имеет `Sign = 1` (строка состояния), а другая строка с `Sign = -1` (строка отмены состояния). Другими словами, записи сворачиваются. - -Для каждого результирующего куска данных ClickHouse сохраняет: - - 1. Первую строку отмены состояния и последнюю строку состояния, если количество строк обоих видов совпадает. - - 2. Последнюю строку состояния, если строк состояния на одну больше, чем строк отмены состояния. - - 3. Первую строку отмены состояния, если их на одну больше, чем строк состояния. - - 4. Ни в одну из строк во всех остальных случаях. - - Слияние продолжается, но ClickHouse рассматривает эту ситуацию как логическую ошибку и записывает её в журнал сервера. Эта ошибка может возникать, если одни и те же данные вставлялись несколько раз. - -Как видно, от сворачивания не должны меняться результаты расчётов статистик. -Изменения постепенно сворачиваются так, что остаются лишь последнее состояние почти каждого объекта. - -Столбец `Sign` необходим, поскольку алгоритм слияния не гарантирует, что все строки с одинаковым ключом сортировки будут находиться в одном результирующем куске данных и даже на одном физическом сервере. ClickHouse выполняет запросы `SELECT` несколькими потоками, и он не может предсказать порядок строк в результате. Если необходимо получить полностью свёрнутые данные из таблицы `CollapsingMergeTree`, то необходимо агрегирование. - -Для завершения свертывания добавьте в запрос секцию`GROUP BY` и агрегатные функции, которые учитывают знак. Например, для расчета количества используйте `sum(Sign)` вместо`count()`. Чтобы вычислить сумму чего-либо, используйте `sum(Sign * x)` вместо`sum(х)`, и так далее, а также добавьте `HAVING sum(Sign) > 0` . - -Таким образом можно вычислять агрегации `count`, `sum` и `avg`. Если объект имеет хотя бы одно не свёрнутое состояние, то может быть вычислена агрегация `uniq`. Агрегации `min` и `max` невозможно вычислить, поскольку `CollapsingMergeTree` не сохраняет историю значений свернутых состояний. - -Если необходимо выбирать данные без агрегации (например, проверить наличие строк, последние значения которых удовлетворяют некоторым условиям), можно использовать модификатор `FINAL` для секции `FROM`. Это вариант существенно менее эффективен. - -## Пример использования {#primer-ispolzovaniia} - -Исходные данные: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Создание таблицы: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Insertion of the data: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -Мы используем два запроса `INSERT` для создания двух различных кусков данных. Если вставить данные одним запросом, ClickHouse создаёт один кусок данных и никогда не будет выполнять слияние. - -Получение данных: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Что мы видим и где сворачивание? - -Двумя запросами `INSERT`, мы создали два куска данных. Запрос `SELECT` был выполнен в 2 потока, и мы получили случайный порядок строк. Сворачивание не произошло, так как слияние кусков данных еще не произошло. ClickHouse объединяет куски данных в неизвестный момент времени, который мы не можем предсказать. - -Таким образом, нам нужна агрегация: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -Если нам не нужна агрегация, но мы хотим принудительно выполнить свёртку данных, можно использовать модификатор `FINAL` для секции `FROM`. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Такой способ выбора данных очень неэффективен. Не используйте его для больших таблиц. - -## Пример другого подхода {#primer-drugogo-podkhoda} - -Исходные данные: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ -5 │ -146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Идея состоит в том, что слияния при сворачивании учитывают только ключевые поля, поэтому в отменяющей строке можно указать отрицательные значения, которые нивелируют предыдущую версию записи при суммировании без учета поля Sign. -Для этого подхода необходимо изменить тип данных `PageViews`, `Duration` для хранения отрицательных значений UInt8 -\> Int16. - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews Int16, - Duration Int16, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Тестируем подход: - -``` sql -insert into UAct values(4324182021466249494, 5, 146, 1); -insert into UAct values(4324182021466249494, -5, -146, -1); -insert into UAct values(4324182021466249494, 6, 185, 1); - -select * from UAct final; // старайтесь не использовать final (он подходит только для тестов и маленьких таблиц) -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -``` sql -SELECT - UserID, - sum(PageViews) AS PageViews, - sum(Duration) AS Duration -FROM UAct -GROUP BY UserID -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -``` sql -select count() FROM UAct -``` - -``` text -┌─count()─┐ -│ 3 │ -└─────────┘ -``` - -``` sql -optimize table UAct final; - -select * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/collapsingmergetree/) 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 deleted file mode 100644 index 039ab1ba0cf..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,126 +0,0 @@ -# Произвольный ключ партиционирования {#proizvolnyi-kliuch-partitsionirovaniia} - -Партиционирование данных доступно для таблиц семейства [MergeTree](mergetree.md) (включая [реплицированные таблицы](replication.md)). Таблицы [MaterializedView](../special/materializedview.md), созданные на основе таблиц MergeTree, также поддерживают партиционирование. - -Партиция – это набор записей в таблице, объединенных по какому-либо критерию. Например, партиция может быть по месяцу, по дню или по типу события. Данные для разных партиций хранятся отдельно. Это позволяет оптимизировать работу с данными, так как при обработке запросов будет использоваться только необходимое подмножество из всевозможных данных. Например, при получении данных за определенный месяц, ClickHouse будет считывать данные только за этот месяц. - -Ключ партиционирования задается при [создании таблицы](mergetree.md#table_engine-mergetree-creating-a-table), в секции `PARTITION BY expr`. Ключ может представлять собой произвольное выражение из столбцов таблицы. Например, чтобы задать партиционирования по месяцам, можно использовать выражение `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour -``` - -Ключом партиционирования также может быть кортеж из выражений (аналогично [первичному ключу](mergetree.md#primary-keys-and-indexes-in-queries)). Например: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -В этом примере задано партиционирование по типам событий, произошедших в течение текущей недели. - -Каждая партиция состоит из отдельных фрагментов или так называемых *кусков данных*. Каждый кусок отсортирован по первичному ключу. При вставке данных в таблицу каждая отдельная запись сохраняется в виде отдельного куска. Через некоторое время после вставки (обычно до 10 минут), ClickHouse выполняет в фоновом режиме слияние данных — в результате куски для одной и той же партиции будут объединены в более крупный кусок. - -!!! info "Info" - Не рекомендуется делать слишком гранулированное партиционирование – то есть задавать партиции по столбцу, в котором будет слишком большой разброс значений (речь идет о порядке более тысячи партиций). Это приведет к скоплению большого числа файлов и файловых дескрипторов в системе, что может значительно снизить производительность запросов `SELECT`. - -Чтобы получить набор кусков и партиций таблицы, можно воспользоваться системной таблицей [system.parts](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#system_tables-parts). В качестве примера рассмотрим таблицу `visits`, в которой задано партиционирование по месяцам. Выполним `SELECT` для таблицы `system.parts`: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 1 │ -│ 201902 │ 201902_11_11_0 │ 1 │ -└───────────┴────────────────┴────────┘ -``` - -Столбец `partition` содержит имена всех партиций таблицы. Таблица `visits` из нашего примера содержит две партиции: `201901` и `201902`. Используйте значения из этого столбца в запросах [ALTER … PARTITION](#alter_manipulations-with-partitions). - -Столбец `name` содержит названия кусков партиций. Значения из этого столбца можно использовать в запросах [ALTER ATTACH PART](#alter_attach-partition). - -Столбец `active` отображает состояние куска. `1` означает, что кусок активен; `0` – неактивен. К неактивным можно отнести куски, оставшиеся после слияния данных. Поврежденные куски также отображаются как неактивные. Неактивные куски удаляются приблизительно через 10 минут после того, как было выполнено слияние. - -Рассмотрим детальнее имя первого куска `201901_1_3_1`: - -- `201901` имя партиции; -- `1` – минимальный номер блока данных; -- `3` – максимальный номер блока данных; -- `1` – уровень куска (глубина дерева слияний, которыми этот кусок образован). - -!!! info "Info" - Названия кусков для таблиц старого типа образуются следующим образом: `20190117_20190123_2_2_0` (минимальная дата \_ максимальная дата \_ номер минимального блока \_ номер максимального блока \_ уровень). - -Как видно из примера выше, таблица содержит несколько отдельных кусков для одной и той же партиции (например, куски `201901_1_3_1` и `201901_1_9_2` принадлежат партиции `201901`). Это означает, что эти куски еще не были объединены – в файловой системе они хранятся отдельно. После того как будет выполнено автоматическое слияние данных (выполняется примерно спустя 10 минут после вставки данных), исходные куски будут объединены в один более крупный кусок и помечены как неактивные. - -Вы можете запустить внеочередное слияние данных с помощью запроса [OPTIMIZE](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#misc_operations-optimize). Пример: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 0 │ -│ 201902 │ 201902_4_11_2 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 0 │ -│ 201902 │ 201902_11_11_0 │ 0 │ -└───────────┴────────────────┴────────┘ -``` - -Неактивные куски будут удалены примерно через 10 минут после слияния. - -Другой способ посмотреть набор кусков и партиций – зайти в директорию с данными таблицы: `/var/lib/clickhouse/data///`. Например: - -``` bash -/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ и т. д. – это директории кусков партиции. Каждый кусок содержит данные только для соответствующего месяца (таблица в данном примере содержит партиционирование по месяцам). - -Директория `detached` содержит куски, отсоединенные от таблицы с помощью запроса [DETACH](#alter_detach-partition). Поврежденные куски также попадают в эту директорию – они не удаляются с сервера. - -Сервер не использует куски из директории `detached`. Вы можете в любое время добавлять, удалять, модифицировать данные в директории detached - сервер не будет об этом знать, пока вы не сделаете запрос [ATTACH](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#alter_attach-partition). - -Следует иметь в виду, что при работающем сервере нельзя вручную изменять набор кусков на файловой системе, так как сервер не будет знать об этом. -Для нереплицируемых таблиц, вы можете это делать при остановленном сервере, однако это не рекомендуется. -Для реплицируемых таблиц, набор кусков нельзя менять в любом случае. - -ClickHouse позволяет производить различные манипуляции с кусками: удалять, копировать из одной таблицы в другую или создавать их резервные копии. Подробнее см. в разделе [Манипуляции с партициями и кусками](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#alter_manipulations-with-partitions). - -[Оригинальная статья:](https://clickhouse.tech/docs/ru/operations/table_engines/custom_partitioning_key/) diff --git a/docs/ru/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/ru/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index 305300fc9a5..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,169 +0,0 @@ -# GraphiteMergeTree {#graphitemergetree} - -Движок предназначен для прореживания и агрегирования/усреднения (rollup) данных [Graphite](http://graphite.readthedocs.io/en/latest/index.html). Он может быть интересен разработчикам, которые хотят использовать ClickHouse как хранилище данных для Graphite. - -Если rollup не требуется, то для хранения данных Graphite можно использовать любой движок таблиц ClickHouse, в противном случае используйте `GraphiteMergeTree`. Движок уменьшает объём хранения и повышает эффективность запросов от Graphite. - -Движок наследует свойства от [MergeTree](mergetree.md). - -## Создание таблицы {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Смотрите описание запроса [CREATE TABLE](../../../engines/table_engines/mergetree_family/graphitemergetree.md#create-table-query). - -В таблице должны быть столбцы для следующих данных: - -- Название метрики (сенсора Graphite). Тип данных: `String`. - -- Время измерения метрики. Тип данных `DateTime`. - -- Значение метрики. Тип данных: любой числовой. - -- Версия метрики. Тип данных: любой числовой. - - ClickHouse сохраняет строки с последней версией или последнюю записанную строку, если версии совпадают. Другие строки удаляются при слиянии кусков данных. - -Имена этих столбцов должны быть заданы в конфигурации rollup. - -**Параметры GraphiteMergeTree** - -- `config_section` — имя раздела в конфигурационном файле, в котором находятся правила rollup. - -**Секции запроса** - -При создании таблицы `GraphiteMergeTree` используются те же [секции](mergetree.md#table_engine-mergetree-creating-a-table) запроса, что и при создании таблицы `MergeTree`. - -
- -Устаревший способ создания таблицы - -!!! attention "Attention" - Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -Все параметры, кроме `config_section` имеют то же значение, что в `MergeTree`. - -- `config_section` — имя раздела в конфигурационном файле, в котором находятся правила rollup. - -
- -## Конфигурация rollup {#rollup-configuration} - -Настройки прореживания данных задаются параметром [graphite\_rollup](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) в конфигурации сервера . Имя параметра может быть любым. Можно создать несколько конфигураций и использовать их для разных таблиц. - -Структура конфигурации rollup: - -``` text -required-columns -patterns -``` - -### Требуемые столбцы (required-columns) {#required-columns} - -- `path_column_name` — столбец, в котором хранится название метрики (сенсор Graphite). Значение по умолчанию: `Path`. -- `time_column_name` — столбец, в котором хранится время измерения метрики. Значение по умолчанию: `Time`. -- `value_column_name` — столбец со значением метрики в момент времени, установленный в `time_column_name`. Значение по умолчанию: `Value`. -- `version_column_name` — столбец, в котором хранится версия метрики. Значение по умолчанию: `Timestamp`. - -### Правила (patterns) {#patterns} - -Структура раздела `patterns`: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "Внимание" - Правила должны быть строго упорядочены: - - 1. Правила без `function` или `retention`. - 1. Правила одновремено содержащие `function` и `retention`. - 1. Правило `default`. - -При обработке строки ClickHouse проверяет правила в разделе `pattern`. Каждый `pattern` (включая `default`) может содержать параметр агрегации `function`, параметр `retention`, или оба параметра одновременно. Если имя метрики соответствует шаблону `regexp`, то применяются правила `pattern`, в противном случае правило `default`. - -Поля для разделов `pattern` и `default`: - -- `regexp` – шаблон имени метрики. -- `age` – минимальный возраст данных в секундах. -- `precision` – точность определения возраста данных в секундах. Должен быть делителем для 86400 (количество секунд в сутках). -- `function` – имя агрегирующей функции, которую следует применить к данным, чей возраст оказался в интервале `[age, age + precision]`. - -### Пример конфигурации {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/graphitemergetree/) diff --git a/docs/ru/engines/table_engines/mergetree_family/index.md b/docs/ru/engines/table_engines/mergetree_family/index.md deleted file mode 100644 index 6a23ef23a8e..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: MergeTree Family -toc_priority: 28 ---- - diff --git a/docs/ru/engines/table_engines/mergetree_family/mergetree.md b/docs/ru/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index f67d03ed875..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,637 +0,0 @@ -# MergeTree {#table_engines-mergetree} - -Движок `MergeTree`, а также другие движки этого семейства (`*MergeTree`) — это наиболее функциональные движки таблиц ClickHouse. - -Основная идея, заложенная в основу движков семейства `MergeTree` следующая. Когда у вас есть огромное количество данных, которые должны быть вставлены в таблицу, вы должны быстро записать их по частям, а затем объединить части по некоторым правилам в фоновом режиме. Этот метод намного эффективнее, чем постоянная перезапись данных в хранилище при вставке. - -Основные возможности: - -- Хранит данные, отсортированные по первичному ключу. - - Это позволяет создавать разреженный индекс небольшого объёма, который позволяет быстрее находить данные. - -- Позволяет оперировать партициями, если задан [ключ партиционирования](custom_partitioning_key.md). - - ClickHouse поддерживает отдельные операции с партициями, которые работают эффективнее, чем общие операции с этим же результатом над этими же данными. Также, ClickHouse автоматически отсекает данные по партициям там, где ключ партиционирования указан в запросе. Это также увеличивает эффективность выполнения запросов. - -- Поддерживает репликацию данных. - - Для этого используется семейство таблиц `ReplicatedMergeTree`. Подробнее читайте в разделе [Репликация данных](replication.md). - -- Поддерживает сэмплирование данных. - - При необходимости можно задать способ сэмплирования данных в таблице. - -!!! info "Info" - Движок [Merge](../special/merge.md) не относится к семейству `*MergeTree`. - -## Создание таблицы {#table_engine-mergetree-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 -) ENGINE = MergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] -[SETTINGS name=value, ...] -``` - -Описание параметров смотрите в [описании запроса CREATE](../../../engines/table_engines/mergetree_family/mergetree.md). - -!!! note "Note" - `INDEX` — экспериментальная возможность, смотрите [Индексы пропуска данных](#table_engine-mergetree-data_skipping-indexes). - -### Секции запроса {#mergetree-query-clauses} - -- `ENGINE` — имя и параметры движка. `ENGINE = MergeTree()`. `MergeTree` не имеет параметров. - -- `PARTITION BY` — [ключ партиционирования](custom_partitioning_key.md). - - Для партиционирования по месяцам используйте выражение `toYYYYMM(date_column)`, где `date_column` — столбец с датой типа [Date](../../../engines/table_engines/mergetree_family/mergetree.md). В этом случае имена партиций имеют формат `"YYYYMM"`. - -- `ORDER BY` — ключ сортировки. - - Кортеж столбцов или произвольных выражений. Пример: `ORDER BY (CounterID, EventDate)`. - -- `PRIMARY KEY` — первичный ключ, если он [отличается от ключа сортировки](#pervichnyi-kliuch-otlichnyi-ot-kliucha-sortirovki). - - По умолчанию первичный ключ совпадает с ключом сортировки (который задаётся секцией `ORDER BY`.) Поэтому в большинстве случаев секцию `PRIMARY KEY` отдельно указывать не нужно. - -- `SAMPLE BY` — выражение для сэмплирования. - - Если используется выражение для сэмплирования, то первичный ключ должен содержать его. Пример: - - `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. - -- `TTL` — список правил, определяющих длительности хранения строк, а также задающих правила перемещения частей на определённые тома или диски. - - Выражение должно возвращать столбец `Date` или `DateTime`. Пример: `TTL date + INTERVAL 1 DAY`. - - Тип правила `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` указывает действие, которое будет выполнено с частью, удаление строк (прореживание), перемещение (при выполнении условия для всех строк части) на определённый диск (`TO DISK 'xxx'`) или том (`TO VOLUME 'xxx'`). Поведение по умолчанию соответствует удалению строк (`DELETE`). В списке правил может быть указано только одно выражение с поведением `DELETE`. - - Дополнительные сведения смотрите в разделе [TTL для столбцов и таблиц](#table_engine-mergetree-ttl) - -- `SETTINGS` — дополнительные параметры, регулирующие поведение `MergeTree`: - - - `index_granularity` — максимальное количество строк данных между засечками индекса. По умолчанию — 8192. Смотрите [Хранение данных](#mergetree-data-storage). - - `index_granularity_bytes` — максимальный размер гранул данных в байтах. По умолчанию — 10Mb. Чтобы ограничить размер гранул только количеством строк, установите значение 0 (не рекомендовано). Смотрите [Хранение данных](#mergetree-data-storage). - - `enable_mixed_granularity_parts` — включает или выключает переход к ограничению размера гранул с помощью настройки `index_granularity_bytes`. До версии 19.11, размер гранул ограничивался только настройкой `index_granularity`. Настройка `index_granularity_bytes` улучшает производительность ClickHouse при выборке данных из таблиц с большими (десятки и сотни мегабайтов) строками. Если у вас есть таблицы с большими строками, можно включить эту настройку, чтобы повысить эффективность запросов `SELECT`. - - `use_minimalistic_part_header_in_zookeeper` — Способ хранения заголовков кусков данных в ZooKeeper. Если `use_minimalistic_part_header_in_zookeeper = 1`, то ZooKeeper хранит меньше данных. Подробнее читайте в [описании настройки](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) в разделе "Конфигурационные параметры сервера". - - `min_merge_bytes_to_use_direct_io` — минимальный объём данных при слиянии, необходимый для прямого (небуферизованного) чтения/записи (direct I/O) на диск. При слиянии частей данных ClickHouse вычисляет общий объём хранения всех данных, подлежащих слиянию. Если общий объём хранения всех данных для чтения превышает `min_bytes_to_use_direct_io` байт, тогда ClickHouse использует флаг `O_DIRECT` при чтении данных с диска. Если `min_merge_bytes_to_use_direct_io = 0`, тогда прямой ввод-вывод отключен. Значение по умолчанию: `10 * 1024 * 1024 * 1024` байтов. - - - `merge_with_ttl_timeout` — минимальное время в секундах перед повторным слиянием с TTL. По умолчанию — 86400 (1 день). - - `write_final_mark` — включает или отключает запись последней засечки индекса в конце куска данных, указывающей за последний байт. По умолчанию — 1. Не отключайте её. - - `merge_max_block_size` — Максимальное количество строк в блоке для операций слияния. Значение по умолчанию: 8192. - - `storage_policy` — политика хранения данных. Смотрите [Хранение данных таблицы на нескольких блочных устройствах](#table_engine-mergetree-multiple-volumes). - -**Пример задания секций** - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 -``` - -В примере мы устанавливаем партиционирование по месяцам. - -Также мы задаем выражение для сэмплирования в виде хэша по идентификатору посетителя. Это позволяет псевдослучайным образом перемешать данные в таблице для каждого `CounterID` и `EventDate`. Если при выборке данных задать секцию [SAMPLE](../../../engines/table_engines/mergetree_family/mergetree.md#select-sample-clause), то ClickHouse вернёт равномерно-псевдослучайную выборку данных для подмножества посетителей. - -`index_granularity` можно было не указывать, поскольку 8192 — это значение по умолчанию. - -
- -Устаревший способ создания таблицы - -!!! attention "Attention" - Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ, описанный выше. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -**Параметры MergeTree()** - -- `date-column` — имя столбца с типом [Date](../../../engines/table_engines/mergetree_family/mergetree.md). На основе этого столбца ClickHouse автоматически создаёт партиции по месяцам. Имена партиций имеют формат `"YYYYMM"`. -- `sampling_expression` — выражение для сэмплирования. -- `(primary, key)` — первичный ключ. Тип — [Tuple()](../../../engines/table_engines/mergetree_family/mergetree.md) -- `index_granularity` — гранулярность индекса. Число строк данных между «засечками» индекса. Для большинства задач подходит значение 8192. - -**Пример** - -``` sql -MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) -``` - -Движок `MergeTree` сконфигурирован таким же образом, как и в примере выше для основного способа конфигурирования движка. - -
- -## Хранение данных {#mergetree-data-storage} - -Таблица состоит из *кусков* данных (data parts), отсортированных по первичному ключу. - -При вставке в таблицу создаются отдельные куски данных, каждый из которых лексикографически отсортирован по первичному ключу. Например, если первичный ключ — `(CounterID, Date)`, то данные в куске будут лежать в порядке `CounterID`, а для каждого `CounterID` в порядке `Date`. - -Данные, относящиеся к разным партициям, разбиваются на разные куски. В фоновом режиме ClickHouse выполняет слияния (merge) кусков данных для более эффективного хранения. Куски, относящиеся к разным партициям не объединяются. Механизм слияния не гарантирует, что все строки с одинаковым первичным ключом окажутся в одном куске. - -Каждый кусок данных логически делится на гранулы. Гранула — это минимальный неделимый набор данных, который ClickHouse считывает при выборке данных. ClickHouse не разбивает строки и значения и гранула всегда содержит целое число строк. Первая строка гранулы помечается значением первичного ключа для этой строки (засечка). Для каждого куска данных ClickHouse создаёт файл с засечками (индексный файл). Для каждого столбца, независимо от того, входит он в первичный ключ или нет, ClickHouse также сохраняет эти же засечки. Засечки используются для поиска данных напрямую в файлах столбцов. - -Размер гранул оганичен настройками движка `index_granularity` и `index_granularity_bytes`. Количество строк в грануле лежит в диапазоне `[1, index_granularity]`, в зависимости от размера строк. Размер гранулы может превышать `index_granularity_bytes` в том случае, когда размер единственной строки в грануле превышает значение настройки. В этом случае, размер гранулы равен размеру строки. - -## Первичные ключи и индексы в запросах {#primary-keys-and-indexes-in-queries} - -Рассмотрим первичный ключ — `(CounterID, Date)`. В этом случае сортировку и индекс можно проиллюстрировать следующим образом: - -``` text -Whole data: [-------------------------------------------------------------------------] -CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] -Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] -Marks: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 -Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 -``` - -Если в запросе к данным указать: - -- `CounterID IN ('a', 'h')`, то сервер читает данные в диапазонах засечек `[0, 3)` и `[6, 8)`. -- `CounterID IN ('a', 'h') AND Date = 3`, то сервер читает данные в диапазонах засечек `[1, 3)` и `[7, 8)`. -- `Date = 3`, то сервер читает данные в диапазоне засечек `[1, 10]`. - -Примеры выше показывают, что использование индекса всегда эффективнее, чем full scan. - -Разреженный индекс допускает чтение лишних строк. При чтении одного диапазона первичного ключа, может быть прочитано до `index_granularity * 2` лишних строк в каждом блоке данных. - -Разреженный индекс почти всегда помещаеся в оперативную память и позволяет работать с очень большим количеством строк в таблицах. - -ClickHouse не требует уникального первичного ключа. Можно вставить много строк с одинаковым первичным ключом. - -### Выбор первичного ключа {#vybor-pervichnogo-kliucha} - -Количество столбцов в первичном ключе не ограничено явным образом. В зависимости от структуры данных в первичный ключ можно включать больше или меньше столбцов. Это может: - -- Увеличить эффективность индекса. - - Пусть первичный ключ — `(a, b)`, тогда добавление ещё одного столбца `c` повысит эффективность, если выполнены условия: - - - Есть запросы с условием на столбец `c`. - - Часто встречаются достаточно длинные (в несколько раз больше `index_granularity`) диапазоны данных с одинаковыми значениями `(a, b)`. Иначе говоря, когда добавление ещё одного столбца позволит пропускать достаточно длинные диапазоны данных. - -- Улучшить сжатие данных. - - ClickHouse сортирует данные по первичному ключу, поэтому чем выше однородность, тем лучше сжатие. - -- Обеспечить дополнительную логику при слиянии кусков данных в движках [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) и [SummingMergeTree](summingmergetree.md). - - В этом случае имеет смысл указать отдельный *ключ сортировки*, отличающийся от первичного ключа. - -Длинный первичный ключ будет негативно влиять на производительность вставки и потребление памяти, однако на производительность ClickHouse при запросах `SELECT` лишние столбцы в первичном ключе не влияют. - -### Первичный ключ, отличный от ключа сортировки {#pervichnyi-kliuch-otlichnyi-ot-kliucha-sortirovki} - -Существует возможность задать первичный ключ (выражение, значения которого будут записаны в индексный файл для -каждой засечки), отличный от ключа сортировки (выражение, по которому будут упорядочены строки в кусках -данных). Кортеж выражения первичного ключа при этом должен быть префиксом кортежа выражения ключа -сортировки. - -Данная возможность особенно полезна при использовании движков [SummingMergeTree](summingmergetree.md) -и [AggregatingMergeTree](aggregatingmergetree.md). В типичном сценарии использования этих движков таблица -содержит столбцы двух типов: *измерения* (dimensions) и *меры* (measures). Типичные запросы агрегируют -значения столбцов-мер с произвольной группировкой и фильтрацией по измерениям. Так как `SummingMergeTree` -и `AggregatingMergeTree` производят фоновую агрегацию строк с одинаковым значением ключа сортировки, приходится -добавлять в него все столбцы-измерения. В результате выражение ключа содержит большой список столбцов, -который приходится постоянно расширять при добавлении новых измерений. - -В этом сценарии имеет смысл оставить в первичном ключе всего несколько столбцов, которые обеспечат эффективную фильтрацию по индексу, а остальные столбцы-измерения добавить в выражение ключа сортировки. - -[ALTER ключа сортировки](../../../engines/table_engines/mergetree_family/mergetree.md) — лёгкая операция, так как при одновременном добавлении нового столбца в таблицу и ключ сортировки не нужно изменять данные кусков (они остаются упорядоченными и по новому выражению ключа). - -### Использование индексов и партиций в запросах {#ispolzovanie-indeksov-i-partitsii-v-zaprosakh} - -Для запросов `SELECT` ClickHouse анализирует возможность использования индекса. Индекс может использоваться, если в секции `WHERE/PREWHERE`, в качестве одного из элементов конъюнкции, или целиком, есть выражение, представляющее операции сравнения на равенства, неравенства, а также `IN` или `LIKE` с фиксированным префиксом, над столбцами или выражениями, входящими в первичный ключ или ключ партиционирования, либо над некоторыми частично монотонными функциями от этих столбцов, а также логические связки над такими выражениями. - -Таким образом, обеспечивается возможность быстро выполнять запросы по одному или многим диапазонам первичного ключа. Например, в указанном примере будут быстро работать запросы для конкретного счётчика; для конкретного счётчика и диапазона дат; для конкретного счётчика и даты, для нескольких счётчиков и диапазона дат и т. п. - -Рассмотрим движок сконфигурированный следующим образом: - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 -``` - -В этом случае в запросах: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -ClickHouse будет использовать индекс по первичному ключу для отсечения не подходящих данных, а также ключ партиционирования по месяцам для отсечения партиций, которые находятся в не подходящих диапазонах дат. - -Запросы выше показывают, что индекс используется даже для сложных выражений. Чтение из таблицы организовано так, что использование индекса не может быть медленнее, чем full scan. - -В примере ниже индекс не может использоваться. - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -Чтобы проверить, сможет ли ClickHouse использовать индекс при выполнении запроса, используйте настройки [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) и [force\_primary\_key](../../../operations/settings/settings.md#settings-force_primary_key). - -Ключ партиционирования по месяцам обеспечивает чтение только тех блоков данных, которые содержат даты из нужного диапазона. При этом блок данных может содержать данные за многие даты (до целого месяца). В пределах одного блока данные упорядочены по первичному ключу, который может не содержать дату в качестве первого столбца. В связи с этим, при использовании запроса с указанием условия только на дату, но не на префикс первичного ключа, будет читаться данных больше, чем за одну дату. - -### Использование индекса для частично-монотонных первичных ключей {#ispolzovanie-indeksa-dlia-chastichno-monotonnykh-pervichnykh-kliuchei} - -Рассмотрим, например, дни месяца. Они образуют последовательность [монотонную](https://ru.wikipedia.org/wiki/Монотонная_последовательность) в течение одного месяца, но не монотонную на более длительных периодах. Это частично-монотонная последовательность. Если пользователь создаёт таблицу с частично-монотонным первичным ключом, ClickHouse как обычно создаёт разреженный индекс. Когда пользователь выбирает данные из такого рода таблиц, ClickHouse анализирует условия запроса. Если пользователь хочет получить данные между двумя метками индекса, и обе эти метки находятся внутри одного месяца, ClickHouse может использовать индекс в данном конкретном случае, поскольку он может рассчитать расстояние между параметрами запроса и индексными метками. - -ClickHouse не может использовать индекс, если значения первичного ключа в диапазоне параметров запроса не представляют собой монотонную последовательность. В этом случае ClickHouse использует метод полного сканирования. - -ClickHouse использует эту логику не только для последовательностей дней месяца, но и для любого частично-монотонного первичного ключа. - -### Индексы пропуска данных (экспериментальная функциональность) {#table_engine-mergetree-data_skipping-indexes} - -Объявление индексов при определении столбцов в запросе `CREATE`. - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -Для таблиц семейства `*MergeTree` можно задать дополнительные индексы в секции столбцов. - -Индексы агрегируют для заданного выражения некоторые данные, а потом при `SELECT` запросе используют для пропуска блоков данных (пропускаемый блок состоит из гранул данных в количестве равном гранулярности данного индекса), на которых секция `WHERE` не может быть выполнена, тем самым уменьшая объём данных читаемых с диска. - -**Пример** - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -Эти индексы смогут использоваться для оптимизации следующих запросов - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### Доступные индексы {#dostupnye-indeksy} - -- `minmax` — Хранит минимум и максимум выражения (если выражение - `tuple`, то для каждого элемента `tuple`), используя их для пропуска блоков аналогично первичному ключу. - -- `set(max_rows)` — Хранит уникальные значения выражения на блоке в количестве не более `max_rows` (если `max_rows = 0`, то ограничений нет), используя их для пропуска блоков, оценивая выполнимость `WHERE` выражения на хранимых данных. - -- `bloom_filter([false_positive])` — [фильтр Блума](https://en.wikipedia.org/wiki/Bloom_filter) для указанных стоблцов. - - Необязательный параметр `false_positive` — это вероятность получения ложноположительного срабатывания. Возможные значения: (0, 1). Значение по умолчанию: 0.025. - - Поддержанные типы данных: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`. - - Фильтром могут пользоваться функции: [equals](../../../engines/table_engines/mergetree_family/mergetree.md), [notEquals](../../../engines/table_engines/mergetree_family/mergetree.md), [in](../../../engines/table_engines/mergetree_family/mergetree.md), [notIn](../../../engines/table_engines/mergetree_family/mergetree.md). - -**Примеры** - -``` sql -INDEX b (u64 * length(str), i32 + f64 * 100, date, str) TYPE minmax GRANULARITY 4 -INDEX b (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -``` - -#### Поддержка для функций {#podderzhka-dlia-funktsii} - -Условия в секции `WHERE` содержат вызовы функций, оперирующих со столбцами. Если столбец - часть индекса, ClickHouse пытается использовать индекс при выполнении функции. Для разных видов индексов, ClickHouse поддерживает различные наборы функций, которые могут использоваться индексами. - -Индекс `set` используется со всеми функциями. Наборы функций для остальных индексов представлены в таблице ниже. - -| Function (operator) / Index | primary key | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | -|----------------------------------------------------------------------------------------------------------|-------------|--------|-------------|-------------|---------------| -| [equals (=, ==)](../../../engines/table_engines/mergetree_family/mergetree.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notEquals(!=, \<\>)](../../../engines/table_engines/mergetree_family/mergetree.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [like](../../../engines/table_engines/mergetree_family/mergetree.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [notLike](../../../engines/table_engines/mergetree_family/mergetree.md#function-notlike) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [startsWith](../../../engines/table_engines/mergetree_family/mergetree.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [endsWith](../../../engines/table_engines/mergetree_family/mergetree.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [multiSearchAny](../../../engines/table_engines/mergetree_family/mergetree.md#function-multisearchany) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [in](../../../engines/table_engines/mergetree_family/mergetree.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notIn](../../../engines/table_engines/mergetree_family/mergetree.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [less (\<)](../../../engines/table_engines/mergetree_family/mergetree.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [greater (\>)](../../../engines/table_engines/mergetree_family/mergetree.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [lessOrEquals (\<=)](../../../engines/table_engines/mergetree_family/mergetree.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [greaterOrEquals (\>=)](../../../engines/table_engines/mergetree_family/mergetree.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [empty](../../../engines/table_engines/mergetree_family/mergetree.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [notEmpty](../../../engines/table_engines/mergetree_family/mergetree.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | - -Функции с постоянным агрументом, который меньше, чем размер ngram не могут использовать индекс `ngrambf_v1` для оптимизации запроса. - -Фильтры Блума могут иметь ложнопозитивные срабатывания, следовательно индексы `ngrambf_v1`, `tokenbf_v1` и `bloom_filter` невозможно использовать для оптимизации запросов, в которых результат функции предполается false, например: - -- Можно оптимизировать: - - `s LIKE '%test%'` - - `NOT s NOT LIKE '%test%'` - - `s = 1` - - `NOT s != 1` - - `startsWith(s, 'test')` -- Нельзя оптимизировать: - - `NOT s LIKE '%test%'` - - `s NOT LIKE '%test%'` - - `NOT s = 1` - - `s != 1` - - `NOT startsWith(s, 'test')` - -## Конкурентный доступ к данным {#konkurentnyi-dostup-k-dannym} - -Для конкурентного доступа к таблице используется мультиверсионность. То есть, при одновременном чтении и обновлении таблицы, данные будут читаться из набора кусочков, актуального на момент запроса. Длинных блокировок нет. Вставки никак не мешают чтениям. - -Чтения из таблицы автоматически распараллеливаются. - -## TTL для столбцов и таблиц {#table_engine-mergetree-ttl} - -Определяет время жизни значений, а также правила перемещения данных на другой диск или том. - -Секция `TTL` может быть установлена как для всей таблицы, так и для каждого отдельного столбца. Правила `TTL` для таблицы позволяют указать целевые диски или тома для фонового перемещения на них частей данных. - -Выражения должны возвращать тип [Date](../../../engines/table_engines/mergetree_family/mergetree.md) или [DateTime](../../../engines/table_engines/mergetree_family/mergetree.md). - -Для задания времени жизни столбца, например: - -``` sql -TTL time_column -TTL time_column + interval -``` - -Чтобы задать `interval`, используйте операторы [интервала времени](../../../engines/table_engines/mergetree_family/mergetree.md#operators-datetime). - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### TTL столбца {#mergetree-column-ttl} - -Когда срок действия значений в столбце истечет, ClickHouse заменит их значениями по умолчанию для типа данных столбца. Если срок действия всех значений столбцов в части данных истек, ClickHouse удаляет столбец из куска данных в файловой системе. - -Секцию `TTL` нельзя использовать для ключевых столбцов. - -Примеры: - -Создание таблицы с TTL - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -Добавление TTL на колонку существующей таблицы - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -Изменение TTL у колонки - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### TTL таблицы {#mergetree-table-ttl} - -Для таблицы можно задать одно выражение для устаревания данных, а также несколько выражений, по срабатывании которых данные переместятся на [некоторый диск или том](#table_engine-mergetree-multiple-volumes). Когда некоторые данные в таблице устаревают, ClickHouse удаляет все соответствующие строки. - -``` sql -TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... -``` - -За каждым TTL выражением может следовать тип действия, которое выполняется после достижения времени, соответствующего результату TTL выражения: - -- `DELETE` - удалить данные (действие по умолчанию); -- `TO DISK 'aaa'` - переместить данные на диск `aaa`; -- `TO VOLUME 'bbb'` - переместить данные на том `bbb`. - -Примеры: - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH [DELETE], - d + INTERVAL 1 WEEK TO VOLUME 'aaa', - d + INTERVAL 2 WEEK TO DISK 'bbb'; -``` - -Изменение TTL - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**Удаление данных** - -Данные с истекшим TTL удаляются, когда ClickHouse мёржит куски данных. - -Когда ClickHouse видит, что некоторые данные устарели, он выполняет внеплановые мёржи. Для управление частотой подобных мёржей, можно задать настройку [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). Если её значение слишком низкое, придется выполнять много внеплановых мёржей, которые могут начать потреблять значительную долю ресурсов сервера. - -Если вы выполните запрос `SELECT` между слияниями вы можете получить устаревшие данные. Чтобы избежать этого используйте запрос [OPTIMIZE](../../../engines/table_engines/mergetree_family/mergetree.md#misc_operations-optimize) перед `SELECT`. - -## Хранение данных таблицы на нескольких блочных устройствах {#table_engine-mergetree-multiple-volumes} - -### Введение {#vvedenie} - -Движки таблиц семейства `MergeTree` могут хранить данные на нескольких блочных устройствах. Это может оказаться полезным, например, при неявном разделении данных одной таблицы на «горячие» и «холодные». Наиболее свежая часть занимает малый объём и запрашивается регулярно, а большой хвост исторических данных запрашивается редко. При наличии в системе нескольких дисков, «горячая» часть данных может быть размещена на быстрых дисках (например, на NVMe SSD или в памяти), а холодная на более медленных (например, HDD). - -Минимальной перемещаемой единицей для `MergeTree` является кусок данных (data part). Данные одного куска могут находится только на одном диске. Куски могут перемещаться между дисками в фоне, согласно пользовательским настройкам, а также с помощью запросов [ALTER](../../../engines/table_engines/mergetree_family/mergetree.md#alter_move-partition). - -### Термины {#terminy} - -- Диск — примонтированное в файловой системе блочное устройство. -- Диск по умолчанию — диск, на котором находится путь, указанный в конфигурационной настройке сервера [path](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path). -- Том (Volume) — упорядоченный набор равноценных дисков (схоже с [JBOD](https://ru.wikipedia.org/wiki/JBOD)) -- Политика хранения (StoragePolicy) — множество томов с правилами перемещения данных между ними. - -У всех описанных сущностей при создании указываются имена, можно найти в системных таблицах [system.storage\_policies](../../../engines/table_engines/mergetree_family/mergetree.md#system_tables-storage_policies) и [system.disks](../../../engines/table_engines/mergetree_family/mergetree.md#system_tables-disks). Имя политики хранения можно указать в настройке `storage_policy` движков таблиц семейства `MergeTree`. - -### Конфигурация {#table_engine-mergetree-multiple-volumes-configure} - -Диски, тома и политики хранения задаются внутри тега `` в основном файле `config.xml` или в отдельном файле в директории `config.d`. - -Структура конфигурации: - -``` xml - - - - /mnt/fast_ssd/clickhouse/ - - - /mnt/hdd1/clickhouse/ - 10485760 - - - /mnt/hdd2/clickhouse/ - 10485760 - - - ... - - - ... - -``` - -Теги: - -- `` — имя диска. Имена должны быть разными для всех дисков. -- `path` — путь по которому будут храниться данные сервера (каталоги `data` и `shadow`), должен быть терминирован `/`. -- `keep_free_space_bytes` — размер зарезервированного свободного места на диске. - -Порядок задания дисков не имеет значения. - -Общий вид конфигурации политик хранения: - -``` xml - - ... - - - - - disk_name_from_disks_configuration - 1073741824 - - - - - - - 0.2 - - - - - - - - ... - -``` - -Тэги: - -- `policy_name_N` — название политики. Названия политик должны быть уникальны. -- `volume_name_N` — название тома. Названия томов должны быть уникальны. -- `disk` — диск, находящийся внутри тома. -- `max_data_part_size_bytes` — максимальный размер куска данных, который может находится на любом из дисков этого тома. -- `move_factor` — доля свободного места, при превышении которого данные начинают перемещаться на следующий том, если он есть (по умолчанию 0.1). - -Примеры конфигураций: - -``` xml - - ... - - - - - disk1 - disk2 - - - - - - - - fast_ssd - 1073741824 - - - disk1 - - - 0.2 - - - ... - -``` - -В приведенном примере, политика `hdd_in_order` реализует прицип [round-robin](https://ru.wikipedia.org/wiki/Round-robin_(%D0%B0%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC)). Так как в политике есть всего один том (`single`), то все записи производятся на его диски по круговому циклу. Такая политика может быть полезна при наличии в системе нескольких похожих дисков, но при этом не сконфигурирован RAID. Учтите, что каждый отдельный диск ненадёжен и чтобы не потерять важные данные это необходимо скомпенсировать за счет хранения данных в трёх копиях. - -Если система содержит диски различных типов, то может пригодиться политика `moving_from_ssd_to_hdd`. В томе `hot` находится один SSD-диск (`fast_ssd`), а также задается ограничение на максимальный размер куска, который может храниться на этом томе (1GB). Все куски такой таблицы больше 1GB будут записываться сразу на том `cold`, в котором содержится один HDD-диск `disk1`. Также, при заполнении диска `fast_ssd` более чем на 80% данные будут переносится на диск `disk1` фоновым процессом. - -Порядок томов в политиках хранения важен, при достижении условий на переполнение тома данные переносятся на следующий. Порядок дисков в томах так же важен, данные пишутся по очереди на каждый из них. - -После задания конфигурации политик хранения их можно использовать, как настройку при создании таблиц: - -``` sql -CREATE TABLE table_with_non_default_policy ( - EventDate Date, - OrderID UInt64, - BannerID UInt64, - SearchPhrase String -) ENGINE = MergeTree -ORDER BY (OrderID, BannerID) -PARTITION BY toYYYYMM(EventDate) -SETTINGS storage_policy = 'moving_from_ssd_to_hdd' -``` - -По умолчанию используется политика хранения `default` в которой есть один том и один диск, указанный в ``. В данный момент менять политику хранения после создания таблицы нельзя. - -### Особенности работы {#osobennosti-raboty} - -В таблицах `MergeTree` данные попадают на диск несколькими способами: - -- В результате вставки (запрос `INSERT`). -- В фоновых операциях слияний и [мутаций](../../../engines/table_engines/mergetree_family/mergetree.md#alter-mutations). -- При скачивании данных с другой реплики. -- В результате заморозки партиций [ALTER TABLE … FREEZE PARTITION](../../../engines/table_engines/mergetree_family/mergetree.md#alter_freeze-partition). - -Во всех случаях, кроме мутаций и заморозки партиций, при записи куска выбирается том и диск в соответствии с указанной конфигурацией хранилища: - -1. Выбирается первый по порядку том, на котором есть свободное место для записи куска (`unreserved_space > current_part_size`) и который позволяет записывать куски требуемого размера `max_data_part_size_bytes > current_part_size`. -2. Внутри тома выбирается следующий диск после того, на который была предыдущая запись и на котором свободного места больше чем размер куска (`unreserved_space - keep_free_space_bytes > current_part_size`) - -Мутации и запросы заморозки партиций в реализации используют [жесткие ссылки](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) пользователь может принудительно перенести кусок или партицию с одного раздела на другой. При этом учитываются все ограничения, указанные для фоновых операций. Запрос самостоятельно инициирует процесс перемещения не дожидаясь фоновых операций. В случае недостатка места или неудовлетворения ограничениям пользователь получит сообщение об ошибке. - -Перемещения данных не взаимодействуют с репликацией данных, поэтому на разных репликах одной и той же таблицы могут быть указаны разные политики хранения. - -После выполнения фоновых слияний или мутаций старые куски не удаляются сразу, а через некоторое время (табличная настройка `old_parts_lifetime`). Также они не перемещаются на другие тома или диски, поэтому до момента удаления они продолжают учитываться при подсчёте занятого дискового пространства. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/ru/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/ru/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index 40a1eb1a9c6..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,61 +0,0 @@ -# ReplacingMergeTree {#replacingmergetree} - -Движок отличается от [MergeTree](mergetree.md#table_engines-mergetree) тем, что выполняет удаление дублирующихся записей с одинаковым значением первичного ключа (точнее, с одинаковым значением [ключа сортировки](mergetree.md)). - -Дедупликация данных производится лишь во время слияний. Слияние происходят в фоне в неизвестный момент времени, на который вы не можете ориентироваться. Некоторая часть данных может остаться необработанной. Хотя вы можете вызвать внеочередное слияние с помощью запроса `OPTIMIZE`, на это не стоит рассчитывать, так как запрос `OPTIMIZE` приводит к чтению и записи большого объёма данных. - -Таким образом, `ReplacingMergeTree` подходит для фоновой чистки дублирующихся данных в целях экономии места, но не даёт гарантии отсутствия дубликатов. - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Описание параметров запроса смотрите в [описании запроса](../../../engines/table_engines/mergetree_family/replacingmergetree.md). - -**Параметры ReplacingMergeTree** - -- `ver` — столбец с версией, тип `UInt*`, `Date` или `DateTime`. Необязательный параметр. - - При слиянии, из всех строк с одинаковым значением первичного ключа `ReplacingMergeTree` оставляет только одну: - - - Последнюю в выборке, если `ver` не задан. - - С максимальной версией, если `ver` задан. - -**Секции запроса** - -При создании таблицы `ReplacingMergeTree` используются те же [секции](mergetree.md), что и при создании таблицы `MergeTree`. - -
- -Устаревший способ создания таблицы - -!!! attention "Attention" - Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -Все параметры, кроме `ver` имеют то же значение, что в и `MergeTree`. - -- `ver` — столбец с версией. Необязательный параметр. Описание смотрите выше по тексту. - -
- -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/replacingmergetree/) diff --git a/docs/ru/engines/table_engines/mergetree_family/replication.md b/docs/ru/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index 14a50a2b94b..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,211 +0,0 @@ -# Репликация данных {#table_engines-replication} - -Репликация поддерживается только для таблиц семейства MergeTree: - -- ReplicatedMergeTree -- ReplicatedSummingMergeTree -- ReplicatedReplacingMergeTree -- ReplicatedAggregatingMergeTree -- ReplicatedCollapsingMergeTree -- ReplicatedVersionedCollapsingMergeTree -- ReplicatedGraphiteMergeTree - -Репликация работает на уровне отдельных таблиц, а не всего сервера. То есть, на сервере могут быть расположены одновременно реплицируемые и не реплицируемые таблицы. - -Репликация не зависит от шардирования. На каждом шарде репликация работает независимо. - -Реплицируются сжатые данные запросов `INSERT`, `ALTER` (см. подробности в описании запроса [ALTER](../../../engines/table_engines/mergetree_family/replication.md#query_language_queries_alter)). - -Запросы `CREATE`, `DROP`, `ATTACH`, `DETACH` и `RENAME` выполняются на одном сервере и не реплицируются: - -- Запрос `CREATE TABLE` создаёт новую реплицируемую таблицу на том сервере, где его выполнили. Если таблица уже существует на других серверах, запрос добавляет новую реплику. -- `DROP TABLE` удаляет реплику, расположенную на том сервере, где выполняется запрос. -- Запрос `RENAME` переименовывает таблицу на одной реплик. Другими словами, реплицируемые таблицы на разных репликах могут называться по-разному. - -ClickHouse хранит метаинформацию о репликах в [Apache ZooKeeper](https://zookeeper.apache.org). Используйте ZooKeeper 3.4.5 или новее. - -Для использовании репликации, установите параметры в секции [zookeeper](../../../operations/server_configuration_parameters/settings.md#server-settings_zookeeper) конфигурации сервера. - -!!! attention "Внимание" - Не пренебрегайте настройками безопасности. ClickHouse поддерживает [ACL схему](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) `digest` подсистемы безопасности ZooKeeper. - -Пример указания адресов кластера ZooKeeper: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -Можно указать любой имеющийся у вас ZooKeeper-кластер - система будет использовать в нём одну директорию для своих данных (директория указывается при создании реплицируемой таблицы). - -Если в конфигурационном файле не настроен ZooKeeper, то вы не сможете создать реплицируемые таблицы, а уже имеющиеся реплицируемые таблицы будут доступны в режиме только на чтение. - -При запросах `SELECT`, ZooKeeper не используется, т.е. репликация не влияет на производительность `SELECT` и запросы работают так же быстро, как и для нереплицируемых таблиц. При запросах к распределенным реплицированным таблицам поведение ClickHouse регулируется настройками [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) and [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md). - -При каждом запросе `INSERT`, делается около десятка записей в ZooKeeper в рамках нескольких транзакций. (Чтобы быть более точным, это для каждого вставленного блока данных; запрос INSERT содержит один блок или один блок на `max_insert_block_size = 1048576` строк.) Это приводит к некоторому увеличению задержек при `INSERT`, по сравнению с нереплицируемыми таблицами. Но если придерживаться обычных рекомендаций - вставлять данные пачками не более одного `INSERT` в секунду, то это не составляет проблем. На всём кластере ClickHouse, использующим для координации один кластер ZooKeeper, может быть в совокупности несколько сотен `INSERT` в секунду. Пропускная способность при вставке данных (количество строчек в секунду) такая же высокая, как для нереплицируемых таблиц. - -Для очень больших кластеров, можно использовать разные кластеры ZooKeeper для разных шардов. Впрочем, на кластере Яндекс.Метрики (примерно 300 серверов) такой необходимости не возникает. - -Репликация асинхронная, мульти-мастер. Запросы `INSERT` и `ALTER` можно направлять на любой доступный сервер. Данные вставятся на сервер, где выполнен запрос, а затем скопируются на остальные серверы. В связи с асинхронностью, только что вставленные данные появляются на остальных репликах с небольшой задержкой. Если часть реплик недоступна, данные на них запишутся тогда, когда они станут доступны. Если реплика доступна, то задержка составляет столько времени, сколько требуется для передачи блока сжатых данных по сети. - -По умолчанию, запрос INSERT ждёт подтверждения записи только от одной реплики. Если данные были успешно записаны только на одну реплику, и сервер с этой репликой перестал существовать, то записанные данные будут потеряны. Вы можете включить подтверждение записи от нескольких реплик, используя настройку `insert_quorum`. - -Каждый блок данных записывается атомарно. Запрос INSERT разбивается на блоки данных размером до `max_insert_block_size = 1048576` строк. То есть, если в запросе `INSERT` менее 1048576 строк, то он делается атомарно. - -Блоки данных дедуплицируются. При многократной записи одного и того же блока данных (блоков данных одинакового размера, содержащих одни и те же строчки в одном и том же порядке), блок будет записан только один раз. Это сделано для того, чтобы в случае сбоя в сети, когда клиентское приложение не может понять, были ли данные записаны в БД, можно было просто повторить запрос `INSERT`. При этом не имеет значения, на какую реплику будут отправлены INSERT-ы с одинаковыми данными. Запрос `INSERT` идемпотентный. Параметры дедуплицирования регулируются настройками сервера [merge\_tree](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-merge_tree) - -При репликации, по сети передаются только исходные вставляемые данные. Дальнейшие преобразования данных (слияния) координируются и делаются на всех репликах одинаковым образом. За счёт этого минимизируется использование сети, и благодаря этому, репликация хорошо работает при расположении реплик в разных дата-центрах. (Стоит заметить, что дублирование данных в разных дата-центрах, по сути, является основной задачей репликации). - -Количество реплик одних и тех же данных может быть произвольным. В Яндекс.Метрике в продакшене используется двукратная репликация. На каждом сервере используется RAID-5 или RAID-6, в некоторых случаях RAID-10. Это является сравнительно надёжным и удобным для эксплуатации решением. - -Система следит за синхронностью данных на репликах и умеет восстанавливаться после сбоя. Восстановление после сбоя автоматическое (в случае небольших различий в данных) или полуавтоматическое (когда данные отличаются слишком сильно, что может свидетельствовать об ошибке конфигурации). - -## Создание реплицируемых таблиц {#creating-replicated-tables} - -В начало имени движка таблицы добавляется `Replicated`. Например, `ReplicatedMergeTree`. - -**Параметры Replicated\*MergeTree** - -- `zoo_path` — путь к таблице в ZooKeeper. -- `replica_name` — имя реплики в ZooKeeper. - -Пример: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -
- -Пример в устаревшем синтаксисе - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -
- -Как видно в примере, эти параметры могут содержать подстановки в фигурных скобках. Подставляемые значения достаются из конфигурационного файла, из секции `macros`. Пример: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -Путь к таблице в ZooKeeper должен быть разным для каждой реплицируемой таблицы. В том числе, для таблиц на разных шардах, должны быть разные пути. -В данном случае, путь состоит из следующих частей: - -`/clickhouse/tables/` — общий префикс. Рекомендуется использовать именно его. - -`{layer}-{shard}` — идентификатор шарда. В данном примере он состоит из двух частей, так как на кластере Яндекс.Метрики используется двухуровневое шардирование. Для большинства задач, оставьте только подстановку {shard}, которая будет раскрываться в идентификатор шарда. - -`table_name` - имя узла для таблицы в ZooKeeper. Разумно делать его таким же, как имя таблицы. Оно указывается явно, так как, в отличие от имени таблицы, оно не меняется после запроса RENAME. -*Подсказка*: можно также указать имя базы данных перед `table_name`, например `db_name.table_name` - -Имя реплики — то, что идентифицирует разные реплики одной и той же таблицы. Можно использовать для него имя сервера, как показано в примере. Впрочем, достаточно, чтобы имя было уникально лишь в пределах каждого шарда. - -Можно не использовать подстановки, а указать соответствующие параметры явно. Это может быть удобным для тестирования и при настройке маленьких кластеров. Однако в этом случае нельзя пользоваться распределенными DDL-запросами (`ON CLUSTER`). - -При работе с большими кластерами мы рекомендуем использовать подстановки, они уменьшают вероятность ошибки. - -Выполните запрос `CREATE TABLE` на каждой реплике. Запрос создаёт новую реплицируемую таблицу, или добавляет новую реплику к имеющимся. - -Если вы добавляете новую реплику после того, как таблица на других репликах уже содержит некоторые данные, то после выполнения запроса, данные на новую реплику будут скачаны с других реплик. То есть, новая реплика синхронизирует себя с остальными. - -Для удаления реплики, выполните запрос `DROP TABLE`. При этом, удаляется только одна реплика — расположенная на том сервере, где вы выполняете запрос. - -## Восстановление после сбоя {#vosstanovlenie-posle-sboia} - -Если при старте сервера, недоступен ZooKeeper, реплицируемые таблицы переходят в режим только для чтения. Система будет пытаться периодически установить соединение с ZooKeeper. - -Если при `INSERT` недоступен ZooKeeper, или происходит ошибка при взаимодействии с ним, будет выкинуто исключение. - -При подключении к ZooKeeper, система проверяет соответствие между имеющимся в локальной файловой системе набором данных и ожидаемым набором данных (информация о котором хранится в ZooKeeper). Если имеются небольшие несоответствия, то система устраняет их, синхронизируя данные с реплик. - -Обнаруженные битые куски данных (с файлами несоответствующего размера) или неизвестные куски (куски, записанные в файловую систему, но информация о которых не была записана в ZooKeeper) переносятся в поддиректорию detached (не удаляются). Недостающие куски скачиваются с реплик. - -Стоит заметить, что ClickHouse не делает самостоятельно никаких деструктивных действий типа автоматического удаления большого количества данных. - -При старте сервера (или создании новой сессии с ZooKeeper), проверяется только количество и размеры всех файлов. Если у файлов совпадают размеры, но изменены байты где-то посередине, то это обнаруживается не сразу, а только при попытке их прочитать при каком-либо запросе `SELECT`. Запрос кинет исключение о несоответствующей чексумме или размере сжатого блока. В этом случае, куски данных добавляются в очередь на проверку, и при необходимости, скачиваются с реплик. - -Если обнаруживается, что локальный набор данных слишком сильно отличается от ожидаемого, то срабатывает защитный механизм. Сервер сообщает об этом в лог и отказывается запускаться. Это сделано, так как такой случай может свидетельствовать об ошибке конфигурации - например, если реплика одного шарда была случайно сконфигурирована, как реплика другого шарда. Тем не менее, пороги защитного механизма поставлены довольно низкими, и такая ситуация может возникнуть и при обычном восстановлении после сбоя. В этом случае, восстановление делается полуавтоматически - «по кнопке». - -Для запуска восстановления, создайте в ZooKeeper узел `/path_to_table/replica_name/flags/force_restore_data` с любым содержимым или выполните команду для восстановления всех реплицируемых таблиц: - -``` bash -$ sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -Затем запустите сервер. При старте, сервер удалит эти флаги и запустит восстановление. - -## Восстановление в случае потери всех данных {#vosstanovlenie-v-sluchae-poteri-vsekh-dannykh} - -Если на одном из серверов исчезли все данные и метаданные, восстановление делается следующим образом: - -1. Установите на сервер ClickHouse. Корректно пропишите подстановки в конфигурационном файле, отвечающие за идентификатор шарда и реплики, если вы их используете. -2. Если у вас были нереплицируемые таблицы, которые должны быть вручную продублированы на серверах, скопируйте их данные (в директории `/var/lib/clickhouse/data/db_name/table_name/`) с реплики. -3. Скопируйте с реплики определения таблиц, находящиеся в `/var/lib/clickhouse/metadata/`. Если в определениях таблиц, идентификатор шарда или реплики, прописаны в явном виде - исправьте их, чтобы они соответствовали данной реплике. (Альтернативный вариант - запустить сервер и сделать самостоятельно все запросы `ATTACH TABLE`, которые должны были бы быть в соответствующих .sql файлах в `/var/lib/clickhouse/metadata/`.) -4. Создайте в ZooKeeper узел `/path_to_table/replica_name/flags/force_restore_data` с любым содержимым или выполните команду для восстановления всех реплицируемых таблиц: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -Затем запустите сервер (перезапустите, если уже запущен). Данные будут скачаны с реплик. - -В качестве альтернативного варианта восстановления, вы можете удалить из ZooKeeper информацию о потерянной реплике (`/path_to_table/replica_name`), и затем создать реплику заново, как написано в разделе [Создание реплицированных таблиц](#creating-replicated-tables) . - -Отсутствует ограничение на использование сетевой полосы при восстановлении. Имейте это ввиду, если восстанавливаете сразу много реплик. - -## Преобразование из MergeTree в ReplicatedMergeTree {#preobrazovanie-iz-mergetree-v-replicatedmergetree} - -Здесь и далее, под `MergeTree` подразумеваются все движки таблиц семейства `MergeTree`, так же для `ReplicatedMergeTree`. - -Если у вас была таблица типа `MergeTree`, репликация которой делалась вручную, вы можете преобразовать её в реплицируемую таблицу. Это может понадобиться лишь в случаях, когда вы уже успели накопить большое количество данных в таблице типа `MergeTree`, а сейчас хотите включить репликацию. - -Если на разных репликах данные отличаются, то сначала синхронизируйте их, либо удалите эти данные на всех репликах кроме одной. - -Переименуйте имеющуюся MergeTree таблицу, затем создайте со старым именем таблицу типа `ReplicatedMergeTree`. -Перенесите данные из старой таблицы в поддиректорию detached в директории с данными новой таблицы (`/var/lib/clickhouse/data/db_name/table_name/`). -Затем добавьте эти куски данных в рабочий набор с помощью выполнения запросов `ALTER TABLE ATTACH PARTITION` на одной из реплик. - -## Преобразование из ReplicatedMergeTree в MergeTree {#preobrazovanie-iz-replicatedmergetree-v-mergetree} - -Создайте таблицу типа MergeTree с другим именем. Перенесите в её директорию с данными все данные из директории с данными таблицы типа `ReplicatedMergeTree`. Затем удалите таблицу типа `ReplicatedMergeTree` и перезапустите сервер. - -Если вы хотите избавиться от таблицы `ReplicatedMergeTree`, не запуская сервер, то - -- удалите соответствующий файл `.sql` в директории с метаданными (`/var/lib/clickhouse/metadata/`); -- удалите соответствующий путь в ZooKeeper (`/path_to_table/replica_name`); - -После этого, вы можете запустить сервер, создать таблицу типа `MergeTree`, перенести данные в её директорию, и перезапустить сервер. - -## Восстановление в случае потери или повреждения метаданных на ZooKeeper кластере {#vosstanovlenie-v-sluchae-poteri-ili-povrezhdeniia-metadannykh-na-zookeeper-klastere} - -Если данные в ZooKeeper оказались утеряны или повреждены, то вы можете сохранить данные, переместив их в нереплицируемую таблицу, как описано в пункте выше. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/replication/) diff --git a/docs/ru/engines/table_engines/mergetree_family/summingmergetree.md b/docs/ru/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index b69f58c3dac..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,134 +0,0 @@ -# SummingMergeTree {#summingmergetree} - -Движок наследует функциональность [MergeTree](mergetree.md#table_engines-mergetree). Отличие заключается в том, что для таблиц `SummingMergeTree` при слиянии кусков данных ClickHouse все строки с одинаковым первичным ключом (точнее, с одинаковым [ключом сортировки](mergetree.md)) заменяет на одну, которая хранит только суммы значений из столбцов с цифровым типом данных. Если ключ сортировки подобран таким образом, что одному значению ключа соответствует много строк, это значительно уменьшает объём хранения и ускоряет последующую выборку данных. - -Мы рекомендуем использовать движок в паре с `MergeTree`. В `MergeTree` храните полные данные, а `SummingMergeTree` используйте для хранения агрегированных данных, например, при подготовке отчетов. Такой подход позволит не утратить ценные данные из-за неправильно выбранного первичного ключа. - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = SummingMergeTree([columns]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Описание параметров запроса смотрите в [описании запроса](../../../engines/table_engines/mergetree_family/summingmergetree.md). - -**Параметры SummingMergeTree** - -- `columns` — кортеж с именами столбцов, в которых будут суммироваться данные. Необязательный параметр. - Столбцы должны иметь числовой тип и не должны входить в первичный ключ. - - Если `columns` не задан, то ClickHouse суммирует значения во всех столбцах с числовым типом данных, не входящих в первичный ключ. - -**Секции запроса** - -При создании таблицы `SummingMergeTree` используются те же [секции](mergetree.md) запроса, что и при создании таблицы `MergeTree`. - -
- -Устаревший способ создания таблицы - -!!! attention "Attention" - Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) -``` - -Все параметры, кроме `columns` имеют то же значение, что в и `MergeTree`. - -- `columns` — кортеж с именами столбцов для суммирования данных. Необязательный параметр. Описание смотрите выше по тексту. - -
- -## Пример использования {#primer-ispolzovaniia} - -Рассмотрим следующую таблицу: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -Добавим в неё данные: - -``` sql -INSERT INTO summtt Values(1,1),(1,2),(2,1) -``` - -ClickHouse может не полностью просуммировать все строки ([смотрите ниже по тексту](#obrabotka-dannykh)), поэтому при запросе мы используем агрегатную функцию `sum` и секцию `GROUP BY`. - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - -``` text -┌─key─┬─sum(value)─┐ -│ 2 │ 1 │ -│ 1 │ 3 │ -└─────┴────────────┘ -``` - -## Обработка данных {#obrabotka-dannykh} - -При вставке данных в таблицу они сохраняются как есть. Периодически ClickHouse выполняет слияние вставленных кусков данных и именно в этот момент производится суммирование и замена многих строк с одинаковым первичным ключом на одну для каждого результирующего куска данных. - -ClickHouse может слить куски данных таким образом, что не все строки с одинаковым первичным ключом окажутся в одном финальном куске, т.е. суммирование будет не полным. Поэтому, при выборке данных (`SELECT`) необходимо использовать агрегатную функцию [sum()](../../../engines/table_engines/mergetree_family/summingmergetree.md#agg_function-sum) и секцию `GROUP BY` как описано в примере выше. - -### Общие правила суммирования {#obshchie-pravila-summirovaniia} - -Суммируются значения в столбцах с числовым типом данных. Набор столбцов определяется параметром `columns`. - -Если значения во всех столбцах для суммирования оказались нулевыми, то строчка удаляется. - -Для столбцов, не входящих в первичный ключ и не суммирующихся, выбирается произвольное значение из имеющихся. - -Значения для столбцов, входящих в первичный ключ, не суммируются. - -### Суммирование в столбцах AggregateFunction {#summirovanie-v-stolbtsakh-aggregatefunction} - -Для столбцов типа [AggregateFunction](../../../engines/table_engines/mergetree_family/summingmergetree.md#data_type-aggregatefunction) ClickHouse выполняет агрегацию согласно заданной функции, повторяя поведение движка [AggregatingMergeTree](aggregatingmergetree.md). - -### Вложенные структуры {#vlozhennye-struktury} - -Таблица может иметь вложенные структуры данных, которые обрабатываются особым образом. - -Если название вложенной таблицы заканчивается на `Map` и она содержит не менее двух столбцов, удовлетворяющих критериям: - -- первый столбец - числовой `(*Int*, Date, DateTime)`, назовем его условно `key`, -- остальные столбцы - арифметические `(*Int*, Float32/64)`, условно `(values...)`, - -то вложенная таблица воспринимается как отображение `key => (values...)` и при слиянии её строк выполняется слияние элементов двух множеств по `key` со сложением соответствующих `(values...)`. - -Примеры: - -``` text -[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] -[(1, 100)] + [(1, 150)] -> [(1, 250)] -[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] -[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] -``` - -При запросе данных используйте функцию [sumMap(key, value)](../../../engines/table_engines/mergetree_family/summingmergetree.md) для агрегации `Map`. - -Для вложенной структуры данных не нужно указывать её столбцы в кортеже столбцов для суммирования. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/summingmergetree/) diff --git a/docs/ru/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/ru/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index 90647edd0eb..00000000000 --- a/docs/ru/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,231 +0,0 @@ -# VersionedCollapsingMergeTree {#versionedcollapsingmergetree} - -Движок: - -- Позволяет быстро записывать постоянно изменяющиеся состояния объектов. -- Удаляет старые состояния объектов в фоновом режиме. Это значительно сокращает объём хранения. - -Подробнее читайте в разделе [Collapsing](#table_engines_versionedcollapsingmergetree). - -Движок наследует функциональность от [MergeTree](mergetree.md#table_engines-mergetree) и добавляет в алгоритм слияния кусков данных логику сворачивания (удаления) строк. `VersionedCollapsingMergeTree` предназначен для тех же задач, что и [CollapsingMergeTree](collapsingmergetree.md), но использует другой алгоритм свёртывания, который позволяет вставлять данные в любом порядке в несколько потоков. В частности, столбец `Version` помогает свернуть строки правильно, даже если они вставлены в неправильном порядке. `CollapsingMergeTree` требует строго последовательную вставку данных. - -## Создание таблицы {#sozdanie-tablitsy} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Подробности про `CREATE TABLE` смотрите в [описании запроса](../../../engines/table_engines/mergetree_family/versionedcollapsingmergetree.md). - -**Параметры движка** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. - - Тип данных столбца должен быть `Int8`. - -- `version` — имя столбца с версией состояния объекта. - - Тип данных столбца должен быть `UInt*`. - -**Секции запроса** - -При создании таблицы `VersionedСollapsingMergeTree` используются те же [секции](mergetree.md) запроса, что и при создании таблицы `MergeTree` . - -
- -Устаревший способ создания таблицы - -!!! warning "Внимание" - Не используйте этот метод в новых проектах. По возможности переключите старые проекты на метод, описанный выше. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -Все параметры, за исключением `sign` и `version` имеют то же значение, что и в `MergeTree`. - -- `sign` — Имя столбца с типом строки: `1` — строка состояния, `-1` — строка отмены состояния. - - Тип данных столбца — `Int8`. - -- `version` — имя столбца с версией состояния объекта. - - Тип данных столбца должен быть `UInt*`. - -
- -## Сворачивание (удаление) строк {#table_engines-versionedcollapsingmergetree} - -### Данные {#dannye} - -Рассмотрим ситуацию, когда необходимо сохранять постоянно изменяющиеся данные для какого-либо объекта. Разумно иметь одну строку для объекта и обновлять эту строку при каждом изменении. Однако операция обновления является дорогостоящей и медленной для СУБД, поскольку требует перезаписи данных в хранилище. Обновление неприемлемо, если требуется быстро записывать данные, но можно записывать изменения в объект последовательно следующим образом. - -Используйте столбец `Sign` при записи строки. Если `Sign = 1`, то это означает, что строка является состоянием объекта, назовём её строкой состояния. Если `Sign = -1`, то это означает отмену состояния объекта с теми же атрибутами, назовём её строкой отмены состояния. Также используйте столбец `Version`, который должен идентифицировать каждое состояние объекта отдельным номером. - -Например, мы хотим рассчитать, сколько страниц пользователи посетили на каком-либо сайте и как долго они там находились. В какой-то момент времени мы записываем следующую строку состояния пользовательской активности: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Через некоторое время мы регистрируем изменение активности пользователя и записываем его следующими двумя строками. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Первая строка отменяет предыдущее состояние объекта (пользователя). Она должна копировать все поля отменяемого состояния за исключением `Sign`. - -Вторая строка содержит текущее состояние. - -Поскольку нам нужно только последнее состояние активности пользователя, строки - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -можно удалить, сворачивая (удаляя) устаревшее состояние объекта. `VersionedCollapsingMergeTree` делает это при слиянии кусков данных. - -Чтобы узнать, зачем нам нужны две строки для каждого изменения, см. раздел [Алгоритм](#table_engines-versionedcollapsingmergetree-algorithm). - -**Примечания по использованию** - -1. Программа, которая записывает данные, должна помнить состояние объекта, чтобы иметь возможность отменить его. Строка отмены состояния должна быть копией предыдущей строки состояния с противоположным значением `Sign`. Это увеличивает начальный размер хранилища, но позволяет быстро записывать данные. -2. Длинные растущие массивы в столбцах снижают эффективность работы движка за счёт нагрузки на запись. Чем проще данные, тем выше эффективность. -3. `SELECT` результаты сильно зависят от согласованности истории изменений объекта. Будьте точны при подготовке данных для вставки. Вы можете получить непредсказуемые результаты с несогласованными данными, такими как отрицательные значения для неотрицательных метрик, таких как глубина сеанса. - -### Алгоритм {#table_engines-versionedcollapsingmergetree-algorithm} - -Когда ClickHouse объединяет куски данных, он удаляет каждую пару строк, которые имеют один и тот же первичный ключ и версию и разный `Sign`. Порядок строк не имеет значения. - -Когда ClickHouse вставляет данные, он упорядочивает строки по первичному ключу. Если столбец `Version` не находится в первичном ключе, ClickHouse добавляет его к первичному ключу неявно как последнее поле и использует для сортировки. - -## Выборка данных {#vyborka-dannykh} - -ClickHouse не гарантирует, что все строки с одинаковым первичным ключом будут находиться в одном результирующем куске данных или даже на одном физическом сервере. Это справедливо как для записи данных, так и для последующего слияния кусков данных. Кроме того, ClickHouse обрабатывает запросы `SELECT` несколькими потоками, и не может предсказать порядок строк в конечной выборке. Это означает, что если необходимо получить полностью «свернутые» данные из таблицы `VersionedCollapsingMergeTree`, то требуется агрегирование. - -Для завершения свертывания добавьте в запрос секцию `GROUP BY` и агрегатные функции, которые учитывают знак. Например, для расчета количества используйте `sum(Sign)` вместо`count()`. Чтобы вычислить сумму чего-либо, используйте `sum(Sign * x)` вместо`sum(х)`, а также добавьте `HAVING sum(Sign) > 0` . - -Таким образом можно вычислять агрегации `count`, `sum` и `avg`. Агрегация `uniq` может вычисляться, если объект имеет хотя бы одно не свернутое состояние. Невозможно вычислить агрегации `min` и `max` поскольку`VersionedCollapsingMergeTree` не сохраняет историю значений для свернутых состояний. - -Если необходимо выбирать данные без агрегации (например, проверить наличие строк, последние значения которых удовлетворяют некоторым условиям), можно использовать модификатор `FINAL` для секции `FROM`. Такой подход неэффективен и не должен использоваться с большими таблицами. - -## Пример использования {#primer-ispolzovaniia} - -Данные для примера: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Создание таблицы: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -Вставка данных: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -Мы используем два запроса `INSERT` для создания двух различных кусков данных. Если мы вставляем данные с помощью одного запроса, ClickHouse создаёт один кусок данных и не будет выполнять слияние. - -Получение данных: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Что мы видим и где сворачивание? -Мы создали два куска данных, используя два запроса `INSERT`. Запрос `SELECT` был выполнен в два потока, и результатом является случайный порядок строк. -Свертывание не произошло, поскольку части данных еще не были объединены. ClickHouse объединяет части данных в неизвестный момент времени, который мы не можем предсказать. - -Поэтому нам нужна агрегация: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -Если нам не нужна агрегация, но мы хотим принудительно выполнить свёртку данных, то можно использовать модификатор `FINAL` для секции `FROM`. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Это очень неэффективный способ выбора данных. Не используйте его для больших таблиц. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/ru/engines/table_engines/special/dictionary.md b/docs/ru/engines/table_engines/special/dictionary.md deleted file mode 100644 index fac22b5d2f2..00000000000 --- a/docs/ru/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,88 +0,0 @@ -# Dictionary {#dictionary} - -Движок `Dictionary` отображает данные [словаря](../../../engines/table_engines/special/dictionary.md) как таблицу ClickHouse. - -Рассмотрим для примера словарь `products` со следующей конфигурацией: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -Запрос данных словаря: - -``` sql -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - -``` text -┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ -│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ -└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ -``` - -В таком виде данные из словаря можно получить при помощи функций [dictGet\*](../../../engines/table_engines/special/dictionary.md#ext_dict_functions). - -Такое представление неудобно, когда нам необходимо получить данные в чистом виде, а также при выполнении операции `JOIN`. Для этих случаев можно использовать движок `Dictionary`, который отобразит данные словаря в таблицу. - -Синтаксис: - -``` sql -CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` -``` - -Пример использования: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); -``` - -Проверим что у нас в таблице? - -``` sql -select * from products limit 1; -``` - -``` text -┌────product_id─┬─title───────────┐ -│ 152689 │ Some item │ -└───────────────┴─────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/dictionary/) diff --git a/docs/ru/engines/table_engines/special/distributed.md b/docs/ru/engines/table_engines/special/distributed.md deleted file mode 100644 index 9fc7b470f1d..00000000000 --- a/docs/ru/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,116 +0,0 @@ -# Distributed {#distributed} - -**Движок Distributed не хранит данные самостоятельно**, а позволяет обрабатывать запросы распределённо, на нескольких серверах. -Чтение автоматически распараллеливается. При чтении будут использованы индексы таблиц на удалённых серверах, если есть. -Движок Distributed принимает параметры: имя кластера в конфигурационном файле сервера, имя удалённой базы данных, имя удалённой таблицы, а также (не обязательно) ключ шардирования. -Пример: - -``` sql -Distributed(logs, default, hits[, sharding_key]) -``` - -данные будут читаться со всех серверов кластера logs, из таблицы default.hits, расположенной на каждом сервере кластера. -Данные не только читаются, но и частично (настолько, насколько это возможно) обрабатываются на удалённых серверах. -Например, при запросе с GROUP BY, данные будут агрегированы на удалённых серверах, промежуточные состояния агрегатных функций будут отправлены на запросивший сервер; затем данные будут доагрегированы. - -Вместо имени базы данных может использоваться константное выражение, возвращающее строку. Например, currentDatabase(). - -logs - имя кластера в конфигурационном файле сервера. - -Кластеры задаются следующим образом: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 9000 - - - - -``` - -Здесь задан кластер с именем logs, состоящий из двух шардов, каждый из которых состоит из двух реплик. -Шардами называются серверы, содержащие разные части данных (чтобы прочитать все данные, нужно идти на все шарды). -Репликами называются дублирующие серверы (чтобы прочитать данные, можно идти за данными на любую из реплик). - -Имя кластера не должно содержать точки. - -В качестве параметров для каждого сервера указываются `host`, `port` и, не обязательно, `user`, `password`, `secure`, `compression`: -- `host` - адрес удалённого сервера. Может быть указан домен, или IPv4 или IPv6 адрес. В случае указания домена, при старте сервера делается DNS запрос, и результат запоминается на всё время работы сервера. Если DNS запрос неуспешен, то сервер не запускается. Если вы изменяете DNS-запись, перезапустите сервер. -- `port` - TCP-порт для межсерверного взаимодействия (в конфиге - tcp\_port, обычно 9000). Не перепутайте с http\_port. -- `user` - имя пользователя для соединения с удалённым сервером. по умолчанию - default. Этот пользователь должен иметь доступ для соединения с указанным сервером. Доступы настраиваются в файле users.xml, подробнее смотрите в разделе [Права доступа](../../../operations/access_rights.md). -- `password` - пароль для соединения с удалённым сервером, в открытом виде. по умолчанию - пустая строка. -- `secure` - Использовать шифрованное соединение ssl, Обычно используется с портом `port` = 9440. Сервер должен слушать порт 9440 с корректными настройками сертификатов. -- `compression` - Использовать сжатие данных. По умолчанию: true. - -При указании реплик, для каждого из шардов, при чтении, будет выбрана одна из доступных реплик. Можно настроить алгоритм балансировки нагрузки (то есть, предпочтения, на какую из реплик идти) - см. настройку [load\_balancing](../../../operations/settings/settings.md#settings-load_balancing). -Если соединение с сервером не установлено, то будет произведена попытка соединения с небольшим таймаутом. Если соединиться не удалось, то будет выбрана следующая реплика, и так для всех реплик. Если попытка соединения для всех реплик не удалась, то будут снова произведены попытки соединения по кругу, и так несколько раз. -Это работает в пользу отказоустойчивости, хотя и не обеспечивает полную отказоустойчивость: удалённый сервер может принять соединение, но не работать, или плохо работать. - -Можно указать от одного шарда (в таком случае, обработку запроса стоит называть удалённой, а не распределённой) до произвольного количества шардов. В каждом шарде можно указать от одной до произвольного числа реплик. Можно указать разное число реплик для каждого шарда. - -Вы можете прописать сколько угодно кластеров в конфигурации. - -Для просмотра имеющихся кластеров, вы можете использовать системную таблицу system.clusters. - -Движок Distributed позволяет работать с кластером, как с локальным сервером. При этом, кластер является неэластичным: вы должны прописать его конфигурацию в конфигурационный файл сервера (лучше всех серверов кластера). - -Как видно, движок Distributed требует прописывания кластера в конфигурационный файл; кластера из конфигурационного файла обновляются налету, без перезапуска сервера. Если вам необходимо каждый раз отправлять запрос на неизвестный набор шардов и реплик, вы можете не создавать Distributed таблицу, а воспользоваться табличной функцией remote. Смотрите раздел [Табличные функции](../../../engines/table_engines/special/distributed.md). - -Есть два способа записывать данные на кластер: - -Во-первых, вы можете самостоятельно определять, на какие серверы какие данные записывать, и выполнять запись непосредственно на каждый шард. То есть, делать INSERT в те таблицы, на которые «смотрит» распределённая таблица. Это наиболее гибкое решение поскольку вы можете использовать любую схему шардирования, которая может быть нетривиальной из-за требований предметной области. -Также это является наиболее оптимальным решением, так как данные могут записываться на разные шарды полностью независимо. - -Во-вторых, вы можете делать INSERT в Distributed таблицу. В этом случае, таблица будет сама распределять вставляемые данные по серверам. Для того, чтобы писать в Distributed таблицу, у неё должен быть задан ключ шардирования (последний параметр). Также, если шард всего-лишь один, то запись работает и без указания ключа шардирования (так как в этом случае он не имеет смысла). - -У каждого шарда в конфигурационном файле может быть задан «вес» (weight). По умолчанию, вес равен единице. Данные будут распределяться по шардам в количестве, пропорциональном весу шарда. Например, если есть два шарда, и у первого выставлен вес 9, а у второго 10, то на первый будет отправляться 9 / 19 доля строк, а на второй - 10 / 19. - -У каждого шарда в конфигурационном файле может быть указан параметр internal\_replication. - -Если он выставлен в true, то для записи будет выбираться первая живая реплика и данные будут писаться на неё. Этот вариант следует использовать, если Distributed таблица «смотрит» на реплицируемые таблицы. То есть, если таблица, в которую будут записаны данные, будет сама заниматься их репликацией. - -Если он выставлен в false (по умолчанию), то данные будут записываться на все реплики. По сути, это означает, что Distributed таблица занимается репликацией данных самостоятельно. Это хуже, чем использование реплицируемых таблиц, так как не контролируется консистентность реплик, и они со временем будут содержать немного разные данные. - -Для выбора шарда, на который отправляется строка данных, вычисляется выражение шардирования, и берётся его остаток от деления на суммарный вес шардов. Строка отправляется на шард, соответствующий полуинтервалу остатков от prev\_weights до prev\_weights + weight, где prev\_weights - сумма весов шардов с меньшим номером, а weight - вес этого шарда. Например, если есть два шарда, и у первого выставлен вес 9, а у второго 10, то строка будет отправляться на первый шард для остатков из диапазона \[0, 9), а на второй - для остатков из диапазона \[9, 19). - -Выражением шардирование может быть произвольное выражение от констант и столбцов таблицы, возвращающее целое число. Например, вы можете использовать выражение rand() для случайного распределения данных, или UserID - для распределения по остатку от деления идентификатора посетителя (тогда данные одного посетителя будут расположены на одном шарде, что упростит выполнение IN и JOIN по посетителям). Если распределение какого-либо столбца недостаточно равномерное, вы можете обернуть его в хэш функцию: intHash64(UserID). - -Простой остаток от деления является довольно ограниченным решением для шардирования и подходит не для всех случаев. Он подходит для среднего и большого объёма данных (десятки серверов), но не для очень больших объёмов данных (сотни серверов и больше). В последнем случае, лучше использовать схему шардирования, продиктованную требованиями предметной области, и не использовать возможность записи в Distributed таблицы. - -Запросы SELECT отправляются на все шарды, и работают независимо от того, каким образом данные распределены по шардам (они могут быть распределены полностью случайно). При добавлении нового шарда, можно не переносить на него старые данные, а записывать новые данные с большим весом - данные будут распределены слегка неравномерно, но запросы будут работать корректно и достаточно эффективно. - -Беспокоиться о схеме шардирования имеет смысл в следующих случаях: -- используются запросы, требующие соединение данных (IN, JOIN) по определённому ключу - тогда если данные шардированы по этому ключу, то можно использовать локальные IN, JOIN вместо GLOBAL IN, GLOBAL JOIN, что кардинально более эффективно. -- используется большое количество серверов (сотни и больше) и большое количество маленьких запросов (запросы отдельных клиентов - сайтов, рекламодателей, партнёров) - тогда, для того, чтобы маленькие запросы не затрагивали весь кластер, имеет смысл располагать данные одного клиента на одном шарде, или (вариант, который используется в Яндекс.Метрике) сделать двухуровневое шардирование: разбить весь кластер на «слои», где слой может состоять из нескольких шардов; данные для одного клиента располагаются на одном слое, но в один слой можно по мере необходимости добавлять шарды, в рамках которых данные распределены произвольным образом; создаются распределённые таблицы на каждый слой и одна общая распределённая таблица для глобальных запросов. - -Запись данных осуществляется полностью асинхронно. При вставке в таблицу, блок данных сначала записывается в файловую систему. Затем, в фоновом режиме отправляются на удалённые серверы при первой возможности. Период отправки регулируется настройками [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) и [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms). Движок таблиц `Distributed` отправляет каждый файл со вставленными данными отдельно, но можно включить пакетную отправку данных настройкой [distributed\_directory\_monitor\_batch\_inserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts). Эта настройка улучшает производительность кластера за счет более оптимального использования ресурсов сервера-отправителя и сети. Необходимо проверять, что данные отправлены успешно, для этого проверьте список файлов (данных, ожидающих отправки) в каталоге таблицы `/var/lib/clickhouse/data/database/table/`. - -Если после INSERT-а в Distributed таблицу, сервер перестал существовать или был грубо перезапущен (например, в следствие аппаратного сбоя), то записанные данные могут быть потеряны. Если в директории таблицы обнаружен повреждённый кусок данных, то он переносится в поддиректорию broken и больше не используется. - -При выставлении опции max\_parallel\_replicas выполнение запроса распараллеливается по всем репликам внутри одного шарда. Подробнее смотрите раздел [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/distributed/) diff --git a/docs/ru/engines/table_engines/special/file.md b/docs/ru/engines/table_engines/special/file.md deleted file mode 100644 index 138c2e47b89..00000000000 --- a/docs/ru/engines/table_engines/special/file.md +++ /dev/null @@ -1,79 +0,0 @@ -# File(Format) {#table_engines-file} - -Управляет данными в одном файле на диске в указанном формате. - -Примеры применения: - -- Выгрузка данных из ClickHouse в файл. -- Преобразование данных из одного формата в другой. -- Обновление данных в ClickHouse редактированием файла на диске. - -## Использование движка в сервере ClickHouse {#ispolzovanie-dvizhka-v-servere-clickhouse} - -``` sql -File(Format) -``` - -`Format` должен быть таким, который ClickHouse может использовать и в запросах `INSERT` и в запросах `SELECT`. Полный список поддерживаемых форматов смотрите в разделе [Форматы](../../../interfaces/formats.md#formats). - -Сервер ClickHouse не позволяет указать путь к файлу, с которым будет работать `File`. Используется путь к хранилищу, определенный параметром [path](../../../operations/server_configuration_parameters/settings.md) в конфигурации сервера. - -При создании таблицы с помощью `File(Format)` сервер ClickHouse создает в хранилище каталог с именем таблицы, а после добавления в таблицу данных помещает туда файл `data.Format`. - -Можно вручную создать в хранилище каталог таблицы, поместить туда файл, затем на сервере ClickHouse добавить ([ATTACH](../../../engines/table_engines/special/file.md)) информацию о таблице, соответствующей имени каталога и прочитать из файла данные. - -!!! warning "Warning" - Будьте аккуратны с этой функциональностью, поскольку сервер ClickHouse не отслеживает внешние изменения данных. Если в файл будет производиться запись одновременно со стороны сервера ClickHouse и с внешней стороны, то результат непредсказуем. - -**Пример:** - -**1.** Создадим на сервере таблицу `file_engine_table`: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -В конфигурации по умолчанию сервер ClickHouse создаст каталог `/var/lib/clickhouse/data/default/file_engine_table`. - -**2.** Вручную создадим файл `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` с содержимым: - -``` bash -$cat data.TabSeparated -one 1 -two 2 -``` - -**3.** Запросим данные: - -``` sql -SELECT * FROM file_engine_table -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Использование движка в clickhouse-local {#ispolzovanie-dvizhka-v-clickhouse-local} - -В [clickhouse-local](../../../engines/table_engines/special/file.md) движок в качестве параметра принимает не только формат, но и путь к файлу. В том числе можно указать стандартные потоки ввода/вывода цифровым или буквенным обозначением `0` или `stdin`, `1` или `stdout`. - -**Пример:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## Детали реализации {#detali-realizatsii} - -- Поддерживается одновременное выполнение множества запросов `SELECT`, запросы `INSERT` могут выполняться только последовательно. -- Поддерживается создание ещё не существующего файла при запросе `INSERT`. -- Для существующих файлов `INSERT` записывает в конец файла. -- Не поддерживается: - - использование операций `ALTER` и `SELECT...SAMPLE`; - - индексы; - - репликация. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/file/) diff --git a/docs/ru/engines/table_engines/special/generate.md b/docs/ru/engines/table_engines/special/generate.md deleted file mode 120000 index 566dc4e5382..00000000000 --- a/docs/ru/engines/table_engines/special/generate.md +++ /dev/null @@ -1 +0,0 @@ -../../../../en/engines/table_engines/special/generate.md \ No newline at end of file diff --git a/docs/ru/engines/table_engines/special/index.md b/docs/ru/engines/table_engines/special/index.md deleted file mode 100644 index 22cebf295c1..00000000000 --- a/docs/ru/engines/table_engines/special/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Special -toc_priority: 31 ---- - diff --git a/docs/ru/engines/table_engines/special/join.md b/docs/ru/engines/table_engines/special/join.md deleted file mode 100644 index 0ca53f34acb..00000000000 --- a/docs/ru/engines/table_engines/special/join.md +++ /dev/null @@ -1,104 +0,0 @@ -# Join {#join} - -Подготовленная структура данных для использования в операциях [JOIN](../../../engines/table_engines/special/join.md#select-join). - -## Создание таблицы {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], -) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) -``` - -Смотрите подробное описание запроса [CREATE TABLE](../../../engines/table_engines/special/join.md#create-table-query). - -**Параметры движка** - -- `join_strictness` – [строгость JOIN](../../../engines/table_engines/special/join.md#select-join-strictness). -- `join_type` – [тип JOIN](../../../engines/table_engines/special/join.md#select-join-types). -- `k1[, k2, ...]` – ключевые столбцы секции `USING` с которыми выполняется операция `JOIN`. - -Вводите параметры `join_strictness` и `join_type` без кавычек, например, `Join(ANY, LEFT, col1)`. Они должны быть такими же как и в той операции `JOIN`, в которой таблица будет использоваться. Если параметры не совпадают, ClickHouse не генерирует исключение и может возвращать неверные данные. - -## Использование таблицы {#ispolzovanie-tablitsy} - -### Пример {#primer} - -Создание левой таблицы: - -``` sql -CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog -``` - -``` sql -INSERT INTO id_val VALUES (1,11)(2,12)(3,13) -``` - -Создание правой таблицы с движком `Join`: - -``` sql -CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) -``` - -``` sql -INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) -``` - -Объединение таблиц: - -``` sql -SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 -``` - -``` text -┌─id─┬─val─┬─id_val_join.val─┐ -│ 1 │ 11 │ 21 │ -│ 2 │ 12 │ ᴺᵁᴸᴸ │ -│ 3 │ 13 │ 23 │ -└────┴─────┴─────────────────┘ -``` - -В качестве альтернативы, можно извлечь данные из таблицы `Join`, указав значение ключа объединения: - -``` sql -SELECT joinGet('id_val_join', 'val', toUInt32(1)) -``` - -``` text -┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ -│ 21 │ -└────────────────────────────────────────────┘ -``` - -### Выборка и вставка данных {#vyborka-i-vstavka-dannykh} - -Для добавления данных в таблицы с движком `Join` используйте запрос `INSERT`. Если таблица создавалась со строгостью `ANY`, то данные с повторяющимися ключами игнорируются. Если задавалась строгость `ALL`, то добавляются все строки. - -Из таблиц нельзя выбрать данные с помощью запроса `SELECT`. Вместо этого, используйте один из следующих методов: - -- Используйте таблицу как правую в секции `JOIN`. -- Используйте функцию [joinGet](../../../engines/table_engines/special/join.md#joinget), которая позволяет извлекать данные из таблицы таким же образом как из словаря. - -### Ограничения и настройки {#join-limitations-and-settings} - -При создании таблицы, применяются следующие параметры : - -- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) -- [max\_rows\_in\_join](../../../operations/settings/query_complexity.md#settings-max_rows_in_join) -- [max\_bytes\_in\_join](../../../operations/settings/query_complexity.md#settings-max_bytes_in_join) -- [join\_overflow\_mode](../../../operations/settings/query_complexity.md#settings-join_overflow_mode) -- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) - -Таблицы с движком `Join` нельзя использовать в операциях `GLOBAL JOIN`. - -Движок `Join` позволяет использовать параметр [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) в запросе `CREATE TABLE`, который также можно использовать в запросе [SELECT](../../../engines/table_engines/special/join.md). Если у вас разные настройки `join_use_nulls`, вы можете получить сообщение об ошибке при объединении таблиц. Это зависит от типа соединения. Когда вы используете функцию [joinGet](../../../engines/table_engines/special/join.md#joinget), вам необходимо использовать один и тот же параметр `join_use_nulls` в запросах `CRATE TABLE` и `SELECT`. - -## Хранение данных {#khranenie-dannykh} - -Данные таблиц `Join` всегда находятся в RAM. При вставке строк в таблицу ClickHouse записывает блоки данных в каталог на диске, чтобы их можно было восстановить при перезапуске сервера. - -При аварийном перезапуске сервера блок данных на диске может быть потерян или повреждён. В последнем случае, может потребоваться вручную удалить файл с повреждёнными данными. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/join/) diff --git a/docs/ru/engines/table_engines/special/materializedview.md b/docs/ru/engines/table_engines/special/materializedview.md deleted file mode 100644 index 2adcdb8df70..00000000000 --- a/docs/ru/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,5 +0,0 @@ -# MaterializedView {#materializedview} - -Используется для реализации материализованных представлений (подробнее см. запрос [CREATE TABLE](../../../engines/table_engines/special/materializedview.md)). Для хранения данных, использует другой движок, который был указан при создании представления. При чтении из таблицы, просто использует этот движок. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/materializedview/) diff --git a/docs/ru/engines/table_engines/special/merge.md b/docs/ru/engines/table_engines/special/merge.md deleted file mode 100644 index 65dd8dc7a2c..00000000000 --- a/docs/ru/engines/table_engines/special/merge.md +++ /dev/null @@ -1,63 +0,0 @@ -# Merge {#merge} - -Движок `Merge` (не путайте с движком `MergeTree`) не хранит данные самостоятельно, а позволяет читать одновременно из произвольного количества других таблиц. -Чтение автоматически распараллеливается. Запись в таблицу не поддерживается. При чтении будут использованы индексы тех таблиц, из которых реально идёт чтение, если они существуют. -Движок `Merge` принимает параметры: имя базы данных и регулярное выражение для таблиц. - -Пример: - -``` sql -Merge(hits, '^WatchLog') -``` - -Данные будут читаться из таблиц в базе `hits`, имена которых соответствуют регулярному выражению ‘`^WatchLog`’. - -Вместо имени базы данных может использоваться константное выражение, возвращающее строку. Например, `currentDatabase()`. - -Регулярные выражения — [re2](https://github.com/google/re2) (поддерживает подмножество PCRE), регистрозависимые. -Смотрите замечание об экранировании в регулярных выражениях в разделе «match». - -При выборе таблиц для чтения, сама `Merge`-таблица не будет выбрана, даже если попадает под регулярное выражение, чтобы не возникло циклов. -Впрочем, вы можете создать две `Merge`-таблицы, которые будут пытаться бесконечно читать данные друг друга, но делать этого не нужно. - -Типичный способ использования движка `Merge` — работа с большим количеством таблиц типа `TinyLog`, как с одной. - -Пример 2: - -Пусть есть старая таблица `WatchLog_old`. Необходимо изменить партиционирование без перемещения данных в новую таблицу `WatchLog_new`. При этом в выборке должны участвовать данные обеих таблиц. - -``` sql -CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree(date, (UserId, EventType), 8192); -INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - -CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; -INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - -CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - -SELECT * -FROM WatchLog -``` - -``` text -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-01 │ 1 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-02 │ 2 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -``` - -## Виртуальные столбцы {#virtualnye-stolbtsy} - -- `_table` — содержит имя таблицы, из которой данные были прочитаны. Тип — [String](../../../engines/table_engines/special/merge.md). - - В секции `WHERE/PREWHERE` можно установить константное условие на столбец `_table` (например, `WHERE _table='xyz'`). В этом случае операции чтения выполняются только для тех таблиц, для которых выполняется условие на значение `_table`, таким образом, столбец `_table` работает как индекс. - -**Смотрите также** - -- [Виртуальные столбцы](index.md#table_engines-virtual_columns) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/table_engines/merge/) diff --git a/docs/ru/faq/general.md b/docs/ru/faq/general.md index 5bfe8ea8f2d..de1e34601f0 100644 --- a/docs/ru/faq/general.md +++ b/docs/ru/faq/general.md @@ -25,7 +25,7 @@ NLS_LANG=RUSSIAN_RUSSIA.UTF8 ### Секция INTO OUTFILE {#sektsiia-into-outfile} -Добавьте секцию [INTO OUTFILE](../sql_reference/statements/select.md#into-outfile-clause) к своему запросу. +Добавьте секцию [INTO OUTFILE](../sql-reference/statements/select.md#into-outfile-clause) к своему запросу. Например: @@ -33,7 +33,7 @@ NLS_LANG=RUSSIAN_RUSSIA.UTF8 SELECT * FROM table INTO OUTFILE 'file' ``` -По умолчанию, для выдачи данных ClickHouse использует формат [TabSeparated](../interfaces/formats.md#tabseparated). Чтобы выбрать [формат данных](../interfaces/formats.md), используйте [секцию FORMAT](../sql_reference/statements/select.md#format-clause). +По умолчанию, для выдачи данных ClickHouse использует формат [TabSeparated](../interfaces/formats.md#tabseparated). Чтобы выбрать [формат данных](../interfaces/formats.md), используйте [секцию FORMAT](../sql-reference/statements/select.md#format-clause). Например: @@ -43,7 +43,7 @@ SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV ### Таблица с движком File {#tablitsa-s-dvizhkom-file} -Смотрите [File](../engines/table_engines/special/file.md). +Смотрите [File](../engines/table-engines/special/file.md). ### Перенаправление в командой строке {#perenapravlenie-v-komandoi-stroke} diff --git a/docs/ru/getting_started/example_datasets/amplab_benchmark.md b/docs/ru/getting-started/example-datasets/amplab-benchmark.md similarity index 100% rename from docs/ru/getting_started/example_datasets/amplab_benchmark.md rename to docs/ru/getting-started/example-datasets/amplab-benchmark.md diff --git a/docs/ru/getting_started/example_datasets/criteo.md b/docs/ru/getting-started/example-datasets/criteo.md similarity index 100% rename from docs/ru/getting_started/example_datasets/criteo.md rename to docs/ru/getting-started/example-datasets/criteo.md diff --git a/docs/ru/getting-started/example-datasets/index.md b/docs/ru/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..c349e369b1d --- /dev/null +++ b/docs/ru/getting-started/example-datasets/index.md @@ -0,0 +1,21 @@ +--- +toc_folder_title: "\u0422\u0435\u0441\u0442\u043E\u0432\u044B\u0435 \u043C\u0430\u0441\ + \u0441\u0438\u0432\u044B \u0434\u0430\u043D\u043D\u044B\u0445" +toc_priority: 12 +toc_title: "\u041E\u0431\u0437\u043E\u0440" +--- + +# Тестовые массивы данных {#testovye-massivy-dannykh} + +Этот раздел описывает как получить тестовые массивы данных и загрузить их в ClickHouse. +Для некоторых тестовых массивов данных также доступны тестовые запросы. + +- [Анонимизированные данные Яндекс.Метрики](metrica.md) +- [Star Schema Benchmark](star-schema.md) +- [WikiStat](wikistat.md) +- [Терабайт логов кликов от Criteo](criteo.md) +- [AMPLab Big Data Benchmark](amplab-benchmark.md) +- [Данные о такси в Нью-Йорке](nyc-taxi.md) +- [OnTime](ontime.md) + +[Оригинальная статья](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/ru/getting_started/example_datasets/metrica.md b/docs/ru/getting-started/example-datasets/metrica.md similarity index 100% rename from docs/ru/getting_started/example_datasets/metrica.md rename to docs/ru/getting-started/example-datasets/metrica.md diff --git a/docs/ru/getting_started/example_datasets/nyc_taxi.md b/docs/ru/getting-started/example-datasets/nyc-taxi.md similarity index 100% rename from docs/ru/getting_started/example_datasets/nyc_taxi.md rename to docs/ru/getting-started/example-datasets/nyc-taxi.md diff --git a/docs/ru/getting_started/example_datasets/ontime.md b/docs/ru/getting-started/example-datasets/ontime.md similarity index 100% rename from docs/ru/getting_started/example_datasets/ontime.md rename to docs/ru/getting-started/example-datasets/ontime.md diff --git a/docs/ru/getting_started/example_datasets/star_schema.md b/docs/ru/getting-started/example-datasets/star-schema.md similarity index 100% rename from docs/ru/getting_started/example_datasets/star_schema.md rename to docs/ru/getting-started/example-datasets/star-schema.md diff --git a/docs/ru/getting_started/example_datasets/wikistat.md b/docs/ru/getting-started/example-datasets/wikistat.md similarity index 100% rename from docs/ru/getting_started/example_datasets/wikistat.md rename to docs/ru/getting-started/example-datasets/wikistat.md diff --git a/docs/ru/getting-started/index.md b/docs/ru/getting-started/index.md new file mode 100644 index 00000000000..b2b292c4725 --- /dev/null +++ b/docs/ru/getting-started/index.md @@ -0,0 +1,18 @@ +--- +toc_folder_title: "\u041D\u0430\u0447\u0430\u043B\u043E \u0440\u0430\u0431\u043E\u0442\ + \u044B" +toc_hidden: true +toc_priority: 8 +toc_title: hidden +--- + +# Начало работы {#nachalo-raboty} + +Если вы новичок в ClickHouse и хотите вживую оценить его производительность, прежде всего нужно пройти через [процесс установки](install.md). + +После этого можно выбрать один из следующих вариантов: + +- [Пройти подробное руководство для начинающих](tutorial.md) +- [Поэкспериментировать с тестовыми наборами данных](example-datasets/ontime.md) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/getting_started/) diff --git a/docs/ru/getting-started/install.md b/docs/ru/getting-started/install.md new file mode 100644 index 00000000000..fb36b9c87ec --- /dev/null +++ b/docs/ru/getting-started/install.md @@ -0,0 +1,159 @@ +# Установка {#ustanovka} + +## Системные требования {#sistemnye-trebovaniia} + +ClickHouse может работать на любой операционной системе Linux, FreeBSD или Mac OS X с архитектурой процессора x86\_64, AArch64 или PowerPC64LE. + +Предварительно собранные пакеты компилируются для x86\_64 и используют набор инструкций SSE 4.2, поэтому, если не указано иное, его поддержка в используемом процессоре, становится дополнительным требованием к системе. Вот команда, чтобы проверить, поддерживает ли текущий процессор SSE 4.2: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +Чтобы запустить ClickHouse на процессорах, которые не поддерживают SSE 4.2, либо имеют архитектуру AArch64 или PowerPC64LE, необходимо самостоятельно [собрать ClickHouse из исходного кода](#from-sources) с соответствующими настройками конфигурации. + +## Доступные варианты установки {#dostupnye-varianty-ustanovki} + +### Из DEB пакетов {#install-from-deb-packages} + +Яндекс рекомендует использовать официальные скомпилированные `deb` пакеты для Debian или Ubuntu. Для установки пакетов выполните: + +``` bash +{% include 'install/deb.sh' %} +``` + +Также эти пакеты можно скачать и установить вручную отсюда: https://repo.clickhouse.tech/deb/stable/main/. + +Если вы хотите использовать наиболее свежую версию, замените `stable` на `testing` (рекомендуется для тестовых окружений). + +### Из RPM пакетов {#from-rpm-packages} + +Команда ClickHouse в Яндексе рекомендует использовать официальные предкомпилированные `rpm` пакеты для CentOS, RedHad и всех остальных дистрибутивов Linux, основанных на rpm. + +Сначала нужно подключить официальный репозиторий: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.yandex.ru/clickhouse/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.yandex.ru/clickhouse/rpm/stable/x86_64 +``` + +Для использования наиболее свежих версий нужно заменить `stable` на `testing` (рекомендуется для тестовых окружений). + +Для, собственно, установки пакетов необходимо выполнить следующие команды: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +Также есть возможность установить пакеты вручную, скачав отсюда: https://repo.yandex.ru/clickhouse/rpm/stable/x86\_64. + +### Из Tgz архивов {#from-tgz-archives} + +Команда ClickHouse в Яндексе рекомендует использовать предкомпилированные бинарники из `tgz` архивов для всех дистрибутивов, где невозможна установка `deb` и `rpm` пакетов. + +Интересующую версию архивов можно скачать вручную с помощью `curl` или `wget` из репозитория https://repo.yandex.ru/clickhouse/tgz/. +После этого архивы нужно распаковать и воспользоваться скриптами установки. Пример установки самой свежей версии: + +``` bash +export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` +curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-common-static-$LATEST_VERSION.tgz +curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz +curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-server-$LATEST_VERSION.tgz +curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-client-$LATEST_VERSION.tgz + +tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz +sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz +sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-server-$LATEST_VERSION.tgz +sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh +sudo /etc/init.d/clickhouse-server start + +tar -xzvf clickhouse-client-$LATEST_VERSION.tgz +sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh +``` + +Для production окружений рекомендуется использовать последнюю `stable`-версию. Её номер также можно найти на github с на вкладке https://github.com/ClickHouse/ClickHouse/tags c постфиксом `-stable`. + +### Из Docker образа {#from-docker-image} + +Для запуска ClickHouse в Docker нужно следовать инструкции на [Docker Hub](https://hub.docker.com/r/yandex/clickhouse-server/). Внутри образов используются официальные `deb` пакеты. + +### Из исходного кода {#from-sources} + +Для компиляции ClickHouse вручную, используйте инструкцию для [Linux](../development/build.md) или [Mac OS X](../development/build-osx.md). + +Можно скомпилировать пакеты и установить их, либо использовать программы без установки пакетов. Также при ручой сборке можно отключить необходимость поддержки набора инструкций SSE 4.2 или собрать под процессоры архитектуры AArch64. + + Client: programs/clickhouse-client + Server: programs/clickhouse-server + +Для работы собранного вручную сервера необходимо создать директории для данных и метаданных, а также сделать их `chown` для желаемого пользователя. Пути к этим директориям могут быть изменены в конфигурационном файле сервера (src/programs/server/config.xml), по умолчанию используются следующие: + + /opt/clickhouse/data/default/ + /opt/clickhouse/metadata/default/ + +На Gentoo для установки ClickHouse из исходного кода можно использовать просто `emerge clickhouse`. + +## Запуск {#zapusk} + +Для запуска сервера в качестве демона, выполните: + +``` bash +$ sudo service clickhouse-server start +``` + +Смотрите логи в директории `/var/log/clickhouse-server/`. + +Если сервер не стартует, проверьте корректность конфигурации в файле `/etc/clickhouse-server/config.xml` + +Также можно запустить сервер вручную из консоли: + +``` bash +$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +При этом, лог будет выводиться в консоль, что удобно для разработки. +Если конфигурационный файл лежит в текущей директории, то указывать параметр `--config-file` не требуется, по умолчанию будет использован файл `./config.xml`. + +После запуска сервера, соединиться с ним можно с помощью клиента командной строки: + +``` bash +$ clickhouse-client +``` + +По умолчанию он соединяется с localhost:9000, от имени пользователя `default` без пароля. Также клиент может быть использован для соединения с удалённым сервером с помощью аргумента `--host`. + +Терминал должен использовать кодировку UTF-8. + +Более подробная информация о клиенте располагается в разделе [«Клиент командной строки»](../interfaces/cli.md). + +Пример проверки работоспособности системы: + +``` bash +$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**Поздравляем, система работает!** + +Для дальнейших экспериментов можно попробовать загрузить один из тестовых наборов данных или пройти [пошаговое руководство для начинающих](https://clickhouse.tech/tutorial.html). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/getting_started/install/) diff --git a/docs/ru/getting_started/playground.md b/docs/ru/getting-started/playground.md similarity index 100% rename from docs/ru/getting_started/playground.md rename to docs/ru/getting-started/playground.md diff --git a/docs/ru/getting-started/tutorial.md b/docs/ru/getting-started/tutorial.md new file mode 120000 index 00000000000..7af416c9878 --- /dev/null +++ b/docs/ru/getting-started/tutorial.md @@ -0,0 +1 @@ +../../en/getting-started/tutorial.md \ No newline at end of file diff --git a/docs/ru/getting_started/example_datasets/index.md b/docs/ru/getting_started/example_datasets/index.md deleted file mode 100644 index 5fbe0843f4b..00000000000 --- a/docs/ru/getting_started/example_datasets/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -toc_folder_title: Тестовые массивы данных -toc_priority: 12 -toc_title: Обзор ---- -# Тестовые массивы данных - -Этот раздел описывает как получить тестовые массивы данных и загрузить их в ClickHouse. -Для некоторых тестовых массивов данных также доступны тестовые запросы. - -* [Анонимизированные данные Яндекс.Метрики](metrica.md) -* [Star Schema Benchmark](star_schema.md) -* [WikiStat](wikistat.md) -* [Терабайт логов кликов от Criteo](criteo.md) -* [AMPLab Big Data Benchmark](amplab_benchmark.md) -* [Данные о такси в Нью-Йорке](nyc_taxi.md) -* [OnTime](ontime.md) - -[Оригинальная статья](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/ru/getting_started/index.md b/docs/ru/getting_started/index.md deleted file mode 100644 index 7711d6b94ee..00000000000 --- a/docs/ru/getting_started/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -toc_folder_title: Начало работы -toc_hidden: true -toc_priority: 8 -toc_title: hidden ---- - -# Начало работы {#nachalo-raboty} - -Если вы новичок в ClickHouse и хотите вживую оценить его производительность, прежде всего нужно пройти через [процесс установки](install.md). - -После этого можно выбрать один из следующих вариантов: - -- [Пройти подробное руководство для начинающих](tutorial.md) -- [Поэкспериментировать с тестовыми наборами данных](example_datasets/ontime.md) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/getting_started/) diff --git a/docs/ru/getting_started/install.md b/docs/ru/getting_started/install.md deleted file mode 100644 index cd571156d03..00000000000 --- a/docs/ru/getting_started/install.md +++ /dev/null @@ -1,168 +0,0 @@ -# Установка {#ustanovka} - -## Системные требования {#sistemnye-trebovaniia} - -ClickHouse может работать на любой операционной системе Linux, FreeBSD или Mac OS X с архитектурой процессора x86\_64, AArch64 или PowerPC64LE. - -Предварительно собранные пакеты компилируются для x86\_64 и используют набор инструкций SSE 4.2, поэтому, если не указано иное, его поддержка в используемом процессоре, становится дополнительным требованием к системе. Вот команда, чтобы проверить, поддерживает ли текущий процессор SSE 4.2: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -Чтобы запустить ClickHouse на процессорах, которые не поддерживают SSE 4.2, либо имеют архитектуру AArch64 или PowerPC64LE, необходимо самостоятельно [собрать ClickHouse из исходного кода](#from-sources) с соответствующими настройками конфигурации. - -## Доступные варианты установки {#dostupnye-varianty-ustanovki} - -### Из DEB пакетов {#install-from-deb-packages} - -Яндекс рекомендует использовать официальные скомпилированные `deb` пакеты для Debian или Ubuntu. - -Чтобы установить официальные пакеты, пропишите репозиторий Яндекса в `/etc/apt/sources.list` или в отдельный файл `/etc/apt/sources.list.d/clickhouse.list`: - - deb http://repo.yandex.ru/clickhouse/deb/stable/ main/ - -Если вы хотите использовать наиболее свежую тестовую, замените `stable` на `testing` (не рекомендуется для production окружений). - -Затем для самой установки пакетов выполните: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -Также эти пакеты можно скачать и установить вручную отсюда: https://repo.yandex.ru/clickhouse/deb/stable/main/. - -### Из RPM пакетов {#from-rpm-packages} - -Команда ClickHouse в Яндексе рекомендует использовать официальные предкомпилированные `rpm` пакеты для CentOS, RedHad и всех остальных дистрибутивов Linux, основанных на rpm. - -Сначала нужно подключить официальный репозиторий: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.yandex.ru/clickhouse/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.yandex.ru/clickhouse/rpm/stable/x86_64 -``` - -Для использования наиболее свежих версий нужно заменить `stable` на `testing` (рекомендуется для тестовых окружений). - -Для, собственно, установки пакетов необходимо выполнить следующие команды: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -Также есть возможность установить пакеты вручную, скачав отсюда: https://repo.yandex.ru/clickhouse/rpm/stable/x86\_64. - -### Из Tgz архивов {#from-tgz-archives} - -Команда ClickHouse в Яндексе рекомендует использовать предкомпилированные бинарники из `tgz` архивов для всех дистрибутивов, где невозможна установка `deb` и `rpm` пакетов. - -Интересующую версию архивов можно скачать вручную с помощью `curl` или `wget` из репозитория https://repo.yandex.ru/clickhouse/tgz/. -После этого архивы нужно распаковать и воспользоваться скриптами установки. Пример установки самой свежей версии: - -``` bash -export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` -curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-common-static-$LATEST_VERSION.tgz -curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz -curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-server-$LATEST_VERSION.tgz -curl -O https://repo.yandex.ru/clickhouse/tgz/clickhouse-client-$LATEST_VERSION.tgz - -tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz -sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz -sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-server-$LATEST_VERSION.tgz -sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh -sudo /etc/init.d/clickhouse-server start - -tar -xzvf clickhouse-client-$LATEST_VERSION.tgz -sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh -``` - -Для production окружений рекомендуется использовать последнюю `stable`-версию. Её номер также можно найти на github с на вкладке https://github.com/ClickHouse/ClickHouse/tags c постфиксом `-stable`. - -### Из Docker образа {#from-docker-image} - -Для запуска ClickHouse в Docker нужно следовать инструкции на [Docker Hub](https://hub.docker.com/r/yandex/clickhouse-server/). Внутри образов используются официальные `deb` пакеты. - -### Из исходного кода {#from-sources} - -Для компиляции ClickHouse вручную, используйте инструкцию для [Linux](../development/build.md) или [Mac OS X](../development/build_osx.md). - -Можно скомпилировать пакеты и установить их, либо использовать программы без установки пакетов. Также при ручой сборке можно отключить необходимость поддержки набора инструкций SSE 4.2 или собрать под процессоры архитектуры AArch64. - - Client: programs/clickhouse-client - Server: programs/clickhouse-server - -Для работы собранного вручную сервера необходимо создать директории для данных и метаданных, а также сделать их `chown` для желаемого пользователя. Пути к этим директориям могут быть изменены в конфигурационном файле сервера (src/programs/server/config.xml), по умолчанию используются следующие: - - /opt/clickhouse/data/default/ - /opt/clickhouse/metadata/default/ - -На Gentoo для установки ClickHouse из исходного кода можно использовать просто `emerge clickhouse`. - -## Запуск {#zapusk} - -Для запуска сервера в качестве демона, выполните: - -``` bash -$ sudo service clickhouse-server start -``` - -Смотрите логи в директории `/var/log/clickhouse-server/`. - -Если сервер не стартует, проверьте корректность конфигурации в файле `/etc/clickhouse-server/config.xml` - -Также можно запустить сервер вручную из консоли: - -``` bash -$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -При этом, лог будет выводиться в консоль, что удобно для разработки. -Если конфигурационный файл лежит в текущей директории, то указывать параметр `--config-file` не требуется, по умолчанию будет использован файл `./config.xml`. - -После запуска сервера, соединиться с ним можно с помощью клиента командной строки: - -``` bash -$ clickhouse-client -``` - -По умолчанию он соединяется с localhost:9000, от имени пользователя `default` без пароля. Также клиент может быть использован для соединения с удалённым сервером с помощью аргумента `--host`. - -Терминал должен использовать кодировку UTF-8. - -Более подробная информация о клиенте располагается в разделе [«Клиент командной строки»](../interfaces/cli.md). - -Пример проверки работоспособности системы: - -``` bash -$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**Поздравляем, система работает!** - -Для дальнейших экспериментов можно попробовать загрузить один из тестовых наборов данных или пройти [пошаговое руководство для начинающих](https://clickhouse.tech/tutorial.html). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/getting_started/install/) diff --git a/docs/ru/getting_started/tutorial.md b/docs/ru/getting_started/tutorial.md deleted file mode 120000 index 8bc40816ab2..00000000000 --- a/docs/ru/getting_started/tutorial.md +++ /dev/null @@ -1 +0,0 @@ -../../en/getting_started/tutorial.md \ No newline at end of file diff --git a/docs/ru/guides/apply-catboost-model.md b/docs/ru/guides/apply-catboost-model.md new file mode 100644 index 00000000000..1de8f013db8 --- /dev/null +++ b/docs/ru/guides/apply-catboost-model.md @@ -0,0 +1,230 @@ +# Применение модели CatBoost в ClickHouse {#applying-catboost-model-in-clickhouse} + +[CatBoost](https://catboost.ai) — открытая программная библиотека разработанная компанией [Яндекс](https://yandex.ru/company/) для машинного обучения, которая использует схему градиентного бустинга. + +С помощью этой инструкции вы научитесь применять предобученные модели в ClickHouse: в результате вы запустите вывод модели из SQL. + +Чтобы применить модель CatBoost в ClickHouse: + +1. [Создайте таблицу](#create-table). +2. [Вставьте данные в таблицу](#insert-data-to-table). +3. [Интегрируйте CatBoost в ClickHouse](#integrate-catboost-into-clickhouse) (Опциональный шаг). +4. [Запустите вывод модели из SQL](#run-model-inference). + +Подробнее об обучении моделей в CatBoost, см. [Обучение и применение моделей](https://catboost.ai/docs/features/training.html#training). + +## Перед началом работы {#prerequisites} + +Если у вас еще нет [Docker](https://docs.docker.com/install/), установите его. + +!!! note "Примечание" + [Docker](https://www.docker.com) – это программная платформа для создания контейнеров, которые изолируют установку CatBoost и ClickHouse от остальной части системы. + +Перед применением модели CatBoost: + +**1.** Скачайте [Docker-образ](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) из реестра: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +Данный Docker-образ содержит все необходимое для запуска CatBoost и ClickHouse: код, среду выполнения, библиотеки, переменные окружения и файлы конфигурации. + +**2.** Проверьте, что Docker-образ успешно скачался: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** Запустите Docker-контейнер основанный на данном образе: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. Создайте таблицу {#create-table} + +Чтобы создать таблицу для обучающей выборки: + +**1.** Запустите клиент ClickHouse: + +``` bash +$ clickhouse client +``` + +!!! note "Примечание" + Сервер ClickHouse уже запущен внутри Docker-контейнера. + +**2.** Создайте таблицу в ClickHouse с помощью следующей команды: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** Выйдите из клиента ClickHouse: + +``` sql +:) exit +``` + +## 2. Вставьте данные в таблицу {#insert-data-to-table} + +Чтобы вставить данные: + +**1.** Выполните следующую команду: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** Запустите клиент ClickHouse: + +``` bash +$ clickhouse client +``` + +**3.** Проверьте, что данные успешно загрузились: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++---------+ +``` + +## 3. Интегрируйте CatBoost в ClickHouse {#integrate-catboost-into-clickhouse} + +!!! note "Примечание" + **Опциональный шаг.** Docker-образ содержит все необходимое для запуска CatBoost и ClickHouse. + +Чтобы интегрировать CatBoost в ClickHouse: + +**1.** Создайте библиотеку для оценки модели. + +Наиболее быстрый способ оценить модель CatBoost — это скомпилировать библиотеку `libcatboostmodel.`. Подробнее о том, как скомпилировать библиотеку, читайте в [документации CatBoost](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** Создайте в любом месте новую директорию с произвольным названием, например `data` и поместите в нее созданную библиотеку. Docker-образ уже содержит библиотеку `data/libcatboostmodel.so`. + +**3.** Создайте в любом месте новую директорию для конфигурации модели с произвольным названием, например `models`. + +**4.** Создайте файл конфигурации модели с произвольным названием, например `models/amazon_model.xml`. + +**5.** Опишите конфигурацию модели: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** Добавьте в конфигурацию ClickHouse путь к CatBoost и конфигурации модели: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. Запустите вывод модели из SQL {#run-model-inference} + +Для тестирования модели запустите клиент ClickHouse `$ clickhouse client`. + +Проверьте, что модель работает: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Примечание" + Функция [modelEvaluate](../sql-reference/functions/other-functions.md#function-modelevaluate) возвращает кортежи (tuple) с исходными прогнозами по классам для моделей с несколькими классами. + +Спрогнозируйте вероятность: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Примечание" + Подробнее про функцию [exp()](../sql-reference/functions/math-functions.md). + +Посчитайте логистическую функцию потерь (LogLoss) на всей выборке: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "Примечание" + Подробнее про функции [avg()](../sql-reference/aggregate-functions/reference.md#agg_function-avg), [log()](../sql-reference/functions/math-functions.md). diff --git a/docs/ru/guides/apply_catboost_model.md b/docs/ru/guides/apply_catboost_model.md deleted file mode 100644 index 2f94753b7f2..00000000000 --- a/docs/ru/guides/apply_catboost_model.md +++ /dev/null @@ -1,230 +0,0 @@ -# Применение модели CatBoost в ClickHouse {#applying-catboost-model-in-clickhouse} - -[CatBoost](https://catboost.ai) — открытая программная библиотека разработанная компанией [Яндекс](https://yandex.ru/company/) для машинного обучения, которая использует схему градиентного бустинга. - -С помощью этой инструкции вы научитесь применять предобученные модели в ClickHouse: в результате вы запустите вывод модели из SQL. - -Чтобы применить модель CatBoost в ClickHouse: - -1. [Создайте таблицу](#create-table). -2. [Вставьте данные в таблицу](#insert-data-to-table). -3. [Интегрируйте CatBoost в ClickHouse](#integrate-catboost-into-clickhouse) (Опциональный шаг). -4. [Запустите вывод модели из SQL](#run-model-inference). - -Подробнее об обучении моделей в CatBoost, см. [Обучение и применение моделей](https://catboost.ai/docs/features/training.html#training). - -## Перед началом работы {#prerequisites} - -Если у вас еще нет [Docker](https://docs.docker.com/install/), установите его. - -!!! note "Примечание" - [Docker](https://www.docker.com) – это программная платформа для создания контейнеров, которые изолируют установку CatBoost и ClickHouse от остальной части системы. - -Перед применением модели CatBoost: - -**1.** Скачайте [Docker-образ](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) из реестра: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -Данный Docker-образ содержит все необходимое для запуска CatBoost и ClickHouse: код, среду выполнения, библиотеки, переменные окружения и файлы конфигурации. - -**2.** Проверьте, что Docker-образ успешно скачался: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** Запустите Docker-контейнер основанный на данном образе: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. Создайте таблицу {#create-table} - -Чтобы создать таблицу для обучающей выборки: - -**1.** Запустите клиент ClickHouse: - -``` bash -$ clickhouse client -``` - -!!! note "Примечание" - Сервер ClickHouse уже запущен внутри Docker-контейнера. - -**2.** Создайте таблицу в ClickHouse с помощью следующей команды: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** Выйдите из клиента ClickHouse: - -``` sql -:) exit -``` - -## 2. Вставьте данные в таблицу {#insert-data-to-table} - -Чтобы вставить данные: - -**1.** Выполните следующую команду: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** Запустите клиент ClickHouse: - -``` bash -$ clickhouse client -``` - -**3.** Проверьте, что данные успешно загрузились: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+---------+ -``` - -## 3. Интегрируйте CatBoost в ClickHouse {#integrate-catboost-into-clickhouse} - -!!! note "Примечание" - **Опциональный шаг.** Docker-образ содержит все необходимое для запуска CatBoost и ClickHouse. - -Чтобы интегрировать CatBoost в ClickHouse: - -**1.** Создайте библиотеку для оценки модели. - -Наиболее быстрый способ оценить модель CatBoost — это скомпилировать библиотеку `libcatboostmodel.`. Подробнее о том, как скомпилировать библиотеку, читайте в [документации CatBoost](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** Создайте в любом месте новую директорию с произвольным названием, например `data` и поместите в нее созданную библиотеку. Docker-образ уже содержит библиотеку `data/libcatboostmodel.so`. - -**3.** Создайте в любом месте новую директорию для конфигурации модели с произвольным названием, например `models`. - -**4.** Создайте файл конфигурации модели с произвольным названием, например `models/amazon_model.xml`. - -**5.** Опишите конфигурацию модели: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** Добавьте в конфигурацию ClickHouse путь к CatBoost и конфигурации модели: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. Запустите вывод модели из SQL {#run-model-inference} - -Для тестирования модели запустите клиент ClickHouse `$ clickhouse client`. - -Проверьте, что модель работает: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Примечание" - Функция [modelEvaluate](../sql_reference/functions/other_functions.md#function-modelevaluate) возвращает кортежи (tuple) с исходными прогнозами по классам для моделей с несколькими классами. - -Спрогнозируйте вероятность: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Примечание" - Подробнее про функцию [exp()](../sql_reference/functions/math_functions.md). - -Посчитайте логистическую функцию потерь (LogLoss) на всей выборке: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "Примечание" - Подробнее про функции [avg()](../sql_reference/aggregate_functions/reference.md#agg_function-avg), [log()](../sql_reference/functions/math_functions.md). diff --git a/docs/ru/guides/index.md b/docs/ru/guides/index.md index 2ba84e9afc2..2c38de275a7 100644 --- a/docs/ru/guides/index.md +++ b/docs/ru/guides/index.md @@ -1,11 +1,11 @@ --- -toc_folder_title: Руководства +toc_folder_title: "\u0420\u0443\u043A\u043E\u0432\u043E\u0434\u0441\u0442\u0432\u0430" toc_priority: 38 -toc_title: Обзор +toc_title: "\u041E\u0431\u0437\u043E\u0440" --- # Руководства {#rukovodstva} Подробные пошаговые инструкции, которые помогут вам решать различные задачи с помощью ClickHouse. -- [Применение модели CatBoost в ClickHouse](apply_catboost_model.md) +- [Применение модели CatBoost в ClickHouse](apply-catboost-model.md) diff --git a/docs/ru/images/column_oriented.gif b/docs/ru/images/column-oriented.gif similarity index 100% rename from docs/ru/images/column_oriented.gif rename to docs/ru/images/column-oriented.gif diff --git a/docs/ru/images/logo.svg b/docs/ru/images/logo.svg index b5ab923ff65..17da9417e2d 100644 --- a/docs/ru/images/logo.svg +++ b/docs/ru/images/logo.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/docs/ru/images/row_oriented.gif b/docs/ru/images/row-oriented.gif similarity index 100% rename from docs/ru/images/row_oriented.gif rename to docs/ru/images/row-oriented.gif diff --git a/docs/ru/index.md b/docs/ru/index.md index e537c240cb6..a7aa80b91d2 100644 --- a/docs/ru/index.md +++ b/docs/ru/index.md @@ -1,6 +1,6 @@ --- toc_priority: 0 -toc_title: Обзор +toc_title: "\u041E\u0431\u0437\u043E\u0440" --- # Что такое ClickHouse {#chto-takoe-clickhouse} @@ -66,11 +66,11 @@ ClickHouse - столбцовая система управления базам **Строковые СУБД** -![Строковые](images/row_oriented.gif#) +![Строковые](images/row-oriented.gif#) **Столбцовые СУБД** -![Столбцовые](images/column_oriented.gif#) +![Столбцовые](images/column-oriented.gif#) Видите разницу? diff --git a/docs/ru/interfaces/cli.md b/docs/ru/interfaces/cli.md index b76e96cc1dc..816b5962280 100644 --- a/docs/ru/interfaces/cli.md +++ b/docs/ru/interfaces/cli.md @@ -2,7 +2,7 @@ ClickHouse предоставляет собственный клиент командной строки: `clickhouse-client`. Клиент поддерживает запуск с аргументами командной строки и с конфигурационными файлами. Подробнее читайте в разделе [Конфигурирование](#interfaces_cli_configuration). -Клиент [устанавливается](../getting_started/index.md) пакетом `clickhouse-client` и запускается командой `clickhouse-client`. +Клиент [устанавливается](../getting-started/index.md) пакетом `clickhouse-client` и запускается командой `clickhouse-client`. ``` bash $ clickhouse-client @@ -88,7 +88,7 @@ clickhouse-client --param_parName="[1, 2]" -q "SELECT * FROM table WHERE a = {p ``` - `name` — идентификатор подстановки. В консольном клиенте его следует использовать как часть имени параметра `--param_ = value`. -- `data type` — [тип данных](../sql_reference/data_types/index.md) значения. Например, структура данных `(integer, ('string', integer))` может иметь тип данных `Tuple(UInt8, Tuple(String, UInt8))` ([целочисленный](../sql_reference/data_types/int_uint.md) тип может быть и другим). +- `data type` — [тип данных](../sql-reference/data-types/index.md) значения. Например, структура данных `(integer, ('string', integer))` может иметь тип данных `Tuple(UInt8, Tuple(String, UInt8))` ([целочисленный](../sql-reference/data-types/int-uint.md) тип может быть и другим). #### Пример {#primer} diff --git a/docs/ru/interfaces/formats.md b/docs/ru/interfaces/formats.md index b1707a55193..75e87a34f88 100644 --- a/docs/ru/interfaces/formats.md +++ b/docs/ru/interfaces/formats.md @@ -99,9 +99,9 @@ world Массивы форматируются в виде списка значений через запятую в квадратных скобках. Элементы массива - числа форматируются как обычно, а даты, даты-с-временем и строки - в одинарных кавычках с такими же правилами экранирования, как указано выше. -[NULL](../sql_reference/syntax.md) форматируется как `\N`. +[NULL](../sql-reference/syntax.md) форматируется как `\N`. -Каждый элемент структуры типа [Nested](../sql_reference/data_types/nested_data_structures/nested.md) представляется как отдельный массив. +Каждый элемент структуры типа [Nested](../sql-reference/data-types/nested-data-structures/nested.md) представляется как отдельный массив. Например: @@ -302,7 +302,7 @@ SearchPhrase=дизайн штор count()=1064 SearchPhrase=баку count()=1000 ``` -[NULL](../sql_reference/syntax.md) форматируется как `\N`. +[NULL](../sql-reference/syntax.md) форматируется как `\N`. ``` sql SELECT * FROM t_null FORMAT TSKV @@ -432,7 +432,7 @@ JSON совместим с JavaScript. Для этого, дополнитель Этот формат подходит только для вывода результата выполнения запроса, но не для парсинга (приёма данных для вставки в таблицу). -ClickHouse поддерживает [NULL](../sql_reference/syntax.md), который при выводе JSON будет отображен как `null`. +ClickHouse поддерживает [NULL](../sql-reference/syntax.md), который при выводе JSON будет отображен как `null`. Смотрите также формат [JSONEachRow](#jsoneachrow) . @@ -507,7 +507,7 @@ ClickHouse игнорирует пробелы между элементами **Обработка пропущенных значений** -ClickHouse заменяет опущенные значения значениями по умолчанию для соответствующих [data types](../sql_reference/data_types/index.md). +ClickHouse заменяет опущенные значения значениями по умолчанию для соответствующих [data types](../sql-reference/data-types/index.md). Если указано `DEFAULT expr`, то ClickHouse использует различные правила подстановки в зависимости от настройки [input\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields). @@ -552,7 +552,7 @@ CREATE TABLE IF NOT EXISTS example_table ### Использование вложенных структур {#jsoneachrow-nested} -Если у вас есть таблица со столбцами типа [Nested](../sql_reference/data_types/nested_data_structures/nested.md), то в неё можно вставить данные из JSON-документа с такой же структурой. Функциональность включается настройкой [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json). +Если у вас есть таблица со столбцами типа [Nested](../sql-reference/data-types/nested-data-structures/nested.md), то в неё можно вставить данные из JSON-документа с такой же структурой. Функциональность включается настройкой [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json). Например, рассмотрим следующую таблицу: @@ -626,7 +626,7 @@ SELECT * FROM json_each_row_nested Рисуется полная сетка таблицы и, таким образом, каждая строчка занимает две строки в терминале. Каждый блок результата выводится в виде отдельной таблицы. Это нужно, чтобы можно было выводить блоки без буферизации результата (буферизация потребовалась бы, чтобы заранее вычислить видимую ширину всех значений.) -[NULL](../sql_reference/syntax.md) выводится как `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) выводится как `ᴺᵁᴸᴸ`. ``` sql SELECT * FROM t_null @@ -728,7 +728,7 @@ FixedString представлены просто как последовате Array представлены как длина в формате varint (unsigned [LEB128](https://en.wikipedia.org/wiki/LEB128)), а затем элементы массива, подряд. -Для поддержки [NULL](../sql_reference/syntax.md#null-literal) перед каждым значением типа [Nullable](../sql_reference/data_types/nullable.md) следует байт содержащий 1 или 0. Если байт 1, то значение равно NULL, и этот байт интерпретируется как отдельное значение (т.е. после него следует значение следующего поля). Если байт 0, то после байта следует значение поля (не равно NULL). +Для поддержки [NULL](../sql-reference/syntax.md#null-literal) перед каждым значением типа [Nullable](../sql-reference/data-types/nullable.md) следует байт содержащий 1 или 0. Если байт 1, то значение равно NULL, и этот байт интерпретируется как отдельное значение (т.е. после него следует значение следующего поля). Если байт 0, то после байта следует значение поля (не равно NULL). ## RowBinaryWithNamesAndTypes {#rowbinarywithnamesandtypes} @@ -740,7 +740,7 @@ Array представлены как длина в формате varint (unsig ## Values {#data-format-values} -Выводит каждую строку в скобках. Строки разделены запятыми. После последней строки запятой нет. Значения внутри скобок также разделены запятыми. Числа выводятся в десятичном виде без кавычек. Массивы выводятся в квадратных скобках. Строки, даты, даты-с-временем выводятся в кавычках. Правила экранирования и особенности парсинга аналогичны формату [TabSeparated](#tabseparated). При форматировании, лишние пробелы не ставятся, а при парсинге - допустимы и пропускаются (за исключением пробелов внутри значений типа массив, которые недопустимы). [NULL](../sql_reference/syntax.md) представляется как `NULL`. +Выводит каждую строку в скобках. Строки разделены запятыми. После последней строки запятой нет. Значения внутри скобок также разделены запятыми. Числа выводятся в десятичном виде без кавычек. Массивы выводятся в квадратных скобках. Строки, даты, даты-с-временем выводятся в кавычках. Правила экранирования и особенности парсинга аналогичны формату [TabSeparated](#tabseparated). При форматировании, лишние пробелы не ставятся, а при парсинге - допустимы и пропускаются (за исключением пробелов внутри значений типа массив, которые недопустимы). [NULL](../sql-reference/syntax.md) представляется как `NULL`. Минимальный набор символов, которых вам необходимо экранировать при передаче в Values формате: одинарная кавычка и обратный слеш. @@ -750,7 +750,7 @@ Array представлены как длина в формате varint (unsig Выводит каждое значение на отдельной строке, с указанием имени столбца. Формат удобно использовать для вывода одной-нескольких строк, если каждая строка состоит из большого количества столбцов. -[NULL](../sql_reference/syntax.md) выводится как `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) выводится как `ᴺᵁᴸᴸ`. Пример: @@ -928,7 +928,7 @@ message MessageType { ``` ClickHouse попытается найти столбец с именем `x.y.z` (или `x_y_z`, или `X.y_Z` и т.п.). -Вложенные сообщения удобно использовать в качестве соответствия для [вложенной структуры данных](../sql_reference/data_types/nested_data_structures/nested.md). +Вложенные сообщения удобно использовать в качестве соответствия для [вложенной структуры данных](../sql-reference/data-types/nested-data-structures/nested.md). Значения по умолчанию, определённые в схеме `proto2`, например, @@ -940,7 +940,7 @@ message MessageType { } ``` -не применяются; вместо них используются определенные в таблице [значения по умолчанию](../sql_reference/statements/create.md#create-default-values). +не применяются; вместо них используются определенные в таблице [значения по умолчанию](../sql-reference/statements/create.md#create-default-values). ClickHouse пишет и читает сообщения `Protocol Buffers` в формате `length-delimited`. Это означает, что перед каждым сообщением пишется его длина в формате [varint](https://developers.google.com/protocol-buffers/docs/encoding#varints). См. также [как читать и записывать сообщения Protocol Buffers в формате length-delimited в различных языках программирования](https://cwiki.apache.org/confluence/display/GEODE/Delimiting+Protobuf+Messages). @@ -951,25 +951,25 @@ ClickHouse пишет и читает сообщения `Protocol Buffers` в ### Соответствие типов данных {#sootvetstvie-tipov-dannykh} -Таблица ниже содержит поддерживаемые типы данных и их соответствие [типам данных](../sql_reference/data_types/index.md) ClickHouse для запросов `INSERT` и `SELECT`. +Таблица ниже содержит поддерживаемые типы данных и их соответствие [типам данных](../sql-reference/data-types/index.md) ClickHouse для запросов `INSERT` и `SELECT`. | Тип данных Parquet (`INSERT`) | Тип данных ClickHouse | Тип данных Parquet (`SELECT`) | |-------------------------------|-----------------------------------------------------------|-------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | `UINT8` | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | `INT8` | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | `UINT16` | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | `INT16` | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | `UINT32` | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | `INT32` | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | `UINT64` | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | `INT64` | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | `FLOAT` | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | `DOUBLE` | -| `DATE32` | [Date](../sql_reference/data_types/date.md) | `UINT16` | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | `UINT32` | -| `STRING`, `BINARY` | [String](../sql_reference/data_types/string.md) | `STRING` | -| — | [FixedString](../sql_reference/data_types/fixedstring.md) | `STRING` | -| `DECIMAL` | [Decimal](../sql_reference/data_types/decimal.md) | `DECIMAL` | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | `UINT8` | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | `INT8` | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | `UINT16` | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | `INT16` | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | `UINT32` | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | `INT32` | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | `UINT64` | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | `INT64` | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | `FLOAT` | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | `DOUBLE` | +| `DATE32` | [Date](../sql-reference/data-types/date.md) | `UINT16` | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | `UINT32` | +| `STRING`, `BINARY` | [String](../sql-reference/data-types/string.md) | `STRING` | +| — | [FixedString](../sql-reference/data-types/fixedstring.md) | `STRING` | +| `DECIMAL` | [Decimal](../sql-reference/data-types/decimal.md) | `DECIMAL` | ClickHouse поддерживает настраиваемую точность для формата `Decimal`. При обработке запроса `INSERT`, ClickHouse обрабатывает тип данных Parquet `DECIMAL` как `Decimal128`. @@ -991,7 +991,7 @@ $ cat {filename} | clickhouse-client --query="INSERT INTO {some_table} FORMAT Pa $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_file.pq} ``` -Для обмена данными с экосистемой Hadoop можно использовать движки таблиц [HDFS](../engines/table_engines/integrations/hdfs.md). +Для обмена данными с экосистемой Hadoop можно использовать движки таблиц [HDFS](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} @@ -999,24 +999,24 @@ $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_ ### Соответствие типов данных {#sootvetstvie-tipov-dannykh-1} -Таблица показывает поддержанные типы данных и их соответствие [типам данных](../sql_reference/data_types/index.md) ClickHouse для запросов `INSERT`. +Таблица показывает поддержанные типы данных и их соответствие [типам данных](../sql-reference/data-types/index.md) ClickHouse для запросов `INSERT`. | Тип данных ORC (`INSERT`) | Тип данных ClickHouse | |---------------------------|-----------------------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | -| `DATE32` | [Date](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [String](../sql_reference/data_types/string.md) | -| `DECIMAL` | [Decimal](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | +| `DATE32` | [Date](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [String](../sql-reference/data-types/string.md) | +| `DECIMAL` | [Decimal](../sql-reference/data-types/decimal.md) | ClickHouse поддерживает настраиваемую точность для формата `Decimal`. При обработке запроса `INSERT`, ClickHouse обрабатывает тип данных Parquet `DECIMAL` как `Decimal128`. @@ -1032,7 +1032,7 @@ ClickHouse поддерживает настраиваемую точность $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -Для обмена данных с Hadoop можно использовать [движок таблиц HDFS](../engines/table_engines/integrations/hdfs.md). +Для обмена данных с Hadoop можно использовать [движок таблиц HDFS](../engines/table-engines/integrations/hdfs.md). ## Схема формата {#formatschema} @@ -1045,6 +1045,6 @@ $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT OR относительно текущей директории на клиенте. Если клиент используется в [batch режиме](../interfaces/cli.md#cli_usage), то в записи схемы допускается только относительный путь, из соображений безопасности. Если для ввода/вывода данных используется [HTTP-интерфейс](../interfaces/http.md), то файл со схемой должен располагаться на сервере в каталоге, -указанном в параметре [format\_schema\_path](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) конфигурации сервера. +указанном в параметре [format\_schema\_path](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) конфигурации сервера. [Оригинальная статья](https://clickhouse.tech/docs/ru/interfaces/formats/) diff --git a/docs/ru/interfaces/http.md b/docs/ru/interfaces/http.md index add57183824..afe38132cc9 100644 --- a/docs/ru/interfaces/http.md +++ b/docs/ru/interfaces/http.md @@ -3,7 +3,7 @@ HTTP интерфейс позволяет использовать ClickHouse на любой платформе, из любого языка программирования. У нас он используется для работы из Java и Perl, а также из shell-скриптов. В других отделах, HTTP интерфейс используется из Perl, Python и Go. HTTP интерфейс более ограничен по сравнению с родным интерфейсом, но является более совместимым. По умолчанию, clickhouse-server слушает HTTP на порту 8123 (это можно изменить в конфиге). -Если запросить GET / без параметров, то вернётся строка заданная с помощью настройки [http\_server\_default\_response](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-http_server_default_response). Значение по умолчанию «Ok.» (с переводом строки на конце). +Если запросить GET / без параметров, то вернётся строка заданная с помощью настройки [http\_server\_default\_response](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-http_server_default_response). Значение по умолчанию «Ok.» (с переводом строки на конце). ``` bash $ curl 'http://localhost:8123/' diff --git a/docs/ru/interfaces/index.md b/docs/ru/interfaces/index.md index be49e640132..ea381c46206 100644 --- a/docs/ru/interfaces/index.md +++ b/docs/ru/interfaces/index.md @@ -1,7 +1,7 @@ --- -toc_folder_title: Интерфейсы +toc_folder_title: "\u0418\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044B" toc_priority: 14 -toc_title: Введение +toc_title: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0435" --- # Интерфейсы {#interfaces} @@ -20,7 +20,7 @@ ClickHouse предоставляет два сетевых интерфейса Существует также широкий спектр сторонних библиотек для работы с ClickHouse: -- [Клиентские библиотеки](third-party/client_libraries.md); +- [Клиентские библиотеки](third-party/client-libraries.md); - [Библиотеки для интеграции](third-party/integrations.md); - [Визуальные интерфейсы](third-party/gui.md). diff --git a/docs/ru/interfaces/mysql.md b/docs/ru/interfaces/mysql.md index d550b430c69..493df82be53 100644 --- a/docs/ru/interfaces/mysql.md +++ b/docs/ru/interfaces/mysql.md @@ -1,6 +1,6 @@ # MySQL-интерфейс {#mysql-interface} -ClickHouse поддерживает взаимодействие по протоколу MySQL. Данная функция включается настройкой [mysql\_port](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) в конфигурационном файле: +ClickHouse поддерживает взаимодействие по протоколу MySQL. Данная функция включается настройкой [mysql\_port](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) в конфигурационном файле: ``` xml 9004 @@ -30,8 +30,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -Для совместимости со всеми клиентами рекомендуется задавать пароль пользователя в конфигурационном файле с помощью двойного хэша [SHA1](../operations/settings/settings_users.md#password_double_sha1_hex). -В случае указания пароля с помощью [SHA256](../operations/settings/settings_users.md#password_sha256_hex) некоторые клиенты не смогут пройти аутентификацию (mysqljs и старые версии стандартного клиента mysql). +Для совместимости со всеми клиентами рекомендуется задавать пароль пользователя в конфигурационном файле с помощью двойного хэша [SHA1](../operations/settings/settings-users.md#password_double_sha1_hex). +В случае указания пароля с помощью [SHA256](../operations/settings/settings-users.md#password_sha256_hex) некоторые клиенты не смогут пройти аутентификацию (mysqljs и старые версии стандартного клиента mysql). Ограничения: diff --git a/docs/ru/interfaces/third-party/client_libraries.md b/docs/ru/interfaces/third-party/client-libraries.md similarity index 100% rename from docs/ru/interfaces/third-party/client_libraries.md rename to docs/ru/interfaces/third-party/client-libraries.md diff --git a/docs/ru/interfaces/third-party/index.md b/docs/ru/interfaces/third-party/index.md index 8e768ad9d8e..db6e4ad0038 100644 --- a/docs/ru/interfaces/third-party/index.md +++ b/docs/ru/interfaces/third-party/index.md @@ -1,5 +1,7 @@ --- -toc_folder_title: От сторонних разработчиков +toc_folder_title: "\u041E\u0442 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0445\ + \ \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A\u043E\u0432" toc_priority: 24 --- + diff --git a/docs/ru/interfaces/third-party/integrations.md b/docs/ru/interfaces/third-party/integrations.md index d16404e2f27..bc4b9f22950 100644 --- a/docs/ru/interfaces/third-party/integrations.md +++ b/docs/ru/interfaces/third-party/integrations.md @@ -38,7 +38,7 @@ - [graphouse](https://github.com/yandex/graphouse) - [carbon-clickhouse](https://github.com/lomik/carbon-clickhouse) + - [graphite-clickhouse](https://github.com/lomik/graphite-clickhouse) - - [graphite-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) - оптимизирует партиции таблиц [\*GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) согласно правилам в [конфигурации rollup](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) + - [graphite-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) - оптимизирует партиции таблиц [\*GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) согласно правилам в [конфигурации rollup](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) - [Grafana](https://grafana.com/) - [clickhouse-grafana](https://github.com/Vertamedia/clickhouse-grafana) - [Prometheus](https://prometheus.io/) @@ -70,7 +70,7 @@ - [sqlalchemy-clickhouse](https://github.com/cloudflare/sqlalchemy-clickhouse) (использует [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm)) - [pandas](https://pandas.pydata.org) - [pandahouse](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -78,7 +78,7 @@ - [RClickhouse](https://github.com/IMSMWU/RClickhouse) (использует [clickhouse-cpp](https://github.com/artpaul/clickhouse-cpp)) - Java - [Hadoop](http://hadoop.apache.org) - - [clickhouse-hdfs-loader](https://github.com/jaykelin/clickhouse-hdfs-loader) (использует [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [clickhouse-hdfs-loader](https://github.com/jaykelin/clickhouse-hdfs-loader) (использует [JDBC](../../sql-reference/table-functions/jdbc.md)) - Scala - [Akka](https://akka.io) - [clickhouse-scala-client](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/ru/introduction/distinctive-features.md b/docs/ru/introduction/distinctive-features.md new file mode 100644 index 00000000000..98dbe6df134 --- /dev/null +++ b/docs/ru/introduction/distinctive-features.md @@ -0,0 +1,71 @@ +# Отличительные возможности ClickHouse {#otlichitelnye-vozmozhnosti-clickhouse} + +## По-настоящему столбцовая СУБД {#po-nastoiashchemu-stolbtsovaia-subd} + +В по-настоящему столбцовой СУБД рядом со значениями не хранится никаких лишних данных. Например, должны поддерживаться значения постоянной длины, чтобы не хранить рядом со значениями типа «число» их длины. Для примера, миллиард значений типа UInt8 должен действительно занимать в несжатом виде около 1GB, иначе это сильно ударит по эффективности использования CPU. Очень важно хранить данные компактно (без «мусора») в том числе в несжатом виде, так как скорость разжатия (использование CPU) зависит, в основном, от объёма несжатых данных. + +Этот пункт пришлось выделить, так как существуют системы, которые могут хранить значения отдельных столбцов по отдельности, но не могут эффективно выполнять аналитические запросы в силу оптимизации под другой сценарий работы. Примеры: HBase, BigTable, Cassandra, HyperTable. В этих системах вы получите пропускную способность в районе сотен тысяч строк в секунду, но не сотен миллионов строк в секунду. + +Также стоит заметить, что ClickHouse является системой управления базами данных, а не одной базой данных. То есть, ClickHouse позволяет создавать таблицы и базы данных в runtime, загружать данные и выполнять запросы без переконфигурирования и перезапуска сервера. + +## Сжатие данных {#szhatie-dannykh} + +Некоторые столбцовые СУБД (InfiniDB CE, MonetDB) не используют сжатие данных. Однако сжатие данных действительно играет одну из ключевых ролей в демонстрации отличной производительности. + +## Хранение данных на диске {#khranenie-dannykh-na-diske} + +Многие столбцовые СУБД (SAP HANA, Google PowerDrill) могут работать только в оперативной памяти. Такой подход стимулирует выделять больший бюджет на оборудование, чем фактически требуется для анализа в реальном времени. ClickHouse спроектирован для работы на обычных жестких дисках, что обеспечивает низкую стоимость хранения на гигабайт данных, но SSD и дополнительная оперативная память тоже полноценно используются, если доступны. + +## Параллельная обработка запроса на многих процессорных ядрах {#parallelnaia-obrabotka-zaprosa-na-mnogikh-protsessornykh-iadrakh} + +Большие запросы естественным образом распараллеливаются, используя все необходимые ресурсы из доступных на сервере. + +## Распределённая обработка запроса на многих серверах {#raspredelionnaia-obrabotka-zaprosa-na-mnogikh-serverakh} + +Почти все перечисленные ранее столбцовые СУБД не поддерживают распределённую обработку запроса. +В ClickHouse данные могут быть расположены на разных шардах. Каждый шард может представлять собой группу реплик, которые используются для отказоустойчивости. Запрос будет выполнен на всех шардах параллельно. Это делается прозрачно для пользователя. + +## Поддержка SQL {#podderzhka-sql} + +ClickHouse поддерживает декларативный язык запросов на основе SQL и во многих случаях совпадающий с SQL стандартом. +Поддерживаются GROUP BY, ORDER BY, подзапросы в секциях FROM, IN, JOIN, а также скалярные подзапросы. +Зависимые подзапросы и оконные функции не поддерживаются. + +## Векторный движок {#vektornyi-dvizhok} + +Данные не только хранятся по столбцам, но и обрабатываются по векторам - кусочкам столбцов. За счёт этого достигается высокая эффективность по CPU. + +## Обновление данных в реальном времени {#obnovlenie-dannykh-v-realnom-vremeni} + +ClickHouse поддерживает таблицы с первичным ключом. Для того, чтобы можно было быстро выполнять запросы по диапазону первичного ключа, данные инкрементально сортируются с помощью merge дерева. За счёт этого, поддерживается постоянное добавление данных в таблицу. Блокировки при добавлении данных отсутствуют. + +## Наличие индекса {#nalichie-indeksa} + +Физическая сортировка данных по первичному ключу позволяет получать данные для конкретных его значений или их диапазонов с низкими задержками - менее десятков миллисекунд. + +## Подходит для онлайн запросов {#podkhodit-dlia-onlain-zaprosov} + +Низкие задержки позволяют не откладывать выполнение запроса и не подготавливать ответ заранее, а выполнять его именно в момент загрузки страницы пользовательского интерфейса. То есть, в режиме онлайн. + +## Поддержка приближённых вычислений {#podderzhka-priblizhionnykh-vychislenii} + +ClickHouse предоставляет различные способы разменять точность вычислений на производительность: + +1. Система содержит агрегатные функции для приближённого вычисления количества различных значений, медианы и квантилей. +2. Поддерживается возможность выполнить запрос на основе части (выборки) данных и получить приближённый результат. При этом, с диска будет считано пропорционально меньше данных. +3. Поддерживается возможность выполнить агрегацию не для всех ключей, а для ограниченного количества первых попавшихся ключей. При выполнении некоторых условий на распределение ключей в данных, это позволяет получить достаточно точный результат с использованием меньшего количества ресурсов. + +## Репликация данных и поддержка целостности {#replikatsiia-dannykh-i-podderzhka-tselostnosti} + +Используется асинхронная multimaster репликация. После записи на любую доступную реплику, данные распространяются на все остальные реплики в фоне. Система поддерживает полную идентичность данных на разных репликах. Восстановление после большинства сбоев осуществляется автоматически, а в сложных случаях — полуавтоматически. При необходимости, можно [включить кворумную запись](../operations/settings/settings.md) данных. + +Подробнее смотрите раздел [Репликация данных](../engines/table-engines/mergetree-family/replication.md). + +## Особенности, которые могут считаться недостатками {#osobennosti-clickhouse-kotorye-mogut-schitatsia-nedostatkami} + +1. Отсутствие полноценных транзакций. +2. Возможность изменять или удалять ранее записанные данные с низкими задержками и высокой частотой запросов не предоставляется. Есть массовое удаление и изменение данных для очистки более не нужного или соответствия [GDPR](https://gdpr-info.eu). +3. Разреженный индекс делает ClickHouse плохо пригодным для точечных чтений одиночных строк по своим + ключам. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/introduction/distinctive_features/) diff --git a/docs/ru/introduction/distinctive_features.md b/docs/ru/introduction/distinctive_features.md deleted file mode 100644 index 079a0667070..00000000000 --- a/docs/ru/introduction/distinctive_features.md +++ /dev/null @@ -1,71 +0,0 @@ -# Отличительные возможности ClickHouse {#otlichitelnye-vozmozhnosti-clickhouse} - -## По-настоящему столбцовая СУБД {#po-nastoiashchemu-stolbtsovaia-subd} - -В по-настоящему столбцовой СУБД рядом со значениями не хранится никаких лишних данных. Например, должны поддерживаться значения постоянной длины, чтобы не хранить рядом со значениями типа «число» их длины. Для примера, миллиард значений типа UInt8 должен действительно занимать в несжатом виде около 1GB, иначе это сильно ударит по эффективности использования CPU. Очень важно хранить данные компактно (без «мусора») в том числе в несжатом виде, так как скорость разжатия (использование CPU) зависит, в основном, от объёма несжатых данных. - -Этот пункт пришлось выделить, так как существуют системы, которые могут хранить значения отдельных столбцов по отдельности, но не могут эффективно выполнять аналитические запросы в силу оптимизации под другой сценарий работы. Примеры: HBase, BigTable, Cassandra, HyperTable. В этих системах вы получите пропускную способность в районе сотен тысяч строк в секунду, но не сотен миллионов строк в секунду. - -Также стоит заметить, что ClickHouse является системой управления базами данных, а не одной базой данных. То есть, ClickHouse позволяет создавать таблицы и базы данных в runtime, загружать данные и выполнять запросы без переконфигурирования и перезапуска сервера. - -## Сжатие данных {#szhatie-dannykh} - -Некоторые столбцовые СУБД (InfiniDB CE, MonetDB) не используют сжатие данных. Однако сжатие данных действительно играет одну из ключевых ролей в демонстрации отличной производительности. - -## Хранение данных на диске {#khranenie-dannykh-na-diske} - -Многие столбцовые СУБД (SAP HANA, Google PowerDrill) могут работать только в оперативной памяти. Такой подход стимулирует выделять больший бюджет на оборудование, чем фактически требуется для анализа в реальном времени. ClickHouse спроектирован для работы на обычных жестких дисках, что обеспечивает низкую стоимость хранения на гигабайт данных, но SSD и дополнительная оперативная память тоже полноценно используются, если доступны. - -## Параллельная обработка запроса на многих процессорных ядрах {#parallelnaia-obrabotka-zaprosa-na-mnogikh-protsessornykh-iadrakh} - -Большие запросы естественным образом распараллеливаются, используя все необходимые ресурсы из доступных на сервере. - -## Распределённая обработка запроса на многих серверах {#raspredelionnaia-obrabotka-zaprosa-na-mnogikh-serverakh} - -Почти все перечисленные ранее столбцовые СУБД не поддерживают распределённую обработку запроса. -В ClickHouse данные могут быть расположены на разных шардах. Каждый шард может представлять собой группу реплик, которые используются для отказоустойчивости. Запрос будет выполнен на всех шардах параллельно. Это делается прозрачно для пользователя. - -## Поддержка SQL {#podderzhka-sql} - -ClickHouse поддерживает декларативный язык запросов на основе SQL и во многих случаях совпадающий с SQL стандартом. -Поддерживаются GROUP BY, ORDER BY, подзапросы в секциях FROM, IN, JOIN, а также скалярные подзапросы. -Зависимые подзапросы и оконные функции не поддерживаются. - -## Векторный движок {#vektornyi-dvizhok} - -Данные не только хранятся по столбцам, но и обрабатываются по векторам - кусочкам столбцов. За счёт этого достигается высокая эффективность по CPU. - -## Обновление данных в реальном времени {#obnovlenie-dannykh-v-realnom-vremeni} - -ClickHouse поддерживает таблицы с первичным ключом. Для того, чтобы можно было быстро выполнять запросы по диапазону первичного ключа, данные инкрементально сортируются с помощью merge дерева. За счёт этого, поддерживается постоянное добавление данных в таблицу. Блокировки при добавлении данных отсутствуют. - -## Наличие индекса {#nalichie-indeksa} - -Физическая сортировка данных по первичному ключу позволяет получать данные для конкретных его значений или их диапазонов с низкими задержками - менее десятков миллисекунд. - -## Подходит для онлайн запросов {#podkhodit-dlia-onlain-zaprosov} - -Низкие задержки позволяют не откладывать выполнение запроса и не подготавливать ответ заранее, а выполнять его именно в момент загрузки страницы пользовательского интерфейса. То есть, в режиме онлайн. - -## Поддержка приближённых вычислений {#podderzhka-priblizhionnykh-vychislenii} - -ClickHouse предоставляет различные способы разменять точность вычислений на производительность: - -1. Система содержит агрегатные функции для приближённого вычисления количества различных значений, медианы и квантилей. -2. Поддерживается возможность выполнить запрос на основе части (выборки) данных и получить приближённый результат. При этом, с диска будет считано пропорционально меньше данных. -3. Поддерживается возможность выполнить агрегацию не для всех ключей, а для ограниченного количества первых попавшихся ключей. При выполнении некоторых условий на распределение ключей в данных, это позволяет получить достаточно точный результат с использованием меньшего количества ресурсов. - -## Репликация данных и поддержка целостности {#replikatsiia-dannykh-i-podderzhka-tselostnosti} - -Используется асинхронная multimaster репликация. После записи на любую доступную реплику, данные распространяются на все остальные реплики в фоне. Система поддерживает полную идентичность данных на разных репликах. Восстановление после большинства сбоев осуществляется автоматически, а в сложных случаях — полуавтоматически. При необходимости, можно [включить кворумную запись](../operations/settings/settings.md) данных. - -Подробнее смотрите раздел [Репликация данных](../engines/table_engines/mergetree_family/replication.md). - -## Особенности, которые могут считаться недостатками {#osobennosti-clickhouse-kotorye-mogut-schitatsia-nedostatkami} - -1. Отсутствие полноценных транзакций. -2. Возможность изменять или удалять ранее записанные данные с низкими задержками и высокой частотой запросов не предоставляется. Есть массовое удаление и изменение данных для очистки более не нужного или соответствия [GDPR](https://gdpr-info.eu). -3. Разреженный индекс делает ClickHouse плохо пригодным для точечных чтений одиночных строк по своим - ключам. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/introduction/distinctive_features/) diff --git a/docs/ru/introduction/index.md b/docs/ru/introduction/index.md index 5479b37428f..28a8e10e15b 100644 --- a/docs/ru/introduction/index.md +++ b/docs/ru/introduction/index.md @@ -1,5 +1,5 @@ --- -toc_folder_title: Введение +toc_folder_title: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0435" toc_priority: 1 --- diff --git a/docs/ru/operations/access-rights.md b/docs/ru/operations/access-rights.md new file mode 100644 index 00000000000..8c131aa34e4 --- /dev/null +++ b/docs/ru/operations/access-rights.md @@ -0,0 +1,101 @@ +# Права доступа {#prava-dostupa} + +Пользователи и права доступа настраиваются в конфиге пользователей. Обычно это `users.xml`. + +Пользователи прописаны в секции `users`. Рассмотрим фрагмент файла `users.xml`: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + +``` + +Здесь видно объявление двух пользователей - `default` и `web`. Пользователя `web` мы добавили самостоятельно. + +Пользователь `default` выбирается в случаях, когда имя пользователя не передаётся. Также пользователь `default` может использоваться при распределённой обработке запроса - если в конфигурации кластера для сервера не указаны `user` и `password`. (см. раздел о движке [Distributed](../engines/table-engines/special/distributed.md)). + +Пользователь, который используется для обмена информацией между серверами, объединенными в кластер, не должен иметь существенных ограничений или квот - иначе распределённые запросы сломаются. + +Пароль указывается либо в открытом виде (не рекомендуется), либо в виде SHA-256. Хэш не содержит соль. В связи с этим, не следует рассматривать такие пароли, как защиту от потенциального злоумышленника. Скорее, они нужны для защиты от сотрудников. + +Указывается список сетей, из которых разрешён доступ. В этом примере, список сетей для обеих пользователей, загружается из отдельного файла (`/etc/metrika.xml`), содержащего подстановку `networks`. Вот его фрагмент: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +Можно было бы указать этот список сетей непосредственно в `users.xml`, или в файле в директории `users.d` (подробнее смотрите раздел «[Конфигурационные файлы](configuration-files.md#configuration_files)»). + +В конфиге приведён комментарий, указывающий, как можно открыть доступ отовсюду. + +Для продакшен использования, указывайте только элементы вида `ip` (IP-адреса и их маски), так как использование `host` и `host_regexp` может вызывать лишние задержки. + +Далее указывается используемый профиль настроек пользователя (смотрите раздел «[Профили настроек](settings/settings-profiles.md)»). Вы можете указать профиль по умолчанию - `default`. Профиль может называться как угодно; один и тот же профиль может быть указан для разных пользователей. Наиболее важная вещь, которую вы можете прописать в профиле настроек `readonly=1`, что обеспечивает доступ только на чтение. +Затем указывается используемая квота (смотрите раздел «[Квоты](quotas.md#quotas)»). Вы можете указать квоту по умолчанию — `default`. Она настроена в конфиге по умолчанию так, что только считает использование ресурсов, но никак их не ограничивает. Квота может называться как угодно. Одна и та же квота может быть указана для разных пользователей, в этом случае подсчёт использования ресурсов делается для каждого пользователя по отдельности. + +Также, в необязательном разделе `` можно указать перечень баз, к которым у пользователя будет доступ. По умолчанию пользователю доступны все базы. Можно указать базу данных `default`, в этом случае пользователь получит доступ к базе данных по умолчанию. + +Доступ к БД `system` всегда считается разрешённым (так как эта БД используется для выполнения запросов). + +Пользователь может получить список всех БД и таблиц в них с помощью запросов `SHOW` или системных таблиц, даже если у него нет доступа к отдельным БД. + +Доступ к БД не связан с настройкой [readonly](settings/permissions-for-queries.md#settings_readonly). Невозможно дать полный доступ к одной БД и `readonly` к другой. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/access_rights/) diff --git a/docs/ru/operations/access_rights.md b/docs/ru/operations/access_rights.md deleted file mode 100644 index 18c2a25377a..00000000000 --- a/docs/ru/operations/access_rights.md +++ /dev/null @@ -1,101 +0,0 @@ -# Права доступа {#prava-dostupa} - -Пользователи и права доступа настраиваются в конфиге пользователей. Обычно это `users.xml`. - -Пользователи прописаны в секции `users`. Рассмотрим фрагмент файла `users.xml`: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - -``` - -Здесь видно объявление двух пользователей - `default` и `web`. Пользователя `web` мы добавили самостоятельно. - -Пользователь `default` выбирается в случаях, когда имя пользователя не передаётся. Также пользователь `default` может использоваться при распределённой обработке запроса - если в конфигурации кластера для сервера не указаны `user` и `password`. (см. раздел о движке [Distributed](../engines/table_engines/special/distributed.md)). - -Пользователь, который используется для обмена информацией между серверами, объединенными в кластер, не должен иметь существенных ограничений или квот - иначе распределённые запросы сломаются. - -Пароль указывается либо в открытом виде (не рекомендуется), либо в виде SHA-256. Хэш не содержит соль. В связи с этим, не следует рассматривать такие пароли, как защиту от потенциального злоумышленника. Скорее, они нужны для защиты от сотрудников. - -Указывается список сетей, из которых разрешён доступ. В этом примере, список сетей для обеих пользователей, загружается из отдельного файла (`/etc/metrika.xml`), содержащего подстановку `networks`. Вот его фрагмент: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -Можно было бы указать этот список сетей непосредственно в `users.xml`, или в файле в директории `users.d` (подробнее смотрите раздел «[Конфигурационные файлы](configuration_files.md#configuration_files)»). - -В конфиге приведён комментарий, указывающий, как можно открыть доступ отовсюду. - -Для продакшен использования, указывайте только элементы вида `ip` (IP-адреса и их маски), так как использование `host` и `host_regexp` может вызывать лишние задержки. - -Далее указывается используемый профиль настроек пользователя (смотрите раздел «[Профили настроек](settings/settings_profiles.md)»). Вы можете указать профиль по умолчанию - `default`. Профиль может называться как угодно; один и тот же профиль может быть указан для разных пользователей. Наиболее важная вещь, которую вы можете прописать в профиле настроек `readonly=1`, что обеспечивает доступ только на чтение. -Затем указывается используемая квота (смотрите раздел «[Квоты](quotas.md#quotas)»). Вы можете указать квоту по умолчанию — `default`. Она настроена в конфиге по умолчанию так, что только считает использование ресурсов, но никак их не ограничивает. Квота может называться как угодно. Одна и та же квота может быть указана для разных пользователей, в этом случае подсчёт использования ресурсов делается для каждого пользователя по отдельности. - -Также, в необязательном разделе `` можно указать перечень баз, к которым у пользователя будет доступ. По умолчанию пользователю доступны все базы. Можно указать базу данных `default`, в этом случае пользователь получит доступ к базе данных по умолчанию. - -Доступ к БД `system` всегда считается разрешённым (так как эта БД используется для выполнения запросов). - -Пользователь может получить список всех БД и таблиц в них с помощью запросов `SHOW` или системных таблиц, даже если у него нет доступа к отдельным БД. - -Доступ к БД не связан с настройкой [readonly](settings/permissions_for_queries.md#settings_readonly). Невозможно дать полный доступ к одной БД и `readonly` к другой. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/access_rights/) diff --git a/docs/ru/operations/backup.md b/docs/ru/operations/backup.md index 601eaa4d6d9..6badaa7f724 100644 --- a/docs/ru/operations/backup.md +++ b/docs/ru/operations/backup.md @@ -1,6 +1,6 @@ # Резервное копирование данных {#rezervnoe-kopirovanie-dannykh} -[Репликация](../engines/table_engines/mergetree_family/replication.md) обеспечивает защиту от аппаратных сбоев, но не защищает от человеческих ошибок: случайного удаления данных, удаления не той таблицы, которую надо было, или таблицы на не том кластере, а также программных ошибок, которые приводят к неправильной обработке данных или их повреждению. Во многих случаях подобные ошибки влияют на все реплики. ClickHouse имеет встроенные средства защиты для предотвращения некоторых типов ошибок — например, по умолчанию [не получится удалить таблицы \*MergeTree, содержащие более 50 Гб данных, одной командой](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Однако эти средства защиты не охватывают все возможные случаи и могут быть обойдены. +[Репликация](../engines/table-engines/mergetree-family/replication.md) обеспечивает защиту от аппаратных сбоев, но не защищает от человеческих ошибок: случайного удаления данных, удаления не той таблицы, которую надо было, или таблицы на не том кластере, а также программных ошибок, которые приводят к неправильной обработке данных или их повреждению. Во многих случаях подобные ошибки влияют на все реплики. ClickHouse имеет встроенные средства защиты для предотвращения некоторых типов ошибок — например, по умолчанию [не получится удалить таблицы \*MergeTree, содержащие более 50 Гб данных, одной командой](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Однако эти средства защиты не охватывают все возможные случаи и могут быть обойдены. Для того чтобы эффективно уменьшить возможные человеческие ошибки, следует тщательно подготовить стратегию резервного копирования и восстановления данных **заранее**. @@ -15,7 +15,7 @@ ## Снимки файловой системы {#snimki-failovoi-sistemy} -Некоторые локальные файловые системы позволяют делать снимки (например, [ZFS](https://en.wikipedia.org/wiki/ZFS)), но они могут быть не лучшим выбором для обслуживания живых запросов. Возможным решением является создание дополнительных реплик с такой файловой системой и исключение их из [Distributed](../engines/table_engines/special/distributed.md) таблиц, используемых для запросов `SELECT`. Снимки на таких репликах будут недоступны для запросов, изменяющих данные. В качестве бонуса, эти реплики могут иметь особые конфигурации оборудования с большим количеством дисков, подключенных к серверу, что будет экономически эффективным. +Некоторые локальные файловые системы позволяют делать снимки (например, [ZFS](https://en.wikipedia.org/wiki/ZFS)), но они могут быть не лучшим выбором для обслуживания живых запросов. Возможным решением является создание дополнительных реплик с такой файловой системой и исключение их из [Distributed](../engines/table-engines/special/distributed.md) таблиц, используемых для запросов `SELECT`. Снимки на таких репликах будут недоступны для запросов, изменяющих данные. В качестве бонуса, эти реплики могут иметь особые конфигурации оборудования с большим количеством дисков, подключенных к серверу, что будет экономически эффективным. ## clickhouse-copier {#clickhouse-copier} @@ -27,7 +27,7 @@ ClickHouse позволяет использовать запрос `ALTER TABLE ... FREEZE PARTITION ...` для создания локальной копии партиций таблицы. Это реализуется с помощью жестких ссылок (hardlinks) на каталог `/var/lib/clickhouse/shadow/`, поэтому такая копия обычно не занимает дополнительное место на диске для старых данных. Созданные копии файлов не обрабатываются сервером ClickHouse, поэтому вы можете просто оставить их там: у вас будет простая резервная копия, которая не требует дополнительной внешней системы, однако при аппаратных проблемах вы можете утратить и актуальные данные и сохраненную копию. По этой причине, лучше удаленно скопировать их в другое место, а затем удалить локальную копию. Распределенные файловые системы и хранилища объектов по-прежнему являются хорошими вариантами для этого, однако можно использовать и обычные присоединенные файловые серверы с достаточно большой ёмкостью (в этом случае передача будет происходить через сетевую файловую систему или, возможно, [rsync](https://en.wikipedia.org/wiki/Rsync)). -Дополнительные сведения о запросах, связанных с манипуляциями партициями, см. в разделе [ALTER](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +Дополнительные сведения о запросах, связанных с манипуляциями партициями, см. в разделе [ALTER](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). Для автоматизации этого подхода доступен инструмент от сторонних разработчиков: [clickhouse-backup](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/ru/operations/configuration-files.md b/docs/ru/operations/configuration-files.md new file mode 100644 index 00000000000..f9c8f3f57a6 --- /dev/null +++ b/docs/ru/operations/configuration-files.md @@ -0,0 +1,46 @@ +# Конфигурационные файлы {#configuration_files} + +Основной конфигурационный файл сервера - `config.xml`. Он расположен в директории `/etc/clickhouse-server/`. + +Отдельные настройки могут быть переопределены в файлах `*.xml` и `*.conf` из директории `config.d` рядом с конфигом. + +У элементов этих конфигурационных файлов могут быть указаны атрибуты `replace` или `remove`. + +Если ни один не указан - объединить содержимое элементов рекурсивно с заменой значений совпадающих детей. + +Если указано `replace` - заменить весь элемент на указанный. + +Если указано `remove` - удалить элемент. + +Также в конфиге могут быть указаны «подстановки». Если у элемента присутствует атрибут `incl`, то в качестве значения будет использована соответствующая подстановка из файла. По умолчанию, путь к файлу с подстановками - `/etc/metrika.xml`. Он может быть изменён в конфигурации сервера в элементе [include\_from](server-configuration-parameters/settings.md#server_configuration_parameters-include_from). Значения подстановок указываются в элементах `/yandex/имя_подстановки` этого файла. Если подстановка, заданная в `incl` отсутствует, то в лог попадает соответствующая запись. Чтобы ClickHouse не писал в лог об отсутствии подстановки, необходимо указать атрибут `optional="true"` (например, настройка [macros](server-configuration-parameters/settings.md)). + +Подстановки могут также выполняться из ZooKeeper. Для этого укажите у элемента атрибут `from_zk = "/path/to/node"`. Значение элемента заменится на содержимое узла `/path/to/node` в ZooKeeper. В ZooKeeper-узел также можно положить целое XML-поддерево, оно будет целиком вставлено в исходный элемент. + +В `config.xml` может быть указан отдельный конфиг с настройками пользователей, профилей и квот. Относительный путь к нему указывается в элементе users\_config. По умолчанию - `users.xml`. Если `users_config` не указан, то настройки пользователей, профилей и квот, указываются непосредственно в `config.xml`. + +Для `users_config` могут также существовать переопределения в файлах из директории `users_config.d` (например, `users.d`) и подстановки. Например, можно иметь по отдельному конфигурационному файлу для каждого пользователя: + +``` bash +$ cat /etc/clickhouse-server/users.d/alice.xml +``` + +``` xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +Для каждого конфигурационного файла, сервер при запуске генерирует также файлы `file-preprocessed.xml`. Эти файлы содержат все выполненные подстановки и переопределения, и предназначены для информационных целей. Если в конфигурационных файлах были использованы ZooKeeper-подстановки, но при старте сервера ZooKeeper недоступен, то сервер загрузит конфигурацию из preprocessed-файла. + +Сервер следит за изменениями конфигурационных файлов, а также файлов и ZooKeeper-узлов, которые были использованы при выполнении подстановок и переопределений, и перезагружает настройки пользователей и кластеров на лету. То есть, можно изменять кластера, пользователей и их настройки без перезапуска сервера. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/configuration_files/) diff --git a/docs/ru/operations/configuration_files.md b/docs/ru/operations/configuration_files.md deleted file mode 100644 index 19f7ea9d5db..00000000000 --- a/docs/ru/operations/configuration_files.md +++ /dev/null @@ -1,46 +0,0 @@ -# Конфигурационные файлы {#configuration_files} - -Основной конфигурационный файл сервера - `config.xml`. Он расположен в директории `/etc/clickhouse-server/`. - -Отдельные настройки могут быть переопределены в файлах `*.xml` и `*.conf` из директории `config.d` рядом с конфигом. - -У элементов этих конфигурационных файлов могут быть указаны атрибуты `replace` или `remove`. - -Если ни один не указан - объединить содержимое элементов рекурсивно с заменой значений совпадающих детей. - -Если указано `replace` - заменить весь элемент на указанный. - -Если указано `remove` - удалить элемент. - -Также в конфиге могут быть указаны «подстановки». Если у элемента присутствует атрибут `incl`, то в качестве значения будет использована соответствующая подстановка из файла. По умолчанию, путь к файлу с подстановками - `/etc/metrika.xml`. Он может быть изменён в конфигурации сервера в элементе [include\_from](server_configuration_parameters/settings.md#server_configuration_parameters-include_from). Значения подстановок указываются в элементах `/yandex/имя_подстановки` этого файла. Если подстановка, заданная в `incl` отсутствует, то в лог попадает соответствующая запись. Чтобы ClickHouse не писал в лог об отсутствии подстановки, необходимо указать атрибут `optional="true"` (например, настройка [macros](server_configuration_parameters/settings.md)). - -Подстановки могут также выполняться из ZooKeeper. Для этого укажите у элемента атрибут `from_zk = "/path/to/node"`. Значение элемента заменится на содержимое узла `/path/to/node` в ZooKeeper. В ZooKeeper-узел также можно положить целое XML-поддерево, оно будет целиком вставлено в исходный элемент. - -В `config.xml` может быть указан отдельный конфиг с настройками пользователей, профилей и квот. Относительный путь к нему указывается в элементе users\_config. По умолчанию - `users.xml`. Если `users_config` не указан, то настройки пользователей, профилей и квот, указываются непосредственно в `config.xml`. - -Для `users_config` могут также существовать переопределения в файлах из директории `users_config.d` (например, `users.d`) и подстановки. Например, можно иметь по отдельному конфигурационному файлу для каждого пользователя: - -``` bash -$ cat /etc/clickhouse-server/users.d/alice.xml -``` - -``` xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -Для каждого конфигурационного файла, сервер при запуске генерирует также файлы `file-preprocessed.xml`. Эти файлы содержат все выполненные подстановки и переопределения, и предназначены для информационных целей. Если в конфигурационных файлах были использованы ZooKeeper-подстановки, но при старте сервера ZooKeeper недоступен, то сервер загрузит конфигурацию из preprocessed-файла. - -Сервер следит за изменениями конфигурационных файлов, а также файлов и ZooKeeper-узлов, которые были использованы при выполнении подстановок и переопределений, и перезагружает настройки пользователей и кластеров на лету. То есть, можно изменять кластера, пользователей и их настройки без перезапуска сервера. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/configuration_files/) diff --git a/docs/ru/operations/index.md b/docs/ru/operations/index.md index babb22cd8b4..eff0bcb217f 100644 --- a/docs/ru/operations/index.md +++ b/docs/ru/operations/index.md @@ -1,7 +1,8 @@ --- -toc_folder_title: Эксплуатация +toc_folder_title: "\u042D\u043A\u0441\u043F\u043B\u0443\u0430\u0442\u0430\u0446\u0438\ + \u044F" toc_priority: 41 -toc_title: Введение +toc_title: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0435" --- # Эксплуатация {#ekspluatatsiia} diff --git a/docs/ru/operations/monitoring.md b/docs/ru/operations/monitoring.md index 2629a4da931..3082e6275da 100644 --- a/docs/ru/operations/monitoring.md +++ b/docs/ru/operations/monitoring.md @@ -21,18 +21,18 @@ ClickHouse не отслеживает состояние аппаратных Сервер ClickHouse имеет встроенные инструменты мониторинга. -Для отслеживания событий на сервере используйте логи. Подробнее смотрите в разделе конфигурационного файла [logger](server_configuration_parameters/settings.md#server_configuration_parameters-logger). +Для отслеживания событий на сервере используйте логи. Подробнее смотрите в разделе конфигурационного файла [logger](server-configuration-parameters/settings.md#server_configuration_parameters-logger). ClickHouse собирает: - Различные метрики того, как сервер использует вычислительные ресурсы. - Общую статистику обработки запросов. -Метрики находятся в таблицах [system.metrics](system_tables.md#system_tables-metrics), [system.events](system_tables.md#system_tables-events) и [system.asynchronous\_metrics](system_tables.md#system_tables-asynchronous_metrics). +Метрики находятся в таблицах [system.metrics](system-tables.md#system_tables-metrics), [system.events](system-tables.md#system_tables-events) и [system.asynchronous\_metrics](system-tables.md#system_tables-asynchronous_metrics). -Можно настроить экспорт метрик из ClickHouse в [Graphite](https://github.com/graphite-project). Смотрите секцию [graphite](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) конфигурационного файла ClickHouse. Перед настройкой экспорта метрик необходимо настроить Graphite, как указано в [официальном руководстве](https://graphite.readthedocs.io/en/latest/install.html). +Можно настроить экспорт метрик из ClickHouse в [Graphite](https://github.com/graphite-project). Смотрите секцию [graphite](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) конфигурационного файла ClickHouse. Перед настройкой экспорта метрик необходимо настроить Graphite, как указано в [официальном руководстве](https://graphite.readthedocs.io/en/latest/install.html). -Можно настроить экспорт метрик из ClickHouse в [Prometheus](https://prometheus.io). Смотрите [prometheus](server_configuration_parameters/settings.md#server_configuration_parameters-prometheus) конфигурационного файла ClickHouse. Перед настройкой экспорта метрик необходимо настроить Prometheus, как указано в [официальном руководстве](https://prometheus.io/docs/prometheus/latest/installation/). +Можно настроить экспорт метрик из ClickHouse в [Prometheus](https://prometheus.io). Смотрите [prometheus](server-configuration-parameters/settings.md#server_configuration_parameters-prometheus) конфигурационного файла ClickHouse. Перед настройкой экспорта метрик необходимо настроить Prometheus, как указано в [официальном руководстве](https://prometheus.io/docs/prometheus/latest/installation/). Также, можно отслеживать доступность сервера через HTTP API. Отправьте `HTTP GET` к ресурсу `/ping`. Если сервер доступен, он отвечает `200 OK`. diff --git a/docs/ru/operations/optimizing-performance/index.md b/docs/ru/operations/optimizing-performance/index.md new file mode 100644 index 00000000000..6e6cef109c1 --- /dev/null +++ b/docs/ru/operations/optimizing-performance/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Optimizing Performance +toc_priority: 52 +--- + + diff --git a/docs/ru/operations/optimizing-performance/sampling-query-profiler.md b/docs/ru/operations/optimizing-performance/sampling-query-profiler.md new file mode 120000 index 00000000000..fe5373bfe13 --- /dev/null +++ b/docs/ru/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1 @@ +../../../en/operations/optimizing-performance/sampling-query-profiler.md \ No newline at end of file diff --git a/docs/ru/operations/optimizing_performance/index.md b/docs/ru/operations/optimizing_performance/index.md deleted file mode 100644 index 4f4cbb66d24..00000000000 --- a/docs/ru/operations/optimizing_performance/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Optimizing Performance -toc_priority: 52 ---- - diff --git a/docs/ru/operations/optimizing_performance/sampling_query_profiler.md b/docs/ru/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 120000 index 9f3b57cd086..00000000000 --- a/docs/ru/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/operations/optimizing_performance/sampling_query_profiler.md \ No newline at end of file diff --git a/docs/ru/operations/performance-test.md b/docs/ru/operations/performance-test.md new file mode 120000 index 00000000000..a5b151dc417 --- /dev/null +++ b/docs/ru/operations/performance-test.md @@ -0,0 +1 @@ +../../en/operations/performance-test.md \ No newline at end of file diff --git a/docs/ru/operations/performance_test.md b/docs/ru/operations/performance_test.md deleted file mode 120000 index a74c126c63f..00000000000 --- a/docs/ru/operations/performance_test.md +++ /dev/null @@ -1 +0,0 @@ -../../en/operations/performance_test.md \ No newline at end of file diff --git a/docs/ru/operations/requirements.md b/docs/ru/operations/requirements.md index e6bc2f15e43..7fecbfe4e8e 100644 --- a/docs/ru/operations/requirements.md +++ b/docs/ru/operations/requirements.md @@ -17,9 +17,9 @@ ClickHouse реализует параллельную обработку дан - Сложности запросов. - Объёма данных, обрабатываемых в запросах. -Для расчета объёма RAM необходимо оценить размер промежуточных данных для операций [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) а также других операций, которыми вы пользуетесь. +Для расчета объёма RAM необходимо оценить размер промежуточных данных для операций [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) а также других операций, которыми вы пользуетесь. -ClickHouse может использовать внешнюю память для промежуточных данных. Подробнее смотрите в разделе [GROUP BY во внешней памяти](../sql_reference/statements/select.md#select-group-by-in-external-memory). +ClickHouse может использовать внешнюю память для промежуточных данных. Подробнее смотрите в разделе [GROUP BY во внешней памяти](../sql-reference/statements/select.md#select-group-by-in-external-memory). ## Файл подкачки {#fail-podkachki} @@ -51,4 +51,4 @@ ClickHouse может использовать внешнюю память дл ClickHouse разработан для семейства операционных систем Linux. Рекомендуемый дистрибутив Linux — Ubuntu. В системе должен быть установлен пакет `tzdata`. -ClickHouse может работать и в других семействах операционных систем. Подробнее смотрите разделе документации [Начало работы](../getting_started/index.md). +ClickHouse может работать и в других семействах операционных систем. Подробнее смотрите разделе документации [Начало работы](../getting-started/index.md). diff --git a/docs/ru/operations/server-configuration-parameters/index.md b/docs/ru/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..2dec9072b34 --- /dev/null +++ b/docs/ru/operations/server-configuration-parameters/index.md @@ -0,0 +1,11 @@ +# Конфигурационные параметры сервера {#server-settings} + +Раздел содержит описания настроек сервера, которые не могут изменяться на уровне сессии или запроса. + +Рассмотренные настройки хранятся в файле `config.xml` сервера ClickHouse. + +Прочие настройки описаны в разделе «[Настройки](../settings/index.md#settings)». + +Перед изучением настроек ознакомьтесь с разделом [Конфигурационные файлы](../configuration-files.md#configuration_files), обратите внимание на использование подстановок (атрибуты `incl` и `optional`). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/server_configuration_parameters/) diff --git a/docs/ru/operations/server-configuration-parameters/settings.md b/docs/ru/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..fe118c79f23 --- /dev/null +++ b/docs/ru/operations/server-configuration-parameters/settings.md @@ -0,0 +1,835 @@ +# Конфигурационные параметры сервера {#konfiguratsionnye-parametry-servera} + +## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} + +Интервал (в секундах) перезагрузки встроенных словарей. + +ClickHouse перезагружает встроенные словари с заданным интервалом. Это позволяет править словари «на лету» без перезапуска сервера. + +Значение по умолчанию - 3600. + +**Пример** + +``` xml +3600 +``` + +## compression {#compression} + +Настройки компрессии данных. + +!!! warning "Внимание" + Лучше не использовать, если вы только начали работать с ClickHouse. + +Общий вид конфигурации: + +``` xml + + + + + ... + +``` + +Можно сконфигурировать несколько разделов ``. + +Поля блока ``: + +- `min_part_size` - Минимальный размер части таблицы. +- `min_part_size_ratio` - Отношение размера минимальной части таблицы к полному размеру таблицы. +- `method` - Метод сжатия. Возможные значения: `lz4`, `zstd` (экспериментальный). + +ClickHouse проверит условия `min_part_size` и `min_part_size_ratio` и выполнит те блоки `case`, для которых условия совпали. Если ни один `` не подходит, то ClickHouse применит алгоритм сжатия `lz4`. + +**Пример** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## default\_database {#default-database} + +База данных по умолчанию. + +Перечень баз данных можно получить запросом [SHOW DATABASES](../../operations/server-configuration-parameters/settings.md#show-databases). + +**Пример** + +``` xml +default +``` + +## default\_profile {#default-profile} + +Профиль настроек по умолчанию. + +Профили настроек находятся в файле, указанном в параметре `user_config`. + +**Пример** + +``` xml +default +``` + +## dictionaries\_config {#dictionaries-config} + +Путь к конфигурации внешних словарей. + +Путь: + +- Указывается абсолютным или относительно конфигурационного файла сервера. +- Может содержать wildcard-ы \* и ?. + +Смотрите также «[Внешние словари](../../operations/server-configuration-parameters/settings.md)». + +**Пример** + +``` xml +*_dictionary.xml +``` + +## dictionaries\_lazy\_load {#dictionaries-lazy-load} + +Отложенная загрузка словарей. + +Если `true`, то каждый словарь создаётся при первом использовании. Если словарь не удалось создать, то вызов функции, использующей словарь, сгенерирует исключение. + +Если `false`, то все словари создаются при старте сервера, и в случае ошибки сервер завершает работу. + +По умолчанию - `true`. + +**Пример** + +``` xml +true +``` + +## format\_schema\_path {#server_configuration_parameters-format_schema_path} + +Путь к каталогу со схемами для входных данных. Например со схемами для формата [CapnProto](../../interfaces/formats.md#capnproto). + +**Пример** + +``` xml + + format_schemas/ +``` + +## graphite {#server_configuration_parameters-graphite} + +Отправка данных в [Graphite](https://github.com/graphite-project). + +Настройки: + +- host – Сервер Graphite. +- port – Порт сервера Graphite. +- interval – Период отправки в секундах. +- timeout – Таймаут отправки данных в секундах. +- root\_path – Префикс для ключей. +- metrics – Отправка данных из таблицы [system.metrics](../../operations/server-configuration-parameters/settings.md#system_tables-metrics). +- events – Отправка дельты данных, накопленной за промежуток времени из таблицы [system.events](../../operations/server-configuration-parameters/settings.md#system_tables-events). +- events\_cumulative – Отправка суммарных данных из таблицы [system.events](../../operations/server-configuration-parameters/settings.md#system_tables-events). +- asynchronous\_metrics – Отправка данных из таблицы [system.asynchronous\_metrics](../../operations/server-configuration-parameters/settings.md#system_tables-asynchronous_metrics). + +Можно определить несколько секций ``, например, для передачи различных данных с различной частотой. + +**Пример** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## graphite\_rollup {#server_configuration_parameters-graphite-rollup} + +Настройка прореживания данных для Graphite. + +Подробнее читайте в разделе [GraphiteMergeTree](../../operations/server-configuration-parameters/settings.md). + +**Пример** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## http\_port/https\_port {#http-porthttps-port} + +Порт для обращений к серверу по протоколу HTTP(s). + +Если указан `https_port`, то требуется конфигурирование [openSSL](#server_configuration_parameters-openssl). + +Если указан `http_port`, то настройка openSSL игнорируется, даже если она задана. + +**Пример** + +``` xml +0000 +``` + +## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} + +Страница, показываемая по умолчанию, при обращении к HTTP(s) серверу ClickHouse. +Значение по умолчанию «Ok.» (с переводом строки на конце). + +**Пример** + +Показывает `https://tabix.io/` при обращении к `http://localhost:http_port`. + +``` xml + +
]]> +
+``` + +## include\_from {#server_configuration_parameters-include_from} + +Путь к файлу с подстановками. + +Подробности смотрите в разделе «[Конфигурационный файлы](../configuration-files.md#configuration_files)». + +**Пример** + +``` xml +/etc/metrica.xml +``` + +## interserver\_http\_port {#interserver-http-port} + +Порт для обмена между серверами ClickHouse. + +**Пример** + +``` xml +9009 +``` + +## interserver\_http\_host {#interserver-http-host} + +Имя хоста, которое могут использовать другие серверы для обращения к этому. + +Если не указано, то определяется аналогично команде `hostname -f`. + +Удобно использовать, чтобы отвязаться от конкретного сетевого интерфейса. + +**Пример** + +``` xml +example.yandex.ru +``` + +## interserver\_http\_credentials {#server-settings-interserver-http-credentials} + +Имя пользователя и пароль, использующиеся для аутентификации при [репликации](../../operations/server-configuration-parameters/settings.md) движками Replicated\*. Это имя пользователя и пароль используются только для взаимодействия между репликами кластера и никак не связаны с аутентификацией клиентов ClickHouse. Сервер проверяет совпадение имени и пароля для соединяющихся с ним реплик, а также использует это же имя и пароль для соединения с другими репликами. Соответственно, эти имя и пароль должны быть прописаны одинаковыми для всех реплик кластера. +По умолчанию аутентификация не используется. + +Раздел содержит следующие параметры: + +- `user` — имя пользователя. +- `password` — пароль. + +**Пример конфигурации** + +``` xml + + admin + 222 + +``` + +## keep\_alive\_timeout {#keep-alive-timeout} + +Время в секундах, в течение которого ClickHouse ожидает входящих запросов прежде, чем закрыть соединение. + +**Пример** + +``` xml +3 +``` + +## listen\_host {#server_configuration_parameters-listen_host} + +Ограничение по хостам, с которых может прийти запрос. Если необходимо, чтобы сервер отвечал всем, то надо указать `::`. + +Примеры: + +``` xml +::1 +127.0.0.1 +``` + +## logger {#server_configuration_parameters-logger} + +Настройки логирования. + +Ключи: + +- level - Уровень логирования. Допустимые значения: `trace`, `debug`, `information`, `warning`, `error`. +- log - Файл лога. Содержит все записи согласно `level`. +- errorlog - Файл лога ошибок. +- size - Размер файла. Действует для `log` и `errorlog`. Как только файл достиг размера `size`, ClickHouse архивирует и переименовывает его, а на его месте создает новый файл лога. +- count - Количество заархивированных файлов логов, которые сохраняет ClickHouse. + +**Пример** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +Также, существует поддержка записи в syslog. Пример конфига: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +Ключи: +- use\_syslog - обязательная настройка, если требуется запись в syslog +- address - хост\[:порт\] демона syslogd. Если не указан, используется локальный +- hostname - опционально, имя хоста, с которого отсылаются логи +- facility - [категория syslog](https://en.wikipedia.org/wiki/Syslog#Facility), +записанная в верхнем регистре, с префиксом «LOG\_»: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` и прочие). +Значения по умолчанию: при указанном `address` - `LOG_USER`, иначе - `LOG_DAEMON` +- format - формат сообщений. Возможные значения - `bsd` и `syslog` + +## macros {#macros} + +Подстановки параметров реплицируемых таблиц. + +Можно не указывать, если реплицируемых таблицы не используются. + +Подробнее смотрите в разделе «[Создание реплицируемых таблиц](../../operations/server-configuration-parameters/settings.md)». + +**Пример** + +``` xml + +``` + +## mark\_cache\_size {#server-mark-cache-size} + +Приблизительный размер (в байтах) кэша засечек, используемых движками таблиц семейства [MergeTree](../../operations/server-configuration-parameters/settings.md). + +Кэш общий для сервера, память выделяется по мере необходимости. + +**Пример** + +``` xml +5368709120 +``` + +## max\_concurrent\_queries {#max-concurrent-queries} + +Максимальное количество одновременно обрабатываемых запросов. + +**Пример** + +``` xml +100 +``` + +## max\_connections {#max-connections} + +Максимальное количество входящих соединений. + +**Пример** + +``` xml +4096 +``` + +## max\_open\_files {#max-open-files} + +Максимальное количество открытых файлов. + +По умолчанию - `maximum`. + +Рекомендуется использовать в Mac OS X, поскольку функция `getrlimit()` возвращает некорректное значение. + +**Пример** + +``` xml +262144 +``` + +## max\_table\_size\_to\_drop {#max-table-size-to-drop} + +Ограничение на удаление таблиц. + +Если размер таблицы семейства [MergeTree](../../operations/server-configuration-parameters/settings.md) превышает `max_table_size_to_drop` (в байтах), то ее нельзя удалить запросом DROP. + +Если таблицу все же необходимо удалить, не перезапуская при этом сервер ClickHouse, то необходимо создать файл `/flags/force_drop_table` и выполнить запрос DROP. + +Значение по умолчанию - 50GB. + +Значение 0 означает, что можно удалять все таблицы без ограничений. + +**Пример** + +``` xml +0 +``` + +## merge\_tree {#server_configuration_parameters-merge_tree} + +Тонкая настройка таблиц семейства [MergeTree](../../operations/server-configuration-parameters/settings.md). + +Подробнее смотрите в заголовочном файле MergeTreeSettings.h. + +**Пример** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +Настройки клиента/сервера SSL. + +Поддержку SSL обеспечивает библиотека `libpoco`. Описание интерфейса находится в файле [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +Ключи настроек сервера/клиента: + +- privateKeyFile - Путь к файлу с секретным ключом сертификата в формате PEM. Файл может содержать ключ и сертификат одновременно. +- certificateFile - Путь к файлу сертификата клиента/сервера в формате PEM. Можно не указывать, если `privateKeyFile` содержит сертификат. +- caConfig - Путь к файлу или каталогу, которые содержат доверенные корневые сертификаты. +- verificationMode - Способ проверки сертификатов узла. Подробности находятся в описании класса [Context](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h). Допустимые значения: `none`, `relaxed`, `strict`, `once`. +- verificationDepth - Максимальная длина верификационной цепи. Верификация завершится ошибкой, если длина цепи сертификатов превысит установленное значение. +- loadDefaultCAFile - Признак того, что будут использоваться встроенные CA-сертификаты для OpenSSL. Допустимые значения: `true`, `false`. \| +- cipherList - Поддерживаемые OpenSSL-шифры. Например, `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions - Включение/выключение кеширования сессии. Использовать обязательно вместе с `sessionIdContext`. Допустимые значения: `true`, `false`. +- sessionIdContext - Уникальный набор произвольных символов, которые сервер добавляет к каждому сгенерированному идентификатору. Длина строки не должна превышать `SSL_MAX_SSL_SESSION_ID_LENGTH`. Рекомендуется к использованию всегда, поскольку позволяет избежать проблем как в случае, если сервер кеширует сессию, так и если клиент затребовал кеширование. По умолчанию `${application.name}`. +- sessionCacheSize - Максимальное количество сессий, которые кэширует сервер. По умолчанию - 1024\*20. 0 - неограниченное количество сессий. +- sessionTimeout - Время кеширования сессии на сервере. +- extendedVerification - Автоматическая расширенная проверка сертификатов после завершении сессии. Допустимые значения: `true`, `false`. +- requireTLSv1 - Требование соединения TLSv1. Допустимые значения: `true`, `false`. +- requireTLSv1\_1 - Требование соединения TLSv1.1. Допустимые значения: `true`, `false`. +- requireTLSv1\_2 - Требование соединения TLSv1.2. Допустимые значения: `true`, `false`. +- fips - Активация режима OpenSSL FIPS. Поддерживается, если версия OpenSSL, с которой собрана библиотека поддерживает fips. +- privateKeyPassphraseHandler - Класс (подкласс PrivateKeyPassphraseHandler)запрашивающий кодовую фразу доступа к секретному ключу. Например, ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler - Класс (подкласс CertificateHandler) для подтверждения не валидных сертификатов. Например, ` ConsoleCertificateHandler `. +- disableProtocols - Запрещенные к использованию протоколы. +- preferServerCiphers - Предпочтение серверных шифров на клиенте. + +**Пример настройки:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## part\_log {#server_configuration_parameters-part-log} + +Логирование событий, связанных с данными типа [MergeTree](../../operations/server-configuration-parameters/settings.md). Например, события добавления или мержа данных. Лог можно использовать для симуляции алгоритмов слияния, чтобы сравнивать их характеристики. Также, можно визуализировать процесс слияния. + +Запросы логируются не в отдельный файл, а в таблицу [system.part\_log](../../operations/server-configuration-parameters/settings.md#system_tables-part-log). Вы можете изменить название этой таблицы в параметре `table` (см. ниже). + +При настройке логирования используются следующие параметры: + +- `database` — имя базы данных; +- `table` — имя таблицы; +- `partition_by` — устанавливает [произвольный ключ партиционирования](../../operations/server-configuration-parameters/settings.md); +- `flush_interval_milliseconds` — период сброса данных из буфера в памяти в таблицу. + +**Пример** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## path {#server_configuration_parameters-path} + +Путь к каталогу с данными. + +!!! warning "Обратите внимание" + Завершающий слеш обязателен. + +**Пример** + +``` xml +/var/lib/clickhouse/ +``` + +## prometheus {#server_configuration_parameters-prometheus} + +Опубликовать данные о метриках, для сбора с помощью системы мониторинга [Prometheus](https://prometheus.io). + +Настройки: + +- `endpoint` – путь по которому будет осуществляться экспорт данных метрик по HTTP протоколу для сбора с помощью prometheus. Должен начинаться с ‘/’. +- `port` – порт по которому будет доступен endpoint для сбора метрик. +- `metrics` – флаг для экспорта текущих значений метрик из таблицы [system.metrics](../system-tables.md#system_tables-metrics). +- `events` – флаг для экспорта текущих значений метрик из таблицы [system.events](../system-tables.md#system_tables-events). +- `asynchronous_metrics` – флаг для экспорта текущих значений значения метрик из таблицы [system.asynchronous\_metrics](../system-tables.md#system_tables-asynchronous_metrics). + +**Пример** + +``` xml + + /metrics + 8001 + true + true + true + +``` + +## query\_log {#server_configuration_parameters-query-log} + +Настройка логирования запросов, принятых с настройкой [log\_queries=1](../settings/settings.md). + +Запросы логируются не в отдельный файл, а в системную таблицу [system.query\_log](../../operations/server-configuration-parameters/settings.md#system_tables-query-log). Вы можете изменить название этой таблицы в параметре `table` (см. ниже). + +При настройке логирования используются следующие параметры: + +- `database` — имя базы данных; +- `table` — имя таблицы, куда будет записываться лог; +- `partition_by` — [произвольный ключ партиционирования](../../operations/server-configuration-parameters/settings.md) для таблицы с логами; +- `flush_interval_milliseconds` — период сброса данных из буфера в памяти в таблицу. + +Если таблица не существует, то ClickHouse создаст её. Если структура журнала запросов изменилась при обновлении сервера ClickHouse, то таблица со старой структурой переименовывается, а новая таблица создается автоматически. + +**Пример** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## query\_thread\_log {#server_configuration_parameters-query-thread-log} + +Настройка логирования потоков выполнения запросов, принятых с настройкой [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads). + +Запросы логируются не в отдельный файл, а в системную таблицу [system.query\_thread\_log](../../operations/server-configuration-parameters/settings.md#system_tables-query-thread-log). Вы можете изменить название этой таблицы в параметре `table` (см. ниже). + +При настройке логирования используются следующие параметры: + +- `database` — имя базы данных; +- `table` — имя таблицы, куда будет записываться лог; +- `partition_by` — [произвольный ключ партиционирования](../../operations/server-configuration-parameters/settings.md) для таблицы с логами; +- `flush_interval_milliseconds` — период сброса данных из буфера в памяти в таблицу. + +Если таблица не существует, то ClickHouse создаст её. Если структура журнала запросов изменилась при обновлении сервера ClickHouse, то таблица со старой структурой переименовывается, а новая таблица создается автоматически. + +**Пример** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## trace\_log {#server_configuration_parameters-trace_log} + +Settings for the [trace\_log](../../operations/server-configuration-parameters/settings.md#system_tables-trace_log) system table operation. + +Parameters: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [Custom partitioning key](../../operations/server-configuration-parameters/settings.md) for a system table. +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +The default server configuration file `config.xml` contains the following settings section: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## remote\_servers {#server-settings-remote-servers} + +Конфигурация кластеров, которые использует движок таблиц [Distributed](../../operations/server-configuration-parameters/settings.md) и табличная функция `cluster`. + +**Пример** + +``` xml + +``` + +Значение атрибута `incl` смотрите в разделе «[Конфигурационные файлы](../configuration-files.md#configuration_files)». + +**Смотрите также** + +- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) + +## timezone {#server_configuration_parameters-timezone} + +Временная зона сервера. + +Указывается идентификатором IANA в виде часового пояса UTC или географического положения (например, Africa/Abidjan). + +Временная зона необходима при преобразованиях между форматами String и DateTime, которые возникают при выводе полей DateTime в текстовый формат (на экран или в файл) и при получении DateTime из строки. Также, временная зона используется в функциях, которые работают со временем и датой, если они не получили временную зону в параметрах вызова. + +**Пример** + +``` xml +Europe/Moscow +``` + +## tcp\_port {#server_configuration_parameters-tcp_port} + +Порт для взаимодействия с клиентами по протоколу TCP. + +**Пример** + +``` xml +9000 +``` + +## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} + +TCP порт для защищённого обмена данными с клиентами. Используйте с настройкой [OpenSSL](#server_configuration_parameters-openssl). + +**Возможные значения** + +Положительное целое число. + +**Значение по умолчанию** + +``` xml +9440 +``` + +## mysql\_port {#server_configuration_parameters-mysql_port} + +Порт для взаимодействия с клиентами по протоколу MySQL. + +Пример + +``` xml +9004 +``` + +## tmp\_path {#tmp-path} + +Путь ко временным данным для обработки больших запросов. + +!!! warning "Обратите внимание" + Завершающий слеш обязателен. + +**Пример** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} + +Размер кеша (в байтах) для несжатых данных, используемых движками таблиц семейства [MergeTree](../../operations/server-configuration-parameters/settings.md). + +Кеш единый для сервера. Память выделяется по требованию. Кеш используется в том случае, если включена опция [use\_uncompressed\_cache](../settings/settings.md). + +Несжатый кеш выгодно использовать для очень коротких запросов в отдельных случаях. + +**Пример** + +``` xml +8589934592 +``` + +## user\_files\_path {#server_configuration_parameters-user_files_path} + +Каталог с пользовательскими файлами. Используется в табличной функции [file()](../../operations/server-configuration-parameters/settings.md). + +**Пример** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## users\_config {#users-config} + +Путь к файлу, который содержит: + +- Конфигурации пользователей. +- Права доступа. +- Профили настроек. +- Настройки квот. + +**Пример** + +``` xml +users.xml +``` + +## zookeeper {#server-settings_zookeeper} + +Содержит параметры, позволяющие ClickHouse взаимодействовать с кластером [ZooKeeper](http://zookeeper.apache.org/). + +ClickHouse использует ZooKeeper для хранения метаданных о репликах при использовании реплицированных таблиц. Если реплицированные таблицы не используются, этот раздел параметров может отсутствовать. + +Раздел содержит следующие параметры: + +- `node` — адрес ноды (сервера) ZooKeeper. Можно сконфигурировать несколько нод. + + Например: + + + +``` xml + + example_host + 2181 + +``` + + Атрибут `index` задает порядок опроса нод при попытках подключиться к кластеру ZooKeeper. + +- `session_timeout` — максимальный таймаут клиентской сессии в миллисекундах. +- `root` — [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes), который используется как корневой для всех znode, которые использует сервер ClickHouse. Необязательный. +- `identity` — пользователь и пароль, которые может потребовать ZooKeeper для доступа к запрошенным znode. Необязательный. + +**Пример конфигурации** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + + /path/to/zookeeper/node + + user:password + +``` + +**Смотрите также** + +- [Репликация](../../engines/table-engines/mergetree-family/replication.md) +- [ZooKeeper Programmer’s Guide](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} + +Способ хранения заголовков кусков данных в ZooKeeper. + +Параметр применяется только к семейству таблиц `MergeTree`. Его можно установить: + +- Глобально в разделе [merge\_tree](#server_configuration_parameters-merge_tree) файла `config.xml`. + + ClickHouse использует этот параметр для всех таблиц на сервере. Вы можете изменить настройку в любое время. Существующие таблицы изменяют свое поведение при изменении параметра. + +- Для каждой отдельной таблицы. + + При создании таблицы укажите соответствующую [настройку движка](../../operations/server_configuration_parameters/settings.md#table_engine-mergetree-creating-a-table). Поведение существующей таблицы с установленным параметром не изменяется даже при изменении глобального параметра. + +**Возможные значения** + +- 0 — функциональность выключена. +- 1 — функциональность включена. + +Если `use_minimalistic_part_header_in_zookeeper = 1`, то [реплицированные](../../operations/server-configuration-parameters/settings.md) таблицы хранят заголовки кусков данных в компактном виде, используя только одну `znode`. Если таблица содержит много столбцов, этот метод хранения значительно уменьшает объём данных, хранящихся в Zookeeper. + +!!! attention "Внимание" + После того как вы установили `use_minimalistic_part_header_in_zookeeper = 1`, невозможно откатить ClickHouse до версии, которая не поддерживает этот параметр. Будьте осторожны при обновлении ClickHouse на серверах в кластере. Не обновляйте все серверы сразу. Безопаснее проверять новые версии ClickHouse в тестовой среде или только на некоторых серверах кластера. + + Заголовки частей данных, ранее сохранённые с этим параметром, не могут быть восстановлены в их предыдущем (некомпактном) представлении. + +**Значение по умолчанию**: 0. + +## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} + +Отключает внутренний кеш DNS записей. Используется при эксплуатации ClickHouse в системах +с часто меняющейся инфраструктурой, таких как Kubernetes. + +**Значение по умолчанию**: 0. + +## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} + +Период обновления IP адресов у записей во внутреннем DNS кеше ClickHouse (в секундах). +Обновление выполняется асинхронно, отдельным системным потоком. + +**Значение по умолчанию**: 15. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/server_configuration_parameters/settings/) diff --git a/docs/ru/operations/server_configuration_parameters/index.md b/docs/ru/operations/server_configuration_parameters/index.md deleted file mode 100644 index 91deb2973a7..00000000000 --- a/docs/ru/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,11 +0,0 @@ -# Конфигурационные параметры сервера {#server-settings} - -Раздел содержит описания настроек сервера, которые не могут изменяться на уровне сессии или запроса. - -Рассмотренные настройки хранятся в файле `config.xml` сервера ClickHouse. - -Прочие настройки описаны в разделе «[Настройки](../settings/index.md#settings)». - -Перед изучением настроек ознакомьтесь с разделом [Конфигурационные файлы](../configuration_files.md#configuration_files), обратите внимание на использование подстановок (атрибуты `incl` и `optional`). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/server_configuration_parameters/) diff --git a/docs/ru/operations/server_configuration_parameters/settings.md b/docs/ru/operations/server_configuration_parameters/settings.md deleted file mode 100644 index 618bb9764ad..00000000000 --- a/docs/ru/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,835 +0,0 @@ -# Конфигурационные параметры сервера {#konfiguratsionnye-parametry-servera} - -## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} - -Интервал (в секундах) перезагрузки встроенных словарей. - -ClickHouse перезагружает встроенные словари с заданным интервалом. Это позволяет править словари «на лету» без перезапуска сервера. - -Значение по умолчанию - 3600. - -**Пример** - -``` xml -3600 -``` - -## compression {#compression} - -Настройки компрессии данных. - -!!! warning "Внимание" - Лучше не использовать, если вы только начали работать с ClickHouse. - -Общий вид конфигурации: - -``` xml - - - - - ... - -``` - -Можно сконфигурировать несколько разделов ``. - -Поля блока ``: - -- `min_part_size` - Минимальный размер части таблицы. -- `min_part_size_ratio` - Отношение размера минимальной части таблицы к полному размеру таблицы. -- `method` - Метод сжатия. Возможные значения: `lz4`, `zstd` (экспериментальный). - -ClickHouse проверит условия `min_part_size` и `min_part_size_ratio` и выполнит те блоки `case`, для которых условия совпали. Если ни один `` не подходит, то ClickHouse применит алгоритм сжатия `lz4`. - -**Пример** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## default\_database {#default-database} - -База данных по умолчанию. - -Перечень баз данных можно получить запросом [SHOW DATABASES](../../operations/server_configuration_parameters/settings.md#show-databases). - -**Пример** - -``` xml -default -``` - -## default\_profile {#default-profile} - -Профиль настроек по умолчанию. - -Профили настроек находятся в файле, указанном в параметре `user_config`. - -**Пример** - -``` xml -default -``` - -## dictionaries\_config {#dictionaries-config} - -Путь к конфигурации внешних словарей. - -Путь: - -- Указывается абсолютным или относительно конфигурационного файла сервера. -- Может содержать wildcard-ы \* и ?. - -Смотрите также «[Внешние словари](../../operations/server_configuration_parameters/settings.md)». - -**Пример** - -``` xml -*_dictionary.xml -``` - -## dictionaries\_lazy\_load {#dictionaries-lazy-load} - -Отложенная загрузка словарей. - -Если `true`, то каждый словарь создаётся при первом использовании. Если словарь не удалось создать, то вызов функции, использующей словарь, сгенерирует исключение. - -Если `false`, то все словари создаются при старте сервера, и в случае ошибки сервер завершает работу. - -По умолчанию - `true`. - -**Пример** - -``` xml -true -``` - -## format\_schema\_path {#server_configuration_parameters-format_schema_path} - -Путь к каталогу со схемами для входных данных. Например со схемами для формата [CapnProto](../../interfaces/formats.md#capnproto). - -**Пример** - -``` xml - - format_schemas/ -``` - -## graphite {#server_configuration_parameters-graphite} - -Отправка данных в [Graphite](https://github.com/graphite-project). - -Настройки: - -- host – Сервер Graphite. -- port – Порт сервера Graphite. -- interval – Период отправки в секундах. -- timeout – Таймаут отправки данных в секундах. -- root\_path – Префикс для ключей. -- metrics – Отправка данных из таблицы [system.metrics](../../operations/server_configuration_parameters/settings.md#system_tables-metrics). -- events – Отправка дельты данных, накопленной за промежуток времени из таблицы [system.events](../../operations/server_configuration_parameters/settings.md#system_tables-events). -- events\_cumulative – Отправка суммарных данных из таблицы [system.events](../../operations/server_configuration_parameters/settings.md#system_tables-events). -- asynchronous\_metrics – Отправка данных из таблицы [system.asynchronous\_metrics](../../operations/server_configuration_parameters/settings.md#system_tables-asynchronous_metrics). - -Можно определить несколько секций ``, например, для передачи различных данных с различной частотой. - -**Пример** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## graphite\_rollup {#server_configuration_parameters-graphite-rollup} - -Настройка прореживания данных для Graphite. - -Подробнее читайте в разделе [GraphiteMergeTree](../../operations/server_configuration_parameters/settings.md). - -**Пример** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## http\_port/https\_port {#http-porthttps-port} - -Порт для обращений к серверу по протоколу HTTP(s). - -Если указан `https_port`, то требуется конфигурирование [openSSL](#server_configuration_parameters-openssl). - -Если указан `http_port`, то настройка openSSL игнорируется, даже если она задана. - -**Пример** - -``` xml -0000 -``` - -## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} - -Страница, показываемая по умолчанию, при обращении к HTTP(s) серверу ClickHouse. -Значение по умолчанию «Ok.» (с переводом строки на конце). - -**Пример** - -Показывает `https://tabix.io/` при обращении к `http://localhost:http_port`. - -``` xml - -
]]> -
-``` - -## include\_from {#server_configuration_parameters-include_from} - -Путь к файлу с подстановками. - -Подробности смотрите в разделе «[Конфигурационный файлы](../configuration_files.md#configuration_files)». - -**Пример** - -``` xml -/etc/metrica.xml -``` - -## interserver\_http\_port {#interserver-http-port} - -Порт для обмена между серверами ClickHouse. - -**Пример** - -``` xml -9009 -``` - -## interserver\_http\_host {#interserver-http-host} - -Имя хоста, которое могут использовать другие серверы для обращения к этому. - -Если не указано, то определяется аналогично команде `hostname -f`. - -Удобно использовать, чтобы отвязаться от конкретного сетевого интерфейса. - -**Пример** - -``` xml -example.yandex.ru -``` - -## interserver\_http\_credentials {#server-settings-interserver-http-credentials} - -Имя пользователя и пароль, использующиеся для аутентификации при [репликации](../../operations/server_configuration_parameters/settings.md) движками Replicated\*. Это имя пользователя и пароль используются только для взаимодействия между репликами кластера и никак не связаны с аутентификацией клиентов ClickHouse. Сервер проверяет совпадение имени и пароля для соединяющихся с ним реплик, а также использует это же имя и пароль для соединения с другими репликами. Соответственно, эти имя и пароль должны быть прописаны одинаковыми для всех реплик кластера. -По умолчанию аутентификация не используется. - -Раздел содержит следующие параметры: - -- `user` — имя пользователя. -- `password` — пароль. - -**Пример конфигурации** - -``` xml - - admin - 222 - -``` - -## keep\_alive\_timeout {#keep-alive-timeout} - -Время в секундах, в течение которого ClickHouse ожидает входящих запросов прежде, чем закрыть соединение. - -**Пример** - -``` xml -3 -``` - -## listen\_host {#server_configuration_parameters-listen_host} - -Ограничение по хостам, с которых может прийти запрос. Если необходимо, чтобы сервер отвечал всем, то надо указать `::`. - -Примеры: - -``` xml -::1 -127.0.0.1 -``` - -## logger {#server_configuration_parameters-logger} - -Настройки логирования. - -Ключи: - -- level - Уровень логирования. Допустимые значения: `trace`, `debug`, `information`, `warning`, `error`. -- log - Файл лога. Содержит все записи согласно `level`. -- errorlog - Файл лога ошибок. -- size - Размер файла. Действует для `log` и `errorlog`. Как только файл достиг размера `size`, ClickHouse архивирует и переименовывает его, а на его месте создает новый файл лога. -- count - Количество заархивированных файлов логов, которые сохраняет ClickHouse. - -**Пример** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -Также, существует поддержка записи в syslog. Пример конфига: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -Ключи: -- use\_syslog - обязательная настройка, если требуется запись в syslog -- address - хост\[:порт\] демона syslogd. Если не указан, используется локальный -- hostname - опционально, имя хоста, с которого отсылаются логи -- facility - [категория syslog](https://en.wikipedia.org/wiki/Syslog#Facility), -записанная в верхнем регистре, с префиксом «LOG\_»: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` и прочие). -Значения по умолчанию: при указанном `address` - `LOG_USER`, иначе - `LOG_DAEMON` -- format - формат сообщений. Возможные значения - `bsd` и `syslog` - -## macros {#macros} - -Подстановки параметров реплицируемых таблиц. - -Можно не указывать, если реплицируемых таблицы не используются. - -Подробнее смотрите в разделе «[Создание реплицируемых таблиц](../../operations/server_configuration_parameters/settings.md)». - -**Пример** - -``` xml - -``` - -## mark\_cache\_size {#server-mark-cache-size} - -Приблизительный размер (в байтах) кэша засечек, используемых движками таблиц семейства [MergeTree](../../operations/server_configuration_parameters/settings.md). - -Кэш общий для сервера, память выделяется по мере необходимости. - -**Пример** - -``` xml -5368709120 -``` - -## max\_concurrent\_queries {#max-concurrent-queries} - -Максимальное количество одновременно обрабатываемых запросов. - -**Пример** - -``` xml -100 -``` - -## max\_connections {#max-connections} - -Максимальное количество входящих соединений. - -**Пример** - -``` xml -4096 -``` - -## max\_open\_files {#max-open-files} - -Максимальное количество открытых файлов. - -По умолчанию - `maximum`. - -Рекомендуется использовать в Mac OS X, поскольку функция `getrlimit()` возвращает некорректное значение. - -**Пример** - -``` xml -262144 -``` - -## max\_table\_size\_to\_drop {#max-table-size-to-drop} - -Ограничение на удаление таблиц. - -Если размер таблицы семейства [MergeTree](../../operations/server_configuration_parameters/settings.md) превышает `max_table_size_to_drop` (в байтах), то ее нельзя удалить запросом DROP. - -Если таблицу все же необходимо удалить, не перезапуская при этом сервер ClickHouse, то необходимо создать файл `/flags/force_drop_table` и выполнить запрос DROP. - -Значение по умолчанию - 50GB. - -Значение 0 означает, что можно удалять все таблицы без ограничений. - -**Пример** - -``` xml -0 -``` - -## merge\_tree {#server_configuration_parameters-merge_tree} - -Тонкая настройка таблиц семейства [MergeTree](../../operations/server_configuration_parameters/settings.md). - -Подробнее смотрите в заголовочном файле MergeTreeSettings.h. - -**Пример** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -Настройки клиента/сервера SSL. - -Поддержку SSL обеспечивает библиотека `libpoco`. Описание интерфейса находится в файле [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -Ключи настроек сервера/клиента: - -- privateKeyFile - Путь к файлу с секретным ключом сертификата в формате PEM. Файл может содержать ключ и сертификат одновременно. -- certificateFile - Путь к файлу сертификата клиента/сервера в формате PEM. Можно не указывать, если `privateKeyFile` содержит сертификат. -- caConfig - Путь к файлу или каталогу, которые содержат доверенные корневые сертификаты. -- verificationMode - Способ проверки сертификатов узла. Подробности находятся в описании класса [Context](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h). Допустимые значения: `none`, `relaxed`, `strict`, `once`. -- verificationDepth - Максимальная длина верификационной цепи. Верификация завершится ошибкой, если длина цепи сертификатов превысит установленное значение. -- loadDefaultCAFile - Признак того, что будут использоваться встроенные CA-сертификаты для OpenSSL. Допустимые значения: `true`, `false`. \| -- cipherList - Поддерживаемые OpenSSL-шифры. Например, `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions - Включение/выключение кеширования сессии. Использовать обязательно вместе с `sessionIdContext`. Допустимые значения: `true`, `false`. -- sessionIdContext - Уникальный набор произвольных символов, которые сервер добавляет к каждому сгенерированному идентификатору. Длина строки не должна превышать `SSL_MAX_SSL_SESSION_ID_LENGTH`. Рекомендуется к использованию всегда, поскольку позволяет избежать проблем как в случае, если сервер кеширует сессию, так и если клиент затребовал кеширование. По умолчанию `${application.name}`. -- sessionCacheSize - Максимальное количество сессий, которые кэширует сервер. По умолчанию - 1024\*20. 0 - неограниченное количество сессий. -- sessionTimeout - Время кеширования сессии на сервере. -- extendedVerification - Автоматическая расширенная проверка сертификатов после завершении сессии. Допустимые значения: `true`, `false`. -- requireTLSv1 - Требование соединения TLSv1. Допустимые значения: `true`, `false`. -- requireTLSv1\_1 - Требование соединения TLSv1.1. Допустимые значения: `true`, `false`. -- requireTLSv1\_2 - Требование соединения TLSv1.2. Допустимые значения: `true`, `false`. -- fips - Активация режима OpenSSL FIPS. Поддерживается, если версия OpenSSL, с которой собрана библиотека поддерживает fips. -- privateKeyPassphraseHandler - Класс (подкласс PrivateKeyPassphraseHandler)запрашивающий кодовую фразу доступа к секретному ключу. Например, ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler - Класс (подкласс CertificateHandler) для подтверждения не валидных сертификатов. Например, ` ConsoleCertificateHandler `. -- disableProtocols - Запрещенные к использованию протоколы. -- preferServerCiphers - Предпочтение серверных шифров на клиенте. - -**Пример настройки:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## part\_log {#server_configuration_parameters-part-log} - -Логирование событий, связанных с данными типа [MergeTree](../../operations/server_configuration_parameters/settings.md). Например, события добавления или мержа данных. Лог можно использовать для симуляции алгоритмов слияния, чтобы сравнивать их характеристики. Также, можно визуализировать процесс слияния. - -Запросы логируются не в отдельный файл, а в таблицу [system.part\_log](../../operations/server_configuration_parameters/settings.md#system_tables-part-log). Вы можете изменить название этой таблицы в параметре `table` (см. ниже). - -При настройке логирования используются следующие параметры: - -- `database` — имя базы данных; -- `table` — имя таблицы; -- `partition_by` — устанавливает [произвольный ключ партиционирования](../../operations/server_configuration_parameters/settings.md); -- `flush_interval_milliseconds` — период сброса данных из буфера в памяти в таблицу. - -**Пример** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## path {#server_configuration_parameters-path} - -Путь к каталогу с данными. - -!!! warning "Обратите внимание" - Завершающий слеш обязателен. - -**Пример** - -``` xml -/var/lib/clickhouse/ -``` - -## prometheus {#server_configuration_parameters-prometheus} - -Опубликовать данные о метриках, для сбора с помощью системы мониторинга [Prometheus](https://prometheus.io). - -Настройки: - -- `endpoint` – путь по которому будет осуществляться экспорт данных метрик по HTTP протоколу для сбора с помощью prometheus. Должен начинаться с '/'. -- `port` – порт по которому будет доступен endpoint для сбора метрик. -- `metrics` – флаг для экспорта текущих значений метрик из таблицы [system.metrics](../system_tables.md#system_tables-metrics). -- `events` – флаг для экспорта текущих значений метрик из таблицы [system.events](../system_tables.md#system_tables-events). -- `asynchronous_metrics` – флаг для экспорта текущих значений значения метрик из таблицы [system.asynchronous\_metrics](../system_tables.md#system_tables-asynchronous_metrics). - -**Пример** - -``` xml - - /metrics - 8001 - true - true - true - -``` - -## query\_log {#server_configuration_parameters-query-log} - -Настройка логирования запросов, принятых с настройкой [log\_queries=1](../settings/settings.md). - -Запросы логируются не в отдельный файл, а в системную таблицу [system.query\_log](../../operations/server_configuration_parameters/settings.md#system_tables-query-log). Вы можете изменить название этой таблицы в параметре `table` (см. ниже). - -При настройке логирования используются следующие параметры: - -- `database` — имя базы данных; -- `table` — имя таблицы, куда будет записываться лог; -- `partition_by` — [произвольный ключ партиционирования](../../operations/server_configuration_parameters/settings.md) для таблицы с логами; -- `flush_interval_milliseconds` — период сброса данных из буфера в памяти в таблицу. - -Если таблица не существует, то ClickHouse создаст её. Если структура журнала запросов изменилась при обновлении сервера ClickHouse, то таблица со старой структурой переименовывается, а новая таблица создается автоматически. - -**Пример** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## query\_thread\_log {#server_configuration_parameters-query-thread-log} - -Настройка логирования потоков выполнения запросов, принятых с настройкой [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads). - -Запросы логируются не в отдельный файл, а в системную таблицу [system.query\_thread\_log](../../operations/server_configuration_parameters/settings.md#system_tables-query-thread-log). Вы можете изменить название этой таблицы в параметре `table` (см. ниже). - -При настройке логирования используются следующие параметры: - -- `database` — имя базы данных; -- `table` — имя таблицы, куда будет записываться лог; -- `partition_by` — [произвольный ключ партиционирования](../../operations/server_configuration_parameters/settings.md) для таблицы с логами; -- `flush_interval_milliseconds` — период сброса данных из буфера в памяти в таблицу. - -Если таблица не существует, то ClickHouse создаст её. Если структура журнала запросов изменилась при обновлении сервера ClickHouse, то таблица со старой структурой переименовывается, а новая таблица создается автоматически. - -**Пример** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## trace\_log {#server_configuration_parameters-trace_log} - -Settings for the [trace\_log](../../operations/server_configuration_parameters/settings.md#system_tables-trace_log) system table operation. - -Parameters: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [Custom partitioning key](../../operations/server_configuration_parameters/settings.md) for a system table. -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -The default server configuration file `config.xml` contains the following settings section: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## remote\_servers {#server-settings-remote-servers} - -Конфигурация кластеров, которые использует движок таблиц [Distributed](../../operations/server_configuration_parameters/settings.md) и табличная функция `cluster`. - -**Пример** - -``` xml - -``` - -Значение атрибута `incl` смотрите в разделе «[Конфигурационные файлы](../configuration_files.md#configuration_files)». - -**Смотрите также** - -- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) - -## timezone {#server_configuration_parameters-timezone} - -Временная зона сервера. - -Указывается идентификатором IANA в виде часового пояса UTC или географического положения (например, Africa/Abidjan). - -Временная зона необходима при преобразованиях между форматами String и DateTime, которые возникают при выводе полей DateTime в текстовый формат (на экран или в файл) и при получении DateTime из строки. Также, временная зона используется в функциях, которые работают со временем и датой, если они не получили временную зону в параметрах вызова. - -**Пример** - -``` xml -Europe/Moscow -``` - -## tcp\_port {#server_configuration_parameters-tcp_port} - -Порт для взаимодействия с клиентами по протоколу TCP. - -**Пример** - -``` xml -9000 -``` - -## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} - -TCP порт для защищённого обмена данными с клиентами. Используйте с настройкой [OpenSSL](#server_configuration_parameters-openssl). - -**Возможные значения** - -Положительное целое число. - -**Значение по умолчанию** - -``` xml -9440 -``` - -## mysql\_port {#server_configuration_parameters-mysql_port} - -Порт для взаимодействия с клиентами по протоколу MySQL. - -Пример - -``` xml -9004 -``` - -## tmp\_path {#tmp-path} - -Путь ко временным данным для обработки больших запросов. - -!!! warning "Обратите внимание" - Завершающий слеш обязателен. - -**Пример** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} - -Размер кеша (в байтах) для несжатых данных, используемых движками таблиц семейства [MergeTree](../../operations/server_configuration_parameters/settings.md). - -Кеш единый для сервера. Память выделяется по требованию. Кеш используется в том случае, если включена опция [use\_uncompressed\_cache](../settings/settings.md). - -Несжатый кеш выгодно использовать для очень коротких запросов в отдельных случаях. - -**Пример** - -``` xml -8589934592 -``` - -## user\_files\_path {#server_configuration_parameters-user_files_path} - -Каталог с пользовательскими файлами. Используется в табличной функции [file()](../../operations/server_configuration_parameters/settings.md). - -**Пример** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## users\_config {#users-config} - -Путь к файлу, который содержит: - -- Конфигурации пользователей. -- Права доступа. -- Профили настроек. -- Настройки квот. - -**Пример** - -``` xml -users.xml -``` - -## zookeeper {#server-settings_zookeeper} - -Содержит параметры, позволяющие ClickHouse взаимодействовать с кластером [ZooKeeper](http://zookeeper.apache.org/). - -ClickHouse использует ZooKeeper для хранения метаданных о репликах при использовании реплицированных таблиц. Если реплицированные таблицы не используются, этот раздел параметров может отсутствовать. - -Раздел содержит следующие параметры: - -- `node` — адрес ноды (сервера) ZooKeeper. Можно сконфигурировать несколько нод. - - Например: - - - -``` xml - - example_host - 2181 - -``` - - Атрибут `index` задает порядок опроса нод при попытках подключиться к кластеру ZooKeeper. - -- `session_timeout` — максимальный таймаут клиентской сессии в миллисекундах. -- `root` — [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes), который используется как корневой для всех znode, которые использует сервер ClickHouse. Необязательный. -- `identity` — пользователь и пароль, которые может потребовать ZooKeeper для доступа к запрошенным znode. Необязательный. - -**Пример конфигурации** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - - /path/to/zookeeper/node - - user:password - -``` - -**Смотрите также** - -- [Репликация](../../operations/server_configuration_parameters/settings.md) -- [ZooKeeper Programmer’s Guide](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} - -Способ хранения заголовков кусков данных в ZooKeeper. - -Параметр применяется только к семейству таблиц `MergeTree`. Его можно установить: - -- Глобально в разделе [merge\_tree](#server_configuration_parameters-merge_tree) файла `config.xml`. - - ClickHouse использует этот параметр для всех таблиц на сервере. Вы можете изменить настройку в любое время. Существующие таблицы изменяют свое поведение при изменении параметра. - -- Для каждой отдельной таблицы. - - При создании таблицы укажите соответствующую [настройку движка](../../operations/server_configuration_parameters/settings.md#table_engine-mergetree-creating-a-table). Поведение существующей таблицы с установленным параметром не изменяется даже при изменении глобального параметра. - -**Возможные значения** - -- 0 — функциональность выключена. -- 1 — функциональность включена. - -Если `use_minimalistic_part_header_in_zookeeper = 1`, то [реплицированные](../../operations/server_configuration_parameters/settings.md) таблицы хранят заголовки кусков данных в компактном виде, используя только одну `znode`. Если таблица содержит много столбцов, этот метод хранения значительно уменьшает объём данных, хранящихся в Zookeeper. - -!!! attention "Внимание" - После того как вы установили `use_minimalistic_part_header_in_zookeeper = 1`, невозможно откатить ClickHouse до версии, которая не поддерживает этот параметр. Будьте осторожны при обновлении ClickHouse на серверах в кластере. Не обновляйте все серверы сразу. Безопаснее проверять новые версии ClickHouse в тестовой среде или только на некоторых серверах кластера. - - Заголовки частей данных, ранее сохранённые с этим параметром, не могут быть восстановлены в их предыдущем (некомпактном) представлении. - -**Значение по умолчанию**: 0. - -## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} - -Отключает внутренний кеш DNS записей. Используется при эксплуатации ClickHouse в системах -с часто меняющейся инфраструктурой, таких как Kubernetes. - -**Значение по умолчанию**: 0. - -## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} - -Период обновления IP адресов у записей во внутреннем DNS кеше ClickHouse (в секундах). -Обновление выполняется асинхронно, отдельным системным потоком. - -**Значение по умолчанию**: 15. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/server_configuration_parameters/settings/) diff --git a/docs/ru/operations/settings/constraints_on_settings.md b/docs/ru/operations/settings/constraints-on-settings.md similarity index 100% rename from docs/ru/operations/settings/constraints_on_settings.md rename to docs/ru/operations/settings/constraints-on-settings.md diff --git a/docs/ru/operations/settings/index.md b/docs/ru/operations/settings/index.md index f60b7837acc..6c74054f933 100644 --- a/docs/ru/operations/settings/index.md +++ b/docs/ru/operations/settings/index.md @@ -5,19 +5,19 @@ Способы задания настроек, упорядоченные по приоритету: -- Настройки в конфигурационном файле сервера `users.xml`. +- Настройки в конфигурационном файле сервера `users.xml`. - Устанавливаются в элементе ``. + Устанавливаются в элементе ``. -- Настройки для сессии. +- Настройки для сессии. - Из консольного клиента ClickHouse в интерактивном режиме отправьте запрос `SET setting=value`. - Аналогично можно использовать ClickHouse-сессии в HTTP-протоколе, для этого необходимо указывать HTTP-параметр `session_id`. + Из консольного клиента ClickHouse в интерактивном режиме отправьте запрос `SET setting=value`. + Аналогично можно использовать ClickHouse-сессии в HTTP-протоколе, для этого необходимо указывать HTTP-параметр `session_id`. -- Настройки для запроса. +- Настройки для запроса. - - При запуске консольного клиента ClickHouse в не интерактивном режиме установите параметр запуска `--setting=value`. - - При использовании HTTP API передавайте cgi-параметры (`URL?setting_1=value&setting_2=value...`). + - При запуске консольного клиента ClickHouse в не интерактивном режиме установите параметр запуска `--setting=value`. + - При использовании HTTP API передавайте cgi-параметры (`URL?setting_1=value&setting_2=value...`). Настройки, которые можно задать только в конфигурационном файле сервера, в разделе не рассматриваются. diff --git a/docs/ru/operations/settings/merge-tree-settings.md b/docs/ru/operations/settings/merge-tree-settings.md new file mode 100644 index 00000000000..6d74b7a1c96 --- /dev/null +++ b/docs/ru/operations/settings/merge-tree-settings.md @@ -0,0 +1,95 @@ +# Настройки MergeTree таблиц {#merge-tree-settings} + +Значения настроек merge-tree (для всех MergeTree таблиц) можно посмотреть в таблице `system.merge_tree_settings`, их можно переопределить в `config.xml` в секции `merge_tree`, или задать в секции `SETTINGS` у каждой таблицы. + +Пример переопределения в `config.xml`: + +``` text + + 5 + +``` + +Пример для определения в `SETTINGS` у конкретной таблицы: + +``` sql +CREATE TABLE foo +( + `A` Int64 +) +ENGINE = MergeTree +ORDER BY tuple() +SETTINGS max_suspicious_broken_parts = 500; +``` + +Пример изменения настроек у конкретной таблицы командой `ALTER TABLE ... MODIFY SETTING`: + +``` sql +ALTER TABLE foo + MODIFY SETTING max_suspicious_broken_parts = 100; +``` + +## parts\_to\_throw\_insert {#parts-to-throw-insert} + +Eсли число кусков в партиции превышает значение `parts_to_throw_insert`, INSERT прерывается с исключением `Too many parts (N). Merges are processing significantly slower than inserts`. + +Возможные значения: + +- Положительное целое число. + +Значение по умолчанию: 300. + +Для достижения максимальной производительности запросов `SELECT` необходимо минимизировать количество обрабатываемых кусков, см. [Дизайн MergeTree](../../development/architecture.md#merge-tree). + +Можно установить большее значение 600 (1200), это уменьшит вероятность возникновения ошибки `Too many parts`, но в тоже время вы позже обнаружите возможную проблему со слияниями (например, из-за недостатка места на диске) и деградацию производительности `SELECT`. + +## parts\_to\_delay\_insert {#parts-to-delay-insert} + +Eсли число кусков в партиции превышает значение `parts_to_delay_insert`, `INSERT` искусственно замедляется. + +Возможные значения: + +- Положительное целое число. + +Значение по умолчанию: 150. + +ClickHouse искусственно выполняет `INSERT` дольше (добавляет ‘sleep’), чтобы фоновый механизм слияния успевал слиять куски быстрее, чем они добавляются. + +## max\_delay\_to\_insert {#max-delay-to-insert} + +Величина в секундах, которая используется для расчета задержки `INSERT`, если число кусков в партиции превышает значение [parts\_to\_delay\_insert](#parts-to-delay-insert). + +Возможные значения: + +- Положительное целое число. + +Значение по умолчанию: 1. + +Величина задержи (в миллисекундах) для `INSERT` вычисляется по формуле: + +``` code +max_k = parts_to_throw_insert - parts_to_delay_insert +k = 1 + parts_count_in_partition - parts_to_delay_insert +delay_milliseconds = pow(max_delay_to_insert * 1000, k / max_k) +``` + +Т.е. если в партиции уже 299 кусков и parts\_to\_throw\_insert = 300, parts\_to\_delay\_insert = 150, max\_delay\_to\_insert = 1, `INSERT` замедлится на `pow( 1 * 1000, (1 + 299 - 150) / (300 - 150) ) = 1000` миллисекунд. + +## old\_parts\_lifetime {#old-parts-lifetime} + +Время (в секундах) хранения неактивных кусков, для защиты от потери данных при спонтанной перезагрузке сервера или О.С. + +Возможные значения: + +- Положительное целое число. + +Значение по умолчанию: 480. + +После слияния нескольких кусков в новый кусок, ClickHouse помечает исходные куски как неактивные и удаляет их после `old_parts_lifetime` секунд. +Неактивные куски удаляются, если они не используются в текущих запросах, т.е. если счетчик ссылок куска – `refcount` равен нулю. + +Неактивные куски удаляются не сразу, потому что при записи нового куска не вызывается `fsync`, т.е. некоторое время новый кусок находится только в оперативной памяти сервера (кеше О.С.). Т.о. при спонтанной перезагрузке сервера новый (смерженный) кусок может быть потерян или испорчен. В этом случае ClickHouse в процессе старта при проверке целостности кусков обнаружит проблему, вернет неактивные куски в список активных и позже заново их смержит. Сломанный кусок в этом случае переименовывается (добавляется префикс broken\_) и перемещается в папку detached. Если проверка целостности не обнаруживает проблем в смерженном куске, то исходные неактивные куски переименовываются (добавляется префикс ignored\_) и перемещаются в папку detached. + +Стандартное значение Linux dirty\_expire\_centisecs - 30 секунд (максимальное время, которое записанные данные хранятся только в оперативной памяти), но при больших нагрузках на дисковую систему, данные могут быть записаны намного позже. Экспериментально было найдено время - 480 секунд, за которое гарантированно новый кусок будет записан на диск. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/merge_tree_settings/) diff --git a/docs/ru/operations/settings/merge_tree_settings.md b/docs/ru/operations/settings/merge_tree_settings.md deleted file mode 100644 index 5297e359547..00000000000 --- a/docs/ru/operations/settings/merge_tree_settings.md +++ /dev/null @@ -1,96 +0,0 @@ -# Настройки MergeTree таблиц {#merge-tree-settings} - -Значения настроек merge-tree (для всех MergeTree таблиц) можно посмотреть в таблице `system.merge_tree_settings`, их можно переопределить в `config.xml` в секции `merge_tree`, или задать в секции `SETTINGS` у каждой таблицы. - -Пример переопределения в `config.xml`: -```text - - 5 - -``` - -Пример для определения в `SETTINGS` у конкретной таблицы: -```sql -CREATE TABLE foo -( - `A` Int64 -) -ENGINE = MergeTree -ORDER BY tuple() -SETTINGS max_suspicious_broken_parts = 500; -``` - -Пример изменения настроек у конкретной таблицы командой `ALTER TABLE ... MODIFY SETTING`: -```sql -ALTER TABLE foo - MODIFY SETTING max_suspicious_broken_parts = 100; -``` - - -## parts_to_throw_insert {#parts-to-throw-insert} - -Eсли число кусков в партиции превышает значение `parts_to_throw_insert`, INSERT прерывается с исключением `Too many parts (N). Merges are processing significantly slower than inserts`. - -Возможные значения: - -- Положительное целое число. - -Значение по умолчанию: 300. - -Для достижения максимальной производительности запросов `SELECT` необходимо минимизировать количество обрабатываемых кусков, см. [Дизайн MergeTree](../../development/architecture.md#merge-tree). - -Можно установить большее значение 600 (1200), это уменьшит вероятность возникновения ошибки `Too many parts`, но в тоже время вы позже обнаружите возможную проблему со слияниями (например, из-за недостатка места на диске) и деградацию производительности `SELECT`. - - -## parts_to_delay_insert {#parts-to-delay-insert} - -Eсли число кусков в партиции превышает значение `parts_to_delay_insert`, `INSERT` искусственно замедляется. - -Возможные значения: - -- Положительное целое число. - -Значение по умолчанию: 150. - -ClickHouse искусственно выполняет `INSERT` дольше (добавляет 'sleep'), чтобы фоновый механизм слияния успевал слиять куски быстрее, чем они добавляются. - - -## max_delay_to_insert {#max-delay-to-insert} - -Величина в секундах, которая используется для расчета задержки `INSERT`, если число кусков в партиции превышает значение [parts_to_delay_insert](#parts-to-delay-insert). - -Возможные значения: - -- Положительное целое число. - -Значение по умолчанию: 1. - -Величина задержи (в миллисекундах) для `INSERT` вычисляется по формуле: - -```code -max_k = parts_to_throw_insert - parts_to_delay_insert -k = 1 + parts_count_in_partition - parts_to_delay_insert -delay_milliseconds = pow(max_delay_to_insert * 1000, k / max_k) -``` - -Т.е. если в партиции уже 299 кусков и parts_to_throw_insert = 300, parts_to_delay_insert = 150, max_delay_to_insert = 1, `INSERT` замедлится на `pow( 1 * 1000, (1 + 299 - 150) / (300 - 150) ) = 1000` миллисекунд. - -## old_parts_lifetime {#old-parts-lifetime} - -Время (в секундах) хранения неактивных кусков, для защиты от потери данных при спонтанной перезагрузке сервера или О.С. - -Возможные значения: - -- Положительное целое число. - -Значение по умолчанию: 480. - -После слияния нескольких кусков в новый кусок, ClickHouse помечает исходные куски как неактивные и удаляет их после `old_parts_lifetime` секунд. -Неактивные куски удаляются, если они не используются в текущих запросах, т.е. если счетчик ссылок куска -- `refcount` равен нулю. - -Неактивные куски удаляются не сразу, потому что при записи нового куска не вызывается `fsync`, т.е. некоторое время новый кусок находится только в оперативной памяти сервера (кеше О.С.). Т.о. при спонтанной перезагрузке сервера новый (смерженный) кусок может быть потерян или испорчен. В этом случае ClickHouse в процессе старта при проверке целостности кусков обнаружит проблему, вернет неактивные куски в список активных и позже заново их смержит. Сломанный кусок в этом случае переименовывается (добавляется префикс broken_) и перемещается в папку detached. Если проверка целостности не обнаруживает проблем в смерженном куске, то исходные неактивные куски переименовываются (добавляется префикс ignored_) и перемещаются в папку detached. - -Стандартное значение Linux dirty_expire_centisecs - 30 секунд (максимальное время, которое записанные данные хранятся только в оперативной памяти), но при больших нагрузках на дисковую систему, данные могут быть записаны намного позже. Экспериментально было найдено время - 480 секунд, за которое гарантированно новый кусок будет записан на диск. - - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/merge_tree_settings/) diff --git a/docs/ru/operations/settings/permissions-for-queries.md b/docs/ru/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..3d61edc9e76 --- /dev/null +++ b/docs/ru/operations/settings/permissions-for-queries.md @@ -0,0 +1,57 @@ +# Разрешения для запросов {#permissions_for_queries} + +Запросы в ClickHouse можно разделить на несколько типов: + +1. Запросы на чтение данных: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. Запросы за запись данных: `INSERT`, `OPTIMIZE`. +3. Запросы на изменение настроек: `SET`, `USE`. +4. [Запросы DDL](https://ru.wikipedia.org/wiki/Data_Definition_Language): `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +Разрешения пользователя по типу запроса регулируются параметрами: + +- [readonly](#settings_readonly) — ограничивает разрешения для всех типов запросов, кроме DDL. +- [allow\_ddl](#settings_allow_ddl) — ограничивает разрешения для DDL запросов. + +`KILL QUERY` выполняется с любыми настройками. + +## readonly {#settings_readonly} + +Ограничивает разрешения для запросов на чтение данных, запись данных и изменение параметров. + +Разделение запросов по типам смотрите по тексту [выше](#permissions_for_queries) по тексту. + +**Возможные значения** + +- 0 — разрешены все запросы. +- 1 — разрешены только запросы на чтение данных. +- 2 — разрешены запросы на чтение данных и изменение настроек. + +После установки `readonly = 1` или `2` пользователь не может изменить настройки `readonly` и `allow_ddl` в текущей сессии. + +При использовании метода `GET` в [HTTP интерфейсе](../../interfaces/http.md#http_interface), `readonly = 1` устанавливается автоматически. Для изменения данных используйте метод `POST`. + +Установка `readonly = 1` запрещает изменение всех настроек. Существует способ запретить изменения только некоторых настроек, см. [ограничения на изменение настроек](constraints-on-settings.md). + +**Значение по умолчанию** + +0 + +## allow\_ddl {#settings_allow_ddl} + +Разрешает/запрещает [DDL](https://ru.wikipedia.org/wiki/Data_Definition_Language) запросы. + +Разделение запросов по типам смотрите по тексту [выше](#permissions_for_queries) по тексту. + +**Возможные значения** + +- 0 — DDL запросы не разрешены. +- 1 — DDL запросы разрешены. + +Если `allow_ddl = 0`, то невозможно выполнить `SET allow_ddl = 1` для текущей сессии. + +**Значение по умолчанию** + +1 + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/permissions_for_queries/) diff --git a/docs/ru/operations/settings/permissions_for_queries.md b/docs/ru/operations/settings/permissions_for_queries.md deleted file mode 100644 index 1b37779422c..00000000000 --- a/docs/ru/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,57 +0,0 @@ -# Разрешения для запросов {#permissions_for_queries} - -Запросы в ClickHouse можно разделить на несколько типов: - -1. Запросы на чтение данных: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. Запросы за запись данных: `INSERT`, `OPTIMIZE`. -3. Запросы на изменение настроек: `SET`, `USE`. -4. [Запросы DDL](https://ru.wikipedia.org/wiki/Data_Definition_Language): `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -Разрешения пользователя по типу запроса регулируются параметрами: - -- [readonly](#settings_readonly) — ограничивает разрешения для всех типов запросов, кроме DDL. -- [allow\_ddl](#settings_allow_ddl) — ограничивает разрешения для DDL запросов. - -`KILL QUERY` выполняется с любыми настройками. - -## readonly {#settings_readonly} - -Ограничивает разрешения для запросов на чтение данных, запись данных и изменение параметров. - -Разделение запросов по типам смотрите по тексту [выше](#permissions_for_queries) по тексту. - -**Возможные значения** - -- 0 — разрешены все запросы. -- 1 — разрешены только запросы на чтение данных. -- 2 — разрешены запросы на чтение данных и изменение настроек. - -После установки `readonly = 1` или `2` пользователь не может изменить настройки `readonly` и `allow_ddl` в текущей сессии. - -При использовании метода `GET` в [HTTP интерфейсе](../../interfaces/http.md#http_interface), `readonly = 1` устанавливается автоматически. Для изменения данных используйте метод `POST`. - -Установка `readonly = 1` запрещает изменение всех настроек. Существует способ запретить изменения только некоторых настроек, см. [ограничения на изменение настроек](constraints_on_settings.md). - -**Значение по умолчанию** - -0 - -## allow\_ddl {#settings_allow_ddl} - -Разрешает/запрещает [DDL](https://ru.wikipedia.org/wiki/Data_Definition_Language) запросы. - -Разделение запросов по типам смотрите по тексту [выше](#permissions_for_queries) по тексту. - -**Возможные значения** - -- 0 — DDL запросы не разрешены. -- 1 — DDL запросы разрешены. - -Если `allow_ddl = 0`, то невозможно выполнить `SET allow_ddl = 1` для текущей сессии. - -**Значение по умолчанию** - -1 - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/permissions_for_queries/) diff --git a/docs/ru/operations/settings/query-complexity.md b/docs/ru/operations/settings/query-complexity.md new file mode 100644 index 00000000000..bb22d623c09 --- /dev/null +++ b/docs/ru/operations/settings/query-complexity.md @@ -0,0 +1,295 @@ +# Ограничения на сложность запроса {#ogranicheniia-na-slozhnost-zaprosa} + +Ограничения на сложность запроса - часть настроек. +Используются, чтобы обеспечить более безопасное исполнение запросов из пользовательского интерфейса. +Почти все ограничения действуют только на SELECT-ы. +При распределённой обработке запроса, ограничения действуют на каждом сервере по отдельности. + +Ограничения проверяются на каждый блок обработанных данных, а не на каждую строку. В связи с этим, ограничения могут быть превышены на размер блока. + +Ограничения вида «максимальное количество чего-нибудь» могут принимать значение 0, которое обозначает «не ограничено». +Для большинства ограничений также присутствует настройка вида overflow\_mode - что делать, когда ограничение превышено. +Оно может принимать одно из двух значений: `throw` или `break`; а для ограничения на агрегацию (group\_by\_overflow\_mode) есть ещё значение `any`. + +`throw` - кинуть исключение (по умолчанию). + +`break` - прервать выполнение запроса и вернуть неполный результат, как будто исходные данные закончились. + +`any (только для group_by_overflow_mode)` - продолжить агрегацию по ключам, которые успели войти в набор, но не добавлять новые ключи в набор. + +## max\_memory\_usage {#settings_max_memory_usage} + +Максимальный возможный объём оперативной памяти для выполнения запроса на одном сервере. + +В конфигурационном файле по умолчанию, ограничение равно 10 ГБ. + +Настройка не учитывает объём свободной памяти или общий объём памяти на машине. +Ограничение действует на один запрос, в пределах одного сервера. +Текущее потребление памяти для каждого запроса можно посмотреть с помощью `SHOW PROCESSLIST`. +Также отслеживается и выводится в лог пиковое потребление памяти для каждого запроса. + +Потребление памяти не отслеживается для состояний некоторых агрегатных функций. + +Потребление памяти не полностью учитывается для состояний агрегатных функций `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` от аргументов `String` и `Array`. + +Потребление памяти ограничивается также параметрами `max_memory_usage_for_user` и `max_memory_usage_for_all_queries`. + +## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} + +Максимальный возможный объём оперативной памяти для запросов пользователя на одном сервере. + +Значения по умолчанию определены в файле [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). По умолчанию размер не ограничен (`max_memory_usage_for_user = 0`). + +Смотрите также описание настройки [max\_memory\_usage](#settings_max_memory_usage). + +## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} + +Максимальный возможный объём оперативной памяти для всех запросов на одном сервере. + +Значения по умолчанию определены в файле [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). По умолчанию размер не ограничен (`max_memory_usage_for_all_queries = 0`). + +Смотрите также описание настройки [max\_memory\_usage](#settings_max_memory_usage). + +## max\_rows\_to\_read {#max-rows-to-read} + +Следующие ограничения могут проверяться на каждый блок (а не на каждую строку). То есть, ограничения могут быть немного нарушены. +При выполнении запроса в несколько потоков, следующие ограничения действуют в каждом потоке по отдельности. + +Максимальное количество строчек, которое можно прочитать из таблицы при выполнении запроса. + +## max\_bytes\_to\_read {#max-bytes-to-read} + +Максимальное количество байт (несжатых данных), которое можно прочитать из таблицы при выполнении запроса. + +## read\_overflow\_mode {#read-overflow-mode} + +Что делать, когда количество прочитанных данных превысило одно из ограничений: throw или break. По умолчанию: throw. + +## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} + +Максимальное количество уникальных ключей, получаемых в процессе агрегации. Позволяет ограничить потребление оперативки при агрегации. + +## group\_by\_overflow\_mode {#group-by-overflow-mode} + +Что делать, когда количество уникальных ключей при агрегации превысило ограничение: throw, break или any. По умолчанию: throw. +Использование значения any позволяет выполнить GROUP BY приближённо. Качество такого приближённого вычисления сильно зависит от статистических свойств данных. + +## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} + +Включает или отключает выполнение секций `GROUP BY` во внешней памяти. Смотрите [GROUP BY во внешней памяти](../../sql-reference/statements/select.md#select-group-by-in-external-memory). + +Возможные значения: + +- Максимальный объём RAM (в байтах), который может использовать отдельная операция [GROUP BY](../../sql-reference/statements/select.md#select-group-by-clause). +- 0 — `GROUP BY` во внешней памяти отключен. + +Значение по умолчанию — 0. + +## max\_rows\_to\_sort {#max-rows-to-sort} + +Максимальное количество строк до сортировки. Позволяет ограничить потребление оперативки при сортировке. + +## max\_bytes\_to\_sort {#max-bytes-to-sort} + +Максимальное количество байт до сортировки. + +## sort\_overflow\_mode {#sort-overflow-mode} + +Что делать, если количество строк, полученное перед сортировкой, превысило одно из ограничений: throw или break. По умолчанию: throw. + +## max\_result\_rows {#setting-max_result_rows} + +Ограничение на количество строк результата. Проверяются также для подзапросов и на удалённых серверах при выполнении части распределённого запроса. + +## max\_result\_bytes {#max-result-bytes} + +Ограничение на количество байт результата. Аналогично. + +## result\_overflow\_mode {#result-overflow-mode} + +Что делать, если объём результата превысил одно из ограничений: throw или break. По умолчанию: throw. + +Использование break по смыслу похоже на LIMIT. Break прерывает выполнение только на уровне блока. Т.е. число строк которые вернет запрос будет больше чем ограничение [max\_result\_rows](#setting-max_result_rows), кратно [max\_block\_size](settings.md#setting-max_block_size) и зависит от [max\_threads](settings.md#settings-max_threads). + +Пример: + +``` sql +SET max_threads = 3, max_block_size = 3333; +SET max_result_rows = 3334, result_overflow_mode = 'break'; + +SELECT * +FROM numbers_mt(100000) +FORMAT Null; +``` + +Результат: + +``` text +6666 rows in set. ... +``` + +## max\_execution\_time {#max-execution-time} + +Максимальное время выполнения запроса в секундах. +На данный момент не проверяется при одной из стадий сортировки а также при слиянии и финализации агрегатных функций. + +## timeout\_overflow\_mode {#timeout-overflow-mode} + +Что делать, если запрос выполняется дольше max\_execution\_time: throw или break. По умолчанию: throw. + +## min\_execution\_speed {#min-execution-speed} + +Минимальная скорость выполнения запроса в строчках в секунду. Проверяется на каждый блок данных по истечении timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса оказывается меньше, то кидается исключение. + +## min\_execution\_speed\_bytes {#min-execution-speed-bytes} + +Минимальная скорость выполнения запроса в строках на байт. Он проверяется для каждого блока данных после timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса меньше, исключение. + +## max\_execution\_speed {#max-execution-speed} + +Максимальная скорость выполнения запроса в строках в секунду. Он проверяется для каждого блока данных после timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса выше, скорость будет снижена. + +## max\_execution\_speed\_bytes {#max-execution-speed-bytes} + +Максимальная скорость выполнения запроса в байтах в секунду. Он проверяется для каждого блока данных после timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса выше, скорость будет снижена. + +## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} + +Проверять, что скорость выполнения запроса не слишком низкая (не меньше min\_execution\_speed), после прошествия указанного времени в секундах. + +## max\_columns\_to\_read {#max-columns-to-read} + +Максимальное количество столбцов, которых можно читать из таблицы в одном запросе. Если запрос требует чтения большего количества столбцов - кинуть исключение. + +## max\_temporary\_columns {#max-temporary-columns} + +Максимальное количество временных столбцов, которых необходимо одновременно держать в оперативке, в процессе выполнения запроса, включая константные столбцы. Если временных столбцов оказалось больше - кидается исключение. + +## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} + +То же самое, что и max\_temporary\_columns, но без учёта столбцов-констант. +Стоит заметить, что столбцы-константы довольно часто образуются в процессе выполнения запроса, но расходуют примерно нулевое количество вычислительных ресурсов. + +## max\_subquery\_depth {#max-subquery-depth} + +Максимальная вложенность подзапросов. Если подзапросы более глубокие - кидается исключение. По умолчанию: 100. + +## max\_pipeline\_depth {#max-pipeline-depth} + +Максимальная глубина конвейера выполнения запроса. Соответствует количеству преобразований, которое проходит каждый блок данных в процессе выполнения запроса. Считается в пределах одного сервера. Если глубина конвейера больше - кидается исключение. По умолчанию: 1000. + +## max\_ast\_depth {#max-ast-depth} + +Максимальная вложенность синтаксического дерева запроса. Если превышена - кидается исключение. +На данный момент, проверяются не во время парсинга а уже после парсинга запроса. То есть, во время парсинга может быть создано слишком глубокое синтаксическое дерево, но запрос не будет выполнен. По умолчанию: 1000. + +## max\_ast\_elements {#max-ast-elements} + +Максимальное количество элементов синтаксического дерева запроса. Если превышено - кидается исключение. +Аналогично, проверяется уже после парсинга запроса. По умолчанию: 50 000. + +## max\_rows\_in\_set {#max-rows-in-set} + +Максимальное количество строчек для множества в секции IN, создаваемого из подзапроса. + +## max\_bytes\_in\_set {#max-bytes-in-set} + +Максимальное количество байт (несжатых данных), занимаемое множеством в секции IN, создаваемым из подзапроса. + +## set\_overflow\_mode {#set-overflow-mode} + +Что делать, когда количество данных превысило одно из ограничений: throw или break. По умолчанию: throw. + +## max\_rows\_in\_distinct {#max-rows-in-distinct} + +Максимальное количество различных строчек при использовании DISTINCT. + +## max\_bytes\_in\_distinct {#max-bytes-in-distinct} + +Максимальное количество байт, занимаемых хэш-таблицей, при использовании DISTINCT. + +## distinct\_overflow\_mode {#distinct-overflow-mode} + +Что делать, когда количество данных превысило одно из ограничений: throw или break. По умолчанию: throw. + +## max\_rows\_to\_transfer {#max-rows-to-transfer} + +Максимальное количество строчек, которых можно передать на удалённый сервер или сохранить во временную таблицу, при использовании GLOBAL IN. + +## max\_bytes\_to\_transfer {#max-bytes-to-transfer} + +Максимальное количество байт (несжатых данных), которых можно передать на удалённый сервер или сохранить во временную таблицу, при использовании GLOBAL IN. + +## transfer\_overflow\_mode {#transfer-overflow-mode} + +Что делать, когда количество данных превысило одно из ограничений: throw или break. По умолчанию: throw. + +## max\_rows\_in\_join {#settings-max_rows_in_join} + +Ограничивает количество строк в хэш-таблице, используемой при соединении таблиц. + +Параметр применяется к операциям [SELECT… JOIN](../../sql-reference/statements/select.md#select-join) и к движку таблиц [Join](../../engines/table-engines/special/join.md). + +Если запрос содержит несколько `JOIN`, то ClickHouse проверяет значение настройки для каждого промежуточного результата. + +При достижении предела ClickHouse может выполнять различные действия. Используйте настройку [join\_overflow\_mode](#settings-join_overflow_mode) для выбора действия. + +Возможные значения: + +- Положительное целое число. +- 0 — неограниченное количество строк. + +Значение по умолчанию — 0. + +## max\_bytes\_in\_join {#settings-max_bytes_in_join} + +Ограничивает размер (в байтах) хэш-таблицы, используемой при объединении таблиц. + +Параметр применяется к операциям [SELECT… JOIN](../../sql-reference/statements/select.md#select-join) и к движку таблиц [Join](../../engines/table-engines/special/join.md). + +Если запрос содержит несколько `JOIN`, то ClickHouse проверяет значение настройки для каждого промежуточного результата. + +При достижении предела ClickHouse может выполнять различные действия. Используйте настройку [join\_overflow\_mode](#settings-join_overflow_mode) для выбора действия. + +Возможные значения: + +- Положительное целое число. +- 0 — контроль памяти отключен. + +Значение по умолчанию — 0. + +## join\_overflow\_mode {#settings-join_overflow_mode} + +Определяет, какое действие ClickHouse выполняет при достижении любого из следующих ограничений для `JOIN`: + +- [max\_bytes\_in\_join](#settings-max_bytes_in_join) +- [max\_rows\_in\_join](#settings-max_rows_in_join) + +Возможные значения: + +- `THROW` — ClickHouse генерирует исключение и прерывает операцию. +- `BREAK` — ClickHouse прерывает операцию, но не генерирует исключение. + +Значение по умолчанию — `THROW`. + +**Смотрите также** + +- [Секция JOIN](../../sql-reference/statements/select.md#select-join) +- [Движоy таблиц Join](../../engines/table-engines/special/join.md) + +## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} + +Ограничивает максимальное количество партиций в одном вставленном блоке. + +- Положительное целое число. +- 0 — неограниченное количество разделов. + +Значение по умолчанию: 100. + +**Подробности** + +При вставке данных, ClickHouse вычисляет количество партиций во вставленном блоке. Если число партиций больше, чем `max_partitions_per_insert_block`, ClickHouse генерирует исключение со следующим текстом: + +> «Too many partitions for single INSERT block (more than» + toString(max\_parts) + «). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. Large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).» + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/query_complexity/) diff --git a/docs/ru/operations/settings/query_complexity.md b/docs/ru/operations/settings/query_complexity.md deleted file mode 100644 index 5ad28eed0a8..00000000000 --- a/docs/ru/operations/settings/query_complexity.md +++ /dev/null @@ -1,295 +0,0 @@ -# Ограничения на сложность запроса {#ogranicheniia-na-slozhnost-zaprosa} - -Ограничения на сложность запроса - часть настроек. -Используются, чтобы обеспечить более безопасное исполнение запросов из пользовательского интерфейса. -Почти все ограничения действуют только на SELECT-ы. -При распределённой обработке запроса, ограничения действуют на каждом сервере по отдельности. - -Ограничения проверяются на каждый блок обработанных данных, а не на каждую строку. В связи с этим, ограничения могут быть превышены на размер блока. - -Ограничения вида «максимальное количество чего-нибудь» могут принимать значение 0, которое обозначает «не ограничено». -Для большинства ограничений также присутствует настройка вида overflow\_mode - что делать, когда ограничение превышено. -Оно может принимать одно из двух значений: `throw` или `break`; а для ограничения на агрегацию (group\_by\_overflow\_mode) есть ещё значение `any`. - -`throw` - кинуть исключение (по умолчанию). - -`break` - прервать выполнение запроса и вернуть неполный результат, как будто исходные данные закончились. - -`any (только для group_by_overflow_mode)` - продолжить агрегацию по ключам, которые успели войти в набор, но не добавлять новые ключи в набор. - -## max\_memory\_usage {#settings_max_memory_usage} - -Максимальный возможный объём оперативной памяти для выполнения запроса на одном сервере. - -В конфигурационном файле по умолчанию, ограничение равно 10 ГБ. - -Настройка не учитывает объём свободной памяти или общий объём памяти на машине. -Ограничение действует на один запрос, в пределах одного сервера. -Текущее потребление памяти для каждого запроса можно посмотреть с помощью `SHOW PROCESSLIST`. -Также отслеживается и выводится в лог пиковое потребление памяти для каждого запроса. - -Потребление памяти не отслеживается для состояний некоторых агрегатных функций. - -Потребление памяти не полностью учитывается для состояний агрегатных функций `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` от аргументов `String` и `Array`. - -Потребление памяти ограничивается также параметрами `max_memory_usage_for_user` и `max_memory_usage_for_all_queries`. - -## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} - -Максимальный возможный объём оперативной памяти для запросов пользователя на одном сервере. - -Значения по умолчанию определены в файле [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). По умолчанию размер не ограничен (`max_memory_usage_for_user = 0`). - -Смотрите также описание настройки [max\_memory\_usage](#settings_max_memory_usage). - -## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} - -Максимальный возможный объём оперативной памяти для всех запросов на одном сервере. - -Значения по умолчанию определены в файле [Settings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). По умолчанию размер не ограничен (`max_memory_usage_for_all_queries = 0`). - -Смотрите также описание настройки [max\_memory\_usage](#settings_max_memory_usage). - -## max\_rows\_to\_read {#max-rows-to-read} - -Следующие ограничения могут проверяться на каждый блок (а не на каждую строку). То есть, ограничения могут быть немного нарушены. -При выполнении запроса в несколько потоков, следующие ограничения действуют в каждом потоке по отдельности. - -Максимальное количество строчек, которое можно прочитать из таблицы при выполнении запроса. - -## max\_bytes\_to\_read {#max-bytes-to-read} - -Максимальное количество байт (несжатых данных), которое можно прочитать из таблицы при выполнении запроса. - -## read\_overflow\_mode {#read-overflow-mode} - -Что делать, когда количество прочитанных данных превысило одно из ограничений: throw или break. По умолчанию: throw. - -## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} - -Максимальное количество уникальных ключей, получаемых в процессе агрегации. Позволяет ограничить потребление оперативки при агрегации. - -## group\_by\_overflow\_mode {#group-by-overflow-mode} - -Что делать, когда количество уникальных ключей при агрегации превысило ограничение: throw, break или any. По умолчанию: throw. -Использование значения any позволяет выполнить GROUP BY приближённо. Качество такого приближённого вычисления сильно зависит от статистических свойств данных. - -## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} - -Включает или отключает выполнение секций `GROUP BY` во внешней памяти. Смотрите [GROUP BY во внешней памяти](../../sql_reference/statements/select.md#select-group-by-in-external-memory). - -Возможные значения: - -- Максимальный объём RAM (в байтах), который может использовать отдельная операция [GROUP BY](../../sql_reference/statements/select.md#select-group-by-clause). -- 0 — `GROUP BY` во внешней памяти отключен. - -Значение по умолчанию — 0. - -## max\_rows\_to\_sort {#max-rows-to-sort} - -Максимальное количество строк до сортировки. Позволяет ограничить потребление оперативки при сортировке. - -## max\_bytes\_to\_sort {#max-bytes-to-sort} - -Максимальное количество байт до сортировки. - -## sort\_overflow\_mode {#sort-overflow-mode} - -Что делать, если количество строк, полученное перед сортировкой, превысило одно из ограничений: throw или break. По умолчанию: throw. - -## max\_result\_rows {#setting-max_result_rows} - -Ограничение на количество строк результата. Проверяются также для подзапросов и на удалённых серверах при выполнении части распределённого запроса. - -## max\_result\_bytes {#max-result-bytes} - -Ограничение на количество байт результата. Аналогично. - -## result\_overflow\_mode {#result-overflow-mode} - -Что делать, если объём результата превысил одно из ограничений: throw или break. По умолчанию: throw. - -Использование break по смыслу похоже на LIMIT. Break прерывает выполнение только на уровне блока. Т.е. число строк которые вернет запрос будет больше чем ограничение [max\_result\_rows](#setting-max_result_rows), кратно [max\_block\_size](settings.md#setting-max_block_size) и зависит от [max\_threads](settings.md#settings-max_threads). - -Пример: - -``` sql -SET max_threads = 3, max_block_size = 3333; -SET max_result_rows = 3334, result_overflow_mode = 'break'; - -SELECT * -FROM numbers_mt(100000) -FORMAT Null; -``` - -Результат: - -``` text -6666 rows in set. ... -``` - -## max\_execution\_time {#max-execution-time} - -Максимальное время выполнения запроса в секундах. -На данный момент не проверяется при одной из стадий сортировки а также при слиянии и финализации агрегатных функций. - -## timeout\_overflow\_mode {#timeout-overflow-mode} - -Что делать, если запрос выполняется дольше max\_execution\_time: throw или break. По умолчанию: throw. - -## min\_execution\_speed {#min-execution-speed} - -Минимальная скорость выполнения запроса в строчках в секунду. Проверяется на каждый блок данных по истечении timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса оказывается меньше, то кидается исключение. - -## min\_execution\_speed\_bytes {#min-execution-speed-bytes} - -Минимальная скорость выполнения запроса в строках на байт. Он проверяется для каждого блока данных после timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса меньше, исключение. - -## max\_execution\_speed {#max-execution-speed} - -Максимальная скорость выполнения запроса в строках в секунду. Он проверяется для каждого блока данных после timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса выше, скорость будет снижена. - -## max\_execution\_speed\_bytes {#max-execution-speed-bytes} - -Максимальная скорость выполнения запроса в байтах в секунду. Он проверяется для каждого блока данных после timeout\_before\_checking\_execution\_speed. Если скорость выполнения запроса выше, скорость будет снижена. - -## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} - -Проверять, что скорость выполнения запроса не слишком низкая (не меньше min\_execution\_speed), после прошествия указанного времени в секундах. - -## max\_columns\_to\_read {#max-columns-to-read} - -Максимальное количество столбцов, которых можно читать из таблицы в одном запросе. Если запрос требует чтения большего количества столбцов - кинуть исключение. - -## max\_temporary\_columns {#max-temporary-columns} - -Максимальное количество временных столбцов, которых необходимо одновременно держать в оперативке, в процессе выполнения запроса, включая константные столбцы. Если временных столбцов оказалось больше - кидается исключение. - -## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} - -То же самое, что и max\_temporary\_columns, но без учёта столбцов-констант. -Стоит заметить, что столбцы-константы довольно часто образуются в процессе выполнения запроса, но расходуют примерно нулевое количество вычислительных ресурсов. - -## max\_subquery\_depth {#max-subquery-depth} - -Максимальная вложенность подзапросов. Если подзапросы более глубокие - кидается исключение. По умолчанию: 100. - -## max\_pipeline\_depth {#max-pipeline-depth} - -Максимальная глубина конвейера выполнения запроса. Соответствует количеству преобразований, которое проходит каждый блок данных в процессе выполнения запроса. Считается в пределах одного сервера. Если глубина конвейера больше - кидается исключение. По умолчанию: 1000. - -## max\_ast\_depth {#max-ast-depth} - -Максимальная вложенность синтаксического дерева запроса. Если превышена - кидается исключение. -На данный момент, проверяются не во время парсинга а уже после парсинга запроса. То есть, во время парсинга может быть создано слишком глубокое синтаксическое дерево, но запрос не будет выполнен. По умолчанию: 1000. - -## max\_ast\_elements {#max-ast-elements} - -Максимальное количество элементов синтаксического дерева запроса. Если превышено - кидается исключение. -Аналогично, проверяется уже после парсинга запроса. По умолчанию: 50 000. - -## max\_rows\_in\_set {#max-rows-in-set} - -Максимальное количество строчек для множества в секции IN, создаваемого из подзапроса. - -## max\_bytes\_in\_set {#max-bytes-in-set} - -Максимальное количество байт (несжатых данных), занимаемое множеством в секции IN, создаваемым из подзапроса. - -## set\_overflow\_mode {#set-overflow-mode} - -Что делать, когда количество данных превысило одно из ограничений: throw или break. По умолчанию: throw. - -## max\_rows\_in\_distinct {#max-rows-in-distinct} - -Максимальное количество различных строчек при использовании DISTINCT. - -## max\_bytes\_in\_distinct {#max-bytes-in-distinct} - -Максимальное количество байт, занимаемых хэш-таблицей, при использовании DISTINCT. - -## distinct\_overflow\_mode {#distinct-overflow-mode} - -Что делать, когда количество данных превысило одно из ограничений: throw или break. По умолчанию: throw. - -## max\_rows\_to\_transfer {#max-rows-to-transfer} - -Максимальное количество строчек, которых можно передать на удалённый сервер или сохранить во временную таблицу, при использовании GLOBAL IN. - -## max\_bytes\_to\_transfer {#max-bytes-to-transfer} - -Максимальное количество байт (несжатых данных), которых можно передать на удалённый сервер или сохранить во временную таблицу, при использовании GLOBAL IN. - -## transfer\_overflow\_mode {#transfer-overflow-mode} - -Что делать, когда количество данных превысило одно из ограничений: throw или break. По умолчанию: throw. - -## max\_rows\_in\_join {#settings-max_rows_in_join} - -Ограничивает количество строк в хэш-таблице, используемой при соединении таблиц. - -Параметр применяется к операциям [SELECT… JOIN](../../sql_reference/statements/select.md#select-join) и к движку таблиц [Join](../../engines/table_engines/special/join.md). - -Если запрос содержит несколько `JOIN`, то ClickHouse проверяет значение настройки для каждого промежуточного результата. - -При достижении предела ClickHouse может выполнять различные действия. Используйте настройку [join\_overflow\_mode](#settings-join_overflow_mode) для выбора действия. - -Возможные значения: - -- Положительное целое число. -- 0 — неограниченное количество строк. - -Значение по умолчанию — 0. - -## max\_bytes\_in\_join {#settings-max_bytes_in_join} - -Ограничивает размер (в байтах) хэш-таблицы, используемой при объединении таблиц. - -Параметр применяется к операциям [SELECT… JOIN](../../sql_reference/statements/select.md#select-join) и к движку таблиц [Join](../../engines/table_engines/special/join.md). - -Если запрос содержит несколько `JOIN`, то ClickHouse проверяет значение настройки для каждого промежуточного результата. - -При достижении предела ClickHouse может выполнять различные действия. Используйте настройку [join\_overflow\_mode](#settings-join_overflow_mode) для выбора действия. - -Возможные значения: - -- Положительное целое число. -- 0 — контроль памяти отключен. - -Значение по умолчанию — 0. - -## join\_overflow\_mode {#settings-join_overflow_mode} - -Определяет, какое действие ClickHouse выполняет при достижении любого из следующих ограничений для `JOIN`: - -- [max\_bytes\_in\_join](#settings-max_bytes_in_join) -- [max\_rows\_in\_join](#settings-max_rows_in_join) - -Возможные значения: - -- `THROW` — ClickHouse генерирует исключение и прерывает операцию. -- `BREAK` — ClickHouse прерывает операцию, но не генерирует исключение. - -Значение по умолчанию — `THROW`. - -**Смотрите также** - -- [Секция JOIN](../../sql_reference/statements/select.md#select-join) -- [Движоy таблиц Join](../../engines/table_engines/special/join.md) - -## max\_partitions\_per\_insert\_block {#max-partitions-per-insert-block} - -Ограничивает максимальное количество партиций в одном вставленном блоке. - -- Положительное целое число. -- 0 — неограниченное количество разделов. - -Значение по умолчанию: 100. - -**Подробности** - -При вставке данных, ClickHouse вычисляет количество партиций во вставленном блоке. Если число партиций больше, чем `max_partitions_per_insert_block`, ClickHouse генерирует исключение со следующим текстом: - -> «Too many partitions for single INSERT block (more than» + toString(max\_parts) + «). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. Large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).» - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/query_complexity/) diff --git a/docs/ru/operations/settings/settings_profiles.md b/docs/ru/operations/settings/settings-profiles.md similarity index 100% rename from docs/ru/operations/settings/settings_profiles.md rename to docs/ru/operations/settings/settings-profiles.md diff --git a/docs/ru/operations/settings/settings-users.md b/docs/ru/operations/settings/settings-users.md new file mode 100644 index 00000000000..2d2e2dec506 --- /dev/null +++ b/docs/ru/operations/settings/settings-users.md @@ -0,0 +1,144 @@ +# Настройки пользователей {#nastroiki-polzovatelei} + +Раздел `users` конфигурационного файла `user.xml` содержит настройки для пользователей. + +Структура раздела `users`: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### user\_name/password {#user-namepassword} + +Пароль можно указать в текстовом виде или в виде SHA256 (шестнадцатеричный формат). + +- Чтобы назначить пароль в текстовом виде (**не рекомендуем**), поместите его в элемент `password`. + + Например, `qwerty`. Пароль можно оставить пустым. + + + +- Чтобы назначить пароль в виде SHA256, поместите хэш в элемент `password_sha256_hex`. + + Например, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + Пример создания пароля в командной строке: + + ``` + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + ``` + + Первая строка результата — пароль. Вторая строка — соответствующий ему хэш SHA256. + + + +- Для совместимости с клиентами MySQL, пароль можно задать с помощью двойного хэша SHA1, поместив его в элемент `password_double_sha1_hex`. + + Например, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + Пример создания пароля в командной строке: + + ``` + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + ``` + + Первая строка результата — пароль. Вторая строка — соответствующий ему двойной хэш SHA1. + +### user\_name/networks {#user-namenetworks} + +Список сетей, из которых пользователь может подключиться к серверу ClickHouse. + +Каждый элемент списка имеет одну из следующих форм: + +- `` — IP-адрес или маска подсети. + + Примеры: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Имя хоста. + + Пример: `example01.host.ru`. + + Для проверки доступа выполняется DNS-запрос, и все возвращенные IP-адреса сравниваются с адресом клиента. + +- `` — Регулярное выражение для имен хостов. + + Пример, `^example\d\d-\d\d-\d\.host\.ru$` + + Для проверки доступа выполняется [DNS запрос PTR](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) для адреса клиента, а затем применяется заданное регулярное выражение. Затем, для результатов запроса PTR выполняется другой DNS-запрос и все полученные адреса сравниваются с адресом клиента. Рекомендуем завершать регулярное выражение символом $. + +Все результаты DNS-запросов кэшируются до перезапуска сервера. + +**Примеры** + +Чтобы открыть доступ пользователю из любой сети, укажите: + +``` xml +::/0 +``` + +!!! warning "Внимание" + Открывать доступ из любой сети небезопасно, если у вас нет правильно настроенного брандмауэра или сервер не отключен от интернета. + +Чтобы открыть только локальный доступ, укажите: + +``` xml +::1 +127.0.0.1 +``` + +### user\_name/profile {#user-nameprofile} + +Пользователю можно назначить профиль настроек. Профили настроек конфигурируются в отдельной секции файла `users.xml`. Подробнее читайте в разделе [Профили настроек](settings-profiles.md). + +### user\_name/quota {#user-namequota} + +Квотирование позволяет отслеживать или ограничивать использование ресурсов в течение определённого периода времени. Квоты настраиваются в разделе `quotas` конфигурационного файла `users.xml`. + +Пользователю можно назначить квоты. Подробное описание настройки квот смотрите в разделе [Квоты](../quotas.md#quotas). + +### user\_name/databases {#user-namedatabases} + +В этом разделе вы можете ограничить выдачу ClickHouse запросами `SELECT` для конкретного пользователя, таким образом реализуя базовую защиту на уровне строк. + +**Пример** + +Следующая конфигурация задаёт, что пользователь `user1` в результате запросов `SELECT` может получать только те строки `table1`, в которых значение поля `id` равно 1000. + +``` xml + + + + + id = 1000 + + + + +``` + +Элемент `filter` содержать любое выражение, возвращающее значение типа [UInt8](../../sql-reference/data-types/int-uint.md). Обычно он содержит сравнения и логические операторы. Строки `database_name.table1`, для которых фильтр возвращает 0 не выдаются пользователю. Фильтрация несовместима с операциями `PREWHERE` и отключает оптимизацию `WHERE→PREWHERE`. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/settings_users/) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 732829494e1..c99ed319b1d 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -2,7 +2,7 @@ ## distributed\_product\_mode {#distributed-product-mode} -Изменяет поведение [распределенных подзапросов](../../sql_reference/statements/select.md). +Изменяет поведение [распределенных подзапросов](../../sql-reference/statements/select.md). ClickHouse применяет настройку в тех случаях, когда запрос содержит произведение распределённых таблиц, т.е. когда запрос к распределенной таблице содержит не-GLOBAL подзапрос к также распределенной таблице. @@ -11,7 +11,7 @@ ClickHouse применяет настройку в тех случаях, ко - Только подзапросы для IN, JOIN. - Только если в секции FROM используется распределённая таблица, содержащая более одного шарда. - Если подзапрос касается распределенной таблицы, содержащей более одного шарда. -- Не используется в случае табличной функции [remote](../../sql_reference/table_functions/remote.md). +- Не используется в случае табличной функции [remote](../../sql-reference/table-functions/remote.md). Возможные значения: @@ -46,7 +46,7 @@ ClickHouse применяет настройку в тех случаях, ко ## fallback\_to\_stale\_replicas\_for\_distributed\_queries {#settings-fallback_to_stale_replicas_for_distributed_queries} -Форсирует запрос в устаревшую реплику в случае, если актуальные данные недоступны. См. [Репликация](../../engines/table_engines/mergetree_family/replication.md). +Форсирует запрос в устаревшую реплику в случае, если актуальные данные недоступны. См. [Репликация](../../engines/table-engines/mergetree-family/replication.md). Из устаревших реплик таблицы ClickHouse выбирает наиболее актуальную. @@ -60,7 +60,7 @@ ClickHouse применяет настройку в тех случаях, ко Работает с таблицами семейства MergeTree. -При `force_index_by_date=1` ClickHouse проверяет, есть ли в запросе условие на ключ даты, которое может использоваться для отсечения диапазонов данных. Если подходящего условия нет - кидается исключение. При этом не проверяется, действительно ли условие уменьшает объём данных для чтения. Например, условие `Date != '2000-01-01'` подходит даже в том случае, когда соответствует всем данным в таблице (т.е. для выполнения запроса требуется full scan). Подробнее про диапазоны данных в таблицах MergeTree читайте в разделе [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +При `force_index_by_date=1` ClickHouse проверяет, есть ли в запросе условие на ключ даты, которое может использоваться для отсечения диапазонов данных. Если подходящего условия нет - кидается исключение. При этом не проверяется, действительно ли условие уменьшает объём данных для чтения. Например, условие `Date != '2000-01-01'` подходит даже в том случае, когда соответствует всем данным в таблице (т.е. для выполнения запроса требуется full scan). Подробнее про диапазоны данных в таблицах MergeTree читайте в разделе [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## force\_primary\_key {#settings-force-primary-key} @@ -68,7 +68,7 @@ ClickHouse применяет настройку в тех случаях, ко Работает с таблицами семейства MergeTree. -При `force_primary_key=1` ClickHouse проверяет, есть ли в запросе условие на первичный ключ, которое может использоваться для отсечения диапазонов данных. Если подходящего условия нет - кидается исключение. При этом не проверяется, действительно ли условие уменьшает объём данных для чтения. Подробнее про диапазоны данных в таблицах MergeTree читайте в разделе [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +При `force_primary_key=1` ClickHouse проверяет, есть ли в запросе условие на первичный ключ, которое может использоваться для отсечения диапазонов данных. Если подходящего условия нет - кидается исключение. При этом не проверяется, действительно ли условие уменьшает объём данных для чтения. Подробнее про диапазоны данных в таблицах MergeTree читайте в разделе [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## format\_schema {#format-schema} @@ -129,7 +129,7 @@ ClickHouse применяет настройку в тех случаях, ко ## max\_http\_get\_redirects {#setting-max_http_get_redirects} -Ограничивает максимальное количество переходов по редиректам в таблицах с движком [URL](../../engines/table_engines/special/url.md) при выполнении HTTP запросов методом GET. Настройка применяется для обоих типов таблиц: созданных запросом [CREATE TABLE](../../sql_reference/create/#create-table-query) и с помощью табличной функции [url](../../sql_reference/table_functions/url.md). +Ограничивает максимальное количество переходов по редиректам в таблицах с движком [URL](../../engines/table-engines/special/url.md) при выполнении HTTP запросов методом GET. Настройка применяется для обоих типов таблиц: созданных запросом [CREATE TABLE](../../sql_reference/create/#create-table-query) и с помощью табличной функции [url](../../sql-reference/table-functions/url.md). Возможные значения: @@ -165,7 +165,7 @@ ClickHouse применяет настройку в тех случаях, ко ## input\_format\_values\_interpret\_expressions {#settings-input_format_values_interpret_expressions} -Включает или отключает парсер SQL, если потоковый парсер не может проанализировать данные. Этот параметр используется только для формата [Values](../../interfaces/formats.md#data-format-values) при вставке данных. Дополнительные сведения о парсерах читайте в разделе [Синтаксис](../../sql_reference/syntax.md). +Включает или отключает парсер SQL, если потоковый парсер не может проанализировать данные. Этот параметр используется только для формата [Values](../../interfaces/formats.md#data-format-values) при вставке данных. Дополнительные сведения о парсерах читайте в разделе [Синтаксис](../../sql-reference/syntax.md). Возможные значения: @@ -181,7 +181,7 @@ ClickHouse применяет настройку в тех случаях, ко Пример использования: -Вставим значение типа [DateTime](../../sql_reference/data_types/datetime.md) при разных значения настройки. +Вставим значение типа [DateTime](../../sql-reference/data-types/datetime.md) при разных значения настройки. ``` sql SET input_format_values_interpret_expressions = 0; @@ -341,7 +341,7 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( Выбор парсера для текстового представления дат и времени при обработке входного формата. -Настройка не применяется к [функциям для работы с датой и временем](../../sql_reference/functions/date_time_functions.md). +Настройка не применяется к [функциям для работы с датой и временем](../../sql-reference/functions/date-time-functions.md). Возможные значения: @@ -357,12 +357,12 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( См. также: -- [Тип данных DateTime.](../../sql_reference/data_types/datetime.md) -- [Функции для работы с датой и временем.](../../sql_reference/functions/date_time_functions.md) +- [Тип данных DateTime.](../../sql-reference/data-types/datetime.md) +- [Функции для работы с датой и временем.](../../sql-reference/functions/date-time-functions.md) ## join\_default\_strictness {#settings-join_default_strictness} -Устанавливает строгость по умолчанию для [JOIN](../../sql_reference/statements/select.md#select-join). +Устанавливает строгость по умолчанию для [JOIN](../../sql-reference/statements/select.md#select-join). Возможные значения @@ -377,7 +377,7 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( Изменяет поведение операций, выполняемых со строгостью `ANY`. !!! warning "Внимание" - Настройка применяется только для операций `JOIN`, выполняемых над таблицами с движком [Join](../../engines/table_engines/special/join.md). + Настройка применяется только для операций `JOIN`, выполняемых над таблицами с движком [Join](../../engines/table-engines/special/join.md). Возможные значения: @@ -388,18 +388,18 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( См. также: -- [Секция JOIN](../../sql_reference/statements/select.md#select-join) -- [Движок таблиц Join](../../engines/table_engines/special/join.md) +- [Секция JOIN](../../sql-reference/statements/select.md#select-join) +- [Движок таблиц Join](../../engines/table-engines/special/join.md) - [join\_default\_strictness](#settings-join_default_strictness) ## join\_use\_nulls {#join_use_nulls} -Устанавливает тип поведения [JOIN](../../sql_reference/statements/select.md). При объединении таблиц могут появиться пустые ячейки. ClickHouse заполняет их по-разному в зависимости от настроек. +Устанавливает тип поведения [JOIN](../../sql-reference/statements/select.md). При объединении таблиц могут появиться пустые ячейки. ClickHouse заполняет их по-разному в зависимости от настроек. Возможные значения - 0 — пустые ячейки заполняются значением по умолчанию соответствующего типа поля. -- 1 — `JOIN` ведёт себя как в стандартном SQL. Тип соответствующего поля преобразуется в [Nullable](../../sql_reference/data_types/nullable.md#data_type-nullable), а пустые ячейки заполняются значениями [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` ведёт себя как в стандартном SQL. Тип соответствующего поля преобразуется в [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable), а пустые ячейки заполняются значениями [NULL](../../sql-reference/syntax.md). Значение по умолчанию: 0. @@ -419,7 +419,7 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( ## merge\_tree\_uniform\_read\_distribution {#setting-merge-tree-uniform-read-distribution} -При чтении из таблиц [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) ClickHouse использует несколько потоков. Этот параметр включает/выключает равномерное распределение заданий по рабочим потокам. Алгоритм равномерного распределения стремится сделать время выполнения всех потоков примерно равным для одного запроса `SELECT`. +При чтении из таблиц [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) ClickHouse использует несколько потоков. Этот параметр включает/выключает равномерное распределение заданий по рабочим потокам. Алгоритм равномерного распределения стремится сделать время выполнения всех потоков примерно равным для одного запроса `SELECT`. Возможные значения: @@ -430,7 +430,7 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( ## merge\_tree\_min\_rows\_for\_concurrent\_read {#setting-merge-tree-min-rows-for-concurrent-read} -Если количество строк, считываемых из файла таблицы [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) превышает `merge_tree_min_rows_for_concurrent_read`, то ClickHouse пытается выполнить одновременное чтение из этого файла в несколько потоков. +Если количество строк, считываемых из файла таблицы [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) превышает `merge_tree_min_rows_for_concurrent_read`, то ClickHouse пытается выполнить одновременное чтение из этого файла в несколько потоков. Возможные значения: @@ -440,7 +440,7 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( ## merge\_tree\_min\_bytes\_for\_concurrent\_read {#setting-merge-tree-min-bytes-for-concurrent-read} -Если число байтов, которое должно быть прочитано из одного файла таблицы с движком [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md), превышает значение `merge_tree_min_bytes_for_concurrent_read`, то ClickHouse выполняет одновременное чтение в несколько потоков из этого файла. +Если число байтов, которое должно быть прочитано из одного файла таблицы с движком [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md), превышает значение `merge_tree_min_bytes_for_concurrent_read`, то ClickHouse выполняет одновременное чтение в несколько потоков из этого файла. Возможное значение: @@ -482,7 +482,7 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( Если требуется прочитать более, чем `merge_tree_max_rows_to_use_cache` строк в одном запросе, ClickHouse не используют кэш несжатых блоков. -Кэш несжатых блоков хранит данные, извлечённые при выполнении запросов. ClickHouse использует этот кэш для ускорения ответов на повторяющиеся небольшие запросы. Настройка защищает кэш от замусоривания запросами, для выполнения которых необходимо извлечь большое количество данных. Настройка сервера [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) определяет размер кэша несжатых блоков. +Кэш несжатых блоков хранит данные, извлечённые при выполнении запросов. ClickHouse использует этот кэш для ускорения ответов на повторяющиеся небольшие запросы. Настройка защищает кэш от замусоривания запросами, для выполнения которых необходимо извлечь большое количество данных. Настройка сервера [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) определяет размер кэша несжатых блоков. Возможные значения: @@ -494,7 +494,7 @@ INSERT INTO test VALUES (lower('Hello')), (lower('world')), (lower('INSERT')), ( Если требуется прочитать более, чем `merge_tree_max_bytes_to_use_cache` байтов в одном запросе, ClickHouse не используют кэш несжатых блоков. -Кэш несжатых блоков хранит данные, извлечённые при выполнении запросов. ClickHouse использует кэш для ускорения ответов на повторяющиеся небольшие запросы. Настройка защищает кэш от переполнения. Настройка сервера [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) определяет размер кэша несжатых блоков. +Кэш несжатых блоков хранит данные, извлечённые при выполнении запросов. ClickHouse использует кэш для ускорения ответов на повторяющиеся небольшие запросы. Настройка защищает кэш от переполнения. Настройка сервера [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) определяет размер кэша несжатых блоков. Возможное значение: @@ -519,7 +519,7 @@ ClickHouse использует этот параметр при чтении д Установка логирования запроса. -Запросы, переданные в ClickHouse с этой установкой, логируются согласно правилам конфигурационного параметра сервера [query\_log](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-query-log). +Запросы, переданные в ClickHouse с этой установкой, логируются согласно правилам конфигурационного параметра сервера [query\_log](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-query-log). Пример: @@ -531,7 +531,7 @@ log_queries=1 Установка логирования информации о потоках выполнения запроса. -Лог информации о потоках выполнения запросов, переданных в ClickHouse с этой установкой, записывается согласно правилам конфигурационного параметра сервера [query\_thread\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log). +Лог информации о потоках выполнения запросов, переданных в ClickHouse с этой установкой, записывается согласно правилам конфигурационного параметра сервера [query\_thread\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log). Пример: @@ -551,31 +551,31 @@ log_query_threads=1 Это значение намного больше, чем `max_block_size`. Это сделано, потому что некоторые движки таблиц (`*MergeTree`) будут на каждый вставляемый блок формировать кусок данных на диске, что является довольно большой сущностью. Также, в таблицах типа `*MergeTree`, данные сортируются при вставке, и достаточно большой размер блока позволяет отсортировать больше данных в оперативке. -## min_insert_block_size_rows {#min-insert-block-size-rows} +## min\_insert\_block\_size\_rows {#min-insert-block-size-rows} Устанавливает минимальное количество строк в блоке, который может быть вставлен в таблицу запросом `INSERT`. Блоки меньшего размера склеиваются в блоки большего размера. Возможные значения: -- Целое положительное число. -- 0 — Склейка блоков выключена. +- Целое положительное число. +- 0 — Склейка блоков выключена. Значение по умолчанию: 1048576. -## min_insert_block_size_bytes {#min-insert-block-size-bytes} +## min\_insert\_block\_size\_bytes {#min-insert-block-size-bytes} Устанавливает минимальное количество байтов в блоке, который может быть вставлен в таблицу запросом `INSERT`. Блоки меньшего размера склеиваются в блоки большего размера. Возможные значения: -- Целое положительное число. -- 0 — Склейка блоков выключена. +- Целое положительное число. +- 0 — Склейка блоков выключена. Значение по умолчанию: 268435456. ## max\_replica\_delay\_for\_distributed\_queries {#settings-max_replica_delay_for_distributed_queries} -Отключает отстающие реплики при распределенных запросах. См. [Репликация](../../engines/table_engines/mergetree_family/replication.md). +Отключает отстающие реплики при распределенных запросах. См. [Репликация](../../engines/table-engines/mergetree-family/replication.md). Устанавливает время в секундах. Если отставание реплики больше установленного значения, то реплика не используется. @@ -620,7 +620,7 @@ log_query_threads=1 ## min\_compress\_block\_size {#min-compress-block-size} -Для таблиц типа [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). В целях уменьшения задержек при обработке запросов, блок сжимается при записи следующей засечки, если его размер не меньше min\_compress\_block\_size. По умолчанию - 65 536. +Для таблиц типа [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). В целях уменьшения задержек при обработке запросов, блок сжимается при записи следующей засечки, если его размер не меньше min\_compress\_block\_size. По умолчанию - 65 536. Реальный размер блока, если несжатых данных меньше max\_compress\_block\_size, будет не меньше этого значения и не меньше объёма данных на одну засечку. @@ -699,7 +699,7 @@ log_query_threads=1 Использовать ли кэш разжатых блоков. Принимает 0 или 1. По умолчанию - 0 (выключено). -Использование кэша несжатых блоков (только для таблиц семейства MergeTree) может существенно сократить задержку и увеличить пропускную способность при работе с большим количеством коротких запросов. Включите эту настройку для пользователей, от которых идут частые короткие запросы. Также обратите внимание на конфигурационный параметр [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) (настраивается только в конфигурационном файле) – размер кэша разжатых блоков. По умолчанию - 8 GiB. Кэш разжатых блоков заполняется по мере надобности, а наиболее невостребованные данные автоматически удаляются. +Использование кэша несжатых блоков (только для таблиц семейства MergeTree) может существенно сократить задержку и увеличить пропускную способность при работе с большим количеством коротких запросов. Включите эту настройку для пользователей, от которых идут частые короткие запросы. Также обратите внимание на конфигурационный параметр [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) (настраивается только в конфигурационном файле) – размер кэша разжатых блоков. По умолчанию - 8 GiB. Кэш разжатых блоков заполняется по мере надобности, а наиболее невостребованные данные автоматически удаляются. Для запросов, читающих хоть немного приличный объём данных (миллион строк и больше), кэш разжатых блоков автоматически выключается, чтобы оставить место для действительно мелких запросов. Поэтому, можно держать настройку `use_uncompressed_cache` всегда выставленной в 1. @@ -733,7 +733,7 @@ ClickHouse поддерживает следующие алгоритмы выб - [In order](#load_balancing-in_order) - [First or random](#load_balancing-first_or_random) -### Random (by default) {#load_balancing-random} +### Random (by Default) {#load_balancing-random} ``` sql load_balancing = random @@ -915,7 +915,7 @@ ClickHouse генерирует исключение Значение по умолчанию: 1. -По умолчанию блоки, вставляемые в реплицируемые таблицы оператором `INSERT`, дедуплицируются (см. [Репликация данных](../../engines/table_engines/mergetree_family/replication.md)). +По умолчанию блоки, вставляемые в реплицируемые таблицы оператором `INSERT`, дедуплицируются (см. [Репликация данных](../../engines/table-engines/mergetree-family/replication.md)). ## deduplicate\_blocks\_in\_dependent\_materialized\_views {#settings-deduplicate-blocks-in-dependent-materialized-views} @@ -934,15 +934,15 @@ ClickHouse генерирует исключение ## count\_distinct\_implementation {#settings-count_distinct_implementation} -Задаёт, какая из функций `uniq*` используется при выполнении конструкции [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count). +Задаёт, какая из функций `uniq*` используется при выполнении конструкции [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count). Возможные значения: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqCombined](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [uniqCombined64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [uniqHLL12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [uniqExact](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqCombined](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [uniqCombined64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [uniqHLL12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [uniqExact](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) Значение по умолчанию: `uniqExact`. @@ -1022,7 +1022,7 @@ ClickHouse генерирует исключение ## optimize\_throw\_if\_noop {#setting-optimize_throw_if_noop} -Включает или отключает генерирование исключения в в случаях, когда запрос [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) не выполняет мёрж. +Включает или отключает генерирование исключения в в случаях, когда запрос [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) не выполняет мёрж. По умолчанию, `OPTIMIZE` завершается успешно и в тех случаях, когда он ничего не сделал. Настройка позволяет отделить подобные случаи и включает генерирование исключения с поясняющим сообщением. @@ -1035,7 +1035,7 @@ ClickHouse генерирует исключение ## distributed\_directory\_monitor\_sleep\_time\_ms {#distributed_directory_monitor_sleep_time_ms} -Основной интервал отправки данных движком таблиц [Distributed](../../engines/table_engines/special/distributed.md). Фактический интервал растёт экспоненциально при возникновении ошибок. +Основной интервал отправки данных движком таблиц [Distributed](../../engines/table-engines/special/distributed.md). Фактический интервал растёт экспоненциально при возникновении ошибок. Возможные значения: @@ -1045,7 +1045,7 @@ ClickHouse генерирует исключение ## distributed\_directory\_monitor\_max\_sleep\_time\_ms {#distributed_directory_monitor_max_sleep_time_ms} -Максимальный интервал отправки данных движком таблиц [Distributed](../../engines/table_engines/special/distributed.md). Ограничивает экпоненциальный рост интервала, установленого настройкой [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms). +Максимальный интервал отправки данных движком таблиц [Distributed](../../engines/table-engines/special/distributed.md). Ограничивает экпоненциальный рост интервала, установленого настройкой [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms). Возможные значения: @@ -1057,7 +1057,7 @@ ClickHouse генерирует исключение Включает/выключает пакетную отправку вставленных данных. -Если пакетная отправка включена, то движок таблиц [Distributed](../../engines/table_engines/special/distributed.md) вместо того, чтобы отправлять каждый файл со вставленными данными по отдельности, старается отправить их все за одну операцию. Пакетная отправка улучшает производительность кластера за счет более оптимального использования ресурсов сервера и сети. +Если пакетная отправка включена, то движок таблиц [Distributed](../../engines/table-engines/special/distributed.md) вместо того, чтобы отправлять каждый файл со вставленными данными по отдельности, старается отправить их все за одну операцию. Пакетная отправка улучшает производительность кластера за счет более оптимального использования ресурсов сервера и сети. Возможные значения: @@ -1083,7 +1083,7 @@ ClickHouse генерирует исключение ## query\_profiler\_real\_time\_period\_ns {#query_profiler_real_time_period_ns} -Sets the period for a real clock timer of the [query profiler](../../operations/optimizing_performance/sampling_query_profiler.md). Real clock timer counts wall-clock time. +Sets the period for a real clock timer of the [query profiler](../../operations/optimizing-performance/sampling-query-profiler.md). Real clock timer counts wall-clock time. Possible values: @@ -1096,17 +1096,17 @@ Possible values: - 0 for turning off the timer. -Type: [UInt64](../../sql_reference/data_types/int_uint.md). +Type: [UInt64](../../sql-reference/data-types/int-uint.md). Default value: 1000000000 nanoseconds (once a second). See also: -- System table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- System table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## query\_profiler\_cpu\_time\_period\_ns {#query_profiler_cpu_time_period_ns} -Sets the period for a CPU clock timer of the [query profiler](../../operations/optimizing_performance/sampling_query_profiler.md). This timer counts only CPU time. +Sets the period for a CPU clock timer of the [query profiler](../../operations/optimizing-performance/sampling-query-profiler.md). This timer counts only CPU time. Possible values: @@ -1119,17 +1119,17 @@ Possible values: - 0 for turning off the timer. -Type: [UInt64](../../sql_reference/data_types/int_uint.md). +Type: [UInt64](../../sql-reference/data-types/int-uint.md). Default value: 1000000000 nanoseconds. See also: -- System table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- System table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## allow\_introspection\_functions {#settings-allow_introspection_functions} -Enables of disables [introspections functions](../../sql_reference/functions/introspection.md) for query profiling. +Enables of disables [introspections functions](../../sql-reference/functions/introspection.md) for query profiling. Possible values: @@ -1140,7 +1140,17 @@ Default value: 0. **See Also** -- [Sampling Query Profiler](../optimizing_performance/sampling_query_profiler.md) -- System table [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- [Sampling Query Profiler](../optimizing-performance/sampling-query-profiler.md) +- System table [trace\_log](../../operations/system-tables.md#system_tables-trace_log) + +## background\_pool\_size {#background_pool_size} + +Задает количество потоков для выполнения фоновых операций в движках таблиц (например, слияния в таблицах c движком [MergeTree](../../engines/table-engines/mergetree-family/index.md)). Настройка применяется при запуске сервера ClickHouse и не может быть изменена во пользовательском сеансе. Настройка позволяет управлять загрузкой процессора и диска. Чем меньше пулл, тем ниже нагрузка на CPU и диск, при этом фоновые процессы замедляются, что может повлиять на скорость выполнения запроса. + +Допустимые значения: + +- Положительное целое число. + +Значение по умолчанию: 16. [Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/settings/) diff --git a/docs/ru/operations/settings/settings_users.md b/docs/ru/operations/settings/settings_users.md deleted file mode 100644 index 1719f21a031..00000000000 --- a/docs/ru/operations/settings/settings_users.md +++ /dev/null @@ -1,144 +0,0 @@ -# Настройки пользователей {#nastroiki-polzovatelei} - -Раздел `users` конфигурационного файла `user.xml` содержит настройки для пользователей. - -Структура раздела `users`: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### user\_name/password {#user-namepassword} - -Пароль можно указать в текстовом виде или в виде SHA256 (шестнадцатеричный формат). - -- Чтобы назначить пароль в текстовом виде (**не рекомендуем**), поместите его в элемент `password`. - - Например, `qwerty`. Пароль можно оставить пустым. - - - -- Чтобы назначить пароль в виде SHA256, поместите хэш в элемент `password_sha256_hex`. - - Например, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - Пример создания пароля в командной строке: - - ``` - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - ``` - - Первая строка результата — пароль. Вторая строка — соответствующий ему хэш SHA256. - - - -- Для совместимости с клиентами MySQL, пароль можно задать с помощью двойного хэша SHA1, поместив его в элемент `password_double_sha1_hex`. - - Например, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - Пример создания пароля в командной строке: - - ``` - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - ``` - - Первая строка результата — пароль. Вторая строка — соответствующий ему двойной хэш SHA1. - -### user\_name/networks {#user-namenetworks} - -Список сетей, из которых пользователь может подключиться к серверу ClickHouse. - -Каждый элемент списка имеет одну из следующих форм: - -- `` — IP-адрес или маска подсети. - - Примеры: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Имя хоста. - - Пример: `example01.host.ru`. - - Для проверки доступа выполняется DNS-запрос, и все возвращенные IP-адреса сравниваются с адресом клиента. - -- `` — Регулярное выражение для имен хостов. - - Пример, `^example\d\d-\d\d-\d\.host\.ru$` - - Для проверки доступа выполняется [DNS запрос PTR](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) для адреса клиента, а затем применяется заданное регулярное выражение. Затем, для результатов запроса PTR выполняется другой DNS-запрос и все полученные адреса сравниваются с адресом клиента. Рекомендуем завершать регулярное выражение символом $. - -Все результаты DNS-запросов кэшируются до перезапуска сервера. - -**Примеры** - -Чтобы открыть доступ пользователю из любой сети, укажите: - -``` xml -::/0 -``` - -!!! warning "Внимание" - Открывать доступ из любой сети небезопасно, если у вас нет правильно настроенного брандмауэра или сервер не отключен от интернета. - -Чтобы открыть только локальный доступ, укажите: - -``` xml -::1 -127.0.0.1 -``` - -### user\_name/profile {#user-nameprofile} - -Пользователю можно назначить профиль настроек. Профили настроек конфигурируются в отдельной секции файла `users.xml`. Подробнее читайте в разделе [Профили настроек](settings_profiles.md). - -### user\_name/quota {#user-namequota} - -Квотирование позволяет отслеживать или ограничивать использование ресурсов в течение определённого периода времени. Квоты настраиваются в разделе `quotas` конфигурационного файла `users.xml`. - -Пользователю можно назначить квоты. Подробное описание настройки квот смотрите в разделе [Квоты](../quotas.md#quotas). - -### user\_name/databases {#user-namedatabases} - -В этом разделе вы можете ограничить выдачу ClickHouse запросами `SELECT` для конкретного пользователя, таким образом реализуя базовую защиту на уровне строк. - -**Пример** - -Следующая конфигурация задаёт, что пользователь `user1` в результате запросов `SELECT` может получать только те строки `table1`, в которых значение поля `id` равно 1000. - -``` xml - - - - - id = 1000 - - - - -``` - -Элемент `filter` содержать любое выражение, возвращающее значение типа [UInt8](../../sql_reference/data_types/int_uint.md). Обычно он содержит сравнения и логические операторы. Строки `database_name.table1`, для которых фильтр возвращает 0 не выдаются пользователю. Фильтрация несовместима с операциями `PREWHERE` и отключает оптимизацию `WHERE→PREWHERE`. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/settings/settings_users/) diff --git a/docs/ru/operations/system-tables.md b/docs/ru/operations/system-tables.md new file mode 100644 index 00000000000..1eae7c08330 --- /dev/null +++ b/docs/ru/operations/system-tables.md @@ -0,0 +1,1170 @@ +# Системные таблицы {#sistemnye-tablitsy} + +Системные таблицы используются для реализации части функциональности системы, а также предоставляют доступ к информации о работе системы. +Вы не можете удалить системную таблицу (хотя можете сделать DETACH). +Для системных таблиц нет файлов с данными на диске и файлов с метаданными. Сервер создаёт все системные таблицы при старте. +В системные таблицы нельзя записывать данные - можно только читать. +Системные таблицы расположены в базе данных system. + +## system.asynchronous\_metrics {#system_tables-asynchronous_metrics} + +Содержит метрики, которые периодически вычисляются в фоновом режиме. Например, объём используемой оперативной памяти. + +Столбцы: + +- `metric` ([String](../sql-reference/data-types/string.md)) — название метрики. +- `value` ([Float64](../sql-reference/data-types/float.md)) — значение метрики. + +**Пример** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**Смотрите также** + +- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. +- [system.metrics](#system_tables-metrics) — таблица с мгновенно вычисляемыми метриками. +- [system.events](#system_tables-events) — таблица с количеством произошедших событий. +- [system.metric\_log](#system_tables-metric_log) — таблица фиксирующая историю значений метрик из `system.metrics` и `system.events`. + +## system.clusters {#system-clusters} + +Содержит информацию о доступных в конфигурационном файле кластерах и серверах, которые в них входят. +Столбцы: + +``` text +cluster String — имя кластера. +shard_num UInt32 — номер шарда в кластере, начиная с 1. +shard_weight UInt32 — относительный вес шарда при записи данных +replica_num UInt32 — номер реплики в шарде, начиная с 1. +host_name String — хост, указанный в конфигурации. +host_address String — IP-адрес хоста, полученный из DNS. +port UInt16 — порт, на который обращаться для соединения с сервером. +user String — имя пользователя, которого использовать для соединения с сервером. +``` + +## system.columns {#system-columns} + +Содержит информацию о столбцах всех таблиц. + +С помощью этой таблицы можно получить информацию аналогично запросу [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table), но для многих таблиц сразу. + +Таблица `system.columns` содержит столбцы (тип столбца указан в скобках): + +- `database` (String) — имя базы данных. +- `table` (String) — имя таблицы. +- `name` (String) — имя столбца. +- `type` (String) — тип столбца. +- `default_kind` (String) — тип выражения (`DEFAULT`, `MATERIALIZED`, `ALIAS`) значения по умолчанию, или пустая строка. +- `default_expression` (String) — выражение для значения по умолчанию или пустая строка. +- `data_compressed_bytes` (UInt64) — размер сжатых данных в байтах. +- `data_uncompressed_bytes` (UInt64) — размер распакованных данных в байтах. +- `marks_bytes` (UInt64) — размер засечек в байтах. +- `comment` (String) — комментарий к столбцу или пустая строка. +- `is_in_partition_key` (UInt8) — флаг, показывающий включение столбца в ключ партиционирования. +- `is_in_sorting_key` (UInt8) — флаг, показывающий включение столбца в ключ сортировки. +- `is_in_primary_key` (UInt8) — флаг, показывающий включение столбца в первичный ключ. +- `is_in_sampling_key` (UInt8) — флаг, показывающий включение столбца в ключ выборки. + +## system.contributors {#system-contributors} + +Содержит информацию о контрибьютерах. Контрибьютеры расположены в таблице в случайном порядке. Порядок определяется заново при каждом запросе. + +Столбцы: + +- `name` (String) — Имя контрибьютера (автора коммита) из git log. + +**Пример** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +Чтобы найти себя в таблице, выполните запрос: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## system.databases {#system-databases} + +Таблица содержит один столбец name типа String - имя базы данных. +Для каждой базы данных, о которой знает сервер, будет присутствовать соответствующая запись в таблице. +Эта системная таблица используется для реализации запроса `SHOW DATABASES`. + +## system.detached\_parts {#system_tables-detached_parts} + +Содержит информацию об отсоединённых кусках таблиц семейства [MergeTree](../engines/table-engines/mergetree-family/mergetree.md). Столбец `reason` содержит причину, по которой кусок был отсоединён. Для кусов, отсоединённых пользователем, `reason` содержит пустую строку. +Такие куски могут быть присоединены с помощью [ALTER TABLE ATTACH PARTITION\|PART](../sql_reference/alter/#alter_attach-partition). Остальные столбцы описаны в [system.parts](#system_tables-parts). +Если имя куска некорректно, значения некоторых столбцов могут быть `NULL`. Такие куски могут быть удалены с помощью [ALTER TABLE DROP DETACHED PART](../sql_reference/alter/#alter_drop-detached). + +## system.dictionaries {#system_tables-dictionaries} + +Содержит информацию о [внешних словарях](../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +Столбцы: + +- `database` ([String](../sql-reference/data-types/string.md)) — Имя базы данных, в которой находится словарь, созданный с помощью DDL-запроса. Пустая строка для других словарей. +- `name` ([String](../sql-reference/data-types/string.md)) — [Имя словаря](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md). +- `status` ([Enum8](../sql-reference/data-types/enum.md)) — Статус словаря. Возможные значения: + - `NOT_LOADED` — Словарь не загружен, потому что не использовался. + - `LOADED` — Словарь загружен успешно. + - `FAILED` — Словарь не загружен в результате ошибки. + - `LOADING` — Словарь в процессе загрузки. + - `LOADED_AND_RELOADING` — Словарь загружен успешно, сейчас перезагружается (частые причины: запрос [SYSTEM RELOAD DICTIONARY](../sql-reference/statements/system.md#query_language-system-reload-dictionary), таймаут, изменение настроек словаря). + - `FAILED_AND_RELOADING` — Словарь не загружен в результате ошибки, сейчас перезагружается. +- `origin` ([String](../sql-reference/data-types/string.md)) — Путь к конфигурационному файлу, описывающему словарь. +- `type` ([String](../sql-reference/data-types/string.md)) — Тип размещения словаря. [Хранение словарей в памяти](../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)) или Составной ключ ([String](../sql-reference/data-types/string.md)) — строка вида “(тип 1, тип 2, …, тип n)”. +- `attribute.names` ([Array](../sql-reference/data-types/array.md)([String](../sql-reference/data-types/string.md))) — Массив [имен атрибутов](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), предоставляемых справочником. +- `attribute.types` ([Array](../sql-reference/data-types/array.md)([String](../sql-reference/data-types/string.md))) — Соответствующий массив [типов атрибутов](../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)) — Объем оперативной памяти, используемый словарем. +- `query_count` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Количество запросов с момента загрузки словаря или с момента последней успешной перезагрузки. +- `hit_rate` ([Float64](../sql-reference/data-types/float.md)) — Для cache-словарей — процент закэшированных значений. +- `element_count` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Количество элементов, хранящихся в словаре. +- `load_factor` ([Float64](../sql-reference/data-types/float.md)) — Процент заполнения словаря (для хэшированного словаря — процент заполнения хэш-таблицы). +- `source` ([String](../sql-reference/data-types/string.md)) — Текст, описывающий [источник данных](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md) для словаря. +- `lifetime_min` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Минимальное [время обновления](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md) словаря в памяти, по истечении которого Clickhouse попытается перезагрузить словарь (если задано `invalidate_query`, то только если он изменился). Задается в секундах. +- `lifetime_max` ([UInt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Максимальное [время обновления](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md) словаря в памяти, по истечении которого Clickhouse попытается перезагрузить словарь (если задано `invalidate_query`, то только если он изменился). Задается в секундах. +- `loading_start_time` ([DateTime](../sql-reference/data-types/datetime.md)) — Время начала загрузки словаря. +- `loading_duration` ([Float32](../sql-reference/data-types/float.md)) — Время, затраченное на загрузку словаря. +- `last_exception` ([String](../sql-reference/data-types/string.md)) — Текст ошибки, возникающей при создании или перезагрузке словаря, если словарь не удалось создать. + +**Пример** + +Настройте словарь. + +``` sql +CREATE DICTIONARY dictdb.dict +( + `key` Int64 DEFAULT -1, + `value_default` String DEFAULT 'world', + `value_expression` String DEFAULT 'xxx' EXPRESSION 'toString(127 * 172)' +) +PRIMARY KEY key +SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dicttbl' DB 'dictdb')) +LIFETIME(MIN 0 MAX 1) +LAYOUT(FLAT()) +``` + +Убедитесь, что словарь загружен. + +``` sql +SELECT * FROM system.dictionaries +``` + +``` text +┌─database─┬─name─┬─status─┬─origin──────┬─type─┬─key────┬─attribute.names──────────────────────┬─attribute.types─────┬─bytes_allocated─┬─query_count─┬─hit_rate─┬─element_count─┬───────────load_factor─┬─source─────────────────────┬─lifetime_min─┬─lifetime_max─┬──loading_start_time─┌──last_successful_update_time─┬──────loading_duration─┬─last_exception─┐ +│ dictdb │ dict │ LOADED │ dictdb.dict │ Flat │ UInt64 │ ['value_default','value_expression'] │ ['String','String'] │ 74032 │ 0 │ 1 │ 1 │ 0.0004887585532746823 │ ClickHouse: dictdb.dicttbl │ 0 │ 1 │ 2020-03-04 04:17:34 │ 2020-03-04 04:30:34 │ 0.002 │ │ +└──────────┴──────┴────────┴─────────────┴──────┴────────┴──────────────────────────────────────┴─────────────────────┴─────────────────┴─────────────┴──────────┴───────────────┴───────────────────────┴────────────────────────────┴──────────────┴──────────────┴─────────────────────┴──────────────────────────────┘───────────────────────┴────────────────┘ +``` + +## system.events {#system_tables-events} + +Содержит информацию о количестве событий, произошедших в системе. Например, в таблице можно найти, сколько запросов `SELECT` обработано с момента запуска сервера ClickHouse. + +Столбцы: + +- `event` ([String](../sql-reference/data-types/string.md)) — имя события. +- `value` ([UInt64](../sql-reference/data-types/int-uint.md)) — количество произошедших событий. +- `description` ([String](../sql-reference/data-types/string.md)) — описание события. + +**Пример** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Смотрите также** + +- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — таблица с периодически вычисляемыми метриками. +- [system.metrics](#system_tables-metrics) — таблица с мгновенно вычисляемыми метриками. +- [system.metric\_log](#system_tables-metric_log) — таблица фиксирующая историю значений метрик из `system.metrics` и `system.events`. +- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. + +## system.functions {#system-functions} + +Содержит информацию об обычных и агрегатных функциях. + +Столбцы: + +- `name` (`String`) – Имя функции. +- `is_aggregate` (`UInt8`) – Признак, является ли функция агрегатной. + +## system.graphite\_retentions {#system-graphite-retentions} + +Содержит информацию о том, какие параметры [graphite\_rollup](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) используются в таблицах с движками [\*GraphiteMergeTree](../engines/table-engines/mergetree-family/graphitemergetree.md). + +Столбцы: + +- `config_name` (String) - Имя параметра, используемого для `graphite_rollup`. +- `regexp` (String) - Шаблон имени метрики. +- `function` (String) - Имя агрегирующей функции. +- `age` (UInt64) - Минимальный возраст данных в секундах. +- `precision` (UInt64) - Точность определения возраста данных в секундах. +- `priority` (UInt16) - Приоритет раздела pattern. +- `is_default` (UInt8) - Является ли раздел pattern дефолтным. +- `Tables.database` (Array(String)) - Массив имён баз данных таблиц, использующих параметр `config_name`. +- `Tables.table` (Array(String)) - Массив имён таблиц, использующих параметр `config_name`. + +## system.merges {#system-merges} + +Содержит информацию о производящихся прямо сейчас слияниях и мутациях кусков для таблиц семейства MergeTree. + +Столбцы: + +- `database String` — Имя базы данных, в которой находится таблица. +- `table String` — Имя таблицы. +- `elapsed Float64` — Время в секундах, прошедшее от начала выполнения слияния. +- `progress Float64` — Доля выполненной работы от 0 до 1. +- `num_parts UInt64` — Количество сливаемых кусков. +- `result_part_name String` — Имя куска, который будет образован в результате слияния. +- `is_mutation UInt8` - Является ли данный процесс мутацией куска. +- `total_size_bytes_compressed UInt64` — Суммарный размер сжатых данных сливаемых кусков. +- `total_size_marks UInt64` — Суммарное количество засечек в сливаемых кусках. +- `bytes_read_uncompressed UInt64` — Количество прочитанных байт, разжатых. +- `rows_read UInt64` — Количество прочитанных строк. +- `bytes_written_uncompressed UInt64` — Количество записанных байт, несжатых. +- `rows_written UInt64` — Количество записанных строк. + +## system.metrics {#system_tables-metrics} + +Содержит метрики, которые могут быть рассчитаны мгновенно или имеют текущее значение. Например, число одновременно обрабатываемых запросов или текущее значение задержки реплики. Эта таблица всегда актуальна. + +Столбцы: + +- `metric` ([String](../sql-reference/data-types/string.md)) — название метрики. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — значение метрики. +- `description` ([String](../sql-reference/data-types/string.md)) — описание метрики. + +Список поддержанных метрик смотрите в файле [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp). + +**Пример** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Смотрите также** + +- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — таблица с периодически вычисляемыми метриками. +- [system.events](#system_tables-events) — таблица с количеством произошедших событий. +- [system.metric\_log](#system_tables-metric_log) — таблица фиксирующая историю значений метрик из `system.metrics` и `system.events`. +- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. + +## system.metric\_log {#system_tables-metric_log} + +Содержит историю значений метрик из таблиц `system.metrics` и `system.events`, периодически сбрасываемую на диск. +Для включения сбора истории метрик в таблице `system.metric_log` создайте `/etc/clickhouse-server/config.d/metric_log.xml` следующего содержания: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**Пример** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**Смотрите также** + +- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — таблица с периодически вычисляемыми метриками. +- [system.events](#system_tables-events) — таблица с количеством произошедших событий. +- [system.metrics](#system_tables-metrics) — таблица с мгновенно вычисляемыми метриками. +- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. + +## system.numbers {#system-numbers} + +Таблица содержит один столбец с именем number типа UInt64, содержащим почти все натуральные числа, начиная с нуля. +Эту таблицу можно использовать для тестов, а также если вам нужно сделать перебор. +Чтения из этой таблицы не распараллеливаются. + +## system.numbers\_mt {#system-numbers-mt} + +То же самое, что и system.numbers, но чтение распараллеливается. Числа могут возвращаться в произвольном порядке. +Используется для тестов. + +## system.one {#system-one} + +Таблица содержит одну строку с одним столбцом dummy типа UInt8, содержащим значение 0. +Эта таблица используется, если в SELECT запросе не указана секция FROM. +То есть, это - аналог таблицы DUAL, которую можно найти в других СУБД. + +## system.parts {#system_tables-parts} + +Содержит информацию о кусках данных таблиц семейства [MergeTree](../engines/table-engines/mergetree-family/mergetree.md). + +Каждая строка описывает один кусок данных. + +Столбцы: + +- `partition` (`String`) – Имя партиции. Что такое партиция можно узнать из описания запроса [ALTER](../sql-reference/statements/alter.md#sql_reference_queries_alter). + + Форматы: + + - `YYYYMM` для автоматической схемы партиционирования по месяцам. + - `any_string` при партиционировании вручную. + +- `name` (`String`) – имя куска. + +- `active` (`UInt8`) – признак активности. Если кусок активен, то он используется таблицей, в противном случает он будет удален. Неактивные куски остаются после слияний. + +- `marks` (`UInt64`) – количество засечек. Чтобы получить примерное количество строк в куске, умножьте `marks` на гранулированность индекса (обычно 8192). + +- `rows` (`UInt64`) – количество строк. + +- `bytes_on_disk` (`UInt64`) – общий размер всех файлов кусков данных в байтах. + +- `data_compressed_bytes` (`UInt64`) – общий размер сжатой информации в куске данных. Размер всех дополнительных файлов (например, файлов с засечками) не учитывается. + +- `data_uncompressed_bytes` (`UInt64`) – общий размер распакованной информации куска данных. Размер всех дополнительных файлов (например, файлов с засечками) не учитывается. + +- `marks_bytes` (`UInt64`) – размер файла с засечками. + +- `modification_time` (`DateTime`) – время модификации директории с куском данных. Обычно соответствует времени создания куска. + +- `remove_time` (`DateTime`) – время, когда кусок стал неактивным. + +- `refcount` (`UInt32`) – количество мест, в котором кусок используется. Значение больше 2 говорит о том, что кусок участвует в запросах или в слияниях. + +- `min_date` (`Date`) – минимальное значение ключа даты в куске данных. + +- `max_date` (`Date`) – максимальное значение ключа даты в куске данных. + +- `min_time` (`DateTime`) – минимальное значение даты и времени в куске данных. + +- `max_time`(`DateTime`) – максимальное значение даты и времени в куске данных. + +- `partition_id` (`String`) – ID партиции. + +- `min_block_number` (`UInt64`) – минимальное число кусков, из которых состоит текущий после слияния. + +- `max_block_number` (`UInt64`) – максимальное число кусков, из которых состоит текущий после слияния. + +- `level` (`UInt32`) - глубина дерева слияний. Если слияний не было, то `level=0`. + +- `data_version` (`UInt64`) – число, которое используется для определения того, какие мутации необходимо применить к куску данных (мутации с версией большей, чем `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – объём памяти (в байтах), занимаемой значениями первичных ключей. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – объём памяти (в байтах) выделенный для размещения первичных ключей. + +- `is_frozen` (`UInt8`) – Признак, показывающий существование бэкапа партиции. 1, бэкап есть. 0, бэкапа нет. Смотрите раздел [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition). + +- `database` (`String`) – имя базы данных. + +- `table` (`String`) – имя таблицы. + +- `engine` (`String`) – имя движка таблицы, без параметров. + +- `path` (`String`) – абсолютный путь к папке с файлами кусков данных. + +- `disk` (`String`) – имя диска, на котором находится кусок данных. + +- `hash_of_all_files` (`String`) – значение [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) для сжатых файлов. + +- `hash_of_uncompressed_files` (`String`) – значение [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) несжатых файлов (файлы с засечками, первичным ключом и пр.) + +- `uncompressed_hash_of_compressed_files` (`String`) – значение [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) данных в сжатых файлах как если бы они были разжатыми. + +- `bytes` (`UInt64`) – алиас для `bytes_on_disk`. + +- `marks_size` (`UInt64`) – алиас для `marks_bytes`. + +## system.part\_log {#system_tables-part-log} + +Системная таблица `system.part_log` создается только в том случае, если задана серверная настройка [part\_log](server-configuration-parameters/settings.md#server_configuration_parameters-part-log). + +Содержит информацию о всех событиях, произошедших с [кусками данных](../engines/table-engines/mergetree-family/custom-partitioning-key.md) таблиц семейства [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) (например, события добавления, удаления или слияния данных). + +Столбцы: + +- `event_type` (Enum) — тип события. Столбец может содержать одно из следующих значений: + - `NEW_PART` — вставка нового куска. + - `MERGE_PARTS` — слияние кусков. + - `DOWNLOAD_PART` — загрузка с реплики. + - `REMOVE_PART` — удаление или отсоединение из таблицы с помощью [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — изменение куска. + - `MOVE_PART` — перемещение куска между дисками. +- `event_date` (Date) — дата события. +- `event_time` (DateTime) — время события. +- `duration_ms` (UInt64) — длительность. +- `database` (String) — имя базы данных, в которой находится кусок. +- `table` (String) — имя таблицы, в которой находится кусок. +- `part_name` (String) — имя куска. +- `partition_id` (String) — идентификатор партиции, в которую был добавлен кусок. В столбце будет значение ‘all’, если таблица партициируется по выражению `tuple()`. +- `rows` (UInt64) — число строк в куске. +- `size_in_bytes` (UInt64) — размер куска данных в байтах. +- `merged_from` (Array(String)) — массив имён кусков, из которых образован текущий кусок в результате слияния (также столбец заполняется в случае скачивания уже смерженного куска). +- `bytes_uncompressed` (UInt64) — количество прочитанных разжатых байт. +- `read_rows` (UInt64) — сколько было прочитано строк при слиянии кусков. +- `read_bytes` (UInt64) — сколько было прочитано байт при слиянии кусков. +- `error` (UInt16) — код ошибки, возникшей при текущем событии. +- `exception` (String) — текст ошибки. + +Системная таблица `system.part_log` будет создана после первой вставки данных в таблицу `MergeTree`. + +## system.processes {#system_tables-processes} + +Используется для реализации запроса `SHOW PROCESSLIST`. + +Столбцы: + +- `user` (String) – пользователь, инициировавший запрос. При распределённом выполнении запросы отправляются на удалённые серверы от имени пользователя `default`. Поле содержит имя пользователя для конкретного запроса, а не для запроса, который иницировал этот запрос. +- `address` (String) – IP-адрес, с которого пришёл запрос. При распределённой обработке запроса аналогично. Чтобы определить откуда запрос пришел изначально, необходимо смотреть таблицу `system.processes` на сервере-источнике запроса. +- `elapsed` (Float64) – время в секундах с начала обработки запроса. +- `rows_read` (UInt64) – количество прочитанных строк. При распределённой обработке запроса на сервере-инициаторе запроса представляет собой сумму по всем удалённым серверам. +- `bytes_read` (UInt64) – количество прочитанных из таблиц байт, в несжатом виде. При распределённой обработке запроса на сервере-инициаторе запроса представляет собой сумму по всем удалённым серверам. +- `total_rows_approx` (UInt64) – приблизительная оценка общего количества строк, которые должны быть прочитаны. При распределённой обработке запроса, на сервере-инициаторе запроса, представляет собой сумму по всем удалённым серверам. Может обновляться в процессе выполнения запроса, когда становятся известны новые источники для обработки. +- `memory_usage` (UInt64) – потребление памяти запросом. Может не учитывать некоторые виды выделенной памяти. Смотрите описание настройки [max\_memory\_usage](../operations/settings/query-complexity.md#settings_max_memory_usage). +- `query` (String) – текст запроса. Для запросов `INSERT` не содержит встаявляемые данные. +- `query_id` (String) – идентификатор запроса, если был задан. + +## system.query\_log {#system_tables-query_log} + +Содержит информацию о выполнении запросов. Для каждого запроса вы можете увидеть время начала обработки, продолжительность обработки, сообщения об ошибках и другую информацию. + +!!! note "Внимание" + Таблица не содержит входных данных для запросов `INSERT`. + +ClickHouse создаёт таблицу только в том случае, когда установлен конфигурационный параметр сервера [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log). Параметр задаёт правила ведения лога, такие как интервал логирования или имя таблицы, в которую будут логгироваться запросы. + +Чтобы включить логирование, задайте значение параметра [log\_queries](settings/settings.md#settings-log-queries) равным 1. Подробности смотрите в разделе [Настройки](settings/settings.md). + +Таблица `system.query_log` содержит информацию о двух видах запросов: + +1. Первоначальные запросы, которые были выполнены непосредственно клиентом. +2. Дочерние запросы, инициированные другими запросами (для выполнения распределенных запросов). Для дочерних запросов информация о первоначальном запросе содержится в столбцах `initial_*`. + +Столбцы: + +- `type` (`Enum8`) — тип события, произошедшего при выполнении запроса. Значения: + - `'QueryStart' = 1` — успешное начало выполнения запроса. + - `'QueryFinish' = 2` — успешное завершение выполнения запроса. + - `'ExceptionBeforeStart' = 3` — исключение перед началом обработки запроса. + - `'ExceptionWhileProcessing' = 4` — исключение во время обработки запроса. +- `event_date` (Date) — дата начала запроса. +- `event_time` (DateTime) — время начала запроса. +- `query_start_time` (DateTime) — время начала обработки запроса. +- `query_duration_ms` (UInt64) — длительность обработки запроса. +- `read_rows` (UInt64) — количество прочитанных строк. +- `read_bytes` (UInt64) — количество прочитанных байтов. +- `written_rows` (UInt64) — количество записанных строк для запросов `INSERT`. Для других запросов, значение столбца 0. +- `written_bytes` (UInt64) — объём записанных данных в байтах для запросов `INSERT`. Для других запросов, значение столбца 0. +- `result_rows` (UInt64) — количество строк в результате. +- `result_bytes` (UInt64) — объём результата в байтах. +- `memory_usage` (UInt64) — потребление RAM запросом. +- `query` (String) — текст запроса. +- `exception` (String) — сообщение исключения, если запрос завершился по исключению. +- `stack_trace` (String) — трассировка (список функций, последовательно вызванных перед ошибкой). Пустая строка, если запрос успешно завершен. +- `is_initial_query` (UInt8) — вид запроса. Возможные значения: + - 1 — запрос был инициирован клиентом. + - 0 — запрос был инициирован другим запросом при распределенном запросе. +- `user` (String) — пользователь, запустивший текущий запрос. +- `query_id` (String) — ID запроса. +- `address` (IPv6) — IP адрес, с которого пришел запрос. +- `port` (UInt16) — порт, с которого клиент сделал запрос +- `initial_user` (String) — пользователь, запустивший первоначальный запрос (для распределенных запросов). +- `initial_query_id` (String) — ID родительского запроса. +- `initial_address` (IPv6) — IP адрес, с которого пришел родительский запрос. +- `initial_port` (UInt16) — порт, с которого клиент сделал родительский запрос. +- `interface` (UInt8) — интерфейс, с которого ушёл запрос. Возможные значения: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — имя пользователя в OS, который запустил [clickhouse-client](../interfaces/cli.md). +- `client_hostname` (String) — имя сервера, с которого присоединился [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. +- `client_name` (String) — [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. +- `client_revision` (UInt32) — ревизия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `client_version_major` (UInt32) — старшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `client_version_minor` (UInt32) — младшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `client_version_patch` (UInt32) — патч [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `http_method` (UInt8) — HTTP метод, инициировавший запрос. Возможные значения: + - 0 — запрос запущен с интерфейса TCP. + - 1 — `GET`. + - 2 — `POST`. +- `http_user_agent` (String) — HTTP заголовок `UserAgent`. +- `quota_key` (String) — «ключ квоты» из настроек [квот](quotas.md) (см. `keyed`). +- `revision` (UInt32) — ревизия ClickHouse. +- `thread_numbers` (Array(UInt32)) — количество потоков, участвующих в обработке запросов. +- `ProfileEvents.Names` (Array(String)) — Счетчики для изменения различных метрик. Описание метрик можно получить из таблицы [system.events](#system_tables-events)(\#system\_tables-events +- `ProfileEvents.Values` (Array(UInt64)) — метрики, перечисленные в столбце `ProfileEvents.Names`. +- `Settings.Names` (Array(String)) — имена настроек, которые меняются, когда клиент выполняет запрос. Чтобы разрешить логирование изменений настроек, установите параметр `log_query_settings` равным 1. +- `Settings.Values` (Array(String)) — Значения настроек, которые перечислены в столбце `Settings.Names`. + +Каждый запрос создаёт одну или две строки в таблице `query_log`, в зависимости от статуса запроса: + +1. Если запрос выполнен успешно, создаются два события типа 1 и 2 (смотрите столбец `type`). +2. Если во время обработки запроса произошла ошибка, создаются два события с типами 1 и 4. +3. Если ошибка произошла до запуска запроса, создается одно событие с типом 3. + +По умолчанию, строки добавляются в таблицу логирования с интервалом в 7,5 секунд. Можно задать интервал в конфигурационном параметре сервера [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) (смотрите параметр `flush_interval_milliseconds`). Чтобы принудительно записать логи из буффера памяти в таблицу, используйте запрос `SYSTEM FLUSH LOGS`. + +Если таблицу удалить вручную, она пересоздастся автоматически «на лету». При этом все логи на момент удаления таблицы будут удалены. + +!!! note "Примечание" + Срок хранения логов не ограничен. Логи не удаляются из таблицы автоматически. Вам необходимо самостоятельно организовать удаление устаревших логов. + +Можно указать произвольный ключ партиционирования для таблицы `system.query_log` в конфигурации [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) (параметр `partition_by`). + +## system.query\_log {#system_tables-query_log} + +Contains information about execution of queries. For each query, you can see processing start time, duration of processing, error messages and other information. + +!!! note "Note" + The table doesn’t contain input data for `INSERT` queries. + +ClickHouse creates this table only if the [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) server parameter is specified. This parameter sets the logging rules, such as the logging interval or the name of the table the queries will be logged in. + +To enable query logging, set the [log\_queries](settings/settings.md#settings-log-queries) parameter to 1. For details, see the [Settings](settings/settings.md) section. + +The `system.query_log` table registers two kinds of queries: + +1. Initial queries that were run directly by the client. +2. Child queries that were initiated by other queries (for distributed query execution). For these types of queries, information about the parent queries is shown in the `initial_*` columns. + +Columns: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` queries, the number of written rows. For other queries, the column value is 0. +- `written_bytes` (UInt64) — For `INSERT` queries, the number of written bytes. For other queries, the column value is 0. +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) or another TCP client is run. +- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) or another TCP client name. +- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. +- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) or another TCP client version. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` method was used. + - 2 — `POST` method was used. +- `http_user_agent` (String) — The `UserAgent` header passed in the HTTP request. +- `quota_key` (String) — The «quota key» specified in the [quotas](quotas.md) setting (see `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [system.events](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` column. +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parameter to 1. +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` column. + +Each query creates one or two rows in the `query_log` table, depending on the status of the query: + +1. If the query execution is successful, two events with types 1 and 2 are created (see the `type` column). +2. If an error occurred during query processing, two events with types 1 and 4 are created. +3. If an error occurred before launching the query, a single event with type 3 is created. + +By default, logs are added to the table at intervals of 7.5 seconds. You can set this interval in the [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `flush_interval_milliseconds` parameter). To flush the logs forcibly from the memory buffer into the table, use the `SYSTEM FLUSH LOGS` query. + +When the table is deleted manually, it will be automatically created on the fly. Note that all the previous logs will be deleted. + +!!! note "Note" + The storage period for logs is unlimited. Logs aren’t automatically deleted from the table. You need to organize the removal of outdated logs yourself. + +You can specify an arbitrary partitioning key for the `system.query_log` table in the [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `partition_by` parameter). +\#\# system.query\_thread\_log {\#system\_tables-query-thread-log} + +Содержит информацию о каждом потоке выполняемых запросов. + +ClickHouse создаёт таблицу только в том случае, когда установлен конфигурационный параметр сервера [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log). Параметр задаёт правила ведения лога, такие как интервал логирования или имя таблицы, в которую будут логгироваться запросы. + +Чтобы включить логирование, задайте значение параметра [log\_query\_threads](settings/settings.md#settings-log-query-threads) равным 1. Подробности смотрите в разделе [Настройки](settings/settings.md). + +Столбцы: + +- `event_date` (Date) — дата завершения выполнения запроса потоком. +- `event_time` (DateTime) — дата и время завершения выполнения запроса потоком. +- `query_start_time` (DateTime) — время начала обработки запроса. +- `query_duration_ms` (UInt64) — длительность обработки запроса в миллисекундах. +- `read_rows` (UInt64) — количество прочитанных строк. +- `read_bytes` (UInt64) — количество прочитанных байтов. +- `written_rows` (UInt64) — количество записанных строк для запросов `INSERT`. Для других запросов, значение столбца 0. +- `written_bytes` (UInt64) — объём записанных данных в байтах для запросов `INSERT`. Для других запросов, значение столбца 0. +- `memory_usage` (Int64) — разница между выделенной и освобождённой памятью в контексте потока. +- `peak_memory_usage` (Int64) — максимальная разница между выделенной и освобождённой памятью в контексте потока. +- `thread_name` (String) — Имя потока. +- `thread_id` (UInt64) — tid (ID потока операционной системы). +- `master_thread_id` (UInt64) — tid (ID потока операционной системы) главного потока. +- `query` (String) — текст запроса. +- `is_initial_query` (UInt8) — вид запроса. Возможные значения: + - 1 — запрос был инициирован клиентом. + - 0 — запрос был инициирован другим запросом при распределенном запросе. +- `user` (String) — пользователь, запустивший текущий запрос. +- `query_id` (String) — ID запроса. +- `address` (IPv6) — IP адрес, с которого пришел запрос. +- `port` (UInt16) — порт, с которого пришел запрос. +- `initial_user` (String) — пользователь, запустивший первоначальный запрос (для распределенных запросов). +- `initial_query_id` (String) — ID родительского запроса. +- `initial_address` (IPv6) — IP адрес, с которого пришел родительский запрос. +- `initial_port` (UInt16) — порт, пришел родительский запрос. +- `interface` (UInt8) — интерфейс, с которого ушёл запрос. Возможные значения: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — имя пользователя в OS, который запустил [clickhouse-client](../interfaces/cli.md). +- `client_hostname` (String) — hostname клиентской машины, с которой присоединился [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. +- `client_name` (String) — [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. +- `client_revision` (UInt32) — ревизия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `client_version_major` (UInt32) — старшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `client_version_minor` (UInt32) — младшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `client_version_patch` (UInt32) — патч [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. +- `http_method` (UInt8) — HTTP метод, инициировавший запрос. Возможные значения: + - 0 — запрос запущен с интерфейса TCP. + - 1 — `GET`. + - 2 — `POST`. +- `http_user_agent` (String) — HTTP заголовок `UserAgent`. +- `quota_key` (String) — «ключ квоты» из настроек [квот](quotas.md) (см. `keyed`). +- `revision` (UInt32) — ревизия ClickHouse. +- `ProfileEvents.Names` (Array(String)) — Счетчики для изменения различных метрик для данного потока. Описание метрик можно получить из таблицы [system.events](#system_tables-events)(\#system\_tables-events +- `ProfileEvents.Values` (Array(UInt64)) — метрики для данного потока, перечисленные в столбце `ProfileEvents.Names`. + +По умолчанию, строки добавляются в таблицу логирования с интервалом в 7,5 секунд. Можно задать интервал в конфигурационном параметре сервера [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) (смотрите параметр `flush_interval_milliseconds`). Чтобы принудительно записать логи из буффера памяти в таблицу, используйте запрос `SYSTEM FLUSH LOGS`. + +Если таблицу удалить вручную, она пересоздастся автоматически «на лету». При этом все логи на момент удаления таблицы будут удалены. + +!!! note "Примечание" + Срок хранения логов не ограничен. Логи не удаляются из таблицы автоматически. Вам необходимо самостоятельно организовать удаление устаревших логов. + +Можно указать произвольный ключ партиционирования для таблицы `system.query_log` в конфигурации [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) (параметр `partition_by`). + +## system.trace\_log {#system_tables-trace_log} + +Contains stack traces collected by the sampling query profiler. + +ClickHouse creates this table when the [trace\_log](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) server configuration section is set. Also the [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) and [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) settings should be set. + +To analyze logs, use the `addressToLine`, `addressToSymbol` and `demangle` introspection functions. + +Columns: + +- `event_date`([Date](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time`([DateTime](../sql-reference/data-types/datetime.md)) — Timestamp of sampling moment. + +- `revision`([UInt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + When connecting to server by `clickhouse-client`, you see the string similar to `Connected to ClickHouse server version 19.18.1 revision 54429.`. This field contains the `revision`, but not the `version` of a server. + +- `timer_type`([Enum8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` represents wall-clock time. + - `CPU` represents CPU time. + +- `thread_number`([UInt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id`([String](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) system table. + +- `trace`([Array(UInt64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**Example** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## system.replicas {#system_tables-replicas} + +Содержит информацию и статус для реплицируемых таблиц, расположенных на локальном сервере. +Эту таблицу можно использовать для мониторинга. Таблица содержит по строчке для каждой Replicated\*-таблицы. + +Пример: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +Столбцы: + +- `database` (`String`) - имя БД. +- `table` (`String`) - имя таблицы. +- `engine` (`String`) - имя движка таблицы. +- `is_leader` (`UInt8`) - является ли реплика лидером. + В один момент времени, не более одной из реплик является лидером. Лидер отвечает за выбор фоновых слияний, которые следует произвести. + Замечу, что запись можно осуществлять на любую реплику (доступную и имеющую сессию в ZK), независимо от лидерства. +- `can_become_leader` (`UInt8`) - может ли реплика быть выбрана лидером. +- `is_readonly` (`UInt8`) - находится ли реплика в режиме «только для чтения» + Этот режим включается, если в конфиге нет секции с ZK; если при переинициализации сессии в ZK произошла неизвестная ошибка; во время переинициализации сессии с ZK. +- `is_session_expired` (`UInt8`) - истекла ли сессия с ZK. В основном, то же самое, что и `is_readonly`. +- `future_parts` (`UInt32`) - количество кусков с данными, которые появятся в результате INSERT-ов или слияний, которых ещё предстоит сделать +- `parts_to_check` (`UInt32`) - количество кусков с данными в очереди на проверку. Кусок помещается в очередь на проверку, если есть подозрение, что он может быть битым. +- `zookeeper_path` (`String`) - путь к данным таблицы в ZK. +- `replica_name` (`String`) - имя реплики в ZK; разные реплики одной таблицы имеют разное имя. +- `replica_path` (`String`) - путь к данным реплики в ZK. То же самое, что конкатенация zookeeper\_path/replicas/replica\_path. +- `columns_version` (`Int32`) - номер версии структуры таблицы. Обозначает, сколько раз был сделан ALTER. Если на репликах разные версии, значит некоторые реплики сделали ещё не все ALTER-ы. +- `queue_size` (`UInt32`) - размер очереди действий, которые предстоит сделать. К действиям относятся вставки блоков данных, слияния, и некоторые другие действия. Как правило, совпадает с future\_parts. +- `inserts_in_queue` (`UInt32`) - количество вставок блоков данных, которые предстоит сделать. Обычно вставки должны быстро реплицироваться. Если величина большая - значит что-то не так. +- `merges_in_queue` (`UInt32`) - количество слияний, которые предстоит сделать. Бывают длинные слияния - то есть, это значение может быть больше нуля продолжительное время. +- `part_mutations_in_queue` (`UInt32`) - количество мутаций, которые предстоит сделать. +- `queue_oldest_time` (`DateTime`) - если `queue_size` больше 0, показывает, когда была добавлена в очередь самая старая операция. +- `inserts_oldest_time` (`DateTime`) - см. `queue_oldest_time`. +- `merges_oldest_time` (`DateTime`) - см. `queue_oldest_time`. +- `part_mutations_oldest_time` (`DateTime`) - см. `queue_oldest_time`. + +Следующие 4 столбца имеют ненулевое значение только если активна сессия с ZK. + +- `log_max_index` (`UInt64`) - максимальный номер записи в общем логе действий. +- `log_pointer` (`UInt64`) - максимальный номер записи из общего лога действий, которую реплика скопировала в свою очередь для выполнения, плюс единица. Если log\_pointer сильно меньше log\_max\_index, значит что-то не так. +- `last_queue_update` (`DateTime`) - When the queue was updated last time. +- `absolute_delay` (`UInt64`) - How big lag in seconds the current replica has. +- `total_replicas` (`UInt8`) - общее число известных реплик этой таблицы. +- `active_replicas` (`UInt8`) - число реплик этой таблицы, имеющих сессию в ZK; то есть, число работающих реплик. + +Если запрашивать все столбцы, то таблица может работать слегка медленно, так как на каждую строчку делается несколько чтений из ZK. +Если не запрашивать последние 4 столбца (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), то таблица работает быстро. + +Например, так можно проверить, что всё хорошо: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +Если этот запрос ничего не возвращает - значит всё хорошо. + +## system.settings {#system-tables-system-settings} + +Содержит информацию о сессионных настройках для текущего пользователя. + +Столбцы: + +- `name` ([String](../sql-reference/data-types/string.md)) — имя настройки. +- `value` ([String](../sql-reference/data-types/string.md)) — значение настройки. +- `changed` ([UInt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — показывает, изменена ли настройка по отношению к значению по умолчанию. +- `description` ([String](../sql-reference/data-types/string.md)) — краткое описание настройки. +- `min` ([Nullable](../sql-reference/data-types/nullable.md)([String](../sql-reference/data-types/string.md))) — минимальное значение настройки, если задано [ограничение](settings/constraints-on-settings.md#constraints-on-settings). Если нет, то поле содержит [NULL](../sql-reference/syntax.md#null-literal). +- `max` ([Nullable](../sql-reference/data-types/nullable.md)([String](../sql-reference/data-types/string.md))) — максимальное значение настройки, если задано [ограничение](settings/constraints-on-settings.md#constraints-on-settings). Если нет, то поле содержит [NULL](../sql-reference/syntax.md#null-literal). +- `readonly` ([UInt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — Показывает, может ли пользователь изменять настройку: + - `0` — Текущий пользователь может изменять настройку. + - `1` — Текущий пользователь не может изменять настройку. + +**Пример** + +Пример показывает как получить информацию о настройках, имена которых содержат `min_i`. + +``` sql +SELECT * +FROM system.settings +WHERE name LIKE '%min_i%' +``` + +``` text +┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ +│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ +``` + +Использование `WHERE changed` может быть полезно, например, если необходимо проверить: + +- Что настройки корректно загрузились из конфигурационного файла и используются. +- Настройки, изменённые в текущей сессии. + + + +``` sql +SELECT * FROM system.settings WHERE changed AND name='load_balancing' +``` + +**Cм. также** + +- [Настройки](settings/index.md#settings) +- [Разрешения для запросов](settings/permissions-for-queries.md#settings_readonly) +- [Ограничения для значений настроек](settings/constraints-on-settings.md) + +## system.table\_engines {#system.table_engines} + +``` text +┌─name───────────────────┬─value───────┬─changed─┐ +│ max_threads │ 8 │ 1 │ +│ use_uncompressed_cache │ 0 │ 1 │ +│ load_balancing │ random │ 1 │ +│ max_memory_usage │ 10000000000 │ 1 │ +└────────────────────────┴─────────────┴─────────┘ +``` + +## system.table\_engines {#system-table-engines} + +Содержит информацию про движки таблиц, поддерживаемые сервером, а также об их возможностях. + +Эта таблица содержит следующие столбцы (тип столбца показан в скобках): + +- `name` (String) — имя движка. +- `supports_settings` (UInt8) — флаг, показывающий поддержку секции `SETTINGS`. +- `supports_skipping_indices` (UInt8) — флаг, показывающий поддержку [индексов пропуска данных](table_engines/mergetree/#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — флаг, показывающий поддержку [TTL](table_engines/mergetree/#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — флаг, показывающий поддержку секций `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` и `SAMPLE_BY`. +- `supports_replication` (UInt8) — флаг, показвыающий поддержку [репликации](table_engines/replication/). +- `supports_duduplication` (UInt8) — флаг, показывающий наличие в движке дедупликации данных. + +Пример: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**Смотрите также** + +- [Секции движка](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) семейства MergeTree +- [Настройки](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) Kafka +- [Настройки](../engines/table-engines/special/join.md#join-limitations-and-settings) Join + +## system.tables {#system-tables} + +Содержит метаданные каждой таблицы, о которой знает сервер. Отсоединённые таблицы не отображаются в `system.tables`. + +Эта таблица содержит следующие столбцы (тип столбца показан в скобках): + +- `database String` — имя базы данных, в которой находится таблица. +- `name` (String) — имя таблицы. +- `engine` (String) — движок таблицы (без параметров). +- `is_temporary` (UInt8) — флаг, указывающий на то, временная это таблица или нет. +- `data_path` (String) — путь к данным таблицы в файловой системе. +- `metadata_path` (String) — путь к табличным метаданным в файловой системе. +- `metadata_modification_time` (DateTime) — время последней модификации табличных метаданных. +- `dependencies_database` (Array(String)) — зависимости базы данных. +- `dependencies_table` (Array(String)) — табличные зависимости (таблицы [MaterializedView](../engines/table-engines/special/materializedview.md), созданные на базе текущей таблицы). +- `create_table_query` (String) — запрос, которым создавалась таблица. +- `engine_full` (String) — параметры табличного движка. +- `partition_key` (String) — ключ партиционирования таблицы. +- `sorting_key` (String) — ключ сортировки таблицы. +- `primary_key` (String) - первичный ключ таблицы. +- `sampling_key` (String) — ключ сэмплирования таблицы. + +Таблица `system.tables` используется при выполнении запроса `SHOW TABLES`. + +## system.zookeeper {#system-zookeeper} + +Таблицы не существует, если ZooKeeper не сконфигурирован. Позволяет читать данные из ZooKeeper кластера, описанного в конфигурации. +В запросе обязательно в секции WHERE должно присутствовать условие на равенство path - путь в ZooKeeper, для детей которого вы хотите получить данные. + +Запрос `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` выведет данные по всем детям узла `/clickhouse`. +Чтобы вывести данные по всем узлам в корне, напишите path = ‘/’. +Если узла, указанного в path не существует, то будет брошено исключение. + +Столбцы: + +- `name String` — Имя узла. +- `path String` — Путь к узлу. +- `value String` — Значение узла. +- `dataLength Int32` — Размер значения. +- `numChildren Int32` — Количество детей. +- `czxid Int64` — Идентификатор транзакции, в которой узел был создан. +- `mzxid Int64` — Идентификатор транзакции, в которой узел был последний раз изменён. +- `pzxid Int64` — Идентификатор транзакции, последний раз удаливший или добавивший детей. +- `ctime DateTime` — Время создания узла. +- `mtime DateTime` — Время последней модификации узла. +- `version Int32` — Версия узла - количество раз, когда узел был изменён. +- `cversion Int32` — Количество добавлений или удалений детей. +- `aversion Int32` — Количество изменений ACL. +- `ephemeralOwner Int64` — Для эфемерных узлов - идентификатор сессии, которая владеет этим узлом. + +Пример: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## system.mutations {#system_tables-mutations} + +Таблица содержит информацию о ходе выполнения [мутаций](../sql-reference/statements/alter.md#alter-mutations) MergeTree-таблиц. Каждой команде мутации соответствует одна строка. В таблице есть следующие столбцы: + +**database**, **table** - имя БД и таблицы, к которой была применена мутация. + +**mutation\_id** - ID запроса. Для реплицированных таблиц эти ID соответствуют именам записей в директории `/mutations/` в ZooKeeper, для нереплицированных - именам файлов в директории с данными таблицы. + +**command** - Команда мутации (часть запроса после `ALTER TABLE [db.]table`). + +**create\_time** - Время создания мутации. + +**block\_numbers.partition\_id**, **block\_numbers.number** - Nested-столбец. Для мутаций реплицированных таблиц для каждой партиции содержит номер блока, полученный этой мутацией (в каждой партиции будут изменены только куски, содержащие блоки с номерами, меньшими номера, полученного мутацией в этой партиции). Для нереплицированных таблиц нумерация блоков сквозная по партициям, поэтому столбец содержит одну запись с единственным номером блока, полученным мутацией. + +**parts\_to\_do** - Количество кусков таблицы, которые ещё предстоит изменить. + +**is\_done** - Завершена ли мутация. Замечание: даже если `parts_to_do = 0`, для реплицированной таблицы возможна ситуация, когда мутация ещё не завершена из-за долго выполняющейся вставки, которая добавляет данные, которые нужно будет мутировать. + +Если во время мутации какого-либо куска возникли проблемы, заполняются следующие столбцы: + +**latest\_failed\_part** - Имя последнего куска, мутация которого не удалась. + +**latest\_fail\_time** — время последней ошибки мутации. + +**latest\_fail\_reason** — причина последней ошибки мутации. + +## system.disks {#system_tables-disks} + +Cодержит информацию о дисках, заданных в [конфигурации сервера](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Столбцы: + +- `name` ([String](../sql-reference/data-types/string.md)) — имя диска в конфигурации сервера. +- `path` ([String](../sql-reference/data-types/string.md)) — путь к точке монтирования в файловой системе. +- `free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — свободное место на диске в байтах. +- `total_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — объём диска в байтах. +- `keep_free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — место, которое должно остаться свободным на диске в байтах. Задаётся значением параметра `keep_free_space_bytes` конфигурации дисков. + +## system.storage\_policies {#system_tables-storage_policies} + +Содержит информацию о политиках хранения и томах, заданных в [конфигурации сервера](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Столбцы: + +- `policy_name` ([String](../sql-reference/data-types/string.md)) — имя политики хранения. +- `volume_name` ([String](../sql-reference/data-types/string.md)) — имя тома, который содержится в политике хранения. +- `volume_priority` ([UInt64](../sql-reference/data-types/int-uint.md)) — порядковый номер тома согласно конфигурации. +- `disks` ([Array(String)](../sql-reference/data-types/array.md)) — имена дисков, содержащихся в политике хранения. +- `max_data_part_size` ([UInt64](../sql-reference/data-types/int-uint.md)) — максимальный размер куска данных, который может храниться на дисках тома (0 — без ограничений). +- `move_factor` ([Float64](../sql-reference/data-types/float.md))\` — доля свободного места, при превышении которой данные начинают перемещаться на следующий том. + +Если политика хранения содержит несколько томов, то каждому тому соответствует отдельная запись в таблице. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/system_tables/) diff --git a/docs/ru/operations/system_tables.md b/docs/ru/operations/system_tables.md deleted file mode 100644 index b68aa570f52..00000000000 --- a/docs/ru/operations/system_tables.md +++ /dev/null @@ -1,1170 +0,0 @@ -# Системные таблицы {#sistemnye-tablitsy} - -Системные таблицы используются для реализации части функциональности системы, а также предоставляют доступ к информации о работе системы. -Вы не можете удалить системную таблицу (хотя можете сделать DETACH). -Для системных таблиц нет файлов с данными на диске и файлов с метаданными. Сервер создаёт все системные таблицы при старте. -В системные таблицы нельзя записывать данные - можно только читать. -Системные таблицы расположены в базе данных system. - -## system.asynchronous\_metrics {#system_tables-asynchronous_metrics} - -Содержит метрики, которые периодически вычисляются в фоновом режиме. Например, объём используемой оперативной памяти. - -Столбцы: - -- `metric` ([String](../sql_reference/data_types/string.md)) — название метрики. -- `value` ([Float64](../sql_reference/data_types/float.md)) — значение метрики. - -**Пример** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**Смотрите также** - -- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. -- [system.metrics](#system_tables-metrics) — таблица с мгновенно вычисляемыми метриками. -- [system.events](#system_tables-events) — таблица с количеством произошедших событий. -- [system.metric\_log](#system_tables-metric_log) — таблица фиксирующая историю значений метрик из `system.metrics` и `system.events`. - -## system.clusters {#system-clusters} - -Содержит информацию о доступных в конфигурационном файле кластерах и серверах, которые в них входят. -Столбцы: - -``` text -cluster String — имя кластера. -shard_num UInt32 — номер шарда в кластере, начиная с 1. -shard_weight UInt32 — относительный вес шарда при записи данных -replica_num UInt32 — номер реплики в шарде, начиная с 1. -host_name String — хост, указанный в конфигурации. -host_address String — IP-адрес хоста, полученный из DNS. -port UInt16 — порт, на который обращаться для соединения с сервером. -user String — имя пользователя, которого использовать для соединения с сервером. -``` - -## system.columns {#system-columns} - -Содержит информацию о столбцах всех таблиц. - -С помощью этой таблицы можно получить информацию аналогично запросу [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table), но для многих таблиц сразу. - -Таблица `system.columns` содержит столбцы (тип столбца указан в скобках): - -- `database` (String) — имя базы данных. -- `table` (String) — имя таблицы. -- `name` (String) — имя столбца. -- `type` (String) — тип столбца. -- `default_kind` (String) — тип выражения (`DEFAULT`, `MATERIALIZED`, `ALIAS`) значения по умолчанию, или пустая строка. -- `default_expression` (String) — выражение для значения по умолчанию или пустая строка. -- `data_compressed_bytes` (UInt64) — размер сжатых данных в байтах. -- `data_uncompressed_bytes` (UInt64) — размер распакованных данных в байтах. -- `marks_bytes` (UInt64) — размер засечек в байтах. -- `comment` (String) — комментарий к столбцу или пустая строка. -- `is_in_partition_key` (UInt8) — флаг, показывающий включение столбца в ключ партиционирования. -- `is_in_sorting_key` (UInt8) — флаг, показывающий включение столбца в ключ сортировки. -- `is_in_primary_key` (UInt8) — флаг, показывающий включение столбца в первичный ключ. -- `is_in_sampling_key` (UInt8) — флаг, показывающий включение столбца в ключ выборки. - -## system.contributors {#system-contributors} - -Содержит информацию о контрибьютерах. Контрибьютеры расположены в таблице в случайном порядке. Порядок определяется заново при каждом запросе. - -Столбцы: - -- `name` (String) — Имя контрибьютера (автора коммита) из git log. - -**Пример** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -Чтобы найти себя в таблице, выполните запрос: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## system.databases {#system-databases} - -Таблица содержит один столбец name типа String - имя базы данных. -Для каждой базы данных, о которой знает сервер, будет присутствовать соответствующая запись в таблице. -Эта системная таблица используется для реализации запроса `SHOW DATABASES`. - -## system.detached\_parts {#system_tables-detached_parts} - -Содержит информацию об отсоединённых кусках таблиц семейства [MergeTree](../engines/table_engines/mergetree_family/mergetree.md). Столбец `reason` содержит причину, по которой кусок был отсоединён. Для кусов, отсоединённых пользователем, `reason` содержит пустую строку. -Такие куски могут быть присоединены с помощью [ALTER TABLE ATTACH PARTITION\|PART](../sql_reference/alter/#alter_attach-partition). Остальные столбцы описаны в [system.parts](#system_tables-parts). -Если имя куска некорректно, значения некоторых столбцов могут быть `NULL`. Такие куски могут быть удалены с помощью [ALTER TABLE DROP DETACHED PART](../sql_reference/alter/#alter_drop-detached). - -## system.dictionaries {#system_tables-dictionaries} - -Содержит информацию о [внешних словарях](../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -Столбцы: - -- `database` ([String](../sql_reference/data_types/string.md)) — Имя базы данных, в которой находится словарь, созданный с помощью DDL-запроса. Пустая строка для других словарей. -- `name` ([String](../sql_reference/data_types/string.md)) — [Имя словаря](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md). -- `status` ([Enum8](../sql_reference/data_types/enum.md)) — Статус словаря. Возможные значения: - - `NOT_LOADED` — Словарь не загружен, потому что не использовался. - - `LOADED` — Словарь загружен успешно. - - `FAILED` — Словарь не загружен в результате ошибки. - - `LOADING` — Словарь в процессе загрузки. - - `LOADED_AND_RELOADING` — Словарь загружен успешно, сейчас перезагружается (частые причины: запрос [SYSTEM RELOAD DICTIONARY](../sql_reference/statements/system.md#query_language-system-reload-dictionary), таймаут, изменение настроек словаря). - - `FAILED_AND_RELOADING` — Словарь не загружен в результате ошибки, сейчас перезагружается. -- `origin` ([String](../sql_reference/data_types/string.md)) — Путь к конфигурационному файлу, описывающему словарь. -- `type` ([String](../sql_reference/data_types/string.md)) — Тип размещения словаря. [Хранение словарей в памяти](../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)) или Составной ключ ([String](../sql_reference/data_types/string.md)) — строка вида “(тип 1, тип 2, …, тип n)”. -- `attribute.names` ([Array](../sql_reference/data_types/array.md)([String](../sql_reference/data_types/string.md))) — Массив [имен атрибутов](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), предоставляемых справочником. -- `attribute.types` ([Array](../sql_reference/data_types/array.md)([String](../sql_reference/data_types/string.md))) — Соответствующий массив [типов атрибутов](../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)) — Объем оперативной памяти, используемый словарем. -- `query_count` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Количество запросов с момента загрузки словаря или с момента последней успешной перезагрузки. -- `hit_rate` ([Float64](../sql_reference/data_types/float.md)) — Для cache-словарей — процент закэшированных значений. -- `element_count` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Количество элементов, хранящихся в словаре. -- `load_factor` ([Float64](../sql_reference/data_types/float.md)) — Процент заполнения словаря (для хэшированного словаря — процент заполнения хэш-таблицы). -- `source` ([String](../sql_reference/data_types/string.md)) — Текст, описывающий [источник данных](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md) для словаря. -- `lifetime_min` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Минимальное [время обновления](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md) словаря в памяти, по истечении которого Clickhouse попытается перезагрузить словарь (если задано `invalidate_query`, то только если он изменился). Задается в секундах. -- `lifetime_max` ([UInt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Максимальное [время обновления](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md) словаря в памяти, по истечении которого Clickhouse попытается перезагрузить словарь (если задано `invalidate_query`, то только если он изменился). Задается в секундах. -- `loading_start_time` ([DateTime](../sql_reference/data_types/datetime.md)) — Время начала загрузки словаря. -- `loading_duration` ([Float32](../sql_reference/data_types/float.md)) — Время, затраченное на загрузку словаря. -- `last_exception` ([String](../sql_reference/data_types/string.md)) — Текст ошибки, возникающей при создании или перезагрузке словаря, если словарь не удалось создать. - -**Пример** - -Настройте словарь. - -``` sql -CREATE DICTIONARY dictdb.dict -( - `key` Int64 DEFAULT -1, - `value_default` String DEFAULT 'world', - `value_expression` String DEFAULT 'xxx' EXPRESSION 'toString(127 * 172)' -) -PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dicttbl' DB 'dictdb')) -LIFETIME(MIN 0 MAX 1) -LAYOUT(FLAT()) -``` - -Убедитесь, что словарь загружен. - -``` sql -SELECT * FROM system.dictionaries -``` - -``` text -┌─database─┬─name─┬─status─┬─origin──────┬─type─┬─key────┬─attribute.names──────────────────────┬─attribute.types─────┬─bytes_allocated─┬─query_count─┬─hit_rate─┬─element_count─┬───────────load_factor─┬─source─────────────────────┬─lifetime_min─┬─lifetime_max─┬──loading_start_time─┌──last_successful_update_time─┬──────loading_duration─┬─last_exception─┐ -│ dictdb │ dict │ LOADED │ dictdb.dict │ Flat │ UInt64 │ ['value_default','value_expression'] │ ['String','String'] │ 74032 │ 0 │ 1 │ 1 │ 0.0004887585532746823 │ ClickHouse: dictdb.dicttbl │ 0 │ 1 │ 2020-03-04 04:17:34 │ 2020-03-04 04:30:34 │ 0.002 │ │ -└──────────┴──────┴────────┴─────────────┴──────┴────────┴──────────────────────────────────────┴─────────────────────┴─────────────────┴─────────────┴──────────┴───────────────┴───────────────────────┴────────────────────────────┴──────────────┴──────────────┴─────────────────────┴──────────────────────────────┘───────────────────────┴────────────────┘ -``` - -## system.events {#system_tables-events} - -Содержит информацию о количестве событий, произошедших в системе. Например, в таблице можно найти, сколько запросов `SELECT` обработано с момента запуска сервера ClickHouse. - -Столбцы: - -- `event` ([String](../sql_reference/data_types/string.md)) — имя события. -- `value` ([UInt64](../sql_reference/data_types/int_uint.md)) — количество произошедших событий. -- `description` ([String](../sql_reference/data_types/string.md)) — описание события. - -**Пример** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Смотрите также** - -- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — таблица с периодически вычисляемыми метриками. -- [system.metrics](#system_tables-metrics) — таблица с мгновенно вычисляемыми метриками. -- [system.metric\_log](#system_tables-metric_log) — таблица фиксирующая историю значений метрик из `system.metrics` и `system.events`. -- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. - -## system.functions {#system-functions} - -Содержит информацию об обычных и агрегатных функциях. - -Столбцы: - -- `name` (`String`) – Имя функции. -- `is_aggregate` (`UInt8`) – Признак, является ли функция агрегатной. - -## system.graphite\_retentions {#system-graphite-retentions} - -Содержит информацию о том, какие параметры [graphite\_rollup](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) используются в таблицах с движками [\*GraphiteMergeTree](../engines/table_engines/mergetree_family/graphitemergetree.md). - -Столбцы: - -- `config_name` (String) - Имя параметра, используемого для `graphite_rollup`. -- `regexp` (String) - Шаблон имени метрики. -- `function` (String) - Имя агрегирующей функции. -- `age` (UInt64) - Минимальный возраст данных в секундах. -- `precision` (UInt64) - Точность определения возраста данных в секундах. -- `priority` (UInt16) - Приоритет раздела pattern. -- `is_default` (UInt8) - Является ли раздел pattern дефолтным. -- `Tables.database` (Array(String)) - Массив имён баз данных таблиц, использующих параметр `config_name`. -- `Tables.table` (Array(String)) - Массив имён таблиц, использующих параметр `config_name`. - -## system.merges {#system-merges} - -Содержит информацию о производящихся прямо сейчас слияниях и мутациях кусков для таблиц семейства MergeTree. - -Столбцы: - -- `database String` — Имя базы данных, в которой находится таблица. -- `table String` — Имя таблицы. -- `elapsed Float64` — Время в секундах, прошедшее от начала выполнения слияния. -- `progress Float64` — Доля выполненной работы от 0 до 1. -- `num_parts UInt64` — Количество сливаемых кусков. -- `result_part_name String` — Имя куска, который будет образован в результате слияния. -- `is_mutation UInt8` - Является ли данный процесс мутацией куска. -- `total_size_bytes_compressed UInt64` — Суммарный размер сжатых данных сливаемых кусков. -- `total_size_marks UInt64` — Суммарное количество засечек в сливаемых кусках. -- `bytes_read_uncompressed UInt64` — Количество прочитанных байт, разжатых. -- `rows_read UInt64` — Количество прочитанных строк. -- `bytes_written_uncompressed UInt64` — Количество записанных байт, несжатых. -- `rows_written UInt64` — Количество записанных строк. - -## system.metrics {#system_tables-metrics} - -Содержит метрики, которые могут быть рассчитаны мгновенно или имеют текущее значение. Например, число одновременно обрабатываемых запросов или текущее значение задержки реплики. Эта таблица всегда актуальна. - -Столбцы: - -- `metric` ([String](../sql_reference/data_types/string.md)) — название метрики. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — значение метрики. -- `description` ([String](../sql_reference/data_types/string.md)) — описание метрики. - -Список поддержанных метрик смотрите в файле [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp). - -**Пример** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Смотрите также** - -- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — таблица с периодически вычисляемыми метриками. -- [system.events](#system_tables-events) — таблица с количеством произошедших событий. -- [system.metric\_log](#system_tables-metric_log) — таблица фиксирующая историю значений метрик из `system.metrics` и `system.events`. -- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. - -## system.metric\_log {#system_tables-metric_log} - -Содержит историю значений метрик из таблиц `system.metrics` и `system.events`, периодически сбрасываемую на диск. -Для включения сбора истории метрик в таблице `system.metric_log` создайте `/etc/clickhouse-server/config.d/metric_log.xml` следующего содержания: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**Пример** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**Смотрите также** - -- [system.asynchronous\_metrics](#system_tables-asynchronous_metrics) — таблица с периодически вычисляемыми метриками. -- [system.events](#system_tables-events) — таблица с количеством произошедших событий. -- [system.metrics](#system_tables-metrics) — таблица с мгновенно вычисляемыми метриками. -- [Мониторинг](monitoring.md) — основы мониторинга в ClickHouse. - -## system.numbers {#system-numbers} - -Таблица содержит один столбец с именем number типа UInt64, содержащим почти все натуральные числа, начиная с нуля. -Эту таблицу можно использовать для тестов, а также если вам нужно сделать перебор. -Чтения из этой таблицы не распараллеливаются. - -## system.numbers\_mt {#system-numbers-mt} - -То же самое, что и system.numbers, но чтение распараллеливается. Числа могут возвращаться в произвольном порядке. -Используется для тестов. - -## system.one {#system-one} - -Таблица содержит одну строку с одним столбцом dummy типа UInt8, содержащим значение 0. -Эта таблица используется, если в SELECT запросе не указана секция FROM. -То есть, это - аналог таблицы DUAL, которую можно найти в других СУБД. - -## system.parts {#system_tables-parts} - -Содержит информацию о кусках данных таблиц семейства [MergeTree](../engines/table_engines/mergetree_family/mergetree.md). - -Каждая строка описывает один кусок данных. - -Столбцы: - -- `partition` (`String`) – Имя партиции. Что такое партиция можно узнать из описания запроса [ALTER](../sql_reference/statements/alter.md#sql_reference_queries_alter). - - Форматы: - - - `YYYYMM` для автоматической схемы партиционирования по месяцам. - - `any_string` при партиционировании вручную. - -- `name` (`String`) – имя куска. - -- `active` (`UInt8`) – признак активности. Если кусок активен, то он используется таблицей, в противном случает он будет удален. Неактивные куски остаются после слияний. - -- `marks` (`UInt64`) – количество засечек. Чтобы получить примерное количество строк в куске, умножьте `marks` на гранулированность индекса (обычно 8192). - -- `rows` (`UInt64`) – количество строк. - -- `bytes_on_disk` (`UInt64`) – общий размер всех файлов кусков данных в байтах. - -- `data_compressed_bytes` (`UInt64`) – общий размер сжатой информации в куске данных. Размер всех дополнительных файлов (например, файлов с засечками) не учитывается. - -- `data_uncompressed_bytes` (`UInt64`) – общий размер распакованной информации куска данных. Размер всех дополнительных файлов (например, файлов с засечками) не учитывается. - -- `marks_bytes` (`UInt64`) – размер файла с засечками. - -- `modification_time` (`DateTime`) – время модификации директории с куском данных. Обычно соответствует времени создания куска. - -- `remove_time` (`DateTime`) – время, когда кусок стал неактивным. - -- `refcount` (`UInt32`) – количество мест, в котором кусок используется. Значение больше 2 говорит о том, что кусок участвует в запросах или в слияниях. - -- `min_date` (`Date`) – минимальное значение ключа даты в куске данных. - -- `max_date` (`Date`) – максимальное значение ключа даты в куске данных. - -- `min_time` (`DateTime`) – минимальное значение даты и времени в куске данных. - -- `max_time`(`DateTime`) – максимальное значение даты и времени в куске данных. - -- `partition_id` (`String`) – ID партиции. - -- `min_block_number` (`UInt64`) – минимальное число кусков, из которых состоит текущий после слияния. - -- `max_block_number` (`UInt64`) – максимальное число кусков, из которых состоит текущий после слияния. - -- `level` (`UInt32`) - глубина дерева слияний. Если слияний не было, то `level=0`. - -- `data_version` (`UInt64`) – число, которое используется для определения того, какие мутации необходимо применить к куску данных (мутации с версией большей, чем `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – объём памяти (в байтах), занимаемой значениями первичных ключей. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – объём памяти (в байтах) выделенный для размещения первичных ключей. - -- `is_frozen` (`UInt8`) – Признак, показывающий существование бэкапа партиции. 1, бэкап есть. 0, бэкапа нет. Смотрите раздел [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition). - -- `database` (`String`) – имя базы данных. - -- `table` (`String`) – имя таблицы. - -- `engine` (`String`) – имя движка таблицы, без параметров. - -- `path` (`String`) – абсолютный путь к папке с файлами кусков данных. - -- `disk` (`String`) – имя диска, на котором находится кусок данных. - -- `hash_of_all_files` (`String`) – значение [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) для сжатых файлов. - -- `hash_of_uncompressed_files` (`String`) – значение [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) несжатых файлов (файлы с засечками, первичным ключом и пр.) - -- `uncompressed_hash_of_compressed_files` (`String`) – значение [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) данных в сжатых файлах как если бы они были разжатыми. - -- `bytes` (`UInt64`) – алиас для `bytes_on_disk`. - -- `marks_size` (`UInt64`) – алиас для `marks_bytes`. - -## system.part\_log {#system_tables-part-log} - -Системная таблица `system.part_log` создается только в том случае, если задана серверная настройка [part\_log](server_configuration_parameters/settings.md#server_configuration_parameters-part-log). - -Содержит информацию о всех событиях, произошедших с [кусками данных](../engines/table_engines/mergetree_family/custom_partitioning_key.md) таблиц семейства [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) (например, события добавления, удаления или слияния данных). - -Столбцы: - -- `event_type` (Enum) — тип события. Столбец может содержать одно из следующих значений: - - `NEW_PART` — вставка нового куска. - - `MERGE_PARTS` — слияние кусков. - - `DOWNLOAD_PART` — загрузка с реплики. - - `REMOVE_PART` — удаление или отсоединение из таблицы с помощью [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — изменение куска. - - `MOVE_PART` — перемещение куска между дисками. -- `event_date` (Date) — дата события. -- `event_time` (DateTime) — время события. -- `duration_ms` (UInt64) — длительность. -- `database` (String) — имя базы данных, в которой находится кусок. -- `table` (String) — имя таблицы, в которой находится кусок. -- `part_name` (String) — имя куска. -- `partition_id` (String) — идентификатор партиции, в которую был добавлен кусок. В столбце будет значение ‘all’, если таблица партициируется по выражению `tuple()`. -- `rows` (UInt64) — число строк в куске. -- `size_in_bytes` (UInt64) — размер куска данных в байтах. -- `merged_from` (Array(String)) — массив имён кусков, из которых образован текущий кусок в результате слияния (также столбец заполняется в случае скачивания уже смерженного куска). -- `bytes_uncompressed` (UInt64) — количество прочитанных разжатых байт. -- `read_rows` (UInt64) — сколько было прочитано строк при слиянии кусков. -- `read_bytes` (UInt64) — сколько было прочитано байт при слиянии кусков. -- `error` (UInt16) — код ошибки, возникшей при текущем событии. -- `exception` (String) — текст ошибки. - -Системная таблица `system.part_log` будет создана после первой вставки данных в таблицу `MergeTree`. - -## system.processes {#system_tables-processes} - -Используется для реализации запроса `SHOW PROCESSLIST`. - -Столбцы: - -- `user` (String) – пользователь, инициировавший запрос. При распределённом выполнении запросы отправляются на удалённые серверы от имени пользователя `default`. Поле содержит имя пользователя для конкретного запроса, а не для запроса, который иницировал этот запрос. -- `address` (String) – IP-адрес, с которого пришёл запрос. При распределённой обработке запроса аналогично. Чтобы определить откуда запрос пришел изначально, необходимо смотреть таблицу `system.processes` на сервере-источнике запроса. -- `elapsed` (Float64) – время в секундах с начала обработки запроса. -- `rows_read` (UInt64) – количество прочитанных строк. При распределённой обработке запроса на сервере-инициаторе запроса представляет собой сумму по всем удалённым серверам. -- `bytes_read` (UInt64) – количество прочитанных из таблиц байт, в несжатом виде. При распределённой обработке запроса на сервере-инициаторе запроса представляет собой сумму по всем удалённым серверам. -- `total_rows_approx` (UInt64) – приблизительная оценка общего количества строк, которые должны быть прочитаны. При распределённой обработке запроса, на сервере-инициаторе запроса, представляет собой сумму по всем удалённым серверам. Может обновляться в процессе выполнения запроса, когда становятся известны новые источники для обработки. -- `memory_usage` (UInt64) – потребление памяти запросом. Может не учитывать некоторые виды выделенной памяти. Смотрите описание настройки [max\_memory\_usage](../operations/settings/query_complexity.md#settings_max_memory_usage). -- `query` (String) – текст запроса. Для запросов `INSERT` не содержит встаявляемые данные. -- `query_id` (String) – идентификатор запроса, если был задан. - -## system.query\_log {#system_tables-query_log} - -Содержит информацию о выполнении запросов. Для каждого запроса вы можете увидеть время начала обработки, продолжительность обработки, сообщения об ошибках и другую информацию. - -!!! note "Внимание" - Таблица не содержит входных данных для запросов `INSERT`. - -ClickHouse создаёт таблицу только в том случае, когда установлен конфигурационный параметр сервера [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log). Параметр задаёт правила ведения лога, такие как интервал логирования или имя таблицы, в которую будут логгироваться запросы. - -Чтобы включить логирование, задайте значение параметра [log\_queries](settings/settings.md#settings-log-queries) равным 1. Подробности смотрите в разделе [Настройки](settings/settings.md). - -Таблица `system.query_log` содержит информацию о двух видах запросов: - -1. Первоначальные запросы, которые были выполнены непосредственно клиентом. -2. Дочерние запросы, инициированные другими запросами (для выполнения распределенных запросов). Для дочерних запросов информация о первоначальном запросе содержится в столбцах `initial_*`. - -Столбцы: - -- `type` (`Enum8`) — тип события, произошедшего при выполнении запроса. Значения: - - `'QueryStart' = 1` — успешное начало выполнения запроса. - - `'QueryFinish' = 2` — успешное завершение выполнения запроса. - - `'ExceptionBeforeStart' = 3` — исключение перед началом обработки запроса. - - `'ExceptionWhileProcessing' = 4` — исключение во время обработки запроса. -- `event_date` (Date) — дата начала запроса. -- `event_time` (DateTime) — время начала запроса. -- `query_start_time` (DateTime) — время начала обработки запроса. -- `query_duration_ms` (UInt64) — длительность обработки запроса. -- `read_rows` (UInt64) — количество прочитанных строк. -- `read_bytes` (UInt64) — количество прочитанных байтов. -- `written_rows` (UInt64) — количество записанных строк для запросов `INSERT`. Для других запросов, значение столбца 0. -- `written_bytes` (UInt64) — объём записанных данных в байтах для запросов `INSERT`. Для других запросов, значение столбца 0. -- `result_rows` (UInt64) — количество строк в результате. -- `result_bytes` (UInt64) — объём результата в байтах. -- `memory_usage` (UInt64) — потребление RAM запросом. -- `query` (String) — текст запроса. -- `exception` (String) — сообщение исключения, если запрос завершился по исключению. -- `stack_trace` (String) — трассировка (список функций, последовательно вызванных перед ошибкой). Пустая строка, если запрос успешно завершен. -- `is_initial_query` (UInt8) — вид запроса. Возможные значения: - - 1 — запрос был инициирован клиентом. - - 0 — запрос был инициирован другим запросом при распределенном запросе. -- `user` (String) — пользователь, запустивший текущий запрос. -- `query_id` (String) — ID запроса. -- `address` (IPv6) — IP адрес, с которого пришел запрос. -- `port` (UInt16) — порт, с которого клиент сделал запрос -- `initial_user` (String) — пользователь, запустивший первоначальный запрос (для распределенных запросов). -- `initial_query_id` (String) — ID родительского запроса. -- `initial_address` (IPv6) — IP адрес, с которого пришел родительский запрос. -- `initial_port` (UInt16) — порт, с которого клиент сделал родительский запрос. -- `interface` (UInt8) — интерфейс, с которого ушёл запрос. Возможные значения: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — имя пользователя в OS, который запустил [clickhouse-client](../interfaces/cli.md). -- `client_hostname` (String) — имя сервера, с которого присоединился [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. -- `client_name` (String) — [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. -- `client_revision` (UInt32) — ревизия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `client_version_major` (UInt32) — старшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `client_version_minor` (UInt32) — младшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `client_version_patch` (UInt32) — патч [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `http_method` (UInt8) — HTTP метод, инициировавший запрос. Возможные значения: - - 0 — запрос запущен с интерфейса TCP. - - 1 — `GET`. - - 2 — `POST`. -- `http_user_agent` (String) — HTTP заголовок `UserAgent`. -- `quota_key` (String) — «ключ квоты» из настроек [квот](quotas.md) (см. `keyed`). -- `revision` (UInt32) — ревизия ClickHouse. -- `thread_numbers` (Array(UInt32)) — количество потоков, участвующих в обработке запросов. -- `ProfileEvents.Names` (Array(String)) — Счетчики для изменения различных метрик. Описание метрик можно получить из таблицы [system.events](#system_tables-events)(\#system\_tables-events -- `ProfileEvents.Values` (Array(UInt64)) — метрики, перечисленные в столбце `ProfileEvents.Names`. -- `Settings.Names` (Array(String)) — имена настроек, которые меняются, когда клиент выполняет запрос. Чтобы разрешить логирование изменений настроек, установите параметр `log_query_settings` равным 1. -- `Settings.Values` (Array(String)) — Значения настроек, которые перечислены в столбце `Settings.Names`. - -Каждый запрос создаёт одну или две строки в таблице `query_log`, в зависимости от статуса запроса: - -1. Если запрос выполнен успешно, создаются два события типа 1 и 2 (смотрите столбец `type`). -2. Если во время обработки запроса произошла ошибка, создаются два события с типами 1 и 4. -3. Если ошибка произошла до запуска запроса, создается одно событие с типом 3. - -По умолчанию, строки добавляются в таблицу логирования с интервалом в 7,5 секунд. Можно задать интервал в конфигурационном параметре сервера [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) (смотрите параметр `flush_interval_milliseconds`). Чтобы принудительно записать логи из буффера памяти в таблицу, используйте запрос `SYSTEM FLUSH LOGS`. - -Если таблицу удалить вручную, она пересоздастся автоматически «на лету». При этом все логи на момент удаления таблицы будут удалены. - -!!! note "Примечание" - Срок хранения логов не ограничен. Логи не удаляются из таблицы автоматически. Вам необходимо самостоятельно организовать удаление устаревших логов. - -Можно указать произвольный ключ партиционирования для таблицы `system.query_log` в конфигурации [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) (параметр `partition_by`). - -## system.query\_log {#system_tables-query_log} - -Contains information about execution of queries. For each query, you can see processing start time, duration of processing, error messages and other information. - -!!! note "Note" - The table doesn’t contain input data for `INSERT` queries. - -ClickHouse creates this table only if the [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) server parameter is specified. This parameter sets the logging rules, such as the logging interval or the name of the table the queries will be logged in. - -To enable query logging, set the [log\_queries](settings/settings.md#settings-log-queries) parameter to 1. For details, see the [Settings](settings/settings.md) section. - -The `system.query_log` table registers two kinds of queries: - -1. Initial queries that were run directly by the client. -2. Child queries that were initiated by other queries (for distributed query execution). For these types of queries, information about the parent queries is shown in the `initial_*` columns. - -Columns: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` queries, the number of written rows. For other queries, the column value is 0. -- `written_bytes` (UInt64) — For `INSERT` queries, the number of written bytes. For other queries, the column value is 0. -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS’s username who runs [clickhouse-client](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-client](../interfaces/cli.md) or another TCP client is run. -- `client_name` (String) — The [clickhouse-client](../interfaces/cli.md) or another TCP client name. -- `client_revision` (UInt32) — Revision of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_major` (UInt32) — Major version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_minor` (UInt32) — Minor version of the [clickhouse-client](../interfaces/cli.md) or another TCP client. -- `client_version_patch` (UInt32) — Patch component of the [clickhouse-client](../interfaces/cli.md) or another TCP client version. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` method was used. - - 2 — `POST` method was used. -- `http_user_agent` (String) — The `UserAgent` header passed in the HTTP request. -- `quota_key` (String) — The «quota key» specified in the [quotas](quotas.md) setting (see `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [system.events](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` column. -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parameter to 1. -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` column. - -Each query creates one or two rows in the `query_log` table, depending on the status of the query: - -1. If the query execution is successful, two events with types 1 and 2 are created (see the `type` column). -2. If an error occurred during query processing, two events with types 1 and 4 are created. -3. If an error occurred before launching the query, a single event with type 3 is created. - -By default, logs are added to the table at intervals of 7.5 seconds. You can set this interval in the [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `flush_interval_milliseconds` parameter). To flush the logs forcibly from the memory buffer into the table, use the `SYSTEM FLUSH LOGS` query. - -When the table is deleted manually, it will be automatically created on the fly. Note that all the previous logs will be deleted. - -!!! note "Note" - The storage period for logs is unlimited. Logs aren’t automatically deleted from the table. You need to organize the removal of outdated logs yourself. - -You can specify an arbitrary partitioning key for the `system.query_log` table in the [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) server setting (see the `partition_by` parameter). -\#\# system.query\_thread\_log {\#system\_tables-query-thread-log} - -Содержит информацию о каждом потоке выполняемых запросов. - -ClickHouse создаёт таблицу только в том случае, когда установлен конфигурационный параметр сервера [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log). Параметр задаёт правила ведения лога, такие как интервал логирования или имя таблицы, в которую будут логгироваться запросы. - -Чтобы включить логирование, задайте значение параметра [log\_query\_threads](settings/settings.md#settings-log-query-threads) равным 1. Подробности смотрите в разделе [Настройки](settings/settings.md). - -Столбцы: - -- `event_date` (Date) — дата завершения выполнения запроса потоком. -- `event_time` (DateTime) — дата и время завершения выполнения запроса потоком. -- `query_start_time` (DateTime) — время начала обработки запроса. -- `query_duration_ms` (UInt64) — длительность обработки запроса в миллисекундах. -- `read_rows` (UInt64) — количество прочитанных строк. -- `read_bytes` (UInt64) — количество прочитанных байтов. -- `written_rows` (UInt64) — количество записанных строк для запросов `INSERT`. Для других запросов, значение столбца 0. -- `written_bytes` (UInt64) — объём записанных данных в байтах для запросов `INSERT`. Для других запросов, значение столбца 0. -- `memory_usage` (Int64) — разница между выделенной и освобождённой памятью в контексте потока. -- `peak_memory_usage` (Int64) — максимальная разница между выделенной и освобождённой памятью в контексте потока. -- `thread_name` (String) — Имя потока. -- `thread_id` (UInt64) — tid (ID потока операционной системы). -- `master_thread_id` (UInt64) — tid (ID потока операционной системы) главного потока. -- `query` (String) — текст запроса. -- `is_initial_query` (UInt8) — вид запроса. Возможные значения: - - 1 — запрос был инициирован клиентом. - - 0 — запрос был инициирован другим запросом при распределенном запросе. -- `user` (String) — пользователь, запустивший текущий запрос. -- `query_id` (String) — ID запроса. -- `address` (IPv6) — IP адрес, с которого пришел запрос. -- `port` (UInt16) — порт, с которого пришел запрос. -- `initial_user` (String) — пользователь, запустивший первоначальный запрос (для распределенных запросов). -- `initial_query_id` (String) — ID родительского запроса. -- `initial_address` (IPv6) — IP адрес, с которого пришел родительский запрос. -- `initial_port` (UInt16) — порт, пришел родительский запрос. -- `interface` (UInt8) — интерфейс, с которого ушёл запрос. Возможные значения: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — имя пользователя в OS, который запустил [clickhouse-client](../interfaces/cli.md). -- `client_hostname` (String) — hostname клиентской машины, с которой присоединился [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. -- `client_name` (String) — [clickhouse-client](../interfaces/cli.md) или другой TCP клиент. -- `client_revision` (UInt32) — ревизия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `client_version_major` (UInt32) — старшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `client_version_minor` (UInt32) — младшая версия [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `client_version_patch` (UInt32) — патч [clickhouse-client](../interfaces/cli.md) или другого TCP клиента. -- `http_method` (UInt8) — HTTP метод, инициировавший запрос. Возможные значения: - - 0 — запрос запущен с интерфейса TCP. - - 1 — `GET`. - - 2 — `POST`. -- `http_user_agent` (String) — HTTP заголовок `UserAgent`. -- `quota_key` (String) — «ключ квоты» из настроек [квот](quotas.md) (см. `keyed`). -- `revision` (UInt32) — ревизия ClickHouse. -- `ProfileEvents.Names` (Array(String)) — Счетчики для изменения различных метрик для данного потока. Описание метрик можно получить из таблицы [system.events](#system_tables-events)(\#system\_tables-events -- `ProfileEvents.Values` (Array(UInt64)) — метрики для данного потока, перечисленные в столбце `ProfileEvents.Names`. - -По умолчанию, строки добавляются в таблицу логирования с интервалом в 7,5 секунд. Можно задать интервал в конфигурационном параметре сервера [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) (смотрите параметр `flush_interval_milliseconds`). Чтобы принудительно записать логи из буффера памяти в таблицу, используйте запрос `SYSTEM FLUSH LOGS`. - -Если таблицу удалить вручную, она пересоздастся автоматически «на лету». При этом все логи на момент удаления таблицы будут удалены. - -!!! note "Примечание" - Срок хранения логов не ограничен. Логи не удаляются из таблицы автоматически. Вам необходимо самостоятельно организовать удаление устаревших логов. - -Можно указать произвольный ключ партиционирования для таблицы `system.query_log` в конфигурации [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) (параметр `partition_by`). - -## system.trace\_log {#system_tables-trace_log} - -Contains stack traces collected by the sampling query profiler. - -ClickHouse creates this table when the [trace\_log](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) server configuration section is set. Also the [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) and [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) settings should be set. - -To analyze logs, use the `addressToLine`, `addressToSymbol` and `demangle` introspection functions. - -Columns: - -- `event_date`([Date](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time`([DateTime](../sql_reference/data_types/datetime.md)) — Timestamp of sampling moment. - -- `revision`([UInt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - When connecting to server by `clickhouse-client`, you see the string similar to `Connected to ClickHouse server version 19.18.1 revision 54429.`. This field contains the `revision`, but not the `version` of a server. - -- `timer_type`([Enum8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` represents wall-clock time. - - `CPU` represents CPU time. - -- `thread_number`([UInt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id`([String](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) system table. - -- `trace`([Array(UInt64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**Example** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## system.replicas {#system_tables-replicas} - -Содержит информацию и статус для реплицируемых таблиц, расположенных на локальном сервере. -Эту таблицу можно использовать для мониторинга. Таблица содержит по строчке для каждой Replicated\*-таблицы. - -Пример: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -Столбцы: - -- `database` (`String`) - имя БД. -- `table` (`String`) - имя таблицы. -- `engine` (`String`) - имя движка таблицы. -- `is_leader` (`UInt8`) - является ли реплика лидером. - В один момент времени, не более одной из реплик является лидером. Лидер отвечает за выбор фоновых слияний, которые следует произвести. - Замечу, что запись можно осуществлять на любую реплику (доступную и имеющую сессию в ZK), независимо от лидерства. -- `can_become_leader` (`UInt8`) - может ли реплика быть выбрана лидером. -- `is_readonly` (`UInt8`) - находится ли реплика в режиме «только для чтения» - Этот режим включается, если в конфиге нет секции с ZK; если при переинициализации сессии в ZK произошла неизвестная ошибка; во время переинициализации сессии с ZK. -- `is_session_expired` (`UInt8`) - истекла ли сессия с ZK. В основном, то же самое, что и `is_readonly`. -- `future_parts` (`UInt32`) - количество кусков с данными, которые появятся в результате INSERT-ов или слияний, которых ещё предстоит сделать -- `parts_to_check` (`UInt32`) - количество кусков с данными в очереди на проверку. Кусок помещается в очередь на проверку, если есть подозрение, что он может быть битым. -- `zookeeper_path` (`String`) - путь к данным таблицы в ZK. -- `replica_name` (`String`) - имя реплики в ZK; разные реплики одной таблицы имеют разное имя. -- `replica_path` (`String`) - путь к данным реплики в ZK. То же самое, что конкатенация zookeeper\_path/replicas/replica\_path. -- `columns_version` (`Int32`) - номер версии структуры таблицы. Обозначает, сколько раз был сделан ALTER. Если на репликах разные версии, значит некоторые реплики сделали ещё не все ALTER-ы. -- `queue_size` (`UInt32`) - размер очереди действий, которые предстоит сделать. К действиям относятся вставки блоков данных, слияния, и некоторые другие действия. Как правило, совпадает с future\_parts. -- `inserts_in_queue` (`UInt32`) - количество вставок блоков данных, которые предстоит сделать. Обычно вставки должны быстро реплицироваться. Если величина большая - значит что-то не так. -- `merges_in_queue` (`UInt32`) - количество слияний, которые предстоит сделать. Бывают длинные слияния - то есть, это значение может быть больше нуля продолжительное время. -- `part_mutations_in_queue` (`UInt32`) - количество мутаций, которые предстоит сделать. -- `queue_oldest_time` (`DateTime`) - если `queue_size` больше 0, показывает, когда была добавлена в очередь самая старая операция. -- `inserts_oldest_time` (`DateTime`) - см. `queue_oldest_time`. -- `merges_oldest_time` (`DateTime`) - см. `queue_oldest_time`. -- `part_mutations_oldest_time` (`DateTime`) - см. `queue_oldest_time`. - -Следующие 4 столбца имеют ненулевое значение только если активна сессия с ZK. - -- `log_max_index` (`UInt64`) - максимальный номер записи в общем логе действий. -- `log_pointer` (`UInt64`) - максимальный номер записи из общего лога действий, которую реплика скопировала в свою очередь для выполнения, плюс единица. Если log\_pointer сильно меньше log\_max\_index, значит что-то не так. -- `last_queue_update` (`DateTime`) - When the queue was updated last time. -- `absolute_delay` (`UInt64`) - How big lag in seconds the current replica has. -- `total_replicas` (`UInt8`) - общее число известных реплик этой таблицы. -- `active_replicas` (`UInt8`) - число реплик этой таблицы, имеющих сессию в ZK; то есть, число работающих реплик. - -Если запрашивать все столбцы, то таблица может работать слегка медленно, так как на каждую строчку делается несколько чтений из ZK. -Если не запрашивать последние 4 столбца (log\_max\_index, log\_pointer, total\_replicas, active\_replicas), то таблица работает быстро. - -Например, так можно проверить, что всё хорошо: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -Если этот запрос ничего не возвращает - значит всё хорошо. - -## system.settings {#system-tables-system-settings} - -Содержит информацию о сессионных настройках для текущего пользователя. - -Столбцы: - -- `name` ([String](../sql_reference/data_types/string.md)) — имя настройки. -- `value` ([String](../sql_reference/data_types/string.md)) — значение настройки. -- `changed` ([UInt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — показывает, изменена ли настройка по отношению к значению по умолчанию. -- `description` ([String](../sql_reference/data_types/string.md)) — краткое описание настройки. -- `min` ([Nullable](../sql_reference/data_types/nullable.md)([String](../sql_reference/data_types/string.md))) — минимальное значение настройки, если задано [ограничение](settings/constraints_on_settings.md#constraints-on-settings). Если нет, то поле содержит [NULL](../sql_reference/syntax.md#null-literal). -- `max` ([Nullable](../sql_reference/data_types/nullable.md)([String](../sql_reference/data_types/string.md))) — максимальное значение настройки, если задано [ограничение](settings/constraints_on_settings.md#constraints-on-settings). Если нет, то поле содержит [NULL](../sql_reference/syntax.md#null-literal). -- `readonly` ([UInt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — Показывает, может ли пользователь изменять настройку: - - `0` — Текущий пользователь может изменять настройку. - - `1` — Текущий пользователь не может изменять настройку. - -**Пример** - -Пример показывает как получить информацию о настройках, имена которых содержат `min_i`. - -``` sql -SELECT * -FROM system.settings -WHERE name LIKE '%min_i%' -``` - -``` text -┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ -│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ -``` - -Использование `WHERE changed` может быть полезно, например, если необходимо проверить: - -- Что настройки корректно загрузились из конфигурационного файла и используются. -- Настройки, изменённые в текущей сессии. - - - -``` sql -SELECT * FROM system.settings WHERE changed AND name='load_balancing' -``` - -**Cм. также** - -- [Настройки](settings/index.md#settings) -- [Разрешения для запросов](settings/permissions_for_queries.md#settings_readonly) -- [Ограничения для значений настроек](settings/constraints_on_settings.md) - -## system.table\_engines {#system.table_engines} - -``` text -┌─name───────────────────┬─value───────┬─changed─┐ -│ max_threads │ 8 │ 1 │ -│ use_uncompressed_cache │ 0 │ 1 │ -│ load_balancing │ random │ 1 │ -│ max_memory_usage │ 10000000000 │ 1 │ -└────────────────────────┴─────────────┴─────────┘ -``` - -## system.table\_engines {#system-table-engines} - -Содержит информацию про движки таблиц, поддерживаемые сервером, а также об их возможностях. - -Эта таблица содержит следующие столбцы (тип столбца показан в скобках): - -- `name` (String) — имя движка. -- `supports_settings` (UInt8) — флаг, показывающий поддержку секции `SETTINGS`. -- `supports_skipping_indices` (UInt8) — флаг, показывающий поддержку [индексов пропуска данных](table_engines/mergetree/#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — флаг, показывающий поддержку [TTL](table_engines/mergetree/#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — флаг, показывающий поддержку секций `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` и `SAMPLE_BY`. -- `supports_replication` (UInt8) — флаг, показвыающий поддержку [репликации](table_engines/replication/). -- `supports_duduplication` (UInt8) — флаг, показывающий наличие в движке дедупликации данных. - -Пример: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**Смотрите также** - -- [Секции движка](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) семейства MergeTree -- [Настройки](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) Kafka -- [Настройки](../engines/table_engines/special/join.md#join-limitations-and-settings) Join - -## system.tables {#system-tables} - -Содержит метаданные каждой таблицы, о которой знает сервер. Отсоединённые таблицы не отображаются в `system.tables`. - -Эта таблица содержит следующие столбцы (тип столбца показан в скобках): - -- `database String` — имя базы данных, в которой находится таблица. -- `name` (String) — имя таблицы. -- `engine` (String) — движок таблицы (без параметров). -- `is_temporary` (UInt8) — флаг, указывающий на то, временная это таблица или нет. -- `data_path` (String) — путь к данным таблицы в файловой системе. -- `metadata_path` (String) — путь к табличным метаданным в файловой системе. -- `metadata_modification_time` (DateTime) — время последней модификации табличных метаданных. -- `dependencies_database` (Array(String)) — зависимости базы данных. -- `dependencies_table` (Array(String)) — табличные зависимости (таблицы [MaterializedView](../engines/table_engines/special/materializedview.md), созданные на базе текущей таблицы). -- `create_table_query` (String) — запрос, которым создавалась таблица. -- `engine_full` (String) — параметры табличного движка. -- `partition_key` (String) — ключ партиционирования таблицы. -- `sorting_key` (String) — ключ сортировки таблицы. -- `primary_key` (String) - первичный ключ таблицы. -- `sampling_key` (String) — ключ сэмплирования таблицы. - -Таблица `system.tables` используется при выполнении запроса `SHOW TABLES`. - -## system.zookeeper {#system-zookeeper} - -Таблицы не существует, если ZooKeeper не сконфигурирован. Позволяет читать данные из ZooKeeper кластера, описанного в конфигурации. -В запросе обязательно в секции WHERE должно присутствовать условие на равенство path - путь в ZooKeeper, для детей которого вы хотите получить данные. - -Запрос `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` выведет данные по всем детям узла `/clickhouse`. -Чтобы вывести данные по всем узлам в корне, напишите path = ‘/’. -Если узла, указанного в path не существует, то будет брошено исключение. - -Столбцы: - -- `name String` — Имя узла. -- `path String` — Путь к узлу. -- `value String` — Значение узла. -- `dataLength Int32` — Размер значения. -- `numChildren Int32` — Количество детей. -- `czxid Int64` — Идентификатор транзакции, в которой узел был создан. -- `mzxid Int64` — Идентификатор транзакции, в которой узел был последний раз изменён. -- `pzxid Int64` — Идентификатор транзакции, последний раз удаливший или добавивший детей. -- `ctime DateTime` — Время создания узла. -- `mtime DateTime` — Время последней модификации узла. -- `version Int32` — Версия узла - количество раз, когда узел был изменён. -- `cversion Int32` — Количество добавлений или удалений детей. -- `aversion Int32` — Количество изменений ACL. -- `ephemeralOwner Int64` — Для эфемерных узлов - идентификатор сессии, которая владеет этим узлом. - -Пример: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## system.mutations {#system_tables-mutations} - -Таблица содержит информацию о ходе выполнения [мутаций](../sql_reference/statements/alter.md#alter-mutations) MergeTree-таблиц. Каждой команде мутации соответствует одна строка. В таблице есть следующие столбцы: - -**database**, **table** - имя БД и таблицы, к которой была применена мутация. - -**mutation\_id** - ID запроса. Для реплицированных таблиц эти ID соответствуют именам записей в директории `/mutations/` в ZooKeeper, для нереплицированных - именам файлов в директории с данными таблицы. - -**command** - Команда мутации (часть запроса после `ALTER TABLE [db.]table`). - -**create\_time** - Время создания мутации. - -**block\_numbers.partition\_id**, **block\_numbers.number** - Nested-столбец. Для мутаций реплицированных таблиц для каждой партиции содержит номер блока, полученный этой мутацией (в каждой партиции будут изменены только куски, содержащие блоки с номерами, меньшими номера, полученного мутацией в этой партиции). Для нереплицированных таблиц нумерация блоков сквозная по партициям, поэтому столбец содержит одну запись с единственным номером блока, полученным мутацией. - -**parts\_to\_do** - Количество кусков таблицы, которые ещё предстоит изменить. - -**is\_done** - Завершена ли мутация. Замечание: даже если `parts_to_do = 0`, для реплицированной таблицы возможна ситуация, когда мутация ещё не завершена из-за долго выполняющейся вставки, которая добавляет данные, которые нужно будет мутировать. - -Если во время мутации какого-либо куска возникли проблемы, заполняются следующие столбцы: - -**latest\_failed\_part** - Имя последнего куска, мутация которого не удалась. - -**latest\_fail\_time** — время последней ошибки мутации. - -**latest\_fail\_reason** — причина последней ошибки мутации. - -## system.disks {#system_tables-disks} - -Cодержит информацию о дисках, заданных в [конфигурации сервера](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Столбцы: - -- `name` ([String](../sql_reference/data_types/string.md)) — имя диска в конфигурации сервера. -- `path` ([String](../sql_reference/data_types/string.md)) — путь к точке монтирования в файловой системе. -- `free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — свободное место на диске в байтах. -- `total_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — объём диска в байтах. -- `keep_free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — место, которое должно остаться свободным на диске в байтах. Задаётся значением параметра `keep_free_space_bytes` конфигурации дисков. - -## system.storage\_policies {#system_tables-storage_policies} - -Содержит информацию о политиках хранения и томах, заданных в [конфигурации сервера](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Столбцы: - -- `policy_name` ([String](../sql_reference/data_types/string.md)) — имя политики хранения. -- `volume_name` ([String](../sql_reference/data_types/string.md)) — имя тома, который содержится в политике хранения. -- `volume_priority` ([UInt64](../sql_reference/data_types/int_uint.md)) — порядковый номер тома согласно конфигурации. -- `disks` ([Array(String)](../sql_reference/data_types/array.md)) — имена дисков, содержащихся в политике хранения. -- `max_data_part_size` ([UInt64](../sql_reference/data_types/int_uint.md)) — максимальный размер куска данных, который может храниться на дисках тома (0 — без ограничений). -- `move_factor` ([Float64](../sql_reference/data_types/float.md))\` — доля свободного места, при превышении которой данные начинают перемещаться на следующий том. - -Если политика хранения содержит несколько томов, то каждому тому соответствует отдельная запись в таблице. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/operations/system_tables/) diff --git a/docs/ru/operations/troubleshooting.md b/docs/ru/operations/troubleshooting.md index a045de41ccc..cb86dfef5e8 100644 --- a/docs/ru/operations/troubleshooting.md +++ b/docs/ru/operations/troubleshooting.md @@ -10,7 +10,7 @@ ### Не получается скачать deb-пакеты из репозитория ClickHouse с помощью Apt-get {#ne-poluchaetsia-skachat-deb-pakety-iz-repozitoriia-clickhouse-s-pomoshchiu-apt-get} - Проверьте настройки брандмауэра. -- Если по какой-либо причине вы не можете получить доступ к репозиторию, скачайте пакеты как описано в разделе [Начало работы](../getting_started/index.md) и установите их вручную командой `sudo dpkg -i `. Также, необходим пакет `tzdata`. +- Если по какой-либо причине вы не можете получить доступ к репозиторию, скачайте пакеты как описано в разделе [Начало работы](../getting-started/index.md) и установите их вручную командой `sudo dpkg -i `. Также, необходим пакет `tzdata`. ## Соединение с сервером {#troubleshooting-accepts-no-connections} diff --git a/docs/ru/operations/utilities/clickhouse-copier.md b/docs/ru/operations/utilities/clickhouse-copier.md index 291c36993c6..b05db93b28b 100644 --- a/docs/ru/operations/utilities/clickhouse-copier.md +++ b/docs/ru/operations/utilities/clickhouse-copier.md @@ -19,7 +19,7 @@ Для снижения сетевого трафика рекомендуем запускать `clickhouse-copier` на том же сервере, где находятся исходные данные. -## Запуск clickhouse-copier {#zapusk-clickhouse-copier} +## Запуск Clickhouse-copier {#zapusk-clickhouse-copier} Утилиту следует запускать вручную следующим образом: @@ -36,7 +36,7 @@ $ clickhouse-copier copier --daemon --config zookeeper.xml --task-path /task/pat - `task-upload-force` - Загрузить `task-file` в ZooKeeper даже если уже было загружено. - `base-dir` - путь к логам и вспомогательным файлам. При запуске `clickhouse-copier` создает в `$base-dir` подкаталоги `clickhouse-copier_YYYYMMHHSS_`. Если параметр не указан, то каталоги будут создаваться в каталоге, где `clickhouse-copier` был запущен. -## Формат zookeeper.xml {#format-zookeeper-xml} +## Формат Zookeeper.xml {#format-zookeeper-xml} ``` xml diff --git a/docs/ru/sql-reference/aggregate-functions/combinators.md b/docs/ru/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..1bbafc436cd --- /dev/null +++ b/docs/ru/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,116 @@ +# Комбинаторы агрегатных функций {#aggregate_functions_combinators} + +К имени агрегатной функции может быть приписан некоторый суффикс. При этом, работа агрегатной функции некоторым образом модифицируется. + +## -If {#agg-functions-combinator-if} + +К имени любой агрегатной функции может быть приписан суффикс -If. В этом случае, агрегатная функция принимает ещё один дополнительный аргумент - условие (типа UInt8). Агрегатная функция будет обрабатывать только те строки, для которых условие сработало. Если условие ни разу не сработало - возвращается некоторое значение по умолчанию (обычно - нули, пустые строки). + +Примеры: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` и т. п. + +С помощью условных агрегатных функций, вы можете вычислить агрегаты сразу для нескольких условий, не используя подзапросы и `JOIN`-ы. +Например, в Яндекс.Метрике, условные агрегатные функции используются для реализации функциональности сравнения сегментов. + +## -Array {#array} + +К имени любой агрегатной функции может быть приписан суффикс -Array. В этом случае, агрегатная функция вместо аргументов типов T принимает аргументы типов Array(T) (массивы). Если агрегатная функция принимает несколько аргументов, то это должны быть массивы одинаковых длин. При обработке массивов, агрегатная функция работает, как исходная агрегатная функция по всем элементам массивов. + +Пример 1: `sumArray(arr)` - просуммировать все элементы всех массивов arr. В данном примере можно было бы написать проще: `sum(arraySum(arr))`. + +Пример 2: `uniqArray(arr)` - посчитать количество уникальных элементов всех массивов arr. Это можно было бы сделать проще: `uniq(arrayJoin(arr))`, но не всегда есть возможность добавить arrayJoin в запрос. + +Комбинаторы -If и -Array можно сочетать. При этом, должен сначала идти Array, а потом If. Примеры: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. Из-за такого порядка получается, что аргумент cond не должен быть массивом. + +## -State {#state} + +В случае применения этого комбинатора, агрегатная функция возвращает не готовое значение (например, в случае функции [uniq](reference.md#agg_function-uniq) — количество уникальных значений), а промежуточное состояние агрегации (например, в случае функции `uniq` — хэш-таблицу для расчёта количества уникальных значений), которое имеет тип `AggregateFunction(...)` и может использоваться для дальнейшей обработки или может быть сохранено в таблицу для последующей доагрегации. + +Для работы с промежуточными состояниями предназначены: + +- Движок таблиц [AggregatingMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md). +- Функция [finalizeAggregation](../../sql-reference/aggregate-functions/combinators.md#function-finalizeaggregation). +- Функция [runningAccumulate](../../sql-reference/aggregate-functions/combinators.md#function-runningaccumulate). +- Комбинатор [-Merge](#aggregate_functions_combinators_merge). +- Комбинатор [-MergeState](#aggregate_functions_combinators_mergestate). + +## -Merge {#aggregate_functions_combinators-merge} + +В случае применения этого комбинатора, агрегатная функция будет принимать в качестве аргумента промежуточное состояние агрегации, доагрегировать (объединять вместе) эти состояния, и возвращать готовое значение. + +## -MergeState {#aggregate_functions_combinators-mergestate} + +Выполняет слияние промежуточных состояний агрегации, аналогично комбинатору -Merge, но возвращает не готовое значение, а промежуточное состояние агрегации, аналогично комбинатору -State. + +## -ForEach {#foreach} + +Преобразует агрегатную функцию для таблиц в агрегатную функцию для массивов, которая применяет агрегирование для соответствующих элементов массивов и возвращает массив результатов. Например, `sumForEach` для массивов `[1, 2]`, `[3, 4, 5]` и `[6, 7]` даст результат `[10, 13, 5]`, сложив соответственные элементы массивов. + +## -Resample {#agg-functions-combinator-resample} + +Позволяет поделить данные на группы, а затем по-отдельности агрегирует данные для этих групп. Группы образуются разбиением значений одного из столбцов на интервалы. + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**Параметры** + +- `start` — начальное значение для интервала значений `resampling_key`. +- `stop` — конечное значение для интервала значений `resampling_key`. Интервал не включает значение `stop` (`[start, stop)`). +- `step` — шаг деления полного интервала на подинтервалы. Функция `aggFunction` выполняется для каждого из подинтервалов независимо. +- `resampling_key` — столбец, значения которого используются для разделения данных на интервалы. +- `aggFunction_params` — параметры `aggFunction`. + +**Возвращаемые значения** + +- Массив результатов `aggFunction` для каждого подинтервала. + +**Пример** + +Рассмотрим таблицу `people` со следующими данными: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +Получим имена людей, чей возраст находится в интервалах `[30,60)` и `[60,75)`. Поскольку мы используем целочисленное представление возраста, то интервалы будут выглядеть как `[30, 59]` и `[60,74]`. + +Чтобы собрать имена в массив, возьмём агрегатную функцию [groupArray](reference.md#agg_function-grouparray). Она принимает один аргумент. В нашем случае, это столбец `name`. Функция `groupArrayResample` должна использовать столбец `age` для агрегирования имён по возрасту. Чтобы определить необходимые интервалы, передадим в функцию `groupArrayResample` аргументы `30, 75, 30`. + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) from people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +Посмотрим на результаты. + +`Jonh` не попал в выдачу, поскольку слишком молод. Остальные распределены согласно заданным возрастным интервалам. + +Теперь посчитаем общее количество людей и их среднюю заработную плату в заданных возрастных интервалах. + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/combinators/) diff --git a/docs/ru/sql-reference/aggregate-functions/index.md b/docs/ru/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..6bdb2a7808d --- /dev/null +++ b/docs/ru/sql-reference/aggregate-functions/index.md @@ -0,0 +1,63 @@ +--- +toc_folder_title: "\u0410\u0433\u0440\u0435\u0433\u0430\u0442\u043D\u044B\u0435 \u0444\ + \u0443\u043D\u043A\u0446\u0438\u0438" +toc_priority: 33 +toc_title: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0435" +--- + +# Агрегатные функции {#aggregate-functions} + +Агрегатные функции работают в [привычном](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) для специалистов по базам данных смысле. + +ClickHouse поддерживает также: + +- [Параметрические агрегатные функции](parametric-functions.md#aggregate_functions_parametric), которые помимо столбцов принимаю и другие параметры. +- [Комбинаторы](combinators.md#aggregate_functions_combinators), которые изменяют поведение агрегатных функций. + +## Обработка NULL {#obrabotka-null} + +При агрегации все `NULL` пропускаются. + +**Примеры** + +Рассмотрим таблицу: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +Выполним суммирование значений в столбце `y`: + +``` sql +SELECT sum(y) FROM t_null_big +``` + +``` text +┌─sum(y)─┐ +│ 7 │ +└────────┘ +``` + +Функция `sum` работает с `NULL` как с `0`. В частности, это означает, что если на вход в функцию подать выборку, где все значения `NULL`, то результат будет `0`, а не `NULL`. + +Теперь с помощью функции `groupArray` сформируем массив из столбца `y`: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` не включает `NULL` в результирующий массив. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/) diff --git a/docs/ru/sql-reference/aggregate-functions/parametric-functions.md b/docs/ru/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..b980ed199a8 --- /dev/null +++ b/docs/ru/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,479 @@ +# Параметрические агрегатные функции {#aggregate_functions_parametric} + +Некоторые агрегатные функции могут принимать не только столбцы-аргументы (по которым производится свёртка), но и набор параметров - констант для инициализации. Синтаксис - две пары круглых скобок вместо одной. Первая - для параметров, вторая - для аргументов. + +## histogram {#histogram} + +Рассчитывает адаптивную гистограмму. Не гарантирует точного результата. + + histogram(number_of_bins)(values) + +Функция использует [A Streaming Parallel Decision Tree Algorithm](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Границы столбцов устанавливаются по мере поступления новых данных в функцию. В общем случае столбцы имею разную ширину. + +**Параметры** + +`number_of_bins` — максимальное количество корзин в гистограмме. Функция автоматически вычисляет количество корзин. Она пытается получить указанное количество корзин, но если не получилось, то в результате корзин будет меньше. +`values` — [выражение](../syntax.md#syntax-expressions), предоставляющее входные значения. + +**Возвращаемые значения** + +- [Массив](../../sql-reference/data-types/array.md) [кортежей](../../sql-reference/data-types/tuple.md) следующего вида: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — нижняя граница корзины. + - `upper` — верхняя граница корзины. + - `height` — количество значений в корзине. + +**Пример** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +С помощью функции [bar](../../sql-reference/aggregate-functions/parametric-functions.md#function-bar) можно визуализировать гистограмму, например: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +В этом случае необходимо помнить, что границы корзин гистограммы не известны. + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +Проверяет, содержит ли последовательность событий цепочку, которая соответствует указанному шаблону. + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "Предупреждение" + События, произошедшие в одну и ту же секунду, располагаются в последовательности в неопределенном порядке, что может повлиять на результат работы функции. + +**Параметры** + +- `pattern` — строка с шаблоном. Смотрите [Синтаксис шаблонов](#sequence-function-pattern-syntax). + +- `timestamp` — столбец, содержащий метки времени. Типичный тип данных столбца — `Date` или `DateTime`. Также можно использовать любой из поддержанных типов данных [UInt](../../sql-reference/aggregate-functions/parametric-functions.md). + +- `cond1`, `cond2` — условия, описывающие цепочку событий. Тип данных — `UInt8`. Можно использовать до 32 условий. Функция учитывает только те события, которые указаны в условиях. Функция пропускает данные из последовательности, если они не описаны ни в одном из условий. + +**Возвращаемые значения** + +- 1, если цепочка событий, соответствующая шаблону найдена. +- 0, если цепочка событий, соответствующая шаблону не найдена. + +Тип: `UInt8`. + + +**Синтаксис шаблонов** + +- `(?N)` — соответствует условию на позиции `N`. Условия пронумерованы по порядку в диапазоне `[1, 32]`. Например, `(?1)` соответствует условию, заданному параметром `cond1`. + +- `.*` — соответствует любому количеству событий. Для этого элемента шаблона не надо задавать условия. + +- `(?t operator value)` — устанавливает время в секундах, которое должно разделять два события. Например, шаблон `(?1)(?t>1800)(?2)` соответствует событиям, которые произошли более чем через 1800 секунд друг от друга. Между этими событиями может находиться произвольное количество любых событий. Операторы могут быть `>=`, `>`, `<`, `<=`. + +**Примеры** + +Пусть таблица `t` содержит следующие данные: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +Выполним запрос: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +Функция нашла цепочку событий, в которой число 2 следует за числом 1. Число 3 между ними было пропущено, поскольку оно не было использовано ни в одном из условий. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +В этом случае функция не может найти цепочку событий, соответствующую шаблону, поскольку событие для числа 3 произошло между 1 и 2. Если бы в этом же случае мы бы проверяли условие на событие для числа 4, то цепочка бы соответствовала шаблону. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Смотрите также** + +- [sequenceCount](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +Вычисляет количество цепочек событий, соответствующих шаблону. Функция обнаруживает только непересекающиеся цепочки событий. Она начитает искать следующую цепочку только после того, как полностью совпала текущая цепочка событий. + +!!! warning "Предупреждение" + События, произошедшие в одну и ту же секунду, располагаются в последовательности в неопределенном порядке, что может повлиять на результат работы функции. + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**Параметры** + +- `pattern` — строка с шаблоном. Смотрите [Синтаксис шаблонов](#sequence-function-pattern-syntax). + +- `timestamp` — столбец, содержащий метки времени. Типичный тип данных столбца — `Date` или `DateTime`. Также можно использовать любой из поддержанных типов данных [UInt](../../sql-reference/aggregate-functions/parametric-functions.md). + +- `cond1`, `cond2` — условия, описывающие цепочку событий. Тип данных — `UInt8`. Можно использовать до 32 условий. Функция учитывает только те события, которые указаны в условиях. Функция пропускает данные из последовательности, если они не описаны ни в одном из условий. + +**Возвращаемое значение** + +- Число непересекающихся цепочек событий, соответствущих шаблону. + +Тип: `UInt64`. + +**Пример** + +Пусть таблица `t` содержит следующие данные: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +Вычислим сколько раз число 2 стоит после числа 1, причем между 1 и 2 могут быть любые числа: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**Смотрите также** + +- [sequenceMatch](#function-sequencematch) + +## windowFunnel {#windowfunnel} + +Отыскивает цепочки событий в скользящем окне по времени и вычисляет максимальное количество произошедших событий из цепочки. + +Функция работает по алгоритму: + +- Функция отыскивает данные, на которых срабатывает первое условие из цепочки, и присваивает счетчику событий значение 1. С этого же момента начинается отсчет времени скользящего окна. + +- Если в пределах окна последовательно попадаются события из цепочки, то счетчик увеличивается. Если последовательность событий нарушается, то счетчик не растет. + +- Если в данных оказалось несколько цепочек разной степени завершенности, то функция выдаст только размер самой длинной цепочки. + +**Синтаксис** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**Параметры** + +- `window` — ширина скользящего окна по времени в секундах. [UInt](../../sql-reference/aggregate-functions/parametric-functions.md). +- `mode` - необязательный параметр. Если установлено значение `'strict'`, то функция `windowFunnel()` применяет условия только для уникальных значений. +- `timestamp` — имя столбца, содержащего временные отметки. [Date](../../sql-reference/aggregate-functions/parametric-functions.md), [DateTime](../../sql-reference/aggregate-functions/parametric-functions.md#data_type-datetime) и другие параметры с типом `Integer`. В случае хранения меток времени в столбцах с типом `UInt64`, максимально допустимое значение соответствует ограничению для типа `Int64`, т.е. равно `2^63-1`. +- `cond` — условия или данные, описывающие цепочку событий. [UInt8](../../sql-reference/aggregate-functions/parametric-functions.md). + +**Возвращаемое значение** + +Максимальное количество последовательно сработавших условий из цепочки в пределах скользящего окна по времени. Исследуются все цепочки в выборке. + +Тип: `Integer`. + +**Пример** + +Определим, успевает ли пользователь за установленный период выбрать телефон в интернет-магазине, купить его и сделать повторный заказ. + +Зададим следующую цепочку событий: + +1. Пользователь вошел в личный кабинет (`eventID = 1001`). +2. Пользователь ищет телефон (`eventID = 1003, product = 'phone'`). +3. Пользователь сделал заказ (`eventID = 1009`) +4. Пользователь сделал повторный заказ (`eventID = 1010`). + +Входная таблица: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +Сделаем запрос и узнаем, как далеко пользователь `user_id` смог пройти по цепочке за период в январе-феврале 2019-го года. + +Запрос: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +## retention {#retention} + +Аналитическая функция, которая показывает, насколько +выдерживаются те или иные условия, например, удержание динамики/уровня [посещаемости сайта](https://yandex.ru/support/partner2/statistics/metrika-visitors-statistics.html?lang=ru). + +Функция принимает набор (от 1 до 32) логических условий, как в [WHERE](../../sql-reference/statements/select.md#select-where), и применяет их к заданному набору данных. + +Условия, кроме первого, применяются попарно: результат второго будет истинным, если истинно первое и второе, третьего - если истинно первое и третье и т. д. + +**Синтаксис** + +``` sql +retention(cond1, cond2, ..., cond32) +``` + +**Параметры** + +- `cond` — вычисляемое условие или выражение, которое возвращает `UInt8` результат (1/0). + +**Возвращаемое значение** + +Массив из 1 или 0. + +- 1 — условие выполнено. +- 0 — условие не выполнено. + +Тип: `UInt8`. + +**Пример** + +Рассмотрим пример расчета функции `retention` для определения посещаемости сайта. + +**1.** Создадим таблицу для илюстрации примера. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32)ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +Входная таблица: + +Запрос: + +``` sql +SELECT * FROM retention_test +``` + +Ответ: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** Сгруппируем пользователей по уникальному идентификатору `uid` с помощью функции `retention`. + +Запрос: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +Результат: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** Рассчитаем количество посещений сайта за день. + +Запрос: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +Результат: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +Где: + +- `r1` - количество уникальных посетителей за 2020-01-01 (`cond1`). +- `r2` - количество уникальных посетителей в период между 2020-01-01 и 2020-01-02 (`cond1` и `cond2`). +- `r3` - количество уникальных посетителей в период между 2020-01-01 и 2020-01-03 (`cond1` и `cond3`). + +## uniqUpTo(N)(x) {#uniquptonx} + +Вычисляет количество различных значений аргумента, если оно меньше или равно N. +В случае, если количество различных значений аргумента больше N, возвращает N + 1. + +Рекомендуется использовать для маленьких N - до 10. Максимальное значение N - 100. + +Для состояния агрегатной функции используется количество оперативки равное 1 + N \* размер одного значения байт. +Для строк запоминается не криптографический хэш, имеющий размер 8 байт. То есть, для строк вычисление приближённое. + +Функция также работает для нескольких аргументов. + +Работает максимально быстро за исключением патологических случаев, когда используется большое значение N и количество уникальных значений чуть меньше N. + +Пример применения: + +``` text +Задача: показывать в отчёте только поисковые фразы, по которым было хотя бы 5 уникальных посетителей. +Решение: пишем в запросе GROUP BY SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/parametric_functions/) diff --git a/docs/ru/sql-reference/aggregate-functions/reference.md b/docs/ru/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..30ce6c87c6c --- /dev/null +++ b/docs/ru/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1737 @@ +# Справочник функций {#spravochnik-funktsii} + +## count {#agg_function-count} + +Вычисляет количество строк или не NULL значений . + +ClickHouse поддерживает следующие виды синтаксиса для `count`: + +- `count(expr)` или `COUNT(DISTINCT expr)`. +- `count()` или `COUNT(*)`. Синтаксис `count()` специфичен для ClickHouse. + +**Параметры** + +Функция может принимать: + +- Ноль параметров. +- Одно [выражение](../syntax.md#syntax-expressions). + +**Возвращаемое значение** + +- Если функция вызывается без параметров, она вычисляет количество строк. +- Если передаётся [выражение](../syntax.md#syntax-expressions) , то функция вычисляет количество раз, когда выражение возвращает не NULL. Если выражение возвращает значение типа [Nullable](../../sql-reference/data-types/nullable.md), то результат `count` не становится `Nullable`. Функция возвращает 0, если выражение возвращает `NULL` для всех строк. + +В обоих случаях тип возвращаемого значения [UInt64](../../sql-reference/data-types/int-uint.md). + +**Подробности** + +ClickHouse поддерживает синтаксис `COUNT(DISTINCT ...)`. Поведение этой конструкции зависит от настройки [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation). Она определяет, какая из функций [uniq\*](#agg_function-uniq) используется для выполнения операции. По умолчанию — функция [uniqExact](#agg_function-uniqexact). + +Запрос `SELECT count() FROM table` не оптимизирован, поскольку количество записей в таблице не хранится отдельно. Он выбирает небольшой столбец из таблицы и подсчитывает количество значений в нём. + +**Примеры** + +Пример 1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +Пример 2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +Этот пример показывает, что `count(DISTINCT num)` выполняется с помощью функции `uniqExact` в соответствии со значением настройки `count_distinct_implementation`. + +## any(x) {#agg_function-any} + +Выбирает первое попавшееся значение. +Порядок выполнения запроса может быть произвольным и даже каждый раз разным, поэтому результат данной функции недетерминирован. +Для получения детерминированного результата, можно использовать функции min или max вместо any. + +В некоторых случаях, вы всё-таки можете рассчитывать на порядок выполнения запроса. Это - случаи, когда SELECT идёт из подзапроса, в котором используется ORDER BY. + +При наличии в запросе `SELECT` секции `GROUP BY` или хотя бы одной агрегатной функции, ClickHouse (в отличие от, например, MySQL) требует, чтобы все выражения в секциях `SELECT`, `HAVING`, `ORDER BY` вычислялись из ключей или из агрегатных функций. То есть, каждый выбираемый из таблицы столбец, должен использоваться либо в ключах, либо внутри агрегатных функций. Чтобы получить поведение, как в MySQL, вы можете поместить остальные столбцы в агрегатную функцию `any`. + +## anyHeavy(x) {#agg_function-anyheavy} + +Выбирает часто встречающееся значение с помощью алгоритма «[heavy hitters](http://www.cs.umd.edu/~samir/498/karp.pdf)». Если существует значение, которое встречается чаще, чем в половине случаев, в каждом потоке выполнения запроса, то возвращается данное значение. В общем случае, результат недетерминирован. + +``` sql +anyHeavy(column) +``` + +**Аргументы** + +- `column` — имя столбца. + +**Пример** + +Возьмём набор данных [OnTime](../../getting-started/example-datasets/ontime.md) и выберем произвольное часто встречающееся значение в столбце `AirlineID`. + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## anyLast(x) {#agg_function-anylast} + +Выбирает последнее попавшееся значение. +Результат так же недетерминирован, как и для функции `any`. + +## groupBitAnd {#groupbitand} + +Применяет побитовое `И` для последовательности чисел. + +``` sql +groupBitAnd(expr) +``` + +**Параметры** + +`expr` – выражение, результат которого имеет тип данных `UInt*`. + +**Возвращаемое значение** + +Значение типа `UInt*`. + +**Пример** + +Тестовые данные: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Запрос: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +Где `num` — столбец с тестовыми данными. + +Результат: + +``` text +binary decimal +00000100 = 4 +``` + +## groupBitOr {#groupbitor} + +Применяет побитовое `ИЛИ` для последовательности чисел. + +``` sql +groupBitOr(expr) +``` + +**Параметры** + +`expr` – выражение, результат которого имеет тип данных `UInt*`. + +**Возвращаемое значение** + +Значение типа `UInt*`. + +**Пример** + +Тестовые данные: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Запрос: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +Где `num` — столбец с тестовыми данными. + +Результат: + +``` text +binary decimal +01111101 = 125 +``` + +## groupBitXor {#groupbitxor} + +Применяет побитовое `ИСКЛЮЧАЮЩЕЕ ИЛИ` для последовательности чисел. + +``` sql +groupBitXor(expr) +``` + +**Параметры** + +`expr` – выражение, результат которого имеет тип данных `UInt*`. + +**Возвращаемое значение** + +Значение типа `UInt*`. + +**Пример** + +Тестовые данные: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Запрос: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +Где `num` — столбец с тестовыми данными. + +Результат: + +``` text +binary decimal +01101000 = 104 +``` + +## groupBitmap {#groupbitmap} + +Bitmap или агрегатные вычисления для столбца с типом данных `UInt*`, возвращают кардинальность в виде значения типа UInt64, если добавить суффикс -State, то возвращают [объект bitmap](../../sql-reference/aggregate-functions/reference.md). + +``` sql +groupBitmap(expr) +``` + +**Параметры** + +`expr` – выражение, результат которого имеет тип данных `UInt*`. + +**Возвращаемое значение** + +Значение типа `UInt64`. + +**Пример** + +Тестовые данные: + +``` text +UserID +1 +1 +2 +3 +``` + +Запрос: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +Результат: + +``` text +num +3 +``` + +## min(x) {#agg_function-min} + +Вычисляет минимум. + +## max(x) {#agg_function-max} + +Вычисляет максимум. + +## argMin(arg, val) {#agg-function-argmin} + +Вычисляет значение arg при минимальном значении val. Если есть несколько разных значений arg для минимальных значений val, то выдаётся первое попавшееся из таких значений. + +**Пример:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## argMax(arg, val) {#agg-function-argmax} + +Вычисляет значение arg при максимальном значении val. Если есть несколько разных значений arg для максимальных значений val, то выдаётся первое попавшееся из таких значений. + +## sum(x) {#agg_function-sum} + +Вычисляет сумму. +Работает только для чисел. + +## sumWithOverflow(x) {#agg_function-sumwithoverflow} + +Вычисляет сумму чисел, используя для результата тот же тип данных, что и для входных параметров. Если сумма выйдет за максимальное значение для заданного типа данных, то функция вернёт ошибку. + +Работает только для чисел. + +## sumMap(key, value) {#summapkey-value} + +Производит суммирование массива ‘value’ по соответствующим ключам заданным в массиве ‘key’. +Количество элементов в ‘key’ и ‘value’ должно быть одинаковым для каждой строки, для которой происходит суммирование. +Возвращает кортеж из двух массивов - ключи в отсортированном порядке и значения, просуммированные по соответствующим ключам. + +Пример: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┘ +``` + +## skewPop {#skewpop} + +Вычисляет [коэффициент асимметрии](https://ru.wikipedia.org/wiki/Коэффициент_асимметрии) для последовательности. + +``` sql +skewPop(expr) +``` + +**Параметры** + +`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. + +**Возвращаемое значение** + +Коэффициент асимметрии заданного распределения. Тип — [Float64](../../sql-reference/aggregate-functions/reference.md) + +**Пример** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## skewSamp {#skewsamp} + +Вычисляет [выборочный коэффициент асимметрии](https://ru.wikipedia.org/wiki/Статистика_(функция_выборки)) для последовательности. + +Он представляет собой несмещенную оценку асимметрии случайной величины, если переданные значения образуют ее выборку. + +``` sql +skewSamp(expr) +``` + +**Параметры** + +`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. + +**Возвращаемое значение** + +Коэффициент асимметрии заданного распределения. Тип — [Float64](../../sql-reference/aggregate-functions/reference.md). Если `n <= 1` (`n` — размер выборки), тогда функция возвращает `nan`. + +**Пример** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## kurtPop {#kurtpop} + +Вычисляет [коэффициент эксцесса](https://ru.wikipedia.org/wiki/Коэффициент_эксцесса) последовательности. + +``` sql +kurtPop(expr) +``` + +**Параметры** + +`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. + +**Возвращаемое значение** + +Коэффициент эксцесса заданного распределения. Тип — [Float64](../../sql-reference/aggregate-functions/reference.md) + +**Пример** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## kurtSamp {#kurtsamp} + +Вычисляет [выборочный коэффициент эксцесса](https://ru.wikipedia.org/wiki/Статистика_(функция_выборки)) для последовательности. + +Он представляет собой несмещенную оценку эксцесса случайной величины, если переданные значения образуют ее выборку. + +``` sql +kurtSamp(expr) +``` + +**Параметры** + +`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. + +**Возвращаемое значение** + +Коэффициент эксцесса заданного распределения. Тип — [Float64](../../sql-reference/aggregate-functions/reference.md). Если `n <= 1` (`n` — размер выборки), тогда функция возвращает `nan`. + +**Пример** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## timeSeriesGroupSum(uid, timestamp, value) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` агрегирует временные ряды в которых не совпадают моменты. +Функция использует линейную интерполяцию между двумя значениями времени, а затем суммирует значения для одного и того же момента (как измеренные так и интерполированные) по всем рядам. + +- `uid` уникальный идентификатор временного ряда, `UInt64`. +- `timestamp` имеет тип `Int64` чтобы можно было учитывать милли и микросекунды. +- `value` представляет собой значение метрики. + +Функция возвращает массив кортежей с парами `(timestamp, aggregated_value)`. + +Временные ряды должны быть отсортированы по возрастанию `timestamp`. + +Пример: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +И результат будет: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## timeSeriesGroupRateSum(uid, ts, val) {#agg-function-timeseriesgroupratesum} + +Аналогично timeSeriesGroupSum, timeSeriesGroupRateSum будет вычислять производные по timestamp для рядов, а затем суммировать полученные производные для всех рядов для одного значения timestamp. +Также ряды должны быть отсортированы по возрастанию timestamp. + +Для пример из описания timeSeriesGroupSum результат будет следующим: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## avg(x) {#agg_function-avg} + +Вычисляет среднее. +Работает только для чисел. +Результат всегда Float64. + +## avgWeighted {#avgweighted} + +Вычисляет [среднее арифметическое взвешенное](https://ru.wikipedia.org/wiki/Среднее_арифметическое_взвешенное). + +**Синтаксис** + +``` sql +avgWeighted(x, weight) +``` + +**Параметры** + +- `x` — Значения. [Целые числа](../../sql-reference/aggregate-functions/reference.md) или [числа с плавающей запятой](../../sql-reference/aggregate-functions/reference.md). +- `weight` — Веса отдельных значений. [Целые числа](../../sql-reference/aggregate-functions/reference.md) или [числа с плавающей запятой](../../sql-reference/aggregate-functions/reference.md). + +Типы параметров должны совпадать. + +**Возвращаемое значение** + +- Среднее арифметическое взвешенное. +- `NaN`, если все веса равны 0. + +Тип: [Float64](../../sql-reference/aggregate-functions/reference.md) + +**Пример** + +Запрос: + +``` sql +SELECT avgWeighted(x, w) +FROM values('x Int8, w Int8', (4, 1), (1, 0), (10, 2)) +``` + +Результат: + +``` text +┌─avgWeighted(x, weight)─┐ +│ 8 │ +└────────────────────────┘ +``` + +## uniq {#agg_function-uniq} + +Приближённо вычисляет количество различных значений аргумента. + +``` sql +uniq(x[, ...]) +``` + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. + +**Возвращаемое значение** + +- Значение с типом данных [UInt64](../../sql-reference/aggregate-functions/reference.md). + +**Детали реализации** + +Функция: + +- Вычисляет хэш для всех параметров агрегации, а затем использует его в вычислениях. + +- Использует адаптивный алгоритм выборки. В качестве состояния вычисления функция использует выборку хэш-значений элементов размером до 65536. + + Этот алгоритм очень точен и очень эффективен по использованию CPU. Если запрос содержит небольшое количество этих функций, использование `uniq` почти так же эффективно, как и использование других агрегатных функций. + +- Результат детерминирован (не зависит от порядка выполнения запроса). + +Эту функцию рекомендуется использовать практически во всех сценариях. + +**Смотрите также** + +- [uniqCombined](#agg_function-uniqcombined) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined {#agg_function-uniqcombined} + +Приближённо вычисляет количество различных значений аргумента. + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +Функция `uniqCombined` — это хороший выбор для вычисления количества различных значений. + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. + +`HLL_precision` — это логарифм по основанию 2 от числа ячеек в [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). Необязательный, можно использовать функцию как `uniqCombined (x [,...])`. Для `HLL_precision` значение по умолчанию — 17, что фактически составляет 96 КБ пространства (2^17 ячеек, 6 бит каждая). + +**Возвращаемое значение** + +- Число типа [UInt64](../../sql-reference/aggregate-functions/reference.md). + +**Детали реализации** + +Функция: + +- Вычисляет хэш (64-битный для `String` и 32-битный для всех остальных типов) для всех параметров агрегации, а затем использует его в вычислениях. + +- Используется комбинация трёх алгоритмов: массив, хэш-таблица и HyperLogLog с таблицей коррекции погрешности. + + Для небольшого количества различных значений используется массив. Если размер набора больше, используется хэш-таблица. При дальнейшем увеличении количества значений, используется структура HyperLogLog, имеющая фиксированный размер в памяти. + +- Результат детерминирован (не зависит от порядка выполнения запроса). + +!!! note "Note" + Так как используется 32-битный хэш для не-`String` типов, результат будет иметь очень очень большую ошибку для количества разичных элементов существенно больше `UINT_MAX` (ошибка быстро растёт начиная с нескольких десятков миллиардов различных значений), таким образом в этом случае нужно использовать [uniqCombined64](#agg_function-uniqcombined64) + +По сравнению с функцией [uniq](#agg_function-uniq), `uniqCombined`: + +- Потребляет в несколько раз меньше памяти. +- Вычисляет с в несколько раз более высокой точностью. +- Обычно имеет немного более низкую производительность. В некоторых сценариях `uniqCombined` может показывать более высокую производительность, чем `uniq`, например, в случае распределенных запросов, при которых по сети передаётся большое количество состояний агрегации. + +**Смотрите также** + +- [uniq](#agg_function-uniq) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined64 {#agg_function-uniqcombined64} + +Использует 64-битный хэш для всех типов, в отличие от [uniqCombined](#agg_function-uniqcombined). + +## uniqHLL12 {#agg_function-uniqhll12} + +Вычисляет приблизительное число различных значений аргументов, используя алгоритм [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). + +``` sql +uniqHLL12(x[, ...]) +``` + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. + +**Возвращаемое значение** + +- Значение хэша с типом данных [UInt64](../../sql-reference/aggregate-functions/reference.md). + +**Детали реализации** + +Функция: + +- Вычисляет хэш для всех параметров агрегации, а затем использует его в вычислениях. + +- Использует алгоритм HyperLogLog для аппроксимации числа различных значений аргументов. + + Используется 212 5-битовых ячеек. Размер состояния чуть больше 2.5 КБ. Результат не точный (ошибка до ~10%) для небольших множеств (<10K элементов). Однако для множеств большой кардинальности (10K - 100M) результат довольно точен (ошибка до ~1.6%). Начиная с 100M ошибка оценки будет только расти и для множеств огромной кардинальности (1B+ элементов) функция возвращает результат с очень большой неточностью. + +- Результат детерминирован (не зависит от порядка выполнения запроса). + +Мы не рекомендуем использовать эту функцию. В большинстве случаев используйте функцию [uniq](#agg_function-uniq) или [uniqCombined](#agg_function-uniqcombined). + +**Смотрите также** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqExact](#agg_function-uniqexact) + +## uniqExact {#agg_function-uniqexact} + +Вычисляет точное количество различных значений аргументов. + +``` sql +uniqExact(x[, ...]) +``` + +Функцию `uniqExact` следует использовать, если вам обязательно нужен точный результат. В противном случае используйте функцию [uniq](#agg_function-uniq). + +Функция `uniqExact` расходует больше оперативной памяти, чем функция `uniq`, так как размер состояния неограниченно растёт по мере роста количества различных значений. + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. + +**Смотрите также** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqHLL12](#agg_function-uniqhll12) + +## groupArray(x), groupArray(max\_size)(x) {#agg_function-grouparray} + +Составляет массив из значений аргумента. +Значения в массив могут быть добавлены в любом (недетерминированном) порядке. + +Вторая версия (с параметром `max_size`) ограничивает размер результирующего массива `max_size` элементами. +Например, `groupArray(1)(x)` эквивалентно `[any(x)]`. + +В некоторых случаях, вы всё же можете рассчитывать на порядок выполнения запроса. Это — случаи, когда `SELECT` идёт из подзапроса, в котором используется `ORDER BY`. + +## groupArrayInsertAt(value, position) {#grouparrayinsertatvalue-position} + +Вставляет в массив значение в заданную позицию. + +!!! note "Примечание" + Эта функция использует нумерацию массивов с нуля, в отличие от принятой в SQL нумерации с единицы. + +Принимает на вход значение и позицию. Если на одну и ту же позицию вставляется несколько значений, в результирующем массиве может оказаться любое (первое в случае однопоточного выполнения). Если в позицию не вставляется ни одного значения, то позиции присваивается значение по умолчанию. + +Опциональные параметры: + +- Значение по умолчанию для подстановки на пустые позиции. +- Длина результирующего массива. Например, если вы хотите получать массивы одинакового размера для всех агрегатных ключей. При использовании этого параметра значение по умолчанию задавать обязательно. + +## groupArrayMovingSum {#agg_function-grouparraymovingsum} + +Вычисляет скользящую сумму входных значений. + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +Функция может принимать размер окна в качестве параметра. Если окно не указано, то функция использует размер окна, равный количеству строк в столбце. + +**Параметры** + +- `numbers_for_summing` — [выражение](../syntax.md#syntax-expressions), возвращающее значение числового типа. +- `window_size` — размер окна. + +**Возвращаемые значения** + +- Массив того же размера и типа, что и входные данные. + +**Пример** + +Таблица с исходными данными: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Запросы: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## groupArrayMovingAvg {#agg_function-grouparraymovingavg} + +Вычисляет скользящее среднее для входных значений. + + groupArrayMovingAvg(numbers_for_summing) + groupArrayMovingAvg(window_size)(numbers_for_summing) + +Функция может принимать размер окна в качестве параметра. Если окно не указано, то функция использует размер окна, равный количеству строк в столбце. + +**Параметры** + +- `numbers_for_summing` — [выражение](../syntax.md#syntax-expressions), возвращающее значение числового типа. +- `window_size` — размер окна. + +**Возвращаемые значения** + +- Массив того же размера и типа, что и входные данные. + +Функция использует [округление к меньшему по модулю](https://ru.wikipedia.org/wiki/Округление#Методы). Оно усекает десятичные разряды, незначимые для результирующего типа данных. + +**Пример** + +Таблица с исходными данными: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Запросы: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## groupUniqArray(x), groupUniqArray(max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} + +Составляет массив из различных значений аргумента. Расход оперативной памяти такой же, как у функции `uniqExact`. + +Функция `groupUniqArray(max_size)(x)` ограничивает размер результирующего массива до `max_size` элементов. Например, `groupUniqArray(1)(x)` равнозначно `[any(x)]`. + +## quantile {#quantile} + +Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности. + +Функция использует алгоритм [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) с размером резервуара до 8192 и случайным генератором чисел для для сэмплирования. Результат не детерминирован. Чтобы получить точную квантиль используйте функцию [quantileExact](#quantileexact). + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantile(level)(expr) +``` + +Алиас: `median`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). +- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql-reference/aggregate-functions/reference.md#data_types) или типов [Date](../../sql-reference/aggregate-functions/reference.md), [DateTime](../../sql-reference/aggregate-functions/reference.md). + +**Возвращаемое значение** + +- Приблизительный квантиль заданного уровня. + +Тип: + +- [Float64](../../sql-reference/aggregate-functions/reference.md) для входных данных числового типа. +- [Date](../../sql-reference/aggregate-functions/reference.md), если входные значения имеют тип `Date`. +- [DateTime](../../sql-reference/aggregate-functions/reference.md), если входные значения имеют тип `DateTime`. + +**Пример** + +Входная таблица: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Запрос: + +``` sql +SELECT quantile(val) FROM t +``` + +Результат: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileDeterministic {#quantiledeterministic} + +Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности. + +Функция использует алгоритм [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) с размером резервуара до 8192 и детерминированным алгоритмом сэмплирования. Результат детерминирован. Чтобы получить точную квантиль используйте функцию [quantileExact](#quantileexact). + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +Алиас: `medianDeterministic`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). +- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql-reference/aggregate-functions/reference.md#data_types) или типов [Date](../../sql-reference/aggregate-functions/reference.md), [DateTime](../../sql-reference/aggregate-functions/reference.md). +- `determinator` — Число, хэш которого используется при сэмплировании в алгоритме reservoir sampling, чтобы сделать результат детерминированным. В качестве детерминатора можно использовать любое определённое положительное число, например, идентификатор пользователя или события. Если одно и то же значение детерминатора попадается в выборке слишком часто, то функция выдаёт некорректный результат. + +**Возвращаемое значение** + +- Приблизительный квантиль заданного уровня. + +Тип: + +- [Float64](../../sql-reference/aggregate-functions/reference.md) для входных данных числового типа. +- [Date](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `Date`. +- [DateTime](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `DateTime`. + +**Пример** + +Входная таблица: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Запрос: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +Результат: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileExact {#quantileexact} + +Точно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности. + +Чтобы получить точный результат, все переданные значения собираются в массив, который затем частично сортируется. Таким образом, функция потребляет объем памяти `O(n)`, где `n` — количество переданных значений. Для небольшого числа значений эта функция эффективна. + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantileExact(level)(expr) +``` + +Алиас: `medianExact`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). +- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql-reference/aggregate-functions/reference.md#data_types) или типов [Date](../../sql-reference/aggregate-functions/reference.md), [DateTime](../../sql-reference/aggregate-functions/reference.md). + +**Возвращаемое значение** + +- Квантиль заданного уровня. + +Тип: + +- [Float64](../../sql-reference/aggregate-functions/reference.md) для входных данных числового типа. +- [Date](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `Date`. +- [DateTime](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `DateTime`. + +**Пример** + +Запрос: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +Результат: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileExactWeighted {#quantileexactweighted} + +Точно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, учитывая вес каждого её элемента. + +Чтобы получить точный результат, все переданные значения собираются в массив, который затем частично сортируется. Для каждого значения учитывается его вес (количество значений в выборке). В алгоритме используется хэш-таблица. Таким образом, если переданные значения часто повторяются, функция потребляет меньше оперативной памяти, чем [quantileExact](#quantileexact). Эту функцию можно использовать вместо `quantileExact` если указать вес 1. + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +Алиас: `medianExactWeighted`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). +- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql-reference/aggregate-functions/reference.md#data_types) или типов [Date](../../sql-reference/aggregate-functions/reference.md), [DateTime](../../sql-reference/aggregate-functions/reference.md). +- `weight` — Столбец с весам элементов последовательности. Вес — это количество повторений элемента в последовательности. + +**Возвращаемое значение** + +- Quantile of the specified level. + +Тип: + +- [Float64](../../sql-reference/aggregate-functions/reference.md) для входных данных числового типа. +- [Date](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `Date`. +- [DateTime](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `DateTime`. + +**Пример** + +Входная таблица: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +Запрос: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +Результат: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTiming {#quantiletiming} + +Вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности с детерминированной точностью. + +Результат детерминирован (не зависит от порядка обработки запроса). Функция оптимизирована для работы с последовательностями, описывающими такие распределения, как время загрузки веб-страниц или время отклика бэкенда. + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantileTiming(level)(expr) +``` + +Алиас: `medianTiming`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). + +- `expr` — [Выражение](../syntax.md#syntax-expressions) над значения столбца, которые возвращают данные типа [Float\*](../../sql-reference/aggregate-functions/reference.md). + + - Если в функцию передать отрицательные значения, то её поведение не определено. + - Если значение больше, чем 30 000 (например, время загрузки страницы превышает 30 секунд), то оно приравнивается к 30 000. + +**Точность** + +Вычисления точны при соблюдении следующих условий: + +- Размер выборки не превышает 5670 элементов. +- Размер выборки превышает 5670 элементов, но значение каждого элемента не больше 1024. + +В противном случае, результат вычисления округляется до ближайшего множителя числа 16. + +!!! note "Примечание" + Для указанного типа последовательностей функция производительнее и точнее, чем [quantile](#quantile). + +**Возвращаемое значение** + +- Квантиль заданного уровня. + +Тип: `Float32`. + +!!! note "Примечания" + Если в функцию `quantileTimingIf` не передать значений, то вернётся [NaN](../../sql-reference/aggregate-functions/reference.md#data_type-float-nan-inf). Это необходимо для отделения подобных случаев от случаев, когда результат 0. Подробности про сортировку `NaN` cмотрите в разделе [Секция ORDER BY](../../sql-reference/statements/select.md#select-order-by). + +**Пример** + +Входная таблица: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +Запрос: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +Результат: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTimingWeighted {#quantiletimingweighted} + +С детерминированной точностью вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, учитывая вес каждого элемента. + +Результат детерминирован (не зависит от порядка обработки запроса). Функция оптимизирована для работы с последовательностями, описывающими такие распределения, как время загрузки веб-страниц или время отклика бэкенда. + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +Алиас: `medianTimingWeighted`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). + +- `expr` — [Выражение](../syntax.md#syntax-expressions) над значения столбца, которые возвращают данные типа [Float\*](../../sql-reference/aggregate-functions/reference.md). + + - Если в функцию передать отрицательные значения, то её поведение не определено. + - Если значение больше, чем 30 000 (например, время загрузки страницы превышает 30 секунд), то оно приравнивается к 30 000. + +- `weight` — Столбец с весам элементов последовательности. Вес — это количество повторений элемента в последовательности. + +**Точность** + +Вычисления точны при соблюдении следующих условий: + +- Размер выборки не превышает 5670 элементов. +- Размер выборки превышает 5670 элементов, но значение каждого элемента не больше 1024. + +В противном случае, результат вычисления округляется до ближайшего множителя числа 16. + +!!! note "Примечание" + Для указанного типа последовательностей функция производительнее и точнее, чем [quantile](#quantile). + +**Возвращаемое значение** + +- Квантиль заданного уровня. + +Тип: `Float32`. + +!!! note "Примечания" + Если в функцию `quantileTimingIf` не передать значений, то вернётся [NaN](../../sql-reference/aggregate-functions/reference.md#data_type-float-nan-inf). Это необходимо для отделения подобных случаев от случаев, когда результат 0. Подробности про сортировку `NaN` cмотрите в разделе [Секция ORDER BY](../../sql-reference/statements/select.md#select-order-by). + +**Пример** + +Входная таблица: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +Запрос: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +Результат: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTDigest {#quantiletdigest} + +Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, используя алгоритм [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf). + +Максимальная ошибка 1%. Потребление памяти — `log(n)`, где `n` — число значений. Результат не детерминирован и зависит от порядка выполнения запроса. + +Производительность функции ниже, чем производительность функции [quantile](#quantile) или [quantileTiming](#quantiletiming). По соотношению размера состояния к точности вычисления, эта функция значительно превосходит `quantile`. + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantileTDigest(level)(expr) +``` + +Алиас: `medianTDigest`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). +- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql-reference/aggregate-functions/reference.md#data_types) или типов [Date](../../sql-reference/aggregate-functions/reference.md), [DateTime](../../sql-reference/aggregate-functions/reference.md). + +**Возвращаемое значение** + +- Приблизительную квантиль заданного уровня. + +Тип: + +- [Float64](../../sql-reference/aggregate-functions/reference.md) для входных данных числового типа. +- [Date](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `Date`. +- [DateTime](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `DateTime`. + +**Пример** + +Запрос: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +Результат: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## quantileTDigestWeighted {#quantiletdigestweighted} + +Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, используя алгоритм [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf). Функция учитывает вес каждого элемента последовательности. + +Максимальная ошибка 1%. Потребление памяти — `log(n)`, где `n` — число значений. Результат не детерминирован и зависит от порядка выполнения запроса. + +Производительность функции ниже, чем производительность функции [quantile](#quantile) или [quantileTiming](#quantiletiming). По соотношению размера состояния к точности вычисления, эта функция значительно превосходит `quantile`. + +Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. + +**Синтаксис** + +``` sql +quantileTDigestWeighted(level)(expr, weight) +``` + +Алиас: `medianTDigest`. + +**Параметры** + +- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). +- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql-reference/aggregate-functions/reference.md#data_types) или типов [Date](../../sql-reference/aggregate-functions/reference.md), [DateTime](../../sql-reference/aggregate-functions/reference.md). +- `weight` — Столбец с весам элементов последовательности. Вес — это количество повторений элемента в последовательности. + +**Возвращаемое значение** + +- Приблизительный квантиль заданного уровня. + +Тип: + +- [Float64](../../sql-reference/aggregate-functions/reference.md) для входных данных числового типа. +- [Date](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `Date`. +- [DateTime](../../sql-reference/aggregate-functions/reference.md) если входные значения имеют тип `DateTime`. + +**Пример** + +Запрос: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +Результат: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**Смотрите также** + +- [median](#median) +- [quantiles](#quantiles) + +## median {#median} + +Функции `median*` — алиасы для соответствущих функций `quantile*`. Они вычисляют медиану числовой последовательности. + +Functions: + +- `median` — алиас [quantile](#quantile). +- `medianDeterministic` — алиас [quantileDeterministic](#quantiledeterministic). +- `medianExact` — алиас [quantileExact](#quantileexact). +- `medianExactWeighted` — алиас [quantileExactWeighted](#quantileexactweighted). +- `medianTiming` — алиас [quantileTiming](#quantiletiming). +- `medianTimingWeighted` — алиас [quantileTimingWeighted](#quantiletimingweighted). +- `medianTDigest` — алиас [quantileTDigest](#quantiletdigest). +- `medianTDigestWeighted` — алиас [quantileTDigestWeighted](#quantiletdigestweighted). + +**Пример** + +Входная таблица: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Запрос: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +Результат: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +Для всех quantile-функций, также присутствуют соответствующие quantiles-функции: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Эти функции за один проход вычисляют все квантили перечисленных уровней и возвращают массив вычисленных значений. + +## varSamp(x) {#varsampx} + +Вычисляет величину `Σ((x - x̅)^2) / (n - 1)`, где `n` - размер выборки, `x̅`- среднее значение `x`. + +Она представляет собой несмещённую оценку дисперсии случайной величины, если переданные в функцию значения являются выборкой этой случайной величины. + +Возвращает `Float64`. В случае, когда `n <= 1`, возвращается `+∞`. + +## varPop(x) {#varpopx} + +Вычисляет величину `Σ((x - x̅)^2) / n`, где `n` - размер выборки, `x̅`- среднее значение `x`. + +То есть, дисперсию для множества значений. Возвращает `Float64`. + +## stddevSamp(x) {#stddevsampx} + +Результат равен квадратному корню от `varSamp(x)`. + +## stddevPop(x) {#stddevpopx} + +Результат равен квадратному корню от `varPop(x)`. + +## topK(N)(column) {#topkncolumn} + +Возвращает массив наиболее часто встречающихся значений в указанном столбце. Результирующий массив упорядочен по убыванию частоты значения (не по самим значениям). + +Реализует [Filtered Space-Saving](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) алгоритм для анализа TopK, на основе reduce-and-combine алгоритма из методики [Parallel Space Saving](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +Функция не дает гарантированного результата. В некоторых ситуациях могут возникать ошибки, и функция возвращает частые, но не наиболее частые значения. + +Рекомендуем использовать значения `N < 10`, при больших `N` снижается производительность. Максимально возможное значение `N = 65536`. + +**Аргументы** + +- ‘N’ - Количество значений. +- ‘x’ – Столбец. + +**Пример** + +Возьмём набор данных [OnTime](../../getting-started/example-datasets/ontime.md) и выберем 3 наиболее часто встречающихся значения в столбце `AirlineID`. + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## topKWeighted {#topkweighted} + +Аналогична `topK`, но дополнительно принимает положительный целочисленный параметр `weight`. Каждое значение учитывается `weight` раз при расчёте частоты. + +**Синтаксис** + +``` sql +topKWeighted(N)(x, weight) +``` + +**Параметры** + +- `N` — Количество элементов для выдачи. + +**Аргументы** + +- `x` – значение. +- `weight` — вес. [UInt8](../../sql-reference/aggregate-functions/reference.md). + +**Возвращаемое значение** + +Возвращает массив значений с максимально приближенной суммой весов. + +**Пример** + +Запрос: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +Результат: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## covarSamp(x, y) {#covarsampx-y} + +Вычисляет величину `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +Возвращает Float64. В случае, когда `n <= 1`, возвращается +∞. + +## covarPop(x, y) {#covarpopx-y} + +Вычисляет величину `Σ((x - x̅)(y - y̅)) / n`. + +## corr(x, y) {#corrx-y} + +Вычисляет коэффициент корреляции Пирсона: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## simpleLinearRegression {#simplelinearregression} + +Выполняет простую (одномерную) линейную регрессию. + +``` sql +simpleLinearRegression(x, y) +``` + +Параметры: + +- `x` — столбец со значениями зависимой переменной. +- `y` — столбец со значениями наблюдаемой переменной. + +Возвращаемые значения: + +Константы `(a, b)` результирующей прямой `y = a*x + b`. + +**Примеры** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## stochasticLinearRegression {#agg_functions-stochasticlinearregression} + +Функция реализует стохастическую линейную регрессию. Поддерживает пользовательские параметры для скорости обучения, коэффициента регуляризации L2, размера mini-batch и имеет несколько методов обновления весов ([Adam](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (по умолчанию), [simple SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Momentum](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### Параметры {#agg_functions-stochasticlinearregression-parameters} + +Есть 4 настраиваемых параметра. Они передаются в функцию последовательно, однако не обязательно указывать все, используются значения по умолчанию, однако хорошая модель требует некоторой настройки параметров. + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. Скорость обучения — коэффициент длины шага, при выполнении градиентного спуска. Слишком большая скорость обучения может привести к бесконечным весам модели. По умолчанию `0.00001`. +2. Коэффициент регуляризации l2. Помогает предотвратить подгонку. По умолчанию `0.1`. +3. Размер mini-batch задаёт количество элементов, чьи градиенты будут вычислены и просуммированы при выполнении одного шага градиентного спуска. Чистый стохастический спуск использует один элемент, однако использование mini-batch (около 10 элементов) делает градиентные шаги более стабильными. По умолчанию `15`. +4. Метод обновления весов, можно выбрать один из следующих: `Adam` (по умолчанию), `SGD`, `Momentum`, `Nesterov`. `Momentum` и `Nesterov` более требовательные к вычислительным ресурсам и памяти, однако они имеют высокую скорость схождения и устойчивости методов стохастического градиента. + +### Использование {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` используется на двух этапах: построение модели и предсказание новых данных. Чтобы построить модель и сохранить её состояние для дальнейшего использования, мы используем комбинатор `-State`. +Для прогнозирования мы используем функцию [evalMLMethod](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod), которая принимает в качестве аргументов состояние и свойства для прогнозирования. + + + +**1.** Построение модели + +Пример запроса: + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +Здесь нам также нужно вставить данные в таблицу `train_data`. Количество параметров не фиксировано, оно зависит только от количества аргументов, перешедших в `linearRegressionState`. Все они должны быть числовыми значениями. +Обратите внимание, что столбец с целевым значением (которое мы хотели бы научиться предсказывать) вставляется в качестве первого аргумента. + +**2.** Прогнозирование + +После сохранения состояния в таблице мы можем использовать его несколько раз для прогнозирования или смёржить с другими состояниями и создать новые, улучшенные модели. + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +Запрос возвращает столбец прогнозируемых значений. Обратите внимание, что первый аргумент `evalMLMethod` это объект `AggregateFunctionState`, далее идут столбцы свойств. + +`test_data` — это таблица, подобная `train_data`, но при этом может не содержать целевое значение. + +### Примечания {#agg_functions-stochasticlinearregression-notes} + +1. Объединить две модели можно следующим запросом: + + + + ``` sql + SELECT state1 + state2 FROM your_models + ``` + +где таблица `your_models` содержит обе модели. Запрос вернёт новый объект `AggregateFunctionState`. + +1. Пользователь может получать веса созданной модели для своих целей без сохранения модели, если не использовать комбинатор `-State`. + + + + ``` sql + SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data + ``` + +Подобный запрос строит модель и возвращает её веса, отвечающие параметрам моделей и смещение. Таким образом, в приведенном выше примере запрос вернет столбец с тремя значениями. + +**Смотрите также** + +- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) +- [Отличие линейной от логистической регрессии.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} + +Функция реализует стохастическую логистическую регрессию. Её можно использовать для задачи бинарной классификации, функция поддерживает те же пользовательские параметры, что и stochasticLinearRegression и работает таким же образом. + +### Параметры {#agg_functions-stochasticlogisticregression-parameters} + +Параметры те же, что и в stochasticLinearRegression: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +Смотрите раздел [parameters](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. Построение модели + + + +Смотрите раздел `Построение модели` в описании [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) . + + Прогнозируемые метки должны быть в диапазоне \[-1, 1\]. + +1. Прогнозирование + + + +Используя сохраненное состояние, можно предсказать вероятность наличия у объекта метки `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + +Запрос возвращает столбец вероятностей. Обратите внимание, что первый аргумент `evalMLMethod` это объект `AggregateFunctionState`, далее идут столбцы свойств. + +Мы также можем установить границу вероятности, которая присваивает элементам различные метки. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + +Тогда результатом будут метки. + +`test_data` — это таблица, подобная `train_data`, но при этом может не содержать целевое значение. + +**Смотрите также** + +- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) +- [Отличие линейной от логистической регрессии](https://moredez.ru/q/51225972/) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/reference/) diff --git a/docs/ru/sql-reference/ansi.md b/docs/ru/sql-reference/ansi.md new file mode 120000 index 00000000000..3cf6bffed67 --- /dev/null +++ b/docs/ru/sql-reference/ansi.md @@ -0,0 +1 @@ +../../en/sql-reference/ansi.md \ No newline at end of file diff --git a/docs/ru/sql-reference/data-types/aggregatefunction.md b/docs/ru/sql-reference/data-types/aggregatefunction.md new file mode 100644 index 00000000000..153a8e7e809 --- /dev/null +++ b/docs/ru/sql-reference/data-types/aggregatefunction.md @@ -0,0 +1,63 @@ +# AggregateFunction(name, types\_of\_arguments…) {#data-type-aggregatefunction} + +Промежуточное состояние агрегатной функции. Чтобы его получить, используются агрегатные функции с суффиксом `-State`. Чтобы в дальнейшем получить агрегированные данные необходимо использовать те же агрегатные функции с суффиксом `-Merge`. + +`AggregateFunction` — параметрический тип данных. + +**Параметры** + +- Имя агрегатной функции. + + Для параметрических агрегатных функций указываются также их параметры. + +- Типы аргументов агрегатной функции. + +**Пример** + +``` sql +CREATE TABLE t +( + column1 AggregateFunction(uniq, UInt64), + column2 AggregateFunction(anyIf, String, UInt8), + column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) +) ENGINE = ... +``` + +[uniq](../../sql-reference/data-types/aggregatefunction.md#agg_function-uniq), anyIf ([any](../../sql-reference/data-types/aggregatefunction.md#agg_function-any)+[If](../../sql-reference/data-types/aggregatefunction.md#agg-functions-combinator-if)) и [quantiles](../../sql-reference/data-types/aggregatefunction.md) — агрегатные функции, поддержанные в ClickHouse. + +## Особенности использования {#osobennosti-ispolzovaniia} + +### Вставка данных {#vstavka-dannykh} + +Для вставки данных используйте `INSERT SELECT` с агрегатными `-State`-функциями. + +**Примеры функций** + +``` sql +uniqState(UserID) +quantilesState(0.5, 0.9)(SendTiming) +``` + +В отличие от соответствующих функций `uniq` и `quantiles`, `-State`-функциями возвращают не готовое значение, а состояние. То есть, значение типа `AggregateFunction`. + +В запросах `SELECT` значения типа `AggregateFunction` выводятся во всех форматах, которые поддерживает ClickHouse, в виде implementation-specific бинарных данных. Если с помощью `SELECT` выполнить дамп данных, например, в формат `TabSeparated`, то потом этот дамп можно загрузить обратно с помощью запроса `INSERT`. + +### Выборка данных {#vyborka-dannykh} + +При выборке данных из таблицы `AggregatingMergeTree`, используйте `GROUP BY` и те же агрегатные функции, что и при вставке данных, но с суффиксом `-Merge`. + +Агрегатная функция с суффиксом `-Merge` берёт множество состояний, объединяет их, и возвращает результат полной агрегации данных. + +Например, следующие два запроса возвращают один и тот же результат: + +``` sql +SELECT uniq(UserID) FROM table + +SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) +``` + +## Пример использования {#primer-ispolzovaniia} + +Смотрите в описании движка [AggregatingMergeTree](../../sql-reference/data-types/aggregatefunction.md). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/ru/sql-reference/data-types/array.md b/docs/ru/sql-reference/data-types/array.md new file mode 100644 index 00000000000..09973d8162c --- /dev/null +++ b/docs/ru/sql-reference/data-types/array.md @@ -0,0 +1,72 @@ +# Array(T) {#data-type-array} + +Массив из элементов типа `T`. + +`T` может любым, в том числе, массивом. Таким образом поддержаны многомерные массивы. + +## Создание массива {#sozdanie-massiva} + +Массив можно создать с помощью функции: + +``` sql +array(T) +``` + +Также можно использовать квадратные скобки + +``` sql +[] +``` + +Пример создания массива: + +``` sql +SELECT array(1, 2) AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName(array(1, 2))─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴─────────────────────────┘ +``` + +``` sql +SELECT [1, 2] AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName([1, 2])─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴────────────────────┘ +``` + +## Особенности работы с типами данных {#osobennosti-raboty-s-tipami-dannykh} + +При создании массива «на лету» ClickHouse автоматически определяет тип аргументов как наиболее узкий тип данных, в котором можно хранить все перечисленные аргументы. Если среди аргументов есть [NULL](../../sql-reference/data-types/array.md#null-literal) или аргумент типа [Nullable](nullable.md#data_type-nullable), то тип элементов массива — [Nullable](nullable.md). + +Если ClickHouse не смог подобрать тип данных, то он сгенерирует исключение. Это произойдёт, например, при попытке создать массив одновременно со строками и числами `SELECT array(1, 'a')`. + +Примеры автоматического определения типа данных: + +``` sql +SELECT array(1, 2, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ +│ [1,2,NULL] │ Array(Nullable(UInt8)) │ +└────────────┴───────────────────────────────┘ +``` + +Если попытаться создать массив из несовместимых типов данных, то ClickHouse выбросит исключение: + +``` sql +SELECT array(1, 'a') +``` + +``` text +Received exception from server (version 1.1.54388): +Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/array/) diff --git a/docs/ru/sql_reference/data_types/boolean.md b/docs/ru/sql-reference/data-types/boolean.md similarity index 100% rename from docs/ru/sql_reference/data_types/boolean.md rename to docs/ru/sql-reference/data-types/boolean.md diff --git a/docs/ru/sql_reference/data_types/date.md b/docs/ru/sql-reference/data-types/date.md similarity index 100% rename from docs/ru/sql_reference/data_types/date.md rename to docs/ru/sql-reference/data-types/date.md diff --git a/docs/ru/sql-reference/data-types/datetime.md b/docs/ru/sql-reference/data-types/datetime.md new file mode 100644 index 00000000000..e7c3d8c24f1 --- /dev/null +++ b/docs/ru/sql-reference/data-types/datetime.md @@ -0,0 +1,122 @@ +# DateTime {#data_type-datetime} + +Позволяет хранить момент времени, который может быть представлен как календарная дата и время. + +Синтаксис: + +``` sql +DateTime([timezone]) +``` + +Диапазон значений: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. + +Точность: 1 секунда. + +## Использование {#ispolzovanie} + +Момент времени сохраняется как [Unix timestamp](https://ru.wikipedia.org/wiki/Unix-%D0%B2%D1%80%D0%B5%D0%BC%D1%8F), независимо от часового пояса и переходов на летнее/зимнее время. Дополнительно, тип `DateTime` позволяет хранить часовой пояс, единый для всей колонки, который влияет на то, как будут отображаться значения типа `DateTime` в текстовом виде и как будут парситься значения заданные в виде строк (‘2020-01-01 05:00:01’). Часовой пояс не хранится в строках таблицы (выборки), а хранится в метаданных колонки. +Список поддерживаемых временных зон можно найти в [IANA Time Zone Database](https://www.iana.org/time-zones). +Пакет `tzdata`, содержащий [базу данных часовых поясов IANA](https://www.iana.org/time-zones), должен быть установлен в системе. Используйте команду `timedatectl list-timezones` для получения списка часовых поясов, известных локальной системе. + +Часовой пояс для столбца типа `DateTime` можно в явном виде установить при создании таблицы. Если часовой пояс не установлен, то ClickHouse использует значение параметра [timezone](../../sql-reference/data-types/datetime.md#server_configuration_parameters-timezone), установленное в конфигурации сервера или в настройках операционной системы на момент запуска сервера. + +Консольный клиент ClickHouse по умолчанию использует часовой пояс сервера, если для значения `DateTime` часовой пояс не был задан в явном виде при инициализации типа данных. Чтобы использовать часовой пояс клиента, запустите [clickhouse-client](../../interfaces/cli.md) с параметром `--use_client_time_zone`. + +ClickHouse отображает значения типа `DateTime` в формате `YYYY-MM-DD hh:mm:ss`. Отображение можно поменять с помощью функции [formatDateTime](../../sql-reference/data-types/datetime.md#formatdatetime). + +При вставке данных в ClickHouse, можно использовать различные форматы даты и времени в зависимости от значения настройки [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format). + +## Примеры {#primery} + +**1.** Создание таблицы с столбцом типа `DateTime` и вставка данных в неё: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime('Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog; +``` + +``` sql +INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); +``` + +``` sql +SELECT * FROM dt; +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +- При вставке даты-времени как целого числа, оно трактуется как Unix Timestamp (UTC). Unix timestamp `1546300800` в часовом поясе `Europe/London (UTC+0)` представляет время `'2019-01-01 00:00:00'`. Однако, столбец `timestamp` имеет тип `DateTime('Europe/Moscow (UTC+3)')`, так что при выводе в виде строки время отобразится как `2019-01-01 03:00:00`. +- При вставке даты-времени в виде строки, время трактуется соответственно часовому поясу установленному для колонки. `'2019-01-01 00:00:00'` трактуется как время по Москве (и в базу сохраняется `1546290000`) + +**2.** Фильтрация по значениям даты-времени + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +Фильтровать по колонке типа `DateTime` можно, указывая строковое значение в фильтре `WHERE`. Конвертация будет выполнена автоматически: + +``` sql +SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +└─────────────────────┴──────────┘ +``` + +**3.** Получение часового пояса для колонки типа `DateTime`: + +``` sql +SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────column─┬─x─────────────────────────┐ +│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ +└─────────────────────┴───────────────────────────┘ +``` + +**4.** Конвертация часовых поясов + +``` sql +SELECT +toDateTime(timestamp, 'Europe/London') as lon_time, +toDateTime(timestamp, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────lon_time──┬────────────mos_time─┐ +│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ +│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ +└─────────────────────┴─────────────────────┘ +``` + +## See Also {#see-also} + +- [Функции преобразования типов](../../sql-reference/data-types/datetime.md) +- [Функции для работы с датой и временем](../../sql-reference/data-types/datetime.md) +- [Функции для работы с массивами](../../sql-reference/data-types/datetime.md) +- [Настройка `date_time_input_format`](../../operations/settings/settings.md#settings-date_time_input_format) +- [Конфигурационный параметр сервера `timezone`](../../sql-reference/data-types/datetime.md#server_configuration_parameters-timezone) +- [Операторы для работы с датой и временем](../../sql-reference/data-types/datetime.md#operators-datetime) +- [Тип данных `Date`](date.md) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/datetime/) diff --git a/docs/ru/sql-reference/data-types/datetime64.md b/docs/ru/sql-reference/data-types/datetime64.md new file mode 100644 index 00000000000..bc9394276ee --- /dev/null +++ b/docs/ru/sql-reference/data-types/datetime64.md @@ -0,0 +1,97 @@ +# DateTime64 {#data_type-datetime64} + +Позволяет хранить момент времени, который может быть представлен как календарная дата и время, с заданной суб-секундной точностью. + +Размер тика/точность: 10-precision секунд, где precision - целочисленный параметр типа. + +Синтаксис: + +``` sql +DateTime64(precision, [timezone]) +``` + +Данные хранятся в виде количества ‘тиков’, прошедших с момента начала эпохи (1970-01-01 00:00:00 UTC), в Int64. Размер тика определяется параметром precision. Дополнительно, тип `DateTime64` позволяет хранить часовой пояс, единый для всей колонки, который влияет на то, как будут отображаться значения типа `DateTime64` в текстовом виде и как будут парситься значения заданные в виде строк (‘2020-01-01 05:00:01.000’). Часовой пояс не хранится в строках таблицы (выборки), а хранится в метаданных колонки. Подробнее см. [DateTime](datetime.md). + +## Пример {#primer} + +**1.** Создание таблицы с столбцом типа `DateTime64` и вставка данных в неё: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime64(3, 'Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog +``` + +``` sql +INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) +``` + +``` sql +SELECT * FROM dt +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00.000 │ 1 │ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +- При вставке даты-времени как числа (аналогично ‘Unix timestamp’), время трактуется как UTC. Unix timestamp `1546300800` в часовом поясе `Europe/London (UTC+0)` представляет время `'2019-01-01 00:00:00'`. Однако, столбец `timestamp` имеет тип `DateTime('Europe/Moscow (UTC+3)')`, так что при выводе в виде строки время отобразится как `2019-01-01 03:00:00`. +- При вставке даты-времени в виде строки, время трактуется соответственно часовому поясу установленному для колонки. `'2019-01-01 00:00:00'` трактуется как время по Москве (и в базу сохраняется `'2018-12-31 21:00:00'` в виде Unix Timestamp) + +**2.** Фильтрация по значениям даты-времени + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +В отличие от типа `DateTime`, `DateTime64` не конвертируется из строк автоматически + +**3.** Получение часового пояса для значения типа `DateTime64`: + +``` sql +SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────────column─┬─x──────────────────────────────┐ +│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ +└─────────────────────────┴────────────────────────────────┘ +``` + +**4.** Конвертация часовых поясов + +``` sql +SELECT +toDateTime64(timestamp, 3, 'Europe/London') as lon_time, +toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────────lon_time──┬────────────────mos_time─┐ +│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ +│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ +└─────────────────────────┴─────────────────────────┘ +``` + +## See Also {#see-also} + +- [Функции преобразования типов](../../sql-reference/data-types/datetime64.md) +- [Функции для работы с датой и временем](../../sql-reference/data-types/datetime64.md) +- [Функции для работы с массивами](../../sql-reference/data-types/datetime64.md) +- [Настройка `date_time_input_format`](../../operations/settings/settings.md#settings-date_time_input_format) +- [Конфигурационный параметр сервера `timezone`](../../sql-reference/data-types/datetime64.md#server_configuration_parameters-timezone) +- [Операторы для работы с датой и временем](../../sql-reference/data-types/datetime64.md#operators-datetime) +- [Тип данных `Date`](date.md) +- [Тип данных `DateTime`](datetime.md) diff --git a/docs/ru/sql_reference/data_types/decimal.md b/docs/ru/sql-reference/data-types/decimal.md similarity index 100% rename from docs/ru/sql_reference/data_types/decimal.md rename to docs/ru/sql-reference/data-types/decimal.md diff --git a/docs/ru/sql-reference/data-types/domains/index.md b/docs/ru/sql-reference/data-types/domains/index.md new file mode 100644 index 00000000000..ddcb5b21d82 --- /dev/null +++ b/docs/ru/sql-reference/data-types/domains/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: Domains +toc_priority: 56 +--- + + diff --git a/docs/ru/sql_reference/data_types/domains/ipv4.md b/docs/ru/sql-reference/data-types/domains/ipv4.md similarity index 100% rename from docs/ru/sql_reference/data_types/domains/ipv4.md rename to docs/ru/sql-reference/data-types/domains/ipv4.md diff --git a/docs/ru/sql_reference/data_types/domains/ipv6.md b/docs/ru/sql-reference/data-types/domains/ipv6.md similarity index 100% rename from docs/ru/sql_reference/data_types/domains/ipv6.md rename to docs/ru/sql-reference/data-types/domains/ipv6.md diff --git a/docs/ru/sql_reference/data_types/domains/overview.md b/docs/ru/sql-reference/data-types/domains/overview.md similarity index 100% rename from docs/ru/sql_reference/data_types/domains/overview.md rename to docs/ru/sql-reference/data-types/domains/overview.md diff --git a/docs/ru/sql-reference/data-types/enum.md b/docs/ru/sql-reference/data-types/enum.md new file mode 100644 index 00000000000..792c82f7410 --- /dev/null +++ b/docs/ru/sql-reference/data-types/enum.md @@ -0,0 +1,124 @@ +# Enum {#enum} + +Перечисляемый тип данных, содержащий именованные значения. + +Именованные значения задаются парами `'string' = integer`. ClickHouse хранит только числа, но допускает операции над ними с помощью заданных имён. + +ClickHouse поддерживает: + +- 8-битный `Enum`. Может содержать до 256 значений, пронумерованных в диапазоне `[-128, 127]`. +- 16-битный `Enum`. Может содержать до 65536 значений, пронумерованных в диапазоне `[-32768, 32767]`. + +ClickHouse автоматически выбирает размерность `Enum` при вставке данных. Чтобы точно понимать размер хранимых данных можно использовать типы `Enum8` или `Enum16`. + +## Примеры использования {#primery-ispolzovaniia} + +Создадим таблицу со столбцом типа `Enum8('hello' = 1, 'world' = 2)`. + +``` sql +CREATE TABLE t_enum +( + x Enum('hello' = 1, 'world' = 2) +) +ENGINE = TinyLog +``` + +В столбец `x` можно сохранять только значения, перечисленные при определении типа, т.е. `'hello'` или `'world'`. Если вы попытаетесь сохранить любое другое значение, ClickHouse сгенерирует исключение. ClickHouse автоматически выберет размерность 8-bit для этого `Enum`. + +``` sql +INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') +``` + +``` text +Ok. +``` + +``` sql +insert into t_enum values('a') +``` + +``` text +Exception on client: +Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) +``` + +При запросе данных из таблицы ClickHouse выдаст строковые значения из `Enum`. + +``` sql +SELECT * FROM t_enum +``` + +``` text +┌─x─────┐ +│ hello │ +│ world │ +│ hello │ +└───────┘ +``` + +Если необходимо увидеть цифровые эквиваленты строкам, то необходимо привести тип `Enum` к целочисленному. + +``` sql +SELECT CAST(x AS Int8) FROM t_enum +``` + +``` text +┌─CAST(x, 'Int8')─┐ +│ 1 │ +│ 2 │ +│ 1 │ +└─────────────────┘ +``` + +Чтобы создать значение типа `Enum` в запросе, также необходимо использовать функцию `CAST`. + +``` sql +SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) +``` + +``` text +┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ +│ Enum8('a' = 1, 'b' = 2) │ +└─────────────────────────────────────────────────────┘ +``` + +## Общие правила и особенности использования {#obshchie-pravila-i-osobennosti-ispolzovaniia} + +Для каждого из значений прописывается число в диапазоне `-128 .. 127` для `Enum8` или в диапазоне `-32768 .. 32767` для `Enum16`. Все строки должны быть разными, числа - тоже. Разрешена пустая строка. При указании такого типа (в определении таблицы), числа могут идти не подряд и в произвольном порядке. При этом, порядок не имеет значения. + +Ни строка, ни цифровое значение в `Enum` не могут быть [NULL](../../sql-reference/syntax.md#null-literal). + +`Enum` может быть передан в тип [Nullable](nullable.md). Таким образом, если создать таблицу запросом + +``` sql +CREATE TABLE t_enum_nullable +( + x Nullable( Enum8('hello' = 1, 'world' = 2) ) +) +ENGINE = TinyLog +``` + +, то в ней можно будет хранить не только `'hello'` и `'world'`, но и `NULL`. + +``` sql +INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) +``` + +В оперативке столбец типа `Enum` представлен так же, как `Int8` или `Int16` соответствующими числовыми значениями. +При чтении в текстовом виде, парсит значение как строку и ищет соответствующую строку из множества значений Enum-а. Если не находит - кидается исключение. +При записи в текстовом виде, записывает значение как соответствующую строку. Если в данных столбца есть мусор - числа не из допустимого множества, то кидается исключение. При чтении и записи в бинарном виде, оно осуществляется так же, как для типов данных Int8, Int16. +Неявное значение по умолчанию - это значение с минимальным номером. + +При `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` и т. п., Enum-ы ведут себя так же, как соответствующие числа. Например, при ORDER BY они сортируются по числовым значениям. Функции сравнения на равенство и сравнения на отношение порядка двух Enum-ов работают с Enum-ами так же, как с числами. + +Сравнивать Enum с числом нельзя. Можно сравнивать Enum с константной строкой - при этом, для строки ищется соответствующее значение Enum-а; если не находится - кидается исключение. Поддерживается оператор IN, где слева стоит Enum, а справа - множество строк. В этом случае, строки рассматриваются как значения соответствующего Enum-а. + +Большинство операций с числами и со строками не имеет смысла и не работают для Enum-ов: например, к Enum-у нельзя прибавить число. +Для Enum-а естественным образом определяется функция `toString`, которая возвращает его строковое значение. + +Также для Enum-а определяются функции `toT`, где T - числовой тип. При совпадении T с типом столбца Enum-а, преобразование работает бесплатно. +При ALTER, есть возможность бесплатно изменить тип Enum-а, если меняется только множество значений. При этом, можно добавлять новые значения; можно удалять старые значения (это безопасно только если они ни разу не использовались, так как это не проверяется). В качестве «защиты от дурака», нельзя менять числовые значения у имеющихся строк - в этом случае, кидается исключение. + +При ALTER, есть возможность поменять Enum8 на Enum16 и обратно - так же, как можно поменять Int8 на Int16. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/enum/) diff --git a/docs/ru/sql-reference/data-types/fixedstring.md b/docs/ru/sql-reference/data-types/fixedstring.md new file mode 100644 index 00000000000..1d801bb6e92 --- /dev/null +++ b/docs/ru/sql-reference/data-types/fixedstring.md @@ -0,0 +1,56 @@ +# FixedString {#fixedstring} + +Строка фиксированной длины `N` байт (не символов, не кодовых точек). + +Чтобы объявить столбец типа `FixedString`, используйте следующий синтаксис: + +``` sql + FixedString(N) +``` + +Где `N` — натуральное число. + +Тип `FixedString` эффективен, когда данные имеют длину ровно `N` байт. Во всех остальных случаях использование FixedString может привести к снижению эффективности. + +Примеры значений, которые можно эффективно хранить в столбцах типа `FixedString`: + +- Двоичное представление IP-адреса (`FixedString(16)` для IPv6). +- Коды языков (ru\_RU, en\_US … ). +- Коды валют (USD, RUB … ). +- Двоичное представление хэшей (`FixedString(16)` для MD5, `FixedString(32)` для SHA256). + +Для хранения значений UUID используйте тип данных [UUID](uuid.md). + +При вставке данных, ClickHouse: + +- Дополняет строку нулевыми байтами, если строка содержит меньше байтов, чем `N`. +- Генерирует исключение `Too large value for FixedString(N)`, если строка содержит более `N` байт. + +При выборе данных ClickHouse не обрезает нулевые байты в конце строки. Если вы используете секцию `WHERE`, то необходимо добавлять нулевые байты вручную, чтобы ClickHouse смог сопоставить выражение из фильтра значению `FixedString`. Следующий пример показывает, как использовать секцию `WHERE` с `FixedString`. + +Рассмотрим следующую таблицу с единственным столбцом типа `FixedString(2)`: + +``` text +┌─name──┐ +│ b │ +└───────┘ +``` + +Запрос `SELECT * FROM FixedStringTable WHERE a = 'b'` не возвращает необходимых данных. Необходимо дополнить шаблон фильтра нулевыми байтами. + +``` sql +SELECT * FROM FixedStringTable +WHERE a = 'b\0' +``` + +``` text +┌─a─┐ +│ b │ +└───┘ +``` + +Это поведение отличается от поведения MySQL для типа `CHAR`, где строки дополняются пробелами, а пробелы перед выводом вырезаются. + +Обратите внимание, что длина значения `FixedString(N)` постоянна. Функция [length](../../sql-reference/data-types/fixedstring.md#array_functions-length) возвращает `N` даже если значение `FixedString(N)` заполнено только нулевыми байтами, однако функция [empty](../../sql-reference/data-types/fixedstring.md#empty) в этом же случае возвращает `1`. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/fixedstring/) diff --git a/docs/ru/sql_reference/data_types/float.md b/docs/ru/sql-reference/data-types/float.md similarity index 100% rename from docs/ru/sql_reference/data_types/float.md rename to docs/ru/sql-reference/data-types/float.md diff --git a/docs/ru/sql-reference/data-types/index.md b/docs/ru/sql-reference/data-types/index.md new file mode 100644 index 00000000000..8b4f28aad3e --- /dev/null +++ b/docs/ru/sql-reference/data-types/index.md @@ -0,0 +1,12 @@ +--- +toc_folder_title: "\u0422\u0438\u043F\u044B \u0434\u0430\u043D\u043D\u044B\u0445" +toc_priority: 37 +toc_title: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0435" +--- + +# Типы данных {#data_types} + +ClickHouse может сохранять в ячейках таблиц данные различных типов. + +Раздел содержит описания поддерживаемых типов данных и специфику их использования и/или реализации, если таковые имеются. +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/) diff --git a/docs/ru/sql_reference/data_types/int_uint.md b/docs/ru/sql-reference/data-types/int-uint.md similarity index 100% rename from docs/ru/sql_reference/data_types/int_uint.md rename to docs/ru/sql-reference/data-types/int-uint.md diff --git a/docs/ru/sql_reference/data_types/nested_data_structures/index.md b/docs/ru/sql-reference/data-types/nested-data-structures/index.md similarity index 100% rename from docs/ru/sql_reference/data_types/nested_data_structures/index.md rename to docs/ru/sql-reference/data-types/nested-data-structures/index.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 similarity index 100% rename from docs/ru/sql_reference/data_types/nested_data_structures/nested.md rename to docs/ru/sql-reference/data-types/nested-data-structures/nested.md diff --git a/docs/ru/sql-reference/data-types/nullable.md b/docs/ru/sql-reference/data-types/nullable.md new file mode 100644 index 00000000000..4ceb94876ab --- /dev/null +++ b/docs/ru/sql-reference/data-types/nullable.md @@ -0,0 +1,46 @@ +# Nullable(TypeName) {#data_type-nullable} + +Позволяет работать как со значением типа `TypeName` так и с отсутствием этого значения ([NULL](../../sql-reference/data-types/nullable.md)) в одной и той же переменной, в том числе хранить `NULL` в таблицах вместе со значения типа `TypeName`. Например, в столбце типа `Nullable(Int8)` можно хранить значения типа `Int8`, а в тех строках, где значения нет, будет храниться `NULL`. + +В качестве `TypeName` нельзя использовать составные типы данных [Array](array.md#data_type-array) и [Tuple](tuple.md). Составные типы данных могут содержать значения типа `Nullable`, например `Array(Nullable(Int8))`. + +Поле типа `Nullable` нельзя включать в индексы. + +`NULL` — значение по умолчанию для типа `Nullable`, если в конфигурации сервера ClickHouse не указано иное. + +## Особенности хранения {#osobennosti-khraneniia} + +Для хранения значения типа `Nullable` ClickHouse использует: + +- Отдельный файл с масками `NULL` (далее маска). +- Непосредственно файл со значениями. + +Маска определяет, что лежит в ячейке данных: `NULL` или значение. + +В случае, когда маска указывает, что в ячейке хранится `NULL`, в файле значений хранится значение по умолчанию для типа данных. Т.е. если, например, поле имеет тип `Nullable(Int8)`, то ячейка будет хранить значение по умолчанию для `Int8`. Эта особенность увеличивает размер хранилища. + +!!! info "Info" + Почти всегда использование `Nullable` снижает производительность, учитывайте это при проектировании своих баз. + +## Пример использования {#primer-ispolzovaniia} + +``` sql +CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog +``` + +``` sql +INSERT INTO t_null VALUES (1, NULL), (2, 3) +``` + +``` sql +SELECT x + y from t_null +``` + +``` text +┌─plus(x, y)─┐ +│ ᴺᵁᴸᴸ │ +│ 5 │ +└────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/nullable/) diff --git a/docs/ru/sql-reference/data-types/simpleaggregatefunction.md b/docs/ru/sql-reference/data-types/simpleaggregatefunction.md new file mode 120000 index 00000000000..76a7ef3b802 --- /dev/null +++ b/docs/ru/sql-reference/data-types/simpleaggregatefunction.md @@ -0,0 +1 @@ +../../../en/sql-reference/data-types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/ru/sql_reference/data_types/special_data_types/expression.md b/docs/ru/sql-reference/data-types/special-data-types/expression.md similarity index 100% rename from docs/ru/sql_reference/data_types/special_data_types/expression.md rename to docs/ru/sql-reference/data-types/special-data-types/expression.md diff --git a/docs/ru/sql_reference/data_types/special_data_types/index.md b/docs/ru/sql-reference/data-types/special-data-types/index.md similarity index 100% rename from docs/ru/sql_reference/data_types/special_data_types/index.md rename to docs/ru/sql-reference/data-types/special-data-types/index.md diff --git a/docs/ru/sql-reference/data-types/special-data-types/interval.md b/docs/ru/sql-reference/data-types/special-data-types/interval.md new file mode 100644 index 00000000000..8a4ace179a6 --- /dev/null +++ b/docs/ru/sql-reference/data-types/special-data-types/interval.md @@ -0,0 +1,78 @@ +# Interval {#data-type-interval} + +Семейство типов данных, представляющих интервалы дат и времени. Оператор [INTERVAL](../../../sql-reference/data-types/special-data-types/interval.md#operator-interval) возвращает значения этих типов. + +!!! warning "Внимание" + Нельзя использовать типы данных `Interval` для хранения данных в таблице. + +Структура: + +- Интервал времени в виде положительного целого числа. +- Тип интервала. + +Поддержанные типы интервалов: + +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +Каждому типу интервала соответствует отдельный тип данных. Например, тип данных `IntervalDay` соответствует интервалу `DAY`: + +``` sql +SELECT toTypeName(INTERVAL 4 DAY) +``` + +``` text +┌─toTypeName(toIntervalDay(4))─┐ +│ IntervalDay │ +└──────────────────────────────┘ +``` + +## Использование {#data-type-interval-usage-remarks} + +Значения типов `Interval` можно использовать в арифметических операциях со значениями типов [Date](../../../sql-reference/data-types/special-data-types/interval.md) и [DateTime](../../../sql-reference/data-types/special-data-types/interval.md). Например, можно добавить 4 дня к текущей дате: + +``` sql +SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY +``` + +``` text +┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ +│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ +└─────────────────────┴───────────────────────────────┘ +``` + +Нельзя объединять интервалы различных типов. Нельзя использовать интервалы вида `4 DAY 1 HOUR`. Вместо этого выражайте интервал в единицах меньших или равных минимальной единице интервала, например, интервал «1 день и 1 час» можно выразить как `25 HOUR` или `90000 SECOND`. + +Арифметические операции со значениями типов `Interval` не доступны, однако можно последовательно добавлять различные интервалы к значениям типов `Date` и `DateTime`. Например: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +Следующий запрос приведёт к генерированию исключения: + +``` sql +select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) +``` + +``` text +Received exception from server (version 19.14.1): +Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. +``` + +## Смотрите также {#smotrite-takzhe} + +- Оператор[INTERVAL](../../../sql-reference/data-types/special-data-types/interval.md#operator-interval) +- Функция приведения типа [toInterval](../../../sql-reference/data-types/special-data-types/interval.md#function-tointerval) diff --git a/docs/ru/sql-reference/data-types/special-data-types/nothing.md b/docs/ru/sql-reference/data-types/special-data-types/nothing.md new file mode 100644 index 00000000000..9644f102522 --- /dev/null +++ b/docs/ru/sql-reference/data-types/special-data-types/nothing.md @@ -0,0 +1,17 @@ +# Nothing {#nothing} + +Этот тип данных предназначен только для того, чтобы представлять [NULL](../../../sql-reference/data-types/special-data-types/nothing.md), т.е. отсутствие значения. + +Невозможно создать значение типа `Nothing`, поэтому он используется там, где значение не подразумевается. Например, `NULL` записывается как `Nullable(Nothing)` ([Nullable](../../../sql-reference/data-types/special-data-types/nothing.md) — это тип данных, позволяющий хранить `NULL` в таблицах). Также тип `Nothing` используется для обозначения пустых массивов: + +``` sql +SELECT toTypeName(Array()) +``` + +``` text +┌─toTypeName(array())─┐ +│ Array(Nothing) │ +└─────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/special_data_types/nothing/) diff --git a/docs/ru/sql_reference/data_types/special_data_types/set.md b/docs/ru/sql-reference/data-types/special-data-types/set.md similarity index 100% rename from docs/ru/sql_reference/data_types/special_data_types/set.md rename to docs/ru/sql-reference/data-types/special-data-types/set.md diff --git a/docs/ru/sql_reference/data_types/string.md b/docs/ru/sql-reference/data-types/string.md similarity index 100% rename from docs/ru/sql_reference/data_types/string.md rename to docs/ru/sql-reference/data-types/string.md diff --git a/docs/ru/sql-reference/data-types/tuple.md b/docs/ru/sql-reference/data-types/tuple.md new file mode 100644 index 00000000000..d842f66a4c7 --- /dev/null +++ b/docs/ru/sql-reference/data-types/tuple.md @@ -0,0 +1,45 @@ +# Tuple(T1, T2, …) {#tuplet1-t2} + +Кортеж из элементов любого [типа](index.md#data_types). Элементы кортежа могут быть одного или разных типов. + +Кортежи используются для временной группировки столбцов. Столбцы могут группироваться при использовании выражения IN в запросе, а также для указания нескольких формальных параметров лямбда-функций. Подробнее смотрите разделы [Операторы IN](../../sql-reference/data-types/tuple.md), [Функции высшего порядка](../../sql-reference/data-types/tuple.md#higher_order_functions). + +Кортежи могут быть результатом запроса. В этом случае, в текстовых форматах кроме JSON, значения выводятся в круглых скобках через запятую. В форматах JSON, кортежи выводятся в виде массивов (в квадратных скобках). + +## Создание кортежа {#sozdanie-kortezha} + +Кортеж можно создать с помощью функции + +``` sql +tuple(T1, T2, ...) +``` + +Пример создания кортежа: + +``` sql +SELECT tuple(1,'a') AS x, toTypeName(x) +``` + +``` text +┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ +│ (1,'a') │ Tuple(UInt8, String) │ +└─────────┴───────────────────────────┘ +``` + +## Особенности работы с типами данных {#osobennosti-raboty-s-tipami-dannykh} + +При создании кортежа «на лету» ClickHouse автоматически определяет тип каждого аргументов как минимальный из типов, который может сохранить значение аргумента. Если аргумент — [NULL](../../sql-reference/data-types/tuple.md#null-literal), то тип элемента кортежа — [Nullable](nullable.md). + +Пример автоматического определения типа данных: + +``` sql +SELECT tuple(1,NULL) AS x, toTypeName(x) +``` + +``` text +┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ +│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ +└──────────┴─────────────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/tuple/) diff --git a/docs/ru/sql-reference/data-types/uuid.md b/docs/ru/sql-reference/data-types/uuid.md new file mode 100644 index 00000000000..9d667a50526 --- /dev/null +++ b/docs/ru/sql-reference/data-types/uuid.md @@ -0,0 +1,72 @@ +# UUID {#uuid-data-type} + +Универсальный уникальный идентификатор (UUID) - это 16-байтовое число, используемое для идентификации записей. Подробнее про UUID читайте на [Википедии](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +Пример UUID значения представлен ниже: + +``` text +61f0c404-5cb3-11e7-907b-a6006ad3dba0 +``` + +Если при вставке новой записи значение для UUID-колонки не указано, UUID идентификатор будет заполнен нулями: + +``` text +00000000-0000-0000-0000-000000000000 +``` + +## Как сгенерировать UUID {#kak-sgenerirovat-uuid} + +Для генерации UUID-значений предназначена функция [generateUUIDv4](../../sql-reference/data-types/uuid.md). + +## Примеры использования {#primery-ispolzovaniia} + +Ниже представлены примеры работы с UUID. + +**Пример 1** + +Этот пример демонстрирует, как создать таблицу с UUID-колонкой и добавить в нее сгенерированный UUID. + +``` sql +CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog +``` + +``` sql +INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +└──────────────────────────────────────┴───────────┘ +``` + +**Пример 2** + +В этом примере, при добавлении записи в таблицу значение для UUID-колонки не задано. UUID будет заполнен нулями. + +``` sql +INSERT INTO t_uuid (y) VALUES ('Example 2') +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ +└──────────────────────────────────────┴───────────┘ +``` + +## Ограничения {#ogranicheniia} + +Тип данных UUID можно использовать только с функциями, которые поддерживаются типом данных [String](string.md) (например, [min](../../sql-reference/data-types/uuid.md#agg_function-min), [max](../../sql-reference/data-types/uuid.md#agg_function-max), и [count](../../sql-reference/data-types/uuid.md#agg_function-count)). + +Тип данных UUID не поддерживается арифметическими операциями (например, [abs](../../sql-reference/data-types/uuid.md#arithm_func-abs)) или агрегатными функциями, такими как [sum](../../sql-reference/data-types/uuid.md#agg_function-sum) и [avg](../../sql-reference/data-types/uuid.md#agg_function-avg). + +[Original article](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md new file mode 100644 index 00000000000..3534fc4e48a --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md @@ -0,0 +1,63 @@ +# Иерархические словари {#ierarkhicheskie-slovari} + +ClickHouse поддерживает иерархические словари с [числовыми ключом](external-dicts-dict-structure.md#ext_dict-numeric-key). + +Рассмотрим следующую структуру: + +``` text +0 (Common parent) +│ +├── 1 (Russia) +│ │ +│ └── 2 (Moscow) +│ │ +│ └── 3 (Center) +│ +└── 4 (Great Britain) + │ + └── 5 (London) +``` + +Эту иерархию можно выразить в виде следующей таблицы-словаря. + +| region\_id | parent\_region | region\_name | +|------------|----------------|---------------| +| 1 | 0 | Russia | +| 2 | 1 | Moscow | +| 3 | 2 | Center | +| 4 | 0 | Great Britain | +| 5 | 4 | London | + +Таблица содержит столбец `parent_region`, содержащий ключ ближайшего предка для текущего элемента. + +ClickHouse поддерживает свойство [hierarchical](external-dicts-dict-structure.md#hierarchical-dict-attr) для атрибутов [внешнего словаря](index.md). Это свойство позволяет конфигурировать словари, подобные описанному выше. + +С помощью функции [dictGetHierarchy](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md#dictgethierarchy) можно получить цепочку предков элемента. + +Структура словаря для нашего примера может выглядеть следующим образом: + +``` xml + + + + region_id + + + + parent_region + UInt64 + 0 + true + + + + region_name + String + + + + + +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md new file mode 100644 index 00000000000..4028fc27eb8 --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md @@ -0,0 +1,369 @@ +# Хранение словарей в памяти {#dicts-external-dicts-dict-layout} + +Словари можно размещать в памяти множеством способов. + +Рекомендуем [flat](#flat), [hashed](#hashed) и [complex\_key\_hashed](#complex-key-hashed). Скорость обработки словарей при этом максимальна. + +Размещение с кэшированием не рекомендуется использовать из-за потенциально низкой производительности и сложностей в подборе оптимальных параметров. Читайте об этом подробнее в разделе «[cache](#cache)». + +Повысить производительность словарей можно следующими способами: + +- Вызывать функцию для работы со словарём после `GROUP BY`. +- Помечать извлекаемые атрибуты как инъективные. Атрибут называется инъективным, если разным ключам соответствуют разные значения атрибута. Тогда при использовании в `GROUP BY` функции, достающей значение атрибута по ключу, эта функция автоматически выносится из `GROUP BY`. + +При ошибках работы со словарями ClickHouse генерирует исключения. Например, в следующих ситуациях: + +- При обращении к словарю, который не удалось загрузить. +- При ошибке запроса к `cached`-словарю. + +Список внешних словарей и их статус можно посмотреть в таблице `system.dictionaries`. + +Общий вид конфигурации: + +``` xml + + + ... + + + + + + ... + + +``` + +Соответствущий [DDL-запрос](../../../sql-reference/statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY (...) +... +LAYOUT(LAYOUT_TYPE(param value)) -- layout settings +... +``` + +## Способы размещения словарей в памяти {#sposoby-razmeshcheniia-slovarei-v-pamiati} + +- [flat](#flat) +- [hashed](#hashed) +- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) +- [cache](#cache) +- [range\_hashed](#range-hashed) +- [complex\_key\_hashed](#complex-key-hashed) +- [complex\_key\_cache](#complex-key-cache) +- [ip\_trie](#ip-trie) + +### flat {#flat} + +Словарь полностью хранится в оперативной памяти в виде плоских массивов. Объём памяти, занимаемой словарём пропорционален размеру самого большого по размеру ключа. + +Ключ словаря имеет тип `UInt64` и его величина ограничена 500 000. Если при создании словаря обнаружен ключ больше, то ClickHouse бросает исключение и не создает словарь. + +Поддерживаются все виды источников. При обновлении, данные (из файла, из таблицы) читаются целиком. + +Это метод обеспечивает максимальную производительность среди всех доступных способов размещения словаря. + +Пример конфигурации: + +``` xml + + + +``` + +или + +``` sql +LAYOUT(FLAT()) +``` + +### hashed {#hashed} + +Словарь полностью хранится в оперативной памяти в виде хэш-таблиц. Словарь может содержать произвольное количество элементов с произвольными идентификаторами. На практике, количество ключей может достигать десятков миллионов элементов. + +Поддерживаются все виды источников. При обновлении, данные (из файла, из таблицы) читаются целиком. + +Пример конфигурации: + +``` xml + + + +``` + +или + +``` sql +LAYOUT(HASHED()) +``` + +### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} + +Аналогичен `hashed`, но при этом занимает меньше места в памяти и генерирует более высокую загрузку CPU. + +Пример конфигурации: + +``` xml + + + +``` + +или + +``` sql +LAYOUT(SPARSE_HASHED()) +``` + +### complex\_key\_hashed {#complex-key-hashed} + +Тип размещения предназначен для использования с составными [ключами](external-dicts-dict-structure.md). Аналогичен `hashed`. + +Пример конфигурации: + +``` xml + + + +``` + +или + +``` sql +LAYOUT(COMPLEX_KEY_HASHED()) +``` + +### range\_hashed {#range-hashed} + +Словарь хранится в оперативной памяти в виде хэш-таблицы с упорядоченным массивом диапазонов и соответствующих им значений. + +Этот способ размещения работает также как и hashed и позволяет дополнительно к ключу использовать дипазоны по дате/времени (произвольному числовому типу). + +Пример: таблица содержит скидки для каждого рекламодателя в виде: + +``` text ++---------------+---------------------+-------------------+--------+ +| advertiser id | discount start date | discount end date | amount | ++===============+=====================+===================+========+ +| 123 | 2015-01-01 | 2015-01-15 | 0.15 | ++---------------+---------------------+-------------------+--------+ +| 123 | 2015-01-16 | 2015-01-31 | 0.25 | ++---------------+---------------------+-------------------+--------+ +| 456 | 2015-01-01 | 2015-01-15 | 0.05 | ++---------------+---------------------+-------------------+--------+ +``` + +Чтобы использовать выборку по диапазонам дат, необходимо в [structure](external-dicts-dict-structure.md) определить элементы `range_min`, `range_max`. В этих элементах должны присутствовать элементы `name` и `type` (если `type` не указан, будет использован тип по умолчанию – Date). `type` может быть любым численным типом (Date/DateTime/UInt64/Int32/др.). + +Пример: + +``` xml + + + Id + + + first + Date + + + last + Date + + ... +``` + +или + +``` sql +CREATE DICTIONARY somedict ( + id UInt64, + first Date, + last Date +) +PRIMARY KEY id +LAYOUT(RANGE_HASHED()) +RANGE(MIN first MAX last) +``` + +Для работы с такими словарями в функцию `dictGetT` необходимо передавать дополнительный аргумент, для которого подбирается диапазон: + + dictGetT('dict_name', 'attr_name', id, date) + +Функция возвращает значение для заданных `id` и диапазона дат, в который входит переданная дата. + +Особенности алгоритма: + +- Если не найден `id` или для найденного `id` не найден диапазон, то возвращается значение по умолчанию для словаря. +- Если есть перекрывающиеся диапазоны, то можно использовать любой подходящий. +- Если граница диапазона `NULL` или некорректная дата (1900-01-01, 2039-01-01), то диапазон считается открытым. Диапазон может быть открытым с обеих сторон. + +Пример конфигурации: + +``` xml + + + + ... + + + + + + + + Abcdef + + + StartTimeStamp + UInt64 + + + EndTimeStamp + UInt64 + + + XXXType + String + + + + + + +``` + +или + +``` sql +CREATE DICTIONARY somedict( + Abcdef UInt64, + StartTimeStamp UInt64, + EndTimeStamp UInt64, + XXXType String DEFAULT '' +) +PRIMARY KEY Abcdef +RANGE(MIN StartTimeStamp MAX EndTimeStamp) +``` + +### cache {#cache} + +Словарь хранится в кэше, состоящем из фиксированного количества ячеек. Ячейки содержат часто используемые элементы. + +При поиске в словаре сначала просматривается кэш. На каждый блок данных, все не найденные в кэше или устаревшие ключи запрашиваются у источника с помощью `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Затем, полученные данные записываются в кэш. + +Для cache-словарей может быть задано время устаревания [lifetime](external-dicts-dict-lifetime.md) данных в кэше. Если от загрузки данных в ячейке прошло больше времени, чем `lifetime`, то значение не используется, и будет запрошено заново при следующей необходимости его использовать. + +Это наименее эффективный из всех способов размещения словарей. Скорость работы кэша очень сильно зависит от правильности настройки и сценария использования. Словарь типа cache показывает высокую производительность лишь при достаточно больших hit rate-ах (рекомендуется 99% и выше). Посмотреть средний hit rate можно в таблице `system.dictionaries`. + +Чтобы увеличить производительность кэша, используйте подзапрос с `LIMIT`, а снаружи вызывайте функцию со словарём. + +Поддерживаются [источники](external-dicts-dict-sources.md): MySQL, ClickHouse, executable, HTTP. + +Пример настройки: + +``` xml + + + + 1000000000 + + +``` + +или + +``` sql +LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) +``` + +Укажите достаточно большой размер кэша. Количество ячеек следует подобрать экспериментальным путём: + +1. Выставить некоторое значение. +2. Запросами добиться полной заполненности кэша. +3. Оценить потребление оперативной памяти с помощью таблицы `system.dictionaries`. +4. Увеличивать/уменьшать количество ячеек до получения требуемого расхода оперативной памяти. + +!!! warning "Warning" + Не используйте в качестве источника ClickHouse, поскольку он медленно обрабатывает запросы со случайным чтением. + +### complex\_key\_cache {#complex-key-cache} + +Тип размещения предназначен для использования с составными [ключами](external-dicts-dict-structure.md). Аналогичен `cache`. + +### ip\_trie {#ip-trie} + +Тип размещения предназначен для сопоставления префиксов сети (IP адресов) с метаданными, такими как ASN. + +Пример: таблица содержит префиксы сети и соответствующие им номера AS и коды стран: + +``` text + +-----------------+-------+--------+ + | prefix | asn | cca2 | + +=================+=======+========+ + | 202.79.32.0/20 | 17501 | NP | + +-----------------+-------+--------+ + | 2620:0:870::/48 | 3856 | US | + +-----------------+-------+--------+ + | 2a02:6b8:1::/48 | 13238 | RU | + +-----------------+-------+--------+ + | 2001:db8::/32 | 65536 | ZZ | + +-----------------+-------+--------+ +``` + +При использовании такого макета структура должна иметь составной ключ. + +Пример: + +``` xml + + + + prefix + String + + + + asn + UInt32 + + + + cca2 + String + ?? + + ... +``` + +или + +``` sql +CREATE DICTIONARY somedict ( + prefix String, + asn UInt32, + cca2 String DEFAULT '??' +) +PRIMARY KEY prefix +``` + +Этот ключ должен иметь только один атрибут типа `String`, содержащий допустимый префикс IP. Другие типы еще не поддерживаются. + +Для запросов необходимо использовать те же функции (`dictGetT` с кортежем), что и для словарей с составными ключами: + +``` sql +dictGetT('dict_name', 'attr_name', tuple(ip)) +``` + +Функция принимает либо `UInt32` для IPv4, либо `FixedString(16)` для IPv6: + +``` sql +dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) +``` + +Никакие другие типы не поддерживаются. Функция возвращает атрибут для префикса, соответствующего данному IP-адресу. Если есть перекрывающиеся префиксы, возвращается наиболее специфический. + +Данные хранятся в побитовом дереве (`trie`), он должен полностью помещаться в оперативной памяти. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md new file mode 100644 index 00000000000..2f287795296 --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md @@ -0,0 +1,81 @@ +# Обновление словарей {#obnovlenie-slovarei} + +ClickHouse периодически обновляет словари. Интервал обновления для полностью загружаемых словарей и интервал инвалидации для кэшируемых словарей определяется в теге `` в секундах. + +Обновление словарей (кроме загрузки при первом использовании) не блокирует запросы - во время обновления используется старая версия словаря. Если при обновлении возникнет ошибка, то ошибка пишется в лог сервера, а запросы продолжат использовать старую версию словарей. + +Пример настройки: + +``` xml + + ... + 300 + ... + +``` + +или + +``` sql +CREATE DICTIONARY (...) +... +LIFETIME(300) +... +``` + +Настройка `0` запрещает обновление словарей. + +Можно задать интервал, внутри которого ClickHouse равномерно-случайно выберет время для обновления. Это необходимо для распределения нагрузки на источник словаря при обновлении на большом количестве серверов. + +Пример настройки: + +``` xml + + ... + + 300 + 360 + + ... + +``` + +или + +``` sql +LIFETIME(MIN 300 MAX 360) +``` + +При обновлении словарей сервер ClickHouse применяет различную логику в зависимости от типа [источника](external-dicts-dict-sources.md): + +> - У текстового файла проверяется время модификации. Если время изменилось по отношению к запомненному ранее, то словарь обновляется. +> - Для таблиц типа MyISAM, время модификации проверяется запросом `SHOW TABLE STATUS`. +> - Словари из других источников по умолчанию обновляются каждый раз. + +Для источников MySQL (InnoDB), ODBC и ClickHouse можно настроить запрос, который позволит обновлять словари только в случае их фактического изменения, а не каждый раз. Чтобы это сделать необходимо выполнить следующие условия/действия: + +> - В таблице словаря должно быть поле, которое гарантированно изменяется при обновлении данных в источнике. +> - В настройках источника указывается запрос, который получает изменяющееся поле. Результат запроса сервер ClickHouse интерпретирует как строку и если эта строка изменилась по отношению к предыдущему состоянию, то словарь обновляется. Запрос следует указывать в поле `` настроек [источника](external-dicts-dict-sources.md). + +Пример настройки: + +``` xml + + ... + + ... + SELECT update_time FROM dictionary_source where id = 1 + + ... + +``` + +или + +``` sql +... +SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) +... +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md new file mode 100644 index 00000000000..4190e8e1015 --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md @@ -0,0 +1,615 @@ +# Источники внешних словарей {#dicts-external-dicts-dict-sources} + +Внешний словарь можно подключить из множества источников. + +Общий вид XML-конфигурации: + +``` xml + + + ... + + + + + + ... + + ... + +``` + +Аналогичный [DDL-запрос](../../../sql-reference/statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY dict_name (...) +... +SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration +... +``` + +Источник настраивается в разделе `source`. + +Для типов источников [Локальный файл](#dicts-external_dicts_dict_sources-local_file), [Исполняемый файл](#dicts-external_dicts_dict_sources-executable), [HTTP(s)](#dicts-external_dicts_dict_sources-http), [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) +доступны дополнительные настройки: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + + 0 + + +``` + +или + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +SETTINGS(format_csv_allow_single_quotes = 0) +``` + +Типы источников (`source_type`): + +- [Локальный файл](#dicts-external_dicts_dict_sources-local_file) +- [Исполняемый файл](#dicts-external_dicts_dict_sources-executable) +- [HTTP(s)](#dicts-external_dicts_dict_sources-http) +- СУБД: + - [ODBC](#dicts-external_dicts_dict_sources-odbc) + - [MySQL](#dicts-external_dicts_dict_sources-mysql) + - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) + - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) + - [Redis](#dicts-external_dicts_dict_sources-redis) + +## Локальный файл {#dicts-external_dicts_dict_sources-local_file} + +Пример настройки: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + +``` + +или + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Поля настройки: + +- `path` — Абсолютный путь к файлу. +- `format` — Формат файла. Поддерживаются все форматы, описанные в разделе «[Форматы](../../../interfaces/formats.md#formats)». + +## Исполняемый файл {#dicts-external_dicts_dict_sources-executable} + +Работа с исполняемым файлом зависит от [размещения словаря в памяти](external-dicts-dict-layout.md). Если тип размещения словаря `cache` и `complex_key_cache`, то ClickHouse запрашивает необходимые ключи, отправляя запрос в `STDIN` исполняемого файла. + +Пример настройки: + +``` xml + + + cat /opt/dictionaries/os.tsv + TabSeparated + + +``` + +или + +``` sql +SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Поля настройки: + +- `command` — Абсолютный путь к исполняемому файлу или имя файла (если каталог программы прописан в `PATH`). +- `format` — Формат файла. Поддерживаются все форматы, описанные в разделе «[Форматы](../../../interfaces/formats.md#formats)». + +## HTTP(s) {#dicts-external_dicts_dict_sources-http} + +Работа с HTTP(s) сервером зависит от [размещения словаря в памяти](external-dicts-dict-layout.md). Если тип размещения словаря `cache` и `complex_key_cache`, то ClickHouse запрашивает необходимые ключи, отправляя запрос методом `POST`. + +Пример настройки: + +``` xml + + + http://[::1]/os.tsv + TabSeparated + + user + password + + +
+ API-KEY + key +
+
+
+ +``` + +или + +``` sql +SOURCE(HTTP( + url 'http://[::1]/os.tsv' + format 'TabSeparated' + credentials(user 'user' password 'password') + headers(header(name 'API-KEY' value 'key')) +)) +``` + +Чтобы ClickHouse смог обратиться к HTTPS-ресурсу, необходимо [настроить openSSL](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md) в конфигурации сервера. + +Поля настройки: + +- `url` — URL источника. +- `format` — Формат файла. Поддерживаются все форматы, описанные в разделе «[Форматы](../../../interfaces/formats.md#formats)». + +## ODBC {#dicts-external_dicts_dict_sources-odbc} + +Этим способом можно подключить любую базу данных, имеющую ODBC драйвер. + +Пример настройки: + +``` xml + + + DatabaseName + ShemaName.TableName
+ DSN=some_parameters + SQL_QUERY +
+ +``` + +или + +``` sql +SOURCE(ODBC( + db 'DatabaseName' + table 'SchemaName.TableName' + connection_string 'DSN=some_parameters' + invalidate_query 'SQL_QUERY' +)) +``` + +Поля настройки: + +- `db` — имя базы данных. Не указывать, если имя базы задано в параметрах. ``. +- `table` — имя таблицы и схемы, если она есть. +- `connection_string` — строка соединения. +- `invalidate_query` — запрос для проверки статуса словаря. Необязательный параметр. Читайте подробнее в разделе [Обновление словарей](external-dicts-dict-lifetime.md). + +ClickHouse получает от ODBC-драйвера информацию о квотировании и квотирует настройки в запросах к драйверу, поэтому имя таблицы нужно указывать в соответствии с регистром имени таблицы в базе данных. + +Если у вас есть проблемы с кодировками при использовании Oracle, ознакомьтесь с соответствующим разделом [FAQ](../../../faq/general.md#oracle-odbc-encodings). + +### Выявленная уязвимость в функционировании ODBC словарей {#vyiavlennaia-uiazvimost-v-funktsionirovanii-odbc-slovarei} + +!!! attention "Attention" + При соединении с базой данных через ODBC можно заменить параметр соединения `Servername`. В этом случае, значения `USERNAME` и `PASSWORD` из `odbc.ini` отправляются на удаленный сервер и могут быть скомпрометированы. + +**Пример небезопасного использования** + +Сконфигурируем unixODBC для работы с PostgreSQL. Содержимое `/etc/odbc.ini`: + +``` text +[gregtest] +Driver = /usr/lib/psqlodbca.so +Servername = localhost +PORT = 5432 +DATABASE = test_db +#OPTION = 3 +USERNAME = test +PASSWORD = test +``` + +Если выполнить запрос вида: + +``` sql +SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); +``` + +то ODBC драйвер отправит значения `USERNAME` и `PASSWORD` из `odbc.ini` на `some-server.com`. + +### Пример подключения PostgreSQL {#primer-podkliucheniia-postgresql} + +ОС Ubuntu. + +Установка unixODBC и ODBC-драйвера для PostgreSQL: : + +``` bash +$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql +``` + +Настройка `/etc/odbc.ini` (или `~/.odbc.ini`): + +``` text + [DEFAULT] + Driver = myconnection + + [myconnection] + Description = PostgreSQL connection to my_db + Driver = PostgreSQL Unicode + Database = my_db + Servername = 127.0.0.1 + UserName = username + Password = password + Port = 5432 + Protocol = 9.3 + ReadOnly = No + RowVersioning = No + ShowSystemTables = No + ConnSettings = +``` + +Конфигурация словаря в ClickHouse: + +``` xml + + + table_name + + + + + DSN=myconnection + postgresql_table
+
+ + + 300 + 360 + + + + + + + id + + + some_column + UInt64 + 0 + + +
+
+``` + +или + +``` sql +CREATE DICTIONARY table_name ( + id UInt64, + some_column UInt64 DEFAULT 0 +) +PRIMARY KEY id +SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) +LAYOUT(HASHED()) +LIFETIME(MIN 300 MAX 360) + +Может понадобиться в `odbc.ini` указать полный путь до библиотеки с драйвером `DRIVER=/usr/local/lib/psqlodbcw.so`. + +### Пример подключения MS SQL Server + +ОС Ubuntu. + +Установка драйвера: : + +```bash +$ sudo apt-get install tdsodbc freetds-bin sqsh +``` + +Настройка драйвера: : + +``` bash + $ cat /etc/freetds/freetds.conf + ... + + [MSSQL] + host = 192.168.56.101 + port = 1433 + tds version = 7.0 + client charset = UTF-8 + + $ cat /etc/odbcinst.ini + ... + + [FreeTDS] + Description = FreeTDS + Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so + Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so + FileUsage = 1 + UsageCount = 5 + + $ cat ~/.odbc.ini + ... + + [MSSQL] + Description = FreeTDS + Driver = FreeTDS + Servername = MSSQL + Database = test + UID = test + PWD = test + Port = 1433 +``` + +Настройка словаря в ClickHouse: + +``` xml + + + test + + + dict
+ DSN=MSSQL;UID=test;PWD=test +
+ + + + 300 + 360 + + + + + + + + + k + + + s + String + + + +
+
+``` + +или + +``` sql +CREATE DICTIONARY test ( + k UInt64, + s String DEFAULT '' +) +PRIMARY KEY k +SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) +LAYOUT(FLAT()) +LIFETIME(MIN 300 MAX 360) +``` + +## СУБД {#subd} + +### MySQL {#dicts-external_dicts_dict_sources-mysql} + +Пример настройки: + +``` xml + + + 3306 + clickhouse + qwerty + + example01-1 + 1 + + + example01-2 + 1 + + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +или + +``` sql +SOURCE(MYSQL( + port 3306 + user 'clickhouse' + password 'qwerty' + replica(host 'example01-1' priority 1) + replica(host 'example01-2' priority 1) + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +Поля настройки: + +- `port` — порт сервера MySQL. Можно указать для всех реплик или для каждой в отдельности (внутри ``). + +- `user` — имя пользователя MySQL. Можно указать для всех реплик или для каждой в отдельности (внутри ``). + +- `password` — пароль пользователя MySQL. Можно указать для всех реплик или для каждой в отдельности (внутри ``). + +- `replica` — блок конфигурации реплики. Блоков может быть несколько. + + - `replica/host` — хост MySQL. + - `replica/priority` — приоритет реплики. При попытке соединения ClickHouse обходит реплики в соответствии с приоритетом. Чем меньше цифра, тем выше приоритет. + +- `db` — имя базы данных. + +- `table` — имя таблицы. + +- `where` — условие выбора. Синтаксис условия совпадает с синтаксисом секции `WHERE` в MySQL, например, `id > 10 AND id < 20`. Необязательный параметр. + +- `invalidate_query` — запрос для проверки статуса словаря. Необязательный параметр. Читайте подробнее в разделе [Обновление словарей](external-dicts-dict-lifetime.md). + +MySQL можно подключить на локальном хосте через сокеты, для этого необходимо задать `host` и `socket`. + +Пример настройки: + +``` xml + + + localhost + /path/to/socket/file.sock + clickhouse + qwerty + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +или + +``` sql +SOURCE(MYSQL( + host 'localhost' + socket '/path/to/socket/file.sock' + user 'clickhouse' + password 'qwerty' + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +### ClickHouse {#dicts-external_dicts_dict_sources-clickhouse} + +Пример настройки: + +``` xml + + + example01-01-1 + 9000 + default + + default + ids
+ id=10 +
+ +``` + +или + +``` sql +SOURCE(CLICKHOUSE( + host 'example01-01-1' + port 9000 + user 'default' + password '' + db 'default' + table 'ids' + where 'id=10' +)) +``` + +Поля настройки: + +- `host` — хост ClickHouse. Если host локальный, то запрос выполняется без сетевого взаимодействия. Чтобы повысить отказоустойчивость решения, можно создать таблицу типа [Distributed](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md) и прописать её в дальнейших настройках. +- `port` — порт сервера ClickHouse. +- `user` — имя пользователя ClickHouse. +- `password` — пароль пользователя ClickHouse. +- `db` — имя базы данных. +- `table` — имя таблицы. +- `where` — условие выбора. Может отсутствовать. +- `invalidate_query` — запрос для проверки статуса словаря. Необязательный параметр. Читайте подробнее в разделе [Обновление словарей](external-dicts-dict-lifetime.md). + +### MongoDB {#dicts-external_dicts_dict_sources-mongodb} + +Пример настройки: + +``` xml + + + localhost + 27017 + + + test + dictionary_source + + +``` + +или + +``` sql +SOURCE(MONGO( + host 'localhost' + port 27017 + user '' + password '' + db 'test' + collection 'dictionary_source' +)) +``` + +Поля настройки: + +- `host` — хост MongoDB. +- `port` — порт сервера MongoDB. +- `user` — имя пользователя MongoDB. +- `password` — пароль пользователя MongoDB. +- `db` — имя базы данных. +- `collection` — имя коллекции. + +### Redis {#dicts-external_dicts_dict_sources-redis} + +Пример настройки: + +``` xml + + + localhost + 6379 + simple + 0 + + +``` + +или + +``` sql +SOURCE(REDIS( + host 'localhost' + port 6379 + storage_type 'simple' + db_index 0 +)) +``` + +Поля настройки: + +- `host` – хост Redis. +- `port` – порт сервера Redis. +- `storage_type` – способ хранения ключей. Необходимо использовать `simple` для источников с одним столбцом ключей, `hash_map` – для источников с двумя столбцами ключей. Источники с более, чем двумя столбцами ключей, не поддерживаются. Может отсутствовать, значение по умолчанию `simple`. +- `db_index` – номер базы данных. Может отсутствовать, значение по умолчанию 0. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md new file mode 100644 index 00000000000..27702959eac --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md @@ -0,0 +1,167 @@ +# Ключ и поля словаря {#kliuch-i-polia-slovaria} + +Секция `` описывает ключ словаря и поля, доступные для запросов. + +Описание в формате XML: + +``` xml + + + + Id + + + + + + + ... + + + +``` + +Атрибуты описываются элементами: + +- `` — [столбец с ключом](external-dicts-dict-structure.md#ext_dict_structure-key). +- `` — [столбец данных](external-dicts-dict-structure.md#ext_dict_structure-attributes). Можно задать несколько атрибутов. + +Создание словаря запросом: + +``` sql +CREATE DICTIONARY dict_name ( + Id UInt64, + -- attributes +) +PRIMARY KEY Id +... +``` + +Атрибуты задаются в теле запроса: + +- `PRIMARY KEY` — [столбец с ключом](external-dicts-dict-structure.md#ext_dict_structure-key) +- `AttrName AttrType` — [столбец данных](external-dicts-dict-structure.md#ext_dict_structure-attributes). Можно задать несколько столбцов. + +## Ключ {#ext_dict_structure-key} + +ClickHouse поддерживает следующие виды ключей: + +- Числовой ключ. `UInt64`. Описывается в теге `` или ключевым словом `PRIMARY KEY`. +- Составной ключ. Набор значений разного типа. Описывается в теге `` или ключевым словом `PRIMARY KEY`. + +Структура может содержать либо `` либо ``. DDL-запрос может содержать только `PRIMARY KEY`. + +!!! warning "Обратите внимание" + Ключ не надо дополнительно описывать в атрибутах. + +### Числовой ключ {#ext_dict-numeric-key} + +Тип: `UInt64`. + +Пример конфигурации: + +``` xml + + Id + +``` + +Поля конфигурации: + +- `name` — имя столбца с ключами. + +Для DDL-запроса: + +``` sql +CREATE DICTIONARY ( + Id UInt64, + ... +) +PRIMARY KEY Id +... +``` + +- `PRIMARY KEY` – имя столбца с ключами. + +### Составной ключ {#sostavnoi-kliuch} + +Ключом может быть кортеж (`tuple`) из полей произвольных типов. В этом случае [layout](external-dicts-dict-layout.md) должен быть `complex_key_hashed` или `complex_key_cache`. + +!!! tip "Совет" + Составной ключ может состоять из одного элемента. Это даёт возможность использовать в качестве ключа, например, строку. + +Структура ключа задаётся в элементе ``. Поля ключа задаются в том же формате, что и [атрибуты](external-dicts-dict-structure.md) словаря. Пример: + +``` xml + + + + field1 + String + + + field2 + UInt32 + + ... + +... +``` + +или + +``` sql +CREATE DICTIONARY ( + field1 String, + field2 String + ... +) +PRIMARY KEY field1, field2 +... +``` + +При запросе в функции `dictGet*` в качестве ключа передаётся кортеж. Пример: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. + +## Атрибуты {#ext_dict_structure-attributes} + +Пример конфигурации: + +``` xml + + ... + + Name + ClickHouseDataType + + rand64() + true + true + true + + +``` + +или + +``` sql +CREATE DICTIONARY somename ( + Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID +) +``` + +Поля конфигурации: + +| Тег | Описание | Обязательный | +|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------| +| `name` | Имя столбца. | Да | +| `type` | Тип данных ClickHouse.
ClickHouse пытается привести значение из словаря к заданному типу данных. Например, в случае MySQL, в таблице-источнике поле может быть `TEXT`, `VARCHAR`, `BLOB`, но загружено может быть как `String`. [Nullable](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md) не поддерживается. | Да | +| `null_value` | Значение по умолчанию для несуществующего элемента.
В примере это пустая строка. Нельзя указать значение `NULL`. | Да | +| `expression` | [Выражение](../../syntax.md#syntax-expressions), которое ClickHouse выполняет со значением.
Выражением может быть имя столбца в удаленной SQL базе. Таким образом, вы можете использовать его для создания псевдонима удаленного столбца.

Значение по умолчанию: нет выражения. | Нет | +| `hierarchical` | Если `true`, то атрибут содержит ключ предка для текущего элемента. Смотрите [Иерархические словари](external-dicts-dict-hierarchical.md).

Default value: `false`. | No | +| `is_object_id` | Признак того, что запрос выполняется к документу MongoDB по `ObjectID`.

Значение по умолчанию: `false`. | Нет | + +## Смотрите также {#smotrite-takzhe} + +- [Функции для работы с внешними словарями](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md new file mode 100644 index 00000000000..9eb6c8d8d86 --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md @@ -0,0 +1,46 @@ +# Настройка внешнего словаря {#dicts-external-dicts-dict} + +XML-конфигурация словаря имеет следующую структуру: + +``` xml + + dict_name + + + + + + + + + + + + + + + + + +``` + +Соответствующий [DDL-запрос](../../../sql-reference/statements/create.md#create-dictionary-query) имеет следующий вид: + +``` sql +CREATE DICTIONARY dict_name +( + ... -- attributes +) +PRIMARY KEY ... -- complex or single key configuration +SOURCE(...) -- Source configuration +LAYOUT(...) -- Memory layout configuration +LIFETIME(...) -- Lifetime of dictionary in memory +``` + +- `name` — Идентификатор, под которым словарь будет доступен для использования. Используйте символы `[a-zA-Z0-9_\-]`. +- [source](external-dicts-dict-sources.md) — Источник словаря. +- [layout](external-dicts-dict-layout.md) — Размещение словаря в памяти. +- [structure](external-dicts-dict-structure.md) — Структура словаря. Ключ и атрибуты, которые можно получить по ключу. +- [lifetime](external-dicts-dict-lifetime.md) — Периодичность обновления словарей. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts.md new file mode 100644 index 00000000000..55d62b2a6c3 --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/external-dicts.md @@ -0,0 +1,52 @@ +# Внешние словари {#dicts-external-dicts} + +Существует возможность подключать собственные словари из различных источников данных. Источником данных для словаря может быть локальный текстовый/исполняемый файл, HTTP(s) ресурс или другая СУБД. Подробнее смотрите в разделе «[Источники внешних словарей](external-dicts-dict-sources.md)». + +ClickHouse: +- Полностью или частично хранит словари в оперативной памяти. +- Периодически обновляет их и динамически подгружает отсутствующие значения. +- Позволяет создавать внешние словари с помощью xml-файлов или [DDL-запросов](../../../sql-reference/statements/create.md#create-dictionary-query). + +Конфигурация внешних словарей может находится в одном или нескольких xml-файлах. Путь к конфигурации указывается в параметре [dictionaries\_config](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +Словари могут загружаться при старте сервера или при первом использовании, в зависимости от настройки [dictionaries\_lazy\_load](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +Конфигурационный файл словарей имеет вид: + +``` xml + + Необязательный элемент с любым содержимым. Игнорируется сервером ClickHouse. + + + /etc/metrika.xml + + + + + + + ... + + + + + +``` + +В одном файле можно [сконфигурировать](external-dicts-dict.md) произвольное количество словарей. + +Если вы создаёте внешние словари [DDL-запросами](../../../sql-reference/statements/create.md#create-dictionary-query), то не задавайте конфигурацию словаря в конфигурации сервера. + +!!! attention "Внимание" + Можно преобразовывать значения по небольшому словарю, описав его в запросе `SELECT` (см. функцию [transform](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)). Эта функциональность не связана с внешними словарями. + +## Смотрите также {#ext-dicts-see-also} + +- [Настройка внешнего словаря](external-dicts-dict.md) +- [Хранение словарей в памяти](external-dicts-dict-layout.md) +- [Обновление словарей](external-dicts-dict-lifetime.md) +- [Источники внешних словарей](external-dicts-dict-sources.md) +- [Ключ и поля словаря](external-dicts-dict-structure.md) +- [Функции для работы с внешними словарями](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md#ext_dict_functions) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts/) diff --git a/docs/ru/sql-reference/dictionaries/external-dictionaries/index.md b/docs/ru/sql-reference/dictionaries/external-dictionaries/index.md new file mode 100644 index 00000000000..4098ac38060 --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/external-dictionaries/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: External Dictionaries +toc_priority: 37 +--- + + diff --git a/docs/ru/sql-reference/dictionaries/index.md b/docs/ru/sql-reference/dictionaries/index.md new file mode 100644 index 00000000000..822e43e464e --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/index.md @@ -0,0 +1,14 @@ +# Словари {#slovari} + +Словарь — это отображение (`ключ -> атрибуты`), которое удобно использовать для различного вида справочников. + +ClickHouse поддерживает специальные функции для работы со словарями, которые можно использовать в запросах. Проще и эффективнее использовать словари с помощью функций, чем `JOIN` с таблицами-справочниками. + +В словаре нельзя хранить значения [NULL](../syntax.md#null). + +ClickHouse поддерживает: + +- [Встроенные словари](internal-dicts.md#internal_dicts) со специфическим [набором функций](../../sql-reference/dictionaries/external-dictionaries/index.md). +- [Подключаемые (внешние) словари](external-dictionaries/external-dicts.md) с [набором функций](../../sql-reference/dictionaries/external-dictionaries/index.md). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/) diff --git a/docs/ru/sql-reference/dictionaries/internal-dicts.md b/docs/ru/sql-reference/dictionaries/internal-dicts.md new file mode 100644 index 00000000000..0e8e7c82a6e --- /dev/null +++ b/docs/ru/sql-reference/dictionaries/internal-dicts.md @@ -0,0 +1,48 @@ +# Встроенные словари {#internal_dicts} + +ClickHouse содержит встроенную возможность работы с геобазой. + +Это позволяет: + +- для идентификатора региона получить его имя на нужном языке; +- по идентификатору региона получить идентификатор города, области, федерального округа, страны, континента; +- проверить, что один регион входит в другой; +- получить цепочку родительских регионов. + +Все функции поддерживают «транслокальность», то есть возможность использовать одновременно разные точки зрения на принадлежность регионов. Подробнее смотрите в разделе «Функции для работы со словарями Яндекс.Метрики». + +В пакете по умолчанию, встроенные словари выключены. +Для включения, раскомментируйте параметры `path_to_regions_hierarchy_file` и `path_to_regions_names_files` в конфигурационном файле сервера. + +Геобаза загружается из текстовых файлов. + +Положите файлы `regions_hierarchy*.txt` в директорию `path_to_regions_hierarchy_file`. Этот конфигурационный параметр должен содержать путь к файлу `regions_hierarchy.txt` (иерархия регионов по умолчанию), а другие файлы (`regions_hierarchy_ua.txt`) должны находиться рядом в той же директории. + +Положите файлы `regions_names_*.txt` в директорию `path_to_regions_names_files`. + +Также вы можете создать эти файлы самостоятельно. Формат файлов такой: + +`regions_hierarchy*.txt`: TabSeparated (без заголовка), столбцы: + +- идентификатор региона (`UInt32`); +- идентификатор родительского региона (`UInt32`); +- тип региона (`UInt8`): 1 - континент, 3 - страна, 4 - федеральный округ, 5 - область, 6 - город; остальные типы не имеют значения; +- население (`UInt32`) - не обязательный столбец. + +`regions_names_*.txt`: TabSeparated (без заголовка), столбцы: + +- идентификатор региона (`UInt32`); +- имя региона (`String`) - не может содержать табы или переводы строк, даже экранированные. + +Для хранения в оперативке используется плоский массив. Поэтому, идентификаторы не должны быть больше миллиона. + +Словари могут обновляться без перезапуска сервера. Но набор доступных словарей не обновляется. +Для обновления проверяется время модификации файлов; если файл изменился, то словарь будет обновлён. +Периодичность проверки настраивается конфигурационным параметром `builtin_dictionaries_reload_interval`. +Обновление словарей (кроме загрузки при первом использовании) не блокирует запросы - во время обновления запросы используют старую версию словарей. Если при обновлении возникнет ошибка, то ошибка пишется в лог сервера, а запросы продолжат использовать старую версию словарей. + +Рекомендуется периодически обновлять словари с геобазой. При обновлении, генерируйте новые файлы, записывая их в отдельное место, а только когда всё готово - переименовывайте в файлы, которые использует сервер. + +Также имеются функции для работы с идентификаторами операционных систем и поисковых систем Яндекс.Метрики, пользоваться которыми не нужно. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/internal_dicts/) diff --git a/docs/ru/sql_reference/functions/arithmetic_functions.md b/docs/ru/sql-reference/functions/arithmetic-functions.md similarity index 100% rename from docs/ru/sql_reference/functions/arithmetic_functions.md rename to docs/ru/sql-reference/functions/arithmetic-functions.md diff --git a/docs/ru/sql-reference/functions/array-functions.md b/docs/ru/sql-reference/functions/array-functions.md new file mode 100644 index 00000000000..d08e6e35a3f --- /dev/null +++ b/docs/ru/sql-reference/functions/array-functions.md @@ -0,0 +1,972 @@ +# Функции по работе с массивами {#funktsii-po-rabote-s-massivami} + +## empty {#function-empty} + +Возвращает 1 для пустого массива, и 0 для непустого массива. +Тип результата - UInt8. +Функция также работает для строк. + +## notEmpty {#function-notempty} + +Возвращает 0 для пустого массива, и 1 для непустого массива. +Тип результата - UInt8. +Функция также работает для строк. + +## length {#array_functions-length} + +Возвращает количество элементов в массиве. +Тип результата - UInt64. +Функция также работает для строк. + +## emptyArrayUInt8, emptyArrayUInt16, emptyArrayUInt32, emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} + +## emptyArrayInt8, emptyArrayInt16, emptyArrayInt32, emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} + +## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} + +## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} + +## emptyArrayString {#emptyarraystring} + +Принимает ноль аргументов и возвращает пустой массив соответствующего типа. + +## emptyArrayToSingle {#emptyarraytosingle} + +Принимает пустой массив и возвращает массив из одного элемента, равного значению по умолчанию. + +## range(N) {#rangen} + +Возвращает массив чисел от 0 до N-1. +На всякий случай, если на блок данных, создаются массивы суммарной длины больше 100 000 000 элементов, то кидается исключение. + +## array(x1, …), оператор \[x1, …\] {#arrayx1-operator-x1} + +Создаёт массив из аргументов функции. +Аргументы должны быть константами и иметь типы, для которых есть наименьший общий тип. Должен быть передан хотя бы один аргумент, так как иначе непонятно, какого типа создавать массив. То есть, с помощью этой функции невозможно создать пустой массив (для этого используйте функции emptyArray\*, описанные выше). +Возвращает результат типа Array(T), где T - наименьший общий тип от переданных аргументов. + +## arrayConcat {#arrayconcat} + +Объединяет массивы, переданные в качестве аргументов. + +``` sql +arrayConcat(arrays) +``` + +**Параметры** + +- `arrays` – произвольное количество элементов типа [Array](../../sql-reference/functions/array-functions.md) + **Пример** + + + +``` sql +SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,3,4,5,6] │ +└───────────────┘ +``` + +## arrayElement(arr, n), operator arr\[n\] {#arrayelementarr-n-operator-arrn} + +Достаёт элемент с индексом n из массива arr. n должен быть любым целочисленным типом. +Индексы в массиве начинаются с единицы. +Поддерживаются отрицательные индексы. В этом случае, будет выбран соответствующий по номеру элемент с конца. Например, arr\[-1\] - последний элемент массива. + +Если индекс выходит за границы массива, то возвращается некоторое значение по умолчанию (0 для чисел, пустая строка для строк и т. п.), кроме случая с неконстантным массивом и константным индексом 0 (в этом случае будет ошибка `Array indices are 1-based`). + +## has(arr, elem) {#hasarr-elem} + +Проверяет наличие элемента elem в массиве arr. +Возвращает 0, если элемента в массиве нет, или 1, если есть. + +`NULL` обрабатывается как значение. + +``` sql +SELECT has([1, 2, NULL], NULL) +``` + +``` text +┌─has([1, 2, NULL], NULL)─┐ +│ 1 │ +└─────────────────────────┘ +``` + +## hasAll {#hasall} + +Проверяет, является ли один массив подмножеством другого. + +``` sql +hasAll(set, subset) +``` + +**Параметры** + +- `set` – массив любого типа с набором элементов. +- `subset` – массив любого типа со значениями, которые проверяются на вхождение в `set`. + +**Возвращаемые значения** + +- `1`, если `set` содержит все элементы из `subset`. +- `0`, в противном случае. + +**Особенности** + +- Пустой массив является подмножеством любого массива. +- `NULL` обрабатывается как значение. +- Порядок значений в обоих массивах не имеет значения. + +**Примеры** + +`SELECT hasAll([], [])` возвращает 1. + +`SELECT hasAll([1, Null], [Null])` возвращает 1. + +`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` возвращает 1. + +`SELECT hasAll(['a', 'b'], ['a'])` возвращает 1. + +`SELECT hasAll([1], ['a'])` возвращает 0. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` возвращает 0. + +## hasAny {#hasany} + +Проверяет, имеют ли два массива хотя бы один общий элемент. + +``` sql +hasAny(array1, array2) +``` + +**Параметры** + +- `array1` – массив любого типа с набором элементов. +- `array2` – массив любого типа с набором элементов. + +**Возвращаемые значения** + +- `1`, если `array1` и `array2` имеют хотя бы один одинаковый элемент. +- `0`, в противном случае. + +**Особенности** + +- `NULL` обрабатывается как значение. +- Порядок значений в обоих массивах не имеет значения. + +**Примеры** + +`SELECT hasAny([1], [])` возвращает `0`. + +`SELECT hasAny([Null], [Null, 1])` возвращает `1`. + +`SELECT hasAny([-128, 1., 512], [1])` возвращает `1`. + +`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` возвращает `0`. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` возвращает `1`. + +## indexOf(arr, x) {#indexofarr-x} + +Возвращает индекс первого элемента x (начиная с 1), если он есть в массиве, или 0, если его нет. + +Пример: + +``` sql +SELECT indexOf([1, 3, NULL, NULL], NULL) +``` + +``` text +┌─indexOf([1, 3, NULL, NULL], NULL)─┐ +│ 3 │ +└───────────────────────────────────┘ +``` + +Элементы, равные `NULL`, обрабатываются как обычные значения. + +## countEqual(arr, x) {#countequalarr-x} + +Возвращает количество элементов массива, равных x. Эквивалентно arrayCount(elem -\> elem = x, arr). + +`NULL` обрабатывается как значение. + +Пример: + +``` sql +SELECT countEqual([1, 2, NULL, NULL], NULL) +``` + +``` text +┌─countEqual([1, 2, NULL, NULL], NULL)─┐ +│ 2 │ +└──────────────────────────────────────┘ +``` + +## arrayEnumerate(arr) {#array_functions-arrayenumerate} + +Возвращает массив \[1, 2, 3, …, length(arr)\] + +Эта функция обычно используется совместно с ARRAY JOIN. Она позволяет, после применения ARRAY JOIN, посчитать что-либо только один раз для каждого массива. Пример: + +``` sql +SELECT + count() AS Reaches, + countIf(num = 1) AS Hits +FROM test.hits +ARRAY JOIN + GoalsReached, + arrayEnumerate(GoalsReached) AS num +WHERE CounterID = 160656 +LIMIT 10 +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +В этом примере, Reaches - число достижений целей (строк, получившихся после применения ARRAY JOIN), а Hits - число хитов (строк, которые были до ARRAY JOIN). В данном случае, тот же результат можно получить проще: + +``` sql +SELECT + sum(length(GoalsReached)) AS Reaches, + count() AS Hits +FROM test.hits +WHERE (CounterID = 160656) AND notEmpty(GoalsReached) +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +Также эта функция может быть использована в функциях высшего порядка. Например, с её помощью можно достать индексы массива для элементов, удовлетворяющих некоторому условию. + +## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} + +Возвращает массив, такого же размера, как исходный, где для каждого элемента указано, какой он по счету среди элементов с таким же значением. +Например: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. + +Эта функция полезна при использовании ARRAY JOIN и агрегации по элементам массива. +Пример: + +``` sql +SELECT + Goals.ID AS GoalID, + sum(Sign) AS Reaches, + sumIf(Sign, num = 1) AS Visits +FROM test.visits +ARRAY JOIN + Goals, + arrayEnumerateUniq(Goals.ID) AS num +WHERE CounterID = 160656 +GROUP BY GoalID +ORDER BY Reaches DESC +LIMIT 10 +``` + +``` text +┌──GoalID─┬─Reaches─┬─Visits─┐ +│ 53225 │ 3214 │ 1097 │ +│ 2825062 │ 3188 │ 1097 │ +│ 56600 │ 2803 │ 488 │ +│ 1989037 │ 2401 │ 365 │ +│ 2830064 │ 2396 │ 910 │ +│ 1113562 │ 2372 │ 373 │ +│ 3270895 │ 2262 │ 812 │ +│ 1084657 │ 2262 │ 345 │ +│ 56599 │ 2260 │ 799 │ +│ 3271094 │ 2256 │ 812 │ +└─────────┴─────────┴────────┘ +``` + +В этом примере, для каждого идентификатора цели, посчитано количество достижений целей (каждый элемент вложенной структуры данных Goals является достижением целей) и количество визитов. Если бы не было ARRAY JOIN, мы бы считали количество визитов как sum(Sign). Но в данном случае, строчки были размножены по вложенной структуре Goals, и чтобы после этого учесть каждый визит один раз, мы поставили условие на значение функции arrayEnumerateUniq(Goals.ID). + +Функция arrayEnumerateUniq может принимать несколько аргументов - массивов одинаковых размеров. В этом случае, уникальность считается для кортежей элементов на одинаковых позициях всех массивов. + +``` sql +SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,1,1,2,1] │ +└───────────────┘ +``` + +Это нужно при использовании ARRAY JOIN с вложенной структурой данных и затем агрегации по нескольким элементам этой структуры. + +## arrayPopBack {#arraypopback} + +Удаляет последний элемент из массива. + +``` sql +arrayPopBack(array) +``` + +**Параметры** + +- `array` - Массив. + +**Пример** + +``` sql +SELECT arrayPopBack([1, 2, 3]) AS res +``` + +text + + ┌─res───┐ + │ [1,2] │ + └───────┘ + +## arrayPopFront {#arraypopfront} + +Удаляет первый элемент из массива. + +``` sql +arrayPopFront(array) +``` + +**Параметры** + +- `array` - Массив. + +**Пример** + +``` sql +SELECT arrayPopFront([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [2,3] │ +└───────┘ +``` + +## arrayPushBack {#arraypushback} + +Добавляет один элемент в конец массива. + +``` sql +arrayPushBack(array, single_value) +``` + +**Параметры** + +- `array` - Массив. +- `single_value` - Одиночное значение. В массив с числам можно добавить только числа, в массив со строками только строки. При добавлении чисел ClickHouse автоматически приводит тип `single_value` к типу данных массива. Подробнее о типах данных в ClickHouse читайте в разделе «[Типы данных](../../sql-reference/functions/array-functions.md#data_types)». Может быть равно `NULL`. Функция добавит элемент `NULL` в массив, а тип элементов массива преобразует в `Nullable`. + +**Пример** + +``` sql +SELECT arrayPushBack(['a'], 'b') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayPushFront {#arraypushfront} + +Добавляет один элемент в начало массива. + +``` sql +arrayPushFront(array, single_value) +``` + +**Параметры** + +- `array` - Массив. +- `single_value` - Одиночное значение. В массив с числам можно добавить только числа, в массив со строками только строки. При добавлении чисел ClickHouse автоматически приводит тип `single_value` к типу данных массива. Подробнее о типах данных в ClickHouse читайте в разделе «[Типы данных](../../sql-reference/functions/array-functions.md#data_types)». Может быть равно `NULL`. Функция добавит элемент `NULL` в массив, а тип элементов массива преобразует в `Nullable`. + +**Пример** + +``` sql +SELECT arrayPushFront(['b'], 'a') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayResize {#arrayresize} + +Изменяет длину массива. + +``` sql +arrayResize(array, size[, extender]) +``` + +**Параметры** + +- `array` — массив. +- `size` — необходимая длина массива. + - Если `size` меньше изначального размера массива, то массив обрезается справа. + - Если `size` больше изначального размера массива, массив дополняется справа значениями `extender` или значениями по умолчанию для типа данных элементов массива. +- `extender` — значение для дополнения массива. Может быть `NULL`. + +**Возвращаемое значение:** + +Массив длины `size`. + +**Примеры вызовов** + +``` sql +SELECT arrayResize([1], 3) +``` + +``` text +┌─arrayResize([1], 3)─┐ +│ [1,0,0] │ +└─────────────────────┘ +``` + +``` sql +SELECT arrayResize([1], 3, NULL) +``` + +``` text +┌─arrayResize([1], 3, NULL)─┐ +│ [1,NULL,NULL] │ +└───────────────────────────┘ +``` + +## arraySlice {#arrayslice} + +Возвращает срез массива. + +``` sql +arraySlice(array, offset[, length]) +``` + +**Параметры** + +- `array` - Массив данных. +- `offset` - Отступ от края массива. Положительное значение - отступ слева, отрицательное значение - отступ справа. Отсчет элементов массива начинается с 1. +- `length` - Длина необходимого среза. Если указать отрицательное значение, то функция вернёт открытый срез `[offset, array_length - length)`. Если не указать значение, то функция вернёт срез `[offset, the_end_of_array]`. + +**Пример** + +``` sql +SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res +``` + +``` text +┌─res────────┐ +│ [2,NULL,4] │ +└────────────┘ +``` + +Элементы массива равные `NULL` обрабатываются как обычные значения. + +## arraySort(\[func,\] arr, …) {#array_functions-sort} + +Возвращает массив `arr`, отсортированный в восходящем порядке. Если задана функция `func`, то порядок сортировки определяется результатом применения этой функции на элементы массива `arr`. Если `func` принимает несколько аргументов, то в функцию `arraySort` нужно передавать несколько массивов, которые будут соответствовать аргументам функции `func`. Подробные примеры рассмотрены в конце описания `arraySort`. + +Пример сортировки целочисленных значений: + +``` sql +SELECT arraySort([1, 3, 3, 0]) +``` + +``` text +┌─arraySort([1, 3, 3, 0])─┐ +│ [0,1,3,3] │ +└─────────────────────────┘ +``` + +Пример сортировки строковых значений: + +``` sql +SELECT arraySort(['hello', 'world', '!']) +``` + +``` text +┌─arraySort(['hello', 'world', '!'])─┐ +│ ['!','hello','world'] │ +└────────────────────────────────────┘ +``` + +Значения `NULL`, `NaN` и `Inf` сортируются по следующему принципу: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); +``` + +``` text +┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ +│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────────────────────────┘ +``` + +- Значения `-Inf` идут в начале массива. +- Значения `NULL` идут в конце массива. +- Значения `NaN` идут перед `NULL`. +- Значения `Inf` идут перед `NaN`. + +Функция `arraySort` является [функцией высшего порядка](higher-order-functions.md) — в качестве первого аргумента ей можно передать лямбда-функцию. В этом случае порядок сортировки определяется результатом применения лямбда-функции на элементы массива. + +Рассмотрим пример: + +``` sql +SELECT arraySort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,2,1] │ +└─────────┘ +``` + +Для каждого элемента исходного массива лямбда-функция возвращает ключ сортировки, то есть \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Так как `arraySort` сортирует элементы в порядке возрастания ключей, результат будет \[3, 2, 1\]. Как можно заметить, функция `x –> -x` устанавливает [обратный порядок сортировки](#array_functions-reverse-sort). + +Лямбда-функция может принимать несколько аргументов. В этом случае, в функцию `arraySort` нужно передавать несколько массивов, которые будут соответствовать аргументам лямбда-функции (массивы должны быть одинаковой длины). Следует иметь в виду, что результат будет содержать элементы только из первого массива; элементы из всех последующих массивов будут задавать ключи сортировки. Например: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Элементы, указанные во втором массиве (\[2,1\]), определяют ключ сортировки для элементов из исходного массива (\[‘hello’, ‘world’\]), то есть \[‘hello’ –\> 2, ‘world’ –\> 1\]. Так как лямбда-функция не использует `x`, элементы исходного массива не влияют на порядок сортировки. Таким образом, ‘hello’ будет вторым элементом в отсортированном массиве, а ‘world’ — первым. + +Ниже приведены другие примеры. + +``` sql +SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +``` sql +SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +!!! note "Примечание" + Для улучшения эффективности сортировки применяется [преобразование Шварца](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). + +## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} + +Возвращает массив `arr`, отсортированный в нисходящем порядке. Если указана функция `func`, то массив `arr` сначала сортируется в порядке, который определяется функцией `func`, а затем отсортированный массив переворачивается. Если функция `func` принимает несколько аргументов, то в функцию `arrayReverseSort` необходимо передавать несколько массивов, которые будут соответствовать аргументам функции `func`. Подробные примеры рассмотрены в конце описания функции `arrayReverseSort`. + +Пример сортировки целочисленных значений: + +``` sql +SELECT arrayReverseSort([1, 3, 3, 0]); +``` + +``` text +┌─arrayReverseSort([1, 3, 3, 0])─┐ +│ [3,3,1,0] │ +└────────────────────────────────┘ +``` + +Пример сортировки строковых значений: + +``` sql +SELECT arrayReverseSort(['hello', 'world', '!']); +``` + +``` text +┌─arrayReverseSort(['hello', 'world', '!'])─┐ +│ ['world','hello','!'] │ +└───────────────────────────────────────────┘ +``` + +Значения `NULL`, `NaN` и `Inf` сортируются в следующем порядке: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; +``` + +``` text +┌─res───────────────────────────────────┐ +│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────┘ +``` + +- Значения `Inf` идут в начале массива. +- Значения `NULL` идут в конце массива. +- Значения `NaN` идут перед `NULL`. +- Значения `-Inf` идут перед `NaN`. + +Функция `arrayReverseSort` является [функцией высшего порядка](higher-order-functions.md). Вы можете передать ей в качестве первого аргумента лямбда-функцию. Например: + +``` sql +SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [1,2,3] │ +└─────────┘ +``` + +В этом примере, порядок сортировки устанавливается следующим образом: + +1. Сначала исходный массив (\[1, 2, 3\]) сортируется в том порядке, который определяется лямбда-функцией. Результатом будет массив \[3, 2, 1\]. +2. Массив, который был получен на предыдущем шаге, переворачивается. То есть, получается массив \[1, 2, 3\]. + +Лямбда-функция может принимать на вход несколько аргументов. В этом случае, в функцию `arrayReverseSort` нужно передавать несколько массивов, которые будут соответствовать аргументам лямбда-функции (массивы должны быть одинаковой длины). Следует иметь в виду, что результат будет содержать элементы только из первого массива; элементы из всех последующих массивов будут определять ключи сортировки. Например: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +В этом примере, массив сортируется следующим образом: + +1. Сначала массив сортируется в том порядке, который определяется лямбда-функцией. Элементы, указанные во втором массиве (\[2,1\]), определяют ключи сортировки соответствующих элементов из исходного массива (\[‘hello’, ‘world’\]). То есть, будет массив \[‘world’, ‘hello’\]. +2. Массив, который был отсортирован на предыдущем шаге, переворачивается. Получается массив \[‘hello’, ‘world’\]. + +Ниже приведены ещё примеры. + +``` sql +SELECT arrayReverseSort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` text +┌─res─────┐ +│ [0,1,2] │ +└─────────┘ +``` + +``` sql +SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; +``` + +``` text +┌─res─────┐ +│ [4,3,5] │ +└─────────┘ +``` + +## arrayUniq(arr, …) {#array-functions-arrayuniq} + +Если передан один аргумент, считает количество разных элементов в массиве. +Если передано несколько аргументов, считает количество разных кортежей из элементов на соответствующих позициях в нескольких массивах. + +Если необходимо получить список уникальных элементов массива, можно воспользоваться arrayReduce(‘groupUniqArray’, arr). + +## arrayJoin(arr) {#array-functions-arrayjoin} + +Особенная функция. Смотрите раздел [«Функция arrayJoin»](array-join.md#functions_arrayjoin). + +## arrayDifference {#arraydifference} + +Вычисляет разность между соседними элементами массива. Возвращает массив, где первым элементом будет 0, вторым – разность `a[1] - a[0]` и т. д. Тип элементов результирующего массива определяется правилами вывода типов при вычитании (напр. `UInt8` - `UInt8` = `Int16`). + +**Синтаксис** + +``` sql +arrayDifference(array) +``` + +**Параметры** + +- `array` – [Массив](https://clickhouse.yandex/docs/ru/data_types/array/). + +**Возвращаемое значение** + +Возвращает массив разностей между соседними элементами. + +**Пример** + +Запрос: + +``` sql +SELECT arrayDifference([1, 2, 3, 4]) +``` + +Ответ: + +``` text +┌─arrayDifference([1, 2, 3, 4])─┐ +│ [0,1,1,1] │ +└───────────────────────────────┘ +``` + +Пример переполнения из-за результирующего типа `Int64`: + +Запрос: + +``` sql +SELECT arrayDifference([0, 10000000000000000000]) +``` + +Ответ: + +``` text +┌─arrayDifference([0, 10000000000000000000])─┐ +│ [0,-8446744073709551616] │ +└────────────────────────────────────────────┘ +``` + +## arrayDistinct {#arraydistinct} + +Принимает массив, возвращает массив, содержащий уникальные элементы. + +**Синтаксис** + +``` sql +arrayDistinct(array) +``` + +**Параметры** + +- `array` – [Массив](https://clickhouse.yandex/docs/ru/data_types/array/). + +**Возвращаемое значение** + +Возвращает массив, содержащий только уникальные элементы исходного массива. + +**Пример** + +Запрос: + +``` sql +SELECT arrayDistinct([1, 2, 2, 3, 1]) +``` + +Ответ: + +``` text +┌─arrayDistinct([1, 2, 2, 3, 1])─┐ +│ [1,2,3] │ +└────────────────────────────────┘ +``` + +## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} + +Возвращает массив того же размера, что и исходный массив, с индексами исходного массива, указывающими, где каждый элемент впервые появляется в исходном массиве. + +Пример: + +``` sql +SELECT arrayEnumerateDense([10, 20, 10, 30]) +``` + +``` text +┌─arrayEnumerateDense([10, 20, 10, 30])─┐ +│ [1,2,1,3] │ +└───────────────────────────────────────┘ +``` + +## arrayIntersect(arr) {#array-functions-arrayintersect} + +Принимает несколько массивов, возвращает массив с элементами, присутствующими во всех исходных массивах. Элементы на выходе следуют в порядке следования в первом массиве. + +Пример: + +``` sql +SELECT + arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, + arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect +``` + +``` text +┌─no_intersect─┬─intersect─┐ +│ [] │ [1] │ +└──────────────┴───────────┘ +``` + +## arrayReduce(agg\_func, arr1, …) {#array-functions-arrayreduce} + +Применяет агрегатную функцию к элементам массива и возвращает ее результат. Имя агрегирующей функции передается как строка в одинарных кавычках `'max'`, `'sum'`. При использовании параметрических агрегатных функций, параметр указывается после имени функции в круглых скобках `'uniqUpTo(6)'`. + +Пример: + +``` sql +SELECT arrayReduce('max', [1, 2, 3]) +``` + +``` text +┌─arrayReduce('max', [1, 2, 3])─┐ +│ 3 │ +└───────────────────────────────┘ +``` + +Если агрегатная функция имеет несколько аргументов, то эту функцию можно применять к нескольким массивам одинакового размера. + +Пример: + +``` sql +SELECT arrayReduce('maxIf', [3, 5], [1, 0]) +``` + +``` text +┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ +│ 3 │ +└──────────────────────────────────────┘ +``` + +Пример с параметрической агрегатной функцией: + +``` sql +SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) +``` + +``` text +┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ +│ 4 │ +└─────────────────────────────────────────────────────────────┘ +``` + +## arrayReverse(arr) {#array_functions-arrayreverse} + +Возвращает массив того же размера, что и исходный массив, содержащий элементы в обратном порядке. + +Пример: + +``` sql +SELECT arrayReverse([1, 2, 3]) +``` + +``` text +┌─arrayReverse([1, 2, 3])─┐ +│ [3,2,1] │ +└─────────────────────────┘ +``` + +## reverse(arr) {#array-functions-reverse} + +Синоним для [«arrayReverse»](#array_functions-arrayreverse) + +## arrayFlatten {#arrayflatten} + +Преобразует массив массивов в плоский массив. + +Функция: + +- Оперирует с массивами любой вложенности. +- Не изменяет массив, если он уже плоский. + +Результирующий массив содержит все элементы исходных массивов. + +**Синтаксис** + +``` sql +flatten(array_of_arrays) +``` + +Синоним: `flatten`. + +**Параметры** + +- `array_of_arrays` — [Массивов](../../sql-reference/functions/array-functions.md) массивов. Например, `[[1,2,3], [4,5]]`. + +**Примеры** + +``` sql +SELECT flatten([[[1]], [[2], [3]]]) +``` + +``` text +┌─flatten(array(array([1]), array([2], [3])))─┐ +│ [1,2,3] │ +└─────────────────────────────────────────────┘ +``` + +## arrayCompact {#arraycompact} + +Удаляет дубликаты из массива. Порядок результирующих значений определяется порядком в исходном массиве. + +**Синтаксис** + +``` sql +arrayCompact(arr) +``` + +**Параметры** + +`arr` — [Массив](../../sql-reference/functions/array-functions.md) для обхода. + +**Возвращаемое значение** + +Массив без дубликатов. + +Тип: `Array`. + +**Пример** + +Запрос: + +``` sql +SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) +``` + +Ответ: + +``` text +┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ +│ [1,nan,nan,2,3] │ +└────────────────────────────────────────────┘ +``` + +## arrayZip {#arrayzip} + +Объединяет несколько массивов в один. Результирующий массив содержит соответственные элементы исходных массивов, сгруппированные в кортежи в указанном порядке аргументов. + +**Синтаксис** + +``` sql +arrayZip(arr1, arr2, ..., arrN) +``` + +**Параметры** + +- `arrN` — [Массив](../data-types/array.md). + +Функция принимает любое количество массивов, которые могут быть различных типов. Все массивы должны иметь одинаковую длину. + +**Возвращаемое значение** + +- Массив с элементами исходных массивов, сгруппированными в [кортежи](../data-types/tuple.md). Типы данных в кортежах соответствуют типам данных входных массивов и следуют в том же порядке, в котором переданы массивы. + +Тип: [Массив](../data-types/array.md). + +**Пример** + +Запрос: + +``` sql +SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]) +``` + +Ответ: + +``` text +┌─arrayZip(['a', 'b', 'c'], [5, 2, 1])─┐ +│ [('a',5),('b',2),('c',1)] │ +└──────────────────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/array_functions/) diff --git a/docs/ru/sql-reference/functions/array-join.md b/docs/ru/sql-reference/functions/array-join.md new file mode 100644 index 00000000000..afbc7bfe3e8 --- /dev/null +++ b/docs/ru/sql-reference/functions/array-join.md @@ -0,0 +1,30 @@ +# Функция ArrayJoin {#functions_arrayjoin} + +Это совсем необычная функция. + +Обычные функции не изменяют множество строк, а лишь изменяют значения в каждой строке (map). +Агрегатные функции выполняют свёртку множества строк (fold, reduce). +Функция arrayJoin выполняет размножение каждой строки в множество строк (unfold). + +Функция принимает в качестве аргумента массив, и размножает исходную строку в несколько строк - по числу элементов массива. +Все значения в столбцах просто копируются, кроме значения в столбце с применением этой функции - он заменяется на соответствующее значение массива. + +В запросе может быть использовано несколько функций `arrayJoin`. В этом случае, соответствующее преобразование делается несколько раз. + +Обратите внимание на синтаксис ARRAY JOIN в запросе SELECT, который предоставляет более широкие возможности. + +Пример: + +``` sql +SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src +``` + +``` text +┌─dst─┬─\'Hello\'─┬─src─────┐ +│ 1 │ Hello │ [1,2,3] │ +│ 2 │ Hello │ [1,2,3] │ +│ 3 │ Hello │ [1,2,3] │ +└─────┴───────────┴─────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/array_join/) diff --git a/docs/ru/sql-reference/functions/bit-functions.md b/docs/ru/sql-reference/functions/bit-functions.md new file mode 100644 index 00000000000..9d78dd861e9 --- /dev/null +++ b/docs/ru/sql-reference/functions/bit-functions.md @@ -0,0 +1,238 @@ +# Битовые функции {#bitovye-funktsii} + +Битовые функции работают для любой пары типов из UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32, Float64. + +Тип результата - целое число, битность которого равна максимальной битности аргументов. Если хотя бы один аргумент знаковый, то результат - знаковое число. Если аргумент - число с плавающей запятой - оно приводится к Int64. + +## bitAnd(a, b) {#bitanda-b} + +## bitOr(a, b) {#bitora-b} + +## bitXor(a, b) {#bitxora-b} + +## bitNot(a) {#bitnota} + +## bitShiftLeft(a, b) {#bitshiftlefta-b} + +## bitShiftRight(a, b) {#bitshiftrighta-b} + +## bitTest {#bittest} + +Принимает любое целое число и конвертирует его в [двоичное число](https://en.wikipedia.org/wiki/Binary_number), возвращает значение бита в указанной позиции. Отсчет начинается с 0 справа налево. + +**Синтаксис** + +``` sql +SELECT bitTest(number, index) +``` + +**Параметры** + +- `number` – целое число. +- `index` – position of bit. + +**Возвращаемое значение** + +Возвращает значение бита в указанной позиции. + +Тип: `UInt8`. + +**Пример** + +Например, число 43 в двоичной системе счисления равно: 101011. + +Запрос: + +``` sql +SELECT bitTest(43, 1) +``` + +Ответ: + +``` text +┌─bitTest(43, 1)─┐ +│ 1 │ +└────────────────┘ +``` + +Другой пример: + +Запрос: + +``` sql +SELECT bitTest(43, 2) +``` + +Ответ: + +``` text +┌─bitTest(43, 2)─┐ +│ 0 │ +└────────────────┘ +``` + +## bitTestAll {#bittestall} + +Возвращает результат [логической конъюнкции](https://en.wikipedia.org/wiki/Logical_conjunction) (оператор AND) всех битов в указанных позициях. Отсчет начинается с 0 справа налево. + +Бинарная конъюнкция: + +0 AND 0 = 0 +0 AND 1 = 0 +1 AND 0 = 0 +1 AND 1 = 1 + +**Синтаксис** + +``` sql +SELECT bitTestAll(number, index1, index2, index3, index4, ...) +``` + +**Параметры** + +- `number` – целое число. +- `index1`, `index2`, `index3`, `index4` – позиция бита. Например, конъюнкция для набора позиций `index1`, `index2`, `index3`, `index4` является истинной, если все его позиции истинны `index1` ⋀ `index2` ⋀ `index3` ⋀ `index4`. + +**Возвращаемое значение** + +Возвращает результат логической конъюнкции. + +Тип: `UInt8`. + +**Пример** + +Например, число 43 в двоичной системе счисления равно: 101011. + +Запрос: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5) +``` + +Ответ: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5)─┐ +│ 1 │ +└────────────────────────────┘ +``` + +Другой пример: + +Запрос: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5, 2) +``` + +Ответ: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ +│ 0 │ +└───────────────────────────────┘ +``` + +## bitTestAny {#bittestany} + +Возвращает результат [логической дизъюнкции](https://en.wikipedia.org/wiki/Logical_disjunction) (оператор OR) всех битов в указанных позициях. Отсчет начинается с 0 справа налево. + +Бинарная дизъюнкция: + +0 OR 0 = 0 +0 OR 1 = 1 +1 OR 0 = 1 +1 OR 1 = 1 + +**Синтаксис** + +``` sql +SELECT bitTestAny(number, index1, index2, index3, index4, ...) +``` + +**Параметры** + +- `number` – целое число. +- `index1`, `index2`, `index3`, `index4` – позиции бита. + +**Возвращаемое значение** + +Возвращает результат логической дизъюнкции. + +Тип: `UInt8`. + +**Пример** + +Например, число 43 в двоичной системе счисления равно: 101011. + +Запрос: + +``` sql +SELECT bitTestAny(43, 0, 2) +``` + +Ответ: + +``` text +┌─bitTestAny(43, 0, 2)─┐ +│ 1 │ +└──────────────────────┘ +``` + +Другой пример: + +Запрос: + +``` sql +SELECT bitTestAny(43, 4, 2) +``` + +Ответ: + +``` text +┌─bitTestAny(43, 4, 2)─┐ +│ 0 │ +└──────────────────────┘ +``` + +## bitCount {#bitcount} + +Подсчитывает количество равных единице бит в числе. + +**Синтаксис** + +``` sql +bitCount(x) +``` + +**Параметры** + +- `x` — [Целое число](../../sql-reference/functions/bit-functions.md) или [число с плавающей запятой](../../sql-reference/functions/bit-functions.md). Функция использует представление числа в памяти, что позволяет поддержать числа с плавающей запятой. + +**Возвращаемое значение** + +- Количество равных единице бит во входном числе. + +Функция не преобразует входное значение в более крупный тип ([sign extension](https://en.wikipedia.org/wiki/Sign_extension)). Поэтому, например, `bitCount(toUInt8(-1)) = 8`. + +Тип: `UInt8`. + +**Пример** + +Возьмём к примеру число 333. Его бинарное представление — 0000000101001101. + +Запрос: + +``` sql +SELECT bitCount(333) +``` + +Результат: + +``` text +┌─bitCount(100)─┐ +│ 5 │ +└───────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/bit_functions/) diff --git a/docs/ru/sql-reference/functions/bitmap-functions.md b/docs/ru/sql-reference/functions/bitmap-functions.md new file mode 100644 index 00000000000..c91725c7a39 --- /dev/null +++ b/docs/ru/sql-reference/functions/bitmap-functions.md @@ -0,0 +1,393 @@ +# Функции для битмапов {#funktsii-dlia-bitmapov} + +## bitmapBuild {#bitmap_functions-bitmapbuild} + +Создаёт битовый массив из массива целочисленных значений. + +``` sql +bitmapBuild(array) +``` + +**Параметры** + +- `array` – массив типа `UInt*`. + +**Пример** + +``` sql +SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) +``` + +``` text +┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ +│  │ AggregateFunction(groupBitmap, UInt8) │ +└─────┴──────────────────────────────────────────────┘ +``` + +## bitmapToArray {#bitmaptoarray} + +Преобразует битовый массив в массив целочисленных значений. + +``` sql +bitmapToArray(bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapSubsetLimit {#bitmapsubsetlimit} + +Создает подмножество битмапа с n элементами, расположенными между `range_start` и `cardinality_limit`. + +**Синтаксис** + +``` sql +bitmapSubsetLimit(bitmap, range_start, cardinality_limit) +``` + +**Параметры** + +- `bitmap` – Битмап. [Bitmap object](#bitmap_functions-bitmapbuild). +- `range_start` – Начальная точка подмножества. [UInt32](../../sql-reference/functions/bitmap-functions.md). +- `cardinality_limit` – Верхний предел подмножества. [UInt32](../../sql-reference/functions/bitmap-functions.md). + +**Возвращаемое значение** + +Подмножество битмапа. + +Тип: `Bitmap object`. + +**Пример** + +Запрос: + +``` sql +SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +Ответ: + +``` text +┌─res───────────────────────┐ +│ [30,31,32,33,100,200,500] │ +└───────────────────────────┘ +``` + +## bitmapContains {#bitmap_functions-bitmapcontains} + +Проверяет вхождение элемента в битовый массив. + +``` sql +bitmapContains(haystack, needle) +``` + +**Параметры** + +- `haystack` – [объект Bitmap](#bitmap_functions-bitmapbuild), в котором функция ищет значение. +- `needle` – значение, которое функция ищет. Тип — [UInt32](../../sql-reference/functions/bitmap-functions.md). + +**Возвращаемые значения** + +- 0 — если в `haystack` нет `needle`. +- 1 — если в `haystack` есть `needle`. + +Тип — `UInt8`. + +**Пример** + +``` sql +SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAny {#bitmaphasany} + +Проверяет, имеют ли два битовых массива хотя бы один общий элемент. + +``` sql +bitmapHasAny(bitmap1, bitmap2) +``` + +Если вы уверены, что `bitmap2` содержит строго один элемент, используйте функцию [bitmapContains](#bitmap_functions-bitmapcontains). Она работает эффективнее. + +**Параметры** + +- `bitmap*` – массив любого типа с набором элементов. + +**Возвращаемые значения** + +- `1`, если `bitmap1` и `bitmap2` имеют хотя бы один одинаковый элемент. +- `0`, в противном случае. + +**Пример** + +``` sql +SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAll {#bitmaphasall} + +Аналогично функции `hasAll(array, array)` возвращает 1 если первый битовый массив содержит все элементы второго, 0 в противном случае. +Если второй аргумент является пустым битовым массивом, то возвращает 1. + +``` sql +bitmapHasAll(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 0 │ +└─────┘ +``` + +## bitmapAnd {#bitmapand} + +Логическое И для двух битовых массивов. Результат — новый битовый массив. + +``` sql +bitmapAnd(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─┐ +│ [3] │ +└─────┘ +``` + +## bitmapOr {#bitmapor} + +Логическое ИЛИ для двух битовых массивов. Результат — новый битовый массив. + +``` sql +bitmapOr(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapXor {#bitmapxor} + +Логическое исключающее ИЛИ для двух битовых массивов. Результат — новый битовый массив. + +``` sql +bitmapXor(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,4,5] │ +└───────────┘ +``` + +## bitmapAndnot {#bitmapandnot} + +Логическое отрицание И для двух битовых массивов. Результат — новый битовый массив. + +``` sql +bitmapAndnot(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## bitmapCardinality {#bitmapcardinality} + +Возвращает кардинальность битового массива в виде значения типа `UInt64`. + +``` sql +bitmapCardinality(bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapAndCardinality {#bitmapandcardinality} + +Выполняет логическое И и возвращает кардинальность (`UInt64`) результирующего битового массива. + +``` sql +bitmapAndCardinality(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapOrCardinality {#bitmaporcardinality} + +Выполняет логическое ИЛИ и возвращает кардинальность (`UInt64`) результирующего битового массива. + +``` sql +bitmapOrCardinality(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapXorCardinality {#bitmapxorcardinality} + +Выполняет логическое исключающее ИЛИ и возвращает кардинальность (`UInt64`) результирующего битового массива. + +``` sql +bitmapXorCardinality(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 4 │ +└─────┘ +``` + +## bitmapAndnotCardinality {#bitmapandnotcardinality} + +Выполняет логическое отрицание И и возвращает кардинальность (`UInt64`) результирующего битового массива. + +``` sql +bitmapAndnotCardinality(bitmap,bitmap) +``` + +**Параметры** + +- `bitmap` – битовый массив. + +**Пример** + +``` sql +SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 2 │ +└─────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/bitmap_functions/) diff --git a/docs/ru/sql-reference/functions/comparison-functions.md b/docs/ru/sql-reference/functions/comparison-functions.md new file mode 100644 index 00000000000..9b921d6fe55 --- /dev/null +++ b/docs/ru/sql-reference/functions/comparison-functions.md @@ -0,0 +1,32 @@ +# Функции сравнения {#funktsii-sravneniia} + +Функции сравнения возвращают всегда 0 или 1 (UInt8). + +Сравнивать можно следующие типы: + +- числа; +- строки и фиксированные строки; +- даты; +- даты-с-временем; + +внутри каждой группы, но не из разных групп. + +Например, вы не можете сравнить дату со строкой. Надо использовать функцию преобразования строки в дату или наоборот. + +Строки сравниваются побайтово. Более короткая строка меньше всех строк, начинающихся с неё и содержащих ещё хотя бы один символ. + +Замечание. До версии 1.1.54134 сравнение знаковых и беззнаковых целых чисел производилось также, как в C++. То есть, вы могли получить неверный результат в таких случаях: SELECT 9223372036854775807 \> -1. С версии 1.1.54134 поведение изменилось и стало математически корректным. + +## equals, оператор a = b и a == b {#function-equals} + +## notEquals, оператор a != b и a `<>` b {#function-notequals} + +## less, оператор `<` {#function-less} + +## greater, оператор `>` {#function-greater} + +## lessOrEquals, оператор `<=` {#function-lessorequals} + +## greaterOrEquals, оператор `>=` {#function-greaterorequals} + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/comparison_functions/) diff --git a/docs/ru/sql-reference/functions/conditional-functions.md b/docs/ru/sql-reference/functions/conditional-functions.md new file mode 100644 index 00000000000..78bdab826d9 --- /dev/null +++ b/docs/ru/sql-reference/functions/conditional-functions.md @@ -0,0 +1,109 @@ +# Условные функции {#uslovnye-funktsii} + +## if {#if} + +Условное выражение. В отличии от большинства систем, ClickHouse всегда считает оба выражения `then` и `else`. + +**Синтаксис** + +``` sql +SELECT if(cond, then, else) +``` + +Если условие `cond` не равно нулю, то возвращается результат выражения `then`. Если условие `cond` равно нулю или является NULL, то результат выражения `then` пропускается и возвращается результат выражения `else`. + +**Параметры** + +- `cond` – Условие, которое может быть равно 0 или нет. Может быть [UInt8](../../sql-reference/functions/conditional-functions.md) или `NULL`. +- `then` - Возвращается результат выражения, если условие `cond` истинно. +- `else` - Возвращается результат выражения, если условие `cond` ложно. + +**Возвращаемые значения** + +Функция выполняет выражения `then` или `else` и возвращает его результат, в зависимости от того, было ли условие `cond` равно нулю или нет. + +**Пример** + +Запрос: + +``` sql +SELECT if(1, plus(2, 2), plus(2, 6)) +``` + +Ответ: + +``` text +┌─plus(2, 2)─┐ +│ 4 │ +└────────────┘ +``` + +Запрос: + +``` sql +SELECT if(0, plus(2, 2), plus(2, 6)) +``` + +Ответ: + +``` text +┌─plus(2, 6)─┐ +│ 8 │ +└────────────┘ +``` + +## Тернарный оператор {#ternary-operator} + +Работает так же, как функция `if`. + +Синтаксис: `cond ? then : else` + +Возвращает `then`, если `cond` верно (больше нуля), в остальных случаях возвращает `else`. + +- `cond` должно быть типа `UInt8`, `then` и `else` должны относиться к наименьшему общему типу. + +- `then` и `else` могут быть `NULL`. + +**Смотрите также** + +- [ifNotFinite](other-functions.md#ifnotfinite). + +## multiIf {#multiif} + +Позволяет более компактно записать оператор [CASE](../operators.md#operator_case) в запросе. + + multiIf(cond_1, then_1, cond_2, then_2...else) + +**Параметры** + +- `cond_N` — Условие, при выполнении которого функция вернёт `then_N`. +- `then_N` — Результат функции при выполнении. +- `else` — Результат функции, если ни одно из условий не выполнено. + +Функция принимает `2N+1` параметров. + +**Возвращаемые значения** + +Функция возвращает одно из значений `then_N` или `else`, в зависимости от условий `cond_N`. + +**Пример** + +Рассмотрим таблицу + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Выполним запрос `SELECT multiIf(isNull(y), x, y < 3, y, NULL) FROM t_null`. Результат: + +``` text +┌─multiIf(isNull(y), x, less(y, 3), y, NULL)─┐ +│ 1 │ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/conditional_functions/) diff --git a/docs/ru/sql-reference/functions/date-time-functions.md b/docs/ru/sql-reference/functions/date-time-functions.md new file mode 100644 index 00000000000..ecd9c760fbc --- /dev/null +++ b/docs/ru/sql-reference/functions/date-time-functions.md @@ -0,0 +1,290 @@ +# Функции для работы с датами и временем {#funktsii-dlia-raboty-s-datami-i-vremenem} + +Поддержка часовых поясов + +Все функции по работе с датой и временем, для которых это имеет смысл, могут принимать второй, необязательный аргумент - имя часового пояса. Пример: Asia/Yekaterinburg. В этом случае, они используют не локальный часовой пояс (по умолчанию), а указанный. + +``` sql +SELECT + toDateTime('2016-06-15 23:00:00') AS time, + toDate(time) AS date_local, + toDate(time, 'Asia/Yekaterinburg') AS date_yekat, + toString(time, 'US/Samoa') AS time_samoa +``` + +``` text +┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ +└─────────────────────┴────────────┴────────────┴─────────────────────┘ +``` + +Поддерживаются только часовые пояса, отличающиеся от UTC на целое число часов. + +## toYear {#toyear} + +Переводит дату или дату-с-временем в число типа UInt16, содержащее номер года (AD). + +## toMonth {#tomonth} + +Переводит дату или дату-с-временем в число типа UInt8, содержащее номер месяца (1-12). + +## toDayOfMonth {#todayofmonth} + +Переводит дату или дату-с-временем в число типа UInt8, содержащее номер дня в месяце (1-31). + +## toDayOfWeek {#todayofweek} + +Переводит дату или дату-с-временем в число типа UInt8, содержащее номер дня в неделе (понедельник - 1, воскресенье - 7). + +## toHour {#tohour} + +Переводит дату-с-временем в число типа UInt8, содержащее номер часа в сутках (0-23). +Функция исходит из допущения, что перевод стрелок вперёд, если осуществляется, то на час, в два часа ночи, а перевод стрелок назад, если осуществляется, то на час, в три часа ночи (что, в общем, не верно - даже в Москве два раза перевод стрелок был осуществлён в другое время). + +## toMinute {#tominute} + +Переводит дату-с-временем в число типа UInt8, содержащее номер минуты в часе (0-59). + +## toSecond {#tosecond} + +Переводит дату-с-временем в число типа UInt8, содержащее номер секунды в минуте (0-59). +Секунды координации не учитываются. + +## toUnixTimestamp {#to-unix-timestamp} + +For DateTime argument: converts value to its internal numeric representation (Unix Timestamp). +For String argument: parse datetime from string according to the timezone (optional second argument, server timezone is used by default) and returns the corresponding unix timestamp. +For Date argument: the behaviour is unspecified. + +**Syntax** + +``` sql +toUnixTimestamp(datetime) +toUnixTimestamp(str, [timezone]) +``` + +**Returned value** + +- Returns the unix timestamp. + +Type: `UInt32`. + +**Example** + +Query: + +``` sql +SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp +``` + +Result: + +``` text +┌─unix_timestamp─┐ +│ 1509836867 │ +└────────────────┘ +``` + +## toStartOfYear {#tostartofyear} + +Округляет дату или дату-с-временем вниз до первого дня года. +Возвращается дата. + +## toStartOfQuarter {#tostartofquarter} + +Округляет дату или дату-с-временем вниз до первого дня квартала. +Первый день квартала - это одно из 1 января, 1 апреля, 1 июля, 1 октября. +Возвращается дата. + +## toStartOfMonth {#tostartofmonth} + +Округляет дату или дату-с-временем вниз до первого дня месяца. +Возвращается дата. + +!!! attention "Attention" + Возвращаемое значение для некорректных дат зависит от реализации. ClickHouse может вернуть нулевую дату, выбросить исключение, или выполнить «естественное» перетекание дат между месяцами. + +## toMonday {#tomonday} + +Округляет дату или дату-с-временем вниз до ближайшего понедельника. +Возвращается дата. + +## toStartOfDay {#tostartofday} + +Округляет дату-с-временем вниз до начала дня. Возвращается дата-с-временем. + +## toStartOfHour {#tostartofhour} + +Округляет дату-с-временем вниз до начала часа. + +## toStartOfMinute {#tostartofminute} + +Округляет дату-с-временем вниз до начала минуты. + +## toStartOfFiveMinute {#tostartoffiveminute} + +Округляет дату-с-временем вниз до начала пятиминутного интервала. + +## toStartOfTenMinutes {#tostartoftenminutes} + +Округляет дату-с-временем вниз до начала десятиминутного интервала. + +## toStartOfFifteenMinutes {#tostartoffifteenminutes} + +Округляет дату-с-временем вниз до начала пятнадцатиминутного интервала. + +## toStartOfInterval(time\_or\_data, INTERVAL x unit \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} + +Обобщение остальных функций `toStartOf*`. Например, +`toStartOfInterval(t, INTERVAL 1 year)` возвращает то же самое, что и `toStartOfYear(t)`, +`toStartOfInterval(t, INTERVAL 1 month)` возвращает то же самое, что и `toStartOfMonth(t)`, +`toStartOfInterval(t, INTERVAL 1 day)` возвращает то же самое, что и `toStartOfDay(t)`, +`toStartOfInterval(t, INTERVAL 15 minute)` возвращает то же самое, что и `toStartOfFifteenMinutes(t)`, и т.п. + +## toTime {#totime} + +Переводит дату-с-временем на некоторую фиксированную дату, сохраняя при этом время. + +## toRelativeYearNum {#torelativeyearnum} + +Переводит дату-с-временем или дату в номер года, начиная с некоторого фиксированного момента в прошлом. + +## toRelativeMonthNum {#torelativemonthnum} + +Переводит дату-с-временем или дату в номер месяца, начиная с некоторого фиксированного момента в прошлом. + +## toRelativeWeekNum {#torelativeweeknum} + +Переводит дату-с-временем или дату в номер недели, начиная с некоторого фиксированного момента в прошлом. + +## toRelativeDayNum {#torelativedaynum} + +Переводит дату-с-временем или дату в номер дня, начиная с некоторого фиксированного момента в прошлом. + +## toRelativeHourNum {#torelativehournum} + +Переводит дату-с-временем в номер часа, начиная с некоторого фиксированного момента в прошлом. + +## toRelativeMinuteNum {#torelativeminutenum} + +Переводит дату-с-временем в номер минуты, начиная с некоторого фиксированного момента в прошлом. + +## toRelativeSecondNum {#torelativesecondnum} + +Переводит дату-с-временем в номер секунды, начиная с некоторого фиксированного момента в прошлом. + +## now {#now} + +Принимает ноль аргументов и возвращает текущее время на один из моментов выполнения запроса. +Функция возвращает константу, даже если запрос выполнялся долго. + +## today {#today} + +Принимает ноль аргументов и возвращает текущую дату на один из моментов выполнения запроса. +То же самое, что toDate(now()) + +## yesterday {#yesterday} + +Принимает ноль аргументов и возвращает вчерашнюю дату на один из моментов выполнения запроса. +Делает то же самое, что today() - 1. + +## dateDiff {#datediff} + +Вычисляет разницу между двумя значениями дат с временем. + +**Синтаксис** + +``` sql +dateDiff('unit', startdate, enddate, [timezone]) +``` + +**Параметры** + +- `unit` — Единица измерения времени, в которой будет вычислена разница между `startdate` и `enddate`. [String](../syntax.md#syntax-string-literal). + + Поддерживаемые значения: + + | unit | + | ------ | + |second | + |minute | + |hour | + |day | + |week | + |month | + |quarter | + |year | + +- `startdate` — Первая дата. [Date](../../sql-reference/functions/date-time-functions.md) или [DateTime](../../sql-reference/functions/date-time-functions.md). + +- `enddate` — Вторая дата. [Date](../../sql-reference/functions/date-time-functions.md) или [DateTime](../../sql-reference/functions/date-time-functions.md). + +- `timezone` — Опциональный параметр. Если определен, применяется к обоим значениям: `startdate` и `enddate`. Если не определен, используются часовые пояса `startdate` и `enddate`. Если часовые пояса не совпадают, вернется неожидаемый результат. + +**Возвращаемое значение** + +Разница между `startdate` и `enddate`, выраженная в `unit`. + +Тип: `int`. + +**Пример** + +Запрос: + +``` sql +SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); +``` + +Ответ: + +``` text +┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ +│ 25 │ +└────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## timeSlot {#timeslot} + +Округляет время до получаса. +Эта функция является специфичной для Яндекс.Метрики, так как пол часа - минимальное время, для которого, если соседние по времени хиты одного посетителя на одном счётчике отстоят друг от друга строго более, чем на это время, визит может быть разбит на два визита. То есть, кортежи (номер счётчика, идентификатор посетителя, тайм-слот) могут использоваться для поиска хитов, входящий в соответствующий визит. + +## timeSlots(StartTime, Duration,\[, Size\]) {#timeslotsstarttime-duration-size} + +Для интервала времени, начинающегося в ‘StartTime’ и продолжающегося ‘Duration’ секунд, возвращает массив моментов времени, состоящий из округлений вниз до ‘Size’ точек в секундах из этого интервала. ‘Size’ - необязательный параметр, константный UInt32, по умолчанию равен 1800. + +Например, `timeSlots(toDateTime('2012-01-01 12:20:00'), toUInt32(600)) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. +Это нужно для поиска хитов, входящих в соответствующий визит. + +## formatDateTime(Time, Format\[, Timezone\]) {#formatdatetime} + +Функция преобразования даты-с-временем в String согласно заданному шаблону. Важно - шаблон является константным выражением, т.е. невозможно использование разных шаблонов в одной колонке. + +Поддерживаемые модификаторы в шаблоне Format: +(колонка «Пример» показана для времени `2018-01-02 22:33:44`) + +| Модификатор | Описание | Пример | +|-------------|----------------------------------------------------------------------|------------| +| %C | номер года, поделённый на 100 (00-99) | 20 | +| %d | день месяца, с ведущим нулём (01-31) | 02 | +| %D | короткая запись %m/%d/%y | 01/02/18 | +| %e | день месяца, с ведущим пробелом ( 1-31) | 2 | +| %F | короткая запись %Y-%m-%d | 2018-01-02 | +| %H | час в 24-часовом формате (00-23) | 22 | +| %I | час в 12-часовом формате (01-12) | 10 | +| %j | номер дня в году, с ведущими нулями (001-366) | 002 | +| %m | месяц, с ведущим нулём (01-12) | 01 | +| %M | минуты, с ведущим нулём (00-59) | 33 | +| %n | символ переноса строки (‘’) | | +| %p | обозначения AM или PM | PM | +| %R | короткая запись %H:%M | 22:33 | +| %S | секунды, с ведущими нулями (00-59) | 44 | +| %t | символ табуляции (’) | | +| %T | формат времени ISO 8601, одинаковый с %H:%M:%S | 22:33:44 | +| %u | номер дня недели согласно ISO 8601, понедельник - 1, воскресенье - 7 | 2 | +| %V | номер недели согласно ISO 8601 (01-53) | 01 | +| %w | номер дня недели, начиная с воскресенья (0-6) | 2 | +| %y | год, последние 2 цифры (00-99) | 18 | +| %Y | год, 4 цифры | 2018 | +| %% | символ % | % | + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/date_time_functions/) diff --git a/docs/ru/sql-reference/functions/encoding-functions.md b/docs/ru/sql-reference/functions/encoding-functions.md new file mode 100644 index 00000000000..b8ea481364d --- /dev/null +++ b/docs/ru/sql-reference/functions/encoding-functions.md @@ -0,0 +1,168 @@ +# Функции кодирования {#funktsii-kodirovaniia} + +## char {#char} + +Возвращает строку, длина которой равна числу переданных аргументов, и каждый байт имеет значение соответствующего аргумента. Принимает несколько числовых аргументов. Если значение аргумента выходит за диапазон UInt8 (0..255), то оно преобразуется в UInt8 с возможным округлением и переполнением. + +**Синтаксис** + +``` sql +char(number_1, [number_2, ..., number_n]); +``` + +**Параметры** + +- `number_1, number_2, ..., number_n` — Числовые аргументы, которые интерпретируются как целые числа. Типы: [Int](../../sql-reference/functions/encoding-functions.md), [Float](../../sql-reference/functions/encoding-functions.md). + +**Возвращаемое значение** + +- строка из соответствующих байт. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello +``` + +Ответ: + +``` text +┌─hello─┐ +│ hello │ +└───────┘ +``` + +Вы можете создать строку в произвольной кодировке, передав соответствующие байты. Пример для UTF-8: + +Запрос: + +``` sql +SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; +``` + +Ответ: + +``` text +┌─hello──┐ +│ привет │ +└────────┘ +``` + +Запрос: + +``` sql +SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; +``` + +Ответ: + +``` text +┌─hello─┐ +│ 你好 │ +└───────┘ +``` + +## hex {#hex} + +Returns a string containing the argument’s hexadecimal representation. + +**Syntax** + +``` sql +hex(arg) +``` + +The function is using uppercase letters `A-F` and not using any prefixes (like `0x`) or suffixes (like `h`). + +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 leading digit is zero. + +Example: + +**Example** + +Query: + +``` sql +SELECT hex(1); +``` + +Result: + +``` text +01 +``` + +Values of type `Date` and `DateTime` are formatted as corresponding integers (the number of days since Epoch for Date and the value of Unix Timestamp for DateTime). + +For `String` and `FixedString`, all bytes are simply encoded as two hexadecimal numbers. Zero bytes are not omitted. + +Values of floating point and Decimal 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. + +**Parameters** + +- `arg` — A value to convert to hexadecimal. Types: [String](../../sql-reference/functions/encoding-functions.md), [UInt](../../sql-reference/functions/encoding-functions.md), [Float](../../sql-reference/functions/encoding-functions.md), [Decimal](../../sql-reference/functions/encoding-functions.md), [Date](../../sql-reference/functions/encoding-functions.md) or [DateTime](../../sql-reference/functions/encoding-functions.md). + +**Returned value** + +- A string with the hexadecimal representation of the argument. + +Type: `String`. + +**Example** + +Query: + +``` sql +SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); +``` + +Result: + +``` text +┌─hex_presentation─┐ +│ 00007041 │ +│ 00008041 │ +└──────────────────┘ +``` + +Query: + +``` sql +SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); +``` + +Result: + +``` text +┌─hex_presentation─┐ +│ 0000000000002E40 │ +│ 0000000000003040 │ +└──────────────────┘ +``` + +## unhex(str) {#unhexstr} + +Accepts a string containing any number of hexadecimal digits, and returns a string containing the corresponding bytes. 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). +If you want to convert the result to a number, you can use the ‘reverse’ and ‘reinterpretAsType’ functions. + +## UUIDStringToNum(str) {#uuidstringtonumstr} + +Принимает строку, содержащую 36 символов в формате `123e4567-e89b-12d3-a456-426655440000`, и возвращает в виде набора байт в FixedString(16). + +## UUIDNumToString(str) {#uuidnumtostringstr} + +Принимает значение типа FixedString(16). Возвращает строку из 36 символов в текстовом виде. + +## bitmaskToList(num) {#bitmasktolistnum} + +Принимает целое число. Возвращает строку, содержащую список степеней двойки, в сумме дающих исходное число; по возрастанию, в текстовом виде, через запятую, без пробелов. + +## bitmaskToArray(num) {#bitmasktoarraynum} + +Принимает целое число. Возвращает массив чисел типа UInt64, содержащий степени двойки, в сумме дающих исходное число; числа в массиве идут по возрастанию. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/encoding_functions/) diff --git a/docs/ru/sql-reference/functions/ext-dict-functions.md b/docs/ru/sql-reference/functions/ext-dict-functions.md new file mode 100644 index 00000000000..f8d2ebb2b98 --- /dev/null +++ b/docs/ru/sql-reference/functions/ext-dict-functions.md @@ -0,0 +1,196 @@ +# Функции для работы с внешними словарями {#ext_dict_functions} + +Информацию о подключении и настройке внешних словарей смотрите в разделе [Внешние словари](../../sql-reference/functions/ext-dict-functions.md). + +## dictGet {#dictget} + +Извлекает значение из внешнего словаря. + +``` sql +dictGet('dict_name', 'attr_name', id_expr) +dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Параметры** + +- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). +- `attr_name` — имя столбца словаря. [Строковый литерал](../syntax.md#syntax-string-literal). +- `id_expr` — значение ключа словаря. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql-reference/functions/ext-dict-functions.md) или [Tuple](../../sql-reference/functions/ext-dict-functions.md) в зависимости от конфигурации словаря. +- `default_value_expr` — значение, возвращаемое в том случае, когда словарь не содержит строки с заданным ключом `id_expr`. [Выражение](../syntax.md#syntax-expressions) возвращающее значение с типом данных, сконфигурированным для атрибута `attr_name`. + +**Возвращаемое значение** + +- Значение атрибута, соответствующее ключу `id_expr`, если ClickHouse смог привести это значение к [заданному типу данных](../../sql-reference/functions/ext-dict-functions.md#ext_dict_structure-attributes). + +- Если ключа, соответствующего `id_expr` в словаре нет, то: + + - `dictGet` возвращает содержимое элемента ``, указанного для атрибута в конфигурации словаря. + - `dictGetOrDefault` возвращает атрибут `default_value_expr`. + +Если значение атрибута не удалось обработать или оно не соответствует типу данных атрибута, то ClickHouse генерирует исключение. + +**Пример** + +Создадим текстовый файл `ext-dict-text.csv` со следующим содержимым: + +``` text +1,1 +2,2 +``` + +Первый столбец — `id`, второй столбец — `c1`. + +Настройка внешнего словаря: + +``` xml + + + ext-dict-test + + + /path-to/ext-dict-test.csv + CSV + + + + + + + + id + + + c1 + UInt32 + + + + 0 + + +``` + +Выполним запрос: + +``` sql +SELECT + dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, + toTypeName(val) AS type +FROM system.numbers +LIMIT 3 +``` + +``` text +┌─val─┬─type───┐ +│ 1 │ UInt32 │ +│ 2 │ UInt32 │ +│ 20 │ UInt32 │ +└─────┴────────┘ +``` + +**Смотрите также** + +- [Внешние словари](../../sql-reference/functions/ext-dict-functions.md) + +## dictHas {#dicthas} + +Проверяет, присутствует ли запись с указанным ключом в словаре. + +``` sql +dictHas('dict_name', id) +``` + +**Параметры** + +- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). +- `id_expr` — значение ключа словаря. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql-reference/functions/ext-dict-functions.md). + +**Возвращаемое значение** + +- 0, если ключа нет. +- 1, если ключ есть. + +Тип — `UInt8`. + +## dictGetHierarchy {#dictgethierarchy} + +Создаёт массив, содержащий цепочку предков для заданного ключа в [иерархическом словаре](../dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md). + +**Синтаксис** + +``` sql +dictGetHierarchy('dict_name', key) +``` + +**Параметры** + +- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). +- `key` — значение ключа. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql-reference/functions/ext-dict-functions.md). + +**Возвращаемое значение** + +- Цепочка предков заданного ключа. + +Type: [Array(UInt64)](../../sql-reference/functions/ext-dict-functions.md). + +## dictIsIn {#dictisin} + +Проверяет предка ключа по всей иерархической цепочке словаря. + +`dictIsIn ('dict_name', child_id_expr, ancestor_id_expr)` + +**Параметры** + +- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). +- `child_id_expr` — ключ для проверки. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql-reference/functions/ext-dict-functions.md). +- `ancestor_id_expr` — предполагаемый предок ключа `child_id_expr`. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql-reference/functions/ext-dict-functions.md). + +**Возвращаемое значение** + +- 0, если `child_id_expr` — не дочерний элемент `ancestor_id_expr`. +- 1, если `child_id_expr` — дочерний элемент `ancestor_id_expr` или если `child_id_expr` и есть `ancestor_id_expr`. + +Тип — `UInt8`. + +## Прочие функции {#ext_dict_functions-other} + +ClickHouse поддерживает специализированные функции, которые приводят значения атрибутов словаря к определённому типу данных независимо от конфигурации словаря. + +Функции: + +- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` +- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` +- `dictGetFloat32`, `dictGetFloat64` +- `dictGetDate` +- `dictGetDateTime` +- `dictGetUUID` +- `dictGetString` + +Все эти функции можно использовать с модификатором `OrDefault`. Например, `dictGetDateOrDefault`. + +Синтаксис: + +``` sql +dictGet[Type]('dict_name', 'attr_name', id_expr) +dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Параметры** + +- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). +- `attr_name` — имя столбца словаря. [Строковый литерал](../syntax.md#syntax-string-literal). +- `id_expr` — значение ключа словаря. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql-reference/functions/ext-dict-functions.md). +- `default_value_expr` — значение, возвращаемое в том случае, когда словарь не содержит строки с заданным ключом `id_expr`. [Выражение](../syntax.md#syntax-expressions) возвращающее значение с типом данных, сконфигурированным для атрибута `attr_name`. + +**Возвращаемое значение** + +- Если ClickHouse успешно обработал атрибут в соответствии с [заданным типом данных](../../sql-reference/functions/ext-dict-functions.md#ext_dict_structure-attributes), то функции возвращают значение атрибута, соответствующее ключу `id_expr`. + +- Если запрошенного `id_expr` нет в словаре, то: + + - `dictGet[Type]` возвращает содержимое элемента ``, указанного для атрибута в конфигурации словаря. + - `dictGet[Type]OrDefault` возвращает аргумент `default_value_expr`. + +Если значение атрибута не удалось обработать или оно не соответствует типу данных атрибута, то ClickHouse генерирует исключение. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/ext_dict_functions/) diff --git a/docs/ru/sql-reference/functions/functions-for-nulls.md b/docs/ru/sql-reference/functions/functions-for-nulls.md new file mode 100644 index 00000000000..fd6bf699c1c --- /dev/null +++ b/docs/ru/sql-reference/functions/functions-for-nulls.md @@ -0,0 +1,305 @@ +# Функции для работы с Nullable-аргументами {#funktsii-dlia-raboty-s-nullable-argumentami} + +## isNull {#isnull} + +Проверяет является ли аргумент [NULL](../syntax.md#null). + +``` sql +isNull(x) +``` + +**Параметры** + +- `x` — значение с не составным типом данных. + +**Возвращаемое значение** + +- `1`, если `x` — `NULL`. +- `0`, если `x` — не `NULL`. + +**Пример** + +Входная таблица + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Запрос + +``` sql +SELECT x FROM t_null WHERE isNull(y) +``` + +``` text +┌─x─┐ +│ 1 │ +└───┘ +``` + +## isNotNull {#isnotnull} + +Проверяет не является ли аргумент [NULL](../syntax.md#null). + +``` sql +isNotNull(x) +``` + +**Параметры** + +- `x` — значение с не составным типом данных. + +**Возвращаемое значение** + +- `0`, если `x` — `NULL`. +- `1`, если `x` — не `NULL`. + +**Пример** + +Входная таблица + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Запрос + +``` sql +SELECT x FROM t_null WHERE isNotNull(y) +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## coalesce {#coalesce} + +Последовательно слева-направо проверяет являются ли переданные аргументы `NULL` и возвращает первый не `NULL`. + +``` sql +coalesce(x,...) +``` + +**Параметры** + +- Произвольное количество параметров не составного типа. Все параметры должны быть совместимы по типу данных. + +**Возвращаемые значения** + +- Первый не `NULL` аргумент. +- `NULL`, если все аргументы — `NULL`. + +**Пример** + +Рассмотрим адресную книгу, в которой может быть указано несколько способов связи с клиентом. + +``` text +┌─name─────┬─mail─┬─phone─────┬──icq─┐ +│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ +│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└──────────┴──────┴───────────┴──────┘ +``` + +Поля `mail` и `phone` имеют тип String, а поле `icq` — `UInt32`, его необходимо будет преобразовать в `String`. + +Получим из адресной книги первый доступный способ связаться с клиентом: + +``` sql +SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook +``` + +``` text +┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ +│ client 1 │ 123-45-67 │ +│ client 2 │ ᴺᵁᴸᴸ │ +└──────────┴──────────────────────────────────────────────────────┘ +``` + +## ifNull {#ifnull} + +Возвращает альтернативное значение, если основной аргумент — `NULL`. + +``` sql +ifNull(x,alt) +``` + +**Параметры** + +- `x` — значение для проверки на `NULL`, +- `alt` — значение, которое функция вернёт, если `x` — `NULL`. + +**Возвращаемые значения** + +- Значение `x`, если `x` — не `NULL`. +- Значение `alt`, если `x` — `NULL`. + +**Пример** + +``` sql +SELECT ifNull('a', 'b') +``` + +``` text +┌─ifNull('a', 'b')─┐ +│ a │ +└──────────────────┘ +``` + +``` sql +SELECT ifNull(NULL, 'b') +``` + +``` text +┌─ifNull(NULL, 'b')─┐ +│ b │ +└───────────────────┘ +``` + +## nullIf {#nullif} + +Возвращает `NULL`, если аргументы равны. + +``` sql +nullIf(x, y) +``` + +**Параметры** + +`x`, `y` — значения для сравнивания. Они должны быть совместимых типов, иначе ClickHouse сгенерирует исключение. + +**Возвращаемые значения** + +- `NULL`, если аргументы равны. +- Значение `x`, если аргументы не равны. + +**Пример** + +``` sql +SELECT nullIf(1, 1) +``` + +``` text +┌─nullIf(1, 1)─┐ +│ ᴺᵁᴸᴸ │ +└──────────────┘ +``` + +``` sql +SELECT nullIf(1, 2) +``` + +``` text +┌─nullIf(1, 2)─┐ +│ 1 │ +└──────────────┘ +``` + +## assumeNotNull {#assumenotnull} + +Приводит значение типа [Nullable](../../sql-reference/functions/functions-for-nulls.md) к не `Nullable`, если значение не `NULL`. + +``` sql +assumeNotNull(x) +``` + +**Параметры** + +- `x` — исходное значение. + +**Возвращаемые значения** + +- Исходное значение с не `Nullable` типом, если оно — не `NULL`. +- Значение по умолчанию для не `Nullable` типа, если исходное значение — `NULL`. + +**Пример** + +Рассмотрим таблицу `t_null`. + +``` sql +SHOW CREATE TABLE t_null +``` + +``` text +┌─statement─────────────────────────────────────────────────────────────────┐ +│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ +└───────────────────────────────────────────────────────────────────────────┘ +``` + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Применим функцию `assumeNotNull` к столбцу `y`. + +``` sql +SELECT assumeNotNull(y) FROM t_null +``` + +``` text +┌─assumeNotNull(y)─┐ +│ 0 │ +│ 3 │ +└──────────────────┘ +``` + +``` sql +SELECT toTypeName(assumeNotNull(y)) FROM t_null +``` + +``` text +┌─toTypeName(assumeNotNull(y))─┐ +│ Int8 │ +│ Int8 │ +└──────────────────────────────┘ +``` + +## toNullable {#tonullable} + +Преобразует тип аргумента к `Nullable`. + +``` sql +toNullable(x) +``` + +**Параметры** + +- `x` — значение произвольного не составного типа. + +**Возвращаемое значение** + +- Входное значение с типом не `Nullable`. + +**Пример** + +``` sql +SELECT toTypeName(10) +``` + +``` text +┌─toTypeName(10)─┐ +│ UInt8 │ +└────────────────┘ +``` + +``` sql +SELECT toTypeName(toNullable(10)) +``` + +``` text +┌─toTypeName(toNullable(10))─┐ +│ Nullable(UInt8) │ +└────────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/functions_for_nulls/) diff --git a/docs/ru/sql-reference/functions/geo.md b/docs/ru/sql-reference/functions/geo.md new file mode 100644 index 00000000000..e747d719938 --- /dev/null +++ b/docs/ru/sql-reference/functions/geo.md @@ -0,0 +1,385 @@ +# Функции для работы с географическими координатами {#funktsii-dlia-raboty-s-geograficheskimi-koordinatami} + +## greatCircleDistance {#greatcircledistance} + +Вычисляет расстояние между двумя точками на поверхности Земли по [формуле большого круга](https://en.wikipedia.org/wiki/Great-circle_distance). + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**Входные параметры** + +- `lon1Deg` — долгота первой точки в градусах. Диапазон — `[-180°, 180°]`. +- `lat1Deg` — широта первой точки в градусах. Диапазон — `[-90°, 90°]`. +- `lon2Deg` — долгота второй точки в градусах. Диапазон — `[-180°, 180°]`. +- `lat2Deg` — широта второй точки в градусах. Диапазон — `[-90°, 90°]`. + +Положительные значения соответствуют северной широте и восточной долготе, отрицательные — южной широте и западной долготе. + +**Возвращаемое значение** + +Расстояние между двумя точками на поверхности Земли в метрах. + +Генерирует исключение, когда значения входных параметров выходят за границы диапазонов. + +**Пример** + +``` sql +SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) +``` + +``` text +┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ +│ 14132374.194975413 │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## greatCircleAngle {#greatcircleangle} + +Вычисляет угловое расстояние на сфере по [формуле большого круга](https://en.wikipedia.org/wiki/Great-circle_distance). + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**Входные параметры** + +- `lon1Deg` — долгота первой точки в градусах. +- `lat1Deg` — широта первой точки в градусах. +- `lon2Deg` — долгота второй точки в градусах. +- `lat2Deg` — широта второй точки в градусах. + +**Возвращаемое значение** + +Длина дуги большого круга между двумя точками в градусах. + +**Пример** + +``` sql +SELECT greatCircleAngle(0, 0, 45, 0) AS arc +``` + +``` text +┌─arc─┐ +│ 45 │ +└─────┘ +``` + +## pointInEllipses {#pointinellipses} + +Проверяет, принадлежит ли точка хотя бы одному из эллипсов. +Координаты — геометрические в декартовой системе координат. + + pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) + +**Входные параметры** + +- `x, y` — координаты точки на плоскости. +- `xᵢ, yᵢ` — координаты центра `i`-го эллипса. +- `aᵢ, bᵢ` — полуоси `i`-го эллипса (в единицах измерения координат x,y). + +Входных параметров должно быть `2+4⋅n`, где `n` — количество эллипсов. + +**Возвращаемые значения** + +`1`, если точка внутри хотя бы одного из эллипсов, `0`, если нет. + +**Пример** + +``` sql +SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) +``` + +``` text +┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ +│ 1 │ +└─────────────────────────────────────────────────┘ +``` + +## pointInPolygon {#pointinpolygon} + +Проверяет, принадлежит ли точка многоугольнику на плоскости. + +``` sql +pointInPolygon((x, y), [(a, b), (c, d) ...], ...) +``` + +**Входные значения** + +- `(x, y)` — координаты точки на плоскости. Тип данных — [Tuple](../../sql-reference/functions/geo.md) — кортеж из двух чисел. +- `[(a, b), (c, d) ...]` — вершины многоугольника. Тип данных — [Array](../../sql-reference/functions/geo.md). Каждая вершина представлена парой координат `(a, b)`. Вершины следует указывать в порядке обхода по или против часовой стрелки. Минимальное количество вершин — 3. Многоугольник должен быть константным. +- функция поддерживает также многоугольники с дырками (вырезанными кусками). Для этого случая, добавьте многоугольники, описывающие вырезанные куски, дополнительными аргументами функции. Функция не поддерживает не односвязные многоугольники. + +**Возвращаемые значения** + +`1`, если точка внутри многоугольника, `0`, если нет. +Если точка находится на границе многоугольника, функция может возвращать как 0, так и 1. + +**Пример** + +``` sql +SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## geohashEncode {#geohashencode} + +Кодирует широту и долготу в строку geohash, смотрите http://geohash.org/, https://en.wikipedia.org/wiki/Geohash. + +``` sql +geohashEncode(longitude, latitude, [precision]) +``` + +**Входные значения** + +- longitude — долгота. Диапазон — `[-180°, 180°].` +- latitude — широта. Диапазон — `[-90°, 90°].` +- precision — длина результирующей строки, по умолчанию `12`. Опционально. Целое число в диапазоне `[1, 12]`. Любое значение меньше, чем `1` или больше `12` автоматически преобразуются в `12`. + +**Возвращаемые значения** + +- Строка с координатой, закодированной модифицированной версией алфавита base32. + +**Пример** + +``` sql +SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res +``` + +``` text +┌─res──────────┐ +│ ezs42d000000 │ +└──────────────┘ +``` + +## geohashDecode {#geohashdecode} + +Декодирует любую строку, закодированную в geohash, на долготу и широту. + +``` sql +geohashDecode(geohash_string) +``` + +**Входные значения** + +- `geohash_string` — строка, содержащая geohash. + +**Возвращаемые значения** + +- `(longitude, latitude)` — широта и долгота. Кортеж из двух значений типа `Float64`. + +**Пример** + +``` sql +SELECT geohashDecode('ezs42') AS res +``` + +``` text +┌─res─────────────────────────────┐ +│ (-5.60302734375,42.60498046875) │ +└─────────────────────────────────┘ +``` + +## h3IsValid {#h3isvalid} + +Проверяет корректность H3-индекса. + +``` sql +h3IsValid(h3index) +``` + +**Входные значения** + +- `h3index` — идентификатор шестиугольника. Тип данных — [UInt64](../../sql-reference/functions/geo.md). + +**Возвращаемые значения** + +- 0 — число не является H3-индексом +- 1 — число является H3-индексом + +Тип — [UInt8](../../sql-reference/functions/geo.md). + +**Пример** + +``` sql +SELECT h3IsValid(630814730351855103) as h3IsValid +``` + +``` text +┌─h3IsValid─┐ +│ 1 │ +└───────────┘ +``` + +## h3GetResolution {#h3getresolution} + +Извлекает разрешение H3-индекса. + +``` sql +h3GetResolution(h3index) +``` + +**Входные значения** + +- `h3index` — идентификатор шестиугольника. Тип данных — [UInt64](../../sql-reference/functions/geo.md). + +**Возвращаемые значения** + +- Разрешение сетки, от 0 до 15. +- Для несуществующего идентификатора может быть возвращено произвольное значение, используйте [h3IsValid](#h3isvalid) для проверки идентификаторов + +Тип — [UInt8](../../sql-reference/functions/geo.md). + +**Пример** + +``` sql +SELECT h3GetResolution(639821929606596015) as resolution +``` + +``` text +┌─resolution─┐ +│ 14 │ +└────────────┘ +``` + +## h3EdgeAngle {#h3edgeangle} + +Информирует о среднем размере стороны шестигранника H3 в градусах + +``` sql +h3EdgeAngle(resolution) +``` + +**Входные значения** + +- `resolution` — требуемое разрешение индекса. Тип данных — [UInt8](../../sql-reference/functions/geo.md). Диапазон возможных значений — `[0, 15]`. + +**Возвращаемые значения** + +Средняя длина стороны многоугольника H3 в градусах, тип — [Float64](../../sql-reference/functions/geo.md). + +**Пример** + +``` sql +SELECT h3EdgeAngle(10) as edgeAngle +``` + +``` text +┌─────────h3EdgeAngle(10)─┐ +│ 0.0005927224846720883 │ +└───────────────────────┘ +``` + +## h3EdgeLengthM {#h3edgelengthm} + +Информирует о среднем размере стороны шестигранника H3 в метрах + +``` sql +h3EdgeLengthM(resolution) +``` + +**Входные значения** + +- `resolution` — требуемое разрешение индекса. Тип данных — [UInt8](../../sql-reference/functions/geo.md). Диапазон возможных значений — `[0, 15]`. + +**Возвращаемые значения** + +Средняя длина стороны многоугольника H3 в метрах, тип — [Float64](../../sql-reference/functions/geo.md). + +**Пример** + +``` sql +SELECT h3EdgeLengthM(15) as edgeLengthM +``` + +``` text +┌─edgeLengthM─┐ +│ 0.509713273 │ +└─────────────┘ +``` + +## geoToH3 {#geotoh3} + +Возвращает H3 индекс точки `(lon, lat)` с заданным разрешением. + +[H3](https://uber.github.io/h3/#/documentation/overview/introduction) - это географическая система индексации, в которой поверхность Земли разделена на ровные шестиугольные плитки. Эта система иерархична, то есть каждый шестиугольник на верхнем уровне может быть разбит на семь еще более мелких и так далее. + +H3 индекс используется в основном для определения местоположения с помощью карт и других геопространственных манипуляций. + +**Синтаксис** + +``` sql +geoToH3(lon, lat, resolution) +``` + +**Параметры** + +- `lon` — географическая долгота. Тип данных — [Float64](../../sql-reference/functions/geo.md). +- `lat` — географическая широта. Тип данных — [Float64](../../sql-reference/functions/geo.md). +- `resolution` — требуемое разрешение индекса. Тип данных — [UInt8](../../sql-reference/functions/geo.md). Диапазон возможных значений — `[0, 15]`. + +**Возвращаемые значения** + +- Порядковый номер шестиугольника. +- 0 в случае ошибки. + +Тип — [UInt64](../../sql-reference/functions/geo.md). + +**Пример** + +Запрос: + +``` sql +SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index +``` + +Ответ: + +``` text +┌────────────h3Index─┐ +│ 644325524701193974 │ +└────────────────────┘ +``` + +## h3kRing {#h3kring} + +Возвращает H3-индексы шестиугольников в радиусе `k` от данного в произвольном порядке + +``` sql +h3kRing(h3index, k) +``` + +**Входные значения** + +- `h3index` — идентификатор шестиугольника. Тип данных — [UInt64](../../sql-reference/functions/geo.md). +- `k` — радиус. Тип данных — [целое число](../../sql-reference/functions/geo.md) + +**Возвращаемые значения** + +[Массив](../../sql-reference/functions/geo.md) из H3-индексов типа [UInt64](../../sql-reference/functions/geo.md). + +**Пример** + +``` sql +SELECT arrayJoin(h3kRing(644325529233966508, 1)) AS h3index +``` + +``` text +┌────────────h3index─┐ +│ 644325529233966508 │ +│ 644325529233966497 │ +│ 644325529233966510 │ +│ 644325529233966504 │ +│ 644325529233966509 │ +│ 644325529233966355 │ +│ 644325529233966354 │ +└────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/geo/) diff --git a/docs/ru/sql-reference/functions/hash-functions.md b/docs/ru/sql-reference/functions/hash-functions.md new file mode 100644 index 00000000000..682f1410cc6 --- /dev/null +++ b/docs/ru/sql-reference/functions/hash-functions.md @@ -0,0 +1,479 @@ +# Функции хэширования {#funktsii-kheshirovaniia} + +Функции хэширования могут использоваться для детерминированного псевдослучайного разбрасывания элементов. + +## halfMD5 {#hash-functions-halfmd5} + +[Интерпретирует](../../sql-reference/functions/hash-functions.md#type_conversion_functions-reinterpretAsString) все входные параметры как строки и вычисляет хэш [MD5](https://ru.wikipedia.org/wiki/MD5) для каждой из них. Затем объединяет хэши, берет первые 8 байт хэша результирующей строки и интерпретирует их как значение типа `UInt64` с big-endian порядком байтов. + +``` sql +halfMD5(par1, ...) +``` + +Функция относительно медленная (5 миллионов коротких строк в секунду на ядро процессора). +По возможности, используйте функцию [sipHash64](#hash_functions-siphash64) вместо неё. + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +Значение хэша с типом данных [UInt64](../../sql-reference/functions/hash-functions.md). + +**Пример** + +``` sql +SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type +``` + +``` text +┌────────halfMD5hash─┬─type───┐ +│ 186182704141653334 │ UInt64 │ +└────────────────────┴────────┘ +``` + +## MD5 {#hash_functions-md5} + +Вычисляет MD5 от строки и возвращает полученный набор байт в виде FixedString(16). +Если вам не нужен конкретно MD5, а нужен неплохой криптографический 128-битный хэш, то используйте вместо этого функцию sipHash128. +Если вы хотите получить такой же результат, как выдаёт утилита md5sum, напишите lower(hex(MD5(s))). + +## sipHash64 {#hash_functions-siphash64} + +Генерирует 64-х битное значение [SipHash](https://131002.net/siphash/). + +``` sql +sipHash64(par1,...) +``` + +Это криптографическая хэш-функция. Она работает по крайней мере в три раза быстрее, чем функция [MD5](#hash_functions-md5). + +Функция [интерпретирует](../../sql-reference/functions/hash-functions.md#type_conversion_functions-reinterpretAsString) все входные параметры как строки и вычисляет хэш MD5 для каждой из них. Затем комбинирует хэши по следующему алгоритму. + +1. После хэширования всех входных параметров функция получает массив хэшей. +2. Функция принимает первый и второй элементы и вычисляет хэш для массива из них. +3. Затем функция принимает хэш-значение, вычисленное на предыдущем шаге, и третий элемент исходного хэш-массива, и вычисляет хэш для массива из них. +4. Предыдущий шаг повторяется для всех остальных элементов исходного хэш-массива. + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +Значение хэша с типом данных [UInt64](../../sql-reference/functions/hash-functions.md). + +**Пример** + +``` sql +SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type +``` + +``` text +┌──────────────SipHash─┬─type───┐ +│ 13726873534472839665 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## sipHash128 {#hash_functions-siphash128} + +Вычисляет SipHash от строки. +Принимает аргумент типа String. Возвращает FixedString(16). +Отличается от sipHash64 тем, что финальный xor-folding состояния делается только до 128 бит. + +## cityHash64 {#cityhash64} + +Генерирует 64-х битное значение [CityHash](https://github.com/google/cityhash). + +``` sql +cityHash64(par1,...) +``` + +Это не криптографическая хэш-функция. Она использует CityHash алгоритм для строковых параметров и зависящую от реализации быструю некриптографическую хэш-функцию для параметров с другими типами данных. Функция использует комбинатор CityHash для получения конечных результатов. + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +Значение хэша с типом данных [UInt64](../../sql-reference/functions/hash-functions.md). + +**Примеры** + +Пример вызова: + +``` sql +SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type +``` + +``` text +┌─────────────CityHash─┬─type───┐ +│ 12072650598913549138 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +А вот так вы можете вычислить чексумму всей таблицы с точностью до порядка строк: + +``` sql +SELECT groupBitXor(cityHash64(*)) FROM table +``` + +## intHash32 {#inthash32} + +Вычисляет 32-битный хэш-код от целого числа любого типа. +Это сравнительно быстрая не криптографическая хэш-функция среднего качества для чисел. + +## intHash64 {#inthash64} + +Вычисляет 64-битный хэш-код от целого числа любого типа. +Работает быстрее, чем intHash32. Качество среднее. + +## SHA1 {#sha1} + +## SHA224 {#sha224} + +## SHA256 {#sha256} + +Вычисляет SHA-1, SHA-224, SHA-256 от строки и возвращает полученный набор байт в виде FixedString(20), FixedString(28), FixedString(32). +Функция работает достаточно медленно (SHA-1 - примерно 5 миллионов коротких строк в секунду на одном процессорном ядре, SHA-224 и SHA-256 - примерно 2.2 миллионов). +Рекомендуется использовать эти функции лишь в тех случаях, когда вам нужна конкретная хэш-функция и вы не можете её выбрать. +Даже в этих случаях, рекомендуется применять функцию оффлайн - заранее вычисляя значения при вставке в таблицу, вместо того, чтобы применять её при SELECT-ах. + +## URLHash(url\[, N\]) {#urlhashurl-n} + +Быстрая не криптографическая хэш-функция неплохого качества для строки, полученной из URL путём некоторой нормализации. +`URLHash(s)` - вычислить хэш от строки без одного завершающего символа `/`, `?` или `#` на конце, если там такой есть. +`URLHash(s, N)` - вычислить хэш от строки до N-го уровня в иерархии URL, без одного завершающего символа `/`, `?` или `#` на конце, если там такой есть. +Уровни аналогичные URLHierarchy. Функция специфична для Яндекс.Метрики. + +## farmHash64 {#farmhash64} + +Генерирует 64-х битное значение [FarmHash](https://github.com/google/farmhash). + +``` sql +farmHash64(par1, ...) +``` + +Из всех [доступных методов](https://github.com/google/farmhash/blob/master/src/farmhash.h) функция использует `Hash64`. + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +Значение хэша с типом данных [UInt64](../../sql-reference/functions/hash-functions.md). + +**Пример** + +``` sql +SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type +``` + +``` text +┌─────────────FarmHash─┬─type───┐ +│ 17790458267262532859 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## javaHash {#hash_functions-javahash} + +Вычисляет [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) от строки. `JavaHash` не отличается ни скоростью, ни качеством, поэтому эту функцию следует считать устаревшей. Используйте эту функцию, если вам необходимо получить значение хэша по такому же алгоритму. + +``` sql +SELECT javaHash(''); +``` + +**Возвращаемое значение** + +Хэш-значение типа `Int32`. + +Тип: `javaHash`. + +**Пример** + +Запрос: + +``` sql +SELECT javaHash('Hello, world!'); +``` + +Ответ: + +``` text +┌─javaHash('Hello, world!')─┐ +│ -1880044555 │ +└───────────────────────────┘ +``` + +## javaHashUTF16LE {#javahashutf16le} + +Вычисляет [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) от строки, при допущении, что строка представлена в кодировке `UTF-16LE`. + +**Синтаксис** + +``` sql +javaHashUTF16LE(stringUtf16le) +``` + +**Параметры** + +- `stringUtf16le` — строка в `UTF-16LE`. + +**Возвращаемое значение** + +Хэш-значение типа `Int32`. + +Тип: `javaHash`. + +**Пример** + +Верный запрос для строки кодированной в `UTF-16LE`. + +Запрос: + +``` sql +SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) +``` + +Ответ: + +``` text +┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ +│ 3556498 │ +└──────────────────────────────────────────────────────────────┘ +``` + +## hiveHash {#hash-functions-hivehash} + +Вычисляет `HiveHash` от строки. + +``` sql +SELECT hiveHash(''); +``` + +`HiveHash` — это результат [JavaHash](#hash_functions-javahash) с обнулённым битом знака числа. Функция используется в [Apache Hive](https://en.wikipedia.org/wiki/Apache_Hive) вплоть до версии 3.0. + +**Возвращаемое значение** + +Хэш-значение типа `Int32`. + +Тип: `hiveHash`. + +**Пример** + +Запрос: + +``` sql +SELECT hiveHash('Hello, world!'); +``` + +Ответ: + +``` text +┌─hiveHash('Hello, world!')─┐ +│ 267439093 │ +└───────────────────────────┘ +``` + +## metroHash64 {#metrohash64} + +Генерирует 64-х битное значение [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/). + +``` sql +metroHash64(par1, ...) +``` + +**Параметры** + +Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +Значение хэша с типом данных [UInt64](../../sql-reference/functions/hash-functions.md). + +**Пример** + +``` sql +SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type +``` + +``` text +┌────────────MetroHash─┬─type───┐ +│ 14235658766382344533 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## jumpConsistentHash {#jumpconsistenthash} + +Вычисляет JumpConsistentHash от значения типа UInt64. +Имеет два параметра: ключ типа UInt64 и количество бакетов. Возвращает значение типа Int32. +Дополнительные сведения смотрите по ссылке: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) + +## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} + +Генерирует значение [MurmurHash2](https://github.com/aappleby/smhasher). + +``` sql +murmurHash2_32(par1, ...) +murmurHash2_64(par1, ...) +``` + +**Параметры** + +Обе функции принимают переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +- Функция `murmurHash2_32` возвращает значение типа [UInt32](../../sql-reference/functions/hash-functions.md). +- Функция `murmurHash2_64` возвращает значение типа [UInt64](../../sql-reference/functions/hash-functions.md). + +**Пример** + +``` sql +SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type +``` + +``` text +┌──────────MurmurHash2─┬─type───┐ +│ 11832096901709403633 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## gccMurmurHash {#gccmurmurhash} + +Вычисляет 64-битное значение [MurmurHash2](https://github.com/aappleby/smhasher), используя те же hash seed, что и [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191). + +**Синтаксис** + +``` sql +gccMurmurHash(par1, ...); +``` + +**Параметры** + +- `par1, ...` — Переменное число параметров. Каждый параметр может быть любого из [поддерживаемых типов данных](../../sql-reference/data-types/index.md). + +**Возвращаемое значение** + +- Вычисленный хэш-код. + +Тип: [UInt64](../../sql-reference/data-types/int-uint.md). + +**Примеры** + +Запрос: + +``` sql +SELECT + gccMurmurHash(1, 2, 3) AS res1, + gccMurmurHash(('a', [1, 2, 3], 4, (4, ['foo', 'bar'], 1, (1, 2)))) AS res2 +``` + +Результат: + +``` text +┌─────────────────res1─┬────────────────res2─┐ +│ 12384823029245979431 │ 1188926775431157506 │ +└──────────────────────┴─────────────────────┘ +``` + +## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} + +Генерирует значение [MurmurHash3](https://github.com/aappleby/smhasher). + +``` sql +murmurHash3_32(par1, ...) +murmurHash3_64(par1, ...) +``` + +**Параметры** + +Обе функции принимают переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +- Функция `murmurHash3_32` возвращает значение типа [UInt32](../../sql-reference/functions/hash-functions.md). +- Функция `murmurHash3_64` возвращает значение типа [UInt64](../../sql-reference/functions/hash-functions.md). + +**Пример** + +``` sql +SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3─┬─type───┐ +│ 2152717 │ UInt32 │ +└─────────────┴────────┘ +``` + +## murmurHash3\_128 {#murmurhash3-128} + +Генерирует значение [MurmurHash3](https://github.com/aappleby/smhasher). + +``` sql +murmurHash3_128( expr ) +``` + +**Параметры** + +- `expr` — [выражение](../syntax.md#syntax-expressions) возвращающее значение типа[String](../../sql-reference/functions/hash-functions.md). + +**Возвращаемое значение** + +Хэш-значение типа [FixedString(16)](../../sql-reference/functions/hash-functions.md). + +**Пример** + +``` sql +SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3──────┬─type────────────┐ +│ 6�1�4"S5KT�~~q │ FixedString(16) │ +└──────────────────┴─────────────────┘ +``` + +## xxHash32, xxHash64 {#hash-functions-xxhash32-xxhash64} + +Вычисляет `xxHash` от строки. Предлагается в двух вариантах: 32 и 64 бита. + +``` sql +SELECT xxHash32(''); + +OR + +SELECT xxHash64(''); +``` + +**Возвращаемое значение** + +Хэш-значение типа `Uint32` или `Uint64`. + +Тип: `xxHash`. + +**Пример** + +Запрос: + +``` sql +SELECT xxHash32('Hello, world!'); +``` + +Ответ: + +``` text +┌─xxHash32('Hello, world!')─┐ +│ 834093149 │ +└───────────────────────────┘ +``` + +**Смотрите также** + +- [xxHash](http://cyan4973.github.io/xxHash/). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/hash_functions/) diff --git a/docs/ru/sql-reference/functions/higher-order-functions.md b/docs/ru/sql-reference/functions/higher-order-functions.md new file mode 100644 index 00000000000..757a2980542 --- /dev/null +++ b/docs/ru/sql-reference/functions/higher-order-functions.md @@ -0,0 +1,167 @@ +# Функции высшего порядка {#higher-order-functions} + +## Оператор `->`, функция lambda(params, expr) {#operator-funktsiia-lambdaparams-expr} + +Позволяет описать лямбда-функцию для передачи в функцию высшего порядка. Слева от стрелочки стоит формальный параметр - произвольный идентификатор, или несколько формальных параметров - произвольные идентификаторы в кортеже. Справа от стрелочки стоит выражение, в котором могут использоваться эти формальные параметры, а также любые столбцы таблицы. + +Примеры: `x -> 2 * x, str -> str != Referer.` + +Функции высшего порядка, в качестве своего функционального аргумента могут принимать только лямбда-функции. + +В функции высшего порядка может быть передана лямбда-функция, принимающая несколько аргументов. В этом случае, в функцию высшего порядка передаётся несколько массивов одинаковых длин, которым эти аргументы будут соответствовать. + +Для некоторых функций, например [arrayCount](#higher_order_functions-array-count) или [arraySum](#higher_order_functions-array-sum), первый аргумент (лямбда-функция) может отсутствовать. В этом случае, подразумевается тождественное отображение. + +Для функций, перечисленных ниже, лямбда-функцию должна быть указана всегда: + +- [arrayMap](#higher_order_functions-array-map) +- [arrayFilter](#higher_order_functions-array-filter) +- [arrayFirst](#higher_order_functions-array-first) +- [arrayFirstIndex](#higher_order_functions-array-first-index) + +### arrayMap(func, arr1, …) {#higher_order_functions-array-map} + +Вернуть массив, полученный на основе результатов применения функции `func` к каждому элементу массива `arr`. + +Примеры: + +``` sql +SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,4,5] │ +└─────────┘ +``` + +Следующий пример показывает, как создать кортежи из элементов разных массивов: + +``` sql +SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res +``` + +``` text +┌─res─────────────────┐ +│ [(1,4),(2,5),(3,6)] │ +└─────────────────────┘ +``` + +Обратите внимание, что у функции `arrayMap` первый аргумент (лямбда-функция) не может быть опущен. + +### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} + +Вернуть массив, содержащий только те элементы массива `arr1`, для которых функция `func` возвращает не 0. + +Примеры: + +``` sql +SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res +``` + +``` text +┌─res───────────┐ +│ ['abc World'] │ +└───────────────┘ +``` + +``` sql +SELECT + arrayFilter( + (i, x) -> x LIKE '%World%', + arrayEnumerate(arr), + ['Hello', 'abc World'] AS arr) + AS res +``` + +``` text +┌─res─┐ +│ [2] │ +└─────┘ +``` + +Обратите внимание, что у функции `arrayFilter` первый аргумент (лямбда-функция) не может быть опущен. + +### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} + +Вернуть количество элементов массива `arr`, для которых функция func возвращает не 0. Если func не указана - вернуть количество ненулевых элементов массива. + +### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} + +Вернуть 1, если существует хотя бы один элемент массива `arr`, для которого функция func возвращает не 0. Иначе вернуть 0. + +### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} + +Вернуть 1, если для всех элементов массива `arr`, функция `func` возвращает не 0. Иначе вернуть 0. + +### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} + +Вернуть сумму значений функции `func`. Если функция не указана - просто вернуть сумму элементов массива. + +### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} + +Вернуть первый элемент массива `arr1`, для которого функция func возвращает не 0. + +Обратите внимание, что у функции `arrayFirst` первый аргумент (лямбда-функция) не может быть опущен. + +### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} + +Вернуть индекс первого элемента массива `arr1`, для которого функция func возвращает не 0. + +Обратите внимание, что у функции `arrayFirstFilter` первый аргумент (лямбда-функция) не может быть опущен. + +### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} + +Возвращает массив из частичных сумм элементов исходного массива (сумма с накоплением). Если указана функция `func`, то значения элементов массива преобразуются этой функцией перед суммированием. + +Пример: + +``` sql +SELECT arrayCumSum([1, 1, 1, 1]) AS res +``` + +``` text +┌─res──────────┐ +│ [1, 2, 3, 4] │ +└──────────────┘ +``` + +### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} + +Возвращает отсортированный в восходящем порядке массив `arr1`. Если задана функция `func`, то порядок сортировки определяется результатом применения функции `func` на элементы массива (массивов). + +Для улучшения эффективности сортировки применяется [Преобразование Шварца](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). + +Пример: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Подробная информация о методе `arraySort` приведена в разделе [Функции по работе с массивами](array-functions.md#array_functions-sort). + +### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} + +Возвращает отсортированный в нисходящем порядке массив `arr1`. Если задана функция `func`, то порядок сортировки определяется результатом применения функции `func` на элементы массива (массивов). + +Пример: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +Подробная информация о методе `arrayReverseSort` приведена в разделе [Функции по работе с массивами](array-functions.md#array_functions-reverse-sort). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/higher_order_functions/) diff --git a/docs/ru/sql-reference/functions/in-functions.md b/docs/ru/sql-reference/functions/in-functions.md new file mode 100644 index 00000000000..4153eb1aac0 --- /dev/null +++ b/docs/ru/sql-reference/functions/in-functions.md @@ -0,0 +1,19 @@ +# Функции для реализации оператора IN {#funktsii-dlia-realizatsii-operatora-in} + +## in, notIn, globalIn, globalNotIn {#in-functions} + +Смотрите раздел [Операторы IN](../statements/select.md#select-in-operators). + +## tuple(x, y, …), оператор (x, y, …) {#tuplex-y-operator-x-y} + +Функция, позволяющая сгруппировать несколько столбцов. +Для столбцов, имеющих типы T1, T2, … возвращает кортеж типа Tuple(T1, T2, …), содержащий эти столбцы. Выполнение функции ничего не стоит. +Кортежи обычно используются как промежуточное значение в качестве аргумента операторов IN, или для создания списка формальных параметров лямбда-функций. Кортежи не могут быть записаны в таблицу. + +## tupleElement(tuple, n), оператор x.N {#tupleelementtuple-n-operator-x-n} + +Функция, позволяющая достать столбец из кортежа. +N - индекс столбца начиная с 1. N должно быть константой. N должно быть целым строго положительным числом не большим размера кортежа. +Выполнение функции ничего не стоит. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/in_functions/) diff --git a/docs/ru/sql_reference/functions/index.md b/docs/ru/sql-reference/functions/index.md similarity index 100% rename from docs/ru/sql_reference/functions/index.md rename to docs/ru/sql-reference/functions/index.md diff --git a/docs/ru/sql-reference/functions/introspection.md b/docs/ru/sql-reference/functions/introspection.md new file mode 100644 index 00000000000..23ccf3fd855 --- /dev/null +++ b/docs/ru/sql-reference/functions/introspection.md @@ -0,0 +1,303 @@ +# Функции интроспекции {#introspection-functions} + +Функции из этого раздела могут использоваться для интроспекции [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) и [DWARF](https://en.wikipedia.org/wiki/DWARF) в целях профилирования запросов. + +!!! warning "Предупреждение" + Эти функции выполняются медленно и могут приводить к нежелательным последствиям в плане безопасности. + +Для правильной работы функций интроспекции: + +- Установите пакет `clickhouse-common-static-dbg`. + +- Установите настройку [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) в 1. + +Из соображений безопасности данные функции отключены по умолчанию. + +ClickHouse сохраняет отчеты профилировщика в [журнал трассировки](../../operations/system-tables.md#system_tables-trace_log) в системной таблице. Убедитесь, что таблица и профилировщик настроены правильно. + +## addresssToLine {#addresstoline} + +Преобразует адрес виртуальной памяти внутри процесса сервера ClickHouse в имя файла и номер строки в исходном коде ClickHouse. + +Если вы используете официальные пакеты ClickHouse, вам необходимо установить следующий пакеты: `clickhouse-common-static-dbg`. + +**Синтаксис** + +``` sql +addressToLine(address_of_binary_instruction) +``` + +**Параметры** + +- `address_of_binary_instruction` ([Тип UInt64](../../sql-reference/functions/introspection.md))- Адрес инструкции в запущенном процессе. + +**Возвращаемое значение** + +- Имя файла исходного кода и номер строки в этом файле разделяются двоеточием. + + Например, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, где `199` — номер строки. + +- Имя бинарного файла, если функция не может найти отладочную информацию. + +- Пустая строка, если адрес не является допустимым. + +Тип: [String](../../sql-reference/functions/introspection.md). + +**Пример** + +Включение функций самоанализа: + +``` sql +SET allow_introspection_functions=1 +``` + +Выбор первой строки из списка `trace_log` системная таблица: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-19 +event_time: 2019-11-19 18:57:23 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 421b6855-1858-45a5-8f37-f383409d6d72 +trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] +``` + +То `trace` поле содержит трассировку стека в момент выборки. + +Получение имени файла исходного кода и номера строки для одного адреса: + +``` sql +SELECT addressToLine(94784076370703) \G +``` + +``` text +Row 1: +────── +addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +``` + +Применение функции ко всему стектрейсу: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines +FROM system.trace_log +LIMIT 1 +\G +``` + +Функция [arrayMap](higher-order-functions.md#higher_order_functions-array-map) позволяет обрабатывать каждый отдельный элемент массива `trace` с помощью функции `addressToLine`. Результат этой обработки вы видите в виде `trace_source_code_lines` колонки выходных данных. + +``` text +Row 1: +────── +trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so +/usr/lib/debug/usr/bin/clickhouse +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 +/usr/include/c++/9/bits/atomic_base.h:551 +/usr/lib/debug/usr/bin/clickhouse +/lib/x86_64-linux-gnu/libpthread-2.27.so +/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 +``` + +## addressToSymbol {#addresstosymbol} + +Преобразует адрес виртуальной памяти внутри серверного процесса ClickHouse в символ из объектных файлов ClickHouse. + +**Синтаксис** + +``` sql +addressToSymbol(address_of_binary_instruction) +``` + +**Параметры** + +- `address_of_binary_instruction` ([Тип uint64](../../sql-reference/functions/introspection.md)) — Адрес инструкции в запущенном процессе. + +**Возвращаемое значение** + +- Символ из объектных файлов ClickHouse. +- Пустая строка, если адрес не является допустимым. + +Тип: [String](../../sql-reference/functions/introspection.md). + +**Пример** + +Включение функций самоанализа: + +``` sql +SET allow_introspection_functions=1 +``` + +Выбор первой строки из списка `trace_log` системная таблица: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +То `trace` поле содержит трассировку стека в момент выборки. + +Получение символа для одного адреса: + +``` sql +SELECT addressToSymbol(94138803686098) \G +``` + +``` text +Row 1: +────── +addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +``` + +Применение функции ко всей трассировке стека: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols +FROM system.trace_log +LIMIT 1 +\G +``` + +То [arrayMap](higher-order-functions.md#higher_order_functions-array-map) функция позволяет обрабатывать каждый отдельный элемент системы. `trace` массив по типу `addressToSymbols` функция. Результат этой обработки вы видите в виде `trace_symbols` колонка выходных данных. + +``` text +Row 1: +────── +trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE +_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb +_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb +_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE +_ZN2DB27AggregatingBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB28AsynchronousBlockInputStream9calculateEv +_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data +_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E +_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv +_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E +execute_native_thread_routine +start_thread +clone +``` + +## demangle {#demangle} + +Преобразует символ, который вы можете получить с помощью [addressstosymbol](#addresstosymbol) функция имя функции C++. + +**Синтаксис** + +``` sql +demangle(symbol) +``` + +**Параметры** + +- `symbol` ([Строка](../../sql-reference/functions/introspection.md)) - Символ из объектного файла. + +**Возвращаемое значение** + +- Имя функции C++. +- Пустая строка, если символ не является допустимым. + +Тип: [Строка](../../sql-reference/functions/introspection.md). + +**Пример** + +Включение функций самоанализа: + +``` sql +SET allow_introspection_functions=1 +``` + +Выбор первой строки из списка `trace_log` системная таблица: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +То `trace` поле содержит трассировку стека в момент выборки. + +Получение имени функции для одного адреса: + +``` sql +SELECT demangle(addressToSymbol(94138803686098)) \G +``` + +``` text +Row 1: +────── +demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +``` + +Применение функции ко всему стектрейсу: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions +FROM system.trace_log +LIMIT 1 +\G +``` + +Функция [arrayMap](higher-order-functions.md#higher_order_functions-array-map) позволяет обрабатывать каждый отдельный элемент массива `trace` с помощью функции `demangle`. + +``` text +Row 1: +────── +trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const +DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) +DB::AggregatingBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::AsynchronousBlockInputStream::calculate() +std::_Function_handler::_M_invoke(std::_Any_data const&) +ThreadPoolImpl::worker(std::_List_iterator) +ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const +ThreadPoolImpl::worker(std::_List_iterator) +execute_native_thread_routine +start_thread +clone +``` diff --git a/docs/ru/sql-reference/functions/ip-address-functions.md b/docs/ru/sql-reference/functions/ip-address-functions.md new file mode 100644 index 00000000000..6dd5a68adc5 --- /dev/null +++ b/docs/ru/sql-reference/functions/ip-address-functions.md @@ -0,0 +1,241 @@ +# Функции для работы с IP-адресами {#funktsii-dlia-raboty-s-ip-adresami} + +## IPv4NumToString(num) {#ipv4numtostringnum} + +Принимает число типа UInt32. Интерпретирует его, как IPv4-адрес в big endian. Возвращает строку, содержащую соответствующий IPv4-адрес в формате A.B.C.D (числа в десятичной форме через точки). + +## IPv4StringToNum(s) {#ipv4stringtonums} + +Функция, обратная к IPv4NumToString. Если IPv4 адрес в неправильном формате, то возвращает 0. + +## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} + +Похоже на IPv4NumToString, но вместо последнего октета используется xxx. + +Пример: + +``` sql +SELECT + IPv4NumToStringClassC(ClientIP) AS k, + count() AS c +FROM test.hits +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─k──────────────┬─────c─┐ +│ 83.149.9.xxx │ 26238 │ +│ 217.118.81.xxx │ 26074 │ +│ 213.87.129.xxx │ 25481 │ +│ 83.149.8.xxx │ 24984 │ +│ 217.118.83.xxx │ 22797 │ +│ 78.25.120.xxx │ 22354 │ +│ 213.87.131.xxx │ 21285 │ +│ 78.25.121.xxx │ 20887 │ +│ 188.162.65.xxx │ 19694 │ +│ 83.149.48.xxx │ 17406 │ +└────────────────┴───────┘ +``` + +В связи с тем, что использование xxx весьма необычно, это может быть изменено в дальнейшем. Вам не следует полагаться на конкретный вид этого фрагмента. + +### IPv6NumToString(x) {#ipv6numtostringx} + +Принимает значение типа FixedString(16), содержащее IPv6-адрес в бинарном виде. Возвращает строку, содержащую этот адрес в текстовом виде. +IPv6-mapped IPv4 адреса выводится в формате ::ffff:111.222.33.44. Примеры: + +``` sql +SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr +``` + +``` text +┌─addr─────────┐ +│ 2a02:6b8::11 │ +└──────────────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ +│ 2a02:2168:aaa:bbbb::2 │ 24695 │ +│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ +│ 2a02:6b8:0:fff::ff │ 16389 │ +│ 2a01:4f8:111:6666::2 │ 16016 │ +│ 2a02:2168:888:222::1 │ 15896 │ +│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ +│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ +│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ +│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ +│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ +└─────────────────────────────────────────┴───────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)─┬──────c─┐ +│ ::ffff:94.26.111.111 │ 747440 │ +│ ::ffff:37.143.222.4 │ 529483 │ +│ ::ffff:5.166.111.99 │ 317707 │ +│ ::ffff:46.38.11.77 │ 263086 │ +│ ::ffff:79.105.111.111 │ 186611 │ +│ ::ffff:93.92.111.88 │ 176773 │ +│ ::ffff:84.53.111.33 │ 158709 │ +│ ::ffff:217.118.11.22 │ 154004 │ +│ ::ffff:217.118.11.33 │ 148449 │ +│ ::ffff:217.118.11.44 │ 148243 │ +└────────────────────────────┴────────┘ +``` + +## IPv6StringToNum(s) {#ipv6stringtonums} + +Функция, обратная к IPv6NumToString. Если IPv6 адрес в неправильном формате, то возвращает строку из нулевых байт. +HEX может быть в любом регистре. + +## IPv4ToIPv6(x) {#ipv4toipv6x} + +Принимает число типа `UInt32`. Интерпретирует его, как IPv4-адрес в [big endian](https://en.wikipedia.org/wiki/Endianness). Возвращает значение `FixedString(16)`, содержащее адрес IPv6 в двоичном формате. Примеры: + +``` sql +SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr +``` + +``` text +┌─addr───────────────┐ +│ ::ffff:192.168.0.1 │ +└────────────────────┘ +``` + +## cutIPv6(x, bitsToCutForIPv6, bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} + +Принимает значение типа FixedString(16), содержащее IPv6-адрес в бинарном виде. Возвращает строку, содержащую адрес из указанного количества битов, удаленных в текстовом формате. Например: + +``` sql +WITH + IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, + IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 +SELECT + cutIPv6(ipv6, 2, 0), + cutIPv6(ipv4, 0, 2) +``` + +``` text +┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ +│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ +└─────────────────────────────────────┴─────────────────────┘ +``` + +## IPv4CIDRToRange(ipv4, Cidr), {#ipv4cidrtorangeipv4-cidr} + +Принимает на вход IPv4 и значение `UInt8`, содержащее [CIDR](https://ru.wikipedia.org/wiki/Бесклассовая_адресация). Возвращает кортеж с двумя IPv4, содержащими нижний и более высокий диапазон подсети. + +``` sql +SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) +``` + +``` text +┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ +│ ('192.168.0.0','192.168.255.255') │ +└────────────────────────────────────────────┘ +``` + +## IPv6CIDRToRange(ipv6, Cidr), {#ipv6cidrtorangeipv6-cidr} + +Принимает на вход IPv6 и значение `UInt8`, содержащее CIDR. Возвращает кортеж с двумя IPv6, содержащими нижний и более высокий диапазон подсети. + +``` sql +SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32) +``` + +``` text +┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ +│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ +└────────────────────────────────────────────────────────────────────────┘ +``` + +## toIPv4(string) {#toipv4string} + +Псевдоним функции `IPv4StringToNum()` которая принимает строку с адресом IPv4 и возвращает значение типа [IPv4](../../sql-reference/functions/ip-address-functions.md), которое равно значению, возвращаемому функцией `IPv4StringToNum()`. + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + toTypeName(IPv4StringToNum(IPv4_string)), + toTypeName(toIPv4(IPv4_string)) +``` + +``` text +┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ +│ UInt32 │ IPv4 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + hex(IPv4StringToNum(IPv4_string)), + hex(toIPv4(IPv4_string)) +``` + +``` text +┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ +│ ABE1822D │ ABE1822D │ +└───────────────────────────────────┴──────────────────────────┘ +``` + +## toIPv6(string) {#toipv6string} + +Псевдоним функции `IPv6StringToNum()` которая принимает строку с адресом IPv6 и возвращает значение типа [IPv6](../../sql-reference/functions/ip-address-functions.md), которое равно значению, возвращаемому функцией `IPv6StringToNum()`. + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + toTypeName(IPv6StringToNum(IPv6_string)), + toTypeName(toIPv6(IPv6_string)) +``` + +``` text +┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ +│ FixedString(16) │ IPv6 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + hex(IPv6StringToNum(IPv6_string)), + hex(toIPv6(IPv6_string)) +``` + +``` text +┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ +│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ +└───────────────────────────────────┴──────────────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/ip_address_functions/) diff --git a/docs/ru/sql-reference/functions/json-functions.md b/docs/ru/sql-reference/functions/json-functions.md new file mode 100644 index 00000000000..5fd93f16a5c --- /dev/null +++ b/docs/ru/sql-reference/functions/json-functions.md @@ -0,0 +1,224 @@ +# Функции для работы с JSON {#funktsii-dlia-raboty-s-json} + +В Яндекс.Метрике пользователями передаётся JSON в качестве параметров визитов. Для работы с таким JSON-ом, реализованы некоторые функции. (Хотя в большинстве случаев, JSON-ы дополнительно обрабатываются заранее, и полученные значения кладутся в отдельные столбцы в уже обработанном виде.) Все эти функции исходят из сильных допущений о том, каким может быть JSON, и при этом стараются почти ничего не делать. + +Делаются следующие допущения: + +1. Имя поля (аргумент функции) должно быть константой; +2. Считается, что имя поля в JSON-е закодировано некоторым каноническим образом. Например, `visitParamHas('{"abc":"def"}', 'abc') = 1`, но `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` +3. Поля ищутся на любом уровне вложенности, без разбора. Если есть несколько подходящих полей - берётся первое. +4. В JSON-е нет пробельных символов вне строковых литералов. + +## visitParamHas(params, name) {#visitparamhasparams-name} + +Проверить наличие поля с именем name. + +## visitParamExtractUInt(params, name) {#visitparamextractuintparams-name} + +Распарсить UInt64 из значения поля с именем name. Если поле строковое - попытаться распарсить число из начала строки. Если такого поля нет, или если оно есть, но содержит не число, то вернуть 0. + +## visitParamExtractInt(params, name) {#visitparamextractintparams-name} + +Аналогично для Int64. + +## visitParamExtractFloat(params, name) {#visitparamextractfloatparams-name} + +Аналогично для Float64. + +## visitParamExtractBool(params, name) {#visitparamextractboolparams-name} + +Распарсить значение true/false. Результат - UInt8. + +## visitParamExtractRaw(params, name) {#visitparamextractrawparams-name} + +Вернуть значение поля, включая разделители. + +Примеры: + +``` sql +visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' +visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' +``` + +## visitParamExtractString(params, name) {#visitparamextractstringparams-name} + +Распарсить строку в двойных кавычках. У значения убирается экранирование. Если убрать экранированные символы не удалось, то возвращается пустая строка. + +Примеры: + +``` sql +visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' +visitParamExtractString('{"abc":"hello}', 'abc') = '' +``` + +На данный момент, не поддерживаются записанные в формате `\uXXXX\uYYYY` кодовые точки не из basic multilingual plane (они переводятся не в UTF-8, а в CESU-8). + +Следующие функции используют [simdjson](https://github.com/lemire/simdjson) который разработан под более сложные требования для разбора JSON. Упомянутое выше предположение 2 по-прежнему применимо. + +## isValidJSON(json) {#isvalidjsonjson} + +Проверяет, является ли переданная строка валидным json значением. + +Примеры: + +``` sql +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} + +Если значение существует в документе JSON, то возвращается `1`. + +Если значение не существует, то возвращается `0`. + +Примеры: + +``` sql +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 +``` + +`indices_or_keys` — это список из нуля или более аргументов каждый из них может быть либо строкой либо целым числом. + +- Строка — это доступ к объекту по ключу. +- Положительное целое число — это доступ к n-му члену/ключу с начала. +- Отрицательное целое число — это доступ к n-му члену/ключу с конца. + +Адресация элементов по индексу начинается с 1, следовательно элемент 0 не существует. + +Вы можете использовать целые числа, чтобы адресовать как массивы JSON, так и JSON-объекты. + +Примеры: + +``` sql +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' +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} + +Возвращает длину массива JSON или объекта JSON. + +Если значение не существует или имеет неверный тип, то возвращается `0`. + +Примеры: + +``` sql +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} + +Возвращает тип значения JSON. + +Если значение не существует, то возвращается `Null`. + +Примеры: + +``` sql +SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' +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} + +## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} + +## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} + +## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} + +Парсит JSON и извлекает значение. Эти функции аналогичны функциям `visitParam`. + +Если значение не существует или имеет неверный тип, то возвращается `0`. + +Примеры: + +``` sql +SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 +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} + +Парсит JSON и извлекает строку. Эта функция аналогична функции `visitParamExtractString`. + +Если значение не существует или имеет неверный тип, то возвращается пустая строка. + +У значения убирается экранирование. Если убрать экранированные символы не удалось, то возвращается пустая строка. + +Примеры: + +``` sql +SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' +SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' +SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' +``` + +## JSONExtract(json\[, indices\_or\_keys…\], Return\_type) {#jsonextractjson-indices-or-keys-return-type} + +Парсит JSON и извлекает значение с заданным типом данных. + +Это обобщение предыдущих функций `JSONExtract`. +Это означает +`JSONExtract(..., 'String')` выдает такой же результат, как `JSONExtractString()`, +`JSONExtract(..., 'Float64')` выдает такой же результат, как `JSONExtractFloat()`. + +Примеры: + +``` sql +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL +SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 +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} + +Разбор пар ключ-значение из JSON, где значение имеет тип данных ClickHouse. + +Пример: + +``` sql +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} + +Возвращает часть JSON в виде строки, содержащей неразобранную подстроку. + +Если значение не существует, то возвращается пустая строка. + +Пример: + +``` sql +SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' +``` + +## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} + +Возвращает массив из элементов JSON массива, каждый из которых представлен в виде строки с неразобранными подстроками из JSON. + +Если значение не существует или не является массивом, то возвращается пустой массив. + +Пример: + +``` sql +SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/json_functions/) diff --git a/docs/ru/sql_reference/functions/logical_functions.md b/docs/ru/sql-reference/functions/logical-functions.md similarity index 100% rename from docs/ru/sql_reference/functions/logical_functions.md rename to docs/ru/sql-reference/functions/logical-functions.md diff --git a/docs/ru/sql-reference/functions/machine-learning-functions.md b/docs/ru/sql-reference/functions/machine-learning-functions.md new file mode 100644 index 00000000000..11d6c0f7230 --- /dev/null +++ b/docs/ru/sql-reference/functions/machine-learning-functions.md @@ -0,0 +1,13 @@ +# Функции машинного обучения {#funktsii-mashinnogo-obucheniia} + +## evalMLMethod (prediction) {#machine_learning_methods-evalmlmethod} + +Предсказание с использованием подобранных регрессионных моделей. + +### Stochastic Linear Regression {#stochastic-linear-regression} + +Агрегатная функция [stochasticLinearRegression](../../sql-reference/functions/machine-learning-functions.md#agg_functions-stochasticlinearregression) реализует стохастический градиентный спуск, использую линейную модель и функцию потерь MSE. + +### Stochastic Logistic Regression {#stochastic-logistic-regression} + +Агрегатная функция [stochasticLogisticRegression](../../sql-reference/functions/machine-learning-functions.md#agg_functions-stochasticlogisticregression) реализует стохастический градиентный спуск для задачи бинарной классификации. diff --git a/docs/ru/sql_reference/functions/math_functions.md b/docs/ru/sql-reference/functions/math-functions.md similarity index 100% rename from docs/ru/sql_reference/functions/math_functions.md rename to docs/ru/sql-reference/functions/math-functions.md diff --git a/docs/ru/sql-reference/functions/other-functions.md b/docs/ru/sql-reference/functions/other-functions.md new file mode 100644 index 00000000000..bd2938bd50f --- /dev/null +++ b/docs/ru/sql-reference/functions/other-functions.md @@ -0,0 +1,1087 @@ +# Прочие функции {#prochie-funktsii} + +## hostName() {#hostname} + +Возвращает строку - имя хоста, на котором эта функция была выполнена. При распределённой обработке запроса, это будет имя хоста удалённого сервера, если функция выполняется на удалённом сервере. + +## getMacro {#getmacro} + +Возвращает именованное значение из секции [macros](../../operations/server-configuration-parameters/settings.md#macros) конфигурации сервера. + +**Синтаксис** + +```sql +getMacro(name); +``` + +**Параметры** + +- `name` — Имя, которое необходимо получить из секции `macros`. [String](../../sql-reference/data-types/string.md#string). + +**Возвращаемое значение** + +- Значение по указанному имени. + +Тип: [String](../../sql-reference/data-types/string.md). + +**Пример** + +Пример секции `macros` в конфигурационном файле сервера: + +```xml + + Value + +``` + +Запрос: + +```sql +SELECT getMacro('test'); +``` + +Результат: + +```text +┌─getMacro('test')─┐ +│ Value │ +└──────────────────┘ +``` + +Альтернативный способ получения значения: + +```sql +SELECT * FROM system.macros +WHERE macro = 'test' +``` + +```text +┌─macro─┬─substitution─┐ +│ test │ Value │ +└───────┴──────────────┘ +``` + + +## FQDN {#fqdn} + +Возвращает полное имя домена. + +**Синтаксис** + +``` sql +fqdn(); +``` + +Эта функция регистронезависимая. + +**Возвращаемое значение** + +- Полное имя домена. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT FQDN(); +``` + +Ответ: + +``` text +┌─FQDN()──────────────────────────┐ +│ clickhouse.ru-central1.internal │ +└─────────────────────────────────┘ +``` + +## basename {#basename} + +Извлекает конечную часть строки после последнего слэша или бэкслэша. Функция часто используется для извлечения имени файла из пути. + +``` sql +basename( expr ) +``` + +**Параметры** + +- `expr` — Выражение, возвращающее значение типа [String](../../sql-reference/functions/other-functions.md). В результирующем значении все бэкслэши должны быть экранированы. + +**Возвращаемое значение** + +Строка, содержащая: + +- Конечную часть строки после последнего слэша или бэкслэша. + + Если входная строка содержит путь, заканчивающийся слэшем или бэкслэшем, например, `/` или `с:\`, функция возвращает пустую строку. + +- Исходная строка, если нет слэша или бэкслэша. + +**Пример** + +``` sql +SELECT 'some/long/path/to/file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some\\long\\path\\to\\file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some-file-name' AS a, basename(a) +``` + +``` text +┌─a──────────────┬─basename('some-file-name')─┐ +│ some-file-name │ some-file-name │ +└────────────────┴────────────────────────────┘ +``` + +## visibleWidth(x) {#visiblewidthx} + +Вычисляет приблизительную ширину при выводе значения в текстовом (tab-separated) виде на консоль. +Функция используется системой для реализации Pretty форматов. + +`NULL` представляется как строка, соответствующая отображению `NULL` в форматах `Pretty`. + +``` sql +SELECT visibleWidth(NULL) +``` + +``` text +┌─visibleWidth(NULL)─┐ +│ 4 │ +└────────────────────┘ +``` + +## toTypeName(x) {#totypenamex} + +Возвращает строку, содержащую имя типа переданного аргумента. + +Если на вход функции передать `NULL`, то она вернёт тип `Nullable(Nothing)`, что соответствует внутреннему представлению `NULL` в ClickHouse. + +## blockSize() {#function-blocksize} + +Получить размер блока. +В ClickHouse выполнение запроса всегда идёт по блокам (наборам кусочков столбцов). Функция позволяет получить размер блока, для которого её вызвали. + +## materialize(x) {#materializex} + +Превращает константу в полноценный столбец, содержащий только одно значение. +В ClickHouse полноценные столбцы и константы представлены в памяти по-разному. Функции по-разному работают для аргументов-констант и обычных аргументов (выполняется разный код), хотя результат почти всегда должен быть одинаковым. Эта функция предназначена для отладки такого поведения. + +## ignore(…) {#ignore} + +Принимает любые аргументы, в т.ч. `NULL`, всегда возвращает 0. +При этом, аргумент всё равно вычисляется. Это может использоваться для бенчмарков. + +## sleep(seconds) {#sleepseconds} + +Спит seconds секунд на каждый блок данных. Можно указать как целое число, так и число с плавающей запятой. + +## currentDatabase() {#currentdatabase} + +Возвращает имя текущей базы данных. +Эта функция может использоваться в параметрах движка таблицы в запросе CREATE TABLE там, где нужно указать базу данных. + +## currentUser() {#other-function-currentuser} + +Возвращает логин текущего пользователя. При распределенном запросе, возвращается имя пользователя, инициировавшего запрос. + +``` sql +SELECT currentUser(); +``` + +Алиас: `user()`, `USER()`. + +**Возвращаемые значения** + +- Логин текущего пользователя. +- При распределенном запросе — логин пользователя, инициировавшего запрос. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT currentUser(); +``` + +Ответ: + +``` text +┌─currentUser()─┐ +│ default │ +└───────────────┘ +``` + +## isFinite(x) {#isfinitex} + +Принимает Float32 или Float64 и возвращает UInt8, равный 1, если аргумент не бесконечный и не NaN, иначе 0. + +## ifNotFinite {#ifnotfinite} + +Проверяет, является ли значение дробного числа с плавающей точкой конечным. + +**Синтаксис** + + ifNotFinite(x,y) + +**Параметры** + +- `x` — Значение, которое нужно проверить на бесконечность. Тип: [Float\*](../../sql-reference/functions/other-functions.md). +- `y` — Запасное значение. Тип: [Float\*](../../sql-reference/functions/other-functions.md). + +**Возвращаемые значения** + +- `x`, если `x` принимает конечное значение. +- `y`, если`x` принимает не конечное значение. + +**Пример** + +Запрос: + + SELECT 1/0 as infimum, ifNotFinite(infimum,42) + +Результат: + + ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ + │ inf │ 42 │ + └─────────┴───────────────────────────────┘ + +Аналогичный результат можно получить с помощью [тернарного оператора](conditional-functions.md#ternary-operator) `isFinite(x) ? x : y`. + +## isInfinite(x) {#isinfinitex} + +Принимает Float32 или Float64 и возвращает UInt8, равный 1, если аргумент бесконечный, иначе 0. Отметим, что в случае NaN возвращается 0. + +## isNaN(x) {#isnanx} + +Принимает Float32 или Float64 и возвращает UInt8, равный 1, если аргумент является NaN, иначе 0. + +## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} + +Принимает константные строки - имя базы данных, имя таблицы и название столбца. Возвращает константное выражение типа UInt8, равное 1, +если есть столбец, иначе 0. Если задан параметр hostname, проверка будет выполнена на удалённом сервере. +Функция кидает исключение, если таблица не существует. +Для элементов вложенной структуры данных функция проверяет существование столбца. Для самой же вложенной структуры данных функция возвращает 0. + +## bar {#function-bar} + +Позволяет построить unicode-art диаграмму. + +`bar(x, min, max, width)` рисует полосу ширины пропорциональной `(x - min)` и равной `width` символов при `x = max`. + +Параметры: + +- `x` — Величина для отображения. +- `min, max` — Целочисленные константы, значение должно помещаться в `Int64`. +- `width` — Константа, положительное число, может быть дробным. + +Полоса рисуется с точностью до одной восьмой символа. + +Пример: + +``` sql +SELECT + toHour(EventTime) AS h, + count() AS c, + bar(c, 0, 600000, 20) AS bar +FROM test.hits +GROUP BY h +ORDER BY h ASC +``` + +``` text +┌──h─┬──────c─┬─bar────────────────┐ +│ 0 │ 292907 │ █████████▋ │ +│ 1 │ 180563 │ ██████ │ +│ 2 │ 114861 │ ███▋ │ +│ 3 │ 85069 │ ██▋ │ +│ 4 │ 68543 │ ██▎ │ +│ 5 │ 78116 │ ██▌ │ +│ 6 │ 113474 │ ███▋ │ +│ 7 │ 170678 │ █████▋ │ +│ 8 │ 278380 │ █████████▎ │ +│ 9 │ 391053 │ █████████████ │ +│ 10 │ 457681 │ ███████████████▎ │ +│ 11 │ 493667 │ ████████████████▍ │ +│ 12 │ 509641 │ ████████████████▊ │ +│ 13 │ 522947 │ █████████████████▍ │ +│ 14 │ 539954 │ █████████████████▊ │ +│ 15 │ 528460 │ █████████████████▌ │ +│ 16 │ 539201 │ █████████████████▊ │ +│ 17 │ 523539 │ █████████████████▍ │ +│ 18 │ 506467 │ ████████████████▊ │ +│ 19 │ 520915 │ █████████████████▎ │ +│ 20 │ 521665 │ █████████████████▍ │ +│ 21 │ 542078 │ ██████████████████ │ +│ 22 │ 493642 │ ████████████████▍ │ +│ 23 │ 400397 │ █████████████▎ │ +└────┴────────┴────────────────────┘ +``` + +## transform {#transform} + +Преобразовать значение согласно явно указанному отображению одних элементов на другие. +Имеется два варианта функции: + +### transform(x, array\_from, array\_to, default) {#transformx-array-from-array-to-default} + +`x` - что преобразовывать. + +`array_from` - константный массив значений для преобразования. + +`array_to` - константный массив значений, в которые должны быть преобразованы значения из from. + +`default` - какое значение использовать, если x не равен ни одному из значений во from. + +`array_from` и `array_to` - массивы одинаковых размеров. + +Типы: + +`transform(T, Array(T), Array(U), U) -> U` + +`T` и `U` - могут быть числовыми, строковыми, или Date или DateTime типами. +При этом, где обозначена одна и та же буква (T или U), могут быть, в случае числовых типов, не совпадающие типы, а типы, для которых есть общий тип. +Например, первый аргумент может иметь тип Int64, а второй - Array(UInt16). + +Если значение x равно одному из элементов массива array\_from, то возвращает соответствующий (такой же по номеру) элемент массива array\_to; иначе возвращает default. Если имеется несколько совпадающих элементов в array\_from, то возвращает какой-нибудь из соответствующих. + +Пример: + +``` sql +SELECT + transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, + count() AS c +FROM test.hits +WHERE SearchEngineID != 0 +GROUP BY title +ORDER BY c DESC +``` + +``` text +┌─title─────┬──────c─┐ +│ Yandex │ 498635 │ +│ Google │ 229872 │ +│ Other │ 104472 │ +└───────────┴────────┘ +``` + +### transform(x, array\_from, array\_to) {#transformx-array-from-array-to} + +Отличается от первого варианта отсутствующим аргументом default. +Если значение x равно одному из элементов массива array\_from, то возвращает соответствующий (такой же по номеру) элемент массива array\_to; иначе возвращает x. + +Типы: + +`transform(T, Array(T), Array(T)) -> T` + +Пример: + +``` sql +SELECT + transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, + count() AS c +FROM test.hits +GROUP BY domain(Referer) +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +┌─s──────────────┬───────c─┐ +│ │ 2906259 │ +│ www.yandex │ 867767 │ +│ ███████.ru │ 313599 │ +│ mail.yandex.ru │ 107147 │ +│ ██████.ru │ 100355 │ +│ █████████.ru │ 65040 │ +│ news.yandex.ru │ 64515 │ +│ ██████.net │ 59141 │ +│ example.com │ 57316 │ +└────────────────┴─────────┘ +``` + +## formatReadableSize(x) {#formatreadablesizex} + +Принимает размер (число байт). Возвращает округленный размер с суффиксом (KiB, MiB и т.д.) в виде строки. + +Пример: + +``` sql +SELECT + arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, + formatReadableSize(filesize_bytes) AS filesize +``` + +``` text +┌─filesize_bytes─┬─filesize───┐ +│ 1 │ 1.00 B │ +│ 1024 │ 1.00 KiB │ +│ 1048576 │ 1.00 MiB │ +│ 192851925 │ 183.92 MiB │ +└────────────────┴────────────┘ +``` + +## least(a, b) {#leasta-b} + +Возвращает наименьшее значение из a и b. + +## greatest(a, b) {#greatesta-b} + +Возвращает наибольшее значение из a и b. + +## uptime() {#uptime} + +Возвращает аптайм сервера в секундах. + +## version() {#version} + +Возвращает версию сервера в виде строки. + +## rowNumberInBlock {#function-rownumberinblock} + +Возвращает порядковый номер строки в блоке данных. Для каждого блока данных нумерация начинается с 0. + +## rowNumberInAllBlocks() {#rownumberinallblocks} + +Возвращает порядковый номер строки в блоке данных. Функция учитывает только задействованные блоки данных. + +## neighbor {#neighbor} + +Функция позволяет получить доступ к значению в колонке `column`, находящемуся на смещении `offset` относительно текущей строки. Является частичной реализацией [оконных функций](https://en.wikipedia.org/wiki/SQL_window_function) `LEAD()` и `LAG()`. + +**Синтаксис** + +``` sql +neighbor(column, offset[, default_value]) +``` + +Результат функции зависит от затронутых блоков данных и порядка данных в блоке. Если сделать подзапрос с ORDER BY и вызывать функцию извне подзапроса, можно будет получить ожидаемый результат. + +**Параметры** + +- `column` — Имя столбца или скалярное выражение. +- `offset` - Смещение от текущей строки `column`. [Int64](../../sql-reference/functions/other-functions.md). +- `default_value` - Опциональный параметр. Значение, которое будет возвращено, если смещение выходит за пределы блока данных. + +**Возвращаемое значение** + +- Значение `column` в смещении от текущей строки, если значение `offset` не выходит за пределы блока. +- Значение по умолчанию для `column`, если значение `offset` выходит за пределы блока данных. Если передан параметр `default_value`, то значение берется из него. + +Тип: зависит от данных в `column` или переданного значения по умолчанию в `default_value`. + +**Пример** + +Запрос: + +``` sql +SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; +``` + +Ответ: + +``` text +┌─number─┬─neighbor(number, 2)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 0 │ +│ 9 │ 0 │ +└────────┴─────────────────────┘ +``` + +Запрос: + +``` sql +SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; +``` + +Ответ: + +``` text +┌─number─┬─neighbor(number, 2, 999)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 999 │ +│ 9 │ 999 │ +└────────┴──────────────────────────┘ +``` + +Эта функция может использоваться для оценки year-over-year значение показателя: + +Запрос: + +``` sql +WITH toDate('2018-01-01') AS start_date +SELECT + toStartOfMonth(start_date + (number * 32)) AS month, + toInt32(month) % 100 AS money, + neighbor(money, -12) AS prev_year, + round(prev_year / money, 2) AS year_over_year +FROM numbers(16) +``` + +Ответ: + +``` text +┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ +│ 2018-01-01 │ 32 │ 0 │ 0 │ +│ 2018-02-01 │ 63 │ 0 │ 0 │ +│ 2018-03-01 │ 91 │ 0 │ 0 │ +│ 2018-04-01 │ 22 │ 0 │ 0 │ +│ 2018-05-01 │ 52 │ 0 │ 0 │ +│ 2018-06-01 │ 83 │ 0 │ 0 │ +│ 2018-07-01 │ 13 │ 0 │ 0 │ +│ 2018-08-01 │ 44 │ 0 │ 0 │ +│ 2018-09-01 │ 75 │ 0 │ 0 │ +│ 2018-10-01 │ 5 │ 0 │ 0 │ +│ 2018-11-01 │ 36 │ 0 │ 0 │ +│ 2018-12-01 │ 66 │ 0 │ 0 │ +│ 2019-01-01 │ 97 │ 32 │ 0.33 │ +│ 2019-02-01 │ 28 │ 63 │ 2.25 │ +│ 2019-03-01 │ 56 │ 91 │ 1.62 │ +│ 2019-04-01 │ 87 │ 22 │ 0.25 │ +└────────────┴───────┴───────────┴────────────────┘ +``` + +## runningDifference(x) {#runningdifferencex} + +Считает разницу между последовательными значениями строк в блоке данных. +Возвращает 0 для первой строки и разницу с предыдущей строкой для каждой последующей строки. + +Результат функции зависит от затронутых блоков данных и порядка данных в блоке. +Если сделать подзапрос с ORDER BY и вызывать функцию извне подзапроса, можно будет получить ожидаемый результат. + +Пример: + +``` sql +SELECT + EventID, + EventTime, + runningDifference(EventTime) AS delta +FROM +( + SELECT + EventID, + EventTime + FROM events + WHERE EventDate = '2016-11-24' + ORDER BY EventTime ASC + LIMIT 5 +) +``` + +``` text +┌─EventID─┬───────────EventTime─┬─delta─┐ +│ 1106 │ 2016-11-24 00:00:04 │ 0 │ +│ 1107 │ 2016-11-24 00:00:05 │ 1 │ +│ 1108 │ 2016-11-24 00:00:05 │ 0 │ +│ 1109 │ 2016-11-24 00:00:09 │ 4 │ +│ 1110 │ 2016-11-24 00:00:10 │ 1 │ +└─────────┴─────────────────────┴───────┘ +``` + +Обратите внимание — размер блока влияет на результат. С каждым новым блоком состояние `runningDifference` сбрасывается. + +``` sql +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +┌─number─┬─diff─┐ +│ 65536 │ 0 │ +└────────┴──────┘ +``` + + set max_block_size=100000 -- по умолчанию 65536! + + SELECT + number, + runningDifference(number + 1) AS diff + FROM numbers(100000) + WHERE diff != 1 + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +``` + +## runningDifferenceStartingWithFirstValue {#runningdifferencestartingwithfirstvalue} + +То же, что и \[runningDifference\] (./other\_functions.md \# other\_functions-runningdifference), но в первой строке возвращается значение первой строки, а не ноль. + +## MACNumToString(num) {#macnumtostringnum} + +Принимает число типа UInt64. Интерпретирует его, как MAC-адрес в big endian. Возвращает строку, содержащую соответствующий MAC-адрес в формате AA:BB:CC:DD:EE:FF (числа в шестнадцатеричной форме через двоеточие). + +## MACStringToNum(s) {#macstringtonums} + +Функция, обратная к MACNumToString. Если MAC адрес в неправильном формате, то возвращает 0. + +## MACStringToOUI(s) {#macstringtoouis} + +Принимает MAC адрес в формате AA:BB:CC:DD:EE:FF (числа в шестнадцатеричной форме через двоеточие). Возвращает первые три октета как число в формате UInt64. Если MAC адрес в неправильном формате, то возвращает 0. + +## getSizeOfEnumType {#getsizeofenumtype} + +Возвращает количество полей в [Enum](../../sql-reference/functions/other-functions.md). + +``` sql +getSizeOfEnumType(value) +``` + +**Параметры** + +- `value` — Значение типа `Enum`. + +**Возвращаемые значения** + +- Количество полей входного значения типа `Enum`. +- Исключение, если тип не `Enum`. + +**Пример** + +``` sql +SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## toColumnTypeName {#tocolumntypename} + +Возвращает имя класса, которым представлен тип данных столбца в оперативной памяти. + +``` sql +toColumnTypeName(value) +``` + +**Параметры** + +- `value` — Значение произвольного типа. + +**Возвращаемые значения** + +- Строка с именем класса, который используется для представления типа данных `value` в оперативной памяти. + +**Пример разницы между `toTypeName` и `toColumnTypeName`** + +``` sql +SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime │ +└─────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ Const(UInt32) │ +└───────────────────────────────────────────────────────────┘ +``` + +В примере видно, что тип данных `DateTime` хранится в памяти как `Const(UInt32)`. + +## dumpColumnStructure {#dumpcolumnstructure} + +Выводит развернутое описание структур данных в оперативной памяти + +``` sql +dumpColumnStructure(value) +``` + +**Параметры** + +- `value` — Значение произвольного типа. + +**Возвращаемые значения** + +- Строка с описанием структуры, которая используется для представления типа данных `value` в оперативной памяти. + +**Пример** + +``` sql +SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) +``` + +``` text +┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime, Const(size = 1, UInt32(size = 1)) │ +└──────────────────────────────────────────────────────────────┘ +``` + +## defaultValueOfArgumentType {#defaultvalueofargumenttype} + +Выводит значение по умолчанию для типа данных. + +Не учитывает значения по умолчанию для столбцов, заданные пользователем. + +``` sql +defaultValueOfArgumentType(expression) +``` + +**Параметры** + +- `expression` — Значение произвольного типа или выражение, результатом которого является значение произвольного типа. + +**Возвращаемые значения** + +- `0` для чисел; +- Пустая строка для строк; +- `ᴺᵁᴸᴸ` для [Nullable](../../sql-reference/functions/other-functions.md). + +**Пример** + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ +│ 0 │ +└─────────────────────────────────────────────┘ +``` + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ +│ ᴺᵁᴸᴸ │ +└───────────────────────────────────────────────────────┘ +``` + +## replicate {#other-functions-replicate} + +Создает массив, заполненный одним значением. + +Используется для внутренней реализации [arrayJoin](array-join.md#functions_arrayjoin). + +``` sql +SELECT replicate(x, arr); +``` + +**Параметры** + +- `arr` — Исходный массив. ClickHouse создаёт новый массив такой же длины как исходный и заполняет его значением `x`. +- `x` — Значение, которым будет заполнен результирующий массив. + +**Возвращаемое значение** + +Массив, заполненный значением `x`. + +Тип: `Array`. + +**Пример** + +Запрос: + +``` sql +SELECT replicate(1, ['a', 'b', 'c']); +``` + +Ответ: + +``` text +┌─replicate(1, ['a', 'b', 'c'])─┐ +│ [1,1,1] │ +└───────────────────────────────┘ +``` + +## filesystemAvailable {#filesystemavailable} + +Возвращает объём доступного для записи данных места на файловой системе. Он всегда меньше общего свободного места ([filesystemFree](#filesystemfree)), потому что некоторое пространство зарезервировано для нужд операционной системы. + +**Синтаксис** + +``` sql +filesystemAvailable() +``` + +**Возвращаемое значение** + +- Объём доступного для записи данных места в байтах. + +Тип: [UInt64](../../sql-reference/functions/other-functions.md). + +**Пример** + +Запрос: + +``` sql +SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; +``` + +Ответ: + +``` text +┌─Available space─┬─Type───┐ +│ 30.75 GiB │ UInt64 │ +└─────────────────┴────────┘ +``` + +## filesystemFree {#filesystemfree} + +Возвращает объём свободного места на файловой системе. Смотрите также `filesystemAvailable`. + +**Синтаксис** + +``` sql +filesystemFree() +``` + +**Возвращаемое значение** + +- Объем свободного места в байтах. + +Тип: [UInt64](../../sql-reference/functions/other-functions.md). + +**Пример** + +Запрос: + +``` sql +SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; +``` + +Ответ: + +``` text +┌─Free space─┬─Type───┐ +│ 32.39 GiB │ UInt64 │ +└────────────┴────────┘ +``` + +## filesystemCapacity {#filesystemcapacity} + +Возвращает информацию о ёмкости файловой системы в байтах. Для оценки должен быть настроен [путь](../../sql-reference/functions/other-functions.md#server_configuration_parameters-path) к каталогу с данными. + +**Синтаксис** + +``` sql +filesystemCapacity() +``` + +**Возвращаемое значение** + +- Информация о ёмкости файловой системы в байтах. + +Тип: [UInt64](../../sql-reference/functions/other-functions.md). + +**Пример** + +Запрос: + +``` sql +SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" +``` + +Ответ: + +``` text +┌─Capacity──┬─Type───┐ +│ 39.32 GiB │ UInt64 │ +└───────────┴────────┘ +``` + +## finalizeAggregation {#function-finalizeaggregation} + +Принимает состояние агрегатной функции. Возвращает результат агрегирования. + +## runningAccumulate {#function-runningaccumulate} + +Принимает на вход состояния агрегатной функции и возвращает столбец со значениями, которые представляют собой результат мёржа этих состояний для выборки строк из блока от первой до текущей строки. Например, принимает состояние агрегатной функции (например, `runningAccumulate(uniqState(UserID))`), и для каждой строки блока возвращает результат агрегатной функции после мёржа состояний функции для всех предыдущих строк и текущей. Таким образом, результат зависит от разбиения данных по блокам и от порядка данных в блоке. + +## joinGet {#joinget} + +Функция позволяет извлекать данные из таблицы таким же образом как из [словаря](../../sql-reference/functions/other-functions.md). + +Получает данные из таблиц [Join](../../sql-reference/functions/other-functions.md#creating-a-table) по ключу. + +Поддерживаются только таблицы, созданные с `ENGINE = Join(ANY, LEFT, )`. + +**Синтаксис** + +``` sql +joinGet(join_storage_table_name, `value_column`, join_keys) +``` + +**Параметры** + +- `join_storage_table_name` — [идентификатор](../syntax.md#syntax-identifiers), который указывает, откуда производится выборка данных. Поиск по идентификатору осуществляется в базе данных по умолчанию (см. конфигурацию `default_database`). Чтобы переопределить базу данных по умолчанию, используйте команду `USE db_name`, или укажите базу данных и таблицу через разделитель `db_name.db_table`, см. пример. +- `value_column` — столбец, из которого нужно произвести выборку данных. +- `join_keys` — список ключей, по которым производится выборка данных. + +**Возвращаемое значение** + +Возвращает значение по списку ключей. + +Если значения не существует в исходной таблице, вернется `0` или `null` в соответствии с настройками [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls). + +Подробнее о настройке `join_use_nulls` в [операциях Join](../../sql-reference/functions/other-functions.md). + +**Пример** + +Входная таблица: + +``` sql +CREATE DATABASE db_test +CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 +INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) +``` + +``` text +┌─id─┬─val─┐ +│ 4 │ 13 │ +│ 2 │ 12 │ +│ 1 │ 11 │ +└────┴─────┘ +``` + +Запрос: + +``` sql +SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 +``` + +Результат: + +``` text +┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ +│ 0 │ +│ 11 │ +│ 12 │ +│ 0 │ +└──────────────────────────────────────────────────┘ +``` + +## modelEvaluate(model\_name, …) {#function-modelevaluate} + +Оценивает внешнюю модель. + +Принимает на вход имя и аргументы модели. Возвращает Float64. + +## throwIf(x\[, custom\_message\]) {#throwifx-custom-message} + +Бросает исключение, если аргумент не равен нулю. +custom\_message - необязательный параметр, константная строка, задает текст сообщения об ошибке. + +``` sql +SELECT throwIf(number = 3, 'Too many') FROM numbers(10); +``` + +``` text +↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): +Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. +``` + +## identity {#identity} + +Возвращает свой аргумент. Используется для отладки и тестирования, позволяет отменить использование индекса, и получить результат и производительность полного сканирования таблицы. Это работает, потому что оптимизатор запросов не может «заглянуть» внутрь функции `identity`. + +**Синтаксис** + +``` sql +identity(x) +``` + +**Пример** + +Query: + +``` sql +SELECT identity(42) +``` + +Результат: + +``` text +┌─identity(42)─┐ +│ 42 │ +└──────────────┘ +``` + +## randomPrintableASCII {#randomascii} + +Генерирует строку со случайным набором печатных символов [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters). + +**Синтаксис** + +``` sql +randomPrintableASCII(length) +``` + +**Параметры** + +- `length` — Длина результирующей строки. Положительное целое число. + + Если передать `length < 0`, то поведение функции не определено. + +**Возвращаемое значение** + +- Строка со случайным набором печатных символов [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters). + +Тип: [String](../../sql-reference/functions/other-functions.md) + +**Пример** + +``` sql +SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 +``` + +``` text +┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ +│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ +│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ +│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ +└────────┴────────────────────────────────┴──────────────────────────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/other_functions/) diff --git a/docs/ru/sql_reference/functions/random_functions.md b/docs/ru/sql-reference/functions/random-functions.md similarity index 100% rename from docs/ru/sql_reference/functions/random_functions.md rename to docs/ru/sql-reference/functions/random-functions.md diff --git a/docs/ru/sql-reference/functions/rounding-functions.md b/docs/ru/sql-reference/functions/rounding-functions.md new file mode 100644 index 00000000000..c643bccf3e2 --- /dev/null +++ b/docs/ru/sql-reference/functions/rounding-functions.md @@ -0,0 +1,175 @@ +# Функции округления {#funktsii-okrugleniia} + +## floor(x\[, N\]) {#floorx-n} + +Возвращает наибольшее круглое число, которое меньше или равно, чем x. +Круглым называется число, кратное 1 / 10N или ближайшее к нему число соответствующего типа данных, если 1 / 10N не представимо точно. +N - целочисленная константа, не обязательный параметр. По умолчанию - ноль, что означает - округлять до целого числа. +N может быть отрицательным. + +Примеры: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` + +`x` - любой числовой тип. Результат - число того же типа. +Для целочисленных аргументов имеет смысл округление с отрицательным значением N (для неотрицательных N, функция ничего не делает). +В случае переполнения при округлении (например, floor(-128, -1)), возвращается implementation specific результат. + +## ceil(x\[, N\]) {#ceilx-n} + +Возвращает наименьшее круглое число, которое больше или равно, чем x. +В остальном, аналогично функции floor, см. выше. + +## round(x\[, N\]) {#rounding_functions-round} + +Округляет значение до указанного десятичного разряда. + +Функция возвращает ближайшее значение указанного порядка. В случае, когда заданное число равноудалено от чисел необходимого порядка, функция возвращает то из них, которое имеет ближайшую чётную цифру (банковское округление). + +``` sql +round(expression [, decimal_places]) +``` + +**Параметры:** + +- `expression` — Число для округления. Может быть любым [выражением](../syntax.md#syntax-expressions), возвращающим числовой [тип данных](../../sql-reference/functions/rounding-functions.md#data_types). +- `decimal-places` — Целое значение. + - Если `decimal-places > 0`, то функция округляет значение справа от запятой. + - Если `decimal-places < 0` то функция округляет значение слева от запятой. + - Если `decimal-places = 0`, то функция округляет значение до целого. В этом случае аргумент можно опустить. + +**Возвращаемое значение:** + +Округлённое значение того же типа, что и входящее. + +### Примеры {#primery} + +**Пример использования** + +``` sql +SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 +``` + +``` text +┌───x─┬─round(divide(number, 2))─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +└─────┴──────────────────────────┘ +``` + +**Примеры округления** + +Округление до ближайшего числа. + +``` text +round(3.2, 0) = 3 +round(4.1267, 2) = 4.13 +round(22,-1) = 20 +round(467,-2) = 500 +round(-467,-2) = -500 +``` + +Банковское округление. + +``` text +round(3.5) = 4 +round(4.5) = 4 +round(3.55, 1) = 3.6 +round(3.65, 1) = 3.6 +``` + +**Смотрите также** + +- [roundBankers](#roundbankers) + +## roundBankers {#roundbankers} + +Округляет число до указанного десятичного разряда. + +- Если округляемое число равноудалено от соседних чисел, то используется банковское округление. + + Банковское округление (англ. banker's rounding) — метод округления дробных чисел. Если округляемое число равноудалено от соседних чисел, то оно округляется до ближайшей чётной цифры заданного десятичного разряда. К примеру, 3,5 округляется до 4, а 2,5 до 2. + + Этот метод округления, используемый по умолчанию для чисел с плавающей запятой, определён в стандарте [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). Функция [round](#rounding_functions-round) также округляет числа с плавающей запятой по этому методу. Функция `roundBankers` округляет не только числа с плавающей запятой, но и целые числа методом банковского округления, например, `roundBankers(45, -1) = 40`. + +- В других случаях функция округляет к ближайшему целому. + +Банковское округление позволяет уменьшить влияние округления чисел на результат суммирования или вычитания этих чисел. + +Пример суммирования чисел 1.5, 2.5, 3.5 и 4.5 с различным округлением: + +- Без округления: 1.5 + 2.5 + 3.5 + 4.5 = 12. +- Банковское округление: 2 + 2 + 4 + 4 = 12. +- Округление до ближайшего целого: 2 + 3 + 4 + 5 = 14. + +**Синтаксис** + +``` sql +roundBankers(expression [, decimal_places]) +``` + +**Параметры** + +- `expression` — Число для округления. Может быть любым [выражением](../syntax.md#syntax-expressions), возвращающим числовой [тип данных](../../sql-reference/functions/rounding-functions.md#data_types). +- `decimal-places` — Десятичный разряд. Целое число. + - `decimal-places > 0` — Функция округляет значение выражения до ближайшего чётного числа на соответствующей позиции справа от запятой. Например, `roundBankers(3.55, 1) = 3.6`. + - `decimal-places < 0` — Функция округляет значение выражения до ближайшего чётного числа на соответствующей позиции слева от запятой. Например, `roundBankers(24.55, -1) = 20`. + - `decimal-places = 0` — Функция округляет значение до целого. В этом случае аргумент можно не передавать. Например, `roundBankers(2.5) = 2`. + +**Возвращаемое значение** + +Округлённое значение по методу банковского округления. + +**Пример использования** + +Запрос: + +``` sql + SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 +``` + +Результат: + +``` text +┌───x─┬─b─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +│ 1.5 │ 2 │ +│ 2 │ 2 │ +│ 2.5 │ 2 │ +│ 3 │ 3 │ +│ 3.5 │ 4 │ +│ 4 │ 4 │ +│ 4.5 │ 4 │ +└─────┴───┘ +``` + +**Примеры банковского округления** + +``` text +roundBankers(0.4) = 0 +roundBankers(-3.5) = -4 +roundBankers(4.5) = 4 +roundBankers(3.55, 1) = 3.6 +roundBankers(3.65, 1) = 3.6 +roundBankers(10.35, 1) = 10.4 +roundBankers(10.755, 2) = 11,76 +``` + +**Смотрите также** + +- [round](#rounding_functions-round) + +## roundToExp2(num) {#roundtoexp2num} + +Принимает число. Если число меньше единицы - возвращает 0. Иначе округляет число вниз до ближайшей (целой неотрицательной) степени двух. + +## roundDuration(num) {#rounddurationnum} + +Принимает число. Если число меньше единицы - возвращает 0. Иначе округляет число вниз до чисел из набора: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Эта функция специфична для Яндекс.Метрики и предназначена для реализации отчёта по длительности визита. + +## roundAge(num) {#roundagenum} + +Принимает число. Если число меньше 18 - возвращает 0. Иначе округляет число вниз до чисел из набора: 18, 25, 35, 45, 55. Эта функция специфична для Яндекс.Метрики и предназначена для реализации отчёта по возрасту посетителей. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/rounding_functions/) diff --git a/docs/ru/sql_reference/functions/splitting_merging_functions.md b/docs/ru/sql-reference/functions/splitting-merging-functions.md similarity index 100% rename from docs/ru/sql_reference/functions/splitting_merging_functions.md rename to docs/ru/sql-reference/functions/splitting-merging-functions.md diff --git a/docs/ru/sql-reference/functions/string-functions.md b/docs/ru/sql-reference/functions/string-functions.md new file mode 100644 index 00000000000..a9e254f215b --- /dev/null +++ b/docs/ru/sql-reference/functions/string-functions.md @@ -0,0 +1,482 @@ +# Функции для работы со строками {#funktsii-dlia-raboty-so-strokami} + +## empty {#empty} + +Возвращает 1 для пустой строки, и 0 для непустой строки. +Тип результата — UInt8. +Строка считается непустой, если содержит хотя бы один байт, пусть даже это пробел или нулевой байт. +Функция также работает для массивов. + +## notEmpty {#notempty} + +Возвращает 0 для пустой строки, и 1 для непустой строки. +Тип результата — UInt8. +Функция также работает для массивов. + +## length {#length} + +Возвращает длину строки в байтах (не символах, не кодовых точках). +Тип результата — UInt64. +Функция также работает для массивов. + +## lengthUTF8 {#lengthutf8} + +Возвращает длину строки в кодовых точках Unicode (не символах), при допущении, что строка содержит набор байтов, являющийся текстом в кодировке UTF-8. Если допущение не выполнено, то возвращает какой-нибудь результат (не кидает исключение). +Тип результата — UInt64. + +## char\_length, CHAR\_LENGTH {#char-length} + +Возвращает длину строки в кодовых точках Unicode (не символах), при допущении, что строка содержит набор байтов, являющийся текстом в кодировке UTF-8. Если допущение не выполнено, возвращает какой-нибудь результат (не кидает исключение). +Тип результата — UInt64. + +## character\_length, CHARACTER\_LENGTH {#character-length} + +Возвращает длину строки в кодовых точках Unicode (не символах), при допущении, что строка содержит набор байтов, являющийся текстом в кодировке UTF-8. Если допущение не выполнено, возвращает какой-нибудь результат (не кидает исключение). +Тип результата — UInt64. + +## lower, lcase {#lower} + +Переводит ASCII-символы латиницы в строке в нижний регистр. + +## upper, ucase {#upper} + +Переводит ASCII-символы латиницы в строке в верхний регистр. + +## lowerUTF8 {#lowerutf8} + +Переводит строку в нижний регистр, при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. +Не учитывает язык. То есть, для турецкого языка, результат может быть не совсем верным. +Если длина UTF-8 последовательности байтов различна для верхнего и нижнего регистра кодовой точки, то для этой кодовой точки результат работы может быть некорректным. +Если строка содержит набор байтов, не являющийся UTF-8, то поведение не определено. + +## upperUTF8 {#upperutf8} + +Переводит строку в верхний регистр, при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. +Не учитывает язык. То есть, для турецкого языка, результат может быть не совсем верным. +Если длина UTF-8 последовательности байтов различна для верхнего и нижнего регистра кодовой точки, то для этой кодовой точки, результат работы может быть некорректным. +Если строка содержит набор байтов, не являющийся UTF-8, то поведение не определено. + +## isValidUTF8 {#isvalidutf8} + +Возвращает 1, если набор байтов является корректным в кодировке UTF-8, 0 иначе. + +## toValidUTF8 {#tovalidutf8} + +Заменяет некорректные символы UTF-8 на символ `�` (U+FFFD). Все идущие подряд некорректные символы схлопываются в один заменяющий символ. + +``` sql +toValidUTF8( input_string ) +``` + +Параметры: + +- input\_string — произвольный набор байтов, представленный как объект типа [String](../../sql-reference/functions/string-functions.md). + +Возвращаемое значение: Корректная строка UTF-8. + +**Пример** + +``` sql +SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') +``` + +``` text +┌─toValidUTF8('a����b')─┐ +│ a�b │ +└───────────────────────┘ +``` + +## repeat {#repeat} + +Повторяет строку определенное количество раз и объединяет повторяемые значения в одну строку. + +**Синтаксис** + +``` sql +repeat(s, n) +``` + +**Параметры** + +- `s` — Строка для повторения. [String](../../sql-reference/functions/string-functions.md). +- `n` — Количество повторов. [UInt](../../sql-reference/functions/string-functions.md). + +**Возвращаемое значение** + +Строка, состоящая из повторений `n` раз исходной строки `s`. Если `n` \< 1, то функция вернет пустую строку. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT repeat('abc', 10) +``` + +Ответ: + +``` text +┌─repeat('abc', 10)──────────────┐ +│ abcabcabcabcabcabcabcabcabcabc │ +└────────────────────────────────┘ +``` + +## reverse {#reverse} + +Разворачивает строку (как последовательность байтов). + +## reverseUTF8 {#reverseutf8} + +Разворачивает последовательность кодовых точек Unicode, при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. Иначе — что-то делает (не кидает исключение). + +## format(pattern, s0, s1, …) {#format} + +Форматирует константный шаблон со строками, перечисленными в аргументах. `pattern` — упрощенная версия шаблона в языке Python. Шаблон содержит «заменяющие поля», которые окружены фигурными скобками `{}`. Всё, что не содержится в скобках, интерпретируется как обычный текст и просто копируется. Если нужно использовать символ фигурной скобки, можно экранировать двойной скобкой `{{ '{{' }}` или `{{ '}}' }}`. Имя полей могут быть числами (нумерация с нуля) или пустыми (тогда они интерпретируются как последовательные числа). + +``` sql +SELECT format('{1} {0} {1}', 'World', 'Hello') +``` + +``` text +┌─format('{1} {0} {1}', 'World', 'Hello')─┐ +│ Hello World Hello │ +└─────────────────────────────────────────┘ +``` + +``` sql +SELECT format('{} {}', 'Hello', 'World') +``` + +``` text +┌─format('{} {}', 'Hello', 'World')─┐ +│ Hello World │ +└───────────────────────────────────┘ +``` + +## concat {#concat} + +Склеивает строки, переданные в аргументы, в одну строку без разделителей. + +**Cинтаксис** + +``` sql +concat(s1, s2, ...) +``` + +**Параметры** + +Значения типа String или FixedString. + +**Возвращаемое значение** + +Возвращает строку, полученную в результате склейки аргументов. + +Если любой из аргументов имеет значение `NULL`, `concat` возвращает значение `NULL`. + +**Пример** + +Запрос: + +``` sql +SELECT concat('Hello, ', 'World!') +``` + +Ответ: + +``` text +┌─concat('Hello, ', 'World!')─┐ +│ Hello, World! │ +└─────────────────────────────┘ +``` + +## concatAssumeInjective {#concatassumeinjective} + +Аналогична [concat](#concat). Разница заключается в том, что вам нужно убедиться, что `concat(s1, s2, ...) → sn` является инъективным, так как это предположение будет использоваться для оптимизации GROUP BY. + +Функция называется «инъективной», если она возвращает разные значения для разных аргументов. Или, иными словами, функция никогда не выдаёт одно и то же значение, если аргументы разные. + +**Синтаксис** + +``` sql +concatAssumeInjective(s1, s2, ...) +``` + +**Параметры** + +Значения типа String или FixedString. + +**Возвращаемые значения** + +Возвращает строку, полученную в результате объединения аргументов. + +Если любой из аргументов имеет значение `NULL`, `concatAssumeInjective` возвращает значение `NULL`. + +**Пример** + +Вводная таблица: + +``` sql +CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog +INSERT INTO key_val VALUES ('Hello, ','World',1)('Hello, ','World',2)('Hello, ','World!',3)('Hello',', World!',2) +SELECT * from key_val +``` + +``` text +┌─key1────┬─key2─────┬─value─┐ +│ Hello, │ World │ 1 │ +│ Hello, │ World │ 2 │ +│ Hello, │ World! │ 3 │ +│ Hello │ , World! │ 2 │ +└─────────┴──────────┴───────┘ +``` + +Запрос: + +``` sql +SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY (key1, key2) +``` + +Ответ: + +``` text +┌─concat(key1, key2)─┬─sum(value)─┐ +│ Hello, World! │ 3 │ +│ Hello, World! │ 2 │ +│ Hello, World │ 3 │ +└────────────────────┴────────────┘ +``` + +## substring(s, offset, length), mid(s, offset, length), substr(s, offset, length) {#substring} + +Возвращает подстроку, начиная с байта по индексу offset, длины length байт. Индексация символов — начиная с единицы (как в стандартном SQL). Аргументы offset и length должны быть константами. + +## substringUTF8(s, offset, length) {#substringutf8} + +Так же, как substring, но для кодовых точек Unicode. Работает при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. Если допущение не выполнено, то возвращает какой-нибудь результат (не кидает исключение). + +## appendTrailingCharIfAbsent(s, c) {#appendtrailingcharifabsent} + +Если строка s непустая и не содержит символ c на конце, то добавляет символ c в конец. + +## convertCharset(s, from, to) {#convertcharset} + +Возвращает сконвертированную из кодировки from в кодировку to строку s. + +## base64Encode(s) {#base64encode} + +Производит кодирование строки s в base64-представление. + +## base64Decode(s) {#base64decode} + +Декодирует base64-представление s в исходную строку. При невозможности декодирования выбрасывает исключение + +## tryBase64Decode(s) {#trybase64decode} + +Функционал аналогичен base64Decode, но при невозможности декодирования возвращает пустую строку. + +## endsWith(s, suffix) {#endswith} + +Возвращает 1, если строка завершается указанным суффиксом, и 0 в противном случае. + +## startsWith(str, prefix) {#startswith} + +Возвращает 1, если строка начинается указанным префиксом, в противном случае 0. + +``` sql +SELECT startsWith('Spider-Man', 'Spi'); +``` + +**Возвращаемые значения** + +- 1, если строка начинается указанным префиксом. +- 0, если строка не начинается указанным префиксом. + +**Пример** + +Запрос: + +``` sql +SELECT startsWith('Hello, world!', 'He'); +``` + +Ответ: + +``` text +┌─startsWith('Hello, world!', 'He')─┐ +│ 1 │ +└───────────────────────────────────┘ +``` + +## trim {#trim} + +Удаляет все указанные символы с начала или окончания строки. +По умолчанию удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с обоих концов строки. + +**Синтаксис** + +``` sql +trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) +``` + +**Параметры** + +- `trim_character` — один или несколько символов, подлежащие удалению. [String](../../sql-reference/functions/string-functions.md). +- `input_string` — строка для обрезки. [String](../../sql-reference/functions/string-functions.md). + +**Возвращаемое значение** + +Исходную строку после обрезки с левого и (или) правого концов строки. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT trim(BOTH ' ()' FROM '( Hello, world! )') +``` + +Ответ: + +``` text +┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ +│ Hello, world! │ +└───────────────────────────────────────────────┘ +``` + +## trimLeft {#trimleft} + +Удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с левого конца строки. Не удаляет другие виды пробелов (табуляция, пробел без разрыва и т. д.). + +**Синтаксис** + +``` sql +trimLeft(input_string) +``` + +Алиас: `ltrim(input_string)`. + +**Параметры** + +- `input_string` — строка для обрезки. [String](../../sql-reference/functions/string-functions.md). + +**Возвращаемое значение** + +Исходную строку без общих пробельных символов слева. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT trimLeft(' Hello, world! ') +``` + +Ответ: + +``` text +┌─trimLeft(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## trimRight {#trimright} + +Удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с правого конца строки. Не удаляет другие виды пробелов (табуляция, пробел без разрыва и т. д.). + +**Синтаксис** + +``` sql +trimRight(input_string) +``` + +Алиас: `rtrim(input_string)`. + +**Параметры** + +- `input_string` — строка для обрезки. [String](../../sql-reference/functions/string-functions.md). + +**Возвращаемое значение** + +Исходную строку без общих пробельных символов справа. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT trimRight(' Hello, world! ') +``` + +Ответ: + +``` text +┌─trimRight(' Hello, world! ')─┐ +│ Hello, world! │ +└──────────────────────────────────────┘ +``` + +## trimBoth {#trimboth} + +Удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с обоих концов строки. Не удаляет другие виды пробелов (табуляция, пробел без разрыва и т. д.). + +**Синтаксис** + +``` sql +trimBoth(input_string) +``` + +Алиас: `trim(input_string)`. + +**Параметры** + +- `input_string` — строка для обрезки. [String](../../sql-reference/functions/string-functions.md). + +**Возвращаемое значение** + +Исходную строку без общих пробельных символов с обоих концов строки. + +Тип: `String`. + +**Пример** + +Запрос: + +``` sql +SELECT trimBoth(' Hello, world! ') +``` + +Ответ: + +``` text +┌─trimBoth(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## CRC32(s) {#crc32} + +Возвращает чексумму CRC32 данной строки, используется CRC-32-IEEE 802.3 многочлен и начальным значением `0xffffffff` (т.к. используется реализация из zlib). + +Тип результата — UInt32. + +## CRC32IEEE(s) {#crc32ieee} + +Возвращает чексумму CRC32 данной строки, используется CRC-32-IEEE 802.3 многочлен. + +Тип результата — UInt32. + +## CRC64(s) {#crc64} + +Возвращает чексумму CRC64 данной строки, используется CRC-64-ECMA многочлен. + +Тип результата — UInt64. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/string_functions/) diff --git a/docs/ru/sql_reference/functions/string_replace_functions.md b/docs/ru/sql-reference/functions/string-replace-functions.md similarity index 100% rename from docs/ru/sql_reference/functions/string_replace_functions.md rename to docs/ru/sql-reference/functions/string-replace-functions.md diff --git a/docs/ru/sql_reference/functions/string_search_functions.md b/docs/ru/sql-reference/functions/string-search-functions.md similarity index 100% rename from docs/ru/sql_reference/functions/string_search_functions.md rename to docs/ru/sql-reference/functions/string-search-functions.md diff --git a/docs/ru/sql-reference/functions/type-conversion-functions.md b/docs/ru/sql-reference/functions/type-conversion-functions.md new file mode 100644 index 00000000000..57cc76b797e --- /dev/null +++ b/docs/ru/sql-reference/functions/type-conversion-functions.md @@ -0,0 +1,516 @@ +# Функции преобразования типов {#funktsii-preobrazovaniia-tipov} + +## Общие проблемы преобразования чисел {#numeric-conversion-issues} + +При преобразовании значения из одного типа в другой необходимо помнить, что в общем случае это небезопасная операция, которая может привести к потере данных. Потеря данных может произойти при попытке сконвертировать тип данных значения от большего к меньшему или при конвертировании между различными классами типов данных. + +Поведение ClickHouse при конвертировании похоже на [поведение C++ программ](https://en.cppreference.com/w/cpp/language/implicit_conversion). + +## toInt(8\|16\|32\|64) {#toint8163264} + +Преобразует входное значение к типу [Int](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает: + +- `toInt8(expr)` — возвращает значение типа `Int8`. +- `toInt16(expr)` — возвращает значение типа `Int16`. +- `toInt32(expr)` — возвращает значение типа `Int32`. +- `toInt64(expr)` — возвращает значение типа `Int64`. + +**Параметры** + +- `expr` — [выражение](../syntax.md#syntax-expressions) возвращающее число или строку с десятичным представление числа. Бинарное, восьмеричное и шестнадцатеричное представление числа не поддержаны. Ведущие нули обрезаются. + +**Возвращаемое значение** + +Целое число типа `Int8`, `Int16`, `Int32` или `Int64`. + +Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа. + +Поведение функций для аргументов [NaN и Inf](../../sql-reference/functions/type-conversion-functions.md#data_type-float-nan-inf) не определено. При использовании функций помните о возможных проблемах при [преобразовании чисел](#numeric-conversion-issues). + +**Пример** + +``` sql +SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) +``` + +``` text +┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ +│ -9223372036854775808 │ 32 │ 16 │ 8 │ +└──────────────────────┴─────────────┴───────────────┴─────────────┘ +``` + +## toInt(8\|16\|32\|64)OrZero {#toint8163264orzero} + +Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64). Если не удалось - возвращает 0. + +**Пример** + +``` sql +select toInt64OrZero('123123'), toInt8OrZero('123qwe123') +``` + +``` text +┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ +│ 123123 │ 0 │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toInt(8\|16\|32\|64)OrNull {#toint8163264ornull} + +Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64). Если не удалось - возвращает NULL. + +**Пример** + +``` sql +select toInt64OrNull('123123'), toInt8OrNull('123qwe123') +``` + +``` text +┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ +│ 123123 │ ᴺᵁᴸᴸ │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toUInt(8\|16\|32\|64) {#touint8163264} + +Преобраует входное значение к типу [UInt](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает: + +- `toUInt8(expr)` — возвращает значение типа `UInt8`. +- `toUInt16(expr)` — возвращает значение типа `UInt16`. +- `toUInt32(expr)` — возвращает значение типа `UInt32`. +- `toUInt64(expr)` — возвращает значение типа `UInt64`. + +**Параметры** + +- `expr` — [выражение](../syntax.md#syntax-expressions) возвращающее число или строку с десятичным представление числа. Бинарное, восьмеричное и шестнадцатеричное представление числа не поддержаны. Ведущие нули обрезаются. + +**Возвращаемое значение** + +Целое число типа `UInt8`, `UInt16`, `UInt32` или `UInt64`. + +Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа. + +Поведение функций для аргументов [NaN и Inf](../../sql-reference/functions/type-conversion-functions.md#data_type-float-nan-inf) не определено. Если передать строку, содержащую отрицательное число, например `'-32'`, ClickHouse генерирует исключение. При использовании функций помните о возможных проблемах при [преобразовании чисел](#numeric-conversion-issues). + +**Пример** + +``` sql +SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) +``` + +``` text +┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ +│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ +└─────────────────────┴───────────────┴────────────────┴──────────────┘ +``` + +## toUInt(8\|16\|32\|64)OrZero {#touint8163264orzero} + +## toUInt(8\|16\|32\|64)OrNull {#touint8163264ornull} + +## toFloat(32\|64) {#tofloat3264} + +## toFloat(32\|64)OrZero {#tofloat3264orzero} + +## toFloat(32\|64)OrNull {#tofloat3264ornull} + +## toDate {#todate} + +## toDateOrZero {#todateorzero} + +## toDateOrNull {#todateornull} + +## toDateTime {#todatetime} + +## toDateTimeOrZero {#todatetimeorzero} + +## toDateTimeOrNull {#todatetimeornull} + +## toDecimal(32\|64\|128) {#todecimal3264128} + +Преобразует `value` к типу данных [Decimal](../../sql-reference/functions/type-conversion-functions.md) с точностью `S`. `value` может быть числом или строкой. Параметр `S` (scale) задаёт число десятичных знаков. + +- `toDecimal32(value, S)` +- `toDecimal64(value, S)` +- `toDecimal128(value, S)` + +## toDecimal(32\|64\|128)OrNull {#todecimal3264128ornull} + +Преобразует входную строку в значение с типом данных [Nullable (Decimal (P, S))](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает в себя: + +- `toDecimal32OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal32(S))`. +- `toDecimal64OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal64(S))`. +- `toDecimal128OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal128(S))`. + +Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `NULL` вместо исключения. + +**Параметры** + +- `expr` — [выражение](../syntax.md#syntax-expressions), возвращающее значение типа [String](../../sql-reference/functions/type-conversion-functions.md). ClickHouse ожидает текстовое представление десятичного числа. Например, `'1.111'`. +- `S` — количество десятичных знаков в результирующем значении. + +**Возвращаемое значение** + +Значение типа `Nullable(Decimal(P,S))`. Значение содержит: + +- Число с `S` десятичными знаками, если ClickHouse распознал число во входной строке. +- `NULL`, если ClickHouse не смог распознать число во входной строке или входное число содержит больше чем `S` десятичных знаков. + +**Примеры** + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ +│ -1.11100 │ Nullable(Decimal(9, 5)) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ +│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toDecimal(32\|64\|128)OrZero {#todecimal3264128orzero} + +Преобразует тип входного значения в [Decimal (P, S)](../../sql-reference/functions/type-conversion-functions.md). Семейство функций включает в себя: + +- `toDecimal32OrZero( expr, S)` — возвращает значение типа `Decimal32(S)`. +- `toDecimal64OrZero( expr, S)` — возвращает значение типа `Decimal64(S)`. +- `toDecimal128OrZero( expr, S)` — возвращает значение типа `Decimal128(S)`. + +Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `0` вместо исключения. + +**Параметры** + +- `expr` — [выражение](../syntax.md#syntax-expressions), возвращающее значение типа [String](../../sql-reference/functions/type-conversion-functions.md). ClickHouse ожидает текстовое представление десятичного числа. Например, `'1.111'`. +- `S` — количество десятичных знаков в результирующем значении. + +**Возвращаемое значение** + +Значение типа `Nullable(Decimal(P,S))`. `P` равно числовой части имени функции. Например, для функции `toDecimal32OrZero`, `P = 32`. Значение содержит: + +- Число с `S` десятичными знаками, если ClickHouse распознал число во входной строке. +- 0 c `S` десятичными знаками, если ClickHouse не смог распознать число во входной строке или входное число содержит больше чем `S` десятичных знаков. + +**Пример** + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ +│ -1.11100 │ Decimal(9, 5) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ +│ 0.00 │ Decimal(9, 2) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toString {#tostring} + +Функции преобразования между числами, строками (но не фиксированными строками), датами и датами-с-временем. +Все эти функции принимают один аргумент. + +При преобразовании в строку или из строки, производится форматирование или парсинг значения по тем же правилам, что и для формата TabSeparated (и почти всех остальных текстовых форматов). Если распарсить строку не удаётся - кидается исключение и выполнение запроса прерывается. + +При преобразовании даты в число или наоборот, дате соответствует число дней от начала unix эпохи. +При преобразовании даты-с-временем в число или наоборот, дате-с-временем соответствует число секунд от начала unix эпохи. + +Форматы даты и даты-с-временем для функций toDate/toDateTime определены следующим образом: + +``` text +YYYY-MM-DD +YYYY-MM-DD hh:mm:ss +``` + +В качестве исключения, если делается преобразование из числа типа UInt32, Int32, UInt64, Int64 в Date, и если число больше или равно 65536, то число рассматривается как unix timestamp (а не как число дней) и округляется до даты. Это позволяет поддержать распространённый случай, когда пишут toDate(unix\_timestamp), что иначе было бы ошибкой и требовало бы написания более громоздкого toDate(toDateTime(unix\_timestamp)) + +Преобразование между датой и датой-с-временем производится естественным образом: добавлением нулевого времени или отбрасыванием времени. + +Преобразование между числовыми типами производится по тем же правилам, что и присваивание между разными числовыми типами в C++. + +Дополнительно, функция toString от аргумента типа DateTime может принимать второй аргумент String - имя тайм-зоны. Пример: `Asia/Yekaterinburg` В этом случае, форматирование времени производится согласно указанной тайм-зоне. + +``` sql +SELECT + now() AS now_local, + toString(now(), 'Asia/Yekaterinburg') AS now_yekat +``` + +``` text +┌───────────now_local─┬─now_yekat───────────┐ +│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ +└─────────────────────┴─────────────────────┘ +``` + +Также смотрите функцию `toUnixTimestamp`. + +## toFixedString(s, N) {#tofixedstrings-n} + +Преобразует аргумент типа String в тип FixedString(N) (строку фиксированной длины N). N должно быть константой. +Если строка имеет меньше байт, чем N, то она дополняется нулевыми байтами справа. Если строка имеет больше байт, чем N - кидается исключение. + +## toStringCutToZero(s) {#tostringcuttozeros} + +Принимает аргумент типа String или FixedString. Возвращает String, вырезая содержимое строки до первого найденного нулевого байта. + +Пример: + +``` sql +SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s─────────────┬─s_cut─┐ +│ foo\0\0\0\0\0 │ foo │ +└───────────────┴───────┘ +``` + +``` sql +SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s──────────┬─s_cut─┐ +│ foo\0bar\0 │ foo │ +└────────────┴───────┘ +``` + +## reinterpretAsUInt(8\|16\|32\|64) {#reinterpretasuint8163264} + +## reinterpretAsInt(8\|16\|32\|64) {#reinterpretasint8163264} + +## reinterpretAsFloat(32\|64) {#reinterpretasfloat3264} + +## reinterpretAsDate {#reinterpretasdate} + +## reinterpretAsDateTime {#reinterpretasdatetime} + +Функции принимают строку и интерпретируют байты, расположенные в начале строки, как число в host order (little endian). Если строка имеет недостаточную длину, то функции работают так, как будто строка дополнена необходимым количеством нулевых байт. Если строка длиннее, чем нужно, то лишние байты игнорируются. Дата интерпретируется, как число дней с начала unix-эпохи, а дата-с-временем - как число секунд с начала unix-эпохи. + +## reinterpretAsString {#type_conversion_functions-reinterpretAsString} + +Функция принимает число или дату или дату-с-временем и возвращает строку, содержащую байты, представляющие соответствующее значение в host order (little endian). При этом, отбрасываются нулевые байты с конца. Например, значение 255 типа UInt32 будет строкой длины 1 байт. + +## CAST(x, T) {#type_conversion_function-cast} + +Преобразует x в тип данных t. +Поддерживается также синтаксис CAST(x AS t). + +Пример: + +``` sql +SELECT + '2016-06-15 23:00:00' AS timestamp, + CAST(timestamp AS DateTime) AS datetime, + CAST(timestamp AS Date) AS date, + CAST(timestamp, 'String') AS string, + CAST(timestamp, 'FixedString(22)') AS fixed_string +``` + +``` text +┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ +└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ +``` + +Преобразование в FixedString(N) работает только для аргументов типа String или FixedString(N). + +Поддержано преобразование к типу [Nullable](../../sql-reference/functions/type-conversion-functions.md) и обратно. Пример: + +``` sql +SELECT toTypeName(x) FROM t_null +``` + +``` text +┌─toTypeName(x)─┐ +│ Int8 │ +│ Int8 │ +└───────────────┘ +``` + +``` sql +SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null +``` + +``` text +┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ +│ Nullable(UInt16) │ +│ Nullable(UInt16) │ +└─────────────────────────────────────────┘ +``` + +## toInterval(Year\|Quarter\|Month\|Week\|Day\|Hour\|Minute\|Second) {#function-tointerval} + +Приводит аргумент из числового типа данных к типу данных [IntervalType](../../sql-reference/functions/type-conversion-functions.md). + +**Синтаксис** + +``` sql +toIntervalSecond(number) +toIntervalMinute(number) +toIntervalHour(number) +toIntervalDay(number) +toIntervalWeek(number) +toIntervalMonth(number) +toIntervalQuarter(number) +toIntervalYear(number) +``` + +**Параметры** + +- `number` — длительность интервала. Положительное целое число. + +**Возвращаемые значения** + +- Значение с типом данных `Interval`. + +**Пример** + +``` sql +WITH + toDate('2019-01-01') AS date, + INTERVAL 1 WEEK AS interval_week, + toIntervalWeek(1) AS interval_to_week +SELECT + date + interval_week, + date + interval_to_week +``` + +``` text +┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ +│ 2019-01-08 │ 2019-01-08 │ +└───────────────────────────┴──────────────────────────────┘ +``` + +## parseDateTimeBestEffort {#parsedatetimebesteffort} + +Преобразует дату и время в [строковом](../../sql-reference/functions/type-conversion-functions.md) представлении к типу данных [DateTime](../../sql-reference/functions/type-conversion-functions.md#data_type-datetime). + +Функция распознаёт форматы [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 а также некоторые другие форматы. + +**Синтаксис** + +``` sql +parseDateTimeBestEffort(time_string[, time_zone]); +``` + +**Параметры** + +- `time_string` — строка, содержащая дату и время для преобразования. [String](../../sql-reference/functions/type-conversion-functions.md). +- `time_zone` — часовой пояс. Функция анализирует `time_string` в соответствии с заданным часовым поясом. [String](../../sql-reference/functions/type-conversion-functions.md). + +**Поддерживаемые нестандартные форматы** + +- [Unix timestamp](https://ru.wikipedia.org/wiki/Unix-время) в строковом представлении. 9 или 10 символов. +- Строка с датой и временем: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, etc. +- Строка с датой, но без времени: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` и т.д. +- Строка с временем, и с днём: `DD`, `DD hh`, `DD hh:mm`. В этом случае `YYYY-MM` принимается равным `2000-01`. +- Строка, содержащая дату и время вместе с информацией о часовом поясе: `YYYY-MM-DD hh:mm:ss ±h:mm`, и т.д. Например, `2020-12-12 17:36:00 -5:00`. + +Для всех форматов с разделителями функция распознаёт названия месяцев, выраженных в виде полного англоязычного имени месяца или в виде первых трёх символов имени месяца. Примеры: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. + +**Возвращаемое значение** + +- `time_string` преобразованная к типу данных `DateTime`. + +**Примеры** + +Запрос: + +``` sql +SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') +AS parseDateTimeBestEffort; +``` + +Результат: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2020-12-12 12:12:57 │ +└─────────────────────────┘ +``` + +Запрос: + +``` sql +SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') +AS parseDateTimeBestEffort +``` + +Результат: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-08-18 10:22:16 │ +└─────────────────────────┘ +``` + +Запрос: + +``` sql +SELECT parseDateTimeBestEffort('1284101485') +AS parseDateTimeBestEffort +``` + +Результат: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2015-07-07 12:04:41 │ +└─────────────────────────┘ +``` + +Запрос: + +``` sql +SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') +AS parseDateTimeBestEffort +``` + +Результат: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-12-12 10:12:12 │ +└─────────────────────────┘ +``` + +Запрос: + +``` sql +SELECT parseDateTimeBestEffort('10 20:19') +``` + +Результат: + +``` text +┌─parseDateTimeBestEffort('10 20:19')─┐ +│ 2000-01-10 20:19:00 │ +└─────────────────────────────────────┘ +``` + +**См. также** + +- \[Информация о формате ISO 8601 от @xkcd\](https://xkcd.com/1179/) +- [RFC 1123](https://tools.ietf.org/html/rfc1123) +- [toDate](#todate) +- [toDateTime](#todatetime) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/type_conversion_functions/) diff --git a/docs/ru/sql-reference/functions/url-functions.md b/docs/ru/sql-reference/functions/url-functions.md new file mode 100644 index 00000000000..6d749f6f143 --- /dev/null +++ b/docs/ru/sql-reference/functions/url-functions.md @@ -0,0 +1,201 @@ +# Функции для работы с URL {#funktsii-dlia-raboty-s-url} + +Все функции работают не по RFC - то есть, максимально упрощены ради производительности. + +## Функции, извлекающие часть URL-а {#funktsii-izvlekaiushchie-chast-url-a} + +Если в URL-е нет ничего похожего, то возвращается пустая строка. + +### protocol {#protocol} + +Возвращает протокол. Примеры: http, ftp, mailto, magnet… + +### domain {#domain} + +Извлекает имя хоста из URL. + +``` sql +domain(url) +``` + +**Параметры** + +- `url` — URL. Тип — [String](../../sql-reference/functions/url-functions.md). + +URL может быть указан со схемой или без неё. Примеры: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +Для указанных примеров функция `domain` возвращает следующие результаты: + +``` text +some.svn-hosting.com +some.svn-hosting.com +yandex.com +``` + +**Возвращаемые значения** + +- Имя хоста. Если ClickHouse может распарсить входную строку как URL. +- Пустая строка. Если ClickHouse не может распарсить входную строку как URL. + +Тип — `String`. + +**Пример** + +``` sql +SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ +│ some.svn-hosting.com │ +└────────────────────────────────────────────────────────┘ +``` + +### domainWithoutWWW {#domainwithoutwww} + +Возвращает домен, удалив префикс ‘www.’, если он присутствовал. + +### topLevelDomain {#topleveldomain} + +Извлекает домен верхнего уровня из URL. + +``` sql +topLevelDomain(url) +``` + +**Параметры** + +- `url` — URL. Тип — [String](../../sql-reference/functions/url-functions.md). + +URL может быть указан со схемой или без неё. Примеры: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +**Возвращаемые значения** + +- Имя домена. Если ClickHouse может распарсить входную строку как URL. +- Пустая строка. Если ClickHouse не может распарсить входную строку как URL. + +Тип — `String`. + +**Пример** + +``` sql +SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ +│ com │ +└────────────────────────────────────────────────────────────────────┘ +``` + +### firstSignificantSubdomain {#firstsignificantsubdomain} + +Возвращает «первый существенный поддомен». Это понятие является нестандартным и специфично для Яндекс.Метрики. Первый существенный поддомен - это домен второго уровня, если он не равен одному из com, net, org, co, или домен третьего уровня, иначе. Например, firstSignificantSubdomain(‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain(‘https://news.yandex.com.tr/’) = ‘yandex’. Список «несущественных» доменов второго уровня и другие детали реализации могут изменяться в будущем. + +### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} + +Возвращает часть домена, включающую поддомены верхнего уровня до «первого существенного поддомена» (см. выше). + +Например, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. + +### path {#path} + +Возвращает путь. Пример: `/top/news.html` Путь не включает в себя query string. + +### pathFull {#pathfull} + +То же самое, но включая query string и fragment. Пример: /top/news.html?page=2\#comments + +### queryString {#querystring} + +Возвращает query-string. Пример: page=1&lr=213. query-string не включает в себя начальный знак вопроса, а также \# и всё, что после \#. + +### fragment {#fragment} + +Возвращает fragment identifier. fragment не включает в себя начальный символ решётки. + +### queryStringAndFragment {#querystringandfragment} + +Возвращает query string и fragment identifier. Пример: страница=1\#29390. + +### extractURLParameter(URL, name) {#extracturlparameterurl-name} + +Возвращает значение параметра name в URL, если такой есть; или пустую строку, иначе; если параметров с таким именем много - вернуть первый попавшийся. Функция работает при допущении, что имя параметра закодировано в URL в точности таким же образом, что и в переданном аргументе. + +### extractURLParameters(URL) {#extracturlparametersurl} + +Возвращает массив строк вида name=value, соответствующих параметрам URL. Значения никак не декодируются. + +### extractURLParameterNames(URL) {#extracturlparameternamesurl} + +Возвращает массив строк вида name, соответствующих именам параметров URL. Значения никак не декодируются. + +### URLHierarchy(URL) {#urlhierarchyurl} + +Возвращает массив, содержащий URL, обрезанный с конца по символам /, ? в пути и query-string. Подряд идущие символы-разделители считаются за один. Резка производится в позиции после всех подряд идущих символов-разделителей. Пример: + +### URLPathHierarchy(URL) {#urlpathhierarchyurl} + +То же самое, но без протокола и хоста в результате. Элемент / (корень) не включается. Пример: +Функция используется для реализации древовидных отчётов по URL в Яндекс.Метрике. + +``` text +URLPathHierarchy('https://example.com/browse/CONV-6788') = +[ + '/browse/', + '/browse/CONV-6788' +] +``` + +### decodeURLComponent(URL) {#decodeurlcomponenturl} + +Возвращает декодированный URL. +Пример: + +``` sql +SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; +``` + +``` text +┌─DecodedURL─────────────────────────────┐ +│ http://127.0.0.1:8123/?query=SELECT 1; │ +└────────────────────────────────────────┘ +``` + +## Функции, удаляющие часть из URL-а {#funktsii-udaliaiushchie-chast-iz-url-a} + +Если в URL-е нет ничего похожего, то URL остаётся без изменений. + +### cutWWW {#cutwww} + +Удаляет не более одного ‘www.’ с начала домена URL-а, если есть. + +### cutQueryString {#cutquerystring} + +Удаляет query string. Знак вопроса тоже удаляется. + +### cutFragment {#cutfragment} + +Удаляет fragment identifier. Символ решётки тоже удаляется. + +### cutQueryStringAndFragment {#cutquerystringandfragment} + +Удаляет query string и fragment identifier. Знак вопроса и символ решётки тоже удаляются. + +### cutURLParameter(URL, name) {#cuturlparameterurl-name} + +Удаляет параметр URL с именем name, если такой есть. Функция работает при допущении, что имя параметра закодировано в URL в точности таким же образом, что и в переданном аргументе. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/url_functions/) diff --git a/docs/ru/sql-reference/functions/uuid-functions.md b/docs/ru/sql-reference/functions/uuid-functions.md new file mode 100644 index 00000000000..b2b567c6a06 --- /dev/null +++ b/docs/ru/sql-reference/functions/uuid-functions.md @@ -0,0 +1,114 @@ +# Функции для работы с UUID {#funktsii-dlia-raboty-s-uuid} + +## generateUUIDv4 {#uuid-function-generate} + +Генерирует идентификатор [UUID версии 4](https://tools.ietf.org/html/rfc4122#section-4.4). + +``` sql +generateUUIDv4() +``` + +**Возвращаемое значение** + +Значение типа [UUID](../../sql-reference/functions/uuid-functions.md). + +**Пример использования** + +Этот пример демонстрирует, как создать таблицу с UUID-колонкой и добавить в нее сгенерированный UUID. + +``` sql +CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog + +INSERT INTO t_uuid SELECT generateUUIDv4() + +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┐ +│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ +└──────────────────────────────────────┘ +``` + +## toUUID (x) {#touuid-x} + +Преобразует значение типа String в тип UUID. + +``` sql +toUUID(String) +``` + +**Возвращаемое значение** + +Значение типа UUID. + +**Пример использования** + +``` sql +SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid +``` + +``` text +┌─────────────────────────────────uuid─┐ +│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ +└──────────────────────────────────────┘ +``` + +## UUIDStringToNum {#uuidstringtonum} + +Принимает строку, содержащую 36 символов в формате `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, и возвращает в виде набора байт в [FixedString(16)](../../sql-reference/functions/uuid-functions.md). + +``` sql +UUIDStringToNum(String) +``` + +**Возвращаемое значение** + +FixedString(16) + +**Пример использования** + +``` sql +SELECT + '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, + UUIDStringToNum(uuid) AS bytes +``` + +``` text +┌─uuid─────────────────────────────────┬─bytes────────────┐ +│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ +└──────────────────────────────────────┴──────────────────┘ +``` + +## UUIDNumToString {#uuidnumtostring} + +Принимает значение типа [FixedString(16)](../../sql-reference/functions/uuid-functions.md). Возвращает строку из 36 символов в текстовом виде. + +``` sql +UUIDNumToString(FixedString(16)) +``` + +**Возвращаемое значение** + +Значение типа String. + +**Пример использования** + +``` sql +SELECT + 'a/<@];!~p{jTj={)' AS bytes, + UUIDNumToString(toFixedString(bytes, 16)) AS uuid +``` + +``` text +┌─bytes────────────┬─uuid─────────────────────────────────┐ +│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ +└──────────────────┴──────────────────────────────────────┘ +``` + +## См. также: {#sm-takzhe} + +- [dictGetUUID](ext-dict-functions.md) +- [dictGetUUIDOrDefault](ext-dict-functions.md) + +[Original article](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/ru/sql-reference/functions/ym-dict-functions.md b/docs/ru/sql-reference/functions/ym-dict-functions.md new file mode 100644 index 00000000000..16ecba0a1a8 --- /dev/null +++ b/docs/ru/sql-reference/functions/ym-dict-functions.md @@ -0,0 +1,149 @@ +# Функции для работы со словарями Яндекс.Метрики {#ym-dict-functions} + +Чтобы указанные ниже функции работали, в конфиге сервера должны быть указаны пути и адреса для получения всех словарей Яндекс.Метрики. Словари загружаются при первом вызове любой из этих функций. Если справочники не удаётся загрузить - будет выкинуто исключение. + +О том, как создать справочники, смотрите в разделе «Словари». + +## Множественные геобазы {#mnozhestvennye-geobazy} + +ClickHouse поддерживает работу одновременно с несколькими альтернативными геобазами (иерархиями регионов), для того чтобы можно было поддержать разные точки зрения о принадлежности регионов странам. + +В конфиге clickhouse-server указывается файл с иерархией регионов: +`/opt/geo/regions_hierarchy.txt` + +Кроме указанного файла, рядом ищутся файлы, к имени которых (до расширения) добавлен символ \_ и какой угодно суффикс. +Например, также найдётся файл `/opt/geo/regions_hierarchy_ua.txt`, если такой есть. + +`ua` называется ключом словаря. Для словаря без суффикса, ключ является пустой строкой. + +Все словари перезагружаются в рантайме (раз в количество секунд, заданное в конфигурационном параметре builtin\_dictionaries\_reload\_interval, по умолчанию - раз в час), но перечень доступных словарей определяется один раз, при старте сервера. + +Во все функции по работе с регионами, в конце добавлен один необязательный аргумент - ключ словаря. Далее он обозначен как geobase. +Пример: + +``` text +regionToCountry(RegionID) - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt; +regionToCountry(RegionID, '') - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt; +regionToCountry(RegionID, 'ua') - использует словарь для ключа ua: /opt/geo/regions_hierarchy_ua.txt; +``` + +### regionToCity(id\[, geobase\]) {#regiontocityid-geobase} + +Принимает число типа UInt32 - идентификатор региона из геобазы Яндекса. Если регион является городом или входит в некоторый город, то возвращает идентификатор региона - соответствующего города. Иначе возвращает 0. + +### regionToArea(id\[, geobase\]) {#regiontoareaid-geobase} + +Переводит регион в область (тип в геобазе - 5). В остальном, аналогично функции regionToCity. + +``` sql +SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ +│ │ +│ Москва и Московская область │ +│ Санкт-Петербург и Ленинградская область │ +│ Белгородская область │ +│ Ивановская область │ +│ Калужская область │ +│ Костромская область │ +│ Курская область │ +│ Липецкая область │ +│ Орловская область │ +│ Рязанская область │ +│ Смоленская область │ +│ Тамбовская область │ +│ Тверская область │ +│ Тульская область │ +└──────────────────────────────────────────────────────┘ +``` + +### regionToDistrict(id\[, geobase\]) {#regiontodistrictid-geobase} + +Переводит регион в федеральный округ (тип в геобазе - 4). В остальном, аналогично функции regionToCity. + +``` sql +SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ +│ │ +│ Центральный федеральный округ │ +│ Северо-Западный федеральный округ │ +│ Южный федеральный округ │ +│ Северо-Кавказский федеральный округ │ +│ Приволжский федеральный округ │ +│ Уральский федеральный округ │ +│ Сибирский федеральный округ │ +│ Дальневосточный федеральный округ │ +│ Шотландия │ +│ Фарерские острова │ +│ Фламандский регион │ +│ Брюссельский столичный регион │ +│ Валлония │ +│ Федерация Боснии и Герцеговины │ +└──────────────────────────────────────────────────────────┘ +``` + +### regionToCountry(id\[, geobase\]) {#regiontocountryid-geobase} + +Переводит регион в страну. В остальном, аналогично функции regionToCity. +Пример: `regionToCountry(toUInt32(213)) = 225` - преобразовали Москву (213) в Россию (225). + +### regionToContinent(id\[, geobase\]) {#regiontocontinentid-geobase} + +Переводит регион в континент. В остальном, аналогично функции regionToCity. +Пример: `regionToContinent(toUInt32(213)) = 10001` - преобразовали Москву (213) в Евразию (10001). + +### regionToTopContinent (\#regiontotopcontinent) {#regiontotopcontinent-regiontotopcontinent} + +Находит для региона верхний в иерархии континент. + +**Синтаксис** + +``` sql +regionToTopContinent(id[, geobase]); +``` + +**Параметры** + +- `id` — Идентификатор региона из геобазы Яндекса. [UInt32](../../sql-reference/functions/ym-dict-functions.md). +- `geobase` — Ключ словаря. Смотрите [Множественные геобазы](#multiple-geobases). [String](../../sql-reference/functions/ym-dict-functions.md). Опциональный параметр. + +**Возвращаемое значение** + +- Идентификатор континента верхнего уровня (последний при подъеме по иерархии регионов). +- 0, если его нет. + +Тип: `UInt32`. + +### regionToPopulation(id\[, geobase\]) {#regiontopopulationid-geobase} + +Получает население для региона. +Население может быть прописано в файлах с геобазой. Смотрите в разделе «Встроенные словари». +Если для региона не прописано население, возвращается 0. +В геобазе Яндекса, население может быть прописано для дочерних регионов, но не прописано для родительских. + +### regionIn(lhs, rhs\[, geobase\]) {#regioninlhs-rhs-geobase} + +Проверяет принадлежность региона lhs региону rhs. Возвращает число типа UInt8, равное 1, если принадлежит и 0, если не принадлежит. +Отношение рефлексивное - любой регион принадлежит также самому себе. + +### regionHierarchy(id\[, geobase\]) {#regionhierarchyid-geobase} + +Принимает число типа UInt32 - идентификатор региона из геобазы Яндекса. Возвращает массив идентификаторов регионов, состоящий из переданного региона и всех родителей по цепочке. +Пример: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. + +### regionToName(id\[, lang\]) {#regiontonameid-lang} + +Принимает число типа UInt32 - идентификатор региона из геобазы Яндекса. Вторым аргументом может быть передана строка - название языка. Поддерживаются языки ru, en, ua, uk, by, kz, tr. Если второй аргумент отсутствует - используется язык ru. Если язык не поддерживается - кидается исключение. Возвращает строку - название региона на соответствующем языке. Если региона с указанным идентификатором не существует - возвращается пустая строка. + +`ua` и `uk` обозначают одно и то же - украинский язык. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/ym_dict_functions/) diff --git a/docs/ru/sql-reference/index.md b/docs/ru/sql-reference/index.md new file mode 100644 index 00000000000..3dff768cb7e --- /dev/null +++ b/docs/ru/sql-reference/index.md @@ -0,0 +1,16 @@ +--- +toc_folder_title: "\u0421\u043F\u0440\u0430\u0432\u043A\u0430 \u043F\u043E SQL" +toc_hidden: true +toc_priority: 28 +toc_title: hidden +--- + +# Справка по SQL {#spravka-po-sql} + +- [SELECT](statements/select.md) +- [INSERT INTO](statements/insert-into.md) +- [CREATE](statements/create.md) +- [ALTER](statements/alter.md) +- [Прочие виды запросов](statements/misc.md) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/) diff --git a/docs/ru/sql-reference/operators.md b/docs/ru/sql-reference/operators.md new file mode 100644 index 00000000000..85fa861fec5 --- /dev/null +++ b/docs/ru/sql-reference/operators.md @@ -0,0 +1,271 @@ +# Операторы {#operatory} + +Все операторы преобразуются в соответствующие функции на этапе парсинга запроса, с учётом их приоритетов и ассоциативности. +Далее будут перечислены группы операторов в порядке их приоритета (чем выше, тем раньше оператор связывается со своими аргументами). + +## Операторы доступа {#operatory-dostupa} + +`a[N]` - доступ к элементу массива, функция `arrayElement(a, N)`. + +`a.N` - доступ к элементу кортежа, функция `tupleElement(a, N)`. + +## Оператор числового отрицания {#operator-chislovogo-otritsaniia} + +`-a` - функция `negate(a)`. + +## Операторы умножения и деления {#operatory-umnozheniia-i-deleniia} + +`a * b` - функция `multiply(a, b)` + +`a / b` - функция `divide(a, b)` + +`a % b` - функция `modulo(a, b)` + +## Операторы сложения и вычитания {#operatory-slozheniia-i-vychitaniia} + +`a + b` - функция `plus(a, b)` + +`a - b` - функция `minus(a, b)` + +## Операторы сравнения {#operatory-sravneniia} + +`a = b` - функция `equals(a, b)` + +`a == b` - функция `equals(a, b)` + +`a != b` - функция `notEquals(a, b)` + +`a <> b` - функция `notEquals(a, b)` + +`a <= b` - функция `lessOrEquals(a, b)` + +`a >= b` - функция `greaterOrEquals(a, b)` + +`a < b` - функция `less(a, b)` + +`a > b` - функция `greater(a, b)` + +`a LIKE s` - функция `like(a, b)` + +`a NOT LIKE s` - функция `notLike(a, b)` + +`a BETWEEN b AND c` - равнозначно `a >= b AND a <= c` + +`a NOT BETWEEN b AND c` - равнозначно `a < b OR a > c` + +## Операторы для работы с множествами {#operatory-dlia-raboty-s-mnozhestvami} + +*Смотрите раздел [Операторы IN](../sql-reference/statements/select.md#select-in-operators).* + +`a IN ...` - функция `in(a, b)` + +`a NOT IN ...` - функция `notIn(a, b)` + +`a GLOBAL IN ...` - функция `globalIn(a, b)` + +`a GLOBAL NOT IN ...` - функция `globalNotIn(a, b)` + +## Оператор для работы с датами и временем {#operators-datetime} + +### EXTRACT {#extract} + +``` sql +EXTRACT(part FROM date); +``` + +Позволяет извлечь отдельные части из переданной даты. Например, можно получить месяц из даты, или минуты из времени. + +В параметре `part` указывается, какой фрагмент даты нужно получить. Доступные значения: + +- `DAY` — День. Возможные значения: 1–31. +- `MONTH` — Номер месяца. Возможные значения: 1–12. +- `YEAR` — Год. +- `SECOND` — Секунда. Возможные значения: 0–59. +- `MINUTE` — Минута. Возможные значения: 0–59. +- `HOUR` — Час. Возможные значения: 0–23. + +Эти значения могут быть указаны также в нижнем регистре (`day`, `month`). + +В параметре `date` указывается исходная дата. Поддерживаются типы [Date](../sql-reference/data-types/date.md) и [DateTime](../sql-reference/data-types/datetime.md). + +Примеры: + +``` sql +SELECT EXTRACT(DAY FROM toDate('2017-06-15')); +SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); +SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); +``` + +В следующем примере создадим таблицу и добавим в неё значение с типом `DateTime`. + +``` sql +CREATE TABLE test.Orders +( + OrderId UInt64, + OrderName String, + OrderDate DateTime +) +ENGINE = Log; +``` + +``` sql +INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); +``` + +``` sql +SELECT + toYear(OrderDate) AS OrderYear, + toMonth(OrderDate) AS OrderMonth, + toDayOfMonth(OrderDate) AS OrderDay, + toHour(OrderDate) AS OrderHour, + toMinute(OrderDate) AS OrderMinute, + toSecond(OrderDate) AS OrderSecond +FROM test.Orders; +``` + +``` text +┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ +│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ +└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ +``` + +Больше примеров приведено в [тестах](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). + +### INTERVAL {#operator-interval} + +Создаёт значение типа [Interval](../sql-reference/operators.md) которое должно использоваться в арифметических операциях со значениями типов [Date](../sql-reference/operators.md) и [DateTime](../sql-reference/operators.md). + +Типы интервалов: +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +!!! warning "Внимание" + Интервалы различных типов нельзя объединять. Нельзя использовать выражения вида `INTERVAL 4 DAY 1 HOUR`. Вместо этого интервалы можно выразить в единицах меньших или равных наименьшей единице интервала, Например, `INTERVAL 25 HOUR`. Также можно выполнять последовательные операции как показано в примере ниже. + +Пример: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +**Смотрите также** + +- Тип данных [Interval](../sql-reference/operators.md) +- Функции преобразования типов [toInterval](../sql-reference/operators.md#function-tointerval) + +## Оператор логического отрицания {#operator-logicheskogo-otritsaniia} + +`NOT a` - функция `not(a)` + +## Оператор логического ‘И’ {#operator-logicheskogo-i} + +`a AND b` - функция `and(a, b)` + +## Оператор логического ‘ИЛИ’ {#operator-logicheskogo-ili} + +`a OR b` - функция `or(a, b)` + +## Условный оператор {#uslovnyi-operator} + +`a ? b : c` - функция `if(a, b, c)` + +Примечание: + +Условный оператор сначала вычисляет значения b и c, затем проверяет выполнение условия a, и только после этого возвращает соответствующее значение. Если в качестве b или с выступает функция [arrayJoin()](../sql-reference/operators.md#functions_arrayjoin), то размножение каждой строки произойдет вне зависимости от условия а. + +## Условное выражение {#operator_case} + +``` sql +CASE [x] + WHEN a THEN b + [WHEN ... THEN ...] + [ELSE c] +END +``` + +В случае указания `x` - функция `transform(x, [a, ...], [b, ...], c)`. Иначе — `multiIf(a, b, ..., c)`. +При отсутствии секции `ELSE c`, значением по умолчанию будет `NULL`. + +!!! note "Примечание" + Функция `transform` не умеет работать с `NULL`. + +## Оператор склеивания строк {#operator-skleivaniia-strok} + +`s1 || s2` - функция `concat(s1, s2)` + +## Оператор создания лямбда-выражения {#operator-sozdaniia-liambda-vyrazheniia} + +`x -> expr` - функция `lambda(x, expr)` + +Следующие операторы не имеют приоритета, так как представляют собой скобки: + +## Оператор создания массива {#operator-sozdaniia-massiva} + +`[x1, ...]` - функция `array(x1, ...)` + +## Оператор создания кортежа {#operator-sozdaniia-kortezha} + +`(x1, x2, ...)` - функция `tuple(x2, x2, ...)` + +## Ассоциативность {#assotsiativnost} + +Все бинарные операторы имеют левую ассоциативность. Например, `1 + 2 + 3` преобразуется в `plus(plus(1, 2), 3)`. +Иногда это работает не так, как ожидается. Например, `SELECT 4 > 3 > 2` выдаст 0. + +Для эффективности, реализованы функции `and` и `or`, принимающие произвольное количество аргументов. Соответствующие цепочки операторов `AND` и `OR`, преобразуются в один вызов этих функций. + +## Проверка на `NULL` {#proverka-na-null} + +ClickHouse поддерживает операторы `IS NULL` и `IS NOT NULL`. + +### IS NULL {#operator-is-null} + +- Для значений типа [Nullable](../sql-reference/operators.md) оператор `IS NULL` возвращает: + - `1`, если значение — `NULL`. + - `0` в обратном случае. +- Для прочих значений оператор `IS NULL` всегда возвращает `0`. + + + +``` sql +SELECT x+100 FROM t_null WHERE y IS NULL +``` + +``` text +┌─plus(x, 100)─┐ +│ 101 │ +└──────────────┘ +``` + +### IS NOT NULL {#is-not-null} + +- Для значений типа [Nullable](../sql-reference/operators.md) оператор `IS NOT NULL` возвращает: + - `0`, если значение — `NULL`. + - `1`, в обратном случае. +- Для прочих значений оператор `IS NOT NULL` всегда возвращает `1`. + + + +``` sql +SELECT * FROM t_null WHERE y IS NOT NULL +``` + +``` text +┌─x─┬─y─┐ +│ 2 │ 3 │ +└───┴───┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/operators/) diff --git a/docs/ru/sql-reference/statements/alter.md b/docs/ru/sql-reference/statements/alter.md new file mode 100644 index 00000000000..1b35f411df2 --- /dev/null +++ b/docs/ru/sql-reference/statements/alter.md @@ -0,0 +1,505 @@ +--- +toc_priority: 36 +toc_title: ALTER +--- + +## ALTER {#query_language_queries_alter} + +Запрос `ALTER` поддерживается только для таблиц типа `*MergeTree`, а также `Merge` и `Distributed`. Запрос имеет несколько вариантов. + +### Манипуляции со столбцами {#manipuliatsii-so-stolbtsami} + +Изменение структуры таблицы. + +``` sql +ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... +``` + +В запросе указывается список из одного или более действий через запятую. +Каждое действие — операция над столбцом. + +Существуют следующие действия: + +- [ADD COLUMN](#alter_add-column) — добавляет столбец в таблицу; +- [DROP COLUMN](#alter_drop-column) — удаляет столбец; +- [CLEAR COLUMN](#alter_clear-column) — сбрасывает все значения в столбце для заданной партиции; +- [COMMENT COLUMN](#alter_comment-column) — добавляет комментарий к столбцу; +- [MODIFY COLUMN](#alter_modify-column) — изменяет тип столбца, выражение для значения по умолчанию и TTL. + +Подробное описание для каждого действия приведено ниже. + +#### ADD COLUMN {#alter_add-column} + +``` sql +ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] +``` + +Добавляет в таблицу новый столбец с именем `name`, типом `type`, [кодеком](create.md#codecs) `codec` и выражением для умолчания `default_expr` (смотрите раздел [Значения по умолчанию](create.md#create-default-values)). + +Если указано `IF NOT EXISTS`, запрос не будет возвращать ошибку, если столбец уже существует. Если указано `AFTER name_after` (имя другого столбца), то столбец добавляется (в список столбцов таблицы) после указанного. Иначе, столбец добавляется в конец таблицы. Обратите внимание, ClickHouse не позволяет добавлять столбцы в начало таблицы. Для цепочки действий, `name_after` может быть именем столбца, который добавляется в одном из предыдущих действий. + +Добавление столбца всего лишь меняет структуру таблицы, и не производит никаких действий с данными - соответствующие данные не появляются на диске после ALTER-а. При чтении из таблицы, если для какого-либо столбца отсутствуют данные, то он заполняется значениями по умолчанию (выполняя выражение по умолчанию, если такое есть, или нулями, пустыми строками). Также, столбец появляется на диске при слиянии кусков данных (см. [MergeTree](../../sql-reference/statements/alter.md)). + +Такая схема позволяет добиться мгновенной работы запроса `ALTER` и отсутствия необходимости увеличивать объём старых данных. + +Пример: + +``` sql +ALTER TABLE visits ADD COLUMN browser String AFTER user_id +``` + +#### DROP COLUMN {#alter_drop-column} + +``` sql +DROP COLUMN [IF EXISTS] name +``` + +Удаляет столбец с именем `name`. Если указано `IF EXISTS`, запрос не будет возвращать ошибку, если столбца не существует. + +Запрос удаляет данные из файловой системы. Так как это представляет собой удаление целых файлов, запрос выполняется почти мгновенно. + +Пример: + +``` sql +ALTER TABLE visits DROP COLUMN browser +``` + +#### CLEAR COLUMN {#alter_clear-column} + +``` sql +CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name +``` + +Сбрасывает все значения в столбце для заданной партиции. Если указано `IF EXISTS`, запрос не будет возвращать ошибку, если столбца не существует. + +Как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +Пример: + +``` sql +ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() +``` + +#### COMMENT COLUMN {#alter_comment-column} + +``` sql +COMMENT COLUMN [IF EXISTS] name 'Text comment' +``` + +Добавляет комментарий к таблице. Если указано `IF EXISTS`, запрос не будет возвращать ошибку, если столбца не существует. + +Каждый столбец может содержать только один комментарий. При выполнении запроса существующий комментарий заменяется на новый. + +Посмотреть комментарии можно в столбце `comment_expression` из запроса [DESCRIBE TABLE](misc.md#misc-describe-table). + +Пример: + +``` sql +ALTER TABLE visits COMMENT COLUMN browser 'Столбец показывает, из каких браузеров пользователи заходили на сайт.' +``` + +#### MODIFY COLUMN {#alter_modify-column} + +``` sql +MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] +``` + +Запрос изменяет следующие свойства столбца `name`: + +- Тип + +- Значение по умолчанию + +- TTL + + Примеры изменения TTL столбца смотрите в разделе [TTL столбца](../../sql_reference/statements/alter.md#mergetree-column-ttl). + +Если указано `IF EXISTS`, запрос не возвращает ошибку, если столбца не существует. + +При изменении типа, значения преобразуются так, как если бы к ним была применена функция [toType](../../sql-reference/statements/alter.md). Если изменяется только выражение для умолчания, запрос не делает никакой сложной работы и выполняется мгновенно. + +Пример запроса: + +``` sql +ALTER TABLE visits MODIFY COLUMN browser Array(String) +``` + +Изменение типа столбца - это единственное действие, которое выполняет сложную работу - меняет содержимое файлов с данными. Для больших таблиц, выполнение может занять длительное время. + +Выполнение производится в несколько стадий: + +- подготовка временных (новых) файлов с изменёнными данными; +- переименование старых файлов; +- переименование временных (новых) файлов в старые; +- удаление старых файлов. + +Из них, длительной является только первая стадия. Если на этой стадии возникнет сбой, то данные не поменяются. +Если на одной из следующих стадий возникнет сбой, то данные будет можно восстановить вручную. За исключением случаев, когда старые файлы удалены из файловой системы, а данные для новых файлов не доехали на диск и потеряны. + +Запрос `ALTER` на изменение столбцов реплицируется. Соответствующие инструкции сохраняются в ZooKeeper, и затем каждая реплика их применяет. Все запросы `ALTER` выполняются в одном и том же порядке. Запрос ждёт выполнения соответствующих действий на всех репликах. Но при этом, запрос на изменение столбцов в реплицируемой таблице можно прервать, и все действия будут осуществлены асинхронно. + +#### Ограничения запроса ALTER {#ogranicheniia-zaprosa-alter} + +Запрос `ALTER` позволяет создавать и удалять отдельные элементы (столбцы) вложенных структур данных, но не вложенные структуры данных целиком. Для добавления вложенной структуры данных, вы можете добавить столбцы с именем вида `name.nested_name` и типом `Array(T)` - вложенная структура данных полностью эквивалентна нескольким столбцам-массивам с именем, имеющим одинаковый префикс до точки. + +Отсутствует возможность удалять столбцы, входящие в первичный ключ или ключ для сэмплирования (в общем, входящие в выражение `ENGINE`). Изменение типа у столбцов, входящих в первичный ключ возможно только в том случае, если это изменение не приводит к изменению данных (например, разрешено добавление значения в Enum или изменение типа с `DateTime` на `UInt32`). + +Если возможностей запроса `ALTER` не хватает для нужного изменения таблицы, вы можете создать новую таблицу, скопировать туда данные с помощью запроса [INSERT SELECT](insert-into.md#insert_query_insert-select), затем поменять таблицы местами с помощью запроса [RENAME](misc.md#misc_operations-rename), и удалить старую таблицу. В качестве альтернативы для запроса `INSERT SELECT`, можно использовать инструмент [clickhouse-copier](../../sql-reference/statements/alter.md). + +Запрос `ALTER` блокирует все чтения и записи для таблицы. То есть, если на момент запроса `ALTER`, выполнялся долгий `SELECT`, то запрос `ALTER` сначала дождётся его выполнения. И в это время, все новые запросы к той же таблице, будут ждать, пока завершится этот `ALTER`. + +Для таблиц, которые не хранят данные самостоятельно (типа [Merge](../../sql-reference/statements/alter.md) и [Distributed](../../sql-reference/statements/alter.md)), `ALTER` всего лишь меняет структуру таблицы, но не меняет структуру подчинённых таблиц. Для примера, при ALTER-е таблицы типа `Distributed`, вам также потребуется выполнить запрос `ALTER` для таблиц на всех удалённых серверах. + +### Манипуляции с ключевыми выражениями таблиц {#manipuliatsii-s-kliuchevymi-vyrazheniiami-tablits} + +Поддерживается операция: + +``` sql +MODIFY ORDER BY new_expression +``` + +Работает только для таблиц семейства [`MergeTree`](../../sql-reference/statements/alter.md) (в том числе [реплицированных](../../sql-reference/statements/alter.md)). После выполнения запроса +[ключ сортировки](../../sql-reference/statements/alter.md) таблицы +заменяется на `new_expression` (выражение или кортеж выражений). Первичный ключ при этом остаётся прежним. + +Операция затрагивает только метаданные. Чтобы сохранить свойство упорядоченности кусков данных по ключу +сортировки, разрешено добавлять в ключ только новые столбцы (т.е. столбцы, добавляемые командой `ADD COLUMN` +в том же запросе `ALTER`), у которых нет выражения по умолчанию. + +### Манипуляции с индексами {#manipuliatsii-s-indeksami} + +Добавить или удалить индекс можно с помощью операций + +``` sql +ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value [AFTER name] +ALTER TABLE [db].name DROP INDEX name +``` + +Поддерживается только таблицами семейства `*MergeTree`. + +Команда `ADD INDEX` добавляет описание индексов в метаданные, а `DROP INDEX` удаляет индекс из метаданных и стирает файлы индекса с диска, поэтому они легковесные и работают мгновенно. + +Если индекс появился в метаданных, то он начнет считаться в последующих слияниях и записях в таблицу, а не сразу после выполнения операции `ALTER`. + +Запрос на изменение индексов реплицируется, сохраняя новые метаданные в ZooKeeper и применяя изменения на всех репликах. + +### Манипуляции с ограничениями (constraints) {#manipuliatsii-s-ogranicheniiami-constraints} + +Про ограничения подробнее написано [тут](create.md#constraints). + +Добавить или удалить ограничение можно с помощью запросов + +``` sql +ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; +ALTER TABLE [db].name DROP CONSTRAINT constraint_name; +``` + +Запросы выполняют добавление или удаление метаданных об ограничениях таблицы `[db].name`, поэтому выполняются мнгновенно. + +Если ограничение появилось для непустой таблицы, то *проверка ограничения для имеющихся данных не производится*. + +Запрос на изменение ограничений для Replicated таблиц реплицируется, сохраняя новые метаданные в ZooKeeper и применяя изменения на всех репликах. + +### Манипуляции с партициями и кусками {#alter_manipulations-with-partitions} + +Для работы с [партициями](../../sql-reference/statements/alter.md) доступны следующие операции: + +- [DETACH PARTITION](#alter_detach-partition) – перенести партицию в директорию `detached`; +- [DROP PARTITION](#alter_drop-partition) – удалить партицию; +- [ATTACH PARTITION\|PART](#alter_attach-partition) – добавить партицию/кусок в таблицу из директории `detached`; +- [ATTACH PARTITION FROM](#alter_attach-partition-from) – скопировать партицию из другой таблицы; +- [REPLACE PARTITION](#alter_replace-partition) – скопировать партицию из другой таблицы с заменой; +- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - переместить партицию в другую таблицу; +- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) – удалить все значения в столбце для заданной партиции; +- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - очистить построенные вторичные индексы для заданной партиции; +- [FREEZE PARTITION](#alter_freeze-partition) – создать резервную копию партиции; +- [FETCH PARTITION](#alter_fetch-partition) – скачать партицию с другого сервера; +- [MOVE PARTITION\|PART](#alter_move-partition) – переместить партицию/кускок на другой диск или том. + +#### DETACH PARTITION {#alter_detach-partition} + +``` sql +ALTER TABLE table_name DETACH PARTITION partition_expr +``` + +Перемещает заданную партицию в директорию `detached`. Сервер не будет знать об этой партиции до тех пор, пока вы не выполните запрос [ATTACH](#alter_attach-partition). + +Пример: + +``` sql +ALTER TABLE visits DETACH PARTITION 201901 +``` + +Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +После того как запрос будет выполнен, вы сможете производить любые операции с данными в директории `detached`. Например, можно удалить их из файловой системы. + +Запрос реплицируется — данные будут перенесены в директорию `detached` и забыты на всех репликах. Обратите внимание, запрос может быть отправлен только на реплику-лидер. Чтобы узнать, является ли реплика лидером, выполните запрос `SELECT` к системной таблице [system.replicas](../../operations/system-tables.md#system_tables-replicas). Либо можно выполнить запрос `DETACH` на всех репликах — тогда на всех репликах, кроме реплики-лидера, запрос вернет ошибку. + +#### DROP PARTITION {#alter_drop-partition} + +``` sql +ALTER TABLE table_name DROP PARTITION partition_expr +``` + +Удаляет партицию. Партиция помечается как неактивная и будет полностью удалена примерно через 10 минут. + +Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +Запрос реплицируется — данные будут удалены на всех репликах. + +#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} + +``` sql +ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr +``` + +Удаляет из `detached` кусок или все куски, принадлежащие партиции. +Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +#### ATTACH PARTITION\|PART {#alter_attach-partition} + +``` sql +ALTER TABLE table_name ATTACH PARTITION|PART partition_expr +``` + +Добавляет данные в таблицу из директории `detached`. Можно добавить данные как для целой партиции, так и для отдельного куска. Примеры: + +``` sql +ALTER TABLE visits ATTACH PARTITION 201901; +ALTER TABLE visits ATTACH PART 201901_2_2_0; +``` + +Как корректно задать имя партиции или куска, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +Этот запрос реплицируется. Реплика-иницатор проверяет, есть ли данные в директории `detached`. Если данные есть, то запрос проверяет их целостность. В случае успеха данные добавляются в таблицу. Все остальные реплики загружают данные с реплики-инициатора запроса. + +Это означает, что вы можете разместить данные в директории `detached` на одной реплике и с помощью запроса `ALTER ... ATTACH` добавить их в таблицу на всех репликах. + +#### ATTACH PARTITION FROM {#alter_attach-partition-from} + +``` sql +ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 +``` + +Копирует партицию из таблицы `table1` в таблицу `table2` и добавляет к существующим данным `table2`. Данные из `table1` не удаляются. + +Следует иметь в виду: + +- Таблицы должны иметь одинаковую структуру. +- Для таблиц должен быть задан одинаковый ключ партиционирования. + +Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +#### REPLACE PARTITION {#alter_replace-partition} + +``` sql +ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 +``` + +Копирует партицию из таблицы `table1` в таблицу `table2` с заменой существующих данных в `table2`. Данные из `table1` не удаляются. + +Следует иметь в виду: + +- Таблицы должны иметь одинаковую структуру. +- Для таблиц должен быть задан одинаковый ключ партиционирования. + +Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} + +``` sql +ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest +``` + +Перемещает партицию из таблицы `table_source` в таблицу `table_dest` (добавляет к существующим данным в `table_dest`), с удалением данных из таблицы `table_source`. + +Следует иметь в виду: + +- Таблицы должны иметь одинаковую структуру. +- Для таблиц должен быть задан одинаковый ключ партиционирования. + +#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} + +``` sql +ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr +``` + +Сбрасывает все значения в столбце для заданной партиции. Если для столбца определено значение по умолчанию (в секции `DEFAULT`), то будет выставлено это значение. + +Пример: + +``` sql +ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 +``` + +#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} + +``` sql +ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr +``` + +Работает как `CLEAR COLUMN`, но сбрасывает индексы вместо данных в столбцах. + +#### FREEZE PARTITION {#alter_freeze-partition} + +``` sql +ALTER TABLE table_name FREEZE [PARTITION partition_expr] +``` + +Создаёт резервную копию для заданной партиции. Если выражение `PARTITION` опущено, резервные копии будут созданы для всех партиций. + +!!! note "Примечание" + Создание резервной копии не требует остановки сервера. + +Для таблиц старого стиля имя партиций можно задавать в виде префикса (например, ‘2019’). В этом случае резервные копии будут созданы для всех соответствующих партиций. Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). + +Запрос делает следующее — для текущего состояния таблицы он формирует жесткие ссылки на данные в этой таблице. Ссылки размещаются в директории `/var/lib/clickhouse/shadow/N/...`, где: + +- `/var/lib/clickhouse/` — рабочая директория ClickHouse, заданная в конфигурационном файле; +- `N` — инкрементальный номер резервной копии. + +!!! note "Примечание" + При использовании [нескольких дисков для хранения данных таблицы](../../sql-reference/statements/alter.md#table_engine-mergetree-multiple-volumes) директория `shadow/N` появляется на каждом из дисков, на которых были куски, попавшие под выражение `PARTITION`. + +Структура директорий внутри резервной копии такая же, как внутри `/var/lib/clickhouse/`. Запрос выполнит ‘chmod’ для всех файлов, запрещая запись в них. + +Обратите внимание, запрос `ALTER TABLE t FREEZE PARTITION` не реплицируется. Он создает резервную копию только на локальном сервере. После создания резервной копии данные из `/var/lib/clickhouse/shadow/` можно скопировать на удалённый сервер, а локальную копию удалить. + +Резервная копия создается почти мгновенно (однако сначала запрос дожидается завершения всех запросов, которые выполняются для соответствующей таблицы). + +`ALTER TABLE t FREEZE PARTITION` копирует только данные, но не метаданные таблицы. Чтобы сделать резервную копию метаданных таблицы, скопируйте файл `/var/lib/clickhouse/metadata/database/table.sql` + +Чтобы восстановить данные из резервной копии, выполните следующее: + +1. Создайте таблицу, если она ещё не существует. Запрос на создание можно взять из .sql файла (замените в нём `ATTACH` на `CREATE`). +2. Скопируйте данные из директории `data/database/table/` внутри резервной копии в директорию `/var/lib/clickhouse/data/database/table/detached/`. +3. С помощью запросов `ALTER TABLE t ATTACH PARTITION` добавьте данные в таблицу. + +Восстановление данных из резервной копии не требует остановки сервера. + +Подробнее о резервном копировании и восстановлении данных читайте в разделе [Резервное копирование данных](../../operations/backup.md). + +#### FETCH PARTITION {#alter_fetch-partition} + +``` sql +ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' +``` + +Загружает партицию с другого сервера. Этот запрос работает только для реплицированных таблиц. + +Запрос выполняет следующее: + +1. Загружает партицию с указанного шарда. Путь к шарду задается в секции `FROM` (‘path-in-zookeeper’). Обратите внимание, нужно задавать путь к шарду в ZooKeeper. +2. Помещает загруженные данные в директорию `detached` таблицы `table_name`. Чтобы прикрепить эти данные к таблице, используйте запрос [ATTACH PARTITION\|PART](#alter_attach-partition). + +Например: + +``` sql +ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; +ALTER TABLE users ATTACH PARTITION 201902; +``` + +Следует иметь в виду: + +- Запрос `ALTER TABLE t FETCH PARTITION` не реплицируется. Он загружает партицию в директорию `detached` только на локальном сервере. +- Запрос `ALTER TABLE t ATTACH` реплицируется — он добавляет данные в таблицу сразу на всех репликах. На одной из реплик данные будут добавлены из директории `detached`, а на других — из соседних реплик. + +Перед загрузкой данных система проверяет, существует ли партиция и совпадает ли её структура со структурой таблицы. При этом автоматически выбирается наиболее актуальная реплика среди всех живых реплик. + +Несмотря на то что запрос называется `ALTER TABLE`, он не изменяет структуру таблицы и не изменяет сразу доступные данные в таблице. + +#### MOVE PARTITION\|PART {#alter_move-partition} + +Перемещает партицию или кусок данных на другой том или диск для таблиц с движком `MergeTree`. Смотрите [Хранение данных таблицы на нескольких блочных устройствах](../../sql-reference/statements/alter.md#table_engine-mergetree-multiple-volumes). + +``` sql +ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' +``` + +Запрос `ALTER TABLE t MOVE`: + +- Не реплицируется, т.к. на разных репликах могут быть различные конфигурации политик хранения. +- Возвращает ошибку, если указан несконфигурированный том или диск. Ошибка также возвращается в случае невыполнения условий перемещения данных, которые указаны в конфигурации политики хранения. +- Может возвращать ошибку в случае, когда перемещаемые данные уже оказались перемещены в результате фонового процесса, конкурентного запроса `ALTER TABLE t MOVE` или как часть результата фоновой операции слияния. В данном случае никаких дополнительных действий от пользователя не требуется. + +Примеры: + +``` sql +ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' +ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' +``` + +#### Как задавать имя партиции в запросах ALTER {#alter-how-to-specify-part-expr} + +Чтобы задать нужную партицию в запросах `ALTER ... PARTITION`, можно использовать: + +- Имя партиции. Посмотреть имя партиции можно в столбце `partition` системной таблицы [system.parts](../../operations/system-tables.md#system_tables-parts). Например, `ALTER TABLE visits DETACH PARTITION 201901`. +- Произвольное выражение из столбцов исходной таблицы. Также поддерживаются константы и константные выражения. Например, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. +- Строковый идентификатор партиции. Идентификатор партиции используется для именования кусков партиции на файловой системе и в ZooKeeper. В запросах `ALTER` идентификатор партиции нужно указывать в секции `PARTITION ID`, в одинарных кавычках. Например, `ALTER TABLE visits DETACH PARTITION ID '201901'`. +- Для запросов [ATTACH PART](#alter_attach-partition) и [DROP DETACHED PART](#alter_drop-detached): чтобы задать имя куска партиции, используйте строковой литерал со значением из столбца `name` системной таблицы [system.detached\_parts](../../operations/system-tables.md#system_tables-detached_parts). Например, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. + +Использование кавычек в имени партиций зависит от типа данных столбца, по которому задано партиционирование. Например, для столбца с типом `String` имя партиции необходимо указывать в кавычках (одинарных). Для типов `Date` и `Int*` кавычки указывать не нужно. + +Замечание: для таблиц старого стиля партицию можно указывать и как число `201901`, и как строку `'201901'`. Синтаксис для таблиц нового типа более строг к типам (аналогично парсеру входного формата VALUES). + +Правила, сформулированные выше, актуальны также для запросов [OPTIMIZE](misc.md#misc_operations-optimize). Чтобы указать единственную партицию непартиционированной таблицы, укажите `PARTITION tuple()`. Например: + +``` sql +OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; +``` + +Примеры запросов `ALTER ... PARTITION` можно посмотреть в тестах: [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) и [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). + +### Манипуляции с TTL таблицы {#manipuliatsii-s-ttl-tablitsy} + +Вы можете изменить [TTL для таблицы](../../sql-reference/statements/alter.md#mergetree-table-ttl) запросом следующего вида: + +``` sql +ALTER TABLE table-name MODIFY TTL ttl-expression +``` + +### Синхронность запросов ALTER {#sinkhronnost-zaprosov-alter} + +Для нереплицируемых таблиц, все запросы `ALTER` выполняются синхронно. Для реплицируемых таблиц, запрос всего лишь добавляет инструкцию по соответствующим действиям в `ZooKeeper`, а сами действия осуществляются при первой возможности. Но при этом, запрос может ждать завершения выполнения этих действий на всех репликах. + +Для запросов `ALTER ... ATTACH|DETACH|DROP` можно настроить ожидание, с помощью настройки `replication_alter_partitions_sync`. +Возможные значения: `0` - не ждать, `1` - ждать выполнения только у себя (по умолчанию), `2` - ждать всех. + +### Мутации {#alter-mutations} + +Мутации - разновидность запроса ALTER, позволяющая изменять или удалять данные в таблице. В отличие от стандартных запросов `DELETE` и `UPDATE`, рассчитанных на точечное изменение данных, область применения мутаций - достаточно тяжёлые изменения, затрагивающие много строк в таблице. Поддержана для движков таблиц семейства `MergeTree`, в том числе для движков с репликацией. + +Конвертировать существующие таблицы для работы с мутациями не нужно. Но после применения первой мутации формат данных таблицы становится несовместимым с предыдущими версиями и откатиться на предыдущую версию уже не получится. + +На данный момент доступны команды: + +``` sql +ALTER TABLE [db.]table DELETE WHERE filter_expr +``` + +Выражение `filter_expr` должно иметь тип `UInt8`. Запрос удаляет строки таблицы, для которых это выражение принимает ненулевое значение. + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr +``` + +Выражение `filter_expr` должно иметь тип `UInt8`. Запрос изменяет значение указанных столбцов на вычисленное значение соответствующих выражений в каждой строке, для которой `filter_expr` принимает ненулевое значение. Вычисленные значения преобразуются к типу столбца с помощью оператора `CAST`. Изменение столбцов, которые используются при вычислении первичного ключа или ключа партиционирования, не поддерживается. + +``` sql +ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name +``` + +Команда перестроит вторичный индекс `name` для партиции `partition_name`. + +В одном запросе можно указать несколько команд через запятую. + +Для \*MergeTree-таблиц мутации выполняются, перезаписывая данные по кускам (parts). При этом атомарности нет — куски заменяются на помутированные по мере выполнения и запрос `SELECT`, заданный во время выполнения мутации, увидит данные как из измененных кусков, так и из кусков, которые еще не были изменены. + +Мутации линейно упорядочены между собой и накладываются на каждый кусок в порядке добавления. Мутации также упорядочены со вставками - гарантируется, что данные, вставленные в таблицу до начала выполнения запроса мутации, будут изменены, а данные, вставленные после окончания запроса мутации, изменены не будут. При этом мутации никак не блокируют вставки. + +Запрос завершается немедленно после добавления информации о мутации (для реплицированных таблиц - в ZooKeeper, для нереплицированных - на файловую систему). Сама мутация выполняется асинхронно, используя настройки системного профиля. Следить за ходом её выполнения можно по таблице [`system.mutations`](../../operations/system-tables.md#system_tables-mutations). Добавленные мутации будут выполняться до конца даже в случае перезапуска серверов ClickHouse. Откатить мутацию после её добавления нельзя, но если мутация по какой-то причине не может выполниться до конца, её можно остановить с помощью запроса [`KILL MUTATION`](misc.md#kill-mutation). + +Записи о последних выполненных мутациях удаляются не сразу (количество сохраняемых мутаций определяется параметром движка таблиц `finished_mutations_to_keep`). Более старые записи удаляются. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/alter/) diff --git a/docs/ru/sql-reference/statements/create.md b/docs/ru/sql-reference/statements/create.md new file mode 100644 index 00000000000..67d19ad991b --- /dev/null +++ b/docs/ru/sql-reference/statements/create.md @@ -0,0 +1,305 @@ +--- +toc_priority: 35 +toc_title: CREATE +--- + +## CREATE DATABASE {#query-language-create-database} + +Создает базу данных. + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] +``` + +### Секции {#sektsii} + +- `IF NOT EXISTS` + + Если база данных с именем `db_name` уже существует, то ClickHouse не создаёт базу данных и: + - Не генерирует исключение, если секция указана. + - Генерирует исключение, если секция не указана. + +- `ON CLUSTER` + + ClickHouse создаёт базу данных `db_name` на всех серверах указанного кластера. + +- `ENGINE` + + - [MySQL](../../sql_reference/statements/create.md) + + Позволяет получать данные с удаленного сервера MySQL. + + По умолчанию ClickHouse использует собственный [движок баз данных](../../sql_reference/statements/create.md). + +## CREATE TABLE {#create-table-query} + +Запрос `CREATE TABLE` может иметь несколько форм. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], + ... +) ENGINE = engine +``` + +Создаёт таблицу с именем name в БД db или текущей БД, если db не указана, со структурой, указанной в скобках, и движком engine. +Структура таблицы представляет список описаний столбцов. Индексы, если поддерживаются движком, указываются в качестве параметров для движка таблицы. + +Описание столбца, это `name type`, в простейшем случае. Пример: `RegionID UInt32`. +Также могут быть указаны выражения для значений по умолчанию - смотрите ниже. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] +``` + +Создаёт таблицу с такой же структурой, как другая таблица. Можно указать другой движок для таблицы. Если движок не указан, то будет выбран такой же движок, как у таблицы `db2.name2`. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() +``` + +Создаёт таблицу с такой же структурой и данными, как результат соответствующей табличной функцией. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... +``` + +Создаёт таблицу со структурой, как результат запроса `SELECT`, с движком engine, и заполняет её данными из SELECT-а. + +Во всех случаях, если указано `IF NOT EXISTS`, то запрос не будет возвращать ошибку, если таблица уже существует. В этом случае, запрос будет ничего не делать. + +После секции `ENGINE` в запросе могут использоваться и другие секции в зависимости от движка. Подробную документацию по созданию таблиц смотрите в описаниях [движков таблиц](../../sql-reference/statements/create.md#table_engines). + +### Значения по умолчанию {#create-default-values} + +В описании столбца, может быть указано выражение для значения по умолчанию, одного из следующих видов: +`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. +Пример: `URLDomain String DEFAULT domain(URL)`. + +Если выражение для значения по умолчанию не указано, то в качестве значений по умолчанию будут использоваться нули для чисел, пустые строки для строк, пустые массивы для массивов, а также `0000-00-00` для дат и `0000-00-00 00:00:00` для дат с временем. NULL-ы не поддерживаются. + +В случае, если указано выражение по умолчанию, то указание типа столбца не обязательно. При отсутствии явно указанного типа, будет использован тип выражения по умолчанию. Пример: `EventDate DEFAULT toDate(EventTime)` - для столбца EventDate будет использован тип Date. + +При наличии явно указанного типа данных и выражения по умолчанию, это выражение будет приводиться к указанному типу с использованием функций приведения типа. Пример: `Hits UInt32 DEFAULT 0` - имеет такой же смысл, как `Hits UInt32 DEFAULT toUInt32(0)`. + +В качестве выражения для умолчания, может быть указано произвольное выражение от констант и столбцов таблицы. При создании и изменении структуры таблицы, проверяется, что выражения не содержат циклов. При INSERT-е проверяется разрешимость выражений - что все столбцы, из которых их можно вычислить, переданы. + +`DEFAULT expr` + +Обычное значение по умолчанию. Если в запросе INSERT не указан соответствующий столбец, то он будет заполнен путём вычисления соответствующего выражения. + +`MATERIALIZED expr` + +Материализованное выражение. Такой столбец не может быть указан при INSERT, то есть, он всегда вычисляется. +При INSERT без указания списка столбцов, такие столбцы не рассматриваются. +Также этот столбец не подставляется при использовании звёздочки в запросе SELECT. Это необходимо, чтобы сохранить инвариант, что дамп, полученный путём `SELECT *`, можно вставить обратно в таблицу INSERT-ом без указания списка столбцов. + +`ALIAS expr` + +Синоним. Такой столбец вообще не хранится в таблице. +Его значения не могут быть вставлены в таблицу, он не подставляется при использовании звёздочки в запросе SELECT. +Он может быть использован в SELECT-ах - в таком случае, во время разбора запроса, алиас раскрывается. + +При добавлении новых столбцов с помощью запроса ALTER, старые данные для этих столбцов не записываются. Вместо этого, при чтении старых данных, для которых отсутствуют значения новых столбцов, выполняется вычисление выражений по умолчанию на лету. При этом, если выполнение выражения требует использования других столбцов, не указанных в запросе, то эти столбцы будут дополнительно прочитаны, но только для тех блоков данных, для которых это необходимо. + +Если добавить в таблицу новый столбец, а через некоторое время изменить его выражение по умолчанию, то используемые значения для старых данных (для данных, где значения не хранились на диске) поменяются. Также заметим, что при выполнении фоновых слияний, данные для столбцов, отсутствующих в одном из сливаемых кусков, записываются в объединённый кусок. + +Отсутствует возможность задать значения по умолчанию для элементов вложенных структур данных. + +### Ограничения (constraints) {#constraints} + +Наряду с объявлением столбцов можно объявить ограничения на значения в столбцах таблицы: + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + ... + CONSTRAINT constraint_name_1 CHECK boolean_expr_1, + ... +) ENGINE = engine +``` + +`boolean_expr_1` может быть любым булевым выражением, состоящим из операторов сравнения или функций. При наличии одного или нескольких ограничений в момент вставки данных выражения ограничений будут проверяться на истинность для каждой вставляемой строки данных. В случае, если в теле INSERT запроса придут некорректные данные — клиент получит исключение с описанием нарушенного ограничения. + +Добавление большого числа ограничений может негативно повлиять на производительность `INSERT` запросов. + +### Выражение для TTL {#vyrazhenie-dlia-ttl} + +Определяет время хранения значений. Может быть указано только для таблиц семейства MergeTree. Подробнее смотрите в [TTL для столбцов и таблиц](../../sql-reference/statements/create.md#table_engine-mergetree-ttl). + +### Кодеки сжатия столбцов {#codecs} + +По умолчанию, ClickHouse применяет к столбцу метод сжатия, определённый в [конфигурации сервера](../../sql-reference/statements/create.md#compression). Кроме этого, можно задать метод сжатия для каждого отдельного столбца в запросе `CREATE TABLE`. + +``` sql +CREATE TABLE codec_example +( + dt Date CODEC(ZSTD), + ts DateTime CODEC(LZ4HC), + float_value Float32 CODEC(NONE), + double_value Float64 CODEC(LZ4HC(9)) + value Float32 CODEC(Delta, ZSTD) +) +ENGINE = +... +``` + +Если задать кодек для столбца, то кодек по умолчанию не применяется. Кодеки можно последовательно комбинировать, например, `CODEC(Delta, ZSTD)`. Чтобы выбрать наиболее подходящую для вашего проекта комбинацию кодеков, необходимо провести сравнительные тесты, подобные тем, что описаны в статье Altinity [New Encodings to Improve ClickHouse Efficiency](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse). + +!!! warning "Предупреждение" + Нельзя распаковать базу данных ClickHouse с помощью сторонних утилит наподобие `lz4`. Необходимо использовать специальную утилиту [clickhouse-compressor](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor). + +Сжатие поддерживается для следующих движков таблиц: + +- [MergeTree family](../../sql-reference/statements/create.md) +- [Log family](../../sql-reference/statements/create.md) +- [Set](../../sql-reference/statements/create.md) +- [Join](../../sql-reference/statements/create.md) + +ClickHouse поддерживает кодеки общего назначения и специализированные кодеки. + +#### Специализированные кодеки {#create-query-specialized-codecs} + +Эти кодеки разработаны для того, чтобы, используя особенности данных сделать сжатие более эффективным. Некоторые из этих кодеков не сжимают данные самостоятельно. Они готовят данные для кодеков общего назначения, которые сжимают подготовленные данные эффективнее, чем неподготовленные. + +Специализированные кодеки: + +- `Delta(delta_bytes)` — Метод, в котором исходные значения заменяются разностью двух соседних значений, за исключением первого значения, которое остаётся неизменным. Для хранения разниц используется до `delta_bytes`, т.е. `delta_bytes` — это максимальный размер исходных данных. Возможные значения `delta_bytes`: 1, 2, 4, 8. Значение по умолчанию для `delta_bytes` равно `sizeof(type)`, если результат 1, 2, 4, or 8. Во всех других случаях — 1. +- `DoubleDelta` — Вычисляется разницу от разниц и сохраняет её в компакном бинарном виде. Оптимальная степень сжатия достигается для монотонных последовательностей с постоянным шагом, наподобие временных рядов. Можно использовать с любым типом данных фиксированного размера. Реализует алгоритм, используемый в TSDB Gorilla, поддерживает 64-битные типы данных. Использует 1 дополнительный бит для 32-байтовых значений: 5-битные префиксы вместо 4-битных префиксов. Подробнее читайте в разделе «Compressing Time Stamps» документа [Gorilla: A Fast, Scalable, In-Memory Time Series Database](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `Gorilla` — Вычисляет XOR между текущим и предыдущим значением и записывает результат в компактной бинарной форме. Еффективно сохраняет ряды медленно изменяющихся чисел с плавающей запятой, поскольку наилучший коэффициент сжатия достигается, если соседние значения одинаковые. Реализует алгоритм, используемый в TSDB Gorilla, адаптируя его для работы с 64-битными значениями. Подробнее читайте в разделе «Compressing Values» документа [Gorilla: A Fast, Scalable, In-Memory Time Series Database](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `T64` — Метод сжатия который обрезает неиспользуемые старшие биты целочисленных значений (включая `Enum`, `Date` и `DateTime`). На каждом шаге алгоритма, кодек помещает блок из 64 значений в матрицу 64✕64, транспонирует её, обрезает неиспользуемые биты, а то, что осталось возвращает в виде последовательности. Неиспользуемые биты, это биты, которые не изменяются от минимального к максимальному на всём диапазоне значений куска данных. + +Кодеки `DoubleDelta` и `Gorilla` используются в TSDB Gorilla как компоненты алгоритма сжатия. Подход Gorilla эффективен в сценариях, когда данные представляют собой медленно изменяющиеся во времени величины. Метки времени эффективно сжимаются кодеком `DoubleDelta`, а значения кодеком `Gorilla`. Например, чтобы создать эффективно хранящуюся таблицу, используйте следующую конфигурацию: + +``` sql +CREATE TABLE codec_example +( + timestamp DateTime CODEC(DoubleDelta), + slow_values Float32 CODEC(Gorilla) +) +ENGINE = MergeTree() +``` + +#### Кодеки общего назначения {#create-query-common-purpose-codecs} + +Кодеки: + +- `NONE` — без сжатия. +- `LZ4` — [алгоритм сжатия без потерь](https://github.com/lz4/lz4) используемый по умолчанию. Применяет быстрое сжатие LZ4. +- `LZ4HC[(level)]` — алгоритм LZ4 HC (high compression) с настраиваемым уровнем сжатия. Уровень по умолчанию — 9. Настройка `level <= 0` устанавливает уровень сжания по умолчанию. Возможные уровни сжатия: \[1, 12\]. Рекомендуемый диапазон уровней: \[4, 9\]. +- `ZSTD[(level)]` — [алгоритм сжатия ZSTD](https://en.wikipedia.org/wiki/Zstandard) с настраиваемым уровнем сжатия `level`. Возможные уровни сжатия: \[1, 22\]. Уровень сжатия по умолчанию: 1. + +Высокие уровни сжатия полезны для ассимметричных сценариев, подобных «один раз сжал, много раз распаковал». Высокие уровни сжатия подразумеваю лучшее сжатие, но большее использование CPU. + +## Временные таблицы {#vremennye-tablitsy} + +ClickHouse поддерживает временные таблицы со следующими характеристиками: + +- Временные таблицы исчезают после завершения сессии, в том числе при обрыве соединения. +- Временная таблица использует только модуль памяти. +- Невозможно указать базу данных для временной таблицы. Она создается вне баз данных. +- Невозможно создать временную таблицу распределнным DDL запросом на всех серверах кластера (с опцией `ON CLUSTER`): такая таблица существует только в рамках существующей сессии. +- Если временная таблица имеет то же имя, что и некоторая другая, то, при упоминании в запросе без указания БД, будет использована временная таблица. +- При распределённой обработке запроса, используемые в запросе временные таблицы, передаются на удалённые серверы. + +Чтобы создать временную таблицу, используйте следующий синтаксис: + +``` sql +CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) +``` + +В большинстве случаев, временные таблицы создаются не вручную, а при использовании внешних данных для запроса, или при распределённом `(GLOBAL) IN`. Подробнее см. соответствующие разделы + +Вместо временных можно использовать обычные таблицы с [ENGINE = Memory](../../sql-reference/statements/create.md). + +## Распределенные DDL запросы (секция ON CLUSTER) {#raspredelennye-ddl-zaprosy-sektsiia-on-cluster} + +Запросы `CREATE`, `DROP`, `ALTER`, `RENAME` поддерживают возможность распределенного выполнения на кластере. +Например, следующий запрос создает распределенную (Distributed) таблицу `all_hits` на каждом хосте в `cluster`: + +``` sql +CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) +``` + +Для корректного выполнения таких запросов необходимо на каждом хосте иметь одинаковое определение кластера (для упрощения синхронизации конфигов можете использовать подстановки из ZooKeeper). Также необходимо подключение к ZooKeeper серверам. +Локальная версия запроса в конечном итоге будет выполнена на каждом хосте кластера, даже если некоторые хосты в данный момент не доступны. Гарантируется упорядоченность выполнения запросов в рамках одного хоста. + +## CREATE VIEW {#create-view} + +``` sql +CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... +``` + +Создаёт представление. Представления бывают двух видов - обычные и материализованные (MATERIALIZED). + +Обычные представления не хранят никаких данных, а всего лишь производят чтение из другой таблицы. То есть, обычное представление - не более чем сохранённый запрос. При чтении из представления, этот сохранённый запрос, используется в качестве подзапроса в секции FROM. + +Для примера, пусть вы создали представление: + +``` sql +CREATE VIEW view AS SELECT ... +``` + +и написали запрос: + +``` sql +SELECT a, b, c FROM view +``` + +Этот запрос полностью эквивалентен использованию подзапроса: + +``` sql +SELECT a, b, c FROM (SELECT ...) +``` + +Материализованные (MATERIALIZED) представления хранят данные, преобразованные соответствующим запросом SELECT. + +При создании материализованного представления без использования `TO [db].[table]`, нужно обязательно указать ENGINE - движок таблицы для хранения данных. + +При создании материализованного представления с испольованием `TO [db].[table]`, нельзя указывать `POPULATE` + +Материализованное представление устроено следующим образом: при вставке данных в таблицу, указанную в SELECT-е, кусок вставляемых данных преобразуется этим запросом SELECT, и полученный результат вставляется в представление. + +Если указано POPULATE, то при создании представления, в него будут вставлены имеющиеся данные таблицы, как если бы был сделан запрос `CREATE TABLE ... AS SELECT ...` . Иначе, представление будет содержать только данные, вставляемые в таблицу после создания представления. Не рекомендуется использовать POPULATE, так как вставляемые в таблицу данные во время создания представления, не попадут в него. + +Запрос `SELECT` может содержать `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Следует иметь ввиду, что соответствующие преобразования будут выполняться независимо, на каждый блок вставляемых данных. Например, при наличии `GROUP BY`, данные будут агрегироваться при вставке, но только в рамках одной пачки вставляемых данных. Далее, данные не будут доагрегированы. Исключение - использование ENGINE, производящего агрегацию данных самостоятельно, например, `SummingMergeTree`. + +Недоработано выполнение запросов `ALTER` над материализованными представлениями, поэтому они могут быть неудобными для использования. Если материализованное представление использует конструкцию `TO [db.]name`, то можно выполнить `DETACH` представления, `ALTER` для целевой таблицы и последующий `ATTACH` ранее отсоединенного (`DETACH`) представления. + +Представления выглядят так же, как обычные таблицы. Например, они перечисляются в результате запроса `SHOW TABLES`. + +Отсутствует отдельный запрос для удаления представлений. Чтобы удалить представление, следует использовать `DROP TABLE`. + +## CREATE DICTIONARY {#create-dictionary-query} + +``` sql +CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] +( + key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + attr1 type2 [DEFAULT|EXPRESSION expr3], + attr2 type2 [DEFAULT|EXPRESSION expr4] +) +PRIMARY KEY key1, key2 +SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) +LAYOUT(LAYOUT_NAME([param_name param_value])) +LIFETIME([MIN val1] MAX val2) +``` + +Создаёт [внешний словарь](../../sql-reference/statements/create.md) с заданной [структурой](../../sql-reference/statements/create.md), [источником](../../sql-reference/statements/create.md), [способом размещения в памяти](../../sql-reference/statements/create.md) и [периодом обновления](../../sql-reference/statements/create.md). + +Структура внешнего словаря состоит из атрибутов. Атрибуты словаря задаются как столбцы таблицы. Единственным обязательным свойством атрибута является его тип, все остальные свойства могут иметь значения по умолчанию. + +В зависимости от [способа размещения словаря в памяти](../../sql-reference/statements/create.md), ключами словаря могут быть один и более атрибутов. + +Смотрите [Внешние словари](../../sql-reference/statements/create.md). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/create/) diff --git a/docs/ru/sql-reference/statements/index.md b/docs/ru/sql-reference/statements/index.md new file mode 100644 index 00000000000..4dad718d721 --- /dev/null +++ b/docs/ru/sql-reference/statements/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: "\u0412\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u044F" +toc_priority: 31 +--- + + diff --git a/docs/ru/sql-reference/statements/insert-into.md b/docs/ru/sql-reference/statements/insert-into.md new file mode 100644 index 00000000000..e8cea2db739 --- /dev/null +++ b/docs/ru/sql-reference/statements/insert-into.md @@ -0,0 +1,79 @@ +--- +toc_priority: 34 +toc_title: INSERT INTO +--- + +## INSERT {#insert} + +Добавление данных. + +Базовый формат запроса: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... +``` + +В запросе можно указать список столбцов для вставки `[(c1, c2, c3)]`. В этом случае, в остальные столбцы записываются: + +- Значения, вычисляемые из `DEFAULT` выражений, указанных в определении таблицы. +- Нули и пустые строки, если `DEFAULT` не определены. + +Если [strict\_insert\_defaults=1](../../operations/settings/settings.md), то столбцы, для которых не определены `DEFAULT`, необходимо перечислить в запросе. + +В INSERT можно передавать данные любого [формата](../../interfaces/formats.md#formats), который поддерживает ClickHouse. Для этого формат необходимо указать в запросе в явном виде: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT format_name data_set +``` + +Например, следующий формат запроса идентичен базовому варианту INSERT … VALUES: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... +``` + +ClickHouse отсекает все пробелы и один перенос строки (если он есть) перед данными. Рекомендуем при формировании запроса переносить данные на новую строку после операторов запроса (это важно, если данные начинаются с пробелов). + +Пример: + +``` sql +INSERT INTO t FORMAT TabSeparated +11 Hello, world! +22 Qwerty +``` + +С помощью консольного клиента или HTTP интерфейса можно вставлять данные отдельно от запроса. Как это сделать, читайте в разделе «[Интерфейсы](../../interfaces/index.md#interfaces)». + +### Ограничения (constraints) {#ogranicheniia-constraints} + +Если в таблице объявлены [ограничения](create.md#constraints), то их выполнимость будет проверена для каждой вставляемой строки. Если для хотя бы одной строки ограничения не будут выполнены, запрос будет остановлен. + +### Вставка результатов `SELECT` {#insert_query_insert-select} + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... +``` + +Соответствие столбцов определяется их позицией в секции SELECT. При этом, их имена в выражении SELECT и в таблице для INSERT, могут отличаться. При необходимости выполняется приведение типов данных, эквивалентное соответствующему оператору CAST. + +Все форматы данных кроме Values не позволяют использовать в качестве значений выражения, такие как `now()`, `1 + 2` и подобные. Формат Values позволяет ограниченно использовать выражения, но это не рекомендуется, так как в этом случае для их выполнения используется неэффективный вариант кода. + +Не поддерживаются другие запросы на модификацию части данных: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. +Вы можете удалять старые данные с помощью запроса `ALTER TABLE ... DROP PARTITION`. + +Для табличной функции [input()](../table-functions/input.md) после секции `SELECT` должна следовать +секция `FORMAT`. + +### Замечания о производительности {#zamechaniia-o-proizvoditelnosti} + +`INSERT` сортирует входящие данные по первичному ключу и разбивает их на партиции по ключу партиционирования. Если вы вставляете данные в несколько партиций одновременно, то это может значительно снизить производительность запроса `INSERT`. Чтобы избежать этого: + +- Добавляйте данные достаточно большими пачками. Например, по 100 000 строк. +- Группируйте данные по ключу партиционирования самостоятельно перед загрузкой в ClickHouse. + +Снижения производительности не будет, если: + +- Данные поступают в режиме реального времени. +- Вы загружаете данные, которые как правило отсортированы по времени. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/insert_into/) diff --git a/docs/ru/sql-reference/statements/misc.md b/docs/ru/sql-reference/statements/misc.md new file mode 100644 index 00000000000..cdd53843ab4 --- /dev/null +++ b/docs/ru/sql-reference/statements/misc.md @@ -0,0 +1,238 @@ +# Прочие виды запросов {#prochie-vidy-zaprosov} + +## ATTACH {#attach} + +Запрос полностью аналогичен запросу `CREATE`, но: + +- вместо слова `CREATE` используется слово `ATTACH`; +- запрос не создаёт данные на диске, а предполагает, что данные уже лежат в соответствующих местах, и всего лишь добавляет информацию о таблице на сервер. После выполнения запроса `ATTACH` сервер будет знать о существовании таблицы. + +Если таблица перед этим была отсоединена (`DETACH`), т.е. её структура известна, можно использовать сокращенную форму записи без определения структуры. + +``` sql +ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Этот запрос используется при старте сервера. Сервер хранит метаданные таблиц в виде файлов с запросами `ATTACH`, которые он просто исполняет при запуске (за исключением системных таблиц, которые явно создаются на сервере). + +## CHECK TABLE {#check-table} + +Проверяет таблицу на повреждение данных. + +``` sql +CHECK TABLE [db.]name +``` + +Запрос `CHECK TABLE` сравнивает текущие размеры файлов (в которых хранятся данные из колонок) с ожидаемыми значениями. Если значения не совпадают, данные в таблице считаются поврежденными. Искажение возможно, например, из-за сбоя при записи данных. + +Ответ содержит колонку `result`, содержащую одну строку с типом [Boolean](../../sql-reference/data-types/boolean.md). Допустимые значения: + +- 0 - данные в таблице повреждены; +- 1 - данные не повреждены. + +Запрос `CHECK TABLE` поддерживает следующие движки таблиц: + +- [Log](../../engines/table-engines/log-family/log.md) +- [TinyLog](../../engines/table-engines/log-family/tinylog.md) +- [StripeLog](../../engines/table-engines/log-family/stripelog.md) +- [Семейство MergeTree](../../engines/table-engines/mergetree-family/index.md) + +При попытке выполнить запрос с таблицами с другими табличными движками, ClickHouse генерирует исключение. + +В движках `*Log` не предусмотрено автоматическое восстановление данных после сбоя. Используйте запрос `CHECK TABLE`, чтобы своевременно выявлять повреждение данных. + +Для движков из семейства `MergeTree` запрос `CHECK TABLE` показывает статус проверки для каждого отдельного куска данных таблицы на локальном сервере. + +**Что делать, если данные повреждены** + +В этом случае можно скопировать оставшиеся неповрежденные данные в другую таблицу. Для этого: + +1. Создайте новую таблицу с такой же структурой, как у поврежденной таблицы. Для этого выполните запрос `CREATE TABLE AS `. +2. Установите значение параметра [max\_threads](../../operations/settings/settings.md#settings-max_threads) в 1. Это нужно для того, чтобы выполнить следующий запрос в одном потоке. Установить значение параметра можно через запрос: `SET max_threads = 1`. +3. Выполните запрос `INSERT INTO SELECT * FROM `. В результате неповрежденные данные будут скопированы в другую таблицу. Обратите внимание, будут скопированы только те данные, которые следуют до поврежденного участка. +4. Перезапустите `clickhouse-client`, чтобы вернуть предыдущее значение параметра `max_threads`. + +## DESCRIBE TABLE {#misc-describe-table} + +``` sql +DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Возвращает описание столбцов таблицы. + +Результат запроса содержит столбцы (все столбцы имеют тип String): + +- `name` — имя столбца таблицы; +- `type`— тип столбца; +- `default_type` — в каком виде задано [выражение для значения по умолчанию](create.md#create-default-values): `DEFAULT`, `MATERIALIZED` или `ALIAS`. Столбец содержит пустую строку, если значение по умолчанию не задано. +- `default_expression` — значение, заданное в секции `DEFAULT`; +- `comment_expression` — комментарий к столбцу. + +Вложенные структуры данных выводятся в «развёрнутом» виде. То есть, каждый столбец - по отдельности, с именем через точку. + +## DETACH {#detach} + +Удаляет из сервера информацию о таблице name. Сервер перестаёт знать о существовании таблицы. + +``` sql +DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Но ни данные, ни метаданные таблицы не удаляются. При следующем запуске сервера, сервер прочитает метаданные и снова узнает о таблице. +Также, «отцепленную» таблицу можно прицепить заново запросом `ATTACH` (за исключением системных таблиц, для которых метаданные не хранятся). + +Запроса `DETACH DATABASE` нет. + +## DROP {#drop} + +Запрос имеет два вида: `DROP DATABASE` и `DROP TABLE`. + +``` sql +DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] +``` + +Удаляет все таблицы внутри базы данных db, а затем саму базу данных db. +Если указано `IF EXISTS` - не выдавать ошибку, если база данных не существует. + +``` sql +DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Удаляет таблицу. +Если указано `IF EXISTS` - не выдавать ошибку, если таблица не существует или база данных не существует. + +## EXISTS {#exists} + +``` sql +EXISTS [TEMPORARY] TABLE [db.]name [INTO OUTFILE filename] [FORMAT format] +``` + +Возвращает один столбец типа `UInt8`, содержащий одно значение - `0`, если таблицы или БД не существует и `1`, если таблица в указанной БД существует. + +## KILL QUERY {#kill-query} + +``` sql +KILL QUERY [ON CLUSTER cluster] + WHERE + [SYNC|ASYNC|TEST] + [FORMAT format] +``` + +Пытается принудительно остановить исполняющиеся в данный момент запросы. +Запросы для принудительной остановки выбираются из таблицы system.processes с помощью условия, указанного в секции `WHERE` запроса `KILL`. + +Примеры + +``` sql +-- Принудительно останавливает все запросы с указанным query_id: +KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' + +-- Синхронно останавливает все запросы пользователя 'username': +KILL QUERY WHERE user='username' SYNC +``` + +Readonly-пользователи могут останавливать только свои запросы. + +По умолчанию используется асинхронный вариант запроса (`ASYNC`), который не дожидается подтверждения остановки запросов. + +Синхронный вариант (`SYNC`) ожидает остановки всех запросов и построчно выводит информацию о процессах по ходу их остановки. +Ответ содержит колонку `kill_status`, которая может принимать следующие значения: + +1. ‘finished’ - запрос был успешно остановлен; +2. ‘waiting’ - запросу отправлен сигнал завершения, ожидается его остановка; +3. остальные значения описывают причину невозможности остановки запроса. + +Тестовый вариант запроса (`TEST`) только проверяет права пользователя и выводит список запросов для остановки. + +## KILL MUTATION {#kill-mutation} + +``` sql +KILL MUTATION [ON CLUSTER cluster] + WHERE + [TEST] + [FORMAT format] +``` + +Пытается остановить выполняющиеся в данные момент [мутации](alter.md#alter-mutations). Мутации для остановки выбираются из таблицы [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) с помощью условия, указанного в секции `WHERE` запроса `KILL`. + +Тестовый вариант запроса (`TEST`) только проверяет права пользователя и выводит список запросов для остановки. + +Примеры: + +``` sql +-- Останавливает все мутации одной таблицы: +KILL MUTATION WHERE database = 'default' AND table = 'table' + +-- Останавливает конкретную мутацию: +KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' +``` + +Запрос полезен в случаях, когда мутация не может выполниться до конца (например, если функция в запросе мутации бросает исключение на данных таблицы). + +Данные, уже изменённые мутацией, остаются в таблице (отката на старую версию данных не происходит). + +## OPTIMIZE {#misc_operations-optimize} + +``` sql +OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] +``` + +Запрос пытается запустить внеплановый мёрж кусков данных для таблиц семейства [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). Другие движки таблиц не поддерживаются. + +Если `OPTIMIZE` применяется к таблицам семейства [ReplicatedMergeTree](../../engines/table-engines/mergetree-family/replication.md), ClickHouse создаёт задачу на мёрж и ожидает её исполнения на всех узлах (если активирована настройка `replication_alter_partitions_sync`). + +- Если `OPTIMIZE` не выполняет мёрж по любой причине, ClickHouse не оповещает об этом клиента. Чтобы включить оповещения, используйте настройку [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop). +- Если указать `PARTITION`, то оптимизация выполняется только для указанной партиции. [Как задавать имя партиции в запросах](alter.md#alter-how-to-specify-part-expr). +- Если указать `FINAL`, то оптимизация выполняется даже в том случае, если все данные уже лежат в одном куске. +- Если указать `DEDUPLICATE`, то произойдет схлопывание полностью одинаковых строк (сравниваются значения во всех колонках), имеет смысл только для движка MergeTree. + +!!! warning "Внимание" + Запрос `OPTIMIZE` не может устранить причину появления ошибки «Too many parts». + +## RENAME {#misc_operations-rename} + +Переименовывает одну или несколько таблиц. + +``` sql +RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] +``` + +Все таблицы переименовываются под глобальной блокировкой. Переименовывание таблицы является лёгкой операцией. Если вы указали после TO другую базу данных, то таблица будет перенесена в эту базу данных. При этом, директории с базами данных должны быть расположены в одной файловой системе (иначе возвращается ошибка). + +## SET {#query-set} + +``` sql +SET param = value +``` + +Устанавливает значение `value` для [настройки](../../operations/settings/index.md) `param` в текущей сессии. [Конфигурационные параметры сервера](../../operations/server-configuration-parameters/settings.md) нельзя изменить подобным образом. + +Можно одним запросом установить все настройки из заданного профиля настроек. + +``` sql +SET profile = 'profile-name-from-the-settings-file' +``` + +Подробности смотрите в разделе [Настройки](../../operations/settings/settings.md). + +## TRUNCATE {#truncate} + +``` sql +TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Удаляет все данные из таблицы. Если условие `IF EXISTS` не указано, запрос вернет ошибку, если таблицы не существует. + +Запрос `TRUNCATE` не поддерживается для следующих движков: [View](../../engines/table-engines/special/view.md), [File](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md) и [Null](../../engines/table-engines/special/null.md). + +## USE {#use} + +``` sql +USE db +``` + +Позволяет установить текущую базу данных для сессии. +Текущая база данных используется для поиска таблиц, если база данных не указана в запросе явно через точку перед именем таблицы. +При использовании HTTP протокола запрос не может быть выполнен, так как понятия сессии не существует. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/misc/) diff --git a/docs/ru/sql-reference/statements/select.md b/docs/ru/sql-reference/statements/select.md new file mode 100644 index 00000000000..d3683688aa2 --- /dev/null +++ b/docs/ru/sql-reference/statements/select.md @@ -0,0 +1,1406 @@ +--- +toc_priority: 33 +toc_title: SELECT +--- + +# Синтаксис запросов SELECT {#sintaksis-zaprosov-select} + +`SELECT` осуществляет выборку данных. + +``` sql +[WITH expr_list|(subquery)] +SELECT [DISTINCT] expr_list +[FROM [db.]table | (subquery) | table_function] [FINAL] +[SAMPLE sample_coeff] +[ARRAY JOIN ...] +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list +[PREWHERE expr] +[WHERE expr] +[GROUP BY expr_list] [WITH TOTALS] +[HAVING expr] +[ORDER BY expr_list] +[LIMIT [offset_value, ]n BY columns] +[LIMIT [n, ]m] +[UNION ALL ...] +[INTO OUTFILE filename] +[FORMAT format] +``` + +Все секции, кроме списка выражений сразу после SELECT, являются необязательными. +Ниже секции будут описаны в порядке, почти соответствующем конвейеру выполнения запроса. + +Если в запросе отсутствуют секции `DISTINCT`, `GROUP BY`, `ORDER BY`, подзапросы в `IN` и `JOIN`, то запрос будет обработан полностью потоково, с использованием O(1) количества оперативки. +Иначе запрос может съесть много оперативки, если не указаны подходящие ограничения `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Подробнее смотрите в разделе «Настройки». Присутствует возможность использовать внешнюю сортировку (с сохранением временных данных на диск) и внешнюю агрегацию. `Merge join` в системе нет. + +### Секция WITH {#sektsiia-with} + +Данная секция представляет собой [CTE](https://ru.wikipedia.org/wiki/Иерархические_и_рекурсивные_запросы_в_SQL), с рядом ограничений: +1. Рекурсивные запросы не поддерживаются +2. Если в качестве выражения используется подзапрос, то результат должен содержать ровно одну строку +3. Результаты выражений нельзя переиспользовать во вложенных запросах +В дальнейшем, результаты выражений можно использовать в секции SELECT. + +Пример 1: Использование константного выражения как «переменной» + +``` sql +WITH '2019-08-01 15:23:00' as ts_upper_bound +SELECT * +FROM hits +WHERE + EventDate = toDate(ts_upper_bound) AND + EventTime <= ts_upper_bound +``` + +Пример 2: Выкидывание выражения sum(bytes) из списка колонок в SELECT + +``` sql +WITH sum(bytes) as s +SELECT + formatReadableSize(s), + table +FROM system.parts +GROUP BY table +ORDER BY s +``` + +Пример 3: Использование результатов скалярного подзапроса + +``` sql +/* запрос покажет TOP 10 самых больших таблиц */ +WITH + ( + SELECT sum(bytes) + FROM system.parts + WHERE active + ) AS total_disk_usage +SELECT + (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, + table +FROM system.parts +GROUP BY table +ORDER BY table_disk_usage DESC +LIMIT 10 +``` + +Пример 4: Переиспользование выражения +В настоящий момент, переиспользование выражения из секции WITH внутри подзапроса возможно только через дублирование. + +``` sql +WITH ['hello'] AS hello +SELECT + hello, + * +FROM +( + WITH ['hello'] AS hello + SELECT hello +) +``` + +``` text +┌─hello─────┬─hello─────┐ +│ ['hello'] │ ['hello'] │ +└───────────┴───────────┘ +``` + +### Секция FROM {#select-from} + +Если секция FROM отсутствует, то данные будут читаться из таблицы `system.one`. +Таблица `system.one` содержит ровно одну строку (то есть, эта таблица выполняет такую же роль, как таблица DUAL, которую можно найти в других СУБД). + +Cекция `FROM` определяет источник данных: + +- Таблица +- Подзапрос +- [Табличная функция](../../sql-reference/statements/select.md) + +Также могут присутствовать `ARRAY JOIN` и обычный `JOIN` (смотрите ниже). + +Вместо таблицы, может быть указан подзапрос `SELECT` в скобках. +В отличие от стандартного SQL, после подзапроса не обязательно указывать его синоним. + +Для выполнения запроса, из соответствующей таблицы, вынимаются все столбцы, перечисленные в запросе. Из подзапросов выкидываются столбцы, не нужные для внешнего запроса. +Если в запросе не перечислено ни одного столбца (например, `SELECT count() FROM t`), то из таблицы всё равно вынимается один какой-нибудь столбец (предпочитается самый маленький), для того, чтобы можно было посчитать количество строк. + +Модификатор `FINAL` может быть использован в запросе `SELECT` из таблиц семейства [MergeTree](../../engines/table-engines/mergetree-family/index.md). При указании `FINAL`, данные будут выбираться полностью «домерженными». Стоит учитывать, что использование `FINAL` приводит к чтению также столбцов, относящихся к первичному ключу. Также, запрос будет выполняться в один поток, и при выполнении запроса будет выполняться слияние данных. Это приводит к тому, что при использовании `FINAL`, запрос выполняется медленнее. В большинстве случаев, следует избегать использования `FINAL`. +Модификатор `FINAL` может быть использован для всех таблиц семейства `MergeTree`, которые производят преобразования данных в процессе фоновых слияний (кроме GraphiteMergeTree). + +#### FINAL Modifier {#select-from-final} + +Применим при выборке данных из таблиц с движками таблиц семейства [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)), кроме `GraphiteMergeTree`. Если в запросе используется `FINAL`, то ClickHouse полностью мёржит данные перед выдачей результата, таким образом выполняя все преобразования данных, которые производятся движком таблиц при мёржах. + +Также поддержан для движков: + +- [Replicated](../../engines/table-engines/mergetree-family/replication.md)-версий `MergeTree`. +- [View](../../engines/table-engines/special/view.md), [Buffer](../../engines/table-engines/special/buffer.md), [Distributed](../../engines/table-engines/special/distributed.md), и [MaterializedView](../../engines/table-engines/special/materializedview.md), которые работают поверх других движков, если они созданы для таблиц с движками семейства `MergeTree`. + +Запросы, использующие `FINAL` исполняются медленнее аналогичных запросов без `FINAL`, поскольку: + +- Запрос исполняется в один поток и данные мёржатся в процессе выполнения. +- Запросы с модификатором `FINAL` дополнительно к столбцам, указанным в запросе, читают столбцы первичного ключа. + +По возможности не используйте модификатор `FINAL`. + +### Секция SAMPLE {#select-sample-clause} + +Секция `SAMPLE` позволяет выполнять запросы приближённо. Например, чтобы посчитать статистику по всем визитам, можно обработать 1/10 всех визитов и результат домножить на 10. + +Сэмплирование имеет смысл, когда: + +1. Точность результата не важна, например, для оценочных расчетов. +2. Возможности аппаратной части не позволяют соответствовать строгим критериям. Например, время ответа должно быть \<100 мс. При этом точность расчета имеет более низкий приоритет. +3. Точность результата участвует в бизнес-модели сервиса. Например, пользователи с бесплатной подпиской на сервис могут получать отчеты с меньшей точностью, чем пользователи с премиум подпиской. + +!!! note "Внимание" + Не стоит использовать сэмплирование в тех задачах, где важна точность расчетов. Например, при работе с финансовыми отчетами. + +Свойства сэмплирования: + +- Сэмплирование работает детерминированно. При многократном выполнении одного и того же запроса `SELECT .. SAMPLE`, результат всегда будет одинаковым. +- Сэмплирование поддерживает консистентность для разных таблиц. Имеется в виду, что для таблиц с одним и тем же ключом сэмплирования, подмножество данных в выборках будет одинаковым (выборки при этом должны быть сформированы для одинаковой доли данных). Например, выборка по идентификаторам посетителей выберет из разных таблиц строки с одинаковым подмножеством всех возможных идентификаторов. Это свойство позволяет использовать выборки в подзапросах в секции [IN](#select-in-operators), а также объединять выборки с помощью [JOIN](#select-join). +- Сэмплирование позволяет читать меньше данных с диска. Обратите внимание, для этого необходимо корректно указать ключ сэмплирования. Подробнее см. в разделе [Создание таблицы MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). + +Сэмплирование поддерживается только таблицами семейства [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table) и только в том случае, если для таблиц был указан ключ сэмплирования (выражение, на основе которого должна производиться выборка). Подробнее см. в разделе [Создание таблиц MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). + +Выражение `SAMPLE` в запросе можно задать следующими способами: + +| Способ задания SAMPLE | Описание | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `SAMPLE k` | Здесь `k` – это дробное число в интервале от 0 до 1.
Запрос будет выполнен по `k` доле данных. Например, если указано `SAMPLE 1/10`, то запрос будет выполнен для выборки из 1/10 данных. [Подробнее](#select-sample-k) | +| `SAMPLE n` | Здесь `n` – это достаточно большое целое число.
Запрос будет выполнен для выборки, состоящей из не менее чем `n` строк. Например, если указано `SAMPLE 10000000`, то запрос будет выполнен для не менее чем 10,000,000 строк. [Подробнее](#select-sample-n) | +| `SAMPLE k OFFSET m` | Здесь `k` и `m` – числа от 0 до 1.
Запрос будет выполнен по `k` доле данных. При этом выборка будет сформирована со смещением на `m` долю. [Подробнее](#select-sample-offset) | + +#### SAMPLE k {#select-sample-k} + +Здесь `k` – число в интервале от 0 до 1. Поддерживается как дробная, так и десятичная форма записи. Например, `SAMPLE 1/2` или `SAMPLE 0.5`. + +Если задано выражение `SAMPLE k`, запрос будет выполнен для `k` доли данных. Рассмотрим пример: + +``` sql +SELECT + Title, + count() * 10 AS PageViews +FROM hits_distributed +SAMPLE 0.1 +WHERE + CounterID = 34 +GROUP BY Title +ORDER BY PageViews DESC LIMIT 1000 +``` + +В этом примере запрос выполняется по выборке из 0.1 (10%) данных. Значения агрегатных функций не корректируются автоматически, поэтому чтобы получить приближённый результат, значение `count()` нужно вручную умножить на 10. + +Выборка с указанием относительного коэффициента является «согласованной»: для таблиц с одним и тем же ключом сэмплирования, выборка с одинаковой относительной долей всегда будет составлять одно и то же подмножество данных. То есть выборка из разных таблиц, на разных серверах, в разное время, формируется одинаковым образом. + +#### SAMPLE n {#select-sample-n} + +Здесь `n` – это достаточно большое целое число. Например, `SAMPLE 10000000`. + +Если задано выражение `SAMPLE n`, запрос будет выполнен для выборки из не менее `n` строк (но не значительно больше этого значения). Например, если задать `SAMPLE 10000000`, в выборку попадут не менее 10,000,000 строк. + +!!! note "Примечание" + Следует иметь в виду, что `n` должно быть достаточно большим числом. Так как минимальной единицей данных для чтения является одна гранула (её размер задаётся настройкой `index_granularity` для таблицы), имеет смысл создавать выборки, размер которых существенно превосходит размер гранулы. + +При выполнении `SAMPLE n` коэффициент сэмплирования заранее неизвестен (то есть нет информации о том, относительно какого количества данных будет сформирована выборка). Чтобы узнать коэффициент сэмплирования, используйте столбец `_sample_factor`. + +Виртуальный столбец `_sample_factor` автоматически создается в тех таблицах, для которых задано выражение `SAMPLE BY` (подробнее см. в разделе [Создание таблицы MergeTree](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table)). В столбце содержится коэффициент сэмплирования для таблицы – он рассчитывается динамически по мере добавления данных в таблицу. Ниже приведены примеры использования столбца `_sample_factor`. + +Предположим, у нас есть таблица, в которой ведется статистика посещений сайта. Пример ниже показывает, как рассчитать суммарное число просмотров: + +``` sql +SELECT sum(PageViews * _sample_factor) +FROM visits +SAMPLE 10000000 +``` + +Следующий пример показывает, как посчитать общее число визитов: + +``` sql +SELECT sum(_sample_factor) +FROM visits +SAMPLE 10000000 +``` + +В примере ниже рассчитывается среднее время на сайте. Обратите внимание, при расчете средних значений, умножать результат на коэффициент сэмплирования не нужно. + +``` sql +SELECT avg(Duration) +FROM visits +SAMPLE 10000000 +``` + +#### SAMPLE k OFFSET m {#select-sample-offset} + +Здесь `k` и `m` – числа в интервале от 0 до 1. Например, `SAMPLE 0.1 OFFSET 0.5`. Поддерживается как дробная, так и десятичная форма записи. + +При задании `SAMPLE k OFFSET m`, выборка будет сформирована из `k` доли данных со смещением на долю `m`. Примеры приведены ниже. + +**Пример 1** + +``` sql +SAMPLE 1/10 +``` + +В этом примере выборка будет сформирована по 1/10 доле всех данных: + +`[++------------------]` + +**Пример 2** + +``` sql +SAMPLE 1/10 OFFSET 1/2 +``` + +Здесь выборка, которая состоит из 1/10 доли данных, взята из второй половины данных. + +`[----------++--------]` + +### Секция ARRAY JOIN {#select-array-join-clause} + +Позволяет выполнить `JOIN` с массивом или вложенной структурой данных. Смысл похож на функцию [arrayJoin](../../sql-reference/statements/select.md#functions_arrayjoin), но функциональность более широкая. + +``` sql +SELECT +FROM +[LEFT] ARRAY JOIN +[WHERE|PREWHERE ] +... +``` + +В запросе может быть указано не более одной секции `ARRAY JOIN`. + +При использовании `ARRAY JOIN`, порядок выполнения запроса оптимизируется. Несмотря на то что секция `ARRAY JOIN` всегда указывается перед выражением `WHERE / PREWHERE`, преобразование `JOIN` может быть выполнено как до выполнения выражения `WHERE / PREWHERE` (если результат необходим в этом выражении), так и после (чтобы уменьшить объём расчетов). Порядок обработки контролируется оптимизатором запросов. + +Секция `ARRAY JOIN` поддерживает следующие формы записи: + +- `ARRAY JOIN` — в этом случае результат `JOIN` не будет содержать пустые массивы; +- `LEFT ARRAY JOIN` — пустые массивы попадут в результат выполнения `JOIN`. В качестве значения для пустых массивов устанавливается значение по умолчанию. Обычно это 0, пустая строка или NULL, в зависимости от типа элементов массива. + +Рассмотрим примеры использования `ARRAY JOIN` и `LEFT ARRAY JOIN`. Для начала создадим таблицу, содержащую столбец с типом [Array](../../sql-reference/statements/select.md), и добавим в него значение: + +``` sql +CREATE TABLE arrays_test +( + s String, + arr Array(UInt8) +) ENGINE = Memory; + +INSERT INTO arrays_test +VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); +``` + +``` text +┌─s───────────┬─arr─────┐ +│ Hello │ [1,2] │ +│ World │ [3,4,5] │ +│ Goodbye │ [] │ +└─────────────┴─────────┘ +``` + +В примере ниже используется `ARRAY JOIN`: + +``` sql +SELECT s, arr +FROM arrays_test +ARRAY JOIN arr; +``` + +``` text +┌─s─────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +└───────┴─────┘ +``` + +Следующий пример использует `LEFT ARRAY JOIN`: + +``` sql +SELECT s, arr +FROM arrays_test +LEFT ARRAY JOIN arr; +``` + +``` text +┌─s───────────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +│ Goodbye │ 0 │ +└─────────────┴─────┘ +``` + +#### Использование алиасов {#ispolzovanie-aliasov} + +Для массива в секции `ARRAY JOIN` может быть указан алиас. В этом случае, элемент массива будет доступен под этим алиасом, а сам массив — под исходным именем. Пример: + +``` sql +SELECT s, arr, a +FROM arrays_test +ARRAY JOIN arr AS a; +``` + +``` text +┌─s─────┬─arr─────┬─a─┐ +│ Hello │ [1,2] │ 1 │ +│ Hello │ [1,2] │ 2 │ +│ World │ [3,4,5] │ 3 │ +│ World │ [3,4,5] │ 4 │ +│ World │ [3,4,5] │ 5 │ +└───────┴─────────┴───┘ +``` + +Используя алиасы, можно выполнять `JOIN` с внешними массивами: + +``` sql +SELECT s, arr_external +FROM arrays_test +ARRAY JOIN [1, 2, 3] AS arr_external; +``` + +``` text +┌─s───────────┬─arr_external─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ Hello │ 3 │ +│ World │ 1 │ +│ World │ 2 │ +│ World │ 3 │ +│ Goodbye │ 1 │ +│ Goodbye │ 2 │ +│ Goodbye │ 3 │ +└─────────────┴──────────────┘ +``` + +В секции `ARRAY JOIN` можно указать через запятую сразу несколько массивов. В этом случае, `JOIN` делается с ними одновременно (прямая сумма, а не прямое произведение). Обратите внимание, массивы должны быть одинаковых размеров. Примеры: + +``` sql +SELECT s, arr, a, num, mapped +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ +│ Hello │ [1,2] │ 1 │ 1 │ 2 │ +│ Hello │ [1,2] │ 2 │ 2 │ 3 │ +│ World │ [3,4,5] │ 3 │ 1 │ 4 │ +│ World │ [3,4,5] │ 4 │ 2 │ 5 │ +│ World │ [3,4,5] │ 5 │ 3 │ 6 │ +└───────┴─────────┴───┴─────┴────────┘ +``` + +В примере ниже используется функция [arrayEnumerate](../../sql-reference/statements/select.md#array_functions-arrayenumerate): + +``` sql +SELECT s, arr, a, num, arrayEnumerate(arr) +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ +│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ +│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ +│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ +│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ +│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ +└───────┴─────────┴───┴─────┴─────────────────────┘ +``` + +#### ARRAY JOIN с вложенными структурами данных {#array-join-s-vlozhennymi-strukturami-dannykh} + +`ARRAY JOIN` также работает с [вложенными структурами данных](../../sql-reference/statements/select.md). Пример: + +``` sql +CREATE TABLE nested_test +( + s String, + nest Nested( + x UInt8, + y UInt32) +) ENGINE = Memory; + +INSERT INTO nested_test +VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); +``` + +``` text +┌─s───────┬─nest.x──┬─nest.y─────┐ +│ Hello │ [1,2] │ [10,20] │ +│ World │ [3,4,5] │ [30,40,50] │ +│ Goodbye │ [] │ [] │ +└─────────┴─────────┴────────────┘ +``` + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +При указании имени вложенной структуры данных в `ARRAY JOIN`, смысл такой же, как `ARRAY JOIN` со всеми элементами-массивами, из которых она состоит. Пример: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`, `nest.y`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +Такой вариант тоже имеет смысл: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─────┐ +│ Hello │ 1 │ [10,20] │ +│ Hello │ 2 │ [10,20] │ +│ World │ 3 │ [30,40,50] │ +│ World │ 4 │ [30,40,50] │ +│ World │ 5 │ [30,40,50] │ +└───────┴────────┴────────────┘ +``` + +Алиас для вложенной структуры данных можно использовать, чтобы выбрать как результат `JOIN`-а, так и исходный массив. Пример: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest AS n; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ +└───────┴─────┴─────┴─────────┴────────────┘ +``` + +Пример использования функции [arrayEnumerate](../../sql-reference/statements/select.md#array_functions-arrayenumerate): + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num +FROM nested_test +ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ +└───────┴─────┴─────┴─────────┴────────────┴─────┘ +``` + +### Секция JOIN {#select-join} + +Соединяет данные в привычном для [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) смысле. + +!!! info "Примечание" + Не связана с функциональностью [ARRAY JOIN](#select-array-join-clause). + +``` sql +SELECT +FROM +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN +(ON )|(USING ) ... +``` + +Вместо `` и `` можно указать имена таблиц. Это эквивалентно подзапросу `SELECT * FROM table`, за исключением особого случая таблицы с движком [Join](../../sql-reference/statements/select.md) – массива, подготовленного для присоединения. + +#### Поддерживаемые типы `JOIN` {#select-join-types} + +- `INNER JOIN` (or `JOIN`) +- `LEFT JOIN` (or `LEFT OUTER JOIN`) +- `RIGHT JOIN` (or `RIGHT OUTER JOIN`) +- `FULL JOIN` (or `FULL OUTER JOIN`) +- `CROSS JOIN` (or `,` ) + +Смотрите описание стандартного [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)). + +#### Множественный JOIN {#mnozhestvennyi-join} + +При выполнении запросов, ClickHouse перезаписывает множественный `JOIN` как комбинацию двух-табличных объединений и обрабатывает их последовательно. Например, если необходимо объединить четыре таблицы, ClickHouse объединяет первую и вторую таблицы, затем соединяет результат с третьей, а затем с четвертой. + +Если запрос содержит секцию `WHERE`, ClickHouse пытается пробросить фильтры из этой секции в промежуточный `JOIN`. Если он не может пробросить фильтр в каждый промежуточный `JOIN`, ClickHouse применяет фильтры после того, как все `JOIN` будут выполнены. + +Для создания запросов мы рекомендуем использовать синтаксис `JOIN ON` или `JOIN USING`. Например: + +``` sql +SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a +``` + +В секции `FROM` вы можете использовать разделенные запятыми списки таблиц для объединения. Например: + +``` sql +SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a +``` + +Не смешивайте синтаксисы. + +ClickHouse не поддерживает синтаксис с запятыми напрямую и мы не рекомендуем его использовать. Алгоритм пытается переписать запрос с помощью секций `CROSS JOIN` и `INNER JOIN` и затем продолжает его выполнение. При переписывании запроса, ClickHouse пытается оптимизировать производительность и потребление памяти. По умолчанию, ClickHouse трактует запятые как `INNER JOIN` и конвертирует их в `CROSS JOIN` когда не может гарантировать, что `INNER JOIN` возвращает запрошенные данные. + +#### Строгость {#select-join-strictness} + +- `ALL` — если правая таблица содержит несколько подходящих строк, то ClickHouse выполняет их [декартово произведение](https://ru.wikipedia.org/wiki/Прямое_произведение). Это стандартное поведение `JOIN` в SQL. +- `ANY` — если в правой таблице несколько соответствующих строк, то присоединяется только первая найденная. Если в правой таблице есть только одна подходящая строка, то результаты `ANY` и `ALL` совпадают. +- `ASOF` — для объединения последовательностей с нечётким совпадением. `ASOF JOIN` описан ниже по тексту. + +**Использование ASOF JOIN** + +`ASOF JOIN` применим в том случае, когда необходимо объединять записи, которые не имеют точного совпадения. + +Таблицы для `ASOF JOIN` должны иметь столбец с отсортированной последовательностью. Этот столбец не может быть единственным в таблице и должен быть одного из типов: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date` и `DateTime`. + +Синтаксис `ASOF JOIN ... ON`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF LEFT JOIN table_2 +ON equi_cond AND closest_match_cond +``` + +Можно использовать произвольное количество условий равенства и одно условие на ближайшее совпадение. Например, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. + +Условия, поддержанные для проверки на ближайшее совпадение: `>`, `>=`, `<`, `<=`. + +Синтаксис `ASOF JOIN ... USING`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF JOIN table_2 +USING (equi_column1, ... equi_columnN, asof_column) +``` + +Для слияния по равенству `ASOF JOIN` использует `equi_columnX`, а для слияния по ближайшему совпадению использует `asof_column` с условием `table_1.asof_column >= table_2.asof_column`. Столбец `asof_column` должен быть последним в секции `USING`. + +Например, рассмотрим следующие таблицы: + + table_1 table_2 + event | ev_time | user_id event | ev_time | user_id + ----------|---------|---------- ----------|---------|---------- + ... ... + event_1_1 | 12:00 | 42 event_2_1 | 11:59 | 42 + ... event_2_2 | 12:30 | 42 + event_1_2 | 13:00 | 42 event_2_3 | 13:00 | 42 + ... ... + +`ASOF JOIN` принимает метку времени пользовательского события из `table_1` и находит такое событие в `table_2` метка времени которого наиболее близка к метке времени события из `table_1` в соответствии с условием на ближайшее совпадение. При этом столбец `user_id` используется для объединения по равенству, а столбец `ev_time` для объединения по ближайшему совпадению. В нашем примере `event_1_1` может быть объединено с `event_2_1`, `event_1_2` может быть объединено с `event_2_3`, а `event_2_2` не объединяется. + +!!! note "Примечание" + `ASOF JOIN` не поддержан для движка таблиц [Join](../../sql-reference/statements/select.md). + +Чтобы задать значение строгости по умолчанию, используйте сессионный параметр [join\_default\_strictness](../../operations/settings/settings.md#settings-join_default_strictness). + +#### GLOBAL JOIN {#global-join} + +При использовании обычного `JOIN` , запрос отправляется на удалённые серверы. На каждом из них выполняются подзапросы для формирования «правой» таблицы, и с этой таблицей выполняется соединение. То есть, «правая» таблица формируется на каждом сервере отдельно. + +При использовании `GLOBAL ... JOIN`, сначала сервер-инициатор запроса запускает подзапрос для вычисления правой таблицы. Эта временная таблица передаётся на каждый удалённый сервер, и на них выполняются запросы с использованием переданных временных данных. + +Будьте аккуратны при использовании `GLOBAL` . За дополнительной информацией обращайтесь в раздел [Распределенные подзапросы](#select-distributed-subqueries). + +**Советы по использованию** + +Из подзапроса удаляются все столбцы, ненужные для `JOIN`. + +При запуске `JOIN`, отсутствует оптимизация порядка выполнения по отношению к другим стадиям запроса. Соединение (поиск в «правой» таблице) выполняется до фильтрации в `WHERE` и до агрегации. Чтобы явно задать порядок вычислений, рекомендуется выполнять `JOIN` подзапроса с подзапросом. + +Пример: + +``` sql +SELECT + CounterID, + hits, + visits +FROM +( + SELECT + CounterID, + count() AS hits + FROM test.hits + GROUP BY CounterID +) ANY LEFT JOIN +( + SELECT + CounterID, + sum(Sign) AS visits + FROM test.visits + GROUP BY CounterID +) USING CounterID +ORDER BY hits DESC +LIMIT 10 +``` + +``` text +┌─CounterID─┬───hits─┬─visits─┐ +│ 1143050 │ 523264 │ 13665 │ +│ 731962 │ 475698 │ 102716 │ +│ 722545 │ 337212 │ 108187 │ +│ 722889 │ 252197 │ 10547 │ +│ 2237260 │ 196036 │ 9522 │ +│ 23057320 │ 147211 │ 7689 │ +│ 722818 │ 90109 │ 17847 │ +│ 48221 │ 85379 │ 4652 │ +│ 19762435 │ 77807 │ 7026 │ +│ 722884 │ 77492 │ 11056 │ +└───────────┴────────┴────────┘ +``` + +У подзапросов нет возможности задать имена и нет возможности их использовать для того, чтобы сослаться на столбец из конкретного подзапроса. +Требуется, чтобы столбцы, указанные в `USING`, назывались одинаково в обоих подзапросах, а остальные столбцы - по-разному. Изменить имена столбцов в подзапросах можно с помощью синонимов (в примере используются синонимы hits и visits). + +В секции `USING` указывается один или несколько столбцов для соединения, что обозначает условие на равенство этих столбцов. Список столбцов задаётся без скобок. Более сложные условия соединения не поддерживаются. + +«Правая» таблица (результат подзапроса) располагается в оперативной памяти. Если её не хватает, вы не сможете выполнить `JOIN`. + +Каждый раз для выполнения запроса с одинаковым `JOIN`, подзапрос выполняется заново — результат не кэшируется. Это можно избежать, используя специальный движок таблиц [Join](../../engines/table-engines/special/join.md), представляющий собой подготовленное множество для соединения, которое всегда находится в оперативке. + +В некоторых случаях более эффективно использовать `IN` вместо `JOIN`. +Среди разных типов `JOIN`, наиболее эффективен `ANY LEFT JOIN`, следующий по эффективности `ANY INNER JOIN`. Наименее эффективны `ALL LEFT JOIN` и `ALL INNER JOIN`. + +Если `JOIN` необходим для соединения с таблицами измерений (dimension tables - сравнительно небольшие таблицы, которые содержат свойства измерений - например, имена для рекламных кампаний), то использование `JOIN` может быть не очень удобным из-за громоздкости синтаксиса, а также из-за того, что правая таблица читается заново при каждом запросе. Специально для таких случаев существует функциональность «Внешние словари», которую следует использовать вместо `JOIN`. Дополнительные сведения смотрите в разделе [Внешние словари](../../sql-reference/statements/select.md). + +**Ограничения по памяти** + +ClickHouse использует алгоритм [hash join](https://en.wikipedia.org/wiki/Hash_join). ClickHouse принимает `` и создает для него хэш-таблицу в RAM. Чтобы ограничить потребление памяти операцией `JOIN`, используйте следующие параметры: + +- [max\_rows\_in\_join](../../operations/settings/query-complexity.md#settings-max_rows_in_join) — ограничивает количество строк в хэш-таблице. +- [max\_bytes\_in\_join](../../operations/settings/query-complexity.md#settings-max_bytes_in_join) — ограничивает размер хэш-таблицы. + +По достижении любого из этих ограничений, ClickHouse действует в соответствии с настройкой [join\_overflow\_mode](../../operations/settings/query-complexity.md#settings-join_overflow_mode). + +#### Обработка пустых ячеек и NULL {#obrabotka-pustykh-iacheek-i-null} + +При слиянии таблиц могут появляться пустые ячейки. То, каким образом ClickHouse заполняет эти ячейки, определяется настройкой [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls). + +Если ключами `JOIN` выступают поля типа [Nullable](../../sql-reference/statements/select.md), то строки, где хотя бы один из ключей имеет значение [NULL](../syntax.md#null-literal), не соединяются. + +#### Ограничения синтаксиса {#ogranicheniia-sintaksisa} + +Для множественных секций `JOIN` в одном запросе `SELECT`: + +- Получение всех столбцов через `*` возможно только при объединении таблиц, но не подзапросов. +- Секция `PREWHERE` недоступна. + +Для секций `ON`, `WHERE` и `GROUP BY`: + +- Нельзя использовать произвольные выражения в секциях `ON`, `WHERE`, и `GROUP BY`, однако можно определить выражение в секции `SELECT` и затем использовать его через алиас в других секциях. + +### Секция WHERE {#select-where} + +Позволяет задать выражение, которое ClickHouse использует для фильтрации данных перед всеми другими действиями в запросе кроме выражений, содержащихся в секции [PREWHERE](#select-prewhere). Обычно, это выражение с логическими операторами. + +Результат выражения должен иметь тип `UInt8`. + +ClickHouse использует в выражении индексы, если это позволяет [движок таблицы](../../sql-reference/statements/select.md). + +Если в секции необходимо проверить [NULL](../syntax.md#null-literal), то используйте операторы [IS NULL](../operators.md#operator-is-null) и [IS NOT NULL](../operators.md#is-not-null), а также соответствующие функции `isNull` и `isNotNull`. В противном случае выражение будет считаться всегда не выполненным. + +Пример проверки на `NULL`: + +``` sql +SELECT * FROM t_null WHERE y IS NULL +``` + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +### Секция PREWHERE {#select-prewhere} + +Имеет такой же смысл, как и секция [WHERE](#select-where). Отличие состоит в том, какие данные читаются из таблицы. +При использовании `PREWHERE`, из таблицы сначала читаются только столбцы, необходимые для выполнения `PREWHERE`. Затем читаются остальные столбцы, нужные для выполнения запроса, но из них только те блоки, в которых выражение в `PREWHERE` истинное. + +`PREWHERE` имеет смысл использовать, если есть условия фильтрации, которые использует меньшинство столбцов из тех, что есть в запросе, но достаточно сильно фильтрует данные. Таким образом, сокращается количество читаемых данных. + +Например, полезно писать `PREWHERE` для запросов, которые вынимают много столбцов, но в которых фильтрация производится лишь по нескольким столбцам. + +`PREWHERE` поддерживается только таблицами семейства `*MergeTree`. + +В запросе могут быть одновременно указаны секции `PREWHERE` и `WHERE`. В этом случае, `PREWHERE` идёт перед `WHERE`. + +Если настройка `optimize_move_to_prewhere` выставлена в `1`, то при отсутствии `PREWHERE`, система будет автоматически переносить части выражений из `WHERE` в `PREWHERE` согласно некоторой эвристике. + +### Секция GROUP BY {#select-group-by-clause} + +Это одна из наиболее важных частей СУБД. + +Секция GROUP BY, если есть, должна содержать список выражений. Каждое выражение далее будем называть «ключом». +При этом, все выражения в секциях SELECT, HAVING, ORDER BY, должны вычисляться из ключей или из агрегатных функций. То есть, каждый выбираемый из таблицы столбец, должен использоваться либо в ключах, либо внутри агрегатных функций. + +Если запрос содержит столбцы таблицы только внутри агрегатных функций, то секция GROUP BY может не указываться, и подразумевается агрегация по пустому набору ключей. + +Пример: + +``` sql +SELECT + count(), + median(FetchTiming > 60 ? 60 : FetchTiming), + count() - sum(Refresh) +FROM hits +``` + +Но, в отличие от стандартного SQL, если в таблице нет строк (вообще нет или после фильтрации с помощью WHERE), в качестве результата возвращается пустой результат, а не результат из одной строки, содержащий «начальные» значения агрегатных функций. + +В отличие от MySQL (и в соответствии со стандартом SQL), вы не можете получить какое-нибудь значение некоторого столбца, не входящего в ключ или агрегатную функцию (за исключением константных выражений). Для обхода этого вы можете воспользоваться агрегатной функцией any (получить первое попавшееся значение) или min/max. + +Пример: + +``` sql +SELECT + domainWithoutWWW(URL) AS domain, + count(), + any(Title) AS title -- getting the first occurred page header for each domain. +FROM hits +GROUP BY domain +``` + +GROUP BY вычисляет для каждого встретившегося различного значения ключей, набор значений агрегатных функций. + +Не поддерживается GROUP BY по столбцам-массивам. + +Не поддерживается указание констант в качестве аргументов агрегатных функций. Пример: sum(1). Вместо этого, вы можете избавиться от констант. Пример: `count()`. + +#### Обработка NULL {#obrabotka-null} + +При группировке, ClickHouse рассматривает [NULL](../syntax.md) как значение, причём `NULL=NULL`. + +Рассмотрим, что это значит на примере. + +Пусть есть таблица: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +В результате запроса `SELECT sum(x), y FROM t_null_big GROUP BY y` мы получим: + +``` text +┌─sum(x)─┬────y─┐ +│ 4 │ 2 │ +│ 3 │ 3 │ +│ 5 │ ᴺᵁᴸᴸ │ +└────────┴──────┘ +``` + +Видно, что `GROUP BY` для `У = NULL` просуммировал `x`, как будто `NULL` — это значение. + +Если в `GROUP BY` передать несколько ключей, то в результате мы получим все комбинации выборки, как если бы `NULL` был конкретным значением. + +#### Модификатор WITH TOTALS {#modifikator-with-totals} + +Если указан модификатор WITH TOTALS, то будет посчитана ещё одна строчка, в которой в столбцах-ключах будут содержаться значения по умолчанию (нули, пустые строки), а в столбцах агрегатных функций - значения, посчитанные по всем строкам («тотальные» значения). + +Эта дополнительная строчка выводится в форматах JSON\*, TabSeparated\*, Pretty\* отдельно от остальных строчек. В остальных форматах эта строчка не выводится. + +В форматах JSON\* строчка выводится отдельным полем totals. В форматах TabSeparated\* строчка выводится после основного результата, и перед ней (после остальных данных) вставляется пустая строка. В форматах Pretty\* строчка выводится отдельной табличкой после основного результата. + +`WITH TOTALS` может выполняться по-разному при наличии HAVING. Поведение зависит от настройки totals\_mode. +По умолчанию `totals_mode = 'before_having'`. В этом случае totals считается по всем строчкам, включая непрошедших через HAVING и max\_rows\_to\_group\_by. + +Остальные варианты учитывают в totals только строчки, прошедшие через HAVING, и имеют разное поведение при наличии настройки `max_rows_to_group_by` и `group_by_overflow_mode = 'any'`. + +`after_having_exclusive` - не учитывать строчки, не прошедшие `max_rows_to_group_by`. То есть в totals попадёт меньше или столько же строчек, чем если бы `max_rows_to_group_by` не было. + +`after_having_inclusive` - учитывать в totals все строчки, не прошедшие max\_rows\_to\_group\_by. То есть в totals попадёт больше или столько же строчек, чем если бы `max_rows_to_group_by` не было. + +`after_having_auto` - считать долю строчек, прошедших через HAVING. Если она больше некоторого значения (по умолчанию - 50%), то включить все строчки, не прошедшие max\_rows\_to\_group\_by в totals, иначе - не включить. + +`totals_auto_threshold` - по умолчанию 0.5. Коэффициент для работы `after_having_auto`. + +Если `max_rows_to_group_by` и `group_by_overflow_mode = 'any'` не используются, то все варианты вида `after_having` не отличаются, и вы можете использовать любой из них, например, `after_having_auto`. + +Вы можете использовать WITH TOTALS в подзапросах, включая подзапросы в секции JOIN (в этом случае соответствующие тотальные значения будут соединены). + +#### GROUP BY во внешней памяти {#select-group-by-in-external-memory} + +Можно включить сброс временных данных на диск, чтобы ограничить потребление оперативной памяти при выполнении `GROUP BY`. +Настройка [max\_bytes\_before\_external\_group\_by](../../operations/settings/settings.md#settings-max_bytes_before_external_group_by) определяет пороговое значение потребления RAM, по достижении которого временные данные `GROUP BY` сбрасываются в файловую систему. Если равно 0 (по умолчанию) - значит выключено. + +При использовании `max_bytes_before_external_group_by`, рекомендуем выставить `max_memory_usage` приблизительно в два раза больше. Это следует сделать, потому что агрегация выполняется в две стадии: чтение и формирование промежуточных данных (1) и слияние промежуточных данных (2). Сброс данных на файловую систему может производиться только на стадии 1. Если сброса временных данных не было, то на стадии 2 может потребляться до такого же объёма памяти, как на стадии 1. + +Например, если [max\_memory\_usage](../../operations/settings/settings.md#settings_max_memory_usage) было выставлено в 10000000000, и вы хотите использовать внешнюю агрегацию, то имеет смысл выставить `max_bytes_before_external_group_by` в 10000000000, а max\_memory\_usage в 20000000000. При срабатывании внешней агрегации (если был хотя бы один сброс временных данных в файловую систему) максимальное потребление оперативки будет лишь чуть-чуть больше `max_bytes_before_external_group_by`. + +При распределённой обработке запроса внешняя агрегация производится на удалённых серверах. Для того чтобы на сервере-инициаторе запроса использовалось немного оперативки, нужно выставить настройку `distributed_aggregation_memory_efficient` в 1. + +При слиянии данных, сброшенных на диск, а также при слиянии результатов с удалённых серверов, при включенной настройке `distributed_aggregation_memory_efficient`, потребляется до `1/256 * the_number_of_threads` количество потоков от общего объёма оперативки. + +При включенной внешней агрегации, если данных было меньше `max_bytes_before_external_group_by` (то есть сброса данных не было), то запрос работает так же быстро, как без внешней агрегации. Если же какие-то временные данные были сброшены, то время выполнения будет в несколько раз больше (примерно в три раза). + +Если есть `ORDER BY` с `LIMIT` после `GROUP BY`, то объём потребляемой RAM будет зависеть от объёма данных в `LIMIT`, а не во всей таблице. Однако, если `ORDER BY` используется без `LIMIT`, не забудьте включить внешнюю сортировку (`max_bytes_before_external_sort`). + +### Секция LIMIT BY {#sektsiia-limit-by} + +Запрос с секцией `LIMIT n BY expressions` выбирает первые `n` строк для каждого отличного значения `expressions`. Ключ `LIMIT BY` может содержать любое количество [выражений](../syntax.md#syntax-expressions). + +ClickHouse поддерживает следующий синтаксис: + +- `LIMIT [offset_value, ]n BY expressions` +- `LIMIT n OFFSET offset_value BY expressions` + +Во время обработки запроса, ClickHouse выбирает данные, упорядоченные по ключу сортировки. Ключ сортировки задаётся явно в секции [ORDER BY](#select-order-by) или неявно в свойствах движка таблицы. Затем ClickHouse применяет `LIMIT n BY expressions` и возвращает первые `n` для каждой отличной комбинации `expressions`. Если указан `OFFSET`, то для каждого блока данных, который принадлежит отдельной комбинации `expressions`, ClickHouse отступает `offset_value` строк от начала блока и возвращает не более `n`. Если `offset_value` больше, чем количество строк в блоке данных, ClickHouse не возвращает ни одной строки. + +`LIMIT BY` не связана с секцией `LIMIT`. Их можно использовать в одном запросе. + +**Примеры** + +Образец таблицы: + +``` sql +CREATE TABLE limit_by(id Int, val Int) ENGINE = Memory; +INSERT INTO limit_by values(1, 10), (1, 11), (1, 12), (2, 20), (2, 21); +``` + +Запросы: + +``` sql +SELECT * FROM limit_by ORDER BY id, val LIMIT 2 BY id +``` + +``` text +┌─id─┬─val─┐ +│ 1 │ 10 │ +│ 1 │ 11 │ +│ 2 │ 20 │ +│ 2 │ 21 │ +└────┴─────┘ +``` + +``` sql +SELECT * FROM limit_by ORDER BY id, val LIMIT 1, 2 BY id +``` + +``` text +┌─id─┬─val─┐ +│ 1 │ 11 │ +│ 1 │ 12 │ +│ 2 │ 21 │ +└────┴─────┘ +``` + +Запрос `SELECT * FROM limit_by ORDER BY id, val LIMIT 2 OFFSET 1 BY id` возвращает такой же результат. + +Следующий запрос выбирает топ 5 рефереров для каждой пары `domain, device_type`, но не более 100 строк (`LIMIT n BY + LIMIT`). + +``` sql +SELECT + domainWithoutWWW(URL) AS domain, + domainWithoutWWW(REFERRER_URL) AS referrer, + device_type, + count() cnt +FROM hits +GROUP BY domain, referrer, device_type +ORDER BY cnt DESC +LIMIT 5 BY domain, device_type +LIMIT 100 +``` + +Запрос выберет топ 5 рефереров для каждой пары `domain, device_type`, но не более 100 строк (`LIMIT n BY + LIMIT`). + +`LIMIT n BY` работает с [NULL](../syntax.md) как если бы это было конкретное значение. Т.е. в результате запроса пользователь получит все комбинации полей, указанных в `BY`. + +### Секция HAVING {#sektsiia-having} + +Позволяет отфильтровать результат, полученный после GROUP BY, аналогично секции WHERE. +WHERE и HAVING отличаются тем, что WHERE выполняется до агрегации (GROUP BY), а HAVING - после. +Если агрегации не производится, то HAVING использовать нельзя. + +### Секция ORDER BY {#select-order-by} + +Секция ORDER BY содержит список выражений, к каждому из которых также может быть приписано DESC или ASC (направление сортировки). Если ничего не приписано - это аналогично приписыванию ASC. ASC - сортировка по возрастанию, DESC - сортировка по убыванию. Обозначение направления сортировки действует на одно выражение, а не на весь список. Пример: `ORDER BY Visits DESC, SearchPhrase` + +Для сортировки по значениям типа String есть возможность указать collation (сравнение). Пример: `ORDER BY SearchPhrase COLLATE 'tr'` - для сортировки по поисковой фразе, по возрастанию, с учётом турецкого алфавита, регистронезависимо, при допущении, что строки в кодировке UTF-8. COLLATE может быть указан или не указан для каждого выражения в ORDER BY независимо. Если есть ASC или DESC, то COLLATE указывается после них. При использовании COLLATE сортировка всегда регистронезависима. + +Рекомендуется использовать COLLATE только для окончательной сортировки небольшого количества строк, так как производительность сортировки с указанием COLLATE меньше, чем обычной сортировки по байтам. + +Строки, для которых список выражений, по которым производится сортировка, принимает одинаковые значения, выводятся в произвольном порядке, который может быть также недетерминированным (каждый раз разным). +Если секция ORDER BY отсутствует, то, аналогично, порядок, в котором идут строки, не определён, и может быть недетерминированным. + +Порядок сортировки `NaN` и `NULL`: + +- С модификатором `NULLS FIRST` — Сначала `NULL`, затем `NaN`, затем остальные значения. +- С модификатором `NULLS LAST` — Сначала значения, затем `NaN`, затем `NULL`. +- По умолчанию — Как с модификатором `NULLS LAST`. + +Пример: + +Для таблицы + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 2 │ +│ 1 │ nan │ +│ 2 │ 2 │ +│ 3 │ 4 │ +│ 5 │ 6 │ +│ 6 │ nan │ +│ 7 │ ᴺᵁᴸᴸ │ +│ 6 │ 7 │ +│ 8 │ 9 │ +└───┴──────┘ +``` + +Выполним запрос `SELECT * FROM t_null_nan ORDER BY y NULLS FIRST`, получим: + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 7 │ ᴺᵁᴸᴸ │ +│ 1 │ nan │ +│ 6 │ nan │ +│ 2 │ 2 │ +│ 2 │ 2 │ +│ 3 │ 4 │ +│ 5 │ 6 │ +│ 6 │ 7 │ +│ 8 │ 9 │ +└───┴──────┘ +``` + +Если кроме ORDER BY указан также не слишком большой LIMIT, то расходуется меньше оперативки. Иначе расходуется количество памяти, пропорциональное количеству данных для сортировки. При распределённой обработке запроса, если отсутствует GROUP BY, сортировка частично делается на удалённых серверах, а на сервере-инициаторе запроса производится слияние результатов. Таким образом, при распределённой сортировке, может сортироваться объём данных, превышающий размер памяти на одном сервере. + +Существует возможность выполнять сортировку во внешней памяти (с созданием временных файлов на диске), если оперативной памяти не хватает. Для этого предназначена настройка `max_bytes_before_external_sort`. Если она выставлена в 0 (по умолчанию), то внешняя сортировка выключена. Если она включена, то при достижении объёмом данных для сортировки указанного количества байт, накопленные данные будут отсортированы и сброшены во временный файл. После того, как все данные будут прочитаны, будет произведено слияние всех сортированных файлов и выдача результата. Файлы записываются в директорию /var/lib/clickhouse/tmp/ (по умолчанию, может быть изменено с помощью параметра tmp\_path) в конфиге. + +На выполнение запроса может расходоваться больше памяти, чем max\_bytes\_before\_external\_sort. Поэтому, значение этой настройки должно быть существенно меньше, чем max\_memory\_usage. Для примера, если на вашем сервере 128 GB оперативки, и вам нужно выполнить один запрос, то выставите max\_memory\_usage в 100 GB, а max\_bytes\_before\_external\_sort в 80 GB. + +Внешняя сортировка работает существенно менее эффективно, чем сортировка в оперативке. + +### Секция SELECT {#select-select} + +[Выражения](../syntax.md#syntax-expressions) указанные в секции `SELECT` анализируются после завершения всех вычислений из секций, описанных выше. Вернее, анализируются выражения, стоящие над агрегатными функциями, если есть агрегатные функции. +Сами агрегатные функции и то, что под ними, вычисляются при агрегации (`GROUP BY`). Эти выражения работают так, как будто применяются к отдельным строкам результата. + +Если в результат необходимо включить все столбцы, используйте символ звёздочка (`*`). Например, `SELECT * FROM ...`. + +Чтобы включить в результат несколько столбцов, выбрав их имена с помощью регулярных выражений [re2](https://en.wikipedia.org/wiki/RE2_(software)), используйте выражение `COLUMNS`. + +``` sql +COLUMNS('regexp') +``` + +Например, рассмотрим таблицу: + +``` sql +CREATE TABLE default.col_names (aa Int8, ab Int8, bc Int8) ENGINE = TinyLog +``` + +Следующий запрос выбирает данные из всех столбцов, содержащих в имени символ `a`. + +``` sql +SELECT COLUMNS('a') FROM col_names +``` + +``` text +┌─aa─┬─ab─┐ +│ 1 │ 1 │ +└────┴────┘ +``` + +Выбранные стоблцы возвращаются не в алфавитном порядке. + +В запросе можно использовать несколько выражений `COLUMNS`, а также вызывать над ними функции. + +Например: + +``` sql +SELECT COLUMNS('a'), COLUMNS('c'), toTypeName(COLUMNS('c')) FROM col_names +``` + +``` text +┌─aa─┬─ab─┬─bc─┬─toTypeName(bc)─┐ +│ 1 │ 1 │ 1 │ Int8 │ +└────┴────┴────┴────────────────┘ +``` + +Каждый столбец, возвращённый выражением `COLUMNS`, передаётся в функцию отдельным аргументом. Также можно передавать и другие аргументы, если функция их поддерживаем. Аккуратно используйте функции. Если функция не поддерживает переданное количество аргументов, то ClickHouse генерирует исключение. + +Например: + +``` sql +SELECT COLUMNS('a') + COLUMNS('c') FROM col_names +``` + +``` text +Received exception from server (version 19.14.1): +Code: 42. DB::Exception: Received from localhost:9000. DB::Exception: Number of arguments for function plus doesn't match: passed 3, should be 2. +``` + +В этом примере, `COLUMNS('a')` возвращает два столбца: `aa` и `ab`. `COLUMNS('c')` возвращает столбец `bc`. Оператор `+` не работает с тремя аргументами, поэтому ClickHouse генерирует исключение с соответствущим сообщением. + +Столбцы, которые возвращаются выражением `COLUMNS` могут быть разных типов. Если `COLUMNS` не возвращает ни одного столбца и это единственное выражение в запросе `SELECT`, то ClickHouse генерирует исключение. + +### Секция DISTINCT {#select-distinct} + +Если указано `DISTINCT`, то из всех множеств полностью совпадающих строк результата, будет оставляться только одна строка. +Результат выполнения будет таким же, как если указано `GROUP BY` по всем указанным полям в `SELECT` и не указаны агрегатные функции. Но имеется несколько отличий от `GROUP BY`: + +- `DISTINCT` может применяться совместно с `GROUP BY`; +- при отсутствии `ORDER BY` и наличии `LIMIT`, запрос прекратит выполнение сразу после того, как будет прочитано необходимое количество различных строк - в этом случае использование DISTINCT существенно более оптимально; +- блоки данных будут выдаваться по мере их обработки, не дожидаясь выполнения всего запроса. + +`DISTINCT` не поддерживается, если в `SELECT` присутствует хотя бы один столбец типа массив. + +`DISTINCT` работает с [NULL](../syntax.md) как если бы `NULL` был конкретным значением, причём `NULL=NULL`. Т.е. в результате `DISTINCT` разные комбинации с `NULL` встретятся только по одному разу. + +ClickHouse поддерживает использование в одном запросе секций `DISTINCT` и `ORDER BY` для разных столбцов. Секция `DISTINCT` исполняется перед секцией `ORDER BY`. + +Таблица для примера: + +``` text +┌─a─┬─b─┐ +│ 2 │ 1 │ +│ 1 │ 2 │ +│ 3 │ 3 │ +│ 2 │ 4 │ +└───┴───┘ +``` + +При выборке данных запросом `SELECT DISTINCT a FROM t1 ORDER BY b ASC`, мы получаем следующий результат: + +``` text +┌─a─┐ +│ 2 │ +│ 1 │ +│ 3 │ +└───┘ +``` + +Если изменить направление сортировки `SELECT DISTINCT a FROM t1 ORDER BY b DESC`, то результат получается следующий: + +``` text +┌─a─┐ +│ 3 │ +│ 1 │ +│ 2 │ +└───┘ +``` + +Строка `2, 4` была удалена перед сортировкой. + +Учитывайте эту особенность реализации при программировании запросов. + +### Секция LIMIT {#sektsiia-limit} + +`LIMIT m` позволяет выбрать из результата первые `m` строк. + +`LIMIT n, m` позволяет выбрать из результата первые `m` строк после пропуска первых `n` строк. Синтаксис `LIMIT m OFFSET n` также поддерживается. + +`n` и `m` должны быть неотрицательными целыми числами. + +При отсутствии секции `ORDER BY`, однозначно сортирующей результат, результат может быть произвольным и может являться недетерминированным. + +### Секция UNION ALL {#sektsiia-union-all} + +Произвольное количество запросов может быть объединено с помощью `UNION ALL`. Пример: + +``` sql +SELECT CounterID, 1 AS table, toInt64(count()) AS c + FROM test.hits + GROUP BY CounterID + +UNION ALL + +SELECT CounterID, 2 AS table, sum(Sign) AS c + FROM test.visits + GROUP BY CounterID + HAVING c > 0 +``` + +Поддерживается только `UNION ALL`. Обычный `UNION` (`UNION DISTINCT`) не поддерживается. Если вам нужен `UNION DISTINCT`, то вы можете написать `SELECT DISTINCT` из подзапроса, содержащего `UNION ALL`. + +Запросы - части `UNION ALL` могут выполняться параллельно, и их результаты могут возвращаться вперемешку. + +Структура результатов (количество и типы столбцов) у запросов должна совпадать. Но имена столбцов могут отличаться. В этом случае, имена столбцов для общего результата будут взяты из первого запроса. При объединении выполняется приведение типов. Например, если в двух объединяемых запросах одно и тоже поле имеет типы не-`Nullable` и `Nullable` от совместимого типа, то в результате `UNION ALL` получим поле типа `Nullable`. + +Запросы - части `UNION ALL` нельзя заключить в скобки. `ORDER BY` и `LIMIT` применяются к отдельным запросам, а не к общему результату. Если вам нужно применить какое-либо преобразование к общему результату, то вы можете разместить все запросы с `UNION ALL` в подзапросе в секции `FROM`. + +### Секция INTO OUTFILE {#into-outfile-clause} + +При указании `INTO OUTFILE filename` (где filename - строковый литерал), результат запроса будет сохранён в файл filename. +В отличие от MySQL, файл создаётся на стороне клиента. Если файл с таким именем уже существует, это приведёт к ошибке. +Функциональность доступна в клиенте командной строки и clickhouse-local (попытка выполнить запрос с INTO OUTFILE через HTTP интерфейс приведёт к ошибке). + +Формат вывода по умолчанию - TabSeparated, как и в не интерактивном режиме клиента командной строки. + +### Секция FORMAT {#format-clause} + +При указании FORMAT format вы можете получить данные в любом указанном формате. +Это может использоваться для удобства или для создания дампов. +Подробнее смотрите раздел «Форматы». +Если секция FORMAT отсутствует, то используется формат по умолчанию, который зависит от используемого интерфейса для доступа к БД и от настроек. Для HTTP интерфейса, а также для клиента командной строки, используемого в batch-режиме, по умолчанию используется формат TabSeparated. Для клиента командной строки, используемого в интерактивном режиме, по умолчанию используется формат PrettyCompact (прикольные таблички, компактные). + +При использовании клиента командной строки данные на клиент передаются во внутреннем эффективном формате. При этом клиент самостоятельно интерпретирует секцию FORMAT запроса и форматирует данные на своей стороне (снимая нагрузку на сеть и сервер). + +### Операторы IN {#select-in-operators} + +Операторы `IN`, `NOT IN`, `GLOBAL IN`, `GLOBAL NOT IN` рассматриваются отдельно, так как их функциональность достаточно богатая. + +В качестве левой части оператора, может присутствовать как один столбец, так и кортеж. + +Примеры: + +``` sql +SELECT UserID IN (123, 456) FROM ... +SELECT (CounterID, UserID) IN ((34, 123), (101500, 456)) FROM ... +``` + +Если слева стоит один столбец, входящий в индекс, а справа - множество констант, то при выполнении запроса, система воспользуется индексом. + +Не перечисляйте слишком большое количество значений (миллионы) явно. Если множество большое - лучше загрузить его во временную таблицу (например, смотрите раздел «Внешние данные для обработки запроса»), и затем воспользоваться подзапросом. + +В качестве правой части оператора может быть множество константных выражений, множество кортежей с константными выражениями (показано в примерах выше), а также имя таблицы или подзапрос SELECT в скобках. + +Если в качестве правой части оператора указано имя таблицы (например, `UserID IN users`), то это эквивалентно подзапросу `UserID IN (SELECT * FROM users)`. Это используется при работе с внешними данными, отправляемым вместе с запросом. Например, вместе с запросом может быть отправлено множество идентификаторов посетителей, загруженное во временную таблицу users, по которому следует выполнить фильтрацию. + +Если в качестве правой части оператора, указано имя таблицы, имеющий движок Set (подготовленное множество, постоянно находящееся в оперативке), то множество не будет создаваться заново при каждом запросе. + +В подзапросе может быть указано более одного столбца для фильтрации кортежей. +Пример: + +``` sql +SELECT (CounterID, UserID) IN (SELECT CounterID, UserID FROM ...) FROM ... +``` + +Типы столбцов слева и справа оператора IN, должны совпадать. + +Оператор IN и подзапрос могут встречаться в любой части запроса, в том числе в агрегатных и лямбда функциях. +Пример: + +``` sql +SELECT + EventDate, + avg(UserID IN + ( + SELECT UserID + FROM test.hits + WHERE EventDate = toDate('2014-03-17') + )) AS ratio +FROM test.hits +GROUP BY EventDate +ORDER BY EventDate ASC +``` + +``` text +┌──EventDate─┬────ratio─┐ +│ 2014-03-17 │ 1 │ +│ 2014-03-18 │ 0.807696 │ +│ 2014-03-19 │ 0.755406 │ +│ 2014-03-20 │ 0.723218 │ +│ 2014-03-21 │ 0.697021 │ +│ 2014-03-22 │ 0.647851 │ +│ 2014-03-23 │ 0.648416 │ +└────────────┴──────────┘ +``` + +за каждый день после 17 марта считаем долю хитов, сделанных посетителями, которые заходили на сайт 17 марта. +Подзапрос в секции IN на одном сервере всегда выполняется только один раз. Зависимых подзапросов не существует. + +#### Обработка NULL {#obrabotka-null-1} + +При обработке запроса оператор IN будет считать, что результат операции с [NULL](../syntax.md) всегда равен `0`, независимо от того, находится `NULL` в правой или левой части оператора. Значения `NULL` не входят ни в какое множество, не соответствуют друг другу и не могут сравниваться. + +Рассмотрим для примера таблицу `t_null`: + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +При выполнении запроса `SELECT x FROM t_null WHERE y IN (NULL,3)` получим следующий результат: + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +Видно, что строка, в которой `y = NULL`, выброшена из результатов запроса. Это произошло потому, что ClickHouse не может решить входит ли `NULL` в множество `(NULL,3)`, возвращает результат операции `0`, а `SELECT` выбрасывает эту строку из финальной выдачи. + +``` sql +SELECT y IN (NULL, 3) +FROM t_null +``` + +``` text +┌─in(y, tuple(NULL, 3))─┐ +│ 0 │ +│ 1 │ +└───────────────────────┘ +``` + +#### Распределённые подзапросы {#select-distributed-subqueries} + +Существует два варианта IN-ов с подзапросами (аналогично для JOIN-ов): обычный `IN` / `JOIN` и `GLOBAL IN` / `GLOBAL JOIN`. Они отличаются способом выполнения при распределённой обработке запроса. + +!!! attention "Attention" + Помните, что алгоритмы, описанные ниже, могут работать иначе в зависимости от [настройки](../../operations/settings/settings.md) `distributed_product_mode`. + +При использовании обычного IN-а, запрос отправляется на удалённые серверы, и на каждом из них выполняются подзапросы в секциях `IN` / `JOIN`. + +При использовании `GLOBAL IN` / `GLOBAL JOIN-а`, сначала выполняются все подзапросы для `GLOBAL IN` / `GLOBAL JOIN-ов`, и результаты складываются во временные таблицы. Затем эти временные таблицы передаются на каждый удалённый сервер, и на них выполняются запросы, с использованием этих переданных временных данных. + +Если запрос не распределённый, используйте обычный `IN` / `JOIN`. + +Следует быть внимательным при использовании подзапросов в секции `IN` / `JOIN` в случае распределённой обработки запроса. + +Рассмотрим это на примерах. Пусть на каждом сервере кластера есть обычная таблица **local\_table**. Пусть также есть таблица **distributed\_table** типа **Distributed**, которая смотрит на все серверы кластера. + +При запросе к распределённой таблице **distributed\_table**, запрос будет отправлен на все удалённые серверы, и на них будет выполнен с использованием таблицы **local\_table**. + +Например, запрос + +``` sql +SELECT uniq(UserID) FROM distributed_table +``` + +будет отправлен на все удалённые серверы в виде + +``` sql +SELECT uniq(UserID) FROM local_table +``` + +, выполнен параллельно на каждом из них до стадии, позволяющей объединить промежуточные результаты; затем промежуточные результаты вернутся на сервер-инициатор запроса, будут на нём объединены, и финальный результат будет отправлен клиенту. + +Теперь рассмотрим запрос с IN-ом: + +``` sql +SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) +``` + +- расчёт пересечения аудиторий двух сайтов. + +Этот запрос будет отправлен на все удалённые серверы в виде + +``` sql +SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) +``` + +То есть, множество в секции IN будет собрано на каждом сервере независимо, только по тем данным, которые есть локально на каждом из серверов. + +Это будет работать правильно и оптимально, если вы предусмотрели такой случай, и раскладываете данные по серверам кластера таким образом, чтобы данные одного UserID-а лежали только на одном сервере. В таком случае все необходимые данные будут присутствовать на каждом сервере локально. В противном случае результат будет посчитан неточно. Назовём этот вариант запроса «локальный IN». + +Чтобы исправить работу запроса, когда данные размазаны по серверам кластера произвольным образом, можно было бы указать **distributed\_table** внутри подзапроса. Запрос будет выглядеть так: + +``` sql +SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) +``` + +Этот запрос будет отправлен на все удалённые серверы в виде + +``` sql +SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) +``` + +На каждом удалённом сервере начнёт выполняться подзапрос. Так как в подзапросе используется распределённая таблица, то подзапрос будет, на каждом удалённом сервере, снова отправлен на каждый удалённый сервер, в виде + +``` sql +SELECT UserID FROM local_table WHERE CounterID = 34 +``` + +Например, если у вас кластер из 100 серверов, то выполнение всего запроса потребует 10 000 элементарных запросов, что, как правило, является неприемлемым. + +В таких случаях всегда следует использовать GLOBAL IN вместо IN. Рассмотрим его работу для запроса + +``` sql +SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID GLOBAL IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) +``` + +На сервере-инициаторе запроса будет выполнен подзапрос + +``` sql +SELECT UserID FROM distributed_table WHERE CounterID = 34 +``` + +, и результат будет сложен во временную таблицу в оперативке. Затем запрос будет отправлен на каждый удалённый сервер в виде + +``` sql +SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID GLOBAL IN _data1 +``` + +, и вместе с запросом, на каждый удалённый сервер будет отправлена временная таблица `_data1` (имя временной таблицы - implementation defined). + +Это гораздо более оптимально, чем при использовании обычного IN. Но при этом, следует помнить о нескольких вещах: + +1. При создании временной таблицы данные не уникализируются. Чтобы уменьшить объём передаваемых по сети данных, укажите в подзапросе DISTINCT (для обычного IN-а этого делать не нужно). +2. Временная таблица будет передана на все удалённые серверы. Передача не учитывает топологию сети. Например, если 10 удалённых серверов расположены в удалённом относительно сервера-инициатора запроса дата-центре, то по каналу в удалённый дата-центр данные будет переданы 10 раз. Старайтесь не использовать большие множества при использовании GLOBAL IN. +3. При передаче данных на удалённые серверы не настраивается ограничение использования сетевой полосы. Вы можете перегрузить сеть. +4. Старайтесь распределять данные по серверам так, чтобы в GLOBAL IN-ах не было частой необходимости. +5. Если в GLOBAL IN есть частая необходимость, то спланируйте размещение кластера ClickHouse таким образом, чтобы в каждом дата-центре была хотя бы одна реплика каждого шарда, и среди них была быстрая сеть - чтобы запрос целиком можно было бы выполнить, передавая данные в пределах одного дата-центра. + +В секции `GLOBAL IN` также имеет смысл указывать локальную таблицу - в случае, если эта локальная таблица есть только на сервере-инициаторе запроса, и вы хотите воспользоваться данными из неё на удалённых серверах. + +### Экстремальные значения {#ekstremalnye-znacheniia} + +Вы можете получить в дополнение к результату также минимальные и максимальные значения по столбцам результата. Для этого выставите настройку **extremes** в 1. Минимумы и максимумы считаются для числовых типов, дат, дат-с-временем. Для остальных столбцов будут выведены значения по умолчанию. + +Вычисляются дополнительные две строчки - минимумы и максимумы, соответственно. Эти две дополнительные строки выводятся в [форматах](../../interfaces/formats.md) `JSON*`, `TabSeparated*`, и `Pretty*` отдельно от остальных строчек. В остальных форматах они не выводится. + +Во форматах `JSON*`, экстремальные значения выводятся отдельным полем ‘extremes’. В форматах `TabSeparated*`, строка выводится после основного результата и после ‘totals’ если есть. Перед ней (после остальных данных) вставляется пустая строка. В форматах `Pretty*`, строка выводится отдельной таблицей после основного результата и после `totals` если есть. + +Экстремальные значения вычисляются для строк перед `LIMIT`, но после `LIMIT BY`. Однако при использовании `LIMIT offset, size`, строки перед `offset` включаются в `extremes`. В потоковых запросах, в результате может учитываться также небольшое количество строчек, прошедших `LIMIT`. + +### Замечания {#zamechaniia} + +В секциях `GROUP BY`, `ORDER BY`, в отличие от диалекта MySQL, и в соответствии со стандартным SQL, не поддерживаются позиционные аргументы. +Например, если вы напишите `GROUP BY 1, 2` - то это будет воспринято, как группировка по константам (то есть, агрегация всех строк в одну). + +Вы можете использовать синонимы (алиасы `AS`) в любом месте запроса. + +В любом месте запроса, вместо выражения, может стоять звёздочка. При анализе запроса звёздочка раскрывается в список всех столбцов таблицы (за исключением `MATERIALIZED` и `ALIAS` столбцов). Есть лишь немного случаев, когда оправдано использовать звёздочку: + +- при создании дампа таблицы; +- для таблиц, содержащих всего несколько столбцов - например, системных таблиц; +- для получения информации о том, какие столбцы есть в таблице; в этом случае, укажите `LIMIT 1`. Но лучше используйте запрос `DESC TABLE`; +- при наличии сильной фильтрации по небольшому количеству столбцов с помощью `PREWHERE`; +- в подзапросах (так как из подзапросов выкидываются столбцы, не нужные для внешнего запроса). + +В других случаях использование звёздочки является издевательством над системой, так как вместо преимуществ столбцовой СУБД вы получаете недостатки. То есть использовать звёздочку не рекомендуется. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/select/) diff --git a/docs/ru/sql-reference/statements/show.md b/docs/ru/sql-reference/statements/show.md new file mode 100644 index 00000000000..86f7abd8a1b --- /dev/null +++ b/docs/ru/sql-reference/statements/show.md @@ -0,0 +1,98 @@ +# SHOW Queries {#show-queries} + +## SHOW CREATE TABLE {#show-create-table} + +``` sql +SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Возвращает один столбец типа `String` с именем statement, содержащий одно значение — запрос `CREATE TABLE`, с помощью которого был создан указанный объект. + +## SHOW DATABASES {#show-databases} + +``` sql +SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] +``` + +Выводит список всех баз данных. +Запрос полностью аналогичен запросу `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. + +## SHOW PROCESSLIST {#show-processlist} + +``` sql +SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] +``` + +Выводит содержимое таблицы [system.processes](../../operations/system-tables.md#system_tables-processes), которая содержит список запросов, выполняющихся в данный момент времени, кроме самих запросов `SHOW PROCESSLIST`. + +Запрос `SELECT * FROM system.processes` возвращает данные обо всех текущих запросах. + +Полезный совет (выполните в консоли): + +``` bash +$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" +``` + +## SHOW TABLES {#show-tables} + +Выводит список таблиц. + +``` sql +SHOW [TEMPORARY] TABLES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Если секция `FROM` не используется, то запрос возвращает список таблиц из текущей базы данных. + +Результат, идентичный тому, что выдаёт запрос `SHOW TABLES` можно получить также запросом следующего вида: + +``` sql +SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Пример** + +Следующий запрос выбирает первые две строки из списка таблиц в базе данных `system`, чьи имена содержат `co`. + +``` sql +SHOW TABLES FROM system LIKE '%co%' LIMIT 2 +``` + +``` text +┌─name───────────────────────────┐ +│ aggregate_function_combinators │ +│ collations │ +└────────────────────────────────┘ +``` + +## SHOW DICTIONARIES {#show-dictionaries} + +Выводит список [внешних словарей](../../sql-reference/statements/show.md). + +``` sql +SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Если секция `FROM` не указана, запрос возвращает список словарей из текущей базы данных. + +Аналогичный результат можно получить следующим запросом: + +``` sql +SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Example** + +Запрос выводит первые две стоки из списка таблиц в базе данных `system`, имена которых содержат `reg`. + +``` sql +SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 +``` + +``` text +┌─name─────────┐ +│ regions │ +│ region_names │ +└──────────────┘ +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/show/) diff --git a/docs/ru/sql-reference/statements/system.md b/docs/ru/sql-reference/statements/system.md new file mode 100644 index 00000000000..b058739c894 --- /dev/null +++ b/docs/ru/sql-reference/statements/system.md @@ -0,0 +1,106 @@ +# Запросы SYSTEM {#query-language-system} + +- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) +- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) +- [DROP DNS CACHE](#query_language-system-drop-dns-cache) +- [DROP MARK CACHE](#query_language-system-drop-mark-cache) +- [FLUSH LOGS](#query_language-system-flush_logs) +- [RELOAD CONFIG](#query_language-system-reload-config) +- [SHUTDOWN](#query_language-system-shutdown) +- [KILL](#query_language-system-kill) +- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) +- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) +- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) +- [STOP MERGES](#query_language-system-stop-merges) +- [START MERGES](#query_language-system-start-merges) + +## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} + +Перегружает все словари, которые были успешно загружены до этого. +По умолчанию включена ленивая загрузка [dictionaries\_lazy\_load](../../sql-reference/statements/system.md#dictionaries-lazy-load), поэтому словари не загружаются автоматически при старте, а только при первом обращении через dictGet или SELECT к ENGINE=Dictionary. После этого такие словари (LOADED) будут перегружаться командой `system reload dictionaries`. +Всегда возвращает `Ok.`, вне зависимости от результата обновления словарей. + +## RELOAD DICTIONARY Dictionary\_name {#query_language-system-reload-dictionary} + +Полностью перегружает словарь `dictionary_name`, вне зависимости от состояния словаря (LOADED/NOT\_LOADED/FAILED). +Всегда возвращает `Ok.`, вне зависимости от результата обновления словаря. +Состояние словаря можно проверить запросом к `system.dictionaries`. + +``` sql +SELECT name, status FROM system.dictionaries; +``` + +## DROP DNS CACHE {#query_language-system-drop-dns-cache} + +Сбрасывает внутренний DNS кеш ClickHouse. Иногда (для старых версий ClickHouse) необходимо использовать эту команду при изменении инфраструктуры (смене IP адреса у другого ClickHouse сервера или сервера, используемого словарями). + +Для более удобного (автоматического) управления кешем см. параметры disable\_internal\_dns\_cache, dns\_cache\_update\_period. + +## DROP MARK CACHE {#query_language-system-drop-mark-cache} + +Сбрасывает кеш «засечек» (`mark cache`). Используется при разработке ClickHouse и тестах производительности. + +## FLUSH LOGS {#query_language-system-flush_logs} + +Записывает буферы логов в системные таблицы (например system.query\_log). Позволяет не ждать 7.5 секунд при отладке. + +## RELOAD CONFIG {#query_language-system-reload-config} + +Перечитывает конфигурацию настроек ClickHouse. Используется при хранении конфигурации в zookeeeper. + +## SHUTDOWN {#query_language-system-shutdown} + +Штатно завершает работу ClickHouse (аналог `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) + +## KILL {#query_language-system-kill} + +Аварийно завершает работу ClickHouse (аналог `kill -9 {$pid_clickhouse-server}`) + +## Управление распределёнными таблицами {#query-language-system-distributed} + +ClickHouse может оперировать [распределёнными](../../sql-reference/statements/system.md) таблицами. Когда пользователь вставляет данные в эти таблицы, ClickHouse сначала формирует очередь из данных, которые должны быть отправлены на узлы кластера, а затем асинхронно отправляет подготовленные данные. Вы можете управлять очередью с помощью запросов [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) и [FLUSH DISTRIBUTED](#query_language-system-flush-distributed). Также есть возможность синхронно вставлять распределенные данные с помощью настройки `insert_distributed_sync`. + +### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} + +Отключает фоновую отправку при вставке данных в распределённые таблицы. + +``` sql +SYSTEM STOP DISTRIBUTED SENDS [db.] +``` + +### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} + +В синхронном режиме отправляет все данные на узлы кластера. Если какие-либо узлы недоступны, ClickHouse генерирует исключение и останавливает выполнение запроса. Такой запрос можно повторять до успешного завершения, что будет означать возвращение связанности с остальными узлами кластера. + +``` sql +SYSTEM FLUSH DISTRIBUTED [db.] +``` + +### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} + +Включает фоновую отправку при вставке данных в распределенные таблицы. + +``` sql +SYSTEM START DISTRIBUTED SENDS [db.] +``` + +### STOP MERGES {#query_language-system-stop-merges} + +Позволяет остановить фоновые мержи для таблиц семейства MergeTree: + +``` sql +SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +``` + +!!! note "Note" + `DETACH / ATTACH` таблицы восстанавливает фоновые мержи для этой таблицы (даже в случае отключения фоновых мержей для всех таблиц семейства MergeTree до `DETACH`). + +### START MERGES {#query_language-system-start-merges} + +Включает фоновые мержи для таблиц семейства MergeTree: + +``` sql +SYSTEM START MERGES [[db.]merge_tree_family_table_name] +``` + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/system/) diff --git a/docs/ru/sql-reference/syntax.md b/docs/ru/sql-reference/syntax.md new file mode 100644 index 00000000000..c13cc68db31 --- /dev/null +++ b/docs/ru/sql-reference/syntax.md @@ -0,0 +1,179 @@ +# Синтаксис {#sintaksis} + +В системе есть два вида парсеров: полноценный парсер SQL (recursive descent parser) и парсер форматов данных (быстрый потоковый парсер). +Во всех случаях кроме запроса INSERT, используется только полноценный парсер SQL. +В запросе INSERT используется оба парсера: + +``` sql +INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') +``` + +Фрагмент `INSERT INTO t VALUES` парсится полноценным парсером, а данные `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` - быстрым потоковым парсером. +Данные могут иметь любой формат. При получении запроса, сервер заранее считывает в оперативку не более `max_query_size` байт запроса (по умолчанию, 1МБ), а всё остальное обрабатывается потоково. +Таким образом, в системе нет проблем с большими INSERT запросами, как в MySQL. + +При использовании формата Values в INSERT запросе может сложиться иллюзия, что данные парсятся также, как выражения в запросе SELECT, но это не так. Формат Values гораздо более ограничен. + +Далее пойдёт речь о полноценном парсере. О парсерах форматов, смотри раздел «Форматы». + +## Пробелы {#probely} + +Между синтаксическими конструкциями (в том числе, в начале и конце запроса) может быть расположено произвольное количество пробельных символов. К пробельным символам относятся пробел, таб, перевод строки, CR, form feed. + +## Комментарии {#kommentarii} + +Поддерживаются комментарии в SQL-стиле и C-стиле. +Комментарии в SQL-стиле: от `--` до конца строки. Пробел после `--` может не ставиться. +Комментарии в C-стиле: от `/*` до `*/`. Такие комментарии могут быть многострочными. Пробелы тоже не обязательны. + +## Ключевые слова {#syntax-keywords} + +Ключевые слова не зависят от регистра, если они соответствуют: + +- Стандарту SQL. Например, применение любого из вариантов `SELECT`, `select` или `SeLeCt` не вызовет ошибки. +- Реализации в некоторых популярных DBMS (MySQL или Postgres). Например, `DateTime` и `datetime`. + +Зависимость от регистра для имён типов данных можно проверить в таблице `system.data_type_families`. + +В отличие от стандарта SQL, все остальные ключевые слова, включая названия функций зависят от регистра. + +Ключевые слова не зарезервированы (а всего лишь парсятся как ключевые слова в соответствующем контексте). Если вы используете [идентификаторы](#syntax-identifiers), совпадающие с ключевыми словами, заключите их в кавычки. Например, запрос `SELECT "FROM" FROM table_name` валиден, если таблица `table_name` имеет столбец с именем `"FROM"`. + +## Идентификаторы {#syntax-identifiers} + +Идентификаторы: + +- Имена кластеров, баз данных, таблиц, разделов и столбцов; +- Функции; +- Типы данных; +- [Синонимы выражений](#syntax-expression_aliases). + +Некоторые идентификаторы нужно указывать в кавычках (например, идентификаторы с пробелами). Прочие идентификаторы можно указывать без кавычек. Рекомендуется использовать идентификаторы, не требующие кавычек. + +Идентификаторы не требующие кавычек соответствуют регулярному выражению `^[a-zA-Z_][0-9a-zA-Z_]*$` и не могут совпадать с [ключевыми словами](#syntax-keywords). Примеры: `x, _1, X_y__Z123_.` + +Если вы хотите использовать идентификаторы, совпадающие с ключевыми словами, или использовать в идентификаторах символы, не входящие в регулярное выражение, заключите их в двойные или обратные кавычки, например, `"id"`, `` `id` ``. + +## Литералы {#literaly} + +Существуют: числовые, строковые, составные литералы и `NULL`. + +### Числовые {#chislovye} + +Числовой литерал пытается распарситься: + +- Сначала как знаковое 64-разрядное число, функцией [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul). +- Если не получилось, то как беззнаковое 64-разрядное число, функцией [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol). +- Если не получилось, то как число с плавающей запятой, функцией [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof). +- Иначе — ошибка. + +Соответствующее значение будет иметь тип минимального размера, который вмещает значение. +Например, 1 парсится как `UInt8`, а 256 как `UInt16`. Подробнее о типах данных читайте в разделе [Типы данных](../sql-reference/syntax.md). + +Примеры: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. + +### Строковые {#syntax-string-literal} + +Поддерживаются только строковые литералы в одинарных кавычках. Символы внутри могут быть экранированы с помощью обратного слеша. Следующие escape-последовательности имеют соответствующее специальное значение: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. Во всех остальных случаях, последовательности вида `\c`, где `c` — любой символ, преобразуется в `c` . Таким образом, могут быть использованы последовательности `\'` и `\\`. Значение будет иметь тип [String](../sql-reference/syntax.md). + +Минимальный набор символов, которых вам необходимо экранировать в строковых литералах: `'` и `\`. Одинарная кавычка может быть экранирована одинарной кавычкой, литералы `'It\'s'` и `'It''s'` эквивалентны. + +### Составные {#sostavnye} + +Поддерживаются конструкции для массивов: `[1, 2, 3]` и кортежей: `(1, 'Hello, world!', 2)`. +На самом деле, это вовсе не литералы, а выражение с оператором создания массива и оператором создания кортежа, соответственно. +Массив должен состоять хотя бы из одного элемента, а кортеж - хотя бы из двух. +Кортежи носят служебное значение для использования в секции `IN` запроса `SELECT`. Кортежи могут быть получены как результат запроса, но они не могут быть сохранены в базе данных (за исключением таблицы [Memory](../sql-reference/syntax.md).) + +### NULL {#null-literal} + +Обозначает, что значение отсутствует. + +Чтобы в поле таблицы можно было хранить `NULL`, оно должно быть типа [Nullable](../sql-reference/syntax.md). + +В зависимости от формата данных (входных или выходных) `NULL` может иметь различное представление. Подробнее смотрите в документации для [форматов данных](../interfaces/formats.md#formats). + +При обработке `NULL` есть множество особенностей. Например, если хотя бы один из аргументов операции сравнения — `NULL`, то результатом такой операции тоже будет `NULL`. Этим же свойством обладают операции умножения, сложения и пр. Подробнее читайте в документации на каждую операцию. + +В запросах можно проверить `NULL` с помощью операторов [IS NULL](operators.md#operator-is-null) и [IS NOT NULL](operators.md), а также соответствующих функций `isNull` и `isNotNull`. + +## Функции {#funktsii} + +Функции записываются как идентификатор со списком аргументов (возможно, пустым) в скобках. В отличие от стандартного SQL, даже в случае пустого списка аргументов, скобки обязательны. Пример: `now()`. +Бывают обычные и агрегатные функции (смотрите раздел «Агрегатные функции»). Некоторые агрегатные функции могут содержать два списка аргументов в круглых скобках. Пример: `quantile(0.9)(x)`. Такие агрегатные функции называются «параметрическими», а первый список аргументов называется «параметрами». Синтаксис агрегатных функций без параметров ничем не отличается от обычных функций. + +## Операторы {#operatory} + +Операторы преобразуются в соответствующие им функции во время парсинга запроса, с учётом их приоритета и ассоциативности. +Например, выражение `1 + 2 * 3 + 4` преобразуется в `plus(plus(1, multiply(2, 3)), 4)`. + +## Типы данных и движки таблиц {#tipy-dannykh-i-dvizhki-tablits} + +Типы данных и движки таблиц в запросе `CREATE` записываются также, как идентификаторы или также как функции. То есть, могут содержать или не содержать список аргументов в круглых скобках. Подробнее смотрите разделы «Типы данных», «Движки таблиц», «CREATE». + +## Синонимы выражений {#syntax-expression_aliases} + +Синоним — это пользовательское имя выражения в запросе. + +``` sql +expr AS alias +``` + +- `AS` — ключевое слово для определения синонимов. Можно определить синоним для имени таблицы или столбца в секции `SELECT` без использования ключевого слова `AS` . + + Например, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. + + В функции [CAST](sql_reference/syntax.md#type_conversion_function-cast), ключевое слово `AS` имеет другое значение. Смотрите описание функции. + +- `expr` — любое выражение, которое поддерживает ClickHouse. + + Например, `SELECT column_name * 2 AS double FROM some_table`. + +- `alias` — имя для `выражения`. Синонимы должны соответствовать синтаксису [идентификаторов](#syntax-identifiers). + + Например, `SELECT "table t".column_name FROM table_name AS "table t"`. + +### Примечания по использованию {#primechaniia-po-ispolzovaniiu} + +Синонимы являются глобальными для запроса или подзапроса, и вы можете определить синоним в любой части запроса для любого выражения. Например, `SELECT (1 AS n) + 2, n`. + +Синонимы не передаются в подзапросы и между подзапросами. Например, при выполнении запроса `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse сгенерирует исключение `Unknown identifier: num`. + +Если синоним определен для результирующих столбцов в секции `SELECT` вложенного запроса, то эти столбцы отображаются во внешнем запросе. Например, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. + +Будьте осторожны с синонимами, совпадающими с именами столбцов или таблиц. Рассмотрим следующий пример: + +``` sql +CREATE TABLE t +( + a Int, + b Int +) +ENGINE = TinyLog() +``` + +``` sql +SELECT + argMax(a, b), + sum(b) AS b +FROM t +``` + +``` text +Received exception from server (version 18.14.17): +Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. +``` + +В этом примере мы объявили таблицу `t` со столбцом `b`. Затем, при выборе данных, мы определили синоним `sum(b) AS b`. Поскольку синонимы глобальные, то ClickHouse заменил литерал `b` в выражении `argMax(a, b)` выражением `sum(b)`. Эта замена вызвала исключение. + +## Звёздочка {#zviozdochka} + +В запросе `SELECT`, вместо выражения может стоять звёздочка. Подробнее смотрите раздел «SELECT». + +## Выражения {#syntax-expressions} + +Выражение представляет собой функцию, идентификатор, литерал, применение оператора, выражение в скобках, подзапрос, звёздочку. А также может содержать синоним. +Список выражений - одно выражение или несколько выражений через запятую. +Функции и операторы, в свою очередь, в качестве аргументов, могут иметь произвольные выражения. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/syntax/) diff --git a/docs/ru/sql-reference/table-functions/file.md b/docs/ru/sql-reference/table-functions/file.md new file mode 100644 index 00000000000..103ff34753c --- /dev/null +++ b/docs/ru/sql-reference/table-functions/file.md @@ -0,0 +1,107 @@ +# file {#file} + +Создаёт таблицу из файла. Данная табличная функция похожа на табличные функции [file](file.md) и [hdfs](hdfs.md). + +``` sql +file(path, format, structure) +``` + +**Входные параметры** + +- `path` — относительный путь до файла от [user\_files\_path](../../sql-reference/table-functions/file.md#server_configuration_parameters-user_files_path). Путь к файлу поддерживает следующие шаблоны в режиме доступа только для чтения `*`, `?`, `{abc,def}` и `{N..M}`, где `N`, `M` — числа, \``'abc', 'def'` — строки. +- `format` — [формат](../../interfaces/formats.md#formats) файла. +- `structure` — структура таблицы. Формат `'colunmn1_name column1_ype, column2_name column2_type, ...'`. + +**Возвращаемое значение** + +Таблица с указанной структурой, предназначенная для чтения или записи данных в указанном файле. + +**Пример** + +Настройка `user_files_path` и содержимое файла `test.csv`: + +``` bash +$ grep user_files_path /etc/clickhouse-server/config.xml + /var/lib/clickhouse/user_files/ + +$ cat /var/lib/clickhouse/user_files/test.csv + 1,2,3 + 3,2,1 + 78,43,45 +``` + +Таблица из `test.csv` и выборка первых двух строк из неё: + +``` sql +SELECT * +FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +Шаблоны могут содержаться в нескольких компонентах пути. Обрабатываются только существующие файлы, название которых целиком удовлетворяет шаблону (не только суффиксом или префиксом). + +- `*` — Заменяет любое количество любых символов кроме `/`, включая отсутствие символов. +- `?` — Заменяет ровно один любой символ. +- `{some_string,another_string,yet_another_one}` — Заменяет любую из строк `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Заменяет любое число в интервале от `N` до `M` включительно (может содержать ведущие нули). + +Конструкция с `{}` аналогична табличной функции [remote](remote.md). + +**Пример** + +1. Предположим у нас есть несколько файлов со следующими относительными путями: + +- ‘some\_dir/some\_file\_1’ +- ‘some\_dir/some\_file\_2’ +- ‘some\_dir/some\_file\_3’ +- ‘another\_dir/some\_file\_1’ +- ‘another\_dir/some\_file\_2’ +- ‘another\_dir/some\_file\_3’ + +1. Запросим количество строк в этих файлах: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. Запросим количество строк во всех файлах этих двух директорий: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "Warning" + Если ваш список файлов содержит интервал с ведущими нулями, используйте конструкцию с фигурными скобками для каждой цифры по отдельности или используйте `?`. + +**Пример** + +Запрос данных из файлов с именами `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## Виртуальные столбцы {#virtualnye-stolbtsy} + +- `_path` — Путь к файлу. +- `_file` — Имя файла. + +**Смотрите также** + +- [Виртуальные столбцы](index.md#table_engines-virtual_columns) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/file/) diff --git a/docs/ru/sql_reference/table_functions/generate.md b/docs/ru/sql-reference/table-functions/generate.md similarity index 100% rename from docs/ru/sql_reference/table_functions/generate.md rename to docs/ru/sql-reference/table-functions/generate.md diff --git a/docs/ru/sql_reference/table_functions/hdfs.md b/docs/ru/sql-reference/table-functions/hdfs.md similarity index 100% rename from docs/ru/sql_reference/table_functions/hdfs.md rename to docs/ru/sql-reference/table-functions/hdfs.md diff --git a/docs/ru/sql-reference/table-functions/index.md b/docs/ru/sql-reference/table-functions/index.md new file mode 100644 index 00000000000..79b247eaaf6 --- /dev/null +++ b/docs/ru/sql-reference/table-functions/index.md @@ -0,0 +1,37 @@ +--- +toc_folder_title: "\u0422\u0430\u0431\u043B\u0438\u0447\u043D\u044B\u0435 \u0444\u0443\ + \u043D\u043A\u0446\u0438\u0438" +toc_priority: 34 +toc_title: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0435" +--- + +# Табличные функции {#tablichnye-funktsii} + +Табличные функции — это метод создания таблиц. + +Табличные функции можно использовать в: + +- Секции [FROM](../statements/select.md#select-from) запроса `SELECT`. + + Это способ создания временной таблицы, которая доступна только в текущем запросе. + +- Запросе [CREATE TABLE AS \](../statements/create.md#create-table-query). + + Это один из методов создания таблицы. + +!!! warning "Предупреждение" + Если настройка [allow\_ddl](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) выключена, то использовать табличные функции невозможно. + +| Функция | Описание | +|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| [file](file.md) | Создаёт таблицу с движком [File](../../sql-reference/table-functions/index.md). | +| [merge](merge.md) | Создаёт таблицу с движком [Merge](../../sql-reference/table-functions/index.md). | +| [numbers](numbers.md) | Создаёт таблицу с единственным столбцом, заполненным целыми числами. | +| [remote](remote.md) | Предоставляет доступ к удалённым серверам, не создавая таблицу с движком [Distributed](../../sql-reference/table-functions/index.md). | +| [url](url.md) | Создаёт таблицу с движком [Url](../../sql-reference/table-functions/index.md). | +| [mysql](mysql.md) | Создаёт таблицу с движком [MySQL](../../sql-reference/table-functions/index.md). | +| [jdbc](jdbc.md) | Создаёт таблицу с дижком [JDBC](../../sql-reference/table-functions/index.md). | +| [odbc](odbc.md) | Создаёт таблицу с движком [ODBC](../../sql-reference/table-functions/index.md). | +| [hdfs](hdfs.md) | Создаёт таблицу с движком [HDFS](../../sql-reference/table-functions/index.md). | + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/) diff --git a/docs/ru/sql_reference/table_functions/input.md b/docs/ru/sql-reference/table-functions/input.md similarity index 100% rename from docs/ru/sql_reference/table_functions/input.md rename to docs/ru/sql-reference/table-functions/input.md diff --git a/docs/ru/sql_reference/table_functions/jdbc.md b/docs/ru/sql-reference/table-functions/jdbc.md similarity index 100% rename from docs/ru/sql_reference/table_functions/jdbc.md rename to docs/ru/sql-reference/table-functions/jdbc.md diff --git a/docs/ru/sql_reference/table_functions/merge.md b/docs/ru/sql-reference/table-functions/merge.md similarity index 100% rename from docs/ru/sql_reference/table_functions/merge.md rename to docs/ru/sql-reference/table-functions/merge.md diff --git a/docs/ru/sql-reference/table-functions/mysql.md b/docs/ru/sql-reference/table-functions/mysql.md new file mode 100644 index 00000000000..99d82022df4 --- /dev/null +++ b/docs/ru/sql-reference/table-functions/mysql.md @@ -0,0 +1,79 @@ +# mysql {#mysql} + +Позволяет выполнять запросы `SELECT` над данными, хранящимися на удалённом MySQL сервере. + +``` sql +mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +**Параметры** + +- `host:port` — адрес сервера MySQL. + +- `database` — имя базы данных на удалённом сервере. + +- `table` — имя таблицы на удалённом сервере. + +- `user` — пользователь MySQL. + +- `password` — пароль пользователя. + +- `replace_query` — флаг, отвечающий за преобразование запросов `INSERT INTO` в `REPLACE INTO`. Если `replace_query=1`, то запрос заменяется. + +- `on_duplicate_clause` — выражение `ON DUPLICATE KEY on_duplicate_clause`, добавляемое в запрос `INSERT`. + + Пример: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, где `on_duplicate_clause` это `UPDATE c2 = c2 + 1`. Чтобы узнать какие `on_duplicate_clause` можно использовать с секцией `ON DUPLICATE KEY` обратитесь к документации MySQL. + + Чтобы указать `'on_duplicate_clause'` необходимо передать `0` в параметр `replace_query`. Если одновременно передать `replace_query = 1` и `'on_duplicate_clause'`, то ClickHouse сгенерирует исключение. + +Простые условия `WHERE` такие как `=, !=, >, >=, <, =` выполняются на стороне сервера MySQL. + +Остальные условия и ограничение выборки `LIMIT` будут выполнены в ClickHouse только после выполнения запроса к MySQL. + +**Возвращаемое значение** + +Объект таблицы с теми же столбцами, что и в исходной таблице MySQL. + +## Пример использования {#primer-ispolzovaniia} + +Таблица в MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++--------+--------------+-------+----------------+ +| int_id | int_nullable | float | float_nullable | ++--------+--------------+-------+----------------+ +| 1 | NULL | 2 | NULL | ++--------+--------------+-------+----------------+ +1 row in set (0,00 sec) +``` + +Получение данных в ClickHouse: + +``` sql +SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Смотрите также {#smotrite-takzhe} + +- [Движок таблиц ‘MySQL’](../../sql-reference/table-functions/mysql.md) +- [Использование MySQL как источника данных для внешнего словаря](../../sql-reference/table-functions/mysql.md#dicts-external_dicts_dict_sources-mysql) + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/mysql/) diff --git a/docs/ru/sql_reference/table_functions/numbers.md b/docs/ru/sql-reference/table-functions/numbers.md similarity index 100% rename from docs/ru/sql_reference/table_functions/numbers.md rename to docs/ru/sql-reference/table-functions/numbers.md diff --git a/docs/ru/sql-reference/table-functions/odbc.md b/docs/ru/sql-reference/table-functions/odbc.md new file mode 100644 index 00000000000..38da5066cbd --- /dev/null +++ b/docs/ru/sql-reference/table-functions/odbc.md @@ -0,0 +1,101 @@ +# odbc {#table-functions-odbc} + +Возвращает таблицу, подключенную через [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +``` sql +odbc(connection_settings, external_database, external_table) +``` + +Параметры: + +- `connection_settings` — название секции с настройками соединения в файле `odbc.ini`. +- `external_database` — имя базы данных во внешней СУБД. +- `external_table` — имя таблицы в `external_database`. + +Чтобы использование ODBC было безопасным, ClickHouse использует отдельную программу `clickhouse-odbc-bridge`. Если драйвер ODBC подгружать непосредственно из `clickhouse-server`, то проблемы с драйвером могут привести к аварийной остановке сервера ClickHouse. ClickHouse автоматически запускает `clickhouse-odbc-bridge` по мере необходимости. Программа устанавливается из того же пакета, что и `clickhouse-server`. + +Поля из внешней таблицы со значениями `NULL` получают значение по умолчанию для базового типа данных. Например, если поле в удалённой таблице MySQL имеет тип `INT NULL` оно сконвертируется в 0 (значение по умолчанию для типа данных ClickHouse `Int32`). + +## Пример использования {#primer-ispolzovaniia} + +**Получение данных из локальной установки MySQL через ODBC** + +Этот пример проверялся в Ubuntu Linux 18.04 для MySQL server 5.7. + +Убедитесь, что unixODBC и MySQL Connector установлены. + +По умолчанию (если установлен из пакетов) ClickHouse запускается от имени пользователя `clickhouse`. Таким образом, вам нужно создать и настроить этого пользователя на сервере MySQL. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +Теперь настроим соединение в `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Вы можете проверить соединение с помощью утилиты `isql` из установки unixODBC. + +``` bash +$ isql -v mysqlconn ++---------------------------------------+ +| Connected! | +| | +... +``` + +Таблица в MySQL: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++--------+--------------+-------+----------------+ +| int_id | int_nullable | float | float_nullable | ++--------+--------------+-------+----------------+ +| 1 | NULL | 2 | NULL | ++--------+--------------+-------+----------------+ +1 row in set (0,00 sec) +``` + +Получение данных из таблицы MySQL в ClickHouse: + +``` sql +SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ 0 │ 2 │ 0 │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Смотрите также {#smotrite-takzhe} + +- [Внешние словари ODBC](../../sql-reference/table-functions/odbc.md#dicts-external_dicts_dict_sources-odbc) +- [Движок таблиц ODBC](../../sql-reference/table-functions/odbc.md). + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/jdbc/) diff --git a/docs/ru/sql-reference/table-functions/remote.md b/docs/ru/sql-reference/table-functions/remote.md new file mode 100644 index 00000000000..55c602d4bbf --- /dev/null +++ b/docs/ru/sql-reference/table-functions/remote.md @@ -0,0 +1,76 @@ +# remote, remoteSecure {#remote-remotesecure} + +Позволяет обратиться к удалённым серверам без создания таблицы типа `Distributed`. + +Сигнатуры: + +``` sql +remote('addresses_expr', db, table[, 'user'[, 'password']]) +remote('addresses_expr', db.table[, 'user'[, 'password']]) +``` + +`addresses_expr` - выражение, генерирующее адреса удалённых серверов. Это может быть просто один адрес сервера. Адрес сервера - это `хост:порт`, или только `хост`. Хост может быть указан в виде имени сервера, или в виде IPv4 или IPv6 адреса. IPv6 адрес указывается в квадратных скобках. Порт - TCP-порт удалённого сервера. Если порт не указан, используется `tcp_port` из конфигурационного файла сервера (по умолчанию - 9000). + +!!! important "Важно" + С IPv6-адресом обязательно нужно указывать порт. + +Примеры: + +``` text +example01-01-1 +example01-01-1:9000 +localhost +127.0.0.1 +[::]:9000 +[2a02:6b8:0:1111::11]:9000 +``` + +Адреса можно указать через запятую, в этом случае ClickHouse обработает запрос как распределённый, т.е. отправит его по всем указанным адресам как на шарды с разными данными. + +Пример: + +``` text +example01-01-1,example01-02-1 +``` + +Часть выражения может быть указана в фигурных скобках. Предыдущий пример может быть записан следующим образом: + +``` text +example01-0{1,2}-1 +``` + +В фигурных скобках может быть указан диапазон (неотрицательных целых) чисел через две точки. В этом случае, диапазон раскрывается в множество значений, генерирующих адреса шардов. Если запись первого числа начинается с нуля, то значения формируются с таким же выравниванием нулями. Предыдущий пример может быть записан следующим образом: + +``` text +example01-{01..02}-1 +``` + +При наличии нескольких пар фигурных скобок, генерируется прямое произведение соответствующих множеств. + +Адреса или их фрагменты в фигурных скобках можно указать через символ \|. В этом случае, соответствующие множества адресов понимаются как реплики - запрос будет отправлен на первую живую реплику. При этом, реплики перебираются в порядке, согласно текущей настройке [load\_balancing](../../operations/settings/settings.md). + +Пример: + +``` text +example01-{01..02}-{1|2} +``` + +В этом примере указано два шарда, в каждом из которых имеется две реплики. + +Количество генерируемых адресов ограничено константой - сейчас это 1000 штук. + +Использование табличной функции `remote` менее оптимально, чем создание таблицы типа `Distributed`, так как в этом случае, соединения с серверами устанавливаются заново при каждом запросе, в случае задания имён хостов, делается резолвинг имён, а также не ведётся подсчёт ошибок при работе с разными репликами. При обработке большого количества запросов, всегда создавайте `Distributed` таблицу заранее, не используйте табличную функцию `remote`. + +Табличная функция `remote` может быть полезна для следующих случаях: + +- обращение на конкретный сервер в целях сравнения данных, отладки и тестирования; +- запросы между разными кластерами ClickHouse в целях исследований; +- нечастых распределённых запросов, задаваемых вручную; +- распределённых запросов, где набор серверов определяется каждый раз заново. + +Если пользователь не задан,то используется `default`. +Если пароль не задан, то используется пустой пароль. + +`remoteSecure` - аналогично функции `remote`, но с соединением по шифрованному каналу. Порт по умолчанию - `tcp_port_secure` из конфига или 9440. + +[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/remote/) diff --git a/docs/ru/sql_reference/table_functions/url.md b/docs/ru/sql-reference/table-functions/url.md similarity index 100% rename from docs/ru/sql_reference/table_functions/url.md rename to docs/ru/sql-reference/table-functions/url.md diff --git a/docs/ru/sql_reference/aggregate_functions/combinators.md b/docs/ru/sql_reference/aggregate_functions/combinators.md deleted file mode 100644 index e4295f0d76e..00000000000 --- a/docs/ru/sql_reference/aggregate_functions/combinators.md +++ /dev/null @@ -1,116 +0,0 @@ -# Комбинаторы агрегатных функций {#aggregate_functions_combinators} - -К имени агрегатной функции может быть приписан некоторый суффикс. При этом, работа агрегатной функции некоторым образом модифицируется. - -## -If {#agg-functions-combinator-if} - -К имени любой агрегатной функции может быть приписан суффикс -If. В этом случае, агрегатная функция принимает ещё один дополнительный аргумент - условие (типа UInt8). Агрегатная функция будет обрабатывать только те строки, для которых условие сработало. Если условие ни разу не сработало - возвращается некоторое значение по умолчанию (обычно - нули, пустые строки). - -Примеры: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` и т. п. - -С помощью условных агрегатных функций, вы можете вычислить агрегаты сразу для нескольких условий, не используя подзапросы и `JOIN`-ы. -Например, в Яндекс.Метрике, условные агрегатные функции используются для реализации функциональности сравнения сегментов. - -## -Array {#array} - -К имени любой агрегатной функции может быть приписан суффикс -Array. В этом случае, агрегатная функция вместо аргументов типов T принимает аргументы типов Array(T) (массивы). Если агрегатная функция принимает несколько аргументов, то это должны быть массивы одинаковых длин. При обработке массивов, агрегатная функция работает, как исходная агрегатная функция по всем элементам массивов. - -Пример 1: `sumArray(arr)` - просуммировать все элементы всех массивов arr. В данном примере можно было бы написать проще: `sum(arraySum(arr))`. - -Пример 2: `uniqArray(arr)` - посчитать количество уникальных элементов всех массивов arr. Это можно было бы сделать проще: `uniq(arrayJoin(arr))`, но не всегда есть возможность добавить arrayJoin в запрос. - -Комбинаторы -If и -Array можно сочетать. При этом, должен сначала идти Array, а потом If. Примеры: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. Из-за такого порядка получается, что аргумент cond не должен быть массивом. - -## -State {#state} - -В случае применения этого комбинатора, агрегатная функция возвращает не готовое значение (например, в случае функции [uniq](reference.md#agg_function-uniq) — количество уникальных значений), а промежуточное состояние агрегации (например, в случае функции `uniq` — хэш-таблицу для расчёта количества уникальных значений), которое имеет тип `AggregateFunction(...)` и может использоваться для дальнейшей обработки или может быть сохранено в таблицу для последующей доагрегации. - -Для работы с промежуточными состояниями предназначены: - -- Движок таблиц [AggregatingMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md). -- Функция [finalizeAggregation](../../sql_reference/aggregate_functions/combinators.md#function-finalizeaggregation). -- Функция [runningAccumulate](../../sql_reference/aggregate_functions/combinators.md#function-runningaccumulate). -- Комбинатор [-Merge](#aggregate_functions_combinators_merge). -- Комбинатор [-MergeState](#aggregate_functions_combinators_mergestate). - -## -Merge {#aggregate_functions_combinators-merge} - -В случае применения этого комбинатора, агрегатная функция будет принимать в качестве аргумента промежуточное состояние агрегации, доагрегировать (объединять вместе) эти состояния, и возвращать готовое значение. - -## -MergeState {#aggregate_functions_combinators-mergestate} - -Выполняет слияние промежуточных состояний агрегации, аналогично комбинатору -Merge, но возвращает не готовое значение, а промежуточное состояние агрегации, аналогично комбинатору -State. - -## -ForEach {#foreach} - -Преобразует агрегатную функцию для таблиц в агрегатную функцию для массивов, которая применяет агрегирование для соответствующих элементов массивов и возвращает массив результатов. Например, `sumForEach` для массивов `[1, 2]`, `[3, 4, 5]` и `[6, 7]` даст результат `[10, 13, 5]`, сложив соответственные элементы массивов. - -## -Resample {#agg-functions-combinator-resample} - -Позволяет поделить данные на группы, а затем по-отдельности агрегирует данные для этих групп. Группы образуются разбиением значений одного из столбцов на интервалы. - -``` sql -Resample(start, end, step)(, resampling_key) -``` - -**Параметры** - -- `start` — начальное значение для интервала значений `resampling_key`. -- `stop` — конечное значение для интервала значений `resampling_key`. Интервал не включает значение `stop` (`[start, stop)`). -- `step` — шаг деления полного интервала на подинтервалы. Функция `aggFunction` выполняется для каждого из подинтервалов независимо. -- `resampling_key` — столбец, значения которого используются для разделения данных на интервалы. -- `aggFunction_params` — параметры `aggFunction`. - -**Возвращаемые значения** - -- Массив результатов `aggFunction` для каждого подинтервала. - -**Пример** - -Рассмотрим таблицу `people` со следующими данными: - -``` text -┌─name───┬─age─┬─wage─┐ -│ John │ 16 │ 10 │ -│ Alice │ 30 │ 15 │ -│ Mary │ 35 │ 8 │ -│ Evelyn │ 48 │ 11.5 │ -│ David │ 62 │ 9.9 │ -│ Brian │ 60 │ 16 │ -└────────┴─────┴──────┘ -``` - -Получим имена людей, чей возраст находится в интервалах `[30,60)` и `[60,75)`. Поскольку мы используем целочисленное представление возраста, то интервалы будут выглядеть как `[30, 59]` и `[60,74]`. - -Чтобы собрать имена в массив, возьмём агрегатную функцию [groupArray](reference.md#agg_function-grouparray). Она принимает один аргумент. В нашем случае, это столбец `name`. Функция `groupArrayResample` должна использовать столбец `age` для агрегирования имён по возрасту. Чтобы определить необходимые интервалы, передадим в функцию `groupArrayResample` аргументы `30, 75, 30`. - -``` sql -SELECT groupArrayResample(30, 75, 30)(name, age) from people -``` - -``` text -┌─groupArrayResample(30, 75, 30)(name, age)─────┐ -│ [['Alice','Mary','Evelyn'],['David','Brian']] │ -└───────────────────────────────────────────────┘ -``` - -Посмотрим на результаты. - -`Jonh` не попал в выдачу, поскольку слишком молод. Остальные распределены согласно заданным возрастным интервалам. - -Теперь посчитаем общее количество людей и их среднюю заработную плату в заданных возрастных интервалах. - -``` sql -SELECT - countResample(30, 75, 30)(name, age) AS amount, - avgResample(30, 75, 30)(wage, age) AS avg_wage -FROM people -``` - -``` text -┌─amount─┬─avg_wage──────────────────┐ -│ [3,2] │ [11.5,12.949999809265137] │ -└────────┴───────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/combinators/) diff --git a/docs/ru/sql_reference/aggregate_functions/index.md b/docs/ru/sql_reference/aggregate_functions/index.md deleted file mode 100644 index d28e105f6fc..00000000000 --- a/docs/ru/sql_reference/aggregate_functions/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -toc_folder_title: Агрегатные функции -toc_priority: 33 -toc_title: Введение ---- - -# Агрегатные функции {#aggregate-functions} - -Агрегатные функции работают в [привычном](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) для специалистов по базам данных смысле. - -ClickHouse поддерживает также: - -- [Параметрические агрегатные функции](parametric_functions.md#aggregate_functions_parametric), которые помимо столбцов принимаю и другие параметры. -- [Комбинаторы](combinators.md#aggregate_functions_combinators), которые изменяют поведение агрегатных функций. - -## Обработка NULL {#obrabotka-null} - -При агрегации все `NULL` пропускаются. - -**Примеры** - -Рассмотрим таблицу: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -Выполним суммирование значений в столбце `y`: - -``` sql -SELECT sum(y) FROM t_null_big -``` - -``` text -┌─sum(y)─┐ -│ 7 │ -└────────┘ -``` - -Функция `sum` работает с `NULL` как с `0`. В частности, это означает, что если на вход в функцию подать выборку, где все значения `NULL`, то результат будет `0`, а не `NULL`. - -Теперь с помощью функции `groupArray` сформируем массив из столбца `y`: - -``` sql -SELECT groupArray(y) FROM t_null_big -``` - -``` text -┌─groupArray(y)─┐ -│ [2,2,3] │ -└───────────────┘ -``` - -`groupArray` не включает `NULL` в результирующий массив. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/) diff --git a/docs/ru/sql_reference/aggregate_functions/parametric_functions.md b/docs/ru/sql_reference/aggregate_functions/parametric_functions.md deleted file mode 100644 index 70430d21eae..00000000000 --- a/docs/ru/sql_reference/aggregate_functions/parametric_functions.md +++ /dev/null @@ -1,479 +0,0 @@ -# Параметрические агрегатные функции {#aggregate_functions_parametric} - -Некоторые агрегатные функции могут принимать не только столбцы-аргументы (по которым производится свёртка), но и набор параметров - констант для инициализации. Синтаксис - две пары круглых скобок вместо одной. Первая - для параметров, вторая - для аргументов. - -## histogram {#histogram} - -Рассчитывает адаптивную гистограмму. Не гарантирует точного результата. - - histogram(number_of_bins)(values) - -Функция использует [A Streaming Parallel Decision Tree Algorithm](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Границы столбцов устанавливаются по мере поступления новых данных в функцию. В общем случае столбцы имею разную ширину. - -**Параметры** - -`number_of_bins` — максимальное количество корзин в гистограмме. Функция автоматически вычисляет количество корзин. Она пытается получить указанное количество корзин, но если не получилось, то в результате корзин будет меньше. -`values` — [выражение](../syntax.md#syntax-expressions), предоставляющее входные значения. - -**Возвращаемые значения** - -- [Массив](../../sql_reference/data_types/array.md) [кортежей](../../sql_reference/data_types/tuple.md) следующего вида: - - ``` - [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] - ``` - - - `lower` — нижняя граница корзины. - - `upper` — верхняя граница корзины. - - `height` — количество значений в корзине. - -**Пример** - -``` sql -SELECT histogram(5)(number + 1) -FROM ( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ -│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -С помощью функции [bar](../../sql_reference/aggregate_functions/parametric_functions.md#function-bar) можно визуализировать гистограмму, например: - -``` sql -WITH histogram(5)(rand() % 100) AS hist -SELECT - arrayJoin(hist).3 AS height, - bar(height, 0, 6, 5) AS bar -FROM -( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─height─┬─bar───┐ -│ 2.125 │ █▋ │ -│ 3.25 │ ██▌ │ -│ 5.625 │ ████▏ │ -│ 5.625 │ ████▏ │ -│ 3.375 │ ██▌ │ -└────────┴───────┘ -``` - -В этом случае необходимо помнить, что границы корзин гистограммы не известны. - -## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} - -Проверяет, содержит ли последовательность событий цепочку, которая соответствует указанному шаблону. - -``` sql -sequenceMatch(pattern)(timestamp, cond1, cond2, ...) -``` - -!!! warning "Предупреждение" - События, произошедшие в одну и ту же секунду, располагаются в последовательности в неопределенном порядке, что может повлиять на результат работы функции. - -**Параметры** - -- `pattern` — строка с шаблоном. Смотрите [Синтаксис шаблонов](#sequence-function-pattern-syntax). - -- `timestamp` — столбец, содержащий метки времени. Типичный тип данных столбца — `Date` или `DateTime`. Также можно использовать любой из поддержанных типов данных [UInt](../../sql_reference/aggregate_functions/parametric_functions.md). - -- `cond1`, `cond2` — условия, описывающие цепочку событий. Тип данных — `UInt8`. Можно использовать до 32 условий. Функция учитывает только те события, которые указаны в условиях. Функция пропускает данные из последовательности, если они не описаны ни в одном из условий. - -**Возвращаемые значения** - -- 1, если цепочка событий, соответствующая шаблону найдена. -- 0, если цепочка событий, соответствующая шаблону не найдена. - -Тип: `UInt8`. - - -**Синтаксис шаблонов** - -- `(?N)` — соответствует условию на позиции `N`. Условия пронумерованы по порядку в диапазоне `[1, 32]`. Например, `(?1)` соответствует условию, заданному параметром `cond1`. - -- `.*` — соответствует любому количеству событий. Для этого элемента шаблона не надо задавать условия. - -- `(?t operator value)` — устанавливает время в секундах, которое должно разделять два события. Например, шаблон `(?1)(?t>1800)(?2)` соответствует событиям, которые произошли более чем через 1800 секунд друг от друга. Между этими событиями может находиться произвольное количество любых событий. Операторы могут быть `>=`, `>`, `<`, `<=`. - -**Примеры** - -Пусть таблица `t` содержит следующие данные: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -└──────┴────────┘ -``` - -Выполним запрос: - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 1 │ -└───────────────────────────────────────────────────────────────────────┘ -``` - -Функция нашла цепочку событий, в которой число 2 следует за числом 1. Число 3 между ними было пропущено, поскольку оно не было использовано ни в одном из условий. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ -│ 0 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -В этом случае функция не может найти цепочку событий, соответствующую шаблону, поскольку событие для числа 3 произошло между 1 и 2. Если бы в этом же случае мы бы проверяли условие на событие для числа 4, то цепочка бы соответствовала шаблону. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ -│ 1 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Смотрите также** - -- [sequenceCount](#function-sequencecount) - -## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} - -Вычисляет количество цепочек событий, соответствующих шаблону. Функция обнаруживает только непересекающиеся цепочки событий. Она начитает искать следующую цепочку только после того, как полностью совпала текущая цепочка событий. - -!!! warning "Предупреждение" - События, произошедшие в одну и ту же секунду, располагаются в последовательности в неопределенном порядке, что может повлиять на результат работы функции. - -``` sql -sequenceCount(pattern)(timestamp, cond1, cond2, ...) -``` - -**Параметры** - -- `pattern` — строка с шаблоном. Смотрите [Синтаксис шаблонов](#sequence-function-pattern-syntax). - -- `timestamp` — столбец, содержащий метки времени. Типичный тип данных столбца — `Date` или `DateTime`. Также можно использовать любой из поддержанных типов данных [UInt](../../sql_reference/aggregate_functions/parametric_functions.md). - -- `cond1`, `cond2` — условия, описывающие цепочку событий. Тип данных — `UInt8`. Можно использовать до 32 условий. Функция учитывает только те события, которые указаны в условиях. Функция пропускает данные из последовательности, если они не описаны ни в одном из условий. - -**Возвращаемое значение** - -- Число непересекающихся цепочек событий, соответствущих шаблону. - -Тип: `UInt64`. - -**Пример** - -Пусть таблица `t` содержит следующие данные: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -│ 4 │ 1 │ -│ 5 │ 3 │ -│ 6 │ 2 │ -└──────┴────────┘ -``` - -Вычислим сколько раз число 2 стоит после числа 1, причем между 1 и 2 могут быть любые числа: - -``` sql -SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 2 │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -**Смотрите также** - -- [sequenceMatch](#function-sequencematch) - -## windowFunnel {#windowfunnel} - -Отыскивает цепочки событий в скользящем окне по времени и вычисляет максимальное количество произошедших событий из цепочки. - -Функция работает по алгоритму: - -- Функция отыскивает данные, на которых срабатывает первое условие из цепочки, и присваивает счетчику событий значение 1. С этого же момента начинается отсчет времени скользящего окна. - -- Если в пределах окна последовательно попадаются события из цепочки, то счетчик увеличивается. Если последовательность событий нарушается, то счетчик не растет. - -- Если в данных оказалось несколько цепочек разной степени завершенности, то функция выдаст только размер самой длинной цепочки. - -**Синтаксис** - -``` sql -windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) -``` - -**Параметры** - -- `window` — ширина скользящего окна по времени в секундах. [UInt](../../sql_reference/aggregate_functions/parametric_functions.md). -- `mode` - необязательный параметр. Если установлено значение `'strict'`, то функция `windowFunnel()` применяет условия только для уникальных значений. -- `timestamp` — имя столбца, содержащего временные отметки. [Date](../../sql_reference/aggregate_functions/parametric_functions.md), [DateTime](../../sql_reference/aggregate_functions/parametric_functions.md#data_type-datetime) и другие параметры с типом `Integer`. В случае хранения меток времени в столбцах с типом `UInt64`, максимально допустимое значение соответствует ограничению для типа `Int64`, т.е. равно `2^63-1`. -- `cond` — условия или данные, описывающие цепочку событий. [UInt8](../../sql_reference/aggregate_functions/parametric_functions.md). - -**Возвращаемое значение** - -Максимальное количество последовательно сработавших условий из цепочки в пределах скользящего окна по времени. Исследуются все цепочки в выборке. - -Тип: `Integer`. - -**Пример** - -Определим, успевает ли пользователь за установленный период выбрать телефон в интернет-магазине, купить его и сделать повторный заказ. - -Зададим следующую цепочку событий: - -1. Пользователь вошел в личный кабинет (`eventID = 1001`). -2. Пользователь ищет телефон (`eventID = 1003, product = 'phone'`). -3. Пользователь сделал заказ (`eventID = 1009`) -4. Пользователь сделал повторный заказ (`eventID = 1010`). - -Входная таблица: - -``` text -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -``` - -Сделаем запрос и узнаем, как далеко пользователь `user_id` смог пройти по цепочке за период в январе-феврале 2019-го года. - -Запрос: - -``` sql -SELECT - level, - count() AS c -FROM -( - SELECT - user_id, - windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level - FROM trend - WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') - GROUP BY user_id -) -GROUP BY level -ORDER BY level ASC -``` - -## retention {#retention} - -Аналитическая функция, которая показывает, насколько -выдерживаются те или иные условия, например, удержание динамики/уровня [посещаемости сайта](https://yandex.ru/support/partner2/statistics/metrika-visitors-statistics.html?lang=ru). - -Функция принимает набор (от 1 до 32) логических условий, как в [WHERE](../../sql_reference/statements/select.md#select-where), и применяет их к заданному набору данных. - -Условия, кроме первого, применяются попарно: результат второго будет истинным, если истинно первое и второе, третьего - если истинно первое и третье и т. д. - -**Синтаксис** - -``` sql -retention(cond1, cond2, ..., cond32) -``` - -**Параметры** - -- `cond` — вычисляемое условие или выражение, которое возвращает `UInt8` результат (1/0). - -**Возвращаемое значение** - -Массив из 1 или 0. - -- 1 — условие выполнено. -- 0 — условие не выполнено. - -Тип: `UInt8`. - -**Пример** - -Рассмотрим пример расчета функции `retention` для определения посещаемости сайта. - -**1.** Создадим таблицу для илюстрации примера. - -``` sql -CREATE TABLE retention_test(date Date, uid Int32)ENGINE = Memory; - -INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); -INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); -INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); -``` - -Входная таблица: - -Запрос: - -``` sql -SELECT * FROM retention_test -``` - -Ответ: - -``` text -┌───────date─┬─uid─┐ -│ 2020-01-01 │ 0 │ -│ 2020-01-01 │ 1 │ -│ 2020-01-01 │ 2 │ -│ 2020-01-01 │ 3 │ -│ 2020-01-01 │ 4 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-02 │ 0 │ -│ 2020-01-02 │ 1 │ -│ 2020-01-02 │ 2 │ -│ 2020-01-02 │ 3 │ -│ 2020-01-02 │ 4 │ -│ 2020-01-02 │ 5 │ -│ 2020-01-02 │ 6 │ -│ 2020-01-02 │ 7 │ -│ 2020-01-02 │ 8 │ -│ 2020-01-02 │ 9 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-03 │ 0 │ -│ 2020-01-03 │ 1 │ -│ 2020-01-03 │ 2 │ -│ 2020-01-03 │ 3 │ -│ 2020-01-03 │ 4 │ -│ 2020-01-03 │ 5 │ -│ 2020-01-03 │ 6 │ -│ 2020-01-03 │ 7 │ -│ 2020-01-03 │ 8 │ -│ 2020-01-03 │ 9 │ -│ 2020-01-03 │ 10 │ -│ 2020-01-03 │ 11 │ -│ 2020-01-03 │ 12 │ -│ 2020-01-03 │ 13 │ -│ 2020-01-03 │ 14 │ -└────────────┴─────┘ -``` - -**2.** Сгруппируем пользователей по уникальному идентификатору `uid` с помощью функции `retention`. - -Запрос: - -``` sql -SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r -FROM retention_test -WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') -GROUP BY uid -ORDER BY uid ASC -``` - -Результат: - -``` text -┌─uid─┬─r───────┐ -│ 0 │ [1,1,1] │ -│ 1 │ [1,1,1] │ -│ 2 │ [1,1,1] │ -│ 3 │ [1,1,1] │ -│ 4 │ [1,1,1] │ -│ 5 │ [0,0,0] │ -│ 6 │ [0,0,0] │ -│ 7 │ [0,0,0] │ -│ 8 │ [0,0,0] │ -│ 9 │ [0,0,0] │ -│ 10 │ [0,0,0] │ -│ 11 │ [0,0,0] │ -│ 12 │ [0,0,0] │ -│ 13 │ [0,0,0] │ -│ 14 │ [0,0,0] │ -└─────┴─────────┘ -``` - -**3.** Рассчитаем количество посещений сайта за день. - -Запрос: - -``` sql -SELECT - sum(r[1]) AS r1, - sum(r[2]) AS r2, - sum(r[3]) AS r3 -FROM -( - SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r - FROM retention_test - WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') - GROUP BY uid -) -``` - -Результат: - -``` text -┌─r1─┬─r2─┬─r3─┐ -│ 5 │ 5 │ 5 │ -└────┴────┴────┘ -``` - -Где: - -- `r1` - количество уникальных посетителей за 2020-01-01 (`cond1`). -- `r2` - количество уникальных посетителей в период между 2020-01-01 и 2020-01-02 (`cond1` и `cond2`). -- `r3` - количество уникальных посетителей в период между 2020-01-01 и 2020-01-03 (`cond1` и `cond3`). - -## uniqUpTo(N)(x) {#uniquptonx} - -Вычисляет количество различных значений аргумента, если оно меньше или равно N. -В случае, если количество различных значений аргумента больше N, возвращает N + 1. - -Рекомендуется использовать для маленьких N - до 10. Максимальное значение N - 100. - -Для состояния агрегатной функции используется количество оперативки равное 1 + N \* размер одного значения байт. -Для строк запоминается не криптографический хэш, имеющий размер 8 байт. То есть, для строк вычисление приближённое. - -Функция также работает для нескольких аргументов. - -Работает максимально быстро за исключением патологических случаев, когда используется большое значение N и количество уникальных значений чуть меньше N. - -Пример применения: - -``` text -Задача: показывать в отчёте только поисковые фразы, по которым было хотя бы 5 уникальных посетителей. -Решение: пишем в запросе GROUP BY SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/parametric_functions/) diff --git a/docs/ru/sql_reference/aggregate_functions/reference.md b/docs/ru/sql_reference/aggregate_functions/reference.md deleted file mode 100644 index b84e92ef7a8..00000000000 --- a/docs/ru/sql_reference/aggregate_functions/reference.md +++ /dev/null @@ -1,1739 +0,0 @@ -# Справочник функций {#spravochnik-funktsii} - -## count {#agg_function-count} - -Вычисляет количество строк или не NULL значений . - -ClickHouse поддерживает следующие виды синтаксиса для `count`: - -- `count(expr)` или `COUNT(DISTINCT expr)`. -- `count()` или `COUNT(*)`. Синтаксис `count()` специфичен для ClickHouse. - -**Параметры** - -Функция может принимать: - -- Ноль параметров. -- Одно [выражение](../syntax.md#syntax-expressions). - -**Возвращаемое значение** - -- Если функция вызывается без параметров, она вычисляет количество строк. -- Если передаётся [выражение](../syntax.md#syntax-expressions) , то функция вычисляет количество раз, когда выражение возвращает не NULL. Если выражение возвращает значение типа [Nullable](../../sql_reference/data_types/nullable.md), то результат `count` не становится `Nullable`. Функция возвращает 0, если выражение возвращает `NULL` для всех строк. - -В обоих случаях тип возвращаемого значения [UInt64](../../sql_reference/data_types/int_uint.md). - -**Подробности** - -ClickHouse поддерживает синтаксис `COUNT(DISTINCT ...)`. Поведение этой конструкции зависит от настройки [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation). Она определяет, какая из функций [uniq\*](#agg_function-uniq) используется для выполнения операции. По умолчанию — функция [uniqExact](#agg_function-uniqexact). - -Запрос `SELECT count() FROM table` не оптимизирован, поскольку количество записей в таблице не хранится отдельно. Он выбирает небольшой столбец из таблицы и подсчитывает количество значений в нём. - -**Примеры** - -Пример 1: - -``` sql -SELECT count() FROM t -``` - -``` text -┌─count()─┐ -│ 5 │ -└─────────┘ -``` - -Пример 2: - -``` sql -SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' -``` - -``` text -┌─name──────────────────────────┬─value─────┐ -│ count_distinct_implementation │ uniqExact │ -└───────────────────────────────┴───────────┘ -``` - -``` sql -SELECT count(DISTINCT num) FROM t -``` - -``` text -┌─uniqExact(num)─┐ -│ 3 │ -└────────────────┘ -``` - -Этот пример показывает, что `count(DISTINCT num)` выполняется с помощью функции `uniqExact` в соответствии со значением настройки `count_distinct_implementation`. - -## any(x) {#agg_function-any} - -Выбирает первое попавшееся значение. -Порядок выполнения запроса может быть произвольным и даже каждый раз разным, поэтому результат данной функции недетерминирован. -Для получения детерминированного результата, можно использовать функции min или max вместо any. - -В некоторых случаях, вы всё-таки можете рассчитывать на порядок выполнения запроса. Это - случаи, когда SELECT идёт из подзапроса, в котором используется ORDER BY. - -При наличии в запросе `SELECT` секции `GROUP BY` или хотя бы одной агрегатной функции, ClickHouse (в отличие от, например, MySQL) требует, чтобы все выражения в секциях `SELECT`, `HAVING`, `ORDER BY` вычислялись из ключей или из агрегатных функций. То есть, каждый выбираемый из таблицы столбец, должен использоваться либо в ключах, либо внутри агрегатных функций. Чтобы получить поведение, как в MySQL, вы можете поместить остальные столбцы в агрегатную функцию `any`. - -## anyHeavy(x) {#agg_function-anyheavy} - -Выбирает часто встречающееся значение с помощью алгоритма «[heavy hitters](http://www.cs.umd.edu/~samir/498/karp.pdf)». Если существует значение, которое встречается чаще, чем в половине случаев, в каждом потоке выполнения запроса, то возвращается данное значение. В общем случае, результат недетерминирован. - -``` sql -anyHeavy(column) -``` - -**Аргументы** - -- `column` — имя столбца. - -**Пример** - -Возьмём набор данных [OnTime](../../getting_started/example_datasets/ontime.md) и выберем произвольное часто встречающееся значение в столбце `AirlineID`. - -``` sql -SELECT anyHeavy(AirlineID) AS res -FROM ontime -``` - -``` text -┌───res─┐ -│ 19690 │ -└───────┘ -``` - -## anyLast(x) {#agg_function-anylast} - -Выбирает последнее попавшееся значение. -Результат так же недетерминирован, как и для функции `any`. - -## groupBitAnd {#groupbitand} - -Применяет побитовое `И` для последовательности чисел. - -``` sql -groupBitAnd(expr) -``` - -**Параметры** - -`expr` – выражение, результат которого имеет тип данных `UInt*`. - -**Возвращаемое значение** - -Значение типа `UInt*`. - -**Пример** - -Тестовые данные: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Запрос: - -``` sql -SELECT groupBitAnd(num) FROM t -``` - -Где `num` — столбец с тестовыми данными. - -Результат: - -``` text -binary decimal -00000100 = 4 -``` - -## groupBitOr {#groupbitor} - -Применяет побитовое `ИЛИ` для последовательности чисел. - -``` sql -groupBitOr(expr) -``` - -**Параметры** - -`expr` – выражение, результат которого имеет тип данных `UInt*`. - -**Возвращаемое значение** - -Значение типа `UInt*`. - -**Пример** - -Тестовые данные: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Запрос: - -``` sql -SELECT groupBitOr(num) FROM t -``` - -Где `num` — столбец с тестовыми данными. - -Результат: - -``` text -binary decimal -01111101 = 125 -``` - -## groupBitXor {#groupbitxor} - -Применяет побитовое `ИСКЛЮЧАЮЩЕЕ ИЛИ` для последовательности чисел. - -``` sql -groupBitXor(expr) -``` - -**Параметры** - -`expr` – выражение, результат которого имеет тип данных `UInt*`. - -**Возвращаемое значение** - -Значение типа `UInt*`. - -**Пример** - -Тестовые данные: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Запрос: - -``` sql -SELECT groupBitXor(num) FROM t -``` - -Где `num` — столбец с тестовыми данными. - -Результат: - -``` text -binary decimal -01101000 = 104 -``` - -## groupBitmap {#groupbitmap} - -Bitmap или агрегатные вычисления для столбца с типом данных `UInt*`, возвращают кардинальность в виде значения типа UInt64, если добавить суффикс -State, то возвращают [объект bitmap](../../sql_reference/aggregate_functions/reference.md). - -``` sql -groupBitmap(expr) -``` - -**Параметры** - -`expr` – выражение, результат которого имеет тип данных `UInt*`. - -**Возвращаемое значение** - -Значение типа `UInt64`. - -**Пример** - -Тестовые данные: - -``` text -UserID -1 -1 -2 -3 -``` - -Запрос: - -``` sql -SELECT groupBitmap(UserID) as num FROM t -``` - -Результат: - -``` text -num -3 -``` - -## min(x) {#agg_function-min} - -Вычисляет минимум. - -## max(x) {#agg_function-max} - -Вычисляет максимум. - -## argMin(arg, val) {#agg-function-argmin} - -Вычисляет значение arg при минимальном значении val. Если есть несколько разных значений arg для минимальных значений val, то выдаётся первое попавшееся из таких значений. - -**Пример:** - -``` text -┌─user─────┬─salary─┐ -│ director │ 5000 │ -│ manager │ 3000 │ -│ worker │ 1000 │ -└──────────┴────────┘ -``` - -``` sql -SELECT argMin(user, salary) FROM salary -``` - -``` text -┌─argMin(user, salary)─┐ -│ worker │ -└──────────────────────┘ -``` - -## argMax(arg, val) {#agg-function-argmax} - -Вычисляет значение arg при максимальном значении val. Если есть несколько разных значений arg для максимальных значений val, то выдаётся первое попавшееся из таких значений. - -## sum(x) {#agg_function-sum} - -Вычисляет сумму. -Работает только для чисел. - -## sumWithOverflow(x) {#agg_function-sumwithoverflow} - -Вычисляет сумму чисел, используя для результата тот же тип данных, что и для входных параметров. Если сумма выйдет за максимальное значение для заданного типа данных, то функция вернёт ошибку. - -Работает только для чисел. - -## sumMap(key, value) {#summapkey-value} - -Производит суммирование массива ‘value’ по соответствующим ключам заданным в массиве ‘key’. -Количество элементов в ‘key’ и ‘value’ должно быть одинаковым для каждой строки, для которой происходит суммирование. -Возвращает кортеж из двух массивов - ключи в отсортированном порядке и значения, просуммированные по соответствующим ключам. - -Пример: - -``` sql -CREATE TABLE sum_map( - date Date, - timeslot DateTime, - statusMap Nested( - status UInt16, - requests UInt64 - ) -) ENGINE = Log; -INSERT INTO sum_map VALUES - ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); -SELECT - timeslot, - sumMap(statusMap.status, statusMap.requests) -FROM sum_map -GROUP BY timeslot -``` - -``` text -┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ -│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ -│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ -└─────────────────────┴──────────────────────────────────────────────┘ -``` - -## skewPop {#skewpop} - -Вычисляет [коэффициент асимметрии](https://ru.wikipedia.org/wiki/Коэффициент_асимметрии) для последовательности. - -``` sql -skewPop(expr) -``` - -**Параметры** - -`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. - -**Возвращаемое значение** - -Коэффициент асимметрии заданного распределения. Тип — [Float64](../../sql_reference/aggregate_functions/reference.md) - -**Пример** - -``` sql -SELECT skewPop(value) FROM series_with_value_column -``` - -## skewSamp {#skewsamp} - -Вычисляет [выборочный коэффициент асимметрии](https://ru.wikipedia.org/wiki/Статистика_(функция_выборки)) для последовательности. - -Он представляет собой несмещенную оценку асимметрии случайной величины, если переданные значения образуют ее выборку. - -``` sql -skewSamp(expr) -``` - -**Параметры** - -`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. - -**Возвращаемое значение** - -Коэффициент асимметрии заданного распределения. Тип — [Float64](../../sql_reference/aggregate_functions/reference.md). Если `n <= 1` (`n` — размер выборки), тогда функция возвращает `nan`. - -**Пример** - -``` sql -SELECT skewSamp(value) FROM series_with_value_column -``` - -## kurtPop {#kurtpop} - -Вычисляет [коэффициент эксцесса](https://ru.wikipedia.org/wiki/Коэффициент_эксцесса) последовательности. - -``` sql -kurtPop(expr) -``` - -**Параметры** - -`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. - -**Возвращаемое значение** - -Коэффициент эксцесса заданного распределения. Тип — [Float64](../../sql_reference/aggregate_functions/reference.md) - -**Пример** - -``` sql -SELECT kurtPop(value) FROM series_with_value_column -``` - -## kurtSamp {#kurtsamp} - -Вычисляет [выборочный коэффициент эксцесса](https://ru.wikipedia.org/wiki/Статистика_(функция_выборки)) для последовательности. - -Он представляет собой несмещенную оценку эксцесса случайной величины, если переданные значения образуют ее выборку. - -``` sql -kurtSamp(expr) -``` - -**Параметры** - -`expr` — [Выражение](../syntax.md#syntax-expressions), возвращающее число. - -**Возвращаемое значение** - -Коэффициент эксцесса заданного распределения. Тип — [Float64](../../sql_reference/aggregate_functions/reference.md). Если `n <= 1` (`n` — размер выборки), тогда функция возвращает `nan`. - -**Пример** - -``` sql -SELECT kurtSamp(value) FROM series_with_value_column -``` - -## timeSeriesGroupSum(uid, timestamp, value) {#agg-function-timeseriesgroupsum} - -`timeSeriesGroupSum` агрегирует временные ряды в которых не совпадают моменты. -Функция использует линейную интерполяцию между двумя значениями времени, а затем суммирует значения для одного и того же момента (как измеренные так и интерполированные) по всем рядам. - -- `uid` уникальный идентификатор временного ряда, `UInt64`. -- `timestamp` имеет тип `Int64` чтобы можно было учитывать милли и микросекунды. -- `value` представляет собой значение метрики. - -Функция возвращает массив кортежей с парами `(timestamp, aggregated_value)`. - -Временные ряды должны быть отсортированы по возрастанию `timestamp`. - -Пример: - -``` text -┌─uid─┬─timestamp─┬─value─┐ -│ 1 │ 2 │ 0.2 │ -│ 1 │ 7 │ 0.7 │ -│ 1 │ 12 │ 1.2 │ -│ 1 │ 17 │ 1.7 │ -│ 1 │ 25 │ 2.5 │ -│ 2 │ 3 │ 0.6 │ -│ 2 │ 8 │ 1.6 │ -│ 2 │ 12 │ 2.4 │ -│ 2 │ 18 │ 3.6 │ -│ 2 │ 24 │ 4.8 │ -└─────┴───────────┴───────┘ -``` - -``` sql -CREATE TABLE time_series( - uid UInt64, - timestamp Int64, - value Float64 -) ENGINE = Memory; -INSERT INTO time_series VALUES - (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), - (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); - -SELECT timeSeriesGroupSum(uid, timestamp, value) -FROM ( - SELECT * FROM time_series order by timestamp ASC -); -``` - -И результат будет: - -``` text -[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] -``` - -## timeSeriesGroupRateSum(uid, ts, val) {#agg-function-timeseriesgroupratesum} - -Аналогично timeSeriesGroupSum, timeSeriesGroupRateSum будет вычислять производные по timestamp для рядов, а затем суммировать полученные производные для всех рядов для одного значения timestamp. -Также ряды должны быть отсортированы по возрастанию timestamp. - -Для пример из описания timeSeriesGroupSum результат будет следующим: - -``` text -[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] -``` - -## avg(x) {#agg_function-avg} - -Вычисляет среднее. -Работает только для чисел. -Результат всегда Float64. - - -## avgWeighted {#avgweighted} - -Вычисляет [среднее арифметическое взвешенное](https://ru.wikipedia.org/wiki/Среднее_арифметическое_взвешенное). - -**Синтаксис** - -```sql -avgWeighted(x, weight) -``` - -**Параметры** - -- `x` — Значения. [Целые числа](../../sql_reference/aggregate_functions/reference.md) или [числа с плавающей запятой](../../sql_reference/aggregate_functions/reference.md). -- `weight` — Веса отдельных значений. [Целые числа](../../sql_reference/aggregate_functions/reference.md) или [числа с плавающей запятой](../../sql_reference/aggregate_functions/reference.md). - -Типы параметров должны совпадать. - -**Возвращаемое значение** - -- Среднее арифметическое взвешенное. -- `NaN`, если все веса равны 0. - -Тип: [Float64](../../sql_reference/aggregate_functions/reference.md) - -**Пример** - -Запрос: - -```sql -SELECT avgWeighted(x, w) -FROM values('x Int8, w Int8', (4, 1), (1, 0), (10, 2)) -``` - -Результат: - -```text -┌─avgWeighted(x, weight)─┐ -│ 8 │ -└────────────────────────┘ -``` - - -## uniq {#agg_function-uniq} - -Приближённо вычисляет количество различных значений аргумента. - -``` sql -uniq(x[, ...]) -``` - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. - -**Возвращаемое значение** - -- Значение с типом данных [UInt64](../../sql_reference/aggregate_functions/reference.md). - -**Детали реализации** - -Функция: - -- Вычисляет хэш для всех параметров агрегации, а затем использует его в вычислениях. - -- Использует адаптивный алгоритм выборки. В качестве состояния вычисления функция использует выборку хэш-значений элементов размером до 65536. - - Этот алгоритм очень точен и очень эффективен по использованию CPU. Если запрос содержит небольшое количество этих функций, использование `uniq` почти так же эффективно, как и использование других агрегатных функций. - -- Результат детерминирован (не зависит от порядка выполнения запроса). - -Эту функцию рекомендуется использовать практически во всех сценариях. - -**Смотрите также** - -- [uniqCombined](#agg_function-uniqcombined) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined {#agg_function-uniqcombined} - -Приближённо вычисляет количество различных значений аргумента. - -``` sql -uniqCombined(HLL_precision)(x[, ...]) -``` - -Функция `uniqCombined` — это хороший выбор для вычисления количества различных значений. - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. - -`HLL_precision` — это логарифм по основанию 2 от числа ячеек в [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). Необязательный, можно использовать функцию как `uniqCombined (x [,...])`. Для `HLL_precision` значение по умолчанию — 17, что фактически составляет 96 КБ пространства (2^17 ячеек, 6 бит каждая). - -**Возвращаемое значение** - -- Число типа [UInt64](../../sql_reference/aggregate_functions/reference.md). - -**Детали реализации** - -Функция: - -- Вычисляет хэш (64-битный для `String` и 32-битный для всех остальных типов) для всех параметров агрегации, а затем использует его в вычислениях. - -- Используется комбинация трёх алгоритмов: массив, хэш-таблица и HyperLogLog с таблицей коррекции погрешности. - - Для небольшого количества различных значений используется массив. Если размер набора больше, используется хэш-таблица. При дальнейшем увеличении количества значений, используется структура HyperLogLog, имеющая фиксированный размер в памяти. - -- Результат детерминирован (не зависит от порядка выполнения запроса). - -!!! note "Note" - Так как используется 32-битный хэш для не-`String` типов, результат будет иметь очень очень большую ошибку для количества разичных элементов существенно больше `UINT_MAX` (ошибка быстро растёт начиная с нескольких десятков миллиардов различных значений), таким образом в этом случае нужно использовать [uniqCombined64](#agg_function-uniqcombined64) - -По сравнению с функцией [uniq](#agg_function-uniq), `uniqCombined`: - -- Потребляет в несколько раз меньше памяти. -- Вычисляет с в несколько раз более высокой точностью. -- Обычно имеет немного более низкую производительность. В некоторых сценариях `uniqCombined` может показывать более высокую производительность, чем `uniq`, например, в случае распределенных запросов, при которых по сети передаётся большое количество состояний агрегации. - -**Смотрите также** - -- [uniq](#agg_function-uniq) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined64 {#agg_function-uniqcombined64} - -Использует 64-битный хэш для всех типов, в отличие от [uniqCombined](#agg_function-uniqcombined). - -## uniqHLL12 {#agg_function-uniqhll12} - -Вычисляет приблизительное число различных значений аргументов, используя алгоритм [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). - -``` sql -uniqHLL12(x[, ...]) -``` - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. - -**Возвращаемое значение** - -- Значение хэша с типом данных [UInt64](../../sql_reference/aggregate_functions/reference.md). - -**Детали реализации** - -Функция: - -- Вычисляет хэш для всех параметров агрегации, а затем использует его в вычислениях. - -- Использует алгоритм HyperLogLog для аппроксимации числа различных значений аргументов. - - Используется 212 5-битовых ячеек. Размер состояния чуть больше 2.5 КБ. Результат не точный (ошибка до ~10%) для небольших множеств (<10K элементов). Однако для множеств большой кардинальности (10K - 100M) результат довольно точен (ошибка до ~1.6%). Начиная с 100M ошибка оценки будет только расти и для множеств огромной кардинальности (1B+ элементов) функция возвращает результат с очень большой неточностью. - -- Результат детерминирован (не зависит от порядка выполнения запроса). - -Мы не рекомендуем использовать эту функцию. В большинстве случаев используйте функцию [uniq](#agg_function-uniq) или [uniqCombined](#agg_function-uniqcombined). - -**Смотрите также** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqExact](#agg_function-uniqexact) - -## uniqExact {#agg_function-uniqexact} - -Вычисляет точное количество различных значений аргументов. - -``` sql -uniqExact(x[, ...]) -``` - -Функцию `uniqExact` следует использовать, если вам обязательно нужен точный результат. В противном случае используйте функцию [uniq](#agg_function-uniq). - -Функция `uniqExact` расходует больше оперативной памяти, чем функция `uniq`, так как размер состояния неограниченно растёт по мере роста количества различных значений. - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть числовых типов, а также `Tuple`, `Array`, `Date`, `DateTime`, `String`. - -**Смотрите также** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqHLL12](#agg_function-uniqhll12) - -## groupArray(x), groupArray(max\_size)(x) {#agg_function-grouparray} - -Составляет массив из значений аргумента. -Значения в массив могут быть добавлены в любом (недетерминированном) порядке. - -Вторая версия (с параметром `max_size`) ограничивает размер результирующего массива `max_size` элементами. -Например, `groupArray(1)(x)` эквивалентно `[any(x)]`. - -В некоторых случаях, вы всё же можете рассчитывать на порядок выполнения запроса. Это — случаи, когда `SELECT` идёт из подзапроса, в котором используется `ORDER BY`. - -## groupArrayInsertAt(value, position) {#grouparrayinsertatvalue-position} - -Вставляет в массив значение в заданную позицию. - -!!! note "Примечание" - Эта функция использует нумерацию массивов с нуля, в отличие от принятой в SQL нумерации с единицы. - -Принимает на вход значение и позицию. Если на одну и ту же позицию вставляется несколько значений, в результирующем массиве может оказаться любое (первое в случае однопоточного выполнения). Если в позицию не вставляется ни одного значения, то позиции присваивается значение по умолчанию. - -Опциональные параметры: - -- Значение по умолчанию для подстановки на пустые позиции. -- Длина результирующего массива. Например, если вы хотите получать массивы одинакового размера для всех агрегатных ключей. При использовании этого параметра значение по умолчанию задавать обязательно. - -## groupArrayMovingSum {#agg_function-grouparraymovingsum} - -Вычисляет скользящую сумму входных значений. - -``` sql -groupArrayMovingSum(numbers_for_summing) -groupArrayMovingSum(window_size)(numbers_for_summing) -``` - -Функция может принимать размер окна в качестве параметра. Если окно не указано, то функция использует размер окна, равный количеству строк в столбце. - -**Параметры** - -- `numbers_for_summing` — [выражение](../syntax.md#syntax-expressions), возвращающее значение числового типа. -- `window_size` — размер окна. - -**Возвращаемые значения** - -- Массив того же размера и типа, что и входные данные. - -**Пример** - -Таблица с исходными данными: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Запросы: - -``` sql -SELECT - groupArrayMovingSum(int) AS I, - groupArrayMovingSum(float) AS F, - groupArrayMovingSum(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingSum(2)(int) AS I, - groupArrayMovingSum(2)(float) AS F, - groupArrayMovingSum(2)(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -## groupArrayMovingAvg {#agg_function-grouparraymovingavg} - -Вычисляет скользящее среднее для входных значений. - - groupArrayMovingAvg(numbers_for_summing) - groupArrayMovingAvg(window_size)(numbers_for_summing) - -Функция может принимать размер окна в качестве параметра. Если окно не указано, то функция использует размер окна, равный количеству строк в столбце. - -**Параметры** - -- `numbers_for_summing` — [выражение](../syntax.md#syntax-expressions), возвращающее значение числового типа. -- `window_size` — размер окна. - -**Возвращаемые значения** - -- Массив того же размера и типа, что и входные данные. - -Функция использует [округление к меньшему по модулю](https://ru.wikipedia.org/wiki/Округление#Методы). Оно усекает десятичные разряды, незначимые для результирующего типа данных. - -**Пример** - -Таблица с исходными данными: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Запросы: - -``` sql -SELECT - groupArrayMovingAvg(int) AS I, - groupArrayMovingAvg(float) AS F, - groupArrayMovingAvg(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ -│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ -└───────────┴─────────────────────────────────────┴───────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingAvg(2)(int) AS I, - groupArrayMovingAvg(2)(float) AS F, - groupArrayMovingAvg(2)(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ -│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ -└───────────┴──────────────────────────────────┴───────────────────────┘ -``` - -## groupUniqArray(x), groupUniqArray(max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} - -Составляет массив из различных значений аргумента. Расход оперативной памяти такой же, как у функции `uniqExact`. - -Функция `groupUniqArray(max_size)(x)` ограничивает размер результирующего массива до `max_size` элементов. Например, `groupUniqArray(1)(x)` равнозначно `[any(x)]`. - -## quantile {#quantile} - -Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности. - -Функция использует алгоритм [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) с размером резервуара до 8192 и случайным генератором чисел для для сэмплирования. Результат не детерминирован. Чтобы получить точную квантиль используйте функцию [quantileExact](#quantileexact). - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantile(level)(expr) -``` - -Алиас: `median`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). -- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql_reference/aggregate_functions/reference.md#data_types) или типов [Date](../../sql_reference/aggregate_functions/reference.md), [DateTime](../../sql_reference/aggregate_functions/reference.md). - -**Возвращаемое значение** - -- Приблизительный квантиль заданного уровня. - -Тип: - -- [Float64](../../sql_reference/aggregate_functions/reference.md) для входных данных числового типа. -- [Date](../../sql_reference/aggregate_functions/reference.md), если входные значения имеют тип `Date`. -- [DateTime](../../sql_reference/aggregate_functions/reference.md), если входные значения имеют тип `DateTime`. - -**Пример** - -Входная таблица: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Запрос: - -``` sql -SELECT quantile(val) FROM t -``` - -Результат: - -``` text -┌─quantile(val)─┐ -│ 1.5 │ -└───────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## quantileDeterministic {#quantiledeterministic} - -Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности. - -Функция использует алгоритм [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) с размером резервуара до 8192 и детерминированным алгоритмом сэмплирования. Результат детерминирован. Чтобы получить точную квантиль используйте функцию [quantileExact](#quantileexact). - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantileDeterministic(level)(expr, determinator) -``` - -Алиас: `medianDeterministic`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). -- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql_reference/aggregate_functions/reference.md#data_types) или типов [Date](../../sql_reference/aggregate_functions/reference.md), [DateTime](../../sql_reference/aggregate_functions/reference.md). -- `determinator` — Число, хэш которого используется при сэмплировании в алгоритме reservoir sampling, чтобы сделать результат детерминированным. В качестве детерминатора можно использовать любое определённое положительное число, например, идентификатор пользователя или события. Если одно и то же значение детерминатора попадается в выборке слишком часто, то функция выдаёт некорректный результат. - -**Возвращаемое значение** - -- Приблизительный квантиль заданного уровня. - -Тип: - -- [Float64](../../sql_reference/aggregate_functions/reference.md) для входных данных числового типа. -- [Date](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `Date`. -- [DateTime](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `DateTime`. - -**Пример** - -Входная таблица: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Запрос: - -``` sql -SELECT quantileDeterministic(val, 1) FROM t -``` - -Результат: - -``` text -┌─quantileDeterministic(val, 1)─┐ -│ 1.5 │ -└───────────────────────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## quantileExact {#quantileexact} - -Точно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности. - -Чтобы получить точный результат, все переданные значения собираются в массив, который затем частично сортируется. Таким образом, функция потребляет объем памяти `O(n)`, где `n` — количество переданных значений. Для небольшого числа значений эта функция эффективна. - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantileExact(level)(expr) -``` - -Алиас: `medianExact`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). -- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql_reference/aggregate_functions/reference.md#data_types) или типов [Date](../../sql_reference/aggregate_functions/reference.md), [DateTime](../../sql_reference/aggregate_functions/reference.md). - -**Возвращаемое значение** - -- Квантиль заданного уровня. - -Тип: - -- [Float64](../../sql_reference/aggregate_functions/reference.md) для входных данных числового типа. -- [Date](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `Date`. -- [DateTime](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `DateTime`. - -**Пример** - -Запрос: - -``` sql -SELECT quantileExact(number) FROM numbers(10) -``` - -Результат: - -``` text -┌─quantileExact(number)─┐ -│ 5 │ -└───────────────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## quantileExactWeighted {#quantileexactweighted} - -Точно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, учитывая вес каждого её элемента. - -Чтобы получить точный результат, все переданные значения собираются в массив, который затем частично сортируется. Для каждого значения учитывается его вес (количество значений в выборке). В алгоритме используется хэш-таблица. Таким образом, если переданные значения часто повторяются, функция потребляет меньше оперативной памяти, чем [quantileExact](#quantileexact). Эту функцию можно использовать вместо `quantileExact` если указать вес 1. - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantileExactWeighted(level)(expr, weight) -``` - -Алиас: `medianExactWeighted`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). -- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql_reference/aggregate_functions/reference.md#data_types) или типов [Date](../../sql_reference/aggregate_functions/reference.md), [DateTime](../../sql_reference/aggregate_functions/reference.md). -- `weight` — Столбец с весам элементов последовательности. Вес — это количество повторений элемента в последовательности. - -**Возвращаемое значение** - -- Quantile of the specified level. - -Тип: - -- [Float64](../../sql_reference/aggregate_functions/reference.md) для входных данных числового типа. -- [Date](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `Date`. -- [DateTime](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `DateTime`. - -**Пример** - -Входная таблица: - -``` text -┌─n─┬─val─┐ -│ 0 │ 3 │ -│ 1 │ 2 │ -│ 2 │ 1 │ -│ 5 │ 4 │ -└───┴─────┘ -``` - -Запрос: - -``` sql -SELECT quantileExactWeighted(n, val) FROM t -``` - -Результат: - -``` text -┌─quantileExactWeighted(n, val)─┐ -│ 1 │ -└───────────────────────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## quantileTiming {#quantiletiming} - -Вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности с детерминированной точностью. - -Результат детерминирован (не зависит от порядка обработки запроса). Функция оптимизирована для работы с последовательностями, описывающими такие распределения, как время загрузки веб-страниц или время отклика бэкенда. - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantileTiming(level)(expr) -``` - -Алиас: `medianTiming`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). - -- `expr` — [Выражение](../syntax.md#syntax-expressions) над значения столбца, которые возвращают данные типа [Float\*](../../sql_reference/aggregate_functions/reference.md). - - - Если в функцию передать отрицательные значения, то её поведение не определено. - - Если значение больше, чем 30 000 (например, время загрузки страницы превышает 30 секунд), то оно приравнивается к 30 000. - -**Точность** - -Вычисления точны при соблюдении следующих условий: - -- Размер выборки не превышает 5670 элементов. -- Размер выборки превышает 5670 элементов, но значение каждого элемента не больше 1024. - -В противном случае, результат вычисления округляется до ближайшего множителя числа 16. - -!!! note "Примечание" - Для указанного типа последовательностей функция производительнее и точнее, чем [quantile](#quantile). - -**Возвращаемое значение** - -- Квантиль заданного уровня. - -Тип: `Float32`. - -!!! note "Примечания" - Если в функцию `quantileTimingIf` не передать значений, то вернётся [NaN](../../sql_reference/aggregate_functions/reference.md#data_type-float-nan-inf). Это необходимо для отделения подобных случаев от случаев, когда результат 0. Подробности про сортировку `NaN` cмотрите в разделе [Секция ORDER BY](../../sql_reference/statements/select.md#select-order-by). - -**Пример** - -Входная таблица: - -``` text -┌─response_time─┐ -│ 72 │ -│ 112 │ -│ 126 │ -│ 145 │ -│ 104 │ -│ 242 │ -│ 313 │ -│ 168 │ -│ 108 │ -└───────────────┘ -``` - -Запрос: - -``` sql -SELECT quantileTiming(response_time) FROM t -``` - -Результат: - -``` text -┌─quantileTiming(response_time)─┐ -│ 126 │ -└───────────────────────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## quantileTimingWeighted {#quantiletimingweighted} - -С детерминированной точностью вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, учитывая вес каждого элемента. - -Результат детерминирован (не зависит от порядка обработки запроса). Функция оптимизирована для работы с последовательностями, описывающими такие распределения, как время загрузки веб-страниц или время отклика бэкенда. - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantileTimingWeighted(level)(expr, weight) -``` - -Алиас: `medianTimingWeighted`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). - -- `expr` — [Выражение](../syntax.md#syntax-expressions) над значения столбца, которые возвращают данные типа [Float\*](../../sql_reference/aggregate_functions/reference.md). - - - Если в функцию передать отрицательные значения, то её поведение не определено. - - Если значение больше, чем 30 000 (например, время загрузки страницы превышает 30 секунд), то оно приравнивается к 30 000. - -- `weight` — Столбец с весам элементов последовательности. Вес — это количество повторений элемента в последовательности. - -**Точность** - -Вычисления точны при соблюдении следующих условий: - -- Размер выборки не превышает 5670 элементов. -- Размер выборки превышает 5670 элементов, но значение каждого элемента не больше 1024. - -В противном случае, результат вычисления округляется до ближайшего множителя числа 16. - -!!! note "Примечание" - Для указанного типа последовательностей функция производительнее и точнее, чем [quantile](#quantile). - -**Возвращаемое значение** - -- Квантиль заданного уровня. - -Тип: `Float32`. - -!!! note "Примечания" - Если в функцию `quantileTimingIf` не передать значений, то вернётся [NaN](../../sql_reference/aggregate_functions/reference.md#data_type-float-nan-inf). Это необходимо для отделения подобных случаев от случаев, когда результат 0. Подробности про сортировку `NaN` cмотрите в разделе [Секция ORDER BY](../../sql_reference/statements/select.md#select-order-by). - -**Пример** - -Входная таблица: - -``` text -┌─response_time─┬─weight─┐ -│ 68 │ 1 │ -│ 104 │ 2 │ -│ 112 │ 3 │ -│ 126 │ 2 │ -│ 138 │ 1 │ -│ 162 │ 1 │ -└───────────────┴────────┘ -``` - -Запрос: - -``` sql -SELECT quantileTimingWeighted(response_time, weight) FROM t -``` - -Результат: - -``` text -┌─quantileTimingWeighted(response_time, weight)─┐ -│ 112 │ -└───────────────────────────────────────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## quantileTDigest {#quantiletdigest} - -Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, используя алгоритм [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf). - -Максимальная ошибка 1%. Потребление памяти — `log(n)`, где `n` — число значений. Результат не детерминирован и зависит от порядка выполнения запроса. - -Производительность функции ниже, чем производительность функции [quantile](#quantile) или [quantileTiming](#quantiletiming). По соотношению размера состояния к точности вычисления, эта функция значительно превосходит `quantile`. - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantileTDigest(level)(expr) -``` - -Алиас: `medianTDigest`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). -- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql_reference/aggregate_functions/reference.md#data_types) или типов [Date](../../sql_reference/aggregate_functions/reference.md), [DateTime](../../sql_reference/aggregate_functions/reference.md). - -**Возвращаемое значение** - -- Приблизительную квантиль заданного уровня. - -Тип: - -- [Float64](../../sql_reference/aggregate_functions/reference.md) для входных данных числового типа. -- [Date](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `Date`. -- [DateTime](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `DateTime`. - -**Пример** - -Запрос: - -``` sql -SELECT quantileTDigest(number) FROM numbers(10) -``` - -Результат: - -``` text -┌─quantileTDigest(number)─┐ -│ 4.5 │ -└─────────────────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## quantileTDigestWeighted {#quantiletdigestweighted} - -Приблизительно вычисляет [квантиль](https://ru.wikipedia.org/wiki/Квантиль) числовой последовательности, используя алгоритм [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf). Функция учитывает вес каждого элемента последовательности. - -Максимальная ошибка 1%. Потребление памяти — `log(n)`, где `n` — число значений. Результат не детерминирован и зависит от порядка выполнения запроса. - -Производительность функции ниже, чем производительность функции [quantile](#quantile) или [quantileTiming](#quantiletiming). По соотношению размера состояния к точности вычисления, эта функция значительно превосходит `quantile`. - -Внутренние состояния функций `quantile*` не объединяются, если они используются в одном запросе. Если вам необходимо вычислить квантили нескольких уровней, используйте функцию [quantiles](#quantiles), это повысит эффективность запроса. - -**Синтаксис** - -``` sql -quantileTDigestWeighted(level)(expr, weight) -``` - -Алиас: `medianTDigest`. - -**Параметры** - -- `level` — Уровень квантили. Опционально. Константное значение с плавающей запятой от 0 до 1. Мы рекомендуем использовать значение `level` из диапазона `[0.01, 0.99]`. Значение по умолчанию: 0.5. При `level=0.5` функция вычисляет [медиану](https://ru.wikipedia.org/wiki/Медиана_(статистика)). -- `expr` — Выражение над значениями столбца, которое возвращает данные [числовых типов](../../sql_reference/aggregate_functions/reference.md#data_types) или типов [Date](../../sql_reference/aggregate_functions/reference.md), [DateTime](../../sql_reference/aggregate_functions/reference.md). -- `weight` — Столбец с весам элементов последовательности. Вес — это количество повторений элемента в последовательности. - -**Возвращаемое значение** - -- Приблизительный квантиль заданного уровня. - -Тип: - -- [Float64](../../sql_reference/aggregate_functions/reference.md) для входных данных числового типа. -- [Date](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `Date`. -- [DateTime](../../sql_reference/aggregate_functions/reference.md) если входные значения имеют тип `DateTime`. - -**Пример** - -Запрос: - -``` sql -SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) -``` - -Результат: - -``` text -┌─quantileTDigestWeighted(number, 1)─┐ -│ 4.5 │ -└────────────────────────────────────┘ -``` - -**Смотрите также** - -- [median](#median) -- [quantiles](#quantiles) - -## median {#median} - -Функции `median*` — алиасы для соответствущих функций `quantile*`. Они вычисляют медиану числовой последовательности. - -Functions: - -- `median` — алиас [quantile](#quantile). -- `medianDeterministic` — алиас [quantileDeterministic](#quantiledeterministic). -- `medianExact` — алиас [quantileExact](#quantileexact). -- `medianExactWeighted` — алиас [quantileExactWeighted](#quantileexactweighted). -- `medianTiming` — алиас [quantileTiming](#quantiletiming). -- `medianTimingWeighted` — алиас [quantileTimingWeighted](#quantiletimingweighted). -- `medianTDigest` — алиас [quantileTDigest](#quantiletdigest). -- `medianTDigestWeighted` — алиас [quantileTDigestWeighted](#quantiletdigestweighted). - -**Пример** - -Входная таблица: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Запрос: - -``` sql -SELECT medianDeterministic(val, 1) FROM t -``` - -Результат: - -``` text -┌─medianDeterministic(val, 1)─┐ -│ 1.5 │ -└─────────────────────────────┘ -``` - -## quantiles(level1, level2, …)(x) {#quantiles} - -Для всех quantile-функций, также присутствуют соответствующие quantiles-функции: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Эти функции за один проход вычисляют все квантили перечисленных уровней и возвращают массив вычисленных значений. - -## varSamp(x) {#varsampx} - -Вычисляет величину `Σ((x - x̅)^2) / (n - 1)`, где `n` - размер выборки, `x̅`- среднее значение `x`. - -Она представляет собой несмещённую оценку дисперсии случайной величины, если переданные в функцию значения являются выборкой этой случайной величины. - -Возвращает `Float64`. В случае, когда `n <= 1`, возвращается `+∞`. - -## varPop(x) {#varpopx} - -Вычисляет величину `Σ((x - x̅)^2) / n`, где `n` - размер выборки, `x̅`- среднее значение `x`. - -То есть, дисперсию для множества значений. Возвращает `Float64`. - -## stddevSamp(x) {#stddevsampx} - -Результат равен квадратному корню от `varSamp(x)`. - -## stddevPop(x) {#stddevpopx} - -Результат равен квадратному корню от `varPop(x)`. - -## topK(N)(column) {#topkncolumn} - -Возвращает массив наиболее часто встречающихся значений в указанном столбце. Результирующий массив упорядочен по убыванию частоты значения (не по самим значениям). - -Реализует [Filtered Space-Saving](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) алгоритм для анализа TopK, на основе reduce-and-combine алгоритма из методики [Parallel Space Saving](https://arxiv.org/pdf/1401.0702.pdf). - -``` sql -topK(N)(column) -``` - -Функция не дает гарантированного результата. В некоторых ситуациях могут возникать ошибки, и функция возвращает частые, но не наиболее частые значения. - -Рекомендуем использовать значения `N < 10`, при больших `N` снижается производительность. Максимально возможное значение `N = 65536`. - -**Аргументы** - -- ‘N’ - Количество значений. -- ‘x’ – Столбец. - -**Пример** - -Возьмём набор данных [OnTime](../../getting_started/example_datasets/ontime.md) и выберем 3 наиболее часто встречающихся значения в столбце `AirlineID`. - -``` sql -SELECT topK(3)(AirlineID) AS res -FROM ontime -``` - -``` text -┌─res─────────────────┐ -│ [19393,19790,19805] │ -└─────────────────────┘ -``` - -## topKWeighted {#topkweighted} - -Аналогична `topK`, но дополнительно принимает положительный целочисленный параметр `weight`. Каждое значение учитывается `weight` раз при расчёте частоты. - -**Синтаксис** - -``` sql -topKWeighted(N)(x, weight) -``` - -**Параметры** - -- `N` — Количество элементов для выдачи. - -**Аргументы** - -- `x` – значение. -- `weight` — вес. [UInt8](../../sql_reference/aggregate_functions/reference.md). - -**Возвращаемое значение** - -Возвращает массив значений с максимально приближенной суммой весов. - -**Пример** - -Запрос: - -``` sql -SELECT topKWeighted(10)(number, number) FROM numbers(1000) -``` - -Результат: - -``` text -┌─topKWeighted(10)(number, number)──────────┐ -│ [999,998,997,996,995,994,993,992,991,990] │ -└───────────────────────────────────────────┘ -``` - -## covarSamp(x, y) {#covarsampx-y} - -Вычисляет величину `Σ((x - x̅)(y - y̅)) / (n - 1)`. - -Возвращает Float64. В случае, когда `n <= 1`, возвращается +∞. - -## covarPop(x, y) {#covarpopx-y} - -Вычисляет величину `Σ((x - x̅)(y - y̅)) / n`. - -## corr(x, y) {#corrx-y} - -Вычисляет коэффициент корреляции Пирсона: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. - -## simpleLinearRegression {#simplelinearregression} - -Выполняет простую (одномерную) линейную регрессию. - -``` sql -simpleLinearRegression(x, y) -``` - -Параметры: - -- `x` — столбец со значениями зависимой переменной. -- `y` — столбец со значениями наблюдаемой переменной. - -Возвращаемые значения: - -Константы `(a, b)` результирующей прямой `y = a*x + b`. - -**Примеры** - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ -│ (1,0) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ -│ (1,3) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## stochasticLinearRegression {#agg_functions-stochasticlinearregression} - -Функция реализует стохастическую линейную регрессию. Поддерживает пользовательские параметры для скорости обучения, коэффициента регуляризации L2, размера mini-batch и имеет несколько методов обновления весов ([Adam](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (по умолчанию), [simple SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [Momentum](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). - -### Параметры {#agg_functions-stochasticlinearregression-parameters} - -Есть 4 настраиваемых параметра. Они передаются в функцию последовательно, однако не обязательно указывать все, используются значения по умолчанию, однако хорошая модель требует некоторой настройки параметров. - -``` text -stochasticLinearRegression(1.0, 1.0, 10, 'SGD') -``` - -1. Скорость обучения — коэффициент длины шага, при выполнении градиентного спуска. Слишком большая скорость обучения может привести к бесконечным весам модели. По умолчанию `0.00001`. -2. Коэффициент регуляризации l2. Помогает предотвратить подгонку. По умолчанию `0.1`. -3. Размер mini-batch задаёт количество элементов, чьи градиенты будут вычислены и просуммированы при выполнении одного шага градиентного спуска. Чистый стохастический спуск использует один элемент, однако использование mini-batch (около 10 элементов) делает градиентные шаги более стабильными. По умолчанию `15`. -4. Метод обновления весов, можно выбрать один из следующих: `Adam` (по умолчанию), `SGD`, `Momentum`, `Nesterov`. `Momentum` и `Nesterov` более требовательные к вычислительным ресурсам и памяти, однако они имеют высокую скорость схождения и устойчивости методов стохастического градиента. - -### Использование {#agg_functions-stochasticlinearregression-usage} - -`stochasticLinearRegression` используется на двух этапах: построение модели и предсказание новых данных. Чтобы построить модель и сохранить её состояние для дальнейшего использования, мы используем комбинатор `-State`. -Для прогнозирования мы используем функцию [evalMLMethod](../functions/machine_learning_functions.md#machine_learning_methods-evalmlmethod), которая принимает в качестве аргументов состояние и свойства для прогнозирования. - - - -**1.** Построение модели - -Пример запроса: - -``` sql -CREATE TABLE IF NOT EXISTS train_data -( - param1 Float64, - param2 Float64, - target Float64 -) ENGINE = Memory; - -CREATE TABLE your_model ENGINE = Memory AS SELECT -stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) -AS state FROM train_data; -``` - -Здесь нам также нужно вставить данные в таблицу `train_data`. Количество параметров не фиксировано, оно зависит только от количества аргументов, перешедших в `linearRegressionState`. Все они должны быть числовыми значениями. -Обратите внимание, что столбец с целевым значением (которое мы хотели бы научиться предсказывать) вставляется в качестве первого аргумента. - -**2.** Прогнозирование - -После сохранения состояния в таблице мы можем использовать его несколько раз для прогнозирования или смёржить с другими состояниями и создать новые, улучшенные модели. - -``` sql -WITH (SELECT state FROM your_model) AS model SELECT -evalMLMethod(model, param1, param2) FROM test_data -``` - -Запрос возвращает столбец прогнозируемых значений. Обратите внимание, что первый аргумент `evalMLMethod` это объект `AggregateFunctionState`, далее идут столбцы свойств. - -`test_data` — это таблица, подобная `train_data`, но при этом может не содержать целевое значение. - -### Примечания {#agg_functions-stochasticlinearregression-notes} - -1. Объединить две модели можно следующим запросом: - - - - ``` sql - SELECT state1 + state2 FROM your_models - ``` - - где таблица `your_models` содержит обе модели. Запрос вернёт новый объект `AggregateFunctionState`. - -1. Пользователь может получать веса созданной модели для своих целей без сохранения модели, если не использовать комбинатор `-State`. - - - - ``` sql - SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data - ``` - - Подобный запрос строит модель и возвращает её веса, отвечающие параметрам моделей и смещение. Таким образом, в приведенном выше примере запрос вернет столбец с тремя значениями. - -**Смотрите также** - -- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) -- [Отличие линейной от логистической регрессии.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} - -Функция реализует стохастическую логистическую регрессию. Её можно использовать для задачи бинарной классификации, функция поддерживает те же пользовательские параметры, что и stochasticLinearRegression и работает таким же образом. - -### Параметры {#agg_functions-stochasticlogisticregression-parameters} - -Параметры те же, что и в stochasticLinearRegression: -`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. -Смотрите раздел [parameters](#agg_functions-stochasticlinearregression-parameters). - -``` text -stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') -``` - -1. Построение модели - - - - Смотрите раздел `Построение модели` в описании [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) . - - Прогнозируемые метки должны быть в диапазоне \[-1, 1\]. - -1. Прогнозирование - - - - Используя сохраненное состояние, можно предсказать вероятность наличия у объекта метки `1`. - - ``` sql - WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) FROM test_data - ``` - - Запрос возвращает столбец вероятностей. Обратите внимание, что первый аргумент `evalMLMethod` это объект `AggregateFunctionState`, далее идут столбцы свойств. - - Мы также можем установить границу вероятности, которая присваивает элементам различные метки. - - ``` sql - SELECT ans < 1.1 AND ans > 0.5 FROM - (WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) AS ans FROM test_data) - ``` - - Тогда результатом будут метки. - - `test_data` — это таблица, подобная `train_data`, но при этом может не содержать целевое значение. - -**Смотрите также** - -- [stochasticLinearRegression](#agg_functions-stochasticlinearregression) -- [Отличие линейной от логистической регрессии](https://moredez.ru/q/51225972/) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/agg_functions/reference/) diff --git a/docs/ru/sql_reference/ansi.md b/docs/ru/sql_reference/ansi.md deleted file mode 120000 index ee0f9c8cb7e..00000000000 --- a/docs/ru/sql_reference/ansi.md +++ /dev/null @@ -1 +0,0 @@ -../../en/sql_reference/ansi.md \ No newline at end of file diff --git a/docs/ru/sql_reference/data_types/aggregatefunction.md b/docs/ru/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index d7ee1211845..00000000000 --- a/docs/ru/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,63 +0,0 @@ -# AggregateFunction(name, types\_of\_arguments…) {#data-type-aggregatefunction} - -Промежуточное состояние агрегатной функции. Чтобы его получить, используются агрегатные функции с суффиксом `-State`. Чтобы в дальнейшем получить агрегированные данные необходимо использовать те же агрегатные функции с суффиксом `-Merge`. - -`AggregateFunction` — параметрический тип данных. - -**Параметры** - -- Имя агрегатной функции. - - Для параметрических агрегатных функций указываются также их параметры. - -- Типы аргументов агрегатной функции. - -**Пример** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -[uniq](../../sql_reference/data_types/aggregatefunction.md#agg_function-uniq), anyIf ([any](../../sql_reference/data_types/aggregatefunction.md#agg_function-any)+[If](../../sql_reference/data_types/aggregatefunction.md#agg-functions-combinator-if)) и [quantiles](../../sql_reference/data_types/aggregatefunction.md) — агрегатные функции, поддержанные в ClickHouse. - -## Особенности использования {#osobennosti-ispolzovaniia} - -### Вставка данных {#vstavka-dannykh} - -Для вставки данных используйте `INSERT SELECT` с агрегатными `-State`-функциями. - -**Примеры функций** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -В отличие от соответствующих функций `uniq` и `quantiles`, `-State`-функциями возвращают не готовое значение, а состояние. То есть, значение типа `AggregateFunction`. - -В запросах `SELECT` значения типа `AggregateFunction` выводятся во всех форматах, которые поддерживает ClickHouse, в виде implementation-specific бинарных данных. Если с помощью `SELECT` выполнить дамп данных, например, в формат `TabSeparated`, то потом этот дамп можно загрузить обратно с помощью запроса `INSERT`. - -### Выборка данных {#vyborka-dannykh} - -При выборке данных из таблицы `AggregatingMergeTree`, используйте `GROUP BY` и те же агрегатные функции, что и при вставке данных, но с суффиксом `-Merge`. - -Агрегатная функция с суффиксом `-Merge` берёт множество состояний, объединяет их, и возвращает результат полной агрегации данных. - -Например, следующие два запроса возвращают один и тот же результат: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## Пример использования {#primer-ispolzovaniia} - -Смотрите в описании движка [AggregatingMergeTree](../../sql_reference/data_types/aggregatefunction.md). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/ru/sql_reference/data_types/array.md b/docs/ru/sql_reference/data_types/array.md deleted file mode 100644 index acc2e4940d0..00000000000 --- a/docs/ru/sql_reference/data_types/array.md +++ /dev/null @@ -1,72 +0,0 @@ -# Array(T) {#data-type-array} - -Массив из элементов типа `T`. - -`T` может любым, в том числе, массивом. Таким образом поддержаны многомерные массивы. - -## Создание массива {#sozdanie-massiva} - -Массив можно создать с помощью функции: - -``` sql -array(T) -``` - -Также можно использовать квадратные скобки - -``` sql -[] -``` - -Пример создания массива: - -``` sql -SELECT array(1, 2) AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName(array(1, 2))─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴─────────────────────────┘ -``` - -``` sql -SELECT [1, 2] AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName([1, 2])─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴────────────────────┘ -``` - -## Особенности работы с типами данных {#osobennosti-raboty-s-tipami-dannykh} - -При создании массива «на лету» ClickHouse автоматически определяет тип аргументов как наиболее узкий тип данных, в котором можно хранить все перечисленные аргументы. Если среди аргументов есть [NULL](../../sql_reference/data_types/array.md#null-literal) или аргумент типа [Nullable](nullable.md#data_type-nullable), то тип элементов массива — [Nullable](nullable.md). - -Если ClickHouse не смог подобрать тип данных, то он сгенерирует исключение. Это произойдёт, например, при попытке создать массив одновременно со строками и числами `SELECT array(1, 'a')`. - -Примеры автоматического определения типа данных: - -``` sql -SELECT array(1, 2, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ -│ [1,2,NULL] │ Array(Nullable(UInt8)) │ -└────────────┴───────────────────────────────┘ -``` - -Если попытаться создать массив из несовместимых типов данных, то ClickHouse выбросит исключение: - -``` sql -SELECT array(1, 'a') -``` - -``` text -Received exception from server (version 1.1.54388): -Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/array/) diff --git a/docs/ru/sql_reference/data_types/datetime.md b/docs/ru/sql_reference/data_types/datetime.md deleted file mode 100644 index e52ca549907..00000000000 --- a/docs/ru/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,122 +0,0 @@ -# DateTime {#data_type-datetime} - -Позволяет хранить момент времени, который может быть представлен как календарная дата и время. - -Синтаксис: - -``` sql -DateTime([timezone]) -``` - -Диапазон значений: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. - -Точность: 1 секунда. - -## Использование {#ispolzovanie} - -Момент времени сохраняется как [Unix timestamp](https://ru.wikipedia.org/wiki/Unix-%D0%B2%D1%80%D0%B5%D0%BC%D1%8F), независимо от часового пояса и переходов на летнее/зимнее время. Дополнительно, тип `DateTime` позволяет хранить часовой пояс, единый для всей колонки, который влияет на то, как будут отображаться значения типа `DateTime` в текстовом виде и как будут парситься значения заданные в виде строк (‘2020-01-01 05:00:01’). Часовой пояс не хранится в строках таблицы (выборки), а хранится в метаданных колонки. -Список поддерживаемых временных зон можно найти в [IANA Time Zone Database](https://www.iana.org/time-zones). -Пакет `tzdata`, содержащий [базу данных часовых поясов IANA](https://www.iana.org/time-zones), должен быть установлен в системе. Используйте команду `timedatectl list-timezones` для получения списка часовых поясов, известных локальной системе. - -Часовой пояс для столбца типа `DateTime` можно в явном виде установить при создании таблицы. Если часовой пояс не установлен, то ClickHouse использует значение параметра [timezone](../../sql_reference/data_types/datetime.md#server_configuration_parameters-timezone), установленное в конфигурации сервера или в настройках операционной системы на момент запуска сервера. - -Консольный клиент ClickHouse по умолчанию использует часовой пояс сервера, если для значения `DateTime` часовой пояс не был задан в явном виде при инициализации типа данных. Чтобы использовать часовой пояс клиента, запустите [clickhouse-client](../../interfaces/cli.md) с параметром `--use_client_time_zone`. - -ClickHouse отображает значения типа `DateTime` в формате `YYYY-MM-DD hh:mm:ss`. Отображение можно поменять с помощью функции [formatDateTime](../../sql_reference/data_types/datetime.md#formatdatetime). - -При вставке данных в ClickHouse, можно использовать различные форматы даты и времени в зависимости от значения настройки [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format). - -## Примеры {#primery} - -**1.** Создание таблицы с столбцом типа `DateTime` и вставка данных в неё: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime('Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog; -``` - -``` sql -INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); -``` - -``` sql -SELECT * FROM dt; -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -- При вставке даты-времени как целого числа, оно трактуется как Unix Timestamp (UTC). Unix timestamp `1546300800` в часовом поясе `Europe/London (UTC+0)` представляет время `'2019-01-01 00:00:00'`. Однако, столбец `timestamp` имеет тип `DateTime('Europe/Moscow (UTC+3)')`, так что при выводе в виде строки время отобразится как `2019-01-01 03:00:00`. -- При вставке даты-времени в виде строки, время трактуется соответственно часовому поясу установленному для колонки. `'2019-01-01 00:00:00'` трактуется как время по Москве (и в базу сохраняется `1546290000`) - -**2.** Фильтрация по значениям даты-времени - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -Фильтровать по колонке типа `DateTime` можно, указывая строковое значение в фильтре `WHERE`. Конвертация будет выполнена автоматически: - -``` sql -SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -└─────────────────────┴──────────┘ -``` - -**3.** Получение часового пояса для колонки типа `DateTime`: - -``` sql -SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────column─┬─x─────────────────────────┐ -│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ -└─────────────────────┴───────────────────────────┘ -``` - -**4.** Конвертация часовых поясов - -``` sql -SELECT -toDateTime(timestamp, 'Europe/London') as lon_time, -toDateTime(timestamp, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────lon_time──┬────────────mos_time─┐ -│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ -│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ -└─────────────────────┴─────────────────────┘ -``` - -## See Also {#see-also} - -- [Функции преобразования типов](../../sql_reference/data_types/datetime.md) -- [Функции для работы с датой и временем](../../sql_reference/data_types/datetime.md) -- [Функции для работы с массивами](../../sql_reference/data_types/datetime.md) -- [Настройка `date_time_input_format`](../../operations/settings/settings.md#settings-date_time_input_format) -- [Конфигурационный параметр сервера `timezone`](../../sql_reference/data_types/datetime.md#server_configuration_parameters-timezone) -- [Операторы для работы с датой и временем](../../sql_reference/data_types/datetime.md#operators-datetime) -- [Тип данных `Date`](date.md) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/datetime/) diff --git a/docs/ru/sql_reference/data_types/datetime64.md b/docs/ru/sql_reference/data_types/datetime64.md deleted file mode 100644 index 9e126885058..00000000000 --- a/docs/ru/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,97 +0,0 @@ -# DateTime64 {#data_type-datetime64} - -Позволяет хранить момент времени, который может быть представлен как календарная дата и время, с заданной суб-секундной точностью. - -Размер тика/точность: 10-precision секунд, где precision - целочисленный параметр типа. - -Синтаксис: - -``` sql -DateTime64(precision, [timezone]) -``` - -Данные хранятся в виде количества ‘тиков’, прошедших с момента начала эпохи (1970-01-01 00:00:00 UTC), в Int64. Размер тика определяется параметром precision. Дополнительно, тип `DateTime64` позволяет хранить часовой пояс, единый для всей колонки, который влияет на то, как будут отображаться значения типа `DateTime64` в текстовом виде и как будут парситься значения заданные в виде строк (‘2020-01-01 05:00:01.000’). Часовой пояс не хранится в строках таблицы (выборки), а хранится в метаданных колонки. Подробнее см. [DateTime](datetime.md). - -## Пример {#primer} - -**1.** Создание таблицы с столбцом типа `DateTime64` и вставка данных в неё: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- При вставке даты-времени как числа (аналогично ‘Unix timestamp’), время трактуется как UTC. Unix timestamp `1546300800` в часовом поясе `Europe/London (UTC+0)` представляет время `'2019-01-01 00:00:00'`. Однако, столбец `timestamp` имеет тип `DateTime('Europe/Moscow (UTC+3)')`, так что при выводе в виде строки время отобразится как `2019-01-01 03:00:00`. -- При вставке даты-времени в виде строки, время трактуется соответственно часовому поясу установленному для колонки. `'2019-01-01 00:00:00'` трактуется как время по Москве (и в базу сохраняется `'2018-12-31 21:00:00'` в виде Unix Timestamp) - -**2.** Фильтрация по значениям даты-времени - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -В отличие от типа `DateTime`, `DateTime64` не конвертируется из строк автоматически - -**3.** Получение часового пояса для значения типа `DateTime64`: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** Конвертация часовых поясов - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## See Also {#see-also} - -- [Функции преобразования типов](../../sql_reference/data_types/datetime64.md) -- [Функции для работы с датой и временем](../../sql_reference/data_types/datetime64.md) -- [Функции для работы с массивами](../../sql_reference/data_types/datetime64.md) -- [Настройка `date_time_input_format`](../../operations/settings/settings.md#settings-date_time_input_format) -- [Конфигурационный параметр сервера `timezone`](../../sql_reference/data_types/datetime64.md#server_configuration_parameters-timezone) -- [Операторы для работы с датой и временем](../../sql_reference/data_types/datetime64.md#operators-datetime) -- [Тип данных `Date`](date.md) -- [Тип данных `DateTime`](datetime.md) diff --git a/docs/ru/sql_reference/data_types/domains/index.md b/docs/ru/sql_reference/data_types/domains/index.md deleted file mode 100644 index d4496cf8d5b..00000000000 --- a/docs/ru/sql_reference/data_types/domains/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Domains -toc_priority: 56 ---- - diff --git a/docs/ru/sql_reference/data_types/enum.md b/docs/ru/sql_reference/data_types/enum.md deleted file mode 100644 index 58f2a4b188e..00000000000 --- a/docs/ru/sql_reference/data_types/enum.md +++ /dev/null @@ -1,124 +0,0 @@ -# Enum {#enum} - -Перечисляемый тип данных, содержащий именованные значения. - -Именованные значения задаются парами `'string' = integer`. ClickHouse хранит только числа, но допускает операции над ними с помощью заданных имён. - -ClickHouse поддерживает: - -- 8-битный `Enum`. Может содержать до 256 значений, пронумерованных в диапазоне `[-128, 127]`. -- 16-битный `Enum`. Может содержать до 65536 значений, пронумерованных в диапазоне `[-32768, 32767]`. - -ClickHouse автоматически выбирает размерность `Enum` при вставке данных. Чтобы точно понимать размер хранимых данных можно использовать типы `Enum8` или `Enum16`. - -## Примеры использования {#primery-ispolzovaniia} - -Создадим таблицу со столбцом типа `Enum8('hello' = 1, 'world' = 2)`. - -``` sql -CREATE TABLE t_enum -( - x Enum('hello' = 1, 'world' = 2) -) -ENGINE = TinyLog -``` - -В столбец `x` можно сохранять только значения, перечисленные при определении типа, т.е. `'hello'` или `'world'`. Если вы попытаетесь сохранить любое другое значение, ClickHouse сгенерирует исключение. ClickHouse автоматически выберет размерность 8-bit для этого `Enum`. - -``` sql -INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') -``` - -``` text -Ok. -``` - -``` sql -insert into t_enum values('a') -``` - -``` text -Exception on client: -Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) -``` - -При запросе данных из таблицы ClickHouse выдаст строковые значения из `Enum`. - -``` sql -SELECT * FROM t_enum -``` - -``` text -┌─x─────┐ -│ hello │ -│ world │ -│ hello │ -└───────┘ -``` - -Если необходимо увидеть цифровые эквиваленты строкам, то необходимо привести тип `Enum` к целочисленному. - -``` sql -SELECT CAST(x AS Int8) FROM t_enum -``` - -``` text -┌─CAST(x, 'Int8')─┐ -│ 1 │ -│ 2 │ -│ 1 │ -└─────────────────┘ -``` - -Чтобы создать значение типа `Enum` в запросе, также необходимо использовать функцию `CAST`. - -``` sql -SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) -``` - -``` text -┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ -│ Enum8('a' = 1, 'b' = 2) │ -└─────────────────────────────────────────────────────┘ -``` - -## Общие правила и особенности использования {#obshchie-pravila-i-osobennosti-ispolzovaniia} - -Для каждого из значений прописывается число в диапазоне `-128 .. 127` для `Enum8` или в диапазоне `-32768 .. 32767` для `Enum16`. Все строки должны быть разными, числа - тоже. Разрешена пустая строка. При указании такого типа (в определении таблицы), числа могут идти не подряд и в произвольном порядке. При этом, порядок не имеет значения. - -Ни строка, ни цифровое значение в `Enum` не могут быть [NULL](../../sql_reference/syntax.md#null-literal). - -`Enum` может быть передан в тип [Nullable](nullable.md). Таким образом, если создать таблицу запросом - -``` sql -CREATE TABLE t_enum_nullable -( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) -) -ENGINE = TinyLog -``` - -, то в ней можно будет хранить не только `'hello'` и `'world'`, но и `NULL`. - -``` sql -INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) -``` - -В оперативке столбец типа `Enum` представлен так же, как `Int8` или `Int16` соответствующими числовыми значениями. -При чтении в текстовом виде, парсит значение как строку и ищет соответствующую строку из множества значений Enum-а. Если не находит - кидается исключение. -При записи в текстовом виде, записывает значение как соответствующую строку. Если в данных столбца есть мусор - числа не из допустимого множества, то кидается исключение. При чтении и записи в бинарном виде, оно осуществляется так же, как для типов данных Int8, Int16. -Неявное значение по умолчанию - это значение с минимальным номером. - -При `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` и т. п., Enum-ы ведут себя так же, как соответствующие числа. Например, при ORDER BY они сортируются по числовым значениям. Функции сравнения на равенство и сравнения на отношение порядка двух Enum-ов работают с Enum-ами так же, как с числами. - -Сравнивать Enum с числом нельзя. Можно сравнивать Enum с константной строкой - при этом, для строки ищется соответствующее значение Enum-а; если не находится - кидается исключение. Поддерживается оператор IN, где слева стоит Enum, а справа - множество строк. В этом случае, строки рассматриваются как значения соответствующего Enum-а. - -Большинство операций с числами и со строками не имеет смысла и не работают для Enum-ов: например, к Enum-у нельзя прибавить число. -Для Enum-а естественным образом определяется функция `toString`, которая возвращает его строковое значение. - -Также для Enum-а определяются функции `toT`, где T - числовой тип. При совпадении T с типом столбца Enum-а, преобразование работает бесплатно. -При ALTER, есть возможность бесплатно изменить тип Enum-а, если меняется только множество значений. При этом, можно добавлять новые значения; можно удалять старые значения (это безопасно только если они ни разу не использовались, так как это не проверяется). В качестве «защиты от дурака», нельзя менять числовые значения у имеющихся строк - в этом случае, кидается исключение. - -При ALTER, есть возможность поменять Enum8 на Enum16 и обратно - так же, как можно поменять Int8 на Int16. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/enum/) diff --git a/docs/ru/sql_reference/data_types/fixedstring.md b/docs/ru/sql_reference/data_types/fixedstring.md deleted file mode 100644 index 7e2fdd5d525..00000000000 --- a/docs/ru/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,56 +0,0 @@ -# FixedString {#fixedstring} - -Строка фиксированной длины `N` байт (не символов, не кодовых точек). - -Чтобы объявить столбец типа `FixedString`, используйте следующий синтаксис: - -``` sql - FixedString(N) -``` - -Где `N` — натуральное число. - -Тип `FixedString` эффективен, когда данные имеют длину ровно `N` байт. Во всех остальных случаях использование FixedString может привести к снижению эффективности. - -Примеры значений, которые можно эффективно хранить в столбцах типа `FixedString`: - -- Двоичное представление IP-адреса (`FixedString(16)` для IPv6). -- Коды языков (ru\_RU, en\_US … ). -- Коды валют (USD, RUB … ). -- Двоичное представление хэшей (`FixedString(16)` для MD5, `FixedString(32)` для SHA256). - -Для хранения значений UUID используйте тип данных [UUID](uuid.md). - -При вставке данных, ClickHouse: - -- Дополняет строку нулевыми байтами, если строка содержит меньше байтов, чем `N`. -- Генерирует исключение `Too large value for FixedString(N)`, если строка содержит более `N` байт. - -При выборе данных ClickHouse не обрезает нулевые байты в конце строки. Если вы используете секцию `WHERE`, то необходимо добавлять нулевые байты вручную, чтобы ClickHouse смог сопоставить выражение из фильтра значению `FixedString`. Следующий пример показывает, как использовать секцию `WHERE` с `FixedString`. - -Рассмотрим следующую таблицу с единственным столбцом типа `FixedString(2)`: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -Запрос `SELECT * FROM FixedStringTable WHERE a = 'b'` не возвращает необходимых данных. Необходимо дополнить шаблон фильтра нулевыми байтами. - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -Это поведение отличается от поведения MySQL для типа `CHAR`, где строки дополняются пробелами, а пробелы перед выводом вырезаются. - -Обратите внимание, что длина значения `FixedString(N)` постоянна. Функция [length](../../sql_reference/data_types/fixedstring.md#array_functions-length) возвращает `N` даже если значение `FixedString(N)` заполнено только нулевыми байтами, однако функция [empty](../../sql_reference/data_types/fixedstring.md#empty) в этом же случае возвращает `1`. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/fixedstring/) diff --git a/docs/ru/sql_reference/data_types/index.md b/docs/ru/sql_reference/data_types/index.md deleted file mode 100644 index 1fd52b9bf9e..00000000000 --- a/docs/ru/sql_reference/data_types/index.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -toc_folder_title: Типы данных -toc_priority: 37 -toc_title: Введение ---- - -# Типы данных {#data_types} - -ClickHouse может сохранять в ячейках таблиц данные различных типов. - -Раздел содержит описания поддерживаемых типов данных и специфику их использования и/или реализации, если таковые имеются. -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/) diff --git a/docs/ru/sql_reference/data_types/nullable.md b/docs/ru/sql_reference/data_types/nullable.md deleted file mode 100644 index dfbd0fb0512..00000000000 --- a/docs/ru/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,46 +0,0 @@ -# Nullable(TypeName) {#data_type-nullable} - -Позволяет работать как со значением типа `TypeName` так и с отсутствием этого значения ([NULL](../../sql_reference/data_types/nullable.md)) в одной и той же переменной, в том числе хранить `NULL` в таблицах вместе со значения типа `TypeName`. Например, в столбце типа `Nullable(Int8)` можно хранить значения типа `Int8`, а в тех строках, где значения нет, будет храниться `NULL`. - -В качестве `TypeName` нельзя использовать составные типы данных [Array](array.md#data_type-array) и [Tuple](tuple.md). Составные типы данных могут содержать значения типа `Nullable`, например `Array(Nullable(Int8))`. - -Поле типа `Nullable` нельзя включать в индексы. - -`NULL` — значение по умолчанию для типа `Nullable`, если в конфигурации сервера ClickHouse не указано иное. - -## Особенности хранения {#osobennosti-khraneniia} - -Для хранения значения типа `Nullable` ClickHouse использует: - -- Отдельный файл с масками `NULL` (далее маска). -- Непосредственно файл со значениями. - -Маска определяет, что лежит в ячейке данных: `NULL` или значение. - -В случае, когда маска указывает, что в ячейке хранится `NULL`, в файле значений хранится значение по умолчанию для типа данных. Т.е. если, например, поле имеет тип `Nullable(Int8)`, то ячейка будет хранить значение по умолчанию для `Int8`. Эта особенность увеличивает размер хранилища. - -!!! info "Info" - Почти всегда использование `Nullable` снижает производительность, учитывайте это при проектировании своих баз. - -## Пример использования {#primer-ispolzovaniia} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y from t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/nullable/) diff --git a/docs/ru/sql_reference/data_types/simpleaggregatefunction.md b/docs/ru/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 120000 index 02fad64d50e..00000000000 --- a/docs/ru/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/sql_reference/data_types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/ru/sql_reference/data_types/special_data_types/interval.md b/docs/ru/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index 1721b8631ad..00000000000 --- a/docs/ru/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,78 +0,0 @@ -# Interval {#data-type-interval} - -Семейство типов данных, представляющих интервалы дат и времени. Оператор [INTERVAL](../../../sql_reference/data_types/special_data_types/interval.md#operator-interval) возвращает значения этих типов. - -!!! warning "Внимание" - Нельзя использовать типы данных `Interval` для хранения данных в таблице. - -Структура: - -- Интервал времени в виде положительного целого числа. -- Тип интервала. - -Поддержанные типы интервалов: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -Каждому типу интервала соответствует отдельный тип данных. Например, тип данных `IntervalDay` соответствует интервалу `DAY`: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## Использование {#data-type-interval-usage-remarks} - -Значения типов `Interval` можно использовать в арифметических операциях со значениями типов [Date](../../../sql_reference/data_types/special_data_types/interval.md) и [DateTime](../../../sql_reference/data_types/special_data_types/interval.md). Например, можно добавить 4 дня к текущей дате: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -Нельзя объединять интервалы различных типов. Нельзя использовать интервалы вида `4 DAY 1 HOUR`. Вместо этого выражайте интервал в единицах меньших или равных минимальной единице интервала, например, интервал «1 день и 1 час» можно выразить как `25 HOUR` или `90000 SECOND`. - -Арифметические операции со значениями типов `Interval` не доступны, однако можно последовательно добавлять различные интервалы к значениям типов `Date` и `DateTime`. Например: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -Следующий запрос приведёт к генерированию исключения: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## Смотрите также {#smotrite-takzhe} - -- Оператор[INTERVAL](../../../sql_reference/data_types/special_data_types/interval.md#operator-interval) -- Функция приведения типа [toInterval](../../../sql_reference/data_types/special_data_types/interval.md#function-tointerval) diff --git a/docs/ru/sql_reference/data_types/special_data_types/nothing.md b/docs/ru/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index c23de847077..00000000000 --- a/docs/ru/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,17 +0,0 @@ -# Nothing {#nothing} - -Этот тип данных предназначен только для того, чтобы представлять [NULL](../../../sql_reference/data_types/special_data_types/nothing.md), т.е. отсутствие значения. - -Невозможно создать значение типа `Nothing`, поэтому он используется там, где значение не подразумевается. Например, `NULL` записывается как `Nullable(Nothing)` ([Nullable](../../../sql_reference/data_types/special_data_types/nothing.md) — это тип данных, позволяющий хранить `NULL` в таблицах). Также тип `Nothing` используется для обозначения пустых массивов: - -``` sql -SELECT toTypeName(Array()) -``` - -``` text -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/special_data_types/nothing/) diff --git a/docs/ru/sql_reference/data_types/tuple.md b/docs/ru/sql_reference/data_types/tuple.md deleted file mode 100644 index e8f5f335278..00000000000 --- a/docs/ru/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,45 +0,0 @@ -# Tuple(T1, T2, …) {#tuplet1-t2} - -Кортеж из элементов любого [типа](index.md#data_types). Элементы кортежа могут быть одного или разных типов. - -Кортежи используются для временной группировки столбцов. Столбцы могут группироваться при использовании выражения IN в запросе, а также для указания нескольких формальных параметров лямбда-функций. Подробнее смотрите разделы [Операторы IN](../../sql_reference/data_types/tuple.md), [Функции высшего порядка](../../sql_reference/data_types/tuple.md#higher_order_functions). - -Кортежи могут быть результатом запроса. В этом случае, в текстовых форматах кроме JSON, значения выводятся в круглых скобках через запятую. В форматах JSON, кортежи выводятся в виде массивов (в квадратных скобках). - -## Создание кортежа {#sozdanie-kortezha} - -Кортеж можно создать с помощью функции - -``` sql -tuple(T1, T2, ...) -``` - -Пример создания кортежа: - -``` sql -SELECT tuple(1,'a') AS x, toTypeName(x) -``` - -``` text -┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ -│ (1,'a') │ Tuple(UInt8, String) │ -└─────────┴───────────────────────────┘ -``` - -## Особенности работы с типами данных {#osobennosti-raboty-s-tipami-dannykh} - -При создании кортежа «на лету» ClickHouse автоматически определяет тип каждого аргументов как минимальный из типов, который может сохранить значение аргумента. Если аргумент — [NULL](../../sql_reference/data_types/tuple.md#null-literal), то тип элемента кортежа — [Nullable](nullable.md). - -Пример автоматического определения типа данных: - -``` sql -SELECT tuple(1,NULL) AS x, toTypeName(x) -``` - -``` text -┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ -│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ -└──────────┴─────────────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/data_types/tuple/) diff --git a/docs/ru/sql_reference/data_types/uuid.md b/docs/ru/sql_reference/data_types/uuid.md deleted file mode 100644 index d62ec22eecb..00000000000 --- a/docs/ru/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,72 +0,0 @@ -# UUID {#uuid-data-type} - -Универсальный уникальный идентификатор (UUID) - это 16-байтовое число, используемое для идентификации записей. Подробнее про UUID читайте на [Википедии](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -Пример UUID значения представлен ниже: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -Если при вставке новой записи значение для UUID-колонки не указано, UUID идентификатор будет заполнен нулями: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## Как сгенерировать UUID {#kak-sgenerirovat-uuid} - -Для генерации UUID-значений предназначена функция [generateUUIDv4](../../sql_reference/data_types/uuid.md). - -## Примеры использования {#primery-ispolzovaniia} - -Ниже представлены примеры работы с UUID. - -**Пример 1** - -Этот пример демонстрирует, как создать таблицу с UUID-колонкой и добавить в нее сгенерированный UUID. - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**Пример 2** - -В этом примере, при добавлении записи в таблицу значение для UUID-колонки не задано. UUID будет заполнен нулями. - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## Ограничения {#ogranicheniia} - -Тип данных UUID можно использовать только с функциями, которые поддерживаются типом данных [String](string.md) (например, [min](../../sql_reference/data_types/uuid.md#agg_function-min), [max](../../sql_reference/data_types/uuid.md#agg_function-max), и [count](../../sql_reference/data_types/uuid.md#agg_function-count)). - -Тип данных UUID не поддерживается арифметическими операциями (например, [abs](../../sql_reference/data_types/uuid.md#arithm_func-abs)) или агрегатными функциями, такими как [sum](../../sql_reference/data_types/uuid.md#agg_function-sum) и [avg](../../sql_reference/data_types/uuid.md#agg_function-avg). - -[Original article](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index 4929e571758..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,52 +0,0 @@ -# Внешние словари {#dicts-external-dicts} - -Существует возможность подключать собственные словари из различных источников данных. Источником данных для словаря может быть локальный текстовый/исполняемый файл, HTTP(s) ресурс или другая СУБД. Подробнее смотрите в разделе «[Источники внешних словарей](external_dicts_dict_sources.md)». - -ClickHouse: -- Полностью или частично хранит словари в оперативной памяти. -- Периодически обновляет их и динамически подгружает отсутствующие значения. -- Позволяет создавать внешние словари с помощью xml-файлов или [DDL-запросов](../../../sql_reference/statements/create.md#create-dictionary-query). - -Конфигурация внешних словарей может находится в одном или нескольких xml-файлах. Путь к конфигурации указывается в параметре [dictionaries\_config](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -Словари могут загружаться при старте сервера или при первом использовании, в зависимости от настройки [dictionaries\_lazy\_load](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -Конфигурационный файл словарей имеет вид: - -``` xml - - Необязательный элемент с любым содержимым. Игнорируется сервером ClickHouse. - - - /etc/metrika.xml - - - - - - - ... - - - - - -``` - -В одном файле можно [сконфигурировать](external_dicts_dict.md) произвольное количество словарей. - -Если вы создаёте внешние словари [DDL-запросами](../../../sql_reference/statements/create.md#create-dictionary-query), то не задавайте конфигурацию словаря в конфигурации сервера. - -!!! attention "Внимание" - Можно преобразовывать значения по небольшому словарю, описав его в запросе `SELECT` (см. функцию [transform](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)). Эта функциональность не связана с внешними словарями. - -## Смотрите также {#ext-dicts-see-also} - -- [Настройка внешнего словаря](external_dicts_dict.md) -- [Хранение словарей в памяти](external_dicts_dict_layout.md) -- [Обновление словарей](external_dicts_dict_lifetime.md) -- [Источники внешних словарей](external_dicts_dict_sources.md) -- [Ключ и поля словаря](external_dicts_dict_structure.md) -- [Функции для работы с внешними словарями](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md#ext_dict_functions) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index 2e3068882bf..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,46 +0,0 @@ -# Настройка внешнего словаря {#dicts-external-dicts-dict} - -XML-конфигурация словаря имеет следующую структуру: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -Соответствующий [DDL-запрос](../../../sql_reference/statements/create.md#create-dictionary-query) имеет следующий вид: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` — Идентификатор, под которым словарь будет доступен для использования. Используйте символы `[a-zA-Z0-9_\-]`. -- [source](external_dicts_dict_sources.md) — Источник словаря. -- [layout](external_dicts_dict_layout.md) — Размещение словаря в памяти. -- [structure](external_dicts_dict_structure.md) — Структура словаря. Ключ и атрибуты, которые можно получить по ключу. -- [lifetime](external_dicts_dict_lifetime.md) — Периодичность обновления словарей. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index ef9b79c0444..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,63 +0,0 @@ -# Иерархические словари {#ierarkhicheskie-slovari} - -ClickHouse поддерживает иерархические словари с [числовыми ключом](external_dicts_dict_structure.md#ext_dict-numeric-key). - -Рассмотрим следующую структуру: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -Эту иерархию можно выразить в виде следующей таблицы-словаря. - -| region\_id | parent\_region | region\_name | -|------------|----------------|---------------| -| 1 | 0 | Russia | -| 2 | 1 | Moscow | -| 3 | 2 | Center | -| 4 | 0 | Great Britain | -| 5 | 4 | London | - -Таблица содержит столбец `parent_region`, содержащий ключ ближайшего предка для текущего элемента. - -ClickHouse поддерживает свойство [hierarchical](external_dicts_dict_structure.md#hierarchical-dict-attr) для атрибутов [внешнего словаря](index.md). Это свойство позволяет конфигурировать словари, подобные описанному выше. - -С помощью функции [dictGetHierarchy](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md#dictgethierarchy) можно получить цепочку предков элемента. - -Структура словаря для нашего примера может выглядеть следующим образом: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index 898fe45b15a..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,369 +0,0 @@ -# Хранение словарей в памяти {#dicts-external-dicts-dict-layout} - -Словари можно размещать в памяти множеством способов. - -Рекомендуем [flat](#flat), [hashed](#hashed) и [complex\_key\_hashed](#complex-key-hashed). Скорость обработки словарей при этом максимальна. - -Размещение с кэшированием не рекомендуется использовать из-за потенциально низкой производительности и сложностей в подборе оптимальных параметров. Читайте об этом подробнее в разделе «[cache](#cache)». - -Повысить производительность словарей можно следующими способами: - -- Вызывать функцию для работы со словарём после `GROUP BY`. -- Помечать извлекаемые атрибуты как инъективные. Атрибут называется инъективным, если разным ключам соответствуют разные значения атрибута. Тогда при использовании в `GROUP BY` функции, достающей значение атрибута по ключу, эта функция автоматически выносится из `GROUP BY`. - -При ошибках работы со словарями ClickHouse генерирует исключения. Например, в следующих ситуациях: - -- При обращении к словарю, который не удалось загрузить. -- При ошибке запроса к `cached`-словарю. - -Список внешних словарей и их статус можно посмотреть в таблице `system.dictionaries`. - -Общий вид конфигурации: - -``` xml - - - ... - - - - - - ... - - -``` - -Соответствущий [DDL-запрос](../../../sql_reference/statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## Способы размещения словарей в памяти {#sposoby-razmeshcheniia-slovarei-v-pamiati} - -- [flat](#flat) -- [hashed](#hashed) -- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) -- [cache](#cache) -- [range\_hashed](#range-hashed) -- [complex\_key\_hashed](#complex-key-hashed) -- [complex\_key\_cache](#complex-key-cache) -- [ip\_trie](#ip-trie) - -### flat {#flat} - -Словарь полностью хранится в оперативной памяти в виде плоских массивов. Объём памяти, занимаемой словарём пропорционален размеру самого большого по размеру ключа. - -Ключ словаря имеет тип `UInt64` и его величина ограничена 500 000. Если при создании словаря обнаружен ключ больше, то ClickHouse бросает исключение и не создает словарь. - -Поддерживаются все виды источников. При обновлении, данные (из файла, из таблицы) читаются целиком. - -Это метод обеспечивает максимальную производительность среди всех доступных способов размещения словаря. - -Пример конфигурации: - -``` xml - - - -``` - -или - -``` sql -LAYOUT(FLAT()) -``` - -### hashed {#hashed} - -Словарь полностью хранится в оперативной памяти в виде хэш-таблиц. Словарь может содержать произвольное количество элементов с произвольными идентификаторами. На практике, количество ключей может достигать десятков миллионов элементов. - -Поддерживаются все виды источников. При обновлении, данные (из файла, из таблицы) читаются целиком. - -Пример конфигурации: - -``` xml - - - -``` - -или - -``` sql -LAYOUT(HASHED()) -``` - -### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} - -Аналогичен `hashed`, но при этом занимает меньше места в памяти и генерирует более высокую загрузку CPU. - -Пример конфигурации: - -``` xml - - - -``` - -или - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### complex\_key\_hashed {#complex-key-hashed} - -Тип размещения предназначен для использования с составными [ключами](external_dicts_dict_structure.md). Аналогичен `hashed`. - -Пример конфигурации: - -``` xml - - - -``` - -или - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### range\_hashed {#range-hashed} - -Словарь хранится в оперативной памяти в виде хэш-таблицы с упорядоченным массивом диапазонов и соответствующих им значений. - -Этот способ размещения работает также как и hashed и позволяет дополнительно к ключу использовать дипазоны по дате/времени (произвольному числовому типу). - -Пример: таблица содержит скидки для каждого рекламодателя в виде: - -``` text -+---------------+---------------------+-------------------+--------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------------+---------------------+-------------------+--------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------------+---------------------+-------------------+--------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------------+---------------------+-------------------+--------+ -``` - -Чтобы использовать выборку по диапазонам дат, необходимо в [structure](external_dicts_dict_structure.md) определить элементы `range_min`, `range_max`. В этих элементах должны присутствовать элементы `name` и `type` (если `type` не указан, будет использован тип по умолчанию – Date). `type` может быть любым численным типом (Date/DateTime/UInt64/Int32/др.). - -Пример: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -или - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -Для работы с такими словарями в функцию `dictGetT` необходимо передавать дополнительный аргумент, для которого подбирается диапазон: - - dictGetT('dict_name', 'attr_name', id, date) - -Функция возвращает значение для заданных `id` и диапазона дат, в который входит переданная дата. - -Особенности алгоритма: - -- Если не найден `id` или для найденного `id` не найден диапазон, то возвращается значение по умолчанию для словаря. -- Если есть перекрывающиеся диапазоны, то можно использовать любой подходящий. -- Если граница диапазона `NULL` или некорректная дата (1900-01-01, 2039-01-01), то диапазон считается открытым. Диапазон может быть открытым с обеих сторон. - -Пример конфигурации: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -или - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### cache {#cache} - -Словарь хранится в кэше, состоящем из фиксированного количества ячеек. Ячейки содержат часто используемые элементы. - -При поиске в словаре сначала просматривается кэш. На каждый блок данных, все не найденные в кэше или устаревшие ключи запрашиваются у источника с помощью `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Затем, полученные данные записываются в кэш. - -Для cache-словарей может быть задано время устаревания [lifetime](external_dicts_dict_lifetime.md) данных в кэше. Если от загрузки данных в ячейке прошло больше времени, чем `lifetime`, то значение не используется, и будет запрошено заново при следующей необходимости его использовать. - -Это наименее эффективный из всех способов размещения словарей. Скорость работы кэша очень сильно зависит от правильности настройки и сценария использования. Словарь типа cache показывает высокую производительность лишь при достаточно больших hit rate-ах (рекомендуется 99% и выше). Посмотреть средний hit rate можно в таблице `system.dictionaries`. - -Чтобы увеличить производительность кэша, используйте подзапрос с `LIMIT`, а снаружи вызывайте функцию со словарём. - -Поддерживаются [источники](external_dicts_dict_sources.md): MySQL, ClickHouse, executable, HTTP. - -Пример настройки: - -``` xml - - - - 1000000000 - - -``` - -или - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -Укажите достаточно большой размер кэша. Количество ячеек следует подобрать экспериментальным путём: - -1. Выставить некоторое значение. -2. Запросами добиться полной заполненности кэша. -3. Оценить потребление оперативной памяти с помощью таблицы `system.dictionaries`. -4. Увеличивать/уменьшать количество ячеек до получения требуемого расхода оперативной памяти. - -!!! warning "Warning" - Не используйте в качестве источника ClickHouse, поскольку он медленно обрабатывает запросы со случайным чтением. - -### complex\_key\_cache {#complex-key-cache} - -Тип размещения предназначен для использования с составными [ключами](external_dicts_dict_structure.md). Аналогичен `cache`. - -### ip\_trie {#ip-trie} - -Тип размещения предназначен для сопоставления префиксов сети (IP адресов) с метаданными, такими как ASN. - -Пример: таблица содержит префиксы сети и соответствующие им номера AS и коды стран: - -``` text - +-----------------+-------+--------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------------+-------+--------+ - | 2620:0:870::/48 | 3856 | US | - +-----------------+-------+--------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------------+-------+--------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------------+-------+--------+ -``` - -При использовании такого макета структура должна иметь составной ключ. - -Пример: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -или - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -Этот ключ должен иметь только один атрибут типа `String`, содержащий допустимый префикс IP. Другие типы еще не поддерживаются. - -Для запросов необходимо использовать те же функции (`dictGetT` с кортежем), что и для словарей с составными ключами: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -Функция принимает либо `UInt32` для IPv4, либо `FixedString(16)` для IPv6: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -Никакие другие типы не поддерживаются. Функция возвращает атрибут для префикса, соответствующего данному IP-адресу. Если есть перекрывающиеся префиксы, возвращается наиболее специфический. - -Данные хранятся в побитовом дереве (`trie`), он должен полностью помещаться в оперативной памяти. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index e886a3e7ef6..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,81 +0,0 @@ -# Обновление словарей {#obnovlenie-slovarei} - -ClickHouse периодически обновляет словари. Интервал обновления для полностью загружаемых словарей и интервал инвалидации для кэшируемых словарей определяется в теге `` в секундах. - -Обновление словарей (кроме загрузки при первом использовании) не блокирует запросы - во время обновления используется старая версия словаря. Если при обновлении возникнет ошибка, то ошибка пишется в лог сервера, а запросы продолжат использовать старую версию словарей. - -Пример настройки: - -``` xml - - ... - 300 - ... - -``` - -или - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -Настройка `0` запрещает обновление словарей. - -Можно задать интервал, внутри которого ClickHouse равномерно-случайно выберет время для обновления. Это необходимо для распределения нагрузки на источник словаря при обновлении на большом количестве серверов. - -Пример настройки: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -или - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -При обновлении словарей сервер ClickHouse применяет различную логику в зависимости от типа [источника](external_dicts_dict_sources.md): - -> - У текстового файла проверяется время модификации. Если время изменилось по отношению к запомненному ранее, то словарь обновляется. -> - Для таблиц типа MyISAM, время модификации проверяется запросом `SHOW TABLE STATUS`. -> - Словари из других источников по умолчанию обновляются каждый раз. - -Для источников MySQL (InnoDB), ODBC и ClickHouse можно настроить запрос, который позволит обновлять словари только в случае их фактического изменения, а не каждый раз. Чтобы это сделать необходимо выполнить следующие условия/действия: - -> - В таблице словаря должно быть поле, которое гарантированно изменяется при обновлении данных в источнике. -> - В настройках источника указывается запрос, который получает изменяющееся поле. Результат запроса сервер ClickHouse интерпретирует как строку и если эта строка изменилась по отношению к предыдущему состоянию, то словарь обновляется. Запрос следует указывать в поле `` настроек [источника](external_dicts_dict_sources.md). - -Пример настройки: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -или - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index ae3bb57fae7..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,613 +0,0 @@ -# Источники внешних словарей {#dicts-external-dicts-dict-sources} - -Внешний словарь можно подключить из множества источников. - -Общий вид XML-конфигурации: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -Аналогичный [DDL-запрос](../../../sql_reference/statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -Источник настраивается в разделе `source`. - -Для типов источников [Локальный файл](#dicts-external_dicts_dict_sources-local_file), [Исполняемый файл](#dicts-external_dicts_dict_sources-executable), [HTTP(s)](#dicts-external_dicts_dict_sources-http), [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) -доступны дополнительные настройки: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - - 0 - - -``` -или -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -SETTINGS(format_csv_allow_single_quotes = 0) -``` - -Типы источников (`source_type`): - -- [Локальный файл](#dicts-external_dicts_dict_sources-local_file) -- [Исполняемый файл](#dicts-external_dicts_dict_sources-executable) -- [HTTP(s)](#dicts-external_dicts_dict_sources-http) -- СУБД: - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) - - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) - - [Redis](#dicts-external_dicts_dict_sources-redis) - -## Локальный файл {#dicts-external_dicts_dict_sources-local_file} - -Пример настройки: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -или - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Поля настройки: - -- `path` — Абсолютный путь к файлу. -- `format` — Формат файла. Поддерживаются все форматы, описанные в разделе «[Форматы](../../../interfaces/formats.md#formats)». - -## Исполняемый файл {#dicts-external_dicts_dict_sources-executable} - -Работа с исполняемым файлом зависит от [размещения словаря в памяти](external_dicts_dict_layout.md). Если тип размещения словаря `cache` и `complex_key_cache`, то ClickHouse запрашивает необходимые ключи, отправляя запрос в `STDIN` исполняемого файла. - -Пример настройки: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -или - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Поля настройки: - -- `command` — Абсолютный путь к исполняемому файлу или имя файла (если каталог программы прописан в `PATH`). -- `format` — Формат файла. Поддерживаются все форматы, описанные в разделе «[Форматы](../../../interfaces/formats.md#formats)». - -## HTTP(s) {#dicts-external_dicts_dict_sources-http} - -Работа с HTTP(s) сервером зависит от [размещения словаря в памяти](external_dicts_dict_layout.md). Если тип размещения словаря `cache` и `complex_key_cache`, то ClickHouse запрашивает необходимые ключи, отправляя запрос методом `POST`. - -Пример настройки: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -или - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -Чтобы ClickHouse смог обратиться к HTTPS-ресурсу, необходимо [настроить openSSL](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md) в конфигурации сервера. - -Поля настройки: - -- `url` — URL источника. -- `format` — Формат файла. Поддерживаются все форматы, описанные в разделе «[Форматы](../../../interfaces/formats.md#formats)». - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -Этим способом можно подключить любую базу данных, имеющую ODBC драйвер. - -Пример настройки: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -или - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -Поля настройки: - -- `db` — имя базы данных. Не указывать, если имя базы задано в параметрах. ``. -- `table` — имя таблицы и схемы, если она есть. -- `connection_string` — строка соединения. -- `invalidate_query` — запрос для проверки статуса словаря. Необязательный параметр. Читайте подробнее в разделе [Обновление словарей](external_dicts_dict_lifetime.md). - -ClickHouse получает от ODBC-драйвера информацию о квотировании и квотирует настройки в запросах к драйверу, поэтому имя таблицы нужно указывать в соответствии с регистром имени таблицы в базе данных. - -Если у вас есть проблемы с кодировками при использовании Oracle, ознакомьтесь с соответствующим разделом [FAQ](../../../faq/general.md#oracle-odbc-encodings). - -### Выявленная уязвимость в функционировании ODBC словарей {#vyiavlennaia-uiazvimost-v-funktsionirovanii-odbc-slovarei} - -!!! attention "Attention" - При соединении с базой данных через ODBC можно заменить параметр соединения `Servername`. В этом случае, значения `USERNAME` и `PASSWORD` из `odbc.ini` отправляются на удаленный сервер и могут быть скомпрометированы. - -**Пример небезопасного использования** - -Сконфигурируем unixODBC для работы с PostgreSQL. Содержимое `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -Если выполнить запрос вида: - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -то ODBC драйвер отправит значения `USERNAME` и `PASSWORD` из `odbc.ini` на `some-server.com`. - -### Пример подключения PostgreSQL {#primer-podkliucheniia-postgresql} - -ОС Ubuntu. - -Установка unixODBC и ODBC-драйвера для PostgreSQL: : - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -Настройка `/etc/odbc.ini` (или `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -Конфигурация словаря в ClickHouse: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -или - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) - -Может понадобиться в `odbc.ini` указать полный путь до библиотеки с драйвером `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### Пример подключения MS SQL Server - -ОС Ubuntu. - -Установка драйвера: : - -```bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -Настройка драйвера: : - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -Настройка словаря в ClickHouse: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -или - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## СУБД {#subd} - -### MySQL {#dicts-external_dicts_dict_sources-mysql} - -Пример настройки: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -или - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -Поля настройки: - -- `port` — порт сервера MySQL. Можно указать для всех реплик или для каждой в отдельности (внутри ``). - -- `user` — имя пользователя MySQL. Можно указать для всех реплик или для каждой в отдельности (внутри ``). - -- `password` — пароль пользователя MySQL. Можно указать для всех реплик или для каждой в отдельности (внутри ``). - -- `replica` — блок конфигурации реплики. Блоков может быть несколько. - - - `replica/host` — хост MySQL. - - `replica/priority` — приоритет реплики. При попытке соединения ClickHouse обходит реплики в соответствии с приоритетом. Чем меньше цифра, тем выше приоритет. - -- `db` — имя базы данных. - -- `table` — имя таблицы. - -- `where` — условие выбора. Синтаксис условия совпадает с синтаксисом секции `WHERE` в MySQL, например, `id > 10 AND id < 20`. Необязательный параметр. - -- `invalidate_query` — запрос для проверки статуса словаря. Необязательный параметр. Читайте подробнее в разделе [Обновление словарей](external_dicts_dict_lifetime.md). - -MySQL можно подключить на локальном хосте через сокеты, для этого необходимо задать `host` и `socket`. - -Пример настройки: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -или - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### ClickHouse {#dicts-external_dicts_dict_sources-clickhouse} - -Пример настройки: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -или - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -Поля настройки: - -- `host` — хост ClickHouse. Если host локальный, то запрос выполняется без сетевого взаимодействия. Чтобы повысить отказоустойчивость решения, можно создать таблицу типа [Distributed](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md) и прописать её в дальнейших настройках. -- `port` — порт сервера ClickHouse. -- `user` — имя пользователя ClickHouse. -- `password` — пароль пользователя ClickHouse. -- `db` — имя базы данных. -- `table` — имя таблицы. -- `where` — условие выбора. Может отсутствовать. -- `invalidate_query` — запрос для проверки статуса словаря. Необязательный параметр. Читайте подробнее в разделе [Обновление словарей](external_dicts_dict_lifetime.md). - -### MongoDB {#dicts-external_dicts_dict_sources-mongodb} - -Пример настройки: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -или - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -Поля настройки: - -- `host` — хост MongoDB. -- `port` — порт сервера MongoDB. -- `user` — имя пользователя MongoDB. -- `password` — пароль пользователя MongoDB. -- `db` — имя базы данных. -- `collection` — имя коллекции. - -### Redis {#dicts-external_dicts_dict_sources-redis} - -Пример настройки: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -или - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -Поля настройки: - -- `host` – хост Redis. -- `port` – порт сервера Redis. -- `storage_type` – способ хранения ключей. Необходимо использовать `simple` для источников с одним столбцом ключей, `hash_map` – для источников с двумя столбцами ключей. Источники с более, чем двумя столбцами ключей, не поддерживаются. Может отсутствовать, значение по умолчанию `simple`. -- `db_index` – номер базы данных. Может отсутствовать, значение по умолчанию 0. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index f83b7657b54..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,167 +0,0 @@ -# Ключ и поля словаря {#kliuch-i-polia-slovaria} - -Секция `` описывает ключ словаря и поля, доступные для запросов. - -Описание в формате XML: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -Атрибуты описываются элементами: - -- `` — [столбец с ключом](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [столбец данных](external_dicts_dict_structure.md#ext_dict_structure-attributes). Можно задать несколько атрибутов. - -Создание словаря запросом: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -Атрибуты задаются в теле запроса: - -- `PRIMARY KEY` — [столбец с ключом](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [столбец данных](external_dicts_dict_structure.md#ext_dict_structure-attributes). Можно задать несколько столбцов. - -## Ключ {#ext_dict_structure-key} - -ClickHouse поддерживает следующие виды ключей: - -- Числовой ключ. `UInt64`. Описывается в теге `` или ключевым словом `PRIMARY KEY`. -- Составной ключ. Набор значений разного типа. Описывается в теге `` или ключевым словом `PRIMARY KEY`. - -Структура может содержать либо `` либо ``. DDL-запрос может содержать только `PRIMARY KEY`. - -!!! warning "Обратите внимание" - Ключ не надо дополнительно описывать в атрибутах. - -### Числовой ключ {#ext_dict-numeric-key} - -Тип: `UInt64`. - -Пример конфигурации: - -``` xml - - Id - -``` - -Поля конфигурации: - -- `name` — имя столбца с ключами. - -Для DDL-запроса: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – имя столбца с ключами. - -### Составной ключ {#sostavnoi-kliuch} - -Ключом может быть кортеж (`tuple`) из полей произвольных типов. В этом случае [layout](external_dicts_dict_layout.md) должен быть `complex_key_hashed` или `complex_key_cache`. - -!!! tip "Совет" - Составной ключ может состоять из одного элемента. Это даёт возможность использовать в качестве ключа, например, строку. - -Структура ключа задаётся в элементе ``. Поля ключа задаются в том же формате, что и [атрибуты](external_dicts_dict_structure.md) словаря. Пример: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -или - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -При запросе в функции `dictGet*` в качестве ключа передаётся кортеж. Пример: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## Атрибуты {#ext_dict_structure-attributes} - -Пример конфигурации: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -или - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -Поля конфигурации: - -| Тег | Описание | Обязательный | -|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------| -| `name` | Имя столбца. | Да | -| `type` | Тип данных ClickHouse.
ClickHouse пытается привести значение из словаря к заданному типу данных. Например, в случае MySQL, в таблице-источнике поле может быть `TEXT`, `VARCHAR`, `BLOB`, но загружено может быть как `String`. [Nullable](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md) не поддерживается. | Да | -| `null_value` | Значение по умолчанию для несуществующего элемента.
В примере это пустая строка. Нельзя указать значение `NULL`. | Да | -| `expression` | [Выражение](../../syntax.md#syntax-expressions), которое ClickHouse выполняет со значением.
Выражением может быть имя столбца в удаленной SQL базе. Таким образом, вы можете использовать его для создания псевдонима удаленного столбца.

Значение по умолчанию: нет выражения. | Нет | -| `hierarchical` | Если `true`, то атрибут содержит ключ предка для текущего элемента. Смотрите [Иерархические словари](external_dicts_dict_hierarchical.md).

Default value: `false`. | No | -| `is_object_id` | Признак того, что запрос выполняется к документу MongoDB по `ObjectID`.

Значение по умолчанию: `false`. | Нет | - -## Смотрите также {#smotrite-takzhe} - -- [Функции для работы с внешними словарями](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/ru/sql_reference/dictionaries/external_dictionaries/index.md b/docs/ru/sql_reference/dictionaries/external_dictionaries/index.md deleted file mode 100644 index 9af8b4f2f12..00000000000 --- a/docs/ru/sql_reference/dictionaries/external_dictionaries/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: External Dictionaries -toc_priority: 37 ---- - diff --git a/docs/ru/sql_reference/dictionaries/index.md b/docs/ru/sql_reference/dictionaries/index.md deleted file mode 100644 index e876b92c9bf..00000000000 --- a/docs/ru/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,14 +0,0 @@ -# Словари {#slovari} - -Словарь — это отображение (`ключ -> атрибуты`), которое удобно использовать для различного вида справочников. - -ClickHouse поддерживает специальные функции для работы со словарями, которые можно использовать в запросах. Проще и эффективнее использовать словари с помощью функций, чем `JOIN` с таблицами-справочниками. - -В словаре нельзя хранить значения [NULL](../syntax.md#null). - -ClickHouse поддерживает: - -- [Встроенные словари](internal_dicts.md#internal_dicts) со специфическим [набором функций](../../sql_reference/dictionaries/external_dictionaries/index.md). -- [Подключаемые (внешние) словари](external_dictionaries/external_dicts.md) с [набором функций](../../sql_reference/dictionaries/external_dictionaries/index.md). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/) diff --git a/docs/ru/sql_reference/dictionaries/internal_dicts.md b/docs/ru/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index 2b93c4e3b7f..00000000000 --- a/docs/ru/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,48 +0,0 @@ -# Встроенные словари {#internal_dicts} - -ClickHouse содержит встроенную возможность работы с геобазой. - -Это позволяет: - -- для идентификатора региона получить его имя на нужном языке; -- по идентификатору региона получить идентификатор города, области, федерального округа, страны, континента; -- проверить, что один регион входит в другой; -- получить цепочку родительских регионов. - -Все функции поддерживают «транслокальность», то есть возможность использовать одновременно разные точки зрения на принадлежность регионов. Подробнее смотрите в разделе «Функции для работы со словарями Яндекс.Метрики». - -В пакете по умолчанию, встроенные словари выключены. -Для включения, раскомментируйте параметры `path_to_regions_hierarchy_file` и `path_to_regions_names_files` в конфигурационном файле сервера. - -Геобаза загружается из текстовых файлов. - -Положите файлы `regions_hierarchy*.txt` в директорию `path_to_regions_hierarchy_file`. Этот конфигурационный параметр должен содержать путь к файлу `regions_hierarchy.txt` (иерархия регионов по умолчанию), а другие файлы (`regions_hierarchy_ua.txt`) должны находиться рядом в той же директории. - -Положите файлы `regions_names_*.txt` в директорию `path_to_regions_names_files`. - -Также вы можете создать эти файлы самостоятельно. Формат файлов такой: - -`regions_hierarchy*.txt`: TabSeparated (без заголовка), столбцы: - -- идентификатор региона (`UInt32`); -- идентификатор родительского региона (`UInt32`); -- тип региона (`UInt8`): 1 - континент, 3 - страна, 4 - федеральный округ, 5 - область, 6 - город; остальные типы не имеют значения; -- население (`UInt32`) - не обязательный столбец. - -`regions_names_*.txt`: TabSeparated (без заголовка), столбцы: - -- идентификатор региона (`UInt32`); -- имя региона (`String`) - не может содержать табы или переводы строк, даже экранированные. - -Для хранения в оперативке используется плоский массив. Поэтому, идентификаторы не должны быть больше миллиона. - -Словари могут обновляться без перезапуска сервера. Но набор доступных словарей не обновляется. -Для обновления проверяется время модификации файлов; если файл изменился, то словарь будет обновлён. -Периодичность проверки настраивается конфигурационным параметром `builtin_dictionaries_reload_interval`. -Обновление словарей (кроме загрузки при первом использовании) не блокирует запросы - во время обновления запросы используют старую версию словарей. Если при обновлении возникнет ошибка, то ошибка пишется в лог сервера, а запросы продолжат использовать старую версию словарей. - -Рекомендуется периодически обновлять словари с геобазой. При обновлении, генерируйте новые файлы, записывая их в отдельное место, а только когда всё готово - переименовывайте в файлы, которые использует сервер. - -Также имеются функции для работы с идентификаторами операционных систем и поисковых систем Яндекс.Метрики, пользоваться которыми не нужно. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/dicts/internal_dicts/) diff --git a/docs/ru/sql_reference/functions/array_functions.md b/docs/ru/sql_reference/functions/array_functions.md deleted file mode 100644 index 82a6ceea001..00000000000 --- a/docs/ru/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,972 +0,0 @@ -# Функции по работе с массивами {#funktsii-po-rabote-s-massivami} - -## empty {#function-empty} - -Возвращает 1 для пустого массива, и 0 для непустого массива. -Тип результата - UInt8. -Функция также работает для строк. - -## notEmpty {#function-notempty} - -Возвращает 0 для пустого массива, и 1 для непустого массива. -Тип результата - UInt8. -Функция также работает для строк. - -## length {#array_functions-length} - -Возвращает количество элементов в массиве. -Тип результата - UInt64. -Функция также работает для строк. - -## emptyArrayUInt8, emptyArrayUInt16, emptyArrayUInt32, emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## emptyArrayInt8, emptyArrayInt16, emptyArrayInt32, emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} - -## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} - -## emptyArrayString {#emptyarraystring} - -Принимает ноль аргументов и возвращает пустой массив соответствующего типа. - -## emptyArrayToSingle {#emptyarraytosingle} - -Принимает пустой массив и возвращает массив из одного элемента, равного значению по умолчанию. - -## range(N) {#rangen} - -Возвращает массив чисел от 0 до N-1. -На всякий случай, если на блок данных, создаются массивы суммарной длины больше 100 000 000 элементов, то кидается исключение. - -## array(x1, …), оператор \[x1, …\] {#arrayx1-operator-x1} - -Создаёт массив из аргументов функции. -Аргументы должны быть константами и иметь типы, для которых есть наименьший общий тип. Должен быть передан хотя бы один аргумент, так как иначе непонятно, какого типа создавать массив. То есть, с помощью этой функции невозможно создать пустой массив (для этого используйте функции emptyArray\*, описанные выше). -Возвращает результат типа Array(T), где T - наименьший общий тип от переданных аргументов. - -## arrayConcat {#arrayconcat} - -Объединяет массивы, переданные в качестве аргументов. - -``` sql -arrayConcat(arrays) -``` - -**Параметры** - -- `arrays` – произвольное количество элементов типа [Array](../../sql_reference/functions/array_functions.md) - **Пример** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,3,4,5,6] │ -└───────────────┘ -``` - -## arrayElement(arr, n), operator arr\[n\] {#arrayelementarr-n-operator-arrn} - -Достаёт элемент с индексом n из массива arr. n должен быть любым целочисленным типом. -Индексы в массиве начинаются с единицы. -Поддерживаются отрицательные индексы. В этом случае, будет выбран соответствующий по номеру элемент с конца. Например, arr\[-1\] - последний элемент массива. - -Если индекс выходит за границы массива, то возвращается некоторое значение по умолчанию (0 для чисел, пустая строка для строк и т. п.), кроме случая с неконстантным массивом и константным индексом 0 (в этом случае будет ошибка `Array indices are 1-based`). - -## has(arr, elem) {#hasarr-elem} - -Проверяет наличие элемента elem в массиве arr. -Возвращает 0, если элемента в массиве нет, или 1, если есть. - -`NULL` обрабатывается как значение. - -``` sql -SELECT has([1, 2, NULL], NULL) -``` - -``` text -┌─has([1, 2, NULL], NULL)─┐ -│ 1 │ -└─────────────────────────┘ -``` - -## hasAll {#hasall} - -Проверяет, является ли один массив подмножеством другого. - -``` sql -hasAll(set, subset) -``` - -**Параметры** - -- `set` – массив любого типа с набором элементов. -- `subset` – массив любого типа со значениями, которые проверяются на вхождение в `set`. - -**Возвращаемые значения** - -- `1`, если `set` содержит все элементы из `subset`. -- `0`, в противном случае. - -**Особенности** - -- Пустой массив является подмножеством любого массива. -- `NULL` обрабатывается как значение. -- Порядок значений в обоих массивах не имеет значения. - -**Примеры** - -`SELECT hasAll([], [])` возвращает 1. - -`SELECT hasAll([1, Null], [Null])` возвращает 1. - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` возвращает 1. - -`SELECT hasAll(['a', 'b'], ['a'])` возвращает 1. - -`SELECT hasAll([1], ['a'])` возвращает 0. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` возвращает 0. - -## hasAny {#hasany} - -Проверяет, имеют ли два массива хотя бы один общий элемент. - -``` sql -hasAny(array1, array2) -``` - -**Параметры** - -- `array1` – массив любого типа с набором элементов. -- `array2` – массив любого типа с набором элементов. - -**Возвращаемые значения** - -- `1`, если `array1` и `array2` имеют хотя бы один одинаковый элемент. -- `0`, в противном случае. - -**Особенности** - -- `NULL` обрабатывается как значение. -- Порядок значений в обоих массивах не имеет значения. - -**Примеры** - -`SELECT hasAny([1], [])` возвращает `0`. - -`SELECT hasAny([Null], [Null, 1])` возвращает `1`. - -`SELECT hasAny([-128, 1., 512], [1])` возвращает `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` возвращает `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` возвращает `1`. - -## indexOf(arr, x) {#indexofarr-x} - -Возвращает индекс первого элемента x (начиная с 1), если он есть в массиве, или 0, если его нет. - -Пример: - -``` sql -SELECT indexOf([1, 3, NULL, NULL], NULL) -``` - -``` text -┌─indexOf([1, 3, NULL, NULL], NULL)─┐ -│ 3 │ -└───────────────────────────────────┘ -``` - -Элементы, равные `NULL`, обрабатываются как обычные значения. - -## countEqual(arr, x) {#countequalarr-x} - -Возвращает количество элементов массива, равных x. Эквивалентно arrayCount(elem -\> elem = x, arr). - -`NULL` обрабатывается как значение. - -Пример: - -``` sql -SELECT countEqual([1, 2, NULL, NULL], NULL) -``` - -``` text -┌─countEqual([1, 2, NULL, NULL], NULL)─┐ -│ 2 │ -└──────────────────────────────────────┘ -``` - -## arrayEnumerate(arr) {#array_functions-arrayenumerate} - -Возвращает массив \[1, 2, 3, …, length(arr)\] - -Эта функция обычно используется совместно с ARRAY JOIN. Она позволяет, после применения ARRAY JOIN, посчитать что-либо только один раз для каждого массива. Пример: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -В этом примере, Reaches - число достижений целей (строк, получившихся после применения ARRAY JOIN), а Hits - число хитов (строк, которые были до ARRAY JOIN). В данном случае, тот же результат можно получить проще: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -Также эта функция может быть использована в функциях высшего порядка. Например, с её помощью можно достать индексы массива для элементов, удовлетворяющих некоторому условию. - -## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} - -Возвращает массив, такого же размера, как исходный, где для каждого элемента указано, какой он по счету среди элементов с таким же значением. -Например: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. - -Эта функция полезна при использовании ARRAY JOIN и агрегации по элементам массива. -Пример: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - -``` text -┌──GoalID─┬─Reaches─┬─Visits─┐ -│ 53225 │ 3214 │ 1097 │ -│ 2825062 │ 3188 │ 1097 │ -│ 56600 │ 2803 │ 488 │ -│ 1989037 │ 2401 │ 365 │ -│ 2830064 │ 2396 │ 910 │ -│ 1113562 │ 2372 │ 373 │ -│ 3270895 │ 2262 │ 812 │ -│ 1084657 │ 2262 │ 345 │ -│ 56599 │ 2260 │ 799 │ -│ 3271094 │ 2256 │ 812 │ -└─────────┴─────────┴────────┘ -``` - -В этом примере, для каждого идентификатора цели, посчитано количество достижений целей (каждый элемент вложенной структуры данных Goals является достижением целей) и количество визитов. Если бы не было ARRAY JOIN, мы бы считали количество визитов как sum(Sign). Но в данном случае, строчки были размножены по вложенной структуре Goals, и чтобы после этого учесть каждый визит один раз, мы поставили условие на значение функции arrayEnumerateUniq(Goals.ID). - -Функция arrayEnumerateUniq может принимать несколько аргументов - массивов одинаковых размеров. В этом случае, уникальность считается для кортежей элементов на одинаковых позициях всех массивов. - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,1,1,2,1] │ -└───────────────┘ -``` - -Это нужно при использовании ARRAY JOIN с вложенной структурой данных и затем агрегации по нескольким элементам этой структуры. - -## arrayPopBack {#arraypopback} - -Удаляет последний элемент из массива. - -``` sql -arrayPopBack(array) -``` - -**Параметры** - -- `array` - Массив. - -**Пример** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - -text - - ┌─res───┐ - │ [1,2] │ - └───────┘ - -## arrayPopFront {#arraypopfront} - -Удаляет первый элемент из массива. - -``` sql -arrayPopFront(array) -``` - -**Параметры** - -- `array` - Массив. - -**Пример** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [2,3] │ -└───────┘ -``` - -## arrayPushBack {#arraypushback} - -Добавляет один элемент в конец массива. - -``` sql -arrayPushBack(array, single_value) -``` - -**Параметры** - -- `array` - Массив. -- `single_value` - Одиночное значение. В массив с числам можно добавить только числа, в массив со строками только строки. При добавлении чисел ClickHouse автоматически приводит тип `single_value` к типу данных массива. Подробнее о типах данных в ClickHouse читайте в разделе «[Типы данных](../../sql_reference/functions/array_functions.md#data_types)». Может быть равно `NULL`. Функция добавит элемент `NULL` в массив, а тип элементов массива преобразует в `Nullable`. - -**Пример** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayPushFront {#arraypushfront} - -Добавляет один элемент в начало массива. - -``` sql -arrayPushFront(array, single_value) -``` - -**Параметры** - -- `array` - Массив. -- `single_value` - Одиночное значение. В массив с числам можно добавить только числа, в массив со строками только строки. При добавлении чисел ClickHouse автоматически приводит тип `single_value` к типу данных массива. Подробнее о типах данных в ClickHouse читайте в разделе «[Типы данных](../../sql_reference/functions/array_functions.md#data_types)». Может быть равно `NULL`. Функция добавит элемент `NULL` в массив, а тип элементов массива преобразует в `Nullable`. - -**Пример** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayResize {#arrayresize} - -Изменяет длину массива. - -``` sql -arrayResize(array, size[, extender]) -``` - -**Параметры** - -- `array` — массив. -- `size` — необходимая длина массива. - - Если `size` меньше изначального размера массива, то массив обрезается справа. - - Если `size` больше изначального размера массива, массив дополняется справа значениями `extender` или значениями по умолчанию для типа данных элементов массива. -- `extender` — значение для дополнения массива. Может быть `NULL`. - -**Возвращаемое значение:** - -Массив длины `size`. - -**Примеры вызовов** - -``` sql -SELECT arrayResize([1], 3) -``` - -``` text -┌─arrayResize([1], 3)─┐ -│ [1,0,0] │ -└─────────────────────┘ -``` - -``` sql -SELECT arrayResize([1], 3, NULL) -``` - -``` text -┌─arrayResize([1], 3, NULL)─┐ -│ [1,NULL,NULL] │ -└───────────────────────────┘ -``` - -## arraySlice {#arrayslice} - -Возвращает срез массива. - -``` sql -arraySlice(array, offset[, length]) -``` - -**Параметры** - -- `array` - Массив данных. -- `offset` - Отступ от края массива. Положительное значение - отступ слева, отрицательное значение - отступ справа. Отсчет элементов массива начинается с 1. -- `length` - Длина необходимого среза. Если указать отрицательное значение, то функция вернёт открытый срез `[offset, array_length - length)`. Если не указать значение, то функция вернёт срез `[offset, the_end_of_array]`. - -**Пример** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - -``` text -┌─res────────┐ -│ [2,NULL,4] │ -└────────────┘ -``` - -Элементы массива равные `NULL` обрабатываются как обычные значения. - -## arraySort(\[func,\] arr, …) {#array_functions-sort} - -Возвращает массив `arr`, отсортированный в восходящем порядке. Если задана функция `func`, то порядок сортировки определяется результатом применения этой функции на элементы массива `arr`. Если `func` принимает несколько аргументов, то в функцию `arraySort` нужно передавать несколько массивов, которые будут соответствовать аргументам функции `func`. Подробные примеры рассмотрены в конце описания `arraySort`. - -Пример сортировки целочисленных значений: - -``` sql -SELECT arraySort([1, 3, 3, 0]) -``` - -``` text -┌─arraySort([1, 3, 3, 0])─┐ -│ [0,1,3,3] │ -└─────────────────────────┘ -``` - -Пример сортировки строковых значений: - -``` sql -SELECT arraySort(['hello', 'world', '!']) -``` - -``` text -┌─arraySort(['hello', 'world', '!'])─┐ -│ ['!','hello','world'] │ -└────────────────────────────────────┘ -``` - -Значения `NULL`, `NaN` и `Inf` сортируются по следующему принципу: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - -``` text -┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ -│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────────────────────────┘ -``` - -- Значения `-Inf` идут в начале массива. -- Значения `NULL` идут в конце массива. -- Значения `NaN` идут перед `NULL`. -- Значения `Inf` идут перед `NaN`. - -Функция `arraySort` является [функцией высшего порядка](higher_order_functions.md) — в качестве первого аргумента ей можно передать лямбда-функцию. В этом случае порядок сортировки определяется результатом применения лямбда-функции на элементы массива. - -Рассмотрим пример: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,2,1] │ -└─────────┘ -``` - -Для каждого элемента исходного массива лямбда-функция возвращает ключ сортировки, то есть \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Так как `arraySort` сортирует элементы в порядке возрастания ключей, результат будет \[3, 2, 1\]. Как можно заметить, функция `x –> -x` устанавливает [обратный порядок сортировки](#array_functions-reverse-sort). - -Лямбда-функция может принимать несколько аргументов. В этом случае, в функцию `arraySort` нужно передавать несколько массивов, которые будут соответствовать аргументам лямбда-функции (массивы должны быть одинаковой длины). Следует иметь в виду, что результат будет содержать элементы только из первого массива; элементы из всех последующих массивов будут задавать ключи сортировки. Например: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Элементы, указанные во втором массиве (\[2,1\]), определяют ключ сортировки для элементов из исходного массива (\[‘hello’, ‘world’\]), то есть \[‘hello’ –\> 2, ‘world’ –\> 1\]. Так как лямбда-функция не использует `x`, элементы исходного массива не влияют на порядок сортировки. Таким образом, ‘hello’ будет вторым элементом в отсортированном массиве, а ‘world’ — первым. - -Ниже приведены другие примеры. - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! note "Примечание" - Для улучшения эффективности сортировки применяется [преобразование Шварца](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). - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} - -Возвращает массив `arr`, отсортированный в нисходящем порядке. Если указана функция `func`, то массив `arr` сначала сортируется в порядке, который определяется функцией `func`, а затем отсортированный массив переворачивается. Если функция `func` принимает несколько аргументов, то в функцию `arrayReverseSort` необходимо передавать несколько массивов, которые будут соответствовать аргументам функции `func`. Подробные примеры рассмотрены в конце описания функции `arrayReverseSort`. - -Пример сортировки целочисленных значений: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - -``` text -┌─arrayReverseSort([1, 3, 3, 0])─┐ -│ [3,3,1,0] │ -└────────────────────────────────┘ -``` - -Пример сортировки строковых значений: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - -``` text -┌─arrayReverseSort(['hello', 'world', '!'])─┐ -│ ['world','hello','!'] │ -└───────────────────────────────────────────┘ -``` - -Значения `NULL`, `NaN` и `Inf` сортируются в следующем порядке: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` text -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- Значения `Inf` идут в начале массива. -- Значения `NULL` идут в конце массива. -- Значения `NaN` идут перед `NULL`. -- Значения `-Inf` идут перед `NaN`. - -Функция `arrayReverseSort` является [функцией высшего порядка](higher_order_functions.md). Вы можете передать ей в качестве первого аргумента лямбда-функцию. Например: - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [1,2,3] │ -└─────────┘ -``` - -В этом примере, порядок сортировки устанавливается следующим образом: - -1. Сначала исходный массив (\[1, 2, 3\]) сортируется в том порядке, который определяется лямбда-функцией. Результатом будет массив \[3, 2, 1\]. -2. Массив, который был получен на предыдущем шаге, переворачивается. То есть, получается массив \[1, 2, 3\]. - -Лямбда-функция может принимать на вход несколько аргументов. В этом случае, в функцию `arrayReverseSort` нужно передавать несколько массивов, которые будут соответствовать аргументам лямбда-функции (массивы должны быть одинаковой длины). Следует иметь в виду, что результат будет содержать элементы только из первого массива; элементы из всех последующих массивов будут определять ключи сортировки. Например: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -В этом примере, массив сортируется следующим образом: - -1. Сначала массив сортируется в том порядке, который определяется лямбда-функцией. Элементы, указанные во втором массиве (\[2,1\]), определяют ключи сортировки соответствующих элементов из исходного массива (\[‘hello’, ‘world’\]). То есть, будет массив \[‘world’, ‘hello’\]. -2. Массив, который был отсортирован на предыдущем шаге, переворачивается. Получается массив \[‘hello’, ‘world’\]. - -Ниже приведены ещё примеры. - -``` sql -SELECT arrayReverseSort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [0,1,2] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` text -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#array-functions-arrayuniq} - -Если передан один аргумент, считает количество разных элементов в массиве. -Если передано несколько аргументов, считает количество разных кортежей из элементов на соответствующих позициях в нескольких массивах. - -Если необходимо получить список уникальных элементов массива, можно воспользоваться arrayReduce(‘groupUniqArray’, arr). - -## arrayJoin(arr) {#array-functions-arrayjoin} - -Особенная функция. Смотрите раздел [«Функция arrayJoin»](array_join.md#functions_arrayjoin). - -## arrayDifference {#arraydifference} - -Вычисляет разность между соседними элементами массива. Возвращает массив, где первым элементом будет 0, вторым – разность `a[1] - a[0]` и т. д. Тип элементов результирующего массива определяется правилами вывода типов при вычитании (напр. `UInt8` - `UInt8` = `Int16`). - -**Синтаксис** - -``` sql -arrayDifference(array) -``` - -**Параметры** - -- `array` – [Массив](https://clickhouse.yandex/docs/ru/data_types/array/). - -**Возвращаемое значение** - -Возвращает массив разностей между соседними элементами. - -**Пример** - -Запрос: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - -Ответ: - -``` text -┌─arrayDifference([1, 2, 3, 4])─┐ -│ [0,1,1,1] │ -└───────────────────────────────┘ -``` - -Пример переполнения из-за результирующего типа `Int64`: - -Запрос: - -``` sql -SELECT arrayDifference([0, 10000000000000000000]) -``` - -Ответ: - -``` text -┌─arrayDifference([0, 10000000000000000000])─┐ -│ [0,-8446744073709551616] │ -└────────────────────────────────────────────┘ -``` - -## arrayDistinct {#arraydistinct} - -Принимает массив, возвращает массив, содержащий уникальные элементы. - -**Синтаксис** - -``` sql -arrayDistinct(array) -``` - -**Параметры** - -- `array` – [Массив](https://clickhouse.yandex/docs/ru/data_types/array/). - -**Возвращаемое значение** - -Возвращает массив, содержащий только уникальные элементы исходного массива. - -**Пример** - -Запрос: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - -Ответ: - -``` text -┌─arrayDistinct([1, 2, 2, 3, 1])─┐ -│ [1,2,3] │ -└────────────────────────────────┘ -``` - -## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} - -Возвращает массив того же размера, что и исходный массив, с индексами исходного массива, указывающими, где каждый элемент впервые появляется в исходном массиве. - -Пример: - -``` sql -SELECT arrayEnumerateDense([10, 20, 10, 30]) -``` - -``` text -┌─arrayEnumerateDense([10, 20, 10, 30])─┐ -│ [1,2,1,3] │ -└───────────────────────────────────────┘ -``` - -## arrayIntersect(arr) {#array-functions-arrayintersect} - -Принимает несколько массивов, возвращает массив с элементами, присутствующими во всех исходных массивах. Элементы на выходе следуют в порядке следования в первом массиве. - -Пример: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - -``` text -┌─no_intersect─┬─intersect─┐ -│ [] │ [1] │ -└──────────────┴───────────┘ -``` - -## arrayReduce(agg\_func, arr1, …) {#array-functions-arrayreduce} - -Применяет агрегатную функцию к элементам массива и возвращает ее результат. Имя агрегирующей функции передается как строка в одинарных кавычках `'max'`, `'sum'`. При использовании параметрических агрегатных функций, параметр указывается после имени функции в круглых скобках `'uniqUpTo(6)'`. - -Пример: - -``` sql -SELECT arrayReduce('max', [1, 2, 3]) -``` - -``` text -┌─arrayReduce('max', [1, 2, 3])─┐ -│ 3 │ -└───────────────────────────────┘ -``` - -Если агрегатная функция имеет несколько аргументов, то эту функцию можно применять к нескольким массивам одинакового размера. - -Пример: - -``` sql -SELECT arrayReduce('maxIf', [3, 5], [1, 0]) -``` - -``` text -┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ -│ 3 │ -└──────────────────────────────────────┘ -``` - -Пример с параметрической агрегатной функцией: - -``` sql -SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -``` - -``` text -┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ -│ 4 │ -└─────────────────────────────────────────────────────────────┘ -``` - -## arrayReverse(arr) {#array_functions-arrayreverse} - -Возвращает массив того же размера, что и исходный массив, содержащий элементы в обратном порядке. - -Пример: - -``` sql -SELECT arrayReverse([1, 2, 3]) -``` - -``` text -┌─arrayReverse([1, 2, 3])─┐ -│ [3,2,1] │ -└─────────────────────────┘ -``` - -## reverse(arr) {#array-functions-reverse} - -Синоним для [«arrayReverse»](#array_functions-arrayreverse) - -## arrayFlatten {#arrayflatten} - -Преобразует массив массивов в плоский массив. - -Функция: - -- Оперирует с массивами любой вложенности. -- Не изменяет массив, если он уже плоский. - -Результирующий массив содержит все элементы исходных массивов. - -**Синтаксис** - -``` sql -flatten(array_of_arrays) -``` - -Синоним: `flatten`. - -**Параметры** - -- `array_of_arrays` — [Массивов](../../sql_reference/functions/array_functions.md) массивов. Например, `[[1,2,3], [4,5]]`. - -**Примеры** - -``` sql -SELECT flatten([[[1]], [[2], [3]]]) -``` - -``` text -┌─flatten(array(array([1]), array([2], [3])))─┐ -│ [1,2,3] │ -└─────────────────────────────────────────────┘ -``` - -## arrayCompact {#arraycompact} - -Удаляет дубликаты из массива. Порядок результирующих значений определяется порядком в исходном массиве. - -**Синтаксис** - -``` sql -arrayCompact(arr) -``` - -**Параметры** - -`arr` — [Массив](../../sql_reference/functions/array_functions.md) для обхода. - -**Возвращаемое значение** - -Массив без дубликатов. - -Тип: `Array`. - -**Пример** - -Запрос: - -``` sql -SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) -``` - -Ответ: - -``` text -┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ -│ [1,nan,nan,2,3] │ -└────────────────────────────────────────────┘ -``` - -## arrayZip {#arrayzip} - -Объединяет несколько массивов в один. Результирующий массив содержит соответственные элементы исходных массивов, сгруппированные в кортежи в указанном порядке аргументов. - -**Синтаксис** - -``` sql -arrayZip(arr1, arr2, ..., arrN) -``` - -**Параметры** - -- `arrN` — [Массив](../data_types/array.md). - -Функция принимает любое количество массивов, которые могут быть различных типов. Все массивы должны иметь одинаковую длину. - -**Возвращаемое значение** - -- Массив с элементами исходных массивов, сгруппированными в [кортежи](../data_types/tuple.md). Типы данных в кортежах соответствуют типам данных входных массивов и следуют в том же порядке, в котором переданы массивы. - -Тип: [Массив](../data_types/array.md). - -**Пример** - -Запрос: - -``` sql -SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]) -``` - -Ответ: - -``` text -┌─arrayZip(['a', 'b', 'c'], [5, 2, 1])─┐ -│ [('a',5),('b',2),('c',1)] │ -└──────────────────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/array_functions/) diff --git a/docs/ru/sql_reference/functions/array_join.md b/docs/ru/sql_reference/functions/array_join.md deleted file mode 100644 index 4298eea89e6..00000000000 --- a/docs/ru/sql_reference/functions/array_join.md +++ /dev/null @@ -1,30 +0,0 @@ -# Функция arrayJoin {#functions_arrayjoin} - -Это совсем необычная функция. - -Обычные функции не изменяют множество строк, а лишь изменяют значения в каждой строке (map). -Агрегатные функции выполняют свёртку множества строк (fold, reduce). -Функция arrayJoin выполняет размножение каждой строки в множество строк (unfold). - -Функция принимает в качестве аргумента массив, и размножает исходную строку в несколько строк - по числу элементов массива. -Все значения в столбцах просто копируются, кроме значения в столбце с применением этой функции - он заменяется на соответствующее значение массива. - -В запросе может быть использовано несколько функций `arrayJoin`. В этом случае, соответствующее преобразование делается несколько раз. - -Обратите внимание на синтаксис ARRAY JOIN в запросе SELECT, который предоставляет более широкие возможности. - -Пример: - -``` sql -SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src -``` - -``` text -┌─dst─┬─\'Hello\'─┬─src─────┐ -│ 1 │ Hello │ [1,2,3] │ -│ 2 │ Hello │ [1,2,3] │ -│ 3 │ Hello │ [1,2,3] │ -└─────┴───────────┴─────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/array_join/) diff --git a/docs/ru/sql_reference/functions/bit_functions.md b/docs/ru/sql_reference/functions/bit_functions.md deleted file mode 100644 index 09eb9d17bc2..00000000000 --- a/docs/ru/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,238 +0,0 @@ -# Битовые функции {#bitovye-funktsii} - -Битовые функции работают для любой пары типов из UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32, Float64. - -Тип результата - целое число, битность которого равна максимальной битности аргументов. Если хотя бы один аргумент знаковый, то результат - знаковое число. Если аргумент - число с плавающей запятой - оно приводится к Int64. - -## bitAnd(a, b) {#bitanda-b} - -## bitOr(a, b) {#bitora-b} - -## bitXor(a, b) {#bitxora-b} - -## bitNot(a) {#bitnota} - -## bitShiftLeft(a, b) {#bitshiftlefta-b} - -## bitShiftRight(a, b) {#bitshiftrighta-b} - -## bitTest {#bittest} - -Принимает любое целое число и конвертирует его в [двоичное число](https://en.wikipedia.org/wiki/Binary_number), возвращает значение бита в указанной позиции. Отсчет начинается с 0 справа налево. - -**Синтаксис** - -``` sql -SELECT bitTest(number, index) -``` - -**Параметры** - -- `number` – целое число. -- `index` – position of bit. - -**Возвращаемое значение** - -Возвращает значение бита в указанной позиции. - -Тип: `UInt8`. - -**Пример** - -Например, число 43 в двоичной системе счисления равно: 101011. - -Запрос: - -``` sql -SELECT bitTest(43, 1) -``` - -Ответ: - -``` text -┌─bitTest(43, 1)─┐ -│ 1 │ -└────────────────┘ -``` - -Другой пример: - -Запрос: - -``` sql -SELECT bitTest(43, 2) -``` - -Ответ: - -``` text -┌─bitTest(43, 2)─┐ -│ 0 │ -└────────────────┘ -``` - -## bitTestAll {#bittestall} - -Возвращает результат [логической конъюнкции](https://en.wikipedia.org/wiki/Logical_conjunction) (оператор AND) всех битов в указанных позициях. Отсчет начинается с 0 справа налево. - -Бинарная конъюнкция: - -0 AND 0 = 0 -0 AND 1 = 0 -1 AND 0 = 0 -1 AND 1 = 1 - -**Синтаксис** - -``` sql -SELECT bitTestAll(number, index1, index2, index3, index4, ...) -``` - -**Параметры** - -- `number` – целое число. -- `index1`, `index2`, `index3`, `index4` – позиция бита. Например, конъюнкция для набора позиций `index1`, `index2`, `index3`, `index4` является истинной, если все его позиции истинны `index1` ⋀ `index2` ⋀ `index3` ⋀ `index4`. - -**Возвращаемое значение** - -Возвращает результат логической конъюнкции. - -Тип: `UInt8`. - -**Пример** - -Например, число 43 в двоичной системе счисления равно: 101011. - -Запрос: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5) -``` - -Ответ: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5)─┐ -│ 1 │ -└────────────────────────────┘ -``` - -Другой пример: - -Запрос: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5, 2) -``` - -Ответ: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ -│ 0 │ -└───────────────────────────────┘ -``` - -## bitTestAny {#bittestany} - -Возвращает результат [логической дизъюнкции](https://en.wikipedia.org/wiki/Logical_disjunction) (оператор OR) всех битов в указанных позициях. Отсчет начинается с 0 справа налево. - -Бинарная дизъюнкция: - -0 OR 0 = 0 -0 OR 1 = 1 -1 OR 0 = 1 -1 OR 1 = 1 - -**Синтаксис** - -``` sql -SELECT bitTestAny(number, index1, index2, index3, index4, ...) -``` - -**Параметры** - -- `number` – целое число. -- `index1`, `index2`, `index3`, `index4` – позиции бита. - -**Возвращаемое значение** - -Возвращает результат логической дизъюнкции. - -Тип: `UInt8`. - -**Пример** - -Например, число 43 в двоичной системе счисления равно: 101011. - -Запрос: - -``` sql -SELECT bitTestAny(43, 0, 2) -``` - -Ответ: - -``` text -┌─bitTestAny(43, 0, 2)─┐ -│ 1 │ -└──────────────────────┘ -``` - -Другой пример: - -Запрос: - -``` sql -SELECT bitTestAny(43, 4, 2) -``` - -Ответ: - -``` text -┌─bitTestAny(43, 4, 2)─┐ -│ 0 │ -└──────────────────────┘ -``` - -## bitCount {#bitcount} - -Подсчитывает количество равных единице бит в числе. - -**Синтаксис** - -```sql -bitCount(x) -``` - -**Параметры** - -- `x` — [Целое число](../../sql_reference/functions/bit_functions.md) или [число с плавающей запятой](../../sql_reference/functions/bit_functions.md). Функция использует представление числа в памяти, что позволяет поддержать числа с плавающей запятой. - -**Возвращаемое значение** - -- Количество равных единице бит во входном числе. - -Функция не преобразует входное значение в более крупный тип ([sign extension](https://en.wikipedia.org/wiki/Sign_extension)). Поэтому, например, `bitCount(toUInt8(-1)) = 8`. - -Тип: `UInt8`. - -**Пример** - -Возьмём к примеру число 333. Его бинарное представление — 0000000101001101. - -Запрос: - -```sql -SELECT bitCount(333) -``` - -Результат: - -```text -┌─bitCount(100)─┐ -│ 5 │ -└───────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/bit_functions/) diff --git a/docs/ru/sql_reference/functions/bitmap_functions.md b/docs/ru/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index 0a6288498be..00000000000 --- a/docs/ru/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,393 +0,0 @@ -# Функции для битмапов {#funktsii-dlia-bitmapov} - -## bitmapBuild {#bitmap_functions-bitmapbuild} - -Создаёт битовый массив из массива целочисленных значений. - -``` sql -bitmapBuild(array) -``` - -**Параметры** - -- `array` – массив типа `UInt*`. - -**Пример** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) -``` - -``` text -┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ -│  │ AggregateFunction(groupBitmap, UInt8) │ -└─────┴──────────────────────────────────────────────┘ -``` - -## bitmapToArray {#bitmaptoarray} - -Преобразует битовый массив в массив целочисленных значений. - -``` sql -bitmapToArray(bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapSubsetLimit {#bitmapsubsetlimit} - -Создает подмножество битмапа с n элементами, расположенными между `range_start` и `cardinality_limit`. - -**Синтаксис** - -``` sql -bitmapSubsetLimit(bitmap, range_start, cardinality_limit) -``` - -**Параметры** - -- `bitmap` – Битмап. [Bitmap object](#bitmap_functions-bitmapbuild). -- `range_start` – Начальная точка подмножества. [UInt32](../../sql_reference/functions/bitmap_functions.md). -- `cardinality_limit` – Верхний предел подмножества. [UInt32](../../sql_reference/functions/bitmap_functions.md). - -**Возвращаемое значение** - -Подмножество битмапа. - -Тип: `Bitmap object`. - -**Пример** - -Запрос: - -``` sql -SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -Ответ: - -``` text -┌─res───────────────────────┐ -│ [30,31,32,33,100,200,500] │ -└───────────────────────────┘ -``` - -## bitmapContains {#bitmap_functions-bitmapcontains} - -Проверяет вхождение элемента в битовый массив. - -``` sql -bitmapContains(haystack, needle) -``` - -**Параметры** - -- `haystack` – [объект Bitmap](#bitmap_functions-bitmapbuild), в котором функция ищет значение. -- `needle` – значение, которое функция ищет. Тип — [UInt32](../../sql_reference/functions/bitmap_functions.md). - -**Возвращаемые значения** - -- 0 — если в `haystack` нет `needle`. -- 1 — если в `haystack` есть `needle`. - -Тип — `UInt8`. - -**Пример** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAny {#bitmaphasany} - -Проверяет, имеют ли два битовых массива хотя бы один общий элемент. - -``` sql -bitmapHasAny(bitmap1, bitmap2) -``` - -Если вы уверены, что `bitmap2` содержит строго один элемент, используйте функцию [bitmapContains](#bitmap_functions-bitmapcontains). Она работает эффективнее. - -**Параметры** - -- `bitmap*` – массив любого типа с набором элементов. - -**Возвращаемые значения** - -- `1`, если `bitmap1` и `bitmap2` имеют хотя бы один одинаковый элемент. -- `0`, в противном случае. - -**Пример** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAll {#bitmaphasall} - -Аналогично функции `hasAll(array, array)` возвращает 1 если первый битовый массив содержит все элементы второго, 0 в противном случае. -Если второй аргумент является пустым битовым массивом, то возвращает 1. - -``` sql -bitmapHasAll(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 0 │ -└─────┘ -``` - -## bitmapAnd {#bitmapand} - -Логическое И для двух битовых массивов. Результат — новый битовый массив. - -``` sql -bitmapAnd(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─┐ -│ [3] │ -└─────┘ -``` - -## bitmapOr {#bitmapor} - -Логическое ИЛИ для двух битовых массивов. Результат — новый битовый массив. - -``` sql -bitmapOr(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapXor {#bitmapxor} - -Логическое исключающее ИЛИ для двух битовых массивов. Результат — новый битовый массив. - -``` sql -bitmapXor(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,4,5] │ -└───────────┘ -``` - -## bitmapAndnot {#bitmapandnot} - -Логическое отрицание И для двух битовых массивов. Результат — новый битовый массив. - -``` sql -bitmapAndnot(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## bitmapCardinality {#bitmapcardinality} - -Возвращает кардинальность битового массива в виде значения типа `UInt64`. - -``` sql -bitmapCardinality(bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapAndCardinality {#bitmapandcardinality} - -Выполняет логическое И и возвращает кардинальность (`UInt64`) результирующего битового массива. - -``` sql -bitmapAndCardinality(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapOrCardinality {#bitmaporcardinality} - -Выполняет логическое ИЛИ и возвращает кардинальность (`UInt64`) результирующего битового массива. - -``` sql -bitmapOrCardinality(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapXorCardinality {#bitmapxorcardinality} - -Выполняет логическое исключающее ИЛИ и возвращает кардинальность (`UInt64`) результирующего битового массива. - -``` sql -bitmapXorCardinality(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 4 │ -└─────┘ -``` - -## bitmapAndnotCardinality {#bitmapandnotcardinality} - -Выполняет логическое отрицание И и возвращает кардинальность (`UInt64`) результирующего битового массива. - -``` sql -bitmapAndnotCardinality(bitmap,bitmap) -``` - -**Параметры** - -- `bitmap` – битовый массив. - -**Пример** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 2 │ -└─────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/bitmap_functions/) diff --git a/docs/ru/sql_reference/functions/comparison_functions.md b/docs/ru/sql_reference/functions/comparison_functions.md deleted file mode 100644 index 16ae7ee4cae..00000000000 --- a/docs/ru/sql_reference/functions/comparison_functions.md +++ /dev/null @@ -1,32 +0,0 @@ -# Функции сравнения {#funktsii-sravneniia} - -Функции сравнения возвращают всегда 0 или 1 (UInt8). - -Сравнивать можно следующие типы: - -- числа; -- строки и фиксированные строки; -- даты; -- даты-с-временем; - -внутри каждой группы, но не из разных групп. - -Например, вы не можете сравнить дату со строкой. Надо использовать функцию преобразования строки в дату или наоборот. - -Строки сравниваются побайтово. Более короткая строка меньше всех строк, начинающихся с неё и содержащих ещё хотя бы один символ. - -Замечание. До версии 1.1.54134 сравнение знаковых и беззнаковых целых чисел производилось также, как в C++. То есть, вы могли получить неверный результат в таких случаях: SELECT 9223372036854775807 \> -1. С версии 1.1.54134 поведение изменилось и стало математически корректным. - -## equals, оператор a = b и a == b {#function-equals} - -## notEquals, оператор a != b и a `<>` b {#function-notequals} - -## less, оператор `<` {#function-less} - -## greater, оператор `>` {#function-greater} - -## lessOrEquals, оператор `<=` {#function-lessorequals} - -## greaterOrEquals, оператор `>=` {#function-greaterorequals} - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/comparison_functions/) diff --git a/docs/ru/sql_reference/functions/conditional_functions.md b/docs/ru/sql_reference/functions/conditional_functions.md deleted file mode 100644 index f3c57aac38b..00000000000 --- a/docs/ru/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,109 +0,0 @@ -# Условные функции {#uslovnye-funktsii} - -## if {#if} - -Условное выражение. В отличии от большинства систем, ClickHouse всегда считает оба выражения `then` и `else`. - -**Синтаксис** - -``` sql -SELECT if(cond, then, else) -``` - -Если условие `cond` не равно нулю, то возвращается результат выражения `then`. Если условие `cond` равно нулю или является NULL, то результат выражения `then` пропускается и возвращается результат выражения `else`. - -**Параметры** - -- `cond` – Условие, которое может быть равно 0 или нет. Может быть [UInt8](../../sql_reference/functions/conditional_functions.md) или `NULL`. -- `then` - Возвращается результат выражения, если условие `cond` истинно. -- `else` - Возвращается результат выражения, если условие `cond` ложно. - -**Возвращаемые значения** - -Функция выполняет выражения `then` или `else` и возвращает его результат, в зависимости от того, было ли условие `cond` равно нулю или нет. - -**Пример** - -Запрос: - -``` sql -SELECT if(1, plus(2, 2), plus(2, 6)) -``` - -Ответ: - -``` text -┌─plus(2, 2)─┐ -│ 4 │ -└────────────┘ -``` - -Запрос: - -``` sql -SELECT if(0, plus(2, 2), plus(2, 6)) -``` - -Ответ: - -``` text -┌─plus(2, 6)─┐ -│ 8 │ -└────────────┘ -``` - -## Тернарный оператор {#ternary-operator} - -Работает так же, как функция `if`. - -Синтаксис: `cond ? then : else` - -Возвращает `then`, если `cond` верно (больше нуля), в остальных случаях возвращает `else`. - -- `cond` должно быть типа `UInt8`, `then` и `else` должны относиться к наименьшему общему типу. - -- `then` и `else` могут быть `NULL`. - -**Смотрите также** - -- [ifNotFinite](other_functions.md#ifnotfinite). - -## multiIf {#multiif} - -Позволяет более компактно записать оператор [CASE](../operators.md#operator_case) в запросе. - - multiIf(cond_1, then_1, cond_2, then_2...else) - -**Параметры** - -- `cond_N` — Условие, при выполнении которого функция вернёт `then_N`. -- `then_N` — Результат функции при выполнении. -- `else` — Результат функции, если ни одно из условий не выполнено. - -Функция принимает `2N+1` параметров. - -**Возвращаемые значения** - -Функция возвращает одно из значений `then_N` или `else`, в зависимости от условий `cond_N`. - -**Пример** - -Рассмотрим таблицу - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Выполним запрос `SELECT multiIf(isNull(y), x, y < 3, y, NULL) FROM t_null`. Результат: - -``` text -┌─multiIf(isNull(y), x, less(y, 3), y, NULL)─┐ -│ 1 │ -│ ᴺᵁᴸᴸ │ -└────────────────────────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/conditional_functions/) diff --git a/docs/ru/sql_reference/functions/date_time_functions.md b/docs/ru/sql_reference/functions/date_time_functions.md deleted file mode 100644 index 9f2f5b8afd2..00000000000 --- a/docs/ru/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,290 +0,0 @@ -# Функции для работы с датами и временем {#funktsii-dlia-raboty-s-datami-i-vremenem} - -Поддержка часовых поясов - -Все функции по работе с датой и временем, для которых это имеет смысл, могут принимать второй, необязательный аргумент - имя часового пояса. Пример: Asia/Yekaterinburg. В этом случае, они используют не локальный часовой пояс (по умолчанию), а указанный. - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - -``` text -┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ -└─────────────────────┴────────────┴────────────┴─────────────────────┘ -``` - -Поддерживаются только часовые пояса, отличающиеся от UTC на целое число часов. - -## toYear {#toyear} - -Переводит дату или дату-с-временем в число типа UInt16, содержащее номер года (AD). - -## toMonth {#tomonth} - -Переводит дату или дату-с-временем в число типа UInt8, содержащее номер месяца (1-12). - -## toDayOfMonth {#todayofmonth} - -Переводит дату или дату-с-временем в число типа UInt8, содержащее номер дня в месяце (1-31). - -## toDayOfWeek {#todayofweek} - -Переводит дату или дату-с-временем в число типа UInt8, содержащее номер дня в неделе (понедельник - 1, воскресенье - 7). - -## toHour {#tohour} - -Переводит дату-с-временем в число типа UInt8, содержащее номер часа в сутках (0-23). -Функция исходит из допущения, что перевод стрелок вперёд, если осуществляется, то на час, в два часа ночи, а перевод стрелок назад, если осуществляется, то на час, в три часа ночи (что, в общем, не верно - даже в Москве два раза перевод стрелок был осуществлён в другое время). - -## toMinute {#tominute} - -Переводит дату-с-временем в число типа UInt8, содержащее номер минуты в часе (0-59). - -## toSecond {#tosecond} - -Переводит дату-с-временем в число типа UInt8, содержащее номер секунды в минуте (0-59). -Секунды координации не учитываются. - -## toUnixTimestamp {#to-unix-timestamp} - -For DateTime argument: converts value to its internal numeric representation (Unix Timestamp). -For String argument: parse datetime from string according to the timezone (optional second argument, server timezone is used by default) and returns the corresponding unix timestamp. -For Date argument: the behaviour is unspecified. - -**Syntax** - -``` sql -toUnixTimestamp(datetime) -toUnixTimestamp(str, [timezone]) -``` - -**Returned value** - -- Returns the unix timestamp. - -Type: `UInt32`. - -**Example** - -Query: - -``` sql -SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp -``` - -Result: - -``` text -┌─unix_timestamp─┐ -│ 1509836867 │ -└────────────────┘ -``` - -## toStartOfYear {#tostartofyear} - -Округляет дату или дату-с-временем вниз до первого дня года. -Возвращается дата. - -## toStartOfQuarter {#tostartofquarter} - -Округляет дату или дату-с-временем вниз до первого дня квартала. -Первый день квартала - это одно из 1 января, 1 апреля, 1 июля, 1 октября. -Возвращается дата. - -## toStartOfMonth {#tostartofmonth} - -Округляет дату или дату-с-временем вниз до первого дня месяца. -Возвращается дата. - -!!! attention "Attention" - Возвращаемое значение для некорректных дат зависит от реализации. ClickHouse может вернуть нулевую дату, выбросить исключение, или выполнить «естественное» перетекание дат между месяцами. - -## toMonday {#tomonday} - -Округляет дату или дату-с-временем вниз до ближайшего понедельника. -Возвращается дата. - -## toStartOfDay {#tostartofday} - -Округляет дату-с-временем вниз до начала дня. Возвращается дата-с-временем. - -## toStartOfHour {#tostartofhour} - -Округляет дату-с-временем вниз до начала часа. - -## toStartOfMinute {#tostartofminute} - -Округляет дату-с-временем вниз до начала минуты. - -## toStartOfFiveMinute {#tostartoffiveminute} - -Округляет дату-с-временем вниз до начала пятиминутного интервала. - -## toStartOfTenMinutes {#tostartoftenminutes} - -Округляет дату-с-временем вниз до начала десятиминутного интервала. - -## toStartOfFifteenMinutes {#tostartoffifteenminutes} - -Округляет дату-с-временем вниз до начала пятнадцатиминутного интервала. - -## toStartOfInterval(time\_or\_data, INTERVAL x unit \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -Обобщение остальных функций `toStartOf*`. Например, -`toStartOfInterval(t, INTERVAL 1 year)` возвращает то же самое, что и `toStartOfYear(t)`, -`toStartOfInterval(t, INTERVAL 1 month)` возвращает то же самое, что и `toStartOfMonth(t)`, -`toStartOfInterval(t, INTERVAL 1 day)` возвращает то же самое, что и `toStartOfDay(t)`, -`toStartOfInterval(t, INTERVAL 15 minute)` возвращает то же самое, что и `toStartOfFifteenMinutes(t)`, и т.п. - -## toTime {#totime} - -Переводит дату-с-временем на некоторую фиксированную дату, сохраняя при этом время. - -## toRelativeYearNum {#torelativeyearnum} - -Переводит дату-с-временем или дату в номер года, начиная с некоторого фиксированного момента в прошлом. - -## toRelativeMonthNum {#torelativemonthnum} - -Переводит дату-с-временем или дату в номер месяца, начиная с некоторого фиксированного момента в прошлом. - -## toRelativeWeekNum {#torelativeweeknum} - -Переводит дату-с-временем или дату в номер недели, начиная с некоторого фиксированного момента в прошлом. - -## toRelativeDayNum {#torelativedaynum} - -Переводит дату-с-временем или дату в номер дня, начиная с некоторого фиксированного момента в прошлом. - -## toRelativeHourNum {#torelativehournum} - -Переводит дату-с-временем в номер часа, начиная с некоторого фиксированного момента в прошлом. - -## toRelativeMinuteNum {#torelativeminutenum} - -Переводит дату-с-временем в номер минуты, начиная с некоторого фиксированного момента в прошлом. - -## toRelativeSecondNum {#torelativesecondnum} - -Переводит дату-с-временем в номер секунды, начиная с некоторого фиксированного момента в прошлом. - -## now {#now} - -Принимает ноль аргументов и возвращает текущее время на один из моментов выполнения запроса. -Функция возвращает константу, даже если запрос выполнялся долго. - -## today {#today} - -Принимает ноль аргументов и возвращает текущую дату на один из моментов выполнения запроса. -То же самое, что toDate(now()) - -## yesterday {#yesterday} - -Принимает ноль аргументов и возвращает вчерашнюю дату на один из моментов выполнения запроса. -Делает то же самое, что today() - 1. - -## dateDiff {#datediff} - -Вычисляет разницу между двумя значениями дат с временем. - -**Синтаксис** - -``` sql -dateDiff('unit', startdate, enddate, [timezone]) -``` - -**Параметры** - -- `unit` — Единица измерения времени, в которой будет вычислена разница между `startdate` и `enddate`. [String](../syntax.md#syntax-string-literal). - - Поддерживаемые значения: - - | unit | - | ------ | - |second | - |minute | - |hour | - |day | - |week | - |month | - |quarter | - |year | - -- `startdate` — Первая дата. [Date](../../sql_reference/functions/date_time_functions.md) или [DateTime](../../sql_reference/functions/date_time_functions.md). - -- `enddate` — Вторая дата. [Date](../../sql_reference/functions/date_time_functions.md) или [DateTime](../../sql_reference/functions/date_time_functions.md). - -- `timezone` — Опциональный параметр. Если определен, применяется к обоим значениям: `startdate` и `enddate`. Если не определен, используются часовые пояса `startdate` и `enddate`. Если часовые пояса не совпадают, вернется неожидаемый результат. - -**Возвращаемое значение** - -Разница между `startdate` и `enddate`, выраженная в `unit`. - -Тип: `int`. - -**Пример** - -Запрос: - -``` sql -SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); -``` - -Ответ: - -``` text -┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ -│ 25 │ -└────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## timeSlot {#timeslot} - -Округляет время до получаса. -Эта функция является специфичной для Яндекс.Метрики, так как пол часа - минимальное время, для которого, если соседние по времени хиты одного посетителя на одном счётчике отстоят друг от друга строго более, чем на это время, визит может быть разбит на два визита. То есть, кортежи (номер счётчика, идентификатор посетителя, тайм-слот) могут использоваться для поиска хитов, входящий в соответствующий визит. - -## timeSlots(StartTime, Duration,\[, Size\]) {#timeslotsstarttime-duration-size} - -Для интервала времени, начинающегося в ‘StartTime’ и продолжающегося ‘Duration’ секунд, возвращает массив моментов времени, состоящий из округлений вниз до ‘Size’ точек в секундах из этого интервала. ‘Size’ - необязательный параметр, константный UInt32, по умолчанию равен 1800. - -Например, `timeSlots(toDateTime('2012-01-01 12:20:00'), toUInt32(600)) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. -Это нужно для поиска хитов, входящих в соответствующий визит. - -## formatDateTime(Time, Format\[, Timezone\]) {#formatdatetime} - -Функция преобразования даты-с-временем в String согласно заданному шаблону. Важно - шаблон является константным выражением, т.е. невозможно использование разных шаблонов в одной колонке. - -Поддерживаемые модификаторы в шаблоне Format: -(колонка «Пример» показана для времени `2018-01-02 22:33:44`) - -| Модификатор | Описание | Пример | -|-------------|----------------------------------------------------------------------|------------| -| %C | номер года, поделённый на 100 (00-99) | 20 | -| %d | день месяца, с ведущим нулём (01-31) | 02 | -| %D | короткая запись %m/%d/%y | 01/02/18 | -| %e | день месяца, с ведущим пробелом ( 1-31) | 2 | -| %F | короткая запись %Y-%m-%d | 2018-01-02 | -| %H | час в 24-часовом формате (00-23) | 22 | -| %I | час в 12-часовом формате (01-12) | 10 | -| %j | номер дня в году, с ведущими нулями (001-366) | 002 | -| %m | месяц, с ведущим нулём (01-12) | 01 | -| %M | минуты, с ведущим нулём (00-59) | 33 | -| %n | символ переноса строки (‘’) | | -| %p | обозначения AM или PM | PM | -| %R | короткая запись %H:%M | 22:33 | -| %S | секунды, с ведущими нулями (00-59) | 44 | -| %t | символ табуляции (’) | | -| %T | формат времени ISO 8601, одинаковый с %H:%M:%S | 22:33:44 | -| %u | номер дня недели согласно ISO 8601, понедельник - 1, воскресенье - 7 | 2 | -| %V | номер недели согласно ISO 8601 (01-53) | 01 | -| %w | номер дня недели, начиная с воскресенья (0-6) | 2 | -| %y | год, последние 2 цифры (00-99) | 18 | -| %Y | год, 4 цифры | 2018 | -| %% | символ % | % | - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/date_time_functions/) diff --git a/docs/ru/sql_reference/functions/encoding_functions.md b/docs/ru/sql_reference/functions/encoding_functions.md deleted file mode 100644 index b4c4716d9c7..00000000000 --- a/docs/ru/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,168 +0,0 @@ -# Функции кодирования {#funktsii-kodirovaniia} - -## char {#char} - -Возвращает строку, длина которой равна числу переданных аргументов, и каждый байт имеет значение соответствующего аргумента. Принимает несколько числовых аргументов. Если значение аргумента выходит за диапазон UInt8 (0..255), то оно преобразуется в UInt8 с возможным округлением и переполнением. - -**Синтаксис** - -``` sql -char(number_1, [number_2, ..., number_n]); -``` - -**Параметры** - -- `number_1, number_2, ..., number_n` — Числовые аргументы, которые интерпретируются как целые числа. Типы: [Int](../../sql_reference/functions/encoding_functions.md), [Float](../../sql_reference/functions/encoding_functions.md). - -**Возвращаемое значение** - -- строка из соответствующих байт. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello -``` - -Ответ: - -``` text -┌─hello─┐ -│ hello │ -└───────┘ -``` - -Вы можете создать строку в произвольной кодировке, передав соответствующие байты. Пример для UTF-8: - -Запрос: - -``` sql -SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; -``` - -Ответ: - -``` text -┌─hello──┐ -│ привет │ -└────────┘ -``` - -Запрос: - -``` sql -SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; -``` - -Ответ: - -``` text -┌─hello─┐ -│ 你好 │ -└───────┘ -``` - -## hex {#hex} - -Returns a string containing the argument’s hexadecimal representation. - -**Syntax** - -``` sql -hex(arg) -``` - -The function is using uppercase letters `A-F` and not using any prefixes (like `0x`) or suffixes (like `h`). - -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 leading digit is zero. - -Example: - -**Example** - -Query: - -``` sql -SELECT hex(1); -``` - -Result: - -``` text -01 -``` - -Values of type `Date` and `DateTime` are formatted as corresponding integers (the number of days since Epoch for Date and the value of Unix Timestamp for DateTime). - -For `String` and `FixedString`, all bytes are simply encoded as two hexadecimal numbers. Zero bytes are not omitted. - -Values of floating point and Decimal 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. - -**Parameters** - -- `arg` — A value to convert to hexadecimal. Types: [String](../../sql_reference/functions/encoding_functions.md), [UInt](../../sql_reference/functions/encoding_functions.md), [Float](../../sql_reference/functions/encoding_functions.md), [Decimal](../../sql_reference/functions/encoding_functions.md), [Date](../../sql_reference/functions/encoding_functions.md) or [DateTime](../../sql_reference/functions/encoding_functions.md). - -**Returned value** - -- A string with the hexadecimal representation of the argument. - -Type: `String`. - -**Example** - -Query: - -``` sql -SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); -``` - -Result: - -``` text -┌─hex_presentation─┐ -│ 00007041 │ -│ 00008041 │ -└──────────────────┘ -``` - -Query: - -``` sql -SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); -``` - -Result: - -``` text -┌─hex_presentation─┐ -│ 0000000000002E40 │ -│ 0000000000003040 │ -└──────────────────┘ -``` - -## unhex(str) {#unhexstr} - -Accepts a string containing any number of hexadecimal digits, and returns a string containing the corresponding bytes. 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). -If you want to convert the result to a number, you can use the ‘reverse’ and ‘reinterpretAsType’ functions. - -## UUIDStringToNum(str) {#uuidstringtonumstr} - -Принимает строку, содержащую 36 символов в формате `123e4567-e89b-12d3-a456-426655440000`, и возвращает в виде набора байт в FixedString(16). - -## UUIDNumToString(str) {#uuidnumtostringstr} - -Принимает значение типа FixedString(16). Возвращает строку из 36 символов в текстовом виде. - -## bitmaskToList(num) {#bitmasktolistnum} - -Принимает целое число. Возвращает строку, содержащую список степеней двойки, в сумме дающих исходное число; по возрастанию, в текстовом виде, через запятую, без пробелов. - -## bitmaskToArray(num) {#bitmasktoarraynum} - -Принимает целое число. Возвращает массив чисел типа UInt64, содержащий степени двойки, в сумме дающих исходное число; числа в массиве идут по возрастанию. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/encoding_functions/) diff --git a/docs/ru/sql_reference/functions/ext_dict_functions.md b/docs/ru/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index 1a1d383e4bb..00000000000 --- a/docs/ru/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,196 +0,0 @@ -# Функции для работы с внешними словарями {#ext_dict_functions} - -Информацию о подключении и настройке внешних словарей смотрите в разделе [Внешние словари](../../sql_reference/functions/ext_dict_functions.md). - -## dictGet {#dictget} - -Извлекает значение из внешнего словаря. - -``` sql -dictGet('dict_name', 'attr_name', id_expr) -dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Параметры** - -- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). -- `attr_name` — имя столбца словаря. [Строковый литерал](../syntax.md#syntax-string-literal). -- `id_expr` — значение ключа словаря. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql_reference/functions/ext_dict_functions.md) или [Tuple](../../sql_reference/functions/ext_dict_functions.md) в зависимости от конфигурации словаря. -- `default_value_expr` — значение, возвращаемое в том случае, когда словарь не содержит строки с заданным ключом `id_expr`. [Выражение](../syntax.md#syntax-expressions) возвращающее значение с типом данных, сконфигурированным для атрибута `attr_name`. - -**Возвращаемое значение** - -- Значение атрибута, соответствующее ключу `id_expr`, если ClickHouse смог привести это значение к [заданному типу данных](../../sql_reference/functions/ext_dict_functions.md#ext_dict_structure-attributes). - -- Если ключа, соответствующего `id_expr` в словаре нет, то: - - - `dictGet` возвращает содержимое элемента ``, указанного для атрибута в конфигурации словаря. - - `dictGetOrDefault` возвращает атрибут `default_value_expr`. - -Если значение атрибута не удалось обработать или оно не соответствует типу данных атрибута, то ClickHouse генерирует исключение. - -**Пример** - -Создадим текстовый файл `ext-dict-text.csv` со следующим содержимым: - -``` text -1,1 -2,2 -``` - -Первый столбец — `id`, второй столбец — `c1`. - -Настройка внешнего словаря: - -``` xml - - - ext-dict-test - - - /path-to/ext-dict-test.csv - CSV - - - - - - - - id - - - c1 - UInt32 - - - - 0 - - -``` - -Выполним запрос: - -``` sql -SELECT - dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, - toTypeName(val) AS type -FROM system.numbers -LIMIT 3 -``` - -``` text -┌─val─┬─type───┐ -│ 1 │ UInt32 │ -│ 2 │ UInt32 │ -│ 20 │ UInt32 │ -└─────┴────────┘ -``` - -**Смотрите также** - -- [Внешние словари](../../sql_reference/functions/ext_dict_functions.md) - -## dictHas {#dicthas} - -Проверяет, присутствует ли запись с указанным ключом в словаре. - -``` sql -dictHas('dict_name', id) -``` - -**Параметры** - -- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). -- `id_expr` — значение ключа словаря. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql_reference/functions/ext_dict_functions.md). - -**Возвращаемое значение** - -- 0, если ключа нет. -- 1, если ключ есть. - -Тип — `UInt8`. - -## dictGetHierarchy {#dictgethierarchy} - -Создаёт массив, содержащий цепочку предков для заданного ключа в [иерархическом словаре](../dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md). - -**Синтаксис** - -``` sql -dictGetHierarchy('dict_name', key) -``` - -**Параметры** - -- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). -- `key` — значение ключа. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql_reference/functions/ext_dict_functions.md). - -**Возвращаемое значение** - -- Цепочка предков заданного ключа. - -Type: [Array(UInt64)](../../sql_reference/functions/ext_dict_functions.md). - -## dictIsIn {#dictisin} - -Проверяет предка ключа по всей иерархической цепочке словаря. - -`dictIsIn ('dict_name', child_id_expr, ancestor_id_expr)` - -**Параметры** - -- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). -- `child_id_expr` — ключ для проверки. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql_reference/functions/ext_dict_functions.md). -- `ancestor_id_expr` — предполагаемый предок ключа `child_id_expr`. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql_reference/functions/ext_dict_functions.md). - -**Возвращаемое значение** - -- 0, если `child_id_expr` — не дочерний элемент `ancestor_id_expr`. -- 1, если `child_id_expr` — дочерний элемент `ancestor_id_expr` или если `child_id_expr` и есть `ancestor_id_expr`. - -Тип — `UInt8`. - -## Прочие функции {#ext_dict_functions-other} - -ClickHouse поддерживает специализированные функции, которые приводят значения атрибутов словаря к определённому типу данных независимо от конфигурации словаря. - -Функции: - -- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` -- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` -- `dictGetFloat32`, `dictGetFloat64` -- `dictGetDate` -- `dictGetDateTime` -- `dictGetUUID` -- `dictGetString` - -Все эти функции можно использовать с модификатором `OrDefault`. Например, `dictGetDateOrDefault`. - -Синтаксис: - -``` sql -dictGet[Type]('dict_name', 'attr_name', id_expr) -dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Параметры** - -- `dict_name` — имя словаря. [Строковый литерал](../syntax.md#syntax-string-literal). -- `attr_name` — имя столбца словаря. [Строковый литерал](../syntax.md#syntax-string-literal). -- `id_expr` — значение ключа словаря. [Выражение](../syntax.md#syntax-expressions), возвращающее значение типа [UInt64](../../sql_reference/functions/ext_dict_functions.md). -- `default_value_expr` — значение, возвращаемое в том случае, когда словарь не содержит строки с заданным ключом `id_expr`. [Выражение](../syntax.md#syntax-expressions) возвращающее значение с типом данных, сконфигурированным для атрибута `attr_name`. - -**Возвращаемое значение** - -- Если ClickHouse успешно обработал атрибут в соответствии с [заданным типом данных](../../sql_reference/functions/ext_dict_functions.md#ext_dict_structure-attributes), то функции возвращают значение атрибута, соответствующее ключу `id_expr`. - -- Если запрошенного `id_expr` нет в словаре, то: - - - `dictGet[Type]` возвращает содержимое элемента ``, указанного для атрибута в конфигурации словаря. - - `dictGet[Type]OrDefault` возвращает аргумент `default_value_expr`. - -Если значение атрибута не удалось обработать или оно не соответствует типу данных атрибута, то ClickHouse генерирует исключение. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/ext_dict_functions/) diff --git a/docs/ru/sql_reference/functions/functions_for_nulls.md b/docs/ru/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 0d07cbeb62d..00000000000 --- a/docs/ru/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,305 +0,0 @@ -# Функции для работы с Nullable-аргументами {#funktsii-dlia-raboty-s-nullable-argumentami} - -## isNull {#isnull} - -Проверяет является ли аргумент [NULL](../syntax.md#null). - -``` sql -isNull(x) -``` - -**Параметры** - -- `x` — значение с не составным типом данных. - -**Возвращаемое значение** - -- `1`, если `x` — `NULL`. -- `0`, если `x` — не `NULL`. - -**Пример** - -Входная таблица - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Запрос - -``` sql -SELECT x FROM t_null WHERE isNull(y) -``` - -``` text -┌─x─┐ -│ 1 │ -└───┘ -``` - -## isNotNull {#isnotnull} - -Проверяет не является ли аргумент [NULL](../syntax.md#null). - -``` sql -isNotNull(x) -``` - -**Параметры** - -- `x` — значение с не составным типом данных. - -**Возвращаемое значение** - -- `0`, если `x` — `NULL`. -- `1`, если `x` — не `NULL`. - -**Пример** - -Входная таблица - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Запрос - -``` sql -SELECT x FROM t_null WHERE isNotNull(y) -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## coalesce {#coalesce} - -Последовательно слева-направо проверяет являются ли переданные аргументы `NULL` и возвращает первый не `NULL`. - -``` sql -coalesce(x,...) -``` - -**Параметры** - -- Произвольное количество параметров не составного типа. Все параметры должны быть совместимы по типу данных. - -**Возвращаемые значения** - -- Первый не `NULL` аргумент. -- `NULL`, если все аргументы — `NULL`. - -**Пример** - -Рассмотрим адресную книгу, в которой может быть указано несколько способов связи с клиентом. - -``` text -┌─name─────┬─mail─┬─phone─────┬──icq─┐ -│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ -│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└──────────┴──────┴───────────┴──────┘ -``` - -Поля `mail` и `phone` имеют тип String, а поле `icq` — `UInt32`, его необходимо будет преобразовать в `String`. - -Получим из адресной книги первый доступный способ связаться с клиентом: - -``` sql -SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook -``` - -``` text -┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ -│ client 1 │ 123-45-67 │ -│ client 2 │ ᴺᵁᴸᴸ │ -└──────────┴──────────────────────────────────────────────────────┘ -``` - -## ifNull {#ifnull} - -Возвращает альтернативное значение, если основной аргумент — `NULL`. - -``` sql -ifNull(x,alt) -``` - -**Параметры** - -- `x` — значение для проверки на `NULL`, -- `alt` — значение, которое функция вернёт, если `x` — `NULL`. - -**Возвращаемые значения** - -- Значение `x`, если `x` — не `NULL`. -- Значение `alt`, если `x` — `NULL`. - -**Пример** - -``` sql -SELECT ifNull('a', 'b') -``` - -``` text -┌─ifNull('a', 'b')─┐ -│ a │ -└──────────────────┘ -``` - -``` sql -SELECT ifNull(NULL, 'b') -``` - -``` text -┌─ifNull(NULL, 'b')─┐ -│ b │ -└───────────────────┘ -``` - -## nullIf {#nullif} - -Возвращает `NULL`, если аргументы равны. - -``` sql -nullIf(x, y) -``` - -**Параметры** - -`x`, `y` — значения для сравнивания. Они должны быть совместимых типов, иначе ClickHouse сгенерирует исключение. - -**Возвращаемые значения** - -- `NULL`, если аргументы равны. -- Значение `x`, если аргументы не равны. - -**Пример** - -``` sql -SELECT nullIf(1, 1) -``` - -``` text -┌─nullIf(1, 1)─┐ -│ ᴺᵁᴸᴸ │ -└──────────────┘ -``` - -``` sql -SELECT nullIf(1, 2) -``` - -``` text -┌─nullIf(1, 2)─┐ -│ 1 │ -└──────────────┘ -``` - -## assumeNotNull {#assumenotnull} - -Приводит значение типа [Nullable](../../sql_reference/functions/functions_for_nulls.md) к не `Nullable`, если значение не `NULL`. - -``` sql -assumeNotNull(x) -``` - -**Параметры** - -- `x` — исходное значение. - -**Возвращаемые значения** - -- Исходное значение с не `Nullable` типом, если оно — не `NULL`. -- Значение по умолчанию для не `Nullable` типа, если исходное значение — `NULL`. - -**Пример** - -Рассмотрим таблицу `t_null`. - -``` sql -SHOW CREATE TABLE t_null -``` - -``` text -┌─statement─────────────────────────────────────────────────────────────────┐ -│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ -└───────────────────────────────────────────────────────────────────────────┘ -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Применим функцию `assumeNotNull` к столбцу `y`. - -``` sql -SELECT assumeNotNull(y) FROM t_null -``` - -``` text -┌─assumeNotNull(y)─┐ -│ 0 │ -│ 3 │ -└──────────────────┘ -``` - -``` sql -SELECT toTypeName(assumeNotNull(y)) FROM t_null -``` - -``` text -┌─toTypeName(assumeNotNull(y))─┐ -│ Int8 │ -│ Int8 │ -└──────────────────────────────┘ -``` - -## toNullable {#tonullable} - -Преобразует тип аргумента к `Nullable`. - -``` sql -toNullable(x) -``` - -**Параметры** - -- `x` — значение произвольного не составного типа. - -**Возвращаемое значение** - -- Входное значение с типом не `Nullable`. - -**Пример** - -``` sql -SELECT toTypeName(10) -``` - -``` text -┌─toTypeName(10)─┐ -│ UInt8 │ -└────────────────┘ -``` - -``` sql -SELECT toTypeName(toNullable(10)) -``` - -``` text -┌─toTypeName(toNullable(10))─┐ -│ Nullable(UInt8) │ -└────────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/functions_for_nulls/) diff --git a/docs/ru/sql_reference/functions/geo.md b/docs/ru/sql_reference/functions/geo.md deleted file mode 100644 index db51ac05166..00000000000 --- a/docs/ru/sql_reference/functions/geo.md +++ /dev/null @@ -1,385 +0,0 @@ -# Функции для работы с географическими координатами {#funktsii-dlia-raboty-s-geograficheskimi-koordinatami} - -## greatCircleDistance {#greatcircledistance} - -Вычисляет расстояние между двумя точками на поверхности Земли по [формуле большого круга](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**Входные параметры** - -- `lon1Deg` — долгота первой точки в градусах. Диапазон — `[-180°, 180°]`. -- `lat1Deg` — широта первой точки в градусах. Диапазон — `[-90°, 90°]`. -- `lon2Deg` — долгота второй точки в градусах. Диапазон — `[-180°, 180°]`. -- `lat2Deg` — широта второй точки в градусах. Диапазон — `[-90°, 90°]`. - -Положительные значения соответствуют северной широте и восточной долготе, отрицательные — южной широте и западной долготе. - -**Возвращаемое значение** - -Расстояние между двумя точками на поверхности Земли в метрах. - -Генерирует исключение, когда значения входных параметров выходят за границы диапазонов. - -**Пример** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## greatCircleAngle {#greatcircleangle} - -Вычисляет угловое расстояние на сфере по [формуле большого круга](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**Входные параметры** - -- `lon1Deg` — долгота первой точки в градусах. -- `lat1Deg` — широта первой точки в градусах. -- `lon2Deg` — долгота второй точки в градусах. -- `lat2Deg` — широта второй точки в градусах. - -**Возвращаемое значение** - -Длина дуги большого круга между двумя точками в градусах. - -**Пример** - -``` sql -SELECT greatCircleAngle(0, 0, 45, 0) AS arc -``` - -``` text -┌─arc─┐ -│ 45 │ -└─────┘ -``` - -## pointInEllipses {#pointinellipses} - -Проверяет, принадлежит ли точка хотя бы одному из эллипсов. -Координаты — геометрические в декартовой системе координат. - - pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) - -**Входные параметры** - -- `x, y` — координаты точки на плоскости. -- `xᵢ, yᵢ` — координаты центра `i`-го эллипса. -- `aᵢ, bᵢ` — полуоси `i`-го эллипса (в единицах измерения координат x,y). - -Входных параметров должно быть `2+4⋅n`, где `n` — количество эллипсов. - -**Возвращаемые значения** - -`1`, если точка внутри хотя бы одного из эллипсов, `0`, если нет. - -**Пример** - -``` sql -SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) -``` - -``` text -┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ -│ 1 │ -└─────────────────────────────────────────────────┘ -``` - -## pointInPolygon {#pointinpolygon} - -Проверяет, принадлежит ли точка многоугольнику на плоскости. - -``` sql -pointInPolygon((x, y), [(a, b), (c, d) ...], ...) -``` - -**Входные значения** - -- `(x, y)` — координаты точки на плоскости. Тип данных — [Tuple](../../sql_reference/functions/geo.md) — кортеж из двух чисел. -- `[(a, b), (c, d) ...]` — вершины многоугольника. Тип данных — [Array](../../sql_reference/functions/geo.md). Каждая вершина представлена парой координат `(a, b)`. Вершины следует указывать в порядке обхода по или против часовой стрелки. Минимальное количество вершин — 3. Многоугольник должен быть константным. -- функция поддерживает также многоугольники с дырками (вырезанными кусками). Для этого случая, добавьте многоугольники, описывающие вырезанные куски, дополнительными аргументами функции. Функция не поддерживает не односвязные многоугольники. - -**Возвращаемые значения** - -`1`, если точка внутри многоугольника, `0`, если нет. -Если точка находится на границе многоугольника, функция может возвращать как 0, так и 1. - -**Пример** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## geohashEncode {#geohashencode} - -Кодирует широту и долготу в строку geohash, смотрите http://geohash.org/, https://en.wikipedia.org/wiki/Geohash. - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**Входные значения** - -- longitude — долгота. Диапазон — `[-180°, 180°].` -- latitude — широта. Диапазон — `[-90°, 90°].` -- precision — длина результирующей строки, по умолчанию `12`. Опционально. Целое число в диапазоне `[1, 12]`. Любое значение меньше, чем `1` или больше `12` автоматически преобразуются в `12`. - -**Возвращаемые значения** - -- Строка с координатой, закодированной модифицированной версией алфавита base32. - -**Пример** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## geohashDecode {#geohashdecode} - -Декодирует любую строку, закодированную в geohash, на долготу и широту. - -``` sql -geohashDecode(geohash_string) -``` - -**Входные значения** - -- `geohash_string` — строка, содержащая geohash. - -**Возвращаемые значения** - -- `(longitude, latitude)` — широта и долгота. Кортеж из двух значений типа `Float64`. - -**Пример** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## h3IsValid {#h3isvalid} - -Проверяет корректность H3-индекса. - -``` sql -h3IsValid(h3index) -``` - -**Входные значения** - -- `h3index` — идентификатор шестиугольника. Тип данных — [UInt64](../../sql_reference/functions/geo.md). - -**Возвращаемые значения** - -- 0 — число не является H3-индексом -- 1 — число является H3-индексом - -Тип — [UInt8](../../sql_reference/functions/geo.md). - -**Пример** - -``` sql -SELECT h3IsValid(630814730351855103) as h3IsValid -``` - -``` text -┌─h3IsValid─┐ -│ 1 │ -└───────────┘ -``` - -## h3GetResolution {#h3getresolution} - -Извлекает разрешение H3-индекса. - -``` sql -h3GetResolution(h3index) -``` - -**Входные значения** - -- `h3index` — идентификатор шестиугольника. Тип данных — [UInt64](../../sql_reference/functions/geo.md). - -**Возвращаемые значения** - -- Разрешение сетки, от 0 до 15. -- Для несуществующего идентификатора может быть возвращено произвольное значение, используйте [h3IsValid](#h3isvalid) для проверки идентификаторов - -Тип — [UInt8](../../sql_reference/functions/geo.md). - -**Пример** - -``` sql -SELECT h3GetResolution(639821929606596015) as resolution -``` - -``` text -┌─resolution─┐ -│ 14 │ -└────────────┘ -``` - -## h3EdgeAngle {#h3edgeangle} - -Информирует о среднем размере стороны шестигранника H3 в градусах - -``` sql -h3EdgeAngle(resolution) -``` - -**Входные значения** - -- `resolution` — требуемое разрешение индекса. Тип данных — [UInt8](../../sql_reference/functions/geo.md). Диапазон возможных значений — `[0, 15]`. - -**Возвращаемые значения** - -Средняя длина стороны многоугольника H3 в градусах, тип — [Float64](../../sql_reference/functions/geo.md). - -**Пример** - -``` sql -SELECT h3EdgeAngle(10) as edgeAngle -``` - -``` text -┌─────────h3EdgeAngle(10)─┐ -│ 0.0005927224846720883 │ -└───────────────────────┘ -``` - -## h3EdgeLengthM {#h3edgelengthm} - -Информирует о среднем размере стороны шестигранника H3 в метрах - -``` sql -h3EdgeLengthM(resolution) -``` - -**Входные значения** - -- `resolution` — требуемое разрешение индекса. Тип данных — [UInt8](../../sql_reference/functions/geo.md). Диапазон возможных значений — `[0, 15]`. - -**Возвращаемые значения** - -Средняя длина стороны многоугольника H3 в метрах, тип — [Float64](../../sql_reference/functions/geo.md). - -**Пример** - -``` sql -SELECT h3EdgeLengthM(15) as edgeLengthM -``` - -``` text -┌─edgeLengthM─┐ -│ 0.509713273 │ -└─────────────┘ -``` - -## geoToH3 {#geotoh3} - -Возвращает H3 индекс точки `(lon, lat)` с заданным разрешением. - -[H3](https://uber.github.io/h3/#/documentation/overview/introduction) - это географическая система индексации, в которой поверхность Земли разделена на ровные шестиугольные плитки. Эта система иерархична, то есть каждый шестиугольник на верхнем уровне может быть разбит на семь еще более мелких и так далее. - -H3 индекс используется в основном для определения местоположения с помощью карт и других геопространственных манипуляций. - -**Синтаксис** - -``` sql -geoToH3(lon, lat, resolution) -``` - -**Параметры** - -- `lon` — географическая долгота. Тип данных — [Float64](../../sql_reference/functions/geo.md). -- `lat` — географическая широта. Тип данных — [Float64](../../sql_reference/functions/geo.md). -- `resolution` — требуемое разрешение индекса. Тип данных — [UInt8](../../sql_reference/functions/geo.md). Диапазон возможных значений — `[0, 15]`. - -**Возвращаемые значения** - -- Порядковый номер шестиугольника. -- 0 в случае ошибки. - -Тип — [UInt64](../../sql_reference/functions/geo.md). - -**Пример** - -Запрос: - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -Ответ: - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## h3kRing {#h3kring} - -Возвращает H3-индексы шестиугольников в радиусе `k` от данного в произвольном порядке - -``` sql -h3kRing(h3index, k) -``` - -**Входные значения** - -- `h3index` — идентификатор шестиугольника. Тип данных — [UInt64](../../sql_reference/functions/geo.md). -- `k` — радиус. Тип данных — [целое число](../../sql_reference/functions/geo.md) - -**Возвращаемые значения** - -[Массив](../../sql_reference/functions/geo.md) из H3-индексов типа [UInt64](../../sql_reference/functions/geo.md). - -**Пример** - -``` sql -SELECT arrayJoin(h3kRing(644325529233966508, 1)) AS h3index -``` - -``` text -┌────────────h3index─┐ -│ 644325529233966508 │ -│ 644325529233966497 │ -│ 644325529233966510 │ -│ 644325529233966504 │ -│ 644325529233966509 │ -│ 644325529233966355 │ -│ 644325529233966354 │ -└────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/geo/) diff --git a/docs/ru/sql_reference/functions/hash_functions.md b/docs/ru/sql_reference/functions/hash_functions.md deleted file mode 100644 index 9dcd67ba35f..00000000000 --- a/docs/ru/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,479 +0,0 @@ -# Функции хэширования {#funktsii-kheshirovaniia} - -Функции хэширования могут использоваться для детерминированного псевдослучайного разбрасывания элементов. - -## halfMD5 {#hash-functions-halfmd5} - -[Интерпретирует](../../sql_reference/functions/hash_functions.md#type_conversion_functions-reinterpretAsString) все входные параметры как строки и вычисляет хэш [MD5](https://ru.wikipedia.org/wiki/MD5) для каждой из них. Затем объединяет хэши, берет первые 8 байт хэша результирующей строки и интерпретирует их как значение типа `UInt64` с big-endian порядком байтов. - -``` sql -halfMD5(par1, ...) -``` - -Функция относительно медленная (5 миллионов коротких строк в секунду на ядро процессора). -По возможности, используйте функцию [sipHash64](#hash_functions-siphash64) вместо неё. - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -Значение хэша с типом данных [UInt64](../../sql_reference/functions/hash_functions.md). - -**Пример** - -``` sql -SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type -``` - -``` text -┌────────halfMD5hash─┬─type───┐ -│ 186182704141653334 │ UInt64 │ -└────────────────────┴────────┘ -``` - -## MD5 {#hash_functions-md5} - -Вычисляет MD5 от строки и возвращает полученный набор байт в виде FixedString(16). -Если вам не нужен конкретно MD5, а нужен неплохой криптографический 128-битный хэш, то используйте вместо этого функцию sipHash128. -Если вы хотите получить такой же результат, как выдаёт утилита md5sum, напишите lower(hex(MD5(s))). - -## sipHash64 {#hash_functions-siphash64} - -Генерирует 64-х битное значение [SipHash](https://131002.net/siphash/). - -``` sql -sipHash64(par1,...) -``` - -Это криптографическая хэш-функция. Она работает по крайней мере в три раза быстрее, чем функция [MD5](#hash_functions-md5). - -Функция [интерпретирует](../../sql_reference/functions/hash_functions.md#type_conversion_functions-reinterpretAsString) все входные параметры как строки и вычисляет хэш MD5 для каждой из них. Затем комбинирует хэши по следующему алгоритму. - -1. После хэширования всех входных параметров функция получает массив хэшей. -2. Функция принимает первый и второй элементы и вычисляет хэш для массива из них. -3. Затем функция принимает хэш-значение, вычисленное на предыдущем шаге, и третий элемент исходного хэш-массива, и вычисляет хэш для массива из них. -4. Предыдущий шаг повторяется для всех остальных элементов исходного хэш-массива. - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -Значение хэша с типом данных [UInt64](../../sql_reference/functions/hash_functions.md). - -**Пример** - -``` sql -SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type -``` - -``` text -┌──────────────SipHash─┬─type───┐ -│ 13726873534472839665 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## sipHash128 {#hash_functions-siphash128} - -Вычисляет SipHash от строки. -Принимает аргумент типа String. Возвращает FixedString(16). -Отличается от sipHash64 тем, что финальный xor-folding состояния делается только до 128 бит. - -## cityHash64 {#cityhash64} - -Генерирует 64-х битное значение [CityHash](https://github.com/google/cityhash). - -``` sql -cityHash64(par1,...) -``` - -Это не криптографическая хэш-функция. Она использует CityHash алгоритм для строковых параметров и зависящую от реализации быструю некриптографическую хэш-функцию для параметров с другими типами данных. Функция использует комбинатор CityHash для получения конечных результатов. - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -Значение хэша с типом данных [UInt64](../../sql_reference/functions/hash_functions.md). - -**Примеры** - -Пример вызова: - -``` sql -SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type -``` - -``` text -┌─────────────CityHash─┬─type───┐ -│ 12072650598913549138 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -А вот так вы можете вычислить чексумму всей таблицы с точностью до порядка строк: - -``` sql -SELECT groupBitXor(cityHash64(*)) FROM table -``` - -## intHash32 {#inthash32} - -Вычисляет 32-битный хэш-код от целого числа любого типа. -Это сравнительно быстрая не криптографическая хэш-функция среднего качества для чисел. - -## intHash64 {#inthash64} - -Вычисляет 64-битный хэш-код от целого числа любого типа. -Работает быстрее, чем intHash32. Качество среднее. - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -Вычисляет SHA-1, SHA-224, SHA-256 от строки и возвращает полученный набор байт в виде FixedString(20), FixedString(28), FixedString(32). -Функция работает достаточно медленно (SHA-1 - примерно 5 миллионов коротких строк в секунду на одном процессорном ядре, SHA-224 и SHA-256 - примерно 2.2 миллионов). -Рекомендуется использовать эти функции лишь в тех случаях, когда вам нужна конкретная хэш-функция и вы не можете её выбрать. -Даже в этих случаях, рекомендуется применять функцию оффлайн - заранее вычисляя значения при вставке в таблицу, вместо того, чтобы применять её при SELECT-ах. - -## URLHash(url\[, N\]) {#urlhashurl-n} - -Быстрая не криптографическая хэш-функция неплохого качества для строки, полученной из URL путём некоторой нормализации. -`URLHash(s)` - вычислить хэш от строки без одного завершающего символа `/`, `?` или `#` на конце, если там такой есть. -`URLHash(s, N)` - вычислить хэш от строки до N-го уровня в иерархии URL, без одного завершающего символа `/`, `?` или `#` на конце, если там такой есть. -Уровни аналогичные URLHierarchy. Функция специфична для Яндекс.Метрики. - -## farmHash64 {#farmhash64} - -Генерирует 64-х битное значение [FarmHash](https://github.com/google/farmhash). - -``` sql -farmHash64(par1, ...) -``` - -Из всех [доступных методов](https://github.com/google/farmhash/blob/master/src/farmhash.h) функция использует `Hash64`. - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -Значение хэша с типом данных [UInt64](../../sql_reference/functions/hash_functions.md). - -**Пример** - -``` sql -SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type -``` - -``` text -┌─────────────FarmHash─┬─type───┐ -│ 17790458267262532859 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## javaHash {#hash_functions-javahash} - -Вычисляет [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) от строки. `JavaHash` не отличается ни скоростью, ни качеством, поэтому эту функцию следует считать устаревшей. Используйте эту функцию, если вам необходимо получить значение хэша по такому же алгоритму. - -``` sql -SELECT javaHash(''); -``` - -**Возвращаемое значение** - -Хэш-значение типа `Int32`. - -Тип: `javaHash`. - -**Пример** - -Запрос: - -``` sql -SELECT javaHash('Hello, world!'); -``` - -Ответ: - -``` text -┌─javaHash('Hello, world!')─┐ -│ -1880044555 │ -└───────────────────────────┘ -``` - -## javaHashUTF16LE {#javahashutf16le} - -Вычисляет [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) от строки, при допущении, что строка представлена в кодировке `UTF-16LE`. - -**Синтаксис** - -``` sql -javaHashUTF16LE(stringUtf16le) -``` - -**Параметры** - -- `stringUtf16le` — строка в `UTF-16LE`. - -**Возвращаемое значение** - -Хэш-значение типа `Int32`. - -Тип: `javaHash`. - -**Пример** - -Верный запрос для строки кодированной в `UTF-16LE`. - -Запрос: - -``` sql -SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) -``` - -Ответ: - -``` text -┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ -│ 3556498 │ -└──────────────────────────────────────────────────────────────┘ -``` - -## hiveHash {#hash-functions-hivehash} - -Вычисляет `HiveHash` от строки. - -``` sql -SELECT hiveHash(''); -``` - -`HiveHash` — это результат [JavaHash](#hash_functions-javahash) с обнулённым битом знака числа. Функция используется в [Apache Hive](https://en.wikipedia.org/wiki/Apache_Hive) вплоть до версии 3.0. - -**Возвращаемое значение** - -Хэш-значение типа `Int32`. - -Тип: `hiveHash`. - -**Пример** - -Запрос: - -``` sql -SELECT hiveHash('Hello, world!'); -``` - -Ответ: - -``` text -┌─hiveHash('Hello, world!')─┐ -│ 267439093 │ -└───────────────────────────┘ -``` - -## metroHash64 {#metrohash64} - -Генерирует 64-х битное значение [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/). - -``` sql -metroHash64(par1, ...) -``` - -**Параметры** - -Функция принимает переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -Значение хэша с типом данных [UInt64](../../sql_reference/functions/hash_functions.md). - -**Пример** - -``` sql -SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type -``` - -``` text -┌────────────MetroHash─┬─type───┐ -│ 14235658766382344533 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## jumpConsistentHash {#jumpconsistenthash} - -Вычисляет JumpConsistentHash от значения типа UInt64. -Имеет два параметра: ключ типа UInt64 и количество бакетов. Возвращает значение типа Int32. -Дополнительные сведения смотрите по ссылке: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) - -## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} - -Генерирует значение [MurmurHash2](https://github.com/aappleby/smhasher). - -``` sql -murmurHash2_32(par1, ...) -murmurHash2_64(par1, ...) -``` - -**Параметры** - -Обе функции принимают переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -- Функция `murmurHash2_32` возвращает значение типа [UInt32](../../sql_reference/functions/hash_functions.md). -- Функция `murmurHash2_64` возвращает значение типа [UInt64](../../sql_reference/functions/hash_functions.md). - -**Пример** - -``` sql -SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type -``` - -``` text -┌──────────MurmurHash2─┬─type───┐ -│ 11832096901709403633 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## gccMurmurHash {#gccmurmurhash} - -Вычисляет 64-битное значение [MurmurHash2](https://github.com/aappleby/smhasher), используя те же hash seed, что и [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191). - -**Синтаксис** - -```sql -gccMurmurHash(par1, ...); -``` - -**Параметры** - -- `par1, ...` — Переменное число параметров. Каждый параметр может быть любого из [поддерживаемых типов данных](../../sql_reference/data_types/index.md). - -**Возвращаемое значение** - -- Вычисленный хэш-код. - -Тип: [UInt64](../../sql_reference/data_types/int_uint.md). - -**Примеры** - -Запрос: - -```sql -SELECT - gccMurmurHash(1, 2, 3) AS res1, - gccMurmurHash(('a', [1, 2, 3], 4, (4, ['foo', 'bar'], 1, (1, 2)))) AS res2 -``` - -Результат: - -``` text -┌─────────────────res1─┬────────────────res2─┐ -│ 12384823029245979431 │ 1188926775431157506 │ -└──────────────────────┴─────────────────────┘ -``` - -## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} - -Генерирует значение [MurmurHash3](https://github.com/aappleby/smhasher). - -``` sql -murmurHash3_32(par1, ...) -murmurHash3_64(par1, ...) -``` - -**Параметры** - -Обе функции принимают переменное число входных параметров. Параметры могут быть любого [поддерживаемого типа данных](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -- Функция `murmurHash3_32` возвращает значение типа [UInt32](../../sql_reference/functions/hash_functions.md). -- Функция `murmurHash3_64` возвращает значение типа [UInt64](../../sql_reference/functions/hash_functions.md). - -**Пример** - -``` sql -SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3─┬─type───┐ -│ 2152717 │ UInt32 │ -└─────────────┴────────┘ -``` - -## murmurHash3\_128 {#murmurhash3-128} - -Генерирует значение [MurmurHash3](https://github.com/aappleby/smhasher). - -``` sql -murmurHash3_128( expr ) -``` - -**Параметры** - -- `expr` — [выражение](../syntax.md#syntax-expressions) возвращающее значение типа[String](../../sql_reference/functions/hash_functions.md). - -**Возвращаемое значение** - -Хэш-значение типа [FixedString(16)](../../sql_reference/functions/hash_functions.md). - -**Пример** - -``` sql -SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3──────┬─type────────────┐ -│ 6�1�4"S5KT�~~q │ FixedString(16) │ -└──────────────────┴─────────────────┘ -``` - -## xxHash32, xxHash64 {#hash-functions-xxhash32-xxhash64} - -Вычисляет `xxHash` от строки. Предлагается в двух вариантах: 32 и 64 бита. - -``` sql -SELECT xxHash32(''); - -OR - -SELECT xxHash64(''); -``` - -**Возвращаемое значение** - -Хэш-значение типа `Uint32` или `Uint64`. - -Тип: `xxHash`. - -**Пример** - -Запрос: - -``` sql -SELECT xxHash32('Hello, world!'); -``` - -Ответ: - -``` text -┌─xxHash32('Hello, world!')─┐ -│ 834093149 │ -└───────────────────────────┘ -``` - -**Смотрите также** - -- [xxHash](http://cyan4973.github.io/xxHash/). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/hash_functions/) diff --git a/docs/ru/sql_reference/functions/higher_order_functions.md b/docs/ru/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index d6eb09f4353..00000000000 --- a/docs/ru/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,167 +0,0 @@ -# Функции высшего порядка {#higher-order-functions} - -## Оператор `->`, функция lambda(params, expr) {#operator-funktsiia-lambdaparams-expr} - -Позволяет описать лямбда-функцию для передачи в функцию высшего порядка. Слева от стрелочки стоит формальный параметр - произвольный идентификатор, или несколько формальных параметров - произвольные идентификаторы в кортеже. Справа от стрелочки стоит выражение, в котором могут использоваться эти формальные параметры, а также любые столбцы таблицы. - -Примеры: `x -> 2 * x, str -> str != Referer.` - -Функции высшего порядка, в качестве своего функционального аргумента могут принимать только лямбда-функции. - -В функции высшего порядка может быть передана лямбда-функция, принимающая несколько аргументов. В этом случае, в функцию высшего порядка передаётся несколько массивов одинаковых длин, которым эти аргументы будут соответствовать. - -Для некоторых функций, например [arrayCount](#higher_order_functions-array-count) или [arraySum](#higher_order_functions-array-sum), первый аргумент (лямбда-функция) может отсутствовать. В этом случае, подразумевается тождественное отображение. - -Для функций, перечисленных ниже, лямбда-функцию должна быть указана всегда: - -- [arrayMap](#higher_order_functions-array-map) -- [arrayFilter](#higher_order_functions-array-filter) -- [arrayFirst](#higher_order_functions-array-first) -- [arrayFirstIndex](#higher_order_functions-array-first-index) - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -Вернуть массив, полученный на основе результатов применения функции `func` к каждому элементу массива `arr`. - -Примеры: - -``` sql -SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,4,5] │ -└─────────┘ -``` - -Следующий пример показывает, как создать кортежи из элементов разных массивов: - -``` sql -SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res -``` - -``` text -┌─res─────────────────┐ -│ [(1,4),(2,5),(3,6)] │ -└─────────────────────┘ -``` - -Обратите внимание, что у функции `arrayMap` первый аргумент (лямбда-функция) не может быть опущен. - -### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} - -Вернуть массив, содержащий только те элементы массива `arr1`, для которых функция `func` возвращает не 0. - -Примеры: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - -``` text -┌─res───────────┐ -│ ['abc World'] │ -└───────────────┘ -``` - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - -``` text -┌─res─┐ -│ [2] │ -└─────┘ -``` - -Обратите внимание, что у функции `arrayFilter` первый аргумент (лямбда-функция) не может быть опущен. - -### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} - -Вернуть количество элементов массива `arr`, для которых функция func возвращает не 0. Если func не указана - вернуть количество ненулевых элементов массива. - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -Вернуть 1, если существует хотя бы один элемент массива `arr`, для которого функция func возвращает не 0. Иначе вернуть 0. - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -Вернуть 1, если для всех элементов массива `arr`, функция `func` возвращает не 0. Иначе вернуть 0. - -### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} - -Вернуть сумму значений функции `func`. Если функция не указана - просто вернуть сумму элементов массива. - -### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} - -Вернуть первый элемент массива `arr1`, для которого функция func возвращает не 0. - -Обратите внимание, что у функции `arrayFirst` первый аргумент (лямбда-функция) не может быть опущен. - -### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} - -Вернуть индекс первого элемента массива `arr1`, для которого функция func возвращает не 0. - -Обратите внимание, что у функции `arrayFirstFilter` первый аргумент (лямбда-функция) не может быть опущен. - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -Возвращает массив из частичных сумм элементов исходного массива (сумма с накоплением). Если указана функция `func`, то значения элементов массива преобразуются этой функцией перед суммированием. - -Пример: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - -``` text -┌─res──────────┐ -│ [1, 2, 3, 4] │ -└──────────────┘ -``` - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -Возвращает отсортированный в восходящем порядке массив `arr1`. Если задана функция `func`, то порядок сортировки определяется результатом применения функции `func` на элементы массива (массивов). - -Для улучшения эффективности сортировки применяется [Преобразование Шварца](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). - -Пример: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Подробная информация о методе `arraySort` приведена в разделе [Функции по работе с массивами](array_functions.md#array_functions-sort). - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -Возвращает отсортированный в нисходящем порядке массив `arr1`. Если задана функция `func`, то порядок сортировки определяется результатом применения функции `func` на элементы массива (массивов). - -Пример: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -Подробная информация о методе `arrayReverseSort` приведена в разделе [Функции по работе с массивами](array_functions.md#array_functions-reverse-sort). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/higher_order_functions/) diff --git a/docs/ru/sql_reference/functions/in_functions.md b/docs/ru/sql_reference/functions/in_functions.md deleted file mode 100644 index a5cdb1dc217..00000000000 --- a/docs/ru/sql_reference/functions/in_functions.md +++ /dev/null @@ -1,19 +0,0 @@ -# Функции для реализации оператора IN. {#funktsii-dlia-realizatsii-operatora-in} - -## in, notIn, globalIn, globalNotIn {#in-functions} - -Смотрите раздел [Операторы IN](../statements/select.md#select-in-operators). - -## tuple(x, y, …), оператор (x, y, …) {#tuplex-y-operator-x-y} - -Функция, позволяющая сгруппировать несколько столбцов. -Для столбцов, имеющих типы T1, T2, … возвращает кортеж типа Tuple(T1, T2, …), содержащий эти столбцы. Выполнение функции ничего не стоит. -Кортежи обычно используются как промежуточное значение в качестве аргумента операторов IN, или для создания списка формальных параметров лямбда-функций. Кортежи не могут быть записаны в таблицу. - -## tupleElement(tuple, n), оператор x.N {#tupleelementtuple-n-operator-x-n} - -Функция, позволяющая достать столбец из кортежа. -N - индекс столбца начиная с 1. N должно быть константой. N должно быть целым строго положительным числом не большим размера кортежа. -Выполнение функции ничего не стоит. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/in_functions/) diff --git a/docs/ru/sql_reference/functions/introspection.md b/docs/ru/sql_reference/functions/introspection.md deleted file mode 100644 index 41ffb114e09..00000000000 --- a/docs/ru/sql_reference/functions/introspection.md +++ /dev/null @@ -1,303 +0,0 @@ -# Функции интроспекции {#introspection-functions} - -Функции из этого раздела могут использоваться для интроспекции [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) и [DWARF](https://en.wikipedia.org/wiki/DWARF) в целях профилирования запросов. - -!!! warning "Предупреждение" - Эти функции выполняются медленно и могут приводить к нежелательным последствиям в плане безопасности. - -Для правильной работы функций интроспекции: - -- Установите пакет `clickhouse-common-static-dbg`. - -- Установите настройку [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) в 1. - -Из соображений безопасности данные функции отключены по умолчанию. - -ClickHouse сохраняет отчеты профилировщика в [журнал трассировки](../../operations/system_tables.md#system_tables-trace_log) в системной таблице. Убедитесь, что таблица и профилировщик настроены правильно. - -## addresssToLine {#addresstoline} - -Преобразует адрес виртуальной памяти внутри процесса сервера ClickHouse в имя файла и номер строки в исходном коде ClickHouse. - -Если вы используете официальные пакеты ClickHouse, вам необходимо установить следующий пакеты: `clickhouse-common-static-dbg`. - -**Синтаксис** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**Параметры** - -- `address_of_binary_instruction` ([Тип UInt64](../../sql_reference/functions/introspection.md))- Адрес инструкции в запущенном процессе. - -**Возвращаемое значение** - -- Имя файла исходного кода и номер строки в этом файле разделяются двоеточием. - - Например, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, где `199` — номер строки. - -- Имя бинарного файла, если функция не может найти отладочную информацию. - -- Пустая строка, если адрес не является допустимым. - -Тип: [String](../../sql_reference/functions/introspection.md). - -**Пример** - -Включение функций самоанализа: - -``` sql -SET allow_introspection_functions=1 -``` - -Выбор первой строки из списка `trace_log` системная таблица: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -То `trace` поле содержит трассировку стека в момент выборки. - -Получение имени файла исходного кода и номера строки для одного адреса: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -``` - -Применение функции ко всему стектрейсу: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -Функция [arrayMap](higher_order_functions.md#higher_order_functions-array-map) позволяет обрабатывать каждый отдельный элемент массива `trace` с помощью функции `addressToLine`. Результат этой обработки вы видите в виде `trace_source_code_lines` колонки выходных данных. - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## addressToSymbol {#addresstosymbol} - -Преобразует адрес виртуальной памяти внутри серверного процесса ClickHouse в символ из объектных файлов ClickHouse. - -**Синтаксис** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**Параметры** - -- `address_of_binary_instruction` ([Тип uint64](../../sql_reference/functions/introspection.md)) — Адрес инструкции в запущенном процессе. - -**Возвращаемое значение** - -- Символ из объектных файлов ClickHouse. -- Пустая строка, если адрес не является допустимым. - -Тип: [String](../../sql_reference/functions/introspection.md). - -**Пример** - -Включение функций самоанализа: - -``` sql -SET allow_introspection_functions=1 -``` - -Выбор первой строки из списка `trace_log` системная таблица: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -То `trace` поле содержит трассировку стека в момент выборки. - -Получение символа для одного адреса: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -Применение функции ко всей трассировке стека: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -То [arrayMap](higher_order_functions.md#higher_order_functions-array-map) функция позволяет обрабатывать каждый отдельный элемент системы. `trace` массив по типу `addressToSymbols` функция. Результат этой обработки вы видите в виде `trace_symbols` колонка выходных данных. - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## demangle {#demangle} - -Преобразует символ, который вы можете получить с помощью [addressstosymbol](#addresstosymbol) функция имя функции C++. - -**Синтаксис** - -``` sql -demangle(symbol) -``` - -**Параметры** - -- `symbol` ([Строка](../../sql_reference/functions/introspection.md)) - Символ из объектного файла. - -**Возвращаемое значение** - -- Имя функции C++. -- Пустая строка, если символ не является допустимым. - -Тип: [Строка](../../sql_reference/functions/introspection.md). - -**Пример** - -Включение функций самоанализа: - -``` sql -SET allow_introspection_functions=1 -``` - -Выбор первой строки из списка `trace_log` системная таблица: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -То `trace` поле содержит трассировку стека в момент выборки. - -Получение имени функции для одного адреса: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -Применение функции ко всему стектрейсу: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -Функция [arrayMap](higher_order_functions.md#higher_order_functions-array-map) позволяет обрабатывать каждый отдельный элемент массива `trace` с помощью функции `demangle`. - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/ru/sql_reference/functions/ip_address_functions.md b/docs/ru/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index 57485f6a812..00000000000 --- a/docs/ru/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,241 +0,0 @@ -# Функции для работы с IP-адресами {#funktsii-dlia-raboty-s-ip-adresami} - -## IPv4NumToString(num) {#ipv4numtostringnum} - -Принимает число типа UInt32. Интерпретирует его, как IPv4-адрес в big endian. Возвращает строку, содержащую соответствующий IPv4-адрес в формате A.B.C.D (числа в десятичной форме через точки). - -## IPv4StringToNum(s) {#ipv4stringtonums} - -Функция, обратная к IPv4NumToString. Если IPv4 адрес в неправильном формате, то возвращает 0. - -## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} - -Похоже на IPv4NumToString, но вместо последнего октета используется xxx. - -Пример: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─k──────────────┬─────c─┐ -│ 83.149.9.xxx │ 26238 │ -│ 217.118.81.xxx │ 26074 │ -│ 213.87.129.xxx │ 25481 │ -│ 83.149.8.xxx │ 24984 │ -│ 217.118.83.xxx │ 22797 │ -│ 78.25.120.xxx │ 22354 │ -│ 213.87.131.xxx │ 21285 │ -│ 78.25.121.xxx │ 20887 │ -│ 188.162.65.xxx │ 19694 │ -│ 83.149.48.xxx │ 17406 │ -└────────────────┴───────┘ -``` - -В связи с тем, что использование xxx весьма необычно, это может быть изменено в дальнейшем. Вам не следует полагаться на конкретный вид этого фрагмента. - -### IPv6NumToString(x) {#ipv6numtostringx} - -Принимает значение типа FixedString(16), содержащее IPv6-адрес в бинарном виде. Возвращает строку, содержащую этот адрес в текстовом виде. -IPv6-mapped IPv4 адреса выводится в формате ::ffff:111.222.33.44. Примеры: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - -``` text -┌─addr─────────┐ -│ 2a02:6b8::11 │ -└──────────────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ -│ 2a02:2168:aaa:bbbb::2 │ 24695 │ -│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ -│ 2a02:6b8:0:fff::ff │ 16389 │ -│ 2a01:4f8:111:6666::2 │ 16016 │ -│ 2a02:2168:888:222::1 │ 15896 │ -│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ -│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ -│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ -│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ -│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ -└─────────────────────────────────────────┴───────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)─┬──────c─┐ -│ ::ffff:94.26.111.111 │ 747440 │ -│ ::ffff:37.143.222.4 │ 529483 │ -│ ::ffff:5.166.111.99 │ 317707 │ -│ ::ffff:46.38.11.77 │ 263086 │ -│ ::ffff:79.105.111.111 │ 186611 │ -│ ::ffff:93.92.111.88 │ 176773 │ -│ ::ffff:84.53.111.33 │ 158709 │ -│ ::ffff:217.118.11.22 │ 154004 │ -│ ::ffff:217.118.11.33 │ 148449 │ -│ ::ffff:217.118.11.44 │ 148243 │ -└────────────────────────────┴────────┘ -``` - -## IPv6StringToNum(s) {#ipv6stringtonums} - -Функция, обратная к IPv6NumToString. Если IPv6 адрес в неправильном формате, то возвращает строку из нулевых байт. -HEX может быть в любом регистре. - -## IPv4ToIPv6(x) {#ipv4toipv6x} - -Принимает число типа `UInt32`. Интерпретирует его, как IPv4-адрес в [big endian](https://en.wikipedia.org/wiki/Endianness). Возвращает значение `FixedString(16)`, содержащее адрес IPv6 в двоичном формате. Примеры: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - -``` text -┌─addr───────────────┐ -│ ::ffff:192.168.0.1 │ -└────────────────────┘ -``` - -## cutIPv6(x, bitsToCutForIPv6, bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} - -Принимает значение типа FixedString(16), содержащее IPv6-адрес в бинарном виде. Возвращает строку, содержащую адрес из указанного количества битов, удаленных в текстовом формате. Например: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - -``` text -┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ -│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ -└─────────────────────────────────────┴─────────────────────┘ -``` - -## IPv4CIDRToRange(ipv4, cidr), {#ipv4cidrtorangeipv4-cidr} - -Принимает на вход IPv4 и значение `UInt8`, содержащее [CIDR](https://ru.wikipedia.org/wiki/Бесклассовая_адресация). Возвращает кортеж с двумя IPv4, содержащими нижний и более высокий диапазон подсети. - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - -``` text -┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ -│ ('192.168.0.0','192.168.255.255') │ -└────────────────────────────────────────────┘ -``` - -## IPv6CIDRToRange(ipv6, cidr), {#ipv6cidrtorangeipv6-cidr} - -Принимает на вход IPv6 и значение `UInt8`, содержащее CIDR. Возвращает кортеж с двумя IPv6, содержащими нижний и более высокий диапазон подсети. - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32) -``` - -``` text -┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ -│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -## toIPv4(string) {#toipv4string} - -Псевдоним функции `IPv4StringToNum()` которая принимает строку с адресом IPv4 и возвращает значение типа [IPv4](../../sql_reference/functions/ip_address_functions.md), которое равно значению, возвращаемому функцией `IPv4StringToNum()`. - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - -``` text -┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ -│ UInt32 │ IPv4 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - -``` text -┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ -│ ABE1822D │ ABE1822D │ -└───────────────────────────────────┴──────────────────────────┘ -``` - -## toIPv6(string) {#toipv6string} - -Псевдоним функции `IPv6StringToNum()` которая принимает строку с адресом IPv6 и возвращает значение типа [IPv6](../../sql_reference/functions/ip_address_functions.md), которое равно значению, возвращаемому функцией `IPv6StringToNum()`. - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - -``` text -┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ -│ FixedString(16) │ IPv6 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - -``` text -┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ -│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ -└───────────────────────────────────┴──────────────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/ip_address_functions/) diff --git a/docs/ru/sql_reference/functions/json_functions.md b/docs/ru/sql_reference/functions/json_functions.md deleted file mode 100644 index 290fa911e6c..00000000000 --- a/docs/ru/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,224 +0,0 @@ -# Функции для работы с JSON. {#funktsii-dlia-raboty-s-json} - -В Яндекс.Метрике пользователями передаётся JSON в качестве параметров визитов. Для работы с таким JSON-ом, реализованы некоторые функции. (Хотя в большинстве случаев, JSON-ы дополнительно обрабатываются заранее, и полученные значения кладутся в отдельные столбцы в уже обработанном виде.) Все эти функции исходят из сильных допущений о том, каким может быть JSON, и при этом стараются почти ничего не делать. - -Делаются следующие допущения: - -1. Имя поля (аргумент функции) должно быть константой; -2. Считается, что имя поля в JSON-е закодировано некоторым каноническим образом. Например, `visitParamHas('{"abc":"def"}', 'abc') = 1`, но `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. Поля ищутся на любом уровне вложенности, без разбора. Если есть несколько подходящих полей - берётся первое. -4. В JSON-е нет пробельных символов вне строковых литералов. - -## visitParamHas(params, name) {#visitparamhasparams-name} - -Проверить наличие поля с именем name. - -## visitParamExtractUInt(params, name) {#visitparamextractuintparams-name} - -Распарсить UInt64 из значения поля с именем name. Если поле строковое - попытаться распарсить число из начала строки. Если такого поля нет, или если оно есть, но содержит не число, то вернуть 0. - -## visitParamExtractInt(params, name) {#visitparamextractintparams-name} - -Аналогично для Int64. - -## visitParamExtractFloat(params, name) {#visitparamextractfloatparams-name} - -Аналогично для Float64. - -## visitParamExtractBool(params, name) {#visitparamextractboolparams-name} - -Распарсить значение true/false. Результат - UInt8. - -## visitParamExtractRaw(params, name) {#visitparamextractrawparams-name} - -Вернуть значение поля, включая разделители. - -Примеры: - -``` sql -visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' -visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' -``` - -## visitParamExtractString(params, name) {#visitparamextractstringparams-name} - -Распарсить строку в двойных кавычках. У значения убирается экранирование. Если убрать экранированные символы не удалось, то возвращается пустая строка. - -Примеры: - -``` sql -visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' -visitParamExtractString('{"abc":"hello}', 'abc') = '' -``` - -На данный момент, не поддерживаются записанные в формате `\uXXXX\uYYYY` кодовые точки не из basic multilingual plane (они переводятся не в UTF-8, а в CESU-8). - -Следующие функции используют [simdjson](https://github.com/lemire/simdjson) который разработан под более сложные требования для разбора JSON. Упомянутое выше предположение 2 по-прежнему применимо. - -## isValidJSON(json) {#isvalidjsonjson} - -Проверяет, является ли переданная строка валидным json значением. - -Примеры: - -``` sql -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} - -Если значение существует в документе JSON, то возвращается `1`. - -Если значение не существует, то возвращается `0`. - -Примеры: - -``` sql -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 -``` - -`indices_or_keys` — это список из нуля или более аргументов каждый из них может быть либо строкой либо целым числом. - -- Строка — это доступ к объекту по ключу. -- Положительное целое число — это доступ к n-му члену/ключу с начала. -- Отрицательное целое число — это доступ к n-му члену/ключу с конца. - -Адресация элементов по индексу начинается с 1, следовательно элемент 0 не существует. - -Вы можете использовать целые числа, чтобы адресовать как массивы JSON, так и JSON-объекты. - -Примеры: - -``` sql -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' -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} - -Возвращает длину массива JSON или объекта JSON. - -Если значение не существует или имеет неверный тип, то возвращается `0`. - -Примеры: - -``` sql -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} - -Возвращает тип значения JSON. - -Если значение не существует, то возвращается `Null`. - -Примеры: - -``` sql -SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' -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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -Парсит JSON и извлекает значение. Эти функции аналогичны функциям `visitParam`. - -Если значение не существует или имеет неверный тип, то возвращается `0`. - -Примеры: - -``` sql -SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 -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} - -Парсит JSON и извлекает строку. Эта функция аналогична функции `visitParamExtractString`. - -Если значение не существует или имеет неверный тип, то возвращается пустая строка. - -У значения убирается экранирование. Если убрать экранированные символы не удалось, то возвращается пустая строка. - -Примеры: - -``` sql -SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' -SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' -SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' -``` - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -Парсит JSON и извлекает значение с заданным типом данных. - -Это обобщение предыдущих функций `JSONExtract`. -Это означает -`JSONExtract(..., 'String')` выдает такой же результат, как `JSONExtractString()`, -`JSONExtract(..., 'Float64')` выдает такой же результат, как `JSONExtractFloat()`. - -Примеры: - -``` sql -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL -SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 -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} - -Разбор пар ключ-значение из JSON, где значение имеет тип данных ClickHouse. - -Пример: - -``` sql -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} - -Возвращает часть JSON в виде строки, содержащей неразобранную подстроку. - -Если значение не существует, то возвращается пустая строка. - -Пример: - -``` sql -SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' -``` - -## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} - -Возвращает массив из элементов JSON массива, каждый из которых представлен в виде строки с неразобранными подстроками из JSON. - -Если значение не существует или не является массивом, то возвращается пустой массив. - -Пример: - -``` sql -SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/json_functions/) diff --git a/docs/ru/sql_reference/functions/machine_learning_functions.md b/docs/ru/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index c5dd27d96af..00000000000 --- a/docs/ru/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,13 +0,0 @@ -# Функции машинного обучения {#funktsii-mashinnogo-obucheniia} - -## evalMLMethod (prediction) {#machine_learning_methods-evalmlmethod} - -Предсказание с использованием подобранных регрессионных моделей. - -### Stochastic Linear Regression {#stochastic-linear-regression} - -Агрегатная функция [stochasticLinearRegression](../../sql_reference/functions/machine_learning_functions.md#agg_functions-stochasticlinearregression) реализует стохастический градиентный спуск, использую линейную модель и функцию потерь MSE. - -### Stochastic Logistic Regression {#stochastic-logistic-regression} - -Агрегатная функция [stochasticLogisticRegression](../../sql_reference/functions/machine_learning_functions.md#agg_functions-stochasticlogisticregression) реализует стохастический градиентный спуск для задачи бинарной классификации. diff --git a/docs/ru/sql_reference/functions/other_functions.md b/docs/ru/sql_reference/functions/other_functions.md deleted file mode 100644 index a0568cb262e..00000000000 --- a/docs/ru/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,1029 +0,0 @@ -# Прочие функции {#prochie-funktsii} - -## hostName() {#hostname} - -Возвращает строку - имя хоста, на котором эта функция была выполнена. При распределённой обработке запроса, это будет имя хоста удалённого сервера, если функция выполняется на удалённом сервере. - -## FQDN {#fqdn} - -Возвращает полное имя домена. - -**Синтаксис** - -``` sql -fqdn(); -``` - -Эта функция регистронезависимая. - -**Возвращаемое значение** - -- Полное имя домена. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT FQDN(); -``` - -Ответ: - -``` text -┌─FQDN()──────────────────────────┐ -│ clickhouse.ru-central1.internal │ -└─────────────────────────────────┘ -``` - -## basename {#basename} - -Извлекает конечную часть строки после последнего слэша или бэкслэша. Функция часто используется для извлечения имени файла из пути. - -``` sql -basename( expr ) -``` - -**Параметры** - -- `expr` — Выражение, возвращающее значение типа [String](../../sql_reference/functions/other_functions.md). В результирующем значении все бэкслэши должны быть экранированы. - -**Возвращаемое значение** - -Строка, содержащая: - -- Конечную часть строки после последнего слэша или бэкслэша. - - Если входная строка содержит путь, заканчивающийся слэшем или бэкслэшем, например, `/` или `с:\`, функция возвращает пустую строку. - -- Исходная строка, если нет слэша или бэкслэша. - -**Пример** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## visibleWidth(x) {#visiblewidthx} - -Вычисляет приблизительную ширину при выводе значения в текстовом (tab-separated) виде на консоль. -Функция используется системой для реализации Pretty форматов. - -`NULL` представляется как строка, соответствующая отображению `NULL` в форматах `Pretty`. - -``` sql -SELECT visibleWidth(NULL) -``` - -``` text -┌─visibleWidth(NULL)─┐ -│ 4 │ -└────────────────────┘ -``` - -## toTypeName(x) {#totypenamex} - -Возвращает строку, содержащую имя типа переданного аргумента. - -Если на вход функции передать `NULL`, то она вернёт тип `Nullable(Nothing)`, что соответствует внутреннему представлению `NULL` в ClickHouse. - -## blockSize() {#function-blocksize} - -Получить размер блока. -В ClickHouse выполнение запроса всегда идёт по блокам (наборам кусочков столбцов). Функция позволяет получить размер блока, для которого её вызвали. - -## materialize(x) {#materializex} - -Превращает константу в полноценный столбец, содержащий только одно значение. -В ClickHouse полноценные столбцы и константы представлены в памяти по-разному. Функции по-разному работают для аргументов-констант и обычных аргументов (выполняется разный код), хотя результат почти всегда должен быть одинаковым. Эта функция предназначена для отладки такого поведения. - -## ignore(…) {#ignore} - -Принимает любые аргументы, в т.ч. `NULL`, всегда возвращает 0. -При этом, аргумент всё равно вычисляется. Это может использоваться для бенчмарков. - -## sleep(seconds) {#sleepseconds} - -Спит seconds секунд на каждый блок данных. Можно указать как целое число, так и число с плавающей запятой. - -## currentDatabase() {#currentdatabase} - -Возвращает имя текущей базы данных. -Эта функция может использоваться в параметрах движка таблицы в запросе CREATE TABLE там, где нужно указать базу данных. - -## currentUser() {#other-function-currentuser} - -Возвращает логин текущего пользователя. При распределенном запросе, возвращается имя пользователя, инициировавшего запрос. - -``` sql -SELECT currentUser(); -``` - -Алиас: `user()`, `USER()`. - -**Возвращаемые значения** - -- Логин текущего пользователя. -- При распределенном запросе — логин пользователя, инициировавшего запрос. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT currentUser(); -``` - -Ответ: - -``` text -┌─currentUser()─┐ -│ default │ -└───────────────┘ -``` - -## isFinite(x) {#isfinitex} - -Принимает Float32 или Float64 и возвращает UInt8, равный 1, если аргумент не бесконечный и не NaN, иначе 0. - -## ifNotFinite {#ifnotfinite} - -Проверяет, является ли значение дробного числа с плавающей точкой конечным. - -**Синтаксис** - - ifNotFinite(x,y) - -**Параметры** - -- `x` — Значение, которое нужно проверить на бесконечность. Тип: [Float\*](../../sql_reference/functions/other_functions.md). -- `y` — Запасное значение. Тип: [Float\*](../../sql_reference/functions/other_functions.md). - -**Возвращаемые значения** - -- `x`, если `x` принимает конечное значение. -- `y`, если`x` принимает не конечное значение. - -**Пример** - -Запрос: - - SELECT 1/0 as infimum, ifNotFinite(infimum,42) - -Результат: - - ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ - │ inf │ 42 │ - └─────────┴───────────────────────────────┘ - -Аналогичный результат можно получить с помощью [тернарного оператора](conditional_functions.md#ternary-operator) `isFinite(x) ? x : y`. - -## isInfinite(x) {#isinfinitex} - -Принимает Float32 или Float64 и возвращает UInt8, равный 1, если аргумент бесконечный, иначе 0. Отметим, что в случае NaN возвращается 0. - -## isNaN(x) {#isnanx} - -Принимает Float32 или Float64 и возвращает UInt8, равный 1, если аргумент является NaN, иначе 0. - -## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -Принимает константные строки - имя базы данных, имя таблицы и название столбца. Возвращает константное выражение типа UInt8, равное 1, -если есть столбец, иначе 0. Если задан параметр hostname, проверка будет выполнена на удалённом сервере. -Функция кидает исключение, если таблица не существует. -Для элементов вложенной структуры данных функция проверяет существование столбца. Для самой же вложенной структуры данных функция возвращает 0. - -## bar {#function-bar} - -Позволяет построить unicode-art диаграмму. - -`bar(x, min, max, width)` рисует полосу ширины пропорциональной `(x - min)` и равной `width` символов при `x = max`. - -Параметры: - -- `x` — Величина для отображения. -- `min, max` — Целочисленные константы, значение должно помещаться в `Int64`. -- `width` — Константа, положительное число, может быть дробным. - -Полоса рисуется с точностью до одной восьмой символа. - -Пример: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - -``` text -┌──h─┬──────c─┬─bar────────────────┐ -│ 0 │ 292907 │ █████████▋ │ -│ 1 │ 180563 │ ██████ │ -│ 2 │ 114861 │ ███▋ │ -│ 3 │ 85069 │ ██▋ │ -│ 4 │ 68543 │ ██▎ │ -│ 5 │ 78116 │ ██▌ │ -│ 6 │ 113474 │ ███▋ │ -│ 7 │ 170678 │ █████▋ │ -│ 8 │ 278380 │ █████████▎ │ -│ 9 │ 391053 │ █████████████ │ -│ 10 │ 457681 │ ███████████████▎ │ -│ 11 │ 493667 │ ████████████████▍ │ -│ 12 │ 509641 │ ████████████████▊ │ -│ 13 │ 522947 │ █████████████████▍ │ -│ 14 │ 539954 │ █████████████████▊ │ -│ 15 │ 528460 │ █████████████████▌ │ -│ 16 │ 539201 │ █████████████████▊ │ -│ 17 │ 523539 │ █████████████████▍ │ -│ 18 │ 506467 │ ████████████████▊ │ -│ 19 │ 520915 │ █████████████████▎ │ -│ 20 │ 521665 │ █████████████████▍ │ -│ 21 │ 542078 │ ██████████████████ │ -│ 22 │ 493642 │ ████████████████▍ │ -│ 23 │ 400397 │ █████████████▎ │ -└────┴────────┴────────────────────┘ -``` - -## transform {#transform} - -Преобразовать значение согласно явно указанному отображению одних элементов на другие. -Имеется два варианта функции: - -### transform(x, array\_from, array\_to, default) {#transformx-array-from-array-to-default} - -`x` - что преобразовывать. - -`array_from` - константный массив значений для преобразования. - -`array_to` - константный массив значений, в которые должны быть преобразованы значения из from. - -`default` - какое значение использовать, если x не равен ни одному из значений во from. - -`array_from` и `array_to` - массивы одинаковых размеров. - -Типы: - -`transform(T, Array(T), Array(U), U) -> U` - -`T` и `U` - могут быть числовыми, строковыми, или Date или DateTime типами. -При этом, где обозначена одна и та же буква (T или U), могут быть, в случае числовых типов, не совпадающие типы, а типы, для которых есть общий тип. -Например, первый аргумент может иметь тип Int64, а второй - Array(UInt16). - -Если значение x равно одному из элементов массива array\_from, то возвращает соответствующий (такой же по номеру) элемент массива array\_to; иначе возвращает default. Если имеется несколько совпадающих элементов в array\_from, то возвращает какой-нибудь из соответствующих. - -Пример: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - -``` text -┌─title─────┬──────c─┐ -│ Yandex │ 498635 │ -│ Google │ 229872 │ -│ Other │ 104472 │ -└───────────┴────────┘ -``` - -### transform(x, array\_from, array\_to) {#transformx-array-from-array-to} - -Отличается от первого варианта отсутствующим аргументом default. -Если значение x равно одному из элементов массива array\_from, то возвращает соответствующий (такой же по номеру) элемент массива array\_to; иначе возвращает x. - -Типы: - -`transform(T, Array(T), Array(T)) -> T` - -Пример: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -┌─s──────────────┬───────c─┐ -│ │ 2906259 │ -│ www.yandex │ 867767 │ -│ ███████.ru │ 313599 │ -│ mail.yandex.ru │ 107147 │ -│ ██████.ru │ 100355 │ -│ █████████.ru │ 65040 │ -│ news.yandex.ru │ 64515 │ -│ ██████.net │ 59141 │ -│ example.com │ 57316 │ -└────────────────┴─────────┘ -``` - -## formatReadableSize(x) {#formatreadablesizex} - -Принимает размер (число байт). Возвращает округленный размер с суффиксом (KiB, MiB и т.д.) в виде строки. - -Пример: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - -``` text -┌─filesize_bytes─┬─filesize───┐ -│ 1 │ 1.00 B │ -│ 1024 │ 1.00 KiB │ -│ 1048576 │ 1.00 MiB │ -│ 192851925 │ 183.92 MiB │ -└────────────────┴────────────┘ -``` - -## least(a, b) {#leasta-b} - -Возвращает наименьшее значение из a и b. - -## greatest(a, b) {#greatesta-b} - -Возвращает наибольшее значение из a и b. - -## uptime() {#uptime} - -Возвращает аптайм сервера в секундах. - -## version() {#version} - -Возвращает версию сервера в виде строки. - -## rowNumberInBlock {#function-rownumberinblock} - -Возвращает порядковый номер строки в блоке данных. Для каждого блока данных нумерация начинается с 0. - -## rowNumberInAllBlocks() {#rownumberinallblocks} - -Возвращает порядковый номер строки в блоке данных. Функция учитывает только задействованные блоки данных. - -## neighbor {#neighbor} - -Функция позволяет получить доступ к значению в колонке `column`, находящемуся на смещении `offset` относительно текущей строки. Является частичной реализацией [оконных функций](https://en.wikipedia.org/wiki/SQL_window_function) `LEAD()` и `LAG()`. - -**Синтаксис** - -``` sql -neighbor(column, offset[, default_value]) -``` - -Результат функции зависит от затронутых блоков данных и порядка данных в блоке. Если сделать подзапрос с ORDER BY и вызывать функцию извне подзапроса, можно будет получить ожидаемый результат. - -**Параметры** - -- `column` — Имя столбца или скалярное выражение. -- `offset` - Смещение от текущей строки `column`. [Int64](../../sql_reference/functions/other_functions.md). -- `default_value` - Опциональный параметр. Значение, которое будет возвращено, если смещение выходит за пределы блока данных. - -**Возвращаемое значение** - -- Значение `column` в смещении от текущей строки, если значение `offset` не выходит за пределы блока. -- Значение по умолчанию для `column`, если значение `offset` выходит за пределы блока данных. Если передан параметр `default_value`, то значение берется из него. - -Тип: зависит от данных в `column` или переданного значения по умолчанию в `default_value`. - -**Пример** - -Запрос: - -``` sql -SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; -``` - -Ответ: - -``` text -┌─number─┬─neighbor(number, 2)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 0 │ -│ 9 │ 0 │ -└────────┴─────────────────────┘ -``` - -Запрос: - -``` sql -SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; -``` - -Ответ: - -``` text -┌─number─┬─neighbor(number, 2, 999)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 999 │ -│ 9 │ 999 │ -└────────┴──────────────────────────┘ -``` - -Эта функция может использоваться для оценки year-over-year значение показателя: - -Запрос: - -``` sql -WITH toDate('2018-01-01') AS start_date -SELECT - toStartOfMonth(start_date + (number * 32)) AS month, - toInt32(month) % 100 AS money, - neighbor(money, -12) AS prev_year, - round(prev_year / money, 2) AS year_over_year -FROM numbers(16) -``` - -Ответ: - -``` text -┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ -│ 2018-01-01 │ 32 │ 0 │ 0 │ -│ 2018-02-01 │ 63 │ 0 │ 0 │ -│ 2018-03-01 │ 91 │ 0 │ 0 │ -│ 2018-04-01 │ 22 │ 0 │ 0 │ -│ 2018-05-01 │ 52 │ 0 │ 0 │ -│ 2018-06-01 │ 83 │ 0 │ 0 │ -│ 2018-07-01 │ 13 │ 0 │ 0 │ -│ 2018-08-01 │ 44 │ 0 │ 0 │ -│ 2018-09-01 │ 75 │ 0 │ 0 │ -│ 2018-10-01 │ 5 │ 0 │ 0 │ -│ 2018-11-01 │ 36 │ 0 │ 0 │ -│ 2018-12-01 │ 66 │ 0 │ 0 │ -│ 2019-01-01 │ 97 │ 32 │ 0.33 │ -│ 2019-02-01 │ 28 │ 63 │ 2.25 │ -│ 2019-03-01 │ 56 │ 91 │ 1.62 │ -│ 2019-04-01 │ 87 │ 22 │ 0.25 │ -└────────────┴───────┴───────────┴────────────────┘ -``` - -## runningDifference(x) {#runningdifferencex} - -Считает разницу между последовательными значениями строк в блоке данных. -Возвращает 0 для первой строки и разницу с предыдущей строкой для каждой последующей строки. - -Результат функции зависит от затронутых блоков данных и порядка данных в блоке. -Если сделать подзапрос с ORDER BY и вызывать функцию извне подзапроса, можно будет получить ожидаемый результат. - -Пример: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - -``` text -┌─EventID─┬───────────EventTime─┬─delta─┐ -│ 1106 │ 2016-11-24 00:00:04 │ 0 │ -│ 1107 │ 2016-11-24 00:00:05 │ 1 │ -│ 1108 │ 2016-11-24 00:00:05 │ 0 │ -│ 1109 │ 2016-11-24 00:00:09 │ 4 │ -│ 1110 │ 2016-11-24 00:00:10 │ 1 │ -└─────────┴─────────────────────┴───────┘ -``` - -Обратите внимание — размер блока влияет на результат. С каждым новым блоком состояние `runningDifference` сбрасывается. - -``` sql -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -┌─number─┬─diff─┐ -│ 65536 │ 0 │ -└────────┴──────┘ -``` - - set max_block_size=100000 -- по умолчанию 65536! - - SELECT - number, - runningDifference(number + 1) AS diff - FROM numbers(100000) - WHERE diff != 1 - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -``` - -## runningDifferenceStartingWithFirstValue {#runningdifferencestartingwithfirstvalue} - -То же, что и \[runningDifference\] (./other\_functions.md \# other\_functions-runningdifference), но в первой строке возвращается значение первой строки, а не ноль. - -## MACNumToString(num) {#macnumtostringnum} - -Принимает число типа UInt64. Интерпретирует его, как MAC-адрес в big endian. Возвращает строку, содержащую соответствующий MAC-адрес в формате AA:BB:CC:DD:EE:FF (числа в шестнадцатеричной форме через двоеточие). - -## MACStringToNum(s) {#macstringtonums} - -Функция, обратная к MACNumToString. Если MAC адрес в неправильном формате, то возвращает 0. - -## MACStringToOUI(s) {#macstringtoouis} - -Принимает MAC адрес в формате AA:BB:CC:DD:EE:FF (числа в шестнадцатеричной форме через двоеточие). Возвращает первые три октета как число в формате UInt64. Если MAC адрес в неправильном формате, то возвращает 0. - -## getSizeOfEnumType {#getsizeofenumtype} - -Возвращает количество полей в [Enum](../../sql_reference/functions/other_functions.md). - -``` sql -getSizeOfEnumType(value) -``` - -**Параметры** - -- `value` — Значение типа `Enum`. - -**Возвращаемые значения** - -- Количество полей входного значения типа `Enum`. -- Исключение, если тип не `Enum`. - -**Пример** - -``` sql -SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## toColumnTypeName {#tocolumntypename} - -Возвращает имя класса, которым представлен тип данных столбца в оперативной памяти. - -``` sql -toColumnTypeName(value) -``` - -**Параметры** - -- `value` — Значение произвольного типа. - -**Возвращаемые значения** - -- Строка с именем класса, который используется для представления типа данных `value` в оперативной памяти. - -**Пример разницы между `toTypeName` и `toColumnTypeName`** - -``` sql -SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime │ -└─────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ Const(UInt32) │ -└───────────────────────────────────────────────────────────┘ -``` - -В примере видно, что тип данных `DateTime` хранится в памяти как `Const(UInt32)`. - -## dumpColumnStructure {#dumpcolumnstructure} - -Выводит развернутое описание структур данных в оперативной памяти - -``` sql -dumpColumnStructure(value) -``` - -**Параметры** - -- `value` — Значение произвольного типа. - -**Возвращаемые значения** - -- Строка с описанием структуры, которая используется для представления типа данных `value` в оперативной памяти. - -**Пример** - -``` sql -SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) -``` - -``` text -┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime, Const(size = 1, UInt32(size = 1)) │ -└──────────────────────────────────────────────────────────────┘ -``` - -## defaultValueOfArgumentType {#defaultvalueofargumenttype} - -Выводит значение по умолчанию для типа данных. - -Не учитывает значения по умолчанию для столбцов, заданные пользователем. - -``` sql -defaultValueOfArgumentType(expression) -``` - -**Параметры** - -- `expression` — Значение произвольного типа или выражение, результатом которого является значение произвольного типа. - -**Возвращаемые значения** - -- `0` для чисел; -- Пустая строка для строк; -- `ᴺᵁᴸᴸ` для [Nullable](../../sql_reference/functions/other_functions.md). - -**Пример** - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ -│ 0 │ -└─────────────────────────────────────────────┘ -``` - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ -│ ᴺᵁᴸᴸ │ -└───────────────────────────────────────────────────────┘ -``` - -## replicate {#other-functions-replicate} - -Создает массив, заполненный одним значением. - -Используется для внутренней реализации [arrayJoin](array_join.md#functions_arrayjoin). - -``` sql -SELECT replicate(x, arr); -``` - -**Параметры** - -- `arr` — Исходный массив. ClickHouse создаёт новый массив такой же длины как исходный и заполняет его значением `x`. -- `x` — Значение, которым будет заполнен результирующий массив. - -**Возвращаемое значение** - -Массив, заполненный значением `x`. - -Тип: `Array`. - -**Пример** - -Запрос: - -``` sql -SELECT replicate(1, ['a', 'b', 'c']); -``` - -Ответ: - -``` text -┌─replicate(1, ['a', 'b', 'c'])─┐ -│ [1,1,1] │ -└───────────────────────────────┘ -``` - -## filesystemAvailable {#filesystemavailable} - -Возвращает объём доступного для записи данных места на файловой системе. Он всегда меньше общего свободного места ([filesystemFree](#filesystemfree)), потому что некоторое пространство зарезервировано для нужд операционной системы. - -**Синтаксис** - -``` sql -filesystemAvailable() -``` - -**Возвращаемое значение** - -- Объём доступного для записи данных места в байтах. - -Тип: [UInt64](../../sql_reference/functions/other_functions.md). - -**Пример** - -Запрос: - -``` sql -SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; -``` - -Ответ: - -``` text -┌─Available space─┬─Type───┐ -│ 30.75 GiB │ UInt64 │ -└─────────────────┴────────┘ -``` - -## filesystemFree {#filesystemfree} - -Возвращает объём свободного места на файловой системе. Смотрите также `filesystemAvailable`. - -**Синтаксис** - -``` sql -filesystemFree() -``` - -**Возвращаемое значение** - -- Объем свободного места в байтах. - -Тип: [UInt64](../../sql_reference/functions/other_functions.md). - -**Пример** - -Запрос: - -``` sql -SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; -``` - -Ответ: - -``` text -┌─Free space─┬─Type───┐ -│ 32.39 GiB │ UInt64 │ -└────────────┴────────┘ -``` - -## filesystemCapacity {#filesystemcapacity} - -Возвращает информацию о ёмкости файловой системы в байтах. Для оценки должен быть настроен [путь](../../sql_reference/functions/other_functions.md#server_configuration_parameters-path) к каталогу с данными. - -**Синтаксис** - -``` sql -filesystemCapacity() -``` - -**Возвращаемое значение** - -- Информация о ёмкости файловой системы в байтах. - -Тип: [UInt64](../../sql_reference/functions/other_functions.md). - -**Пример** - -Запрос: - -``` sql -SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" -``` - -Ответ: - -``` text -┌─Capacity──┬─Type───┐ -│ 39.32 GiB │ UInt64 │ -└───────────┴────────┘ -``` - -## finalizeAggregation {#function-finalizeaggregation} - -Принимает состояние агрегатной функции. Возвращает результат агрегирования. - -## runningAccumulate {#function-runningaccumulate} - -Принимает на вход состояния агрегатной функции и возвращает столбец со значениями, которые представляют собой результат мёржа этих состояний для выборки строк из блока от первой до текущей строки. Например, принимает состояние агрегатной функции (например, `runningAccumulate(uniqState(UserID))`), и для каждой строки блока возвращает результат агрегатной функции после мёржа состояний функции для всех предыдущих строк и текущей. Таким образом, результат зависит от разбиения данных по блокам и от порядка данных в блоке. - -## joinGet {#joinget} - -Функция позволяет извлекать данные из таблицы таким же образом как из [словаря](../../sql_reference/functions/other_functions.md). - -Получает данные из таблиц [Join](../../sql_reference/functions/other_functions.md#creating-a-table) по ключу. - -Поддерживаются только таблицы, созданные с `ENGINE = Join(ANY, LEFT, )`. - -**Синтаксис** - -``` sql -joinGet(join_storage_table_name, `value_column`, join_keys) -``` - -**Параметры** - -- `join_storage_table_name` — [идентификатор](../syntax.md#syntax-identifiers), который указывает, откуда производится выборка данных. Поиск по идентификатору осуществляется в базе данных по умолчанию (см. конфигурацию `default_database`). Чтобы переопределить базу данных по умолчанию, используйте команду `USE db_name`, или укажите базу данных и таблицу через разделитель `db_name.db_table`, см. пример. -- `value_column` — столбец, из которого нужно произвести выборку данных. -- `join_keys` — список ключей, по которым производится выборка данных. - -**Возвращаемое значение** - -Возвращает значение по списку ключей. - -Если значения не существует в исходной таблице, вернется `0` или `null` в соответствии с настройками [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls). - -Подробнее о настройке `join_use_nulls` в [операциях Join](../../sql_reference/functions/other_functions.md). - -**Пример** - -Входная таблица: - -``` sql -CREATE DATABASE db_test -CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 -INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) -``` - -``` text -┌─id─┬─val─┐ -│ 4 │ 13 │ -│ 2 │ 12 │ -│ 1 │ 11 │ -└────┴─────┘ -``` - -Запрос: - -``` sql -SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 -``` - -Результат: - -``` text -┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ -│ 0 │ -│ 11 │ -│ 12 │ -│ 0 │ -└──────────────────────────────────────────────────┘ -``` - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -Оценивает внешнюю модель. - -Принимает на вход имя и аргументы модели. Возвращает Float64. - -## throwIf(x\[, custom\_message\]) {#throwifx-custom-message} - -Бросает исключение, если аргумент не равен нулю. -custom\_message - необязательный параметр, константная строка, задает текст сообщения об ошибке. - -``` sql -SELECT throwIf(number = 3, 'Too many') FROM numbers(10); -``` - -``` text -↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): -Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. -``` - -## identity {#identity} - -Возвращает свой аргумент. Используется для отладки и тестирования, позволяет отменить использование индекса, и получить результат и производительность полного сканирования таблицы. Это работает, потому что оптимизатор запросов не может «заглянуть» внутрь функции `identity`. - -**Синтаксис** - -``` sql -identity(x) -``` - -**Пример** - -Query: - -``` sql -SELECT identity(42) -``` - -Результат: - -``` text -┌─identity(42)─┐ -│ 42 │ -└──────────────┘ -``` - -## randomPrintableASCII {#randomascii} - -Генерирует строку со случайным набором печатных символов [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters). - -**Синтаксис** - -``` sql -randomPrintableASCII(length) -``` - -**Параметры** - -- `length` — Длина результирующей строки. Положительное целое число. - - Если передать `length < 0`, то поведение функции не определено. - -**Возвращаемое значение** - -- Строка со случайным набором печатных символов [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters). - -Тип: [String](../../sql_reference/functions/other_functions.md) - -**Пример** - -``` sql -SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 -``` - -``` text -┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ -│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ -│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ -│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ -└────────┴────────────────────────────────┴──────────────────────────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/other_functions/) diff --git a/docs/ru/sql_reference/functions/rounding_functions.md b/docs/ru/sql_reference/functions/rounding_functions.md deleted file mode 100644 index 9e7947c109d..00000000000 --- a/docs/ru/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,175 +0,0 @@ -# Функции округления {#funktsii-okrugleniia} - -## floor(x\[, N\]) {#floorx-n} - -Возвращает наибольшее круглое число, которое меньше или равно, чем x. -Круглым называется число, кратное 1 / 10N или ближайшее к нему число соответствующего типа данных, если 1 / 10N не представимо точно. -N - целочисленная константа, не обязательный параметр. По умолчанию - ноль, что означает - округлять до целого числа. -N может быть отрицательным. - -Примеры: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x` - любой числовой тип. Результат - число того же типа. -Для целочисленных аргументов имеет смысл округление с отрицательным значением N (для неотрицательных N, функция ничего не делает). -В случае переполнения при округлении (например, floor(-128, -1)), возвращается implementation specific результат. - -## ceil(x\[, N\]) {#ceilx-n} - -Возвращает наименьшее круглое число, которое больше или равно, чем x. -В остальном, аналогично функции floor, см. выше. - -## round(x\[, N\]) {#rounding_functions-round} - -Округляет значение до указанного десятичного разряда. - -Функция возвращает ближайшее значение указанного порядка. В случае, когда заданное число равноудалено от чисел необходимого порядка, функция возвращает то из них, которое имеет ближайшую чётную цифру (банковское округление). - -``` sql -round(expression [, decimal_places]) -``` - -**Параметры:** - -- `expression` — Число для округления. Может быть любым [выражением](../syntax.md#syntax-expressions), возвращающим числовой [тип данных](../../sql_reference/functions/rounding_functions.md#data_types). -- `decimal-places` — Целое значение. - - Если `decimal-places > 0`, то функция округляет значение справа от запятой. - - Если `decimal-places < 0` то функция округляет значение слева от запятой. - - Если `decimal-places = 0`, то функция округляет значение до целого. В этом случае аргумент можно опустить. - -**Возвращаемое значение:** - -Округлённое значение того же типа, что и входящее. - -### Примеры {#primery} - -**Пример использования** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - -``` text -┌───x─┬─round(divide(number, 2))─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -└─────┴──────────────────────────┘ -``` - -**Примеры округления** - -Округление до ближайшего числа. - -``` text -round(3.2, 0) = 3 -round(4.1267, 2) = 4.13 -round(22,-1) = 20 -round(467,-2) = 500 -round(-467,-2) = -500 -``` - -Банковское округление. - -``` text -round(3.5) = 4 -round(4.5) = 4 -round(3.55, 1) = 3.6 -round(3.65, 1) = 3.6 -``` - -**Смотрите также** - -- [roundBankers](#roundbankers) - -## roundBankers {#roundbankers} - -Округляет число до указанного десятичного разряда. - -- Если округляемое число равноудалено от соседних чисел, то используется банковское округление. - - Банковское округление (англ. banker's rounding) — метод округления дробных чисел. Если округляемое число равноудалено от соседних чисел, то оно округляется до ближайшей чётной цифры заданного десятичного разряда. К примеру, 3,5 округляется до 4, а 2,5 до 2. - - Этот метод округления, используемый по умолчанию для чисел с плавающей запятой, определён в стандарте [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). Функция [round](#rounding_functions-round) также округляет числа с плавающей запятой по этому методу. Функция `roundBankers` округляет не только числа с плавающей запятой, но и целые числа методом банковского округления, например, `roundBankers(45, -1) = 40`. - -- В других случаях функция округляет к ближайшему целому. - -Банковское округление позволяет уменьшить влияние округления чисел на результат суммирования или вычитания этих чисел. - -Пример суммирования чисел 1.5, 2.5, 3.5 и 4.5 с различным округлением: - -- Без округления: 1.5 + 2.5 + 3.5 + 4.5 = 12. -- Банковское округление: 2 + 2 + 4 + 4 = 12. -- Округление до ближайшего целого: 2 + 3 + 4 + 5 = 14. - -**Синтаксис** - -``` sql -roundBankers(expression [, decimal_places]) -``` - -**Параметры** - -- `expression` — Число для округления. Может быть любым [выражением](../syntax.md#syntax-expressions), возвращающим числовой [тип данных](../../sql_reference/functions/rounding_functions.md#data_types). -- `decimal-places` — Десятичный разряд. Целое число. - - `decimal-places > 0` — Функция округляет значение выражения до ближайшего чётного числа на соответствующей позиции справа от запятой. Например, `roundBankers(3.55, 1) = 3.6`. - - `decimal-places < 0` — Функция округляет значение выражения до ближайшего чётного числа на соответствующей позиции слева от запятой. Например, `roundBankers(24.55, -1) = 20`. - - `decimal-places = 0` — Функция округляет значение до целого. В этом случае аргумент можно не передавать. Например, `roundBankers(2.5) = 2`. - -**Возвращаемое значение** - -Округлённое значение по методу банковского округления. - -**Пример использования** - -Запрос: - -``` sql - SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 -``` - -Результат: - -``` text -┌───x─┬─b─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -│ 1.5 │ 2 │ -│ 2 │ 2 │ -│ 2.5 │ 2 │ -│ 3 │ 3 │ -│ 3.5 │ 4 │ -│ 4 │ 4 │ -│ 4.5 │ 4 │ -└─────┴───┘ -``` - -**Примеры банковского округления** - -``` text -roundBankers(0.4) = 0 -roundBankers(-3.5) = -4 -roundBankers(4.5) = 4 -roundBankers(3.55, 1) = 3.6 -roundBankers(3.65, 1) = 3.6 -roundBankers(10.35, 1) = 10.4 -roundBankers(10.755, 2) = 11,76 -``` - -**Смотрите также** - -- [round](#rounding_functions-round) - -## roundToExp2(num) {#roundtoexp2num} - -Принимает число. Если число меньше единицы - возвращает 0. Иначе округляет число вниз до ближайшей (целой неотрицательной) степени двух. - -## roundDuration(num) {#rounddurationnum} - -Принимает число. Если число меньше единицы - возвращает 0. Иначе округляет число вниз до чисел из набора: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Эта функция специфична для Яндекс.Метрики и предназначена для реализации отчёта по длительности визита. - -## roundAge(num) {#roundagenum} - -Принимает число. Если число меньше 18 - возвращает 0. Иначе округляет число вниз до чисел из набора: 18, 25, 35, 45, 55. Эта функция специфична для Яндекс.Метрики и предназначена для реализации отчёта по возрасту посетителей. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/rounding_functions/) diff --git a/docs/ru/sql_reference/functions/string_functions.md b/docs/ru/sql_reference/functions/string_functions.md deleted file mode 100644 index 5c51ad7c73c..00000000000 --- a/docs/ru/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,482 +0,0 @@ -# Функции для работы со строками {#funktsii-dlia-raboty-so-strokami} - -## empty {#empty} - -Возвращает 1 для пустой строки, и 0 для непустой строки. -Тип результата — UInt8. -Строка считается непустой, если содержит хотя бы один байт, пусть даже это пробел или нулевой байт. -Функция также работает для массивов. - -## notEmpty {#notempty} - -Возвращает 0 для пустой строки, и 1 для непустой строки. -Тип результата — UInt8. -Функция также работает для массивов. - -## length {#length} - -Возвращает длину строки в байтах (не символах, не кодовых точках). -Тип результата — UInt64. -Функция также работает для массивов. - -## lengthUTF8 {#lengthutf8} - -Возвращает длину строки в кодовых точках Unicode (не символах), при допущении, что строка содержит набор байтов, являющийся текстом в кодировке UTF-8. Если допущение не выполнено, то возвращает какой-нибудь результат (не кидает исключение). -Тип результата — UInt64. - -## char\_length, CHAR\_LENGTH {#char-length} - -Возвращает длину строки в кодовых точках Unicode (не символах), при допущении, что строка содержит набор байтов, являющийся текстом в кодировке UTF-8. Если допущение не выполнено, возвращает какой-нибудь результат (не кидает исключение). -Тип результата — UInt64. - -## character\_length, CHARACTER\_LENGTH {#character-length} - -Возвращает длину строки в кодовых точках Unicode (не символах), при допущении, что строка содержит набор байтов, являющийся текстом в кодировке UTF-8. Если допущение не выполнено, возвращает какой-нибудь результат (не кидает исключение). -Тип результата — UInt64. - -## lower, lcase {#lower} - -Переводит ASCII-символы латиницы в строке в нижний регистр. - -## upper, ucase {#upper} - -Переводит ASCII-символы латиницы в строке в верхний регистр. - -## lowerUTF8 {#lowerutf8} - -Переводит строку в нижний регистр, при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. -Не учитывает язык. То есть, для турецкого языка, результат может быть не совсем верным. -Если длина UTF-8 последовательности байтов различна для верхнего и нижнего регистра кодовой точки, то для этой кодовой точки результат работы может быть некорректным. -Если строка содержит набор байтов, не являющийся UTF-8, то поведение не определено. - -## upperUTF8 {#upperutf8} - -Переводит строку в верхний регистр, при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. -Не учитывает язык. То есть, для турецкого языка, результат может быть не совсем верным. -Если длина UTF-8 последовательности байтов различна для верхнего и нижнего регистра кодовой точки, то для этой кодовой точки, результат работы может быть некорректным. -Если строка содержит набор байтов, не являющийся UTF-8, то поведение не определено. - -## isValidUTF8 {#isvalidutf8} - -Возвращает 1, если набор байтов является корректным в кодировке UTF-8, 0 иначе. - -## toValidUTF8 {#tovalidutf8} - -Заменяет некорректные символы UTF-8 на символ `�` (U+FFFD). Все идущие подряд некорректные символы схлопываются в один заменяющий символ. - -``` sql -toValidUTF8( input_string ) -``` - -Параметры: - -- input\_string — произвольный набор байтов, представленный как объект типа [String](../../sql_reference/functions/string_functions.md). - -Возвращаемое значение: Корректная строка UTF-8. - -**Пример** - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## repeat {#repeat} - -Повторяет строку определенное количество раз и объединяет повторяемые значения в одну строку. - -**Синтаксис** - -``` sql -repeat(s, n) -``` - -**Параметры** - -- `s` — Строка для повторения. [String](../../sql_reference/functions/string_functions.md). -- `n` — Количество повторов. [UInt](../../sql_reference/functions/string_functions.md). - -**Возвращаемое значение** - -Строка, состоящая из повторений `n` раз исходной строки `s`. Если `n` \< 1, то функция вернет пустую строку. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT repeat('abc', 10) -``` - -Ответ: - -``` text -┌─repeat('abc', 10)──────────────┐ -│ abcabcabcabcabcabcabcabcabcabc │ -└────────────────────────────────┘ -``` - -## reverse {#reverse} - -Разворачивает строку (как последовательность байтов). - -## reverseUTF8 {#reverseutf8} - -Разворачивает последовательность кодовых точек Unicode, при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. Иначе — что-то делает (не кидает исключение). - -## format(pattern, s0, s1, …) {#format} - -Форматирует константный шаблон со строками, перечисленными в аргументах. `pattern` — упрощенная версия шаблона в языке Python. Шаблон содержит «заменяющие поля», которые окружены фигурными скобками `{}`. Всё, что не содержится в скобках, интерпретируется как обычный текст и просто копируется. Если нужно использовать символ фигурной скобки, можно экранировать двойной скобкой `{{ '{{' }}` или `{{ '}}' }}`. Имя полей могут быть числами (нумерация с нуля) или пустыми (тогда они интерпретируются как последовательные числа). - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') -``` - -``` text -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ -``` - -``` sql -SELECT format('{} {}', 'Hello', 'World') -``` - -``` text -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## concat {#concat} - -Склеивает строки, переданные в аргументы, в одну строку без разделителей. - -**Cинтаксис** - -``` sql -concat(s1, s2, ...) -``` - -**Параметры** - -Значения типа String или FixedString. - -**Возвращаемое значение** - -Возвращает строку, полученную в результате склейки аргументов. - -Если любой из аргументов имеет значение `NULL`, `concat` возвращает значение `NULL`. - -**Пример** - -Запрос: - -``` sql -SELECT concat('Hello, ', 'World!') -``` - -Ответ: - -``` text -┌─concat('Hello, ', 'World!')─┐ -│ Hello, World! │ -└─────────────────────────────┘ -``` - -## concatAssumeInjective {#concatassumeinjective} - -Аналогична [concat](#concat). Разница заключается в том, что вам нужно убедиться, что `concat(s1, s2, ...) → sn` является инъективным, так как это предположение будет использоваться для оптимизации GROUP BY. - -Функция называется «инъективной», если она возвращает разные значения для разных аргументов. Или, иными словами, функция никогда не выдаёт одно и то же значение, если аргументы разные. - -**Синтаксис** - -``` sql -concatAssumeInjective(s1, s2, ...) -``` - -**Параметры** - -Значения типа String или FixedString. - -**Возвращаемые значения** - -Возвращает строку, полученную в результате объединения аргументов. - -Если любой из аргументов имеет значение `NULL`, `concatAssumeInjective` возвращает значение `NULL`. - -**Пример** - -Вводная таблица: - -``` sql -CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog -INSERT INTO key_val VALUES ('Hello, ','World',1)('Hello, ','World',2)('Hello, ','World!',3)('Hello',', World!',2) -SELECT * from key_val -``` - -``` text -┌─key1────┬─key2─────┬─value─┐ -│ Hello, │ World │ 1 │ -│ Hello, │ World │ 2 │ -│ Hello, │ World! │ 3 │ -│ Hello │ , World! │ 2 │ -└─────────┴──────────┴───────┘ -``` - -Запрос: - -``` sql -SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY (key1, key2) -``` - -Ответ: - -``` text -┌─concat(key1, key2)─┬─sum(value)─┐ -│ Hello, World! │ 3 │ -│ Hello, World! │ 2 │ -│ Hello, World │ 3 │ -└────────────────────┴────────────┘ -``` - -## substring(s, offset, length), mid(s, offset, length), substr(s, offset, length) {#substring} - -Возвращает подстроку, начиная с байта по индексу offset, длины length байт. Индексация символов — начиная с единицы (как в стандартном SQL). Аргументы offset и length должны быть константами. - -## substringUTF8(s, offset, length) {#substringutf8} - -Так же, как substring, но для кодовых точек Unicode. Работает при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. Если допущение не выполнено, то возвращает какой-нибудь результат (не кидает исключение). - -## appendTrailingCharIfAbsent(s, c) {#appendtrailingcharifabsent} - -Если строка s непустая и не содержит символ c на конце, то добавляет символ c в конец. - -## convertCharset(s, from, to) {#convertcharset} - -Возвращает сконвертированную из кодировки from в кодировку to строку s. - -## base64Encode(s) {#base64encode} - -Производит кодирование строки s в base64-представление. - -## base64Decode(s) {#base64decode} - -Декодирует base64-представление s в исходную строку. При невозможности декодирования выбрасывает исключение - -## tryBase64Decode(s) {#trybase64decode} - -Функционал аналогичен base64Decode, но при невозможности декодирования возвращает пустую строку. - -## endsWith(s, suffix) {#endswith} - -Возвращает 1, если строка завершается указанным суффиксом, и 0 в противном случае. - -## startsWith(str, prefix) {#startswith} - -Возвращает 1, если строка начинается указанным префиксом, в противном случае 0. - -``` sql -SELECT startsWith('Spider-Man', 'Spi'); -``` - -**Возвращаемые значения** - -- 1, если строка начинается указанным префиксом. -- 0, если строка не начинается указанным префиксом. - -**Пример** - -Запрос: - -``` sql -SELECT startsWith('Hello, world!', 'He'); -``` - -Ответ: - -``` text -┌─startsWith('Hello, world!', 'He')─┐ -│ 1 │ -└───────────────────────────────────┘ -``` - -## trim {#trim} - -Удаляет все указанные символы с начала или окончания строки. -По умолчанию удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с обоих концов строки. - -**Синтаксис** - -``` sql -trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) -``` - -**Параметры** - -- `trim_character` — один или несколько символов, подлежащие удалению. [String](../../sql_reference/functions/string_functions.md). -- `input_string` — строка для обрезки. [String](../../sql_reference/functions/string_functions.md). - -**Возвращаемое значение** - -Исходную строку после обрезки с левого и (или) правого концов строки. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT trim(BOTH ' ()' FROM '( Hello, world! )') -``` - -Ответ: - -``` text -┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ -│ Hello, world! │ -└───────────────────────────────────────────────┘ -``` - -## trimLeft {#trimleft} - -Удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с левого конца строки. Не удаляет другие виды пробелов (табуляция, пробел без разрыва и т. д.). - -**Синтаксис** - -``` sql -trimLeft(input_string) -``` - -Алиас: `ltrim(input_string)`. - -**Параметры** - -- `input_string` — строка для обрезки. [String](../../sql_reference/functions/string_functions.md). - -**Возвращаемое значение** - -Исходную строку без общих пробельных символов слева. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT trimLeft(' Hello, world! ') -``` - -Ответ: - -``` text -┌─trimLeft(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## trimRight {#trimright} - -Удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с правого конца строки. Не удаляет другие виды пробелов (табуляция, пробел без разрыва и т. д.). - -**Синтаксис** - -``` sql -trimRight(input_string) -``` - -Алиас: `rtrim(input_string)`. - -**Параметры** - -- `input_string` — строка для обрезки. [String](../../sql_reference/functions/string_functions.md). - -**Возвращаемое значение** - -Исходную строку без общих пробельных символов справа. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT trimRight(' Hello, world! ') -``` - -Ответ: - -``` text -┌─trimRight(' Hello, world! ')─┐ -│ Hello, world! │ -└──────────────────────────────────────┘ -``` - -## trimBoth {#trimboth} - -Удаляет все последовательные вхождения обычных пробелов (32 символ ASCII) с обоих концов строки. Не удаляет другие виды пробелов (табуляция, пробел без разрыва и т. д.). - -**Синтаксис** - -``` sql -trimBoth(input_string) -``` - -Алиас: `trim(input_string)`. - -**Параметры** - -- `input_string` — строка для обрезки. [String](../../sql_reference/functions/string_functions.md). - -**Возвращаемое значение** - -Исходную строку без общих пробельных символов с обоих концов строки. - -Тип: `String`. - -**Пример** - -Запрос: - -``` sql -SELECT trimBoth(' Hello, world! ') -``` - -Ответ: - -``` text -┌─trimBoth(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## CRC32(s) {#crc32} - -Возвращает чексумму CRC32 данной строки, используется CRC-32-IEEE 802.3 многочлен и начальным значением `0xffffffff` (т.к. используется реализация из zlib). - -Тип результата — UInt32. - -## CRC32IEEE(s) {#crc32ieee} - -Возвращает чексумму CRC32 данной строки, используется CRC-32-IEEE 802.3 многочлен. - -Тип результата — UInt32. - -## CRC64(s) {#crc64} - -Возвращает чексумму CRC64 данной строки, используется CRC-64-ECMA многочлен. - -Тип результата — UInt64. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/string_functions/) diff --git a/docs/ru/sql_reference/functions/type_conversion_functions.md b/docs/ru/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index be4de7e7c89..00000000000 --- a/docs/ru/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,518 +0,0 @@ -# Функции преобразования типов {#funktsii-preobrazovaniia-tipov} - -## Общие проблемы преобразования чисел {#numeric-conversion-issues} - -При преобразовании значения из одного типа в другой необходимо помнить, что в общем случае это небезопасная операция, которая может привести к потере данных. Потеря данных может произойти при попытке сконвертировать тип данных значения от большего к меньшему или при конвертировании между различными классами типов данных. - -Поведение ClickHouse при конвертировании похоже на [поведение C++ программ](https://en.cppreference.com/w/cpp/language/implicit_conversion). - -## toInt(8\|16\|32\|64) {#toint8163264} - -Преобразует входное значение к типу [Int](../../sql_reference/functions/type_conversion_functions.md). Семейство функций включает: - -- `toInt8(expr)` — возвращает значение типа `Int8`. -- `toInt16(expr)` — возвращает значение типа `Int16`. -- `toInt32(expr)` — возвращает значение типа `Int32`. -- `toInt64(expr)` — возвращает значение типа `Int64`. - -**Параметры** - -- `expr` — [выражение](../syntax.md#syntax-expressions) возвращающее число или строку с десятичным представление числа. Бинарное, восьмеричное и шестнадцатеричное представление числа не поддержаны. Ведущие нули обрезаются. - -**Возвращаемое значение** - -Целое число типа `Int8`, `Int16`, `Int32` или `Int64`. - -Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа. - -Поведение функций для аргументов [NaN и Inf](../../sql_reference/functions/type_conversion_functions.md#data_type-float-nan-inf) не определено. При использовании функций помните о возможных проблемах при [преобразовании чисел](#numeric-conversion-issues). - -**Пример** - -``` sql -SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) -``` - -``` text -┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ -│ -9223372036854775808 │ 32 │ 16 │ 8 │ -└──────────────────────┴─────────────┴───────────────┴─────────────┘ -``` - -## toInt(8\|16\|32\|64)OrZero {#toint8163264orzero} - -Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64). Если не удалось - возвращает 0. - -**Пример** - -``` sql -select toInt64OrZero('123123'), toInt8OrZero('123qwe123') -``` - -``` text -┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ -│ 123123 │ 0 │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toInt(8\|16\|32\|64)OrNull {#toint8163264ornull} - -Принимает аргумент типа String и пытается его распарсить в Int(8\|16\|32\|64). Если не удалось - возвращает NULL. - -**Пример** - -``` sql -select toInt64OrNull('123123'), toInt8OrNull('123qwe123') -``` - -``` text -┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ -│ 123123 │ ᴺᵁᴸᴸ │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toUInt(8\|16\|32\|64) {#touint8163264} - -Преобраует входное значение к типу [UInt](../../sql_reference/functions/type_conversion_functions.md). Семейство функций включает: - -- `toUInt8(expr)` — возвращает значение типа `UInt8`. -- `toUInt16(expr)` — возвращает значение типа `UInt16`. -- `toUInt32(expr)` — возвращает значение типа `UInt32`. -- `toUInt64(expr)` — возвращает значение типа `UInt64`. - -**Параметры** - -- `expr` — [выражение](../syntax.md#syntax-expressions) возвращающее число или строку с десятичным представление числа. Бинарное, восьмеричное и шестнадцатеричное представление числа не поддержаны. Ведущие нули обрезаются. - -**Возвращаемое значение** - -Целое число типа `UInt8`, `UInt16`, `UInt32` или `UInt64`. - -Функции используют [округление к нулю](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), т.е. обрезают дробную часть числа. - -Поведение функций для аргументов [NaN и Inf](../../sql_reference/functions/type_conversion_functions.md#data_type-float-nan-inf) не определено. Если передать строку, содержащую отрицательное число, например `'-32'`, ClickHouse генерирует исключение. При использовании функций помните о возможных проблемах при [преобразовании чисел](#numeric-conversion-issues). - -**Пример** - -``` sql -SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) -``` - -``` text -┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ -│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ -└─────────────────────┴───────────────┴────────────────┴──────────────┘ -``` - -## toUInt(8\|16\|32\|64)OrZero {#touint8163264orzero} - -## toUInt(8\|16\|32\|64)OrNull {#touint8163264ornull} - -## toFloat(32\|64) {#tofloat3264} - -## toFloat(32\|64)OrZero {#tofloat3264orzero} - -## toFloat(32\|64)OrNull {#tofloat3264ornull} - -## toDate {#todate} - -## toDateOrZero {#todateorzero} - -## toDateOrNull {#todateornull} - -## toDateTime {#todatetime} - -## toDateTimeOrZero {#todatetimeorzero} - -## toDateTimeOrNull {#todatetimeornull} - -## toDecimal(32\|64\|128) {#todecimal3264128} - -Преобразует `value` к типу данных [Decimal](../../sql_reference/functions/type_conversion_functions.md) с точностью `S`. `value` может быть числом или строкой. Параметр `S` (scale) задаёт число десятичных знаков. - -- `toDecimal32(value, S)` -- `toDecimal64(value, S)` -- `toDecimal128(value, S)` - -## toDecimal(32\|64\|128)OrNull {#todecimal3264128ornull} - -Преобразует входную строку в значение с типом данных [Nullable (Decimal (P, S))](../../sql_reference/functions/type_conversion_functions.md). Семейство функций включает в себя: - -- `toDecimal32OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal32(S))`. -- `toDecimal64OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal64(S))`. -- `toDecimal128OrNull(expr, S)` — Возвращает значение типа `Nullable(Decimal128(S))`. - -Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `NULL` вместо исключения. - -**Параметры** - -- `expr` — [выражение](../syntax.md#syntax-expressions), возвращающее значение типа [String](../../sql_reference/functions/type_conversion_functions.md). ClickHouse ожидает текстовое представление десятичного числа. Например, `'1.111'`. -- `S` — количество десятичных знаков в результирующем значении. - -**Возвращаемое значение** - -Значение типа `Nullable(Decimal(P,S))`. Значение содержит: - -- Число с `S` десятичными знаками, если ClickHouse распознал число во входной строке. -- `NULL`, если ClickHouse не смог распознать число во входной строке или входное число содержит больше чем `S` десятичных знаков. - -**Примеры** - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ -│ -1.11100 │ Nullable(Decimal(9, 5)) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ -│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toDecimal(32\|64\|128)OrZero {#todecimal3264128orzero} - -Преобразует тип входного значения в [Decimal (P, S)](../../sql_reference/functions/type_conversion_functions.md). Семейство функций включает в себя: - -- `toDecimal32OrZero( expr, S)` — возвращает значение типа `Decimal32(S)`. -- `toDecimal64OrZero( expr, S)` — возвращает значение типа `Decimal64(S)`. -- `toDecimal128OrZero( expr, S)` — возвращает значение типа `Decimal128(S)`. - -Эти функции следует использовать вместо функций `toDecimal*()`, если при ошибке обработки входного значения вы хотите получать `0` вместо исключения. - -**Параметры** - -- `expr` — [выражение](../syntax.md#syntax-expressions), возвращающее значение типа [String](../../sql_reference/functions/type_conversion_functions.md). ClickHouse ожидает текстовое представление десятичного числа. Например, `'1.111'`. -- `S` — количество десятичных знаков в результирующем значении. - -**Возвращаемое значение** - -Значение типа `Nullable(Decimal(P,S))`. `P` равно числовой части имени функции. Например, для функции `toDecimal32OrZero`, `P = 32`. Значение содержит: - -- Число с `S` десятичными знаками, если ClickHouse распознал число во входной строке. -- 0 c `S` десятичными знаками, если ClickHouse не смог распознать число во входной строке или входное число содержит больше чем `S` десятичных знаков. - -**Пример** - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ -│ -1.11100 │ Decimal(9, 5) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ -│ 0.00 │ Decimal(9, 2) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toString {#tostring} - -Функции преобразования между числами, строками (но не фиксированными строками), датами и датами-с-временем. -Все эти функции принимают один аргумент. - -При преобразовании в строку или из строки, производится форматирование или парсинг значения по тем же правилам, что и для формата TabSeparated (и почти всех остальных текстовых форматов). Если распарсить строку не удаётся - кидается исключение и выполнение запроса прерывается. - -При преобразовании даты в число или наоборот, дате соответствует число дней от начала unix эпохи. -При преобразовании даты-с-временем в число или наоборот, дате-с-временем соответствует число секунд от начала unix эпохи. - -Форматы даты и даты-с-временем для функций toDate/toDateTime определены следующим образом: - -``` text -YYYY-MM-DD -YYYY-MM-DD hh:mm:ss -``` - -В качестве исключения, если делается преобразование из числа типа UInt32, Int32, UInt64, Int64 в Date, и если число больше или равно 65536, то число рассматривается как unix timestamp (а не как число дней) и округляется до даты. Это позволяет поддержать распространённый случай, когда пишут toDate(unix\_timestamp), что иначе было бы ошибкой и требовало бы написания более громоздкого toDate(toDateTime(unix\_timestamp)) - -Преобразование между датой и датой-с-временем производится естественным образом: добавлением нулевого времени или отбрасыванием времени. - -Преобразование между числовыми типами производится по тем же правилам, что и присваивание между разными числовыми типами в C++. - -Дополнительно, функция toString от аргумента типа DateTime может принимать второй аргумент String - имя тайм-зоны. Пример: `Asia/Yekaterinburg` В этом случае, форматирование времени производится согласно указанной тайм-зоне. - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - -``` text -┌───────────now_local─┬─now_yekat───────────┐ -│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ -└─────────────────────┴─────────────────────┘ -``` - -Также смотрите функцию `toUnixTimestamp`. - -## toFixedString(s, N) {#tofixedstrings-n} - -Преобразует аргумент типа String в тип FixedString(N) (строку фиксированной длины N). N должно быть константой. -Если строка имеет меньше байт, чем N, то она дополняется нулевыми байтами справа. Если строка имеет больше байт, чем N - кидается исключение. - -## toStringCutToZero(s) {#tostringcuttozeros} - -Принимает аргумент типа String или FixedString. Возвращает String, вырезая содержимое строки до первого найденного нулевого байта. - -Пример: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s─────────────┬─s_cut─┐ -│ foo\0\0\0\0\0 │ foo │ -└───────────────┴───────┘ -``` - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s──────────┬─s_cut─┐ -│ foo\0bar\0 │ foo │ -└────────────┴───────┘ -``` - -## reinterpretAsUInt(8\|16\|32\|64) {#reinterpretasuint8163264} - -## reinterpretAsInt(8\|16\|32\|64) {#reinterpretasint8163264} - -## reinterpretAsFloat(32\|64) {#reinterpretasfloat3264} - -## reinterpretAsDate {#reinterpretasdate} - -## reinterpretAsDateTime {#reinterpretasdatetime} - -Функции принимают строку и интерпретируют байты, расположенные в начале строки, как число в host order (little endian). Если строка имеет недостаточную длину, то функции работают так, как будто строка дополнена необходимым количеством нулевых байт. Если строка длиннее, чем нужно, то лишние байты игнорируются. Дата интерпретируется, как число дней с начала unix-эпохи, а дата-с-временем - как число секунд с начала unix-эпохи. - -## reinterpretAsString {#type_conversion_functions-reinterpretAsString} - -Функция принимает число или дату или дату-с-временем и возвращает строку, содержащую байты, представляющие соответствующее значение в host order (little endian). При этом, отбрасываются нулевые байты с конца. Например, значение 255 типа UInt32 будет строкой длины 1 байт. - -## CAST(x, t) {#type_conversion_function-cast} - -Преобразует x в тип данных t. -Поддерживается также синтаксис CAST(x AS t). - -Пример: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - -``` text -┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ -└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ -``` - -Преобразование в FixedString(N) работает только для аргументов типа String или FixedString(N). - -Поддержано преобразование к типу [Nullable](../../sql_reference/functions/type_conversion_functions.md) и обратно. Пример: - -``` sql -SELECT toTypeName(x) FROM t_null -``` - -``` text -┌─toTypeName(x)─┐ -│ Int8 │ -│ Int8 │ -└───────────────┘ -``` - -``` sql -SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null -``` - -``` text -┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ -│ Nullable(UInt16) │ -│ Nullable(UInt16) │ -└─────────────────────────────────────────┘ -``` - -## toInterval(Year\|Quarter\|Month\|Week\|Day\|Hour\|Minute\|Second) {#function-tointerval} - -Приводит аргумент из числового типа данных к типу данных [IntervalType](../../sql_reference/functions/type_conversion_functions.md). - -**Синтаксис** - -``` sql -toIntervalSecond(number) -toIntervalMinute(number) -toIntervalHour(number) -toIntervalDay(number) -toIntervalWeek(number) -toIntervalMonth(number) -toIntervalQuarter(number) -toIntervalYear(number) -``` - -**Параметры** - -- `number` — длительность интервала. Положительное целое число. - -**Возвращаемые значения** - -- Значение с типом данных `Interval`. - -**Пример** - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - -``` text -┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ -│ 2019-01-08 │ 2019-01-08 │ -└───────────────────────────┴──────────────────────────────┘ -``` - -## parseDateTimeBestEffort {#parsedatetimebesteffort} - -Преобразует дату и время в [строковом](../../sql_reference/functions/type_conversion_functions.md) представлении к типу данных [DateTime](../../sql_reference/functions/type_conversion_functions.md#data_type-datetime). - -Функция распознаёт форматы [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 а также некоторые другие форматы. - -**Синтаксис** - -```sql -parseDateTimeBestEffort(time_string[, time_zone]); -``` - -**Параметры** - -- `time_string` — строка, содержащая дату и время для преобразования. [String](../../sql_reference/functions/type_conversion_functions.md). -- `time_zone` — часовой пояс. Функция анализирует `time_string` в соответствии с заданным часовым поясом. [String](../../sql_reference/functions/type_conversion_functions.md). - -**Поддерживаемые нестандартные форматы** - -- [Unix timestamp](https://ru.wikipedia.org/wiki/Unix-время) в строковом представлении. 9 или 10 символов. -- Строка с датой и временем: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss`, etc. -- Строка с датой, но без времени: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` и т.д. -- Строка с временем, и с днём: `DD`, `DD hh`, `DD hh:mm`. В этом случае `YYYY-MM` принимается равным `2000-01`. -- Строка, содержащая дату и время вместе с информацией о часовом поясе: `YYYY-MM-DD hh:mm:ss ±h:mm`, и т.д. Например, `2020-12-12 17:36:00 -5:00`. - -Для всех форматов с разделителями функция распознаёт названия месяцев, выраженных в виде полного англоязычного имени месяца или в виде первых трёх символов имени месяца. Примеры: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. - - -**Возвращаемое значение** - -- `time_string` преобразованная к типу данных `DateTime`. - -**Примеры** - -Запрос: - -```sql -SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') -AS parseDateTimeBestEffort; -``` - -Результат: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2020-12-12 12:12:57 │ -└─────────────────────────┘ -``` - -Запрос: - -```sql -SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') -AS parseDateTimeBestEffort -``` - -Результат: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2018-08-18 10:22:16 │ -└─────────────────────────┘ -``` - -Запрос: - -```sql -SELECT parseDateTimeBestEffort('1284101485') -AS parseDateTimeBestEffort -``` - -Результат: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2015-07-07 12:04:41 │ -└─────────────────────────┘ -``` - -Запрос: - -```sql -SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') -AS parseDateTimeBestEffort -``` - -Результат: - -```text -┌─parseDateTimeBestEffort─┐ -│ 2018-12-12 10:12:12 │ -└─────────────────────────┘ -``` - -Запрос: - -```sql -SELECT parseDateTimeBestEffort('10 20:19') -``` - -Результат: - -```text -┌─parseDateTimeBestEffort('10 20:19')─┐ -│ 2000-01-10 20:19:00 │ -└─────────────────────────────────────┘ -``` - -**См. также** - -- [Информация о формате ISO 8601 от @xkcd](https://xkcd.com/1179/) -- [RFC 1123](https://tools.ietf.org/html/rfc1123) -- [toDate](#todate) -- [toDateTime](#todatetime) - - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/type_conversion_functions/) diff --git a/docs/ru/sql_reference/functions/url_functions.md b/docs/ru/sql_reference/functions/url_functions.md deleted file mode 100644 index f024cfdcfd9..00000000000 --- a/docs/ru/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,201 +0,0 @@ -# Функции для работы с URL {#funktsii-dlia-raboty-s-url} - -Все функции работают не по RFC - то есть, максимально упрощены ради производительности. - -## Функции, извлекающие часть URL-а. {#funktsii-izvlekaiushchie-chast-url-a} - -Если в URL-е нет ничего похожего, то возвращается пустая строка. - -### protocol {#protocol} - -Возвращает протокол. Примеры: http, ftp, mailto, magnet… - -### domain {#domain} - -Извлекает имя хоста из URL. - -``` sql -domain(url) -``` - -**Параметры** - -- `url` — URL. Тип — [String](../../sql_reference/functions/url_functions.md). - -URL может быть указан со схемой или без неё. Примеры: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -Для указанных примеров функция `domain` возвращает следующие результаты: - -``` text -some.svn-hosting.com -some.svn-hosting.com -yandex.com -``` - -**Возвращаемые значения** - -- Имя хоста. Если ClickHouse может распарсить входную строку как URL. -- Пустая строка. Если ClickHouse не может распарсить входную строку как URL. - -Тип — `String`. - -**Пример** - -``` sql -SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ -│ some.svn-hosting.com │ -└────────────────────────────────────────────────────────┘ -``` - -### domainWithoutWWW {#domainwithoutwww} - -Возвращает домен, удалив префикс ‘www.’, если он присутствовал. - -### topLevelDomain {#topleveldomain} - -Извлекает домен верхнего уровня из URL. - -``` sql -topLevelDomain(url) -``` - -**Параметры** - -- `url` — URL. Тип — [String](../../sql_reference/functions/url_functions.md). - -URL может быть указан со схемой или без неё. Примеры: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -**Возвращаемые значения** - -- Имя домена. Если ClickHouse может распарсить входную строку как URL. -- Пустая строка. Если ClickHouse не может распарсить входную строку как URL. - -Тип — `String`. - -**Пример** - -``` sql -SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ -│ com │ -└────────────────────────────────────────────────────────────────────┘ -``` - -### firstSignificantSubdomain {#firstsignificantsubdomain} - -Возвращает «первый существенный поддомен». Это понятие является нестандартным и специфично для Яндекс.Метрики. Первый существенный поддомен - это домен второго уровня, если он не равен одному из com, net, org, co, или домен третьего уровня, иначе. Например, firstSignificantSubdomain(‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain(‘https://news.yandex.com.tr/’) = ‘yandex’. Список «несущественных» доменов второго уровня и другие детали реализации могут изменяться в будущем. - -### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} - -Возвращает часть домена, включающую поддомены верхнего уровня до «первого существенного поддомена» (см. выше). - -Например, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### path {#path} - -Возвращает путь. Пример: `/top/news.html` Путь не включает в себя query string. - -### pathFull {#pathfull} - -То же самое, но включая query string и fragment. Пример: /top/news.html?page=2\#comments - -### queryString {#querystring} - -Возвращает query-string. Пример: page=1&lr=213. query-string не включает в себя начальный знак вопроса, а также \# и всё, что после \#. - -### fragment {#fragment} - -Возвращает fragment identifier. fragment не включает в себя начальный символ решётки. - -### queryStringAndFragment {#querystringandfragment} - -Возвращает query string и fragment identifier. Пример: страница=1\#29390. - -### extractURLParameter(URL, name) {#extracturlparameterurl-name} - -Возвращает значение параметра name в URL, если такой есть; или пустую строку, иначе; если параметров с таким именем много - вернуть первый попавшийся. Функция работает при допущении, что имя параметра закодировано в URL в точности таким же образом, что и в переданном аргументе. - -### extractURLParameters(URL) {#extracturlparametersurl} - -Возвращает массив строк вида name=value, соответствующих параметрам URL. Значения никак не декодируются. - -### extractURLParameterNames(URL) {#extracturlparameternamesurl} - -Возвращает массив строк вида name, соответствующих именам параметров URL. Значения никак не декодируются. - -### URLHierarchy(URL) {#urlhierarchyurl} - -Возвращает массив, содержащий URL, обрезанный с конца по символам /, ? в пути и query-string. Подряд идущие символы-разделители считаются за один. Резка производится в позиции после всех подряд идущих символов-разделителей. Пример: - -### URLPathHierarchy(URL) {#urlpathhierarchyurl} - -То же самое, но без протокола и хоста в результате. Элемент / (корень) не включается. Пример: -Функция используется для реализации древовидных отчётов по URL в Яндекс.Метрике. - -``` text -URLPathHierarchy('https://example.com/browse/CONV-6788') = -[ - '/browse/', - '/browse/CONV-6788' -] -``` - -### decodeURLComponent(URL) {#decodeurlcomponenturl} - -Возвращает декодированный URL. -Пример: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - -``` text -┌─DecodedURL─────────────────────────────┐ -│ http://127.0.0.1:8123/?query=SELECT 1; │ -└────────────────────────────────────────┘ -``` - -## Функции, удаляющие часть из URL-а {#funktsii-udaliaiushchie-chast-iz-url-a} - -Если в URL-е нет ничего похожего, то URL остаётся без изменений. - -### cutWWW {#cutwww} - -Удаляет не более одного ‘www.’ с начала домена URL-а, если есть. - -### cutQueryString {#cutquerystring} - -Удаляет query string. Знак вопроса тоже удаляется. - -### cutFragment {#cutfragment} - -Удаляет fragment identifier. Символ решётки тоже удаляется. - -### cutQueryStringAndFragment {#cutquerystringandfragment} - -Удаляет query string и fragment identifier. Знак вопроса и символ решётки тоже удаляются. - -### cutURLParameter(URL, name) {#cuturlparameterurl-name} - -Удаляет параметр URL с именем name, если такой есть. Функция работает при допущении, что имя параметра закодировано в URL в точности таким же образом, что и в переданном аргументе. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/url_functions/) diff --git a/docs/ru/sql_reference/functions/uuid_functions.md b/docs/ru/sql_reference/functions/uuid_functions.md deleted file mode 100644 index 960e2b10e80..00000000000 --- a/docs/ru/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,114 +0,0 @@ -# Функции для работы с UUID {#funktsii-dlia-raboty-s-uuid} - -## generateUUIDv4 {#uuid-function-generate} - -Генерирует идентификатор [UUID версии 4](https://tools.ietf.org/html/rfc4122#section-4.4). - -``` sql -generateUUIDv4() -``` - -**Возвращаемое значение** - -Значение типа [UUID](../../sql_reference/functions/uuid_functions.md). - -**Пример использования** - -Этот пример демонстрирует, как создать таблицу с UUID-колонкой и добавить в нее сгенерированный UUID. - -``` sql -CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -INSERT INTO t_uuid SELECT generateUUIDv4() - -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## toUUID (x) {#touuid-x} - -Преобразует значение типа String в тип UUID. - -``` sql -toUUID(String) -``` - -**Возвращаемое значение** - -Значение типа UUID. - -**Пример использования** - -``` sql -SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid -``` - -``` text -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## UUIDStringToNum {#uuidstringtonum} - -Принимает строку, содержащую 36 символов в формате `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, и возвращает в виде набора байт в [FixedString(16)](../../sql_reference/functions/uuid_functions.md). - -``` sql -UUIDStringToNum(String) -``` - -**Возвращаемое значение** - -FixedString(16) - -**Пример использования** - -``` sql -SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes -``` - -``` text -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## UUIDNumToString {#uuidnumtostring} - -Принимает значение типа [FixedString(16)](../../sql_reference/functions/uuid_functions.md). Возвращает строку из 36 символов в текстовом виде. - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**Возвращаемое значение** - -Значение типа String. - -**Пример использования** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid -``` - -``` text -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## См. также: {#sm-takzhe} - -- [dictGetUUID](ext_dict_functions.md) -- [dictGetUUIDOrDefault](ext_dict_functions.md) - -[Original article](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/ru/sql_reference/functions/ym_dict_functions.md b/docs/ru/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index 5d7aece88b9..00000000000 --- a/docs/ru/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,149 +0,0 @@ -# Функции для работы со словарями Яндекс.Метрики {#ym-dict-functions} - -Чтобы указанные ниже функции работали, в конфиге сервера должны быть указаны пути и адреса для получения всех словарей Яндекс.Метрики. Словари загружаются при первом вызове любой из этих функций. Если справочники не удаётся загрузить - будет выкинуто исключение. - -О том, как создать справочники, смотрите в разделе «Словари». - -## Множественные геобазы {#mnozhestvennye-geobazy} - -ClickHouse поддерживает работу одновременно с несколькими альтернативными геобазами (иерархиями регионов), для того чтобы можно было поддержать разные точки зрения о принадлежности регионов странам. - -В конфиге clickhouse-server указывается файл с иерархией регионов: -`/opt/geo/regions_hierarchy.txt` - -Кроме указанного файла, рядом ищутся файлы, к имени которых (до расширения) добавлен символ \_ и какой угодно суффикс. -Например, также найдётся файл `/opt/geo/regions_hierarchy_ua.txt`, если такой есть. - -`ua` называется ключом словаря. Для словаря без суффикса, ключ является пустой строкой. - -Все словари перезагружаются в рантайме (раз в количество секунд, заданное в конфигурационном параметре builtin\_dictionaries\_reload\_interval, по умолчанию - раз в час), но перечень доступных словарей определяется один раз, при старте сервера. - -Во все функции по работе с регионами, в конце добавлен один необязательный аргумент - ключ словаря. Далее он обозначен как geobase. -Пример: - -``` text -regionToCountry(RegionID) - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt; -regionToCountry(RegionID, '') - использует словарь по умолчанию: /opt/geo/regions_hierarchy.txt; -regionToCountry(RegionID, 'ua') - использует словарь для ключа ua: /opt/geo/regions_hierarchy_ua.txt; -``` - -### regionToCity(id\[, geobase\]) {#regiontocityid-geobase} - -Принимает число типа UInt32 - идентификатор региона из геобазы Яндекса. Если регион является городом или входит в некоторый город, то возвращает идентификатор региона - соответствующего города. Иначе возвращает 0. - -### regionToArea(id\[, geobase\]) {#regiontoareaid-geobase} - -Переводит регион в область (тип в геобазе - 5). В остальном, аналогично функции regionToCity. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ -│ │ -│ Москва и Московская область │ -│ Санкт-Петербург и Ленинградская область │ -│ Белгородская область │ -│ Ивановская область │ -│ Калужская область │ -│ Костромская область │ -│ Курская область │ -│ Липецкая область │ -│ Орловская область │ -│ Рязанская область │ -│ Смоленская область │ -│ Тамбовская область │ -│ Тверская область │ -│ Тульская область │ -└──────────────────────────────────────────────────────┘ -``` - -### regionToDistrict(id\[, geobase\]) {#regiontodistrictid-geobase} - -Переводит регион в федеральный округ (тип в геобазе - 4). В остальном, аналогично функции regionToCity. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ -│ │ -│ Центральный федеральный округ │ -│ Северо-Западный федеральный округ │ -│ Южный федеральный округ │ -│ Северо-Кавказский федеральный округ │ -│ Приволжский федеральный округ │ -│ Уральский федеральный округ │ -│ Сибирский федеральный округ │ -│ Дальневосточный федеральный округ │ -│ Шотландия │ -│ Фарерские острова │ -│ Фламандский регион │ -│ Брюссельский столичный регион │ -│ Валлония │ -│ Федерация Боснии и Герцеговины │ -└──────────────────────────────────────────────────────────┘ -``` - -### regionToCountry(id\[, geobase\]) {#regiontocountryid-geobase} - -Переводит регион в страну. В остальном, аналогично функции regionToCity. -Пример: `regionToCountry(toUInt32(213)) = 225` - преобразовали Москву (213) в Россию (225). - -### regionToContinent(id\[, geobase\]) {#regiontocontinentid-geobase} - -Переводит регион в континент. В остальном, аналогично функции regionToCity. -Пример: `regionToContinent(toUInt32(213)) = 10001` - преобразовали Москву (213) в Евразию (10001). - -### regionToTopContinent (#regiontotopcontinent) - -Находит для региона верхний в иерархии континент. - -**Синтаксис** - -```sql -regionToTopContinent(id[, geobase]); -``` - -**Параметры** - -- `id` — Идентификатор региона из геобазы Яндекса. [UInt32](../../sql_reference/functions/ym_dict_functions.md). -- `geobase` — Ключ словаря. Смотрите [Множественные геобазы](#multiple-geobases). [String](../../sql_reference/functions/ym_dict_functions.md). Опциональный параметр. - -**Возвращаемое значение** - -- Идентификатор континента верхнего уровня (последний при подъеме по иерархии регионов). -- 0, если его нет. - -Тип: `UInt32`. - -### regionToPopulation(id\[, geobase\]) {#regiontopopulationid-geobase} - -Получает население для региона. -Население может быть прописано в файлах с геобазой. Смотрите в разделе «Встроенные словари». -Если для региона не прописано население, возвращается 0. -В геобазе Яндекса, население может быть прописано для дочерних регионов, но не прописано для родительских. - -### regionIn(lhs, rhs\[, geobase\]) {#regioninlhs-rhs-geobase} - -Проверяет принадлежность региона lhs региону rhs. Возвращает число типа UInt8, равное 1, если принадлежит и 0, если не принадлежит. -Отношение рефлексивное - любой регион принадлежит также самому себе. - -### regionHierarchy(id\[, geobase\]) {#regionhierarchyid-geobase} - -Принимает число типа UInt32 - идентификатор региона из геобазы Яндекса. Возвращает массив идентификаторов регионов, состоящий из переданного региона и всех родителей по цепочке. -Пример: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### regionToName(id\[, lang\]) {#regiontonameid-lang} - -Принимает число типа UInt32 - идентификатор региона из геобазы Яндекса. Вторым аргументом может быть передана строка - название языка. Поддерживаются языки ru, en, ua, uk, by, kz, tr. Если второй аргумент отсутствует - используется язык ru. Если язык не поддерживается - кидается исключение. Возвращает строку - название региона на соответствующем языке. Если региона с указанным идентификатором не существует - возвращается пустая строка. - -`ua` и `uk` обозначают одно и то же - украинский язык. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/functions/ym_dict_functions/) diff --git a/docs/ru/sql_reference/index.md b/docs/ru/sql_reference/index.md deleted file mode 100644 index ca21b0df3ed..00000000000 --- a/docs/ru/sql_reference/index.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -toc_folder_title: Справка по SQL -toc_hidden: true -toc_priority: 28 -toc_title: hidden ---- - -# Справка по SQL {#spravka-po-sql} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md) -- [Прочие виды запросов](statements/misc.md) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/) diff --git a/docs/ru/sql_reference/operators.md b/docs/ru/sql_reference/operators.md deleted file mode 100644 index 2cff1ad6aed..00000000000 --- a/docs/ru/sql_reference/operators.md +++ /dev/null @@ -1,271 +0,0 @@ -# Операторы {#operatory} - -Все операторы преобразуются в соответствующие функции на этапе парсинга запроса, с учётом их приоритетов и ассоциативности. -Далее будут перечислены группы операторов в порядке их приоритета (чем выше, тем раньше оператор связывается со своими аргументами). - -## Операторы доступа {#operatory-dostupa} - -`a[N]` - доступ к элементу массива, функция `arrayElement(a, N)`. - -`a.N` - доступ к элементу кортежа, функция `tupleElement(a, N)`. - -## Оператор числового отрицания {#operator-chislovogo-otritsaniia} - -`-a` - функция `negate(a)`. - -## Операторы умножения и деления {#operatory-umnozheniia-i-deleniia} - -`a * b` - функция `multiply(a, b)` - -`a / b` - функция `divide(a, b)` - -`a % b` - функция `modulo(a, b)` - -## Операторы сложения и вычитания {#operatory-slozheniia-i-vychitaniia} - -`a + b` - функция `plus(a, b)` - -`a - b` - функция `minus(a, b)` - -## Операторы сравнения {#operatory-sravneniia} - -`a = b` - функция `equals(a, b)` - -`a == b` - функция `equals(a, b)` - -`a != b` - функция `notEquals(a, b)` - -`a <> b` - функция `notEquals(a, b)` - -`a <= b` - функция `lessOrEquals(a, b)` - -`a >= b` - функция `greaterOrEquals(a, b)` - -`a < b` - функция `less(a, b)` - -`a > b` - функция `greater(a, b)` - -`a LIKE s` - функция `like(a, b)` - -`a NOT LIKE s` - функция `notLike(a, b)` - -`a BETWEEN b AND c` - равнозначно `a >= b AND a <= c` - -`a NOT BETWEEN b AND c` - равнозначно `a < b OR a > c` - -## Операторы для работы с множествами {#operatory-dlia-raboty-s-mnozhestvami} - -*Смотрите раздел [Операторы IN](../sql_reference/statements/select.md#select-in-operators).* - -`a IN ...` - функция `in(a, b)` - -`a NOT IN ...` - функция `notIn(a, b)` - -`a GLOBAL IN ...` - функция `globalIn(a, b)` - -`a GLOBAL NOT IN ...` - функция `globalNotIn(a, b)` - -## Оператор для работы с датами и временем {#operators-datetime} - -### EXTRACT {#extract} - -``` sql -EXTRACT(part FROM date); -``` - -Позволяет извлечь отдельные части из переданной даты. Например, можно получить месяц из даты, или минуты из времени. - -В параметре `part` указывается, какой фрагмент даты нужно получить. Доступные значения: - -- `DAY` — День. Возможные значения: 1–31. -- `MONTH` — Номер месяца. Возможные значения: 1–12. -- `YEAR` — Год. -- `SECOND` — Секунда. Возможные значения: 0–59. -- `MINUTE` — Минута. Возможные значения: 0–59. -- `HOUR` — Час. Возможные значения: 0–23. - -Эти значения могут быть указаны также в нижнем регистре (`day`, `month`). - -В параметре `date` указывается исходная дата. Поддерживаются типы [Date](../sql_reference/data_types/date.md) и [DateTime](../sql_reference/data_types/datetime.md). - -Примеры: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -В следующем примере создадим таблицу и добавим в неё значение с типом `DateTime`. - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -Больше примеров приведено в [тестах](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -Создаёт значение типа [Interval](../sql_reference/operators.md) которое должно использоваться в арифметических операциях со значениями типов [Date](../sql_reference/operators.md) и [DateTime](../sql_reference/operators.md). - -Типы интервалов: -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -!!! warning "Внимание" - Интервалы различных типов нельзя объединять. Нельзя использовать выражения вида `INTERVAL 4 DAY 1 HOUR`. Вместо этого интервалы можно выразить в единицах меньших или равных наименьшей единице интервала, Например, `INTERVAL 25 HOUR`. Также можно выполнять последовательные операции как показано в примере ниже. - -Пример: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**Смотрите также** - -- Тип данных [Interval](../sql_reference/operators.md) -- Функции преобразования типов [toInterval](../sql_reference/operators.md#function-tointerval) - -## Оператор логического отрицания {#operator-logicheskogo-otritsaniia} - -`NOT a` - функция `not(a)` - -## Оператор логического ‘И’ {#operator-logicheskogo-i} - -`a AND b` - функция `and(a, b)` - -## Оператор логического ‘ИЛИ’ {#operator-logicheskogo-ili} - -`a OR b` - функция `or(a, b)` - -## Условный оператор {#uslovnyi-operator} - -`a ? b : c` - функция `if(a, b, c)` - -Примечание: - -Условный оператор сначала вычисляет значения b и c, затем проверяет выполнение условия a, и только после этого возвращает соответствующее значение. Если в качестве b или с выступает функция [arrayJoin()](../sql_reference/operators.md#functions_arrayjoin), то размножение каждой строки произойдет вне зависимости от условия а. - -## Условное выражение {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -В случае указания `x` - функция `transform(x, [a, ...], [b, ...], c)`. Иначе — `multiIf(a, b, ..., c)`. -При отсутствии секции `ELSE c`, значением по умолчанию будет `NULL`. - -!!! note "Примечание" - Функция `transform` не умеет работать с `NULL`. - -## Оператор склеивания строк {#operator-skleivaniia-strok} - -`s1 || s2` - функция `concat(s1, s2)` - -## Оператор создания лямбда-выражения {#operator-sozdaniia-liambda-vyrazheniia} - -`x -> expr` - функция `lambda(x, expr)` - -Следующие операторы не имеют приоритета, так как представляют собой скобки: - -## Оператор создания массива {#operator-sozdaniia-massiva} - -`[x1, ...]` - функция `array(x1, ...)` - -## Оператор создания кортежа {#operator-sozdaniia-kortezha} - -`(x1, x2, ...)` - функция `tuple(x2, x2, ...)` - -## Ассоциативность {#assotsiativnost} - -Все бинарные операторы имеют левую ассоциативность. Например, `1 + 2 + 3` преобразуется в `plus(plus(1, 2), 3)`. -Иногда это работает не так, как ожидается. Например, `SELECT 4 > 3 > 2` выдаст 0. - -Для эффективности, реализованы функции `and` и `or`, принимающие произвольное количество аргументов. Соответствующие цепочки операторов `AND` и `OR`, преобразуются в один вызов этих функций. - -## Проверка на `NULL` {#proverka-na-null} - -ClickHouse поддерживает операторы `IS NULL` и `IS NOT NULL`. - -### IS NULL {#operator-is-null} - -- Для значений типа [Nullable](../sql_reference/operators.md) оператор `IS NULL` возвращает: - - `1`, если значение — `NULL`. - - `0` в обратном случае. -- Для прочих значений оператор `IS NULL` всегда возвращает `0`. - - - -``` sql -SELECT x+100 FROM t_null WHERE y IS NULL -``` - -``` text -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ -``` - -### IS NOT NULL {#is-not-null} - -- Для значений типа [Nullable](../sql_reference/operators.md) оператор `IS NOT NULL` возвращает: - - `0`, если значение — `NULL`. - - `1`, в обратном случае. -- Для прочих значений оператор `IS NOT NULL` всегда возвращает `1`. - - - -``` sql -SELECT * FROM t_null WHERE y IS NOT NULL -``` - -``` text -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/operators/) diff --git a/docs/ru/sql_reference/statements/alter.md b/docs/ru/sql_reference/statements/alter.md deleted file mode 100644 index 5c08d68623e..00000000000 --- a/docs/ru/sql_reference/statements/alter.md +++ /dev/null @@ -1,505 +0,0 @@ ---- -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -Запрос `ALTER` поддерживается только для таблиц типа `*MergeTree`, а также `Merge` и `Distributed`. Запрос имеет несколько вариантов. - -### Манипуляции со столбцами {#manipuliatsii-so-stolbtsami} - -Изменение структуры таблицы. - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -В запросе указывается список из одного или более действий через запятую. -Каждое действие — операция над столбцом. - -Существуют следующие действия: - -- [ADD COLUMN](#alter_add-column) — добавляет столбец в таблицу; -- [DROP COLUMN](#alter_drop-column) — удаляет столбец; -- [CLEAR COLUMN](#alter_clear-column) — сбрасывает все значения в столбце для заданной партиции; -- [COMMENT COLUMN](#alter_comment-column) — добавляет комментарий к столбцу; -- [MODIFY COLUMN](#alter_modify-column) — изменяет тип столбца, выражение для значения по умолчанию и TTL. - -Подробное описание для каждого действия приведено ниже. - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -Добавляет в таблицу новый столбец с именем `name`, типом `type`, [кодеком](create.md#codecs) `codec` и выражением для умолчания `default_expr` (смотрите раздел [Значения по умолчанию](create.md#create-default-values)). - -Если указано `IF NOT EXISTS`, запрос не будет возвращать ошибку, если столбец уже существует. Если указано `AFTER name_after` (имя другого столбца), то столбец добавляется (в список столбцов таблицы) после указанного. Иначе, столбец добавляется в конец таблицы. Обратите внимание, ClickHouse не позволяет добавлять столбцы в начало таблицы. Для цепочки действий, `name_after` может быть именем столбца, который добавляется в одном из предыдущих действий. - -Добавление столбца всего лишь меняет структуру таблицы, и не производит никаких действий с данными - соответствующие данные не появляются на диске после ALTER-а. При чтении из таблицы, если для какого-либо столбца отсутствуют данные, то он заполняется значениями по умолчанию (выполняя выражение по умолчанию, если такое есть, или нулями, пустыми строками). Также, столбец появляется на диске при слиянии кусков данных (см. [MergeTree](../../sql_reference/statements/alter.md)). - -Такая схема позволяет добиться мгновенной работы запроса `ALTER` и отсутствия необходимости увеличивать объём старых данных. - -Пример: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -Удаляет столбец с именем `name`. Если указано `IF EXISTS`, запрос не будет возвращать ошибку, если столбца не существует. - -Запрос удаляет данные из файловой системы. Так как это представляет собой удаление целых файлов, запрос выполняется почти мгновенно. - -Пример: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -Сбрасывает все значения в столбце для заданной партиции. Если указано `IF EXISTS`, запрос не будет возвращать ошибку, если столбца не существует. - -Как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -Пример: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'Text comment' -``` - -Добавляет комментарий к таблице. Если указано `IF EXISTS`, запрос не будет возвращать ошибку, если столбца не существует. - -Каждый столбец может содержать только один комментарий. При выполнении запроса существующий комментарий заменяется на новый. - -Посмотреть комментарии можно в столбце `comment_expression` из запроса [DESCRIBE TABLE](misc.md#misc-describe-table). - -Пример: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'Столбец показывает, из каких браузеров пользователи заходили на сайт.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -Запрос изменяет следующие свойства столбца `name`: - -- Тип - -- Значение по умолчанию - -- TTL - - Примеры изменения TTL столбца смотрите в разделе [TTL столбца](../../sql_reference/statements/alter.md#mergetree-column-ttl). - -Если указано `IF EXISTS`, запрос не возвращает ошибку, если столбца не существует. - -При изменении типа, значения преобразуются так, как если бы к ним была применена функция [toType](../../sql_reference/statements/alter.md). Если изменяется только выражение для умолчания, запрос не делает никакой сложной работы и выполняется мгновенно. - -Пример запроса: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Изменение типа столбца - это единственное действие, которое выполняет сложную работу - меняет содержимое файлов с данными. Для больших таблиц, выполнение может занять длительное время. - -Выполнение производится в несколько стадий: - -- подготовка временных (новых) файлов с изменёнными данными; -- переименование старых файлов; -- переименование временных (новых) файлов в старые; -- удаление старых файлов. - -Из них, длительной является только первая стадия. Если на этой стадии возникнет сбой, то данные не поменяются. -Если на одной из следующих стадий возникнет сбой, то данные будет можно восстановить вручную. За исключением случаев, когда старые файлы удалены из файловой системы, а данные для новых файлов не доехали на диск и потеряны. - -Запрос `ALTER` на изменение столбцов реплицируется. Соответствующие инструкции сохраняются в ZooKeeper, и затем каждая реплика их применяет. Все запросы `ALTER` выполняются в одном и том же порядке. Запрос ждёт выполнения соответствующих действий на всех репликах. Но при этом, запрос на изменение столбцов в реплицируемой таблице можно прервать, и все действия будут осуществлены асинхронно. - -#### Ограничения запроса ALTER {#ogranicheniia-zaprosa-alter} - -Запрос `ALTER` позволяет создавать и удалять отдельные элементы (столбцы) вложенных структур данных, но не вложенные структуры данных целиком. Для добавления вложенной структуры данных, вы можете добавить столбцы с именем вида `name.nested_name` и типом `Array(T)` - вложенная структура данных полностью эквивалентна нескольким столбцам-массивам с именем, имеющим одинаковый префикс до точки. - -Отсутствует возможность удалять столбцы, входящие в первичный ключ или ключ для сэмплирования (в общем, входящие в выражение `ENGINE`). Изменение типа у столбцов, входящих в первичный ключ возможно только в том случае, если это изменение не приводит к изменению данных (например, разрешено добавление значения в Enum или изменение типа с `DateTime` на `UInt32`). - -Если возможностей запроса `ALTER` не хватает для нужного изменения таблицы, вы можете создать новую таблицу, скопировать туда данные с помощью запроса [INSERT SELECT](insert_into.md#insert_query_insert-select), затем поменять таблицы местами с помощью запроса [RENAME](misc.md#misc_operations-rename), и удалить старую таблицу. В качестве альтернативы для запроса `INSERT SELECT`, можно использовать инструмент [clickhouse-copier](../../sql_reference/statements/alter.md). - -Запрос `ALTER` блокирует все чтения и записи для таблицы. То есть, если на момент запроса `ALTER`, выполнялся долгий `SELECT`, то запрос `ALTER` сначала дождётся его выполнения. И в это время, все новые запросы к той же таблице, будут ждать, пока завершится этот `ALTER`. - -Для таблиц, которые не хранят данные самостоятельно (типа [Merge](../../sql_reference/statements/alter.md) и [Distributed](../../sql_reference/statements/alter.md)), `ALTER` всего лишь меняет структуру таблицы, но не меняет структуру подчинённых таблиц. Для примера, при ALTER-е таблицы типа `Distributed`, вам также потребуется выполнить запрос `ALTER` для таблиц на всех удалённых серверах. - -### Манипуляции с ключевыми выражениями таблиц {#manipuliatsii-s-kliuchevymi-vyrazheniiami-tablits} - -Поддерживается операция: - -``` sql -MODIFY ORDER BY new_expression -``` - -Работает только для таблиц семейства [`MergeTree`](../../sql_reference/statements/alter.md) (в том числе [реплицированных](../../sql_reference/statements/alter.md)). После выполнения запроса -[ключ сортировки](../../sql_reference/statements/alter.md) таблицы -заменяется на `new_expression` (выражение или кортеж выражений). Первичный ключ при этом остаётся прежним. - -Операция затрагивает только метаданные. Чтобы сохранить свойство упорядоченности кусков данных по ключу -сортировки, разрешено добавлять в ключ только новые столбцы (т.е. столбцы, добавляемые командой `ADD COLUMN` -в том же запросе `ALTER`), у которых нет выражения по умолчанию. - -### Манипуляции с индексами {#manipuliatsii-s-indeksami} - -Добавить или удалить индекс можно с помощью операций - -``` sql -ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value [AFTER name] -ALTER TABLE [db].name DROP INDEX name -``` - -Поддерживается только таблицами семейства `*MergeTree`. - -Команда `ADD INDEX` добавляет описание индексов в метаданные, а `DROP INDEX` удаляет индекс из метаданных и стирает файлы индекса с диска, поэтому они легковесные и работают мгновенно. - -Если индекс появился в метаданных, то он начнет считаться в последующих слияниях и записях в таблицу, а не сразу после выполнения операции `ALTER`. - -Запрос на изменение индексов реплицируется, сохраняя новые метаданные в ZooKeeper и применяя изменения на всех репликах. - -### Манипуляции с ограничениями (constraints) {#manipuliatsii-s-ogranicheniiami-constraints} - -Про ограничения подробнее написано [тут](create.md#constraints). - -Добавить или удалить ограничение можно с помощью запросов - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -Запросы выполняют добавление или удаление метаданных об ограничениях таблицы `[db].name`, поэтому выполняются мнгновенно. - -Если ограничение появилось для непустой таблицы, то *проверка ограничения для имеющихся данных не производится*. - -Запрос на изменение ограничений для Replicated таблиц реплицируется, сохраняя новые метаданные в ZooKeeper и применяя изменения на всех репликах. - -### Манипуляции с партициями и кусками {#alter_manipulations-with-partitions} - -Для работы с [партициями](../../sql_reference/statements/alter.md) доступны следующие операции: - -- [DETACH PARTITION](#alter_detach-partition) – перенести партицию в директорию `detached`; -- [DROP PARTITION](#alter_drop-partition) – удалить партицию; -- [ATTACH PARTITION\|PART](#alter_attach-partition) – добавить партицию/кусок в таблицу из директории `detached`; -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – скопировать партицию из другой таблицы; -- [REPLACE PARTITION](#alter_replace-partition) – скопировать партицию из другой таблицы с заменой; -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - переместить партицию в другую таблицу; -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) – удалить все значения в столбце для заданной партиции; -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - очистить построенные вторичные индексы для заданной партиции; -- [FREEZE PARTITION](#alter_freeze-partition) – создать резервную копию партиции; -- [FETCH PARTITION](#alter_fetch-partition) – скачать партицию с другого сервера; -- [MOVE PARTITION\|PART](#alter_move-partition) – переместить партицию/кускок на другой диск или том. - -#### DETACH PARTITION {#alter_detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -Перемещает заданную партицию в директорию `detached`. Сервер не будет знать об этой партиции до тех пор, пока вы не выполните запрос [ATTACH](#alter_attach-partition). - -Пример: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -После того как запрос будет выполнен, вы сможете производить любые операции с данными в директории `detached`. Например, можно удалить их из файловой системы. - -Запрос реплицируется — данные будут перенесены в директорию `detached` и забыты на всех репликах. Обратите внимание, запрос может быть отправлен только на реплику-лидер. Чтобы узнать, является ли реплика лидером, выполните запрос `SELECT` к системной таблице [system.replicas](../../operations/system_tables.md#system_tables-replicas). Либо можно выполнить запрос `DETACH` на всех репликах — тогда на всех репликах, кроме реплики-лидера, запрос вернет ошибку. - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -Удаляет партицию. Партиция помечается как неактивная и будет полностью удалена примерно через 10 минут. - -Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -Запрос реплицируется — данные будут удалены на всех репликах. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -Удаляет из `detached` кусок или все куски, принадлежащие партиции. -Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -Добавляет данные в таблицу из директории `detached`. Можно добавить данные как для целой партиции, так и для отдельного куска. Примеры: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -Как корректно задать имя партиции или куска, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -Этот запрос реплицируется. Реплика-иницатор проверяет, есть ли данные в директории `detached`. Если данные есть, то запрос проверяет их целостность. В случае успеха данные добавляются в таблицу. Все остальные реплики загружают данные с реплики-инициатора запроса. - -Это означает, что вы можете разместить данные в директории `detached` на одной реплике и с помощью запроса `ALTER ... ATTACH` добавить их в таблицу на всех репликах. - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -Копирует партицию из таблицы `table1` в таблицу `table2` и добавляет к существующим данным `table2`. Данные из `table1` не удаляются. - -Следует иметь в виду: - -- Таблицы должны иметь одинаковую структуру. -- Для таблиц должен быть задан одинаковый ключ партиционирования. - -Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -Копирует партицию из таблицы `table1` в таблицу `table2` с заменой существующих данных в `table2`. Данные из `table1` не удаляются. - -Следует иметь в виду: - -- Таблицы должны иметь одинаковую структуру. -- Для таблиц должен быть задан одинаковый ключ партиционирования. - -Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -Перемещает партицию из таблицы `table_source` в таблицу `table_dest` (добавляет к существующим данным в `table_dest`), с удалением данных из таблицы `table_source`. - -Следует иметь в виду: - -- Таблицы должны иметь одинаковую структуру. -- Для таблиц должен быть задан одинаковый ключ партиционирования. - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -Сбрасывает все значения в столбце для заданной партиции. Если для столбца определено значение по умолчанию (в секции `DEFAULT`), то будет выставлено это значение. - -Пример: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -Работает как `CLEAR COLUMN`, но сбрасывает индексы вместо данных в столбцах. - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -Создаёт резервную копию для заданной партиции. Если выражение `PARTITION` опущено, резервные копии будут созданы для всех партиций. - -!!! note "Примечание" - Создание резервной копии не требует остановки сервера. - -Для таблиц старого стиля имя партиций можно задавать в виде префикса (например, ‘2019’). В этом случае резервные копии будут созданы для всех соответствующих партиций. Подробнее о том, как корректно задать имя партиции, см. в разделе [Как задавать имя партиции в запросах ALTER](#alter-how-to-specify-part-expr). - -Запрос делает следующее — для текущего состояния таблицы он формирует жесткие ссылки на данные в этой таблице. Ссылки размещаются в директории `/var/lib/clickhouse/shadow/N/...`, где: - -- `/var/lib/clickhouse/` — рабочая директория ClickHouse, заданная в конфигурационном файле; -- `N` — инкрементальный номер резервной копии. - -!!! note "Примечание" - При использовании [нескольких дисков для хранения данных таблицы](../../sql_reference/statements/alter.md#table_engine-mergetree-multiple-volumes) директория `shadow/N` появляется на каждом из дисков, на которых были куски, попавшие под выражение `PARTITION`. - -Структура директорий внутри резервной копии такая же, как внутри `/var/lib/clickhouse/`. Запрос выполнит ‘chmod’ для всех файлов, запрещая запись в них. - -Обратите внимание, запрос `ALTER TABLE t FREEZE PARTITION` не реплицируется. Он создает резервную копию только на локальном сервере. После создания резервной копии данные из `/var/lib/clickhouse/shadow/` можно скопировать на удалённый сервер, а локальную копию удалить. - -Резервная копия создается почти мгновенно (однако сначала запрос дожидается завершения всех запросов, которые выполняются для соответствующей таблицы). - -`ALTER TABLE t FREEZE PARTITION` копирует только данные, но не метаданные таблицы. Чтобы сделать резервную копию метаданных таблицы, скопируйте файл `/var/lib/clickhouse/metadata/database/table.sql` - -Чтобы восстановить данные из резервной копии, выполните следующее: - -1. Создайте таблицу, если она ещё не существует. Запрос на создание можно взять из .sql файла (замените в нём `ATTACH` на `CREATE`). -2. Скопируйте данные из директории `data/database/table/` внутри резервной копии в директорию `/var/lib/clickhouse/data/database/table/detached/`. -3. С помощью запросов `ALTER TABLE t ATTACH PARTITION` добавьте данные в таблицу. - -Восстановление данных из резервной копии не требует остановки сервера. - -Подробнее о резервном копировании и восстановлении данных читайте в разделе [Резервное копирование данных](../../operations/backup.md). - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -Загружает партицию с другого сервера. Этот запрос работает только для реплицированных таблиц. - -Запрос выполняет следующее: - -1. Загружает партицию с указанного шарда. Путь к шарду задается в секции `FROM` (‘path-in-zookeeper’). Обратите внимание, нужно задавать путь к шарду в ZooKeeper. -2. Помещает загруженные данные в директорию `detached` таблицы `table_name`. Чтобы прикрепить эти данные к таблице, используйте запрос [ATTACH PARTITION\|PART](#alter_attach-partition). - -Например: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -Следует иметь в виду: - -- Запрос `ALTER TABLE t FETCH PARTITION` не реплицируется. Он загружает партицию в директорию `detached` только на локальном сервере. -- Запрос `ALTER TABLE t ATTACH` реплицируется — он добавляет данные в таблицу сразу на всех репликах. На одной из реплик данные будут добавлены из директории `detached`, а на других — из соседних реплик. - -Перед загрузкой данных система проверяет, существует ли партиция и совпадает ли её структура со структурой таблицы. При этом автоматически выбирается наиболее актуальная реплика среди всех живых реплик. - -Несмотря на то что запрос называется `ALTER TABLE`, он не изменяет структуру таблицы и не изменяет сразу доступные данные в таблице. - -#### MOVE PARTITION\|PART {#alter_move-partition} - -Перемещает партицию или кусок данных на другой том или диск для таблиц с движком `MergeTree`. Смотрите [Хранение данных таблицы на нескольких блочных устройствах](../../sql_reference/statements/alter.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -Запрос `ALTER TABLE t MOVE`: - -- Не реплицируется, т.к. на разных репликах могут быть различные конфигурации политик хранения. -- Возвращает ошибку, если указан несконфигурированный том или диск. Ошибка также возвращается в случае невыполнения условий перемещения данных, которые указаны в конфигурации политики хранения. -- Может возвращать ошибку в случае, когда перемещаемые данные уже оказались перемещены в результате фонового процесса, конкурентного запроса `ALTER TABLE t MOVE` или как часть результата фоновой операции слияния. В данном случае никаких дополнительных действий от пользователя не требуется. - -Примеры: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### Как задавать имя партиции в запросах ALTER {#alter-how-to-specify-part-expr} - -Чтобы задать нужную партицию в запросах `ALTER ... PARTITION`, можно использовать: - -- Имя партиции. Посмотреть имя партиции можно в столбце `partition` системной таблицы [system.parts](../../operations/system_tables.md#system_tables-parts). Например, `ALTER TABLE visits DETACH PARTITION 201901`. -- Произвольное выражение из столбцов исходной таблицы. Также поддерживаются константы и константные выражения. Например, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- Строковый идентификатор партиции. Идентификатор партиции используется для именования кусков партиции на файловой системе и в ZooKeeper. В запросах `ALTER` идентификатор партиции нужно указывать в секции `PARTITION ID`, в одинарных кавычках. Например, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- Для запросов [ATTACH PART](#alter_attach-partition) и [DROP DETACHED PART](#alter_drop-detached): чтобы задать имя куска партиции, используйте строковой литерал со значением из столбца `name` системной таблицы [system.detached\_parts](../../operations/system_tables.md#system_tables-detached_parts). Например, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -Использование кавычек в имени партиций зависит от типа данных столбца, по которому задано партиционирование. Например, для столбца с типом `String` имя партиции необходимо указывать в кавычках (одинарных). Для типов `Date` и `Int*` кавычки указывать не нужно. - -Замечание: для таблиц старого стиля партицию можно указывать и как число `201901`, и как строку `'201901'`. Синтаксис для таблиц нового типа более строг к типам (аналогично парсеру входного формата VALUES). - -Правила, сформулированные выше, актуальны также для запросов [OPTIMIZE](misc.md#misc_operations-optimize). Чтобы указать единственную партицию непартиционированной таблицы, укажите `PARTITION tuple()`. Например: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -Примеры запросов `ALTER ... PARTITION` можно посмотреть в тестах: [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) и [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### Манипуляции с TTL таблицы {#manipuliatsii-s-ttl-tablitsy} - -Вы можете изменить [TTL для таблицы](../../sql_reference/statements/alter.md#mergetree-table-ttl) запросом следующего вида: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### Синхронность запросов ALTER {#sinkhronnost-zaprosov-alter} - -Для нереплицируемых таблиц, все запросы `ALTER` выполняются синхронно. Для реплицируемых таблиц, запрос всего лишь добавляет инструкцию по соответствующим действиям в `ZooKeeper`, а сами действия осуществляются при первой возможности. Но при этом, запрос может ждать завершения выполнения этих действий на всех репликах. - -Для запросов `ALTER ... ATTACH|DETACH|DROP` можно настроить ожидание, с помощью настройки `replication_alter_partitions_sync`. -Возможные значения: `0` - не ждать, `1` - ждать выполнения только у себя (по умолчанию), `2` - ждать всех. - -### Мутации {#alter-mutations} - -Мутации - разновидность запроса ALTER, позволяющая изменять или удалять данные в таблице. В отличие от стандартных запросов `DELETE` и `UPDATE`, рассчитанных на точечное изменение данных, область применения мутаций - достаточно тяжёлые изменения, затрагивающие много строк в таблице. Поддержана для движков таблиц семейства `MergeTree`, в том числе для движков с репликацией. - -Конвертировать существующие таблицы для работы с мутациями не нужно. Но после применения первой мутации формат данных таблицы становится несовместимым с предыдущими версиями и откатиться на предыдущую версию уже не получится. - -На данный момент доступны команды: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -Выражение `filter_expr` должно иметь тип `UInt8`. Запрос удаляет строки таблицы, для которых это выражение принимает ненулевое значение. - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -Выражение `filter_expr` должно иметь тип `UInt8`. Запрос изменяет значение указанных столбцов на вычисленное значение соответствующих выражений в каждой строке, для которой `filter_expr` принимает ненулевое значение. Вычисленные значения преобразуются к типу столбца с помощью оператора `CAST`. Изменение столбцов, которые используются при вычислении первичного ключа или ключа партиционирования, не поддерживается. - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -Команда перестроит вторичный индекс `name` для партиции `partition_name`. - -В одном запросе можно указать несколько команд через запятую. - -Для \*MergeTree-таблиц мутации выполняются, перезаписывая данные по кускам (parts). При этом атомарности нет — куски заменяются на помутированные по мере выполнения и запрос `SELECT`, заданный во время выполнения мутации, увидит данные как из измененных кусков, так и из кусков, которые еще не были изменены. - -Мутации линейно упорядочены между собой и накладываются на каждый кусок в порядке добавления. Мутации также упорядочены со вставками - гарантируется, что данные, вставленные в таблицу до начала выполнения запроса мутации, будут изменены, а данные, вставленные после окончания запроса мутации, изменены не будут. При этом мутации никак не блокируют вставки. - -Запрос завершается немедленно после добавления информации о мутации (для реплицированных таблиц - в ZooKeeper, для нереплицированных - на файловую систему). Сама мутация выполняется асинхронно, используя настройки системного профиля. Следить за ходом её выполнения можно по таблице [`system.mutations`](../../operations/system_tables.md#system_tables-mutations). Добавленные мутации будут выполняться до конца даже в случае перезапуска серверов ClickHouse. Откатить мутацию после её добавления нельзя, но если мутация по какой-то причине не может выполниться до конца, её можно остановить с помощью запроса [`KILL MUTATION`](misc.md#kill-mutation). - -Записи о последних выполненных мутациях удаляются не сразу (количество сохраняемых мутаций определяется параметром движка таблиц `finished_mutations_to_keep`). Более старые записи удаляются. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/alter/) diff --git a/docs/ru/sql_reference/statements/create.md b/docs/ru/sql_reference/statements/create.md deleted file mode 100644 index e09877d3495..00000000000 --- a/docs/ru/sql_reference/statements/create.md +++ /dev/null @@ -1,305 +0,0 @@ ---- -toc_priority: 35 -toc_title: CREATE ---- - -## CREATE DATABASE {#query-language-create-database} - -Создает базу данных. - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] -``` - -### Секции {#sektsii} - -- `IF NOT EXISTS` - - Если база данных с именем `db_name` уже существует, то ClickHouse не создаёт базу данных и: - - Не генерирует исключение, если секция указана. - - Генерирует исключение, если секция не указана. - -- `ON CLUSTER` - - ClickHouse создаёт базу данных `db_name` на всех серверах указанного кластера. - -- `ENGINE` - - - [MySQL](../../sql_reference/statements/create.md) - - Позволяет получать данные с удаленного сервера MySQL. - - По умолчанию ClickHouse использует собственный [движок баз данных](../../sql_reference/statements/create.md). - -## CREATE TABLE {#create-table-query} - -Запрос `CREATE TABLE` может иметь несколько форм. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], - ... -) ENGINE = engine -``` - -Создаёт таблицу с именем name в БД db или текущей БД, если db не указана, со структурой, указанной в скобках, и движком engine. -Структура таблицы представляет список описаний столбцов. Индексы, если поддерживаются движком, указываются в качестве параметров для движка таблицы. - -Описание столбца, это `name type`, в простейшем случае. Пример: `RegionID UInt32`. -Также могут быть указаны выражения для значений по умолчанию - смотрите ниже. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -Создаёт таблицу с такой же структурой, как другая таблица. Можно указать другой движок для таблицы. Если движок не указан, то будет выбран такой же движок, как у таблицы `db2.name2`. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() -``` - -Создаёт таблицу с такой же структурой и данными, как результат соответствующей табличной функцией. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -Создаёт таблицу со структурой, как результат запроса `SELECT`, с движком engine, и заполняет её данными из SELECT-а. - -Во всех случаях, если указано `IF NOT EXISTS`, то запрос не будет возвращать ошибку, если таблица уже существует. В этом случае, запрос будет ничего не делать. - -После секции `ENGINE` в запросе могут использоваться и другие секции в зависимости от движка. Подробную документацию по созданию таблиц смотрите в описаниях [движков таблиц](../../sql_reference/statements/create.md#table_engines). - -### Значения по умолчанию {#create-default-values} - -В описании столбца, может быть указано выражение для значения по умолчанию, одного из следующих видов: -`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. -Пример: `URLDomain String DEFAULT domain(URL)`. - -Если выражение для значения по умолчанию не указано, то в качестве значений по умолчанию будут использоваться нули для чисел, пустые строки для строк, пустые массивы для массивов, а также `0000-00-00` для дат и `0000-00-00 00:00:00` для дат с временем. NULL-ы не поддерживаются. - -В случае, если указано выражение по умолчанию, то указание типа столбца не обязательно. При отсутствии явно указанного типа, будет использован тип выражения по умолчанию. Пример: `EventDate DEFAULT toDate(EventTime)` - для столбца EventDate будет использован тип Date. - -При наличии явно указанного типа данных и выражения по умолчанию, это выражение будет приводиться к указанному типу с использованием функций приведения типа. Пример: `Hits UInt32 DEFAULT 0` - имеет такой же смысл, как `Hits UInt32 DEFAULT toUInt32(0)`. - -В качестве выражения для умолчания, может быть указано произвольное выражение от констант и столбцов таблицы. При создании и изменении структуры таблицы, проверяется, что выражения не содержат циклов. При INSERT-е проверяется разрешимость выражений - что все столбцы, из которых их можно вычислить, переданы. - -`DEFAULT expr` - -Обычное значение по умолчанию. Если в запросе INSERT не указан соответствующий столбец, то он будет заполнен путём вычисления соответствующего выражения. - -`MATERIALIZED expr` - -Материализованное выражение. Такой столбец не может быть указан при INSERT, то есть, он всегда вычисляется. -При INSERT без указания списка столбцов, такие столбцы не рассматриваются. -Также этот столбец не подставляется при использовании звёздочки в запросе SELECT. Это необходимо, чтобы сохранить инвариант, что дамп, полученный путём `SELECT *`, можно вставить обратно в таблицу INSERT-ом без указания списка столбцов. - -`ALIAS expr` - -Синоним. Такой столбец вообще не хранится в таблице. -Его значения не могут быть вставлены в таблицу, он не подставляется при использовании звёздочки в запросе SELECT. -Он может быть использован в SELECT-ах - в таком случае, во время разбора запроса, алиас раскрывается. - -При добавлении новых столбцов с помощью запроса ALTER, старые данные для этих столбцов не записываются. Вместо этого, при чтении старых данных, для которых отсутствуют значения новых столбцов, выполняется вычисление выражений по умолчанию на лету. При этом, если выполнение выражения требует использования других столбцов, не указанных в запросе, то эти столбцы будут дополнительно прочитаны, но только для тех блоков данных, для которых это необходимо. - -Если добавить в таблицу новый столбец, а через некоторое время изменить его выражение по умолчанию, то используемые значения для старых данных (для данных, где значения не хранились на диске) поменяются. Также заметим, что при выполнении фоновых слияний, данные для столбцов, отсутствующих в одном из сливаемых кусков, записываются в объединённый кусок. - -Отсутствует возможность задать значения по умолчанию для элементов вложенных структур данных. - -### Ограничения (constraints) {#constraints} - -Наряду с объявлением столбцов можно объявить ограничения на значения в столбцах таблицы: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` может быть любым булевым выражением, состоящим из операторов сравнения или функций. При наличии одного или нескольких ограничений в момент вставки данных выражения ограничений будут проверяться на истинность для каждой вставляемой строки данных. В случае, если в теле INSERT запроса придут некорректные данные — клиент получит исключение с описанием нарушенного ограничения. - -Добавление большого числа ограничений может негативно повлиять на производительность `INSERT` запросов. - -### Выражение для TTL {#vyrazhenie-dlia-ttl} - -Определяет время хранения значений. Может быть указано только для таблиц семейства MergeTree. Подробнее смотрите в [TTL для столбцов и таблиц](../../sql_reference/statements/create.md#table_engine-mergetree-ttl). - -### Кодеки сжатия столбцов {#codecs} - -По умолчанию, ClickHouse применяет к столбцу метод сжатия, определённый в [конфигурации сервера](../../sql_reference/statements/create.md#compression). Кроме этого, можно задать метод сжатия для каждого отдельного столбца в запросе `CREATE TABLE`. - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -Если задать кодек для столбца, то кодек по умолчанию не применяется. Кодеки можно последовательно комбинировать, например, `CODEC(Delta, ZSTD)`. Чтобы выбрать наиболее подходящую для вашего проекта комбинацию кодеков, необходимо провести сравнительные тесты, подобные тем, что описаны в статье Altinity [New Encodings to Improve ClickHouse Efficiency](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse). - -!!! warning "Предупреждение" - Нельзя распаковать базу данных ClickHouse с помощью сторонних утилит наподобие `lz4`. Необходимо использовать специальную утилиту [clickhouse-compressor](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor). - -Сжатие поддерживается для следующих движков таблиц: - -- [MergeTree family](../../sql_reference/statements/create.md) -- [Log family](../../sql_reference/statements/create.md) -- [Set](../../sql_reference/statements/create.md) -- [Join](../../sql_reference/statements/create.md) - -ClickHouse поддерживает кодеки общего назначения и специализированные кодеки. - -#### Специализированные кодеки {#create-query-specialized-codecs} - -Эти кодеки разработаны для того, чтобы, используя особенности данных сделать сжатие более эффективным. Некоторые из этих кодеков не сжимают данные самостоятельно. Они готовят данные для кодеков общего назначения, которые сжимают подготовленные данные эффективнее, чем неподготовленные. - -Специализированные кодеки: - -- `Delta(delta_bytes)` — Метод, в котором исходные значения заменяются разностью двух соседних значений, за исключением первого значения, которое остаётся неизменным. Для хранения разниц используется до `delta_bytes`, т.е. `delta_bytes` — это максимальный размер исходных данных. Возможные значения `delta_bytes`: 1, 2, 4, 8. Значение по умолчанию для `delta_bytes` равно `sizeof(type)`, если результат 1, 2, 4, or 8. Во всех других случаях — 1. -- `DoubleDelta` — Вычисляется разницу от разниц и сохраняет её в компакном бинарном виде. Оптимальная степень сжатия достигается для монотонных последовательностей с постоянным шагом, наподобие временных рядов. Можно использовать с любым типом данных фиксированного размера. Реализует алгоритм, используемый в TSDB Gorilla, поддерживает 64-битные типы данных. Использует 1 дополнительный бит для 32-байтовых значений: 5-битные префиксы вместо 4-битных префиксов. Подробнее читайте в разделе «Compressing Time Stamps» документа [Gorilla: A Fast, Scalable, In-Memory Time Series Database](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Вычисляет XOR между текущим и предыдущим значением и записывает результат в компактной бинарной форме. Еффективно сохраняет ряды медленно изменяющихся чисел с плавающей запятой, поскольку наилучший коэффициент сжатия достигается, если соседние значения одинаковые. Реализует алгоритм, используемый в TSDB Gorilla, адаптируя его для работы с 64-битными значениями. Подробнее читайте в разделе «Compressing Values» документа [Gorilla: A Fast, Scalable, In-Memory Time Series Database](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Метод сжатия который обрезает неиспользуемые старшие биты целочисленных значений (включая `Enum`, `Date` и `DateTime`). На каждом шаге алгоритма, кодек помещает блок из 64 значений в матрицу 64✕64, транспонирует её, обрезает неиспользуемые биты, а то, что осталось возвращает в виде последовательности. Неиспользуемые биты, это биты, которые не изменяются от минимального к максимальному на всём диапазоне значений куска данных. - -Кодеки `DoubleDelta` и `Gorilla` используются в TSDB Gorilla как компоненты алгоритма сжатия. Подход Gorilla эффективен в сценариях, когда данные представляют собой медленно изменяющиеся во времени величины. Метки времени эффективно сжимаются кодеком `DoubleDelta`, а значения кодеком `Gorilla`. Например, чтобы создать эффективно хранящуюся таблицу, используйте следующую конфигурацию: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### Кодеки общего назначения {#create-query-common-purpose-codecs} - -Кодеки: - -- `NONE` — без сжатия. -- `LZ4` — [алгоритм сжатия без потерь](https://github.com/lz4/lz4) используемый по умолчанию. Применяет быстрое сжатие LZ4. -- `LZ4HC[(level)]` — алгоритм LZ4 HC (high compression) с настраиваемым уровнем сжатия. Уровень по умолчанию — 9. Настройка `level <= 0` устанавливает уровень сжания по умолчанию. Возможные уровни сжатия: \[1, 12\]. Рекомендуемый диапазон уровней: \[4, 9\]. -- `ZSTD[(level)]` — [алгоритм сжатия ZSTD](https://en.wikipedia.org/wiki/Zstandard) с настраиваемым уровнем сжатия `level`. Возможные уровни сжатия: \[1, 22\]. Уровень сжатия по умолчанию: 1. - -Высокие уровни сжатия полезны для ассимметричных сценариев, подобных «один раз сжал, много раз распаковал». Высокие уровни сжатия подразумеваю лучшее сжатие, но большее использование CPU. - -## Временные таблицы {#vremennye-tablitsy} - -ClickHouse поддерживает временные таблицы со следующими характеристиками: - -- Временные таблицы исчезают после завершения сессии, в том числе при обрыве соединения. -- Временная таблица использует только модуль памяти. -- Невозможно указать базу данных для временной таблицы. Она создается вне баз данных. -- Невозможно создать временную таблицу распределнным DDL запросом на всех серверах кластера (с опцией `ON CLUSTER`): такая таблица существует только в рамках существующей сессии. -- Если временная таблица имеет то же имя, что и некоторая другая, то, при упоминании в запросе без указания БД, будет использована временная таблица. -- При распределённой обработке запроса, используемые в запросе временные таблицы, передаются на удалённые серверы. - -Чтобы создать временную таблицу, используйте следующий синтаксис: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -В большинстве случаев, временные таблицы создаются не вручную, а при использовании внешних данных для запроса, или при распределённом `(GLOBAL) IN`. Подробнее см. соответствующие разделы - -Вместо временных можно использовать обычные таблицы с [ENGINE = Memory](../../sql_reference/statements/create.md). - -## Распределенные DDL запросы (секция ON CLUSTER) {#raspredelennye-ddl-zaprosy-sektsiia-on-cluster} - -Запросы `CREATE`, `DROP`, `ALTER`, `RENAME` поддерживают возможность распределенного выполнения на кластере. -Например, следующий запрос создает распределенную (Distributed) таблицу `all_hits` на каждом хосте в `cluster`: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -Для корректного выполнения таких запросов необходимо на каждом хосте иметь одинаковое определение кластера (для упрощения синхронизации конфигов можете использовать подстановки из ZooKeeper). Также необходимо подключение к ZooKeeper серверам. -Локальная версия запроса в конечном итоге будет выполнена на каждом хосте кластера, даже если некоторые хосты в данный момент не доступны. Гарантируется упорядоченность выполнения запросов в рамках одного хоста. - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -Создаёт представление. Представления бывают двух видов - обычные и материализованные (MATERIALIZED). - -Обычные представления не хранят никаких данных, а всего лишь производят чтение из другой таблицы. То есть, обычное представление - не более чем сохранённый запрос. При чтении из представления, этот сохранённый запрос, используется в качестве подзапроса в секции FROM. - -Для примера, пусть вы создали представление: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -и написали запрос: - -``` sql -SELECT a, b, c FROM view -``` - -Этот запрос полностью эквивалентен использованию подзапроса: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -Материализованные (MATERIALIZED) представления хранят данные, преобразованные соответствующим запросом SELECT. - -При создании материализованного представления без использования `TO [db].[table]`, нужно обязательно указать ENGINE - движок таблицы для хранения данных. - -При создании материализованного представления с испольованием `TO [db].[table]`, нельзя указывать `POPULATE` - -Материализованное представление устроено следующим образом: при вставке данных в таблицу, указанную в SELECT-е, кусок вставляемых данных преобразуется этим запросом SELECT, и полученный результат вставляется в представление. - -Если указано POPULATE, то при создании представления, в него будут вставлены имеющиеся данные таблицы, как если бы был сделан запрос `CREATE TABLE ... AS SELECT ...` . Иначе, представление будет содержать только данные, вставляемые в таблицу после создания представления. Не рекомендуется использовать POPULATE, так как вставляемые в таблицу данные во время создания представления, не попадут в него. - -Запрос `SELECT` может содержать `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Следует иметь ввиду, что соответствующие преобразования будут выполняться независимо, на каждый блок вставляемых данных. Например, при наличии `GROUP BY`, данные будут агрегироваться при вставке, но только в рамках одной пачки вставляемых данных. Далее, данные не будут доагрегированы. Исключение - использование ENGINE, производящего агрегацию данных самостоятельно, например, `SummingMergeTree`. - -Недоработано выполнение запросов `ALTER` над материализованными представлениями, поэтому они могут быть неудобными для использования. Если материализованное представление использует конструкцию `TO [db.]name`, то можно выполнить `DETACH` представления, `ALTER` для целевой таблицы и последующий `ATTACH` ранее отсоединенного (`DETACH`) представления. - -Представления выглядят так же, как обычные таблицы. Например, они перечисляются в результате запроса `SHOW TABLES`. - -Отсутствует отдельный запрос для удаления представлений. Чтобы удалить представление, следует использовать `DROP TABLE`. - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` - -Создаёт [внешний словарь](../../sql_reference/statements/create.md) с заданной [структурой](../../sql_reference/statements/create.md), [источником](../../sql_reference/statements/create.md), [способом размещения в памяти](../../sql_reference/statements/create.md) и [периодом обновления](../../sql_reference/statements/create.md). - -Структура внешнего словаря состоит из атрибутов. Атрибуты словаря задаются как столбцы таблицы. Единственным обязательным свойством атрибута является его тип, все остальные свойства могут иметь значения по умолчанию. - -В зависимости от [способа размещения словаря в памяти](../../sql_reference/statements/create.md), ключами словаря могут быть один и более атрибутов. - -Смотрите [Внешние словари](../../sql_reference/statements/create.md). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/create/) diff --git a/docs/ru/sql_reference/statements/index.md b/docs/ru/sql_reference/statements/index.md deleted file mode 100644 index 5b461b73c92..00000000000 --- a/docs/ru/sql_reference/statements/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -toc_folder_title: Выражения -toc_priority: 31 ---- - diff --git a/docs/ru/sql_reference/statements/insert_into.md b/docs/ru/sql_reference/statements/insert_into.md deleted file mode 100644 index e9c80466a58..00000000000 --- a/docs/ru/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -toc_priority: 34 -toc_title: INSERT INTO ---- - -## INSERT {#insert} - -Добавление данных. - -Базовый формат запроса: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -В запросе можно указать список столбцов для вставки `[(c1, c2, c3)]`. В этом случае, в остальные столбцы записываются: - -- Значения, вычисляемые из `DEFAULT` выражений, указанных в определении таблицы. -- Нули и пустые строки, если `DEFAULT` не определены. - -Если [strict\_insert\_defaults=1](../../operations/settings/settings.md), то столбцы, для которых не определены `DEFAULT`, необходимо перечислить в запросе. - -В INSERT можно передавать данные любого [формата](../../interfaces/formats.md#formats), который поддерживает ClickHouse. Для этого формат необходимо указать в запросе в явном виде: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT format_name data_set -``` - -Например, следующий формат запроса идентичен базовому варианту INSERT … VALUES: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -ClickHouse отсекает все пробелы и один перенос строки (если он есть) перед данными. Рекомендуем при формировании запроса переносить данные на новую строку после операторов запроса (это важно, если данные начинаются с пробелов). - -Пример: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -С помощью консольного клиента или HTTP интерфейса можно вставлять данные отдельно от запроса. Как это сделать, читайте в разделе «[Интерфейсы](../../interfaces/index.md#interfaces)». - -### Ограничения (constraints) {#ogranicheniia-constraints} - -Если в таблице объявлены [ограничения](create.md#constraints), то их выполнимость будет проверена для каждой вставляемой строки. Если для хотя бы одной строки ограничения не будут выполнены, запрос будет остановлен. - -### Вставка результатов `SELECT` {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -Соответствие столбцов определяется их позицией в секции SELECT. При этом, их имена в выражении SELECT и в таблице для INSERT, могут отличаться. При необходимости выполняется приведение типов данных, эквивалентное соответствующему оператору CAST. - -Все форматы данных кроме Values не позволяют использовать в качестве значений выражения, такие как `now()`, `1 + 2` и подобные. Формат Values позволяет ограниченно использовать выражения, но это не рекомендуется, так как в этом случае для их выполнения используется неэффективный вариант кода. - -Не поддерживаются другие запросы на модификацию части данных: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. -Вы можете удалять старые данные с помощью запроса `ALTER TABLE ... DROP PARTITION`. - -Для табличной функции [input()](../table_functions/input.md) после секции `SELECT` должна следовать -секция `FORMAT`. - -### Замечания о производительности {#zamechaniia-o-proizvoditelnosti} - -`INSERT` сортирует входящие данные по первичному ключу и разбивает их на партиции по ключу партиционирования. Если вы вставляете данные в несколько партиций одновременно, то это может значительно снизить производительность запроса `INSERT`. Чтобы избежать этого: - -- Добавляйте данные достаточно большими пачками. Например, по 100 000 строк. -- Группируйте данные по ключу партиционирования самостоятельно перед загрузкой в ClickHouse. - -Снижения производительности не будет, если: - -- Данные поступают в режиме реального времени. -- Вы загружаете данные, которые как правило отсортированы по времени. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/insert_into/) diff --git a/docs/ru/sql_reference/statements/misc.md b/docs/ru/sql_reference/statements/misc.md deleted file mode 100644 index d8278534d46..00000000000 --- a/docs/ru/sql_reference/statements/misc.md +++ /dev/null @@ -1,238 +0,0 @@ -# Прочие виды запросов {#prochie-vidy-zaprosov} - -## ATTACH {#attach} - -Запрос полностью аналогичен запросу `CREATE`, но: - -- вместо слова `CREATE` используется слово `ATTACH`; -- запрос не создаёт данные на диске, а предполагает, что данные уже лежат в соответствующих местах, и всего лишь добавляет информацию о таблице на сервер. После выполнения запроса `ATTACH` сервер будет знать о существовании таблицы. - -Если таблица перед этим была отсоединена (`DETACH`), т.е. её структура известна, можно использовать сокращенную форму записи без определения структуры. - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Этот запрос используется при старте сервера. Сервер хранит метаданные таблиц в виде файлов с запросами `ATTACH`, которые он просто исполняет при запуске (за исключением системных таблиц, которые явно создаются на сервере). - -## CHECK TABLE {#check-table} - -Проверяет таблицу на повреждение данных. - -``` sql -CHECK TABLE [db.]name -``` - -Запрос `CHECK TABLE` сравнивает текущие размеры файлов (в которых хранятся данные из колонок) с ожидаемыми значениями. Если значения не совпадают, данные в таблице считаются поврежденными. Искажение возможно, например, из-за сбоя при записи данных. - -Ответ содержит колонку `result`, содержащую одну строку с типом [Boolean](../../sql_reference/data_types/boolean.md). Допустимые значения: - -- 0 - данные в таблице повреждены; -- 1 - данные не повреждены. - -Запрос `CHECK TABLE` поддерживает следующие движки таблиц: - -- [Log](../../engines/table_engines/log_family/log.md) -- [TinyLog](../../engines/table_engines/log_family/tinylog.md) -- [StripeLog](../../engines/table_engines/log_family/stripelog.md) -- [Семейство MergeTree](../../engines/table_engines/mergetree_family/index.md) - -При попытке выполнить запрос с таблицами с другими табличными движками, ClickHouse генерирует исключение. - -В движках `*Log` не предусмотрено автоматическое восстановление данных после сбоя. Используйте запрос `CHECK TABLE`, чтобы своевременно выявлять повреждение данных. - -Для движков из семейства `MergeTree` запрос `CHECK TABLE` показывает статус проверки для каждого отдельного куска данных таблицы на локальном сервере. - -**Что делать, если данные повреждены** - -В этом случае можно скопировать оставшиеся неповрежденные данные в другую таблицу. Для этого: - -1. Создайте новую таблицу с такой же структурой, как у поврежденной таблицы. Для этого выполните запрос `CREATE TABLE AS `. -2. Установите значение параметра [max\_threads](../../operations/settings/settings.md#settings-max_threads) в 1. Это нужно для того, чтобы выполнить следующий запрос в одном потоке. Установить значение параметра можно через запрос: `SET max_threads = 1`. -3. Выполните запрос `INSERT INTO SELECT * FROM `. В результате неповрежденные данные будут скопированы в другую таблицу. Обратите внимание, будут скопированы только те данные, которые следуют до поврежденного участка. -4. Перезапустите `clickhouse-client`, чтобы вернуть предыдущее значение параметра `max_threads`. - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Возвращает описание столбцов таблицы. - -Результат запроса содержит столбцы (все столбцы имеют тип String): - -- `name` — имя столбца таблицы; -- `type`— тип столбца; -- `default_type` — в каком виде задано [выражение для значения по умолчанию](create.md#create-default-values): `DEFAULT`, `MATERIALIZED` или `ALIAS`. Столбец содержит пустую строку, если значение по умолчанию не задано. -- `default_expression` — значение, заданное в секции `DEFAULT`; -- `comment_expression` — комментарий к столбцу. - -Вложенные структуры данных выводятся в «развёрнутом» виде. То есть, каждый столбец - по отдельности, с именем через точку. - -## DETACH {#detach} - -Удаляет из сервера информацию о таблице name. Сервер перестаёт знать о существовании таблицы. - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Но ни данные, ни метаданные таблицы не удаляются. При следующем запуске сервера, сервер прочитает метаданные и снова узнает о таблице. -Также, «отцепленную» таблицу можно прицепить заново запросом `ATTACH` (за исключением системных таблиц, для которых метаданные не хранятся). - -Запроса `DETACH DATABASE` нет. - -## DROP {#drop} - -Запрос имеет два вида: `DROP DATABASE` и `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -Удаляет все таблицы внутри базы данных db, а затем саму базу данных db. -Если указано `IF EXISTS` - не выдавать ошибку, если база данных не существует. - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Удаляет таблицу. -Если указано `IF EXISTS` - не выдавать ошибку, если таблица не существует или база данных не существует. - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] TABLE [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -Возвращает один столбец типа `UInt8`, содержащий одно значение - `0`, если таблицы или БД не существует и `1`, если таблица в указанной БД существует. - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -Пытается принудительно остановить исполняющиеся в данный момент запросы. -Запросы для принудительной остановки выбираются из таблицы system.processes с помощью условия, указанного в секции `WHERE` запроса `KILL`. - -Примеры - -``` sql --- Принудительно останавливает все запросы с указанным query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Синхронно останавливает все запросы пользователя 'username': -KILL QUERY WHERE user='username' SYNC -``` - -Readonly-пользователи могут останавливать только свои запросы. - -По умолчанию используется асинхронный вариант запроса (`ASYNC`), который не дожидается подтверждения остановки запросов. - -Синхронный вариант (`SYNC`) ожидает остановки всех запросов и построчно выводит информацию о процессах по ходу их остановки. -Ответ содержит колонку `kill_status`, которая может принимать следующие значения: - -1. ‘finished’ - запрос был успешно остановлен; -2. ‘waiting’ - запросу отправлен сигнал завершения, ожидается его остановка; -3. остальные значения описывают причину невозможности остановки запроса. - -Тестовый вариант запроса (`TEST`) только проверяет права пользователя и выводит список запросов для остановки. - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -Пытается остановить выполняющиеся в данные момент [мутации](alter.md#alter-mutations). Мутации для остановки выбираются из таблицы [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) с помощью условия, указанного в секции `WHERE` запроса `KILL`. - -Тестовый вариант запроса (`TEST`) только проверяет права пользователя и выводит список запросов для остановки. - -Примеры: - -``` sql --- Останавливает все мутации одной таблицы: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Останавливает конкретную мутацию: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -Запрос полезен в случаях, когда мутация не может выполниться до конца (например, если функция в запросе мутации бросает исключение на данных таблицы). - -Данные, уже изменённые мутацией, остаются в таблице (отката на старую версию данных не происходит). - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -Запрос пытается запустить внеплановый мёрж кусков данных для таблиц семейства [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). Другие движки таблиц не поддерживаются. - -Если `OPTIMIZE` применяется к таблицам семейства [ReplicatedMergeTree](../../engines/table_engines/mergetree_family/replication.md), ClickHouse создаёт задачу на мёрж и ожидает её исполнения на всех узлах (если активирована настройка `replication_alter_partitions_sync`). - -- Если `OPTIMIZE` не выполняет мёрж по любой причине, ClickHouse не оповещает об этом клиента. Чтобы включить оповещения, используйте настройку [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop). -- Если указать `PARTITION`, то оптимизация выполняется только для указанной партиции. [Как задавать имя партиции в запросах](alter.md#alter-how-to-specify-part-expr). -- Если указать `FINAL`, то оптимизация выполняется даже в том случае, если все данные уже лежат в одном куске. -- Если указать `DEDUPLICATE`, то произойдет схлопывание полностью одинаковых строк (сравниваются значения во всех колонках), имеет смысл только для движка MergeTree. - -!!! warning "Внимание" - Запрос `OPTIMIZE` не может устранить причину появления ошибки «Too many parts». - -## RENAME {#misc_operations-rename} - -Переименовывает одну или несколько таблиц. - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -Все таблицы переименовываются под глобальной блокировкой. Переименовывание таблицы является лёгкой операцией. Если вы указали после TO другую базу данных, то таблица будет перенесена в эту базу данных. При этом, директории с базами данных должны быть расположены в одной файловой системе (иначе возвращается ошибка). - -## SET {#query-set} - -``` sql -SET param = value -``` - -Устанавливает значение `value` для [настройки](../../operations/settings/index.md) `param` в текущей сессии. [Конфигурационные параметры сервера](../../operations/server_configuration_parameters/settings.md) нельзя изменить подобным образом. - -Можно одним запросом установить все настройки из заданного профиля настроек. - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -Подробности смотрите в разделе [Настройки](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Удаляет все данные из таблицы. Если условие `IF EXISTS` не указано, запрос вернет ошибку, если таблицы не существует. - -Запрос `TRUNCATE` не поддерживается для следующих движков: [View](../../engines/table_engines/special/view.md), [File](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) и [Null](../../engines/table_engines/special/null.md). - -## USE {#use} - -``` sql -USE db -``` - -Позволяет установить текущую базу данных для сессии. -Текущая база данных используется для поиска таблиц, если база данных не указана в запросе явно через точку перед именем таблицы. -При использовании HTTP протокола запрос не может быть выполнен, так как понятия сессии не существует. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/misc/) diff --git a/docs/ru/sql_reference/statements/select.md b/docs/ru/sql_reference/statements/select.md deleted file mode 100644 index 2ceeb3489c2..00000000000 --- a/docs/ru/sql_reference/statements/select.md +++ /dev/null @@ -1,1406 +0,0 @@ ---- -toc_priority: 33 -toc_title: SELECT ---- - -# Синтаксис запросов SELECT {#sintaksis-zaprosov-select} - -`SELECT` осуществляет выборку данных. - -``` sql -[WITH expr_list|(subquery)] -SELECT [DISTINCT] expr_list -[FROM [db.]table | (subquery) | table_function] [FINAL] -[SAMPLE sample_coeff] -[ARRAY JOIN ...] -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list -[PREWHERE expr] -[WHERE expr] -[GROUP BY expr_list] [WITH TOTALS] -[HAVING expr] -[ORDER BY expr_list] -[LIMIT [offset_value, ]n BY columns] -[LIMIT [n, ]m] -[UNION ALL ...] -[INTO OUTFILE filename] -[FORMAT format] -``` - -Все секции, кроме списка выражений сразу после SELECT, являются необязательными. -Ниже секции будут описаны в порядке, почти соответствующем конвейеру выполнения запроса. - -Если в запросе отсутствуют секции `DISTINCT`, `GROUP BY`, `ORDER BY`, подзапросы в `IN` и `JOIN`, то запрос будет обработан полностью потоково, с использованием O(1) количества оперативки. -Иначе запрос может съесть много оперативки, если не указаны подходящие ограничения `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Подробнее смотрите в разделе «Настройки». Присутствует возможность использовать внешнюю сортировку (с сохранением временных данных на диск) и внешнюю агрегацию. `Merge join` в системе нет. - -### Секция WITH {#sektsiia-with} - -Данная секция представляет собой [CTE](https://ru.wikipedia.org/wiki/Иерархические_и_рекурсивные_запросы_в_SQL), с рядом ограничений: -1. Рекурсивные запросы не поддерживаются -2. Если в качестве выражения используется подзапрос, то результат должен содержать ровно одну строку -3. Результаты выражений нельзя переиспользовать во вложенных запросах -В дальнейшем, результаты выражений можно использовать в секции SELECT. - -Пример 1: Использование константного выражения как «переменной» - -``` sql -WITH '2019-08-01 15:23:00' as ts_upper_bound -SELECT * -FROM hits -WHERE - EventDate = toDate(ts_upper_bound) AND - EventTime <= ts_upper_bound -``` - -Пример 2: Выкидывание выражения sum(bytes) из списка колонок в SELECT - -``` sql -WITH sum(bytes) as s -SELECT - formatReadableSize(s), - table -FROM system.parts -GROUP BY table -ORDER BY s -``` - -Пример 3: Использование результатов скалярного подзапроса - -``` sql -/* запрос покажет TOP 10 самых больших таблиц */ -WITH - ( - SELECT sum(bytes) - FROM system.parts - WHERE active - ) AS total_disk_usage -SELECT - (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, - table -FROM system.parts -GROUP BY table -ORDER BY table_disk_usage DESC -LIMIT 10 -``` - -Пример 4: Переиспользование выражения -В настоящий момент, переиспользование выражения из секции WITH внутри подзапроса возможно только через дублирование. - -``` sql -WITH ['hello'] AS hello -SELECT - hello, - * -FROM -( - WITH ['hello'] AS hello - SELECT hello -) -``` - -``` text -┌─hello─────┬─hello─────┐ -│ ['hello'] │ ['hello'] │ -└───────────┴───────────┘ -``` - -### Секция FROM {#select-from} - -Если секция FROM отсутствует, то данные будут читаться из таблицы `system.one`. -Таблица `system.one` содержит ровно одну строку (то есть, эта таблица выполняет такую же роль, как таблица DUAL, которую можно найти в других СУБД). - -Cекция `FROM` определяет источник данных: - -- Таблица -- Подзапрос -- [Табличная функция](../../sql_reference/statements/select.md) - -Также могут присутствовать `ARRAY JOIN` и обычный `JOIN` (смотрите ниже). - -Вместо таблицы, может быть указан подзапрос `SELECT` в скобках. -В отличие от стандартного SQL, после подзапроса не обязательно указывать его синоним. - -Для выполнения запроса, из соответствующей таблицы, вынимаются все столбцы, перечисленные в запросе. Из подзапросов выкидываются столбцы, не нужные для внешнего запроса. -Если в запросе не перечислено ни одного столбца (например, `SELECT count() FROM t`), то из таблицы всё равно вынимается один какой-нибудь столбец (предпочитается самый маленький), для того, чтобы можно было посчитать количество строк. - -Модификатор `FINAL` может быть использован в запросе `SELECT` из таблиц семейства [MergeTree](../../engines/table_engines/mergetree_family/index.md). При указании `FINAL`, данные будут выбираться полностью «домерженными». Стоит учитывать, что использование `FINAL` приводит к чтению также столбцов, относящихся к первичному ключу. Также, запрос будет выполняться в один поток, и при выполнении запроса будет выполняться слияние данных. Это приводит к тому, что при использовании `FINAL`, запрос выполняется медленнее. В большинстве случаев, следует избегать использования `FINAL`. -Модификатор `FINAL` может быть использован для всех таблиц семейства `MergeTree`, которые производят преобразования данных в процессе фоновых слияний (кроме GraphiteMergeTree). - -#### FINAL Modifier {#select-from-final} - -Применим при выборке данных из таблиц с движками таблиц семейства [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)), кроме `GraphiteMergeTree`. Если в запросе используется `FINAL`, то ClickHouse полностью мёржит данные перед выдачей результата, таким образом выполняя все преобразования данных, которые производятся движком таблиц при мёржах. - -Также поддержан для движков: - -- [Replicated](../../engines/table_engines/mergetree_family/replication.md)-версий `MergeTree`. -- [View](../../engines/table_engines/special/view.md), [Buffer](../../engines/table_engines/special/buffer.md), [Distributed](../../engines/table_engines/special/distributed.md), и [MaterializedView](../../engines/table_engines/special/materializedview.md), которые работают поверх других движков, если они созданы для таблиц с движками семейства `MergeTree`. - -Запросы, использующие `FINAL` исполняются медленнее аналогичных запросов без `FINAL`, поскольку: - -- Запрос исполняется в один поток и данные мёржатся в процессе выполнения. -- Запросы с модификатором `FINAL` дополнительно к столбцам, указанным в запросе, читают столбцы первичного ключа. - -По возможности не используйте модификатор `FINAL`. - -### Секция SAMPLE {#select-sample-clause} - -Секция `SAMPLE` позволяет выполнять запросы приближённо. Например, чтобы посчитать статистику по всем визитам, можно обработать 1/10 всех визитов и результат домножить на 10. - -Сэмплирование имеет смысл, когда: - -1. Точность результата не важна, например, для оценочных расчетов. -2. Возможности аппаратной части не позволяют соответствовать строгим критериям. Например, время ответа должно быть \<100 мс. При этом точность расчета имеет более низкий приоритет. -3. Точность результата участвует в бизнес-модели сервиса. Например, пользователи с бесплатной подпиской на сервис могут получать отчеты с меньшей точностью, чем пользователи с премиум подпиской. - -!!! note "Внимание" - Не стоит использовать сэмплирование в тех задачах, где важна точность расчетов. Например, при работе с финансовыми отчетами. - -Свойства сэмплирования: - -- Сэмплирование работает детерминированно. При многократном выполнении одного и того же запроса `SELECT .. SAMPLE`, результат всегда будет одинаковым. -- Сэмплирование поддерживает консистентность для разных таблиц. Имеется в виду, что для таблиц с одним и тем же ключом сэмплирования, подмножество данных в выборках будет одинаковым (выборки при этом должны быть сформированы для одинаковой доли данных). Например, выборка по идентификаторам посетителей выберет из разных таблиц строки с одинаковым подмножеством всех возможных идентификаторов. Это свойство позволяет использовать выборки в подзапросах в секции [IN](#select-in-operators), а также объединять выборки с помощью [JOIN](#select-join). -- Сэмплирование позволяет читать меньше данных с диска. Обратите внимание, для этого необходимо корректно указать ключ сэмплирования. Подробнее см. в разделе [Создание таблицы MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -Сэмплирование поддерживается только таблицами семейства [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table) и только в том случае, если для таблиц был указан ключ сэмплирования (выражение, на основе которого должна производиться выборка). Подробнее см. в разделе [Создание таблиц MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -Выражение `SAMPLE` в запросе можно задать следующими способами: - -| Способ задания SAMPLE | Описание | -|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `SAMPLE k` | Здесь `k` – это дробное число в интервале от 0 до 1.
Запрос будет выполнен по `k` доле данных. Например, если указано `SAMPLE 1/10`, то запрос будет выполнен для выборки из 1/10 данных. [Подробнее](#select-sample-k) | -| `SAMPLE n` | Здесь `n` – это достаточно большое целое число.
Запрос будет выполнен для выборки, состоящей из не менее чем `n` строк. Например, если указано `SAMPLE 10000000`, то запрос будет выполнен для не менее чем 10,000,000 строк. [Подробнее](#select-sample-n) | -| `SAMPLE k OFFSET m` | Здесь `k` и `m` – числа от 0 до 1.
Запрос будет выполнен по `k` доле данных. При этом выборка будет сформирована со смещением на `m` долю. [Подробнее](#select-sample-offset) | - -#### SAMPLE k {#select-sample-k} - -Здесь `k` – число в интервале от 0 до 1. Поддерживается как дробная, так и десятичная форма записи. Например, `SAMPLE 1/2` или `SAMPLE 0.5`. - -Если задано выражение `SAMPLE k`, запрос будет выполнен для `k` доли данных. Рассмотрим пример: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -В этом примере запрос выполняется по выборке из 0.1 (10%) данных. Значения агрегатных функций не корректируются автоматически, поэтому чтобы получить приближённый результат, значение `count()` нужно вручную умножить на 10. - -Выборка с указанием относительного коэффициента является «согласованной»: для таблиц с одним и тем же ключом сэмплирования, выборка с одинаковой относительной долей всегда будет составлять одно и то же подмножество данных. То есть выборка из разных таблиц, на разных серверах, в разное время, формируется одинаковым образом. - -#### SAMPLE n {#select-sample-n} - -Здесь `n` – это достаточно большое целое число. Например, `SAMPLE 10000000`. - -Если задано выражение `SAMPLE n`, запрос будет выполнен для выборки из не менее `n` строк (но не значительно больше этого значения). Например, если задать `SAMPLE 10000000`, в выборку попадут не менее 10,000,000 строк. - -!!! note "Примечание" - Следует иметь в виду, что `n` должно быть достаточно большим числом. Так как минимальной единицей данных для чтения является одна гранула (её размер задаётся настройкой `index_granularity` для таблицы), имеет смысл создавать выборки, размер которых существенно превосходит размер гранулы. - -При выполнении `SAMPLE n` коэффициент сэмплирования заранее неизвестен (то есть нет информации о том, относительно какого количества данных будет сформирована выборка). Чтобы узнать коэффициент сэмплирования, используйте столбец `_sample_factor`. - -Виртуальный столбец `_sample_factor` автоматически создается в тех таблицах, для которых задано выражение `SAMPLE BY` (подробнее см. в разделе [Создание таблицы MergeTree](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table)). В столбце содержится коэффициент сэмплирования для таблицы – он рассчитывается динамически по мере добавления данных в таблицу. Ниже приведены примеры использования столбца `_sample_factor`. - -Предположим, у нас есть таблица, в которой ведется статистика посещений сайта. Пример ниже показывает, как рассчитать суммарное число просмотров: - -``` sql -SELECT sum(PageViews * _sample_factor) -FROM visits -SAMPLE 10000000 -``` - -Следующий пример показывает, как посчитать общее число визитов: - -``` sql -SELECT sum(_sample_factor) -FROM visits -SAMPLE 10000000 -``` - -В примере ниже рассчитывается среднее время на сайте. Обратите внимание, при расчете средних значений, умножать результат на коэффициент сэмплирования не нужно. - -``` sql -SELECT avg(Duration) -FROM visits -SAMPLE 10000000 -``` - -#### SAMPLE k OFFSET m {#select-sample-offset} - -Здесь `k` и `m` – числа в интервале от 0 до 1. Например, `SAMPLE 0.1 OFFSET 0.5`. Поддерживается как дробная, так и десятичная форма записи. - -При задании `SAMPLE k OFFSET m`, выборка будет сформирована из `k` доли данных со смещением на долю `m`. Примеры приведены ниже. - -**Пример 1** - -``` sql -SAMPLE 1/10 -``` - -В этом примере выборка будет сформирована по 1/10 доле всех данных: - -`[++------------------]` - -**Пример 2** - -``` sql -SAMPLE 1/10 OFFSET 1/2 -``` - -Здесь выборка, которая состоит из 1/10 доли данных, взята из второй половины данных. - -`[----------++--------]` - -### Секция ARRAY JOIN {#select-array-join-clause} - -Позволяет выполнить `JOIN` с массивом или вложенной структурой данных. Смысл похож на функцию [arrayJoin](../../sql_reference/statements/select.md#functions_arrayjoin), но функциональность более широкая. - -``` sql -SELECT -FROM -[LEFT] ARRAY JOIN -[WHERE|PREWHERE ] -... -``` - -В запросе может быть указано не более одной секции `ARRAY JOIN`. - -При использовании `ARRAY JOIN`, порядок выполнения запроса оптимизируется. Несмотря на то что секция `ARRAY JOIN` всегда указывается перед выражением `WHERE / PREWHERE`, преобразование `JOIN` может быть выполнено как до выполнения выражения `WHERE / PREWHERE` (если результат необходим в этом выражении), так и после (чтобы уменьшить объём расчетов). Порядок обработки контролируется оптимизатором запросов. - -Секция `ARRAY JOIN` поддерживает следующие формы записи: - -- `ARRAY JOIN` — в этом случае результат `JOIN` не будет содержать пустые массивы; -- `LEFT ARRAY JOIN` — пустые массивы попадут в результат выполнения `JOIN`. В качестве значения для пустых массивов устанавливается значение по умолчанию. Обычно это 0, пустая строка или NULL, в зависимости от типа элементов массива. - -Рассмотрим примеры использования `ARRAY JOIN` и `LEFT ARRAY JOIN`. Для начала создадим таблицу, содержащую столбец с типом [Array](../../sql_reference/statements/select.md), и добавим в него значение: - -``` sql -CREATE TABLE arrays_test -( - s String, - arr Array(UInt8) -) ENGINE = Memory; - -INSERT INTO arrays_test -VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); -``` - -``` text -┌─s───────────┬─arr─────┐ -│ Hello │ [1,2] │ -│ World │ [3,4,5] │ -│ Goodbye │ [] │ -└─────────────┴─────────┘ -``` - -В примере ниже используется `ARRAY JOIN`: - -``` sql -SELECT s, arr -FROM arrays_test -ARRAY JOIN arr; -``` - -``` text -┌─s─────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -└───────┴─────┘ -``` - -Следующий пример использует `LEFT ARRAY JOIN`: - -``` sql -SELECT s, arr -FROM arrays_test -LEFT ARRAY JOIN arr; -``` - -``` text -┌─s───────────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -│ Goodbye │ 0 │ -└─────────────┴─────┘ -``` - -#### Использование алиасов {#ispolzovanie-aliasov} - -Для массива в секции `ARRAY JOIN` может быть указан алиас. В этом случае, элемент массива будет доступен под этим алиасом, а сам массив — под исходным именем. Пример: - -``` sql -SELECT s, arr, a -FROM arrays_test -ARRAY JOIN arr AS a; -``` - -``` text -┌─s─────┬─arr─────┬─a─┐ -│ Hello │ [1,2] │ 1 │ -│ Hello │ [1,2] │ 2 │ -│ World │ [3,4,5] │ 3 │ -│ World │ [3,4,5] │ 4 │ -│ World │ [3,4,5] │ 5 │ -└───────┴─────────┴───┘ -``` - -Используя алиасы, можно выполнять `JOIN` с внешними массивами: - -``` sql -SELECT s, arr_external -FROM arrays_test -ARRAY JOIN [1, 2, 3] AS arr_external; -``` - -``` text -┌─s───────────┬─arr_external─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ Hello │ 3 │ -│ World │ 1 │ -│ World │ 2 │ -│ World │ 3 │ -│ Goodbye │ 1 │ -│ Goodbye │ 2 │ -│ Goodbye │ 3 │ -└─────────────┴──────────────┘ -``` - -В секции `ARRAY JOIN` можно указать через запятую сразу несколько массивов. В этом случае, `JOIN` делается с ними одновременно (прямая сумма, а не прямое произведение). Обратите внимание, массивы должны быть одинаковых размеров. Примеры: - -``` sql -SELECT s, arr, a, num, mapped -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ -│ Hello │ [1,2] │ 1 │ 1 │ 2 │ -│ Hello │ [1,2] │ 2 │ 2 │ 3 │ -│ World │ [3,4,5] │ 3 │ 1 │ 4 │ -│ World │ [3,4,5] │ 4 │ 2 │ 5 │ -│ World │ [3,4,5] │ 5 │ 3 │ 6 │ -└───────┴─────────┴───┴─────┴────────┘ -``` - -В примере ниже используется функция [arrayEnumerate](../../sql_reference/statements/select.md#array_functions-arrayenumerate): - -``` sql -SELECT s, arr, a, num, arrayEnumerate(arr) -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ -│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ -│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ -│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ -│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ -│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ -└───────┴─────────┴───┴─────┴─────────────────────┘ -``` - -#### ARRAY JOIN с вложенными структурами данных {#array-join-s-vlozhennymi-strukturami-dannykh} - -`ARRAY JOIN` также работает с [вложенными структурами данных](../../sql_reference/statements/select.md). Пример: - -``` sql -CREATE TABLE nested_test -( - s String, - nest Nested( - x UInt8, - y UInt32) -) ENGINE = Memory; - -INSERT INTO nested_test -VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); -``` - -``` text -┌─s───────┬─nest.x──┬─nest.y─────┐ -│ Hello │ [1,2] │ [10,20] │ -│ World │ [3,4,5] │ [30,40,50] │ -│ Goodbye │ [] │ [] │ -└─────────┴─────────┴────────────┘ -``` - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -При указании имени вложенной структуры данных в `ARRAY JOIN`, смысл такой же, как `ARRAY JOIN` со всеми элементами-массивами, из которых она состоит. Пример: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`, `nest.y`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -Такой вариант тоже имеет смысл: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─────┐ -│ Hello │ 1 │ [10,20] │ -│ Hello │ 2 │ [10,20] │ -│ World │ 3 │ [30,40,50] │ -│ World │ 4 │ [30,40,50] │ -│ World │ 5 │ [30,40,50] │ -└───────┴────────┴────────────┘ -``` - -Алиас для вложенной структуры данных можно использовать, чтобы выбрать как результат `JOIN`-а, так и исходный массив. Пример: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest AS n; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ -└───────┴─────┴─────┴─────────┴────────────┘ -``` - -Пример использования функции [arrayEnumerate](../../sql_reference/statements/select.md#array_functions-arrayenumerate): - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num -FROM nested_test -ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ -└───────┴─────┴─────┴─────────┴────────────┴─────┘ -``` - -### Секция JOIN {#select-join} - -Соединяет данные в привычном для [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) смысле. - -!!! info "Примечание" - Не связана с функциональностью [ARRAY JOIN](#select-array-join-clause). - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN -(ON )|(USING ) ... -``` - -Вместо `` и `` можно указать имена таблиц. Это эквивалентно подзапросу `SELECT * FROM table`, за исключением особого случая таблицы с движком [Join](../../sql_reference/statements/select.md) – массива, подготовленного для присоединения. - -#### Поддерживаемые типы `JOIN` {#select-join-types} - -- `INNER JOIN` (or `JOIN`) -- `LEFT JOIN` (or `LEFT OUTER JOIN`) -- `RIGHT JOIN` (or `RIGHT OUTER JOIN`) -- `FULL JOIN` (or `FULL OUTER JOIN`) -- `CROSS JOIN` (or `,` ) - -Смотрите описание стандартного [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)). - -#### Множественный JOIN {#mnozhestvennyi-join} - -При выполнении запросов, ClickHouse перезаписывает множественный `JOIN` как комбинацию двух-табличных объединений и обрабатывает их последовательно. Например, если необходимо объединить четыре таблицы, ClickHouse объединяет первую и вторую таблицы, затем соединяет результат с третьей, а затем с четвертой. - -Если запрос содержит секцию `WHERE`, ClickHouse пытается пробросить фильтры из этой секции в промежуточный `JOIN`. Если он не может пробросить фильтр в каждый промежуточный `JOIN`, ClickHouse применяет фильтры после того, как все `JOIN` будут выполнены. - -Для создания запросов мы рекомендуем использовать синтаксис `JOIN ON` или `JOIN USING`. Например: - -``` sql -SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a -``` - -В секции `FROM` вы можете использовать разделенные запятыми списки таблиц для объединения. Например: - -``` sql -SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a -``` - -Не смешивайте синтаксисы. - -ClickHouse не поддерживает синтаксис с запятыми напрямую и мы не рекомендуем его использовать. Алгоритм пытается переписать запрос с помощью секций `CROSS JOIN` и `INNER JOIN` и затем продолжает его выполнение. При переписывании запроса, ClickHouse пытается оптимизировать производительность и потребление памяти. По умолчанию, ClickHouse трактует запятые как `INNER JOIN` и конвертирует их в `CROSS JOIN` когда не может гарантировать, что `INNER JOIN` возвращает запрошенные данные. - -#### Строгость {#select-join-strictness} - -- `ALL` — если правая таблица содержит несколько подходящих строк, то ClickHouse выполняет их [декартово произведение](https://ru.wikipedia.org/wiki/Прямое_произведение). Это стандартное поведение `JOIN` в SQL. -- `ANY` — если в правой таблице несколько соответствующих строк, то присоединяется только первая найденная. Если в правой таблице есть только одна подходящая строка, то результаты `ANY` и `ALL` совпадают. -- `ASOF` — для объединения последовательностей с нечётким совпадением. `ASOF JOIN` описан ниже по тексту. - -**Использование ASOF JOIN** - -`ASOF JOIN` применим в том случае, когда необходимо объединять записи, которые не имеют точного совпадения. - -Таблицы для `ASOF JOIN` должны иметь столбец с отсортированной последовательностью. Этот столбец не может быть единственным в таблице и должен быть одного из типов: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date` и `DateTime`. - -Синтаксис `ASOF JOIN ... ON`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF LEFT JOIN table_2 -ON equi_cond AND closest_match_cond -``` - -Можно использовать произвольное количество условий равенства и одно условие на ближайшее совпадение. Например, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. - -Условия, поддержанные для проверки на ближайшее совпадение: `>`, `>=`, `<`, `<=`. - -Синтаксис `ASOF JOIN ... USING`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF JOIN table_2 -USING (equi_column1, ... equi_columnN, asof_column) -``` - -Для слияния по равенству `ASOF JOIN` использует `equi_columnX`, а для слияния по ближайшему совпадению использует `asof_column` с условием `table_1.asof_column >= table_2.asof_column`. Столбец `asof_column` должен быть последним в секции `USING`. - -Например, рассмотрим следующие таблицы: - - table_1 table_2 - event | ev_time | user_id event | ev_time | user_id - ----------|---------|---------- ----------|---------|---------- - ... ... - event_1_1 | 12:00 | 42 event_2_1 | 11:59 | 42 - ... event_2_2 | 12:30 | 42 - event_1_2 | 13:00 | 42 event_2_3 | 13:00 | 42 - ... ... - -`ASOF JOIN` принимает метку времени пользовательского события из `table_1` и находит такое событие в `table_2` метка времени которого наиболее близка к метке времени события из `table_1` в соответствии с условием на ближайшее совпадение. При этом столбец `user_id` используется для объединения по равенству, а столбец `ev_time` для объединения по ближайшему совпадению. В нашем примере `event_1_1` может быть объединено с `event_2_1`, `event_1_2` может быть объединено с `event_2_3`, а `event_2_2` не объединяется. - -!!! note "Примечание" - `ASOF JOIN` не поддержан для движка таблиц [Join](../../sql_reference/statements/select.md). - -Чтобы задать значение строгости по умолчанию, используйте сессионный параметр [join\_default\_strictness](../../operations/settings/settings.md#settings-join_default_strictness). - -#### GLOBAL JOIN {#global-join} - -При использовании обычного `JOIN` , запрос отправляется на удалённые серверы. На каждом из них выполняются подзапросы для формирования «правой» таблицы, и с этой таблицей выполняется соединение. То есть, «правая» таблица формируется на каждом сервере отдельно. - -При использовании `GLOBAL ... JOIN`, сначала сервер-инициатор запроса запускает подзапрос для вычисления правой таблицы. Эта временная таблица передаётся на каждый удалённый сервер, и на них выполняются запросы с использованием переданных временных данных. - -Будьте аккуратны при использовании `GLOBAL` . За дополнительной информацией обращайтесь в раздел [Распределенные подзапросы](#select-distributed-subqueries). - -**Советы по использованию** - -Из подзапроса удаляются все столбцы, ненужные для `JOIN`. - -При запуске `JOIN`, отсутствует оптимизация порядка выполнения по отношению к другим стадиям запроса. Соединение (поиск в «правой» таблице) выполняется до фильтрации в `WHERE` и до агрегации. Чтобы явно задать порядок вычислений, рекомендуется выполнять `JOIN` подзапроса с подзапросом. - -Пример: - -``` sql -SELECT - CounterID, - hits, - visits -FROM -( - SELECT - CounterID, - count() AS hits - FROM test.hits - GROUP BY CounterID -) ANY LEFT JOIN -( - SELECT - CounterID, - sum(Sign) AS visits - FROM test.visits - GROUP BY CounterID -) USING CounterID -ORDER BY hits DESC -LIMIT 10 -``` - -``` text -┌─CounterID─┬───hits─┬─visits─┐ -│ 1143050 │ 523264 │ 13665 │ -│ 731962 │ 475698 │ 102716 │ -│ 722545 │ 337212 │ 108187 │ -│ 722889 │ 252197 │ 10547 │ -│ 2237260 │ 196036 │ 9522 │ -│ 23057320 │ 147211 │ 7689 │ -│ 722818 │ 90109 │ 17847 │ -│ 48221 │ 85379 │ 4652 │ -│ 19762435 │ 77807 │ 7026 │ -│ 722884 │ 77492 │ 11056 │ -└───────────┴────────┴────────┘ -``` - -У подзапросов нет возможности задать имена и нет возможности их использовать для того, чтобы сослаться на столбец из конкретного подзапроса. -Требуется, чтобы столбцы, указанные в `USING`, назывались одинаково в обоих подзапросах, а остальные столбцы - по-разному. Изменить имена столбцов в подзапросах можно с помощью синонимов (в примере используются синонимы hits и visits). - -В секции `USING` указывается один или несколько столбцов для соединения, что обозначает условие на равенство этих столбцов. Список столбцов задаётся без скобок. Более сложные условия соединения не поддерживаются. - -«Правая» таблица (результат подзапроса) располагается в оперативной памяти. Если её не хватает, вы не сможете выполнить `JOIN`. - -Каждый раз для выполнения запроса с одинаковым `JOIN`, подзапрос выполняется заново — результат не кэшируется. Это можно избежать, используя специальный движок таблиц [Join](../../engines/table_engines/special/join.md), представляющий собой подготовленное множество для соединения, которое всегда находится в оперативке. - -В некоторых случаях более эффективно использовать `IN` вместо `JOIN`. -Среди разных типов `JOIN`, наиболее эффективен `ANY LEFT JOIN`, следующий по эффективности `ANY INNER JOIN`. Наименее эффективны `ALL LEFT JOIN` и `ALL INNER JOIN`. - -Если `JOIN` необходим для соединения с таблицами измерений (dimension tables - сравнительно небольшие таблицы, которые содержат свойства измерений - например, имена для рекламных кампаний), то использование `JOIN` может быть не очень удобным из-за громоздкости синтаксиса, а также из-за того, что правая таблица читается заново при каждом запросе. Специально для таких случаев существует функциональность «Внешние словари», которую следует использовать вместо `JOIN`. Дополнительные сведения смотрите в разделе [Внешние словари](../../sql_reference/statements/select.md). - -**Ограничения по памяти** - -ClickHouse использует алгоритм [hash join](https://en.wikipedia.org/wiki/Hash_join). ClickHouse принимает `` и создает для него хэш-таблицу в RAM. Чтобы ограничить потребление памяти операцией `JOIN`, используйте следующие параметры: - -- [max\_rows\_in\_join](../../operations/settings/query_complexity.md#settings-max_rows_in_join) — ограничивает количество строк в хэш-таблице. -- [max\_bytes\_in\_join](../../operations/settings/query_complexity.md#settings-max_bytes_in_join) — ограничивает размер хэш-таблицы. - -По достижении любого из этих ограничений, ClickHouse действует в соответствии с настройкой [join\_overflow\_mode](../../operations/settings/query_complexity.md#settings-join_overflow_mode). - -#### Обработка пустых ячеек и NULL {#obrabotka-pustykh-iacheek-i-null} - -При слиянии таблиц могут появляться пустые ячейки. То, каким образом ClickHouse заполняет эти ячейки, определяется настройкой [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls). - -Если ключами `JOIN` выступают поля типа [Nullable](../../sql_reference/statements/select.md), то строки, где хотя бы один из ключей имеет значение [NULL](../syntax.md#null-literal), не соединяются. - -#### Ограничения синтаксиса {#ogranicheniia-sintaksisa} - -Для множественных секций `JOIN` в одном запросе `SELECT`: - -- Получение всех столбцов через `*` возможно только при объединении таблиц, но не подзапросов. -- Секция `PREWHERE` недоступна. - -Для секций `ON`, `WHERE` и `GROUP BY`: - -- Нельзя использовать произвольные выражения в секциях `ON`, `WHERE`, и `GROUP BY`, однако можно определить выражение в секции `SELECT` и затем использовать его через алиас в других секциях. - -### Секция WHERE {#select-where} - -Позволяет задать выражение, которое ClickHouse использует для фильтрации данных перед всеми другими действиями в запросе кроме выражений, содержащихся в секции [PREWHERE](#select-prewhere). Обычно, это выражение с логическими операторами. - -Результат выражения должен иметь тип `UInt8`. - -ClickHouse использует в выражении индексы, если это позволяет [движок таблицы](../../sql_reference/statements/select.md). - -Если в секции необходимо проверить [NULL](../syntax.md#null-literal), то используйте операторы [IS NULL](../operators.md#operator-is-null) и [IS NOT NULL](../operators.md#is-not-null), а также соответствующие функции `isNull` и `isNotNull`. В противном случае выражение будет считаться всегда не выполненным. - -Пример проверки на `NULL`: - -``` sql -SELECT * FROM t_null WHERE y IS NULL -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -### Секция PREWHERE {#select-prewhere} - -Имеет такой же смысл, как и секция [WHERE](#select-where). Отличие состоит в том, какие данные читаются из таблицы. -При использовании `PREWHERE`, из таблицы сначала читаются только столбцы, необходимые для выполнения `PREWHERE`. Затем читаются остальные столбцы, нужные для выполнения запроса, но из них только те блоки, в которых выражение в `PREWHERE` истинное. - -`PREWHERE` имеет смысл использовать, если есть условия фильтрации, которые использует меньшинство столбцов из тех, что есть в запросе, но достаточно сильно фильтрует данные. Таким образом, сокращается количество читаемых данных. - -Например, полезно писать `PREWHERE` для запросов, которые вынимают много столбцов, но в которых фильтрация производится лишь по нескольким столбцам. - -`PREWHERE` поддерживается только таблицами семейства `*MergeTree`. - -В запросе могут быть одновременно указаны секции `PREWHERE` и `WHERE`. В этом случае, `PREWHERE` идёт перед `WHERE`. - -Если настройка `optimize_move_to_prewhere` выставлена в `1`, то при отсутствии `PREWHERE`, система будет автоматически переносить части выражений из `WHERE` в `PREWHERE` согласно некоторой эвристике. - -### Секция GROUP BY {#select-group-by-clause} - -Это одна из наиболее важных частей СУБД. - -Секция GROUP BY, если есть, должна содержать список выражений. Каждое выражение далее будем называть «ключом». -При этом, все выражения в секциях SELECT, HAVING, ORDER BY, должны вычисляться из ключей или из агрегатных функций. То есть, каждый выбираемый из таблицы столбец, должен использоваться либо в ключах, либо внутри агрегатных функций. - -Если запрос содержит столбцы таблицы только внутри агрегатных функций, то секция GROUP BY может не указываться, и подразумевается агрегация по пустому набору ключей. - -Пример: - -``` sql -SELECT - count(), - median(FetchTiming > 60 ? 60 : FetchTiming), - count() - sum(Refresh) -FROM hits -``` - -Но, в отличие от стандартного SQL, если в таблице нет строк (вообще нет или после фильтрации с помощью WHERE), в качестве результата возвращается пустой результат, а не результат из одной строки, содержащий «начальные» значения агрегатных функций. - -В отличие от MySQL (и в соответствии со стандартом SQL), вы не можете получить какое-нибудь значение некоторого столбца, не входящего в ключ или агрегатную функцию (за исключением константных выражений). Для обхода этого вы можете воспользоваться агрегатной функцией any (получить первое попавшееся значение) или min/max. - -Пример: - -``` sql -SELECT - domainWithoutWWW(URL) AS domain, - count(), - any(Title) AS title -- getting the first occurred page header for each domain. -FROM hits -GROUP BY domain -``` - -GROUP BY вычисляет для каждого встретившегося различного значения ключей, набор значений агрегатных функций. - -Не поддерживается GROUP BY по столбцам-массивам. - -Не поддерживается указание констант в качестве аргументов агрегатных функций. Пример: sum(1). Вместо этого, вы можете избавиться от констант. Пример: `count()`. - -#### Обработка NULL {#obrabotka-null} - -При группировке, ClickHouse рассматривает [NULL](../syntax.md) как значение, причём `NULL=NULL`. - -Рассмотрим, что это значит на примере. - -Пусть есть таблица: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -В результате запроса `SELECT sum(x), y FROM t_null_big GROUP BY y` мы получим: - -``` text -┌─sum(x)─┬────y─┐ -│ 4 │ 2 │ -│ 3 │ 3 │ -│ 5 │ ᴺᵁᴸᴸ │ -└────────┴──────┘ -``` - -Видно, что `GROUP BY` для `У = NULL` просуммировал `x`, как будто `NULL` — это значение. - -Если в `GROUP BY` передать несколько ключей, то в результате мы получим все комбинации выборки, как если бы `NULL` был конкретным значением. - -#### Модификатор WITH TOTALS {#modifikator-with-totals} - -Если указан модификатор WITH TOTALS, то будет посчитана ещё одна строчка, в которой в столбцах-ключах будут содержаться значения по умолчанию (нули, пустые строки), а в столбцах агрегатных функций - значения, посчитанные по всем строкам («тотальные» значения). - -Эта дополнительная строчка выводится в форматах JSON\*, TabSeparated\*, Pretty\* отдельно от остальных строчек. В остальных форматах эта строчка не выводится. - -В форматах JSON\* строчка выводится отдельным полем totals. В форматах TabSeparated\* строчка выводится после основного результата, и перед ней (после остальных данных) вставляется пустая строка. В форматах Pretty\* строчка выводится отдельной табличкой после основного результата. - -`WITH TOTALS` может выполняться по-разному при наличии HAVING. Поведение зависит от настройки totals\_mode. -По умолчанию `totals_mode = 'before_having'`. В этом случае totals считается по всем строчкам, включая непрошедших через HAVING и max\_rows\_to\_group\_by. - -Остальные варианты учитывают в totals только строчки, прошедшие через HAVING, и имеют разное поведение при наличии настройки `max_rows_to_group_by` и `group_by_overflow_mode = 'any'`. - -`after_having_exclusive` - не учитывать строчки, не прошедшие `max_rows_to_group_by`. То есть в totals попадёт меньше или столько же строчек, чем если бы `max_rows_to_group_by` не было. - -`after_having_inclusive` - учитывать в totals все строчки, не прошедшие max\_rows\_to\_group\_by. То есть в totals попадёт больше или столько же строчек, чем если бы `max_rows_to_group_by` не было. - -`after_having_auto` - считать долю строчек, прошедших через HAVING. Если она больше некоторого значения (по умолчанию - 50%), то включить все строчки, не прошедшие max\_rows\_to\_group\_by в totals, иначе - не включить. - -`totals_auto_threshold` - по умолчанию 0.5. Коэффициент для работы `after_having_auto`. - -Если `max_rows_to_group_by` и `group_by_overflow_mode = 'any'` не используются, то все варианты вида `after_having` не отличаются, и вы можете использовать любой из них, например, `after_having_auto`. - -Вы можете использовать WITH TOTALS в подзапросах, включая подзапросы в секции JOIN (в этом случае соответствующие тотальные значения будут соединены). - -#### GROUP BY во внешней памяти {#select-group-by-in-external-memory} - -Можно включить сброс временных данных на диск, чтобы ограничить потребление оперативной памяти при выполнении `GROUP BY`. -Настройка [max\_bytes\_before\_external\_group\_by](../../operations/settings/settings.md#settings-max_bytes_before_external_group_by) определяет пороговое значение потребления RAM, по достижении которого временные данные `GROUP BY` сбрасываются в файловую систему. Если равно 0 (по умолчанию) - значит выключено. - -При использовании `max_bytes_before_external_group_by`, рекомендуем выставить `max_memory_usage` приблизительно в два раза больше. Это следует сделать, потому что агрегация выполняется в две стадии: чтение и формирование промежуточных данных (1) и слияние промежуточных данных (2). Сброс данных на файловую систему может производиться только на стадии 1. Если сброса временных данных не было, то на стадии 2 может потребляться до такого же объёма памяти, как на стадии 1. - -Например, если [max\_memory\_usage](../../operations/settings/settings.md#settings_max_memory_usage) было выставлено в 10000000000, и вы хотите использовать внешнюю агрегацию, то имеет смысл выставить `max_bytes_before_external_group_by` в 10000000000, а max\_memory\_usage в 20000000000. При срабатывании внешней агрегации (если был хотя бы один сброс временных данных в файловую систему) максимальное потребление оперативки будет лишь чуть-чуть больше `max_bytes_before_external_group_by`. - -При распределённой обработке запроса внешняя агрегация производится на удалённых серверах. Для того чтобы на сервере-инициаторе запроса использовалось немного оперативки, нужно выставить настройку `distributed_aggregation_memory_efficient` в 1. - -При слиянии данных, сброшенных на диск, а также при слиянии результатов с удалённых серверов, при включенной настройке `distributed_aggregation_memory_efficient`, потребляется до `1/256 * the_number_of_threads` количество потоков от общего объёма оперативки. - -При включенной внешней агрегации, если данных было меньше `max_bytes_before_external_group_by` (то есть сброса данных не было), то запрос работает так же быстро, как без внешней агрегации. Если же какие-то временные данные были сброшены, то время выполнения будет в несколько раз больше (примерно в три раза). - -Если есть `ORDER BY` с `LIMIT` после `GROUP BY`, то объём потребляемой RAM будет зависеть от объёма данных в `LIMIT`, а не во всей таблице. Однако, если `ORDER BY` используется без `LIMIT`, не забудьте включить внешнюю сортировку (`max_bytes_before_external_sort`). - -### Секция LIMIT BY {#sektsiia-limit-by} - -Запрос с секцией `LIMIT n BY expressions` выбирает первые `n` строк для каждого отличного значения `expressions`. Ключ `LIMIT BY` может содержать любое количество [выражений](../syntax.md#syntax-expressions). - -ClickHouse поддерживает следующий синтаксис: - -- `LIMIT [offset_value, ]n BY expressions` -- `LIMIT n OFFSET offset_value BY expressions` - -Во время обработки запроса, ClickHouse выбирает данные, упорядоченные по ключу сортировки. Ключ сортировки задаётся явно в секции [ORDER BY](#select-order-by) или неявно в свойствах движка таблицы. Затем ClickHouse применяет `LIMIT n BY expressions` и возвращает первые `n` для каждой отличной комбинации `expressions`. Если указан `OFFSET`, то для каждого блока данных, который принадлежит отдельной комбинации `expressions`, ClickHouse отступает `offset_value` строк от начала блока и возвращает не более `n`. Если `offset_value` больше, чем количество строк в блоке данных, ClickHouse не возвращает ни одной строки. - -`LIMIT BY` не связана с секцией `LIMIT`. Их можно использовать в одном запросе. - -**Примеры** - -Образец таблицы: - -``` sql -CREATE TABLE limit_by(id Int, val Int) ENGINE = Memory; -INSERT INTO limit_by values(1, 10), (1, 11), (1, 12), (2, 20), (2, 21); -``` - -Запросы: - -``` sql -SELECT * FROM limit_by ORDER BY id, val LIMIT 2 BY id -``` - -``` text -┌─id─┬─val─┐ -│ 1 │ 10 │ -│ 1 │ 11 │ -│ 2 │ 20 │ -│ 2 │ 21 │ -└────┴─────┘ -``` - -``` sql -SELECT * FROM limit_by ORDER BY id, val LIMIT 1, 2 BY id -``` - -``` text -┌─id─┬─val─┐ -│ 1 │ 11 │ -│ 1 │ 12 │ -│ 2 │ 21 │ -└────┴─────┘ -``` - -Запрос `SELECT * FROM limit_by ORDER BY id, val LIMIT 2 OFFSET 1 BY id` возвращает такой же результат. - -Следующий запрос выбирает топ 5 рефереров для каждой пары `domain, device_type`, но не более 100 строк (`LIMIT n BY + LIMIT`). - -``` sql -SELECT - domainWithoutWWW(URL) AS domain, - domainWithoutWWW(REFERRER_URL) AS referrer, - device_type, - count() cnt -FROM hits -GROUP BY domain, referrer, device_type -ORDER BY cnt DESC -LIMIT 5 BY domain, device_type -LIMIT 100 -``` - -Запрос выберет топ 5 рефереров для каждой пары `domain, device_type`, но не более 100 строк (`LIMIT n BY + LIMIT`). - -`LIMIT n BY` работает с [NULL](../syntax.md) как если бы это было конкретное значение. Т.е. в результате запроса пользователь получит все комбинации полей, указанных в `BY`. - -### Секция HAVING {#sektsiia-having} - -Позволяет отфильтровать результат, полученный после GROUP BY, аналогично секции WHERE. -WHERE и HAVING отличаются тем, что WHERE выполняется до агрегации (GROUP BY), а HAVING - после. -Если агрегации не производится, то HAVING использовать нельзя. - -### Секция ORDER BY {#select-order-by} - -Секция ORDER BY содержит список выражений, к каждому из которых также может быть приписано DESC или ASC (направление сортировки). Если ничего не приписано - это аналогично приписыванию ASC. ASC - сортировка по возрастанию, DESC - сортировка по убыванию. Обозначение направления сортировки действует на одно выражение, а не на весь список. Пример: `ORDER BY Visits DESC, SearchPhrase` - -Для сортировки по значениям типа String есть возможность указать collation (сравнение). Пример: `ORDER BY SearchPhrase COLLATE 'tr'` - для сортировки по поисковой фразе, по возрастанию, с учётом турецкого алфавита, регистронезависимо, при допущении, что строки в кодировке UTF-8. COLLATE может быть указан или не указан для каждого выражения в ORDER BY независимо. Если есть ASC или DESC, то COLLATE указывается после них. При использовании COLLATE сортировка всегда регистронезависима. - -Рекомендуется использовать COLLATE только для окончательной сортировки небольшого количества строк, так как производительность сортировки с указанием COLLATE меньше, чем обычной сортировки по байтам. - -Строки, для которых список выражений, по которым производится сортировка, принимает одинаковые значения, выводятся в произвольном порядке, который может быть также недетерминированным (каждый раз разным). -Если секция ORDER BY отсутствует, то, аналогично, порядок, в котором идут строки, не определён, и может быть недетерминированным. - -Порядок сортировки `NaN` и `NULL`: - -- С модификатором `NULLS FIRST` — Сначала `NULL`, затем `NaN`, затем остальные значения. -- С модификатором `NULLS LAST` — Сначала значения, затем `NaN`, затем `NULL`. -- По умолчанию — Как с модификатором `NULLS LAST`. - -Пример: - -Для таблицы - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 2 │ -│ 1 │ nan │ -│ 2 │ 2 │ -│ 3 │ 4 │ -│ 5 │ 6 │ -│ 6 │ nan │ -│ 7 │ ᴺᵁᴸᴸ │ -│ 6 │ 7 │ -│ 8 │ 9 │ -└───┴──────┘ -``` - -Выполним запрос `SELECT * FROM t_null_nan ORDER BY y NULLS FIRST`, получим: - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 7 │ ᴺᵁᴸᴸ │ -│ 1 │ nan │ -│ 6 │ nan │ -│ 2 │ 2 │ -│ 2 │ 2 │ -│ 3 │ 4 │ -│ 5 │ 6 │ -│ 6 │ 7 │ -│ 8 │ 9 │ -└───┴──────┘ -``` - -Если кроме ORDER BY указан также не слишком большой LIMIT, то расходуется меньше оперативки. Иначе расходуется количество памяти, пропорциональное количеству данных для сортировки. При распределённой обработке запроса, если отсутствует GROUP BY, сортировка частично делается на удалённых серверах, а на сервере-инициаторе запроса производится слияние результатов. Таким образом, при распределённой сортировке, может сортироваться объём данных, превышающий размер памяти на одном сервере. - -Существует возможность выполнять сортировку во внешней памяти (с созданием временных файлов на диске), если оперативной памяти не хватает. Для этого предназначена настройка `max_bytes_before_external_sort`. Если она выставлена в 0 (по умолчанию), то внешняя сортировка выключена. Если она включена, то при достижении объёмом данных для сортировки указанного количества байт, накопленные данные будут отсортированы и сброшены во временный файл. После того, как все данные будут прочитаны, будет произведено слияние всех сортированных файлов и выдача результата. Файлы записываются в директорию /var/lib/clickhouse/tmp/ (по умолчанию, может быть изменено с помощью параметра tmp\_path) в конфиге. - -На выполнение запроса может расходоваться больше памяти, чем max\_bytes\_before\_external\_sort. Поэтому, значение этой настройки должно быть существенно меньше, чем max\_memory\_usage. Для примера, если на вашем сервере 128 GB оперативки, и вам нужно выполнить один запрос, то выставите max\_memory\_usage в 100 GB, а max\_bytes\_before\_external\_sort в 80 GB. - -Внешняя сортировка работает существенно менее эффективно, чем сортировка в оперативке. - -### Секция SELECT {#select-select} - -[Выражения](../syntax.md#syntax-expressions) указанные в секции `SELECT` анализируются после завершения всех вычислений из секций, описанных выше. Вернее, анализируются выражения, стоящие над агрегатными функциями, если есть агрегатные функции. -Сами агрегатные функции и то, что под ними, вычисляются при агрегации (`GROUP BY`). Эти выражения работают так, как будто применяются к отдельным строкам результата. - -Если в результат необходимо включить все столбцы, используйте символ звёздочка (`*`). Например, `SELECT * FROM ...`. - -Чтобы включить в результат несколько столбцов, выбрав их имена с помощью регулярных выражений [re2](https://en.wikipedia.org/wiki/RE2_(software)), используйте выражение `COLUMNS`. - -``` sql -COLUMNS('regexp') -``` - -Например, рассмотрим таблицу: - -``` sql -CREATE TABLE default.col_names (aa Int8, ab Int8, bc Int8) ENGINE = TinyLog -``` - -Следующий запрос выбирает данные из всех столбцов, содержащих в имени символ `a`. - -``` sql -SELECT COLUMNS('a') FROM col_names -``` - -``` text -┌─aa─┬─ab─┐ -│ 1 │ 1 │ -└────┴────┘ -``` - -Выбранные стоблцы возвращаются не в алфавитном порядке. - -В запросе можно использовать несколько выражений `COLUMNS`, а также вызывать над ними функции. - -Например: - -``` sql -SELECT COLUMNS('a'), COLUMNS('c'), toTypeName(COLUMNS('c')) FROM col_names -``` - -``` text -┌─aa─┬─ab─┬─bc─┬─toTypeName(bc)─┐ -│ 1 │ 1 │ 1 │ Int8 │ -└────┴────┴────┴────────────────┘ -``` - -Каждый столбец, возвращённый выражением `COLUMNS`, передаётся в функцию отдельным аргументом. Также можно передавать и другие аргументы, если функция их поддерживаем. Аккуратно используйте функции. Если функция не поддерживает переданное количество аргументов, то ClickHouse генерирует исключение. - -Например: - -``` sql -SELECT COLUMNS('a') + COLUMNS('c') FROM col_names -``` - -``` text -Received exception from server (version 19.14.1): -Code: 42. DB::Exception: Received from localhost:9000. DB::Exception: Number of arguments for function plus doesn't match: passed 3, should be 2. -``` - -В этом примере, `COLUMNS('a')` возвращает два столбца: `aa` и `ab`. `COLUMNS('c')` возвращает столбец `bc`. Оператор `+` не работает с тремя аргументами, поэтому ClickHouse генерирует исключение с соответствущим сообщением. - -Столбцы, которые возвращаются выражением `COLUMNS` могут быть разных типов. Если `COLUMNS` не возвращает ни одного столбца и это единственное выражение в запросе `SELECT`, то ClickHouse генерирует исключение. - -### Секция DISTINCT {#select-distinct} - -Если указано `DISTINCT`, то из всех множеств полностью совпадающих строк результата, будет оставляться только одна строка. -Результат выполнения будет таким же, как если указано `GROUP BY` по всем указанным полям в `SELECT` и не указаны агрегатные функции. Но имеется несколько отличий от `GROUP BY`: - -- `DISTINCT` может применяться совместно с `GROUP BY`; -- при отсутствии `ORDER BY` и наличии `LIMIT`, запрос прекратит выполнение сразу после того, как будет прочитано необходимое количество различных строк - в этом случае использование DISTINCT существенно более оптимально; -- блоки данных будут выдаваться по мере их обработки, не дожидаясь выполнения всего запроса. - -`DISTINCT` не поддерживается, если в `SELECT` присутствует хотя бы один столбец типа массив. - -`DISTINCT` работает с [NULL](../syntax.md) как если бы `NULL` был конкретным значением, причём `NULL=NULL`. Т.е. в результате `DISTINCT` разные комбинации с `NULL` встретятся только по одному разу. - -ClickHouse поддерживает использование в одном запросе секций `DISTINCT` и `ORDER BY` для разных столбцов. Секция `DISTINCT` исполняется перед секцией `ORDER BY`. - -Таблица для примера: - -``` text -┌─a─┬─b─┐ -│ 2 │ 1 │ -│ 1 │ 2 │ -│ 3 │ 3 │ -│ 2 │ 4 │ -└───┴───┘ -``` - -При выборке данных запросом `SELECT DISTINCT a FROM t1 ORDER BY b ASC`, мы получаем следующий результат: - -``` text -┌─a─┐ -│ 2 │ -│ 1 │ -│ 3 │ -└───┘ -``` - -Если изменить направление сортировки `SELECT DISTINCT a FROM t1 ORDER BY b DESC`, то результат получается следующий: - -``` text -┌─a─┐ -│ 3 │ -│ 1 │ -│ 2 │ -└───┘ -``` - -Строка `2, 4` была удалена перед сортировкой. - -Учитывайте эту особенность реализации при программировании запросов. - -### Секция LIMIT {#sektsiia-limit} - -`LIMIT m` позволяет выбрать из результата первые `m` строк. - -`LIMIT n, m` позволяет выбрать из результата первые `m` строк после пропуска первых `n` строк. Синтаксис `LIMIT m OFFSET n` также поддерживается. - -`n` и `m` должны быть неотрицательными целыми числами. - -При отсутствии секции `ORDER BY`, однозначно сортирующей результат, результат может быть произвольным и может являться недетерминированным. - -### Секция UNION ALL {#sektsiia-union-all} - -Произвольное количество запросов может быть объединено с помощью `UNION ALL`. Пример: - -``` sql -SELECT CounterID, 1 AS table, toInt64(count()) AS c - FROM test.hits - GROUP BY CounterID - -UNION ALL - -SELECT CounterID, 2 AS table, sum(Sign) AS c - FROM test.visits - GROUP BY CounterID - HAVING c > 0 -``` - -Поддерживается только `UNION ALL`. Обычный `UNION` (`UNION DISTINCT`) не поддерживается. Если вам нужен `UNION DISTINCT`, то вы можете написать `SELECT DISTINCT` из подзапроса, содержащего `UNION ALL`. - -Запросы - части `UNION ALL` могут выполняться параллельно, и их результаты могут возвращаться вперемешку. - -Структура результатов (количество и типы столбцов) у запросов должна совпадать. Но имена столбцов могут отличаться. В этом случае, имена столбцов для общего результата будут взяты из первого запроса. При объединении выполняется приведение типов. Например, если в двух объединяемых запросах одно и тоже поле имеет типы не-`Nullable` и `Nullable` от совместимого типа, то в результате `UNION ALL` получим поле типа `Nullable`. - -Запросы - части `UNION ALL` нельзя заключить в скобки. `ORDER BY` и `LIMIT` применяются к отдельным запросам, а не к общему результату. Если вам нужно применить какое-либо преобразование к общему результату, то вы можете разместить все запросы с `UNION ALL` в подзапросе в секции `FROM`. - -### Секция INTO OUTFILE {#into-outfile-clause} - -При указании `INTO OUTFILE filename` (где filename - строковый литерал), результат запроса будет сохранён в файл filename. -В отличие от MySQL, файл создаётся на стороне клиента. Если файл с таким именем уже существует, это приведёт к ошибке. -Функциональность доступна в клиенте командной строки и clickhouse-local (попытка выполнить запрос с INTO OUTFILE через HTTP интерфейс приведёт к ошибке). - -Формат вывода по умолчанию - TabSeparated, как и в не интерактивном режиме клиента командной строки. - -### Секция FORMAT {#format-clause} - -При указании FORMAT format вы можете получить данные в любом указанном формате. -Это может использоваться для удобства или для создания дампов. -Подробнее смотрите раздел «Форматы». -Если секция FORMAT отсутствует, то используется формат по умолчанию, который зависит от используемого интерфейса для доступа к БД и от настроек. Для HTTP интерфейса, а также для клиента командной строки, используемого в batch-режиме, по умолчанию используется формат TabSeparated. Для клиента командной строки, используемого в интерактивном режиме, по умолчанию используется формат PrettyCompact (прикольные таблички, компактные). - -При использовании клиента командной строки данные на клиент передаются во внутреннем эффективном формате. При этом клиент самостоятельно интерпретирует секцию FORMAT запроса и форматирует данные на своей стороне (снимая нагрузку на сеть и сервер). - -### Операторы IN {#select-in-operators} - -Операторы `IN`, `NOT IN`, `GLOBAL IN`, `GLOBAL NOT IN` рассматриваются отдельно, так как их функциональность достаточно богатая. - -В качестве левой части оператора, может присутствовать как один столбец, так и кортеж. - -Примеры: - -``` sql -SELECT UserID IN (123, 456) FROM ... -SELECT (CounterID, UserID) IN ((34, 123), (101500, 456)) FROM ... -``` - -Если слева стоит один столбец, входящий в индекс, а справа - множество констант, то при выполнении запроса, система воспользуется индексом. - -Не перечисляйте слишком большое количество значений (миллионы) явно. Если множество большое - лучше загрузить его во временную таблицу (например, смотрите раздел «Внешние данные для обработки запроса»), и затем воспользоваться подзапросом. - -В качестве правой части оператора может быть множество константных выражений, множество кортежей с константными выражениями (показано в примерах выше), а также имя таблицы или подзапрос SELECT в скобках. - -Если в качестве правой части оператора указано имя таблицы (например, `UserID IN users`), то это эквивалентно подзапросу `UserID IN (SELECT * FROM users)`. Это используется при работе с внешними данными, отправляемым вместе с запросом. Например, вместе с запросом может быть отправлено множество идентификаторов посетителей, загруженное во временную таблицу users, по которому следует выполнить фильтрацию. - -Если в качестве правой части оператора, указано имя таблицы, имеющий движок Set (подготовленное множество, постоянно находящееся в оперативке), то множество не будет создаваться заново при каждом запросе. - -В подзапросе может быть указано более одного столбца для фильтрации кортежей. -Пример: - -``` sql -SELECT (CounterID, UserID) IN (SELECT CounterID, UserID FROM ...) FROM ... -``` - -Типы столбцов слева и справа оператора IN, должны совпадать. - -Оператор IN и подзапрос могут встречаться в любой части запроса, в том числе в агрегатных и лямбда функциях. -Пример: - -``` sql -SELECT - EventDate, - avg(UserID IN - ( - SELECT UserID - FROM test.hits - WHERE EventDate = toDate('2014-03-17') - )) AS ratio -FROM test.hits -GROUP BY EventDate -ORDER BY EventDate ASC -``` - -``` text -┌──EventDate─┬────ratio─┐ -│ 2014-03-17 │ 1 │ -│ 2014-03-18 │ 0.807696 │ -│ 2014-03-19 │ 0.755406 │ -│ 2014-03-20 │ 0.723218 │ -│ 2014-03-21 │ 0.697021 │ -│ 2014-03-22 │ 0.647851 │ -│ 2014-03-23 │ 0.648416 │ -└────────────┴──────────┘ -``` - -за каждый день после 17 марта считаем долю хитов, сделанных посетителями, которые заходили на сайт 17 марта. -Подзапрос в секции IN на одном сервере всегда выполняется только один раз. Зависимых подзапросов не существует. - -#### Обработка NULL {#obrabotka-null-1} - -При обработке запроса оператор IN будет считать, что результат операции с [NULL](../syntax.md) всегда равен `0`, независимо от того, находится `NULL` в правой или левой части оператора. Значения `NULL` не входят ни в какое множество, не соответствуют друг другу и не могут сравниваться. - -Рассмотрим для примера таблицу `t_null`: - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -При выполнении запроса `SELECT x FROM t_null WHERE y IN (NULL,3)` получим следующий результат: - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -Видно, что строка, в которой `y = NULL`, выброшена из результатов запроса. Это произошло потому, что ClickHouse не может решить входит ли `NULL` в множество `(NULL,3)`, возвращает результат операции `0`, а `SELECT` выбрасывает эту строку из финальной выдачи. - -``` sql -SELECT y IN (NULL, 3) -FROM t_null -``` - -``` text -┌─in(y, tuple(NULL, 3))─┐ -│ 0 │ -│ 1 │ -└───────────────────────┘ -``` - -#### Распределённые подзапросы {#select-distributed-subqueries} - -Существует два варианта IN-ов с подзапросами (аналогично для JOIN-ов): обычный `IN` / `JOIN` и `GLOBAL IN` / `GLOBAL JOIN`. Они отличаются способом выполнения при распределённой обработке запроса. - -!!! attention "Attention" - Помните, что алгоритмы, описанные ниже, могут работать иначе в зависимости от [настройки](../../operations/settings/settings.md) `distributed_product_mode`. - -При использовании обычного IN-а, запрос отправляется на удалённые серверы, и на каждом из них выполняются подзапросы в секциях `IN` / `JOIN`. - -При использовании `GLOBAL IN` / `GLOBAL JOIN-а`, сначала выполняются все подзапросы для `GLOBAL IN` / `GLOBAL JOIN-ов`, и результаты складываются во временные таблицы. Затем эти временные таблицы передаются на каждый удалённый сервер, и на них выполняются запросы, с использованием этих переданных временных данных. - -Если запрос не распределённый, используйте обычный `IN` / `JOIN`. - -Следует быть внимательным при использовании подзапросов в секции `IN` / `JOIN` в случае распределённой обработки запроса. - -Рассмотрим это на примерах. Пусть на каждом сервере кластера есть обычная таблица **local\_table**. Пусть также есть таблица **distributed\_table** типа **Distributed**, которая смотрит на все серверы кластера. - -При запросе к распределённой таблице **distributed\_table**, запрос будет отправлен на все удалённые серверы, и на них будет выполнен с использованием таблицы **local\_table**. - -Например, запрос - -``` sql -SELECT uniq(UserID) FROM distributed_table -``` - -будет отправлен на все удалённые серверы в виде - -``` sql -SELECT uniq(UserID) FROM local_table -``` - -, выполнен параллельно на каждом из них до стадии, позволяющей объединить промежуточные результаты; затем промежуточные результаты вернутся на сервер-инициатор запроса, будут на нём объединены, и финальный результат будет отправлен клиенту. - -Теперь рассмотрим запрос с IN-ом: - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) -``` - -- расчёт пересечения аудиторий двух сайтов. - -Этот запрос будет отправлен на все удалённые серверы в виде - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) -``` - -То есть, множество в секции IN будет собрано на каждом сервере независимо, только по тем данным, которые есть локально на каждом из серверов. - -Это будет работать правильно и оптимально, если вы предусмотрели такой случай, и раскладываете данные по серверам кластера таким образом, чтобы данные одного UserID-а лежали только на одном сервере. В таком случае все необходимые данные будут присутствовать на каждом сервере локально. В противном случае результат будет посчитан неточно. Назовём этот вариант запроса «локальный IN». - -Чтобы исправить работу запроса, когда данные размазаны по серверам кластера произвольным образом, можно было бы указать **distributed\_table** внутри подзапроса. Запрос будет выглядеть так: - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -Этот запрос будет отправлен на все удалённые серверы в виде - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -На каждом удалённом сервере начнёт выполняться подзапрос. Так как в подзапросе используется распределённая таблица, то подзапрос будет, на каждом удалённом сервере, снова отправлен на каждый удалённый сервер, в виде - -``` sql -SELECT UserID FROM local_table WHERE CounterID = 34 -``` - -Например, если у вас кластер из 100 серверов, то выполнение всего запроса потребует 10 000 элементарных запросов, что, как правило, является неприемлемым. - -В таких случаях всегда следует использовать GLOBAL IN вместо IN. Рассмотрим его работу для запроса - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID GLOBAL IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -На сервере-инициаторе запроса будет выполнен подзапрос - -``` sql -SELECT UserID FROM distributed_table WHERE CounterID = 34 -``` - -, и результат будет сложен во временную таблицу в оперативке. Затем запрос будет отправлен на каждый удалённый сервер в виде - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID GLOBAL IN _data1 -``` - -, и вместе с запросом, на каждый удалённый сервер будет отправлена временная таблица `_data1` (имя временной таблицы - implementation defined). - -Это гораздо более оптимально, чем при использовании обычного IN. Но при этом, следует помнить о нескольких вещах: - -1. При создании временной таблицы данные не уникализируются. Чтобы уменьшить объём передаваемых по сети данных, укажите в подзапросе DISTINCT (для обычного IN-а этого делать не нужно). -2. Временная таблица будет передана на все удалённые серверы. Передача не учитывает топологию сети. Например, если 10 удалённых серверов расположены в удалённом относительно сервера-инициатора запроса дата-центре, то по каналу в удалённый дата-центр данные будет переданы 10 раз. Старайтесь не использовать большие множества при использовании GLOBAL IN. -3. При передаче данных на удалённые серверы не настраивается ограничение использования сетевой полосы. Вы можете перегрузить сеть. -4. Старайтесь распределять данные по серверам так, чтобы в GLOBAL IN-ах не было частой необходимости. -5. Если в GLOBAL IN есть частая необходимость, то спланируйте размещение кластера ClickHouse таким образом, чтобы в каждом дата-центре была хотя бы одна реплика каждого шарда, и среди них была быстрая сеть - чтобы запрос целиком можно было бы выполнить, передавая данные в пределах одного дата-центра. - -В секции `GLOBAL IN` также имеет смысл указывать локальную таблицу - в случае, если эта локальная таблица есть только на сервере-инициаторе запроса, и вы хотите воспользоваться данными из неё на удалённых серверах. - -### Экстремальные значения {#ekstremalnye-znacheniia} - -Вы можете получить в дополнение к результату также минимальные и максимальные значения по столбцам результата. Для этого выставите настройку **extremes** в 1. Минимумы и максимумы считаются для числовых типов, дат, дат-с-временем. Для остальных столбцов будут выведены значения по умолчанию. - -Вычисляются дополнительные две строчки - минимумы и максимумы, соответственно. Эти две дополнительные строки выводятся в [форматах](../../interfaces/formats.md) `JSON*`, `TabSeparated*`, и `Pretty*` отдельно от остальных строчек. В остальных форматах они не выводится. - -Во форматах `JSON*`, экстремальные значения выводятся отдельным полем ‘extremes’. В форматах `TabSeparated*`, строка выводится после основного результата и после ‘totals’ если есть. Перед ней (после остальных данных) вставляется пустая строка. В форматах `Pretty*`, строка выводится отдельной таблицей после основного результата и после `totals` если есть. - -Экстремальные значения вычисляются для строк перед `LIMIT`, но после `LIMIT BY`. Однако при использовании `LIMIT offset, size`, строки перед `offset` включаются в `extremes`. В потоковых запросах, в результате может учитываться также небольшое количество строчек, прошедших `LIMIT`. - -### Замечания {#zamechaniia} - -В секциях `GROUP BY`, `ORDER BY`, в отличие от диалекта MySQL, и в соответствии со стандартным SQL, не поддерживаются позиционные аргументы. -Например, если вы напишите `GROUP BY 1, 2` - то это будет воспринято, как группировка по константам (то есть, агрегация всех строк в одну). - -Вы можете использовать синонимы (алиасы `AS`) в любом месте запроса. - -В любом месте запроса, вместо выражения, может стоять звёздочка. При анализе запроса звёздочка раскрывается в список всех столбцов таблицы (за исключением `MATERIALIZED` и `ALIAS` столбцов). Есть лишь немного случаев, когда оправдано использовать звёздочку: - -- при создании дампа таблицы; -- для таблиц, содержащих всего несколько столбцов - например, системных таблиц; -- для получения информации о том, какие столбцы есть в таблице; в этом случае, укажите `LIMIT 1`. Но лучше используйте запрос `DESC TABLE`; -- при наличии сильной фильтрации по небольшому количеству столбцов с помощью `PREWHERE`; -- в подзапросах (так как из подзапросов выкидываются столбцы, не нужные для внешнего запроса). - -В других случаях использование звёздочки является издевательством над системой, так как вместо преимуществ столбцовой СУБД вы получаете недостатки. То есть использовать звёздочку не рекомендуется. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/select/) diff --git a/docs/ru/sql_reference/statements/show.md b/docs/ru/sql_reference/statements/show.md deleted file mode 100644 index 545301d6166..00000000000 --- a/docs/ru/sql_reference/statements/show.md +++ /dev/null @@ -1,98 +0,0 @@ -# SHOW Queries {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Возвращает один столбец типа `String` с именем statement, содержащий одно значение — запрос `CREATE TABLE`, с помощью которого был создан указанный объект. - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -Выводит список всех баз данных. -Запрос полностью аналогичен запросу `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -Выводит содержимое таблицы [system.processes](../../operations/system_tables.md#system_tables-processes), которая содержит список запросов, выполняющихся в данный момент времени, кроме самих запросов `SHOW PROCESSLIST`. - -Запрос `SELECT * FROM system.processes` возвращает данные обо всех текущих запросах. - -Полезный совет (выполните в консоли): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -Выводит список таблиц. - -``` sql -SHOW [TEMPORARY] TABLES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Если секция `FROM` не используется, то запрос возвращает список таблиц из текущей базы данных. - -Результат, идентичный тому, что выдаёт запрос `SHOW TABLES` можно получить также запросом следующего вида: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Пример** - -Следующий запрос выбирает первые две строки из списка таблиц в базе данных `system`, чьи имена содержат `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -Выводит список [внешних словарей](../../sql_reference/statements/show.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Если секция `FROM` не указана, запрос возвращает список словарей из текущей базы данных. - -Аналогичный результат можно получить следующим запросом: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Example** - -Запрос выводит первые две стоки из списка таблиц в базе данных `system`, имена которых содержат `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/show/) diff --git a/docs/ru/sql_reference/statements/system.md b/docs/ru/sql_reference/statements/system.md deleted file mode 100644 index 2a4acd15e7f..00000000000 --- a/docs/ru/sql_reference/statements/system.md +++ /dev/null @@ -1,106 +0,0 @@ -# Запросы SYSTEM {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -Перегружает все словари, которые были успешно загружены до этого. -По умолчанию включена ленивая загрузка [dictionaries\_lazy\_load](../../sql_reference/statements/system.md#dictionaries-lazy-load), поэтому словари не загружаются автоматически при старте, а только при первом обращении через dictGet или SELECT к ENGINE=Dictionary. После этого такие словари (LOADED) будут перегружаться командой `system reload dictionaries`. -Всегда возвращает `Ok.`, вне зависимости от результата обновления словарей. - -## RELOAD DICTIONARY dictionary\_name {#query_language-system-reload-dictionary} - -Полностью перегружает словарь `dictionary_name`, вне зависимости от состояния словаря (LOADED/NOT\_LOADED/FAILED). -Всегда возвращает `Ok.`, вне зависимости от результата обновления словаря. -Состояние словаря можно проверить запросом к `system.dictionaries`. - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -Сбрасывает внутренний DNS кеш ClickHouse. Иногда (для старых версий ClickHouse) необходимо использовать эту команду при изменении инфраструктуры (смене IP адреса у другого ClickHouse сервера или сервера, используемого словарями). - -Для более удобного (автоматического) управления кешем см. параметры disable\_internal\_dns\_cache, dns\_cache\_update\_period. - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -Сбрасывает кеш «засечек» (`mark cache`). Используется при разработке ClickHouse и тестах производительности. - -## FLUSH LOGS {#query_language-system-flush_logs} - -Записывает буферы логов в системные таблицы (например system.query\_log). Позволяет не ждать 7.5 секунд при отладке. - -## RELOAD CONFIG {#query_language-system-reload-config} - -Перечитывает конфигурацию настроек ClickHouse. Используется при хранении конфигурации в zookeeeper. - -## SHUTDOWN {#query_language-system-shutdown} - -Штатно завершает работу ClickHouse (аналог `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -Аварийно завершает работу ClickHouse (аналог `kill -9 {$pid_clickhouse-server}`) - -## Управление распределёнными таблицами {#query-language-system-distributed} - -ClickHouse может оперировать [распределёнными](../../sql_reference/statements/system.md) таблицами. Когда пользователь вставляет данные в эти таблицы, ClickHouse сначала формирует очередь из данных, которые должны быть отправлены на узлы кластера, а затем асинхронно отправляет подготовленные данные. Вы можете управлять очередью с помощью запросов [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) и [FLUSH DISTRIBUTED](#query_language-system-flush-distributed). Также есть возможность синхронно вставлять распределенные данные с помощью настройки `insert_distributed_sync`. - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -Отключает фоновую отправку при вставке данных в распределённые таблицы. - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -В синхронном режиме отправляет все данные на узлы кластера. Если какие-либо узлы недоступны, ClickHouse генерирует исключение и останавливает выполнение запроса. Такой запрос можно повторять до успешного завершения, что будет означать возвращение связанности с остальными узлами кластера. - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -Включает фоновую отправку при вставке данных в распределенные таблицы. - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -Позволяет остановить фоновые мержи для таблиц семейства MergeTree: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "Note" - `DETACH / ATTACH` таблицы восстанавливает фоновые мержи для этой таблицы (даже в случае отключения фоновых мержей для всех таблиц семейства MergeTree до `DETACH`). - -### START MERGES {#query_language-system-start-merges} - -Включает фоновые мержи для таблиц семейства MergeTree: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/system/) diff --git a/docs/ru/sql_reference/syntax.md b/docs/ru/sql_reference/syntax.md deleted file mode 100644 index b9576e48a59..00000000000 --- a/docs/ru/sql_reference/syntax.md +++ /dev/null @@ -1,179 +0,0 @@ -# Синтаксис {#sintaksis} - -В системе есть два вида парсеров: полноценный парсер SQL (recursive descent parser) и парсер форматов данных (быстрый потоковый парсер). -Во всех случаях кроме запроса INSERT, используется только полноценный парсер SQL. -В запросе INSERT используется оба парсера: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -Фрагмент `INSERT INTO t VALUES` парсится полноценным парсером, а данные `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` - быстрым потоковым парсером. -Данные могут иметь любой формат. При получении запроса, сервер заранее считывает в оперативку не более `max_query_size` байт запроса (по умолчанию, 1МБ), а всё остальное обрабатывается потоково. -Таким образом, в системе нет проблем с большими INSERT запросами, как в MySQL. - -При использовании формата Values в INSERT запросе может сложиться иллюзия, что данные парсятся также, как выражения в запросе SELECT, но это не так. Формат Values гораздо более ограничен. - -Далее пойдёт речь о полноценном парсере. О парсерах форматов, смотри раздел «Форматы». - -## Пробелы {#probely} - -Между синтаксическими конструкциями (в том числе, в начале и конце запроса) может быть расположено произвольное количество пробельных символов. К пробельным символам относятся пробел, таб, перевод строки, CR, form feed. - -## Комментарии {#kommentarii} - -Поддерживаются комментарии в SQL-стиле и C-стиле. -Комментарии в SQL-стиле: от `--` до конца строки. Пробел после `--` может не ставиться. -Комментарии в C-стиле: от `/*` до `*/`. Такие комментарии могут быть многострочными. Пробелы тоже не обязательны. - -## Ключевые слова {#syntax-keywords} - -Ключевые слова не зависят от регистра, если они соответствуют: - -- Стандарту SQL. Например, применение любого из вариантов `SELECT`, `select` или `SeLeCt` не вызовет ошибки. -- Реализации в некоторых популярных DBMS (MySQL или Postgres). Например, `DateTime` и `datetime`. - -Зависимость от регистра для имён типов данных можно проверить в таблице `system.data_type_families`. - -В отличие от стандарта SQL, все остальные ключевые слова, включая названия функций зависят от регистра. - -Ключевые слова не зарезервированы (а всего лишь парсятся как ключевые слова в соответствующем контексте). Если вы используете [идентификаторы](#syntax-identifiers), совпадающие с ключевыми словами, заключите их в кавычки. Например, запрос `SELECT "FROM" FROM table_name` валиден, если таблица `table_name` имеет столбец с именем `"FROM"`. - -## Идентификаторы {#syntax-identifiers} - -Идентификаторы: - -- Имена кластеров, баз данных, таблиц, разделов и столбцов; -- Функции; -- Типы данных; -- [Синонимы выражений](#syntax-expression_aliases). - -Некоторые идентификаторы нужно указывать в кавычках (например, идентификаторы с пробелами). Прочие идентификаторы можно указывать без кавычек. Рекомендуется использовать идентификаторы, не требующие кавычек. - -Идентификаторы не требующие кавычек соответствуют регулярному выражению `^[a-zA-Z_][0-9a-zA-Z_]*$` и не могут совпадать с [ключевыми словами](#syntax-keywords). Примеры: `x, _1, X_y__Z123_.` - -Если вы хотите использовать идентификаторы, совпадающие с ключевыми словами, или использовать в идентификаторах символы, не входящие в регулярное выражение, заключите их в двойные или обратные кавычки, например, `"id"`, `` `id` ``. - -## Литералы {#literaly} - -Существуют: числовые, строковые, составные литералы и `NULL`. - -### Числовые {#chislovye} - -Числовой литерал пытается распарситься: - -- Сначала как знаковое 64-разрядное число, функцией [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul). -- Если не получилось, то как беззнаковое 64-разрядное число, функцией [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol). -- Если не получилось, то как число с плавающей запятой, функцией [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof). -- Иначе — ошибка. - -Соответствующее значение будет иметь тип минимального размера, который вмещает значение. -Например, 1 парсится как `UInt8`, а 256 как `UInt16`. Подробнее о типах данных читайте в разделе [Типы данных](../sql_reference/syntax.md). - -Примеры: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### Строковые {#syntax-string-literal} - -Поддерживаются только строковые литералы в одинарных кавычках. Символы внутри могут быть экранированы с помощью обратного слеша. Следующие escape-последовательности имеют соответствующее специальное значение: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. Во всех остальных случаях, последовательности вида `\c`, где `c` — любой символ, преобразуется в `c` . Таким образом, могут быть использованы последовательности `\'` и `\\`. Значение будет иметь тип [String](../sql_reference/syntax.md). - -Минимальный набор символов, которых вам необходимо экранировать в строковых литералах: `'` и `\`. Одинарная кавычка может быть экранирована одинарной кавычкой, литералы `'It\'s'` и `'It''s'` эквивалентны. - -### Составные {#sostavnye} - -Поддерживаются конструкции для массивов: `[1, 2, 3]` и кортежей: `(1, 'Hello, world!', 2)`. -На самом деле, это вовсе не литералы, а выражение с оператором создания массива и оператором создания кортежа, соответственно. -Массив должен состоять хотя бы из одного элемента, а кортеж - хотя бы из двух. -Кортежи носят служебное значение для использования в секции `IN` запроса `SELECT`. Кортежи могут быть получены как результат запроса, но они не могут быть сохранены в базе данных (за исключением таблицы [Memory](../sql_reference/syntax.md).) - -### NULL {#null-literal} - -Обозначает, что значение отсутствует. - -Чтобы в поле таблицы можно было хранить `NULL`, оно должно быть типа [Nullable](../sql_reference/syntax.md). - -В зависимости от формата данных (входных или выходных) `NULL` может иметь различное представление. Подробнее смотрите в документации для [форматов данных](../interfaces/formats.md#formats). - -При обработке `NULL` есть множество особенностей. Например, если хотя бы один из аргументов операции сравнения — `NULL`, то результатом такой операции тоже будет `NULL`. Этим же свойством обладают операции умножения, сложения и пр. Подробнее читайте в документации на каждую операцию. - -В запросах можно проверить `NULL` с помощью операторов [IS NULL](operators.md#operator-is-null) и [IS NOT NULL](operators.md), а также соответствующих функций `isNull` и `isNotNull`. - -## Функции {#funktsii} - -Функции записываются как идентификатор со списком аргументов (возможно, пустым) в скобках. В отличие от стандартного SQL, даже в случае пустого списка аргументов, скобки обязательны. Пример: `now()`. -Бывают обычные и агрегатные функции (смотрите раздел «Агрегатные функции»). Некоторые агрегатные функции могут содержать два списка аргументов в круглых скобках. Пример: `quantile(0.9)(x)`. Такие агрегатные функции называются «параметрическими», а первый список аргументов называется «параметрами». Синтаксис агрегатных функций без параметров ничем не отличается от обычных функций. - -## Операторы {#operatory} - -Операторы преобразуются в соответствующие им функции во время парсинга запроса, с учётом их приоритета и ассоциативности. -Например, выражение `1 + 2 * 3 + 4` преобразуется в `plus(plus(1, multiply(2, 3)), 4)`. - -## Типы данных и движки таблиц {#tipy-dannykh-i-dvizhki-tablits} - -Типы данных и движки таблиц в запросе `CREATE` записываются также, как идентификаторы или также как функции. То есть, могут содержать или не содержать список аргументов в круглых скобках. Подробнее смотрите разделы «Типы данных», «Движки таблиц», «CREATE». - -## Синонимы выражений {#syntax-expression_aliases} - -Синоним — это пользовательское имя выражения в запросе. - -``` sql -expr AS alias -``` - -- `AS` — ключевое слово для определения синонимов. Можно определить синоним для имени таблицы или столбца в секции `SELECT` без использования ключевого слова `AS` . - - Например, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - В функции [CAST](sql_reference/syntax.md#type_conversion_function-cast), ключевое слово `AS` имеет другое значение. Смотрите описание функции. - -- `expr` — любое выражение, которое поддерживает ClickHouse. - - Например, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — имя для `выражения`. Синонимы должны соответствовать синтаксису [идентификаторов](#syntax-identifiers). - - Например, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### Примечания по использованию {#primechaniia-po-ispolzovaniiu} - -Синонимы являются глобальными для запроса или подзапроса, и вы можете определить синоним в любой части запроса для любого выражения. Например, `SELECT (1 AS n) + 2, n`. - -Синонимы не передаются в подзапросы и между подзапросами. Например, при выполнении запроса `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse сгенерирует исключение `Unknown identifier: num`. - -Если синоним определен для результирующих столбцов в секции `SELECT` вложенного запроса, то эти столбцы отображаются во внешнем запросе. Например, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -Будьте осторожны с синонимами, совпадающими с именами столбцов или таблиц. Рассмотрим следующий пример: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -В этом примере мы объявили таблицу `t` со столбцом `b`. Затем, при выборе данных, мы определили синоним `sum(b) AS b`. Поскольку синонимы глобальные, то ClickHouse заменил литерал `b` в выражении `argMax(a, b)` выражением `sum(b)`. Эта замена вызвала исключение. - -## Звёздочка {#zviozdochka} - -В запросе `SELECT`, вместо выражения может стоять звёздочка. Подробнее смотрите раздел «SELECT». - -## Выражения {#syntax-expressions} - -Выражение представляет собой функцию, идентификатор, литерал, применение оператора, выражение в скобках, подзапрос, звёздочку. А также может содержать синоним. -Список выражений - одно выражение или несколько выражений через запятую. -Функции и операторы, в свою очередь, в качестве аргументов, могут иметь произвольные выражения. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/syntax/) diff --git a/docs/ru/sql_reference/table_functions/file.md b/docs/ru/sql_reference/table_functions/file.md deleted file mode 100644 index e0da3ddc15f..00000000000 --- a/docs/ru/sql_reference/table_functions/file.md +++ /dev/null @@ -1,107 +0,0 @@ -# file {#file} - -Создаёт таблицу из файла. Данная табличная функция похожа на табличные функции [file](file.md) и [hdfs](hdfs.md). - -``` sql -file(path, format, structure) -``` - -**Входные параметры** - -- `path` — относительный путь до файла от [user\_files\_path](../../sql_reference/table_functions/file.md#server_configuration_parameters-user_files_path). Путь к файлу поддерживает следующие шаблоны в режиме доступа только для чтения `*`, `?`, `{abc,def}` и `{N..M}`, где `N`, `M` — числа, \``'abc', 'def'` — строки. -- `format` — [формат](../../interfaces/formats.md#formats) файла. -- `structure` — структура таблицы. Формат `'colunmn1_name column1_ype, column2_name column2_type, ...'`. - -**Возвращаемое значение** - -Таблица с указанной структурой, предназначенная для чтения или записи данных в указанном файле. - -**Пример** - -Настройка `user_files_path` и содержимое файла `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -Таблица из `test.csv` и выборка первых двух строк из неё: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -Шаблоны могут содержаться в нескольких компонентах пути. Обрабатываются только существующие файлы, название которых целиком удовлетворяет шаблону (не только суффиксом или префиксом). - -- `*` — Заменяет любое количество любых символов кроме `/`, включая отсутствие символов. -- `?` — Заменяет ровно один любой символ. -- `{some_string,another_string,yet_another_one}` — Заменяет любую из строк `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Заменяет любое число в интервале от `N` до `M` включительно (может содержать ведущие нули). - -Конструкция с `{}` аналогична табличной функции [remote](remote.md). - -**Пример** - -1. Предположим у нас есть несколько файлов со следующими относительными путями: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. Запросим количество строк в этих файлах: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Запросим количество строк во всех файлах этих двух директорий: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Warning" - Если ваш список файлов содержит интервал с ведущими нулями, используйте конструкцию с фигурными скобками для каждой цифры по отдельности или используйте `?`. - -**Пример** - -Запрос данных из файлов с именами `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Виртуальные столбцы {#virtualnye-stolbtsy} - -- `_path` — Путь к файлу. -- `_file` — Имя файла. - -**Смотрите также** - -- [Виртуальные столбцы](index.md#table_engines-virtual_columns) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/file/) diff --git a/docs/ru/sql_reference/table_functions/index.md b/docs/ru/sql_reference/table_functions/index.md deleted file mode 100644 index 70c701d1713..00000000000 --- a/docs/ru/sql_reference/table_functions/index.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -toc_folder_title: Табличные функции -toc_priority: 34 -toc_title: Введение ---- - -# Табличные функции {#tablichnye-funktsii} - -Табличные функции — это метод создания таблиц. - -Табличные функции можно использовать в: - -- Секции [FROM](../statements/select.md#select-from) запроса `SELECT`. - - Это способ создания временной таблицы, которая доступна только в текущем запросе. - -- Запросе [CREATE TABLE AS \](../statements/create.md#create-table-query). - - Это один из методов создания таблицы. - -!!! warning "Предупреждение" - Если настройка [allow\_ddl](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) выключена, то использовать табличные функции невозможно. - -| Функция | Описание | -|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------| -| [file](file.md) | Создаёт таблицу с движком [File](../../sql_reference/table_functions/index.md). | -| [merge](merge.md) | Создаёт таблицу с движком [Merge](../../sql_reference/table_functions/index.md). | -| [numbers](numbers.md) | Создаёт таблицу с единственным столбцом, заполненным целыми числами. | -| [remote](remote.md) | Предоставляет доступ к удалённым серверам, не создавая таблицу с движком [Distributed](../../sql_reference/table_functions/index.md). | -| [url](url.md) | Создаёт таблицу с движком [Url](../../sql_reference/table_functions/index.md). | -| [mysql](mysql.md) | Создаёт таблицу с движком [MySQL](../../sql_reference/table_functions/index.md). | -| [jdbc](jdbc.md) | Создаёт таблицу с дижком [JDBC](../../sql_reference/table_functions/index.md). | -| [odbc](odbc.md) | Создаёт таблицу с движком [ODBC](../../sql_reference/table_functions/index.md). | -| [hdfs](hdfs.md) | Создаёт таблицу с движком [HDFS](../../sql_reference/table_functions/index.md). | - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/) diff --git a/docs/ru/sql_reference/table_functions/mysql.md b/docs/ru/sql_reference/table_functions/mysql.md deleted file mode 100644 index a26f89ced2f..00000000000 --- a/docs/ru/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,79 +0,0 @@ -# mysql {#mysql} - -Позволяет выполнять запросы `SELECT` над данными, хранящимися на удалённом MySQL сервере. - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**Параметры** - -- `host:port` — адрес сервера MySQL. - -- `database` — имя базы данных на удалённом сервере. - -- `table` — имя таблицы на удалённом сервере. - -- `user` — пользователь MySQL. - -- `password` — пароль пользователя. - -- `replace_query` — флаг, отвечающий за преобразование запросов `INSERT INTO` в `REPLACE INTO`. Если `replace_query=1`, то запрос заменяется. - -- `on_duplicate_clause` — выражение `ON DUPLICATE KEY on_duplicate_clause`, добавляемое в запрос `INSERT`. - - Пример: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, где `on_duplicate_clause` это `UPDATE c2 = c2 + 1`. Чтобы узнать какие `on_duplicate_clause` можно использовать с секцией `ON DUPLICATE KEY` обратитесь к документации MySQL. - - Чтобы указать `'on_duplicate_clause'` необходимо передать `0` в параметр `replace_query`. Если одновременно передать `replace_query = 1` и `'on_duplicate_clause'`, то ClickHouse сгенерирует исключение. - -Простые условия `WHERE` такие как `=, !=, >, >=, <, =` выполняются на стороне сервера MySQL. - -Остальные условия и ограничение выборки `LIMIT` будут выполнены в ClickHouse только после выполнения запроса к MySQL. - -**Возвращаемое значение** - -Объект таблицы с теми же столбцами, что и в исходной таблице MySQL. - -## Пример использования {#primer-ispolzovaniia} - -Таблица в MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+--------+--------------+-------+----------------+ -| int_id | int_nullable | float | float_nullable | -+--------+--------------+-------+----------------+ -| 1 | NULL | 2 | NULL | -+--------+--------------+-------+----------------+ -1 row in set (0,00 sec) -``` - -Получение данных в ClickHouse: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Смотрите также {#smotrite-takzhe} - -- [Движок таблиц ‘MySQL’](../../sql_reference/table_functions/mysql.md) -- [Использование MySQL как источника данных для внешнего словаря](../../sql_reference/table_functions/mysql.md#dicts-external_dicts_dict_sources-mysql) - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/mysql/) diff --git a/docs/ru/sql_reference/table_functions/odbc.md b/docs/ru/sql_reference/table_functions/odbc.md deleted file mode 100644 index 0d277b2b26d..00000000000 --- a/docs/ru/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,101 +0,0 @@ -# odbc {#table-functions-odbc} - -Возвращает таблицу, подключенную через [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -Параметры: - -- `connection_settings` — название секции с настройками соединения в файле `odbc.ini`. -- `external_database` — имя базы данных во внешней СУБД. -- `external_table` — имя таблицы в `external_database`. - -Чтобы использование ODBC было безопасным, ClickHouse использует отдельную программу `clickhouse-odbc-bridge`. Если драйвер ODBC подгружать непосредственно из `clickhouse-server`, то проблемы с драйвером могут привести к аварийной остановке сервера ClickHouse. ClickHouse автоматически запускает `clickhouse-odbc-bridge` по мере необходимости. Программа устанавливается из того же пакета, что и `clickhouse-server`. - -Поля из внешней таблицы со значениями `NULL` получают значение по умолчанию для базового типа данных. Например, если поле в удалённой таблице MySQL имеет тип `INT NULL` оно сконвертируется в 0 (значение по умолчанию для типа данных ClickHouse `Int32`). - -## Пример использования {#primer-ispolzovaniia} - -**Получение данных из локальной установки MySQL через ODBC** - -Этот пример проверялся в Ubuntu Linux 18.04 для MySQL server 5.7. - -Убедитесь, что unixODBC и MySQL Connector установлены. - -По умолчанию (если установлен из пакетов) ClickHouse запускается от имени пользователя `clickhouse`. Таким образом, вам нужно создать и настроить этого пользователя на сервере MySQL. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Теперь настроим соединение в `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Вы можете проверить соединение с помощью утилиты `isql` из установки unixODBC. - -``` bash -$ isql -v mysqlconn -+---------------------------------------+ -| Connected! | -| | -... -``` - -Таблица в MySQL: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+--------+--------------+-------+----------------+ -| int_id | int_nullable | float | float_nullable | -+--------+--------------+-------+----------------+ -| 1 | NULL | 2 | NULL | -+--------+--------------+-------+----------------+ -1 row in set (0,00 sec) -``` - -Получение данных из таблицы MySQL в ClickHouse: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Смотрите также {#smotrite-takzhe} - -- [Внешние словари ODBC](../../sql_reference/table_functions/odbc.md#dicts-external_dicts_dict_sources-odbc) -- [Движок таблиц ODBC](../../sql_reference/table_functions/odbc.md). - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/jdbc/) diff --git a/docs/ru/sql_reference/table_functions/remote.md b/docs/ru/sql_reference/table_functions/remote.md deleted file mode 100644 index 9c504f36690..00000000000 --- a/docs/ru/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,76 +0,0 @@ -# remote, remoteSecure {#remote-remotesecure} - -Позволяет обратиться к удалённым серверам без создания таблицы типа `Distributed`. - -Сигнатуры: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` - выражение, генерирующее адреса удалённых серверов. Это может быть просто один адрес сервера. Адрес сервера - это `хост:порт`, или только `хост`. Хост может быть указан в виде имени сервера, или в виде IPv4 или IPv6 адреса. IPv6 адрес указывается в квадратных скобках. Порт - TCP-порт удалённого сервера. Если порт не указан, используется `tcp_port` из конфигурационного файла сервера (по умолчанию - 9000). - -!!! important "Важно" - С IPv6-адресом обязательно нужно указывать порт. - -Примеры: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -Адреса можно указать через запятую, в этом случае ClickHouse обработает запрос как распределённый, т.е. отправит его по всем указанным адресам как на шарды с разными данными. - -Пример: - -``` text -example01-01-1,example01-02-1 -``` - -Часть выражения может быть указана в фигурных скобках. Предыдущий пример может быть записан следующим образом: - -``` text -example01-0{1,2}-1 -``` - -В фигурных скобках может быть указан диапазон (неотрицательных целых) чисел через две точки. В этом случае, диапазон раскрывается в множество значений, генерирующих адреса шардов. Если запись первого числа начинается с нуля, то значения формируются с таким же выравниванием нулями. Предыдущий пример может быть записан следующим образом: - -``` text -example01-{01..02}-1 -``` - -При наличии нескольких пар фигурных скобок, генерируется прямое произведение соответствующих множеств. - -Адреса или их фрагменты в фигурных скобках можно указать через символ \|. В этом случае, соответствующие множества адресов понимаются как реплики - запрос будет отправлен на первую живую реплику. При этом, реплики перебираются в порядке, согласно текущей настройке [load\_balancing](../../operations/settings/settings.md). - -Пример: - -``` text -example01-{01..02}-{1|2} -``` - -В этом примере указано два шарда, в каждом из которых имеется две реплики. - -Количество генерируемых адресов ограничено константой - сейчас это 1000 штук. - -Использование табличной функции `remote` менее оптимально, чем создание таблицы типа `Distributed`, так как в этом случае, соединения с серверами устанавливаются заново при каждом запросе, в случае задания имён хостов, делается резолвинг имён, а также не ведётся подсчёт ошибок при работе с разными репликами. При обработке большого количества запросов, всегда создавайте `Distributed` таблицу заранее, не используйте табличную функцию `remote`. - -Табличная функция `remote` может быть полезна для следующих случаях: - -- обращение на конкретный сервер в целях сравнения данных, отладки и тестирования; -- запросы между разными кластерами ClickHouse в целях исследований; -- нечастых распределённых запросов, задаваемых вручную; -- распределённых запросов, где набор серверов определяется каждый раз заново. - -Если пользователь не задан,то используется `default`. -Если пароль не задан, то используется пустой пароль. - -`remoteSecure` - аналогично функции `remote`, но с соединением по шифрованному каналу. Порт по умолчанию - `tcp_port_secure` из конфига или 9440. - -[Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/table_functions/remote/) diff --git a/docs/ru/whats-new/changelog/2017.md b/docs/ru/whats-new/changelog/2017.md new file mode 120000 index 00000000000..d581cbbb422 --- /dev/null +++ b/docs/ru/whats-new/changelog/2017.md @@ -0,0 +1 @@ +../../../en/whats-new/changelog/2017.md \ No newline at end of file diff --git a/docs/ru/whats-new/changelog/2018.md b/docs/ru/whats-new/changelog/2018.md new file mode 120000 index 00000000000..22874fcae85 --- /dev/null +++ b/docs/ru/whats-new/changelog/2018.md @@ -0,0 +1 @@ +../../../en/whats-new/changelog/2018.md \ No newline at end of file diff --git a/docs/ru/whats-new/changelog/2019.md b/docs/ru/whats-new/changelog/2019.md new file mode 120000 index 00000000000..0f3f095f8a1 --- /dev/null +++ b/docs/ru/whats-new/changelog/2019.md @@ -0,0 +1 @@ +../../../en/whats-new/changelog/2019.md \ No newline at end of file diff --git a/docs/ru/whats-new/changelog/index.md b/docs/ru/whats-new/changelog/index.md new file mode 100644 index 00000000000..4b49085dfc3 --- /dev/null +++ b/docs/ru/whats-new/changelog/index.md @@ -0,0 +1,666 @@ +--- +toc_folder_title: Changelog +toc_priority: 74 +toc_title: '2020' +--- + +## ClickHouse Release V20.3 {#clickhouse-release-v20-3} + +### ClickHouse Release V20.3.4.10, 2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} + +#### Bug Fix {#bug-fix} + +- This release also contains all bug fixes from 20.1.8.41 +- Fix missing `rows_before_limit_at_least` for queries over http (with processors pipeline). This fixes [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### ClickHouse Release V20.3.3.6, 2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} + +#### Bug Fix {#bug-fix-1} + +- This release also contains all bug fixes from 20.1.7.38 +- Fix bug in a replication that doesn’t allow replication to work if the user has executed mutations on the previous version. This fixes [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). It makes version 20.3 backward compatible again. +- Add setting `use_compact_format_in_distributed_parts_names` which allows to write files for `INSERT` queries into `Distributed` table with more compact format. This fixes [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). It makes version 20.3 backward compatible again. + +### ClickHouse Release V20.3.2.1, 2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} + +#### Backward Incompatible Change {#backward-incompatible-change} + +- Fixed the issue `file name too long` when sending data for `Distributed` tables for a large number of replicas. Fixed the issue that replica credentials were exposed in the server log. The format of directory name on disk was changed to `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) After you upgrade to the new version, you will not be able to downgrade without manual intervention, because old server version does not recognize the new directory format. If you want to downgrade, you have to manually rename the corresponding directories to the old format. This change is relevant only if you have used asynchronous `INSERT`s to `Distributed` tables. In the version 20.3.3 we will introduce a setting that will allow you to enable the new format gradually. +- Changed the format of replication log entries for mutation commands. You have to wait for old mutations to process before installing the new version. +- Implement simple memory profiler that dumps stacktraces to `system.trace_log` every N bytes over soft allocation limit [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([Ivan](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov)) The column of `system.trace_log` was renamed from `timer_type` to `trace_type`. This will require changes in third-party performance analysis and flamegraph processing tools. +- Use OS thread id everywhere instead of internal thread number. This fixes [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Old `clickhouse-client` cannot receive logs that are send from the server when the setting `send_logs_level` is enabled, because the names and types of the structured log messages were changed. On the other hand, different server versions can send logs with different types to each other. When you don’t use the `send_logs_level` setting, you should not care. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Remove `indexHint` function [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Remove `findClusterIndex`, `findClusterValue` functions. This fixes [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). If you were using these functions, send an email to `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now it’s not allowed to create columns or add columns with `SELECT` subquery as default expression. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) +- Require aliases for subqueries in JOIN. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) +- Improved `ALTER MODIFY/ADD` queries logic. Now you cannot `ADD` column without type, `MODIFY` default expression doesn’t change type of column and `MODIFY` type doesn’t loose default expression value. Fixes [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) +- Require server to be restarted to apply the changes in logging configuration. This is a temporary workaround to avoid the bug where the server logs to a deleted log file (see [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- The setting `experimental_use_processors` is enabled by default. This setting enables usage of the new query pipeline. This is internal refactoring and we expect no visible changes. If you will see any issues, set it to back zero. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### New Feature {#new-feature} + +- Add `Avro` and `AvroConfluent` input/output formats [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Multi-threaded and non-blocking updates of expired keys in `cache` dictionaries (with optional permission to read old ones). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Add query `ALTER ... MATERIALIZE TTL`. It runs mutation that forces to remove expired data by TTL and recalculates meta-information about TTL in all parts. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) +- Switch from HashJoin to MergeJoin (on disk) if needed [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) +- Added `MOVE PARTITION` command for `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Reloading storage configuration from configuration file on the fly. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Allowed to change `storage_policy` to not less rich one. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Added support for globs/wildcards for S3 storage and table function. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Implement `bitAnd`, `bitOr`, `bitXor`, `bitNot` for `FixedString(N)` datatype. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Added function `bitCount`. This fixes [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ikopylov](https://github.com/ikopylov)) +- Add `generateRandom` table function to generate random rows with given schema. Allows to populate arbitrary test table with data. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) +- `JSONEachRowFormat`: support special case when objects enclosed in top-level array. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) +- Now it’s possible to create a column with `DEFAULT` expression which depends on a column with default `ALIAS` expression. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) +- Allow to specify `--limit` more than the source data size in `clickhouse-obfuscator`. The data will repeat itself with different random seed. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added `groupArraySample` function (similar to `groupArray`) with reservior sampling algorithm. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos Bird](https://github.com/amosbird)) +- Now you can monitor the size of update queue in `cache`/`complex_key_cache` dictionaries via system metrics. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Allow to use CRLF as a line separator in CSV output format with setting `output_format_csv_crlf_end_of_line` is set to 1 [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) +- Implement more functions of the [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` and `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) +- New setting introduced: `max_parser_depth` to control maximum stack size and allow large complex queries. This fixes [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) and [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) +- Add a setting `force_optimize_skip_unused_shards` setting to throw if skipping of unused shards is not possible [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) +- Allow to configure multiple disks/volumes for storing data for send in `Distributed` engine [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) +- Support storage policy (``) for storing temporary data. [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) +- Added `X-ClickHouse-Exception-Code` HTTP header that is set if exception was thrown before sending data. This implements [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) +- Added function `ifNotFinite`. It is just a syntactic sugar: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added `last_successful_update_time` column in `system.dictionaries` table [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Add `blockSerializedSize` function (size on disk without compression) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) +- Add function `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) +- Added system tables `system.zeros` and `system.zeros_mt` as well as tale functions `zeros()` and `zeros_mt()`. Tables (and table functions) contain single column with name `zero` and type `UInt8`. This column contains zeros. It is needed for test purposes as the fastest method to generate many rows. This fixes [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Experimental Feature {#experimental-feature} + +- Add new compact format of parts in `MergeTree`-family tables in which all columns are stored in one file. It helps to increase performance of small and frequent inserts. The old format (one file per column) is now called wide. Data storing format is controlled by settings `min_bytes_for_wide_part` and `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) +- Support for S3 storage for `Log`, `TinyLog` and `StripeLog` tables. [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) + +#### Bug Fix {#bug-fix-2} + +- Fixed inconsistent whitespaces in log messages. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix bug in which arrays of unnamed tuples were flattened as Nested structures on table creation. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) +- Fixed the issue when “Too many open files” error may happen if there are too many files matching glob pattern in `File` table or `file` table function. Now files are opened lazily. This fixes [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- DROP TEMPORARY TABLE now drops only temporary table. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) +- Remove outdated partition when we shutdown the server or DETACH/ATTACH a table. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) +- For how the default disk calculates the free space from `data` subdirectory. Fixed the issue when the amount of free space is not calculated correctly if the `data` directory is mounted to a separate device (rare case). This fixes [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) +- Allow comma (cross) join with IN () inside. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) +- Allow to rewrite CROSS to INNER JOIN if there’s \[NOT\] LIKE operator in WHERE section. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix possible incorrect result after `GROUP BY` with enabled setting `distributed_aggregation_memory_efficient`. Fixes [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Found keys were counted as missed in metrics of cache dictionaries. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix replication protocol incompatibility introduced in [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- Fixed race condition on `queue_task_handle` at the startup of `ReplicatedMergeTree` tables. [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- The token `NOT` didn’t work in `SHOW TABLES NOT LIKE` query [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added range check to function `h3EdgeLengthM`. Without this check, buffer overflow is possible. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed up a bug in batched calculations of ternary logical OPs on multiple arguments (more than 10). [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) +- Fix error of PREWHERE optimization, which could lead to segfaults or `Inconsistent number of columns got from MergeTreeRangeReader` exception. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) +- Fix unexpected `Timeout exceeded while reading from socket` exception, which randomly happens on secure connection before timeout actually exceeded and when query profiler is enabled. Also add `connect_timeout_with_failover_secure_ms` settings (default 100ms), which is similar to `connect_timeout_with_failover_ms`, but is used for secure connections (because SSL handshake is slower, than ordinary TCP connection) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) +- Fix bug with mutations finalization, when mutation may hang in state with `parts_to_do=0` and `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) +- Use new ANY JOIN logic with `partial_merge_join` setting. It’s possible to make `ANY|ALL|SEMI LEFT` and `ALL INNER` joins with `partial_merge_join=1` now. [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) +- Shard now clamps the settings got from the initiator to the shard’s constaints instead of throwing an exception. This fix allows to send queries to a shard with another constraints. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fixed memory management problem in `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix `toDecimal*OrNull()` functions family when called with string `e`. Fixes [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) +- Make sure that `FORMAT Null` sends no data to the client. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Fix bug that timestamp in `LiveViewBlockInputStream` will not updated. `LIVE VIEW` is an experimental feature. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) +- Fixed `ALTER MODIFY TTL` wrong behavior which did not allow to delete old TTL expressions. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixed UBSan report in MergeTreeIndexSet. This fixes [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed the behaviour of `match` and `extract` functions when haystack has zero bytes. The behaviour was wrong when haystack was constant. This fixes [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid throwing from destructor in Apache Avro 3rd-party library. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) +- Don’t commit a batch polled from `Kafka` partially as it can lead to holes in data. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) +- Fix `joinGet` with nullable return types. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos Bird](https://github.com/amosbird)) +- Fix data incompatibility when compressed with `T64` codec. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Fix data type ids in `T64` compression codec that leads to wrong (de)compression in affected versions. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) +- Add setting `enable_early_constant_folding` and disable it in some cases that leads to errors. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix pushdown predicate optimizer with VIEW and enable the test [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([Winter Zhang](https://github.com/zhang2014)) +- Fix segfault in `Merge` tables, that can happen when reading from `File` storages [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) +- Added a check for storage policy in `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. Otherwise it could make data of part inaccessible after restart and prevent ClickHouse to start. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix alters if there is TTL set for table. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) +- Fix race condition that can happen when `SYSTEM RELOAD ALL DICTIONARIES` is executed while some dictionary is being modified/added/removed. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) +- In previous versions `Memory` database engine use empty data path, so tables are created in `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) +- Fixed wrong log messages about missing default disk or policy. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix not(has()) for the bloom\_filter index of array types. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) +- Allow first column(s) in a table with `Log` engine be an alias [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([Ivan](https://github.com/abyss7)) +- Fix order of ranges while reading from `MergeTree` table in one thread. It could lead to exceptions from `MergeTreeRangeReader` or wrong query results. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) +- Make `reinterpretAsFixedString` to return `FixedString` instead of `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) +- Avoid extremely rare cases when the user can get wrong error message (`Success` instead of detailed error description). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Do not crash when using `Template` format with empty row template. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Metadata files for system tables could be created in wrong place [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix)) Fixes [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). +- Fix data race on exception\_ptr in cache dictionary [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Do not throw an exception for query `ATTACH TABLE IF NOT EXISTS`. Previously it was thrown if table already exists, despite the `IF NOT EXISTS` clause. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed missing closing paren in exception message. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid message `Possible deadlock avoided` at the startup of clickhouse-client in interactive mode. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed the issue when padding at the end of base64 encoded value can be malformed. Update base64 library. This fixes [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), closes [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Prevent losing data in `Kafka` in rare cases when exception happens after reading suffix but before commit. Fixes [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) +- Fixed exception in `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) +- Fix crash when a user tries to `ALTER MODIFY SETTING` for old-formated `MergeTree` table engines family. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- Support for UInt64 numbers that don’t fit in Int64 in JSON-related functions. Update SIMDJSON to master. This fixes [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed execution of inversed predicates when non-strictly monotinic functional index is used. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) +- Don’t try to fold `IN` constant in `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos Bird](https://github.com/amosbird)) +- Fix bug in `ALTER DELETE` mutations which leads to index corruption. This fixes [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) and [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). Additionally fix extremely rare race conditions in `ReplicatedMergeTree` `ALTER` queries. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) +- When the setting `compile_expressions` is enabled, you can get `unexpected column` in `LLVMExecutableFunction` when we use `Nullable` type [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Multiple fixes for `Kafka` engine: 1) fix duplicates that were appearing during consumer group rebalance. 2) Fix rare ‘holes’ appeared when data were polled from several partitions with one poll and committed partially (now we always process / commit the whole polled block of messages). 3) Fix flushes by block size (before that only flushing by timeout was working properly). 4) better subscription procedure (with assignment feedback). 5) Make tests work faster (with default intervals and timeouts). Due to the fact that data was not flushed by block size before (as it should according to documentation), that PR may lead to some performance degradation with default settings (due to more often & tinier flushes which are less optimal). If you encounter the performance issue after that change - please increase `kafka_max_block_size` in the table to the bigger value ( for example `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Fixes [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) +- Fix `Parameter out of bound` exception in some queries after PREWHERE optimizations. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) +- Fixed the case of mixed-constness of arguments of function `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- When executing `CREATE` query, fold constant expressions in storage engine arguments. Replace empty database name with current database. Fixes [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) +- Now it’s not possible to create or add columns with simple cyclic aliases like `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- Fixed a bug with double move which may corrupt original part. This is relevant if you use `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Allow `interval` identifier to correctly parse without backticks. Fixed issue when a query cannot be executed even if the `interval` identifier is enclosed in backticks or double quotes. This fixes [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed fuzz test and incorrect behaviour of `bitTestAll`/`bitTestAny` functions. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix possible crash/wrong number of rows in `LIMIT n WITH TIES` when there are a lot of rows equal to n’th row. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- Fix mutations with parts written with enabled `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) +- Fix data race at destruction of `Poco::HTTPServer`. It could happen when server is started and immediately shut down. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Fix bug in which a misleading error message was shown when running `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) +- Fixed `Parameters are out of bound` exception in some rare cases when we have a constant in the `SELECT` clause when we have an `ORDER BY` and a `LIMIT` clause. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Fix mutations finalization, when already done mutation can have status `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) +- Prevent from executing `ALTER ADD INDEX` for MergeTree tables with old syntax, because it doesn’t work. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) +- During server startup do not access table, which `LIVE VIEW` depends on, so server will be able to start. Also remove `LIVE VIEW` dependencies when detaching `LIVE VIEW`. `LIVE VIEW` is an experimental feature. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) +- Fix possible segfault in `MergeTreeRangeReader`, while executing `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) +- Fix possible mismatched checksums with column TTLs. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed a bug when parts were not being moved in background by TTL rules in case when there is only one volume. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fixed the issue `Method createColumn() is not implemented for data type Set`. This fixes [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now we will try finalize mutations more frequently. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- Fix `intDiv` by minus one constant [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) +- Fix possible race condition in `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix bug leading to server termination when trying to use / drop `Kafka` table created with wrong parameters. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) +- Added workaround if OS returns wrong result for `timer_create` function. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed error in usage of `min_marks_for_seek` parameter. Fixed the error message when there is no sharding key in Distributed table and we try to skip unused shards. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) + +#### Improvement {#improvement} + +- Implement `ALTER MODIFY/DROP` queries on top of mutations for `ReplicatedMergeTree*` engines family. Now `ALTERS` blocks only at the metadata update stage, and don’t block after that. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) +- Add ability to rewrite CROSS to INNER JOINs with `WHERE` section containing unqialified names. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) +- Make `SHOW TABLES` and `SHOW DATABASES` queries support the `WHERE` expressions and `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) +- Added a setting `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) +- After recent changes MySQL client started to print binary strings in hex thereby making them not readable ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). The workaround in ClickHouse is to mark string columns as UTF-8, which is not always, but usually the case. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) +- Add support of String and FixedString keys for `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) +- Support string keys in SummingMergeTree maps [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) +- Signal termination of thread to the thread pool even if the thread has thrown exception [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Allow to set `query_id` in `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) +- Don’t allow strange expressions in `ALTER TABLE ... PARTITION partition` query. This addresses [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- The table `system.table_engines` now provides information about feature support (like `supports_ttl` or `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) +- Enable `system.metric_log` by default. It will contain rows with values of ProfileEvents, CurrentMetrics collected with “collect\_interval\_milliseconds” interval (one second by default). The table is very small (usually in order of megabytes) and collecting this data by default is reasonable. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([Ivan](https://github.com/abyss7)) +- Now temporary `LIVE VIEW` is created by `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` instead of `CREATE TEMPORARY LIVE VIEW ...`, because the previous syntax was not consistent with `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) +- Add text\_log.level configuration parameter to limit entries that goes to `system.text_log` table [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) +- Allow to put downloaded part to a disks/volumes according to TTL rules [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) +- For external MySQL dictionaries, allow to mutualize MySQL connection pool to “share” them among dictionaries. This option significantly reduces the number of connections to MySQL servers. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Show nearest query execution time for quantiles in `clickhouse-benchmark` output instead of interpolated values. It’s better to show values that correspond to the execution time of some queries. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Possibility to add key & timestamp for the message when inserting data to Kafka. Fixes [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) +- If server is run from terminal, highlight thread number, query id and log priority by colors. This is for improved readability of correlated log messages for developers. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Better exception message while loading tables for `Ordinary` database. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Implement `arraySlice` for arrays with aggregate function states. This fixes [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Allow constant functions and constant arrays to be used on the right side of IN operator. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) +- If zookeeper exception has happened while fetching data for system.replicas, display it in a separate column. This implements [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Atomically remove MergeTree data parts on destroy. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Support row-level security for Distributed tables. [\#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([Ivan](https://github.com/abyss7)) +- Now we recognize suffix (like KB, KiB…) in settings values. [\#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) +- Prevent out of memory while constructing result of a large JOIN. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) +- Added names of clusters to suggestions in interactive mode in `clickhouse-client`. [\#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexey-milovidov](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) ([Ivan](https://github.com/abyss7)) +- Added column `exception_code` in `system.query_log` table. [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) +- Enabled MySQL compatibility server on port `9004` in the default server configuration file. Fixed password generation command in the example in configuration. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) +- Prevent abort on shutdown if the filesystem is readonly. This fixes [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Better exception message when length is required in HTTP POST query. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add `_path` and `_file` virtual columns to `HDFS` and `File` engines and `hdfs` and `file` table functions [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fix error `Cannot find column` while inserting into `MATERIALIZED VIEW` in case if new column was added to view’s internal table. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix progress over native client-server protocol, by send progress after final update (like logs). This may be relevant only to some third-party tools that are using native protocol. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) +- Add a system metric tracking the number of client connections using MySQL protocol ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) +- From now on, HTTP responses will have `X-ClickHouse-Timezone` header set to the same timezone value that `SELECT timezone()` would report. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) + +#### Performance Improvement {#performance-improvement} + +- Improve performance of analysing index with IN [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) +- Simpler and more efficient code in Logical Functions + code cleanups. A followup to [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) +- Overall performance improvement (in range of 5%..200% for affected queries) by ensuring even more strict aliasing with C++20 features. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos Bird](https://github.com/amosbird)) +- More strict aliasing for inner loops of comparison functions. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- More strict aliasing for inner loops of arithmetic functions. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- A ~3 times faster implementation for ColumnVector::replicate(), via which ColumnConst::convertToFullColumn() is implemented. Also will be useful in tests when materializing constants. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) +- Another minor performance improvement to `ColumnVector::replicate()` (this speeds up the `materialize` function and higher order functions) an even further improvement to [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) +- Improved performance of `stochasticLinearRegression` aggregate function. This patch is contributed by Intel. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Improve performance of `reinterpretAsFixedString` function. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Do not send blocks to client for `Null` format in processors pipeline. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement} + +- Exception handling now works correctly on Windows Subsystem for Linux. See https://github.com/ClickHouse-Extras/libunwind/pull/3 This fixes [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) +- Replace `readline` with `replxx` for interactive line editing in `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([Ivan](https://github.com/abyss7)) +- Better build time and less template instantiations in FunctionsComparison. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added integration with `clang-tidy` in CI. See also [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now we link ClickHouse in CI using `lld` even for `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) +- Allow to randomize thread scheduling and insert glitches when `THREAD_FUZZER_*` environment variables are set. This helps testing. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Enable secure sockets in stateless tests [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) +- Make SPLIT\_SHARED\_LIBRARIES=OFF more robust [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) +- Make “performance\_introspection\_and\_logging” test reliable to random server stuck. This may happen in CI environment. See also [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Validate XML in style check. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed race condition in test `00738_lock_for_inner_table`. This test relied on sleep. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Remove performance tests of type `once`. This is needed to run all performance tests in statistical comparison mode (more reliable). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added performance test for arithmetic functions. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added performance test for `sumMap` and `sumMapWithOverflow` aggregate functions. Follow-up for [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ensure style of ErrorCodes by style check. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add script for tests history. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) +- Add GCC warning `-Wsuggest-override` to locate and fix all places where `override` keyword must be used. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Ignore weak symbol under Mac OS X because it must be defined [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Deleted user](https://github.com/ghost)) +- Normalize running time of some queries in performance tests. This is done in preparation to run all the performance tests in comparison mode. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix some tests to support pytest with query tests [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([Ivan](https://github.com/abyss7)) +- Enable SSL in build with MSan, so server will not fail at startup when running stateless tests [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) +- Fix database substitution in test results [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) +- Build fixes for miscellaneous platforms [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) +- Added disks section to stateless-with-coverage test docker image [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) +- Get rid of in-source-tree files when building with GRPC [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos Bird](https://github.com/amosbird)) +- Slightly faster build time by removing SessionCleaner from Context. Make the code of SessionCleaner more simple. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Updated checking for hung queries in clickhouse-test script [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) +- Removed some useless files from repository. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Changed type of math perftests from `once` to `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Add docker image which allows to build interactive code browser HTML report for our codebase. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin)) See [Woboq Code Browser](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) +- Suppress some test failures under MSan. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Speedup “exception while insert” test. This test often time out in debug-with-coverage build. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Updated `libcxx` and `libcxxabi` to master. In preparation to [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix flacky test `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Clean up duplicated linker flags. Make sure the linker won’t look up an unexpected symbol. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos Bird](https://github.com/amosbird)) +- Add `clickhouse-odbc` driver into test images. This allows to test interaction of ClickHouse with ClickHouse via its own ODBC driver. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) +- Fix several bugs in unit tests. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) +- Enable `-Wmissing-include-dirs` GCC warning to eliminate all non-existing includes - mostly as a result of CMake scripting errors [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Describe reasons if query profiler cannot work. This is intended for [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Update OpenSSL to upstream master. Fixed the issue when TLS connections may fail with the message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` and `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. The issue was present in version 20.1. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Update Dockerfile for server [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) +- Minor fixes in build-gcc-from-sources script [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) +- Replace `numbers` to `zeros` in perftests where `number` column is not used. This will lead to more clean test results. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix stack overflow issue when using initializer\_list in Column constructors. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Deleted user](https://github.com/ghost)) +- Upgrade librdkafka to v1.3.0. Enable bundled `rdkafka` and `gsasl` libraries on Mac OS X. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) +- build fix on GCC 9.2.0 [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) + +## ClickHouse Release V20.1 {#clickhouse-release-v20-1} + +### ClickHouse Release V20.1.8.41, 2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} + +#### Bug Fix {#bug-fix-3} + +- Fix possible permanent `Cannot schedule a task` error (due to unhandled exception in `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). This fixes [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) +- Fix excessive memory consumption in `ALTER` queries (mutations). This fixes [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) and [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) +- Fix bug in backquoting in external dictionaries DDL. This fixes [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) + +### ClickHouse Release V20.1.7.38, 2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} + +#### Bug Fix {#bug-fix-4} + +- Fixed incorrect internal function names for `sumKahan` and `sumWithOverflow`. I lead to exception while using this functions in remote queries. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). This issue was in all ClickHouse releases. +- Allow `ALTER ON CLUSTER` of `Distributed` tables with internal replication. This fixes [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). This issue was in all ClickHouse releases. +- Fix possible exceptions `Size of filter doesn't match size of column` and `Invalid number of rows in Chunk` in `MergeTreeRangeReader`. They could appear while executing `PREWHERE` in some cases. Fixes [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) +- Fixed the issue: timezone was not preserved if you write a simple arithmetic expression like `time + 1` (in contrast to an expression like `time + INTERVAL 1 SECOND`). This fixes [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). This issue was in all ClickHouse releases. +- Now it’s not possible to create or add columns with simple cyclic aliases like `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- Fixed the issue when padding at the end of base64 encoded value can be malformed. Update base64 library. This fixes [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), closes [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix data race at destruction of `Poco::HTTPServer`. It could happen when server is started and immediately shut down. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Fix possible crash/wrong number of rows in `LIMIT n WITH TIES` when there are a lot of rows equal to n’th row. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- Fix possible mismatched checksums with column TTLs. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Fix crash when a user tries to `ALTER MODIFY SETTING` for old-formated `MergeTree` table engines family. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- Now we will try finalize mutations more frequently. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- Fix replication protocol incompatibility introduced in [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- Fix not(has()) for the bloom\_filter index of array types. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) +- Fixed the behaviour of `match` and `extract` functions when haystack has zero bytes. The behaviour was wrong when haystack was constant. This fixes [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-1} + +- Exception handling now works correctly on Windows Subsystem for Linux. See https://github.com/ClickHouse-Extras/libunwind/pull/3 This fixes [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) + +### ClickHouse Release V20.1.6.30, 2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} + +#### Bug Fix {#bug-fix-5} + +- Fix data incompatibility when compressed with `T64` codec. + [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) +- Fix order of ranges while reading from MergeTree table in one thread. Fixes [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). + [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) +- Fix possible segfault in `MergeTreeRangeReader`, while executing `PREWHERE`. Fixes [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). + [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) +- Fix `reinterpretAsFixedString` to return `FixedString` instead of `String`. + [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) +- Fix `joinGet` with nullable return types. Fixes [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) + [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) +- Fix fuzz test and incorrect behaviour of bitTestAll/bitTestAny functions. + [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Fix the behaviour of match and extract functions when haystack has zero bytes. The behaviour was wrong when haystack was constant. Fixes [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) + [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Fixed execution of inversed predicates when non-strictly monotinic functional index is used. Fixes [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) + [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) +- Allow to rewrite `CROSS` to `INNER JOIN` if there’s `[NOT] LIKE` operator in `WHERE` section. Fixes [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) + [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) +- Allow first column(s) in a table with Log engine be an alias. + [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) +- Allow comma join with `IN()` inside. Fixes [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). + [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) +- Improve `ALTER MODIFY/ADD` queries logic. Now you cannot `ADD` column without type, `MODIFY` default expression doesn’t change type of column and `MODIFY` type doesn’t loose default expression value. Fixes [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). + [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) +- Fix mutations finalization, when already done mutation can have status is\_done=0. + [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) +- Support “Processors” pipeline for system.numbers and system.numbers\_mt. This also fixes the bug when `max_execution_time` is not respected. + [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- Fix wrong counting of `DictCacheKeysRequestedFound` metric. + [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) +- Added a check for storage policy in `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` which otherwise could make data of part inaccessible after restart and prevent ClickHouse to start. + [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) +- Fixed UBSan report in `MergeTreeIndexSet`. This fixes [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) + [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Fix possible datarace in BlockIO. + [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- Support for `UInt64` numbers that don’t fit in Int64 in JSON-related functions. Update `SIMDJSON` to master. This fixes [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) + [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Fix the issue when the amount of free space is not calculated correctly if the data directory is mounted to a separate device. For default disk calculate the free space from data subdirectory. This fixes [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) + [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) +- Fix the issue when TLS connections may fail with the message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Update OpenSSL to upstream master. + [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- When executing `CREATE` query, fold constant expressions in storage engine arguments. Replace empty database name with current database. Fixes [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Also fix check for local address in ClickHouseDictionarySource. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Fix segfault in `StorageMerge`, which can happen when reading from StorageFile. + [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) +- Prevent losing data in `Kafka` in rare cases when exception happens after reading suffix but before commit. Fixes [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Related: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Fix bug leading to server termination when trying to use / drop `Kafka` table created with wrong parameters. Fixes [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporates [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) + +#### New Feature {#new-feature-1} + +- Add `deduplicate_blocks_in_dependent_materialized_views` option to control the behaviour of idempotent inserts into tables with materialized views. This new feature was added to the bugfix release by a special request from Altinity. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### ClickHouse Release V20.1.2.4, 2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} + +#### Backward Incompatible Change {#backward-incompatible-change-1} + +- Make the setting `merge_tree_uniform_read_distribution` obsolete. The server still recognizes this setting but it has no effect. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Changed return type of the function `greatCircleDistance` to `Float32` because now the result of calculation is `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now it’s expected that query parameters are represented in “escaped” format. For example, to pass string `ab` you have to write `a\tb` or `a\b` and respectively, `a%5Ctb` or `a%5C%09b` in URL. This is needed to add the possibility to pass NULL as `\N`. This fixes [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Enable `use_minimalistic_part_header_in_zookeeper` setting for `ReplicatedMergeTree` by default. This will significantly reduce amount of data stored in ZooKeeper. This setting is supported since version 19.1 and we already use it in production in multiple services without any issues for more than half a year. Disable this setting if you have a chance to downgrade to versions older than 19.1. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Data skipping indices are production ready and enabled by default. The settings `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` and `allow_experimental_multiple_joins_emulation` are now obsolete and do nothing. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add new `ANY JOIN` logic for `StorageJoin` consistent with `JOIN` operation. To upgrade without changes in behaviour you need add `SETTINGS any_join_distinct_right_table_keys = 1` to Engine Join tables metadata or recreate these tables after upgrade. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) +- Require server to be restarted to apply the changes in logging configuration. This is a temporary workaround to avoid the bug where the server logs to a deleted log file (see [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### New Feature {#new-feature-2} + +- Added information about part paths to `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Add ability to execute `SYSTEM RELOAD DICTIONARY` query in `ON CLUSTER` mode. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Add ability to execute `CREATE DICTIONARY` queries in `ON CLUSTER` mode. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) +- Now user’s profile in `users.xml` can inherit multiple profiles. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Added `system.stack_trace` table that allows to look at stack traces of all server threads. This is useful for developers to introspect server state. This fixes [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add `DateTime64` datatype with configurable sub-second precision. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) +- Add table function `clusterAllReplicas` which allows to query all the nodes in the cluster. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari)) +- Add aggregate function `categoricalInformationValue` which calculates the information value of a discrete feature. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) +- Speed up parsing of data files in `CSV`, `TSV` and `JSONEachRow` format by doing it in parallel. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Add function `bankerRound` which performs banker’s rounding. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) +- Support more languages in embedded dictionary for region names: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Improvements in consistency of `ANY JOIN` logic. Now `t1 ANY LEFT JOIN t2` equals `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Add setting `any_join_distinct_right_table_keys` which enables old behaviour for `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Add new `SEMI` and `ANTI JOIN`. Old `ANY INNER JOIN` behaviour now available as `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Added `Distributed` format for `File` engine and `file` table function which allows to read from `.bin` files generated by asynchronous inserts into `Distributed` table. [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Add optional reset column argument for `runningAccumulate` which allows to reset aggregation results for each new key value. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) +- Add ability to use ClickHouse as Prometheus endpoint. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) +- Add section `` in `config.xml` which restricts allowed hosts for remote table engines and table functions `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) +- Added function `greatCircleAngle` which calculates the distance on a sphere in degrees. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Changed Earth radius to be consistent with H3 library. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added `JSONCompactEachRow` and `JSONCompactEachRowWithNamesAndTypes` formats for input and output. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) +- Added feature for file-related table engines and table functions (`File`, `S3`, `URL`, `HDFS`) which allows to read and write `gzip` files based on additional engine parameter or file extension. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) +- Added the `randomASCII(length)` function, generating a string with a random set of [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) printable characters. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([BayoNet](https://github.com/BayoNet)) +- Added function `JSONExtractArrayRaw` which returns an array on unparsed json array elements from `JSON` string. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) +- Add `arrayZip` function which allows to combine multiple arrays of equal lengths into one array of tuples. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([Winter Zhang](https://github.com/zhang2014)) +- Add ability to move data between disks according to configured `TTL`-expressions for `*MergeTree` table engines family. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Added new aggregate function `avgWeighted` which allows to calculate weighted average. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) +- Now parallel parsing is enabled by default for `TSV`, `TSKV`, `CSV` and `JSONEachRow` formats. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Add several geo functions from `H3` library: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` and `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) +- Added support for brotli (`br`) compression in file-related storages and table functions. This fixes [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add `groupBit*` functions for the `SimpleAggregationFunction` type. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Bug Fix {#bug-fix-6} + +- Fix rename of tables with `Distributed` engine. Fixes issue [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- Now dictionaries support `EXPRESSION` for attributes in arbitrary string in non-ClickHouse SQL dialect. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- Fix broken `INSERT SELECT FROM mysql(...)` query. This fixes [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) and [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- Fix error “Mismatch column sizes” when inserting default `Tuple` from `JSONEachRow`. This fixes [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) +- Now an exception will be thrown in case of using `WITH TIES` alongside `LIMIT BY`. Also add ability to use `TOP` with `LIMIT BY`. This fixes [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix unintendent dependency from fresh glibc version in `clickhouse-odbc-bridge` binary. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos Bird](https://github.com/amosbird)) +- Fix bug in check function of `*MergeTree` engines family. Now it doesn’t fail in case when we have equal amount of rows in last granule and last mark (non-final). [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) +- Fix insert into `Enum*` columns after `ALTER` query, when underlying numeric type is equal to table specified type. This fixes [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) +- Allowed non-constant negative “size” argument for function `substring`. It was not allowed by mistake. This fixes [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix parsing bug when wrong number of arguments passed to `(O|J)DBC` table engine. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) +- Using command name of the running clickhouse process when sending logs to syslog. In previous versions, empty string was used instead of command name. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) +- Fix check of allowed hosts for `localhost`. This PR fixes the solution provided in [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix rare crash in `argMin` and `argMax` functions for long string arguments, when result is used in `runningAccumulate` function. This fixes [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinosaur](https://github.com/769344359)) +- Fix memory overcommit for tables with `Buffer` engine. [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) +- Fixed potential bug in functions that can take `NULL` as one of the arguments and return non-NULL. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Better metrics calculations in thread pool for background processes for `MergeTree` table engines. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix function `IN` inside `WHERE` statement when row-level table filter is present. Fixes [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([Ivan](https://github.com/abyss7)) +- Now an exception is thrown if the integral value is not parsed completely for settings values. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) +- Fix exception when aggregate function is used in query to distributed table with more than two local shards. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Now bloom filter can handle zero length arrays and doesn’t perform redundant calculations. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbab](https://github.com/achimbab)) +- Fixed checking if a client host is allowed by matching the client host to `host_regexp` specified in `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) +- Relax ambiguous column check that leads to false positives in multiple `JOIN ON` section. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed possible server crash (`std::terminate`) when the server cannot send or write data in `JSON` or `XML` format with values of `String` data type (that require `UTF-8` validation) or when compressing result data with Brotli algorithm or in some other rare cases. This fixes [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix race condition in `StorageDistributedDirectoryMonitor` found by CI. This fixes [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Now background merges in `*MergeTree` table engines family preserve storage policy volume order more accurately. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Now table engine `Kafka` works properly with `Native` format. This fixes [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Fixed formats with headers (like `CSVWithNames`) which were throwing exception about EOF for table engine `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Fixed a bug with making set from subquery in right part of `IN` section. This fixes [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) and [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix possible crash while reading from storage `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed reading of the files in `Parquet` format containing columns of type `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([maxulan](https://github.com/maxulan)) +- Fix error `Not found column` for distributed queries with `PREWHERE` condition dependent on sampling key if `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix error `Not found column` if query used `PREWHERE` dependent on table’s alias and the result set was empty because of primary key condition. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed return type for functions `rand` and `randConstant` in case of `Nullable` argument. Now functions always return `UInt32` and never `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Disabled predicate push-down for `WITH FILL` expression. This fixes [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([Winter Zhang](https://github.com/zhang2014)) +- Fixed incorrect `count()` result for `SummingMergeTree` when `FINAL` section is used. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Fix possible incorrect result for constant functions from remote servers. It happened for queries with functions like `version()`, `uptime()`, etc. which returns different constant values for different servers. This fixes [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix complicated bug in push-down predicate optimization which leads to wrong results. This fixes a lot of issues on push-down predicate optimization. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([Winter Zhang](https://github.com/zhang2014)) +- Fix crash in `CREATE TABLE .. AS dictionary` query. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) +- Several improvements ClickHouse grammar in `.g4` file. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) +- Fix bug that leads to crashes in `JOIN`s with tables with engine `Join`. This fixes [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix redundant dictionaries reload on `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) +- Limit maximum number of streams for read from `StorageFile` and `StorageHDFS`. Fixes https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- Fix bug in `ALTER ... MODIFY ... CODEC` query, when user specify both default expression and codec. Fixes [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) +- Fix error in background merge of columns with `SimpleAggregateFunction(LowCardinality)` type. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fixed type check in function `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) +- Now server do not crash on `LEFT` or `FULL JOIN` with and Join engine and unsupported `join_use_nulls` settings. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) +- Now `DROP DICTIONARY IF EXISTS db.dict` query doesn’t throw exception if `db` doesn’t exist. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fix possible crashes in table functions (`file`, `mysql`, `remote`) caused by usage of reference to removed `IStorage` object. Fix incorrect parsing of columns specified at insertion into table function. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) +- Ensure network be up before starting `clickhouse-server`. This fixes [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fix timeouts handling for secure connections, so queries doesn’t hang indefenitely. This fixes [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix `clickhouse-copier`’s redundant contention between concurrent workers. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Now mutations doesn’t skip attached parts, even if their mutation version were larger than current mutation version. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- Ignore redundant copies of `*MergeTree` data parts after move to another disk and server restart. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix crash in `FULL JOIN` with `LowCardinality` in `JOIN` key. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) +- Forbidden to use column name more than once in insert query like `INSERT INTO tbl (x, y, x)`. This fixes [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) +- Added fallback for detection the number of physical CPU cores for unknown CPUs (using the number of logical CPU cores). This fixes [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix `There's no column` error for materialized and alias columns. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed sever crash when `EXISTS` query was used without `TABLE` or `DICTIONARY` qualifier. Just like `EXISTS t`. This fixes [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). This bug was introduced in version 19.17. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix rare bug with error `"Sizes of columns doesn't match"` that might appear when using `SimpleAggregateFunction` column. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Fix bug where user with empty `allow_databases` got access to all databases (and same for `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) +- Fix client crash when server already disconnected from client. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Fix `ORDER BY` behaviour in case of sorting by primary key prefix and non primary key suffix. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) +- Check if qualified column present in the table. This fixes [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) +- Fixed behavior with `ALTER MOVE` ran immediately after merge finish moves superpart of specified. Fixes [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix possible server crash while using `UNION` with different number of columns. Fixes [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix size of result substring for function `substr` with negative size. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Now server does not execute part mutation in `MergeTree` if there are not enough free threads in background pool. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) +- Fix a minor typo on formatting `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) +- Fixed incorrect bloom filter results for negative numbers. This fixes [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([Winter Zhang](https://github.com/zhang2014)) +- Fixed potential buffer overflow in decompress. Malicious user can pass fabricated compressed data that will cause read after buffer. This issue was found by Eldar Zaitov from Yandex information security team. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix incorrect result because of integers overflow in `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Now `OPTIMIZE TABLE` query will not wait for offline replicas to perform the operation. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) +- Fixed `ALTER TTL` parser for `Replicated*MergeTree` tables. [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix communication between server and client, so server read temporary tables info after query failure. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Fix `bitmapAnd` function error when intersecting an aggregated bitmap and a scalar bitmap. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Refine the definition of `ZXid` according to the ZooKeeper Programmer’s Guide which fixes bug in `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- `odbc` table function now respects `external_table_functions_use_nulls` setting. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) +- Fixed bug that lead to a rare data race. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- Now `SYSTEM RELOAD DICTIONARY` reloads a dictionary completely, ignoring `update_field`. This fixes [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Add ability to check if dictionary exists in create query. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) +- Fix `Float*` parsing in `Values` format. This fixes [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- Fix crash when we cannot reserve space in some background operations of `*MergeTree` table engines family. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix crash of merge operation when table contains `SimpleAggregateFunction(LowCardinality)` column. This fixes [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) +- Restore support of all ICU locales and add the ability to apply collations for constant expressions. Also add language name to `system.collations` table. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- Fix bug when external dictionaries with zero minimal lifetime (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) don’t update in background. [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) +- Fix crash when external dictionary with ClickHouse source has subquery in query. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fix incorrect parsing of file extension in table with engine `URL`. This fixes [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) +- Fix `CHECK TABLE` query for `*MergeTree` tables without key. Fixes [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- Fixed conversion of `Float64` to MySQL type. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) +- Now if table was not completely dropped because of server crash, server will try to restore and load it. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- Fixed crash in table function `file` while inserting into file that doesn’t exist. Now in this case file would be created and then insert would be processed. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fix rare deadlock which can happen when `trace_log` is in enabled. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Add ability to work with different types besides `Date` in `RangeHashed` external dictionary created from DDL query. Fixes [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- Fixes crash when `now64()` is called with result of another function. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) +- Fixed bug with detecting client IP for connections through mysql wire protocol. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) +- Fix empty array handling in `arraySplit` function. This fixes [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) +- Fixed the issue when `pid-file` of another running `clickhouse-server` may be deleted. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) +- Fix dictionary reload if it has `invalidate_query`, which stopped updates and some exception on previous update tries. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) +- Fixed error in function `arrayReduce` that may lead to “double free” and error in aggregate function combinator `Resample` that may lead to memory leak. Added aggregate function `aggThrow`. This function can be used for testing purposes. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Improvement {#improvement-1} + +- Improved logging when working with `S3` table engine. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Printed help message when no arguments are passed when calling `clickhouse-local`. This fixes [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) +- Add setting `mutations_sync` which allows to wait `ALTER UPDATE/DELETE` queries synchronously. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) +- Allow to set up relative `user_files_path` in `config.xml` (in the way similar to `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) +- Add exception for illegal types for conversion functions with `-OrZero` postfix. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Simplify format of the header of data sending to a shard in a distributed query. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) +- `Live View` table engine refactoring. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) +- Add additional checks for external dictionaries created from DDL-queries. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) +- Fix error `Column ... already exists` while using `FINAL` and `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Fixes [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Now table the first argument of `joinGet` function can be table indentifier. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos Bird](https://github.com/amosbird)) +- Allow using `MaterializedView` with subqueries above `Kafka` tables. [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) +- Now background moves between disks run it the seprate thread pool. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) +- `SYSTEM RELOAD DICTIONARY` now executes synchronously. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) +- Stack traces now display physical addresses (offsets in object file) instead of virtual memory addresses (where the object file was loaded). That allows the use of `addr2line` when binary is position independent and ASLR is active. This fixes [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Support new syntax for row-level security filters: `…
`. Fixes [\#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [\#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([Ivan](https://github.com/abyss7)) +- Now `cityHash` function can work with `Decimal` and `UUID` types. Fixes [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) +- Removed fixed index granularity (it was 1024) from system logs because it’s obsolete after implementation of adaptive granularity. [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Enabled MySQL compatibility server when ClickHouse is compiled without SSL. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) +- Now server checksums distributed batches, which gives more verbose errors in case of corrupted data in batch. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) +- Support `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` and `ATTACH TABLE` for `MySQL` database engine. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([Winter Zhang](https://github.com/zhang2014)) +- Add authentication in S3 table function and table engine. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Added check for extra parts of `MergeTree` at different disks, in order to not allow to miss data parts at undefined disks. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Enable SSL support for Mac client and server. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([Ivan](https://github.com/abyss7)) +- Now ClickHouse can work as MySQL federated server (see https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- `clickhouse-client` now only enable `bracketed-paste` when multiquery is on and multiline is off. This fixes (\#7757)\[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos Bird](https://github.com/amosbird)) +- Support `Array(Decimal)` in `if` function. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) +- Support Decimals in `arrayDifference`, `arrayCumSum` and `arrayCumSumNegative` functions. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) +- Added `lifetime` column to `system.dictionaries` table. [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) +- Improved check for existing parts on different disks for `*MergeTree` table engines. Addresses [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Integration with `AWS SDK` for `S3` interactions which allows to use all S3 features out of the box. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) +- Added support for subqueries in `Live View` tables. [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) +- Check for using `Date` or `DateTime` column from `TTL` expressions was removed. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Information about disk was added to `system.detached_parts` table. [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Now settings `max_(table|partition)_size_to_drop` can be changed without a restart. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Slightly better usability of error messages. Ask user not to remove the lines below `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Better reading messages from `Kafka` engine in various formats after [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([Ivan](https://github.com/abyss7)) +- Better compatibility with MySQL clients which don’t support `sha2_password` auth plugin. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) +- Support more column types in MySQL compatibility server. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) +- Implement `ORDER BY` optimization for `Merge`, `Buffer` and `Materilized View` storages with underlying `MergeTree` tables. [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) +- Now we always use POSIX implementation of `getrandom` to have better compatibility with old kernels (\< 3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos Bird](https://github.com/amosbird)) +- Better check for valid destination in a move TTL rule. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Better checks for broken insert batches for `Distributed` table engine. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) +- Add column with array of parts name which mutations must process in future to `system.mutations` table. [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) +- Parallel merge sort optimization for processors. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- The settings `mark_cache_min_lifetime` is now obsolete and does nothing. In previous versions, mark cache can grow in memory larger than `mark_cache_size` to accomodate data within `mark_cache_min_lifetime` seconds. That was leading to confusion and higher memory usage than expected, that is especially bad on memory constrained systems. If you will see performance degradation after installing this release, you should increase the `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Preparation to use `tid` everywhere. This is needed for [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Performance Improvement {#performance-improvement-1} + +- Performance optimizations in processors pipeline. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Non-blocking updates of expired keys in cache dictionaries (with permission to read old ones). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Compile ClickHouse without `-fno-omit-frame-pointer` globally to spare one more register. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos Bird](https://github.com/amosbird)) +- Speedup `greatCircleDistance` function and add performance tests for it. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) +- Improved performance of function `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Improved performance of `max`, `min`, `argMin`, `argMax` for `DateTime64` data type. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) +- Improved performance of sorting without a limit or with big limit and external sorting. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Improved performance of formatting floating point numbers up to 6 times. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Improved performance of `modulo` function. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos Bird](https://github.com/amosbird)) +- Optimized `ORDER BY` and merging with single column key. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Better implementation for `arrayReduce`, `-Array` and `-State` combinators. [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos Bird](https://github.com/amosbird)) +- Now `PREWHERE` should be optimized to be at least as efficient as `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos Bird](https://github.com/amosbird)) +- Improve the way `round` and `roundBankers` handling negative numbers. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) +- Improved decoding performance of `DoubleDelta` and `Gorilla` codecs by roughly 30-40%. This fixes [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) +- Improved performance of `base64` related functions. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Added a function `geoDistance`. It is similar to `greatCircleDistance` but uses approximation to WGS-84 ellipsoid model. The performance of both functions are near the same. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Faster `min` and `max` aggregation functions for `Decimal` data type. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) +- Vectorize processing `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Bird](https://github.com/amosbird)) +- `if` chains are now optimized as `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) +- Fix performance regression of `Kafka` table engine introduced in 19.15. This fixes [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) +- Removed “pie” code generation that `gcc` from Debian packages occasionally brings by default. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Parallel parsing data formats [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Enable optimized parser of `Values` with expressions by default (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) + +#### Build/Testing/Packaging Improvement {#buildtestingpackaging-improvement-2} + +- Build fixes for `ARM` and in minimal mode. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) +- Add coverage file flush for `clickhouse-server` when std::atexit is not called. Also slightly improved logging in stateless tests with coverage. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) +- Update LLVM library in contrib. Avoid using LLVM from OS packages. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Make bundled `curl` build fully quiet. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) +- Fix some `MemorySanitizer` warnings. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Use `add_warning` and `no_warning` macros in `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([Ivan](https://github.com/abyss7)) +- Add support of Minio S3 Compatible object (https://min.io/) for better integration tests. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) +- Imported `libc` headers to contrib. It allows to make builds more consistent across various systems (only for `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Remove `-fPIC` from some libraries. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Clean `CMakeLists.txt` for curl. See https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Silent warnings in `CapNProto` library. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Add performance tests for short string optimized hash tables. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos Bird](https://github.com/amosbird)) +- Now ClickHouse will build on `AArch64` even if `MADV_FREE` is not available. This fixes [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos Bird](https://github.com/amosbird)) +- Update `zlib-ng` to fix memory sanitizer problems. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Enable internal MySQL library on non-Linux system, because usage of OS packages is very fragile and usually doesn’t work at all. This fixes [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed build on some systems after enabling `libc++`. This supersedes [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Make `Field` methods more type-safe to find more errors. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Added missing files to the `libc-headers` submodule. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix wrong `JSON` quoting in performance test output. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Now stack trace is displayed for `std::exception` and `Poco::Exception`. In previous versions it was available only for `DB::Exception`. This improves diagnostics. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Porting `clock_gettime` and `clock_nanosleep` for fresh glibc versions. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos Bird](https://github.com/amosbird)) +- Enable `part_log` in example config for developers. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix async nature of reload in `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) +- Fixed codec performance tests. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) +- Add install scripts for `.tgz` build and documentation for them. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) +- Removed old `ZSTD` test (it was created in year 2016 to reproduce the bug that pre 1.0 version of ZSTD has had). This fixes [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed build on Mac OS Catalina. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) +- Increased number of rows in codec performance tests to make results noticeable. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) +- In debug builds, treat `LOGICAL_ERROR` exceptions as assertion failures, so that they are easier to notice. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Make formats-related performance test more deterministic. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Update `lz4` to fix a MemorySanitizer failure. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Suppress a known MemorySanitizer false positive in exception handling. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Update `gcc` and `g++` to version 9 in `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) +- Add performance test case to test that `PREWHERE` is worse than `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos Bird](https://github.com/amosbird)) +- Progress towards fixing one flacky test. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Avoid MemorySanitizer report for data from `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Updated `libc++` to the latest version. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Build ICU library from sources. This fixes [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Switched from `libressl` to `openssl`. ClickHouse should support TLS 1.3 and SNI after this change. This fixes [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fixed UBSan report when using `chacha20_poly1305` from SSL (happens on connect to https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix mode of default password file for `.deb` linux distros. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) +- Improved expression for getting `clickhouse-server` PID in `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) +- Updated contrib/googletest to v1.10.0. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Fixed ThreadSaninitizer report in `base64` library. Also updated this library to the latest version, but it doesn’t matter. This fixes [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix `00600_replace_running_query` for processors. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Remove support for `tcmalloc` to make `CMakeLists.txt` simpler. [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Release gcc builds now use `libc++` instead of `libstdc++`. Recently `libc++` was used only with clang. This will improve consistency of build configurations and portability. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Enable ICU library for build with MemorySanitizer. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Suppress warnings from `CapNProto` library. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Removed special cases of code for `tcmalloc`, because it’s no longer supported. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- In CI coverage task, kill the server gracefully to allow it to save the coverage report. This fixes incomplete coverage reports we’ve been seeing lately. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) +- Performance tests for all codecs against `Float64` and `UInt64` values. [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) +- `termcap` is very much deprecated and lead to various problems (f.g. missing “up” cap and echoing `^J` instead of multi line) . Favor `terminfo` or bundled `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos Bird](https://github.com/amosbird)) +- Fix `test_storage_s3` integration test. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Support `StorageFile(, null)` to insert block into given format file without actually write to disk. This is required for performance tests. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos Bird](https://github.com/amosbird)) +- Added argument `--print-time` to functional tests which prints execution time per test. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Added asserts to `KeyCondition` while evaluating RPN. This will fix warning from gcc-9. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Dump cmake options in CI builds. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Don’t generate debug info for some fat libraries. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Make `log_to_console.xml` always log to stderr, regardless of is it interactive or not. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Removed some unused features from `clickhouse-performance-test` tool. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Now we will also search for `lld-X` with corresponding `clang-X` version. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) +- Parquet build improvement. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([maxulan](https://github.com/maxulan)) +- More GCC warnings [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Package for Arch Linux now allows to run ClickHouse server, and not only client. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Fix test with processors. Tiny performance fixes. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Update contrib/protobuf. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) +- In preparation of switching to c++20 as a new year celebration. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos Bird](https://github.com/amosbird)) + +#### Experimental Feature {#experimental-feature-1} + +- Added experimental setting `min_bytes_to_use_mmap_io`. It allows to read big files without copying data from kernel to userspace. The setting is disabled by default. Recommended threshold is about 64 MB, because mmap/munmap is slow. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Reworked quotas as a part of access control system. Added new table `system.quotas`, new functions `currentQuota`, `currentQuotaKey`, new SQL syntax `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) +- Allow skipping unknown settings with warnings instead of throwing exceptions. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) +- Reworked row policies as a part of access control system. Added new table `system.row_policies`, new function `currentRowPolicies()`, new SQL syntax `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Security Fix {#security-fix} + +- Fixed the possibility of reading directories structure in tables with `File` table engine. This fixes [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## [Changelog for 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/ru/whats-new/extended-roadmap.md b/docs/ru/whats-new/extended-roadmap.md new file mode 100644 index 00000000000..7642dc61cee --- /dev/null +++ b/docs/ru/whats-new/extended-roadmap.md @@ -0,0 +1,1927 @@ +# Планы разработки ClickHouse 2020 {#plany-razrabotki-clickhouse-2020} + +Здесь собраны важные задачи на 2020 год. Многие из них присутствуют в GitHub Issues. Данный текст следует рассматривать как рабочий черновик со сводкой и кратким описанием задач, ссылками и материалами для быстрого доступа на одной странице. Классификация задач условная. + +Так как ClickHouse - open-source продукт, мы хотим, чтобы рабочий процесс был также максимально открытым. В связи с этим, вам следует ожидать наличия на данной странице несколько большего количества деталей описания рабочего процесса, чем вы могли бы предположить - настолько близко, насколько рабочий процесс видят разработчики. Так как неотъемлимой частью процесса разработки является исправление недостатков продукта и улучшение качества кода, на данной странице вы найдёте весьма подробные описания таких деталей. Для других open-source продуктов такой подход к разработке обычно нехарактерен. Благодаря тому, что для каждой задачи указаны её зависимости, вы сможете понять, какие подготовительные работы требуются, что позволяет более точно понимать сроки реализации. + +## 1. Хранение данных, индексация {#khranenie-dannykh-indeksatsiia} + +### 1.1. Индексы по z-Order curve, normalized z-Order curve {#indeksy-po-z-order-curve-normalized-z-order-curve} + +[\#6286](https://github.com/ClickHouse/ClickHouse/pull/6286) + +Задача также относится к категории «17. Работа с географическими данными», так как geoHash - это частный случай z-Order curve. +Также связана с задачей 24.27 для нечёткого поиска полудубликатов строк, так как позволит индексировать min-hash. +Задача «normalized z-Order curve» в перспективе может быть полезна для БК и Метрики, так как позволяет смешивать OrderID и PageID и избежать дублирования данных. +В задаче также вводится способ индексации путём обращения функции нескольких аргументов на интервале, что имеет смысл для дальнейшего развития. + +[Андрей Чулков](https://github.com/achulkov2), ВШЭ. + +### 1.2. Wait-free каталог баз данных {#wait-free-katalog-baz-dannykh} + +Q2. Делает [Александр Токмаков](https://github.com/tavplubix), первый рабочий вариант в декабре 2019. Нужно для DataLens и Яндекс.Метрики. + +Манипуляции с каталогом баз данных: запросы CREATE TABLE, DROP TABLE, RENAME TABLE и DATABASE, требуют синхронизации с помощью блокировок. Эта синхронизация становится весьма сложной, так как на неё полагается много внутренних структур данных. + +Предлагается реализовать альтернативный подход, в котором таблицы и базы данных являются всего лишь ссылками на persistent объекты. Подробное описание задачи: [\#6787](https://github.com/ClickHouse/ClickHouse/issues/6787) + +Upd. Сделана крупная часть задачи, но ориентироваться стоит уже на Q2. +Upd. Pull request готов для мержа. + +### 1.3. Неблокирующие ALTER {#neblokiruiushchie-alter} + +Q1. И полностью immutable куски. Делает [Александр Сапин](https://github.com/alesapin). Готов приступить к задаче в конце ноября 2019. Нужно для Яндекс.Метрики. + +Upd. Большая часть задачи реализована и добавлена в master. Есть незначительные технические долги. Остаётся реализация неблокирующего изменения метаданных таблицы. + +### 1.4. + Нетранзитивные ALTER столбцов {#netranzitivnye-alter-stolbtsov} + +Требует 1.3. Будет делать [Александр Сапин](https://github.com/alesapin). Ура, сделано. + +### 1.5. + ALTER RENAME COLUMN {#alter-rename-column} + +[\#6861](https://github.com/ClickHouse/ClickHouse/issues/6861) + +Требует 1.3. Будет делать [Александр Сапин](https://github.com/alesapin). + +### 1.6. + Полиморфные куски данных {#polimorfnye-kuski-dannykh} + +Компактные куски - Q1, куски в оперативке Q1/Q2 - пункт 1.7. + +Компактные куски реализованы, ещё не включены по-умолчанию. Первым шагом включаем по-умолчанию для системных таблиц. + +Upd. Включено для системных таблиц. + +Делает [Антон Попов](https://github.com/CurtizJ), первый рабочий вариант в декабре. Пререквизит чтобы снизить сложность мелких INSERT, что в свою очередь нужно для 1.12, иначе задача 1.12 не сможет нормально работать. Особенно нужно для Яндекс.Облака. + +Данные в таблицах типа MergeTree в ClickHouse хранятся в виде набора независимых «кусков». Внутри куска, каждый столбец, а также индекс, хранится в отдельных файлах. Это сделано для возможности быстрых манипуляций со столбцами (пример - запрос ALTER DROP COLUMN). При вставке данных (INSERT), создаётся новый кусок. Для таблиц с большим количеством столбцов, запросы INSERT с маленьким количеством строк являются неэффективными, так как требуют создания большого количества файлов в файловой системе. Это является врождённой особенностью ClickHouse - одной из первой проблем, с которыми сталкиваются пользователи. Пользователям приходится буферизовывать данные и собирать их в более крупные пачки перед вставкой в ClickHouse. + +Для смягчения эффекта от этой проблемы, в ClickHouse существуют таблицы типа Buffer. Они накапливают данные в оперативке перед записью в другую таблицу. Впрочем, таблицы Buffer не являются полноценным решением проблемы из-за: - наличия блокировок при вставке; - переупорядочивание вставляемых данных; - неатомарность перекладывания данных из Buffer в результирующую таблицу. + +Вместо этого предлагается разрешить кускам таблиц типа MergeTree располагать данные в разных форматах. А именно: - в оперативной памяти; - на диске со всеми столбцами в одном файле; - на диске со столбцами в отдельных файлах: в зависимости от размера куска и прошедшего времени. Для размещения кусков в оперативной памяти, придётся также реализовать опциональную поддержку write-ahead log с настраиваемыми правилами по сбросу на диск. Это позволит избавиться от проблем с мелкими вставками для MergeTree таблиц. Для ReplicatedMergeTree таблиц, это решит проблему лишь частично. + +### 1.7. Буферизация и WAL в MergeTree {#buferizatsiia-i-wal-v-mergetree} + +Требует 1.6. Антон Попов. Задача взята в работу. Q2. + +### 1.8. + Перенос между разделами по TTL {#perenos-mezhdu-razdelami-po-ttl} + +Делает [Владимир Чеботарёв](https://github.com/excitoon), Altinity. Декабрь 2019. + +Q1. Закоммичено, но есть технический долг, который исправляется сейчас. +Готово. + +### 1.9. Использование TTL для прореживания данных {#ispolzovanie-ttl-dlia-prorezhivaniia-dannykh} + +Будет делать Сорокин Николай, ВШЭ и Яндекс. + +Сейчас пользователь может задать в таблице выражение, которое определяет, сколько времени хранятся данные. Обычно это выражение задаётся относительно значения столбца с датой - например: удалять данные через три месяца. https://clickhouse.tech/docs/ru/operations/table\_engines/mergetree/\#table\_engine-mergetree-ttl + +Это может быть задано для всей таблицы (тогда строки целиком удаляются после указанного времени) или для отдельных столбцов (тогда данные столбца физически удаляются с диска, а строки в таблице остаются; при чтении значений столбца, они читаются как значения по-умолчанию). + +Но пользователи также хотят более продвинутый вариант этой функциональности: не удалять строки или столбцы целиком, а прореживать их - оставлять меньшее количество строк. + +И тут есть несколько вариантов: +1. По прошествии времени, оставлять каждую N-ую строку. +2. По прошествии времени, выполнять агрегацию данных, заменяя значения некоторых столбцов на значения агрегатных функций от множества значений в нескольких строках. + +Пункт 1 не представляет интереса, так как уже реализован с помощью TTL выражений для удаления данных. В качестве этого выражения можно прописать, например, `cityHash64(*) % 10 = 0 ? now() : event_time + INTERVAL 3 MONTH`. Правда как-то неудобно получается. + +А вот пункт 2 требуется продумать. Не очевидно даже, какой лучше использовать синтаксис для этого при создании таблицы. Но мы придумаем - сразу видно несколько вариантов. + +Частный случай такой задачи уже есть в https://clickhouse.tech/docs/ru/operations/table\_engines/graphitemergetree/ Но это было сделано для конкретной задачи. А надо обобщить. + +### 1.10. Пережатие старых данных в фоне {#perezhatie-starykh-dannykh-v-fone} + +Будет делать Кирилл Барухов, ВШЭ, экспериментальная реализация к весне 2020. Нужно для Яндекс.Метрики. + +Алгоритмы сжатия типа LZ77 позволяют потратить больше времени на сжатие данных, чтобы сжать данные сильнее, но при этом без проигрыша по скорости разжатия данных. В частности, этим свойством обладает LZ4 и ZSTD, которые используются в ClickHouse. Это позволяет использовать свободные ресурсы CPU, когда сервер не нагружен, для пережатия данных, чтобы данные занимали меньше места на дисках, и при этом сохранить или даже улучшить скорость обработки запросов. + +В то же время, ClickHouse обычно используется для «импульсного» сценария нагрузки. Запрос от пользователя обрабатывается максимально быстро, используя все ресурсы CPU, но в среднем по времени, сервер недостаточно нагружен. + +Предлагается добавить в ClickHouse настройки по пережатию данных и фоновые потоки, выполняющие эту задачу. + +### 1.11. + Виртуальная файловая система {#virtualnaia-failovaia-sistema} + +На VFS переведены Log, TinyLog, StripeLog, а также MergeTree, что доказывает состоятельность реализации. + +Нужно для Яндекс.Облака. Делает Александр, Яндекс.Облако. + +ClickHouse использует для хранения данных локальную файловую систему. Существует сценарий работы, в котором размещение старых (архивных) данных было бы выгодно на удалённой файловой системе. Если файловая система POSIX совместимая, то это не составляет проблем: ClickHouse успешно работает с Ceph, GlusterFS, MooseFS. Также востребованным является сценарий использования S3 (из-за доступности в облаке) или HDFS (для интеграции с Hadoop). Но эти файловые системы не являются POSIX совместимыми. Хотя для них существуют FUSE драйверы, но скорость работы сильно страдает и поддержка неполная. + +ClickHouse использует небольшое подмножество функций ФС, но в то же время, и некоторые специфические части: симлинки и хардлинки, O\_DIRECT. Предлагается выделить всё взаимодействие с файловой системой в отдельный интерфейс. + +### 1.12. Экспериментальная реализация VFS поверх S3 и HDFS {#eksperimentalnaia-realizatsiia-vfs-poverkh-s3-i-hdfs} + +Q2. + +Нужно для Яндекс.Облака. Требует 1.11. Желательно 1.6 и 1.18. +Делает Александр, Яндекс.Облако (сначала часть для S3), а также Олег Ершов, ВШЭ и Яндекс. + +Upd. Олег будет делать только часть про HDFS. + +Upd. Реализация поверх S3 является рабочей на уровне PoC. + +### 1.13. Ускорение запросов с FINAL {#uskorenie-zaprosov-s-final} + +Требует 2.1. Делает [Николай Кочетов](https://github.com/KochetovNicolai). Нужно для Яндекс.Метрики. Q2. + +### 1.14. Не писать столбцы, полностью состоящие из нулей {#ne-pisat-stolbtsy-polnostiu-sostoiashchie-iz-nulei} + +Антон Попов. Q2. +В очереди. Простая задача, является небольшим пререквизитом для потенциальной поддержки полуструктурированных данных. + +### 1.15. Возможность иметь разный первичный ключ в разных кусках {#vozmozhnost-imet-raznyi-pervichnyi-kliuch-v-raznykh-kuskakh} + +Сложная задача, только после 1.3. + +### 1.16. Несколько физических представлений для одного куска данных {#neskolko-fizicheskikh-predstavlenii-dlia-odnogo-kuska-dannykh} + +Сложная задача, только после 1.3 и 1.6. Позволяет компенсировать 21.20. + +### 1.17. Несколько сортировок для одной таблицы {#neskolko-sortirovok-dlia-odnoi-tablitsy} + +Сложная задача, только после 1.3 и 1.6. + +### 1.18. Отдельное хранение файлов кусков {#otdelnoe-khranenie-failov-kuskov} + +Требует 1.3 и 1.6. Полная замена hard links на sym links, что будет лучше для 1.12. + +## 2. Крупные рефакторинги {#krupnye-refaktoringi} + +Для обоснования необходимости смотрите ссылки в описании других задач. + +### 2.1. Переделка конвейера выполнения запросов на Processors {#peredelka-konveiera-vypolneniia-zaprosov-na-processors} + +Делает [Николай Кочетов](https://github.com/KochetovNicolai). Финальная стадия разработки. Включение по-умолчанию в конце декабря 2019. Удаление старого кода в начале 2020. + +Upd. На данный момент исправляются проблемы с регрессиями производительности в отдельных случаях. Кажется, что все проблемы исправлены. +Включение по-умолчанию в Q1, но остаётся вторая часть задачи по корректному выделению async части. + +Upd. Включили по-умолчанию. Удаление старого кода не раньше, чем после первого релиза, в котором это включено по-умолчанию и всё ещё можно выключить обратно. + +Upd. Уже есть первый релиз, в котором это включено по-умолчанию. + +Upd. Всё ещё ждём удаление старого кода, которое должно случиться после релиза 20.4. + +### 2.2. Инфраструктура событий/метрик/ограничений/квот/трассировки {#infrastruktura-sobytiimetrikogranicheniikvottrassirovki} + +В очереди. https://gist.github.com/alexey-milovidov/d62d73222d83b9319dc519cbb13aeff6 + +### 2.3. Перенос столбцового ser/de из DataType в Column {#perenos-stolbtsovogo-serde-iz-datatype-v-column} + +В очереди. + +### 2.4. Перевод LowCardinality из DataType в Column. Добавление ColumnSparse {#perevod-lowcardinality-iz-datatype-v-column-dobavlenie-columnsparse} + +Требует 2.3. + +### 2.5. Версионирование состояний агрегатных функций {#versionirovanie-sostoianii-agregatnykh-funktsii} + +В очереди. + +### 2.6. Правая часть IN как тип данных. Выполнение IN в виде скалярного подзапроса {#pravaia-chast-in-kak-tip-dannykh-vypolnenie-in-v-vide-skaliarnogo-podzaprosa} + +Требует 2.1. + +### 2.7. Нормализация Context {#normalizatsiia-context} + +В очереди. Нужно для YQL. + +Александр Токмаков исправил множество проблем с использованием Context и сейчас переносит каталог БД наружу. + +Upd. Каталог БД вынесен из Context. +Upd. SharedContext вынесен из Context. + +### 2.8. Декларативный парсер запросов {#deklarativnyi-parser-zaprosov} + +Средний приоритет. Нужно для YQL. + +Upd. В очереди. Иван Лежанкин. + +### 2.9. Логгировние в format-стиле {#loggirovnie-v-format-stile} + +Делает [Иван Лежанкин](https://github.com/abyss7). Низкий приоритет. +[\#6049](https://github.com/ClickHouse/ClickHouse/issues/6049#issuecomment-570836998) + +### 2.10. Запрашивать у таблиц не столбцы, а срезы {#zaprashivat-u-tablits-ne-stolbtsy-a-srezy} + +В очереди. + +### 2.11. Разбирательство и нормализация функциональности для bitmap {#razbiratelstvo-i-normalizatsiia-funktsionalnosti-dlia-bitmap} + +В очереди. + +### 2.12. Декларативные сигнатуры функций {#deklarativnye-signatury-funktsii} + +[\#3775](https://github.com/ClickHouse/ClickHouse/pull/3775) + +Задачу делает Алексей Миловидов. Прогресс 50% и разработка временно приостановлена. + +Upd. Разработка всё ещё приостановлена. + +### 2.13. Каждая функция в отдельном файле {#kazhdaia-funktsiia-v-otdelnom-faile} + +Задачу делает Алексей Миловидов. Прогресс 80%. Потребуется помощь других разработчиков. + +Upd. Поползновения наблюдаются. + +### 2.14. Все функции с состоянием переделать на FunctionBuilder {#vse-funktsii-s-sostoianiem-peredelat-na-functionbuilder} + +Долг [Николай Кочетов](https://github.com/KochetovNicolai). Сейчас код находится в переходном состоянии, что неприемлемо. + +### 2.15. Функция subscribe для IStorage {#funktsiia-subscribe-dlia-istorage} + +Для нормализации работы materialized views поверх Merge, Distributed, Kafka. + +## 3. Документация {#dokumentatsiia} + +Здесь задачи только по инфраструктуре документации. + +### 3.1. Перенос документации по функциям в код {#perenos-dokumentatsii-po-funktsiiam-v-kod} + +Требует 2.12 и 2.13. Хотим в Q2, средний приоритет. + +### 3.2. Перенос однородных частей документации в код {#perenos-odnorodnykh-chastei-dokumentatsii-v-kod} + +Требует 3.1. + +### + 3.3. Исправить катастрофически отвратительно неприемлемый поиск по документации {#ispravit-katastroficheski-otvratitelno-nepriemlemyi-poisk-po-dokumentatsii} + +[Иван Блинков](https://github.com/blinkov/) - очень хороший человек. Сам сайт документации основан на технологиях, не удовлетворяющих требованиям задачи, и эти технологии трудно исправить. Задачу будет делать первый встретившийся нам frontend разработчик, которого мы сможем заставить это сделать. + +Upd. Иван Блинков сделал эту задачу путём замены треш-технологий на нормальные. + +### 3.4. + Добавить японский язык в документацию {#dobavit-iaponskii-iazyk-v-dokumentatsiiu} + +Эту задачу сделает [Иван Блинков](https://github.com/blinkov/), до конца декабря 2019. Сделано. + +## 4. Сетевое взаимодействие {#setevoe-vzaimodeistvie} + +### 4.1. Уменьшение числа потоков при распределённых запросах {#umenshenie-chisla-potokov-pri-raspredelionnykh-zaprosakh} + +Весна 2020. Upd. Есть прототип. Upd. Он не работает. Upd. Человек отказался от задачи, теперь сроки не определены. + +### 4.2. Спекулятивное выполнение запросов на нескольких репликах {#spekuliativnoe-vypolnenie-zaprosov-na-neskolkikh-replikakh} + +Нужно для Яндекс.Метрики. Требует 4.1. + +Если распределённый запрос затрагивает большое количество серверов, то время выполнения запросов часто становится большим из-за tail latencies - случайных редких замедлений отдельных серверов. Эту проблему можно избежать, отправляя один и тот же запрос сразу на несколько реплик, и используя данные с наиболее быстрой. + +Задача скрывает в себе много тонкостей, связанных с обработкой стадий выполнения запроса (соединение, обмен handshake, отправка запроса, получение заголовка результата, получение пакетов прогресса, получение данных), правильной возможностью настройки таймаутов, правильной отменой запросов. + +Сейчас для распределённых запросов используется по потоку на соединение. Это позволяет хорошо распараллелить вычисления над полученными данными и утилизировать сеть, но становится сильно избыточным для больших кластеров. Для примера, создание 1000 потоков для чтения данных из 1000 серверов кластера - лишь расходует ресурсы и увеличивает время выполнения запроса. Вместо этого необходимо использовать количество потоков не большее количества процессорных ядер, и мультиплексировать в одном потоке общение с серверами. Реализация нетривиальна, так как мультиплексировать необходимо каждую стадию общения по сети, включая установку соединения и обмен handshake. + +Upd. Сейчас обсуждается, как сделать другую задачу вместо этой. + +### 4.3. Ограничение числа одновременных скачиваний с реплик {#ogranichenie-chisla-odnovremennykh-skachivanii-s-replik} + +Дмитрий Григорьев, ВШЭ. +Изначально делал Олег Алексеенков, но пока решение не готово, хотя там не так уж много доделывать. + +### 4.4. Ограничение сетевой полосы при репликации {#ogranichenie-setevoi-polosy-pri-replikatsii} + +Дмитрий Григорьев, ВШЭ. Нужно для Метрики. + +### 4.5. Возможность продолжить передачу куска данных при репликации после сбоя {#vozmozhnost-prodolzhit-peredachu-kuska-dannykh-pri-replikatsii-posle-sboia} + +Дмитрий Григорьев, ВШЭ. + +### 4.6. p2p передача для GLOBAL подзапросов {#p2p-peredacha-dlia-global-podzaprosov} + +### 4.7. Ленивая загрузка множеств для IN и JOIN с помощью k/v запросов {#lenivaia-zagruzka-mnozhestv-dlia-in-i-join-s-pomoshchiu-kv-zaprosov} + +### 4.8. Разделить background pool для fetch и merge {#razdelit-background-pool-dlia-fetch-i-merge} + +Дмитрий Григорьев, ВШЭ. +В очереди. Исправить проблему, что восстанавливающаяся реплика перестаёт мержить. Частично компенсируется 4.3. + +## 5. Операции {#operatsii} + +### 5.1. + Разделение задач на более мелкие куски в clickhouse-copier {#razdelenie-zadach-na-bolee-melkie-kuski-v-clickhouse-copier} + +[\#9075](https://github.com/ClickHouse/ClickHouse/pull/9075) +Q1. Нужно для Метрики, в очереди. Никита Михайлов. + +Upd. Задача на финальной стадии разработки. +Upd. Сделано. Эффективность работы под вопросом. Есть варианты, как сделать лучше. + +### 5.2. Автонастройка лимита на оперативку и размера кэшей {#avtonastroika-limita-na-operativku-i-razmera-keshei} + +### 5.3. + Встроенная ручка для Prometheus {#vstroennaia-ruchka-dlia-prometheus} + +Сделано. https://github.com/Vdimir + +### 5.4. Opt-in сообщать в клиенте, если вышла новая версия {#opt-in-soobshchat-v-kliente-esli-vyshla-novaia-versiia} + +### 5.5. + LTS релизы {#lts-relizy} + +Требует 7.5. Задачу хочет Метрика, Облако, БК, Маркет и Altinity. Первой LTS версией уже стала версия 19.14. +Метрика, БК, Маркет, Altinity уже используют более свежие версии чем LTS. +Upd. Появилась вторая версия LTS - 20.3. + +## 6. Инструментирование {#instrumentirovanie} + +### 6.1. + Исправления сэмплирующего профайлера запросов {#ispravleniia-sempliruiushchego-profailera-zaprosov} + +Михаил Филимонов, Altinity. Ноябрь 2019. Сделано. +Осталось ещё проверить работоспособность профайлера в первом потоке (что важно для INSERT). Иван Лежанкин. Q1. Сделано. + +### 6.2. + Добавление memory profiler {#dobavlenie-memory-profiler} + +[\#6387](https://github.com/ClickHouse/ClickHouse/issues/6387) + +Сравнительно простая задача, но только для опытных разработчиков. Нужна всем. Иван Лежанкин. Q1. Сделано. + +### 6.3. + Учёт оперативки total расширить не только на запросы {#uchiot-operativki-total-rasshirit-ne-tolko-na-zaprosy} + +Исправление долгоживущей проблемы с дрифтом учёта оперативки. Нужна для Метрики и БК. + +### 6.4. Поддержка perf events как метрик запроса {#podderzhka-perf-events-kak-metrik-zaprosa} + +Делает Андрей Скобцов, ВШЭ. + +В Linux существует возможность получать в программе информацию о счётчиках производительности и событиях, относящихся к CPU и ядру ОС. Подробнее смотрите `man perf_event_open`. Предлагается добавить эти метрики в ClickHouse для инструментирования запросов. + +Есть прототип. + +### 6.5. Эксперименты с LLVM X-Ray {#eksperimenty-s-llvm-x-ray} + +Требует 2.2. + +### 6.6. + Стек трейс для любых исключений {#stek-treis-dlia-liubykh-iskliuchenii} + +Сейчас есть стек трейс для почти всех, но не всех исключений. Требует 7.4. + +### 6.7. + Таблица system.stack\_trace {#tablitsa-system-stack-trace} + +Сравнительно простая задача, но только для опытных разработчиков. + +### 6.8. Таблица system.crashes {#tablitsa-system-crashes} + +Сравнительно простая задача, но только для опытных разработчиков. + +### 6.9. Отправлять информацию клиенту, если сервер падает по сигналу {#otpravliat-informatsiiu-klientu-esli-server-padaet-po-signalu} + +### 6.10. Сбор общих системных метрик {#sbor-obshchikh-sistemnykh-metrik} + +## 7. Сопровождение разработки {#soprovozhdenie-razrabotki} + +### 7.1. + ICU в submodules {#icu-v-submodules} + +Добавление в submodules также нужно для Аркадии (7.26). + +### 7.2. + LLVM в submodules {#llvm-v-submodules} + +Сделал Алексей Миловидов. + +### 7.3. + Обновление Poco {#obnovlenie-poco} + +Алексанр Кузьменков. + +### 7.4. + Включить libc++, libc++-abi при сборке с gcc {#vkliuchit-libc-libc-abi-pri-sborke-s-gcc} + +Сейчас включено только при сборке с clang, но продакшен сборка использует gcc. +Требует 7.2 и, возможно, 7.1 (только в случае новой версии ICU). + +### 7.5. + Начать публиковать LTS релизы {#nachat-publikovat-lts-relizy} + +[Александр Сапин](https://github.com/alesapin). + +### 7.6. + Правильный статистический тест для comparison mode в clickhouse-performance-test {#pravilnyi-statisticheskii-test-dlia-comparison-mode-v-clickhouse-performance-test} + +Задачу начал делать Дмитрий Рубашкин (ВШЭ). Сейчас продолжает [Александр Кузьменков](https://github.com/akuzm). Сделано, работает в CI. + +### 7.7. Доделать тесты под MSan {#dodelat-testy-pod-msan} + +Уже есть ASan, TSan, UBSan. Не хватает тестов под MSan. Они уже добавлены в CI, но не проходят. +[Александр Кузьменков](https://github.com/akuzm) и [Александр Токмаков](https://github.com/tavplubix). + +Upd. Задача всё ещё медленно тащится. + +### 7.8. + Добавить clang-tidy {#dobavit-clang-tidy} + +Уже есть PVS-Studio. Мы очень довольны, но этого недостаточно. + +Upd. Алексей Миловидов. Добавлено некоторое множество проверок, но нужно рассмотреть все проверки подряд и добавить всё, что можно. +Upd. Рассмотрели все проверки подряд. + +### 7.9. + Проверки на стиль имён с помощью clang-tidy {#proverki-na-stil-imion-s-pomoshchiu-clang-tidy} + +Сделано. Только в .cpp файлах и только для имён локальных переменных. Остальное слишком сложно. + +### 7.10. Включение UBSan и MSan в интеграционных тестах {#vkliuchenie-ubsan-i-msan-v-integratsionnykh-testakh} + +UBSan включен в функциональных тестах, но не включен в интеграционных тестах. Требует 7.7. + +### 7.11. Включение \*San в unit тестах {#vkliuchenie-san-v-unit-testakh} + +У нас мало unit тестов по сравнению с функциональными тестами и их использование не обязательно. Но они всё-равно важны и нет причин не запускать их под всеми видами sanitizers. + +Илья Яцишин. + +### 7.12. Показывать тестовое покрытие нового кода в PR {#pokazyvat-testovoe-pokrytie-novogo-koda-v-pr} + +Пока есть просто показ тестового покрытия всего кода. + +### 7.13. + Включение аналога -Weverything в gcc {#vkliuchenie-analoga-weverything-v-gcc} + +Мы используем -Wall -Wextra -Weverything -Werror. +При сборке с clang, -Weverything уже включено. Но в gcc есть уникальные warning-и, отсутствующие в clang. +Сделал Wolf Kreuzerkrieg. + +### 7.14. + Альтернатива для readline и libedit {#alternativa-dlia-readline-i-libedit} + +Подключение replxx вместо readline сделал Иван Лежанкин. + +Есть технический долг с лицензиями файлов консорциума Unicode. + +### 7.14.1. Улучшение возможностей интерактивного режима clickhouse-client {#uluchshenie-vozmozhnostei-interaktivnogo-rezhima-clickhouse-client} + +Тагир Кускаров, ВШЭ. + +Upd. В рамках данной задачи добавляем подстветку синтаксиса и исправление проблем со вставкой больших запросов. + +Для ввода запросов в интерактивном режиме в клиенте командной строки clickhouse-client использовалась библиотека readline или libedit. + +Библиотеки readline и libedit обладает следующими недостатками: +- (исправлено в новых версиях readline) Очень низкая производительность вставки больших кусков текста. Вставка каждого следующего символа имеет сложность O(n = количество предыдущих символов) и при вставке 1 МБ текста, скорость падает до десятков байт в секунду. +- Крайне сложно или невозможно реализовать подсветку синтаксиса по мере набора текста, а также autocomplete без нажатия дополнительных клавиш для вызова. +- Лицензия GPL (для readline) препятствует её включению в кодовую базу продукта. +- Плохо работает навигация по истории, если история вкючает запросы, не помещающиеся на экран. +- История сохраняется лишь при завершении работы клиента. +- При параллельной работе нескольких клиентов с одним файлом истории, сохраняется история только одного из клиентов. +- Плохо работает история для многострочных запросов. +- Излишняя экономия пересылаемых данных, что часто приводит к остаткам мусора в терминале. + +Кроме того, имеются следующие сложно достижимые достоинства: +- Поддержка right-to-left текста; +- Поддержка editrc конфигураций. + +В качестве альтернатив можно рассмотреть следующие варианты: +- Linenoise от Salvatore Sanfilippo. Достоинства: простота и компактность кода; высокая скорость работы. Недостатки: отсутствует поддержка Unicode; отсутствует автоматический перенос текста, что затрудняет работу с многострочными запросами. +- Linenoise с патчами для поддержки Unicode. Недостаток: теряется преимущество по скорости работы. +- Fish shell. Не является библиотекой, но представляет собой отличный пример, как можно реализовать подстветку синтаксиса и удобный autocomplete. Поддерживает Unicode, но работает весьма медленно. +- Python Prompt Toolkit. Не является подходящим решением для интеграции в C++ проект. Хорошие возможности по подсветке синтаксиса и autocomplete. + +Вместо этого предлагается в качестве примера изучить прототип текстового редактора Kilo: https://viewsourcecode.org/snaptoken/kilo/ и реализовать всю необходимую функциональность. + +### 7.15. + Замена libressl обратно на openssl {#zamena-libressl-obratno-na-openssl} + +Поводом использования libressl послужило желание нашего хорошего друга из известной компании несколько лет назад. Но сейчас ситуация состоит в том, что openssl продолжает развиваться, а libressl не особо, и можно спокойно менять обратно. + +Нужно для Яндекс.Облака для поддержки TLS 1.3. + +### 7.16. + tzdata внутри бинарника {#tzdata-vnutri-binarnika} + +Как в Аркадии, fallback на системные. + +### 7.17. + Доделать tgz пакеты {#dodelat-tgz-pakety} + +Уже давно собираются универсальные tgz пакеты, но по нелепой случайности из них исчез install скрипт. +[Александр Сапин](https://github.com/alesapin). Может делегировать эту задачу кому угодно. +Upd. Сделано всё кроме инструкции на сайте. Для этого требуется создать директории testing/stable/prestable на repo.yandex.ru. Внезапно оказалось, что человек, отвечающий за это, в отпуске, и он не отвечает на вопрос, кто его заместитель. Q1. + +### 7.18. + Доделать бинарники под Mac {#dodelat-binarniki-pod-mac} + +Уже есть автосборка бинарников под Mac на каждый коммит и PR, но с недостатками. +[Иван Лежанкин](https://github.com/abyss7). Требует 7.1, 7.2. Рекомендуется 7.14. Сейчас не хватает по крайней мере SSL и ICU. Нужно для Яндекс.Облака. +Upd. Сделано SSL. Ориентируемся в Q1, но приоритет средний и может потеряться. + +### 7.18.1. Поместить ссылку на собранные бинарники под Mac на сайт {#pomestit-ssylku-na-sobrannye-binarniki-pod-mac-na-sait} + +Сейчас людям приходится делать несколько кликов, чтобы их скачать. +[Иван Лежанкин](https://github.com/abyss7) или [Александр Сапин](https://github.com/alesapin). + +### 7.19. + Доделать (проверить) автосборку под AArch64 {#dodelat-proverit-avtosborku-pod-aarch64} + +https://github.com/ClickHouse/ClickHouse/issues/8027\#issuecomment-566670282 +Проверили на настоящем сервере Huawei, а также в специальном Docker контейнере, который содержит внутри qemu-user-static. +Также можно проверить на Cavium, на Raspberry Pi а также на твоём Android телефоне. + +### 7.20. Автосборка для FreeBSD x86\_64 {#avtosborka-dlia-freebsd-x86-64} + +[Иван Лежанкин](https://github.com/abyss7). + +Upd. В процессе реализации, есть pull request. + +### 7.21. Автосборка для Linux ppc64 {#avtosborka-dlia-linux-ppc64} + +[Иван Лежанкин](https://github.com/abyss7). + +### 7.22. Дэшборд для pull requests {#deshbord-dlia-pull-requests} + +Дарья Петрова, УрФУ. + +Над ClickHouse одновременно работает большое количество разработчиков, которые оформляют свои изменения в виде pull requests. Когда непомерженных pull requests много, то возникает сложность с организацией работы - непонятно, на какой pull request смотреть в первую очередь. + +Предлагается реализовать простое одностраничное веб-приложение, в котором отображается список pull requests со следующей информацией: +- размер diff - количество изменённых строк; +- как давно было последнее обновление; +- типы изменённых файлов: C++, документация, скрипты сборки; +- наличие добавленных тестов; +- есть ли описание для changelog; +- изменены ли submodules; +- был ли разрешён запуск проверок CI; +- статусы проверок CI; +- количество approve от ревьюеров; + +Статусы проверок - наиболее важная часть. Так как для каждого PR выполняется несколько десятков проверок и наиболее медленные работают до нескольких часов, придётся: +- отображать сразу все проверки для каждого PR в виде красивой разноцветной матрицы с информацией по наведению мыши; +- отсортировать проверки по важности: например, если у внешнего разработчика проходят все проверки кроме стиля кода, то мы можем взять это в работу сами; +- если для предыдущего коммита проверка была завершена, а для последнего коммита ещё только идёт - то можно отображать в таблице статус предыдущей проверки более блёклым цветом. + +Предлагается реализовать несколько вариантов сортировок. Очевидное - по времени обновления, более интересно - некое ранжирование с целью выяснить, «что лучше взять в работу прямо сейчас». + +Похожие продукты уже есть, например: http://prs.mozilla.io/yandex:ClickHouse К сожалению, этот продукт заброшен, да и делает не совсем то, что нужно. По своему усмотрению, можно взять из него что-нибудь полезное. + +### 7.23. Функции для fuzzing {#funktsii-dlia-fuzzing} + +Андрей Некрашевич, ВШЭ. + +Fuzzing тестирование - это тестирование случайными данными. Мы рассмотрим несколько подходов к этой задачи: + +1. Добавление в SQL диалект ClickHouse функций для генерации случайных данных (пример - случайные бинарные строки заданной длины, случайные валидные UTF-8 строки) и «порчи» данных (например, поменять значения случайных бит с заданной частотой). Это будет использовано для тестирования SQL-функций ClickHouse. + +Можно добавить функции: +`randomString(length)` +`randomFixedString(length)` +- строка заданной длины с равномерно распределёнными случайными байтами; +`randomStringASCII(length)` +`randomStringUTF8(length)` + +`fuzzBits(s, inverse_probability)` - изменить каждый бит строки на противоположный с заданной вероятностью; +`fuzzBytes(s, inverse_probability)` - изменить каждый байт строки на равномерно случайный с заданной вероятностью; + +У каждой функции опциональный аргумент против склейки одинаковых выражений в запросе. + +Также можно сделать функции с детерминированным генератором случайных чисел (аргументом передаётся seed) для воспроизводимости тестовых кейсов. + +Upd. Сергей Штыков сделал функцию `randomPrintableASCII`. +Upd. Илья Яцишин сделал табличную функцию `generateRandom`. +Upd. Эльдар Заитов добавляет OSS Fuzz. + +### 7.24. Fuzzing лексера и парсера запросов; кодеков и форматов {#fuzzing-leksera-i-parsera-zaprosov-kodekov-i-formatov} + +Андрей Некрашевич, ВШЭ. + +Продолжение 7.23. + +1. Использование AFL или LibFuzzer для тестирования отдельных частей кодовой базы ClickHouse. + +2. Генерация и выполнение случайных синтаксически корректных запросов на случайных данных. + +### 7.25. + Синхронизация релизов в Аркадию {#sinkhronizatsiia-relizov-v-arkadiiu} + +Изначально занимался Олег Алексеенков. Сейчас он перешёл работать в дружественный отдел, но обещает продолжать синхронизацию. +Затем, возможно, [Иван Лежанкин](https://github.com/abyss7). Но сейчас приостановлено, так как Максим из YT должен исправить регрессию производительности в анализе индекса. + +Максим из YT сказал, что сделает это после нового года. +Максим из YT сказал, что «мы планируем в январе добиться». +Максим сейчас занимается собираемостью YT с новой версией ClickHouse. + +Нужно для CHYT и YQL. + +Upd: Все патчи Максима отправлены в master. Задача взята в работу. +Upd: Задача в процессе реализации. Синхронизироваться будет master. Делает [Иван Лежанкин](https://github.com/abyss7) +Upd: Есть собирающийся прототип, но сборка как будто ещё не в trunk Аркадии. +Upd: Добавлено в Аркадию, но не все файлы (не побайтово). + +### 7.26. Побайтовая идентичность репозитория с Аркадией {#pobaitovaia-identichnost-repozitoriia-s-arkadiei} + +Команда DevTools. Прогресс по задаче под вопросом. + +### 7.27. Запуск автотестов в Аркадии {#zapusk-avtotestov-v-arkadii} + +Требует 7.26. Коллеги начали делать, есть результат. + +### 7.29. Опции clickhouse install, stop, start вместо postinst, init.d, systemd скриптов {#optsii-clickhouse-install-stop-start-vmesto-postinst-init-d-systemd-skriptov} + +Низкий приоритет. + +### 7.30. Возможность переключения бинарных файлов на продакшене без выкладки пакетов {#vozmozhnost-perekliucheniia-binarnykh-failov-na-prodakshene-bez-vykladki-paketov} + +Низкий приоритет. + +### 7.31. Зеркалирование нагрузки между серверами {#zerkalirovanie-nagruzki-mezhdu-serverami} + +В очереди. Нужно для Яндекс.Метрики. + +### 7.32. Обфускация продакшен запросов {#obfuskatsiia-prodakshen-zaprosov} + +Роман Ильговский. Нужно для Яндекс.Метрики. + +Имея SQL запрос, требуется вывести структуру таблиц, на которых этот запрос будет выполнен, и заполнить эти таблицы случайными данными, такими, что результат этого запроса зависит от выбора подмножества данных. + +Для примера, если есть запрос `SELECT SearchPhrase, count(*) FROM table WHERE CounterID = 34 AND SearchPhrase LIKE '%ClickHouse%'`, то мы можем сделать вывод, что CounterID имеет числовой тип, а SearchPhrase - строковый. Заполнить таблицу данными, на которых отдельные условия `CounterID = 34` и `SearchPhrase LIKE '%ClickHouse%'` для некоторых строк выполнены, а для некоторых строк не выполнены. + +Обфускация запросов: имея секретные запросы и структуру таблиц, заменить имена полей и константы, чтобы запросы можно было использовать в качестве публично доступных тестов. + +### 7.33. Выкладывать патч релизы в репозиторий автоматически {#vykladyvat-patch-relizy-v-repozitorii-avtomaticheski} + +В очереди. Иван Лежанкин. + +### 7.34. Бэкпортировать bugfix автоматически {#bekportirovat-bugfix-avtomaticheski} + +В очереди. Иван Лежанкин. + +### 7.35. Начальные правила для авто-merge {#nachalnye-pravila-dlia-avto-merge} + +Зелёные проверки и два ревью. +[Александр Сапин](https://github.com/alesapin). Может делегировать эту задачу кому угодно. + +### 7.36. Понятие доверенных контрибьюторов {#poniatie-doverennykh-kontribiutorov} + +Контрибьюторы, у которых есть 5 померженных PR. Для их новых PR автотесты запускаются сразу. +[Александр Сапин](https://github.com/alesapin). Может делегировать эту задачу кому угодно. +Сейчас добавляем некоторых доверенных контрибьюторов в ручном режиме. + +### 7.37. Разобраться с repo.yandex.ru {#razobratsia-s-repo-yandex-ru} + +Есть жалобы на скорость загрузки и неудобство maintenance, operations, visibility. + +Upd. Иван Блинков настроил CDN repo.clickhouse.tech, что решает проблему с доступностью зарубежом. +Вопрос с operations, visibility пока актуален. + +## 8. Интеграция с внешними системами {#integratsiia-s-vneshnimi-sistemami} + +### 8.1. Поддержка ALTER MODIFY SETTING для Kafka {#podderzhka-alter-modify-setting-dlia-kafka} + +Также - возможность указать все настройки форматов в Kafka. + +Altinity. Никто не делает эту задачу. + +### 8.2. Поддержка Mongo Atlas URI {#podderzhka-mongo-atlas-uri} + +[Александр Кузьменков](https://github.com/akuzm). + +### 8.3. + Доработки globs (правильная поддержка диапазонов, уменьшение числа одновременных stream-ов) {#dorabotki-globs-pravilnaia-podderzhka-diapazonov-umenshenie-chisla-odnovremennykh-stream-ov} + +[Ольга Хвостикова](https://github.com/stavrolia). + +Уменьшение числа stream-ов сделано, а вот правильная поддержка диапазонов - нет. Будем надеяться на Q1/Q2. Сделано. + +### 8.4. Унификация File, HDFS, S3 под URL {#unifikatsiia-file-hdfs-s3-pod-url} + +### 8.5. + Аутентификация в S3 {#autentifikatsiia-v-s3} + +[Владимир Чеботарёв](https://github.com/excitoon), Altinity. + +### 8.6. Kerberos аутентификация для HDFS и Kafka {#kerberos-autentifikatsiia-dlia-hdfs-i-kafka} + +Андрей Коняев, ArenaData. Он куда-то пропал. + +### 8.7. + Исправление мелочи HDFS на очень старых ядрах Linux {#ispravlenie-melochi-hdfs-na-ochen-starykh-iadrakh-linux} + +В ядрах 2.6 отсутствует один системный вызов, который библиотека hdfs3 использует без необходимости. +Сделал Amos Bird. + +### 8.8. + Поддержка виртуальных столбцов с именем файла и путём {#podderzhka-virtualnykh-stolbtsov-s-imenem-faila-i-putiom} + +[Ольга Хвостикова](https://github.com/stavrolia). + +### 8.9. + Поддержка сжатых файлов (gz, bz) на чтение и запись {#podderzhka-szhatykh-failov-gz-bz-na-chtenie-i-zapis} + +Сделал [Andrey Bodrov](https://github.com/apbodrov) + +### 8.10. Запись в табличную функцию ODBC {#zapis-v-tablichnuiu-funktsiiu-odbc} + +Артемий Бобровский, ВШЭ + +### 8.11. Движок таблиц для чтения из Mongo {#dvizhok-tablits-dlia-chteniia-iz-mongo} + +Артемий Бобровский, ВШЭ + +### 8.12. Пропуск столбцов в форматах Parquet, ORC {#propusk-stolbtsov-v-formatakh-parquet-orc} + +Артемий Бобровский, ВШЭ + +### 8.13. Поддержка массивов в Parquet, ORC {#podderzhka-massivov-v-parquet-orc} + +Артемий Бобровский, ВШЭ + +### 8.14. Запись данных в ORC {#zapis-dannykh-v-orc} + +Возможно, Андрей Коняев, ArenaData (зависит от желания). + +### 8.15. Запись данных в CapNProto {#zapis-dannykh-v-capnproto} + +### 8.16. + Поддержка формата Avro {#podderzhka-formata-avro} + +Andrew Onyshchuk. Есть pull request. Q1. Сделано. + +Формат Apache Avro является компактным структурированным построчным бинарным форматом данных с внешней схемой. Этот формат часто используется совместно с Kafka и поддержка его в качестве одного из форматов ввода-вывода в ClickHouse является востребованной пользователями. + +### 8.16.1. + Поддержка формата JSONEachRow, засунутого в массив {#podderzhka-formata-jsoneachrow-zasunutogo-v-massiv} + +Павел Круглов, ВШЭ и Яндекс. Есть pull request. + +### 8.16.2. - Поддержка формата Thrift {#podderzhka-formata-thrift} + +Павел Круглов, ВШЭ и Яндекс. Задача отменена. + +### 8.16.3. + Поддержка формата MsgPack {#podderzhka-formata-msgpack} + +Павел Круглов, ВШЭ и Яндекс. +Задача взята в работу. + +Upd. Почти готово - есть лишь небольшой технический долг. + +### 8.16.4. + Формат Regexp {#format-regexp} + +Павел Круглов, ВШЭ и Яндекс. +Есть pull request. Готово. + +### 8.17. ClickHouse как MySQL реплика {#clickhouse-kak-mysql-replika} + +Ильяс Адюгамов, ВШЭ. + +Реализовать возможность подписаться на row-based репликацию MySQL и сохранять полученные данные в CollapsingMergeTree или ReplacingMergeTree таблицы. Сторонние решения для этой задачи уже существуют: https://www.altinity.com/blog/2018/6/30/realtime-mysql-clickhouse-replication-in-practice Также существует стороннее решение для PostgreSQL: https://github.com/mkabilov/pg2ch + +Встроенная в ClickHouse возможность работать в качестве реплики MySQL даст преимущества для дальнейшего развития. + +### 8.18. + ClickHouse как Federated MySQL {#clickhouse-kak-federated-mysql} + +Maxim Fedotov, Wargaming + Yuri Baranov, Яндекс. + +### 8.19. Интеграция с RabbitMQ {#integratsiia-s-rabbitmq} + +Ксения Сумарокова, ВШЭ. + +В ClickHouse часто используется потоковый импорт данных из распределённой очереди. Наиболее популярно использование совместно с Kafka. Эта возможность уже есть. + +Следующей по востребованности является система очередей RabbitMQ. Её поддержка в ClickHouse отсутствует. + +Есть pull request в процессе разработки. + +### 8.20. Интеграция с SQS {#integratsiia-s-sqs} + +Низкий приоритет. + +### 8.21. Поддержка произвольного количества языков для имён регионов {#podderzhka-proizvolnogo-kolichestva-iazykov-dlia-imion-regionov} + +Нужно для БК. Декабрь 2019. +В декабре для БК сделан минимальный вариант этой задачи. +Максимальный вариант, вроде, никому не нужен. +Upd. Всё ещё кажется, что задача не нужна. + +### 8.22. Поддержка синтаксиса для переменных в стиле MySQL {#podderzhka-sintaksisa-dlia-peremennykh-v-stile-mysql} + +При парсинге запроса преобразовывать синтаксис вида `@@version_full` в вызов функции `getGlobalVariable('version_full')`. Поддержать популярные MySQL переменные. Может быть поможет Юрий Баранов, если будет энтузиазм. + +Upd. Юрий Баранов работает в Google, там запрещено разрабатывать ClickHouse. + +### 8.23. Подписка для импорта обновляемых и ротируемых логов в ФС {#podpiska-dlia-importa-obnovliaemykh-i-rotiruemykh-logov-v-fs} + +Желательно 2.15. + +## 9. Безопасность {#bezopasnost} + +### 9.1. + Ограничение на хосты в запросах ко внешним системам {#ogranichenie-na-khosty-v-zaprosakh-ko-vneshnim-sistemam} + +Михаил Коротов. + +### 9.2. Преднастроенные именованные соединения к внешним БД {#prednastroennye-imenovannye-soedineniia-k-vneshnim-bd} + +Валерий Батурин, ВШЭ. + +ClickHouse предоставляет возможность обратиться к внешней базе данных из языка запросов. Это реализовано в виде табличных функций. В параметрах к табличной функции указывается адрес удалённой базы данных (хост, порт), а также аутентификационные данные (имя пользователя, пароль). Аутентификационные данные указываются в запросе в открытом виде и, таким образом, попадают в историю запросов и в логи, что компрометирует безопасность системы. + +Вместо этого предлагается описывать необходимые данные в конфигурационном файле сервера или в отдельном сервисе и ссылаться на них по именам. + +### 9.3. + Поддержка TLS для ZooKeeper {#podderzhka-tls-dlia-zookeeper} + +[\#10174](https://github.com/ClickHouse/ClickHouse/issues/10174) + +Есть pull request. + +## 10. Внешние словари {#vneshnie-slovari} + +### 10.1. + Исправление зависания в библиотеке доступа к YT {#ispravlenie-zavisaniia-v-biblioteke-dostupa-k-yt} + +Библиотека для доступа к YT не переживает учения. +Нужно для БК и Метрики. Поиск причин - [Александр Сапин](https://github.com/alesapin). Дальшейшее исправление возможно на стороне YT. + +Цитата: «Оказывается для YT-клиента зависания на несколько минут это нормально. Убрал внутренние ретраи, снизил таймауты. Однозначно станет лучше». + +### 10.2. Исправление SIGILL в библиотеке доступа к YT {#ispravlenie-sigill-v-biblioteke-dostupa-k-yt} + +Код YT использует SIGILL вместо abort. Это, опять же, происходит при учениях. +Нужно для БК и Метрики. Поиск причин - [Александр Сапин](https://github.com/alesapin). Дальшейшее исправление возможно на стороне YT. + +Upd. Одну причину устранили, но ещё что-то неизвестное осталось. +Upd. Нас заставляют переписать эту библиотеку с одного API на другое, так как старое внезапно устарело. Кажется, что переписывание случайно исправит все проблемы. + +### 10.3. Возможность чтения данных из статических таблиц в YT словарях {#vozmozhnost-chteniia-dannykh-iz-staticheskikh-tablits-v-yt-slovariakh} + +Нужно для БК и Метрики. + +### 10.4. Словарь из YDB (KikiMR) {#slovar-iz-ydb-kikimr} + +Нужно для Метрики, а делать будет таинственный незнакомец из команды KikiMR (под вопросом). Таинственный незнакомец не подтверждает, что он будет делать эту задачу. + +### 10.5. Закрытие соединений и уменьшение числа соединений для MySQL и ODBC {#zakrytie-soedinenii-i-umenshenie-chisla-soedinenii-dlia-mysql-i-odbc} + +Нужно для Метрики. + +Для MySQL сделал Clément Rodriguez. + +### 10.6. Словари из Cassandra и Couchbase {#slovari-iz-cassandra-i-couchbase} + +### 10.7. Поддержка Nullable в словарях {#podderzhka-nullable-v-slovariakh} + +Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. + +### 10.8. Поддержка массивов в словарях {#podderzhka-massivov-v-slovariakh} + +Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. + +### 10.9. - Уменьшение блокировок для cache словарей за счёт одновременных запросов одного и того же {#umenshenie-blokirovok-dlia-cache-slovarei-za-schiot-odnovremennykh-zaprosov-odnogo-i-togo-zhe} + +Заменено в пользу 10.10, 10.11. + +### 10.10. + Возможность использования старых значений из cache словаря пока они перезапрашиваются {#vozmozhnost-ispolzovaniia-starykh-znachenii-iz-cache-slovaria-poka-oni-perezaprashivaiutsia} + +Никита Михайлов. Q1. Нужно для БК и Метрики. + +### 10.11. + Возможность исключительно асинхронных запросов в cache словарях {#vozmozhnost-iskliuchitelno-asinkhronnykh-zaprosov-v-cache-slovariakh} + +Никита Михайлов. Q1. Нужно для БК и Метрики. Требует 10.10. + +### 10.12. Layout direct для словарей {#layout-direct-dlia-slovarei} + +Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. +Приступили к этой задаче. + +### 10.13. Использование Join как generic layout для словарей {#ispolzovanie-join-kak-generic-layout-dlia-slovarei} + +Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. + +### 10.14. Поддержка всех типов в функции transform {#podderzhka-vsekh-tipov-v-funktsii-transform} + +### 10.15. Использование словарей как специализированного layout для Join {#ispolzovanie-slovarei-kak-spetsializirovannogo-layout-dlia-join} + +### 10.16. Словари на локальном SSD {#slovari-na-lokalnom-ssd} + +Никита Васильев, ВШЭ и Яндекс. Есть pull request. + +Реализовать в ClickHouse специализированный движок таблиц, подходящий для быстрых key-value запросов и оптимизированный для расположения данных на SSD. Это может быть: реализация на основе RocksDB; сериализованные RowBinary данные с индексом в оперативке; секретная очень эффективная структура данных, о которой я расскажу. + +Использовать эту структуру данных как отдельный вид словарей, как источник для cache словарей или как дополнительный уровень кэширования для cache словарей. + +### 10.17. Локальный дамп состояния словаря для быстрого старта сервера {#lokalnyi-damp-sostoianiia-slovaria-dlia-bystrogo-starta-servera} + +### 10.18. Таблица Join или словарь на удалённом сервере как key-value БД для cache словаря {#tablitsa-join-ili-slovar-na-udalionnom-servere-kak-key-value-bd-dlia-cache-slovaria} + +### 10.19. Возможность зарегистрировать некоторые функции, использующие словари, под пользовательскими именами {#vozmozhnost-zaregistrirovat-nekotorye-funktsii-ispolzuiushchie-slovari-pod-polzovatelskimi-imenami} + +## 11. Интерфейсы {#interfeisy} + +### 11.1. Вставка состояний агрегатных функций в виде кортежа аргументов или массива кортежей аргументов {#vstavka-sostoianii-agregatnykh-funktsii-v-vide-kortezha-argumentov-ili-massiva-kortezhei-argumentov} + +### 11.2. Возможность использовать движок JDBC из коробки {#vozmozhnost-ispolzovat-dvizhok-jdbc-iz-korobki} + +Нужно разобраться, как упаковывать Java в статический бинарник, возможно AppImage. Или предоставить максимально простую инструкцию по установке jdbc-bridge. Может быть будет заинтересован Александр Крашенинников, Badoo, так как он разработал jdbc-bridge. + +Upd. Александр Крашенинников перешёл в другую компанию и больше не занимается этим. + +### 11.3. + Интеграционные тесты ODBC драйвера путём подключения ClickHouse к самому себе через ODBC {#integratsionnye-testy-odbc-draivera-putiom-podkliucheniia-clickhouse-k-samomu-sebe-cherez-odbc} + +Михаил Филимонов, Altinity. Готово. + +### 11.4. Исправление упячек с типами Date и Decimal в clickhouse-cpp {#ispravlenie-upiachek-s-tipami-date-i-decimal-v-clickhouse-cpp} + +### 11.5. Поддержка TLS в clickhouse-cpp {#podderzhka-tls-v-clickhouse-cpp} + +А знаете ли вы, что библиотеку clickhouse-cpp разрабатывал один хороший человек в свободное время? + +### 11.6. Интеграционные тесты clickhouse-cpp {#integratsionnye-testy-clickhouse-cpp} + +### 11.7. Интерактивный режим работы программы clickhouse-local {#interaktivnyi-rezhim-raboty-programmy-clickhouse-local} + +### 11.8. Поддержка протокола PostgreSQL {#podderzhka-protokola-postgresql} + +Элбакян Мовсес Андраникович, ВШЭ. + +В ClickHouse в прошлом году добавили поддержку wire-протокола MySQL. PostgreSQL, так же как MySQL, использует несложный протокол общения между клиентом и сервером, но свой собственный. Поддержка этого протокола является востребованной и откроет новые возможности для ClickHouse. + +Задача в процессе разработки. + +### 11.9. + Доработки ODBC драйвера {#dorabotki-odbc-draivera} + +Денис Глазачев, Altinity. Хороший прогресс по этой задаче. + +### 11.10. Преднастроенные HTTP handlers для запросов {#prednastroennye-http-handlers-dlia-zaprosov} + +zhang2014, есть pull request. + +Возможность описать в конфигурационном файле handler (путь в URL) для HTTP запросов к серверу, которому соответствует некоторый параметризованный запрос. Пользователь может вызвать этот обработчик и не должен передавать SQL запрос. + +## 12. Управление пользователями и доступом {#upravlenie-polzovateliami-i-dostupom} + +### 12.1. + Role Based Access Control {#role-based-access-control} + +[Виталий Баранов](https://github.com/vitlibar). Финальная стадия разработки, рабочая версия в начале апреля 2019. +Q2. Сейчас сделаны все интерфейсы в коде и запросы, но не сделаны варианты хранения прав кроме прототипа. +Upd. Сделано хранение прав. До готового к использованию состояния осталось несколько доработок. + +### 12.2. + Управление пользователями и правами доступа с помощью SQL запросов {#upravlenie-polzovateliami-i-pravami-dostupa-s-pomoshchiu-sql-zaprosov} + +[Виталий Баранов](https://github.com/vitlibar). Финальная стадия разработки, рабочая версия в декабре 2019. +Q1. Сделано управление правами полностью, но не реализовано их хранение, см. 12.1. + +### 12.3. Подключение справочника пользователей и прав доступа из LDAP {#podkliuchenie-spravochnika-polzovatelei-i-prav-dostupa-iz-ldap} + +[Виталий Баранов](https://github.com/vitlibar). Требует 12.1. +Q2. + +### 12.4. Подключение IDM системы Яндекса как справочника пользователей и прав доступа {#podkliuchenie-idm-sistemy-iandeksa-kak-spravochnika-polzovatelei-i-prav-dostupa} + +Пока низкий приоритет. Нужно для Метрики. Требует 12.3. + +### 12.5. Pluggable аутентификация с помощью Kerberos (возможно, подключение GSASL) {#pluggable-autentifikatsiia-s-pomoshchiu-kerberos-vozmozhno-podkliuchenie-gsasl} + +[Виталий Баранов](https://github.com/vitlibar). Требует 12.1. + +### 12.6. Информация о пользователях и квотах в системной таблице {#informatsiia-o-polzovateliakh-i-kvotakh-v-sistemnoi-tablitse} + +[Виталий Баранов](https://github.com/vitlibar). Требует 12.1. +Есть pull request. Q2. + +## 13. Разделение ресурсов, multi-tenancy {#razdelenie-resursov-multi-tenancy} + +### 13.1. Overcommit запросов по памяти и вытеснение {#overcommit-zaprosov-po-pamiati-i-vytesnenie} + +Требует 2.1. Способ реализации обсуждается. + +### 13.2. Общий конвейер выполнения на сервер {#obshchii-konveier-vypolneniia-na-server} + +Требует 2.1. [Николай Кочетов](https://github.com/KochetovNicolai). + +### 13.3. Пулы ресурсов {#puly-resursov} + +Требует 13.2 или сможем сделать более неудобную реализацию раньше. +Обсуждается вариант неудобной реализации. Пока средний приоритет, целимся на Q1/Q2. +Вариант реализации выбрал Александр Казаков. +Upd. Не уследили, и задачу стали обсуждать менеджеры. + +## 14. Диалект SQL {#dialekt-sql} + +### 14.1. Исправление семантики CAST для Nullable {#ispravlenie-semantiki-cast-dlia-nullable} + +Нужно для DataLens. А также для внедрения в BI инструмент Looker. +Павел Потёмкин, ВШЭ. + +### 14.2. Поддержка WITH для подзапросов {#podderzhka-with-dlia-podzaprosov} + +### 14.3. Поддержка подстановок для множеств в правой части IN {#podderzhka-podstanovok-dlia-mnozhestv-v-pravoi-chasti-in} + +### 14.4. Поддержка подстановок для идентификаторов (имён) в SQL запросе {#podderzhka-podstanovok-dlia-identifikatorov-imion-v-sql-zaprose} + +zhang2014 + +### 14.5. + Поддержка задания множества как массива в правой части секции IN {#podderzhka-zadaniia-mnozhestva-kak-massiva-v-pravoi-chasti-sektsii-in} + +Василий Немков, Altinity, делал эту задачу, но забросил её в пользу других задач. +В результате, сейчас доделывает Антон Попов. + +### 14.6. Глобальный scope для WITH {#globalnyi-scope-dlia-with} + +Павел Потёмкин, ВШЭ. + +### 14.7. Nullable для WITH ROLLUP, WITH CUBE, WITH TOTALS {#nullable-dlia-with-rollup-with-cube-with-totals} + +Павел Потёмкин, ВШЭ. + +Простая задача. + +### 14.8. Модификаторы DISTINCT, ORDER BY для агрегатных функций {#modifikatory-distinct-order-by-dlia-agregatnykh-funktsii} + +В ClickHouse поддерживается вычисление COUNT(DISTINCT x). Предлагается добавить возможность использования модификатора DISTINCT для всех агрегатных функций. Например, AVG(DISTINCT x) - вычислить среднее значение для всех различных значений x. Под вопросом вариант, в котором фильтрация уникальных значений выполняется по одному выражению, а агрегация по другому. + +Результат некоторых агрегатных функций зависит от порядка данных. Предлагается реализовать модификатор ORDER BY, задающий порядок явно. Пример: groupArray(x ORDER BY y, z). + +### 14.9. Поддержка запроса EXPLAIN {#podderzhka-zaprosa-explain} + +Требует 2.1. [Николай Кочетов](https://github.com/KochetovNicolai). + +### 14.10. arrayReduce как функция высшего порядка {#arrayreduce-kak-funktsiia-vysshego-poriadka} + +### 14.11. Функции для grouping sets {#funktsii-dlia-grouping-sets} + +### 14.12. Функции обработки временных рядов {#funktsii-obrabotki-vremennykh-riadov} + +Сложная задача, так как вводит новый класс функций и требует его обработку в оптимизаторе запросов. + +В time-series СУБД нужны функции, которые зависят от последовательности значений. Или даже от последовательности значений и их меток времени. Примеры: moving average, exponential smoothing, derivative, Holt-Winters forecast. Вычисление таких функций поддерживается в ClickHouse лишь частично. Так, ClickHouse поддерживает тип данных «массив» и позволяет реализовать эти функции как функции, принимающие массивы. Но гораздо удобнее для пользователя было бы иметь возможность применить такие функции к таблице (промежуточному результату запроса после сортировки). + +Это требует введение нового класса функций (помимо обычных и агрегатных функций) - такие функции будут иметь в коде ClickHouse свой собственный интерфейс, и их вычисление придётся отдельно учитывать в конвейере выполнения запросов. Для примера, вычисление обычных функций тривиально распараллеливается по процессорным ядрам и по серверам; вычисление агрегатных функций распараллеливается с некоторыми особенностями (работа с промежуточными состояниями вычислений, операция merge); а для функций по обработке временных рядов этот вопрос остаётся открытым - возможно, их придётся вычислять на одном сервере и в одном потоке. + +### 14.13. Применимость функций высшего порядка для кортежей и Nested {#primenimost-funktsii-vysshego-poriadka-dlia-kortezhei-i-nested} + +### 14.14. Неявные преобразования типов констант {#neiavnye-preobrazovaniia-tipov-konstant} + +Требует 2.12. + +### 14.15. Неявные преобразования типов под настройкой {#neiavnye-preobrazovaniia-tipov-pod-nastroikoi} + +Требует 2.12. Для внедрения в BI инструмент Looker. + +### 14.16. Синонимы для функций из MySQL {#sinonimy-dlia-funktsii-iz-mysql} + +### 14.17. + Ввести понятие stateful функций {#vvesti-poniatie-stateful-funktsii} + +zhang2014. +Для runningDifference, neighbour - их учёт в оптимизаторе запросов. +В интерфейсе уже сделано. Надо проверить, что учитывается в нужных местах (например, что работает predicate pushdown сквозь ORDER BY, если таких функций нет). + +### 14.18. UNION DISTINCT и возможность включить его по-умолчанию {#union-distinct-i-vozmozhnost-vkliuchit-ego-po-umolchaniiu} + +Павел Потёмкин, ВШЭ. +Для BI систем. + +### 14.19. Совместимость парсера типов данных с SQL {#sovmestimost-parsera-tipov-dannykh-s-sql} + +Павел Потёмкин, ВШЭ. +Для BI систем. + +### 14.20. Позиционные аргументы для GROUP BY и ORDER BY {#pozitsionnye-argumenty-dlia-group-by-i-order-by} + +Павел Потёмкин, ВШЭ. +Тривиально и используется многими системами, но не входит в стандарт SQL. + +### 14.21. Приведение типов для IN (подзапрос) и для JOIN {#privedenie-tipov-dlia-in-podzapros-i-dlia-join} + +Павел Потёмкин, ВШЭ. + +## 15. Улучшение поддержки JOIN {#uluchshenie-podderzhki-join} + +### 15.1. + Доведение merge JOIN до продакшена {#dovedenie-merge-join-do-prodakshena} + +Артём Зуйков. Сейчас merge JOIN включается вручную опцией и всегда замедляет запросы. Хотим, чтобы он замедлял запросы только когда это неизбежно. +Кстати, смысл merge JOIN появляется только совместно с 15.2 и 15.3. +Q1. Сделали адаптивный вариант, но вроде он что-то всё-ещё замедляет. +Задача сделана, но всё работает слишком медленно. + +### 15.1.1. Алгоритм two-level merge JOIN {#algoritm-two-level-merge-join} + +Александр Кузьменков. В очереди. + +### 15.1.2. Тестирование реализации JOIN в Greenplum {#testirovanie-realizatsii-join-v-greenplum} + +В очереди. + +### 15.2. Прокидывание условий в OUTER JOIN {#prokidyvanie-uslovii-v-outer-join} + +Возможно, Артём Зуйков, но задача ещё не продумана до конца. Возможно, требует 2.1. + +### 15.3. Логический вывод для цепочек вида ON t1.x = t2.y WHERE t1.x = 10 {#logicheskii-vyvod-dlia-tsepochek-vida-on-t1-x-t2-y-where-t1-x-10} + +Возможно, Артём Зуйков. Для полноценной работы 15.2. + +### 15.4. Distributed JOIN с помощью перераспределения данных {#distributed-join-s-pomoshchiu-pereraspredeleniia-dannykh} + +Артём Зуйков. + +### 15.5. Использование ключа таблицы для оптимизации merge JOIN {#ispolzovanie-kliucha-tablitsy-dlia-optimizatsii-merge-join} + +### 15.6. + SEMI и ANTI JOIN {#semi-i-anti-join} + +Артём Зуйков. + +## 16. Типы данных и функции {#tipy-dannykh-i-funktsii} + +### 16.1. + DateTime64 {#datetime64} + +Василий Немков, Altinity, декабрь 2019. + +### 16.2. Тип данных для JSON {#tip-dannykh-dlia-json} + +zhang2014 + +Есть PR, в процессе ревью. + +### 16.3. Поддержка неконстантных аргументов с регулярными выражениями в функциях {#podderzhka-nekonstantnykh-argumentov-s-reguliarnymi-vyrazheniiami-v-funktsiiakh} + +Данила Кутенин, но только после секретного изменения в работе. +Upd. Секретного изменения в работе не будет, задачу будет делать другой человек. + +### 16.4. Функция rowNumberForKey {#funktsiia-rownumberforkey} + +### 16.5. Функции для XML и HTML escape {#funktsii-dlia-xml-i-html-escape} + +### 16.6. Функции нормализации и хэширования SQL запросов {#funktsii-normalizatsii-i-kheshirovaniia-sql-zaprosov} + +## 17. Работа с географическими данными {#rabota-s-geograficheskimi-dannymi} + +### 17.1. Гео-словари для определения региона по координатам {#geo-slovari-dlia-opredeleniia-regiona-po-koordinatam} + +[Андрей Чулков](https://github.com/achulkov2), Антон Кваша, Артур Петуховский, ВШЭ. +Будет основано на коде от Арслана Урташева. + +ClickHouse не является geospatial СУБД. Тем не менее, в ClickHouse есть несколько функций для таких задач. Например, функция `pointInPolygon` позволяет быстро проверить попадание точек в полигон на плоскости. При этом, полигон задаётся в явном виде и должен быть константным для вызова функции (то есть - проверяется принадлежность многих точек одному полигону). Эта функциональность нужна, например, для рекламного таргетинга мобильных устройств по координатам. + +Похожая, но более сложная задача, которую ClickHouse пока не умеет решать - определение полигона среди множества полигонов, в которые попадают точки. Для примера: определение района города по географическим координатам. Для решения этой задачи нужно будет реализовать поддержку словарей с полигонами, в которых данные проиндексированы для быстрого поиска. + +Upd. Андрей сделал прототип интерфейса и реализацию-заглушку внутри него. +Upd. Андрей сделал прототип более оптимальной структуры данных. + +### 17.2. GIS типы данных и операции {#gis-tipy-dannykh-i-operatsii} + +Алексей Коряков, Алексей Илюхов, ВШЭ, Яндекс.Карты. + +Реализовать в ClickHouse типы данных для задач обработки геоинформационных данных: Point, Line, MultiLine, Polygon и операции над ними - проверка вхождения, пересечения. Вариантом минимум будет реализация этих операций в евклидовой системе координат. Дополнительно - на сфере и WGS84. + +### 17.3. + Ускорение greatCircleDistance {#uskorenie-greatcircledistance} + +[Ольга Хвостикова](https://github.com/stavrolia), основано на коде Андрея Аксёнова, получено разрешение на использование кода. + +### 17.4. Ускорение geohash с помощью библиотеки из Аркадии {#uskorenie-geohash-s-pomoshchiu-biblioteki-iz-arkadii} + +Предположительно, [Андрей Чулков](https://github.com/achulkov2). Получено одобрение от руководства. + +### 17.5. + Проверки в функции pointInPolygon {#proverki-v-funktsii-pointinpolygon} + +Сейчас функция тихо не работает в случае полигонов с самопересечениями, надо кидать исключение. + +## 18. Машинное обучение и статистика {#mashinnoe-obuchenie-i-statistika} + +### 18.1. Инкрементальная кластеризация данных {#inkrementalnaia-klasterizatsiia-dannykh} + +Александр Кожихов, Максим Кузнецов. Обнаружена фундаментальная проблема в реализации, доделывает предположительно [Николай Кочетов](https://github.com/KochetovNicolai). Он может делегировать задачу кому угодно. + +Исправление фундаментальной проблемы - есть PR. + +### 18.2. Агрегатные функции для статистических тестов {#agregatnye-funktsii-dlia-statisticheskikh-testov} + +Артём Цыганов, Руденский Константин Игоревич, Семёнов Денис, ВШЭ. + +Предлагается реализовать в ClickHouse статистические тесты (Analysis of Variance, тесты нормальности распределения и т. п.) в виде агрегатных функций. Пример: `welchTTest(value, sample_idx)`. + +Сделали прототип одного теста, есть pull request. + +### 18.3. Инфраструктура для тренировки моделей в ClickHouse {#infrastruktura-dlia-trenirovki-modelei-v-clickhouse} + +В очереди. + +## 19. Улучшение работы кластера {#uluchshenie-raboty-klastera} + +### 19.1. Параллельные кворумные вставки без линеаризуемости {#parallelnye-kvorumnye-vstavki-bez-linearizuemosti} + +Александра Латышева, ВШЭ и Яндекс. + +Репликация данных в ClickHouse по-умолчанию является асинхронной без выделенного мастера. Это значит, что клиент, осуществляющий вставку данных, получает успешный ответ после того, как данные попали на один сервер; репликация данных по остальным серверам осуществляется в другой момент времени. Это ненадёжно, потому что допускает потерю только что вставленных данных при потере лишь одного сервера. + +Для решения этой проблемы, в ClickHouse есть возможность включить «кворумную» вставку. Это значит, что клиент, осуществляющий вставку данных, получает успешный ответ после того, как данные попали на несколько (кворум) серверов. Обеспечивается линеаризуемость: клиент, получает успешный ответ после того, как данные попали на несколько реплик, *которые содержат все предыдущие данные, вставленные с кворумом* (такие реплики можно называть «синхронными»), и при запросе SELECT можно выставить настройку, разрешающую только чтение с синхронных реплик. + +Если бы свойства линеаризуемости не было, то для трёх серверов A, B, C, значения кворума = 2, и для трёх вставок данных 1, 2, 3, возможна ситуация, что первая вставка прошла на серверы A и B, вторая прошла на серверы B и C, а третья - на серверы A и C, и теперь ни один из серверов не содержит полный набор данных 1, 2, 3. + +Как ни странно, такое свойство не нужно большинству пользователей. Оно запрещает параллельно выполняющиеся вставки. А пользователи хотят вставлять данные надёжно (на более чем одну реплику), но не важно, в каком порядке. Предлагается сделать опцию, которая отключает линеаризуемость. + +Иногда пользователь хочет реализовать кворумную вставку вручную: просто соединиться с несколькими репликами и вставть на них одинаковые данные (чтобы обеспечить надёжную вставку, не ориентируясь на то, как работает механизм репликации). Сейчас ожидания пользователя не оправдываются. В ClickHouse есть механизм дедупликации для обеспечения идемпотентности вставок. Вторая вставка с такими же данными (пусть даже на другую реплику) будет проигнорирована. Надо сделать так, чтобы вместо этого, вставка одинаковых данных на другую реплику, имела такой же эффект, как если бы эти данные были получены с помощью механизма репликации. + +### 19.2. Подключение Etcd или Consul как альтернативы ZooKeeper {#podkliuchenie-etcd-ili-consul-kak-alternativy-zookeeper} + +Алексей Лёвушкин, ВШЭ и Яндекс. + +Для координации реплик в ClickHouse используется ZooKeeper. Многие пользователи ClickHouse хотели бы иметь возможность использовать для координации некоторые другие системы вместо ZooKeeper. Рассматриваемыми вариантами таких систем являются Etcd, Consul, FoundationDB. Это весьма проблематично, так как эти системы существенно отличаются по интерфейсам и возможностям. Тем не менее, для того, чтобы эта задача стала возможной, в ClickHouse обобщён интерфейс взаимодействия с ZooKeeper, и теперь на его место можно подставлять другие реализации. + +В прошлом году, Алексей добавил модельную реализацию (mock) интерфейса ZooKeeper для тестирования. Сейчас предлагается сделать реализацию поверх Etcd, а также расширить возможности тестовой реализации. + +Upd. Алексей сделал какой-то вариант, но борется с тем, что ничего не работает. +Upd. Есть pull request на начальной стадии. + +### 19.3. Подключение YT Cypress или YDB как альтернативы ZooKeeper {#podkliuchenie-yt-cypress-ili-ydb-kak-alternativy-zookeeper} + +Hold. Полезно для заказчиков внутри Яндекса, но есть риски. Эту задачу никто не будет делать. + +### 19.4. internal\_replication = ‘auto’ {#internal-replication-auto} + +### 19.5. Реплицируемые базы данных {#replitsiruemye-bazy-dannykh} + +В очереди, возможно Валерий Батурин, ВШЭ. + +Репликация в ClickHouse работает на уровне отдельных таблиц. Это является очень гибким решением: на одном сервере одна из таблиц может быть не реплицирована, другая иметь двухкратную репликацию, а третья - реплицирована по всем серверам. Но если все таблицы в базе данных реплицированы одинаковым образом. то это затрудняет управление кластером. Например, при восстановлени сервера, требуется отдельно создавать реплику для каждой таблицы. + +Предлагается реализовать «движок баз данных», который осуществляет репликацию метаданных (множество имеющихся таблиц и лог DDL операций над ними: CREATE, DROP, RENAME, ALTER). Пользователь сможет создать реплицируемую базу данных; при её создании или восстановлении на другом сервере, все реплицируемые таблицы будут созданы автоматически. + +### 19.6. Одновременный выбор кусков для слияния многими репликами, отказ от leader election в ZK {#odnovremennyi-vybor-kuskov-dlia-sliianiia-mnogimi-replikami-otkaz-ot-leader-election-v-zk} + +Обсуждается. Возможно, будет делать Александр Сапин. + +### 19.7. Возможность записи данных при недоступности ZK и отказ от линейного порядка кусков в большинстве случаев {#vozmozhnost-zapisi-dannykh-pri-nedostupnosti-zk-i-otkaz-ot-lineinogo-poriadka-kuskov-v-bolshinstve-sluchaev} + +### 19.8. Отказ от хранения в ZK множества кусков для каждой реплики отдельно {#otkaz-ot-khraneniia-v-zk-mnozhestva-kuskov-dlia-kazhdoi-repliki-otdelno} + +### 19.9. Отказ от хранения в ZK лога вставок и мержей. Обмен данными о кусках напрямую {#otkaz-ot-khraneniia-v-zk-loga-vstavok-i-merzhei-obmen-dannymi-o-kuskakh-napriamuiu} + +Три задачи выше обсуждаются, есть варианты. + +### 19.10. Облачные таблицы {#oblachnye-tablitsy} + +Требует 1.6, 19.1, 19.6, 19.7, 19.8, 19.9. + +## 20. Мутации данных {#mutatsii-dannykh} + +Пока все задачи по точечным UPDATE/DELETE имеют низкий приоритет, но ожидаем взять в работу в середине 2020. + +### 20.1. Поддержка DELETE путём запоминания множества затронутых кусков и ключей {#podderzhka-delete-putiom-zapominaniia-mnozhestva-zatronutykh-kuskov-i-kliuchei} + +### 20.2. Поддержка DELETE путём преобразования множества ключей в множество row\_numbers на реплике, столбца флагов и индекса по диапазонам {#podderzhka-delete-putiom-preobrazovaniia-mnozhestva-kliuchei-v-mnozhestvo-row-numbers-na-replike-stolbtsa-flagov-i-indeksa-po-diapazonam} + +### 20.3. Поддержка ленивых DELETE путём запоминания выражений и преобразования к множеству ключей в фоне {#podderzhka-lenivykh-delete-putiom-zapominaniia-vyrazhenii-i-preobrazovaniia-k-mnozhestvu-kliuchei-v-fone} + +### 20.4. Поддержка UPDATE с помощью преобразования в DELETE и вставок {#podderzhka-update-s-pomoshchiu-preobrazovaniia-v-delete-i-vstavok} + +## 21. Оптимизации производительности {#optimizatsii-proizvoditelnosti} + +### 21.1. + Параллельный парсинг форматов {#parallelnyi-parsing-formatov} + +Начинал Олег Ершов, доделывает Никита Михайлов, помогает [Александр Кузьменков](https://github.com/akuzm). Готово. + +### 21.1.1. Избавление от лишнего копирования при параллельном парсинге форматов, если возможен mmap файла целиком {#izbavlenie-ot-lishnego-kopirovaniia-pri-parallelnom-parsinge-formatov-esli-vozmozhen-mmap-faila-tselikom} + +### 21.2. Параллельное форматирование форматов {#parallelnoe-formatirovanie-formatov} + +После 21.1, предположительно Никита Михайлов. Задача сильно проще чем 21.1. + +### 21.3. + Исправление низкой производительности анализа индекса в случае большого множества в секции IN {#ispravlenie-nizkoi-proizvoditelnosti-analiza-indeksa-v-sluchae-bolshogo-mnozhestva-v-sektsii-in} + +Нужно всем (Zen, БК, DataLens, TestEnv…). Антон Попов, Q1/Q2. + +Upd. Антон делает эту задачу. Большая часть уже реализована. + +### 21.4. Использование ORDER BY ключа для оптимизации GROUP BY и DISTINCT {#ispolzovanie-order-by-kliucha-dlia-optimizatsii-group-by-i-distinct} + +Дмитрий Рубашкин, ВШЭ. Помогает Антон Попов. + +Если таблица имеет ключ сортировки, то возможно эффективное чтение упорядоченных данных. Если запрос содержит операцию GROUP BY, содержащую по крайней мере префикс от ключа сортировки таблицы, либо инъективные функции от него, то возможно более эффективное выполнение GROUP BY: промежуточный результат агрегации финализируется и отправляется клиенту как только в потоке данных при чтении из таблицы встретился следующий ключ. + +Аналогичную оптимизацию следует реализовать для DISTINCT и LIMIT BY. + +В прошлом году, аналогичное решение сделали для операции ORDER BY. + +### 21.5. + Распараллеливание INSERT при INSERT SELECT, если это необходимо {#rasparallelivanie-insert-pri-insert-select-esli-eto-neobkhodimo} + +[Vxider](https://github.com/Vxider), ICT +Есть pull request. + +### 21.6. Уменьшение числа потоков для SELECT в случае тривиального INSERT SELECT {#umenshenie-chisla-potokov-dlia-select-v-sluchae-trivialnogo-insert-select} + +### 21.7. Кэш результатов запросов {#kesh-rezultatov-zaprosov} + +[Achimbab](https://github.com/achimbab). +Есть pull request. Но это не совсем то. + +### 21.8. Взаимная интеграция аллокатора и кэша {#vzaimnaia-integratsiia-allokatora-i-kesha} + +Михаил Кот, ВШЭ. Задача сложная и рискованная. + +Для выделения памяти, аллокаторы запрашивают её у операционной системы (`mmap`). Это возможно только для достаточно крупных кусков памяти является довольно медленной операцией. Поэтому, современные аллокаторы кэшируют крупные куски памяти в программе. При вызове free, кусок памяти, как правило, не отдаётся ОС, а остаётся для последующего переиспользования. Для выделения мелких кусков памяти, крупные куски разбиваются с помощью специальных структур данных (free-list, heap, bitmap). Для уменьшения contention в многопоточных программах, эти структуры также делаются thread-локальными. + +Часто в программе есть кэши некоторых данных. Например - кэш данных после разжатия, использующийся чтобы сэкономить на повторных запросах одних и тех же данных. При вытеснении из кэша, блок данных освобождается (`free`) и данные, бывшие в кэше, становятся недоступными для переиспользования. Но если принимать во внимание то, как работает аллокатор памяти, то оказывается, что после освобождения памяти, данные всё ещё остаются доступными в программе. И если этот кусок памяти не будет выделен аллокатором снова, его можно было бы продолжить использовать в качестве кэша. Иными словами, в программе есть domain-specific кэш, а аллокатор имеет свой кэш, и они не знают друг о друге. + +Для domain-specific кэшей (как например, кэш разжатых данных) выгодно, чтобы они использовали как можно больший объём свободной памяти. Но в этом случае, памяти может не хватить для других структур данных в программе. Если аллокатор памяти знает про кэш, то выделение памяти можно было бы делать путём вытеснения данных из кэша. + +### 21.8.1. Отдельный аллокатор для кэшей с ASLR {#otdelnyi-allokator-dlia-keshei-s-aslr} + +В прошлом году задачу пытался сделать Данила Кутенин с помощью lfalloc из Аркадии и mimalloc из Microsoft, но оба решения не были квалифицированы для использования в продакшене. Успешная реализация задачи 21.8 отменит необходимость в этой задаче, поэтому холд. + +### 21.9. Исправить push-down выражений с помощью Processors {#ispravit-push-down-vyrazhenii-s-pomoshchiu-processors} + +[Николай Кочетов](https://github.com/KochetovNicolai). Требует 2.1. + +### 21.10. + Улучшение эвристики PREWHERE {#uluchshenie-evristiki-prewhere} + +Amos Bird. + +### 21.11. Peephole оптимизации запросов {#peephole-optimizatsii-zaprosov} + +Руслан Камалов, Михаил Малафеев, Виктор Гришанин, ВШЭ + +Реализовать в ClickHouse оптимизации запросов, основанные на упрощении отдельных небольших кусков выражений (так называемые «peephole» оптимизации). Примеры: +- Замена цепочек if на multiIf. +- Удаление min/max/any-агрегатов от выражений от ключей GROUP BY. +- Вынесение арифметических операций из агрегатных функций; +- Вынесение любых функций наружу any, anyLast. +- При GROUP BY по transform или if по строкам, замена строк на Enum. + +Сделана замена цепочек if на multiIf, но внезапно оказалось, что это является не оптимизацией, а наоборот. + +### 21.12. Алгебраические оптимизации запросов {#algebraicheskie-optimizatsii-zaprosov} + +Руслан Камалов, Михаил Малафеев, Виктор Гришанин, ВШЭ + +Реализовать в ClickHouse оптимизации запросов, основанные на алгебраических свойствах функций. Примеры: +- Обращение инъективных функций в сравнениях на равенство. +- Вынесение инъективных функцию наружу uniq. +- Удаление монотонных функций из ORDER BY. +- Удаление избыточных выражений из ORDER BY. +- Удаление из GROUP BY функций от других ключей GROUP BY. +- Удаление дублирующихся DISTINCT, ORDER BY из подзапросов. + +Несколько оптимизаций есть в PR. + +### 21.13. Fusion агрегатных функций {#fusion-agregatnykh-funktsii} + +После или совместно с 21.11. + +### 21.14. Оптимизация запросов с помощью constraints {#optimizatsiia-zaprosov-s-pomoshchiu-constraints} + +Constraints позволяют задать выражение, истинность которого проверяется при вставке данных в таблицу. Предположение о том, что выражение истинно, может использоваться и для оптимизации запросов. Например, встретив в запросе точно такое же выражение, можно заменить его на константу 1. + +Если выражение содержит равенство, то встретив в запросе одну из частей равенства, её можно заменить на другую часть равенства, если это сделает проще чтение данных или вычисление выражения. Например, задан constraint: `URLDomain = domain(URL)`. Значит, выражение `domain(URL)` можно заменить на `URLDomain`. + +### 21.15. Многоступенчатое чтение данных вместо PREWHERE {#mnogostupenchatoe-chtenie-dannykh-vmesto-prewhere} + +Требует 2.1 и 21.10. + +### 21.16. Оптимизация GROUP BY с большим количеством агрегатных функций путём вычисления в два прохода {#optimizatsiia-group-by-s-bolshim-kolichestvom-agregatnykh-funktsii-putiom-vychisleniia-v-dva-prokhoda} + +Нужно для БК. + +### 21.17. Оптимизация GROUP BY при наличии ORDER BY по тем же ключам с LIMIT {#optimizatsiia-group-by-pri-nalichii-order-by-po-tem-zhe-kliucham-s-limit} + +Нужно для БК. + +### 21.18. Внутренняя параллелизация мержа больших состояний агрегатных функций {#vnutrenniaia-parallelizatsiia-merzha-bolshikh-sostoianii-agregatnykh-funktsii} + +### 21.19. Оптимизация сортировки {#optimizatsiia-sortirovki} + +Василий Морозов, Арслан Гумеров, Альберт Кидрачев, ВШЭ. +В прошлом году задачу начинал делать другой человек, но не добился достаточного прогресса. + +1. Оптимизация top sort. + +В ClickHouse используется неоптимальный вариант top sort. Суть его в том, что из каждого блока достаётся top N записей, а затем, все блоки мержатся. Но доставание top N записей у каждого следующего блока бессмысленно, если мы знаем, что из них в глобальный top N войдёт меньше. Конечно нужно реализовать вариацию на тему priority queue (heap) с быстрым пропуском целых блоков, если ни одна строка не попадёт в накопленный top. + +1. Рекурсивный вариант сортировки по кортежам. + +Для сортировки по кортежам используется обычная сортировка с компаратором, который в цикле по элементам кортежа делает виртуальные вызовы `IColumn::compareAt`. Это неоптимально - как из-за короткого цикла по неизвестному в compile-time количеству элементов, так и из-за виртуальных вызовов. Чтобы обойтись без виртуальных вызовов, есть метод `IColumn::getPermutation`. Он используется в случае сортировки по одному столбцу. Есть вариант, что в случае сортировки по кортежу, что-то похожее тоже можно применить… например, сделать метод `updatePermutation`, принимающий аргументы offset и limit, и допереставляющий перестановку в диапазоне значений, в которых предыдущий столбец имел равные значения. + +1. RadixSort для сортировки. + +Один наш знакомый начал делать задачу по попытке использования RadixSort для сортировки столбцов. Был сделан вариант indirect сортировки (для `getPermutation`), но не оптимизирован до конца - есть лишние ненужные перекладывания элементов. Для того, чтобы его оптимизировать, придётся добавить немного шаблонной магии (на последнем шаге что-то не копировать, вместо перекладывания индексов - складывать их в готовое место). Также этот человек добавил метод MSD Radix Sort для реализации radix partial sort. Но даже не проверил производительность. + +Наиболее содержательная часть задачи может состоять в применении Radix Sort для сортировки кортежей, расположенных в оперативке в виде Structure Of Arrays неизвестного в compile-time размера. Это может работать хуже, чем то, что описано в пункте 2… Но попробовать не помешает. + +1. Three-way comparison sort. + +Виртуальный метод `compareAt` возвращает -1, 0, 1. Но алгоритмы сортировки сравнениями обычно рассчитаны на `operator<` и не могут получить преимущества от three-way comparison. А можно ли написать так, чтобы преимущество было? + +1. pdq partial sort + +Хороший алгоритм сортировки сравнениями `pdqsort` не имеет варианта partial sort. Заметим, что на практике, почти все сортировки в запросах ClickHouse являются partial\_sort, так как `ORDER BY` почти всегда идёт с `LIMIT`. Кстати, Данила Кутенин уже попробовал это и показал, что в тривиальном случае преимущества нет. Но не очевидно, что нельзя сделать лучше. + +### 21.20. Использование материализованных представлений для оптимизации запросов {#ispolzovanie-materializovannykh-predstavlenii-dlia-optimizatsii-zaprosov} + +В ByteDance есть готовая реализация, но они её боятся из-за, возможно, низкого качества кода. + +### 21.21. + Чтение больших файлов с помощью mmap {#chtenie-bolshikh-failov-s-pomoshchiu-mmap} + +Сделан вариант, но достаточно топорный. Без тестирования в продакшене включать по-умолчанию нельзя. + +### 21.22. Userspace page cache {#userspace-page-cache} + +Требует 21.8. + +### 21.23. Ускорение работы с вторичными индексами {#uskorenie-raboty-s-vtorichnymi-indeksami} + +zhang2014. +Есть pull request. + +## 22. Долги и недоделанные возможности {#dolgi-i-nedodelannye-vozmozhnosti} + +### 22.1. + Исправление неработающих таймаутов, если используется TLS {#ispravlenie-nerabotaiushchikh-taimautov-esli-ispolzuetsia-tls} + +Нужно для Яндекс.Облака. Сделал Алексей Миловидов. + +### 22.2. + Убрать возможность изменить настройки в native протоколе в случае readonly {#ubrat-vozmozhnost-izmenit-nastroiki-v-native-protokole-v-sluchae-readonly} + +N.Vartolomei. + +### 22.3. Защита от абсурдно заданных пользователем кодеков {#zashchita-ot-absurdno-zadannykh-polzovatelem-kodekov} + +### 22.4. + Исправление оставшихся deadlocks в табличных RWLock-ах {#ispravlenie-ostavshikhsia-deadlocks-v-tablichnykh-rwlock-akh} + +Александр Казаков. Нужно для Яндекс.Метрики и Datalens. Задача постепенно тащится и исправлениями в соседних местах стала менее актуальна. +В Q1 будет сделана или отменена с учётом 1.2. и 1.3. +Upd. Добавили таймауты. + +### 22.5. + Исправление редких срабатываний TSan в stress тестах в CI {#ispravlenie-redkikh-srabatyvanii-tsan-v-stress-testakh-v-ci} + +Александр Казаков сделал эту задачу. + +### 22.6. + Изменение только DEFAULT в ALTER TABLE может поменять тип столбца {#izmenenie-tolko-default-v-alter-table-mozhet-pomeniat-tip-stolbtsa} + +Александр Сапин сделал эту задачу. + +### 22.7. + Row-Level Security не работает в случае наличия в запросе IN подзапросов {#row-level-security-ne-rabotaet-v-sluchae-nalichiia-v-zaprose-in-podzaprosov} + +Нужно для Метрики. Иван Лежанкин. + +### 22.8. + Исправить десериализацию параметров для параметризованных запросов {#ispravit-deserializatsiiu-parametrov-dlia-parametrizovannykh-zaprosov} + +Хотел исправить Василий Немков, Altinity, но есть маленькие затруднения, наверное переделает Алексей Миловидов. + +### 22.9. Разобраться с десериализацией массивов со значениями по-умолчанию в Protobuf формате в случае protobuf 3 {#razobratsia-s-deserializatsiei-massivov-so-znacheniiami-po-umolchaniiu-v-protobuf-formate-v-sluchae-protobuf-3} + +[Виталий Баранов](https://github.com/vitlibar). Возможно, это - фундаментальная проблема и следует её только документировать. +Кажется, отменяем, но пока ещё не всё ясно. + +### 22.10. + Исправление дрифта при отслеживании потребления памяти запросами {#ispravlenie-drifta-pri-otslezhivanii-potrebleniia-pamiati-zaprosami} + +Требует 6.3., но можно улучшить отдельными хаками. Нужно Метрике и БК. + +### 22.11. + Более простая ser/de настроек запросов {#bolee-prostaia-serde-nastroek-zaprosov} + +И пропуск неизвестных настроек. Важно для Метрики для упрощения апгрейда без изменения конфига. +[Виталий Баранов](https://github.com/vitlibar), готово. + +### 22.12. + Исправление низкой производительности чтения из Kafka {#ispravlenie-nizkoi-proizvoditelnosti-chteniia-iz-kafka} + +Для ClickHouse нехарактерно наличие кода, обладающего столь низкой производительностью. Практики разработки не подразумевают, что такой код должен попасть в продакшен без надлежащего тестирования производительности. + +Изначально было назначено на [Ивана Лежанкина](https://github.com/abyss7), но по неизвестной причине было не сделано в течение нескольких месяцев. +Сделал Михаил Филимонов, Altinity. + +### 22.13. + Посмотреть, почему не работают некоторые collations {#posmotret-pochemu-ne-rabotaiut-nekotorye-collations} + +Изначально было назначено на [Ивана Лежанкина](https://github.com/abyss7), но в результате сделал Александр Сапин. + +### 22.14. + Посмотреть, почему не работает StorageSet для MergeTree таблиц при некоторых условиях {#posmotret-pochemu-ne-rabotaet-storageset-dlia-mergetree-tablits-pri-nekotorykh-usloviiakh} + +Вроде бы сделал Никита Михайлов - проверить существующие issues на эту тему. + +### 22.15. Нормализация коммитов в Kafka и идемпотентности операций {#normalizatsiia-kommitov-v-kafka-i-idempotentnosti-operatsii} + +Altinity. + +### 22.16. + Исправление низкой производительности кодека DoubleDelta {#ispravlenie-nizkoi-proizvoditelnosti-kodeka-doubledelta} + +Василий Немков, Altinity - в процессе. +Можно считать, что сделано, хотя отсутствие SIMD оптимизаций для variable length кодеков - это ужасно. + +### 22.17. Консистентно работающий POPULATE для MaterializedView {#konsistentno-rabotaiushchii-populate-dlia-materializedview} + +### 22.18. Исправление заметного падения производительности форматов после добавления доменов типов {#ispravlenie-zametnogo-padeniia-proizvoditelnosti-formatov-posle-dobavleniia-domenov-tipov} + +Василий Немков, Altinity. + +### 22.19. + Одновременное использование SAMPLE и PREWHERE {#odnovremennoe-ispolzovanie-sample-i-prewhere} + +Нужно для Метрики. [Николай Кочетов](https://github.com/KochetovNicolai), ноябрь 2019. + +### 22.20. + Неправильная работа PREWHERE при некоторых условиях {#nepravilnaia-rabota-prewhere-pri-nekotorykh-usloviiakh} + +[Николай Кочетов](https://github.com/KochetovNicolai), декабрь 2019. + +### 22.21. + Неправильное поведение DateTime в районе начала unix epoch {#nepravilnoe-povedenie-datetime-v-raione-nachala-unix-epoch} + +Алексей Миловидов. + +### 22.22. Nullable в функции transform и в CASE по множеству значений {#nullable-v-funktsii-transform-i-v-case-po-mnozhestvu-znachenii} + +После 10.14. + +[\#7237](https://github.com/ClickHouse/ClickHouse/issues/7237) +[\#2655](https://github.com/ClickHouse/ClickHouse/issues/2655) + +### 22.23. Правильная обработка Nullable в функциях, которые кидают исключение на default значении: modulo, intDiv {#pravilnaia-obrabotka-nullable-v-funktsiiakh-kotorye-kidaiut-iskliuchenie-na-default-znachenii-modulo-intdiv} + +### 22.24. Излишняя фильтрация ODBC connection string {#izlishniaia-filtratsiia-odbc-connection-string} + +Нужно для Метрики. Алексей Миловидов. + +### 22.25. Избавиться от библиотеки btrie {#izbavitsia-ot-biblioteki-btrie} + +Алексей Миловидов. Низкий приоритет. + +### 22.26. Плохая производительность quantileTDigest {#plokhaia-proizvoditelnost-quantiletdigest} + +[\#2668](https://github.com/ClickHouse/ClickHouse/issues/2668) + +Алексей Миловидов или будет переназначено. + +### 22.27. Проверить несколько PR, которые были закрыты zhang2014 и sundy-li {#proverit-neskolko-pr-kotorye-byli-zakryty-zhang2014-i-sundy-li} + +Алексей Миловидов. + +### 22.28. Изучить и исправить поведение работы с Kafka при ребалансировке {#izuchit-i-ispravit-povedenie-raboty-s-kafka-pri-rebalansirovke} + +Altinity. + +### 22.29. + Уязвимость DDL для словарей executable {#uiazvimost-ddl-dlia-slovarei-executable} + +[Александр Сапин](https://github.com/alesapin) + +## 23. Default Festival {#default-festival} + +### 23.1. + Включение minimalistic\_part\_header в ZooKeeper {#vkliuchenie-minimalistic-part-header-v-zookeeper} + +Сильно уменьшает объём данных в ZooKeeper. Уже год в продакшене в Яндекс.Метрике. +Алексей Миловидов, ноябрь 2019. + +### 23.2. Включение distributed\_aggregation\_memory\_efficient {#vkliuchenie-distributed-aggregation-memory-efficient} + +Есть риски меньшей производительности лёгких запросов, хотя производительность тяжёлых запросов всегда увеличивается. + +### 23.3. Включение min\_bytes\_to\_external\_sort и min\_bytes\_to\_external\_group\_by {#vkliuchenie-min-bytes-to-external-sort-i-min-bytes-to-external-group-by} + +Желательно 5.2. и 13.1. + +### 23.4. Включение синхронной записи в Distributed таблицы по-умолчанию {#vkliuchenie-sinkhronnoi-zapisi-v-distributed-tablitsy-po-umolchaniiu} + +Есть гипотеза, что плохо работает на очень больших кластерах. + +### 23.5. Включение compile\_expressions {#vkliuchenie-compile-expressions} + +Требует 7.2. Задачу изначально на 99% сделал Денис Скоробогатов, ВШЭ и Яндекс. Остальной процент доделывал Алексей Миловидов, а затем [Александр Сапин](https://github.com/alesapin). + +### 23.6. Включение учёта порядка столбцов в CSV {#vkliuchenie-uchiota-poriadka-stolbtsov-v-csv} + +Просто аккуратно включить. + +### 23.7. Включение NULL as Default в CSV {#vkliuchenie-null-as-default-v-csv} + +Просто аккуратно включить. + +### 23.8. + Включение оптимизации VALUES {#vkliuchenie-optimizatsii-values} + +Просто аккуратно включить. + +### 23.9. + Включение Processors {#vkliuchenie-processors} + +Q1. [Николай Кочетов](https://github.com/KochetovNicolai). + +### 23.10. Включение mlock бинарника {#vkliuchenie-mlock-binarnika} + +Возможность mlock бинарника сделал Олег Алексеенков [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) +. Поможет, когда на серверах кроме ClickHouse работает много посторонних программ (мы иногда называем их в шутку «треш-программами»). + +## 24. Экспериментальные задачи {#eksperimentalnye-zadachi} + +### 24.1. Веб-интерфейс для просмотра состояния кластера и профилирования запросов {#veb-interfeis-dlia-prosmotra-sostoianiia-klastera-i-profilirovaniia-zaprosov} + +Антон Мамонов, УрФУ, Яндекс. + +Внутри ClickHouse есть богатые возможности по интроспекции и профилированию. Эти возможности доступны через системные таблицы и использовать их приходится путём формулирования SQL запросов. Это неудобно. + +Вместо этого предлагается сделать, чтобы ClickHouse отдавал HTML страницу, реализующую интерактивный web-интерфейс со следующими возможностями: +- отображение состояния кластеров (какие кластеры известны, статус каждого сервера); +- графики нагрузки текущего сервера или выбранного сервера кластера; +- обновляемый список запросов; +- просмотр лога запросов с наиболее востребованными фильтрациями по одной кнопке; +- просмотр лога на кластере, например - последние ошибки; +- просмотр метрик использования ресурсов, flame graph и pprof-граф для выбранных запросов; +- отчёт по использованию кластера (пример: количество ядер CPU по пользователям за сегодня). + +### 24.2. Экспериментальные алгоритмы сжатия {#eksperimentalnye-algoritmy-szhatiia} + +ClickHouse поддерживает LZ4 и ZSTD для сжатия данных. Эти алгоритмы являются парето-оптимальными по соотношению скорости и коэффициентам сжатия среди достаточно известных. Тем не менее, существуют менее известные алгоритмы сжатия, которые могут превзойти их по какому-либо критерию. Из потенциально более быстрых по сравнимом коэффициенте сжатия: Lizard, LZSSE, density. Из более сильных: bsc и csc. Необходимо изучить эти алгоритмы, добавить их поддержку в ClickHouse и исследовать их работу на тестовых датасетах. + +### 24.3. Экспериментальные кодеки {#eksperimentalnye-kodeki} + +Вероника Фалчикова, Лада Торчик, ВШЭ. + +Существуют специализированные алгоритмы кодирования числовых последовательностей: Group VarInt, MaskedVByte, PFOR. Необходимо изучить наиболее эффективные реализации этих алгоритмов. Примеры вы сможете найти на https://github.com/lemire и https://github.com/powturbo/ а также https://github.com/schizofreny/middle-out + +Внедрить их в ClickHouse в виде кодеков и изучить их работу на тестовых датасетах. + +### 24.4. Шифрование в ClickHouse на уровне VFS {#shifrovanie-v-clickhouse-na-urovne-vfs} + +Данные в ClickHouse хранятся без шифрования. При наличии доступа к дискам, злоумышленник может прочитать данные. Предлагается реализовать два подхода к шифрованию: + +1. Шифрование на уровне VFS. + +Обсуждаются детали реализации. Q3/Q4. + +### 24.5. Поддержка функций шифрования для отдельных значений {#podderzhka-funktsii-shifrovaniia-dlia-otdelnykh-znachenii} + +Смотрите также 24.5. + +1. Шифрование отдельных значений. + Для этого требуется реализовать функции шифрования и расшифрования, доступные из SQL. Для шифрования реализовать возможность добавления нужного количества случайных бит для исключения одинаковых зашифрованных значений на одинаковых данных. Это позволит реализовать возможность «забывания» данных без удаления строк таблицы: можно шифровать данные разных клиентов разными ключами, и для того, чтобы забыть данные одного клиента, потребуется всего лишь удалить ключ. + +### 24.6. Userspace RAID {#userspace-raid} + +Глеб Новиков, ВШЭ. + +RAID позволяет одновременно увеличить надёжность хранения данных на дисках и увеличить скорость работы дискового массива. Обычно RAID настраивается с помощью встроенных возможностей ядра Linux (mdraid) или с помощью hardware контроллера. У этого есть следующие ограничения: + +1. Иногда (в облачной инфраструктуре некоторых компаний) сервер предоставляется с отдельными дисками, подмонтированными в виде отдельных разделов (JBOD), без возможности создания RAID. + +2. В ClickHouse для обеспечения избыточности обычно используется репликация между серверами. Но при восстановлении одного из дисков RAID не используются данные с реплик, а в случае отказа одного из дисков в RAID-0, приходится передавать с реплики все данные, а не только данные, соответствующие одному из дисков. Это происходит, потому что RAID не интегрирован в ClickHouse и «не знает» про его особенности. + +3. Отсутствуют продвинутые варианты обеспечения избыточности, как например, LRC. + +Для преодоления этих ограничений, предлагается реализовать в ClickHouse встроенный алгоритм расположения данных на дисках. + +### 24.7. Вероятностные структуры данных для фильтрации по подзапросам {#veroiatnostnye-struktury-dannykh-dlia-filtratsii-po-podzaprosam} + +Рузель Ибрагимов, ВШЭ и Яндекс. + +Частой задачей является выполнение запроса с фильтрацией по множеству, полученному по подзапросу. Пример: найти пользователей, которые заходили на сайт сегодня и заходили неделю назад. Это выражается в виде запроса: `SELECT UserID FROM table WHERE EventDate = today() AND UserID IN (SELECT ...)`. При выполнении этого запроса, сначала выполняется подзапрос в правой части `IN` и формируется хэш-таблица в оперативке; затем эта хэш-таблица используется для фильтрации. + +Иногда объём данных достаточно большой, и хэш-таблица не помещается в оперативку. В этом случае можно рассмотреть в качестве варианта приближённый рассчёт: найти пользователей, которые заходили на сайт сегодня и наверное заходили неделю назад. Для этого можно вместо хэш-таблицы использовать Bloom Filter. Другая задача: найти пользователей, которые встречались, скорее всего, не менее некоторого количества раз. Для этого можно использовать Counting Bloom Filter. Также следует изучить структуры данных Quotient Filter и Cuckoo Filer, а ещё - секретный алгоритм Chaotic Map от Андрея Плахова. + +Предлагается реализовать это в языке запросов ClickHouse с помощью специального синтаксиса, например `x IN BLOOM FILTER (n, m) (SELECT ...)`. + +### 24.8. Специализация векторизованного кода для AVX/AVX2/AVX512 и ARM NEON {#spetsializatsiia-vektorizovannogo-koda-dlia-avxavx2avx512-i-arm-neon} + +[\#1017](https://github.com/ClickHouse/ClickHouse/issues/1017) + +Дмитрий Ковальков, ВШЭ и Яндекс. + +Подавляющее большинство кода ClickHouse написана для x86\_64 с набором инструкций до SSE 4.2 включительно. Лишь отдельные редкие функции поддерживают AVX/AVX2/AVX512 с динамической диспетчеризацией. + +В первой части задачи, следует добавить в ClickHouse реализации некоторых примитивов, оптимизированные под более новый набор инструкций. Например, AVX2 реализацию генератора случайных чисел pcg: https://github.com/lemire/simdpcg + +Во второй части задачи, предлагается адаптировать существующие куски кода, использующие SSE intrinsics на AVX/AVX2 и сравнить производительность. Также рассматривается оптимизация под ARM NEON. + +### 24.9. Общий подход к CPU dispatching в фабрике функций {#obshchii-podkhod-k-cpu-dispatching-v-fabrike-funktsii} + +Дмитрий Ковальков, ВШЭ и Яндекс. + +Продолжение 24.8. + +Upd. Есть pull request. + +### 24.10. Поддержка типов half/bfloat16/unum {#podderzhka-tipov-halfbfloat16unum} + +[\#7657](https://github.com/ClickHouse/ClickHouse/issues/7657) + +Рустам Гусейн-заде, ВШЭ. + +### 24.11. User Defined Functions {#user-defined-functions} + +Игорь Минеев, ВШЭ. + +ClickHouse предоставляет достаточно богатый набор встроенных функций языка запросов, но не позволяет пользователю добавлять свои функции без редактировния исходников и перекомпиляции системы. Это мотивировано следующими потенциальными проблемами: + +1. ClickHouse является array-oriented системой, и все функции внутри кода принимают для обработки целые массивы, а не отдельные значения. Это усложняет внутренний интерфейс и делает его менее удобным для пользователя. +2. Предоставление возможности подключения UDF в виде shared библиотек, потребовало бы фиксировать этот интерфейс или поддерживать обратную совместимость, тогда как мы бы хотели, при разработке ClickHouse, менять этот интерфейс по своему усмотрению без оглядки. +3. Сложность внутренних структур данных повышает вероятность ошибок типа buffer overflow и повреждения памяти, что сильно затруднит сопровождение ClickHouse с пользовательскими функциями. + +Тем не менее, можно выбрать более аккуратный подход, избегающий непосредственной линковки с shared библиотеками. + +Сначала можно реализовать поддержку UDF в виде выражений, составленных из простых функций ClickHouse. В ClickHouse есть встроенная кодогенерация на LLVM, что позволит таким функциям работать весьма эффективно. Но этот подход весьма ограничен и поэтому не является исчерпывающим. + +Затем предлагается реализовать поддержку UDF в виде исходников на C++, которые компилируются в runtime, с использованием заголовочных файлов ClickHouse. Требование компиляции из исходников вместо shared библиотек, позволит ослабить необходимость в поддержке совместимости ABI. + +Для безопасности, потребуется исследовать возможность размещения буферов данных в shared memory для выполнения UDF в отдельных процессах с изоляцией по памяти. Возможно, для этого пригодится интеграция с Apache Arrow. + +Также рассматривается возможность написания UDF на Rust, а также использование Web Assembly. Отдельно можно рассмотреть подключение NumPy и R и других технологий, которые предоставляют операции над целыми массивами. + +### 24.12. GPU offloading {#gpu-offloading} + +Риск состоит в том, что даже известные GPU базы, такие как OmniSci, работают медленнее, чем ClickHouse. +Преимущество возможно только на полной сортировке и JOIN. +Алексей Соловей, nVidia и Рита Коннова, ВШЭ. + +В компании nVidia сделали прототип offloading вычисления GROUP BY с некоторыми из агрегатных функций в ClickHouse и обещат предоставить исходники в публичный доступ для дальнейшего развития. Предлагается изучить этот прототип и расширить его применимость для более широкого сценария использования. В качестве альтернативы, предлагается изучить исходные коды системы `OmniSci` или `Alenka` или библиотеку `CUB` https://nvlabs.github.io/cub/ и применить некоторые из алгоритмов в ClickHouse. + +Upd. В компании nVidia выложили прототип, теперь нужна интеграция в систему сборки. +Upd. Интеграция в систему сборки - Иван Лежанкин. +Upd. Есть прототип bitonic sort. + +### 24.13. Stream запросы {#stream-zaprosy} + +Пререквизит для ClickHouse как CEP-системы. + +### 24.14. Window функции {#window-funktsii} + +[\#1469](https://github.com/ClickHouse/ClickHouse/issues/1469) + +Требует 2.1. + +### 24.15. Поддержка полуструктурированных данных {#podderzhka-polustrukturirovannykh-dannykh} + +Требует 1.14 и 2.10. + +### 24.16. Улучшение эвристики слияний {#uluchshenie-evristiki-sliianii} + +В прошлом году исследование по этой задаче сделал Егор Соловьёв, ВШЭ и Яндекс.Такси. Его исследование показало, что алгоритм нельзя существенно улучшить путём изменения параметров. Но исследование лажовое, так как рассмотрен только уже использующийся алгоритм. То есть, задача остаётся открытой. + +### 24.17. Экспериментальные способы ускорения параллельного GROUP BY {#eksperimentalnye-sposoby-uskoreniia-parallelnogo-group-by} + +Максим Серебряков + +Задача в работе. + +### 24.18. Не TCP протокол передачи файлов при репликации {#ne-tcp-protokol-peredachi-failov-pri-replikatsii} + +### 24.19. Промежуточное состояние GROUP BY как структура данных для key-value доступа {#promezhutochnoe-sostoianie-group-by-kak-struktura-dannykh-dlia-key-value-dostupa} + +### 24.20. Short-circuit вычисления некоторых выражений {#short-circuit-vychisleniia-nekotorykh-vyrazhenii} + +Два года назад задачу попробовала сделать Анастасия Царькова, ВШЭ и Яндекс, но реализация получилась слишком неудобной и её удалили. + +### 24.21. Реализация в ClickHouse протокола распределённого консенсуса {#realizatsiia-v-clickhouse-protokola-raspredelionnogo-konsensusa} + +Имеет смысл только после 19.2. + +### 24.22. Вывод типов по блоку данных. Вывод формата данных по примеру {#vyvod-tipov-po-bloku-dannykh-vyvod-formata-dannykh-po-primeru} + +Задача отложена. + +ClickHouse является строго типизированной системой. Для того, чтобы прочитать данные в каком либо формате (например, CSV), требуется заранее указать типы данных. Если при чтении формата выясняется, что данные не могут быть прочитаны в рамках заданных типов, то кидается исключение. + +ClickHouse также может использоваться для быстрой аналитики по локальным файлам, без загрузки их в базу данных (программа `clickhouse-local`). В этом случае, его использование может заменить `awk`, `sed`, `grep`. Но остаётся неудобство - необходимость указания типов данных. + +Предлагается реализовать функциональность вывода типов по первому блоку данных путём применения эвристик и постепенного расширения типов. + +Другая экспериментальная задача - реализация эвристик для обработки данных в неизвестном построчном текстовом формате. Детектирование CSV, TSV, JSON, детектирование разделителей и форматов значений. + +### 24.23. Минимальная поддержка транзакций для множества вставок/чтений {#minimalnaia-podderzhka-tranzaktsii-dlia-mnozhestva-vstavokchtenii} + +Максим Кузнецов, ВШЭ. + +Таблицы типа MergeTree состоят из набора независимых неизменяемых «кусков» данных. При вставках данных (INSERT), формируются новые куски. При модификациях данных (слияние кусков), формируются новые куски, а старые - становятся неактивными и перестают использоваться следующими запросами. Чтение данных (SELECT) производится из снэпшота множества кусков на некоторый момент времени. Таким образом, чтения и вставки не блокируют друг друга. + +Если же выполняется несколько запросов SELECT, то чтение данных может осуществляться из снэпшотов по состоянию на несколько разных моментов времени и быть неконсистентным. Пример: пользователю отображается отчёт из нескольких графиков и таблиц, но из-за того, что между разными запросами, данные успели обновиться, отображаемые данные не соответствуют друг другу. + +Пример с другой стороны - пользователь хочет осуществить несколько вставок (INSERT) в одну или несколько таблиц, но так, чтобы данные появились в них атомарно с точки зрения других запросов (SELECT). + +Для решения этих проблем, предлагается ввести глобальные метки времени для кусков данных (сейчас уже есть инкрементальные номера кусков, но они выделяются в рамках одной таблицы). Первым шагом сделаем эти метки времени в рамках сервера. Вторым шагом сделаем метки времени в рамках всех серверов, но неточные на основе локальных часов. Третьим шагом сделаем метки времени, выдаваемые сервисом координации. + +### 24.24. Реализация алгоритмов differential privacy {#realizatsiia-algoritmov-differential-privacy} + +[\#6874](https://github.com/ClickHouse/ClickHouse/issues/6874) + +Артём Вишняков, ВШЭ. + +### 24.25. Интеграция в ClickHouse функциональности обработки HTTP User Agent {#integratsiia-v-clickhouse-funktsionalnosti-obrabotki-http-user-agent} + +[\#157](https://github.com/ClickHouse/ClickHouse/issues/157) +Есть хороший код в Яндекс.Метрике. Получено согласие от руководства. +Михаил Филитов, ВШЭ. + +### 24.26. Поддержка open tracing или аналогов {#podderzhka-open-tracing-ili-analogov} + +[\#5182](https://github.com/ClickHouse/ClickHouse/issues/5182) + +Александр Кожихов, ВШЭ и Яндекс.YT. + +### 24.27. Реализация алгоритмов min-hash, sim-hash для нечёткого поиска полудубликатов {#realizatsiia-algoritmov-min-hash-sim-hash-dlia-nechiotkogo-poiska-poludublikatov} + +[\#7649](https://github.com/ClickHouse/ClickHouse/pull/7649) + +ucasFL, ICT. + +Алгоритмы min-hash и sim-hash позволяют вычислить для текста несколько хэш-значений таких, что при небольшом изменении текста, по крайней мере один из хэшей не меняется. Вычисления можно реализовать на n-грамах и словарных шинглах. Предлагается добавить поддержку этих алгоритмов в виде функций в ClickHouse и изучить их применимость для задачи нечёткого поиска полудубликатов. + +Есть pull request, есть что доделывать. + +### 24.28. Другой sketch для квантилей {#drugoi-sketch-dlia-kvantilei} + +Похоже на quantileTiming, но с логарифмическими корзинами. См. DDSketch. + +### 24.29. Поддержка Arrow Flight {#podderzhka-arrow-flight} + +[\#7554](https://github.com/ClickHouse/ClickHouse/issues/7554) + +Жанна Зосимова, ВШЭ. + +### 24.30. ClickHouse как графовая СУБД {#clickhouse-kak-grafovaia-subd} + +Amos Bird, но его решение слишком громоздкое и пока не open-source. + +### 24.31. Кореллированные подзапросы {#korellirovannye-podzaprosy} + +Перепиcывание в JOIN. Не раньше 21.11, 21.12, 21.9. Низкий приоритет. + +### 24.32. Поддержка GRPC {#podderzhka-grpc} + +Мария Конькова, ВШЭ и Яндекс. +Также смотрите 24.29. + +В ClickHouse есть два основных протокола: родной протокол общения между серверами и HTTP/1.1 протокол. HTTP/1.1 протокол удобен для работы из самых разных языков программирования, но, в отличие от родного протокола, не поддерживает двусторонний обмен информацией во время запроса: +- передачу информации о прогрессе во время выполнения запроса; +- передачу логов во время выполнения запроса; +- отмену выполнения запроса в тот момент как данные ещё не начали передаваться; + +Рассматривается вариант - поддержка GRPC в ClickHouse. Здесь есть неочевидные моменты, такие как - эффективная передача массивов данных в column-oriented формате - насколько удобно будет обернуть это в GRPC. + +Задача в работе, есть pull request. + +## 25. DevRel {#devrel} + +### 25.1. + Перевод инструкции для начинающих разработчиков {#perevod-instruktsii-dlia-nachinaiushchikh-razrabotchikov} + +Александр Казаков, ноябрь 2019. + +### 25.2. + Вычитка и выкладка статьи про обфускацию данных на английском {#vychitka-i-vykladka-stati-pro-obfuskatsiiu-dannykh-na-angliiskom} + +Эми, Александр Казаков, Алексей Миловидов, Q1. +Готово к выкладке. + +### 25.3. Подготовка статьи «Секреты оптимизации производительности ClickHouse» {#podgotovka-stati-sekrety-optimizatsii-proizvoditelnosti-clickhouse} + +Алексей Миловидов, Леонид. + +### 25.4. Подготовка статьи «Профайлер запросов: трудный путь» {#podgotovka-stati-profailer-zaprosov-trudnyi-put} + +Алексей Миловидов, Леонид. + +### 25.5. Подготовка статьи «Тестирование ClickHouse, которое мы заслужили» {#podgotovka-stati-testirovanie-clickhouse-kotoroe-my-zasluzhili} + +### 25.6. Перевод этих статей на английский {#perevod-etikh-statei-na-angliiskii} + +Требует 25.3, 25.4, 25.5. Эми + +### 25.7. Перевод статьи Данилы Кутенина на английский {#perevod-stati-danily-kutenina-na-angliiskii} + +Эми + +### 25.8. + Выступление keynote на BDTC {#vystuplenie-keynote-na-bdtc} + +Алексей Миловидов + +### 25.9. Подготовка докладчиков: khvostikao, ilezhankin, nikitamikhailov, akuzm и другие {#podgotovka-dokladchikov-khvostikao-ilezhankin-nikitamikhailov-akuzm-i-drugie} + +[Ольга Хвостикова](https://github.com/stavrolia), [Иван Лежанкин](https://github.com/abyss7), Никита Михайлов, [Александр Кузьменков](https://github.com/akuzm), Артём Зуйков. +Уже готовые докладчики: Алексей Миловидов, [Николай Кочетов](https://github.com/KochetovNicolai), [Александр Сапин](https://github.com/alesapin). +Получаем минимум 8 докладчиков в 2020 году. + +### 25.10. Митапы в России и Беларуси: Москва x2 + митап для разработчиков или хакатон, Санкт-Петербург, Минск, Нижний Новгород, Екатеринбург, Новосибирск и/или Академгородок, Иннополис или Казань {#mitapy-v-rossii-i-belarusi-moskva-x2-mitap-dlia-razrabotchikov-ili-khakaton-sankt-peterburg-minsk-nizhnii-novgorod-ekaterinburg-novosibirsk-iili-akademgorodok-innopolis-ili-kazan} + +Екатерина - организация. Upd. Проведено два онлайн митапа на русском. + +### 25.11. Митапы зарубежные: восток США (Нью Йорк, возможно Raleigh), возможно северо-запад (Сиэтл), Китай (Пекин снова, возможно митап для разработчиков или хакатон), Лондон {#mitapy-zarubezhnye-vostok-ssha-niu-iork-vozmozhno-raleigh-vozmozhno-severo-zapad-sietl-kitai-pekin-snova-vozmozhno-mitap-dlia-razrabotchikov-ili-khakaton-london} + +[Иван Блинков](https://github.com/blinkov/) - организация. Две штуки в США запланированы. Upd. Два митапа в США и один в Европе проведены. + +### 25.12. Статья «научная» - про устройство хранения данных и индексов или whitepaper по архитектуре. Есть вариант подать на VLDB {#statia-nauchnaia-pro-ustroistvo-khraneniia-dannykh-i-indeksov-ili-whitepaper-po-arkhitekture-est-variant-podat-na-vldb} + +Низкий приоритет. Алексей Миловидов. + +### 25.13. Участие во всех мероприятиях Яндекса, которые связаны с разработкой бэкенда, C++ разработкой или с базами данных, возможно участие в DevRel мероприятиях {#uchastie-vo-vsekh-meropriiatiiakh-iandeksa-kotorye-sviazany-s-razrabotkoi-bekenda-c-razrabotkoi-ili-s-bazami-dannykh-vozmozhno-uchastie-v-devrel-meropriiatiiakh} + +Алексей Миловидов и все подготовленные докладчики + +### 25.14. Конференции в России: все HighLoad, возможно CodeFest, DUMP или UWDC, возможно C++ Russia {#konferentsii-v-rossii-vse-highload-vozmozhno-codefest-dump-ili-uwdc-vozmozhno-c-russia} + +Алексей Миловидов и все подготовленные докладчики. +Upd. Есть Saint HighLoad online. + +### 25.15. Конференции зарубежные: Percona, DataOps, попытка попасть на более крупные {#konferentsii-zarubezhnye-percona-dataops-popytka-popast-na-bolee-krupnye} + +Алексей Миловидов и все подготовленные докладчики + +### 25.16. Сайт play.clickhouse {#sait-play-clickhouse} + +Цель состоит в реализации сайта, на котором можно попробовать задавать произвольные запросы к временному экземпляру ClickHouse и изучать его поведение. Из похожих проектов можно отметить: [Compiler Explorer](https://godbolt.org/), http://ideone.com/, [SQLFiddle](http://sqlfiddle.com/), [DB-Fiddle](https://www.db-fiddle.com/). + +С помощью такого сайта можно решать следующие задачи: +- ознакомление с языком запросов ClickHouse; +- демонстрация примеров из документации; +- демонстрация скорости работы на тестовых датасетах; +- сравнение поведения разных версий ClickHouse друг с другом; +- демонстрация неожиданного поведения или багов; + +Требуется проработать вопрос безопасности и изоляции инстансов (поднятие в контейнерах с ограничениями по сети), подключение тестовых датасетов с помощью copy-on-write файловой системы; органичения ресурсов. + +Есть минимальный прототип. Сделал Илья Яцишин. Этот прототип не позволяет делиться ссылками на результаты запросов. + +### 25.17. Взаимодействие с ВУЗами: ВШЭ, УрФУ, ICT Beijing {#vzaimodeistvie-s-vuzami-vshe-urfu-ict-beijing} + +Алексей Миловидов и вся группа разработки + +### 25.18. - Лекция в ШАД {#lektsiia-v-shad} + +Алексей Миловидов + +### 25.19. Участие в курсе разработки на C++ в ШАД {#uchastie-v-kurse-razrabotki-na-c-v-shad} + +### 25.20. Ещё одно сравнение производительности аналитических СУБД {#eshchio-odno-sravnenie-proizvoditelnosti-analiticheskikh-subd} + +Матвей Бубнов, УрФУ + +Существуют мало известные специализированные СУБД, способные конкурировать с ClickHouse по скорости обработки некоторых классов запросов. Пример: `TDEngine` и `DolphinDB`, `VictoriaMetrics`, а также `Apache Doris` и `LocustDB`. Предлагается изучить и классифицировать архитектурные особенности этих систем - их особенности и преимущества. Установить эти системы, загрузить тестовые данные, изучить производительность. Проанализировать, за счёт чего достигаются преимущества. + +### 25.21. Повторное награждение контрибьюторов в Китае {#povtornoe-nagrazhdenie-kontribiutorov-v-kitae} + +### 25.22. On-site помощь с ClickHouse компаниям в дни рядом с мероприятиями {#on-site-pomoshch-s-clickhouse-kompaniiam-v-dni-riadom-s-meropriiatiiami} + +[Иван Блинков](https://github.com/blinkov/) - организация. Проверил мероприятие для турецкой компании. + +### 25.23. Новый мерч для ClickHouse {#novyi-merch-dlia-clickhouse} + +### 25.24. Конкурсы bughunter или оптимизации кода на C++ {#konkursy-bughunter-ili-optimizatsii-koda-na-c} + +Проведение конкурсов должно начинаться для сотрудников Яндекса, пока нет согласования. + +### 25.25. Семинары для потенциальных клиентов Яндекс.Облака {#seminary-dlia-potentsialnykh-klientov-iandeks-oblaka} + +По мере необходимости. Алексей Миловидов, организация - Яндекс.Облако. + +### 25.26. - Участие в GSoC {#uchastie-v-gsoc} + +Андрей Бородин пытается уговорить нас участвовать, но пока загружены задачей 25.17. + +UPD: не участвуем. + +### 25.27. + Обновить сайт ClickHouse {#obnovit-sait-clickhouse} + +Иван Блинков. Нет рисков. Нужно для Яндекс.Облака. Upd. Сделано. diff --git a/docs/ru/whats-new/index.md b/docs/ru/whats-new/index.md new file mode 100644 index 00000000000..a8c908088d0 --- /dev/null +++ b/docs/ru/whats-new/index.md @@ -0,0 +1,6 @@ +--- +toc_folder_title: "\u0427\u0442\u043E \u043D\u043E\u0432\u043E\u0433\u043E?" +toc_priority: 72 +--- + + diff --git a/docs/ru/whats-new/roadmap.md b/docs/ru/whats-new/roadmap.md new file mode 120000 index 00000000000..2c383b2ad5d --- /dev/null +++ b/docs/ru/whats-new/roadmap.md @@ -0,0 +1 @@ +../../en/whats-new/roadmap.md \ No newline at end of file diff --git a/docs/ru/whats-new/security-changelog.md b/docs/ru/whats-new/security-changelog.md new file mode 100644 index 00000000000..4a799a29649 --- /dev/null +++ b/docs/ru/whats-new/security-changelog.md @@ -0,0 +1,71 @@ +# Security Changelog {#security-changelog} + +## Исправлено в релизе 19.14.3.3, 2019-09-10 {#ispravleno-v-relize-19-14-3-3-2019-09-10} + +### CVE-2019-15024 {#cve-2019-15024} + +Злоумышленник с доступом на запись к ZooKeeper и возможностью запустить собственный сервер в сети доступной ClickHouse может создать вредоносный сервер, который будет вести себя как реплика ClickHouse и зарегистрируется в ZooKeeper. В процессе репликации вредоносный сервер может указать любой путь на файловой системе в который будут записаны данные. + +Обнаружено благодаря: Эльдару Заитову из Службы Информационной Безопасности Яндекса + +### CVE-2019-16535 {#cve-2019-16535} + +Интерфейс декомпрессии позволял совершать OOB чтения и записи данных в памяти, а также переполнение целочисленных переменных, что могло приводить к отказу в обслуживании. Также потенциально могло использоваьтся для удаленного выполнения кода. + +Обнаружено благодаря: Эльдару Заитову из Службы Информационной Безопасности Яндекса + +### CVE-2019-16536 {#cve-2019-16536} + +Аутентифицированный клиент злоумышленника имел возможность вызвать переполнение стека, что могло привести к отказу в обслуживании. + +Обнаружено благодаря: Эльдару Заитову из Службы Информационной Безопасности Яндекса + +## Исправлено в релизе 19.13.6.1 от 20 сентября 2019 {#ispravleno-v-relize-19-13-6-1-ot-20-sentiabria-2019} + +### CVE-2019-18657 {#cve-2019-18657} + +Уязвимость в табличной функции `url` позволяла злоумышленнику добавлять произвольные HTTP-заголовки в запрос. + +Обнаружено благодаря: [Никите Тихомирову](https://github.com/NSTikhomirov) + +## Исправлено в релизе 18.12.13 от 10 сентября 2018 {#ispravleno-v-relize-18-12-13-ot-10-sentiabria-2018} + +### CVE-2018-14672 {#cve-2018-14672} + +Функция для загрузки CatBoost моделей некорректно обрабатывала пути к файлам, что позволяло читать произвольные локальные файлы на сервере Clickhouse через сообщения об ошибках. + +Обнаружено благодаря: Андрею Красичкову из Службы Информационной Безопасности Яндекса + +## Исправлено в релизе 18.10.3 от 13 августа 2018 {#ispravleno-v-relize-18-10-3-ot-13-avgusta-2018} + +### CVE-2018-14671 {#cve-2018-14671} + +unixODBC позволял указать путь для подключения произвольного shared object в качестве драйвера базы данных, что приводило к возможности выполнить произвольный код на сервере ClickHouse. + +Обнаружено благодаря: Андрею Красичкову и Евгению Сидорову из Службы Информационной Безопасности Яндекса + +## Исправлено в релизе 1.1.54388 от 28 июня 2018 {#ispravleno-v-relize-1-1-54388-ot-28-iiunia-2018} + +### CVE-2018-14668 {#cve-2018-14668} + +Табличная функция «remote» допускала произвольные символы в полях «user», «password» и «default\_database», что позволяло производить атаки класса Cross Protocol Request Forgery. + +Обнаружено благодаря: Андрею Красичкову из Службы Информационной Безопасности Яндекса + +## Исправлено в релизе 1.1.54390 от 6 июля 2018 {#ispravleno-v-relize-1-1-54390-ot-6-iiulia-2018} + +### CVE-2018-14669 {#cve-2018-14669} + +В ClickHouse MySQL клиенте была включена функциональность «LOAD DATA LOCAL INFILE», что позволяло получать доступ на чтение к произвольным файлам на сервере, где запущен ClickHouse. + +Обнаружено благодаря: Андрею Красичкову и Евгению Сидорову из Службы Информационной Безопасности Яндекса + +## Исправлено в релизе 1.1.54131 от 10 января 2017 {#ispravleno-v-relize-1-1-54131-ot-10-ianvaria-2017} + +### CVE-2018-14670 {#cve-2018-14670} + +Некорректная конфигурация в deb пакете могла привести к неавторизованному доступу к базе данных. + +Обнаружено благодаря: the UK’s National Cyber Security Centre (NCSC) + +{## [Оригинальная статья](https://clickhouse.tech/docs/ru/security_changelog/) ##} diff --git a/docs/ru/whats_new/changelog/2017.md b/docs/ru/whats_new/changelog/2017.md deleted file mode 120000 index a098eddf1d8..00000000000 --- a/docs/ru/whats_new/changelog/2017.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/whats_new/changelog/2017.md \ No newline at end of file diff --git a/docs/ru/whats_new/changelog/2018.md b/docs/ru/whats_new/changelog/2018.md deleted file mode 120000 index 124fb19e175..00000000000 --- a/docs/ru/whats_new/changelog/2018.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/whats_new/changelog/2018.md \ No newline at end of file diff --git a/docs/ru/whats_new/changelog/2019.md b/docs/ru/whats_new/changelog/2019.md deleted file mode 120000 index 740d1edd238..00000000000 --- a/docs/ru/whats_new/changelog/2019.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/whats_new/changelog/2019.md \ No newline at end of file diff --git a/docs/ru/whats_new/changelog/index.md b/docs/ru/whats_new/changelog/index.md deleted file mode 100644 index 969e71fbf42..00000000000 --- a/docs/ru/whats_new/changelog/index.md +++ /dev/null @@ -1,650 +0,0 @@ ---- -toc_folder_title: Changelog -toc_priority: 74 -toc_title: '2020' ---- - -## ClickHouse release v20.3 - -### ClickHouse release v20.3.4.10, 2020-03-20 - -#### Bug Fix -* This release also contains all bug fixes from 20.1.8.41 -* Fix missing `rows_before_limit_at_least` for queries over http (with processors pipeline). This fixes [#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - - -### ClickHouse release v20.3.3.6, 2020-03-17 - -#### Bug Fix -* This release also contains all bug fixes from 20.1.7.38 -* Fix bug in a replication that doesn't allow replication to work if the user has executed mutations on the previous version. This fixes [#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). It makes version 20.3 backward compatible again. -* Add setting `use_compact_format_in_distributed_parts_names` which allows to write files for `INSERT` queries into `Distributed` table with more compact format. This fixes [#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). It makes version 20.3 backward compatible again. - -### ClickHouse release v20.3.2.1, 2020-03-12 - -#### Backward Incompatible Change - -* Fixed the issue `file name too long` when sending data for `Distributed` tables for a large number of replicas. Fixed the issue that replica credentials were exposed in the server log. The format of directory name on disk was changed to `[shard{shard_index}[_replica{replica_index}]]`. [#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) After you upgrade to the new version, you will not be able to downgrade without manual intervention, because old server version does not recognize the new directory format. If you want to downgrade, you have to manually rename the corresponding directories to the old format. This change is relevant only if you have used asynchronous `INSERT`s to `Distributed` tables. In the version 20.3.3 we will introduce a setting that will allow you to enable the new format gradually. -* Changed the format of replication log entries for mutation commands. You have to wait for old mutations to process before installing the new version. -* Implement simple memory profiler that dumps stacktraces to `system.trace_log` every N bytes over soft allocation limit [#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([Ivan](https://github.com/abyss7)) [#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov)) The column of `system.trace_log` was renamed from `timer_type` to `trace_type`. This will require changes in third-party performance analysis and flamegraph processing tools. -* Use OS thread id everywhere instead of internal thread number. This fixes [#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Old `clickhouse-client` cannot receive logs that are send from the server when the setting `send_logs_level` is enabled, because the names and types of the structured log messages were changed. On the other hand, different server versions can send logs with different types to each other. When you don't use the `send_logs_level` setting, you should not care. [#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Remove `indexHint` function [#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Remove `findClusterIndex`, `findClusterValue` functions. This fixes [#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). If you were using these functions, send an email to `clickhouse-feedback@yandex-team.com` [#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Now it's not allowed to create columns or add columns with `SELECT` subquery as default expression. [#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) -* Require aliases for subqueries in JOIN. [#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) -* Improved `ALTER MODIFY/ADD` queries logic. Now you cannot `ADD` column without type, `MODIFY` default expression doesn't change type of column and `MODIFY` type doesn't loose default expression value. Fixes [#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) -* Require server to be restarted to apply the changes in logging configuration. This is a temporary workaround to avoid the bug where the server logs to a deleted log file (see [#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* The setting `experimental_use_processors` is enabled by default. This setting enables usage of the new query pipeline. This is internal refactoring and we expect no visible changes. If you will see any issues, set it to back zero. [#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### New Feature -* Add `Avro` and `AvroConfluent` input/output formats [#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Multi-threaded and non-blocking updates of expired keys in `cache` dictionaries (with optional permission to read old ones). [#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Add query `ALTER ... MATERIALIZE TTL`. It runs mutation that forces to remove expired data by TTL and recalculates meta-information about TTL in all parts. [#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) -* Switch from HashJoin to MergeJoin (on disk) if needed [#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) -* Added `MOVE PARTITION` command for `ALTER TABLE` [#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) -* Reloading storage configuration from configuration file on the fly. [#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Allowed to change `storage_policy` to not less rich one. [#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Added support for globs/wildcards for S3 storage and table function. [#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Implement `bitAnd`, `bitOr`, `bitXor`, `bitNot` for `FixedString(N)` datatype. [#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) -* Added function `bitCount`. This fixes [#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ikopylov](https://github.com/ikopylov)) -* Add `generateRandom` table function to generate random rows with given schema. Allows to populate arbitrary test table with data. [#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) -* `JSONEachRowFormat`: support special case when objects enclosed in top-level array. [#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) -* Now it's possible to create a column with `DEFAULT` expression which depends on a column with default `ALIAS` expression. [#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) -* Allow to specify `--limit` more than the source data size in `clickhouse-obfuscator`. The data will repeat itself with different random seed. [#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added `groupArraySample` function (similar to `groupArray`) with reservior sampling algorithm. [#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos Bird](https://github.com/amosbird)) -* Now you can monitor the size of update queue in `cache`/`complex_key_cache` dictionaries via system metrics. [#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Allow to use CRLF as a line separator in CSV output format with setting `output_format_csv_crlf_end_of_line` is set to 1 [#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) -* Implement more functions of the [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` and `stringToH3` [#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) -* New setting introduced: `max_parser_depth` to control maximum stack size and allow large complex queries. This fixes [#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) and [#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) -* Add a setting `force_optimize_skip_unused_shards` setting to throw if skipping of unused shards is not possible [#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) -* Allow to configure multiple disks/volumes for storing data for send in `Distributed` engine [#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) -* Support storage policy (``) for storing temporary data. [#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) -* Added `X-ClickHouse-Exception-Code` HTTP header that is set if exception was thrown before sending data. This implements [#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) -* Added function `ifNotFinite`. It is just a syntactic sugar: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added `last_successful_update_time` column in `system.dictionaries` table [#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Add `blockSerializedSize` function (size on disk without compression) [#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) -* Add function `moduloOrZero` [#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) -* Added system tables `system.zeros` and `system.zeros_mt` as well as tale functions `zeros()` and `zeros_mt()`. Tables (and table functions) contain single column with name `zero` and type `UInt8`. This column contains zeros. It is needed for test purposes as the fastest method to generate many rows. This fixes [#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Experimental Feature -* Add new compact format of parts in `MergeTree`-family tables in which all columns are stored in one file. It helps to increase performance of small and frequent inserts. The old format (one file per column) is now called wide. Data storing format is controlled by settings `min_bytes_for_wide_part` and `min_rows_for_wide_part`. [#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) -* Support for S3 storage for `Log`, `TinyLog` and `StripeLog` tables. [#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) - -#### Bug Fix -* Fixed inconsistent whitespaces in log messages. [#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix bug in which arrays of unnamed tuples were flattened as Nested structures on table creation. [#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) -* Fixed the issue when "Too many open files" error may happen if there are too many files matching glob pattern in `File` table or `file` table function. Now files are opened lazily. This fixes [#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* DROP TEMPORARY TABLE now drops only temporary table. [#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) -* Remove outdated partition when we shutdown the server or DETACH/ATTACH a table. [#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) -* For how the default disk calculates the free space from `data` subdirectory. Fixed the issue when the amount of free space is not calculated correctly if the `data` directory is mounted to a separate device (rare case). This fixes [#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) -* Allow comma (cross) join with IN () inside. [#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) -* Allow to rewrite CROSS to INNER JOIN if there's [NOT] LIKE operator in WHERE section. [#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) -* Fix possible incorrect result after `GROUP BY` with enabled setting `distributed_aggregation_memory_efficient`. Fixes [#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Found keys were counted as missed in metrics of cache dictionaries. [#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Fix replication protocol incompatibility introduced in [#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -* Fixed race condition on `queue_task_handle` at the startup of `ReplicatedMergeTree` tables. [#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* The token `NOT` didn't work in `SHOW TABLES NOT LIKE` query [#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added range check to function `h3EdgeLengthM`. Without this check, buffer overflow is possible. [#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed up a bug in batched calculations of ternary logical OPs on multiple arguments (more than 10). [#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) -* Fix error of PREWHERE optimization, which could lead to segfaults or `Inconsistent number of columns got from MergeTreeRangeReader` exception. [#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) -* Fix unexpected `Timeout exceeded while reading from socket` exception, which randomly happens on secure connection before timeout actually exceeded and when query profiler is enabled. Also add `connect_timeout_with_failover_secure_ms` settings (default 100ms), which is similar to `connect_timeout_with_failover_ms`, but is used for secure connections (because SSL handshake is slower, than ordinary TCP connection) [#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) -* Fix bug with mutations finalization, when mutation may hang in state with `parts_to_do=0` and `is_done=0`. [#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) -* Use new ANY JOIN logic with `partial_merge_join` setting. It's possible to make `ANY|ALL|SEMI LEFT` and `ALL INNER` joins with `partial_merge_join=1` now. [#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) -* Shard now clamps the settings got from the initiator to the shard's constaints instead of throwing an exception. This fix allows to send queries to a shard with another constraints. [#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) -* Fixed memory management problem in `MergeTreeReadPool`. [#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix `toDecimal*OrNull()` functions family when called with string `e`. Fixes [#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) -* Make sure that `FORMAT Null` sends no data to the client. [#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Fix bug that timestamp in `LiveViewBlockInputStream` will not updated. `LIVE VIEW` is an experimental feature. [#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) -* Fixed `ALTER MODIFY TTL` wrong behavior which did not allow to delete old TTL expressions. [#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fixed UBSan report in MergeTreeIndexSet. This fixes [#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed the behaviour of `match` and `extract` functions when haystack has zero bytes. The behaviour was wrong when haystack was constant. This fixes [#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Avoid throwing from destructor in Apache Avro 3rd-party library. [#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) -* Don't commit a batch polled from `Kafka` partially as it can lead to holes in data. [#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) -* Fix `joinGet` with nullable return types. https://github.com/ClickHouse/ClickHouse/issues/8919 [#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos Bird](https://github.com/amosbird)) -* Fix data incompatibility when compressed with `T64` codec. [#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Fix data type ids in `T64` compression codec that leads to wrong (de)compression in affected versions. [#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) -* Add setting `enable_early_constant_folding` and disable it in some cases that leads to errors. [#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) -* Fix pushdown predicate optimizer with VIEW and enable the test [#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([Winter Zhang](https://github.com/zhang2014)) -* Fix segfault in `Merge` tables, that can happen when reading from `File` storages [#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) -* Added a check for storage policy in `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. Otherwise it could make data of part inaccessible after restart and prevent ClickHouse to start. [#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix alters if there is TTL set for table. [#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) -* Fix race condition that can happen when `SYSTEM RELOAD ALL DICTIONARIES` is executed while some dictionary is being modified/added/removed. [#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) -* In previous versions `Memory` database engine use empty data path, so tables are created in `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) -* Fixed wrong log messages about missing default disk or policy. [#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix not(has()) for the bloom_filter index of array types. [#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) -* Allow first column(s) in a table with `Log` engine be an alias [#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([Ivan](https://github.com/abyss7)) -* Fix order of ranges while reading from `MergeTree` table in one thread. It could lead to exceptions from `MergeTreeRangeReader` or wrong query results. [#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) -* Make `reinterpretAsFixedString` to return `FixedString` instead of `String`. [#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) -* Avoid extremely rare cases when the user can get wrong error message (`Success` instead of detailed error description). [#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Do not crash when using `Template` format with empty row template. [#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Metadata files for system tables could be created in wrong place [#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix)) Fixes [#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). -* Fix data race on exception_ptr in cache dictionary [#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Do not throw an exception for query `ATTACH TABLE IF NOT EXISTS`. Previously it was thrown if table already exists, despite the `IF NOT EXISTS` clause. [#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) -* Fixed missing closing paren in exception message. [#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Avoid message `Possible deadlock avoided` at the startup of clickhouse-client in interactive mode. [#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed the issue when padding at the end of base64 encoded value can be malformed. Update base64 library. This fixes [#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), closes [#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Prevent losing data in `Kafka` in rare cases when exception happens after reading suffix but before commit. Fixes [#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) -* Fixed exception in `DROP TABLE IF EXISTS` [#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) -* Fix crash when a user tries to `ALTER MODIFY SETTING` for old-formated `MergeTree` table engines family. [#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -* Support for UInt64 numbers that don't fit in Int64 in JSON-related functions. Update SIMDJSON to master. This fixes [#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed execution of inversed predicates when non-strictly monotinic functional index is used. [#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) -* Don't try to fold `IN` constant in `GROUP BY` [#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos Bird](https://github.com/amosbird)) -* Fix bug in `ALTER DELETE` mutations which leads to index corruption. This fixes [#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) and [#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). Additionally fix extremely rare race conditions in `ReplicatedMergeTree` `ALTER` queries. [#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) -* When the setting `compile_expressions` is enabled, you can get `unexpected column` in `LLVMExecutableFunction` when we use `Nullable` type [#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) -* Multiple fixes for `Kafka` engine: 1) fix duplicates that were appearing during consumer group rebalance. 2) Fix rare 'holes' appeared when data were polled from several partitions with one poll and committed partially (now we always process / commit the whole polled block of messages). 3) Fix flushes by block size (before that only flushing by timeout was working properly). 4) better subscription procedure (with assignment feedback). 5) Make tests work faster (with default intervals and timeouts). Due to the fact that data was not flushed by block size before (as it should according to documentation), that PR may lead to some performance degradation with default settings (due to more often & tinier flushes which are less optimal). If you encounter the performance issue after that change - please increase `kafka_max_block_size` in the table to the bigger value ( for example `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Fixes [#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) -* Fix `Parameter out of bound` exception in some queries after PREWHERE optimizations. [#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) -* Fixed the case of mixed-constness of arguments of function `arrayZip`. [#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* When executing `CREATE` query, fold constant expressions in storage engine arguments. Replace empty database name with current database. Fixes [#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) -* Now it's not possible to create or add columns with simple cyclic aliases like `a DEFAULT b, b DEFAULT a`. [#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -* Fixed a bug with double move which may corrupt original part. This is relevant if you use `ALTER TABLE MOVE` [#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Allow `interval` identifier to correctly parse without backticks. Fixed issue when a query cannot be executed even if the `interval` identifier is enclosed in backticks or double quotes. This fixes [#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed fuzz test and incorrect behaviour of `bitTestAll`/`bitTestAny` functions. [#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix possible crash/wrong number of rows in `LIMIT n WITH TIES` when there are a lot of rows equal to n'th row. [#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -* Fix mutations with parts written with enabled `insert_quorum`. [#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) -* Fix data race at destruction of `Poco::HTTPServer`. It could happen when server is started and immediately shut down. [#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -* Fix bug in which a misleading error message was shown when running `SHOW CREATE TABLE a_table_that_does_not_exist`. [#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) -* Fixed `Parameters are out of bound` exception in some rare cases when we have a constant in the `SELECT` clause when we have an `ORDER BY` and a `LIMIT` clause. [#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) -* Fix mutations finalization, when already done mutation can have status `is_done=0`. [#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) -* Prevent from executing `ALTER ADD INDEX` for MergeTree tables with old syntax, because it doesn't work. [#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) -* During server startup do not access table, which `LIVE VIEW` depends on, so server will be able to start. Also remove `LIVE VIEW` dependencies when detaching `LIVE VIEW`. `LIVE VIEW` is an experimental feature. [#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) -* Fix possible segfault in `MergeTreeRangeReader`, while executing `PREWHERE`. [#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) -* Fix possible mismatched checksums with column TTLs. [#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -* Fixed a bug when parts were not being moved in background by TTL rules in case when there is only one volume. [#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fixed the issue `Method createColumn() is not implemented for data type Set`. This fixes [#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Now we will try finalize mutations more frequently. [#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -* Fix `intDiv` by minus one constant [#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) -* Fix possible race condition in `BlockIO`. [#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fix bug leading to server termination when trying to use / drop `Kafka` table created with wrong parameters. [#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) -* Added workaround if OS returns wrong result for `timer_create` function. [#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed error in usage of `min_marks_for_seek` parameter. Fixed the error message when there is no sharding key in Distributed table and we try to skip unused shards. [#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) - -#### Improvement -* Implement `ALTER MODIFY/DROP` queries on top of mutations for `ReplicatedMergeTree*` engines family. Now `ALTERS` blocks only at the metadata update stage, and don't block after that. [#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) -* Add ability to rewrite CROSS to INNER JOINs with `WHERE` section containing unqialified names. [#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) -* Make `SHOW TABLES` and `SHOW DATABASES` queries support the `WHERE` expressions and `FROM`/`IN` [#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) -* Added a setting `deduplicate_blocks_in_dependent_materialized_views`. [#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) -* After recent changes MySQL client started to print binary strings in hex thereby making them not readable ([#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). The workaround in ClickHouse is to mark string columns as UTF-8, which is not always, but usually the case. [#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) -* Add support of String and FixedString keys for `sumMap` [#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) -* Support string keys in SummingMergeTree maps [#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) -* Signal termination of thread to the thread pool even if the thread has thrown exception [#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -* Allow to set `query_id` in `clickhouse-benchmark` [#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) -* Don't allow strange expressions in `ALTER TABLE ... PARTITION partition` query. This addresses [#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* The table `system.table_engines` now provides information about feature support (like `supports_ttl` or `supports_sort_order`). [#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) -* Enable `system.metric_log` by default. It will contain rows with values of ProfileEvents, CurrentMetrics collected with "collect_interval_milliseconds" interval (one second by default). The table is very small (usually in order of megabytes) and collecting this data by default is reasonable. [#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([Ivan](https://github.com/abyss7)) -* Now temporary `LIVE VIEW` is created by `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` instead of `CREATE TEMPORARY LIVE VIEW ...`, because the previous syntax was not consistent with `CREATE TEMPORARY TABLE ...` [#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) -* Add text_log.level configuration parameter to limit entries that goes to `system.text_log` table [#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) -* Allow to put downloaded part to a disks/volumes according to TTL rules [#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) -* For external MySQL dictionaries, allow to mutualize MySQL connection pool to "share" them among dictionaries. This option significantly reduces the number of connections to MySQL servers. [#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) -* Show nearest query execution time for quantiles in `clickhouse-benchmark` output instead of interpolated values. It's better to show values that correspond to the execution time of some queries. [#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Possibility to add key & timestamp for the message when inserting data to Kafka. Fixes [#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) -* If server is run from terminal, highlight thread number, query id and log priority by colors. This is for improved readability of correlated log messages for developers. [#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Better exception message while loading tables for `Ordinary` database. [#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Implement `arraySlice` for arrays with aggregate function states. This fixes [#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Allow constant functions and constant arrays to be used on the right side of IN operator. [#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) -* If zookeeper exception has happened while fetching data for system.replicas, display it in a separate column. This implements [#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Atomically remove MergeTree data parts on destroy. [#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Support row-level security for Distributed tables. [#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([Ivan](https://github.com/abyss7)) -* Now we recognize suffix (like KB, KiB...) in settings values. [#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) -* Prevent out of memory while constructing result of a large JOIN. [#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) -* Added names of clusters to suggestions in interactive mode in `clickhouse-client`. [#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexey-milovidov](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) ([Ivan](https://github.com/abyss7)) -* Added column `exception_code` in `system.query_log` table. [#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) -* Enabled MySQL compatibility server on port `9004` in the default server configuration file. Fixed password generation command in the example in configuration. [#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) -* Prevent abort on shutdown if the filesystem is readonly. This fixes [#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Better exception message when length is required in HTTP POST query. [#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Add `_path` and `_file` virtual columns to `HDFS` and `File` engines and `hdfs` and `file` table functions [#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) -* Fix error `Cannot find column` while inserting into `MATERIALIZED VIEW` in case if new column was added to view's internal table. [#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fix progress over native client-server protocol, by send progress after final update (like logs). This may be relevant only to some third-party tools that are using native protocol. [#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) -* Add a system metric tracking the number of client connections using MySQL protocol ([#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) -* From now on, HTTP responses will have `X-ClickHouse-Timezone` header set to the same timezone value that `SELECT timezone()` would report. [#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) - -#### Performance Improvement -* Improve performance of analysing index with IN [#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) -* Simpler and more efficient code in Logical Functions + code cleanups. A followup to [#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) -* Overall performance improvement (in range of 5%..200% for affected queries) by ensuring even more strict aliasing with C++20 features. [#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos Bird](https://github.com/amosbird)) -* More strict aliasing for inner loops of comparison functions. [#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* More strict aliasing for inner loops of arithmetic functions. [#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* A ~3 times faster implementation for ColumnVector::replicate(), via which ColumnConst::convertToFullColumn() is implemented. Also will be useful in tests when materializing constants. [#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) -* Another minor performance improvement to `ColumnVector::replicate()` (this speeds up the `materialize` function and higher order functions) an even further improvement to [#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) -* Improved performance of `stochasticLinearRegression` aggregate function. This patch is contributed by Intel. [#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Improve performance of `reinterpretAsFixedString` function. [#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Do not send blocks to client for `Null` format in processors pipeline. [#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### Build/Testing/Packaging Improvement -* Exception handling now works correctly on Windows Subsystem for Linux. See https://github.com/ClickHouse-Extras/libunwind/pull/3 This fixes [#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) -* Replace `readline` with `replxx` for interactive line editing in `clickhouse-client` [#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([Ivan](https://github.com/abyss7)) -* Better build time and less template instantiations in FunctionsComparison. [#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added integration with `clang-tidy` in CI. See also [#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Now we link ClickHouse in CI using `lld` even for `gcc`. [#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) -* Allow to randomize thread scheduling and insert glitches when `THREAD_FUZZER_*` environment variables are set. This helps testing. [#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Enable secure sockets in stateless tests [#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) -* Make SPLIT_SHARED_LIBRARIES=OFF more robust [#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) -* Make "performance_introspection_and_logging" test reliable to random server stuck. This may happen in CI environment. See also [#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Validate XML in style check. [#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed race condition in test `00738_lock_for_inner_table`. This test relied on sleep. [#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Remove performance tests of type `once`. This is needed to run all performance tests in statistical comparison mode (more reliable). [#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added performance test for arithmetic functions. [#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added performance test for `sumMap` and `sumMapWithOverflow` aggregate functions. Follow-up for [#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Ensure style of ErrorCodes by style check. [#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Add script for tests history. [#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) -* Add GCC warning `-Wsuggest-override` to locate and fix all places where `override` keyword must be used. [#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -* Ignore weak symbol under Mac OS X because it must be defined [#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Deleted user](https://github.com/ghost)) -* Normalize running time of some queries in performance tests. This is done in preparation to run all the performance tests in comparison mode. [#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix some tests to support pytest with query tests [#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([Ivan](https://github.com/abyss7)) -* Enable SSL in build with MSan, so server will not fail at startup when running stateless tests [#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) -* Fix database substitution in test results [#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) -* Build fixes for miscellaneous platforms [#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) -* Added disks section to stateless-with-coverage test docker image [#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) -* Get rid of in-source-tree files when building with GRPC [#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos Bird](https://github.com/amosbird)) -* Slightly faster build time by removing SessionCleaner from Context. Make the code of SessionCleaner more simple. [#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Updated checking for hung queries in clickhouse-test script [#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) -* Removed some useless files from repository. [#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Changed type of math perftests from `once` to `loop`. [#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Add docker image which allows to build interactive code browser HTML report for our codebase. [#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin)) See [Woboq Code Browser](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) -* Suppress some test failures under MSan. [#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Speedup "exception while insert" test. This test often time out in debug-with-coverage build. [#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Updated `libcxx` and `libcxxabi` to master. In preparation to [#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix flacky test `00910_zookeeper_test_alter_compression_codecs`. [#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Clean up duplicated linker flags. Make sure the linker won't look up an unexpected symbol. [#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos Bird](https://github.com/amosbird)) -* Add `clickhouse-odbc` driver into test images. This allows to test interaction of ClickHouse with ClickHouse via its own ODBC driver. [#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) -* Fix several bugs in unit tests. [#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) -* Enable `-Wmissing-include-dirs` GCC warning to eliminate all non-existing includes - mostly as a result of CMake scripting errors [#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -* Describe reasons if query profiler cannot work. This is intended for [#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Update OpenSSL to upstream master. Fixed the issue when TLS connections may fail with the message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` and `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. The issue was present in version 20.1. [#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Update Dockerfile for server [#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) -* Minor fixes in build-gcc-from-sources script [#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) -* Replace `numbers` to `zeros` in perftests where `number` column is not used. This will lead to more clean test results. [#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fix stack overflow issue when using initializer_list in Column constructors. [#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Deleted user](https://github.com/ghost)) -* Upgrade librdkafka to v1.3.0. Enable bundled `rdkafka` and `gsasl` libraries on Mac OS X. [#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) -* build fix on GCC 9.2.0 [#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) - - -## ClickHouse release v20.1 - -### ClickHouse release v20.1.8.41, 2020-03-20 - -#### Bug Fix -* Fix possible permanent `Cannot schedule a task` error (due to unhandled exception in `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). This fixes [#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) -* Fix excessive memory consumption in `ALTER` queries (mutations). This fixes [#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) and [#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) -* Fix bug in backquoting in external dictionaries DDL. This fixes [#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) - -### ClickHouse release v20.1.7.38, 2020-03-18 - -#### Bug Fix -* Fixed incorrect internal function names for `sumKahan` and `sumWithOverflow`. I lead to exception while using this functions in remote queries. [#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). This issue was in all ClickHouse releases. -* Allow `ALTER ON CLUSTER` of `Distributed` tables with internal replication. This fixes [#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). This issue was in all ClickHouse releases. -* Fix possible exceptions `Size of filter doesn't match size of column` and `Invalid number of rows in Chunk` in `MergeTreeRangeReader`. They could appear while executing `PREWHERE` in some cases. Fixes [#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) -* Fixed the issue: timezone was not preserved if you write a simple arithmetic expression like `time + 1` (in contrast to an expression like `time + INTERVAL 1 SECOND`). This fixes [#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). This issue was in all ClickHouse releases. -* Now it's not possible to create or add columns with simple cyclic aliases like `a DEFAULT b, b DEFAULT a`. [#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -* Fixed the issue when padding at the end of base64 encoded value can be malformed. Update base64 library. This fixes [#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), closes [#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix data race at destruction of `Poco::HTTPServer`. It could happen when server is started and immediately shut down. [#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -* Fix possible crash/wrong number of rows in `LIMIT n WITH TIES` when there are a lot of rows equal to n'th row. [#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -* Fix possible mismatched checksums with column TTLs. [#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -* Fix crash when a user tries to `ALTER MODIFY SETTING` for old-formated `MergeTree` table engines family. [#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -* Now we will try finalize mutations more frequently. [#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -* Fix replication protocol incompatibility introduced in [#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -* Fix not(has()) for the bloom_filter index of array types. [#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) -* Fixed the behaviour of `match` and `extract` functions when haystack has zero bytes. The behaviour was wrong when haystack was constant. This fixes [#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Build/Testing/Packaging Improvement - -* Exception handling now works correctly on Windows Subsystem for Linux. See https://github.com/ClickHouse-Extras/libunwind/pull/3 This fixes [#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) - - -### ClickHouse release v20.1.6.30, 2020-03-05 - -#### Bug Fix - -* Fix data incompatibility when compressed with `T64` codec. -[#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) -* Fix order of ranges while reading from MergeTree table in one thread. Fixes [#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). -[#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) -* Fix possible segfault in `MergeTreeRangeReader`, while executing `PREWHERE`. Fixes [#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). -[#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) -* Fix `reinterpretAsFixedString` to return `FixedString` instead of `String`. -[#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) -* Fix `joinGet` with nullable return types. Fixes [#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) -[#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) -* Fix fuzz test and incorrect behaviour of bitTestAll/bitTestAny functions. -[#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) -* Fix the behaviour of match and extract functions when haystack has zero bytes. The behaviour was wrong when haystack was constant. Fixes [#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) -[#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) -* Fixed execution of inversed predicates when non-strictly monotinic functional index is used. Fixes [#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) -[#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) -* Allow to rewrite `CROSS` to `INNER JOIN` if there's `[NOT] LIKE` operator in `WHERE` section. Fixes [#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) -[#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) -* Allow first column(s) in a table with Log engine be an alias. -[#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) -* Allow comma join with `IN()` inside. Fixes [#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). -[#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) -* Improve `ALTER MODIFY/ADD` queries logic. Now you cannot `ADD` column without type, `MODIFY` default expression doesn't change type of column and `MODIFY` type doesn't loose default expression value. Fixes [#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). -[#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) -* Fix mutations finalization, when already done mutation can have status is_done=0. -[#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) -* Support "Processors" pipeline for system.numbers and system.numbers_mt. This also fixes the bug when `max_execution_time` is not respected. -[#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) -* Fix wrong counting of `DictCacheKeysRequestedFound` metric. -[#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) -* Added a check for storage policy in `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` which otherwise could make data of part inaccessible after restart and prevent ClickHouse to start. -[#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) -* Fixed UBSan report in `MergeTreeIndexSet`. This fixes [#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) -[#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) -* Fix possible datarace in BlockIO. -[#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) -* Support for `UInt64` numbers that don't fit in Int64 in JSON-related functions. Update `SIMDJSON` to master. This fixes [#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) -[#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) -* Fix the issue when the amount of free space is not calculated correctly if the data directory is mounted to a separate device. For default disk calculate the free space from data subdirectory. This fixes [#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) -[#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) -* Fix the issue when TLS connections may fail with the message `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Update OpenSSL to upstream master. -[#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) -* When executing `CREATE` query, fold constant expressions in storage engine arguments. Replace empty database name with current database. Fixes [#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Also fix check for local address in ClickHouseDictionarySource. -[#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -* Fix segfault in `StorageMerge`, which can happen when reading from StorageFile. -[#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) -* Prevent losing data in `Kafka` in rare cases when exception happens after reading suffix but before commit. Fixes [#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). Related: [#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) -[#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -* Fix bug leading to server termination when trying to use / drop `Kafka` table created with wrong parameters. Fixes [#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Incorporates [#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). -[#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) - -#### New Feature -* Add `deduplicate_blocks_in_dependent_materialized_views` option to control the behaviour of idempotent inserts into tables with materialized views. This new feature was added to the bugfix release by a special request from Altinity. -[#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### ClickHouse release v20.1.2.4, 2020-01-22 - -#### Backward Incompatible Change -* Make the setting `merge_tree_uniform_read_distribution` obsolete. The server still recognizes this setting but it has no effect. [#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Changed return type of the function `greatCircleDistance` to `Float32` because now the result of calculation is `Float32`. [#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Now it's expected that query parameters are represented in "escaped" format. For example, to pass string `ab` you have to write `a\tb` or `a\b` and respectively, `a%5Ctb` or `a%5C%09b` in URL. This is needed to add the possibility to pass NULL as `\N`. This fixes [#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Enable `use_minimalistic_part_header_in_zookeeper` setting for `ReplicatedMergeTree` by default. This will significantly reduce amount of data stored in ZooKeeper. This setting is supported since version 19.1 and we already use it in production in multiple services without any issues for more than half a year. Disable this setting if you have a chance to downgrade to versions older than 19.1. [#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Data skipping indices are production ready and enabled by default. The settings `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` and `allow_experimental_multiple_joins_emulation` are now obsolete and do nothing. [#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Add new `ANY JOIN` logic for `StorageJoin` consistent with `JOIN` operation. To upgrade without changes in behaviour you need add `SETTINGS any_join_distinct_right_table_keys = 1` to Engine Join tables metadata or recreate these tables after upgrade. [#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) -* Require server to be restarted to apply the changes in logging configuration. This is a temporary workaround to avoid the bug where the server logs to a deleted log file (see [#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### New Feature -* Added information about part paths to `system.merges`. [#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Add ability to execute `SYSTEM RELOAD DICTIONARY` query in `ON CLUSTER` mode. [#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) -* Add ability to execute `CREATE DICTIONARY` queries in `ON CLUSTER` mode. [#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) -* Now user's profile in `users.xml` can inherit multiple profiles. [#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -* Added `system.stack_trace` table that allows to look at stack traces of all server threads. This is useful for developers to introspect server state. This fixes [#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Add `DateTime64` datatype with configurable sub-second precision. [#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) -* Add table function `clusterAllReplicas` which allows to query all the nodes in the cluster. [#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari)) -* Add aggregate function `categoricalInformationValue` which calculates the information value of a discrete feature. [#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) -* Speed up parsing of data files in `CSV`, `TSV` and `JSONEachRow` format by doing it in parallel. [#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Add function `bankerRound` which performs banker's rounding. [#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) -* Support more languages in embedded dictionary for region names: 'ru', 'en', 'ua', 'uk', 'by', 'kz', 'tr', 'de', 'uz', 'lv', 'lt', 'et', 'pt', 'he', 'vi'. [#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Improvements in consistency of `ANY JOIN` logic. Now `t1 ANY LEFT JOIN t2` equals `t2 ANY RIGHT JOIN t1`. [#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -* Add setting `any_join_distinct_right_table_keys` which enables old behaviour for `ANY INNER JOIN`. [#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -* Add new `SEMI` and `ANTI JOIN`. Old `ANY INNER JOIN` behaviour now available as `SEMI LEFT JOIN`. [#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -* Added `Distributed` format for `File` engine and `file` table function which allows to read from `.bin` files generated by asynchronous inserts into `Distributed` table. [#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Add optional reset column argument for `runningAccumulate` which allows to reset aggregation results for each new key value. [#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) -* Add ability to use ClickHouse as Prometheus endpoint. [#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) -* Add section `` in `config.xml` which restricts allowed hosts for remote table engines and table functions `URL`, `S3`, `HDFS`. [#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) -* Added function `greatCircleAngle` which calculates the distance on a sphere in degrees. [#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Changed Earth radius to be consistent with H3 library. [#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added `JSONCompactEachRow` and `JSONCompactEachRowWithNamesAndTypes` formats for input and output. [#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) -* Added feature for file-related table engines and table functions (`File`, `S3`, `URL`, `HDFS`) which allows to read and write `gzip` files based on additional engine parameter or file extension. [#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) -* Added the `randomASCII(length)` function, generating a string with a random set of [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) printable characters. [#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([BayoNet](https://github.com/BayoNet)) -* Added function `JSONExtractArrayRaw` which returns an array on unparsed json array elements from `JSON` string. [#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) -* Add `arrayZip` function which allows to combine multiple arrays of equal lengths into one array of tuples. [#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([Winter Zhang](https://github.com/zhang2014)) -* Add ability to move data between disks according to configured `TTL`-expressions for `*MergeTree` table engines family. [#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Added new aggregate function `avgWeighted` which allows to calculate weighted average. [#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) -* Now parallel parsing is enabled by default for `TSV`, `TSKV`, `CSV` and `JSONEachRow` formats. [#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Add several geo functions from `H3` library: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` and `h3kRing`. [#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) -* Added support for brotli (`br`) compression in file-related storages and table functions. This fixes [#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Add `groupBit*` functions for the `SimpleAggregationFunction` type. [#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Bug Fix -* Fix rename of tables with `Distributed` engine. Fixes issue [#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -* Now dictionaries support `EXPRESSION` for attributes in arbitrary string in non-ClickHouse SQL dialect. [#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -* Fix broken `INSERT SELECT FROM mysql(...)` query. This fixes [#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) and [#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -* Fix error "Mismatch column sizes" when inserting default `Tuple` from `JSONEachRow`. This fixes [#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) -* Now an exception will be thrown in case of using `WITH TIES` alongside `LIMIT BY`. Also add ability to use `TOP` with `LIMIT BY`. This fixes [#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Fix unintendent dependency from fresh glibc version in `clickhouse-odbc-bridge` binary. [#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos Bird](https://github.com/amosbird)) -* Fix bug in check function of `*MergeTree` engines family. Now it doesn't fail in case when we have equal amount of rows in last granule and last mark (non-final). [#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) -* Fix insert into `Enum*` columns after `ALTER` query, when underlying numeric type is equal to table specified type. This fixes [#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) -* Allowed non-constant negative "size" argument for function `substring`. It was not allowed by mistake. This fixes [#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix parsing bug when wrong number of arguments passed to `(O|J)DBC` table engine. [#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) -* Using command name of the running clickhouse process when sending logs to syslog. In previous versions, empty string was used instead of command name. [#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) -* Fix check of allowed hosts for `localhost`. This PR fixes the solution provided in [#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -* Fix rare crash in `argMin` and `argMax` functions for long string arguments, when result is used in `runningAccumulate` function. This fixes [#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinosaur](https://github.com/769344359)) -* Fix memory overcommit for tables with `Buffer` engine. [#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) -* Fixed potential bug in functions that can take `NULL` as one of the arguments and return non-NULL. [#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Better metrics calculations in thread pool for background processes for `MergeTree` table engines. [#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix function `IN` inside `WHERE` statement when row-level table filter is present. Fixes [#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([Ivan](https://github.com/abyss7)) -* Now an exception is thrown if the integral value is not parsed completely for settings values. [#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) -* Fix exception when aggregate function is used in query to distributed table with more than two local shards. [#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -* Now bloom filter can handle zero length arrays and doesn't perform redundant calculations. [#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbab](https://github.com/achimbab)) -* Fixed checking if a client host is allowed by matching the client host to `host_regexp` specified in `users.xml`. [#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) -* Relax ambiguous column check that leads to false positives in multiple `JOIN ON` section. [#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) -* Fixed possible server crash (`std::terminate`) when the server cannot send or write data in `JSON` or `XML` format with values of `String` data type (that require `UTF-8` validation) or when compressing result data with Brotli algorithm or in some other rare cases. This fixes [#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix race condition in `StorageDistributedDirectoryMonitor` found by CI. This fixes [#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Now background merges in `*MergeTree` table engines family preserve storage policy volume order more accurately. [#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Now table engine `Kafka` works properly with `Native` format. This fixes [#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -* Fixed formats with headers (like `CSVWithNames`) which were throwing exception about EOF for table engine `Kafka`. [#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -* Fixed a bug with making set from subquery in right part of `IN` section. This fixes [#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) and [#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Fix possible crash while reading from storage `File`. [#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fixed reading of the files in `Parquet` format containing columns of type `list`. [#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([maxulan](https://github.com/maxulan)) -* Fix error `Not found column` for distributed queries with `PREWHERE` condition dependent on sampling key if `max_parallel_replicas > 1`. [#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fix error `Not found column` if query used `PREWHERE` dependent on table's alias and the result set was empty because of primary key condition. [#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fixed return type for functions `rand` and `randConstant` in case of `Nullable` argument. Now functions always return `UInt32` and never `Nullable(UInt32)`. [#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Disabled predicate push-down for `WITH FILL` expression. This fixes [#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([Winter Zhang](https://github.com/zhang2014)) -* Fixed incorrect `count()` result for `SummingMergeTree` when `FINAL` section is used. [#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Fix possible incorrect result for constant functions from remote servers. It happened for queries with functions like `version()`, `uptime()`, etc. which returns different constant values for different servers. This fixes [#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fix complicated bug in push-down predicate optimization which leads to wrong results. This fixes a lot of issues on push-down predicate optimization. [#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([Winter Zhang](https://github.com/zhang2014)) -* Fix crash in `CREATE TABLE .. AS dictionary` query. [#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) -* Several improvements ClickHouse grammar in `.g4` file. [#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) -* Fix bug that leads to crashes in `JOIN`s with tables with engine `Join`. This fixes [#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) -* Fix redundant dictionaries reload on `CREATE DATABASE`. [#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) -* Limit maximum number of streams for read from `StorageFile` and `StorageHDFS`. Fixes https://github.com/ClickHouse/ClickHouse/issues/7650. [#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -* Fix bug in `ALTER ... MODIFY ... CODEC` query, when user specify both default expression and codec. Fixes [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) -* Fix error in background merge of columns with `SimpleAggregateFunction(LowCardinality)` type. [#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fixed type check in function `toDateTime64`. [#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) -* Now server do not crash on `LEFT` or `FULL JOIN` with and Join engine and unsupported `join_use_nulls` settings. [#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) -* Now `DROP DICTIONARY IF EXISTS db.dict` query doesn't throw exception if `db` doesn't exist. [#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -* Fix possible crashes in table functions (`file`, `mysql`, `remote`) caused by usage of reference to removed `IStorage` object. Fix incorrect parsing of columns specified at insertion into table function. [#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) -* Ensure network be up before starting `clickhouse-server`. This fixes [#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) -* Fix timeouts handling for secure connections, so queries doesn't hang indefenitely. This fixes [#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix `clickhouse-copier`'s redundant contention between concurrent workers. [#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -* Now mutations doesn't skip attached parts, even if their mutation version were larger than current mutation version. [#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -* Ignore redundant copies of `*MergeTree` data parts after move to another disk and server restart. [#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix crash in `FULL JOIN` with `LowCardinality` in `JOIN` key. [#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) -* Forbidden to use column name more than once in insert query like `INSERT INTO tbl (x, y, x)`. This fixes [#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) -* Added fallback for detection the number of physical CPU cores for unknown CPUs (using the number of logical CPU cores). This fixes [#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix `There's no column` error for materialized and alias columns. [#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) -* Fixed sever crash when `EXISTS` query was used without `TABLE` or `DICTIONARY` qualifier. Just like `EXISTS t`. This fixes [#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). This bug was introduced in version 19.17. [#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix rare bug with error `"Sizes of columns doesn't match"` that might appear when using `SimpleAggregateFunction` column. [#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -* Fix bug where user with empty `allow_databases` got access to all databases (and same for `allow_dictionaries`). [#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) -* Fix client crash when server already disconnected from client. [#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -* Fix `ORDER BY` behaviour in case of sorting by primary key prefix and non primary key suffix. [#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) -* Check if qualified column present in the table. This fixes [#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) -* Fixed behavior with `ALTER MOVE` ran immediately after merge finish moves superpart of specified. Fixes [#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix possible server crash while using `UNION` with different number of columns. Fixes [#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fix size of result substring for function `substr` with negative size. [#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Now server does not execute part mutation in `MergeTree` if there are not enough free threads in background pool. [#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) -* Fix a minor typo on formatting `UNION ALL` AST. [#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) -* Fixed incorrect bloom filter results for negative numbers. This fixes [#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([Winter Zhang](https://github.com/zhang2014)) -* Fixed potential buffer overflow in decompress. Malicious user can pass fabricated compressed data that will cause read after buffer. This issue was found by Eldar Zaitov from Yandex information security team. [#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix incorrect result because of integers overflow in `arrayIntersect`. [#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Now `OPTIMIZE TABLE` query will not wait for offline replicas to perform the operation. [#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) -* Fixed `ALTER TTL` parser for `Replicated*MergeTree` tables. [#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix communication between server and client, so server read temporary tables info after query failure. [#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -* Fix `bitmapAnd` function error when intersecting an aggregated bitmap and a scalar bitmap. [#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -* Refine the definition of `ZXid` according to the ZooKeeper Programmer's Guide which fixes bug in `clickhouse-cluster-copier`. [#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -* `odbc` table function now respects `external_table_functions_use_nulls` setting. [#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) -* Fixed bug that lead to a rare data race. [#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -* Now `SYSTEM RELOAD DICTIONARY` reloads a dictionary completely, ignoring `update_field`. This fixes [#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) -* Add ability to check if dictionary exists in create query. [#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) -* Fix `Float*` parsing in `Values` format. This fixes [#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -* Fix crash when we cannot reserve space in some background operations of `*MergeTree` table engines family. [#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix crash of merge operation when table contains `SimpleAggregateFunction(LowCardinality)` column. This fixes [#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) -* Restore support of all ICU locales and add the ability to apply collations for constant expressions. Also add language name to `system.collations` table. [#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -* Fix bug when external dictionaries with zero minimal lifetime (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) don't update in background. [#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) -* Fix crash when external dictionary with ClickHouse source has subquery in query. [#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Fix incorrect parsing of file extension in table with engine `URL`. This fixes [#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) -* Fix `CHECK TABLE` query for `*MergeTree` tables without key. Fixes [#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -* Fixed conversion of `Float64` to MySQL type. [#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) -* Now if table was not completely dropped because of server crash, server will try to restore and load it. [#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -* Fixed crash in table function `file` while inserting into file that doesn't exist. Now in this case file would be created and then insert would be processed. [#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -* Fix rare deadlock which can happen when `trace_log` is in enabled. [#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -* Add ability to work with different types besides `Date` in `RangeHashed` external dictionary created from DDL query. Fixes [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -* Fixes crash when `now64()` is called with result of another function. [#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) -* Fixed bug with detecting client IP for connections through mysql wire protocol. [#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) -* Fix empty array handling in `arraySplit` function. This fixes [#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) -* Fixed the issue when `pid-file` of another running `clickhouse-server` may be deleted. [#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) -* Fix dictionary reload if it has `invalidate_query`, which stopped updates and some exception on previous update tries. [#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) -* Fixed error in function `arrayReduce` that may lead to "double free" and error in aggregate function combinator `Resample` that may lead to memory leak. Added aggregate function `aggThrow`. This function can be used for testing purposes. [#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Improvement -* Improved logging when working with `S3` table engine. [#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -* Printed help message when no arguments are passed when calling `clickhouse-local`. This fixes [#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) -* Add setting `mutations_sync` which allows to wait `ALTER UPDATE/DELETE` queries synchronously. [#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) -* Allow to set up relative `user_files_path` in `config.xml` (in the way similar to `format_schema_path`). [#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) -* Add exception for illegal types for conversion functions with `-OrZero` postfix. [#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) -* Simplify format of the header of data sending to a shard in a distributed query. [#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) -* `Live View` table engine refactoring. [#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) -* Add additional checks for external dictionaries created from DDL-queries. [#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) -* Fix error `Column ... already exists` while using `FINAL` and `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Fixes [#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Now table the first argument of `joinGet` function can be table indentifier. [#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos Bird](https://github.com/amosbird)) -* Allow using `MaterializedView` with subqueries above `Kafka` tables. [#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) -* Now background moves between disks run it the seprate thread pool. [#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) -* `SYSTEM RELOAD DICTIONARY` now executes synchronously. [#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) -* Stack traces now display physical addresses (offsets in object file) instead of virtual memory addresses (where the object file was loaded). That allows the use of `addr2line` when binary is position independent and ASLR is active. This fixes [#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Support new syntax for row-level security filters: `…
`. Fixes [#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([Ivan](https://github.com/abyss7)) -* Now `cityHash` function can work with `Decimal` and `UUID` types. Fixes [#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) -* Removed fixed index granularity (it was 1024) from system logs because it's obsolete after implementation of adaptive granularity. [#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Enabled MySQL compatibility server when ClickHouse is compiled without SSL. [#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) -* Now server checksums distributed batches, which gives more verbose errors in case of corrupted data in batch. [#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) -* Support `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` and `ATTACH TABLE` for `MySQL` database engine. [#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([Winter Zhang](https://github.com/zhang2014)) -* Add authentication in S3 table function and table engine. [#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Added check for extra parts of `MergeTree` at different disks, in order to not allow to miss data parts at undefined disks. [#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Enable SSL support for Mac client and server. [#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([Ivan](https://github.com/abyss7)) -* Now ClickHouse can work as MySQL federated server (see https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) -* `clickhouse-client` now only enable `bracketed-paste` when multiquery is on and multiline is off. This fixes (#7757)[https://github.com/ClickHouse/ClickHouse/issues/7757]. [#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos Bird](https://github.com/amosbird)) -* Support `Array(Decimal)` in `if` function. [#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) -* Support Decimals in `arrayDifference`, `arrayCumSum` and `arrayCumSumNegative` functions. [#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) -* Added `lifetime` column to `system.dictionaries` table. [#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekekule](https://github.com/kekekekule)) -* Improved check for existing parts on different disks for `*MergeTree` table engines. Addresses [#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Integration with `AWS SDK` for `S3` interactions which allows to use all S3 features out of the box. [#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) -* Added support for subqueries in `Live View` tables. [#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) -* Check for using `Date` or `DateTime` column from `TTL` expressions was removed. [#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Information about disk was added to `system.detached_parts` table. [#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Now settings `max_(table|partition)_size_to_drop` can be changed without a restart. [#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -* Slightly better usability of error messages. Ask user not to remove the lines below `Stack trace:`. [#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Better reading messages from `Kafka` engine in various formats after [#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([Ivan](https://github.com/abyss7)) -* Better compatibility with MySQL clients which don't support `sha2_password` auth plugin. [#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) -* Support more column types in MySQL compatibility server. [#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) -* Implement `ORDER BY` optimization for `Merge`, `Buffer` and `Materilized View` storages with underlying `MergeTree` tables. [#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) -* Now we always use POSIX implementation of `getrandom` to have better compatibility with old kernels (< 3.17). [#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos Bird](https://github.com/amosbird)) -* Better check for valid destination in a move TTL rule. [#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Better checks for broken insert batches for `Distributed` table engine. [#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) -* Add column with array of parts name which mutations must process in future to `system.mutations` table. [#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) -* Parallel merge sort optimization for processors. [#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* The settings `mark_cache_min_lifetime` is now obsolete and does nothing. In previous versions, mark cache can grow in memory larger than `mark_cache_size` to accomodate data within `mark_cache_min_lifetime` seconds. That was leading to confusion and higher memory usage than expected, that is especially bad on memory constrained systems. If you will see performance degradation after installing this release, you should increase the `mark_cache_size`. [#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Preparation to use `tid` everywhere. This is needed for [#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Performance Improvement -* Performance optimizations in processors pipeline. [#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Non-blocking updates of expired keys in cache dictionaries (with permission to read old ones). [#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Compile ClickHouse without `-fno-omit-frame-pointer` globally to spare one more register. [#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos Bird](https://github.com/amosbird)) -* Speedup `greatCircleDistance` function and add performance tests for it. [#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) -* Improved performance of function `roundDown`. [#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Improved performance of `max`, `min`, `argMin`, `argMax` for `DateTime64` data type. [#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) -* Improved performance of sorting without a limit or with big limit and external sorting. [#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Improved performance of formatting floating point numbers up to 6 times. [#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Improved performance of `modulo` function. [#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos Bird](https://github.com/amosbird)) -* Optimized `ORDER BY` and merging with single column key. [#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Better implementation for `arrayReduce`, `-Array` and `-State` combinators. [#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos Bird](https://github.com/amosbird)) -* Now `PREWHERE` should be optimized to be at least as efficient as `WHERE`. [#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos Bird](https://github.com/amosbird)) -* Improve the way `round` and `roundBankers` handling negative numbers. [#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) -* Improved decoding performance of `DoubleDelta` and `Gorilla` codecs by roughly 30-40%. This fixes [#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) -* Improved performance of `base64` related functions. [#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Added a function `geoDistance`. It is similar to `greatCircleDistance` but uses approximation to WGS-84 ellipsoid model. The performance of both functions are near the same. [#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Faster `min` and `max` aggregation functions for `Decimal` data type. [#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) -* Vectorize processing `arrayReduce`. [#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Bird](https://github.com/amosbird)) -* `if` chains are now optimized as `multiIf`. [#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) -* Fix performance regression of `Kafka` table engine introduced in 19.15. This fixes [#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) -* Removed "pie" code generation that `gcc` from Debian packages occasionally brings by default. [#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Parallel parsing data formats [#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -* Enable optimized parser of `Values` with expressions by default (`input_format_values_deduce_templates_of_expressions=1`). [#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) - -#### Build/Testing/Packaging Improvement -* Build fixes for `ARM` and in minimal mode. [#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) -* Add coverage file flush for `clickhouse-server` when std::atexit is not called. Also slightly improved logging in stateless tests with coverage. [#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) -* Update LLVM library in contrib. Avoid using LLVM from OS packages. [#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Make bundled `curl` build fully quiet. [#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) -* Fix some `MemorySanitizer` warnings. [#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Use `add_warning` and `no_warning` macros in `CMakeLists.txt`. [#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([Ivan](https://github.com/abyss7)) -* Add support of Minio S3 Compatible object (https://min.io/) for better integration tests. [#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) -* Imported `libc` headers to contrib. It allows to make builds more consistent across various systems (only for `x86_64-linux-gnu`). [#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Remove `-fPIC` from some libraries. [#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Clean `CMakeLists.txt` for curl. See https://github.com/ClickHouse/ClickHouse/pull/8011#issuecomment-569478910 [#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Silent warnings in `CapNProto` library. [#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Add performance tests for short string optimized hash tables. [#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos Bird](https://github.com/amosbird)) -* Now ClickHouse will build on `AArch64` even if `MADV_FREE` is not available. This fixes [#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos Bird](https://github.com/amosbird)) -* Update `zlib-ng` to fix memory sanitizer problems. [#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Enable internal MySQL library on non-Linux system, because usage of OS packages is very fragile and usually doesn't work at all. This fixes [#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed build on some systems after enabling `libc++`. This supersedes [#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Make `Field` methods more type-safe to find more errors. [#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Added missing files to the `libc-headers` submodule. [#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix wrong `JSON` quoting in performance test output. [#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Now stack trace is displayed for `std::exception` and `Poco::Exception`. In previous versions it was available only for `DB::Exception`. This improves diagnostics. [#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Porting `clock_gettime` and `clock_nanosleep` for fresh glibc versions. [#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos Bird](https://github.com/amosbird)) -* Enable `part_log` in example config for developers. [#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix async nature of reload in `01036_no_superfluous_dict_reload_on_create_database*`. [#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) -* Fixed codec performance tests. [#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) -* Add install scripts for `.tgz` build and documentation for them. [#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) -* Removed old `ZSTD` test (it was created in year 2016 to reproduce the bug that pre 1.0 version of ZSTD has had). This fixes [#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed build on Mac OS Catalina. [#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) -* Increased number of rows in codec performance tests to make results noticeable. [#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) -* In debug builds, treat `LOGICAL_ERROR` exceptions as assertion failures, so that they are easier to notice. [#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Make formats-related performance test more deterministic. [#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Update `lz4` to fix a MemorySanitizer failure. [#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Suppress a known MemorySanitizer false positive in exception handling. [#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Update `gcc` and `g++` to version 9 in `build/docker/build.sh` [#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) -* Add performance test case to test that `PREWHERE` is worse than `WHERE`. [#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos Bird](https://github.com/amosbird)) -* Progress towards fixing one flacky test. [#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Avoid MemorySanitizer report for data from `libunwind`. [#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Updated `libc++` to the latest version. [#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Build ICU library from sources. This fixes [#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Switched from `libressl` to `openssl`. ClickHouse should support TLS 1.3 and SNI after this change. This fixes [#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fixed UBSan report when using `chacha20_poly1305` from SSL (happens on connect to https://yandex.ru/). [#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix mode of default password file for `.deb` linux distros. [#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) -* Improved expression for getting `clickhouse-server` PID in `clickhouse-test`. [#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) -* Updated contrib/googletest to v1.10.0. [#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) -* Fixed ThreadSaninitizer report in `base64` library. Also updated this library to the latest version, but it doesn't matter. This fixes [#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Fix `00600_replace_running_query` for processors. [#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Remove support for `tcmalloc` to make `CMakeLists.txt` simpler. [#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Release gcc builds now use `libc++` instead of `libstdc++`. Recently `libc++` was used only with clang. This will improve consistency of build configurations and portability. [#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Enable ICU library for build with MemorySanitizer. [#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Suppress warnings from `CapNProto` library. [#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Removed special cases of code for `tcmalloc`, because it's no longer supported. [#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* In CI coverage task, kill the server gracefully to allow it to save the coverage report. This fixes incomplete coverage reports we've been seeing lately. [#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) -* Performance tests for all codecs against `Float64` and `UInt64` values. [#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) -* `termcap` is very much deprecated and lead to various problems (f.g. missing "up" cap and echoing `^J` instead of multi line) . Favor `terminfo` or bundled `ncurses`. [#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos Bird](https://github.com/amosbird)) -* Fix `test_storage_s3` integration test. [#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Support `StorageFile(, null) ` to insert block into given format file without actually write to disk. This is required for performance tests. [#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos Bird](https://github.com/amosbird)) -* Added argument `--print-time` to functional tests which prints execution time per test. [#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Added asserts to `KeyCondition` while evaluating RPN. This will fix warning from gcc-9. [#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Dump cmake options in CI builds. [#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Don't generate debug info for some fat libraries. [#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Make `log_to_console.xml` always log to stderr, regardless of is it interactive or not. [#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) -* Removed some unused features from `clickhouse-performance-test` tool. [#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Now we will also search for `lld-X` with corresponding `clang-X` version. [#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) -* Parquet build improvement. [#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([maxulan](https://github.com/maxulan)) -* More GCC warnings [#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -* Package for Arch Linux now allows to run ClickHouse server, and not only client. [#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) -* Fix test with processors. Tiny performance fixes. [#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -* Update contrib/protobuf. [#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) -* In preparation of switching to c++20 as a new year celebration. "May the C++ force be with ClickHouse." [#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos Bird](https://github.com/amosbird)) - -#### Experimental Feature -* Added experimental setting `min_bytes_to_use_mmap_io`. It allows to read big files without copying data from kernel to userspace. The setting is disabled by default. Recommended threshold is about 64 MB, because mmap/munmap is slow. [#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) -* Reworked quotas as a part of access control system. Added new table `system.quotas`, new functions `currentQuota`, `currentQuotaKey`, new SQL syntax `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) -* Allow skipping unknown settings with warnings instead of throwing exceptions. [#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) -* Reworked row policies as a part of access control system. Added new table `system.row_policies`, new function `currentRowPolicies()`, new SQL syntax `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Security Fix -* Fixed the possibility of reading directories structure in tables with `File` table engine. This fixes [#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## [Changelog for 2019](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) diff --git a/docs/ru/whats_new/extended_roadmap.md b/docs/ru/whats_new/extended_roadmap.md deleted file mode 100644 index 12668b74ef4..00000000000 --- a/docs/ru/whats_new/extended_roadmap.md +++ /dev/null @@ -1,1950 +0,0 @@ -# Планы разработки ClickHouse 2020. {#plany-razrabotki-clickhouse-2020} - -Здесь собраны важные задачи на 2020 год. Многие из них присутствуют в GitHub Issues. Данный текст следует рассматривать как рабочий черновик со сводкой и кратким описанием задач, ссылками и материалами для быстрого доступа на одной странице. Классификация задач условная. - -Так как ClickHouse - open-source продукт, мы хотим, чтобы рабочий процесс был также максимально открытым. В связи с этим, вам следует ожидать наличия на данной странице несколько большего количества деталей описания рабочего процесса, чем вы могли бы предположить - настолько близко, насколько рабочий процесс видят разработчики. Так как неотъемлимой частью процесса разработки является исправление недостатков продукта и улучшение качества кода, на данной странице вы найдёте весьма подробные описания таких деталей. Для других open-source продуктов такой подход к разработке обычно нехарактерен. Благодаря тому, что для каждой задачи указаны её зависимости, вы сможете понять, какие подготовительные работы требуются, что позволяет более точно понимать сроки реализации. - -## 1. Хранение данных, индексация. {#khranenie-dannykh-indeksatsiia} - -### 1.1. Индексы по z-Order curve, normalized z-Order curve. {#indeksy-po-z-order-curve-normalized-z-order-curve} - -[\#6286](https://github.com/ClickHouse/ClickHouse/pull/6286) - -Задача также относится к категории «17. Работа с географическими данными», так как geoHash - это частный случай z-Order curve. -Также связана с задачей 24.27 для нечёткого поиска полудубликатов строк, так как позволит индексировать min-hash. -Задача «normalized z-Order curve» в перспективе может быть полезна для БК и Метрики, так как позволяет смешивать OrderID и PageID и избежать дублирования данных. -В задаче также вводится способ индексации путём обращения функции нескольких аргументов на интервале, что имеет смысл для дальнейшего развития. - -[Андрей Чулков](https://github.com/achulkov2), ВШЭ. - -### 1.2. Wait-free каталог баз данных. {#wait-free-katalog-baz-dannykh} - -Q2. Делает [Александр Токмаков](https://github.com/tavplubix), первый рабочий вариант в декабре 2019. Нужно для DataLens и Яндекс.Метрики. - -Манипуляции с каталогом баз данных: запросы CREATE TABLE, DROP TABLE, RENAME TABLE и DATABASE, требуют синхронизации с помощью блокировок. Эта синхронизация становится весьма сложной, так как на неё полагается много внутренних структур данных. - -Предлагается реализовать альтернативный подход, в котором таблицы и базы данных являются всего лишь ссылками на persistent объекты. Подробное описание задачи: [\#6787](https://github.com/ClickHouse/ClickHouse/issues/6787) - -Upd. Сделана крупная часть задачи, но ориентироваться стоит уже на Q2. -Upd. Pull request готов для мержа. - -### 1.3. Неблокирующие ALTER. {#neblokiruiushchie-alter} - -Q1. И полностью immutable куски. Делает [Александр Сапин](https://github.com/alesapin). Готов приступить к задаче в конце ноября 2019. Нужно для Яндекс.Метрики. - -Upd. Большая часть задачи реализована и добавлена в master. Есть незначительные технические долги. Остаётся реализация неблокирующего изменения метаданных таблицы. - -### 1.4. + Нетранзитивные ALTER столбцов. {#netranzitivnye-alter-stolbtsov} - -Требует 1.3. Будет делать [Александр Сапин](https://github.com/alesapin). Ура, сделано. - -### 1.5. + ALTER RENAME COLUMN. {#alter-rename-column} - -[\#6861](https://github.com/ClickHouse/ClickHouse/issues/6861) - -Требует 1.3. Будет делать [Александр Сапин](https://github.com/alesapin). - -### 1.6. + Полиморфные куски данных. {#polimorfnye-kuski-dannykh} - -Компактные куски - Q1, куски в оперативке Q1/Q2 - пункт 1.7. - -Компактные куски реализованы, ещё не включены по-умолчанию. Первым шагом включаем по-умолчанию для системных таблиц. - -Upd. Включено для системных таблиц. - -Делает [Антон Попов](https://github.com/CurtizJ), первый рабочий вариант в декабре. Пререквизит чтобы снизить сложность мелких INSERT, что в свою очередь нужно для 1.12, иначе задача 1.12 не сможет нормально работать. Особенно нужно для Яндекс.Облака. - -Данные в таблицах типа MergeTree в ClickHouse хранятся в виде набора независимых «кусков». Внутри куска, каждый столбец, а также индекс, хранится в отдельных файлах. Это сделано для возможности быстрых манипуляций со столбцами (пример - запрос ALTER DROP COLUMN). При вставке данных (INSERT), создаётся новый кусок. Для таблиц с большим количеством столбцов, запросы INSERT с маленьким количеством строк являются неэффективными, так как требуют создания большого количества файлов в файловой системе. Это является врождённой особенностью ClickHouse - одной из первой проблем, с которыми сталкиваются пользователи. Пользователям приходится буферизовывать данные и собирать их в более крупные пачки перед вставкой в ClickHouse. - -Для смягчения эффекта от этой проблемы, в ClickHouse существуют таблицы типа Buffer. Они накапливают данные в оперативке перед записью в другую таблицу. Впрочем, таблицы Buffer не являются полноценным решением проблемы из-за: - наличия блокировок при вставке; - переупорядочивание вставляемых данных; - неатомарность перекладывания данных из Buffer в результирующую таблицу. - -Вместо этого предлагается разрешить кускам таблиц типа MergeTree располагать данные в разных форматах. А именно: - в оперативной памяти; - на диске со всеми столбцами в одном файле; - на диске со столбцами в отдельных файлах: в зависимости от размера куска и прошедшего времени. Для размещения кусков в оперативной памяти, придётся также реализовать опциональную поддержку write-ahead log с настраиваемыми правилами по сбросу на диск. Это позволит избавиться от проблем с мелкими вставками для MergeTree таблиц. Для ReplicatedMergeTree таблиц, это решит проблему лишь частично. - -### 1.7. Буферизация и WAL в MergeTree. {#buferizatsiia-i-wal-v-mergetree} - -Требует 1.6. Антон Попов. Задача взята в работу. Q2. - -### 1.8. + Перенос между разделами по TTL. {#perenos-mezhdu-razdelami-po-ttl} - -Делает [Владимир Чеботарёв](https://github.com/excitoon), Altinity. Декабрь 2019. - -Q1. Закоммичено, но есть технический долг, который исправляется сейчас. -Готово. - -### 1.9. Использование TTL для прореживания данных. {#ispolzovanie-ttl-dlia-prorezhivaniia-dannykh} - -Будет делать Сорокин Николай, ВШЭ и Яндекс. - -Сейчас пользователь может задать в таблице выражение, которое определяет, сколько времени хранятся данные. Обычно это выражение задаётся относительно значения столбца с датой - например: удалять данные через три месяца. https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/\#table_engine-mergetree-ttl - -Это может быть задано для всей таблицы (тогда строки целиком удаляются после указанного времени) или для отдельных столбцов (тогда данные столбца физически удаляются с диска, а строки в таблице остаются; при чтении значений столбца, они читаются как значения по-умолчанию). - -Но пользователи также хотят более продвинутый вариант этой функциональности: не удалять строки или столбцы целиком, а прореживать их - оставлять меньшее количество строк. - -И тут есть несколько вариантов: -1. По прошествии времени, оставлять каждую N-ую строку. -2. По прошествии времени, выполнять агрегацию данных, заменяя значения некоторых столбцов на значения агрегатных функций от множества значений в нескольких строках. - -Пункт 1 не представляет интереса, так как уже реализован с помощью TTL выражений для удаления данных. В качестве этого выражения можно прописать, например, `cityHash64(*) % 10 = 0 ? now() : event_time + INTERVAL 3 MONTH`. Правда как-то неудобно получается. - -А вот пункт 2 требуется продумать. Не очевидно даже, какой лучше использовать синтаксис для этого при создании таблицы. Но мы придумаем - сразу видно несколько вариантов. - -Частный случай такой задачи уже есть в https://clickhouse.tech/docs/ru/operations/table_engines/graphitemergetree/ Но это было сделано для конкретной задачи. А надо обобщить. - -### 1.10. Пережатие старых данных в фоне. {#perezhatie-starykh-dannykh-v-fone} - -Будет делать Кирилл Барухов, ВШЭ, экспериментальная реализация к весне 2020. Нужно для Яндекс.Метрики. - -Алгоритмы сжатия типа LZ77 позволяют потратить больше времени на сжатие данных, чтобы сжать данные сильнее, но при этом без проигрыша по скорости разжатия данных. В частности, этим свойством обладает LZ4 и ZSTD, которые используются в ClickHouse. Это позволяет использовать свободные ресурсы CPU, когда сервер не нагружен, для пережатия данных, чтобы данные занимали меньше места на дисках, и при этом сохранить или даже улучшить скорость обработки запросов. - -В то же время, ClickHouse обычно используется для «импульсного» сценария нагрузки. Запрос от пользователя обрабатывается максимально быстро, используя все ресурсы CPU, но в среднем по времени, сервер недостаточно нагружен. - -Предлагается добавить в ClickHouse настройки по пережатию данных и фоновые потоки, выполняющие эту задачу. - -### 1.11. + Виртуальная файловая система. {#virtualnaia-failovaia-sistema} - -На VFS переведены Log, TinyLog, StripeLog, а также MergeTree, что доказывает состоятельность реализации. - -Нужно для Яндекс.Облака. Делает Александр, Яндекс.Облако. - -ClickHouse использует для хранения данных локальную файловую систему. Существует сценарий работы, в котором размещение старых (архивных) данных было бы выгодно на удалённой файловой системе. Если файловая система POSIX совместимая, то это не составляет проблем: ClickHouse успешно работает с Ceph, GlusterFS, MooseFS. Также востребованным является сценарий использования S3 (из-за доступности в облаке) или HDFS (для интеграции с Hadoop). Но эти файловые системы не являются POSIX совместимыми. Хотя для них существуют FUSE драйверы, но скорость работы сильно страдает и поддержка неполная. - -ClickHouse использует небольшое подмножество функций ФС, но в то же время, и некоторые специфические части: симлинки и хардлинки, O_DIRECT. Предлагается выделить всё взаимодействие с файловой системой в отдельный интерфейс. - -### 1.12. Экспериментальная реализация VFS поверх S3 и HDFS. {#eksperimentalnaia-realizatsiia-vfs-poverkh-s3-i-hdfs} - -Q2. - -Нужно для Яндекс.Облака. Требует 1.11. Желательно 1.6 и 1.18. -Делает Александр, Яндекс.Облако (сначала часть для S3), а также Олег Ершов, ВШЭ и Яндекс. - -Upd. Олег будет делать только часть про HDFS. - -Upd. Реализация поверх S3 является рабочей на уровне PoC. - -### 1.13. Ускорение запросов с FINAL. {#uskorenie-zaprosov-s-final} - -Требует 2.1. Делает [Николай Кочетов](https://github.com/KochetovNicolai). Нужно для Яндекс.Метрики. Q2. - -### 1.14. Не писать столбцы, полностью состоящие из нулей. {#ne-pisat-stolbtsy-polnostiu-sostoiashchie-iz-nulei} - -Антон Попов. Q2. -В очереди. Простая задача, является небольшим пререквизитом для потенциальной поддержки полуструктурированных данных. - -### 1.15. Возможность иметь разный первичный ключ в разных кусках. {#vozmozhnost-imet-raznyi-pervichnyi-kliuch-v-raznykh-kuskakh} - -Сложная задача, только после 1.3. - -### 1.16. Несколько физических представлений для одного куска данных. {#neskolko-fizicheskikh-predstavlenii-dlia-odnogo-kuska-dannykh} - -Сложная задача, только после 1.3 и 1.6. Позволяет компенсировать 21.20. - -### 1.17. Несколько сортировок для одной таблицы. {#neskolko-sortirovok-dlia-odnoi-tablitsy} - -Сложная задача, только после 1.3 и 1.6. - -### 1.18. Отдельное хранение файлов кусков. {#otdelnoe-khranenie-failov-kuskov} - -Требует 1.3 и 1.6. Полная замена hard links на sym links, что будет лучше для 1.12. - - -## 2. Крупные рефакторинги. {#krupnye-refaktoringi} - -Для обоснования необходимости смотрите ссылки в описании других задач. - -### 2.1. Переделка конвейера выполнения запросов на Processors. {#peredelka-konveiera-vypolneniia-zaprosov-na-processors} - -Делает [Николай Кочетов](https://github.com/KochetovNicolai). Финальная стадия разработки. Включение по-умолчанию в конце декабря 2019. Удаление старого кода в начале 2020. - -Upd. На данный момент исправляются проблемы с регрессиями производительности в отдельных случаях. Кажется, что все проблемы исправлены. -Включение по-умолчанию в Q1, но остаётся вторая часть задачи по корректному выделению async части. - -Upd. Включили по-умолчанию. Удаление старого кода не раньше, чем после первого релиза, в котором это включено по-умолчанию и всё ещё можно выключить обратно. - -Upd. Уже есть первый релиз, в котором это включено по-умолчанию. - -Upd. Всё ещё ждём удаление старого кода, которое должно случиться после релиза 20.4. - -### 2.2. Инфраструктура событий/метрик/ограничений/квот/трассировки. {#infrastruktura-sobytiimetrikogranicheniikvottrassirovki} - -В очереди. https://gist.github.com/alexey-milovidov/d62d73222d83b9319dc519cbb13aeff6 - -### 2.3. Перенос столбцового ser/de из DataType в Column. {#perenos-stolbtsovogo-serde-iz-datatype-v-column} - -В очереди. - -### 2.4. Перевод LowCardinality из DataType в Column. Добавление ColumnSparse. {#perevod-lowcardinality-iz-datatype-v-column-dobavlenie-columnsparse} - -Требует 2.3. - -### 2.5. Версионирование состояний агрегатных функций. {#versionirovanie-sostoianii-agregatnykh-funktsii} - -В очереди. - -### 2.6. Правая часть IN как тип данных. Выполнение IN в виде скалярного подзапроса. {#pravaia-chast-in-kak-tip-dannykh-vypolnenie-in-v-vide-skaliarnogo-podzaprosa} - -Требует 2.1. - -### 2.7. Нормализация Context. {#normalizatsiia-context} - -В очереди. Нужно для YQL. - -Александр Токмаков исправил множество проблем с использованием Context и сейчас переносит каталог БД наружу. - -Upd. Каталог БД вынесен из Context. -Upd. SharedContext вынесен из Context. - -### 2.8. Декларативный парсер запросов. {#deklarativnyi-parser-zaprosov} - -Средний приоритет. Нужно для YQL. - -Upd. В очереди. Иван Лежанкин. - -### 2.9. Логгировние в format-стиле. {#loggirovnie-v-format-stile} - -Делает [Иван Лежанкин](https://github.com/abyss7). Низкий приоритет. -[\#6049](https://github.com/ClickHouse/ClickHouse/issues/6049#issuecomment-570836998) - -### 2.10. Запрашивать у таблиц не столбцы, а срезы. {#zaprashivat-u-tablits-ne-stolbtsy-a-srezy} - -В очереди. - -### 2.11. Разбирательство и нормализация функциональности для bitmap. {#razbiratelstvo-i-normalizatsiia-funktsionalnosti-dlia-bitmap} - -В очереди. - -### 2.12. Декларативные сигнатуры функций. {#deklarativnye-signatury-funktsii} - -[\#3775](https://github.com/ClickHouse/ClickHouse/pull/3775) - -Задачу делает Алексей Миловидов. Прогресс 50% и разработка временно приостановлена. - -Upd. Разработка всё ещё приостановлена. - -### 2.13. Каждая функция в отдельном файле. {#kazhdaia-funktsiia-v-otdelnom-faile} - -Задачу делает Алексей Миловидов. Прогресс 80%. Потребуется помощь других разработчиков. - -Upd. Поползновения наблюдаются. - -### 2.14. Все функции с состоянием переделать на FunctionBuilder. {#vse-funktsii-s-sostoianiem-peredelat-na-functionbuilder} - -Долг [Николай Кочетов](https://github.com/KochetovNicolai). Сейчас код находится в переходном состоянии, что неприемлемо. - -### 2.15. Функция subscribe для IStorage. {#funktsiia-subscribe-dlia-istorage} - -Для нормализации работы materialized views поверх Merge, Distributed, Kafka. - - -## 3. Документация. {#dokumentatsiia} - -Здесь задачи только по инфраструктуре документации. - -### 3.1. Перенос документации по функциям в код. {#perenos-dokumentatsii-po-funktsiiam-v-kod} - -Требует 2.12 и 2.13. Хотим в Q2, средний приоритет. - -### 3.2. Перенос однородных частей документации в код. {#perenos-odnorodnykh-chastei-dokumentatsii-v-kod} - -Требует 3.1. - -### + 3.3. Исправить катастрофически отвратительно неприемлемый поиск по документации. {#ispravit-katastroficheski-otvratitelno-nepriemlemyi-poisk-po-dokumentatsii} - -[Иван Блинков](https://github.com/blinkov/) - очень хороший человек. Сам сайт документации основан на технологиях, не удовлетворяющих требованиям задачи, и эти технологии трудно исправить. Задачу будет делать первый встретившийся нам frontend разработчик, которого мы сможем заставить это сделать. - -Upd. Иван Блинков сделал эту задачу путём замены треш-технологий на нормальные. - -### 3.4. + Добавить японский язык в документацию. {#dobavit-iaponskii-iazyk-v-dokumentatsiiu} - -Эту задачу сделает [Иван Блинков](https://github.com/blinkov/), до конца декабря 2019. Сделано. - - -## 4. Сетевое взаимодействие. {#setevoe-vzaimodeistvie} - -### 4.1. Уменьшение числа потоков при распределённых запросах. {#umenshenie-chisla-potokov-pri-raspredelionnykh-zaprosakh} - -Весна 2020. Upd. Есть прототип. Upd. Он не работает. Upd. Человек отказался от задачи, теперь сроки не определены. - -### 4.2. Спекулятивное выполнение запросов на нескольких репликах. {#spekuliativnoe-vypolnenie-zaprosov-na-neskolkikh-replikakh} - -Нужно для Яндекс.Метрики. Требует 4.1. - -Если распределённый запрос затрагивает большое количество серверов, то время выполнения запросов часто становится большим из-за tail latencies - случайных редких замедлений отдельных серверов. Эту проблему можно избежать, отправляя один и тот же запрос сразу на несколько реплик, и используя данные с наиболее быстрой. - -Задача скрывает в себе много тонкостей, связанных с обработкой стадий выполнения запроса (соединение, обмен handshake, отправка запроса, получение заголовка результата, получение пакетов прогресса, получение данных), правильной возможностью настройки таймаутов, правильной отменой запросов. - -Сейчас для распределённых запросов используется по потоку на соединение. Это позволяет хорошо распараллелить вычисления над полученными данными и утилизировать сеть, но становится сильно избыточным для больших кластеров. Для примера, создание 1000 потоков для чтения данных из 1000 серверов кластера - лишь расходует ресурсы и увеличивает время выполнения запроса. Вместо этого необходимо использовать количество потоков не большее количества процессорных ядер, и мультиплексировать в одном потоке общение с серверами. Реализация нетривиальна, так как мультиплексировать необходимо каждую стадию общения по сети, включая установку соединения и обмен handshake. - -Upd. Сейчас обсуждается, как сделать другую задачу вместо этой. - -### 4.3. Ограничение числа одновременных скачиваний с реплик. {#ogranichenie-chisla-odnovremennykh-skachivanii-s-replik} - -Дмитрий Григорьев, ВШЭ. -Изначально делал Олег Алексеенков, но пока решение не готово, хотя там не так уж много доделывать. - -### 4.4. Ограничение сетевой полосы при репликации. {#ogranichenie-setevoi-polosy-pri-replikatsii} - -Дмитрий Григорьев, ВШЭ. Нужно для Метрики. - -### 4.5. Возможность продолжить передачу куска данных при репликации после сбоя. {#vozmozhnost-prodolzhit-peredachu-kuska-dannykh-pri-replikatsii-posle-sboia} - -Дмитрий Григорьев, ВШЭ. - -### 4.6. p2p передача для GLOBAL подзапросов. {#p2p-peredacha-dlia-global-podzaprosov} - -### 4.7. Ленивая загрузка множеств для IN и JOIN с помощью k/v запросов. {#lenivaia-zagruzka-mnozhestv-dlia-in-i-join-s-pomoshchiu-kv-zaprosov} - -### 4.8. Разделить background pool для fetch и merge. {#razdelit-background-pool-dlia-fetch-i-merge} - -Дмитрий Григорьев, ВШЭ. -В очереди. Исправить проблему, что восстанавливающаяся реплика перестаёт мержить. Частично компенсируется 4.3. - - -## 5. Операции. {#operatsii} - -### 5.1. + Разделение задач на более мелкие куски в clickhouse-copier. {#razdelenie-zadach-na-bolee-melkie-kuski-v-clickhouse-copier} - -[\#9075](https://github.com/ClickHouse/ClickHouse/pull/9075) -Q1. Нужно для Метрики, в очереди. Никита Михайлов. - -Upd. Задача на финальной стадии разработки. -Upd. Сделано. Эффективность работы под вопросом. Есть варианты, как сделать лучше. - -### 5.2. Автонастройка лимита на оперативку и размера кэшей. {#avtonastroika-limita-na-operativku-i-razmera-keshei} - -### 5.3. + Встроенная ручка для Prometheus. {#vstroennaia-ruchka-dlia-prometheus} - -Сделано. https://github.com/Vdimir - -### 5.4. Opt-in сообщать в клиенте, если вышла новая версия. {#opt-in-soobshchat-v-kliente-esli-vyshla-novaia-versiia} - -### 5.5. + LTS релизы. {#lts-relizy} - -Требует 7.5. Задачу хочет Метрика, Облако, БК, Маркет и Altinity. Первой LTS версией уже стала версия 19.14. -Метрика, БК, Маркет, Altinity уже используют более свежие версии чем LTS. -Upd. Появилась вторая версия LTS - 20.3. - - -## 6. Инструментирование. {#instrumentirovanie} - -### 6.1. + Исправления сэмплирующего профайлера запросов. {#ispravleniia-sempliruiushchego-profailera-zaprosov} - -Михаил Филимонов, Altinity. Ноябрь 2019. Сделано. -Осталось ещё проверить работоспособность профайлера в первом потоке (что важно для INSERT). Иван Лежанкин. Q1. Сделано. - -### 6.2. + Добавление memory profiler. {#dobavlenie-memory-profiler} - -[\#6387](https://github.com/ClickHouse/ClickHouse/issues/6387) - -Сравнительно простая задача, но только для опытных разработчиков. Нужна всем. Иван Лежанкин. Q1. Сделано. - -### 6.3. + Учёт оперативки total расширить не только на запросы. {#uchiot-operativki-total-rasshirit-ne-tolko-na-zaprosy} - -Исправление долгоживущей проблемы с дрифтом учёта оперативки. Нужна для Метрики и БК. - -### 6.4. Поддержка perf events как метрик запроса. {#podderzhka-perf-events-kak-metrik-zaprosa} - -Делает Андрей Скобцов, ВШЭ. - -В Linux существует возможность получать в программе информацию о счётчиках производительности и событиях, относящихся к CPU и ядру ОС. Подробнее смотрите `man perf_event_open`. Предлагается добавить эти метрики в ClickHouse для инструментирования запросов. - -Есть прототип. - -### 6.5. Эксперименты с LLVM X-Ray. {#eksperimenty-s-llvm-x-ray} - -Требует 2.2. - -### 6.6. + Стек трейс для любых исключений. {#stek-treis-dlia-liubykh-iskliuchenii} - -Сейчас есть стек трейс для почти всех, но не всех исключений. Требует 7.4. - -### 6.7. + Таблица system.stack_trace. {#tablitsa-system-stack-trace} - -Сравнительно простая задача, но только для опытных разработчиков. - -### 6.8. Таблица system.crashes. {#tablitsa-system-crashes} - -Сравнительно простая задача, но только для опытных разработчиков. - -### 6.9. Отправлять информацию клиенту, если сервер падает по сигналу. {#otpravliat-informatsiiu-klientu-esli-server-padaet-po-signalu} - -### 6.10. Сбор общих системных метрик. {#sbor-obshchikh-sistemnykh-metrik} - - -## 7. Сопровождение разработки. {#soprovozhdenie-razrabotki} - -### 7.1. + ICU в submodules. {#icu-v-submodules} - -Добавление в submodules также нужно для Аркадии (7.26). - -### 7.2. + LLVM в submodules. {#llvm-v-submodules} - -Сделал Алексей Миловидов. - -### 7.3. + Обновление Poco. {#obnovlenie-poco} - -Алексанр Кузьменков. - -### 7.4. + Включить libc++, libc++-abi при сборке с gcc. {#vkliuchit-libc-libc-abi-pri-sborke-s-gcc} - -Сейчас включено только при сборке с clang, но продакшен сборка использует gcc. -Требует 7.2 и, возможно, 7.1 (только в случае новой версии ICU). - -### 7.5. + Начать публиковать LTS релизы. {#nachat-publikovat-lts-relizy} - -[Александр Сапин](https://github.com/alesapin). - -### 7.6. + Правильный статистический тест для comparison mode в clickhouse-performance-test. {#pravilnyi-statisticheskii-test-dlia-comparison-mode-v-clickhouse-performance-test} - -Задачу начал делать Дмитрий Рубашкин (ВШЭ). Сейчас продолжает [Александр Кузьменков](https://github.com/akuzm). Сделано, работает в CI. - -### 7.7. Доделать тесты под MSan. {#dodelat-testy-pod-msan} - -Уже есть ASan, TSan, UBSan. Не хватает тестов под MSan. Они уже добавлены в CI, но не проходят. -[Александр Кузьменков](https://github.com/akuzm) и [Александр Токмаков](https://github.com/tavplubix). - -Upd. Задача всё ещё медленно тащится. - -### 7.8. + Добавить clang-tidy. {#dobavit-clang-tidy} - -Уже есть PVS-Studio. Мы очень довольны, но этого недостаточно. - -Upd. Алексей Миловидов. Добавлено некоторое множество проверок, но нужно рассмотреть все проверки подряд и добавить всё, что можно. -Upd. Рассмотрели все проверки подряд. - -### 7.9. + Проверки на стиль имён с помощью clang-tidy. {#proverki-na-stil-imion-s-pomoshchiu-clang-tidy} - -Сделано. Только в .cpp файлах и только для имён локальных переменных. Остальное слишком сложно. - -### 7.10. Включение UBSan и MSan в интеграционных тестах. {#vkliuchenie-ubsan-i-msan-v-integratsionnykh-testakh} - -UBSan включен в функциональных тестах, но не включен в интеграционных тестах. Требует 7.7. - -### 7.11. Включение \*San в unit тестах. {#vkliuchenie-san-v-unit-testakh} - -У нас мало unit тестов по сравнению с функциональными тестами и их использование не обязательно. Но они всё-равно важны и нет причин не запускать их под всеми видами sanitizers. - -Илья Яцишин. - -### 7.12. Показывать тестовое покрытие нового кода в PR. {#pokazyvat-testovoe-pokrytie-novogo-koda-v-pr} - -Пока есть просто показ тестового покрытия всего кода. - -### 7.13. + Включение аналога -Weverything в gcc. {#vkliuchenie-analoga-weverything-v-gcc} - -Мы используем -Wall -Wextra -Weverything -Werror. -При сборке с clang, -Weverything уже включено. Но в gcc есть уникальные warning-и, отсутствующие в clang. -Сделал Wolf Kreuzerkrieg. - -### 7.14. + Альтернатива для readline и libedit. {#alternativa-dlia-readline-i-libedit} - -Подключение replxx вместо readline сделал Иван Лежанкин. - -Есть технический долг с лицензиями файлов консорциума Unicode. - -### 7.14.1. Улучшение возможностей интерактивного режима clickhouse-client. {#uluchshenie-vozmozhnostei-interaktivnogo-rezhima-clickhouse-client} - -Тагир Кускаров, ВШЭ. - -Upd. В рамках данной задачи добавляем подстветку синтаксиса и исправление проблем со вставкой больших запросов. - -Для ввода запросов в интерактивном режиме в клиенте командной строки clickhouse-client использовалась библиотека readline или libedit. - -Библиотеки readline и libedit обладает следующими недостатками: -- (исправлено в новых версиях readline) Очень низкая производительность вставки больших кусков текста. Вставка каждого следующего символа имеет сложность O(n = количество предыдущих символов) и при вставке 1 МБ текста, скорость падает до десятков байт в секунду. -- Крайне сложно или невозможно реализовать подсветку синтаксиса по мере набора текста, а также autocomplete без нажатия дополнительных клавиш для вызова. -- Лицензия GPL (для readline) препятствует её включению в кодовую базу продукта. -- Плохо работает навигация по истории, если история вкючает запросы, не помещающиеся на экран. -- История сохраняется лишь при завершении работы клиента. -- При параллельной работе нескольких клиентов с одним файлом истории, сохраняется история только одного из клиентов. -- Плохо работает история для многострочных запросов. -- Излишняя экономия пересылаемых данных, что часто приводит к остаткам мусора в терминале. - -Кроме того, имеются следующие сложно достижимые достоинства: -- Поддержка right-to-left текста; -- Поддержка editrc конфигураций. - -В качестве альтернатив можно рассмотреть следующие варианты: -- Linenoise от Salvatore Sanfilippo. Достоинства: простота и компактность кода; высокая скорость работы. Недостатки: отсутствует поддержка Unicode; отсутствует автоматический перенос текста, что затрудняет работу с многострочными запросами. -- Linenoise с патчами для поддержки Unicode. Недостаток: теряется преимущество по скорости работы. -- Fish shell. Не является библиотекой, но представляет собой отличный пример, как можно реализовать подстветку синтаксиса и удобный autocomplete. Поддерживает Unicode, но работает весьма медленно. -- Python Prompt Toolkit. Не является подходящим решением для интеграции в C++ проект. Хорошие возможности по подсветке синтаксиса и autocomplete. - -Вместо этого предлагается в качестве примера изучить прототип текстового редактора Kilo: https://viewsourcecode.org/snaptoken/kilo/ и реализовать всю необходимую функциональность. - -### 7.15. + Замена libressl обратно на openssl. {#zamena-libressl-obratno-na-openssl} - -Поводом использования libressl послужило желание нашего хорошего друга из известной компании несколько лет назад. Но сейчас ситуация состоит в том, что openssl продолжает развиваться, а libressl не особо, и можно спокойно менять обратно. - -Нужно для Яндекс.Облака для поддержки TLS 1.3. - -### 7.16. + tzdata внутри бинарника. {#tzdata-vnutri-binarnika} - -Как в Аркадии, fallback на системные. - -### 7.17. + Доделать tgz пакеты. {#dodelat-tgz-pakety} - -Уже давно собираются универсальные tgz пакеты, но по нелепой случайности из них исчез install скрипт. -[Александр Сапин](https://github.com/alesapin). Может делегировать эту задачу кому угодно. -Upd. Сделано всё кроме инструкции на сайте. Для этого требуется создать директории testing/stable/prestable на repo.yandex.ru. Внезапно оказалось, что человек, отвечающий за это, в отпуске, и он не отвечает на вопрос, кто его заместитель. Q1. - -### 7.18. + Доделать бинарники под Mac. {#dodelat-binarniki-pod-mac} - -Уже есть автосборка бинарников под Mac на каждый коммит и PR, но с недостатками. -[Иван Лежанкин](https://github.com/abyss7). Требует 7.1, 7.2. Рекомендуется 7.14. Сейчас не хватает по крайней мере SSL и ICU. Нужно для Яндекс.Облака. -Upd. Сделано SSL. Ориентируемся в Q1, но приоритет средний и может потеряться. - -### 7.18.1. Поместить ссылку на собранные бинарники под Mac на сайт. {#pomestit-ssylku-na-sobrannye-binarniki-pod-mac-na-sait} - -Сейчас людям приходится делать несколько кликов, чтобы их скачать. -[Иван Лежанкин](https://github.com/abyss7) или [Александр Сапин](https://github.com/alesapin). - -### 7.19. + Доделать (проверить) автосборку под AArch64. {#dodelat-proverit-avtosborku-pod-aarch64} - -https://github.com/ClickHouse/ClickHouse/issues/8027\#issuecomment-566670282 -Проверили на настоящем сервере Huawei, а также в специальном Docker контейнере, который содержит внутри qemu-user-static. -Также можно проверить на Cavium, на Raspberry Pi а также на твоём Android телефоне. - -### 7.20. Автосборка для FreeBSD x86_64. {#avtosborka-dlia-freebsd-x86-64} - -[Иван Лежанкин](https://github.com/abyss7). - -Upd. В процессе реализации, есть pull request. - -### 7.21. Автосборка для Linux ppc64. {#avtosborka-dlia-linux-ppc64} - -[Иван Лежанкин](https://github.com/abyss7). - -### 7.22. Дэшборд для pull requests. {#deshbord-dlia-pull-requests} - -Дарья Петрова, УрФУ. - -Над ClickHouse одновременно работает большое количество разработчиков, которые оформляют свои изменения в виде pull requests. Когда непомерженных pull requests много, то возникает сложность с организацией работы - непонятно, на какой pull request смотреть в первую очередь. - -Предлагается реализовать простое одностраничное веб-приложение, в котором отображается список pull requests со следующей информацией: -- размер diff - количество изменённых строк; -- как давно было последнее обновление; -- типы изменённых файлов: C++, документация, скрипты сборки; -- наличие добавленных тестов; -- есть ли описание для changelog; -- изменены ли submodules; -- был ли разрешён запуск проверок CI; -- статусы проверок CI; -- количество approve от ревьюеров; - -Статусы проверок - наиболее важная часть. Так как для каждого PR выполняется несколько десятков проверок и наиболее медленные работают до нескольких часов, придётся: -- отображать сразу все проверки для каждого PR в виде красивой разноцветной матрицы с информацией по наведению мыши; -- отсортировать проверки по важности: например, если у внешнего разработчика проходят все проверки кроме стиля кода, то мы можем взять это в работу сами; -- если для предыдущего коммита проверка была завершена, а для последнего коммита ещё только идёт - то можно отображать в таблице статус предыдущей проверки более блёклым цветом. - -Предлагается реализовать несколько вариантов сортировок. Очевидное - по времени обновления, более интересно - некое ранжирование с целью выяснить, «что лучше взять в работу прямо сейчас». - -Похожие продукты уже есть, например: http://prs.mozilla.io/yandex:ClickHouse К сожалению, этот продукт заброшен, да и делает не совсем то, что нужно. По своему усмотрению, можно взять из него что-нибудь полезное. - -### 7.23. Функции для fuzzing. {#funktsii-dlia-fuzzing} - -Андрей Некрашевич, ВШЭ. - -Fuzzing тестирование - это тестирование случайными данными. Мы рассмотрим несколько подходов к этой задачи: - -1. Добавление в SQL диалект ClickHouse функций для генерации случайных данных (пример - случайные бинарные строки заданной длины, случайные валидные UTF-8 строки) и «порчи» данных (например, поменять значения случайных бит с заданной частотой). Это будет использовано для тестирования SQL-функций ClickHouse. - -Можно добавить функции: -`randomString(length)` -`randomFixedString(length)` -- строка заданной длины с равномерно распределёнными случайными байтами; -`randomStringASCII(length)` -`randomStringUTF8(length)` - -`fuzzBits(s, inverse_probability)` - изменить каждый бит строки на противоположный с заданной вероятностью; -`fuzzBytes(s, inverse_probability)` - изменить каждый байт строки на равномерно случайный с заданной вероятностью; - -У каждой функции опциональный аргумент против склейки одинаковых выражений в запросе. - -Также можно сделать функции с детерминированным генератором случайных чисел (аргументом передаётся seed) для воспроизводимости тестовых кейсов. - -Upd. Сергей Штыков сделал функцию `randomPrintableASCII`. -Upd. Илья Яцишин сделал табличную функцию `generateRandom`. -Upd. Эльдар Заитов добавляет OSS Fuzz. - -### 7.24. Fuzzing лексера и парсера запросов; кодеков и форматов. {#fuzzing-leksera-i-parsera-zaprosov-kodekov-i-formatov} - -Андрей Некрашевич, ВШЭ. - -Продолжение 7.23. - -1. Использование AFL или LibFuzzer для тестирования отдельных частей кодовой базы ClickHouse. - -2. Генерация и выполнение случайных синтаксически корректных запросов на случайных данных. - -### 7.25. + Синхронизация релизов в Аркадию. {#sinkhronizatsiia-relizov-v-arkadiiu} - -Изначально занимался Олег Алексеенков. Сейчас он перешёл работать в дружественный отдел, но обещает продолжать синхронизацию. -Затем, возможно, [Иван Лежанкин](https://github.com/abyss7). Но сейчас приостановлено, так как Максим из YT должен исправить регрессию производительности в анализе индекса. - -Максим из YT сказал, что сделает это после нового года. -Максим из YT сказал, что «мы планируем в январе добиться». -Максим сейчас занимается собираемостью YT с новой версией ClickHouse. - -Нужно для CHYT и YQL. - -Upd: Все патчи Максима отправлены в master. Задача взята в работу. -Upd: Задача в процессе реализации. Синхронизироваться будет master. Делает [Иван Лежанкин](https://github.com/abyss7) -Upd: Есть собирающийся прототип, но сборка как будто ещё не в trunk Аркадии. -Upd: Добавлено в Аркадию, но не все файлы (не побайтово). - -### 7.26. Побайтовая идентичность репозитория с Аркадией. {#pobaitovaia-identichnost-repozitoriia-s-arkadiei} - -Команда DevTools. Прогресс по задаче под вопросом. - -### 7.27. Запуск автотестов в Аркадии. {#zapusk-avtotestov-v-arkadii} - -Требует 7.26. Коллеги начали делать, есть результат. - -### 7.29. Опции clickhouse install, stop, start вместо postinst, init.d, systemd скриптов. {#optsii-clickhouse-install-stop-start-vmesto-postinst-init-d-systemd-skriptov} - -Низкий приоритет. - -### 7.30. Возможность переключения бинарных файлов на продакшене без выкладки пакетов. {#vozmozhnost-perekliucheniia-binarnykh-failov-na-prodakshene-bez-vykladki-paketov} - -Низкий приоритет. - -### 7.31. Зеркалирование нагрузки между серверами. {#zerkalirovanie-nagruzki-mezhdu-serverami} - -В очереди. Нужно для Яндекс.Метрики. - -### 7.32. Обфускация продакшен запросов. {#obfuskatsiia-prodakshen-zaprosov} - -Роман Ильговский. Нужно для Яндекс.Метрики. - -Имея SQL запрос, требуется вывести структуру таблиц, на которых этот запрос будет выполнен, и заполнить эти таблицы случайными данными, такими, что результат этого запроса зависит от выбора подмножества данных. - -Для примера, если есть запрос `SELECT SearchPhrase, count(*) FROM table WHERE CounterID = 34 AND SearchPhrase LIKE '%ClickHouse%'`, то мы можем сделать вывод, что CounterID имеет числовой тип, а SearchPhrase - строковый. Заполнить таблицу данными, на которых отдельные условия `CounterID = 34` и `SearchPhrase LIKE '%ClickHouse%'` для некоторых строк выполнены, а для некоторых строк не выполнены. - -Обфускация запросов: имея секретные запросы и структуру таблиц, заменить имена полей и константы, чтобы запросы можно было использовать в качестве публично доступных тестов. - -### 7.33. Выкладывать патч релизы в репозиторий автоматически. {#vykladyvat-patch-relizy-v-repozitorii-avtomaticheski} - -В очереди. Иван Лежанкин. - -### 7.34. Бэкпортировать bugfix автоматически. {#bekportirovat-bugfix-avtomaticheski} - -В очереди. Иван Лежанкин. - -### 7.35. Начальные правила для авто-merge. {#nachalnye-pravila-dlia-avto-merge} - -Зелёные проверки и два ревью. -[Александр Сапин](https://github.com/alesapin). Может делегировать эту задачу кому угодно. - -### 7.36. Понятие доверенных контрибьюторов. {#poniatie-doverennykh-kontribiutorov} - -Контрибьюторы, у которых есть 5 померженных PR. Для их новых PR автотесты запускаются сразу. -[Александр Сапин](https://github.com/alesapin). Может делегировать эту задачу кому угодно. -Сейчас добавляем некоторых доверенных контрибьюторов в ручном режиме. - -### 7.37. Разобраться с repo.yandex.ru. {#razobratsia-s-repo-yandex-ru} - -Есть жалобы на скорость загрузки и неудобство maintenance, operations, visibility. - -Upd. Иван Блинков настроил CDN repo.clickhouse.tech, что решает проблему с доступностью зарубежом. -Вопрос с operations, visibility пока актуален. - - -## 8. Интеграция с внешними системами. {#integratsiia-s-vneshnimi-sistemami} - -### 8.1. Поддержка ALTER MODIFY SETTING для Kafka. {#podderzhka-alter-modify-setting-dlia-kafka} - -Также - возможность указать все настройки форматов в Kafka. - -Altinity. Никто не делает эту задачу. - -### 8.2. Поддержка Mongo Atlas URI. {#podderzhka-mongo-atlas-uri} - -[Александр Кузьменков](https://github.com/akuzm). - -### 8.3. + Доработки globs (правильная поддержка диапазонов, уменьшение числа одновременных stream-ов). {#dorabotki-globs-pravilnaia-podderzhka-diapazonov-umenshenie-chisla-odnovremennykh-stream-ov} - -[Ольга Хвостикова](https://github.com/stavrolia). - -Уменьшение числа stream-ов сделано, а вот правильная поддержка диапазонов - нет. Будем надеяться на Q1/Q2. Сделано. - -### 8.4. Унификация File, HDFS, S3 под URL. {#unifikatsiia-file-hdfs-s3-pod-url} - -### 8.5. + Аутентификация в S3. {#autentifikatsiia-v-s3} - -[Владимир Чеботарёв](https://github.com/excitoon), Altinity. - -### 8.6. Kerberos аутентификация для HDFS и Kafka. {#kerberos-autentifikatsiia-dlia-hdfs-i-kafka} - -Андрей Коняев, ArenaData. Он куда-то пропал. - -### 8.7. + Исправление мелочи HDFS на очень старых ядрах Linux. {#ispravlenie-melochi-hdfs-na-ochen-starykh-iadrakh-linux} - -В ядрах 2.6 отсутствует один системный вызов, который библиотека hdfs3 использует без необходимости. -Сделал Amos Bird. - -### 8.8. + Поддержка виртуальных столбцов с именем файла и путём. {#podderzhka-virtualnykh-stolbtsov-s-imenem-faila-i-putiom} - -[Ольга Хвостикова](https://github.com/stavrolia). - -### 8.9. + Поддержка сжатых файлов (gz, bz) на чтение и запись. {#podderzhka-szhatykh-failov-gz-bz-na-chtenie-i-zapis} - -Сделал [Andrey Bodrov](https://github.com/apbodrov) - -### 8.10. Запись в табличную функцию ODBC. {#zapis-v-tablichnuiu-funktsiiu-odbc} - -Артемий Бобровский, ВШЭ - -### 8.11. Движок таблиц для чтения из Mongo. {#dvizhok-tablits-dlia-chteniia-iz-mongo} - -Артемий Бобровский, ВШЭ - -### 8.12. Пропуск столбцов в форматах Parquet, ORC. {#propusk-stolbtsov-v-formatakh-parquet-orc} - -Артемий Бобровский, ВШЭ - -### 8.13. Поддержка массивов в Parquet, ORC. {#podderzhka-massivov-v-parquet-orc} - -Артемий Бобровский, ВШЭ - -### 8.14. Запись данных в ORC. {#zapis-dannykh-v-orc} - -Возможно, Андрей Коняев, ArenaData (зависит от желания). - -### 8.15. Запись данных в CapNProto. {#zapis-dannykh-v-capnproto} - -### 8.16. + Поддержка формата Avro. {#podderzhka-formata-avro} - -Andrew Onyshchuk. Есть pull request. Q1. Сделано. - -Формат Apache Avro является компактным структурированным построчным бинарным форматом данных с внешней схемой. Этот формат часто используется совместно с Kafka и поддержка его в качестве одного из форматов ввода-вывода в ClickHouse является востребованной пользователями. - -### 8.16.1. + Поддержка формата JSONEachRow, засунутого в массив. {#podderzhka-formata-jsoneachrow-zasunutogo-v-massiv} - -Павел Круглов, ВШЭ и Яндекс. Есть pull request. - -### 8.16.2. - Поддержка формата Thrift. {#podderzhka-formata-thrift} - -Павел Круглов, ВШЭ и Яндекс. Задача отменена. - -### 8.16.3. + Поддержка формата MsgPack. {#podderzhka-formata-msgpack} - -Павел Круглов, ВШЭ и Яндекс. -Задача взята в работу. - -Upd. Почти готово - есть лишь небольшой технический долг. - -### 8.16.4. + Формат Regexp. {#format-regexp} - -Павел Круглов, ВШЭ и Яндекс. -Есть pull request. Готово. - -### 8.17. ClickHouse как MySQL реплика. {#clickhouse-kak-mysql-replika} - -Ильяс Адюгамов, ВШЭ. - -Реализовать возможность подписаться на row-based репликацию MySQL и сохранять полученные данные в CollapsingMergeTree или ReplacingMergeTree таблицы. Сторонние решения для этой задачи уже существуют: https://www.altinity.com/blog/2018/6/30/realtime-mysql-clickhouse-replication-in-practice Также существует стороннее решение для PostgreSQL: https://github.com/mkabilov/pg2ch - -Встроенная в ClickHouse возможность работать в качестве реплики MySQL даст преимущества для дальнейшего развития. - -### 8.18. + ClickHouse как Federated MySQL. {#clickhouse-kak-federated-mysql} - -Maxim Fedotov, Wargaming + Yuri Baranov, Яндекс. - -### 8.19. Интеграция с RabbitMQ. {#integratsiia-s-rabbitmq} - -Ксения Сумарокова, ВШЭ. - -В ClickHouse часто используется потоковый импорт данных из распределённой очереди. Наиболее популярно использование совместно с Kafka. Эта возможность уже есть. - -Следующей по востребованности является система очередей RabbitMQ. Её поддержка в ClickHouse отсутствует. - -Есть pull request в процессе разработки. - -### 8.20. Интеграция с SQS. {#integratsiia-s-sqs} - -Низкий приоритет. - -### 8.21. Поддержка произвольного количества языков для имён регионов. {#podderzhka-proizvolnogo-kolichestva-iazykov-dlia-imion-regionov} - -Нужно для БК. Декабрь 2019. -В декабре для БК сделан минимальный вариант этой задачи. -Максимальный вариант, вроде, никому не нужен. -Upd. Всё ещё кажется, что задача не нужна. - -### 8.22. Поддержка синтаксиса для переменных в стиле MySQL. {#podderzhka-sintaksisa-dlia-peremennykh-v-stile-mysql} - -При парсинге запроса преобразовывать синтаксис вида `@@version_full` в вызов функции `getGlobalVariable('version_full')`. Поддержать популярные MySQL переменные. Может быть поможет Юрий Баранов, если будет энтузиазм. - -Upd. Юрий Баранов работает в Google, там запрещено разрабатывать ClickHouse. - -### 8.23. Подписка для импорта обновляемых и ротируемых логов в ФС. {#podpiska-dlia-importa-obnovliaemykh-i-rotiruemykh-logov-v-fs} - -Желательно 2.15. - - -## 9. Безопасность. {#bezopasnost} - -### 9.1. + Ограничение на хосты в запросах ко внешним системам. {#ogranichenie-na-khosty-v-zaprosakh-ko-vneshnim-sistemam} - -Михаил Коротов. - -### 9.2. Преднастроенные именованные соединения к внешним БД. {#prednastroennye-imenovannye-soedineniia-k-vneshnim-bd} - -Валерий Батурин, ВШЭ. - -ClickHouse предоставляет возможность обратиться к внешней базе данных из языка запросов. Это реализовано в виде табличных функций. В параметрах к табличной функции указывается адрес удалённой базы данных (хост, порт), а также аутентификационные данные (имя пользователя, пароль). Аутентификационные данные указываются в запросе в открытом виде и, таким образом, попадают в историю запросов и в логи, что компрометирует безопасность системы. - -Вместо этого предлагается описывать необходимые данные в конфигурационном файле сервера или в отдельном сервисе и ссылаться на них по именам. - -### 9.3. + Поддержка TLS для ZooKeeper. {#podderzhka-tls-dlia-zookeeper} - -[#10174](https://github.com/ClickHouse/ClickHouse/issues/10174) - -Есть pull request. - - -## 10. Внешние словари. {#vneshnie-slovari} - -### 10.1. + Исправление зависания в библиотеке доступа к YT. {#ispravlenie-zavisaniia-v-biblioteke-dostupa-k-yt} - -Библиотека для доступа к YT не переживает учения. -Нужно для БК и Метрики. Поиск причин - [Александр Сапин](https://github.com/alesapin). Дальшейшее исправление возможно на стороне YT. - -Цитата: «Оказывается для YT-клиента зависания на несколько минут это нормально. Убрал внутренние ретраи, снизил таймауты. Однозначно станет лучше». - -### 10.2. Исправление SIGILL в библиотеке доступа к YT. {#ispravlenie-sigill-v-biblioteke-dostupa-k-yt} - -Код YT использует SIGILL вместо abort. Это, опять же, происходит при учениях. -Нужно для БК и Метрики. Поиск причин - [Александр Сапин](https://github.com/alesapin). Дальшейшее исправление возможно на стороне YT. - -Upd. Одну причину устранили, но ещё что-то неизвестное осталось. -Upd. Нас заставляют переписать эту библиотеку с одного API на другое, так как старое внезапно устарело. Кажется, что переписывание случайно исправит все проблемы. - -### 10.3. Возможность чтения данных из статических таблиц в YT словарях. {#vozmozhnost-chteniia-dannykh-iz-staticheskikh-tablits-v-yt-slovariakh} - -Нужно для БК и Метрики. - -### 10.4. Словарь из YDB (KikiMR). {#slovar-iz-ydb-kikimr} - -Нужно для Метрики, а делать будет таинственный незнакомец из команды KikiMR (под вопросом). Таинственный незнакомец не подтверждает, что он будет делать эту задачу. - -### 10.5. Закрытие соединений и уменьшение числа соединений для MySQL и ODBC. {#zakrytie-soedinenii-i-umenshenie-chisla-soedinenii-dlia-mysql-i-odbc} - -Нужно для Метрики. - -Для MySQL сделал Clément Rodriguez. - -### 10.6. Словари из Cassandra и Couchbase. {#slovari-iz-cassandra-i-couchbase} - -### 10.7. Поддержка Nullable в словарях. {#podderzhka-nullable-v-slovariakh} - -Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. - -### 10.8. Поддержка массивов в словарях. {#podderzhka-massivov-v-slovariakh} - -Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. - -### 10.9. - Уменьшение блокировок для cache словарей за счёт одновременных запросов одного и того же. {#umenshenie-blokirovok-dlia-cache-slovarei-za-schiot-odnovremennykh-zaprosov-odnogo-i-togo-zhe} - -Заменено в пользу 10.10, 10.11. - -### 10.10. + Возможность использования старых значений из cache словаря пока они перезапрашиваются. {#vozmozhnost-ispolzovaniia-starykh-znachenii-iz-cache-slovaria-poka-oni-perezaprashivaiutsia} - -Никита Михайлов. Q1. Нужно для БК и Метрики. - -### 10.11. + Возможность исключительно асинхронных запросов в cache словарях. {#vozmozhnost-iskliuchitelno-asinkhronnykh-zaprosov-v-cache-slovariakh} - -Никита Михайлов. Q1. Нужно для БК и Метрики. Требует 10.10. - -### 10.12. Layout direct для словарей. {#layout-direct-dlia-slovarei} - -Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. -Приступили к этой задаче. - -### 10.13. Использование Join как generic layout для словарей. {#ispolzovanie-join-kak-generic-layout-dlia-slovarei} - -Артём Стрельцов, Николай Дегтеринский, Наталия Михненко, ВШЭ. - -### 10.14. Поддержка всех типов в функции transform. {#podderzhka-vsekh-tipov-v-funktsii-transform} - -### 10.15. Использование словарей как специализированного layout для Join. {#ispolzovanie-slovarei-kak-spetsializirovannogo-layout-dlia-join} - -### 10.16. Словари на локальном SSD. {#slovari-na-lokalnom-ssd} - -Никита Васильев, ВШЭ и Яндекс. Есть pull request. - -Реализовать в ClickHouse специализированный движок таблиц, подходящий для быстрых key-value запросов и оптимизированный для расположения данных на SSD. Это может быть: реализация на основе RocksDB; сериализованные RowBinary данные с индексом в оперативке; секретная очень эффективная структура данных, о которой я расскажу. - -Использовать эту структуру данных как отдельный вид словарей, как источник для cache словарей или как дополнительный уровень кэширования для cache словарей. - -### 10.17. Локальный дамп состояния словаря для быстрого старта сервера. {#lokalnyi-damp-sostoianiia-slovaria-dlia-bystrogo-starta-servera} - -### 10.18. Таблица Join или словарь на удалённом сервере как key-value БД для cache словаря. {#tablitsa-join-ili-slovar-na-udalionnom-servere-kak-key-value-bd-dlia-cache-slovaria} - -### 10.19. Возможность зарегистрировать некоторые функции, использующие словари, под пользовательскими именами. {#vozmozhnost-zaregistrirovat-nekotorye-funktsii-ispolzuiushchie-slovari-pod-polzovatelskimi-imenami} - - -## 11. Интерфейсы. {#interfeisy} - -### 11.1. Вставка состояний агрегатных функций в виде кортежа аргументов или массива кортежей аргументов. {#vstavka-sostoianii-agregatnykh-funktsii-v-vide-kortezha-argumentov-ili-massiva-kortezhei-argumentov} - -### 11.2. Возможность использовать движок JDBC из коробки. {#vozmozhnost-ispolzovat-dvizhok-jdbc-iz-korobki} - -Нужно разобраться, как упаковывать Java в статический бинарник, возможно AppImage. Или предоставить максимально простую инструкцию по установке jdbc-bridge. Может быть будет заинтересован Александр Крашенинников, Badoo, так как он разработал jdbc-bridge. - -Upd. Александр Крашенинников перешёл в другую компанию и больше не занимается этим. - -### 11.3. + Интеграционные тесты ODBC драйвера путём подключения ClickHouse к самому себе через ODBC. {#integratsionnye-testy-odbc-draivera-putiom-podkliucheniia-clickhouse-k-samomu-sebe-cherez-odbc} - -Михаил Филимонов, Altinity. Готово. - -### 11.4. Исправление упячек с типами Date и Decimal в clickhouse-cpp. {#ispravlenie-upiachek-s-tipami-date-i-decimal-v-clickhouse-cpp} - -### 11.5. Поддержка TLS в clickhouse-cpp. {#podderzhka-tls-v-clickhouse-cpp} - -А знаете ли вы, что библиотеку clickhouse-cpp разрабатывал один хороший человек в свободное время? - -### 11.6. Интеграционные тесты clickhouse-cpp. {#integratsionnye-testy-clickhouse-cpp} - -### 11.7. Интерактивный режим работы программы clickhouse-local. {#interaktivnyi-rezhim-raboty-programmy-clickhouse-local} - -### 11.8. Поддержка протокола PostgreSQL. {#podderzhka-protokola-postgresql} - -Элбакян Мовсес Андраникович, ВШЭ. - -В ClickHouse в прошлом году добавили поддержку wire-протокола MySQL. PostgreSQL, так же как MySQL, использует несложный протокол общения между клиентом и сервером, но свой собственный. Поддержка этого протокола является востребованной и откроет новые возможности для ClickHouse. - -Задача в процессе разработки. - -### 11.9. + Доработки ODBC драйвера. {#dorabotki-odbc-draivera} - -Денис Глазачев, Altinity. Хороший прогресс по этой задаче. - -### 11.10. Преднастроенные HTTP handlers для запросов. {#prednastroennye-http-handlers-dlia-zaprosov} - -zhang2014, есть pull request. - -Возможность описать в конфигурационном файле handler (путь в URL) для HTTP запросов к серверу, которому соответствует некоторый параметризованный запрос. Пользователь может вызвать этот обработчик и не должен передавать SQL запрос. - - -## 12. Управление пользователями и доступом. {#upravlenie-polzovateliami-i-dostupom} - -### 12.1. + Role Based Access Control. {#role-based-access-control} - -[Виталий Баранов](https://github.com/vitlibar). Финальная стадия разработки, рабочая версия в начале апреля 2019. -Q2. Сейчас сделаны все интерфейсы в коде и запросы, но не сделаны варианты хранения прав кроме прототипа. -Upd. Сделано хранение прав. До готового к использованию состояния осталось несколько доработок. - -### 12.2. + Управление пользователями и правами доступа с помощью SQL запросов. {#upravlenie-polzovateliami-i-pravami-dostupa-s-pomoshchiu-sql-zaprosov} - -[Виталий Баранов](https://github.com/vitlibar). Финальная стадия разработки, рабочая версия в декабре 2019. -Q1. Сделано управление правами полностью, но не реализовано их хранение, см. 12.1. - -### 12.3. Подключение справочника пользователей и прав доступа из LDAP. {#podkliuchenie-spravochnika-polzovatelei-i-prav-dostupa-iz-ldap} - -[Виталий Баранов](https://github.com/vitlibar). Требует 12.1. -Q2. - -### 12.4. Подключение IDM системы Яндекса как справочника пользователей и прав доступа. {#podkliuchenie-idm-sistemy-iandeksa-kak-spravochnika-polzovatelei-i-prav-dostupa} - -Пока низкий приоритет. Нужно для Метрики. Требует 12.3. - -### 12.5. Pluggable аутентификация с помощью Kerberos (возможно, подключение GSASL). {#pluggable-autentifikatsiia-s-pomoshchiu-kerberos-vozmozhno-podkliuchenie-gsasl} - -[Виталий Баранов](https://github.com/vitlibar). Требует 12.1. - -### 12.6. Информация о пользователях и квотах в системной таблице. {#informatsiia-o-polzovateliakh-i-kvotakh-v-sistemnoi-tablitse} - -[Виталий Баранов](https://github.com/vitlibar). Требует 12.1. -Есть pull request. Q2. - - -## 13. Разделение ресурсов, multi-tenancy. {#razdelenie-resursov-multi-tenancy} - -### 13.1. Overcommit запросов по памяти и вытеснение. {#overcommit-zaprosov-po-pamiati-i-vytesnenie} - -Требует 2.1. Способ реализации обсуждается. - -### 13.2. Общий конвейер выполнения на сервер. {#obshchii-konveier-vypolneniia-na-server} - -Требует 2.1. [Николай Кочетов](https://github.com/KochetovNicolai). - -### 13.3. Пулы ресурсов. {#puly-resursov} - -Требует 13.2 или сможем сделать более неудобную реализацию раньше. -Обсуждается вариант неудобной реализации. Пока средний приоритет, целимся на Q1/Q2. -Вариант реализации выбрал Александр Казаков. -Upd. Не уследили, и задачу стали обсуждать менеджеры. - - -## 14. Диалект SQL. {#dialekt-sql} - -### 14.1. Исправление семантики CAST для Nullable. {#ispravlenie-semantiki-cast-dlia-nullable} - -Нужно для DataLens. А также для внедрения в BI инструмент Looker. -Павел Потёмкин, ВШЭ. - -### 14.2. Поддержка WITH для подзапросов. {#podderzhka-with-dlia-podzaprosov} - -### 14.3. Поддержка подстановок для множеств в правой части IN. {#podderzhka-podstanovok-dlia-mnozhestv-v-pravoi-chasti-in} - -### 14.4. Поддержка подстановок для идентификаторов (имён) в SQL запросе. {#podderzhka-podstanovok-dlia-identifikatorov-imion-v-sql-zaprose} - -zhang2014 - -### 14.5. + Поддержка задания множества как массива в правой части секции IN. {#podderzhka-zadaniia-mnozhestva-kak-massiva-v-pravoi-chasti-sektsii-in} - -Василий Немков, Altinity, делал эту задачу, но забросил её в пользу других задач. -В результате, сейчас доделывает Антон Попов. - -### 14.6. Глобальный scope для WITH. {#globalnyi-scope-dlia-with} - -Павел Потёмкин, ВШЭ. - -### 14.7. Nullable для WITH ROLLUP, WITH CUBE, WITH TOTALS. {#nullable-dlia-with-rollup-with-cube-with-totals} - -Павел Потёмкин, ВШЭ. - -Простая задача. - -### 14.8. Модификаторы DISTINCT, ORDER BY для агрегатных функций. {#modifikatory-distinct-order-by-dlia-agregatnykh-funktsii} - -В ClickHouse поддерживается вычисление COUNT(DISTINCT x). Предлагается добавить возможность использования модификатора DISTINCT для всех агрегатных функций. Например, AVG(DISTINCT x) - вычислить среднее значение для всех различных значений x. Под вопросом вариант, в котором фильтрация уникальных значений выполняется по одному выражению, а агрегация по другому. - -Результат некоторых агрегатных функций зависит от порядка данных. Предлагается реализовать модификатор ORDER BY, задающий порядок явно. Пример: groupArray(x ORDER BY y, z). - -### 14.9. Поддержка запроса EXPLAIN. {#podderzhka-zaprosa-explain} - -Требует 2.1. [Николай Кочетов](https://github.com/KochetovNicolai). - -### 14.10. arrayReduce как функция высшего порядка. {#arrayreduce-kak-funktsiia-vysshego-poriadka} - -### 14.11. Функции для grouping sets. {#funktsii-dlia-grouping-sets} - -### 14.12. Функции обработки временных рядов. {#funktsii-obrabotki-vremennykh-riadov} - -Сложная задача, так как вводит новый класс функций и требует его обработку в оптимизаторе запросов. - -В time-series СУБД нужны функции, которые зависят от последовательности значений. Или даже от последовательности значений и их меток времени. Примеры: moving average, exponential smoothing, derivative, Holt-Winters forecast. Вычисление таких функций поддерживается в ClickHouse лишь частично. Так, ClickHouse поддерживает тип данных «массив» и позволяет реализовать эти функции как функции, принимающие массивы. Но гораздо удобнее для пользователя было бы иметь возможность применить такие функции к таблице (промежуточному результату запроса после сортировки). - -Это требует введение нового класса функций (помимо обычных и агрегатных функций) - такие функции будут иметь в коде ClickHouse свой собственный интерфейс, и их вычисление придётся отдельно учитывать в конвейере выполнения запросов. Для примера, вычисление обычных функций тривиально распараллеливается по процессорным ядрам и по серверам; вычисление агрегатных функций распараллеливается с некоторыми особенностями (работа с промежуточными состояниями вычислений, операция merge); а для функций по обработке временных рядов этот вопрос остаётся открытым - возможно, их придётся вычислять на одном сервере и в одном потоке. - -### 14.13. Применимость функций высшего порядка для кортежей и Nested. {#primenimost-funktsii-vysshego-poriadka-dlia-kortezhei-i-nested} - -### 14.14. Неявные преобразования типов констант. {#neiavnye-preobrazovaniia-tipov-konstant} - -Требует 2.12. - -### 14.15. Неявные преобразования типов под настройкой. {#neiavnye-preobrazovaniia-tipov-pod-nastroikoi} - -Требует 2.12. Для внедрения в BI инструмент Looker. - -### 14.16. Синонимы для функций из MySQL. {#sinonimy-dlia-funktsii-iz-mysql} - -### 14.17. + Ввести понятие stateful функций. {#vvesti-poniatie-stateful-funktsii} - -zhang2014. -Для runningDifference, neighbour - их учёт в оптимизаторе запросов. -В интерфейсе уже сделано. Надо проверить, что учитывается в нужных местах (например, что работает predicate pushdown сквозь ORDER BY, если таких функций нет). - -### 14.18. UNION DISTINCT и возможность включить его по-умолчанию. {#union-distinct-i-vozmozhnost-vkliuchit-ego-po-umolchaniiu} - -Павел Потёмкин, ВШЭ. -Для BI систем. - -### 14.19. Совместимость парсера типов данных с SQL. {#sovmestimost-parsera-tipov-dannykh-s-sql} - -Павел Потёмкин, ВШЭ. -Для BI систем. - -### 14.20. Позиционные аргументы для GROUP BY и ORDER BY. {#pozitsionnye-argumenty-dlia-group-by-i-order-by} - -Павел Потёмкин, ВШЭ. -Тривиально и используется многими системами, но не входит в стандарт SQL. - -### 14.21. Приведение типов для IN (подзапрос) и для JOIN. {#privedenie-tipov-dlia-in-podzapros-i-dlia-join} - -Павел Потёмкин, ВШЭ. - - -## 15. Улучшение поддержки JOIN. {#uluchshenie-podderzhki-join} - -### 15.1. + Доведение merge JOIN до продакшена. {#dovedenie-merge-join-do-prodakshena} - -Артём Зуйков. Сейчас merge JOIN включается вручную опцией и всегда замедляет запросы. Хотим, чтобы он замедлял запросы только когда это неизбежно. -Кстати, смысл merge JOIN появляется только совместно с 15.2 и 15.3. -Q1. Сделали адаптивный вариант, но вроде он что-то всё-ещё замедляет. -Задача сделана, но всё работает слишком медленно. - -### 15.1.1. Алгоритм two-level merge JOIN. {#algoritm-two-level-merge-join} - -Александр Кузьменков. В очереди. - -### 15.1.2. Тестирование реализации JOIN в Greenplum. {#testirovanie-realizatsii-join-v-greenplum} - -В очереди. - -### 15.2. Прокидывание условий в OUTER JOIN. {#prokidyvanie-uslovii-v-outer-join} - -Возможно, Артём Зуйков, но задача ещё не продумана до конца. Возможно, требует 2.1. - -### 15.3. Логический вывод для цепочек вида ON t1.x = t2.y WHERE t1.x = 10 {#logicheskii-vyvod-dlia-tsepochek-vida-on-t1-x-t2-y-where-t1-x-10} - -Возможно, Артём Зуйков. Для полноценной работы 15.2. - -### 15.4. Distributed JOIN с помощью перераспределения данных. {#distributed-join-s-pomoshchiu-pereraspredeleniia-dannykh} - -Артём Зуйков. - -### 15.5. Использование ключа таблицы для оптимизации merge JOIN. {#ispolzovanie-kliucha-tablitsy-dlia-optimizatsii-merge-join} - -### 15.6. + SEMI и ANTI JOIN. {#semi-i-anti-join} - -Артём Зуйков. - - -## 16. Типы данных и функции. {#tipy-dannykh-i-funktsii} - -### 16.1. + DateTime64. {#datetime64} - -Василий Немков, Altinity, декабрь 2019. - -### 16.2. Тип данных для JSON. {#tip-dannykh-dlia-json} - -zhang2014 - -Есть PR, в процессе ревью. - -### 16.3. Поддержка неконстантных аргументов с регулярными выражениями в функциях. {#podderzhka-nekonstantnykh-argumentov-s-reguliarnymi-vyrazheniiami-v-funktsiiakh} - -Данила Кутенин, но только после секретного изменения в работе. -Upd. Секретного изменения в работе не будет, задачу будет делать другой человек. - -### 16.4. Функция rowNumberForKey. {#funktsiia-rownumberforkey} - -### 16.5. Функции для XML и HTML escape. {#funktsii-dlia-xml-i-html-escape} - -### 16.6. Функции нормализации и хэширования SQL запросов. {#funktsii-normalizatsii-i-kheshirovaniia-sql-zaprosov} - - -## 17. Работа с географическими данными. {#rabota-s-geograficheskimi-dannymi} - -### 17.1. Гео-словари для определения региона по координатам. {#geo-slovari-dlia-opredeleniia-regiona-po-koordinatam} - -[Андрей Чулков](https://github.com/achulkov2), Антон Кваша, Артур Петуховский, ВШЭ. -Будет основано на коде от Арслана Урташева. - -ClickHouse не является geospatial СУБД. Тем не менее, в ClickHouse есть несколько функций для таких задач. Например, функция `pointInPolygon` позволяет быстро проверить попадание точек в полигон на плоскости. При этом, полигон задаётся в явном виде и должен быть константным для вызова функции (то есть - проверяется принадлежность многих точек одному полигону). Эта функциональность нужна, например, для рекламного таргетинга мобильных устройств по координатам. - -Похожая, но более сложная задача, которую ClickHouse пока не умеет решать - определение полигона среди множества полигонов, в которые попадают точки. Для примера: определение района города по географическим координатам. Для решения этой задачи нужно будет реализовать поддержку словарей с полигонами, в которых данные проиндексированы для быстрого поиска. - -Upd. Андрей сделал прототип интерфейса и реализацию-заглушку внутри него. -Upd. Андрей сделал прототип более оптимальной структуры данных. - -### 17.2. GIS типы данных и операции. {#gis-tipy-dannykh-i-operatsii} - -Алексей Коряков, Алексей Илюхов, ВШЭ, Яндекс.Карты. - -Реализовать в ClickHouse типы данных для задач обработки геоинформационных данных: Point, Line, MultiLine, Polygon и операции над ними - проверка вхождения, пересечения. Вариантом минимум будет реализация этих операций в евклидовой системе координат. Дополнительно - на сфере и WGS84. - -### 17.3. + Ускорение greatCircleDistance. {#uskorenie-greatcircledistance} - -[Ольга Хвостикова](https://github.com/stavrolia), основано на коде Андрея Аксёнова, получено разрешение на использование кода. - -### 17.4. Ускорение geohash с помощью библиотеки из Аркадии. {#uskorenie-geohash-s-pomoshchiu-biblioteki-iz-arkadii} - -Предположительно, [Андрей Чулков](https://github.com/achulkov2). Получено одобрение от руководства. - -### 17.5. + Проверки в функции pointInPolygon. {#proverki-v-funktsii-pointinpolygon} - -Сейчас функция тихо не работает в случае полигонов с самопересечениями, надо кидать исключение. - - -## 18. Машинное обучение и статистика. {#mashinnoe-obuchenie-i-statistika} - -### 18.1. Инкрементальная кластеризация данных. {#inkrementalnaia-klasterizatsiia-dannykh} - -Александр Кожихов, Максим Кузнецов. Обнаружена фундаментальная проблема в реализации, доделывает предположительно [Николай Кочетов](https://github.com/KochetovNicolai). Он может делегировать задачу кому угодно. - -Исправление фундаментальной проблемы - есть PR. - -### 18.2. Агрегатные функции для статистических тестов. {#agregatnye-funktsii-dlia-statisticheskikh-testov} - -Артём Цыганов, Руденский Константин Игоревич, Семёнов Денис, ВШЭ. - -Предлагается реализовать в ClickHouse статистические тесты (Analysis of Variance, тесты нормальности распределения и т. п.) в виде агрегатных функций. Пример: `welchTTest(value, sample_idx)`. - -Сделали прототип одного теста, есть pull request. - -### 18.3. Инфраструктура для тренировки моделей в ClickHouse. {#infrastruktura-dlia-trenirovki-modelei-v-clickhouse} - -В очереди. - - -## 19. Улучшение работы кластера. {#uluchshenie-raboty-klastera} - -### 19.1. Параллельные кворумные вставки без линеаризуемости. {#parallelnye-kvorumnye-vstavki-bez-linearizuemosti} - -Александра Латышева, ВШЭ и Яндекс. - -Репликация данных в ClickHouse по-умолчанию является асинхронной без выделенного мастера. Это значит, что клиент, осуществляющий вставку данных, получает успешный ответ после того, как данные попали на один сервер; репликация данных по остальным серверам осуществляется в другой момент времени. Это ненадёжно, потому что допускает потерю только что вставленных данных при потере лишь одного сервера. - -Для решения этой проблемы, в ClickHouse есть возможность включить «кворумную» вставку. Это значит, что клиент, осуществляющий вставку данных, получает успешный ответ после того, как данные попали на несколько (кворум) серверов. Обеспечивается линеаризуемость: клиент, получает успешный ответ после того, как данные попали на несколько реплик, *которые содержат все предыдущие данные, вставленные с кворумом* (такие реплики можно называть «синхронными»), и при запросе SELECT можно выставить настройку, разрешающую только чтение с синхронных реплик. - -Если бы свойства линеаризуемости не было, то для трёх серверов A, B, C, значения кворума = 2, и для трёх вставок данных 1, 2, 3, возможна ситуация, что первая вставка прошла на серверы A и B, вторая прошла на серверы B и C, а третья - на серверы A и C, и теперь ни один из серверов не содержит полный набор данных 1, 2, 3. - -Как ни странно, такое свойство не нужно большинству пользователей. Оно запрещает параллельно выполняющиеся вставки. А пользователи хотят вставлять данные надёжно (на более чем одну реплику), но не важно, в каком порядке. Предлагается сделать опцию, которая отключает линеаризуемость. - -Иногда пользователь хочет реализовать кворумную вставку вручную: просто соединиться с несколькими репликами и вставть на них одинаковые данные (чтобы обеспечить надёжную вставку, не ориентируясь на то, как работает механизм репликации). Сейчас ожидания пользователя не оправдываются. В ClickHouse есть механизм дедупликации для обеспечения идемпотентности вставок. Вторая вставка с такими же данными (пусть даже на другую реплику) будет проигнорирована. Надо сделать так, чтобы вместо этого, вставка одинаковых данных на другую реплику, имела такой же эффект, как если бы эти данные были получены с помощью механизма репликации. - -### 19.2. Подключение Etcd или Consul как альтернативы ZooKeeper. {#podkliuchenie-etcd-ili-consul-kak-alternativy-zookeeper} - -Алексей Лёвушкин, ВШЭ и Яндекс. - -Для координации реплик в ClickHouse используется ZooKeeper. Многие пользователи ClickHouse хотели бы иметь возможность использовать для координации некоторые другие системы вместо ZooKeeper. Рассматриваемыми вариантами таких систем являются Etcd, Consul, FoundationDB. Это весьма проблематично, так как эти системы существенно отличаются по интерфейсам и возможностям. Тем не менее, для того, чтобы эта задача стала возможной, в ClickHouse обобщён интерфейс взаимодействия с ZooKeeper, и теперь на его место можно подставлять другие реализации. - -В прошлом году, Алексей добавил модельную реализацию (mock) интерфейса ZooKeeper для тестирования. Сейчас предлагается сделать реализацию поверх Etcd, а также расширить возможности тестовой реализации. - -Upd. Алексей сделал какой-то вариант, но борется с тем, что ничего не работает. -Upd. Есть pull request на начальной стадии. - -### 19.3. Подключение YT Cypress или YDB как альтернативы ZooKeeper. {#podkliuchenie-yt-cypress-ili-ydb-kak-alternativy-zookeeper} - -Hold. Полезно для заказчиков внутри Яндекса, но есть риски. Эту задачу никто не будет делать. - -### 19.4. internal_replication = ‘auto’. {#internal-replication-auto} - -### 19.5. Реплицируемые базы данных. {#replitsiruemye-bazy-dannykh} - -В очереди, возможно Валерий Батурин, ВШЭ. - -Репликация в ClickHouse работает на уровне отдельных таблиц. Это является очень гибким решением: на одном сервере одна из таблиц может быть не реплицирована, другая иметь двухкратную репликацию, а третья - реплицирована по всем серверам. Но если все таблицы в базе данных реплицированы одинаковым образом. то это затрудняет управление кластером. Например, при восстановлени сервера, требуется отдельно создавать реплику для каждой таблицы. - -Предлагается реализовать «движок баз данных», который осуществляет репликацию метаданных (множество имеющихся таблиц и лог DDL операций над ними: CREATE, DROP, RENAME, ALTER). Пользователь сможет создать реплицируемую базу данных; при её создании или восстановлении на другом сервере, все реплицируемые таблицы будут созданы автоматически. - -### 19.6. Одновременный выбор кусков для слияния многими репликами, отказ от leader election в ZK. {#odnovremennyi-vybor-kuskov-dlia-sliianiia-mnogimi-replikami-otkaz-ot-leader-election-v-zk} - -Обсуждается. Возможно, будет делать Александр Сапин. - -### 19.7. Возможность записи данных при недоступности ZK и отказ от линейного порядка кусков в большинстве случаев. {#vozmozhnost-zapisi-dannykh-pri-nedostupnosti-zk-i-otkaz-ot-lineinogo-poriadka-kuskov-v-bolshinstve-sluchaev} - -### 19.8. Отказ от хранения в ZK множества кусков для каждой реплики отдельно. {#otkaz-ot-khraneniia-v-zk-mnozhestva-kuskov-dlia-kazhdoi-repliki-otdelno} - -### 19.9. Отказ от хранения в ZK лога вставок и мержей. Обмен данными о кусках напрямую. {#otkaz-ot-khraneniia-v-zk-loga-vstavok-i-merzhei-obmen-dannymi-o-kuskakh-napriamuiu} - -Три задачи выше обсуждаются, есть варианты. - -### 19.10. Облачные таблицы. {#oblachnye-tablitsy} - -Требует 1.6, 19.1, 19.6, 19.7, 19.8, 19.9. - - -## 20. Мутации данных. {#mutatsii-dannykh} - -Пока все задачи по точечным UPDATE/DELETE имеют низкий приоритет, но ожидаем взять в работу в середине 2020. - -### 20.1. Поддержка DELETE путём запоминания множества затронутых кусков и ключей. {#podderzhka-delete-putiom-zapominaniia-mnozhestva-zatronutykh-kuskov-i-kliuchei} - -### 20.2. Поддержка DELETE путём преобразования множества ключей в множество row_numbers на реплике, столбца флагов и индекса по диапазонам. {#podderzhka-delete-putiom-preobrazovaniia-mnozhestva-kliuchei-v-mnozhestvo-row-numbers-na-replike-stolbtsa-flagov-i-indeksa-po-diapazonam} - -### 20.3. Поддержка ленивых DELETE путём запоминания выражений и преобразования к множеству ключей в фоне. {#podderzhka-lenivykh-delete-putiom-zapominaniia-vyrazhenii-i-preobrazovaniia-k-mnozhestvu-kliuchei-v-fone} - -### 20.4. Поддержка UPDATE с помощью преобразования в DELETE и вставок. {#podderzhka-update-s-pomoshchiu-preobrazovaniia-v-delete-i-vstavok} - - -## 21. Оптимизации производительности. {#optimizatsii-proizvoditelnosti} - -### 21.1. + Параллельный парсинг форматов. {#parallelnyi-parsing-formatov} - -Начинал Олег Ершов, доделывает Никита Михайлов, помогает [Александр Кузьменков](https://github.com/akuzm). Готово. - -### 21.1.1. Избавление от лишнего копирования при параллельном парсинге форматов, если возможен mmap файла целиком. {#izbavlenie-ot-lishnego-kopirovaniia-pri-parallelnom-parsinge-formatov-esli-vozmozhen-mmap-faila-tselikom} - -### 21.2. Параллельное форматирование форматов. {#parallelnoe-formatirovanie-formatov} - -После 21.1, предположительно Никита Михайлов. Задача сильно проще чем 21.1. - -### 21.3. + Исправление низкой производительности анализа индекса в случае большого множества в секции IN. {#ispravlenie-nizkoi-proizvoditelnosti-analiza-indeksa-v-sluchae-bolshogo-mnozhestva-v-sektsii-in} - -Нужно всем (Zen, БК, DataLens, TestEnv…). Антон Попов, Q1/Q2. - -Upd. Антон делает эту задачу. Большая часть уже реализована. - -### 21.4. Использование ORDER BY ключа для оптимизации GROUP BY и DISTINCT. {#ispolzovanie-order-by-kliucha-dlia-optimizatsii-group-by-i-distinct} - -Дмитрий Рубашкин, ВШЭ. Помогает Антон Попов. - -Если таблица имеет ключ сортировки, то возможно эффективное чтение упорядоченных данных. Если запрос содержит операцию GROUP BY, содержащую по крайней мере префикс от ключа сортировки таблицы, либо инъективные функции от него, то возможно более эффективное выполнение GROUP BY: промежуточный результат агрегации финализируется и отправляется клиенту как только в потоке данных при чтении из таблицы встретился следующий ключ. - -Аналогичную оптимизацию следует реализовать для DISTINCT и LIMIT BY. - -В прошлом году, аналогичное решение сделали для операции ORDER BY. - -### 21.5. + Распараллеливание INSERT при INSERT SELECT, если это необходимо. {#rasparallelivanie-insert-pri-insert-select-esli-eto-neobkhodimo} - -[Vxider](https://github.com/Vxider), ICT -Есть pull request. - -### 21.6. Уменьшение числа потоков для SELECT в случае тривиального INSERT SELECT. {#umenshenie-chisla-potokov-dlia-select-v-sluchae-trivialnogo-insert-select} - -### 21.7. Кэш результатов запросов. {#kesh-rezultatov-zaprosov} - -[Achimbab](https://github.com/achimbab). -Есть pull request. Но это не совсем то. - -### 21.8. Взаимная интеграция аллокатора и кэша. {#vzaimnaia-integratsiia-allokatora-i-kesha} - -Михаил Кот, ВШЭ. Задача сложная и рискованная. - -Для выделения памяти, аллокаторы запрашивают её у операционной системы (`mmap`). Это возможно только для достаточно крупных кусков памяти является довольно медленной операцией. Поэтому, современные аллокаторы кэшируют крупные куски памяти в программе. При вызове free, кусок памяти, как правило, не отдаётся ОС, а остаётся для последующего переиспользования. Для выделения мелких кусков памяти, крупные куски разбиваются с помощью специальных структур данных (free-list, heap, bitmap). Для уменьшения contention в многопоточных программах, эти структуры также делаются thread-локальными. - -Часто в программе есть кэши некоторых данных. Например - кэш данных после разжатия, использующийся чтобы сэкономить на повторных запросах одних и тех же данных. При вытеснении из кэша, блок данных освобождается (`free`) и данные, бывшие в кэше, становятся недоступными для переиспользования. Но если принимать во внимание то, как работает аллокатор памяти, то оказывается, что после освобождения памяти, данные всё ещё остаются доступными в программе. И если этот кусок памяти не будет выделен аллокатором снова, его можно было бы продолжить использовать в качестве кэша. Иными словами, в программе есть domain-specific кэш, а аллокатор имеет свой кэш, и они не знают друг о друге. - -Для domain-specific кэшей (как например, кэш разжатых данных) выгодно, чтобы они использовали как можно больший объём свободной памяти. Но в этом случае, памяти может не хватить для других структур данных в программе. Если аллокатор памяти знает про кэш, то выделение памяти можно было бы делать путём вытеснения данных из кэша. - -### 21.8.1. Отдельный аллокатор для кэшей с ASLR. {#otdelnyi-allokator-dlia-keshei-s-aslr} - -В прошлом году задачу пытался сделать Данила Кутенин с помощью lfalloc из Аркадии и mimalloc из Microsoft, но оба решения не были квалифицированы для использования в продакшене. Успешная реализация задачи 21.8 отменит необходимость в этой задаче, поэтому холд. - -### 21.9. Исправить push-down выражений с помощью Processors. {#ispravit-push-down-vyrazhenii-s-pomoshchiu-processors} - -[Николай Кочетов](https://github.com/KochetovNicolai). Требует 2.1. - -### 21.10. + Улучшение эвристики PREWHERE. {#uluchshenie-evristiki-prewhere} - -Amos Bird. - -### 21.11. Peephole оптимизации запросов. {#peephole-optimizatsii-zaprosov} - -Руслан Камалов, Михаил Малафеев, Виктор Гришанин, ВШЭ - -Реализовать в ClickHouse оптимизации запросов, основанные на упрощении отдельных небольших кусков выражений (так называемые «peephole» оптимизации). Примеры: -- Замена цепочек if на multiIf. -- Удаление min/max/any-агрегатов от выражений от ключей GROUP BY. -- Вынесение арифметических операций из агрегатных функций; -- Вынесение любых функций наружу any, anyLast. -- При GROUP BY по transform или if по строкам, замена строк на Enum. - -Сделана замена цепочек if на multiIf, но внезапно оказалось, что это является не оптимизацией, а наоборот. - -### 21.12. Алгебраические оптимизации запросов. {#algebraicheskie-optimizatsii-zaprosov} - -Руслан Камалов, Михаил Малафеев, Виктор Гришанин, ВШЭ - -Реализовать в ClickHouse оптимизации запросов, основанные на алгебраических свойствах функций. Примеры: -- Обращение инъективных функций в сравнениях на равенство. -- Вынесение инъективных функцию наружу uniq. -- Удаление монотонных функций из ORDER BY. -- Удаление избыточных выражений из ORDER BY. -- Удаление из GROUP BY функций от других ключей GROUP BY. -- Удаление дублирующихся DISTINCT, ORDER BY из подзапросов. - -Несколько оптимизаций есть в PR. - -### 21.13. Fusion агрегатных функций. {#fusion-agregatnykh-funktsii} - -После или совместно с 21.11. - -### 21.14. Оптимизация запросов с помощью constraints. {#optimizatsiia-zaprosov-s-pomoshchiu-constraints} - -Constraints позволяют задать выражение, истинность которого проверяется при вставке данных в таблицу. Предположение о том, что выражение истинно, может использоваться и для оптимизации запросов. Например, встретив в запросе точно такое же выражение, можно заменить его на константу 1. - -Если выражение содержит равенство, то встретив в запросе одну из частей равенства, её можно заменить на другую часть равенства, если это сделает проще чтение данных или вычисление выражения. Например, задан constraint: `URLDomain = domain(URL)`. Значит, выражение `domain(URL)` можно заменить на `URLDomain`. - -### 21.15. Многоступенчатое чтение данных вместо PREWHERE. {#mnogostupenchatoe-chtenie-dannykh-vmesto-prewhere} - -Требует 2.1 и 21.10. - -### 21.16. Оптимизация GROUP BY с большим количеством агрегатных функций путём вычисления в два прохода. {#optimizatsiia-group-by-s-bolshim-kolichestvom-agregatnykh-funktsii-putiom-vychisleniia-v-dva-prokhoda} - -Нужно для БК. - -### 21.17. Оптимизация GROUP BY при наличии ORDER BY по тем же ключам с LIMIT. {#optimizatsiia-group-by-pri-nalichii-order-by-po-tem-zhe-kliucham-s-limit} - -Нужно для БК. - -### 21.18. Внутренняя параллелизация мержа больших состояний агрегатных функций. {#vnutrenniaia-parallelizatsiia-merzha-bolshikh-sostoianii-agregatnykh-funktsii} - -### 21.19. Оптимизация сортировки. {#optimizatsiia-sortirovki} - -Василий Морозов, Арслан Гумеров, Альберт Кидрачев, ВШЭ. -В прошлом году задачу начинал делать другой человек, но не добился достаточного прогресса. - -1. Оптимизация top sort. - -В ClickHouse используется неоптимальный вариант top sort. Суть его в том, что из каждого блока достаётся top N записей, а затем, все блоки мержатся. Но доставание top N записей у каждого следующего блока бессмысленно, если мы знаем, что из них в глобальный top N войдёт меньше. Конечно нужно реализовать вариацию на тему priority queue (heap) с быстрым пропуском целых блоков, если ни одна строка не попадёт в накопленный top. - -2. Рекурсивный вариант сортировки по кортежам. - -Для сортировки по кортежам используется обычная сортировка с компаратором, который в цикле по элементам кортежа делает виртуальные вызовы `IColumn::compareAt`. Это неоптимально - как из-за короткого цикла по неизвестному в compile-time количеству элементов, так и из-за виртуальных вызовов. Чтобы обойтись без виртуальных вызовов, есть метод `IColumn::getPermutation`. Он используется в случае сортировки по одному столбцу. Есть вариант, что в случае сортировки по кортежу, что-то похожее тоже можно применить… например, сделать метод `updatePermutation`, принимающий аргументы offset и limit, и допереставляющий перестановку в диапазоне значений, в которых предыдущий столбец имел равные значения. - -3. RadixSort для сортировки. - -Один наш знакомый начал делать задачу по попытке использования RadixSort для сортировки столбцов. Был сделан вариант indirect сортировки (для `getPermutation`), но не оптимизирован до конца - есть лишние ненужные перекладывания элементов. Для того, чтобы его оптимизировать, придётся добавить немного шаблонной магии (на последнем шаге что-то не копировать, вместо перекладывания индексов - складывать их в готовое место). Также этот человек добавил метод MSD Radix Sort для реализации radix partial sort. Но даже не проверил производительность. - -Наиболее содержательная часть задачи может состоять в применении Radix Sort для сортировки кортежей, расположенных в оперативке в виде Structure Of Arrays неизвестного в compile-time размера. Это может работать хуже, чем то, что описано в пункте 2… Но попробовать не помешает. - -4. Three-way comparison sort. - -Виртуальный метод `compareAt` возвращает -1, 0, 1. Но алгоритмы сортировки сравнениями обычно рассчитаны на `operator<` и не могут получить преимущества от three-way comparison. А можно ли написать так, чтобы преимущество было? - -5. pdq partial sort - -Хороший алгоритм сортировки сравнениями `pdqsort` не имеет варианта partial sort. Заметим, что на практике, почти все сортировки в запросах ClickHouse являются partial_sort, так как `ORDER BY` почти всегда идёт с `LIMIT`. Кстати, Данила Кутенин уже попробовал это и показал, что в тривиальном случае преимущества нет. Но не очевидно, что нельзя сделать лучше. - -### 21.20. Использование материализованных представлений для оптимизации запросов. {#ispolzovanie-materializovannykh-predstavlenii-dlia-optimizatsii-zaprosov} - -В ByteDance есть готовая реализация, но они её боятся из-за, возможно, низкого качества кода. - -### 21.21. + Чтение больших файлов с помощью mmap. {#chtenie-bolshikh-failov-s-pomoshchiu-mmap} - -Сделан вариант, но достаточно топорный. Без тестирования в продакшене включать по-умолчанию нельзя. - -### 21.22. Userspace page cache. {#userspace-page-cache} - -Требует 21.8. - -### 21.23. Ускорение работы с вторичными индексами. {#uskorenie-raboty-s-vtorichnymi-indeksami} - -zhang2014. -Есть pull request. - - -## 22. Долги и недоделанные возможности. {#dolgi-i-nedodelannye-vozmozhnosti} - -### 22.1. + Исправление неработающих таймаутов, если используется TLS. {#ispravlenie-nerabotaiushchikh-taimautov-esli-ispolzuetsia-tls} - -Нужно для Яндекс.Облака. Сделал Алексей Миловидов. - -### 22.2. + Убрать возможность изменить настройки в native протоколе в случае readonly. {#ubrat-vozmozhnost-izmenit-nastroiki-v-native-protokole-v-sluchae-readonly} - -N.Vartolomei. - -### 22.3. Защита от абсурдно заданных пользователем кодеков. {#zashchita-ot-absurdno-zadannykh-polzovatelem-kodekov} - -### 22.4. + Исправление оставшихся deadlocks в табличных RWLock-ах. {#ispravlenie-ostavshikhsia-deadlocks-v-tablichnykh-rwlock-akh} - -Александр Казаков. Нужно для Яндекс.Метрики и Datalens. Задача постепенно тащится и исправлениями в соседних местах стала менее актуальна. -В Q1 будет сделана или отменена с учётом 1.2. и 1.3. -Upd. Добавили таймауты. - -### 22.5. + Исправление редких срабатываний TSan в stress тестах в CI. {#ispravlenie-redkikh-srabatyvanii-tsan-v-stress-testakh-v-ci} - -Александр Казаков сделал эту задачу. - -### 22.6. + Изменение только DEFAULT в ALTER TABLE может поменять тип столбца. {#izmenenie-tolko-default-v-alter-table-mozhet-pomeniat-tip-stolbtsa} - -Александр Сапин сделал эту задачу. - -### 22.7. + Row-Level Security не работает в случае наличия в запросе IN подзапросов. {#row-level-security-ne-rabotaet-v-sluchae-nalichiia-v-zaprose-in-podzaprosov} - -Нужно для Метрики. Иван Лежанкин. - -### 22.8. + Исправить десериализацию параметров для параметризованных запросов. {#ispravit-deserializatsiiu-parametrov-dlia-parametrizovannykh-zaprosov} - -Хотел исправить Василий Немков, Altinity, но есть маленькие затруднения, наверное переделает Алексей Миловидов. - -### 22.9. Разобраться с десериализацией массивов со значениями по-умолчанию в Protobuf формате в случае protobuf 3. {#razobratsia-s-deserializatsiei-massivov-so-znacheniiami-po-umolchaniiu-v-protobuf-formate-v-sluchae-protobuf-3} - -[Виталий Баранов](https://github.com/vitlibar). Возможно, это - фундаментальная проблема и следует её только документировать. -Кажется, отменяем, но пока ещё не всё ясно. - -### 22.10. + Исправление дрифта при отслеживании потребления памяти запросами. {#ispravlenie-drifta-pri-otslezhivanii-potrebleniia-pamiati-zaprosami} - -Требует 6.3., но можно улучшить отдельными хаками. Нужно Метрике и БК. - -### 22.11. + Более простая ser/de настроек запросов. {#bolee-prostaia-serde-nastroek-zaprosov} - -И пропуск неизвестных настроек. Важно для Метрики для упрощения апгрейда без изменения конфига. -[Виталий Баранов](https://github.com/vitlibar), готово. - -### 22.12. + Исправление низкой производительности чтения из Kafka. {#ispravlenie-nizkoi-proizvoditelnosti-chteniia-iz-kafka} - -Для ClickHouse нехарактерно наличие кода, обладающего столь низкой производительностью. Практики разработки не подразумевают, что такой код должен попасть в продакшен без надлежащего тестирования производительности. - -Изначально было назначено на [Ивана Лежанкина](https://github.com/abyss7), но по неизвестной причине было не сделано в течение нескольких месяцев. -Сделал Михаил Филимонов, Altinity. - -### 22.13. + Посмотреть, почему не работают некоторые collations. {#posmotret-pochemu-ne-rabotaiut-nekotorye-collations} - -Изначально было назначено на [Ивана Лежанкина](https://github.com/abyss7), но в результате сделал Александр Сапин. - -### 22.14. + Посмотреть, почему не работает StorageSet для MergeTree таблиц при некоторых условиях. {#posmotret-pochemu-ne-rabotaet-storageset-dlia-mergetree-tablits-pri-nekotorykh-usloviiakh} - -Вроде бы сделал Никита Михайлов - проверить существующие issues на эту тему. - -### 22.15. Нормализация коммитов в Kafka и идемпотентности операций. {#normalizatsiia-kommitov-v-kafka-i-idempotentnosti-operatsii} - -Altinity. - -### 22.16. + Исправление низкой производительности кодека DoubleDelta. {#ispravlenie-nizkoi-proizvoditelnosti-kodeka-doubledelta} - -Василий Немков, Altinity - в процессе. -Можно считать, что сделано, хотя отсутствие SIMD оптимизаций для variable length кодеков - это ужасно. - -### 22.17. Консистентно работающий POPULATE для MaterializedView. {#konsistentno-rabotaiushchii-populate-dlia-materializedview} - -### 22.18. Исправление заметного падения производительности форматов после добавления доменов типов. {#ispravlenie-zametnogo-padeniia-proizvoditelnosti-formatov-posle-dobavleniia-domenov-tipov} - -Василий Немков, Altinity. - -### 22.19. + Одновременное использование SAMPLE и PREWHERE. {#odnovremennoe-ispolzovanie-sample-i-prewhere} - -Нужно для Метрики. [Николай Кочетов](https://github.com/KochetovNicolai), ноябрь 2019. - -### 22.20. + Неправильная работа PREWHERE при некоторых условиях. {#nepravilnaia-rabota-prewhere-pri-nekotorykh-usloviiakh} - -[Николай Кочетов](https://github.com/KochetovNicolai), декабрь 2019. - -### 22.21. + Неправильное поведение DateTime в районе начала unix epoch. {#nepravilnoe-povedenie-datetime-v-raione-nachala-unix-epoch} - -Алексей Миловидов. - -### 22.22. Nullable в функции transform и в CASE по множеству значений. {#nullable-v-funktsii-transform-i-v-case-po-mnozhestvu-znachenii} - -После 10.14. - -[\#7237](https://github.com/ClickHouse/ClickHouse/issues/7237) -[\#2655](https://github.com/ClickHouse/ClickHouse/issues/2655) - -### 22.23. Правильная обработка Nullable в функциях, которые кидают исключение на default значении: modulo, intDiv. {#pravilnaia-obrabotka-nullable-v-funktsiiakh-kotorye-kidaiut-iskliuchenie-na-default-znachenii-modulo-intdiv} - -### 22.24. Излишняя фильтрация ODBC connection string. {#izlishniaia-filtratsiia-odbc-connection-string} - -Нужно для Метрики. Алексей Миловидов. - -### 22.25. Избавиться от библиотеки btrie. {#izbavitsia-ot-biblioteki-btrie} - -Алексей Миловидов. Низкий приоритет. - -### 22.26. Плохая производительность quantileTDigest. {#plokhaia-proizvoditelnost-quantiletdigest} - -[\#2668](https://github.com/ClickHouse/ClickHouse/issues/2668) - -Алексей Миловидов или будет переназначено. - -### 22.27. Проверить несколько PR, которые были закрыты zhang2014 и sundy-li. {#proverit-neskolko-pr-kotorye-byli-zakryty-zhang2014-i-sundy-li} - -Алексей Миловидов. - -### 22.28. Изучить и исправить поведение работы с Kafka при ребалансировке. {#izuchit-i-ispravit-povedenie-raboty-s-kafka-pri-rebalansirovke} - -Altinity. - -### 22.29. + Уязвимость DDL для словарей executable. {#uiazvimost-ddl-dlia-slovarei-executable} - -[Александр Сапин](https://github.com/alesapin) - - -## 23. Default Festival. {#default-festival} - -### 23.1. + Включение minimalistic_part_header в ZooKeeper. {#vkliuchenie-minimalistic-part-header-v-zookeeper} - -Сильно уменьшает объём данных в ZooKeeper. Уже год в продакшене в Яндекс.Метрике. -Алексей Миловидов, ноябрь 2019. - -### 23.2. Включение distributed_aggregation_memory_efficient. {#vkliuchenie-distributed-aggregation-memory-efficient} - -Есть риски меньшей производительности лёгких запросов, хотя производительность тяжёлых запросов всегда увеличивается. - -### 23.3. Включение min_bytes_to_external_sort и min_bytes_to_external_group_by. {#vkliuchenie-min-bytes-to-external-sort-i-min-bytes-to-external-group-by} - -Желательно 5.2. и 13.1. - -### 23.4. Включение синхронной записи в Distributed таблицы по-умолчанию. {#vkliuchenie-sinkhronnoi-zapisi-v-distributed-tablitsy-po-umolchaniiu} - -Есть гипотеза, что плохо работает на очень больших кластерах. - -### 23.5. Включение compile_expressions. {#vkliuchenie-compile-expressions} - -Требует 7.2. Задачу изначально на 99% сделал Денис Скоробогатов, ВШЭ и Яндекс. Остальной процент доделывал Алексей Миловидов, а затем [Александр Сапин](https://github.com/alesapin). - -### 23.6. Включение учёта порядка столбцов в CSV. {#vkliuchenie-uchiota-poriadka-stolbtsov-v-csv} - -Просто аккуратно включить. - -### 23.7. Включение NULL as Default в CSV. {#vkliuchenie-null-as-default-v-csv} - -Просто аккуратно включить. - -### 23.8. + Включение оптимизации VALUES. {#vkliuchenie-optimizatsii-values} - -Просто аккуратно включить. - -### 23.9. + Включение Processors. {#vkliuchenie-processors} - -Q1. [Николай Кочетов](https://github.com/KochetovNicolai). - -### 23.10. Включение mlock бинарника. {#vkliuchenie-mlock-binarnika} - -Возможность mlock бинарника сделал Олег Алексеенков [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) -. Поможет, когда на серверах кроме ClickHouse работает много посторонних программ (мы иногда называем их в шутку «треш-программами»). - - -## 24. Экспериментальные задачи. {#eksperimentalnye-zadachi} - -### 24.1. Веб-интерфейс для просмотра состояния кластера и профилирования запросов. {#veb-interfeis-dlia-prosmotra-sostoianiia-klastera-i-profilirovaniia-zaprosov} - -Антон Мамонов, УрФУ, Яндекс. - -Внутри ClickHouse есть богатые возможности по интроспекции и профилированию. Эти возможности доступны через системные таблицы и использовать их приходится путём формулирования SQL запросов. Это неудобно. - -Вместо этого предлагается сделать, чтобы ClickHouse отдавал HTML страницу, реализующую интерактивный web-интерфейс со следующими возможностями: -- отображение состояния кластеров (какие кластеры известны, статус каждого сервера); -- графики нагрузки текущего сервера или выбранного сервера кластера; -- обновляемый список запросов; -- просмотр лога запросов с наиболее востребованными фильтрациями по одной кнопке; -- просмотр лога на кластере, например - последние ошибки; -- просмотр метрик использования ресурсов, flame graph и pprof-граф для выбранных запросов; -- отчёт по использованию кластера (пример: количество ядер CPU по пользователям за сегодня). - -### 24.2. Экспериментальные алгоритмы сжатия. {#eksperimentalnye-algoritmy-szhatiia} - -ClickHouse поддерживает LZ4 и ZSTD для сжатия данных. Эти алгоритмы являются парето-оптимальными по соотношению скорости и коэффициентам сжатия среди достаточно известных. Тем не менее, существуют менее известные алгоритмы сжатия, которые могут превзойти их по какому-либо критерию. Из потенциально более быстрых по сравнимом коэффициенте сжатия: Lizard, LZSSE, density. Из более сильных: bsc и csc. Необходимо изучить эти алгоритмы, добавить их поддержку в ClickHouse и исследовать их работу на тестовых датасетах. - -### 24.3. Экспериментальные кодеки. {#eksperimentalnye-kodeki} - -Вероника Фалчикова, Лада Торчик, ВШЭ. - -Существуют специализированные алгоритмы кодирования числовых последовательностей: Group VarInt, MaskedVByte, PFOR. Необходимо изучить наиболее эффективные реализации этих алгоритмов. Примеры вы сможете найти на https://github.com/lemire и https://github.com/powturbo/ а также https://github.com/schizofreny/middle-out - -Внедрить их в ClickHouse в виде кодеков и изучить их работу на тестовых датасетах. - -### 24.4. Шифрование в ClickHouse на уровне VFS. {#shifrovanie-v-clickhouse-na-urovne-vfs} - -Данные в ClickHouse хранятся без шифрования. При наличии доступа к дискам, злоумышленник может прочитать данные. Предлагается реализовать два подхода к шифрованию: - -1. Шифрование на уровне VFS. - -Обсуждаются детали реализации. Q3/Q4. - -### 24.5. Поддержка функций шифрования для отдельных значений. {#podderzhka-funktsii-shifrovaniia-dlia-otdelnykh-znachenii} - -Смотрите также 24.5. - -2. Шифрование отдельных значений. - Для этого требуется реализовать функции шифрования и расшифрования, доступные из SQL. Для шифрования реализовать возможность добавления нужного количества случайных бит для исключения одинаковых зашифрованных значений на одинаковых данных. Это позволит реализовать возможность «забывания» данных без удаления строк таблицы: можно шифровать данные разных клиентов разными ключами, и для того, чтобы забыть данные одного клиента, потребуется всего лишь удалить ключ. - -### 24.6. Userspace RAID. {#userspace-raid} - -Глеб Новиков, ВШЭ. - -RAID позволяет одновременно увеличить надёжность хранения данных на дисках и увеличить скорость работы дискового массива. Обычно RAID настраивается с помощью встроенных возможностей ядра Linux (mdraid) или с помощью hardware контроллера. У этого есть следующие ограничения: - -1. Иногда (в облачной инфраструктуре некоторых компаний) сервер предоставляется с отдельными дисками, подмонтированными в виде отдельных разделов (JBOD), без возможности создания RAID. - -2. В ClickHouse для обеспечения избыточности обычно используется репликация между серверами. Но при восстановлении одного из дисков RAID не используются данные с реплик, а в случае отказа одного из дисков в RAID-0, приходится передавать с реплики все данные, а не только данные, соответствующие одному из дисков. Это происходит, потому что RAID не интегрирован в ClickHouse и «не знает» про его особенности. - -3. Отсутствуют продвинутые варианты обеспечения избыточности, как например, LRC. - -Для преодоления этих ограничений, предлагается реализовать в ClickHouse встроенный алгоритм расположения данных на дисках. - -### 24.7. Вероятностные структуры данных для фильтрации по подзапросам. {#veroiatnostnye-struktury-dannykh-dlia-filtratsii-po-podzaprosam} - -Рузель Ибрагимов, ВШЭ и Яндекс. - -Частой задачей является выполнение запроса с фильтрацией по множеству, полученному по подзапросу. Пример: найти пользователей, которые заходили на сайт сегодня и заходили неделю назад. Это выражается в виде запроса: `SELECT UserID FROM table WHERE EventDate = today() AND UserID IN (SELECT ...)`. При выполнении этого запроса, сначала выполняется подзапрос в правой части `IN` и формируется хэш-таблица в оперативке; затем эта хэш-таблица используется для фильтрации. - -Иногда объём данных достаточно большой, и хэш-таблица не помещается в оперативку. В этом случае можно рассмотреть в качестве варианта приближённый рассчёт: найти пользователей, которые заходили на сайт сегодня и наверное заходили неделю назад. Для этого можно вместо хэш-таблицы использовать Bloom Filter. Другая задача: найти пользователей, которые встречались, скорее всего, не менее некоторого количества раз. Для этого можно использовать Counting Bloom Filter. Также следует изучить структуры данных Quotient Filter и Cuckoo Filer, а ещё - секретный алгоритм Chaotic Map от Андрея Плахова. - -Предлагается реализовать это в языке запросов ClickHouse с помощью специального синтаксиса, например `x IN BLOOM FILTER (n, m) (SELECT ...)`. - -### 24.8. Специализация векторизованного кода для AVX/AVX2/AVX512 и ARM NEON. {#spetsializatsiia-vektorizovannogo-koda-dlia-avxavx2avx512-i-arm-neon} - -[\#1017](https://github.com/ClickHouse/ClickHouse/issues/1017) - -Дмитрий Ковальков, ВШЭ и Яндекс. - -Подавляющее большинство кода ClickHouse написана для x86_64 с набором инструкций до SSE 4.2 включительно. Лишь отдельные редкие функции поддерживают AVX/AVX2/AVX512 с динамической диспетчеризацией. - -В первой части задачи, следует добавить в ClickHouse реализации некоторых примитивов, оптимизированные под более новый набор инструкций. Например, AVX2 реализацию генератора случайных чисел pcg: https://github.com/lemire/simdpcg - -Во второй части задачи, предлагается адаптировать существующие куски кода, использующие SSE intrinsics на AVX/AVX2 и сравнить производительность. Также рассматривается оптимизация под ARM NEON. - -### 24.9. Общий подход к CPU dispatching в фабрике функций. {#obshchii-podkhod-k-cpu-dispatching-v-fabrike-funktsii} - -Дмитрий Ковальков, ВШЭ и Яндекс. - -Продолжение 24.8. - -Upd. Есть pull request. - -### 24.10. Поддержка типов half/bfloat16/unum. {#podderzhka-tipov-halfbfloat16unum} - -[\#7657](https://github.com/ClickHouse/ClickHouse/issues/7657) - -Рустам Гусейн-заде, ВШЭ. - -### 24.11. User Defined Functions. {#user-defined-functions} - -Игорь Минеев, ВШЭ. - -ClickHouse предоставляет достаточно богатый набор встроенных функций языка запросов, но не позволяет пользователю добавлять свои функции без редактировния исходников и перекомпиляции системы. Это мотивировано следующими потенциальными проблемами: - -1. ClickHouse является array-oriented системой, и все функции внутри кода принимают для обработки целые массивы, а не отдельные значения. Это усложняет внутренний интерфейс и делает его менее удобным для пользователя. -2. Предоставление возможности подключения UDF в виде shared библиотек, потребовало бы фиксировать этот интерфейс или поддерживать обратную совместимость, тогда как мы бы хотели, при разработке ClickHouse, менять этот интерфейс по своему усмотрению без оглядки. -3. Сложность внутренних структур данных повышает вероятность ошибок типа buffer overflow и повреждения памяти, что сильно затруднит сопровождение ClickHouse с пользовательскими функциями. - -Тем не менее, можно выбрать более аккуратный подход, избегающий непосредственной линковки с shared библиотеками. - -Сначала можно реализовать поддержку UDF в виде выражений, составленных из простых функций ClickHouse. В ClickHouse есть встроенная кодогенерация на LLVM, что позволит таким функциям работать весьма эффективно. Но этот подход весьма ограничен и поэтому не является исчерпывающим. - -Затем предлагается реализовать поддержку UDF в виде исходников на C++, которые компилируются в runtime, с использованием заголовочных файлов ClickHouse. Требование компиляции из исходников вместо shared библиотек, позволит ослабить необходимость в поддержке совместимости ABI. - -Для безопасности, потребуется исследовать возможность размещения буферов данных в shared memory для выполнения UDF в отдельных процессах с изоляцией по памяти. Возможно, для этого пригодится интеграция с Apache Arrow. - -Также рассматривается возможность написания UDF на Rust, а также использование Web Assembly. Отдельно можно рассмотреть подключение NumPy и R и других технологий, которые предоставляют операции над целыми массивами. - -### 24.12. GPU offloading. {#gpu-offloading} - -Риск состоит в том, что даже известные GPU базы, такие как OmniSci, работают медленнее, чем ClickHouse. -Преимущество возможно только на полной сортировке и JOIN. -Алексей Соловей, nVidia и Рита Коннова, ВШЭ. - -В компании nVidia сделали прототип offloading вычисления GROUP BY с некоторыми из агрегатных функций в ClickHouse и обещат предоставить исходники в публичный доступ для дальнейшего развития. Предлагается изучить этот прототип и расширить его применимость для более широкого сценария использования. В качестве альтернативы, предлагается изучить исходные коды системы `OmniSci` или `Alenka` или библиотеку `CUB` https://nvlabs.github.io/cub/ и применить некоторые из алгоритмов в ClickHouse. - -Upd. В компании nVidia выложили прототип, теперь нужна интеграция в систему сборки. -Upd. Интеграция в систему сборки - Иван Лежанкин. -Upd. Есть прототип bitonic sort. - -### 24.13. Stream запросы. {#stream-zaprosy} - -Пререквизит для ClickHouse как CEP-системы. - -### 24.14. Window функции. {#window-funktsii} - -[\#1469](https://github.com/ClickHouse/ClickHouse/issues/1469) - -Требует 2.1. - -### 24.15. Поддержка полуструктурированных данных. {#podderzhka-polustrukturirovannykh-dannykh} - -Требует 1.14 и 2.10. - -### 24.16. Улучшение эвристики слияний. {#uluchshenie-evristiki-sliianii} - -В прошлом году исследование по этой задаче сделал Егор Соловьёв, ВШЭ и Яндекс.Такси. Его исследование показало, что алгоритм нельзя существенно улучшить путём изменения параметров. Но исследование лажовое, так как рассмотрен только уже использующийся алгоритм. То есть, задача остаётся открытой. - -### 24.17. Экспериментальные способы ускорения параллельного GROUP BY. {#eksperimentalnye-sposoby-uskoreniia-parallelnogo-group-by} - -Максим Серебряков - -Задача в работе. - -### 24.18. Не TCP протокол передачи файлов при репликации. {#ne-tcp-protokol-peredachi-failov-pri-replikatsii} - -### 24.19. Промежуточное состояние GROUP BY как структура данных для key-value доступа. {#promezhutochnoe-sostoianie-group-by-kak-struktura-dannykh-dlia-key-value-dostupa} - -### 24.20. Short-circuit вычисления некоторых выражений. {#short-circuit-vychisleniia-nekotorykh-vyrazhenii} - -Два года назад задачу попробовала сделать Анастасия Царькова, ВШЭ и Яндекс, но реализация получилась слишком неудобной и её удалили. - -### 24.21. Реализация в ClickHouse протокола распределённого консенсуса. {#realizatsiia-v-clickhouse-protokola-raspredelionnogo-konsensusa} - -Имеет смысл только после 19.2. - -### 24.22. Вывод типов по блоку данных. Вывод формата данных по примеру. {#vyvod-tipov-po-bloku-dannykh-vyvod-formata-dannykh-po-primeru} - -Задача отложена. - -ClickHouse является строго типизированной системой. Для того, чтобы прочитать данные в каком либо формате (например, CSV), требуется заранее указать типы данных. Если при чтении формата выясняется, что данные не могут быть прочитаны в рамках заданных типов, то кидается исключение. - -ClickHouse также может использоваться для быстрой аналитики по локальным файлам, без загрузки их в базу данных (программа `clickhouse-local`). В этом случае, его использование может заменить `awk`, `sed`, `grep`. Но остаётся неудобство - необходимость указания типов данных. - -Предлагается реализовать функциональность вывода типов по первому блоку данных путём применения эвристик и постепенного расширения типов. - -Другая экспериментальная задача - реализация эвристик для обработки данных в неизвестном построчном текстовом формате. Детектирование CSV, TSV, JSON, детектирование разделителей и форматов значений. - -### 24.23. Минимальная поддержка транзакций для множества вставок/чтений. {#minimalnaia-podderzhka-tranzaktsii-dlia-mnozhestva-vstavokchtenii} - -Максим Кузнецов, ВШЭ. - -Таблицы типа MergeTree состоят из набора независимых неизменяемых «кусков» данных. При вставках данных (INSERT), формируются новые куски. При модификациях данных (слияние кусков), формируются новые куски, а старые - становятся неактивными и перестают использоваться следующими запросами. Чтение данных (SELECT) производится из снэпшота множества кусков на некоторый момент времени. Таким образом, чтения и вставки не блокируют друг друга. - -Если же выполняется несколько запросов SELECT, то чтение данных может осуществляться из снэпшотов по состоянию на несколько разных моментов времени и быть неконсистентным. Пример: пользователю отображается отчёт из нескольких графиков и таблиц, но из-за того, что между разными запросами, данные успели обновиться, отображаемые данные не соответствуют друг другу. - -Пример с другой стороны - пользователь хочет осуществить несколько вставок (INSERT) в одну или несколько таблиц, но так, чтобы данные появились в них атомарно с точки зрения других запросов (SELECT). - -Для решения этих проблем, предлагается ввести глобальные метки времени для кусков данных (сейчас уже есть инкрементальные номера кусков, но они выделяются в рамках одной таблицы). Первым шагом сделаем эти метки времени в рамках сервера. Вторым шагом сделаем метки времени в рамках всех серверов, но неточные на основе локальных часов. Третьим шагом сделаем метки времени, выдаваемые сервисом координации. - -### 24.24. Реализация алгоритмов differential privacy. {#realizatsiia-algoritmov-differential-privacy} - -[\#6874](https://github.com/ClickHouse/ClickHouse/issues/6874) - -Артём Вишняков, ВШЭ. - -### 24.25. Интеграция в ClickHouse функциональности обработки HTTP User Agent. {#integratsiia-v-clickhouse-funktsionalnosti-obrabotki-http-user-agent} - -[\#157](https://github.com/ClickHouse/ClickHouse/issues/157) -Есть хороший код в Яндекс.Метрике. Получено согласие от руководства. -Михаил Филитов, ВШЭ. - -### 24.26. Поддержка open tracing или аналогов. {#podderzhka-open-tracing-ili-analogov} - -[\#5182](https://github.com/ClickHouse/ClickHouse/issues/5182) - -Александр Кожихов, ВШЭ и Яндекс.YT. - -### 24.27. Реализация алгоритмов min-hash, sim-hash для нечёткого поиска полудубликатов. {#realizatsiia-algoritmov-min-hash-sim-hash-dlia-nechiotkogo-poiska-poludublikatov} - -[\#7649](https://github.com/ClickHouse/ClickHouse/pull/7649) - -ucasFL, ICT. - -Алгоритмы min-hash и sim-hash позволяют вычислить для текста несколько хэш-значений таких, что при небольшом изменении текста, по крайней мере один из хэшей не меняется. Вычисления можно реализовать на n-грамах и словарных шинглах. Предлагается добавить поддержку этих алгоритмов в виде функций в ClickHouse и изучить их применимость для задачи нечёткого поиска полудубликатов. - -Есть pull request, есть что доделывать. - -### 24.28. Другой sketch для квантилей. {#drugoi-sketch-dlia-kvantilei} - -Похоже на quantileTiming, но с логарифмическими корзинами. См. DDSketch. - -### 24.29. Поддержка Arrow Flight. {#podderzhka-arrow-flight} - -[\#7554](https://github.com/ClickHouse/ClickHouse/issues/7554) - -Жанна Зосимова, ВШЭ. - -### 24.30. ClickHouse как графовая СУБД. {#clickhouse-kak-grafovaia-subd} - -Amos Bird, но его решение слишком громоздкое и пока не open-source. - -### 24.31. Кореллированные подзапросы. {#korellirovannye-podzaprosy} - -Перепиcывание в JOIN. Не раньше 21.11, 21.12, 21.9. Низкий приоритет. - -### 24.32. Поддержка GRPC. {#podderzhka-grpc} - -Мария Конькова, ВШЭ и Яндекс. -Также смотрите 24.29. - -В ClickHouse есть два основных протокола: родной протокол общения между серверами и HTTP/1.1 протокол. HTTP/1.1 протокол удобен для работы из самых разных языков программирования, но, в отличие от родного протокола, не поддерживает двусторонний обмен информацией во время запроса: -- передачу информации о прогрессе во время выполнения запроса; -- передачу логов во время выполнения запроса; -- отмену выполнения запроса в тот момент как данные ещё не начали передаваться; - -Рассматривается вариант - поддержка GRPC в ClickHouse. Здесь есть неочевидные моменты, такие как - эффективная передача массивов данных в column-oriented формате - насколько удобно будет обернуть это в GRPC. - -Задача в работе, есть pull request. - -## 25. DevRel {#devrel} - -### 25.1. + Перевод инструкции для начинающих разработчиков. {#perevod-instruktsii-dlia-nachinaiushchikh-razrabotchikov} - -Александр Казаков, ноябрь 2019. - -### 25.2. + Вычитка и выкладка статьи про обфускацию данных на английском. {#vychitka-i-vykladka-stati-pro-obfuskatsiiu-dannykh-na-angliiskom} - -Эми, Александр Казаков, Алексей Миловидов, Q1. -Готово к выкладке. - -### 25.3. Подготовка статьи «Секреты оптимизации производительности ClickHouse». {#podgotovka-stati-sekrety-optimizatsii-proizvoditelnosti-clickhouse} - -Алексей Миловидов, Леонид. - -### 25.4. Подготовка статьи «Профайлер запросов: трудный путь». {#podgotovka-stati-profailer-zaprosov-trudnyi-put} - -Алексей Миловидов, Леонид. - -### 25.5. Подготовка статьи «Тестирование ClickHouse, которое мы заслужили». {#podgotovka-stati-testirovanie-clickhouse-kotoroe-my-zasluzhili} - -### 25.6. Перевод этих статей на английский. {#perevod-etikh-statei-na-angliiskii} - -Требует 25.3, 25.4, 25.5. Эми - -### 25.7. Перевод статьи Данилы Кутенина на английский. {#perevod-stati-danily-kutenina-na-angliiskii} - -Эми - -### 25.8. + Выступление keynote на BDTC. {#vystuplenie-keynote-na-bdtc} - -Алексей Миловидов - -### 25.9. Подготовка докладчиков: khvostikao, ilezhankin, nikitamikhailov, akuzm и другие. {#podgotovka-dokladchikov-khvostikao-ilezhankin-nikitamikhailov-akuzm-i-drugie} - -[Ольга Хвостикова](https://github.com/stavrolia), [Иван Лежанкин](https://github.com/abyss7), Никита Михайлов, [Александр Кузьменков](https://github.com/akuzm), Артём Зуйков. -Уже готовые докладчики: Алексей Миловидов, [Николай Кочетов](https://github.com/KochetovNicolai), [Александр Сапин](https://github.com/alesapin). -Получаем минимум 8 докладчиков в 2020 году. - -### 25.10. Митапы в России и Беларуси: Москва x2 + митап для разработчиков или хакатон, Санкт-Петербург, Минск, Нижний Новгород, Екатеринбург, Новосибирск и/или Академгородок, Иннополис или Казань. {#mitapy-v-rossii-i-belarusi-moskva-x2-mitap-dlia-razrabotchikov-ili-khakaton-sankt-peterburg-minsk-nizhnii-novgorod-ekaterinburg-novosibirsk-iili-akademgorodok-innopolis-ili-kazan} - -Екатерина - организация. Upd. Проведено два онлайн митапа на русском. - -### 25.11. Митапы зарубежные: восток США (Нью Йорк, возможно Raleigh), возможно северо-запад (Сиэтл), Китай (Пекин снова, возможно митап для разработчиков или хакатон), Лондон. {#mitapy-zarubezhnye-vostok-ssha-niu-iork-vozmozhno-raleigh-vozmozhno-severo-zapad-sietl-kitai-pekin-snova-vozmozhno-mitap-dlia-razrabotchikov-ili-khakaton-london} - -[Иван Блинков](https://github.com/blinkov/) - организация. Две штуки в США запланированы. Upd. Два митапа в США и один в Европе проведены. - -### 25.12. Статья «научная» - про устройство хранения данных и индексов или whitepaper по архитектуре. Есть вариант подать на VLDB. {#statia-nauchnaia-pro-ustroistvo-khraneniia-dannykh-i-indeksov-ili-whitepaper-po-arkhitekture-est-variant-podat-na-vldb} - -Низкий приоритет. Алексей Миловидов. - -### 25.13. Участие во всех мероприятиях Яндекса, которые связаны с разработкой бэкенда, C++ разработкой или с базами данных, возможно участие в DevRel мероприятиях. {#uchastie-vo-vsekh-meropriiatiiakh-iandeksa-kotorye-sviazany-s-razrabotkoi-bekenda-c-razrabotkoi-ili-s-bazami-dannykh-vozmozhno-uchastie-v-devrel-meropriiatiiakh} - -Алексей Миловидов и все подготовленные докладчики - -### 25.14. Конференции в России: все HighLoad, возможно CodeFest, DUMP или UWDC, возможно C++ Russia. {#konferentsii-v-rossii-vse-highload-vozmozhno-codefest-dump-ili-uwdc-vozmozhno-c-russia} - -Алексей Миловидов и все подготовленные докладчики. -Upd. Есть Saint HighLoad online. - -### 25.15. Конференции зарубежные: Percona, DataOps, попытка попасть на более крупные. {#konferentsii-zarubezhnye-percona-dataops-popytka-popast-na-bolee-krupnye} - -Алексей Миловидов и все подготовленные докладчики - -### 25.16. Сайт play.clickhouse. {#sait-play-clickhouse} - -Цель состоит в реализации сайта, на котором можно попробовать задавать произвольные запросы к временному экземпляру ClickHouse и изучать его поведение. Из похожих проектов можно отметить: [Compiler Explorer](https://godbolt.org/), http://ideone.com/, [SQLFiddle](http://sqlfiddle.com/), [DB-Fiddle](https://www.db-fiddle.com/). - -С помощью такого сайта можно решать следующие задачи: -- ознакомление с языком запросов ClickHouse; -- демонстрация примеров из документации; -- демонстрация скорости работы на тестовых датасетах; -- сравнение поведения разных версий ClickHouse друг с другом; -- демонстрация неожиданного поведения или багов; - -Требуется проработать вопрос безопасности и изоляции инстансов (поднятие в контейнерах с ограничениями по сети), подключение тестовых датасетов с помощью copy-on-write файловой системы; органичения ресурсов. - -Есть минимальный прототип. Сделал Илья Яцишин. Этот прототип не позволяет делиться ссылками на результаты запросов. - -### 25.17. Взаимодействие с ВУЗами: ВШЭ, УрФУ, ICT Beijing. {#vzaimodeistvie-s-vuzami-vshe-urfu-ict-beijing} - -Алексей Миловидов и вся группа разработки - -### 25.18. - Лекция в ШАД. {#lektsiia-v-shad} - -Алексей Миловидов - -### 25.19. Участие в курсе разработки на C++ в ШАД. {#uchastie-v-kurse-razrabotki-na-c-v-shad} - -### 25.20. Ещё одно сравнение производительности аналитических СУБД. {#eshchio-odno-sravnenie-proizvoditelnosti-analiticheskikh-subd} - -Матвей Бубнов, УрФУ - -Существуют мало известные специализированные СУБД, способные конкурировать с ClickHouse по скорости обработки некоторых классов запросов. Пример: `TDEngine` и `DolphinDB`, `VictoriaMetrics`, а также `Apache Doris` и `LocustDB`. Предлагается изучить и классифицировать архитектурные особенности этих систем - их особенности и преимущества. Установить эти системы, загрузить тестовые данные, изучить производительность. Проанализировать, за счёт чего достигаются преимущества. - -### 25.21. Повторное награждение контрибьюторов в Китае. {#povtornoe-nagrazhdenie-kontribiutorov-v-kitae} - -### 25.22. On-site помощь с ClickHouse компаниям в дни рядом с мероприятиями. {#on-site-pomoshch-s-clickhouse-kompaniiam-v-dni-riadom-s-meropriiatiiami} - -[Иван Блинков](https://github.com/blinkov/) - организация. Проверил мероприятие для турецкой компании. - -### 25.23. Новый мерч для ClickHouse. {#novyi-merch-dlia-clickhouse} - -### 25.24. Конкурсы bughunter или оптимизации кода на C++. {#konkursy-bughunter-ili-optimizatsii-koda-na-c} - -Проведение конкурсов должно начинаться для сотрудников Яндекса, пока нет согласования. - -### 25.25. Семинары для потенциальных клиентов Яндекс.Облака. {#seminary-dlia-potentsialnykh-klientov-iandeks-oblaka} - -По мере необходимости. Алексей Миловидов, организация - Яндекс.Облако. - -### 25.26. - Участие в GSoC. {#uchastie-v-gsoc} - -Андрей Бородин пытается уговорить нас участвовать, но пока загружены задачей 25.17. - -UPD: не участвуем. - -### 25.27. + Обновить сайт ClickHouse. {#obnovit-sait-clickhouse} - -Иван Блинков. Нет рисков. Нужно для Яндекс.Облака. Upd. Сделано. diff --git a/docs/ru/whats_new/index.md b/docs/ru/whats_new/index.md deleted file mode 100644 index b97b3623a9e..00000000000 --- a/docs/ru/whats_new/index.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -toc_folder_title: Что нового? -toc_priority: 72 ---- - - diff --git a/docs/ru/whats_new/roadmap.md b/docs/ru/whats_new/roadmap.md deleted file mode 120000 index 5ef0ebdb1bb..00000000000 --- a/docs/ru/whats_new/roadmap.md +++ /dev/null @@ -1 +0,0 @@ -../../en/whats_new/roadmap.md \ No newline at end of file diff --git a/docs/ru/whats_new/security_changelog.md b/docs/ru/whats_new/security_changelog.md deleted file mode 100644 index 9a2dab8ba14..00000000000 --- a/docs/ru/whats_new/security_changelog.md +++ /dev/null @@ -1,71 +0,0 @@ -# Security Changelog - -## Исправлено в релизе 19.14.3.3, 2019-09-10 {#ispravleno-v-relize-19-14-3-3-2019-09-10} - -### CVE-2019-15024 {#cve-2019-15024} - -Злоумышленник с доступом на запись к ZooKeeper и возможностью запустить собственный сервер в сети доступной ClickHouse может создать вредоносный сервер, который будет вести себя как реплика ClickHouse и зарегистрируется в ZooKeeper. В процессе репликации вредоносный сервер может указать любой путь на файловой системе в который будут записаны данные. - -Обнаружено благодаря: Эльдару Заитову из Службы Информационной Безопасности Яндекса - -### CVE-2019-16535 {#cve-2019-16535} - -Интерфейс декомпрессии позволял совершать OOB чтения и записи данных в памяти, а также переполнение целочисленных переменных, что могло приводить к отказу в обслуживании. Также потенциально могло использоваьтся для удаленного выполнения кода. - -Обнаружено благодаря: Эльдару Заитову из Службы Информационной Безопасности Яндекса - -### CVE-2019-16536 {#cve-2019-16536} - -Аутентифицированный клиент злоумышленника имел возможность вызвать переполнение стека, что могло привести к отказу в обслуживании. - -Обнаружено благодаря: Эльдару Заитову из Службы Информационной Безопасности Яндекса - -## Исправлено в релизе 19.13.6.1 от 20 сентября 2019 {#ispravleno-v-relize-19-13-6-1-ot-20-sentiabria-2019} - -### CVE-2019-18657 {#cve-2019-18657} - -Уязвимость в табличной функции `url` позволяла злоумышленнику добавлять произвольные HTTP-заголовки в запрос. - -Обнаружено благодаря: [Никите Тихомирову](https://github.com/NSTikhomirov) - -## Исправлено в релизе 18.12.13 от 10 сентября 2018 {#ispravleno-v-relize-18-12-13-ot-10-sentiabria-2018} - -### CVE-2018-14672 {#cve-2018-14672} - -Функция для загрузки CatBoost моделей некорректно обрабатывала пути к файлам, что позволяло читать произвольные локальные файлы на сервере Clickhouse через сообщения об ошибках. - -Обнаружено благодаря: Андрею Красичкову из Службы Информационной Безопасности Яндекса - -## Исправлено в релизе 18.10.3 от 13 августа 2018 {#ispravleno-v-relize-18-10-3-ot-13-avgusta-2018} - -### CVE-2018-14671 {#cve-2018-14671} - -unixODBC позволял указать путь для подключения произвольного shared object в качестве драйвера базы данных, что приводило к возможности выполнить произвольный код на сервере ClickHouse. - -Обнаружено благодаря: Андрею Красичкову и Евгению Сидорову из Службы Информационной Безопасности Яндекса - -## Исправлено в релизе 1.1.54388 от 28 июня 2018 {#ispravleno-v-relize-1-1-54388-ot-28-iiunia-2018} - -### CVE-2018-14668 {#cve-2018-14668} - -Табличная функция «remote» допускала произвольные символы в полях «user», «password» и «default\_database», что позволяло производить атаки класса Cross Protocol Request Forgery. - -Обнаружено благодаря: Андрею Красичкову из Службы Информационной Безопасности Яндекса - -## Исправлено в релизе 1.1.54390 от 6 июля 2018 {#ispravleno-v-relize-1-1-54390-ot-6-iiulia-2018} - -### CVE-2018-14669 {#cve-2018-14669} - -В ClickHouse MySQL клиенте была включена функциональность «LOAD DATA LOCAL INFILE», что позволяло получать доступ на чтение к произвольным файлам на сервере, где запущен ClickHouse. - -Обнаружено благодаря: Андрею Красичкову и Евгению Сидорову из Службы Информационной Безопасности Яндекса - -## Исправлено в релизе 1.1.54131 от 10 января 2017 {#ispravleno-v-relize-1-1-54131-ot-10-ianvaria-2017} - -### CVE-2018-14670 {#cve-2018-14670} - -Некорректная конфигурация в deb пакете могла привести к неавторизованному доступу к базе данных. - -Обнаружено благодаря: the UK’s National Cyber Security Centre (NCSC) - -{## [Оригинальная статья](https://clickhouse.tech/docs/ru/security_changelog/) ##} diff --git a/docs/tools/build.py b/docs/tools/build.py index 2f7279ea07b..759ea2a4c4d 100755 --- a/docs/tools/build.py +++ b/docs/tools/build.py @@ -127,11 +127,12 @@ def build_for_lang(lang, args): if args.htmlproofer: plugins.append('htmlproofer') + website_url = 'https://clickhouse.tech' site_name = site_names.get(lang, site_names['en']) % args.version_prefix site_name = site_name.replace(' ', ' ') raw_config = dict( site_name=site_name, - site_url=f'https://clickhouse.tech/docs/{lang}/', + site_url=f'{website_url}/docs/{lang}/', docs_dir=os.path.join(args.docs_dir, lang), site_dir=site_dir, strict=not args.version_prefix, @@ -150,6 +151,7 @@ def build_for_lang(lang, args): 'rev': args.rev, 'rev_short': args.rev_short, 'rev_url': args.rev_url, + 'website_url': website_url, 'events': args.events, 'languages': languages, 'includes_dir': os.path.join(os.path.dirname(__file__), '..', '_includes') diff --git a/docs/tools/requirements.txt b/docs/tools/requirements.txt index cc63ea71d8c..06f07f62fd1 100644 --- a/docs/tools/requirements.txt +++ b/docs/tools/requirements.txt @@ -4,7 +4,7 @@ backports.functools-lru-cache==1.6.1 beautifulsoup4==4.9.0 certifi==2020.4.5.1 chardet==3.0.4 -click==7.1.1 +click==7.1.2 closure==20191111 cssmin==0.2.0 future==0.18.2 diff --git a/docs/tools/translate/filter.py b/docs/tools/translate/filter.py index b5424f20921..fe421381700 100755 --- a/docs/tools/translate/filter.py +++ b/docs/tools/translate/filter.py @@ -160,16 +160,9 @@ def translate_filter(key, value, _format, _): attempts = 10 if '#' in href: href, anchor = href.split('#', 1) - - if filename: - while attempts and not os.path.exists(href): - href = f'../{href}' - attempts -= 1 if anchor: href = f'{href}#{anchor}' - - if attempts: - value[2][0] = href + value[2][0] = href return cls(*value) elif key == 'Header': if value[1][0].islower() and '_' not in value[1][0]: # Preserve some manually specified anchors diff --git a/docs/tools/translate/util.py b/docs/tools/translate/util.py deleted file mode 120000 index 7f16d68497e..00000000000 --- a/docs/tools/translate/util.py +++ /dev/null @@ -1 +0,0 @@ -../util.py \ No newline at end of file diff --git a/docs/tools/website.py b/docs/tools/website.py index 7a45d22da5c..1e18af75237 100644 --- a/docs/tools/website.py +++ b/docs/tools/website.py @@ -17,7 +17,10 @@ import mdx_clickhouse def build_website(args): logging.info('Building website') env = jinja2.Environment( - loader=jinja2.FileSystemLoader(args.website_dir), + loader=jinja2.FileSystemLoader([ + args.website_dir, + os.path.join(args.docs_dir, '_includes') + ]), extensions=[ 'jinja2.ext.i18n', 'jinja2_highlight.HighlightExtension' @@ -79,7 +82,7 @@ def get_css_in(args): def get_js_in(args): return [ - f"'{args.website_dir}/js/jquery-3.4.1.js'", + f"'{args.website_dir}/js/jquery.js'", f"'{args.website_dir}/js/popper.js'", f"'{args.website_dir}/js/bootstrap.js'", f"'{args.website_dir}/js/base.js'", diff --git a/docs/tr/commercial/cloud.md b/docs/tr/commercial/cloud.md index f20656cc428..1d5ae7b3368 100644 --- a/docs/tr/commercial/cloud.md +++ b/docs/tr/commercial/cloud.md @@ -12,7 +12,7 @@ machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 [Yandex Clickhouse için yönetilen hizmet](https://cloud.yandex.com/services/managed-clickhouse?utm_source=referrals&utm_medium=clickhouseofficialsite&utm_campaign=link3) aşağıdaki temel özellikleri sağlar: -- İçin tamamen yönetilen ZooKeeper hizmeti [ClickHouse çoğaltma](../engines/table_engines/mergetree_family/replication.md) +- İçin tamamen yönetilen ZooKeeper hizmeti [ClickHouse çoğaltma](../engines/table-engines/mergetree-family/replication.md) - Çoklu depolama tipi seçenekleri - Farklı kullanılabilirlik bölgelerinde yinelemeler - Şifreleme ve izolasyon diff --git a/docs/tr/development/architecture.md b/docs/tr/development/architecture.md index 4713c2e5409..619778f3bd4 100644 --- a/docs/tr/development/architecture.md +++ b/docs/tr/development/architecture.md @@ -5,13 +5,13 @@ toc_priority: 62 toc_title: "ClickHouse mimarisine genel bak\u0131\u015F" --- -# ClickHouse mimarisine genel bakış {#overview-of-clickhouse-architecture} +# ClickHouse Mimarisine Genel bakış {#overview-of-clickhouse-architecture} ClickHouse gerçek bir sütun yönelimli DBMS olduğunu. Veriler sütunlar tarafından ve dizilerin yürütülmesi sırasında (vektörler veya sütun parçaları) saklanır. Mümkün olduğunda, işlemler tek tek değerler yerine dizilere gönderilir. Buna denir “vectorized query execution,” ve gerçek veri işleme maliyetini düşürmeye yardımcı olur. > Bu fikir yeni bir şey değil. Bu kadar uzanır `APL` programlama dili ve Tor andunları: `A +`, `J`, `K`, ve `Q`. Dizi programlama bilimsel veri işlemede kullanılır. Bu fikir ilişkisel veritabanlarında yeni bir şey değildir: örneğin, `Vectorwise` sistem. -Sorgu işlemeyi hızlandırmak için iki farklı yaklaşım vardır: vektörize sorgu yürütme ve çalışma zamanı kodu oluşturma. İkincisi, tüm Yönlendirme ve dinamik gönderimi kaldırır. Bu yaklaşımların hiçbiri diğerinden kesinlikle daha iyi değildir. Çalışma zamanı kodu üretimi, birçok işlemi birleştirdiğinde daha iyi olabilir, böylece CPU yürütme birimlerini ve boru hattını tam olarak kullanır. Vectorized sorgu yürütme daha az pratik olabilir, çünkü önbelleğe yazılması ve geri okunması gereken geçici vektörler içerir. Geçici veri L2 önbelleğinde uymuyorsa, bu bir sorun haline gelir. Ancak vektörize sorgu yürütme, CPU'nun SIMD yeteneklerini daha kolay kullanır. Bir [araştırma öd paperevi](http://15721.courses.cs.cmu.edu/spring2016/papers/p5-sompolski.pdf) arkadaşlarımız tarafından yazıldı, her iki yaklaşımı birleştirmenin daha iyi olduğunu gösteriyor. ClickHouse vectorized sorgu yürütme kullanır ve çalışma zamanı kodu üretimi için başlangıç desteği sınırlıdır. +Sorgu işlemeyi hızlandırmak için iki farklı yaklaşım vardır: vektörize sorgu yürütme ve çalışma zamanı kodu oluşturma. İkincisi, tüm Yönlendirme ve dinamik gönderimi kaldırır. Bu yaklaşımların hiçbiri diğerinden kesinlikle daha iyi değildir. Çalışma zamanı kodu üretimi, birçok işlemi birleştirdiğinde daha iyi olabilir, böylece CPU yürütme birimlerini ve boru hattını tam olarak kullanır. Vectorized sorgu yürütme daha az pratik olabilir, çünkü önbelleğe yazılması ve geri okunması gereken geçici vektörler içerir. Geçici veri L2 önbelleğinde uymuyorsa, bu bir sorun haline gelir. Ancak vektörize sorgu yürütme, CPU’nun SIMD yeteneklerini daha kolay kullanır. Bir [araştırma öd paperevi](http://15721.courses.cs.cmu.edu/spring2016/papers/p5-sompolski.pdf) arkadaşlarımız tarafından yazıldı, her iki yaklaşımı birleştirmenin daha iyi olduğunu gösteriyor. ClickHouse vectorized sorgu yürütme kullanır ve çalışma zamanı kodu üretimi için başlangıç desteği sınırlıdır. ## Sütun {#columns} @@ -21,7 +21,7 @@ Sorgu işlemeyi hızlandırmak için iki farklı yaklaşım vardır: vektörize ## Alan {#field} -Bununla birlikte, bireysel değerlerle de çalışmak mümkündür. Bireysel bir değeri temsil etmek için, `Field` kullanılır. `Field` sadece ayrımcılığa uğramış bir birlik mi `UInt64`, `Int64`, `Float64`, `String` ve `Array`. `IColumn` has the `operator[]` n - inci değerini bir olarak alma yöntemi `Field` ve... `insert` bir ekleme yöntemi `Field` bir sütunun sonuna. Bu yöntemler çok verimli değildir, çünkü geçici olarak uğraşmayı gerektirirler `Field` tek bir değeri temsil eden nesneler. Daha etkili yöntemleri vardır, mesela: `insertFrom`, `insertRangeFrom` ve bu yüzden. +Bununla birlikte, bireysel değerlerle de çalışmak mümkündür. Bireysel bir değeri temsil etmek için, `Field` kullanılır. `Field` sadece ayrımcılığa uğramış bir birlik mi `UInt64`, `Int64`, `Float64`, `String` ve `Array`. `IColumn` has the `operator[]` n - inci değerini bir olarak alma yöntemi `Field` ve… `insert` bir ekleme yöntemi `Field` bir sütunun sonuna. Bu yöntemler çok verimli değildir, çünkü geçici olarak uğraşmayı gerektirirler `Field` tek bir değeri temsil eden nesneler. Daha etkili yöntemleri vardır, mesela: `insertFrom`, `insertRangeFrom` ve bu yüzden. `Field` bir tablo için belirli bir veri türü hakkında yeterli bilgiye sahip değildir. Mesela, `UInt8`, `UInt16`, `UInt32`, ve `UInt64` hepsi olarak temsil edilir `UInt64` in a `Field`. @@ -120,11 +120,11 @@ Sorgu yürütme kanalının oluşturulmasından tercümanlar sorumludur. `AST`. Sıradan fonksiyonlar ve toplam fonksiyonlar vardır. Toplama işlevleri için bir sonraki bölüme bakın. -Ordinary functions don't change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`'s vectorized sorgu yürütme uygulamak için veri. +Ordinary functions don’t change the number of rows – they work as if they are processing each row independently. In fact, functions are not called for individual rows, but for `Block`’s vectorized sorgu yürütme uygulamak için veri. -Gibi bazı çeşitli fonksiyonlar vardır [blockSize](../sql_reference/functions/other_functions.md#function-blocksize), [rowNumberİnBlock](../sql_reference/functions/other_functions.md#function-rownumberinblock), ve [runningAccumulate](../sql_reference/functions/other_functions.md#function-runningaccumulate), blok işlemeyi istismar eden ve satırların bağımsızlığını ihlal eden. +Gibi bazı çeşitli fonksiyonlar vardır [blockSize](../sql-reference/functions/other-functions.md#function-blocksize), [rowNumberİnBlock](../sql-reference/functions/other-functions.md#function-rownumberinblock), ve [runningAccumulate](../sql-reference/functions/other-functions.md#function-runningaccumulate), blok işlemeyi istismar eden ve satırların bağımsızlığını ihlal eden. -Clickhouse'un güçlü yazımı var, bu yüzden örtük tür dönüşümü yok. Bir işlev belirli bir tür kombinasyonunu desteklemiyorsa, bir istisna atar. Ancak, birçok farklı tür kombinasyonu için işlevler çalışabilir (aşırı yüklenebilir). Örneğin, `plus` fonksiyonu (uygulamak için `+` operatör) sayısal türlerin herhangi bir kombinasyonu için çalışır: `UInt8` + `Float32`, `UInt16` + `Int8` ve bu yüzden. Ayrıca, bazı variadic işlevleri gibi bağımsız değişkenlerin herhangi bir sayıda kabul edebilir `concat` işlev. +Clickhouse’un güçlü yazımı var, bu yüzden örtük tür dönüşümü yok. Bir işlev belirli bir tür kombinasyonunu desteklemiyorsa, bir istisna atar. Ancak, birçok farklı tür kombinasyonu için işlevler çalışabilir (aşırı yüklenebilir). Örneğin, `plus` fonksiyonu (uygulamak için `+` operatör) sayısal türlerin herhangi bir kombinasyonu için çalışır: `UInt8` + `Float32`, `UInt16` + `Int8` ve bu yüzden. Ayrıca, bazı variadic işlevleri gibi bağımsız değişkenlerin herhangi bir sayıda kabul edebilir `concat` işlev. Bir işlev açıkça desteklenen veri türlerini gönderir ve desteklenen çünkü bir işlev uygulamak biraz rahatsız edici olabilir `IColumns`. Örneğin, `plus` işlev, sayısal türlerin ve sabit veya sabit olmayan sol ve sağ bağımsız değişkenlerin her birleşimi için bir C++ şablonunun örneklendirilmesiyle oluşturulan koda sahiptir. @@ -171,13 +171,13 @@ Dağıtılmış sorgu yürütme için genel bir sorgu planı yoktur. Her düğü `MergeTree` birincil anahtarla dizin oluşturmayı destekleyen bir depolama altyapısı ailesidir. Birincil anahtar, isteğe bağlı bir sütun veya ifade kümesi olabilir. Veri `MergeTree` tablo saklanır “parts”. Her bölüm verileri birincil anahtar sırasına göre saklar, böylece veriler birincil anahtar tuple tarafından lexicographically sıralanır. Tüm tablo sütunları ayrı olarak saklanır `column.bin` bu kısımlardaki dosyalar. Dosyalar sıkıştırılmış bloklardan oluşur. Her blok, ortalama değer boyutuna bağlı olarak genellikle 64 KB ila 1 MB sıkıştırılmamış veridir. Bloklar, birbiri ardına bitişik olarak yerleştirilmiş sütun değerlerinden oluşur. Sütun değerleri her sütun için aynı sıradadır (birincil anahtar siparişi tanımlar), bu nedenle birçok sütun tarafından yineleme yaptığınızda, karşılık gelen satırlar için değerler alırsınız. -Birincil anahtarın kendisi “sparse”. Her satır Adres yok ama verilerin sadece biraz değişir. Ayıran `primary.idx` dosya, n'nin çağrıldığı her N-inci satır için birincil anahtarın değerine sahiptir `index_granularity` (genellikle, n = 8192). Ayrıca, her sütun için, biz var `column.mrk` dosyaları ile “marks,” veri dosyasındaki her N-inci satıra ofset olan. Her işaret bir çifttir: dosyadaki ofset sıkıştırılmış bloğun başlangıcına ve sıkıştırılmış bloktaki ofset verilerin başlangıcına. Genellikle, sıkıştırılmış bloklar işaretlerle hizalanır ve sıkıştırılmış bloktaki ofset sıfırdır. İçin veri `primary.idx` her zaman bellekte bulunur ve veri `column.mrk` dosyalar önbelleğe alınır. +Birincil anahtarın kendisi “sparse”. Her satır Adres yok ama verilerin sadece biraz değişir. Ayıran `primary.idx` dosya, n’nin çağrıldığı her N-inci satır için birincil anahtarın değerine sahiptir `index_granularity` (genellikle, n = 8192). Ayrıca, her sütun için, biz var `column.mrk` dosyaları ile “marks,” veri dosyasındaki her N-inci satıra ofset olan. Her işaret bir çifttir: dosyadaki ofset sıkıştırılmış bloğun başlangıcına ve sıkıştırılmış bloktaki ofset verilerin başlangıcına. Genellikle, sıkıştırılmış bloklar işaretlerle hizalanır ve sıkıştırılmış bloktaki ofset sıfırdır. İçin veri `primary.idx` her zaman bellekte bulunur ve veri `column.mrk` dosyalar önbelleğe alınır. Bir kısm aından bir şey okuy readacağımız zaman `MergeTree` bak biz `primary.idx` veri ve istenen verileri içerebilecek aralıkları bulun, ardından `column.mrk` veri ve bu aralıkları okumaya başlamak için nerede için uzaklıklar hesaplayın. Çünkü seyrek, fazla veri okunabilir. ClickHouse, basit nokta sorgularının yüksek bir yükü için uygun değildir, çünkü tüm Aralık `index_granularity` her anahtar için satırlar okunmalı ve her sütun için sıkıştırılmış bloğun tamamı sıkıştırılmalıdır. Dizin için fark edilebilir bellek tüketimi olmadan tek bir sunucu başına trilyonlarca satır tutabilmemiz gerektiğinden dizini seyrek yaptık. Ayrıca, birincil anahtar seyrek olduğundan, benzersiz değildir: ekleme zamanında tablodaki anahtarın varlığını denetleyemez. Bir tabloda aynı anahtara sahip birçok satır olabilir. Ne zaman sen `INSERT` içine veri bir demet `MergeTree`, bu grup birincil anahtar sırasına göre sıralanır ve yeni bir bölüm oluşturur. Bazı parçaları periyodik olarak seçen ve parça sayısını nispeten düşük tutmak için bunları tek bir sıralanmış parçaya birleştiren arka plan iş parçacıkları vardır. Bu yüzden denir `MergeTree`. Tabii ki, birleştirme yol açar “write amplification”. Tüm parçalar değişmez: sadece oluşturulur ve silinir, ancak değiştirilmez. SELECT yürütüldüğünde, tablonun bir anlık görüntüsünü (bir parça kümesi) tutar. Birleştirildikten sonra, arızadan sonra iyileşmeyi kolaylaştırmak için eski parçaları bir süre tutuyoruz, bu nedenle birleştirilmiş bir parçanın muhtemelen kırıldığını görürsek, kaynak parçalarıyla değiştirebiliriz. -`MergeTree` içermediği için bir lsm ağacı değildir “memtable” ve “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity's sake, and because we are already inserting data in batches in our applications. +`MergeTree` içermediği için bir lsm ağacı değildir “memtable” ve “log”: inserted data is written directly to the filesystem. This makes it suitable only to INSERT data in batches, not by individual row and not very frequently – about once per second is ok, but a thousand times a second is not. We did it this way for simplicity’s sake, and because we are already inserting data in batches in our applications. > MergeTree tabloları yalnızca bir (birincil) dizine sahip olabilir: herhangi bir ikincil dizin yoktur. Bir mantıksal tablo altında birden fazla fiziksel gösterime izin vermek, örneğin verileri birden fazla fiziksel sırayla depolamak veya hatta orijinal verilerle birlikte önceden toplanmış verilerle gösterimlere izin vermek güzel olurdu. diff --git a/docs/tr/development/browse-code.md b/docs/tr/development/browse-code.md new file mode 100644 index 00000000000..58c6f8fac63 --- /dev/null +++ b/docs/tr/development/browse-code.md @@ -0,0 +1,14 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 63 +toc_title: "ClickHouse Kaynak Koduna G\xF6z At\u0131n" +--- + +# ClickHouse Kaynak Koduna Göz Atın {#browse-clickhouse-source-code} + +Kullanabilirsiniz **Woboq** online kod tarayıcı mevcut [burada](https://clickhouse.tech/codebrowser/html_report///ClickHouse/src/index.html). Bu kod navigasyon ve semantik vurgulama, arama ve indeksleme sağlar. Kod anlık görüntüsü günlük olarak güncellenir. + +Ayrıca, kaynaklara göz atabilirsiniz [GitHub](https://github.com/ClickHouse/ClickHouse) herzamanki. + +IDE’NİN ne kullanacağı ile ilgileniyorsanız, CLion, QT Creator, vs Code ve KDevelop (uyarılar ile) öneririz. Herhangi bir favori IDE kullanabilirsiniz. Vim ve Emacs da sayılır. diff --git a/docs/tr/development/browse_code.md b/docs/tr/development/browse_code.md deleted file mode 100644 index dacebf01050..00000000000 --- a/docs/tr/development/browse_code.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 63 -toc_title: "ClickHouse Kaynak Koduna G\xF6z At\u0131n" ---- - -# ClickHouse Kaynak Koduna Göz Atın {#browse-clickhouse-source-code} - -Kullanabilirsiniz **Woboq** online kod tarayıcı mevcut [burada](https://clickhouse.tech/codebrowser/html_report///ClickHouse/src/index.html). Bu kod navigasyon ve semantik vurgulama, arama ve indeksleme sağlar. Kod anlık görüntüsü günlük olarak güncellenir. - -Ayrıca, kaynaklara göz atabilirsiniz [GitHub](https://github.com/ClickHouse/ClickHouse) herzamanki. - -IDE'NİN ne kullanacağı ile ilgileniyorsanız, CLion, QT Creator, vs Code ve KDevelop (uyarılar ile) öneririz. Herhangi bir favori IDE kullanabilirsiniz. Vim ve Emacs da sayılır. diff --git a/docs/tr/development/build-cross-arm.md b/docs/tr/development/build-cross-arm.md new file mode 100644 index 00000000000..7801d88c265 --- /dev/null +++ b/docs/tr/development/build-cross-arm.md @@ -0,0 +1,43 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 67 +toc_title: "AARCH64 (ARM64) i\xE7in Linux'ta ClickHouse nas\u0131l olu\u015Fturulur)" +--- + +# AARCH64 (ARM64) Mimarisi için Linux’ta ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-linux-for-aarch64-arm64-architecture} + +Bu, Linux makineniz olduğunda ve onu oluşturmak için kullanmak istediğinizde geçerlidir `clickhouse` AARCH64 CPU mimarisi ile başka bir Linux makinede çalışacak ikili. Bu, Linux sunucularında çalışan sürekli entegrasyon kontrolleri için tasarlanmıştır. + +AARCH64 için çapraz yapı, [Inşa talimatları](build.md) önce onları takip et. + +# Clang-8’i Yükle {#install-clang-8} + +Yönergeleri izleyin https://apt.llvm.org / Ubuntu veya Debian kurulumunuz için. +Örneğin, Ubuntu Bionic’te aşağıdaki komutları kullanabilirsiniz: + +``` bash +echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" | sudo tee /etc/apt/sources.list.d/llvm.list +sudo apt-get update +sudo apt-get install clang-8 +``` + +# Çapraz Derleme Araç Setini Yükle {#install-cross-compilation-toolset} + +``` bash +cd ClickHouse +mkdir -p build-aarch64/cmake/toolchain/linux-aarch64 +wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9&la=en' -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz +tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cmake/toolchain/linux-aarch64 --strip-components=1 +``` + +# ClickHouse İnşa {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-arm64 +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake +ninja -C build-arm64 +``` + +Ortaya çıkan ikili, yalnızca AARCH64 CPU mimarisi ile Linux’ta çalışacaktır. diff --git a/docs/tr/development/build-cross-osx.md b/docs/tr/development/build-cross-osx.md new file mode 100644 index 00000000000..0e56b0aeb78 --- /dev/null +++ b/docs/tr/development/build-cross-osx.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 66 +toc_title: "Mac OS X i\xE7in Linux'ta ClickHouse nas\u0131l olu\u015Fturulur" +--- + +# Mac OS X için Linux’ta ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-linux-for-mac-os-x} + +Bu, Linux makineniz olduğunda ve onu oluşturmak için kullanmak istediğinizde geçerlidir `clickhouse` OS X üzerinde çalışacak ikili. bu, Linux sunucularında çalışan sürekli entegrasyon kontrolleri için tasarlanmıştır. Clickhouse’u doğrudan Mac OS X’te oluşturmak istiyorsanız, devam edin [başka bir talimat](build-osx.md). + +Mac OS X için çapraz yapı, [Inşa talimatları](build.md) önce onları takip et. + +# Clang-8’i Yükle {#install-clang-8} + +Yönergeleri izleyin https://apt.llvm.org / Ubuntu veya Debian kurulumunuz için. +Örneğin biyonik için komutlar gibidir: + +``` bash +sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list +sudo apt-get install clang-8 +``` + +# Çapraz Derleme Araç Setini Yükle {#install-cross-compilation-toolset} + +Yüklediğimiz yolu hatırlayalım `cctools` olarak $ {CCTOOLS} + +``` bash +mkdir ${CCTOOLS} + +git clone https://github.com/tpoechtrager/apple-libtapi.git +cd apple-libtapi +INSTALLPREFIX=${CCTOOLS} ./build.sh +./install.sh +cd .. + +git clone https://github.com/tpoechtrager/cctools-port.git +cd cctools-port/cctools +./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin +make install +``` + +Ayrıca, MacOS X SDK’YI çalışma ağacına indirmemiz gerekiyor. + +``` bash +cd ClickHouse +wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' +mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 +tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 +``` + +# ClickHouse İnşa {#build-clickhouse} + +``` bash +cd ClickHouse +mkdir build-osx +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ + -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ + -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ + -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld +ninja -C build-osx +``` + +Ortaya çıkan ikili bir Mach-O yürütülebilir biçimine sahip olacak ve Linux üzerinde çalıştırılamaz. diff --git a/docs/tr/development/build-osx.md b/docs/tr/development/build-osx.md new file mode 100644 index 00000000000..f2ea9ac6e46 --- /dev/null +++ b/docs/tr/development/build-osx.md @@ -0,0 +1,93 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 65 +toc_title: "Mac OS X \xFCzerinde ClickHouse nas\u0131l olu\u015Fturulur" +--- + +# Mac OS X üzerinde ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-mac-os-x} + +Build Mac OS X 10.15 (Catalina) üzerinde çalışmalıdır) + +## Homebrew Yüklemek {#install-homebrew} + +``` bash +$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +## Gerekli Derleyicileri, araçları Ve kitaplıkları yükleyin {#install-required-compilers-tools-and-libraries} + +``` bash +$ brew install cmake ninja libtool gettext +``` + +## Checkout ClickHouse Kaynakları {#checkout-clickhouse-sources} + +``` bash +$ git clone --recursive git@github.com:ClickHouse/ClickHouse.git +``` + +veya + +``` bash +$ git clone --recursive https://github.com/ClickHouse/ClickHouse.git + +$ cd ClickHouse +``` + +## ClickHouse İnşa {#build-clickhouse} + +``` bash +$ mkdir build +$ cd build +$ cmake .. -DCMAKE_CXX_COMPILER=`which clang++` -DCMAKE_C_COMPILER=`which clang` +$ ninja +$ cd .. +``` + +## Uyarılar {#caveats} + +Clickhouse-server çalıştırmak istiyorsanız, sistemin maxfiles değişken artırmak için emin olun. + +!!! info "Not" + Sudo kullanmanız gerekecek. + +Bunu yapmak için aşağıdaki dosyayı oluşturun: + +/ Kütüphane / LaunchDaemons / sınırı.maxfiles.plist: + +``` xml + + + + + Label + limit.maxfiles + ProgramArguments + + launchctl + limit + maxfiles + 524288 + 524288 + + RunAtLoad + + ServiceIPC + + + +``` + +Aşağıdaki komutu çalıştırın: + +``` bash +$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist +``` + +Başlatmak. + +Çalışıp çalışmadığını kontrol etmek için şunları kullanabilirsiniz `ulimit -n` komut. + +[Orijinal makale](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/tr/development/build.md b/docs/tr/development/build.md index 3a3cda15f1b..8d29e647dd6 100644 --- a/docs/tr/development/build.md +++ b/docs/tr/development/build.md @@ -5,13 +5,13 @@ toc_priority: 64 toc_title: "Linux \xFCzerinde ClickHouse nas\u0131l olu\u015Fturulur" --- -# Geliştirme için ClickHouse nasıl inşa edilir {#how-to-build-clickhouse-for-development} +# Geliştirme için ClickHouse nasıl inşa Edilir {#how-to-build-clickhouse-for-development} Aşağıdaki öğretici Ubuntu Linux sistemine dayanmaktadır. Uygun değişikliklerle, başka herhangi bir Linux dağıtımı üzerinde de çalışması gerekir. Desteklenen platformlar: x86\_64 ve AArch64. Power9 için destek deneyseldir. -## Git, Cmake, Python ve Ninja'yı yükleyin {#install-git-cmake-python-and-ninja} +## Git, Cmake, Python Ve Ninja’yı yükleyin {#install-git-cmake-python-and-ninja} ``` bash $ sudo apt-get install git cmake python ninja-build @@ -19,11 +19,11 @@ $ sudo apt-get install git cmake python ninja-build Veya eski sistemlerde cmake yerine cmake3. -## Gcc 9'u yükle {#install-gcc-9} +## Gcc 9’u yükle {#install-gcc-9} Bunu yapmak için çeşitli yollar vardır. -### Bir PPA paketinden yükleme {#install-from-a-ppa-package} +### Bir PPA Paketinden yükleme {#install-from-a-ppa-package} ``` bash $ sudo apt-get install software-properties-common @@ -69,7 +69,7 @@ $ cd .. Bir yürütülebilir dosya oluşturmak için çalıştırın `ninja clickhouse`. Bu yaratacak `programs/clickhouse` ile kullanılabilecek çalıştırılabilir `client` veya `server` değişkenler. -# Herhangi bir Linux üzerinde ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-any-linux} +# Herhangi Bir Linux üzerinde ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-any-linux} Yapı aşağıdaki bileşenleri gerektirir: @@ -108,7 +108,7 @@ Fedora Rawhide için örnek: cmake ../ClickHouse make -j $(nproc) -# ClickHouse inşa etmek zorunda değilsiniz {#you-dont-have-to-build-clickhouse} +# ClickHouse inşa Etmek Zorunda değilsiniz {#you-dont-have-to-build-clickhouse} ClickHouse önceden oluşturulmuş ikili ve paketlerde mevcuttur. İkili dosyalar taşınabilir ve herhangi bir Linux lezzet üzerinde çalıştırılabilir. @@ -116,9 +116,9 @@ Onlar sürece her Master taahhüt ve her çekme isteği için kararlı, prestabl En taze yapıyı bulmak için `master`, go to [taahhüt sayfası](https://github.com/ClickHouse/ClickHouse/commits/master), commit yakınındaki ilk yeşil onay işaretini veya kırmızı çarpı işaretini tıklayın ve “Details” hemen sonra bağlantı “ClickHouse Build Check”. -# ClickHouse Debian paketi nasıl oluşturulur {#how-to-build-clickhouse-debian-package} +# ClickHouse Debian Paketi nasıl oluşturulur {#how-to-build-clickhouse-debian-package} -## Git ve Pbuilder'ı yükleyin {#install-git-and-pbuilder} +## Git Ve Pbuilder’ı yükleyin {#install-git-and-pbuilder} ``` bash $ sudo apt-get update diff --git a/docs/tr/development/build_cross_arm.md b/docs/tr/development/build_cross_arm.md deleted file mode 100644 index d0d18162d6f..00000000000 --- a/docs/tr/development/build_cross_arm.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 67 -toc_title: "AARCH64 (ARM64) i\xE7in Linux'ta ClickHouse nas\u0131l olu\u015Fturulur)" ---- - -# AARCH64 (ARM64) mimarisi için Linux'ta ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-linux-for-aarch64-arm64-architecture} - -Bu, Linux makineniz olduğunda ve onu oluşturmak için kullanmak istediğinizde geçerlidir `clickhouse` AARCH64 CPU mimarisi ile başka bir Linux makinede çalışacak ikili. Bu, Linux sunucularında çalışan sürekli entegrasyon kontrolleri için tasarlanmıştır. - -AARCH64 için çapraz yapı, [Inşa talimatları](build.md) önce onları takip et. - -# Clang-8'i Yükle {#install-clang-8} - -Yönergeleri izleyin https://apt.llvm.org / Ubuntu veya Debian kurulumunuz için. -Örneğin, Ubuntu Bionic'te aşağıdaki komutları kullanabilirsiniz: - -``` bash -echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" | sudo tee /etc/apt/sources.list.d/llvm.list -sudo apt-get update -sudo apt-get install clang-8 -``` - -# Çapraz Derleme Araç Setini Yükle {#install-cross-compilation-toolset} - -``` bash -cd ClickHouse -mkdir -p build-aarch64/cmake/toolchain/linux-aarch64 -wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9&la=en' -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -tar xJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C build-aarch64/cmake/toolchain/linux-aarch64 --strip-components=1 -``` - -# ClickHouse İnşa {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-arm64 -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake -ninja -C build-arm64 -``` - -Ortaya çıkan ikili, yalnızca AARCH64 CPU mimarisi ile Linux'ta çalışacaktır. diff --git a/docs/tr/development/build_cross_osx.md b/docs/tr/development/build_cross_osx.md deleted file mode 100644 index 2001ad985e2..00000000000 --- a/docs/tr/development/build_cross_osx.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 66 -toc_title: "Mac OS X i\xE7in Linux'ta ClickHouse nas\u0131l olu\u015Fturulur" ---- - -# Mac OS X için Linux'ta ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-linux-for-mac-os-x} - -Bu, Linux makineniz olduğunda ve onu oluşturmak için kullanmak istediğinizde geçerlidir `clickhouse` OS X üzerinde çalışacak ikili. bu, Linux sunucularında çalışan sürekli entegrasyon kontrolleri için tasarlanmıştır. Clickhouse'u doğrudan Mac OS X'te oluşturmak istiyorsanız, devam edin [başka bir talimat](build_osx.md). - -Mac OS X için çapraz yapı, [Inşa talimatları](build.md) önce onları takip et. - -# Clang-8'i Yükle {#install-clang-8} - -Yönergeleri izleyin https://apt.llvm.org / Ubuntu veya Debian kurulumunuz için. -Örneğin biyonik için komutlar gibidir: - -``` bash -sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list -sudo apt-get install clang-8 -``` - -# Çapraz Derleme Araç Setini Yükle {#install-cross-compilation-toolset} - -Yüklediğimiz yolu hatırlayalım `cctools` olarak $ {CCTOOLS} - -``` bash -mkdir ${CCTOOLS} - -git clone https://github.com/tpoechtrager/apple-libtapi.git -cd apple-libtapi -INSTALLPREFIX=${CCTOOLS} ./build.sh -./install.sh -cd .. - -git clone https://github.com/tpoechtrager/cctools-port.git -cd cctools-port/cctools -./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin -make install -``` - -Ayrıca, MacOS X SDK'YI çalışma ağacına indirmemiz gerekiyor. - -``` bash -cd ClickHouse -wget 'https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz' -mkdir -p build-darwin/cmake/toolchain/darwin-x86_64 -tar xJf MacOSX10.14.sdk.tar.xz -C build-darwin/cmake/toolchain/darwin-x86_64 --strip-components=1 -``` - -# ClickHouse İnşa {#build-clickhouse} - -``` bash -cd ClickHouse -mkdir build-osx -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake \ - -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ - -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ - -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -ninja -C build-osx -``` - -Ortaya çıkan ikili bir Mach-O yürütülebilir biçimine sahip olacak ve Linux üzerinde çalıştırılamaz. diff --git a/docs/tr/development/build_osx.md b/docs/tr/development/build_osx.md deleted file mode 100644 index af750725070..00000000000 --- a/docs/tr/development/build_osx.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 65 -toc_title: "Mac OS X \xFCzerinde ClickHouse nas\u0131l olu\u015Fturulur" ---- - -# Mac OS X üzerinde ClickHouse nasıl oluşturulur {#how-to-build-clickhouse-on-mac-os-x} - -Build Mac OS X 10.15 (Catalina) üzerinde çalışmalıdır) - -## Homebrew Yüklemek {#install-homebrew} - -``` bash -$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - -## Gerekli derleyicileri, araçları ve kitaplıkları yükleyin {#install-required-compilers-tools-and-libraries} - -``` bash -$ brew install cmake ninja libtool gettext -``` - -## Checkout ClickHouse Kaynakları {#checkout-clickhouse-sources} - -``` bash -$ git clone --recursive git@github.com:ClickHouse/ClickHouse.git -``` - -veya - -``` bash -$ git clone --recursive https://github.com/ClickHouse/ClickHouse.git - -$ cd ClickHouse -``` - -## ClickHouse İnşa {#build-clickhouse} - -``` bash -$ mkdir build -$ cd build -$ cmake .. -DCMAKE_CXX_COMPILER=`which clang++` -DCMAKE_C_COMPILER=`which clang` -$ ninja -$ cd .. -``` - -## Uyarılar {#caveats} - -Clickhouse-server çalıştırmak istiyorsanız, sistemin maxfiles değişken artırmak için emin olun. - -!!! info "Not" - Sudo kullanmanız gerekecek. - -Bunu yapmak için aşağıdaki dosyayı oluşturun: - -/ Kütüphane / LaunchDaemons / sınırı.maxfiles.plist: - -``` xml - - - - - Label - limit.maxfiles - ProgramArguments - - launchctl - limit - maxfiles - 524288 - 524288 - - RunAtLoad - - ServiceIPC - - - -``` - -Aşağıdaki komutu çalıştırın: - -``` bash -$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist -``` - -Başlatmak. - -Çalışıp çalışmadığını kontrol etmek için şunları kullanabilirsiniz `ulimit -n` komut. - -[Orijinal makale](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/tr/development/developer-instruction.md b/docs/tr/development/developer-instruction.md new file mode 100644 index 00000000000..8e5f83e00a4 --- /dev/null +++ b/docs/tr/development/developer-instruction.md @@ -0,0 +1,285 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 61 +toc_title: "Acemi ClickHouse Geli\u015Ftirici Talimat" +--- + +ClickHouse binası Linux, FreeBSD ve Mac OS X üzerinde desteklenmektedir. + +# Windows Kullanıyorsanız {#if-you-use-windows} + +Windows kullanıyorsanız, Ubuntu ile bir sanal makine oluşturmanız gerekir. Bir sanal makine ile çalışmaya başlamak için VirtualBox yükleyin. UB :unt :u’yu web sitesinden indirebilirsiniz: https://www.ubuntu.com/\#download. lütfen indirilen görüntüden bir sanal makine oluşturun (bunun için en az 4GB RAM ayırmalısınız). Ubuntu’da bir komut satırı terminali çalıştırmak için lütfen kelimeyi içeren bir program bulun “terminal” adına (gnome-terminal, konsole vb.)) veya sadece Ctrl+Alt+T tuşlarına basın. + +# 32 bit sistem kullanıyorsanız {#if-you-use-a-32-bit-system} + +ClickHouse çalışamaz veya 32-bit bir sistem üzerinde oluşturun. 64-bit bir sisteme erişim kazanmanız gerekir ve okumaya devam edebilirsiniz. + +# Github’da Bir Depo oluşturma {#creating-a-repository-on-github} + +ClickHouse repository ile çalışmaya başlamak için bir GitHub hesabına ihtiyacınız olacaktır. + +Muhtemelen zaten bir tane var, ama yapmazsanız, lütfen kayıt olun https://github.com. SSH anahtarlarınız yoksa, bunları üretmeli ve daha sonra Github’a yüklemelisiniz. Bu yamalar üzerinden göndermek için gereklidir. Diğer SSH sunucularıyla kullandığınız aynı SSH anahtarlarını kullanmak da mümkündür - muhtemelen zaten bunlara sahipsiniz. + +ClickHouse deposunun bir çatalı oluşturun. Bunu yapmak için lütfen tıklayın “fork” sağ üst köşedeki düğme https://github.com/ClickHouse/ClickHouse. bu hesabınıza ClickHouse / ClickHouse kendi kopyasını çatal olacaktır. + +Geliştirme süreci ilk ClickHouse sizin çatal içine amaçlanan değişiklikleri işlemekle ve daha sonra bir oluşturma oluşur “pull request” bu değişikliklerin ana depoya kabul edilmesi için (ClickHouse/ClickHouse). + +Git depoları ile çalışmak için lütfen yükleyin `git`. + +Bunu Ubuntu’da yapmak için komut satırı terminalinde çalışırsınız: + + sudo apt update + sudo apt install git + +Git kullanımı ile ilgili kısa bir el kitabı burada bulunabilir: https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf. +Git ile ilgili ayrıntılı bir el kitabı için bkz. https://git-scm.com/book/en/v2. + +# Geliştirme Makinenize Bir Depo Klonlama {#cloning-a-repository-to-your-development-machine} + +Ardından, kaynak dosyaları çalışma makinenize indirmeniz gerekir. Bu denir “to clone a repository” çünkü çalışma makinenizde deponun yerel bir kopyasını oluşturur. + +Komut satırında terminal Çalıştır: + + git clone --recursive git@guthub.com:your_github_username/ClickHouse.git + cd ClickHouse + +Not: lütfen, yerine *your\_github\_username* uygun olanı ile! + +Bu komut bir dizin oluşturacaktır `ClickHouse` projenin çalışma kopyasını içeren. + +Yapı sistemini çalıştırmakla ilgili sorunlara yol açabileceğinden, çalışma dizininin yolunun hiçbir boşluk içermemesi önemlidir. + +ClickHouse deposunun kullandığını lütfen unutmayın `submodules`. That is what the references to additional repositories are called (i.e. external libraries on which the project depends). It means that when cloning the repository you need to specify the `--recursive` yukarıdaki örnekte olduğu gibi bayrak. Depo alt modüller olmadan klonlanmışsa, bunları indirmek için aşağıdakileri çalıştırmanız gerekir: + + git submodule init + git submodule update + +Komutu ile durumunu kontrol edebilirsiniz: `git submodule status`. + +Aşağıdaki hata iletisini alırsanız: + + Permission denied (publickey). + fatal: Could not read from remote repository. + + Please make sure you have the correct access rights + and the repository exists. + +Genellikle Github’a bağlanmak için SSH anahtarlarının eksik olduğu anlamına gelir. Bu anahtarlar normalde `~/.ssh`. SSH anahtarlarının kabul edilmesi için bunları GitHub kullanıcı arayüzünün ayarlar bölümüne yüklemeniz gerekir. + +Depoyu https protokolü aracılığıyla da klonlayabilirsiniz: + + git clone https://github.com/ClickHouse/ClickHouse.git + +Ancak bu, değişikliklerinizi sunucuya göndermenize izin vermez. Yine de geçici olarak kullanabilir ve SSH anahtarlarını daha sonra deponun uzak adresini değiştirerek ekleyebilirsiniz `git remote` komut. + +Oradan güncellemeleri çekmek için orijinal ClickHouse repo’nun adresini yerel deponuza da ekleyebilirsiniz: + + git remote add upstream git@github.com:ClickHouse/ClickHouse.git + +Başarıyla bu komutu çalıştırdıktan sonra çalıştırarak ana ClickHouse repo güncellemeleri çekmek mümkün olacak `git pull upstream master`. + +## Alt modüllerle çalışma {#working-with-submodules} + +Git’teki alt modüllerle çalışmak acı verici olabilir. Sonraki komutlar onu yönetmeye yardımcı olacaktır: + + # ! each command accepts --recursive + # Update remote URLs for submodules. Barely rare case + git submodule sync + # Add new submodules + git submodule init + # Update existing submodules to the current state + git submodule update + # Two last commands could be merged together + git submodule update --init + +Bir sonraki komutlar, tüm alt modülleri başlangıç durumuna sıfırlamanıza yardımcı olacaktır (!UYARI! - herhangi bir değişiklik içinde silinecektir): + + # Synchronizes submodules' remote URL with .gitmodules + git submodule sync --recursive + # Update the registered submodules with initialize not yet initialized + git submodule update --init --recursive + # Reset all changes done after HEAD + git submodule foreach git reset --hard + # Clean files from .gitignore + git submodule foreach git clean -xfd + # Repeat last 4 commands for all submodule + git submodule foreach git submodule sync --recursive + git submodule foreach git submodule update --init --recursive + git submodule foreach git submodule foreach git reset --hard + git submodule foreach git submodule foreach git clean -xfd + +# Yapı Sistemi {#build-system} + +ClickHouse bina için Cmake ve Ninja kullanır. + +Cmake-ninja dosyaları (yapı görevleri) üretebilir bir meta-yapı sistemi. +Ninja-bu cmake oluşturulan görevleri yürütmek için kullanılan hıza odaklanarak daha küçük bir yapı sistemi. + +Ubuntu, Debian veya Mint run’a yüklemek için `sudo apt install cmake ninja-build`. + +Centos’ta, RedHat koşusu `sudo yum install cmake ninja-build`. + +Arch veya Gentoo kullanıyorsanız, muhtemelen cmake’i nasıl kuracağınızı kendiniz biliyorsunuz. + +Mac OS X üzerinde cmake ve Ninja yüklemek için ilk homebrew yüklemek ve daha sonra demlemek yoluyla her şeyi yüklemek: + + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + brew install cmake ninja + +Ardından, cmake sürümünü kontrol edin: `cmake --version`. 3.3’ün altındaysa, web sitesinden daha yeni bir sürüm yüklemelisiniz: https://cmake.org/download/. + +# İsteğe Bağlı Harici Kütüphaneler {#optional-external-libraries} + +ClickHouse, bina için birkaç dış kütüphane kullanır. Alt modüllerde bulunan kaynaklardan ClickHouse ile birlikte oluşturuldukları için hepsinin ayrı olarak kurulması gerekmez. Listeyi kontrol edebilirsiniz `contrib`. + +# C++ Derleyici {#c-compiler} + +Derleyiciler gcc sürüm 9 ve Clang sürüm 8 veya üzeri başlayarak ClickHouse bina için desteklenmektedir. + +Resmi Yandex şu anda GCC’Yİ kullanıyor çünkü biraz daha iyi performansa sahip makine kodu üretiyor (kriterlerimize göre yüzde birkaçına kadar bir fark yaratıyor). Ve Clang genellikle geliştirme için daha uygundur. Yine de, sürekli entegrasyon (CI) platformumuz yaklaşık bir düzine yapı kombinasyonunu denetler. + +Ubuntu run GCC yüklemek için: `sudo apt install gcc g++` + +Gcc sürümünü kontrol edin: `gcc --version`. 9’un altındaysa, buradaki talimatları izleyin: https://clickhouse.tech / docs/TR/development / build / \#ınstall-gcc-9. + +Mac OS X build sadece Clang için desteklenir. Sadece koş `brew install llvm` + +Eğer Clang kullanmaya karar verirseniz, ayrıca yükleyebilirsiniz `libc++` ve `lld` eğer ne olduğunu biliyorsan. Kullanım `ccache` ayrıca tavsiye edilir. + +# İnşaat Süreci {#the-building-process} + +Artık ClickHouse oluşturmaya hazır olduğunuza göre ayrı bir dizin oluşturmanızı öneririz `build` için `ClickHouse` bu, tüm yapı eserlerini içerecek: + + mkdir build + cd build + +Birkaç farklı dizine (build\_release, build\_debug, vb.) sahip olabilirsiniz.) farklı yapı türleri için. + +İçinde iken `build` dizin, cmake çalıştırarak yapı yapılandırın. İlk çalıştırmadan önce, derleyici belirten ortam değişkenlerini tanımlamanız gerekir (bu örnekte sürüm 9 gcc derleyicisi). + +Linux: + + export CC=gcc-9 CXX=g++-9 + cmake .. + +Mac OS X: + + export CC=clang CXX=clang++ + cmake .. + +Bu `CC` değişken C için derleyiciyi belirtir (C derleyicisi için kısa) ve `CXX` değişken, hangi C++ derleyicisinin bina için kullanılacağını bildirir. + +Daha hızlı bir yapı için, `debug` yapı türü-hiçbir optimizasyonları ile bir yapı. Bunun için aşağıdaki parametreyi sağlayın `-D CMAKE_BUILD_TYPE=Debug`: + + cmake -D CMAKE_BUILD_TYPE=Debug .. + +Bu komutu çalıştırarak yapı türünü değiştirebilirsiniz. `build` dizin. + +İnşa etmek için ninja çalıştırın: + + ninja clickhouse-server clickhouse-client + +Bu örnekte yalnızca gerekli ikili dosyalar oluşturulacaktır. + +Tüm ikili dosyaları (Yardımcı Programlar ve testler) oluşturmanız gerekiyorsa, ninja’yı parametre olmadan çalıştırmalısınız: + + ninja + +Tam yapı, ana ikili dosyaları oluşturmak için yaklaşık 30GB boş disk alanı veya 15GB gerektirir. + +Yapı makinesinde büyük miktarda RAM mevcut olduğunda, paralel olarak çalışan yapı görevlerinin sayısını sınırlamanız gerekir `-j` param: + + ninja -j 1 clickhouse-server clickhouse-client + +4GB RAM’Lİ makinelerde, 8GB RAM için 1 belirtmeniz önerilir `-j 2` tavsiye edilir. + +Mesajı alırsanız: `ninja: error: loading 'build.ninja': No such file or directory` bu, bir yapı yapılandırması oluşturmanın başarısız olduğu ve yukarıdaki mesajı incelemeniz gerektiği anlamına gelir. + +Bina işleminin başarılı bir şekilde başlatılmasının ardından, yapı ilerlemesini görürsünüz-işlenmiş görevlerin sayısı ve toplam görev sayısı. + +Libhdfs2 kütüphanesinde protobuf dosyaları hakkında mesajlar oluştururken `libprotobuf WARNING` ortaya çıkabilir. Hiçbir şeyi etkilemezler ve göz ardı edilmeleri güvenlidir. + +Başarılı bir yapı üzerine yürütülebilir bir dosya alırsınız `ClickHouse//programs/clickhouse`: + + ls -l programs/clickhouse + +# Clickhouse’un yerleşik yürütülebilir dosyasını çalıştırma {#running-the-built-executable-of-clickhouse} + +Sunucuyu geçerli kullanıcı altında çalıştırmak için aşağıdakilere gitmeniz gerekir `ClickHouse/programs/server/` (dışında bulunan `build`) ve koş: + + ../../../build/programs/clickhouse server + +Bu durumda, ClickHouse geçerli dizinde bulunan yapılandırma dosyalarını kullanır. Koş youabilirsiniz `clickhouse server` komut satırı parametresi olarak bir yapılandırma dosyasının yolunu belirten herhangi bir dizinden `--config-file`. + +Başka bir terminalde clickhouse-client ile Clickhouse’a bağlanmak için `ClickHouse/build/programs/` ve koş `clickhouse client`. + +Eğer alırsanız `Connection refused` Mac OS X veya Freebsd’de mesaj, ana bilgisayar adresi 127.0.0.1 belirtmeyi deneyin: + + clickhouse client --host 127.0.0.1 + +Sisteminizde yüklü olan ClickHouse binary’nin üretim sürümünü özel olarak oluşturulmuş ClickHouse binaryinizle değiştirebilirsiniz. Bunu yapmak için resmi web sitesinden talimatları izleyerek Makinenize ClickHouse yükleyin. Ardından, aşağıdakileri çalıştırın: + + sudo service clickhouse-server stop + sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ + sudo service clickhouse-server start + +Not thate that `clickhouse-client`, `clickhouse-server` ve diğerleri yaygın olarak paylaşılan sembolik bağlardır `clickhouse` ikilik. + +Ayrıca sisteminizde yüklü ClickHouse paketinden yapılandırma dosyası ile özel inşa ClickHouse ikili çalıştırabilirsiniz: + + sudo service clickhouse-server stop + sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml + +# IDE (entegre geliştirme ortamı) {#ide-integrated-development-environment} + +Hangi IDE kullanmak bilmiyorsanız, clion kullanmanızı öneririz. CLion ticari bir yazılımdır, ancak 30 günlük ücretsiz deneme süresi sunar. Öğrenciler için de ücretsizdir. CLion Linux ve Mac OS X hem de kullanılabilir. + +KDevelop ve QTCreator, ClickHouse geliştirmek için bir IDE’NİN diğer harika alternatifleridir. KDevelop kararsız olmasına rağmen çok kullanışlı bir IDE olarak geliyor. KDevelop projeyi açtıktan sonra bir süre sonra çökerse, tıklamanız gerekir “Stop All” proje dosyalarının listesini açar açmaz düğme. Bunu yaptıktan sonra KDevelop ile çalışmak iyi olmalıdır. + +Basit kod editörleri olarak, Yüce metin veya Visual Studio kodunu veya Kate’i (hepsi Linux’ta kullanılabilir) kullanabilirsiniz. + +Her ihtimale karşı, Clion’un yarattığını belirtmek gerekir `build` kendi başına yol, aynı zamanda kendi seçtikleri `debug` yapı türü için, yapılandırma için Clion’da tanımlanan ve sizin tarafınızdan yüklenmeyen bir cmake sürümünü kullanır ve son olarak CLion kullanacaktır `make` yerine yapı görevlerini çalıştırmak için `ninja`. Bu normal bir davranıştır, sadece karışıklığı önlemek için bunu aklınızda bulundurun. + +# Kod Yazma {#writing-code} + +Açıklaması ClickHouse mimarisi burada bulabilirsiniz: https://clickhouse.tech / doscs/TR / development / Arch /it /ec /ture/ + +Kod stili Kılavuzu: https://clickhouse.tech / doscs / TR / development / style/ + +Yazma testleri: https://clickhouse.teknoloji / doscs / TR / geliştirme / testler/ + +Görevlerin listesi: https://github.com/ClickHouse/ClickHouse/blob/master/testsructions/easy\_tasks\_sorted\_en.md + +# Test Verileri {#test-data} + +Clickhouse’un geliştirilmesi genellikle gerçekçi veri kümelerinin yüklenmesini gerektirir. Performans testi için özellikle önemlidir. Yandex’ten özel olarak hazırlanmış anonim veri setimiz var.Metrica. Ayrıca bazı 3GB boş disk alanı gerektirir. Bu verilerin geliştirme görevlerinin çoğunu gerçekleştirmek için gerekli olmadığını unutmayın. + + sudo apt install wget xz-utils + + wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz + wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz + + xz -v -d hits_v1.tsv.xz + xz -v -d visits_v1.tsv.xz + + clickhouse-client + + CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); + + CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); + + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv + +# Çekme İsteği Oluşturma {#creating-pull-request} + +Github’un kullanıcı arayüzünde çatal deposuna gidin. Bir dalda gelişiyorsanız, o Dalı seçmeniz gerekir. Bir olacak “Pull request” ekranda bulunan düğme. Özünde, bu demektir “create a request for accepting my changes into the main repository”. + +Çalışma henüz tamamlanmamış olsa bile bir çekme isteği oluşturulabilir. Bu durumda lütfen kelimeyi koyun “WIP” (devam eden çalışma) başlığın başında, daha sonra değiştirilebilir. Bu, kooperatif Gözden geçirme ve değişikliklerin tartışılması ve mevcut tüm testlerin çalıştırılması için kullanışlıdır. Değişikliklerinizin kısa bir açıklamasını sağlamanız önemlidir, daha sonra sürüm değişiklikleri oluşturmak için kullanılacaktır. + +Yandex çalışanları PR’NİZİ bir etiketle etiketlediğinde testler başlayacaktır “can be tested”. The results of some first checks (e.g. code style) will come in within several minutes. Build check results will arrive within half an hour. And the main set of tests will report itself within an hour. + +Sistem, çekme isteğiniz için ayrı ayrı ClickHouse ikili yapıları hazırlayacaktır. Bu yapıları almak için tıklayın “Details” yanındaki bağlantı “ClickHouse build check” çekler listesinde giriş. Orada inşa doğrudan bağlantılar bulacaksınız .eğer üretim sunucularında bile dağıtabilirsiniz ClickHouse DEB paketleri (eğer hiçbir korku varsa). + +Büyük olasılıkla bazı yapılar ilk kez başarısız olur. Bunun nedeni, hem gcc hem de clang ile, hemen hemen tüm mevcut uyarılarla (her zaman `-Werror` bayrak) clang için etkin. Aynı sayfada, tüm yapı günlüklerini bulabilirsiniz, böylece tüm olası yollarla ClickHouse oluşturmak zorunda kalmazsınız. diff --git a/docs/tr/development/developer_instruction.md b/docs/tr/development/developer_instruction.md deleted file mode 100644 index f9984d9bf20..00000000000 --- a/docs/tr/development/developer_instruction.md +++ /dev/null @@ -1,285 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 61 -toc_title: "Acemi ClickHouse Geli\u015Ftirici Talimat" ---- - -ClickHouse binası Linux, FreeBSD ve Mac OS X üzerinde desteklenmektedir. - -# Windows Kullanıyorsanız {#if-you-use-windows} - -Windows kullanıyorsanız, Ubuntu ile bir sanal makine oluşturmanız gerekir. Bir sanal makine ile çalışmaya başlamak için VirtualBox yükleyin. UB :unt :u'yu web sitesinden indirebilirsiniz: https://www.ubuntu.com/\#download. lütfen indirilen görüntüden bir sanal makine oluşturun (bunun için en az 4GB RAM ayırmalısınız). Ubuntu'da bir komut satırı terminali çalıştırmak için lütfen kelimeyi içeren bir program bulun “terminal” adına (gnome-terminal, konsole vb.)) veya sadece Ctrl+Alt+T tuşlarına basın. - -# 32 bit sistem kullanıyorsanız {#if-you-use-a-32-bit-system} - -ClickHouse çalışamaz veya 32-bit bir sistem üzerinde oluşturun. 64-bit bir sisteme erişim kazanmanız gerekir ve okumaya devam edebilirsiniz. - -# Github'da bir depo oluşturma {#creating-a-repository-on-github} - -ClickHouse repository ile çalışmaya başlamak için bir GitHub hesabına ihtiyacınız olacaktır. - -Muhtemelen zaten bir tane var, ama yapmazsanız, lütfen kayıt olun https://github.com. SSH anahtarlarınız yoksa, bunları üretmeli ve daha sonra Github'a yüklemelisiniz. Bu yamalar üzerinden göndermek için gereklidir. Diğer SSH sunucularıyla kullandığınız aynı SSH anahtarlarını kullanmak da mümkündür - muhtemelen zaten bunlara sahipsiniz. - -ClickHouse deposunun bir çatalı oluşturun. Bunu yapmak için lütfen tıklayın “fork” sağ üst köşedeki düğme https://github.com/ClickHouse/ClickHouse. bu hesabınıza ClickHouse / ClickHouse kendi kopyasını çatal olacaktır. - -Geliştirme süreci ilk ClickHouse sizin çatal içine amaçlanan değişiklikleri işlemekle ve daha sonra bir oluşturma oluşur “pull request” bu değişikliklerin ana depoya kabul edilmesi için (ClickHouse/ClickHouse). - -Git depoları ile çalışmak için lütfen yükleyin `git`. - -Bunu Ubuntu'da yapmak için komut satırı terminalinde çalışırsınız: - - sudo apt update - sudo apt install git - -Git kullanımı ile ilgili kısa bir el kitabı burada bulunabilir: https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf. -Git ile ilgili ayrıntılı bir el kitabı için bkz. https://git-scm.com/book/en/v2. - -# Geliştirme Makinenize bir depo klonlama {#cloning-a-repository-to-your-development-machine} - -Ardından, kaynak dosyaları çalışma makinenize indirmeniz gerekir. Bu denir “to clone a repository” çünkü çalışma makinenizde deponun yerel bir kopyasını oluşturur. - -Komut satırında terminal Çalıştır: - - git clone --recursive git@guthub.com:your_github_username/ClickHouse.git - cd ClickHouse - -Not: lütfen, yerine *your\_github\_username* uygun olanı ile! - -Bu komut bir dizin oluşturacaktır `ClickHouse` projenin çalışma kopyasını içeren. - -Yapı sistemini çalıştırmakla ilgili sorunlara yol açabileceğinden, çalışma dizininin yolunun hiçbir boşluk içermemesi önemlidir. - -ClickHouse deposunun kullandığını lütfen unutmayın `submodules`. That is what the references to additional repositories are called (i.e. external libraries on which the project depends). It means that when cloning the repository you need to specify the `--recursive` yukarıdaki örnekte olduğu gibi bayrak. Depo alt modüller olmadan klonlanmışsa, bunları indirmek için aşağıdakileri çalıştırmanız gerekir: - - git submodule init - git submodule update - -Komutu ile durumunu kontrol edebilirsiniz: `git submodule status`. - -Aşağıdaki hata iletisini alırsanız: - - Permission denied (publickey). - fatal: Could not read from remote repository. - - Please make sure you have the correct access rights - and the repository exists. - -Genellikle Github'a bağlanmak için SSH anahtarlarının eksik olduğu anlamına gelir. Bu anahtarlar normalde `~/.ssh`. SSH anahtarlarının kabul edilmesi için bunları GitHub kullanıcı arayüzünün ayarlar bölümüne yüklemeniz gerekir. - -Depoyu https protokolü aracılığıyla da klonlayabilirsiniz: - - git clone https://github.com/ClickHouse/ClickHouse.git - -Ancak bu, değişikliklerinizi sunucuya göndermenize izin vermez. Yine de geçici olarak kullanabilir ve SSH anahtarlarını daha sonra deponun uzak adresini değiştirerek ekleyebilirsiniz `git remote` komut. - -Oradan güncellemeleri çekmek için orijinal ClickHouse repo'nun adresini yerel deponuza da ekleyebilirsiniz: - - git remote add upstream git@github.com:ClickHouse/ClickHouse.git - -Başarıyla bu komutu çalıştırdıktan sonra çalıştırarak ana ClickHouse repo güncellemeleri çekmek mümkün olacak `git pull upstream master`. - -## Alt modüllerle çalışma {#working-with-submodules} - -Git'teki alt modüllerle çalışmak acı verici olabilir. Sonraki komutlar onu yönetmeye yardımcı olacaktır: - - # ! each command accepts --recursive - # Update remote URLs for submodules. Barely rare case - git submodule sync - # Add new submodules - git submodule init - # Update existing submodules to the current state - git submodule update - # Two last commands could be merged together - git submodule update --init - -Bir sonraki komutlar, tüm alt modülleri başlangıç durumuna sıfırlamanıza yardımcı olacaktır (!UYARI! - herhangi bir değişiklik içinde silinecektir): - - # Synchronizes submodules' remote URL with .gitmodules - git submodule sync --recursive - # Update the registered submodules with initialize not yet initialized - git submodule update --init --recursive - # Reset all changes done after HEAD - git submodule foreach git reset --hard - # Clean files from .gitignore - git submodule foreach git clean -xfd - # Repeat last 4 commands for all submodule - git submodule foreach git submodule sync --recursive - git submodule foreach git submodule update --init --recursive - git submodule foreach git submodule foreach git reset --hard - git submodule foreach git submodule foreach git clean -xfd - -# Yapı Sistemi {#build-system} - -ClickHouse bina için Cmake ve Ninja kullanır. - -Cmake-ninja dosyaları (yapı görevleri) üretebilir bir meta-yapı sistemi. -Ninja-bu cmake oluşturulan görevleri yürütmek için kullanılan hıza odaklanarak daha küçük bir yapı sistemi. - -Ubuntu, Debian veya Mint run'a yüklemek için `sudo apt install cmake ninja-build`. - -Centos'ta, RedHat koşusu `sudo yum install cmake ninja-build`. - -Arch veya Gentoo kullanıyorsanız, muhtemelen cmake'i nasıl kuracağınızı kendiniz biliyorsunuz. - -Mac OS X üzerinde cmake ve Ninja yüklemek için ilk homebrew yüklemek ve daha sonra demlemek yoluyla her şeyi yüklemek: - - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install cmake ninja - -Ardından, cmake sürümünü kontrol edin: `cmake --version`. 3.3'ün altındaysa, web sitesinden daha yeni bir sürüm yüklemelisiniz: https://cmake.org/download/. - -# İsteğe Bağlı Harici Kütüphaneler {#optional-external-libraries} - -ClickHouse, bina için birkaç dış kütüphane kullanır. Alt modüllerde bulunan kaynaklardan ClickHouse ile birlikte oluşturuldukları için hepsinin ayrı olarak kurulması gerekmez. Listeyi kontrol edebilirsiniz `contrib`. - -# C++ Derleyici {#c-compiler} - -Derleyiciler gcc sürüm 9 ve Clang sürüm 8 veya üzeri başlayarak ClickHouse bina için desteklenmektedir. - -Resmi Yandex şu anda GCC'Yİ kullanıyor çünkü biraz daha iyi performansa sahip makine kodu üretiyor (kriterlerimize göre yüzde birkaçına kadar bir fark yaratıyor). Ve Clang genellikle geliştirme için daha uygundur. Yine de, sürekli entegrasyon (CI) platformumuz yaklaşık bir düzine yapı kombinasyonunu denetler. - -Ubuntu run GCC yüklemek için: `sudo apt install gcc g++` - -Gcc sürümünü kontrol edin: `gcc --version`. 9'un altındaysa, buradaki talimatları izleyin: https://clickhouse.tech / docs/TR/development / build / \#ınstall-gcc-9. - -Mac OS X build sadece Clang için desteklenir. Sadece koş `brew install llvm` - -Eğer Clang kullanmaya karar verirseniz, ayrıca yükleyebilirsiniz `libc++` ve `lld` eğer ne olduğunu biliyorsan. Kullanım `ccache` ayrıca tavsiye edilir. - -# İnşaat Süreci {#the-building-process} - -Artık ClickHouse oluşturmaya hazır olduğunuza göre ayrı bir dizin oluşturmanızı öneririz `build` için `ClickHouse` bu, tüm yapı eserlerini içerecek: - - mkdir build - cd build - -Birkaç farklı dizine (build\_release, build\_debug, vb.) sahip olabilirsiniz.) farklı yapı türleri için. - -İçinde iken `build` dizin, cmake çalıştırarak yapı yapılandırın. İlk çalıştırmadan önce, derleyici belirten ortam değişkenlerini tanımlamanız gerekir (bu örnekte sürüm 9 gcc derleyicisi). - -Linux: - - export CC=gcc-9 CXX=g++-9 - cmake .. - -Mac OS X: - - export CC=clang CXX=clang++ - cmake .. - -Bu `CC` değişken C için derleyiciyi belirtir (C derleyicisi için kısa) ve `CXX` değişken, hangi C++ derleyicisinin bina için kullanılacağını bildirir. - -Daha hızlı bir yapı için, `debug` yapı türü-hiçbir optimizasyonları ile bir yapı. Bunun için aşağıdaki parametreyi sağlayın `-D CMAKE_BUILD_TYPE=Debug`: - - cmake -D CMAKE_BUILD_TYPE=Debug .. - -Bu komutu çalıştırarak yapı türünü değiştirebilirsiniz. `build` dizin. - -İnşa etmek için ninja çalıştırın: - - ninja clickhouse-server clickhouse-client - -Bu örnekte yalnızca gerekli ikili dosyalar oluşturulacaktır. - -Tüm ikili dosyaları (Yardımcı Programlar ve testler) oluşturmanız gerekiyorsa, ninja'yı parametre olmadan çalıştırmalısınız: - - ninja - -Tam yapı, ana ikili dosyaları oluşturmak için yaklaşık 30GB boş disk alanı veya 15GB gerektirir. - -Yapı makinesinde büyük miktarda RAM mevcut olduğunda, paralel olarak çalışan yapı görevlerinin sayısını sınırlamanız gerekir `-j` param: - - ninja -j 1 clickhouse-server clickhouse-client - -4GB RAM'Lİ makinelerde, 8GB RAM için 1 belirtmeniz önerilir `-j 2` tavsiye edilir. - -Mesajı alırsanız: `ninja: error: loading 'build.ninja': No such file or directory` bu, bir yapı yapılandırması oluşturmanın başarısız olduğu ve yukarıdaki mesajı incelemeniz gerektiği anlamına gelir. - -Bina işleminin başarılı bir şekilde başlatılmasının ardından, yapı ilerlemesini görürsünüz-işlenmiş görevlerin sayısı ve toplam görev sayısı. - -Libhdfs2 kütüphanesinde protobuf dosyaları hakkında mesajlar oluştururken `libprotobuf WARNING` ortaya çıkabilir. Hiçbir şeyi etkilemezler ve göz ardı edilmeleri güvenlidir. - -Başarılı bir yapı üzerine yürütülebilir bir dosya alırsınız `ClickHouse//programs/clickhouse`: - - ls -l programs/clickhouse - -# Clickhouse'un yerleşik yürütülebilir dosyasını çalıştırma {#running-the-built-executable-of-clickhouse} - -Sunucuyu geçerli kullanıcı altında çalıştırmak için aşağıdakilere gitmeniz gerekir `ClickHouse/programs/server/` (dışında bulunan `build`) ve koş: - - ../../../build/programs/clickhouse server - -Bu durumda, ClickHouse geçerli dizinde bulunan yapılandırma dosyalarını kullanır. Koş youabilirsiniz `clickhouse server` komut satırı parametresi olarak bir yapılandırma dosyasının yolunu belirten herhangi bir dizinden `--config-file`. - -Başka bir terminalde clickhouse-client ile Clickhouse'a bağlanmak için `ClickHouse/build/programs/` ve koş `clickhouse client`. - -Eğer alırsanız `Connection refused` Mac OS X veya Freebsd'de mesaj, ana bilgisayar adresi 127.0.0.1 belirtmeyi deneyin: - - clickhouse client --host 127.0.0.1 - -Sisteminizde yüklü olan ClickHouse binary'nin üretim sürümünü özel olarak oluşturulmuş ClickHouse binaryinizle değiştirebilirsiniz. Bunu yapmak için resmi web sitesinden talimatları izleyerek Makinenize ClickHouse yükleyin. Ardından, aşağıdakileri çalıştırın: - - sudo service clickhouse-server stop - sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ - sudo service clickhouse-server start - -Not thate that `clickhouse-client`, `clickhouse-server` ve diğerleri yaygın olarak paylaşılan sembolik bağlardır `clickhouse` ikilik. - -Ayrıca sisteminizde yüklü ClickHouse paketinden yapılandırma dosyası ile özel inşa ClickHouse ikili çalıştırabilirsiniz: - - sudo service clickhouse-server stop - sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml - -# IDE (entegre geliştirme ortamı) {#ide-integrated-development-environment} - -Hangi IDE kullanmak bilmiyorsanız, clion kullanmanızı öneririz. CLion ticari bir yazılımdır, ancak 30 günlük ücretsiz deneme süresi sunar. Öğrenciler için de ücretsizdir. CLion Linux ve Mac OS X hem de kullanılabilir. - -KDevelop ve QTCreator, ClickHouse geliştirmek için bir IDE'NİN diğer harika alternatifleridir. KDevelop kararsız olmasına rağmen çok kullanışlı bir IDE olarak geliyor. KDevelop projeyi açtıktan sonra bir süre sonra çökerse, tıklamanız gerekir “Stop All” proje dosyalarının listesini açar açmaz düğme. Bunu yaptıktan sonra KDevelop ile çalışmak iyi olmalıdır. - -Basit kod editörleri olarak, Yüce metin veya Visual Studio kodunu veya Kate'i (hepsi Linux'ta kullanılabilir) kullanabilirsiniz. - -Her ihtimale karşı, Clion'un yarattığını belirtmek gerekir `build` kendi başına yol, aynı zamanda kendi seçtikleri `debug` yapı türü için, yapılandırma için Clion'da tanımlanan ve sizin tarafınızdan yüklenmeyen bir cmake sürümünü kullanır ve son olarak CLion kullanacaktır `make` yerine yapı görevlerini çalıştırmak için `ninja`. Bu normal bir davranıştır, sadece karışıklığı önlemek için bunu aklınızda bulundurun. - -# Kod Yazma {#writing-code} - -Açıklaması ClickHouse mimarisi burada bulabilirsiniz: https://clickhouse.tech / doscs/TR / development / Arch /it /ec /ture/ - -Kod stili Kılavuzu: https://clickhouse.tech / doscs / TR / development / style/ - -Yazma testleri: https://clickhouse.teknoloji / doscs / TR / geliştirme / testler/ - -Görevlerin listesi: https://github.com/ClickHouse/ClickHouse/blob/master/testsructions/easy\_tasks\_sorted\_en.md - -# Test Verileri {#test-data} - -Clickhouse'un geliştirilmesi genellikle gerçekçi veri kümelerinin yüklenmesini gerektirir. Performans testi için özellikle önemlidir. Yandex'ten özel olarak hazırlanmış anonim veri setimiz var.Metrica. Ayrıca bazı 3GB boş disk alanı gerektirir. Bu verilerin geliştirme görevlerinin çoğunu gerçekleştirmek için gerekli olmadığını unutmayın. - - sudo apt install wget xz-utils - - wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz - wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz - - xz -v -d hits_v1.tsv.xz - xz -v -d visits_v1.tsv.xz - - clickhouse-client - - CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); - - CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); - - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv - -# Çekme İsteği Oluşturma {#creating-pull-request} - -Github'un kullanıcı arayüzünde çatal deposuna gidin. Bir dalda gelişiyorsanız, o Dalı seçmeniz gerekir. Bir olacak “Pull request” ekranda bulunan düğme. Özünde, bu demektir “create a request for accepting my changes into the main repository”. - -Çalışma henüz tamamlanmamış olsa bile bir çekme isteği oluşturulabilir. Bu durumda lütfen kelimeyi koyun “WIP” (devam eden çalışma) başlığın başında, daha sonra değiştirilebilir. Bu, kooperatif Gözden geçirme ve değişikliklerin tartışılması ve mevcut tüm testlerin çalıştırılması için kullanışlıdır. Değişikliklerinizin kısa bir açıklamasını sağlamanız önemlidir, daha sonra sürüm değişiklikleri oluşturmak için kullanılacaktır. - -Yandex çalışanları PR'NİZİ bir etiketle etiketlediğinde testler başlayacaktır “can be tested”. The results of some first checks (e.g. code style) will come in within several minutes. Build check results will arrive within half an hour. And the main set of tests will report itself within an hour. - -Sistem, çekme isteğiniz için ayrı ayrı ClickHouse ikili yapıları hazırlayacaktır. Bu yapıları almak için tıklayın “Details” yanındaki bağlantı “ClickHouse build check” çekler listesinde giriş. Orada inşa doğrudan bağlantılar bulacaksınız .eğer üretim sunucularında bile dağıtabilirsiniz ClickHouse DEB paketleri (eğer hiçbir korku varsa). - -Büyük olasılıkla bazı yapılar ilk kez başarısız olur. Bunun nedeni, hem gcc hem de clang ile, hemen hemen tüm mevcut uyarılarla (her zaman `-Werror` bayrak) clang için etkin. Aynı sayfada, tüm yapı günlüklerini bulabilirsiniz, böylece tüm olası yollarla ClickHouse oluşturmak zorunda kalmazsınız. diff --git a/docs/tr/development/style.md b/docs/tr/development/style.md index 713f95cf053..fae00422d18 100644 --- a/docs/tr/development/style.md +++ b/docs/tr/development/style.md @@ -5,7 +5,7 @@ toc_priority: 68 toc_title: "C++ kodu nas\u0131l yaz\u0131l\u0131r" --- -# C++ kodu nasıl yazılır {#how-to-write-c-code} +# C++ Kodu nasıl yazılır {#how-to-write-c-code} ## Genel Öneriler {#general-recommendations} @@ -270,7 +270,7 @@ void executeQuery( **8.** Tek satırlı yorumlar üç eğik çizgi ile başlar: `///` ve çok satırlı yorumlar ile başlar `/**`. Bu yorumlar dikkate alınır “documentation”. -Not: bu yorumlardan belgeler oluşturmak için Doxygen kullanabilirsiniz. Ancak DOXYGEN genellikle kullanılmaz, çünkü IDE'DEKİ kodda gezinmek daha uygundur. +Not: bu yorumlardan belgeler oluşturmak için Doxygen kullanabilirsiniz. Ancak DOXYGEN genellikle kullanılmaz, çünkü IDE’DEKİ kodda gezinmek daha uygundur. **9.** Çok satırlı açıklamaların başında ve sonunda (çok satırlı bir açıklamayı kapatan satır hariç) boş satırları olmamalıdır. @@ -396,7 +396,7 @@ Bağımsız değişken yapıcı gövdesinde kullanılmazsa, alt çizgi soneki at timer (not m_timer) ``` -**14.** Bir de SAB theitler için `enum`, büyük harfle CamelCase kullanın. ALL\_CAPS da kabul edilebilir. Eğer... `enum` yerel olmayan, bir `enum class`. +**14.** Bir de SAB theitler için `enum`, büyük harfle CamelCase kullanın. ALL\_CAPS da kabul edilebilir. Eğer… `enum` yerel olmayan, bir `enum class`. ``` cpp enum class CompressionMethod @@ -410,7 +410,7 @@ enum class CompressionMethod not Stroka -**16.** Kısaltmalar iyi biliniyorsa kabul edilebilir (kısaltmanın anlamını Wikipedia'da veya bir arama motorunda kolayca bulabilirsiniz). +**16.** Kısaltmalar iyi biliniyorsa kabul edilebilir (kısaltmanın anlamını Wikipedia’da veya bir arama motorunda kolayca bulabilirsiniz). `AST`, `SQL`. @@ -656,7 +656,7 @@ Günlüğünde UTF-8 kodlamasını kullanın. Nadir durumlarda, günlüğünde A Kullanmayın `iostreams` uygulama performansı için kritik olan iç döngülerde (ve asla kullanmayın `stringstream`). -Kullan... `DB/IO` kütüphane yerine. +Kullan… `DB/IO` kütüphane yerine. **21.** Tarih ve zaman. @@ -689,7 +689,7 @@ auto s = std::string{"Hello"}; **26.** Sanal işlevler için yaz `virtual` temel sınıfta, ama yaz `override` yerine `virtual` soyundan gelen sınıflarda. -## C++ ' ın kullanılmayan özellikleri {#unused-features-of-c} +## C++ ’ ın kullanılmayan özellikleri {#unused-features-of-c} **1.** Sanal devralma kullanılmaz. @@ -727,7 +727,7 @@ CPU komut seti, sunucularımız arasında desteklenen minimum kümedir. Şu anda **3.** Profilleme için kullanın `Linux Perf`, `valgrind` (`callgrind`), veya `strace -cf`. -**4.** Kaynaklar Git'te. +**4.** Kaynaklar Git’te. **5.** Montaj kullanımları `CMake`. @@ -795,7 +795,7 @@ Yazar yousan `std::memcpy` yerine `memcpy` her yerde, o zaman `memmem` olarak `s Yine de, hala kullanabilirsiniz `std::` eğer tercih ederseniz edin. -**3.** Aynı olanlar standart C++ kütüphanesinde mevcut olduğunda C'den işlevleri kullanma. +**3.** Aynı olanlar standart C++ kütüphanesinde mevcut olduğunda C’den işlevleri kullanma. Daha verimli ise bu kabul edilebilir. diff --git a/docs/tr/development/tests.md b/docs/tr/development/tests.md index 1d39c24da5f..0ebfebe0316 100644 --- a/docs/tr/development/tests.md +++ b/docs/tr/development/tests.md @@ -14,7 +14,7 @@ Fonksiyonel testler en basit ve kullanımı kolay olanlardır. ClickHouse özell Her işlevsel test, çalışan ClickHouse sunucusuna bir veya birden çok sorgu gönderir ve sonucu referansla karşılaştırır. -Testler bulunur `queries` dizin. İki alt dizin var: `stateless` ve `stateful`. Durumsuz testler, önceden yüklenmiş test verileri olmadan sorguları çalıştırır - genellikle testin kendisinde anında küçük sentetik veri kümeleri oluştururlar. Durum bilgisi testleri, Yandex'ten önceden yüklenmiş test verileri gerektirir.Metrica ve halka açık değil. Biz sadece kullanmak eğilimindedir `stateless` testler ve yeni eklemekten kaçının `stateful` testler. +Testler bulunur `queries` dizin. İki alt dizin var: `stateless` ve `stateful`. Durumsuz testler, önceden yüklenmiş test verileri olmadan sorguları çalıştırır - genellikle testin kendisinde anında küçük sentetik veri kümeleri oluştururlar. Durum bilgisi testleri, Yandex’ten önceden yüklenmiş test verileri gerektirir.Metrica ve halka açık değil. Biz sadece kullanmak eğilimindedir `stateless` testler ve yeni eklemekten kaçının `stateful` testler. Her test iki tipten biri olabilir: `.sql` ve `.sh`. `.sql` test için borulu basit SQL komut dosyasıdır `clickhouse-client --multiquery --testmode`. `.sh` test kendisi tarafından çalıştırılan bir komut dosyasıdır. @@ -41,15 +41,15 @@ Fonksiyonel testlerle kolayca çoğaltılabilen bazı hatalar biliyorsak, hazır ## Entegrasyon Testleri {#integration-tests} -Entegrasyon testleri, kümelenmiş konfigürasyonda Clickhouse'u ve MySQL, Postgres, MongoDB gibi diğer sunucularla ClickHouse etkileşimini test etmeyi sağlar. Ağ bölmelerini, paket damlalarını vb. taklit etmek için kullanışlıdırlar. Bu testler Docker altında çalıştırılır ve çeşitli yazılımlarla birden fazla konteyner oluşturur. +Entegrasyon testleri, kümelenmiş konfigürasyonda Clickhouse’u ve MySQL, Postgres, MongoDB gibi diğer sunucularla ClickHouse etkileşimini test etmeyi sağlar. Ağ bölmelerini, paket damlalarını vb. taklit etmek için kullanışlıdırlar. Bu testler Docker altında çalıştırılır ve çeşitli yazılımlarla birden fazla konteyner oluşturur. Görmek `tests/integration/README.md` bu testlerin nasıl çalıştırılacağı hakkında. -Clickhouse'un üçüncü taraf sürücülerle entegrasyonunun sınanmadığını unutmayın. Ayrıca şu anda JDBC ve ODBC sürücülerimizle entegrasyon testlerimiz yok. +Clickhouse’un üçüncü taraf sürücülerle entegrasyonunun sınanmadığını unutmayın. Ayrıca şu anda JDBC ve ODBC sürücülerimizle entegrasyon testlerimiz yok. ## Ünite Testleri {#unit-tests} -Birim testleri, Clickhouse'u bir bütün olarak değil, tek bir yalıtılmış kitaplık veya sınıfı test etmek istediğinizde kullanışlıdır. Etkinleştirebilir veya devre dışı bırakma ile testlerin yapı `ENABLE_TESTS` Cmake seçeneği. Birim testleri (ve diğer test programları) bulunur `tests` kodun alt dizinleri. Birim testlerini çalıştırmak için şunları yazın `ninja test`. Bazı testler kullanın `gtest`, ancak bazıları test başarısızlığında sıfır olmayan çıkış kodunu döndüren programlardır. +Birim testleri, Clickhouse’u bir bütün olarak değil, tek bir yalıtılmış kitaplık veya sınıfı test etmek istediğinizde kullanışlıdır. Etkinleştirebilir veya devre dışı bırakma ile testlerin yapı `ENABLE_TESTS` Cmake seçeneği. Birim testleri (ve diğer test programları) bulunur `tests` kodun alt dizinleri. Birim testlerini çalıştırmak için şunları yazın `ninja test`. Bazı testler kullanın `gtest`, ancak bazıları test başarısızlığında sıfır olmayan çıkış kodunu döndüren programlardır. Kodun zaten işlevsel testler tarafından kapsanması durumunda birim testlerine sahip olmak zorunlu değildir (ve işlevsel testler genellikle kullanımı çok daha basittir). @@ -59,11 +59,11 @@ Performans testleri ölçmek ve sentetik sorguları ClickHouse bazı izole kısm Her test, durdurma için bazı koşullarla (örneğin, bir döngüde bir veya birden fazla sorgu (muhtemelen parametre kombinasyonlarıyla) çalıştırır “maximum execution speed is not changing in three seconds”) ve sorgu performansı ile ilgili bazı metrikleri ölçün (örneğin “maximum execution speed”). Bazı testler önceden yüklenmiş test veri kümesinde Önkoşullar içerebilir. -Bazı senaryoda Clickhouse'un performansını artırmak istiyorsanız ve basit sorgularda iyileştirmeler gözlemlenebiliyorsa, bir performans testi yazmanız önerilir. Her zaman kullanmak mantıklı `perf top` testleriniz sırasında veya diğer perf araçları. +Bazı senaryoda Clickhouse’un performansını artırmak istiyorsanız ve basit sorgularda iyileştirmeler gözlemlenebiliyorsa, bir performans testi yazmanız önerilir. Her zaman kullanmak mantıklı `perf top` testleriniz sırasında veya diğer perf araçları. -## Test araçları ve komut dosyaları {#test-tools-and-scripts} +## Test araçları Ve Komut dosyaları {#test-tools-and-scripts} -Bazı programlar `tests` dizin testleri hazırlanmış değil, ancak test araçlarıdır. Örneğin, için `Lexer` bir araç var `src/Parsers/tests/lexer` bu sadece stdin'in tokenizasyonunu yapar ve renklendirilmiş sonucu stdout'a yazar. Bu tür araçları kod örnekleri olarak ve keşif ve manuel test için kullanabilirsiniz. +Bazı programlar `tests` dizin testleri hazırlanmış değil, ancak test araçlarıdır. Örneğin, için `Lexer` bir araç var `src/Parsers/tests/lexer` bu sadece stdin’in tokenizasyonunu yapar ve renklendirilmiş sonucu stdout’a yazar. Bu tür araçları kod örnekleri olarak ve keşif ve manuel test için kullanabilirsiniz. Ayrıca Çift Dosya yerleştirebilirsiniz `.sh` ve `.reference` aracı ile birlikte bazı önceden tanımlanmış giriş üzerinde çalıştırmak için-daha sonra komut sonucu karşılaştırılabilir `.reference` Dosya. Bu tür testler otomatik değildir. @@ -79,7 +79,7 @@ Clickhouse açık kaynaklı önce çekirdek testi ayrı ekip tarafından yazılm Yeni bir özellik geliştirdiğinizde, el ile de test etmek mantıklıdır. Bunu aşağıdaki adımlarla yapabilirsiniz: -ClickHouse Oluşturun. Terminalden Clickhouse'u çalıştırın: dizini değiştir `programs/clickhouse-server` ve ile çalıştırın `./clickhouse-server`. Bu yapılandırma kullanacak (`config.xml`, `users.xml` ve içindeki dosyalar `config.d` ve `users.d` dizinler) geçerli dizinden varsayılan olarak. ClickHouse sunucusuna bağlanmak için, çalıştırın `programs/clickhouse-client/clickhouse-client`. +ClickHouse Oluşturun. Terminalden Clickhouse’u çalıştırın: dizini değiştir `programs/clickhouse-server` ve ile çalıştırın `./clickhouse-server`. Bu yapılandırma kullanacak (`config.xml`, `users.xml` ve içindeki dosyalar `config.d` ve `users.d` dizinler) geçerli dizinden varsayılan olarak. ClickHouse sunucusuna bağlanmak için, çalıştırın `programs/clickhouse-client/clickhouse-client`. Tüm clickhouse araçlarının (sunucu, istemci, vb.) sadece tek bir ikili için symlinks olduğunu unutmayın `clickhouse`. Bu ikili bulabilirsiniz `programs/clickhouse`. Tüm araçlar olarak da çağrılabilir `clickhouse tool` yerine `clickhouse-tool`. @@ -118,7 +118,7 @@ Kararlı olarak yayınlamadan önce test ortamında dağıtın. Test ortamı, 1/ SELECT hostName() AS h, any(version()), any(uptime()), max(UTCEventTime), count() FROM remote('example01-01-{1..3}t', merge, hits) WHERE EventDate >= today() - 2 GROUP BY h ORDER BY h; ``` -Bazı durumlarda yandex'teki arkadaş ekiplerimizin test ortamına da dağıtım yapıyoruz: Pazar, Bulut, vb. Ayrıca geliştirme amacıyla kullanılan bazı donanım sunucularımız var. +Bazı durumlarda yandex’teki arkadaş ekiplerimizin test ortamına da dağıtım yapıyoruz: Pazar, Bulut, vb. Ayrıca geliştirme amacıyla kullanılan bazı donanım sunucularımız var. ## Yük Testi {#load-testing} @@ -132,7 +132,7 @@ Bir gün veya daha fazla sorgu günlüğü toplayın: $ clickhouse-client --query="SELECT DISTINCT query FROM system.query_log WHERE event_date = today() AND query LIKE '%ym:%' AND query NOT LIKE '%system.query_log%' AND type = 2 AND is_initial_query" > queries.tsv ``` -Bu şekilde karmaşık bir örnektir. `type = 2` başarıyla yürütülen sorguları süzer. `query LIKE '%ym:%'` yandex'ten ilgili sorguları seçmektir.Metrica. `is_initial_query` yalnızca istemci tarafından başlatılan sorguları seçmektir, Clickhouse'un kendisi tarafından değil (dağıtılmış sorgu işlemenin parçaları olarak). +Bu şekilde karmaşık bir örnektir. `type = 2` başarıyla yürütülen sorguları süzer. `query LIKE '%ym:%'` yandex’ten ilgili sorguları seçmektir.Metrica. `is_initial_query` yalnızca istemci tarafından başlatılan sorguları seçmektir, Clickhouse’un kendisi tarafından değil (dağıtılmış sorgu işlemenin parçaları olarak). `scp` bu test kümenize günlük ve aşağıdaki gibi çalıştırın: @@ -150,7 +150,7 @@ Kesin sorgu yürütme zamanlamaları kaydedilmez ve sorguların ve ortamın yük ## Yapı Testleri {#build-tests} -Yapı testleri, yapının çeşitli alternatif konfigürasyonlarda ve bazı yabancı sistemlerde bozulmadığını kontrol etmeyi sağlar. Testler bulunur `ci` dizin. Docker, Vagrant ve bazen de `qemu-user-static` Docker'ın içinde. Bu testler geliştirme aşamasındadır ve test çalıştırmaları otomatik değildir. +Yapı testleri, yapının çeşitli alternatif konfigürasyonlarda ve bazı yabancı sistemlerde bozulmadığını kontrol etmeyi sağlar. Testler bulunur `ci` dizin. Docker, Vagrant ve bazen de `qemu-user-static` Docker’ın içinde. Bu testler geliştirme aşamasındadır ve test çalıştırmaları otomatik değildir. Motivasyon: @@ -166,7 +166,7 @@ Normalde tüm testleri ClickHouse yapısının tek bir varyantında serbest bır Tüm yapı varyantlarında tüm testleri çalıştıramasak da, en azından çeşitli yapı varyantlarının bozulmadığını kontrol etmek istiyoruz. Bu amaçla yapı testlerini kullanıyoruz. -## Protokol uyumluluğu testi {#testing-for-protocol-compatibility} +## Protokol uyumluluğu Testi {#testing-for-protocol-compatibility} ClickHouse ağ protokolünü genişlettiğimizde, eski clickhouse istemcisinin yeni clickhouse sunucusu ile çalıştığını ve yeni clickhouse istemcisinin eski clickhouse sunucusu ile çalıştığını (sadece ilgili paketlerden ikili dosyaları çalıştırarak) manuel olarak test ediyoruz. @@ -176,7 +176,7 @@ Ana ClickHouse kodu (bu `dbms` dizin) ile inşa edilmiştir `-Wall -Wextra -Werr Clang daha yararlı uyarılar vardır-Sen ile onları arayabilirsiniz `-Weverything` ve varsayılan oluşturmak için bir şey seçin. -Üretim yapıları için gcc kullanılır (hala clang'dan biraz daha verimli kod üretir). Geliştirme için, clang genellikle kullanımı daha uygundur. Hata ayıklama modu ile kendi makinenizde inşa edebilirsiniz (dizüstü bilgisayarınızın pilinden tasarruf etmek için), ancak derleyicinin daha fazla uyarı üretebileceğini lütfen unutmayın `-O3` daha iyi kontrol akışı ve prosedürler arası analiz nedeniyle. Clang ile inşa ederken, `libc++` yerine kullanılır `libstdc++` ve hata ayıklama modu ile oluştururken, hata ayıklama sürümü `libc++` çalışma zamanında daha fazla hata yakalamak için izin verir kullanılır. +Üretim yapıları için gcc kullanılır (hala clang’dan biraz daha verimli kod üretir). Geliştirme için, clang genellikle kullanımı daha uygundur. Hata ayıklama modu ile kendi makinenizde inşa edebilirsiniz (dizüstü bilgisayarınızın pilinden tasarruf etmek için), ancak derleyicinin daha fazla uyarı üretebileceğini lütfen unutmayın `-O3` daha iyi kontrol akışı ve prosedürler arası analiz nedeniyle. Clang ile inşa ederken, `libc++` yerine kullanılır `libstdc++` ve hata ayıklama modu ile oluştururken, hata ayıklama sürümü `libc++` çalışma zamanında daha fazla hata yakalamak için izin verir kullanılır. ## Dezenfektanlar {#sanitizers} @@ -230,9 +230,9 @@ Alternatif olarak deneyebilirsiniz `uncrustify` kodunuzu yeniden biçimlendirmek `CLion` kod stilimiz için ayarlanması gereken kendi kod biçimlendiricisine sahiptir. -## Metrica B2B testleri {#metrica-b2b-tests} +## Metrica B2B Testleri {#metrica-b2b-tests} -Her ClickHouse sürümü Yandex Metrica ve AppMetrica motorları ile test edilir. Clickhouse'un Test ve kararlı sürümleri Vm'lerde dağıtılır ve Giriş verilerinin sabit örneğini işleyen Metrica motorunun küçük bir kopyasıyla çalışır. Daha sonra Metrica motorunun iki örneğinin sonuçları birlikte karşılaştırılır. +Her ClickHouse sürümü Yandex Metrica ve AppMetrica motorları ile test edilir. Clickhouse’un Test ve kararlı sürümleri Vm’lerde dağıtılır ve Giriş verilerinin sabit örneğini işleyen Metrica motorunun küçük bir kopyasıyla çalışır. Daha sonra Metrica motorunun iki örneğinin sonuçları birlikte karşılaştırılır. Bu testler ayrı ekip tarafından otomatikleştirilir. Yüksek sayıda hareketli parça nedeniyle, testler çoğu zaman tamamen ilgisiz nedenlerle başarısız olur, bu da anlaşılması çok zordur. Büyük olasılıkla bu testlerin bizim için negatif değeri var. Bununla birlikte, bu testlerin yüzlerce kişiden yaklaşık bir veya iki kez yararlı olduğu kanıtlanmıştır. @@ -244,9 +244,9 @@ Temmuz 2018 itibariyle test kapsamını takip etmiyoruz. Yandex dahili CI ve iş otomasyon sistemi ile testler yapıyoruz “Sandbox”. -Yapı işleri ve testler, taahhüt bazında sanal alanda çalıştırılır. Ortaya çıkan paketler ve test sonuçları Github'da yayınlanır ve doğrudan bağlantılar tarafından indirilebilir. Eserler sonsuza dek saklanır. Eğer GitHub bir çekme isteği gönderdiğinizde, biz olarak etiketlemek “can be tested” ve bizim CI sistemi sizin için ClickHouse paketleri (yayın, hata ayıklama, Adres dezenfektanı ile, vb) inşa edecek. +Yapı işleri ve testler, taahhüt bazında sanal alanda çalıştırılır. Ortaya çıkan paketler ve test sonuçları Github’da yayınlanır ve doğrudan bağlantılar tarafından indirilebilir. Eserler sonsuza dek saklanır. Eğer GitHub bir çekme isteği gönderdiğinizde, biz olarak etiketlemek “can be tested” ve bizim CI sistemi sizin için ClickHouse paketleri (yayın, hata ayıklama, Adres dezenfektanı ile, vb) inşa edecek. Travis CI, zaman ve hesaplama gücü sınırı nedeniyle kullanmıyoruz. -Jenkins'i kullanmayız. Daha önce kullanıldı ve şimdi Jenkins kullanmadığımız için mutluyuz. +Jenkins’i kullanmayız. Daha önce kullanıldı ve şimdi Jenkins kullanmadığımız için mutluyuz. [Orijinal makale](https://clickhouse.tech/docs/en/development/tests/) diff --git a/docs/tr/engines/database-engines/index.md b/docs/tr/engines/database-engines/index.md new file mode 100644 index 00000000000..f3fcd3e8d10 --- /dev/null +++ b/docs/tr/engines/database-engines/index.md @@ -0,0 +1,21 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "Veritaban\u0131 Motorlar\u0131" +toc_priority: 27 +toc_title: "Giri\u015F" +--- + +# Veritabanı Motorları {#database-engines} + +Veritabanı motorları, tablolarla çalışmanıza izin verir. + +Varsayılan olarak, ClickHouse yapılandırılabilir sağlayan yerel veritabanı altyapısını kullanır [masa motorları](../../engines/table-engines/index.md) ve bir [SQL lehçesi](../../sql-reference/syntax.md). + +Aşağıdaki veritabanı altyapılarını da kullanabilirsiniz: + +- [MySQL](mysql.md) + +- [Tembel](lazy.md) + +[Orijinal makale](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/tr/engines/database-engines/lazy.md b/docs/tr/engines/database-engines/lazy.md new file mode 100644 index 00000000000..8b2a4f716bd --- /dev/null +++ b/docs/tr/engines/database-engines/lazy.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 31 +toc_title: Tembel +--- + +# Tembel {#lazy} + +Tabloları yalnızca RAM’de tutar `expiration_time_in_seconds` son erişimden saniyeler sonra. Sadece \* Log tabloları ile kullanılabilir. + +Erişimler arasında uzun bir zaman aralığı olan birçok küçük \* günlük tablosunu saklamak için optimize edilmiştir. + +## Veritabanı oluşturma {#creating-a-database} + + CREATE DATABASE testlazy ENGINE = Lazy(expiration_time_in_seconds); + +[Orijinal makale](https://clickhouse.tech/docs/en/database_engines/lazy/) diff --git a/docs/tr/engines/database-engines/mysql.md b/docs/tr/engines/database-engines/mysql.md new file mode 100644 index 00000000000..f5e20528d67 --- /dev/null +++ b/docs/tr/engines/database-engines/mysql.md @@ -0,0 +1,135 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 30 +toc_title: MySQL +--- + +# MySQL {#mysql} + +Uzak bir MySQL sunucusunda veritabanlarına bağlanmak ve gerçekleştirmek için izin verir `INSERT` ve `SELECT` ClickHouse ve MySQL arasında veri alışverişi için sorgular. + +Bu `MySQL` veritabanı motoru sorguları MySQL sunucusuna çevirir, böylece aşağıdaki gibi işlemleri gerçekleştirebilirsiniz `SHOW TABLES` veya `SHOW CREATE TABLE`. + +Aşağıdaki sorguları gerçekleştiremiyor: + +- `RENAME` +- `CREATE TABLE` +- `ALTER` + +## Veritabanı oluşturma {#creating-a-database} + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] +ENGINE = MySQL('host:port', ['database' | database], 'user', 'password') +``` + +**Motor Parametreleri** + +- `host:port` — MySQL server address. +- `database` — Remote database name. +- `user` — MySQL user. +- `password` — User password. + +## Veri Türleri Desteği {#data_types-support} + +| MySQL | ClickHouse | +|----------------------------------|--------------------------------------------------------------| +| UNSIGNED TINYINT | [Uİnt8](../../sql-reference/data-types/int-uint.md) | +| TINYINT | [Int8](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED SMALLINT | [Uınt16](../../sql-reference/data-types/int-uint.md) | +| SMALLINT | [Int16](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED INT, UNSIGNED MEDIUMINT | [Uİnt32](../../sql-reference/data-types/int-uint.md) | +| INT, MEDIUMINT | [Int32](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED BIGINT | [Uİnt64](../../sql-reference/data-types/int-uint.md) | +| BIGINT | [Int64](../../sql-reference/data-types/int-uint.md) | +| FLOAT | [Float32](../../sql-reference/data-types/float.md) | +| DOUBLE | [Float64](../../sql-reference/data-types/float.md) | +| DATE | [Tarihli](../../sql-reference/data-types/date.md) | +| DATETIME, TIMESTAMP | [DateTime](../../sql-reference/data-types/datetime.md) | +| BINARY | [FixedString](../../sql-reference/data-types/fixedstring.md) | + +Diğer tüm MySQL veri türleri dönüştürülür [Dize](../../sql-reference/data-types/string.md). + +[Nullable](../../sql-reference/data-types/nullable.md) desteklenir. + +## Kullanım Örnekleri {#examples-of-use} + +MySQL tablo: + +``` text +mysql> USE test; +Database changed + +mysql> CREATE TABLE `mysql_table` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `float` FLOAT NOT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from mysql_table; ++------+-----+ +| int_id | value | ++------+-----+ +| 1 | 2 | ++------+-----+ +1 row in set (0,00 sec) +``` + +Clickhouse’daki veritabanı, MySQL sunucusu ile veri alışverişi: + +``` sql +CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') +``` + +``` sql +SHOW DATABASES +``` + +``` text +┌─name─────┐ +│ default │ +│ mysql_db │ +│ system │ +└──────────┘ +``` + +``` sql +SHOW TABLES FROM mysql_db +``` + +``` text +┌─name─────────┐ +│ mysql_table │ +└──────────────┘ +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +└────────┴───────┘ +``` + +``` sql +INSERT INTO mysql_db.mysql_table VALUES (3,4) +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +│ 3 │ 4 │ +└────────┴───────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/tr/engines/database_engines/index.md b/docs/tr/engines/database_engines/index.md deleted file mode 100644 index c0e0bea8ab5..00000000000 --- a/docs/tr/engines/database_engines/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "Veritaban\u0131 Motorlar\u0131" -toc_priority: 27 -toc_title: "Giri\u015F" ---- - -# Veritabanı Motorları {#database-engines} - -Veritabanı motorları, tablolarla çalışmanıza izin verir. - -Varsayılan olarak, ClickHouse yapılandırılabilir sağlayan yerel veritabanı altyapısını kullanır [masa motorları](../../engines/table_engines/index.md) ve bir [SQL lehçesi](../../sql_reference/syntax.md). - -Aşağıdaki veritabanı altyapılarını da kullanabilirsiniz: - -- [MySQL](mysql.md) - -- [Tembel](lazy.md) - -[Orijinal makale](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/tr/engines/database_engines/lazy.md b/docs/tr/engines/database_engines/lazy.md deleted file mode 100644 index 85436fdc164..00000000000 --- a/docs/tr/engines/database_engines/lazy.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 31 -toc_title: Tembel ---- - -# Tembel {#lazy} - -Tabloları yalnızca RAM'de tutar `expiration_time_in_seconds` son erişimden saniyeler sonra. Sadece \* Log tabloları ile kullanılabilir. - -Erişimler arasında uzun bir zaman aralığı olan birçok küçük \* günlük tablosunu saklamak için optimize edilmiştir. - -## Veritabanı oluşturma {#creating-a-database} - - CREATE DATABASE testlazy ENGINE = Lazy(expiration_time_in_seconds); - -[Orijinal makale](https://clickhouse.tech/docs/en/database_engines/lazy/) diff --git a/docs/tr/engines/database_engines/mysql.md b/docs/tr/engines/database_engines/mysql.md deleted file mode 100644 index 974515ab655..00000000000 --- a/docs/tr/engines/database_engines/mysql.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 30 -toc_title: MySQL ---- - -# MySQL {#mysql} - -Uzak bir MySQL sunucusunda veritabanlarına bağlanmak ve gerçekleştirmek için izin verir `INSERT` ve `SELECT` ClickHouse ve MySQL arasında veri alışverişi için sorgular. - -Bu `MySQL` veritabanı motoru sorguları MySQL sunucusuna çevirir, böylece aşağıdaki gibi işlemleri gerçekleştirebilirsiniz `SHOW TABLES` veya `SHOW CREATE TABLE`. - -Aşağıdaki sorguları gerçekleştiremiyor: - -- `RENAME` -- `CREATE TABLE` -- `ALTER` - -## Veritabanı oluşturma {#creating-a-database} - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] -ENGINE = MySQL('host:port', ['database' | database], 'user', 'password') -``` - -**Motor Parametreleri** - -- `host:port` — MySQL server address. -- `database` — Remote database name. -- `user` — MySQL user. -- `password` — User password. - -## Veri Türleri Desteği {#data_types-support} - -| MySQL | ClickHouse | -|----------------------------------|--------------------------------------------------------------| -| UNSIGNED TINYINT | [Uİnt8](../../sql_reference/data_types/int_uint.md) | -| TINYINT | [Int8](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED SMALLINT | [Uınt16](../../sql_reference/data_types/int_uint.md) | -| SMALLINT | [Int16](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED INT, UNSIGNED MEDIUMINT | [Uİnt32](../../sql_reference/data_types/int_uint.md) | -| INT, MEDIUMINT | [Int32](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED BIGINT | [Uİnt64](../../sql_reference/data_types/int_uint.md) | -| BIGINT | [Int64](../../sql_reference/data_types/int_uint.md) | -| FLOAT | [Float32](../../sql_reference/data_types/float.md) | -| DOUBLE | [Float64](../../sql_reference/data_types/float.md) | -| DATE | [Tarihli](../../sql_reference/data_types/date.md) | -| DATETIME, TIMESTAMP | [DateTime](../../sql_reference/data_types/datetime.md) | -| BINARY | [FixedString](../../sql_reference/data_types/fixedstring.md) | - -Diğer tüm MySQL veri türleri dönüştürülür [Dize](../../sql_reference/data_types/string.md). - -[Nullable](../../sql_reference/data_types/nullable.md) desteklenir. - -## Kullanım Örnekleri {#examples-of-use} - -MySQL tablo: - -``` text -mysql> USE test; -Database changed - -mysql> CREATE TABLE `mysql_table` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `float` FLOAT NOT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from mysql_table; -+------+-----+ -| int_id | value | -+------+-----+ -| 1 | 2 | -+------+-----+ -1 row in set (0,00 sec) -``` - -Clickhouse'daki veritabanı, MySQL sunucusu ile veri alışverişi: - -``` sql -CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') -``` - -``` sql -SHOW DATABASES -``` - -``` text -┌─name─────┐ -│ default │ -│ mysql_db │ -│ system │ -└──────────┘ -``` - -``` sql -SHOW TABLES FROM mysql_db -``` - -``` text -┌─name─────────┐ -│ mysql_table │ -└──────────────┘ -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -└────────┴───────┘ -``` - -``` sql -INSERT INTO mysql_db.mysql_table VALUES (3,4) -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -│ 3 │ 4 │ -└────────┴───────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/tr/engines/table-engines/index.md b/docs/tr/engines/table-engines/index.md new file mode 100644 index 00000000000..64ae0c91d79 --- /dev/null +++ b/docs/tr/engines/table-engines/index.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "Masa Motorlar\u0131" +toc_priority: 26 +toc_title: "Giri\u015F" +--- + +# Masa Motorları {#table_engines} + +Tablo motoru (tablo türü) belirler: + +- Verilerin nasıl ve nerede depolandığı, nereye yazılacağı ve nereden okunacağı. +- Hangi sorgular desteklenir ve nasıl. +- Eşzamanlı veri erişimi. +- Varsa indeks uselerin kullanımı. +- Çok iş parçacıklı istek yürütme mümkün olup olmadığı. +- Veri çoğaltma parametreleri. + +## Motor Aileleri {#engine-families} + +### MergeTree {#mergetree} + +Yüksek yük görevleri için en evrensel ve fonksiyonel masa motorları. Bu motorlar tarafından paylaşılan özellik, sonraki arka plan veri işleme ile hızlı veri ekleme ’ dir. `MergeTree` aile motorları destek veri çoğaltma (ile [Çoğaltıyordu\*](mergetree-family/replication.md) sürümleri), bölümleme ve diğer özellikler diğer motorlarda desteklenmez. + +Ailede motorlar: + +- [MergeTree](mergetree-family/mergetree.md) +- [ReplacingMergeTree](mergetree-family/replacingmergetree.md) +- [SummingMergeTree](mergetree-family/summingmergetree.md) +- [AggregatingMergeTree](mergetree-family/aggregatingmergetree.md) +- [CollapsingMergeTree](mergetree-family/collapsingmergetree.md) +- [VersionedCollapsingMergeTree](mergetree-family/versionedcollapsingmergetree.md) +- [Graphıtemergetree](mergetree-family/graphitemergetree.md) + +### Günlük {#log} + +Hafiflik [motorlar](log-family/index.md) minimum işlevsellik ile. Birçok küçük tabloyu (yaklaşık 1 milyon satıra kadar) hızlı bir şekilde yazmanız ve daha sonra bir bütün olarak okumanız gerektiğinde en etkili olanlardır. + +Ailede motorlar: + +- [TinyLog](log-family/tinylog.md) +- [StripeLog](log-family/stripelog.md) +- [Günlük](log-family/log.md) + +### Entegrasyon Motorları {#integration-engines} + +Diğer veri depolama ve işleme sistemleri ile iletişim kurmak için motorlar. + +Ailede motorlar: + +- [Kafka](integrations/kafka.md) +- [MySQL](integrations/mysql.md) +- [ODBC](integrations/odbc.md) +- [JDBC](integrations/jdbc.md) +- [HDFS](integrations/hdfs.md) + +### Özel Motorlar {#special-engines} + +Ailede motorlar: + +- [Dağılı](special/distributed.md) +- [MaterializedView](special/materializedview.md) +- [Sözlük](special/dictionary.md) +- [Birleştirmek](special/merge.md) +- [Dosya](special/file.md) +- [Boş](special/null.md) +- [Koymak](special/set.md) +- [Katmak](special/join.md) +- [URL](special/url.md) +- [Görünüm](special/view.md) +- [Bellek](special/memory.md) +- [Arabellek](special/buffer.md) + +## Sanal Sütunlar {#table_engines-virtual-columns} + +Sanal sütun, motor kaynak kodunda tanımlanan ayrılmaz bir tablo altyapısı özniteliğidir. + +Sanal sütunları belirtmemelisiniz `CREATE TABLE` sorgula ve onları göremezsin `SHOW CREATE TABLE` ve `DESCRIBE TABLE` sorgu sonuçları. Sanal sütunlar da salt okunur, bu nedenle sanal sütunlara veri ekleyemezsiniz. + +Sanal bir sütundan veri seçmek için, adını `SELECT` sorgu. `SELECT *` sanal sütunlardan değerler döndürmez. + +Tablo sanal sütunlarından biriyle aynı ada sahip bir sütuna sahip bir tablo oluşturursanız, sanal sütuna erişilemez hale gelir. Bunu yapmayı önermiyoruz. Çakışmaları önlemek için, sanal sütun adları genellikle bir alt çizgi ile öneki. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/tr/engines/table-engines/integrations/hdfs.md b/docs/tr/engines/table-engines/integrations/hdfs.md new file mode 100644 index 00000000000..1ae14e575c9 --- /dev/null +++ b/docs/tr/engines/table-engines/integrations/hdfs.md @@ -0,0 +1,123 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 36 +toc_title: HDFS +--- + +# HDFS {#table_engines-hdfs} + +Bu motor ile entegrasyon sağlar [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) üzerinde veri Yönet allowingilmesine izin vererek ekosist dataem [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)ClickHouse aracılığıyla. Bu motor benzer +to the [Dosya](../special/file.md) ve [URL](../special/url.md) motorlar, ancak hadoop özgü özellikleri sağlar. + +## Kullanma {#usage} + +``` sql +ENGINE = HDFS(URI, format) +``` + +Bu `URI` parametre, HDFS’DEKİ tüm dosya URI’SIDIR. +Bu `format` parametre kullanılabilir dosya biçimlerinden birini belirtir. Gerçekleştirmek +`SELECT` sorgular, biçim giriş için desteklenmeli ve gerçekleştirmek için +`INSERT` queries – for output. The available formats are listed in the +[Biçimliler](../../../interfaces/formats.md#formats) bölme. +Yol kısmı `URI` globs içerebilir. Bu durumda tablo salt okunur olurdu. + +**Örnek:** + +**1.** Set up the `hdfs_engine_table` Tablo: + +``` sql +CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') +``` + +**2.** Fil filel file: + +``` sql +INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) +``` + +**3.** Verileri sorgula: + +``` sql +SELECT * FROM hdfs_engine_table LIMIT 2 +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Uygulama Detayları {#implementation-details} + +- Okuma ve yazma paralel olabilir +- Desteklenmiyor: + - `ALTER` ve `SELECT...SAMPLE` harekat. + - Dizinler. + - Çoğalma. + +**Yolda Globs** + +Birden çok yol bileşenleri globs olabilir. İşlenmek için dosya var olmalı ve tüm yol deseniyle eşleşmelidir. Sırasında dosyaların listelen ofmesini belirler `SELECT` (not at `CREATE` an). + +- `*` — Substitutes any number of any characters except `/` boş dize dahil. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +İle yapılar `{}` benzer olan [uzak](../../../sql-reference/table-functions/remote.md) tablo işlevi. + +**Örnek** + +1. HDFS’DE aşağıdaki Urı’lerle TSV formatında birkaç dosyamız olduğunu varsayalım: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. Altı dosyadan oluşan bir tablo oluşturmanın birkaç yolu vardır: + + + +``` sql +CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') +``` + +Başka bir yol: + +``` sql +CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') +``` + +Tablo, her iki dizindeki tüm dosyalardan oluşur (tüm dosyalar, sorguda açıklanan biçimi ve şemayı karşılamalıdır): + +``` sql +CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') +``` + +!!! warning "Uyarıcı" + Dosyaların listelenmesi, önde gelen sıfırlarla sayı aralıkları içeriyorsa, her basamak için parantez içeren yapıyı ayrı ayrı kullanın veya kullanın `?`. + +**Örnek** + +Adlı dosyaları içeren tablo oluşturma `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') +``` + +## Sanal Sütunlar {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Ayrıca Bakınız** + +- [Sanal sütunlar](../index.md#table_engines-virtual_columns) + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/tr/engines/table_engines/integrations/index.md b/docs/tr/engines/table-engines/integrations/index.md similarity index 100% rename from docs/tr/engines/table_engines/integrations/index.md rename to docs/tr/engines/table-engines/integrations/index.md diff --git a/docs/tr/engines/table-engines/integrations/jdbc.md b/docs/tr/engines/table-engines/integrations/jdbc.md new file mode 100644 index 00000000000..acc7660e24f --- /dev/null +++ b/docs/tr/engines/table-engines/integrations/jdbc.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 34 +toc_title: JDBC +--- + +# JDBC {#table-engine-jdbc} + +ClickHouse üzerinden harici veritabanlarına bağlanmak için izin verir [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). + +JDBC bağlantısını uygulamak için ClickHouse ayrı programı kullanır [clickhouse-JDBC-köprü](https://github.com/alex-krash/clickhouse-jdbc-bridge) bu bir daemon olarak çalışmalıdır. + +Bu motor destekler [Nullable](../../../sql-reference/data-types/nullable.md) veri türü. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name +( + columns list... +) +ENGINE = JDBC(dbms_uri, external_database, external_table) +``` + +**Motor Parametreleri** + +- `dbms_uri` — URI of an external DBMS. + + Biçimli: `jdbc:://:/?user=&password=`. + MySQL örneği: `jdbc:mysql://localhost:3306/?user=root&password=root`. + +- `external_database` — Database in an external DBMS. + +- `external_table` — Name of the table in `external_database`. + +## Kullanım Örneği {#usage-example} + +Doğrudan konsol istemcisine bağlanarak MySQL sunucusunda bir tablo oluşturma: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ClickHouse Server’da bir tablo oluşturma ve ondan veri seçme: + +``` sql +CREATE TABLE jdbc_table +( + `int_id` Int32, + `int_nullable` Nullable(Int32), + `float` Float32, + `float_nullable` Nullable(Float32) +) +ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') +``` + +``` sql +SELECT * +FROM jdbc_table +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Ayrıca Bakınız {#see-also} + +- [JDBC tablo işlevi](../../../sql-reference/table-functions/jdbc.md). + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/tr/engines/table-engines/integrations/kafka.md b/docs/tr/engines/table-engines/integrations/kafka.md new file mode 100644 index 00000000000..7845c1609b0 --- /dev/null +++ b/docs/tr/engines/table-engines/integrations/kafka.md @@ -0,0 +1,176 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 32 +toc_title: Kafka +--- + +# Kafka {#kafka} + +Bu motor ile çalışır [Apache Kafka](http://kafka.apache.org/). + +Kafka sağlar: + +- Veri akışlarını yayınlayın veya abone olun. +- Hataya dayanıklı depolama düzenlemek. +- Kullanılabilir hale geldikçe akışları işleyin. + +## Tablo oluşturma {#table_engine-kafka-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = Kafka() +SETTINGS + kafka_broker_list = 'host:port', + kafka_topic_list = 'topic1,topic2,...', + kafka_group_name = 'group_name', + kafka_format = 'data_format'[,] + [kafka_row_delimiter = 'delimiter_symbol',] + [kafka_schema = '',] + [kafka_num_consumers = N,] + [kafka_skip_broken_messages = N] +``` + +Gerekli parametreler: + +- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). +- `kafka_topic_list` – A list of Kafka topics. +- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don’t want messages to be duplicated in the cluster, use the same group name everywhere. +- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` fonksiyon gibi `JSONEachRow`. Daha fazla bilgi için, bkz: [Biçimliler](../../../interfaces/formats.md) bölme. + +İsteğe bağlı parametreler: + +- `kafka_row_delimiter` – Delimiter character, which ends the message. +- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap’n Proto](https://capnproto.org/) şema dosyasının yolunu ve kök adını gerektirir `schema.capnp:Message` nesne. +- `kafka_num_consumers` – The number of consumers per table. Default: `1`. Bir tüketicinin verimi yetersizse daha fazla tüketici belirtin. Bölüm başına yalnızca bir tüketici atanabileceğinden, toplam tüketici sayısı konudaki bölüm sayısını geçmemelidir. +- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. Eğer `kafka_skip_broken_messages = N` sonra motor atlar *N* Ayrıştırılamayan Kafka iletileri (bir ileti bir veri satırına eşittir). + +Örnekler: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + SELECT * FROM queue LIMIT 5; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', + kafka_topic_list = 'topic', + kafka_group_name = 'group1', + kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') + SETTINGS kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; +``` + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın. Mümkünse, eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format + [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) +``` + +
+ +## Açıklama {#description} + +Teslim edilen mesajlar otomatik olarak izlenir, bu nedenle bir gruptaki her mesaj yalnızca bir kez sayılır. Verileri iki kez almak istiyorsanız, tablonun başka bir grup adıyla bir kopyasını oluşturun. + +Gruplar esnek ve kümede senkronize edilir. Örneğin, bir kümede 10 konu ve bir tablonun 5 kopyası varsa, her kopya 2 konu alır. Kopya sayısı değişirse, konular kopyalar arasında otomatik olarak yeniden dağıtılır. Bu konuda daha fazla bilgi edinin http://kafka.apache.org/intro. + +`SELECT` mesajları okumak için özellikle yararlı değildir (hata ayıklama hariç), çünkü her mesaj yalnızca bir kez okunabilir. Hayata görünümler kullanarak gerçek zamanlı iş parçacıkları oluşturmak daha pratiktir. Bunu yapmak için : + +1. Bir Kafka tüketici oluşturmak için motoru kullanın ve bir veri akışı düşünün. +2. İstenen yapıya sahip bir tablo oluşturun. +3. Verileri motordan dönüştüren ve daha önce oluşturulmuş bir tabloya koyan materyalleştirilmiş bir görünüm oluşturun. + +Ne zaman `MATERIALIZED VIEW` motora katılır, arka planda veri toplamaya başlar. Bu, kafka’dan sürekli olarak mesaj almanızı ve bunları kullanarak gerekli biçime dönüştürmenizi sağlar `SELECT`. +Bir kafka tablosu istediğiniz kadar materialized görüşe sahip olabilir, kafka tablosundan doğrudan veri okumazlar, ancak yeni kayıtlar (bloklar halinde) alırlar, bu şekilde farklı ayrıntı seviyesine sahip birkaç tabloya yazabilirsiniz (gruplama-toplama ve olmadan). + +Örnek: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + CREATE TABLE daily ( + day Date, + level String, + total UInt64 + ) ENGINE = SummingMergeTree(day, (day, level), 8192); + + CREATE MATERIALIZED VIEW consumer TO daily + AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total + FROM queue GROUP BY day, level; + + SELECT level, sum(total) FROM daily GROUP BY level; +``` + +Performansı artırmak için, alınan iletiler bloklar halinde gruplandırılır [max\_ınsert\_block\_size](../../../operations/server-configuration-parameters/settings.md#settings-max_insert_block_size). İçinde blok oluş ifma ifdıysa [stream\_flush\_interval\_ms](../../../operations/server-configuration-parameters/settings.md) milisaniye, veri blok bütünlüğü ne olursa olsun tabloya temizlendi. + +Konu verilerini almayı durdurmak veya dönüşüm mantığını değiştirmek için, hayata geçirilmiş görünümü ayırın: + +``` sql + DETACH TABLE consumer; + ATTACH TABLE consumer; +``` + +Kullanarak hedef tabloyu değiştirmek istiyorsanız `ALTER` hedef tablo ile görünümdeki veriler arasındaki tutarsızlıkları önlemek için malzeme görünümünü devre dışı bırakmanızı öneririz. + +## Yapılandırma {#configuration} + +GraphiteMergeTree benzer şekilde, Kafka motoru ClickHouse yapılandırma dosyasını kullanarak genişletilmiş yapılandırmayı destekler. Kullanabileceğiniz iki yapılandırma anahtarı vardır: global (`kafka`) ve konu düzeyinde (`kafka_*`). Genel yapılandırma önce uygulanır ve sonra konu düzeyinde yapılandırma uygulanır (varsa). + +``` xml + + + cgrp + smallest + + + + + 250 + 100000 + +``` + +Olası yapılandırma seçeneklerinin listesi için bkz. [librdkafka yapılandırma referansı](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Alt çizgiyi kullan (`_`) ClickHouse yapılandırmasında bir nokta yerine. Mesela, `check.crcs=true` olacak `true`. + +## Sanal Sütunlar {#virtual-columns} + +- `_topic` — Kafka topic. +- `_key` — Key of the message. +- `_offset` — Offset of the message. +- `_timestamp` — Timestamp of the message. +- `_partition` — Partition of Kafka topic. + +**Ayrıca Bakınız** + +- [Sanal sütunlar](../index.md#table_engines-virtual_columns) + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/tr/engines/table-engines/integrations/mysql.md b/docs/tr/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..27b6ee1029f --- /dev/null +++ b/docs/tr/engines/table-engines/integrations/mysql.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 33 +toc_title: MySQL +--- + +# Mysql {#mysql} + +MySQL motoru gerçekleştirmek için izin verir `SELECT` uzak bir MySQL sunucusunda depolanan veriler üzerinde sorgular. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... +) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +Ayrıntılı bir açıklamasını görmek [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) sorgu. + +Tablo yapısı orijinal MySQL tablo yapısından farklı olabilir: + +- Sütun adları orijinal MySQL tablosundaki ile aynı olmalıdır, ancak bu sütunların sadece bazılarını ve herhangi bir sırada kullanabilirsiniz. +- Sütun türleri orijinal MySQL tablosundakilerden farklı olabilir. ClickHouse çalışır [döküm](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) ClickHouse veri türleri için değerler. + +**Motor Parametreleri** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` için sorgular `REPLACE INTO`. Eğer `replace_query=1`, sorgu değiştirilir. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` eklenen ifade `INSERT` sorgu. + + Örnek: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, nere `on_duplicate_clause` oluyor `UPDATE c2 = c2 + 1`. Görmek [MySQL dökü documentationmanları](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) bulmak için hangi `on_duplicate_clause` ile kullanabilirsiniz `ON DUPLICATE KEY` yan. + + Belirtmek `on_duplicate_clause` sen geçmek gerekir `0` to the `replace_query` parametre. Aynı anda geçerseniz `replace_query = 1` ve `on_duplicate_clause`, ClickHouse bir özel durum oluşturur. + +Basit `WHERE` gibi maddeler `=, !=, >, >=, <, <=` MySQL sunucusunda yürütülür. + +Geri kalan şartlar ve `LIMIT` örnekleme kısıtlaması, yalnızca MySQL sorgusu bittikten sonra Clickhouse’da yürütülür. + +## Kullanım Örneği {#usage-example} + +MySQL tablo: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Clickhouse’daki tablo, yukarıda oluşturulan MySQL tablosundan veri alma: + +``` sql +CREATE TABLE mysql_table +( + `float_nullable` Nullable(Float32), + `int_id` Int32 +) +ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` sql +SELECT * FROM mysql_table +``` + +``` text +┌─float_nullable─┬─int_id─┐ +│ ᴺᵁᴸᴸ │ 1 │ +└────────────────┴────────┘ +``` + +## Ayrıca Bakınız {#see-also} + +- [Bu ‘mysql’ tablo fonksiyonu](../../../sql-reference/table-functions/mysql.md) +- [Harici sözlük kaynağı olarak MySQL kullanma](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/tr/engines/table-engines/integrations/odbc.md b/docs/tr/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..5b56b90a1e4 --- /dev/null +++ b/docs/tr/engines/table-engines/integrations/odbc.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 35 +toc_title: ODBC +--- + +# ODBC {#table-engine-odbc} + +ClickHouse üzerinden harici veritabanlarına bağlanmak için izin verir [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +ODBC bağlantılarını güvenli bir şekilde uygulamak için ClickHouse ayrı bir program kullanır `clickhouse-odbc-bridge`. ODBC sürücüsü doğrudan yüklenmişse `clickhouse-server`, sürücü sorunları ClickHouse sunucu çökmesine neden olabilir. ClickHouse otomatik olarak başlar `clickhouse-odbc-bridge` gerekli olduğunda. ODBC Köprüsü programı aynı paketten yüklenir `clickhouse-server`. + +Bu motor destekler [Nullable](../../../sql-reference/data-types/nullable.md) veri türü. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +Ayrıntılı bir açıklamasını görmek [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) sorgu. + +Tablo yapısı kaynak tablo yapısından farklı olabilir: + +- Sütun adları kaynak tablodaki ile aynı olmalıdır, ancak yalnızca bu sütunlardan bazılarını ve herhangi bir sırada kullanabilirsiniz. +- Sütun türleri kaynak tablodakilerden farklı olabilir. ClickHouse çalışır [döküm](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) ClickHouse veri türleri için değerler. + +**Motor Parametreleri** + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` Dosya. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +## Kullanım Örneği {#usage-example} + +**ODBC üzerinden yerel MySQL kurulumundan veri alma** + +Bu örnek Ubuntu Linux 18.04 ve MySQL server 5.7 için kontrol edilir. + +UnixODBC ve MySQL Connector yüklü olduğundan emin olun. + +Varsayılan olarak (paketlerden yüklüyse), ClickHouse kullanıcı olarak başlar `clickhouse`. Bu nedenle, bu kullanıcıyı MySQL sunucusunda oluşturmanız ve yapılandırmanız gerekir. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +Sonra bağlantıyı yapılandırın `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Kullanarak bağlantıyı kontrol edebilirsiniz `isql` unixodbc yüklemesinden yardımcı program. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +MySQL tablo: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Clickhouse’daki tablo, MySQL tablosundan veri alma: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## Ayrıca Bakınız {#see-also} + +- [ODBC harici sözlükler](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [ODBC tablo işlevi](../../../sql-reference/table-functions/odbc.md) + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/tr/engines/table_engines/log_family/index.md b/docs/tr/engines/table-engines/log-family/index.md similarity index 100% rename from docs/tr/engines/table_engines/log_family/index.md rename to docs/tr/engines/table-engines/log-family/index.md diff --git a/docs/tr/engines/table-engines/log-family/log-family.md b/docs/tr/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..664a7e4ab22 --- /dev/null +++ b/docs/tr/engines/table-engines/log-family/log-family.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 31 +toc_title: "Giri\u015F" +--- + +# Log Engine Ailesi {#log-engine-family} + +Bu motorlar, birçok küçük tabloyu (yaklaşık 1 milyon satıra kadar) hızlı bir şekilde yazmanız ve daha sonra bir bütün olarak okumanız gerektiğinde senaryolar için geliştirilmiştir. + +Ailenin motorları: + +- [StripeLog](stripelog.md) +- [Günlük](log.md) +- [TinyLog](tinylog.md) + +## Ortak Özellikler {#common-properties} + +Motorlar: + +- Verileri bir diskte saklayın. + +- Yazarken dosyanın sonuna veri ekleyin. + +- Eşzamanlı veri erişimi için destek kilitleri. + + Sırasında `INSERT` sorgular, tablo kilitlenir ve veri okumak ve yazmak için diğer sorgular hem tablonun kilidini açmak için bekler. Veri yazma sorguları varsa, herhangi bir sayıda veri okuma sorguları aynı anda gerçekleştirilebilir. + +- Destek yok [mutasyon](../../../sql-reference/statements/alter.md#alter-mutations) harekat. + +- Dizinleri desteklemez. + + Bu demektir ki `SELECT` veri aralıkları için sorgular verimli değildir. + +- Atomik veri yazmayın. + + Bir şey yazma işlemini bozarsa, örneğin anormal sunucu kapatma gibi bozuk verilerle bir tablo alabilirsiniz. + +## Farklılıklar {#differences} + +Bu `TinyLog` motor, ailenin en basitidir ve en fakir işlevselliği ve en düşük verimliliği sağlar. Bu `TinyLog` motor, birkaç iş parçacığı tarafından paralel veri okumayı desteklemez. Paralel okumayı destekleyen ailedeki diğer motorlardan daha yavaş veri okur ve neredeyse birçok tanımlayıcı kullanır `Log` motor, her sütunu ayrı bir dosyada sakladığı için. Basit düşük yük senaryolarında kullanın. + +Bu `Log` ve `StripeLog` motorlar paralel veri okumayı destekler. Veri okurken, ClickHouse birden çok iş parçacığı kullanır. Her iş parçacığı ayrı bir veri bloğu işler. Bu `Log` engine, tablonun her sütunu için ayrı bir dosya kullanır. `StripeLog` tüm verileri tek bir dosyada saklar. Sonuç olarak, `StripeLog` motor işletim sisteminde daha az tanımlayıcı kullanır, ancak `Log` motor veri okurken daha yüksek verimlilik sağlar. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/tr/engines/table-engines/log-family/log.md b/docs/tr/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..6c23df468d6 --- /dev/null +++ b/docs/tr/engines/table-engines/log-family/log.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 33 +toc_title: "G\xFCnl\xFCk" +--- + +# Günlük {#log} + +Motor günlük motorları ailesine aittir. Günlük motorlarının ortak özelliklerini ve farklılıklarını görün [Log Engine Ailesi](log-family.md) makale. + +Log differsar differsit fromma [TinyLog](tinylog.md) bu küçük bir dosyada “marks” sütun dosyaları ile bulunur. Bu işaretler her veri bloğuna yazılır ve belirtilen satır sayısını atlamak için dosyayı okumaya nereden başlayacağınızı gösteren uzaklıklar içerir. Bu, tablo verilerini birden çok iş parçacığında okumayı mümkün kılar. +Eşzamanlı veri erişimi için, okuma işlemleri aynı anda gerçekleştirilebilirken, yazma işlemleri okur ve birbirlerini engeller. +Günlük altyapısı dizinleri desteklemez. Benzer şekilde, bir tabloya yazma başarısız olursa, tablo bozulur ve Okuma bir hata döndürür. Günlük altyapısı, geçici veriler, bir kez yazma tabloları ve sınama veya gösteri amaçları için uygundur. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/tr/engines/table-engines/log-family/stripelog.md b/docs/tr/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..518c057e0b2 --- /dev/null +++ b/docs/tr/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,95 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 32 +toc_title: StripeLog +--- + +# Stripelog {#stripelog} + +Bu motor günlük motor ailesine aittir. Günlük motorlarının ortak özelliklerini ve farklılıklarını görün [Log Engine Ailesi](log-family.md) makale. + +Az miktarda veri içeren (1 milyondan az satır) birçok tablo yazmanız gerektiğinde, bu altyapıyı senaryolarda kullanın. + +## Tablo oluşturma {#table_engines-stripelog-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = StripeLog +``` + +Ayrıntılı açıklamasına bakın [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) sorgu. + +## Veri Yazma {#table_engines-stripelog-writing-the-data} + +Bu `StripeLog` motor tüm sütunları tek bir dosyada saklar. Her biri için `INSERT` sorgu, ClickHouse veri bloğunu bir tablo dosyasının sonuna ekler, sütunları tek tek yazar. + +Her tablo için ClickHouse dosyaları yazar: + +- `data.bin` — Data file. +- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. + +Bu `StripeLog` motor desteklemiyor `ALTER UPDATE` ve `ALTER DELETE` harekat. + +## Verileri Okuma {#table_engines-stripelog-reading-the-data} + +İşaretli dosya, Clickhouse’un verilerin okunmasını paralelleştirmesine izin verir. Bu demektir `SELECT` sorgu satırları öngörülemeyen bir sırayla döndürür. Kullan… `ORDER BY` satırları sıralamak için yan tümce. + +## Kullanım Örneği {#table_engines-stripelog-example-of-use} + +Tablo oluşturma: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +Veri ekleme: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +İki kullandık `INSERT` içinde iki veri bloğu oluşturmak için sorgular `data.bin` Dosya. + +ClickHouse veri seçerken birden çok iş parçacığı kullanır. Her iş parçacığı ayrı bir veri bloğu okur ve sonuç olarak satırları bağımsız olarak döndürür. Sonuç olarak, çıktıdaki satır bloklarının sırası, çoğu durumda girişteki aynı blokların sırasına uymuyor. Mesela: + +``` sql +SELECT * FROM stripe_log_table +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +┌───────────timestamp─┬─message_type─┬─message───────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +└─────────────────────┴──────────────┴───────────────────────────┘ +``` + +Sonuçları sıralama (varsayılan olarak artan sipariş): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + +``` text +┌───────────timestamp─┬─message_type─┬─message────────────────────┐ +│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ +│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ +│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ +└─────────────────────┴──────────────┴────────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/tr/engines/table-engines/log-family/tinylog.md b/docs/tr/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..ea6032abbac --- /dev/null +++ b/docs/tr/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,16 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 34 +toc_title: TinyLog +--- + +# TinyLog {#tinylog} + +Motor log engine ailesine aittir. Görmek [Log Engine Ailesi](log-family.md) günlük motorlarının ortak özellikleri ve farklılıkları için. + +Bu tablo motoru genellikle write-once yöntemi ile kullanılır: verileri bir kez yazın, ardından gerektiği kadar okuyun. Örneğin, kullanabilirsiniz `TinyLog`- küçük gruplar halinde işlenen Ara veriler için tablolar yazın. Çok sayıda küçük tabloda veri depolamanın verimsiz olduğunu unutmayın. + +Sorgular tek bir akışta yürütülür. Başka bir deyişle, bu motor nispeten küçük tablolar için tasarlanmıştır (yaklaşık 1.000.000 satıra kadar). Çok sayıda küçük tablonuz varsa, bu tablo motorunu kullanmak mantıklıdır, çünkü [Günlük](log.md) motor (daha az dosya açılması gerekir). + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/tr/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/tr/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..f824a7226fe --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,102 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 35 +toc_title: AggregatingMergeTree +--- + +# Aggregatingmergetree {#aggregatingmergetree} + +Motor devralır [MergeTree](mergetree.md#table_engines-mergetree), veri parçaları birleştirme mantığı değiştirme. ClickHouse, tüm satırları aynı birincil anahtarla değiştirir (veya daha doğru olarak, aynı [sıralama anahtarı](mergetree.md)) tek bir satırla (bir veri parçası içinde), toplama işlevlerinin durumlarının bir kombinasyonunu saklar. + +Kullanabilirsiniz `AggregatingMergeTree` artımlı veri toplama, toplanan materialized görünümleri de dahil olmak üzere tablolar. + +Motor tüm sütunları ile işler [AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md) tür. + +Kullanmak uygundur `AggregatingMergeTree` siparişlere göre satır sayısını azaltırsa. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[TTL expr] +[SETTINGS name=value, ...] +``` + +İstek parametrelerinin açıklaması için bkz. [istek açıklaması](../../../sql-reference/statements/create.md). + +**Sorgu yan tümceleri** + +Oluştururken bir `AggregatingMergeTree` tablo aynı [yanlar](mergetree.md) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +Tüm parametreler, aşağıdaki gibi aynı anlama sahiptir `MergeTree`. +
+ +## Seç Ve Ekle {#select-and-insert} + +Veri eklemek için şunları kullanın [INSERT SELECT](../../../sql-reference/statements/insert-into.md) agrega-Devlet-fonksiyonları ile sorgu. +Veri seçerken `AggregatingMergeTree` tablo kullanın `GROUP BY` yan tümce ve veri eklerken aynı toplama işlevleri, ancak kullanarak `-Merge` sonek. + +Sonuç inlarında `SELECT` sorgu, değerleri `AggregateFunction` türü, Tüm ClickHouse çıktı biçimleri için uygulamaya özgü ikili gösterime sahiptir. Örneğin, veri dökümü, `TabSeparated` ile format `SELECT` sorgu daha sonra bu dökümü kullanarak geri yüklenebilir `INSERT` sorgu. + +## Toplu Bir Somutlaştırılmış Görünüm örneği {#example-of-an-aggregated-materialized-view} + +`AggregatingMergeTree` saatler hayata görünüm `test.visits` Tablo: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +Veri ekleme `test.visits` Tablo. + +``` sql +INSERT INTO test.visits ... +``` + +Veriler hem tablo hem de görünümde eklenir `test.basic` toplama işlemini gerçekleştir .ecektir. + +Toplanan verileri almak için, aşağıdaki gibi bir sorgu yürütmemiz gerekir `SELECT ... GROUP BY ...` görünüm fromden `test.basic`: + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/tr/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/tr/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..75e643d1f89 --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,309 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 36 +toc_title: CollapsingMergeTree +--- + +# CollapsingMergeTree {#table_engine-collapsingmergetree} + +Motor devralır [MergeTree](mergetree.md) ve veri parçaları birleştirme algoritmasına çöken satırların mantığını ekler. + +`CollapsingMergeTree` sıralama anahtarındaki tüm alanlar zaman uyumsuz olarak siler (daraltır) satır çiftleri (`ORDER BY`) belirli alan hariç eşdeğerdir `Sign` hangi olabilir `1` ve `-1` değerler. Çift olmayan satırlar tutulur. Daha fazla bilgi için bkz: [Çökme](#table_engine-collapsingmergetree-collapsing) belgenin bölümü. + +Motor depolama hacmini önemli ölçüde azaltabilir ve `SELECT` sonuç olarak sorgu. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Sorgu parametrelerinin açıklaması için bkz. [sorgu açıklaması](../../../sql-reference/statements/create.md). + +**CollapsingMergeTree Parametreleri** + +- `sign` — Name of the column with the type of row: `1` is a “state” satır, `-1` is a “cancel” satır. + + Column data type — `Int8`. + +**Sorgu yan tümceleri** + +Oluştururken bir `CollapsingMergeTree` tablo, aynı [sorgu yan tümceleri](mergetree.md#table_engine-mergetree-creating-a-table) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +Hariç tüm parametreler `sign` içinde olduğu gibi aynı anlama sahip `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` — “state” satır, `-1` — “cancel” satır. + + Column Data Type — `Int8`. + +
+ +## Çökme {#table_engine-collapsingmergetree-collapsing} + +### Veriler {#data} + +Bazı nesneler için sürekli değişen verileri kaydetmeniz gereken durumu düşünün. Bir nesne için bir satıra sahip olmak ve herhangi bir değişiklikte güncellemek mantıklı geliyor, ancak güncelleme işlemi dbms için pahalı ve yavaş çünkü depolama alanındaki verilerin yeniden yazılmasını gerektiriyor. Verileri hızlı bir şekilde yazmanız gerekiyorsa, güncelleme kabul edilemez, ancak bir nesnenin değişikliklerini sırayla aşağıdaki gibi yazabilirsiniz. + +Belirli sütunu kullanın `Sign`. Eğer `Sign = 1` bu, satırın bir nesnenin durumu olduğu anlamına gelir, diyelim ki “state” satır. Eğer `Sign = -1` aynı özelliklere sahip bir nesnenin durumunun iptali anlamına gelir, diyelim ki “cancel” satır. + +Örneğin, kullanıcıların bazı sitelerde ne kadar sayfa kontrol ettiğini ve ne kadar süre orada olduklarını hesaplamak istiyoruz. Bir anda kullanıcı etkinliği durumu ile aşağıdaki satırı yazıyoruz: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Bir an sonra kullanıcı aktivitesinin değişikliğini kaydedip aşağıdaki iki satırla yazıyoruz. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +İlk satır, nesnenin (kullanıcı) önceki durumunu iptal eder. İptal edilen durumun sıralama anahtar alanlarını kopyalamalıdır `Sign`. + +İkinci satır geçerli durumu içerir. + +Sadece kullanıcı etkinliğinin son durumuna ihtiyacımız olduğu için, satırlar + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +bir nesnenin geçersiz (eski) durumunu daraltarak silinebilir. `CollapsingMergeTree` veri parçalarının birleştirilmesi sırasında bunu yapar. + +Neden her değişiklik için 2 satıra ihtiyacımız var [Algoritma](#table_engine-collapsingmergetree-collapsing-algorithm) paragraf. + +**Bu yaklaşımın kendine özgü özellikleri** + +1. Verileri yazan program, iptal edebilmek için bir nesnenin durumunu hatırlamalıdır. “Cancel” dize, sıralama anahtar alanlarının kopyalarını içermelidir. “state” dize ve tersi `Sign`. Bu depolama başlangıç boyutunu artırır ama hızlı bir şekilde veri yazmak için izin verir. +2. Sütunlardaki uzun büyüyen diziler, yazma yükü nedeniyle motorun verimliliğini azaltır. Daha basit veriler, verimlilik o kadar yüksek olur. +3. Bu `SELECT` sonuçlara itiraz değişiklikler tarihin tutarlılık bağlıdır. Ekleme için veri hazırlarken doğru olun. Tutarsız verilerde öngörülemeyen sonuçlar elde edebilirsiniz, örneğin, oturum derinliği gibi negatif olmayan metrikler için negatif değerler. + +### Algoritma {#table_engine-collapsingmergetree-collapsing-algorithm} + +ClickHouse veri parçalarını birleştirdiğinde, her ardışık satır grubu aynı sıralama anahtarıyla (`ORDER BY`) en fazla iki satır reduceda indir isgen ,ir, biri `Sign = 1` (“state” satır) ve başka bir `Sign = -1` (“cancel” satır). Başka bir deyişle, girişler çöker. + +Elde edilen her veri parçası için ClickHouse kaydeder: + +1. Birincilik “cancel” ve son “state” satır sayısı ise “state” ve “cancel” satırlar eşleşir ve son satır bir “state” satır. + +2. Son “state” satır, daha varsa “state” satırlar daha “cancel” satırlar. + +3. Birincilik “cancel” satır, daha varsa “cancel” satırlar daha “state” satırlar. + +4. Diğer tüm durumlarda satırların hiçbiri. + +Ayrıca en az 2 tane daha olduğunda “state” satırlar daha “cancel” satırlar veya en az 2 tane daha “cancel” r rowsows th thenen “state” satırlar, birleştirme devam eder, ancak ClickHouse bu durumu mantıksal bir hata olarak değerlendirir ve sunucu günlüğüne kaydeder. Aynı veriler birden çok kez eklendiğinde, bu hata oluşabilir. + +Bu nedenle, çöken istatistik hesaplama sonuçlarını değiştirmemelidir. +Değişiklikler yavaş yavaş çöktü, böylece sonunda hemen hemen her nesnenin sadece son durumu kaldı. + +Bu `Sign` birleştirme algoritması, aynı sıralama anahtarına sahip tüm satırların aynı sonuçtaki veri bölümünde ve hatta aynı fiziksel sunucuda olacağını garanti etmediğinden gereklidir. ClickHouse süreci `SELECT` birden çok iş parçacığına sahip sorgular ve sonuçtaki satırların sırasını tahmin edemez. Tamamen almak için bir ihtiyaç varsa toplama gereklidir “collapsed” veri `CollapsingMergeTree` Tablo. + +Daraltmayı sonuçlandırmak için bir sorgu yazın `GROUP BY` yan tümce ve işareti için hesap toplama işlevleri. Örneğin, miktarı hesaplamak için kullanın `sum(Sign)` yerine `count()`. Bir şeyin toplamını hesaplamak için şunları kullanın `sum(Sign * x)` yerine `sum(x)`, ve böylece, ve ayrıca ekleyin `HAVING sum(Sign) > 0`. + +Toplanan `count`, `sum` ve `avg` bu şekilde hesaplanmış olabilir. Toplanan `uniq` bir nesnenin en az bir durumu çökmüş değilse hesaplanabilir. Toplanan `min` ve `max` hesaplan becauseamadı çünkü `CollapsingMergeTree` daraltılmış durumların değerleri geçmişini kaydetmez. + +Toplama olmadan veri ayıklamanız gerekiyorsa (örneğin, en yeni değerleri belirli koşullarla eşleşen satırların mevcut olup olmadığını kontrol etmek için) `FINAL` değiştirici için `FROM` yan. Bu yaklaşım önemli ölçüde daha az etkilidir. + +## Kullanım Örneği {#example-of-use} + +Örnek veriler: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Tablonun oluşturulması: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Veri ekleme: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +Biz iki kullanın `INSERT` iki farklı veri parçası oluşturmak için sorgular. Verileri bir sorgu ile eklersek ClickHouse bir veri parçası oluşturur ve hiç bir birleştirme gerçekleştirmez. + +Veri alma: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Ne görüyoruz ve nerede çöküyor? + +İki ile `INSERT` sorgular, 2 Veri parçası oluşturduk. Bu `SELECT` sorgu 2 iş parçacığında yapıldı ve rastgele bir satır sırası aldık. Veri parçalarının henüz birleştirilmediği için çökme gerçekleşmedi. ClickHouse biz tahmin edemez bilinmeyen bir anda veri kısmını birleştirir. + +Böylece toplama ihtiyacımız var: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +Toplamaya ihtiyacımız yoksa ve çökmeyi zorlamak istiyorsak, şunları kullanabiliriz `FINAL` değiştirici için `FROM` yan. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Verileri seçmenin bu yolu çok verimsizdir. Büyük masalar için kullanmayın. + +## Başka Bir Yaklaşım Örneği {#example-of-another-approach} + +Örnek veriler: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ +│ 4324182021466249494 │ -5 │ -146 │ -1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +Fikir, birleştirmelerin yalnızca anahtar alanları hesaba katmasıdır. Ve içinde “Cancel” satır işareti sütununu kullanmadan toplanırken satırın önceki sürümünü eşitleyen negatif değerleri belirtebiliriz. Bu yaklaşım için veri türünü değiştirmek gerekir `PageViews`,`Duration` uint8 -\> Int16 negatif değerlerini saklamak için. + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews Int16, + Duration Int16, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +Yaklaşımı test edelim: + +``` sql +insert into UAct values(4324182021466249494, 5, 146, 1); +insert into UAct values(4324182021466249494, -5, -146, -1); +insert into UAct values(4324182021466249494, 6, 185, 1); + +select * from UAct final; // avoid using final in production (just for a test or small tables) +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +``` sql +SELECT + UserID, + sum(PageViews) AS PageViews, + sum(Duration) AS Duration +FROM UAct +GROUP BY UserID +```text +┌──────────────UserID─┬─PageViews─┬─Duration─┐ +│ 4324182021466249494 │ 6 │ 185 │ +└─────────────────────┴───────────┴──────────┘ +``` + +``` sqk +select count() FROM UAct +``` + +``` text +┌─count()─┐ +│ 3 │ +└─────────┘ +``` + +``` sql +optimize table UAct final; + +select * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/tr/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/tr/engines/table-engines/mergetree-family/custom-partitioning-key.md new file mode 100644 index 00000000000..48658e76642 --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,127 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 32 +toc_title: "\xD6zel B\xF6l\xFCmleme Anahtar\u0131" +--- + +# Özel Bölümleme Anahtarı {#custom-partitioning-key} + +Bölümleme için kullanılabilir [MergeTree](mergetree.md) aile tabloları (dahil [çoğaltıyordu](replication.md) Tablolar). [Hayata görünümler](../special/materializedview.md) MergeTree tablolarına dayanarak bölümlemeyi de destekler. + +Bir bölüm, bir tablodaki kayıtların belirtilen bir kritere göre mantıksal bir birleşimidir. Bir bölümü, ay, gün veya olay türü gibi rasgele bir ölçütle ayarlayabilirsiniz. Bu verilerin manipülasyonlarını basitleştirmek için her bölüm ayrı ayrı saklanır. Verilere erişirken, ClickHouse mümkün olan en küçük bölüm alt kümesini kullanır. + +Bölüm belirtilen `PARTITION BY expr` fık whenra ne zaman [tablo oluşturma](mergetree.md#table_engine-mergetree-creating-a-table). Bölüm anahtarı tablo sütunlarından herhangi bir ifade olabilir. Örneğin, aya göre bölümleme belirtmek için ifadeyi kullanın `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour; +``` + +Bölüm anahtarı ayrıca bir ifade kümesi olabilir ( [birincil anahtar](mergetree.md#primary-keys-and-indexes-in-queries)). Mesela: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +Bu örnekte, bölümlemeyi geçerli hafta boyunca meydana gelen olay türlerine göre ayarladık. + +Bir tabloya yeni veri eklerken, bu veriler birincil anahtara göre sıralanmış ayrı bir parça (yığın) olarak depolanır. Taktıktan 10-15 dakika sonra, aynı bölümün parçaları tüm parçaya birleştirilir. + +!!! info "Bilgin" + Birleştirme yalnızca bölümleme ifadesi için aynı değere sahip veri parçaları için çalışır. Bu demektir **aşırı granüler bölümler yapmamalısınız** (yaklaşık binden fazla bölüm). Aksi takdirde, `SELECT` sorgu, dosya sistemindeki ve açık dosya tanımlayıcılarındaki makul olmayan sayıda dosya nedeniyle yetersiz performans gösterir. + +Kullan… [sistem.parçalar](../../../operations/system-tables.md#system_tables-parts) tablo tablo parçaları ve bölümleri görüntülemek için. Örneğin, bir var varsayalım `visits` aya göre bölümleme ile tablo. Hadi gerçekleştirelim `SELECT` sorgu için `system.parts` Tablo: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 1 │ +│ 201902 │ 201902_11_11_0 │ 1 │ +└───────────┴────────────────┴────────┘ +``` + +Bu `partition` sütun bölümlerin adlarını içerir. Bu örnekte iki bölüm vardır: `201901` ve `201902`. Bölüm adını belirtmek için bu sütun değerini kullanabilirsiniz [ALTER … PARTITION](#alter_manipulations-with-partitions) sorgular. + +Bu `name` sütun, bölüm veri parçalarının adlarını içerir. Bölümün adını belirtmek için bu sütunu kullanabilirsiniz. [ALTER ATTACH PART](#alter_attach-partition) sorgu. + +İlk bölümün adını kıralım: `201901_1_3_1`: + +- `201901` bölüm adıdır. +- `1` en az veri bloğu sayısıdır. +- `3` veri bloğunun maksimum sayısıdır. +- `1` yığın düzeyidir (oluşturduğu birleştirme ağacının derinliği). + +!!! info "Bilgin" + Eski tip tabloların parçaları adı vardır: `20190117_20190123_2_2_0` (minimum tarih - maksimum tarih - minimum blok numarası - maksimum blok numarası - seviye). + +Bu `active` sütun, parçanın durumunu gösterir. `1` aktif istir; `0` etkin değil. Etkin olmayan parçalar, örneğin, daha büyük bir parçaya birleştirildikten sonra kalan kaynak parçalarıdır. Bozuk veri parçaları da etkin olarak gösterilir. + +Örnekte gördüğünüz gibi, aynı bölümün birkaç ayrı parçası vardır (örneğin, `201901_1_3_1` ve `201901_1_9_2`). Bu, bu parçaların henüz birleştirilmediği anlamına gelir. ClickHouse, eklendikten yaklaşık 15 dakika sonra eklenen veri parçalarını periyodik olarak birleştirir. Buna ek olarak, kullanarak zamanlanmış olmayan birleştirme gerçekleştirebilirsiniz [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) sorgu. Örnek: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + +``` text +┌─partition─┬─name───────────┬─active─┐ +│ 201901 │ 201901_1_3_1 │ 0 │ +│ 201901 │ 201901_1_9_2 │ 1 │ +│ 201901 │ 201901_8_8_0 │ 0 │ +│ 201901 │ 201901_9_9_0 │ 0 │ +│ 201902 │ 201902_4_6_1 │ 0 │ +│ 201902 │ 201902_4_11_2 │ 1 │ +│ 201902 │ 201902_10_10_0 │ 0 │ +│ 201902 │ 201902_11_11_0 │ 0 │ +└───────────┴────────────────┴────────┘ +``` + +Etkin olmayan parçalar birleştirildikten yaklaşık 10 dakika sonra silinecektir. + +Bir parça ve bölüm kümesini görüntülemenin başka bir yolu da tablonun dizinine gitmektir: `/var/lib/clickhouse/data///`. Mesela: + +``` bash +/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +Klasör ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ ve böylece parçaların dizinleri vardır. Her bölüm karşılık gelen bir bölümle ilgilidir ve yalnızca belirli bir ay için veri içerir (Bu örnekteki tabloda aylara göre bölümleme vardır). + +Bu `detached` dizin kullanarak tablodan ayrılmış parçaları içerir [DETACH](#alter_detach-partition) sorgu. Bozuk parçalar da silinmek yerine bu dizine taşınır. Sunucu parçaları kullanmaz `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql-reference/statements/alter.md#alter_attach-partition) sorgu. + +İşletim sunucusunda, sunucu bunu bilmediğinden, dosya sistemindeki parça kümesini veya verilerini el ile değiştiremeyeceğinizi unutmayın. Çoğaltılmamış tablolar için, sunucu durdurulduğunda bunu yapabilirsiniz, ancak önerilmez. Çoğaltılmış tablolar için, parça kümesi her durumda değiştirilemez. + +ClickHouse, bölümlerle işlemleri gerçekleştirmenize izin verir: bunları silin, bir tablodan diğerine kopyalayın veya bir yedek oluşturun. Bölümdeki tüm işlemlerin listesine bakın [Bölümler ve parçalar ile manipülasyonlar](../../../sql-reference/statements/alter.md#alter_manipulations-with-partitions). + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/tr/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/tr/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..d02f94dcf4c --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,174 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 38 +toc_title: "Graph\u0131temergetree" +--- + +# Graphıtemergetree {#graphitemergetree} + +Bu motor inceltme ve toplama/ortalama (toplaması) için tasarlanmıştır) [Grafit](http://graphite.readthedocs.io/en/latest/index.html) veriler. Clickhouse’u Grafit için bir veri deposu olarak kullanmak isteyen geliştiriciler için yararlı olabilir. + +Toplamaya ihtiyacınız yoksa Grafit verilerini depolamak için herhangi bir ClickHouse tablo motorunu kullanabilirsiniz, ancak bir toplamaya ihtiyacınız varsa `GraphiteMergeTree`. Motor, depolama hacmini azaltır ve grafitten gelen sorguların verimliliğini arttırır. + +Motor özellikleri devralır [MergeTree](mergetree.md). + +## Tablo oluşturma {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Ayrıntılı bir açıklamasını görmek [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) sorgu. + +Grafit verileri için bir tablo aşağıdaki veriler için aşağıdaki sütunlara sahip olmalıdır: + +- Metrik adı (Grafit sensörü). Veri türü: `String`. + +- Metrik ölçme zamanı. Veri türü: `DateTime`. + +- Metrik değeri. Veri türü: herhangi bir sayısal. + +- Metrik sürümü. Veri türü: herhangi bir sayısal. + + ClickHouse en yüksek sürümü veya sürümleri aynı ise son yazılan satırları kaydeder. Veri parçalarının birleştirilmesi sırasında diğer satırlar silinir. + +Bu sütunların adları toplaması yapılandırmasında ayarlanmalıdır. + +**Graphıtemergetree parametreleri** + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +**Sorgu yan tümceleri** + +Oluştururken bir `GraphiteMergeTree` tablo, aynı [yanlar](mergetree.md#table_engine-mergetree-creating-a-table) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +Hariç tüm parametreler `config_section` içinde olduğu gibi aynı anlama sahip `MergeTree`. + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +
+ +## Toplaması Yapılandırması {#rollup-configuration} + +Toplaması için ayarları tarafından tanımlanan [graphite\_rollup](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) sunucu yapılandırmasında parametre. Parametrenin adı herhangi biri olabilir. Birkaç yapılandırma oluşturabilir ve bunları farklı tablolar için kullanabilirsiniz. + +Toplaması yapılandırma yapısı: + + required-columns + patterns + +### Gerekli Sütunlar {#required-columns} + +- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. +- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. +- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Varsayılan değer: `Value`. +- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. + +### Desenler {#patterns} + +Bu yapı `patterns` bölme: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "Dikkat" + Desenler kesinlikle sipariş edilmelidir: + + 1. Patterns without `function` or `retention`. + 1. Patterns with both `function` and `retention`. + 1. Pattern `default`. + +Bir satır işlerken, ClickHouse kuralları denetler `pattern` bölmeler. Tüm `pattern` (içeren `default`) bölümler içerebilir `function` toplama için parametre, `retention` parametreler veya her ikisi. Metrik adı eşleşirse `regexp` gelen kuralları `pattern` bölüm (veya bölümler) uygulanır; aksi takdirde, kurallar `default` bölüm kullanılır. + +Alanlar için `pattern` ve `default` bölmeler: + +- `regexp`– A pattern for the metric name. +- `age` – The minimum age of the data in seconds. +- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). +- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. + +### Yapılandırma Örneği {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/tr/engines/table_engines/mergetree_family/index.md b/docs/tr/engines/table-engines/mergetree-family/index.md similarity index 100% rename from docs/tr/engines/table_engines/mergetree_family/index.md rename to docs/tr/engines/table-engines/mergetree-family/index.md diff --git a/docs/tr/engines/table-engines/mergetree-family/mergetree.md b/docs/tr/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..5a090ee03b2 --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,654 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 30 +toc_title: MergeTree +--- + +# MergeTree {#table_engines-mergetree} + +Bu `MergeTree` bu ailenin motoru ve diğer motorları (`*MergeTree`) en sağlam ClickHouse masa motorlarıdır. + +Motor inlarda `MergeTree` aile, bir tabloya çok büyük miktarda veri eklemek için tasarlanmıştır. Veriler hızlı bir şekilde tabloya kısmen yazılır, daha sonra parçaları arka planda birleştirmek için kurallar uygulanır. Bu yöntem, ınsert sırasında depolama alanındaki verileri sürekli olarak yeniden yazmaktan çok daha etkilidir. + +Ana özellikler: + +- Birincil anahtara göre sıralanmış verileri saklar. + + Bu, verileri daha hızlı bulmanıza yardımcı olan küçük bir seyrek dizin oluşturmanıza olanak sağlar. + +- Bölümler eğer kullanılabilir [bölümleme anahtarı](custom-partitioning-key.md) belirt .ilmektedir. + + ClickHouse, aynı sonuçla aynı veriler üzerindeki genel işlemlerden daha etkili olan bölümlerle belirli işlemleri destekler. ClickHouse, bölümleme anahtarının sorguda belirtildiği bölüm verilerini de otomatik olarak keser. Bu da sorgu performansını artırır. + +- Veri çoğaltma desteği. + + The family of `ReplicatedMergeTree` tablolar veri çoğaltma sağlar. Daha fazla bilgi için, bkz. [Veri çoğaltma](replication.md). + +- Veri örnekleme desteği. + + Gerekirse, tabloda veri örnekleme yöntemini ayarlayabilirsiniz. + +!!! info "Bilgin" + Bu [Birleştirmek](../special/merge.md) motor ait değil `*MergeTree` aile. + +## Tablo oluşturma {#table_engine-mergetree-creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 +) ENGINE = MergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] +[SETTINGS name=value, ...] +``` + +Parametrelerin açıklaması için bkz. [Sorgu açıklaması oluştur](../../../sql-reference/statements/create.md). + +!!! note "Not" + `INDEX` deneysel bir özelliktir, bkz [Veri Atlama Dizinleri](#table_engine-mergetree-data_skipping-indexes). + +### Sorgu Yan Tümceleri {#mergetree-query-clauses} + +- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. Bu `MergeTree` motor parametreleri yok. + +- `PARTITION BY` — The [bölümleme anahtarı](custom-partitioning-key.md). + + Aylara göre bölümleme için `toYYYYMM(date_column)` ifade, nerede `date_column` türün tarihi olan bir sütun mu [Tarihli](../../../sql-reference/data-types/date.md). Burada bölüm isimleri var `"YYYYMM"` biçimli. + +- `ORDER BY` — The sorting key. + + Sütun veya keyfi ifadeler bir tuple. Örnek: `ORDER BY (CounterID, EventDate)`. + +- `PRIMARY KEY` — The primary key if it [sıralama anahtarından farklıdır](mergetree.md). + + Varsayılan olarak, birincil anahtar sıralama anahtarıyla aynıdır (bu anahtar tarafından belirtilir). `ORDER BY` yan). Bu nedenle çoğu durumda ayrı bir belirtmek gereksizdir `PRIMARY KEY` yan. + +- `SAMPLE BY` — An expression for sampling. + + Bir örnekleme ifadesi kullanılırsa, birincil anahtar onu içermelidir. Örnek: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. + +- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [diskler ve birimler arasında](#table_engine-mergetree-multiple-volumes). + + İfade bir olmalıdır `Date` veya `DateTime` sonuç olarak sütun. Örnek: + `TTL date + INTERVAL 1 DAY` + + Kuralın türü `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` ifade tatmin edildiyse (geçerli zamana ulaşırsa) parça ile yapılacak bir eylemi belirtir: süresi dolmuş satırların kaldırılması, bir parçanın (bir parçadaki tüm satırlar için ifade tatmin edildiyse) belirtilen diske taşınması (`TO DISK 'xxx'`) veya hacim (`TO VOLUME 'xxx'`). Kuralın varsayılan türü kaldırma (`DELETE`). Birden fazla kural listesi belirtilebilir, ancak birden fazla olmamalıdır `DELETE` kural. + + Daha fazla ayrıntı için bkz. [Sütunlar ve tablolar için TTL](#table_engine-mergetree-ttl) + +- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: + + - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Veri Depolama](#mergetree-data-storage). + - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Veri Depolama](#mergetree-data-storage). + - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` ayar. 19.11 sürümünden önce, sadece `index_granularity` granül boyutunu kısıtlamak için ayar. Bu `index_granularity_bytes` büyük satırlar (onlarca ve megabayt yüzlerce) ile tablolardan veri seçerken ayarı ClickHouse performansını artırır. Büyük satırlara sahip tablolarınız varsa, tabloların verimliliğini artırmak için bu ayarı etkinleştirebilirsiniz. `SELECT` sorgular. + - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, daha sonra ZooKeeper daha az veri depolar. Daha fazla bilgi için, bkz: [ayar açıklaması](../../../operations/server-configuration-parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) içinde “Server configuration parameters”. + - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` bayt, ClickHouse okur ve doğrudan I/O arabirimi kullanarak depolama diskine veri yazar (`O_DIRECT` seçenek). Eğer `min_merge_bytes_to_use_direct_io = 0`, sonra doğrudan g / Ç devre dışı bırakılır. Varsayılan değer: `10 * 1024 * 1024 * 1024` baytlar. + + - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). + - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don’t turn it off. + - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. + - `storage_policy` — Storage policy. See [Veri depolama için birden fazla blok cihazı kullanma](#table_engine-mergetree-multiple-volumes). + +**Bölüm ayarı örneği** + +``` sql +ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 +``` + +Örnekte, aylara göre bölümleme ayarladık. + +Biz de kullanıcı kimliği ile karma olarak örnekleme için bir ifade ayarlayın. Bu, her biri için tablodaki verileri pseudorandomize etmenizi sağlar `CounterID` ve `EventDate`. Tanım yoularsanız bir [SAMPLE](../../../sql-reference/statements/select.md#select-sample-clause) yan tümcesi verileri seçerken, ClickHouse kullanıcıların bir alt kümesi için eşit pseudorandom veri örneği döndürür. + +Bu `index_granularity` 8192 varsayılan değer olduğundan ayarı atlanabilir. + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın. Mümkünse, eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +**MergeTree () Parametreleri** + +- `date-column` — The name of a column of the [Tarihli](../../../sql-reference/data-types/date.md) tür. ClickHouse otomatik olarak bu sütuna göre ay bölümleri oluşturur. Bölüm adları `"YYYYMM"` biçimli. +- `sampling_expression` — An expression for sampling. +- `(primary, key)` — Primary key. Type: [Demet()](../../../sql-reference/data-types/tuple.md) +- `index_granularity` — The granularity of an index. The number of data rows between the “marks” bir dizinin. 8192 değeri çoğu görev için uygundur. + +**Örnek** + +``` sql +MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) +``` + +Bu `MergeTree` motor, Ana motor yapılandırma yöntemi için yukarıdaki örnekte olduğu gibi yapılandırılır. +
+ +## Veri Depolama {#mergetree-data-storage} + +Bir tabloda birincil anahtar tarafından sıralanmış verileri bölümden oluşmaktadır. + +Veri bir tabloya eklendiğinde, ayrı veri parçaları oluşturulur ve bunların her biri birincil anahtara göre lexicographically sıralanır. Örneğin, birincil anahtar `(CounterID, Date)`, parçadaki veriler şu şekilde sıralanır `CounterID` ve içinde her `CounterID` tarafından sipariş edilir `Date`. + +Farklı bölümlere ait veriler farklı parçalara ayrılır. Arka planda, ClickHouse daha verimli depolama için veri parçalarını birleştirir. Farklı bölümlere ait parçalar birleştirilmez. Birleştirme mekanizması, aynı birincil anahtara sahip tüm satırların aynı veri bölümünde olacağını garanti etmez. + +Her veri parçası mantıksal olarak granüllere ayrılmıştır. Bir granül, Clickhouse’un veri seçerken okuduğu en küçük bölünmez veri kümesidir. ClickHouse satırları veya değerleri bölmez, bu nedenle her granül her zaman bir tamsayı satır içerir. Bir granülün ilk satırı, satır için birincil anahtarın değeri ile işaretlenir. Her veri bölümü için ClickHouse işaretleri depolayan bir dizin dosyası oluşturur. Her sütun için, birincil anahtarda olsun ya da olmasın, ClickHouse aynı işaretleri de saklar. Bu işaretler, verileri doğrudan sütun dosyalarında bulmanızı sağlar. + +Granül boyutu ile sınırlıdır `index_granularity` ve `index_granularity_bytes` tablo motorunun ayarları. Bir granüldeki satır sayısı `[1, index_granularity]` Aralık, satırların boyutuna bağlı olarak. Bir granülün boyutu aşabilir `index_granularity_bytes` tek bir satırın boyutu ayarın değerinden büyükse. Bu durumda, granülün boyutu satırın boyutuna eşittir. + +## Sorgularda Birincil Anahtarlar Ve Dizinler {#primary-keys-and-indexes-in-queries} + +Tak thee the `(CounterID, Date)` örnek olarak birincil anahtar. Bu durumda, sıralama ve dizin aşağıdaki gibi gösterilebilir: + + Whole data: [---------------------------------------------] + CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] + Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] + Marks: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 + Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 + +Veri sorgusu belirtirse: + +- `CounterID in ('a', 'h')`, sunucu işaretleri aralıklarında verileri okur `[0, 3)` ve `[6, 8)`. +- `CounterID IN ('a', 'h') AND Date = 3`, sunucu işaretleri aralıklarında verileri okur `[1, 3)` ve `[7, 8)`. +- `Date = 3`, sunucu işaretleri aralığında veri okur `[1, 10]`. + +Yukarıdaki örnekler, her zaman bir dizin tam taramadan daha etkili olduğunu göstermektedir. + +Seyrek bir dizin, ekstra verilerin okunmasına izin verir. Birincil anahtarın tek bir aralığını okurken, `index_granularity * 2` her veri bloğundaki ekstra satırlar okunabilir. + +Seyrek dizinler, çok sayıda tablo satırı ile çalışmanıza izin verir, çünkü çoğu durumda, bu tür dizinler bilgisayarın RAM’İNE sığar. + +ClickHouse benzersiz bir birincil anahtar gerektirmez. Aynı birincil anahtar ile birden çok satır ekleyebilirsiniz. + +### Birincil Anahtar seçme {#selecting-the-primary-key} + +Birincil anahtardaki sütun sayısı açıkça sınırlı değildir. Veri yapısına bağlı olarak, birincil anahtara daha fazla veya daha az sütun ekleyebilirsiniz. Bu Mayıs: + +- Bir dizin performansını artırın. + + Birincil anahtar ise `(a, b)`, sonra başka bir sütun ekleyerek `c` aşağıdaki koşullar yerine getirilirse performansı artıracaktır: + + - Sütun üzerinde bir koşulu olan sorgular var `c`. + - Uzun veri aralıkları (birkaç kat daha uzun `index_granularity`) için aynı değer withlerle `(a, b)` yaygındır. Başka bir deyişle, başka bir sütun eklerken oldukça uzun veri aralıklarını atlamanıza izin verir. + +- Veri sıkıştırmasını geliştirin. + + ClickHouse verileri birincil anahtarla sıralar, bu nedenle tutarlılık ne kadar yüksek olursa sıkıştırma o kadar iyi olur. + +- Veri parçalarını birleştirirken ek mantık sağlayın [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) ve [SummingMergeTree](summingmergetree.md) motorlar. + + Bu durumda belirtmek mantıklı *sıralama anahtarı* bu birincil anahtardan farklıdır. + +Uzun bir birincil anahtar, ekleme performansını ve bellek tüketimini olumsuz yönde etkiler, ancak birincil anahtardaki ek sütunlar, ClickHouse performansını etkilemez `SELECT` sorgular. + +### Sıralama anahtarından farklı Bir Birincil Anahtar seçme {#choosing-a-primary-key-that-differs-from-the-sorting-key} + +Sıralama anahtarından (veri bölümlerindeki satırları sıralamak için bir ifade) farklı bir birincil anahtar (her işaret için dizin dosyasında yazılan değerlere sahip bir ifade) belirtmek mümkündür. Bu durumda, birincil anahtar ifadesi tuple, sıralama anahtarı ifadesi tuple’ın bir öneki olmalıdır. + +Bu özellik kullanırken yararlıdır [SummingMergeTree](summingmergetree.md) ve +[AggregatingMergeTree](aggregatingmergetree.md) masa motorları. Bu motorları kullanırken yaygın bir durumda, tablonun iki tür sütunu vardır: *boyutlular* ve *ölçümler*. Tipik sorgular, rasgele ölçü sütunlarının değerlerini toplar `GROUP BY` ve boyutlara göre filtreleme. Çünkü SummingMergeTree ve AggregatingMergeTree sıralama anahtarının aynı değere sahip satırları toplamak, tüm boyutları eklemek doğaldır. Sonuç olarak, anahtar ifadesi uzun bir sütun listesinden oluşur ve bu liste yeni eklenen boyutlarla sık sık güncelleştirilmelidir. + +Bu durumda, birincil anahtarda verimli Aralık taramaları sağlayacak ve kalan boyut sütunlarını sıralama anahtarı kümesine ekleyecek yalnızca birkaç sütun bırakmak mantıklıdır. + +[ALTER](../../../sql-reference/statements/alter.md) yeni bir sütun aynı anda tabloya ve sıralama anahtarı eklendiğinde, varolan veri parçaları değiştirilmesi gerekmez, çünkü sıralama anahtarının hafif bir işlemdir. Eski sıralama anahtarı yeni sıralama anahtarının bir öneki olduğundan ve yeni eklenen sütunda veri olmadığından, veriler tablo değişikliği anında hem eski hem de yeni sıralama anahtarlarına göre sıralanır. + +### Sorgularda Dizin Ve bölümlerin kullanımı {#use-of-indexes-and-partitions-in-queries} + +İçin `SELECT` sorgular, ClickHouse bir dizin kullanılabilir olup olmadığını analiz eder. Eğer bir dizin kullanılabilir `WHERE/PREWHERE` yan tümce, bir eşitlik veya eşitsizlik karşılaştırma işlemini temsil eden bir ifadeye (bağlantı öğelerinden biri olarak veya tamamen) sahiptir veya varsa `IN` veya `LIKE` sütun veya birincil anahtar veya bölümleme anahtar veya bu sütunların belirli kısmen tekrarlayan işlevleri veya bu ifadelerin mantıksal ilişkileri olan ifadeler üzerinde sabit bir önek ile. + +Bu nedenle, birincil anahtarın bir veya daha fazla aralığındaki sorguları hızlı bir şekilde çalıştırmak mümkündür. Bu örnekte, belirli bir izleme etiketi, belirli bir etiket ve tarih aralığı, belirli bir etiket ve tarih için, tarih aralığına sahip birden çok etiket için vb. çalıştırıldığında sorgular hızlı olacaktır. + +Aşağıdaki gibi yapılandırılmış motora bakalım: + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 + +Bu durumda, sorgularda: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +ClickHouse, uygun olmayan verileri kırpmak için birincil anahtar dizinini ve uygun olmayan tarih aralıklarındaki bölümleri kırpmak için aylık bölümleme anahtarını kullanır. + +Yukarıdaki sorgular, dizinin karmaşık ifadeler için bile kullanıldığını göstermektedir. Tablodan okuma, dizini kullanarak tam taramadan daha yavaş olamayacak şekilde düzenlenmiştir. + +Aşağıdaki örnekte, dizin kullanılamaz. + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +Clickhouse’un bir sorgu çalıştırırken dizini kullanıp kullanamayacağını kontrol etmek için ayarları kullanın [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) ve [force\_primary\_key](../../../operations/settings/settings.md). + +Aylara göre bölümleme anahtarı, yalnızca uygun aralıktaki tarihleri içeren veri bloklarını okumanıza izin verir. Bu durumda, veri bloğu birçok tarih için veri içerebilir (bir aya kadar). Bir blok içinde veriler, ilk sütun olarak tarihi içermeyen birincil anahtara göre sıralanır. Bu nedenle, birincil anahtar önekini belirtmeyen yalnızca bir tarih koşulu ile bir sorgu kullanarak tek bir tarih için okunacak daha fazla veri neden olur. + +### Kısmen Monotonik Birincil Anahtarlar için Endeks kullanımı {#use-of-index-for-partially-monotonic-primary-keys} + +Örneğin, Ayın günlerini düşünün. Onlar formu bir [monotonik dizisi](https://en.wikipedia.org/wiki/Monotonic_function) bir ay boyunca, ancak daha uzun süreler için monotonik değil. Bu kısmen monotonik bir dizidir. Bir kullanıcı kısmen monoton birincil anahtar ile tablo oluşturursa, ClickHouse her zamanki gibi seyrek bir dizin oluşturur. Bir kullanıcı bu tür bir tablodan veri seçtiğinde, ClickHouse sorgu koşullarını analiz eder. Kullanıcı, dizinin iki işareti arasında veri almak isterse ve bu işaretlerin her ikisi de bir ay içinde düşerse, ClickHouse bu özel durumda dizini kullanabilir, çünkü sorgu parametreleri ile dizin işaretleri arasındaki mesafeyi hesaplayabilir. + +Sorgu parametresi aralığındaki birincil anahtarın değerleri monotonik bir sırayı temsil etmiyorsa, ClickHouse bir dizin kullanamaz. Bu durumda, ClickHouse Tam Tarama yöntemini kullanır. + +ClickHouse bu mantığı yalnızca ay dizilerinin günleri için değil, kısmen monotonik bir diziyi temsil eden herhangi bir birincil anahtar için kullanır. + +### Veri Atlama Indeksleri (deneysel) {#table_engine-mergetree-data_skipping-indexes} + +Dizin bildirimi sütunlar bölümünde `CREATE` sorgu. + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +Tablolar için `*MergeTree` aile, veri atlama endeksleri belirtilebilir. + +Bu endeksler, bloklarda belirtilen ifade hakkında bazı bilgileri toplar ve bunlardan oluşur `granularity_value` granüller (granül boyutu kullanılarak belirtilir `index_granularity` tablo motoru ayarı). Daha sonra bu agregalar `SELECT` büyük veri bloklarını atlayarak diskten okunacak veri miktarını azaltmak için sorgular `where` sorgu tatmin edilemez. + +**Örnek** + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +Örneğin endeksleri aşağıdaki sorgularda diskten okunacak veri miktarını azaltmak için ClickHouse tarafından kullanılabilir: + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### Mevcut Endeks Türleri {#available-types-of-indices} + +- `minmax` + + Belirtilen ifad (eyi saklar (ifad (enin `tuple`, sonra her eleman için aşırı depolar `tuple`), birincil anahtar gibi veri bloklarını atlamak için saklanan bilgileri kullanır. + +- `set(max_rows)` + + Belirtilen ifadenin benzersiz değerlerini depolar (en fazla `max_rows` satırlar, `max_rows=0` anlama “no limits”). Kontrol etmek için değerleri kullanır `WHERE` ifade, bir veri bloğu üzerinde tatmin edilemez değildir. + +- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + Mağazalar a [Blo filterom filtre](https://en.wikipedia.org/wiki/Bloom_filter) bu, bir veri bloğundaki tüm ngramları içerir. Sadece dizeleri ile çalışır. Optimizasyonu için kullanılabilir `equals`, `like` ve `in` ifadeler. + + - `n` — ngram size, + - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). + - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. + - `random_seed` — The seed for Bloom filter hash functions. + +- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + + Olarak aynı `ngrambf_v1`, ancak ngrams yerine simgeleri saklar. Belirteçler alfasayısal olmayan karakterlerle ayrılmış dizilerdir. + +- `bloom_filter([false_positive])` — Stores a [Blo filterom filtre](https://en.wikipedia.org/wiki/Bloom_filter) belirtilen sütunlar için. + + Opsiyonel `false_positive` parametre, filtreden yanlış pozitif yanıt alma olasılığıdır. Olası değerler: (0, 1). Varsayılan değer: 0.025. + + Desteklenen veri türleri: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. + + Aşağıdaki işlevleri kullanabilirsiniz: [eşitlikler](../../../sql-reference/functions/comparison-functions.md), [notEquals](../../../sql-reference/functions/comparison-functions.md), [içinde](../../../sql-reference/functions/in-functions.md), [notİn](../../../sql-reference/functions/in-functions.md), [var](../../../sql-reference/functions/array-functions.md). + + + +``` sql +INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 +INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 +``` + +#### Fonksiyonları Destek {#functions-support} + +Koşulları `WHERE` yan tümcesi, sütunlarla çalışan işlevlerin çağrılarını içerir. Sütun bir dizinin bir parçasıysa, ClickHouse işlevleri gerçekleştirirken bu dizini kullanmaya çalışır. ClickHouse, dizinleri kullanmak için farklı işlev alt kümelerini destekler. + +Bu `set` dizin tüm fonksiyonları ile kullanılabilir. Diğer dizinler için işlev alt kümeleri aşağıdaki tabloda gösterilmiştir. + +| Fonksiyon (operatör) / dizin | birincil anahtar | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | +|------------------------------------------------------------------------------------------------------------|------------------|--------|-------------|-------------|---------------| +| [eşitlikler (=, ==)](../../../sql-reference/functions/comparison-functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notEquals(!=, \<\>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [hoşlanmak](../../../sql-reference/functions/string-search-functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [notLike](../../../sql-reference/functions/string-search-functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | +| [startsWith](../../../sql-reference/functions/string-functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | +| [endsWith](../../../sql-reference/functions/string-functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | +| [multiSearchAny](../../../sql-reference/functions/string-search-functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | +| [içinde](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [notİn](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | +| [daha az (\<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [büyük (\>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [lessOrEquals (\<=)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [greaterOrEquals (\>=)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [boş](../../../sql-reference/functions/array-functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| [notEmpty](../../../sql-reference/functions/array-functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | +| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | + +Ngram boyutundan daha az olan sabit bir argümana sahip işlevler tarafından kullanılamaz `ngrambf_v1` sorgu optimizasyonu için. + +Bloom filtreleri yanlış pozitif eşleşmelere sahip olabilir, bu yüzden `ngrambf_v1`, `tokenbf_v1`, ve `bloom_filter` dizinler, örneğin bir işlevin sonucunun false olması beklenen sorguları en iyi duruma getirmek için kullanılamaz: + +- Optimize edilebilir: + - `s LIKE '%test%'` + - `NOT s NOT LIKE '%test%'` + - `s = 1` + - `NOT s != 1` + - `startsWith(s, 'test')` +- Optimize edilemez: + - `NOT s LIKE '%test%'` + - `s NOT LIKE '%test%'` + - `NOT s = 1` + - `s != 1` + - `NOT startsWith(s, 'test')` + +## Eşzamanlı Veri Erişimi {#concurrent-data-access} + +Eşzamanlı tablo erişimi için çoklu sürüm kullanıyoruz. Başka bir deyişle, bir tablo aynı anda okunup güncelleştirildiğinde, sorgu sırasında geçerli olan bir parça kümesinden veri okunur. Uzun kilitler yok. Ekler okuma işlemlerinin yoluna girmez. + +Bir tablodan okuma otomatik olarak paralelleştirilir. + +## Sütunlar Ve Tablolar için TTL {#table_engine-mergetree-ttl} + +Değerlerin ömrünü belirler. + +Bu `TTL` yan tümcesi tüm tablo ve her sütun için ayarlanabilir. Tablo düzeyinde TTL ayrıca diskler ve birimler arasında otomatik veri taşıma mantığını belirtebilirsiniz. + +İfadeleri değerlendirmek gerekir [Tarihli](../../../sql-reference/data-types/date.md) veya [DateTime](../../../sql-reference/data-types/datetime.md) veri türü. + +Örnek: + +``` sql +TTL time_column +TTL time_column + interval +``` + +Tanımlamak `interval`, kullanma [zaman aralığı](../../../sql-reference/operators.md#operators-datetime) operatörler. + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### Sütun TTL {#mergetree-column-ttl} + +Sütundaki değerler sona erdiğinde, ClickHouse bunları sütun veri türü için varsayılan değerlerle değiştirir. Veri bölümündeki tüm sütun değerleri sona ererse, ClickHouse bu sütunu bir dosya sistemindeki veri bölümünden siler. + +Bu `TTL` yan tümcesi anahtar sütunlar için kullanılamaz. + +Örnekler: + +TTL ile tablo oluşturma + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +Varolan bir tablonun sütununa TTL ekleme + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +Sütun TTL değiştirme + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### Tablo TTL {#mergetree-table-ttl} + +Tablo, süresi dolmuş satırların kaldırılması için bir ifadeye ve parçaların arasında otomatik olarak taşınması için birden fazla ifadeye sahip olabilir [diskler veya birimler](#table_engine-mergetree-multiple-volumes). Tablodaki satırların süresi dolduğunda, ClickHouse ilgili tüm satırları siler. Parça taşıma özelliği için, bir parçanın tüm satırları hareket ifadesi ölçütlerini karşılaması gerekir. + +``` sql +TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... +``` + +TTL kuralı türü her TTL ifadesini takip edebilir. İfade tatmin edildikten sonra yapılacak bir eylemi etkiler (şimdiki zamana ulaşır): + +- `DELETE` - süresi dolmuş satırları sil (varsayılan eylem); +- `TO DISK 'aaa'` - parçayı diske taşı `aaa`; +- `TO VOLUME 'bbb'` - parçayı diske taşı `bbb`. + +Örnekler: + +TTL ile tablo oluşturma + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH [DELETE], + d + INTERVAL 1 WEEK TO VOLUME 'aaa', + d + INTERVAL 2 WEEK TO DISK 'bbb'; +``` + +Tablonun TTL değiştirme + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**Verileri Kaldırma** + +ClickHouse veri parçalarını birleştirdiğinde süresi dolmuş bir TTL ile veri kaldırılır. + +ClickHouse, verilerin süresi dolduğunu gördüğünde, zamanlama dışı bir birleştirme gerçekleştirir. Bu tür birleştirmelerin sıklığını kontrol etmek için şunları ayarlayabilirsiniz [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). Değer çok düşükse, çok fazla kaynak tüketebilecek birçok zamanlama dışı birleştirme gerçekleştirir. + +Gerçekleştir theirseniz `SELECT` birleştirme arasında sorgu, süresi dolmuş veri alabilirsiniz. Bunu önlemek için, [OPTIMIZE](../../../sql-reference/statements/misc.md#misc_operations-optimize) önce sorgu `SELECT`. + +## Veri Depolama İçin Birden Fazla Blok Cihazı Kullanma {#table_engine-mergetree-multiple-volumes} + +### Giriş {#introduction} + +`MergeTree` aile tablo motorları birden fazla blok cihazlarda veri saklayabilirsiniz. Örneğin, belirli bir tablonun verileri örtük olarak bölündüğünde yararlı olabilir “hot” ve “cold”. En son veriler düzenli olarak talep edilir, ancak yalnızca az miktarda alan gerektirir. Aksine, yağ kuyruklu tarihsel veriler nadiren talep edilir. Birkaç disk varsa, “hot” veriler hızlı disklerde (örneğin, NVMe SSD’ler veya bellekte) bulunabilir; “cold” veri-nispeten yavaş olanlar (örneğin, HDD). + +Veri kısmı için minimum hareketli birimdir `MergeTree`- motor masaları. Bir parçaya ait veriler bir diskte saklanır. Veri parçaları arka planda diskler arasında (kullanıcı ayarlarına göre) ve aynı zamanda [ALTER](../../../sql-reference/statements/alter.md#alter_move-partition) sorgular. + +### Şartlar {#terms} + +- Disk — Block device mounted to the filesystem. +- Default disk — Disk that stores the path specified in the [yol](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) sunucu ayarı. +- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). +- Storage policy — Set of volumes and the rules for moving data between them. + +Açıklanan varlıklara verilen isimler sistem tablolarında bulunabilir, [sistem.storage\_policies](../../../operations/system-tables.md#system_tables-storage_policies) ve [sistem.diskler](../../../operations/system-tables.md#system_tables-disks). Bir tablo için yapılandırılmış depolama ilkelerinden birini uygulamak için `storage_policy` ayarı `MergeTree`- motor aile tabloları. + +### Yapılandırma {#table_engine-mergetree-multiple-volumes-configure} + +Diskler, birimler ve depolama politikaları içinde bildirilmelidir `` ana dosyada ya etiket `config.xml` veya farklı bir dosyada `config.d` dizin. + +Yapılandırma yapısı: + +``` xml + + + + /mnt/fast_ssd/clickhouse/ + + + /mnt/hdd1/clickhouse/ + 10485760 + + + /mnt/hdd2/clickhouse/ + 10485760 + + + ... + + + ... + +``` + +Etiketler: + +- `` — Disk name. Names must be different for all disks. +- `path` — path under which a server will store data (`data` ve `shadow` klasörler) ile Sonlandır shouldılmalıdır ‘/’. +- `keep_free_space_bytes` — the amount of free disk space to be reserved. + +Disk tanımının sırası önemli değildir. + +Depolama ilkeleri yapılandırma biçimlendirme: + +``` xml + + ... + + + + + disk_name_from_disks_configuration + 1073741824 + + + + + + + 0.2 + + + + + + + + ... + +``` + +Etiketler: + +- `policy_name_N` — Policy name. Policy names must be unique. +- `volume_name_N` — Volume name. Volume names must be unique. +- `disk` — a disk within a volume. +- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. +- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). + +Cofiguration örnekleri: + +``` xml + + ... + + + + + disk1 + disk2 + + + + + + + + fast_ssd + 1073741824 + + + disk1 + + + 0.2 + + + ... + +``` + +Verilen örnekte, `hdd_in_order` politika uygular [Ro -und-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) yaklaşma. Böylece bu politika yalnızca bir birim tanımlar (`single`), veri parçaları tüm disklerinde dairesel sırayla saklanır. Bu tür bir politika, sisteme birkaç benzer disk takılıysa, ancak RAID yapılandırılmamışsa oldukça yararlı olabilir. Her bir disk sürücüsünün güvenilir olmadığını ve bunu 3 veya daha fazla çoğaltma faktörü ile telafi etmek isteyebileceğinizi unutmayın. + +Sistemde farklı türde diskler varsa, `moving_from_ssd_to_hdd` politika yerine kullanılabilir. Birim `hot` bir SSD disk oluşur (`fast_ssd`) ve bu birimde saklanabilecek bir parçanın maksimum boyutu 1GB. Tüm parçaları ile boyutu daha büyük 1 GB üzerinde doğrudan saklanır `cold` bir HDD diski içeren birim `disk1`. +Ayrıca, bir kez disk `fast_ssd` 80’den fazla % tarafından doldurulur, veri transfer edilecektir `disk1` bir arka plan işlemi ile. + +Depolama ilkesi içindeki birim numaralandırma sırası önemlidir. Bir birim aşırı doldurulduktan sonra, veriler bir sonrakine taşınır. Disk numaralandırma sırası da önemlidir, çünkü veriler sırayla depolanır. + +Bir tablo oluştururken, yapılandırılmış depolama ilkelerinden birini ona uygulayabilirsiniz: + +``` sql +CREATE TABLE table_with_non_default_policy ( + EventDate Date, + OrderID UInt64, + BannerID UInt64, + SearchPhrase String +) ENGINE = MergeTree +ORDER BY (OrderID, BannerID) +PARTITION BY toYYYYMM(EventDate) +SETTINGS storage_policy = 'moving_from_ssd_to_hdd' +``` + +Bu `default` depolama ilkesi, Yalnızca verilen bir diskten oluşan yalnızca bir birim kullanmayı ima eder ``. Bir tablo oluşturulduktan sonra, depolama ilkesi değiştirilemez. + +### Ayrıntı {#details} + +Bu durumda `MergeTree` tablolar, veriler diske farklı şekillerde giriyor: + +- Bir ekleme sonucunda (`INSERT` sorgu). +- Arka plan birleştirmeleri sırasında ve [mutasyonlar](../../../sql-reference/statements/alter.md#alter-mutations). +- Başka bir kopyadan indirirken. +- Bölüm Don ofması sonucu [ALTER TABLE … FREEZE PARTITION](../../../sql-reference/statements/alter.md#alter_freeze-partition). + +Mutasyonlar ve bölüm dondurma hariç tüm bu durumlarda, bir parça verilen depolama politikasına göre bir birim ve bir diskte saklanır: + +1. Bir parçayı depolamak için yeterli disk alanına sahip olan ilk birim (tanım sırasına göre) (`unreserved_space > current_part_size`) ve belirli bir boyuttaki parçaların saklanmasına izin verir (`max_data_part_size_bytes > current_part_size`) seçilir. +2. Bu birimde, önceki veri yığınını depolamak için kullanılan ve parça boyutundan daha fazla boş alana sahip olan diski izleyen disk seçilir (`unreserved_space - keep_free_space_bytes > current_part_size`). + +Kap hoodut underun altında, [sabit linkler](https://en.wikipedia.org/wiki/Hard_link). Farklı diskler arasındaki sabit bağlantılar desteklenmez, bu nedenle bu gibi durumlarda ortaya çıkan parçalar ilk disklerle aynı disklerde saklanır. + +Arka planda, parçalar boş alan miktarına göre hacimler arasında taşınır (`move_factor` parametre) sırasına göre birimler yapılandırma dosyasında beyan edilir. +Veriler asla sonuncudan ve birincisine aktarılmaz. Bir sistem tabloları kullanabilirsiniz [sistem.part\_log](../../../operations/system-tables.md#system_tables-part-log) (alan `type = MOVE_PART`) ve [sistem.parçalar](../../../operations/system-tables.md#system_tables-parts) (alanlar `path` ve `disk`) arka plan hareketlerini izlemek için. Ayrıca, ayrıntılı bilgi sunucu günlüklerinde bulunabilir. + +Kullanıcı, sorguyu kullanarak bir bölümü veya bölümü bir birimden diğerine taşımaya zorlayabilir [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql-reference/statements/alter.md#alter_move-partition), arka plan işlemleri için tüm kısıtlamalar dikkate alınır. Sorgu, kendi başına bir hareket başlatır ve tamamlanması için arka plan işlemleri beklemez. Yeterli boş alan yoksa veya gerekli koşullardan herhangi biri karşılanmazsa kullanıcı bir hata mesajı alır. + +Veri taşıma veri çoğaltma ile müdahale etmez. Bu nedenle, farklı depolama ilkeleri aynı tablo için farklı yinelemeler üzerinde belirtilebilir. + +Arka plan birleşimlerinin ve mutasyonlarının tamamlanmasından sonra, eski parçalar yalnızca belirli bir süre sonra çıkarılır (`old_parts_lifetime`). +Bu süre zarfında, diğer birimlere veya disklere taşınmazlar. Bu nedenle, parçalar nihayet çıkarılıncaya kadar, işgal edilen disk alanının değerlendirilmesi için hala dikkate alınır. + +[Orijinal makale](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/tr/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/tr/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..a1ea0fc0d1b --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,69 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 33 +toc_title: ReplacingMergeTree +--- + +# ReplacingMergeTree {#replacingmergetree} + +Motor farklıdır [MergeTree](mergetree.md#table_engines-mergetree) aynı birincil anahtar değerine sahip yinelenen girdileri kaldırır (veya daha doğru bir şekilde, aynı [sıralama anahtarı](mergetree.md) değer). + +Veri tekilleştirme yalnızca birleştirme sırasında oluşur. Birleştirme, arka planda bilinmeyen bir zamanda gerçekleşir, bu nedenle bunu planlayamazsınız. Bazı veriler işlenmemiş kalabilir. Kullanarak programsız bir birleştirme çalıştırabilirsiniz, ancak `OPTIMIZE` sorgu, kullanmaya güvenmeyin, çünkü `OPTIMIZE` sorgu büyük miktarda veri okuyacak ve yazacaktır. + +Böyle, `ReplacingMergeTree` yerden tasarruf etmek için arka planda yinelenen verileri temizlemek için uygundur, ancak kopyaların yokluğunu garanti etmez. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[PRIMARY KEY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +İstek parametrelerinin açıklaması için bkz. [istek açıklaması](../../../sql-reference/statements/create.md). + +**ReplacingMergeTree Parametreleri** + +- `ver` — column with version. Type `UInt*`, `Date` veya `DateTime`. İsteğe bağlı parametre. + + Birleş whenirken, `ReplacingMergeTree` aynı birincil anahtara sahip tüm satırlardan sadece bir tane bırakır: + + - Seç inimde son, eğer `ver` set değil. + - Maksimum sürümü ile, eğer `ver` belirtilen. + +**Sorgu yan tümceleri** + +Oluştururken bir `ReplacingMergeTree` tablo aynı [yanlar](mergetree.md) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +Hariç tüm parametreler `ver` içinde olduğu gibi aynı anlama sahip `MergeTree`. + +- `ver` - sürümü ile sütun. İsteğe bağlı parametre. Bir açıklama için yukarıdaki metne bakın. + +
+ +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/tr/engines/table-engines/mergetree-family/replication.md b/docs/tr/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..68a130a78c6 --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,218 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 31 +toc_title: "Veri \xC7o\u011Faltma" +--- + +# Veri Çoğaltma {#table_engines-replication} + +Çoğaltma yalnızca mergetree ailesindeki tablolar için desteklenir: + +- ReplicatedMergeTree +- ReplicatedSummingMergeTree +- ReplicatedReplacingMergeTree +- ReplicatedAggregatingMergeTree +- ReplicatedCollapsingMergeTree +- ReplicatedVersionedCollapsingMergetree +- ReplicatedGraphiteMergeTree + +Çoğaltma, tüm sunucu değil, tek bir tablo düzeyinde çalışır. Bir sunucu hem çoğaltılmış hem de çoğaltılmamış tabloları aynı anda depolayabilir. + +Çoğaltma, parçaya bağlı değildir. Her parçanın kendi bağımsız çoğaltması vardır. + +İçin sıkıştırılmış veri `INSERT` ve `ALTER` sorgular çoğaltılır (daha fazla bilgi için bkz. [ALTER](../../../sql-reference/statements/alter.md#query_language_queries_alter)). + +`CREATE`, `DROP`, `ATTACH`, `DETACH` ve `RENAME` sorgular tek bir sunucuda yürütülür ve çoğaltılmaz: + +- Bu `CREATE TABLE` sorgu sorgu çalıştırıldığı sunucuda yeni bir replicatable tablo oluşturur. Bu tablo diğer sunucularda zaten varsa, yeni bir yineleme ekler. +- Bu `DROP TABLE` sorgu, sorgunun çalıştırıldığı sunucuda bulunan yinelemeyi siler. +- Bu `RENAME` sorgu yinelemeler birinde tabloyu yeniden adlandırır. Başka bir deyişle, çoğaltılmış tablolar farklı yinelemeler üzerinde farklı adlara sahip olabilir. + +ClickHouse kullanır [Apache ZooKeeper](https://zookeeper.apache.org) kopyaları meta bilgilerini saklamak için. ZooKeeper sürüm 3.4.5 veya daha yeni kullanın. + +Çoğaltma kullanmak için, parametreleri [zookeeper](../../../operations/server-configuration-parameters/settings.md#server-settings_zookeeper) sunucu yapılandırma bölümü. + +!!! attention "Dikkat" + Güvenlik ayarını ihmal etmeyin. ClickHouse destekler `digest` [ACLL şeması](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) ZooKeeper Güvenlik alt sisteminin. + +ZooKeeper kümesinin adreslerini ayarlama örneği: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +Varolan herhangi bir ZooKeeper kümesini belirtebilirsiniz ve sistem kendi verileri için bir dizin kullanır (replicatable tablo oluştururken dizin belirtilir). + +Zookeeper yapılandırma dosyasında ayarlanmamışsa, çoğaltılmış tablolar oluşturamazsınız ve varolan çoğaltılmış tablolar salt okunur olacaktır. + +ZooKeeper kullanılmaz `SELECT` çoğaltma performansını etkilemez çünkü sorgular `SELECT` ve sorgular, çoğaltılmamış tablolar için yaptıkları kadar hızlı çalışır. Dağıtılmış çoğaltılmış tabloları sorgularken, ClickHouse davranışı ayarlar tarafından denetlenir [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) ve [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). + +Her biri için `INSERT` sorgu, yaklaşık on girişleri zookeeper birkaç işlemler aracılığıyla eklenir. (Daha kesin olmak gerekirse, bu eklenen her veri bloğu içindir; bir ekleme sorgusu her bir blok veya bir blok içerir `max_insert_block_size = 1048576` satırlar.) Bu, biraz daha uzun gecikmelere yol açar `INSERT` çoğaltılmamış tablolarla karşılaştırıldığında. Ancak, birden fazla olmayan gruplar halinde veri eklemek için önerileri izlerseniz `INSERT` saniyede, herhangi bir sorun yaratmaz. Bir ZooKeeper kümesini koordine etmek için kullanılan tüm ClickHouse kümesinin toplam birkaç yüzü vardır `INSERTs` saniyede. Veri eklerindeki verim (saniyede satır sayısı), çoğaltılmamış veriler için olduğu kadar yüksektir. + +Çok büyük kümeler için, farklı kırıklar için farklı ZooKeeper kümelerini kullanabilirsiniz. Ancak, bu Yandex’de gerekli değildir.Metrica küme (yaklaşık 300 sunucu). + +Çoğaltma zaman uyumsuz ve çok ana. `INSERT` sorgular (yanı sıra `ALTER`) mevcut herhangi bir sunucuya gönderilebilir. Veri sorgu çalıştırıldığı sunucuda eklenir ve sonra diğer sunuculara kopyalanır. Zaman uyumsuz olduğundan, son eklenen veriler bazı gecikme ile diğer yinelemeler görünür. Yinelemelerin bir kısmı mevcut değilse, veriler kullanılabilir olduklarında yazılır. Bir çoğaltma varsa, gecikme, sıkıştırılmış veri bloğunu ağ üzerinden aktarmak için gereken süredir. + +Varsayılan olarak, bir INSERT sorgusu yalnızca bir yinelemeden veri yazma onayı bekler. Verileri başarıyla yalnızca bir yineleme için yazılmıştır ve bu yineleme ile sunucu varolmaya sona erer, depolanan veriler kaybolur. Birden çok yinelemeden veri yazma onayını almayı etkinleştirmek için `insert_quorum` seçenek. + +Her veri bloğu atomik olarak yazılır. Ekle sorgusu kadar bloklara ayrılmıştır `max_insert_block_size = 1048576` satırlar. Diğer bir deyişle, `INSERT` sorgu 1048576 satırdan daha az, atomik olarak yapılır. + +Veri blokları tekilleştirilmiştir. Aynı veri bloğunun (aynı sırayla aynı satırları içeren aynı boyuttaki veri blokları) birden fazla yazımı için, blok yalnızca bir kez yazılır. Bunun nedeni, istemci uygulaması verilerin DB’YE yazılıp yazılmadığını bilmediğinde ağ arızaları durumunda, `INSERT` sorgu sadece tekrar edilebilir. Hangi çoğaltma eklerinin aynı verilerle gönderildiği önemli değildir. `INSERTs` idempotent vardır. Tekilleştirme parametreleri tarafından kontrol edilir [merge\_tree](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-merge_tree) sunucu ayarları. + +Çoğaltma sırasında, yalnızca eklenecek kaynak veriler ağ üzerinden aktarılır. Daha fazla veri dönüşümü (birleştirme), tüm kopyalarda aynı şekilde koordine edilir ve gerçekleştirilir. Bu, ağ kullanımını en aza indirir; bu, çoğaltmaların farklı veri merkezlerinde bulunduğu zaman çoğaltmanın iyi çalıştığı anlamına gelir. (Farklı veri merkezlerinde çoğaltmanın çoğaltmanın ana hedefi olduğunu unutmayın .) + +Aynı verilerin çoğaltmaları herhangi bir sayıda olabilir. Üye.Metrica üretimde çift çoğaltma kullanır. Her sunucu, bazı durumlarda RAID-5 veya RAID-6 ve RAID-10 kullanır. Bu nispeten güvenilir ve kullanışlı bir çözümdür. + +Sistem, yinelemelerdeki veri senkronizasyonunu izler ve bir hatadan sonra kurtarabilir. Yük devretme otomatik (verilerde küçük farklılıklar için) veya yarı otomatik (veriler çok fazla farklılık gösterdiğinde, bu da bir yapılandırma hatasını gösterebilir). + +## Çoğaltılmış Tablolar Oluşturma {#creating-replicated-tables} + +Bu `Replicated` önek tablo motoru adına eklenir. Mesela:`ReplicatedMergeTree`. + +**Çoğaltılan \* MergeTree parametreleri** + +- `zoo_path` — The path to the table in ZooKeeper. +- `replica_name` — The replica name in ZooKeeper. + +Örnek: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +
+ +Kullanımdan kaldırılmış sözdizimi örneği + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +
+ +Örnekte gösterildiği gibi, bu parametreler kıvırcık köşeli ayraçlarda ikameler içerebilir. İkame edilen değerler ‘macros’ yapılandırma dosyasının bölümü. Örnek: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +Zookeeper tablonun yolunu her çoğaltılmış tablo için benzersiz olmalıdır. Farklı parçalardaki tabloların farklı yolları olmalıdır. +Bu durumda, yol aşağıdaki parçalardan oluşur: + +`/clickhouse/tables/` ortak önek. Tam olarak bunu kullanmanızı öneririz. + +`{layer}-{shard}` shard tanımlayıcısıdır. Bu örnekte Yandex’den beri iki bölümden oluşmaktadır.Metrica küme iki seviyeli sharding kullanır. Çoğu görev için, yalnızca shard tanımlayıcısına genişletilecek olan {shard} ikamesini bırakabilirsiniz. + +`table_name` ZooKeeper tablo için düğüm adıdır. Tablo adı ile aynı yapmak için iyi bir fikirdir. Açıkça tanımlanır, çünkü tablo adının aksine, bir yeniden adlandırma sorgusundan sonra değişmez. +*HINT*: önüne bir veritabanı adı ekleyebilirsiniz `table_name` yanında. E. g. `db_name.table_name` + +Çoğaltma adı, aynı tablonun farklı yinelemelerini tanımlar. Örnekte olduğu gibi bunun için sunucu adını kullanabilirsiniz. Adın sadece her parça içinde benzersiz olması gerekir. + +Değiştirmeleri kullanmak yerine parametreleri açıkça tanımlayabilirsiniz. Bu, test etmek ve küçük kümeleri yapılandırmak için uygun olabilir. Ancak, dağıtılmış DDL sorguları kullanamazsınız (`ON CLUSTER` bu durumda). + +Büyük kümelerle çalışırken, hata olasılığını azalttıkları için değiştirmeleri kullanmanızı öneririz. + +Run the `CREATE TABLE` her yineleme üzerinde sorgu. Bu sorgu, yeni bir çoğaltılmış tablo oluşturur veya varolan bir yeni bir yineleme ekler. + +Tablo zaten diğer yinelemeler üzerinde bazı veriler içerdikten sonra yeni bir yineleme eklerseniz, verileri diğer yinelemeler için yeni bir sorgu çalıştırdıktan sonra kopyalanır. Başka bir deyişle, yeni çoğaltma kendisini diğerleriyle eşitler. + +Bir yineleme silmek için çalıştırın `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. + +## Arızalardan Sonra Kurtarma {#recovery-after-failures} + +Bir sunucu başlatıldığında ZooKeeper kullanılamıyorsa, çoğaltılmış tablolar salt okunur moda geçer. Sistem periyodik olarak ZooKeeper bağlanmaya çalışır. + +ZooKeeper sırasında kullanılamıyorsa bir `INSERT`, veya ZooKeeper ile etkileşimde bulunurken bir hata oluşur, bir istisna atılır. + +ZooKeeper bağlandıktan sonra, sistem yerel dosya sistemindeki veri kümesinin beklenen veri kümesiyle eşleşip eşleşmediğini kontrol eder (ZooKeeper bu bilgileri saklar). Küçük tutarsızlıklar varsa, sistem verileri kopyalarla senkronize ederek bunları çözer. + +Sistem bozuk veri parçalarını (yanlış dosya boyutu ile) veya tanınmayan parçaları (dosya sistemine yazılmış ancak Zookeeper’da kaydedilmemiş parçalar) tespit ederse, bunları `detached` alt dizin (silinmez). Eksik parçalar kopyalardan kopyalanır. + +Clickhouse’un büyük miktarda veriyi otomatik olarak silme gibi yıkıcı eylemler gerçekleştirmediğini unutmayın. + +Sunucu başlatıldığında (veya ZooKeeper ile yeni bir oturum kurduğunda), yalnızca tüm dosyaların miktarını ve boyutlarını kontrol eder. Dosya boyutları eşleşirse, ancak bayt ortasında bir yerde değiştirilmişse, bu hemen algılanmaz, ancak yalnızca bir dosya için verileri okumaya çalışırken algılanmaz. `SELECT` sorgu. Sorgu, eşleşen olmayan bir sağlama toplamı veya sıkıştırılmış bir bloğun boyutu hakkında bir özel durum atar. Bu durumda, veri parçaları doğrulama kuyruğuna eklenir ve gerekirse kopyalardan kopyalanır. + +Yerel veri kümesi beklenenden çok fazla farklıysa, bir güvenlik mekanizması tetiklenir. Sunucu bunu günlüğe girer ve başlatmayı reddeder. Bunun nedeni, bu durumda, bir parçadaki bir kopya yanlışlıkla farklı bir parçadaki bir kopya gibi yapılandırılmışsa gibi bir yapılandırma hatası gösterebilir. Ancak, bu mekanizma için eşikleri oldukça düşük ayarlanır ve bu durum normal hata kurtarma sırasında ortaya çıkabilir. Bu durumda, veriler yarı otomatik olarak geri yüklenir “pushing a button”. + +Kurtarma işlemini başlatmak için düğümü oluşturun `/path_to_table/replica_name/flags/force_restore_data` herhangi bir içerik ile ZooKeeper veya tüm çoğaltılmış tabloları geri yüklemek için komutu çalıştırın: + +``` bash +sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +Sunucuyu yeniden başlatın. Başlangıçta, sunucu bu bayrakları siler ve kurtarma işlemini başlatır. + +## Tam Veri Kaybından Sonra Kurtarma {#recovery-after-complete-data-loss} + +Tüm veriler ve meta veriler sunuculardan birinden kaybolduysa, kurtarma için şu adımları izleyin: + +1. Clickhouse’u sunucuya yükleyin. Bunları kullanırsanız, shard tanımlayıcısı ve yinelemeleri içeren yapılandırma dosyasında doğru değiştirmelerin tanımlayın. +2. Sunucularda el ile çoğaltılması gereken yinelenmemiş tablolar varsa, verilerini bir kopyadan kopyalayın (dizinde `/var/lib/clickhouse/data/db_name/table_name/`). +3. Bulunan tablo tanım copylarını kopyala `/var/lib/clickhouse/metadata/` bir kopyadan. Tablo tanımlarında bir parça veya çoğaltma tanımlayıcısı açıkça tanımlanmışsa, bu kopyaya karşılık gelecek şekilde düzeltin. (Alternatif olarak, sunucuyu başlatın ve tüm `ATTACH TABLE` içinde olması gereken sorgular .sql dosyaları `/var/lib/clickhouse/metadata/`.) +4. Kurtarma işlemini başlatmak için ZooKeeper düğümünü oluşturun `/path_to_table/replica_name/flags/force_restore_data` herhangi bir içerikle veya tüm çoğaltılmış tabloları geri yüklemek için komutu çalıştırın: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +Ardından sunucuyu başlatın (zaten çalışıyorsa yeniden başlatın). Veriler kopyalardan indirilecektir. + +Alternatif bir kurtarma seçeneği zookeeper kayıp yineleme hakkında bilgi silmektir (`/path_to_table/replica_name`), daha sonra açıklandığı gibi yinelemeyi tekrar oluşturun “[Çoğaltılmış tablolar oluşturma](#creating-replicated-tables)”. + +Kurtarma sırasında ağ bant genişliği üzerinde herhangi bir kısıtlama yoktur. Aynı anda birçok yinelemeyi geri yüklüyorsanız bunu aklınızda bulundurun. + +## Mergetree’den Replicatedmergetree’ye Dönüştürme {#converting-from-mergetree-to-replicatedmergetree} + +Terimi kullanıyoruz `MergeTree` tüm tablo motorlarına başvurmak için `MergeTree family` için aynı `ReplicatedMergeTree`. + +Eğer olsaydı bir `MergeTree` el ile çoğaltılmış tablo, çoğaltılmış bir tabloya dönüştürebilirsiniz. Zaten büyük miktarda veri topladıysanız bunu yapmanız gerekebilir. `MergeTree` tablo ve şimdi çoğaltmayı etkinleştirmek istiyorsunuz. + +Veriler çeşitli yinelemelerde farklılık gösteriyorsa, önce onu eşitleyin veya bu verileri biri dışındaki tüm yinelemelerde silin. + +Varolan MergeTree tablosunu yeniden adlandırın, sonra bir `ReplicatedMergeTree` eski adı olan tablo. +Eski tablodan veri taşıma `detached` yeni tablo verileri ile dizin içindeki alt dizin (`/var/lib/clickhouse/data/db_name/table_name/`). +Sonra koş `ALTER TABLE ATTACH PARTITION` bu veri parçalarını çalışma kümesine eklemek için yinelemelerden birinde. + +## Replicatedmergetree’den Mergetree’ye Dönüştürme {#converting-from-replicatedmergetree-to-mergetree} + +Farklı bir adla bir MergeTree tablosu oluşturun. İle dizinden tüm verileri taşıyın `ReplicatedMergeTree` yeni tablonun veri dizinine tablo verileri. Sonra Sil `ReplicatedMergeTree` tablo ve sunucuyu yeniden başlatın. + +Eğer bir kurtulmak istiyorsanız `ReplicatedMergeTree` sunucu başlatmadan tablo: + +- İlgili sil `.sql` meta veri dizinindeki dosya (`/var/lib/clickhouse/metadata/`). +- ZooKeeper ilgili yolu silin (`/path_to_table/replica_name`). + +Bundan sonra, sunucuyu başlatabilir, bir `MergeTree` tablo, verileri kendi dizinine taşıyın ve sonra sunucuyu yeniden başlatın. + +## Zookeeper kümesindeki Meta Veriler kaybolduğunda Veya Zarar gördüğünde Kurtarma {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} + +ZooKeeper içindeki veriler kaybolduysa veya hasar gördüyse, verileri yukarıda açıklandığı gibi yinelenmemiş bir tabloya taşıyarak kaydedebilirsiniz. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/tr/engines/table-engines/mergetree-family/summingmergetree.md b/docs/tr/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..d937ca5371f --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,141 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 34 +toc_title: SummingMergeTree +--- + +# SummingMergeTree {#summingmergetree} + +Motor devralır [MergeTree](mergetree.md#table_engines-mergetree). Fark, veri parçalarını birleştirirken `SummingMergeTree` tablolar ClickHouse tüm satırları aynı birincil anahtarla değiştirir (veya daha doğru olarak, aynı [sıralama anahtarı](mergetree.md)) sayısal veri türüne sahip sütunlar için özetlenen değerleri içeren bir satır ile. Sıralama anahtarı, tek bir anahtar değeri çok sayıda satıra karşılık gelecek şekilde oluşturulursa, bu, depolama birimini önemli ölçüde azaltır ve veri seçimini hızlandırır. + +Motoru birlikte kullanmanızı öneririz `MergeTree`. Mağaza tam veri `MergeTree` tablo ve kullanım `SummingMergeTree` örneğin, rapor hazırlarken toplu veri depolamak için. Böyle bir yaklaşım, yanlış oluşturulmuş bir birincil anahtar nedeniyle değerli verileri kaybetmenizi önleyecektir. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = SummingMergeTree([columns]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +İstek parametrelerinin açıklaması için bkz. [istek açıklaması](../../../sql-reference/statements/create.md). + +**SummingMergeTree parametreleri** + +- `columns` - değerlerin özetleneceği sütunların adlarına sahip bir tuple. İsteğe bağlı parametre. + Sütunlar sayısal tipte olmalı ve birincil anahtarda olmamalıdır. + + Eğer `columns` belirtilmemiş, ClickHouse birincil anahtarda olmayan bir sayısal veri türü ile tüm sütunlardaki değerleri özetler. + +**Sorgu yan tümceleri** + +Oluştururken bir `SummingMergeTree` tablo aynı [yanlar](mergetree.md) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) +``` + +Hariç tüm parametreler `columns` içinde olduğu gibi aynı anlama sahip `MergeTree`. + +- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. + +
+ +## Kullanım Örneği {#usage-example} + +Aşağıdaki tabloyu düşünün: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +Veri Ekle: + +``` sql +INSERT INTO summtt Values(1,1),(1,2),(2,1) +``` + +ClickHouse tüm satırları tamamen toplayabilir ([aşağıya bakın](#data-processing)), bu yüzden bir toplama işlevi kullanıyoruz `sum` ve `GROUP BY` sorguda yan tümcesi. + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + +``` text +┌─key─┬─sum(value)─┐ +│ 2 │ 1 │ +│ 1 │ 3 │ +└─────┴────────────┘ +``` + +## Veri İşleme {#data-processing} + +Veriler bir tabloya eklendiğinde, bunlar olduğu gibi kaydedilir. ClickHouse, verilerin eklenen bölümlerini periyodik olarak birleştirir ve bu, aynı birincil anahtara sahip satırların toplandığı ve sonuçta elde edilen her veri parçası için bir tane ile değiştirildiği zamandır. + +ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) bir toplama fonksiyonu [toplam()](../../../sql-reference/aggregate-functions/reference.md#agg_function-sum) ve `GROUP BY` yukarıdaki örnekte açıklandığı gibi yan tümcesi bir sorguda kullanılmalıdır. + +### Toplama İçin Ortak Kurallar {#common-rules-for-summation} + +Sayısal veri türüne sahip sütunlardaki değerler özetlenir. Sütun kümesi parametre tarafından tanımlanır `columns`. + +Değerler toplamı için tüm sütunlarda 0 ise, satır silinir. + +Sütun birincil anahtarda değilse ve özetlenmezse, mevcut olanlardan rasgele bir değer seçilir. + +Değerler, birincil anahtardaki sütunlar için özetlenmez. + +### Aggregatefunction Sütunlarındaki Toplama {#the-summation-in-the-aggregatefunction-columns} + +Sütunlar için [AggregateFunction türü](../../../sql-reference/data-types/aggregatefunction.md) ClickHouse olarak davranır [AggregatingMergeTree](aggregatingmergetree.md) işleve göre motor toplama. + +### İç İçe Yapılar {#nested-structures} + +Tablo, özel bir şekilde işlenen iç içe geçmiş veri yapılarına sahip olabilir. + +İç içe geçmiş bir tablonun adı ile bitiyorsa `Map` ve aşağıdaki kriterleri karşılayan en az iki sütun içerir: + +- ilk sütun sayısal `(*Int*, Date, DateTime)` veya bir dize `(String, FixedString)` hadi diyelim `key`, +- diğer sütunlar aritmetik `(*Int*, Float32/64)` hadi diyelim `(values...)`, + +sonra bu iç içe geçmiş tablo bir eşleme olarak yorumlanır `key => (values...)` ve satırlarını birleştirirken, iki veri kümesinin öğeleri şu şekilde birleştirilir `key` karşılık gelen bir toplamı ile `(values...)`. + +Örnekler: + +``` text +[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] +[(1, 100)] + [(1, 150)] -> [(1, 250)] +[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] +[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] +``` + +Veri isterken, [sumMap (anahtar, değer)](../../../sql-reference/aggregate-functions/reference.md) toplama fonksiyonu `Map`. + +İç içe geçmiş veri yapısı için, sütunlarının toplamı için sütun kümesinde belirtmeniz gerekmez. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/tr/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/tr/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..72b896df42a --- /dev/null +++ b/docs/tr/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,238 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 37 +toc_title: VersionedCollapsingMergeTree +--- + +# VersionedCollapsingMergeTree {#versionedcollapsingmergetree} + +Bu motor: + +- Sürekli değişen nesne durumlarının hızlı yazılmasını sağlar. +- Arka planda eski nesne durumlarını siler. Bu, depolama hacmini önemli ölçüde azaltır. + +Bölümüne bakınız [Çökme](#table_engines_versionedcollapsingmergetree) ayrıntılar için. + +Motor devralır [MergeTree](mergetree.md#table_engines-mergetree) ve veri parçalarını birleştirmek için algoritmaya satırları daraltmak için mantığı ekler. `VersionedCollapsingMergeTree` aynı amaca hizmet eder [CollapsingMergeTree](collapsingmergetree.md) ancak, verilerin birden çok iş parçacığıyla herhangi bir sıraya yerleştirilmesine izin veren farklı bir çökme algoritması kullanır. Özellikle, `Version` sütun, yanlış sıraya yerleştirilmiş olsalar bile satırları düzgün bir şekilde daraltmaya yardımcı olur. Tersine, `CollapsingMergeTree` sadece kesinlikle ardışık ekleme sağlar. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +Sorgu parametrelerinin açıklaması için bkz: [sorgu açıklaması](../../../sql-reference/statements/create.md). + +**Motor Parametreleri** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Name of the column with the type of row: `1` is a “state” satır, `-1` is a “cancel” satır. + + Sütun veri türü olmalıdır `Int8`. + +- `version` — Name of the column with the version of the object state. + + Sütun veri türü olmalıdır `UInt*`. + +**Sorgu Yan Tümceleri** + +Oluştururken bir `VersionedCollapsingMergeTree` tablo, aynı [yanlar](mergetree.md) oluşturul aurken gerekli `MergeTree` Tablo. + +
+ +Bir tablo oluşturmak için kullanımdan kaldırılan yöntem + +!!! attention "Dikkat" + Bu yöntemi yeni projelerde kullanmayın. Mümkünse, eski projeleri yukarıda açıklanan yönteme geçin. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +Dışındaki tüm parametreler `sign` ve `version` içinde olduğu gibi aynı anlama sahip `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` is a “state” satır, `-1` is a “cancel” satır. + + Column Data Type — `Int8`. + +- `version` — Name of the column with the version of the object state. + + Sütun veri türü olmalıdır `UInt*`. + +
+ +## Çökme {#table_engines-versionedcollapsingmergetree} + +### Veriler {#data} + +Bazı nesneler için sürekli değişen verileri kaydetmeniz gereken bir durumu düşünün. Bir nesne için bir satıra sahip olmak ve değişiklikler olduğunda satırı güncellemek mantıklıdır. Ancak, depolama alanındaki verileri yeniden yazmayı gerektirdiğinden, güncelleştirme işlemi bir DBMS için pahalı ve yavaştır. Verileri hızlı bir şekilde yazmanız gerekiyorsa güncelleştirme kabul edilemez, ancak değişiklikleri bir nesneye sırayla aşağıdaki gibi yazabilirsiniz. + +Kullan… `Sign` satır yazarken sütun. Eğer `Sign = 1` bu, satırın bir nesnenin durumu olduğu anlamına gelir (diyelim “state” satır). Eğer `Sign = -1` aynı özelliklere sahip bir nesnenin durumunun iptal edildiğini gösterir (buna “cancel” satır). Ayrıca kullanın `Version` bir nesnenin her durumunu ayrı bir sayı ile tanımlaması gereken sütun. + +Örneğin, kullanıcıların bazı sitede kaç sayfa ziyaret ettiğini ve ne kadar süre orada olduklarını hesaplamak istiyoruz. Bir noktada, kullanıcı etkinliği durumu ile aşağıdaki satırı yazıyoruz: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Bir noktada daha sonra kullanıcı aktivitesinin değişikliğini kaydediyoruz ve aşağıdaki iki satırla yazıyoruz. + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +İlk satır, nesnenin (kullanıcı) önceki durumunu iptal eder. Dışında iptal edilen Devletin tüm alanlarını kopya shouldlama shouldlıdır `Sign`. + +İkinci satır geçerli durumu içerir. + +Sadece kullanıcı etkinliğinin son durumuna ihtiyacımız olduğundan, satırlar + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +nesnenin geçersiz (eski) durumunu daraltarak silinebilir. `VersionedCollapsingMergeTree` veri parçalarını birleştirirken bunu yapar. + +Her değişiklik için neden iki satıra ihtiyacımız olduğunu bulmak için bkz. [Algoritma](#table_engines-versionedcollapsingmergetree-algorithm). + +**Kullanımı ile ilgili notlar** + +1. Verileri yazan program, iptal etmek için bir nesnenin durumunu hatırlamalıdır. Bu “cancel” dize bir kopyası olmalıdır “state” tersi ile dize `Sign`. Bu, ilk depolama boyutunu arttırır, ancak verileri hızlı bir şekilde yazmanıza izin verir. +2. Sütunlardaki uzun büyüyen diziler, yazma yükü nedeniyle motorun verimliliğini azaltır. Daha basit veri, daha iyi verim. +3. `SELECT` sonuçlara itiraz değişiklikleri tarihinin tutarlılık bağlıdır. Ekleme için veri hazırlarken doğru olun. Oturum derinliği gibi negatif olmayan metrikler için negatif değerler gibi tutarsız verilerle öngörülemeyen sonuçlar alabilirsiniz. + +### Algoritma {#table_engines-versionedcollapsingmergetree-algorithm} + +ClickHouse veri parçalarını birleştirdiğinde, aynı birincil anahtar ve sürüm ve farklı olan her satır çiftini siler `Sign`. Satırların sırası önemli değil. + +ClickHouse veri eklediğinde, satırları birincil anahtarla sipariş eder. Eğer… `Version` sütun birincil anahtarda değil, ClickHouse onu birincil anahtara örtük olarak son alan olarak ekler ve sipariş vermek için kullanır. + +## Veri Seçme {#selecting-data} + +ClickHouse, aynı birincil anahtara sahip tüm satırların aynı sonuçtaki veri bölümünde veya hatta aynı fiziksel sunucuda olacağını garanti etmez. Bu, hem verileri yazmak hem de veri parçalarının daha sonra birleştirilmesi için geçerlidir. Ayrıca, ClickHouse süreçleri `SELECT` birden çok iş parçacıklarıyla sorgular ve sonuçtaki satırların sırasını tahmin edemez. Bu tamamen almak için bir ihtiyaç varsa toplama gerekli olduğu anlamına gelir “collapsed” bir veri `VersionedCollapsingMergeTree` Tablo. + +Daraltmayı sonuçlandırmak için, bir sorgu ile bir sorgu yazın `GROUP BY` yan tümce ve işareti için hesap toplama işlevleri. Örneğin, miktarı hesaplamak için kullanın `sum(Sign)` yerine `count()`. Bir şeyin toplamını hesaplamak için şunları kullanın `sum(Sign * x)` yerine `sum(x)` ve Ekle `HAVING sum(Sign) > 0`. + +Toplanan `count`, `sum` ve `avg` bu şekilde hesaplanabilir. Toplanan `uniq` bir nesnenin en az bir daraltılmamış durumu varsa hesaplanabilir. Toplanan `min` ve `max` hesaplan becauseamaz çünkü `VersionedCollapsingMergeTree` çökmüş durumların değerlerinin geçmişini kaydetmez. + +İle verileri ayıklamak gerekiyorsa “collapsing” ancak toplama olmadan (örneğin, en yeni değerleri belirli koşullarla eşleşen satırların mevcut olup olmadığını kontrol etmek için) `FINAL` değiştirici için `FROM` yan. Bu yaklaşım verimsizdir ve büyük tablolarla kullanılmamalıdır. + +## Kullanım Örneği {#example-of-use} + +Örnek veriler: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Tablo oluşturma: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +Veri ekleme: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +Biz iki kullanın `INSERT` iki farklı veri parçası oluşturmak için sorgular. Verileri tek bir sorgu ile eklersek, ClickHouse bir veri parçası oluşturur ve hiçbir zaman birleştirme gerçekleştirmez. + +Veri alma: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Burada ne görüyoruz ve çökmüş parçalar nerede? +İki veri parçasını iki kullanarak oluşturduk `INSERT` sorgular. Bu `SELECT` sorgu iki iş parçacığında gerçekleştirildi ve sonuç rastgele bir satır sırasıdır. +Veri bölümleri henüz birleştirilmediği için çökme gerçekleşmedi. ClickHouse biz tahmin edemez zaman içinde bilinmeyen bir noktada veri parçalarını birleştirir. + +Bu yüzden toplamaya ihtiyacımız var: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +Toplamaya ihtiyacımız yoksa ve çökmeyi zorlamak istiyorsak, `FINAL` değiştirici için `FROM` yan. + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +Bu, verileri seçmek için çok verimsiz bir yoldur. Büyük tablolar için kullanmayın. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/tr/engines/table-engines/special/buffer.md b/docs/tr/engines/table-engines/special/buffer.md new file mode 100644 index 00000000000..f15e2a5407a --- /dev/null +++ b/docs/tr/engines/table-engines/special/buffer.md @@ -0,0 +1,71 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 45 +toc_title: Arabellek +--- + +# Arabellek {#buffer} + +RAM’de yazmak için verileri tamponlar, periyodik olarak başka bir tabloya temizler. Okuma işlemi sırasında veri arabellekten ve diğer tablodan aynı anda okunur. + +``` sql +Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) +``` + +Motor parametreleri: + +- `database` – Database name. Instead of the database name, you can use a constant expression that returns a string. +- `table` – Table to flush data to. +- `num_layers` – Parallelism layer. Physically, the table will be represented as `num_layers` bağımsız tamponların. Önerilen değer: 16. +- `min_time`, `max_time`, `min_rows`, `max_rows`, `min_bytes`, ve `max_bytes` – Conditions for flushing data from the buffer. + +Veri arabellekten temizlendi ve hedef tabloya yazılır eğer tüm `min*` koşulları veya en az bir `max*` koşul karşı arelanır. + +- `min_time`, `max_time` – Condition for the time in seconds from the moment of the first write to the buffer. +- `min_rows`, `max_rows` – Condition for the number of rows in the buffer. +- `min_bytes`, `max_bytes` – Condition for the number of bytes in the buffer. + +Yazma işlemi sırasında veri bir `num_layers` rastgele tampon sayısı. Veya, eklenecek veri kısmı yeterince büyükse (daha büyük `max_rows` veya `max_bytes`), arabelleği atlayarak doğrudan hedef tabloya yazılır. + +Verilerin yıkanması için koşullar, her biri için ayrı ayrı hesaplanır. `num_layers` arabellekler. Örneğin, `num_layers = 16` ve `max_bytes = 100000000`, maksimum RAM tüketimi 1,6 GB’DİR. + +Örnek: + +``` sql +CREATE TABLE merge.hits_buffer AS merge.hits ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000) +``` + +Oluşturma Bir ‘merge.hits\_buffer’ ile aynı yapıya sahip tablo ‘merge.hits’ ve Tampon motorunu kullanarak. Bu tabloya yazarken, veriler RAM’de arabelleğe alınır ve daha sonra ‘merge.hits’ Tablo. 16 tamponlar oluşturulur. 100 saniye geçti veya bir milyon satır yazılmış veya 100 MB veri yazılmıştır; ya da aynı anda 10 saniye geçti ve 10.000 satır ve 10 MB veri yazılmıştır, bunların her veri temizlendi. Örneğin, sadece bir satır yazılmışsa, 100 saniye sonra ne olursa olsun, yıkanacaktır. Ancak, birçok satır yazılmışsa, veriler daha erken temizlenecektir. + +Sunucu DROP TABLE veya DETACH TABLE ile durdurulduğunda, arabellek verileri de hedef tabloya temizlendi. + +Veritabanı ve tablo adı için tek tırnak içinde boş dizeleri ayarlayabilirsiniz. Bu, bir hedef tablonun yokluğunu gösterir. Bu durumda, Veri Temizleme koşullarına ulaşıldığında, arabellek basitçe temizlenir. Bu, bir veri penceresini bellekte tutmak için yararlı olabilir. + +Bir arabellek tablosundan okurken, veriler hem arabellekten hem de hedef tablodan (varsa) işlenir. +Arabellek tabloları bir dizin desteklemediğini unutmayın. Başka bir deyişle, arabellekteki veriler tamamen taranır, bu da büyük arabellekler için yavaş olabilir. (Alt tablodaki veriler için, desteklediği dizin kullanılacaktır.) + +Arabellek tablosundaki sütun kümesi, alt tablodaki sütun kümesiyle eşleşmiyorsa, her iki tabloda da bulunan sütunların bir alt kümesi eklenir. + +Türleri arabellek tablo ve alt tablo sütunlarından biri için eşleşmiyorsa, sunucu günlüğüne bir hata iletisi girilir ve arabellek temizlenir. +Arabellek temizlendiğinde alt tablo yoksa aynı şey olur. + +Eğer bağımlı bir tablo ve Tampon tablo için ALTER çalıştırmak gerekiyorsa, ilk Tampon tablo silme, alt tablo için ALTER çalışan, sonra tekrar Tampon tablo oluşturma öneririz. + +Sunucu anormal şekilde yeniden başlatılırsa, arabellekteki veriler kaybolur. + +Son ve örnek arabellek tabloları için düzgün çalışmıyor. Bu koşullar hedef tabloya geçirilir, ancak arabellekte veri işlemek için kullanılmaz. Bu özellikler gerekiyorsa, hedef tablodan okurken yalnızca yazma için arabellek tablosunu kullanmanızı öneririz. + +Bir arabelleğe veri eklerken, arabelleklerden biri kilitlenir. Bir okuma işlemi aynı anda tablodan gerçekleştiriliyor, bu gecikmelere neden olur. + +Bir arabellek tablosuna eklenen veriler, alt tabloda farklı bir sırada ve farklı bloklarda sonuçlanabilir. Bu nedenle, bir arabellek tablo CollapsingMergeTree doğru yazmak için kullanmak zordur. Sorunları önlemek için şunları ayarlayabilirsiniz ‘num\_layers’ 1’e. + +Hedef tablo yinelenirse, bir arabellek tablosuna yazarken yinelenmiş tabloların bazı beklenen özellikleri kaybolur. Satır ve veri parçaları boyutlarda sipariş için rasgele değişiklikler veri çoğaltma güvenilir olması mümkün olmadığını ifade eden çalışma, kapanmasına neden ‘exactly once’ çoğaltılan tablolara yazın. + +Bu dezavantajlardan dolayı, nadir durumlarda yalnızca bir arabellek tablosu kullanmanızı önerebiliriz. + +Bir arabellek tablosu, bir zaman birimi üzerinden çok sayıda sunucudan çok fazla ekleme alındığında kullanılır ve ekleme işleminden önce veri arabelleğe alınamaz, bu da eklerin yeterince hızlı çalışamayacağı anlamına gelir. + +Arabellek tabloları için bile, her seferinde bir satır veri eklemek mantıklı olmadığını unutmayın. Bu, yalnızca saniyede birkaç bin satırlık bir hız üretirken, daha büyük veri blokları eklemek saniyede bir milyondan fazla satır üretebilir (bölüme bakın “Performance”). + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/buffer/) diff --git a/docs/tr/engines/table-engines/special/dictionary.md b/docs/tr/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..be3d5b5a72d --- /dev/null +++ b/docs/tr/engines/table-engines/special/dictionary.md @@ -0,0 +1,97 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 35 +toc_title: "S\xF6zl\xFCk" +--- + +# Sözlük {#dictionary} + +Bu `Dictionary` motor görüntüler [sözlük](../../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) bir ClickHouse tablo olarak veri. + +Örnek olarak, bir sözlük düşünün `products` aşağıdaki yapılandırma ile: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +Sözlük verilerini sorgula: + +``` sql +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + +``` text +┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ +│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ +└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ +``` + +Kullanabilirsiniz [dictGet\*](../../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions) sözlük verilerini bu formatta almak için işlev. + +Bu görünüm, ham veri almanız gerektiğinde veya bir `JOIN` işleyiş. Bu durumlar için şunları kullanabilirsiniz `Dictionary` bir tabloda sözlük verilerini görüntüleyen motor. + +Sözdizimi: + +``` sql +CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` +``` + +Kullanım örneği: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); +``` + + Ok + +Masada ne olduğuna bir bak. + +``` sql +select * from products limit 1; +``` + +``` text +┌────product_id─┬─title───────────┐ +│ 152689 │ Some item │ +└───────────────┴─────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/tr/engines/table-engines/special/distributed.md b/docs/tr/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..951aa3ec9e2 --- /dev/null +++ b/docs/tr/engines/table-engines/special/distributed.md @@ -0,0 +1,152 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 33 +toc_title: "Da\u011F\u0131l\u0131" +--- + +# Dağılı {#distributed} + +**Dağıtılmış altyapısı olan tablolar kendileri tarafından herhangi bir veri depolamaz**, ancak birden çok sunucuda dağıtılmış sorgu işleme izin verir. +Okuma otomatik olarak paralelleştirilir. Bir okuma sırasında, varsa uzak sunucularda tablo dizinleri kullanılır. + +Dağıtılmış motor parametreleri kabul eder: + +- sunucunun yapılandırma dosyasındaki küme adı + +- uzak veritabanı adı + +- uzak bir tablonun adı + +- (isteğe bağlı olarak) sharding anahtarı + +- (isteğe bağlı olarak) ilke adı, zaman uyumsuz göndermek için geçici dosyaları depolamak için kullanılacaktır + + Ayrıca bakınız: + + - `insert_distributed_sync` ayar + - [MergeTree](../mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) örnekler için + +Örnek: + +``` sql +Distributed(logs, default, hits[, sharding_key[, policy_name]]) +``` + +Veri tüm sunuculardan okunacak ‘logs’ küme, varsayılan değerden.kümedeki her sunucuda bulunan hits tablosu. +Veriler yalnızca okunmakla kalmaz, aynı zamanda uzak sunucularda kısmen işlenir (bunun mümkün olduğu ölçüde). +Örneğin, GROUP BY ile bir sorgu için uzak sunucularda veri toplanır ve toplama işlevlerinin Ara durumları istek sahibi sunucuya gönderilir. Daha sonra veriler daha fazla toplanacaktır. + +Veritabanı adı yerine, bir dize döndüren sabit bir ifade kullanabilirsiniz. Örneğin: currentDatabase (). + +logs – The cluster name in the server’s config file. + +Kümeler şöyle ayarlanır: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 1 + 9440 + + + + +``` + +Burada bir küme adı ile tanımlanır ‘logs’ bu, her biri iki kopya içeren iki parçadan oluşur. +Kırıklar, verilerin farklı bölümlerini içeren sunuculara başvurur (tüm verileri okumak için tüm kırıklara erişmeniz gerekir). +Yinelemeler sunucuları çoğaltılıyor (tüm verileri okumak için, yinelemelerden herhangi birinde verilere erişebilirsiniz). + +Küme adları nokta içermemelidir. + +Parametre `host`, `port` ve isteğe bağlı olarak `user`, `password`, `secure`, `compression` her sunucu için belirtilir: +- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn’t start. If you change the DNS record, restart the server. +- `port` – The TCP port for messenger activity (‘tcp\_port’ yapılandırmada, genellikle 9000 olarak ayarlanır). Http\_port ile karıştırmayın. +- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Erişim hakları](../../../operations/access-rights.md). +- `password` – The password for connecting to a remote server (not masked). Default value: empty string. +- `secure` - Bağlantı için ssl kullanın, genellikle de tanımlamanız gerekir `port` = 9440. Sunucu dinlem shouldeli 9440 ve doğru sertifikalara sahip. +- `compression` - Kullanım veri sıkıştırma. Varsayılan değer: true. + +When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [dengeleme](../../../operations/settings/settings.md#settings-load_balancing) ayar. +Sunucu ile bağlantı kurulmamışsa, kısa bir zaman aşımı ile bağlanma girişimi olacaktır. Bağlantı başarısız olursa, sonraki yineleme seçilir ve benzeri tüm yinelemeler için. Bağlantı girişimi tüm yinelemeler için başarısız olursa, girişimi aynı şekilde, birkaç kez tekrarlanır. +Bu esneklik lehine çalışır, ancak tam hataya dayanıklılık sağlamaz: uzak bir sunucu bağlantıyı kabul edebilir, ancak çalışmayabilir veya kötü çalışabilir. + +Parçalardan yalnızca birini belirtebilirsiniz (bu durumda, sorgu işleme dağıtılmış yerine uzak olarak adlandırılmalıdır) veya herhangi bir sayıda parçaya kadar. Her parçada, bir ila herhangi bir sayıda yinelemeyi belirtebilirsiniz. Her parça için farklı sayıda çoğaltma belirtebilirsiniz. + +Yapılandırmada istediğiniz kadar küme belirtebilirsiniz. + +Kümelerinizi görüntülemek için ‘system.clusters’ Tablo. + +Dağıtılmış motor, yerel bir sunucu gibi bir küme ile çalışmaya izin verir. Ancak, küme uzatılamaz: yapılandırmasını sunucu yapılandırma dosyasına yazmanız gerekir (tüm kümenin sunucuları için daha da iyisi). + +The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don’t need to create a Distributed table – use the ‘remote’ bunun yerine tablo işlevi. Bölümüne bakınız [Tablo fonksiyonları](../../../sql-reference/table-functions/index.md). + +Bir kümeye veri yazmak için iki yöntem vardır: + +İlk olarak, hangi sunucuların hangi verileri yazacağını ve her bir parçaya doğrudan yazmayı gerçekleştireceğini tanımlayabilirsiniz. Başka bir deyişle, dağıtılmış tablo içinde INSERT gerçekleştirmek “looks at”. Bu, konu alanının gereklilikleri nedeniyle önemsiz olmayan herhangi bir sharding şemasını kullanabileceğiniz için en esnek çözümdür. Bu aynı zamanda en uygun çözümdür, çünkü veriler farklı parçalara tamamen bağımsız olarak yazılabilir. + +İkinci olarak, dağıtılmış bir tabloda ekleme gerçekleştirebilirsiniz. Bu durumda, tablo eklenen verileri sunucuların kendisine dağıtacaktır. Dağıtılmış bir tabloya yazmak için, bir sharding anahtar kümesi (son parametre) olmalıdır. Ek olarak, yalnızca bir parça varsa, yazma işlemi sharding anahtarını belirtmeden çalışır, çünkü bu durumda hiçbir şey ifade etmez. + +Her parça yapılandırma dosyasında tanımlanan bir ağırlığa sahip olabilir. Varsayılan olarak, ağırlık bir eşittir. Veriler, parça ağırlığı ile orantılı miktarda parçalara dağıtılır. Örneğin, iki parça varsa ve birincisi 9’luk bir ağırlığa sahipse, ikincisi 10’luk bir ağırlığa sahipse, ilk satırların 9 / 19 parçası gönderilir ve ikincisi 10 / 19 gönderilir. + +Her shard olabilir ‘internal\_replication’ yapılandırma dosyasında tanımlanan parametre. + +Bu parametre şu şekilde ayarlanırsa ‘true’, yazma işlemi ilk sağlıklı yinelemeyi seçer ve ona veri yazar. Dağıtılmış tablo ise bu alternatifi kullanın “looks at” çoğaltılan tablolar. Başka bir deyişle, verilerin yazılacağı tablo kendilerini çoğaltacaktır. + +Olarak ayarlan ifmışsa ‘false’ (varsayılan), veriler tüm kopyalara yazılır. Özünde, bu, dağıtılmış tablonun verilerin kendisini çoğalttığı anlamına gelir. Bu, çoğaltılmış tabloları kullanmaktan daha kötüdür, çünkü kopyaların tutarlılığı denetlenmez ve zamanla biraz farklı veriler içerirler. + +Bir veri satırının gönderildiği parçayı seçmek için, parçalama ifadesi analiz edilir ve kalan kısmı, parçaların toplam ağırlığına bölünmesinden alınır. Satır, kalanların yarı aralığına karşılık gelen parçaya gönderilir. ‘prev\_weight’ -e doğru ‘prev\_weights + weight’, nere ‘prev\_weights’ en küçük sayıya sahip parçaların toplam ağırlığı ve ‘weight’ bu parçanın ağırlığı. Örneğin, iki parça varsa ve birincisi 9’luk bir ağırlığa sahipse, ikincisi 10’luk bir ağırlığa sahipse, satır \[0, 9) aralığından kalanlar için ilk parçaya ve ikincisine \[9, 19) aralığından kalanlar için gönderilecektir. + +Sharding ifadesi, bir tamsayı döndüren sabitler ve tablo sütunlarından herhangi bir ifade olabilir. Örneğin, ifadeyi kullanabilirsiniz ‘rand()’ verilerin rastgele dağılımı için veya ‘UserID’ kullanıcının kimliğinin bölünmesinden kalanın dağıtımı için (daha sonra tek bir kullanıcının verileri, kullanıcılar tarafından çalışmayı ve katılmayı basitleştiren tek bir parçada bulunur). Sütunlardan biri yeterince eşit olarak dağıtılmazsa, onu bir karma işleve sarabilirsiniz: ınthash64(Userıd). + +Bölüm’den basit bir hatırlatma, sharding için sınırlı bir çözümdür ve her zaman uygun değildir. Orta ve büyük hacimlerde veri (düzinelerce sunucu) için çalışır, ancak çok büyük hacimlerde veri (yüzlerce sunucu veya daha fazla) için değildir. İkinci durumda, dağıtılmış tablolarda girdileri kullanmak yerine konu alanı tarafından gerekli olan sharding şemasını kullanın. + +SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don’t have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. + +Aşağıdaki durumlarda sharding şeması hakkında endişelenmelisiniz: + +- Belirli bir anahtar tarafından veri (veya birleştirme) birleştirme gerektiren sorgular kullanılır. Veriler bu anahtar tarafından parçalanırsa, GLOBAL IN veya GLOBAL JOİN yerine local IN veya JOİN kullanabilirsiniz, bu da çok daha etkilidir. +- Çok sayıda küçük Sorgu ile çok sayıda sunucu (yüzlerce veya daha fazla) kullanılır (bireysel müşterilerin sorguları - web siteleri, reklamverenler veya ortaklar). Küçük sorguların tüm kümeyi etkilememesi için, tek bir istemci için tek bir parça üzerinde veri bulmak mantıklıdır. Alternatif olarak, Yandex’te yaptığımız gibi.Metrica, iki seviyeli sharding kurabilirsiniz: tüm kümeyi bölün “layers”, bir katmanın birden fazla parçadan oluşabileceği yer. Tek bir istemci için veriler tek bir katmanda bulunur, ancak kırıklar gerektiğinde bir katmana eklenebilir ve veriler rastgele dağıtılır. Her katman için dağıtılmış tablolar oluşturulur ve genel sorgular için tek bir paylaşılan dağıtılmış tablo oluşturulur. + +Veriler zaman uyumsuz olarak yazılır. Tabloya eklendiğinde, veri bloğu sadece yerel dosya sistemine yazılır. Veriler en kısa sürede arka planda uzak sunuculara gönderilir. Veri gönderme süresi tarafından yönetilir [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) ve [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) ayarlar. Bu `Distributed` motor ayrı ayrı eklenen verilerle her dosyayı gönderir, ancak toplu dosya gönderme etkinleştirebilirsiniz [distributed\_directory\_monitor\_batch\_ınserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) ayar. Bu ayar, yerel sunucu ve ağ kaynaklarını daha iyi kullanarak küme performansını artırır. Tablo dizinindeki dosyaların listesini (gönderilmeyi bekleyen veriler) kontrol ederek verilerin başarıyla gönderilip gönderilmediğini kontrol etmelisiniz: `/var/lib/clickhouse/data/database/table/`. + +Sunucu varlığını durdurdu veya (örneğin, bir aygıt arızasından sonra) dağıtılmış bir tabloya bir ekleme sonra kaba bir yeniden başlatma vardı, eklenen veriler kaybolabilir. Tablo dizininde bozuk bir veri parçası tespit edilirse, ‘broken’ alt dizin ve artık kullanılmıyor. + +Max\_parallel\_replicas seçeneği etkinleştirildiğinde, sorgu işleme tek bir parça içindeki tüm yinelemeler arasında paralelleştirilir. Daha fazla bilgi için bölüme bakın [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). + +## Sanal Sütunlar {#virtual-columns} + +- `_shard_num` — Contains the `shard_num` (itibaren `system.clusters`). Tür: [Uİnt32](../../../sql-reference/data-types/int-uint.md). + +!!! note "Not" + Beri [`remote`](../../../sql-reference/table-functions/remote.md)/`cluster` tablo işlevleri DAHİLİ olarak aynı dağıtılmış altyapının geçici örneğini oluşturur, `_shard_num` de kullanılabilir. + +**Ayrıca Bakınız** + +- [Sanal sütunlar](index.md#table_engines-virtual_columns) + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/tr/engines/table-engines/special/external-data.md b/docs/tr/engines/table-engines/special/external-data.md new file mode 100644 index 00000000000..f9cbad62112 --- /dev/null +++ b/docs/tr/engines/table-engines/special/external-data.md @@ -0,0 +1,68 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 34 +toc_title: "D\u0131\u015F veri" +--- + +# Sorgu işleme için Harici Veriler {#external-data-for-query-processing} + +ClickHouse bir sunucu bir SELECT sorgusu ile birlikte bir sorgu işlemek için gerekli olan verileri gönderme sağlar. Bu veriler geçici bir tabloya konur (bölüme bakın “Temporary tables”) ve sorguda kullanılabilir (örneğin, işleçlerde). + +Örneğin, önemli kullanıcı tanımlayıcılarına sahip bir metin dosyanız varsa, bu listeyi süzme kullanan bir sorgu ile birlikte sunucuya yükleyebilirsiniz. + +Büyük hacimli dış verilerle birden fazla sorgu çalıştırmanız gerekiyorsa, bu özelliği kullanmayın. Verileri vaktinden önce DB’YE yüklemek daha iyidir. + +Harici veriler komut satırı istemcisi (etkileşimli olmayan modda) veya HTTP arabirimi kullanılarak yüklenebilir. + +Komut satırı istemcisinde, formatta bir parametreler bölümü belirtebilirsiniz + +``` bash +--external --file=... [--name=...] [--format=...] [--types=...|--structure=...] +``` + +İletilen tablo sayısı için bunun gibi birden çok bölümünüz olabilir. + +**–external** – Marks the beginning of a clause. +**–file** – Path to the file with the table dump, or -, which refers to stdin. +Stdın’den yalnızca tek bir tablo alınabilir. + +Aşağıdaki parametreler isteğe bağlıdır: **–name**– Name of the table. If omitted, \_data is used. +**–format** – Data format in the file. If omitted, TabSeparated is used. + +Aşağıdaki parametrelerden biri gereklidir:**–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`. Sütun adlarını ve türlerini tanımlar. + +Belirtilen dosyalar ‘file’ belirtilen biçimde ayrıştırılır ‘format’, belirtilen veri türlerini kullanarak ‘types’ veya ‘structure’. Tablo sunucuya yüklenecek ve orada adı ile geçici bir tablo olarak erişilebilir ‘name’. + +Örnekler: + +``` bash +$ echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 +849897 +$ cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +HTTP arabirimini kullanırken, dış veriler çok parçalı/form veri biçiminde geçirilir. Her tablo ayrı bir dosya olarak iletilir. Tablo adı dosya adından alınır. Bu ‘query\_string’ parametreleri geçirilir ‘name\_format’, ‘name\_types’, ve ‘name\_structure’, nere ‘name’ bu parametreler karşılık gelen tablonun adıdır. Parametrelerin anlamı, komut satırı istemcisini kullanırken olduğu gibi aynıdır. + +Örnek: + +``` bash +$ cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv + +$ curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +Dağıtılmış sorgu işleme için geçici tablolar tüm uzak sunuculara gönderilir. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/external_data/) diff --git a/docs/tr/engines/table-engines/special/file.md b/docs/tr/engines/table-engines/special/file.md new file mode 100644 index 00000000000..812d69bb3c3 --- /dev/null +++ b/docs/tr/engines/table-engines/special/file.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 37 +toc_title: Dosya +--- + +# Dosya {#table_engines-file} + +Dosya tablosu altyapısı, verileri desteklenen dosyalardan birinde tutar [Dosya +biçimliler](../../../interfaces/formats.md#formats) (TabSeparated, yerli, vb.). + +Kullanım örnekleri: + +- Clickhouse’dan dosyaya veri aktarımı. +- Verileri bir biçimden diğerine dönüştürün. +- Bir diskte bir dosya düzenleme yoluyla ClickHouse veri güncelleme. + +## ClickHouse Sunucusunda Kullanım {#usage-in-clickhouse-server} + +``` sql +File(Format) +``` + +Bu `Format` parametre kullanılabilir dosya biçimlerinden birini belirtir. Gerçekleştirmek +`SELECT` sorgular, biçim giriş için desteklenmeli ve gerçekleştirmek için +`INSERT` queries – for output. The available formats are listed in the +[Biçimliler](../../../interfaces/formats.md#formats) bölme. + +ClickHouse dosya sistemi yolunu belirtmek için izin vermiyor`File`. Tarafından tanımlanan klasörü kullan willacaktır [yol](../../../operations/server-configuration-parameters/settings.md) sunucu yapılandırmasında ayarlama. + +Kullanarak tablo oluştururken `File(Format)` bu klasörde boş bir alt dizin oluşturur. Veri o tabloya yazıldığında, içine konur `data.Format` bu alt dizinde dosya. + +Bu alt klasörü ve dosyayı sunucu dosya sisteminde el ile oluşturabilir ve sonra [ATTACH](../../../sql-reference/statements/misc.md) eşleşen ada sahip tablo bilgilerine, böylece bu dosyadan veri sorgulayabilirsiniz. + +!!! warning "Uyarıcı" + Bu işlevselliğe dikkat edin, çünkü ClickHouse bu tür dosyalarda harici değişiklikleri izlemez. ClickHouse ve ClickHouse dışında eşzamanlı yazma sonucu tanımsızdır. + +**Örnek:** + +**1.** Set up the `file_engine_table` Tablo: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +Varsayılan olarak ClickHouse klasör oluşturur `/var/lib/clickhouse/data/default/file_engine_table`. + +**2.** El ile oluştur `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` içerme: + +``` bash +$ cat data.TabSeparated +one 1 +two 2 +``` + +**3.** Verileri sorgula: + +``` sql +SELECT * FROM file_engine_table +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## Clickhouse’da kullanım-yerel {#usage-in-clickhouse-local} + +İçinde [clickhouse-yerel](../../../operations/utilities/clickhouse-local.md) Dosya motoru ek olarak dosya yolunu kabul eder `Format`. Varsayılan giriş / çıkış akışları gibi sayısal veya insan tarafından okunabilir isimler kullanılarak belirtilebilir `0` veya `stdin`, `1` veya `stdout`. +**Örnek:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## Uygulama Detayları {#details-of-implementation} + +- Çoklu `SELECT` sorgular aynı anda yapılabilir, ancak `INSERT` sorgular birbirini bekler. +- Tarafından yeni dosya oluşturma desteklenen `INSERT` sorgu. +- Dosya varsa, `INSERT` içinde yeni değerler ekler. +- Desteklenmiyor: + - `ALTER` + - `SELECT ... SAMPLE` + - Dizinler + - Çoğalma + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/tr/engines/table-engines/special/generate.md b/docs/tr/engines/table-engines/special/generate.md new file mode 100644 index 00000000000..30f0b6a0734 --- /dev/null +++ b/docs/tr/engines/table-engines/special/generate.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 46 +toc_title: GenerateRandom +--- + +# Generaterandom {#table_engines-generate} + +GenerateRandom tablo motoru, verilen tablo şeması için rasgele veri üretir. + +Kullanım örnekleri: + +- Tekrarlanabilir büyük tabloyu doldurmak için testte kullanın. +- Fuzzing testleri için rastgele girdi oluşturun. + +## ClickHouse Sunucusunda Kullanım {#usage-in-clickhouse-server} + +``` sql +ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) +``` + +Bu `max_array_length` ve `max_string_length` parametreler tüm maksimum uzunluğu belirtin +oluşturulan verilerde dizi sütunları ve dizeleri. + +Tablo motoru oluşturmak yalnızca destekler `SELECT` sorgular. + +Tüm destekler [Veri türleri](../../../sql-reference/data-types/index.md) dışında bir tabloda saklanabilir `LowCardinality` ve `AggregateFunction`. + +**Örnek:** + +**1.** Set up the `generate_engine_table` Tablo: + +``` sql +CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) +``` + +**2.** Verileri sorgula: + +``` sql +SELECT * FROM generate_engine_table LIMIT 3 +``` + +``` text +┌─name─┬──────value─┐ +│ c4xJ │ 1412771199 │ +│ r │ 1791099446 │ +│ 7#$ │ 124312908 │ +└──────┴────────────┘ +``` + +## Uygulama Detayları {#details-of-implementation} + +- Desteklenmiyor: + - `ALTER` + - `SELECT ... SAMPLE` + - `INSERT` + - Dizinler + - Çoğalma + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/tr/engines/table_engines/special/index.md b/docs/tr/engines/table-engines/special/index.md similarity index 100% rename from docs/tr/engines/table_engines/special/index.md rename to docs/tr/engines/table-engines/special/index.md diff --git a/docs/tr/engines/table-engines/special/join.md b/docs/tr/engines/table-engines/special/join.md new file mode 100644 index 00000000000..966a0b84d0c --- /dev/null +++ b/docs/tr/engines/table-engines/special/join.md @@ -0,0 +1,111 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 40 +toc_title: Katmak +--- + +# Katmak {#join} + +Kullanılmak üzere hazırlanmış veri yapısı [JOIN](../../../sql-reference/statements/select.md#select-join) harekat. + +## Tablo oluşturma {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], +) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) +``` + +Ayrıntılı açıklamasına bakın [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) sorgu. + +**Motor Parametreleri** + +- `join_strictness` – [Katılık katılın](../../../sql-reference/statements/select.md#select-join-strictness). +- `join_type` – [Birleştirme türü](../../../sql-reference/statements/select.md#select-join-types). +- `k1[, k2, ...]` – Key columns from the `USING` fık thera: `JOIN` işlemi yapılmamaktadır. + +Girmek `join_strictness` ve `join_type` tırnak işaretleri olmadan parametreler, örneğin, `Join(ANY, LEFT, col1)`. Onlar eşleşmelidir `JOIN` tablo için kullanılacak işlem. Parametreler eşleşmezse, ClickHouse bir istisna atmaz ve yanlış veri döndürebilir. + +## Tablo Kullanımı {#table-usage} + +### Örnek {#example} + +Sol taraftaki tablo oluşturma: + +``` sql +CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog +``` + +``` sql +INSERT INTO id_val VALUES (1,11)(2,12)(3,13) +``` + +Sağ tarafı oluşturma `Join` Tablo: + +``` sql +CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) +``` + +``` sql +INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) +``` + +Tabloları birleştirme: + +``` sql +SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 +``` + +``` text +┌─id─┬─val─┬─id_val_join.val─┐ +│ 1 │ 11 │ 21 │ +│ 2 │ 12 │ ᴺᵁᴸᴸ │ +│ 3 │ 13 │ 23 │ +└────┴─────┴─────────────────┘ +``` + +Alternatif olarak, veri alabilirsiniz `Join` tablo, birleştirme anahtarı değerini belirterek: + +``` sql +SELECT joinGet('id_val_join', 'val', toUInt32(1)) +``` + +``` text +┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ +│ 21 │ +└────────────────────────────────────────────┘ +``` + +### Veri seçme Ve Ekleme {#selecting-and-inserting-data} + +Kullanabilirsiniz `INSERT` veri eklemek için sorgular `Join`- motor masaları. Tablo ile oluşturulmuş ise `ANY` katılık, yinelenen anahtarlar için veriler göz ardı edilir. İle… `ALL` katılık, tüm satırlar eklenir. + +Gerçekleştir aemezsiniz `SELECT` doğrudan tablodan sorgulayın. Bunun yerine, aşağıdaki yöntemlerden birini kullanın: + +- Tabloyu sağ tarafa yerleştirin. `JOIN` yan. +- Call the [joinGet](../../../sql-reference/functions/other-functions.md#joinget) tablodan bir sözlükten aynı şekilde veri ayıklamanızı sağlayan işlev. + +### Sınırlamalar Ve Ayarlar {#join-limitations-and-settings} + +Bir tablo oluştururken aşağıdaki ayarlar uygulanır: + +- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) +- [max\_rows\_in\_join](../../../operations/settings/query-complexity.md#settings-max_rows_in_join) +- [max\_bytes\_in\_join](../../../operations/settings/query-complexity.md#settings-max_bytes_in_join) +- [join\_overflow\_mode](../../../operations/settings/query-complexity.md#settings-join_overflow_mode) +- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) + +Bu `Join`- motor tabloları kullanılamaz `GLOBAL JOIN` harekat. + +Bu `Join`- motor kullanımına izin verir [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) ayarı `CREATE TABLE` deyim. Ve [SELECT](../../../sql-reference/statements/select.md) sorgu kullanımına izin verir `join_use_nulls` çok. Eğer farklı varsa `join_use_nulls` ayarlar, tablo birleştirme bir hata alabilirsiniz. Bu katılmak türüne bağlıdır. Kullandığınızda [joinGet](../../../sql-reference/functions/other-functions.md#joinget) fonksiyonu, aynı kullanmak zorunda `join_use_nulls` ayarı `CRATE TABLE` ve `SELECT` deyimler. + +## Veri Depolama {#data-storage} + +`Join` tablo verileri her zaman RAM’de bulunur. Bir tabloya satır eklerken, sunucu yeniden başlatıldığında geri yüklenebilir, böylece ClickHouse disk üzerindeki dizine veri bloklarını yazar. + +Sunucu yanlış yeniden başlatılırsa, diskteki veri bloğu kaybolabilir veya zarar görebilir. Bu durumda, dosyayı hasarlı verilerle el ile silmeniz gerekebilir. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/tr/engines/table-engines/special/materializedview.md b/docs/tr/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..5182395e21c --- /dev/null +++ b/docs/tr/engines/table-engines/special/materializedview.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 43 +toc_title: MaterializedView +--- + +# Materializedview {#materializedview} + +Somut görünümler uygulamak için kullanılır (Daha fazla bilgi için bkz . [CREATE TABLE](../../../sql-reference/statements/create.md)). Verileri depolamak için, görünümü oluştururken belirtilen farklı bir motor kullanır. Bir tablodan okurken, sadece bu motoru kullanır. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/tr/engines/table-engines/special/memory.md b/docs/tr/engines/table-engines/special/memory.md new file mode 100644 index 00000000000..d11a52affc1 --- /dev/null +++ b/docs/tr/engines/table-engines/special/memory.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 44 +toc_title: Bellek +--- + +# Bellek {#memory} + +Bellek altyapısı verileri RAM, sıkıştırılmamış biçimde depolar. Veri okunduğunda alınan tam olarak aynı biçimde saklanır. Başka bir deyişle, bu tablodan okuma tamamen ücretsizdir. +Eşzamanlı veri erişimi senkronize edilir. Kilitler kısa: okuma ve yazma işlemleri birbirini engellemez. +Dizinler desteklenmiyor. Okuma paralelleştirilmiştir. +Basit sorgularda maksimum üretkenliğe (10 GB/sn’den fazla) ulaşılır, çünkü diskten okuma, açma veya veri serisini kaldırma yoktur. (Birçok durumda MergeTree motorunun verimliliğinin neredeyse yüksek olduğunu unutmamalıyız.) +Bir sunucu yeniden başlatılırken, veri tablodan kaybolur ve tablo boş olur. +Normalde, bu tablo motorunu kullanmak haklı değildir. Bununla birlikte, testler ve nispeten az sayıda satırda (yaklaşık 100.000.000’a kadar) maksimum hızın gerekli olduğu görevler için kullanılabilir. + +Bellek motoru, harici sorgu verilerine sahip geçici tablolar için sistem tarafından kullanılır (bkz. “External data for processing a query”) ve GLOBAL In uygulanması için (bkz. “IN operators”). + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/memory/) diff --git a/docs/tr/engines/table-engines/special/merge.md b/docs/tr/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..811dd7f1770 --- /dev/null +++ b/docs/tr/engines/table-engines/special/merge.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 36 +toc_title: "Birle\u015Ftirmek" +--- + +# Birleştirmek {#merge} + +Bu `Merge` motor (ile karıştırılmamalıdır `MergeTree`) verileri kendisi saklamaz, ancak aynı anda herhangi bir sayıda başka tablodan okumaya izin verir. +Okuma otomatik olarak paralelleştirilir. Bir tabloya yazma desteklenmiyor. Okurken, gerçekten okunmakta olan tabloların dizinleri varsa kullanılır. +Bu `Merge` motor parametreleri kabul eder: veritabanı adı ve tablolar için düzenli ifade. + +Örnek: + +``` sql +Merge(hits, '^WatchLog') +``` + +Veri tablolardan okunacak `hits` düzenli ifadeyle eşleşen adlara sahip veritabanı ‘`^WatchLog`’. + +Veritabanı adı yerine, bir dize döndüren sabit bir ifade kullanabilirsiniz. Mesela, `currentDatabase()`. + +Regular expressions — [re2](https://github.com/google/re2) (pcre bir alt kümesini destekler), büyük / küçük harf duyarlı. +Düzenli ifadelerde kaçan sembollerle ilgili notlara bakın “match” bölme. + +Okumak için tabloları seçerken, `Merge` regex ile eşleşse bile tablonun kendisi seçilmeyecektir. Bu döngülerden kaçınmaktır. +İki tane oluşturmak mümkündür `Merge` sonsuza kadar birbirlerinin verilerini okumaya çalışacak tablolar, ancak bu iyi bir fikir değil. + +Kullanmak için tipik bir yol `Merge` motor çok sayıda çalışma içindir `TinyLog` tablolar tek bir tablo ile sanki. + +Örnek 2: + +Diyelim ki eski bir tablonuz (WatchLog\_old) var ve verileri yeni bir tabloya (WatchLog\_new) taşımadan bölümlemeyi değiştirmeye karar verdiniz ve her iki tablodaki verileri görmeniz gerekiyor. + +``` sql +CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree(date, (UserId, EventType), 8192); +INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + +CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) +ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; +INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + +CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + +SELECT * +FROM WatchLog +``` + +``` text +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-01 │ 1 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ +│ 2018-01-02 │ 2 │ hit │ 3 │ +└────────────┴────────┴───────────┴─────┘ +``` + +## Sanal Sütunlar {#virtual-columns} + +- `_table` — Contains the name of the table from which data was read. Type: [Dize](../../../sql-reference/data-types/string.md). + + Sabit koşulları ayarlayabilirsiniz `_table` in the `WHERE/PREWHERE` fıkra (sı (örneğin, `WHERE _table='xyz'`). Bu durumda, okuma işlemi yalnızca koşulun açık olduğu tablolar için gerçekleştirilir `_table` memnun olduğunu, bu yüzden `_table` sütun bir dizin görevi görür. + +**Ayrıca Bakınız** + +- [Sanal sütunlar](index.md#table_engines-virtual_columns) + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/tr/engines/table_engines/special/null.md b/docs/tr/engines/table-engines/special/null.md similarity index 100% rename from docs/tr/engines/table_engines/special/null.md rename to docs/tr/engines/table-engines/special/null.md diff --git a/docs/tr/engines/table-engines/special/set.md b/docs/tr/engines/table-engines/special/set.md new file mode 100644 index 00000000000..65c88beb359 --- /dev/null +++ b/docs/tr/engines/table-engines/special/set.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 39 +toc_title: Koymak +--- + +# Koymak {#set} + +Her zaman RAM olan bir veri kümesi. In operatörünün sağ tarafında kullanılmak üzere tasarlanmıştır (bölüme bakın “IN operators”). + +Tabloya veri eklemek için INSERT kullanabilirsiniz. Veri kümesine yeni öğeler eklenirken, yinelenenler göz ardı edilir. +Ancak tablodan seçim yapamazsınız. Verileri almak için tek yol, IN operatörünün sağ yarısında kullanmaktır. + +Veri her zaman RAM yer almaktadır. INSERT için, eklenen veri blokları da diskteki tabloların dizinine yazılır. Sunucuyu başlatırken, bu veriler RAM’e yüklenir. Başka bir deyişle, yeniden başlattıktan sonra veriler yerinde kalır. + +Kaba bir sunucu yeniden başlatma için diskteki veri bloğu kaybolabilir veya zarar görebilir. İkinci durumda, dosyayı hasarlı verilerle el ile silmeniz gerekebilir. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/set/) diff --git a/docs/tr/engines/table-engines/special/url.md b/docs/tr/engines/table-engines/special/url.md new file mode 100644 index 00000000000..3534f27b74b --- /dev/null +++ b/docs/tr/engines/table-engines/special/url.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 41 +toc_title: URL +--- + +# URL (URL, Biçim) {#table_engines-url} + +Uzak bir HTTP/HTTPS sunucusundaki verileri yönetir. Bu motor benzer +to the [Dosya](file.md) motor. + +## ClickHouse Sunucusunda Motoru Kullanma {#using-the-engine-in-the-clickhouse-server} + +Bu `format` Clickhouse’un kullanabileceği bir tane olmalı +`SELECT` sorgular ve gerekirse `INSERTs`. Desteklenen formatların tam listesi için bkz. +[Biçimliler](../../../interfaces/formats.md#formats). + +Bu `URL` tekdüzen bir kaynak Bulucu yapısına uygun olmalıdır. Belirtilen URL bir sunucuya işaret etmelidir +bu HTTP veya HTTPS kullanır. Bu herhangi bir gerektirmez +sunucudan yanıt almak için ek başlıklar. + +`INSERT` ve `SELECT` sorgular dönüştürülür `POST` ve `GET` istemler, +sırasıyla. İşleme için `POST` istekleri, uzak sunucu desteklemesi gerekir +[Yığınlı aktarım kodlaması](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). + +Kullanarak HTTP get yönlendirme şerbetçiotu sayısını sınırlayabilirsiniz [max\_http\_get\_redirects](../../../operations/settings/settings.md#setting-max_http_get_redirects) ayar. + +**Örnek:** + +**1.** Create a `url_engine_table` sunucuda tablo : + +``` sql +CREATE TABLE url_engine_table (word String, value UInt64) +ENGINE=URL('http://127.0.0.1:12345/', CSV) +``` + +**2.** Standart Python 3 araçlarını kullanarak temel bir HTTP Sunucusu oluşturun ve +Başlat: + +``` python3 +from http.server import BaseHTTPRequestHandler, HTTPServer + +class CSVHTTPServer(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-type', 'text/csv') + self.end_headers() + + self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) + +if __name__ == "__main__": + server_address = ('127.0.0.1', 12345) + HTTPServer(server_address, CSVHTTPServer).serve_forever() +``` + +``` bash +$ python3 server.py +``` + +**3.** Veri iste: + +``` sql +SELECT * FROM url_engine_table +``` + +``` text +┌─word──┬─value─┐ +│ Hello │ 1 │ +│ World │ 2 │ +└───────┴───────┘ +``` + +## Uygulama Detayları {#details-of-implementation} + +- Okuma ve yazma paralel olabilir +- Desteklenmiyor: + - `ALTER` ve `SELECT...SAMPLE` harekat. + - Dizinler. + - Çoğalma. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/tr/engines/table_engines/special/view.md b/docs/tr/engines/table-engines/special/view.md similarity index 100% rename from docs/tr/engines/table_engines/special/view.md rename to docs/tr/engines/table-engines/special/view.md diff --git a/docs/tr/engines/table_engines/index.md b/docs/tr/engines/table_engines/index.md deleted file mode 100644 index fad3823453c..00000000000 --- a/docs/tr/engines/table_engines/index.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "Masa Motorlar\u0131" -toc_priority: 26 -toc_title: "Giri\u015F" ---- - -# Masa Motorları {#table_engines} - -Tablo motoru (tablo türü) belirler: - -- Verilerin nasıl ve nerede depolandığı, nereye yazılacağı ve nereden okunacağı. -- Hangi sorgular desteklenir ve nasıl. -- Eşzamanlı veri erişimi. -- Varsa indeks uselerin kullanımı. -- Çok iş parçacıklı istek yürütme mümkün olup olmadığı. -- Veri çoğaltma parametreleri. - -## Motor Aileleri {#engine-families} - -### MergeTree {#mergetree} - -Yüksek yük görevleri için en evrensel ve fonksiyonel masa motorları. Bu motorlar tarafından paylaşılan özellik, sonraki arka plan veri işleme ile hızlı veri ekleme ' dir. `MergeTree` aile motorları destek veri çoğaltma (ile [Çoğaltıyordu\*](mergetree_family/replication.md) sürümleri), bölümleme ve diğer özellikler diğer motorlarda desteklenmez. - -Ailede motorlar: - -- [MergeTree](mergetree_family/mergetree.md) -- [ReplacingMergeTree](mergetree_family/replacingmergetree.md) -- [SummingMergeTree](mergetree_family/summingmergetree.md) -- [AggregatingMergeTree](mergetree_family/aggregatingmergetree.md) -- [CollapsingMergeTree](mergetree_family/collapsingmergetree.md) -- [VersionedCollapsingMergeTree](mergetree_family/versionedcollapsingmergetree.md) -- [Graphıtemergetree](mergetree_family/graphitemergetree.md) - -### Günlük {#log} - -Hafiflik [motorlar](log_family/index.md) minimum işlevsellik ile. Birçok küçük tabloyu (yaklaşık 1 milyon satıra kadar) hızlı bir şekilde yazmanız ve daha sonra bir bütün olarak okumanız gerektiğinde en etkili olanlardır. - -Ailede motorlar: - -- [TinyLog](log_family/tinylog.md) -- [StripeLog](log_family/stripelog.md) -- [Günlük](log_family/log.md) - -### Entegrasyon Motorları {#integration-engines} - -Diğer veri depolama ve işleme sistemleri ile iletişim kurmak için motorlar. - -Ailede motorlar: - -- [Kafka](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) -- [HDFS](integrations/hdfs.md) - -### Özel Motorlar {#special-engines} - -Ailede motorlar: - -- [Dağılı](special/distributed.md) -- [MaterializedView](special/materializedview.md) -- [Sözlük](special/dictionary.md) -- [Birleştirmek](special/merge.md) -- [Dosya](special/file.md) -- [Boş](special/null.md) -- [Koymak](special/set.md) -- [Katmak](special/join.md) -- [URL](special/url.md) -- [Görünüm](special/view.md) -- [Bellek](special/memory.md) -- [Arabellek](special/buffer.md) - -## Sanal Sütunlar {#table_engines-virtual-columns} - -Sanal sütun, motor kaynak kodunda tanımlanan ayrılmaz bir tablo altyapısı özniteliğidir. - -Sanal sütunları belirtmemelisiniz `CREATE TABLE` sorgula ve onları göremezsin `SHOW CREATE TABLE` ve `DESCRIBE TABLE` sorgu sonuçları. Sanal sütunlar da salt okunur, bu nedenle sanal sütunlara veri ekleyemezsiniz. - -Sanal bir sütundan veri seçmek için, adını `SELECT` sorgu. `SELECT *` sanal sütunlardan değerler döndürmez. - -Tablo sanal sütunlarından biriyle aynı ada sahip bir sütuna sahip bir tablo oluşturursanız, sanal sütuna erişilemez hale gelir. Bunu yapmayı önermiyoruz. Çakışmaları önlemek için, sanal sütun adları genellikle bir alt çizgi ile öneki. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/) diff --git a/docs/tr/engines/table_engines/integrations/hdfs.md b/docs/tr/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index 42e1e31b80f..00000000000 --- a/docs/tr/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 36 -toc_title: HDFS ---- - -# HDFS {#table_engines-hdfs} - -Bu motor ile entegrasyon sağlar [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) üzerinde veri Yönet allowingilmesine izin vererek ekosist dataem [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)ClickHouse aracılığıyla. Bu motor benzer -to the [Dosya](../special/file.md) ve [URL](../special/url.md) motorlar, ancak hadoop özgü özellikleri sağlar. - -## Kullanma {#usage} - -``` sql -ENGINE = HDFS(URI, format) -``` - -Bu `URI` parametre, HDFS'DEKİ tüm dosya URI'SIDIR. -Bu `format` parametre kullanılabilir dosya biçimlerinden birini belirtir. Gerçekleştirmek -`SELECT` sorgular, biçim giriş için desteklenmeli ve gerçekleştirmek için -`INSERT` queries – for output. The available formats are listed in the -[Biçimliler](../../../interfaces/formats.md#formats) bölme. -Yol kısmı `URI` globs içerebilir. Bu durumda tablo salt okunur olurdu. - -**Örnek:** - -**1.** Set up the `hdfs_engine_table` Tablo: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** Fil filel file: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** Verileri sorgula: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Uygulama Detayları {#implementation-details} - -- Okuma ve yazma paralel olabilir -- Desteklenmiyor: - - `ALTER` ve `SELECT...SAMPLE` harekat. - - Dizinler. - - Çoğalma. - -**Yolda Globs** - -Birden çok yol bileşenleri globs olabilir. İşlenmek için dosya var olmalı ve tüm yol deseniyle eşleşmelidir. Sırasında dosyaların listelen ofmesini belirler `SELECT` (not at `CREATE` an). - -- `*` — Substitutes any number of any characters except `/` boş dize dahil. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -İle yapılar `{}` benzer olan [uzak](../../../sql_reference/table_functions/remote.md) tablo işlevi. - -**Örnek** - -1. HDFS'DE aşağıdaki Urı'lerle TSV formatında birkaç dosyamız olduğunu varsayalım: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Altı dosyadan oluşan bir tablo oluşturmanın birkaç yolu vardır: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -Başka bir yol: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -Tablo, her iki dizindeki tüm dosyalardan oluşur (tüm dosyalar, sorguda açıklanan biçimi ve şemayı karşılamalıdır): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "Uyarıcı" - Dosyaların listelenmesi, önde gelen sıfırlarla sayı aralıkları içeriyorsa, her basamak için parantez içeren yapıyı ayrı ayrı kullanın veya kullanın `?`. - -**Örnek** - -Adlı dosyaları içeren tablo oluşturma `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') -``` - -## Sanal Sütunlar {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Ayrıca Bakınız** - -- [Sanal sütunlar](../index.md#table_engines-virtual_columns) - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/tr/engines/table_engines/integrations/jdbc.md b/docs/tr/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index 08196116cf8..00000000000 --- a/docs/tr/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 34 -toc_title: JDBC ---- - -# JDBC {#table-engine-jdbc} - -ClickHouse üzerinden harici veritabanlarına bağlanmak için izin verir [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -JDBC bağlantısını uygulamak için ClickHouse ayrı programı kullanır [clickhouse-JDBC-köprü](https://github.com/alex-krash/clickhouse-jdbc-bridge) bu bir daemon olarak çalışmalıdır. - -Bu motor destekler [Nullable](../../../sql_reference/data_types/nullable.md) veri türü. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -( - columns list... -) -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**Motor Parametreleri** - -- `dbms_uri` — URI of an external DBMS. - - Biçimli: `jdbc:://:/?user=&password=`. - MySQL örneği: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — Database in an external DBMS. - -- `external_table` — Name of the table in `external_database`. - -## Kullanım Örneği {#usage-example} - -Doğrudan konsol istemcisine bağlanarak MySQL sunucusunda bir tablo oluşturma: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ClickHouse Server'da bir tablo oluşturma ve ondan veri seçme: - -``` sql -CREATE TABLE jdbc_table -( - `int_id` Int32, - `int_nullable` Nullable(Int32), - `float` Float32, - `float_nullable` Nullable(Float32) -) -ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Ayrıca Bakınız {#see-also} - -- [JDBC tablo işlevi](../../../sql_reference/table_functions/jdbc.md). - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/tr/engines/table_engines/integrations/kafka.md b/docs/tr/engines/table_engines/integrations/kafka.md deleted file mode 100644 index e66894ed4ac..00000000000 --- a/docs/tr/engines/table_engines/integrations/kafka.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 32 -toc_title: Kafka ---- - -# Kafka {#kafka} - -Bu motor ile çalışır [Apache Kafka](http://kafka.apache.org/). - -Kafka sağlar: - -- Veri akışlarını yayınlayın veya abone olun. -- Hataya dayanıklı depolama düzenlemek. -- Kullanılabilir hale geldikçe akışları işleyin. - -## Tablo oluşturma {#table_engine-kafka-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = Kafka() -SETTINGS - kafka_broker_list = 'host:port', - kafka_topic_list = 'topic1,topic2,...', - kafka_group_name = 'group_name', - kafka_format = 'data_format'[,] - [kafka_row_delimiter = 'delimiter_symbol',] - [kafka_schema = '',] - [kafka_num_consumers = N,] - [kafka_skip_broken_messages = N] -``` - -Gerekli parametreler: - -- `kafka_broker_list` – A comma-separated list of brokers (for example, `localhost:9092`). -- `kafka_topic_list` – A list of Kafka topics. -- `kafka_group_name` – A group of Kafka consumers. Reading margins are tracked for each group separately. If you don't want messages to be duplicated in the cluster, use the same group name everywhere. -- `kafka_format` – Message format. Uses the same notation as the SQL `FORMAT` fonksiyon gibi `JSONEachRow`. Daha fazla bilgi için, bkz: [Biçimliler](../../../interfaces/formats.md) bölme. - -İsteğe bağlı parametreler: - -- `kafka_row_delimiter` – Delimiter character, which ends the message. -- `kafka_schema` – Parameter that must be used if the format requires a schema definition. For example, [Cap'n Proto](https://capnproto.org/) şema dosyasının yolunu ve kök adını gerektirir `schema.capnp:Message` nesne. -- `kafka_num_consumers` – The number of consumers per table. Default: `1`. Bir tüketicinin verimi yetersizse daha fazla tüketici belirtin. Bölüm başına yalnızca bir tüketici atanabileceğinden, toplam tüketici sayısı konudaki bölüm sayısını geçmemelidir. -- `kafka_skip_broken_messages` – Kafka message parser tolerance to schema-incompatible messages per block. Default: `0`. Eğer `kafka_skip_broken_messages = N` sonra motor atlar *N* Ayrıştırılamayan Kafka iletileri (bir ileti bir veri satırına eşittir). - -Örnekler: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - SELECT * FROM queue LIMIT 5; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') - SETTINGS kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; -``` - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın. Mümkünse, eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format - [, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_skip_broken_messages]) -``` - -
- -## Açıklama {#description} - -Teslim edilen mesajlar otomatik olarak izlenir, bu nedenle bir gruptaki her mesaj yalnızca bir kez sayılır. Verileri iki kez almak istiyorsanız, tablonun başka bir grup adıyla bir kopyasını oluşturun. - -Gruplar esnek ve kümede senkronize edilir. Örneğin, bir kümede 10 konu ve bir tablonun 5 kopyası varsa, her kopya 2 konu alır. Kopya sayısı değişirse, konular kopyalar arasında otomatik olarak yeniden dağıtılır. Bu konuda daha fazla bilgi edinin http://kafka.apache.org/intro. - -`SELECT` mesajları okumak için özellikle yararlı değildir (hata ayıklama hariç), çünkü her mesaj yalnızca bir kez okunabilir. Hayata görünümler kullanarak gerçek zamanlı iş parçacıkları oluşturmak daha pratiktir. Bunu yapmak için : - -1. Bir Kafka tüketici oluşturmak için motoru kullanın ve bir veri akışı düşünün. -2. İstenen yapıya sahip bir tablo oluşturun. -3. Verileri motordan dönüştüren ve daha önce oluşturulmuş bir tabloya koyan materyalleştirilmiş bir görünüm oluşturun. - -Ne zaman `MATERIALIZED VIEW` motora katılır, arka planda veri toplamaya başlar. Bu, kafka'dan sürekli olarak mesaj almanızı ve bunları kullanarak gerekli biçime dönüştürmenizi sağlar `SELECT`. -Bir kafka tablosu istediğiniz kadar materialized görüşe sahip olabilir, kafka tablosundan doğrudan veri okumazlar, ancak yeni kayıtlar (bloklar halinde) alırlar, bu şekilde farklı ayrıntı seviyesine sahip birkaç tabloya yazabilirsiniz (gruplama-toplama ve olmadan). - -Örnek: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - CREATE TABLE daily ( - day Date, - level String, - total UInt64 - ) ENGINE = SummingMergeTree(day, (day, level), 8192); - - CREATE MATERIALIZED VIEW consumer TO daily - AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total - FROM queue GROUP BY day, level; - - SELECT level, sum(total) FROM daily GROUP BY level; -``` - -Performansı artırmak için, alınan iletiler bloklar halinde gruplandırılır [max\_ınsert\_block\_size](../../../operations/server_configuration_parameters/settings.md#settings-max_insert_block_size). İçinde blok oluş ifma ifdıysa [stream\_flush\_interval\_ms](../../../operations/server_configuration_parameters/settings.md) milisaniye, veri blok bütünlüğü ne olursa olsun tabloya temizlendi. - -Konu verilerini almayı durdurmak veya dönüşüm mantığını değiştirmek için, hayata geçirilmiş görünümü ayırın: - -``` sql - DETACH TABLE consumer; - ATTACH TABLE consumer; -``` - -Kullanarak hedef tabloyu değiştirmek istiyorsanız `ALTER` hedef tablo ile görünümdeki veriler arasındaki tutarsızlıkları önlemek için malzeme görünümünü devre dışı bırakmanızı öneririz. - -## Yapılandırma {#configuration} - -GraphiteMergeTree benzer şekilde, Kafka motoru ClickHouse yapılandırma dosyasını kullanarak genişletilmiş yapılandırmayı destekler. Kullanabileceğiniz iki yapılandırma anahtarı vardır: global (`kafka`) ve konu düzeyinde (`kafka_*`). Genel yapılandırma önce uygulanır ve sonra konu düzeyinde yapılandırma uygulanır (varsa). - -``` xml - - - cgrp - smallest - - - - - 250 - 100000 - -``` - -Olası yapılandırma seçeneklerinin listesi için bkz. [librdkafka yapılandırma referansı](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). Alt çizgiyi kullan (`_`) ClickHouse yapılandırmasında bir nokta yerine. Mesela, `check.crcs=true` olacak `true`. - -## Sanal Sütunlar {#virtual-columns} - -- `_topic` — Kafka topic. -- `_key` — Key of the message. -- `_offset` — Offset of the message. -- `_timestamp` — Timestamp of the message. -- `_partition` — Partition of Kafka topic. - -**Ayrıca Bakınız** - -- [Sanal sütunlar](../index.md#table_engines-virtual_columns) - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) diff --git a/docs/tr/engines/table_engines/integrations/mysql.md b/docs/tr/engines/table_engines/integrations/mysql.md deleted file mode 100644 index f6c811465e6..00000000000 --- a/docs/tr/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 33 -toc_title: MySQL ---- - -# Mysql {#mysql} - -MySQL motoru gerçekleştirmek için izin verir `SELECT` uzak bir MySQL sunucusunda depolanan veriler üzerinde sorgular. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... -) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -Ayrıntılı bir açıklamasını görmek [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) sorgu. - -Tablo yapısı orijinal MySQL tablo yapısından farklı olabilir: - -- Sütun adları orijinal MySQL tablosundaki ile aynı olmalıdır, ancak bu sütunların sadece bazılarını ve herhangi bir sırada kullanabilirsiniz. -- Sütun türleri orijinal MySQL tablosundakilerden farklı olabilir. ClickHouse çalışır [döküm](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) ClickHouse veri türleri için değerler. - -**Motor Parametreleri** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` için sorgular `REPLACE INTO`. Eğer `replace_query=1`, sorgu değiştirilir. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` eklenen ifade `INSERT` sorgu. - - Örnek: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, nere `on_duplicate_clause` oluyor `UPDATE c2 = c2 + 1`. Görmek [MySQL dökü documentationmanları](https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html) bulmak için hangi `on_duplicate_clause` ile kullanabilirsiniz `ON DUPLICATE KEY` yan. - - Belirtmek `on_duplicate_clause` sen geçmek gerekir `0` to the `replace_query` parametre. Aynı anda geçerseniz `replace_query = 1` ve `on_duplicate_clause`, ClickHouse bir özel durum oluşturur. - -Basit `WHERE` gibi maddeler `=, !=, >, >=, <, <=` MySQL sunucusunda yürütülür. - -Geri kalan şartlar ve `LIMIT` örnekleme kısıtlaması, yalnızca MySQL sorgusu bittikten sonra Clickhouse'da yürütülür. - -## Kullanım Örneği {#usage-example} - -MySQL tablo: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Clickhouse'daki tablo, yukarıda oluşturulan MySQL tablosundan veri alma: - -``` sql -CREATE TABLE mysql_table -( - `float_nullable` Nullable(Float32), - `int_id` Int32 -) -ENGINE = MySQL('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` sql -SELECT * FROM mysql_table -``` - -``` text -┌─float_nullable─┬─int_id─┐ -│ ᴺᵁᴸᴸ │ 1 │ -└────────────────┴────────┘ -``` - -## Ayrıca Bakınız {#see-also} - -- [Bu ‘mysql’ tablo fonksiyonu](../../../sql_reference/table_functions/mysql.md) -- [Harici sözlük kaynağı olarak MySQL kullanma](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) diff --git a/docs/tr/engines/table_engines/integrations/odbc.md b/docs/tr/engines/table_engines/integrations/odbc.md deleted file mode 100644 index 86ded26587a..00000000000 --- a/docs/tr/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 35 -toc_title: ODBC ---- - -# ODBC {#table-engine-odbc} - -ClickHouse üzerinden harici veritabanlarına bağlanmak için izin verir [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -ODBC bağlantılarını güvenli bir şekilde uygulamak için ClickHouse ayrı bir program kullanır `clickhouse-odbc-bridge`. ODBC sürücüsü doğrudan yüklenmişse `clickhouse-server`, sürücü sorunları ClickHouse sunucu çökmesine neden olabilir. ClickHouse otomatik olarak başlar `clickhouse-odbc-bridge` gerekli olduğunda. ODBC Köprüsü programı aynı paketten yüklenir `clickhouse-server`. - -Bu motor destekler [Nullable](../../../sql_reference/data_types/nullable.md) veri türü. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -Ayrıntılı bir açıklamasını görmek [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) sorgu. - -Tablo yapısı kaynak tablo yapısından farklı olabilir: - -- Sütun adları kaynak tablodaki ile aynı olmalıdır, ancak yalnızca bu sütunlardan bazılarını ve herhangi bir sırada kullanabilirsiniz. -- Sütun türleri kaynak tablodakilerden farklı olabilir. ClickHouse çalışır [döküm](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) ClickHouse veri türleri için değerler. - -**Motor Parametreleri** - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` Dosya. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -## Kullanım Örneği {#usage-example} - -**ODBC üzerinden yerel MySQL kurulumundan veri alma** - -Bu örnek Ubuntu Linux 18.04 ve MySQL server 5.7 için kontrol edilir. - -UnixODBC ve MySQL Connector yüklü olduğundan emin olun. - -Varsayılan olarak (paketlerden yüklüyse), ClickHouse kullanıcı olarak başlar `clickhouse`. Bu nedenle, bu kullanıcıyı MySQL sunucusunda oluşturmanız ve yapılandırmanız gerekir. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Sonra bağlantıyı yapılandırın `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Kullanarak bağlantıyı kontrol edebilirsiniz `isql` unixodbc yüklemesinden yardımcı program. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -MySQL tablo: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Clickhouse'daki tablo, MySQL tablosundan veri alma: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## Ayrıca Bakınız {#see-also} - -- [ODBC harici sözlükler](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBC tablo işlevi](../../../sql_reference/table_functions/odbc.md) - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/tr/engines/table_engines/log_family/log.md b/docs/tr/engines/table_engines/log_family/log.md deleted file mode 100644 index ca1f8c4c1f4..00000000000 --- a/docs/tr/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 33 -toc_title: "G\xFCnl\xFCk" ---- - -# Günlük {#log} - -Motor günlük motorları ailesine aittir. Günlük motorlarının ortak özelliklerini ve farklılıklarını görün [Log Engine Ailesi](log_family.md) makale. - -Log differsar differsit fromma [TinyLog](tinylog.md) bu küçük bir dosyada “marks” sütun dosyaları ile bulunur. Bu işaretler her veri bloğuna yazılır ve belirtilen satır sayısını atlamak için dosyayı okumaya nereden başlayacağınızı gösteren uzaklıklar içerir. Bu, tablo verilerini birden çok iş parçacığında okumayı mümkün kılar. -Eşzamanlı veri erişimi için, okuma işlemleri aynı anda gerçekleştirilebilirken, yazma işlemleri okur ve birbirlerini engeller. -Günlük altyapısı dizinleri desteklemez. Benzer şekilde, bir tabloya yazma başarısız olursa, tablo bozulur ve Okuma bir hata döndürür. Günlük altyapısı, geçici veriler, bir kez yazma tabloları ve sınama veya gösteri amaçları için uygundur. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/log/) diff --git a/docs/tr/engines/table_engines/log_family/log_family.md b/docs/tr/engines/table_engines/log_family/log_family.md deleted file mode 100644 index 2a954c60def..00000000000 --- a/docs/tr/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 31 -toc_title: "Giri\u015F" ---- - -# Log Engine Ailesi {#log-engine-family} - -Bu motorlar, birçok küçük tabloyu (yaklaşık 1 milyon satıra kadar) hızlı bir şekilde yazmanız ve daha sonra bir bütün olarak okumanız gerektiğinde senaryolar için geliştirilmiştir. - -Ailenin motorları: - -- [StripeLog](stripelog.md) -- [Günlük](log.md) -- [TinyLog](tinylog.md) - -## Ortak Özellikler {#common-properties} - -Motorlar: - -- Verileri bir diskte saklayın. - -- Yazarken dosyanın sonuna veri ekleyin. - -- Eşzamanlı veri erişimi için destek kilitleri. - - Sırasında `INSERT` sorgular, tablo kilitlenir ve veri okumak ve yazmak için diğer sorgular hem tablonun kilidini açmak için bekler. Veri yazma sorguları varsa, herhangi bir sayıda veri okuma sorguları aynı anda gerçekleştirilebilir. - -- Destek yok [mutasyon](../../../sql_reference/statements/alter.md#alter-mutations) harekat. - -- Dizinleri desteklemez. - - Bu demektir ki `SELECT` veri aralıkları için sorgular verimli değildir. - -- Atomik veri yazmayın. - - Bir şey yazma işlemini bozarsa, örneğin anormal sunucu kapatma gibi bozuk verilerle bir tablo alabilirsiniz. - -## Farklılıklar {#differences} - -Bu `TinyLog` motor, ailenin en basitidir ve en fakir işlevselliği ve en düşük verimliliği sağlar. Bu `TinyLog` motor, birkaç iş parçacığı tarafından paralel veri okumayı desteklemez. Paralel okumayı destekleyen ailedeki diğer motorlardan daha yavaş veri okur ve neredeyse birçok tanımlayıcı kullanır `Log` motor, her sütunu ayrı bir dosyada sakladığı için. Basit düşük yük senaryolarında kullanın. - -Bu `Log` ve `StripeLog` motorlar paralel veri okumayı destekler. Veri okurken, ClickHouse birden çok iş parçacığı kullanır. Her iş parçacığı ayrı bir veri bloğu işler. Bu `Log` engine, tablonun her sütunu için ayrı bir dosya kullanır. `StripeLog` tüm verileri tek bir dosyada saklar. Sonuç olarak, `StripeLog` motor işletim sisteminde daha az tanımlayıcı kullanır, ancak `Log` motor veri okurken daha yüksek verimlilik sağlar. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/tr/engines/table_engines/log_family/stripelog.md b/docs/tr/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index 1ff251c3ee0..00000000000 --- a/docs/tr/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 32 -toc_title: StripeLog ---- - -# Stripelog {#stripelog} - -Bu motor günlük motor ailesine aittir. Günlük motorlarının ortak özelliklerini ve farklılıklarını görün [Log Engine Ailesi](log_family.md) makale. - -Az miktarda veri içeren (1 milyondan az satır) birçok tablo yazmanız gerektiğinde, bu altyapıyı senaryolarda kullanın. - -## Tablo oluşturma {#table_engines-stripelog-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = StripeLog -``` - -Ayrıntılı açıklamasına bakın [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) sorgu. - -## Veri yazma {#table_engines-stripelog-writing-the-data} - -Bu `StripeLog` motor tüm sütunları tek bir dosyada saklar. Her biri için `INSERT` sorgu, ClickHouse veri bloğunu bir tablo dosyasının sonuna ekler, sütunları tek tek yazar. - -Her tablo için ClickHouse dosyaları yazar: - -- `data.bin` — Data file. -- `index.mrk` — File with marks. Marks contain offsets for each column of each data block inserted. - -Bu `StripeLog` motor desteklemiyor `ALTER UPDATE` ve `ALTER DELETE` harekat. - -## Verileri okuma {#table_engines-stripelog-reading-the-data} - -İşaretli dosya, Clickhouse'un verilerin okunmasını paralelleştirmesine izin verir. Bu demektir `SELECT` sorgu satırları öngörülemeyen bir sırayla döndürür. Kullan... `ORDER BY` satırları sıralamak için yan tümce. - -## Kullanım Örneği {#table_engines-stripelog-example-of-use} - -Tablo oluşturma: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -Veri ekleme: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -İki kullandık `INSERT` içinde iki veri bloğu oluşturmak için sorgular `data.bin` Dosya. - -ClickHouse veri seçerken birden çok iş parçacığı kullanır. Her iş parçacığı ayrı bir veri bloğu okur ve sonuç olarak satırları bağımsız olarak döndürür. Sonuç olarak, çıktıdaki satır bloklarının sırası, çoğu durumda girişteki aynı blokların sırasına uymuyor. Mesela: - -``` sql -SELECT * FROM stripe_log_table -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -┌───────────timestamp─┬─message_type─┬─message───────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -└─────────────────────┴──────────────┴───────────────────────────┘ -``` - -Sonuçları sıralama (varsayılan olarak artan sipariş): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - -``` text -┌───────────timestamp─┬─message_type─┬─message────────────────────┐ -│ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ -│ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ -│ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ -└─────────────────────┴──────────────┴────────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/tr/engines/table_engines/log_family/tinylog.md b/docs/tr/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index e4eccf220b1..00000000000 --- a/docs/tr/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 34 -toc_title: TinyLog ---- - -# TinyLog {#tinylog} - -Motor log engine ailesine aittir. Görmek [Log Engine Ailesi](log_family.md) günlük motorlarının ortak özellikleri ve farklılıkları için. - -Bu tablo motoru genellikle write-once yöntemi ile kullanılır: verileri bir kez yazın, ardından gerektiği kadar okuyun. Örneğin, kullanabilirsiniz `TinyLog`- küçük gruplar halinde işlenen Ara veriler için tablolar yazın. Çok sayıda küçük tabloda veri depolamanın verimsiz olduğunu unutmayın. - -Sorgular tek bir akışta yürütülür. Başka bir deyişle, bu motor nispeten küçük tablolar için tasarlanmıştır (yaklaşık 1.000.000 satıra kadar). Çok sayıda küçük tablonuz varsa, bu tablo motorunu kullanmak mantıklıdır, çünkü [Günlük](log.md) motor (daha az dosya açılması gerekir). - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/tinylog/) diff --git a/docs/tr/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/tr/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index 8034be02969..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 35 -toc_title: AggregatingMergeTree ---- - -# Aggregatingmergetree {#aggregatingmergetree} - -Motor devralır [MergeTree](mergetree.md#table_engines-mergetree), veri parçaları birleştirme mantığı değiştirme. ClickHouse, tüm satırları aynı birincil anahtarla değiştirir (veya daha doğru olarak, aynı [sıralama anahtarı](mergetree.md)) tek bir satırla (bir veri parçası içinde), toplama işlevlerinin durumlarının bir kombinasyonunu saklar. - -Kullanabilirsiniz `AggregatingMergeTree` artımlı veri toplama, toplanan materialized görünümleri de dahil olmak üzere tablolar. - -Motor tüm sütunları ile işler [AggregateFunction](../../../sql_reference/data_types/aggregatefunction.md) tür. - -Kullanmak uygundur `AggregatingMergeTree` siparişlere göre satır sayısını azaltırsa. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[TTL expr] -[SETTINGS name=value, ...] -``` - -İstek parametrelerinin açıklaması için bkz. [istek açıklaması](../../../sql_reference/statements/create.md). - -**Sorgu yan tümceleri** - -Oluştururken bir `AggregatingMergeTree` tablo aynı [yanlar](mergetree.md) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -Tüm parametreler, aşağıdaki gibi aynı anlama sahiptir `MergeTree`. -
- -## Seç ve Ekle {#select-and-insert} - -Veri eklemek için şunları kullanın [INSERT SELECT](../../../sql_reference/statements/insert_into.md) agrega-Devlet-fonksiyonları ile sorgu. -Veri seçerken `AggregatingMergeTree` tablo kullanın `GROUP BY` yan tümce ve veri eklerken aynı toplama işlevleri, ancak kullanarak `-Merge` sonek. - -Sonuç inlarında `SELECT` sorgu, değerleri `AggregateFunction` türü, Tüm ClickHouse çıktı biçimleri için uygulamaya özgü ikili gösterime sahiptir. Örneğin, veri dökümü, `TabSeparated` ile format `SELECT` sorgu daha sonra bu dökümü kullanarak geri yüklenebilir `INSERT` sorgu. - -## Toplu bir Somutlaştırılmış Görünüm örneği {#example-of-an-aggregated-materialized-view} - -`AggregatingMergeTree` saatler hayata görünüm `test.visits` Tablo: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -Veri ekleme `test.visits` Tablo. - -``` sql -INSERT INTO test.visits ... -``` - -Veriler hem tablo hem de görünümde eklenir `test.basic` toplama işlemini gerçekleştir .ecektir. - -Toplanan verileri almak için, aşağıdaki gibi bir sorgu yürütmemiz gerekir `SELECT ... GROUP BY ...` görünüm fromden `test.basic`: - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/tr/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/tr/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index 3ef53846f32..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 36 -toc_title: CollapsingMergeTree ---- - -# CollapsingMergeTree {#table_engine-collapsingmergetree} - -Motor devralır [MergeTree](mergetree.md) ve veri parçaları birleştirme algoritmasına çöken satırların mantığını ekler. - -`CollapsingMergeTree` sıralama anahtarındaki tüm alanlar zaman uyumsuz olarak siler (daraltır) satır çiftleri (`ORDER BY`) belirli alan hariç eşdeğerdir `Sign` hangi olabilir `1` ve `-1` değerler. Çift olmayan satırlar tutulur. Daha fazla bilgi için bkz: [Çökme](#table_engine-collapsingmergetree-collapsing) belgenin bölümü. - -Motor depolama hacmini önemli ölçüde azaltabilir ve `SELECT` sonuç olarak sorgu. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Sorgu parametrelerinin açıklaması için bkz. [sorgu açıklaması](../../../sql_reference/statements/create.md). - -**CollapsingMergeTree Parametreleri** - -- `sign` — Name of the column with the type of row: `1` is a “state” satır, `-1` is a “cancel” satır. - - Column data type — `Int8`. - -**Sorgu yan tümceleri** - -Oluştururken bir `CollapsingMergeTree` tablo, aynı [sorgu yan tümceleri](mergetree.md#table_engine-mergetree-creating-a-table) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -Hariç tüm parametreler `sign` içinde olduğu gibi aynı anlama sahip `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` — “state” satır, `-1` — “cancel” satır. - - Column Data Type — `Int8`. - -
- -## Çökme {#table_engine-collapsingmergetree-collapsing} - -### Veriler {#data} - -Bazı nesneler için sürekli değişen verileri kaydetmeniz gereken durumu düşünün. Bir nesne için bir satıra sahip olmak ve herhangi bir değişiklikte güncellemek mantıklı geliyor, ancak güncelleme işlemi dbms için pahalı ve yavaş çünkü depolama alanındaki verilerin yeniden yazılmasını gerektiriyor. Verileri hızlı bir şekilde yazmanız gerekiyorsa, güncelleme kabul edilemez, ancak bir nesnenin değişikliklerini sırayla aşağıdaki gibi yazabilirsiniz. - -Belirli sütunu kullanın `Sign`. Eğer `Sign = 1` bu, satırın bir nesnenin durumu olduğu anlamına gelir, diyelim ki “state” satır. Eğer `Sign = -1` aynı özelliklere sahip bir nesnenin durumunun iptali anlamına gelir, diyelim ki “cancel” satır. - -Örneğin, kullanıcıların bazı sitelerde ne kadar sayfa kontrol ettiğini ve ne kadar süre orada olduklarını hesaplamak istiyoruz. Bir anda kullanıcı etkinliği durumu ile aşağıdaki satırı yazıyoruz: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Bir an sonra kullanıcı aktivitesinin değişikliğini kaydedip aşağıdaki iki satırla yazıyoruz. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -İlk satır, nesnenin (kullanıcı) önceki durumunu iptal eder. İptal edilen durumun sıralama anahtar alanlarını kopyalamalıdır `Sign`. - -İkinci satır geçerli durumu içerir. - -Sadece kullanıcı etkinliğinin son durumuna ihtiyacımız olduğu için, satırlar - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -bir nesnenin geçersiz (eski) durumunu daraltarak silinebilir. `CollapsingMergeTree` veri parçalarının birleştirilmesi sırasında bunu yapar. - -Neden her değişiklik için 2 satıra ihtiyacımız var [Algoritma](#table_engine-collapsingmergetree-collapsing-algorithm) paragraf. - -**Bu yaklaşımın kendine özgü özellikleri** - -1. Verileri yazan program, iptal edebilmek için bir nesnenin durumunu hatırlamalıdır. “Cancel” dize, sıralama anahtar alanlarının kopyalarını içermelidir. “state” dize ve tersi `Sign`. Bu depolama başlangıç boyutunu artırır ama hızlı bir şekilde veri yazmak için izin verir. -2. Sütunlardaki uzun büyüyen diziler, yazma yükü nedeniyle motorun verimliliğini azaltır. Daha basit veriler, verimlilik o kadar yüksek olur. -3. Bu `SELECT` sonuçlara itiraz değişiklikler tarihin tutarlılık bağlıdır. Ekleme için veri hazırlarken doğru olun. Tutarsız verilerde öngörülemeyen sonuçlar elde edebilirsiniz, örneğin, oturum derinliği gibi negatif olmayan metrikler için negatif değerler. - -### Algoritma {#table_engine-collapsingmergetree-collapsing-algorithm} - -ClickHouse veri parçalarını birleştirdiğinde, her ardışık satır grubu aynı sıralama anahtarıyla (`ORDER BY`) en fazla iki satır reduceda indir isgen ,ir, biri `Sign = 1` (“state” satır) ve başka bir `Sign = -1` (“cancel” satır). Başka bir deyişle, girişler çöker. - -Elde edilen her veri parçası için ClickHouse kaydeder: - -1. Birincilik “cancel” ve son “state” satır sayısı ise “state” ve “cancel” satırlar eşleşir ve son satır bir “state” satır. - -2. Son “state” satır, daha varsa “state” satırlar daha “cancel” satırlar. - -3. Birincilik “cancel” satır, daha varsa “cancel” satırlar daha “state” satırlar. - -4. Diğer tüm durumlarda satırların hiçbiri. - -Ayrıca en az 2 tane daha olduğunda “state” satırlar daha “cancel” satırlar veya en az 2 tane daha “cancel” r rowsows th thenen “state” satırlar, birleştirme devam eder, ancak ClickHouse bu durumu mantıksal bir hata olarak değerlendirir ve sunucu günlüğüne kaydeder. Aynı veriler birden çok kez eklendiğinde, bu hata oluşabilir. - -Bu nedenle, çöken istatistik hesaplama sonuçlarını değiştirmemelidir. -Değişiklikler yavaş yavaş çöktü, böylece sonunda hemen hemen her nesnenin sadece son durumu kaldı. - -Bu `Sign` birleştirme algoritması, aynı sıralama anahtarına sahip tüm satırların aynı sonuçtaki veri bölümünde ve hatta aynı fiziksel sunucuda olacağını garanti etmediğinden gereklidir. ClickHouse süreci `SELECT` birden çok iş parçacığına sahip sorgular ve sonuçtaki satırların sırasını tahmin edemez. Tamamen almak için bir ihtiyaç varsa toplama gereklidir “collapsed” veri `CollapsingMergeTree` Tablo. - -Daraltmayı sonuçlandırmak için bir sorgu yazın `GROUP BY` yan tümce ve işareti için hesap toplama işlevleri. Örneğin, miktarı hesaplamak için kullanın `sum(Sign)` yerine `count()`. Bir şeyin toplamını hesaplamak için şunları kullanın `sum(Sign * x)` yerine `sum(x)`, ve böylece, ve ayrıca ekleyin `HAVING sum(Sign) > 0`. - -Toplanan `count`, `sum` ve `avg` bu şekilde hesaplanmış olabilir. Toplanan `uniq` bir nesnenin en az bir durumu çökmüş değilse hesaplanabilir. Toplanan `min` ve `max` hesaplan becauseamadı çünkü `CollapsingMergeTree` daraltılmış durumların değerleri geçmişini kaydetmez. - -Toplama olmadan veri ayıklamanız gerekiyorsa (örneğin, en yeni değerleri belirli koşullarla eşleşen satırların mevcut olup olmadığını kontrol etmek için) `FINAL` değiştirici için `FROM` yan. Bu yaklaşım önemli ölçüde daha az etkilidir. - -## Kullanım Örneği {#example-of-use} - -Örnek veriler: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Tablonun oluşturulması: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Veri ekleme: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -Biz iki kullanın `INSERT` iki farklı veri parçası oluşturmak için sorgular. Verileri bir sorgu ile eklersek ClickHouse bir veri parçası oluşturur ve hiç bir birleştirme gerçekleştirmez. - -Veri alma: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Ne görüyoruz ve nerede çöküyor? - -İki ile `INSERT` sorgular, 2 Veri parçası oluşturduk. Bu `SELECT` sorgu 2 iş parçacığında yapıldı ve rastgele bir satır sırası aldık. Veri parçalarının henüz birleştirilmediği için çökme gerçekleşmedi. ClickHouse biz tahmin edemez bilinmeyen bir anda veri kısmını birleştirir. - -Böylece toplama ihtiyacımız var: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -Toplamaya ihtiyacımız yoksa ve çökmeyi zorlamak istiyorsak, şunları kullanabiliriz `FINAL` değiştirici için `FROM` yan. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Verileri seçmenin bu yolu çok verimsizdir. Büyük masalar için kullanmayın. - -## Başka Bir Yaklaşım Örneği {#example-of-another-approach} - -Örnek veriler: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ -│ 4324182021466249494 │ -5 │ -146 │ -1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -Fikir, birleştirmelerin yalnızca anahtar alanları hesaba katmasıdır. Ve içinde “Cancel” satır işareti sütununu kullanmadan toplanırken satırın önceki sürümünü eşitleyen negatif değerleri belirtebiliriz. Bu yaklaşım için veri türünü değiştirmek gerekir `PageViews`,`Duration` uint8 -\> Int16 negatif değerlerini saklamak için. - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews Int16, - Duration Int16, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -Yaklaşımı test edelim: - -``` sql -insert into UAct values(4324182021466249494, 5, 146, 1); -insert into UAct values(4324182021466249494, -5, -146, -1); -insert into UAct values(4324182021466249494, 6, 185, 1); - -select * from UAct final; // avoid using final in production (just for a test or small tables) -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -``` sql -SELECT - UserID, - sum(PageViews) AS PageViews, - sum(Duration) AS Duration -FROM UAct -GROUP BY UserID -```text -┌──────────────UserID─┬─PageViews─┬─Duration─┐ -│ 4324182021466249494 │ 6 │ 185 │ -└─────────────────────┴───────────┴──────────┘ -``` - -``` sqk -select count() FROM UAct -``` - -``` text -┌─count()─┐ -│ 3 │ -└─────────┘ -``` - -``` sql -optimize table UAct final; - -select * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) diff --git a/docs/tr/engines/table_engines/mergetree_family/custom_partitioning_key.md b/docs/tr/engines/table_engines/mergetree_family/custom_partitioning_key.md deleted file mode 100644 index ba09aa08cbb..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 32 -toc_title: "\xD6zel B\xF6l\xFCmleme Anahtar\u0131" ---- - -# Özel Bölümleme Anahtarı {#custom-partitioning-key} - -Bölümleme için kullanılabilir [MergeTree](mergetree.md) aile tabloları (dahil [çoğaltıyordu](replication.md) Tablolar). [Hayata görünümler](../special/materializedview.md) MergeTree tablolarına dayanarak bölümlemeyi de destekler. - -Bir bölüm, bir tablodaki kayıtların belirtilen bir kritere göre mantıksal bir birleşimidir. Bir bölümü, ay, gün veya olay türü gibi rasgele bir ölçütle ayarlayabilirsiniz. Bu verilerin manipülasyonlarını basitleştirmek için her bölüm ayrı ayrı saklanır. Verilere erişirken, ClickHouse mümkün olan en küçük bölüm alt kümesini kullanır. - -Bölüm belirtilen `PARTITION BY expr` fık whenra ne zaman [tablo oluşturma](mergetree.md#table_engine-mergetree-creating-a-table). Bölüm anahtarı tablo sütunlarından herhangi bir ifade olabilir. Örneğin, aya göre bölümleme belirtmek için ifadeyi kullanın `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour; -``` - -Bölüm anahtarı ayrıca bir ifade kümesi olabilir ( [birincil anahtar](mergetree.md#primary-keys-and-indexes-in-queries)). Mesela: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -Bu örnekte, bölümlemeyi geçerli hafta boyunca meydana gelen olay türlerine göre ayarladık. - -Bir tabloya yeni veri eklerken, bu veriler birincil anahtara göre sıralanmış ayrı bir parça (yığın) olarak depolanır. Taktıktan 10-15 dakika sonra, aynı bölümün parçaları tüm parçaya birleştirilir. - -!!! info "Bilgin" - Birleştirme yalnızca bölümleme ifadesi için aynı değere sahip veri parçaları için çalışır. Bu demektir **aşırı granüler bölümler yapmamalısınız** (yaklaşık binden fazla bölüm). Aksi takdirde, `SELECT` sorgu, dosya sistemindeki ve açık dosya tanımlayıcılarındaki makul olmayan sayıda dosya nedeniyle yetersiz performans gösterir. - -Kullan... [sistem.parçalar](../../../operations/system_tables.md#system_tables-parts) tablo tablo parçaları ve bölümleri görüntülemek için. Örneğin, bir var varsayalım `visits` aya göre bölümleme ile tablo. Hadi gerçekleştirelim `SELECT` sorgu için `system.parts` Tablo: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 1 │ -│ 201902 │ 201902_11_11_0 │ 1 │ -└───────────┴────────────────┴────────┘ -``` - -Bu `partition` sütun bölümlerin adlarını içerir. Bu örnekte iki bölüm vardır: `201901` ve `201902`. Bölüm adını belirtmek için bu sütun değerini kullanabilirsiniz [ALTER … PARTITION](#alter_manipulations-with-partitions) sorgular. - -Bu `name` sütun, bölüm veri parçalarının adlarını içerir. Bölümün adını belirtmek için bu sütunu kullanabilirsiniz. [ALTER ATTACH PART](#alter_attach-partition) sorgu. - -İlk bölümün adını kıralım: `201901_1_3_1`: - -- `201901` bölüm adıdır. -- `1` en az veri bloğu sayısıdır. -- `3` veri bloğunun maksimum sayısıdır. -- `1` yığın düzeyidir (oluşturduğu birleştirme ağacının derinliği). - -!!! info "Bilgin" - Eski tip tabloların parçaları adı vardır: `20190117_20190123_2_2_0` (minimum tarih - maksimum tarih - minimum blok numarası - maksimum blok numarası - seviye). - -Bu `active` sütun, parçanın durumunu gösterir. `1` aktif istir; `0` etkin değil. Etkin olmayan parçalar, örneğin, daha büyük bir parçaya birleştirildikten sonra kalan kaynak parçalarıdır. Bozuk veri parçaları da etkin olarak gösterilir. - -Örnekte gördüğünüz gibi, aynı bölümün birkaç ayrı parçası vardır (örneğin, `201901_1_3_1` ve `201901_1_9_2`). Bu, bu parçaların henüz birleştirilmediği anlamına gelir. ClickHouse, eklendikten yaklaşık 15 dakika sonra eklenen veri parçalarını periyodik olarak birleştirir. Buna ek olarak, kullanarak zamanlanmış olmayan birleştirme gerçekleştirebilirsiniz [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) sorgu. Örnek: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - -``` text -┌─partition─┬─name───────────┬─active─┐ -│ 201901 │ 201901_1_3_1 │ 0 │ -│ 201901 │ 201901_1_9_2 │ 1 │ -│ 201901 │ 201901_8_8_0 │ 0 │ -│ 201901 │ 201901_9_9_0 │ 0 │ -│ 201902 │ 201902_4_6_1 │ 0 │ -│ 201902 │ 201902_4_11_2 │ 1 │ -│ 201902 │ 201902_10_10_0 │ 0 │ -│ 201902 │ 201902_11_11_0 │ 0 │ -└───────────┴────────────────┴────────┘ -``` - -Etkin olmayan parçalar birleştirildikten yaklaşık 10 dakika sonra silinecektir. - -Bir parça ve bölüm kümesini görüntülemenin başka bir yolu da tablonun dizinine gitmektir: `/var/lib/clickhouse/data///`. Mesela: - -``` bash -/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -Klasör ‘201901\_1\_1\_0’, ‘201901\_1\_7\_1’ ve böylece parçaların dizinleri vardır. Her bölüm karşılık gelen bir bölümle ilgilidir ve yalnızca belirli bir ay için veri içerir (Bu örnekteki tabloda aylara göre bölümleme vardır). - -Bu `detached` dizin kullanarak tablodan ayrılmış parçaları içerir [DETACH](#alter_detach-partition) sorgu. Bozuk parçalar da silinmek yerine bu dizine taşınır. Sunucu parçaları kullanmaz `detached` directory. You can add, delete, or modify the data in this directory at any time – the server will not know about this until you run the [ATTACH](../../../sql_reference/statements/alter.md#alter_attach-partition) sorgu. - -İşletim sunucusunda, sunucu bunu bilmediğinden, dosya sistemindeki parça kümesini veya verilerini el ile değiştiremeyeceğinizi unutmayın. Çoğaltılmamış tablolar için, sunucu durdurulduğunda bunu yapabilirsiniz, ancak önerilmez. Çoğaltılmış tablolar için, parça kümesi her durumda değiştirilemez. - -ClickHouse, bölümlerle işlemleri gerçekleştirmenize izin verir: bunları silin, bir tablodan diğerine kopyalayın veya bir yedek oluşturun. Bölümdeki tüm işlemlerin listesine bakın [Bölümler ve parçalar ile manipülasyonlar](../../../sql_reference/statements/alter.md#alter_manipulations-with-partitions). - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/tr/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/tr/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index 5d4a349631b..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 38 -toc_title: "Graph\u0131temergetree" ---- - -# Graphıtemergetree {#graphitemergetree} - -Bu motor inceltme ve toplama/ortalama (toplaması) için tasarlanmıştır) [Grafit](http://graphite.readthedocs.io/en/latest/index.html) veriler. Clickhouse'u Grafit için bir veri deposu olarak kullanmak isteyen geliştiriciler için yararlı olabilir. - -Toplamaya ihtiyacınız yoksa Grafit verilerini depolamak için herhangi bir ClickHouse tablo motorunu kullanabilirsiniz, ancak bir toplamaya ihtiyacınız varsa `GraphiteMergeTree`. Motor, depolama hacmini azaltır ve grafitten gelen sorguların verimliliğini arttırır. - -Motor özellikleri devralır [MergeTree](mergetree.md). - -## Tablo oluşturma {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Ayrıntılı bir açıklamasını görmek [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) sorgu. - -Grafit verileri için bir tablo aşağıdaki veriler için aşağıdaki sütunlara sahip olmalıdır: - -- Metrik adı (Grafit sensörü). Veri türü: `String`. - -- Metrik ölçme zamanı. Veri türü: `DateTime`. - -- Metrik değeri. Veri türü: herhangi bir sayısal. - -- Metrik sürümü. Veri türü: herhangi bir sayısal. - - ClickHouse en yüksek sürümü veya sürümleri aynı ise son yazılan satırları kaydeder. Veri parçalarının birleştirilmesi sırasında diğer satırlar silinir. - -Bu sütunların adları toplaması yapılandırmasında ayarlanmalıdır. - -**Graphıtemergetree parametreleri** - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -**Sorgu yan tümceleri** - -Oluştururken bir `GraphiteMergeTree` tablo, aynı [yanlar](mergetree.md#table_engine-mergetree-creating-a-table) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -Hariç tüm parametreler `config_section` içinde olduğu gibi aynı anlama sahip `MergeTree`. - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -
- -## Toplaması Yapılandırması {#rollup-configuration} - -Toplaması için ayarları tarafından tanımlanan [graphite\_rollup](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) sunucu yapılandırmasında parametre. Parametrenin adı herhangi biri olabilir. Birkaç yapılandırma oluşturabilir ve bunları farklı tablolar için kullanabilirsiniz. - -Toplaması yapılandırma yapısı: - - required-columns - patterns - -### Gerekli Sütunlar {#required-columns} - -- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. -- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. -- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. Varsayılan değer: `Value`. -- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. - -### Desenler {#patterns} - -Bu yapı `patterns` bölme: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "Dikkat" - Desenler kesinlikle sipariş edilmelidir: - - 1. Patterns without `function` or `retention`. - 1. Patterns with both `function` and `retention`. - 1. Pattern `default`. - -Bir satır işlerken, ClickHouse kuralları denetler `pattern` bölmeler. Tüm `pattern` (içeren `default`) bölümler içerebilir `function` toplama için parametre, `retention` parametreler veya her ikisi. Metrik adı eşleşirse `regexp` gelen kuralları `pattern` bölüm (veya bölümler) uygulanır; aksi takdirde, kurallar `default` bölüm kullanılır. - -Alanlar için `pattern` ve `default` bölmeler: - -- `regexp`– A pattern for the metric name. -- `age` – The minimum age of the data in seconds. -- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). -- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. - -### Yapılandırma Örneği {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/tr/engines/table_engines/mergetree_family/mergetree.md b/docs/tr/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index 5adb6c2b038..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,654 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 30 -toc_title: MergeTree ---- - -# MergeTree {#table_engines-mergetree} - -Bu `MergeTree` bu ailenin motoru ve diğer motorları (`*MergeTree`) en sağlam ClickHouse masa motorlarıdır. - -Motor inlarda `MergeTree` aile, bir tabloya çok büyük miktarda veri eklemek için tasarlanmıştır. Veriler hızlı bir şekilde tabloya kısmen yazılır, daha sonra parçaları arka planda birleştirmek için kurallar uygulanır. Bu yöntem, ınsert sırasında depolama alanındaki verileri sürekli olarak yeniden yazmaktan çok daha etkilidir. - -Ana özellikler: - -- Birincil anahtara göre sıralanmış verileri saklar. - - Bu, verileri daha hızlı bulmanıza yardımcı olan küçük bir seyrek dizin oluşturmanıza olanak sağlar. - -- Bölümler eğer kullanılabilir [bölümleme anahtarı](custom_partitioning_key.md) belirt .ilmektedir. - - ClickHouse, aynı sonuçla aynı veriler üzerindeki genel işlemlerden daha etkili olan bölümlerle belirli işlemleri destekler. ClickHouse, bölümleme anahtarının sorguda belirtildiği bölüm verilerini de otomatik olarak keser. Bu da sorgu performansını artırır. - -- Veri çoğaltma desteği. - - The family of `ReplicatedMergeTree` tablolar veri çoğaltma sağlar. Daha fazla bilgi için, bkz. [Veri çoğaltma](replication.md). - -- Veri örnekleme desteği. - - Gerekirse, tabloda veri örnekleme yöntemini ayarlayabilirsiniz. - -!!! info "Bilgin" - Bu [Birleştirmek](../special/merge.md) motor ait değil `*MergeTree` aile. - -## Tablo oluşturma {#table_engine-mergetree-creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 -) ENGINE = MergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...] -[SETTINGS name=value, ...] -``` - -Parametrelerin açıklaması için bkz. [Sorgu açıklaması oluştur](../../../sql_reference/statements/create.md). - -!!! note "Not" - `INDEX` deneysel bir özelliktir, bkz [Veri Atlama Dizinleri](#table_engine-mergetree-data_skipping-indexes). - -### Sorgu Yan Tümceleri {#mergetree-query-clauses} - -- `ENGINE` — Name and parameters of the engine. `ENGINE = MergeTree()`. Bu `MergeTree` motor parametreleri yok. - -- `PARTITION BY` — The [bölümleme anahtarı](custom_partitioning_key.md). - - Aylara göre bölümleme için `toYYYYMM(date_column)` ifade, nerede `date_column` türün tarihi olan bir sütun mu [Tarihli](../../../sql_reference/data_types/date.md). Burada bölüm isimleri var `"YYYYMM"` biçimli. - -- `ORDER BY` — The sorting key. - - Sütun veya keyfi ifadeler bir tuple. Örnek: `ORDER BY (CounterID, EventDate)`. - -- `PRIMARY KEY` — The primary key if it [sıralama anahtarından farklıdır](mergetree.md). - - Varsayılan olarak, birincil anahtar sıralama anahtarıyla aynıdır (bu anahtar tarafından belirtilir). `ORDER BY` yan). Bu nedenle çoğu durumda ayrı bir belirtmek gereksizdir `PRIMARY KEY` yan. - -- `SAMPLE BY` — An expression for sampling. - - Bir örnekleme ifadesi kullanılırsa, birincil anahtar onu içermelidir. Örnek: `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))`. - -- `TTL` — A list of rules specifying storage duration of rows and defining logic of automatic parts movement [diskler ve birimler arasında](#table_engine-mergetree-multiple-volumes). - - İfade bir olmalıdır `Date` veya `DateTime` sonuç olarak sütun. Örnek: - `TTL date + INTERVAL 1 DAY` - - Kuralın türü `DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'` ifade tatmin edildiyse (geçerli zamana ulaşırsa) parça ile yapılacak bir eylemi belirtir: süresi dolmuş satırların kaldırılması, bir parçanın (bir parçadaki tüm satırlar için ifade tatmin edildiyse) belirtilen diske taşınması (`TO DISK 'xxx'`) veya hacim (`TO VOLUME 'xxx'`). Kuralın varsayılan türü kaldırma (`DELETE`). Birden fazla kural listesi belirtilebilir, ancak birden fazla olmamalıdır `DELETE` kural. - - Daha fazla ayrıntı için bkz. [Sütunlar ve tablolar için TTL](#table_engine-mergetree-ttl) - -- `SETTINGS` — Additional parameters that control the behavior of the `MergeTree`: - - - `index_granularity` — Maximum number of data rows between the marks of an index. Default value: 8192. See [Veri Depolama](#mergetree-data-storage). - - `index_granularity_bytes` — Maximum size of data granules in bytes. Default value: 10Mb. To restrict the granule size only by number of rows, set to 0 (not recommended). See [Veri Depolama](#mergetree-data-storage). - - `enable_mixed_granularity_parts` — Enables or disables transitioning to control the granule size with the `index_granularity_bytes` ayar. 19.11 sürümünden önce, sadece `index_granularity` granül boyutunu kısıtlamak için ayar. Bu `index_granularity_bytes` büyük satırlar (onlarca ve megabayt yüzlerce) ile tablolardan veri seçerken ayarı ClickHouse performansını artırır. Büyük satırlara sahip tablolarınız varsa, tabloların verimliliğini artırmak için bu ayarı etkinleştirebilirsiniz. `SELECT` sorgular. - - `use_minimalistic_part_header_in_zookeeper` — Storage method of the data parts headers in ZooKeeper. If `use_minimalistic_part_header_in_zookeeper=1`, daha sonra ZooKeeper daha az veri depolar. Daha fazla bilgi için, bkz: [ayar açıklaması](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) içinde “Server configuration parameters”. - - `min_merge_bytes_to_use_direct_io` — The minimum data volume for merge operation that is required for using direct I/O access to the storage disk. When merging data parts, ClickHouse calculates the total storage volume of all the data to be merged. If the volume exceeds `min_merge_bytes_to_use_direct_io` bayt, ClickHouse okur ve doğrudan I/O arabirimi kullanarak depolama diskine veri yazar (`O_DIRECT` seçenek). Eğer `min_merge_bytes_to_use_direct_io = 0`, sonra doğrudan g / Ç devre dışı bırakılır. Varsayılan değer: `10 * 1024 * 1024 * 1024` baytlar. - - - `merge_with_ttl_timeout` — Minimum delay in seconds before repeating a merge with TTL. Default value: 86400 (1 day). - - `write_final_mark` — Enables or disables writing the final index mark at the end of data part (after the last byte). Default value: 1. Don't turn it off. - - `merge_max_block_size` — Maximum number of rows in block for merge operations. Default value: 8192. - - `storage_policy` — Storage policy. See [Veri depolama için birden fazla blok cihazı kullanma](#table_engine-mergetree-multiple-volumes). - -**Bölüm ayarı örneği** - -``` sql -ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 -``` - -Örnekte, aylara göre bölümleme ayarladık. - -Biz de kullanıcı kimliği ile karma olarak örnekleme için bir ifade ayarlayın. Bu, her biri için tablodaki verileri pseudorandomize etmenizi sağlar `CounterID` ve `EventDate`. Tanım yoularsanız bir [SAMPLE](../../../sql_reference/statements/select.md#select-sample-clause) yan tümcesi verileri seçerken, ClickHouse kullanıcıların bir alt kümesi için eşit pseudorandom veri örneği döndürür. - -Bu `index_granularity` 8192 varsayılan değer olduğundan ayarı atlanabilir. - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın. Mümkünse, eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -**MergeTree () Parametreleri** - -- `date-column` — The name of a column of the [Tarihli](../../../sql_reference/data_types/date.md) tür. ClickHouse otomatik olarak bu sütuna göre ay bölümleri oluşturur. Bölüm adları `"YYYYMM"` biçimli. -- `sampling_expression` — An expression for sampling. -- `(primary, key)` — Primary key. Type: [Demet()](../../../sql_reference/data_types/tuple.md) -- `index_granularity` — The granularity of an index. The number of data rows between the “marks” bir dizinin. 8192 değeri çoğu görev için uygundur. - -**Örnek** - -``` sql -MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) -``` - -Bu `MergeTree` motor, Ana motor yapılandırma yöntemi için yukarıdaki örnekte olduğu gibi yapılandırılır. -
- -## Veri Depolama {#mergetree-data-storage} - -Bir tabloda birincil anahtar tarafından sıralanmış verileri bölümden oluşmaktadır. - -Veri bir tabloya eklendiğinde, ayrı veri parçaları oluşturulur ve bunların her biri birincil anahtara göre lexicographically sıralanır. Örneğin, birincil anahtar `(CounterID, Date)`, parçadaki veriler şu şekilde sıralanır `CounterID` ve içinde her `CounterID` tarafından sipariş edilir `Date`. - -Farklı bölümlere ait veriler farklı parçalara ayrılır. Arka planda, ClickHouse daha verimli depolama için veri parçalarını birleştirir. Farklı bölümlere ait parçalar birleştirilmez. Birleştirme mekanizması, aynı birincil anahtara sahip tüm satırların aynı veri bölümünde olacağını garanti etmez. - -Her veri parçası mantıksal olarak granüllere ayrılmıştır. Bir granül, Clickhouse'un veri seçerken okuduğu en küçük bölünmez veri kümesidir. ClickHouse satırları veya değerleri bölmez, bu nedenle her granül her zaman bir tamsayı satır içerir. Bir granülün ilk satırı, satır için birincil anahtarın değeri ile işaretlenir. Her veri bölümü için ClickHouse işaretleri depolayan bir dizin dosyası oluşturur. Her sütun için, birincil anahtarda olsun ya da olmasın, ClickHouse aynı işaretleri de saklar. Bu işaretler, verileri doğrudan sütun dosyalarında bulmanızı sağlar. - -Granül boyutu ile sınırlıdır `index_granularity` ve `index_granularity_bytes` tablo motorunun ayarları. Bir granüldeki satır sayısı `[1, index_granularity]` Aralık, satırların boyutuna bağlı olarak. Bir granülün boyutu aşabilir `index_granularity_bytes` tek bir satırın boyutu ayarın değerinden büyükse. Bu durumda, granülün boyutu satırın boyutuna eşittir. - -## Sorgularda birincil anahtarlar ve dizinler {#primary-keys-and-indexes-in-queries} - -Tak thee the `(CounterID, Date)` örnek olarak birincil anahtar. Bu durumda, sıralama ve dizin aşağıdaki gibi gösterilebilir: - - Whole data: [---------------------------------------------] - CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] - Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] - Marks: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 - Marks numbers: 0 1 2 3 4 5 6 7 8 9 10 - -Veri sorgusu belirtirse: - -- `CounterID in ('a', 'h')`, sunucu işaretleri aralıklarında verileri okur `[0, 3)` ve `[6, 8)`. -- `CounterID IN ('a', 'h') AND Date = 3`, sunucu işaretleri aralıklarında verileri okur `[1, 3)` ve `[7, 8)`. -- `Date = 3`, sunucu işaretleri aralığında veri okur `[1, 10]`. - -Yukarıdaki örnekler, her zaman bir dizin tam taramadan daha etkili olduğunu göstermektedir. - -Seyrek bir dizin, ekstra verilerin okunmasına izin verir. Birincil anahtarın tek bir aralığını okurken, `index_granularity * 2` her veri bloğundaki ekstra satırlar okunabilir. - -Seyrek dizinler, çok sayıda tablo satırı ile çalışmanıza izin verir, çünkü çoğu durumda, bu tür dizinler bilgisayarın RAM'İNE sığar. - -ClickHouse benzersiz bir birincil anahtar gerektirmez. Aynı birincil anahtar ile birden çok satır ekleyebilirsiniz. - -### Birincil anahtar seçme {#selecting-the-primary-key} - -Birincil anahtardaki sütun sayısı açıkça sınırlı değildir. Veri yapısına bağlı olarak, birincil anahtara daha fazla veya daha az sütun ekleyebilirsiniz. Bu Mayıs: - -- Bir dizin performansını artırın. - - Birincil anahtar ise `(a, b)`, sonra başka bir sütun ekleyerek `c` aşağıdaki koşullar yerine getirilirse performansı artıracaktır: - - - Sütun üzerinde bir koşulu olan sorgular var `c`. - - Uzun veri aralıkları (birkaç kat daha uzun `index_granularity`) için aynı değer withlerle `(a, b)` yaygındır. Başka bir deyişle, başka bir sütun eklerken oldukça uzun veri aralıklarını atlamanıza izin verir. - -- Veri sıkıştırmasını geliştirin. - - ClickHouse verileri birincil anahtarla sıralar, bu nedenle tutarlılık ne kadar yüksek olursa sıkıştırma o kadar iyi olur. - -- Veri parçalarını birleştirirken ek mantık sağlayın [CollapsingMergeTree](collapsingmergetree.md#table_engine-collapsingmergetree) ve [SummingMergeTree](summingmergetree.md) motorlar. - - Bu durumda belirtmek mantıklı *sıralama anahtarı* bu birincil anahtardan farklıdır. - -Uzun bir birincil anahtar, ekleme performansını ve bellek tüketimini olumsuz yönde etkiler, ancak birincil anahtardaki ek sütunlar, ClickHouse performansını etkilemez `SELECT` sorgular. - -### Sıralama anahtarından farklı bir birincil anahtar seçme {#choosing-a-primary-key-that-differs-from-the-sorting-key} - -Sıralama anahtarından (veri bölümlerindeki satırları sıralamak için bir ifade) farklı bir birincil anahtar (her işaret için dizin dosyasında yazılan değerlere sahip bir ifade) belirtmek mümkündür. Bu durumda, birincil anahtar ifadesi tuple, sıralama anahtarı ifadesi tuple'ın bir öneki olmalıdır. - -Bu özellik kullanırken yararlıdır [SummingMergeTree](summingmergetree.md) ve -[AggregatingMergeTree](aggregatingmergetree.md) masa motorları. Bu motorları kullanırken yaygın bir durumda, tablonun iki tür sütunu vardır: *boyutlular* ve *ölçümler*. Tipik sorgular, rasgele ölçü sütunlarının değerlerini toplar `GROUP BY` ve boyutlara göre filtreleme. Çünkü SummingMergeTree ve AggregatingMergeTree sıralama anahtarının aynı değere sahip satırları toplamak, tüm boyutları eklemek doğaldır. Sonuç olarak, anahtar ifadesi uzun bir sütun listesinden oluşur ve bu liste yeni eklenen boyutlarla sık sık güncelleştirilmelidir. - -Bu durumda, birincil anahtarda verimli Aralık taramaları sağlayacak ve kalan boyut sütunlarını sıralama anahtarı kümesine ekleyecek yalnızca birkaç sütun bırakmak mantıklıdır. - -[ALTER](../../../sql_reference/statements/alter.md) yeni bir sütun aynı anda tabloya ve sıralama anahtarı eklendiğinde, varolan veri parçaları değiştirilmesi gerekmez, çünkü sıralama anahtarının hafif bir işlemdir. Eski sıralama anahtarı yeni sıralama anahtarının bir öneki olduğundan ve yeni eklenen sütunda veri olmadığından, veriler tablo değişikliği anında hem eski hem de yeni sıralama anahtarlarına göre sıralanır. - -### Sorgularda dizin ve bölümlerin kullanımı {#use-of-indexes-and-partitions-in-queries} - -İçin `SELECT` sorgular, ClickHouse bir dizin kullanılabilir olup olmadığını analiz eder. Eğer bir dizin kullanılabilir `WHERE/PREWHERE` yan tümce, bir eşitlik veya eşitsizlik karşılaştırma işlemini temsil eden bir ifadeye (bağlantı öğelerinden biri olarak veya tamamen) sahiptir veya varsa `IN` veya `LIKE` sütun veya birincil anahtar veya bölümleme anahtar veya bu sütunların belirli kısmen tekrarlayan işlevleri veya bu ifadelerin mantıksal ilişkileri olan ifadeler üzerinde sabit bir önek ile. - -Bu nedenle, birincil anahtarın bir veya daha fazla aralığındaki sorguları hızlı bir şekilde çalıştırmak mümkündür. Bu örnekte, belirli bir izleme etiketi, belirli bir etiket ve tarih aralığı, belirli bir etiket ve tarih için, tarih aralığına sahip birden çok etiket için vb. çalıştırıldığında sorgular hızlı olacaktır. - -Aşağıdaki gibi yapılandırılmış motora bakalım: - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 - -Bu durumda, sorgularda: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -ClickHouse, uygun olmayan verileri kırpmak için birincil anahtar dizinini ve uygun olmayan tarih aralıklarındaki bölümleri kırpmak için aylık bölümleme anahtarını kullanır. - -Yukarıdaki sorgular, dizinin karmaşık ifadeler için bile kullanıldığını göstermektedir. Tablodan okuma, dizini kullanarak tam taramadan daha yavaş olamayacak şekilde düzenlenmiştir. - -Aşağıdaki örnekte, dizin kullanılamaz. - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -Clickhouse'un bir sorgu çalıştırırken dizini kullanıp kullanamayacağını kontrol etmek için ayarları kullanın [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) ve [force\_primary\_key](../../../operations/settings/settings.md). - -Aylara göre bölümleme anahtarı, yalnızca uygun aralıktaki tarihleri içeren veri bloklarını okumanıza izin verir. Bu durumda, veri bloğu birçok tarih için veri içerebilir (bir aya kadar). Bir blok içinde veriler, ilk sütun olarak tarihi içermeyen birincil anahtara göre sıralanır. Bu nedenle, birincil anahtar önekini belirtmeyen yalnızca bir tarih koşulu ile bir sorgu kullanarak tek bir tarih için okunacak daha fazla veri neden olur. - -### Kısmen monotonik birincil anahtarlar için Endeks kullanımı {#use-of-index-for-partially-monotonic-primary-keys} - -Örneğin, Ayın günlerini düşünün. Onlar formu bir [monotonik dizisi](https://en.wikipedia.org/wiki/Monotonic_function) bir ay boyunca, ancak daha uzun süreler için monotonik değil. Bu kısmen monotonik bir dizidir. Bir kullanıcı kısmen monoton birincil anahtar ile tablo oluşturursa, ClickHouse her zamanki gibi seyrek bir dizin oluşturur. Bir kullanıcı bu tür bir tablodan veri seçtiğinde, ClickHouse sorgu koşullarını analiz eder. Kullanıcı, dizinin iki işareti arasında veri almak isterse ve bu işaretlerin her ikisi de bir ay içinde düşerse, ClickHouse bu özel durumda dizini kullanabilir, çünkü sorgu parametreleri ile dizin işaretleri arasındaki mesafeyi hesaplayabilir. - -Sorgu parametresi aralığındaki birincil anahtarın değerleri monotonik bir sırayı temsil etmiyorsa, ClickHouse bir dizin kullanamaz. Bu durumda, ClickHouse Tam Tarama yöntemini kullanır. - -ClickHouse bu mantığı yalnızca ay dizilerinin günleri için değil, kısmen monotonik bir diziyi temsil eden herhangi bir birincil anahtar için kullanır. - -### Veri atlama indeksleri (deneysel) {#table_engine-mergetree-data_skipping-indexes} - -Dizin bildirimi sütunlar bölümünde `CREATE` sorgu. - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -Tablolar için `*MergeTree` aile, veri atlama endeksleri belirtilebilir. - -Bu endeksler, bloklarda belirtilen ifade hakkında bazı bilgileri toplar ve bunlardan oluşur `granularity_value` granüller (granül boyutu kullanılarak belirtilir `index_granularity` tablo motoru ayarı). Daha sonra bu agregalar `SELECT` büyük veri bloklarını atlayarak diskten okunacak veri miktarını azaltmak için sorgular `where` sorgu tatmin edilemez. - -**Örnek** - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -Örneğin endeksleri aşağıdaki sorgularda diskten okunacak veri miktarını azaltmak için ClickHouse tarafından kullanılabilir: - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### Mevcut Endeks Türleri {#available-types-of-indices} - -- `minmax` - - Belirtilen ifad (eyi saklar (ifad (enin `tuple`, sonra her eleman için aşırı depolar `tuple`), birincil anahtar gibi veri bloklarını atlamak için saklanan bilgileri kullanır. - -- `set(max_rows)` - - Belirtilen ifadenin benzersiz değerlerini depolar (en fazla `max_rows` satırlar, `max_rows=0` anlama “no limits”). Kontrol etmek için değerleri kullanır `WHERE` ifade, bir veri bloğu üzerinde tatmin edilemez değildir. - -- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - Mağazalar a [Blo filterom filtre](https://en.wikipedia.org/wiki/Bloom_filter) bu, bir veri bloğundaki tüm ngramları içerir. Sadece dizeleri ile çalışır. Optimizasyonu için kullanılabilir `equals`, `like` ve `in` ifadeler. - - - `n` — ngram size, - - `size_of_bloom_filter_in_bytes` — Bloom filter size in bytes (you can use large values here, for example, 256 or 512, because it can be compressed well). - - `number_of_hash_functions` — The number of hash functions used in the Bloom filter. - - `random_seed` — The seed for Bloom filter hash functions. - -- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - - Olarak aynı `ngrambf_v1`, ancak ngrams yerine simgeleri saklar. Belirteçler alfasayısal olmayan karakterlerle ayrılmış dizilerdir. - -- `bloom_filter([false_positive])` — Stores a [Blo filterom filtre](https://en.wikipedia.org/wiki/Bloom_filter) belirtilen sütunlar için. - - Opsiyonel `false_positive` parametre, filtreden yanlış pozitif yanıt alma olasılığıdır. Olası değerler: (0, 1). Varsayılan değer: 0.025. - - Desteklenen veri türleri: `Int*`, `UInt*`, `Float*`, `Enum`, `Date`, `DateTime`, `String`, `FixedString`, `Array`, `LowCardinality`, `Nullable`. - - Aşağıdaki işlevleri kullanabilirsiniz: [eşitlikler](../../../sql_reference/functions/comparison_functions.md), [notEquals](../../../sql_reference/functions/comparison_functions.md), [içinde](../../../sql_reference/functions/in_functions.md), [notİn](../../../sql_reference/functions/in_functions.md), [var](../../../sql_reference/functions/array_functions.md). - - - -``` sql -INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 -INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 -``` - -#### Fonksiyonları Destek {#functions-support} - -Koşulları `WHERE` yan tümcesi, sütunlarla çalışan işlevlerin çağrılarını içerir. Sütun bir dizinin bir parçasıysa, ClickHouse işlevleri gerçekleştirirken bu dizini kullanmaya çalışır. ClickHouse, dizinleri kullanmak için farklı işlev alt kümelerini destekler. - -Bu `set` dizin tüm fonksiyonları ile kullanılabilir. Diğer dizinler için işlev alt kümeleri aşağıdaki tabloda gösterilmiştir. - -| Fonksiyon (operatör) / dizin | birincil anahtar | minmax | ngrambf\_v1 | tokenbf\_v1 | bloom\_filter | -|------------------------------------------------------------------------------------------------------------|------------------|--------|-------------|-------------|---------------| -| [eşitlikler (=, ==)](../../../sql_reference/functions/comparison_functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notEquals(!=, \<\>)](../../../sql_reference/functions/comparison_functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [hoşlanmak](../../../sql_reference/functions/string_search_functions.md#function-like) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [notLike](../../../sql_reference/functions/string_search_functions.md#function-notlike) | ✔ | ✔ | ✔ | ✗ | ✗ | -| [startsWith](../../../sql_reference/functions/string_functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ | -| [endsWith](../../../sql_reference/functions/string_functions.md#endswith) | ✗ | ✗ | ✔ | ✔ | ✗ | -| [multiSearchAny](../../../sql_reference/functions/string_search_functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ | -| [içinde](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [notİn](../../../sql_reference/functions/in_functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ | -| [daha az (\<)](../../../sql_reference/functions/comparison_functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [büyük (\>)](../../../sql_reference/functions/comparison_functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [lessOrEquals (\<=)](../../../sql_reference/functions/comparison_functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [greaterOrEquals (\>=)](../../../sql_reference/functions/comparison_functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [boş](../../../sql_reference/functions/array_functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| [notEmpty](../../../sql_reference/functions/array_functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ | -| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ | - -Ngram boyutundan daha az olan sabit bir argümana sahip işlevler tarafından kullanılamaz `ngrambf_v1` sorgu optimizasyonu için. - -Bloom filtreleri yanlış pozitif eşleşmelere sahip olabilir, bu yüzden `ngrambf_v1`, `tokenbf_v1`, ve `bloom_filter` dizinler, örneğin bir işlevin sonucunun false olması beklenen sorguları en iyi duruma getirmek için kullanılamaz: - -- Optimize edilebilir: - - `s LIKE '%test%'` - - `NOT s NOT LIKE '%test%'` - - `s = 1` - - `NOT s != 1` - - `startsWith(s, 'test')` -- Optimize edilemez: - - `NOT s LIKE '%test%'` - - `s NOT LIKE '%test%'` - - `NOT s = 1` - - `s != 1` - - `NOT startsWith(s, 'test')` - -## Eşzamanlı Veri Erişimi {#concurrent-data-access} - -Eşzamanlı tablo erişimi için çoklu sürüm kullanıyoruz. Başka bir deyişle, bir tablo aynı anda okunup güncelleştirildiğinde, sorgu sırasında geçerli olan bir parça kümesinden veri okunur. Uzun kilitler yok. Ekler okuma işlemlerinin yoluna girmez. - -Bir tablodan okuma otomatik olarak paralelleştirilir. - -## Sütunlar ve tablolar için TTL {#table_engine-mergetree-ttl} - -Değerlerin ömrünü belirler. - -Bu `TTL` yan tümcesi tüm tablo ve her sütun için ayarlanabilir. Tablo düzeyinde TTL ayrıca diskler ve birimler arasında otomatik veri taşıma mantığını belirtebilirsiniz. - -İfadeleri değerlendirmek gerekir [Tarihli](../../../sql_reference/data_types/date.md) veya [DateTime](../../../sql_reference/data_types/datetime.md) veri türü. - -Örnek: - -``` sql -TTL time_column -TTL time_column + interval -``` - -Tanımlamak `interval`, kullanma [zaman aralığı](../../../sql_reference/operators.md#operators-datetime) operatörler. - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### Sütun TTL {#mergetree-column-ttl} - -Sütundaki değerler sona erdiğinde, ClickHouse bunları sütun veri türü için varsayılan değerlerle değiştirir. Veri bölümündeki tüm sütun değerleri sona ererse, ClickHouse bu sütunu bir dosya sistemindeki veri bölümünden siler. - -Bu `TTL` yan tümcesi anahtar sütunlar için kullanılamaz. - -Örnekler: - -TTL ile tablo oluşturma - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -Varolan bir tablonun sütununa TTL ekleme - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -Sütun TTL değiştirme - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### Tablo TTL {#mergetree-table-ttl} - -Tablo, süresi dolmuş satırların kaldırılması için bir ifadeye ve parçaların arasında otomatik olarak taşınması için birden fazla ifadeye sahip olabilir [diskler veya birimler](#table_engine-mergetree-multiple-volumes). Tablodaki satırların süresi dolduğunda, ClickHouse ilgili tüm satırları siler. Parça taşıma özelliği için, bir parçanın tüm satırları hareket ifadesi ölçütlerini karşılaması gerekir. - -``` sql -TTL expr [DELETE|TO DISK 'aaa'|TO VOLUME 'bbb'], ... -``` - -TTL kuralı türü her TTL ifadesini takip edebilir. İfade tatmin edildikten sonra yapılacak bir eylemi etkiler (şimdiki zamana ulaşır): - -- `DELETE` - süresi dolmuş satırları sil (varsayılan eylem); -- `TO DISK 'aaa'` - parçayı diske taşı `aaa`; -- `TO VOLUME 'bbb'` - parçayı diske taşı `bbb`. - -Örnekler: - -TTL ile tablo oluşturma - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH [DELETE], - d + INTERVAL 1 WEEK TO VOLUME 'aaa', - d + INTERVAL 2 WEEK TO DISK 'bbb'; -``` - -Tablonun TTL değiştirme - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**Verileri Kaldırma** - -ClickHouse veri parçalarını birleştirdiğinde süresi dolmuş bir TTL ile veri kaldırılır. - -ClickHouse, verilerin süresi dolduğunu gördüğünde, zamanlama dışı bir birleştirme gerçekleştirir. Bu tür birleştirmelerin sıklığını kontrol etmek için şunları ayarlayabilirsiniz [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout). Değer çok düşükse, çok fazla kaynak tüketebilecek birçok zamanlama dışı birleştirme gerçekleştirir. - -Gerçekleştir theirseniz `SELECT` birleştirme arasında sorgu, süresi dolmuş veri alabilirsiniz. Bunu önlemek için, [OPTIMIZE](../../../sql_reference/statements/misc.md#misc_operations-optimize) önce sorgu `SELECT`. - -## Veri Depolama İçin Birden Fazla Blok Cihazı Kullanma {#table_engine-mergetree-multiple-volumes} - -### Giriş {#introduction} - -`MergeTree` aile tablo motorları birden fazla blok cihazlarda veri saklayabilirsiniz. Örneğin, belirli bir tablonun verileri örtük olarak bölündüğünde yararlı olabilir “hot” ve “cold”. En son veriler düzenli olarak talep edilir, ancak yalnızca az miktarda alan gerektirir. Aksine, yağ kuyruklu tarihsel veriler nadiren talep edilir. Birkaç disk varsa, “hot” veriler hızlı disklerde (örneğin, NVMe SSD'ler veya bellekte) bulunabilir; “cold” veri-nispeten yavaş olanlar (örneğin, HDD). - -Veri kısmı için minimum hareketli birimdir `MergeTree`- motor masaları. Bir parçaya ait veriler bir diskte saklanır. Veri parçaları arka planda diskler arasında (kullanıcı ayarlarına göre) ve aynı zamanda [ALTER](../../../sql_reference/statements/alter.md#alter_move-partition) sorgular. - -### Şartlar {#terms} - -- Disk — Block device mounted to the filesystem. -- Default disk — Disk that stores the path specified in the [yol](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) sunucu ayarı. -- Volume — Ordered set of equal disks (similar to [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures)). -- Storage policy — Set of volumes and the rules for moving data between them. - -Açıklanan varlıklara verilen isimler sistem tablolarında bulunabilir, [sistem.storage\_policies](../../../operations/system_tables.md#system_tables-storage_policies) ve [sistem.diskler](../../../operations/system_tables.md#system_tables-disks). Bir tablo için yapılandırılmış depolama ilkelerinden birini uygulamak için `storage_policy` ayarı `MergeTree`- motor aile tabloları. - -### Yapılandırma {#table_engine-mergetree-multiple-volumes-configure} - -Diskler, birimler ve depolama politikaları içinde bildirilmelidir `` ana dosyada ya etiket `config.xml` veya farklı bir dosyada `config.d` dizin. - -Yapılandırma yapısı: - -``` xml - - - - /mnt/fast_ssd/clickhouse/ - - - /mnt/hdd1/clickhouse/ - 10485760 - - - /mnt/hdd2/clickhouse/ - 10485760 - - - ... - - - ... - -``` - -Etiketler: - -- `` — Disk name. Names must be different for all disks. -- `path` — path under which a server will store data (`data` ve `shadow` klasörler) ile Sonlandır shouldılmalıdır ‘/’. -- `keep_free_space_bytes` — the amount of free disk space to be reserved. - -Disk tanımının sırası önemli değildir. - -Depolama ilkeleri yapılandırma biçimlendirme: - -``` xml - - ... - - - - - disk_name_from_disks_configuration - 1073741824 - - - - - - - 0.2 - - - - - - - - ... - -``` - -Etiketler: - -- `policy_name_N` — Policy name. Policy names must be unique. -- `volume_name_N` — Volume name. Volume names must be unique. -- `disk` — a disk within a volume. -- `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume's disks. -- `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). - -Cofiguration örnekleri: - -``` xml - - ... - - - - - disk1 - disk2 - - - - - - - - fast_ssd - 1073741824 - - - disk1 - - - 0.2 - - - ... - -``` - -Verilen örnekte, `hdd_in_order` politika uygular [Ro -und-robin](https://en.wikipedia.org/wiki/Round-robin_scheduling) yaklaşma. Böylece bu politika yalnızca bir birim tanımlar (`single`), veri parçaları tüm disklerinde dairesel sırayla saklanır. Bu tür bir politika, sisteme birkaç benzer disk takılıysa, ancak RAID yapılandırılmamışsa oldukça yararlı olabilir. Her bir disk sürücüsünün güvenilir olmadığını ve bunu 3 veya daha fazla çoğaltma faktörü ile telafi etmek isteyebileceğinizi unutmayın. - -Sistemde farklı türde diskler varsa, `moving_from_ssd_to_hdd` politika yerine kullanılabilir. Birim `hot` bir SSD disk oluşur (`fast_ssd`) ve bu birimde saklanabilecek bir parçanın maksimum boyutu 1GB. Tüm parçaları ile boyutu daha büyük 1 GB üzerinde doğrudan saklanır `cold` bir HDD diski içeren birim `disk1`. -Ayrıca, bir kez disk `fast_ssd` 80'den fazla % tarafından doldurulur, veri transfer edilecektir `disk1` bir arka plan işlemi ile. - -Depolama ilkesi içindeki birim numaralandırma sırası önemlidir. Bir birim aşırı doldurulduktan sonra, veriler bir sonrakine taşınır. Disk numaralandırma sırası da önemlidir, çünkü veriler sırayla depolanır. - -Bir tablo oluştururken, yapılandırılmış depolama ilkelerinden birini ona uygulayabilirsiniz: - -``` sql -CREATE TABLE table_with_non_default_policy ( - EventDate Date, - OrderID UInt64, - BannerID UInt64, - SearchPhrase String -) ENGINE = MergeTree -ORDER BY (OrderID, BannerID) -PARTITION BY toYYYYMM(EventDate) -SETTINGS storage_policy = 'moving_from_ssd_to_hdd' -``` - -Bu `default` depolama ilkesi, Yalnızca verilen bir diskten oluşan yalnızca bir birim kullanmayı ima eder ``. Bir tablo oluşturulduktan sonra, depolama ilkesi değiştirilemez. - -### Ayrıntı {#details} - -Bu durumda `MergeTree` tablolar, veriler diske farklı şekillerde giriyor: - -- Bir ekleme sonucunda (`INSERT` sorgu). -- Arka plan birleştirmeleri sırasında ve [mutasyonlar](../../../sql_reference/statements/alter.md#alter-mutations). -- Başka bir kopyadan indirirken. -- Bölüm Don ofması sonucu [ALTER TABLE … FREEZE PARTITION](../../../sql_reference/statements/alter.md#alter_freeze-partition). - -Mutasyonlar ve bölüm dondurma hariç tüm bu durumlarda, bir parça verilen depolama politikasına göre bir birim ve bir diskte saklanır: - -1. Bir parçayı depolamak için yeterli disk alanına sahip olan ilk birim (tanım sırasına göre) (`unreserved_space > current_part_size`) ve belirli bir boyuttaki parçaların saklanmasına izin verir (`max_data_part_size_bytes > current_part_size`) seçilir. -2. Bu birimde, önceki veri yığınını depolamak için kullanılan ve parça boyutundan daha fazla boş alana sahip olan diski izleyen disk seçilir (`unreserved_space - keep_free_space_bytes > current_part_size`). - -Kap hoodut underun altında, [sabit linkler](https://en.wikipedia.org/wiki/Hard_link). Farklı diskler arasındaki sabit bağlantılar desteklenmez, bu nedenle bu gibi durumlarda ortaya çıkan parçalar ilk disklerle aynı disklerde saklanır. - -Arka planda, parçalar boş alan miktarına göre hacimler arasında taşınır (`move_factor` parametre) sırasına göre birimler yapılandırma dosyasında beyan edilir. -Veriler asla sonuncudan ve birincisine aktarılmaz. Bir sistem tabloları kullanabilirsiniz [sistem.part\_log](../../../operations/system_tables.md#system_tables-part-log) (alan `type = MOVE_PART`) ve [sistem.parçalar](../../../operations/system_tables.md#system_tables-parts) (alanlar `path` ve `disk`) arka plan hareketlerini izlemek için. Ayrıca, ayrıntılı bilgi sunucu günlüklerinde bulunabilir. - -Kullanıcı, sorguyu kullanarak bir bölümü veya bölümü bir birimden diğerine taşımaya zorlayabilir [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql_reference/statements/alter.md#alter_move-partition), arka plan işlemleri için tüm kısıtlamalar dikkate alınır. Sorgu, kendi başına bir hareket başlatır ve tamamlanması için arka plan işlemleri beklemez. Yeterli boş alan yoksa veya gerekli koşullardan herhangi biri karşılanmazsa kullanıcı bir hata mesajı alır. - -Veri taşıma veri çoğaltma ile müdahale etmez. Bu nedenle, farklı depolama ilkeleri aynı tablo için farklı yinelemeler üzerinde belirtilebilir. - -Arka plan birleşimlerinin ve mutasyonlarının tamamlanmasından sonra, eski parçalar yalnızca belirli bir süre sonra çıkarılır (`old_parts_lifetime`). -Bu süre zarfında, diğer birimlere veya disklere taşınmazlar. Bu nedenle, parçalar nihayet çıkarılıncaya kadar, işgal edilen disk alanının değerlendirilmesi için hala dikkate alınır. - -[Orijinal makale](https://clickhouse.tech/docs/ru/operations/table_engines/mergetree/) diff --git a/docs/tr/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/tr/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index baf2fc98b07..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 33 -toc_title: ReplacingMergeTree ---- - -# ReplacingMergeTree {#replacingmergetree} - -Motor farklıdır [MergeTree](mergetree.md#table_engines-mergetree) aynı birincil anahtar değerine sahip yinelenen girdileri kaldırır (veya daha doğru bir şekilde, aynı [sıralama anahtarı](mergetree.md) değer). - -Veri tekilleştirme yalnızca birleştirme sırasında oluşur. Birleştirme, arka planda bilinmeyen bir zamanda gerçekleşir, bu nedenle bunu planlayamazsınız. Bazı veriler işlenmemiş kalabilir. Kullanarak programsız bir birleştirme çalıştırabilirsiniz, ancak `OPTIMIZE` sorgu, kullanmaya güvenmeyin, çünkü `OPTIMIZE` sorgu büyük miktarda veri okuyacak ve yazacaktır. - -Böyle, `ReplacingMergeTree` yerden tasarruf etmek için arka planda yinelenen verileri temizlemek için uygundur, ancak kopyaların yokluğunu garanti etmez. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[PRIMARY KEY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -İstek parametrelerinin açıklaması için bkz. [istek açıklaması](../../../sql_reference/statements/create.md). - -**ReplacingMergeTree Parametreleri** - -- `ver` — column with version. Type `UInt*`, `Date` veya `DateTime`. İsteğe bağlı parametre. - - Birleş whenirken, `ReplacingMergeTree` aynı birincil anahtara sahip tüm satırlardan sadece bir tane bırakır: - - - Seç inimde son, eğer `ver` set değil. - - Maksimum sürümü ile, eğer `ver` belirtilen. - -**Sorgu yan tümceleri** - -Oluştururken bir `ReplacingMergeTree` tablo aynı [yanlar](mergetree.md) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -Hariç tüm parametreler `ver` içinde olduğu gibi aynı anlama sahip `MergeTree`. - -- `ver` - sürümü ile sütun. İsteğe bağlı parametre. Bir açıklama için yukarıdaki metne bakın. - -
- -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/tr/engines/table_engines/mergetree_family/replication.md b/docs/tr/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index e9890c2652f..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 31 -toc_title: "Veri \xC7o\u011Faltma" ---- - -# Veri Çoğaltma {#table_engines-replication} - -Çoğaltma yalnızca mergetree ailesindeki tablolar için desteklenir: - -- ReplicatedMergeTree -- ReplicatedSummingMergeTree -- ReplicatedReplacingMergeTree -- ReplicatedAggregatingMergeTree -- ReplicatedCollapsingMergeTree -- ReplicatedVersionedCollapsingMergetree -- ReplicatedGraphiteMergeTree - -Çoğaltma, tüm sunucu değil, tek bir tablo düzeyinde çalışır. Bir sunucu hem çoğaltılmış hem de çoğaltılmamış tabloları aynı anda depolayabilir. - -Çoğaltma, parçaya bağlı değildir. Her parçanın kendi bağımsız çoğaltması vardır. - -İçin sıkıştırılmış veri `INSERT` ve `ALTER` sorgular çoğaltılır (daha fazla bilgi için bkz. [ALTER](../../../sql_reference/statements/alter.md#query_language_queries_alter)). - -`CREATE`, `DROP`, `ATTACH`, `DETACH` ve `RENAME` sorgular tek bir sunucuda yürütülür ve çoğaltılmaz: - -- Bu `CREATE TABLE` sorgu sorgu çalıştırıldığı sunucuda yeni bir replicatable tablo oluşturur. Bu tablo diğer sunucularda zaten varsa, yeni bir yineleme ekler. -- Bu `DROP TABLE` sorgu, sorgunun çalıştırıldığı sunucuda bulunan yinelemeyi siler. -- Bu `RENAME` sorgu yinelemeler birinde tabloyu yeniden adlandırır. Başka bir deyişle, çoğaltılmış tablolar farklı yinelemeler üzerinde farklı adlara sahip olabilir. - -ClickHouse kullanır [Apache ZooKeeper](https://zookeeper.apache.org) kopyaları meta bilgilerini saklamak için. ZooKeeper sürüm 3.4.5 veya daha yeni kullanın. - -Çoğaltma kullanmak için, parametreleri [zookeeper](../../../operations/server_configuration_parameters/settings.md#server-settings_zookeeper) sunucu yapılandırma bölümü. - -!!! attention "Dikkat" - Güvenlik ayarını ihmal etmeyin. ClickHouse destekler `digest` [ACLL şeması](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) ZooKeeper Güvenlik alt sisteminin. - -ZooKeeper kümesinin adreslerini ayarlama örneği: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -Varolan herhangi bir ZooKeeper kümesini belirtebilirsiniz ve sistem kendi verileri için bir dizin kullanır (replicatable tablo oluştururken dizin belirtilir). - -Zookeeper yapılandırma dosyasında ayarlanmamışsa, çoğaltılmış tablolar oluşturamazsınız ve varolan çoğaltılmış tablolar salt okunur olacaktır. - -ZooKeeper kullanılmaz `SELECT` çoğaltma performansını etkilemez çünkü sorgular `SELECT` ve sorgular, çoğaltılmamış tablolar için yaptıkları kadar hızlı çalışır. Dağıtılmış çoğaltılmış tabloları sorgularken, ClickHouse davranışı ayarlar tarafından denetlenir [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) ve [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-fallback_to_stale_replicas_for_distributed_queries). - -Her biri için `INSERT` sorgu, yaklaşık on girişleri zookeeper birkaç işlemler aracılığıyla eklenir. (Daha kesin olmak gerekirse, bu eklenen her veri bloğu içindir; bir ekleme sorgusu her bir blok veya bir blok içerir `max_insert_block_size = 1048576` satırlar.) Bu, biraz daha uzun gecikmelere yol açar `INSERT` çoğaltılmamış tablolarla karşılaştırıldığında. Ancak, birden fazla olmayan gruplar halinde veri eklemek için önerileri izlerseniz `INSERT` saniyede, herhangi bir sorun yaratmaz. Bir ZooKeeper kümesini koordine etmek için kullanılan tüm ClickHouse kümesinin toplam birkaç yüzü vardır `INSERTs` saniyede. Veri eklerindeki verim (saniyede satır sayısı), çoğaltılmamış veriler için olduğu kadar yüksektir. - -Çok büyük kümeler için, farklı kırıklar için farklı ZooKeeper kümelerini kullanabilirsiniz. Ancak, bu Yandex'de gerekli değildir.Metrica küme (yaklaşık 300 sunucu). - -Çoğaltma zaman uyumsuz ve çok ana. `INSERT` sorgular (yanı sıra `ALTER`) mevcut herhangi bir sunucuya gönderilebilir. Veri sorgu çalıştırıldığı sunucuda eklenir ve sonra diğer sunuculara kopyalanır. Zaman uyumsuz olduğundan, son eklenen veriler bazı gecikme ile diğer yinelemeler görünür. Yinelemelerin bir kısmı mevcut değilse, veriler kullanılabilir olduklarında yazılır. Bir çoğaltma varsa, gecikme, sıkıştırılmış veri bloğunu ağ üzerinden aktarmak için gereken süredir. - -Varsayılan olarak, bir INSERT sorgusu yalnızca bir yinelemeden veri yazma onayı bekler. Verileri başarıyla yalnızca bir yineleme için yazılmıştır ve bu yineleme ile sunucu varolmaya sona erer, depolanan veriler kaybolur. Birden çok yinelemeden veri yazma onayını almayı etkinleştirmek için `insert_quorum` seçenek. - -Her veri bloğu atomik olarak yazılır. Ekle sorgusu kadar bloklara ayrılmıştır `max_insert_block_size = 1048576` satırlar. Diğer bir deyişle, `INSERT` sorgu 1048576 satırdan daha az, atomik olarak yapılır. - -Veri blokları tekilleştirilmiştir. Aynı veri bloğunun (aynı sırayla aynı satırları içeren aynı boyuttaki veri blokları) birden fazla yazımı için, blok yalnızca bir kez yazılır. Bunun nedeni, istemci uygulaması verilerin DB'YE yazılıp yazılmadığını bilmediğinde ağ arızaları durumunda, `INSERT` sorgu sadece tekrar edilebilir. Hangi çoğaltma eklerinin aynı verilerle gönderildiği önemli değildir. `INSERTs` idempotent vardır. Tekilleştirme parametreleri tarafından kontrol edilir [merge\_tree](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-merge_tree) sunucu ayarları. - -Çoğaltma sırasında, yalnızca eklenecek kaynak veriler ağ üzerinden aktarılır. Daha fazla veri dönüşümü (birleştirme), tüm kopyalarda aynı şekilde koordine edilir ve gerçekleştirilir. Bu, ağ kullanımını en aza indirir; bu, çoğaltmaların farklı veri merkezlerinde bulunduğu zaman çoğaltmanın iyi çalıştığı anlamına gelir. (Farklı veri merkezlerinde çoğaltmanın çoğaltmanın ana hedefi olduğunu unutmayın .) - -Aynı verilerin çoğaltmaları herhangi bir sayıda olabilir. Üye.Metrica üretimde çift çoğaltma kullanır. Her sunucu, bazı durumlarda RAID-5 veya RAID-6 ve RAID-10 kullanır. Bu nispeten güvenilir ve kullanışlı bir çözümdür. - -Sistem, yinelemelerdeki veri senkronizasyonunu izler ve bir hatadan sonra kurtarabilir. Yük devretme otomatik (verilerde küçük farklılıklar için) veya yarı otomatik (veriler çok fazla farklılık gösterdiğinde, bu da bir yapılandırma hatasını gösterebilir). - -## Çoğaltılmış Tablolar Oluşturma {#creating-replicated-tables} - -Bu `Replicated` önek tablo motoru adına eklenir. Mesela:`ReplicatedMergeTree`. - -**Çoğaltılan \* MergeTree parametreleri** - -- `zoo_path` — The path to the table in ZooKeeper. -- `replica_name` — The replica name in ZooKeeper. - -Örnek: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -
- -Kullanımdan kaldırılmış sözdizimi örneği - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -
- -Örnekte gösterildiği gibi, bu parametreler kıvırcık köşeli ayraçlarda ikameler içerebilir. İkame edilen değerler ‘macros’ yapılandırma dosyasının bölümü. Örnek: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -Zookeeper tablonun yolunu her çoğaltılmış tablo için benzersiz olmalıdır. Farklı parçalardaki tabloların farklı yolları olmalıdır. -Bu durumda, yol aşağıdaki parçalardan oluşur: - -`/clickhouse/tables/` ortak önek. Tam olarak bunu kullanmanızı öneririz. - -`{layer}-{shard}` shard tanımlayıcısıdır. Bu örnekte Yandex'den beri iki bölümden oluşmaktadır.Metrica küme iki seviyeli sharding kullanır. Çoğu görev için, yalnızca shard tanımlayıcısına genişletilecek olan {shard} ikamesini bırakabilirsiniz. - -`table_name` ZooKeeper tablo için düğüm adıdır. Tablo adı ile aynı yapmak için iyi bir fikirdir. Açıkça tanımlanır, çünkü tablo adının aksine, bir yeniden adlandırma sorgusundan sonra değişmez. -*HINT*: önüne bir veritabanı adı ekleyebilirsiniz `table_name` yanında. E. g. `db_name.table_name` - -Çoğaltma adı, aynı tablonun farklı yinelemelerini tanımlar. Örnekte olduğu gibi bunun için sunucu adını kullanabilirsiniz. Adın sadece her parça içinde benzersiz olması gerekir. - -Değiştirmeleri kullanmak yerine parametreleri açıkça tanımlayabilirsiniz. Bu, test etmek ve küçük kümeleri yapılandırmak için uygun olabilir. Ancak, dağıtılmış DDL sorguları kullanamazsınız (`ON CLUSTER` bu durumda). - -Büyük kümelerle çalışırken, hata olasılığını azalttıkları için değiştirmeleri kullanmanızı öneririz. - -Run the `CREATE TABLE` her yineleme üzerinde sorgu. Bu sorgu, yeni bir çoğaltılmış tablo oluşturur veya varolan bir yeni bir yineleme ekler. - -Tablo zaten diğer yinelemeler üzerinde bazı veriler içerdikten sonra yeni bir yineleme eklerseniz, verileri diğer yinelemeler için yeni bir sorgu çalıştırdıktan sonra kopyalanır. Başka bir deyişle, yeni çoğaltma kendisini diğerleriyle eşitler. - -Bir yineleme silmek için çalıştırın `DROP TABLE`. However, only one replica is deleted – the one that resides on the server where you run the query. - -## Arızalardan Sonra Kurtarma {#recovery-after-failures} - -Bir sunucu başlatıldığında ZooKeeper kullanılamıyorsa, çoğaltılmış tablolar salt okunur moda geçer. Sistem periyodik olarak ZooKeeper bağlanmaya çalışır. - -ZooKeeper sırasında kullanılamıyorsa bir `INSERT`, veya ZooKeeper ile etkileşimde bulunurken bir hata oluşur, bir istisna atılır. - -ZooKeeper bağlandıktan sonra, sistem yerel dosya sistemindeki veri kümesinin beklenen veri kümesiyle eşleşip eşleşmediğini kontrol eder (ZooKeeper bu bilgileri saklar). Küçük tutarsızlıklar varsa, sistem verileri kopyalarla senkronize ederek bunları çözer. - -Sistem bozuk veri parçalarını (yanlış dosya boyutu ile) veya tanınmayan parçaları (dosya sistemine yazılmış ancak Zookeeper'da kaydedilmemiş parçalar) tespit ederse, bunları `detached` alt dizin (silinmez). Eksik parçalar kopyalardan kopyalanır. - -Clickhouse'un büyük miktarda veriyi otomatik olarak silme gibi yıkıcı eylemler gerçekleştirmediğini unutmayın. - -Sunucu başlatıldığında (veya ZooKeeper ile yeni bir oturum kurduğunda), yalnızca tüm dosyaların miktarını ve boyutlarını kontrol eder. Dosya boyutları eşleşirse, ancak bayt ortasında bir yerde değiştirilmişse, bu hemen algılanmaz, ancak yalnızca bir dosya için verileri okumaya çalışırken algılanmaz. `SELECT` sorgu. Sorgu, eşleşen olmayan bir sağlama toplamı veya sıkıştırılmış bir bloğun boyutu hakkında bir özel durum atar. Bu durumda, veri parçaları doğrulama kuyruğuna eklenir ve gerekirse kopyalardan kopyalanır. - -Yerel veri kümesi beklenenden çok fazla farklıysa, bir güvenlik mekanizması tetiklenir. Sunucu bunu günlüğe girer ve başlatmayı reddeder. Bunun nedeni, bu durumda, bir parçadaki bir kopya yanlışlıkla farklı bir parçadaki bir kopya gibi yapılandırılmışsa gibi bir yapılandırma hatası gösterebilir. Ancak, bu mekanizma için eşikleri oldukça düşük ayarlanır ve bu durum normal hata kurtarma sırasında ortaya çıkabilir. Bu durumda, veriler yarı otomatik olarak geri yüklenir “pushing a button”. - -Kurtarma işlemini başlatmak için düğümü oluşturun `/path_to_table/replica_name/flags/force_restore_data` herhangi bir içerik ile ZooKeeper veya tüm çoğaltılmış tabloları geri yüklemek için komutu çalıştırın: - -``` bash -sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -Sunucuyu yeniden başlatın. Başlangıçta, sunucu bu bayrakları siler ve kurtarma işlemini başlatır. - -## Tam Veri Kaybından Sonra Kurtarma {#recovery-after-complete-data-loss} - -Tüm veriler ve meta veriler sunuculardan birinden kaybolduysa, kurtarma için şu adımları izleyin: - -1. Clickhouse'u sunucuya yükleyin. Bunları kullanırsanız, shard tanımlayıcısı ve yinelemeleri içeren yapılandırma dosyasında doğru değiştirmelerin tanımlayın. -2. Sunucularda el ile çoğaltılması gereken yinelenmemiş tablolar varsa, verilerini bir kopyadan kopyalayın (dizinde `/var/lib/clickhouse/data/db_name/table_name/`). -3. Bulunan tablo tanım copylarını kopyala `/var/lib/clickhouse/metadata/` bir kopyadan. Tablo tanımlarında bir parça veya çoğaltma tanımlayıcısı açıkça tanımlanmışsa, bu kopyaya karşılık gelecek şekilde düzeltin. (Alternatif olarak, sunucuyu başlatın ve tüm `ATTACH TABLE` içinde olması gereken sorgular .sql dosyaları `/var/lib/clickhouse/metadata/`.) -4. Kurtarma işlemini başlatmak için ZooKeeper düğümünü oluşturun `/path_to_table/replica_name/flags/force_restore_data` herhangi bir içerikle veya tüm çoğaltılmış tabloları geri yüklemek için komutu çalıştırın: `sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -Ardından sunucuyu başlatın (zaten çalışıyorsa yeniden başlatın). Veriler kopyalardan indirilecektir. - -Alternatif bir kurtarma seçeneği zookeeper kayıp yineleme hakkında bilgi silmektir (`/path_to_table/replica_name`), daha sonra açıklandığı gibi yinelemeyi tekrar oluşturun “[Çoğaltılmış tablolar oluşturma](#creating-replicated-tables)”. - -Kurtarma sırasında ağ bant genişliği üzerinde herhangi bir kısıtlama yoktur. Aynı anda birçok yinelemeyi geri yüklüyorsanız bunu aklınızda bulundurun. - -## Mergetree'den Replicatedmergetree'ye Dönüştürme {#converting-from-mergetree-to-replicatedmergetree} - -Terimi kullanıyoruz `MergeTree` tüm tablo motorlarına başvurmak için `MergeTree family` için aynı `ReplicatedMergeTree`. - -Eğer olsaydı bir `MergeTree` el ile çoğaltılmış tablo, çoğaltılmış bir tabloya dönüştürebilirsiniz. Zaten büyük miktarda veri topladıysanız bunu yapmanız gerekebilir. `MergeTree` tablo ve şimdi çoğaltmayı etkinleştirmek istiyorsunuz. - -Veriler çeşitli yinelemelerde farklılık gösteriyorsa, önce onu eşitleyin veya bu verileri biri dışındaki tüm yinelemelerde silin. - -Varolan MergeTree tablosunu yeniden adlandırın, sonra bir `ReplicatedMergeTree` eski adı olan tablo. -Eski tablodan veri taşıma `detached` yeni tablo verileri ile dizin içindeki alt dizin (`/var/lib/clickhouse/data/db_name/table_name/`). -Sonra koş `ALTER TABLE ATTACH PARTITION` bu veri parçalarını çalışma kümesine eklemek için yinelemelerden birinde. - -## Replicatedmergetree'den Mergetree'ye Dönüştürme {#converting-from-replicatedmergetree-to-mergetree} - -Farklı bir adla bir MergeTree tablosu oluşturun. İle dizinden tüm verileri taşıyın `ReplicatedMergeTree` yeni tablonun veri dizinine tablo verileri. Sonra Sil `ReplicatedMergeTree` tablo ve sunucuyu yeniden başlatın. - -Eğer bir kurtulmak istiyorsanız `ReplicatedMergeTree` sunucu başlatmadan tablo: - -- İlgili sil `.sql` meta veri dizinindeki dosya (`/var/lib/clickhouse/metadata/`). -- ZooKeeper ilgili yolu silin (`/path_to_table/replica_name`). - -Bundan sonra, sunucuyu başlatabilir, bir `MergeTree` tablo, verileri kendi dizinine taşıyın ve sonra sunucuyu yeniden başlatın. - -## Zookeeper kümesindeki meta veriler kaybolduğunda veya zarar gördüğünde kurtarma {#recovery-when-metadata-in-the-zookeeper-cluster-is-lost-or-damaged} - -ZooKeeper içindeki veriler kaybolduysa veya hasar gördüyse, verileri yukarıda açıklandığı gibi yinelenmemiş bir tabloya taşıyarak kaydedebilirsiniz. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/tr/engines/table_engines/mergetree_family/summingmergetree.md b/docs/tr/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index 15a58064ab4..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 34 -toc_title: SummingMergeTree ---- - -# SummingMergeTree {#summingmergetree} - -Motor devralır [MergeTree](mergetree.md#table_engines-mergetree). Fark, veri parçalarını birleştirirken `SummingMergeTree` tablolar ClickHouse tüm satırları aynı birincil anahtarla değiştirir (veya daha doğru olarak, aynı [sıralama anahtarı](mergetree.md)) sayısal veri türüne sahip sütunlar için özetlenen değerleri içeren bir satır ile. Sıralama anahtarı, tek bir anahtar değeri çok sayıda satıra karşılık gelecek şekilde oluşturulursa, bu, depolama birimini önemli ölçüde azaltır ve veri seçimini hızlandırır. - -Motoru birlikte kullanmanızı öneririz `MergeTree`. Mağaza tam veri `MergeTree` tablo ve kullanım `SummingMergeTree` örneğin, rapor hazırlarken toplu veri depolamak için. Böyle bir yaklaşım, yanlış oluşturulmuş bir birincil anahtar nedeniyle değerli verileri kaybetmenizi önleyecektir. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = SummingMergeTree([columns]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -İstek parametrelerinin açıklaması için bkz. [istek açıklaması](../../../sql_reference/statements/create.md). - -**SummingMergeTree parametreleri** - -- `columns` - değerlerin özetleneceği sütunların adlarına sahip bir tuple. İsteğe bağlı parametre. - Sütunlar sayısal tipte olmalı ve birincil anahtarda olmamalıdır. - - Eğer `columns` belirtilmemiş, ClickHouse birincil anahtarda olmayan bir sayısal veri türü ile tüm sütunlardaki değerleri özetler. - -**Sorgu yan tümceleri** - -Oluştururken bir `SummingMergeTree` tablo aynı [yanlar](mergetree.md) oluşturul ,urken olduğu gibi gerekli `MergeTree` Tablo. - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın ve mümkünse eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) -``` - -Hariç tüm parametreler `columns` içinde olduğu gibi aynı anlama sahip `MergeTree`. - -- `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. - -
- -## Kullanım Örneği {#usage-example} - -Aşağıdaki tabloyu düşünün: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -Veri Ekle: - -``` sql -INSERT INTO summtt Values(1,1),(1,2),(2,1) -``` - -ClickHouse tüm satırları tamamen toplayabilir ([aşağıya bakın](#data-processing)), bu yüzden bir toplama işlevi kullanıyoruz `sum` ve `GROUP BY` sorguda yan tümcesi. - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - -``` text -┌─key─┬─sum(value)─┐ -│ 2 │ 1 │ -│ 1 │ 3 │ -└─────┴────────────┘ -``` - -## Veri İşleme {#data-processing} - -Veriler bir tabloya eklendiğinde, bunlar olduğu gibi kaydedilir. ClickHouse, verilerin eklenen bölümlerini periyodik olarak birleştirir ve bu, aynı birincil anahtara sahip satırların toplandığı ve sonuçta elde edilen her veri parçası için bir tane ile değiştirildiği zamandır. - -ClickHouse can merge the data parts so that different resulting parts of data cat consist rows with the same primary key, i.e. the summation will be incomplete. Therefore (`SELECT`) bir toplama fonksiyonu [toplam()](../../../sql_reference/aggregate_functions/reference.md#agg_function-sum) ve `GROUP BY` yukarıdaki örnekte açıklandığı gibi yan tümcesi bir sorguda kullanılmalıdır. - -### Toplama İçin Ortak Kurallar {#common-rules-for-summation} - -Sayısal veri türüne sahip sütunlardaki değerler özetlenir. Sütun kümesi parametre tarafından tanımlanır `columns`. - -Değerler toplamı için tüm sütunlarda 0 ise, satır silinir. - -Sütun birincil anahtarda değilse ve özetlenmezse, mevcut olanlardan rasgele bir değer seçilir. - -Değerler, birincil anahtardaki sütunlar için özetlenmez. - -### Aggregatefunction Sütunlarındaki toplama {#the-summation-in-the-aggregatefunction-columns} - -Sütunlar için [AggregateFunction türü](../../../sql_reference/data_types/aggregatefunction.md) ClickHouse olarak davranır [AggregatingMergeTree](aggregatingmergetree.md) işleve göre motor toplama. - -### İç İçe Yapılar {#nested-structures} - -Tablo, özel bir şekilde işlenen iç içe geçmiş veri yapılarına sahip olabilir. - -İç içe geçmiş bir tablonun adı ile bitiyorsa `Map` ve aşağıdaki kriterleri karşılayan en az iki sütun içerir: - -- ilk sütun sayısal `(*Int*, Date, DateTime)` veya bir dize `(String, FixedString)` hadi diyelim `key`, -- diğer sütunlar aritmetik `(*Int*, Float32/64)` hadi diyelim `(values...)`, - -sonra bu iç içe geçmiş tablo bir eşleme olarak yorumlanır `key => (values...)` ve satırlarını birleştirirken, iki veri kümesinin öğeleri şu şekilde birleştirilir `key` karşılık gelen bir toplamı ile `(values...)`. - -Örnekler: - -``` text -[(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] -[(1, 100)] + [(1, 150)] -> [(1, 250)] -[(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] -[(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] -``` - -Veri isterken, [sumMap (anahtar, değer)](../../../sql_reference/aggregate_functions/reference.md) toplama fonksiyonu `Map`. - -İç içe geçmiş veri yapısı için, sütunlarının toplamı için sütun kümesinde belirtmeniz gerekmez. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/tr/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/tr/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index b9adb381783..00000000000 --- a/docs/tr/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 37 -toc_title: VersionedCollapsingMergeTree ---- - -# VersionedCollapsingMergeTree {#versionedcollapsingmergetree} - -Bu motor: - -- Sürekli değişen nesne durumlarının hızlı yazılmasını sağlar. -- Arka planda eski nesne durumlarını siler. Bu, depolama hacmini önemli ölçüde azaltır. - -Bölümüne bakınız [Çökme](#table_engines_versionedcollapsingmergetree) ayrıntılar için. - -Motor devralır [MergeTree](mergetree.md#table_engines-mergetree) ve veri parçalarını birleştirmek için algoritmaya satırları daraltmak için mantığı ekler. `VersionedCollapsingMergeTree` aynı amaca hizmet eder [CollapsingMergeTree](collapsingmergetree.md) ancak, verilerin birden çok iş parçacığıyla herhangi bir sıraya yerleştirilmesine izin veren farklı bir çökme algoritması kullanır. Özellikle, `Version` sütun, yanlış sıraya yerleştirilmiş olsalar bile satırları düzgün bir şekilde daraltmaya yardımcı olur. Tersine, `CollapsingMergeTree` sadece kesinlikle ardışık ekleme sağlar. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -Sorgu parametrelerinin açıklaması için bkz: [sorgu açıklaması](../../../sql_reference/statements/create.md). - -**Motor Parametreleri** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Name of the column with the type of row: `1` is a “state” satır, `-1` is a “cancel” satır. - - Sütun veri türü olmalıdır `Int8`. - -- `version` — Name of the column with the version of the object state. - - Sütun veri türü olmalıdır `UInt*`. - -**Sorgu Yan Tümceleri** - -Oluştururken bir `VersionedCollapsingMergeTree` tablo, aynı [yanlar](mergetree.md) oluşturul aurken gerekli `MergeTree` Tablo. - -
- -Bir tablo oluşturmak için kullanımdan kaldırılan yöntem - -!!! attention "Dikkat" - Bu yöntemi yeni projelerde kullanmayın. Mümkünse, eski projeleri yukarıda açıklanan yönteme geçin. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -Dışındaki tüm parametreler `sign` ve `version` içinde olduğu gibi aynı anlama sahip `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` is a “state” satır, `-1` is a “cancel” satır. - - Column Data Type — `Int8`. - -- `version` — Name of the column with the version of the object state. - - Sütun veri türü olmalıdır `UInt*`. - -
- -## Çökme {#table_engines-versionedcollapsingmergetree} - -### Veriler {#data} - -Bazı nesneler için sürekli değişen verileri kaydetmeniz gereken bir durumu düşünün. Bir nesne için bir satıra sahip olmak ve değişiklikler olduğunda satırı güncellemek mantıklıdır. Ancak, depolama alanındaki verileri yeniden yazmayı gerektirdiğinden, güncelleştirme işlemi bir DBMS için pahalı ve yavaştır. Verileri hızlı bir şekilde yazmanız gerekiyorsa güncelleştirme kabul edilemez, ancak değişiklikleri bir nesneye sırayla aşağıdaki gibi yazabilirsiniz. - -Kullan... `Sign` satır yazarken sütun. Eğer `Sign = 1` bu, satırın bir nesnenin durumu olduğu anlamına gelir (diyelim “state” satır). Eğer `Sign = -1` aynı özelliklere sahip bir nesnenin durumunun iptal edildiğini gösterir (buna “cancel” satır). Ayrıca kullanın `Version` bir nesnenin her durumunu ayrı bir sayı ile tanımlaması gereken sütun. - -Örneğin, kullanıcıların bazı sitede kaç sayfa ziyaret ettiğini ve ne kadar süre orada olduklarını hesaplamak istiyoruz. Bir noktada, kullanıcı etkinliği durumu ile aşağıdaki satırı yazıyoruz: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Bir noktada daha sonra kullanıcı aktivitesinin değişikliğini kaydediyoruz ve aşağıdaki iki satırla yazıyoruz. - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -İlk satır, nesnenin (kullanıcı) önceki durumunu iptal eder. Dışında iptal edilen Devletin tüm alanlarını kopya shouldlama shouldlıdır `Sign`. - -İkinci satır geçerli durumu içerir. - -Sadece kullanıcı etkinliğinin son durumuna ihtiyacımız olduğundan, satırlar - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -nesnenin geçersiz (eski) durumunu daraltarak silinebilir. `VersionedCollapsingMergeTree` veri parçalarını birleştirirken bunu yapar. - -Her değişiklik için neden iki satıra ihtiyacımız olduğunu bulmak için bkz. [Algoritma](#table_engines-versionedcollapsingmergetree-algorithm). - -**Kullanımı ile ilgili notlar** - -1. Verileri yazan program, iptal etmek için bir nesnenin durumunu hatırlamalıdır. Bu “cancel” dize bir kopyası olmalıdır “state” tersi ile dize `Sign`. Bu, ilk depolama boyutunu arttırır, ancak verileri hızlı bir şekilde yazmanıza izin verir. -2. Sütunlardaki uzun büyüyen diziler, yazma yükü nedeniyle motorun verimliliğini azaltır. Daha basit veri, daha iyi verim. -3. `SELECT` sonuçlara itiraz değişiklikleri tarihinin tutarlılık bağlıdır. Ekleme için veri hazırlarken doğru olun. Oturum derinliği gibi negatif olmayan metrikler için negatif değerler gibi tutarsız verilerle öngörülemeyen sonuçlar alabilirsiniz. - -### Algoritma {#table_engines-versionedcollapsingmergetree-algorithm} - -ClickHouse veri parçalarını birleştirdiğinde, aynı birincil anahtar ve sürüm ve farklı olan her satır çiftini siler `Sign`. Satırların sırası önemli değil. - -ClickHouse veri eklediğinde, satırları birincil anahtarla sipariş eder. Eğer... `Version` sütun birincil anahtarda değil, ClickHouse onu birincil anahtara örtük olarak son alan olarak ekler ve sipariş vermek için kullanır. - -## Veri Seçme {#selecting-data} - -ClickHouse, aynı birincil anahtara sahip tüm satırların aynı sonuçtaki veri bölümünde veya hatta aynı fiziksel sunucuda olacağını garanti etmez. Bu, hem verileri yazmak hem de veri parçalarının daha sonra birleştirilmesi için geçerlidir. Ayrıca, ClickHouse süreçleri `SELECT` birden çok iş parçacıklarıyla sorgular ve sonuçtaki satırların sırasını tahmin edemez. Bu tamamen almak için bir ihtiyaç varsa toplama gerekli olduğu anlamına gelir “collapsed” bir veri `VersionedCollapsingMergeTree` Tablo. - -Daraltmayı sonuçlandırmak için, bir sorgu ile bir sorgu yazın `GROUP BY` yan tümce ve işareti için hesap toplama işlevleri. Örneğin, miktarı hesaplamak için kullanın `sum(Sign)` yerine `count()`. Bir şeyin toplamını hesaplamak için şunları kullanın `sum(Sign * x)` yerine `sum(x)` ve Ekle `HAVING sum(Sign) > 0`. - -Toplanan `count`, `sum` ve `avg` bu şekilde hesaplanabilir. Toplanan `uniq` bir nesnenin en az bir daraltılmamış durumu varsa hesaplanabilir. Toplanan `min` ve `max` hesaplan becauseamaz çünkü `VersionedCollapsingMergeTree` çökmüş durumların değerlerinin geçmişini kaydetmez. - -İle verileri ayıklamak gerekiyorsa “collapsing” ancak toplama olmadan (örneğin, en yeni değerleri belirli koşullarla eşleşen satırların mevcut olup olmadığını kontrol etmek için) `FINAL` değiştirici için `FROM` yan. Bu yaklaşım verimsizdir ve büyük tablolarla kullanılmamalıdır. - -## Kullanım Örneği {#example-of-use} - -Örnek veriler: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Tablo oluşturma: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -Veri ekleme: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -Biz iki kullanın `INSERT` iki farklı veri parçası oluşturmak için sorgular. Verileri tek bir sorgu ile eklersek, ClickHouse bir veri parçası oluşturur ve hiçbir zaman birleştirme gerçekleştirmez. - -Veri alma: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Burada ne görüyoruz ve çökmüş parçalar nerede? -İki veri parçasını iki kullanarak oluşturduk `INSERT` sorgular. Bu `SELECT` sorgu iki iş parçacığında gerçekleştirildi ve sonuç rastgele bir satır sırasıdır. -Veri bölümleri henüz birleştirilmediği için çökme gerçekleşmedi. ClickHouse biz tahmin edemez zaman içinde bilinmeyen bir noktada veri parçalarını birleştirir. - -Bu yüzden toplamaya ihtiyacımız var: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -Toplamaya ihtiyacımız yoksa ve çökmeyi zorlamak istiyorsak, `FINAL` değiştirici için `FROM` yan. - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -Bu, verileri seçmek için çok verimsiz bir yoldur. Büyük tablolar için kullanmayın. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/tr/engines/table_engines/special/buffer.md b/docs/tr/engines/table_engines/special/buffer.md deleted file mode 100644 index fa53822ab2b..00000000000 --- a/docs/tr/engines/table_engines/special/buffer.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 45 -toc_title: Arabellek ---- - -# Arabellek {#buffer} - -RAM'de yazmak için verileri tamponlar, periyodik olarak başka bir tabloya temizler. Okuma işlemi sırasında veri arabellekten ve diğer tablodan aynı anda okunur. - -``` sql -Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) -``` - -Motor parametreleri: - -- `database` – Database name. Instead of the database name, you can use a constant expression that returns a string. -- `table` – Table to flush data to. -- `num_layers` – Parallelism layer. Physically, the table will be represented as `num_layers` bağımsız tamponların. Önerilen değer: 16. -- `min_time`, `max_time`, `min_rows`, `max_rows`, `min_bytes`, ve `max_bytes` – Conditions for flushing data from the buffer. - -Veri arabellekten temizlendi ve hedef tabloya yazılır eğer tüm `min*` koşulları veya en az bir `max*` koşul karşı arelanır. - -- `min_time`, `max_time` – Condition for the time in seconds from the moment of the first write to the buffer. -- `min_rows`, `max_rows` – Condition for the number of rows in the buffer. -- `min_bytes`, `max_bytes` – Condition for the number of bytes in the buffer. - -Yazma işlemi sırasında veri bir `num_layers` rastgele tampon sayısı. Veya, eklenecek veri kısmı yeterince büyükse (daha büyük `max_rows` veya `max_bytes`), arabelleği atlayarak doğrudan hedef tabloya yazılır. - -Verilerin yıkanması için koşullar, her biri için ayrı ayrı hesaplanır. `num_layers` arabellekler. Örneğin, `num_layers = 16` ve `max_bytes = 100000000`, maksimum RAM tüketimi 1,6 GB'DİR. - -Örnek: - -``` sql -CREATE TABLE merge.hits_buffer AS merge.hits ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000) -``` - -Oluşturma Bir ‘merge.hits\_buffer’ ile aynı yapıya sahip tablo ‘merge.hits’ ve Tampon motorunu kullanarak. Bu tabloya yazarken, veriler RAM'de arabelleğe alınır ve daha sonra ‘merge.hits’ Tablo. 16 tamponlar oluşturulur. 100 saniye geçti veya bir milyon satır yazılmış veya 100 MB veri yazılmıştır; ya da aynı anda 10 saniye geçti ve 10.000 satır ve 10 MB veri yazılmıştır, bunların her veri temizlendi. Örneğin, sadece bir satır yazılmışsa, 100 saniye sonra ne olursa olsun, yıkanacaktır. Ancak, birçok satır yazılmışsa, veriler daha erken temizlenecektir. - -Sunucu DROP TABLE veya DETACH TABLE ile durdurulduğunda, arabellek verileri de hedef tabloya temizlendi. - -Veritabanı ve tablo adı için tek tırnak içinde boş dizeleri ayarlayabilirsiniz. Bu, bir hedef tablonun yokluğunu gösterir. Bu durumda, Veri Temizleme koşullarına ulaşıldığında, arabellek basitçe temizlenir. Bu, bir veri penceresini bellekte tutmak için yararlı olabilir. - -Bir arabellek tablosundan okurken, veriler hem arabellekten hem de hedef tablodan (varsa) işlenir. -Arabellek tabloları bir dizin desteklemediğini unutmayın. Başka bir deyişle, arabellekteki veriler tamamen taranır, bu da büyük arabellekler için yavaş olabilir. (Alt tablodaki veriler için, desteklediği dizin kullanılacaktır.) - -Arabellek tablosundaki sütun kümesi, alt tablodaki sütun kümesiyle eşleşmiyorsa, her iki tabloda da bulunan sütunların bir alt kümesi eklenir. - -Türleri arabellek tablo ve alt tablo sütunlarından biri için eşleşmiyorsa, sunucu günlüğüne bir hata iletisi girilir ve arabellek temizlenir. -Arabellek temizlendiğinde alt tablo yoksa aynı şey olur. - -Eğer bağımlı bir tablo ve Tampon tablo için ALTER çalıştırmak gerekiyorsa, ilk Tampon tablo silme, alt tablo için ALTER çalışan, sonra tekrar Tampon tablo oluşturma öneririz. - -Sunucu anormal şekilde yeniden başlatılırsa, arabellekteki veriler kaybolur. - -Son ve örnek arabellek tabloları için düzgün çalışmıyor. Bu koşullar hedef tabloya geçirilir, ancak arabellekte veri işlemek için kullanılmaz. Bu özellikler gerekiyorsa, hedef tablodan okurken yalnızca yazma için arabellek tablosunu kullanmanızı öneririz. - -Bir arabelleğe veri eklerken, arabelleklerden biri kilitlenir. Bir okuma işlemi aynı anda tablodan gerçekleştiriliyor, bu gecikmelere neden olur. - -Bir arabellek tablosuna eklenen veriler, alt tabloda farklı bir sırada ve farklı bloklarda sonuçlanabilir. Bu nedenle, bir arabellek tablo CollapsingMergeTree doğru yazmak için kullanmak zordur. Sorunları önlemek için şunları ayarlayabilirsiniz ‘num\_layers’ 1'e. - -Hedef tablo yinelenirse, bir arabellek tablosuna yazarken yinelenmiş tabloların bazı beklenen özellikleri kaybolur. Satır ve veri parçaları boyutlarda sipariş için rasgele değişiklikler veri çoğaltma güvenilir olması mümkün olmadığını ifade eden çalışma, kapanmasına neden ‘exactly once’ çoğaltılan tablolara yazın. - -Bu dezavantajlardan dolayı, nadir durumlarda yalnızca bir arabellek tablosu kullanmanızı önerebiliriz. - -Bir arabellek tablosu, bir zaman birimi üzerinden çok sayıda sunucudan çok fazla ekleme alındığında kullanılır ve ekleme işleminden önce veri arabelleğe alınamaz, bu da eklerin yeterince hızlı çalışamayacağı anlamına gelir. - -Arabellek tabloları için bile, her seferinde bir satır veri eklemek mantıklı olmadığını unutmayın. Bu, yalnızca saniyede birkaç bin satırlık bir hız üretirken, daha büyük veri blokları eklemek saniyede bir milyondan fazla satır üretebilir (bölüme bakın “Performance”). - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/buffer/) diff --git a/docs/tr/engines/table_engines/special/dictionary.md b/docs/tr/engines/table_engines/special/dictionary.md deleted file mode 100644 index ce02429a31f..00000000000 --- a/docs/tr/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 35 -toc_title: "S\xF6zl\xFCk" ---- - -# Sözlük {#dictionary} - -Bu `Dictionary` motor görüntüler [sözlük](../../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) bir ClickHouse tablo olarak veri. - -Örnek olarak, bir sözlük düşünün `products` aşağıdaki yapılandırma ile: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -Sözlük verilerini sorgula: - -``` sql -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - -``` text -┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ -│ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ -└──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ -``` - -Kullanabilirsiniz [dictGet\*](../../../sql_reference/functions/ext_dict_functions.md#ext_dict_functions) sözlük verilerini bu formatta almak için işlev. - -Bu görünüm, ham veri almanız gerektiğinde veya bir `JOIN` işleyiş. Bu durumlar için şunları kullanabilirsiniz `Dictionary` bir tabloda sözlük verilerini görüntüleyen motor. - -Sözdizimi: - -``` sql -CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` -``` - -Kullanım örneği: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); -``` - - Ok - -Masada ne olduğuna bir bak. - -``` sql -select * from products limit 1; -``` - -``` text -┌────product_id─┬─title───────────┐ -│ 152689 │ Some item │ -└───────────────┴─────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/tr/engines/table_engines/special/distributed.md b/docs/tr/engines/table_engines/special/distributed.md deleted file mode 100644 index 28cb0e0855d..00000000000 --- a/docs/tr/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 33 -toc_title: "Da\u011F\u0131l\u0131" ---- - -# Dağılı {#distributed} - -**Dağıtılmış altyapısı olan tablolar kendileri tarafından herhangi bir veri depolamaz**, ancak birden çok sunucuda dağıtılmış sorgu işleme izin verir. -Okuma otomatik olarak paralelleştirilir. Bir okuma sırasında, varsa uzak sunucularda tablo dizinleri kullanılır. - -Dağıtılmış motor parametreleri kabul eder: - -- sunucunun yapılandırma dosyasındaki küme adı - -- uzak veritabanı adı - -- uzak bir tablonun adı - -- (isteğe bağlı olarak) sharding anahtarı - -- (isteğe bağlı olarak) ilke adı, zaman uyumsuz göndermek için geçici dosyaları depolamak için kullanılacaktır - - Ayrıca bakınız: - - - `insert_distributed_sync` ayar - - [MergeTree](../mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) örnekler için - -Örnek: - -``` sql -Distributed(logs, default, hits[, sharding_key[, policy_name]]) -``` - -Veri tüm sunuculardan okunacak ‘logs’ küme, varsayılan değerden.kümedeki her sunucuda bulunan hits tablosu. -Veriler yalnızca okunmakla kalmaz, aynı zamanda uzak sunucularda kısmen işlenir (bunun mümkün olduğu ölçüde). -Örneğin, GROUP BY ile bir sorgu için uzak sunucularda veri toplanır ve toplama işlevlerinin Ara durumları istek sahibi sunucuya gönderilir. Daha sonra veriler daha fazla toplanacaktır. - -Veritabanı adı yerine, bir dize döndüren sabit bir ifade kullanabilirsiniz. Örneğin: currentDatabase (). - -logs – The cluster name in the server's config file. - -Kümeler şöyle ayarlanır: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 1 - 9440 - - - - -``` - -Burada bir küme adı ile tanımlanır ‘logs’ bu, her biri iki kopya içeren iki parçadan oluşur. -Kırıklar, verilerin farklı bölümlerini içeren sunuculara başvurur (tüm verileri okumak için tüm kırıklara erişmeniz gerekir). -Yinelemeler sunucuları çoğaltılıyor (tüm verileri okumak için, yinelemelerden herhangi birinde verilere erişebilirsiniz). - -Küme adları nokta içermemelidir. - -Parametre `host`, `port` ve isteğe bağlı olarak `user`, `password`, `secure`, `compression` her sunucu için belirtilir: -- `host` – The address of the remote server. You can use either the domain or the IPv4 or IPv6 address. If you specify the domain, the server makes a DNS request when it starts, and the result is stored as long as the server is running. If the DNS request fails, the server doesn't start. If you change the DNS record, restart the server. -- `port` – The TCP port for messenger activity (‘tcp\_port’ yapılandırmada, genellikle 9000 olarak ayarlanır). Http\_port ile karıştırmayın. -- `user` – Name of the user for connecting to a remote server. Default value: default. This user must have access to connect to the specified server. Access is configured in the users.xml file. For more information, see the section [Erişim hakları](../../../operations/access_rights.md). -- `password` – The password for connecting to a remote server (not masked). Default value: empty string. -- `secure` - Bağlantı için ssl kullanın, genellikle de tanımlamanız gerekir `port` = 9440. Sunucu dinlem shouldeli 9440 ve doğru sertifikalara sahip. -- `compression` - Kullanım veri sıkıştırma. Varsayılan değer: true. - -When specifying replicas, one of the available replicas will be selected for each of the shards when reading. You can configure the algorithm for load balancing (the preference for which replica to access) – see the [dengeleme](../../../operations/settings/settings.md#settings-load_balancing) ayar. -Sunucu ile bağlantı kurulmamışsa, kısa bir zaman aşımı ile bağlanma girişimi olacaktır. Bağlantı başarısız olursa, sonraki yineleme seçilir ve benzeri tüm yinelemeler için. Bağlantı girişimi tüm yinelemeler için başarısız olursa, girişimi aynı şekilde, birkaç kez tekrarlanır. -Bu esneklik lehine çalışır, ancak tam hataya dayanıklılık sağlamaz: uzak bir sunucu bağlantıyı kabul edebilir, ancak çalışmayabilir veya kötü çalışabilir. - -Parçalardan yalnızca birini belirtebilirsiniz (bu durumda, sorgu işleme dağıtılmış yerine uzak olarak adlandırılmalıdır) veya herhangi bir sayıda parçaya kadar. Her parçada, bir ila herhangi bir sayıda yinelemeyi belirtebilirsiniz. Her parça için farklı sayıda çoğaltma belirtebilirsiniz. - -Yapılandırmada istediğiniz kadar küme belirtebilirsiniz. - -Kümelerinizi görüntülemek için ‘system.clusters’ Tablo. - -Dağıtılmış motor, yerel bir sunucu gibi bir küme ile çalışmaya izin verir. Ancak, küme uzatılamaz: yapılandırmasını sunucu yapılandırma dosyasına yazmanız gerekir (tüm kümenin sunucuları için daha da iyisi). - -The Distributed engine requires writing clusters to the config file. Clusters from the config file are updated on the fly, without restarting the server. If you need to send a query to an unknown set of shards and replicas each time, you don't need to create a Distributed table – use the ‘remote’ bunun yerine tablo işlevi. Bölümüne bakınız [Tablo fonksiyonları](../../../sql_reference/table_functions/index.md). - -Bir kümeye veri yazmak için iki yöntem vardır: - -İlk olarak, hangi sunucuların hangi verileri yazacağını ve her bir parçaya doğrudan yazmayı gerçekleştireceğini tanımlayabilirsiniz. Başka bir deyişle, dağıtılmış tablo içinde INSERT gerçekleştirmek “looks at”. Bu, konu alanının gereklilikleri nedeniyle önemsiz olmayan herhangi bir sharding şemasını kullanabileceğiniz için en esnek çözümdür. Bu aynı zamanda en uygun çözümdür, çünkü veriler farklı parçalara tamamen bağımsız olarak yazılabilir. - -İkinci olarak, dağıtılmış bir tabloda ekleme gerçekleştirebilirsiniz. Bu durumda, tablo eklenen verileri sunucuların kendisine dağıtacaktır. Dağıtılmış bir tabloya yazmak için, bir sharding anahtar kümesi (son parametre) olmalıdır. Ek olarak, yalnızca bir parça varsa, yazma işlemi sharding anahtarını belirtmeden çalışır, çünkü bu durumda hiçbir şey ifade etmez. - -Her parça yapılandırma dosyasında tanımlanan bir ağırlığa sahip olabilir. Varsayılan olarak, ağırlık bir eşittir. Veriler, parça ağırlığı ile orantılı miktarda parçalara dağıtılır. Örneğin, iki parça varsa ve birincisi 9'luk bir ağırlığa sahipse, ikincisi 10'luk bir ağırlığa sahipse, ilk satırların 9 / 19 parçası gönderilir ve ikincisi 10 / 19 gönderilir. - -Her shard olabilir ‘internal\_replication’ yapılandırma dosyasında tanımlanan parametre. - -Bu parametre şu şekilde ayarlanırsa ‘true’, yazma işlemi ilk sağlıklı yinelemeyi seçer ve ona veri yazar. Dağıtılmış tablo ise bu alternatifi kullanın “looks at” çoğaltılan tablolar. Başka bir deyişle, verilerin yazılacağı tablo kendilerini çoğaltacaktır. - -Olarak ayarlan ifmışsa ‘false’ (varsayılan), veriler tüm kopyalara yazılır. Özünde, bu, dağıtılmış tablonun verilerin kendisini çoğalttığı anlamına gelir. Bu, çoğaltılmış tabloları kullanmaktan daha kötüdür, çünkü kopyaların tutarlılığı denetlenmez ve zamanla biraz farklı veriler içerirler. - -Bir veri satırının gönderildiği parçayı seçmek için, parçalama ifadesi analiz edilir ve kalan kısmı, parçaların toplam ağırlığına bölünmesinden alınır. Satır, kalanların yarı aralığına karşılık gelen parçaya gönderilir. ‘prev\_weight’ -e doğru ‘prev\_weights + weight’, nere ‘prev\_weights’ en küçük sayıya sahip parçaların toplam ağırlığı ve ‘weight’ bu parçanın ağırlığı. Örneğin, iki parça varsa ve birincisi 9'luk bir ağırlığa sahipse, ikincisi 10'luk bir ağırlığa sahipse, satır \[0, 9) aralığından kalanlar için ilk parçaya ve ikincisine \[9, 19) aralığından kalanlar için gönderilecektir. - -Sharding ifadesi, bir tamsayı döndüren sabitler ve tablo sütunlarından herhangi bir ifade olabilir. Örneğin, ifadeyi kullanabilirsiniz ‘rand()’ verilerin rastgele dağılımı için veya ‘UserID’ kullanıcının kimliğinin bölünmesinden kalanın dağıtımı için (daha sonra tek bir kullanıcının verileri, kullanıcılar tarafından çalışmayı ve katılmayı basitleştiren tek bir parçada bulunur). Sütunlardan biri yeterince eşit olarak dağıtılmazsa, onu bir karma işleve sarabilirsiniz: ınthash64(Userıd). - -Bölüm'den basit bir hatırlatma, sharding için sınırlı bir çözümdür ve her zaman uygun değildir. Orta ve büyük hacimlerde veri (düzinelerce sunucu) için çalışır, ancak çok büyük hacimlerde veri (yüzlerce sunucu veya daha fazla) için değildir. İkinci durumda, dağıtılmış tablolarda girdileri kullanmak yerine konu alanı tarafından gerekli olan sharding şemasını kullanın. - -SELECT queries are sent to all the shards and work regardless of how data is distributed across the shards (they can be distributed completely randomly). When you add a new shard, you don't have to transfer the old data to it. You can write new data with a heavier weight – the data will be distributed slightly unevenly, but queries will work correctly and efficiently. - -Aşağıdaki durumlarda sharding şeması hakkında endişelenmelisiniz: - -- Belirli bir anahtar tarafından veri (veya birleştirme) birleştirme gerektiren sorgular kullanılır. Veriler bu anahtar tarafından parçalanırsa, GLOBAL IN veya GLOBAL JOİN yerine local IN veya JOİN kullanabilirsiniz, bu da çok daha etkilidir. -- Çok sayıda küçük Sorgu ile çok sayıda sunucu (yüzlerce veya daha fazla) kullanılır (bireysel müşterilerin sorguları - web siteleri, reklamverenler veya ortaklar). Küçük sorguların tüm kümeyi etkilememesi için, tek bir istemci için tek bir parça üzerinde veri bulmak mantıklıdır. Alternatif olarak, Yandex'te yaptığımız gibi.Metrica, iki seviyeli sharding kurabilirsiniz: tüm kümeyi bölün “layers”, bir katmanın birden fazla parçadan oluşabileceği yer. Tek bir istemci için veriler tek bir katmanda bulunur, ancak kırıklar gerektiğinde bir katmana eklenebilir ve veriler rastgele dağıtılır. Her katman için dağıtılmış tablolar oluşturulur ve genel sorgular için tek bir paylaşılan dağıtılmış tablo oluşturulur. - -Veriler zaman uyumsuz olarak yazılır. Tabloya eklendiğinde, veri bloğu sadece yerel dosya sistemine yazılır. Veriler en kısa sürede arka planda uzak sunuculara gönderilir. Veri gönderme süresi tarafından yönetilir [distributed\_directory\_monitor\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_sleep_time_ms) ve [distributed\_directory\_monitor\_max\_sleep\_time\_ms](../../../operations/settings/settings.md#distributed_directory_monitor_max_sleep_time_ms) ayarlar. Bu `Distributed` motor ayrı ayrı eklenen verilerle her dosyayı gönderir, ancak toplu dosya gönderme etkinleştirebilirsiniz [distributed\_directory\_monitor\_batch\_ınserts](../../../operations/settings/settings.md#distributed_directory_monitor_batch_inserts) ayar. Bu ayar, yerel sunucu ve ağ kaynaklarını daha iyi kullanarak küme performansını artırır. Tablo dizinindeki dosyaların listesini (gönderilmeyi bekleyen veriler) kontrol ederek verilerin başarıyla gönderilip gönderilmediğini kontrol etmelisiniz: `/var/lib/clickhouse/data/database/table/`. - -Sunucu varlığını durdurdu veya (örneğin, bir aygıt arızasından sonra) dağıtılmış bir tabloya bir ekleme sonra kaba bir yeniden başlatma vardı, eklenen veriler kaybolabilir. Tablo dizininde bozuk bir veri parçası tespit edilirse, ‘broken’ alt dizin ve artık kullanılmıyor. - -Max\_parallel\_replicas seçeneği etkinleştirildiğinde, sorgu işleme tek bir parça içindeki tüm yinelemeler arasında paralelleştirilir. Daha fazla bilgi için bölüme bakın [max\_parallel\_replicas](../../../operations/settings/settings.md#settings-max_parallel_replicas). - -## Sanal Sütunlar {#virtual-columns} - -- `_shard_num` — Contains the `shard_num` (itibaren `system.clusters`). Tür: [Uİnt32](../../../sql_reference/data_types/int_uint.md). - -!!! note "Not" - Beri [`remote`](../../../sql_reference/table_functions/remote.md)/`cluster` tablo işlevleri DAHİLİ olarak aynı dağıtılmış altyapının geçici örneğini oluşturur, `_shard_num` de kullanılabilir. - -**Ayrıca Bakınız** - -- [Sanal sütunlar](index.md#table_engines-virtual_columns) - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/tr/engines/table_engines/special/external_data.md b/docs/tr/engines/table_engines/special/external_data.md deleted file mode 100644 index 123b2dbdf0e..00000000000 --- a/docs/tr/engines/table_engines/special/external_data.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 34 -toc_title: "D\u0131\u015F veri" ---- - -# Sorgu işleme için harici veriler {#external-data-for-query-processing} - -ClickHouse bir sunucu bir SELECT sorgusu ile birlikte bir sorgu işlemek için gerekli olan verileri gönderme sağlar. Bu veriler geçici bir tabloya konur (bölüme bakın “Temporary tables”) ve sorguda kullanılabilir (örneğin, işleçlerde). - -Örneğin, önemli kullanıcı tanımlayıcılarına sahip bir metin dosyanız varsa, bu listeyi süzme kullanan bir sorgu ile birlikte sunucuya yükleyebilirsiniz. - -Büyük hacimli dış verilerle birden fazla sorgu çalıştırmanız gerekiyorsa, bu özelliği kullanmayın. Verileri vaktinden önce DB'YE yüklemek daha iyidir. - -Harici veriler komut satırı istemcisi (etkileşimli olmayan modda) veya HTTP arabirimi kullanılarak yüklenebilir. - -Komut satırı istemcisinde, formatta bir parametreler bölümü belirtebilirsiniz - -``` bash ---external --file=... [--name=...] [--format=...] [--types=...|--structure=...] -``` - -İletilen tablo sayısı için bunun gibi birden çok bölümünüz olabilir. - -**–external** – Marks the beginning of a clause. -**–file** – Path to the file with the table dump, or -, which refers to stdin. -Stdın'den yalnızca tek bir tablo alınabilir. - -Aşağıdaki parametreler isteğe bağlıdır: **–name**– Name of the table. If omitted, \_data is used. -**–format** – Data format in the file. If omitted, TabSeparated is used. - -Aşağıdaki parametrelerden biri gereklidir:**–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`. Sütun adlarını ve türlerini tanımlar. - -Belirtilen dosyalar ‘file’ belirtilen biçimde ayrıştırılır ‘format’, belirtilen veri türlerini kullanarak ‘types’ veya ‘structure’. Tablo sunucuya yüklenecek ve orada adı ile geçici bir tablo olarak erişilebilir ‘name’. - -Örnekler: - -``` bash -$ echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 -849897 -$ cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -HTTP arabirimini kullanırken, dış veriler çok parçalı/form veri biçiminde geçirilir. Her tablo ayrı bir dosya olarak iletilir. Tablo adı dosya adından alınır. Bu ‘query\_string’ parametreleri geçirilir ‘name\_format’, ‘name\_types’, ve ‘name\_structure’, nere ‘name’ bu parametreler karşılık gelen tablonun adıdır. Parametrelerin anlamı, komut satırı istemcisini kullanırken olduğu gibi aynıdır. - -Örnek: - -``` bash -$ cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv - -$ curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -Dağıtılmış sorgu işleme için geçici tablolar tüm uzak sunuculara gönderilir. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/external_data/) diff --git a/docs/tr/engines/table_engines/special/file.md b/docs/tr/engines/table_engines/special/file.md deleted file mode 100644 index c132d1dd5a4..00000000000 --- a/docs/tr/engines/table_engines/special/file.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 37 -toc_title: Dosya ---- - -# Dosya {#table_engines-file} - -Dosya tablosu altyapısı, verileri desteklenen dosyalardan birinde tutar [Dosya -biçimliler](../../../interfaces/formats.md#formats) (TabSeparated, yerli, vb.). - -Kullanım örnekleri: - -- Clickhouse'dan dosyaya veri aktarımı. -- Verileri bir biçimden diğerine dönüştürün. -- Bir diskte bir dosya düzenleme yoluyla ClickHouse veri güncelleme. - -## ClickHouse Sunucusunda Kullanım {#usage-in-clickhouse-server} - -``` sql -File(Format) -``` - -Bu `Format` parametre kullanılabilir dosya biçimlerinden birini belirtir. Gerçekleştirmek -`SELECT` sorgular, biçim giriş için desteklenmeli ve gerçekleştirmek için -`INSERT` queries – for output. The available formats are listed in the -[Biçimliler](../../../interfaces/formats.md#formats) bölme. - -ClickHouse dosya sistemi yolunu belirtmek için izin vermiyor`File`. Tarafından tanımlanan klasörü kullan willacaktır [yol](../../../operations/server_configuration_parameters/settings.md) sunucu yapılandırmasında ayarlama. - -Kullanarak tablo oluştururken `File(Format)` bu klasörde boş bir alt dizin oluşturur. Veri o tabloya yazıldığında, içine konur `data.Format` bu alt dizinde dosya. - -Bu alt klasörü ve dosyayı sunucu dosya sisteminde el ile oluşturabilir ve sonra [ATTACH](../../../sql_reference/statements/misc.md) eşleşen ada sahip tablo bilgilerine, böylece bu dosyadan veri sorgulayabilirsiniz. - -!!! warning "Uyarıcı" - Bu işlevselliğe dikkat edin, çünkü ClickHouse bu tür dosyalarda harici değişiklikleri izlemez. ClickHouse ve ClickHouse dışında eşzamanlı yazma sonucu tanımsızdır. - -**Örnek:** - -**1.** Set up the `file_engine_table` Tablo: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -Varsayılan olarak ClickHouse klasör oluşturur `/var/lib/clickhouse/data/default/file_engine_table`. - -**2.** El ile oluştur `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` içerme: - -``` bash -$ cat data.TabSeparated -one 1 -two 2 -``` - -**3.** Verileri sorgula: - -``` sql -SELECT * FROM file_engine_table -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## Clickhouse'da kullanım-yerel {#usage-in-clickhouse-local} - -İçinde [clickhouse-yerel](../../../operations/utilities/clickhouse-local.md) Dosya motoru ek olarak dosya yolunu kabul eder `Format`. Varsayılan giriş / çıkış akışları gibi sayısal veya insan tarafından okunabilir isimler kullanılarak belirtilebilir `0` veya `stdin`, `1` veya `stdout`. -**Örnek:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## Uygulama Detayları {#details-of-implementation} - -- Çoklu `SELECT` sorgular aynı anda yapılabilir, ancak `INSERT` sorgular birbirini bekler. -- Tarafından yeni dosya oluşturma desteklenen `INSERT` sorgu. -- Dosya varsa, `INSERT` içinde yeni değerler ekler. -- Desteklenmiyor: - - `ALTER` - - `SELECT ... SAMPLE` - - Dizinler - - Çoğalma - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/tr/engines/table_engines/special/generate.md b/docs/tr/engines/table_engines/special/generate.md deleted file mode 100644 index 01d2534441e..00000000000 --- a/docs/tr/engines/table_engines/special/generate.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 46 -toc_title: GenerateRandom ---- - -# Generaterandom {#table_engines-generate} - -GenerateRandom tablo motoru, verilen tablo şeması için rasgele veri üretir. - -Kullanım örnekleri: - -- Tekrarlanabilir büyük tabloyu doldurmak için testte kullanın. -- Fuzzing testleri için rastgele girdi oluşturun. - -## ClickHouse Sunucusunda Kullanım {#usage-in-clickhouse-server} - -``` sql -ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) -``` - -Bu `max_array_length` ve `max_string_length` parametreler tüm maksimum uzunluğu belirtin -oluşturulan verilerde dizi sütunları ve dizeleri. - -Tablo motoru oluşturmak yalnızca destekler `SELECT` sorgular. - -Tüm destekler [Veri türleri](../../../sql_reference/data_types/index.md) dışında bir tabloda saklanabilir `LowCardinality` ve `AggregateFunction`. - -**Örnek:** - -**1.** Set up the `generate_engine_table` Tablo: - -``` sql -CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) -``` - -**2.** Verileri sorgula: - -``` sql -SELECT * FROM generate_engine_table LIMIT 3 -``` - -``` text -┌─name─┬──────value─┐ -│ c4xJ │ 1412771199 │ -│ r │ 1791099446 │ -│ 7#$ │ 124312908 │ -└──────┴────────────┘ -``` - -## Uygulama Detayları {#details-of-implementation} - -- Desteklenmiyor: - - `ALTER` - - `SELECT ... SAMPLE` - - `INSERT` - - Dizinler - - Çoğalma - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/tr/engines/table_engines/special/join.md b/docs/tr/engines/table_engines/special/join.md deleted file mode 100644 index 2fa786148e0..00000000000 --- a/docs/tr/engines/table_engines/special/join.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 40 -toc_title: Katmak ---- - -# Katmak {#join} - -Kullanılmak üzere hazırlanmış veri yapısı [JOIN](../../../sql_reference/statements/select.md#select-join) harekat. - -## Tablo oluşturma {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2], -) ENGINE = Join(join_strictness, join_type, k1[, k2, ...]) -``` - -Ayrıntılı açıklamasına bakın [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) sorgu. - -**Motor Parametreleri** - -- `join_strictness` – [Katılık katılın](../../../sql_reference/statements/select.md#select-join-strictness). -- `join_type` – [Birleştirme türü](../../../sql_reference/statements/select.md#select-join-types). -- `k1[, k2, ...]` – Key columns from the `USING` fık thera: `JOIN` işlemi yapılmamaktadır. - -Girmek `join_strictness` ve `join_type` tırnak işaretleri olmadan parametreler, örneğin, `Join(ANY, LEFT, col1)`. Onlar eşleşmelidir `JOIN` tablo için kullanılacak işlem. Parametreler eşleşmezse, ClickHouse bir istisna atmaz ve yanlış veri döndürebilir. - -## Tablo Kullanımı {#table-usage} - -### Örnek {#example} - -Sol taraftaki tablo oluşturma: - -``` sql -CREATE TABLE id_val(`id` UInt32, `val` UInt32) ENGINE = TinyLog -``` - -``` sql -INSERT INTO id_val VALUES (1,11)(2,12)(3,13) -``` - -Sağ tarafı oluşturma `Join` Tablo: - -``` sql -CREATE TABLE id_val_join(`id` UInt32, `val` UInt8) ENGINE = Join(ANY, LEFT, id) -``` - -``` sql -INSERT INTO id_val_join VALUES (1,21)(1,22)(3,23) -``` - -Tabloları birleştirme: - -``` sql -SELECT * FROM id_val ANY LEFT JOIN id_val_join USING (id) SETTINGS join_use_nulls = 1 -``` - -``` text -┌─id─┬─val─┬─id_val_join.val─┐ -│ 1 │ 11 │ 21 │ -│ 2 │ 12 │ ᴺᵁᴸᴸ │ -│ 3 │ 13 │ 23 │ -└────┴─────┴─────────────────┘ -``` - -Alternatif olarak, veri alabilirsiniz `Join` tablo, birleştirme anahtarı değerini belirterek: - -``` sql -SELECT joinGet('id_val_join', 'val', toUInt32(1)) -``` - -``` text -┌─joinGet('id_val_join', 'val', toUInt32(1))─┐ -│ 21 │ -└────────────────────────────────────────────┘ -``` - -### Veri seçme ve ekleme {#selecting-and-inserting-data} - -Kullanabilirsiniz `INSERT` veri eklemek için sorgular `Join`- motor masaları. Tablo ile oluşturulmuş ise `ANY` katılık, yinelenen anahtarlar için veriler göz ardı edilir. İle... `ALL` katılık, tüm satırlar eklenir. - -Gerçekleştir aemezsiniz `SELECT` doğrudan tablodan sorgulayın. Bunun yerine, aşağıdaki yöntemlerden birini kullanın: - -- Tabloyu sağ tarafa yerleştirin. `JOIN` yan. -- Call the [joinGet](../../../sql_reference/functions/other_functions.md#joinget) tablodan bir sözlükten aynı şekilde veri ayıklamanızı sağlayan işlev. - -### Sınırlamalar ve Ayarlar {#join-limitations-and-settings} - -Bir tablo oluştururken aşağıdaki ayarlar uygulanır: - -- [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) -- [max\_rows\_in\_join](../../../operations/settings/query_complexity.md#settings-max_rows_in_join) -- [max\_bytes\_in\_join](../../../operations/settings/query_complexity.md#settings-max_bytes_in_join) -- [join\_overflow\_mode](../../../operations/settings/query_complexity.md#settings-join_overflow_mode) -- [join\_any\_take\_last\_row](../../../operations/settings/settings.md#settings-join_any_take_last_row) - -Bu `Join`- motor tabloları kullanılamaz `GLOBAL JOIN` harekat. - -Bu `Join`- motor kullanımına izin verir [join\_use\_nulls](../../../operations/settings/settings.md#join_use_nulls) ayarı `CREATE TABLE` deyim. Ve [SELECT](../../../sql_reference/statements/select.md) sorgu kullanımına izin verir `join_use_nulls` çok. Eğer farklı varsa `join_use_nulls` ayarlar, tablo birleştirme bir hata alabilirsiniz. Bu katılmak türüne bağlıdır. Kullandığınızda [joinGet](../../../sql_reference/functions/other_functions.md#joinget) fonksiyonu, aynı kullanmak zorunda `join_use_nulls` ayarı `CRATE TABLE` ve `SELECT` deyimler. - -## Veri Depolama {#data-storage} - -`Join` tablo verileri her zaman RAM'de bulunur. Bir tabloya satır eklerken, sunucu yeniden başlatıldığında geri yüklenebilir, böylece ClickHouse disk üzerindeki dizine veri bloklarını yazar. - -Sunucu yanlış yeniden başlatılırsa, diskteki veri bloğu kaybolabilir veya zarar görebilir. Bu durumda, dosyayı hasarlı verilerle el ile silmeniz gerekebilir. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/tr/engines/table_engines/special/materializedview.md b/docs/tr/engines/table_engines/special/materializedview.md deleted file mode 100644 index 23e7d3122eb..00000000000 --- a/docs/tr/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 43 -toc_title: MaterializedView ---- - -# Materializedview {#materializedview} - -Somut görünümler uygulamak için kullanılır (Daha fazla bilgi için bkz . [CREATE TABLE](../../../sql_reference/statements/create.md)). Verileri depolamak için, görünümü oluştururken belirtilen farklı bir motor kullanır. Bir tablodan okurken, sadece bu motoru kullanır. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/tr/engines/table_engines/special/memory.md b/docs/tr/engines/table_engines/special/memory.md deleted file mode 100644 index a5f985ff5e2..00000000000 --- a/docs/tr/engines/table_engines/special/memory.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 44 -toc_title: Bellek ---- - -# Bellek {#memory} - -Bellek altyapısı verileri RAM, sıkıştırılmamış biçimde depolar. Veri okunduğunda alınan tam olarak aynı biçimde saklanır. Başka bir deyişle, bu tablodan okuma tamamen ücretsizdir. -Eşzamanlı veri erişimi senkronize edilir. Kilitler kısa: okuma ve yazma işlemleri birbirini engellemez. -Dizinler desteklenmiyor. Okuma paralelleştirilmiştir. -Basit sorgularda maksimum üretkenliğe (10 GB/sn'den fazla) ulaşılır, çünkü diskten okuma, açma veya veri serisini kaldırma yoktur. (Birçok durumda MergeTree motorunun verimliliğinin neredeyse yüksek olduğunu unutmamalıyız.) -Bir sunucu yeniden başlatılırken, veri tablodan kaybolur ve tablo boş olur. -Normalde, bu tablo motorunu kullanmak haklı değildir. Bununla birlikte, testler ve nispeten az sayıda satırda (yaklaşık 100.000.000'a kadar) maksimum hızın gerekli olduğu görevler için kullanılabilir. - -Bellek motoru, harici sorgu verilerine sahip geçici tablolar için sistem tarafından kullanılır (bkz. “External data for processing a query”) ve GLOBAL In uygulanması için (bkz. “IN operators”). - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/memory/) diff --git a/docs/tr/engines/table_engines/special/merge.md b/docs/tr/engines/table_engines/special/merge.md deleted file mode 100644 index bd4150e1afb..00000000000 --- a/docs/tr/engines/table_engines/special/merge.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 36 -toc_title: "Birle\u015Ftirmek" ---- - -# Birleştirmek {#merge} - -Bu `Merge` motor (ile karıştırılmamalıdır `MergeTree`) verileri kendisi saklamaz, ancak aynı anda herhangi bir sayıda başka tablodan okumaya izin verir. -Okuma otomatik olarak paralelleştirilir. Bir tabloya yazma desteklenmiyor. Okurken, gerçekten okunmakta olan tabloların dizinleri varsa kullanılır. -Bu `Merge` motor parametreleri kabul eder: veritabanı adı ve tablolar için düzenli ifade. - -Örnek: - -``` sql -Merge(hits, '^WatchLog') -``` - -Veri tablolardan okunacak `hits` düzenli ifadeyle eşleşen adlara sahip veritabanı ‘`^WatchLog`’. - -Veritabanı adı yerine, bir dize döndüren sabit bir ifade kullanabilirsiniz. Mesela, `currentDatabase()`. - -Regular expressions — [re2](https://github.com/google/re2) (pcre bir alt kümesini destekler), büyük / küçük harf duyarlı. -Düzenli ifadelerde kaçan sembollerle ilgili notlara bakın “match” bölme. - -Okumak için tabloları seçerken, `Merge` regex ile eşleşse bile tablonun kendisi seçilmeyecektir. Bu döngülerden kaçınmaktır. -İki tane oluşturmak mümkündür `Merge` sonsuza kadar birbirlerinin verilerini okumaya çalışacak tablolar, ancak bu iyi bir fikir değil. - -Kullanmak için tipik bir yol `Merge` motor çok sayıda çalışma içindir `TinyLog` tablolar tek bir tablo ile sanki. - -Örnek 2: - -Diyelim ki eski bir tablonuz (WatchLog\_old) var ve verileri yeni bir tabloya (WatchLog\_new) taşımadan bölümlemeyi değiştirmeye karar verdiniz ve her iki tablodaki verileri görmeniz gerekiyor. - -``` sql -CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree(date, (UserId, EventType), 8192); -INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - -CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) -ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; -INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - -CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - -SELECT * -FROM WatchLog -``` - -``` text -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-01 │ 1 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ -│ 2018-01-02 │ 2 │ hit │ 3 │ -└────────────┴────────┴───────────┴─────┘ -``` - -## Sanal Sütunlar {#virtual-columns} - -- `_table` — Contains the name of the table from which data was read. Type: [Dize](../../../sql_reference/data_types/string.md). - - Sabit koşulları ayarlayabilirsiniz `_table` in the `WHERE/PREWHERE` fıkra (sı (örneğin, `WHERE _table='xyz'`). Bu durumda, okuma işlemi yalnızca koşulun açık olduğu tablolar için gerçekleştirilir `_table` memnun olduğunu, bu yüzden `_table` sütun bir dizin görevi görür. - -**Ayrıca Bakınız** - -- [Sanal sütunlar](index.md#table_engines-virtual_columns) - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/tr/engines/table_engines/special/set.md b/docs/tr/engines/table_engines/special/set.md deleted file mode 100644 index af94ada6e12..00000000000 --- a/docs/tr/engines/table_engines/special/set.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 39 -toc_title: Koymak ---- - -# Koymak {#set} - -Her zaman RAM olan bir veri kümesi. In operatörünün sağ tarafında kullanılmak üzere tasarlanmıştır (bölüme bakın “IN operators”). - -Tabloya veri eklemek için INSERT kullanabilirsiniz. Veri kümesine yeni öğeler eklenirken, yinelenenler göz ardı edilir. -Ancak tablodan seçim yapamazsınız. Verileri almak için tek yol, IN operatörünün sağ yarısında kullanmaktır. - -Veri her zaman RAM yer almaktadır. INSERT için, eklenen veri blokları da diskteki tabloların dizinine yazılır. Sunucuyu başlatırken, bu veriler RAM'e yüklenir. Başka bir deyişle, yeniden başlattıktan sonra veriler yerinde kalır. - -Kaba bir sunucu yeniden başlatma için diskteki veri bloğu kaybolabilir veya zarar görebilir. İkinci durumda, dosyayı hasarlı verilerle el ile silmeniz gerekebilir. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/set/) diff --git a/docs/tr/engines/table_engines/special/url.md b/docs/tr/engines/table_engines/special/url.md deleted file mode 100644 index 51657248e75..00000000000 --- a/docs/tr/engines/table_engines/special/url.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 41 -toc_title: URL ---- - -# URL (URL, Biçim) {#table_engines-url} - -Uzak bir HTTP/HTTPS sunucusundaki verileri yönetir. Bu motor benzer -to the [Dosya](file.md) motor. - -## ClickHouse sunucusunda motoru kullanma {#using-the-engine-in-the-clickhouse-server} - -Bu `format` Clickhouse'un kullanabileceği bir tane olmalı -`SELECT` sorgular ve gerekirse `INSERTs`. Desteklenen formatların tam listesi için bkz. -[Biçimliler](../../../interfaces/formats.md#formats). - -Bu `URL` tekdüzen bir kaynak Bulucu yapısına uygun olmalıdır. Belirtilen URL bir sunucuya işaret etmelidir -bu HTTP veya HTTPS kullanır. Bu herhangi bir gerektirmez -sunucudan yanıt almak için ek başlıklar. - -`INSERT` ve `SELECT` sorgular dönüştürülür `POST` ve `GET` istemler, -sırasıyla. İşleme için `POST` istekleri, uzak sunucu desteklemesi gerekir -[Yığınlı aktarım kodlaması](https://en.wikipedia.org/wiki/Chunked_transfer_encoding). - -Kullanarak HTTP get yönlendirme şerbetçiotu sayısını sınırlayabilirsiniz [max\_http\_get\_redirects](../../../operations/settings/settings.md#setting-max_http_get_redirects) ayar. - -**Örnek:** - -**1.** Create a `url_engine_table` sunucuda tablo : - -``` sql -CREATE TABLE url_engine_table (word String, value UInt64) -ENGINE=URL('http://127.0.0.1:12345/', CSV) -``` - -**2.** Standart Python 3 araçlarını kullanarak temel bir HTTP Sunucusu oluşturun ve -Başlat: - -``` python3 -from http.server import BaseHTTPRequestHandler, HTTPServer - -class CSVHTTPServer(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type', 'text/csv') - self.end_headers() - - self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) - -if __name__ == "__main__": - server_address = ('127.0.0.1', 12345) - HTTPServer(server_address, CSVHTTPServer).serve_forever() -``` - -``` bash -$ python3 server.py -``` - -**3.** Veri iste: - -``` sql -SELECT * FROM url_engine_table -``` - -``` text -┌─word──┬─value─┐ -│ Hello │ 1 │ -│ World │ 2 │ -└───────┴───────┘ -``` - -## Uygulama Detayları {#details-of-implementation} - -- Okuma ve yazma paralel olabilir -- Desteklenmiyor: - - `ALTER` ve `SELECT...SAMPLE` harekat. - - Dizinler. - - Çoğalma. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/tr/faq/general.md b/docs/tr/faq/general.md index 05779e132a9..e49471bfb9b 100644 --- a/docs/tr/faq/general.md +++ b/docs/tr/faq/general.md @@ -9,13 +9,13 @@ toc_title: Genel Sorular ## Neden MapReduce Gibi Bir Şey Kullanmıyorsun? {#why-not-use-something-like-mapreduce} -Mapreduce gibi sistemlere, azaltma işleminin dağıtılmış sıralamaya dayandığı dağıtılmış bilgi işlem sistemleri olarak başvurabiliriz. Bu sınıftaki en yaygın açık kaynak çözümü [Apache Hadoop](http://hadoop.apache.org). Yandex, şirket içi çözümünü, YT'Yİ kullanıyor. +Mapreduce gibi sistemlere, azaltma işleminin dağıtılmış sıralamaya dayandığı dağıtılmış bilgi işlem sistemleri olarak başvurabiliriz. Bu sınıftaki en yaygın açık kaynak çözümü [Apache Hadoop](http://hadoop.apache.org). Yandex, şirket içi çözümünü, YT’Yİ kullanıyor. -Bu sistemler, yüksek gecikme süreleri nedeniyle çevrimiçi sorgular için uygun değildir. Başka bir deyişle, bir web arayüzü için arka uç olarak kullanılamazlar. Bu tür sistemler gerçek zamanlı veri güncellemeleri için yararlı değildir. Dağıtılmış sıralama, işlemin sonucu ve tüm ara sonuçlar (varsa) tek bir sunucunun RAM'İNDE bulunuyorsa, genellikle çevrimiçi sorgular için geçerli olan işlemleri azaltmanın en iyi yolu değildir. Böyle bir durumda, bir karma tablo azaltma işlemlerini gerçekleştirmek için en uygun yoldur. Harita azaltma görevlerini optimize etmek için ortak bir yaklaşım, RAM'de bir karma tablo kullanarak ön toplama (kısmi azaltma) ' dir. Kullanıcı bu optimizasyonu manuel olarak gerçekleştirir. Dağıtılmış sıralama, basit harita azaltma görevlerini çalıştırırken düşük performansın ana nedenlerinden biridir. +Bu sistemler, yüksek gecikme süreleri nedeniyle çevrimiçi sorgular için uygun değildir. Başka bir deyişle, bir web arayüzü için arka uç olarak kullanılamazlar. Bu tür sistemler gerçek zamanlı veri güncellemeleri için yararlı değildir. Dağıtılmış sıralama, işlemin sonucu ve tüm ara sonuçlar (varsa) tek bir sunucunun RAM’İNDE bulunuyorsa, genellikle çevrimiçi sorgular için geçerli olan işlemleri azaltmanın en iyi yolu değildir. Böyle bir durumda, bir karma tablo azaltma işlemlerini gerçekleştirmek için en uygun yoldur. Harita azaltma görevlerini optimize etmek için ortak bir yaklaşım, RAM’de bir karma tablo kullanarak ön toplama (kısmi azaltma) ’ dir. Kullanıcı bu optimizasyonu manuel olarak gerçekleştirir. Dağıtılmış sıralama, basit harita azaltma görevlerini çalıştırırken düşük performansın ana nedenlerinden biridir. -Çoğu MapReduce uygulaması, bir kümede rasgele kod çalıştırmanıza izin verir. Ancak bildirimsel bir sorgu dili, deneyleri hızlı bir şekilde çalıştırmak için OLAP için daha uygundur. Örneğin, Hadoop kovanı ve domuz vardır. Ayrıca Spark için Cloudera Impala veya Shark'ı (modası geçmiş) ve Spark SQL, Presto ve Apache Drill'i de düşünün. Bu tür görevleri çalıştırırken performans, özel sistemlere kıyasla oldukça düşük bir seviyededir, ancak nispeten yüksek gecikme, bu sistemleri bir web arayüzü için arka uç olarak kullanmayı gerçekçi kılmaktadır. +Çoğu MapReduce uygulaması, bir kümede rasgele kod çalıştırmanıza izin verir. Ancak bildirimsel bir sorgu dili, deneyleri hızlı bir şekilde çalıştırmak için OLAP için daha uygundur. Örneğin, Hadoop kovanı ve domuz vardır. Ayrıca Spark için Cloudera Impala veya Shark’ı (modası geçmiş) ve Spark SQL, Presto ve Apache Drill’i de düşünün. Bu tür görevleri çalıştırırken performans, özel sistemlere kıyasla oldukça düşük bir seviyededir, ancak nispeten yüksek gecikme, bu sistemleri bir web arayüzü için arka uç olarak kullanmayı gerçekçi kılmaktadır. -## Oracle aracılığıyla ODBC kullanırken Kodlamalarla ilgili bir sorunum varsa ne olur? {#oracle-odbc-encodings} +## Oracle aracılığıyla ODBC kullanırken Kodlamalarla Ilgili Bir Sorunum Varsa Ne Olur? {#oracle-odbc-encodings} Oracle ODBC sürücüsü aracılığıyla dış sözlükler kaynağı olarak kullanırsanız, doğru değeri ayarlamanız gerekir. `NLS_LANG` ortam değişkeni `/etc/default/clickhouse`. Daha fazla bilgi için, bkz: [Oracle NLS\_LANG SSS](https://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html). @@ -25,11 +25,11 @@ Oracle ODBC sürücüsü aracılığıyla dış sözlükler kaynağı olarak kul NLS_LANG=RUSSIAN_RUSSIA.UTF8 ``` -## Clickhouse'dan bir dosyaya verileri nasıl dışa aktarırım? {#how-to-export-to-file} +## Clickhouse’dan Bir Dosyaya Verileri nasıl dışa aktarırım? {#how-to-export-to-file} -### INTO OUTFİLE yan tümcesini kullanma {#using-into-outfile-clause} +### INTO OUTFİLE Yan tümcesini Kullanma {#using-into-outfile-clause} -Add an [INTO OUTFILE](../sql_reference/statements/select.md#into-outfile-clause) sorgunuza yan tümce. +Add an [INTO OUTFILE](../sql-reference/statements/select.md#into-outfile-clause) sorgunuza yan tümce. Mesela: @@ -37,7 +37,7 @@ Mesela: SELECT * FROM table INTO OUTFILE 'file' ``` -Varsayılan olarak, ClickHouse kullanır [TabSeparated](../interfaces/formats.md#tabseparated) çıktı verileri için Biçim. Seçmek için [Veri formatı](../interfaces/formats.md), use the [FORMAT CLA clauseuse](../sql_reference/statements/select.md#format-clause). +Varsayılan olarak, ClickHouse kullanır [TabSeparated](../interfaces/formats.md#tabseparated) çıktı verileri için Biçim. Seçmek için [Veri formatı](../interfaces/formats.md), use the [FORMAT CLA clauseuse](../sql-reference/statements/select.md#format-clause). Mesela: @@ -45,9 +45,9 @@ Mesela: SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV ``` -### Dosya altyapısı tablosu kullanma {#using-a-file-engine-table} +### Dosya altyapısı Tablosu Kullanma {#using-a-file-engine-table} -Görmek [Dosya](../engines/table_engines/special/file.md). +Görmek [Dosya](../engines/table-engines/special/file.md). ### Komut Satırı Yeniden Yönlendirmesini Kullanma {#using-command-line-redirection} diff --git a/docs/tr/getting_started/example_datasets/amplab_benchmark.md b/docs/tr/getting-started/example-datasets/amplab-benchmark.md similarity index 100% rename from docs/tr/getting_started/example_datasets/amplab_benchmark.md rename to docs/tr/getting-started/example-datasets/amplab-benchmark.md diff --git a/docs/tr/getting-started/example-datasets/criteo.md b/docs/tr/getting-started/example-datasets/criteo.md new file mode 100644 index 00000000000..f9fc2975e34 --- /dev/null +++ b/docs/tr/getting-started/example-datasets/criteo.md @@ -0,0 +1,81 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 19 +toc_title: "Criteo'dan Terabyte t\u0131klama g\xFCnl\xFCkleri" +--- + +# Criteo’dan tıklama günlüklerinin Terabayt {#terabyte-of-click-logs-from-criteo} + +Verileri indirin http://labs.criteo.com/downloads/download-terabyte-click-logs/ + +Günlük almak için bir tablo oluşturun: + +``` sql +CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log +``` + +Verileri indirin: + +``` bash +$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done +``` + +Dönüştürülen veriler için bir tablo oluşturma: + +``` sql +CREATE TABLE criteo +( + date Date, + clicked UInt8, + int1 Int32, + int2 Int32, + int3 Int32, + int4 Int32, + int5 Int32, + int6 Int32, + int7 Int32, + int8 Int32, + int9 Int32, + int10 Int32, + int11 Int32, + int12 Int32, + int13 Int32, + icat1 UInt32, + icat2 UInt32, + icat3 UInt32, + icat4 UInt32, + icat5 UInt32, + icat6 UInt32, + icat7 UInt32, + icat8 UInt32, + icat9 UInt32, + icat10 UInt32, + icat11 UInt32, + icat12 UInt32, + icat13 UInt32, + icat14 UInt32, + icat15 UInt32, + icat16 UInt32, + icat17 UInt32, + icat18 UInt32, + icat19 UInt32, + icat20 UInt32, + icat21 UInt32, + icat22 UInt32, + icat23 UInt32, + icat24 UInt32, + icat25 UInt32, + icat26 UInt32 +) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) +``` + +Verileri ham günlüğünden dönüştürün ve ikinci tabloya koyun: + +``` sql +INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; + +DROP TABLE criteo_log; +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/tr/getting-started/example-datasets/index.md b/docs/tr/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..950b7dc0d7f --- /dev/null +++ b/docs/tr/getting-started/example-datasets/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "\xD6rnek Veri K\xFCmeleri" +toc_priority: 12 +toc_title: "Giri\u015F" +--- + +# Örnek Veri Kümeleri {#example-datasets} + +Bu bölümde, örnek veri kümelerinin nasıl elde edileceği ve bunları Clickhouse’a nasıl içe aktarılacağı açıklanmaktadır. +Bazı veri kümeleri için örnek sorgular da mevcuttur. + +- [Anonim Yandex.Metrica Veri Kümesi](metrica.md) +- [Yıldız Şema Ben Benchmarkch Benchmarkmark](star-schema.md) +- [WikiStat](wikistat.md) +- [Criteo’dan tıklama günlüklerinin terabayt](criteo.md) +- [AMPLab Büyük Veri Benchmark](amplab-benchmark.md) +- [New York Taksi Verileri](nyc-taxi.md) +- [OnTime](ontime.md) + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/tr/getting-started/example-datasets/metrica.md b/docs/tr/getting-started/example-datasets/metrica.md new file mode 100644 index 00000000000..f9af62d7e0c --- /dev/null +++ b/docs/tr/getting-started/example-datasets/metrica.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 21 +toc_title: "\xDCye.Metrica Verileri" +--- + +# Anonim Yandex.Metrica Verileri {#anonymized-yandex-metrica-data} + +Veri kümesi, isabetlerle ilgili anonimleştirilmiş verileri içeren iki tablodan oluşur (`hits_v1`) ve ziyaret visitsler (`visits_v1`(kayıt olmak için).Metrica. Yandex hakkında daha fazla bilgi edinebilirsiniz.Metrica içinde [ClickHouse geçmişi](../../introduction/history.md) bölme. + +Veri kümesi iki tablodan oluşur, bunlardan biri sıkıştırılmış olarak indirilebilir `tsv.xz` dosya veya hazırlanmış bölümler olarak. Buna ek olarak, genişletilmiş bir sürümü `hits` 100 milyon satır içeren tablo TSV olarak mevcuttur https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz ve hazırlanan bölümler olarak https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. + +## Hazırlanan bölümlerden Tablolar Elde Etme {#obtaining-tables-from-prepared-partitions} + +İndirme ve ithalat tablo hits: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar +tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +İndirme ve ithalat ziyaretleri: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar +tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Sıkıştırılmış TSV dosyasından Tablo Alma {#obtaining-tables-from-compressed-tsv-file} + +Sıkıştırılmış TSV dosyasından indir ve İçe Aktar: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +Sıkıştırılmış tsv dosyasından ziyaretleri indirin ve içe aktarın: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## Örnek Sorgular {#example-queries} + +[ClickHouse eğitimi](../../getting-started/tutorial.md) Yandex dayanmaktadır.Metrica veri kümesi ve bu veri kümesine başlamak için önerilen yol sadece öğreticiden geçmektir. + +Bu tablolara ek sorgu örnekleri arasında bulunabilir [durum bilgisi testleri](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) ClickHouse of (onlar adlandırılır `test.hists` ve `test.visits` oralarda). diff --git a/docs/tr/getting-started/example-datasets/nyc-taxi.md b/docs/tr/getting-started/example-datasets/nyc-taxi.md new file mode 100644 index 00000000000..bf3d62d51a6 --- /dev/null +++ b/docs/tr/getting-started/example-datasets/nyc-taxi.md @@ -0,0 +1,390 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 16 +toc_title: New York Taksi Verileri +--- + +# New York Taksi Verileri {#new-york-taxi-data} + +Bu veri kümesi iki şekilde elde edilebilir: + +- ham verilerden içe aktarma +- hazırlanan bölüm downloadlerin indir downloadilmesi + +## Ham Veri nasıl alınır {#how-to-import-the-raw-data} + +Bkz. https://github.com/toddwschneider/nyc-taxi-data ve http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html bir veri kümesinin açıklaması ve indirme talimatları için. + +İndirme, CSV dosyalarında yaklaşık 227 GB sıkıştırılmamış veri ile sonuçlanacaktır. İndirme, 1 Gbit bağlantısı üzerinden yaklaşık bir saat sürer (paralel indirme s3.amazonaws.com 1 Gbit kanalın en az yarısını kurtarır). +Bazı dosyalar tam olarak indirilmeyebilir. Dosya boyutlarını kontrol edin ve şüpheli görünen herhangi birini yeniden indirin. + +Bazı dosyalar geçersiz satırlar içerebilir. Bunları aşağıdaki gibi düzeltebilirsiniz: + +``` bash +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ +mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv +mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv +``` + +Daha sonra veriler Postgresql’de önceden işlenmelidir. Bu, çokgenlerdeki noktaların seçimlerini oluşturacaktır (Haritadaki noktaları New York şehrinin ilçeleriyle eşleştirmek için) ve tüm verileri bir birleştirme kullanarak tek bir denormalize düz tabloda birleştirecektir. Bunu yapmak için Postgresql’i Postgıs desteği ile yüklemeniz gerekir. + +Çalışırken dikkatli olun `initialize_database.sh` ve tüm tabloların doğru şekilde oluşturulduğunu manuel olarak yeniden kontrol edin. + +Postgresql’deki her ayın verilerini işlemek yaklaşık 20-30 dakika sürer, toplam yaklaşık 48 saat sürer. + +İndirilen satır sayısını aşağıdaki gibi kontrol edebilirsiniz: + +``` bash +$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" +## Count + 1298979494 +(1 row) + +real 7m9.164s +``` + +(Bu, Mark Litwintschik tarafından bir dizi blog gönderisinde bildirilen 1.1 milyar satırdan biraz daha fazladır .) + +Postgresql’deki veriler 370 GB alan kullanıyor. + +PostgreSQL veri verme: + +``` sql +COPY +( + SELECT trips.id, + trips.vendor_id, + trips.pickup_datetime, + trips.dropoff_datetime, + trips.store_and_fwd_flag, + trips.rate_code_id, + trips.pickup_longitude, + trips.pickup_latitude, + trips.dropoff_longitude, + trips.dropoff_latitude, + trips.passenger_count, + trips.trip_distance, + trips.fare_amount, + trips.extra, + trips.mta_tax, + trips.tip_amount, + trips.tolls_amount, + trips.ehail_fee, + trips.improvement_surcharge, + trips.total_amount, + trips.payment_type, + trips.trip_type, + trips.pickup, + trips.dropoff, + + cab_types.type cab_type, + + weather.precipitation_tenths_of_mm rain, + weather.snow_depth_mm, + weather.snowfall_mm, + weather.max_temperature_tenths_degrees_celsius max_temp, + weather.min_temperature_tenths_degrees_celsius min_temp, + weather.average_wind_speed_tenths_of_meters_per_second wind, + + pick_up.gid pickup_nyct2010_gid, + pick_up.ctlabel pickup_ctlabel, + pick_up.borocode pickup_borocode, + pick_up.boroname pickup_boroname, + pick_up.ct2010 pickup_ct2010, + pick_up.boroct2010 pickup_boroct2010, + pick_up.cdeligibil pickup_cdeligibil, + pick_up.ntacode pickup_ntacode, + pick_up.ntaname pickup_ntaname, + pick_up.puma pickup_puma, + + drop_off.gid dropoff_nyct2010_gid, + drop_off.ctlabel dropoff_ctlabel, + drop_off.borocode dropoff_borocode, + drop_off.boroname dropoff_boroname, + drop_off.ct2010 dropoff_ct2010, + drop_off.boroct2010 dropoff_boroct2010, + drop_off.cdeligibil dropoff_cdeligibil, + drop_off.ntacode dropoff_ntacode, + drop_off.ntaname dropoff_ntaname, + drop_off.puma dropoff_puma + FROM trips + LEFT JOIN cab_types + ON trips.cab_type_id = cab_types.id + LEFT JOIN central_park_weather_observations_raw weather + ON weather.date = trips.pickup_datetime::date + LEFT JOIN nyct2010 pick_up + ON pick_up.gid = trips.pickup_nyct2010_gid + LEFT JOIN nyct2010 drop_off + ON drop_off.gid = trips.dropoff_nyct2010_gid +) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; +``` + +Veri anlık görüntüsü saniyede yaklaşık 50 MB hızında oluşturulur. Anlık görüntü oluştururken, PostgreSQL diskten saniyede yaklaşık 28 MB hızında okur. +Bu yaklaşık 5 saat sürer. Elde edilen TSV dosyası 590612904969 bayttır. + +Clickhouse’da geçici bir tablo oluşturma: + +``` sql +CREATE TABLE trips +( +trip_id UInt32, +vendor_id String, +pickup_datetime DateTime, +dropoff_datetime Nullable(DateTime), +store_and_fwd_flag Nullable(FixedString(1)), +rate_code_id Nullable(UInt8), +pickup_longitude Nullable(Float64), +pickup_latitude Nullable(Float64), +dropoff_longitude Nullable(Float64), +dropoff_latitude Nullable(Float64), +passenger_count Nullable(UInt8), +trip_distance Nullable(Float64), +fare_amount Nullable(Float32), +extra Nullable(Float32), +mta_tax Nullable(Float32), +tip_amount Nullable(Float32), +tolls_amount Nullable(Float32), +ehail_fee Nullable(Float32), +improvement_surcharge Nullable(Float32), +total_amount Nullable(Float32), +payment_type Nullable(String), +trip_type Nullable(UInt8), +pickup Nullable(String), +dropoff Nullable(String), +cab_type Nullable(String), +precipitation Nullable(UInt8), +snow_depth Nullable(UInt8), +snowfall Nullable(UInt8), +max_temperature Nullable(UInt8), +min_temperature Nullable(UInt8), +average_wind_speed Nullable(UInt8), +pickup_nyct2010_gid Nullable(UInt8), +pickup_ctlabel Nullable(String), +pickup_borocode Nullable(UInt8), +pickup_boroname Nullable(String), +pickup_ct2010 Nullable(String), +pickup_boroct2010 Nullable(String), +pickup_cdeligibil Nullable(FixedString(1)), +pickup_ntacode Nullable(String), +pickup_ntaname Nullable(String), +pickup_puma Nullable(String), +dropoff_nyct2010_gid Nullable(UInt8), +dropoff_ctlabel Nullable(String), +dropoff_borocode Nullable(UInt8), +dropoff_boroname Nullable(String), +dropoff_ct2010 Nullable(String), +dropoff_boroct2010 Nullable(String), +dropoff_cdeligibil Nullable(String), +dropoff_ntacode Nullable(String), +dropoff_ntaname Nullable(String), +dropoff_puma Nullable(String) +) ENGINE = Log; +``` + +Alanları daha doğru veri türlerine dönüştürmek ve mümkünse Boşları ortadan kaldırmak için gereklidir. + +``` bash +$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv + +real 75m56.214s +``` + +Veri 112-140 Mb/saniye hızında okunur. +Bir akışta bir günlük türü tablosuna veri yükleme 76 dakika sürdü. +Bu tablodaki veriler 142 GB kullanır. + +(Verileri doğrudan Postgres’ten içe aktarmak da mümkündür `COPY ... TO PROGRAM`.) + +Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. + +Başlamak için, tek bir sunucuda bir tablo oluşturacağız. Daha sonra tabloyu dağıtacağız. + +Özet Tablo oluşturma ve doldurma: + +``` sql +CREATE TABLE trips_mergetree +ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +AS SELECT + +trip_id, +CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, +toDate(pickup_datetime) AS pickup_date, +ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, +toDate(dropoff_datetime) AS dropoff_date, +ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, +assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, +assumeNotNull(rate_code_id) AS rate_code_id, +assumeNotNull(pickup_longitude) AS pickup_longitude, +assumeNotNull(pickup_latitude) AS pickup_latitude, +assumeNotNull(dropoff_longitude) AS dropoff_longitude, +assumeNotNull(dropoff_latitude) AS dropoff_latitude, +assumeNotNull(passenger_count) AS passenger_count, +assumeNotNull(trip_distance) AS trip_distance, +assumeNotNull(fare_amount) AS fare_amount, +assumeNotNull(extra) AS extra, +assumeNotNull(mta_tax) AS mta_tax, +assumeNotNull(tip_amount) AS tip_amount, +assumeNotNull(tolls_amount) AS tolls_amount, +assumeNotNull(ehail_fee) AS ehail_fee, +assumeNotNull(improvement_surcharge) AS improvement_surcharge, +assumeNotNull(total_amount) AS total_amount, +CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, +assumeNotNull(trip_type) AS trip_type, +ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, +ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, +CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, + +assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, +toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, +assumeNotNull(pickup_borocode) AS pickup_borocode, +CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, +toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, +toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, +CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, +toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, + +CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, + +toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, + +assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, +toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, +assumeNotNull(dropoff_borocode) AS dropoff_borocode, +CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, +toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, +toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, +CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, +toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, + +CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, + +toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma + +FROM trips +``` + +Bu, saniyede yaklaşık 428.000 satırlık bir hızda 3030 saniye sürer. +Daha hızlı yüklemek için, tablo ile oluşturabilirsiniz `Log` motor yerine `MergeTree`. Bu durumda, indirme 200 saniyeden daha hızlı çalışır. + +Tablo 126 GB disk alanı kullanır. + +``` sql +SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active +``` + +``` text +┌─formatReadableSize(sum(bytes))─┐ +│ 126.18 GiB │ +└────────────────────────────────┘ +``` + +Diğer şeylerin yanı sıra, MERGETREE üzerinde en iyi duruma getirme sorgusunu çalıştırabilirsiniz. Ama her şey onsuz iyi olacak çünkü gerekli değildir. + +## Hazırlanan Bölüm Downloadlerin Indir Downloadilmesi {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar +$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" +``` + +!!! info "Bilgin" + Aşağıda açıklanan sorguları çalıştıracaksanız, tam tablo adını kullanmanız gerekir, `datasets.trips_mergetree`. + +## Tek Server Ile Ilgili sonuçlar {#results-on-single-server} + +Q1: + +``` sql +SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type +``` + +0.490 saniye. + +Q2: + +``` sql +SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count +``` + +1.224 saniye. + +Q3: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year +``` + +2.104 saniye. + +Q4: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) +FROM trips_mergetree +GROUP BY passenger_count, year, distance +ORDER BY year, count(*) DESC +``` + +3.593 saniye. + +Aşağıdaki sunucu kullanıldı: + +İki Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60 GHz, 16 fiziksel çekirdekler toplam,128 GiB RAM,8x6 TB HD donanım RAID-5 + +Yürütme süresi üç koşunun en iyisidir. Ancak ikinci çalıştırmadan başlayarak, sorgular dosya sistemi önbelleğinden verileri okur. Başka önbelleğe alma oluşur: veri okundu ve her vadede işlenir. + +Üç sunucuda tablo oluşturma: + +Her sunucuda: + +``` sql +CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +``` + +Kaynak sunucuda: + +``` sql +CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) +``` + +Aşağıdaki sorgu verileri yeniden dağıtır: + +``` sql +INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree +``` + +Bu 2454 saniye sürer. + +Üç sunucuda: + +Q1: 0.212 saniye. +Q2: 0.438 saniye. +Q3: 0.733 saniye. +Q4: 1.241 saniye. + +Sorgular doğrusal olarak ölçeklendiğinden, burada sürpriz yok. + +Ayrıca 140 sunucu kümesinden elde edilen sonuçlara sahibiz: + +Q1: 0.028 sn. +Q2: 0.043 sn. +Q3: 0.051 sn. +Q4: 0.072 sn. + +Bu durumda, sorgu işleme süresi her şeyden önce ağ gecikmesi ile belirlenir. +Finlandiya’daki bir Yandex veri merkezinde bulunan ve Rusya’daki bir kümede bulunan ve yaklaşık 20 ms gecikme süresi ekleyen bir istemci kullanarak sorgular çalıştırdık. + +## Özet {#summary} + +| hizmetçiler | Q1 | Q2 | Q3 | Q4 | +|-------------|-------|-------|-------|-------| +| 1 | 0.490 | 1.224 | 2.104 | 3.593 | +| 3 | 0.212 | 0.438 | 0.733 | 1.241 | +| 140 | 0.028 | 0.043 | 0.051 | 0.072 | + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/tr/getting-started/example-datasets/ontime.md b/docs/tr/getting-started/example-datasets/ontime.md new file mode 100644 index 00000000000..ff489ee7e5c --- /dev/null +++ b/docs/tr/getting-started/example-datasets/ontime.md @@ -0,0 +1,412 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 15 +toc_title: OnTime +--- + +# OnTime {#ontime} + +Bu veri kümesi iki şekilde elde edilebilir: + +- ham verilerden içe aktarma +- hazırlanan bölüm downloadlerin indir downloadilmesi + +## Ham Verilerden İçe Aktarma {#import-from-raw-data} + +Veri indirme: + +``` bash +for s in `seq 1987 2018` +do +for m in `seq 1 12` +do +wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip +done +done +``` + +(from https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) + +Tablo oluşturma: + +``` sql +CREATE TABLE `ontime` ( + `Year` UInt16, + `Quarter` UInt8, + `Month` UInt8, + `DayofMonth` UInt8, + `DayOfWeek` UInt8, + `FlightDate` Date, + `UniqueCarrier` FixedString(7), + `AirlineID` Int32, + `Carrier` FixedString(2), + `TailNum` String, + `FlightNum` String, + `OriginAirportID` Int32, + `OriginAirportSeqID` Int32, + `OriginCityMarketID` Int32, + `Origin` FixedString(5), + `OriginCityName` String, + `OriginState` FixedString(2), + `OriginStateFips` String, + `OriginStateName` String, + `OriginWac` Int32, + `DestAirportID` Int32, + `DestAirportSeqID` Int32, + `DestCityMarketID` Int32, + `Dest` FixedString(5), + `DestCityName` String, + `DestState` FixedString(2), + `DestStateFips` String, + `DestStateName` String, + `DestWac` Int32, + `CRSDepTime` Int32, + `DepTime` Int32, + `DepDelay` Int32, + `DepDelayMinutes` Int32, + `DepDel15` Int32, + `DepartureDelayGroups` String, + `DepTimeBlk` String, + `TaxiOut` Int32, + `WheelsOff` Int32, + `WheelsOn` Int32, + `TaxiIn` Int32, + `CRSArrTime` Int32, + `ArrTime` Int32, + `ArrDelay` Int32, + `ArrDelayMinutes` Int32, + `ArrDel15` Int32, + `ArrivalDelayGroups` Int32, + `ArrTimeBlk` String, + `Cancelled` UInt8, + `CancellationCode` FixedString(1), + `Diverted` UInt8, + `CRSElapsedTime` Int32, + `ActualElapsedTime` Int32, + `AirTime` Int32, + `Flights` Int32, + `Distance` Int32, + `DistanceGroup` UInt8, + `CarrierDelay` Int32, + `WeatherDelay` Int32, + `NASDelay` Int32, + `SecurityDelay` Int32, + `LateAircraftDelay` Int32, + `FirstDepTime` String, + `TotalAddGTime` String, + `LongestAddGTime` String, + `DivAirportLandings` String, + `DivReachedDest` String, + `DivActualElapsedTime` String, + `DivArrDelay` String, + `DivDistance` String, + `Div1Airport` String, + `Div1AirportID` Int32, + `Div1AirportSeqID` Int32, + `Div1WheelsOn` String, + `Div1TotalGTime` String, + `Div1LongestGTime` String, + `Div1WheelsOff` String, + `Div1TailNum` String, + `Div2Airport` String, + `Div2AirportID` Int32, + `Div2AirportSeqID` Int32, + `Div2WheelsOn` String, + `Div2TotalGTime` String, + `Div2LongestGTime` String, + `Div2WheelsOff` String, + `Div2TailNum` String, + `Div3Airport` String, + `Div3AirportID` Int32, + `Div3AirportSeqID` Int32, + `Div3WheelsOn` String, + `Div3TotalGTime` String, + `Div3LongestGTime` String, + `Div3WheelsOff` String, + `Div3TailNum` String, + `Div4Airport` String, + `Div4AirportID` Int32, + `Div4AirportSeqID` Int32, + `Div4WheelsOn` String, + `Div4TotalGTime` String, + `Div4LongestGTime` String, + `Div4WheelsOff` String, + `Div4TailNum` String, + `Div5Airport` String, + `Div5AirportID` Int32, + `Div5AirportSeqID` Int32, + `Div5WheelsOn` String, + `Div5TotalGTime` String, + `Div5LongestGTime` String, + `Div5WheelsOff` String, + `Div5TailNum` String +) ENGINE = MergeTree +PARTITION BY Year +ORDER BY (Carrier, FlightDate) +SETTINGS index_granularity = 8192; +``` + +Veri yükleme: + +``` bash +$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done +``` + +## Hazırlanan Bölüm Downloadlerin Indir Downloadilmesi {#download-of-prepared-partitions} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar +$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.ontime" +``` + +!!! info "Bilgin" + Aşağıda açıklanan sorguları çalıştıracaksanız, tam tablo adını kullanmanız gerekir, `datasets.ontime`. + +## Sorgular {#queries} + +Q0. + +``` sql +SELECT avg(c1) +FROM +( + SELECT Year, Month, count(*) AS c1 + FROM ontime + GROUP BY Year, Month +); +``` + +Q1. 2000 yılından 2008 yılına kadar günlük uçuş sayısı + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +S2. 2000-2008 için haftanın gününe göre gruplandırılmış 10 dakikadan fazla geciken uçuş sayısı + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +Q3. 2000-2008 için havaalanı tarafından gecikme sayısı + +``` sql +SELECT Origin, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY Origin +ORDER BY c DESC +LIMIT 10; +``` + +S4. 2007 yılı için taşıyıcı tarafından gecikme sayısı + +``` sql +SELECT Carrier, count(*) +FROM ontime +WHERE DepDelay>10 AND Year=2007 +GROUP BY Carrier +ORDER BY count(*) DESC; +``` + +Q5. 2007 yılı için taşıyıcı tarafından gecikme yüzdesi + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year=2007 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year=2007 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Aynı sorgunun daha iyi sürümü: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year=2007 +GROUP BY Carrier +ORDER BY c3 DESC +``` + +S6. Daha geniş bir yıl aralığı için önceki talep, 2000-2008 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year>=2000 AND Year<=2008 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year>=2000 AND Year<=2008 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +Aynı sorgunun daha iyi sürümü: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY Carrier +ORDER BY c3 DESC; +``` + +Q7. Yıla göre 10 dakikadan fazla gecikmeli uçuş yüzdesi + +``` sql +SELECT Year, c1/c2 +FROM +( + select + Year, + count(*)*100 as c1 + from ontime + WHERE DepDelay>10 + GROUP BY Year +) +JOIN +( + select + Year, + count(*) as c2 + from ontime + GROUP BY Year +) USING (Year) +ORDER BY Year; +``` + +Aynı sorgunun daha iyi sürümü: + +``` sql +SELECT Year, avg(DepDelay>10)*100 +FROM ontime +GROUP BY Year +ORDER BY Year; +``` + +S8. Çeşitli yıl aralıkları için doğrudan bağlı şehirlerin sayısına göre en popüler yerler + +``` sql +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +WHERE Year >= 2000 and Year <= 2010 +GROUP BY DestCityName +ORDER BY u DESC LIMIT 10; +``` + +Q9. + +``` sql +SELECT Year, count(*) AS c1 +FROM ontime +GROUP BY Year; +``` + +Q10. + +``` sql +SELECT + min(Year), max(Year), Carrier, count(*) AS cnt, + sum(ArrDelayMinutes>30) AS flights_delayed, + round(sum(ArrDelayMinutes>30)/count(*),2) AS rate +FROM ontime +WHERE + DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') + AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') + AND FlightDate < '2010-01-01' +GROUP by Carrier +HAVING cnt>100000 and max(Year)>1990 +ORDER by rate DESC +LIMIT 1000; +``` + +Bonus: + +``` sql +SELECT avg(cnt) +FROM +( + SELECT Year,Month,count(*) AS cnt + FROM ontime + WHERE DepDel15=1 + GROUP BY Year,Month +); + +SELECT avg(c1) FROM +( + SELECT Year,Month,count(*) AS c1 + FROM ontime + GROUP BY Year,Month +); + +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +GROUP BY DestCityName +ORDER BY u DESC +LIMIT 10; + +SELECT OriginCityName, DestCityName, count() AS c +FROM ontime +GROUP BY OriginCityName, DestCityName +ORDER BY c DESC +LIMIT 10; + +SELECT OriginCityName, count() AS c +FROM ontime +GROUP BY OriginCityName +ORDER BY c DESC +LIMIT 10; +``` + +Bu performans testi Vadim Tkachenko tarafından oluşturuldu. Görmek: + +- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ +- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ +- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ +- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ +- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ +- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/tr/getting-started/example-datasets/star-schema.md b/docs/tr/getting-started/example-datasets/star-schema.md new file mode 100644 index 00000000000..b2de52ff5d6 --- /dev/null +++ b/docs/tr/getting-started/example-datasets/star-schema.md @@ -0,0 +1,370 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 20 +toc_title: "Y\u0131ld\u0131z \u015Eema Ben Benchmarkch Benchmarkmark" +--- + +# Yıldız Şema Ben Benchmarkch Benchmarkmark {#star-schema-benchmark} + +Dbgen derleme: + +``` bash +$ git clone git@github.com:vadimtk/ssb-dbgen.git +$ cd ssb-dbgen +$ make +``` + +Veri oluşturma: + +!!! warning "Dikkat" + İle `-s 100` dbgen, 600 milyon satır (67 GB) üretir `-s 1000` 6 milyar satır üretir (bu çok zaman alır) + +``` bash +$ ./dbgen -s 1000 -T c +$ ./dbgen -s 1000 -T l +$ ./dbgen -s 1000 -T p +$ ./dbgen -s 1000 -T s +$ ./dbgen -s 1000 -T d +``` + +Clickhouse’da tablolar oluşturma: + +``` sql +CREATE TABLE customer +( + C_CUSTKEY UInt32, + C_NAME String, + C_ADDRESS String, + C_CITY LowCardinality(String), + C_NATION LowCardinality(String), + C_REGION LowCardinality(String), + C_PHONE String, + C_MKTSEGMENT LowCardinality(String) +) +ENGINE = MergeTree ORDER BY (C_CUSTKEY); + +CREATE TABLE lineorder +( + LO_ORDERKEY UInt32, + LO_LINENUMBER UInt8, + LO_CUSTKEY UInt32, + LO_PARTKEY UInt32, + LO_SUPPKEY UInt32, + LO_ORDERDATE Date, + LO_ORDERPRIORITY LowCardinality(String), + LO_SHIPPRIORITY UInt8, + LO_QUANTITY UInt8, + LO_EXTENDEDPRICE UInt32, + LO_ORDTOTALPRICE UInt32, + LO_DISCOUNT UInt8, + LO_REVENUE UInt32, + LO_SUPPLYCOST UInt32, + LO_TAX UInt8, + LO_COMMITDATE Date, + LO_SHIPMODE LowCardinality(String) +) +ENGINE = MergeTree PARTITION BY toYear(LO_ORDERDATE) ORDER BY (LO_ORDERDATE, LO_ORDERKEY); + +CREATE TABLE part +( + P_PARTKEY UInt32, + P_NAME String, + P_MFGR LowCardinality(String), + P_CATEGORY LowCardinality(String), + P_BRAND LowCardinality(String), + P_COLOR LowCardinality(String), + P_TYPE LowCardinality(String), + P_SIZE UInt8, + P_CONTAINER LowCardinality(String) +) +ENGINE = MergeTree ORDER BY P_PARTKEY; + +CREATE TABLE supplier +( + S_SUPPKEY UInt32, + S_NAME String, + S_ADDRESS String, + S_CITY LowCardinality(String), + S_NATION LowCardinality(String), + S_REGION LowCardinality(String), + S_PHONE String +) +ENGINE = MergeTree ORDER BY S_SUPPKEY; +``` + +Veri ekleme: + +``` bash +$ clickhouse-client --query "INSERT INTO customer FORMAT CSV" < customer.tbl +$ clickhouse-client --query "INSERT INTO part FORMAT CSV" < part.tbl +$ clickhouse-client --query "INSERT INTO supplier FORMAT CSV" < supplier.tbl +$ clickhouse-client --query "INSERT INTO lineorder FORMAT CSV" < lineorder.tbl +``` + +Dönüşüm “star schema” denormalized için “flat schema”: + +``` sql +SET max_memory_usage = 20000000000; + +CREATE TABLE lineorder_flat +ENGINE = MergeTree +PARTITION BY toYear(LO_ORDERDATE) +ORDER BY (LO_ORDERDATE, LO_ORDERKEY) AS +SELECT + l.LO_ORDERKEY AS LO_ORDERKEY, + l.LO_LINENUMBER AS LO_LINENUMBER, + l.LO_CUSTKEY AS LO_CUSTKEY, + l.LO_PARTKEY AS LO_PARTKEY, + l.LO_SUPPKEY AS LO_SUPPKEY, + l.LO_ORDERDATE AS LO_ORDERDATE, + l.LO_ORDERPRIORITY AS LO_ORDERPRIORITY, + l.LO_SHIPPRIORITY AS LO_SHIPPRIORITY, + l.LO_QUANTITY AS LO_QUANTITY, + l.LO_EXTENDEDPRICE AS LO_EXTENDEDPRICE, + l.LO_ORDTOTALPRICE AS LO_ORDTOTALPRICE, + l.LO_DISCOUNT AS LO_DISCOUNT, + l.LO_REVENUE AS LO_REVENUE, + l.LO_SUPPLYCOST AS LO_SUPPLYCOST, + l.LO_TAX AS LO_TAX, + l.LO_COMMITDATE AS LO_COMMITDATE, + l.LO_SHIPMODE AS LO_SHIPMODE, + c.C_NAME AS C_NAME, + c.C_ADDRESS AS C_ADDRESS, + c.C_CITY AS C_CITY, + c.C_NATION AS C_NATION, + c.C_REGION AS C_REGION, + c.C_PHONE AS C_PHONE, + c.C_MKTSEGMENT AS C_MKTSEGMENT, + s.S_NAME AS S_NAME, + s.S_ADDRESS AS S_ADDRESS, + s.S_CITY AS S_CITY, + s.S_NATION AS S_NATION, + s.S_REGION AS S_REGION, + s.S_PHONE AS S_PHONE, + p.P_NAME AS P_NAME, + p.P_MFGR AS P_MFGR, + p.P_CATEGORY AS P_CATEGORY, + p.P_BRAND AS P_BRAND, + p.P_COLOR AS P_COLOR, + p.P_TYPE AS P_TYPE, + p.P_SIZE AS P_SIZE, + p.P_CONTAINER AS P_CONTAINER +FROM lineorder AS l +INNER JOIN customer AS c ON c.C_CUSTKEY = l.LO_CUSTKEY +INNER JOIN supplier AS s ON s.S_SUPPKEY = l.LO_SUPPKEY +INNER JOIN part AS p ON p.P_PARTKEY = l.LO_PARTKEY; +``` + +Sorguları çalıştırma: + +Q1.1 + +``` sql +SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue +FROM lineorder_flat +WHERE toYear(LO_ORDERDATE) = 1993 AND LO_DISCOUNT BETWEEN 1 AND 3 AND LO_QUANTITY < 25; +``` + +Q1.2 + +``` sql +SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue +FROM lineorder_flat +WHERE toYYYYMM(LO_ORDERDATE) = 199401 AND LO_DISCOUNT BETWEEN 4 AND 6 AND LO_QUANTITY BETWEEN 26 AND 35; +``` + +Q1.3 + +``` sql +SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue +FROM lineorder_flat +WHERE toISOWeek(LO_ORDERDATE) = 6 AND toYear(LO_ORDERDATE) = 1994 + AND LO_DISCOUNT BETWEEN 5 AND 7 AND LO_QUANTITY BETWEEN 26 AND 35; +``` + +Q2.1 + +``` sql +SELECT + sum(LO_REVENUE), + toYear(LO_ORDERDATE) AS year, + P_BRAND +FROM lineorder_flat +WHERE P_CATEGORY = 'MFGR#12' AND S_REGION = 'AMERICA' +GROUP BY + year, + P_BRAND +ORDER BY + year, + P_BRAND; +``` + +Q2.2 + +``` sql +SELECT + sum(LO_REVENUE), + toYear(LO_ORDERDATE) AS year, + P_BRAND +FROM lineorder_flat +WHERE P_BRAND >= 'MFGR#2221' AND P_BRAND <= 'MFGR#2228' AND S_REGION = 'ASIA' +GROUP BY + year, + P_BRAND +ORDER BY + year, + P_BRAND; +``` + +Q2.3 + +``` sql +SELECT + sum(LO_REVENUE), + toYear(LO_ORDERDATE) AS year, + P_BRAND +FROM lineorder_flat +WHERE P_BRAND = 'MFGR#2239' AND S_REGION = 'EUROPE' +GROUP BY + year, + P_BRAND +ORDER BY + year, + P_BRAND; +``` + +Q3.1 + +``` sql +SELECT + C_NATION, + S_NATION, + toYear(LO_ORDERDATE) AS year, + sum(LO_REVENUE) AS revenue +FROM lineorder_flat +WHERE C_REGION = 'ASIA' AND S_REGION = 'ASIA' AND year >= 1992 AND year <= 1997 +GROUP BY + C_NATION, + S_NATION, + year +ORDER BY + year ASC, + revenue DESC; +``` + +Q3.2 + +``` sql +SELECT + C_CITY, + S_CITY, + toYear(LO_ORDERDATE) AS year, + sum(LO_REVENUE) AS revenue +FROM lineorder_flat +WHERE C_NATION = 'UNITED STATES' AND S_NATION = 'UNITED STATES' AND year >= 1992 AND year <= 1997 +GROUP BY + C_CITY, + S_CITY, + year +ORDER BY + year ASC, + revenue DESC; +``` + +Q3.3 + +``` sql +SELECT + C_CITY, + S_CITY, + toYear(LO_ORDERDATE) AS year, + sum(LO_REVENUE) AS revenue +FROM lineorder_flat +WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND year >= 1992 AND year <= 1997 +GROUP BY + C_CITY, + S_CITY, + year +ORDER BY + year ASC, + revenue DESC; +``` + +Q3.4 + +``` sql +SELECT + C_CITY, + S_CITY, + toYear(LO_ORDERDATE) AS year, + sum(LO_REVENUE) AS revenue +FROM lineorder_flat +WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND toYYYYMM(LO_ORDERDATE) = 199712 +GROUP BY + C_CITY, + S_CITY, + year +ORDER BY + year ASC, + revenue DESC; +``` + +Q4.1 + +``` sql +SELECT + toYear(LO_ORDERDATE) AS year, + C_NATION, + sum(LO_REVENUE - LO_SUPPLYCOST) AS profit +FROM lineorder_flat +WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') +GROUP BY + year, + C_NATION +ORDER BY + year ASC, + C_NATION ASC; +``` + +Q4.2 + +``` sql +SELECT + toYear(LO_ORDERDATE) AS year, + S_NATION, + P_CATEGORY, + sum(LO_REVENUE - LO_SUPPLYCOST) AS profit +FROM lineorder_flat +WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (year = 1997 OR year = 1998) AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') +GROUP BY + year, + S_NATION, + P_CATEGORY +ORDER BY + year ASC, + S_NATION ASC, + P_CATEGORY ASC; +``` + +Q4.3 + +``` sql +SELECT + toYear(LO_ORDERDATE) AS year, + S_CITY, + P_BRAND, + sum(LO_REVENUE - LO_SUPPLYCOST) AS profit +FROM lineorder_flat +WHERE S_NATION = 'UNITED STATES' AND (year = 1997 OR year = 1998) AND P_CATEGORY = 'MFGR#14' +GROUP BY + year, + S_CITY, + P_BRAND +ORDER BY + year ASC, + S_CITY ASC, + P_BRAND ASC; +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/star_schema/) diff --git a/docs/tr/getting_started/example_datasets/wikistat.md b/docs/tr/getting-started/example-datasets/wikistat.md similarity index 100% rename from docs/tr/getting_started/example_datasets/wikistat.md rename to docs/tr/getting-started/example-datasets/wikistat.md diff --git a/docs/tr/getting-started/index.md b/docs/tr/getting-started/index.md new file mode 100644 index 00000000000..c03665813ad --- /dev/null +++ b/docs/tr/getting-started/index.md @@ -0,0 +1,17 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "Ba\u015Flarken" +toc_hidden: true +toc_priority: 8 +toc_title: "gizlenmi\u015F" +--- + +# Başlarken {#getting-started} + +Eğer ClickHouse için yeni ve performans bir hands-on hissi almak istiyorsanız, her şeyden önce, sen [yükleme işlemi](install.md). Bundan sonra şunları yapabilirsiniz: + +- [Ayrıntılı öğretici geçmesi](tutorial.md) +- [Örnek veri kümeleri ile deneme](example-datasets/ontime.md) + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/tr/getting-started/install.md b/docs/tr/getting-started/install.md new file mode 100644 index 00000000000..2d02cb0b1b1 --- /dev/null +++ b/docs/tr/getting-started/install.md @@ -0,0 +1,191 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 11 +toc_title: Kurulum +--- + +# Kurulum {#installation} + +## Sistem Gereksinimleri {#system-requirements} + +ClickHouse, x86\_64, AArch64 veya PowerPC64LE CPU mimarisine sahip herhangi bir Linux, FreeBSD veya Mac OS X üzerinde çalışabilir. + +Resmi önceden oluşturulmuş ikili dosyalar genellikle x86\_64 ve kaldıraç sse 4.2 komut seti için derlenir, bu nedenle destekleyen CPU’nun aksi belirtilmedikçe ek bir sistem gereksinimi haline gelir. Geçerli CPU’nun sse 4.2 desteği olup olmadığını kontrol etmek için komut: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +SSE 4.2’yi desteklemeyen veya AArch64 veya PowerPC64LE mimarisine sahip işlemcilerde Clickhouse’u çalıştırmak için şunları yapmalısınız [kaynaklardan ClickHouse oluşturun](#from-sources) uygun yapılandırma ayarlamaları ile. + +## Mevcut Kurulum Seçenekleri {#available-installation-options} + +### DEB Paket Fromlerinden {#install-from-deb-packages} + +Resmi önceden derlenmiş kullanılması tavsiye edilir `deb` Debian veya Ubuntu için paketler. + +Resmi paketleri yüklemek için Yandex deposunu ekleyin `/etc/apt/sources.list` veya ayrı bir `/etc/apt/sources.list.d/clickhouse.list` Dosya: + + deb https://repo.clickhouse.tech/deb/stable/ main/ + +En son sürümü kullanmak istiyorsanız, değiştirin `stable` ile `testing` (bu, test ortamlarınız için önerilir). + +Sonra paketleri yüklemek için bu komutları çalıştırın: + +``` bash +sudo apt-get install apt-transport-https ca-certificates dirmngr # optional +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional +sudo apt-get update +sudo apt-get install clickhouse-client clickhouse-server +``` + +Paketleri buradan manuel olarak indirebilir ve kurabilirsiniz: https://repo.yandex.ru/clickhouse/deb/stable/main/. + +#### Paketler {#packages} + +- `clickhouse-common-static` — Installs ClickHouse compiled binary files. +- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` ve varsayılan sunucu yapılandırmasını yükler. +- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` ve diğer istemci ile ilgili araçlar. ve istemci yapılandırma dosyalarını yükler. +- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. + +### RPM Paket Fromlerinden {#from-rpm-packages} + +Resmi önceden derlenmiş kullanılması tavsiye edilir `rpm` CentOS, RedHat ve diğer tüm rpm tabanlı Linux dağıtımları için paketler. + +İlk olarak, resmi depoyu eklemeniz gerekir: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 +``` + +En son sürümü kullanmak istiyorsanız, değiştirin `stable` ile `testing` (bu, test ortamlarınız için önerilir). Bu `prestable` etiket de bazen kullanılabilir. + +Sonra paketleri yüklemek için bu komutları çalıştırın: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +Paketleri buradan manuel olarak indirebilir ve kurabilirsiniz: https://repo.clickhouse.teknoloji / rpm / kararlı / x86\_64. + +### Tgz Arşivlerinden {#from-tgz-archives} + +Resmi önceden derlenmiş kullanılması tavsiye edilir `tgz` Arch ,iv ,es for tüm Linux dağıtım installationları, kurulumu `deb` veya `rpm` paketler mümkün değildir. + +Gerekli sürümü ile indirilebilir `curl` veya `wget` depo fromdan https://repo.yandex.ru/clickhouse/tgz/. +Bundan sonra indirilen arşivler açılmalı ve kurulum komut dosyaları ile kurulmalıdır. En son sürüm için örnek: + +``` bash +export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz +curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz + +tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz +sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz +sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh + +tar -xzvf clickhouse-server-$LATEST_VERSION.tgz +sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh +sudo /etc/init.d/clickhouse-server start + +tar -xzvf clickhouse-client-$LATEST_VERSION.tgz +sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh +``` + +Üretim ortamları için en son teknolojiyi kullanmanız önerilir `stable`-sürüm. Numarasını GitHub sayfasında bulabilirsiniz https://github.com/ClickHouse/ClickHouse/tags postfix ile `-stable`. + +### Docker Görüntüden {#from-docker-image} + +Docker içinde ClickHouse çalıştırmak için kılavuzu izleyin [Docker Hub](https://hub.docker.com/r/yandex/clickhouse-server/). Bu görüntüler resmi `deb` paketler içinde. + +### Kaynaklardan {#from-sources} + +Clickhouse’u el ile derlemek için aşağıdaki talimatları izleyin [Linux](../development/build.md) veya [Mac OS X](../development/build-osx.md). + +Paketleri derleyebilir ve yükleyebilir veya paketleri yüklemeden programları kullanabilirsiniz. Ayrıca elle inşa ederek SSE 4.2 gereksinimini devre dışı bırakabilir veya AArch64 CPU’lar için oluşturabilirsiniz. + + Client: programs/clickhouse-client + Server: programs/clickhouse-server + +Bir veri ve meta veri klasörleri oluşturmanız gerekir ve `chown` onları istenen kullanıcı için. Yolları sunucu yapılandırmasında değiştirilebilir (src / programlar / sunucu / config.xml), varsayılan olarak: + + /opt/clickhouse/data/default/ + /opt/clickhouse/metadata/default/ + +Gentoo üzerinde, sadece kullanabilirsiniz `emerge clickhouse` Clickhouse’u kaynaklardan yüklemek için. + +## Başlamak {#launch} + +Sunucuyu bir daemon olarak başlatmak için çalıştırın: + +``` bash +$ sudo service clickhouse-server start +``` + +Yok eğer `service` command, run as + +``` bash +$ sudo /etc/init.d/clickhouse-server start +``` + +Günlükleri görmek `/var/log/clickhouse-server/` dizin. + +Sunucu başlatılmazsa, dosyadaki yapılandırmaları kontrol edin `/etc/clickhouse-server/config.xml`. + +Ayrıca sunucuyu konsoldan manuel olarak başlatabilirsiniz: + +``` bash +$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +Bu durumda, günlük geliştirme sırasında uygun olan konsola yazdırılacaktır. +Yapılandırma dosyası geçerli dizinde ise, `--config-file` parametre. Varsayılan olarak, kullanır `./config.xml`. + +ClickHouse erişim kısıtlama ayarlarını destekler. Bulun theurlar. `users.xml` dosya (yanındaki `config.xml`). +Varsayılan olarak, erişim için herhangi bir yerden izin verilir `default` Kullanıcı, şifre olmadan. Görmek `user/default/networks`. +Daha fazla bilgi için bölüme bakın [“Configuration Files”](../operations/configuration-files.md). + +Sunucuyu başlattıktan sonra, ona bağlanmak için komut satırı istemcisini kullanabilirsiniz: + +``` bash +$ clickhouse-client +``` + +Varsayılan olarak, bağlanır `localhost:9000` kullanıcı adına `default` şifre olmadan. Kullanarak uzak bir sunucuya bağlanmak için de kullanılabilir `--host` değişken. + +Terminal UTF-8 kodlamasını kullanmalıdır. +Daha fazla bilgi için bölüme bakın [“Command-line client”](../interfaces/cli.md). + +Örnek: + +``` bash +$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**Tebrikler, sistem çalışıyor!** + +Denemeye devam etmek için, test veri kümelerinden birini indirebilir veya şunları yapabilirsiniz [öğretici](https://clickhouse.tech/tutorial.html). + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/tr/getting-started/playground.md b/docs/tr/getting-started/playground.md new file mode 100644 index 00000000000..f1eabbb5e86 --- /dev/null +++ b/docs/tr/getting-started/playground.md @@ -0,0 +1,48 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 14 +toc_title: "Bah\xE7e" +--- + +# ClickHouse Oyun Alanı {#clickhouse-playground} + +[ClickHouse Oyun Alanı](https://play.clickhouse.tech?file=welcome) kullanıcıların kendi sunucu veya küme kurmadan, anında sorguları çalıştırarak ClickHouse ile deneme sağlar. +Oyun alanında çeşitli örnek veri kümelerinin yanı sıra ClickHouse özelliklerini gösteren örnek sorgular da mevcuttur. + +Sorgular salt okunur bir kullanıcı olarak yürütülür. Bazı sınırlamaları ima eder: + +- DDL sorgularına İzin Verilmiyor +- Sorgu Ekle izin verilmez + +Aşağıdaki ayarlar da uygulanır: +- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) +- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) +- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) +- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) + +ClickHouse oyun alanı m2 deneyimini sunar.küçükler +[ClickHouse için yönetilen hizmet](https://cloud.yandex.com/services/managed-clickhouse) +örnek host hosteded in [Üye.Bulut](https://cloud.yandex.com/). +Hakkında daha fazla bilgi [bulut sağlayıcıları](../commercial/cloud.md). + +ClickHouse Playground web arayüzü clickhouse üzerinden istekleri yapar [HTTP API](../interfaces/http.md). +Bahçesi arka uç herhangi bir ek sunucu tarafı uygulaması olmadan sadece bir ClickHouse kümesidir. +ClickHouse HTTPS bitiş noktası da oyun alanının bir parçası olarak kullanılabilir. + +Herhangi bir HTTP istemcisi kullanarak oyun alanına sorgu yapabilirsiniz, örneğin [kıvrılma](https://curl.haxx.se) veya [wget](https://www.gnu.org/software/wget/), veya kullanarak bir bağlantı kurmak [JDBC](../interfaces/jdbc.md) veya [ODBC](../interfaces/odbc.md) sürücüler. +Clickhouse’u destekleyen yazılım ürünleri hakkında daha fazla bilgi mevcuttur [burada](../interfaces/index.md). + +| Parametre | Değer | +|:----------|:----------------------------------------| +| Nokta | https://play-api.clickhouse.teknik:8443 | +| Kullanan | `playground` | +| Şifre | `clickhouse` | + +Bu bitiş noktasının güvenli bir bağlantı gerektirdiğini unutmayın. + +Örnek: + +``` bash +curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" +``` diff --git a/docs/tr/getting-started/tutorial.md b/docs/tr/getting-started/tutorial.md new file mode 100644 index 00000000000..2c65f29268b --- /dev/null +++ b/docs/tr/getting-started/tutorial.md @@ -0,0 +1,671 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 12 +toc_title: "\xD6\u011Fretici" +--- + +# ClickHouse Eğitimi {#clickhouse-tutorial} + +## Bu Öğreticiden Ne Beklenir? {#what-to-expect-from-this-tutorial} + +Bu öğreticiden geçerek, basit bir ClickHouse kümesinin nasıl kurulacağını öğreneceksiniz. Küçük ama hataya dayanıklı ve ölçeklenebilir olacak. Ardından, verilerle doldurmak ve bazı demo sorguları yürütmek için örnek veri kümelerinden birini kullanacağız. + +## Tek Düğüm Kurulumu {#single-node-setup} + +Dağıtılmış bir ortamın karmaşıklığını ertelemek için, Clickhouse’u tek bir sunucu veya sanal makinede dağıtmaya başlayacağız. ClickHouse genellikle [deb](index.md#install-from-deb-packages) veya [rpm](index.md#from-rpm-packages) paketler, ama var [alternatifler](index.md#from-docker-image) onları desteklemeyen işletim sistemleri için. + +Örneğin, seçtiğiniz `deb` paketler ve yürütülen: + +``` bash +sudo apt-get install apt-transport-https ca-certificates dirmngr +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 + +echo "deb https://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list +sudo apt-get update + +sudo apt-get install -y clickhouse-server clickhouse-client +``` + +Yüklü olan paketlerde ne var: + +- `clickhouse-client` paket içerir [clickhouse-müşteri](../interfaces/cli.md) uygulama, interaktif ClickHouse konsol istemcisi. +- `clickhouse-common` paket clickhouse yürütülebilir dosya içerir. +- `clickhouse-server` paket bir sunucu olarak ClickHouse çalıştırmak için yapılandırma dosyalarını içerir. + +Sunucu yapılandırma dosyaları bulunur `/etc/clickhouse-server/`. Daha fazla gitmeden önce, fark lütfen `` element in `config.xml`. Path, veri depolama için konumu belirler, bu nedenle büyük disk kapasitesine sahip birimde bulunmalıdır; varsayılan değer `/var/lib/clickhouse/`. Yapılandırmayı ayarlamak istiyorsanız, doğrudan düzenlemek kullanışlı değildir `config.xml` dosya, gelecekteki paket güncellemelerinde yeniden yazılabileceğini düşünüyor. Yapılandırma öğelerini geçersiz kılmak için önerilen yol oluşturmaktır [config dosyaları.d dizin](../operations/configuration-files.md) hizmet olarak “patches” config için.xml. + +Fark etmiş olabileceğiniz gibi, `clickhouse-server` paket kurulumdan sonra otomatik olarak başlatılmaz. Güncellemelerden sonra otomatik olarak yeniden başlatılmaz. Sunucuyu başlatma şekliniz init sisteminize bağlıdır, genellikle: + +``` bash +sudo service clickhouse-server start +``` + +veya + +``` bash +sudo /etc/init.d/clickhouse-server start +``` + +Sunucu günlükleri için varsayılan konum `/var/log/clickhouse-server/`. Sunucu, oturum açtıktan sonra istemci bağlantılarını işlemeye hazırdır. `Ready for connections` ileti. + +Bir kez `clickhouse-server` yukarı ve çalışıyor, biz kullanabilirsiniz `clickhouse-client` sunucuya bağlanmak ve aşağıdaki gibi bazı test sorguları çalıştırmak için `SELECT "Hello, world!";`. + +
+ +Clickhouse-client için hızlı ipuçları +İnteraktif mod: + +``` bash +clickhouse-client +clickhouse-client --host=... --port=... --user=... --password=... +``` + +Çok satırlı sorguları etkinleştirme: + +``` bash +clickhouse-client -m +clickhouse-client --multiline +``` + +Toplu iş modunda sorguları çalıştırma: + +``` bash +clickhouse-client --query='SELECT 1' +echo 'SELECT 1' | clickhouse-client +clickhouse-client <<< 'SELECT 1' +``` + +Belirtilen biçimde bir dosyadan veri ekleme: + +``` bash +clickhouse-client --query='INSERT INTO table VALUES' < data.txt +clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv +``` + +
+ +## Örnek Veri Kümesini İçe Aktar {#import-sample-dataset} + +Şimdi ClickHouse sunucumuzu bazı örnek verilerle doldurmanın zamanı geldi. Bu eğitimde, yandex’in anonim verilerini kullanacağız.Metrica, açık kaynak olmadan önce Clickhouse’u üretim yolunda çalıştıran ilk hizmet (daha fazlası [tarih bölümü](../introduction/history.md)). Var [Yandex’i içe aktarmanın birden fazla yolu.Metrica veri kümesi](example-datasets/metrica.md) ve öğretici uğruna, en gerçekçi olanı ile gideceğiz. + +### Tablo Verilerini Indirin Ve ayıklayın {#download-and-extract-table-data} + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +``` + +Çıkarılan dosyalar yaklaşık 10GB boyutundadır. + +### Tablo Oluşturma {#create-tables} + +Çoğu veritabanı yönetim sisteminde olduğu gibi, ClickHouse tabloları mantıksal olarak gruplar “databases”. Bir `default` veritabanı, ancak adında yeni bir tane oluşturacağız `tutorial`: + +``` bash +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" +``` + +Tablolar oluşturmak için sözdizimi veritabanlarına kıyasla çok daha karmaşıktır (bkz. [başvurma](../sql-reference/statements/create.md). Genelde `CREATE TABLE` deyimi üç önemli şeyi belirtmek zorundadır: + +1. Oluşturulacak tablonun adı. +2. Table schema, i.e. list of columns and their [veri türleri](../sql-reference/data-types/index.md). +3. [Masa motoru](../engines/table-engines/index.md) ve bu tabloya yapılan sorguların fiziksel olarak nasıl yürütüleceği ile ilgili tüm ayrıntıları belirleyen ayarları. + +Üye.Metrica bir web analitiği hizmetidir ve örnek veri kümesi tam işlevselliğini kapsamaz, bu nedenle oluşturmak için sadece iki tablo vardır: + +- `hits` hizmet kapsamındaki tüm web sitelerinde tüm kullanıcılar tarafından yapılan her eylem ile bir tablodur. +- `visits` bireysel eylemler yerine önceden oluşturulmuş oturumlar içeren bir tablodur. + +Bu tablolar için gerçek create table sorgularını görelim ve yürütelim: + +``` sql +CREATE TABLE tutorial.hits_v1 +( + `WatchID` UInt64, + `JavaEnable` UInt8, + `Title` String, + `GoodEvent` Int16, + `EventTime` DateTime, + `EventDate` Date, + `CounterID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RegionID` UInt32, + `UserID` UInt64, + `CounterClass` Int8, + `OS` UInt8, + `UserAgent` UInt8, + `URL` String, + `Referer` String, + `URLDomain` String, + `RefererDomain` String, + `Refresh` UInt8, + `IsRobot` UInt8, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `FlashMinor2` String, + `NetMajor` UInt8, + `NetMinor` UInt8, + `UserAgentMajor` UInt16, + `UserAgentMinor` FixedString(2), + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `MobilePhone` UInt8, + `MobilePhoneModel` String, + `Params` String, + `IPNetworkID` UInt32, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `IsArtifical` UInt8, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `ClientTimeZone` Int16, + `ClientEventTime` DateTime, + `SilverlightVersion1` UInt8, + `SilverlightVersion2` UInt8, + `SilverlightVersion3` UInt32, + `SilverlightVersion4` UInt16, + `PageCharset` String, + `CodeVersion` UInt32, + `IsLink` UInt8, + `IsDownload` UInt8, + `IsNotBounce` UInt8, + `FUniqID` UInt64, + `HID` UInt32, + `IsOldCounter` UInt8, + `IsEvent` UInt8, + `IsParameter` UInt8, + `DontCountHits` UInt8, + `WithHash` UInt8, + `HitColor` FixedString(1), + `UTCEventTime` DateTime, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `WindowName` Int32, + `OpenerName` Int32, + `HistoryLength` Int16, + `BrowserLanguage` FixedString(2), + `BrowserCountry` FixedString(2), + `SocialNetwork` String, + `SocialAction` String, + `HTTPError` UInt16, + `SendTiming` Int32, + `DNSTiming` Int32, + `ConnectTiming` Int32, + `ResponseStartTiming` Int32, + `ResponseEndTiming` Int32, + `FetchTiming` Int32, + `RedirectTiming` Int32, + `DOMInteractiveTiming` Int32, + `DOMContentLoadedTiming` Int32, + `DOMCompleteTiming` Int32, + `LoadEventStartTiming` Int32, + `LoadEventEndTiming` Int32, + `NSToDOMContentLoadedTiming` Int32, + `FirstPaintTiming` Int32, + `RedirectCount` Int8, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `ParamPrice` Int64, + `ParamOrderID` String, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `GoalsReached` Array(UInt32), + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `RefererHash` UInt64, + `URLHash` UInt64, + `CLID` UInt32, + `YCLID` UInt64, + `ShareService` String, + `ShareURL` String, + `ShareTitle` String, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `IslandID` FixedString(16), + `RequestNum` UInt32, + `RequestTry` UInt8 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +``` sql +CREATE TABLE tutorial.visits_v1 +( + `CounterID` UInt32, + `StartDate` Date, + `Sign` Int8, + `IsNew` UInt8, + `VisitID` UInt64, + `UserID` UInt64, + `StartTime` DateTime, + `Duration` UInt32, + `UTCStartTime` DateTime, + `PageViews` Int32, + `Hits` Int32, + `IsBounce` UInt8, + `Referer` String, + `StartURL` String, + `RefererDomain` String, + `StartURLDomain` String, + `EndURL` String, + `LinkURL` String, + `IsDownload` UInt8, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `PlaceID` Int32, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `IsYandex` UInt8, + `GoalReachesDepth` Int32, + `GoalReachesURL` Int32, + `GoalReachesAny` Int32, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `MobilePhoneModel` String, + `ClientEventTime` DateTime, + `RegionID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `IPNetworkID` UInt32, + `SilverlightVersion3` UInt32, + `CodeVersion` UInt32, + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `UserAgentMajor` UInt16, + `UserAgentMinor` UInt16, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `SilverlightVersion2` UInt8, + `SilverlightVersion4` UInt16, + `FlashVersion3` UInt16, + `FlashVersion4` UInt16, + `ClientTimeZone` Int16, + `OS` UInt8, + `UserAgent` UInt8, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `NetMajor` UInt8, + `NetMinor` UInt8, + `MobilePhone` UInt8, + `SilverlightVersion1` UInt8, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `JavaEnable` UInt8, + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `BrowserLanguage` UInt16, + `BrowserCountry` UInt16, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `Params` Array(String), + `Goals` Nested( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32), + `WatchIDs` Array(UInt64), + `ParamSumPrice` Int64, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `ClickLogID` UInt64, + `ClickEventID` Int32, + `ClickGoodEvent` Int32, + `ClickEventTime` DateTime, + `ClickPriorityID` Int32, + `ClickPhraseID` Int32, + `ClickPageID` Int32, + `ClickPlaceID` Int32, + `ClickTypeID` Int32, + `ClickResourceID` Int32, + `ClickCost` UInt32, + `ClickClientIP` UInt32, + `ClickDomainID` UInt32, + `ClickURL` String, + `ClickAttempt` UInt8, + `ClickOrderID` UInt32, + `ClickBannerID` UInt32, + `ClickMarketCategoryID` UInt32, + `ClickMarketPP` UInt32, + `ClickMarketCategoryName` String, + `ClickMarketPPName` String, + `ClickAWAPSCampaignName` String, + `ClickPageName` String, + `ClickTargetType` UInt16, + `ClickTargetPhraseID` UInt64, + `ClickContextType` UInt8, + `ClickSelectType` Int8, + `ClickOptions` String, + `ClickGroupBannerID` Int32, + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `FirstVisit` DateTime, + `PredLastVisit` Date, + `LastVisit` Date, + `TotalVisits` UInt32, + `TraficSource` Nested( + ID Int8, + SearchEngineID UInt16, + AdvEngineID UInt8, + PlaceID UInt16, + SocialSourceNetworkID UInt8, + Domain String, + SearchPhrase String, + SocialSourcePage String), + `Attendance` FixedString(16), + `CLID` UInt32, + `YCLID` UInt64, + `NormalizedRefererHash` UInt64, + `SearchPhraseHash` UInt64, + `RefererDomainHash` UInt64, + `NormalizedStartURLHash` UInt64, + `StartURLDomainHash` UInt64, + `NormalizedEndURLHash` UInt64, + `TopLevelDomain` UInt64, + `URLScheme` UInt64, + `OpenstatServiceNameHash` UInt64, + `OpenstatCampaignIDHash` UInt64, + `OpenstatAdIDHash` UInt64, + `OpenstatSourceIDHash` UInt64, + `UTMSourceHash` UInt64, + `UTMMediumHash` UInt64, + `UTMCampaignHash` UInt64, + `UTMContentHash` UInt64, + `UTMTermHash` UInt64, + `FromHash` UInt64, + `WebVisorEnabled` UInt8, + `WebVisorActivity` UInt32, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `Market` Nested( + Type UInt8, + GoalID UInt32, + OrderID String, + OrderPrice Int64, + PP UInt32, + DirectPlaceID UInt32, + DirectOrderID UInt32, + DirectBannerID UInt32, + GoodID String, + GoodName String, + GoodQuantity Int32, + GoodPrice Int64), + `IslandID` FixedString(16) +) +ENGINE = CollapsingMergeTree(Sign) +PARTITION BY toYYYYMM(StartDate) +ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +Etkileşimli modunu kullanarak bu sorguları yürütebilirsiniz `clickhouse-client` (sadece önceden bir sorgu belirtmeden bir terminalde başlatın) veya bazı deneyin [alternatif arayüz](../interfaces/index.md) Eğer isterseniz. + +Gördüğümüz gibi, `hits_v1` kullanır [temel MergeTree motoru](../engines/table-engines/mergetree-family/mergetree.md), WH whileile the `visits_v1` kullanır [Çökme](../engines/table-engines/mergetree-family/collapsingmergetree.md) varyant. + +### Verileri İçe Aktar {#import-data} + +Clickhouse’a veri aktarımı yapılır [INSERT INTO](../sql-reference/statements/insert-into.md) diğer birçok SQL veritabanlarında olduğu gibi sorgu. Bununla birlikte, veriler genellikle [desteklenen seri hale getirme biçimleri](../interfaces/formats.md) yerine `VALUES` fıkra clausesı (ayrıca desteklenmektedir). + +Onları almak için ne kadar daha önce indirdiğimiz dosyaları sekme ayrılmış biçimde, yani burada konsol istemci ile : + +``` bash +clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv +clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv +``` + +ClickHouse bir yeri vardır [ayarlan settingsacak ayarlar](../operations/settings/index.md) ve bunları konsol istemcisinde belirtmenin bir yolu, görebildiğimiz gibi argümanlar aracılığıyla `--max_insert_block_size`. Hangi ayarların mevcut olduğunu, ne anlama geldiğini ve varsayılanların ne olduğunu anlamanın en kolay yolu `system.settings` Tablo: + +``` sql +SELECT name, value, changed, description +FROM system.settings +WHERE name LIKE '%max_insert_b%' +FORMAT TSV + +max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." +``` + +İsteğe bağlı olarak şunları yapabilirsiniz [OPTIMIZE](../sql-reference/statements/misc.md#misc_operations-optimize) ithalattan sonra tablolar. MergeTree-family’den bir motorla yapılandırılmış tablolar, veri depolamayı en iyi duruma getirmek (veya en azından mantıklı olup olmadığını kontrol etmek) için her zaman arka planda veri parçalarının birleştirilmesini sağlar. Bu sorgular, tablo motorunu bir süre sonra yerine şu anda depolama optimizasyonu yapmaya zorlar: + +``` bash +clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" +clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" +``` + +Bu sorgular bir G/Ç ve CPU yoğun işlem başlatır, bu nedenle tablo sürekli olarak yeni veriler alırsa, onu yalnız bırakmak ve birleştirmelerin arka planda çalışmasına izin vermek daha iyidir. + +Şimdi tablo ithalatının başarılı olup olmadığını kontrol edebiliriz: + +``` bash +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" +``` + +## Örnek Sorgular {#example-queries} + +``` sql +SELECT + StartURL AS URL, + AVG(Duration) AS AvgDuration +FROM tutorial.visits_v1 +WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' +GROUP BY URL +ORDER BY AvgDuration DESC +LIMIT 10 +``` + +``` sql +SELECT + sum(Sign) AS visits, + sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, + (100. * goal_visits) / visits AS goal_percent +FROM tutorial.visits_v1 +WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') +``` + +## Küme Dağıtımı {#cluster-deployment} + +ClickHouse kümesi homojen bir kümedir. Kurulum adımları: + +1. Kümenin tüm makinelerine ClickHouse Server’ı yükleyin +2. Yapılandırma dosyalarında küme yapılandırmalarını ayarlama +3. Her örnekte yerel tablolar oluşturun +4. Create a [Dağıtılmış tablo](../engines/table-engines/special/distributed.md) + +[Dağıtılmış tablo](../engines/table-engines/special/distributed.md) aslında bir tür “view” ClickHouse kümesinin yerel tablolarına. Dağıtılmış bir tablodan sorgu seçin, tüm kümenin parçalarının kaynaklarını kullanarak yürütür. Birden çok küme için yapılandırmalar belirtebilir ve farklı kümelere görünümler sağlayan birden çok dağıtılmış tablo oluşturabilirsiniz. + +Her biri bir kopya olan üç parçalı bir küme için örnek yapılandırma: + +``` xml + + + + + example-perftest01j.yandex.ru + 9000 + + + + + example-perftest02j.yandex.ru + 9000 + + + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +Daha fazla gösteri için, aynı ile yeni bir yerel tablo oluşturalım `CREATE TABLE` için kullandığımız sorgu `hits_v1` ama farklı bir tablo adı: + +``` sql +CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... +``` + +Kümenin yerel tablolarına bir görünüm sağlayan dağıtılmış bir tablo oluşturma: + +``` sql +CREATE TABLE tutorial.hits_all AS tutorial.hits_local +ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); +``` + +Yaygın bir uygulama, kümenin tüm makinelerinde benzer dağıtılmış tablolar oluşturmaktır. Kümenin herhangi bir makinesinde dağıtılmış sorguları çalıştırmaya izin verir. Ayrıca, belirli bir SELECT sorgusu için geçici dağıtılmış tablo oluşturmak için alternatif bir seçenek vardır [uzak](../sql-reference/table-functions/remote.md) tablo işlevi. + +Hadi koşalım [INSERT SELECT](../sql-reference/statements/insert-into.md) tabloyu birden çok sunucuya yaymak için dağıtılmış tabloya. + +``` sql +INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; +``` + +!!! warning "Bildirim" + Bu yaklaşım büyük tabloların parçalanması için uygun değildir. Ayrı bir araç var [clickhouse-fotokopi makinesi](../operations/utilities/clickhouse-copier.md) bu keyfi büyük tabloları yeniden parçalayabilir. + +Tahmin edebileceğiniz gibi, hesaplamalı olarak ağır sorgular, bir yerine 3 sunucu kullanıyorsa n kat daha hızlı çalışır. + +Bu durumda, 3 parçaya sahip bir küme kullandık ve her biri tek bir kopya içeriyor. + +Bir üretim ortamında esneklik sağlamak için, her bir parçanın birden çok kullanılabilirlik bölgesi veya veri merkezleri (veya en azından raflar) arasında yayılmış 2-3 kopya içermesi önerilir. ClickHouse yinelemeler sınırsız sayıda desteklediğini unutmayın. + +Üç yineleme içeren bir parça kümesi için örnek yapılandırma: + +``` xml + + ... + + + + example-perftest01j.yandex.ru + 9000 + + + example-perftest02j.yandex.ru + 9000 + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +Yerel çoğaltmayı etkinleştirmek için [ZooKeeper](http://zookeeper.apache.org/) gereklidir. ClickHouse tüm yinelemeler üzerinde veri tutarlılığı ilgilenir ve otomatik olarak hatadan sonra prosedürü geri çalışır. ZooKeeper kümesinin ayrı sunuculara dağıtılması önerilir(ClickHouse dahil başka hiçbir işlem çalışmaz). + +!!! note "Not" + ZooKeeper sıkı bir gereklilik değildir: bazı basit durumlarda, verileri uygulama kodunuzdan tüm kopyalara yazarak çoğaltabilirsiniz. Bu yaklaşım **değil** önerilen, bu durumda, ClickHouse tüm yinelemelerde veri tutarlılığını garanti edemez. Böylece başvurunuzun sorumluluğu haline gelir. + +Zookeeper konumları yapılandırma dosyasında belirtilir: + +``` xml + + + zoo01.yandex.ru + 2181 + + + zoo02.yandex.ru + 2181 + + + zoo03.yandex.ru + 2181 + + +``` + +Ayrıca, tablo oluşturulmasında kullanılan her bir parça ve kopyayı tanımlamak için makrolar ayarlamamız gerekir: + +``` xml + + 01 + 01 + +``` + +Yinelenmiş tablo oluşturma şu anda hiçbir yinelemeler varsa, yeni bir ilk yineleme örneği. Zaten canlı yinelemeler varsa, yeni yineleme varolan verileri klonlar. Önce tüm çoğaltılmış tablolar oluşturmak ve sonra veri eklemek için bir seçeneğiniz vardır. Başka bir seçenek, bazı yinelemeler oluşturmak ve veri ekleme sırasında veya sonrasında diğerlerini eklemektir. + +``` sql +CREATE TABLE tutorial.hits_replica (...) +ENGINE = ReplcatedMergeTree( + '/clickhouse_perftest/tables/{shard}/hits', + '{replica}' +) +... +``` + +Burada kullanıyoruz [ReplicatedMergeTree](../engines/table-engines/mergetree-family/replication.md) masa motoru. Parametrelerde, Shard ve çoğaltma tanımlayıcılarını içeren ZooKeeper yolunu belirtiyoruz. + +``` sql +INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; +``` + +Çoğaltma çok ana modda çalışır. Veriler herhangi bir kopyaya yüklenebilir ve sistem daha sonra otomatik olarak diğer örneklerle eşitler. Çoğaltma zaman uyumsuz olduğundan, belirli bir anda, tüm yinelemeler son eklenen verileri içerebilir. Veri alımına izin vermek için en az bir kopya olmalıdır. Diğerleri verileri senkronize eder ve tekrar aktif hale geldiklerinde tutarlılığı onarır. Bu yaklaşımın, yakın zamanda eklenen veri kaybı olasılığının düşük olmasına izin verdiğini unutmayın. + +[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/tr/getting_started/example_datasets/criteo.md b/docs/tr/getting_started/example_datasets/criteo.md deleted file mode 100644 index 37cb2d2b0e6..00000000000 --- a/docs/tr/getting_started/example_datasets/criteo.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 19 -toc_title: "Criteo'dan Terabyte t\u0131klama g\xFCnl\xFCkleri" ---- - -# Criteo'dan tıklama günlüklerinin terabayt {#terabyte-of-click-logs-from-criteo} - -Verileri indirin http://labs.criteo.com/downloads/download-terabyte-click-logs/ - -Günlük almak için bir tablo oluşturun: - -``` sql -CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log -``` - -Verileri indirin: - -``` bash -$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done -``` - -Dönüştürülen veriler için bir tablo oluşturma: - -``` sql -CREATE TABLE criteo -( - date Date, - clicked UInt8, - int1 Int32, - int2 Int32, - int3 Int32, - int4 Int32, - int5 Int32, - int6 Int32, - int7 Int32, - int8 Int32, - int9 Int32, - int10 Int32, - int11 Int32, - int12 Int32, - int13 Int32, - icat1 UInt32, - icat2 UInt32, - icat3 UInt32, - icat4 UInt32, - icat5 UInt32, - icat6 UInt32, - icat7 UInt32, - icat8 UInt32, - icat9 UInt32, - icat10 UInt32, - icat11 UInt32, - icat12 UInt32, - icat13 UInt32, - icat14 UInt32, - icat15 UInt32, - icat16 UInt32, - icat17 UInt32, - icat18 UInt32, - icat19 UInt32, - icat20 UInt32, - icat21 UInt32, - icat22 UInt32, - icat23 UInt32, - icat24 UInt32, - icat25 UInt32, - icat26 UInt32 -) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) -``` - -Verileri ham günlüğünden dönüştürün ve ikinci tabloya koyun: - -``` sql -INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; - -DROP TABLE criteo_log; -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/tr/getting_started/example_datasets/index.md b/docs/tr/getting_started/example_datasets/index.md deleted file mode 100644 index fecb39f219f..00000000000 --- a/docs/tr/getting_started/example_datasets/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "\xD6rnek Veri K\xFCmeleri" -toc_priority: 12 -toc_title: "Giri\u015F" ---- - -# Örnek Veri Kümeleri {#example-datasets} - -Bu bölümde, örnek veri kümelerinin nasıl elde edileceği ve bunları Clickhouse'a nasıl içe aktarılacağı açıklanmaktadır. -Bazı veri kümeleri için örnek sorgular da mevcuttur. - -- [Anonim Yandex.Metrica Veri Kümesi](metrica.md) -- [Yıldız Şema Ben Benchmarkch Benchmarkmark](star_schema.md) -- [WikiStat](wikistat.md) -- [Criteo'dan tıklama günlüklerinin terabayt](criteo.md) -- [AMPLab Büyük Veri Benchmark](amplab_benchmark.md) -- [New York Taksi Verileri](nyc_taxi.md) -- [OnTime](ontime.md) - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/tr/getting_started/example_datasets/metrica.md b/docs/tr/getting_started/example_datasets/metrica.md deleted file mode 100644 index a9d3d6743ee..00000000000 --- a/docs/tr/getting_started/example_datasets/metrica.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 21 -toc_title: "\xDCye.Metrica Verileri" ---- - -# Anonim Yandex.Metrica Verileri {#anonymized-yandex-metrica-data} - -Veri kümesi, isabetlerle ilgili anonimleştirilmiş verileri içeren iki tablodan oluşur (`hits_v1`) ve ziyaret visitsler (`visits_v1`(kayıt olmak için).Metrica. Yandex hakkında daha fazla bilgi edinebilirsiniz.Metrica içinde [ClickHouse geçmişi](../../introduction/history.md) bölme. - -Veri kümesi iki tablodan oluşur, bunlardan biri sıkıştırılmış olarak indirilebilir `tsv.xz` dosya veya hazırlanmış bölümler olarak. Buna ek olarak, genişletilmiş bir sürümü `hits` 100 milyon satır içeren tablo TSV olarak mevcuttur https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz ve hazırlanan bölümler olarak https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. - -## Hazırlanan bölümlerden tablolar elde etme {#obtaining-tables-from-prepared-partitions} - -İndirme ve ithalat tablo hits: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar -tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -İndirme ve ithalat ziyaretleri: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar -tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Sıkıştırılmış TSV dosyasından Tablo alma {#obtaining-tables-from-compressed-tsv-file} - -Sıkıştırılmış TSV dosyasından indir ve İçe Aktar: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -Sıkıştırılmış tsv dosyasından ziyaretleri indirin ve içe aktarın: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## Örnek Sorgular {#example-queries} - -[ClickHouse eğitimi](../../getting_started/tutorial.md) Yandex dayanmaktadır.Metrica veri kümesi ve bu veri kümesine başlamak için önerilen yol sadece öğreticiden geçmektir. - -Bu tablolara ek sorgu örnekleri arasında bulunabilir [durum bilgisi testleri](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) ClickHouse of (onlar adlandırılır `test.hists` ve `test.visits` oralarda). diff --git a/docs/tr/getting_started/example_datasets/nyc_taxi.md b/docs/tr/getting_started/example_datasets/nyc_taxi.md deleted file mode 100644 index 218a7f06f7a..00000000000 --- a/docs/tr/getting_started/example_datasets/nyc_taxi.md +++ /dev/null @@ -1,390 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 16 -toc_title: New York Taksi Verileri ---- - -# New York Taksi Verileri {#new-york-taxi-data} - -Bu veri kümesi iki şekilde elde edilebilir: - -- ham verilerden içe aktarma -- hazırlanan bölüm downloadlerin indir downloadilmesi - -## Ham veri nasıl alınır {#how-to-import-the-raw-data} - -Bkz. https://github.com/toddwschneider/nyc-taxi-data ve http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html bir veri kümesinin açıklaması ve indirme talimatları için. - -İndirme, CSV dosyalarında yaklaşık 227 GB sıkıştırılmamış veri ile sonuçlanacaktır. İndirme, 1 Gbit bağlantısı üzerinden yaklaşık bir saat sürer (paralel indirme s3.amazonaws.com 1 Gbit kanalın en az yarısını kurtarır). -Bazı dosyalar tam olarak indirilmeyebilir. Dosya boyutlarını kontrol edin ve şüpheli görünen herhangi birini yeniden indirin. - -Bazı dosyalar geçersiz satırlar içerebilir. Bunları aşağıdaki gibi düzeltebilirsiniz: - -``` bash -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ -mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv -mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv -``` - -Daha sonra veriler Postgresql'de önceden işlenmelidir. Bu, çokgenlerdeki noktaların seçimlerini oluşturacaktır (Haritadaki noktaları New York şehrinin ilçeleriyle eşleştirmek için) ve tüm verileri bir birleştirme kullanarak tek bir denormalize düz tabloda birleştirecektir. Bunu yapmak için Postgresql'i Postgıs desteği ile yüklemeniz gerekir. - -Çalışırken dikkatli olun `initialize_database.sh` ve tüm tabloların doğru şekilde oluşturulduğunu manuel olarak yeniden kontrol edin. - -Postgresql'deki her ayın verilerini işlemek yaklaşık 20-30 dakika sürer, toplam yaklaşık 48 saat sürer. - -İndirilen satır sayısını aşağıdaki gibi kontrol edebilirsiniz: - -``` bash -$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" -## Count - 1298979494 -(1 row) - -real 7m9.164s -``` - -(Bu, Mark Litwintschik tarafından bir dizi blog gönderisinde bildirilen 1.1 milyar satırdan biraz daha fazladır .) - -Postgresql'deki veriler 370 GB alan kullanıyor. - -PostgreSQL veri verme: - -``` sql -COPY -( - SELECT trips.id, - trips.vendor_id, - trips.pickup_datetime, - trips.dropoff_datetime, - trips.store_and_fwd_flag, - trips.rate_code_id, - trips.pickup_longitude, - trips.pickup_latitude, - trips.dropoff_longitude, - trips.dropoff_latitude, - trips.passenger_count, - trips.trip_distance, - trips.fare_amount, - trips.extra, - trips.mta_tax, - trips.tip_amount, - trips.tolls_amount, - trips.ehail_fee, - trips.improvement_surcharge, - trips.total_amount, - trips.payment_type, - trips.trip_type, - trips.pickup, - trips.dropoff, - - cab_types.type cab_type, - - weather.precipitation_tenths_of_mm rain, - weather.snow_depth_mm, - weather.snowfall_mm, - weather.max_temperature_tenths_degrees_celsius max_temp, - weather.min_temperature_tenths_degrees_celsius min_temp, - weather.average_wind_speed_tenths_of_meters_per_second wind, - - pick_up.gid pickup_nyct2010_gid, - pick_up.ctlabel pickup_ctlabel, - pick_up.borocode pickup_borocode, - pick_up.boroname pickup_boroname, - pick_up.ct2010 pickup_ct2010, - pick_up.boroct2010 pickup_boroct2010, - pick_up.cdeligibil pickup_cdeligibil, - pick_up.ntacode pickup_ntacode, - pick_up.ntaname pickup_ntaname, - pick_up.puma pickup_puma, - - drop_off.gid dropoff_nyct2010_gid, - drop_off.ctlabel dropoff_ctlabel, - drop_off.borocode dropoff_borocode, - drop_off.boroname dropoff_boroname, - drop_off.ct2010 dropoff_ct2010, - drop_off.boroct2010 dropoff_boroct2010, - drop_off.cdeligibil dropoff_cdeligibil, - drop_off.ntacode dropoff_ntacode, - drop_off.ntaname dropoff_ntaname, - drop_off.puma dropoff_puma - FROM trips - LEFT JOIN cab_types - ON trips.cab_type_id = cab_types.id - LEFT JOIN central_park_weather_observations_raw weather - ON weather.date = trips.pickup_datetime::date - LEFT JOIN nyct2010 pick_up - ON pick_up.gid = trips.pickup_nyct2010_gid - LEFT JOIN nyct2010 drop_off - ON drop_off.gid = trips.dropoff_nyct2010_gid -) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; -``` - -Veri anlık görüntüsü saniyede yaklaşık 50 MB hızında oluşturulur. Anlık görüntü oluştururken, PostgreSQL diskten saniyede yaklaşık 28 MB hızında okur. -Bu yaklaşık 5 saat sürer. Elde edilen TSV dosyası 590612904969 bayttır. - -Clickhouse'da geçici bir tablo oluşturma: - -``` sql -CREATE TABLE trips -( -trip_id UInt32, -vendor_id String, -pickup_datetime DateTime, -dropoff_datetime Nullable(DateTime), -store_and_fwd_flag Nullable(FixedString(1)), -rate_code_id Nullable(UInt8), -pickup_longitude Nullable(Float64), -pickup_latitude Nullable(Float64), -dropoff_longitude Nullable(Float64), -dropoff_latitude Nullable(Float64), -passenger_count Nullable(UInt8), -trip_distance Nullable(Float64), -fare_amount Nullable(Float32), -extra Nullable(Float32), -mta_tax Nullable(Float32), -tip_amount Nullable(Float32), -tolls_amount Nullable(Float32), -ehail_fee Nullable(Float32), -improvement_surcharge Nullable(Float32), -total_amount Nullable(Float32), -payment_type Nullable(String), -trip_type Nullable(UInt8), -pickup Nullable(String), -dropoff Nullable(String), -cab_type Nullable(String), -precipitation Nullable(UInt8), -snow_depth Nullable(UInt8), -snowfall Nullable(UInt8), -max_temperature Nullable(UInt8), -min_temperature Nullable(UInt8), -average_wind_speed Nullable(UInt8), -pickup_nyct2010_gid Nullable(UInt8), -pickup_ctlabel Nullable(String), -pickup_borocode Nullable(UInt8), -pickup_boroname Nullable(String), -pickup_ct2010 Nullable(String), -pickup_boroct2010 Nullable(String), -pickup_cdeligibil Nullable(FixedString(1)), -pickup_ntacode Nullable(String), -pickup_ntaname Nullable(String), -pickup_puma Nullable(String), -dropoff_nyct2010_gid Nullable(UInt8), -dropoff_ctlabel Nullable(String), -dropoff_borocode Nullable(UInt8), -dropoff_boroname Nullable(String), -dropoff_ct2010 Nullable(String), -dropoff_boroct2010 Nullable(String), -dropoff_cdeligibil Nullable(String), -dropoff_ntacode Nullable(String), -dropoff_ntaname Nullable(String), -dropoff_puma Nullable(String) -) ENGINE = Log; -``` - -Alanları daha doğru veri türlerine dönüştürmek ve mümkünse Boşları ortadan kaldırmak için gereklidir. - -``` bash -$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv - -real 75m56.214s -``` - -Veri 112-140 Mb/saniye hızında okunur. -Bir akışta bir günlük türü tablosuna veri yükleme 76 dakika sürdü. -Bu tablodaki veriler 142 GB kullanır. - -(Verileri doğrudan Postgres'ten içe aktarmak da mümkündür `COPY ... TO PROGRAM`.) - -Unfortunately, all the fields associated with the weather (precipitation…average\_wind\_speed) were filled with NULL. Because of this, we will remove them from the final data set. - -Başlamak için, tek bir sunucuda bir tablo oluşturacağız. Daha sonra tabloyu dağıtacağız. - -Özet Tablo oluşturma ve doldurma: - -``` sql -CREATE TABLE trips_mergetree -ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -AS SELECT - -trip_id, -CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, -toDate(pickup_datetime) AS pickup_date, -ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, -toDate(dropoff_datetime) AS dropoff_date, -ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, -assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, -assumeNotNull(rate_code_id) AS rate_code_id, -assumeNotNull(pickup_longitude) AS pickup_longitude, -assumeNotNull(pickup_latitude) AS pickup_latitude, -assumeNotNull(dropoff_longitude) AS dropoff_longitude, -assumeNotNull(dropoff_latitude) AS dropoff_latitude, -assumeNotNull(passenger_count) AS passenger_count, -assumeNotNull(trip_distance) AS trip_distance, -assumeNotNull(fare_amount) AS fare_amount, -assumeNotNull(extra) AS extra, -assumeNotNull(mta_tax) AS mta_tax, -assumeNotNull(tip_amount) AS tip_amount, -assumeNotNull(tolls_amount) AS tolls_amount, -assumeNotNull(ehail_fee) AS ehail_fee, -assumeNotNull(improvement_surcharge) AS improvement_surcharge, -assumeNotNull(total_amount) AS total_amount, -CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, -assumeNotNull(trip_type) AS trip_type, -ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, -ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, -CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, - -assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, -toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, -assumeNotNull(pickup_borocode) AS pickup_borocode, -CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, -toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, -toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, -CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, -toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, - -CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, - -toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, - -assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, -toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, -assumeNotNull(dropoff_borocode) AS dropoff_borocode, -CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, -toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, -toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, -CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, -toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, - -CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, - -toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma - -FROM trips -``` - -Bu, saniyede yaklaşık 428.000 satırlık bir hızda 3030 saniye sürer. -Daha hızlı yüklemek için, tablo ile oluşturabilirsiniz `Log` motor yerine `MergeTree`. Bu durumda, indirme 200 saniyeden daha hızlı çalışır. - -Tablo 126 GB disk alanı kullanır. - -``` sql -SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active -``` - -``` text -┌─formatReadableSize(sum(bytes))─┐ -│ 126.18 GiB │ -└────────────────────────────────┘ -``` - -Diğer şeylerin yanı sıra, MERGETREE üzerinde en iyi duruma getirme sorgusunu çalıştırabilirsiniz. Ama her şey onsuz iyi olacak çünkü gerekli değildir. - -## Hazırlanan Bölüm downloadlerin indir downloadilmesi {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar -$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" -``` - -!!! info "Bilgin" - Aşağıda açıklanan sorguları çalıştıracaksanız, tam tablo adını kullanmanız gerekir, `datasets.trips_mergetree`. - -## Tek Server ile ilgili sonuçlar {#results-on-single-server} - -Q1: - -``` sql -SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type -``` - -0.490 saniye. - -Q2: - -``` sql -SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count -``` - -1.224 saniye. - -Q3: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year -``` - -2.104 saniye. - -Q4: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) -FROM trips_mergetree -GROUP BY passenger_count, year, distance -ORDER BY year, count(*) DESC -``` - -3.593 saniye. - -Aşağıdaki sunucu kullanıldı: - -İki Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60 GHz, 16 fiziksel çekirdekler toplam,128 GiB RAM,8x6 TB HD donanım RAID-5 - -Yürütme süresi üç koşunun en iyisidir. Ancak ikinci çalıştırmadan başlayarak, sorgular dosya sistemi önbelleğinden verileri okur. Başka önbelleğe alma oluşur: veri okundu ve her vadede işlenir. - -Üç sunucuda tablo oluşturma: - -Her sunucuda: - -``` sql -CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -``` - -Kaynak sunucuda: - -``` sql -CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) -``` - -Aşağıdaki sorgu verileri yeniden dağıtır: - -``` sql -INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree -``` - -Bu 2454 saniye sürer. - -Üç sunucuda: - -Q1: 0.212 saniye. -Q2: 0.438 saniye. -Q3: 0.733 saniye. -Q4: 1.241 saniye. - -Sorgular doğrusal olarak ölçeklendiğinden, burada sürpriz yok. - -Ayrıca 140 sunucu kümesinden elde edilen sonuçlara sahibiz: - -Q1: 0.028 sn. -Q2: 0.043 sn. -Q3: 0.051 sn. -Q4: 0.072 sn. - -Bu durumda, sorgu işleme süresi her şeyden önce ağ gecikmesi ile belirlenir. -Finlandiya'daki bir Yandex veri merkezinde bulunan ve Rusya'daki bir kümede bulunan ve yaklaşık 20 ms gecikme süresi ekleyen bir istemci kullanarak sorgular çalıştırdık. - -## Özet {#summary} - -| hizmetçiler | Q1 | Q2 | Q3 | Q4 | -|-------------|-------|-------|-------|-------| -| 1 | 0.490 | 1.224 | 2.104 | 3.593 | -| 3 | 0.212 | 0.438 | 0.733 | 1.241 | -| 140 | 0.028 | 0.043 | 0.051 | 0.072 | - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/tr/getting_started/example_datasets/ontime.md b/docs/tr/getting_started/example_datasets/ontime.md deleted file mode 100644 index dc06b86189f..00000000000 --- a/docs/tr/getting_started/example_datasets/ontime.md +++ /dev/null @@ -1,412 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 15 -toc_title: OnTime ---- - -# OnTime {#ontime} - -Bu veri kümesi iki şekilde elde edilebilir: - -- ham verilerden içe aktarma -- hazırlanan bölüm downloadlerin indir downloadilmesi - -## Ham Verilerden İçe Aktarma {#import-from-raw-data} - -Veri indirme: - -``` bash -for s in `seq 1987 2018` -do -for m in `seq 1 12` -do -wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip -done -done -``` - -(from https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) - -Tablo oluşturma: - -``` sql -CREATE TABLE `ontime` ( - `Year` UInt16, - `Quarter` UInt8, - `Month` UInt8, - `DayofMonth` UInt8, - `DayOfWeek` UInt8, - `FlightDate` Date, - `UniqueCarrier` FixedString(7), - `AirlineID` Int32, - `Carrier` FixedString(2), - `TailNum` String, - `FlightNum` String, - `OriginAirportID` Int32, - `OriginAirportSeqID` Int32, - `OriginCityMarketID` Int32, - `Origin` FixedString(5), - `OriginCityName` String, - `OriginState` FixedString(2), - `OriginStateFips` String, - `OriginStateName` String, - `OriginWac` Int32, - `DestAirportID` Int32, - `DestAirportSeqID` Int32, - `DestCityMarketID` Int32, - `Dest` FixedString(5), - `DestCityName` String, - `DestState` FixedString(2), - `DestStateFips` String, - `DestStateName` String, - `DestWac` Int32, - `CRSDepTime` Int32, - `DepTime` Int32, - `DepDelay` Int32, - `DepDelayMinutes` Int32, - `DepDel15` Int32, - `DepartureDelayGroups` String, - `DepTimeBlk` String, - `TaxiOut` Int32, - `WheelsOff` Int32, - `WheelsOn` Int32, - `TaxiIn` Int32, - `CRSArrTime` Int32, - `ArrTime` Int32, - `ArrDelay` Int32, - `ArrDelayMinutes` Int32, - `ArrDel15` Int32, - `ArrivalDelayGroups` Int32, - `ArrTimeBlk` String, - `Cancelled` UInt8, - `CancellationCode` FixedString(1), - `Diverted` UInt8, - `CRSElapsedTime` Int32, - `ActualElapsedTime` Int32, - `AirTime` Int32, - `Flights` Int32, - `Distance` Int32, - `DistanceGroup` UInt8, - `CarrierDelay` Int32, - `WeatherDelay` Int32, - `NASDelay` Int32, - `SecurityDelay` Int32, - `LateAircraftDelay` Int32, - `FirstDepTime` String, - `TotalAddGTime` String, - `LongestAddGTime` String, - `DivAirportLandings` String, - `DivReachedDest` String, - `DivActualElapsedTime` String, - `DivArrDelay` String, - `DivDistance` String, - `Div1Airport` String, - `Div1AirportID` Int32, - `Div1AirportSeqID` Int32, - `Div1WheelsOn` String, - `Div1TotalGTime` String, - `Div1LongestGTime` String, - `Div1WheelsOff` String, - `Div1TailNum` String, - `Div2Airport` String, - `Div2AirportID` Int32, - `Div2AirportSeqID` Int32, - `Div2WheelsOn` String, - `Div2TotalGTime` String, - `Div2LongestGTime` String, - `Div2WheelsOff` String, - `Div2TailNum` String, - `Div3Airport` String, - `Div3AirportID` Int32, - `Div3AirportSeqID` Int32, - `Div3WheelsOn` String, - `Div3TotalGTime` String, - `Div3LongestGTime` String, - `Div3WheelsOff` String, - `Div3TailNum` String, - `Div4Airport` String, - `Div4AirportID` Int32, - `Div4AirportSeqID` Int32, - `Div4WheelsOn` String, - `Div4TotalGTime` String, - `Div4LongestGTime` String, - `Div4WheelsOff` String, - `Div4TailNum` String, - `Div5Airport` String, - `Div5AirportID` Int32, - `Div5AirportSeqID` Int32, - `Div5WheelsOn` String, - `Div5TotalGTime` String, - `Div5LongestGTime` String, - `Div5WheelsOff` String, - `Div5TailNum` String -) ENGINE = MergeTree -PARTITION BY Year -ORDER BY (Carrier, FlightDate) -SETTINGS index_granularity = 8192; -``` - -Veri yükleme: - -``` bash -$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done -``` - -## Hazırlanan Bölüm downloadlerin indir downloadilmesi {#download-of-prepared-partitions} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar -$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.ontime" -``` - -!!! info "Bilgin" - Aşağıda açıklanan sorguları çalıştıracaksanız, tam tablo adını kullanmanız gerekir, `datasets.ontime`. - -## Sorgular {#queries} - -Q0. - -``` sql -SELECT avg(c1) -FROM -( - SELECT Year, Month, count(*) AS c1 - FROM ontime - GROUP BY Year, Month -); -``` - -Q1. 2000 yılından 2008 yılına kadar günlük uçuş sayısı - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -S2. 2000-2008 için haftanın gününe göre gruplandırılmış 10 dakikadan fazla geciken uçuş sayısı - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -Q3. 2000-2008 için havaalanı tarafından gecikme sayısı - -``` sql -SELECT Origin, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY Origin -ORDER BY c DESC -LIMIT 10; -``` - -S4. 2007 yılı için taşıyıcı tarafından gecikme sayısı - -``` sql -SELECT Carrier, count(*) -FROM ontime -WHERE DepDelay>10 AND Year=2007 -GROUP BY Carrier -ORDER BY count(*) DESC; -``` - -Q5. 2007 yılı için taşıyıcı tarafından gecikme yüzdesi - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year=2007 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year=2007 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Aynı sorgunun daha iyi sürümü: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year=2007 -GROUP BY Carrier -ORDER BY c3 DESC -``` - -S6. Daha geniş bir yıl aralığı için önceki talep, 2000-2008 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year>=2000 AND Year<=2008 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year>=2000 AND Year<=2008 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -Aynı sorgunun daha iyi sürümü: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY Carrier -ORDER BY c3 DESC; -``` - -Q7. Yıla göre 10 dakikadan fazla gecikmeli uçuş yüzdesi - -``` sql -SELECT Year, c1/c2 -FROM -( - select - Year, - count(*)*100 as c1 - from ontime - WHERE DepDelay>10 - GROUP BY Year -) -JOIN -( - select - Year, - count(*) as c2 - from ontime - GROUP BY Year -) USING (Year) -ORDER BY Year; -``` - -Aynı sorgunun daha iyi sürümü: - -``` sql -SELECT Year, avg(DepDelay>10)*100 -FROM ontime -GROUP BY Year -ORDER BY Year; -``` - -S8. Çeşitli yıl aralıkları için doğrudan bağlı şehirlerin sayısına göre en popüler yerler - -``` sql -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -WHERE Year >= 2000 and Year <= 2010 -GROUP BY DestCityName -ORDER BY u DESC LIMIT 10; -``` - -Q9. - -``` sql -SELECT Year, count(*) AS c1 -FROM ontime -GROUP BY Year; -``` - -Q10. - -``` sql -SELECT - min(Year), max(Year), Carrier, count(*) AS cnt, - sum(ArrDelayMinutes>30) AS flights_delayed, - round(sum(ArrDelayMinutes>30)/count(*),2) AS rate -FROM ontime -WHERE - DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') - AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') - AND FlightDate < '2010-01-01' -GROUP by Carrier -HAVING cnt>100000 and max(Year)>1990 -ORDER by rate DESC -LIMIT 1000; -``` - -Bonus: - -``` sql -SELECT avg(cnt) -FROM -( - SELECT Year,Month,count(*) AS cnt - FROM ontime - WHERE DepDel15=1 - GROUP BY Year,Month -); - -SELECT avg(c1) FROM -( - SELECT Year,Month,count(*) AS c1 - FROM ontime - GROUP BY Year,Month -); - -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -GROUP BY DestCityName -ORDER BY u DESC -LIMIT 10; - -SELECT OriginCityName, DestCityName, count() AS c -FROM ontime -GROUP BY OriginCityName, DestCityName -ORDER BY c DESC -LIMIT 10; - -SELECT OriginCityName, count() AS c -FROM ontime -GROUP BY OriginCityName -ORDER BY c DESC -LIMIT 10; -``` - -Bu performans testi Vadim Tkachenko tarafından oluşturuldu. Görmek: - -- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ -- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ -- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ -- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ -- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ -- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/ontime/) diff --git a/docs/tr/getting_started/example_datasets/star_schema.md b/docs/tr/getting_started/example_datasets/star_schema.md deleted file mode 100644 index 1326aab7ab2..00000000000 --- a/docs/tr/getting_started/example_datasets/star_schema.md +++ /dev/null @@ -1,370 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 20 -toc_title: "Y\u0131ld\u0131z \u015Eema Ben Benchmarkch Benchmarkmark" ---- - -# Yıldız Şema Ben Benchmarkch Benchmarkmark {#star-schema-benchmark} - -Dbgen derleme: - -``` bash -$ git clone git@github.com:vadimtk/ssb-dbgen.git -$ cd ssb-dbgen -$ make -``` - -Veri oluşturma: - -!!! warning "Dikkat" - İle `-s 100` dbgen, 600 milyon satır (67 GB) üretir `-s 1000` 6 milyar satır üretir (bu çok zaman alır) - -``` bash -$ ./dbgen -s 1000 -T c -$ ./dbgen -s 1000 -T l -$ ./dbgen -s 1000 -T p -$ ./dbgen -s 1000 -T s -$ ./dbgen -s 1000 -T d -``` - -Clickhouse'da tablolar oluşturma: - -``` sql -CREATE TABLE customer -( - C_CUSTKEY UInt32, - C_NAME String, - C_ADDRESS String, - C_CITY LowCardinality(String), - C_NATION LowCardinality(String), - C_REGION LowCardinality(String), - C_PHONE String, - C_MKTSEGMENT LowCardinality(String) -) -ENGINE = MergeTree ORDER BY (C_CUSTKEY); - -CREATE TABLE lineorder -( - LO_ORDERKEY UInt32, - LO_LINENUMBER UInt8, - LO_CUSTKEY UInt32, - LO_PARTKEY UInt32, - LO_SUPPKEY UInt32, - LO_ORDERDATE Date, - LO_ORDERPRIORITY LowCardinality(String), - LO_SHIPPRIORITY UInt8, - LO_QUANTITY UInt8, - LO_EXTENDEDPRICE UInt32, - LO_ORDTOTALPRICE UInt32, - LO_DISCOUNT UInt8, - LO_REVENUE UInt32, - LO_SUPPLYCOST UInt32, - LO_TAX UInt8, - LO_COMMITDATE Date, - LO_SHIPMODE LowCardinality(String) -) -ENGINE = MergeTree PARTITION BY toYear(LO_ORDERDATE) ORDER BY (LO_ORDERDATE, LO_ORDERKEY); - -CREATE TABLE part -( - P_PARTKEY UInt32, - P_NAME String, - P_MFGR LowCardinality(String), - P_CATEGORY LowCardinality(String), - P_BRAND LowCardinality(String), - P_COLOR LowCardinality(String), - P_TYPE LowCardinality(String), - P_SIZE UInt8, - P_CONTAINER LowCardinality(String) -) -ENGINE = MergeTree ORDER BY P_PARTKEY; - -CREATE TABLE supplier -( - S_SUPPKEY UInt32, - S_NAME String, - S_ADDRESS String, - S_CITY LowCardinality(String), - S_NATION LowCardinality(String), - S_REGION LowCardinality(String), - S_PHONE String -) -ENGINE = MergeTree ORDER BY S_SUPPKEY; -``` - -Veri ekleme: - -``` bash -$ clickhouse-client --query "INSERT INTO customer FORMAT CSV" < customer.tbl -$ clickhouse-client --query "INSERT INTO part FORMAT CSV" < part.tbl -$ clickhouse-client --query "INSERT INTO supplier FORMAT CSV" < supplier.tbl -$ clickhouse-client --query "INSERT INTO lineorder FORMAT CSV" < lineorder.tbl -``` - -Dönüşüm “star schema” denormalized için “flat schema”: - -``` sql -SET max_memory_usage = 20000000000; - -CREATE TABLE lineorder_flat -ENGINE = MergeTree -PARTITION BY toYear(LO_ORDERDATE) -ORDER BY (LO_ORDERDATE, LO_ORDERKEY) AS -SELECT - l.LO_ORDERKEY AS LO_ORDERKEY, - l.LO_LINENUMBER AS LO_LINENUMBER, - l.LO_CUSTKEY AS LO_CUSTKEY, - l.LO_PARTKEY AS LO_PARTKEY, - l.LO_SUPPKEY AS LO_SUPPKEY, - l.LO_ORDERDATE AS LO_ORDERDATE, - l.LO_ORDERPRIORITY AS LO_ORDERPRIORITY, - l.LO_SHIPPRIORITY AS LO_SHIPPRIORITY, - l.LO_QUANTITY AS LO_QUANTITY, - l.LO_EXTENDEDPRICE AS LO_EXTENDEDPRICE, - l.LO_ORDTOTALPRICE AS LO_ORDTOTALPRICE, - l.LO_DISCOUNT AS LO_DISCOUNT, - l.LO_REVENUE AS LO_REVENUE, - l.LO_SUPPLYCOST AS LO_SUPPLYCOST, - l.LO_TAX AS LO_TAX, - l.LO_COMMITDATE AS LO_COMMITDATE, - l.LO_SHIPMODE AS LO_SHIPMODE, - c.C_NAME AS C_NAME, - c.C_ADDRESS AS C_ADDRESS, - c.C_CITY AS C_CITY, - c.C_NATION AS C_NATION, - c.C_REGION AS C_REGION, - c.C_PHONE AS C_PHONE, - c.C_MKTSEGMENT AS C_MKTSEGMENT, - s.S_NAME AS S_NAME, - s.S_ADDRESS AS S_ADDRESS, - s.S_CITY AS S_CITY, - s.S_NATION AS S_NATION, - s.S_REGION AS S_REGION, - s.S_PHONE AS S_PHONE, - p.P_NAME AS P_NAME, - p.P_MFGR AS P_MFGR, - p.P_CATEGORY AS P_CATEGORY, - p.P_BRAND AS P_BRAND, - p.P_COLOR AS P_COLOR, - p.P_TYPE AS P_TYPE, - p.P_SIZE AS P_SIZE, - p.P_CONTAINER AS P_CONTAINER -FROM lineorder AS l -INNER JOIN customer AS c ON c.C_CUSTKEY = l.LO_CUSTKEY -INNER JOIN supplier AS s ON s.S_SUPPKEY = l.LO_SUPPKEY -INNER JOIN part AS p ON p.P_PARTKEY = l.LO_PARTKEY; -``` - -Sorguları çalıştırma: - -Q1.1 - -``` sql -SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue -FROM lineorder_flat -WHERE toYear(LO_ORDERDATE) = 1993 AND LO_DISCOUNT BETWEEN 1 AND 3 AND LO_QUANTITY < 25; -``` - -Q1.2 - -``` sql -SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue -FROM lineorder_flat -WHERE toYYYYMM(LO_ORDERDATE) = 199401 AND LO_DISCOUNT BETWEEN 4 AND 6 AND LO_QUANTITY BETWEEN 26 AND 35; -``` - -Q1.3 - -``` sql -SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue -FROM lineorder_flat -WHERE toISOWeek(LO_ORDERDATE) = 6 AND toYear(LO_ORDERDATE) = 1994 - AND LO_DISCOUNT BETWEEN 5 AND 7 AND LO_QUANTITY BETWEEN 26 AND 35; -``` - -Q2.1 - -``` sql -SELECT - sum(LO_REVENUE), - toYear(LO_ORDERDATE) AS year, - P_BRAND -FROM lineorder_flat -WHERE P_CATEGORY = 'MFGR#12' AND S_REGION = 'AMERICA' -GROUP BY - year, - P_BRAND -ORDER BY - year, - P_BRAND; -``` - -Q2.2 - -``` sql -SELECT - sum(LO_REVENUE), - toYear(LO_ORDERDATE) AS year, - P_BRAND -FROM lineorder_flat -WHERE P_BRAND >= 'MFGR#2221' AND P_BRAND <= 'MFGR#2228' AND S_REGION = 'ASIA' -GROUP BY - year, - P_BRAND -ORDER BY - year, - P_BRAND; -``` - -Q2.3 - -``` sql -SELECT - sum(LO_REVENUE), - toYear(LO_ORDERDATE) AS year, - P_BRAND -FROM lineorder_flat -WHERE P_BRAND = 'MFGR#2239' AND S_REGION = 'EUROPE' -GROUP BY - year, - P_BRAND -ORDER BY - year, - P_BRAND; -``` - -Q3.1 - -``` sql -SELECT - C_NATION, - S_NATION, - toYear(LO_ORDERDATE) AS year, - sum(LO_REVENUE) AS revenue -FROM lineorder_flat -WHERE C_REGION = 'ASIA' AND S_REGION = 'ASIA' AND year >= 1992 AND year <= 1997 -GROUP BY - C_NATION, - S_NATION, - year -ORDER BY - year ASC, - revenue DESC; -``` - -Q3.2 - -``` sql -SELECT - C_CITY, - S_CITY, - toYear(LO_ORDERDATE) AS year, - sum(LO_REVENUE) AS revenue -FROM lineorder_flat -WHERE C_NATION = 'UNITED STATES' AND S_NATION = 'UNITED STATES' AND year >= 1992 AND year <= 1997 -GROUP BY - C_CITY, - S_CITY, - year -ORDER BY - year ASC, - revenue DESC; -``` - -Q3.3 - -``` sql -SELECT - C_CITY, - S_CITY, - toYear(LO_ORDERDATE) AS year, - sum(LO_REVENUE) AS revenue -FROM lineorder_flat -WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND year >= 1992 AND year <= 1997 -GROUP BY - C_CITY, - S_CITY, - year -ORDER BY - year ASC, - revenue DESC; -``` - -Q3.4 - -``` sql -SELECT - C_CITY, - S_CITY, - toYear(LO_ORDERDATE) AS year, - sum(LO_REVENUE) AS revenue -FROM lineorder_flat -WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND toYYYYMM(LO_ORDERDATE) = 199712 -GROUP BY - C_CITY, - S_CITY, - year -ORDER BY - year ASC, - revenue DESC; -``` - -Q4.1 - -``` sql -SELECT - toYear(LO_ORDERDATE) AS year, - C_NATION, - sum(LO_REVENUE - LO_SUPPLYCOST) AS profit -FROM lineorder_flat -WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') -GROUP BY - year, - C_NATION -ORDER BY - year ASC, - C_NATION ASC; -``` - -Q4.2 - -``` sql -SELECT - toYear(LO_ORDERDATE) AS year, - S_NATION, - P_CATEGORY, - sum(LO_REVENUE - LO_SUPPLYCOST) AS profit -FROM lineorder_flat -WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (year = 1997 OR year = 1998) AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') -GROUP BY - year, - S_NATION, - P_CATEGORY -ORDER BY - year ASC, - S_NATION ASC, - P_CATEGORY ASC; -``` - -Q4.3 - -``` sql -SELECT - toYear(LO_ORDERDATE) AS year, - S_CITY, - P_BRAND, - sum(LO_REVENUE - LO_SUPPLYCOST) AS profit -FROM lineorder_flat -WHERE S_NATION = 'UNITED STATES' AND (year = 1997 OR year = 1998) AND P_CATEGORY = 'MFGR#14' -GROUP BY - year, - S_CITY, - P_BRAND -ORDER BY - year ASC, - S_CITY ASC, - P_BRAND ASC; -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/example_datasets/star_schema/) diff --git a/docs/tr/getting_started/index.md b/docs/tr/getting_started/index.md deleted file mode 100644 index e97f9add1f0..00000000000 --- a/docs/tr/getting_started/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "Ba\u015Flarken" -toc_hidden: true -toc_priority: 8 -toc_title: "gizlenmi\u015F" ---- - -# Başlarken {#getting-started} - -Eğer ClickHouse için yeni ve performans bir hands-on hissi almak istiyorsanız, her şeyden önce, sen [yükleme işlemi](install.md). Bundan sonra şunları yapabilirsiniz: - -- [Ayrıntılı öğretici geçmesi](tutorial.md) -- [Örnek veri kümeleri ile deneme](example_datasets/ontime.md) - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/) diff --git a/docs/tr/getting_started/install.md b/docs/tr/getting_started/install.md deleted file mode 100644 index 8597a378fb4..00000000000 --- a/docs/tr/getting_started/install.md +++ /dev/null @@ -1,191 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 11 -toc_title: Kurulum ---- - -# Kurulum {#installation} - -## Sistem Gereksinimleri {#system-requirements} - -ClickHouse, x86\_64, AArch64 veya PowerPC64LE CPU mimarisine sahip herhangi bir Linux, FreeBSD veya Mac OS X üzerinde çalışabilir. - -Resmi önceden oluşturulmuş ikili dosyalar genellikle x86\_64 ve kaldıraç sse 4.2 komut seti için derlenir, bu nedenle destekleyen CPU'nun aksi belirtilmedikçe ek bir sistem gereksinimi haline gelir. Geçerli CPU'nun sse 4.2 desteği olup olmadığını kontrol etmek için komut: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -SSE 4.2'yi desteklemeyen veya AArch64 veya PowerPC64LE mimarisine sahip işlemcilerde Clickhouse'u çalıştırmak için şunları yapmalısınız [kaynaklardan ClickHouse oluşturun](#from-sources) uygun yapılandırma ayarlamaları ile. - -## Mevcut Kurulum Seçenekleri {#available-installation-options} - -### DEB paket fromlerinden {#install-from-deb-packages} - -Resmi önceden derlenmiş kullanılması tavsiye edilir `deb` Debian veya Ubuntu için paketler. - -Resmi paketleri yüklemek için Yandex deposunu ekleyin `/etc/apt/sources.list` veya ayrı bir `/etc/apt/sources.list.d/clickhouse.list` Dosya: - - deb http://repo.clickhouse.tech/deb/stable/ main/ - -En son sürümü kullanmak istiyorsanız, değiştirin `stable` ile `testing` (bu, test ortamlarınız için önerilir). - -Sonra paketleri yüklemek için bu komutları çalıştırın: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -Paketleri buradan manuel olarak indirebilir ve kurabilirsiniz: https://repo.yandex.ru/clickhouse/deb/stable/main/. - -#### Paketler {#packages} - -- `clickhouse-common-static` — Installs ClickHouse compiled binary files. -- `clickhouse-server` — Creates a symbolic link for `clickhouse-server` ve varsayılan sunucu yapılandırmasını yükler. -- `clickhouse-client` — Creates a symbolic link for `clickhouse-client` ve diğer istemci ile ilgili araçlar. ve istemci yapılandırma dosyalarını yükler. -- `clickhouse-common-static-dbg` — Installs ClickHouse compiled binary files with debug info. - -### RPM paket fromlerinden {#from-rpm-packages} - -Resmi önceden derlenmiş kullanılması tavsiye edilir `rpm` CentOS, RedHat ve diğer tüm rpm tabanlı Linux dağıtımları için paketler. - -İlk olarak, resmi depoyu eklemeniz gerekir: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64 -``` - -En son sürümü kullanmak istiyorsanız, değiştirin `stable` ile `testing` (bu, test ortamlarınız için önerilir). Bu `prestable` etiket de bazen kullanılabilir. - -Sonra paketleri yüklemek için bu komutları çalıştırın: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -Paketleri buradan manuel olarak indirebilir ve kurabilirsiniz: https://repo.clickhouse.teknoloji / rpm / kararlı / x86\_64. - -### Tgz Arşivlerinden {#from-tgz-archives} - -Resmi önceden derlenmiş kullanılması tavsiye edilir `tgz` Arch ,iv ,es for tüm Linux dağıtım installationları, kurulumu `deb` veya `rpm` paketler mümkün değildir. - -Gerekli sürümü ile indirilebilir `curl` veya `wget` depo fromdan https://repo.yandex.ru/clickhouse/tgz/. -Bundan sonra indirilen arşivler açılmalı ve kurulum komut dosyaları ile kurulmalıdır. En son sürüm için örnek: - -``` bash -export LATEST_VERSION=`curl https://api.github.com/repos/ClickHouse/ClickHouse/tags 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-common-static-dbg-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-server-$LATEST_VERSION.tgz -curl -O https://repo.clickhouse.tech/tgz/clickhouse-client-$LATEST_VERSION.tgz - -tar -xzvf clickhouse-common-static-$LATEST_VERSION.tgz -sudo clickhouse-common-static-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-common-static-dbg-$LATEST_VERSION.tgz -sudo clickhouse-common-static-dbg-$LATEST_VERSION/install/doinst.sh - -tar -xzvf clickhouse-server-$LATEST_VERSION.tgz -sudo clickhouse-server-$LATEST_VERSION/install/doinst.sh -sudo /etc/init.d/clickhouse-server start - -tar -xzvf clickhouse-client-$LATEST_VERSION.tgz -sudo clickhouse-client-$LATEST_VERSION/install/doinst.sh -``` - -Üretim ortamları için en son teknolojiyi kullanmanız önerilir `stable`-sürüm. Numarasını GitHub sayfasında bulabilirsiniz https://github.com/ClickHouse/ClickHouse/tags postfix ile `-stable`. - -### Docker Görüntüden {#from-docker-image} - -Docker içinde ClickHouse çalıştırmak için kılavuzu izleyin [Docker Hub](https://hub.docker.com/r/yandex/clickhouse-server/). Bu görüntüler resmi `deb` paketler içinde. - -### Kaynaklardan {#from-sources} - -Clickhouse'u el ile derlemek için aşağıdaki talimatları izleyin [Linux](../development/build.md) veya [Mac OS X](../development/build_osx.md). - -Paketleri derleyebilir ve yükleyebilir veya paketleri yüklemeden programları kullanabilirsiniz. Ayrıca elle inşa ederek SSE 4.2 gereksinimini devre dışı bırakabilir veya AArch64 CPU'lar için oluşturabilirsiniz. - - Client: programs/clickhouse-client - Server: programs/clickhouse-server - -Bir veri ve meta veri klasörleri oluşturmanız gerekir ve `chown` onları istenen kullanıcı için. Yolları sunucu yapılandırmasında değiştirilebilir (src / programlar / sunucu / config.xml), varsayılan olarak: - - /opt/clickhouse/data/default/ - /opt/clickhouse/metadata/default/ - -Gentoo üzerinde, sadece kullanabilirsiniz `emerge clickhouse` Clickhouse'u kaynaklardan yüklemek için. - -## Başlamak {#launch} - -Sunucuyu bir daemon olarak başlatmak için çalıştırın: - -``` bash -$ sudo service clickhouse-server start -``` - -Yok eğer `service` command, run as - -``` bash -$ sudo /etc/init.d/clickhouse-server start -``` - -Günlükleri görmek `/var/log/clickhouse-server/` dizin. - -Sunucu başlatılmazsa, dosyadaki yapılandırmaları kontrol edin `/etc/clickhouse-server/config.xml`. - -Ayrıca sunucuyu konsoldan manuel olarak başlatabilirsiniz: - -``` bash -$ clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -Bu durumda, günlük geliştirme sırasında uygun olan konsola yazdırılacaktır. -Yapılandırma dosyası geçerli dizinde ise, `--config-file` parametre. Varsayılan olarak, kullanır `./config.xml`. - -ClickHouse erişim kısıtlama ayarlarını destekler. Bulun theurlar. `users.xml` dosya (yanındaki `config.xml`). -Varsayılan olarak, erişim için herhangi bir yerden izin verilir `default` Kullanıcı, şifre olmadan. Görmek `user/default/networks`. -Daha fazla bilgi için bölüme bakın [“Configuration Files”](../operations/configuration_files.md). - -Sunucuyu başlattıktan sonra, ona bağlanmak için komut satırı istemcisini kullanabilirsiniz: - -``` bash -$ clickhouse-client -``` - -Varsayılan olarak, bağlanır `localhost:9000` kullanıcı adına `default` şifre olmadan. Kullanarak uzak bir sunucuya bağlanmak için de kullanılabilir `--host` değişken. - -Terminal UTF-8 kodlamasını kullanmalıdır. -Daha fazla bilgi için bölüme bakın [“Command-line client”](../interfaces/cli.md). - -Örnek: - -``` bash -$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**Tebrikler, sistem çalışıyor!** - -Denemeye devam etmek için, test veri kümelerinden birini indirebilir veya şunları yapabilirsiniz [öğretici](https://clickhouse.tech/tutorial.html). - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/tr/getting_started/playground.md b/docs/tr/getting_started/playground.md deleted file mode 100644 index 7c0f3641544..00000000000 --- a/docs/tr/getting_started/playground.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 14 -toc_title: "Bah\xE7e" ---- - -# ClickHouse Oyun Alanı {#clickhouse-playground} - -[ClickHouse Oyun Alanı](https://play.clickhouse.tech?file=welcome) kullanıcıların kendi sunucu veya küme kurmadan, anında sorguları çalıştırarak ClickHouse ile deneme sağlar. -Oyun alanında çeşitli örnek veri kümelerinin yanı sıra ClickHouse özelliklerini gösteren örnek sorgular da mevcuttur. - -Sorgular salt okunur bir kullanıcı olarak yürütülür. Bazı sınırlamaları ima eder: - -- DDL sorgularına İzin Verilmiyor -- Sorgu Ekle izin verilmez - -Aşağıdaki ayarlar da uygulanır: -- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) -- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) -- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) -- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) - -ClickHouse oyun alanı m2 deneyimini sunar.küçükler -[ClickHouse için yönetilen hizmet](https://cloud.yandex.com/services/managed-clickhouse) -örnek host hosteded in [Üye.Bulut](https://cloud.yandex.com/). -Hakkında daha fazla bilgi [bulut sağlayıcıları](../commercial/cloud.md). - -ClickHouse Playground web arayüzü clickhouse üzerinden istekleri yapar [HTTP API](../interfaces/http.md). -Bahçesi arka uç herhangi bir ek sunucu tarafı uygulaması olmadan sadece bir ClickHouse kümesidir. -ClickHouse HTTPS bitiş noktası da oyun alanının bir parçası olarak kullanılabilir. - -Herhangi bir HTTP istemcisi kullanarak oyun alanına sorgu yapabilirsiniz, örneğin [kıvrılma](https://curl.haxx.se) veya [wget](https://www.gnu.org/software/wget/), veya kullanarak bir bağlantı kurmak [JDBC](../interfaces/jdbc.md) veya [ODBC](../interfaces/odbc.md) sürücüler. -Clickhouse'u destekleyen yazılım ürünleri hakkında daha fazla bilgi mevcuttur [burada](../interfaces/index.md). - -| Parametre | Değer | -|:----------|:----------------------------------------| -| Nokta | https://play-api.clickhouse.teknik:8443 | -| Kullanan | `playground` | -| Şifre | `clickhouse` | - -Bu bitiş noktasının güvenli bir bağlantı gerektirdiğini unutmayın. - -Örnek: - -``` bash -curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" -``` diff --git a/docs/tr/getting_started/tutorial.md b/docs/tr/getting_started/tutorial.md deleted file mode 100644 index 9d3d31ba898..00000000000 --- a/docs/tr/getting_started/tutorial.md +++ /dev/null @@ -1,671 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 12 -toc_title: "\xD6\u011Fretici" ---- - -# ClickHouse Eğitimi {#clickhouse-tutorial} - -## Bu Öğreticiden ne beklenir? {#what-to-expect-from-this-tutorial} - -Bu öğreticiden geçerek, basit bir ClickHouse kümesinin nasıl kurulacağını öğreneceksiniz. Küçük ama hataya dayanıklı ve ölçeklenebilir olacak. Ardından, verilerle doldurmak ve bazı demo sorguları yürütmek için örnek veri kümelerinden birini kullanacağız. - -## Tek Düğüm Kurulumu {#single-node-setup} - -Dağıtılmış bir ortamın karmaşıklığını ertelemek için, Clickhouse'u tek bir sunucu veya sanal makinede dağıtmaya başlayacağız. ClickHouse genellikle [deb](index.md#install-from-deb-packages) veya [rpm](index.md#from-rpm-packages) paketler, ama var [alternatifler](index.md#from-docker-image) onları desteklemeyen işletim sistemleri için. - -Örneğin, seçtiğiniz `deb` paketler ve yürütülen: - -``` bash -sudo apt-get install dirmngr -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 - -echo "deb http://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list -sudo apt-get update - -sudo apt-get install -y clickhouse-server clickhouse-client -``` - -Yüklü olan paketlerde ne var: - -- `clickhouse-client` paket içerir [clickhouse-müşteri](../interfaces/cli.md) uygulama, interaktif ClickHouse konsol istemcisi. -- `clickhouse-common` paket clickhouse yürütülebilir dosya içerir. -- `clickhouse-server` paket bir sunucu olarak ClickHouse çalıştırmak için yapılandırma dosyalarını içerir. - -Sunucu yapılandırma dosyaları bulunur `/etc/clickhouse-server/`. Daha fazla gitmeden önce, fark lütfen `` element in `config.xml`. Path, veri depolama için konumu belirler, bu nedenle büyük disk kapasitesine sahip birimde bulunmalıdır; varsayılan değer `/var/lib/clickhouse/`. Yapılandırmayı ayarlamak istiyorsanız, doğrudan düzenlemek kullanışlı değildir `config.xml` dosya, gelecekteki paket güncellemelerinde yeniden yazılabileceğini düşünüyor. Yapılandırma öğelerini geçersiz kılmak için önerilen yol oluşturmaktır [config dosyaları.d dizin](../operations/configuration_files.md) hizmet olarak “patches” config için.xml. - -Fark etmiş olabileceğiniz gibi, `clickhouse-server` paket kurulumdan sonra otomatik olarak başlatılmaz. Güncellemelerden sonra otomatik olarak yeniden başlatılmaz. Sunucuyu başlatma şekliniz init sisteminize bağlıdır, genellikle: - -``` bash -sudo service clickhouse-server start -``` - -veya - -``` bash -sudo /etc/init.d/clickhouse-server start -``` - -Sunucu günlükleri için varsayılan konum `/var/log/clickhouse-server/`. Sunucu, oturum açtıktan sonra istemci bağlantılarını işlemeye hazırdır. `Ready for connections` ileti. - -Bir kez `clickhouse-server` yukarı ve çalışıyor, biz kullanabilirsiniz `clickhouse-client` sunucuya bağlanmak ve aşağıdaki gibi bazı test sorguları çalıştırmak için `SELECT "Hello, world!";`. - -
- -Clickhouse-client için hızlı ipuçları -İnteraktif mod: - -``` bash -clickhouse-client -clickhouse-client --host=... --port=... --user=... --password=... -``` - -Çok satırlı sorguları etkinleştirme: - -``` bash -clickhouse-client -m -clickhouse-client --multiline -``` - -Toplu iş modunda sorguları çalıştırma: - -``` bash -clickhouse-client --query='SELECT 1' -echo 'SELECT 1' | clickhouse-client -clickhouse-client <<< 'SELECT 1' -``` - -Belirtilen biçimde bir dosyadan veri ekleme: - -``` bash -clickhouse-client --query='INSERT INTO table VALUES' < data.txt -clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv -``` - -
- -## Örnek Veri Kümesini İçe Aktar {#import-sample-dataset} - -Şimdi ClickHouse sunucumuzu bazı örnek verilerle doldurmanın zamanı geldi. Bu eğitimde, yandex'in anonim verilerini kullanacağız.Metrica, açık kaynak olmadan önce Clickhouse'u üretim yolunda çalıştıran ilk hizmet (daha fazlası [tarih bölümü](../introduction/history.md)). Var [Yandex'i içe aktarmanın birden fazla yolu.Metrica veri kümesi](example_datasets/metrica.md) ve öğretici uğruna, en gerçekçi olanı ile gideceğiz. - -### Tablo verilerini indirin ve ayıklayın {#download-and-extract-table-data} - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -``` - -Çıkarılan dosyalar yaklaşık 10GB boyutundadır. - -### Tablo Oluşturma {#create-tables} - -Çoğu veritabanı yönetim sisteminde olduğu gibi, ClickHouse tabloları mantıksal olarak gruplar “databases”. Bir `default` veritabanı, ancak adında yeni bir tane oluşturacağız `tutorial`: - -``` bash -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" -``` - -Tablolar oluşturmak için sözdizimi veritabanlarına kıyasla çok daha karmaşıktır (bkz. [başvurma](../sql_reference/statements/create.md). Genelde `CREATE TABLE` deyimi üç önemli şeyi belirtmek zorundadır: - -1. Oluşturulacak tablonun adı. -2. Table schema, i.e. list of columns and their [veri türleri](../sql_reference/data_types/index.md). -3. [Masa motoru](../engines/table_engines/index.md) ve bu tabloya yapılan sorguların fiziksel olarak nasıl yürütüleceği ile ilgili tüm ayrıntıları belirleyen ayarları. - -Üye.Metrica bir web analitiği hizmetidir ve örnek veri kümesi tam işlevselliğini kapsamaz, bu nedenle oluşturmak için sadece iki tablo vardır: - -- `hits` hizmet kapsamındaki tüm web sitelerinde tüm kullanıcılar tarafından yapılan her eylem ile bir tablodur. -- `visits` bireysel eylemler yerine önceden oluşturulmuş oturumlar içeren bir tablodur. - -Bu tablolar için gerçek create table sorgularını görelim ve yürütelim: - -``` sql -CREATE TABLE tutorial.hits_v1 -( - `WatchID` UInt64, - `JavaEnable` UInt8, - `Title` String, - `GoodEvent` Int16, - `EventTime` DateTime, - `EventDate` Date, - `CounterID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RegionID` UInt32, - `UserID` UInt64, - `CounterClass` Int8, - `OS` UInt8, - `UserAgent` UInt8, - `URL` String, - `Referer` String, - `URLDomain` String, - `RefererDomain` String, - `Refresh` UInt8, - `IsRobot` UInt8, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `FlashMinor2` String, - `NetMajor` UInt8, - `NetMinor` UInt8, - `UserAgentMajor` UInt16, - `UserAgentMinor` FixedString(2), - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `MobilePhone` UInt8, - `MobilePhoneModel` String, - `Params` String, - `IPNetworkID` UInt32, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `IsArtifical` UInt8, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `ClientTimeZone` Int16, - `ClientEventTime` DateTime, - `SilverlightVersion1` UInt8, - `SilverlightVersion2` UInt8, - `SilverlightVersion3` UInt32, - `SilverlightVersion4` UInt16, - `PageCharset` String, - `CodeVersion` UInt32, - `IsLink` UInt8, - `IsDownload` UInt8, - `IsNotBounce` UInt8, - `FUniqID` UInt64, - `HID` UInt32, - `IsOldCounter` UInt8, - `IsEvent` UInt8, - `IsParameter` UInt8, - `DontCountHits` UInt8, - `WithHash` UInt8, - `HitColor` FixedString(1), - `UTCEventTime` DateTime, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `WindowName` Int32, - `OpenerName` Int32, - `HistoryLength` Int16, - `BrowserLanguage` FixedString(2), - `BrowserCountry` FixedString(2), - `SocialNetwork` String, - `SocialAction` String, - `HTTPError` UInt16, - `SendTiming` Int32, - `DNSTiming` Int32, - `ConnectTiming` Int32, - `ResponseStartTiming` Int32, - `ResponseEndTiming` Int32, - `FetchTiming` Int32, - `RedirectTiming` Int32, - `DOMInteractiveTiming` Int32, - `DOMContentLoadedTiming` Int32, - `DOMCompleteTiming` Int32, - `LoadEventStartTiming` Int32, - `LoadEventEndTiming` Int32, - `NSToDOMContentLoadedTiming` Int32, - `FirstPaintTiming` Int32, - `RedirectCount` Int8, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `ParamPrice` Int64, - `ParamOrderID` String, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `GoalsReached` Array(UInt32), - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `RefererHash` UInt64, - `URLHash` UInt64, - `CLID` UInt32, - `YCLID` UInt64, - `ShareService` String, - `ShareURL` String, - `ShareTitle` String, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `IslandID` FixedString(16), - `RequestNum` UInt32, - `RequestTry` UInt8 -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -``` sql -CREATE TABLE tutorial.visits_v1 -( - `CounterID` UInt32, - `StartDate` Date, - `Sign` Int8, - `IsNew` UInt8, - `VisitID` UInt64, - `UserID` UInt64, - `StartTime` DateTime, - `Duration` UInt32, - `UTCStartTime` DateTime, - `PageViews` Int32, - `Hits` Int32, - `IsBounce` UInt8, - `Referer` String, - `StartURL` String, - `RefererDomain` String, - `StartURLDomain` String, - `EndURL` String, - `LinkURL` String, - `IsDownload` UInt8, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `PlaceID` Int32, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `IsYandex` UInt8, - `GoalReachesDepth` Int32, - `GoalReachesURL` Int32, - `GoalReachesAny` Int32, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `MobilePhoneModel` String, - `ClientEventTime` DateTime, - `RegionID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `IPNetworkID` UInt32, - `SilverlightVersion3` UInt32, - `CodeVersion` UInt32, - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `UserAgentMajor` UInt16, - `UserAgentMinor` UInt16, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `SilverlightVersion2` UInt8, - `SilverlightVersion4` UInt16, - `FlashVersion3` UInt16, - `FlashVersion4` UInt16, - `ClientTimeZone` Int16, - `OS` UInt8, - `UserAgent` UInt8, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `NetMajor` UInt8, - `NetMinor` UInt8, - `MobilePhone` UInt8, - `SilverlightVersion1` UInt8, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `JavaEnable` UInt8, - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `BrowserLanguage` UInt16, - `BrowserCountry` UInt16, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `Params` Array(String), - `Goals` Nested( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32), - `WatchIDs` Array(UInt64), - `ParamSumPrice` Int64, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `ClickLogID` UInt64, - `ClickEventID` Int32, - `ClickGoodEvent` Int32, - `ClickEventTime` DateTime, - `ClickPriorityID` Int32, - `ClickPhraseID` Int32, - `ClickPageID` Int32, - `ClickPlaceID` Int32, - `ClickTypeID` Int32, - `ClickResourceID` Int32, - `ClickCost` UInt32, - `ClickClientIP` UInt32, - `ClickDomainID` UInt32, - `ClickURL` String, - `ClickAttempt` UInt8, - `ClickOrderID` UInt32, - `ClickBannerID` UInt32, - `ClickMarketCategoryID` UInt32, - `ClickMarketPP` UInt32, - `ClickMarketCategoryName` String, - `ClickMarketPPName` String, - `ClickAWAPSCampaignName` String, - `ClickPageName` String, - `ClickTargetType` UInt16, - `ClickTargetPhraseID` UInt64, - `ClickContextType` UInt8, - `ClickSelectType` Int8, - `ClickOptions` String, - `ClickGroupBannerID` Int32, - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `FirstVisit` DateTime, - `PredLastVisit` Date, - `LastVisit` Date, - `TotalVisits` UInt32, - `TraficSource` Nested( - ID Int8, - SearchEngineID UInt16, - AdvEngineID UInt8, - PlaceID UInt16, - SocialSourceNetworkID UInt8, - Domain String, - SearchPhrase String, - SocialSourcePage String), - `Attendance` FixedString(16), - `CLID` UInt32, - `YCLID` UInt64, - `NormalizedRefererHash` UInt64, - `SearchPhraseHash` UInt64, - `RefererDomainHash` UInt64, - `NormalizedStartURLHash` UInt64, - `StartURLDomainHash` UInt64, - `NormalizedEndURLHash` UInt64, - `TopLevelDomain` UInt64, - `URLScheme` UInt64, - `OpenstatServiceNameHash` UInt64, - `OpenstatCampaignIDHash` UInt64, - `OpenstatAdIDHash` UInt64, - `OpenstatSourceIDHash` UInt64, - `UTMSourceHash` UInt64, - `UTMMediumHash` UInt64, - `UTMCampaignHash` UInt64, - `UTMContentHash` UInt64, - `UTMTermHash` UInt64, - `FromHash` UInt64, - `WebVisorEnabled` UInt8, - `WebVisorActivity` UInt32, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `Market` Nested( - Type UInt8, - GoalID UInt32, - OrderID String, - OrderPrice Int64, - PP UInt32, - DirectPlaceID UInt32, - DirectOrderID UInt32, - DirectBannerID UInt32, - GoodID String, - GoodName String, - GoodQuantity Int32, - GoodPrice Int64), - `IslandID` FixedString(16) -) -ENGINE = CollapsingMergeTree(Sign) -PARTITION BY toYYYYMM(StartDate) -ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -Etkileşimli modunu kullanarak bu sorguları yürütebilirsiniz `clickhouse-client` (sadece önceden bir sorgu belirtmeden bir terminalde başlatın) veya bazı deneyin [alternatif arayüz](../interfaces/index.md) Eğer isterseniz. - -Gördüğümüz gibi, `hits_v1` kullanır [temel MergeTree motoru](../engines/table_engines/mergetree_family/mergetree.md), WH whileile the `visits_v1` kullanır [Çökme](../engines/table_engines/mergetree_family/collapsingmergetree.md) varyant. - -### Verileri İçe Aktar {#import-data} - -Clickhouse'a veri aktarımı yapılır [INSERT INTO](../sql_reference/statements/insert_into.md) diğer birçok SQL veritabanlarında olduğu gibi sorgu. Bununla birlikte, veriler genellikle [desteklenen seri hale getirme biçimleri](../interfaces/formats.md) yerine `VALUES` fıkra clausesı (ayrıca desteklenmektedir). - -Onları almak için ne kadar daha önce indirdiğimiz dosyaları sekme ayrılmış biçimde, yani burada konsol istemci ile : - -``` bash -clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv -clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv -``` - -ClickHouse bir yeri vardır [ayarlan settingsacak ayarlar](../operations/settings/index.md) ve bunları konsol istemcisinde belirtmenin bir yolu, görebildiğimiz gibi argümanlar aracılığıyla `--max_insert_block_size`. Hangi ayarların mevcut olduğunu, ne anlama geldiğini ve varsayılanların ne olduğunu anlamanın en kolay yolu `system.settings` Tablo: - -``` sql -SELECT name, value, changed, description -FROM system.settings -WHERE name LIKE '%max_insert_b%' -FORMAT TSV - -max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." -``` - -İsteğe bağlı olarak şunları yapabilirsiniz [OPTIMIZE](../sql_reference/statements/misc.md#misc_operations-optimize) ithalattan sonra tablolar. MergeTree-family'den bir motorla yapılandırılmış tablolar, veri depolamayı en iyi duruma getirmek (veya en azından mantıklı olup olmadığını kontrol etmek) için her zaman arka planda veri parçalarının birleştirilmesini sağlar. Bu sorgular, tablo motorunu bir süre sonra yerine şu anda depolama optimizasyonu yapmaya zorlar: - -``` bash -clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" -clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" -``` - -Bu sorgular bir G/Ç ve CPU yoğun işlem başlatır, bu nedenle tablo sürekli olarak yeni veriler alırsa, onu yalnız bırakmak ve birleştirmelerin arka planda çalışmasına izin vermek daha iyidir. - -Şimdi tablo ithalatının başarılı olup olmadığını kontrol edebiliriz: - -``` bash -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" -``` - -## Örnek Sorgular {#example-queries} - -``` sql -SELECT - StartURL AS URL, - AVG(Duration) AS AvgDuration -FROM tutorial.visits_v1 -WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' -GROUP BY URL -ORDER BY AvgDuration DESC -LIMIT 10 -``` - -``` sql -SELECT - sum(Sign) AS visits, - sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, - (100. * goal_visits) / visits AS goal_percent -FROM tutorial.visits_v1 -WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') -``` - -## Küme Dağıtımı {#cluster-deployment} - -ClickHouse kümesi homojen bir kümedir. Kurulum adımları: - -1. Kümenin tüm makinelerine ClickHouse Server'ı yükleyin -2. Yapılandırma dosyalarında küme yapılandırmalarını ayarlama -3. Her örnekte yerel tablolar oluşturun -4. Create a [Dağıtılmış tablo](../engines/table_engines/special/distributed.md) - -[Dağıtılmış tablo](../engines/table_engines/special/distributed.md) aslında bir tür “view” ClickHouse kümesinin yerel tablolarına. Dağıtılmış bir tablodan sorgu seçin, tüm kümenin parçalarının kaynaklarını kullanarak yürütür. Birden çok küme için yapılandırmalar belirtebilir ve farklı kümelere görünümler sağlayan birden çok dağıtılmış tablo oluşturabilirsiniz. - -Her biri bir kopya olan üç parçalı bir küme için örnek yapılandırma: - -``` xml - - - - - example-perftest01j.yandex.ru - 9000 - - - - - example-perftest02j.yandex.ru - 9000 - - - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -Daha fazla gösteri için, aynı ile yeni bir yerel tablo oluşturalım `CREATE TABLE` için kullandığımız sorgu `hits_v1` ama farklı bir tablo adı: - -``` sql -CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... -``` - -Kümenin yerel tablolarına bir görünüm sağlayan dağıtılmış bir tablo oluşturma: - -``` sql -CREATE TABLE tutorial.hits_all AS tutorial.hits_local -ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); -``` - -Yaygın bir uygulama, kümenin tüm makinelerinde benzer dağıtılmış tablolar oluşturmaktır. Kümenin herhangi bir makinesinde dağıtılmış sorguları çalıştırmaya izin verir. Ayrıca, belirli bir SELECT sorgusu için geçici dağıtılmış tablo oluşturmak için alternatif bir seçenek vardır [uzak](../sql_reference/table_functions/remote.md) tablo işlevi. - -Hadi koşalım [INSERT SELECT](../sql_reference/statements/insert_into.md) tabloyu birden çok sunucuya yaymak için dağıtılmış tabloya. - -``` sql -INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; -``` - -!!! warning "Bildirim" - Bu yaklaşım büyük tabloların parçalanması için uygun değildir. Ayrı bir araç var [clickhouse-fotokopi makinesi](../operations/utilities/clickhouse-copier.md) bu keyfi büyük tabloları yeniden parçalayabilir. - -Tahmin edebileceğiniz gibi, hesaplamalı olarak ağır sorgular, bir yerine 3 sunucu kullanıyorsa n kat daha hızlı çalışır. - -Bu durumda, 3 parçaya sahip bir küme kullandık ve her biri tek bir kopya içeriyor. - -Bir üretim ortamında esneklik sağlamak için, her bir parçanın birden çok kullanılabilirlik bölgesi veya veri merkezleri (veya en azından raflar) arasında yayılmış 2-3 kopya içermesi önerilir. ClickHouse yinelemeler sınırsız sayıda desteklediğini unutmayın. - -Üç yineleme içeren bir parça kümesi için örnek yapılandırma: - -``` xml - - ... - - - - example-perftest01j.yandex.ru - 9000 - - - example-perftest02j.yandex.ru - 9000 - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -Yerel çoğaltmayı etkinleştirmek için [ZooKeeper](http://zookeeper.apache.org/) gereklidir. ClickHouse tüm yinelemeler üzerinde veri tutarlılığı ilgilenir ve otomatik olarak hatadan sonra prosedürü geri çalışır. ZooKeeper kümesinin ayrı sunuculara dağıtılması önerilir(ClickHouse dahil başka hiçbir işlem çalışmaz). - -!!! note "Not" - ZooKeeper sıkı bir gereklilik değildir: bazı basit durumlarda, verileri uygulama kodunuzdan tüm kopyalara yazarak çoğaltabilirsiniz. Bu yaklaşım **değil** önerilen, bu durumda, ClickHouse tüm yinelemelerde veri tutarlılığını garanti edemez. Böylece başvurunuzun sorumluluğu haline gelir. - -Zookeeper konumları yapılandırma dosyasında belirtilir: - -``` xml - - - zoo01.yandex.ru - 2181 - - - zoo02.yandex.ru - 2181 - - - zoo03.yandex.ru - 2181 - - -``` - -Ayrıca, tablo oluşturulmasında kullanılan her bir parça ve kopyayı tanımlamak için makrolar ayarlamamız gerekir: - -``` xml - - 01 - 01 - -``` - -Yinelenmiş tablo oluşturma şu anda hiçbir yinelemeler varsa, yeni bir ilk yineleme örneği. Zaten canlı yinelemeler varsa, yeni yineleme varolan verileri klonlar. Önce tüm çoğaltılmış tablolar oluşturmak ve sonra veri eklemek için bir seçeneğiniz vardır. Başka bir seçenek, bazı yinelemeler oluşturmak ve veri ekleme sırasında veya sonrasında diğerlerini eklemektir. - -``` sql -CREATE TABLE tutorial.hits_replica (...) -ENGINE = ReplcatedMergeTree( - '/clickhouse_perftest/tables/{shard}/hits', - '{replica}' -) -... -``` - -Burada kullanıyoruz [ReplicatedMergeTree](../engines/table_engines/mergetree_family/replication.md) masa motoru. Parametrelerde, Shard ve çoğaltma tanımlayıcılarını içeren ZooKeeper yolunu belirtiyoruz. - -``` sql -INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; -``` - -Çoğaltma çok ana modda çalışır. Veriler herhangi bir kopyaya yüklenebilir ve sistem daha sonra otomatik olarak diğer örneklerle eşitler. Çoğaltma zaman uyumsuz olduğundan, belirli bir anda, tüm yinelemeler son eklenen verileri içerebilir. Veri alımına izin vermek için en az bir kopya olmalıdır. Diğerleri verileri senkronize eder ve tekrar aktif hale geldiklerinde tutarlılığı onarır. Bu yaklaşımın, yakın zamanda eklenen veri kaybı olasılığının düşük olmasına izin verdiğini unutmayın. - -[Orijinal makale](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/tr/guides/apply-catboost-model.md b/docs/tr/guides/apply-catboost-model.md new file mode 100644 index 00000000000..c60b35287e7 --- /dev/null +++ b/docs/tr/guides/apply-catboost-model.md @@ -0,0 +1,239 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 41 +toc_title: CatBoost Modellerini Uygulamak +--- + +# Clickhouse’da Bir Catboost Modeli Uygulamak {#applying-catboost-model-in-clickhouse} + +[CatBoost](https://catboost.ai) geliştirilen ücretsiz ve açık kaynak kodlu bir GRA anddi libraryent kütüphan aesidir. [Yandex](https://yandex.com/company/) makine öğrenimi için. + +Bu Talimatla, Sql’den model çıkarımı çalıştırarak Clickhouse’da önceden eğitilmiş modelleri uygulamayı öğreneceksiniz. + +Clickhouse’da bir CatBoost modeli uygulamak için: + +1. [Tablo oluşturma](#create-table). +2. [Verileri tabloya ekleme](#insert-data-to-table). +3. [Catboost’u Clickhouse’a entegre edin](#integrate-catboost-into-clickhouse) (İsteğe bağlı adım). +4. [SQL’DEN Model Çıkarımını çalıştırın](#run-model-inference). + +Eğitim CatBoost modelleri hakkında daha fazla bilgi için bkz [Eğitim ve uygulama modelleri](https://catboost.ai/docs/features/training.html#training). + +## Önkoşullar {#prerequisites} + +Eğer yoksa [Docker](https://docs.docker.com/install/) yine de yükleyin. + +!!! note "Not" + [Docker](https://www.docker.com) sistemin geri kalanından bir CatBoost ve ClickHouse kurulumunu izole eden kaplar oluşturmanıza olanak sağlayan bir yazılım platformudur. + +Bir CatBoost modeli uygulamadan önce: + +**1.** P pullull the [Docker görüntü](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) kayıt defter theinden: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +Kod, çalışma zamanı, kütüphaneler, ortam değişkenleri ve Yapılandırma Dosyaları: bu Docker görüntü catboost ve ClickHouse çalıştırmak için gereken her şeyi içerir. + +**2.** Docker görüntüsünün başarıyla çekildiğinden emin olun: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** Bu görüntüye dayalı bir Docker kabı başlatın: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. Tablo oluşturma {#create-table} + +Eğitim örneği için bir ClickHouse tablosu oluşturmak için: + +**1.** Etkileşimli modda ClickHouse konsol istemcisini başlatın: + +``` bash +$ clickhouse client +``` + +!!! note "Not" + Clickhouse sunucusu Docker kapsayıcısı içinde zaten çalışıyor. + +**2.** Komutu kullanarak tablo oluşturun: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** ClickHouse konsol istemcisinden çıkış: + +``` sql +:) exit +``` + +## 2. Verileri tabloya ekleme {#insert-data-to-table} + +Verileri eklemek için: + +**1.** Aşağıdaki komutu çalıştırın: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** Etkileşimli modda ClickHouse konsol istemcisini başlatın: + +``` bash +$ clickhouse client +``` + +**3.** Verilerin yüklendiğinden emin olun: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++-------+ +``` + +## 3. Catboost’u Clickhouse’a entegre edin {#integrate-catboost-into-clickhouse} + +!!! note "Not" + **İsteğe bağlı adım.** Docker görüntü catboost ve ClickHouse çalıştırmak için gereken her şeyi içerir. + +Catboost’u Clickhouse’a entegre etmek için: + +**1.** Değerlendirme kitaplığı oluşturun. + +Bir CatBoost modelini değerlendirmenin en hızlı yolu derlemedir `libcatboostmodel.` kitaplık. Kitaplığın nasıl oluşturulacağı hakkında daha fazla bilgi için bkz. [CatBoost belgeleri](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** Herhangi bir yerde ve herhangi bir adla yeni bir dizin oluşturun, örneğin, `data` ve oluşturulan kütüphaneyi içine koyun. Docker görüntüsü zaten kütüphaneyi içeriyor `data/libcatboostmodel.so`. + +**3.** Yapılandırma modeli için herhangi bir yerde ve herhangi bir adla yeni bir dizin oluşturun, örneğin, `models`. + +**4.** Örneğin, herhangi bir ada sahip bir model yapılandırma dosyası oluşturun, `models/amazon_model.xml`. + +**5.** Model yapılandırmasını açıklayın: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** Catboost yolunu ve model yapılandırmasını ClickHouse yapılandırmasına ekleyin: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. SQL’DEN Model Çıkarımını çalıştırın {#run-model-inference} + +Test modeli için ClickHouse istemcisini çalıştırın `$ clickhouse client`. + +Modelin çalıştığından emin olalım: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Not" + İşlev [modelEvaluate](../sql-reference/functions/other-functions.md#function-modelevaluate) multiclass modelleri için sınıf başına ham tahminleri ile tuple döndürür. + +Olasılığı tahmin edelim: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "Not" + Hakkında daha fazla bilgi [exp()](../sql-reference/functions/math-functions.md) işlev. + +Örnek üzerinde LogLoss hesaplayalım: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "Not" + Hakkında daha fazla bilgi [avg()](../sql-reference/aggregate-functions/reference.md#agg_function-avg) ve [günlük()](../sql-reference/functions/math-functions.md) işlevler. + +[Orijinal makale](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/tr/guides/apply_catboost_model.md b/docs/tr/guides/apply_catboost_model.md deleted file mode 100644 index 92bfac226f2..00000000000 --- a/docs/tr/guides/apply_catboost_model.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 41 -toc_title: CatBoost Modellerini Uygulamak ---- - -# Clickhouse'da bir Catboost modeli uygulamak {#applying-catboost-model-in-clickhouse} - -[CatBoost](https://catboost.ai) geliştirilen ücretsiz ve açık kaynak kodlu bir GRA anddi libraryent kütüphan aesidir. [Yandex](https://yandex.com/company/) makine öğrenimi için. - -Bu Talimatla, Sql'den model çıkarımı çalıştırarak Clickhouse'da önceden eğitilmiş modelleri uygulamayı öğreneceksiniz. - -Clickhouse'da bir CatBoost modeli uygulamak için: - -1. [Tablo oluşturma](#create-table). -2. [Verileri tabloya ekleme](#insert-data-to-table). -3. [Catboost'u Clickhouse'a entegre edin](#integrate-catboost-into-clickhouse) (İsteğe bağlı adım). -4. [SQL'DEN Model Çıkarımını çalıştırın](#run-model-inference). - -Eğitim CatBoost modelleri hakkında daha fazla bilgi için bkz [Eğitim ve uygulama modelleri](https://catboost.ai/docs/features/training.html#training). - -## Önkoşullar {#prerequisites} - -Eğer yoksa [Docker](https://docs.docker.com/install/) yine de yükleyin. - -!!! note "Not" - [Docker](https://www.docker.com) sistemin geri kalanından bir CatBoost ve ClickHouse kurulumunu izole eden kaplar oluşturmanıza olanak sağlayan bir yazılım platformudur. - -Bir CatBoost modeli uygulamadan önce: - -**1.** P pullull the [Docker görüntü](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) kayıt defter theinden: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -Kod, çalışma zamanı, kütüphaneler, ortam değişkenleri ve Yapılandırma Dosyaları: bu Docker görüntü catboost ve ClickHouse çalıştırmak için gereken her şeyi içerir. - -**2.** Docker görüntüsünün başarıyla çekildiğinden emin olun: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** Bu görüntüye dayalı bir Docker kabı başlatın: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. Tablo oluşturma {#create-table} - -Eğitim örneği için bir ClickHouse tablosu oluşturmak için: - -**1.** Etkileşimli modda ClickHouse konsol istemcisini başlatın: - -``` bash -$ clickhouse client -``` - -!!! note "Not" - Clickhouse sunucusu Docker kapsayıcısı içinde zaten çalışıyor. - -**2.** Komutu kullanarak tablo oluşturun: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** ClickHouse konsol istemcisinden çıkış: - -``` sql -:) exit -``` - -## 2. Verileri tabloya ekleme {#insert-data-to-table} - -Verileri eklemek için: - -**1.** Aşağıdaki komutu çalıştırın: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** Etkileşimli modda ClickHouse konsol istemcisini başlatın: - -``` bash -$ clickhouse client -``` - -**3.** Verilerin yüklendiğinden emin olun: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+-------+ -``` - -## 3. Catboost'u Clickhouse'a entegre edin {#integrate-catboost-into-clickhouse} - -!!! note "Not" - **İsteğe bağlı adım.** Docker görüntü catboost ve ClickHouse çalıştırmak için gereken her şeyi içerir. - -Catboost'u Clickhouse'a entegre etmek için: - -**1.** Değerlendirme kitaplığı oluşturun. - -Bir CatBoost modelini değerlendirmenin en hızlı yolu derlemedir `libcatboostmodel.` kitaplık. Kitaplığın nasıl oluşturulacağı hakkında daha fazla bilgi için bkz. [CatBoost belgeleri](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** Herhangi bir yerde ve herhangi bir adla yeni bir dizin oluşturun, örneğin, `data` ve oluşturulan kütüphaneyi içine koyun. Docker görüntüsü zaten kütüphaneyi içeriyor `data/libcatboostmodel.so`. - -**3.** Yapılandırma modeli için herhangi bir yerde ve herhangi bir adla yeni bir dizin oluşturun, örneğin, `models`. - -**4.** Örneğin, herhangi bir ada sahip bir model yapılandırma dosyası oluşturun, `models/amazon_model.xml`. - -**5.** Model yapılandırmasını açıklayın: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** Catboost yolunu ve model yapılandırmasını ClickHouse yapılandırmasına ekleyin: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. SQL'DEN Model Çıkarımını çalıştırın {#run-model-inference} - -Test modeli için ClickHouse istemcisini çalıştırın `$ clickhouse client`. - -Modelin çalıştığından emin olalım: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Not" - İşlev [modelEvaluate](../sql_reference/functions/other_functions.md#function-modelevaluate) multiclass modelleri için sınıf başına ham tahminleri ile tuple döndürür. - -Olasılığı tahmin edelim: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "Not" - Hakkında daha fazla bilgi [exp()](../sql_reference/functions/math_functions.md) işlev. - -Örnek üzerinde LogLoss hesaplayalım: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "Not" - Hakkında daha fazla bilgi [avg()](../sql_reference/aggregate_functions/reference.md#agg_function-avg) ve [günlük()](../sql_reference/functions/math_functions.md) işlevler. - -[Orijinal makale](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/tr/guides/index.md b/docs/tr/guides/index.md index 95ad65443b0..44e3910c026 100644 --- a/docs/tr/guides/index.md +++ b/docs/tr/guides/index.md @@ -10,7 +10,7 @@ toc_title: "Genel bak\u0131\u015F" ClickHouse kullanarak çeşitli görevleri çözmeye yardımcı olan ayrıntılı adım adım talimatların listesi: -- [Basit küme kurulumu eğitimi](../getting_started/tutorial.md) -- [Clickhouse'da bir CatBoost modeli uygulamak](apply_catboost_model.md) +- [Basit küme kurulumu eğitimi](../getting-started/tutorial.md) +- [Clickhouse’da bir CatBoost modeli uygulamak](apply-catboost-model.md) [Orijinal makale](https://clickhouse.tech/docs/en/guides/) diff --git a/docs/tr/index.md b/docs/tr/index.md index 5cbf9330750..9ac619a1f8d 100644 --- a/docs/tr/index.md +++ b/docs/tr/index.md @@ -3,32 +3,32 @@ toc_priority: 0 toc_title: "Genel bak\u0131\u015F" --- -# ClickHouse nedir? {#what-is-clickhouse} +# ClickHouse Nedir? {#what-is-clickhouse} ClickHouse, sorguların çevrimiçi analitik işlenmesi (*Online Analytical Processing* - OLAP) için sütun odaklı bir Veritabanı Yönetim Sistemidir (*DataBase Management System* - DBMS). “Normal” bir satır odaklı DBMS içinde veriler şu şekilde saklanır: -| Satır | WatchId | JavaEnable | Başlık | İyiOlay | OlayZamanı | -|-------|-------------|------------|----------------------|-----------|---------------------| -| \#0 | 89354350662 | 1 | Yatırımcı İlişkileri | 1 | 2016-05-18 05:19:20 | -| \#1 | 90329509958 | 0 | Bize ulaşın | 1 | 2016-05-18 08:10:20 | -| \#2 | 89953706054 | 1 | Görev | 1 | 2016-05-18 07:38:00 | -| \#N | … | … | … | … | … | +| Satır | WatchId | JavaEnable | Başlık | İyiOlay | OlayZamanı | +|-------|-------------|------------|----------------------|---------|---------------------| +| \#0 | 89354350662 | 1 | Yatırımcı İlişkileri | 1 | 2016-05-18 05:19:20 | +| \#1 | 90329509958 | 0 | Bize ulaşın | 1 | 2016-05-18 08:10:20 | +| \#2 | 89953706054 | 1 | Görev | 1 | 2016-05-18 07:38:00 | +| \#N | … | … | … | … | … | Başka bir deyişle, bir satırla ilgili tüm değerler fiziksel olarak yan yana depolanır. MySQL, Postgres ve MS SQL Server gibi veritabanları satır odaklı DBMS örnekleridir. -Sütun odaklı bir DBMS'de ise veriler şu şekilde saklanır: +Sütun odaklı bir DBMS’de ise veriler şu şekilde saklanır: | Satır: | \#0 | \#1 | \#2 | \#N | |-------------|----------------------|---------------------|---------------------|-----| | WatchId: | 89354350662 | 90329509958 | 89953706054 | … | | JavaEnable: | 1 | 0 | 1 | … | | Başlık: | Yatırımcı İlişkileri | Bize ulaşın | Görev | … | -| İyiOlay: | 1 | 1 | 1 | … | -| OlayZamanı: | 2016-05-18 05:19:20 | 2016-05-18 08:10:20 | 2016-05-18 07:38:00 | … | +| İyiOlay: | 1 | 1 | 1 | … | +| OlayZamanı: | 2016-05-18 05:19:20 | 2016-05-18 08:10:20 | 2016-05-18 07:38:00 | … | Bu örnekler yalnızca verilerin düzenlendiği sırayı gösterir. Farklı sütunlardaki değerler ayrı olarak depolanır ve aynı sütundaki veriler birlikte depolanır. @@ -38,13 +38,13 @@ Verinin farklı bir şekilde sıralanarak depolanması, bazı veri erişim senar Sistem üzerindeki yük ne kadar fazlaysa, sistem ayarlarının kullanım senaryolarına uyarlanması ve bu ayarların ne kadar hassas olduğu da o kadar önemli hale gelir. Birbirinden büyük ölçüde farklı olan veri erişim senaryolarına tam uyum sağlayan, yani her işe ve yüke gelen bir sistem yoktur. Eğer bir sistem yük altında her türlü veri erişim senaryosuna adapte olabiliyorsa, o halde böyle bir sistem ya tüm senaryolara ya da senaryoların bir veya birkaçına karşı zayıp bir performans gösterir. -## OLAP senaryosunun temel özellikleri {#key-properties-of-olap-scenario} +## OLAP Senaryosunun Temel özellikleri {#key-properties-of-olap-scenario} - İsteklerin büyük çoğunluğu, okuma erişimi içindir. - Veriler, tek satırlarla değil, oldukça büyük gruplar halinde (\> 1000 satır) güncellenir; veya hiç güncellenmez. - Veri, veritabanına eklenir, ancak değiştirilmez. - Bazı sorgular için veritabanından den oldukça fazla sayıda satır çekilir, ancak sonuç sadece birkaç satır ve sütunludur. -- Tablolar "geniştir", yani bir tabloda çok sayıda kolon vardır(onlarca). +- Tablolar “geniştir”, yani bir tabloda çok sayıda kolon vardır(onlarca). - Sorgular sıkılığı diğer senaryolara göre daha azdır (genellikle sunucu başına saniyede 100 veya daha az sorgu gelir). - Basit sorgular için, 50 ms civarında gecikmelere izin verilir. - Saklanan veriler oldukça küçüktür: genelde sadece sayılar ve kısa metinler içerir(örneğin, URL başına 60 bayt). @@ -52,27 +52,27 @@ Sistem üzerindeki yük ne kadar fazlaysa, sistem ayarlarının kullanım senary - Veri değiş-tokuşu(transaction) gerekli değildir. - Veri tutarlılığı o kadar da önemli değildir. - Genelde bir tane çok büyük tablo vardır, gerisi küçük tablolardan oluşur -- Bir sorgu sonucu elde edilen veri, okuanan veri miktarından oldukça küçüktür. Başka bir deyişle, milyarlarca satır içinden veriler süzgeçlenerek veya birleştirilerek elde edilen verilerin tek bir sunucunun RAM'ine sığar. +- Bir sorgu sonucu elde edilen veri, okuanan veri miktarından oldukça küçüktür. Başka bir deyişle, milyarlarca satır içinden veriler süzgeçlenerek veya birleştirilerek elde edilen verilerin tek bir sunucunun RAM’ine sığar. OLAP senaryosunun diğer popüler senaryolardan (*Online Transactional Processing* - OLTP veya *Key-Value* veritabanı) çok farklı olduğu açıkça görülebilir. Bu nedenle, iyi bir performans elde etmek istiyorsanız, analitik sorguları işlemek için OLTP veya *Key-Value* veritabanlarını kullanmak pek mantıklı olmaz. Örneğin, analitik için MongoDB veya Redis kullanmaya çalışırsanız, OLAP veritabanlarına kıyasla çok düşük performans elde edersiniz. -## Sütun yönelimli veritabanları OLAP senaryosunda neden daha iyi çalışır {#why-column-oriented-databases-work-better-in-the-olap-scenario} +## Sütun yönelimli veritabanları OLAP Senaryosunda Neden Daha Iyi çalışır {#why-column-oriented-databases-work-better-in-the-olap-scenario} Sütun yönelimli veritabanları OLAP senaryolarına daha uygundur: hatta o kadar ki, çoğu sorgunun işlenmesi en az 100 kat daha hızlıdır. Her ne kadar OLAP veritabanlarının neden bu kadar hızlı olduğuna dair nedenler aşağıda ayrıntılı verilmiş olsa da görseller üzerinden anlatmak daha kolay olacakttır: **Satır yönelimli DBMS** -![Row-oriented](images/row_oriented.gif#) +![Row-oriented](images/row-oriented.gif#) **Sütun yönelimli DBMS** -![Column-oriented](images/column_oriented.gif#) +![Column-oriented](images/column-oriented.gif#) Farkı görüyor musunuz? ### Giriş/çıkış {#inputoutput} -1. Analitik bir sorgu için, yalnızca az sayıda tablo sütununun okunması gerekir. Sütun yönelimli bir veritabanında, yalnızca ihtiyacınız olan verileri okuyabilirsiniz. Örneğin, 100 üzerinden 5 sütun gerekiyorsa, g/Ç'de 20 kat azalma bekleyebilirsiniz. +1. Analitik bir sorgu için, yalnızca az sayıda tablo sütununun okunması gerekir. Sütun yönelimli bir veritabanında, yalnızca ihtiyacınız olan verileri okuyabilirsiniz. Örneğin, 100 üzerinden 5 sütun gerekiyorsa, g/Ç’de 20 kat azalma bekleyebilirsiniz. 2. Veri paketler halinde okunduğundan, sıkıştırılması daha kolaydır. Sütunlardaki verilerin sıkıştırılması da daha kolaydır. Bu, G/Ç hacmini daha da azaltır. 3. Azaltılmış G/Ç nedeniyle, sistem önbelleğine daha fazla veri sığar. @@ -80,7 +80,7 @@ Farkı görüyor musunuz? ### CPU {#cpu} -Bir sorguyu yürütmek çok sayıda satırı işlemeyi gerektirdiğinden, ayrı satırlar yerine tüm vektörler için tüm işlemlerin gönderilmesine veya sorgu motorunun neredeyse hiç gönderim maliyeti olmaması için uygulanmasına yardımcı olur. Bunu yapmazsanız, yarı iyi bir disk alt sistemi ile, sorgu yorumlayıcısı kaçınılmaz olarak CPU'yu durdurur. Hem verileri sütunlarda depolamak hem de mümkün olduğunda sütunlarla işlemek mantıklıdır. +Bir sorguyu yürütmek çok sayıda satırı işlemeyi gerektirdiğinden, ayrı satırlar yerine tüm vektörler için tüm işlemlerin gönderilmesine veya sorgu motorunun neredeyse hiç gönderim maliyeti olmaması için uygulanmasına yardımcı olur. Bunu yapmazsanız, yarı iyi bir disk alt sistemi ile, sorgu yorumlayıcısı kaçınılmaz olarak CPU’yu durdurur. Hem verileri sütunlarda depolamak hem de mümkün olduğunda sütunlarla işlemek mantıklıdır. Bunu yapmanın iki yolu vardır: @@ -88,7 +88,7 @@ Bunu yapmanın iki yolu vardır: 2. Kod üretimi. Sorgu için oluşturulan kod, içindeki tüm dolaylı çağrılara sahiptir. -Bu yapılmaz “normal” veritabanları, çünkü basit sorguları çalıştırırken mantıklı değil. Ancak, istisnalar vardır. Örneğin, MemSQL SQL sorgularını işlerken gecikmeyi azaltmak için kod oluşturma kullanır. (Karşılaştırma için, analitik Dbms'ler gecikme değil, verim optimizasyonunu gerektirir .) +Bu yapılmaz “normal” veritabanları, çünkü basit sorguları çalıştırırken mantıklı değil. Ancak, istisnalar vardır. Örneğin, MemSQL SQL sorgularını işlerken gecikmeyi azaltmak için kod oluşturma kullanır. (Karşılaştırma için, analitik Dbms’ler gecikme değil, verim optimizasyonunu gerektirir .) CPU verimliliği için sorgu dilinin bildirimsel (SQL veya MDX) veya en az bir vektör (J, K) olması gerektiğini unutmayın. Sorgu yalnızca en iyi duruma getirme için izin veren örtük döngüler içermelidir. diff --git a/docs/tr/interfaces/cli.md b/docs/tr/interfaces/cli.md index c526105dfe7..4a28610e602 100644 --- a/docs/tr/interfaces/cli.md +++ b/docs/tr/interfaces/cli.md @@ -5,11 +5,11 @@ toc_priority: 17 toc_title: "Komut Sat\u0131r\u0131 \u0130stemcisi" --- -# Komut satırı istemcisi {#command-line-client} +# Komut satırı Istemcisi {#command-line-client} ClickHouse yerel bir komut satırı istemcisi sağlar: `clickhouse-client`. İstemci komut satırı seçeneklerini ve yapılandırma dosyalarını destekler. Daha fazla bilgi için, bkz. [Yapılandırma](#interfaces_cli_configuration). -[Yüklemek](../getting_started/index.md) ıt from the `clickhouse-client` paketleyin ve komutla çalıştırın `clickhouse-client`. +[Yüklemek](../getting-started/index.md) ıt from the `clickhouse-client` paketleyin ve komutla çalıştırın `clickhouse-client`. ``` bash $ clickhouse-client @@ -43,7 +43,7 @@ $ cat file.csv | clickhouse-client --database=test --query="INSERT INTO test FOR Toplu iş modunda, varsayılan veri biçimi TabSeparated. Sorgunun biçim yan tümcesinde biçimi ayarlayabilirsiniz. -Varsayılan olarak, yalnızca tek bir sorguyu toplu iş modunda işleyebilirsiniz. Birden çok sorgu yapmak için bir “script,” kullan... `--multiquery` parametre. Bu, INSERT dışındaki tüm sorgular için çalışır. Sorgu sonuçları, ek ayırıcılar olmadan ardışık olarak çıktılanır. Benzer şekilde, çok sayıda sorgu işlemek için, çalıştırabilirsiniz ‘clickhouse-client’ her sorgu için. Başlatmak için onlarca milisaniye sürebilir unutmayın ‘clickhouse-client’ program. +Varsayılan olarak, yalnızca tek bir sorguyu toplu iş modunda işleyebilirsiniz. Birden çok sorgu yapmak için bir “script,” kullan… `--multiquery` parametre. Bu, INSERT dışındaki tüm sorgular için çalışır. Sorgu sonuçları, ek ayırıcılar olmadan ardışık olarak çıktılanır. Benzer şekilde, çok sayıda sorgu işlemek için, çalıştırabilirsiniz ‘clickhouse-client’ her sorgu için. Başlatmak için onlarca milisaniye sürebilir unutmayın ‘clickhouse-client’ program. Etkileşimli modda, sorguları girebileceğiniz bir komut satırı alırsınız. @@ -72,7 +72,7 @@ Ctrl + C tuşlarına basarak uzun bir sorguyu iptal edebilirsiniz. ancak, sunucu Komut satırı istemcisi, sorgulamak için dış verileri (dış geçici tablolar) geçirmenize izin verir. Daha fazla bilgi için bölüme bakın “External data for query processing”. -### Parametrelerle sorgular {#cli-queries-with-parameters} +### Parametrelerle Sorgular {#cli-queries-with-parameters} Parametrelerle bir sorgu oluşturabilir ve istemci uygulamasından onlara değerler aktarabilirsiniz. Bu, istemci tarafında belirli dinamik değerlerle biçimlendirme sorgusunu önlemeye izin verir. Mesela: @@ -89,7 +89,7 @@ Bir sorguyu her zamanki gibi biçimlendirin, ardından uygulama parametrelerinde ``` - `name` — Placeholder identifier. In the console client it should be used in app parameters as `--param_ = value`. -- `data type` — [Veri türü](../sql_reference/data_types/index.md) app parametre değeri. Örneğin, aşağıdaki gibi bir veri yapısı `(integer, ('string', integer))` olabilir var `Tuple(UInt8, Tuple(String, UInt8))` veri türü (başka birini de kullanabilirsiniz [tamsayı](../sql_reference/data_types/int_uint.md) türler). +- `data type` — [Veri türü](../sql-reference/data-types/index.md) app parametre değeri. Örneğin, aşağıdaki gibi bir veri yapısı `(integer, ('string', integer))` olabilir var `Tuple(UInt8, Tuple(String, UInt8))` veri türü (başka birini de kullanabilirsiniz [tamsayı](../sql-reference/data-types/int-uint.md) türler). #### Örnek {#example} diff --git a/docs/tr/interfaces/formats.md b/docs/tr/interfaces/formats.md index f522d697aa1..cda944e9014 100644 --- a/docs/tr/interfaces/formats.md +++ b/docs/tr/interfaces/formats.md @@ -5,7 +5,7 @@ toc_priority: 21 toc_title: "Giri\u015F ve \xE7\u0131k\u0131\u015F bi\xE7imleri" --- -# Giriş ve çıkış verileri için biçimler {#formats} +# Giriş Ve çıkış Verileri için biçimler {#formats} ClickHouse kabul ve çeşitli biçimlerde veri dönebilirsiniz. Giriş için desteklenen bir biçim, sağlanan verileri ayrıştırmak için kullanılabilir `INSERT`s, gerçekleştirmek için `SELECT`s dosya, URL veya HDFS gibi bir dosya destekli tablodan veya harici bir sözlük okumak için. Çıktı için desteklenen bir biçim düzenlemek için kullanılabilir sonuçları bir `SELECT` ve gerçekleştirmek için `INSERT`s dosya destekli bir tabloya. @@ -55,7 +55,7 @@ Sekmede ayrı format, veri satır ile yazılır. Her satır sekmelerle ayrılmı Bu biçim adı altında da kullanılabilir `TSV`. -Bu `TabSeparated` format, özel programlar ve komut dosyaları kullanarak verileri işlemek için uygundur. Varsayılan olarak HTTP arabiriminde ve komut satırı istemcisinin toplu iş modunda kullanılır. Bu format aynı zamanda farklı Dbms'ler arasında veri aktarımı sağlar. Örneğin, Mysql'den bir dökümü alabilir ve Clickhouse'a yükleyebilirsiniz veya tam tersi. +Bu `TabSeparated` format, özel programlar ve komut dosyaları kullanarak verileri işlemek için uygundur. Varsayılan olarak HTTP arabiriminde ve komut satırı istemcisinin toplu iş modunda kullanılır. Bu format aynı zamanda farklı Dbms’ler arasında veri aktarımı sağlar. Örneğin, Mysql’den bir dökümü alabilir ve Clickhouse’a yükleyebilirsiniz veya tam tersi. Bu `TabSeparated` biçim, toplam değerleri (TOPLAMLARLA birlikte kullanıldığında) ve aşırı değerleri (ne zaman ‘extremes’ 1 olarak ayarlanır). Bu durumlarda, toplam değerler ve aşırılıklar ana veriden sonra çıkar. Ana sonuç, toplam değerler ve aşırılıklar birbirinden boş bir çizgi ile ayrılır. Örnek: @@ -110,9 +110,9 @@ Sadece küçük bir sembol seti kaçtı. Terminalinizin çıktıda mahvedeceği Diziler köşeli parantez içinde virgülle ayrılmış değerlerin bir listesi olarak yazılır. Dizideki sayı öğeleri normal olarak biçimlendirilir. `Date` ve `DateTime` türleri tek tırnak yazılır. Diz .eler yukarıdaki gibi aynı kural quoteslarla tek tırnak içinde yazılır. -[NULL](../sql_reference/syntax.md) olarak format islanır `\N`. +[NULL](../sql-reference/syntax.md) olarak format islanır `\N`. -Her eleman [İçiçe](../sql_reference/data_types/nested_data_structures/nested.md) yapılar dizi olarak temsil edilir. +Her eleman [İçiçe](../sql-reference/data-types/nested-data-structures/nested.md) yapılar dizi olarak temsil edilir. Mesela: @@ -207,7 +207,7 @@ Ayar `format_template_resultset` resultset için bir biçim dizesi içeren dosya - `bytes_read` bayt sayısı (sıkıştırılmamış) okundu mu Tutucu `data`, `totals`, `min` ve `max` kaç rulema kuralı belirtilm (em (elidir (veya `None` açıkça belirtilen) olmalıdır. Kalan yer tutucuları belirtilen kaçan herhangi bir kural olabilir. -Eğer... `format_template_resultset` ayar boş bir dizedir, `${data}` varsayılan değer olarak kullanılır. +Eğer… `format_template_resultset` ayar boş bir dizedir, `${data}` varsayılan değer olarak kullanılır. Insert sorguları biçimi için önek veya sonek varsa bazı sütunları veya bazı alanları atlamaya izin verir (örneğe bakın). Örnek seç: @@ -332,7 +332,7 @@ SearchPhrase=curtain designs count()=1064 SearchPhrase=baku count()=1000 ``` -[NULL](../sql_reference/syntax.md) olarak format islanır `\N`. +[NULL](../sql-reference/syntax.md) olarak format islanır `\N`. ``` sql SELECT * FROM t_null FORMAT TSKV @@ -342,7 +342,7 @@ SELECT * FROM t_null FORMAT TSKV x=1 y=\N ``` -Çok sayıda küçük sütun olduğunda, bu biçim etkisizdir ve genellikle kullanmak için hiçbir neden yoktur. Bununla birlikte, verimlilik açısından Jsoneachrow'dan daha kötü değildir. +Çok sayıda küçük sütun olduğunda, bu biçim etkisizdir ve genellikle kullanmak için hiçbir neden yoktur. Bununla birlikte, verimlilik açısından Jsoneachrow’dan daha kötü değildir. Both data output and parsing are supported in this format. For parsing, any order is supported for the values of different columns. It is acceptable for some values to be omitted – they are treated as equal to their default values. In this case, zeros and blank rows are used as default values. Complex values that could be specified in the table are not supported as defaults. @@ -352,7 +352,7 @@ Ayrıştırma, ek alanın varlığına izin verir `tskv` eşit işareti veya bir Virgülle ayrılmış değerler biçimi ([RFC](https://tools.ietf.org/html/rfc4180)). -Biçimlendirme yaparken, satırlar çift tırnak içine alınır. Bir dizenin içindeki çift alıntı, bir satırda iki çift tırnak olarak çıktılanır. Karakterlerden kaçmak için başka kural yoktur. Tarih ve Tarih-Saat çift tırnak içine alınır. Sayılar tırnak işaretleri olmadan çıktı. Değerler, bir sınırlayıcı karakterle ayrılır; `,` varsayılan olarak. Sınırlayıcı karakteri ayarında tanımlanır [format\_csv\_delimiter](../operations/settings/settings.md#settings-format_csv_delimiter). Satırlar Unıx satır besleme (LF) kullanılarak ayrılır. Diziler CSV'DE aşağıdaki gibi serileştirilir: ilk olarak, dizi TabSeparated biçiminde olduğu gibi bir dizeye serileştirilir ve daha sonra ortaya çıkan dize çift tırnak içinde CSV'YE çıkarılır. CSV biçimindeki Tuples ayrı sütunlar olarak serileştirilir(yani, tuple'daki yuvalanmaları kaybolur). +Biçimlendirme yaparken, satırlar çift tırnak içine alınır. Bir dizenin içindeki çift alıntı, bir satırda iki çift tırnak olarak çıktılanır. Karakterlerden kaçmak için başka kural yoktur. Tarih ve Tarih-Saat çift tırnak içine alınır. Sayılar tırnak işaretleri olmadan çıktı. Değerler, bir sınırlayıcı karakterle ayrılır; `,` varsayılan olarak. Sınırlayıcı karakteri ayarında tanımlanır [format\_csv\_delimiter](../operations/settings/settings.md#settings-format_csv_delimiter). Satırlar Unıx satır besleme (LF) kullanılarak ayrılır. Diziler CSV’DE aşağıdaki gibi serileştirilir: ilk olarak, dizi TabSeparated biçiminde olduğu gibi bir dizeye serileştirilir ve daha sonra ortaya çıkan dize çift tırnak içinde CSV’YE çıkarılır. CSV biçimindeki Tuples ayrı sütunlar olarak serileştirilir(yani, tuple’daki yuvalanmaları kaybolur). ``` bash $ clickhouse-client --format_csv_delimiter="|" --query="INSERT INTO test.csv FORMAT CSV" < data.csv @@ -360,7 +360,7 @@ $ clickhouse-client --format_csv_delimiter="|" --query="INSERT INTO test.csv FOR \* Varsayılan olarak, sınırlayıcı `,`. Görmek [format\_csv\_delimiter](../operations/settings/settings.md#settings-format_csv_delimiter) daha fazla bilgi için ayarlama. -Ayrıştırma yaparken, tüm değerler tırnak işaretleri ile veya tırnak işaretleri olmadan ayrıştırılabilir. Hem çift hem de tek tırnak desteklenmektedir. Satırlar tırnak işaretleri olmadan da düzenlenebilir. Bu durumda, sınırlayıcı karaktere veya satır beslemesine (CR veya LF) ayrıştırılır. RFC'Yİ ihlal ederken, satırları tırnak işaretleri olmadan ayrıştırırken, önde gelen ve sondaki boşluklar ve sekmeler göz ardı edilir. Hat beslemesi için Unix (LF), Windows (CR LF) ve Mac OS Classic (CR LF) türleri desteklenir. +Ayrıştırma yaparken, tüm değerler tırnak işaretleri ile veya tırnak işaretleri olmadan ayrıştırılabilir. Hem çift hem de tek tırnak desteklenmektedir. Satırlar tırnak işaretleri olmadan da düzenlenebilir. Bu durumda, sınırlayıcı karaktere veya satır beslemesine (CR veya LF) ayrıştırılır. RFC’Yİ ihlal ederken, satırları tırnak işaretleri olmadan ayrıştırırken, önde gelen ve sondaki boşluklar ve sekmeler göz ardı edilir. Hat beslemesi için Unix (LF), Windows (CR LF) ve Mac OS Classic (CR LF) türleri desteklenir. Boş unquoted giriş değerleri, ilgili sütunlar için varsayılan değerlerle değiştirilir [ınput\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) @@ -451,7 +451,7 @@ SELECT SearchPhrase, count() AS c FROM test.hits GROUP BY SearchPhrase WITH TOTA } ``` -Json JavaScript ile uyumludur. Bunu sağlamak için, bazı karakterler ek olarak kaçar: eğik çizgi `/` olarak kaç İsar `\/`; alternatif Satır sonları `U+2028` ve `U+2029`, hangi bazı tarayıcılar kırmak, olarak kaçtı `\uXXXX`. ASCII denetim karakterleri kaçtı: backspace, form besleme, satır besleme, satır başı ve yatay sekme ile değiştirilir `\b`, `\f`, `\n`, `\r`, `\t` , 00-1f aralığında kalan baytların yanı sıra `\uXXXX` sequences. Invalid UTF-8 sequences are changed to the replacement character � so the output text will consist of valid UTF-8 sequences. For compatibility with JavaScript, Int64 and UInt64 integers are enclosed in double-quotes by default. To remove the quotes, you can set the configuration parameter [output\_format\_json\_quote\_64bit\_integers](../operations/settings/settings.md#session_settings-output_format_json_quote_64bit_integers) 0'a. +Json JavaScript ile uyumludur. Bunu sağlamak için, bazı karakterler ek olarak kaçar: eğik çizgi `/` olarak kaç İsar `\/`; alternatif Satır sonları `U+2028` ve `U+2029`, hangi bazı tarayıcılar kırmak, olarak kaçtı `\uXXXX`. ASCII denetim karakterleri kaçtı: backspace, form besleme, satır besleme, satır başı ve yatay sekme ile değiştirilir `\b`, `\f`, `\n`, `\r`, `\t` , 00-1f aralığında kalan baytların yanı sıra `\uXXXX` sequences. Invalid UTF-8 sequences are changed to the replacement character � so the output text will consist of valid UTF-8 sequences. For compatibility with JavaScript, Int64 and UInt64 integers are enclosed in double-quotes by default. To remove the quotes, you can set the configuration parameter [output\_format\_json\_quote\_64bit\_integers](../operations/settings/settings.md#session_settings-output_format_json_quote_64bit_integers) 0’a. `rows` – The total number of output rows. @@ -464,13 +464,13 @@ Sorgu GROUP BY içeriyorsa, ROWS\_BEFORE\_LİMİT\_AT\_LEAST SINIRSIZDI olurdu s Bu biçim yalnızca bir sorgu sonucu çıktısı için uygundur, ancak ayrıştırma için değil (bir tabloya eklemek için veri alma). -ClickHouse destekler [NULL](../sql_reference/syntax.md) olarak görüntülenen `null` JSON çıkışında. +ClickHouse destekler [NULL](../sql-reference/syntax.md) olarak görüntülenen `null` JSON çıkışında. Ayrıca bakınız [JSONEachRow](#jsoneachrow) biçimli. ## JSONCompact {#jsoncompact} -Yalnızca veri satırlarında json'dan farklıdır, nesnelerde değil, dizilerde çıktıdır. +Yalnızca veri satırlarında json’dan farklıdır, nesnelerde değil, dizilerde çıktıdır. Örnek: @@ -541,7 +541,7 @@ ClickHouse, nesnelerden sonra öğeler ve virgüller arasındaki boşlukları yo **İhmal edilen değerler işleme** -ClickHouse, karşılık gelen değerler için varsayılan değerlerle atlanmış değerleri değiştirir [veri türleri](../sql_reference/data_types/index.md). +ClickHouse, karşılık gelen değerler için varsayılan değerlerle atlanmış değerleri değiştirir [veri türleri](../sql-reference/data-types/index.md). Eğer `DEFAULT expr` belirtilen, ClickHouse bağlı olarak farklı ikame kuralları kullanır [ınput\_format\_defaults\_for\_omitted\_fields](../operations/settings/settings.md#session_settings-input_format_defaults_for_omitted_fields) ayar. @@ -582,11 +582,11 @@ Sorgu `SELECT * FROM UserActivity FORMAT JSONEachRow` dönüşler: Aksine [JSON](#json) biçimi, geçersiz UTF-8 dizilerinin hiçbir ikame yoktur. Değerleri için olduğu gibi aynı şekilde kaçtı `JSON`. !!! note "Not" - Herhangi bir bayt kümesi dizelerde çıktı olabilir. Kullan... `JSONEachRow` tablodaki verilerin herhangi bir bilgi kaybetmeden JSON olarak biçimlendirilebileceğinden eminseniz biçimlendirin. + Herhangi bir bayt kümesi dizelerde çıktı olabilir. Kullan… `JSONEachRow` tablodaki verilerin herhangi bir bilgi kaybetmeden JSON olarak biçimlendirilebileceğinden eminseniz biçimlendirin. ### İç içe yapıların kullanımı {#jsoneachrow-nested} -İle bir tablo varsa [İçiçe](../sql_reference/data_types/nested_data_structures/nested.md) veri türü sütunları, aynı yapıya sahip json verilerini ekleyebilirsiniz. İle bu özelliği etkinleştirin [ınput\_format\_ımport\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) ayar. +İle bir tablo varsa [İçiçe](../sql-reference/data-types/nested-data-structures/nested.md) veri türü sütunları, aynı yapıya sahip json verilerini ekleyebilirsiniz. İle bu özelliği etkinleştirin [ınput\_format\_ımport\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) ayar. Örneğin, aşağıdaki tabloyu göz önünde bulundurun: @@ -645,7 +645,7 @@ SELECT * FROM json_each_row_nested ## Yerel {#native} -En verimli biçim. Veriler ikili formatta bloklar tarafından yazılır ve okunur. Her blok için satır sayısı, sütun sayısı, sütun adları ve türleri ve bu bloktaki sütunların parçaları birbiri ardına kaydedilir. Başka bir deyişle, bu format “columnar” – it doesn't convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. +En verimli biçim. Veriler ikili formatta bloklar tarafından yazılır ve okunur. Her blok için satır sayısı, sütun sayısı, sütun adları ve türleri ve bu bloktaki sütunların parçaları birbiri ardına kaydedilir. Başka bir deyişle, bu format “columnar” – it doesn’t convert columns to rows. This is the format used in the native interface for interaction between servers, for using the command-line client, and for C++ clients. Bu biçimi, yalnızca ClickHouse DBMS tarafından okunabilen dökümleri hızlı bir şekilde oluşturmak için kullanabilirsiniz. Bu formatla kendiniz çalışmak mantıklı değil. @@ -660,7 +660,7 @@ Verileri Unicode-art tabloları olarak çıkarır, ayrıca TERMİNALDEKİ renkle Tablonun tam bir ızgarası çizilir ve her satır terminalde iki satır kaplar. Her sonuç bloğu ayrı bir tablo olarak çıktı. Bu, blokların arabelleğe alma sonuçları olmadan çıkabilmesi için gereklidir (tüm değerlerin görünür genişliğini önceden hesaplamak için arabelleğe alma gerekli olacaktır). -[NULL](../sql_reference/syntax.md) olarak çıktı `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) olarak çıktı `ᴺᵁᴸᴸ`. Örnek (gösterilen [PrettyCompact](#prettycompact) biçimli): @@ -686,7 +686,7 @@ SELECT 'String with \'quotes\' and \t character' AS Escaping_test └──────────────────────────────────────┘ ``` -Terminale çok fazla veri boşaltmaktan kaçınmak için yalnızca ilk 10.000 satır yazdırılır. Satır sayısı 10.000'den büyük veya eşitse, ileti “Showed first 10 000” bas .ılmıştır. +Terminale çok fazla veri boşaltmaktan kaçınmak için yalnızca ilk 10.000 satır yazdırılır. Satır sayısı 10.000’den büyük veya eşitse, ileti “Showed first 10 000” bas .ılmıştır. Bu biçim yalnızca bir sorgu sonucu çıktısı için uygundur, ancak ayrıştırma için değil (bir tabloya eklemek için veri alma). Güzel biçim, toplam değerleri (TOPLAMLARLA birlikte kullanıldığında) ve aşırılıkları (ne zaman ‘extremes’ 1 olarak ayarlanır). Bu durumlarda, toplam değerler ve aşırı değerler ana veriden sonra ayrı tablolarda çıktılanır. Örnek (gösterilen [PrettyCompact](#prettycompact) biçimli): @@ -764,9 +764,9 @@ FixedString sadece bir bayt dizisi olarak temsil edilir. Dizi varint uzunluğu (imzasız) olarak temsil edilir [LEB128](https://en.wikipedia.org/wiki/LEB128)), ardından dizinin ardışık elemanları. -İçin [NULL](../sql_reference/syntax.md#null-literal) destek, 1 veya 0 içeren ek bir bayt her önce eklenir [Nullable](../sql_reference/data_types/nullable.md) değer. 1 ise, o zaman değer `NULL` ve bu bayt ayrı bir değer olarak yorumlanır. 0 ise, bayttan sonraki değer değil `NULL`. +İçin [NULL](../sql-reference/syntax.md#null-literal) destek, 1 veya 0 içeren ek bir bayt her önce eklenir [Nullable](../sql-reference/data-types/nullable.md) değer. 1 ise, o zaman değer `NULL` ve bu bayt ayrı bir değer olarak yorumlanır. 0 ise, bayttan sonraki değer değil `NULL`. -## Rowbinarywithnames ve türleri {#rowbinarywithnamesandtypes} +## Rowbinarywithnames Ve türleri {#rowbinarywithnamesandtypes} Benzer [RowBinary](#rowbinary), ancak eklenen Başlık ile: @@ -776,7 +776,7 @@ Benzer [RowBinary](#rowbinary), ancak eklenen Başlık ile: ## Değerler {#data-format-values} -Her satırı parantez içinde yazdırır. Satırlar virgülle ayrılır. Son satırdan sonra virgül yok. Parantez içindeki değerler de virgülle ayrılır. Sayılar tırnak işaretleri olmadan ondalık biçimde çıktıdır. Diziler köşeli parantez içinde çıktı. Kat tırnak içinde çıkış dizelerle, tarihleri ve tarihleri. Kaçan kurallar ve ayrıştırma benzer [TabSeparated](#tabseparated) biçimli. Biçimlendirme sırasında fazladan boşluk eklenmez, ancak ayrıştırma sırasında izin verilir ve atlanır (izin verilmeyen dizi değerleri içindeki boşluklar hariç). [NULL](../sql_reference/syntax.md) olarak temsil edilir `NULL`. +Her satırı parantez içinde yazdırır. Satırlar virgülle ayrılır. Son satırdan sonra virgül yok. Parantez içindeki değerler de virgülle ayrılır. Sayılar tırnak işaretleri olmadan ondalık biçimde çıktıdır. Diziler köşeli parantez içinde çıktı. Kat tırnak içinde çıkış dizelerle, tarihleri ve tarihleri. Kaçan kurallar ve ayrıştırma benzer [TabSeparated](#tabseparated) biçimli. Biçimlendirme sırasında fazladan boşluk eklenmez, ancak ayrıştırma sırasında izin verilir ve atlanır (izin verilmeyen dizi değerleri içindeki boşluklar hariç). [NULL](../sql-reference/syntax.md) olarak temsil edilir `NULL`. The minimum set of characters that you need to escape when passing data in Values ​​format: single quotes and backslashes. @@ -788,7 +788,7 @@ Ayrıca bakınız: [ınput\_format\_values\_interpret\_expressions](../operation Her değeri belirtilen sütun adıyla ayrı bir satıra yazdırır. Bu biçim, her satır çok sayıda sütundan oluşuyorsa, yalnızca bir veya birkaç satır yazdırmak için uygundur. -[NULL](../sql_reference/syntax.md) olarak çıktı `ᴺᵁᴸᴸ`. +[NULL](../sql-reference/syntax.md) olarak çıktı `ᴺᵁᴸᴸ`. Örnek: @@ -897,9 +897,9 @@ Diziler olarak çıktı `HelloWorld...` ## CapnProto {#capnproto} -Cap'n Proto, Protokol Tamponlarına ve tasarrufuna benzer, ancak JSON veya MessagePack gibi olmayan bir ikili mesaj biçimidir. +Cap’n Proto, Protokol Tamponlarına ve tasarrufuna benzer, ancak JSON veya MessagePack gibi olmayan bir ikili mesaj biçimidir. -Cap'n Proto mesajları kesinlikle yazılır ve kendi kendini tanımlamaz, yani harici bir şema açıklamasına ihtiyaç duyarlar. Şema anında uygulanır ve her sorgu için önbelleğe alınır. +Cap’n Proto mesajları kesinlikle yazılır ve kendi kendini tanımlamaz, yani harici bir şema açıklamasına ihtiyaç duyarlar. Şema anında uygulanır ve her sorgu için önbelleğe alınır. ``` bash $ cat capnproto_messages.bin | clickhouse-client --query "INSERT INTO test.hits FORMAT CapnProto SETTINGS format_schema='schema:Message'" @@ -948,7 +948,7 @@ message MessageType { }; ``` -İletişim kuralı arabellekleri' ileti türü Tablo sütunları ve alanları arasındaki yazışmaları bulmak için clickhouse adlarını karşılaştırır. +İletişim kuralı arabellekleri’ ileti türü Tablo sütunları ve alanları arasındaki yazışmaları bulmak için clickhouse adlarını karşılaştırır. Bu karşılaştırma büyük / küçük harf duyarsız ve karakterler `_` (alt çizgi) ve `.` (nokta) eşit olarak kabul edilir. Bir sütun türleri ve protokol arabellekleri ileti alanı farklıysa, gerekli dönüştürme uygulanır. @@ -967,7 +967,7 @@ message MessageType { ``` ClickHouse adlı bir sütun bulmaya çalışır `x.y.z` (veya `x_y_z` veya `X.y_Z` ve benzeri). -İç içe mesajlar giriş veya çıkış a için uygundur [iç içe veri yapıları](../sql_reference/data_types/nested_data_structures/nested.md). +İç içe mesajlar giriş veya çıkış a için uygundur [iç içe veri yapıları](../sql-reference/data-types/nested-data-structures/nested.md). Böyle bir protobuf şemasında tanımlanan varsayılan değerler @@ -979,7 +979,7 @@ message MessageType { } ``` -uygulan ;mamaktadır; [tablo varsayılanları](../sql_reference/statements/create.md#create-default-values) bunların yerine kullanılır. +uygulan ;mamaktadır; [tablo varsayılanları](../sql-reference/statements/create.md#create-default-values) bunların yerine kullanılır. ClickHouse girişleri ve çıkışları protobuf mesajları `length-delimited` biçimli. Bu, her mesajın uzunluğunu bir olarak yazmadan önce anlamına gelir [varint](https://developers.google.com/protocol-buffers/docs/encoding#varints). @@ -987,29 +987,29 @@ Ayrıca bakınız [popüler dillerde uzunlukla ayrılmış protobuf mesajları n ## Avro {#data-format-avro} -[Apache Avro](http://avro.apache.org/) Apache'nin Hadoop projesi kapsamında geliştirilen satır odaklı veri serileştirme çerçevesidir. +[Apache Avro](http://avro.apache.org/) Apache’nin Hadoop projesi kapsamında geliştirilen satır odaklı veri serileştirme çerçevesidir. ClickHouse Avro biçimi okuma ve yazma destekler [Avro veri dosyaları](http://avro.apache.org/docs/current/spec.html#Object+Container+Files). ### Veri Türleri Eşleştirme {#data_types-matching} -Aşağıdaki tablo, desteklenen veri türlerini ve Clickhouse'la nasıl eşleştiğini gösterir [veri türleri](../sql_reference/data_types/index.md) içinde `INSERT` ve `SELECT` sorgular. +Aşağıdaki tablo, desteklenen veri türlerini ve Clickhouse’la nasıl eşleştiğini gösterir [veri türleri](../sql-reference/data-types/index.md) içinde `INSERT` ve `SELECT` sorgular. | Avro veri türü `INSERT` | ClickHouse veri türü | Avro veri türü `SELECT` | |---------------------------------------------|-------------------------------------------------------------------------------------------------------------------|------------------------------| -| `boolean`, `int`, `long`, `float`, `double` | [Int(8/16/32)](../sql_reference/data_types/int_uint.md), [Uİnt(8/16/32)](../sql_reference/data_types/int_uint.md) | `int` | -| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql_reference/data_types/int_uint.md), [Uİnt64](../sql_reference/data_types/int_uint.md) | `long` | -| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql_reference/data_types/float.md) | `float` | -| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql_reference/data_types/float.md) | `double` | -| `bytes`, `string`, `fixed`, `enum` | [Dize](../sql_reference/data_types/string.md) | `bytes` | -| `bytes`, `string`, `fixed` | [FixedString(N)](../sql_reference/data_types/fixedstring.md) | `fixed(N)` | -| `enum` | [Enum (8/16)](../sql_reference/data_types/enum.md) | `enum` | -| `array(T)` | [Dizi(T)](../sql_reference/data_types/array.md) | `array(T)` | -| `union(null, T)`, `union(T, null)` | [Null (T)](../sql_reference/data_types/date.md) | `union(null, T)` | -| `null` | [Null (Hiçbir Şey)](../sql_reference/data_types/special_data_types/nothing.md) | `null` | -| `int (date)` \* | [Tarihli](../sql_reference/data_types/date.md) | `int (date)` \* | -| `long (timestamp-millis)` \* | [DateTime64 (3)](../sql_reference/data_types/datetime.md) | `long (timestamp-millis)` \* | -| `long (timestamp-micros)` \* | [DateTime64 (6)](../sql_reference/data_types/datetime.md) | `long (timestamp-micros)` \* | +| `boolean`, `int`, `long`, `float`, `double` | [Int(8/16/32)](../sql-reference/data-types/int-uint.md), [Uİnt(8/16/32)](../sql-reference/data-types/int-uint.md) | `int` | +| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql-reference/data-types/int-uint.md), [Uİnt64](../sql-reference/data-types/int-uint.md) | `long` | +| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql-reference/data-types/float.md) | `float` | +| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql-reference/data-types/float.md) | `double` | +| `bytes`, `string`, `fixed`, `enum` | [Dize](../sql-reference/data-types/string.md) | `bytes` | +| `bytes`, `string`, `fixed` | [FixedString(N)](../sql-reference/data-types/fixedstring.md) | `fixed(N)` | +| `enum` | [Enum (8/16)](../sql-reference/data-types/enum.md) | `enum` | +| `array(T)` | [Dizi(T)](../sql-reference/data-types/array.md) | `array(T)` | +| `union(null, T)`, `union(T, null)` | [Null (T)](../sql-reference/data-types/date.md) | `union(null, T)` | +| `null` | [Null (Hiçbir Şey)](../sql-reference/data-types/special-data-types/nothing.md) | `null` | +| `int (date)` \* | [Tarihli](../sql-reference/data-types/date.md) | `int (date)` \* | +| `long (timestamp-millis)` \* | [DateTime64 (3)](../sql-reference/data-types/datetime.md) | `long (timestamp-millis)` \* | +| `long (timestamp-micros)` \* | [DateTime64 (6)](../sql-reference/data-types/datetime.md) | `long (timestamp-micros)` \* | \* [Avro mantıksal türleri](http://avro.apache.org/docs/current/spec.html#Logical+Types) @@ -1030,7 +1030,7 @@ Giriş Avro dosyasının kök şeması olmalıdır `record` tür. ClickHouse tablo sütunları ve Avro şema alanları arasındaki yazışmaları bulmak için adlarını karşılaştırır. Bu karşılaştırma büyük / küçük harf duyarlıdır. Kullanılmayan alanlar atlanır. -ClickHouse tablo sütunlarının veri türleri, eklenen Avro verilerinin karşılık gelen alanlarından farklı olabilir. Veri eklerken, ClickHouse veri türlerini yukarıdaki tabloya göre yorumlar ve sonra [döküm](../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) karşılık gelen sütun türüne veri. +ClickHouse tablo sütunlarının veri türleri, eklenen Avro verilerinin karşılık gelen alanlarından farklı olabilir. Veri eklerken, ClickHouse veri türlerini yukarıdaki tabloya göre yorumlar ve sonra [döküm](../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) karşılık gelen sütun türüne veri. ### Veri Seçme {#selecting-data-1} @@ -1055,7 +1055,7 @@ Her Avro iletisi, şema Kayıt defterinin yardımıyla gerçek şemaya çözüle Şemalar çözüldükten sonra önbelleğe alınır. -Şema kayıt defteri URL'si ile yapılandırılır [format\_avro\_schema\_registry\_url](../operations/settings/settings.md#settings-format_avro_schema_registry_url) +Şema kayıt defteri URL’si ile yapılandırılır [format\_avro\_schema\_registry\_url](../operations/settings/settings.md#settings-format_avro_schema_registry_url) ### Veri Türleri Eşleştirme {#data_types-matching-1} @@ -1072,7 +1072,7 @@ $ kafkacat -b kafka-broker -C -t topic1 -o beginning -f '%s' -c 3 | clickhouse- 3 c ``` -Kullanmak `AvroConfluent` ile [Kafka](../engines/table_engines/integrations/kafka.md): +Kullanmak `AvroConfluent` ile [Kafka](../engines/table-engines/integrations/kafka.md): ``` sql CREATE TABLE topic1_stream @@ -1101,25 +1101,25 @@ SELECT * FROM topic1_stream; ### Veri Türleri Eşleştirme {#data_types-matching-2} -Aşağıdaki tablo, desteklenen veri türlerini ve Clickhouse'la nasıl eşleştiğini gösterir [veri türleri](../sql_reference/data_types/index.md) içinde `INSERT` ve `SELECT` sorgular. +Aşağıdaki tablo, desteklenen veri türlerini ve Clickhouse’la nasıl eşleştiğini gösterir [veri türleri](../sql-reference/data-types/index.md) içinde `INSERT` ve `SELECT` sorgular. | Parke veri türü (`INSERT`) | ClickHouse veri türü | Parke veri türü (`SELECT`) | |----------------------------|-----------------------------------------------------------|----------------------------| -| `UINT8`, `BOOL` | [Uİnt8](../sql_reference/data_types/int_uint.md) | `UINT8` | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | `INT8` | -| `UINT16` | [Uınt16](../sql_reference/data_types/int_uint.md) | `UINT16` | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | `INT16` | -| `UINT32` | [Uİnt32](../sql_reference/data_types/int_uint.md) | `UINT32` | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | `INT32` | -| `UINT64` | [Uİnt64](../sql_reference/data_types/int_uint.md) | `UINT64` | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | `INT64` | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | `FLOAT` | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | `DOUBLE` | -| `DATE32` | [Tarihli](../sql_reference/data_types/date.md) | `UINT16` | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | `UINT32` | -| `STRING`, `BINARY` | [Dize](../sql_reference/data_types/string.md) | `STRING` | -| — | [FixedString](../sql_reference/data_types/fixedstring.md) | `STRING` | -| `DECIMAL` | [Ondalık](../sql_reference/data_types/decimal.md) | `DECIMAL` | +| `UINT8`, `BOOL` | [Uİnt8](../sql-reference/data-types/int-uint.md) | `UINT8` | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | `INT8` | +| `UINT16` | [Uınt16](../sql-reference/data-types/int-uint.md) | `UINT16` | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | `INT16` | +| `UINT32` | [Uİnt32](../sql-reference/data-types/int-uint.md) | `UINT32` | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | `INT32` | +| `UINT64` | [Uİnt64](../sql-reference/data-types/int-uint.md) | `UINT64` | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | `INT64` | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | `FLOAT` | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | `DOUBLE` | +| `DATE32` | [Tarihli](../sql-reference/data-types/date.md) | `UINT16` | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | `UINT32` | +| `STRING`, `BINARY` | [Dize](../sql-reference/data-types/string.md) | `STRING` | +| — | [FixedString](../sql-reference/data-types/fixedstring.md) | `STRING` | +| `DECIMAL` | [Ondalık](../sql-reference/data-types/decimal.md) | `DECIMAL` | ClickHouse yapılandırılabilir hassas destekler `Decimal` tür. Bu `INSERT` sorgu parke davranır `DECIMAL` ClickHouse olarak yazın `Decimal128` tür. @@ -1127,7 +1127,7 @@ Desteklen datameyen veri türleri: `DATE32`, `TIME32`, `FIXED_SIZE_BINARY`, `JSO ClickHouse tablo sütunlarının veri türleri, eklenen parke verilerinin ilgili alanlarından farklı olabilir. Veri eklerken, ClickHouse veri türlerini yukarıdaki tabloya göre yorumlar ve sonra [döküm](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) ClickHouse tablo sütunu için ayarlanmış olan bu veri türüne ait veriler. -### Veri ekleme ve seçme {#inserting-and-selecting-data} +### Veri Ekleme Ve seçme {#inserting-and-selecting-data} Bir dosyadan parke verilerini ClickHouse tablosuna aşağıdaki komutla ekleyebilirsiniz: @@ -1141,38 +1141,38 @@ Bir ClickHouse tablosundan veri seçin ve aşağıdaki komutla parke formatında $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_file.pq} ``` -Hadoop ile veri alışverişi yapmak için şunları kullanabilirsiniz [HDFS tablo motoru](../engines/table_engines/integrations/hdfs.md). +Hadoop ile veri alışverişi yapmak için şunları kullanabilirsiniz [HDFS tablo motoru](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} -[Apache ORCC](https://orc.apache.org/) hadoop ekosisteminde yaygın bir sütunlu depolama biçimidir. Bu formatta yalnızca Clickhouse'a veri ekleyebilirsiniz. +[Apache ORCC](https://orc.apache.org/) hadoop ekosisteminde yaygın bir sütunlu depolama biçimidir. Bu formatta yalnızca Clickhouse’a veri ekleyebilirsiniz. ### Veri Türleri Eşleştirme {#data_types-matching-3} -Aşağıdaki tablo, desteklenen veri türlerini ve Clickhouse'la nasıl eşleştiğini gösterir [veri türleri](../sql_reference/data_types/index.md) içinde `INSERT` sorgular. +Aşağıdaki tablo, desteklenen veri türlerini ve Clickhouse’la nasıl eşleştiğini gösterir [veri türleri](../sql-reference/data-types/index.md) içinde `INSERT` sorgular. | Orc veri türü (`INSERT`) | ClickHouse veri türü | |--------------------------|-----------------------------------------------------| -| `UINT8`, `BOOL` | [Uİnt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [Uınt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [Uİnt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [Uİnt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | -| `DATE32` | [Tarihli](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [DateTime](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [Dize](../sql_reference/data_types/string.md) | -| `DECIMAL` | [Ondalık](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [Uİnt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [Uınt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [Uİnt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [Uİnt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | +| `DATE32` | [Tarihli](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [DateTime](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [Dize](../sql-reference/data-types/string.md) | +| `DECIMAL` | [Ondalık](../sql-reference/data-types/decimal.md) | ClickHouse yapılandırılabilir hassas destekler `Decimal` tür. Bu `INSERT` sorgu Orc davranır `DECIMAL` ClickHouse olarak yazın `Decimal128` tür. Desteklenmeyen Orc veri türleri: `DATE32`, `TIME32`, `FIXED_SIZE_BINARY`, `JSON`, `UUID`, `ENUM`. -ClickHouse tablo sütunlarının veri türlerinin karşılık gelen ORC veri alanları ile eşleşmesi gerekmez. Veri eklerken, ClickHouse veri türlerini yukarıdaki tabloya göre yorumlar ve sonra [döküm](../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) veri türü için veri kümesi ClickHouse tablo sütun. +ClickHouse tablo sütunlarının veri türlerinin karşılık gelen ORC veri alanları ile eşleşmesi gerekmez. Veri eklerken, ClickHouse veri türlerini yukarıdaki tabloya göre yorumlar ve sonra [döküm](../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) veri türü için veri kümesi ClickHouse tablo sütun. ### Veri Ekleme {#inserting-data-2} @@ -1182,7 +1182,7 @@ Bir dosyadan Orc verilerini ClickHouse tablosuna aşağıdaki komutla ekleyebili $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -Hadoop ile veri alışverişi yapmak için şunları kullanabilirsiniz [HDFS tablo motoru](../engines/table_engines/integrations/hdfs.md). +Hadoop ile veri alışverişi yapmak için şunları kullanabilirsiniz [HDFS tablo motoru](../engines/table-engines/integrations/hdfs.md). ## Biçim Şeması {#formatschema} @@ -1198,7 +1198,7 @@ mutlak bir yol veya istemci üzerinde geçerli dizine göre bir yol içerebilir. Eğer istemci kullanıyorsanız [Toplu Modu](../interfaces/cli.md#cli_usage), şemanın yolu güvenlik nedeniyle göreceli olmalıdır. Eğer giriş veya çıkış veri üzerinden [HTTP arayüzü](../interfaces/http.md) biçim şemasında belirtilen dosya adı -belirtilen dizinde bulunmalıdır [format\_schema\_path](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) +belirtilen dizinde bulunmalıdır [format\_schema\_path](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) sunucu yapılandırmasında. ## Atlama Hataları {#skippingerrors} diff --git a/docs/tr/interfaces/http.md b/docs/tr/interfaces/http.md index a30e05418c8..a5ba5183743 100644 --- a/docs/tr/interfaces/http.md +++ b/docs/tr/interfaces/http.md @@ -7,11 +7,11 @@ toc_title: "HTTP aray\xFCz\xFC" # HTTP arayüzü {#http-interface} -HTTP arayüzü, herhangi bir programlama dilinden herhangi bir platformda Clickhouse'u kullanmanızı sağlar. Java ve Perl'den ve kabuk komut dosyalarından çalışmak için kullanıyoruz. Diğer bölümlerde, HTTP arayüzü Perl, Python ve Go'dan kullanılır. HTTP arabirimi yerel arabirimden daha sınırlıdır, ancak daha iyi uyumluluğa sahiptir. +HTTP arayüzü, herhangi bir programlama dilinden herhangi bir platformda Clickhouse’u kullanmanızı sağlar. Java ve Perl’den ve kabuk komut dosyalarından çalışmak için kullanıyoruz. Diğer bölümlerde, HTTP arayüzü Perl, Python ve Go’dan kullanılır. HTTP arabirimi yerel arabirimden daha sınırlıdır, ancak daha iyi uyumluluğa sahiptir. Varsayılan olarak, clickhouse-server, 8123 numaralı bağlantı noktasında HTTP dinler (bu, yapılandırmada değiştirilebilir). -Parametreler olmadan bir GET / request yaparsanız, 200 yanıt kodunu ve tanımlanan dizeyi döndürür [http\_server\_default\_response](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-http_server_default_response) varsayılan değer “Ok.” (sonunda bir çizgi besleme ile) +Parametreler olmadan bir GET / request yaparsanız, 200 yanıt kodunu ve tanımlanan dizeyi döndürür [http\_server\_default\_response](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-http_server_default_response) varsayılan değer “Ok.” (sonunda bir çizgi besleme ile) ``` bash $ curl 'http://localhost:8123/' @@ -25,7 +25,7 @@ $ curl 'http://localhost:8123/ping' Ok. ``` -İsteği URL olarak gönder ‘query’ parametre veya bir POST olarak. Veya sorgunun başlangıcını gönder ‘query’ parametre ve postadaki geri kalanı (bunun neden gerekli olduğunu daha sonra açıklayacağız). URL'nin boyutu 16 KB ile sınırlıdır, bu nedenle büyük sorgular gönderirken bunu aklınızda bulundurun. +İsteği URL olarak gönder ‘query’ parametre veya bir POST olarak. Veya sorgunun başlangıcını gönder ‘query’ parametre ve postadaki geri kalanı (bunun neden gerekli olduğunu daha sonra açıklayacağız). URL’nin boyutu 16 KB ile sınırlıdır, bu nedenle büyük sorgular gönderirken bunu aklınızda bulundurun. Başarılı olursa, 200 yanıt Kodu ve yanıt gövdesinde sonucu alırsınız. Bir hata oluşursa, 500 yanıt Kodu ve yanıt gövdesinde bir hata açıklaması metni alırsınız. @@ -53,7 +53,7 @@ X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","writ 1 ``` -Gördüğünüz gibi, curl, boşlukların URL'den kaçması gerektiği konusunda biraz rahatsız edici. +Gördüğünüz gibi, curl, boşlukların URL’den kaçması gerektiği konusunda biraz rahatsız edici. Her ne kadar wget her şeyden kaçsa da, onu kullanmanızı önermiyoruz çünkü keep-alive ve Transfer-Encoding: chunked kullanırken HTTP 1.1 üzerinde iyi çalışmıyor. ``` bash @@ -89,7 +89,7 @@ $ echo 'SELECT 1 FORMAT Pretty' | curl 'http://localhost:8123/?' --data-binary @ └───┘ ``` -Ekleme sorguları için veri iletmenin POST yöntemi gereklidir. Bu durumda, URL parametresinde sorgunun başlangıcını yazabilir ve eklemek için verileri iletmek için POST'u kullanabilirsiniz. Eklenecek veriler, örneğin Mysql'den sekmeyle ayrılmış bir döküm olabilir. Bu şekilde, INSERT sorgusu MYSQL'DEN load DATA LOCAL INFİLE'IN yerini alır. +Ekleme sorguları için veri iletmenin POST yöntemi gereklidir. Bu durumda, URL parametresinde sorgunun başlangıcını yazabilir ve eklemek için verileri iletmek için POST’u kullanabilirsiniz. Eklenecek veriler, örneğin Mysql’den sekmeyle ayrılmış bir döküm olabilir. Bu şekilde, INSERT sorgusu MYSQL’DEN load DATA LOCAL INFİLE’IN yerini alır. Örnekler: tablo oluşturma: @@ -149,10 +149,10 @@ Veri tablosu döndürmeyen başarılı istekler için boş bir yanıt gövdesi d Veri iletirken dahili ClickHouse sıkıştırma formatını kullanabilirsiniz. Sıkıştırılmış veriler standart olmayan bir biçime sahiptir ve özel `clickhouse-compressor` onunla çalışmak için program (bu ile yüklü `clickhouse-client` paket). Veri ekleme verimliliğini artırmak için, sunucu tarafı sağlama toplamı doğrulamasını kullanarak devre dışı bırakabilirsiniz. [http\_native\_compression\_disable\_checksumming\_on\_decompress](../operations/settings/settings.md#settings-http_native_compression_disable_checksumming_on_decompress) ayar. -Belirt ift ifiyseniz `compress=1` URL'de, sunucu size gönderdiği verileri sıkıştırır. -Belirt ift ifiyseniz `decompress=1` URL'de, sunucu içinde geçirdiğiniz aynı verileri açar. `POST` yöntem. +Belirt ift ifiyseniz `compress=1` URL’de, sunucu size gönderdiği verileri sıkıştırır. +Belirt ift ifiyseniz `decompress=1` URL’de, sunucu içinde geçirdiğiniz aynı verileri açar. `POST` yöntem. -Ayrıca kullanmayı seçebilirsiniz [HTTP sıkıştırma](https://en.wikipedia.org/wiki/HTTP_compression). Sıkıştırılmış bir göndermek için `POST` istek, istek başlığını Ekle `Content-Encoding: compression_method`. Clickhouse'un yanıtı sıkıştırması için şunları eklemelisiniz `Accept-Encoding: compression_method`. ClickHouse destekler `gzip`, `br`, ve `deflate` [sıkıştırma yöntemleri](https://en.wikipedia.org/wiki/HTTP_compression#Content-Encoding_tokens). HTTP sıkıştırmasını etkinleştirmek için Clickhouse'u kullanmanız gerekir [enable\_http\_compression](../operations/settings/settings.md#settings-enable_http_compression) ayar. Veri sıkıştırma düzeyini [http\_zlib\_compression\_level](#settings-http_zlib_compression_level) tüm sıkıştırma yöntemleri için ayarlama. +Ayrıca kullanmayı seçebilirsiniz [HTTP sıkıştırma](https://en.wikipedia.org/wiki/HTTP_compression). Sıkıştırılmış bir göndermek için `POST` istek, istek başlığını Ekle `Content-Encoding: compression_method`. Clickhouse’un yanıtı sıkıştırması için şunları eklemelisiniz `Accept-Encoding: compression_method`. ClickHouse destekler `gzip`, `br`, ve `deflate` [sıkıştırma yöntemleri](https://en.wikipedia.org/wiki/HTTP_compression#Content-Encoding_tokens). HTTP sıkıştırmasını etkinleştirmek için Clickhouse’u kullanmanız gerekir [enable\_http\_compression](../operations/settings/settings.md#settings-enable_http_compression) ayar. Veri sıkıştırma düzeyini [http\_zlib\_compression\_level](#settings-http_zlib_compression_level) tüm sıkıştırma yöntemleri için ayarlama. Bunu, büyük miktarda veri iletirken ağ trafiğini azaltmak veya hemen sıkıştırılmış dökümler oluşturmak için kullanabilirsiniz. @@ -275,7 +275,7 @@ $ curl -sS 'http://localhost:8123/?max_result_bytes=4000000&buffer_size=3000000& Yanıt Kodu ve HTTP üstbilgileri istemciye gönderildikten sonra bir sorgu işleme hatası oluştu durumları önlemek için arabelleğe alma kullanın. Bu durumda, yanıt gövdesinin sonunda bir hata iletisi yazılır ve istemci tarafında hata yalnızca ayrıştırma aşamasında algılanabilir. -### Parametrelerle sorgular {#cli-queries-with-parameters} +### Parametrelerle Sorgular {#cli-queries-with-parameters} Parametrelerle bir sorgu oluşturabilir ve karşılık gelen HTTP istek parametrelerinden onlar için değerler geçirebilirsiniz. Daha fazla bilgi için, bkz. [CLI için parametrelerle sorgular](cli.md#cli-queries-with-parameters). @@ -285,7 +285,7 @@ Parametrelerle bir sorgu oluşturabilir ve karşılık gelen HTTP istek parametr $ curl -sS "
?param_id=2¶m_phrase=test" -d "SELECT * FROM table WHERE int_column = {id:UInt8} and string_column = {phrase:String}" ``` -## Önceden tanımlanmış HTTP arabirimi {#predefined_http_interface} +## Önceden tanımlanmış HTTP Arabirimi {#predefined_http_interface} ClickHouse HTTP arabirimi üzerinden belirli sorguları destekler. Örneğin, bir tabloya aşağıdaki gibi veri yazabilirsiniz: @@ -367,7 +367,7 @@ curl -vvv 'http://localhost:8123/metrics' `` kök yolu isteği için belirtilen içeriği döndürür. Belirli dönüş içeriği tarafından yapılandırılır `http_server_default_response` config.xml. belirtilmemişse, iade **Tamam.** -`http_server_default_response` tanımlanmadı ve Clickhouse'a bir HTTP isteği gönderildi. Sonuç aşağıdaki gibidir: +`http_server_default_response` tanımlanmadı ve Clickhouse’a bir HTTP isteği gönderildi. Sonuç aşağıdaki gibidir: ``` xml @@ -378,7 +378,7 @@ curl -vvv 'http://localhost:8123/metrics' $ curl 'http://localhost:8123' Ok. -`http_server_default_response` tanımlanır ve Clickhouse'a bir HTTP isteği gönderilir. Sonuç aşağıdaki gibidir: +`http_server_default_response` tanımlanır ve Clickhouse’a bir HTTP isteği gönderilir. Sonuç aşağıdaki gibidir: ``` xml
]]>
@@ -393,7 +393,7 @@ curl -vvv 'http://localhost:8123/metrics' ## ping\_handler {#ping_handler} -`` geçerli ClickHouse sunucusunun durumunu araştırmak için kullanılabilir. ClickHouse HTTP Sunucusu normal olduğunda, Clickhouse'a erişme `` dön willecektir **Tamam.**. +`` geçerli ClickHouse sunucusunun durumunu araştırmak için kullanılabilir. ClickHouse HTTP Sunucusu normal olduğunda, Clickhouse’a erişme `` dön willecektir **Tamam.**. Örnek: @@ -440,7 +440,7 @@ Yapılandırabilirsiniz ``, ``, `` ve `` içinde `` HTTP isteğinin yöntem bölümünü eşleştirmekten sorumludur. `` tam tanımına uygundur [yöntem](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) HTTP protokolünde. İsteğe bağlı bir yapılandırmadır. Yapılandırma dosyasında tanımlanmamışsa, HTTP isteğinin yöntem kısmıyla eşleşmez -`` HTTP isteğinin url bölümünü eşleştirmekten sorumludur. İle uyumludur [RE2](https://github.com/google/re2)'In düzenli ifadeleri. İsteğe bağlı bir yapılandırmadır. Yapılandırma dosyasında tanımlanmamışsa, HTTP isteğinin url kısmıyla eşleşmez +`` HTTP isteğinin url bölümünü eşleştirmekten sorumludur. İle uyumludur [RE2](https://github.com/google/re2)’In düzenli ifadeleri. İsteğe bağlı bir yapılandırmadır. Yapılandırma dosyasında tanımlanmamışsa, HTTP isteğinin url kısmıyla eşleşmez `` HTTP isteğinin başlık kısmını eşleştirmekten sorumludur. Bu re2 düzenli ifadeler ile uyumludur. İsteğe bağlı bir yapılandırmadır. Yapılandırma dosyasında tanımlanmamışsa, HTTP isteğinin başlık kısmıyla eşleşmez @@ -482,7 +482,7 @@ max_alter_threads 2 `` göre `` artmak `` . -ClickHouse ayıklar ve karşılık gelen değeri yürütür `` HTTP isteğinin url'sindeki değer. +ClickHouse ayıklar ve karşılık gelen değeri yürütür `` HTTP isteğinin url’sindeki değer. ClickHouse varsayılan ayarı `` oluyor `/query` . İsteğe bağlı bir yapılandırmadır. Yapılandırma dosyasında tanım yoksa, param iletilmez. Bu işlevselliği denemek için örnek max\_threads ve max\_alter\_threads değerlerini tanımlar ve ayarların başarıyla ayarlanıp ayarlanmadığını sorgular. diff --git a/docs/tr/interfaces/index.md b/docs/tr/interfaces/index.md index 6a89d8cce7e..d80ea8d8f57 100644 --- a/docs/tr/interfaces/index.md +++ b/docs/tr/interfaces/index.md @@ -8,7 +8,7 @@ toc_title: "Giri\u015F" # Arabirimler {#interfaces} -ClickHouse iki ağ arabirimi sağlar (Her ikisi de isteğe bağlı olarak ek güvenlik için TLS'YE sarılabilir): +ClickHouse iki ağ arabirimi sağlar (Her ikisi de isteğe bağlı olarak ek güvenlik için TLS’YE sarılabilir): - [HTTP](http.md), belgelenmiş ve doğrudan kullanımı kolay olan. - [Yerel TCP](tcp.md) daha az yükü olan. @@ -22,7 +22,7 @@ ClickHouse iki ağ arabirimi sağlar (Her ikisi de isteğe bağlı olarak ek gü ClickHouse ile çalışmak için çok çeşitli üçüncü taraf kütüphaneleri de vardır: -- [İstemci kitaplıkları](third-party/client_libraries.md) +- [İstemci kitaplıkları](third-party/client-libraries.md) - [Entegrasyonlar](third-party/integrations.md) - [Görsel arayüzler](third-party/gui.md) diff --git a/docs/tr/interfaces/mysql.md b/docs/tr/interfaces/mysql.md index 4e60430f554..97658803589 100644 --- a/docs/tr/interfaces/mysql.md +++ b/docs/tr/interfaces/mysql.md @@ -7,7 +7,7 @@ toc_title: "MySQL Aray\xFCz\xFC" # MySQL Arayüzü {#mysql-interface} -ClickHouse MySQL Tel protokolünü destekler. Tarafından etkinleştir canilebilir [mysql\_port](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) yapılandırma dosyasında ayarlama: +ClickHouse MySQL Tel protokolünü destekler. Tarafından etkinleştir canilebilir [mysql\_port](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) yapılandırma dosyasında ayarlama: ``` xml 9004 @@ -37,8 +37,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -Tüm MySQL istemcileri ile uyumluluk için, kullanıcı parolasını belirtmeniz önerilir [çift SHA1](../operations/settings/settings_users.md#password_double_sha1_hex) yapılandırma dosyasında. -Kullanarak kullanıcı şifresi belirt ifilirse [SHA256](../operations/settings/settings_users.md#password_sha256_hex), bazı istemciler (mysqljs ve komut satırı aracı mysql eski sürümleri) kimlik doğrulaması mümkün olmayacaktır. +Tüm MySQL istemcileri ile uyumluluk için, kullanıcı parolasını belirtmeniz önerilir [çift SHA1](../operations/settings/settings-users.md#password_double_sha1_hex) yapılandırma dosyasında. +Kullanarak kullanıcı şifresi belirt ifilirse [SHA256](../operations/settings/settings-users.md#password_sha256_hex), bazı istemciler (mysqljs ve komut satırı aracı mysql eski sürümleri) kimlik doğrulaması mümkün olmayacaktır. Kısıtlama: diff --git a/docs/tr/interfaces/tcp.md b/docs/tr/interfaces/tcp.md index b1f712efd7d..b5382ae8ec3 100644 --- a/docs/tr/interfaces/tcp.md +++ b/docs/tr/interfaces/tcp.md @@ -5,7 +5,7 @@ toc_priority: 18 toc_title: Yerel arabirim (TCP) --- -# Yerel arabirim (TCP) {#native-interface-tcp} +# Yerel Arabirim (TCP) {#native-interface-tcp} Yerel protokol kullanılır [komut satırı istemcisi](cli.md), dağıtılmış sorgu işleme sırasında ve ayrıca diğer C++ programlarında sunucular arası iletişim için. Ne yazık ki, yerel ClickHouse protokolü henüz resmi bir spesifikasyona sahip değildir, ancak ClickHouse kaynak kodundan ters mühendislik yapılabilir (başlangıç [bu civarda](https://github.com/ClickHouse/ClickHouse/tree/master/src/Client)) ve / veya TCP trafiğini ele alarak ve analiz ederek. diff --git a/docs/tr/interfaces/third-party/client-libraries.md b/docs/tr/interfaces/third-party/client-libraries.md new file mode 100644 index 00000000000..a676cec9885 --- /dev/null +++ b/docs/tr/interfaces/third-party/client-libraries.md @@ -0,0 +1,59 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 26 +toc_title: "\u0130stemci Kitapl\u0131klar\u0131" +--- + +# Üçüncü Taraf geliştiricilerin Istemci kitaplıkları {#client-libraries-from-third-party-developers} + +!!! warning "Uyarı" + Yandex yapar **değil** Aşağıda listelenen kütüphaneleri koruyun ve kalitelerini sağlamak için kapsamlı bir test yapmadınız. + +- Piton + - [ınfi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm) + - [clickhouse-sürücü](https://github.com/mymarilyn/clickhouse-driver) + - [clickhouse-müşteri](https://github.com/yurial/clickhouse-client) + - [aiochclient](https://github.com/maximdanilchenko/aiochclient) +- PHP + - [smı2/phpclickhouse](https://packagist.org/packages/smi2/phpClickHouse) + - [8bitov / clickhouse-php-client](https://packagist.org/packages/8bitov/clickhouse-php-client) + - [bozerkins / clickhouse-müşteri](https://packagist.org/packages/bozerkins/clickhouse-client) + - [simpod / clickhouse-müşteri](https://packagist.org/packages/simpod/clickhouse-client) + - [seva-code / php-click-house-client](https://packagist.org/packages/seva-code/php-click-house-client) + - [SeasClick c ++ istemcisi](https://github.com/SeasX/SeasClick) +- Gitmek + - [clickhouse](https://github.com/kshvakov/clickhouse/) + - [git-clickhouse](https://github.com/roistat/go-clickhouse) + - [mailrugo-clickhouse](https://github.com/mailru/go-clickhouse) + - [golang-clickhouse](https://github.com/leprosus/golang-clickhouse) +- NodeJs + - [NodeJs) clickhouse)](https://github.com/TimonKK/clickhouse) + - [düğüm-clickhouse](https://github.com/apla/node-clickhouse) +- Per perll + - [perl-DBD-ClickHouse](https://github.com/elcamlost/perl-DBD-ClickHouse) + - [HTTP-ClickHouse](https://metacpan.org/release/HTTP-ClickHouse) + - [AnyEvent-ClickHouse](https://metacpan.org/release/AnyEvent-ClickHouse) +- Yakut + - [ClickHouse (Ruby)](https://github.com/shlima/click_house) + - [clickhouse-activerecord](https://github.com/PNixx/clickhouse-activerecord) +- R + - [clickhouse-r](https://github.com/hannesmuehleisen/clickhouse-r) + - [RClickHouse](https://github.com/IMSMWU/RClickHouse) +- Java + - [clickhouse-client-java](https://github.com/VirtusAI/clickhouse-client-java) + - [clickhouse-müşteri](https://github.com/Ecwid/clickhouse-client) +- SC scalaala + - [clickhouse-Scala-istemci](https://github.com/crobox/clickhouse-scala-client) +- Kotlin + - [AORM](https://github.com/TanVD/AORM) +- C\# + - [ClickHouse.Gürültü](https://github.com/killwort/ClickHouse-Net) + - [ClickHouse.Müşteri](https://github.com/DarkWanderer/ClickHouse.Client) + - [ClickHouse.Net](https://github.com/ilyabreev/ClickHouse.Net) +- İksir + - [clickhousex](https://github.com/appodeal/clickhousex/) +- Nim + - [nim-clickhouse](https://github.com/leonardoce/nim-clickhouse) + +[Orijinal makale](https://clickhouse.tech/docs/en/interfaces/third-party/client_libraries/) diff --git a/docs/tr/interfaces/third-party/client_libraries.md b/docs/tr/interfaces/third-party/client_libraries.md deleted file mode 100644 index 2b89b1c4520..00000000000 --- a/docs/tr/interfaces/third-party/client_libraries.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 26 -toc_title: "\u0130stemci Kitapl\u0131klar\u0131" ---- - -# Üçüncü taraf geliştiricilerin istemci kitaplıkları {#client-libraries-from-third-party-developers} - -!!! warning "Uyarı" - Yandex yapar **değil** Aşağıda listelenen kütüphaneleri koruyun ve kalitelerini sağlamak için kapsamlı bir test yapmadınız. - -- Piton - - [ınfi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm) - - [clickhouse-sürücü](https://github.com/mymarilyn/clickhouse-driver) - - [clickhouse-müşteri](https://github.com/yurial/clickhouse-client) - - [aiochclient](https://github.com/maximdanilchenko/aiochclient) -- PHP - - [smı2/phpclickhouse](https://packagist.org/packages/smi2/phpClickHouse) - - [8bitov / clickhouse-php-client](https://packagist.org/packages/8bitov/clickhouse-php-client) - - [bozerkins / clickhouse-müşteri](https://packagist.org/packages/bozerkins/clickhouse-client) - - [simpod / clickhouse-müşteri](https://packagist.org/packages/simpod/clickhouse-client) - - [seva-code / php-click-house-client](https://packagist.org/packages/seva-code/php-click-house-client) - - [SeasClick c ++ istemcisi](https://github.com/SeasX/SeasClick) -- Gitmek - - [clickhouse](https://github.com/kshvakov/clickhouse/) - - [git-clickhouse](https://github.com/roistat/go-clickhouse) - - [mailrugo-clickhouse](https://github.com/mailru/go-clickhouse) - - [golang-clickhouse](https://github.com/leprosus/golang-clickhouse) -- NodeJs - - [NodeJs) clickhouse)](https://github.com/TimonKK/clickhouse) - - [düğüm-clickhouse](https://github.com/apla/node-clickhouse) -- Per perll - - [perl-DBD-ClickHouse](https://github.com/elcamlost/perl-DBD-ClickHouse) - - [HTTP-ClickHouse](https://metacpan.org/release/HTTP-ClickHouse) - - [AnyEvent-ClickHouse](https://metacpan.org/release/AnyEvent-ClickHouse) -- Yakut - - [ClickHouse (Ruby)](https://github.com/shlima/click_house) - - [clickhouse-activerecord](https://github.com/PNixx/clickhouse-activerecord) -- R - - [clickhouse-r](https://github.com/hannesmuehleisen/clickhouse-r) - - [RClickHouse](https://github.com/IMSMWU/RClickHouse) -- Java - - [clickhouse-client-java](https://github.com/VirtusAI/clickhouse-client-java) - - [clickhouse-müşteri](https://github.com/Ecwid/clickhouse-client) -- SC scalaala - - [clickhouse-Scala-istemci](https://github.com/crobox/clickhouse-scala-client) -- Kotlin - - [AORM](https://github.com/TanVD/AORM) -- C\# - - [ClickHouse.Gürültü](https://github.com/killwort/ClickHouse-Net) - - [ClickHouse.Müşteri](https://github.com/DarkWanderer/ClickHouse.Client) - - [ClickHouse.Net](https://github.com/ilyabreev/ClickHouse.Net) -- İksir - - [clickhousex](https://github.com/appodeal/clickhousex/) -- Nim - - [nim-clickhouse](https://github.com/leonardoce/nim-clickhouse) - -[Orijinal makale](https://clickhouse.tech/docs/en/interfaces/third-party/client_libraries/) diff --git a/docs/tr/interfaces/third-party/gui.md b/docs/tr/interfaces/third-party/gui.md index cb41103563d..91bd1e399de 100644 --- a/docs/tr/interfaces/third-party/gui.md +++ b/docs/tr/interfaces/third-party/gui.md @@ -5,7 +5,7 @@ toc_priority: 28 toc_title: "G\xF6rsel Aray\xFCzler" --- -# Üçüncü taraf geliştiricilerin görsel arayüzleri {#visual-interfaces-from-third-party-developers} +# Üçüncü Taraf geliştiricilerin görsel arayüzleri {#visual-interfaces-from-third-party-developers} ## Açık Kaynak {#open-source} @@ -103,7 +103,7 @@ ClickHouse dahil olmak üzere birden fazla veri kaynağı için destekler, Redas - Çok hızlı kod tamamlama. - ClickHouse sözdizimi vurgulama. -- Clickhouse'a özgü özellikler için destek, örneğin iç içe geçmiş sütunlar, tablo motorları. +- Clickhouse’a özgü özellikler için destek, örneğin iç içe geçmiş sütunlar, tablo motorları. - Veri Editörü. - Refactorings. - Arama ve navigasyon. diff --git a/docs/tr/interfaces/third-party/integrations.md b/docs/tr/interfaces/third-party/integrations.md index 2216e68a4c4..a076a5e2558 100644 --- a/docs/tr/interfaces/third-party/integrations.md +++ b/docs/tr/interfaces/third-party/integrations.md @@ -5,7 +5,7 @@ toc_priority: 27 toc_title: Entegrasyonlar --- -# Üçüncü taraf geliştiricilerin entegrasyon kütüphaneleri {#integration-libraries-from-third-party-developers} +# Üçüncü Taraf geliştiricilerin Entegrasyon kütüphaneleri {#integration-libraries-from-third-party-developers} !!! warning "Uyarı" Yandex yapar **değil** Aşağıda listelenen araçları ve kütüphaneleri koruyun ve kalitelerini sağlamak için kapsamlı bir test yapmadınız. @@ -42,7 +42,7 @@ toc_title: Entegrasyonlar - [graphouse](https://github.com/yandex/graphouse) - [karbon-clickhouse](https://github.com/lomik/carbon-clickhouse) + - [grafit-clickhouse](https://github.com/lomik/graphite-clickhouse) - - [grafit-ch-doktoru](https://github.com/innogames/graphite-ch-optimizer) - staled bölümleri optimize eder [\* Graphıtemergetree](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) eğer kurallar [toplaması yapılandırması](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) uygulanabilir + - [grafit-ch-doktoru](https://github.com/innogames/graphite-ch-optimizer) - staled bölümleri optimize eder [\* Graphıtemergetree](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) eğer kurallar [toplaması yapılandırması](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) uygulanabilir - [Grafana](https://grafana.com/) - [clickhouse-grafana](https://github.com/Vertamedia/clickhouse-grafana) - [Prometheus](https://prometheus.io/) @@ -74,7 +74,7 @@ toc_title: Entegrasyonlar - [sqlalchemy-clickhouse](https://github.com/cloudflare/sqlalchemy-clickhouse) (kullanma [ınfi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm)) - [Pandalar](https://pandas.pydata.org) - [pandahouse](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -82,7 +82,7 @@ toc_title: Entegrasyonlar - [RClickHouse](https://github.com/IMSMWU/RClickHouse) (kullanma [clickhouse-cpp](https://github.com/artpaul/clickhouse-cpp)) - Java - [Hadoop](http://hadoop.apache.org) - - [clickhouse-hdfs-loader](https://github.com/jaykelin/clickhouse-hdfs-loader) (kullanma [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [clickhouse-hdfs-loader](https://github.com/jaykelin/clickhouse-hdfs-loader) (kullanma [JDBC](../../sql-reference/table-functions/jdbc.md)) - SC scalaala - [Akka](https://akka.io) - [clickhouse-Scala-istemci](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/tr/interfaces/third-party/proxy.md b/docs/tr/interfaces/third-party/proxy.md index 7ff9fc3642f..e25ccf50ca2 100644 --- a/docs/tr/interfaces/third-party/proxy.md +++ b/docs/tr/interfaces/third-party/proxy.md @@ -5,7 +5,7 @@ toc_priority: 29 toc_title: Vekiller --- -# Üçüncü taraf geliştiricilerin Proxy sunucuları {#proxy-servers-from-third-party-developers} +# Üçüncü Taraf geliştiricilerin Proxy sunucuları {#proxy-servers-from-third-party-developers} ## chproxy {#chproxy} diff --git a/docs/tr/introduction/adopters.md b/docs/tr/introduction/adopters.md index 0e180e161ec..d2509ff4256 100644 --- a/docs/tr/introduction/adopters.md +++ b/docs/tr/introduction/adopters.md @@ -8,7 +8,7 @@ toc_title: Benimseyenler # ClickHouse Benimseyenler {#clickhouse-adopters} !!! warning "Uyarı" - ClickHouse ve onların Başarı Öyküleri kullanarak şirketlerin aşağıdaki liste kamu kaynaklarından monte edilir, böylece mevcut gerçeklikten farklı olabilir. Şirketinizde Clickhouse'u benimseme hikayesini paylaşırsanız memnun oluruz ve [listeye Ekle](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/introduction/adopters.md), ancak lütfen bunu yaparak herhangi bir NDA sorun yaşamayacağınızdan emin olun. Diğer şirketlerden gelen yayınlarla güncellemeler sağlamak da yararlıdır. + ClickHouse ve onların Başarı Öyküleri kullanarak şirketlerin aşağıdaki liste kamu kaynaklarından monte edilir, böylece mevcut gerçeklikten farklı olabilir. Şirketinizde Clickhouse’u benimseme hikayesini paylaşırsanız memnun oluruz ve [listeye Ekle](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/introduction/adopters.md), ancak lütfen bunu yaparak herhangi bir NDA sorun yaşamayacağınızdan emin olun. Diğer şirketlerden gelen yayınlarla güncellemeler sağlamak da yararlıdır. | Şirket | Sektör | Usecase | Küme Boyutu | (Un) Sıkıştırılmış Veri Boyutu\* | Başvurma | |----------------------------------------------------------------------------------------------------------|---------------------------------|-----------------------------|------------------------------------------------|------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -51,7 +51,7 @@ toc_title: Benimseyenler | [Pragma Yenilik](http://www.pragma-innovation.fr/) | Telemetri ve büyük veri analizi | Ana ürün | — | — | [İngilizce slaytlar, Ekim 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/4_pragma_innovation.pdf) | | [QINGCLOUD](https://www.qingcloud.com/) | Bulut hizmetleri | Ana ürün | — | — | [Çince slaytlar, Ekim 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/4.%20Cloud%20%2B%20TSDB%20for%20ClickHouse%20张健%20QingCloud.pdf) | | [Qrator](https://qrator.net) | DDoS koruması | Ana ürün | — | — | [Blog Yazısı, Mart 2019](https://blog.qrator.net/en/clickhouse-ddos-mitigation_37/) | -| [Beijing per PERCENTC İnformationent Information Technology Co., Ltd. Ltd.Şti.](https://www.percent.cn/) | Analiz | Ana Ürün | — | — | [Çince slaytlar, Haziran 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/4.%20ClickHouse万亿数据双中心的设计与实践%20.pdf) | +| [Beijing per PERCENTC İnformationent Information Technology Co., Ltd. Ltd.Şti.](https://www.percent.cn/) | Analiz | Ana Ürün | — | — | [Çince slaytlar, Haziran 2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/4.%20ClickHouse万亿数据双中心的设计与实践%20.pdf) | | [Serseri](https://rambler.ru) | İnternet Hizmetleri | Analiz | — | — | [Rusça konuşma, Nisan 2018](https://medium.com/@ramblertop/разработка-api-clickhouse-для-рамблер-топ-100-f4c7e56f3141) | | [Tencent](https://www.tencent.com) | Mesaj | Günlük | — | — | [Çince konuşun, Kasım 2019](https://youtu.be/T-iVQRuw-QY?t=5050) | | [Trafik Yıldız Starsları](https://trafficstars.com/) | Reklam Ağı | — | — | — | [Rusça slaytlar, Mayıs 2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup15/lightning/ninja.pdf) | diff --git a/docs/tr/introduction/distinctive-features.md b/docs/tr/introduction/distinctive-features.md new file mode 100644 index 00000000000..996a182b676 --- /dev/null +++ b/docs/tr/introduction/distinctive-features.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 4 +toc_title: "Ay\u0131rt Edici \xD6zellikler" +--- + +# Clickhouse’un ayırt Edici özellikleri {#distinctive-features-of-clickhouse} + +## Doğru sütun yönelimli DBMS {#true-column-oriented-dbms} + +Bir gerçek sütun yönelimli DBMS, hiçbir ek veri değerleri ile depolanır. Diğer şeylerin yanı sıra, bu, uzunluklarının saklanmasını önlemek için sabit uzunluk değerlerinin desteklenmesi gerektiği anlamına gelir “number” değerlerin yanında. Örnek olarak, bir milyar Uİnt8 tipi değerler yaklaşık 1 GB sıkıştırılmamış tüketmelidir veya bu CPU kullanımını güçlü bir şekilde etkiler. Verileri kompakt bir şekilde saklamak esastır (herhangi bir “garbage”) sıkıştırılmamış olsa bile, dekompresyon hızı (CPU kullanımı) esas olarak sıkıştırılmamış verilerin hacmine bağlıdır. + +Farklı sütunların değerlerini ayrı ayrı depolayabilen, ancak diğer senaryolar için optimizasyonları nedeniyle analitik sorguları etkili bir şekilde işleyemeyen sistemler olduğu için dikkat çekicidir. Örnekler HBase, BigTable, Cassandra ve HyperTable. Bu sistemlerde, saniyede yüz bin satır civarında verim elde edersiniz, ancak saniyede yüz milyonlarca satır olmaz. + +Clickhouse’un tek bir veritabanı değil, bir veritabanı yönetim sistemi olduğunu da belirtmek gerekir. ClickHouse, çalışma zamanında tablolar ve veritabanları oluşturmak, veri yüklemek ve sunucuyu yeniden yapılandırmadan ve yeniden başlatmadan sorguları çalıştırmaya izin verir. + +## Veri Sıkıştırma {#data-compression} + +Bazı sütun yönelimli DBMSs (InfiniDB CE ve MonetDB) veri sıkıştırma kullanmayın. Bununla birlikte, veri sıkıştırma mükemmel performans elde etmede önemli bir rol oynar. + +## Verilerin Disk Depolama {#disk-storage-of-data} + +Verileri fiziksel olarak birincil anahtara göre sıralamak, belirli değerleri veya değer aralıkları için düşük gecikme süresi ile birkaç düzine milisaniyeden daha az veri ayıklamayı mümkün kılar. Bazı sütun yönelimli Dbms’ler (SAP HANA ve Google PowerDrill gibi) yalnızca RAM’de çalışabilir. Bu yaklaşım, gerçek zamanlı analiz için gerekenden daha büyük bir donanım bütçesinin tahsisini teşvik eder. ClickHouse düzenli sabit diskler üzerinde çalışmak üzere tasarlanmıştır, bu da GB veri depolama başına maliyetin düşük olduğu anlamına gelir, ancak varsa SSD ve ek RAM de tamamen kullanılır. + +## Birden Fazla çekirdekte Paralel işleme {#parallel-processing-on-multiple-cores} + +Büyük sorgular, geçerli sunucuda bulunan tüm gerekli kaynakları alarak doğal olarak paralelleştirilir. + +## Birden çok Sunucuda dağıtılmış işleme {#distributed-processing-on-multiple-servers} + +Yukarıda belirtilen sütunlu Dbms’lerin neredeyse hiçbiri dağıtılmış sorgu işleme desteğine sahip değildir. +Clickhouse’da, veriler farklı parçalarda bulunabilir. Her parça, hata toleransı için kullanılan bir grup kopya olabilir. Tüm kırıklar, kullanıcı için şeffaf olarak paralel bir sorgu çalıştırmak için kullanılır. + +## SQL desteği {#sql-support} + +ClickHouse, çoğu durumda SQL standardına özdeş olan sql’i temel alan bildirime dayalı bir sorgu dilini destekler. +Desteklenen sorgular arasında GROUP BY, ORDER BY, from, ın ve JOIN yan tümceleri ve skaler alt sorgular bulunur. +Bağımlı alt sorgular ve pencere işlevleri desteklenmez. + +## Vektör Motoru {#vector-engine} + +Veriler yalnızca sütunlar tarafından saklanmakla kalmaz, aynı zamanda yüksek CPU verimliliği elde etmeyi sağlayan vektörler (sütunların parçaları) tarafından işlenir. + +## Gerçek zamanlı Veri güncellemeleri {#real-time-data-updates} + +ClickHouse, birincil anahtarlı tabloları destekler. Birincil anahtar aralığındaki sorguları hızlı bir şekilde gerçekleştirmek için, veriler birleştirme ağacını kullanarak aşamalı olarak sıralanır. Bu nedenle, veriler sürekli olarak tabloya eklenebilir. Yeni veri Yutulduğunda hiçbir kilit alınır. + +## Dizin {#index} + +Birincil anahtara göre fiziksel olarak sıralanmış bir veriye sahip olmak, belirli değerleri veya değer aralıkları için düşük gecikme süresi ile birkaç düzine milisaniyeden daha az veri çıkarmayı mümkün kılar. + +## Çevrimiçi Sorgular için Uygundur {#suitable-for-online-queries} + +Düşük gecikme süresi, kullanıcı arayüzü sayfası yüklenirken, sorguların gecikmeden ve önceden bir cevap hazırlamaya çalışmadan işlenebileceği anlamına gelir. Başka bir deyişle, çevrimiçi. + +## Yaklaşık Hesaplamalar için Destek {#support-for-approximated-calculations} + +ClickHouse performans için doğruluk ticaret için çeşitli yollar sağlar: + +1. Farklı değerler, medyan ve quantiles sayısı yaklaşık hesaplama için toplam işlevleri. +2. Verilerin bir bölümünü (örnek) temel alan bir sorguyu çalıştırmak ve yaklaşık bir sonuç almak. Bu durumda, diskten orantılı olarak daha az veri alınır. +3. Tüm anahtarlar yerine, sınırlı sayıda rastgele anahtar için bir toplama çalıştırma. Verilerde anahtar dağıtımı için belirli koşullar altında, bu daha az kaynak kullanırken makul derecede doğru bir sonuç sağlar. + +## Veri çoğaltma Ve Veri Bütünlüğü desteği {#data-replication-and-data-integrity-support} + +ClickHouse zaman uyumsuz çoklu ana çoğaltma kullanır. Kullanılabilir herhangi bir yineleme için yazıldıktan sonra kalan tüm yinelemeler arka planda kendi kopyasını almak. Sistem, farklı yinelemelerde aynı verileri korur. Çoğu arızadan sonra kurtarma, karmaşık durumlarda otomatik olarak veya yarı otomatik olarak gerçekleştirilir. + +Daha fazla bilgi için bölüme bakın [Veri çoğaltma](../engines/table-engines/mergetree-family/replication.md). + +## Dezavantajları Olarak Kabul Edilebilir özellikler {#clickhouse-features-that-can-be-considered-disadvantages} + +1. Tam teşekküllü işlemler yok. +2. Yüksek oranda ve düşük gecikme ile zaten eklenen verileri değiştirme veya silme yeteneği eksikliği. Verileri temizlemek veya değiştirmek için toplu silme ve güncellemeler vardır, örneğin Aşağıdakilere uymak için [GDPR](https://gdpr-info.eu). +3. Seyrek dizin, Clickhouse’u anahtarlarıyla tek satırları almak için nokta sorguları için çok uygun değildir. + +[Orijinal makale](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/tr/introduction/distinctive_features.md b/docs/tr/introduction/distinctive_features.md deleted file mode 100644 index 3b26dea645c..00000000000 --- a/docs/tr/introduction/distinctive_features.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 4 -toc_title: "Ay\u0131rt Edici \xD6zellikler" ---- - -# Clickhouse'un ayırt edici özellikleri {#distinctive-features-of-clickhouse} - -## Doğru sütun yönelimli DBMS {#true-column-oriented-dbms} - -Bir gerçek sütun yönelimli DBMS, hiçbir ek veri değerleri ile depolanır. Diğer şeylerin yanı sıra, bu, uzunluklarının saklanmasını önlemek için sabit uzunluk değerlerinin desteklenmesi gerektiği anlamına gelir “number” değerlerin yanında. Örnek olarak, bir milyar Uİnt8 tipi değerler yaklaşık 1 GB sıkıştırılmamış tüketmelidir veya bu CPU kullanımını güçlü bir şekilde etkiler. Verileri kompakt bir şekilde saklamak esastır (herhangi bir “garbage”) sıkıştırılmamış olsa bile, dekompresyon hızı (CPU kullanımı) esas olarak sıkıştırılmamış verilerin hacmine bağlıdır. - -Farklı sütunların değerlerini ayrı ayrı depolayabilen, ancak diğer senaryolar için optimizasyonları nedeniyle analitik sorguları etkili bir şekilde işleyemeyen sistemler olduğu için dikkat çekicidir. Örnekler HBase, BigTable, Cassandra ve HyperTable. Bu sistemlerde, saniyede yüz bin satır civarında verim elde edersiniz, ancak saniyede yüz milyonlarca satır olmaz. - -Clickhouse'un tek bir veritabanı değil, bir veritabanı yönetim sistemi olduğunu da belirtmek gerekir. ClickHouse, çalışma zamanında tablolar ve veritabanları oluşturmak, veri yüklemek ve sunucuyu yeniden yapılandırmadan ve yeniden başlatmadan sorguları çalıştırmaya izin verir. - -## Veri Sıkıştırma {#data-compression} - -Bazı sütun yönelimli DBMSs (InfiniDB CE ve MonetDB) veri sıkıştırma kullanmayın. Bununla birlikte, veri sıkıştırma mükemmel performans elde etmede önemli bir rol oynar. - -## Verilerin Disk Depolama {#disk-storage-of-data} - -Verileri fiziksel olarak birincil anahtara göre sıralamak, belirli değerleri veya değer aralıkları için düşük gecikme süresi ile birkaç düzine milisaniyeden daha az veri ayıklamayı mümkün kılar. Bazı sütun yönelimli Dbms'ler (SAP HANA ve Google PowerDrill gibi) yalnızca RAM'de çalışabilir. Bu yaklaşım, gerçek zamanlı analiz için gerekenden daha büyük bir donanım bütçesinin tahsisini teşvik eder. ClickHouse düzenli sabit diskler üzerinde çalışmak üzere tasarlanmıştır, bu da GB veri depolama başına maliyetin düşük olduğu anlamına gelir, ancak varsa SSD ve ek RAM de tamamen kullanılır. - -## Birden fazla çekirdekte paralel işleme {#parallel-processing-on-multiple-cores} - -Büyük sorgular, geçerli sunucuda bulunan tüm gerekli kaynakları alarak doğal olarak paralelleştirilir. - -## Birden çok sunucuda dağıtılmış işleme {#distributed-processing-on-multiple-servers} - -Yukarıda belirtilen sütunlu Dbms'lerin neredeyse hiçbiri dağıtılmış sorgu işleme desteğine sahip değildir. -Clickhouse'da, veriler farklı parçalarda bulunabilir. Her parça, hata toleransı için kullanılan bir grup kopya olabilir. Tüm kırıklar, kullanıcı için şeffaf olarak paralel bir sorgu çalıştırmak için kullanılır. - -## SQL desteği {#sql-support} - -ClickHouse, çoğu durumda SQL standardına özdeş olan sql'i temel alan bildirime dayalı bir sorgu dilini destekler. -Desteklenen sorgular arasında GROUP BY, ORDER BY, from, ın ve JOIN yan tümceleri ve skaler alt sorgular bulunur. -Bağımlı alt sorgular ve pencere işlevleri desteklenmez. - -## Vektör Motoru {#vector-engine} - -Veriler yalnızca sütunlar tarafından saklanmakla kalmaz, aynı zamanda yüksek CPU verimliliği elde etmeyi sağlayan vektörler (sütunların parçaları) tarafından işlenir. - -## Gerçek zamanlı veri güncellemeleri {#real-time-data-updates} - -ClickHouse, birincil anahtarlı tabloları destekler. Birincil anahtar aralığındaki sorguları hızlı bir şekilde gerçekleştirmek için, veriler birleştirme ağacını kullanarak aşamalı olarak sıralanır. Bu nedenle, veriler sürekli olarak tabloya eklenebilir. Yeni veri Yutulduğunda hiçbir kilit alınır. - -## Dizin {#index} - -Birincil anahtara göre fiziksel olarak sıralanmış bir veriye sahip olmak, belirli değerleri veya değer aralıkları için düşük gecikme süresi ile birkaç düzine milisaniyeden daha az veri çıkarmayı mümkün kılar. - -## Çevrimiçi sorgular için uygundur {#suitable-for-online-queries} - -Düşük gecikme süresi, kullanıcı arayüzü sayfası yüklenirken, sorguların gecikmeden ve önceden bir cevap hazırlamaya çalışmadan işlenebileceği anlamına gelir. Başka bir deyişle, çevrimiçi. - -## Yaklaşık hesaplamalar için destek {#support-for-approximated-calculations} - -ClickHouse performans için doğruluk ticaret için çeşitli yollar sağlar: - -1. Farklı değerler, medyan ve quantiles sayısı yaklaşık hesaplama için toplam işlevleri. -2. Verilerin bir bölümünü (örnek) temel alan bir sorguyu çalıştırmak ve yaklaşık bir sonuç almak. Bu durumda, diskten orantılı olarak daha az veri alınır. -3. Tüm anahtarlar yerine, sınırlı sayıda rastgele anahtar için bir toplama çalıştırma. Verilerde anahtar dağıtımı için belirli koşullar altında, bu daha az kaynak kullanırken makul derecede doğru bir sonuç sağlar. - -## Veri çoğaltma ve Veri Bütünlüğü desteği {#data-replication-and-data-integrity-support} - -ClickHouse zaman uyumsuz çoklu ana çoğaltma kullanır. Kullanılabilir herhangi bir yineleme için yazıldıktan sonra kalan tüm yinelemeler arka planda kendi kopyasını almak. Sistem, farklı yinelemelerde aynı verileri korur. Çoğu arızadan sonra kurtarma, karmaşık durumlarda otomatik olarak veya yarı otomatik olarak gerçekleştirilir. - -Daha fazla bilgi için bölüme bakın [Veri çoğaltma](../engines/table_engines/mergetree_family/replication.md). - -## Dezavantajları olarak kabul edilebilir özellikler {#clickhouse-features-that-can-be-considered-disadvantages} - -1. Tam teşekküllü işlemler yok. -2. Yüksek oranda ve düşük gecikme ile zaten eklenen verileri değiştirme veya silme yeteneği eksikliği. Verileri temizlemek veya değiştirmek için toplu silme ve güncellemeler vardır, örneğin Aşağıdakilere uymak için [GDPR](https://gdpr-info.eu). -3. Seyrek dizin, Clickhouse'u anahtarlarıyla tek satırları almak için nokta sorguları için çok uygun değildir. - -[Orijinal makale](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/tr/introduction/history.md b/docs/tr/introduction/history.md index cfc18df2981..2f32929fe90 100644 --- a/docs/tr/introduction/history.md +++ b/docs/tr/introduction/history.md @@ -7,20 +7,20 @@ toc_title: "Tarih\xE7e" # ClickHouse Geçmişi {#clickhouse-history} -ClickHouse güç başlangıçta geliştirilmiştir [Üye.Metrica](https://metrica.yandex.com/), [dünyanın en büyük ikinci web analiz platformu](http://w3techs.com/technologies/overview/traffic_analysis/all) ve bu sistemin temel bileşeni olmaya devam ediyor. Veritabanında 13 trilyondan fazla kayıt ve günlük 20 milyardan fazla etkinlik ile ClickHouse, doğrudan toplanmamış verilerden anında özel raporlar oluşturmanıza olanak tanır. Bu makale Kısaca Clickhouse'un gelişiminin ilk aşamalarında hedeflerini kapsamaktadır. +ClickHouse güç başlangıçta geliştirilmiştir [Üye.Metrica](https://metrica.yandex.com/), [dünyanın en büyük ikinci web analiz platformu](http://w3techs.com/technologies/overview/traffic_analysis/all) ve bu sistemin temel bileşeni olmaya devam ediyor. Veritabanında 13 trilyondan fazla kayıt ve günlük 20 milyardan fazla etkinlik ile ClickHouse, doğrudan toplanmamış verilerden anında özel raporlar oluşturmanıza olanak tanır. Bu makale Kısaca Clickhouse’un gelişiminin ilk aşamalarında hedeflerini kapsamaktadır. Üye.Metrica kullanıcı tarafından tanımlanan keyfi kesimleri ile, hit ve oturumları dayalı anında özelleştirilmiş raporlar oluşturur. Bunu sık sık yapmak, benzersiz kullanıcı sayısı gibi karmaşık agregalar oluşturmayı gerektirir. Bir rapor oluşturmak için yeni veriler gerçek zamanlı olarak gelir. Nisan 2014 itibariyle, Yandex.Metrica, günlük olarak yaklaşık 12 milyar olayı (sayfa görüntüleme ve tıklama) izliyordu. Tüm bu olaylar özel raporlar oluşturmak için saklanmalıdır. Tek bir sorgu, birkaç yüz milisaniye içinde milyonlarca satırı veya sadece birkaç saniye içinde yüz milyonlarca satırı taramayı gerektirebilir. -## Yandex kullanımı.Metrica ve diğer Yandex Hizmetleri {#usage-in-yandex-metrica-and-other-yandex-services} +## Yandex kullanımı.Metrica Ve diğer Yandex Hizmetleri {#usage-in-yandex-metrica-and-other-yandex-services} -ClickHouse, Yandex'te birden fazla amaca hizmet eder.Metrica. -Ana görevi, toplanmamış verileri kullanarak çevrimiçi modda raporlar oluşturmaktır. Veritabanında 20.3 trilyon satırdan fazla depolayan 374 sunucu kümesi kullanır. Sıkıştırılmış verilerin hacmi, yinelenenleri ve kopyaları hesaba katmadan yaklaşık 2 PB'DİR. Sıkıştırılmamış verilerin hacmi (TSV formatında) Yaklaşık 17 PB olacaktır. +ClickHouse, Yandex’te birden fazla amaca hizmet eder.Metrica. +Ana görevi, toplanmamış verileri kullanarak çevrimiçi modda raporlar oluşturmaktır. Veritabanında 20.3 trilyon satırdan fazla depolayan 374 sunucu kümesi kullanır. Sıkıştırılmış verilerin hacmi, yinelenenleri ve kopyaları hesaba katmadan yaklaşık 2 PB’DİR. Sıkıştırılmamış verilerin hacmi (TSV formatında) Yaklaşık 17 PB olacaktır. ClickHouse ayrıca aşağıdaki süreçlerde önemli bir rol oynar: -- Yandex'den oturum tekrarı için veri saklama.Metrica. +- Yandex’den oturum tekrarı için veri saklama.Metrica. - Ara veri işleme. - Analitik ile küresel raporlar oluşturma. - Yandex hata ayıklama için sorguları çalıştırma.Metrica motoru. @@ -28,7 +28,7 @@ ClickHouse ayrıca aşağıdaki süreçlerde önemli bir rol oynar: Günümüzde, diğer Yandex hizmetlerinde ve bölümlerinde birden fazla düzine ClickHouse kurulumu bulunmaktadır: arama dikey, e-ticaret, reklam, iş analitiği, mobil geliştirme, kişisel hizmetler ve diğerleri. -## Toplanmış ve toplanmamış veriler {#aggregated-and-non-aggregated-data} +## Toplanmış Ve toplanmamış Veriler {#aggregated-and-non-aggregated-data} İstatistikleri etkili bir şekilde hesaplamak için, veri hacmini azalttığından verileri toplamanız gerektiğine dair yaygın bir görüş vardır. @@ -38,7 +38,7 @@ Ancak veri toplama birçok sınırlama ile birlikte gelir: - Kullanıcı özel raporlar yapamaz. - Çok sayıda farklı anahtar üzerinde toplanırken, veri hacmi zorlukla azaltılır, bu nedenle toplama işe yaramaz. - Çok sayıda rapor için çok fazla toplama varyasyonu vardır (kombinatoryal patlama). -- Anahtarları yüksek önemlilik (URL'ler gibi) ile toplarken, veri hacmi çok fazla azaltılmaz (iki kattan daha az). +- Anahtarları yüksek önemlilik (URL’ler gibi) ile toplarken, veri hacmi çok fazla azaltılmaz (iki kattan daha az). - Bu nedenle, toplama ile veri hacmi küçültmek yerine büyüyebilir. - Kullanıcılar onlar için oluşturduğumuz tüm raporları görüntülemez. Bu hesaplamaların büyük bir kısmı işe yaramaz. - Verilerin mantıksal bütünlüğü, çeşitli toplamalar için ihlal edilebilir. @@ -48,8 +48,8 @@ Hiçbir şeyi toplamazsak ve toplanmamış verilerle çalışırsak, bu hesaplam Bununla birlikte, toplama ile, çalışmanın önemli bir kısmı çevrimdışı olarak alınır ve nispeten sakin bir şekilde tamamlanır. Buna karşılık, çevrimiçi hesaplamalar, kullanıcı sonucu beklediğinden mümkün olduğunca hızlı hesaplamayı gerektirir. Üye.Metrica, raporların çoğunluğu için kullanılan Metrage adı verilen verileri toplamak için özel bir sisteme sahiptir. -2009'dan itibaren Yandex.Metrica, daha önce Rapor Oluşturucusu için kullanılan OLAPServer adlı toplanmamış veriler için özel bir OLAP veritabanı da kullandı. -OLAPServer, toplanmamış veriler için iyi çalıştı, ancak tüm raporlar için istenildiği gibi kullanılmasına izin vermeyen birçok kısıtlamaya sahipti. Bunlar, veri türleri için destek eksikliği (yalnızca sayılar) ve verileri gerçek zamanlı olarak aşamalı olarak güncelleyememe (yalnızca verileri günlük olarak yeniden yazarak yapılabilir) içeriyordu. OLAPServer bir DBMS değil, özel bir dB'dir. +2009’dan itibaren Yandex.Metrica, daha önce Rapor Oluşturucusu için kullanılan OLAPServer adlı toplanmamış veriler için özel bir OLAP veritabanı da kullandı. +OLAPServer, toplanmamış veriler için iyi çalıştı, ancak tüm raporlar için istenildiği gibi kullanılmasına izin vermeyen birçok kısıtlamaya sahipti. Bunlar, veri türleri için destek eksikliği (yalnızca sayılar) ve verileri gerçek zamanlı olarak aşamalı olarak güncelleyememe (yalnızca verileri günlük olarak yeniden yazarak yapılabilir) içeriyordu. OLAPServer bir DBMS değil, özel bir dB’dir. ClickHouse için ilk hedef OLAPServer sınırlamaları kaldırmak ve tüm raporlar için toplanmamış verilerle çalışma sorunu çözmek oldu, ama yıllar içinde, analitik görevler geniş bir yelpazede için uygun bir genel amaçlı veritabanı yönetim sistemi haline gelmiştir. diff --git a/docs/tr/introduction/performance.md b/docs/tr/introduction/performance.md index ce54825af98..ac0804f1854 100644 --- a/docs/tr/introduction/performance.md +++ b/docs/tr/introduction/performance.md @@ -7,13 +7,13 @@ toc_title: Performans # Performans {#performance} -Yandex'deki dahili test sonuçlarına göre, ClickHouse, test için mevcut olan sınıfının sistemleri arasında karşılaştırılabilir işletim senaryoları için en iyi performansı (hem uzun sorgular için en yüksek verim hem de kısa sorgularda en düşük gecikme süresi) gösterir. Test sonuçlarını bir [ayrı sayfa](https://clickhouse.tech/benchmark/dbms/). +Yandex’deki dahili test sonuçlarına göre, ClickHouse, test için mevcut olan sınıfının sistemleri arasında karşılaştırılabilir işletim senaryoları için en iyi performansı (hem uzun sorgular için en yüksek verim hem de kısa sorgularda en düşük gecikme süresi) gösterir. Test sonuçlarını bir [ayrı sayfa](https://clickhouse.tech/benchmark/dbms/). Çok sayıda bağımsız kriterler benzer sonuçlara geldi. Bir internet araması kullanarak bulmak zor değildir veya görebilirsiniz [ilgili bağlantı ourlardan oluşan küçük koleksiyon collectionumuz](https://clickhouse.tech/#independent-benchmarks). -## Tek bir büyük sorgu için çıktı {#throughput-for-a-single-large-query} +## Tek Bir büyük Sorgu için çıktı {#throughput-for-a-single-large-query} -Verim, saniyede satır veya saniyede megabayt olarak ölçülebilir. Veriler sayfa önbelleğine yerleştirilirse, çok karmaşık olmayan bir sorgu, modern donanım üzerinde tek bir sunucuda yaklaşık 2-10 GB/s sıkıştırılmamış veri hızında işlenir (en basit durumlar için, hız 30 GB/s'ye ulaşabilir). Veri sayfa önbelleğine yerleştirilmezse, hız disk alt sistemine ve veri sıkıştırma hızına bağlıdır. Örneğin, disk alt sistemi 400 MB/s veri okuma izin verir ve veri sıkıştırma hızı 3 ise, hız 1.2 GB / s civarında olması bekleniyor. saniyede satır hızı elde etmek için hızı saniyede bayt cinsinden sorguda kullanılan sütunların toplam boyutuna bölün. Örneğin, 10 bayt sütun ayıklanırsa, hızın saniyede yaklaşık 100-200 milyon satır olması beklenir. +Verim, saniyede satır veya saniyede megabayt olarak ölçülebilir. Veriler sayfa önbelleğine yerleştirilirse, çok karmaşık olmayan bir sorgu, modern donanım üzerinde tek bir sunucuda yaklaşık 2-10 GB/s sıkıştırılmamış veri hızında işlenir (en basit durumlar için, hız 30 GB/s’ye ulaşabilir). Veri sayfa önbelleğine yerleştirilmezse, hız disk alt sistemine ve veri sıkıştırma hızına bağlıdır. Örneğin, disk alt sistemi 400 MB/s veri okuma izin verir ve veri sıkıştırma hızı 3 ise, hız 1.2 GB / s civarında olması bekleniyor. saniyede satır hızı elde etmek için hızı saniyede bayt cinsinden sorguda kullanılan sütunların toplam boyutuna bölün. Örneğin, 10 bayt sütun ayıklanırsa, hızın saniyede yaklaşık 100-200 milyon satır olması beklenir. İşlem hızı, dağıtılmış işlem için neredeyse doğrusal olarak artar, ancak yalnızca toplama veya sıralamadan kaynaklanan satır sayısı çok büyük değilse. @@ -21,7 +21,7 @@ Verim, saniyede satır veya saniyede megabayt olarak ölçülebilir. Veriler say Bir sorgu birincil anahtar kullanır ve çok fazla sütun ve satır (yüzbinlerce) işlemek için seçmez, veri sayfa önbelleğine yerleştirilirse, 50 milisaniyeden daha az gecikme süresi (en iyi durumda milisaniye tek basamak) bekleyebilirsiniz. Aksi takdirde, gecikme çoğunlukla arama sayısı tarafından hakimdir. Aşırı yüklenmemiş bir sistem için dönen disk sürücüleri kullanırsanız, gecikme bu formülle tahmin edilebilir: `seek time (10 ms) * count of columns queried * count of data parts`. -## Büyük miktarda kısa sorgu işlerken verim {#throughput-when-processing-a-large-quantity-of-short-queries} +## Büyük Miktarda kısa Sorgu işlerken Verim {#throughput-when-processing-a-large-quantity-of-short-queries} Aynı koşullar altında, ClickHouse tek bir sunucuda saniyede birkaç yüz sorgu işleyebilir (en iyi durumda birkaç bine kadar). Bu senaryo analitik DBMSs için tipik olmadığından, saniyede en fazla 100 sorgu beklemenizi öneririz. diff --git a/docs/tr/operations/access-rights.md b/docs/tr/operations/access-rights.md new file mode 100644 index 00000000000..91a1581591e --- /dev/null +++ b/docs/tr/operations/access-rights.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 48 +toc_title: "Eri\u015Fim Haklar\u0131" +--- + +# Erişim Hakları {#access-rights} + +Kullanıcılar ve erişim hakları kullanıcı yapılandırmasında ayarlanır. Bu genellikle `users.xml`. + +Kullanıcılar kaydedilir `users` bölme. İşte bir parçası `users.xml` Dosya: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + + test + + + +``` + +İki kullanıcıdan bir bildirim görebilirsiniz: `default`ve`web`. Ek weledik `web` kullanıcı ayrı ayrı. + +Bu `default` kullanıcı adı geçilmez durumlarda kullanıcı seçilir. Bu `default` kullanıcı, sunucu veya kümenin yapılandırması, sunucu veya kümenin yapılandırılmasını belirtmezse, dağıtılmış sorgu işleme için de kullanılır. `user` ve `password` (on bölümüne bakın [Dağılı](../engines/table-engines/special/distributed.md) motor). + +The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. + +Parola, açık metin (önerilmez) veya SHA-256’da belirtilir. Haşhaş tuzlu değil. Bu bağlamda, bu şifreleri potansiyel kötü amaçlı saldırılara karşı güvenlik sağlamak olarak düşünmemelisiniz. Aksine, çalışanlardan korunmak için gereklidir. + +Erişime izin verilen ağların listesi belirtilir. Bu örnekte, her iki kullanıcı için ağ listesi ayrı bir dosyadan yüklenir (`/etc/metrika.xml`) içeren `networks` ikame. İşte bunun bir parçası: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +Bu ağ listesini doğrudan tanımlayabilirsiniz `users.xml` veya bir dosyada `users.d` dizin (daha fazla bilgi için bölüme bakın “[Yapılandırma dosyaları](configuration-files.md#configuration_files)”). + +Yapılandırma, her yerden erişimin nasıl açılacağını açıklayan yorumları içerir. + +Üretimde kullanım için, sadece belirtin `ip` elemanları (IP adresleri ve maskeleri), kullanıl ,dığından beri `host` ve `hoost_regexp` ekstra gecikmeye neden olabilir. + +Daha sonra kullanıcı ayarları profili belirtilir (bölüme bakın “[Ayarlar profilleri](settings/settings-profiles.md)”. Varsayılan profili belirtebilirsiniz, `default'`. Profilin herhangi bir adı olabilir. Farklı kullanıcılar için aynı profili belirtebilirsiniz. Ayarlar profilinde yazabileceğiniz en önemli şey `readonly=1` sağlar okumak-sadece erişim. Ardından kullanılacak kotayı belirtin (bölüme bakın “[Kotalar](quotas.md#quotas)”). Varsayılan kotayı belirtebilirsiniz: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. + +İsteğe bağlı `` bölümünde, kullanıcının erişebileceği veritabanlarının bir listesini de belirtebilirsiniz. Varsayılan olarak, tüm veritabanları kullanıcı tarafından kullanılabilir. Belirtebilirsiniz `default` veritabanı. Bu durumda, kullanıcı varsayılan olarak veritabanına erişim alır. + +İsteğe bağlı `` bölümünde, kullanıcının erişebileceği sözlüklerin bir listesini de belirtebilirsiniz. Varsayılan olarak, tüm sözlükler kullanıcı tarafından kullanılabilir. + +Erişim `system` veritabanı her zaman izin verilir (bu veritabanı sorguları işlemek için kullanıldığından). + +Kullanıcı kullanarak onları tüm veritabanları ve tabloların bir listesini alabilirsiniz `SHOW` tek tek veritabanlarına erişime izin verilmese bile, sorgular veya sistem tabloları. + +Veritabanı erişimi ile ilgili değildir [readonly](settings/permissions-for-queries.md#settings_readonly) ayar. Bir veritabanına tam erişim izni veremezsiniz ve `readonly` başka birine erişim. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/tr/operations/access_rights.md b/docs/tr/operations/access_rights.md deleted file mode 100644 index b270c0ecbed..00000000000 --- a/docs/tr/operations/access_rights.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 48 -toc_title: "Eri\u015Fim Haklar\u0131" ---- - -# Erişim Hakları {#access-rights} - -Kullanıcılar ve erişim hakları kullanıcı yapılandırmasında ayarlanır. Bu genellikle `users.xml`. - -Kullanıcılar kaydedilir `users` bölme. İşte bir parçası `users.xml` Dosya: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - - test - - - -``` - -İki kullanıcıdan bir bildirim görebilirsiniz: `default`ve`web`. Ek weledik `web` kullanıcı ayrı ayrı. - -Bu `default` kullanıcı adı geçilmez durumlarda kullanıcı seçilir. Bu `default` kullanıcı, sunucu veya kümenin yapılandırması, sunucu veya kümenin yapılandırılmasını belirtmezse, dağıtılmış sorgu işleme için de kullanılır. `user` ve `password` (on bölümüne bakın [Dağılı](../engines/table_engines/special/distributed.md) motor). - -The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. - -Parola, açık metin (önerilmez) veya SHA-256'da belirtilir. Haşhaş tuzlu değil. Bu bağlamda, bu şifreleri potansiyel kötü amaçlı saldırılara karşı güvenlik sağlamak olarak düşünmemelisiniz. Aksine, çalışanlardan korunmak için gereklidir. - -Erişime izin verilen ağların listesi belirtilir. Bu örnekte, her iki kullanıcı için ağ listesi ayrı bir dosyadan yüklenir (`/etc/metrika.xml`) içeren `networks` ikame. İşte bunun bir parçası: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -Bu ağ listesini doğrudan tanımlayabilirsiniz `users.xml` veya bir dosyada `users.d` dizin (daha fazla bilgi için bölüme bakın “[Yapılandırma dosyaları](configuration_files.md#configuration_files)”). - -Yapılandırma, her yerden erişimin nasıl açılacağını açıklayan yorumları içerir. - -Üretimde kullanım için, sadece belirtin `ip` elemanları (IP adresleri ve maskeleri), kullanıl ,dığından beri `host` ve `hoost_regexp` ekstra gecikmeye neden olabilir. - -Daha sonra kullanıcı ayarları profili belirtilir (bölüme bakın “[Ayarlar profilleri](settings/settings_profiles.md)”. Varsayılan profili belirtebilirsiniz, `default'`. Profilin herhangi bir adı olabilir. Farklı kullanıcılar için aynı profili belirtebilirsiniz. Ayarlar profilinde yazabileceğiniz en önemli şey `readonly=1` sağlar okumak-sadece erişim. Ardından kullanılacak kotayı belirtin (bölüme bakın “[Kotalar](quotas.md#quotas)”). Varsayılan kotayı belirtebilirsiniz: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. - -İsteğe bağlı `` bölümünde, kullanıcının erişebileceği veritabanlarının bir listesini de belirtebilirsiniz. Varsayılan olarak, tüm veritabanları kullanıcı tarafından kullanılabilir. Belirtebilirsiniz `default` veritabanı. Bu durumda, kullanıcı varsayılan olarak veritabanına erişim alır. - -İsteğe bağlı `` bölümünde, kullanıcının erişebileceği sözlüklerin bir listesini de belirtebilirsiniz. Varsayılan olarak, tüm sözlükler kullanıcı tarafından kullanılabilir. - -Erişim `system` veritabanı her zaman izin verilir (bu veritabanı sorguları işlemek için kullanıldığından). - -Kullanıcı kullanarak onları tüm veritabanları ve tabloların bir listesini alabilirsiniz `SHOW` tek tek veritabanlarına erişime izin verilmese bile, sorgular veya sistem tabloları. - -Veritabanı erişimi ile ilgili değildir [readonly](settings/permissions_for_queries.md#settings_readonly) ayar. Bir veritabanına tam erişim izni veremezsiniz ve `readonly` başka birine erişim. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/tr/operations/backup.md b/docs/tr/operations/backup.md index 5d1d806e5dd..22cc6211341 100644 --- a/docs/tr/operations/backup.md +++ b/docs/tr/operations/backup.md @@ -7,7 +7,7 @@ toc_title: Veri Yedekleme # Veri Yedekleme {#data-backup} -Karşın [çoğalma](../engines/table_engines/mergetree_family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [50 GB'den fazla veri içeren MergeTree benzeri bir motorla tabloları bırakamazsınız](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Ancak, bu önlemler olası tüm davaları kapsamaz ve atlatılabilir. +Karşın [çoğalma](../engines/table-engines/mergetree-family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [50 GB’den fazla veri içeren MergeTree benzeri bir motorla tabloları bırakamazsınız](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). Ancak, bu önlemler olası tüm davaları kapsamaz ve atlatılabilir. Olası insan hatalarını etkili bir şekilde azaltmak için, verilerinizi yedeklemek ve geri yüklemek için dikkatli bir şekilde bir strateji hazırlamanız gerekir **önceden**. @@ -18,11 +18,11 @@ Her şirketin farklı kaynakları ve iş gereksinimleri vardır, bu nedenle her ## Kaynak Verileri Başka Bir Yerde Çoğaltma {#duplicating-source-data-somewhere-else} -Genellikle Clickhouse'a alınan veriler, aşağıdaki gibi bir tür kalıcı sıra yoluyla teslim edilir [Apache Kafka](https://kafka.apache.org). Bu durumda, Clickhouse'a yazılırken aynı veri akışını okuyacak ve bir yerde soğuk depoda depolayacak ek bir abone kümesi yapılandırmak mümkündür. Çoğu şirket zaten bir nesne deposu veya dağıtılmış bir dosya sistemi gibi olabilecek bazı varsayılan önerilen soğuk depolamaya sahiptir [HDFS](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html). +Genellikle Clickhouse’a alınan veriler, aşağıdaki gibi bir tür kalıcı sıra yoluyla teslim edilir [Apache Kafka](https://kafka.apache.org). Bu durumda, Clickhouse’a yazılırken aynı veri akışını okuyacak ve bir yerde soğuk depoda depolayacak ek bir abone kümesi yapılandırmak mümkündür. Çoğu şirket zaten bir nesne deposu veya dağıtılmış bir dosya sistemi gibi olabilecek bazı varsayılan önerilen soğuk depolamaya sahiptir [HDFS](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html). ## Dosya Sistemi Anlık Görüntüleri {#filesystem-snapshots} -Bazı yerel dosya sistemleri anlık görüntü işlevselliği sağlar (örneğin, [ZFS](https://en.wikipedia.org/wiki/ZFS)), ancak canlı sorguları sunmak için en iyi seçenek olmayabilir. Olası bir çözüm, bu tür dosya sistemi ile ek kopyalar oluşturmak ve bunları [Dağılı](../engines/table_engines/special/distributed.md) için kullanılan tablolar `SELECT` sorgular. Bu tür yinelemelerdeki anlık görüntüler, verileri değiştiren sorguların erişemeyeceği bir yerde olacaktır. Bonus olarak, bu yinelemeler, sunucu başına daha fazla disk eklenmiş özel donanım yapılandırmalarına sahip olabilir ve bu da uygun maliyetli olabilir. +Bazı yerel dosya sistemleri anlık görüntü işlevselliği sağlar (örneğin, [ZFS](https://en.wikipedia.org/wiki/ZFS)), ancak canlı sorguları sunmak için en iyi seçenek olmayabilir. Olası bir çözüm, bu tür dosya sistemi ile ek kopyalar oluşturmak ve bunları [Dağılı](../engines/table-engines/special/distributed.md) için kullanılan tablolar `SELECT` sorgular. Bu tür yinelemelerdeki anlık görüntüler, verileri değiştiren sorguların erişemeyeceği bir yerde olacaktır. Bonus olarak, bu yinelemeler, sunucu başına daha fazla disk eklenmiş özel donanım yapılandırmalarına sahip olabilir ve bu da uygun maliyetli olabilir. ## clickhouse-fotokopi makinesi {#clickhouse-copier} @@ -30,11 +30,11 @@ Bazı yerel dosya sistemleri anlık görüntü işlevselliği sağlar (örneğin Daha küçük veri hacimleri için, basit bir `INSERT INTO ... SELECT ...` uzak tablolara da çalışabilir. -## Parçalar ile manipülasyonlar {#manipulations-with-parts} +## Parçalar Ile manipülasyonlar {#manipulations-with-parts} ClickHouse kullanarak sağlar `ALTER TABLE ... FREEZE PARTITION ...` tablo bölümleri yerel bir kopyasını oluşturmak için sorgu. Bu hardlinks kullanarak uygulanır `/var/lib/clickhouse/shadow/` klasör, bu yüzden genellikle eski veriler için ekstra disk alanı tüketmez. Oluşturulan dosyaların kopyaları ClickHouse server tarafından işlenmez, bu yüzden onları orada bırakabilirsiniz: herhangi bir ek harici sistem gerektirmeyen basit bir yedeklemeniz olacak, ancak yine de donanım sorunlarına eğilimli olacaktır. Bu nedenle, bunları uzaktan başka bir konuma kopyalamak ve ardından yerel kopyaları kaldırmak daha iyidir. Dağıtılmış dosya sistemleri ve nesne depoları bunun için hala iyi bir seçenektir, ancak yeterince büyük kapasiteye sahip normal ekli dosya sunucuları da işe yarayabilir (bu durumda aktarım ağ dosya sistemi veya belki de [rsync](https://en.wikipedia.org/wiki/Rsync)). -Bölüm işlemleriyle ilgili sorgular hakkında daha fazla bilgi için bkz. [ALTER belgeleri](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +Bölüm işlemleriyle ilgili sorgular hakkında daha fazla bilgi için bkz. [ALTER belgeleri](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). Bu yaklaşımı otomatikleştirmek için üçüncü taraf bir araç kullanılabilir: [clickhouse-yedekleme](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/tr/operations/configuration-files.md b/docs/tr/operations/configuration-files.md new file mode 100644 index 00000000000..82378d0cab7 --- /dev/null +++ b/docs/tr/operations/configuration-files.md @@ -0,0 +1,57 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 50 +toc_title: "Yap\u0131land\u0131rma Dosyalar\u0131" +--- + +# Yapılandırma Dosyaları {#configuration_files} + +ClickHouse Çoklu dosya yapılandırma yönetimini destekler. Ana sunucu yapılandırma dosyası `/etc/clickhouse-server/config.xml`. Diğer dosyalar içinde olmalıdır `/etc/clickhouse-server/config.d` dizin. + +!!! note "Not" + Tüm yapılandırma dosyaları XML biçiminde olmalıdır. Ayrıca, genellikle aynı kök öğeye sahip olmalıdırlar ``. + +Ana yapılandırma dosyasında belirtilen bazı ayarlar diğer yapılandırma dosyalarında geçersiz kılınabilir. Bu `replace` veya `remove` bu yapılandırma dosyalarının öğeleri için öznitelikler belirtilebilir. + +Her ikisi de belirtilmezse, yinelenen çocukların değerlerini değiştirerek öğelerin içeriğini yinelemeli olarak birleştirir. + +Eğer `replace` belirtilen, tüm öğeyi belirtilen ile değiştirir. + +Eğer `remove` belirt .ilirse, öğeyi siler. + +Yapılandırma ayrıca tanımlayabilir “substitutions”. Bir öğe varsa `incl` öznitelik, dosyadan karşılık gelen ikame değeri olarak kullanılacaktır. Varsayılan olarak, değiştirmeler ile dosyanın yolu `/etc/metrika.xml`. Bu değiştirilebilir [include\_from](server-configuration-parameters/settings.md#server_configuration_parameters-include_from) sunucu yapılandırmasında öğe. İkame değerleri belirtilen `/yandex/substitution_name` bu dosyadaki öğeler. Belirtilen bir ika Ame halinde `incl` yok, günlüğe kaydedilir. Clickhouse’un eksik değiştirmelerin günlüğe kaydedilmesini önlemek için `optional="true"` öznitelik (örneğin, ayarlar [makrolar](server-configuration-parameters/settings.md)). + +İkame da ZooKeeper yapılabilir. Bunu yapmak için özniteliği belirtin `from_zk = "/path/to/node"`. Eleman değeri, düğümün içeriği ile değiştirilir `/path/to/node` ZooKeeper. Ayrıca ZooKeeper düğümünde bir XML alt ağacının tamamını koyabilirsiniz ve kaynak öğeye tamamen eklenecektir. + +Bu `config.xml` dosya kullanıcı ayarları, profiller ve kotalar ile ayrı bir yapılandırma belirtebilirsiniz. Bu yapılandırmanın göreli yolu, `users_config` öğe. Varsayılan olarak, bu `users.xml`. Eğer `users_config` atlanır, kullanıcı ayarları, profiller ve kotalar doğrudan belirtilir `config.xml`. + +Kullanıcılar yapılandırma benzer ayrı dosyaları içine bölünmüş olabilir `config.xml` ve `config.d/`. +Dizin adı olarak tanımlanır `users_config` olmadan ayarı `.xml` postfix ile birleştirilmiş `.d`. +Dizin `users.d` varsayılan olarak kullanılır, gibi `users_config` varsayılan olarak `users.xml`. +Örneğin, bu gibi her kullanıcı için ayrı yapılandırma dosyasına sahip olabilirsiniz: + +``` bash +$ cat /etc/clickhouse-server/users.d/alice.xml +``` + +``` xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +Her yapılandırma dosyası için sunucu da üretir `file-preprocessed.xml` başlatırken dosyalar. Bu dosyalar, tamamlanmış tüm değiştirmeleri ve geçersiz kılmaları içerir ve bunlar bilgi amaçlı kullanım içindir. Zookeeper değiştirmelerin yapılandırma dosyalarında kullanılan ancak ZooKeeper sunucu başlangıcında kullanılabilir değilse, sunucu yapılandırmayı önceden işlenmiş dosyadan yükler. + +Sunucu, yapılandırma dosyalarındaki değişikliklerin yanı sıra, değiştirmeleri ve geçersiz kılmaları gerçekleştirirken kullanılan dosya ve ZooKeeper düğümlerini izler ve anında kullanıcılar ve kümeler için ayarları yeniden yükler. Bu, sunucuyu yeniden başlatmadan kümeyi, kullanıcıları ve ayarlarını değiştirebileceğiniz anlamına gelir. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/tr/operations/configuration_files.md b/docs/tr/operations/configuration_files.md deleted file mode 100644 index fda72e6ba21..00000000000 --- a/docs/tr/operations/configuration_files.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 50 -toc_title: "Yap\u0131land\u0131rma Dosyalar\u0131" ---- - -# Yapılandırma Dosyaları {#configuration_files} - -ClickHouse Çoklu dosya yapılandırma yönetimini destekler. Ana sunucu yapılandırma dosyası `/etc/clickhouse-server/config.xml`. Diğer dosyalar içinde olmalıdır `/etc/clickhouse-server/config.d` dizin. - -!!! note "Not" - Tüm yapılandırma dosyaları XML biçiminde olmalıdır. Ayrıca, genellikle aynı kök öğeye sahip olmalıdırlar ``. - -Ana yapılandırma dosyasında belirtilen bazı ayarlar diğer yapılandırma dosyalarında geçersiz kılınabilir. Bu `replace` veya `remove` bu yapılandırma dosyalarının öğeleri için öznitelikler belirtilebilir. - -Her ikisi de belirtilmezse, yinelenen çocukların değerlerini değiştirerek öğelerin içeriğini yinelemeli olarak birleştirir. - -Eğer `replace` belirtilen, tüm öğeyi belirtilen ile değiştirir. - -Eğer `remove` belirt .ilirse, öğeyi siler. - -Yapılandırma ayrıca tanımlayabilir “substitutions”. Bir öğe varsa `incl` öznitelik, dosyadan karşılık gelen ikame değeri olarak kullanılacaktır. Varsayılan olarak, değiştirmeler ile dosyanın yolu `/etc/metrika.xml`. Bu değiştirilebilir [include\_from](server_configuration_parameters/settings.md#server_configuration_parameters-include_from) sunucu yapılandırmasında öğe. İkame değerleri belirtilen `/yandex/substitution_name` bu dosyadaki öğeler. Belirtilen bir ika Ame halinde `incl` yok, günlüğe kaydedilir. Clickhouse'un eksik değiştirmelerin günlüğe kaydedilmesini önlemek için `optional="true"` öznitelik (örneğin, ayarlar [makrolar](server_configuration_parameters/settings.md)). - -İkame da ZooKeeper yapılabilir. Bunu yapmak için özniteliği belirtin `from_zk = "/path/to/node"`. Eleman değeri, düğümün içeriği ile değiştirilir `/path/to/node` ZooKeeper. Ayrıca ZooKeeper düğümünde bir XML alt ağacının tamamını koyabilirsiniz ve kaynak öğeye tamamen eklenecektir. - -Bu `config.xml` dosya kullanıcı ayarları, profiller ve kotalar ile ayrı bir yapılandırma belirtebilirsiniz. Bu yapılandırmanın göreli yolu, `users_config` öğe. Varsayılan olarak, bu `users.xml`. Eğer `users_config` atlanır, kullanıcı ayarları, profiller ve kotalar doğrudan belirtilir `config.xml`. - -Kullanıcılar yapılandırma benzer ayrı dosyaları içine bölünmüş olabilir `config.xml` ve `config.d/`. -Dizin adı olarak tanımlanır `users_config` olmadan ayarı `.xml` postfix ile birleştirilmiş `.d`. -Dizin `users.d` varsayılan olarak kullanılır, gibi `users_config` varsayılan olarak `users.xml`. -Örneğin, bu gibi her kullanıcı için ayrı yapılandırma dosyasına sahip olabilirsiniz: - -``` bash -$ cat /etc/clickhouse-server/users.d/alice.xml -``` - -``` xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -Her yapılandırma dosyası için sunucu da üretir `file-preprocessed.xml` başlatırken dosyalar. Bu dosyalar, tamamlanmış tüm değiştirmeleri ve geçersiz kılmaları içerir ve bunlar bilgi amaçlı kullanım içindir. Zookeeper değiştirmelerin yapılandırma dosyalarında kullanılan ancak ZooKeeper sunucu başlangıcında kullanılabilir değilse, sunucu yapılandırmayı önceden işlenmiş dosyadan yükler. - -Sunucu, yapılandırma dosyalarındaki değişikliklerin yanı sıra, değiştirmeleri ve geçersiz kılmaları gerçekleştirirken kullanılan dosya ve ZooKeeper düğümlerini izler ve anında kullanıcılar ve kümeler için ayarları yeniden yükler. Bu, sunucuyu yeniden başlatmadan kümeyi, kullanıcıları ve ayarlarını değiştirebileceğiniz anlamına gelir. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/tr/operations/index.md b/docs/tr/operations/index.md index e20eefc1ab0..042529cc62a 100644 --- a/docs/tr/operations/index.md +++ b/docs/tr/operations/index.md @@ -15,13 +15,13 @@ ClickHouse işlemleri kılavuzu aşağıdaki ana bölümlerden oluşur: - [Arıza](troubleshooting.md) - [Kullanım Önerileri](tips.md) - [Güncelleme Prosedürü](update.md) -- [Erişim Hakları](access_rights.md) +- [Erişim Hakları](access-rights.md) - [Veri Yedekleme](backup.md) -- [Yapılandırma Dosyaları](configuration_files.md) +- [Yapılandırma Dosyaları](configuration-files.md) - [Kotalar](quotas.md) -- [Sistem Tabloları](system_tables.md) -- [Sunucu Yapılandırma Parametreleri](server_configuration_parameters/index.md) -- [Donanımınızı ClickHouse İle Test Etme](performance_test.md) +- [Sistem Tabloları](system-tables.md) +- [Sunucu Yapılandırma Parametreleri](server-configuration-parameters/index.md) +- [Donanımınızı ClickHouse İle Test Etme](performance-test.md) - [Ayarlar](settings/index.md) - [Programlar](utilities/index.md) diff --git a/docs/tr/operations/monitoring.md b/docs/tr/operations/monitoring.md index eb5b7bd6dc8..811face9de7 100644 --- a/docs/tr/operations/monitoring.md +++ b/docs/tr/operations/monitoring.md @@ -28,18 +28,18 @@ ClickHouse, donanım kaynaklarının durumunu tek başına izlemez. ClickHouse sunucu kendini devlet izleme için araçlar gömülü vardır. -Sunucu olaylarını izlemek için sunucu günlüklerini kullanın. Görmek [kaydedici](server_configuration_parameters/settings.md#server_configuration_parameters-logger) yapılandırma dosyasının bölümü. +Sunucu olaylarını izlemek için sunucu günlüklerini kullanın. Görmek [kaydedici](server-configuration-parameters/settings.md#server_configuration_parameters-logger) yapılandırma dosyasının bölümü. ClickHouse toplar: - Sunucunun hesaplama kaynaklarını nasıl kullandığına dair farklı metrikler. - Sorgu işleme ile ilgili ortak istatistikler. -Metrikleri şu adreste bulabilirsiniz: [sistem.metrik](../operations/system_tables.md#system_tables-metrics), [sistem.etkinlik](../operations/system_tables.md#system_tables-events), ve [sistem.asynchronous\_metrics](../operations/system_tables.md#system_tables-asynchronous_metrics) Tablolar. +Metrikleri şu adreste bulabilirsiniz: [sistem.metrik](../operations/system-tables.md#system_tables-metrics), [sistem.etkinlik](../operations/system-tables.md#system_tables-events), ve [sistem.asynchronous\_metrics](../operations/system-tables.md#system_tables-asynchronous_metrics) Tablolar. -Clickhouse'u metrikleri dışa aktaracak şekilde yapılandırabilirsiniz [Grafit](https://github.com/graphite-project). Görmek [Graf sectionit bölümü](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) ClickHouse sunucu yapılandırma dosyasında. Metriklerin dışa aktarımını yapılandırmadan önce, grafit'i resmi olarak takip ederek ayarlamanız gerekir [kılavuz](https://graphite.readthedocs.io/en/latest/install.html). +Clickhouse’u metrikleri dışa aktaracak şekilde yapılandırabilirsiniz [Grafit](https://github.com/graphite-project). Görmek [Graf sectionit bölümü](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) ClickHouse sunucu yapılandırma dosyasında. Metriklerin dışa aktarımını yapılandırmadan önce, grafit’i resmi olarak takip ederek ayarlamanız gerekir [kılavuz](https://graphite.readthedocs.io/en/latest/install.html). -Clickhouse'u metrikleri dışa aktaracak şekilde yapılandırabilirsiniz [Prometheus](https://prometheus.io). Görmek [Prometheus bölümü](server_configuration_parameters/settings.md#server_configuration_parameters-prometheus) ClickHouse sunucu yapılandırma dosyasında. Metriklerin dışa aktarılmasını yapılandırmadan önce, prometheus'u yetkililerini takip ederek ayarlamanız gerekir [kılavuz](https://prometheus.io/docs/prometheus/latest/installation/). +Clickhouse’u metrikleri dışa aktaracak şekilde yapılandırabilirsiniz [Prometheus](https://prometheus.io). Görmek [Prometheus bölümü](server-configuration-parameters/settings.md#server_configuration_parameters-prometheus) ClickHouse sunucu yapılandırma dosyasında. Metriklerin dışa aktarılmasını yapılandırmadan önce, prometheus’u yetkililerini takip ederek ayarlamanız gerekir [kılavuz](https://prometheus.io/docs/prometheus/latest/installation/). Ayrıca, http API aracılığıyla sunucu kullanılabilirliğini izleyebilirsiniz. Sen sendd the `HTTP GET` istek için `/ping`. Sunucu mevcutsa, yanıt verir `200 OK`. diff --git a/docs/tr/operations/optimizing_performance/index.md b/docs/tr/operations/optimizing-performance/index.md similarity index 100% rename from docs/tr/operations/optimizing_performance/index.md rename to docs/tr/operations/optimizing-performance/index.md diff --git a/docs/tr/operations/optimizing-performance/sampling-query-profiler.md b/docs/tr/operations/optimizing-performance/sampling-query-profiler.md new file mode 100644 index 00000000000..8ffbd665b0a --- /dev/null +++ b/docs/tr/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 54 +toc_title: "Sorgu Profili Olu\u015Fturma" +--- + +# Örnekleme Sorgusu Profiler {#sampling-query-profiler} + +ClickHouse, sorgu yürütülmesini analiz etmeyi sağlayan örnekleme profiler’i çalıştırır. Profiler kullanarak sorgu yürütme sırasında en sık kullanılan kaynak kodu yordamları bulabilirsiniz. Boşta kalma süresi de dahil olmak üzere harcanan CPU zamanını ve duvar saati zamanını izleyebilirsiniz. + +Profiler kullanmak için: + +- Kurulum [trace\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) sunucu yapılandırması bölümü. + + Bu bölüm yapılandırır [trace\_log](../../operations/system-tables.md#system_tables-trace_log) profiler işleyişinin sonuçlarını içeren sistem tablosu. Varsayılan olarak yapılandırılmıştır. Bu tablodaki verilerin yalnızca çalışan bir sunucu için geçerli olduğunu unutmayın. Sunucu yeniden başlatıldıktan sonra ClickHouse tabloyu temizlemez ve depolanan tüm sanal bellek adresi geçersiz hale gelebilir. + +- Kurulum [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) veya [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) ayarlar. Her iki ayar da aynı anda kullanılabilir. + + Bu ayarlar, profiler zamanlayıcılarını yapılandırmanıza izin verir. Bunlar oturum ayarları olduğundan, tüm sunucu, bireysel kullanıcılar veya kullanıcı profilleri, etkileşimli oturumunuz ve her bir sorgu için farklı örnekleme sıklığı elde edebilirsiniz. + +Varsayılan örnekleme frekansı saniyede bir örnektir ve hem CPU hem de gerçek zamanlayıcılar etkindir. Bu frekans, ClickHouse kümesi hakkında yeterli bilgi toplamaya izin verir. Aynı zamanda, bu sıklıkla çalışan profiler, ClickHouse sunucusunun performansını etkilemez. Her bir sorguyu profillemeniz gerekiyorsa, daha yüksek örnekleme frekansı kullanmayı deneyin. + +Analiz etmek `trace_log` sistem tablosu: + +- Yüklemek `clickhouse-common-static-dbg` paket. Görmek [DEB paketlerinden yükleyin](../../getting-started/install.md#install-from-deb-packages). + +- Tarafından iç gözlem işlevlerine izin ver [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) ayar. + + Güvenlik nedenleriyle, iç gözlem işlevleri varsayılan olarak devre dışı bırakılır. + +- Kullan… `addressToLine`, `addressToSymbol` ve `demangle` [iç gözlem fonksiyonları](../../sql-reference/functions/introspection.md) ClickHouse kodu işlev adları ve konumlarını almak için. Bazı sorgu için bir profil almak için, `trace_log` Tablo. Bireysel fonksiyonları bütün yığın izleri ya da veri toplama yapabilirsiniz. + +Görselleştirmeniz gerekiyorsa `trace_log` bilgi, deneyin [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) ve [speedscope](https://github.com/laplab/clickhouse-speedscope). + +## Örnek {#example} + +Bu örnekte biz: + +- Filtre `trace_log` bir sorgu tanımlayıcısı ve geçerli tarihe göre veri. + +- Yığın izleme ile toplama. + +- İç gözlem işlevlerini kullanarak, bir rapor alacağız: + + - Sembollerin isimleri ve karşılık gelen kaynak kodu işlevleri. + - Bu işlevlerin kaynak kodu konumları. + + + +``` sql +SELECT + count(), + arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym +FROM system.trace_log +WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) +GROUP BY trace +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +{% include "examples/sampling_query_profiler_result.txt" %} +``` diff --git a/docs/tr/operations/optimizing_performance/sampling_query_profiler.md b/docs/tr/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 100644 index 120df6be7a6..00000000000 --- a/docs/tr/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 54 -toc_title: "Sorgu Profili Olu\u015Fturma" ---- - -# Örnekleme Sorgusu Profiler {#sampling-query-profiler} - -ClickHouse, sorgu yürütülmesini analiz etmeyi sağlayan örnekleme profiler'i çalıştırır. Profiler kullanarak sorgu yürütme sırasında en sık kullanılan kaynak kodu yordamları bulabilirsiniz. Boşta kalma süresi de dahil olmak üzere harcanan CPU zamanını ve duvar saati zamanını izleyebilirsiniz. - -Profiler kullanmak için: - -- Kurulum [trace\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) sunucu yapılandırması bölümü. - - Bu bölüm yapılandırır [trace\_log](../../operations/system_tables.md#system_tables-trace_log) profiler işleyişinin sonuçlarını içeren sistem tablosu. Varsayılan olarak yapılandırılmıştır. Bu tablodaki verilerin yalnızca çalışan bir sunucu için geçerli olduğunu unutmayın. Sunucu yeniden başlatıldıktan sonra ClickHouse tabloyu temizlemez ve depolanan tüm sanal bellek adresi geçersiz hale gelebilir. - -- Kurulum [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) veya [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) ayarlar. Her iki ayar da aynı anda kullanılabilir. - - Bu ayarlar, profiler zamanlayıcılarını yapılandırmanıza izin verir. Bunlar oturum ayarları olduğundan, tüm sunucu, bireysel kullanıcılar veya kullanıcı profilleri, etkileşimli oturumunuz ve her bir sorgu için farklı örnekleme sıklığı elde edebilirsiniz. - -Varsayılan örnekleme frekansı saniyede bir örnektir ve hem CPU hem de gerçek zamanlayıcılar etkindir. Bu frekans, ClickHouse kümesi hakkında yeterli bilgi toplamaya izin verir. Aynı zamanda, bu sıklıkla çalışan profiler, ClickHouse sunucusunun performansını etkilemez. Her bir sorguyu profillemeniz gerekiyorsa, daha yüksek örnekleme frekansı kullanmayı deneyin. - -Analiz etmek `trace_log` sistem tablosu: - -- Yüklemek `clickhouse-common-static-dbg` paket. Görmek [DEB paketlerinden yükleyin](../../getting_started/install.md#install-from-deb-packages). - -- Tarafından iç gözlem işlevlerine izin ver [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) ayar. - - Güvenlik nedenleriyle, iç gözlem işlevleri varsayılan olarak devre dışı bırakılır. - -- Kullan... `addressToLine`, `addressToSymbol` ve `demangle` [iç gözlem fonksiyonları](../../sql_reference/functions/introspection.md) ClickHouse kodu işlev adları ve konumlarını almak için. Bazı sorgu için bir profil almak için, `trace_log` Tablo. Bireysel fonksiyonları bütün yığın izleri ya da veri toplama yapabilirsiniz. - -Görselleştirmeniz gerekiyorsa `trace_log` bilgi, deneyin [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) ve [speedscope](https://github.com/laplab/clickhouse-speedscope). - -## Örnek {#example} - -Bu örnekte biz: - -- Filtre `trace_log` bir sorgu tanımlayıcısı ve geçerli tarihe göre veri. - -- Yığın izleme ile toplama. - -- İç gözlem işlevlerini kullanarak, bir rapor alacağız: - - - Sembollerin isimleri ve karşılık gelen kaynak kodu işlevleri. - - Bu işlevlerin kaynak kodu konumları. - - - -``` sql -SELECT - count(), - arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym -FROM system.trace_log -WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) -GROUP BY trace -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -{% include "examples/sampling_query_profiler_result.txt" %} -``` diff --git a/docs/tr/operations/performance-test.md b/docs/tr/operations/performance-test.md new file mode 100644 index 00000000000..85b03f4e4d8 --- /dev/null +++ b/docs/tr/operations/performance-test.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 54 +toc_title: "Donan\u0131m Test" +--- + +# Donanımınızı ClickHouse Ile Test Etme {#how-to-test-your-hardware-with-clickhouse} + +Bu talimat ile ClickHouse paketlerinin kurulumu olmadan herhangi bir sunucuda temel ClickHouse performans testi çalıştırabilirsiniz. + +1. Gitmek “commits” sayfa: https://github.com/ClickHouse/ClickHouse/commits/master + +2. Yeşil ile ilk yeşil onay işareti veya kırmızı Haç tıklayın “ClickHouse Build Check” ve tıklayın “Details” link yakın “ClickHouse Build Check”. Bazı taahhütlerde böyle bir bağlantı yoktur, örneğin belgelerle taahhüt eder. Bu durumda, bu bağlantıya sahip en yakın taahhüt seçin. + +3. Bağlantıyı kopyala “clickhouse” amd64 veya aarch64 için ikili. + +4. sunucuya ssh ve wget ile indirin: + + + + # For amd64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse + # For aarch64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse + # Then do: + chmod a+x clickhouse + +1. İndir yapılandırmaları: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml + mkdir config.d + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml + +1. Ben benchmarkch filesmark dosyaları indir: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh + chmod a+x benchmark-new.sh + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql + +1. İndir göre test verileri [Üye.Metrica veri kümesi](../getting-started/example-datasets/metrica.md) talimat (“hits” 100 milyon satır içeren tablo). + + + + wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz + tar xvf hits_100m_obfuscated_v1.tar.xz -C . + mv hits_100m_obfuscated_v1/* . + +1. Sunucuyu Çalıştır: + + + + ./clickhouse server + +1. Verileri kontrol edin: başka bir terminaldeki sunucuya ssh + + + + ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" + 100000000 + +1. Edit the benchmark-new.sh, değişim `clickhouse-client` -e doğru `./clickhouse client` ve Ekle `–-max_memory_usage 100000000000` parametre. + + + + mcedit benchmark-new.sh + +1. Ben benchmarkch runmark Çalıştır: + + + + ./benchmark-new.sh hits_100m_obfuscated + +1. Donanım yapılandırmanız hakkındaki numaraları ve bilgileri şu adrese gönderin clickhouse-feedback@yandex-team.com + +Tüm sonuçlar burada yayınlanmaktadır: https://clickhouse.teknoloji / benchmark\_hardware.html diff --git a/docs/tr/operations/performance_test.md b/docs/tr/operations/performance_test.md deleted file mode 100644 index dbfbc39998d..00000000000 --- a/docs/tr/operations/performance_test.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 54 -toc_title: "Donan\u0131m Test" ---- - -# Donanımınızı ClickHouse ile Test etme {#how-to-test-your-hardware-with-clickhouse} - -Bu talimat ile ClickHouse paketlerinin kurulumu olmadan herhangi bir sunucuda temel ClickHouse performans testi çalıştırabilirsiniz. - -1. Gitmek “commits” sayfa: https://github.com/ClickHouse/ClickHouse/commits/master - -2. Yeşil ile ilk yeşil onay işareti veya kırmızı Haç tıklayın “ClickHouse Build Check” ve tıklayın “Details” link yakın “ClickHouse Build Check”. Bazı taahhütlerde böyle bir bağlantı yoktur, örneğin belgelerle taahhüt eder. Bu durumda, bu bağlantıya sahip en yakın taahhüt seçin. - -3. Bağlantıyı kopyala “clickhouse” amd64 veya aarch64 için ikili. - -4. sunucuya ssh ve wget ile indirin: - - - - # For amd64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse - # For aarch64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse - # Then do: - chmod a+x clickhouse - -1. İndir yapılandırmaları: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml - mkdir config.d - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml - -1. Ben benchmarkch filesmark dosyaları indir: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh - chmod a+x benchmark-new.sh - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql - -1. İndir göre test verileri [Üye.Metrica veri kümesi](../getting_started/example_datasets/metrica.md) talimat (“hits” 100 milyon satır içeren tablo). - - - - wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz - tar xvf hits_100m_obfuscated_v1.tar.xz -C . - mv hits_100m_obfuscated_v1/* . - -1. Sunucuyu Çalıştır: - - - - ./clickhouse server - -1. Verileri kontrol edin: başka bir terminaldeki sunucuya ssh - - - - ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" - 100000000 - -1. Edit the benchmark-new.sh, değişim `clickhouse-client` -e doğru `./clickhouse client` ve Ekle `–-max_memory_usage 100000000000` parametre. - - - - mcedit benchmark-new.sh - -1. Ben benchmarkch runmark Çalıştır: - - - - ./benchmark-new.sh hits_100m_obfuscated - -1. Donanım yapılandırmanız hakkındaki numaraları ve bilgileri şu adrese gönderin clickhouse-feedback@yandex-team.com - -Tüm sonuçlar burada yayınlanmaktadır: https://clickhouse.teknoloji / benchmark\_hardware.html diff --git a/docs/tr/operations/requirements.md b/docs/tr/operations/requirements.md index c77159d11d7..8d1245557d3 100644 --- a/docs/tr/operations/requirements.md +++ b/docs/tr/operations/requirements.md @@ -9,9 +9,9 @@ toc_title: Gereksinimler ## CPU {#cpu} -Önceden oluşturulmuş deb paketlerinden kurulum için, x86\_64 mimarisine sahip bir CPU kullanın ve sse 4.2 yönergelerini destekleyin. Clickhouse'u SSE 4.2'yi desteklemeyen veya AArch64 veya PowerPC64LE mimarisine sahip işlemcilerle çalıştırmak için, kaynaklardan Clickhouse'u oluşturmanız gerekir. +Önceden oluşturulmuş deb paketlerinden kurulum için, x86\_64 mimarisine sahip bir CPU kullanın ve sse 4.2 yönergelerini destekleyin. Clickhouse’u SSE 4.2’yi desteklemeyen veya AArch64 veya PowerPC64LE mimarisine sahip işlemcilerle çalıştırmak için, kaynaklardan Clickhouse’u oluşturmanız gerekir. -ClickHouse paralel veri işleme uygular ve mevcut tüm donanım kaynaklarını kullanır. Bir işlemci seçerken, Clickhouse'un çok sayıda çekirdeğe sahip konfigürasyonlarda daha verimli çalıştığını, ancak daha az çekirdeğe ve daha yüksek bir saat hızına sahip konfigürasyonlardan daha düşük bir saat hızına sahip olduğunu göz önünde bulundurun. Örneğin, 2600 MHz'lik 16 çekirdek, 3600 MHz'lik 8 çekirdeğe tercih edilir. +ClickHouse paralel veri işleme uygular ve mevcut tüm donanım kaynaklarını kullanır. Bir işlemci seçerken, Clickhouse’un çok sayıda çekirdeğe sahip konfigürasyonlarda daha verimli çalıştığını, ancak daha az çekirdeğe ve daha yüksek bir saat hızına sahip konfigürasyonlardan daha düşük bir saat hızına sahip olduğunu göz önünde bulundurun. Örneğin, 2600 MHz’lik 16 çekirdek, 3600 MHz’lik 8 çekirdeğe tercih edilir. Kullanılması tavsiye edilir **Turbo Bo Boostost** ve **hyper-thre -ading** teknolojiler. Tipik bir iş yükü ile performansı önemli ölçüde artırır. @@ -24,9 +24,9 @@ Gerekli RAM hacmi Aşağıdakilere bağlıdır: - Sorguların karmaşıklığı. - Sorgularda işlenen veri miktarı. -Gerekli RAM hacmini hesaplamak için, aşağıdakiler için geçici verilerin boyutunu tahmin etmelisiniz [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) ve kullandığınız diğer işlemler. +Gerekli RAM hacmini hesaplamak için, aşağıdakiler için geçici verilerin boyutunu tahmin etmelisiniz [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) ve kullandığınız diğer işlemler. -ClickHouse geçici veriler için harici bellek kullanabilirsiniz. Görmek [Harici bellekte grupla](../sql_reference/statements/select.md#select-group-by-in-external-memory) ayrıntılar için. +ClickHouse geçici veriler için harici bellek kullanabilirsiniz. Görmek [Harici bellekte grupla](../sql-reference/statements/select.md#select-group-by-in-external-memory) ayrıntılar için. ## Takas Dosyası {#swap-file} @@ -34,7 +34,7 @@ ClickHouse geçici veriler için harici bellek kullanabilirsiniz. Görmek [Haric ## Depolama Alt Sistemi {#storage-subsystem} -Clickhouse'u yüklemek için 2GB Boş disk alanına sahip olmanız gerekir. +Clickhouse’u yüklemek için 2GB Boş disk alanına sahip olmanız gerekir. Verileriniz için gereken depolama hacmi ayrı ayrı hesaplanmalıdır. Değerlendirme şunları içermelidir: @@ -44,7 +44,7 @@ Verileriniz için gereken depolama hacmi ayrı ayrı hesaplanmalıdır. Değerle - Veri sıkıştırma katsayısı. - Veri sıkıştırma katsayısını tahmin etmek için, verilerinizin bir örneğini Clickhouse'a yükleyin ve verilerin gerçek boyutunu depolanan tablonun boyutuyla karşılaştırın. Örneğin, clickstream verileri genellikle 6-10 kez sıkıştırılır. + Veri sıkıştırma katsayısını tahmin etmek için, verilerinizin bir örneğini Clickhouse’a yükleyin ve verilerin gerçek boyutunu depolanan tablonun boyutuyla karşılaştırın. Örneğin, clickstream verileri genellikle 6-10 kez sıkıştırılır. Saklanacak verilerin son hacmini hesaplamak için, sıkıştırma katsayısını tahmini veri hacmine uygulayın. Verileri birkaç yinelemede depolamayı planlıyorsanız, tahmini birimi yinelemelerin sayısıyla çarpın. @@ -56,6 +56,6 @@ Ağ bant genişliği, büyük miktarda Ara veriyle dağıtılmış sorguları i ## Yazılım {#software} -ClickHouse öncelikle Linux işletim sistemleri ailesi için geliştirilmiştir. Önerilen Linux dağıtımı Ubuntu'dur. Bu `tzdata` paket sisteme kurulmalıdır. +ClickHouse öncelikle Linux işletim sistemleri ailesi için geliştirilmiştir. Önerilen Linux dağıtımı Ubuntu’dur. Bu `tzdata` paket sisteme kurulmalıdır. -ClickHouse diğer işletim sistemi ailelerinde de çalışabilir. Ayrıntıları görün [Başlarken](../getting_started/index.md) belgelerin bölümü. +ClickHouse diğer işletim sistemi ailelerinde de çalışabilir. Ayrıntıları görün [Başlarken](../getting-started/index.md) belgelerin bölümü. diff --git a/docs/tr/operations/server-configuration-parameters/index.md b/docs/tr/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..5b0da1ee7eb --- /dev/null +++ b/docs/tr/operations/server-configuration-parameters/index.md @@ -0,0 +1,19 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "Sunucu Yap\u0131land\u0131rma Parametreleri" +toc_priority: 54 +toc_title: "Giri\u015F" +--- + +# Sunucu yapılandırma Parametreleri {#server-settings} + +Bu bölüm, oturum veya sorgu düzeyinde değiştirilemeyen sunucu ayarlarının açıklamalarını içerir. + +Bu ayarlar saklanır `config.xml` ClickHouse sunucusunda dosya. + +Diğer ayarlar aşağıda açıklanmıştır “[Ayarlar](../settings/index.md#settings)” bölme. + +Ayarları incelemeden önce, [Yapılandırma dosyaları](../configuration-files.md#configuration_files) bölüm ve ikame kullanımı (not `incl` ve `optional` öznitelik). + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/tr/operations/server-configuration-parameters/settings.md b/docs/tr/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..b0beb4afcfd --- /dev/null +++ b/docs/tr/operations/server-configuration-parameters/settings.md @@ -0,0 +1,896 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 57 +toc_title: "Sunucu Ayarlar\u0131" +--- + +# Sunucu Ayarları {#server-settings} + +## buıltın\_dıctıonarıes\_reload\_ınterval {#builtin-dictionaries-reload-interval} + +Dahili sözlükleri yeniden yüklemeden önce saniye cinsinden Aralık. + +ClickHouse, her x saniyede bir yerleşik sözlükleri yeniden yükler. Bu, sözlükleri düzenlemeyi mümkün kılar “on the fly” sunucuyu yeniden başlatmadan. + +Varsayılan değer: 3600. + +**Örnek** + +``` xml +3600 +``` + +## sıkıştırma {#server-settings-compression} + +İçin veri sıkıştırma ayarları [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)- motor masaları. + +!!! warning "Uyarıcı" + Sadece ClickHouse kullanmaya başladıysanız kullanmayın. + +Yapılandırma şablonu: + +``` xml + + + ... + ... + ... + + ... + +``` + +`` alanlar: + +- `min_part_size` – The minimum size of a data part. +- `min_part_size_ratio` – The ratio of the data part size to the table size. +- `method` – Compression method. Acceptable values: `lz4` veya `zstd`. + +Birden fazla yapılandırabilirsiniz `` bölmeler. + +Koşullar yerine getirildiğinde eylemler: + +- Bir veri parçası bir koşul kümesiyle eşleşirse, ClickHouse belirtilen sıkıştırma yöntemini kullanır. +- Bir veri parçası birden çok koşul kümesiyle eşleşirse, ClickHouse ilk eşleşen koşul kümesini kullanır. + +Bir veri bölümü için herhangi bir koşul karşılanmazsa, ClickHouse `lz4` sıkıştırma. + +**Örnek** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## default\_database {#default-database} + +Varsayılan veritabanı. + +Veritabanlarının bir listesini almak için [SHOW DATABASES](../../sql-reference/statements/show.md#show-databases) sorgu. + +**Örnek** + +``` xml +default +``` + +## default\_profile {#default-profile} + +Varsayılan ayarlar profili. + +Ayarlar profilleri parametrede belirtilen dosyada bulunur `user_config`. + +**Örnek** + +``` xml +default +``` + +## dictionaries\_config {#server_configuration_parameters-dictionaries_config} + +Dış sözlükler için yapılandırma dosyasının yolu. + +Yol: + +- Mutlak yolu veya sunucu yapılandırma dosyasına göre yolu belirtin. +- Yol joker karakterler içerebilir \* ve ?. + +Ayrıca bakınız “[Dış söz dictionarieslükler](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)”. + +**Örnek** + +``` xml +*_dictionary.xml +``` + +## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} + +Sözlüklerin tembel yüklenmesi. + +Eğer `true`, sonra her sözlük ilk kullanımda oluşturulur. Sözlük oluşturma başarısız olursa, sözlüğü kullanan işlev bir özel durum atar. + +Eğer `false`, sunucu başladığında tüm sözlükler oluşturulur ve bir hata varsa, sunucu kapanır. + +Varsayılan değer `true`. + +**Örnek** + +``` xml +true +``` + +## format\_schema\_path {#server_configuration_parameters-format_schema_path} + +Dizin için şemalar gibi giriş verileri için şemaları ile yolu [CapnProto](../../interfaces/formats.md#capnproto) biçimli. + +**Örnek** + +``` xml + + format_schemas/ +``` + +## grafit {#server_configuration_parameters-graphite} + +Veri gönderme [Grafit](https://github.com/graphite-project). + +Ayarlar: + +- host – The Graphite server. +- port – The port on the Graphite server. +- interval – The interval for sending, in seconds. +- timeout – The timeout for sending data, in seconds. +- root\_path – Prefix for keys. +- metrics – Sending data from the [sistem.metrik](../../operations/system-tables.md#system_tables-metrics) Tablo. +- events – Sending deltas data accumulated for the time period from the [sistem.etkinlik](../../operations/system-tables.md#system_tables-events) Tablo. +- events\_cumulative – Sending cumulative data from the [sistem.etkinlik](../../operations/system-tables.md#system_tables-events) Tablo. +- asynchronous\_metrics – Sending data from the [sistem.asynchronous\_metrics](../../operations/system-tables.md#system_tables-asynchronous_metrics) Tablo. + +Birden fazla yapılandırabilirsiniz `` yanlar. Örneğin, bunu farklı aralıklarla farklı veri göndermek için kullanabilirsiniz. + +**Örnek** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## graphite\_rollup {#server_configuration_parameters-graphite-rollup} + +Grafit için inceltme verileri için ayarlar. + +Daha fazla ayrıntı için bkz. [Graphıtemergetree](../../engines/table-engines/mergetree-family/graphitemergetree.md). + +**Örnek** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## http\_port/https\_port {#http-porthttps-port} + +Http(ler) üzerinden sunucuya bağlanmak için bağlantı noktası. + +Eğer `https_port` belirtilen, [openSSL](#server_configuration_parameters-openssl) yapılandırılmalıdır. + +Eğer `http_port` belirtilmişse, OpenSSL yapılandırması ayarlanmış olsa bile göz ardı edilir. + +**Örnek** + +``` xml +0000 +``` + +## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} + +ClickHouse HTTP (s) sunucusuna eriştiğinizde varsayılan olarak gösterilen sayfa. +Varsayılan değer “Ok.” (sonunda bir çizgi besleme ile) + +**Örnek** + +Açıyor `https://tabix.io/` eriş whenirken `http://localhost: http_port`. + +``` xml + +
]]> +
+``` + +## include\_from {#server_configuration_parameters-include_from} + +Değiştirmeleri ile dosyanın yolu. + +Daha fazla bilgi için bölüme bakın “[Yapılandırma dosyaları](../configuration-files.md#configuration_files)”. + +**Örnek** + +``` xml +/etc/metrica.xml +``` + +## ınterserver\_http\_port {#interserver-http-port} + +ClickHouse sunucuları arasında veri alışverişi için bağlantı noktası. + +**Örnek** + +``` xml +9009 +``` + +## ınterserver\_http\_host {#interserver-http-host} + +Bu sunucuya erişmek için diğer sunucular tarafından kullanılabilecek ana bilgisayar adı. + +Eğer ihmal edilirse, aynı şekilde tanımlanır `hostname-f` komut. + +Belirli bir ağ arayüzünden kopmak için kullanışlıdır. + +**Örnek** + +``` xml +example.yandex.ru +``` + +## ınterserver\_http\_credentials {#server-settings-interserver-http-credentials} + +Sırasında kimlik doğrulaması için kullanılan kullanıcı adı ve şifre [çoğalma](../../engines/table-engines/mergetree-family/replication.md) çoğaltılan \* motorlarla. Bu kimlik bilgileri yalnızca yinelemeler arasındaki iletişim için kullanılır ve ClickHouse istemcileri için kimlik bilgileri ile ilgisizdir. Sunucu, yinelemeleri bağlamak için bu kimlik bilgilerini denetliyor ve diğer yinelemelere bağlanırken aynı kimlik bilgilerini kullanıyor. Bu nedenle, bu kimlik bilgileri kümedeki tüm yinelemeler için aynı şekilde ayarlanmalıdır. +Varsayılan olarak, kimlik doğrulama kullanılmaz. + +Bu bölüm aşağıdaki parametreleri içerir: + +- `user` — username. +- `password` — password. + +**Örnek** + +``` xml + + admin + 222 + +``` + +## keep\_alive\_timeout {#keep-alive-timeout} + +ClickHouse bağlantıyı kapatmadan önce gelen istekleri bekler saniye sayısı. Varsayılan 3 saniye. + +**Örnek** + +``` xml +3 +``` + +## listen\_host {#server_configuration_parameters-listen_host} + +İsteklerin gelebileceği ana bilgisayarlarda kısıtlama. Sunucunun hepsini yanıtlamasını istiyorsanız, belirtin `::`. + +Örnekler: + +``` xml +::1 +127.0.0.1 +``` + +## kaydedici {#server_configuration_parameters-logger} + +Günlük ayarları. + +Anahtarlar: + +- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. +- log – The log file. Contains all the entries according to `level`. +- errorlog – Error log file. +- size – Size of the file. Applies to `log`ve`errorlog`. Dosya ulaştıktan sonra `size`, ClickHouse arşivleri ve yeniden adlandırır ve onun yerine yeni bir günlük dosyası oluşturur. +- count – The number of archived log files that ClickHouse stores. + +**Örnek** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +Syslog yazma da desteklenmektedir. Yapılandırma örneği: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +Anahtarlar: + +- use\_syslog — Required setting if you want to write to the syslog. +- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. +- hostname — Optional. The name of the host that logs are sent from. +- facility — [Syslog tesisi anahtar sözcüğü](https://en.wikipedia.org/wiki/Syslog#Facility) ile büyük harf inlerle “LOG\_” önek: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` vb.). + Varsayılan değer: `LOG_USER` eğer `address` belirtilen, `LOG_DAEMON otherwise.` +- format – Message format. Possible values: `bsd` ve `syslog.` + +## makrolar {#macros} + +Çoğaltılmış tablolar için parametre değiştirmeleri. + +Çoğaltılmış tablolar kullanılmazsa atlanabilir. + +Daha fazla bilgi için bölüme bakın “[Çoğaltılmış tablolar oluşturma](../../engines/table-engines/mergetree-family/replication.md)”. + +**Örnek** + +``` xml + +``` + +## mark\_cache\_size {#server-mark-cache-size} + +Tablo motorları tarafından kullanılan işaretlerin önbelleğinin yaklaşık boyutu (bayt cinsinden) [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) aile. + +Önbellek sunucu için paylaşılır ve bellek gerektiği gibi ayrılır. Önbellek boyutu en az 5368709120 olmalıdır. + +**Örnek** + +``` xml +5368709120 +``` + +## max\_concurrent\_queries {#max-concurrent-queries} + +Aynı anda işlenen isteklerin maksimum sayısı. + +**Örnek** + +``` xml +100 +``` + +## max\_connections {#max-connections} + +En fazla gelen bağlantı sayısı. + +**Örnek** + +``` xml +4096 +``` + +## max\_open\_files {#max-open-files} + +Maksimum açık dosya sayısı. + +Varsayılan olarak: `maximum`. + +Biz beri Mac OS X bu seçeneği kullanmanızı öneririz `getrlimit()` işlev yanlış bir değer döndürür. + +**Örnek** + +``` xml +262144 +``` + +## max\_table\_size\_to\_drop {#max-table-size-to-drop} + +Tabloları silme konusunda kısıtlama. + +Eğer bir boyutu [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) tablo aşıyor `max_table_size_to_drop` (bayt cinsinden), bir bırakma sorgusu kullanarak silemezsiniz. + +ClickHouse sunucusunu yeniden başlatmadan tabloyu silmeniz gerekiyorsa, `/flags/force_drop_table` dosya ve bırakma sorgusunu çalıştırın. + +Varsayılan değer: 50 GB. + +0 değeri, herhangi bir kısıtlama olmaksızın tüm tabloları silebileceğiniz anlamına gelir. + +**Örnek** + +``` xml +0 +``` + +## merge\_tree {#server_configuration_parameters-merge_tree} + +Tablolar için ince ayar [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +Daha fazla bilgi için bkz: MergeTreeSettings.h başlık dosyası. + +**Örnek** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +SSL istemci / sunucu yapılandırması. + +SSL desteği tarafından sağlanmaktadır `libpoco` kitaplık. Arayüz dosyada açıklanmıştır [SSLManager.sa](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +Sunucu/istemci ayarları için tuşlar: + +- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. +- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` sertifika içerir. +- caConfig – The path to the file or directory that contains trusted root certificates. +- verificationMode – The method for checking the node’s certificates. Details are in the description of the [Bağlama](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) sınıf. Olası değerler: `none`, `relaxed`, `strict`, `once`. +- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. +- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| +- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Kabul edilebilir değerler: `true`, `false`. +- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. Bu parametre her zaman sunucu oturumu önbelleğe alır ve istemci önbellekleme istedi, sorunları önlemek yardımcı olduğundan önerilir. Varsayılan değer: `${application.name}`. +- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. +- sessionTimeout – Time for caching the session on the server. +- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. +- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. +- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. +- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . +- disableProtocols – Protocols that are not allowed to use. +- preferServerCiphers – Preferred server ciphers on the client. + +**Ayarlar örneği:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## part\_log {#server_configuration_parameters-part-log} + +İlişkili olayları günlüğe kaydetme [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). Örneğin, veri ekleme veya birleştirme. Birleştirme algoritmalarını simüle etmek ve özelliklerini karşılaştırmak için günlüğü kullanabilirsiniz. Birleştirme işlemini görselleştirebilirsiniz. + +Sorgular günlüğe kaydedilir [sistem.part\_log](../../operations/system-tables.md#system_tables-part-log) tablo, ayrı bir dosyada değil. Bu tablonun adını aşağıdaki tabloda yapılandırabilirsiniz: `table` parametre (aşağıya bakınız). + +Günlüğü yapılandırmak için aşağıdaki parametreleri kullanın: + +- `database` – Name of the database. +- `table` – Name of the system table. +- `partition_by` – Sets a [özel bölümleme anahtarı](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +**Örnek** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## yol {#server_configuration_parameters-path} + +Veri içeren dizinin yolu. + +!!! note "Not" + Sondaki eğik çizgi zorunludur. + +**Örnek** + +``` xml +/var/lib/clickhouse/ +``` + +## prometheus {#server_configuration_parameters-prometheus} + +Kazıma için metrik verilerini açığa çıkarma [Prometheus](https://prometheus.io). + +Ayarlar: + +- `endpoint` – HTTP endpoint for scraping metrics by prometheus server. Start from ‘/’. +- `port` – Port for `endpoint`. +- `metrics` – Flag that sets to expose metrics from the [sistem.metrik](../system-tables.md#system_tables-metrics) Tablo. +- `events` – Flag that sets to expose metrics from the [sistem.etkinlik](../system-tables.md#system_tables-events) Tablo. +- `asynchronous_metrics` – Flag that sets to expose current metrics values from the [sistem.asynchronous\_metrics](../system-tables.md#system_tables-asynchronous_metrics) Tablo. + +**Örnek** + +``` xml + + /metrics + 8001 + true + true + true + +``` + +## query\_log {#server_configuration_parameters-query-log} + +İle alınan günlük sorgu settinglarının ayarlanması [log\_queries = 1](../settings/settings.md) ayar. + +Sorgular günlüğe kaydedilir [sistem.query\_log](../../operations/system-tables.md#system_tables-query_log) tablo, ayrı bir dosyada değil. Tablonun adını değiştirebilirsiniz. `table` parametre (aşağıya bakınız). + +Günlüğü yapılandırmak için aşağıdaki parametreleri kullanın: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [özel bölümleme anahtarı](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) bir masa için. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +Tablo yoksa, ClickHouse bunu oluşturur. ClickHouse sunucusu güncelleştirildiğinde sorgu günlüğünün yapısı değiştiyse, eski yapıya sahip tablo yeniden adlandırılır ve otomatik olarak yeni bir tablo oluşturulur. + +**Örnek** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## query\_thread\_log {#server_configuration_parameters-query-thread-log} + +İle alınan sorguların günlük iş parçacıklarının ayarlanması [log\_query\_threads = 1](../settings/settings.md#settings-log-query-threads) ayar. + +Sorgular günlüğe kaydedilir [sistem.query\_thread\_log](../../operations/system-tables.md#system_tables-query-thread-log) tablo, ayrı bir dosyada değil. Tablonun adını değiştirebilirsiniz. `table` parametre (aşağıya bakınız). + +Günlüğü yapılandırmak için aşağıdaki parametreleri kullanın: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [özel bölümleme anahtarı](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) bir sistem tablosu için. +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +Tablo yoksa, ClickHouse bunu oluşturur. Sorgu iş parçacığı günlüğü yapısını değiştirdiyseniz ClickHouse sunucu güncelleştirildi, tablo eski yapısı ile yeniden adlandırılır ve yeni bir tablo otomatik olarak oluşturulur. + +**Örnek** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## trace\_log {#server_configuration_parameters-trace_log} + +İçin ayarlar [trace\_log](../../operations/system-tables.md#system_tables-trace_log) sistem tablosu çalışması. + +Parametre: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [Özel bölümleme anahtarı](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) bir sistem tablosu için. +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +Varsayılan sunucu yapılandırma dosyası `config.xml` aşağıdaki ayarlar bölümünü içerir: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## query\_masking\_rules {#query-masking-rules} + +Regexp tabanlı kurallar, sorgulara ve tüm günlük iletilerine sunucu günlüklerinde depolamadan önce uygulanacak, +`system.query_log`, `system.text_log`, `system.processes` tablo ve istemciye gönderilen günlüklerde. Önlem allowseyi sağlayan +SQL sorgularından hassas veri sızıntısı (isimler, e-postalar, kişisel +kimlik veya kredi kartı numaraları) günlükleri için. + +**Örnek** + +``` xml + + + hide SSN + (^|\D)\d{3}-\d{2}-\d{4}($|\D) + 000-00-0000 + + +``` + +Config alanları: +- `name` - kuralın adı (isteğe bağlı) +- `regexp` - Re2 uyumlu düzenli ifade (zorunlu) +- `replace` - hassas veriler için ikame dizesi (isteğe bağlı, varsayılan olarak-altı Yıldız İşareti) + +Maskeleme kuralları tüm sorguya uygulanır (hatalı biçimlendirilmiş / ayrıştırılamayan sorgulardan hassas verilerin sızıntılarını önlemek için). + +`system.events` tablo sayacı var `QueryMaskingRulesMatch` hangi sorgu maskeleme kuralları maçları genel bir numarası var. + +Dağıtılmış sorgular için her sunucu ayrı ayrı yapılandırılmalıdır, aksi takdirde alt sorgular diğerine iletilir +düğümler maskeleme olmadan saklanır. + +## remote\_servers {#server-settings-remote-servers} + +Tarafından kullanılan küm ofelerin yapılandırması [Dağılı](../../engines/table-engines/special/distributed.md) tablo motoru ve `cluster` tablo işlevi. + +**Örnek** + +``` xml + +``` + +Değeri için `incl` öznitelik, bölümüne bakın “[Yapılandırma dosyaları](../configuration-files.md#configuration_files)”. + +**Ayrıca Bakınız** + +- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) + +## saat dilimi {#server_configuration_parameters-timezone} + +Sunucunun saat dilimi. + +UTC saat dilimi veya coğrafi konum (örneğin, Afrika / Abidjan) için bir IANA tanımlayıcısı olarak belirtilir. + +Saat dilimi, datetime alanları metin biçimine (ekranda veya dosyada yazdırıldığında) çıktığında ve datetime’ı bir dizeden alırken dize ve DateTime biçimleri arasındaki dönüşümler için gereklidir. Ayrıca, saat dilimi, giriş parametrelerinde saat dilimini almadıkları takdirde saat ve tarih ile çalışan işlevlerde kullanılır. + +**Örnek** + +``` xml +Europe/Moscow +``` + +## tcp\_port {#server_configuration_parameters-tcp_port} + +TCP protokolü üzerinden istemcilerle iletişim kurmak için bağlantı noktası. + +**Örnek** + +``` xml +9000 +``` + +## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} + +İstemcilerle güvenli iletişim için TCP bağlantı noktası. İle kullanın [OpenSSL](#server_configuration_parameters-openssl) ayarlar. + +**Olası değerler** + +Pozitif tamsayı. + +**Varsayılan değer** + +``` xml +9440 +``` + +## mysql\_port {#server_configuration_parameters-mysql_port} + +MySQL protokolü üzerinden istemcilerle iletişim kurmak için bağlantı noktası. + +**Olası değerler** + +Pozitif tamsayı. + +Örnek + +``` xml +9004 +``` + +## tmp\_path {#server-settings-tmp_path} + +Büyük sorguları işlemek için geçici veri yolu. + +!!! note "Not" + Sondaki eğik çizgi zorunludur. + +**Örnek** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## tmp\_policy {#server-settings-tmp-policy} + +Politika dan [`storage_configuration`](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) geçici dosyaları saklamak için. +Set değilse [`tmp_path`](#server-settings-tmp_path) kullanılır, aksi takdirde göz ardı edilir. + +!!! note "Not" + - `move_factor` göz ardı edilir +- `keep_free_space_bytes` göz ardı edilir +- `max_data_part_size_bytes` göz ardı edilir +- bu Politikada tam olarak bir cilt olmalı + +## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} + +Tablo motorları tarafından kullanılan sıkıştırılmamış veriler için önbellek boyutu (bayt cinsinden) [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +Sunucu için bir paylaşılan önbellek var. Bellek talep üzerine tahsis edilir. Seçenek varsa önbellek kullanılır [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) etkindir. + +Sıkıştırılmamış önbellek, tek tek durumlarda çok kısa sorgular için avantajlıdır. + +**Örnek** + +``` xml +8589934592 +``` + +## user\_files\_path {#server_configuration_parameters-user_files_path} + +Kullanıcı dosyaları ile dizin. Tablo işlevinde kullanılır [Dosya()](../../sql-reference/table-functions/file.md). + +**Örnek** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## users\_config {#users-config} + +İçeren dosyanın yolu: + +- Kullanıcı yapılandırmaları. +- Erişim hakları. +- Ayarlar profilleri. +- Kota ayarları. + +**Örnek** + +``` xml +users.xml +``` + +## zookeeper {#server-settings_zookeeper} + +ClickHouse ile etkileşim sağlayan ayarları içerir [ZooKeeper](http://zookeeper.apache.org/) küme. + +ClickHouse, çoğaltılmış tabloları kullanırken kopyaların meta verilerini depolamak için ZooKeeper kullanır. Çoğaltılmış tablolar kullanılmazsa, parametrelerin bu bölümü atlanabilir. + +Bu bölüm aşağıdaki parametreleri içerir: + +- `node` — ZooKeeper endpoint. You can set multiple endpoints. + + Mesela: + + + +``` xml + + example_host + 2181 + +``` + + The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. + +- `session_timeout` — Maximum timeout for the client session in milliseconds. +- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) bu, ClickHouse sunucusu tarafından kullanılan znodes için kök olarak kullanılır. İsteğe bağlı. +- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. + +**Örnek yapılandırma** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + 10000 + + /path/to/zookeeper/node + + user:password + +``` + +**Ayrıca Bakınız** + +- [Çoğalma](../../engines/table-engines/mergetree-family/replication.md) +- [ZooKeeper programcı Kılavuzu](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} + +ZooKeeper veri parçası başlıkları için depolama yöntemi. + +Bu ayar yalnızca `MergeTree` aile. Belirt specifiedilebilir: + +- Küresel olarak [merge\_tree](#server_configuration_parameters-merge_tree) bu bölüm `config.xml` Dosya. + + ClickHouse sunucudaki tüm tablolar için ayarı kullanır. Ayarı istediğiniz zaman değiştirebilirsiniz. Mevcut tablolar, ayar değiştiğinde davranışlarını değiştirir. + +- Her tablo için. + + Bir tablo oluştururken, karşılık gelen [motor ayarı](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). Genel ayar değişse bile, bu ayara sahip varolan bir tablonun davranışı değişmez. + +**Olası değerler** + +- 0 — Functionality is turned off. +- 1 — Functionality is turned on. + +Eğer `use_minimalistic_part_header_in_zookeeper = 1`, sonraları [çoğaltıyordu](../../engines/table-engines/mergetree-family/replication.md) tablolar, veri parçalarının başlıklarını tek bir `znode`. Tablo çok sayıda sütun içeriyorsa, bu depolama yöntemi Zookeeper’da depolanan verilerin hacmini önemli ölçüde azaltır. + +!!! attention "Dikkat" + Uyguladıktan sonra `use_minimalistic_part_header_in_zookeeper = 1`, ClickHouse sunucusunu bu ayarı desteklemeyen bir sürüme düşüremezsiniz. Bir kümedeki sunucularda ClickHouse yükseltirken dikkatli olun. Tüm sunucuları bir kerede yükseltmeyin. Clickhouse’un yeni sürümlerini bir test ortamında veya bir kümenin yalnızca birkaç sunucusunda test etmek daha güvenlidir. + + Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. + +**Varsayılan değer:** 0. + +## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} + +İç DNS önbelleğini devre dışı bırakır. Sistemlerinde ClickHouse işletim için tavsiye +Kubernetes gibi sık sık değişen altyapı ile. + +**Varsayılan değer:** 0. + +## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} + +ClickHouse iç DNS önbelleğinde saklanan IP adreslerini güncelleme süresi (saniye cinsinden). +Güncelleştirme, ayrı bir sistem iş parçacığında zaman uyumsuz olarak gerçekleştirilir. + +**Varsayılan değer**: 15. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/tr/operations/server_configuration_parameters/index.md b/docs/tr/operations/server_configuration_parameters/index.md deleted file mode 100644 index f1a20b924f0..00000000000 --- a/docs/tr/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "Sunucu Yap\u0131land\u0131rma Parametreleri" -toc_priority: 54 -toc_title: "Giri\u015F" ---- - -# Sunucu yapılandırma parametreleri {#server-settings} - -Bu bölüm, oturum veya sorgu düzeyinde değiştirilemeyen sunucu ayarlarının açıklamalarını içerir. - -Bu ayarlar saklanır `config.xml` ClickHouse sunucusunda dosya. - -Diğer ayarlar aşağıda açıklanmıştır “[Ayarlar](../settings/index.md#settings)” bölme. - -Ayarları incelemeden önce, [Yapılandırma dosyaları](../configuration_files.md#configuration_files) bölüm ve ikame kullanımı (not `incl` ve `optional` öznitelik). - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/tr/operations/server_configuration_parameters/settings.md b/docs/tr/operations/server_configuration_parameters/settings.md deleted file mode 100644 index bc0a464c511..00000000000 --- a/docs/tr/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,896 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 57 -toc_title: "Sunucu Ayarlar\u0131" ---- - -# Sunucu Ayarları {#server-settings} - -## buıltın\_dıctıonarıes\_reload\_ınterval {#builtin-dictionaries-reload-interval} - -Dahili sözlükleri yeniden yüklemeden önce saniye cinsinden Aralık. - -ClickHouse, her x saniyede bir yerleşik sözlükleri yeniden yükler. Bu, sözlükleri düzenlemeyi mümkün kılar “on the fly” sunucuyu yeniden başlatmadan. - -Varsayılan değer: 3600. - -**Örnek** - -``` xml -3600 -``` - -## sıkıştırma {#server-settings-compression} - -İçin veri sıkıştırma ayarları [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)- motor masaları. - -!!! warning "Uyarıcı" - Sadece ClickHouse kullanmaya başladıysanız kullanmayın. - -Yapılandırma şablonu: - -``` xml - - - ... - ... - ... - - ... - -``` - -`` alanlar: - -- `min_part_size` – The minimum size of a data part. -- `min_part_size_ratio` – The ratio of the data part size to the table size. -- `method` – Compression method. Acceptable values: `lz4` veya `zstd`. - -Birden fazla yapılandırabilirsiniz `` bölmeler. - -Koşullar yerine getirildiğinde eylemler: - -- Bir veri parçası bir koşul kümesiyle eşleşirse, ClickHouse belirtilen sıkıştırma yöntemini kullanır. -- Bir veri parçası birden çok koşul kümesiyle eşleşirse, ClickHouse ilk eşleşen koşul kümesini kullanır. - -Bir veri bölümü için herhangi bir koşul karşılanmazsa, ClickHouse `lz4` sıkıştırma. - -**Örnek** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## default\_database {#default-database} - -Varsayılan veritabanı. - -Veritabanlarının bir listesini almak için [SHOW DATABASES](../../sql_reference/statements/show.md#show-databases) sorgu. - -**Örnek** - -``` xml -default -``` - -## default\_profile {#default-profile} - -Varsayılan ayarlar profili. - -Ayarlar profilleri parametrede belirtilen dosyada bulunur `user_config`. - -**Örnek** - -``` xml -default -``` - -## dictionaries\_config {#server_configuration_parameters-dictionaries_config} - -Dış sözlükler için yapılandırma dosyasının yolu. - -Yol: - -- Mutlak yolu veya sunucu yapılandırma dosyasına göre yolu belirtin. -- Yol joker karakterler içerebilir \* ve ?. - -Ayrıca bakınız “[Dış söz dictionarieslükler](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)”. - -**Örnek** - -``` xml -*_dictionary.xml -``` - -## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} - -Sözlüklerin tembel yüklenmesi. - -Eğer `true`, sonra her sözlük ilk kullanımda oluşturulur. Sözlük oluşturma başarısız olursa, sözlüğü kullanan işlev bir özel durum atar. - -Eğer `false`, sunucu başladığında tüm sözlükler oluşturulur ve bir hata varsa, sunucu kapanır. - -Varsayılan değer `true`. - -**Örnek** - -``` xml -true -``` - -## format\_schema\_path {#server_configuration_parameters-format_schema_path} - -Dizin için şemalar gibi giriş verileri için şemaları ile yolu [CapnProto](../../interfaces/formats.md#capnproto) biçimli. - -**Örnek** - -``` xml - - format_schemas/ -``` - -## grafit {#server_configuration_parameters-graphite} - -Veri gönderme [Grafit](https://github.com/graphite-project). - -Ayarlar: - -- host – The Graphite server. -- port – The port on the Graphite server. -- interval – The interval for sending, in seconds. -- timeout – The timeout for sending data, in seconds. -- root\_path – Prefix for keys. -- metrics – Sending data from the [sistem.metrik](../../operations/system_tables.md#system_tables-metrics) Tablo. -- events – Sending deltas data accumulated for the time period from the [sistem.etkinlik](../../operations/system_tables.md#system_tables-events) Tablo. -- events\_cumulative – Sending cumulative data from the [sistem.etkinlik](../../operations/system_tables.md#system_tables-events) Tablo. -- asynchronous\_metrics – Sending data from the [sistem.asynchronous\_metrics](../../operations/system_tables.md#system_tables-asynchronous_metrics) Tablo. - -Birden fazla yapılandırabilirsiniz `` yanlar. Örneğin, bunu farklı aralıklarla farklı veri göndermek için kullanabilirsiniz. - -**Örnek** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## graphite\_rollup {#server_configuration_parameters-graphite-rollup} - -Grafit için inceltme verileri için ayarlar. - -Daha fazla ayrıntı için bkz. [Graphıtemergetree](../../engines/table_engines/mergetree_family/graphitemergetree.md). - -**Örnek** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## http\_port/https\_port {#http-porthttps-port} - -Http(ler) üzerinden sunucuya bağlanmak için bağlantı noktası. - -Eğer `https_port` belirtilen, [openSSL](#server_configuration_parameters-openssl) yapılandırılmalıdır. - -Eğer `http_port` belirtilmişse, OpenSSL yapılandırması ayarlanmış olsa bile göz ardı edilir. - -**Örnek** - -``` xml -0000 -``` - -## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} - -ClickHouse HTTP (s) sunucusuna eriştiğinizde varsayılan olarak gösterilen sayfa. -Varsayılan değer “Ok.” (sonunda bir çizgi besleme ile) - -**Örnek** - -Açıyor `https://tabix.io/` eriş whenirken `http://localhost: http_port`. - -``` xml - -
]]> -
-``` - -## include\_from {#server_configuration_parameters-include_from} - -Değiştirmeleri ile dosyanın yolu. - -Daha fazla bilgi için bölüme bakın “[Yapılandırma dosyaları](../configuration_files.md#configuration_files)”. - -**Örnek** - -``` xml -/etc/metrica.xml -``` - -## ınterserver\_http\_port {#interserver-http-port} - -ClickHouse sunucuları arasında veri alışverişi için bağlantı noktası. - -**Örnek** - -``` xml -9009 -``` - -## ınterserver\_http\_host {#interserver-http-host} - -Bu sunucuya erişmek için diğer sunucular tarafından kullanılabilecek ana bilgisayar adı. - -Eğer ihmal edilirse, aynı şekilde tanımlanır `hostname-f` komut. - -Belirli bir ağ arayüzünden kopmak için kullanışlıdır. - -**Örnek** - -``` xml -example.yandex.ru -``` - -## ınterserver\_http\_credentials {#server-settings-interserver-http-credentials} - -Sırasında kimlik doğrulaması için kullanılan kullanıcı adı ve şifre [çoğalma](../../engines/table_engines/mergetree_family/replication.md) çoğaltılan \* motorlarla. Bu kimlik bilgileri yalnızca yinelemeler arasındaki iletişim için kullanılır ve ClickHouse istemcileri için kimlik bilgileri ile ilgisizdir. Sunucu, yinelemeleri bağlamak için bu kimlik bilgilerini denetliyor ve diğer yinelemelere bağlanırken aynı kimlik bilgilerini kullanıyor. Bu nedenle, bu kimlik bilgileri kümedeki tüm yinelemeler için aynı şekilde ayarlanmalıdır. -Varsayılan olarak, kimlik doğrulama kullanılmaz. - -Bu bölüm aşağıdaki parametreleri içerir: - -- `user` — username. -- `password` — password. - -**Örnek** - -``` xml - - admin - 222 - -``` - -## keep\_alive\_timeout {#keep-alive-timeout} - -ClickHouse bağlantıyı kapatmadan önce gelen istekleri bekler saniye sayısı. Varsayılan 3 saniye. - -**Örnek** - -``` xml -3 -``` - -## listen\_host {#server_configuration_parameters-listen_host} - -İsteklerin gelebileceği ana bilgisayarlarda kısıtlama. Sunucunun hepsini yanıtlamasını istiyorsanız, belirtin `::`. - -Örnekler: - -``` xml -::1 -127.0.0.1 -``` - -## kaydedici {#server_configuration_parameters-logger} - -Günlük ayarları. - -Anahtarlar: - -- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. -- log – The log file. Contains all the entries according to `level`. -- errorlog – Error log file. -- size – Size of the file. Applies to `log`ve`errorlog`. Dosya ulaştıktan sonra `size`, ClickHouse arşivleri ve yeniden adlandırır ve onun yerine yeni bir günlük dosyası oluşturur. -- count – The number of archived log files that ClickHouse stores. - -**Örnek** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -Syslog yazma da desteklenmektedir. Yapılandırma örneği: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -Anahtarlar: - -- use\_syslog — Required setting if you want to write to the syslog. -- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. -- hostname — Optional. The name of the host that logs are sent from. -- facility — [Syslog tesisi anahtar sözcüğü](https://en.wikipedia.org/wiki/Syslog#Facility) ile büyük harf inlerle “LOG\_” önek: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3` vb.). - Varsayılan değer: `LOG_USER` eğer `address` belirtilen, `LOG_DAEMON otherwise.` -- format – Message format. Possible values: `bsd` ve `syslog.` - -## makrolar {#macros} - -Çoğaltılmış tablolar için parametre değiştirmeleri. - -Çoğaltılmış tablolar kullanılmazsa atlanabilir. - -Daha fazla bilgi için bölüme bakın “[Çoğaltılmış tablolar oluşturma](../../engines/table_engines/mergetree_family/replication.md)”. - -**Örnek** - -``` xml - -``` - -## mark\_cache\_size {#server-mark-cache-size} - -Tablo motorları tarafından kullanılan işaretlerin önbelleğinin yaklaşık boyutu (bayt cinsinden) [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) aile. - -Önbellek sunucu için paylaşılır ve bellek gerektiği gibi ayrılır. Önbellek boyutu en az 5368709120 olmalıdır. - -**Örnek** - -``` xml -5368709120 -``` - -## max\_concurrent\_queries {#max-concurrent-queries} - -Aynı anda işlenen isteklerin maksimum sayısı. - -**Örnek** - -``` xml -100 -``` - -## max\_connections {#max-connections} - -En fazla gelen bağlantı sayısı. - -**Örnek** - -``` xml -4096 -``` - -## max\_open\_files {#max-open-files} - -Maksimum açık dosya sayısı. - -Varsayılan olarak: `maximum`. - -Biz beri Mac OS X bu seçeneği kullanmanızı öneririz `getrlimit()` işlev yanlış bir değer döndürür. - -**Örnek** - -``` xml -262144 -``` - -## max\_table\_size\_to\_drop {#max-table-size-to-drop} - -Tabloları silme konusunda kısıtlama. - -Eğer bir boyutu [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) tablo aşıyor `max_table_size_to_drop` (bayt cinsinden), bir bırakma sorgusu kullanarak silemezsiniz. - -ClickHouse sunucusunu yeniden başlatmadan tabloyu silmeniz gerekiyorsa, `/flags/force_drop_table` dosya ve bırakma sorgusunu çalıştırın. - -Varsayılan değer: 50 GB. - -0 değeri, herhangi bir kısıtlama olmaksızın tüm tabloları silebileceğiniz anlamına gelir. - -**Örnek** - -``` xml -0 -``` - -## merge\_tree {#server_configuration_parameters-merge_tree} - -Tablolar için ince ayar [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -Daha fazla bilgi için bkz: MergeTreeSettings.h başlık dosyası. - -**Örnek** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -SSL istemci / sunucu yapılandırması. - -SSL desteği tarafından sağlanmaktadır `libpoco` kitaplık. Arayüz dosyada açıklanmıştır [SSLManager.sa](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -Sunucu/istemci ayarları için tuşlar: - -- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. -- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` sertifika içerir. -- caConfig – The path to the file or directory that contains trusted root certificates. -- verificationMode – The method for checking the node's certificates. Details are in the description of the [Bağlama](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) sınıf. Olası değerler: `none`, `relaxed`, `strict`, `once`. -- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. -- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| -- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. Kabul edilebilir değerler: `true`, `false`. -- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. Bu parametre her zaman sunucu oturumu önbelleğe alır ve istemci önbellekleme istedi, sorunları önlemek yardımcı olduğundan önerilir. Varsayılan değer: `${application.name}`. -- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. -- sessionTimeout – Time for caching the session on the server. -- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. -- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. -- fips – Activates OpenSSL FIPS mode. Supported if the library's OpenSSL version supports FIPS. -- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . -- disableProtocols – Protocols that are not allowed to use. -- preferServerCiphers – Preferred server ciphers on the client. - -**Ayarlar örneği:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## part\_log {#server_configuration_parameters-part-log} - -İlişkili olayları günlüğe kaydetme [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). Örneğin, veri ekleme veya birleştirme. Birleştirme algoritmalarını simüle etmek ve özelliklerini karşılaştırmak için günlüğü kullanabilirsiniz. Birleştirme işlemini görselleştirebilirsiniz. - -Sorgular günlüğe kaydedilir [sistem.part\_log](../../operations/system_tables.md#system_tables-part-log) tablo, ayrı bir dosyada değil. Bu tablonun adını aşağıdaki tabloda yapılandırabilirsiniz: `table` parametre (aşağıya bakınız). - -Günlüğü yapılandırmak için aşağıdaki parametreleri kullanın: - -- `database` – Name of the database. -- `table` – Name of the system table. -- `partition_by` – Sets a [özel bölümleme anahtarı](../../engines/table_engines/mergetree_family/custom_partitioning_key.md). -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -**Örnek** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## yol {#server_configuration_parameters-path} - -Veri içeren dizinin yolu. - -!!! note "Not" - Sondaki eğik çizgi zorunludur. - -**Örnek** - -``` xml -/var/lib/clickhouse/ -``` - -## prometheus {#server_configuration_parameters-prometheus} - -Kazıma için metrik verilerini açığa çıkarma [Prometheus](https://prometheus.io). - -Ayarlar: - -- `endpoint` – HTTP endpoint for scraping metrics by prometheus server. Start from ‘/’. -- `port` – Port for `endpoint`. -- `metrics` – Flag that sets to expose metrics from the [sistem.metrik](../system_tables.md#system_tables-metrics) Tablo. -- `events` – Flag that sets to expose metrics from the [sistem.etkinlik](../system_tables.md#system_tables-events) Tablo. -- `asynchronous_metrics` – Flag that sets to expose current metrics values from the [sistem.asynchronous\_metrics](../system_tables.md#system_tables-asynchronous_metrics) Tablo. - -**Örnek** - -``` xml - - /metrics - 8001 - true - true - true - -``` - -## query\_log {#server_configuration_parameters-query-log} - -İle alınan günlük sorgu settinglarının ayarlanması [log\_queries = 1](../settings/settings.md) ayar. - -Sorgular günlüğe kaydedilir [sistem.query\_log](../../operations/system_tables.md#system_tables-query_log) tablo, ayrı bir dosyada değil. Tablonun adını değiştirebilirsiniz. `table` parametre (aşağıya bakınız). - -Günlüğü yapılandırmak için aşağıdaki parametreleri kullanın: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [özel bölümleme anahtarı](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) bir masa için. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -Tablo yoksa, ClickHouse bunu oluşturur. ClickHouse sunucusu güncelleştirildiğinde sorgu günlüğünün yapısı değiştiyse, eski yapıya sahip tablo yeniden adlandırılır ve otomatik olarak yeni bir tablo oluşturulur. - -**Örnek** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## query\_thread\_log {#server_configuration_parameters-query-thread-log} - -İle alınan sorguların günlük iş parçacıklarının ayarlanması [log\_query\_threads = 1](../settings/settings.md#settings-log-query-threads) ayar. - -Sorgular günlüğe kaydedilir [sistem.query\_thread\_log](../../operations/system_tables.md#system_tables-query-thread-log) tablo, ayrı bir dosyada değil. Tablonun adını değiştirebilirsiniz. `table` parametre (aşağıya bakınız). - -Günlüğü yapılandırmak için aşağıdaki parametreleri kullanın: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [özel bölümleme anahtarı](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) bir sistem tablosu için. -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -Tablo yoksa, ClickHouse bunu oluşturur. Sorgu iş parçacığı günlüğü yapısını değiştirdiyseniz ClickHouse sunucu güncelleştirildi, tablo eski yapısı ile yeniden adlandırılır ve yeni bir tablo otomatik olarak oluşturulur. - -**Örnek** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## trace\_log {#server_configuration_parameters-trace_log} - -İçin ayarlar [trace\_log](../../operations/system_tables.md#system_tables-trace_log) sistem tablosu çalışması. - -Parametre: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [Özel bölümleme anahtarı](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) bir sistem tablosu için. -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -Varsayılan sunucu yapılandırma dosyası `config.xml` aşağıdaki ayarlar bölümünü içerir: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## query\_masking\_rules {#query-masking-rules} - -Regexp tabanlı kurallar, sorgulara ve tüm günlük iletilerine sunucu günlüklerinde depolamadan önce uygulanacak, -`system.query_log`, `system.text_log`, `system.processes` tablo ve istemciye gönderilen günlüklerde. Önlem allowseyi sağlayan -SQL sorgularından hassas veri sızıntısı (isimler, e-postalar, kişisel -kimlik veya kredi kartı numaraları) günlükleri için. - -**Örnek** - -``` xml - - - hide SSN - (^|\D)\d{3}-\d{2}-\d{4}($|\D) - 000-00-0000 - - -``` - -Config alanları: -- `name` - kuralın adı (isteğe bağlı) -- `regexp` - Re2 uyumlu düzenli ifade (zorunlu) -- `replace` - hassas veriler için ikame dizesi (isteğe bağlı, varsayılan olarak-altı Yıldız İşareti) - -Maskeleme kuralları tüm sorguya uygulanır (hatalı biçimlendirilmiş / ayrıştırılamayan sorgulardan hassas verilerin sızıntılarını önlemek için). - -`system.events` tablo sayacı var `QueryMaskingRulesMatch` hangi sorgu maskeleme kuralları maçları genel bir numarası var. - -Dağıtılmış sorgular için her sunucu ayrı ayrı yapılandırılmalıdır, aksi takdirde alt sorgular diğerine iletilir -düğümler maskeleme olmadan saklanır. - -## remote\_servers {#server-settings-remote-servers} - -Tarafından kullanılan küm ofelerin yapılandırması [Dağılı](../../engines/table_engines/special/distributed.md) tablo motoru ve `cluster` tablo işlevi. - -**Örnek** - -``` xml - -``` - -Değeri için `incl` öznitelik, bölümüne bakın “[Yapılandırma dosyaları](../configuration_files.md#configuration_files)”. - -**Ayrıca Bakınız** - -- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) - -## saat dilimi {#server_configuration_parameters-timezone} - -Sunucunun saat dilimi. - -UTC saat dilimi veya coğrafi konum (örneğin, Afrika / Abidjan) için bir IANA tanımlayıcısı olarak belirtilir. - -Saat dilimi, datetime alanları metin biçimine (ekranda veya dosyada yazdırıldığında) çıktığında ve datetime'ı bir dizeden alırken dize ve DateTime biçimleri arasındaki dönüşümler için gereklidir. Ayrıca, saat dilimi, giriş parametrelerinde saat dilimini almadıkları takdirde saat ve tarih ile çalışan işlevlerde kullanılır. - -**Örnek** - -``` xml -Europe/Moscow -``` - -## tcp\_port {#server_configuration_parameters-tcp_port} - -TCP protokolü üzerinden istemcilerle iletişim kurmak için bağlantı noktası. - -**Örnek** - -``` xml -9000 -``` - -## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} - -İstemcilerle güvenli iletişim için TCP bağlantı noktası. İle kullanın [OpenSSL](#server_configuration_parameters-openssl) ayarlar. - -**Olası değerler** - -Pozitif tamsayı. - -**Varsayılan değer** - -``` xml -9440 -``` - -## mysql\_port {#server_configuration_parameters-mysql_port} - -MySQL protokolü üzerinden istemcilerle iletişim kurmak için bağlantı noktası. - -**Olası değerler** - -Pozitif tamsayı. - -Örnek - -``` xml -9004 -``` - -## tmp\_path {#server-settings-tmp_path} - -Büyük sorguları işlemek için geçici veri yolu. - -!!! note "Not" - Sondaki eğik çizgi zorunludur. - -**Örnek** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## tmp\_policy {#server-settings-tmp-policy} - -Politika dan [`storage_configuration`](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) geçici dosyaları saklamak için. -Set değilse [`tmp_path`](#server-settings-tmp_path) kullanılır, aksi takdirde göz ardı edilir. - -!!! note "Not" - - `move_factor` göz ardı edilir -- `keep_free_space_bytes` göz ardı edilir -- `max_data_part_size_bytes` göz ardı edilir -- bu Politikada tam olarak bir cilt olmalı - -## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} - -Tablo motorları tarafından kullanılan sıkıştırılmamış veriler için önbellek boyutu (bayt cinsinden) [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -Sunucu için bir paylaşılan önbellek var. Bellek talep üzerine tahsis edilir. Seçenek varsa önbellek kullanılır [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) etkindir. - -Sıkıştırılmamış önbellek, tek tek durumlarda çok kısa sorgular için avantajlıdır. - -**Örnek** - -``` xml -8589934592 -``` - -## user\_files\_path {#server_configuration_parameters-user_files_path} - -Kullanıcı dosyaları ile dizin. Tablo işlevinde kullanılır [Dosya()](../../sql_reference/table_functions/file.md). - -**Örnek** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## users\_config {#users-config} - -İçeren dosyanın yolu: - -- Kullanıcı yapılandırmaları. -- Erişim hakları. -- Ayarlar profilleri. -- Kota ayarları. - -**Örnek** - -``` xml -users.xml -``` - -## zookeeper {#server-settings_zookeeper} - -ClickHouse ile etkileşim sağlayan ayarları içerir [ZooKeeper](http://zookeeper.apache.org/) küme. - -ClickHouse, çoğaltılmış tabloları kullanırken kopyaların meta verilerini depolamak için ZooKeeper kullanır. Çoğaltılmış tablolar kullanılmazsa, parametrelerin bu bölümü atlanabilir. - -Bu bölüm aşağıdaki parametreleri içerir: - -- `node` — ZooKeeper endpoint. You can set multiple endpoints. - - Mesela: - - - -``` xml - - example_host - 2181 - -``` - - The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. - -- `session_timeout` — Maximum timeout for the client session in milliseconds. -- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) bu, ClickHouse sunucusu tarafından kullanılan znodes için kök olarak kullanılır. İsteğe bağlı. -- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. - -**Örnek yapılandırma** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - 10000 - - /path/to/zookeeper/node - - user:password - -``` - -**Ayrıca Bakınız** - -- [Çoğalma](../../engines/table_engines/mergetree_family/replication.md) -- [ZooKeeper programcı Kılavuzu](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} - -ZooKeeper veri parçası başlıkları için depolama yöntemi. - -Bu ayar yalnızca `MergeTree` aile. Belirt specifiedilebilir: - -- Küresel olarak [merge\_tree](#server_configuration_parameters-merge_tree) bu bölüm `config.xml` Dosya. - - ClickHouse sunucudaki tüm tablolar için ayarı kullanır. Ayarı istediğiniz zaman değiştirebilirsiniz. Mevcut tablolar, ayar değiştiğinde davranışlarını değiştirir. - -- Her tablo için. - - Bir tablo oluştururken, karşılık gelen [motor ayarı](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). Genel ayar değişse bile, bu ayara sahip varolan bir tablonun davranışı değişmez. - -**Olası değerler** - -- 0 — Functionality is turned off. -- 1 — Functionality is turned on. - -Eğer `use_minimalistic_part_header_in_zookeeper = 1`, sonraları [çoğaltıyordu](../../engines/table_engines/mergetree_family/replication.md) tablolar, veri parçalarının başlıklarını tek bir `znode`. Tablo çok sayıda sütun içeriyorsa, bu depolama yöntemi Zookeeper'da depolanan verilerin hacmini önemli ölçüde azaltır. - -!!! attention "Dikkat" - Uyguladıktan sonra `use_minimalistic_part_header_in_zookeeper = 1`, ClickHouse sunucusunu bu ayarı desteklemeyen bir sürüme düşüremezsiniz. Bir kümedeki sunucularda ClickHouse yükseltirken dikkatli olun. Tüm sunucuları bir kerede yükseltmeyin. Clickhouse'un yeni sürümlerini bir test ortamında veya bir kümenin yalnızca birkaç sunucusunda test etmek daha güvenlidir. - - Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. - -**Varsayılan değer:** 0. - -## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} - -İç DNS önbelleğini devre dışı bırakır. Sistemlerinde ClickHouse işletim için tavsiye -Kubernetes gibi sık sık değişen altyapı ile. - -**Varsayılan değer:** 0. - -## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} - -ClickHouse iç DNS önbelleğinde saklanan IP adreslerini güncelleme süresi (saniye cinsinden). -Güncelleştirme, ayrı bir sistem iş parçacığında zaman uyumsuz olarak gerçekleştirilir. - -**Varsayılan değer**: 15. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/tr/operations/settings/constraints_on_settings.md b/docs/tr/operations/settings/constraints-on-settings.md similarity index 100% rename from docs/tr/operations/settings/constraints_on_settings.md rename to docs/tr/operations/settings/constraints-on-settings.md diff --git a/docs/tr/operations/settings/index.md b/docs/tr/operations/settings/index.md index 72270b8a397..ed9d7f49151 100644 --- a/docs/tr/operations/settings/index.md +++ b/docs/tr/operations/settings/index.md @@ -25,7 +25,7 @@ Ayarlar katmanlar halinde yapılandırılır, böylece sonraki her katman öncek - Sorgu ayarları. - ClickHouse konsol istemcisini etkileşimli olmayan modda başlatırken, başlangıç parametresini ayarlayın `--setting=value`. - - HTTP API'sini kullanırken, CGI parametrelerini geçirin (`URL?setting_1=value&setting_2=value...`). + - HTTP API’sini kullanırken, CGI parametrelerini geçirin (`URL?setting_1=value&setting_2=value...`). Yalnızca sunucu yapılandırma dosyasında yapılabilecek ayarlar bu bölümde yer almaz. diff --git a/docs/tr/operations/settings/permissions-for-queries.md b/docs/tr/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..d4b023f5fb3 --- /dev/null +++ b/docs/tr/operations/settings/permissions-for-queries.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 58 +toc_title: "Sorgular i\xE7in izinler" +--- + +# Sorgular için Izinler {#permissions_for_queries} + +Clickhouse’daki sorgular birkaç türe ayrılabilir: + +1. Veri sorgularını oku: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. Veri sorgularını yaz: `INSERT`, `OPTIMIZE`. +3. Ayarları değiştir sorgu: `SET`, `USE`. +4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) sorgular: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +Aşağıdaki ayarlar, kullanıcı izinlerini sorgu Türüne göre düzenler: + +- [readonly](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. +- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. + +`KILL QUERY` herhangi bir ayar ile yapılabilir. + +## readonly {#settings_readonly} + +Veri okuma, veri yazma ve ayar sorgularını değiştirme izinlerini kısıtlar. + +Sorguların türlere nasıl ayrıldığını görün [üzerinde](#permissions_for_queries). + +Olası değerler: + +- 0 — All queries are allowed. +- 1 — Only read data queries are allowed. +- 2 — Read data and change settings queries are allowed. + +Sonra ayarı `readonly = 1`, kullanıcı değiştir canemez `readonly` ve `allow_ddl` geçerli oturumda ayarlar. + +Kullanırken `GET` metho thed in the [HTTP arayüzü](../../interfaces/http.md), `readonly = 1` otomatik olarak ayarlanır. Değiştirmek için veri kullanın `POST` yöntem. + +Ayar `readonly = 1` kullanıcının tüm ayarları değiştirmesini yasaklayın. Kullanıcıyı yasaklamanın bir yolu var +sadece belirli ayarları değiştirmekten, ayrıntılar için bkz [ayarlardaki kısıtlamalar](constraints-on-settings.md). + +Varsayılan değer: 0 + +## allow\_ddl {#settings_allow_ddl} + +İzin verir veya reddeder [DDL](https://en.wikipedia.org/wiki/Data_definition_language) sorgular. + +Sorguların türlere nasıl ayrıldığını görün [üzerinde](#permissions_for_queries). + +Olası değerler: + +- 0 — DDL queries are not allowed. +- 1 — DDL queries are allowed. + +Yürüt canemezsiniz `SET allow_ddl = 1` eğer `allow_ddl = 0` geçerli oturum için. + +Varsayılan değer: 1 + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/tr/operations/settings/permissions_for_queries.md b/docs/tr/operations/settings/permissions_for_queries.md deleted file mode 100644 index 2f65630604c..00000000000 --- a/docs/tr/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 58 -toc_title: "Sorgular i\xE7in izinler" ---- - -# Sorgular için izinler {#permissions_for_queries} - -Clickhouse'daki sorgular birkaç türe ayrılabilir: - -1. Veri sorgularını oku: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. Veri sorgularını yaz: `INSERT`, `OPTIMIZE`. -3. Ayarları değiştir sorgu: `SET`, `USE`. -4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) sorgular: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -Aşağıdaki ayarlar, kullanıcı izinlerini sorgu Türüne göre düzenler: - -- [readonly](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. -- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. - -`KILL QUERY` herhangi bir ayar ile yapılabilir. - -## readonly {#settings_readonly} - -Veri okuma, veri yazma ve ayar sorgularını değiştirme izinlerini kısıtlar. - -Sorguların türlere nasıl ayrıldığını görün [üzerinde](#permissions_for_queries). - -Olası değerler: - -- 0 — All queries are allowed. -- 1 — Only read data queries are allowed. -- 2 — Read data and change settings queries are allowed. - -Sonra ayarı `readonly = 1`, kullanıcı değiştir canemez `readonly` ve `allow_ddl` geçerli oturumda ayarlar. - -Kullanırken `GET` metho thed in the [HTTP arayüzü](../../interfaces/http.md), `readonly = 1` otomatik olarak ayarlanır. Değiştirmek için veri kullanın `POST` yöntem. - -Ayar `readonly = 1` kullanıcının tüm ayarları değiştirmesini yasaklayın. Kullanıcıyı yasaklamanın bir yolu var -sadece belirli ayarları değiştirmekten, ayrıntılar için bkz [ayarlardaki kısıtlamalar](constraints_on_settings.md). - -Varsayılan değer: 0 - -## allow\_ddl {#settings_allow_ddl} - -İzin verir veya reddeder [DDL](https://en.wikipedia.org/wiki/Data_definition_language) sorgular. - -Sorguların türlere nasıl ayrıldığını görün [üzerinde](#permissions_for_queries). - -Olası değerler: - -- 0 — DDL queries are not allowed. -- 1 — DDL queries are allowed. - -Yürüt canemezsiniz `SET allow_ddl = 1` eğer `allow_ddl = 0` geçerli oturum için. - -Varsayılan değer: 1 - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/tr/operations/settings/query-complexity.md b/docs/tr/operations/settings/query-complexity.md new file mode 100644 index 00000000000..248f7884f60 --- /dev/null +++ b/docs/tr/operations/settings/query-complexity.md @@ -0,0 +1,302 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 59 +toc_title: "Sorgu karma\u015F\u0131kl\u0131\u011F\u0131 \xFCzerindeki k\u0131s\u0131\ + tlamalar" +--- + +# Sorgu Karmaşıklığı Üzerindeki Kısıtlamalar {#restrictions-on-query-complexity} + +Sorgu karmaşıklığı üzerindeki kısıtlamalar ayarların bir parçasıdır. +Kullanıcı arabiriminden daha güvenli yürütme sağlamak için kullanılırlar. +Hemen hemen tüm kısıtlamalar sadece aşağıdakiler için geçerlidir `SELECT`. Dağıtılmış sorgu işleme için kısıtlamalar her sunucuda ayrı ayrı uygulanır. + +ClickHouse, her satır için değil, veri bölümleri için kısıtlamaları denetler. Bu, veri parçasının boyutu ile kısıtlama değerini aşabileceğiniz anlamına gelir. + +Üzerindeki kısıtlamalar “maximum amount of something” 0 değerini alabilir, yani “unrestricted”. +Çoğu kısıtlama da bir ‘overflow\_mode’ ayar, sınır aşıldığında ne yapılması gerektiği anlamına gelir. +İki değerden birini alabilir: `throw` veya `break`. Toplama (group\_by\_overflow\_mode) üzerindeki kısıtlamalar da değere sahiptir `any`. + +`throw` – Throw an exception (default). + +`break` – Stop executing the query and return the partial result, as if the source data ran out. + +`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. + +## max\_memory\_usage {#settings_max_memory_usage} + +Tek bir sunucuda bir sorgu çalıştırmak için kullanılacak en fazla RAM miktarı. + +Varsayılan yapılandırma dosyasında maksimum 10 GB’DİR. + +Bu ayar, kullanılabilir belleğin hacmini veya makinedeki toplam bellek hacmini dikkate almaz. +Kısıtlama, tek bir sunucu içindeki tek bir sorgu için geçerlidir. +Kullanabilirsiniz `SHOW PROCESSLIST` her sorgu için geçerli bellek tüketimini görmek için. +Ayrıca, en yüksek bellek tüketimi her sorgu için izlenir ve günlüğe yazılır. + +Bellek kullanımı, belirli toplama işlevlerinin durumları için izlenmez. + +Toplam işlevlerin durumları için bellek kullanımı tam olarak izlenmiyor `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` itibaren `String` ve `Array` değişkenler. + +Bellek tüketimi de parametrelerle sınırlıdır `max_memory_usage_for_user` ve `max_memory_usage_for_all_queries`. + +## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} + +Tek bir sunucuda bir kullanıcının sorguları çalıştırmak için kullanılacak en fazla RAM miktarı. + +Varsayılan değerler [Ayarlar.sa](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). Varsayılan olarak, tutar sınırlı değildir (`max_memory_usage_for_user = 0`). + +Ayrıca açıklamasına bakın [max\_memory\_usage](#settings_max_memory_usage). + +## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} + +Tek bir sunucuda tüm sorguları çalıştırmak için kullanılacak en fazla RAM miktarı. + +Varsayılan değerler [Ayarlar.sa](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). Varsayılan olarak, tutar sınırlı değildir (`max_memory_usage_for_all_queries = 0`). + +Ayrıca açıklamasına bakın [max\_memory\_usage](#settings_max_memory_usage). + +## max\_rows\_to\_read {#max-rows-to-read} + +Aşağıdaki kısıtlamalar her blokta kontrol edilebilir (her satır yerine). Yani, kısıtlamalar biraz kırılabilir. +Birden çok iş parçacığında bir sorgu çalıştırırken, aşağıdaki kısıtlamalar her iş parçacığı için ayrı ayrı uygulanır. + +Bir sorgu çalıştırırken bir tablodan okunabilen satır sayısı. + +## max\_bytes\_to\_read {#max-bytes-to-read} + +Bir sorgu çalıştırırken bir tablodan okunabilen bayt sayısı (sıkıştırılmamış veri). + +## read\_overflow\_mode {#read-overflow-mode} + +Okunan veri hacmi sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. + +## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} + +Toplama alınan benzersiz anahtarların maksimum sayısı. Bu ayar, toplama sırasında bellek tüketimini sınırlamanızı sağlar. + +## group\_by\_overflow\_mode {#group-by-overflow-mode} + +Toplama için benzersiz anahtarların sayısı sınırı aştığında ne yapmalı: ‘throw’, ‘break’, veya ‘any’. Varsayılan olarak, atın. +Kullanarak ‘any’ değer, GROUP BY’NİN bir yaklaşımını çalıştırmanızı sağlar. Bu yaklaşımın kalitesi, verilerin istatistiksel niteliğine bağlıdır. + +## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} + +Çalıştırmayı etkinleştirir veya devre dışı bırakır `GROUP BY` harici bellekte yan tümceleri. Görmek [Harici bellekte grupla](../../sql-reference/statements/select.md#select-group-by-in-external-memory). + +Olası değerler: + +- Tek tarafından kullanılabilecek maksimum RAM hacmi (bayt cinsinden) [GROUP BY](../../sql-reference/statements/select.md#select-group-by-clause) işleyiş. +- 0 — `GROUP BY` harici bellekte devre dışı. + +Varsayılan değer: 0. + +## max\_rows\_to\_sort {#max-rows-to-sort} + +Sıralamadan önce en fazla satır sayısı. Bu, sıralama yaparken bellek tüketimini sınırlamanıza izin verir. + +## max\_bytes\_to\_sort {#max-bytes-to-sort} + +Sıralamadan önce en fazla bayt sayısı. + +## sort\_overflow\_mode {#sort-overflow-mode} + +Sıralamadan önce alınan satır sayısı sınırlardan birini aşarsa ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. + +## max\_result\_rows {#setting-max_result_rows} + +Sonuçtaki satır sayısını sınırlayın. Ayrıca, dağıtılmış bir sorgunun parçalarını çalıştırırken alt sorgular ve uzak sunucularda da kontrol edildi. + +## max\_result\_bytes {#max-result-bytes} + +Sonuçtaki bayt sayısını sınırlayın. Önceki ayar ile aynı. + +## result\_overflow\_mode {#result-overflow-mode} + +Sonucun hacmi sınırlardan birini aşarsa ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. + +Kullanım ‘break’ LİMİT kullanmaya benzer. `Break` yürütmeyi yalnızca blok düzeyinde keser. Bu, döndürülen satırların miktarının daha büyük olduğu anlamına gelir [max\_result\_rows](#setting-max_result_rows) birden çok [max\_block\_size](settings.md#setting-max_block_size) ve bağlıdır [max\_threads](settings.md#settings-max_threads). + +Örnek: + +``` sql +SET max_threads = 3, max_block_size = 3333; +SET max_result_rows = 3334, result_overflow_mode = 'break'; + +SELECT * +FROM numbers_mt(100000) +FORMAT Null; +``` + +Sonuç: + +``` text +6666 rows in set. ... +``` + +## max\_execution\_time {#max-execution-time} + +Saniye cinsinden maksimum sorgu yürütme süresi. +Şu anda, sıralama aşamalarından biri için veya toplama işlevlerini birleştirirken ve sonlandırırken kontrol edilmez. + +## timeout\_overflow\_mode {#timeout-overflow-mode} + +Sorgu daha uzun çalıştırılırsa ne yapmalı ‘max\_execution\_time’: ‘throw’ veya ‘break’. Varsayılan olarak, atın. + +## min\_execution\_speed {#min-execution-speed} + +Saniyede satırlarda minimum yürütme hızı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı düşükse, bir istisna atılır. + +## min\_execution\_speed\_bytes {#min-execution-speed-bytes} + +Saniyede en az yürütme bayt sayısı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı düşükse, bir istisna atılır. + +## max\_execution\_speed {#max-execution-speed} + +Saniyede en fazla yürütme satırı sayısı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı yüksekse, yürütme hızı azaltılır. + +## max\_execution\_speed\_bytes {#max-execution-speed-bytes} + +Saniyede en fazla yürütme bayt sayısı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı yüksekse, yürütme hızı azaltılır. + +## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} + +Yürütme hızının çok yavaş olmadığını kontrol eder (en az ‘min\_execution\_speed’), saniye içinde belirtilen süre dolduktan sonra. + +## max\_columns\_to\_read {#max-columns-to-read} + +Tek bir sorguda bir tablodan okunabilen sütun sayısı. Bir sorgu daha fazla sayıda sütun okuma gerektiriyorsa, bir özel durum atar. + +## max\_temporary\_columns {#max-temporary-columns} + +Sabit sütunlar da dahil olmak üzere bir sorgu çalıştırırken aynı anda RAM’de tutulması gereken geçici sütun sayısı. Bundan daha fazla geçici sütun varsa, bir istisna atar. + +## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} + +Aynı şey ‘max\_temporary\_columns’, ancak sabit sütunları saymadan. +Bir sorgu çalıştırırken sabit sütunların oldukça sık oluşturulduğunu, ancak yaklaşık sıfır bilgi işlem kaynağı gerektirdiğini unutmayın. + +## max\_subquery\_depth {#max-subquery-depth} + +Alt sorguların maksimum yuvalama derinliği. Alt sorgular daha derinse, bir istisna atılır. Varsayılan olarak, 100. + +## max\_pipeline\_depth {#max-pipeline-depth} + +Maksimum boru hattı derinliği. Sorgu işleme sırasında her veri bloğunun geçtiği dönüşümlerin sayısına karşılık gelir. Tek bir sunucunun sınırları içinde sayılır. Boru hattı derinliği büyükse, bir istisna atılır. Varsayılan olarak, 1000. + +## max\_ast\_depth {#max-ast-depth} + +Sorgu sözdizimsel ağacının en fazla yuvalama derinliği. Aşılırsa, bir istisna atılır. +Şu anda, ayrıştırma sırasında değil, yalnızca sorguyu ayrıştırdıktan sonra kontrol edilir. Yani, ayrıştırma sırasında çok derin bir sözdizimsel ağaç oluşturulabilir, ancak sorgu başarısız olur. Varsayılan olarak, 1000. + +## max\_ast\_elements {#max-ast-elements} + +Sorgu sözdizimsel ağacındaki en fazla öğe sayısı. Aşılırsa, bir istisna atılır. +Önceki ayarla aynı şekilde, yalnızca sorguyu ayrıştırdıktan sonra kontrol edilir. Varsayılan olarak, 50.000. + +## max\_rows\_in\_set {#max-rows-in-set} + +Bir alt sorgudan oluşturulan In yan tümcesinde bir veri kümesi için satır sayısı. + +## max\_bytes\_in\_set {#max-bytes-in-set} + +Bir alt sorgudan oluşturulan In yan tümcesinde bir set tarafından kullanılan en fazla bayt sayısı (sıkıştırılmamış veri). + +## set\_overflow\_mode {#set-overflow-mode} + +Veri miktarı sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. + +## max\_rows\_ın\_distinct {#max-rows-in-distinct} + +DISTINCT kullanırken en fazla sayıda farklı satır. + +## max\_bytes\_ın\_distinct {#max-bytes-in-distinct} + +DISTINCT kullanırken bir karma tablo tarafından kullanılan bayt sayısı. + +## distinct\_overflow\_mode {#distinct-overflow-mode} + +Veri miktarı sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. + +## max\_rows\_to\_transfer {#max-rows-to-transfer} + +Uzak bir sunucuya geçirilen veya GLOBAL In kullanırken geçici bir tabloya kaydedilen satır sayısı. + +## max\_bytes\_to\_transfer {#max-bytes-to-transfer} + +Uzak bir sunucuya geçirilen veya GLOBAL In kullanırken geçici bir tabloya kaydedilen bayt sayısı (sıkıştırılmamış veri). + +## transfer\_overflow\_mode {#transfer-overflow-mode} + +Veri miktarı sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. + +## max\_rows\_in\_join {#settings-max_rows_in_join} + +Tabloları birleştirirken kullanılan karma tablodaki satır sayısını sınırlar. + +Bu ayarlar aşağıdakiler için geçerlidir [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) işlemleri ve [Katmak](../../engines/table-engines/special/join.md) masa motoru. + +Bir sorgu birden çok birleşim içeriyorsa, ClickHouse her Ara sonuç için bu ayarı denetler. + +Limit ulaşıldığında ClickHouse farklı eylemlerle devam edebilirsiniz. Kullan… [join\_overflow\_mode](#settings-join_overflow_mode) eylemi seçmek için ayarlama. + +Olası değerler: + +- Pozitif tamsayı. +- 0 — Unlimited number of rows. + +Varsayılan değer: 0. + +## max\_bytes\_in\_join {#settings-max_bytes_in_join} + +Tabloları birleştirirken kullanılan karma tablonun bayt cinsinden boyutunu sınırlar. + +Bu ayarlar aşağıdakiler için geçerlidir [SELECT … JOIN](../../sql-reference/statements/select.md#select-join) işlemleri ve [Jo tablein table engine](../../engines/table-engines/special/join.md). + +Sorgu birleşimler içeriyorsa, ClickHouse her Ara sonuç için bu ayarı denetler. + +Limit ulaşıldığında ClickHouse farklı eylemlerle devam edebilirsiniz. Kullanmak [join\_overflow\_mode](#settings-join_overflow_mode) eylemi seçmek için ayarlar. + +Olası değerler: + +- Pozitif tamsayı. +- 0 — Memory control is disabled. + +Varsayılan değer: 0. + +## join\_overflow\_mode {#settings-join_overflow_mode} + +Tanımlar katılın aşağıdaki sınırlar her zaman eylem ClickHouse gerçekleştirdiği ulaştı: + +- [max\_bytes\_in\_join](#settings-max_bytes_in_join) +- [max\_rows\_in\_join](#settings-max_rows_in_join) + +Olası değerler: + +- `THROW` — ClickHouse throws an exception and breaks operation. +- `BREAK` — ClickHouse breaks operation and doesn’t throw an exception. + +Varsayılan değer: `THROW`. + +**Ayrıca Bakınız** + +- [Jo](../../sql-reference/statements/select.md#select-join) +- [Jo tablein table engine](../../engines/table-engines/special/join.md) + +## max\_partitions\_per\_ınsert\_block {#max-partitions-per-insert-block} + +Eklenen tek bir bloktaki en fazla bölüm sayısını sınırlar. + +- Pozitif tamsayı. +- 0 — Unlimited number of partitions. + +Varsayılan değer: 100. + +**Ayrıntı** + +Veri eklerken, ClickHouse eklenen bloktaki bölüm sayısını hesaplar. Bölüm sayısı fazla ise `max_partitions_per_insert_block`, ClickHouse aşağıdaki metinle bir özel durum atar: + +> “Too many partitions for single INSERT block (more than” + toString (max\_parts) + “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/tr/operations/settings/query_complexity.md b/docs/tr/operations/settings/query_complexity.md deleted file mode 100644 index 54958b786ab..00000000000 --- a/docs/tr/operations/settings/query_complexity.md +++ /dev/null @@ -1,302 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 59 -toc_title: "Sorgu karma\u015F\u0131kl\u0131\u011F\u0131 \xFCzerindeki k\u0131s\u0131\ - tlamalar" ---- - -# Sorgu Karmaşıklığı Üzerindeki Kısıtlamalar {#restrictions-on-query-complexity} - -Sorgu karmaşıklığı üzerindeki kısıtlamalar ayarların bir parçasıdır. -Kullanıcı arabiriminden daha güvenli yürütme sağlamak için kullanılırlar. -Hemen hemen tüm kısıtlamalar sadece aşağıdakiler için geçerlidir `SELECT`. Dağıtılmış sorgu işleme için kısıtlamalar her sunucuda ayrı ayrı uygulanır. - -ClickHouse, her satır için değil, veri bölümleri için kısıtlamaları denetler. Bu, veri parçasının boyutu ile kısıtlama değerini aşabileceğiniz anlamına gelir. - -Üzerindeki kısıtlamalar “maximum amount of something” 0 değerini alabilir, yani “unrestricted”. -Çoğu kısıtlama da bir ‘overflow\_mode’ ayar, sınır aşıldığında ne yapılması gerektiği anlamına gelir. -İki değerden birini alabilir: `throw` veya `break`. Toplama (group\_by\_overflow\_mode) üzerindeki kısıtlamalar da değere sahiptir `any`. - -`throw` – Throw an exception (default). - -`break` – Stop executing the query and return the partial result, as if the source data ran out. - -`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don't add new keys to the set. - -## max\_memory\_usage {#settings_max_memory_usage} - -Tek bir sunucuda bir sorgu çalıştırmak için kullanılacak en fazla RAM miktarı. - -Varsayılan yapılandırma dosyasında maksimum 10 GB'DİR. - -Bu ayar, kullanılabilir belleğin hacmini veya makinedeki toplam bellek hacmini dikkate almaz. -Kısıtlama, tek bir sunucu içindeki tek bir sorgu için geçerlidir. -Kullanabilirsiniz `SHOW PROCESSLIST` her sorgu için geçerli bellek tüketimini görmek için. -Ayrıca, en yüksek bellek tüketimi her sorgu için izlenir ve günlüğe yazılır. - -Bellek kullanımı, belirli toplama işlevlerinin durumları için izlenmez. - -Toplam işlevlerin durumları için bellek kullanımı tam olarak izlenmiyor `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` itibaren `String` ve `Array` değişkenler. - -Bellek tüketimi de parametrelerle sınırlıdır `max_memory_usage_for_user` ve `max_memory_usage_for_all_queries`. - -## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} - -Tek bir sunucuda bir kullanıcının sorguları çalıştırmak için kullanılacak en fazla RAM miktarı. - -Varsayılan değerler [Ayarlar.sa](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L288). Varsayılan olarak, tutar sınırlı değildir (`max_memory_usage_for_user = 0`). - -Ayrıca açıklamasına bakın [max\_memory\_usage](#settings_max_memory_usage). - -## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} - -Tek bir sunucuda tüm sorguları çalıştırmak için kullanılacak en fazla RAM miktarı. - -Varsayılan değerler [Ayarlar.sa](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.h#L289). Varsayılan olarak, tutar sınırlı değildir (`max_memory_usage_for_all_queries = 0`). - -Ayrıca açıklamasına bakın [max\_memory\_usage](#settings_max_memory_usage). - -## max\_rows\_to\_read {#max-rows-to-read} - -Aşağıdaki kısıtlamalar her blokta kontrol edilebilir (her satır yerine). Yani, kısıtlamalar biraz kırılabilir. -Birden çok iş parçacığında bir sorgu çalıştırırken, aşağıdaki kısıtlamalar her iş parçacığı için ayrı ayrı uygulanır. - -Bir sorgu çalıştırırken bir tablodan okunabilen satır sayısı. - -## max\_bytes\_to\_read {#max-bytes-to-read} - -Bir sorgu çalıştırırken bir tablodan okunabilen bayt sayısı (sıkıştırılmamış veri). - -## read\_overflow\_mode {#read-overflow-mode} - -Okunan veri hacmi sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. - -## max\_rows\_to\_group\_by {#settings-max-rows-to-group-by} - -Toplama alınan benzersiz anahtarların maksimum sayısı. Bu ayar, toplama sırasında bellek tüketimini sınırlamanızı sağlar. - -## group\_by\_overflow\_mode {#group-by-overflow-mode} - -Toplama için benzersiz anahtarların sayısı sınırı aştığında ne yapmalı: ‘throw’, ‘break’, veya ‘any’. Varsayılan olarak, atın. -Kullanarak ‘any’ değer, GROUP BY'NİN bir yaklaşımını çalıştırmanızı sağlar. Bu yaklaşımın kalitesi, verilerin istatistiksel niteliğine bağlıdır. - -## max\_bytes\_before\_external\_group\_by {#settings-max_bytes_before_external_group_by} - -Çalıştırmayı etkinleştirir veya devre dışı bırakır `GROUP BY` harici bellekte yan tümceleri. Görmek [Harici bellekte grupla](../../sql_reference/statements/select.md#select-group-by-in-external-memory). - -Olası değerler: - -- Tek tarafından kullanılabilecek maksimum RAM hacmi (bayt cinsinden) [GROUP BY](../../sql_reference/statements/select.md#select-group-by-clause) işleyiş. -- 0 — `GROUP BY` harici bellekte devre dışı. - -Varsayılan değer: 0. - -## max\_rows\_to\_sort {#max-rows-to-sort} - -Sıralamadan önce en fazla satır sayısı. Bu, sıralama yaparken bellek tüketimini sınırlamanıza izin verir. - -## max\_bytes\_to\_sort {#max-bytes-to-sort} - -Sıralamadan önce en fazla bayt sayısı. - -## sort\_overflow\_mode {#sort-overflow-mode} - -Sıralamadan önce alınan satır sayısı sınırlardan birini aşarsa ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. - -## max\_result\_rows {#setting-max_result_rows} - -Sonuçtaki satır sayısını sınırlayın. Ayrıca, dağıtılmış bir sorgunun parçalarını çalıştırırken alt sorgular ve uzak sunucularda da kontrol edildi. - -## max\_result\_bytes {#max-result-bytes} - -Sonuçtaki bayt sayısını sınırlayın. Önceki ayar ile aynı. - -## result\_overflow\_mode {#result-overflow-mode} - -Sonucun hacmi sınırlardan birini aşarsa ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. - -Kullanım ‘break’ LİMİT kullanmaya benzer. `Break` yürütmeyi yalnızca blok düzeyinde keser. Bu, döndürülen satırların miktarının daha büyük olduğu anlamına gelir [max\_result\_rows](#setting-max_result_rows) birden çok [max\_block\_size](settings.md#setting-max_block_size) ve bağlıdır [max\_threads](settings.md#settings-max_threads). - -Örnek: - -``` sql -SET max_threads = 3, max_block_size = 3333; -SET max_result_rows = 3334, result_overflow_mode = 'break'; - -SELECT * -FROM numbers_mt(100000) -FORMAT Null; -``` - -Sonuç: - -``` text -6666 rows in set. ... -``` - -## max\_execution\_time {#max-execution-time} - -Saniye cinsinden maksimum sorgu yürütme süresi. -Şu anda, sıralama aşamalarından biri için veya toplama işlevlerini birleştirirken ve sonlandırırken kontrol edilmez. - -## timeout\_overflow\_mode {#timeout-overflow-mode} - -Sorgu daha uzun çalıştırılırsa ne yapmalı ‘max\_execution\_time’: ‘throw’ veya ‘break’. Varsayılan olarak, atın. - -## min\_execution\_speed {#min-execution-speed} - -Saniyede satırlarda minimum yürütme hızı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı düşükse, bir istisna atılır. - -## min\_execution\_speed\_bytes {#min-execution-speed-bytes} - -Saniyede en az yürütme bayt sayısı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı düşükse, bir istisna atılır. - -## max\_execution\_speed {#max-execution-speed} - -Saniyede en fazla yürütme satırı sayısı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı yüksekse, yürütme hızı azaltılır. - -## max\_execution\_speed\_bytes {#max-execution-speed-bytes} - -Saniyede en fazla yürütme bayt sayısı. Her veri bloğunda ne zaman kontrol edildi ‘timeout\_before\_checking\_execution\_speed’ doluyor. Yürütme hızı yüksekse, yürütme hızı azaltılır. - -## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} - -Yürütme hızının çok yavaş olmadığını kontrol eder (en az ‘min\_execution\_speed’), saniye içinde belirtilen süre dolduktan sonra. - -## max\_columns\_to\_read {#max-columns-to-read} - -Tek bir sorguda bir tablodan okunabilen sütun sayısı. Bir sorgu daha fazla sayıda sütun okuma gerektiriyorsa, bir özel durum atar. - -## max\_temporary\_columns {#max-temporary-columns} - -Sabit sütunlar da dahil olmak üzere bir sorgu çalıştırırken aynı anda RAM'de tutulması gereken geçici sütun sayısı. Bundan daha fazla geçici sütun varsa, bir istisna atar. - -## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} - -Aynı şey ‘max\_temporary\_columns’, ancak sabit sütunları saymadan. -Bir sorgu çalıştırırken sabit sütunların oldukça sık oluşturulduğunu, ancak yaklaşık sıfır bilgi işlem kaynağı gerektirdiğini unutmayın. - -## max\_subquery\_depth {#max-subquery-depth} - -Alt sorguların maksimum yuvalama derinliği. Alt sorgular daha derinse, bir istisna atılır. Varsayılan olarak, 100. - -## max\_pipeline\_depth {#max-pipeline-depth} - -Maksimum boru hattı derinliği. Sorgu işleme sırasında her veri bloğunun geçtiği dönüşümlerin sayısına karşılık gelir. Tek bir sunucunun sınırları içinde sayılır. Boru hattı derinliği büyükse, bir istisna atılır. Varsayılan olarak, 1000. - -## max\_ast\_depth {#max-ast-depth} - -Sorgu sözdizimsel ağacının en fazla yuvalama derinliği. Aşılırsa, bir istisna atılır. -Şu anda, ayrıştırma sırasında değil, yalnızca sorguyu ayrıştırdıktan sonra kontrol edilir. Yani, ayrıştırma sırasında çok derin bir sözdizimsel ağaç oluşturulabilir, ancak sorgu başarısız olur. Varsayılan olarak, 1000. - -## max\_ast\_elements {#max-ast-elements} - -Sorgu sözdizimsel ağacındaki en fazla öğe sayısı. Aşılırsa, bir istisna atılır. -Önceki ayarla aynı şekilde, yalnızca sorguyu ayrıştırdıktan sonra kontrol edilir. Varsayılan olarak, 50.000. - -## max\_rows\_in\_set {#max-rows-in-set} - -Bir alt sorgudan oluşturulan In yan tümcesinde bir veri kümesi için satır sayısı. - -## max\_bytes\_in\_set {#max-bytes-in-set} - -Bir alt sorgudan oluşturulan In yan tümcesinde bir set tarafından kullanılan en fazla bayt sayısı (sıkıştırılmamış veri). - -## set\_overflow\_mode {#set-overflow-mode} - -Veri miktarı sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. - -## max\_rows\_ın\_distinct {#max-rows-in-distinct} - -DISTINCT kullanırken en fazla sayıda farklı satır. - -## max\_bytes\_ın\_distinct {#max-bytes-in-distinct} - -DISTINCT kullanırken bir karma tablo tarafından kullanılan bayt sayısı. - -## distinct\_overflow\_mode {#distinct-overflow-mode} - -Veri miktarı sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. - -## max\_rows\_to\_transfer {#max-rows-to-transfer} - -Uzak bir sunucuya geçirilen veya GLOBAL In kullanırken geçici bir tabloya kaydedilen satır sayısı. - -## max\_bytes\_to\_transfer {#max-bytes-to-transfer} - -Uzak bir sunucuya geçirilen veya GLOBAL In kullanırken geçici bir tabloya kaydedilen bayt sayısı (sıkıştırılmamış veri). - -## transfer\_overflow\_mode {#transfer-overflow-mode} - -Veri miktarı sınırlardan birini aştığında ne yapmalı: ‘throw’ veya ‘break’. Varsayılan olarak, atın. - -## max\_rows\_in\_join {#settings-max_rows_in_join} - -Tabloları birleştirirken kullanılan karma tablodaki satır sayısını sınırlar. - -Bu ayarlar aşağıdakiler için geçerlidir [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) işlemleri ve [Katmak](../../engines/table_engines/special/join.md) masa motoru. - -Bir sorgu birden çok birleşim içeriyorsa, ClickHouse her Ara sonuç için bu ayarı denetler. - -Limit ulaşıldığında ClickHouse farklı eylemlerle devam edebilirsiniz. Kullan... [join\_overflow\_mode](#settings-join_overflow_mode) eylemi seçmek için ayarlama. - -Olası değerler: - -- Pozitif tamsayı. -- 0 — Unlimited number of rows. - -Varsayılan değer: 0. - -## max\_bytes\_in\_join {#settings-max_bytes_in_join} - -Tabloları birleştirirken kullanılan karma tablonun bayt cinsinden boyutunu sınırlar. - -Bu ayarlar aşağıdakiler için geçerlidir [SELECT … JOIN](../../sql_reference/statements/select.md#select-join) işlemleri ve [Jo tablein table engine](../../engines/table_engines/special/join.md). - -Sorgu birleşimler içeriyorsa, ClickHouse her Ara sonuç için bu ayarı denetler. - -Limit ulaşıldığında ClickHouse farklı eylemlerle devam edebilirsiniz. Kullanmak [join\_overflow\_mode](#settings-join_overflow_mode) eylemi seçmek için ayarlar. - -Olası değerler: - -- Pozitif tamsayı. -- 0 — Memory control is disabled. - -Varsayılan değer: 0. - -## join\_overflow\_mode {#settings-join_overflow_mode} - -Tanımlar katılın aşağıdaki sınırlar her zaman eylem ClickHouse gerçekleştirdiği ulaştı: - -- [max\_bytes\_in\_join](#settings-max_bytes_in_join) -- [max\_rows\_in\_join](#settings-max_rows_in_join) - -Olası değerler: - -- `THROW` — ClickHouse throws an exception and breaks operation. -- `BREAK` — ClickHouse breaks operation and doesn't throw an exception. - -Varsayılan değer: `THROW`. - -**Ayrıca Bakınız** - -- [Jo](../../sql_reference/statements/select.md#select-join) -- [Jo tablein table engine](../../engines/table_engines/special/join.md) - -## max\_partitions\_per\_ınsert\_block {#max-partitions-per-insert-block} - -Eklenen tek bir bloktaki en fazla bölüm sayısını sınırlar. - -- Pozitif tamsayı. -- 0 — Unlimited number of partitions. - -Varsayılan değer: 100. - -**Ayrıntı** - -Veri eklerken, ClickHouse eklenen bloktaki bölüm sayısını hesaplar. Bölüm sayısı fazla ise `max_partitions_per_insert_block`, ClickHouse aşağıdaki metinle bir özel durum atar: - -> “Too many partitions for single INSERT block (more than” + toString (max\_parts) + “). The limit is controlled by ‘max\_partitions\_per\_insert\_block’ setting. A large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow INSERT queries and slow SELECT queries. Recommended total number of partitions for a table is under 1000..10000. Please note, that partitioning is not intended to speed up SELECT queries (ORDER BY key is sufficient to make range queries fast). Partitions are intended for data manipulation (DROP PARTITION, etc).” - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/tr/operations/settings/settings_profiles.md b/docs/tr/operations/settings/settings-profiles.md similarity index 100% rename from docs/tr/operations/settings/settings_profiles.md rename to docs/tr/operations/settings/settings-profiles.md diff --git a/docs/tr/operations/settings/settings-users.md b/docs/tr/operations/settings/settings-users.md new file mode 100644 index 00000000000..43fb14f4013 --- /dev/null +++ b/docs/tr/operations/settings/settings-users.md @@ -0,0 +1,148 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 63 +toc_title: "Kullan\u0131c\u0131 Ayarlar\u0131" +--- + +# Kullanıcı Ayarları {#user-settings} + +Bu `users` bu bölüm `user.xml` yapılandırma dosyası kullanıcı ayarlarını içerir. + +Bu yapı `users` bölme: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### home/şifre {#user-namepassword} + +Şifre düz metin veya SHA256 (hex formatında) belirtilebilir. + +- Düz metin içinde bir şifre atamak için (**tavsiye edilmez**bir koyun `password` öğe. + + Mesela, `qwerty`. Şifre boş bırakılabilir. + + + +- SHA256 karmasını kullanarak bir şifre atamak için, bir `password_sha256_hex` öğe. + + Mesela, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + Kabuktan bir parola oluşturma örneği: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + + Sonucun ilk satırı şifredir. İkinci satır karşılık gelen SHA256 karmasıdır. + + + +- MySQL istemcileri ile uyumluluk için, şifre çift SHA1 karma belirtilebilir. İçine yerleştirin `password_double_sha1_hex` öğe. + + Mesela, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + Kabuktan bir parola oluşturma örneği: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + + Sonucun ilk satırı şifredir. İkinci satır karşılık gelen çift SHA1 karmasıdır. + +### kullanıcı\_adı / ağlar {#user-namenetworks} + +Kullanıcının ClickHouse sunucusuna bağlanabileceği ağların listesi. + +Listenin her öğesi aşağıdaki formlardan birine sahip olabilir: + +- `` — IP address or network mask. + + Örnekler: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Hostname. + + Örnek: `example01.host.ru`. + + Erişimi denetlemek için bir DNS sorgusu gerçekleştirilir ve döndürülen tüm IP adresleri eş adresiyle karşılaştırılır. + +- `` — Regular expression for hostnames. + + Örnek, `^example\d\d-\d\d-\d\.host\.ru$` + + Erişimi kontrol etmek için, bir [DNS ptr sorgusu](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) eş adresi için gerçekleştirilir ve sonra belirtilen regexp uygulanır. Daha sonra PTR sorgusunun sonuçları için başka bir DNS sorgusu gerçekleştirilir ve alınan tüm adresler eş adresine karşılaştırılır. Regexp’nin $ile bitmesini şiddetle tavsiye ederiz. + +Sunucu yeniden başlatılıncaya kadar DNS isteklerinin tüm sonuçları önbelleğe alınır. + +**Örnekler** + +Herhangi bir ağdan kullanıcı için erişimi açmak için şunları belirtin: + +``` xml +::/0 +``` + +!!! warning "Uyarıcı" + Düzgün yapılandırılmış bir güvenlik duvarınız yoksa veya sunucu doğrudan internete bağlı değilse, herhangi bir ağdan erişimi açmak güvensizdir. + +Erişimi yalnızca localhost’tan açmak için şunları belirtin: + +``` xml +::1 +127.0.0.1 +``` + +### kullanıcı\_adı / profil {#user-nameprofile} + +Kullanıcı için bir ayarlar profili atayabilirsiniz. Ayarlar profilleri ayrı bir bölümde yapılandırılır `users.xml` Dosya. Daha fazla bilgi için, bkz. [Ayarların profilleri](settings-profiles.md). + +### user\_name / kota {#user-namequota} + +Kotalar, belirli bir süre boyunca kaynak kullanımını izlemenize veya sınırlamanıza izin verir. Kotalar yapılandırılır `quotas` +bu bölüm `users.xml` yapılandırma dosyası. + +Kullanıcı için ayarlanmış bir kotalar atayabilirsiniz. Kotalar yapılandırmasının ayrıntılı bir açıklaması için bkz. [Kotalar](../quotas.md#quotas). + +### user\_name / veritabanları {#user-namedatabases} + +Bu bölümde, ClickHouse tarafından döndürülen satırları sınırlayabilirsiniz `SELECT` geçerli kullanıcı tarafından yapılan sorgular, böylece temel satır düzeyinde güvenlik uygular. + +**Örnek** + +Aşağıdaki yapılandırma bu kullanıcıyı zorlar `user1` sadece satırları görebilirsiniz `table1` sonucu olarak `SELECT` sorgular, burada değeri `id` alan 1000’dir. + +``` xml + + + + + id = 1000 + + + + +``` + +Bu `filter` bir sonuç veren herhangi bir ifade olabilir [Uİnt8](../../sql-reference/data-types/int-uint.md)- tip değeri. Genellikle karşılaştırmalar ve mantıksal operatörler içerir. Satır fromlardan `database_name.table1` burada filtre sonuçları 0 için bu kullanıcı için döndürülür. Filtreleme ile uyumsuz `PREWHERE` işlemler ve devre dışı bırakır `WHERE→PREWHERE` optimizasyon. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/tr/operations/settings/settings.md b/docs/tr/operations/settings/settings.md index 48e48ca00a6..4604db43773 100644 --- a/docs/tr/operations/settings/settings.md +++ b/docs/tr/operations/settings/settings.md @@ -9,7 +9,7 @@ toc_title: Ayarlar ## distributed\_product\_mode {#distributed-product-mode} -Davranışını değiştirir [dağıtılmış alt sorgular](../../sql_reference/statements/select.md). +Davranışını değiştirir [dağıtılmış alt sorgular](../../sql-reference/statements/select.md). ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table. @@ -18,7 +18,7 @@ Kısıtlama: - Yalnızca ın ve JOIN alt sorguları için uygulanır. - Yalnızca FROM bölümü birden fazla parça içeren dağıtılmış bir tablo kullanıyorsa. - Alt sorgu birden fazla parça içeren dağıtılmış bir tablo ile ilgiliyse. -- Bir tablo için kullanılmaz-değerli [uzak](../../sql_reference/table_functions/remote.md) işlev. +- Bir tablo için kullanılmaz-değerli [uzak](../../sql-reference/table-functions/remote.md) işlev. Olası değerler: @@ -53,7 +53,7 @@ Eğer `enable_optimize_predicate_expression = 0`, daha sonra ikinci sorgunun yü ## fallback\_to\_stale\_replicas\_for\_distributed\_queries {#settings-fallback_to_stale_replicas_for_distributed_queries} -Güncelleştirilmiş veriler mevcut değilse, bir sorgu için güncel olmayan bir yineleme zorlar. Görmek [Çoğalma](../../engines/table_engines/mergetree_family/replication.md). +Güncelleştirilmiş veriler mevcut değilse, bir sorgu için güncel olmayan bir yineleme zorlar. Görmek [Çoğalma](../../engines/table-engines/mergetree-family/replication.md). ClickHouse, tablonun eski kopyalarından en alakalı olanı seçer. @@ -67,7 +67,7 @@ Dizin tarihe göre kullanılamıyorsa, sorgu yürütülmesini devre dışı bır MergeTree ailesindeki tablolarla çalışır. -Eğer `force_index_by_date=1`, ClickHouse sorgunun veri aralıklarını kısıtlamak için kullanılabilecek bir tarih anahtarı koşulu olup olmadığını denetler. Uygun bir koşul yoksa, bir istisna atar. Ancak, koşul okumak için veri miktarını azaltır olup olmadığını denetlemez. Örneğin, durum `Date != ' 2000-01-01 '` tablodaki tüm verilerle eşleştiğinde bile kabul edilebilir (yani, sorguyu çalıştırmak tam bir tarama gerektirir). MergeTree tablolarındaki veri aralıkları hakkında daha fazla bilgi için bkz. [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +Eğer `force_index_by_date=1`, ClickHouse sorgunun veri aralıklarını kısıtlamak için kullanılabilecek bir tarih anahtarı koşulu olup olmadığını denetler. Uygun bir koşul yoksa, bir istisna atar. Ancak, koşul okumak için veri miktarını azaltır olup olmadığını denetlemez. Örneğin, durum `Date != ' 2000-01-01 '` tablodaki tüm verilerle eşleştiğinde bile kabul edilebilir (yani, sorguyu çalıştırmak tam bir tarama gerektirir). MergeTree tablolarındaki veri aralıkları hakkında daha fazla bilgi için bkz. [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## force\_primary\_key {#force-primary-key} @@ -75,11 +75,11 @@ Birincil anahtar tarafından dizin oluşturma mümkün değilse, sorgu yürütü MergeTree ailesindeki tablolarla çalışır. -Eğer `force_primary_key=1`, ClickHouse, sorgunun veri aralıklarını kısıtlamak için kullanılabilecek bir birincil anahtar koşulu olup olmadığını denetler. Uygun bir koşul yoksa, bir istisna atar. Ancak, koşul okumak için veri miktarını azaltır olup olmadığını denetlemez. MergeTree tablolarındaki veri aralıkları hakkında daha fazla bilgi için bkz. [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +Eğer `force_primary_key=1`, ClickHouse, sorgunun veri aralıklarını kısıtlamak için kullanılabilecek bir birincil anahtar koşulu olup olmadığını denetler. Uygun bir koşul yoksa, bir istisna atar. Ancak, koşul okumak için veri miktarını azaltır olup olmadığını denetlemez. MergeTree tablolarındaki veri aralıkları hakkında daha fazla bilgi için bkz. [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## format\_schema {#format-schema} -Bu parametre, aşağıdaki gibi bir şema tanımı gerektiren biçimler kullanırken kullanışlıdır [Cap'n Proto](https://capnproto.org/) veya [Protobuf](https://developers.google.com/protocol-buffers/). Değer biçime bağlıdır. +Bu parametre, aşağıdaki gibi bir şema tanımı gerektiren biçimler kullanırken kullanışlıdır [Cap’n Proto](https://capnproto.org/) veya [Protobuf](https://developers.google.com/protocol-buffers/). Değer biçime bağlıdır. ## fsync\_metadata {#fsync-metadata} @@ -104,7 +104,7 @@ Varsayılan değer: 0. Eğer bir HTTP isteğine yanıt veri sıkıştırma düzeyini ayarlar [enable\_http\_compression = 1](#settings-enable_http_compression). -Olası değerler: 1'den 9'a kadar olan sayılar. +Olası değerler: 1’den 9’a kadar olan sayılar. Varsayılan değer: 3. @@ -136,7 +136,7 @@ Varsayılan değer: 0. ## max\_http\_get\_redirects {#setting-max_http_get_redirects} -Maksimum http get yönlendirme atlama sayısını sınırlar [URL](../../engines/table_engines/special/url.md)- motor masaları. Ayarı tablolar iki tür tarafından oluşturulan bu geçerlidir: [CREATE TABLE](../../sql_reference/statements/create.md#create-table-query) sorgu ve [url](../../sql_reference/table_functions/url.md) tablo işlevi. +Maksimum http get yönlendirme atlama sayısını sınırlar [URL](../../engines/table-engines/special/url.md)- motor masaları. Ayarı tablolar iki tür tarafından oluşturulan bu geçerlidir: [CREATE TABLE](../../sql-reference/statements/create.md#create-table-query) sorgu ve [url](../../sql-reference/table-functions/url.md) tablo işlevi. Olası değerler: @@ -149,7 +149,7 @@ Varsayılan değer: 0. Metin biçimlerinden (CSV, TSV, vb.) okurken kabul edilebilir hataların maksimum sayısını ayarlar.). -Varsayılan değer 0'dır. +Varsayılan değer 0’dır. Her zaman ile eşleştirmek `input_format_allow_errors_ratio`. @@ -162,7 +162,7 @@ Eğer her ikisi de `input_format_allow_errors_num` ve `input_format_allow_errors Metin biçimlerinden (CSV, TSV, vb.) okurken izin verilen maksimum hata yüzdesini ayarlar.). Hataların yüzdesi 0 ile 1 arasında kayan nokta sayısı olarak ayarlanır. -Varsayılan değer 0'dır. +Varsayılan değer 0’dır. Her zaman ile eşleştirmek `input_format_allow_errors_num`. @@ -172,7 +172,7 @@ Eğer her ikisi de `input_format_allow_errors_num` ve `input_format_allow_errors ## ınput\_format\_values\_interpret\_expressions {#settings-input_format_values_interpret_expressions} -Hızlı akış ayrıştırıcısı verileri ayrıştıramazsa, tam SQL ayrıştırıcısını etkinleştirir veya devre dışı bırakır. Bu ayar yalnızca için kullanılır [Değerler](../../interfaces/formats.md#data-format-values) veri ekleme sırasında biçimlendirin. Sözdizimi ayrıştırma hakkında daha fazla bilgi için bkz: [Sözdizimi](../../sql_reference/syntax.md) bölme. +Hızlı akış ayrıştırıcısı verileri ayrıştıramazsa, tam SQL ayrıştırıcısını etkinleştirir veya devre dışı bırakır. Bu ayar yalnızca için kullanılır [Değerler](../../interfaces/formats.md#data-format-values) veri ekleme sırasında biçimlendirin. Sözdizimi ayrıştırma hakkında daha fazla bilgi için bkz: [Sözdizimi](../../sql-reference/syntax.md) bölme. Olası değerler: @@ -188,7 +188,7 @@ Varsayılan değer: 1. Kullanım örneği -Ekle [DateTime](../../sql_reference/data_types/datetime.md) farklı ayarlarla değer yazın. +Ekle [DateTime](../../sql-reference/data-types/datetime.md) farklı ayarlarla değer yazın. ``` sql SET input_format_values_interpret_expressions = 0; @@ -279,7 +279,7 @@ Varsayılan değer: 1. ## ınput\_format\_tsv\_empty\_as\_default {#settings-input-format-tsv-empty-as-default} -Etkinleştirildiğinde, TSV'DEKİ boş giriş alanlarını varsayılan değerlerle değiştirin. Karmaşık varsayılan ifadeler için `input_format_defaults_for_omitted_fields` de etkin olmalıdır. +Etkinleştirildiğinde, TSV’DEKİ boş giriş alanlarını varsayılan değerlerle değiştirin. Karmaşık varsayılan ifadeler için `input_format_defaults_for_omitted_fields` de etkin olmalıdır. Varsayılan olarak devre dışı. @@ -324,7 +324,7 @@ Varsayılan değer: 0. Ayrıca bakınız: -- [İç içe yapıların kullanımı](../../interfaces/formats.md#jsoneachrow-nested) ile... `JSONEachRow` biçimli. +- [İç içe yapıların kullanımı](../../interfaces/formats.md#jsoneachrow-nested) ile… `JSONEachRow` biçimli. ## ınput\_format\_with\_names\_use\_header {#settings-input-format-with-names-use-header} @@ -348,7 +348,7 @@ Varsayılan değer: 1. Tarih ve saat metin gösterimi bir ayrıştırıcı seçme sağlar. -Ayar için geçerli değildir [tarih ve saat fonksiyonları](../../sql_reference/functions/date_time_functions.md). +Ayar için geçerli değildir [tarih ve saat fonksiyonları](../../sql-reference/functions/date-time-functions.md). Olası değerler: @@ -364,16 +364,16 @@ Varsayılan değer: `'basic'`. Ayrıca bakınız: -- [DateTime veri türü.](../../sql_reference/data_types/datetime.md) -- [Tarihler ve saatler ile çalışmak için fonksiyonlar.](../../sql_reference/functions/date_time_functions.md) +- [DateTime veri türü.](../../sql-reference/data-types/datetime.md) +- [Tarihler ve saatler ile çalışmak için fonksiyonlar.](../../sql-reference/functions/date-time-functions.md) ## join\_default\_strictness {#settings-join_default_strictness} -Ayarlar varsayılan strictness için [Maddeleri KATILIN ](../../sql_reference/statements/select.md#select-join). +Ayarlar varsayılan strictness için [Maddeleri KATILIN](../../sql-reference/statements/select.md#select-join). Olası değerler: -- `ALL` — If the right table has several matching rows, ClickHouse creates a [Kartezyen ürün](https://en.wikipedia.org/wiki/Cartesian_product) eşleşen satırlardan. Bu normaldir `JOIN` standart SQL'DEN davranış. +- `ALL` — If the right table has several matching rows, ClickHouse creates a [Kartezyen ürün](https://en.wikipedia.org/wiki/Cartesian_product) eşleşen satırlardan. Bu normaldir `JOIN` standart SQL’DEN davranış. - `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of `ANY` ve `ALL` aynı. - `ASOF` — For joining sequences with an uncertain match. - `Empty string` — If `ALL` veya `ANY` sorguda belirtilmezse, ClickHouse bir özel durum atar. @@ -385,7 +385,7 @@ Varsayılan değer: `ALL`. İle birleştirme işlemlerinin davranışını değiştirir `ANY` katılık. !!! warning "Dikkat" - Bu ayar yalnızca aşağıdakiler için geçerlidir `JOIN` ile işlemler [Katmak](../../engines/table_engines/special/join.md) motor tabloları. + Bu ayar yalnızca aşağıdakiler için geçerlidir `JOIN` ile işlemler [Katmak](../../engines/table-engines/special/join.md) motor tabloları. Olası değerler: @@ -396,24 +396,24 @@ Varsayılan değer: 0. Ayrıca bakınız: -- [Jo](../../sql_reference/statements/select.md#select-join) -- [Jo tablein table engine](../../engines/table_engines/special/join.md) +- [Jo](../../sql-reference/statements/select.md#select-join) +- [Jo tablein table engine](../../engines/table-engines/special/join.md) - [join\_default\_strictness](#settings-join_default_strictness) ## join\_use\_nulls {#join_use_nulls} -Türünü ayarlar [JOIN](../../sql_reference/statements/select.md) davranış. Tabloları birleştirirken boş hücreler görünebilir. ClickHouse bu ayara göre onları farklı şekilde doldurur. +Türünü ayarlar [JOIN](../../sql-reference/statements/select.md) davranış. Tabloları birleştirirken boş hücreler görünebilir. ClickHouse bu ayara göre onları farklı şekilde doldurur. Olası değerler: - 0 — The empty cells are filled with the default value of the corresponding field type. -- 1 — `JOIN` standart SQL ile aynı şekilde davranır. Karşılık gelen alanın türü dönüştürülür [Nullable](../../sql_reference/data_types/nullable.md#data_type-nullable) ve boş hücreler ile doldurulur [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` standart SQL ile aynı şekilde davranır. Karşılık gelen alanın türü dönüştürülür [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) ve boş hücreler ile doldurulur [NULL](../../sql-reference/syntax.md). Varsayılan değer: 0. ## max\_block\_size {#setting-max_block_size} -Clickhouse'da, veriler bloklarla (sütun parçaları kümeleri) işlenir. Tek bir blok için dahili işlem döngüleri yeterince verimlidir, ancak her blokta gözle görülür harcamalar vardır. Bu `max_block_size` ayar, blokun boyutunun (satır sayımında) tablolardan yükleneceği bir öneridir. Blok boyutu çok küçük olmamalı, böylece her bloktaki harcamalar hala fark edilebilir, ancak çok büyük olmamalı, böylece ilk blok hızla işlendikten sonra tamamlanan limitli sorgu çok büyük olmamalıdır. Amaç, birden çok iş parçacığında çok sayıda sütun ayıklarken çok fazla bellek tüketmekten kaçınmak ve en azından bazı önbellek konumlarını korumaktır. +Clickhouse’da, veriler bloklarla (sütun parçaları kümeleri) işlenir. Tek bir blok için dahili işlem döngüleri yeterince verimlidir, ancak her blokta gözle görülür harcamalar vardır. Bu `max_block_size` ayar, blokun boyutunun (satır sayımında) tablolardan yükleneceği bir öneridir. Blok boyutu çok küçük olmamalı, böylece her bloktaki harcamalar hala fark edilebilir, ancak çok büyük olmamalı, böylece ilk blok hızla işlendikten sonra tamamlanan limitli sorgu çok büyük olmamalıdır. Amaç, birden çok iş parçacığında çok sayıda sütun ayıklarken çok fazla bellek tüketmekten kaçınmak ve en azından bazı önbellek konumlarını korumaktır. Varsayılan değer: 65,536. @@ -427,7 +427,7 @@ Varsayılan olarak: 1.000.000. Sadece MergeTree motorlarından okurken çalış ## merge\_tree\_mın\_rows\_for\_concurrent\_read {#setting-merge-tree-min-rows-for-concurrent-read} -Bir dosyadan okunacak satır sayısı ise [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) tablo aşıyor `merge_tree_min_rows_for_concurrent_read` daha sonra ClickHouse, bu dosyadan birkaç iş parçacığı üzerinde eşzamanlı bir okuma gerçekleştirmeye çalışır. +Bir dosyadan okunacak satır sayısı ise [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) tablo aşıyor `merge_tree_min_rows_for_concurrent_read` daha sonra ClickHouse, bu dosyadan birkaç iş parçacığı üzerinde eşzamanlı bir okuma gerçekleştirmeye çalışır. Olası değerler: @@ -437,7 +437,7 @@ Varsayılan değer: 163840. ## merge\_tree\_min\_bytes\_for\_concurrent\_read {#setting-merge-tree-min-bytes-for-concurrent-read} -Eğer bir dosyadan okunacak bayt sayısı [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)- motor tablosu `merge_tree_min_bytes_for_concurrent_read`, daha sonra ClickHouse, bu dosyadan aynı anda birkaç iş parçacığında okumaya çalışır. +Eğer bir dosyadan okunacak bayt sayısı [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)- motor tablosu `merge_tree_min_bytes_for_concurrent_read`, daha sonra ClickHouse, bu dosyadan aynı anda birkaç iş parçacığında okumaya çalışır. Olası değer: @@ -479,7 +479,7 @@ Varsayılan değer: 8. ClickHouse daha fazla okumak gerekiyorsa `merge_tree_max_rows_to_use_cache` bir sorgudaki satırlar, sıkıştırılmamış blokların önbelleğini kullanmaz. -Sıkıştırılmamış blokların önbelleği, sorgular için ayıklanan verileri depolar. ClickHouse, tekrarlanan küçük sorgulara verilen yanıtları hızlandırmak için bu önbelleği kullanır. Bu ayar, önbelleğin büyük miktarda veri okuyan sorgularla çöpe atmasını önler. Bu [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) sunucu ayarı, sıkıştırılmamış blokların önbelleğinin boyutunu tanımlar. +Sıkıştırılmamış blokların önbelleği, sorgular için ayıklanan verileri depolar. ClickHouse, tekrarlanan küçük sorgulara verilen yanıtları hızlandırmak için bu önbelleği kullanır. Bu ayar, önbelleğin büyük miktarda veri okuyan sorgularla çöpe atmasını önler. Bu [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) sunucu ayarı, sıkıştırılmamış blokların önbelleğinin boyutunu tanımlar. Olası değerler: @@ -491,7 +491,7 @@ Default value: 128 ✕ 8192. ClickHouse daha fazla okumak gerekiyorsa `merge_tree_max_bytes_to_use_cache` bir sorguda bayt, sıkıştırılmamış blokların önbelleğini kullanmaz. -Sıkıştırılmamış blokların önbelleği, sorgular için ayıklanan verileri depolar. ClickHouse, tekrarlanan küçük sorgulara verilen yanıtları hızlandırmak için bu önbelleği kullanır. Bu ayar, önbelleğin büyük miktarda veri okuyan sorgularla çöpe atmasını önler. Bu [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) sunucu ayarı, sıkıştırılmamış blokların önbelleğinin boyutunu tanımlar. +Sıkıştırılmamış blokların önbelleği, sorgular için ayıklanan verileri depolar. ClickHouse, tekrarlanan küçük sorgulara verilen yanıtları hızlandırmak için bu önbelleği kullanır. Bu ayar, önbelleğin büyük miktarda veri okuyan sorgularla çöpe atmasını önler. Bu [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) sunucu ayarı, sıkıştırılmamış blokların önbelleğinin boyutunu tanımlar. Olası değer: @@ -516,7 +516,7 @@ Varsayılan değer: 0. Sorgu günlüğü ayarlama. -Bu kurulum ile Clickhouse'a gönderilen sorgular, [query\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-log) sunucu yapılandırma parametresi. +Bu kurulum ile Clickhouse’a gönderilen sorgular, [query\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-log) sunucu yapılandırma parametresi. Örnek: @@ -546,7 +546,7 @@ log_queries_min_type='EXCEPTION_WHILE_PROCESSING' Sorgu iş parçacığı günlüğü ayarlama. -Bu kurulum ile ClickHouse tarafından çalıştırılan sorguların konuları, [query\_thread\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu yapılandırma parametresi. +Bu kurulum ile ClickHouse tarafından çalıştırılan sorguların konuları, [query\_thread\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu yapılandırma parametresi. Örnek: @@ -564,11 +564,11 @@ Veri SELECT sonra oluşturulan aynı blokları kullanarak eklendiğinden, INSERT Varsayılan değer: 1.048,576. -Varsayılan biraz daha fazla `max_block_size`. Bunun nedeni, bazı tablo motorlarının (`*MergeTree`) oldukça büyük bir varlık olan eklenen her blok için diskte bir veri parçası oluşturun. Benzer bir şekilde, `*MergeTree` tablolar ekleme sırasında verileri sıralar ve yeterince büyük bir blok boyutu RAM'de daha fazla veriyi sıralamaya izin verir. +Varsayılan biraz daha fazla `max_block_size`. Bunun nedeni, bazı tablo motorlarının (`*MergeTree`) oldukça büyük bir varlık olan eklenen her blok için diskte bir veri parçası oluşturun. Benzer bir şekilde, `*MergeTree` tablolar ekleme sırasında verileri sıralar ve yeterince büyük bir blok boyutu RAM’de daha fazla veriyi sıralamaya izin verir. ## max\_replica\_delay\_for\_distributed\_queries {#settings-max_replica_delay_for_distributed_queries} -Dağıtılmış sorgular için gecikmeli yinelemeleri devre dışı bırakır. Görmek [Çoğalma](../../engines/table_engines/mergetree_family/replication.md). +Dağıtılmış sorgular için gecikmeli yinelemeleri devre dışı bırakır. Görmek [Çoğalma](../../engines/table-engines/mergetree-family/replication.md). Saati saniye olarak ayarlar. Bir çoğaltma ayarlanan değerden daha fazla kalıyorsa, Bu çoğaltma kullanılmaz. @@ -587,7 +587,7 @@ Varsayılan değer: fiziksel CPU çekirdeği sayısı. Bir kerede bir sunucuda normal olarak birden az SELECT sorgusu çalıştırılırsa, bu parametreyi gerçek işlemci çekirdeği sayısından biraz daha küçük bir değere ayarlayın. -Bir sınır nedeniyle hızlı bir şekilde tamamlanan sorgular için, daha düşük bir ‘max\_threads’. Örneğin, gerekli sayıda giriş her blokta ve max\_threads = 8'de bulunuyorsa, sadece bir tane okumak için yeterli olsa da, 8 blok alınır. +Bir sınır nedeniyle hızlı bir şekilde tamamlanan sorgular için, daha düşük bir ‘max\_threads’. Örneğin, gerekli sayıda giriş her blokta ve max\_threads = 8’de bulunuyorsa, sadece bir tane okumak için yeterli olsa da, 8 blok alınır. Daha küçük `max_threads` değer, daha az bellek tüketilir. @@ -598,7 +598,7 @@ Daha küçük `max_threads` değer, daha az bellek tüketilir. Olası değerler: - 0 (or 1) — `INSERT SELECT` paralel infaz yok. -- Pozitif tamsayı. 1'den büyük. +- Pozitif tamsayı. 1’den büyük. Varsayılan değer: 0. @@ -613,7 +613,7 @@ Sıkıştırma için blokları (bayttan oluşan bir bellek yığını) sorgu iş ## min\_compress\_block\_size {#min-compress-block-size} -İçin [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)" Tablolar. Sorguları işlerken gecikmeyi azaltmak için, boyutu en az bir sonraki işareti yazarken bir blok sıkıştırılır ‘min\_compress\_block\_size’. Varsayılan olarak, 65.536. +İçin [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)" Tablolar. Sorguları işlerken gecikmeyi azaltmak için, boyutu en az bir sonraki işareti yazarken bir blok sıkıştırılır ‘min\_compress\_block\_size’. Varsayılan olarak, 65.536. Sıkıştırılmamış veriler daha az ise, bloğun gerçek boyutu ‘max\_compress\_block\_size’, bu değerden daha az değildir ve bir işaret için veri hacminden daha az değildir. @@ -621,13 +621,13 @@ Bir örneğe bakalım. Varsaymak ‘index\_granularity’ tablo oluşturma sıra Bir uint32 tipi sütun yazıyoruz (değer başına 4 bayt). 8192 satır yazarken, toplam 32 KB veri olacaktır. Min\_compress\_block\_size = 65.536 olduğundan, her iki işaret için sıkıştırılmış bir blok oluşturulacaktır. -Dize türüne sahip bir URL sütunu yazıyoruz (değer başına ortalama 60 bayt boyutu). 8192 satır yazarken, ortalama 500 KB veri biraz daha az olacaktır. Bu 65,536'dan fazla olduğu için, her işaret için sıkıştırılmış bir blok oluşturulacaktır. Bu durumda, diskteki verileri tek bir işaret aralığında okurken, ekstra veriler sıkıştırılmaz. +Dize türüne sahip bir URL sütunu yazıyoruz (değer başına ortalama 60 bayt boyutu). 8192 satır yazarken, ortalama 500 KB veri biraz daha az olacaktır. Bu 65,536’dan fazla olduğu için, her işaret için sıkıştırılmış bir blok oluşturulacaktır. Bu durumda, diskteki verileri tek bir işaret aralığında okurken, ekstra veriler sıkıştırılmaz. Bu ayarı değiştirmek için genellikle herhangi bir neden yoktur. ## max\_query\_size {#settings-max_query_size} -SQL ayrıştırıcısı ile ayrıştırmak için RAM'e alınabilecek bir sorgunun en büyük kısmı. +SQL ayrıştırıcısı ile ayrıştırmak için RAM’e alınabilecek bir sorgunun en büyük kısmı. INSERT sorgusu, bu kısıtlamaya dahil olmayan ayrı bir akış ayrıştırıcısı (o(1) RAM tüketir) tarafından işlenen INSERT için veri de içerir. Varsayılan değer: 256 KiB. @@ -691,7 +691,7 @@ Daha fazla bilgi için bölüme bakın “Extreme values”. ## use\_uncompressed\_cache {#setting-use_uncompressed_cache} Sıkıştırılmamış blokların önbelleğinin kullanılıp kullanılmayacağı. 0 veya 1 kabul eder. Varsayılan olarak, 0 (devre dışı). -Sıkıştırılmamış önbelleği (yalnızca mergetree ailesindeki tablolar için) kullanmak, çok sayıda kısa Sorgu ile çalışırken gecikmeyi önemli ölçüde azaltabilir ve verimi artırabilir. Sık sık kısa istek Gönderen kullanıcılar için bu ayarı etkinleştirin. Ayrıca dikkat [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. +Sıkıştırılmamış önbelleği (yalnızca mergetree ailesindeki tablolar için) kullanmak, çok sayıda kısa Sorgu ile çalışırken gecikmeyi önemli ölçüde azaltabilir ve verimi artırabilir. Sık sık kısa istek Gönderen kullanıcılar için bu ayarı etkinleştirin. Ayrıca dikkat [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. En azından biraz büyük bir veri hacmi (bir milyon satır veya daha fazla) okuyan sorgular için sıkıştırılmamış önbellek, gerçekten küçük sorgular için yer kazanmak için otomatik olarak devre dışı bırakılır. Bu tutmak anlamına gelir ‘use\_uncompressed\_cache’ ayar her zaman 1 olarak ayarlanır. @@ -700,7 +700,7 @@ En azından biraz büyük bir veri hacmi (bir milyon satır veya daha fazla) oku HTTP arayüzünü kullanırken, ‘query\_id’ parametre geçirilebilir. Bu, sorgu tanımlayıcısı olarak hizmet veren herhangi bir dizedir. Aynı kullanıcıdan aynı sorgu varsa ‘query\_id’ zaten şu anda var, davranış bağlıdır ‘replace\_running\_query’ parametre. -`0` (default) – Throw an exception (don't allow the query to run if a query with the same ‘query\_id’ zaten çalışan) var. +`0` (default) – Throw an exception (don’t allow the query to run if a query with the same ‘query\_id’ zaten çalışan) var. `1` – Cancel the old query and start running the new one. @@ -710,7 +710,7 @@ Aynı kullanıcıdan aynı sorgu varsa ‘query\_id’ zaten şu anda var, davra Bir zaman aşımı durumunda akışlı tablolar için çalışır veya bir iş parçacığı oluşturduğunda [max\_ınsert\_block\_size](#settings-max_insert_block_size) satırlar. -Varsayılan değer 7500'dür. +Varsayılan değer 7500’dür. Küçük değer, daha sık veri tablosuna temizlendi. Değeri çok düşük ayarlamak, düşük performansa yol açar. @@ -725,7 +725,7 @@ ClickHouse kopyaları seçme aşağıdaki algoritmaları destekler: - [Sıralı](#load_balancing-in_order) - [İlk veya rastgele](#load_balancing-first_or_random) -### Rastgele (varsayılan olarak) {#load_balancing-random} +### Rastgele (varsayılan Olarak) {#load_balancing-random} ``` sql load_balancing = random @@ -740,7 +740,7 @@ Dezavantajları: sunucu yakınlık hesaba değil; kopyaları farklı veri varsa, load_balancing = nearest_hostname ``` -The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server's hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). +The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server’s hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). Örneğin, example01-01-1 ve example01-01-2.yandex.ru bir pozisyonda farklıdır, örneği01-01-1 ve örneği01-02-2 iki yerde farklılık gösterir. Bu yöntem ilkel görünebilir, ancak ağ topolojisi hakkında harici veri gerektirmez ve IPv6 adreslerimiz için karmaşık olan IP adreslerini karşılaştırmaz. @@ -757,7 +757,7 @@ load_balancing = in_order Yapılandırmada belirtilen hataları aynı sayıda yinelemeler aynı sırayla erişilir. Bu yöntem, tam olarak hangi kopyanın tercih edildiğini bildiğinizde uygundur. -### İlk veya rastgele {#load_balancing-first_or_random} +### İlk Veya Rastgele {#load_balancing-first_or_random} ``` sql load_balancing = first_or_random @@ -811,7 +811,7 @@ For testing, the value can be set to 0: compilation runs synchronously and the q Değer 1 veya daha fazla ise, derleme zaman uyumsuz olarak ayrı bir iş parçacığında oluşur. Sonuç, şu anda çalışmakta olan sorgular da dahil olmak üzere hazır olduğu anda kullanılacaktır. Derlenmiş kod, sorguda kullanılan toplama işlevlerinin her farklı birleşimi ve GROUP BY yan tümcesindeki anahtarların türü için gereklidir. -The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don't use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. +The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don’t use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. ## output\_format\_json\_quote\_64bit\_integers {#session_settings-output_format_json_quote_64bit_integers} @@ -827,11 +827,11 @@ CSV giriş biçimi sağlar veya unquoted ayrıştırma devre dışı bırakır i ## output\_format\_csv\_crlf\_end\_of\_line {#settings-output-format-csv-crlf-end-of-line} -Unix stili (LF) yerine CSV'DE DOS/Windows stili çizgi ayırıcı (CRLF) kullanın. +Unix stili (LF) yerine CSV’DE DOS/Windows stili çizgi ayırıcı (CRLF) kullanın. ## output\_format\_tsv\_crlf\_end\_of\_line {#settings-output-format-tsv-crlf-end-of-line} -Unıx stili (LF) yerine TSV'DE DOC/Windows stili çizgi ayırıcı (CRLF) kullanın. +Unıx stili (LF) yerine TSV’DE DOC/Windows stili çizgi ayırıcı (CRLF) kullanın. ## insert\_quorum {#settings-insert_quorum} @@ -919,7 +919,7 @@ Kullanma Varsayılan olarak, tekilleştirme materialized görünümler için gerçekleştirilmez, ancak kaynak tabloda, Yukarı akış yapılır. Eklenen bir blok, kaynak tablodaki tekilleştirme nedeniyle atlanırsa, ekli materialized görünümlerine ekleme olmaz. Bu davranış, eklenen blokların materialized görünüm toplamasından sonra aynı olduğu, ancak kaynak tabloya farklı eklerden türetildiği durumlar için, yüksek oranda toplanmış verilerin materialized görünümlere eklenmesini sağlamak için vardır. -Aynı zamanda, bu davranış “breaks” `INSERT` idempotency. Eğer bir `INSERT` ana tabloya başarılı oldu ve `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won't receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` bu davranışı değiştirmeye izin verir. Yeniden denemede, somutlaştırılmış bir görünüm tekrar ekleme işlemini alacak ve tekilleştirme kontrolünü kendi başına gerçekleştirecektir, +Aynı zamanda, bu davranış “breaks” `INSERT` idempotency. Eğer bir `INSERT` ana tabloya başarılı oldu ve `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won’t receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` bu davranışı değiştirmeye izin verir. Yeniden denemede, somutlaştırılmış bir görünüm tekrar ekleme işlemini alacak ve tekilleştirme kontrolünü kendi başına gerçekleştirecektir, kaynak tablo için onay sonucunu yoksayar ve ilk hata nedeniyle kaybedilen satırları ekler. ## max\_network\_bytes {#settings-max-network-bytes} @@ -968,15 +968,15 @@ Varsayılan değer: 0. ## count\_distinct\_implementation {#settings-count_distinct_implementation} -Aşağıdakilerden hang theisinin `uniq*` işlevleri gerçekleştirmek için kullanılmalıdır [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count) yapma. +Aşağıdakilerden hang theisinin `uniq*` işlevleri gerçekleştirmek için kullanılmalıdır [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count) yapma. Olası değerler: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqCombined](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [uniqCombined64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [uniqHLL12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [uniqExact](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqCombined](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [uniqCombined64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [uniqHLL12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [uniqExact](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) Varsayılan değer: `uniqExact`. @@ -994,7 +994,7 @@ Tüm kopyaları kullanılamıyorsa, Shard kullanılamaz olarak kabul edilir. Aş Çoğaltmanın ana bilgisayar adı DNS aracılığıyla çözümlenemezse, aşağıdaki durumları gösterebilir: - - Çoğaltma ana bilgisayar DNS kaydı yok. Dinamik DNS'YE sahip sistemlerde oluşabilir, örneğin, [Kubernetes](https://kubernetes.io), burada düğümler kesinti sırasında çözülmez olabilir ve bu bir hata değildir. + - Çoğaltma ana bilgisayar DNS kaydı yok. Dinamik DNS’YE sahip sistemlerde oluşabilir, örneğin, [Kubernetes](https://kubernetes.io), burada düğümler kesinti sırasında çözülmez olabilir ve bu bir hata değildir. - Yapılandırma hatası. ClickHouse yapılandırma dosyası yanlış bir ana bilgisayar adı içerir. @@ -1041,7 +1041,7 @@ Varsayılan değer: 0. ## optimize\_throw\_if\_noop {#setting-optimize_throw_if_noop} -Bir özel durum atmayı etkinleştirir veya devre dışı bırakır. [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) sorgu birleştirme gerçekleştirmedi. +Bir özel durum atmayı etkinleştirir veya devre dışı bırakır. [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) sorgu birleştirme gerçekleştirmedi. Varsayılan olarak, `OPTIMIZE` eğer hiç bir şey yapmamış olsa bile, başarılı bir şekilde verir. Bu ayar, bu durumları ayırt etmenizi ve bir özel durum iletisinde nedeni almanızı sağlar. @@ -1061,7 +1061,7 @@ Dağıtılmış tablolardaki hataların ne kadar hızlı sıfırlandığını de Ayrıca bakınız: -- [Masa motoru Dağıt Distributedıldı](../../engines/table_engines/special/distributed.md) +- [Masa motoru Dağıt Distributedıldı](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_cap](#settings-distributed_replica_error_cap) ## distributed\_replica\_error\_cap {#settings-distributed_replica_error_cap} @@ -1073,12 +1073,12 @@ Her yineleme hata sayısı çok fazla hata biriken tek bir yineleme engelleyerek Ayrıca bakınız: -- [Masa motoru Dağıt Distributedıldı](../../engines/table_engines/special/distributed.md) +- [Masa motoru Dağıt Distributedıldı](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_half\_life](#settings-distributed_replica_error_half_life) ## distributed\_directory\_monitor\_sleep\_time\_ms {#distributed_directory_monitor_sleep_time_ms} -İçin taban aralığı [Dağılı](../../engines/table_engines/special/distributed.md) veri göndermek için tablo motoru. Gerçek Aralık, hatalar durumunda katlanarak büyür. +İçin taban aralığı [Dağılı](../../engines/table-engines/special/distributed.md) veri göndermek için tablo motoru. Gerçek Aralık, hatalar durumunda katlanarak büyür. Olası değerler: @@ -1088,7 +1088,7 @@ Varsayılan değer: 100 milisaniye. ## distributed\_directory\_monitor\_max\_sleep\_time\_ms {#distributed_directory_monitor_max_sleep_time_ms} -İçin Maksimum Aralık [Dağılı](../../engines/table_engines/special/distributed.md) veri göndermek için tablo motoru. Sınırları içinde belirlenen Aralık üstel büyüme [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) ayar. +İçin Maksimum Aralık [Dağılı](../../engines/table-engines/special/distributed.md) veri göndermek için tablo motoru. Sınırları içinde belirlenen Aralık üstel büyüme [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) ayar. Olası değerler: @@ -1100,7 +1100,7 @@ Varsayılan değer: 30000 milisaniye (30 saniye). Eklenen verilerin toplu olarak gönderilmesini etkinleştirir / devre dışı bırakır. -Toplu gönderme etkinleştirildiğinde, [Dağılı](../../engines/table_engines/special/distributed.md) table engine, eklenen verilerin birden çok dosyasını ayrı ayrı göndermek yerine tek bir işlemde göndermeye çalışır. Toplu gönderme, sunucu ve ağ kaynaklarını daha iyi kullanarak küme performansını artırır. +Toplu gönderme etkinleştirildiğinde, [Dağılı](../../engines/table-engines/special/distributed.md) table engine, eklenen verilerin birden çok dosyasını ayrı ayrı göndermek yerine tek bir işlemde göndermeye çalışır. Toplu gönderme, sunucu ve ağ kaynaklarını daha iyi kullanarak küme performansını artırır. Olası değerler: @@ -1126,7 +1126,7 @@ Varsayılan değer: 0. ## query\_profiler\_real\_time\_period\_ns {#query_profiler_real_time_period_ns} -Gerçek bir saat zamanlayıcı için süreyi ayarlar [sorgu profiler](../../operations/optimizing_performance/sampling_query_profiler.md). Gerçek saat zamanlayıcı duvar saati zaman sayar. +Gerçek bir saat zamanlayıcı için süreyi ayarlar [sorgu profiler](../../operations/optimizing-performance/sampling-query-profiler.md). Gerçek saat zamanlayıcı duvar saati zaman sayar. Olası değerler: @@ -1139,17 +1139,17 @@ Olası değerler: - Zamanlayıcıyı kapatmak için 0. -Tür: [Uİnt64](../../sql_reference/data_types/int_uint.md). +Tür: [Uİnt64](../../sql-reference/data-types/int-uint.md). Varsayılan değer: 1000000000 nanosaniye (saniyede bir kez). Ayrıca bakınız: -- Sistem tablosu [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- Sistem tablosu [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## query\_profiler\_cpu\_time\_period\_ns {#query_profiler_cpu_time_period_ns} -Bir CPU saat süreölçerinin dönemini ayarlar. [sorgu profiler](../../operations/optimizing_performance/sampling_query_profiler.md). Bu zamanlayıcı sadece CPU süresini sayar. +Bir CPU saat süreölçerinin dönemini ayarlar. [sorgu profiler](../../operations/optimizing-performance/sampling-query-profiler.md). Bu zamanlayıcı sadece CPU süresini sayar. Olası değerler: @@ -1162,17 +1162,17 @@ Olası değerler: - Zamanlayıcıyı kapatmak için 0. -Tür: [Uİnt64](../../sql_reference/data_types/int_uint.md). +Tür: [Uİnt64](../../sql-reference/data-types/int-uint.md). Varsayılan değer: 1000000000 nanosaniye. Ayrıca bakınız: -- Sistem tablosu [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- Sistem tablosu [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## allow\_introspection\_functions {#settings-allow_introspection_functions} -Devre dışı bırakmayı etkinleştirir [ıntrospections fonksiyonları](../../sql_reference/functions/introspection.md) sorgu profilleme için. +Devre dışı bırakmayı etkinleştirir [ıntrospections fonksiyonları](../../sql-reference/functions/introspection.md) sorgu profilleme için. Olası değerler: @@ -1183,8 +1183,8 @@ Varsayılan değer: 0. **Ayrıca Bakınız** -- [Örnekleme Sorgusu Profiler](../optimizing_performance/sampling_query_profiler.md) -- Sistem tablosu [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- [Örnekleme Sorgusu Profiler](../optimizing-performance/sampling-query-profiler.md) +- Sistem tablosu [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## ınput\_format\_parallel\_parsing {#input-format-parallel-parsing} diff --git a/docs/tr/operations/settings/settings_users.md b/docs/tr/operations/settings/settings_users.md deleted file mode 100644 index 0bc2b5ac1a5..00000000000 --- a/docs/tr/operations/settings/settings_users.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 63 -toc_title: "Kullan\u0131c\u0131 Ayarlar\u0131" ---- - -# Kullanıcı Ayarları {#user-settings} - -Bu `users` bu bölüm `user.xml` yapılandırma dosyası kullanıcı ayarlarını içerir. - -Bu yapı `users` bölme: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### home/şifre {#user-namepassword} - -Şifre düz metin veya SHA256 (hex formatında) belirtilebilir. - -- Düz metin içinde bir şifre atamak için (**tavsiye edilmez**bir koyun `password` öğe. - - Mesela, `qwerty`. Şifre boş bırakılabilir. - - - -- SHA256 karmasını kullanarak bir şifre atamak için, bir `password_sha256_hex` öğe. - - Mesela, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - Kabuktan bir parola oluşturma örneği: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - - Sonucun ilk satırı şifredir. İkinci satır karşılık gelen SHA256 karmasıdır. - - - -- MySQL istemcileri ile uyumluluk için, şifre çift SHA1 karma belirtilebilir. İçine yerleştirin `password_double_sha1_hex` öğe. - - Mesela, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - Kabuktan bir parola oluşturma örneği: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - - Sonucun ilk satırı şifredir. İkinci satır karşılık gelen çift SHA1 karmasıdır. - -### kullanıcı\_adı / ağlar {#user-namenetworks} - -Kullanıcının ClickHouse sunucusuna bağlanabileceği ağların listesi. - -Listenin her öğesi aşağıdaki formlardan birine sahip olabilir: - -- `` — IP address or network mask. - - Örnekler: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Hostname. - - Örnek: `example01.host.ru`. - - Erişimi denetlemek için bir DNS sorgusu gerçekleştirilir ve döndürülen tüm IP adresleri eş adresiyle karşılaştırılır. - -- `` — Regular expression for hostnames. - - Örnek, `^example\d\d-\d\d-\d\.host\.ru$` - - Erişimi kontrol etmek için, bir [DNS ptr sorgusu](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) eş adresi için gerçekleştirilir ve sonra belirtilen regexp uygulanır. Daha sonra PTR sorgusunun sonuçları için başka bir DNS sorgusu gerçekleştirilir ve alınan tüm adresler eş adresine karşılaştırılır. Regexp'nin $ile bitmesini şiddetle tavsiye ederiz. - -Sunucu yeniden başlatılıncaya kadar DNS isteklerinin tüm sonuçları önbelleğe alınır. - -**Örnekler** - -Herhangi bir ağdan kullanıcı için erişimi açmak için şunları belirtin: - -``` xml -::/0 -``` - -!!! warning "Uyarıcı" - Düzgün yapılandırılmış bir güvenlik duvarınız yoksa veya sunucu doğrudan internete bağlı değilse, herhangi bir ağdan erişimi açmak güvensizdir. - -Erişimi yalnızca localhost'tan açmak için şunları belirtin: - -``` xml -::1 -127.0.0.1 -``` - -### kullanıcı\_adı / profil {#user-nameprofile} - -Kullanıcı için bir ayarlar profili atayabilirsiniz. Ayarlar profilleri ayrı bir bölümde yapılandırılır `users.xml` Dosya. Daha fazla bilgi için, bkz. [Ayarların profilleri](settings_profiles.md). - -### user\_name / kota {#user-namequota} - -Kotalar, belirli bir süre boyunca kaynak kullanımını izlemenize veya sınırlamanıza izin verir. Kotalar yapılandırılır `quotas` -bu bölüm `users.xml` yapılandırma dosyası. - -Kullanıcı için ayarlanmış bir kotalar atayabilirsiniz. Kotalar yapılandırmasının ayrıntılı bir açıklaması için bkz. [Kotalar](../quotas.md#quotas). - -### user\_name / veritabanları {#user-namedatabases} - -Bu bölümde, ClickHouse tarafından döndürülen satırları sınırlayabilirsiniz `SELECT` geçerli kullanıcı tarafından yapılan sorgular, böylece temel satır düzeyinde güvenlik uygular. - -**Örnek** - -Aşağıdaki yapılandırma bu kullanıcıyı zorlar `user1` sadece satırları görebilirsiniz `table1` sonucu olarak `SELECT` sorgular, burada değeri `id` alan 1000'dir. - -``` xml - - - - - id = 1000 - - - - -``` - -Bu `filter` bir sonuç veren herhangi bir ifade olabilir [Uİnt8](../../sql_reference/data_types/int_uint.md)- tip değeri. Genellikle karşılaştırmalar ve mantıksal operatörler içerir. Satır fromlardan `database_name.table1` burada filtre sonuçları 0 için bu kullanıcı için döndürülür. Filtreleme ile uyumsuz `PREWHERE` işlemler ve devre dışı bırakır `WHERE→PREWHERE` optimizasyon. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/tr/operations/system-tables.md b/docs/tr/operations/system-tables.md new file mode 100644 index 00000000000..8c7e8e91938 --- /dev/null +++ b/docs/tr/operations/system-tables.md @@ -0,0 +1,1166 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 52 +toc_title: "Sistem Tablolar\u0131" +--- + +# Sistem Tabloları {#system-tables} + +Sistem tabloları, sistemin işlevselliğinin bir kısmını uygulamak ve sistemin nasıl çalıştığı hakkında bilgilere erişim sağlamak için kullanılır. +Bir sistem tablosunu silemezsiniz (ancak ayırma işlemini gerçekleştirebilirsiniz). +Sistem tablolarında diskte veri bulunan dosyalar veya meta verilere sahip dosyalar yoktur. Sunucu, başlatıldığında tüm sistem tablolarını oluşturur. +Sistem tabloları salt okunur. +Bulun theurlar. ‘system’ veritabanı. + +## sistem.asynchronous\_metrics {#system_tables-asynchronous_metrics} + +Arka planda periyodik olarak hesaplanan metrikleri içerir. Örneğin, kullanılan RAM miktarı. + +Sütun: + +- `metric` ([Dize](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Float64](../sql-reference/data-types/float.md)) — Metric value. + +**Örnek** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**Ayrıca Bakınız** + +- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. +- [sistem.metrik](#system_tables-metrics) — Contains instantly calculated metrics. +- [sistem.etkinlik](#system_tables-events) — Contains a number of events that have occurred. +- [sistem.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. + +## sistem.kümeler {#system-clusters} + +Yapılandırma dosyasında bulunan kümeler ve içindeki sunucular hakkında bilgi içerir. + +Sütun: + +- `cluster` (String) — The cluster name. +- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. +- `shard_weight` (UInt32) — The relative weight of the shard when writing data. +- `replica_num` (UInt32) — The replica number in the shard, starting from 1. +- `host_name` (String) — The host name, as specified in the config. +- `host_address` (String) — The host IP address obtained from DNS. +- `port` (UInt16) — The port to use for connecting to the server. +- `user` (String) — The name of the user for connecting to the server. +- `errors_count` (Uİnt32) - bu ana bilgisayarın çoğaltma ulaşamadı sayısı. +- `estimated_recovery_time` (Uİnt32) - çoğaltma hata sayısı sıfırlanana kadar saniye kaldı ve normale döndü olarak kabul edilir. + +Lütfen unutmayın `errors_count` küme için sorgu başına bir kez güncelleştirilir, ancak `estimated_recovery_time` isteğe bağlı olarak yeniden hesaplanır. Yani sıfır olmayan bir durum olabilir `errors_count` ve sıfır `estimated_recovery_time`, sonraki sorgu sıfır olacak `errors_count` ve hiçbir hata yokmuş gibi çoğaltma kullanmayı deneyin. + +**Ayrıca bakınız** + +- [Masa motoru Dağıt Distributedıldı](../engines/table-engines/special/distributed.md) +- [distributed\_replica\_error\_cap ayarı](settings/settings.md#settings-distributed_replica_error_cap) +- [distributed\_replica\_error\_half\_life ayarı](settings/settings.md#settings-distributed_replica_error_half_life) + +## sistem.sütun {#system-columns} + +Tüm tablolardaki sütunlar hakkında bilgi içerir. + +Benzer bilgileri almak için bu tabloyu kullanabilirsiniz [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table) sorgu, ancak aynı anda birden çok tablo için. + +Bu `system.columns` tablo aşağıdaki sütunları içerir (sütun türü parantez içinde gösterilir): + +- `database` (String) — Database name. +- `table` (String) — Table name. +- `name` (String) — Column name. +- `type` (String) — Column type. +- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) varsayılan değer veya tanımlanmamışsa boş bir dize için. +- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. +- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. +- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. +- `marks_bytes` (UInt64) — The size of marks, in bytes. +- `comment` (String) — Comment on the column, or an empty string if it is not defined. +- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. +- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. +- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. +- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. + +## sistem.katılımcılar {#system-contributors} + +Katkıda bulunanlar hakkında bilgi içerir. Rastgele sırayla tüm constributors. Sipariş, sorgu yürütme zamanında rasgele olur. + +Sütun: + +- `name` (String) — Contributor (author) name from git log. + +**Örnek** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +Tabloda kendinizi bulmak için bir sorgu kullanın: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## sistem.veritabanılar {#system-databases} + +Bu tablo, adı verilen tek bir dize sütunu içerir ‘name’ – the name of a database. +Sunucunun bildiği her veritabanı, tabloda karşılık gelen bir girdiye sahiptir. +Bu sistem tablosu uygulamak için kullanılır `SHOW DATABASES` sorgu. + +## sistem.detached\_parts {#system_tables-detached_parts} + +Müstakil parçaları hakkında bilgiler içerir [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) Tablolar. Bu `reason` sütun, parçanın neden ayrıldığını belirtir. Kullanıcı tarafından ayrılmış parçalar için sebep boştur. Bu tür parçalar ile eklenebilir [ALTER TABLE ATTACH PARTITION\|PART](../sql-reference/statements/alter.md#alter_attach-partition) komut. Diğer sütunların açıklaması için bkz. [sistem.parçalar](#system_tables-parts). Bölüm adı geçersiz ise, bazı sütunların değerleri olabilir `NULL`. Bu tür parçalar ile silinebilir [ALTER TABLE DROP DETACHED PART](../sql-reference/statements/alter.md#alter_drop-detached). + +## sistem.sözlükler {#system_tables-dictionaries} + +Hakkında bilgi içerir [dış söz dictionarieslükler](../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +Sütun: + +- `database` ([Dize](../sql-reference/data-types/string.md)) — Name of the database containing the dictionary created by DDL query. Empty string for other dictionaries. +- `name` ([Dize](../sql-reference/data-types/string.md)) — [Sözlük adı](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md). +- `status` ([Enum8](../sql-reference/data-types/enum.md)) — Dictionary status. Possible values: + - `NOT_LOADED` — Dictionary was not loaded because it was not used. + - `LOADED` — Dictionary loaded successfully. + - `FAILED` — Unable to load the dictionary as a result of an error. + - `LOADING` — Dictionary is loading now. + - `LOADED_AND_RELOADING` — Dictionary is loaded successfully, and is being reloaded right now (frequent reasons: [SYSTEM RELOAD DICTIONARY](../sql-reference/statements/system.md#query_language-system-reload-dictionary) sorgu, zaman aşımı, sözlük yapılandırması değişti). + - `FAILED_AND_RELOADING` — Could not load the dictionary as a result of an error and is loading now. +- `origin` ([Dize](../sql-reference/data-types/string.md)) — Path to the configuration file that describes the dictionary. +- `type` ([Dize](../sql-reference/data-types/string.md)) — Type of a dictionary allocation. [Sözlükleri bellekte saklama](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md). +- `key` — [Anahtar tipi](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-key): Sayısal Tuş ([Uİnt64](../sql-reference/data-types/int-uint.md#uint-ranges)) or Сomposite key ([Dize](../sql-reference/data-types/string.md)) — form “(type 1, type 2, …, type n)”. +- `attribute.names` ([Dizi](../sql-reference/data-types/array.md)([Dize](../sql-reference/data-types/string.md))) — Array of [öznitelik adları](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes) sözlük tarafından sağlanmıştır. +- `attribute.types` ([Dizi](../sql-reference/data-types/array.md)([Dize](../sql-reference/data-types/string.md))) — Corresponding array of [öznitelik türleri](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes) sözlük tarafından sağlanmaktadır. +- `bytes_allocated` ([Uİnt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Amount of RAM allocated for the dictionary. +- `query_count` ([Uİnt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Number of queries since the dictionary was loaded or since the last successful reboot. +- `hit_rate` ([Float64](../sql-reference/data-types/float.md)) — For cache dictionaries, the percentage of uses for which the value was in the cache. +- `element_count` ([Uİnt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Number of items stored in the dictionary. +- `load_factor` ([Float64](../sql-reference/data-types/float.md)) — Percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). +- `source` ([Dize](../sql-reference/data-types/string.md)) — Text describing the [veri kaynağı](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md) sözlük için. +- `lifetime_min` ([Uİnt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Minimum [ömür](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md) bellekteki sözlüğün ardından ClickHouse sözlüğü yeniden yüklemeye çalışır (eğer `invalidate_query` ayarlanır, daha sonra sadece değiştiyse). Saniyeler içinde ayarlayın. +- `lifetime_max` ([Uİnt64](../sql-reference/data-types/int-uint.md#uint-ranges)) — Maximum [ömür](../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md) bellekteki sözlüğün ardından ClickHouse sözlüğü yeniden yüklemeye çalışır (eğer `invalidate_query` ayarlanır, daha sonra sadece değiştiyse). Saniyeler içinde ayarlayın. +- `loading_start_time` ([DateTime](../sql-reference/data-types/datetime.md)) — Start time for loading the dictionary. +- `last_successful_update_time` ([DateTime](../sql-reference/data-types/datetime.md)) — End time for loading or updating the dictionary. Helps to monitor some troubles with external sources and investigate causes. +- `loading_duration` ([Float32](../sql-reference/data-types/float.md)) — Duration of a dictionary loading. +- `last_exception` ([Dize](../sql-reference/data-types/string.md)) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn’t be created. + +**Örnek** + +Sözlüğü yapılandırın. + +``` sql +CREATE DICTIONARY dictdb.dict +( + `key` Int64 DEFAULT -1, + `value_default` String DEFAULT 'world', + `value_expression` String DEFAULT 'xxx' EXPRESSION 'toString(127 * 172)' +) +PRIMARY KEY key +SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dicttbl' DB 'dictdb')) +LIFETIME(MIN 0 MAX 1) +LAYOUT(FLAT()) +``` + +Sözlüğün yüklendiğinden emin olun. + +``` sql +SELECT * FROM system.dictionaries +``` + +``` text +┌─database─┬─name─┬─status─┬─origin──────┬─type─┬─key────┬─attribute.names──────────────────────┬─attribute.types─────┬─bytes_allocated─┬─query_count─┬─hit_rate─┬─element_count─┬───────────load_factor─┬─source─────────────────────┬─lifetime_min─┬─lifetime_max─┬──loading_start_time─┌──last_successful_update_time─┬──────loading_duration─┬─last_exception─┐ +│ dictdb │ dict │ LOADED │ dictdb.dict │ Flat │ UInt64 │ ['value_default','value_expression'] │ ['String','String'] │ 74032 │ 0 │ 1 │ 1 │ 0.0004887585532746823 │ ClickHouse: dictdb.dicttbl │ 0 │ 1 │ 2020-03-04 04:17:34 │ 2020-03-04 04:30:34 │ 0.002 │ │ +└──────────┴──────┴────────┴─────────────┴──────┴────────┴──────────────────────────────────────┴─────────────────────┴─────────────────┴─────────────┴──────────┴───────────────┴───────────────────────┴────────────────────────────┴──────────────┴──────────────┴─────────────────────┴──────────────────────────────┘───────────────────────┴────────────────┘ +``` + +## sistem.etkinlik {#system_tables-events} + +Sistemde meydana gelen olayların sayısı hakkında bilgi içerir. Örneğin, tabloda kaç tane bulabilirsiniz `SELECT` ClickHouse sunucusu başladığından beri sorgular işlendi. + +Sütun: + +- `event` ([Dize](../sql-reference/data-types/string.md)) — Event name. +- `value` ([Uİnt64](../sql-reference/data-types/int-uint.md)) — Number of events occurred. +- `description` ([Dize](../sql-reference/data-types/string.md)) — Event description. + +**Örnek** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [sistem.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [sistem.metrik](#system_tables-metrics) — Contains instantly calculated metrics. +- [sistem.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. + +## sistem.işlevler {#system-functions} + +Normal ve toplama işlevleri hakkında bilgi içerir. + +Sütun: + +- `name`(`String`) – The name of the function. +- `is_aggregate`(`UInt8`) — Whether the function is aggregate. + +## sistem.graphite\_retentions {#system-graphite-retentions} + +Parametreleri hakkında bilgi içerir [graphite\_rollup](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) tablo usedlarında kullanılan [\* Graphıtemergetree](../engines/table-engines/mergetree-family/graphitemergetree.md) motorlar. + +Sütun: + +- `config_name` (Dize) - `graphite_rollup` parametre adı. +- `regexp` (String) - metrik adı için bir desen. +- `function` (String) - toplama işlevinin adı. +- `age` (Uint64) - saniye cinsinden verilerin minimum yaş. +- `precision` (Uİnt64) - verilerin yaşını saniyeler içinde tam olarak tanımlamak için. +- `priority` (Uİnt16) - desen önceliği. +- `is_default` (Uİnt8) - desenin varsayılan olup olmadığı. +- `Tables.database` (Array (String)) - kullanılan veritabanı tablolarının adlarının dizisi `config_name` parametre. +- `Tables.table` (Array (String)) - kullanılan tablo adları dizisi `config_name` parametre. + +## sistem.birleştiriyor {#system-merges} + +Mergetree ailesindeki tablolar için şu anda işlemde olan birleştirme ve parça mutasyonları hakkında bilgi içerir. + +Sütun: + +- `database` (String) — The name of the database the table is in. +- `table` (String) — Table name. +- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. +- `progress` (Float64) — The percentage of completed work from 0 to 1. +- `num_parts` (UInt64) — The number of pieces to be merged. +- `result_part_name` (String) — The name of the part that will be formed as the result of merging. +- `is_mutation` (Uİnt8 ) - 1 Bu işlem bir parça mutasyonu ise. +- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. +- `total_size_marks` (UInt64) — The total number of marks in the merged parts. +- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. +- `rows_read` (UInt64) — Number of rows read. +- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. +- `rows_written` (UInt64) — Number of rows written. + +## sistem.metrik {#system_tables-metrics} + +Anında hesaplanan veya geçerli bir değere sahip olabilir metrikleri içerir. Örneğin, aynı anda işlenen sorguların sayısı veya geçerli yineleme gecikmesi. Bu tablo her zaman güncel. + +Sütun: + +- `metric` ([Dize](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — Metric value. +- `description` ([Dize](../sql-reference/data-types/string.md)) — Metric description. + +Desteklenen metriklerin listesi [src / ortak / CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) ClickHouse kaynak dosyası. + +**Örnek** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [sistem.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [sistem.etkinlik](#system_tables-events) — Contains a number of events that occurred. +- [sistem.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. + +## sistem.metric\_log {#system_tables-metric_log} + +Tablolardan metrik değerlerinin geçmişini içerir `system.metrics` ve `system.events`, periyodik olarak diske boşaltılır. +Metrik geçmişi koleksiyonunu açmak için `system.metric_log`, oluşturmak `/etc/clickhouse-server/config.d/metric_log.xml` aşağıdaki içerik ile: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**Örnek** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**Ayrıca bakınız** + +- [sistem.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [sistem.etkinlik](#system_tables-events) — Contains a number of events that occurred. +- [sistem.metrik](#system_tables-metrics) — Contains instantly calculated metrics. +- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. + +## sistem.şiir {#system-numbers} + +Bu tablo adında tek bir uint64 sütunu içerir ‘number’ bu sıfırdan başlayarak hemen hemen tüm doğal sayıları içerir. +Bu tabloyu testler için veya kaba kuvvet araması yapmanız gerekiyorsa kullanabilirsiniz. +Bu tablodan okumalar parallelized değil. + +## sistem.numbers\_mt {#system-numbers-mt} + +Olarak aynı ‘system.numbers’ ancak okumalar paralelleştirilmiştir. Sayılar herhangi bir sırayla iade edilebilir. +Testler için kullanılır. + +## sistem.bir {#system-one} + +Bu tablo, tek bir satır içeren tek bir satır içerir ‘dummy’ 0 değerini içeren uint8 sütunu. +SELECT sorgusu FROM yan tümcesi belirtmezse, bu tablo kullanılır. +Bu, diğer Dbms’lerde bulunan ikili tabloya benzer. + +## sistem.parçalar {#system_tables-parts} + +Bölümleri hakkında bilgi içerir [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) Tablolar. + +Her satır bir veri bölümünü açıklar. + +Sütun: + +- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql-reference/statements/alter.md#query_language_queries_alter) sorgu. + + Biçimliler: + + - `YYYYMM` ay otomatik bölümleme için. + - `any_string` el ile bölümleme yaparken. + +- `name` (`String`) – Name of the data part. + +- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. + +- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` dizin ayrıntısına göre (genellikle 8192) (bu ipucu uyarlanabilir ayrıntı için çalışmaz). + +- `rows` (`UInt64`) – The number of rows. + +- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. + +- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `marks_bytes` (`UInt64`) – The size of the file with marks. + +- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| + +- `remove_time` (`DateTime`) – The time when the data part became inactive. + +- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. + +- `min_date` (`Date`) – The minimum value of the date key in the data part. + +- `max_date` (`Date`) – The maximum value of the date key in the data part. + +- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. + +- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. + +- `partition_id` (`String`) – ID of the partition. + +- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. + +- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. + +- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. + +- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. + +- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition) + +- `database` (`String`) – Name of the database. + +- `table` (`String`) – Name of the table. + +- `engine` (`String`) – Name of the table engine without parameters. + +- `path` (`String`) – Absolute path to the folder with data part files. + +- `disk` (`String`) – Name of a disk that stores the data part. + +- `hash_of_all_files` (`String`) – [sifash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) sıkıştırılmış dosyaların. + +- `hash_of_uncompressed_files` (`String`) – [sifash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) sıkıştırılmamış dosyaların (işaretli dosyalar, dizin dosyası vb.)). + +- `uncompressed_hash_of_compressed_files` (`String`) – [sifash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) sıkıştırılmış dosyalardaki verilerin sıkıştırılmamış gibi. + +- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. + +- `marks_size` (`UInt64`) – Alias for `marks_bytes`. + +## sistem.part\_log {#system_tables-part-log} + +Bu `system.part_log` tablo yalnızca aşağıdaki durumlarda oluşturulur: [part\_log](server-configuration-parameters/settings.md#server_configuration_parameters-part-log) sunucu ayarı belirtilir. + +Bu tablo ile oluşan olaylar hakkında bilgi içerir [veri parçaları](../engines/table-engines/mergetree-family/custom-partitioning-key.md) in the [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) veri ekleme veya birleştirme gibi aile tabloları. + +Bu `system.part_log` tablo aşağıdaki sütunları içerir: + +- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: + - `NEW_PART` — Inserting of a new data part. + - `MERGE_PARTS` — Merging of data parts. + - `DOWNLOAD_PART` — Downloading a data part. + - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — Mutating of a data part. + - `MOVE_PART` — Moving the data part from the one disk to another one. +- `event_date` (Date) — Event date. +- `event_time` (DateTime) — Event time. +- `duration_ms` (UInt64) — Duration. +- `database` (String) — Name of the database the data part is in. +- `table` (String) — Name of the table the data part is in. +- `part_name` (String) — Name of the data part. +- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ bölümleme tarafından ise değer `tuple()`. +- `rows` (UInt64) — The number of rows in the data part. +- `size_in_bytes` (UInt64) — Size of the data part in bytes. +- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). +- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. +- `read_rows` (UInt64) — The number of rows was read during the merge. +- `read_bytes` (UInt64) — The number of bytes was read during the merge. +- `error` (UInt16) — The code number of the occurred error. +- `exception` (String) — Text message of the occurred error. + +Bu `system.part_log` tablo ilk veri ekleme sonra oluşturulur `MergeTree` Tablo. + +## sistem.işleyişler {#system_tables-processes} + +Bu sistem tablosu uygulamak için kullanılır `SHOW PROCESSLIST` sorgu. + +Sütun: + +- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` kullanan. Alan, bu sorgunun başlattığı bir sorgu için değil, belirli bir sorgunun kullanıcı adını içerir. +- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` sorgu istek sahibi sunucuda. +- `elapsed` (Float64) – The time in seconds since request execution started. +- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. +- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query-complexity.md#settings_max_memory_usage) ayar. +- `query` (String) – The query text. For `INSERT`, eklemek için veri içermez. +- `query_id` (String) – Query ID, if defined. + +## sistem.text\_log {#system-tables-text-log} + +Günlük girişleri içerir. Bu tabloya giden günlük seviyesi ile sınırlı olabilir `text_log.level` sunucu ayarı. + +Sütun: + +- `event_date` (`Date`)- Giriş tarihi. +- `event_time` (`DateTime`)- Giriş zamanı. +- `microseconds` (`UInt32`)- Girişin mikrosaniye. +- `thread_name` (String) — Name of the thread from which the logging was done. +- `thread_id` (UInt64) — OS thread ID. +- `level` (`Enum8`)- Giriş seviyesi. + - `'Fatal' = 1` + - `'Critical' = 2` + - `'Error' = 3` + - `'Warning' = 4` + - `'Notice' = 5` + - `'Information' = 6` + - `'Debug' = 7` + - `'Trace' = 8` +- `query_id` (`String`)- Sorgunun kimliği. +- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) +- `message` (`String`)- Mesajın kendisi . +- `revision` (`UInt32`)- ClickHouse revizyon. +- `source_file` (`LowCardinality(String)`)- Günlüğü yapıldığı kaynak dosya. +- `source_line` (`UInt64`)- Kaynak satır hangi günlüğü yapıldı. + +## sistem.query\_log {#system_tables-query_log} + +Sorguların yürütülmesi hakkında bilgi içerir. Her sorgu için, işlem başlangıç saatini, işlem süresini, hata mesajlarını ve diğer bilgileri görebilirsiniz. + +!!! note "Not" + Tablo için giriş verileri içermiyor `INSERT` sorgular. + +ClickHouse bu tabloyu yalnızca [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) sunucu parametresi belirtilir. Bu parametre, günlük aralığı veya sorguların oturum açacağı tablonun adı gibi günlük kurallarını ayarlar. + +Sorgu günlüğünü etkinleştirmek için, [log\_queries](settings/settings.md#settings-log-queries) parametre 1. Ayrıntılar için, bkz. [Ayarlar](settings/settings.md) bölme. + +Bu `system.query_log` tablo iki tür sorgu kaydeder: + +1. Doğrudan istemci tarafından çalıştırılan ilk sorgular. +2. Diğer sorgular tarafından başlatılan alt sorgular (dağıtılmış sorgu yürütme için). Bu tür sorgular için, üst sorgular hakkında bilgi `initial_*` sütun. + +Sütun: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` sorgular, yazılı satır sayısı. Diğer sorgular için sütun değeri 0’dır. +- `written_bytes` (UInt64) — For `INSERT` sorgular, yazılı bayt sayısı. Diğer sorgular için sütun değeri 0’dır. +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [clickhouse-müşteri](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi çalıştırılır. +- `client_name` (String) — The [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci adı. +- `client_revision` (UInt32) — Revision of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. +- `client_version_major` (UInt32) — Major version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. +- `client_version_minor` (UInt32) — Minor version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. +- `client_version_patch` (UInt32) — Patch component of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci sürümü. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` yöntem kullanılmıştır. + - 2 — `POST` yöntem kullanılmıştır. +- `http_user_agent` (String) — The `UserAgent` başlık http isteğinde geçti. +- `quota_key` (String) — The “quota key” belirtilen [kotalar](quotas.md) ayarı (bakınız `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [sistem.etkinlik](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` sütun. +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parametre 1. +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` sütun. + +Her sorgu bir veya iki satır oluşturur `query_log` tablo, sorgunun durumuna bağlı olarak: + +1. Sorgu yürütme başarılı olursa, tip 1 ve 2 ile iki olay oluşturulur (bkz. `type` sütun). +2. Sorgu işleme sırasında bir hata oluştu, iki olay türleri 1 ve 4 oluşturulur. +3. Sorguyu başlatmadan önce bir hata oluşmuşsa, 3 tipi olan tek bir olay oluşturulur. + +Varsayılan olarak, günlükleri 7.5 saniye aralıklarla tabloya eklenir. Bu aralığı ayarlayabilirsiniz [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) sunucu ayarı (bkz. `flush_interval_milliseconds` parametre). Günlükleri zorla bellek arabelleğinden tabloya temizlemek için `SYSTEM FLUSH LOGS` sorgu. + +Tablo elle silindiğinde, otomatik olarak anında oluşturulur. Önceki tüm günlüklerin silineceğini unutmayın. + +!!! note "Not" + Günlüklerin depolama süresi sınırsızdır. Günlükler tablodan otomatik olarak silinmez. Eski günlüklerin kaldırılmasını kendiniz düzenlemeniz gerekir. + +İçin keyfi bir bölümleme anahtarı belirtebilirsiniz `system.query_log` tablo içinde [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) sunucu ayarı (bkz. `partition_by` parametre). + +## sistem.query\_thread\_log {#system_tables-query-thread-log} + +Tablo, her sorgu yürütme iş parçacığı hakkında bilgi içerir. + +ClickHouse bu tabloyu yalnızca [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu parametresi belirtilir. Bu parametre, günlük aralığı veya sorguların oturum açacağı tablonun adı gibi günlük kurallarını ayarlar. + +Sorgu günlüğünü etkinleştirmek için, [log\_query\_threads](settings/settings.md#settings-log-query-threads) parametre 1. Ayrıntılar için, bkz. [Ayarlar](settings/settings.md) bölme. + +Sütun: + +- `event_date` (Date) — the date when the thread has finished execution of the query. +- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` sorgular, yazılı satır sayısı. Diğer sorgular için sütun değeri 0’dır. +- `written_bytes` (UInt64) — For `INSERT` sorgular, yazılı bayt sayısı. Diğer sorgular için sütun değeri 0’dır. +- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. +- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. +- `thread_name` (String) — Name of the thread. +- `thread_number` (UInt32) — Internal thread ID. +- `os_thread_id` (Int32) — OS thread ID. +- `master_thread_id` (UInt64) — OS initial ID of initial thread. +- `query` (String) — Query string. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [clickhouse-müşteri](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi çalıştırılır. +- `client_name` (String) — The [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci adı. +- `client_revision` (UInt32) — Revision of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. +- `client_version_major` (UInt32) — Major version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. +- `client_version_minor` (UInt32) — Minor version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. +- `client_version_patch` (UInt32) — Patch component of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci sürümü. +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` yöntem kullanılmıştır. + - 2 — `POST` yöntem kullanılmıştır. +- `http_user_agent` (String) — The `UserAgent` başlık http isteğinde geçti. +- `quota_key` (String) — The “quota key” belirtilen [kotalar](quotas.md) ayarı (bakınız `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [sistem.etkinlik](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` sütun. + +Varsayılan olarak, günlükleri 7.5 saniye aralıklarla tabloya eklenir. Bu aralığı ayarlayabilirsiniz [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu ayarı (bkz. `flush_interval_milliseconds` parametre). Günlükleri zorla bellek arabelleğinden tabloya temizlemek için `SYSTEM FLUSH LOGS` sorgu. + +Tablo elle silindiğinde, otomatik olarak anında oluşturulur. Önceki tüm günlüklerin silineceğini unutmayın. + +!!! note "Not" + Günlüklerin depolama süresi sınırsızdır. Günlükler tablodan otomatik olarak silinmez. Eski günlüklerin kaldırılmasını kendiniz düzenlemeniz gerekir. + +İçin keyfi bir bölümleme anahtarı belirtebilirsiniz `system.query_thread_log` tablo içinde [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu ayarı (bkz. `partition_by` parametre). + +## sistem.trace\_log {#system_tables-trace_log} + +Örnekleme sorgusu profiler tarafından toplanan yığın izlemeleri içerir. + +ClickHouse bu tabloyu oluşturduğunda [trace\_log](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) sunucu yapılandırma bölümü ayarlanır. Ayrıca [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) ve [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) ayarlar ayarlan .malıdır. + +Günlükleri analiz etmek için `addressToLine`, `addressToSymbol` ve `demangle` iç gözlem fonksiyonları. + +Sütun: + +- `event_date`([Tarihli](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time`([DateTime](../sql-reference/data-types/datetime.md)) — Timestamp of sampling moment. + +- `revision`([Uİnt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + Tarafından sunucuya Bağlan byırken `clickhouse-client`, benzer diz theg seeeyi görüyorsunuz `Connected to ClickHouse server version 19.18.1 revision 54429.`. Bu alan şunları içerir `revision` ama `version` bir sunucunun. + +- `timer_type`([Enum8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` duvar saati zamanını temsil eder. + - `CPU` CPU süresini temsil eder. + +- `thread_number`([Uİnt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id`([Dize](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) sistem tablosu. + +- `trace`([Dizi (Uİnt64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**Örnek** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## sistem.yinelemeler {#system_tables-replicas} + +Yerel sunucuda bulunan çoğaltılmış tablolar için bilgi ve durum içerir. +Bu tablo izleme için kullanılabilir. Tablo, her çoğaltılmış \* tablo için bir satır içerir. + +Örnek: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +Sütun: + +- `database` (`String`)- Veritabanı adı +- `table` (`String`)- Tablo adı +- `engine` (`String`)- Tablo motor adı +- `is_leader` (`UInt8`)- Kopya lider olup olmadığı. + Bir seferde sadece bir kopya lider olabilir. Lider, gerçekleştirmek için arka plan birleştirmelerini seçmekten sorumludur. + Yazma kullanılabilir ve bir oturum ZK, bir lider olup olmadığına bakılmaksızın olan herhangi bir yineleme için gerçekleştirilebilir unutmayın. +- `can_become_leader` (`UInt8`)- Rep .lik leaderanın lider olarak seçil .ip seçil .emeyeceği. +- `is_readonly` (`UInt8`)- Yinelemenin salt okunur modda olup olmadığı. + Yapılandırmanın ZooKeeper ile bölümleri yoksa, zookeeper’daki oturumları yeniden başlatırken ve Zookeeper’daki oturum yeniden başlatılırken bilinmeyen bir hata oluşmuşsa bu mod açılır. +- `is_session_expired` (`UInt8`)- ZooKeeper ile oturum süresi doldu. Temelde aynı `is_readonly`. +- `future_parts` (`UInt32`)- Henüz yapılmamış ekler veya birleştirmelerin sonucu olarak görünecek veri parçalarının sayısı. +- `parts_to_check` (`UInt32`)- Doğrulama için kuyruktaki veri parçalarının sayısı. Hasar görebileceğinden şüphe varsa, bir parça doğrulama kuyruğuna konur. +- `zookeeper_path` (`String`)- ZooKeeper tablo verilerine yolu. +- `replica_name` (`String`)- Zookeeper çoğaltma adı. Aynı tablonun farklı kopyaları farklı adlara sahiptir. +- `replica_path` (`String`)- ZooKeeper çoğaltma veri yolu. Birleştirme ile aynı ‘zookeeper\_path/replicas/replica\_path’. +- `columns_version` (`Int32`)- Tablo yapısının sürüm numarası. ALTER kaç kez gerçekleştirildiğini gösterir. Kopyaların farklı sürümleri varsa, bazı kopyaların tüm değişiklikleri henüz yapmadığı anlamına gelir. +- `queue_size` (`UInt32`)- Yapılması beklenen işlemler için sıranın büyüklüğü. İşlemler, veri bloklarını, birleştirmeleri ve diğer bazı eylemleri eklemeyi içerir. Genellikle ile çakışmaktadır `future_parts`. +- `inserts_in_queue` (`UInt32`)- Yapılması gereken veri bloklarının eklerinin sayısı. Eklemeler genellikle oldukça hızlı bir şekilde çoğaltılır. Bu sayı büyükse, bir şeylerin yanlış olduğu anlamına gelir. +- `merges_in_queue` (`UInt32`)- Yapılmasını bekleyen birleştirme sayısı. Bazen birleştirmeler uzundur, bu nedenle bu değer uzun süre sıfırdan büyük olabilir. +- `part_mutations_in_queue` (`UInt32`)- Yapılması beklenen Mut numberasyon sayısı. +- `queue_oldest_time` (`DateTime`) - Eğer `queue_size` daha büyük 0, en eski işlem sıraya eklendiğinde gösterir. +- `inserts_oldest_time` (`DateTime`) - Görmek `queue_oldest_time` +- `merges_oldest_time` (`DateTime`) - Görmek `queue_oldest_time` +- `part_mutations_oldest_time` (`DateTime`) - Görmek `queue_oldest_time` + +Sonraki 4 sütun, yalnızca ZK ile aktif bir oturumun olduğu sıfır olmayan bir değere sahiptir. + +- `log_max_index` (`UInt64`)- Genel faaliyet günlüğüne maksimum giriş numarası. +- `log_pointer` (`UInt64`)- Çoğaltma yürütme kuyruğuna kopyalanan genel faaliyet günlüğüne maksimum giriş numarası, artı bir. Eğer `log_pointer` daha küçük `log_max_index` yanlış bir şey olduğunu. +- `last_queue_update` (`DateTime`)- Kuyruk son kez güncellendiğinde. +- `absolute_delay` (`UInt64`)- Geçerli kopyanın saniyeler içinde ne kadar büyük gecikme var. +- `total_replicas` (`UInt8`)- Bu tablonun bilinen kopyalarının toplam sayısı. +- `active_replicas` (`UInt8`)- ZooKeeper bir oturum var bu tablonun kopyaları sayısı (yani, işleyen kopyaları sayısı). + +Tüm sütunları talep ederseniz, Tablo biraz yavaş çalışabilir, çünkü ZooKeeper birkaç okuma her satır için yapılır. +Son 4 sütun (log\_max\_ındex, log\_pointer, total\_replicas, active\_replicas) istemiyorsanız, tablo hızlı bir şekilde çalışır. + +Örneğin, her şeyin böyle düzgün çalıştığını kontrol edebilirsiniz: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +Bu sorgu hiçbir şey döndürmezse, her şeyin yolunda olduğu anlamına gelir. + +## sistem.ayarlar {#system-tables-system-settings} + +Geçerli kullanıcı için oturum ayarları hakkında bilgi içerir. + +Sütun: + +- `name` ([Dize](../sql-reference/data-types/string.md)) — Setting name. +- `value` ([Dize](../sql-reference/data-types/string.md)) — Setting value. +- `changed` ([Uİnt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — Shows whether a setting is changed from its default value. +- `description` ([Dize](../sql-reference/data-types/string.md)) — Short setting description. +- `min` ([Nullable](../sql-reference/data-types/nullable.md)([Dize](../sql-reference/data-types/string.md))) — Minimum value of the setting, if any is set via [kısıtlamalar](settings/constraints-on-settings.md#constraints-on-settings). Ayarın minimum değeri yoksa, şunları içerir [NULL](../sql-reference/syntax.md#null-literal). +- `max` ([Nullable](../sql-reference/data-types/nullable.md)([Dize](../sql-reference/data-types/string.md))) — Maximum value of the setting, if any is set via [kısıtlamalar](settings/constraints-on-settings.md#constraints-on-settings). Ayarın maksimum değeri yoksa, şunları içerir [NULL](../sql-reference/syntax.md#null-literal). +- `readonly` ([Uİnt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — Shows whether the current user can change the setting: + - `0` — Current user can change the setting. + - `1` — Current user can’t change the setting. + +**Örnek** + +Aşağıdaki örnek, adı içeren ayarlar hakkında bilgi almak gösterilmiştir `min_i`. + +``` sql +SELECT * +FROM system.settings +WHERE name LIKE '%min_i%' +``` + +``` text +┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ +│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ +``` + +Kullanımı `WHERE changed` örneğin, kontrol etmek istediğinizde yararlı olabilir: + +- Olsun yapılandırma dosyaları, ayarları doğru şekilde yüklenmiş ve kullanımdadır. +- Geçerli oturumda değişen ayarlar. + + + +``` sql +SELECT * FROM system.settings WHERE changed AND name='load_balancing' +``` + +**Ayrıca bakınız** + +- [Ayarlar](settings/index.md#settings) +- [Sorgular için izinler](settings/permissions-for-queries.md#settings_readonly) +- [Ayarlardaki kısıtlamalar](settings/constraints-on-settings.md) + +## sistem.table\_engines {#system.table_engines} + +``` text +┌─name───────────────────┬─value───────┐ +│ max_threads │ 8 │ +│ use_uncompressed_cache │ 0 │ +│ load_balancing │ random │ +│ max_memory_usage │ 10000000000 │ +└────────────────────────┴─────────────┘ +``` + +## sistem.merge\_tree\_settings {#system-merge_tree_settings} + +İçin ayarlar hakkında bilgi içerir `MergeTree` Tablolar. + +Sütun: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. + +## sistem.table\_engines {#system-table-engines} + +Sunucu tarafından desteklenen tablo motorlarının açıklamasını ve özellik destek bilgilerini içerir. + +Bu tablo aşağıdaki sütunları içerir (sütun türü parantez içinde gösterilir): + +- `name` (String) — The name of table engine. +- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` yan. +- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [endeksleri atlama](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` ve `SAMPLE_BY`. +- `supports_replication` (UInt8) — Flag that indicates if table engine supports [veri çoğaltma](../engines/table-engines/mergetree-family/replication.md). +- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. + +Örnek: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**Ayrıca bakınız** + +- MergeTree ailesi [sorgu yan tümceleri](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) +- Kafka [ayarlar](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) +- Katmak [ayarlar](../engines/table-engines/special/join.md#join-limitations-and-settings) + +## sistem.Tablolar {#system-tables} + +Sunucunun bildiği her tablonun meta verilerini içerir. Müstakil tablolar gösterilmez `system.tables`. + +Bu tablo aşağıdaki sütunları içerir (sütun türü parantez içinde gösterilir): + +- `database` (String) — The name of the database the table is in. + +- `name` (String) — Table name. + +- `engine` (String) — Table engine name (without parameters). + +- `is_temporary` (Uİnt8) - tablonun geçici olup olmadığını gösteren bayrak. + +- `data_path` (String) - dosya sistemindeki tablo verilerinin yolu. + +- `metadata_path` (String) - dosya sistemindeki tablo Meta Veri Yolu. + +- `metadata_modification_time` (DateTime) - tablo meta son değişiklik zamanı. + +- `dependencies_database` (Array (String)) - veritabanı bağımlılıkları. + +- `dependencies_table` (Array (String)) - Tablo bağımlılıkları ([MaterializedView](../engines/table-engines/special/materializedview.md) geçerli tabloya dayalı tablolar). + +- `create_table_query` (String) - tablo oluşturmak için kullanılan sorgu. + +- `engine_full` (String) - tablo motorunun parametreleri. + +- `partition_key` (String) - tabloda belirtilen bölüm anahtarı ifadesi. + +- `sorting_key` (String) - tabloda belirtilen sıralama anahtarı ifadesi. + +- `primary_key` (String) - tabloda belirtilen birincil anahtar ifadesi. + +- `sampling_key` (String) - tabloda belirtilen örnekleme anahtar ifadesi. + +- `storage_policy` (String) - depolama politikası: + + - [MergeTree](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) + - [Dağılı](../engines/table-engines/special/distributed.md#distributed) + +- `total_rows` (Nullable (Uİnt64)) - tablodaki tam satır sayısını hızlı bir şekilde belirlemek mümkün ise, toplam satır sayısı `Null` (underying dahil `Buffer` Tablo). + +- `total_bytes` (Nullable (Uİnt64)) - toplam bayt sayısı, eğer depolama alanındaki tablo için tam bayt sayısını hızlı bir şekilde belirlemek mümkün ise, aksi takdirde `Null` (**do Notes not** herhangi bir temel depolama içerir). + + - If the table stores data on disk, returns used space on disk (i.e. compressed). + - Tablo verileri bellekte depolarsa, bellekte kullanılan bayt sayısını yaklaşık olarak döndürür. + +Bu `system.tables` tablo kullanılır `SHOW TABLES` sorgu uygulaması. + +## sistem.zookeeper {#system-zookeeper} + +ZooKeeper yapılandırılmamışsa, tablo yok. Yapılandırmada tanımlanan ZooKeeper kümesinden veri okumayı sağlar. +Sorgu bir olmalıdır ‘path’ WH .ere madd .esindeki eşitlik koşulu. Bu veri almak istediğiniz çocuklar için ZooKeeper yoludur. + +Sorgu `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` tüm çocuklar için veri çıkışı `/clickhouse` düğümlü. +Tüm kök düğümler için veri çıkışı yapmak için, path = yazın ‘/’. +Belirtilen yol ise ‘path’ yok, bir istisna atılır. + +Sütun: + +- `name` (String) — The name of the node. +- `path` (String) — The path to the node. +- `value` (String) — Node value. +- `dataLength` (Int32) — Size of the value. +- `numChildren` (Int32) — Number of descendants. +- `czxid` (Int64) — ID of the transaction that created the node. +- `mzxid` (Int64) — ID of the transaction that last changed the node. +- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. +- `ctime` (DateTime) — Time of node creation. +- `mtime` (DateTime) — Time of the last modification of the node. +- `version` (Int32) — Node version: the number of times the node was changed. +- `cversion` (Int32) — Number of added or removed descendants. +- `aversion` (Int32) — Number of changes to the ACL. +- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. + +Örnek: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## sistem.mutasyonlar {#system_tables-mutations} + +Tablo hakkında bilgi içerir [mutasyonlar](../sql-reference/statements/alter.md#alter-mutations) MergeTree tabloları ve bunların ilerleme. Her mutasyon komutu tek bir satırla temsil edilir. Tablo aşağıdaki sütunlara sahiptir: + +**veritabanı**, **Tablo** - Mutasyonun uygulandığı veritabanı ve tablonun adı. + +**mutation\_id** - Mutasyonun kimliği. Çoğaltılmış tablolar için bu kimlikler znode adlarına karşılık gelir `/mutations/` ZooKeeper dizin. Yinelenmemiş tablolar için kimlikler, tablonun veri dizinindeki dosya adlarına karşılık gelir. + +**komut** - Mut commandasyon komut diz (gesi (sorgu afterdan sonra `ALTER TABLE [db.]table`). + +**create\_time** - Bu mutasyon komutu idam için sunulduğunda. + +**block\_numbers.partition\_id**, **block\_numbers.numara** - İç içe geçmiş bir sütun. Çoğaltılmış tabloların mutasyonları için, her bölüm için bir kayıt içerir: bölüm kimliği ve mutasyon tarafından elde edilen blok numarası (her bölümde, yalnızca bu bölümdeki mutasyon tarafından elde edilen blok sayısından daha az sayıda blok içeren parçalar mutasyona uğrayacaktır). Çoğaltılmamış tablolarda, tüm bölümlerdeki blok numaraları tek bir sıra oluşturur. Bu, çoğaltılmamış tabloların mutasyonları için, sütunun mutasyon tarafından elde edilen tek bir blok numarasına sahip bir kayıt içereceği anlamına gelir. + +**parts\_to\_do** - Mutasyonun bitmesi için mutasyona uğraması gereken veri parçalarının sayısı. + +**is\_done** - Mutasyon bitti mi? Not bile `parts_to_do = 0` çoğaltılmış bir tablonun mutasyonu, mutasyona uğraması gereken yeni bir veri parçası yaratacak uzun süren bir ekleme nedeniyle henüz yapılmamıştır. + +Bazı bölümleri mutasyon ile ilgili sorunlar varsa, aşağıdaki sütunlar ek bilgi içerir: + +**latest\_failed\_part** - Mutasyona uğramayan en son bölümün adı. + +**latest\_fail\_time** - En son bölüm mutasyon başarısızlığı zamanı. + +**latest\_fail\_reason** - En son bölüm mutasyon başarısızlığına neden olan istisna mesajı. + +## sistem.diskler {#system_tables-disks} + +İçinde tanımlanan diskler hakkında bilgi içerir [sunucu yapılandırması](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Sütun: + +- `name` ([Dize](../sql-reference/data-types/string.md)) — Name of a disk in the server configuration. +- `path` ([Dize](../sql-reference/data-types/string.md)) — Path to the mount point in the file system. +- `free_space` ([Uİnt64](../sql-reference/data-types/int-uint.md)) — Free space on disk in bytes. +- `total_space` ([Uİnt64](../sql-reference/data-types/int-uint.md)) — Disk volume in bytes. +- `keep_free_space` ([Uİnt64](../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` disk yapılandırması parametresi. + +## sistem.storage\_policies {#system_tables-storage_policies} + +Depolama ilkeleri ve birimlerinde tanımlanan bilgiler içerir. [sunucu yapılandırması](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +Sütun: + +- `policy_name` ([Dize](../sql-reference/data-types/string.md)) — Name of the storage policy. +- `volume_name` ([Dize](../sql-reference/data-types/string.md)) — Volume name defined in the storage policy. +- `volume_priority` ([Uİnt64](../sql-reference/data-types/int-uint.md)) — Volume order number in the configuration. +- `disks` ([Ar Arrayray (String)](../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. +- `max_data_part_size` ([Uİnt64](../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). +- `move_factor` ([Float64](../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. + +Depolama ilkesi birden fazla birim içeriyorsa, her birim için bilgiler tablonun tek tek satırında saklanır. + +[Orijinal makale](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/tr/operations/system_tables.md b/docs/tr/operations/system_tables.md deleted file mode 100644 index 17fd176cc58..00000000000 --- a/docs/tr/operations/system_tables.md +++ /dev/null @@ -1,1166 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 52 -toc_title: "Sistem Tablolar\u0131" ---- - -# Sistem Tabloları {#system-tables} - -Sistem tabloları, sistemin işlevselliğinin bir kısmını uygulamak ve sistemin nasıl çalıştığı hakkında bilgilere erişim sağlamak için kullanılır. -Bir sistem tablosunu silemezsiniz (ancak ayırma işlemini gerçekleştirebilirsiniz). -Sistem tablolarında diskte veri bulunan dosyalar veya meta verilere sahip dosyalar yoktur. Sunucu, başlatıldığında tüm sistem tablolarını oluşturur. -Sistem tabloları salt okunur. -Bulun theurlar. ‘system’ veritabanı. - -## sistem.asynchronous\_metrics {#system_tables-asynchronous_metrics} - -Arka planda periyodik olarak hesaplanan metrikleri içerir. Örneğin, kullanılan RAM miktarı. - -Sütun: - -- `metric` ([Dize](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Float64](../sql_reference/data_types/float.md)) — Metric value. - -**Örnek** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**Ayrıca Bakınız** - -- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. -- [sistem.metrik](#system_tables-metrics) — Contains instantly calculated metrics. -- [sistem.etkinlik](#system_tables-events) — Contains a number of events that have occurred. -- [sistem.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. - -## sistem.kümeler {#system-clusters} - -Yapılandırma dosyasında bulunan kümeler ve içindeki sunucular hakkında bilgi içerir. - -Sütun: - -- `cluster` (String) — The cluster name. -- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. -- `shard_weight` (UInt32) — The relative weight of the shard when writing data. -- `replica_num` (UInt32) — The replica number in the shard, starting from 1. -- `host_name` (String) — The host name, as specified in the config. -- `host_address` (String) — The host IP address obtained from DNS. -- `port` (UInt16) — The port to use for connecting to the server. -- `user` (String) — The name of the user for connecting to the server. -- `errors_count` (Uİnt32) - bu ana bilgisayarın çoğaltma ulaşamadı sayısı. -- `estimated_recovery_time` (Uİnt32) - çoğaltma hata sayısı sıfırlanana kadar saniye kaldı ve normale döndü olarak kabul edilir. - -Lütfen unutmayın `errors_count` küme için sorgu başına bir kez güncelleştirilir, ancak `estimated_recovery_time` isteğe bağlı olarak yeniden hesaplanır. Yani sıfır olmayan bir durum olabilir `errors_count` ve sıfır `estimated_recovery_time`, sonraki sorgu sıfır olacak `errors_count` ve hiçbir hata yokmuş gibi çoğaltma kullanmayı deneyin. - -**Ayrıca bakınız** - -- [Masa motoru Dağıt Distributedıldı](../engines/table_engines/special/distributed.md) -- [distributed\_replica\_error\_cap ayarı](settings/settings.md#settings-distributed_replica_error_cap) -- [distributed\_replica\_error\_half\_life ayarı](settings/settings.md#settings-distributed_replica_error_half_life) - -## sistem.sütun {#system-columns} - -Tüm tablolardaki sütunlar hakkında bilgi içerir. - -Benzer bilgileri almak için bu tabloyu kullanabilirsiniz [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table) sorgu, ancak aynı anda birden çok tablo için. - -Bu `system.columns` tablo aşağıdaki sütunları içerir (sütun türü parantez içinde gösterilir): - -- `database` (String) — Database name. -- `table` (String) — Table name. -- `name` (String) — Column name. -- `type` (String) — Column type. -- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`) varsayılan değer veya tanımlanmamışsa boş bir dize için. -- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. -- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. -- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. -- `marks_bytes` (UInt64) — The size of marks, in bytes. -- `comment` (String) — Comment on the column, or an empty string if it is not defined. -- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. -- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. -- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. -- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. - -## sistem.katılımcılar {#system-contributors} - -Katkıda bulunanlar hakkında bilgi içerir. Rastgele sırayla tüm constributors. Sipariş, sorgu yürütme zamanında rasgele olur. - -Sütun: - -- `name` (String) — Contributor (author) name from git log. - -**Örnek** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -Tabloda kendinizi bulmak için bir sorgu kullanın: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## sistem.veritabanılar {#system-databases} - -Bu tablo, adı verilen tek bir dize sütunu içerir ‘name’ – the name of a database. -Sunucunun bildiği her veritabanı, tabloda karşılık gelen bir girdiye sahiptir. -Bu sistem tablosu uygulamak için kullanılır `SHOW DATABASES` sorgu. - -## sistem.detached\_parts {#system_tables-detached_parts} - -Müstakil parçaları hakkında bilgiler içerir [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) Tablolar. Bu `reason` sütun, parçanın neden ayrıldığını belirtir. Kullanıcı tarafından ayrılmış parçalar için sebep boştur. Bu tür parçalar ile eklenebilir [ALTER TABLE ATTACH PARTITION\|PART](../sql_reference/statements/alter.md#alter_attach-partition) komut. Diğer sütunların açıklaması için bkz. [sistem.parçalar](#system_tables-parts). Bölüm adı geçersiz ise, bazı sütunların değerleri olabilir `NULL`. Bu tür parçalar ile silinebilir [ALTER TABLE DROP DETACHED PART](../sql_reference/statements/alter.md#alter_drop-detached). - -## sistem.sözlükler {#system_tables-dictionaries} - -Hakkında bilgi içerir [dış söz dictionarieslükler](../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -Sütun: - -- `database` ([Dize](../sql_reference/data_types/string.md)) — Name of the database containing the dictionary created by DDL query. Empty string for other dictionaries. -- `name` ([Dize](../sql_reference/data_types/string.md)) — [Sözlük adı](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md). -- `status` ([Enum8](../sql_reference/data_types/enum.md)) — Dictionary status. Possible values: - - `NOT_LOADED` — Dictionary was not loaded because it was not used. - - `LOADED` — Dictionary loaded successfully. - - `FAILED` — Unable to load the dictionary as a result of an error. - - `LOADING` — Dictionary is loading now. - - `LOADED_AND_RELOADING` — Dictionary is loaded successfully, and is being reloaded right now (frequent reasons: [SYSTEM RELOAD DICTIONARY](../sql_reference/statements/system.md#query_language-system-reload-dictionary) sorgu, zaman aşımı, sözlük yapılandırması değişti). - - `FAILED_AND_RELOADING` — Could not load the dictionary as a result of an error and is loading now. -- `origin` ([Dize](../sql_reference/data_types/string.md)) — Path to the configuration file that describes the dictionary. -- `type` ([Dize](../sql_reference/data_types/string.md)) — Type of a dictionary allocation. [Sözlükleri bellekte saklama](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md). -- `key` — [Anahtar tipi](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-key): Sayısal Tuş ([Uİnt64](../sql_reference/data_types/int_uint.md#uint-ranges)) or Сomposite key ([Dize](../sql_reference/data_types/string.md)) — form “(type 1, type 2, …, type n)”. -- `attribute.names` ([Dizi](../sql_reference/data_types/array.md)([Dize](../sql_reference/data_types/string.md))) — Array of [öznitelik adları](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes) sözlük tarafından sağlanmıştır. -- `attribute.types` ([Dizi](../sql_reference/data_types/array.md)([Dize](../sql_reference/data_types/string.md))) — Corresponding array of [öznitelik türleri](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes) sözlük tarafından sağlanmaktadır. -- `bytes_allocated` ([Uİnt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Amount of RAM allocated for the dictionary. -- `query_count` ([Uİnt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Number of queries since the dictionary was loaded or since the last successful reboot. -- `hit_rate` ([Float64](../sql_reference/data_types/float.md)) — For cache dictionaries, the percentage of uses for which the value was in the cache. -- `element_count` ([Uİnt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Number of items stored in the dictionary. -- `load_factor` ([Float64](../sql_reference/data_types/float.md)) — Percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). -- `source` ([Dize](../sql_reference/data_types/string.md)) — Text describing the [veri kaynağı](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md) sözlük için. -- `lifetime_min` ([Uİnt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Minimum [ömür](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md) bellekteki sözlüğün ardından ClickHouse sözlüğü yeniden yüklemeye çalışır (eğer `invalidate_query` ayarlanır, daha sonra sadece değiştiyse). Saniyeler içinde ayarlayın. -- `lifetime_max` ([Uİnt64](../sql_reference/data_types/int_uint.md#uint-ranges)) — Maximum [ömür](../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md) bellekteki sözlüğün ardından ClickHouse sözlüğü yeniden yüklemeye çalışır (eğer `invalidate_query` ayarlanır, daha sonra sadece değiştiyse). Saniyeler içinde ayarlayın. -- `loading_start_time` ([DateTime](../sql_reference/data_types/datetime.md)) — Start time for loading the dictionary. -- `last_successful_update_time` ([DateTime](../sql_reference/data_types/datetime.md)) — End time for loading or updating the dictionary. Helps to monitor some troubles with external sources and investigate causes. -- `loading_duration` ([Float32](../sql_reference/data_types/float.md)) — Duration of a dictionary loading. -- `last_exception` ([Dize](../sql_reference/data_types/string.md)) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn't be created. - -**Örnek** - -Sözlüğü yapılandırın. - -``` sql -CREATE DICTIONARY dictdb.dict -( - `key` Int64 DEFAULT -1, - `value_default` String DEFAULT 'world', - `value_expression` String DEFAULT 'xxx' EXPRESSION 'toString(127 * 172)' -) -PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dicttbl' DB 'dictdb')) -LIFETIME(MIN 0 MAX 1) -LAYOUT(FLAT()) -``` - -Sözlüğün yüklendiğinden emin olun. - -``` sql -SELECT * FROM system.dictionaries -``` - -``` text -┌─database─┬─name─┬─status─┬─origin──────┬─type─┬─key────┬─attribute.names──────────────────────┬─attribute.types─────┬─bytes_allocated─┬─query_count─┬─hit_rate─┬─element_count─┬───────────load_factor─┬─source─────────────────────┬─lifetime_min─┬─lifetime_max─┬──loading_start_time─┌──last_successful_update_time─┬──────loading_duration─┬─last_exception─┐ -│ dictdb │ dict │ LOADED │ dictdb.dict │ Flat │ UInt64 │ ['value_default','value_expression'] │ ['String','String'] │ 74032 │ 0 │ 1 │ 1 │ 0.0004887585532746823 │ ClickHouse: dictdb.dicttbl │ 0 │ 1 │ 2020-03-04 04:17:34 │ 2020-03-04 04:30:34 │ 0.002 │ │ -└──────────┴──────┴────────┴─────────────┴──────┴────────┴──────────────────────────────────────┴─────────────────────┴─────────────────┴─────────────┴──────────┴───────────────┴───────────────────────┴────────────────────────────┴──────────────┴──────────────┴─────────────────────┴──────────────────────────────┘───────────────────────┴────────────────┘ -``` - -## sistem.etkinlik {#system_tables-events} - -Sistemde meydana gelen olayların sayısı hakkında bilgi içerir. Örneğin, tabloda kaç tane bulabilirsiniz `SELECT` ClickHouse sunucusu başladığından beri sorgular işlendi. - -Sütun: - -- `event` ([Dize](../sql_reference/data_types/string.md)) — Event name. -- `value` ([Uİnt64](../sql_reference/data_types/int_uint.md)) — Number of events occurred. -- `description` ([Dize](../sql_reference/data_types/string.md)) — Event description. - -**Örnek** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [sistem.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [sistem.metrik](#system_tables-metrics) — Contains instantly calculated metrics. -- [sistem.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. - -## sistem.işlevler {#system-functions} - -Normal ve toplama işlevleri hakkında bilgi içerir. - -Sütun: - -- `name`(`String`) – The name of the function. -- `is_aggregate`(`UInt8`) — Whether the function is aggregate. - -## sistem.graphite\_retentions {#system-graphite-retentions} - -Parametreleri hakkında bilgi içerir [graphite\_rollup](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) tablo usedlarında kullanılan [\* Graphıtemergetree](../engines/table_engines/mergetree_family/graphitemergetree.md) motorlar. - -Sütun: - -- `config_name` (Dize) - `graphite_rollup` parametre adı. -- `regexp` (String) - metrik adı için bir desen. -- `function` (String) - toplama işlevinin adı. -- `age` (Uint64) - saniye cinsinden verilerin minimum yaş. -- `precision` (Uİnt64) - verilerin yaşını saniyeler içinde tam olarak tanımlamak için. -- `priority` (Uİnt16) - desen önceliği. -- `is_default` (Uİnt8) - desenin varsayılan olup olmadığı. -- `Tables.database` (Array (String)) - kullanılan veritabanı tablolarının adlarının dizisi `config_name` parametre. -- `Tables.table` (Array (String)) - kullanılan tablo adları dizisi `config_name` parametre. - -## sistem.birleştiriyor {#system-merges} - -Mergetree ailesindeki tablolar için şu anda işlemde olan birleştirme ve parça mutasyonları hakkında bilgi içerir. - -Sütun: - -- `database` (String) — The name of the database the table is in. -- `table` (String) — Table name. -- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. -- `progress` (Float64) — The percentage of completed work from 0 to 1. -- `num_parts` (UInt64) — The number of pieces to be merged. -- `result_part_name` (String) — The name of the part that will be formed as the result of merging. -- `is_mutation` (Uİnt8 ) - 1 Bu işlem bir parça mutasyonu ise. -- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. -- `total_size_marks` (UInt64) — The total number of marks in the merged parts. -- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. -- `rows_read` (UInt64) — Number of rows read. -- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. -- `rows_written` (UInt64) — Number of rows written. - -## sistem.metrik {#system_tables-metrics} - -Anında hesaplanan veya geçerli bir değere sahip olabilir metrikleri içerir. Örneğin, aynı anda işlenen sorguların sayısı veya geçerli yineleme gecikmesi. Bu tablo her zaman güncel. - -Sütun: - -- `metric` ([Dize](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — Metric value. -- `description` ([Dize](../sql_reference/data_types/string.md)) — Metric description. - -Desteklenen metriklerin listesi [src / ortak / CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) ClickHouse kaynak dosyası. - -**Örnek** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [sistem.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [sistem.etkinlik](#system_tables-events) — Contains a number of events that occurred. -- [sistem.metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. - -## sistem.metric\_log {#system_tables-metric_log} - -Tablolardan metrik değerlerinin geçmişini içerir `system.metrics` ve `system.events`, periyodik olarak diske boşaltılır. -Metrik geçmişi koleksiyonunu açmak için `system.metric_log`, oluşturmak `/etc/clickhouse-server/config.d/metric_log.xml` aşağıdaki içerik ile: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**Örnek** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**Ayrıca bakınız** - -- [sistem.asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [sistem.etkinlik](#system_tables-events) — Contains a number of events that occurred. -- [sistem.metrik](#system_tables-metrics) — Contains instantly calculated metrics. -- [İzleme](monitoring.md) — Base concepts of ClickHouse monitoring. - -## sistem.şiir {#system-numbers} - -Bu tablo adında tek bir uint64 sütunu içerir ‘number’ bu sıfırdan başlayarak hemen hemen tüm doğal sayıları içerir. -Bu tabloyu testler için veya kaba kuvvet araması yapmanız gerekiyorsa kullanabilirsiniz. -Bu tablodan okumalar parallelized değil. - -## sistem.numbers\_mt {#system-numbers-mt} - -Olarak aynı ‘system.numbers’ ancak okumalar paralelleştirilmiştir. Sayılar herhangi bir sırayla iade edilebilir. -Testler için kullanılır. - -## sistem.bir {#system-one} - -Bu tablo, tek bir satır içeren tek bir satır içerir ‘dummy’ 0 değerini içeren uint8 sütunu. -SELECT sorgusu FROM yan tümcesi belirtmezse, bu tablo kullanılır. -Bu, diğer Dbms'lerde bulunan ikili tabloya benzer. - -## sistem.parçalar {#system_tables-parts} - -Bölümleri hakkında bilgi içerir [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) Tablolar. - -Her satır bir veri bölümünü açıklar. - -Sütun: - -- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql_reference/statements/alter.md#query_language_queries_alter) sorgu. - - Biçimliler: - - - `YYYYMM` ay otomatik bölümleme için. - - `any_string` el ile bölümleme yaparken. - -- `name` (`String`) – Name of the data part. - -- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it's used in a table. Otherwise, it's deleted. Inactive data parts remain after merging. - -- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` dizin ayrıntısına göre (genellikle 8192) (bu ipucu uyarlanabilir ayrıntı için çalışmaz). - -- `rows` (`UInt64`) – The number of rows. - -- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. - -- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `marks_bytes` (`UInt64`) – The size of the file with marks. - -- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| - -- `remove_time` (`DateTime`) – The time when the data part became inactive. - -- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. - -- `min_date` (`Date`) – The minimum value of the date key in the data part. - -- `max_date` (`Date`) – The maximum value of the date key in the data part. - -- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. - -- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. - -- `partition_id` (`String`) – ID of the partition. - -- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. - -- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. - -- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. - -- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. - -- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn't exist. For more details, see [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition) - -- `database` (`String`) – Name of the database. - -- `table` (`String`) – Name of the table. - -- `engine` (`String`) – Name of the table engine without parameters. - -- `path` (`String`) – Absolute path to the folder with data part files. - -- `disk` (`String`) – Name of a disk that stores the data part. - -- `hash_of_all_files` (`String`) – [sifash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) sıkıştırılmış dosyaların. - -- `hash_of_uncompressed_files` (`String`) – [sifash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) sıkıştırılmamış dosyaların (işaretli dosyalar, dizin dosyası vb.)). - -- `uncompressed_hash_of_compressed_files` (`String`) – [sifash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) sıkıştırılmış dosyalardaki verilerin sıkıştırılmamış gibi. - -- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. - -- `marks_size` (`UInt64`) – Alias for `marks_bytes`. - -## sistem.part\_log {#system_tables-part-log} - -Bu `system.part_log` tablo yalnızca aşağıdaki durumlarda oluşturulur: [part\_log](server_configuration_parameters/settings.md#server_configuration_parameters-part-log) sunucu ayarı belirtilir. - -Bu tablo ile oluşan olaylar hakkında bilgi içerir [veri parçaları](../engines/table_engines/mergetree_family/custom_partitioning_key.md) in the [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) veri ekleme veya birleştirme gibi aile tabloları. - -Bu `system.part_log` tablo aşağıdaki sütunları içerir: - -- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: - - `NEW_PART` — Inserting of a new data part. - - `MERGE_PARTS` — Merging of data parts. - - `DOWNLOAD_PART` — Downloading a data part. - - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — Mutating of a data part. - - `MOVE_PART` — Moving the data part from the one disk to another one. -- `event_date` (Date) — Event date. -- `event_time` (DateTime) — Event time. -- `duration_ms` (UInt64) — Duration. -- `database` (String) — Name of the database the data part is in. -- `table` (String) — Name of the table the data part is in. -- `part_name` (String) — Name of the data part. -- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ bölümleme tarafından ise değer `tuple()`. -- `rows` (UInt64) — The number of rows in the data part. -- `size_in_bytes` (UInt64) — Size of the data part in bytes. -- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). -- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. -- `read_rows` (UInt64) — The number of rows was read during the merge. -- `read_bytes` (UInt64) — The number of bytes was read during the merge. -- `error` (UInt16) — The code number of the occurred error. -- `exception` (String) — Text message of the occurred error. - -Bu `system.part_log` tablo ilk veri ekleme sonra oluşturulur `MergeTree` Tablo. - -## sistem.işleyişler {#system_tables-processes} - -Bu sistem tablosu uygulamak için kullanılır `SHOW PROCESSLIST` sorgu. - -Sütun: - -- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` kullanan. Alan, bu sorgunun başlattığı bir sorgu için değil, belirli bir sorgunun kullanıcı adını içerir. -- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` sorgu istek sahibi sunucuda. -- `elapsed` (Float64) – The time in seconds since request execution started. -- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. -- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query_complexity.md#settings_max_memory_usage) ayar. -- `query` (String) – The query text. For `INSERT`, eklemek için veri içermez. -- `query_id` (String) – Query ID, if defined. - -## sistem.text\_log {#system-tables-text-log} - -Günlük girişleri içerir. Bu tabloya giden günlük seviyesi ile sınırlı olabilir `text_log.level` sunucu ayarı. - -Sütun: - -- `event_date` (`Date`)- Giriş tarihi. -- `event_time` (`DateTime`)- Giriş zamanı. -- `microseconds` (`UInt32`)- Girişin mikrosaniye. -- `thread_name` (String) — Name of the thread from which the logging was done. -- `thread_id` (UInt64) — OS thread ID. -- `level` (`Enum8`)- Giriş seviyesi. - - `'Fatal' = 1` - - `'Critical' = 2` - - `'Error' = 3` - - `'Warning' = 4` - - `'Notice' = 5` - - `'Information' = 6` - - `'Debug' = 7` - - `'Trace' = 8` -- `query_id` (`String`)- Sorgunun kimliği. -- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) -- `message` (`String`)- Mesajın kendisi . -- `revision` (`UInt32`)- ClickHouse revizyon. -- `source_file` (`LowCardinality(String)`)- Günlüğü yapıldığı kaynak dosya. -- `source_line` (`UInt64`)- Kaynak satır hangi günlüğü yapıldı. - -## sistem.query\_log {#system_tables-query_log} - -Sorguların yürütülmesi hakkında bilgi içerir. Her sorgu için, işlem başlangıç saatini, işlem süresini, hata mesajlarını ve diğer bilgileri görebilirsiniz. - -!!! note "Not" - Tablo için giriş verileri içermiyor `INSERT` sorgular. - -ClickHouse bu tabloyu yalnızca [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) sunucu parametresi belirtilir. Bu parametre, günlük aralığı veya sorguların oturum açacağı tablonun adı gibi günlük kurallarını ayarlar. - -Sorgu günlüğünü etkinleştirmek için, [log\_queries](settings/settings.md#settings-log-queries) parametre 1. Ayrıntılar için, bkz. [Ayarlar](settings/settings.md) bölme. - -Bu `system.query_log` tablo iki tür sorgu kaydeder: - -1. Doğrudan istemci tarafından çalıştırılan ilk sorgular. -2. Diğer sorgular tarafından başlatılan alt sorgular (dağıtılmış sorgu yürütme için). Bu tür sorgular için, üst sorgular hakkında bilgi `initial_*` sütun. - -Sütun: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` sorgular, yazılı satır sayısı. Diğer sorgular için sütun değeri 0'dır. -- `written_bytes` (UInt64) — For `INSERT` sorgular, yazılı bayt sayısı. Diğer sorgular için sütun değeri 0'dır. -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [clickhouse-müşteri](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi çalıştırılır. -- `client_name` (String) — The [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci adı. -- `client_revision` (UInt32) — Revision of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. -- `client_version_major` (UInt32) — Major version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. -- `client_version_minor` (UInt32) — Minor version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. -- `client_version_patch` (UInt32) — Patch component of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci sürümü. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` yöntem kullanılmıştır. - - 2 — `POST` yöntem kullanılmıştır. -- `http_user_agent` (String) — The `UserAgent` başlık http isteğinde geçti. -- `quota_key` (String) — The “quota key” belirtilen [kotalar](quotas.md) ayarı (bakınız `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [sistem.etkinlik](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` sütun. -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parametre 1. -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` sütun. - -Her sorgu bir veya iki satır oluşturur `query_log` tablo, sorgunun durumuna bağlı olarak: - -1. Sorgu yürütme başarılı olursa, tip 1 ve 2 ile iki olay oluşturulur (bkz. `type` sütun). -2. Sorgu işleme sırasında bir hata oluştu, iki olay türleri 1 ve 4 oluşturulur. -3. Sorguyu başlatmadan önce bir hata oluşmuşsa, 3 tipi olan tek bir olay oluşturulur. - -Varsayılan olarak, günlükleri 7.5 saniye aralıklarla tabloya eklenir. Bu aralığı ayarlayabilirsiniz [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) sunucu ayarı (bkz. `flush_interval_milliseconds` parametre). Günlükleri zorla bellek arabelleğinden tabloya temizlemek için `SYSTEM FLUSH LOGS` sorgu. - -Tablo elle silindiğinde, otomatik olarak anında oluşturulur. Önceki tüm günlüklerin silineceğini unutmayın. - -!!! note "Not" - Günlüklerin depolama süresi sınırsızdır. Günlükler tablodan otomatik olarak silinmez. Eski günlüklerin kaldırılmasını kendiniz düzenlemeniz gerekir. - -İçin keyfi bir bölümleme anahtarı belirtebilirsiniz `system.query_log` tablo içinde [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) sunucu ayarı (bkz. `partition_by` parametre). - -## sistem.query\_thread\_log {#system_tables-query-thread-log} - -Tablo, her sorgu yürütme iş parçacığı hakkında bilgi içerir. - -ClickHouse bu tabloyu yalnızca [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu parametresi belirtilir. Bu parametre, günlük aralığı veya sorguların oturum açacağı tablonun adı gibi günlük kurallarını ayarlar. - -Sorgu günlüğünü etkinleştirmek için, [log\_query\_threads](settings/settings.md#settings-log-query-threads) parametre 1. Ayrıntılar için, bkz. [Ayarlar](settings/settings.md) bölme. - -Sütun: - -- `event_date` (Date) — the date when the thread has finished execution of the query. -- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` sorgular, yazılı satır sayısı. Diğer sorgular için sütun değeri 0'dır. -- `written_bytes` (UInt64) — For `INSERT` sorgular, yazılı bayt sayısı. Diğer sorgular için sütun değeri 0'dır. -- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. -- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. -- `thread_name` (String) — Name of the thread. -- `thread_number` (UInt32) — Internal thread ID. -- `os_thread_id` (Int32) — OS thread ID. -- `master_thread_id` (UInt64) — OS initial ID of initial thread. -- `query` (String) — Query string. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [clickhouse-müşteri](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi çalıştırılır. -- `client_name` (String) — The [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci adı. -- `client_revision` (UInt32) — Revision of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. -- `client_version_major` (UInt32) — Major version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. -- `client_version_minor` (UInt32) — Minor version of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemcisi. -- `client_version_patch` (UInt32) — Patch component of the [clickhouse-müşteri](../interfaces/cli.md) veya başka bir TCP istemci sürümü. -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` yöntem kullanılmıştır. - - 2 — `POST` yöntem kullanılmıştır. -- `http_user_agent` (String) — The `UserAgent` başlık http isteğinde geçti. -- `quota_key` (String) — The “quota key” belirtilen [kotalar](quotas.md) ayarı (bakınız `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [sistem.etkinlik](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` sütun. - -Varsayılan olarak, günlükleri 7.5 saniye aralıklarla tabloya eklenir. Bu aralığı ayarlayabilirsiniz [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu ayarı (bkz. `flush_interval_milliseconds` parametre). Günlükleri zorla bellek arabelleğinden tabloya temizlemek için `SYSTEM FLUSH LOGS` sorgu. - -Tablo elle silindiğinde, otomatik olarak anında oluşturulur. Önceki tüm günlüklerin silineceğini unutmayın. - -!!! note "Not" - Günlüklerin depolama süresi sınırsızdır. Günlükler tablodan otomatik olarak silinmez. Eski günlüklerin kaldırılmasını kendiniz düzenlemeniz gerekir. - -İçin keyfi bir bölümleme anahtarı belirtebilirsiniz `system.query_thread_log` tablo içinde [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) sunucu ayarı (bkz. `partition_by` parametre). - -## sistem.trace\_log {#system_tables-trace_log} - -Örnekleme sorgusu profiler tarafından toplanan yığın izlemeleri içerir. - -ClickHouse bu tabloyu oluşturduğunda [trace\_log](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) sunucu yapılandırma bölümü ayarlanır. Ayrıca [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) ve [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) ayarlar ayarlan .malıdır. - -Günlükleri analiz etmek için `addressToLine`, `addressToSymbol` ve `demangle` iç gözlem fonksiyonları. - -Sütun: - -- `event_date`([Tarihli](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time`([DateTime](../sql_reference/data_types/datetime.md)) — Timestamp of sampling moment. - -- `revision`([Uİnt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - Tarafından sunucuya Bağlan byırken `clickhouse-client`, benzer diz theg seeeyi görüyorsunuz `Connected to ClickHouse server version 19.18.1 revision 54429.`. Bu alan şunları içerir `revision` ama `version` bir sunucunun. - -- `timer_type`([Enum8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` duvar saati zamanını temsil eder. - - `CPU` CPU süresini temsil eder. - -- `thread_number`([Uİnt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id`([Dize](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) sistem tablosu. - -- `trace`([Dizi (Uİnt64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**Örnek** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## sistem.yinelemeler {#system_tables-replicas} - -Yerel sunucuda bulunan çoğaltılmış tablolar için bilgi ve durum içerir. -Bu tablo izleme için kullanılabilir. Tablo, her çoğaltılmış \* tablo için bir satır içerir. - -Örnek: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -Sütun: - -- `database` (`String`)- Veritabanı adı -- `table` (`String`)- Tablo adı -- `engine` (`String`)- Tablo motor adı -- `is_leader` (`UInt8`)- Kopya lider olup olmadığı. - Bir seferde sadece bir kopya lider olabilir. Lider, gerçekleştirmek için arka plan birleştirmelerini seçmekten sorumludur. - Yazma kullanılabilir ve bir oturum ZK, bir lider olup olmadığına bakılmaksızın olan herhangi bir yineleme için gerçekleştirilebilir unutmayın. -- `can_become_leader` (`UInt8`)- Rep .lik leaderanın lider olarak seçil .ip seçil .emeyeceği. -- `is_readonly` (`UInt8`)- Yinelemenin salt okunur modda olup olmadığı. - Yapılandırmanın ZooKeeper ile bölümleri yoksa, zookeeper'daki oturumları yeniden başlatırken ve Zookeeper'daki oturum yeniden başlatılırken bilinmeyen bir hata oluşmuşsa bu mod açılır. -- `is_session_expired` (`UInt8`)- ZooKeeper ile oturum süresi doldu. Temelde aynı `is_readonly`. -- `future_parts` (`UInt32`)- Henüz yapılmamış ekler veya birleştirmelerin sonucu olarak görünecek veri parçalarının sayısı. -- `parts_to_check` (`UInt32`)- Doğrulama için kuyruktaki veri parçalarının sayısı. Hasar görebileceğinden şüphe varsa, bir parça doğrulama kuyruğuna konur. -- `zookeeper_path` (`String`)- ZooKeeper tablo verilerine yolu. -- `replica_name` (`String`)- Zookeeper çoğaltma adı. Aynı tablonun farklı kopyaları farklı adlara sahiptir. -- `replica_path` (`String`)- ZooKeeper çoğaltma veri yolu. Birleştirme ile aynı ‘zookeeper\_path/replicas/replica\_path’. -- `columns_version` (`Int32`)- Tablo yapısının sürüm numarası. ALTER kaç kez gerçekleştirildiğini gösterir. Kopyaların farklı sürümleri varsa, bazı kopyaların tüm değişiklikleri henüz yapmadığı anlamına gelir. -- `queue_size` (`UInt32`)- Yapılması beklenen işlemler için sıranın büyüklüğü. İşlemler, veri bloklarını, birleştirmeleri ve diğer bazı eylemleri eklemeyi içerir. Genellikle ile çakışmaktadır `future_parts`. -- `inserts_in_queue` (`UInt32`)- Yapılması gereken veri bloklarının eklerinin sayısı. Eklemeler genellikle oldukça hızlı bir şekilde çoğaltılır. Bu sayı büyükse, bir şeylerin yanlış olduğu anlamına gelir. -- `merges_in_queue` (`UInt32`)- Yapılmasını bekleyen birleştirme sayısı. Bazen birleştirmeler uzundur, bu nedenle bu değer uzun süre sıfırdan büyük olabilir. -- `part_mutations_in_queue` (`UInt32`)- Yapılması beklenen Mut numberasyon sayısı. -- `queue_oldest_time` (`DateTime`) - Eğer `queue_size` daha büyük 0, en eski işlem sıraya eklendiğinde gösterir. -- `inserts_oldest_time` (`DateTime`) - Görmek `queue_oldest_time` -- `merges_oldest_time` (`DateTime`) - Görmek `queue_oldest_time` -- `part_mutations_oldest_time` (`DateTime`) - Görmek `queue_oldest_time` - -Sonraki 4 sütun, yalnızca ZK ile aktif bir oturumun olduğu sıfır olmayan bir değere sahiptir. - -- `log_max_index` (`UInt64`)- Genel faaliyet günlüğüne maksimum giriş numarası. -- `log_pointer` (`UInt64`)- Çoğaltma yürütme kuyruğuna kopyalanan genel faaliyet günlüğüne maksimum giriş numarası, artı bir. Eğer `log_pointer` daha küçük `log_max_index` yanlış bir şey olduğunu. -- `last_queue_update` (`DateTime`)- Kuyruk son kez güncellendiğinde. -- `absolute_delay` (`UInt64`)- Geçerli kopyanın saniyeler içinde ne kadar büyük gecikme var. -- `total_replicas` (`UInt8`)- Bu tablonun bilinen kopyalarının toplam sayısı. -- `active_replicas` (`UInt8`)- ZooKeeper bir oturum var bu tablonun kopyaları sayısı (yani, işleyen kopyaları sayısı). - -Tüm sütunları talep ederseniz, Tablo biraz yavaş çalışabilir, çünkü ZooKeeper birkaç okuma her satır için yapılır. -Son 4 sütun (log\_max\_ındex, log\_pointer, total\_replicas, active\_replicas) istemiyorsanız, tablo hızlı bir şekilde çalışır. - -Örneğin, her şeyin böyle düzgün çalıştığını kontrol edebilirsiniz: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -Bu sorgu hiçbir şey döndürmezse, her şeyin yolunda olduğu anlamına gelir. - -## sistem.ayarlar {#system-tables-system-settings} - -Geçerli kullanıcı için oturum ayarları hakkında bilgi içerir. - -Sütun: - -- `name` ([Dize](../sql_reference/data_types/string.md)) — Setting name. -- `value` ([Dize](../sql_reference/data_types/string.md)) — Setting value. -- `changed` ([Uİnt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — Shows whether a setting is changed from its default value. -- `description` ([Dize](../sql_reference/data_types/string.md)) — Short setting description. -- `min` ([Nullable](../sql_reference/data_types/nullable.md)([Dize](../sql_reference/data_types/string.md))) — Minimum value of the setting, if any is set via [kısıtlamalar](settings/constraints_on_settings.md#constraints-on-settings). Ayarın minimum değeri yoksa, şunları içerir [NULL](../sql_reference/syntax.md#null-literal). -- `max` ([Nullable](../sql_reference/data_types/nullable.md)([Dize](../sql_reference/data_types/string.md))) — Maximum value of the setting, if any is set via [kısıtlamalar](settings/constraints_on_settings.md#constraints-on-settings). Ayarın maksimum değeri yoksa, şunları içerir [NULL](../sql_reference/syntax.md#null-literal). -- `readonly` ([Uİnt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — Shows whether the current user can change the setting: - - `0` — Current user can change the setting. - - `1` — Current user can't change the setting. - -**Örnek** - -Aşağıdaki örnek, adı içeren ayarlar hakkında bilgi almak gösterilmiştir `min_i`. - -``` sql -SELECT * -FROM system.settings -WHERE name LIKE '%min_i%' -``` - -``` text -┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ -│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ -``` - -Kullanımı `WHERE changed` örneğin, kontrol etmek istediğinizde yararlı olabilir: - -- Olsun yapılandırma dosyaları, ayarları doğru şekilde yüklenmiş ve kullanımdadır. -- Geçerli oturumda değişen ayarlar. - - - -``` sql -SELECT * FROM system.settings WHERE changed AND name='load_balancing' -``` - -**Ayrıca bakınız** - -- [Ayarlar](settings/index.md#settings) -- [Sorgular için izinler](settings/permissions_for_queries.md#settings_readonly) -- [Ayarlardaki kısıtlamalar](settings/constraints_on_settings.md) - -## sistem.table\_engines {#system.table_engines} - -``` text -┌─name───────────────────┬─value───────┐ -│ max_threads │ 8 │ -│ use_uncompressed_cache │ 0 │ -│ load_balancing │ random │ -│ max_memory_usage │ 10000000000 │ -└────────────────────────┴─────────────┘ -``` - -## sistem.merge\_tree\_settings {#system-merge_tree_settings} - -İçin ayarlar hakkında bilgi içerir `MergeTree` Tablolar. - -Sütun: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. - -## sistem.table\_engines {#system-table-engines} - -Sunucu tarafından desteklenen tablo motorlarının açıklamasını ve özellik destek bilgilerini içerir. - -Bu tablo aşağıdaki sütunları içerir (sütun türü parantez içinde gösterilir): - -- `name` (String) — The name of table engine. -- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` yan. -- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [endeksleri atlama](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` ve `SAMPLE_BY`. -- `supports_replication` (UInt8) — Flag that indicates if table engine supports [veri çoğaltma](../engines/table_engines/mergetree_family/replication.md). -- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. - -Örnek: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**Ayrıca bakınız** - -- MergeTree ailesi [sorgu yan tümceleri](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) -- Kafka [ayarlar](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) -- Katmak [ayarlar](../engines/table_engines/special/join.md#join-limitations-and-settings) - -## sistem.Tablolar {#system-tables} - -Sunucunun bildiği her tablonun meta verilerini içerir. Müstakil tablolar gösterilmez `system.tables`. - -Bu tablo aşağıdaki sütunları içerir (sütun türü parantez içinde gösterilir): - -- `database` (String) — The name of the database the table is in. - -- `name` (String) — Table name. - -- `engine` (String) — Table engine name (without parameters). - -- `is_temporary` (Uİnt8) - tablonun geçici olup olmadığını gösteren bayrak. - -- `data_path` (String) - dosya sistemindeki tablo verilerinin yolu. - -- `metadata_path` (String) - dosya sistemindeki tablo Meta Veri Yolu. - -- `metadata_modification_time` (DateTime) - tablo meta son değişiklik zamanı. - -- `dependencies_database` (Array (String)) - veritabanı bağımlılıkları. - -- `dependencies_table` (Array (String)) - Tablo bağımlılıkları ([MaterializedView](../engines/table_engines/special/materializedview.md) geçerli tabloya dayalı tablolar). - -- `create_table_query` (String) - tablo oluşturmak için kullanılan sorgu. - -- `engine_full` (String) - tablo motorunun parametreleri. - -- `partition_key` (String) - tabloda belirtilen bölüm anahtarı ifadesi. - -- `sorting_key` (String) - tabloda belirtilen sıralama anahtarı ifadesi. - -- `primary_key` (String) - tabloda belirtilen birincil anahtar ifadesi. - -- `sampling_key` (String) - tabloda belirtilen örnekleme anahtar ifadesi. - -- `storage_policy` (String) - depolama politikası: - - - [MergeTree](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) - - [Dağılı](../engines/table_engines/special/distributed.md#distributed) - -- `total_rows` (Nullable (Uİnt64)) - tablodaki tam satır sayısını hızlı bir şekilde belirlemek mümkün ise, toplam satır sayısı `Null` (underying dahil `Buffer` Tablo). - -- `total_bytes` (Nullable (Uİnt64)) - toplam bayt sayısı, eğer depolama alanındaki tablo için tam bayt sayısını hızlı bir şekilde belirlemek mümkün ise, aksi takdirde `Null` (**do Notes not** herhangi bir temel depolama içerir). - - - If the table stores data on disk, returns used space on disk (i.e. compressed). - - Tablo verileri bellekte depolarsa, bellekte kullanılan bayt sayısını yaklaşık olarak döndürür. - -Bu `system.tables` tablo kullanılır `SHOW TABLES` sorgu uygulaması. - -## sistem.zookeeper {#system-zookeeper} - -ZooKeeper yapılandırılmamışsa, tablo yok. Yapılandırmada tanımlanan ZooKeeper kümesinden veri okumayı sağlar. -Sorgu bir olmalıdır ‘path’ WH .ere madd .esindeki eşitlik koşulu. Bu veri almak istediğiniz çocuklar için ZooKeeper yoludur. - -Sorgu `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` tüm çocuklar için veri çıkışı `/clickhouse` düğümlü. -Tüm kök düğümler için veri çıkışı yapmak için, path = yazın ‘/’. -Belirtilen yol ise ‘path’ yok, bir istisna atılır. - -Sütun: - -- `name` (String) — The name of the node. -- `path` (String) — The path to the node. -- `value` (String) — Node value. -- `dataLength` (Int32) — Size of the value. -- `numChildren` (Int32) — Number of descendants. -- `czxid` (Int64) — ID of the transaction that created the node. -- `mzxid` (Int64) — ID of the transaction that last changed the node. -- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. -- `ctime` (DateTime) — Time of node creation. -- `mtime` (DateTime) — Time of the last modification of the node. -- `version` (Int32) — Node version: the number of times the node was changed. -- `cversion` (Int32) — Number of added or removed descendants. -- `aversion` (Int32) — Number of changes to the ACL. -- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. - -Örnek: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## sistem.mutasyonlar {#system_tables-mutations} - -Tablo hakkında bilgi içerir [mutasyonlar](../sql_reference/statements/alter.md#alter-mutations) MergeTree tabloları ve bunların ilerleme. Her mutasyon komutu tek bir satırla temsil edilir. Tablo aşağıdaki sütunlara sahiptir: - -**veritabanı**, **Tablo** - Mutasyonun uygulandığı veritabanı ve tablonun adı. - -**mutation\_id** - Mutasyonun kimliği. Çoğaltılmış tablolar için bu kimlikler znode adlarına karşılık gelir `/mutations/` ZooKeeper dizin. Yinelenmemiş tablolar için kimlikler, tablonun veri dizinindeki dosya adlarına karşılık gelir. - -**komut** - Mut commandasyon komut diz (gesi (sorgu afterdan sonra `ALTER TABLE [db.]table`). - -**create\_time** - Bu mutasyon komutu idam için sunulduğunda. - -**block\_numbers.partition\_id**, **block\_numbers.numara** - İç içe geçmiş bir sütun. Çoğaltılmış tabloların mutasyonları için, her bölüm için bir kayıt içerir: bölüm kimliği ve mutasyon tarafından elde edilen blok numarası (her bölümde, yalnızca bu bölümdeki mutasyon tarafından elde edilen blok sayısından daha az sayıda blok içeren parçalar mutasyona uğrayacaktır). Çoğaltılmamış tablolarda, tüm bölümlerdeki blok numaraları tek bir sıra oluşturur. Bu, çoğaltılmamış tabloların mutasyonları için, sütunun mutasyon tarafından elde edilen tek bir blok numarasına sahip bir kayıt içereceği anlamına gelir. - -**parts\_to\_do** - Mutasyonun bitmesi için mutasyona uğraması gereken veri parçalarının sayısı. - -**is\_done** - Mutasyon bitti mi? Not bile `parts_to_do = 0` çoğaltılmış bir tablonun mutasyonu, mutasyona uğraması gereken yeni bir veri parçası yaratacak uzun süren bir ekleme nedeniyle henüz yapılmamıştır. - -Bazı bölümleri mutasyon ile ilgili sorunlar varsa, aşağıdaki sütunlar ek bilgi içerir: - -**latest\_failed\_part** - Mutasyona uğramayan en son bölümün adı. - -**latest\_fail\_time** - En son bölüm mutasyon başarısızlığı zamanı. - -**latest\_fail\_reason** - En son bölüm mutasyon başarısızlığına neden olan istisna mesajı. - -## sistem.diskler {#system_tables-disks} - -İçinde tanımlanan diskler hakkında bilgi içerir [sunucu yapılandırması](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Sütun: - -- `name` ([Dize](../sql_reference/data_types/string.md)) — Name of a disk in the server configuration. -- `path` ([Dize](../sql_reference/data_types/string.md)) — Path to the mount point in the file system. -- `free_space` ([Uİnt64](../sql_reference/data_types/int_uint.md)) — Free space on disk in bytes. -- `total_space` ([Uİnt64](../sql_reference/data_types/int_uint.md)) — Disk volume in bytes. -- `keep_free_space` ([Uİnt64](../sql_reference/data_types/int_uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` disk yapılandırması parametresi. - -## sistem.storage\_policies {#system_tables-storage_policies} - -Depolama ilkeleri ve birimlerinde tanımlanan bilgiler içerir. [sunucu yapılandırması](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -Sütun: - -- `policy_name` ([Dize](../sql_reference/data_types/string.md)) — Name of the storage policy. -- `volume_name` ([Dize](../sql_reference/data_types/string.md)) — Volume name defined in the storage policy. -- `volume_priority` ([Uİnt64](../sql_reference/data_types/int_uint.md)) — Volume order number in the configuration. -- `disks` ([Ar Arrayray (String)](../sql_reference/data_types/array.md)) — Disk names, defined in the storage policy. -- `max_data_part_size` ([Uİnt64](../sql_reference/data_types/int_uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). -- `move_factor` ([Float64](../sql_reference/data_types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. - -Depolama ilkesi birden fazla birim içeriyorsa, her birim için bilgiler tablonun tek tek satırında saklanır. - -[Orijinal makale](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/tr/operations/tips.md b/docs/tr/operations/tips.md index e6b02a239c5..34d1efd44e5 100644 --- a/docs/tr/operations/tips.md +++ b/docs/tr/operations/tips.md @@ -17,14 +17,14 @@ $ echo 'performance' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_gov ## CPU sınırlamaları {#cpu-limitations} -İşlemciler aşırı ısınabilir. Kullanmak `dmesg` aşırı ısınma nedeniyle CPU'nun saat hızının sınırlı olup olmadığını görmek için. +İşlemciler aşırı ısınabilir. Kullanmak `dmesg` aşırı ısınma nedeniyle CPU’nun saat hızının sınırlı olup olmadığını görmek için. Kısıtlama, veri merkezi düzeyinde harici olarak da ayarlanabilir. Kullanabilirsiniz `turbostat` bir yük altında izlemek için. ## RAM {#ram} -Küçük miktarlarda veri için (~200 GB'a kadar sıkıştırılmış), veri hacmi kadar bellek kullanmak en iyisidir. +Küçük miktarlarda veri için (~200 GB’a kadar sıkıştırılmış), veri hacmi kadar bellek kullanmak en iyisidir. Büyük miktarda veri için ve etkileşimli (çevrimiçi) sorguları işlerken, sıcak veri alt kümesi sayfaların önbelleğine sığacak şekilde makul miktarda RAM (128 GB veya daha fazla) kullanmalısınız. -Sunucu başına ~50 TB veri hacimleri için bile, 128 GB RAM kullanmak, 64 GB'ye kıyasla sorgu performansını önemli ölçüde artırır. +Sunucu başına ~50 TB veri hacimleri için bile, 128 GB RAM kullanmak, 64 GB’ye kıyasla sorgu performansını önemli ölçüde artırır. Overcommit devre dışı bırakmayın. Değer `cat /proc/sys/vm/overcommit_memory` 0 veya 1 olmalıdır. Koşmak @@ -46,19 +46,19 @@ Kalıcı büyük sayfaların da tahsis edilmesine gerek yoktur. ## Depolama Alt Sistemi {#storage-subsystem} Bütçeniz SSD kullanmanıza izin veriyorsa, SSD kullanın. -Eğer değilse, sabit disk kullanın. SATA HDD'ler 7200 RPM yapacak. +Eğer değilse, sabit disk kullanın. SATA HDD’ler 7200 RPM yapacak. Bağlı disk raflarına sahip daha az sayıda sunucu üzerinde yerel sabit disklere sahip birçok sunucuyu tercih edin. Ancak nadir sorguları olan arşivleri saklamak için raflar çalışacaktır. ## RAID {#raid} -HDD kullanırken, RAID-10, RAID-5, RAID-6 veya RAID-50'yi birleştirebilirsiniz. -Linux için, yazılım RAID daha iyidir (ile `mdadm`). LVM'Yİ kullanmanızı önermiyoruz. +HDD kullanırken, RAID-10, RAID-5, RAID-6 veya RAID-50’yi birleştirebilirsiniz. +Linux için, yazılım RAID daha iyidir (ile `mdadm`). LVM’Yİ kullanmanızı önermiyoruz. RAID-10 oluştururken, `far` düzen. -Bütçeniz izin veriyorsa, RAID-10'u seçin. +Bütçeniz izin veriyorsa, RAID-10’u seçin. -4'ten fazla diskiniz varsa, RAID-5 yerine RAID-6 (tercih edilen) veya RAID-50 kullanın. +4’ten fazla diskiniz varsa, RAID-5 yerine RAID-6 (tercih edilen) veya RAID-50 kullanın. RAID-5, RAID-6 veya RAID-50 kullanırken, varsayılan değer genellikle en iyi seçenek olmadığından daima stripe\_cache\_size değerini artırın. ``` bash @@ -70,10 +70,10 @@ Formülü kullanarak cihaz sayısından ve blok boyutundan tam sayıyı hesaplay Tüm RAID yapılandırmaları için 1024 KB blok boyutu yeterlidir. Blok boyutunu asla çok küçük veya çok büyük ayarlamayın. -SSD'DE RAID-0 kullanabilirsiniz. +SSD’DE RAID-0 kullanabilirsiniz. RAID kullanımı ne olursa olsun, her zaman veri güvenliği için çoğaltma kullanın. -Uzun bir kuyruk ile NCQ etkinleştirin. HDD için CFQ zamanlayıcısını seçin ve SSD için noop'u seçin. Azalt themayın ‘readahead’ ayar. +Uzun bir kuyruk ile NCQ etkinleştirin. HDD için CFQ zamanlayıcısını seçin ve SSD için noop’u seçin. Azalt themayın ‘readahead’ ayar. HDD için yazma önbelleğini etkinleştirin. ## Dosya Sistemi {#file-system} @@ -97,7 +97,7 @@ Mümkünse en az 10 GB ağ kullanın. 1 Gb de çalışacak, ancak onlarca teraba Muhtemelen zaten başka amaçlar için ZooKeeper kullanıyor. Zaten aşırı değilse, aynı ZooKeeper kurulumunu kullanabilirsiniz. -It's best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. +It’s best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. Sonuç sıralı düğümler için yanlış olacağından, farklı ZooKeeper kümeleri arasında veri aktarmak için el ile yazılmış komut dosyalarını asla kullanmamalısınız. Asla kullanmayın “zkcopy” aynı nedenle yardımcı program: https://github.com/ksprojects/zkcopy/issues/15 @@ -111,7 +111,7 @@ Varsayılan ayarlarla, ZooKeeper bir saatli bomba: Bu bomba etkisiz hale getirilmeli. -Aşağıdaki ZooKeeper (3.5.1) yapılandırması Yandex'te kullanılmaktadır.20 Mayıs 2017 tarihi itibariyle Metrica üretim ortamı: +Aşağıdaki ZooKeeper (3.5.1) yapılandırması Yandex’te kullanılmaktadır.20 Mayıs 2017 tarihi itibariyle Metrica üretim ortamı: hayvanat bahçesi.cfg: diff --git a/docs/tr/operations/troubleshooting.md b/docs/tr/operations/troubleshooting.md index f16a59767d6..0c998e727ef 100644 --- a/docs/tr/operations/troubleshooting.md +++ b/docs/tr/operations/troubleshooting.md @@ -14,10 +14,10 @@ toc_title: "Ar\u0131za" ## Kurulum {#troubleshooting-installation-errors} -### Apt-get ile ClickHouse deposundan Deb paketleri alınamıyor {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} +### Apt-get Ile ClickHouse Deposundan Deb Paketleri alınamıyor {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} - Güvenlik Duvarı ayarlarını kontrol edin. -- Depoya herhangi bir nedenle erişemiyorsanız, paketleri aşağıda açıklandığı gibi indirin [Başlarken](../getting_started/index.md) makale ve bunları kullanarak manuel olarak yükleyin `sudo dpkg -i ` komut. Ayrıca ihtiyacınız olacak `tzdata` paket. +- Depoya herhangi bir nedenle erişemiyorsanız, paketleri aşağıda açıklandığı gibi indirin [Başlarken](../getting-started/index.md) makale ve bunları kullanarak manuel olarak yükleyin `sudo dpkg -i ` komut. Ayrıca ihtiyacınız olacak `tzdata` paket. ## Sunucuya bağlanma {#troubleshooting-accepts-no-connections} @@ -87,7 +87,7 @@ Eğer herhangi bir yararlı bilgi bulamazsanız `clickhouse-server` günlükler $ sudo journalctl -u clickhouse-server ``` -**Clickhouse-Server'ı etkileşimli modda Başlat** +**Clickhouse-Server’ı etkileşimli modda Başlat** ``` bash $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-server/config.xml @@ -101,11 +101,11 @@ Kontrol: - Docker ayarları. - Bir IPv6 ağında Docker'da ClickHouse çalıştırırsanız, `network=host` ayar .lanmıştır. + Bir IPv6 ağında Docker’da ClickHouse çalıştırırsanız, `network=host` ayar .lanmıştır. - Bitiş noktası ayarları. - Kontrol [listen\_host](server_configuration_parameters/settings.md#server_configuration_parameters-listen_host) ve [tcp\_port](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port) ayarlar. + Kontrol [listen\_host](server-configuration-parameters/settings.md#server_configuration_parameters-listen_host) ve [tcp\_port](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port) ayarlar. ClickHouse server, yalnızca varsayılan olarak localhost bağlantılarını kabul eder. @@ -117,8 +117,8 @@ Kontrol: Kontrol: - - Bu [tcp\_port\_secure](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) ayar. - - İçin ayarlar [SSL sertifikaları](server_configuration_parameters/settings.md#server_configuration_parameters-openssl). + - Bu [tcp\_port\_secure](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) ayar. + - İçin ayarlar [SSL sertifikaları](server-configuration-parameters/settings.md#server_configuration_parameters-openssl). Bağlanırken uygun parametreleri kullanın. Örneğin, kullanın `port_secure` parametre ile `clickhouse_client`. @@ -135,12 +135,12 @@ $ curl 'http://localhost:8123/' --data-binary "SELECT a" Code: 47, e.displayText() = DB::Exception: Unknown identifier: a. Note that there are no tables (FROM clause) in your query, context: required_names: 'a' source_tables: table_aliases: private_aliases: column_aliases: public_columns: 'a' masked_columns: array_join_columns: source_columns: , e.what() = DB::Exception ``` -Eğer başlarsanız `clickhouse-client` ile... `stack-trace` parametre, ClickHouse bir hata açıklaması ile sunucu yığın izleme döndürür. +Eğer başlarsanız `clickhouse-client` ile… `stack-trace` parametre, ClickHouse bir hata açıklaması ile sunucu yığın izleme döndürür. Bozuk bir bağlantı hakkında bir mesaj görebilirsiniz. Bu durumda, sorguyu tekrarlayabilirsiniz. Sorguyu her gerçekleştirdiğinizde bağlantı kesilirse, sunucu günlüklerini hatalar için denetleyin. ## Sorgu işleme verimliliği {#troubleshooting-too-slow} -Clickhouse'un çok yavaş çalıştığını görürseniz, sorgularınız için sunucu kaynakları ve ağdaki yükü profillemeniz gerekir. +Clickhouse’un çok yavaş çalıştığını görürseniz, sorgularınız için sunucu kaynakları ve ağdaki yükü profillemeniz gerekir. Profil sorguları için clickhouse-benchmark yardımcı programını kullanabilirsiniz. Saniyede işlenen sorgu sayısını, saniyede işlenen satır sayısını ve sorgu işleme sürelerinin yüzdelerini gösterir. diff --git a/docs/tr/operations/utilities/clickhouse-benchmark.md b/docs/tr/operations/utilities/clickhouse-benchmark.md index 952852d880e..68fcc437aa2 100644 --- a/docs/tr/operations/utilities/clickhouse-benchmark.md +++ b/docs/tr/operations/utilities/clickhouse-benchmark.md @@ -99,7 +99,7 @@ Raporda bulabilirsiniz: - Sorgu yürütme süresi yüzdelik. -## Karşılaştırma modu {#clickhouse-benchmark-comparison-mode} +## Karşılaştırma Modu {#clickhouse-benchmark-comparison-mode} `clickhouse-benchmark` iki çalışan ClickHouse sunucuları için performansları karşılaştırabilirsiniz. diff --git a/docs/tr/operations/utilities/clickhouse-local.md b/docs/tr/operations/utilities/clickhouse-local.md index 5e47459b670..32d70455388 100644 --- a/docs/tr/operations/utilities/clickhouse-local.md +++ b/docs/tr/operations/utilities/clickhouse-local.md @@ -9,7 +9,7 @@ toc_title: clickhouse-yerel Bu `clickhouse-local` program, ClickHouse sunucusunu dağıtmak ve yapılandırmak zorunda kalmadan yerel dosyalar üzerinde hızlı işlem yapmanızı sağlar. -Tabloları temsil eden verileri kabul eder ve bunları kullanarak sorgular [ClickHouse SQL lehçesi](../../sql_reference/index.md). +Tabloları temsil eden verileri kabul eder ve bunları kullanarak sorgular [ClickHouse SQL lehçesi](../../sql-reference/index.md). `clickhouse-local` ClickHouse server ile aynı çekirdeği kullanır, bu nedenle özelliklerin çoğunu ve aynı format ve tablo motorlarını destekler. diff --git a/docs/tr/sql-reference/aggregate-functions/combinators.md b/docs/tr/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..cb31cc65982 --- /dev/null +++ b/docs/tr/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,166 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 37 +toc_title: "Toplama fonksiyonu birle\u015Ftiriciler" +--- + +# Toplama Fonksiyonu Birleştiriciler {#aggregate_functions_combinators} + +Bir toplama işlevinin adı, ona eklenmiş bir sonek olabilir. Bu, toplama işlevinin çalışma şeklini değiştirir. + +## -Eğer {#agg-functions-combinator-if} + +The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). + +Örnekler: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` ve böyle devam eder. + +Koşullu toplama işlevleriyle, alt sorgular kullanmadan aynı anda birkaç koşul için toplamları hesaplayabilirsiniz ve `JOIN`s. Örneğin, Üye olarak.Metrica, koşullu toplama işlevleri segment karşılaştırma işlevselliğini uygulamak için kullanılır. + +## -Dizi {#agg-functions-combinator-array} + +\- Array soneki herhangi bir toplama işlevine eklenebilir. Bu durumda, toplama işlevi, ‘Array(T)’ type (ar arraysra )ys) yerine ‘T’ bağımsız değişkenleri yazın. Toplama işlevi birden çok bağımsız değişken kabul ederse, bu eşit uzunlukta diziler olmalıdır. Dizileri işlerken, toplama işlevi tüm dizi öğelerinde orijinal toplama işlevi gibi çalışır. + +Örnek 1: `sumArray(arr)` - Tüm unsurları toplamları ‘arr’ diziler. Bu örnekte, daha basit yazılmış olabilir: `sum(arraySum(arr))`. + +Örnek 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ diziler. Bu daha kolay bir şekilde yapılabilir: `uniq(arrayJoin(arr))`, ancak eklemek her zaman mümkün değildir ‘arrayJoin’ bir sorguya. + +\- Eğer ve-dizi kombine edilebilir. Ancak, ‘Array’ önce gel mustmeli, sonra ‘If’. Örnekler: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. Nedeniyle bu sipariş için, ‘cond’ argüman bir dizi olmayacak. + +## -Devlet {#agg-functions-combinator-state} + +Bu birleştiriciyi uygularsanız, toplama işlevi elde edilen değeri döndürmez (örneğin, [uniq](reference.md#agg_function-uniq) fonksiyonu), ancak top aggreglamanın bir ara durumu (for `uniq`, bu benzersiz değerlerin sayısını hesaplamak için karma tablodur). Bu bir `AggregateFunction(...)` bu, daha fazla işlem için kullanılabilir veya daha sonra toplanmayı bitirmek için bir tabloda saklanabilir. + +Bu durumlarla çalışmak için şunları kullanın: + +- [AggregatingMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) masa motoru. +- [finalizeAggregation](../../sql-reference/functions/other-functions.md#function-finalizeaggregation) işlev. +- [runningAccumulate](../../sql-reference/functions/other-functions.md#function-runningaccumulate) işlev. +- [-Birleştirmek](#aggregate_functions_combinators_merge) birleştirici. +- [- MergeState](#aggregate_functions_combinators_mergestate) birleştirici. + +## -Birleştirmek {#aggregate_functions_combinators-merge} + +Bu birleştiriciyi uygularsanız, toplama işlevi Ara toplama durumunu bağımsız değişken olarak alır, toplama işlemini tamamlamak için durumları birleştirir ve elde edilen değeri döndürür. + +## - MergeState {#aggregate_functions_combinators-mergestate} + +Ara toplama durumlarını-birleştirme Birleştiricisi ile aynı şekilde birleştirir. Bununla birlikte, elde edilen değeri döndürmez, ancak-State combinator’a benzer bir ara toplama durumu döndürür. + +## - ForEach {#agg-functions-combinator-foreach} + +Tablolar için bir toplama işlevi, karşılık gelen dizi öğelerini toplayan ve bir dizi sonuç döndüren diziler için bir toplama işlevine dönüştürür. Mesela, `sumForEach` diz theiler için `[1, 2]`, `[3, 4, 5]`ve`[6, 7]`sonucu döndürür `[10, 13, 5]` karşılık gelen dizi öğelerini bir araya getirdikten sonra. + +## - OrDefault {#agg-functions-combinator-ordefault} + +Toplamak için hiçbir şey yoksa, toplama işlevinin dönüş türünün Varsayılan değerini doldurur. + +``` sql +SELECT avg(number), avgOrDefault(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrDefault(number)─┐ +│ nan │ 0 │ +└─────────────┴──────────────────────┘ +``` + +## - OrNull {#agg-functions-combinator-ornull} + +Doldurmalar `null` toplamak için hiçbir şey varsa. Dönüş sütun null olur. + +``` sql +SELECT avg(number), avgOrNull(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrNull(number)─┐ +│ nan │ ᴺᵁᴸᴸ │ +└─────────────┴───────────────────┘ +``` + +\- OrDefault ve-OrNull diğer birleştiriciler ile kombine edilebilir. Toplama işlevi boş girişi kabul etmediğinde yararlıdır. + +``` sql +SELECT avgOrNullIf(x, x > 10) +FROM +( + SELECT toDecimal32(1.23, 2) AS x +) +``` + +``` text +┌─avgOrNullIf(x, greater(x, 10))─┐ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────┘ +``` + +## - Resample {#agg-functions-combinator-resample} + +Verileri gruplara ayırmanızı sağlar ve ardından bu gruplardaki verileri ayrı ayrı toplar. Gruplar, değerleri bir sütundan aralıklara bölerek oluşturulur. + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**Parametre** + +- `start` — Starting value of the whole required interval for `resampling_key` değerler. +- `stop` — Ending value of the whole required interval for `resampling_key` değerler. Tüm Aralık içermez `stop` değer `[start, stop)`. +- `step` — Step for separating the whole interval into subintervals. The `aggFunction` bu alt aralıkların her biri üzerinde bağımsız olarak yürütülür. +- `resampling_key` — Column whose values are used for separating data into intervals. +- `aggFunction_params` — `aggFunction` parametre. + +**Döndürülen değerler** + +- Ar arrayray of `aggFunction` her subinterval için sonuçlar. + +**Örnek** + +Düşünün `people` aşağıdaki verilerle tablo: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +Yaş aralığı içinde olan kişilerin isimlerini alalım `[30,60)` ve `[60,75)`. Yaş için tamsayı temsilini kullandığımızdan, yaşları `[30, 59]` ve `[60,74]` aralıklılar. + +Bir dizideki isimleri toplamak için, [groupArray](reference.md#agg_function-grouparray) toplama işlevi. Bir argüman alır. Bizim durumumuzda, bu `name` sütun. Bu `groupArrayResample` fonksiyon kullanmalıdır `age` yaşlara göre isimleri toplamak için sütun. Gerekli aralıkları tanımlamak için `30, 75, 30` argü themanlar içine `groupArrayResample` işlev. + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) FROM people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +Sonuçları düşünün. + +`Jonh` çok genç olduğu için numunenin dışında. Diğer insanlar belirtilen yaş aralıklarına göre dağıtılır. + +Şimdi toplam insan sayısını ve ortalama ücretlerini belirtilen yaş aralıklarında sayalım. + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/tr/sql-reference/aggregate-functions/index.md b/docs/tr/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..312868ff8f3 --- /dev/null +++ b/docs/tr/sql-reference/aggregate-functions/index.md @@ -0,0 +1,62 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "Toplama Fonksiyonlar\u0131" +toc_priority: 33 +toc_title: "Giri\u015F" +--- + +# Toplama fonksiyonları {#aggregate-functions} + +Toplama fonksiyonları [normal](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) veritabanı uzmanları tarafından beklendiği gibi. + +ClickHouse da destekler: + +- [Parametrik agrega fonksiyonları](parametric-functions.md#aggregate_functions_parametric), sütunlara ek olarak diğer parametreleri kabul eder. +- [Birleştiriciler](combinators.md#aggregate_functions_combinators) toplama işlevlerinin davranışını değiştiren. + +## NULL işleme {#null-processing} + +Toplama sırasında, tüm `NULL`s atlanır. + +**Örnekler:** + +Bu tabloyu düşünün: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +Diyelim ki değerleri toplamanız gerekiyor `y` sütun: + +``` sql +SELECT sum(y) FROM t_null_big +``` + + ┌─sum(y)─┐ + │ 7 │ + └────────┘ + +Bu `sum` fonksiyon yorumlar `NULL` olarak `0`. Özellikle, bu, işlevin tüm değerlerin bulunduğu bir seçimin girişini aldığı anlamına gelir `NULL`, sonra sonuç olacak `0`, değil `NULL`. + +Şimdi kullanabilirsiniz `groupArray` bir dizi oluşturmak için işlev `y` sütun: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` içermez `NULL` elde edilen dizi. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/tr/sql-reference/aggregate-functions/parametric-functions.md b/docs/tr/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..f356c013519 --- /dev/null +++ b/docs/tr/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,499 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 38 +toc_title: "Parametrik agrega fonksiyonlar\u0131" +--- + +# Parametrik Agrega Fonksiyonları {#aggregate_functions_parametric} + +Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. + +## çubuk {#histogram} + +Uyarlanabilir bir histogram hesaplar. Kesin sonuçları garanti etmez. + +``` sql +histogram(number_of_bins)(values) +``` + +İşlevleri kullanır [Bir Akış Paralel Karar Ağacı Algoritması](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Histogram kutularının sınırları, yeni veriler bir işleve girdiğinde ayarlanır. Ortak durumda, kutu genişlikleri eşit değildir. + +**Parametre** + +`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. +`values` — [İfade](../syntax.md#syntax-expressions) giriş değerleri ile sonuçlanır. + +**Döndürülen değerler** + +- [Dizi](../../sql-reference/data-types/array.md) -den [Demetler](../../sql-reference/data-types/tuple.md) aşağıdaki format oftan: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — Lower bound of the bin. + - `upper` — Upper bound of the bin. + - `height` — Calculated height of the bin. + +**Örnek** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +Bir histogram ile görselleştirebilirsiniz [bar](../../sql-reference/functions/other-functions.md#function-bar) fonksiyon, örneğin: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +Bu durumda, histogram kutusu kenarlıklarını bilmediğinizi unutmamalısınız. + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +Dizinin desenle eşleşen bir olay zinciri içerip içermediğini denetler. + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "Uyarıcı" + Aynı saniyede meydana gelen olaylar sonucu etkileyen tanımsız bir sırada sırayla yatıyordu. + +**Parametre** + +- `pattern` — Pattern string. See [Desen sözdizimi](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` ve `DateTime`. Ayrıca desteklenen herhangi birini kullanabilirsiniz [Uİnt](../../sql-reference/data-types/int-uint.md) veri türleri. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. En fazla 32 koşul argümanını iletebilirsiniz. İşlev yalnızca bu koşullarda açıklanan olayları dikkate alır. Sıra, bir koşulda açıklanmayan veriler içeriyorsa, işlev bunları atlar. + +**Döndürülen değerler** + +- 1, Eğer desen eşleşti. +- Desen eşleşmezse 0. + +Tür: `UInt8`. + + +**Desen sözdizimi** + +- `(?N)` — Matches the condition argument at position `N`. Şartlar numaralandırılmıştır `[1, 32]` Aralık. Mesela, `(?1)` argü theman thela eşleş their `cond1` parametre. + +- `.*` — Matches any number of events. You don’t need conditional arguments to match this element of the pattern. + +- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` birbirinden 1800 saniyeden fazla meydana gelen olayları eşleşir. Bu olaylar arasında herhangi bir olayın keyfi bir sayısı olabilir. Kullanabilirsiniz `>=`, `>`, `<`, `<=` operatörler. + +**Örnekler** + +Verileri göz önünde bulundurun `t` Tablo: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +Sorguyu gerçekleştir: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +İşlev, 2 numarasının 1 numarayı takip ettiği olay zincirini buldu. Sayı bir olay olarak tanımlanmadığı için aralarında 3 sayısını atladı. Örnekte verilen olay zincirini ararken bu numarayı dikkate almak istiyorsak, bunun için bir koşul oluşturmalıyız. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +Bu durumda, işlev desenle eşleşen olay zincirini bulamadı, çünkü 3 numaralı olay 1 ile 2 arasında gerçekleşti. Aynı durumda 4 numaralı koşulu kontrol edersek, sıra desenle eşleşir. + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [sequenceCount](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +Desenle eşleşen olay zincirlerinin sayısını sayar. İşlev, çakışmayan olay zincirlerini arar. Geçerli zincir eşleştirildikten sonra bir sonraki zinciri aramaya başlar. + +!!! warning "Uyarıcı" + Aynı saniyede meydana gelen olaylar sonucu etkileyen tanımsız bir sırada sırayla yatıyordu. + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**Parametre** + +- `pattern` — Pattern string. See [Desen sözdizimi](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` ve `DateTime`. Ayrıca desteklenen herhangi birini kullanabilirsiniz [Uİnt](../../sql-reference/data-types/int-uint.md) veri türleri. + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. En fazla 32 koşul argümanını iletebilirsiniz. İşlev yalnızca bu koşullarda açıklanan olayları dikkate alır. Sıra, bir koşulda açıklanmayan veriler içeriyorsa, işlev bunları atlar. + +**Döndürülen değerler** + +- Eşleşen çakışmayan olay zincirlerinin sayısı. + +Tür: `UInt64`. + +**Örnek** + +Verileri göz önünde bulundurun `t` Tablo: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +2 numara aralarında diğer sayıların herhangi bir miktarda 1 numaradan sonra meydana kaç kez Sayın: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [sequenceMatch](#function-sequencematch) + +## windowFunnel {#windowfunnel} + +Kayan bir zaman penceresinde olay zincirlerini arar ve zincirden meydana gelen en fazla olay sayısını hesaplar. + +Fonksiyon algoritmaya göre çalışır: + +- İşlev, zincirdeki ilk koşulu tetikleyen ve olay sayacını 1’e ayarlayan verileri arar. Sürgülü pencerenin başladığı an budur. + +- Zincirdeki olaylar pencerede sırayla gerçekleşirse, sayaç artırılır. Olayların sırası bozulursa, sayaç artırılmaz. + +- Verilerin çeşitli tamamlanma noktalarında birden çok olay zinciri varsa, işlev yalnızca en uzun zincirin boyutunu çıkarır. + +**Sözdizimi** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**Parametre** + +- `window` — Length of the sliding window in seconds. +- `mode` - Bu isteğe bağlı bir argüman. + - `'strict'` - Zaman `'strict'` ayarlanırsa, windowFunnel () yalnızca benzersiz değerler için koşullar uygular. +- `timestamp` — Name of the column containing the timestamp. Data types supported: [Tarihli](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) ve diğer imzasız tamsayı türleri (timestamp’ın `UInt64` yazın, değeri 2^63 - 1 olan Int64 maksimum değerini aşamaz). +- `cond` — Conditions or data describing the chain of events. [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değer** + +Sürgülü zaman penceresi içindeki zincirden ardışık tetiklenen koşulların maksimum sayısı. +Seçimdeki tüm zincirler analiz edilir. + +Tür: `Integer`. + +**Örnek** + +Kullanıcının bir telefon seçmesi ve çevrimiçi mağazada iki kez satın alması için belirli bir süre yeterli olup olmadığını belirleyin. + +Aşağıdaki olaylar zincirini ayarlayın: + +1. Mağaz theadaki Hesabına giriş yapan kullanıcı (`eventID = 1003`). +2. Kullanıcı bir telefon arar (`eventID = 1007, product = 'phone'`). +3. Kullanıcı sipariş verdi (`eventID = 1009`). +4. Kullanıcı tekrar sipariş yaptı (`eventID = 1010`). + +Giriş tablosu: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +Kullanıcının ne kadar uzakta olduğunu öğrenin `user_id` 2019 yılının Ocak-Şubat aylarında bir dönemde zincirden geçebilir. + +Sorgu: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +Sonuç: + +``` text +┌─level─┬─c─┐ +│ 4 │ 1 │ +└───────┴───┘ +``` + +## saklama {#retention} + +İşlev, bağımsız değişken olarak 1’den 32’ye kadar bir dizi koşul türünü alır `UInt8` bu, etkinlik için belirli bir koşulun karşılanıp karşılanmadığını gösterir. +Herhangi bir koşul bir argüman olarak belirtilebilir (aşağıdaki gibi [WHERE](../../sql-reference/statements/select.md#select-where)). + +İlk hariç, koşullar çiftler halinde geçerlidir: birinci ve ikinci doğruysa, ikincinin sonucu, birinci ve fird doğruysa, üçüncüsü doğru olacaktır. + +**Sözdizimi** + +``` sql +retention(cond1, cond2, ..., cond32); +``` + +**Parametre** + +- `cond` — an expression that returns a `UInt8` sonuç (1 veya 0). + +**Döndürülen değer** + +1 veya 0 dizisi. + +- 1 — condition was met for the event. +- 0 — condition wasn’t met for the event. + +Tür: `UInt8`. + +**Örnek** + +Hesaplamanın bir örneğini düşünelim `retention` site trafiğini belirlemek için işlev. + +**1.** Сreate a table to illustrate an example. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +Giriş tablosu: + +Sorgu: + +``` sql +SELECT * FROM retention_test +``` + +Sonuç: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** Kullanıcıları benzersiz kimliğe göre grupla `uid` kullanarak `retention` işlev. + +Sorgu: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +Sonuç: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** Günde toplam site ziyaret sayısını hesaplayın. + +Sorgu: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +Sonuç: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +Nerede: + +- `r1`- 2020-01-01 sırasında siteyi ziyaret eden tekil ziyaretçi sayısı ( `cond1` koşul). +- `r2`- 2020-01-01 ve 2020-01-02 arasında belirli bir süre boyunca siteyi ziyaret eden tekil ziyaretçi sayısı (`cond1` ve `cond2` şartlar). +- `r3`- 2020-01-01 ve 2020-01-03 arasında belirli bir süre boyunca siteyi ziyaret eden tekil ziyaretçi sayısı (`cond1` ve `cond3` şartlar). + +## uniqUpTo(N) (x) {#uniquptonx} + +Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. + +Küçük Ns ile kullanım için tavsiye, kadar 10. N’nin maksimum değeri 100’dür. + +Bir toplama işlevinin durumu için, 1 + n \* bir bayt değerinin boyutuna eşit bellek miktarını kullanır. +Dizeler için, 8 baytlık kriptografik olmayan bir karma saklar. Yani, hesaplama dizeler için yaklaşık olarak hesaplanır. + +İşlev ayrıca birkaç argüman için de çalışır. + +Büyük bir N değeri kullanıldığında ve benzersiz değerlerin sayısı n’den biraz daha az olduğu durumlar dışında mümkün olduğunca hızlı çalışır. + +Kullanım örneği: + +``` text +Problem: Generate a report that shows only keywords that produced at least 5 unique users. +Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) + +## sumMapFiltered (keys\_to\_keep) (anahtarlar, değerler) {#summapfilteredkeys-to-keepkeys-values} + +Aynı davranış [sumMap](reference.md#agg_functions-summap) dışında bir dizi anahtar parametre olarak geçirilir. Bu, özellikle yüksek bir Anahtarlık ile çalışırken yararlı olabilir. diff --git a/docs/tr/sql-reference/aggregate-functions/reference.md b/docs/tr/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..7b8e83224e6 --- /dev/null +++ b/docs/tr/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1878 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 36 +toc_title: "Ba\u015Fvurma" +--- + +# Fonksiyon Referans {#function-reference} + +## sayma {#agg_function-count} + +Satır veya NOT-NULL değerleri sayar. + +ClickHouse için aşağıdaki sözdizimleri destekler `count`: +- `count(expr)` veya `COUNT(DISTINCT expr)`. +- `count()` veya `COUNT(*)`. Bu `count()` sözdizimi ClickHouse özeldir. + +**Parametre** + +Fonksiyon alabilir: + +- Sıfır parametreler. +- Bir [ifade](../syntax.md#syntax-expressions). + +**Döndürülen değer** + +- Fonksiyon parametreleri olmadan çağrılırsa, satır sayısını sayar. +- Eğer… [ifade](../syntax.md#syntax-expressions) geçirilir, daha sonra işlev bu ifadenin kaç kez NOT null döndürdüğünü sayar. İfad aede bir [Nullable](../../sql-reference/data-types/nullable.md)- type değeri, sonra sonucu `count` kalır değil `Nullable`. İfade döndürülürse işlev 0 döndürür `NULL` tüm satırlar için. + +Her iki durumda da döndürülen değerin türü [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Ayrıntı** + +ClickHouse destekler `COUNT(DISTINCT ...)` sözdizimi. Bu yapının davranışı Aşağıdakilere bağlıdır [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) ayar. Aşağıdakilerden hang theisini tanımlar [uniq\*](#agg_function-uniq) fonksiyonlar işlemi gerçekleştirmek için kullanılır. Varsayılan değer [uniqExact](#agg_function-uniqexact) işlev. + +Bu `SELECT count() FROM table` tablodaki girdi sayısı ayrı olarak depolanmadığı için sorgu en iyi duruma getirilmez. Tablodan küçük bir sütun seçer ve içindeki değerlerin sayısını sayar. + +**Örnekler** + +Örnek 1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +Örnek 2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +Bu örnek gösteriyor ki `count(DISTINCT num)` tarafından gerçekleştirilir `uniqExact` fonksiyonu göre `count_distinct_implementation` ayar değeri. + +## herhangi(x) {#agg_function-any} + +İlk karşılaşılan değeri seçer. +Sorgu herhangi bir sırada ve hatta her seferinde farklı bir sırada çalıştırılabilir, bu nedenle bu işlevin sonucu belirsizdir. +Belirli bir sonuç elde etmek için ‘min’ veya ‘max’ fonksiyon yerine ‘any’. + +Bazı durumlarda, yürütme sırasına güvenebilirsiniz. Bu, select ORDER BY kullanan bir alt sorgudan geldiğinde durumlar için geçerlidir. + +Ne zaman bir `SELECT` sorgu vardır `GROUP BY` yan tümce veya en az bir toplama işlevi, ClickHouse (Mysql’in aksine), tüm ifadelerin `SELECT`, `HAVING`, ve `ORDER BY` anahtar functionslardan veya toplama işlev .lerinden hesaplan .malıdır. Başka bir deyişle, tablodan seçilen her sütun, anahtarlarda veya toplama işlevlerinde kullanılmalıdır. Mysql’de olduğu gibi davranış elde etmek için, diğer sütunları `any` toplama işlevi. + +## anyHeavy (x) {#anyheavyx} + +Kullanarak sık oluşan bir değer seçer [ağır vurucular](http://www.cs.umd.edu/~samir/498/karp.pdf) algoritma. Sorgunun yürütme iş parçacığı her durumda yarısından fazlasını oluşan bir değer varsa, bu değer döndürülür. Normalde, sonuç belirsizdir. + +``` sql +anyHeavy(column) +``` + +**Değişkenler** + +- `column` – The column name. + +**Örnek** + +Tak thee the [OnTime](../../getting-started/example-datasets/ontime.md) veri kümesi ve herhangi bir sık oluşan değeri seçin `AirlineID` sütun. + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## anyLast(x) {#anylastx} + +Karşılaşılan son değeri seçer. +Sonuç için olduğu kadar belirsiz `any` işlev. + +## groupBitAnd {#groupbitand} + +Bitwise uygular `AND` sayı serisi için. + +``` sql +groupBitAnd(expr) +``` + +**Parametre** + +`expr` – An expression that results in `UInt*` tür. + +**Dönüş değeri** + +Bu değer `UInt*` tür. + +**Örnek** + +Test verileri: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Sorgu: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +Nerede `num` test verileri ile sütundur. + +Sonuç: + +``` text +binary decimal +00000100 = 4 +``` + +## groupBitOr {#groupbitor} + +Bitwise uygular `OR` sayı serisi için. + +``` sql +groupBitOr(expr) +``` + +**Parametre** + +`expr` – An expression that results in `UInt*` tür. + +**Dönüş değeri** + +Bu değer `UInt*` tür. + +**Örnek** + +Test verileri: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Sorgu: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +Nerede `num` test verileri ile sütundur. + +Sonuç: + +``` text +binary decimal +01111101 = 125 +``` + +## groupBitXor {#groupbitxor} + +Bitwise uygular `XOR` sayı serisi için. + +``` sql +groupBitXor(expr) +``` + +**Parametre** + +`expr` – An expression that results in `UInt*` tür. + +**Dönüş değeri** + +Bu değer `UInt*` tür. + +**Örnek** + +Test verileri: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +Sorgu: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +Nerede `num` test verileri ile sütundur. + +Sonuç: + +``` text +binary decimal +01101000 = 104 +``` + +## groupBitmap {#groupbitmap} + +İşaretsiz tamsayı sütun, Uınt64 tür iade önem, gelen bit eşlem veya Toplama hesaplamaları suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmap(expr) +``` + +**Parametre** + +`expr` – An expression that results in `UInt*` tür. + +**Dönüş değeri** + +Bu değer `UInt64` tür. + +**Örnek** + +Test verileri: + +``` text +UserID +1 +1 +2 +3 +``` + +Sorgu: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +Sonuç: + +``` text +num +3 +``` + +## min (x) {#agg_function-min} + +Minimum hesaplar. + +## max (x) {#agg_function-max} + +Maksimum hesaplar. + +## argMin (arg, val) {#agg-function-argmin} + +Hesaplar ‘arg’ minimum değer ‘val’ değer. Birkaç farklı değer varsa ‘arg’ minimum değerler için ‘val’, karşılaşılan bu değerlerin ilki çıktıdır. + +**Örnek:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## argMax (arg, val) {#agg-function-argmax} + +Hesaplar ‘arg’ maksimum değer ‘val’ değer. Birkaç farklı değer varsa ‘arg’ maksimum değerler için ‘val’, karşılaşılan bu değerlerin ilki çıktıdır. + +## s (um (x) {#agg_function-sum} + +Toplamı hesaplar. +Sadece sayılar için çalışır. + +## sumWithOverflow(x) {#sumwithoverflowx} + +Giriş parametreleri için olduğu gibi sonuç için aynı veri türünü kullanarak sayıların toplamını hesaplar. Toplam bu veri türü için en büyük değeri aşarsa, işlev bir hata döndürür. + +Sadece sayılar için çalışır. + +## sumMap (anahtar, değer) {#agg_functions-summap} + +Toplam thelar ‘value’ belirtilen tuş accordinglara göre dizi ‘key’ dizi. +Eleman sayısı ‘key’ ve ‘value’ toplam her satır için aynı olmalıdır. +Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. + +Örnek: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┘ +``` + +## skewPop {#skewpop} + +Hesaplar [çarpıklık](https://en.wikipedia.org/wiki/Skewness) bir sıra. + +``` sql +skewPop(expr) +``` + +**Parametre** + +`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. + +**Döndürülen değer** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Örnek** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## skewSamp {#skewsamp} + +Hesaplar [örnek çarpıklık](https://en.wikipedia.org/wiki/Skewness) bir sıra. + +Bir rassal değişkenin çarpıklığının tarafsız bir tahminini temsil eder. + +``` sql +skewSamp(expr) +``` + +**Parametre** + +`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. + +**Döndürülen değer** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). Eğer `n <= 1` (`n` örnek boyutudur), daha sonra işlev döner `nan`. + +**Örnek** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## kurtPop {#kurtpop} + +Hesaplar [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) bir sıra. + +``` sql +kurtPop(expr) +``` + +**Parametre** + +`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. + +**Döndürülen değer** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**Örnek** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## kurtSamp {#kurtsamp} + +Hesaplar [örnek kurtoz](https://en.wikipedia.org/wiki/Kurtosis) bir sıra. + +Eğer geçen değerleri örnek oluşturur, eğer bir rassal değişken kurtosis tarafsız bir tahmini temsil eder. + +``` sql +kurtSamp(expr) +``` + +**Parametre** + +`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. + +**Döndürülen değer** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). Eğer `n <= 1` (`n` örnek bir boyutudur), daha sonra işlev döner `nan`. + +**Örnek** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## timeSeriesGroupSum(uıd, zaman damgası, değer) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` örnek zaman damgası değil hizalama farklı zaman serileri toplayabilir. +İki örnek zaman damgası arasında doğrusal enterpolasyon kullanacak ve daha sonra zaman serilerini birlikte toplayacaktır. + +- `uid` zaman serisi benzersiz kimliği mi, `UInt64`. +- `timestamp` milisaniye veya mikrosaniye desteklemek için Int64 türüdür. +- `value` metr .iktir. + +İşlev, tuples dizisini döndürür `(timestamp, aggregated_value)` çiftliler. + +Bu işlevi kullanmadan önce emin olun `timestamp` artan düzende. + +Örnek: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +Ve sonuç olacak: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## timeSeriesGroupRateSum(uıd, ts, val) {#agg-function-timeseriesgroupratesum} + +Benzer şekilde timeSeriesGroupRateSum, timeSeriesGroupRateSum zaman serisi ve daha sonra toplam oranları birlikte oranını hesaplar. +Ayrıca, bu işlevi kullanmadan önce zaman damgası yükseliş sırasına göre olmalıdır. + +Bu işlevi kullanın, yukarıdaki sonuç olacaktır: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## avg (x) {#agg_function-avg} + +Ortalama hesaplar. +Sadece sayılar için çalışır. +Sonuç Her zaman Float64. + +## avgWeighted {#avgweighted} + +Hesaplar [ağırlıklı aritmetik ortalama](https://en.wikipedia.org/wiki/Weighted_arithmetic_mean). + +**Sözdizimi** + +``` sql +avgWeighted(x, weight) +``` + +**Parametre** + +- `x` — Values. [Tamsayı](../data-types/int-uint.md) veya [kayan nokta](../data-types/float.md). +- `weight` — Weights of the values. [Tamsayı](../data-types/int-uint.md) veya [kayan nokta](../data-types/float.md). + +Türü `x` ve `weight` aynı olmalıdır. + +**Döndürülen değer** + +- Ağırlıklı ortalama. +- `NaN`. Tüm ağırlıklar 0’a eşitse. + +Tür: [Float64](../data-types/float.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT avgWeighted(x, w) +FROM values('x Int8, w Int8', (4, 1), (1, 0), (10, 2)) +``` + +Sonuç: + +``` text +┌─avgWeighted(x, weight)─┐ +│ 8 │ +└────────────────────────┘ +``` + +## uniq {#agg_function-uniq} + +Bağımsız değişken farklı değerlerin yaklaşık sayısını hesaplar. + +``` sql +uniq(x[, ...]) +``` + +**Parametre** + +Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. + +**Döndürülen değer** + +- A [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip numarası. + +**Uygulama Detayları** + +İşlev: + +- Toplamdaki tüm parametreler için bir karma hesaplar, daha sonra hesaplamalarda kullanır. + +- Bir adaptif örnekleme algoritması kullanır. Hesaplama durumu için işlev, 65536’ya kadar öğe karma değerlerinin bir örneğini kullanır. + + This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. + +- Sonucu deterministically sağlar (sorgu işleme sırasına bağlı değildir). + +Bu işlevi hemen hemen tüm senaryolarda kullanmanızı öneririz. + +**Ayrıca Bakınız** + +- [uniqCombined](#agg_function-uniqcombined) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined {#agg_function-uniqcombined} + +Farklı bağımsız değişken değerlerinin yaklaşık sayısını hesaplar. + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +Bu `uniqCombined` fonksiyon, farklı değerlerin sayısını hesaplamak için iyi bir seçimdir. + +**Parametre** + +Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. + +`HLL_precision` hücre sayısının baz-2 logaritmasıdır. [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). İsteğe bağlı olarak işlevi kullanabilirsiniz `uniqCombined(x[, ...])`. İçin varsayılan değer `HLL_precision` etkin bir şekilde 96 KiB alan olan 17’dir (2^17 hücre, her biri 6 bit). + +**Döndürülen değer** + +- Numara [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip numarası. + +**Uygulama Detayları** + +İşlev: + +- Bir karma hesaplar (64-bit karma için `String` ve 32-bit aksi halde) agregadaki tüm parametreler için, hesaplamalarda kullanır. + +- Bir hata düzeltme tablosu ile dizi, karma tablo ve HyperLogLog: üç algoritmaları bir arada kullanır. + + For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. + +- Sonucu deterministically sağlar (sorgu işleme sırasına bağlı değildir). + +!!! note "Not" + Olmayan için 32-bit karma kullandığından-`String` tipi, sonuç cardinalities önemli ölçüde daha büyük için çok yüksek hata olacak `UINT_MAX` (birkaç on milyarlarca farklı değerden sonra hata hızla artacaktır), bu durumda kullanmanız gerekir [uniqCombined64](#agg_function-uniqcombined64) + +İle karşılaştırıldığında [uniq](#agg_function-uniq) fonksiyonu, `uniqCombined`: + +- Birkaç kez daha az bellek tüketir. +- Birkaç kat daha yüksek doğrulukla hesaplar. +- Genellikle biraz daha düşük performansa sahiptir. Bazı senaryolarda, `uniqCombined` daha iyi performans gösterebilir `uniq` örneğin, ağ üzerinden çok sayıda toplama durumu ileten dağıtılmış sorgularla. + +**Ayrıca Bakınız** + +- [uniq](#agg_function-uniq) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined64 {#agg_function-uniqcombined64} + +Aynı olarak [uniqCombined](#agg_function-uniqcombined), ancak tüm veri türleri için 64 bit karma kullanır. + +## uniqHLL12 {#agg_function-uniqhll12} + +Farklı argüman değerlerinin yaklaşık sayısını hesaplar [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) algoritma. + +``` sql +uniqHLL12(x[, ...]) +``` + +**Parametre** + +Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. + +**Döndürülen değer** + +- A [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip numarası. + +**Uygulama Detayları** + +İşlev: + +- Toplamdaki tüm parametreler için bir karma hesaplar, daha sonra hesaplamalarda kullanır. + +- Farklı bağımsız değişken değerlerinin sayısını yaklaştırmak için HyperLogLog algoritmasını kullanır. + + 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). + +- Belirli sonucu sağlar (sorgu işleme sırasına bağlı değildir). + +Bu işlevi kullanmanızı önermiyoruz. Çoğu durumda, kullan [uniq](#agg_function-uniq) veya [uniqCombined](#agg_function-uniqcombined) işlev. + +**Ayrıca Bakınız** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqExact](#agg_function-uniqexact) + +## uniqExact {#agg_function-uniqexact} + +Farklı bağımsız değişken değerlerinin tam sayısını hesaplar. + +``` sql +uniqExact(x[, ...]) +``` + +Kullan… `uniqExact` kesinlikle kesin bir sonuca ihtiyacınız varsa işlev. Aksi takdirde kullanın [uniq](#agg_function-uniq) işlev. + +Bu `uniqExact` fonksiyonu daha fazla bellek kullanır `uniq`, çünkü farklı değerlerin sayısı arttıkça devletin büyüklüğü sınırsız büyümeye sahiptir. + +**Parametre** + +Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. + +**Ayrıca Bakınız** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqHLL12](#agg_function-uniqhll12) + +## groupArray (x), groupArray (max\_size)(x) {#agg_function-grouparray} + +Bağımsız değişken değerleri dizisi oluşturur. +Değerler diziye herhangi bir (belirsiz) sırayla eklenebilir. + +İkinci versiyonu (ile `max_size` parametre), elde edilen dizinin boyutunu sınırlar `max_size` öğeler. +Mesela, `groupArray (1) (x)` eşdeğ toer equivalentdir `[any (x)]`. + +Bazı durumlarda, hala yürütme sırasına güvenebilirsiniz. Bu, aşağıdaki durumlar için geçerlidir `SELECT` kullanan bir alt sorgudan gelir `ORDER BY`. + +## grouparrayınsertat (değer, konum) {#grouparrayinsertatvalue-position} + +Belirtilen konumda diziye bir değer ekler. + +!!! note "Not" + Bu işlev, SQL dizileri için geleneksel tek tabanlı konumların aksine sıfır tabanlı konumlar kullanır. + +Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. + +İsteğe bağlı parametreler: + +- Boş pozisyonlarda ikame için varsayılan değer. +- Elde edilen dizinin uzunluğu. Bu, tüm toplama anahtarları için aynı boyuttaki dizileri almanızı sağlar. Bu parametreyi kullanırken, varsayılan değer belirtilmelidir. + +## groupArrayMovingSum {#agg_function-grouparraymovingsum} + +Giriş değerlerinin hareketli toplamını hesaplar. + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +İşlev, pencere boyutunu bir parametre olarak alabilir. Belirtilmemiş bırakılırsa, işlev, sütundaki satır sayısına eşit pencere boyutunu alır. + +**Parametre** + +- `numbers_for_summing` — [İfade](../syntax.md#syntax-expressions) sayısal veri türü değeri ile sonuçlanır. +- `window_size` — Size of the calculation window. + +**Döndürülen değerler** + +- Giriş verileri ile aynı boyut ve türdeki dizi. + +**Örnek** + +Örnek tablo: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Sorgu: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## groupArrayMovingAvg {#agg_function-grouparraymovingavg} + +Giriş değerlerinin hareketli ortalamasını hesaplar. + +``` sql +groupArrayMovingAvg(numbers_for_summing) +groupArrayMovingAvg(window_size)(numbers_for_summing) +``` + +İşlev, pencere boyutunu bir parametre olarak alabilir. Belirtilmemiş bırakılırsa, işlev, sütundaki satır sayısına eşit pencere boyutunu alır. + +**Parametre** + +- `numbers_for_summing` — [İfade](../syntax.md#syntax-expressions) sayısal veri türü değeri ile sonuçlanır. +- `window_size` — Size of the calculation window. + +**Döndürülen değerler** + +- Giriş verileri ile aynı boyut ve türdeki dizi. + +İşlev kullanır [sıfıra doğru yuvarlama](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). Sonuç veri türü için önemsiz ondalık basamaklar keser. + +**Örnek** + +Örnek tablo `b`: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +Sorgu: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## groupUniqArray (x), groupUniqArray (max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} + +Farklı bağımsız değişken değerlerinden bir dizi oluşturur. Bellek tüketimi için aynıdır `uniqExact` işlev. + +İkinci versiyonu (ile `max_size` parametre), elde edilen dizinin boyutunu sınırlar `max_size` öğeler. +Mesela, `groupUniqArray(1)(x)` eşdeğ toer equivalentdir `[any(x)]`. + +## quantile {#quantile} + +Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. + +Bu işlev geçerlidir [rezerv reservoiruar örnek samplinglemesi](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192’ye kadar bir rezervuar boyutu ve örnekleme için rastgele sayı üreteci ile. Sonuç deterministik değildir. Tam bir miktar elde etmek için [quantileExact](#quantileexact) işlev. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantile(level)(expr) +``` + +Takma ad: `median`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql-reference/data-types/index.md#data_types), [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). + +**Döndürülen değer** + +- Belirtilen seviyenin yaklaşık miktarı. + +Tür: + +- [Float64](../../sql-reference/data-types/float.md) sayısal veri türü girişi için. +- [Tarihli](../../sql-reference/data-types/date.md) giriş değerleri varsa `Date` tür. +- [DateTime](../../sql-reference/data-types/datetime.md) giriş değerleri varsa `DateTime` tür. + +**Örnek** + +Giriş tablosu: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Sorgu: + +``` sql +SELECT quantile(val) FROM t +``` + +Sonuç: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## quantileDeterministic {#quantiledeterministic} + +Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. + +Bu işlev geçerlidir [rezerv reservoiruar örnek samplinglemesi](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192’ye kadar bir rezervuar boyutu ve örnekleme deterministik algoritması ile. Sonuç deterministiktir. Tam bir miktar elde etmek için [quantileExact](#quantileexact) işlev. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +Takma ad: `medianDeterministic`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql-reference/data-types/index.md#data_types), [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). +- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. + +**Döndürülen değer** + +- Belirtilen seviyenin yaklaşık miktarı. + +Tür: + +- [Float64](../../sql-reference/data-types/float.md) sayısal veri türü girişi için. +- [Tarihli](../../sql-reference/data-types/date.md) giriş değerleri varsa `Date` tür. +- [DateTime](../../sql-reference/data-types/datetime.md) giriş değerleri varsa `DateTime` tür. + +**Örnek** + +Giriş tablosu: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Sorgu: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +Sonuç: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## quantileExact {#quantileexact} + +Tam olarak hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` bellek, nerede `n` geçirilen değerler say .ısıdır. Bununla birlikte, az sayıda değer için, işlev çok etkilidir. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantileExact(level)(expr) +``` + +Takma ad: `medianExact`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql-reference/data-types/index.md#data_types), [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). + +**Döndürülen değer** + +- Belirtilen seviyenin miktarı. + +Tür: + +- [Float64](../../sql-reference/data-types/float.md) sayısal veri türü girişi için. +- [Tarihli](../../sql-reference/data-types/date.md) giriş değerleri varsa `Date` tür. +- [DateTime](../../sql-reference/data-types/datetime.md) giriş değerleri varsa `DateTime` tür. + +**Örnek** + +Sorgu: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +Sonuç: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## quantilexactweighted {#quantileexactweighted} + +Tam olarak hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) her elemanın ağırlığını dikkate alarak sayısal bir veri dizisinin. + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). Bunun yerine bu işlevi kullanabilirsiniz `quantileExact` ve 1 ağırlığını belirtin. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +Takma ad: `medianExactWeighted`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql-reference/data-types/index.md#data_types), [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. + +**Döndürülen değer** + +- Belirtilen seviyenin miktarı. + +Tür: + +- [Float64](../../sql-reference/data-types/float.md) sayısal veri türü girişi için. +- [Tarihli](../../sql-reference/data-types/date.md) giriş değerleri varsa `Date` tür. +- [DateTime](../../sql-reference/data-types/datetime.md) giriş değerleri varsa `DateTime` tür. + +**Örnek** + +Giriş tablosu: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +Sorgu: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +Sonuç: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## quantileTiming {#quantiletiming} + +Belirlenen hassas hesaplar ile [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. + +Sonuç deterministiktir (sorgu işleme sırasına bağlı değildir). Fonksiyon yükleme web sayfaları kez veya arka uç yanıt süreleri gibi dağılımları tanımlamak dizileri ile çalışmak için optimize edilmiştir. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantileTiming(level)(expr) +``` + +Takma ad: `medianTiming`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). + +- `expr` — [İfade](../syntax.md#syntax-expressions) bir sütun değerleri üzerinde dönen bir [Yüzdürmek\*](../../sql-reference/data-types/float.md)- tip numarası. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +**Doğruluk** + +Hesaplama doğru ise: + +- Toplam değer sayısı 5670’i geçmez. +- Toplam değer sayısı 5670’i aşıyor, ancak sayfa yükleme süresi 1024 ms’den az. + +Aksi takdirde, hesaplamanın sonucu 16 MS’nin en yakın katlarına yuvarlanır. + +!!! note "Not" + Sayfa yükleme süresi nicelerini hesaplamak için, bu işlev daha etkili ve doğrudur [quantile](#quantile). + +**Döndürülen değer** + +- Belirtilen seviyenin miktarı. + +Tür: `Float32`. + +!!! note "Not" + İşlev valuese hiçbir değer geçir (ilmem (işse (kullanırken `quantileTimingIf`), [Nine](../../sql-reference/data-types/float.md#data_type-float-nan-inf) döndürülür. Bunun amacı, bu vakaları sıfır ile sonuçlanan vakalardan ayırmaktır. Görmek [ORDER BY FLA BYGE](../statements/select.md#select-order-by) sıralama ile ilgili notlar için `NaN` değerler. + +**Örnek** + +Giriş tablosu: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +Sorgu: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +Sonuç: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## niceletimingweighted {#quantiletimingweighted} + +Belirlenen hassas hesaplar ile [quantile](https://en.wikipedia.org/wiki/Quantile) her sıra üyesi ağırlığına göre sayısal veri dizisi. + +Sonuç deterministiktir (sorgu işleme sırasına bağlı değildir). Fonksiyon yükleme web sayfaları kez veya arka uç yanıt süreleri gibi dağılımları tanımlamak dizileri ile çalışmak için optimize edilmiştir. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +Takma ad: `medianTimingWeighted`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). + +- `expr` — [İfade](../syntax.md#syntax-expressions) bir sütun değerleri üzerinde dönen bir [Yüzdürmek\*](../../sql-reference/data-types/float.md)- tip numarası. + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Doğruluk** + +Hesaplama doğru ise: + +- Toplam değer sayısı 5670’i geçmez. +- Toplam değer sayısı 5670’i aşıyor, ancak sayfa yükleme süresi 1024 ms’den az. + +Aksi takdirde, hesaplamanın sonucu 16 MS’nin en yakın katlarına yuvarlanır. + +!!! note "Not" + Sayfa yükleme süresi nicelerini hesaplamak için, bu işlev daha etkili ve doğrudur [quantile](#quantile). + +**Döndürülen değer** + +- Belirtilen seviyenin miktarı. + +Tür: `Float32`. + +!!! note "Not" + İşlev valuese hiçbir değer geçir (ilmem (işse (kullanırken `quantileTimingIf`), [Nine](../../sql-reference/data-types/float.md#data_type-float-nan-inf) döndürülür. Bunun amacı, bu vakaları sıfır ile sonuçlanan vakalardan ayırmaktır. Görmek [ORDER BY FLA BYGE](../statements/select.md#select-order-by) sıralama ile ilgili notlar için `NaN` değerler. + +**Örnek** + +Giriş tablosu: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +Sorgu: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +Sonuç: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## quantileTDigest {#quantiletdigest} + +Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) kullanarak sayısal veri diz ofisinin [t-dig -est](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritma. + +Maksimum hata %1’dir. Bellek tüketimi `log(n)`, nere `n` değer say isısıdır. Sonuç, sorguyu çalıştırma sırasına bağlıdır ve nondeterministic. + +Fonksiyonun performansı, performanstan daha düşüktür [quantile](#quantile) veya [quantileTiming](#quantiletiming). Durum boyutunun hassasiyete oranı açısından, bu işlev çok daha iyidir `quantile`. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantileTDigest(level)(expr) +``` + +Takma ad: `medianTDigest`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql-reference/data-types/index.md#data_types), [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). + +**Döndürülen değer** + +- Belirtilen seviyenin yaklaşık miktarı. + +Tür: + +- [Float64](../../sql-reference/data-types/float.md) sayısal veri türü girişi için. +- [Tarihli](../../sql-reference/data-types/date.md) giriş değerleri varsa `Date` tür. +- [DateTime](../../sql-reference/data-types/datetime.md) giriş değerleri varsa `DateTime` tür. + +**Örnek** + +Sorgu: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +Sonuç: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## quantileTDigestWeighted {#quantiletdigestweighted} + +Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) kullanarak sayısal veri diz ofisinin [t-dig -est](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritma. İşlev, her sıra üyesinin ağırlığını dikkate alır. Maksimum hata %1’dir. Bellek tüketimi `log(n)`, nere `n` değer say isısıdır. + +Fonksiyonun performansı, performanstan daha düşüktür [quantile](#quantile) veya [quantileTiming](#quantiletiming). Durum boyutunun hassasiyete oranı açısından, bu işlev çok daha iyidir `quantile`. + +Sonuç, sorguyu çalıştırma sırasına bağlıdır ve nondeterministic. + +Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. + +**Sözdizimi** + +``` sql +quantileTDigest(level)(expr) +``` + +Takma ad: `medianTDigest`. + +**Parametre** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql-reference/data-types/index.md#data_types), [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**Döndürülen değer** + +- Belirtilen seviyenin yaklaşık miktarı. + +Tür: + +- [Float64](../../sql-reference/data-types/float.md) sayısal veri türü girişi için. +- [Tarihli](../../sql-reference/data-types/date.md) giriş değerleri varsa `Date` tür. +- [DateTime](../../sql-reference/data-types/datetime.md) giriş değerleri varsa `DateTime` tür. + +**Örnek** + +Sorgu: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +Sonuç: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [medyan](#median) +- [quantiles](#quantiles) + +## medyan {#median} + +Bu `median*` fonksiyonlar karşılık gelen takma adlardır `quantile*` işlevler. Sayısal bir veri örneğinin medyanını hesaplarlar. + +İşlevler: + +- `median` — Alias for [quantile](#quantile). +- `medianDeterministic` — Alias for [quantileDeterministic](#quantiledeterministic). +- `medianExact` — Alias for [quantileExact](#quantileexact). +- `medianExactWeighted` — Alias for [quantilexactweighted](#quantileexactweighted). +- `medianTiming` — Alias for [quantileTiming](#quantiletiming). +- `medianTimingWeighted` — Alias for [niceletimingweighted](#quantiletimingweighted). +- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). +- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). + +**Örnek** + +Giriş tablosu: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +Sorgu: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +Sonuç: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +Tüm quantile fonksiyonları da karşılık gelen quantile fonksiyonlarına sahiptir: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Bu işlevler, listelenen seviyelerin tüm nicelerini tek geçişte hesaplar ve elde edilen değerlerin bir dizisini döndürür. + +## varSamp (x) {#varsampx} + +Miktarı hesaplar `Σ((x - x̅)^2) / (n - 1)`, nere `n` örneklem büyüklüğü ve `x̅`ortalama değer isidir `x`. + +Bir rassal değişkenin varyansının tarafsız bir tahminini temsil eder, eğer geçirilen değerler numunesini oluşturursa. + +Dönüşler `Float64`. Ne zaman `n <= 1`, dönüşler `+∞`. + +## varPop (x) {#varpopx} + +Miktarı hesaplar `Σ((x - x̅)^2) / n`, nere `n` örneklem büyüklüğü ve `x̅`ortalama değer isidir `x`. + +Başka bir deyişle, bir dizi değer için dağılım. Dönüşler `Float64`. + +## stddevSamp(x) {#stddevsampx} + +Sonuç kareköküne eşittir `varSamp(x)`. + +## stddevPop(x) {#stddevpopx} + +Sonuç kareköküne eşittir `varPop(x)`. + +## topK (N) (x) {#topknx} + +Belirtilen sütundaki yaklaşık en sık değerleri bir dizi döndürür. Elde edilen dizi, değerlerin yaklaşık frekansının azalan sırasına göre sıralanır (değerlerin kendileri tarafından değil). + +Uygular [Filtrelenmiş Yerden Tasarruf](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) TopK analiz etmek için algoritma, azaltmak ve birleştirmek algoritması dayalı [Paralel Alan Tasarrufu](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +Bu işlev garantili bir sonuç sağlamaz. Bazı durumlarda, hatalar oluşabilir ve en sık kullanılan değerler olmayan sık değerler döndürebilir. + +Biz kullanmanızı öneririz `N < 10` değer; performans büyük ile azalır `N` değerler. Maksimum değeri `N = 65536`. + +**Parametre** + +- ‘N’ dönmek için Öğe sayısıdır. + +Parametre atlanırsa, varsayılan değer 10 kullanılır. + +**Değişkenler** + +- ’ x ’ – The value to calculate frequency. + +**Örnek** + +Tak thee the [OnTime](../../getting-started/example-datasets/ontime.md) veri kümesi ve üç en sık oluşan değerleri seçin `AirlineID` sütun. + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## topKWeighted {#topkweighted} + +Benzer `topK` ancak tamsayı türünde bir ek argüman alır - `weight`. Her değer muhasebeleştirilir `weight` frekans hesaplaması için zamanlar. + +**Sözdizimi** + +``` sql +topKWeighted(N)(x, weight) +``` + +**Parametre** + +- `N` — The number of elements to return. + +**Değişkenler** + +- `x` – The value. +- `weight` — The weight. [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değer** + +Maksimum yaklaşık ağırlık toplamına sahip değerlerin bir dizisini döndürür. + +**Örnek** + +Sorgu: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +Sonuç: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## covarSamp(x, y) {#covarsampx-y} + +Değerini hesaplar `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +Float64 Döndürür. Ne zaman `n <= 1`, returns +∞. + +## covarPop (x, y) {#covarpopx-y} + +Değerini hesaplar `Σ((x - x̅)(y - y̅)) / n`. + +## corr(x, y) {#corrx-y} + +Pearson korelasyon katsayısını hesaplar: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## categoricalınformationvalue {#categoricalinformationvalue} + +Değerini hesaplar `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` her kategori için. + +``` sql +categoricalInformationValue(category1, category2, ..., tag) +``` + +Sonuç, ayrık (kategorik) bir özelliğin nasıl olduğunu gösterir `[category1, category2, ...]` değerini öngör aen bir öğrenme modeline katkıda `tag`. + +## simpleLinearRegression {#simplelinearregression} + +Basit (tek boyutlu) doğrusal regresyon gerçekleştirir. + +``` sql +simpleLinearRegression(x, y) +``` + +Parametre: + +- `x` — Column with dependent variable values. +- `y` — Column with explanatory variable values. + +Döndürülen değerler: + +Devamlılar `(a, b)` ortaya çıkan hat linetın `y = a*x + b`. + +**Örnekler** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## stokastiklinearregression {#agg_functions-stochasticlinearregression} + +Bu fonksiyon stokastik doğrusal regresyon uygular. Öğrenme oranı, L2 regularization katsayısı, mini-batch boyutu için özel parametreleri destekler ve ağırlıkları güncellemek için birkaç yöntem vardır ([Adem](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (varsayılan olarak kullanılır), [basit SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [İvme](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### Parametre {#agg_functions-stochasticlinearregression-parameters} + +4 özelleştirilebilir parametre vardır. Onlar sırayla işleve geçirilir, ancak dört varsayılan değerleri kullanılacak geçmek gerek yoktur, ancak iyi bir model bazı parametre ayarlama gerekli. + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. `learning rate` Gradyan iniş adımı gerçekleştirildiğinde adım uzunluğundaki katsayıdır. Çok büyük öğrenme oranı, modelin sonsuz ağırlıklarına neden olabilir. Default is `0.00001`. +2. `l2 regularization coefficient` hangi overfitting önlemek için yardımcı olabilir. Default is `0.1`. +3. `mini-batch size` gradyanların hesaplanacağı ve Gradyan inişinin bir adımını gerçekleştirmek için toplanacağı öğelerin sayısını ayarlar. Saf stokastik iniş bir eleman kullanır, ancak küçük partilere(yaklaşık 10 eleman) sahip olmak degrade adımları daha kararlı hale getirir. Default is `15`. +4. `method for updating weights` onlar : `Adam` (varsayılan olarak), `SGD`, `Momentum`, `Nesterov`. `Momentum` ve `Nesterov` biraz daha fazla hesaplama ve bellek gerektirir, ancak stokastik Gradyan yöntemlerinin yakınsama hızı ve kararlılığı açısından yararlı olurlar. + +### Kullanma {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` iki adımda kullanılır: modelin takılması ve yeni verilerin tahmin edilmesi. Modeli sığdırmak ve daha sonra kullanım için durumunu kaydetmek için kullandığımız `-State` temel olarak durumu kurtaran birleştirici (model ağırlıkları, vb.). +Fonksiyonu kullan wedığımızı tahmin etmek [evalMLMethod](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod), bir argüman olarak bir durumu yanı sıra tahmin etmek için özellikler alır. + + + +**1.** Uydurma + +Böyle bir sorgu kullanılabilir. + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +Burada ayrıca veri eklememiz gerekiyor `train_data` Tablo. Parametrelerin sayısı sabit değildir, sadece argümanların sayısına bağlıdır, `linearRegressionState`. Hepsi sayısal değerler olmalıdır. +Hedef değere sahip sütunun(tahmin etmeyi öğrenmek istediğimiz) ilk argüman olarak eklendiğini unutmayın. + +**2.** Öngören + +Bir durumu tabloya kaydettikten sonra, tahmin için birden çok kez kullanabilir, hatta diğer durumlarla birleşebilir ve yeni daha iyi modeller oluşturabiliriz. + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +Sorgu, tahmin edilen değerlerin bir sütununu döndürür. Not ilk argüman `evalMLMethod` oluyor `AggregateFunctionState` nesne, sonraki özelliklerin sütunlarıdır. + +`test_data` bir tablo gibi mi `train_data` ancak hedef değer içermeyebilir. + +### Not {#agg_functions-stochasticlinearregression-notes} + +1. İki modeli birleştirmek için Kullanıcı böyle bir sorgu oluşturabilir: + `sql SELECT state1 + state2 FROM your_models` + nerede `your_models` tablo her iki modeli de içerir. Bu sorgu yeni dönecektir `AggregateFunctionState` nesne. + +2. Kullanıcı, modeli kaydetmeden oluşturulan modelin ağırlıklarını kendi amaçları için alabilir `-State` birleştirici kullanılır. + `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` + Bu sorgu modele uyacak ve ağırlıklarını geri getirecektir-ilk önce modelin parametrelerine karşılık gelen ağırlıklar, sonuncusu önyargıdır. Yani yukarıdaki örnekte sorgu 3 değer içeren bir sütun döndürecektir. + +**Ayrıca Bakınız** + +- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) +- [Doğrusal ve lojistik regresyonlar arasındaki fark](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} + +Bu işlev stokastik lojistik regresyon uygular. İkili sınıflandırma problemi için kullanılabilir, stochasticLinearRegression ile aynı özel parametreleri destekler ve aynı şekilde çalışır. + +### Parametre {#agg_functions-stochasticlogisticregression-parameters} + +Parametreler tam olarak stochasticLinearRegression ile aynıdır: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +Daha fazla bilgi için bkz. [parametre](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. Uydurma + + + + See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. + + Predicted labels have to be in \[-1, 1\]. + +1. Öngören + + + + Using saved state we can predict probability of object having label `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + + The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + + We can also set a bound of probability, which assigns elements to different labels. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + + Then the result will be labels. + + `test_data` is a table like `train_data` but may not contain target value. + +**Ayrıca Bakınız** + +- [stokastiklinearregression](#agg_functions-stochasticlinearregression) +- [Doğrusal ve lojistik regresyonlar arasındaki fark.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## groupBitmapAnd {#groupbitmapand} + +Bu VE bir bitmap sütun, Uınt64 tür iade önem, hesaplamaları suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapAnd(expr) +``` + +**Parametre** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tür. + +**Dönüş değeri** + +Bu değer `UInt64` tür. + +**Örnek** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapAnd(z)─┐ +│ 3 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ +│ [6,8,10] │ +└──────────────────────────────────────────────────┘ +``` + +## groupBitmapOr {#groupbitmapor} + +YA da bir bitmap sütun, Uınt64 tür iade önem, hesaplamaları suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql-reference/functions/bitmap-functions.md). Bu eşdeğerdir `groupBitmapMerge`. + +``` sql +groupBitmapOr(expr) +``` + +**Parametre** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tür. + +**Dönüş değeri** + +Bu değer `UInt64` tür. + +**Örnek** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapOr(z)─┐ +│ 15 │ +└──────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ +│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ +└─────────────────────────────────────────────────┘ +``` + +## groupBitmapXor {#groupbitmapxor} + +Bir bitmap sütun, Uınt64 tür iade önem hesaplamaları XOR, suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapOr(expr) +``` + +**Parametre** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tür. + +**Dönüş değeri** + +Bu değer `UInt64` tür. + +**Örnek** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapXor(z)─┐ +│ 10 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ +│ [1,3,5,6,8,10,11,13,14,15] │ +└──────────────────────────────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/tr/sql-reference/ansi.md b/docs/tr/sql-reference/ansi.md new file mode 120000 index 00000000000..3cf6bffed67 --- /dev/null +++ b/docs/tr/sql-reference/ansi.md @@ -0,0 +1 @@ +../../en/sql-reference/ansi.md \ No newline at end of file diff --git a/docs/tr/sql-reference/data-types/aggregatefunction.md b/docs/tr/sql-reference/data-types/aggregatefunction.md new file mode 100644 index 00000000000..58d2e8e5ffb --- /dev/null +++ b/docs/tr/sql-reference/data-types/aggregatefunction.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 52 +toc_title: AggregateFunction (ad, types_of_arguments...) +--- + +# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [materyalize bir görünüm](../../sql-reference/statements/select.md#create-view). Bir toplama işlevi durumu üretmek için ortak yolu ile toplama işlevi çağırarak olduğunu `-State` sonek. Gelecekte toplanmanın nihai sonucunu elde etmek için, aynı toplama işlevini `-Merge`sonek. + +`AggregateFunction` — parametric data type. + +**Parametre** + +- Toplama işlevinin adı. + + If the function is parametric, specify its parameters too. + +- Toplama işlevi bağımsız değişkenleri türleri. + +**Örnek** + +``` sql +CREATE TABLE t +( + column1 AggregateFunction(uniq, UInt64), + column2 AggregateFunction(anyIf, String, UInt8), + column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) +) ENGINE = ... +``` + +[uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq), anyİf ([herhangi](../../sql-reference/aggregate-functions/reference.md#agg_function-any)+[Eğer](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-if)) ve [quantiles](../../sql-reference/aggregate-functions/reference.md) ClickHouse desteklenen toplam işlevleri vardır. + +## Kullanma {#usage} + +### Veri Ekleme {#data-insertion} + +Veri eklemek için şunları kullanın `INSERT SELECT` agr aggregateega ile `-State`- işlevler. + +**Fonksiyon örnekleri** + +``` sql +uniqState(UserID) +quantilesState(0.5, 0.9)(SendTiming) +``` + +Karşılık gelen fonksiyonların aksine `uniq` ve `quantiles`, `-State`- fonksiyonlar son değer yerine durumu döndürür. Başka bir deyişle, bir değer döndürür `AggregateFunction` tür. + +Sonuç inlarında `SELECT` sorgu, değerleri `AggregateFunction` türü, Tüm ClickHouse çıktı biçimleri için uygulamaya özgü ikili gösterime sahiptir. Örneğin, veri dökümü, `TabSeparated` ile format `SELECT` sorgu, daha sonra bu dökümü kullanarak geri yüklenebilir `INSERT` sorgu. + +### Veri Seçimi {#data-selection} + +Veri seçerken `AggregatingMergeTree` tablo kullanın `GROUP BY` yan tümce ve veri eklerken aynı toplama işlevleri, ancak kullanarak `-Merge`sonek. + +Bir toplama fonksiyonu ile `-Merge` sonek, bir dizi durum alır, bunları birleştirir ve tam veri toplama sonucunu döndürür. + +Örneğin, aşağıdaki iki sorgu aynı sonucu döndürür: + +``` sql +SELECT uniq(UserID) FROM table + +SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) +``` + +## Kullanım Örneği {#usage-example} + +Görmek [AggregatingMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) motor açıklaması. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/tr/sql-reference/data-types/array.md b/docs/tr/sql-reference/data-types/array.md new file mode 100644 index 00000000000..015e5558def --- /dev/null +++ b/docs/tr/sql-reference/data-types/array.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 51 +toc_title: Dizi(T) +--- + +# Dizi(t) {#data-type-array} + +Bir dizi `T`- tip öğeleri. `T` herhangi bir veri türü, bir dizi dahil edilebilir. + +## Bir Dizi oluşturma {#creating-an-array} + +Bir dizi oluşturmak için bir işlev kullanabilirsiniz: + +``` sql +array(T) +``` + +Köşeli parantez de kullanabilirsiniz. + +``` sql +[] +``` + +Bir dizi oluşturma örneği: + +``` sql +SELECT array(1, 2) AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName(array(1, 2))─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴─────────────────────────┘ +``` + +``` sql +SELECT [1, 2] AS x, toTypeName(x) +``` + +``` text +┌─x─────┬─toTypeName([1, 2])─┐ +│ [1,2] │ Array(UInt8) │ +└───────┴────────────────────┘ +``` + +## Veri Türleri İle Çalışma {#working-with-data-types} + +Anında bir dizi oluştururken, ClickHouse bağımsız değişken türünü otomatik olarak listelenen tüm bağımsız değişkenleri depolayabilen en dar veri türü olarak tanımlar. Eğer herhangi bir [Nullable](nullable.md#data_type-nullable) veya edebi [NULL](../../sql-reference/syntax.md#null-literal) değerler, bir dizi öğesinin türü de olur [Nullable](nullable.md). + +ClickHouse veri türünü belirleyemedi, bir özel durum oluşturur. Örneğin, aynı anda dizeler ve sayılarla bir dizi oluşturmaya çalışırken bu olur (`SELECT array(1, 'a')`). + +Otomatik veri türü algılama örnekleri: + +``` sql +SELECT array(1, 2, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ +│ [1,2,NULL] │ Array(Nullable(UInt8)) │ +└────────────┴───────────────────────────────┘ +``` + +Uyumsuz veri türleri dizisi oluşturmaya çalışırsanız, ClickHouse bir özel durum atar: + +``` sql +SELECT array(1, 'a') +``` + +``` text +Received exception from server (version 1.1.54388): +Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/tr/sql_reference/data_types/boolean.md b/docs/tr/sql-reference/data-types/boolean.md similarity index 100% rename from docs/tr/sql_reference/data_types/boolean.md rename to docs/tr/sql-reference/data-types/boolean.md diff --git a/docs/tr/sql-reference/data-types/date.md b/docs/tr/sql-reference/data-types/date.md new file mode 100644 index 00000000000..13f8d347533 --- /dev/null +++ b/docs/tr/sql-reference/data-types/date.md @@ -0,0 +1,15 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 47 +toc_title: Tarihli +--- + +# Tarihli {#date} + +Tarihli. 1970-01-01 (imzasız) gün sayısı olarak iki bayt olarak saklanır. Unix döneminin başlangıcından hemen sonra, derleme aşamasında bir sabit tarafından tanımlanan üst eşiğe kadar değerlerin depolanmasına izin verir (şu anda, bu 2106 yılına kadar, ancak tam olarak desteklenen son yıl 2105’tir). +Minimum değer 0000-00-00 olarak çıktıdır. + +Tarih değeri saat dilimi olmadan depolanır. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/date/) diff --git a/docs/tr/sql-reference/data-types/datetime.md b/docs/tr/sql-reference/data-types/datetime.md new file mode 100644 index 00000000000..db0b757f802 --- /dev/null +++ b/docs/tr/sql-reference/data-types/datetime.md @@ -0,0 +1,129 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 48 +toc_title: DateTime +--- + +# Datetime {#data_type-datetime} + +Bir takvim tarih ve bir günün bir saat olarak ifade edilebilir, zaman içinde bir anlık saklamak için izin verir. + +Sözdizimi: + +``` sql +DateTime([timezone]) +``` + +Desteklenen değerler aralığı: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. + +Çözünürlük: 1 saniye. + +## Kullanım Açıklamaları {#usage-remarks} + +Zaman içindeki nokta bir [Unix zaman damgası](https://en.wikipedia.org/wiki/Unix_time), ne olursa olsun saat dilimi veya gün ışığından yararlanma saati. Ayrıca, `DateTime` tür, tüm sütun için aynı olan saat dilimini depolayabilir, bu da `DateTime` tür değerleri metin biçiminde görüntülenir ve dizeler olarak belirtilen değerlerin nasıl ayrıştırılır (‘2020-01-01 05:00:01’). Saat dilimi tablo (veya resultset) satırlarında depolanır, ancak sütun meta verileri depolanır. +Desteklenen saat dilimlerinin bir listesi şu adreste bulunabilir: [IANA Saat Dilimi veritabanı](https://www.iana.org/time-zones). +Bu `tzdata` paket, içeren [IANA Saat Dilimi veritabanı](https://www.iana.org/time-zones), sisteme Kurul .malıdır. Kullan… `timedatectl list-timezones` yerel bir sistem tarafından bilinen zaman dilimlerini listelemek için komut. + +İçin bir saat dilimi açıkça ayarlayabilirsiniz `DateTime`- bir tablo oluştururken sütunları yazın. Saat dilimi ayarlanmamışsa, ClickHouse değerini kullanır [saat dilimi](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) sunucu ayarlarında veya ClickHouse sunucusunun başlatıldığı anda işletim sistemi ayarlarında parametre. + +Bu [clickhouse-müşteri](../../interfaces/cli.md) veri türünü başlatırken bir saat dilimi açıkça ayarlanmamışsa, sunucu saat dilimini varsayılan olarak uygular. İstemci saat dilimini kullanmak için `clickhouse-client` ile… `--use_client_time_zone` parametre. + +ClickHouse çıkış değerleri `YYYY-MM-DD hh:mm:ss` varsayılan olarak metin biçimi. Çıkış ile değiştirebilirsiniz [formatDateTime](../../sql-reference/functions/date-time-functions.md#formatdatetime) işlev. + +Clickhouse’a veri eklerken, Tarih ve saat dizelerinin farklı biçimlerini kullanabilirsiniz. [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) ayar. + +## Örnekler {#examples} + +**1.** Bir tablo ile bir tablo oluşturma `DateTime`- sütun yazın ve içine veri ekleme: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime('Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog; +``` + +``` sql +INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); +``` + +``` sql +SELECT * FROM dt; +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +- Bir tamsayı olarak datetime eklerken, Unıx Zaman Damgası (UTC) olarak kabul edilir. `1546300800` temsil etmek `'2019-01-01 00:00:00'` UTC. Ancak, `timestamp` sütun vardır `Europe/Moscow` (UTC+3) belirtilen zaman dilimi, dize olarak çıkış yaparken değer olarak gösterilecektir `'2019-01-01 03:00:00'` +- Dize değerini datetime olarak eklerken, sütun saat diliminde olduğu kabul edilir. `'2019-01-01 00:00:00'` will gibi muamele `Europe/Moscow` saat dilimi ve farklı kaydedildi `1546290000`. + +**2.** Üzerinde filtreleme `DateTime` değerler + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00 │ 2 │ +└─────────────────────┴──────────┘ +``` + +`DateTime` sütun değerleri, bir dize değeri kullanılarak filtrelenebilir `WHERE` yüklem. Dönüştürül willecektir `DateTime` otomatik olarak: + +``` sql +SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' +``` + +``` text +┌───────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00 │ 1 │ +└─────────────────────┴──────────┘ +``` + +**3.** Bir saat dilimi almak `DateTime`- type Col columnum columnn: + +``` sql +SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────column─┬─x─────────────────────────┐ +│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ +└─────────────────────┴───────────────────────────┘ +``` + +**4.** Zaman dilimi dönüştürme + +``` sql +SELECT +toDateTime(timestamp, 'Europe/London') as lon_time, +toDateTime(timestamp, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────lon_time──┬────────────mos_time─┐ +│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ +│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ +└─────────────────────┴─────────────────────┘ +``` + +## Ayrıca Bakınız {#see-also} + +- [Tip dönüştürme fonksiyonları](../../sql-reference/functions/type-conversion-functions.md) +- [Tarih ve saatlerle çalışmak için işlevler](../../sql-reference/functions/date-time-functions.md) +- [Dizilerle çalışmak için işlevler](../../sql-reference/functions/array-functions.md) +- [Bu `date_time_input_format` ayar](../../operations/settings/settings.md#settings-date_time_input_format) +- [Bu `timezone` sunucu yapılandırma parametresi](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [Tarih ve saatlerle çalışmak için operatörler](../../sql-reference/operators.md#operators-datetime) +- [Bu `Date` veri türü](date.md) + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/tr/sql-reference/data-types/datetime64.md b/docs/tr/sql-reference/data-types/datetime64.md new file mode 100644 index 00000000000..706fc5fc0ce --- /dev/null +++ b/docs/tr/sql-reference/data-types/datetime64.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 49 +toc_title: DateTime64 +--- + +# Datetime64 {#data_type-datetime64} + +Tanımlanmış alt saniye hassasiyetle, bir takvim tarihi ve bir günün saati olarak ifade edilebilir, zaman içinde bir anlık saklamak için izin verir + +Kene boyutu (hassas): 10-hassaslık ikincilikler + +Sözdizimi: + +``` sql +DateTime64(precision, [timezone]) +``` + +DAHİLİ olarak, verileri bir dizi olarak saklar ‘ticks’ epoch başlangıçtan beri (1970-01-01 00:00:00 UTC) Int64 olarak. Kene çözünürlüğü hassasiyet parametresi tarafından belirlenir. Ayrıca, `DateTime64` tür, tüm sütun için aynı olan saat dilimini depolayabilir, bu da `DateTime64` tür değerleri metin biçiminde görüntülenir ve dizeler olarak belirtilen değerlerin nasıl ayrıştırılır (‘2020-01-01 05:00:01.000’). Saat dilimi tablo (veya resultset) satırlarında depolanır, ancak sütun meta verileri depolanır. Ayrıntıları görün [DateTime](datetime.md). + +## Örnekler {#examples} + +**1.** İle bir tablo oluşturma `DateTime64`- sütun yazın ve içine veri ekleme: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime64(3, 'Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog +``` + +``` sql +INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) +``` + +``` sql +SELECT * FROM dt +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00.000 │ 1 │ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +- Bir tamsayı olarak datetime eklerken, uygun şekilde ölçeklendirilmiş bir Unıx Zaman Damgası (UTC) olarak kabul edilir. `1546300800000` (hassas 3 ile) temsil eder `'2019-01-01 00:00:00'` UTC. Ancak, `timestamp` sütun vardır `Europe/Moscow` (UTC+3) belirtilen zaman dilimi, bir dize olarak çıkış yaparken değer olarak gösterilir `'2019-01-01 03:00:00'` +- Dize değerini datetime olarak eklerken, sütun saat diliminde olduğu kabul edilir. `'2019-01-01 00:00:00'` will gibi muamele `Europe/Moscow` saat dilimi ve olarak saklanır `1546290000000`. + +**2.** Üzerinde filtreleme `DateTime64` değerler + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +Aksine `DateTime`, `DateTime64` değerler dönüştürülmez `String` otomatik olarak + +**3.** Bir saat dilimi almak `DateTime64`- tip değeri: + +``` sql +SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────────column─┬─x──────────────────────────────┐ +│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ +└─────────────────────────┴────────────────────────────────┘ +``` + +**4.** Zaman dilimi dönüştürme + +``` sql +SELECT +toDateTime64(timestamp, 3, 'Europe/London') as lon_time, +toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────────lon_time──┬────────────────mos_time─┐ +│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ +│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ +└─────────────────────────┴─────────────────────────┘ +``` + +## Ayrıca Bakınız {#see-also} + +- [Tip dönüştürme fonksiyonları](../../sql-reference/functions/type-conversion-functions.md) +- [Tarih ve saatlerle çalışmak için işlevler](../../sql-reference/functions/date-time-functions.md) +- [Dizilerle çalışmak için işlevler](../../sql-reference/functions/array-functions.md) +- [Bu `date_time_input_format` ayar](../../operations/settings/settings.md#settings-date_time_input_format) +- [Bu `timezone` sunucu yapılandırma parametresi](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [Tarih ve saatlerle çalışmak için operatörler](../../sql-reference/operators.md#operators-datetime) +- [`Date` veri türü](date.md) +- [`DateTime` veri türü](datetime.md) diff --git a/docs/tr/sql-reference/data-types/decimal.md b/docs/tr/sql-reference/data-types/decimal.md new file mode 100644 index 00000000000..3cdcc7ea2a6 --- /dev/null +++ b/docs/tr/sql-reference/data-types/decimal.md @@ -0,0 +1,109 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 42 +toc_title: "Ondal\u0131k" +--- + +# Ondalık(P, S), Decimal32 (S), Decimal64( S), Decimal128 (S) {#decimalp-s-decimal32s-decimal64s-decimal128s} + +Ekleme, çıkarma ve çarpma işlemleri sırasında hassasiyeti koruyan imzalı sabit noktalı sayılar. Bölünme için en az önemli basamak atılır (yuvarlatılmamış). + +## Parametre {#parameters} + +- P-hassas. Geçerli Aralık: \[1: 38 \]. Kaç ondalık basamak sayısı (kesir dahil) olabilir belirler. +- S-scale. Geçerli Aralık: \[0: P\]. Kaç ondalık basamak kesir olabilir belirler. + +P parametre değerine bağlı olarak ondalık (P, S) bir eşanlamlıdır: +- P \[ 1 : 9\] - Decimal32(S) için) +- P \[ 10 : 18\] - Decimal64(ler) için) +- P \[ 19 : 38\] - Decimal128(ler) için) + +## Ondalık değer aralıkları {#decimal-value-ranges} + +- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9-S) ) +- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18-S) ) +- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38-S) ) + +Örneğin, Decimal32 (4) -99999.9999 99999.9999 0.0001 adım ile sayılar içerebilir. + +## İç Temsil {#internal-representation} + +Dahili veri, ilgili bit genişliğine sahip normal imzalı tamsayılar olarak temsil edilir. Bellekte saklanabilen gerçek değer aralıkları, yukarıda belirtilenden biraz daha büyüktür ve yalnızca bir dizeden dönüştürmede kontrol edilir. + +Modern CPU 128-bit tamsayıları doğal olarak desteklemediğinden, Decimal128 üzerindeki işlemler öykünülür. Bu Decimal128 nedeniyle Decimal32/Decimal64’ten önemli ölçüde daha yavaş çalışır. + +## İşlemler Ve sonuç türü {#operations-and-result-type} + +Ondalık sonuçtaki ikili işlemler daha geniş sonuç türünde (herhangi bir bağımsız değişken sırası ile) sonuçlanır. + +- Decimal64(S1) Decimal32 (S2) - \> Decimal64 (S) +- Decimal128(S1) Decimal32 (S2) - \> Decimal128(S) +- Decimal128(S1) Decimal64 (S2) - \> Decimal128(S) + +Ölçek kuralları: + +- ekleme, çıkarma: s = max (S1, S2). +- multuply: S = S1 + S2. +- böl: S = S1. + +Ondalık ve tamsayılar arasındaki benzer işlemler için sonuç, bir bağımsız değişkenle aynı boyutta ondalık olur. + +Ondalık ve Float32 / Float64 arasındaki işlemler tanımlanmamıştır. Bunlara ihtiyacınız varsa, todecimal32, toDecimal64, toDecimal128 veya toFloat32, toFloat64 builtins kullanarak bağımsız değişkenlerden birini açıkça yayınlayabilirsiniz. Sonucun hassasiyeti kaybedeceğini ve tür dönüşümünün hesaplamalı olarak pahalı bir işlem olduğunu unutmayın. + +Float64 (örneğin, var veya stddev) ondalık dönüş sonucu bazı işlevler. Ara hesaplamalar hala Float64 ve aynı değerlere sahip ondalık girişler arasında farklı sonuçlara yol açabilecek ondalık olarak gerçekleştirilebilir. + +## Taşma Kontrolleri {#overflow-checks} + +Ondalık hesaplamalar sırasında tamsayı taşmaları gerçekleşebilir. Bir kesirdeki aşırı rakamlar atılır (yuvarlatılmamış). Tamsayı bölümünde aşırı basamak bir istisna yol açacaktır. + +``` sql +SELECT toDecimal32(2, 4) AS x, x / 3 +``` + +``` text +┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ +│ 2.0000 │ 0.6666 │ +└────────┴──────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32(4.2, 8) AS x, x * x +``` + +``` text +DB::Exception: Scale is out of bounds. +``` + +``` sql +SELECT toDecimal32(4.2, 8) AS x, 6 * x +``` + +``` text +DB::Exception: Decimal math overflow. +``` + +Taşma kontrolleri operasyonların yavaşlamasına neden olur. Taşmaların mümkün olmadığı biliniyorsa, kontrolleri kullanarak devre dışı bırakmak mantıklıdır `decimal_check_overflow` ayar. Kontroller devre dışı bırakıldığında ve taşma gerçekleştiğinde, sonuç yanlış olacaktır: + +``` sql +SET decimal_check_overflow = 0; +SELECT toDecimal32(4.2, 8) AS x, 6 * x +``` + +``` text +┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ +│ 4.20000000 │ -17.74967296 │ +└────────────┴──────────────────────────────────┘ +``` + +Taşma kontrolleri sadece aritmetik işlemlerde değil, değer karşılaştırmasında da gerçekleşir: + +``` sql +SELECT toDecimal32(1, 8) < 100 +``` + +``` text +DB::Exception: Can't compare. +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/decimal/) diff --git a/docs/tr/sql_reference/data_types/domains/index.md b/docs/tr/sql-reference/data-types/domains/index.md similarity index 100% rename from docs/tr/sql_reference/data_types/domains/index.md rename to docs/tr/sql-reference/data-types/domains/index.md diff --git a/docs/tr/sql_reference/data_types/domains/ipv4.md b/docs/tr/sql-reference/data-types/domains/ipv4.md similarity index 100% rename from docs/tr/sql_reference/data_types/domains/ipv4.md rename to docs/tr/sql-reference/data-types/domains/ipv4.md diff --git a/docs/tr/sql_reference/data_types/domains/ipv6.md b/docs/tr/sql-reference/data-types/domains/ipv6.md similarity index 100% rename from docs/tr/sql_reference/data_types/domains/ipv6.md rename to docs/tr/sql-reference/data-types/domains/ipv6.md diff --git a/docs/tr/sql-reference/data-types/domains/overview.md b/docs/tr/sql-reference/data-types/domains/overview.md new file mode 100644 index 00000000000..87dbe3d9b38 --- /dev/null +++ b/docs/tr/sql-reference/data-types/domains/overview.md @@ -0,0 +1,32 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 58 +toc_title: "Genel bak\u0131\u015F" +--- + +# Etkiler {#domains} + +Etki alanları, varolan temel türün üstüne bazı ek özellikler ekleyen, ancak temel veri türünün kablolu ve disk üstü biçimini sağlam bırakan özel amaçlı türlerdir. Şu anda, ClickHouse kullanıcı tanımlı etki alanlarını desteklemiyor. + +Örneğin, ilgili taban türünün kullanılabileceği her yerde etki alanlarını kullanabilirsiniz: + +- Etki alanı türünde bir sütun oluşturma +- Alan sütunundan/alanına değerleri okuma / yazma +- Bir temel türü bir dizin olarak kullanılabilir, bir dizin olarak kullanın +- Etki alanı sütun değerleri ile çağrı fonksiyonları + +### Alanların Ekstra özellikleri {#extra-features-of-domains} + +- Açık sütun türü adı `SHOW CREATE TABLE` veya `DESCRIBE TABLE` +- İle insan dostu format inputtan giriş `INSERT INTO domain_table(domain_column) VALUES(...)` +- İçin insan dostu forma outputta çıktı `SELECT domain_column FROM domain_table` +- Harici bir kaynaktan insan dostu biçimde veri yükleme: `INSERT INTO domain_table FORMAT CSV ...` + +### Sınırlamalar {#limitations} + +- Temel türün dizin sütununu etki alanı türüne dönüştürülemiyor `ALTER TABLE`. +- Başka bir sütun veya tablodan veri eklerken dize değerlerini dolaylı olarak etki alanı değerlerine dönüştüremez. +- Etki alanı, depolanan değerler üzerinde hiçbir kısıtlama ekler. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/tr/sql-reference/data-types/enum.md b/docs/tr/sql-reference/data-types/enum.md new file mode 100644 index 00000000000..650c026a8b4 --- /dev/null +++ b/docs/tr/sql-reference/data-types/enum.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 50 +toc_title: Enum +--- + +# Enum {#enum} + +Adlandırılmış değerlerden oluşan numaralandırılmış tür. + +Adlandırılmış değerler olarak bildirilmelidir `'string' = integer` çiftliler. ClickHouse yalnızca sayıları saklar, ancak adları aracılığıyla değerlerle işlemleri destekler. + +ClickHouse destekler: + +- 8-bit `Enum`. En fazla 256 değerleri numaralandırılmış içerebilir `[-128, 127]` Aralık. +- 16-bit `Enum`. En fazla 65536 değerleri numaralandırılmış içerebilir `[-32768, 32767]` Aralık. + +ClickHouse otomatik olarak türünü seçer `Enum` veri eklendiğinde. Ayrıca kullanabilirsiniz `Enum8` veya `Enum16` türleri depolama boyutunda emin olmak için. + +## Kullanım Örnekleri {#usage-examples} + +Burada bir tablo oluşturuyoruz `Enum8('hello' = 1, 'world' = 2)` type Col columnum columnn: + +``` sql +CREATE TABLE t_enum +( + x Enum('hello' = 1, 'world' = 2) +) +ENGINE = TinyLog +``` + +Sütun `x` yalnızca tür tanımında listelenen değerleri depolayabilir: `'hello'` veya `'world'`. Başka bir değer kaydetmeye çalışırsanız, ClickHouse bir özel durum yükseltir. Bunun için 8-bit boyutu `Enum` otomatik olarak seçilir. + +``` sql +INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') +``` + +``` text +Ok. +``` + +``` sql +INSERT INTO t_enum values('a') +``` + +``` text +Exception on client: +Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) +``` + +Tablodan veri sorguladığınızda, ClickHouse dize değerleri `Enum`. + +``` sql +SELECT * FROM t_enum +``` + +``` text +┌─x─────┐ +│ hello │ +│ world │ +│ hello │ +└───────┘ +``` + +Satırların sayısal eşdeğerlerini görmeniz gerekiyorsa, `Enum` tamsayı türüne değer. + +``` sql +SELECT CAST(x, 'Int8') FROM t_enum +``` + +``` text +┌─CAST(x, 'Int8')─┐ +│ 1 │ +│ 2 │ +│ 1 │ +└─────────────────┘ +``` + +Bir sorguda bir Enum değeri oluşturmak için, ayrıca kullanmanız gerekir `CAST`. + +``` sql +SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) +``` + +``` text +┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ +│ Enum8('a' = 1, 'b' = 2) │ +└─────────────────────────────────────────────────────┘ +``` + +## Genel Kurallar Ve kullanım {#general-rules-and-usage} + +Değerlerin her birine aralıkta bir sayı atanır `-128 ... 127` için `Enum8` veya aralık inta `-32768 ... 32767` için `Enum16`. Tüm dizeler ve sayılar farklı olmalıdır. Boş bir dize izin verilir. Bu tür belirtilmişse (bir tablo tanımında), sayılar rasgele bir sırada olabilir. Ancak, sipariş önemli değil. + +Ne dize ne de sayısal değer bir `Enum` olabilir [NULL](../../sql-reference/syntax.md). + +Bir `Enum` içerdiği olabilir [Nullable](nullable.md) tür. Yani sorguyu kullanarak bir tablo oluşturursanız + +``` sql +CREATE TABLE t_enum_nullable +( + x Nullable( Enum8('hello' = 1, 'world' = 2) ) +) +ENGINE = TinyLog +``` + +bu mağaza değil sadece `'hello'` ve `'world'`, ama `NULL`, yanında. + +``` sql +INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) +``` + +RAM, bir `Enum` sütun aynı şekilde saklanır `Int8` veya `Int16` karşılık gelen sayısal değerlerin. + +Metin formunda okurken, ClickHouse değeri bir dize olarak ayrıştırır ve karşılık gelen dizeyi Enum değerleri kümesinden arar. Bulunmazsa, bir istisna atılır. Metin biçiminde okurken, dize okunur ve karşılık gelen sayısal değer aranır. Bulunmazsa bir istisna atılır. +Metin formunda yazarken, değeri karşılık gelen dize olarak yazar. Sütun verileri çöp içeriyorsa (geçerli kümeden olmayan sayılar), bir özel durum atılır. İkili formda okurken ve yazarken, Int8 ve Int16 veri türleri ile aynı şekilde çalışır. +Örtülü varsayılan değer, en düşük sayıya sahip değerdir. + +Sırasında `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` ve böylece, Enumlar karşılık gelen sayılarla aynı şekilde davranır. Örneğin, sipariş onları sayısal olarak sıralar. Eşitlik ve karşılaştırma işleçleri, alttaki sayısal değerler üzerinde yaptıkları gibi Enumlarda aynı şekilde çalışır. + +Enum değerleri sayılarla karşılaştırılamaz. Enums sabit bir dize ile karşılaştırılabilir. Karşılaştırılan dize Enum için geçerli bir değer değilse, bir özel durum atılır. IN operatörü, sol taraftaki Enum ve sağ taraftaki bir dizi dizeyle desteklenir. Dizeler, karşılık gelen Enumun değerleridir. + +Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. +Ancak, Enum doğal bir `toString` dize değerini döndüren işlev. + +Enum değerleri de kullanarak sayısal türlere dönüştürülebilir `toT` fonksiyon, burada t sayısal bir türdür. T enum’un temel sayısal türüne karşılık geldiğinde, bu dönüşüm sıfır maliyetlidir. +Enum türü, yalnızca değer kümesi değiştirilirse, alter kullanılarak maliyet olmadan değiştirilebilir. Her iki ekleme ve Alter kullanarak Enum üyeleri kaldırmak mümkündür (kaldırma yalnızca kaldırılan değer tabloda hiç kullanılmadıysa güvenlidir). Bir koruma olarak, önceden tanımlanmış bir Enum üyesinin sayısal değerini değiştirmek bir istisna atar. + +ALTER kullanarak, bir Enum8 için bir Enum16 veya tam tersi, Int8 için Int16 değiştirme gibi değiştirmek mümkündür. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/tr/sql-reference/data-types/fixedstring.md b/docs/tr/sql-reference/data-types/fixedstring.md new file mode 100644 index 00000000000..e576bc36ec5 --- /dev/null +++ b/docs/tr/sql-reference/data-types/fixedstring.md @@ -0,0 +1,63 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 45 +toc_title: FixedString(N) +--- + +# Fixedstring {#fixedstring} + +Sabit uzunlukta bir dize `N` bayt (ne karakter ne de kod noktaları). + +Bir sütun bildirmek için `FixedString` yazın, aşağıdaki sözdizimini kullanın: + +``` sql + FixedString(N) +``` + +Nerede `N` doğal bir sayıdır. + +Bu `FixedString` veri tam olarak uzunluğa sahip olduğunda tür etkilidir `N` baytlar. Diğer tüm durumlarda, verimliliği düşürmesi muhtemeldir. + +Verimli bir şekilde depolan theabilen değerlere örnekler `FixedString`- yazılan sütunlar: + +- IP adreslerinin ikili gösterimi (`FixedString(16)` IPv6 için). +- Language codes (ru\_RU, en\_US … ). +- Currency codes (USD, RUB … ). +- Karma ikili gösterimi (`FixedString(16)` MD5 için, `FixedString(32)` SHA256 için). + +UUID değerlerini depolamak için [UUID](uuid.md) veri türü. + +Verileri eklerken, ClickHouse: + +- Dize daha az içeriyorsa, boş bayt ile bir dize tamamlar `N` baytlar. +- Atar `Too large value for FixedString(N)` dize birden fazla içeriyorsa, özel durum `N` baytlar. + +Verileri seçerken, ClickHouse dize sonunda boş bayt kaldırmaz. Eğer kullanıyorsanız `WHERE` yan tümcesi, null bayt el ile eşleştirmek için eklemelisiniz `FixedString` değer. Kullanımı için aşağıdaki örnek, nasıl gösterir `WHERE` fık withra ile `FixedString`. + +Aşağıdaki tabloyu tek ile düşünelim `FixedString(2)` sütun: + +``` text +┌─name──┐ +│ b │ +└───────┘ +``` + +Sorgu `SELECT * FROM FixedStringTable WHERE a = 'b'` sonuç olarak herhangi bir veri döndürmez. Filtre desenini boş baytlarla tamamlamalıyız. + +``` sql +SELECT * FROM FixedStringTable +WHERE a = 'b\0' +``` + +``` text +┌─a─┐ +│ b │ +└───┘ +``` + +Bu davranış için MySQL farklıdır `CHAR` tür (burada dizeler boşluklarla doldurulur ve boşluklar çıktı için kaldırılır). + +Not uzunluğu `FixedString(N)` değer sabittir. Bu [uzunluk](../../sql-reference/functions/array-functions.md#array_functions-length) fonksiyon döndürür `N` hatta eğer `FixedString(N)` değer yalnızca boş baytlarla doldurulur, ancak [boş](../../sql-reference/functions/string-functions.md#empty) fonksiyon döndürür `1` bu durumda. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/tr/sql-reference/data-types/float.md b/docs/tr/sql-reference/data-types/float.md new file mode 100644 index 00000000000..523c06e91d2 --- /dev/null +++ b/docs/tr/sql-reference/data-types/float.md @@ -0,0 +1,87 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 41 +toc_title: Float32, Float64 +--- + +# Float32, Float64 {#float32-float64} + +[Kayan nokta numaraları](https://en.wikipedia.org/wiki/IEEE_754). + +Türleri C türlerine eşdeğerdir: + +- `Float32` - `float` +- `Float64` - `double` + +Verileri mümkün olduğunda tamsayı biçiminde saklamanızı öneririz. Örneğin, sabit hassas sayıları parasal tutarlar veya sayfa yükleme süreleri gibi milisaniye cinsinden tamsayı değerlerine dönüştürün. + +## Kayan noktalı sayıları Kullanma {#using-floating-point-numbers} + +- Kayan noktalı sayılarla yapılan hesaplamalar yuvarlama hatası oluşturabilir. + + + +``` sql +SELECT 1 - 0.9 +``` + +``` text +┌───────minus(1, 0.9)─┐ +│ 0.09999999999999998 │ +└─────────────────────┘ +``` + +- Hesaplamanın sonucu hesaplama yöntemine (bilgisayar sisteminin işlemci tipi ve mimarisi) bağlıdır. +- Kayan nokta hesaplamaları, sonsuzluk gibi sayılarla sonuçlanabilir (`Inf`) ve “not-a-number” (`NaN`). Hesaplamaların sonuçlarını işlerken bu dikkate alınmalıdır. +- Kayan noktalı sayıları metinden ayrıştırırken, sonuç en yakın makine tarafından temsil edilebilir sayı olmayabilir. + +## N Andan Ve in Andf {#data_type-float-nan-inf} + +Standart SQL aksine, ClickHouse kayan noktalı sayılar aşağıdaki kategorileri destekler: + +- `Inf` – Infinity. + + + +``` sql +SELECT 0.5 / 0 +``` + +``` text +┌─divide(0.5, 0)─┐ +│ inf │ +└────────────────┘ +``` + +- `-Inf` – Negative infinity. + + + +``` sql +SELECT -0.5 / 0 +``` + +``` text +┌─divide(-0.5, 0)─┐ +│ -inf │ +└─────────────────┘ +``` + +- `NaN` – Not a number. + + + +``` sql +SELECT 0 / 0 +``` + +``` text +┌─divide(0, 0)─┐ +│ nan │ +└──────────────┘ +``` + + See the rules for `NaN` sorting in the section [ORDER BY clause](../sql_reference/statements/select.md). + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/float/) diff --git a/docs/tr/sql_reference/data_types/index.md b/docs/tr/sql-reference/data-types/index.md similarity index 100% rename from docs/tr/sql_reference/data_types/index.md rename to docs/tr/sql-reference/data-types/index.md diff --git a/docs/tr/sql_reference/data_types/int_uint.md b/docs/tr/sql-reference/data-types/int-uint.md similarity index 100% rename from docs/tr/sql_reference/data_types/int_uint.md rename to docs/tr/sql-reference/data-types/int-uint.md diff --git a/docs/tr/sql_reference/data_types/nested_data_structures/index.md b/docs/tr/sql-reference/data-types/nested-data-structures/index.md similarity index 100% rename from docs/tr/sql_reference/data_types/nested_data_structures/index.md rename to docs/tr/sql-reference/data-types/nested-data-structures/index.md diff --git a/docs/tr/sql-reference/data-types/nested-data-structures/nested.md b/docs/tr/sql-reference/data-types/nested-data-structures/nested.md new file mode 100644 index 00000000000..b3d50db0bbc --- /dev/null +++ b/docs/tr/sql-reference/data-types/nested-data-structures/nested.md @@ -0,0 +1,106 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 57 +toc_title: "\u0130\xE7 \u0130\xE7e (Name1 Type1, Name2 Type2,...)" +--- + +# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) sorgu. Her tablo satırı, iç içe geçmiş veri yapısındaki herhangi bir sayıda satıra karşılık gelebilir. + +Örnek: + +``` sql +CREATE TABLE test.visits +( + CounterID UInt32, + StartDate Date, + Sign Int8, + IsNew UInt8, + VisitID UInt64, + UserID UInt64, + ... + Goals Nested + ( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32 + ), + ... +) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) +``` + +Bu örnek bildirir `Goals` dönüşümlerle ilgili verileri içeren iç içe veri yapısı (ulaşılan hedefler). Her satır içinde ‘visits’ tablo sıfır veya dönüşüm herhangi bir sayıda karşılık gelebilir. + +Sadece tek bir yuvalama seviyesi desteklenir. Diziler içeren iç içe geçmiş yapıların sütunları çok boyutlu dizilere eşdeğerdir, bu nedenle sınırlı desteğe sahiptirler (bu sütunları MergeTree altyapısı ile tablolarda depolamak için destek yoktur). + +Çoğu durumda, iç içe geçmiş bir veri yapısıyla çalışırken, sütunları bir nokta ile ayrılmış sütun adlarıyla belirtilir. Bu sütunlar eşleşen türleri bir dizi oluşturur. Tek bir iç içe geçmiş veri yapısının tüm sütun dizileri aynı uzunluğa sahiptir. + +Örnek: + +``` sql +SELECT + Goals.ID, + Goals.EventTime +FROM test.visits +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ +│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ +│ [1073752] │ ['2014-03-17 00:28:25'] │ +│ [1073752] │ ['2014-03-17 10:46:20'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ +│ [] │ [] │ +│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ +│ [] │ [] │ +│ [] │ [] │ +│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ +└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +İç içe geçmiş bir veri yapısını aynı uzunlukta birden çok sütun dizisi kümesi olarak düşünmek en kolay yoldur. + +Bir SELECT sorgusunun tek tek sütunlar yerine tüm iç içe geçmiş veri yapısının adını belirtebileceği tek yer array JOIN yan tümcesi. Daha fazla bilgi için, bkz. “ARRAY JOIN clause”. Örnek: + +``` sql +SELECT + Goal.ID, + Goal.EventTime +FROM test.visits +ARRAY JOIN Goals AS Goal +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goal.ID─┬──────Goal.EventTime─┐ +│ 1073752 │ 2014-03-17 16:38:10 │ +│ 591325 │ 2014-03-17 16:38:48 │ +│ 591325 │ 2014-03-17 16:42:27 │ +│ 1073752 │ 2014-03-17 00:28:25 │ +│ 1073752 │ 2014-03-17 10:46:20 │ +│ 1073752 │ 2014-03-17 13:59:20 │ +│ 591325 │ 2014-03-17 22:17:55 │ +│ 591325 │ 2014-03-17 22:18:07 │ +│ 591325 │ 2014-03-17 22:18:51 │ +│ 1073752 │ 2014-03-17 11:37:06 │ +└─────────┴─────────────────────┘ +``` + +İç içe geçmiş veri yapısının tamamı için SELECT gerçekleştiremezsiniz. Yalnızca bir parçası olan tek tek sütunları açıkça listeleyebilirsiniz. + +Bir INSERT sorgusu için, iç içe geçmiş bir veri yapısının tüm bileşen sütun dizilerini ayrı ayrı (tek tek sütun dizileri gibi) iletmelisiniz. Ekleme sırasında, sistem aynı uzunluğa sahip olduklarını kontrol eder. + +Bir tanımlama sorgusu için, iç içe geçmiş bir veri yapısındaki sütunlar aynı şekilde ayrı olarak listelenir. + +İç içe geçmiş bir veri yapısındaki öğeler için ALTER sorgusu sınırlamaları vardır. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/tr/sql-reference/data-types/nullable.md b/docs/tr/sql-reference/data-types/nullable.md new file mode 100644 index 00000000000..d094ae6bf59 --- /dev/null +++ b/docs/tr/sql-reference/data-types/nullable.md @@ -0,0 +1,46 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 54 +toc_title: Nullable +--- + +# Nullable (typename) {#data_type-nullable} + +Özel işaretleyici saklamak için izin verir ([NULL](../../sql-reference/syntax.md)) bu ifade eder “missing value” tarafından izin verilen normal değerlerin yanında `TypeName`. Örneğin, bir `Nullable(Int8)` tipi sütun saklayabilirsiniz `Int8` değerleri yazın ve değeri olmayan satırlar depolayacaktır `NULL`. + +İçin… `TypeName`, bileşik veri türlerini kullanamazsınız [Dizi](array.md) ve [Demet](tuple.md). Bileşik veri türleri şunları içerebilir `Nullable` gibi tür değerleri `Array(Nullable(Int8))`. + +A `Nullable` tür alanı tablo dizinlerine dahil edilemez. + +`NULL` herhangi biri için varsayılan değer mi `Nullable` ClickHouse sunucu yapılandırmasında aksi belirtilmediği sürece yazın. + +## Depolama Özellikleri {#storage-features} + +İçermek `Nullable` bir tablo sütunundaki değerleri yazın, ClickHouse ile ayrı bir dosya kullanır `NULL` değerleri ile normal dosyaya ek olarak Maskeler. Maskeli girişleri ClickHouse ayırt izin dosyası `NULL` ve her tablo satırı için karşılık gelen veri türünün varsayılan değeri. Ek bir dosya nedeniyle, `Nullable` sütun, benzer bir normal olana kıyasla ek depolama alanı tüketir. + +!!! info "Not" + Kullanım `Nullable` neredeyse her zaman performansı olumsuz etkiler, veritabanlarınızı tasarlarken bunu aklınızda bulundurun. + +## Kullanım Örneği {#usage-example} + +``` sql +CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog +``` + +``` sql +INSERT INTO t_null VALUES (1, NULL), (2, 3) +``` + +``` sql +SELECT x + y FROM t_null +``` + +``` text +┌─plus(x, y)─┐ +│ ᴺᵁᴸᴸ │ +│ 5 │ +└────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/tr/sql-reference/data-types/simpleaggregatefunction.md b/docs/tr/sql-reference/data-types/simpleaggregatefunction.md new file mode 120000 index 00000000000..76a7ef3b802 --- /dev/null +++ b/docs/tr/sql-reference/data-types/simpleaggregatefunction.md @@ -0,0 +1 @@ +../../../en/sql-reference/data-types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/tr/sql-reference/data-types/special-data-types/expression.md b/docs/tr/sql-reference/data-types/special-data-types/expression.md new file mode 100644 index 00000000000..441d9aeccc2 --- /dev/null +++ b/docs/tr/sql-reference/data-types/special-data-types/expression.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 58 +toc_title: "\u0130fade" +--- + +# İfade {#expression} + +İfadeler, lambda’ları yüksek mertebeden işlevlerde temsil etmek için kullanılır. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/special_data_types/expression/) diff --git a/docs/tr/sql_reference/data_types/special_data_types/index.md b/docs/tr/sql-reference/data-types/special-data-types/index.md similarity index 100% rename from docs/tr/sql_reference/data_types/special_data_types/index.md rename to docs/tr/sql-reference/data-types/special-data-types/index.md diff --git a/docs/tr/sql-reference/data-types/special-data-types/interval.md b/docs/tr/sql-reference/data-types/special-data-types/interval.md new file mode 100644 index 00000000000..aed3361c173 --- /dev/null +++ b/docs/tr/sql-reference/data-types/special-data-types/interval.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 61 +toc_title: "Aral\u0131kl\u0131" +--- + +# Aralıklı {#data-type-interval} + +Zaman ve Tarih aralıklarını temsil eden veri türleri ailesi. Ortaya çıkan türleri [INTERVAL](../../../sql-reference/operators.md#operator-interval) operatör. + +!!! warning "Uyarıcı" + `Interval` veri türü değerleri tablolarda saklanamaz. + +Yapılı: + +- İmzasız bir tamsayı değeri olarak zaman aralığı. +- Bir aralık türü. + +Desteklenen Aralık türleri: + +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +Her Aralık türü için ayrı bir veri türü vardır. Örneğin, `DAY` Aralık karşılık gelir `IntervalDay` veri türü: + +``` sql +SELECT toTypeName(INTERVAL 4 DAY) +``` + +``` text +┌─toTypeName(toIntervalDay(4))─┐ +│ IntervalDay │ +└──────────────────────────────┘ +``` + +## Kullanım Açıklamaları {#data-type-interval-usage-remarks} + +Kullanabilirsiniz `Interval`- aritmetik işlemlerde değerler yazın [Tarihli](../../../sql-reference/data-types/date.md) ve [DateTime](../../../sql-reference/data-types/datetime.md)- tip değerleri. Örneğin, geçerli saate 4 gün ekleyebilirsiniz: + +``` sql +SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY +``` + +``` text +┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ +│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ +└─────────────────────┴───────────────────────────────┘ +``` + +Farklı tiplere sahip aralıklar birleştirilemez. Gibi aralıklarla kullanamazsınız `4 DAY 1 HOUR`. Aralıkların, örneğin aralığın en küçük birimine eşit veya daha küçük olan birimlerdeki aralıkları belirtin `1 day and an hour` aralık olarak ifade edilebilir `25 HOUR` veya `90000 SECOND`. + +İle aritmetik işlemler yapamazsınız `Interval`- değerleri yazın, ancak farklı türde aralıklar ekleyebilirsiniz. `Date` veya `DateTime` veri türleri. Mesela: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +Aşağıdaki sorgu bir özel duruma neden olur: + +``` sql +select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) +``` + +``` text +Received exception from server (version 19.14.1): +Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. +``` + +## Ayrıca Bakınız {#see-also} + +- [INTERVAL](../../../sql-reference/operators.md#operator-interval) operatör +- [toİnterval](../../../sql-reference/functions/type-conversion-functions.md#function-tointerval) tip dönüştürme işlevleri diff --git a/docs/tr/sql-reference/data-types/special-data-types/nothing.md b/docs/tr/sql-reference/data-types/special-data-types/nothing.md new file mode 100644 index 00000000000..b6eb53b2b59 --- /dev/null +++ b/docs/tr/sql-reference/data-types/special-data-types/nothing.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 60 +toc_title: "Hi\xE7bir \u015Fey" +--- + +# Hiçbir şey {#nothing} + +Bu veri türünün tek amacı, bir değerin beklenmediği durumları temsil etmektir. Yani bir oluşturamazsınız `Nothing` type value. + +Örneğin, literal [NULL](../../../sql-reference/syntax.md#null-literal) türü vardır `Nullable(Nothing)`. Daha fazla görmek [Nullable](../../../sql-reference/data-types/nullable.md). + +Bu `Nothing` tür boş dizileri belirtmek için de kullanılabilir: + +``` sql +SELECT toTypeName(array()) +``` + +``` text +┌─toTypeName(array())─┐ +│ Array(Nothing) │ +└─────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/tr/sql-reference/data-types/special-data-types/set.md b/docs/tr/sql-reference/data-types/special-data-types/set.md new file mode 100644 index 00000000000..7b527c69fce --- /dev/null +++ b/docs/tr/sql-reference/data-types/special-data-types/set.md @@ -0,0 +1,12 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 59 +toc_title: Koymak +--- + +# Koymak {#set} + +Sağ yarısı için kullanılan bir [IN](../../../sql-reference/statements/select.md#select-in-operators) ifade. + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/tr/sql_reference/data_types/string.md b/docs/tr/sql-reference/data-types/string.md similarity index 100% rename from docs/tr/sql_reference/data_types/string.md rename to docs/tr/sql-reference/data-types/string.md diff --git a/docs/tr/sql-reference/data-types/tuple.md b/docs/tr/sql-reference/data-types/tuple.md new file mode 100644 index 00000000000..a52670d3f7e --- /dev/null +++ b/docs/tr/sql-reference/data-types/tuple.md @@ -0,0 +1,52 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 53 +toc_title: Tuple (T1, T2, ...) +--- + +# Tuple(t1, T2, …) {#tuplet1-t2} + +Elemanlarının bir demet, her bir birey olması [tür](index.md#data_types). + +Tuples geçici sütun gruplama için kullanılır. Sütunlar, bir sorguda bir In ifadesi kullanıldığında ve lambda işlevlerinin belirli resmi parametrelerini belirtmek için gruplandırılabilir. Daha fazla bilgi için bölümlere bakın [Operatör İNLERDE](../../sql-reference/statements/select.md) ve [Yüksek mertebeden fonksiyonlar](../../sql-reference/functions/higher-order-functions.md). + +Tuples bir sorgunun sonucu olabilir. Bu durumda, json dışındaki metin formatları için değerler köşeli parantez içinde virgülle ayrılır. JSON formatlarında, tuples diziler olarak çıktılanır (köşeli parantez içinde). + +## Bir Tuple oluşturma {#creating-a-tuple} + +Bir tuple oluşturmak için bir işlev kullanabilirsiniz: + +``` sql +tuple(T1, T2, ...) +``` + +Bir tuple oluşturma örneği: + +``` sql +SELECT tuple(1,'a') AS x, toTypeName(x) +``` + +``` text +┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ +│ (1,'a') │ Tuple(UInt8, String) │ +└─────────┴───────────────────────────┘ +``` + +## Veri Türleri İle Çalışma {#working-with-data-types} + +Anında bir tuple oluştururken, ClickHouse her bağımsız değişkenin türünü bağımsız değişken değerini depolayabilen türlerin en azı olarak otomatik olarak algılar. Argüman ise [NULL](../../sql-reference/syntax.md#null-literal), tuple elemanının türü [Nullable](nullable.md). + +Otomatik veri türü algılama örneği: + +``` sql +SELECT tuple(1, NULL) AS x, toTypeName(x) +``` + +``` text +┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ +│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ +└──────────┴─────────────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/tr/sql-reference/data-types/uuid.md b/docs/tr/sql-reference/data-types/uuid.md new file mode 100644 index 00000000000..65e77271010 --- /dev/null +++ b/docs/tr/sql-reference/data-types/uuid.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 46 +toc_title: UUID +--- + +# UUID {#uuid-data-type} + +Evrensel olarak benzersiz bir tanımlayıcı (UUID), kayıtları tanımlamak için kullanılan 16 baytlık bir sayıdır. UUID hakkında ayrıntılı bilgi için bkz [Vikipedi](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +UUID türü değeri örneği aşağıda temsil edilmektedir: + +``` text +61f0c404-5cb3-11e7-907b-a6006ad3dba0 +``` + +Yeni bir kayıt eklerken UUID sütun değerini belirtmezseniz, UUID değeri sıfır ile doldurulur: + +``` text +00000000-0000-0000-0000-000000000000 +``` + +## Nasıl Oluşturulur {#how-to-generate} + +UUID değerini oluşturmak için ClickHouse, [generateuuıdv4](../../sql-reference/functions/uuid-functions.md) işlev. + +## Kullanım Örneği {#usage-example} + +**Örnek 1** + +Bu örnek, UUID türü sütunuyla bir tablo oluşturma ve tabloya bir değer ekleme gösterir. + +``` sql +CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog +``` + +``` sql +INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +└──────────────────────────────────────┴───────────┘ +``` + +**Örnek 2** + +Bu örnekte, yeni bir kayıt eklerken UUID sütun değeri belirtilmedi. + +``` sql +INSERT INTO t_uuid (y) VALUES ('Example 2') +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ +└──────────────────────────────────────┴───────────┘ +``` + +## Kısıtlama {#restrictions} + +UUID veri türü sadece hangi fonksiyonları destekler [Dize](string.md) veri türü de destekler (örneğin, [dakika](../../sql-reference/aggregate-functions/reference.md#agg_function-min), [maksimum](../../sql-reference/aggregate-functions/reference.md#agg_function-max), ve [sayma](../../sql-reference/aggregate-functions/reference.md#agg_function-count)). + +UUID veri türü aritmetik işlemler tarafından desteklenmez (örneğin, [abs](../../sql-reference/functions/arithmetic-functions.md#arithm_func-abs)) veya toplama fonksiyonları gibi [toplam](../../sql-reference/aggregate-functions/reference.md#agg_function-sum) ve [avg](../../sql-reference/aggregate-functions/reference.md#agg_function-avg). + +[Orijinal makale](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md new file mode 100644 index 00000000000..e6615de1f24 --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 45 +toc_title: "Hiyerar\u015Fik s\xF6zl\xFCkler" +--- + +# Hiyerarşik Sözlükler {#hierarchical-dictionaries} + +ClickHouse bir hiyerarşik sözlükler destekler [sayısal tuş](external-dicts-dict-structure.md#ext_dict-numeric-key). + +Aşağıdaki hiyerarşik yapıya bakın: + +``` text +0 (Common parent) +│ +├── 1 (Russia) +│ │ +│ └── 2 (Moscow) +│ │ +│ └── 3 (Center) +│ +└── 4 (Great Britain) + │ + └── 5 (London) +``` + +Bu hiyerarşi aşağıdaki sözlük tablosu olarak ifade edilebilir. + +| region\_id | parent\_region | region\_name | +|------------|----------------|--------------| +| 1 | 0 | Rusya | +| 2 | 1 | Moskova | +| 3 | 2 | Merkezli | +| 4 | 0 | İngiltere | +| 5 | 4 | Londra | + +Bu tablo bir sütun içerir `parent_region` bu öğe için en yakın ebeveynin anahtarını içerir. + +ClickHouse destekler [hiyerarşik](external-dicts-dict-structure.md#hierarchical-dict-attr) için mülkiyet [dış sözlük](index.md) öznitelik. Bu özellik, yukarıda açıklanana benzer hiyerarşik sözlüğü yapılandırmanıza izin verir. + +Bu [dictGetHierarchy](../../../sql-reference/functions/ext-dict-functions.md#dictgethierarchy) fonksiyonu bir elemanın üst zincir almak için izin verir. + +Örneğimiz için, sözlüğün yapısı aşağıdaki gibi olabilir: + +``` xml + + + + region_id + + + + parent_region + UInt64 + 0 + true + + + + region_name + String + + + + + +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md new file mode 100644 index 00000000000..0071a062c0e --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md @@ -0,0 +1,373 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 41 +toc_title: "S\xF6zl\xFCkleri bellekte saklama" +--- + +# Sözlükleri Bellekte Saklama {#dicts-external-dicts-dict-layout} + +Sözlükleri bellekte saklamanın çeşitli yolları vardır. + +Biz tavsiye [düzlük](#flat), [karıştırıyordu](#dicts-external_dicts_dict_layout-hashed) ve [complex\_key\_hashed](#complex-key-hashed). hangi optimum işleme hızı sağlamak. + +Önbelleğe alma, potansiyel olarak düşük performans ve en uygun parametreleri seçmede zorluklar nedeniyle önerilmez. Bölümünde devamını oku “[önbellek](#cache)”. + +Sözlük performansını artırmanın birkaç yolu vardır: + +- Sonra sözlük ile çalışmak için işlevi çağırın `GROUP BY`. +- Mark enjektif olarak ayıklamak için nitelikler. Farklı öznitelik değerleri farklı anahtarlara karşılık geliyorsa, bir öznitelik ınjective olarak adlandırılır. Yani ne zaman `GROUP BY` anahtar tarafından bir öznitelik değeri getiren bir işlev kullanır, bu işlev otomatik olarak dışarı alınır `GROUP BY`. + +ClickHouse, sözlüklerdeki hatalar için bir istisna oluşturur. Hata örnekleri: + +- Erişilen sözlük yüklenemedi. +- Bir sorgulama hatası `cached` sözlük. + +Sen dış sözlükler ve durumları listesini görüntüleyebilirsiniz `system.dictionaries` Tablo. + +Yapılandırma şöyle görünüyor: + +``` xml + + + ... + + + + + + ... + + +``` + +İlgili [DDL-sorgu](../../statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY (...) +... +LAYOUT(LAYOUT_TYPE(param value)) -- layout settings +... +``` + +## Sözlükleri Bellekte Saklamanın Yolları {#ways-to-store-dictionaries-in-memory} + +- [düzlük](#flat) +- [karıştırıyordu](#dicts-external_dicts_dict_layout-hashed) +- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) +- [önbellek](#cache) +- [range\_hashed](#range-hashed) +- [complex\_key\_hashed](#complex-key-hashed) +- [complex\_key\_cache](#complex-key-cache) +- [ıp\_trie](#ip-trie) + +### düzlük {#flat} + +Sözlük tamamen düz diziler şeklinde bellekte saklanır. Sözlük ne kadar bellek kullanıyor? Miktar, en büyük anahtarın boyutuyla orantılıdır (kullanılan alanda). + +Sözlük anahtarı vardır `UInt64` yazın ve değeri 500.000 ile sınırlıdır. Sözlük oluştururken daha büyük bir anahtar bulunursa, ClickHouse bir özel durum atar ve sözlüğü oluşturmaz. + +Her türlü kaynak desteklenmektedir. Güncellerken, veriler (bir dosyadan veya bir tablodan) bütünüyle okunur. + +Bu yöntem, sözlüğü saklamak için mevcut tüm yöntemler arasında en iyi performansı sağlar. + +Yapılandırma örneği: + +``` xml + + + +``` + +veya + +``` sql +LAYOUT(FLAT()) +``` + +### karıştırıyordu {#dicts-external_dicts_dict_layout-hashed} + +Sözlük tamamen bir karma tablo şeklinde bellekte saklanır. Sözlük, uygulamada herhangi bir tanımlayıcıya sahip herhangi bir sayıda öğe içerebilir, anahtar sayısı on milyonlarca öğeye ulaşabilir. + +Her türlü kaynak desteklenmektedir. Güncellerken, veriler (bir dosyadan veya bir tablodan) bütünüyle okunur. + +Yapılandırma örneği: + +``` xml + + + +``` + +veya + +``` sql +LAYOUT(HASHED()) +``` + +### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} + +Benzer `hashed`, ancak daha fazla CPU kullanımı lehine daha az bellek kullanır. + +Yapılandırma örneği: + +``` xml + + + +``` + +``` sql +LAYOUT(SPARSE_HASHED()) +``` + +### complex\_key\_hashed {#complex-key-hashed} + +Bu tür depolama kompozit ile kullanım içindir [anahtarlar](external-dicts-dict-structure.md). Benzer `hashed`. + +Yapılandırma örneği: + +``` xml + + + +``` + +``` sql +LAYOUT(COMPLEX_KEY_HASHED()) +``` + +### range\_hashed {#range-hashed} + +Sözlük, sıralı bir aralık dizisi ve bunlara karşılık gelen değerleri olan bir karma tablo şeklinde bellekte saklanır. + +Bu depolama yöntemi, hashed ile aynı şekilde çalışır ve anahtara ek olarak tarih/saat (rasgele sayısal tür) aralıklarının kullanılmasına izin verir. + +Örnek: tablo, her reklamveren için biçimdeki indirimleri içerir: + +``` text ++---------|-------------|-------------|------+ +| advertiser id | discount start date | discount end date | amount | ++===============+=====================+===================+========+ +| 123 | 2015-01-01 | 2015-01-15 | 0.15 | ++---------|-------------|-------------|------+ +| 123 | 2015-01-16 | 2015-01-31 | 0.25 | ++---------|-------------|-------------|------+ +| 456 | 2015-01-01 | 2015-01-15 | 0.05 | ++---------|-------------|-------------|------+ +``` + +Tarih aralıkları için bir örnek kullanmak için, `range_min` ve `range_max` element inler [yapılı](external-dicts-dict-structure.md). Bu elemanlar elemanları içermelidir `name` ve`type` (eğer `type` belirtilmemişse, varsayılan tür kullanılır-Tarih). `type` herhangi bir sayısal tür olabilir (Date / DateTime / Uint64 / Int32 / others). + +Örnek: + +``` xml + + + Id + + + first + Date + + + last + Date + + ... +``` + +veya + +``` sql +CREATE DICTIONARY somedict ( + id UInt64, + first Date, + last Date +) +PRIMARY KEY id +LAYOUT(RANGE_HASHED()) +RANGE(MIN first MAX last) +``` + +Bu sözlüklerle çalışmak için, `dictGetT` bir aralığın seçildiği işlev: + +``` sql +dictGetT('dict_name', 'attr_name', id, date) +``` + +Bu işlev belirtilen değerin değerini döndürür `id`s ve geçirilen tarihi içeren tarih aralığı. + +Algoritmanın detayları: + +- Eğer… `id` not fo orund veya a range is not fo aund for the `id`, sözlük için varsayılan değeri döndürür. +- Çakışan aralıklar varsa, herhangi birini kullanabilirsiniz. +- Aralık sınırlayıcı ise `NULL` veya geçersiz bir tarih (örneğin 1900-01-01 veya 2039-01-01), Aralık açık bırakılır. Aralık her iki tarafta da açık olabilir. + +Yapılandırma örneği: + +``` xml + + + + ... + + + + + + + + Abcdef + + + StartTimeStamp + UInt64 + + + EndTimeStamp + UInt64 + + + XXXType + String + + + + + + +``` + +veya + +``` sql +CREATE DICTIONARY somedict( + Abcdef UInt64, + StartTimeStamp UInt64, + EndTimeStamp UInt64, + XXXType String DEFAULT '' +) +PRIMARY KEY Abcdef +RANGE(MIN StartTimeStamp MAX EndTimeStamp) +``` + +### önbellek {#cache} + +Sözlük, sabit sayıda hücre içeren bir önbellekte saklanır. Bu hücreler sık kullanılan elementleri içerir. + +Bir sözlük ararken, önce önbellek aranır. Her veri bloğu için, önbellekte bulunmayan veya güncel olmayan tüm anahtarlar, kaynak kullanılarak istenir `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Alınan veriler daha sonra önbelleğe yazılır. + +Önbellek sözlükleri için, sona erme [ömür](external-dicts-dict-lifetime.md) önbellekteki verilerin ayarlanabilir. Eğer daha fazla zaman `lifetime` bir hücrede veri yüklenmesinden bu yana geçti, hücrenin değeri kullanılmaz ve bir dahaki sefere kullanılması gerektiğinde yeniden istenir. +Bu, sözlükleri saklamanın tüm yollarından en az etkilidir. Önbelleğin hızı, doğru ayarlara ve kullanım senaryosuna bağlıdır. Bir önbellek türü sözlüğü, yalnızca isabet oranları yeterince yüksek olduğunda (önerilen %99 ve daha yüksek) iyi performans gösterir. Sen ortalama isabet oranı görebilirsiniz `system.dictionaries` Tablo. + +Önbellek performansını artırmak için bir alt sorgu ile kullanın `LIMIT`, ve harici sözlük ile işlevini çağırın. + +Destek [kaynaklılar](external-dicts-dict-sources.md): MySQL, ClickHouse, yürütülebilir, HTTP. + +Ayarlar örneği: + +``` xml + + + + 1000000000 + + +``` + +veya + +``` sql +LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) +``` + +Yeterince büyük bir önbellek boyutu ayarlayın. Sen hücre sayısını seçmek için deneme gerekir: + +1. Bazı değer ayarlayın. +2. Önbellek tamamen doluncaya kadar sorguları çalıştırın. +3. Kullanarak bellek tüketimini değerlendirmek `system.dictionaries` Tablo. +4. Gerekli bellek tüketimine ulaşılana kadar hücre sayısını artırın veya azaltın. + +!!! warning "Uyarıcı" + Rasgele okuma ile sorguları işlemek için yavaş olduğundan, ClickHouse kaynak olarak kullanmayın. + +### complex\_key\_cache {#complex-key-cache} + +Bu tür depolama kompozit ile kullanım içindir [anahtarlar](external-dicts-dict-structure.md). Benzer `cache`. + +### ıp\_trie {#ip-trie} + +Bu tür depolama, ağ öneklerini (IP adresleri) asn gibi meta verilere eşlemek içindir. + +Örnek: tablo, ağ önekleri ve bunlara karşılık gelen sayı ve ülke kodu içerir: + +``` text + +-----------|-----|------+ + | prefix | asn | cca2 | + +=================+=======+========+ + | 202.79.32.0/20 | 17501 | NP | + +-----------|-----|------+ + | 2620:0:870::/48 | 3856 | US | + +-----------|-----|------+ + | 2a02:6b8:1::/48 | 13238 | RU | + +-----------|-----|------+ + | 2001:db8::/32 | 65536 | ZZ | + +-----------|-----|------+ +``` + +Bu tür bir düzen kullanırken, yapının bileşik bir anahtarı olmalıdır. + +Örnek: + +``` xml + + + + prefix + String + + + + asn + UInt32 + + + + cca2 + String + ?? + + ... +``` + +veya + +``` sql +CREATE DICTIONARY somedict ( + prefix String, + asn UInt32, + cca2 String DEFAULT '??' +) +PRIMARY KEY prefix +``` + +Anahtarın izin verilen bir IP öneki içeren yalnızca bir dize türü özniteliği olması gerekir. Diğer türler henüz desteklenmiyor. + +Sorgular için aynı işlevleri kullanmanız gerekir (`dictGetT` bir tuple ile) kompozit tuşları ile sözlükler gelince: + +``` sql +dictGetT('dict_name', 'attr_name', tuple(ip)) +``` + +İşlev ya alır `UInt32` IPv4 için veya `FixedString(16)` IPv6 için: + +``` sql +dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) +``` + +Diğer türler henüz desteklenmiyor. İşlev, bu IP adresine karşılık gelen önek için özniteliği döndürür. Örtüşen önekler varsa, en spesifik olanı döndürülür. + +Veri bir saklanan `trie`. Tamamen RAM’e uyması gerekir. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md new file mode 100644 index 00000000000..9c0f8048949 --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md @@ -0,0 +1,91 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 42 +toc_title: "S\xF6zl\xFCk G\xFCncellemeleri" +--- + +# Sözlük Güncellemeleri {#dictionary-updates} + +ClickHouse sözlükleri periyodik olarak günceller. Tam olarak karşıdan yüklenen sözlükler için Güncelleştirme aralığı ve önbelleğe alınmış sözlükler için geçersiz kılma aralığı `` saniyeler içinde etiketleyin. + +Sözlük güncelleştirmeleri (ilk kullanım için yükleme dışında) sorguları engellemez. Güncellemeler sırasında, bir sözlüğün eski sürümü kullanılır. Güncelleştirme sırasında bir hata oluşursa, hata sunucu günlüğüne yazılır ve sorgular sözlüklerin eski sürümünü kullanmaya devam eder. + +Ayarlar örneği: + +``` xml + + ... + 300 + ... + +``` + +``` sql +CREATE DICTIONARY (...) +... +LIFETIME(300) +... +``` + +Ayar `0` (`LIFETIME(0)`) söz dictionarieslük .lerin güncel updatinglenmesini engeller. + +Yükseltmeler için bir zaman aralığı ayarlayabilirsiniz ve ClickHouse bu aralıkta eşit rastgele bir zaman seçecektir. Bu, çok sayıda sunucuda yükseltme yaparken yükü sözlük kaynağına dağıtmak için gereklidir. + +Ayarlar örneği: + +``` xml + + ... + + 300 + 360 + + ... + +``` + +veya + +``` sql +LIFETIME(MIN 300 MAX 360) +``` + +Eğer `0` ve `0`, ClickHouse sözlüğü zaman aşımı ile yeniden yüklemez. +Bu durumda, Sözlük yapılandırma dosyası değiştirilmişse veya ClickHouse sözlüğü daha önce yeniden yükleyebilir. `SYSTEM RELOAD DICTIONARY` komut yürütüldü. + +Sözlükleri yükseltirken, ClickHouse sunucusu türüne bağlı olarak farklı mantık uygular [kaynaklı](external-dicts-dict-sources.md): + +Sözlükleri yükseltirken, ClickHouse sunucusu türüne bağlı olarak farklı mantık uygular [kaynaklı](external-dicts-dict-sources.md): + +- Bir metin dosyası için değişiklik zamanını kontrol eder. Zaman önceden kaydedilmiş zaman farklıysa, sözlük güncelleştirilir. +- Myısam tabloları için, değişiklik zamanı bir `SHOW TABLE STATUS` sorgu. +- Diğer kaynaklardan gelen sözlükler varsayılan olarak her zaman güncellenir. + +MySQL (InnoDB), ODBC ve ClickHouse kaynakları için, sözlükleri her seferinde değil, gerçekten değiştiyse güncelleyecek bir sorgu ayarlayabilirsiniz. Bunu yapmak için şu adımları izleyin: + +- Sözlük tablosu, kaynak verileri güncelleştirildiğinde her zaman değişen bir alana sahip olmalıdır. +- Kaynak ayarları, değişen alanı alan bir sorgu belirtmeniz gerekir. ClickHouse sunucu sorgu sonucu bir satır olarak yorumlar ve bu satır önceki durumuna göre değişmişse, sözlük güncelleştirilir. Sorguda belirtme `` için ayar fieldlardaki alan [kaynaklı](external-dicts-dict-sources.md). + +Ayarlar örneği: + +``` xml + + ... + + ... + SELECT update_time FROM dictionary_source where id = 1 + + ... + +``` + +veya + +``` sql +... +SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) +... +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md new file mode 100644 index 00000000000..912993fc462 --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md @@ -0,0 +1,608 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 43 +toc_title: "D\u0131\u015F S\xF6zl\xFCklerin kaynaklar\u0131" +--- + +# Dış Sözlüklerin Kaynakları {#dicts-external-dicts-dict-sources} + +Harici bir sözlük birçok farklı kaynaktan bağlanabilir. + +Sözlük xml dosyası kullanılarak yapılandırılmışsa, yapılandırma şöyle görünür: + +``` xml + + + ... + + + + + + ... + + ... + +``` + +Durumunda [DDL-sorgu](../../statements/create.md#create-dictionary-query), eşit yapılandırma gibi görünüyor olacak: + +``` sql +CREATE DICTIONARY dict_name (...) +... +SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration +... +``` + +Kaynak yapılandırılmış `source` bölme. + +Kaynak türleri (`source_type`): + +- [Yerel dosya](#dicts-external_dicts_dict_sources-local_file) +- [Yürütülebilir dosya](#dicts-external_dicts_dict_sources-executable) +- [HTTP (s)](#dicts-external_dicts_dict_sources-http) +- DBMS + - [ODBC](#dicts-external_dicts_dict_sources-odbc) + - [MySQL](#dicts-external_dicts_dict_sources-mysql) + - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) + - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) + - [Redis](#dicts-external_dicts_dict_sources-redis) + +## Yerel Dosya {#dicts-external_dicts_dict_sources-local_file} + +Ayarlar örneği: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + +``` + +veya + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Ayar alanları: + +- `path` – The absolute path to the file. +- `format` – The file format. All the formats described in “[Biçimliler](../../../interfaces/formats.md#formats)” desteklenir. + +## Yürütülebilir Dosya {#dicts-external_dicts_dict_sources-executable} + +Yürütülebilir dosyalarla çalışmak Aşağıdakilere bağlıdır [sözlük bellekte nasıl saklanır](external-dicts-dict-layout.md). Sözlük kullanılarak saklan theıyorsa `cache` ve `complex_key_cache` ClickHouse, yürütülebilir dosyanın STDIN’SİNE bir istek göndererek gerekli anahtarları ister. Aksi takdirde, clickhouse yürütülebilir dosyayı başlatır ve çıktısını sözlük verileri olarak değerlendirir. + +Ayarlar örneği: + +``` xml + + + cat /opt/dictionaries/os.tsv + TabSeparated + + +``` + +veya + +``` sql +SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +Ayar alanları: + +- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). +- `format` – The file format. All the formats described in “[Biçimliler](../../../interfaces/formats.md#formats)” desteklenir. + +## Http (s) {#dicts-external_dicts_dict_sources-http} + +Bir HTTP (s) sunucusuyla çalışmak Aşağıdakilere bağlıdır [sözlük bellekte nasıl saklanır](external-dicts-dict-layout.md). Sözlük kullanılarak saklan theıyorsa `cache` ve `complex_key_cache`, ClickHouse aracılığıyla bir istek göndererek gerekli anahtarları ister `POST` yöntem. + +Ayarlar örneği: + +``` xml + + + http://[::1]/os.tsv + TabSeparated + + user + password + + +
+ API-KEY + key +
+
+
+ +``` + +veya + +``` sql +SOURCE(HTTP( + url 'http://[::1]/os.tsv' + format 'TabSeparated' + credentials(user 'user' password 'password') + headers(header(name 'API-KEY' value 'key')) +)) +``` + +Clickhouse’un bir HTTPS kaynağına erişebilmesi için şunları yapmanız gerekir [openssl’yi yapılandırma](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-openssl) sunucu yapılandırmasında. + +Ayar alanları: + +- `url` – The source URL. +- `format` – The file format. All the formats described in “[Biçimliler](../../../interfaces/formats.md#formats)” desteklenir. +- `credentials` – Basic HTTP authentication. Optional parameter. + - `user` – Username required for the authentication. + - `password` – Password required for the authentication. +- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. + - `header` – Single HTTP header entry. + - `name` – Identifiant name used for the header send on the request. + - `value` – Value set for a specific identifiant name. + +## ODBC {#dicts-external_dicts_dict_sources-odbc} + +ODBC sürücüsü olan herhangi bir veritabanını bağlamak için bu yöntemi kullanabilirsiniz. + +Ayarlar örneği: + +``` xml + + + DatabaseName + ShemaName.TableName
+ DSN=some_parameters + SQL_QUERY +
+ +``` + +veya + +``` sql +SOURCE(ODBC( + db 'DatabaseName' + table 'SchemaName.TableName' + connection_string 'DSN=some_parameters' + invalidate_query 'SQL_QUERY' +)) +``` + +Ayar alanları: + +- `db` – Name of the database. Omit it if the database name is set in the `` parametre. +- `table` – Name of the table and schema if exists. +- `connection_string` – Connection string. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Sözlükleri güncelleme](external-dicts-dict-lifetime.md). + +ClickHouse, ODBC sürücüsünden alıntı sembolleri alır ve sorgulardaki tüm ayarları sürücüye aktarır, bu nedenle tablo adını veritabanındaki tablo adı durumuna göre ayarlamak gerekir. + +Oracle kullanırken kodlamalarla ilgili bir sorununuz varsa, ilgili [FAQ](../../../faq/general.md#oracle-odbc-encodings) makale. + +### ODBC Sözlük işlevselliği Bilinen güvenlik açığı {#known-vulnerability-of-the-odbc-dictionary-functionality} + +!!! attention "Dikkat" + ODBC sürücüsü bağlantı parametresi aracılığıyla veritabanına bağlanırken `Servername` yerine. Bu durumda değerler `USERNAME` ve `PASSWORD` itibaren `odbc.ini` uzak sunucuya gönderilir ve tehlikeye girebilir. + +**Güvensiz kullanım örneği** + +PostgreSQL için unixodbc’yi yapılandıralım. İçeriği `/etc/odbc.ini`: + +``` text +[gregtest] +Driver = /usr/lib/psqlodbca.so +Servername = localhost +PORT = 5432 +DATABASE = test_db +#OPTION = 3 +USERNAME = test +PASSWORD = test +``` + +Daha sonra aşağıdaki gibi bir sorgu yaparsanız + +``` sql +SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); +``` + +ODBC sürücüsü değerleri gönderir `USERNAME` ve `PASSWORD` itibaren `odbc.ini` -e doğru `some-server.com`. + +### PostgreSQL Bağlanma Örneği {#example-of-connecting-postgresql} + +UB .untu OS. + +PostgreSQL için UNİXODBC ve ODBC sürücüsünü yükleme: + +``` bash +$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql +``` + +Yapılandırma `/etc/odbc.ini` (veya `~/.odbc.ini`): + +``` text + [DEFAULT] + Driver = myconnection + + [myconnection] + Description = PostgreSQL connection to my_db + Driver = PostgreSQL Unicode + Database = my_db + Servername = 127.0.0.1 + UserName = username + Password = password + Port = 5432 + Protocol = 9.3 + ReadOnly = No + RowVersioning = No + ShowSystemTables = No + ConnSettings = +``` + +Clickhouse’da sözlük yapılandırması: + +``` xml + + + table_name + + + + + DSN=myconnection + postgresql_table
+
+ + + 300 + 360 + + + + + + + id + + + some_column + UInt64 + 0 + + +
+
+``` + +veya + +``` sql +CREATE DICTIONARY table_name ( + id UInt64, + some_column UInt64 DEFAULT 0 +) +PRIMARY KEY id +SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) +LAYOUT(HASHED()) +LIFETIME(MIN 300 MAX 360) +``` + +Düzenlemeniz gerekebilir `odbc.ini` sürücü ile kitaplığın tam yolunu belirtmek için `DRIVER=/usr/local/lib/psqlodbcw.so`. + +### MS SQL Server bağlanma örneği {#example-of-connecting-ms-sql-server} + +UB .untu OS. + +Sürücüyü yükleme: : + +``` bash +$ sudo apt-get install tdsodbc freetds-bin sqsh +``` + +Sürücüyü yapılandırma: + +``` bash + $ cat /etc/freetds/freetds.conf + ... + + [MSSQL] + host = 192.168.56.101 + port = 1433 + tds version = 7.0 + client charset = UTF-8 + + $ cat /etc/odbcinst.ini + ... + + [FreeTDS] + Description = FreeTDS + Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so + Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so + FileUsage = 1 + UsageCount = 5 + + $ cat ~/.odbc.ini + ... + + [MSSQL] + Description = FreeTDS + Driver = FreeTDS + Servername = MSSQL + Database = test + UID = test + PWD = test + Port = 1433 +``` + +Clickhouse’da sözlüğü yapılandırma: + +``` xml + + + test + + + dict
+ DSN=MSSQL;UID=test;PWD=test +
+ + + + 300 + 360 + + + + + + + + + k + + + s + String + + + +
+
+``` + +veya + +``` sql +CREATE DICTIONARY test ( + k UInt64, + s String DEFAULT '' +) +PRIMARY KEY k +SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) +LAYOUT(FLAT()) +LIFETIME(MIN 300 MAX 360) +``` + +## DBMS {#dbms} + +### Mysql {#dicts-external_dicts_dict_sources-mysql} + +Ayarlar örneği: + +``` xml + + + 3306 + clickhouse + qwerty + + example01-1 + 1 + + + example01-2 + 1 + + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +veya + +``` sql +SOURCE(MYSQL( + port 3306 + user 'clickhouse' + password 'qwerty' + replica(host 'example01-1' priority 1) + replica(host 'example01-2' priority 1) + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +Ayar alanları: + +- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). + +- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `replica` – Section of replica configurations. There can be multiple sections. + + - `replica/host` – The MySQL host. + - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. + +- `db` – Name of the database. + +- `table` – Name of the table. + +- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` MySQL, örneğin, `id > 10 AND id < 20`. İsteğe bağlı parametre. + +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Sözlükleri güncelleme](external-dicts-dict-lifetime.md). + +MySQL yuva üzerinden yerel bir ana bilgisayara bağlanabilir. Bunu yapmak için, ayarlayın `host` ve `socket`. + +Ayarlar örneği: + +``` xml + + + localhost + /path/to/socket/file.sock + clickhouse + qwerty + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +veya + +``` sql +SOURCE(MYSQL( + host 'localhost' + socket '/path/to/socket/file.sock' + user 'clickhouse' + password 'qwerty' + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +### ClickHouse {#dicts-external_dicts_dict_sources-clickhouse} + +Ayarlar örneği: + +``` xml + + + example01-01-1 + 9000 + default + + default + ids
+ id=10 +
+ +``` + +veya + +``` sql +SOURCE(CLICKHOUSE( + host 'example01-01-1' + port 9000 + user 'default' + password '' + db 'default' + table 'ids' + where 'id=10' +)) +``` + +Ayar alanları: + +- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [Dağılı](../../../engines/table-engines/special/distributed.md) tablo ve sonraki yapılandırmalarda girin. +- `port` – The port on the ClickHouse server. +- `user` – Name of the ClickHouse user. +- `password` – Password of the ClickHouse user. +- `db` – Name of the database. +- `table` – Name of the table. +- `where` – The selection criteria. May be omitted. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Sözlükleri güncelleme](external-dicts-dict-lifetime.md). + +### Mongodb {#dicts-external_dicts_dict_sources-mongodb} + +Ayarlar örneği: + +``` xml + + + localhost + 27017 + + + test + dictionary_source + + +``` + +veya + +``` sql +SOURCE(MONGO( + host 'localhost' + port 27017 + user '' + password '' + db 'test' + collection 'dictionary_source' +)) +``` + +Ayar alanları: + +- `host` – The MongoDB host. +- `port` – The port on the MongoDB server. +- `user` – Name of the MongoDB user. +- `password` – Password of the MongoDB user. +- `db` – Name of the database. +- `collection` – Name of the collection. + +### Redis {#dicts-external_dicts_dict_sources-redis} + +Ayarlar örneği: + +``` xml + + + localhost + 6379 + simple + 0 + + +``` + +veya + +``` sql +SOURCE(REDIS( + host 'localhost' + port 6379 + storage_type 'simple' + db_index 0 +)) +``` + +Ayar alanları: + +- `host` – The Redis host. +- `port` – The port on the Redis server. +- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` basit kaynaklar ve karma tek anahtar kaynaklar içindir, `hash_map` iki anahtarlı karma kaynaklar içindir. Ranged kaynakları ve karmaşık anahtarlı önbellek kaynakları desteklenmez. İhmal edilebilir, varsayılan değer `simple`. +- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md new file mode 100644 index 00000000000..bef68168a53 --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 44 +toc_title: "S\xF6zl\xFCk anahtar\u0131 ve alanlar\u0131" +--- + +# Sözlük anahtarı Ve alanları {#dictionary-key-and-fields} + +Bu `` yan tümcesi sözlük anahtarı ve sorgular için kullanılabilir alanları açıklar. + +XML açıklaması: + +``` xml + + + + Id + + + + + + + ... + + + +``` + +Nitelikler elemanlarda açıklanmıştır: + +- `` — [Anahtar sütun](external-dicts-dict-structure.md#ext_dict_structure-key). +- `` — [Veri sütunu](external-dicts-dict-structure.md#ext_dict_structure-attributes). Birden fazla sayıda özellik olabilir. + +DDL sorgusu: + +``` sql +CREATE DICTIONARY dict_name ( + Id UInt64, + -- attributes +) +PRIMARY KEY Id +... +``` + +Öznitelikler sorgu gövdesinde açıklanmıştır: + +- `PRIMARY KEY` — [Anahtar sütun](external-dicts-dict-structure.md#ext_dict_structure-key) +- `AttrName AttrType` — [Veri sütunu](external-dicts-dict-structure.md#ext_dict_structure-attributes). Birden fazla sayıda özellik olabilir. + +## Anahtar {#ext_dict_structure-key} + +ClickHouse aşağıdaki anahtar türlerini destekler: + +- Sayısal tuş. `UInt64`. Tanımlanan `` etiket veya kullanma `PRIMARY KEY` kelime. +- Kompozit anahtar. Farklı türde değerler kümesi. Etiket definedinde tanımlı `` veya `PRIMARY KEY` kelime. + +Bir xml yapısı şunları içerebilir `` veya ``. DDL sorgusu tek içermelidir `PRIMARY KEY`. + +!!! warning "Uyarıcı" + Anahtarı bir öznitelik olarak tanımlamamalısınız. + +### Sayısal Tuş {#ext_dict-numeric-key} + +Tür: `UInt64`. + +Yapılandırma örneği: + +``` xml + + Id + +``` + +Yapılandırma alanları: + +- `name` – The name of the column with keys. + +DDL sorgusu için: + +``` sql +CREATE DICTIONARY ( + Id UInt64, + ... +) +PRIMARY KEY Id +... +``` + +- `PRIMARY KEY` – The name of the column with keys. + +### Kompozit Anahtar {#composite-key} + +Anahtar bir olabilir `tuple` her türlü alandan. Bu [düzen](external-dicts-dict-layout.md) bu durumda olmalıdır `complex_key_hashed` veya `complex_key_cache`. + +!!! tip "Uç" + Bileşik bir anahtar tek bir elemandan oluşabilir. Bu, örneğin bir dizeyi anahtar olarak kullanmayı mümkün kılar. + +Anahtar yapısı eleman ayarlanır ``. Anahtar alanlar sözlük ile aynı biçimde belirtilir [öznitelik](external-dicts-dict-structure.md). Örnek: + +``` xml + + + + field1 + String + + + field2 + UInt32 + + ... + +... +``` + +veya + +``` sql +CREATE DICTIONARY ( + field1 String, + field2 String + ... +) +PRIMARY KEY field1, field2 +... +``` + +Bir sorgu için `dictGet*` fonksiyon, bir tuple anahtar olarak geçirilir. Örnek: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. + +## Öznitelik {#ext_dict_structure-attributes} + +Yapılandırma örneği: + +``` xml + + ... + + Name + ClickHouseDataType + + rand64() + true + true + true + + +``` + +veya + +``` sql +CREATE DICTIONARY somename ( + Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID +) +``` + +Yapılandırma alanları: + +| Etiket | Açıklama | Gerekli | +|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| +| `name` | Sütun adı. | Evet | +| `type` | ClickHouse veri türü.
ClickHouse, sözlükten belirtilen veri türüne değer atmaya çalışır. Örneğin, MySQL için alan olabilir `TEXT`, `VARCHAR`, veya `BLOB` MySQL kaynak tablosunda, ancak şu şekilde yüklenebilir `String` Clickhouse’da.
[Nullable](../../../sql-reference/data-types/nullable.md) desteklenmiyor. | Evet | +| `null_value` | Varolan olmayan bir öğe için varsayılan değer.
Örnekte, boş bir dizedir. Kullanamazsınız `NULL` bu alanda. | Evet | +| `expression` | [İfade](../../syntax.md#syntax-expressions) bu ClickHouse değeri yürütür.
İfade, uzak SQL veritabanında bir sütun adı olabilir. Bu nedenle, uzak sütun için bir diğer ad oluşturmak için kullanabilirsiniz.

Varsayılan değer: ifade yok. | Hayır | +| `hierarchical` | Eğer `true`, öznitelik, geçerli anahtar için bir üst anahtarın değerini içerir. Görmek [Hiyerarşik Sözlükler](external-dicts-dict-hierarchical.md).

Varsayılan değer: `false`. | Hayır | +| `injective` | Olup olmadığını gösteren bayrak `id -> attribute` ima isge is [enjektif](https://en.wikipedia.org/wiki/Injective_function).
Eğer `true`, ClickHouse sonra otomatik olarak yerleştirebilirsiniz `GROUP BY` fık .ra ile ilgili istek dictionariesleriniz Genellikle bu tür taleplerin miktarını önemli ölçüde azaltır.

Varsayılan değer: `false`. | Hayır | +| `is_object_id` | Bir MongoDB belgesi için sorgunun yürütülüp yürütülmediğini gösteren bayrak `ObjectID`.

Varsayılan değer: `false`. | Hayır | + +## Ayrıca Bakınız {#see-also} + +- [Harici sözlüklerle çalışmak için işlevler](../../../sql-reference/functions/ext-dict-functions.md). + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md new file mode 100644 index 00000000000..aea4edbbfd3 --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md @@ -0,0 +1,53 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 40 +toc_title: "Harici bir s\xF6zl\xFCk yap\u0131land\u0131rma" +--- + +# Harici Bir sözlük yapılandırma {#dicts-external-dicts-dict} + +Sözlük xml dosyası kullanılarak yapılandırılmışsa, sözlük yapılandırması aşağıdaki yapıya sahiptir: + +``` xml + + dict_name + + + + + + + + + + + + + + + + + +``` + +İlgili [DDL-sorgu](../../statements/create.md#create-dictionary-query) aşağıdaki yapıya sahiptir: + +``` sql +CREATE DICTIONARY dict_name +( + ... -- attributes +) +PRIMARY KEY ... -- complex or single key configuration +SOURCE(...) -- Source configuration +LAYOUT(...) -- Memory layout configuration +LIFETIME(...) -- Lifetime of dictionary in memory +``` + +- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. +- [kaynaklı](external-dicts-dict-sources.md) — Source of the dictionary. +- [düzen](external-dicts-dict-layout.md) — Dictionary layout in memory. +- [yapılı](external-dicts-dict-structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. +- [ömür](external-dicts-dict-lifetime.md) — Frequency of dictionary updates. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts.md new file mode 100644 index 00000000000..9729b7f9b39 --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/external-dictionaries/external-dicts.md @@ -0,0 +1,56 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 39 +toc_title: "Genel A\xE7\u0131klama" +--- + +# Dış Söz Dictionarieslükler {#dicts-external-dicts} + +Çeşitli veri kaynaklarından kendi sözlükleri ekleyebilirsiniz. Bir sözlük için veri kaynağı, yerel bir metin veya yürütülebilir dosya, bir HTTP(s) kaynağı veya başka bir DBMS olabilir. Daha fazla bilgi için, bkz. “[Dış sözlükler için kaynaklar](external-dicts-dict-sources.md)”. + +ClickHouse: + +- Sözlükleri RAM’de tamamen veya kısmen saklar. +- Sözlükleri periyodik olarak günceller ve eksik değerleri dinamik olarak yükler. Başka bir deyişle, sözlükler dinamik olarak yüklenebilir. +- Xml dosyaları ile harici sözlükler oluşturmak için izin verir veya [DDL sorguları](../../statements/create.md#create-dictionary-query). + +Dış sözlüklerin yapılandırması bir veya daha fazla xml dosyasında bulunabilir. Yapılandırma yolu belirtilen [dictionaries\_config](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_config) parametre. + +Sözlükler sunucu başlangıçta veya ilk kullanımda, bağlı olarak yüklenebilir [dictionaries\_lazy\_load](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) ayar. + +Sözlük yapılandırma dosyası aşağıdaki biçime sahiptir: + +``` xml + + An optional element with any content. Ignored by the ClickHouse server. + + + /etc/metrika.xml + + + + + + + + +``` + +Yapabilirsin [yapılandırmak](external-dicts-dict.md) aynı dosyada sözlükler herhangi bir sayıda. + +[Sözlükler için DDL sorguları](../../statements/create.md#create-dictionary-query) sunucu yapılandırmasında herhangi bir ek kayıt gerektirmez. Tablolar veya görünümler gibi birinci sınıf varlıklar olarak sözlüklerle çalışmaya izin verirler. + +!!! attention "Dikkat" + Küçük bir sözlük için değerleri, bir `SELECT` sorgu (bkz. [dönüştürmek](../../../sql-reference/functions/other-functions.md) işlev). Bu işlevsellik harici sözlüklerle ilgili değildir. + +## Ayrıca Bakınız {#ext-dicts-see-also} + +- [Harici bir sözlük yapılandırma](external-dicts-dict.md) +- [Sözlükleri bellekte saklama](external-dicts-dict-layout.md) +- [Sözlük Güncellemeleri](external-dicts-dict-lifetime.md) +- [Dış Sözlüklerin kaynakları](external-dicts-dict-sources.md) +- [Sözlük anahtarı ve alanları](external-dicts-dict-structure.md) +- [Harici Sözlüklerle çalışmak için işlevler](../../../sql-reference/functions/ext-dict-functions.md) + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/index.md b/docs/tr/sql-reference/dictionaries/external-dictionaries/index.md similarity index 100% rename from docs/tr/sql_reference/dictionaries/external_dictionaries/index.md rename to docs/tr/sql-reference/dictionaries/external-dictionaries/index.md diff --git a/docs/tr/sql-reference/dictionaries/index.md b/docs/tr/sql-reference/dictionaries/index.md new file mode 100644 index 00000000000..991d712aef7 --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "S\xF6zl\xFCkler" +toc_priority: 35 +toc_title: "Giri\u015F" +--- + +# Sözlükler {#dictionaries} + +Bir sözlük bir haritalama (`key -> attributes`) bu referans listeleri çeşitli türleri için uygundur. + +ClickHouse, sorgularda kullanılabilecek sözlüklerle çalışmak için özel işlevleri destekler. Sözlükleri işlevlerle kullanmak daha kolay ve daha verimlidir. `JOIN` referans tabloları ile. + +[NULL](../syntax.md#null) değerler sözlükte saklanamaz. + +ClickHouse destekler: + +- [Dahili sözlükler](internal-dicts.md#internal_dicts) bir özel ile [fonksiyonlar kümesi](../../sql-reference/functions/ym-dict-functions.md). +- [Eklenti (harici) söz dictionarieslükler](external-dictionaries/external-dicts.md) ile bir [fonksiyonlar net](../../sql-reference/functions/ext-dict-functions.md). + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/tr/sql-reference/dictionaries/internal-dicts.md b/docs/tr/sql-reference/dictionaries/internal-dicts.md new file mode 100644 index 00000000000..25ca32fe2ff --- /dev/null +++ b/docs/tr/sql-reference/dictionaries/internal-dicts.md @@ -0,0 +1,55 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 39 +toc_title: "\u0130\xE7 S\xF6z Dictionariesl\xFCkler" +--- + +# İç söz dictionarieslükler {#internal_dicts} + +ClickHouse, bir geobase ile çalışmak için yerleşik bir özellik içerir. + +Bu size sağlar: + +- Adını istediğiniz dilde almak için bölgenin kimliğini kullanın. +- Bir şehir, bölge, federal bölge, ülke veya kıtanın kimliğini almak için bölgenin kimliğini kullanın. +- Bir bölgenin başka bir bölgenin parçası olup olmadığını kontrol edin. +- Ana bölgeler zinciri alın. + +Tüm fonksiyonları destek “translocality,” aynı anda bölge mülkiyeti farklı bakış açıları kullanma yeteneği. Daha fazla bilgi için bölüme bakın “Functions for working with Yandex.Metrica dictionaries”. + +İç sözlükler varsayılan pakette devre dışı bırakılır. +Bunları etkinleştirmek için, parametreleri uncomment `path_to_regions_hierarchy_file` ve `path_to_regions_names_files` sunucu yapılandırma dosyasında. + +Geobase metin dosyalarından yüklenir. + +Place the `regions_hierarchy*.txt` dosyaları içine `path_to_regions_hierarchy_file` dizin. Bu yapılandırma parametresi, `regions_hierarchy.txt` dosya (varsayılan bölgesel hiyerarşi) ve diğer dosyalar (`regions_hierarchy_ua.txt`) aynı dizinde bulunmalıdır. + +Koy… `regions_names_*.txt` dosyalar içinde `path_to_regions_names_files` dizin. + +Bu dosyaları kendiniz de oluşturabilirsiniz. Dosya biçimi aşağıdaki gibidir: + +`regions_hierarchy*.txt`: TabSeparated (başlık yok), sütunlar: + +- bölge kimliği (`UInt32`) +- üst bölge kimliği (`UInt32`) +- bölge tipi (`UInt8`): 1 - kıta, 3-ülke, 4-federal bölge, 5-bölge, 6-şehir; diğer türlerin değerleri yoktur +- nüfuslu (`UInt32`) — optional column + +`regions_names_*.txt`: TabSeparated (başlık yok), sütunlar: + +- bölge kimliği (`UInt32`) +- bölge adı (`String`) — Can’t contain tabs or line feeds, even escaped ones. + +RAM’de depolamak için düz bir dizi kullanılır. Bu nedenle, IDs bir milyondan fazla olmamalıdır. + +Sözlükler sunucuyu yeniden başlatmadan güncellenebilir. Ancak, kullanılabilir sözlükler kümesi güncelleştirilmez. +Güncellemeler için dosya değiştirme süreleri kontrol edilir. Bir dosya değiştiyse, sözlük güncelleştirilir. +Değişiklikleri kontrol etmek için Aralık `builtin_dictionaries_reload_interval` parametre. +Sözlük güncelleştirmeleri (ilk kullanımda yükleme dışında) sorguları engellemez. Güncelleştirmeler sırasında, sorgular sözlüklerin eski sürümlerini kullanır. Güncelleştirme sırasında bir hata oluşursa, hata sunucu günlüğüne yazılır ve sorgular sözlüklerin eski sürümünü kullanmaya devam eder. + +Sözlükleri geobase ile periyodik olarak güncellemenizi öneririz. Bir güncelleme sırasında yeni dosyalar oluşturun ve bunları ayrı bir konuma yazın. Her şey hazır olduğunda, bunları sunucu tarafından kullanılan dosyalara yeniden adlandırın. + +OS tanımlayıcıları ve Yandex ile çalışmak için işlevler de vardır.Metrica arama motorları, ancak kullanılmamalıdır. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/tr/sql-reference/functions/arithmetic-functions.md b/docs/tr/sql-reference/functions/arithmetic-functions.md new file mode 100644 index 00000000000..e6d2560e50c --- /dev/null +++ b/docs/tr/sql-reference/functions/arithmetic-functions.md @@ -0,0 +1,87 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 35 +toc_title: Aritmetik +--- + +# Aritmetik Fonksiyonlar {#arithmetic-functions} + +Tüm aritmetik işlevler için, sonuç türü, böyle bir tür varsa, sonucun sığdığı en küçük sayı türü olarak hesaplanır. Minimum, bit sayısına, imzalanıp imzalanmadığına ve yüzüp yüzmediğine bağlı olarak aynı anda alınır. Yeterli bit yoksa, en yüksek bit türü alınır. + +Örnek: + +``` sql +SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) +``` + +``` text +┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ +│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ +└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ +``` + +Aritmetik fonksiyonlar, uint8, Uİnt16, Uİnt32, Uint64, Int8, Int16, Int32, Int64, Float32 veya Float64 türlerinden herhangi bir çift için çalışır. + +Taşma, C++ile aynı şekilde üretilir. + +## artı (a, b), A + B operatörü {#plusa-b-a-b-operator} + +Sayıların toplamını hesaplar. +Ayrıca bir tarih veya tarih ve Saat ile tamsayı numaraları ekleyebilirsiniz. Bir tarih durumunda, bir tamsayı eklemek, karşılık gelen gün sayısını eklemek anlamına gelir. Zamanla bir tarih için, karşılık gelen saniye sayısını eklemek anlamına gelir. + +## eksi (a, b), A - B operatörü {#minusa-b-a-b-operator} + +Farkı hesaplar. Sonuç her zaman imzalanır. + +You can also calculate integer numbers from a date or date with time. The idea is the same – see above for ‘plus’. + +## çarp operatorma (a, b), A \* B operatörü {#multiplya-b-a-b-operator} + +Sayıların ürününü hesaplar. + +## böl (a, b), A / B operatörü {#dividea-b-a-b-operator} + +Sayıların bölümünü hesaplar. Sonuç türü her zaman bir kayan nokta türüdür. +Tam sayı bölümü değildir. Tamsayı bölümü için, ‘intDiv’ işlev. +Sıfıra bölerek zaman olsun ‘inf’, ‘-inf’, veya ‘nan’. + +## ıntdiv(a, b) {#intdiva-b} + +Sayıların bölümünü hesaplar. Tamsayılara bölünür, yuvarlanır (mutlak değere göre). +Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. + +## ıntdivorzero(a, b) {#intdivorzeroa-b} + +Farklıdır ‘intDiv’ bu, sıfıra bölünürken veya en az bir negatif sayıyı eksi bir ile bölerek sıfır döndürür. + +## modulo (a, b), A % B operatörü {#moduloa-b-a-b-operator} + +Bölünmeden sonra kalan hesaplar. +Bağımsız değişkenler kayan nokta sayılarıysa, ondalık bölümü bırakarak tamsayılara önceden dönüştürülürler. +Kalan C++ile aynı anlamda alınır. Kesik bölme negatif sayılar için kullanılır. +Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. + +## moduloOrZero(a, b) {#moduloorzeroa-b} + +Farklıdır ‘modulo’ bölen sıfır olduğunda sıfır döndürür. + +## negate (a), - bir operatör {#negatea-a-operator} + +Ters işareti ile bir sayı hesaplar. Sonuç her zaman imzalanır. + +## abs (a) {#arithm_func-abs} + +\(A) sayısının mutlak değerini hesaplar. Yani, \< 0 ise,- A döndürür. imzasız türler için hiçbir şey yapmaz. İmzalı tamsayı türleri için imzasız bir sayı döndürür. + +## gcd (a, b) {#gcda-b} + +Sayıların en büyük ortak böleni döndürür. +Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. + +## lcm(a, b) {#lcma-b} + +Sayıların en az ortak katını döndürür. +Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/tr/sql-reference/functions/array-functions.md b/docs/tr/sql-reference/functions/array-functions.md new file mode 100644 index 00000000000..df6ab65edc5 --- /dev/null +++ b/docs/tr/sql-reference/functions/array-functions.md @@ -0,0 +1,1061 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 46 +toc_title: "Dizilerle \xE7al\u0131\u015Fma" +--- + +# Dizilerle çalışmak için işlevler {#functions-for-working-with-arrays} + +## boş {#function-empty} + +Boş bir dizi için 1 veya boş olmayan bir dizi için 0 döndürür. +Sonuç türü Uint8’dir. +İşlev ayrıca dizeler için de çalışır. + +## notEmpty {#function-notempty} + +Boş bir dizi için 0 veya boş olmayan bir dizi için 1 döndürür. +Sonuç türü Uint8’dir. +İşlev ayrıca dizeler için de çalışır. + +## uzunluk {#array_functions-length} + +Dizideki öğe sayısını döndürür. +Sonuç türü Uint64’tür. +İşlev ayrıca dizeler için de çalışır. + +## emptyArrayUİnt8, emptyArrayUİnt16, emptyArrayUİnt32, emptyArrayUİnt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} + +## emptyArrayİnt8, emptyArrayİnt16, emptyArrayİnt32, emptyArrayİnt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} + +## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} + +## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} + +## emptyArrayString {#emptyarraystring} + +Sıfır bağımsız değişkeni kabul eder ve uygun türde boş bir dizi döndürür. + +## emptyArrayToSingle {#emptyarraytosingle} + +Boş bir dizi kabul eder ve varsayılan değere eşit bir tek öğe dizisi döndürür. + +## Aralık (bitiş), Aralık(başlangıç, bitiş \[, adım\]) {#rangeend-rangestart-end-step} + +1 Adım-başından sonuna kadar sayıların bir dizi döndürür. +Eğer argüman `start` belirtilmemiş, varsayılan olarak 0. +Eğer argüman `step` belirtilmemiş, varsayılan olarak 1. +Neredeyse pythonic gibi davranışlar `range`. Ancak fark, tüm argümanların tipinin olması gerektiğidir `UInt` şiir. +Bir veri bloğunda toplam uzunluğu 100.000.000’den fazla öğe olan diziler oluşturulursa, bir istisna atılır. + +## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} + +İşlev bağımsız değişkenlerinden bir dizi oluşturur. +Bağımsız değişkenler sabit olmalı ve en küçük ortak türe sahip türlere sahip olmalıdır. En az bir argüman geçirilmelidir, çünkü aksi takdirde hangi tür dizinin oluşturulacağı açık değildir. Yani, boş bir dizi oluşturmak için bu işlevi kullanamazsınız (bunu yapmak için, ‘emptyArray\*’ fonksiyon yukarıda açıklandığı. +Ret anur anns an ‘Array(T)’ sonucu yazın, nerede ‘T’ geçirilen bağımsız değişkenlerin en küçük ortak türüdür. + +## arrayConcat {#arrayconcat} + +Argüman olarak geçirilen dizileri birleştirir. + +``` sql +arrayConcat(arrays) +``` + +**Parametre** + +- `arrays` – Arbitrary number of arguments of [Dizi](../../sql-reference/data-types/array.md) tür. + **Örnek** + + + +``` sql +SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,3,4,5,6] │ +└───────────────┘ +``` + +## arrayElement (arr, n), operatör arr\[n\] {#arrayelementarr-n-operator-arrn} + +İnd theex ile eleman alın `n` diz theiden `arr`. `n` herhangi bir tamsayı türü olmalıdır. +Bir dizideki dizinler birinden başlar. +Negatif dizinler desteklenir. Bu durumda, sondan numaralandırılmış ilgili elemanı seçer. Mesela, `arr[-1]` dizideki son öğedir. + +Dizin bir dizinin sınırlarının dışına düşerse, bazı varsayılan değer döndürür (sayılar için 0, dizeler için boş bir dize vb.).), sabit olmayan bir dizi ve sabit bir dizin 0 olan durum hariç (bu durumda bir hata olacaktır `Array indices are 1-based`). + +## has (arr, elem) {#hasarr-elem} + +Olup olmadığını denetler ‘arr’ dizi var ‘elem’ öğe. +Öğe dizide değilse 0 veya varsa 1 değerini döndürür. + +`NULL` değer olarak iş islenir. + +``` sql +SELECT has([1, 2, NULL], NULL) +``` + +``` text +┌─has([1, 2, NULL], NULL)─┐ +│ 1 │ +└─────────────────────────┘ +``` + +## hasAll {#hasall} + +Bir dizi başka bir alt kümesi olup olmadığını denetler. + +``` sql +hasAll(set, subset) +``` + +**Parametre** + +- `set` – Array of any type with a set of elements. +- `subset` – Array of any type with elements that should be tested to be a subset of `set`. + +**Dönüş değerleri** + +- `1`, eğer `set` tüm öğeleri içerir `subset`. +- `0`, başka. + +**Tuhaf özellikler** + +- Boş bir dizi, herhangi bir dizinin bir alt kümesidir. +- `Null` bir değer olarak işlenir. +- Her iki dizideki değerlerin sırası önemli değil. + +**Örnekler** + +`SELECT hasAll([], [])` döner 1. + +`SELECT hasAll([1, Null], [Null])` döner 1. + +`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` döner 1. + +`SELECT hasAll(['a', 'b'], ['a'])` döner 1. + +`SELECT hasAll([1], ['a'])` 0 döndürür. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` 0 döndürür. + +## hasAny {#hasany} + +İki dizinin bazı öğelerle kesiştiği olup olmadığını kontrol eder. + +``` sql +hasAny(array1, array2) +``` + +**Parametre** + +- `array1` – Array of any type with a set of elements. +- `array2` – Array of any type with a set of elements. + +**Dönüş değerleri** + +- `1`, eğer `array1` ve `array2` en azından benzer bir öğeye sahip olun. +- `0`, başka. + +**Tuhaf özellikler** + +- `Null` bir değer olarak işlenir. +- Her iki dizideki değerlerin sırası önemli değil. + +**Örnekler** + +`SELECT hasAny([1], [])` dönüşler `0`. + +`SELECT hasAny([Null], [Null, 1])` dönüşler `1`. + +`SELECT hasAny([-128, 1., 512], [1])` dönüşler `1`. + +`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` dönüşler `0`. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` dönüşler `1`. + +## ındexof(arr, x) {#indexofarr-x} + +İlk dizini döndürür ‘x’ dizide ise öğe (1’den başlayarak) veya değilse 0. + +Örnek: + +``` sql +SELECT indexOf([1, 3, NULL, NULL], NULL) +``` + +``` text +┌─indexOf([1, 3, NULL, NULL], NULL)─┐ +│ 3 │ +└───────────────────────────────────┘ +``` + +Elem setents set to `NULL` normal değerler olarak ele alınır. + +## countEqual(arr, x) {#countequalarr-x} + +X eşit dizideki öğelerin sayısını döndürür. Arraycount eşdeğer (elem - \> elem = x, arr). + +`NULL` öğeler ayrı değerler olarak işlenir. + +Örnek: + +``` sql +SELECT countEqual([1, 2, NULL, NULL], NULL) +``` + +``` text +┌─countEqual([1, 2, NULL, NULL], NULL)─┐ +│ 2 │ +└──────────────────────────────────────┘ +``` + +## arrayEnumerate(arr) {#array_functions-arrayenumerate} + +Returns the array \[1, 2, 3, …, length (arr) \] + +Bu işlev normalde ARRAY JOIN ile kullanılır. ARRAY JOİN uyguladıktan sonra her dizi için sadece bir kez bir şey saymaya izin verir. Örnek: + +``` sql +SELECT + count() AS Reaches, + countIf(num = 1) AS Hits +FROM test.hits +ARRAY JOIN + GoalsReached, + arrayEnumerate(GoalsReached) AS num +WHERE CounterID = 160656 +LIMIT 10 +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +Bu örnekte, Reaches dönüşümlerin sayısıdır (ARRAY JOİN uygulandıktan sonra alınan dizeler) ve İsabetler sayfa görüntüleme sayısıdır (ARRAY JOİN önce dizeler). Bu özel durumda, aynı sonucu daha kolay bir şekilde alabilirsiniz: + +``` sql +SELECT + sum(length(GoalsReached)) AS Reaches, + count() AS Hits +FROM test.hits +WHERE (CounterID = 160656) AND notEmpty(GoalsReached) +``` + +``` text +┌─Reaches─┬──Hits─┐ +│ 95606 │ 31406 │ +└─────────┴───────┘ +``` + +Bu fonksiyon aynı zamanda yüksek mertebeden fonksiyonlarda da kullanılabilir. Örneğin, bir koşulla eşleşen öğeler için dizi dizinleri almak için kullanabilirsiniz. + +## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} + +Kaynak diziyle aynı boyutta bir dizi döndürür ve her öğe için aynı değere sahip öğeler arasında konumunun ne olduğunu gösterir. +Örneğin: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. + +Bu işlev, dizi birleştirme ve dizi öğelerinin toplanmasını kullanırken kullanışlıdır. +Örnek: + +``` sql +SELECT + Goals.ID AS GoalID, + sum(Sign) AS Reaches, + sumIf(Sign, num = 1) AS Visits +FROM test.visits +ARRAY JOIN + Goals, + arrayEnumerateUniq(Goals.ID) AS num +WHERE CounterID = 160656 +GROUP BY GoalID +ORDER BY Reaches DESC +LIMIT 10 +``` + +``` text +┌──GoalID─┬─Reaches─┬─Visits─┐ +│ 53225 │ 3214 │ 1097 │ +│ 2825062 │ 3188 │ 1097 │ +│ 56600 │ 2803 │ 488 │ +│ 1989037 │ 2401 │ 365 │ +│ 2830064 │ 2396 │ 910 │ +│ 1113562 │ 2372 │ 373 │ +│ 3270895 │ 2262 │ 812 │ +│ 1084657 │ 2262 │ 345 │ +│ 56599 │ 2260 │ 799 │ +│ 3271094 │ 2256 │ 812 │ +└─────────┴─────────┴────────┘ +``` + +Bu örnekte, her hedef kimliğinin dönüşüm sayısı (hedefler iç içe geçmiş veri yapısındaki her öğe, bir dönüşüm olarak adlandırdığımız ulaşılan bir hedeftir) ve oturum sayısı Hesaplaması vardır. ARRAY JOİN olmadan, oturum sayısını sum(Sign) olarak sayardık. Ancak bu özel durumda, satırlar iç içe geçmiş hedefler yapısıyla çarpıldı, bu nedenle her oturumu bir kez saymak için arrayenumerateuniq değerine bir koşul uyguluyoruz(Goals.ID) fonksiyonu. + +Arrayenumerateuniq işlevi, bağımsız değişkenlerle aynı boyutta birden çok dizi alabilir. Bu durumda, tüm dizilerde aynı konumlardaki elemanların tuplesleri için benzersizlik düşünülür. + +``` sql +SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res +``` + +``` text +┌─res───────────┐ +│ [1,2,1,1,2,1] │ +└───────────────┘ +``` + +Bu, iç içe geçmiş bir veri yapısı ve bu yapıdaki birden çok öğe arasında daha fazla toplama ile dizi birleşimini kullanırken gereklidir. + +## arrayPopBack {#arraypopback} + +Son öğeyi diziden kaldırır. + +``` sql +arrayPopBack(array) +``` + +**Parametre** + +- `array` – Array. + +**Örnek** + +``` sql +SELECT arrayPopBack([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## arrayPopFront {#arraypopfront} + +İlk öğeyi diziden kaldırır. + +``` sql +arrayPopFront(array) +``` + +**Parametre** + +- `array` – Array. + +**Örnek** + +``` sql +SELECT arrayPopFront([1, 2, 3]) AS res +``` + +``` text +┌─res───┐ +│ [2,3] │ +└───────┘ +``` + +## arrayPushBack {#arraypushback} + +Dizinin sonuna bir öğe ekler. + +``` sql +arrayPushBack(array, single_value) +``` + +**Parametre** + +- `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` dizinin veri türü için yazın. Clickhouse’daki veri türleri hakkında daha fazla bilgi için bkz. “[Veri türleri](../../sql-reference/data-types/index.md#data_types)”. Olabilir `NULL`. Fonksiyon bir ekler `NULL` bir dizi için öğe ve dizi öğeleri türü dönüştürür `Nullable`. + +**Örnek** + +``` sql +SELECT arrayPushBack(['a'], 'b') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayPushFront {#arraypushfront} + +Dizinin başına bir öğe ekler. + +``` sql +arrayPushFront(array, single_value) +``` + +**Parametre** + +- `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` dizinin veri türü için yazın. Clickhouse’daki veri türleri hakkında daha fazla bilgi için bkz. “[Veri türleri](../../sql-reference/data-types/index.md#data_types)”. Olabilir `NULL`. Fonksiyon bir ekler `NULL` bir dizi için öğe ve dizi öğeleri türü dönüştürür `Nullable`. + +**Örnek** + +``` sql +SELECT arrayPushFront(['b'], 'a') AS res +``` + +``` text +┌─res───────┐ +│ ['a','b'] │ +└───────────┘ +``` + +## arrayResize {#arrayresize} + +Dizinin uzunluğunu değiştirir. + +``` sql +arrayResize(array, size[, extender]) +``` + +**Parametre:** + +- `array` — Array. +- `size` — Required length of the array. + - Eğer `size` dizinin orijinal boyutundan daha az, dizi sağdan kesilir. +- Eğer `size` dizinin başlangıç boyutundan daha büyük, dizi sağa uzatılır `extender` dizi öğelerinin veri türü için değerler veya varsayılan değerler. +- `extender` — Value for extending an array. Can be `NULL`. + +**Döndürülen değer:** + +Bir dizi uzunluk `size`. + +**Arama örnekleri** + +``` sql +SELECT arrayResize([1], 3) +``` + +``` text +┌─arrayResize([1], 3)─┐ +│ [1,0,0] │ +└─────────────────────┘ +``` + +``` sql +SELECT arrayResize([1], 3, NULL) +``` + +``` text +┌─arrayResize([1], 3, NULL)─┐ +│ [1,NULL,NULL] │ +└───────────────────────────┘ +``` + +## arraySlice {#arrayslice} + +Dizinin bir dilimini döndürür. + +``` sql +arraySlice(array, offset[, length]) +``` + +**Parametre** + +- `array` – Array of data. +- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. +- `length` - Gerekli dilimin uzunluğu. Negatif bir değer belirtirseniz, işlev açık bir dilim döndürür `[offset, array_length - length)`. Değeri atlarsanız, işlev dilimi döndürür `[offset, the_end_of_array]`. + +**Örnek** + +``` sql +SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res +``` + +``` text +┌─res────────┐ +│ [2,NULL,4] │ +└────────────┘ +``` + +Ar arrayray elem toents set to `NULL` normal değerler olarak ele alınır. + +## arraySort(\[func,\] arr, …) {#array_functions-sort} + +Elemanları sıralar `arr` artan düzende dizi. Eğer… `func` fonksiyonu belirtilir, sıralama düzeni sonucu belirlenir `func` fonksiyon dizinin elemanlarına uygulanır. Eğer `func` birden fazla argüman kabul eder, `arraySort` fonksiyon argümanları birkaç diziler geçirilir `func` karşılık gelir. Ayrıntılı örnekler sonunda gösterilir `arraySort` açıklama. + +Tamsayı değerleri sıralama örneği: + +``` sql +SELECT arraySort([1, 3, 3, 0]); +``` + +``` text +┌─arraySort([1, 3, 3, 0])─┐ +│ [0,1,3,3] │ +└─────────────────────────┘ +``` + +Dize değerleri sıralama örneği: + +``` sql +SELECT arraySort(['hello', 'world', '!']); +``` + +``` text +┌─arraySort(['hello', 'world', '!'])─┐ +│ ['!','hello','world'] │ +└────────────────────────────────────┘ +``` + +Aşağıdaki sıralama sırasını göz önünde bulundurun `NULL`, `NaN` ve `Inf` değerler: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); +``` + +``` text +┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ +│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────────────────────────┘ +``` + +- `-Inf` değerler dizide ilk sırada yer alır. +- `NULL` değerler dizideki son değerlerdir. +- `NaN` değerler hemen önce `NULL`. +- `Inf` değerler hemen önce `NaN`. + +Not thate that `arraySort` is a [yüksek sipariş fonksiyonu](higher-order-functions.md). Bir lambda işlevini ilk argüman olarak iletebilirsiniz. Bu durumda, sıralama sırası, dizinin elemanlarına uygulanan lambda işlevinin sonucu ile belirlenir. + +Aşağıdaki örneği ele alalım: + +``` sql +SELECT arraySort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,2,1] │ +└─────────┘ +``` + +For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` fonksiyon tuşları artan sırayla sıralar, sonuç \[3, 2, 1\]. Böylece, `(x) –> -x` lambda fonksiyonu setleri [azalan düzen](#array_functions-reverse-sort) bir sıralama içinde. + +Lambda işlevi birden çok bağımsız değişken kabul edebilir. Bu durumda, geçmek gerekir `arraySort` işlev lambda işlevinin argümanlarının karşılık geleceği aynı uzunlukta birkaç dizi. Elde edilen dizi ilk giriş dizisinden elemanlardan oluşacaktır; bir sonraki giriş dizilerinden elemanlar sıralama anahtarlarını belirtir. Mesela: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Burada, ikinci dizide (\[2, 1\]) geçirilen öğeler, kaynak diziden karşılık gelen öğe için bir sıralama anahtarı tanımlar (\[‘hello’, ‘world’\]), bu, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn’t use `x`, kaynak dizinin gerçek değerleri sonuçtaki sırayı etkilemez. Böyle, ‘hello’ sonuçtaki ikinci eleman olacak ve ‘world’ ilk olacak. + +Diğer örnekler aşağıda gösterilmiştir. + +``` sql +SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +``` sql +SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +!!! note "Not" + Sıralama verimliliğini artırmak için, [Schwartzian dönüşümü](https://en.wikipedia.org/wiki/Schwartzian_transform) kullanılır. + +## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} + +Elemanları sıralar `arr` azalan sırayla dizi. Eğer… `func` fonksiyon belirtilir, `arr` sonucuna göre sıra islanır. `func` işlev dizinin öğelerine uygulanır ve sonra sıralanmış dizi tersine çevrilir. Eğer `func` birden fazla argüman kabul eder, `arrayReverseSort` fonksiyon argümanları birkaç diziler geçirilir `func` karşılık gelir. Ayrıntılı örnekler sonunda gösterilir `arrayReverseSort` açıklama. + +Tamsayı değerleri sıralama örneği: + +``` sql +SELECT arrayReverseSort([1, 3, 3, 0]); +``` + +``` text +┌─arrayReverseSort([1, 3, 3, 0])─┐ +│ [3,3,1,0] │ +└────────────────────────────────┘ +``` + +Dize değerleri sıralama örneği: + +``` sql +SELECT arrayReverseSort(['hello', 'world', '!']); +``` + +``` text +┌─arrayReverseSort(['hello', 'world', '!'])─┐ +│ ['world','hello','!'] │ +└───────────────────────────────────────────┘ +``` + +Aşağıdaki sıralama sırasını göz önünde bulundurun `NULL`, `NaN` ve `Inf` değerler: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; +``` + +``` text +┌─res───────────────────────────────────┐ +│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────┘ +``` + +- `Inf` değerler dizide ilk sırada yer alır. +- `NULL` değerler dizideki son değerlerdir. +- `NaN` değerler hemen önce `NULL`. +- `-Inf` değerler hemen önce `NaN`. + +Not `arrayReverseSort` is a [yüksek sipariş fonksiyonu](higher-order-functions.md). Bir lambda işlevini ilk argüman olarak iletebilirsiniz. Örnek aşağıda gösterilmiştir. + +``` sql +SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [1,2,3] │ +└─────────┘ +``` + +Dizi aşağıdaki şekilde sıralanır: + +1. İlk başta, kaynak dizi (\[1, 2, 3\]), dizinin elemanlarına uygulanan lambda işlevinin sonucuna göre sıralanır. Sonuç bir dizidir \[3, 2, 1\]. +2. Önceki adımda elde edilen dizi tersine çevrilir. Yani, nihai sonuç \[1, 2, 3\]. + +Lambda işlevi birden çok bağımsız değişken kabul edebilir. Bu durumda, geçmek gerekir `arrayReverseSort` işlev lambda işlevinin argümanlarının karşılık geleceği aynı uzunlukta birkaç dizi. Elde edilen dizi ilk giriş dizisinden elemanlardan oluşacaktır; bir sonraki giriş dizilerinden elemanlar sıralama anahtarlarını belirtir. Mesela: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +Bu örnekte, dizi aşağıdaki şekilde sıralanır: + +1. İlk başta, kaynak dizi (\[‘hello’, ‘world’\]) dizilerin elemanlarına uygulanan lambda işlevinin sonucuna göre sıralanır. İkinci dizide geçirilen öğeler (\[2, 1\]), kaynak diziden karşılık gelen öğeler için sıralama anahtarlarını tanımlar. Sonuç bir dizidir \[‘world’, ‘hello’\]. +2. Önceki adımda sıralanmış dizi tersine çevrilir. Yani, nihai sonuç \[‘hello’, ‘world’\]. + +Diğer örnekler aşağıda gösterilmiştir. + +``` sql +SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; +``` + +``` text +┌─res─────┐ +│ [5,3,4] │ +└─────────┘ +``` + +``` sql +SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; +``` + +``` text +┌─res─────┐ +│ [4,3,5] │ +└─────────┘ +``` + +## arrayUniq(arr, …) {#arrayuniqarr} + +Bir bağımsız değişken geçirilirse, dizideki farklı öğelerin sayısını sayar. +Birden çok bağımsız değişken geçirilirse, birden çok dizideki karşılık gelen konumlardaki farklı öğe kümelerinin sayısını sayar. + +Bir dizideki benzersiz öğelerin bir listesini almak istiyorsanız, arrayreduce kullanabilirsiniz(‘groupUniqArray’, arr). + +## arrayJoin(arr) {#array-functions-join} + +Özel bir işlev. Bölümüne bakınız [“ArrayJoin function”](array-join.md#functions_arrayjoin). + +## arrayDifference {#arraydifference} + +Bitişik dizi öğeleri arasındaki farkı hesaplar. İlk öğenin 0 olacağı bir dizi döndürür, ikincisi arasındaki farktır `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). + +**Sözdizimi** + +``` sql +arrayDifference(array) +``` + +**Parametre** + +- `array` – [Dizi](https://clickhouse.yandex/docs/en/data_types/array/). + +**Döndürülen değerler** + +Bitişik öğeler arasındaki farklar dizisini döndürür. + +Tür: [Uİnt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Tamsayı\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [Yüzdürmek\*](https://clickhouse.yandex/docs/en/data_types/float/). + +**Örnek** + +Sorgu: + +``` sql +SELECT arrayDifference([1, 2, 3, 4]) +``` + +Sonuç: + +``` text +┌─arrayDifference([1, 2, 3, 4])─┐ +│ [0,1,1,1] │ +└───────────────────────────────┘ +``` + +Sonuç türü Int64 nedeniyle taşma örneği: + +Sorgu: + +``` sql +SELECT arrayDifference([0, 10000000000000000000]) +``` + +Sonuç: + +``` text +┌─arrayDifference([0, 10000000000000000000])─┐ +│ [0,-8446744073709551616] │ +└────────────────────────────────────────────┘ +``` + +## arrayDistinct {#arraydistinct} + +Bir dizi alır, yalnızca farklı öğeleri içeren bir dizi döndürür. + +**Sözdizimi** + +``` sql +arrayDistinct(array) +``` + +**Parametre** + +- `array` – [Dizi](https://clickhouse.yandex/docs/en/data_types/array/). + +**Döndürülen değerler** + +Farklı öğeleri içeren bir dizi döndürür. + +**Örnek** + +Sorgu: + +``` sql +SELECT arrayDistinct([1, 2, 2, 3, 1]) +``` + +Sonuç: + +``` text +┌─arrayDistinct([1, 2, 2, 3, 1])─┐ +│ [1,2,3] │ +└────────────────────────────────┘ +``` + +## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} + +Kaynak diziyle aynı boyutta bir dizi döndürür ve her öğenin kaynak dizide ilk olarak nerede göründüğünü gösterir. + +Örnek: + +``` sql +SELECT arrayEnumerateDense([10, 20, 10, 30]) +``` + +``` text +┌─arrayEnumerateDense([10, 20, 10, 30])─┐ +│ [1,2,1,3] │ +└───────────────────────────────────────┘ +``` + +## arrayıntersect(arr) {#array-functions-arrayintersect} + +Birden çok dizi alır, tüm kaynak dizilerde bulunan öğeleri içeren bir dizi döndürür. Elde edilen dizideki öğeler sırası ilk dizideki ile aynıdır. + +Örnek: + +``` sql +SELECT + arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, + arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect +``` + +``` text +┌─no_intersect─┬─intersect─┐ +│ [] │ [1] │ +└──────────────┴───────────┘ +``` + +## arrayReduce {#arrayreduce} + +Dizi öğelerine bir toplama işlevi uygular ve sonucunu döndürür. Toplama işlevinin adı, tek tırnak içinde bir dize olarak geçirilir `'max'`, `'sum'`. Parametrik toplama işlevleri kullanıldığında, parametre parantez içinde işlev adından sonra gösterilir `'uniqUpTo(6)'`. + +**Sözdizimi** + +``` sql +arrayReduce(agg_func, arr1, arr2, ..., arrN) +``` + +**Parametre** + +- `agg_func` — The name of an aggregate function which should be a constant [dize](../../sql-reference/data-types/string.md). +- `arr` — Any number of [dizi](../../sql-reference/data-types/array.md) sütunları toplama işlevinin parametreleri olarak yazın. + +**Döndürülen değer** + +**Örnek** + +``` sql +SELECT arrayReduce('max', [1, 2, 3]) +``` + +``` text +┌─arrayReduce('max', [1, 2, 3])─┐ +│ 3 │ +└───────────────────────────────┘ +``` + +Bir toplama işlevi birden çok bağımsız değişken alırsa, bu işlev aynı boyuttaki birden çok diziye uygulanmalıdır. + +``` sql +SELECT arrayReduce('maxIf', [3, 5], [1, 0]) +``` + +``` text +┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ +│ 3 │ +└──────────────────────────────────────┘ +``` + +Parametrik toplama fonksiyonu ile örnek: + +``` sql +SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) +``` + +``` text +┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ +│ 4 │ +└─────────────────────────────────────────────────────────────┘ +``` + +## arrayReduceİnRanges {#arrayreduceinranges} + +Belirli aralıklardaki dizi öğelerine bir toplama işlevi uygular ve her aralığa karşılık gelen sonucu içeren bir dizi döndürür. Fonksiyon aynı sonucu birden fazla olarak döndürür `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. + +**Sözdizimi** + +``` sql +arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) +``` + +**Parametre** + +- `agg_func` — The name of an aggregate function which should be a constant [dize](../../sql-reference/data-types/string.md). +- `ranges` — The ranges to aggretate which should be an [dizi](../../sql-reference/data-types/array.md) -den [Demetler](../../sql-reference/data-types/tuple.md) indeks ve her aralığın uzunluğunu içeren. +- `arr` — Any number of [dizi](../../sql-reference/data-types/array.md) sütunları toplama işlevinin parametreleri olarak yazın. + +**Döndürülen değer** + +**Örnek** + +``` sql +SELECT arrayReduceInRanges( + 'sum', + [(1, 5), (2, 3), (3, 4), (4, 4)], + [1000000, 200000, 30000, 4000, 500, 60, 7] +) AS res +``` + +``` text +┌─res─────────────────────────┐ +│ [1234500,234000,34560,4567] │ +└─────────────────────────────┘ +``` + +## arrayReverse(arr) {#arrayreverse} + +Öğeleri ters sırada içeren orijinal diziyle aynı boyutta bir dizi döndürür. + +Örnek: + +``` sql +SELECT arrayReverse([1, 2, 3]) +``` + +``` text +┌─arrayReverse([1, 2, 3])─┐ +│ [3,2,1] │ +└─────────────────────────┘ +``` + +## ters (arr) {#array-functions-reverse} + +Eşanlamlı [“arrayReverse”](#array_functions-arrayreverse) + +## arrayFlatten {#arrayflatten} + +Bir dizi diziyi düz bir diziye dönüştürür. + +İşlev: + +- İç içe geçmiş dizilerin herhangi bir derinliği için geçerlidir. +- Zaten düz olan dizileri değiştirmez. + +Düzleştirilmiş dizi, tüm kaynak dizilerdeki tüm öğeleri içerir. + +**Sözdizimi** + +``` sql +flatten(array_of_arrays) +``` + +Takma ad: `flatten`. + +**Parametre** + +- `array_of_arrays` — [Dizi](../../sql-reference/data-types/array.md) dizilerin. Mesela, `[[1,2,3], [4,5]]`. + +**Örnekler** + +``` sql +SELECT flatten([[[1]], [[2], [3]]]) +``` + +``` text +┌─flatten(array(array([1]), array([2], [3])))─┐ +│ [1,2,3] │ +└─────────────────────────────────────────────┘ +``` + +## arrayCompact {#arraycompact} + +Ardışık yinelenen öğeleri bir diziden kaldırır. Sonuç değerlerinin sırası, kaynak dizideki sıraya göre belirlenir. + +**Sözdizimi** + +``` sql +arrayCompact(arr) +``` + +**Parametre** + +`arr` — The [dizi](../../sql-reference/data-types/array.md) incelemek. + +**Döndürülen değer** + +Yinelenen olmadan dizi. + +Tür: `Array`. + +**Örnek** + +Sorgu: + +``` sql +SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) +``` + +Sonuç: + +``` text +┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ +│ [1,nan,nan,2,3] │ +└────────────────────────────────────────────┘ +``` + +## arrayZip {#arrayzip} + +Birden çok diziyi tek bir dizide birleştirir. Elde edilen dizi, listelenen bağımsız değişken sırasına göre gruplandırılmış kaynak dizilerin karşılık gelen öğelerini içerir. + +**Sözdizimi** + +``` sql +arrayZip(arr1, arr2, ..., arrN) +``` + +**Parametre** + +- `arrN` — [Dizi](../data-types/array.md). + +İşlev, farklı türde herhangi bir dizi alabilir. Tüm giriş dizileri eşit boyutta olmalıdır. + +**Döndürülen değer** + +- Gruplandırılmış kaynak dizilerden öğelerle dizi [Demetler](../data-types/tuple.md). Veri türleri tuple giriş dizileri türleri ile aynıdır ve diziler geçirilir aynı sırada. + +Tür: [Dizi](../data-types/array.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]) +``` + +Sonuç: + +``` text +┌─arrayZip(['a', 'b', 'c'], [5, 2, 1])─┐ +│ [('a',5),('b',2),('c',1)] │ +└──────────────────────────────────────┘ +``` + +## arrayAUC {#arrayauc} + +Auc’yi hesaplayın (makine öğreniminde bir kavram olan eğrinin altındaki alan, daha fazla ayrıntıya bakın: https://en.wikipedia.org/wiki/Receiver\_operating\_characteristic\#Area\_under\_the\_curve). + +**Sözdizimi** + +``` sql +arrayAUC(arr_scores, arr_labels) +``` + +**Parametre** +- `arr_scores` — scores prediction model gives. +- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. + +**Döndürülen değer** +Float64 türü ile AUC değerini döndürür. + +**Örnek** +Sorgu: + +``` sql +select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) +``` + +Sonuç: + +``` text +┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ +│ 0.75 │ +└────────────────────────────────────────---──┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/tr/sql_reference/functions/array_join.md b/docs/tr/sql-reference/functions/array-join.md similarity index 100% rename from docs/tr/sql_reference/functions/array_join.md rename to docs/tr/sql-reference/functions/array-join.md diff --git a/docs/tr/sql-reference/functions/bit-functions.md b/docs/tr/sql-reference/functions/bit-functions.md new file mode 100644 index 00000000000..f67b785dd42 --- /dev/null +++ b/docs/tr/sql-reference/functions/bit-functions.md @@ -0,0 +1,255 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 48 +toc_title: Bitlik +--- + +# Bit fonksiyonları {#bit-functions} + +Bit işlevleri, uint8, Uİnt16, Uİnt32, Uint64, Int8, Int16, Int32, Int64, Float32 veya Float64 türlerinden herhangi bir çift için çalışır. + +Sonuç türü, bağımsız değişkenlerinin maksimum bitlerine eşit bit içeren bir tamsayıdır. Bağımsız değişkenlerden en az biri imzalanırsa, sonuç imzalı bir sayıdır. Bir bağımsız değişken bir kayan noktalı sayı ise, Int64 için cast. + +## bıtor(a, b) {#bitanda-b} + +## bitOr(a, b) {#bitora-b} + +## bitXor(a, b) {#bitxora-b} + +## bitNot (a) {#bitnota} + +## bitShiftLeft(a, b) {#bitshiftlefta-b} + +## bitShiftRight(a, b) {#bitshiftrighta-b} + +## bitRotateLeft(a, b) {#bitrotatelefta-b} + +## bitRotateRight(a, b) {#bitrotaterighta-b} + +## bitTest {#bittest} + +Herhangi bir tamsayı alır ve dönüştürür [ikili form](https://en.wikipedia.org/wiki/Binary_number), belirtilen konumda bir bit değerini döndürür. Geri sayım sağdan sola 0 başlar. + +**Sözdizimi** + +``` sql +SELECT bitTest(number, index) +``` + +**Parametre** + +- `number` – integer number. +- `index` – position of bit. + +**Döndürülen değerler** + +Belirtilen konumda bit değeri döndürür. + +Tür: `UInt8`. + +**Örnek** + +Örneğin, taban-2 (ikili) sayı sistemindeki 43 sayısı 101011’dir. + +Sorgu: + +``` sql +SELECT bitTest(43, 1) +``` + +Sonuç: + +``` text +┌─bitTest(43, 1)─┐ +│ 1 │ +└────────────────┘ +``` + +Başka bir örnek: + +Sorgu: + +``` sql +SELECT bitTest(43, 2) +``` + +Sonuç: + +``` text +┌─bitTest(43, 2)─┐ +│ 0 │ +└────────────────┘ +``` + +## bitTestAll {#bittestall} + +Sonucu döndürür [mantıksal conjuction](https://en.wikipedia.org/wiki/Logical_conjunction) Verilen pozisyonlarda tüm bitlerin (ve operatörü). Geri sayım sağdan sola 0 başlar. + +Bitsel işlemler için conjuction: + +0 AND 0 = 0 + +0 AND 1 = 0 + +1 AND 0 = 0 + +1 AND 1 = 1 + +**Sözdizimi** + +``` sql +SELECT bitTestAll(number, index1, index2, index3, index4, ...) +``` + +**Parametre** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) doğru ise ve sadece tüm pozisyon trueları doğru ise (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). + +**Döndürülen değerler** + +Mantıksal conjuction sonucunu döndürür. + +Tür: `UInt8`. + +**Örnek** + +Örneğin, taban-2 (ikili) sayı sistemindeki 43 sayısı 101011’dir. + +Sorgu: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5) +``` + +Sonuç: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5)─┐ +│ 1 │ +└────────────────────────────┘ +``` + +Başka bir örnek: + +Sorgu: + +``` sql +SELECT bitTestAll(43, 0, 1, 3, 5, 2) +``` + +Sonuç: + +``` text +┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ +│ 0 │ +└───────────────────────────────┘ +``` + +## bitTestAny {#bittestany} + +Sonucu döndürür [mantıksal ayrılma](https://en.wikipedia.org/wiki/Logical_disjunction) Verilen konumlardaki tüm bitlerin (veya operatör). Geri sayım sağdan sola 0 başlar. + +Bitsel işlemler için ayrılma: + +0 OR 0 = 0 + +0 OR 1 = 1 + +1 OR 0 = 1 + +1 OR 1 = 1 + +**Sözdizimi** + +``` sql +SELECT bitTestAny(number, index1, index2, index3, index4, ...) +``` + +**Parametre** + +- `number` – integer number. +- `index1`, `index2`, `index3`, `index4` – positions of bit. + +**Döndürülen değerler** + +Mantıksal disjuction sonucunu döndürür. + +Tür: `UInt8`. + +**Örnek** + +Örneğin, taban-2 (ikili) sayı sistemindeki 43 sayısı 101011’dir. + +Sorgu: + +``` sql +SELECT bitTestAny(43, 0, 2) +``` + +Sonuç: + +``` text +┌─bitTestAny(43, 0, 2)─┐ +│ 1 │ +└──────────────────────┘ +``` + +Başka bir örnek: + +Sorgu: + +``` sql +SELECT bitTestAny(43, 4, 2) +``` + +Sonuç: + +``` text +┌─bitTestAny(43, 4, 2)─┐ +│ 0 │ +└──────────────────────┘ +``` + +## bitCount {#bitcount} + +Bir sayının ikili gösteriminde birine ayarlanmış bit sayısını hesaplar. + +**Sözdizimi** + +``` sql +bitCount(x) +``` + +**Parametre** + +- `x` — [Tamsayı](../../sql-reference/data-types/int-uint.md) veya [kayan nokta](../../sql-reference/data-types/float.md) numara. İşlev, bellekteki değer gösterimini kullanır. Kayan noktalı sayıları desteklemeye izin verir. + +**Döndürülen değer** + +- Giriş numarasında birine ayarlanmış bit sayısı. + +İşlev, giriş değerini daha büyük bir türe dönüştürmez ([işaret uzantısı](https://en.wikipedia.org/wiki/Sign_extension)). Bu yüzden, örneğin , `bitCount(toUInt8(-1)) = 8`. + +Tür: `UInt8`. + +**Örnek** + +Örneğin 333 sayısını alın. İkili gösterimi: 0000000101001101. + +Sorgu: + +``` sql +SELECT bitCount(333) +``` + +Sonuç: + +``` text +┌─bitCount(333)─┐ +│ 5 │ +└───────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/tr/sql-reference/functions/bitmap-functions.md b/docs/tr/sql-reference/functions/bitmap-functions.md new file mode 100644 index 00000000000..0fa11b54443 --- /dev/null +++ b/docs/tr/sql-reference/functions/bitmap-functions.md @@ -0,0 +1,496 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 49 +toc_title: "E\u015Flem" +--- + +# Bitmap işlevleri {#bitmap-functions} + +Bitmap işlevleri iki bit eşlemler nesne değeri hesaplama için çalışmak, yeni bitmap veya kardinality formül hesaplama, and, or, xor ve not, vb gibi kullanırken döndürmektir. + +Bitmap nesnesi için 2 çeşit inşaat yöntemi vardır. Biri-State ile toplama işlevi groupBitmap tarafından inşa edilecek, diğeri Array nesnesi tarafından inşa edilecek. Ayrıca bitmap nesnesini dizi nesnesine dönüştürmektir. + +Roaringbitmap, Bitmap nesnelerinin gerçek depolanması sırasında bir veri yapısına sarılır. Önemlilik 32’den küçük veya eşit olduğunda, Set objet kullanır. Kardinality 32’den büyük olduğunda, roaringbitmap nesnesi kullanır. Bu nedenle düşük kardinalite kümesinin depolanması daha hızlıdır. + +RoaringBitmap hakkında daha fazla bilgi için bkz: [CRoaring](https://github.com/RoaringBitmap/CRoaring). + +## bitmapBuild {#bitmap_functions-bitmapbuild} + +İmzasız tamsayı dizisinden bir bit eşlem oluşturun. + +``` sql +bitmapBuild(array) +``` + +**Parametre** + +- `array` – unsigned integer array. + +**Örnek** + +``` sql +SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) +``` + +``` text +┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ +│  │ AggregateFunction(groupBitmap, UInt8) │ +└─────┴──────────────────────────────────────────────┘ +``` + +## bitmapToArray {#bitmaptoarray} + +Bitmap’i tamsayı dizisine dönüştürün. + +``` sql +bitmapToArray(bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapsubsetınrange {#bitmap-functions-bitmapsubsetinrange} + +Belirtilen aralıktaki alt kümesi döndürür (range\_end içermez). + +``` sql +bitmapSubsetInRange(bitmap, range_start, range_end) +``` + +**Parametre** + +- `bitmap` – [Bitmap nesnesi](#bitmap_functions-bitmapbuild). +- `range_start` – range start point. Type: [Uİnt32](../../sql-reference/data-types/int-uint.md). +- `range_end` – range end point(excluded). Type: [Uİnt32](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +``` sql +SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +``` text +┌─res───────────────┐ +│ [30,31,32,33,100] │ +└───────────────────┘ +``` + +## bitmapSubsetLimit {#bitmapsubsetlimit} + +Arasında alınan n öğeleri ile bitmap bir alt kümesi oluşturur `range_start` ve `cardinality_limit`. + +**Sözdizimi** + +``` sql +bitmapSubsetLimit(bitmap, range_start, cardinality_limit) +``` + +**Parametre** + +- `bitmap` – [Bitmap nesnesi](#bitmap_functions-bitmapbuild). +- `range_start` – The subset starting point. Type: [Uİnt32](../../sql-reference/data-types/int-uint.md). +- `cardinality_limit` – The subset cardinality upper limit. Type: [Uİnt32](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değer** + +Alt. + +Tür: `Bitmap object`. + +**Örnek** + +Sorgu: + +``` sql +SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + +Sonuç: + +``` text +┌─res───────────────────────┐ +│ [30,31,32,33,100,200,500] │ +└───────────────────────────┘ +``` + +## bitmapContains {#bitmap_functions-bitmapcontains} + +Bit eşlem bir öğe içerip içermediğini denetler. + +``` sql +bitmapContains(haystack, needle) +``` + +**Parametre** + +- `haystack` – [Bitmap nesnesi](#bitmap_functions-bitmapbuild), fonksiyon arar nerede. +- `needle` – Value that the function searches. Type: [Uİnt32](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- 0 — If `haystack` içermez `needle`. +- 1 — If `haystack` içeriyor `needle`. + +Tür: `UInt8`. + +**Örnek** + +``` sql +SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAny {#bitmaphasany} + +İki bit eşlemin bazı öğelerle kesiştiği olup olmadığını kontrol eder. + +``` sql +bitmapHasAny(bitmap1, bitmap2) +``` + +Eğer eminseniz `bitmap2` kesinlikle bir öğe içerir, kullanmayı düşünün [bitmapContains](#bitmap_functions-bitmapcontains) işlev. Daha verimli çalışır. + +**Parametre** + +- `bitmap*` – bitmap object. + +**Dönüş değerleri** + +- `1`, eğer `bitmap1` ve `bitmap2` en azından benzer bir öğeye sahip olun. +- `0`, başka. + +**Örnek** + +``` sql +SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAll {#bitmaphasall} + +Benzer `hasAll(array, array)` ilk bit eşlem, ikincisinin tüm öğelerini içeriyorsa, 1 değerini döndürür, aksi halde 0. +İkinci bağımsız değişken boş bir bit eşlem ise, 1 döndürür. + +``` sql +bitmapHasAll(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + +``` text +┌─res─┐ +│ 0 │ +└─────┘ +``` + +## bitmapCardinality {#bitmapcardinality} + +Retrun bit eşlem kardinalite türü Uİnt64. + +``` sql +bitmapCardinality(bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapMin {#bitmapmin} + +Kümedeki uint64 türünün en küçük değerini yeniden çalıştırın, küme boşsa UİNT32\_MAX. + + bitmapMin(bitmap) + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## bitmapMax {#bitmapmax} + +Küme boşsa, kümedeki uint64 türünün en büyük değerini 0 olarak yeniden çalıştırın. + + bitmapMax(bitmap) + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## bitmapTransform {#bitmaptransform} + +Bitmap’teki bir değer dizisini başka bir değer dizisine dönüştürün, sonuç yeni bir bitmap’tir. + + bitmapTransform(bitmap, from_array, to_array) + +**Parametre** + +- `bitmap` – bitmap object. +- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. +- `to_array` – UInt32 array, its size shall be the same to from\_array. + +**Örnek** + +``` sql +SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res +``` + + ┌─res───────────────────┐ + │ [1,3,4,6,7,8,9,10,20] │ + └───────────────────────┘ + +## bitmapAnd {#bitmapand} + +İki bitmap ve hesaplama, sonuç yeni bir bitmap’tir. + +``` sql +bitmapAnd(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─┐ +│ [3] │ +└─────┘ +``` + +## bitmapOr {#bitmapor} + +İki bitmap veya hesaplama, sonuç yeni bir bitmap’tir. + +``` sql +bitmapOr(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res─────────┐ +│ [1,2,3,4,5] │ +└─────────────┘ +``` + +## bitmapXor {#bitmapxor} + +İki bitmap XOR hesaplama, sonuç yeni bir bitmap. + +``` sql +bitmapXor(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,4,5] │ +└───────────┘ +``` + +## bitmapAndnot {#bitmapandnot} + +İki bit eşlem andnot hesaplama, sonuç yeni bir bit eşlem. + +``` sql +bitmapAndnot(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + +``` text +┌─res───┐ +│ [1,2] │ +└───────┘ +``` + +## bitmapAndCardinality {#bitmapandcardinality} + +İki bitmap ve hesaplama, uint64 türünün kardinalliğini döndürür. + +``` sql +bitmapAndCardinality(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapOrCardinality {#bitmaporcardinality} + +İki bitmap veya hesaplama, uint64 türünün kardinalliğini döndürür. + +``` sql +bitmapOrCardinality(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 5 │ +└─────┘ +``` + +## bitmapXorCardinality {#bitmapxorcardinality} + +İki bitmap XOR hesaplama, uint64 türünün kardinalliğini döndürür. + +``` sql +bitmapXorCardinality(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 4 │ +└─────┘ +``` + +## bitmapAndnotCardinality {#bitmapandnotcardinality} + +İki bitmap andnot hesaplama, uint64 türünün kardinalliğini döndürür. + +``` sql +bitmapAndnotCardinality(bitmap,bitmap) +``` + +**Parametre** + +- `bitmap` – bitmap object. + +**Örnek** + +``` sql +SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + +``` text +┌─res─┐ +│ 2 │ +└─────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/tr/sql_reference/functions/comparison_functions.md b/docs/tr/sql-reference/functions/comparison-functions.md similarity index 100% rename from docs/tr/sql_reference/functions/comparison_functions.md rename to docs/tr/sql-reference/functions/comparison-functions.md diff --git a/docs/tr/sql-reference/functions/conditional-functions.md b/docs/tr/sql-reference/functions/conditional-functions.md new file mode 100644 index 00000000000..d9a9fe726a9 --- /dev/null +++ b/docs/tr/sql-reference/functions/conditional-functions.md @@ -0,0 +1,207 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 43 +toc_title: "Ko\u015Fullu " +--- + +# Koşullu Fonksiyonlar {#conditional-functions} + +## eğer {#if} + +Koşullu dallanmayı kontrol eder. Çoğu sistemin aksine, ClickHouse her zaman her iki ifadeyi de değerlendirir `then` ve `else`. + +**Sözdizimi** + +``` sql +SELECT if(cond, then, else) +``` + +Eğer durum `cond` sıfır olmayan bir değere değerlendirir, ifadenin sonucunu döndürür `then` ve ifad andenin sonucu `else` varsa, atlanır. Eğer… `cond` sıfır veya `NULL` fakat daha sonra sonucu `then` ifade atlanır ve sonucu `else` Ifade, varsa, döndürülür. + +**Parametre** + +- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. +- `then` - Koşul karşılanırsa dönmek için ifade. +- `else` - Koşul karşılanmazsa dönmek için ifade. + +**Döndürülen değerler** + +İşlev yürütür `then` ve `else` ifadeler ve koşulun olup olmadığına bağlı olarak sonucunu döndürür `cond` sıfır ya da değil. + +**Örnek** + +Sorgu: + +``` sql +SELECT if(1, plus(2, 2), plus(2, 6)) +``` + +Sonuç: + +``` text +┌─plus(2, 2)─┐ +│ 4 │ +└────────────┘ +``` + +Sorgu: + +``` sql +SELECT if(0, plus(2, 2), plus(2, 6)) +``` + +Sonuç: + +``` text +┌─plus(2, 6)─┐ +│ 8 │ +└────────────┘ +``` + +- `then` ve `else` en düşük ortak türe sahip olmalıdır. + +**Örnek:** + +Bunu al `LEFT_RIGHT` Tablo: + +``` sql +SELECT * +FROM LEFT_RIGHT + +┌─left─┬─right─┐ +│ ᴺᵁᴸᴸ │ 4 │ +│ 1 │ 3 │ +│ 2 │ 2 │ +│ 3 │ 1 │ +│ 4 │ ᴺᵁᴸᴸ │ +└──────┴───────┘ +``` + +Aşağıdaki sorgu karşılaştırır `left` ve `right` değerler: + +``` sql +SELECT + left, + right, + if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller +FROM LEFT_RIGHT +WHERE isNotNull(left) AND isNotNull(right) + +┌─left─┬─right─┬─is_smaller──────────────────────────┐ +│ 1 │ 3 │ left is smaller than right │ +│ 2 │ 2 │ right is greater or equal than left │ +│ 3 │ 1 │ right is greater or equal than left │ +└──────┴───────┴─────────────────────────────────────┘ +``` + +Not: `NULL` bu örnekte değerler kullanılmaz, kontrol edin [Koşullardaki boş değerler](#null-values-in-conditionals) bölme. + +## Üçlü Operatör {#ternary-operator} + +Aynı gibi çalışıyor. `if` işlev. + +Sözdizimi: `cond ? then : else` + +Dönüşler `then` eğer… `cond` true (sıfırdan büyük) olarak değerlendirir, aksi takdirde döndürür `else`. + +- `cond` türü olmalıdır `UInt8`, ve `then` ve `else` en düşük ortak türe sahip olmalıdır. + +- `then` ve `else` olabilir `NULL` + +**Ayrıca bakınız** + +- [ifNotFinite](other-functions.md#ifnotfinite). + +## multiİf {#multiif} + +Yaz allowsmanızı sağlar [CASE](../operators.md#operator_case) operatör sorguda daha kompakt. + +Sözdizimi: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` + +**Parametre:** + +- `cond_N` — The condition for the function to return `then_N`. +- `then_N` — The result of the function when executed. +- `else` — The result of the function if none of the conditions is met. + +İşlev kabul eder `2N+1` parametre. + +**Döndürülen değerler** + +İşlev, değerlerden birini döndürür `then_N` veya `else` bu koşullara bağlı olarak `cond_N`. + +**Örnek** + +Yine kullanarak `LEFT_RIGHT` Tablo. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─result──────────┐ +│ ᴺᵁᴸᴸ │ 4 │ Null value │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ left is greater │ +│ 4 │ ᴺᵁᴸᴸ │ Null value │ +└──────┴───────┴─────────────────┘ +``` + +## Koşullu sonuçları doğrudan Kullanma {#using-conditional-results-directly} + +Koşullar her zaman sonuç `0`, `1` veya `NULL`. Böylece koşullu sonuçları doğrudan bu şekilde kullanabilirsiniz: + +``` sql +SELECT left < right AS is_small +FROM LEFT_RIGHT + +┌─is_small─┐ +│ ᴺᵁᴸᴸ │ +│ 1 │ +│ 0 │ +│ 0 │ +│ ᴺᵁᴸᴸ │ +└──────────┘ +``` + +## Koşullardaki boş değerler {#null-values-in-conditionals} + +Ne zaman `NULL` değerler koşullarla ilgilidir, sonuç da olacaktır `NULL`. + +``` sql +SELECT + NULL < 1, + 2 < NULL, + NULL < NULL, + NULL = NULL + +┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ +│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└───────────────┴───────────────┴──────────────────┴────────────────────┘ +``` + +Bu nedenle, sorgularınızı türleri dikkatli bir şekilde oluşturmalısınız `Nullable`. + +Aşağıdaki örnek, eşittir koşulu eklemek başarısız tarafından bu gösterir `multiIf`. + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─faulty_result────┐ +│ ᴺᵁᴸᴸ │ 4 │ Both equal │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ right is smaller │ +│ 4 │ ᴺᵁᴸᴸ │ Both equal │ +└──────┴───────┴──────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/tr/sql-reference/functions/date-time-functions.md b/docs/tr/sql-reference/functions/date-time-functions.md new file mode 100644 index 00000000000..aee61948c76 --- /dev/null +++ b/docs/tr/sql-reference/functions/date-time-functions.md @@ -0,0 +1,450 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 39 +toc_title: "Tarih ve Saatlerle \xE7al\u0131\u015Fma" +--- + +# Tarih Ve Saatlerle çalışmak için işlevler {#functions-for-working-with-dates-and-times} + +Saat dilimleri için destek + +Saat dilimi için mantıksal kullanımı olan tarih ve Saat ile çalışmak için tüm işlevler, ikinci bir isteğe bağlı saat dilimi bağımsız değişkeni kabul edebilir. Örnek: Asya / Yekaterinburg. Bu durumda, yerel (varsayılan) yerine belirtilen saat dilimini kullanırlar. + +``` sql +SELECT + toDateTime('2016-06-15 23:00:00') AS time, + toDate(time) AS date_local, + toDate(time, 'Asia/Yekaterinburg') AS date_yekat, + toString(time, 'US/Samoa') AS time_samoa +``` + +``` text +┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ +└─────────────────────┴────────────┴────────────┴─────────────────────┘ +``` + +UTC’DEN saat sayısına göre farklı olan yalnızca saat dilimleri desteklenir. + +## toTimeZone {#totimezone} + +Saat veya tarih ve saati belirtilen saat dilimine dönüştürün. + +## toYear {#toyear} + +Bir tarihi veya tarihi zamanla yıl numarasını (AD) içeren bir Uınt16 numarasına dönüştürür. + +## toQuarter {#toquarter} + +Bir tarihi veya tarihi zaman ile çeyrek sayısını içeren bir Uİnt8 numarasına dönüştürür. + +## toMonth {#tomonth} + +Bir tarih veya tarih ile saati, ay numarasını (1-12) içeren bir Uİnt8 numarasına dönüştürür. + +## bugünyıl {#todayofyear} + +Bir tarih veya tarih ile saat, yılın gün sayısını (1-366) içeren bir Uınt16 numarasına dönüştürür. + +## bugünay {#todayofmonth} + +Bir tarih veya tarih ile saat, Ayın gün sayısını (1-31) içeren bir Uınt8 numarasına dönüştürür. + +## bugünhafta {#todayofweek} + +Bir tarih veya tarih ile saat, haftanın gününün sayısını içeren bir Uınt8 numarasına dönüştürür (Pazartesi 1 ve pazar 7’dir). + +## toHour {#tohour} + +Saatli bir tarihi, 24 saatlik süre (0-23) saat sayısını içeren bir Uınt8 numarasına dönüştürür. +This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). + +## toMinute {#tominute} + +Saatli bir tarihi, saatin dakika sayısını (0-59) içeren bir Uınt8 numarasına dönüştürür. + +## toSecond {#tosecond} + +Dakika (0-59) ikinci sayısını içeren bir uınt8 numarasına zaman ile bir tarih dönüştürür. +Sıçrama saniye hesaba değildir. + +## toUnixTimestamp {#to-unix-timestamp} + +DateTime argümanı için: değeri dahili sayısal gösterimine dönüştürür (Unıx Zaman Damgası). +String argümanı için: datetime’ı dizeden saat dilimine göre ayrıştırın (isteğe bağlı ikinci argüman, sunucu zaman dilimi varsayılan olarak kullanılır) ve karşılık gelen unıx zaman damgasını döndürür. +Tarih argümanı için: davranış belirtilmemiş. + +**Sözdizimi** + +``` sql +toUnixTimestamp(datetime) +toUnixTimestamp(str, [timezone]) +``` + +**Döndürülen değer** + +- Unix zaman damgasını döndürür. + +Tür: `UInt32`. + +**Örnek** + +Sorgu: + +``` sql +SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp +``` + +Sonuç: + +``` text +┌─unix_timestamp─┐ +│ 1509836867 │ +└────────────────┘ +``` + +## toStartOfYear {#tostartofyear} + +Yılın ilk gününe kadar bir tarih veya tarih aşağı yuvarlar. +Tarihi döndürür. + +## toStartOfİSOYear {#tostartofisoyear} + +ISO yılın ilk gününe kadar bir tarih veya tarih aşağı yuvarlar. +Tarihi döndürür. + +## toStartOfQuarter {#tostartofquarter} + +Çeyrek ilk güne kadar bir tarih veya tarih aşağı yuvarlar. +Çeyreğin ilk günü 1 Ocak, 1 Nisan, 1 Temmuz veya 1 ekim’dir. +Tarihi döndürür. + +## toStartOfMonth {#tostartofmonth} + +Ayın ilk gününe kadar bir tarih veya tarih aşağı yuvarlar. +Tarihi döndürür. + +!!! attention "Dikkat" + Yanlış tarihleri ayrıştırma davranışı uygulamaya özeldir. ClickHouse sıfır tarihi döndürebilir, bir istisna atabilir veya yapabilir “natural” taşmak. + +## toMonday {#tomonday} + +En yakın Pazartesi günü bir tarih veya tarih aşağı yuvarlar. +Tarihi döndürür. + +## toStartOfWeek(t \[, mod\]) {#tostartofweektmode} + +Modu ile en yakın pazar veya Pazartesi zaman bir tarih veya tarih aşağı yuvarlar. +Tarihi döndürür. +Mod bağımsız değişkeni, toWeek () için mod bağımsız değişkeni gibi çalışır. Tek bağımsız değişken sözdizimi için 0 mod değeri kullanılır. + +## toStartOfDay {#tostartofday} + +Günün başlangıcına kadar bir tarih aşağı yuvarlar. + +## toStartOfHour {#tostartofhour} + +Saat başlangıcına kadar bir tarih aşağı yuvarlar. + +## toStartOfMinute {#tostartofminute} + +Dakikanın başlangıcına kadar bir tarih aşağı yuvarlar. + +## toStartOfFiveMinute {#tostartoffiveminute} + +Beş dakikalık aralığın başlangıcına kadar bir tarih aşağı yuvarlar. + +## toStartOfTenMinutes {#tostartoftenminutes} + +On dakikalık aralığın başlangıcına kadar bir tarih aşağı yuvarlar. + +## toStartOfFifteenMinutes {#tostartoffifteenminutes} + +On beş dakikalık aralığın başlangıcına kadar tarih aşağı yuvarlar. + +## toStartOfİnterval (time\_or\_data, Aralık x birimi \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} + +Bu, diğer işlevlerin bir genellemesidir `toStartOf*`. Mesela, +`toStartOfInterval(t, INTERVAL 1 year)` aynı döndürür `toStartOfYear(t)`, +`toStartOfInterval(t, INTERVAL 1 month)` aynı döndürür `toStartOfMonth(t)`, +`toStartOfInterval(t, INTERVAL 1 day)` aynı döndürür `toStartOfDay(t)`, +`toStartOfInterval(t, INTERVAL 15 minute)` aynı döndürür `toStartOfFifteenMinutes(t)` vb. + +## toTime {#totime} + +Belirli bir sabit tarihe zaman ile bir tarih dönüştürür, zaman korurken. + +## toRelativeYearNum {#torelativeyearnum} + +Geçmişte belirli bir sabit noktadan başlayarak, yıl sayısına saat veya tarih ile bir tarih dönüştürür. + +## toRelativeQuarterNum {#torelativequarternum} + +Geçmişte belirli bir sabit noktadan başlayarak, çeyrek sayısına saat veya tarih ile bir tarih dönüştürür. + +## toRelativeMonthNum {#torelativemonthnum} + +Geçmişte belirli bir sabit noktadan başlayarak, Ayın sayısına saat veya tarih ile bir tarih dönüştürür. + +## toRelativeWeekNum {#torelativeweeknum} + +Geçmişte belirli bir sabit noktadan başlayarak, haftanın sayısına saat veya tarih ile bir tarih dönüştürür. + +## toRelativeDayNum {#torelativedaynum} + +Geçmişte belirli bir sabit noktadan başlayarak, günün sayısına saat veya tarih ile bir tarih dönüştürür. + +## toRelativeHourNum {#torelativehournum} + +Geçmişte belirli bir sabit noktadan başlayarak, saat veya tarih ile bir tarih saat sayısına dönüştürür. + +## toRelativeMinuteNum {#torelativeminutenum} + +Geçmişte belirli bir sabit noktadan başlayarak, dakika sayısına saat veya tarih ile bir tarih dönüştürür. + +## toRelativeSecondNum {#torelativesecondnum} + +Geçmişte belirli bir sabit noktadan başlayarak, ikinci sayısına saat veya tarih ile bir tarih dönüştürür. + +## toİSOYear {#toisoyear} + +ISO yıl numarasını içeren bir uınt16 numarasına bir tarih veya tarih zaman dönüştürür. + +## toİSOWeek {#toisoweek} + +ISO hafta numarasını içeren bir uınt8 numarasına bir tarih veya tarih zaman dönüştürür. + +## toWeek (tarih \[, mod\]) {#toweekdatemode} + +Bu işlev, date veya datetime için hafta numarasını döndürür. ToWeek () ’ in iki bağımsız değişkenli formu, haftanın pazar veya Pazartesi günü başlayıp başlamadığını ve dönüş değerinin 0 ile 53 arasında mı yoksa 1 ile 53 arasında mı olması gerektiğini belirlemenizi sağlar. Mod bağımsız değişkeni atlanırsa, varsayılan mod 0’dır. +`toISOWeek()`eşdeğer bir uyumluluk işlevidir `toWeek(date,3)`. +Aşağıdaki tabloda mod bağımsız değişkeni nasıl çalıştığını açıklar. + +| Modu | Haftanın ilk günü | Aralık | Week 1 is the first week … | +|------|-------------------|--------|----------------------------------| +| 0 | Pazar | 0-53 | bu yıl bir pazar günü ile | +| 1 | Pazartesi | 0-53 | bu yıl 4 veya daha fazla gün ile | +| 2 | Pazar | 1-53 | bu yıl bir pazar günü ile | +| 3 | Pazartesi | 1-53 | bu yıl 4 veya daha fazla gün ile | +| 4 | Pazar | 0-53 | bu yıl 4 veya daha fazla gün ile | +| 5 | Pazartesi | 0-53 | bu yıl bir Pazartesi ile | +| 6 | Pazar | 1-53 | bu yıl 4 veya daha fazla gün ile | +| 7 | Pazartesi | 1-53 | bu yıl bir Pazartesi ile | +| 8 | Pazar | 1-53 | 1 Ocak içerir | +| 9 | Pazartesi | 1-53 | 1 Ocak içerir | + +Bir anlamı olan mod değerleri için “with 4 or more days this year,” haftalar ISO 8601: 1988’e göre numaralandırılmıştır: + +- 1 Ocak içeren haftanın yeni yılda 4 veya daha fazla günü varsa, 1. haftadır. + +- Aksi takdirde, bir önceki yılın son haftasıdır ve bir sonraki hafta 1. haftadır. + +Bir anlamı olan mod değerleri için “contains January 1”, 1 Ocak haftanın 1.haft .asıdır. Haftanın yeni yılda kaç gün içerdiği önemli değil, sadece bir gün içerse bile. + +``` sql +toWeek(date, [, mode][, Timezone]) +``` + +**Parametre** + +- `date` – Date or DateTime. +- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. +- `Timezone` – Optional parameter, it behaves like any other conversion function. + +**Örnek** + +``` sql +SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; +``` + +``` text +┌───────date─┬─week0─┬─week1─┬─week9─┐ +│ 2016-12-27 │ 52 │ 52 │ 1 │ +└────────────┴───────┴───────┴───────┘ +``` + +## toYearWeek (tarih \[, mod\]) {#toyearweekdatemode} + +Bir tarih için yıl ve hafta döndürür. Sonuçtaki yıl, yılın ilk ve son haftası için tarih argümanındaki yıldan farklı olabilir. + +Mod bağımsız değişkeni, toWeek () için mod bağımsız değişkeni gibi çalışır. Tek bağımsız değişken sözdizimi için 0 mod değeri kullanılır. + +`toISOYear()`eşdeğer bir uyumluluk işlevidir `intDiv(toYearWeek(date,3),100)`. + +**Örnek** + +``` sql +SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; +``` + +``` text +┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ +│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ +└────────────┴───────────┴───────────┴───────────┘ +``` + +## şimdi {#now} + +Sıfır bağımsız değişkeni kabul eder ve geçerli saati istek yürütme anlarından birinde döndürür. +Bu işlev, isteğin tamamlanması uzun zaman alsa bile bir sabit döndürür. + +## bugünkü {#today} + +Sıfır bağımsız değişkeni kabul eder ve geçerli tarihi, istek yürütme anlarından birinde döndürür. +Olarak aynı ‘toDate(now())’. + +## dün {#yesterday} + +Sıfır bağımsız değişkeni kabul eder ve istek yürütme anlarından birinde dünün tarihini döndürür. +Olarak aynı ‘today() - 1’. + +## zaman dilimi {#timeslot} + +Yarım saat için zaman yuvarlar. +Bu fonksiyon (kayıt olmak için özeldir.Metrica, yarım saat, bir izleme etiketi, tek bir kullanıcının ardışık sayfa görüntülemelerini, zaman içinde bu miktardan kesinlikle daha fazla farklılık gösteriyorsa, bir oturumu iki oturuma bölmek için minimum zaman miktarıdır. Bu, ilgili oturumda bulunan sayfa görüntülemelerini aramak için tuples (etiket kimliği, kullanıcı kimliği ve zaman dilimi) kullanılabileceği anlamına gelir. + +## toYYYYMM {#toyyyymm} + +Bir tarih veya tarih ile saat, yıl ve ay numarasını (YYYY \* 100 + MM) içeren bir Uınt32 numarasına dönüştürür. + +## toYYYYMMDD {#toyyyymmdd} + +Bir tarih veya tarih ile saat, yıl ve ay numarasını içeren bir Uınt32 numarasına dönüştürür (YYYY \* 10000 + MM \* 100 + DD). + +## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} + +Bir tarihi veya tarihi, yıl ve ay numarasını içeren bir Uınt64 numarasına dönüştürür (YYYY \* 1000000 + MM \* 1000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss). + +## addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} + +İşlev, bir tarih/DateTime aralığına bir tarih/DateTime ekler ve ardından Tarih/Datetime’ı döndürür. Mesela: + +``` sql +WITH + toDate('2018-01-01') AS date, + toDateTime('2018-01-01 00:00:00') AS date_time +SELECT + addYears(date, 1) AS add_years_with_date, + addYears(date_time, 1) AS add_years_with_date_time +``` + +``` text +┌─add_years_with_date─┬─add_years_with_date_time─┐ +│ 2019-01-01 │ 2019-01-01 00:00:00 │ +└─────────────────────┴──────────────────────────┘ +``` + +## subtractYears, subtractMonths, subtractWeeks, subtractDays, subtractHours, subtractMinutes, subtractSeconds, subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} + +Fonksiyon bir tarih/DateTime aralığını bir tarih/DateTime olarak çıkarır ve ardından Tarih/Datetime’ı döndürür. Mesela: + +``` sql +WITH + toDate('2019-01-01') AS date, + toDateTime('2019-01-01 00:00:00') AS date_time +SELECT + subtractYears(date, 1) AS subtract_years_with_date, + subtractYears(date_time, 1) AS subtract_years_with_date_time +``` + +``` text +┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ +│ 2018-01-01 │ 2018-01-01 00:00:00 │ +└──────────────────────────┴───────────────────────────────┘ +``` + +## dateDiff {#datediff} + +İki Date veya DateTime değerleri arasındaki farkı döndürür. + +**Sözdizimi** + +``` sql +dateDiff('unit', startdate, enddate, [timezone]) +``` + +**Parametre** + +- `unit` — Time unit, in which the returned value is expressed. [Dize](../syntax.md#syntax-string-literal). + + Supported values: + + | unit | + | ---- | + |second | + |minute | + |hour | + |day | + |week | + |month | + |quarter | + |year | + +- `startdate` — The first time value to compare. [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). + +- `enddate` — The second time value to compare. [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). + +- `timezone` — Optional parameter. If specified, it is applied to both `startdate` ve `enddate`. Belirtilmemişse, saat dilimleri `startdate` ve `enddate` kullanılır. Aynı değilse, sonuç belirtilmemiştir. + +**Döndürülen değer** + +Arasındaki fark `startdate` ve `enddate` ifade edilen `unit`. + +Tür: `int`. + +**Örnek** + +Sorgu: + +``` sql +SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); +``` + +Sonuç: + +``` text +┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ +│ 25 │ +└────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## (StartTime, Süresi,\[, Boyutu zaman yuvasının\]) {#timeslotsstarttime-duration-size} + +Başlayan bir zaman aralığı için ‘StartTime’ ve devam etmek için ‘Duration’ saniye, bu aralıktan aşağı yuvarlanan noktalardan oluşan zaman içinde bir dizi moment döndürür ‘Size’ saniyeler içinde. ‘Size’ isteğe bağlı bir parametredir: varsayılan olarak 1800 olarak ayarlanmış bir sabit Uİnt32. +Mesela, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. +Bu, ilgili oturumda sayfa görüntülemelerini aramak için gereklidir. + +## formatDateTime (saat, Biçim \[, Saat Dilimi\]) {#formatdatetime} + +Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. + +Biçim için desteklenen değiştiriciler: +(“Example” sütun, zaman için biçimlendirme sonucunu gösterir `2018-01-02 22:33:44`) + +| Değiştirici | Açıklama | Örnek | +|-------------|----------------------------------------------------------|------------| +| %C | yıl 100’e bölünür ve tamsayıya kesilir (00-99) | 20 | +| %d | Ayın günü, sıfır yastıklı (01-31) | 02 | +| %D | Kısa MM/DD/YY tarih, eşdeğer %m / %d / % y | 01/02/18 | +| %e | Ayın günü, boşluk dolgulu (1-31) | 2 | +| %F | kısa YYYY-AA-DD tarih, eşdeğer %Y-%m - %d | 2018-01-02 | +| %H | 24 saat formatında saat (00-23) | 22 | +| %I | 12h formatında saat (01-12) | 10 | +| %j | yılın günü (001-366) | 002 | +| %metre | ondalık sayı olarak ay (01-12) | 01 | +| %M | dakika (00-59) | 33 | +| %ve | new-line char (ac (ter (") | | +| %p | AM veya PM atama | PM | +| %R | 24-hour HH: MM Zaman, eşdeğer %H:%M | 22:33 | +| %S | ikinci (00-59) | 44 | +| %t | yatay-sekme karakteri (’) | | +| %T | ISO 8601 saat biçimi (HH:MM:SS), eşdeğer %H:%M: % S | 22:33:44 | +| %u | ISO 8601 hafta içi sayı olarak Pazartesi olarak 1 (1-7) | 2 | +| %V | ISO 8601 hafta numarası (01-53) | 01 | +| %g | Pazar günü 0 (0-6) olarak ondalık sayı olarak hafta içi) | 2 | +| %y | Yıl, son iki basamak (00-99) | 18 | +| %Y | Yıllık | 2018 | +| %% | im | % | + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/tr/sql-reference/functions/encoding-functions.md b/docs/tr/sql-reference/functions/encoding-functions.md new file mode 100644 index 00000000000..e25ffa04998 --- /dev/null +++ b/docs/tr/sql-reference/functions/encoding-functions.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 52 +toc_title: "Kodlam\u0131\u015F" +--- + +# Kodlama fonksiyonları {#encoding-functions} + +## kömürleşmek {#char} + +Geçirilen bağımsız değişkenlerin sayısı olarak uzunluğu olan dizeyi döndürür ve her bayt karşılık gelen bağımsız değişken değerine sahiptir. Sayısal türlerin birden çok bağımsız değişkeni kabul eder. Bağımsız değişken değeri uint8 veri türü aralığının dışındaysa, Olası yuvarlama ve taşma ile Uint8’e dönüştürülür. + +**Sözdizimi** + +``` sql +char(number_1, [number_2, ..., number_n]); +``` + +**Parametre** + +- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Tamsayı](../../sql-reference/data-types/int-uint.md), [Yüzdürmek](../../sql-reference/data-types/float.md). + +**Döndürülen değer** + +- verilen bayt dizisi. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello +``` + +Sonuç: + +``` text +┌─hello─┐ +│ hello │ +└───────┘ +``` + +Karşılık gelen baytları geçirerek bir rasgele kodlama dizesi oluşturabilirsiniz. İşte UTF-8 için örnek: + +Sorgu: + +``` sql +SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; +``` + +Sonuç: + +``` text +┌─hello──┐ +│ привет │ +└────────┘ +``` + +Sorgu: + +``` sql +SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; +``` + +Sonuç: + +``` text +┌─hello─┐ +│ 你好 │ +└───────┘ +``` + +## büyü {#hex} + +Bağımsız değişkenin onaltılık gösterimini içeren bir dize döndürür. + +**Sözdizimi** + +``` sql +hex(arg) +``` + +İşlev büyük harfler kullanıyor `A-F` ve herhangi bir önek kullanmamak (gibi `0x`) veya sonekler (gibi `h`). + +Tamsayı argümanları için, onaltılık basamak yazdırır (“nibbles”) en önemliden en önemlisine (big endian veya “human readable” sipariş). En önemli sıfır olmayan baytla başlar (önde gelen sıfır bayt atlanır), ancak önde gelen basamak sıfır olsa bile her baytın her iki basamağını da yazdırır. + +Örnek: + +**Örnek** + +Sorgu: + +``` sql +SELECT hex(1); +``` + +Sonuç: + +``` text +01 +``` + +Tip değerleri `Date` ve `DateTime` karşılık gelen tamsayılar olarak biçimlendirilir (tarih için çağdan bu yana geçen gün sayısı ve datetime için Unix zaman damgasının değeri). + +İçin `String` ve `FixedString`, tüm bayt sadece iki onaltılık sayı olarak kodlanır. Sıfır bayt ihmal edilmez. + +Kayan nokta ve ondalık türlerinin değerleri, bellekteki gösterimi olarak kodlanır. Küçük endian mimarisini desteklediğimiz için, bunlar küçük endian’da kodlanmıştır. Sıfır önde gelen / sondaki bayt ihmal edilmez. + +**Parametre** + +- `arg` — A value to convert to hexadecimal. Types: [Dize](../../sql-reference/data-types/string.md), [Uİnt](../../sql-reference/data-types/int-uint.md), [Yüzdürmek](../../sql-reference/data-types/float.md), [Ondalık](../../sql-reference/data-types/decimal.md), [Tarihli](../../sql-reference/data-types/date.md) veya [DateTime](../../sql-reference/data-types/datetime.md). + +**Döndürülen değer** + +- Bağımsız değişken onaltılık gösterimi ile bir dize. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); +``` + +Sonuç: + +``` text +┌─hex_presentation─┐ +│ 00007041 │ +│ 00008041 │ +└──────────────────┘ +``` + +Sorgu: + +``` sql +SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); +``` + +Sonuç: + +``` text +┌─hex_presentation─┐ +│ 0000000000002E40 │ +│ 0000000000003040 │ +└──────────────────┘ +``` + +## unhex (str) {#unhexstr} + +Onaltılık basamak herhangi bir sayıda içeren bir dize kabul eder ve karşılık gelen bayt içeren bir dize döndürür. Hem büyük hem de küçük harfleri destekler a-F. onaltılık basamak sayısı bile olmak zorunda değildir. Tek ise, son rakam 00-0F baytın en az önemli yarısı olarak yorumlanır. Bağımsız değişken dizesi onaltılık basamaklardan başka bir şey içeriyorsa, uygulama tanımlı bazı sonuçlar döndürülür (bir özel durum atılmaz). +Sonucu bir sayıya dönüştürmek istiyorsanız, ‘reverse’ ve ‘reinterpretAsType’ işlevler. + +## UUİDStringToNum (str) {#uuidstringtonumstr} + +Biçiminde 36 karakter içeren bir dize kabul eder `123e4567-e89b-12d3-a456-426655440000` ve bir fixedstring(16) bayt kümesi olarak döndürür. + +## UUİDNumToString (str) {#uuidnumtostringstr} + +FixedString(16) değerini kabul eder. Metin biçiminde 36 karakter içeren bir dize döndürür. + +## bitmaskToList (num) {#bitmasktolistnum} + +Bir tamsayı kabul eder. Özetlendiğinde kaynak sayısını toplayan iki güç listesini içeren bir dize döndürür. Artan düzende metin biçiminde boşluk bırakmadan virgülle ayrılırlar. + +## bitmaskToArray (num) {#bitmasktoarraynum} + +Bir tamsayı kabul eder. Özetlendiğinde kaynak sayısını toplayan iki güç listesini içeren bir uint64 sayı dizisi döndürür. Dizideki sayılar artan düzendedir. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/tr/sql-reference/functions/ext-dict-functions.md b/docs/tr/sql-reference/functions/ext-dict-functions.md new file mode 100644 index 00000000000..0e04fd67aa4 --- /dev/null +++ b/docs/tr/sql-reference/functions/ext-dict-functions.md @@ -0,0 +1,205 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 58 +toc_title: "Harici S\xF6zl\xFCklerle \xE7al\u0131\u015Fma" +--- + +# Harici Sözlüklerle Çalışmak İçin İşlevler {#ext_dict_functions} + +Dış sözlükleri bağlama ve yapılandırma hakkında bilgi için bkz. [Dış söz dictionarieslükler](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +## dictGet {#dictget} + +Harici bir sözlükten bir değer alır. + +``` sql +dictGet('dict_name', 'attr_name', id_expr) +dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Parametre** + +- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql-reference/data-types/int-uint.md) veya [Demet](../../sql-reference/data-types/tuple.md)- sözlük yapılandırmasına bağlı olarak değer yazın. +- `default_value_expr` — Value returned if the dictionary doesn’t contain a row with the `id_expr` anahtar. [İfade](../syntax.md#syntax-expressions) veri türü için yapılandırılmış değeri döndürme `attr_name` öznitelik. + +**Döndürülen değer** + +- ClickHouse özniteliği başarıyla ayrıştırırsa [öznitelik veri türü](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), fonksiyonlar karşılık gelen sözlük özniteliğinin değerini döndürür `id_expr`. + +- Anahtar yoksa, karşılık gelen `id_expr`, söz thelükte, sonra: + + - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. + +Clickhouse, özniteliğin değerini ayrıştıramazsa veya değer öznitelik veri türüyle eşleşmiyorsa bir özel durum atar. + +**Örnek** + +Metin dosyası oluşturma `ext-dict-text.csv` aşağıdakileri içeren: + +``` text +1,1 +2,2 +``` + +İlk sütun `id` ikinci sütun `c1`. + +Dış sözlüğü yapılandırma: + +``` xml + + + ext-dict-test + + + /path-to/ext-dict-test.csv + CSV + + + + + + + + id + + + c1 + UInt32 + + + + 0 + + +``` + +Sorguyu gerçekleştir: + +``` sql +SELECT + dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, + toTypeName(val) AS type +FROM system.numbers +LIMIT 3 +``` + +``` text +┌─val─┬─type───┐ +│ 1 │ UInt32 │ +│ 2 │ UInt32 │ +│ 20 │ UInt32 │ +└─────┴────────┘ +``` + +**Ayrıca Bakınız** + +- [Dış Söz Dictionarieslükler](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) + +## dictHas {#dicthas} + +Bir anahtar sözlükte mevcut olup olmadığını denetler. + +``` sql +dictHas('dict_name', id_expr) +``` + +**Parametre** + +- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip değeri. + +**Döndürülen değer** + +- 0, anahtar yoksa. +- 1, bir anahtar varsa. + +Tür: `UInt8`. + +## dictGetHierarchy {#dictgethierarchy} + +Bir anahtarın tüm ebeveynlerini içeren bir dizi oluşturur. [hiyerarş dictionaryik sözlük](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md). + +**Sözdizimi** + +``` sql +dictGetHierarchy('dict_name', key) +``` + +**Parametre** + +- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). +- `key` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip değeri. + +**Döndürülen değer** + +- Anahtar için ebeveynler. + +Tür: [Dizi (Uİnt64)](../../sql-reference/data-types/array.md). + +## dictİsİn {#dictisin} + +Sözlükteki tüm hiyerarşik zincir boyunca bir anahtarın atasını kontrol eder. + +``` sql +dictIsIn('dict_name', child_id_expr, ancestor_id_expr) +``` + +**Parametre** + +- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). +- `child_id_expr` — Key to be checked. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip değeri. +- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` anahtar. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip değeri. + +**Döndürülen değer** + +- 0, eğer `child_id_expr` bir çocuk değil mi `ancestor_id_expr`. +- 1, Eğer `child_id_expr` bir çocuk `ancestor_id_expr` veya eğer `child_id_expr` is an `ancestor_id_expr`. + +Tür: `UInt8`. + +## Diğer Fonksiyonlar {#ext_dict_functions-other} + +ClickHouse sözlük yapılandırma ne olursa olsun belirli bir veri türü için sözlük öznitelik değerlerini dönüştürmek özel işlevleri destekler. + +İşlevler: + +- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` +- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` +- `dictGetFloat32`, `dictGetFloat64` +- `dictGetDate` +- `dictGetDateTime` +- `dictGetUUID` +- `dictGetString` + +Tüm bu işlevler `OrDefault` değişiklik. Mesela, `dictGetDateOrDefault`. + +Sözdizimi: + +``` sql +dictGet[Type]('dict_name', 'attr_name', id_expr) +dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) +``` + +**Parametre** + +- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). +- `attr_name` — Name of the column of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). +- `id_expr` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql-reference/data-types/int-uint.md)- tip değeri. +- `default_value_expr` — Value which is returned if the dictionary doesn’t contain a row with the `id_expr` anahtar. [İfade](../syntax.md#syntax-expressions) veri türü için yapılandırılmış bir değer döndürme `attr_name` öznitelik. + +**Döndürülen değer** + +- ClickHouse özniteliği başarıyla ayrıştırırsa [öznitelik veri türü](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes), fonksiyonlar karşılık gelen sözlük özniteliğinin değerini döndürür `id_expr`. + +- İsten nomiyorsa `id_expr` söz thelükte o zaman: + + - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. + - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. + +Clickhouse, özniteliğin değerini ayrıştıramazsa veya değer öznitelik veri türüyle eşleşmiyorsa bir özel durum atar. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/tr/sql-reference/functions/functions-for-nulls.md b/docs/tr/sql-reference/functions/functions-for-nulls.md new file mode 100644 index 00000000000..0f7ae8af158 --- /dev/null +++ b/docs/tr/sql-reference/functions/functions-for-nulls.md @@ -0,0 +1,312 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 63 +toc_title: "Null arg\xFCmanlarla \xE7al\u0131\u015Fma" +--- + +# Null Agregalarla çalışmak için işlevler {#functions-for-working-with-nullable-aggregates} + +## isNull {#isnull} + +Bağımsız değişken olup olmadığını denetler [NULL](../syntax.md#null). + +``` sql +isNull(x) +``` + +**Parametre** + +- `x` — A value with a non-compound data type. + +**Döndürülen değer** + +- `1` eğer `x` oluyor `NULL`. +- `0` eğer `x` değildir `NULL`. + +**Örnek** + +Giriş tablosu + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Sorgu + +``` sql +SELECT x FROM t_null WHERE isNull(y) +``` + +``` text +┌─x─┐ +│ 1 │ +└───┘ +``` + +## isNotNull {#isnotnull} + +Bağımsız değişken olup olmadığını denetler [NULL](../syntax.md#null). + +``` sql +isNotNull(x) +``` + +**Parametre:** + +- `x` — A value with a non-compound data type. + +**Döndürülen değer** + +- `0` eğer `x` oluyor `NULL`. +- `1` eğer `x` değildir `NULL`. + +**Örnek** + +Giriş tablosu + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Sorgu + +``` sql +SELECT x FROM t_null WHERE isNotNull(y) +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## birleşmek {#coalesce} + +Olup olmadığını soldan sağa denetler `NULL` argümanlar geçti ve ilk olmayan döndürür-`NULL` değişken. + +``` sql +coalesce(x,...) +``` + +**Parametre:** + +- Bileşik olmayan tipte herhangi bir sayıda parametre. Tüm parametreler veri türüne göre uyumlu olmalıdır. + +**Döndürülen değerler** + +- İlk sigara-`NULL` değişken. +- `NULL`, eğer tüm argümanlar `NULL`. + +**Örnek** + +Bir müşteriyle iletişim kurmak için birden çok yol belirtebilecek kişilerin listesini düşünün. + +``` text +┌─name─────┬─mail─┬─phone─────┬──icq─┐ +│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ +│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└──────────┴──────┴───────────┴──────┘ +``` + +Bu `mail` ve `phone` alanlar String tip ofindedir, ancak `icq` Fi fieldeld is `UInt32`, bu yüzden dönüştürülmesi gerekiyor `String`. + +Müşteri için ilk kullanılabilir iletişim yöntemini kişi listesinden alın: + +``` sql +SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook +``` + +``` text +┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ +│ client 1 │ 123-45-67 │ +│ client 2 │ ᴺᵁᴸᴸ │ +└──────────┴──────────────────────────────────────────────────────┘ +``` + +## ifNull {#ifnull} + +Ana bağımsız değişken ise alternatif bir değer döndürür `NULL`. + +``` sql +ifNull(x,alt) +``` + +**Parametre:** + +- `x` — The value to check for `NULL`. +- `alt` — The value that the function returns if `x` oluyor `NULL`. + +**Döndürülen değerler** + +- Değer `x`, eğer `x` değildir `NULL`. +- Değer `alt`, eğer `x` oluyor `NULL`. + +**Örnek** + +``` sql +SELECT ifNull('a', 'b') +``` + +``` text +┌─ifNull('a', 'b')─┐ +│ a │ +└──────────────────┘ +``` + +``` sql +SELECT ifNull(NULL, 'b') +``` + +``` text +┌─ifNull(NULL, 'b')─┐ +│ b │ +└───────────────────┘ +``` + +## nullİf {#nullif} + +Dönüşler `NULL` argümanlar eşitse. + +``` sql +nullIf(x, y) +``` + +**Parametre:** + +`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. + +**Döndürülen değerler** + +- `NULL`, argümanlar eşitse. +- Bu `x` bağımsız değişkenler eşit değilse, değer. + +**Örnek** + +``` sql +SELECT nullIf(1, 1) +``` + +``` text +┌─nullIf(1, 1)─┐ +│ ᴺᵁᴸᴸ │ +└──────────────┘ +``` + +``` sql +SELECT nullIf(1, 2) +``` + +``` text +┌─nullIf(1, 2)─┐ +│ 1 │ +└──────────────┘ +``` + +## assumeNotNull {#assumenotnull} + +Bir tür değeri ile sonuçlanır [Nullable](../../sql-reference/data-types/nullable.md) bir sigara için- `Nullable` eğer değer değil `NULL`. + +``` sql +assumeNotNull(x) +``` + +**Parametre:** + +- `x` — The original value. + +**Döndürülen değerler** + +- Olmayan orijinal değeri-`Nullable` tipi, değilse `NULL`. +- Olmayan için varsayılan değer-`Nullable` özgün değer ise yazın `NULL`. + +**Örnek** + +Düşünün `t_null` Tablo. + +``` sql +SHOW CREATE TABLE t_null +``` + +``` text +┌─statement─────────────────────────────────────────────────────────────────┐ +│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ +└───────────────────────────────────────────────────────────────────────────┘ +``` + +``` text +┌─x─┬────y─┐ +│ 1 │ ᴺᵁᴸᴸ │ +│ 2 │ 3 │ +└───┴──────┘ +``` + +Uygula `assumeNotNull` fonksiyonu için `y` sütun. + +``` sql +SELECT assumeNotNull(y) FROM t_null +``` + +``` text +┌─assumeNotNull(y)─┐ +│ 0 │ +│ 3 │ +└──────────────────┘ +``` + +``` sql +SELECT toTypeName(assumeNotNull(y)) FROM t_null +``` + +``` text +┌─toTypeName(assumeNotNull(y))─┐ +│ Int8 │ +│ Int8 │ +└──────────────────────────────┘ +``` + +## toNullable {#tonullable} + +Bağımsız değişken türünü dönüştürür `Nullable`. + +``` sql +toNullable(x) +``` + +**Parametre:** + +- `x` — The value of any non-compound type. + +**Döndürülen değer** + +- Bir ile giriş değeri `Nullable` tür. + +**Örnek** + +``` sql +SELECT toTypeName(10) +``` + +``` text +┌─toTypeName(10)─┐ +│ UInt8 │ +└────────────────┘ +``` + +``` sql +SELECT toTypeName(toNullable(10)) +``` + +``` text +┌─toTypeName(toNullable(10))─┐ +│ Nullable(UInt8) │ +└────────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/tr/sql-reference/functions/geo.md b/docs/tr/sql-reference/functions/geo.md new file mode 100644 index 00000000000..fef22263bf1 --- /dev/null +++ b/docs/tr/sql-reference/functions/geo.md @@ -0,0 +1,510 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 62 +toc_title: "Co\u011Frafi koordinatlar ile \xE7al\u0131\u015Fma" +--- + +# Coğrafi Koordinatlarla çalışmak için Fonksiyonlar {#functions-for-working-with-geographical-coordinates} + +## greatCircleDistance {#greatcircledistance} + +Dünya yüzeyindeki iki nokta arasındaki mesafeyi kullanarak hesaplayın [büyük daire formülü](https://en.wikipedia.org/wiki/Great-circle_distance). + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**Giriş parametreleri** + +- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. +- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. +- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. +- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. + +Pozitif değerler Kuzey enlemi ve Doğu boylamına karşılık gelir ve negatif değerler Güney enlemi ve Batı boylamına karşılık gelir. + +**Döndürülen değer** + +Dünya yüzeyindeki iki nokta arasındaki mesafe, metre cinsinden. + +Girdi parametre değerleri aralığın dışına düştüğünde bir özel durum oluşturur. + +**Örnek** + +``` sql +SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) +``` + +``` text +┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ +│ 14132374.194975413 │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## pointİnEllipses {#pointinellipses} + +Noktanın elipslerden en az birine ait olup olmadığını kontrol eder. +Koordinatlar kartezyen koordinat sisteminde geometriktir. + +``` sql +pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) +``` + +**Giriş parametreleri** + +- `x, y` — Coordinates of a point on the plane. +- `xᵢ, yᵢ` — Coordinates of the center of the `i`-inci üç nokta. +- `aᵢ, bᵢ` — Axes of the `i`- x, y koordinatları birimlerinde üç nokta. + +Giriş parametreleri olmalıdır `2+4⋅n`, nere `n` elips sayısıdır. + +**Döndürülen değerler** + +`1` nokta elipslerden en az birinin içindeyse; `0`hayır değil. + +**Örnek** + +``` sql +SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) +``` + +``` text +┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ +│ 1 │ +└─────────────────────────────────────────────────┘ +``` + +## pointİnPolygon {#pointinpolygon} + +Noktanın düzlemdeki poligona ait olup olmadığını kontrol eder. + +``` sql +pointInPolygon((x, y), [(a, b), (c, d) ...], ...) +``` + +**Giriş değerleri** + +- `(x, y)` — Coordinates of a point on the plane. Data type — [Demet](../../sql-reference/data-types/tuple.md) — A tuple of two numbers. +- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [Dizi](../../sql-reference/data-types/array.md). Her köşe bir çift koordinat ile temsil edilir `(a, b)`. Köşeler saat yönünde veya saat yönünün tersine sırayla belirtilmelidir. Minimum köşe sayısı 3’tür. Çokgen sabit olmalıdır. +- Fonksiyon ayrıca delikli çokgenleri de destekler (bölümleri keser). Bu durumda, işlevin ek argümanlarını kullanarak kesilen bölümleri tanımlayan çokgenler ekleyin. İşlev, basit olmayan bağlı çokgenleri desteklemez. + +**Döndürülen değerler** + +`1` nokta çokgenin içinde ise, `0` hayır değil. +Nokta çokgen sınırında ise, işlev 0 veya 1 döndürebilir. + +**Örnek** + +``` sql +SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## geohashEncode {#geohashencode} + +Enlem ve boylamı bir geohash-string olarak kodlar, Lütfen bakınız (http://geohash.org/, https://en.wikipedia.org/wiki/Geohash). + +``` sql +geohashEncode(longitude, latitude, [precision]) +``` + +**Giriş değerleri** + +- boylam-kodlamak istediğiniz koordinatın boylam kısmı. Aralık floatingta yüz floatingen`[-180°, 180°]` +- latitude-kodlamak istediğiniz koordinatın enlem kısmı. Aralık floatingta yüz floatingen `[-90°, 90°]` +- hassas-isteğe bağlı, elde edilen kodlanmış dizenin uzunluğu, varsayılan olarak `12`. Aralıktaki tamsayı `[1, 12]`. Herhangi bir değer daha az `1` veya daha büyük `12` sessizce dönüştürülür `12`. + +**Döndürülen değerler** + +- alfanümerik `String` kodlanmış koordinat (base32-kodlama alfabesinin değiştirilmiş versiyonu kullanılır). + +**Örnek** + +``` sql +SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res +``` + +``` text +┌─res──────────┐ +│ ezs42d000000 │ +└──────────────┘ +``` + +## geohashDecode {#geohashdecode} + +Herhangi bir geohash kodlu dizeyi boylam ve enlem olarak çözer. + +**Giriş değerleri** + +- kodlanmış dize-geohash kodlanmış dize. + +**Döndürülen değerler** + +- (boylam, enlem) - 2-tuple `Float64` boylam ve enlem değerleri. + +**Örnek** + +``` sql +SELECT geohashDecode('ezs42') AS res +``` + +``` text +┌─res─────────────────────────────┐ +│ (-5.60302734375,42.60498046875) │ +└─────────────────────────────────┘ +``` + +## geoToH3 {#geotoh3} + +Dönüşler [H3](https://uber.github.io/h3/#/documentation/overview/introduction) nokta Endeksi `(lon, lat)` belirtilen çözünürlük ile. + +[H3](https://uber.github.io/h3/#/documentation/overview/introduction) Dünya yüzeyinin altıgen fayanslara bile bölündüğü coğrafi bir indeksleme sistemidir. Bu sistem hiyerarşiktir, örn. üst seviyedeki her altıgen yedi hatta daha küçük olanlara bölünebilir. + +Bu endeks öncelikle kovalama yerleri ve diğer coğrafi manipülasyonlar için kullanılır. + +**Sözdizimi** + +``` sql +geoToH3(lon, lat, resolution) +``` + +**Parametre** + +- `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]`. Tür: [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- Altıgen dizin numarası. +- Hata durumunda 0. + +Tür: `UInt64`. + +**Örnek** + +Sorgu: + +``` sql +SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index +``` + +Sonuç: + +``` text +┌────────────h3Index─┐ +│ 644325524701193974 │ +└────────────────────┘ +``` + +## geohashesİnBox {#geohashesinbox} + +Verilen kutunun içine giren ve verilen kutunun sınırlarını kesişen, temel olarak diziye düzleştirilmiş bir 2D ızgarası olan bir dizi geohash kodlu dizeler dizisi döndürür. + +**Giriş değerleri** + +- longitude\_min - min boylam, aralıkta kayan değer `[-180°, 180°]` +- latitude\_min - min enlem, aralıkta kayan değer `[-90°, 90°]` +- longitude\_max-maksimum boylam, aralıkta kayan değer `[-180°, 180°]` +- latitude\_max-maksimum enlem, aralıkta kayan değer `[-90°, 90°]` +- hassas-geohash hassas, `UInt8` Aralık inta `[1, 12]` + +Lütfen tüm koordinat parametrelerinin aynı tipte olması gerektiğini unutmayın: `Float32` veya `Float64`. + +**Döndürülen değerler** + +- verilen alanı kapsayan geohash kutularının hassas uzun dizeleri dizisi, öğelerin sırasına güvenmemelisiniz. +- \[\]- eğer boş dizi *dakika* değerleri *enlem* ve *Boylam* karşılık gelenden daha az değil *maksimum* değerler. + +Ortaya çıkan dizi 10’000’ 000 ürün uzunluğundaysa, işlevin bir istisna atacağını lütfen unutmayın. + +**Örnek** + +``` sql +SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos +``` + +``` text +┌─thasos──────────────────────────────────────┐ +│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ +└─────────────────────────────────────────────┘ +``` + +## h3GetBaseCell {#h3getbasecell} + +Dizin temel hücre numarasını döndürür. + +**Sözdizimi** + +``` sql +h3GetBaseCell(index) +``` + +**Parametre** + +- `index` — Hexagon index number. Type: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- Altıgen baz hücre numarası. Tür: [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT h3GetBaseCell(612916788725809151) as basecell +``` + +Sonuç: + +``` text +┌─basecell─┐ +│ 12 │ +└──────────┘ +``` + +## h3HexAreaM2 {#h3hexaream2} + +Verilen çözünürlükte metrekare ortalama altıgen alan. + +**Sözdizimi** + +``` sql +h3HexAreaM2(resolution) +``` + +**Parametre** + +- `resolution` — Index resolution. Range: `[0, 15]`. Tür: [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- Area in m². Type: [Float64](../../sql-reference/data-types/float.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT h3HexAreaM2(13) as area +``` + +Sonuç: + +``` text +┌─area─┐ +│ 43.9 │ +└──────┘ +``` + +## h3İndexesAreNeighbors {#h3indexesareneighbors} + +Sağlanan H3indexlerin komşu olup olmadığını döndürür. + +**Sözdizimi** + +``` sql +h3IndexesAreNeighbors(index1, index2) +``` + +**Parametre** + +- `index1` — Hexagon index number. Type: [Uİnt64](../../sql-reference/data-types/int-uint.md). +- `index2` — Hexagon index number. Type: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- Dönüşler `1` dizinler komşu ise, `0` başka. Tür: [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n +``` + +Sonuç: + +``` text +┌─n─┐ +│ 1 │ +└───┘ +``` + +## h3ToChildren {#h3tochildren} + +Verilen dizinin alt dizinlerini içeren bir dizi döndürür. + +**Sözdizimi** + +``` sql +h3ToChildren(index, resolution) +``` + +**Parametre** + +- `index` — Hexagon index number. Type: [Uİnt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. Tür: [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- Alt H3 dizinleri ile dizi. Dizi türü: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT h3ToChildren(599405990164561919, 6) AS children +``` + +Sonuç: + +``` text +┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## h3ToParent {#h3toparent} + +Verilen dizini içeren üst (kaba) dizini döndürür. + +**Sözdizimi** + +``` sql +h3ToParent(index, resolution) +``` + +**Parametre** + +- `index` — Hexagon index number. Type: [Uİnt64](../../sql-reference/data-types/int-uint.md). +- `resolution` — Index resolution. Range: `[0, 15]`. Tür: [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- Ana H3 Endeksi. Tür: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT h3ToParent(599405990164561919, 3) as parent +``` + +Sonuç: + +``` text +┌─────────────parent─┐ +│ 590398848891879423 │ +└────────────────────┘ +``` + +## h3ToString {#h3tostring} + +Dizinin H3ındex gösterimini dize gösterimine dönüştürür. + +``` sql +h3ToString(index) +``` + +**Parametre** + +- `index` — Hexagon index number. Type: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- H3 dizininin dize gösterimi. Tür: [Dize](../../sql-reference/data-types/string.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT h3ToString(617420388352917503) as h3_string +``` + +Sonuç: + +``` text +┌─h3_string───────┐ +│ 89184926cdbffff │ +└─────────────────┘ +``` + +## stringToH3 {#stringtoh3} + +Dize gösterimini H3ındex (Uİnt64) gösterimine dönüştürür. + +``` sql +stringToH3(index_str) +``` + +**Parametre** + +- `index_str` — String representation of the H3 index. Type: [Dize](../../sql-reference/data-types/string.md). + +**Döndürülen değerler** + +- Altıgen dizin numarası. Hata 0 döndürür. Tür: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT stringToH3('89184926cc3ffff') as index +``` + +Sonuç: + +``` text +┌──────────────index─┐ +│ 617420388351344639 │ +└────────────────────┘ +``` + +## h3GetResolution {#h3getresolution} + +Dizin çözünürlüğünü döndürür. + +**Sözdizimi** + +``` sql +h3GetResolution(index) +``` + +**Parametre** + +- `index` — Hexagon index number. Type: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değerler** + +- Dizin çözünürlüğü. Aralık: `[0, 15]`. Tür: [Uİnt8](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT h3GetResolution(617420388352917503) as res +``` + +Sonuç: + +``` text +┌─res─┐ +│ 9 │ +└─────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/tr/sql-reference/functions/hash-functions.md b/docs/tr/sql-reference/functions/hash-functions.md new file mode 100644 index 00000000000..b1c7e98c884 --- /dev/null +++ b/docs/tr/sql-reference/functions/hash-functions.md @@ -0,0 +1,446 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 50 +toc_title: Karma +--- + +# Karma Fonksiyonlar {#hash-functions} + +Hash fonksiyonları elementlerin deterministik sözde rastgele karıştırma için kullanılabilir. + +## halfMD5 {#hash-functions-halfmd5} + +[Yorumluyor](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) tüm giriş parametrelerini dizeler olarak hesaplar ve [MD5](https://en.wikipedia.org/wiki/MD5) her biri için karma değeri. Sonra karmaları birleştirir, elde edilen dizenin karmasının ilk 8 baytını alır ve bunları şöyle yorumlar `UInt64` büyük endian bayt sırasına göre. + +``` sql +halfMD5(par1, ...) +``` + +İşlev nispeten yavaştır (işlemci çekirdeği başına saniyede 5 milyon kısa dizge). +Kullanmayı düşünün [sifash64](#hash_functions-siphash64) bunun yerine işlev. + +**Parametre** + +Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql-reference/data-types/index.md). + +**Döndürülen Değer** + +A [Uİnt64](../../sql-reference/data-types/int-uint.md) veri türü karma değeri. + +**Örnek** + +``` sql +SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type +``` + +``` text +┌────────halfMD5hash─┬─type───┐ +│ 186182704141653334 │ UInt64 │ +└────────────────────┴────────┘ +``` + +## MD5 {#hash_functions-md5} + +MD5 bir dizeden hesaplar ve elde edilen bayt kümesini FixedString(16) olarak döndürür. +Özellikle MD5’E ihtiyacınız yoksa, ancak iyi bir şifreleme 128 bit karmasına ihtiyacınız varsa, ‘sipHash128’ bunun yerine işlev. +Md5sum yardımcı programı tarafından çıktı ile aynı sonucu elde etmek istiyorsanız, lower(hex(MD5(s))) kullanın. + +## sifash64 {#hash_functions-siphash64} + +64-bit üretir [Sifash](https://131002.net/siphash/) karma değeri. + +``` sql +sipHash64(par1,...) +``` + +Bu bir şifreleme karma işlevidir. En az üç kat daha hızlı çalışır [MD5](#hash_functions-md5) işlev. + +İşlev [yorumluyor](../../sql-reference/functions/type-conversion-functions.md#type_conversion_functions-reinterpretAsString) tüm giriş parametreleri dizeleri olarak ve bunların her biri için karma değerini hesaplar. Sonra aşağıdaki algoritma ile karmaları birleştirir: + +1. Tüm giriş parametrelerini karma yaptıktan sonra, işlev karma dizisini alır. +2. Fonksiyon birinci ve ikinci öğeleri alır ve bunların dizisi için bir karma hesaplar. +3. Daha sonra işlev, önceki adımda hesaplanan karma değeri ve ilk karma dizinin üçüncü öğesini alır ve bunların dizisi için bir karma hesaplar. +4. Önceki adım, ilk karma dizinin kalan tüm öğeleri için tekrarlanır. + +**Parametre** + +Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql-reference/data-types/index.md). + +**Döndürülen Değer** + +A [Uİnt64](../../sql-reference/data-types/int-uint.md) veri türü karma değeri. + +**Örnek** + +``` sql +SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type +``` + +``` text +┌──────────────SipHash─┬─type───┐ +│ 13726873534472839665 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## sifash128 {#hash_functions-siphash128} + +Bir dizeden Sifash hesaplar. +Bir dize türü bağımsız değişkeni kabul eder. Fixedstring(16) Döndürür. +Sifash64’ten farklıdır, çünkü son xor katlama durumu sadece 128 bit’e kadar yapılır. + +## cityHash64 {#cityhash64} + +64-bit üretir [CityHash](https://github.com/google/cityhash) karma değeri. + +``` sql +cityHash64(par1,...) +``` + +Bu hızlı olmayan şifreleme karma işlevidir. Dize parametreleri için CityHash algoritmasını ve diğer veri türleriyle parametreler için uygulamaya özgü hızlı kriptografik olmayan karma işlevini kullanır. İşlev, nihai sonuçları almak için CityHash birleştiricisini kullanır. + +**Parametre** + +Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql-reference/data-types/index.md). + +**Döndürülen Değer** + +A [Uİnt64](../../sql-reference/data-types/int-uint.md) veri türü karma değeri. + +**Örnekler** + +Çağrı örneği: + +``` sql +SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type +``` + +``` text +┌─────────────CityHash─┬─type───┐ +│ 12072650598913549138 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +Aşağıdaki örnek, tüm tablonun sağlama toplamının satır sırasına kadar doğrulukla nasıl hesaplanacağını gösterir: + +``` sql +SELECT groupBitXor(cityHash64(*)) FROM table +``` + +## intHash32 {#inthash32} + +Herhangi bir tamsayı türünden 32 bit karma kodu hesaplar. +Bu, sayılar için ortalama kalitenin nispeten hızlı bir kriptografik olmayan karma işlevidir. + +## intHash64 {#inthash64} + +Herhangi bir tamsayı türünden 64 bit karma kodu hesaplar. +Inthash32’den daha hızlı çalışır. Ortalama kalite. + +## SHA1 {#sha1} + +## SHA224 {#sha224} + +## SHA256 {#sha256} + +Bir dizeden SHA-1, SHA-224 veya SHA-256 hesaplar ve elde edilen bayt kümesini FixedString(20), FixedString(28) veya FixedString(32) olarak döndürür. +İşlev oldukça yavaş çalışır (SHA-1, işlemci çekirdeği başına saniyede yaklaşık 5 milyon kısa dizgiyi işler, SHA-224 ve SHA-256 ise yaklaşık 2.2 milyon işlem yapar). +Bu işlevi yalnızca belirli bir karma işleve ihtiyacınız olduğunda ve bunu seçemediğinizde kullanmanızı öneririz. +Bu gibi durumlarda bile, SELECTS’TE uygulamak yerine, tabloya eklerken işlev çevrimdışı ve ön hesaplama değerlerini uygulamanızı öneririz. + +## URLHash(url \[, N\]) {#urlhashurl-n} + +Bir tür normalleştirme kullanarak bir URL’den elde edilen bir dize için hızlı, iyi kalitede olmayan şifreleme karma işlevi. +`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` veya `#` sonunda, varsa. +`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` veya `#` sonunda, varsa. +Düzeyleri URLHierarchy aynıdır. Bu fonksiyon (kayıt olmak için özeldir.Metrica. + +## farmHash64 {#farmhash64} + +64-bit üretir [FarmHash](https://github.com/google/farmhash) karma değeri. + +``` sql +farmHash64(par1, ...) +``` + +Fonksiyonu kullanır `Hash64` tüm yöntem [mevcut yöntemler](https://github.com/google/farmhash/blob/master/src/farmhash.h). + +**Parametre** + +Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql-reference/data-types/index.md). + +**Döndürülen Değer** + +A [Uİnt64](../../sql-reference/data-types/int-uint.md) veri türü karma değeri. + +**Örnek** + +``` sql +SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type +``` + +``` text +┌─────────────FarmHash─┬─type───┐ +│ 17790458267262532859 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## javaHash {#hash_functions-javahash} + +Hesaplıyor [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) bir ipten. Bu karma işlevi ne hızlı ne de iyi bir kaliteye sahip değildir. Bunu kullanmanın tek nedeni, bu algoritmanın zaten başka bir sistemde kullanılmasıdır ve tam olarak aynı sonucu hesaplamanız gerekir. + +**Sözdizimi** + +``` sql +SELECT javaHash(''); +``` + +**Döndürülen değer** + +A `Int32` veri türü karma değeri. + +**Örnek** + +Sorgu: + +``` sql +SELECT javaHash('Hello, world!'); +``` + +Sonuç: + +``` text +┌─javaHash('Hello, world!')─┐ +│ -1880044555 │ +└───────────────────────────┘ +``` + +## javaHashUTF16LE {#javahashutf16le} + +Hesaplıyor [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) bir dizeden, UTF-16LE kodlamasında bir dizeyi temsil eden bayt içerdiğini varsayarak. + +**Sözdizimi** + +``` sql +javaHashUTF16LE(stringUtf16le) +``` + +**Parametre** + +- `stringUtf16le` — a string in UTF-16LE encoding. + +**Döndürülen değer** + +A `Int32` veri türü karma değeri. + +**Örnek** + +UTF-16LE kodlanmış dize ile doğru sorgu. + +Sorgu: + +``` sql +SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) +``` + +Sonuç: + +``` text +┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ +│ 3556498 │ +└──────────────────────────────────────────────────────────────┘ +``` + +## hiveHash {#hash-functions-hivehash} + +Hesaplıyor `HiveHash` bir ipten. + +``` sql +SELECT hiveHash(''); +``` + +Bu sadece [JavaHash](#hash_functions-javahash) sıfırlanmış işaret biti ile. Bu işlev kullanılır [Apache Kov Hanı](https://en.wikipedia.org/wiki/Apache_Hive) 3.0 öncesi sürümler için. Bu karma işlevi ne hızlı ne de iyi bir kaliteye sahip değildir. Bunu kullanmanın tek nedeni, bu algoritmanın zaten başka bir sistemde kullanılmasıdır ve tam olarak aynı sonucu hesaplamanız gerekir. + +**Döndürülen değer** + +A `Int32` veri türü karma değeri. + +Tür: `hiveHash`. + +**Örnek** + +Sorgu: + +``` sql +SELECT hiveHash('Hello, world!'); +``` + +Sonuç: + +``` text +┌─hiveHash('Hello, world!')─┐ +│ 267439093 │ +└───────────────────────────┘ +``` + +## metroHash64 {#metrohash64} + +64-bit üretir [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/) karma değeri. + +``` sql +metroHash64(par1, ...) +``` + +**Parametre** + +Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql-reference/data-types/index.md). + +**Döndürülen Değer** + +A [Uİnt64](../../sql-reference/data-types/int-uint.md) veri türü karma değeri. + +**Örnek** + +``` sql +SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type +``` + +``` text +┌────────────MetroHash─┬─type───┐ +│ 14235658766382344533 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## jumpConsistentHash {#jumpconsistenthash} + +Bir Uint64 Formu jumpconsistenthash hesaplar. +İki bağımsız değişkeni kabul eder: bir uint64 tipi anahtar ve kova sayısı. Int32 Döndürür. +Daha fazla bilgi için bağlantıya bakın: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) + +## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} + +Üreten bir [MurmurHash2](https://github.com/aappleby/smhasher) karma değeri. + +``` sql +murmurHash2_32(par1, ...) +murmurHash2_64(par1, ...) +``` + +**Parametre** + +Her iki işlev de değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql-reference/data-types/index.md). + +**Döndürülen Değer** + +- Bu `murmurHash2_32` fonksiyon hash değerini döndürür [Uİnt32](../../sql-reference/data-types/int-uint.md) veri türü. +- Bu `murmurHash2_64` fonksiyon hash değerini döndürür [Uİnt64](../../sql-reference/data-types/int-uint.md) veri türü. + +**Örnek** + +``` sql +SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type +``` + +``` text +┌──────────MurmurHash2─┬─type───┐ +│ 11832096901709403633 │ UInt64 │ +└──────────────────────┴────────┘ +``` + +## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} + +Üreten bir [MurmurHash3](https://github.com/aappleby/smhasher) karma değeri. + +``` sql +murmurHash3_32(par1, ...) +murmurHash3_64(par1, ...) +``` + +**Parametre** + +Her iki işlev de değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql-reference/data-types/index.md). + +**Döndürülen Değer** + +- Bu `murmurHash3_32` fonksiyon bir [Uİnt32](../../sql-reference/data-types/int-uint.md) veri türü karma değeri. +- Bu `murmurHash3_64` fonksiyon bir [Uİnt64](../../sql-reference/data-types/int-uint.md) veri türü karma değeri. + +**Örnek** + +``` sql +SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3─┬─type───┐ +│ 2152717 │ UInt32 │ +└─────────────┴────────┘ +``` + +## murmurHash3\_128 {#murmurhash3-128} + +128-bit üretir [MurmurHash3](https://github.com/aappleby/smhasher) karma değeri. + +``` sql +murmurHash3_128( expr ) +``` + +**Parametre** + +- `expr` — [İfadeler](../syntax.md#syntax-expressions) dönen bir [Dize](../../sql-reference/data-types/string.md)- tip değeri. + +**Döndürülen Değer** + +A [FixedString (16)](../../sql-reference/data-types/fixedstring.md) veri türü karma değeri. + +**Örnek** + +``` sql +SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type +``` + +``` text +┌─MurmurHash3──────┬─type────────────┐ +│ 6�1�4"S5KT�~~q │ FixedString(16) │ +└──────────────────┴─────────────────┘ +``` + +## xxHash32, xxHash64 {#hash-functions-xxhash32} + +Hesaplıyor `xxHash` bir ipten. İki tat, 32 ve 64 bit olarak önerilmiştir. + +``` sql +SELECT xxHash32(''); + +OR + +SELECT xxHash64(''); +``` + +**Döndürülen değer** + +A `Uint32` veya `Uint64` veri türü karma değeri. + +Tür: `xxHash`. + +**Örnek** + +Sorgu: + +``` sql +SELECT xxHash32('Hello, world!'); +``` + +Sonuç: + +``` text +┌─xxHash32('Hello, world!')─┐ +│ 834093149 │ +└───────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [xxHash](http://cyan4973.github.io/xxHash/). + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/tr/sql-reference/functions/higher-order-functions.md b/docs/tr/sql-reference/functions/higher-order-functions.md new file mode 100644 index 00000000000..a7a60007877 --- /dev/null +++ b/docs/tr/sql-reference/functions/higher-order-functions.md @@ -0,0 +1,264 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 57 +toc_title: "Y\xFCksek Sipari\u015F" +--- + +# Yüksek Mertebeden Fonksiyonlar {#higher-order-functions} + +## `->` operatör, lambda (params, expr) fonksiyonu {#operator-lambdaparams-expr-function} + +Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. + +Örnekler: `x -> 2 * x, str -> str != Referer.` + +Daha yüksek mertebeden işlevler yalnızca Lambda işlevlerini işlevsel argümanları olarak kabul edebilir. + +Birden çok bağımsız değişkeni kabul eden bir lambda işlevi, daha yüksek mertebeden bir işleve geçirilebilir. Bu durumda, yüksek mertebeden işlev, bu bağımsız değişkenlerin karşılık geleceği aynı uzunlukta birkaç diziden geçirilir. + +Gibi bazı işlevler için [arrayCount](#higher_order_functions-array-count) veya [arraySum](#higher_order_functions-array-count), ilk argüman (lambda işlevi) ihmal edilebilir. Bu durumda, aynı eşleme varsayılır. + +Aşağıdaki işlevler için bir lambda işlevi ihmal edilemez: + +- [arrayMap](#higher_order_functions-array-map) +- [arrayFilter](#higher_order_functions-array-filter) +- [arrayFill](#higher_order_functions-array-fill) +- [arrayReverseFill](#higher_order_functions-array-reverse-fill) +- [arraySplit](#higher_order_functions-array-split) +- [arrayReverseSplit](#higher_order_functions-array-reverse-split) +- [arrayFirst](#higher_order_functions-array-first) +- [arrayFirstİndex](#higher_order_functions-array-first-index) + +### arrayMap(func, arr1, …) {#higher_order_functions-array-map} + +Özgün uygulamadan elde edilen bir dizi döndürür `func` fonksiyon inunda her ele elementmana `arr` dizi. + +Örnekler: + +``` sql +SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; +``` + +``` text +┌─res─────┐ +│ [3,4,5] │ +└─────────┘ +``` + +Aşağıdaki örnek, farklı dizilerden bir öğe kümesinin nasıl oluşturulacağını gösterir: + +``` sql +SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res +``` + +``` text +┌─res─────────────────┐ +│ [(1,4),(2,5),(3,6)] │ +└─────────────────────┘ +``` + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayMap` işlev. + +### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} + +Yalnızca öğeleri içeren bir dizi döndürür `arr1` hangi için `func` 0’dan başka bir şey döndürür. + +Örnekler: + +``` sql +SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res +``` + +``` text +┌─res───────────┐ +│ ['abc World'] │ +└───────────────┘ +``` + +``` sql +SELECT + arrayFilter( + (i, x) -> x LIKE '%World%', + arrayEnumerate(arr), + ['Hello', 'abc World'] AS arr) + AS res +``` + +``` text +┌─res─┐ +│ [2] │ +└─────┘ +``` + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFilter` işlev. + +### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} + +Tarama yoluyla `arr1` ilk öğeden son öğeye ve değiştir `arr1[i]` tarafından `arr1[i - 1]` eğer `func` 0 döndürür. İlk eleman `arr1` değiştir notilm .eyecektir. + +Örnekler: + +``` sql +SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res──────────────────────────────┐ +│ [1,1,3,11,12,12,12,5,6,14,14,14] │ +└──────────────────────────────────┘ +``` + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFill` işlev. + +### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} + +Tarama yoluyla `arr1` son öğeden ilk öğeye ve değiştir `arr1[i]` tarafından `arr1[i + 1]` eğer `func` 0 döndürür. The La lastst element of `arr1` değiştir notilm .eyecektir. + +Örnekler: + +``` sql +SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res +``` + +``` text +┌─res────────────────────────────────┐ +│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ +└────────────────────────────────────┘ +``` + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayReverseFill` işlev. + +### arraySplit(func, arr1, …) {#higher_order_functions-array-split} + +Bölme `arr1` birden fazla diziye. Ne zaman `func` 0’dan başka bir şey döndürür, dizi öğenin sol tarafında bölünecektir. Dizi ilk öğeden önce bölünmez. + +Örnekler: + +``` sql +SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res─────────────┐ +│ [[1,2,3],[4,5]] │ +└─────────────────┘ +``` + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arraySplit` işlev. + +### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} + +Bölme `arr1` birden fazla diziye. Ne zaman `func` 0’dan başka bir şey döndürür, dizi öğenin sağ tarafında bölünecektir. Dizi son öğeden sonra bölünmez. + +Örnekler: + +``` sql +SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res +``` + +``` text +┌─res───────────────┐ +│ [[1],[2,3,4],[5]] │ +└───────────────────┘ +``` + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arraySplit` işlev. + +### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} + +Func 0’dan başka bir şey döndüren arr dizisindeki öğelerin sayısını döndürür. Eğer ‘func’ belirtilmemişse, dizideki sıfır olmayan öğelerin sayısını döndürür. + +### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} + +İçinde en az bir öğe varsa 1 değerini döndürür ‘arr’ hangi için ‘func’ 0’dan başka bir şey döndürür. Aksi takdirde, 0 döndürür. + +### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} + +Döner 1 Eğer ‘func’ içindeki tüm öğeler için 0’dan başka bir şey döndürür ‘arr’. Aksi takdirde, 0 döndürür. + +### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} + +Toplamını döndürür ‘func’ değerler. İşlev atlanırsa, sadece dizi öğelerinin toplamını döndürür. + +### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} + +İlk öğeyi döndürür ‘arr1’ dizi hangi ‘func’ 0’dan başka bir şey döndürür. + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFirst` işlev. + +### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} + +İlk öğenin dizinini döndürür ‘arr1’ dizi hangi ‘func’ 0’dan başka bir şey döndürür. + +İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFirstIndex` işlev. + +### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} + +Kaynak dizideki öğelerin kısmi toplamlarının bir dizisini döndürür (çalışan bir toplam). Eğer… `func` işlev belirtilir, daha sonra dizi öğelerinin değerleri toplanmadan önce bu işlev tarafından dönüştürülür. + +Örnek: + +``` sql +SELECT arrayCumSum([1, 1, 1, 1]) AS res +``` + +``` text +┌─res──────────┐ +│ [1, 2, 3, 4] │ +└──────────────┘ +``` + +### arrayCumSumNonNegative(arr) {#arraycumsumnonnegativearr} + +Aynı olarak `arrayCumSum`, kaynak dizideki öğelerin kısmi toplamlarının bir dizisini döndürür (çalışan bir toplam). Farklı `arrayCumSum`, daha sonra döndürülen değer sıfırdan küçük bir değer içerdiğinde, değer sıfır ile değiştirilir ve sonraki hesaplama sıfır parametrelerle gerçekleştirilir. Mesela: + +``` sql +SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res +``` + +``` text +┌─res───────┐ +│ [1,2,0,1] │ +└───────────┘ +``` + +### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} + +Öğeleri sıralama sonucu bir dizi döndürür `arr1` artan düzende. Eğer… `func` fonksiyon belirtilir, sıralama sırası fonksiyonun sonucu ile belirlenir `func` dizi elemanlarına uygulanır (diziler) + +Bu [Schwartzian dönüşümü](https://en.wikipedia.org/wiki/Schwartzian_transform) sıralama verimliliğini artırmak için kullanılır. + +Örnek: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); +``` + +``` text +┌─res────────────────┐ +│ ['world', 'hello'] │ +└────────────────────┘ +``` + +Hakkında daha fazla bilgi için `arraySort` yöntem, görmek [Dizilerle çalışmak için işlevler](array-functions.md#array_functions-sort) bölme. + +### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} + +Öğeleri sıralama sonucu bir dizi döndürür `arr1` azalan sırada. Eğer… `func` fonksiyon belirtilir, sıralama sırası fonksiyonun sonucu ile belirlenir `func` dizi (diziler) elemanlarına uygulanır. + +Örnek: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` text +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +Hakkında daha fazla bilgi için `arrayReverseSort` yöntem, görmek [Dizilerle çalışmak için işlevler](array-functions.md#array_functions-reverse-sort) bölme. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/tr/sql-reference/functions/in-functions.md b/docs/tr/sql-reference/functions/in-functions.md new file mode 100644 index 00000000000..46adc6c3d3b --- /dev/null +++ b/docs/tr/sql-reference/functions/in-functions.md @@ -0,0 +1,26 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 60 +toc_title: "In \u0130\u015Flet theic implementingisinin uygulanmas\u0131" +--- + +# In operatörünü Uygulamak için işlevler {#functions-for-implementing-the-in-operator} + +## içinde, notİn, globalİn, globalNotİn {#in-functions} + +Bölümüne bakınız [Operatör İNLERDE](../statements/select.md#select-in-operators). + +## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} + +Birden çok sütun gruplama sağlayan bir işlev. +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 normalde bir argüman için Ara değerler olarak kullanılır operatörler, veya lambda fonksiyonlarının resmi parametrelerin bir listesini oluşturmak için. Tuples bir masaya yazılamaz. + +## tupleElement (tuple, n), operatör x. N {#tupleelementtuple-n-operator-x-n} + +Bir tuple bir sütun alma sağlayan bir işlev. +‘N’ 1’den başlayarak sütun dizinidir. N sabit olmalıdır. ‘N’ bir sabit olması gerekir. ‘N’ tuple boyutundan daha büyük olmayan katı bir pozitif tamsayı olmalıdır. +İşlevi yürütmek için hiçbir maliyet yoktur. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/tr/sql-reference/functions/index.md b/docs/tr/sql-reference/functions/index.md new file mode 100644 index 00000000000..0c9c81baef2 --- /dev/null +++ b/docs/tr/sql-reference/functions/index.md @@ -0,0 +1,74 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "\u0130\u015Flevler" +toc_priority: 32 +toc_title: "Giri\u015F" +--- + +# İşlevler {#functions} + +En az\* iki tür fonksiyon vardır-düzenli Fonksiyonlar (sadece denir “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn’t depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). + +Bu bölümde düzenli işlevleri tartışıyoruz. Toplama işlevleri için bölüme bakın “Aggregate functions”. + +\* - Üçüncü bir işlev türü vardır ‘arrayJoin’ fonksiyon aittir; tablo fonksiyonları da ayrı ayrı belirtilebilir.\* + +## Güçlü Yazarak {#strong-typing} + +Standart SQL aksine, ClickHouse güçlü yazarak vardır. Başka bir deyişle, türler arasında örtük dönüşümler yapmaz. Her işlev belirli bir tür kümesi için çalışır. Bu, bazen tür dönüştürme işlevlerini kullanmanız gerektiği anlamına gelir. + +## Ortak Subexpression Eliminasyonu {#common-subexpression-elimination} + +Aynı AST (aynı kayıt veya sözdizimsel ayrıştırma aynı sonucu) olan bir sorgudaki tüm ifadeler aynı değerlere sahip olarak kabul edilir. Bu tür ifadeler bir kez birleştirilir ve yürütülür. Aynı alt sorgular da bu şekilde elimine edilir. + +## Sonuç türleri {#types-of-results} + +Tüm işlevler sonuç olarak tek bir dönüş döndürür (birkaç değer değil, sıfır değer değil). Sonuç türü genellikle değerlerle değil, yalnızca bağımsız değişken türleriyle tanımlanır. Özel durumlar tupleElement işlevi (a.n işleci) ve tofixedstring işlevidir. + +## Devamlılar {#constants} + +Basitlik için, bazı işlevler yalnızca bazı argümanlar için sabitlerle çalışabilir. Örneğin, LİKE operatörünün doğru argümanı sabit olmalıdır. +Hemen hemen tüm işlevler sabit argümanlar için bir sabit döndürür. İstisna, rasgele sayılar üreten işlevlerdir. +Bu ‘now’ işlev, farklı zamanlarda çalıştırılan sorgular için farklı değerler döndürür, ancak sonuç sabit olarak kabul edilir, çünkü sabitlik yalnızca tek bir sorguda önemlidir. +Sabit bir ifade de sabit olarak kabul edilir (örneğin, LİKE operatörünün sağ yarısı birden fazla sabitten oluşturulabilir). + +Fonksiyonlar sabit ve sabit olmayan argümanlar için farklı şekillerde uygulanabilir (farklı kod yürütülür). Ancak, bir sabit ve yalnızca aynı değeri içeren gerçek bir sütun için sonuçlar birbiriyle eşleşmelidir. + +## NULL işleme {#null-processing} + +Fonksiyonlar aşağıdaki davranışlara sahiptir: + +- İşlevin argümanlarından en az biri ise `NULL`, fonksiyon sonucu da `NULL`. +- Her işlevin açıklamasında ayrı ayrı belirtilen özel davranış. ClickHouse kaynak kodunda, bu işlevler `UseDefaultImplementationForNulls=false`. + +## Süreklilik {#constancy} + +Functions can’t change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. + +## Hata işleme {#error-handling} + +Veriler geçersizse bazı işlevler bir istisna oluşturabilir. Bu durumda, sorgu iptal edilir ve bir hata metni istemciye döndürülür. Dağıtılmış işlem için sunuculardan birinde bir özel durum oluştuğunda, diğer sunucular da sorguyu iptal etmeye çalışır. + +## Argüman Ifadelerinin değerlendirilmesi {#evaluation-of-argument-expressions} + +Hemen hemen tüm programlama dillerinde, argümanlardan biri belirli operatörler için değerlendirilmeyebilir. Bu genellikle operatörler `&&`, `||`, ve `?:`. +Ancak Clickhouse’da, fonksiyonların (operatörler) argümanları her zaman değerlendirilir. Bunun nedeni, sütunların tüm bölümlerinin her satırı ayrı ayrı hesaplamak yerine bir kerede değerlendirilmesidir. + +## Dağıtılmış Sorgu işleme işlevleri gerçekleştirme {#performing-functions-for-distributed-query-processing} + +Dağıtılmış sorgu işleme için, sorgu işlemenin mümkün olduğu kadar çok aşaması uzak sunucularda gerçekleştirilir ve aşamaların geri kalanı (Ara sonuçları ve bundan sonra her şeyi birleştirme) istek sahibi sunucuda gerçekleştirilir. + +Bu, işlevlerin farklı sunucularda gerçekleştirilebileceği anlamına gelir. +Örneğin, sorguda `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` + +- eğer bir `distributed_table` en az iki parçaya sahiptir, fonksiyonlar ‘g’ ve ‘h’ uzak sunucularda gerçekleştirilir ve işlev ‘f’ ıstekçi sunucuda gerçekleştirilir. +- eğer bir `distributed_table` sadece bir parça var, tüm ‘f’, ‘g’, ve ‘h’ fonksiyonlar bu shard’ın sunucusunda gerçekleştirilir. + +Bir işlevin sonucu genellikle hangi sunucuda gerçekleştirildiğine bağlı değildir. Ancak, bazen bu önemlidir. +Örneğin, sözlüklerle çalışan işlevler, üzerinde çalışmakta oldukları sunucuda bulunan sözlüğü kullanır. +Başka bir örnek ise `hostName` yapmak için üzerinde çalıştığı sunucunun adını döndüren işlev `GROUP BY` sunucular tarafından bir `SELECT` sorgu. + +Eğer sorguda bir işlevi istemcisi sunucu üzerinde yapılır, ama uzak sunucularda bunu gerçekleştirmek için ihtiyacınız varsa, bir saramaz mısın ‘any’ toplama işlevi veya bir anahtara ekleyin `GROUP BY`. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/tr/sql-reference/functions/introspection.md b/docs/tr/sql-reference/functions/introspection.md new file mode 100644 index 00000000000..9d5ac44761a --- /dev/null +++ b/docs/tr/sql-reference/functions/introspection.md @@ -0,0 +1,310 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 65 +toc_title: "\u0130\xE7g\xF6zlem" +--- + +# İç Gözlem Fonksiyonları {#introspection-functions} + +İç gözlem için bu bölümde açıklanan işlevleri kullanabilirsiniz [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) ve [DWARF](https://en.wikipedia.org/wiki/DWARF) sorgu profilleme için. + +!!! warning "Uyarıcı" + Bu işlevler yavaştır ve güvenlik konuları getirebilir. + +İç gözlem fonksiyonlarının düzgün çalışması için: + +- Yüklemek `clickhouse-common-static-dbg` paket. + +- Ayarla… [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) ayar 1. + + For security reasons introspection functions are disabled by default. + +ClickHouse için profiler raporları kaydeder [trace\_log](../../operations/system-tables.md#system_tables-trace_log) sistem tablosu. Tablo ve profiler düzgün yapılandırıldığından emin olun. + +## addressToLine {#addresstoline} + +ClickHouse sunucu işleminin içindeki sanal bellek adresini dosya adına ve clickhouse kaynak kodundaki satır numarasına dönüştürür. + +Resmi ClickHouse paketleri kullanırsanız, yüklemeniz gerekir `clickhouse-common-static-dbg` paket. + +**Sözdizimi** + +``` sql +addressToLine(address_of_binary_instruction) +``` + +**Parametre** + +- `address_of_binary_instruction` ([Uİnt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**Döndürülen değer** + +- Kaynak kodu dosya adı ve bu dosyadaki satır numarası iki nokta üst üste ile sınırlandırılmıştır. + + For example, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, where `199` is a line number. + +- Işlev hata ayıklama bilgilerini bulamadıysanız, bir ikili adı. + +- Adres geçerli değilse, boş dize. + +Tür: [Dize](../../sql-reference/data-types/string.md). + +**Örnek** + +İç gözlem işlevlerini etkinleştirme: + +``` sql +SET allow_introspection_functions=1 +``` + +İlk dizeyi seçme `trace_log` sistem tablosu: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-19 +event_time: 2019-11-19 18:57:23 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 421b6855-1858-45a5-8f37-f383409d6d72 +trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] +``` + +Bu `trace` alan, örnekleme anında yığın izini içerir. + +Tek bir adres için kaynak kodu dosya adını ve satır numarasını alma: + +``` sql +SELECT addressToLine(94784076370703) \G +``` + +``` text +Row 1: +────── +addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +``` + +İşlevin tüm yığın izine uygulanması: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines +FROM system.trace_log +LIMIT 1 +\G +``` + +Bu [arrayMap](higher-order-functions.md#higher_order_functions-array-map) işlev, her bir elemanın işlenmesini sağlar `trace` ar arrayray by the `addressToLine` işlev. Gördüğünüz bu işlemin sonucu `trace_source_code_lines` çıktı sütunu. + +``` text +Row 1: +────── +trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so +/usr/lib/debug/usr/bin/clickhouse +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 +/usr/include/c++/9/bits/atomic_base.h:551 +/usr/lib/debug/usr/bin/clickhouse +/lib/x86_64-linux-gnu/libpthread-2.27.so +/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 +``` + +## addressToSymbol {#addresstosymbol} + +Clickhouse sunucu işlemi içindeki sanal bellek adresini ClickHouse nesne dosyalarından gelen simgeye dönüştürür. + +**Sözdizimi** + +``` sql +addressToSymbol(address_of_binary_instruction) +``` + +**Parametre** + +- `address_of_binary_instruction` ([Uİnt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**Döndürülen değer** + +- ClickHouse nesne dosyalarından sembol. +- Adres geçerli değilse, boş dize. + +Tür: [Dize](../../sql-reference/data-types/string.md). + +**Örnek** + +İç gözlem işlevlerini etkinleştirme: + +``` sql +SET allow_introspection_functions=1 +``` + +İlk dizeyi seçme `trace_log` sistem tablosu: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +Bu `trace` alan, örnekleme anında yığın izini içerir. + +Tek bir adres için sembol alma: + +``` sql +SELECT addressToSymbol(94138803686098) \G +``` + +``` text +Row 1: +────── +addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +``` + +İşlevin tüm yığın izine uygulanması: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols +FROM system.trace_log +LIMIT 1 +\G +``` + +Bu [arrayMap](higher-order-functions.md#higher_order_functions-array-map) işlev, her bir elemanın işlenmesini sağlar `trace` ar arrayray by the `addressToSymbols` işlev. Gördüğünüz bu işlemin sonucu `trace_symbols` çıktı sütunu. + +``` text +Row 1: +────── +trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE +_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb +_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb +_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE +_ZN2DB27AggregatingBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB28AsynchronousBlockInputStream9calculateEv +_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data +_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E +_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv +_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E +execute_native_thread_routine +start_thread +clone +``` + +## demangle {#demangle} + +Kullanarak alabileceğiniz bir sembolü dönüştürür [addressToSymbol](#addresstosymbol) C++ işlev adına işlev. + +**Sözdizimi** + +``` sql +demangle(symbol) +``` + +**Parametre** + +- `symbol` ([Dize](../../sql-reference/data-types/string.md)) — Symbol from an object file. + +**Döndürülen değer** + +- C++ işlevinin adı. +- Bir sembol geçerli değilse boş dize. + +Tür: [Dize](../../sql-reference/data-types/string.md). + +**Örnek** + +İç gözlem işlevlerini etkinleştirme: + +``` sql +SET allow_introspection_functions=1 +``` + +İlk dizeyi seçme `trace_log` sistem tablosu: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +Bu `trace` alan, örnekleme anında yığın izini içerir. + +Tek bir adres için bir işlev adı alma: + +``` sql +SELECT demangle(addressToSymbol(94138803686098)) \G +``` + +``` text +Row 1: +────── +demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +``` + +İşlevin tüm yığın izine uygulanması: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions +FROM system.trace_log +LIMIT 1 +\G +``` + +Bu [arrayMap](higher-order-functions.md#higher_order_functions-array-map) işlev, her bir elemanın işlenmesini sağlar `trace` ar arrayray by the `demangle` işlev. Gördüğünüz bu işlemin sonucu `trace_functions` çıktı sütunu. + +``` text +Row 1: +────── +trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const +DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) +DB::AggregatingBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::AsynchronousBlockInputStream::calculate() +std::_Function_handler::_M_invoke(std::_Any_data const&) +ThreadPoolImpl::worker(std::_List_iterator) +ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const +ThreadPoolImpl::worker(std::_List_iterator) +execute_native_thread_routine +start_thread +clone +``` diff --git a/docs/tr/sql-reference/functions/ip-address-functions.md b/docs/tr/sql-reference/functions/ip-address-functions.md new file mode 100644 index 00000000000..c8ce76dd65d --- /dev/null +++ b/docs/tr/sql-reference/functions/ip-address-functions.md @@ -0,0 +1,248 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 55 +toc_title: "IP adresleriyle \xE7al\u0131\u015Fma" +--- + +# IP Adresleriyle çalışmak için işlevler {#functions-for-working-with-ip-addresses} + +## Ipv4numtostring (num) {#ipv4numtostringnum} + +Bir Uınt32 numarası alır. Big endian’da bir IPv4 adresi olarak yorumlar. Karşılık gelen IPv4 adresini a. B. C. d biçiminde içeren bir dize döndürür (ondalık formda nokta ile ayrılmış sayılar). + +## Ipv4stringtonum (s) {#ipv4stringtonums} + +IPv4NumToString ters işlevi. IPv4 adresi geçersiz bir biçime sahipse, 0 döndürür. + +## Ipv4numtostringclassc (num) {#ipv4numtostringclasscnum} + +Ipv4numtostring’e benzer, ancak son sekizli yerine xxx kullanıyor. + +Örnek: + +``` sql +SELECT + IPv4NumToStringClassC(ClientIP) AS k, + count() AS c +FROM test.hits +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─k──────────────┬─────c─┐ +│ 83.149.9.xxx │ 26238 │ +│ 217.118.81.xxx │ 26074 │ +│ 213.87.129.xxx │ 25481 │ +│ 83.149.8.xxx │ 24984 │ +│ 217.118.83.xxx │ 22797 │ +│ 78.25.120.xxx │ 22354 │ +│ 213.87.131.xxx │ 21285 │ +│ 78.25.121.xxx │ 20887 │ +│ 188.162.65.xxx │ 19694 │ +│ 83.149.48.xxx │ 17406 │ +└────────────────┴───────┘ +``` + +Kullanıl sincedığından beri ‘xxx’ son derece sıradışı, bu gelecekte değiştirilebilir. Bu parçanın tam biçimine güvenmemenizi öneririz. + +### Ipv6numtostring (x) {#ipv6numtostringx} + +IPv6 adresini ikili biçimde içeren bir FixedString(16) değerini kabul eder. Bu adresi metin biçiminde içeren bir dize döndürür. +IPv6 eşlemeli IPv4 adresleri ::ffff:111.222.33.44 biçiminde çıktıdır. Örnekler: + +``` sql +SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr +``` + +``` text +┌─addr─────────┐ +│ 2a02:6b8::11 │ +└──────────────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ +│ 2a02:2168:aaa:bbbb::2 │ 24695 │ +│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ +│ 2a02:6b8:0:fff::ff │ 16389 │ +│ 2a01:4f8:111:6666::2 │ 16016 │ +│ 2a02:2168:888:222::1 │ 15896 │ +│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ +│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ +│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ +│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ +│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ +└─────────────────────────────────────────┴───────┘ +``` + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + +``` text +┌─IPv6NumToString(ClientIP6)─┬──────c─┐ +│ ::ffff:94.26.111.111 │ 747440 │ +│ ::ffff:37.143.222.4 │ 529483 │ +│ ::ffff:5.166.111.99 │ 317707 │ +│ ::ffff:46.38.11.77 │ 263086 │ +│ ::ffff:79.105.111.111 │ 186611 │ +│ ::ffff:93.92.111.88 │ 176773 │ +│ ::ffff:84.53.111.33 │ 158709 │ +│ ::ffff:217.118.11.22 │ 154004 │ +│ ::ffff:217.118.11.33 │ 148449 │ +│ ::ffff:217.118.11.44 │ 148243 │ +└────────────────────────────┴────────┘ +``` + +## Ipv6stringtonum (s) {#ipv6stringtonums} + +IPv6NumToString ters işlevi. IPv6 adresi geçersiz bir biçime sahipse, bir boş bayt dizesi döndürür. +HEX büyük veya küçük harf olabilir. + +## Ipv4toıpv6 (x) {#ipv4toipv6x} + +Alır bir `UInt32` numara. Bir IPv4 adresi olarak yorumlar [büyük endian](https://en.wikipedia.org/wiki/Endianness). Ret aur ANS a `FixedString(16)` IPv6 adresini ikili biçimde içeren değer. Örnekler: + +``` sql +SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr +``` + +``` text +┌─addr───────────────┐ +│ ::ffff:192.168.0.1 │ +└────────────────────┘ +``` + +## cutİPv6 (x, bytesToCutForİPv6, bytesToCutForİPv4) {#cutipv6x-bytestocutforipv6-bytestocutforipv4} + +IPv6 adresini ikili biçimde içeren bir FixedString(16) değerini kabul eder. Metin biçiminde kaldırılan belirtilen bayt sayısının adresini içeren bir dize döndürür. Mesela: + +``` sql +WITH + IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, + IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 +SELECT + cutIPv6(ipv6, 2, 0), + cutIPv6(ipv4, 0, 2) +``` + +``` text +┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ +│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ +└─────────────────────────────────────┴─────────────────────┘ +``` + +## Ipv4cidrtorange(ıpv4, cıdr), {#ipv4cidrtorangeipv4-cidr} + +İçeren bir IPv4 ve bir Uint8 değerini kabul eder [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Alt ağın alt aralığını ve daha yüksek aralığını içeren iki IPv4 içeren bir tuple döndürür. + +``` sql +SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) +``` + +``` text +┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ +│ ('192.168.0.0','192.168.255.255') │ +└────────────────────────────────────────────┘ +``` + +## Ipv6cidrtorange(ıpv6, cıdr), {#ipv6cidrtorangeipv6-cidr} + +CIDR’Yİ içeren bir IPv6 ve bir Uİnt8 değerini kabul eder. Alt ağın alt aralığını ve daha yüksek aralığını içeren iki IPv6 içeren bir tuple döndürür. + +``` sql +SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); +``` + +``` text +┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ +│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ +└────────────────────────────────────────────────────────────────────────┘ +``` + +## toıpv4 (dize) {#toipv4string} + +İçin bir takma ad `IPv4StringToNum()` bu, IPv4 adresinin bir dize formunu alır ve değerini döndürür [Ipv44](../../sql-reference/data-types/domains/ipv4.md) tarafından döndürülen değere eşit ikili olan tür `IPv4StringToNum()`. + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + toTypeName(IPv4StringToNum(IPv4_string)), + toTypeName(toIPv4(IPv4_string)) +``` + +``` text +┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ +│ UInt32 │ IPv4 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + hex(IPv4StringToNum(IPv4_string)), + hex(toIPv4(IPv4_string)) +``` + +``` text +┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ +│ ABE1822D │ ABE1822D │ +└───────────────────────────────────┴──────────────────────────┘ +``` + +## toıpv6 (dize) {#toipv6string} + +İçin bir takma ad `IPv6StringToNum()` bu, IPv6 adresinin bir dize formunu alır ve değerini döndürür [IPv6](../../sql-reference/data-types/domains/ipv6.md) tarafından döndürülen değere eşit ikili olan tür `IPv6StringToNum()`. + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + toTypeName(IPv6StringToNum(IPv6_string)), + toTypeName(toIPv6(IPv6_string)) +``` + +``` text +┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ +│ FixedString(16) │ IPv6 │ +└──────────────────────────────────────────┴─────────────────────────────────┘ +``` + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + hex(IPv6StringToNum(IPv6_string)), + hex(toIPv6(IPv6_string)) +``` + +``` text +┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ +│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ +└───────────────────────────────────┴──────────────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/tr/sql-reference/functions/json-functions.md b/docs/tr/sql-reference/functions/json-functions.md new file mode 100644 index 00000000000..ca2af33e449 --- /dev/null +++ b/docs/tr/sql-reference/functions/json-functions.md @@ -0,0 +1,231 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 56 +toc_title: "JSON ile \xE7al\u0131\u015Fmak." +--- + +# Json Ile çalışmak için Fonksiyonlar {#functions-for-working-with-json} + +Üye Olarak.Metrica, JSON kullanıcılar tarafından oturum parametreleri olarak iletilir. Bu JSON ile çalışmak için bazı özel fonksiyonlar var. (Çoğu durumda, JSONs ek olarak önceden işlenir ve elde edilen değerler işlenmiş biçimlerinde ayrı sütunlara konur .) Tüm bu işlevler, JSON’UN ne olabileceğine dair güçlü varsayımlara dayanır, ancak işi yapmak için mümkün olduğunca az şey yapmaya çalışırlar. + +Aşağıdaki varsayımlar yapılır: + +1. Alan adı (işlev bağımsız değişkeni) sabit olmalıdır. +2. Alan adı bir şekilde json’da kanonik olarak kodlanmıştır. Mesela: `visitParamHas('{"abc":"def"}', 'abc') = 1`, ama `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` +3. Alanlar, herhangi bir yuvalama düzeyinde, ayrım gözetmeksizin aranır. Birden çok eşleşen alan varsa, ilk olay kullanılır. +4. JSON, dize değişmezleri dışında boşluk karakterlerine sahip değildir. + +## visitParamHas (params, isim) {#visitparamhasparams-name} + +İle bir alan olup olmadığını denetler ‘name’ ad. + +## visitParamExtractUİnt (params, isim) {#visitparamextractuintparams-name} + +Uint64 adlı alanın değerinden ayrıştırır ‘name’. Bu bir dize alanı ise, dizenin başlangıcından itibaren bir sayıyı ayrıştırmaya çalışır. Alan yoksa veya varsa ancak bir sayı içermiyorsa, 0 döndürür. + +## visitParamExtractİnt (params, isim) {#visitparamextractintparams-name} + +Int64 için olduğu gibi. + +## visitParamExtractFloat (params, isim) {#visitparamextractfloatparams-name} + +Float64 için olduğu gibi. + +## visitParamExtractBool (params, isim) {#visitparamextractboolparams-name} + +True/false değerini ayrıştırır. Sonuç Uİnt8. + +## visitParamExtractRaw (params, isim) {#visitparamextractrawparams-name} + +Ayırıcılar da dahil olmak üzere bir alanın değerini döndürür. + +Örnekler: + +``` sql +visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' +visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' +``` + +## visitParamExtractString (params, isim) {#visitparamextractstringparams-name} + +Dizeyi çift tırnak içinde ayrıştırır. Değeri unescaped. Unescaping başarısız olursa, boş bir dize döndürür. + +Örnekler: + +``` sql +visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' +visitParamExtractString('{"abc":"hello}', 'abc') = '' +``` + +Şu anda biçimdeki kod noktaları için destek yok `\uXXXX\uYYYY` bu temel çok dilli düzlemden değildir(UTF-8 yerine CESU-8’e dönüştürülürler). + +Aşağıdaki işlevler dayanmaktadır [simdjson](https://github.com/lemire/simdjson) daha karmaşık json ayrıştırma gereksinimleri için tasarlanmıştır. Yukarıda belirtilen varsayım 2 hala geçerlidir. + +## ısvalidjson(json) {#isvalidjsonjson} + +Dize geçirilen kontroller geçerli bir json’dur. + +Örnekler: + +``` sql +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} + +Değer JSON belgesinde varsa, `1` iade edilecektir. + +Değer yoksa, `0` iade edilecektir. + +Örnekler: + +``` sql +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 +SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 +``` + +`indices_or_keys` sıfır veya daha fazla argüman listesi her biri dize veya tamsayı olabilir. + +- String = nesne üyesine anahtarla erişin. +- Pozitif tamsayı = n-inci üyesine / anahtarına baştan erişin. +- Negatif tamsayı = sondan n-inci üye/anahtara erişin. + +Elemanın minimum Endeksi 1’dir. Böylece 0 öğesi mevcut değildir. + +Hem json dizilerine hem de JSON nesnelerine erişmek için tamsayılar kullanabilirsiniz. + +Bu yüzden, örneğin : + +``` sql +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' +SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' +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} + +Bir json dizisinin veya bir JSON nesnesinin uzunluğunu döndürür. + +Değer yoksa veya yanlış bir türe sahipse, `0` iade edilecektir. + +Örnekler: + +``` sql +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} + +Bir JSON değerinin türünü döndürür. + +Değer yoksa, `Null` iade edilecektir. + +Örnekler: + +``` sql +SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' +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} + +## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} + +## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} + +## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} + +Bir JSON ayrıştırır ve bir değer ayıklayın. Bu işlevler benzer `visitParam` işlevler. + +Değer yoksa veya yanlış bir türe sahipse, `0` iade edilecektir. + +Örnekler: + +``` sql +SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 +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} + +Bir json ayrıştırır ve bir dize ayıklayın. Bu işlev benzer `visitParamExtractString` işlevler. + +Değer yoksa veya yanlış bir tür varsa, boş bir dize döndürülür. + +Değeri unescaped. Unescaping başarısız olursa, boş bir dize döndürür. + +Örnekler: + +``` sql +SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' +SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' +SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' +SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' +SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' +``` + +## JSONExtract(json\[, indices\_or\_keys…\], Return\_type) {#jsonextractjson-indices-or-keys-return-type} + +Bir Json ayrıştırır ve verilen ClickHouse veri türünün bir değerini çıkarır. + +Bu, önceki bir genellemedir `JSONExtract` işlevler. +Bu demektir +`JSONExtract(..., 'String')` tam olarak aynı döndürür `JSONExtractString()`, +`JSONExtract(..., 'Float64')` tam olarak aynı döndürür `JSONExtractFloat()`. + +Örnekler: + +``` sql +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL +SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 +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} + +Değerlerin verilen ClickHouse veri türünde olduğu bir json’dan anahtar değer çiftlerini ayrıştırın. + +Örnek: + +``` sql +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} + +Json’un bir bölümünü döndürür. + +Bölüm yoksa veya yanlış bir türe sahipse, boş bir dize döndürülür. + +Örnek: + +``` sql +SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' +``` + +## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} + +Her biri ayrıştırılmamış dize olarak temsil edilen json dizisinin öğeleriyle bir dizi döndürür. + +Bölüm yoksa veya dizi değilse, boş bir dizi döndürülür. + +Örnek: + +``` sql +SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/tr/sql-reference/functions/logical-functions.md b/docs/tr/sql-reference/functions/logical-functions.md new file mode 100644 index 00000000000..2747607c3a6 --- /dev/null +++ b/docs/tr/sql-reference/functions/logical-functions.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 37 +toc_title: "Mant\u0131kl\u0131" +--- + +# Mantıksal Fonksiyonlar {#logical-functions} + +Mantıksal işlevler herhangi bir sayısal türü kabul eder, ancak 0 veya 1’e eşit bir Uİnt8 numarası döndürür. + +Bir argüman olarak sıfır kabul edilir “false,” sıfır olmayan herhangi bir değer dikkate alınırken “true”. + +## ve, ve operatör {#and-and-operator} + +## or, or operat ,or {#or-or-operator} + +## değil, operatör değil {#not-not-operator} + +## xor {#xor} + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) diff --git a/docs/tr/sql-reference/functions/machine-learning-functions.md b/docs/tr/sql-reference/functions/machine-learning-functions.md new file mode 100644 index 00000000000..18549f73200 --- /dev/null +++ b/docs/tr/sql-reference/functions/machine-learning-functions.md @@ -0,0 +1,20 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 64 +toc_title: "Makine \xD6\u011Frenme Fonksiyonlar\u0131" +--- + +# Makine Öğrenme Fonksiyonları {#machine-learning-functions} + +## evalMLMethod (tahmin) {#machine_learning_methods-evalmlmethod} + +Tak fittedılmış regresyon model usinglerini kullanarak tahmin `evalMLMethod` işlev. Lin seeke bakınız `linearRegression`. + +### Stokastik Doğrusal Regresyon {#stochastic-linear-regression} + +Bu [stokastiklinearregression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlinearregression) toplama fonksiyonu, doğrusal model ve MSE kayıp fonksiyonunu kullanarak stokastik Gradyan iniş yöntemini uygular. Kullanma `evalMLMethod` yeni veri üzerinde tahmin etmek için. + +### Stokastik Lojistik Regresyon {#stochastic-logistic-regression} + +Bu [stochasticLogisticRegression](../../sql-reference/aggregate-functions/reference.md#agg_functions-stochasticlogisticregression) toplama işlevi, ikili sınıflandırma problemi için stokastik Gradyan iniş yöntemini uygular. Kullanma `evalMLMethod` yeni veri üzerinde tahmin etmek için. diff --git a/docs/tr/sql-reference/functions/math-functions.md b/docs/tr/sql-reference/functions/math-functions.md new file mode 100644 index 00000000000..cf144ca1755 --- /dev/null +++ b/docs/tr/sql-reference/functions/math-functions.md @@ -0,0 +1,116 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 44 +toc_title: Matematiksel +--- + +# Matematiksel Fonksiyonlar {#mathematical-functions} + +Tüm işlevler bir Float64 numarası döndürür. Sonucun doğruluğu mümkün olan en yüksek hassasiyete yakındır, ancak sonuç, ilgili gerçek sayıya en yakın makine temsil edilebilir numarası ile çakışmayabilir. + +## e() {#e} + +E numarasına yakın bir Float64 numarası döndürür. + +## pi sayısı() {#pi} + +Returns a Float64 number that is close to the number π. + +## exp(x) {#expx} + +Sayısal bir bağımsız değişken kabul eder ve bir Float64 sayı argümanın üs yakın döndürür. + +## log (x), L (n(x) {#logx-lnx} + +Sayısal bir bağımsız değişken kabul eder ve bağımsız değişken doğal logaritma yakın bir Float64 sayı döndürür. + +## exp2 (x) {#exp2x} + +Sayısal bir bağımsız değişkeni kabul eder ve X gücüne 2’ye yakın bir Float64 numarası döndürür. + +## log2 (x) {#log2x} + +Sayısal bir bağımsız değişken kabul eder ve değişken ikili logaritma yakın bir Float64 sayı döndürür. + +## exp10 (x) {#exp10x} + +Sayısal bir bağımsız değişkeni kabul eder ve 10’a yakın Float64 numarasını x gücüne döndürür. + +## log10(x) {#log10x} + +Sayısal bir bağımsız değişken kabul eder ve bir float64 sayı bağımsız değişken ondalık logaritması yakın döndürür. + +## sqrt(x) {#sqrtx} + +Sayısal bir bağımsız değişken kabul eder ve bağımsız değişken kareköküne yakın bir Float64 numarası döndürür. + +## TCMB (x) {#cbrtx} + +Sayısal bir bağımsız değişkeni kabul eder ve bağımsız değişken kübik köküne yakın bir Float64 numarası döndürür. + +## erf (x) {#erfx} + +Eğer ‘x’ is non-negative, then erf(x / σ√2) standart sapma ile normal dağılıma sahip bir rasgele değişkenin olasılığı var mı ‘σ’ beklenen değerden daha fazla ayrılan değeri alır ‘x’. + +Örnek (üç sigma kuralı): + +``` sql +SELECT erf(3 / sqrt(2)) +``` + +``` text +┌─erf(divide(3, sqrt(2)))─┐ +│ 0.9973002039367398 │ +└─────────────────────────┘ +``` + +## erfc (x) {#erfcx} + +Sayısal bir bağımsız değişkeni kabul eder ve 1 - erf(x) yakın bir Float64 numarası döndürür, ancak büyük için hassasiyet kaybı olmadan ‘x’ değerler. + +## lgamma (x) {#lgammax} + +Gama fonksiyonunun logaritması. + +## tgamma (x) {#tgammax} + +Gama fonksiyonu. + +## günah(x) {#sinx} + +Sinüs. + +## C (os (x) {#cosx} + +Kosinüs. + +## tan (x) {#tanx} + +Teğet. + +## asin (x) {#asinx} + +Ark sinüsü. + +## acos (x) {#acosx} + +Ark kosinüsü. + +## atan (x) {#atanx} + +Ark teğet. + +## pow (x, y), güç (x, y)) {#powx-y-powerx-y} + +İki sayısal bağımsız değişken X ve y alır.X’e yakın bir Float64 numarasını y gücüne döndürür. + +## ıntexp2 {#intexp2} + +Sayısal bir bağımsız değişkeni kabul eder ve X’in gücüne 2’ye yakın bir uint64 numarası döndürür. + +## ıntexp10 {#intexp10} + +Sayısal bir bağımsız değişkeni kabul eder ve X gücüne 10’a yakın bir uint64 numarası döndürür. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/tr/sql-reference/functions/other-functions.md b/docs/tr/sql-reference/functions/other-functions.md new file mode 100644 index 00000000000..c71e6d09297 --- /dev/null +++ b/docs/tr/sql-reference/functions/other-functions.md @@ -0,0 +1,1079 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 66 +toc_title: "Di\u011Fer" +--- + +# Diğer Fonksiyonlar {#other-functions} + +## hostnamename() {#hostname} + +Bu işlevin gerçekleştirildiği ana bilgisayarın adını içeren bir dize döndürür. Dağıtılmış işlem için, bu işlev uzak bir sunucuda gerçekleştirilirse, uzak sunucu ana bilgisayarının adıdır. + +## FQDN {#fqdn} + +Tam etki alanı adını döndürür. + +**Sözdizimi** + +``` sql +fqdn(); +``` + +Bu işlev büyük / küçük harf duyarsızdır. + +**Döndürülen değer** + +- Tam etki alanı adı ile dize. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT FQDN(); +``` + +Sonuç: + +``` text +┌─FQDN()──────────────────────────┐ +│ clickhouse.ru-central1.internal │ +└─────────────────────────────────┘ +``` + +## basename {#basename} + +Son eğik çizgi veya ters eğik çizgiden sonra bir dizenin sondaki kısmını ayıklar. Bu işlev, genellikle bir yoldan dosya adını ayıklamak için kullanılır. + +``` sql +basename( expr ) +``` + +**Parametre** + +- `expr` — Expression resulting in a [Dize](../../sql-reference/data-types/string.md) type value. Tüm ters eğik çizgilerin ortaya çıkan değerden kaçması gerekir. + +**Döndürülen Değer** + +İçeren bir dize: + +- Son eğik çizgi veya ters eğik çizgiden sonra bir dizenin sondaki kısmı. + + If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. + +- Eğik çizgi veya ters eğik çizgi yoksa orijinal dize. + +**Örnek** + +``` sql +SELECT 'some/long/path/to/file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some\\long\\path\\to\\file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some-file-name' AS a, basename(a) +``` + +``` text +┌─a──────────────┬─basename('some-file-name')─┐ +│ some-file-name │ some-file-name │ +└────────────────┴────────────────────────────┘ +``` + +## visibleWidth(x) {#visiblewidthx} + +Değerleri konsola metin biçiminde (sekmeyle ayrılmış) çıkarırken yaklaşık genişliği hesaplar. +Bu işlev, sistem tarafından güzel formatların uygulanması için kullanılır. + +`NULL` karşılık gelen bir dize olarak temsil edilir `NULL` içinde `Pretty` biçimliler. + +``` sql +SELECT visibleWidth(NULL) +``` + +``` text +┌─visibleWidth(NULL)─┐ +│ 4 │ +└────────────────────┘ +``` + +## toTypeName (x) {#totypenamex} + +Geçirilen bağımsız değişken türü adını içeren bir dize döndürür. + +Eğer `NULL` fonksiyona girdi olarak geçirilir, daha sonra `Nullable(Nothing)` bir iç karşılık gelen türü `NULL` Clickhouse’da temsil. + +## blockSize() {#function-blocksize} + +Bloğun boyutunu alır. +Clickhouse’da, sorgular her zaman bloklarda (sütun parçaları kümeleri) çalıştırılır. Bu işlev, aradığınız bloğun boyutunu almanızı sağlar. + +## materialize (x) {#materializex} + +Bir sabiti yalnızca bir değer içeren tam bir sütuna dönüştürür. +Clickhouse’da, tam sütunlar ve sabitler bellekte farklı şekilde temsil edilir. İşlevler, sabit argümanlar ve normal argümanlar için farklı şekilde çalışır (farklı kod yürütülür), ancak sonuç hemen hemen her zaman aynıdır. Bu işlev, bu davranış hata ayıklama içindir. + +## ignore(…) {#ignore} + +Dahil olmak üzere herhangi bir argümanı kabul eder `NULL`. Her zaman 0 döndürür. +Ancak, argüman hala değerlendirilir. Bu kriterler için kullanılabilir. + +## uyku (saniye) {#sleepseconds} + +Uykular ‘seconds’ her veri bloğunda saniye. Bir tamsayı veya kayan noktalı sayı belirtebilirsiniz. + +## sleepEachRow (saniye) {#sleepeachrowseconds} + +Uykular ‘seconds’ her satırda saniye. Bir tamsayı veya kayan noktalı sayı belirtebilirsiniz. + +## currentDatabase() {#currentdatabase} + +Geçerli veritabanının adını döndürür. +Bu işlevi, veritabanını belirtmeniz gereken bir tablo oluştur sorgusunda tablo altyapısı parametrelerinde kullanabilirsiniz. + +## currentUser() {#other-function-currentuser} + +Geçerli kullanıcının oturum açma döndürür. Kullanıcı girişi, bu başlatılan sorgu, durumda distibuted sorguda iade edilecektir. + +``` sql +SELECT currentUser(); +``` + +Takma ad: `user()`, `USER()`. + +**Döndürülen değerler** + +- Geçerli kullanıcının girişi. +- Disributed sorgu durumunda sorgu başlatılan kullanıcının giriş. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT currentUser(); +``` + +Sonuç: + +``` text +┌─currentUser()─┐ +│ default │ +└───────────────┘ +``` + +## isFinite (x) {#isfinitex} + +Float32 ve Float64 kabul eder ve bağımsız değişken sonsuz değilse ve bir NaN değilse, Uint8’i 1’e eşit olarak döndürür, aksi halde 0. + +## isİnfinite (x) {#isinfinitex} + +Float32 ve Float64 kabul eder ve bağımsız değişken sonsuz ise 1’e eşit Uİnt8 döndürür, aksi takdirde 0. Bir NaN için 0 döndürüldüğünü unutmayın. + +## ifNotFinite {#ifnotfinite} + +Kayan nokta değerinin sonlu olup olmadığını kontrol eder. + +**Sözdizimi** + + ifNotFinite(x,y) + +**Parametre** + +- `x` — Value to be checked for infinity. Type: [Yüzdürmek\*](../../sql-reference/data-types/float.md). +- `y` — Fallback value. Type: [Yüzdürmek\*](../../sql-reference/data-types/float.md). + +**Döndürülen değer** + +- `x` eğer `x` son isludur. +- `y` eğer `x` sonlu değildir. + +**Örnek** + +Sorgu: + + SELECT 1/0 as infimum, ifNotFinite(infimum,42) + +Sonuç: + + ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ + │ inf │ 42 │ + └─────────┴───────────────────────────────┘ + +Kullanarak benzer sonuç alabilirsiniz [üçlü operatör](conditional-functions.md#ternary-operator): `isFinite(x) ? x : y`. + +## ısnan (x) {#isnanx} + +Float32 ve Float64 kabul eder ve bağımsız değişken bir NaN, aksi takdirde 0 ise 1’e eşit uint8 döndürür. + +## hasColumnİnTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} + +Sabit dizeleri kabul eder: veritabanı adı, tablo adı ve sütun adı. Bir sütun varsa 1’e eşit bir uint8 sabit ifadesi döndürür, aksi halde 0. Hostname parametresi ayarlanmışsa, sınama uzak bir sunucuda çalışır. +Tablo yoksa, işlev bir özel durum atar. +İç içe veri yapısındaki öğeler için işlev, bir sütunun varlığını denetler. İç içe veri yapısının kendisi için işlev 0 döndürür. + +## bar {#function-bar} + +Unicode-art diyagramı oluşturmaya izin verir. + +`bar(x, min, max, width)` genişliği orantılı olan bir bant çizer `(x - min)` ve eşit `width` karakterler ne zaman `x = max`. + +Parametre: + +- `x` — Size to display. +- `min, max` — Integer constants. The value must fit in `Int64`. +- `width` — Constant, positive integer, can be fractional. + +Bant, bir sembolün sekizde birine doğrulukla çizilir. + +Örnek: + +``` sql +SELECT + toHour(EventTime) AS h, + count() AS c, + bar(c, 0, 600000, 20) AS bar +FROM test.hits +GROUP BY h +ORDER BY h ASC +``` + +``` text +┌──h─┬──────c─┬─bar────────────────┐ +│ 0 │ 292907 │ █████████▋ │ +│ 1 │ 180563 │ ██████ │ +│ 2 │ 114861 │ ███▋ │ +│ 3 │ 85069 │ ██▋ │ +│ 4 │ 68543 │ ██▎ │ +│ 5 │ 78116 │ ██▌ │ +│ 6 │ 113474 │ ███▋ │ +│ 7 │ 170678 │ █████▋ │ +│ 8 │ 278380 │ █████████▎ │ +│ 9 │ 391053 │ █████████████ │ +│ 10 │ 457681 │ ███████████████▎ │ +│ 11 │ 493667 │ ████████████████▍ │ +│ 12 │ 509641 │ ████████████████▊ │ +│ 13 │ 522947 │ █████████████████▍ │ +│ 14 │ 539954 │ █████████████████▊ │ +│ 15 │ 528460 │ █████████████████▌ │ +│ 16 │ 539201 │ █████████████████▊ │ +│ 17 │ 523539 │ █████████████████▍ │ +│ 18 │ 506467 │ ████████████████▊ │ +│ 19 │ 520915 │ █████████████████▎ │ +│ 20 │ 521665 │ █████████████████▍ │ +│ 21 │ 542078 │ ██████████████████ │ +│ 22 │ 493642 │ ████████████████▍ │ +│ 23 │ 400397 │ █████████████▎ │ +└────┴────────┴────────────────────┘ +``` + +## dönüştürmek {#transform} + +Bir değeri, bazı öğelerin açıkça tanımlanmış eşlemesine göre diğer öğelere dönüştürür. +Bu fonksiyonun iki varyasyonu vardır: + +### transform (x, array\_from, array\_to, varsayılan) {#transformx-array-from-array-to-default} + +`x` – What to transform. + +`array_from` – Constant array of values for converting. + +`array_to` – Constant array of values to convert the values in ‘from’ -e doğru. + +`default` – Which value to use if ‘x’ değer anylerden hiçbir equaline eşit değildir. ‘from’. + +`array_from` ve `array_to` – Arrays of the same size. + +Türler: + +`transform(T, Array(T), Array(U), U) -> U` + +`T` ve `U` sayısal, dize veya tarih veya DateTime türleri olabilir. +Aynı harfin belirtildiği (t veya U), sayısal türler için bunlar eşleşen türler değil, ortak bir türe sahip türler olabilir. +Örneğin, ilk bağımsız değişken Int64 türüne sahip olabilir, ikincisi ise Array(Uİnt16) türüne sahiptir. + +Eğer… ‘x’ değer, içindeki öğelerden birine eşittir. ‘array\_from’ array, varolan öğeyi döndürür (aynı numaralandırılır) ‘array\_to’ dizi. Aksi takdirde, döner ‘default’. İçinde birden fazla eşleşen öğe varsa ‘array\_from’, maçlardan birini döndürür. + +Örnek: + +``` sql +SELECT + transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, + count() AS c +FROM test.hits +WHERE SearchEngineID != 0 +GROUP BY title +ORDER BY c DESC +``` + +``` text +┌─title─────┬──────c─┐ +│ Yandex │ 498635 │ +│ Google │ 229872 │ +│ Other │ 104472 │ +└───────────┴────────┘ +``` + +### transform (x, array\_from, array\_to) {#transformx-array-from-array-to} + +İlk vary thatasyon differsdan farklıdır. ‘default’ argüman atlandı. +Eğer… ‘x’ değer, içindeki öğelerden birine eşittir. ‘array\_from’ array, eşleşen öğeyi (aynı numaralandırılmış) döndürür ‘array\_to’ dizi. Aksi takdirde, döner ‘x’. + +Türler: + +`transform(T, Array(T), Array(T)) -> T` + +Örnek: + +``` sql +SELECT + transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, + count() AS c +FROM test.hits +GROUP BY domain(Referer) +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +┌─s──────────────┬───────c─┐ +│ │ 2906259 │ +│ www.yandex │ 867767 │ +│ ███████.ru │ 313599 │ +│ mail.yandex.ru │ 107147 │ +│ ██████.ru │ 100355 │ +│ █████████.ru │ 65040 │ +│ news.yandex.ru │ 64515 │ +│ ██████.net │ 59141 │ +│ example.com │ 57316 │ +└────────────────┴─────────┘ +``` + +## formatReadableSize (x) {#formatreadablesizex} + +Boyutu (bayt sayısı) kabul eder. Bir sonek (KiB, MıB, vb.) ile yuvarlak bir boyut döndürür.) bir dize olarak. + +Örnek: + +``` sql +SELECT + arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, + formatReadableSize(filesize_bytes) AS filesize +``` + +``` text +┌─filesize_bytes─┬─filesize───┐ +│ 1 │ 1.00 B │ +│ 1024 │ 1.00 KiB │ +│ 1048576 │ 1.00 MiB │ +│ 192851925 │ 183.92 MiB │ +└────────────────┴────────────┘ +``` + +## en az (a, b) {#leasta-b} + +A ve B’den en küçük değeri döndürür. + +## en büyük (a, b) {#greatesta-b} + +A ve B’nin en büyük değerini döndürür. + +## çalışma süresi() {#uptime} + +Sunucunun çalışma süresini saniyeler içinde döndürür. + +## sürüm() {#version} + +Sunucu sürümünü bir dize olarak döndürür. + +## saat dilimi() {#timezone} + +Sunucunun saat dilimini döndürür. + +## blockNumber {#blocknumber} + +Satırın bulunduğu veri bloğunun sıra numarasını döndürür. + +## rowNumberİnBlock {#function-rownumberinblock} + +Veri bloğundaki satırın sıra numarasını döndürür. Farklı veri blokları her zaman yeniden hesaplanır. + +## rownumberınallblocks() {#rownumberinallblocks} + +Veri bloğundaki satırın sıra numarasını döndürür. Bu işlev yalnızca etkilenen veri bloklarını dikkate alır. + +## komşuluk {#neighbor} + +Belirli bir sütunun geçerli satırından önce veya sonra gelen belirli bir ofsette bir satıra erişim sağlayan pencere işlevi. + +**Sözdizimi** + +``` sql +neighbor(column, offset[, default_value]) +``` + +İşlevin sonucu, etkilenen veri bloklarına ve bloktaki veri sırasına bağlıdır. +ORDER BY ile bir alt sorgu yaparsanız ve alt sorgunun dışından işlevi çağırırsanız, beklenen sonucu alabilirsiniz. + +**Parametre** + +- `column` — A column name or scalar expression. +- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql-reference/data-types/int-uint.md). +- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. + +**Döndürülen değerler** + +- İçin değer `column` içinde `offset` eğer geçerli satırdan uzaklık `offset` değer blok sınırları dışında değil. +- İçin varsayılan değer `column` eğer `offset` değer, blok sınırlarının dışındadır. Eğer `default_value` verilir, daha sonra kullanılacaktır. + +Tür: etkilenen veri bloklarının türü veya varsayılan değer türü. + +**Örnek** + +Sorgu: + +``` sql +SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; +``` + +Sonuç: + +``` text +┌─number─┬─neighbor(number, 2)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 0 │ +│ 9 │ 0 │ +└────────┴─────────────────────┘ +``` + +Sorgu: + +``` sql +SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; +``` + +Sonuç: + +``` text +┌─number─┬─neighbor(number, 2, 999)─┐ +│ 0 │ 2 │ +│ 1 │ 3 │ +│ 2 │ 4 │ +│ 3 │ 5 │ +│ 4 │ 6 │ +│ 5 │ 7 │ +│ 6 │ 8 │ +│ 7 │ 9 │ +│ 8 │ 999 │ +│ 9 │ 999 │ +└────────┴──────────────────────────┘ +``` + +Bu işlev, yıldan yıla metrik değeri hesaplamak için kullanılabilir: + +Sorgu: + +``` sql +WITH toDate('2018-01-01') AS start_date +SELECT + toStartOfMonth(start_date + (number * 32)) AS month, + toInt32(month) % 100 AS money, + neighbor(money, -12) AS prev_year, + round(prev_year / money, 2) AS year_over_year +FROM numbers(16) +``` + +Sonuç: + +``` text +┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ +│ 2018-01-01 │ 32 │ 0 │ 0 │ +│ 2018-02-01 │ 63 │ 0 │ 0 │ +│ 2018-03-01 │ 91 │ 0 │ 0 │ +│ 2018-04-01 │ 22 │ 0 │ 0 │ +│ 2018-05-01 │ 52 │ 0 │ 0 │ +│ 2018-06-01 │ 83 │ 0 │ 0 │ +│ 2018-07-01 │ 13 │ 0 │ 0 │ +│ 2018-08-01 │ 44 │ 0 │ 0 │ +│ 2018-09-01 │ 75 │ 0 │ 0 │ +│ 2018-10-01 │ 5 │ 0 │ 0 │ +│ 2018-11-01 │ 36 │ 0 │ 0 │ +│ 2018-12-01 │ 66 │ 0 │ 0 │ +│ 2019-01-01 │ 97 │ 32 │ 0.33 │ +│ 2019-02-01 │ 28 │ 63 │ 2.25 │ +│ 2019-03-01 │ 56 │ 91 │ 1.62 │ +│ 2019-04-01 │ 87 │ 22 │ 0.25 │ +└────────────┴───────┴───────────┴────────────────┘ +``` + +## runningDifference (x) {#other_functions-runningdifference} + +Calculates the difference between successive row values ​​in the data block. +İlk satır için 0 ve sonraki her satır için önceki satırdan farkı döndürür. + +İşlevin sonucu, etkilenen veri bloklarına ve bloktaki veri sırasına bağlıdır. +ORDER BY ile bir alt sorgu yaparsanız ve alt sorgunun dışından işlevi çağırırsanız, beklenen sonucu alabilirsiniz. + +Örnek: + +``` sql +SELECT + EventID, + EventTime, + runningDifference(EventTime) AS delta +FROM +( + SELECT + EventID, + EventTime + FROM events + WHERE EventDate = '2016-11-24' + ORDER BY EventTime ASC + LIMIT 5 +) +``` + +``` text +┌─EventID─┬───────────EventTime─┬─delta─┐ +│ 1106 │ 2016-11-24 00:00:04 │ 0 │ +│ 1107 │ 2016-11-24 00:00:05 │ 1 │ +│ 1108 │ 2016-11-24 00:00:05 │ 0 │ +│ 1109 │ 2016-11-24 00:00:09 │ 4 │ +│ 1110 │ 2016-11-24 00:00:10 │ 1 │ +└─────────┴─────────────────────┴───────┘ +``` + +Lütfen dikkat - blok boyutu sonucu etkiler. Her yeni blok ile, `runningDifference` durum sıfırlandı. + +``` sql +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +┌─number─┬─diff─┐ +│ 65536 │ 0 │ +└────────┴──────┘ +``` + +``` sql +set max_block_size=100000 -- default value is 65536! + +SELECT + number, + runningDifference(number + 1) AS diff +FROM numbers(100000) +WHERE diff != 1 +``` + +``` text +┌─number─┬─diff─┐ +│ 0 │ 0 │ +└────────┴──────┘ +``` + +## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} + +İçin aynı [runningDifference](./other-functions.md#other_functions-runningdifference), fark ilk satırın değeridir, ilk satırın değerini döndürdü ve sonraki her satır önceki satırdan farkı döndürür. + +## MACNumToString (num) {#macnumtostringnum} + +Bir uınt64 numarasını kabul eder. Big endian’da bir MAC adresi olarak yorumlar. AA:BB:CC:DD:EE:FF biçiminde karşılık gelen MAC adresini içeren bir dize döndürür (onaltılık formda iki nokta üst üste ayrılmış sayılar). + +## MACStringToNum (s) {#macstringtonums} + +MACNumToString ters işlevi. MAC adresi geçersiz bir biçime sahipse, 0 döndürür. + +## MACStringToOUİ (s) {#macstringtoouis} + +AA:BB:CC:DD:EE:FF (onaltılık formda iki nokta üst üste ayrılmış sayılar) biçiminde bir MAC adresi kabul eder. İlk üç sekizli uint64 numarası olarak döndürür. MAC adresi geçersiz bir biçime sahipse, 0 döndürür. + +## getSizeOfEnumType {#getsizeofenumtype} + +Alan sayısını döndürür [Enum](../../sql-reference/data-types/enum.md). + +``` sql +getSizeOfEnumType(value) +``` + +**Parametre:** + +- `value` — Value of type `Enum`. + +**Döndürülen değerler** + +- İle alan sayısı `Enum` giriş değerleri. +- Tür değilse bir istisna atılır `Enum`. + +**Örnek** + +``` sql +SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## blockSerializedSize {#blockserializedsize} + +Diskteki boyutu döndürür (sıkıştırmayı hesaba katmadan). + +``` sql +blockSerializedSize(value[, value[, ...]]) +``` + +**Parametre:** + +- `value` — Any value. + +**Döndürülen değerler** + +- (Sıkıştırma olmadan) değerler bloğu için diske yazılacak bayt sayısı. + +**Örnek** + +``` sql +SELECT blockSerializedSize(maxState(1)) as x +``` + +``` text +┌─x─┐ +│ 2 │ +└───┘ +``` + +## toColumnTypeName {#tocolumntypename} + +RAM’DEKİ sütunun veri türünü temsil eden sınıfın adını döndürür. + +``` sql +toColumnTypeName(value) +``` + +**Parametre:** + +- `value` — Any type of value. + +**Döndürülen değerler** + +- Temsil etmek için kullanılan sınıfın adını içeren bir dize `value` RAM veri türü. + +**Arasındaki fark örneği`toTypeName ' and ' toColumnTypeName`** + +``` sql +SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime │ +└─────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) +``` + +``` text +┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ Const(UInt32) │ +└───────────────────────────────────────────────────────────┘ +``` + +Örnek gösteriyor ki `DateTime` veri türü olarak bellekte saklanır `Const(UInt32)`. + +## dumpColumnStructure {#dumpcolumnstructure} + +Ram’deki veri yapılarının ayrıntılı bir açıklamasını verir + +``` sql +dumpColumnStructure(value) +``` + +**Parametre:** + +- `value` — Any type of value. + +**Döndürülen değerler** + +- Temsil etmek için kullanılan yapıyı açıklayan bir dize `value` RAM veri türü. + +**Örnek** + +``` sql +SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) +``` + +``` text +┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ +│ DateTime, Const(size = 1, UInt32(size = 1)) │ +└──────────────────────────────────────────────────────────────┘ +``` + +## defaultValueOfArgumentType {#defaultvalueofargumenttype} + +Veri türü için varsayılan değeri verir. + +Kullanıcı tarafından ayarlanan özel sütunlar için varsayılan değerleri içermez. + +``` sql +defaultValueOfArgumentType(expression) +``` + +**Parametre:** + +- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. + +**Döndürülen değerler** + +- `0` sayılar için. +- Dizeler için boş dize. +- `ᴺᵁᴸᴸ` için [Nullable](../../sql-reference/data-types/nullable.md). + +**Örnek** + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ +│ 0 │ +└─────────────────────────────────────────────┘ +``` + +``` sql +SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) +``` + +``` text +┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ +│ ᴺᵁᴸᴸ │ +└───────────────────────────────────────────────────────┘ +``` + +## çoğaltmak {#other-functions-replicate} + +Tek bir değere sahip bir dizi oluşturur. + +İç uygulama için kullanılan [arrayJoin](array-join.md#functions_arrayjoin). + +``` sql +SELECT replicate(x, arr); +``` + +**Parametre:** + +- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. +- `x` — The value that the resulting array will be filled with. + +**Döndürülen değer** + +Değerle dolu bir dizi `x`. + +Tür: `Array`. + +**Örnek** + +Sorgu: + +``` sql +SELECT replicate(1, ['a', 'b', 'c']) +``` + +Sonuç: + +``` text +┌─replicate(1, ['a', 'b', 'c'])─┐ +│ [1,1,1] │ +└───────────────────────────────┘ +``` + +## filesystemAvailable {#filesystemavailable} + +Veritabanlarının dosyalarının bulunduğu dosya sisteminde kalan alan miktarını döndürür. Her zaman toplam boş alandan daha küçüktür ([filesystemFree](#filesystemfree)) çünkü OS için biraz alan ayrılmıştır. + +**Sözdizimi** + +``` sql +filesystemAvailable() +``` + +**Döndürülen değer** + +- Bayt olarak kullanılabilir kalan alan miktarı. + +Tür: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; +``` + +Sonuç: + +``` text +┌─Available space─┬─Type───┐ +│ 30.75 GiB │ UInt64 │ +└─────────────────┴────────┘ +``` + +## filesystemFree {#filesystemfree} + +Veritabanlarının dosyalarının bulunduğu dosya sistemindeki boş alanın toplam miktarını döndürür. Ayrıca bakınız `filesystemAvailable` + +**Sözdizimi** + +``` sql +filesystemFree() +``` + +**Döndürülen değer** + +- Bayt cinsinden boş alan miktarı. + +Tür: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; +``` + +Sonuç: + +``` text +┌─Free space─┬─Type───┐ +│ 32.39 GiB │ UInt64 │ +└────────────┴────────┘ +``` + +## filesystemCapacity {#filesystemcapacity} + +Dosya sisteminin kapasitesini bayt cinsinden döndürür. Değerlendirme için, [yol](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-path) veri dizinine yapılandırılmalıdır. + +**Sözdizimi** + +``` sql +filesystemCapacity() +``` + +**Döndürülen değer** + +- Dosya sisteminin bayt cinsinden kapasite bilgisi. + +Tür: [Uİnt64](../../sql-reference/data-types/int-uint.md). + +**Örnek** + +Sorgu: + +``` sql +SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" +``` + +Sonuç: + +``` text +┌─Capacity──┬─Type───┐ +│ 39.32 GiB │ UInt64 │ +└───────────┴────────┘ +``` + +## finalizeAggregation {#function-finalizeaggregation} + +Toplama işlevinin durumunu alır. Toplama sonucunu döndürür (kesinleşmiş durum). + +## runningAccumulate {#function-runningaccumulate} + +Toplama işlevinin durumlarını alır ve değerleri olan bir sütun döndürür, bu durumların bir dizi blok satırı için ilk satırdan geçerli satıra birikmesinin sonucudur. +Örneğin, toplama işlevinin durumunu alır (örnek runningAccumulate (uniqState (Userıd))) ve her blok satırı için, önceki tüm Satırların ve geçerli satırın durumlarının birleştirilmesinde toplama işlevinin sonucunu döndürür. +Bu nedenle, işlevin sonucu, verilerin bloklara bölünmesine ve blok içindeki verilerin sırasına bağlıdır. + +## joinGet {#joinget} + +İşlev, tablodan verileri bir tablodan aynı şekilde ayıklamanızı sağlar [sözlük](../../sql-reference/dictionaries/index.md). + +Veri alır [Katmak](../../engines/table-engines/special/join.md#creating-a-table) belirtilen birleştirme anahtarını kullanarak tablolar. + +Sadece ile oluşturulan tabloları destekler `ENGINE = Join(ANY, LEFT, )` deyim. + +**Sözdizimi** + +``` sql +joinGet(join_storage_table_name, `value_column`, join_keys) +``` + +**Parametre** + +- `join_storage_table_name` — an [tanıtıcı](../syntax.md#syntax-identifiers) aramanın nerede yapıldığını gösterir. Tanımlayıcı varsayılan veritabanında aranır (bkz. parametre `default_database` config dosyası). Varsayılan veritabanını geçersiz kılmak için `USE db_name` veya ayırıcı aracılığıyla veritabanını ve tabloyu belirtin `db_name.db_table` örnek bakın. +- `value_column` — name of the column of the table that contains required data. +- `join_keys` — list of keys. + +**Döndürülen değer** + +Anahtarların listesine karşılık gelen değerlerin listesini döndürür. + +Kaynak tabloda kesin yoksa o zaman `0` veya `null` esas alınarak iade edilecektir [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) ayar. + +Hakkında daha fazla bilgi `join_use_nulls` içinde [Birleştirme işlemi](../../engines/table-engines/special/join.md). + +**Örnek** + +Giriş tablosu: + +``` sql +CREATE DATABASE db_test +CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 +INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) +``` + +``` text +┌─id─┬─val─┐ +│ 4 │ 13 │ +│ 2 │ 12 │ +│ 1 │ 11 │ +└────┴─────┘ +``` + +Sorgu: + +``` sql +SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 +``` + +Sonuç: + +``` text +┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ +│ 0 │ +│ 11 │ +│ 12 │ +│ 0 │ +└──────────────────────────────────────────────────┘ +``` + +## modelEvaluate(model\_name, …) {#function-modelevaluate} + +Dış modeli değerlendirin. +Bir model adı ve model bağımsız değişkenleri kabul eder. Float64 Döndürür. + +## throwİf(x \[, custom\_message\]) {#throwifx-custom-message} + +Argüman sıfır değilse bir istisna atın. +custom\_message-isteğe bağlı bir parametredir: sabit bir dize, bir hata mesajı sağlar + +``` sql +SELECT throwIf(number = 3, 'Too many') FROM numbers(10); +``` + +``` text +↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): +Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. +``` + +## kimlik {#identity} + +Bağımsız değişkeni olarak kullanılan aynı değeri döndürür. Hata ayıklama ve test için kullanılan, dizin kullanarak iptal ve tam bir tarama sorgu performansını almak için izin verir. Olası dizin kullanımı için sorgu analiz edildiğinde, analizör içeriye bakmaz `identity` işlevler. + +**Sözdizimi** + +``` sql +identity(x) +``` + +**Örnek** + +Sorgu: + +``` sql +SELECT identity(42) +``` + +Sonuç: + +``` text +┌─identity(42)─┐ +│ 42 │ +└──────────────┘ +``` + +## randomPrintableASCİİ {#randomascii} + +Rastgele bir dizi ile bir dize oluşturur [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) yazdırılabilir karakterler. + +**Sözdizimi** + +``` sql +randomPrintableASCII(length) +``` + +**Parametre** + +- `length` — Resulting string length. Positive integer. + + If you pass `length < 0`, behavior of the function is undefined. + +**Döndürülen değer** + +- Rastgele bir dizi dize [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) yazdırılabilir karakterler. + +Tür: [Dize](../../sql-reference/data-types/string.md) + +**Örnek** + +``` sql +SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 +``` + +``` text +┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ +│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ +│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ +│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ +└────────┴────────────────────────────────┴──────────────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/tr/sql-reference/functions/random-functions.md b/docs/tr/sql-reference/functions/random-functions.md new file mode 100644 index 00000000000..17fbf8acc42 --- /dev/null +++ b/docs/tr/sql-reference/functions/random-functions.md @@ -0,0 +1,30 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 51 +toc_title: "S\xF6zde Rasgele Say\u0131lar Olu\u015Fturma" +--- + +# Sözde Rasgele sayılar üretmek için Fonksiyonlar {#functions-for-generating-pseudo-random-numbers} + +Sözde rasgele sayıların kriptografik olmayan jeneratörleri kullanılır. + +Tüm işlevler sıfır bağımsız değişkeni veya bir bağımsız değişkeni kabul eder. +Bir argüman geçirilirse, herhangi bir tür olabilir ve değeri hiçbir şey için kullanılmaz. +Bu argümanın tek amacı, aynı işlevin iki farklı örneğinin farklı rasgele sayılarla farklı sütunlar döndürmesi için ortak alt ifade eliminasyonunu önlemektir. + +## Güney Afrika parası {#rand} + +Tüm uint32 tipi sayılar arasında eşit olarak dağıtılan bir sözde rasgele uint32 numarası döndürür. +Doğrusal bir uyumlu jeneratör kullanır. + +## rand64 {#rand64} + +Tüm uint64 tipi sayılar arasında eşit olarak dağıtılan sözde rasgele bir uint64 numarası döndürür. +Doğrusal bir uyumlu jeneratör kullanır. + +## randConstant {#randconstant} + +Bir sözde rastgele uint32 numarası döndürür, değer farklı bloklar için birdir. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/tr/sql-reference/functions/rounding-functions.md b/docs/tr/sql-reference/functions/rounding-functions.md new file mode 100644 index 00000000000..2ae5b161a48 --- /dev/null +++ b/docs/tr/sql-reference/functions/rounding-functions.md @@ -0,0 +1,190 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 45 +toc_title: "D\xF6nm\xFC\u015F" +--- + +# Yuvarlama fonksiyonları {#rounding-functions} + +## kat(x \[, N\]) {#floorx-n} + +Küçük veya eşit olan en büyük yuvarlak sayıyı döndürür `x`. Yuvarlak bir sayı, 1/10N’NİN katları veya 1 / 10N tam değilse, uygun veri türünün en yakın sayısıdır. +‘N’ bir tamsayı sabiti, isteğe bağlı parametredir. Varsayılan olarak sıfırdır, bu da bir tam sayıya yuvarlamak anlamına gelir. +‘N’ negatif olabilir. + +Örnekler: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` + +`x` herhangi bir sayısal türüdür. Sonuç aynı türden bir sayıdır. +Tamsayı argümanları için, bir negatif ile yuvarlamak mantıklıdır `N` değer (negatif olmayan için `N`, işlev hiçbir şey yapmaz). +Yuvarlama taşmasına neden olursa (örneğin, floor (-128, -1)), uygulamaya özgü bir sonuç döndürülür. + +## tavan(x \[, N\]), tavan (x \[, N\]) {#ceilx-n-ceilingx-n} + +Büyük veya eşit olan en küçük yuvarlak sayıyı döndürür `x`. Diğer her şekilde, aynı `floor` (yukarıda) işlevi. + +## trunc(x \[, N\]), truncate(x \[, N\]) {#truncx-n-truncatex-n} + +Mutlak değeri küçük veya eşit olan en büyük mutlak değere sahip yuvarlak sayıyı döndürür `x`‘s. In every other way, it is the same as the ’floor’ (yukarıda) işlevi. + +## Yuvarlak(x \[, N\]) {#rounding_functions-round} + +Belirtilen sayıda ondalık basamak için bir değer yuvarlar. + +İşlev, belirtilen siparişin en yakın numarasını döndürür. Verilen sayı çevreleyen sayılara eşit mesafeye sahip olduğunda, işlev, float sayı türleri için bankacının yuvarlamasını kullanır ve diğer sayı türleri için sıfırdan uzaklaşır. + +``` sql +round(expression [, decimal_places]) +``` + +**Parametre:** + +- `expression` — A number to be rounded. Can be any [ifade](../syntax.md#syntax-expressions) sayısal dönen [veri türü](../../sql-reference/data-types/index.md#data_types). +- `decimal-places` — An integer value. + - Eğer `decimal-places > 0` sonra işlev değeri ondalık noktanın sağına yuvarlar. + - Eğer `decimal-places < 0` ardından işlev değeri ondalık noktanın soluna yuvarlar. + - Eğer `decimal-places = 0` sonra işlev değeri tamsayı olarak yuvarlar. Bu durumda argüman ihmal edilebilir. + +**Döndürülen değer:** + +Giriş numarası ile aynı türden yuvarlatılmış sayı. + +### Örnekler {#examples} + +**Kullanım örneği** + +``` sql +SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 +``` + +``` text +┌───x─┬─round(divide(number, 2))─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +└─────┴──────────────────────────┘ +``` + +**Yuvarlama örnekleri** + +En yakın numaraya yuvarlama. + +``` text +round(3.2, 0) = 3 +round(4.1267, 2) = 4.13 +round(22,-1) = 20 +round(467,-2) = 500 +round(-467,-2) = -500 +``` + +Bankacı yuvarlanıyor. + +``` text +round(3.5) = 4 +round(4.5) = 4 +round(3.55, 1) = 3.6 +round(3.65, 1) = 3.6 +``` + +**Ayrıca Bakınız** + +- [roundBankers](#roundbankers) + +## roundBankers {#roundbankers} + +Bir sayıyı belirtilen ondalık konuma yuvarlar. + +- Yuvarlama sayısı iki sayı arasında yarıya ise, işlev banker yuvarlama kullanır. + + Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. + + It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. + +- Diğer durumlarda, işlev sayıları en yakın tam sayıya yuvarlar. + +Banker yuvarlama kullanarak, yuvarlama numaraları toplama veya bu sayıları çıkarma sonuçları üzerindeki etkisini azaltabilir. + +Örneğin, farklı yuvarlama ile 1.5, 2.5, 3.5, 4.5 sayılarını topla: + +- Yuvarlama yok: 1.5 + 2.5 + 3.5 + 4.5 = 12. +- Bankacı yuvarlama: 2 + 2 + 4 + 4 = 12. +- En yakın tam sayıya yuvarlama: 2 + 3 + 4 + 5 = 14. + +**Sözdizimi** + +``` sql +roundBankers(expression [, decimal_places]) +``` + +**Parametre** + +- `expression` — A number to be rounded. Can be any [ifade](../syntax.md#syntax-expressions) sayısal dönen [veri türü](../../sql-reference/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`. + - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. + +**Döndürülen değer** + +Banker yuvarlama yöntemi tarafından yuvarlanan bir değer. + +### Örnekler {#examples-1} + +**Kullanım örneği** + +Sorgu: + +``` sql + SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 +``` + +Sonuç: + +``` text +┌───x─┬─b─┐ +│ 0 │ 0 │ +│ 0.5 │ 0 │ +│ 1 │ 1 │ +│ 1.5 │ 2 │ +│ 2 │ 2 │ +│ 2.5 │ 2 │ +│ 3 │ 3 │ +│ 3.5 │ 4 │ +│ 4 │ 4 │ +│ 4.5 │ 4 │ +└─────┴───┘ +``` + +**Bankacı yuvarlama örnekleri** + +``` text +roundBankers(0.4) = 0 +roundBankers(-3.5) = -4 +roundBankers(4.5) = 4 +roundBankers(3.55, 1) = 3.6 +roundBankers(3.65, 1) = 3.6 +roundBankers(10.35, 1) = 10.4 +roundBankers(10.755, 2) = 11,76 +``` + +**Ayrıca Bakınız** + +- [turlu](#rounding_functions-round) + +## roundToExp2 (num) {#roundtoexp2num} + +Bir sayı kabul eder. Sayı birden az ise, 0 döndürür. Aksi takdirde, sayıyı en yakın (negatif olmayan) iki dereceye yuvarlar. + +## roundDuration (num) {#rounddurationnum} + +Bir sayı kabul eder. Sayı birden az ise, 0 döndürür. Aksi takdirde, sayıyı kümeden sayılara yuvarlar: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Bu fonksiyon (kayıt olmak için özeldir.Metrica ve oturum uzunluğu raporu uygulamak için kullanılır. + +## roundAge (num) {#roundagenum} + +Bir sayı kabul eder. Sayı 18’den küçükse, 0 döndürür. Aksi takdirde, sayıyı kümeden bir sayıya yuvarlar: 18, 25, 35, 45, 55. Bu fonksiyon (kayıt olmak için özeldir.Metrica ve kullanıcı yaş raporu uygulamak için kullanılır. + +## roundDown (num, arr) {#rounddownnum-arr} + +Bir sayıyı kabul eder ve belirtilen Dizideki bir öğeye yuvarlar. Değer en düşük sınırdan küçükse, en düşük sınır döndürülür. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/tr/sql-reference/functions/splitting-merging-functions.md b/docs/tr/sql-reference/functions/splitting-merging-functions.md new file mode 100644 index 00000000000..35c66180cc5 --- /dev/null +++ b/docs/tr/sql-reference/functions/splitting-merging-functions.md @@ -0,0 +1,116 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 47 +toc_title: "Dizeleri ve dizileri b\xF6lme ve birle\u015Ftirme" +--- + +# Dizeleri Ve Dizileri bölme Ve birleştirme işlevleri {#functions-for-splitting-and-merging-strings-and-arrays} + +## splitByChar (ayırıcı, s) {#splitbycharseparator-s} + +Bir dizeyi belirtilen bir karakterle ayrılmış alt dizelere böler. Sabit bir dize kullanır `separator` tam olarak bir karakterden oluşan. +Seçili alt dizelerin bir dizisini döndürür. Ayırıcı dizenin başında veya sonunda oluşursa veya ardışık birden çok ayırıcı varsa, boş alt dizeler seçilebilir. + +**Sözdizimi** + +``` sql +splitByChar(, ) +``` + +**Parametre** + +- `separator` — The separator which should contain exactly one character. [Dize](../../sql-reference/data-types/string.md). +- `s` — The string to split. [Dize](../../sql-reference/data-types/string.md). + +**Döndürülen değer (ler)** + +Seçili alt dizelerin bir dizisini döndürür. Boş alt dizeler şu durumlarda seçilebilir: + +- Dizenin başında veya sonunda bir ayırıcı oluşur; +- Birden fazla ardışık ayırıcı vardır; +- Orijinal dize `s` boş. + +Tür: [Dizi](../../sql-reference/data-types/array.md) -den [Dize](../../sql-reference/data-types/string.md). + +**Örnek** + +``` sql +SELECT splitByChar(',', '1,2,3,abcde') +``` + +``` text +┌─splitByChar(',', '1,2,3,abcde')─┐ +│ ['1','2','3','abcde'] │ +└─────────────────────────────────┘ +``` + +## splitByString (ayırıcı, s) {#splitbystringseparator-s} + +Bir dizeyi bir dizeyle ayrılmış alt dizelere böler. Sabit bir dize kullanır `separator` ayırıcı olarak birden fazla karakter. Eğer dize `separator` boş olduğunu, bu bölünmüş dize `s` tek karakter dizisine. + +**Sözdizimi** + +``` sql +splitByString(, ) +``` + +**Parametre** + +- `separator` — The separator. [Dize](../../sql-reference/data-types/string.md). +- `s` — The string to split. [Dize](../../sql-reference/data-types/string.md). + +**Döndürülen değer (ler)** + +Seçili alt dizelerin bir dizisini döndürür. Boş alt dizeler şu durumlarda seçilebilir: + +Tür: [Dizi](../../sql-reference/data-types/array.md) -den [Dize](../../sql-reference/data-types/string.md). + +- Boş olmayan bir ayırıcı dizenin başında veya sonunda oluşur; +- Birden fazla ardışık boş olmayan ayırıcı vardır; +- Orijinal dize `s` ayırıcı boş değilken boş. + +**Örnek** + +``` sql +SELECT splitByString(', ', '1, 2 3, 4,5, abcde') +``` + +``` text +┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ +│ ['1','2 3','4,5','abcde'] │ +└───────────────────────────────────────────┘ +``` + +``` sql +SELECT splitByString('', 'abcde') +``` + +``` text +┌─splitByString('', 'abcde')─┐ +│ ['a','b','c','d','e'] │ +└────────────────────────────┘ +``` + +## arrayStringConcat(arr \[, ayırıcı\]) {#arraystringconcatarr-separator} + +Dizide listelenen dizeleri ayırıcı ile birleştirir.’separator’ isteğe bağlı bir parametredir: varsayılan olarak boş bir dizeye ayarlanmış sabit bir dize. +Dizeyi döndürür. + +## alphaTokens (s) {#alphatokenss} + +A-z ve A-Z aralıklarından ardışık baytların alt dizelerini seçer. + +**Örnek** + +``` sql +SELECT alphaTokens('abca1abc') +``` + +``` text +┌─alphaTokens('abca1abc')─┐ +│ ['abca','abc'] │ +└─────────────────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/tr/sql-reference/functions/string-functions.md b/docs/tr/sql-reference/functions/string-functions.md new file mode 100644 index 00000000000..4d3b32ad987 --- /dev/null +++ b/docs/tr/sql-reference/functions/string-functions.md @@ -0,0 +1,489 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 40 +toc_title: "Dizeleri ile \xE7al\u0131\u015Fma" +--- + +# Dizelerle çalışmak için işlevler {#functions-for-working-with-strings} + +## boş {#empty} + +Boş bir dize için 1 veya boş olmayan bir dize için 0 döndürür. +Sonuç türü Uint8’dir. +Bir boşluk veya boş bayt olsa bile, en az bir bayt içeriyorsa, bir dize boş olarak kabul edilir. +İşlev ayrıca diziler için de çalışır. + +## notEmpty {#notempty} + +Boş bir dize için 0 veya boş olmayan bir dize için 1 döndürür. +Sonuç türü Uint8’dir. +İşlev ayrıca diziler için de çalışır. + +## uzunluk {#length} + +Bir dizenin uzunluğunu bayt cinsinden döndürür (karakterlerde değil, kod noktalarında değil). +Sonuç türü Uint64’tür. +İşlev ayrıca diziler için de çalışır. + +## lengthUTF8 {#lengthutf8} + +Dizenin UTF-8 kodlanmış metni oluşturan bir bayt kümesi içerdiğini varsayarak, Unicode kod noktalarında (karakterlerde değil) bir dizenin uzunluğunu döndürür. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). +Sonuç türü Uint64’tür. + +## char\_length, CHAR\_LENGTH {#char-length} + +Dizenin UTF-8 kodlanmış metni oluşturan bir bayt kümesi içerdiğini varsayarak, Unicode kod noktalarında (karakterlerde değil) bir dizenin uzunluğunu döndürür. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). +Sonuç türü Uint64’tür. + +## character\_length, CHARACTER\_LENGTH {#character-length} + +Dizenin UTF-8 kodlanmış metni oluşturan bir bayt kümesi içerdiğini varsayarak, Unicode kod noktalarında (karakterlerde değil) bir dizenin uzunluğunu döndürür. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). +Sonuç türü Uint64’tür. + +## alt, lcase {#lower} + +Bir dizedeki ASCII Latin sembollerini küçük harfe dönüştürür. + +## üst, ucase {#upper} + +Bir dizedeki ASCII Latin sembollerini büyük harfe dönüştürür. + +## lowerUTF8 {#lowerutf8} + +Dizenin UTF-8 kodlu bir metni oluşturan bir bayt kümesi içerdiğini varsayarak bir dizeyi küçük harfe dönüştürür. +Dili algılamaz. Yani Türkçe için sonuç tam olarak doğru olmayabilir. +UTF-8 bayt dizisinin uzunluğu bir kod noktasının büyük ve küçük harf için farklıysa, sonuç bu kod noktası için yanlış olabilir. +Dize, UTF-8 olmayan bir bayt kümesi içeriyorsa, davranış tanımsızdır. + +## upperUTF8 {#upperutf8} + +Dize, UTF-8 kodlanmış bir metni oluşturan bir bayt kümesi içerdiğini varsayarak bir dizeyi büyük harfe dönüştürür. +Dili algılamaz. Yani Türkçe için sonuç tam olarak doğru olmayabilir. +UTF-8 bayt dizisinin uzunluğu bir kod noktasının büyük ve küçük harf için farklıysa, sonuç bu kod noktası için yanlış olabilir. +Dize, UTF-8 olmayan bir bayt kümesi içeriyorsa, davranış tanımsızdır. + +## ısvalidutf8 {#isvalidutf8} + +Bayt kümesi geçerli UTF-8 kodlanmış, aksi takdirde 0 ise, 1 döndürür. + +## toValidUTF8 {#tovalidutf8} + +Geçersiz UTF-8 karakterlerini değiştirir `�` (U+FFFD) karakteri. Bir satırda çalışan tüm geçersiz karakterler bir yedek karaktere daraltılır. + +``` sql +toValidUTF8( input_string ) +``` + +Parametre: + +- input\_string — Any set of bytes represented as the [Dize](../../sql-reference/data-types/string.md) veri türü nesnesi. + +Döndürülen değer: geçerli UTF-8 dizesi. + +**Örnek** + +``` sql +SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') +``` + +``` text +┌─toValidUTF8('a����b')─┐ +│ a�b │ +└───────────────────────┘ +``` + +## tekrarlama {#repeat} + +Bir dizeyi belirtilen kadar çok tekrarlar ve çoğaltılmış değerleri tek bir dize olarak birleştirir. + +**Sözdizimi** + +``` sql +repeat(s, n) +``` + +**Parametre** + +- `s` — The string to repeat. [Dize](../../sql-reference/data-types/string.md). +- `n` — The number of times to repeat the string. [Uİnt](../../sql-reference/data-types/int-uint.md). + +**Döndürülen değer** + +Dize içeren tek dize `s` tekrarlanan `n` kez. Eğer `n` \< 1, işlev boş dize döndürür. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT repeat('abc', 10) +``` + +Sonuç: + +``` text +┌─repeat('abc', 10)──────────────┐ +│ abcabcabcabcabcabcabcabcabcabc │ +└────────────────────────────────┘ +``` + +## tersi {#reverse} + +Dizeyi tersine çevirir (bayt dizisi olarak). + +## reverseUTF8 {#reverseutf8} + +Dizenin UTF-8 metnini temsil eden bir bayt kümesi içerdiğini varsayarak bir Unicode kod noktası dizisini tersine çevirir. Aksi takdirde, başka bir şey yapar(bir istisna atmaz). + +## format(pattern, s0, s1, …) {#format} + +Bağımsız değişkenlerde listelenen dize ile sabit desen biçimlendirme. `pattern` basitleştirilmiş bir Python biçimi desenidir. Biçim dizesi içerir “replacement fields” kıvırcık parantez ile çevrili `{}`. Parantez içinde bulunmayan herhangi bir şey, çıktıya değişmeden kopyalanan hazır metin olarak kabul edilir. Literal metne bir ayraç karakteri eklemeniz gerekiyorsa, iki katına çıkararak kaçabilir: `{{ '{{' }}` ve `{{ '}}' }}`. Alan adları sayılar (sıfırdan başlayarak) veya boş olabilir (daha sonra sonuç numaraları olarak kabul edilir). + +``` sql +SELECT format('{1} {0} {1}', 'World', 'Hello') +``` + +``` text +┌─format('{1} {0} {1}', 'World', 'Hello')─┐ +│ Hello World Hello │ +└─────────────────────────────────────────┘ +``` + +``` sql +SELECT format('{} {}', 'Hello', 'World') +``` + +``` text +┌─format('{} {}', 'Hello', 'World')─┐ +│ Hello World │ +└───────────────────────────────────┘ +``` + +## concat {#concat} + +Bağımsız değişkenlerde listelenen dizeleri ayırıcı olmadan birleştirir. + +**Sözdizimi** + +``` sql +concat(s1, s2, ...) +``` + +**Parametre** + +String veya FixedString türünün değerleri. + +**Döndürülen değerler** + +Bağımsız değişkenlerin birleştirilmesinden kaynaklanan dizeyi döndürür. + +Argüman değerlerinden herhangi biri ise `NULL`, `concat` dönüşler `NULL`. + +**Örnek** + +Sorgu: + +``` sql +SELECT concat('Hello, ', 'World!') +``` + +Sonuç: + +``` text +┌─concat('Hello, ', 'World!')─┐ +│ Hello, World! │ +└─────────────────────────────┘ +``` + +## concatassumeınjective {#concatassumeinjective} + +Aynı olarak [concat](#concat) emin olun bu ihtiyaç fark var `concat(s1, s2, ...) → sn` enjekte edilir, grup tarafından optimizasyonu için kullanılacaktır. + +İşlev adlı “injective” bağımsız değişkenlerin farklı değerleri için her zaman farklı sonuç döndürürse. Başka bir deyişle: farklı argümanlar asla aynı sonucu vermez. + +**Sözdizimi** + +``` sql +concatAssumeInjective(s1, s2, ...) +``` + +**Parametre** + +String veya FixedString türünün değerleri. + +**Döndürülen değerler** + +Bağımsız değişkenlerin birleştirilmesinden kaynaklanan dizeyi döndürür. + +Argüman değerlerinden herhangi biri ise `NULL`, `concatAssumeInjective` dönüşler `NULL`. + +**Örnek** + +Giriş tablosu: + +``` sql +CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; +INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); +SELECT * from key_val; +``` + +``` text +┌─key1────┬─key2─────┬─value─┐ +│ Hello, │ World │ 1 │ +│ Hello, │ World │ 2 │ +│ Hello, │ World! │ 3 │ +│ Hello │ , World! │ 2 │ +└─────────┴──────────┴───────┘ +``` + +Sorgu: + +``` sql +SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) +``` + +Sonuç: + +``` text +┌─concat(key1, key2)─┬─sum(value)─┐ +│ Hello, World! │ 3 │ +│ Hello, World! │ 2 │ +│ Hello, World │ 3 │ +└────────────────────┴────────────┘ +``` + +## alt dize (s, ofset, uzunluk), orta (s, ofset, uzunluk), substr (s, ofset, uzunluk) {#substring} + +Bayttan başlayarak bir alt dize döndürür ‘offset’ ind thatex yani ‘length’ uzun bayt. Karakter indeksleme birinden başlar (standart SQL’DE olduğu gibi). Bu ‘offset’ ve ‘length’ bağımsız değişkenler sabit olmalıdır. + +## substringUTF8(s, ofset, uzunluk) {#substringutf8} + +Olarak aynı ‘substring’, ancak Unicode kod noktaları için. Dizenin UTF-8 kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). + +## appendTrailingCharİfAbsent (s, c) {#appendtrailingcharifabsent} + +Eğer… ‘s’ dize boş değildir ve ‘c’ sonunda karakter, ekler ‘c’ sonuna kadar karakter. + +## convertCharset (s, from, to) {#convertcharset} + +Dize döndürür ‘s’ bu kodlamadan dönüştürüldü ‘from’ kod encodinglamaya ‘to’. + +## base64Encode (s) {#base64encode} + +Kodluyor ‘s’ Base64 içine dize + +## base64Decode (s) {#base64decode} + +Base64 kodlu dizeyi çözme ‘s’ orijinal dizeye. Başarısızlık durumunda bir istisna yükseltir. + +## tryBase64Decode (s) {#trybase64decode} + +Base64decode’a benzer, ancak hata durumunda boş bir dize döndürülür. + +## endsWith (s, sonek) {#endswith} + +Belirtilen sonek ile bitip bitmeyeceğini döndürür. Dize belirtilen sonek ile biterse 1 değerini döndürür, aksi takdirde 0 değerini döndürür. + +## startsWith (str, önek) {#startswith} + +Dize belirtilen önek ile başlayıp başlamadığını 1 döndürür, aksi halde 0 döndürür. + +``` sql +SELECT startsWith('Spider-Man', 'Spi'); +``` + +**Döndürülen değerler** + +- 1, dize belirtilen önek ile başlarsa. +- 0, dize belirtilen önek ile başlamazsa. + +**Örnek** + +Sorgu: + +``` sql +SELECT startsWith('Hello, world!', 'He'); +``` + +Sonuç: + +``` text +┌─startsWith('Hello, world!', 'He')─┐ +│ 1 │ +└───────────────────────────────────┘ +``` + +## kırpmak {#trim} + +Belirtilen tüm karakterleri bir dizenin başlangıcından veya sonundan kaldırır. +Varsayılan olarak, bir dizenin her iki ucundan ortak boşlukların (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. + +**Sözdizimi** + +``` sql +trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) +``` + +**Parametre** + +- `trim_character` — specified characters for trim. [Dize](../../sql-reference/data-types/string.md). +- `input_string` — string for trim. [Dize](../../sql-reference/data-types/string.md). + +**Döndürülen değer** + +Önde gelen ve (veya) belirtilen karakterleri izleyen bir dize. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT trim(BOTH ' ()' FROM '( Hello, world! )') +``` + +Sonuç: + +``` text +┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ +│ Hello, world! │ +└───────────────────────────────────────────────┘ +``` + +## trimLeft {#trimleft} + +Bir dizenin başlangıcından ortak boşluk (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. Diğer boşluk karakterlerini (sekme, boşluksuz boşluk, vb.) kaldırmaz.). + +**Sözdizimi** + +``` sql +trimLeft(input_string) +``` + +Takma ad: `ltrim(input_string)`. + +**Parametre** + +- `input_string` — string to trim. [Dize](../../sql-reference/data-types/string.md). + +**Döndürülen değer** + +Bir dize olmadan lider ortak whitespaces. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT trimLeft(' Hello, world! ') +``` + +Sonuç: + +``` text +┌─trimLeft(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## trimRight {#trimright} + +Bir dizenin sonundan ortak boşluk (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. Diğer boşluk karakterlerini (sekme, boşluksuz boşluk, vb.) kaldırmaz.). + +**Sözdizimi** + +``` sql +trimRight(input_string) +``` + +Takma ad: `rtrim(input_string)`. + +**Parametre** + +- `input_string` — string to trim. [Dize](../../sql-reference/data-types/string.md). + +**Döndürülen değer** + +Ortak whitespaces firar olmadan bir dize. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT trimRight(' Hello, world! ') +``` + +Sonuç: + +``` text +┌─trimRight(' Hello, world! ')─┐ +│ Hello, world! │ +└──────────────────────────────────────┘ +``` + +## trimBoth {#trimboth} + +Bir dizenin her iki ucundan ortak boşluk (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. Diğer boşluk karakterlerini (sekme, boşluksuz boşluk, vb.) kaldırmaz.). + +**Sözdizimi** + +``` sql +trimBoth(input_string) +``` + +Takma ad: `trim(input_string)`. + +**Parametre** + +- `input_string` — string to trim. [Dize](../../sql-reference/data-types/string.md). + +**Döndürülen değer** + +Bir dize olmadan lider ve sondaki ortak whitespaces. + +Tür: `String`. + +**Örnek** + +Sorgu: + +``` sql +SELECT trimBoth(' Hello, world! ') +``` + +Sonuç: + +``` text +┌─trimBoth(' Hello, world! ')─┐ +│ Hello, world! │ +└─────────────────────────────────────┘ +``` + +## CRC32 (s) {#crc32} + +CRC-32-IEEE 802.3 polinom ve başlangıç değerini kullanarak bir dizenin CRC32 sağlama toplamını döndürür `0xffffffff` (zlib uygulaması). + +Sonuç türü Uint32’dir. + +## Crc32ieee (s) {#crc32ieee} + +CRC-32-IEEE 802.3 polinomunu kullanarak bir dizenin CRC32 sağlama toplamını döndürür. + +Sonuç türü Uint32’dir. + +## CRC64 (s) {#crc64} + +CRC-64-ECMA polinomunu kullanarak bir dizenin CRC64 sağlama toplamını döndürür. + +Sonuç türü Uint64’tür. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/tr/sql-reference/functions/string-replace-functions.md b/docs/tr/sql-reference/functions/string-replace-functions.md new file mode 100644 index 00000000000..ef71ccb2e41 --- /dev/null +++ b/docs/tr/sql-reference/functions/string-replace-functions.md @@ -0,0 +1,94 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 42 +toc_title: "Dizelerde de\u011Fi\u015Ftirilmesi i\xE7in" +--- + +# Dizelerde Arama Ve değiştirme işlevleri {#functions-for-searching-and-replacing-in-strings} + +## replaceOne(Samanlık, desen, değiştirme) {#replaceonehaystack-pattern-replacement} + +Varsa, ilk oluş replacesumun yerini ‘pattern’ substring içinde ‘haystack’ ile… ‘replacement’ dize. +Ahiret, ‘pattern’ ve ‘replacement’ sabitleri olması gerekir. + +## replaceAll (Samanlık, desen, değiştirme), değiştirin (Samanlık, desen, değiştirme) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} + +Tüm oluşumları değiştirir ‘pattern’ substring içinde ‘haystack’ ile… ‘replacement’ dize. + +## replaceRegexpOne(Samanlık, desen, değiştirme) {#replaceregexponehaystack-pattern-replacement} + +Kullanarak değiştirme ‘pattern’ düzenli ifade. Re2 düzenli ifade. +Varsa, yalnızca ilk oluşumu değiştirir. +Bir desen olarak belirtilebilir ‘replacement’. Bu desen değiştirmeleri içerebilir `\0-\9`. +İkame `\0` tüm düzenli ifadeyi içerir. İkameler `\1-\9` alt desene karşılık gelir numbers.To use the `\` bir şablondaki karakter, kullanarak kaçış `\`. +Ayrıca, bir dize literalinin ekstra bir kaçış gerektirdiğini unutmayın. + +Örnek 1. Tarihi Amerikan format convertingına dönüştürme: + +``` sql +SELECT DISTINCT + EventDate, + replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res +FROM test.hits +LIMIT 7 +FORMAT TabSeparated +``` + +``` text +2014-03-17 03/17/2014 +2014-03-18 03/18/2014 +2014-03-19 03/19/2014 +2014-03-20 03/20/2014 +2014-03-21 03/21/2014 +2014-03-22 03/22/2014 +2014-03-23 03/23/2014 +``` + +Örnek 2. Bir dize on kez kopyalama: + +``` sql +SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res +``` + +``` text +┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +## replaceRegexpAll(Samanlık, desen, değiştirme) {#replaceregexpallhaystack-pattern-replacement} + +Bu aynı şeyi yapar, ancak tüm oluşumların yerini alır. Örnek: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res +``` + +``` text +┌─res────────────────────────┐ +│ HHeelllloo,, WWoorrlldd!! │ +└────────────────────────────┘ +``` + +Normal bir ifade boş bir alt dize üzerinde çalıştıysa, bir istisna olarak, değiştirme birden çok kez yapılmaz. +Örnek: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res +``` + +``` text +┌─res─────────────────┐ +│ here: Hello, World! │ +└─────────────────────┘ +``` + +## regexpQuoteMeta (s) {#regexpquotemetas} + +İşlev, dizedeki bazı önceden tanımlanmış karakterlerden önce bir ters eğik çizgi ekler. +Önceden tanımlanmış karakterler: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, ‘\]’, ‘?’, ‘\*‘,’+‘,’{‘,’:‘,’-’. +Bu uygulama biraz re2::RE2::QuoteMeta farklıdır. Sıfır bayttan 00 yerine \\0 olarak çıkar ve yalnızca gerekli karakterlerden kaçar. +Daha fazla bilgi için bağlantıya bakın: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/tr/sql-reference/functions/string-search-functions.md b/docs/tr/sql-reference/functions/string-search-functions.md new file mode 100644 index 00000000000..62150c3ec36 --- /dev/null +++ b/docs/tr/sql-reference/functions/string-search-functions.md @@ -0,0 +1,379 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 41 +toc_title: "Arama Dizeleri \u0130\xE7in" +--- + +# Dizeleri Aramak için işlevler {#functions-for-searching-strings} + +Arama, tüm bu işlevlerde varsayılan olarak büyük / küçük harf duyarlıdır. Büyük / küçük harf duyarlı arama için ayrı Varyantlar vardır. + +## pozisyon (Samanlık, iğne), bulun (Samanlık, iğne) {#position} + +1’den başlayarak dizedeki bulunan alt dizenin konumunu (bayt cinsinden) döndürür. + +Dize, tek baytlık kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa ve bir karakter tek bir bayt kullanılarak temsil edilemezse, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki bayt kullanılarak temsil edilebilirse, iki bayt vb. kullanır. + +Büyük / küçük harf duyarsız arama için işlevi kullanın [positionCaseİnsensitive](#positioncaseinsensitive). + +**Sözdizimi** + +``` sql +position(haystack, needle) +``` + +Takma ad: `locate(haystack, needle)`. + +**Parametre** + +- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). + +**Döndürülen değerler** + +- Alt dize bulunursa, bayt cinsinden başlangıç pozisyonu (1’den sayma). +- 0, alt dize bulunamadı. + +Tür: `Integer`. + +**Örnekler** + +İfade “Hello, world!” tek baytla kodlanmış bir metni temsil eden bir bayt kümesi içerir. İşlev beklenen bazı sonuçları döndürür: + +Sorgu: + +``` sql +SELECT position('Hello, world!', '!') +``` + +Sonuç: + +``` text +┌─position('Hello, world!', '!')─┐ +│ 13 │ +└────────────────────────────────┘ +``` + +Rusça’daki aynı ifade, tek bir bayt kullanılarak temsil edilemeyen karakterler içerir. İşlev beklenmedik bir sonuç verir (kullanım [positionUTF8](#positionutf8) çok bayt kodlu metin için işlev): + +Sorgu: + +``` sql +SELECT position('Привет, мир!', '!') +``` + +Sonuç: + +``` text +┌─position('Привет, мир!', '!')─┐ +│ 21 │ +└───────────────────────────────┘ +``` + +## positionCaseİnsensitive {#positioncaseinsensitive} + +Olarak aynı [konum](#position) 1’den başlayarak dizedeki bulunan alt dizenin konumunu (bayt cinsinden) döndürür. Büyük / küçük harf duyarlı bir arama için işlevi kullanın. + +Dize, tek baytlık kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa ve bir karakter tek bir bayt kullanılarak temsil edilemezse, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki bayt kullanılarak temsil edilebilirse, iki bayt vb. kullanır. + +**Sözdizimi** + +``` sql +positionCaseInsensitive(haystack, needle) +``` + +**Parametre** + +- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). + +**Döndürülen değerler** + +- Alt dize bulunursa, bayt cinsinden başlangıç pozisyonu (1’den sayma). +- 0, alt dize bulunamadı. + +Tür: `Integer`. + +**Örnek** + +Sorgu: + +``` sql +SELECT positionCaseInsensitive('Hello, world!', 'hello') +``` + +Sonuç: + +``` text +┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ +│ 1 │ +└───────────────────────────────────────────────────┘ +``` + +## positionUTF8 {#positionutf8} + +1’den başlayarak dizedeki bulunan alt dizenin konumunu (Unicode noktalarında) döndürür. + +Dizenin UTF-8 kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki Unicode noktası kullanılarak temsil edilebilirse, iki vb. kullanır. + +Büyük / küçük harf duyarsız arama için işlevi kullanın [positionCaseİnsensitiveUTF8](#positioncaseinsensitiveutf8). + +**Sözdizimi** + +``` sql +positionUTF8(haystack, needle) +``` + +**Parametre** + +- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). + +**Döndürülen değerler** + +- Unicode noktalarında başlangıç pozisyonu (1’den sayma), eğer alt dize bulundu. +- 0, alt dize bulunamadı. + +Tür: `Integer`. + +**Örnekler** + +İfade “Hello, world!” rusça’da, tek noktalı kodlanmış bir metni temsil eden bir dizi Unicode noktası bulunur. İşlev beklenen bazı sonuçları döndürür: + +Sorgu: + +``` sql +SELECT positionUTF8('Привет, мир!', '!') +``` + +Sonuç: + +``` text +┌─positionUTF8('Привет, мир!', '!')─┐ +│ 12 │ +└───────────────────────────────────┘ +``` + +İfade “Salut, étudiante!” karakter nerede `é` bir nokta kullanılarak temsil edilebilir (`U+00E9`) veya iki puan (`U+0065U+0301`) fonksiyon bazı beklenmedik sonuç iade edilebilir: + +Mektup için sorgu `é` bir Unicode noktasını temsil eden `U+00E9`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +Sonuç: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 17 │ +└────────────────────────────────────────┘ +``` + +Mektup için sorgu `é`, iki Unicode noktası temsil edilen `U+0065U+0301`: + +``` sql +SELECT positionUTF8('Salut, étudiante!', '!') +``` + +Sonuç: + +``` text +┌─positionUTF8('Salut, étudiante!', '!')─┐ +│ 18 │ +└────────────────────────────────────────┘ +``` + +## positionCaseİnsensitiveUTF8 {#positioncaseinsensitiveutf8} + +Olarak aynı [positionUTF8](#positionutf8) ama büyük küçük harf duyarlı. 1’den başlayarak dizedeki bulunan alt dizenin konumunu (Unicode noktalarında) döndürür. + +Dizenin UTF-8 kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki Unicode noktası kullanılarak temsil edilebilirse, iki vb. kullanır. + +**Sözdizimi** + +``` sql +positionCaseInsensitiveUTF8(haystack, needle) +``` + +**Parametre** + +- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). + +**Döndürülen değer** + +- Unicode noktalarında başlangıç pozisyonu (1’den sayma), eğer alt dize bulundu. +- 0, alt dize bulunamadı. + +Tür: `Integer`. + +**Örnek** + +Sorgu: + +``` sql +SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') +``` + +Sonuç: + +``` text +┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ +│ 9 │ +└────────────────────────────────────────────────────┘ +``` + +## multiSearchAllPositions {#multisearchallpositions} + +Olarak aynı [konum](string-search-functions.md#position) ama döner `Array` dizede bulunan karşılık gelen alt dizelerin konumlarının (bayt cinsinden). Pozisyonlar 1’den başlayarak endekslenir. + +Arama, dize kodlaması ve harmanlama ile ilgili olmayan bayt dizileri üzerinde gerçekleştirilir. + +- Büyük / küçük harf duyarlı ASCII arama için işlevi kullanın `multiSearchAllPositionsCaseInsensitive`. +- UTF-8’de arama yapmak için işlevi kullanın [multiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). +- Büyük / küçük harf duyarlı UTF-8 arama için multisearchallpositionscaseınsensitiveutf8 işlevini kullanın. + +**Sözdizimi** + +``` sql +multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) +``` + +**Parametre** + +- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). +- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). + +**Döndürülen değerler** + +- Bayt cinsinden başlangıç pozisyonları dizisi (1’den sayma), karşılık gelen alt dize bulunursa ve 0 bulunmazsa. + +**Örnek** + +Sorgu: + +``` sql +SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) +``` + +Sonuç: + +``` text +┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ +│ [0,13,0] │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## multiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} + +Görmek `multiSearchAllPositions`. + +## multiSearchFirstPosition (Samanlık, \[iğne1, iğne2, …, needleve\]) {#multisearchfirstposition} + +Olarak aynı `position` ancak dizenin en soldaki ofsetini döndürür `haystack` bu bazı iğnelerle eşleşti. + +Büyük/küçük harfe duyarsız arama veya / VE UTF-8 biçiminde kullanım işlevleri için `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. + +## multiSearchFirstİndex (Samanlık, \[iğne1, iğne2, …, needleve\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} + +Dizini döndürür `i` en soldaki bulunan iğnenin (1’den başlayarak)ben diz inede `haystack` ve 0 aksi takdirde. + +Büyük/küçük harfe duyarsız arama veya / VE UTF-8 biçiminde kullanım işlevleri için `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. + +## multiSearchAny (Samanlık, \[iğne1, iğne2, …, needleve\]) {#function-multisearchany} + +Döner 1, Eğer en az bir dize iğneben dize ile eşleşir `haystack` ve 0 aksi takdirde. + +Büyük/küçük harfe duyarsız arama veya / VE UTF-8 biçiminde kullanım işlevleri için `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. + +!!! note "Not" + Tamamı `multiSearch*` fonksiyonlar iğne sayısı 2’den az olmalıdır8 uygulama şartname nedeniyle. + +## maç (Samanlık, desen) {#matchhaystack-pattern} + +Dize eşleşip eşleşmediğini denetler `pattern` düzenli ifade. Bir `re2` düzenli ifade. Bu [sözdizimi](https://github.com/google/re2/wiki/Syntax) of the `re2` düzenli ifadeler, Perl düzenli ifadelerin sözdiziminden daha sınırlıdır. + +Eşleşmezse 0 veya eşleşirse 1 değerini döndürür. + +Ters eğik çizgi sembolünün (`\`) normal ifadede kaçmak için kullanılır. Aynı sembol, dize değişmezlerinde kaçmak için kullanılır. Bu nedenle, normal bir ifadede sembolden kaçmak için, bir dize literalinde iki ters eğik çizgi (\\) yazmanız gerekir. + +Normal ifade, bir bayt kümesiymiş gibi dizeyle çalışır. Normal ifade boş bayt içeremez. +Bir dizedeki alt dizeleri aramak için desenler için, LİKE veya ‘position’, çok daha hızlı çalıştıkları için. + +## multiMatchAny (Samanlık, \[desen1, desen2, …, patternve\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} + +Olarak aynı `match`, ancak normal ifadelerin hiçbiri eşleşmezse 0 ve desenlerden herhangi biri eşleşirse 1 değerini döndürür. Kullanır [hyperscan](https://github.com/intel/hyperscan) kitaplık. Bir dizede alt dizeleri aramak için desenler için, kullanmak daha iyidir `multiSearchAny` çok daha hızlı çalıştığı için. + +!!! note "Not" + Herhangi birinin uzunluğu `haystack` dize 2’den az olmalıdır32 bayt aksi takdirde özel durum atılır. Bu kısıtlama, hyperscan API nedeniyle gerçekleşir. + +## multimatchanyındex (haystack, \[desen1, desen2, …, patternve\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} + +Olarak aynı `multiMatchAny`, ancak Samanlık eşleşen herhangi bir dizin döndürür. + +## multiMatchAllİndices (haystack, \[desen1, desen2, …, patternve\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} + +Olarak aynı `multiMatchAny`, ancak herhangi bir sırada Samanlık eşleşen tüm indicies dizisini döndürür. + +## multiFuzzyMatchAny (Samanlık, mesafe, \[desen1, desen2, …, patternve\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} + +Olarak aynı `multiMatchAny`, ancak herhangi bir desen samanlıkta bir sabitle eşleşirse 1 döndürür [mesafeyi Düzenle](https://en.wikipedia.org/wiki/Edit_distance). Bu fonksiyon aynı zamanda deneysel bir moddadır ve son derece yavaş olabilir. Daha fazla bilgi için bkz. [hyperscan belgeleri](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). + +## multifuzzymatchanyındex (Samanlık, mesafe, \[desen1, desen2, …, patternve\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} + +Olarak aynı `multiFuzzyMatchAny`, ancak sabit bir düzenleme mesafesi içinde Samanlık eşleşen herhangi bir dizin döndürür. + +## multiFuzzyMatchAllİndices (Samanlık, mesafe, \[desen1, desen2, …, patternve\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} + +Olarak aynı `multiFuzzyMatchAny`, ancak sabit bir düzenleme mesafesi içinde saman yığını ile eşleşen herhangi bir sırada tüm dizinlerin dizisini döndürür. + +!!! note "Not" + `multiFuzzyMatch*` işlevler UTF-8 normal ifadeleri desteklemez ve bu tür ifadeler hyperscan kısıtlaması nedeniyle bayt olarak kabul edilir. + +!!! note "Not" + Hyperscan kullanan tüm işlevleri kapatmak için, ayarı kullanın `SET allow_hyperscan = 0;`. + +## özü (Samanlık, desen) {#extracthaystack-pattern} + +Normal ifade kullanarak bir dize parçasını ayıklar. Eğer ‘haystack’ eşleşmiyor ‘pattern’ regex, boş bir dize döndürülür. Regex alt desenler içermiyorsa, tüm regex ile eşleşen parçayı alır. Aksi takdirde, ilk alt desenle eşleşen parçayı alır. + +## extractAll(Samanlık, desen) {#extractallhaystack-pattern} + +Normal bir ifade kullanarak bir dizenin tüm parçalarını ayıklar. Eğer ‘haystack’ eşleşmiyor ‘pattern’ regex, boş bir dize döndürülür. Regex için tüm eşleşmelerden oluşan bir dizi dizeyi döndürür. Genel olarak, davranış ile aynıdır ‘extract’ işlev (bir alt desen yoksa ilk alt deseni veya tüm ifadeyi alır). + +## gibi (Samanlık, desen), Samanlık gibi desen operatörü {#function-like} + +Bir dizenin basit bir normal ifadeyle eşleşip eşleşmediğini denetler. +Normal ifade metasymbols içerebilir `%` ve `_`. + +`%` herhangi bir bayt miktarını (sıfır karakter dahil) gösterir. + +`_` herhangi bir bayt gösterir. + +Ters eğik çizgi kullanın (`\`) metasimbollerden kaçmak için. Açıklamasında kaçan nota bakın ‘match’ işlev. + +Gibi düzenli ifadeler için `%needle%`, kod daha optimal ve hızlı olarak çalışır `position` işlev. +Diğer normal ifadeler için kod, ‘match’ işlev. + +## notLike (Samanlık, desen), Samanlık desen operatörü gibi değil {#function-notlike} + +Aynı şey ‘like’ ama negatif. + +## ngramDistance(Samanlık, iğne) {#ngramdistancehaystack-needle} + +Arasındaki 4 gram distancelık mesaf theeyi hesaplar `haystack` ve `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` veya `haystack` 32kb’den fazla, bir istisna atar. Sabit olmayan bazı `haystack` veya `needle` dizeler 32kb’den daha fazladır, mesafe her zaman birdir. + +Büyük/küçük harf duyarsız arama veya / VE UTF-8 formatında kullanım işlevleri için `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. + +## ngramsearch(Samanlık, iğne) {#ngramsearchhaystack-needle} + +Aynı olarak `ngramDistance` ama arasındaki simetrik olmayan farkı hesaplar `needle` ve `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` n-büyükanne. Daha yakın, daha `needle` is in the `haystack`. Bulanık dize arama için yararlı olabilir. + +Büyük/küçük harf duyarsız arama veya / VE UTF-8 formatında kullanım işlevleri için `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. + +!!! note "Not" + For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/tr/sql-reference/functions/type-conversion-functions.md b/docs/tr/sql-reference/functions/type-conversion-functions.md new file mode 100644 index 00000000000..eac956be2ad --- /dev/null +++ b/docs/tr/sql-reference/functions/type-conversion-functions.md @@ -0,0 +1,534 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 38 +toc_title: "Tip D\xF6n\xFC\u015Ft\xFCrme" +--- + +# Tip Dönüştürme Fonksiyonları {#type-conversion-functions} + +## Sayısal dönüşümlerin Ortak sorunları {#numeric-conversion-issues} + +Bir değeri birinden başka bir veri türüne dönüştürdüğünüzde, ortak durumda, veri kaybına neden olabilecek güvenli olmayan bir işlem olduğunu unutmamalısınız. Değeri daha büyük bir veri türünden daha küçük bir veri türüne sığdırmaya çalışırsanız veya değerleri farklı veri türleri arasında dönüştürürseniz, veri kaybı oluşabilir. + +ClickHouse vardır [C++ programları ile aynı davranış](https://en.cppreference.com/w/cpp/language/implicit_conversion). + +## toİnt(8/16/32/64) {#toint8163264} + +Bir giriş değeri dönüştürür [Tamsayı](../../sql-reference/data-types/int-uint.md) veri türü. Bu işlev ailesi şunları içerir: + +- `toInt8(expr)` — Results in the `Int8` veri türü. +- `toInt16(expr)` — Results in the `Int16` veri türü. +- `toInt32(expr)` — Results in the `Int32` veri türü. +- `toInt64(expr)` — Results in the `Int64` veri türü. + +**Parametre** + +- `expr` — [İfade](../syntax.md#syntax-expressions) bir sayının ondalık gösterimiyle bir sayı veya dize döndürülmesi. Sayıların ikili, sekizli ve onaltılık gösterimleri desteklenmez. Önde gelen sıfırlar soyulur. + +**Döndürülen değer** + +Tamsayı değeri `Int8`, `Int16`, `Int32`, veya `Int64` veri türü. + +Fonksiyonlar kullanımı [sıfıra doğru yuvarlama](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), yani sayıların kesirli rakamlarını keserler. + +Fonksiyon behaviorların davranışı [N andan ve In andf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) argümanlar tanımsızdır. Hakkında hatırla [sayısal convertions sorunları](#numeric-conversion-issues), fonksiyonları kullanırken. + +**Örnek** + +``` sql +SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) +``` + +``` text +┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ +│ -9223372036854775808 │ 32 │ 16 │ 8 │ +└──────────────────────┴─────────────┴───────────────┴─────────────┘ +``` + +## toİnt (8/16/32/64)OrZero {#toint8163264orzero} + +String türünde bir argüman alır ve İnt içine ayrıştırmaya çalışır(8 \| 16 \| 32 \| 64). Başarısız olursa, 0 döndürür. + +**Örnek** + +``` sql +select toInt64OrZero('123123'), toInt8OrZero('123qwe123') +``` + +``` text +┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ +│ 123123 │ 0 │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toİnt(8/16/32/64) OrNull {#toint8163264ornull} + +String türünde bir argüman alır ve İnt içine ayrıştırmaya çalışır(8 \| 16 \| 32 \| 64). Başarısız olursa, NULL döndürür. + +**Örnek** + +``` sql +select toInt64OrNull('123123'), toInt8OrNull('123qwe123') +``` + +``` text +┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ +│ 123123 │ ᴺᵁᴸᴸ │ +└─────────────────────────┴───────────────────────────┘ +``` + +## toUİnt(8/16/32/64) {#touint8163264} + +Bir giriş değeri dönüştürür [Uİnt](../../sql-reference/data-types/int-uint.md) veri türü. Bu işlev ailesi şunları içerir: + +- `toUInt8(expr)` — Results in the `UInt8` veri türü. +- `toUInt16(expr)` — Results in the `UInt16` veri türü. +- `toUInt32(expr)` — Results in the `UInt32` veri türü. +- `toUInt64(expr)` — Results in the `UInt64` veri türü. + +**Parametre** + +- `expr` — [İfade](../syntax.md#syntax-expressions) bir sayının ondalık gösterimiyle bir sayı veya dize döndürülmesi. Sayıların ikili, sekizli ve onaltılık gösterimleri desteklenmez. Önde gelen sıfırlar soyulur. + +**Döndürülen değer** + +Tamsayı değeri `UInt8`, `UInt16`, `UInt32`, veya `UInt64` veri türü. + +Fonksiyonlar kullanımı [sıfıra doğru yuvarlama](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), yani sayıların kesirli rakamlarını keserler. + +Olumsuz agruments için işlevlerin davranışı ve [N andan ve In andf](../../sql-reference/data-types/float.md#data_type-float-nan-inf) argümanlar tanımsızdır. Örneğin, negatif bir sayı ile bir dize geçirirseniz `'-32'`, ClickHouse bir özel durum yükseltir. Hakkında hatırla [sayısal convertions sorunları](#numeric-conversion-issues), fonksiyonları kullanırken. + +**Örnek** + +``` sql +SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) +``` + +``` text +┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ +│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ +└─────────────────────┴───────────────┴────────────────┴──────────────┘ +``` + +## toUİnt (8/16/32/64)OrZero {#touint8163264orzero} + +## toUİnt(8/16/32/64) OrNull {#touint8163264ornull} + +## toFloat(32/64) {#tofloat3264} + +## toFloat (32/64)OrZero {#tofloat3264orzero} + +## toFloat(32/64) OrNull {#tofloat3264ornull} + +## toDate {#todate} + +## toDateOrZero {#todateorzero} + +## toDateOrNull {#todateornull} + +## toDateTime {#todatetime} + +## toDateTimeOrZero {#todatetimeorzero} + +## toDateTimeOrNull {#todatetimeornull} + +## toDecimal(32/64/128) {#todecimal3264128} + +Dönüşüyo `value` to the [Ondalık](../../sql-reference/data-types/decimal.md) hassas veri türü `S`. Bu `value` bir sayı veya bir dize olabilir. Bu `S` (scale) parametresi ondalık basamak sayısını belirtir. + +- `toDecimal32(value, S)` +- `toDecimal64(value, S)` +- `toDecimal128(value, S)` + +## toDecimal(32/64/128) OrNull {#todecimal3264128ornull} + +Bir giriş dizesini bir [Nullable (Ondalık (P, S))](../../sql-reference/data-types/decimal.md) veri türü değeri. Bu işlev ailesi şunları içerir: + +- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` veri türü. +- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` veri türü. +- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` veri türü. + +Bu işlevler yerine kullanılmalıdır `toDecimal*()` fonksiyonlar, eğer bir almak için tercih `NULL` bir giriş değeri ayrıştırma hatası durumunda bir özel durum yerine değer. + +**Parametre** + +- `expr` — [İfade](../syntax.md#syntax-expressions) bir değeri döndürür [Dize](../../sql-reference/data-types/string.md) veri türü. ClickHouse ondalık sayının metinsel temsilini bekler. Mesela, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**Döndürülen değer** + +İçinde bir değer `Nullable(Decimal(P,S))` veri türü. Değeri içerir: + +- İle sayı `S` ondalık basamaklar, ClickHouse giriş dizesi bir sayı olarak yorumlar. +- `NULL`, ClickHouse giriş dizesini bir sayı olarak yorumlayamazsa veya giriş numarası birden fazla içeriyorsa `S` ondalık basamaklar. + +**Örnekler** + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ +│ -1.11100 │ Nullable(Decimal(9, 5)) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ +│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toDecimal (32/64/128)OrZero {#todecimal3264128orzero} + +Bir giriş değeri dönüştürür [Ondalık(P, S)](../../sql-reference/data-types/decimal.md) veri türü. Bu işlev ailesi şunları içerir: + +- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` veri türü. +- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` veri türü. +- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` veri türü. + +Bu işlevler yerine kullanılmalıdır `toDecimal*()` fonksiyonlar, eğer bir almak için tercih `0` bir giriş değeri ayrıştırma hatası durumunda bir özel durum yerine değer. + +**Parametre** + +- `expr` — [İfade](../syntax.md#syntax-expressions) bir değeri döndürür [Dize](../../sql-reference/data-types/string.md) veri türü. ClickHouse ondalık sayının metinsel temsilini bekler. Mesela, `'1.111'`. +- `S` — Scale, the number of decimal places in the resulting value. + +**Döndürülen değer** + +İçinde bir değer `Nullable(Decimal(P,S))` veri türü. Değeri içerir: + +- İle sayı `S` ondalık basamaklar, ClickHouse giriş dizesi bir sayı olarak yorumlar. +- 0 ile `S` ondalık basamaklar, ClickHouse giriş dizesini bir sayı olarak yorumlayamazsa veya giriş numarası birden fazla içeriyorsa `S` ondalık basamaklar. + +**Örnek** + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) +``` + +``` text +┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ +│ -1.11100 │ Decimal(9, 5) │ +└──────────┴────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) +``` + +``` text +┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ +│ 0.00 │ Decimal(9, 2) │ +└──────┴────────────────────────────────────────────────────┘ +``` + +## toString {#tostring} + +Sayılar, dizeler (ancak sabit olmayan dizeler), tarihler ve tarihlerle saatler arasında dönüştürme işlevleri. +Tüm bu işlevler bir argümanı kabul eder. + +Bir dizeye veya dizeye dönüştürürken, değer, sekmeyle aynı kuralları kullanarak biçimlendirilir veya ayrıştırılır. ayrı biçim (ve hemen hemen tüm diğer metin biçimleri). Dize ayrıştırılamazsa, bir istisna atılır ve istek iptal edilir. + +Tarihleri sayılara dönüştürürken veya tam tersi, Tarih Unix döneminin başlangıcından bu yana geçen gün sayısına karşılık gelir. +Tarihleri zamanlarla sayılara dönüştürürken veya tam tersi olduğunda, zaman ile tarih, Unix döneminin başlangıcından bu yana geçen saniye sayısına karşılık gelir. + +ToDate / toDateTime işlevleri için tarih ve saatli tarih biçimleri aşağıdaki gibi tanımlanır: + +``` text +YYYY-MM-DD +YYYY-MM-DD hh:mm:ss +``` + +Özel durum olarak, uınt32, Int32, Uınt64 veya Int64 sayısal türlerinden bugüne dönüştürme ve sayı 65536’dan büyük veya eşitse, sayı Unıx zaman damgası (ve gün sayısı olarak değil) olarak yorumlanır ve tarihe yuvarlanır. Bu, yaygın yazı oluşumu için destek sağlar ‘toDate(unix\_timestamp)’, aksi takdirde bir hata olur ve daha hantal yazmayı gerektirir ‘toDate(toDateTime(unix\_timestamp))’. + +Bir tarih ve tarih ile saat arasında dönüştürme doğal bir şekilde gerçekleştirilir: boş bir zaman ekleyerek veya saati bırakarak. + +Sayısal türler arasındaki dönüştürme, C++ ’ daki farklı sayısal türler arasındaki atamalarla aynı kuralları kullanır. + +Ayrıca, Tostring işlevi DateTime bağımsız değişkeni, saat dilimi adını içeren ikinci bir dize bağımsız değişkeni alabilir. Örnek: `Asia/Yekaterinburg` Bu durumda, saat belirtilen saat dilimine göre biçimlendirilir. + +``` sql +SELECT + now() AS now_local, + toString(now(), 'Asia/Yekaterinburg') AS now_yekat +``` + +``` text +┌───────────now_local─┬─now_yekat───────────┐ +│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ +└─────────────────────┴─────────────────────┘ +``` + +Ayrıca bakınız `toUnixTimestamp` işlev. + +## toFixedString(s, N) {#tofixedstrings-n} + +Bir dize türü bağımsız değişkeni dönüştürür bir FixedString(N) türü (sabit uzunlukta bir dize N). N sabit olmalıdır. +Dize n’den daha az bayt varsa, sağa boş bayt ile geçirilir. Dize n’den daha fazla bayt varsa, bir özel durum atılır. + +## tostringcuttozero (s) {#tostringcuttozeros} + +Bir dize veya fixedstring bağımsız değişkeni kabul eder. Bulunan ilk sıfır baytta kesilmiş içeriği olan dizeyi döndürür. + +Örnek: + +``` sql +SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s─────────────┬─s_cut─┐ +│ foo\0\0\0\0\0 │ foo │ +└───────────────┴───────┘ +``` + +``` sql +SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut +``` + +``` text +┌─s──────────┬─s_cut─┐ +│ foo\0bar\0 │ foo │ +└────────────┴───────┘ +``` + +## reinterpretAsUİnt(8/16/32/64) {#reinterpretasuint8163264} + +## reinterpretAsİnt(8/16/32/64) {#reinterpretasint8163264} + +## reinterpretAsFloat (32/64) {#reinterpretasfloat3264} + +## reinterpretAsDate {#reinterpretasdate} + +## reinterpretAsDateTime {#reinterpretasdatetime} + +Bu işlevler bir dizeyi kabul eder ve dizenin başına yerleştirilen baytları ana bilgisayar düzeninde (little endian) bir sayı olarak yorumlar. Dize yeterince uzun değilse, işlevler dize gerekli sayıda boş baytla doldurulmuş gibi çalışır. Dize gerekenden daha uzunsa, ek bayt yoksayılır. Bir tarih, Unix döneminin başlangıcından bu yana geçen gün sayısı olarak yorumlanır ve zamana sahip bir tarih, Unix döneminin başlangıcından bu yana geçen saniye sayısı olarak yorumlanır. + +## reinterpretAsString {#type_conversion_functions-reinterpretAsString} + +Bu işlev, bir sayı veya tarih veya tarih saat ile kabul eder ve ana bilgisayar düzeninde (little endian) karşılık gelen değeri temsil eden bayt içeren bir dize döndürür. Boş bayt sondan bırakılır. Örneğin, 255 uint32 türü değeri bir bayt uzunluğunda bir dizedir. + +## reinterpretAsFixedString {#reinterpretasfixedstring} + +Bu işlev, bir sayı veya tarih veya tarih saat ile kabul eder ve karşılık gelen değeri ana bilgisayar sırasına (little endian) temsil eden bayt içeren bir FixedString döndürür. Boş bayt sondan bırakılır. Örneğin, 255 uint32 türü değeri bir bayt uzunluğunda bir FixedString. + +## CAS (t(x, T) {#type_conversion_function-cast} + +Dönüşüyo ‘x’ to the ‘t’ veri türü. Sözdizimi CAST (x AS t) da desteklenmektedir. + +Örnek: + +``` sql +SELECT + '2016-06-15 23:00:00' AS timestamp, + CAST(timestamp AS DateTime) AS datetime, + CAST(timestamp AS Date) AS date, + CAST(timestamp, 'String') AS string, + CAST(timestamp, 'FixedString(22)') AS fixed_string +``` + +``` text +┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ +│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ +└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ +``` + +Fixedstring(N) ’ ye dönüştürme yalnızca String veya FixedString(N) türünde argümanlar için çalışır. + +Type con conversionvers conversionion to [Nullable](../../sql-reference/data-types/nullable.md) ve geri desteklenmektedir. Örnek: + +``` sql +SELECT toTypeName(x) FROM t_null +``` + +``` text +┌─toTypeName(x)─┐ +│ Int8 │ +│ Int8 │ +└───────────────┘ +``` + +``` sql +SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null +``` + +``` text +┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ +│ Nullable(UInt16) │ +│ Nullable(UInt16) │ +└─────────────────────────────────────────┘ +``` + +## toİnterval(yıl\|Çeyrek\|Ay\|hafta\|Gün\|Saat\|Dakika / Saniye) {#function-tointerval} + +Bir sayı türü argümanını bir [Aralıklı](../../sql-reference/data-types/special-data-types/interval.md) veri türü. + +**Sözdizimi** + +``` sql +toIntervalSecond(number) +toIntervalMinute(number) +toIntervalHour(number) +toIntervalDay(number) +toIntervalWeek(number) +toIntervalMonth(number) +toIntervalQuarter(number) +toIntervalYear(number) +``` + +**Parametre** + +- `number` — Duration of interval. Positive integer number. + +**Döndürülen değerler** + +- Değeri `Interval` veri türü. + +**Örnek** + +``` sql +WITH + toDate('2019-01-01') AS date, + INTERVAL 1 WEEK AS interval_week, + toIntervalWeek(1) AS interval_to_week +SELECT + date + interval_week, + date + interval_to_week +``` + +``` text +┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ +│ 2019-01-08 │ 2019-01-08 │ +└───────────────────────────┴──────────────────────────────┘ +``` + +## parseDateTimeBestEffort {#parsedatetimebesteffort} + +Bir tarih ve saati dönüştürür [Dize](../../sql-reference/data-types/string.md) temsil etmek [DateTime](../../sql-reference/data-types/datetime.md#data_type-datetime) veri türü. + +İşlev ayrıştırır [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC 1123-5.2.14 RFC-822 Tarih ve Saat özellikleri](https://tools.ietf.org/html/rfc1123#page-55), ClickHouse ve diğer bazı tarih ve saat biçimleri. + +**Sözdizimi** + +``` sql +parseDateTimeBestEffort(time_string [, time_zone]); +``` + +**Parametre** + +- `time_string` — String containing a date and time to convert. [Dize](../../sql-reference/data-types/string.md). +- `time_zone` — Time zone. The function parses `time_string` saat dilimine göre. [Dize](../../sql-reference/data-types/string.md). + +**Desteklenen standart dışı formatlar** + +- 9 içeren bir dize..10 haneli [unix zaman damgası](https://en.wikipedia.org/wiki/Unix_time). +- Tarih ve saat bileşeni olan bir dize: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss` vb. +- Bir tarih, ancak hiçbir zaman bileşeni ile bir dize: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` vb. +- Bir gün ve Saat ile bir dize: `DD`, `DD hh`, `DD hh:mm`. Bu durumda `YYYY-MM` olarak ikame edilir `2000-01`. +- Tarih ve Saat Saat Dilimi uzaklık bilgileri ile birlikte içeren bir dize: `YYYY-MM-DD hh:mm:ss ±h:mm` vb. Mesela, `2020-12-12 17:36:00 -5:00`. + +Ayırıcılı tüm formatlar için işlev, tam adlarıyla veya bir ay adının ilk üç harfiyle ifade edilen ay adlarını ayrıştırır. Örnekler: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. + +**Döndürülen değer** + +- `time_string` dönüştürül thedü `DateTime` veri türü. + +**Örnekler** + +Sorgu: + +``` sql +SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') +AS parseDateTimeBestEffort; +``` + +Sonuç: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2020-12-12 12:12:57 │ +└─────────────────────────┘ +``` + +Sorgu: + +``` sql +SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') +AS parseDateTimeBestEffort +``` + +Sonuç: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-08-18 10:22:16 │ +└─────────────────────────┘ +``` + +Sorgu: + +``` sql +SELECT parseDateTimeBestEffort('1284101485') +AS parseDateTimeBestEffort +``` + +Sonuç: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2015-07-07 12:04:41 │ +└─────────────────────────┘ +``` + +Sorgu: + +``` sql +SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') +AS parseDateTimeBestEffort +``` + +Sonuç: + +``` text +┌─parseDateTimeBestEffort─┐ +│ 2018-12-12 10:12:12 │ +└─────────────────────────┘ +``` + +Sorgu: + +``` sql +SELECT parseDateTimeBestEffort('10 20:19') +``` + +Sonuç: + +``` text +┌─parseDateTimeBestEffort('10 20:19')─┐ +│ 2000-01-10 20:19:00 │ +└─────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) +- [RFC 1123](https://tools.ietf.org/html/rfc1123) +- [toDate](#todate) +- [toDateTime](#todatetime) + +## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} + +İçin aynı [parseDateTimeBestEffort](#parsedatetimebesteffort) işlenemeyen bir tarih biçimiyle karşılaştığında null döndürmesi dışında. + +## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} + +İçin aynı [parseDateTimeBestEffort](#parsedatetimebesteffort) bunun dışında, işlenemeyen bir tarih biçimiyle karşılaştığında sıfır tarih veya sıfır tarih saati döndürür. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/tr/sql-reference/functions/url-functions.md b/docs/tr/sql-reference/functions/url-functions.md new file mode 100644 index 00000000000..8ec71501d8a --- /dev/null +++ b/docs/tr/sql-reference/functions/url-functions.md @@ -0,0 +1,209 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 54 +toc_title: "URL'ler ile \xE7al\u0131\u015Fma" +--- + +# URL’ler Ile çalışmak için işlevler {#functions-for-working-with-urls} + +Tüm bu işlevler RFC’Yİ takip etmez. Geliştirilmiş performans için maksimum derecede basitleştirilmişlerdir. + +## Bir URL’nin bölümlerini Ayıklayan işlevler {#functions-that-extract-parts-of-a-url} + +İlgili bölüm bir URL’de yoksa, boş bir dize döndürülür. + +### protokol {#protocol} + +Protokolü bir URL’den ayıklar. + +Examples of typical returned values: http, https, ftp, mailto, tel, magnet… + +### etki {#domain} + +Ana bilgisayar adını bir URL’den ayıklar. + +``` sql +domain(url) +``` + +**Parametre** + +- `url` — URL. Type: [Dize](../../sql-reference/data-types/string.md). + +URL, bir şema ile veya şema olmadan belirtilebilir. Örnekler: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +Bu örnekler için, `domain` işlev aşağıdaki sonuçları döndürür: + +``` text +some.svn-hosting.com +some.svn-hosting.com +yandex.com +``` + +**Döndürülen değerler** + +- Adı ana. ClickHouse giriş dizesini bir URL olarak ayrıştırırsa. +- Boş dize. ClickHouse giriş dizesini bir URL olarak ayrıştıramazsa. + +Tür: `String`. + +**Örnek** + +``` sql +SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ +│ some.svn-hosting.com │ +└────────────────────────────────────────────────────────┘ +``` + +### domainWithoutWWW {#domainwithoutwww} + +Etki alanını döndürür ve birden fazla kaldırır ‘www.’ başlangıcına, eğer var dan. + +### topLevelDomain {#topleveldomain} + +Üst düzey etki alanını bir URL’den ayıklar. + +``` sql +topLevelDomain(url) +``` + +**Parametre** + +- `url` — URL. Type: [Dize](../../sql-reference/data-types/string.md). + +URL, bir şema ile veya şema olmadan belirtilebilir. Örnekler: + +``` text +svn+ssh://some.svn-hosting.com:80/repo/trunk +some.svn-hosting.com:80/repo/trunk +https://yandex.com/time/ +``` + +**Döndürülen değerler** + +- Etki alanı adı. ClickHouse giriş dizesini bir URL olarak ayrıştırırsa. +- Boş dize. ClickHouse giriş dizesini bir URL olarak ayrıştıramazsa. + +Tür: `String`. + +**Örnek** + +``` sql +SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') +``` + +``` text +┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ +│ com │ +└────────────────────────────────────────────────────────────────────┘ +``` + +### firstSignificantSubdomain {#firstsignificantsubdomain} + +Ret theur thens the “first significant subdomain”. Bu, Yandex’e özgü standart olmayan bir kavramdır.Metrica. İlk önemli alt etki alanı ise ikinci düzey bir etki alanıdır ‘com’, ‘net’, ‘org’, veya ‘co’. Aksi takdirde, üçüncü düzey bir alandır. Mesela, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. Listesi “insignificant” ikinci düzey etki alanları ve diğer uygulama ayrıntıları gelecekte değişebilir. + +### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} + +En üst düzey alt etki alanlarını içeren etki alanının bir bölümünü döndürür. “first significant subdomain” (yukarıdaki açıklamaya bakınız). + +Mesela, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. + +### yol {#path} + +Yolu döndürür. Örnek: `/top/news.html` Yol sorgu dizesini içermez. + +### pathFull {#pathfull} + +Yukarıdaki ile aynı, ancak sorgu dizesi ve parça dahil. Örnek: / top / haberler.html?Sayfa = 2 \# yorumlar + +### queryString {#querystring} + +Sorgu dizesini döndürür. Örnek: Sayfa = 1 & lr = 213. sorgu dizesi, ilk soru işaretinin yanı sıra \# ve \# sonrası her şeyi içermez. + +### parça {#fragment} + +Parça tanımlayıcısını döndürür. fragment ilk karma sembolü içermez. + +### queryStringAndFragment {#querystringandfragment} + +Sorgu dizesini ve parça tanımlayıcısını döndürür. Örnek: Sayfa = 1\#29390. + +### extractURLParameter (URL, isim) {#extracturlparameterurl-name} + +Değerini döndürür ‘name’ varsa, URL’DEKİ parametre. Aksi takdirde, boş bir dize. Bu ada sahip birçok parametre varsa, ilk oluşumu döndürür. Bu işlev, parametre adının URL’de geçirilen bağımsız değişkenle aynı şekilde kodlandığı varsayımı altında çalışır. + +### extractURLParameters (URL) {#extracturlparametersurl} + +Bir dizi döndürür name = URL parametrelerine karşılık gelen değer dizeleri. Değerler hiçbir şekilde deşifre edilmez. + +### extractURLParameterNames(URL) {#extracturlparameternamesurl} + +URL parametrelerinin adlarına karşılık gelen bir dizi ad dizesi döndürür. Değerler hiçbir şekilde deşifre edilmez. + +### URLHierarchy(URL) {#urlhierarchyurl} + +Sonunda/,? simgeleriyle kesilen URL’yi içeren bir dizi döndürür yol ve sorgu dizesinde. Ardışık ayırıcı karakterler bir olarak sayılır. Kesim, tüm ardışık ayırıcı karakterlerden sonra pozisyonda yapılır. + +### URLPathHierarchy(URL) {#urlpathhierarchyurl} + +Yukarıdaki ile aynı, ancak sonuçta protokol ve ana bilgisayar olmadan. / Eleman (kök) dahil değildir. Örnek: işlev, yandex’te URL’yi ağaç raporları uygulamak için kullanılır. Ölçü. + +``` text +URLPathHierarchy('https://example.com/browse/CONV-6788') = +[ + '/browse/', + '/browse/CONV-6788' +] +``` + +### decodeURLComponent (URL) {#decodeurlcomponenturl} + +Çözülmüş URL’yi döndürür. +Örnek: + +``` sql +SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; +``` + +``` text +┌─DecodedURL─────────────────────────────┐ +│ http://127.0.0.1:8123/?query=SELECT 1; │ +└────────────────────────────────────────┘ +``` + +## URL’nin Bir bölümünü kaldıran işlevler {#functions-that-remove-part-of-a-url} + +URL’de benzer bir şey yoksa, URL değişmeden kalır. + +### cutWWW {#cutwww} + +Birden fazla kaldırır ‘www.’ varsa, URL’nin etki alanının başından itibaren. + +### cutQueryString {#cutquerystring} + +Sorgu dizesini kaldırır. Soru işareti de kaldırılır. + +### cutFragment {#cutfragment} + +Parça tanımlayıcısını kaldırır. Sayı işareti de kaldırılır. + +### cutQueryStringAndFragment {#cutquerystringandfragment} + +Sorgu dizesini ve parça tanımlayıcısını kaldırır. Soru işareti ve sayı işareti de kaldırılır. + +### cutURLParameter (URL, isim) {#cuturlparameterurl-name} + +Kaldırır ‘name’ Varsa URL parametresi. Bu işlev, parametre adının URL’de geçirilen bağımsız değişkenle aynı şekilde kodlandığı varsayımı altında çalışır. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/tr/sql-reference/functions/uuid-functions.md b/docs/tr/sql-reference/functions/uuid-functions.md new file mode 100644 index 00000000000..0f4b9208d9d --- /dev/null +++ b/docs/tr/sql-reference/functions/uuid-functions.md @@ -0,0 +1,122 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 53 +toc_title: "UUID ile \xE7al\u0131\u015Fma" +--- + +# UUID Ile çalışmak için Fonksiyonlar {#functions-for-working-with-uuid} + +UUID ile çalışmak için işlevler aşağıda listelenmiştir. + +## generateuuıdv4 {#uuid-function-generate} + +Üretir [UUID](../../sql-reference/data-types/uuid.md) -den [sürüm 4](https://tools.ietf.org/html/rfc4122#section-4.4). + +``` sql +generateUUIDv4() +``` + +**Döndürülen değer** + +UUID türü değeri. + +**Kullanım örneği** + +Bu örnek, UUID türü sütunuyla bir tablo oluşturma ve tabloya bir değer ekleme gösterir. + +``` sql +CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog + +INSERT INTO t_uuid SELECT generateUUIDv4() + +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┐ +│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ +└──────────────────────────────────────┘ +``` + +## toUUİD (x) {#touuid-x} + +Dize türü değerini UUID türüne dönüştürür. + +``` sql +toUUID(String) +``` + +**Döndürülen değer** + +UUID türü değeri. + +**Kullanım örneği** + +``` sql +SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid +``` + +``` text +┌─────────────────────────────────uuid─┐ +│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ +└──────────────────────────────────────┘ +``` + +## UUİDStringToNum {#uuidstringtonum} + +Biçiminde 36 karakter içeren bir dize kabul eder `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` ve bir bayt kümesi olarak döndürür [FixedString (16)](../../sql-reference/data-types/fixedstring.md). + +``` sql +UUIDStringToNum(String) +``` + +**Döndürülen değer** + +FixedString (16) + +**Kullanım örnekleri** + +``` sql +SELECT + '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, + UUIDStringToNum(uuid) AS bytes +``` + +``` text +┌─uuid─────────────────────────────────┬─bytes────────────┐ +│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ +└──────────────────────────────────────┴──────────────────┘ +``` + +## UUİDNumToString {#uuidnumtostring} + +Kabul eder bir [FixedString (16)](../../sql-reference/data-types/fixedstring.md) değer ve metin biçiminde 36 karakter içeren bir dize döndürür. + +``` sql +UUIDNumToString(FixedString(16)) +``` + +**Döndürülen değer** + +Dize. + +**Kullanım örneği** + +``` sql +SELECT + 'a/<@];!~p{jTj={)' AS bytes, + UUIDNumToString(toFixedString(bytes, 16)) AS uuid +``` + +``` text +┌─bytes────────────┬─uuid─────────────────────────────────┐ +│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ +└──────────────────┴──────────────────────────────────────┘ +``` + +## Ayrıca bakınız {#see-also} + +- [dictGetUUİD](ext-dict-functions.md#ext_dict_functions-other) + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/tr/sql-reference/functions/ym-dict-functions.md b/docs/tr/sql-reference/functions/ym-dict-functions.md new file mode 100644 index 00000000000..1f47bdd4588 --- /dev/null +++ b/docs/tr/sql-reference/functions/ym-dict-functions.md @@ -0,0 +1,155 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 59 +toc_title: "Yandex ile \xE7al\u0131\u015Fmak.Metrica S\xF6zl\xFCkleri" +--- + +# Yandex Ile çalışmak için Fonksiyonlar.Metrica sözlükleri {#functions-for-working-with-yandex-metrica-dictionaries} + +Aşağıdaki işlevlerin çalışması için, sunucu yapılandırmasının tüm Yandex’i almak için yolları ve adresleri belirtmesi gerekir.Metrica sözlükler. Sözlükler, bu işlevlerden herhangi birinin ilk çağrısında yüklenir. Başvuru listeleri yüklenemiyorsa, bir özel durum atılır. + +Başvuru listeleri oluşturma hakkında daha fazla bilgi için bölüme bakın “Dictionaries”. + +## Çoklu Geobazlar {#multiple-geobases} + +ClickHouse, belirli bölgelerin hangi ülkelere ait olduğu konusunda çeşitli perspektifleri desteklemek için aynı anda birden fazla alternatif jeobaz (bölgesel hiyerarşiler) ile çalışmayı destekler. + +Bu ‘clickhouse-server’ config, dosyayı bölgesel hiyerarşi ile belirtir::`/opt/geo/regions_hierarchy.txt` + +Bu dosyanın yanı sıra, yakındaki \_ sembolüne ve isme eklenen herhangi bir sonek (dosya uzantısından önce) olan dosyaları da arar. +Örneğin, dosyayı da bulacaktır `/opt/geo/regions_hierarchy_ua.txt` varsa. + +`ua` sözlük anahtarı denir. Soneksiz bir sözlük için anahtar boş bir dizedir. + +Tüm sözlükler çalışma zamanında yeniden yüklenir (buıltın\_dıctıonarıes\_reload\_ınterval yapılandırma parametresinde tanımlandığı gibi belirli sayıda saniyede bir kez veya varsayılan olarak saatte bir kez). Ancak, sunucu başladığında kullanılabilir sözlüklerin listesi bir kez tanımlanır. + +All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. +Örnek: + +``` sql +regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt +regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt +``` + +### regionToCity (id \[, geobase\]) {#regiontocityid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. + +### regionToArea (id \[, geobase\]) {#regiontoareaid-geobase} + +Bir bölgeyi bir alana dönüştürür (geobase içinde 5 yazın). Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ +│ │ +│ Moscow and Moscow region │ +│ St. Petersburg and Leningrad region │ +│ Belgorod region │ +│ Ivanovsk region │ +│ Kaluga region │ +│ Kostroma region │ +│ Kursk region │ +│ Lipetsk region │ +│ Orlov region │ +│ Ryazan region │ +│ Smolensk region │ +│ Tambov region │ +│ Tver region │ +│ Tula region │ +└──────────────────────────────────────────────────────┘ +``` + +### regionToDistrict (id \[, geobase\]) {#regiontodistrictid-geobase} + +Bir bölgeyi federal bir bölgeye dönüştürür (geobase içinde tip 4). Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + +``` text +┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ +│ │ +│ Central federal district │ +│ Northwest federal district │ +│ South federal district │ +│ North Caucases federal district │ +│ Privolga federal district │ +│ Ural federal district │ +│ Siberian federal district │ +│ Far East federal district │ +│ Scotland │ +│ Faroe Islands │ +│ Flemish region │ +│ Brussels capital region │ +│ Wallonia │ +│ Federation of Bosnia and Herzegovina │ +└──────────────────────────────────────────────────────────┘ +``` + +### regionToCountry (ıd \[, geobase\]) {#regiontocountryid-geobase} + +Bir bölgeyi bir ülkeye dönüştürür. Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. +Örnek: `regionToCountry(toUInt32(213)) = 225` Moskova’yı (213) Rusya’ya (225) dönüştürür. + +### regionToContinent (id \[, geobase\]) {#regiontocontinentid-geobase} + +Bir bölgeyi bir kıtaya dönüştürür. Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. +Örnek: `regionToContinent(toUInt32(213)) = 10001` Moskova’yı (213) Avrasya’ya (10001) dönüştürür. + +### regionToTopContinent (\#regiontotopcontinent) {#regiontotopcontinent-regiontotopcontinent} + +Bölgenin hiyerarşisinde en yüksek kıtayı bulur. + +**Sözdizimi** + +``` sql +regionToTopContinent(id[, geobase]); +``` + +**Parametre** + +- `id` — Region ID from the Yandex geobase. [Uİnt32](../../sql-reference/data-types/int-uint.md). +- `geobase` — Dictionary key. See [Çoklu Geobazlar](#multiple-geobases). [Dize](../../sql-reference/data-types/string.md). İsteğe bağlı. + +**Döndürülen değer** + +- Üst düzey kıtanın tanımlayıcısı (bölgeler hiyerarşisine tırmandığınızda ikincisi). +- 0, yoksa. + +Tür: `UInt32`. + +### regionToPopulation (id \[, geobase\]) {#regiontopopulationid-geobase} + +Bir bölge için nüfusu alır. +Nüfus geobase ile dosyalarda kaydedilebilir. Bölümüne bakınız “External dictionaries”. +Bölge için nüfus kaydedilmezse, 0 döndürür. +Yandex geobase’de, nüfus alt bölgeler için kaydedilebilir, ancak üst bölgeler için kaydedilemez. + +### regionİn (lhs, rhs \[, geobase\]) {#regioninlhs-rhs-geobase} + +Olup olmadığını denetler bir ‘lhs’ bölge bir ‘rhs’ bölge. Aitse 1’e eşit bir Uİnt8 numarası veya ait değilse 0 döndürür. +The relationship is reflexive – any region also belongs to itself. + +### regionHierarchy (id \[, geobase\]) {#regionhierarchyid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. +Örnek: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. + +### regionToName (id \[, lang\]) {#regiontonameid-lang} + +Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn’t exist, an empty string is returned. + +`ua` ve `uk` hem Ukrayna demek. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/tr/sql-reference/index.md b/docs/tr/sql-reference/index.md new file mode 100644 index 00000000000..9a584f95eda --- /dev/null +++ b/docs/tr/sql-reference/index.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "SQL ba\u015Fvurusu" +toc_hidden: true +toc_priority: 28 +toc_title: "gizlenmi\u015F" +--- + +# SQL başvurusu {#sql-reference} + +- [SELECT](statements/select.md) +- [INSERT INTO](statements/insert-into.md) +- [CREATE](statements/create.md) +- [ALTER](statements/alter.md#query_language_queries_alter) +- [Diğer sorgu türleri](statements/misc.md) + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/tr/sql-reference/operators.md b/docs/tr/sql-reference/operators.md new file mode 100644 index 00000000000..d60207bf111 --- /dev/null +++ b/docs/tr/sql-reference/operators.md @@ -0,0 +1,277 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 37 +toc_title: "Operat\xF6rler" +--- + +# Operatörler {#operators} + +ClickHouse onların öncelik, öncelik ve ilişkilendirme göre sorgu ayrıştırma aşamasında karşılık gelen işlevlere işleçleri dönüştürür. + +## Erişim Operatörleri {#access-operators} + +`a[N]` – Access to an element of an array. The `arrayElement(a, N)` işlev. + +`a.N` – Access to a tuple element. The `tupleElement(a, N)` işlev. + +## Sayısal Olumsuzlama Operatörü {#numeric-negation-operator} + +`-a` – The `negate (a)` işlev. + +## Çarpma Ve bölme operatörleri {#multiplication-and-division-operators} + +`a * b` – The `multiply (a, b)` işlev. + +`a / b` – The `divide(a, b)` işlev. + +`a % b` – The `modulo(a, b)` işlev. + +## Toplama Ve çıkarma operatörleri {#addition-and-subtraction-operators} + +`a + b` – The `plus(a, b)` işlev. + +`a - b` – The `minus(a, b)` işlev. + +## Karşılaştırma Operatörleri {#comparison-operators} + +`a = b` – The `equals(a, b)` işlev. + +`a == b` – The `equals(a, b)` işlev. + +`a != b` – The `notEquals(a, b)` işlev. + +`a <> b` – The `notEquals(a, b)` işlev. + +`a <= b` – The `lessOrEquals(a, b)` işlev. + +`a >= b` – The `greaterOrEquals(a, b)` işlev. + +`a < b` – The `less(a, b)` işlev. + +`a > b` – The `greater(a, b)` işlev. + +`a LIKE s` – The `like(a, b)` işlev. + +`a NOT LIKE s` – The `notLike(a, b)` işlev. + +`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. + +`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. + +## Veri kümeleriyle çalışmak için operatörler {#operators-for-working-with-data-sets} + +*Görmek [Operatör İNLERDE](statements/select.md#select-in-operators).* + +`a IN ...` – The `in(a, b)` işlev. + +`a NOT IN ...` – The `notIn(a, b)` işlev. + +`a GLOBAL IN ...` – The `globalIn(a, b)` işlev. + +`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` işlev. + +## Tarih Ve Saatlerle çalışmak için operatörler {#operators-datetime} + +### EXTRACT {#operator-extract} + +``` sql +EXTRACT(part FROM date); +``` + +Belirli bir tarihten parçaları ayıklayın. Örneğin, belirli bir tarihten bir ay veya bir zamandan bir saniye alabilirsiniz. + +Bu `part` parametre almak için tarihin hangi bölümünü belirtir. Aşağıdaki değerler kullanılabilir: + +- `DAY` — The day of the month. Possible values: 1–31. +- `MONTH` — The number of a month. Possible values: 1–12. +- `YEAR` — The year. +- `SECOND` — The second. Possible values: 0–59. +- `MINUTE` — The minute. Possible values: 0–59. +- `HOUR` — The hour. Possible values: 0–23. + +Bu `part` parametre büyük / küçük harf duyarsızdır. + +Bu `date` parametre, işlenecek tarihi veya saati belirtir. Ya [Tarihli](../sql-reference/data-types/date.md) veya [DateTime](../sql-reference/data-types/datetime.md) türü desteklenir. + +Örnekler: + +``` sql +SELECT EXTRACT(DAY FROM toDate('2017-06-15')); +SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); +SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); +``` + +Aşağıdaki örnekte bir tablo oluşturuyoruz ve içine bir değer ekliyoruz `DateTime` tür. + +``` sql +CREATE TABLE test.Orders +( + OrderId UInt64, + OrderName String, + OrderDate DateTime +) +ENGINE = Log; +``` + +``` sql +INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); +``` + +``` sql +SELECT + toYear(OrderDate) AS OrderYear, + toMonth(OrderDate) AS OrderMonth, + toDayOfMonth(OrderDate) AS OrderDay, + toHour(OrderDate) AS OrderHour, + toMinute(OrderDate) AS OrderMinute, + toSecond(OrderDate) AS OrderSecond +FROM test.Orders; +``` + +``` text +┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ +│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ +└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ +``` + +Daha fazla örnek görebilirsiniz [testler](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). + +### INTERVAL {#operator-interval} + +Oluşturur bir [Aralıklı](../sql-reference/data-types/special-data-types/interval.md)- aritmetik işlemlerde kullanılması gereken tip değeri [Tarihli](../sql-reference/data-types/date.md) ve [DateTime](../sql-reference/data-types/datetime.md)- tip değerleri. + +Aralık türleri: +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +!!! warning "Uyarıcı" + Farklı tiplere sahip aralıklar birleştirilemez. Gibi ifadeler kullanamazsınız `INTERVAL 4 DAY 1 HOUR`. Aralıkların, örneğin aralığın en küçük birimine eşit veya daha küçük olan birimlerdeki aralıkları belirtin, `INTERVAL 25 HOUR`. Aşağıdaki örnekte olduğu gibi ardışık işlemleri kullanabilirsiniz. + +Örnek: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +**Ayrıca Bakınız** + +- [Aralıklı](../sql-reference/data-types/special-data-types/interval.md) veri türü +- [toİnterval](../sql-reference/functions/type-conversion-functions.md#function-tointerval) tip dönüştürme işlevleri + +## Mantıksal Olumsuzlama Operatörü {#logical-negation-operator} + +`NOT a` – The `not(a)` işlev. + +## Mantıksal Ve operatör {#logical-and-operator} + +`a AND b` – The`and(a, b)` işlev. + +## Mantıksal Veya operatör {#logical-or-operator} + +`a OR b` – The `or(a, b)` işlev. + +## Koşullu Operatör {#conditional-operator} + +`a ? b : c` – The `if(a, b, c)` işlev. + +Not: + +Koşullu işleç B ve c değerlerini hesaplar, ardından a koşulunun karşılanıp karşılanmadığını kontrol eder ve ardından karşılık gelen değeri döndürür. Eğer `b` veya `C` is an [arrayJoin()](../sql-reference/functions/array-join.md#functions_arrayjoin) işlev, her satır ne olursa olsun çoğaltılır “a” koşul. + +## Koşullu İfade {#operator_case} + +``` sql +CASE [x] + WHEN a THEN b + [WHEN ... THEN ...] + [ELSE c] +END +``` + +Eğer `x` belirtilen sonra `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. + +Eğer herhangi bir `ELSE c` ifadedeki yan tümce, varsayılan değer `NULL`. + +Bu `transform` fonksiyonu ile çalışmıyor `NULL`. + +## Birleştirme Operatörü {#concatenation-operator} + +`s1 || s2` – The `concat(s1, s2) function.` + +## Lambda Oluşturma Operatörü {#lambda-creation-operator} + +`x -> expr` – The `lambda(x, expr) function.` + +Parantez oldukları için aşağıdaki operatörler bir önceliğe sahip değildir: + +## Dizi Oluşturma Operatörü {#array-creation-operator} + +`[x1, ...]` – The `array(x1, ...) function.` + +## Tuple Oluşturma Operatörü {#tuple-creation-operator} + +`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` + +## İlişkisellik {#associativity} + +Tüm ikili operatörler ilişkisellikten ayrıldı. Mesela, `1 + 2 + 3` dönüştür toülür `plus(plus(1, 2), 3)`. +Bazen bu beklediğiniz gibi çalışmaz. Mesela, `SELECT 4 > 2 > 3` 0 ile sonuç willlanır. + +Verimlilik için, `and` ve `or` işlevler herhangi bir sayıda bağımsız değişkeni kabul eder. İlgili zincirler `AND` ve `OR` operatörler bu işlevlerin tek bir çağrısına dönüştürülür. + +## İçin Kontrol `NULL` {#checking-for-null} + +ClickHouse destekler `IS NULL` ve `IS NOT NULL` operatörler. + +### IS NULL {#operator-is-null} + +- İçin [Nullable](../sql-reference/data-types/nullable.md) türü değerleri `IS NULL` operatör döner: + - `1` değeri ise `NULL`. + - `0` başka. +- Diğer değerler için, `IS NULL` operatör her zaman döner `0`. + + + +``` sql +SELECT x+100 FROM t_null WHERE y IS NULL +``` + +``` text +┌─plus(x, 100)─┐ +│ 101 │ +└──────────────┘ +``` + +### IS NOT NULL {#is-not-null} + +- İçin [Nullable](../sql-reference/data-types/nullable.md) türü değerleri `IS NOT NULL` operatör döner: + - `0` değeri ise `NULL`. + - `1` başka. +- Diğer değerler için, `IS NOT NULL` operatör her zaman döner `1`. + + + +``` sql +SELECT * FROM t_null WHERE y IS NOT NULL +``` + +``` text +┌─x─┬─y─┐ +│ 2 │ 3 │ +└───┴───┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/tr/sql-reference/statements/alter.md b/docs/tr/sql-reference/statements/alter.md new file mode 100644 index 00000000000..e95c1d133bf --- /dev/null +++ b/docs/tr/sql-reference/statements/alter.md @@ -0,0 +1,504 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 36 +toc_title: ALTER +--- + +## ALTER {#query_language_queries_alter} + +Bu `ALTER` sorgu yalnızca için desteklenir `*MergeTree` tablo gibi `Merge`ve`Distributed`. Sorgunun çeşitli varyasyonları vardır. + +### Sütun Manipülasyonları {#column-manipulations} + +Tablo yapısını değiştirme. + +``` sql +ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... +``` + +Sorguda, bir veya daha fazla virgülle ayrılmış eylemlerin bir listesini belirtin. +Her eylem bir sütun üzerinde bir işlemdir. + +Aşağıdaki eylemler desteklenir: + +- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. +- [DROP COLUMN](#alter_drop-column) — Deletes the column. +- [CLEAR COLUMN](#alter_clear-column) — Resets column values. +- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. +- [MODIFY COLUMN](#alter_modify-column) — Changes column’s type, default expression and TTL. + +Bu eylemler aşağıda ayrıntılı olarak açıklanmıştır. + +#### ADD COLUMN {#alter_add-column} + +``` sql +ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] +``` + +Belirtilen tabloya yeni bir sütun ekler `name`, `type`, [`codec`](create.md#codecs) ve `default_expr` (bkz [Varsayılan ifadeler](create.md#create-default-values)). + +Eğer… `IF NOT EXISTS` yan tümcesi dahil, sütun zaten varsa sorgu bir hata döndürmez. Belirtir specifyseniz `AFTER name_after` (başka bir sütunun adı), sütun tablo sütunları listesinde belirtilen sonra eklenir. Aksi takdirde, sütun tablonun sonuna eklenir. Bir tablonun başına bir sütun eklemek için bir yol olduğunu unutmayın. Bir eylem zinciri için, `name_after` önceki eylemlerden birine eklenen bir sütunun adı olabilir. + +Bir sütun eklemek, verilerle herhangi bir işlem yapmadan tablo yapısını değiştirir. Sonra veriler diskte görünmüyor `ALTER`. Tablodan okurken bir sütun için veri eksikse, varsayılan değerlerle doldurulur (varsa, varsayılan ifadeyi gerçekleştirerek veya sıfır veya boş dizeler kullanarak). Sütun, veri parçalarını birleştirdikten sonra diskte görünür (bkz. [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)). + +Bu yaklaşım bize tamamlamak için izin verir `ALTER` eski verilerin hacmini arttırmadan anında sorgulayın. + +Örnek: + +``` sql +ALTER TABLE visits ADD COLUMN browser String AFTER user_id +``` + +#### DROP COLUMN {#alter_drop-column} + +``` sql +DROP COLUMN [IF EXISTS] name +``` + +Sütun adı ile siler `name`. Eğer… `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. + +Dosya sisteminden veri siler. Bu, tüm dosyaları sildiğinden, sorgu neredeyse anında tamamlanır. + +Örnek: + +``` sql +ALTER TABLE visits DROP COLUMN browser +``` + +#### CLEAR COLUMN {#alter_clear-column} + +``` sql +CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name +``` + +Belirtilen bölüm için bir sütundaki tüm verileri sıfırlar. Bölümdeki bölüm adını ayarlama hakkında daha fazla bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). + +Eğer… `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. + +Örnek: + +``` sql +ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() +``` + +#### COMMENT COLUMN {#alter_comment-column} + +``` sql +COMMENT COLUMN [IF EXISTS] name 'comment' +``` + +Sütuna bir yorum ekler. Eğer… `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. + +Her sütunun bir yorumu olabilir. Sütun için bir yorum zaten varsa, yeni bir yorum önceki yorumun üzerine yazar. + +Yorumlar saklanır `comment_expression` tarafından döndürülen sütun [DESCRIBE TABLE](misc.md#misc-describe-table) sorgu. + +Örnek: + +``` sql +ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' +``` + +#### MODIFY COLUMN {#alter_modify-column} + +``` sql +MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] +``` + +Bu sorgu değişiklikleri `name` sütun özellikleri: + +- Tür + +- Varsayılan ifade + +- TTL + + For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). + +Eğer… `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. + +Türü değiştirirken, değerler sanki [toType](../../sql-reference/functions/type-conversion-functions.md) fonksiyonlar onlara uygulandı. Yalnızca varsayılan ifade değiştirilirse, sorgu karmaşık bir şey yapmaz ve neredeyse anında tamamlanır. + +Örnek: + +``` sql +ALTER TABLE visits MODIFY COLUMN browser Array(String) +``` + +Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. + +Birkaç işlem aşaması vardır: + +- Geçici (yeni) dosyaları değiştirilmiş verilerle hazırlama. +- Eski dosyaları yeniden adlandırma. +- Geçici (yeni) dosyaları eski adlara yeniden adlandırma. +- Eski dosyaları silme. + +Sadece ilk aşama zaman alır. Bu aşamada bir hata varsa, veriler değişmez. +Ardışık aşamalardan biri sırasında bir hata varsa, veriler el ile geri yüklenebilir. Eski dosyalar dosya sisteminden silindi, ancak yeni dosyaların verileri diske yazılmadı ve kaybolduysa istisnadır. + +Bu `ALTER` sütunları değiştirmek için sorgu çoğaltılır. Talimatlar ZooKeeper kaydedilir, daha sonra her kopya bunları uygular. Tüm `ALTER` sorgular aynı sırada çalıştırılır. Sorgu, diğer yinelemeler üzerinde tamamlanması uygun eylemleri bekler. Ancak, yinelenen bir tablodaki sütunları değiştirmek için bir sorgu kesilebilir ve tüm eylemler zaman uyumsuz olarak gerçekleştirilir. + +#### Sorgu sınırlamalarını değiştir {#alter-query-limitations} + +Bu `ALTER` sorgu oluşturmak ve iç içe veri yapıları, ancak tüm iç içe veri yapıları ayrı öğeleri (sütunlar) silmenizi sağlar. İç içe geçmiş bir veri yapısı eklemek için, aşağıdaki gibi bir ada sahip sütunlar ekleyebilirsiniz `name.nested_name` ve türü `Array(T)`. İç içe geçmiş bir veri yapısı, noktadan önce aynı öneki olan bir ada sahip birden çok dizi sütununa eşdeğerdir. + +Birincil anahtardaki veya örnekleme anahtarındaki sütunları silmek için destek yoktur. `ENGINE` ifade). Birincil anahtarda bulunan sütunların türünü değiştirmek, yalnızca bu değişiklik verilerin değiştirilmesine neden olmazsa mümkündür (örneğin, bir numaraya değer eklemenize veya bir türden değiştirmenize izin verilir `DateTime` -e doğru `UInt32`). + +Eğer… `ALTER` sorgu, ihtiyacınız olan tablo değişikliklerini yapmak için yeterli değildir, yeni bir tablo oluşturabilir, verileri kullanarak kopyalayabilirsiniz. [INSERT SELECT](insert-into.md#insert_query_insert-select) sorgu, daha sonra tabloları kullanarak geçiş [RENAME](misc.md#misc_operations-rename) sorgu ve eski tabloyu silin. Kullanabilirsiniz [clickhouse-fotokopi makinesi](../../operations/utilities/clickhouse-copier.md) bir alternatif olarak `INSERT SELECT` sorgu. + +Bu `ALTER` sorgu tüm okur ve tablo için yazar engeller. Başka bir deyişle, Eğer uzun `SELECT` zamanda çalışıyor `ALTER` sorgu `ALTER` sorgu tamamlanmasını bekleyecektir. Aynı zamanda, aynı tablodaki tüm yeni sorgular bu sırada bekleyecektir `ALTER` çalışıyor. + +Verileri kendileri saklamayan tablolar için (örneğin `Merge` ve `Distributed`), `ALTER` sadece tablo yapısını değiştirir ve alt tabloların yapısını değiştirmez. Örneğin, ALTER for a çalıştırırken `Distributed` tablo, ayrıca çalıştırmak gerekir `ALTER` tüm uzak sunuculardaki tablolar için. + +### Anahtar İfadelerle Manipülasyonlar {#manipulations-with-key-expressions} + +Aşağıdaki komut desteklenir: + +``` sql +MODIFY ORDER BY new_expression +``` + +Sadece tablolar için çalışır [`MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) aile (dahil +[çoğaltıyordu](../../engines/table-engines/mergetree-family/replication.md) Tablolar). Komutu değiştirir +[sıralama anahtarı](../../engines/table-engines/mergetree-family/mergetree.md) tablonun +-e doğru `new_expression` (bir ifade veya ifadelerin bir tuple). Birincil anahtar aynı kalır. + +Komut, yalnızca meta verileri değiştirdiği bir anlamda hafiftir. Veri parçası özelliği tutmak için +satırlar sıralama anahtarı ifadesi tarafından sıralanır varolan sütunları içeren ifadeler ekleyemezsiniz +sıralama anahtarına (yalnızca sütun tarafından eklenen `ADD COLUMN` aynı komut `ALTER` sorgu). + +### Veri Atlama Endeksleri İle Manipülasyonlar {#manipulations-with-data-skipping-indices} + +Sadece tablolar için çalışır [`*MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) aile (dahil +[çoğaltıyordu](../../engines/table-engines/mergetree-family/replication.md) Tablolar). Aşağıdaki işlemler +mevcuttur: + +- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - Tablolar meta dizin açıklama ekler. + +- `ALTER TABLE [db].name DROP INDEX name` - Tablolar meta dizin açıklama kaldırır ve diskten dizin dosyalarını siler. + +Bu komutlar, yalnızca meta verileri değiştirdikleri veya dosyaları kaldırdıkları bir anlamda hafiftir. +Ayrıca, çoğaltılırlar (ZooKeeper aracılığıyla indeks meta verilerini senkronize etme). + +### Kısıtlamalar İle Manipülasyonlar {#manipulations-with-constraints} + +Daha fazla görmek [kısıtlamalar](create.md#constraints) + +Kısıtlamalar eklenebilir veya aşağıdaki sözdizimi kullanılarak silinebilir: + +``` sql +ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; +ALTER TABLE [db].name DROP CONSTRAINT constraint_name; +``` + +Sorgular eklemek veya hemen işlenir, böylece tablodan kısıtlamaları hakkında meta verileri kaldırın. + +Kısıtlama kontrolü *idam edilm willeyecek* eklen .mişse mevcut ver .ilerde + +Çoğaltılmış tablolardaki tüm değişiklikler Zookeeper’a yayınlanır, bu nedenle diğer kopyalara uygulanır. + +### Bölümler Ve parçalar Ile manipülasyonlar {#alter_manipulations-with-partitions} + +Aşağıdaki işlemler ile [bölümler](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) mevcuttur: + +- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` dizin ve unutun. +- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. +- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` tabloya dizin. +- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. +- [REPLACE PARTITION](#alter_replace-partition) - Veri bölümünü bir tablodan diğerine kopyalar ve değiştirir. +- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - veri bölümünü bir tablodan diğerine taşıyın. +- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - Bir bölümdeki belirtilen sütunun değerini sıfırlar. +- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - Bir bölümde belirtilen ikincil dizini sıfırlar. +- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. +- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. +- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. + + + +#### Bölüm ayırmak {\#alter\_detach-bölüm} {#detach-partition-alter-detach-partition} + +``` sql +ALTER TABLE table_name DETACH PARTITION partition_expr +``` + +Belirtilen bölüm için tüm verileri `detached` dizin. Sunucu, yok gibi ayrılmış veri Bölümü hakkında unutur. Sunucu, bu verileri siz yapana kadar bilmeyecektir. [ATTACH](#alter_attach-partition) sorgu. + +Örnek: + +``` sql +ALTER TABLE visits DETACH PARTITION 201901 +``` + +Bir bölümdeki bölüm ifadesini ayarlama hakkında bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). + +Sorgu yürütüldükten sonra, veri ile istediğiniz her şeyi yapabilirsiniz `detached` directory — delete it from the file system, or just leave it. + +This query is replicated – it moves the data to the `detached` tüm kopyalarda dizin. Bu sorguyu yalnızca bir lider yinelemesinde yürütebileceğinizi unutmayın. Bir kopya bir lider olup olmadığını öğrenmek için `SELECT` sorgu için [sistem.yinelemeler](../../operations/system-tables.md#system_tables-replicas) Tablo. Alternatif olarak, bir yapmak daha kolaydır `DETACH` tüm yinelemelerde sorgu - tüm yinelemeler, lider yinelemesi dışında bir özel durum oluşturur. + +#### DROP PARTITION {#alter_drop-partition} + +``` sql +ALTER TABLE table_name DROP PARTITION partition_expr +``` + +Belirtilen bölümü tablodan siler. Bu sorgu bölümü etkin olarak etiketler ve verileri tamamen yaklaşık 10 dakika içinde siler. + +Bir bölümdeki bölüm ifadesini ayarlama hakkında bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). + +The query is replicated – it deletes data on all replicas. + +#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} + +``` sql +ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr +``` + +Belirtilen bölümü veya belirtilen bölümün tüm bölümlerini kaldırır `detached`. +Bir bölümdeki bölüm ifadesini ayarlama hakkında daha fazla bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). + +#### ATTACH PARTITION\|PART {#alter_attach-partition} + +``` sql +ALTER TABLE table_name ATTACH PARTITION|PART partition_expr +``` + +Tablodan veri ekler `detached` dizin. Tüm bir bölüm veya ayrı bir bölüm için veri eklemek mümkündür. Örnekler: + +``` sql +ALTER TABLE visits ATTACH PARTITION 201901; +ALTER TABLE visits ATTACH PART 201901_2_2_0; +``` + +Bir bölümdeki bölüm ifadesini ayarlama hakkında daha fazla bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). + +Bu sorgu çoğaltılır. Çoğaltma başlatıcısı, veri olup olmadığını denetler. `detached` dizin. Veri varsa, sorgu bütünlüğünü denetler. Her şey doğruysa, sorgu verileri tabloya ekler. Diğer tüm yinelemeler, çoğaltma başlatıcısından verileri karşıdan yükleyin. + +Böylece veri koyabilirsiniz `detached` bir kopya üzerinde dizin ve `ALTER ... ATTACH` tüm yinelemelerde tabloya eklemek için sorgu. + +#### ATTACH PARTITION FROM {#alter_attach-partition-from} + +``` sql +ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 +``` + +Bu sorgu, veri bölümünü `table1` -e doğru `table2` exsisting için veri ekler `table2`. Verilerin silinmeyeceğini unutmayın `table1`. + +Sorgunun başarıyla çalışması için aşağıdaki koşulların karşılanması gerekir: + +- Her iki tablo da aynı yapıya sahip olmalıdır. +- Her iki tablo da aynı bölüm anahtarına sahip olmalıdır. + +#### REPLACE PARTITION {#alter_replace-partition} + +``` sql +ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 +``` + +Bu sorgu, veri bölümünü `table1` -e doğru `table2` ve mevcut bölümün yerini alır `table2`. Verilerin silinmeyeceğini unutmayın `table1`. + +Sorgunun başarıyla çalışması için aşağıdaki koşulların karşılanması gerekir: + +- Her iki tablo da aynı yapıya sahip olmalıdır. +- Her iki tablo da aynı bölüm anahtarına sahip olmalıdır. + +#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} + +``` sql +ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest +``` + +Bu sorgu, veri bölümünü `table_source` -e doğru `table_dest` verileri silme ile `table_source`. + +Sorgunun başarıyla çalışması için aşağıdaki koşulların karşılanması gerekir: + +- Her iki tablo da aynı yapıya sahip olmalıdır. +- Her iki tablo da aynı bölüm anahtarına sahip olmalıdır. +- Her iki tablo da aynı motor ailesi olmalıdır. (çoğaltılmış veya çoğaltılmamış) +- Her iki tablo da aynı depolama ilkesine sahip olmalıdır. + +#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} + +``` sql +ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr +``` + +Bir bölümdeki belirtilen sütundaki tüm değerleri sıfırlar. Eğer… `DEFAULT` bir tablo oluştururken yan tümcesi belirlendi, bu sorgu sütun değerini belirtilen varsayılan değere ayarlar. + +Örnek: + +``` sql +ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 +``` + +#### FREEZE PARTITION {#alter_freeze-partition} + +``` sql +ALTER TABLE table_name FREEZE [PARTITION partition_expr] +``` + +Bu sorgu, belirtilen bir bölümün yerel yedeğini oluşturur. Eğer… `PARTITION` yan tümcesi atlandı, sorgu aynı anda tüm bölümlerin yedeğini oluşturur. + +!!! note "Not" + Tüm yedekleme işlemi sunucuyu durdurmadan gerçekleştirilir. + +Eski tarz tablolar için bölüm adının önekini belirtebileceğinizi unutmayın (örneğin, ‘2019’)- daha sonra sorgu tüm ilgili bölümler için yedek oluşturur. Bir bölümdeki bölüm ifadesini ayarlama hakkında bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). + +Yürütme sırasında, bir veri anlık görüntüsü için sorgu, bir tablo verilerine sabit bağlantılar oluşturur. Hardlinks dizine yerleştirilir `/var/lib/clickhouse/shadow/N/...`, nere: + +- `/var/lib/clickhouse/` yapılandırmada belirtilen çalışma ClickHouse dizinidir. +- `N` yedeklemenin artımlı sayısıdır. + +!!! note "Not" + Kullanıyorsanız [bir tablodaki veri depolama için disk kümesi](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes), bu `shadow/N` dizin tarafından eşleşen veri parçalarını depolamak, her diskte görünür `PARTITION` ifade. + +Dizinlerin aynı yapısı, içinde olduğu gibi yedek içinde oluşturulur `/var/lib/clickhouse/`. Sorgu gerçekleştirir ‘chmod’ tüm dosyalar için, onlara yazmayı yasaklamak. + +Yedeklemeyi oluşturduktan sonra, verileri `/var/lib/clickhouse/shadow/` uzak sunucuya ve sonra yerel sunucudan silin. Not `ALTER t FREEZE PARTITION` sorgu çoğaltılmaz. Yalnızca yerel sunucuda yerel bir yedekleme oluşturur. + +Sorgu neredeyse anında yedekleme oluşturur (ancak önce geçerli sorguları ilgili tabloya çalışmayı bitirmek için bekler). + +`ALTER TABLE t FREEZE PARTITION` tablo meta verilerini değil, yalnızca verileri kopyalar. Tablo meta verilerinin yedeğini almak için dosyayı kopyalayın `/var/lib/clickhouse/metadata/database/table.sql` + +Bir yedekten veri geri yüklemek için aşağıdakileri yapın: + +1. Yoksa tablo oluşturun. Sorguyu görüntülemek için kullanın .sql dosyası (değiştir `ATTACH` içinde ile `CREATE`). +2. Veri kopyalama `data/database/table/` yedekleme içindeki dizin `/var/lib/clickhouse/data/database/table/detached/` dizin. +3. Koşmak `ALTER TABLE t ATTACH PARTITION` verileri bir tabloya eklemek için sorgular. + +Yedeklemeden geri yükleme, sunucuyu durdurmayı gerektirmez. + +Yedekleme ve geri yükleme verileri hakkında daha fazla bilgi için bkz: [Veri Yedekleme](../../operations/backup.md) bölme. + +#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} + +``` sql +ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr +``` + +Sorgu benzer çalışır `CLEAR COLUMN`, ancak bir sütun verileri yerine bir dizini sıfırlar. + +#### FETCH PARTITION {#alter_fetch-partition} + +``` sql +ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' +``` + +Başka bir sunucudan bir bölüm indirir. Bu sorgu yalnızca çoğaltılmış tablolar için çalışır. + +Sorgu aşağıdakileri yapar: + +1. Bölümü belirtilen parçadan indirir. İçinde ‘path-in-zookeeper’ zookeeper içinde shard için bir yol belirtmeniz gerekir. +2. Sonra sorgu indirilen verileri `detached` directory of the `table_name` Tablo. Kullan… [ATTACH PARTITION\|PART](#alter_attach-partition) tabloya veri eklemek için sorgu. + +Mesela: + +``` sql +ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; +ALTER TABLE users ATTACH PARTITION 201902; +``` + +Not thate that: + +- Bu `ALTER ... FETCH PARTITION` sorgu çoğaltılmaz. Bu bölüm için yerleştirir `detached` yalnızca yerel sunucuda dizin. +- Bu `ALTER TABLE ... ATTACH` sorgu çoğaltılır. Verileri tüm yinelemelere ekler. Veriler, kopyalardan birine eklenir. `detached` dizin ve diğerlerine - komşu kopyalardan. + +İndirmeden önce, sistem bölümün olup olmadığını ve tablo yapısının eşleşip eşleşmediğini kontrol eder. En uygun yineleme, sağlıklı yinelemeler otomatik olarak seçilir. + +Sorgu çağrılsa da `ALTER TABLE`, tablo yapısını değiştirmez ve tabloda bulunan verileri hemen değiştirmez. + +#### MOVE PARTITION\|PART {#alter_move-partition} + +Bölümleri veya veri parçalarını başka bir birime veya diske taşır. `MergeTree`- motor masaları. Görmek [Veri depolama için birden fazla blok cihazı kullanma](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes). + +``` sql +ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' +``` + +Bu `ALTER TABLE t MOVE` sorgu: + +- Çoğaltılamaz, çünkü farklı çoğaltmalar farklı depolama ilkelerine sahip olabilir. +- Belirtilen disk veya birim yapılandırılmamışsa bir hata döndürür. Depolama ilkesinde belirtilen veri taşıma koşulları uygulanamazsa, sorgu da bir hata döndürür. +- Durumda bir hata döndürebilir, taşınacak veriler zaten bir arka plan işlemi tarafından taşındığında, eşzamanlı `ALTER TABLE t MOVE` sorgu veya arka plan veri birleştirme sonucu. Bir kullanıcı bu durumda herhangi bir ek eylem gerçekleştirmemelidir. + +Örnek: + +``` sql +ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' +ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' +``` + +#### Bölüm İfadesi Nasıl Ayarlanır {#alter-how-to-specify-part-expr} + +Bölüm ifadesini şu şekilde belirtebilirsiniz `ALTER ... PARTITION` farklı şekillerde sorgular: + +- Bu gibi bir değer `partition` sütun `system.parts` Tablo. Mesela, `ALTER TABLE visits DETACH PARTITION 201901`. +- Tablo sütunundan ifade olarak. Sabitler ve sabit ifadeler desteklenir. Mesela, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. +- Bölüm kimliğini kullanma. Partition ID, dosya sistemindeki ve Zookeeper’daki bölümlerin adları olarak kullanılan bölümün (mümkünse insan tarafından okunabilir) bir dize tanımlayıcısıdır. Bölüm kimliği belirtilmelidir `PARTITION ID` fık .ra, tek tırnak içinde. Mesela, `ALTER TABLE visits DETACH PARTITION ID '201901'`. +- İn the [ALTER ATTACH PART](#alter_attach-partition) ve [DROP DETACHED PART](#alter_drop-detached) sorgu, bir parçanın adını belirtmek için, bir değer ile dize literal kullanın `name` sütun [sistem.detached\_parts](../../operations/system-tables.md#system_tables-detached_parts) Tablo. Mesela, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. + +Bölüm belirtilirken tırnak kullanımı bölüm ifadesi türüne bağlıdır. Örneğin, için `String` yazın, adını tırnak içinde belirtmeniz gerekir (`'`). İçin `Date` ve `Int*` türleri hiçbir tırnak gereklidir. + +Eski stil tablolar için, bölümü bir sayı olarak belirtebilirsiniz `201901` veya bir dize `'201901'`. Yeni stil tabloları için sözdizimi türleri ile daha sıkı (değerleri giriş biçimi için ayrıştırıcı benzer). + +Yukarıdaki tüm kurallar için de geçerlidir [OPTIMIZE](misc.md#misc_operations-optimize) sorgu. Bölümlenmemiş bir tabloyu en iyi duruma getirirken tek bölümü belirtmeniz gerekiyorsa, ifadeyi ayarlayın `PARTITION tuple()`. Mesela: + +``` sql +OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; +``` + +Örnekleri `ALTER ... PARTITION` sorgular testlerde gösterilmiştir [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) ve [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). + +### Tablo TTL Ile manipülasyonlar {#manipulations-with-table-ttl} + +Değiştirebilirsiniz [tablo TTL](../../engines/table-engines/mergetree-family/mergetree.md#mergetree-table-ttl) aşağıdaki formun bir isteği ile: + +``` sql +ALTER TABLE table-name MODIFY TTL ttl-expression +``` + +### Alter sorgularının eşzamanlılığı {#synchronicity-of-alter-queries} + +Replicatable olmayan tablolar için, tüm `ALTER` sorgular eşzamanlı olarak gerçekleştirilir. Replicatable tablolar için, sorgu yalnızca uygun eylemler için yönergeler ekler `ZooKeeper` ve eylemlerin kendileri mümkün olan en kısa sürede gerçekleştirilir. Ancak, sorgu tüm yinelemeler üzerinde tamamlanması için bu eylemleri bekleyebilir. + +İçin `ALTER ... ATTACH|DETACH|DROP` sorgular, kullanabilirsiniz `replication_alter_partitions_sync` bekleyen kurmak için ayarlama. +Olası değerler: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. + +### Mutasyonlar {#alter-mutations} + +Mutasyonlar, bir tablodaki satırların değiştirilmesine veya silinmesine izin veren bir alter query varyantıdır. Standart aksine `UPDATE` ve `DELETE` nokta veri değişikliklerine yönelik sorgular, mutasyonlar, bir tablodaki çok sayıda satırı değiştiren ağır işlemler için tasarlanmıştır. İçin desteklenen `MergeTree` çoğaltma desteği olan motorlar da dahil olmak üzere tablo motorları ailesi. + +Varolan tablolar olduğu gibi mutasyonlar için hazırdır(dönüştürme gerekmez), ancak ilk mutasyon bir tabloya uygulandıktan sonra Meta Veri formatı önceki sunucu sürümleriyle uyumsuz hale gelir ve önceki bir sürüme geri dönmek imkansız hale gelir. + +Şu anda mevcut komutlar: + +``` sql +ALTER TABLE [db.]table DELETE WHERE filter_expr +``` + +Bu `filter_expr` tip olmalıdır `UInt8`. Sorgu, bu ifadenin sıfır olmayan bir değer aldığı tablodaki satırları siler. + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr +``` + +Bu `filter_expr` tip olmalıdır `UInt8`. Bu sorgu, belirtilen sütunların değerlerini, satırlardaki karşılık gelen ifadelerin değerlerine güncelleştirir. `filter_expr` sıfır olmayan bir değer alır. Değerleri kullanarak sütun türüne döküm `CAST` operatör. Birincil veya bölüm anahtarının hesaplanmasında kullanılan sütunları güncelleştirme desteklenmiyor. + +``` sql +ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name +``` + +Sorgu ikincil dizini yeniden oluşturur `name` bölümünde `partition_name`. + +Bir sorgu virgülle ayrılmış birkaç komut içerebilir. + +\* MergeTree tabloları mutasyonları için tüm veri parçalarını yeniden yazarak yürütün. Atomiklik yoktur-parçalar, hazır oldukları anda mutasyona uğramış parçalar için ikame edilir ve bir `SELECT` bir mutasyon sırasında yürütülmeye başlayan sorgu, henüz mutasyona uğramamış olan parçalardan gelen verilerle birlikte mutasyona uğramış olan parçalardan gelen verileri görecektir. + +Mutasyonlar tamamen yaratılış sırasına göre sıralanır ve her bir parçaya bu sırayla uygulanır. Mutasyonlar da kısmen ekler ile sıralanır-mutasyon gönderilmeden önce tabloya eklenen veriler mutasyona uğrayacak ve bundan sonra eklenen veriler mutasyona uğramayacaktır. Mutasyonların ekleri hiçbir şekilde engellemediğini unutmayın. + +Mutasyon girişi eklendikten hemen sonra bir mutasyon sorgusu döner(çoğaltılmış tablolar Zookeeper’a, çoğaltılmamış tablolar için-dosya sistemine). Mutasyonun kendisi sistem profili ayarlarını kullanarak eşzamansız olarak yürütür. Mutasyonların ilerlemesini izlemek için kullanabilirsiniz [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) Tablo. Başarıyla gönderilen BIR mutasyon, ClickHouse sunucuları yeniden başlatılmış olsa bile yürütmeye devam edecektir. Gönderildikten sonra mutasyonu geri almanın bir yolu yoktur, ancak mutasyon herhangi bir nedenle sıkışmışsa, [`KILL MUTATION`](misc.md#kill-mutation) sorgu. + +Bitmiş mutasyonlar için girişler hemen silinmez (korunmuş girişlerin sayısı, `finished_mutations_to_keep` depolama motoru parametresi). Eski mutasyon girişleri silinir. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/tr/sql-reference/statements/create.md b/docs/tr/sql-reference/statements/create.md new file mode 100644 index 00000000000..1ac88b1dfc2 --- /dev/null +++ b/docs/tr/sql-reference/statements/create.md @@ -0,0 +1,305 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 35 +toc_title: CREATE +--- + +# Sorgu oluştur {#create-queries} + +## CREATE DATABASE {#query-language-create-database} + +Veritabanı oluşturur. + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] +``` + +### Yanlar {#clauses} + +- `IF NOT EXISTS` + Eğer… `db_name` veritabanı zaten var, daha sonra ClickHouse yeni bir veritabanı oluşturmuyor ve: + + - If yan tümcesi belirtilmişse bir istisna atmaz. + - Bir istisna atar if yan tümcesi belirtilmemiş. + +- `ON CLUSTER` + ClickHouse oluşturur `db_name` belirtilen bir kümenin tüm sunucularında veritabanı. + +- `ENGINE` + + - [MySQL](../../engines/database-engines/mysql.md) + Uzak MySQL sunucusundan veri almanızı sağlar. + Varsayılan olarak, ClickHouse kendi kullanır [Veritabanı Altyapısı](../../engines/database-engines/index.md). + +## CREATE TABLE {#create-table-query} + +Bu `CREATE TABLE` sorgu çeşitli formlara sahip olabilir. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], + ... +) ENGINE = engine +``` + +Adlı bir tablo oluşturur ‘name’ in the ‘db’ veritabanı veya geçerli veritabanı ise ‘db’ küme değil, parantez içinde belirtilen yapı ve ‘engine’ motor. +Tablonun yapısı sütun açıklamalarının bir listesidir. Dizinler altyapısı tarafından destekleniyorsa, tablo altyapısı için parametreler olarak gösterilir. + +Bir sütun açıklaması `name type` en basit durumda. Örnek: `RegionID UInt32`. +İfadeler varsayılan değerler için de tanımlanabilir (aşağıya bakın). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] +``` + +Başka bir tablo ile aynı yapıya sahip bir tablo oluşturur. Tablo için farklı bir motor belirtebilirsiniz. Motor belirtilmemişse, aynı motor için olduğu gibi kullanılacaktır `db2.name2` Tablo. + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() +``` + +Yapısı ve veri tarafından döndürülen bir tablo oluşturur. [tablo fonksiyonu](../table-functions/index.md). + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... +``` + +Sonucu gibi bir yapıya sahip bir tablo oluşturur `SELECT` Sorgu, ile ‘engine’ motor ve SELECT verilerle doldurur. + +Her durumda, eğer `IF NOT EXISTS` tablo zaten varsa, sorgu bir hata döndürmez. Bu durumda, sorgu hiçbir şey yapmaz. + +Sonra başka maddeler olabilir `ENGINE` sorguda yan tümcesi. Açıklamalarda tabloların nasıl oluşturulacağına ilişkin ayrıntılı belgelere bakın [masa motorları](../../engines/table-engines/index.md#table_engines). + +### Varsayılan Değerler {#create-default-values} + +Sütun açıklaması, aşağıdaki yollardan biriyle varsayılan değer için bir ifade belirtebilir:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. +Örnek: `URLDomain String DEFAULT domain(URL)`. + +Varsayılan değer için bir ifade tanımlanmamışsa, varsayılan değerler sayılar için sıfırlar, dizeler için boş dizeler, diziler için boş diziler ve `0000-00-00` tarihler için veya `0000-00-00 00:00:00` zamanla tarihler için. Boş alanlar desteklenmez. + +Varsayılan ifade tanımlanmışsa, sütun türü isteğe bağlıdır. Açıkça tanımlanmış bir tür yoksa, varsayılan ifade türü kullanılır. Örnek: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ türü için kullanılacak ‘EventDate’ sütun. + +Veri türü ve varsayılan ifade açıkça tanımlanırsa, bu ifade type casting işlevleri kullanılarak belirtilen türe aktarılır. Örnek: `Hits UInt32 DEFAULT 0` aynı şeyi ifade eder `Hits UInt32 DEFAULT toUInt32(0)`. + +Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don’t contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. + +`DEFAULT expr` + +Normal varsayılan değer. INSERT sorgusu karşılık gelen sütunu belirtmezse, ilgili ifadeyi hesaplayarak doldurulur. + +`MATERIALIZED expr` + +Somut ifade. Böyle bir sütun INSERT için belirtilemez, çünkü her zaman hesaplanır. +Sütun listesi olmayan bir ekleme için bu sütunlar dikkate alınmaz. +Buna ek olarak, bir SELECT sorgusunda Yıldız İşareti kullanıldığında bu sütun değiştirilmez. Bu, dökümü kullanarak elde edilen değişmezi korumaktır `SELECT *` sütun listesini belirtmeden INSERT kullanarak tabloya geri eklenebilir. + +`ALIAS expr` + +Eşanlamlı sözcük. Böyle bir sütun tabloda hiç depolanmaz. +Değerleri bir tabloya eklenemez ve bir SELECT sorgusunda Yıldız İşareti kullanılırken değiştirilmez. +Sorgu ayrıştırma sırasında diğer ad genişletilirse, seçimlerde kullanılabilir. + +Yeni sütunlar eklemek için ALTER sorgusunu kullanırken, bu sütunlar için eski veriler yazılmaz. Bunun yerine, yeni sütunlar için değerleri olmayan eski verileri okurken, ifadeler varsayılan olarak anında hesaplanır. Ancak, ifadeleri çalıştırmak sorguda belirtilmeyen farklı sütunlar gerektiriyorsa, bu sütunlar ayrıca okunur, ancak yalnızca buna ihtiyaç duyan veri blokları için okunur. + +Bir tabloya yeni bir sütun eklerseniz, ancak daha sonra varsayılan ifadesini değiştirirseniz, eski veriler için kullanılan değerler değişir (değerlerin diskte depolanmadığı veriler için). Arka plan birleştirmeleri çalıştırırken, birleştirme parçalarından birinde eksik olan sütunların verileri birleştirilmiş parçaya yazıldığını unutmayın. + +İç içe geçmiş veri yapılarındaki öğeler için varsayılan değerleri ayarlamak mümkün değildir. + +### Kısıtlamalar {#constraints} + +Sütun açıklamaları kısıtlamaları ile birlikte tanımlanabilir: + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + ... + CONSTRAINT constraint_name_1 CHECK boolean_expr_1, + ... +) ENGINE = engine +``` + +`boolean_expr_1` herhangi bir Boole ifadesi ile olabilir. Tablo için kısıtlamalar tanımlanırsa, her biri her satır için kontrol edilir `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. + +Büyük miktarda kısıtlama eklemek, büyük `INSERT` sorgular. + +### TTL Ifadesi {#ttl-expression} + +Değerler için depolama süresini tanımlar. Sadece MergeTree-family tabloları için belirtilebilir. Ayrıntılı açıklama için, bkz. [Sütunlar ve tablolar için TTL](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). + +### Sütun Sıkıştırma Kodekleri {#codecs} + +Varsayılan olarak, ClickHouse `lz4` sıkıştırma yöntemi. İçin `MergeTree`- motor ailesi varsayılan sıkıştırma yöntemini değiştirebilirsiniz [sıkıştırma](../../operations/server-configuration-parameters/settings.md#server-settings-compression) bir sunucu yapılandırması bölümü. Her bir sütun için sıkıştırma yöntemini de tanımlayabilirsiniz. `CREATE TABLE` sorgu. + +``` sql +CREATE TABLE codec_example +( + dt Date CODEC(ZSTD), + ts DateTime CODEC(LZ4HC), + float_value Float32 CODEC(NONE), + double_value Float64 CODEC(LZ4HC(9)) + value Float32 CODEC(Delta, ZSTD) +) +ENGINE = +... +``` + +Bir codec bileşeni belirtilmişse, varsayılan codec bileşeni geçerli değildir. Kodekler bir boru hattında birleştirilebilir, örneğin, `CODEC(Delta, ZSTD)`. Projeniz için en iyi codec kombinasyonunu seçmek için, Altınlıkta açıklanana benzer kriterler geçirin [ClickHouse verimliliğini artırmak için yeni Kodlamalar](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) makale. + +!!! warning "Uyarıcı" + ClickHouse veritabanı dosyalarını harici yardımcı programlarla açamazsınız `lz4`. Bunun yerine, özel kullanın [clickhouse-kompresör](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) program. + +Sıkıştırma Aşağıdaki tablo motorları için desteklenir: + +- [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) aile. Sütun sıkıştırma kodeklerini destekler ve varsayılan sıkıştırma yöntemini seçerek [sıkıştırma](../../operations/server-configuration-parameters/settings.md#server-settings-compression) ayarlar. +- [Günlük](../../engines/table-engines/log-family/log-family.md) aile. Kullanır `lz4` sıkıştırma yöntemi varsayılan olarak ve sütun sıkıştırma codec destekler. +- [Koymak](../../engines/table-engines/special/set.md). Yalnızca varsayılan sıkıştırmayı destekledi. +- [Katmak](../../engines/table-engines/special/join.md). Yalnızca varsayılan sıkıştırmayı destekledi. + +ClickHouse ortak amaçlı codec ve özel codec destekler. + +#### Özel Kodekler {#create-query-specialized-codecs} + +Bu kodekler, verilerin belirli özelliklerini kullanarak sıkıştırmayı daha etkili hale getirmek için tasarlanmıştır. Bu kodeklerden bazıları verileri kendileri sıkıştırmaz. Bunun yerine, verileri ortak bir amaç için hazırlarlar codec, bu hazırlık olmadan daha iyi sıkıştırır. + +Özel kodekler: + +- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` delta değerlerini saklamak için kullanılır, böylece `delta_bytes` ham değerlerin maksimum boyutudur. Olası `delta_bytes` değerler: 1, 2, 4, 8. İçin varsayılan değer `delta_bytes` oluyor `sizeof(type)` 1, 2, 4 veya 8’e eşitse. Diğer tüm durumlarda, 1. +- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla: Hızlı, Ölçeklenebilir, Bellek İçi Zaman Serisi Veritabanı](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla: Hızlı, Ölçeklenebilir, Bellek İçi Zaman Serisi Veritabanı](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` ve `DateTime`). Algoritmasının her adımında, codec 64 değerden oluşan bir blok alır, 64x64 bit matrisine koyar, aktarır, kullanılmayan değer bitlerini kırpar ve gerisini bir dizi olarak döndürür. Kullanılmayan bitler, sıkıştırmanın kullanıldığı tüm veri bölümündeki maksimum ve minimum değerler arasında farklılık göstermeyen bitlerdir. + +`DoubleDelta` ve `Gorilla` kodekler, Gorilla TSDB’DE sıkıştırma algoritmasının bileşenleri olarak kullanılır. Gorilla yaklaşımı, zaman damgaları ile yavaş yavaş değişen değerler dizisi olduğunda senaryolarda etkilidir. Zaman damgaları tarafından etkili bir şekilde sıkıştırılır `DoubleDelta` codec ve değerler etkin bir şekilde sıkıştırılır `Gorilla` codec. Örneğin, etkili bir şekilde saklanan bir tablo elde etmek için, aşağıdaki yapılandırmada oluşturabilirsiniz: + +``` sql +CREATE TABLE codec_example +( + timestamp DateTime CODEC(DoubleDelta), + slow_values Float32 CODEC(Gorilla) +) +ENGINE = MergeTree() +``` + +#### Ortak Amaç {#create-query-common-purpose-codecs} + +Cod codecsec codecs’ler: + +- `NONE` — No compression. +- `LZ4` — Lossless [veri sıkıştırma algoritması](https://github.com/lz4/lz4) varsayılan olarak kullanılır. Lz4 hızlı sıkıştırma uygular. +- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` varsayılan düzeyi uygular. Olası seviyeleri: \[1, 12\]. Önerilen seviye aralığı: \[4, 9\]. +- `ZSTD[(level)]` — [Zstd sıkıştırma algoritması](https://en.wikipedia.org/wiki/Zstandard) yapılandırılabilir ile `level`. Olası seviyeler: \[1, 22\]. Varsayılan değer: 1. + +Yüksek Sıkıştırma seviyeleri asimetrik senaryolar için kullanışlıdır, örneğin bir kez sıkıştırın, tekrar tekrar sıkıştırın. Daha yüksek seviyeler daha iyi sıkıştırma ve daha yüksek CPU kullanımı anlamına gelir. + +## Geçici Tablolar {#temporary-tables} + +ClickHouse aşağıdaki özelliklere sahip geçici tabloları destekler: + +- Bağlantı kaybolursa da dahil olmak üzere oturum sona erdiğinde geçici tablolar kaybolur. +- Geçici bir tablo yalnızca bellek altyapısını kullanır. +- DB geçici bir tablo için belirtilemez. Veritabanları dışında oluşturulur. +- Tüm küme sunucularında dağıtılmış DDL sorgusu ile geçici bir tablo oluşturmak imkansız (kullanarak `ON CLUSTER`): bu tablo yalnızca geçerli oturumda bulunur. +- Geçici bir tablo başka bir ile aynı ada sahip ve bir sorgu DB belirtmeden tablo adını belirtir, geçici tablo kullanılır. +- Dağıtılmış sorgu işleme için bir sorguda kullanılan geçici tablolar uzak sunuculara geçirilir. + +Geçici bir tablo oluşturmak için aşağıdaki sözdizimini kullanın: + +``` sql +CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) +``` + +Çoğu durumda, geçici tablolar el ile oluşturulmaz, ancak bir sorgu için veya dağıtılmış için dış verileri kullanırken `(GLOBAL) IN`. Daha fazla bilgi için uygun bölümlere bakın + +İle tabloları kullanmak mümkündür [Motor = bellek](../../engines/table-engines/special/memory.md) geçici tablolar yerine. + +## Dağıtılmış DDL sorguları (küme Yan tümcesinde) {#distributed-ddl-queries-on-cluster-clause} + +Bu `CREATE`, `DROP`, `ALTER`, ve `RENAME` sorgular, bir kümede dağıtılmış yürütmeyi destekler. +Örneğin, aşağıdaki sorgu oluşturur `all_hits` `Distributed` her ana bilgisayarda tablo `cluster`: + +``` sql +CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) +``` + +Bu sorguları doğru bir şekilde çalıştırmak için, her ana bilgisayarın aynı küme tanımına sahip olması gerekir (senkronizasyon yapılandırmalarını basitleştirmek için zookeeper’dan değiştirmeleri kullanabilirsiniz). Ayrıca ZooKeeper sunucularına bağlanmaları gerekir. +Bazı ana bilgisayarlar şu anda mevcut olmasa bile, sorgunun yerel sürümü sonunda kümedeki her ana bilgisayarda uygulanır. Tek bir ana makine içinde sorguları yürütme sırası garanti edilir. + +## CREATE VIEW {#create-view} + +``` sql +CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... +``` + +Bir görünüm oluşturur. İki tür görüş vardır: normal ve SOMUTLAŞTIRILMIŞ. + +Normal görünümler herhangi bir veri depolamaz, ancak başka bir tablodan bir okuma gerçekleştirir. Başka bir deyişle, normal bir görünüm kaydedilmiş bir sorgudan başka bir şey değildir. Bir görünümden okurken, bu kaydedilmiş sorgu FROM yan tümcesinde bir alt sorgu olarak kullanılır. + +Örnek olarak, bir görünüm oluşturduğunuzu varsayalım: + +``` sql +CREATE VIEW view AS SELECT ... +``` + +ve bir sorgu yazdı: + +``` sql +SELECT a, b, c FROM view +``` + +Bu sorgu, alt sorguyu kullanmaya tam olarak eşdeğerdir: + +``` sql +SELECT a, b, c FROM (SELECT ...) +``` + +Materialized görünümler, ilgili SELECT sorgusu tarafından dönüştürülmüş verileri depolar. + +Olmadan hayata bir görünüm oluştururken `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. + +İle somutlaştırılmış bir görünüm oluştururken `TO [db].[table]`, kullanma mustmalısınız `POPULATE`. + +Materialized görünüm aşağıdaki gibi düzenlenmiştir: SELECT belirtilen tabloya veri eklerken, eklenen verilerin bir kısmı bu SELECT sorgusu tarafından dönüştürülür ve sonuç görünümde eklenir. + +Doldur belirtirseniz, varolan tablo verilerini oluştururken görünümde, sanki bir `CREATE TABLE ... AS SELECT ...` . Aksi takdirde, sorgu yalnızca görünümü oluşturduktan sonra tabloya eklenen verileri içerir. Görünüm oluşturma sırasında tabloya eklenen veriler EKLENMEYECEĞİNDEN, doldur kullanmanızı önermiyoruz. + +A `SELECT` sorgu içerebilir `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` ayarlanır, veri ekleme sırasında toplanır, ancak yalnızca tek bir eklenen veri paketi içinde toplanır. Veriler daha fazla toplanmayacaktır. Özel durum, bağımsız olarak veri toplama, gibi gerçekleştiren bir motor kullanırken olur `SummingMergeTree`. + +Yürütme `ALTER` somut görünümlerle ilgili sorgular tam olarak geliştirilmemiştir, bu nedenle rahatsız edici olabilirler. Eğer hayata görünüm inşaat kullanıyorsa `TO [db.]name` yapabilirsiniz `DETACH` the view, run `ALTER` hedef tablo için ve sonra `ATTACH` daha önce müstakil (`DETACH`) görünüm. + +Görünümler normal tablolarla aynı görünür. Örneğin, bunlar sonucu listelenir `SHOW TABLES` sorgu. + +Görünümleri silmek için ayrı bir sorgu yok. Bir görünümü silmek için şunları kullanın `DROP TABLE`. + +## CREATE DICTIONARY {#create-dictionary-query} + +``` sql +CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] +( + key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + attr1 type2 [DEFAULT|EXPRESSION expr3], + attr2 type2 [DEFAULT|EXPRESSION expr4] +) +PRIMARY KEY key1, key2 +SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) +LAYOUT(LAYOUT_NAME([param_name param_value])) +LIFETIME([MIN val1] MAX val2) +``` + +Oluşturuyor [dış sözlük](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) verilen ile [yapılı](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md), [kaynaklı](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md), [düzen](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) ve [ömür](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md). + +Dış sözlük yapısı özniteliklerden oluşur. Sözlük öznitelikleri tablo sütunlarına benzer şekilde belirtilir. Tek gerekli öznitelik özelliği türüdür, diğer tüm özelliklerin varsayılan değerleri olabilir. + +Sözlüğe bağlı olarak [düzen](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md) bir veya daha fazla öznitelik sözlük anahtarları olarak belirtilebilir. + +Daha fazla bilgi için, bkz. [Dış Söz Dictionarieslükler](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md) bölme. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/tr/sql_reference/statements/index.md b/docs/tr/sql-reference/statements/index.md similarity index 100% rename from docs/tr/sql_reference/statements/index.md rename to docs/tr/sql-reference/statements/index.md diff --git a/docs/tr/sql-reference/statements/insert-into.md b/docs/tr/sql-reference/statements/insert-into.md new file mode 100644 index 00000000000..8fe6f67c7cb --- /dev/null +++ b/docs/tr/sql-reference/statements/insert-into.md @@ -0,0 +1,80 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 34 +toc_title: INSERT INTO +--- + +## INSERT {#insert} + +Veri ekleme. + +Temel sorgu biçimi: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... +``` + +Sorgu eklemek için sütunların bir listesini belirtebilirsiniz `[(c1, c2, c3)]`. Bu durumda, sütunların geri kalanı ile doldurulur: + +- Hesaplanan değerler `DEFAULT` tablo tanımında belirtilen ifadeler. +- Sıfırlar ve boş dizeler, eğer `DEFAULT` ifadeler tanımlanmamıştır. + +Eğer [strict\_ınsert\_defaults = 1](../../operations/settings/settings.md), sahip olmayan sütunlar `DEFAULT` tanımlanan sorguda listelenmelidir. + +Veri herhangi bir İNSERT geçirilebilir [biçimli](../../interfaces/formats.md#formats) ClickHouse tarafından desteklenmektedir. Biçim sorguda açıkça belirtilmelidir: + +``` sql +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: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... +``` + +ClickHouse, veriden önce tüm boşlukları ve bir satır beslemesini (varsa) kaldırır. Bir sorgu oluştururken, sorgu işleçlerinden sonra verileri yeni bir satıra koymanızı öneririz (veriler boşluklarla başlarsa bu önemlidir). + +Örnek: + +``` sql +INSERT INTO t FORMAT TabSeparated +11 Hello, world! +22 Qwerty +``` + +Komut satırı istemcisini veya HTTP arabirimini kullanarak verileri sorgudan ayrı olarak ekleyebilirsiniz. Daha fazla bilgi için bölüme bakın “[Arabirimler](../../interfaces/index.md#interfaces)”. + +### Kısıtlamalar {#constraints} + +Tablo varsa [kısıtlamalar](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. + +### Sonuçları Ekleme `SELECT` {#insert_query_insert-select} + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... +``` + +Sütunlar, SELECT yan tümcesindeki konumlarına göre eşleştirilir. Ancak, SELECT ifadesi ve INSERT için tablo adları farklı olabilir. Gerekirse, tip döküm yapılır. + +Değerler dışındaki veri biçimlerinin hiçbiri, aşağıdaki gibi ifadelere değerler ayarlamasına izin vermez `now()`, `1 + 2` ve bu yüzden. Değerler biçimi, ifadelerin sınırlı kullanımına izin verir, ancak bu önerilmez, çünkü bu durumda verimsiz kod yürütme için kullanılır. + +Veri bölümlerini değiştirmek için diğer sorgular desteklenmiyor: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. +Ancak, eski verileri kullanarak silebilirsiniz `ALTER TABLE ... DROP PARTITION`. + +`FORMAT` yan tümcesi sorgu sonunda belirtilmelidir eğer `SELECT` yan tümcesi tablo işlevi içerir [girdi()](../table-functions/input.md). + +### Performans Konuları {#performance-considerations} + +`INSERT` giriş verilerini birincil anahtarla sıralar ve bunları bir bölüm anahtarı ile bölümlere ayırır. Bir kerede birkaç bölüme veri eklerseniz, bu veri tabanının performansını önemli ölçüde azaltabilir. `INSERT` sorgu. Bunu önlemek için: + +- Bir seferde 100.000 satır gibi oldukça büyük gruplar halinde veri ekleyin. +- Clickhouse’a yüklemeden önce verileri bir bölüm anahtarıyla gruplandırın. + +Eğer performans azalmaz: + +- Veri gerçek zamanlı olarak eklenir. +- Genellikle zamana göre sıralanır veri yükleyin. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/tr/sql-reference/statements/misc.md b/docs/tr/sql-reference/statements/misc.md new file mode 100644 index 00000000000..7a6382dbdce --- /dev/null +++ b/docs/tr/sql-reference/statements/misc.md @@ -0,0 +1,252 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 39 +toc_title: "Di\u011Fer" +--- + +# Çeşitli Sorgular {#miscellaneous-queries} + +## ATTACH {#attach} + +Bu sorgu tam olarak aynıdır `CREATE`, ama + +- Kelime yerine `CREATE` kelime kullanır `ATTACH`. +- Sorgu diskte veri oluşturmaz, ancak verilerin zaten uygun yerlerde olduğunu ve yalnızca tablo hakkında bilgi sunucuya eklediğini varsayar. + Bir ekleme sorgusu çalıştırdıktan sonra, sunucu tablonun varlığı hakkında bilgi sahibi olacaktır. + +Tablo daha önce ayrılmış olsaydı (`DETACH`), yapısının bilindiği anlamına gelir, yapıyı tanımlamadan steno kullanabilirsiniz. + +``` sql +ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Bu sorgu, sunucu başlatılırken kullanılır. Sunucu, tablo meta verilerini dosyalar olarak depolar `ATTACH` başlangıçta çalıştığı sorgular (sunucuda açıkça oluşturulan sistem tabloları hariç). + +## CHECK TABLE {#check-table} + +Tablodaki verilerin bozuk olup olmadığını denetler. + +``` sql +CHECK TABLE [db.]name +``` + +Bu `CHECK TABLE` sorgu, gerçek dosya boyutlarını sunucuda depolanan beklenen değerlerle karşılaştırır. Dosya boyutları depolanan değerlerle eşleşmiyorsa, verilerin bozuk olduğu anlamına gelir. Bu, örneğin, sorgu yürütme sırasında bir sistem çökmesine neden olabilir. + +Sorgu yanıtı içerir `result` tek satırlı sütun. Satır bir değere sahiptir +[Boeanoleanean](../../sql-reference/data-types/boolean.md) tür: + +- 0-tablodaki veriler bozuk. +- 1 - veri bütünlüğünü korur. + +Bu `CHECK TABLE` sorgu Aşağıdaki tablo motorlarını destekler: + +- [Günlük](../../engines/table-engines/log-family/log.md) +- [TinyLog](../../engines/table-engines/log-family/tinylog.md) +- [StripeLog](../../engines/table-engines/log-family/stripelog.md) +- [MergeTree ailesi](../../engines/table-engines/mergetree-family/mergetree.md) + +Başka bir tablo motorları ile tablolar üzerinde gerçekleştirilen bir özel duruma neden olur. + +Motor fromlardan `*Log` aile başarısızlık otomatik veri kurtarma sağlamaz. Kullan… `CHECK TABLE` veri kaybını zamanında izlemek için sorgu. + +İçin `MergeTree` aile motorları, `CHECK TABLE` sorgu, yerel sunucudaki bir tablonun her bir veri bölümü için bir kontrol durumunu gösterir. + +**Veri bozuksa** + +Tablo bozuksa, bozuk olmayan verileri başka bir tabloya kopyalayabilirsiniz. Bunu yapmak için : + +1. Bozuk tablo ile aynı yapıya sahip yeni bir tablo oluşturun. Bunu yapmak için sorguyu yürütün `CREATE TABLE AS `. +2. Ayarla… [max\_threads](../../operations/settings/settings.md#settings-max_threads) bir sonraki sorguyu tek bir iş parçacığında işlemek için 1 değeri. Bunu yapmak için sorguyu çalıştırın `SET max_threads = 1`. +3. Sorgu yürütme `INSERT INTO SELECT * FROM `. Bu istek bozuk olmayan verileri bozuk tablodan başka bir tabloya kopyalar. Yalnızca bozuk parçadan önceki veriler kopyalanır. +4. Yeniden Başlat `clickhouse-client` sıfırlamak için `max_threads` değer. + +## DESCRIBE TABLE {#misc-describe-table} + +``` sql +DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Aşağıdaki döndürür `String` sütun tipi: + +- `name` — Column name. +- `type`— Column type. +- `default_type` — Clause that is used in [varsayılan ifade](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` veya `ALIAS`). Varsayılan ifade belirtilmemişse, sütun boş bir dize içerir. +- `default_expression` — Value specified in the `DEFAULT` yan. +- `comment_expression` — Comment text. + +İç içe veri yapıları çıktı “expanded” biçimli. Her sütun ayrı ayrı gösterilir, bir noktadan sonra adı ile. + +## DETACH {#detach} + +Hakkında bilgi siler ‘name’ sunucudan tablo. Sunucu, tablonun varlığını bilmeyi durdurur. + +``` sql +DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Bu tablonun veri veya meta verileri silmez. Bir sonraki sunucu lansmanında, sunucu meta verileri okuyacak ve tablo hakkında tekrar bilgi edinecektir. +Benzer şekilde, bir “detached” tablo kullanılarak yeniden eklenebilir `ATTACH` sorgu (bunlar için depolanan meta verilere sahip olmayan sistem tabloları hariç). + +Hiç yok… `DETACH DATABASE` sorgu. + +## DROP {#drop} + +Bu sorgu iki türü vardır: `DROP DATABASE` ve `DROP TABLE`. + +``` sql +DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] +``` + +İçindeki tüm tabloları siler ‘db’ veritabanı, daha sonra siler ‘db’ veritabanı kendisi. +Eğer `IF EXISTS` belirtilen, veritabanı yoksa bir hata döndürmez. + +``` sql +DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Tabloyu siler. +Eğer `IF EXISTS` belirtilmişse, tablo yoksa veya veritabanı yoksa bir hata döndürmez. + + DROP DICTIONARY [IF EXISTS] [db.]name + +Sözlük Delets. +Eğer `IF EXISTS` belirtilmişse, tablo yoksa veya veritabanı yoksa bir hata döndürmez. + +## EXISTS {#exists} + +``` sql +EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] +``` + +Bir tek döndürür `UInt8`- tek değeri içeren sütun yazın `0` tablo veya veritabanı yoksa veya `1` tablo belirtilen veritabanında varsa. + +## KILL QUERY {#kill-query} + +``` sql +KILL QUERY [ON CLUSTER cluster] + WHERE + [SYNC|ASYNC|TEST] + [FORMAT format] +``` + +Şu anda çalışan sorguları zorla sonlandırmaya çalışır. +Sonlandırılacak sorgular sistemden seçilir.tanımlanan kriterleri kullanarak işlemler tablosu `WHERE` fıkra ofsı `KILL` sorgu. + +Örnekler: + +``` sql +-- Forcibly terminates all queries with the specified query_id: +KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' + +-- Synchronously terminates all queries run by 'username': +KILL QUERY WHERE user='username' SYNC +``` + +Salt okunur kullanıcılar yalnızca kendi sorgularını durdurabilir. + +Varsayılan olarak, sorguların zaman uyumsuz sürümü kullanılır (`ASYNC`), sorguların durduğuna dair onay beklemez. + +Senkron versiyonu (`SYNC`) tüm sorguların durmasını bekler ve durduğunda her işlem hakkında bilgi görüntüler. +Yanıt içerir `kill_status` aşağıdaki değerleri alabilen sütun: + +1. ‘finished’ – The query was terminated successfully. +2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. +3. The other values ​​explain why the query can’t be stopped. + +Bir test sorgusu (`TEST`) yalnızca kullanıcının haklarını denetler ve durdurulacak sorguların bir listesini görüntüler. + +## KILL MUTATION {#kill-mutation} + +``` sql +KILL MUTATION [ON CLUSTER cluster] + WHERE + [TEST] + [FORMAT format] +``` + +İptal etmek ve kaldırmak için çalışır [mutasyonlar](alter.md#alter-mutations) şu anda yürütülüyor. İptal etmek için mutationsasyonlar seçilir [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) tablo tarafından belirtilen filtreyi kullanarak `WHERE` fıkra ofsı `KILL` sorgu. + +Bir test sorgusu (`TEST`) yalnızca kullanıcının haklarını denetler ve durdurulacak sorguların bir listesini görüntüler. + +Örnekler: + +``` sql +-- Cancel and remove all mutations of the single table: +KILL MUTATION WHERE database = 'default' AND table = 'table' + +-- Cancel the specific mutation: +KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' +``` + +The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). + +Mutasyon tarafından yapılan değişiklikler geri alınmaz. + +## OPTIMIZE {#misc_operations-optimize} + +``` sql +OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] +``` + +Bu sorgu, bir tablo altyapısı ile tablolar için veri parçaları planlanmamış birleştirme başlatmaya çalışır. [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) aile. + +Bu `OPTMIZE` sorgu için de desteklenmektedir [MaterializedView](../../engines/table-engines/special/materializedview.md) ve… [Arabellek](../../engines/table-engines/special/buffer.md) motorlar. Diğer tablo motorları desteklenmiyor. + +Ne zaman `OPTIMIZE` ile kullanılır [ReplicatedMergeTree](../../engines/table-engines/mergetree-family/replication.md) Tablo motorları ailesi, ClickHouse birleştirme için bir görev oluşturur ve tüm düğümlerde yürütülmeyi bekler (eğer `replication_alter_partitions_sync` ayar etkinse) ’ dir. + +- Eğer `OPTIMIZE` herhangi bir nedenle bir birleştirme gerçekleştirmez, müşteriye bildirmez. Bildirimleri etkinleştirmek için [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) ayar. +- Belirtir aseniz bir `PARTITION`, sadece belirtilen bölüm optimize edilmiştir. [Bölüm ifadesi nasıl ayarlanır](alter.md#alter-how-to-specify-part-expr). +- Belirtir specifyseniz `FINAL`, optimizasyon, tüm veriler zaten bir parçada olsa bile gerçekleştirilir. +- Belirtir specifyseniz `DEDUPLICATE`, sonra tamamen aynı satırlar tekilleştirilecektir (tüm sütunlar karşılaştırılır), sadece MergeTree motoru için anlamlıdır. + +!!! warning "Uyarıcı" + `OPTIMIZE` Düzelt canemiyorum “Too many parts” hatasız. + +## RENAME {#misc_operations-rename} + +Bir veya daha fazla tabloyu yeniden adlandırır. + +``` sql +RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] +``` + +Tüm tablolar genel kilitleme altında yeniden adlandırılır. Tabloları yeniden adlandırma hafif bir işlemdir. İÇİN’DEN sonra başka bir veritabanı belirttiyseniz, tablo bu veritabanına taşınacaktır. Ancak, veritabanlarına sahip dizinlerin aynı dosya sisteminde bulunması gerekir (aksi takdirde bir hata döndürülür). + +## SET {#query-set} + +``` sql +SET param = value +``` + +Atıyor `value` to the `param` [ayar](../../operations/settings/index.md) geçerli oturum için. Değiştiremezsiniz [sunucu ayarları](../../operations/server-configuration-parameters/index.md) bu şekilde. + +Belirtilen ayarlar profilindeki tüm değerleri tek bir sorguda da ayarlayabilirsiniz. + +``` sql +SET profile = 'profile-name-from-the-settings-file' +``` + +Daha fazla bilgi için, bkz. [Ayarlar](../../operations/settings/settings.md). + +## TRUNCATE {#truncate} + +``` sql +TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +Bir tablodaki tüm verileri kaldırır. Fık thera ne zaman `IF EXISTS` tablo yoksa, sorgu bir hata döndürür. + +Bu `TRUNCATE` sorgu için desteklenmiyor [Görünüm](../../engines/table-engines/special/view.md), [Dosya](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md) ve [Boş](../../engines/table-engines/special/null.md) masa motorları. + +## USE {#use} + +``` sql +USE db +``` + +Oturum için geçerli veritabanını ayarlamanızı sağlar. +Geçerli veritabanı, veritabanı sorguda tablo adından önce bir nokta ile açıkça tanımlanmamışsa, tabloları aramak için kullanılır. +Bir oturum kavramı olmadığından, bu sorgu HTTP protokolünü kullanırken yapılamaz. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/tr/sql-reference/statements/select.md b/docs/tr/sql-reference/statements/select.md new file mode 100644 index 00000000000..3875bb85e61 --- /dev/null +++ b/docs/tr/sql-reference/statements/select.md @@ -0,0 +1,610 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 33 +toc_title: SELECT +--- + +# Select Queries sözdizimi {#select-queries-syntax} + +`SELECT` veri alma gerçekleştirir. + +``` sql +[WITH expr_list|(subquery)] +SELECT [DISTINCT] expr_list +[FROM [db.]table | (subquery) | table_function] [FINAL] +[SAMPLE sample_coeff] +[ARRAY JOIN ...] +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list +[PREWHERE expr] +[WHERE expr] +[GROUP BY expr_list] [WITH TOTALS] +[HAVING expr] +[ORDER BY expr_list] +[LIMIT [offset_value, ]n BY columns] +[LIMIT [n, ]m] +[UNION ALL ...] +[INTO OUTFILE filename] +[FORMAT format] +``` + +Tüm yan tümceleri isteğe bağlıdır, hemen sonra ifadelerin gerekli listesi hariç seçin. +Aşağıdaki yan tümceleri sorgu yürütme konveyör hemen hemen aynı sırada açıklanmıştır. + +Sorgu atlarsa `DISTINCT`, `GROUP BY` ve `ORDER BY` CLA andus Andes and the `IN` ve `JOIN` alt sorgular, sorgu o (1) RAM miktarını kullanarak tamamen akış işlenecektir. +Aksi takdirde, uygun kısıtlamalar belirtilmezse, sorgu çok fazla RAM tüketebilir: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Daha fazla bilgi için bölüme bakın “Settings”. Harici sıralama (geçici tabloları bir diske kaydetme) ve harici toplama kullanmak mümkündür. `The system does not have "merge join"`. + +### Fık WİTHRA Ile {#with-clause} + +Bu bölüm, ortak tablo ifadeleri için destek sağlar ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), bazı sınırlamalar ile: +1. Özyinelemeli sorgular desteklenmiyor +2. Alt sorgu bölüm ile birlikte kullanıldığında, sonuç tam olarak bir satır ile skaler olmalıdır +3. İfadenin sonuçları alt sorgularda kullanılamaz +WITH yan tümcesi ifadeleri sonuçları SELECT yan tümcesi içinde kullanılabilir. + +Örnek 1: Sabit ifadeyi aşağıdaki gibi kullanma “variable” + +``` sql +WITH '2019-08-01 15:23:00' as ts_upper_bound +SELECT * +FROM hits +WHERE + EventDate = toDate(ts_upper_bound) AND + EventTime <= ts_upper_bound +``` + +Örnek 2: SELECT yan tümcesi sütun listesinden toplam(bayt) ifade sonucunu çıkarma + +``` sql +WITH sum(bytes) as s +SELECT + formatReadableSize(s), + table +FROM system.parts +GROUP BY table +ORDER BY s +``` + +Örnek 3: skaler alt sorgu sonuçlarını kullanma + +``` sql +/* this example would return TOP 10 of most huge tables */ +WITH + ( + SELECT sum(bytes) + FROM system.parts + WHERE active + ) AS total_disk_usage +SELECT + (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, + table +FROM system.parts +GROUP BY table +ORDER BY table_disk_usage DESC +LIMIT 10 +``` + +Örnek 4: alt sorguda ifadeyi yeniden kullanma +Alt sorgularda ifade kullanımı için geçerli sınırlama için bir geçici çözüm olarak çoğaltabilirsiniz. + +``` sql +WITH ['hello'] AS hello +SELECT + hello, + * +FROM +( + WITH ['hello'] AS hello + SELECT hello +) +``` + +``` text +┌─hello─────┬─hello─────┐ +│ ['hello'] │ ['hello'] │ +└───────────┴───────────┘ +``` + +### Fık FROMRAS FROMINDAN {#select-from} + +FROM yan tümcesi atlanırsa, veriler `system.one` Tablo. +Bu `system.one` tablo tam olarak bir satır içerir (bu tablo diğer Dbms’lerde bulunan çift tablo ile aynı amacı yerine getirir). + +Bu `FROM` yan tümcesi veri okumak için kaynak belirtir: + +- Tablo +- Alt sorgu +- [Tablo fonksiyonu](../table-functions/index.md) + +`ARRAY JOIN` ve düzenli `JOIN` ayrıca dahil edilebilir (aşağıya bakınız). + +Bunun yerine bir tablo, `SELECT` alt sorgu parantez içinde belirtilebilir. +Standart SQL aksine, bir eşanlamlı bir alt sorgudan sonra belirtilmesi gerekmez. + +Bir sorguyu yürütmek için, sorguda listelenen tüm sütunlar uygun tablodan ayıklanır. Dış sorgu için gerekli olmayan tüm sütunlar alt sorgulardan atılır. +Bir sorgu herhangi bir sütun listelemezse (örneğin, `SELECT count() FROM t`), satır sayısını hesaplamak için yine de tablodan bir sütun çıkarılır (en küçük olanı tercih edilir). + +#### Son değiştirici {#select-from-final} + +Tablolardan veri seçerken uygulanabilir [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)- motor ailesi dışında `GraphiteMergeTree`. Ne zaman `FINAL` belirtilen, ClickHouse sonucu döndürmeden önce verileri tam olarak birleştirir ve böylece verilen tablo altyapısı için birleştirmeler sırasında gerçekleşen tüm veri dönüşümlerini gerçekleştirir. + +Ayrıca için desteklenen: +- [Çoğaltıyordu](../../engines/table-engines/mergetree-family/replication.md) sürümleri `MergeTree` motorlar. +- [Görünüm](../../engines/table-engines/special/view.md), [Arabellek](../../engines/table-engines/special/buffer.md), [Dağılı](../../engines/table-engines/special/distributed.md), ve [MaterializedView](../../engines/table-engines/special/materializedview.md) üzerinden oluşturul ,maları koşuluyla diğer motorlar üzerinde çalışan motorlar `MergeTree`- motor masaları. + +Kullanan sorgular `FINAL` olmayan benzer sorgular kadar hızlı Yürüt ,ülür, çünkü: + +- Sorgu tek bir iş parçacığında yürütülür ve veri sorgu yürütme sırasında birleştirilir. +- İle sorgular `FINAL` sorguda belirtilen sütunlara ek olarak birincil anahtar sütunlarını okuyun. + +Çoğu durumda, kullanmaktan kaçının `FINAL`. + +### Örnek Madde {#select-sample-clause} + +Bu `SAMPLE` yan tümcesi yaklaşık sorgu işleme için izin verir. + +Veri örneklemesi etkinleştirildiğinde, sorgu tüm veriler üzerinde değil, yalnızca belirli bir veri kesirinde (örnek) gerçekleştirilir. Örneğin, tüm ziyaretler için istatistikleri hesaplamanız gerekiyorsa, sorguyu tüm ziyaretlerin 1/10 kesirinde yürütmek ve ardından sonucu 10 ile çarpmak yeterlidir. + +Yaklaşık sorgu işleme aşağıdaki durumlarda yararlı olabilir: + +- Sıkı zamanlama gereksinimleriniz olduğunda (\<100ms gibi), ancak bunları karşılamak için ek donanım kaynaklarının maliyetini haklı çıkaramazsınız. +- Ham verileriniz doğru olmadığında, yaklaşım kaliteyi belirgin şekilde düşürmez. +- İş gereksinimleri yaklaşık sonuçları hedef alır (maliyet etkinliği için veya kesin sonuçları premium kullanıcılara pazarlamak için). + +!!! note "Not" + Örneklemeyi yalnızca aşağıdaki tablolarla kullanabilirsiniz: [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) tablo oluşturma sırasında örnekleme ifadesi belirtilmişse (bkz [MergeTree motoru](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table)). + +Veri örneklemesinin özellikleri aşağıda listelenmiştir: + +- Veri örneklemesi deterministik bir mekanizmadır. Aynı sonucu `SELECT .. SAMPLE` sorgu her zaman aynıdır. +- Örnekleme, farklı tablolar için sürekli olarak çalışır. Tek bir örnekleme anahtarına sahip tablolar için, aynı katsayıya sahip bir örnek her zaman olası verilerin aynı alt kümesini seçer. Örneğin, kullanıcı kimlikleri örneği, farklı tablolardan olası tüm kullanıcı kimliklerinin aynı alt kümesine sahip satırları alır. Bu, örneği alt sorgularda kullanabileceğiniz anlamına gelir. [IN](#select-in-operators) yan. Ayrıca, kullanarak örnekleri katılabilir [JOIN](#select-join) yan. +- Örnekleme, bir diskten daha az veri okumayı sağlar. Örnekleme anahtarını doğru belirtmeniz gerektiğini unutmayın. Daha fazla bilgi için, bkz. [MergeTree tablosu oluşturma](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). + +İçin `SAMPLE` yan tümcesi aşağıdaki sözdizimi desteklenir: + +| SAMPLE Clause Syntax | Açıklama | +|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `SAMPLE k` | Burada `k` 0’dan 1’e kadar olan sayıdır.
Sorgu üzerinde yürütülür `k` verilerin kesir. Mesela, `SAMPLE 0.1` sorguyu verilerin %10’unda çalıştırır. [Daha fazla bilgi edinin](#select-sample-k) | +| `SAMPLE n` | Burada `n` yeterince büyük bir tamsayıdır.
Sorgu en az bir örnek üzerinde yürütülür `n` satırlar (ancak bundan önemli ölçüde daha fazla değil). Mesela, `SAMPLE 10000000` sorguyu en az 10.000.000 satır çalıştırır. [Daha fazla bilgi edinin](#select-sample-n) | +| `SAMPLE k OFFSET m` | Burada `k` ve `m` 0’dan 1’e kadar olan sayılardır.
Sorgu bir örnek üzerinde yürütülür `k` verilerin kesir. Örnek için kullanılan veriler, `m` bölme. [Daha fazla bilgi edinin](#select-sample-offset) | + +#### SAMPLE K {#select-sample-k} + +Burada `k` 0’dan 1’e kadar olan sayıdır (hem kesirli hem de ondalık gösterimler desteklenir). Mesela, `SAMPLE 1/2` veya `SAMPLE 0.5`. + +İn a `SAMPLE k` fık ,ra, örnek alınır `k` verilerin kesir. Örnek aşağıda gösterilmiştir: + +``` sql +SELECT + Title, + count() * 10 AS PageViews +FROM hits_distributed +SAMPLE 0.1 +WHERE + CounterID = 34 +GROUP BY Title +ORDER BY PageViews DESC LIMIT 1000 +``` + +Bu örnekte, sorgu 0.1 (%10) veri örneği üzerinde yürütülür. Toplam fonksiyonların değerleri otomatik olarak düzeltilmez, bu nedenle yaklaşık bir sonuç elde etmek için, değer `count()` elle 10 ile çarpılır. + +#### SAMPLE N {#select-sample-n} + +Burada `n` yeterince büyük bir tamsayıdır. Mesela, `SAMPLE 10000000`. + +Bu durumda, sorgu en az bir örnek üzerinde yürütülür `n` satırlar (ancak bundan önemli ölçüde daha fazla değil). Mesela, `SAMPLE 10000000` sorguyu en az 10.000.000 satır çalıştırır. + +Veri okuma için minimum birim bir granül olduğundan (boyutu `index_granularity` ayar), granülün boyutundan çok daha büyük bir örnek ayarlamak mantıklıdır. + +Kullanırken `SAMPLE n` yan tümce, verilerin hangi göreli yüzde işlendiğini bilmiyorsunuz. Yani toplam fonksiyonların çarpılması gereken katsayıyı bilmiyorsunuz. Kullan… `_sample_factor` sanal sütun yaklaşık sonucu almak için. + +Bu `_sample_factor` sütun dinamik olarak hesaplanan göreli katsayıları içerir. Bu sütun otomatik olarak oluşturulduğunda [oluşturmak](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table) belirtilen örnekleme anahtarına sahip bir tablo. Kullanım örnekleri `_sample_factor` sütun aşağıda gösterilmiştir. + +Masayı düşünelim `visits`, site ziyaretleri ile ilgili istatistikleri içerir. İlk örnek, sayfa görünümlerinin sayısını nasıl hesaplayacağınızı gösterir: + +``` sql +SELECT sum(PageViews * _sample_factor) +FROM visits +SAMPLE 10000000 +``` + +Bir sonraki örnek, toplam ziyaret sayısını nasıl hesaplayacağınızı gösterir: + +``` sql +SELECT sum(_sample_factor) +FROM visits +SAMPLE 10000000 +``` + +Aşağıdaki örnek, ortalama oturum süresinin nasıl hesaplanacağını göstermektedir. Ortalama değerleri hesaplamak için göreli katsayıyı kullanmanız gerekmediğini unutmayın. + +``` sql +SELECT avg(Duration) +FROM visits +SAMPLE 10000000 +``` + +#### SAMPLE K OFFSET M {#select-sample-offset} + +Burada `k` ve `m` 0’dan 1’e kadar olan sayılardır. Örnekler aşağıda gösterilmiştir. + +**Örnek 1** + +``` sql +SAMPLE 1/10 +``` + +Bu örnekte, örnek tüm verilerin 1/10’udur: + +`[++------------]` + +**Örnek 2** + +``` sql +SAMPLE 1/10 OFFSET 1/2 +``` + +Burada, verilerin ikinci yarısından %10’luk bir örnek alınır. + +`[------++------]` + +### Dizi Jo JOİNİN Yan tüm Clausecesi {#select-array-join-clause} + +Yürüt allowsmeyi sağlar `JOIN` bir dizi veya iç içe veri yapısı ile. Niyet benzer [arrayJoin](../../sql-reference/functions/array-join.md#functions_arrayjoin) işlev, ancak işlevselliği daha geniştir. + +``` sql +SELECT +FROM +[LEFT] ARRAY JOIN +[WHERE|PREWHERE ] +... +``` + +Yalnızca bir tek belirtebilirsiniz `ARRAY JOIN` bir sorguda yan tümcesi. + +Sorgu yürütme sırası çalışırken en iyi duruma getirilmiştir `ARRAY JOIN`. Rağmen `ARRAY JOIN` her zaman önce belirtilmelidir `WHERE/PREWHERE` fık ,ra, daha önce de yapılabilir `WHERE/PREWHERE` (sonuç bu maddede gerekliyse) veya tamamladıktan sonra (hesaplamaların hacmini azaltmak için). İşlem sırası sorgu iyileştiricisi tarafından denetlenir. + +Desteklenen türleri `ARRAY JOIN` aşağıda listelenmiştir: + +- `ARRAY JOIN` - Bu durumda, boş diziler sonucu dahil değildir `JOIN`. +- `LEFT ARRAY JOIN` Bunun sonucu `JOIN` boş dizilere sahip satırlar içerir. Boş bir dizinin değeri, dizi öğesi türü için varsayılan değere ayarlanır (genellikle 0, boş dize veya NULL). + +Aşağıdaki örnekler kullanımını göstermektedir `ARRAY JOIN` ve `LEFT ARRAY JOIN` yanlar. Bir tablo oluşturalım [Dizi](../../sql-reference/data-types/array.md) sütun yazın ve içine değerler ekleyin: + +``` sql +CREATE TABLE arrays_test +( + s String, + arr Array(UInt8) +) ENGINE = Memory; + +INSERT INTO arrays_test +VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); +``` + +``` text +┌─s───────────┬─arr─────┐ +│ Hello │ [1,2] │ +│ World │ [3,4,5] │ +│ Goodbye │ [] │ +└─────────────┴─────────┘ +``` + +Aşağıdaki örnek kullanır `ARRAY JOIN` yan: + +``` sql +SELECT s, arr +FROM arrays_test +ARRAY JOIN arr; +``` + +``` text +┌─s─────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +└───────┴─────┘ +``` + +Sonraki örnek kullanımlar `LEFT ARRAY JOIN` yan: + +``` sql +SELECT s, arr +FROM arrays_test +LEFT ARRAY JOIN arr; +``` + +``` text +┌─s───────────┬─arr─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ World │ 3 │ +│ World │ 4 │ +│ World │ 5 │ +│ Goodbye │ 0 │ +└─────────────┴─────┘ +``` + +#### Takma Ad Kullanma {#using-aliases} + +Bir dizi için bir diğer ad belirtilebilir `ARRAY JOIN` yan. Bu durumda, bir dizi öğesine bu diğer adla erişilebilir, ancak dizinin kendisine özgün adla erişilir. Örnek: + +``` sql +SELECT s, arr, a +FROM arrays_test +ARRAY JOIN arr AS a; +``` + +``` text +┌─s─────┬─arr─────┬─a─┐ +│ Hello │ [1,2] │ 1 │ +│ Hello │ [1,2] │ 2 │ +│ World │ [3,4,5] │ 3 │ +│ World │ [3,4,5] │ 4 │ +│ World │ [3,4,5] │ 5 │ +└───────┴─────────┴───┘ +``` + +Takma adlar kullanarak şunları yapabilirsiniz `ARRAY JOIN` harici bir dizi ile. Mesela: + +``` sql +SELECT s, arr_external +FROM arrays_test +ARRAY JOIN [1, 2, 3] AS arr_external; +``` + +``` text +┌─s───────────┬─arr_external─┐ +│ Hello │ 1 │ +│ Hello │ 2 │ +│ Hello │ 3 │ +│ World │ 1 │ +│ World │ 2 │ +│ World │ 3 │ +│ Goodbye │ 1 │ +│ Goodbye │ 2 │ +│ Goodbye │ 3 │ +└─────────────┴──────────────┘ +``` + +Birden çok diziler virgülle ayrılmış olabilir `ARRAY JOIN` yan. Bu durumda, `JOIN` onlarla aynı anda gerçekleştirilir (doğrudan toplam, kartezyen ürün değil). Tüm dizilerin aynı boyuta sahip olması gerektiğini unutmayın. Örnek: + +``` sql +SELECT s, arr, a, num, mapped +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ +│ Hello │ [1,2] │ 1 │ 1 │ 2 │ +│ Hello │ [1,2] │ 2 │ 2 │ 3 │ +│ World │ [3,4,5] │ 3 │ 1 │ 4 │ +│ World │ [3,4,5] │ 4 │ 2 │ 5 │ +│ World │ [3,4,5] │ 5 │ 3 │ 6 │ +└───────┴─────────┴───┴─────┴────────┘ +``` + +Aşağıdaki örnek kullanır [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) işlev: + +``` sql +SELECT s, arr, a, num, arrayEnumerate(arr) +FROM arrays_test +ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; +``` + +``` text +┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ +│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ +│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ +│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ +│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ +│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ +└───────┴─────────┴───┴─────┴─────────────────────┘ +``` + +#### İç içe Veri yapısı Ile Dizi birleştirme {#array-join-with-nested-data-structure} + +`ARRAY`Jo “in” ile de çalışır [iç içe veri yapıları](../../sql-reference/data-types/nested-data-structures/nested.md). Örnek: + +``` sql +CREATE TABLE nested_test +( + s String, + nest Nested( + x UInt8, + y UInt32) +) ENGINE = Memory; + +INSERT INTO nested_test +VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); +``` + +``` text +┌─s───────┬─nest.x──┬─nest.y─────┐ +│ Hello │ [1,2] │ [10,20] │ +│ World │ [3,4,5] │ [30,40,50] │ +│ Goodbye │ [] │ [] │ +└─────────┴─────────┴────────────┘ +``` + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +İç içe geçmiş veri yapılarının adlarını belirtirken `ARRAY JOIN` anlam aynıdır `ARRAY JOIN` içerdiği tüm dizi öğeleri ile. Örnekler aşağıda listelenmiştir: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`, `nest.y`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─┐ +│ Hello │ 1 │ 10 │ +│ Hello │ 2 │ 20 │ +│ World │ 3 │ 30 │ +│ World │ 4 │ 40 │ +│ World │ 5 │ 50 │ +└───────┴────────┴────────┘ +``` + +Bu varyasyon da mantıklı: + +``` sql +SELECT s, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN `nest.x`; +``` + +``` text +┌─s─────┬─nest.x─┬─nest.y─────┐ +│ Hello │ 1 │ [10,20] │ +│ Hello │ 2 │ [10,20] │ +│ World │ 3 │ [30,40,50] │ +│ World │ 4 │ [30,40,50] │ +│ World │ 5 │ [30,40,50] │ +└───────┴────────┴────────────┘ +``` + +Bir diğer ad, iç içe geçmiş bir veri yapısı için kullanılabilir. `JOIN` sonuç veya kaynak dizi. Örnek: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` +FROM nested_test +ARRAY JOIN nest AS n; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ +└───────┴─────┴─────┴─────────┴────────────┘ +``` + +Kullanma örneği [arrayEnumerate](../../sql-reference/functions/array-functions.md#array_functions-arrayenumerate) işlev: + +``` sql +SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num +FROM nested_test +ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; +``` + +``` text +┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ +│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ +│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ +│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ +│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ +│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ +└───────┴─────┴─────┴─────────┴────────────┴─────┘ +``` + +### Jo {#select-join} + +Verileri normal olarak birleştirir [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) anlama. + +!!! info "Not" + İlgili [ARRAY JOIN](#select-array-join-clause). + +``` sql +SELECT +FROM +[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN +(ON )|(USING ) ... +``` + +Tablo adları yerine belirtilebilir `` ve ``. Bu eşdeğerdir `SELECT * FROM table` alt sorgu, tablonun sahip olduğu özel bir durum dışında [Katmak](../../engines/table-engines/special/join.md) engine – an array prepared for joining. + +#### Desteklenen Türleri `JOIN` {#select-join-types} + +- `INNER JOIN` (veya `JOIN`) +- `LEFT JOIN` (veya `LEFT OUTER JOIN`) +- `RIGHT JOIN` (veya `RIGHT OUTER JOIN`) +- `FULL JOIN` (veya `FULL OUTER JOIN`) +- `CROSS JOIN` (veya `,` ) + +Standarda bakın [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) açıklama. + +#### Çoklu birleştirme {#multiple-join} + +Sorguları gerçekleştiren ClickHouse, çoklu tablo birleşimlerini iki tablo birleşimlerinin sırasına yeniden yazar. Örneğin, JOIN ClickHouse için dört tablo varsa birinci ve ikinci katılır, ardından üçüncü tablo ile sonuç katılır ve son adımda dördüncü bir katılır. + +Bir sorgu içeriyorsa `WHERE` yan tümcesi, ClickHouse Ara birleştirme aracılığıyla bu yan tümcesi filtreleri pushdown çalışır. Filtreyi her Ara birleşime uygulayamazsa, tüm birleşimler tamamlandıktan sonra clickhouse filtreleri uygular. + +Biz tavsiye `JOIN ON` veya `JOIN USING` sorguları oluşturmak için sözdizimi. Mesela: + +``` sql +SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a +``` + +Virgülle ayrılmış tablo listelerini kullanabilirsiniz. `FROM` yan. Mesela: + +``` sql +SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a +``` + +Bu sözdizimleri karıştırmayın. + +ClickHouse virgülle sözdizimini doğrudan desteklemez, bu yüzden bunları kullanmanızı önermiyoruz. Algoritma, sorguyu şu şekilde yeniden yazmaya çalışır: `CROSS JOIN` ve `INNER JOIN` yan tümceleri ve sonra sorgu işleme devam eder. Sorguyu yeniden yazarken, ClickHouse performansı ve bellek tüketimini en iyi duruma getirmeye çalışır. Varsayılan olarak, ClickHouse virgülleri bir `INNER JOIN` CLA anduse and conver andts `INNER JOIN` -e doğru `CROSS JOIN` algoritma bunu garanti edemez zaman `INNER JOIN` gerekli verileri döndürür. + +#### Katılık {#select-join-strictness} + +- `ALL` — If the right table has several matching rows, ClickHouse creates a [Kartezyen ürün](https://en.wikipedia.org/wiki/Cartesian_product) eşleşen satırlardan. Bu standart `JOIN` SQL davranış. +- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` ve `ALL` anahtar kelimeler aynıdır. +- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` kullanım aşağıda açıklanmıştır. + +**ASOF JOIN kullanımı** + +`ASOF JOIN` tam olarak eşleşmeyen kayıtlara katılmanız gerektiğinde kullanışlıdır. + +İçin tablolar `ASOF JOIN` sıralı bir sıra sütunu olmalıdır. Bu sütun bir tabloda tek başına olamaz ve veri türlerinden biri olmalıdır: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`, ve `DateTime`. + +Sözdizimi `ASOF JOIN ... ON`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF LEFT JOIN table_2 +ON equi_cond AND closest_match_cond +``` + +Herhangi bir sayıda eşitlik koşulunu ve tam olarak en yakın eşleşme koşulunu kullanabilirsiniz. Mesela, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. + +En yakın maç için desteklenen koşullar: `>`, `>=`, `<`, `<=`. + +Sözdizimi `ASOF JOIN ... USING`: + +``` sql +SELECT expressions_list +FROM table_1 +ASOF JOIN table_2 +USING (equi_column1, ... equi_columnN, asof_column) +``` + +`ASOF JOIN` kullanma `equi_columnX` eşit onliğe katılma ve `asof_column` ile en yakın maça katılmak için `table_1.asof_column >= table_2.asof_column` koşul. Bu `asof_column` sütun her zaman sonuncusu `USING` yan. + +Örneğin, aşağıdaki tabloları göz önünde bulundurun: + +\`\`\` Metin +table\_1 table\_2 + +olay / ev\_time / user\_id olay / ev\_time / user\_id diff --git a/docs/tr/sql-reference/statements/show.md b/docs/tr/sql-reference/statements/show.md new file mode 100644 index 00000000000..f85e4f21f11 --- /dev/null +++ b/docs/tr/sql-reference/statements/show.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 38 +toc_title: SHOW +--- + +# Sorguları göster {#show-queries} + +## SHOW CREATE TABLE {#show-create-table} + +``` sql +SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +Bir tek döndürür `String`-tür ‘statement’ column, which contains a single value – the `CREATE` belirtilen nesneyi oluşturmak için kullanılan sorgu. + +## SHOW DATABASES {#show-databases} + +``` sql +SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] +``` + +Tüm veritabanlarının bir listesini yazdırır. +Bu sorgu ile aynıdır `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. + +## SHOW PROCESSLIST {#show-processlist} + +``` sql +SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] +``` + +İçeriği verir [sistem.işleyişler](../../operations/system-tables.md#system_tables-processes) şu anda işlenmekte olan sorguların bir listesini içeren tablo, hariç `SHOW PROCESSLIST` sorgular. + +Bu `SELECT * FROM system.processes` sorgu, geçerli tüm sorgular hakkında veri döndürür. + +İpucu (konsolda Yürüt): + +``` bash +$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" +``` + +## SHOW TABLES {#show-tables} + +Tablo listesini görüntüler. + +``` sql +SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Eğer… `FROM` yan tümcesi belirtilmemiş, sorgu geçerli veritabanından tabloların listesini döndürür. + +Aynı sonuçları elde edebilirsiniz `SHOW TABLES` aşağıdaki şekilde sorgu: + +``` sql +SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Örnek** + +Aşağıdaki sorgu, tablo listesinden ilk iki satırı seçer. `system` adları içeren veritabanı `co`. + +``` sql +SHOW TABLES FROM system LIKE '%co%' LIMIT 2 +``` + +``` text +┌─name───────────────────────────┐ +│ aggregate_function_combinators │ +│ collations │ +└────────────────────────────────┘ +``` + +## SHOW DICTIONARIES {#show-dictionaries} + +Bir listesini görüntüler [dış söz dictionarieslükler](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +``` sql +SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +Eğer… `FROM` yan tümcesi belirtilmemiş, sorgu geçerli veritabanından sözlükler listesini döndürür. + +Aynı sonuçları elde edebilirsiniz `SHOW DICTIONARIES` aşağıdaki şekilde sorgu: + +``` sql +SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**Örnek** + +Aşağıdaki sorgu, tablo listesinden ilk iki satırı seçer. `system` adları içeren veritabanı `reg`. + +``` sql +SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 +``` + +``` text +┌─name─────────┐ +│ regions │ +│ region_names │ +└──────────────┘ +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/tr/sql-reference/statements/system.md b/docs/tr/sql-reference/statements/system.md new file mode 100644 index 00000000000..0d028e5e8f8 --- /dev/null +++ b/docs/tr/sql-reference/statements/system.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 37 +toc_title: SYSTEM +--- + +# Sistem sorguları {#query-language-system} + +- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) +- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) +- [DROP DNS CACHE](#query_language-system-drop-dns-cache) +- [DROP MARK CACHE](#query_language-system-drop-mark-cache) +- [FLUSH LOGS](#query_language-system-flush_logs) +- [RELOAD CONFIG](#query_language-system-reload-config) +- [SHUTDOWN](#query_language-system-shutdown) +- [KILL](#query_language-system-kill) +- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) +- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) +- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) +- [STOP MERGES](#query_language-system-stop-merges) +- [START MERGES](#query_language-system-start-merges) + +## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} + +Daha önce başarıyla yüklenen tüm sözlükleri yeniden yükler. +Varsayılan olarak, sözlükler tembel yüklenir (bkz [dictionaries\_lazy\_load](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), bu nedenle başlangıçta otomatik olarak yüklenmek yerine, dictGet işlevi aracılığıyla ilk erişimde başlatılır veya ENGİNE = Dictionary ile tablolardan seçim yapılır. Bu `SYSTEM RELOAD DICTIONARIES` sorgu bu sözlükleri yeniden yükler (yüklü). +Her zaman döner `Ok.` sözlük güncellemesinin sonucu ne olursa olsun. + +## Sözlük Dictionary\_name Yeniden yükle {#query_language-system-reload-dictionary} + +Tamamen bir sözlük reloads `dictionary_name`, sözlük durumuna bakılmaksızın (LOADED / NOT\_LOADED / FAİLED). +Her zaman döner `Ok.` ne olursa olsun sözlük güncelleme sonucu. +Sözlüğün durumu sorgulanarak kontrol edilebilir `system.dictionaries` Tablo. + +``` sql +SELECT name, status FROM system.dictionaries; +``` + +## DROP DNS CACHE {#query_language-system-drop-dns-cache} + +Clickhouse’un iç DNS önbelleğini sıfırlar. Bazen (eski ClickHouse sürümleri için) altyapıyı değiştirirken (başka bir ClickHouse sunucusunun IP adresini veya sözlükler tarafından kullanılan sunucuyu değiştirirken) bu komutu kullanmak gerekir. + +Daha uygun (otomatik) önbellek yönetimi için bkz: disable\_internal\_dns\_cache, dns\_cache\_update\_period parametreleri. + +## DROP MARK CACHE {#query_language-system-drop-mark-cache} + +İşaret önbelleğini sıfırlar. ClickHouse ve performans testlerinin geliştirilmesinde kullanılır. + +## FLUSH LOGS {#query_language-system-flush_logs} + +Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. + +## RELOAD CONFIG {#query_language-system-reload-config} + +ClickHouse yapılandırmasını yeniden yükler. Yapılandırma ZooKeeeper saklandığında kullanılır. + +## SHUTDOWN {#query_language-system-shutdown} + +Normalde Clickhouse’u kapatır (gibi `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) + +## KILL {#query_language-system-kill} + +ClickHouse işlemini iptal eder (gibi `kill -9 {$ pid_clickhouse-server}`) + +## Dağıtılmış Tabloları Yönetme {#query-language-system-distributed} + +ClickHouse yönetebilir [dağılı](../../engines/table-engines/special/distributed.md) Tablolar. Bir kullanıcı bu tablolara veri eklediğinde, ClickHouse önce küme düğümlerine gönderilmesi gereken verilerin bir sırası oluşturur, sonra zaman uyumsuz olarak gönderir. İle kuyruk işleme yönetebilirsiniz [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed), ve [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) sorgular. Ayrıca, dağıtılmış verileri eşzamanlı olarak `insert_distributed_sync` ayar. + +### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} + +Dağıtılmış tablolara veri eklerken arka plan veri dağıtımını devre dışı bırakır. + +``` sql +SYSTEM STOP DISTRIBUTED SENDS [db.] +``` + +### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} + +Küme düğümlerine eşzamanlı olarak veri göndermek için Clickhouse’u zorlar. Herhangi bir düğüm kullanılamıyorsa, ClickHouse bir özel durum atar ve sorgu yürütülmesini durdurur. Tüm düğümler tekrar çevrimiçi olduğunda gerçekleşecek olan başarılı olana kadar sorguyu yeniden deneyebilirsiniz. + +``` sql +SYSTEM FLUSH DISTRIBUTED [db.] +``` + +### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} + +Dağıtılmış tablolara veri eklerken arka plan veri dağıtımını etkinleştirir. + +``` sql +SYSTEM START DISTRIBUTED SENDS [db.] +``` + +### STOP MERGES {#query_language-system-stop-merges} + +MergeTree ailesindeki tablolar için arka plan birleşmelerini durdurma imkanı sağlar: + +``` sql +SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +``` + +!!! note "Not" + `DETACH / ATTACH` tablo, daha önce tüm MergeTree tabloları için birleştirmeler durdurulduğunda bile tablo için arka plan birleştirmelerini başlatır. + +### START MERGES {#query_language-system-start-merges} + +MergeTree ailesindeki tablolar için arka plan birleştirmelerini başlatma imkanı sağlar: + +``` sql +SYSTEM START MERGES [[db.]merge_tree_family_table_name] +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/tr/sql-reference/syntax.md b/docs/tr/sql-reference/syntax.md new file mode 100644 index 00000000000..15cd0144d34 --- /dev/null +++ b/docs/tr/sql-reference/syntax.md @@ -0,0 +1,187 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 31 +toc_title: "S\xF6zdizimi" +--- + +# Sözdizimi {#syntax} + +Sistemde iki tür ayrıştırıcı vardır: tam SQL ayrıştırıcısı (özyinelemeli bir iniş ayrıştırıcısı) ve veri biçimi ayrıştırıcısı (hızlı akış ayrıştırıcısı). +Dışında her durumda `INSERT` sorgu, sadece tam SQL ayrıştırıcı kullanılır. +Bu `INSERT` sorgu her iki ayrıştırıcıyı da kullanır: + +``` sql +INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') +``` + +Bu `INSERT INTO t VALUES` parça tam ayrıştırıcı tarafından ayrıştırılır ve veriler `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` hızlı akış ayrıştırıcısı tarafından ayrıştırılır. Ayrıca kullanarak veriler için tam ayrıştırıcı açabilirsiniz [ınput\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) ayar. Ne zaman `input_format_values_interpret_expressions = 1`, ClickHouse önce hızlı akış ayrıştırıcısı ile değerleri ayrıştırmaya çalışır. Başarısız olursa, ClickHouse veriler için tam ayrıştırıcıyı kullanmaya çalışır ve bir SQL gibi davranır [ifade](#syntax-expressions). + +Veri herhangi bir biçime sahip olabilir. Bir sorgu alındığında, sunucu daha fazla hesaplar [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) istek bayt RAM (varsayılan olarak, 1 MB) ve geri kalanı akış ayrıştırılır. +Bu büyük sorunları önlemek için izin verir `INSERT` sorgular. + +Kullanırken `Values` biçim içinde bir `INSERT` sorgu, verilerin bir ifadedeki ifadelerle aynı şekilde ayrıştırıldığı görünebilir `SELECT` sorgu, ancak bu doğru değil. Bu `Values` biçim çok daha sınırlıdır. + +Bu makalenin geri kalanı tam çözümleyici kapsar. Biçim ayrıştırıcıları hakkında daha fazla bilgi için bkz: [Biçimliler](../interfaces/formats.md) bölme. + +## Alanlar {#spaces} + +Sözdizimsel yapılar arasında (bir sorgunun başlangıcı ve sonu dahil) herhangi bir sayıda boşluk simgesi olabilir. Boşluk sembolleri boşluk, sekme, satır beslemesi, CR ve form beslemesini içerir. + +## Yorumlar {#comments} + +ClickHouse, SQL stili ve C stili yorumlarını destekler. +SQL tarzı yorumlar ile başlar `--` ve hattın sonuna kadar devam, bir boşluk sonra `--` atlanmış olabilir. +C-style dan `/*` -e doğru `*/`ve çok satırlı olabilir, boşluklar da gerekli değildir. + +## Kelimeler {#syntax-keywords} + +Anahtar kelimeler karşılık geldiğinde büyük / küçük harf duyarsızdır: + +- SQL standardı. Mesela, `SELECT`, `select` ve `SeLeCt` hepsi geçerlidir. +- Bazı popüler DBMS’DE (MySQL veya Postgres) uygulama. Mesela, `DateTime` ile aynıdır `datetime`. + +Veri türü adı büyük / küçük harf duyarlı olup olmadığını denetlenebilir `system.data_type_families` Tablo. + +Standart SQL’İN aksine, diğer tüm anahtar kelimeler (işlev adları dahil) şunlardır **büyük küçük harf duyarlı**. + +Anahtar kelimeler ayrılmış değildir; sadece karşılık gelen bağlamda bu şekilde ele alınır. Kullanıyorsanız [tanıtıcılar](#syntax-identifiers) anahtar kelimelerle aynı ada sahip olarak, bunları çift tırnak veya backticks içine alın. Örneğin, sorgu `SELECT "FROM" FROM table_name` tablo geçerli ise `table_name` adı ile sütun vardır `"FROM"`. + +## Tanıtıcılar {#syntax-identifiers} + +Tanımlay areıcılar: + +- Küme, veritabanı, tablo, bölüm ve sütun adları. +- İşlevler. +- Veri türleri. +- [İfade takma adları](#syntax-expression_aliases). + +Tanımlayıcılar alıntılanabilir veya alıntılanamaz. İkincisi tercih edilir. + +Alıntılanmamış tanımlayıcılar regex ile eşleşmelidir `^[a-zA-Z_][0-9a-zA-Z_]*$` ve eşit olamaz [kelimeler](#syntax-keywords). Örnekler: `x, _1, X_y__Z123_.` + +Tanımlayıcıları anahtar kelimelerle aynı şekilde kullanmak istiyorsanız veya tanımlayıcılarda başka semboller kullanmak istiyorsanız, örneğin çift tırnak işaretleri veya backticks kullanarak alıntı yapın, `"id"`, `` `id` ``. + +## Harfler {#literals} + +Sayısal, dize, bileşik ve `NULL` harfler. + +### Sayısal {#numeric} + +Sayısal literal ayrıştırılmaya çalışılıyor: + +- İlk olarak, 64-bit imzalı bir sayı olarak, [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) işlev. +- Başarısız olursa, 64-bit imzasız bir sayı olarak, [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) işlev. +- Başarısız olursa, kayan noktalı sayı olarak [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) işlev. +- Aksi takdirde, bir hata döndürür. + +Hazır bilgi değeri, değerin sığdığı en küçük türe sahiptir. +Örneğin, 1 olarak ayrıştırılır `UInt8`, ancak 256 olarak ayrıştırılır `UInt16`. Daha fazla bilgi için, bkz. [Veri türleri](../sql-reference/data-types/index.md). + +Örnekler: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. + +### Dize {#syntax-string-literal} + +Tek tırnak yalnızca dize değişmezleri desteklenir. Kapalı karakterler ters eğik çizgi kaçabilir. Aşağıdaki kaçış dizileri karşılık gelen özel bir değere sahiptir: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. Diğer tüm durumlarda, çıkış dizileri biçiminde `\c`, nere `c` herhangi bir karakter, dönüştürülür `c`. Bu dizileri kullanabileceğiniz anlamına gelir `\'`ve`\\`. Değeri olacak [Dize](../sql-reference/data-types/string.md) tür. + +Dize değişmezlerinde, en azından kaçmanız gerekir `'` ve `\`. Tek tırnak tek Alıntı ile kaçabilir, değişmez `'It\'s'` ve `'It''s'` eşittir. + +### Bileşik {#compound} + +Diziler köşeli parantez ile inşa edilmiştir `[1, 2, 3]`. Nuples yuvarlak parantez ile inşa edilmiştir `(1, 'Hello, world!', 2)`. +Teknik olarak bunlar değişmezler değil, sırasıyla dizi oluşturma işleci ve tuple oluşturma işleci ile ifadeler. +Bir dizi en az bir öğeden oluşmalı ve bir tuple en az iki öğeye sahip olmalıdır. +İçinde tuples göründüğünde ayrı bir durum var `IN` CLA ause of a `SELECT` sorgu. Sorgu sonuçları tuples içerebilir, ancak tuples bir veritabanına kaydedilemez (tablolar hariç [Bellek](../engines/table-engines/special/memory.md) motor). + +### NULL {#null-literal} + +Değerin eksik olduğunu gösterir. + +Saklamak için `NULL` bir tablo alanında, bu olmalıdır [Nullable](../sql-reference/data-types/nullable.md) tür. + +Veri formatına bağlı olarak (giriş veya çıkış), `NULL` farklı bir temsili olabilir. Daha fazla bilgi için belgelere bakın [veri formatları](../interfaces/formats.md#formats). + +İşleme için birçok nüans var `NULL`. Örneğin, bir karşılaştırma işleminin argümanlarından en az biri ise `NULL`, bu işlemin sonucu da `NULL`. Aynı şey çarpma, toplama ve diğer işlemler için de geçerlidir. Daha fazla bilgi için her işlem için belgeleri okuyun. + +Sorgularda, kontrol edebilirsiniz `NULL` kullanarak [IS NULL](operators.md#operator-is-null) ve [IS NOT NULL](operators.md) operatörler ve ilgili fonksiyonlar `isNull` ve `isNotNull`. + +## İşlevler {#functions} + +İşlev çağrıları, yuvarlak parantez içinde bir argüman listesi (muhtemelen boş) olan bir tanımlayıcı gibi yazılır. Standart SQL’İN aksine, boş bir argüman listesi için bile parantezler gereklidir. Örnek: `now()`. +Düzenli ve agrega işlevleri vardır (bkz. “Aggregate functions”). Bazı toplama işlevleri parantez içinde iki bağımsız değişken listesi içerebilir. Örnek: `quantile (0.9) (x)`. Bu toplama fonksiyonları denir “parametric” fonksiyonlar ve ilk listedeki argümanlar çağrılır “parameters”. Parametresiz toplama işlevlerinin sözdizimi, normal işlevlerle aynıdır. + +## Operatörler {#operators} + +Operatörler, sorgu ayrıştırma sırasında önceliklerini ve ilişkilendirmelerini dikkate alarak karşılık gelen işlevlerine dönüştürülür. +Örneğin, ifade `1 + 2 * 3 + 4` dönüştür toülür `plus(plus(1, multiply(2, 3)), 4)`. + +## Veri türleri Ve veritabanı Tablosu motorları {#data_types-and-database-table-engines} + +Veri türleri ve tablo motorları `CREATE` sorgu tanımlayıcıları veya işlevleri aynı şekilde yazılır. Başka bir deyişle, parantez içinde bir argüman listesi içerebilir veya içermeyebilir. Daha fazla bilgi için bölümlere bakın “Data types,” “Table engines,” ve “CREATE”. + +## İfade Takma Adları {#syntax-expression_aliases} + +Diğer ad, sorgudaki ifade için kullanıcı tanımlı bir addır. + +``` sql +expr AS alias +``` + +- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` kullanmadan fık thera `AS` kelime. + + For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. + + In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. + +- `expr` — Any expression supported by ClickHouse. + + For example, `SELECT column_name * 2 AS double FROM some_table`. + +- `alias` — Name for `expr`. Takma adlar ile uyumlu olmalıdır [tanıtıcılar](#syntax-identifiers) sözdizimi. + + For example, `SELECT "table t".column_name FROM table_name AS "table t"`. + +### Kullanımı Ile Ilgili Notlar {#notes-on-usage} + +Diğer adlar bir sorgu veya alt sorgu için geneldir ve herhangi bir ifade için sorgunun herhangi bir bölümünde bir diğer ad tanımlayabilirsiniz. Mesela, `SELECT (1 AS n) + 2, n`. + +Diğer adlar alt sorgularda ve alt sorgular arasında görünmez. Örneğin, sorgu yürütülürken `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse istisna oluşturur `Unknown identifier: num`. + +Sonuç sütunları için bir diğer ad tanımlanmışsa `SELECT` bir alt sorgunun yan tümcesi, bu sütunlar dış sorguda görülebilir. Mesela, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. + +Sütun veya tablo adlarıyla aynı olan diğer adlara dikkat edin. Aşağıdaki örneği ele alalım: + +``` sql +CREATE TABLE t +( + a Int, + b Int +) +ENGINE = TinyLog() +``` + +``` sql +SELECT + argMax(a, b), + sum(b) AS b +FROM t +``` + +``` text +Received exception from server (version 18.14.17): +Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. +``` + +Bu örnekte, tablo ilan ettik `t` sütun ile `b`. Ardından, veri seçerken, `sum(b) AS b` takma ad. Takma adlar küresel olduğundan, ClickHouse literal yerine `b` ifad theesinde `argMax(a, b)` ifad theesiyle `sum(b)`. Bu ikame istisnaya neden oldu. + +## Yıldız işareti {#asterisk} + +İn a `SELECT` sorgu, bir yıldız ifadesinin yerini alabilir. Daha fazla bilgi için bölüme bakın “SELECT”. + +## İfadeler {#syntax-expressions} + +Bir ifade, bir işlev, tanımlayıcı, değişmez, bir operatörün uygulaması, parantez içindeki ifade, alt sorgu veya yıldız işaretidir. Ayrıca bir takma ad içerebilir. +İfadelerin listesi, virgülle ayrılmış bir veya daha fazla ifadedir. +Fonksiyonlar ve operatörler, sırayla, argüman olarak ifadelere sahip olabilirler. + +[Orijinal makale](https://clickhouse.tech/docs/en/sql_reference/syntax/) diff --git a/docs/tr/sql-reference/table-functions/file.md b/docs/tr/sql-reference/table-functions/file.md new file mode 100644 index 00000000000..eb583e3f73b --- /dev/null +++ b/docs/tr/sql-reference/table-functions/file.md @@ -0,0 +1,121 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 37 +toc_title: Dosya +--- + +# Dosya {#file} + +Bir dosyadan bir tablo oluşturur. Bu tablo işlevi benzer [url](url.md) ve [hdf’ler](hdfs.md) biri. + +``` sql +file(path, format, structure) +``` + +**Giriş parametreleri** + +- `path` — The relative path to the file from [user\_files\_path](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_files_path). Readonly modunda glob’ları takip eden dosya desteğine giden yol: `*`, `?`, `{abc,def}` ve `{N..M}` nerede `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [biçimli](../../interfaces/formats.md#formats) dosya. +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**Döndürülen değer** + +Belirtilen dosyada veri okumak veya yazmak için belirtilen yapıya sahip bir tablo. + +**Örnek** + +Ayar `user_files_path` ve dosyanın içeriği `test.csv`: + +``` bash +$ grep user_files_path /etc/clickhouse-server/config.xml + /var/lib/clickhouse/user_files/ + +$ cat /var/lib/clickhouse/user_files/test.csv + 1,2,3 + 3,2,1 + 78,43,45 +``` + +Tablo fromdan`test.csv` ve ondan ilk iki satır seçimi: + +``` sql +SELECT * +FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +``` sql +-- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file +SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 +``` + +**Yolda Globs** + +Birden çok yol bileşenleri globs olabilir. İşlenmek için dosya var olmalı ve tüm yol deseniyle eşleşmelidir (sadece sonek veya önek değil). + +- `*` — Substitutes any number of any characters except `/` boş dize dahil. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +İle yapılar `{}` benzer olan [uzaktan masa fonksiyonu](../../sql-reference/table-functions/remote.md)). + +**Örnek** + +1. Aşağıdaki göreli yollara sahip birkaç dosyamız olduğunu varsayalım: + +- ‘some\_dir/some\_file\_1’ +- ‘some\_dir/some\_file\_2’ +- ‘some\_dir/some\_file\_3’ +- ‘another\_dir/some\_file\_1’ +- ‘another\_dir/some\_file\_2’ +- ‘another\_dir/some\_file\_3’ + +1. Bu dosyalardaki satır miktarını sorgula: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. Bu iki dizinin tüm dosyalarındaki satır miktarını sorgula: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "Uyarıcı" + Dosya listenizde önde gelen sıfırlar içeren sayı aralıkları varsa, her basamak için parantez içeren yapıyı ayrı ayrı kullanın veya kullanın `?`. + +**Örnek** + +Adlı dosy thealardan verileri sorgu thelamak `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## Sanal Sütunlar {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Ayrıca Bakınız** + +- [Sanal sütunlar](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/tr/sql_reference/table_functions/generate.md b/docs/tr/sql-reference/table-functions/generate.md similarity index 100% rename from docs/tr/sql_reference/table_functions/generate.md rename to docs/tr/sql-reference/table-functions/generate.md diff --git a/docs/tr/sql-reference/table-functions/hdfs.md b/docs/tr/sql-reference/table-functions/hdfs.md new file mode 100644 index 00000000000..4878d1620b2 --- /dev/null +++ b/docs/tr/sql-reference/table-functions/hdfs.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 45 +toc_title: hdf'ler +--- + +# hdf’ler {#hdfs} + +Hdfs’deki dosyalardan bir tablo oluşturur. Bu tablo işlevi benzer [url](url.md) ve [Dosya](file.md) biri. + +``` sql +hdfs(URI, format, structure) +``` + +**Giriş parametreleri** + +- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` ve `{N..M}` nerede `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [biçimli](../../interfaces/formats.md#formats) dosya. +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**Döndürülen değer** + +Belirtilen dosyada veri okumak veya yazmak için belirtilen yapıya sahip bir tablo. + +**Örnek** + +Tablo fromdan `hdfs://hdfs1:9000/test` ve ondan ilk iki satır seçimi: + +``` sql +SELECT * +FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +**Yolda Globs** + +Birden çok yol bileşenleri globs olabilir. İşlenmek için dosya var olmalı ve tüm yol deseniyle eşleşmelidir (sadece sonek veya önek değil). + +- `*` — Substitutes any number of any characters except `/` boş dize dahil. +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +İle yapılar `{}` benzer olan [uzaktan masa fonksiyonu](../../sql-reference/table-functions/remote.md)). + +**Örnek** + +1. HDFS’DE aşağıdaki Urı’lere sahip birkaç dosyamız olduğunu varsayalım: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. Bu dosyalardaki satır miktarını sorgula: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. Bu iki dizinin tüm dosyalarındaki satır miktarını sorgula: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "Uyarıcı" + Dosya listenizde önde gelen sıfırlar içeren sayı aralıkları varsa, her basamak için parantez içeren yapıyı ayrı ayrı kullanın veya kullanın `?`. + +**Örnek** + +Adlı dosy thealardan verileri sorgu thelamak `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## Sanal Sütunlar {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**Ayrıca Bakınız** + +- [Sanal sütunlar](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/tr/sql-reference/table-functions/index.md b/docs/tr/sql-reference/table-functions/index.md new file mode 100644 index 00000000000..8a3cbf9e223 --- /dev/null +++ b/docs/tr/sql-reference/table-functions/index.md @@ -0,0 +1,38 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: "Tablo Fonksiyonlar\u0131" +toc_priority: 34 +toc_title: "Giri\u015F" +--- + +# Tablo Fonksiyonları {#table-functions} + +Tablo işlevleri tabloları oluşturmak için yöntemlerdir. + +Tablo işlevlerini kullanabilirsiniz: + +- [FROM](../statements/select.md#select-from) fıkra ofsı `SELECT` sorgu. + + The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. + +- [Tablo oluştur \](../statements/create.md#create-table-query) sorgu. + + It's one of the methods of creating a table. + +!!! warning "Uyarıcı" + Eğer tablo işlevlerini kullanamazsınız [allow\_ddl](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) ayarı devre dışı. + +| İşlev | Açıklama | +|--------------------------|-----------------------------------------------------------------------------------------------------------------------------| +| [Dosya](file.md) | Oluşturur bir [Dosya](../../engines/table-engines/special/file.md)- motor masası. | +| [birleştirmek](merge.md) | Oluşturur bir [Birleştirmek](../../engines/table-engines/special/merge.md)- motor masası. | +| [şiir](numbers.md) | Tamsayı sayılarla dolu tek bir sütun içeren bir tablo oluşturur. | +| [uzak](remote.md) | Oluşturmadan uzak sunuculara erişmenizi sağlar. [Dağılı](../../engines/table-engines/special/distributed.md)- motor masası. | +| [url](url.md) | Oluşturur bir [Url](../../engines/table-engines/special/url.md)- motor masası. | +| [mysql](mysql.md) | Oluşturur bir [MySQL](../../engines/table-engines/integrations/mysql.md)- motor masası. | +| [jdbc](jdbc.md) | Oluşturur bir [JDBC](../../engines/table-engines/integrations/jdbc.md)- motor masası. | +| [odbc](odbc.md) | Oluşturur bir [ODBC](../../engines/table-engines/integrations/odbc.md)- motor masası. | +| [hdf’ler](hdfs.md) | Oluşturur bir [HDFS](../../engines/table-engines/integrations/hdfs.md)- motor masası. | + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/tr/sql_reference/table_functions/input.md b/docs/tr/sql-reference/table-functions/input.md similarity index 100% rename from docs/tr/sql_reference/table_functions/input.md rename to docs/tr/sql-reference/table-functions/input.md diff --git a/docs/tr/sql_reference/table_functions/jdbc.md b/docs/tr/sql-reference/table-functions/jdbc.md similarity index 100% rename from docs/tr/sql_reference/table_functions/jdbc.md rename to docs/tr/sql-reference/table-functions/jdbc.md diff --git a/docs/tr/sql_reference/table_functions/merge.md b/docs/tr/sql-reference/table-functions/merge.md similarity index 100% rename from docs/tr/sql_reference/table_functions/merge.md rename to docs/tr/sql-reference/table-functions/merge.md diff --git a/docs/tr/sql-reference/table-functions/mysql.md b/docs/tr/sql-reference/table-functions/mysql.md new file mode 100644 index 00000000000..459b9268788 --- /dev/null +++ b/docs/tr/sql-reference/table-functions/mysql.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 42 +toc_title: mysql +--- + +# mysql {#mysql} + +Veriyor `SELECT` uzak bir MySQL sunucusunda depolanan veriler üzerinde gerçekleştirilecek sorgular. + +``` sql +mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +**Parametre** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` için sorgular `REPLACE INTO`. Eğer `replace_query=1`, sorgu değiştirilir. + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` eklenen ifade `INSERT` sorgu. + + Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. + + To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. + +Basit `WHERE` gibi maddeler `=, !=, >, >=, <, <=` şu anda MySQL sunucusunda yürütülür. + +Geri kalan şartlar ve `LIMIT` örnekleme kısıtlaması, yalnızca MySQL sorgusu bittikten sonra Clickhouse’da yürütülür. + +**Döndürülen Değer** + +Orijinal MySQL tablosu ile aynı sütunlara sahip bir tablo nesnesi. + +## Kullanım Örneği {#usage-example} + +MySQL tablo: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Clickhouse’dan veri seçme: + +``` sql +SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Ayrıca Bakınız {#see-also} + +- [Bu ‘MySQL’ masa motoru](../../engines/table-engines/integrations/mysql.md) +- [Harici sözlük kaynağı olarak MySQL kullanma](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/tr/sql-reference/table-functions/numbers.md b/docs/tr/sql-reference/table-functions/numbers.md new file mode 100644 index 00000000000..5f65e24719b --- /dev/null +++ b/docs/tr/sql-reference/table-functions/numbers.md @@ -0,0 +1,30 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 39 +toc_title: "\u015Fiir" +--- + +# şiir {#numbers} + +`numbers(N)` – Returns a table with the single ‘number’ 0’dan n-1’e kadar tamsayılar içeren sütun (Uİnt64). +`numbers(N, M)` - Tek bir tablo döndürür ‘number’ n’den (n + M - 1) tamsayıları içeren sütun (Uİnt64). + +Benzer `system.numbers` tablo, ardışık değerleri test etmek ve üretmek için kullanılabilir, `numbers(N, M)` daha verimli `system.numbers`. + +Aşağıdaki sorgular eşdeğerdir: + +``` sql +SELECT * FROM numbers(10); +SELECT * FROM numbers(0, 10); +SELECT * FROM system.numbers LIMIT 10; +``` + +Örnekler: + +``` sql +-- Generate a sequence of dates from 2010-01-01 to 2010-12-31 +select toDate('2010-01-01') + number as d FROM numbers(365); +``` + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/numbers/) diff --git a/docs/tr/sql-reference/table-functions/odbc.md b/docs/tr/sql-reference/table-functions/odbc.md new file mode 100644 index 00000000000..2727bc502d2 --- /dev/null +++ b/docs/tr/sql-reference/table-functions/odbc.md @@ -0,0 +1,108 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 44 +toc_title: odbc +--- + +# odbc {#table-functions-odbc} + +Üzerinden bağlanan tabloyu döndürür [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +``` sql +odbc(connection_settings, external_database, external_table) +``` + +Parametre: + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` Dosya. +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +ODBC bağlantılarını güvenli bir şekilde uygulamak için ClickHouse ayrı bir program kullanır `clickhouse-odbc-bridge`. ODBC sürücüsü doğrudan yüklenmişse `clickhouse-server`, sürücü sorunları ClickHouse sunucu çökmesine neden olabilir. ClickHouse otomatik olarak başlar `clickhouse-odbc-bridge` gerekli olduğunda. ODBC Köprüsü programı aynı paketten yüklenir `clickhouse-server`. + +Alanları ile `NULL` dış tablodaki değerler, temel veri türü için varsayılan değerlere dönüştürülür. Örneğin, uzak bir MySQL tablo alanı `INT NULL` yazın 0’a dönüştürülür (ClickHouse için varsayılan değer `Int32` veri türü). + +## Kullanım örneği {#usage-example} + +**ODBC üzerinden yerel MySQL kurulumundan veri alma** + +Bu örnek Ubuntu Linux 18.04 ve MySQL server 5.7 için kontrol edilir. + +UnixODBC ve MySQL Connector yüklü olduğundan emin olun. + +Varsayılan olarak (paketlerden yüklüyse), ClickHouse kullanıcı olarak başlar `clickhouse`. Bu nedenle, bu kullanıcıyı MySQL sunucusunda oluşturmanız ve yapılandırmanız gerekir. + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +Sonra bağlantıyı yapılandırın `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +Kullanarak bağlantıyı kontrol edebilirsiniz `isql` unixodbc yüklemesinden yardımcı program. + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +MySQL tablo: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +Clickhouse’daki MySQL tablosundan veri alma: + +``` sql +SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ 0 │ 2 │ 0 │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## Ayrıca Bakınız {#see-also} + +- [ODBC harici sözlükler](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [ODBC tablo motoru](../../engines/table-engines/integrations/odbc.md). + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/tr/sql-reference/table-functions/remote.md b/docs/tr/sql-reference/table-functions/remote.md new file mode 100644 index 00000000000..80bda876689 --- /dev/null +++ b/docs/tr/sql-reference/table-functions/remote.md @@ -0,0 +1,83 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 40 +toc_title: uzak +--- + +# uzaktan, remoteSecure {#remote-remotesecure} + +Oluşturmadan uzak sunuculara erişmenizi sağlar. `Distributed` Tablo. + +İmzalar: + +``` sql +remote('addresses_expr', db, table[, 'user'[, 'password']]) +remote('addresses_expr', db.table[, 'user'[, 'password']]) +``` + +`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` ya da sadece `host`. Ana bilgisayar sunucu adı veya IPv4 veya IPv6 adresi olarak belirtilebilir. Köşeli parantez içinde bir IPv6 adresi belirtilir. Bağlantı noktası, uzak sunucudaki TCP bağlantı noktasıdır. Bağlantı noktası atlanırsa, kullanır `tcp_port` sunucunun yapılandırma dosyasından (varsayılan olarak, 9000). + +!!! important "Önemli" + Bir IPv6 adresi için bağlantı noktası gereklidir. + +Örnekler: + +``` text +example01-01-1 +example01-01-1:9000 +localhost +127.0.0.1 +[::]:9000 +[2a02:6b8:0:1111::11]:9000 +``` + +Birden çok Adres virgülle ayrılmış olabilir. Bu durumda, ClickHouse dağıtılmış işleme kullanır, bu nedenle sorguyu belirtilen tüm adreslere gönderir (farklı verilerle kırıklar gibi). + +Örnek: + +``` text +example01-01-1,example01-02-1 +``` + +İfadenin bir kısmı kıvırcık parantez içinde belirtilebilir. Önceki örnek aşağıdaki gibi yazılabilir: + +``` text +example01-0{1,2}-1 +``` + +Kıvırcık parantez iki nokta (negatif olmayan tamsayılar) ile ayrılmış bir sayı aralığı içerebilir. Bu durumda, Aralık, shard adresleri üreten bir değer kümesine genişletilir. İlk sayı sıfır ile başlarsa, değerler aynı sıfır hizalamasıyla oluşturulur. Önceki örnek aşağıdaki gibi yazılabilir: + +``` text +example01-{01..02}-1 +``` + +Birden fazla kıvırcık parantez çiftiniz varsa, ilgili kümelerin doğrudan ürününü oluşturur. + +Adresler ve kıvırcık parantez içindeki adreslerin parçaları boru sembolü (\|) ile ayrılabilir. Bu durumda, karşılık gelen Adres kümeleri yinelemeler olarak yorumlanır ve sorgu ilk sağlıklı yinelemeye gönderilir. Ancak, yinelemeler şu anda ayarlanmış sırayla yinelenir [dengeleme](../../operations/settings/settings.md) ayar. + +Örnek: + +``` text +example01-{01..02}-{1|2} +``` + +Bu örnek, her birinin iki kopyası olan iki parçayı belirtir. + +Oluşturulan Adres sayısı bir sabit tarafından sınırlıdır. Şu anda bu 1000 Adres. + +Kullanarak `remote` tablo işlevi, bir `Distributed` tablo, çünkü bu durumda, her istek için sunucu bağlantısı yeniden kurulur. Buna ek olarak, ana bilgisayar adları ayarlanmışsa, adlar giderilir ve çeşitli yinelemelerle çalışırken hatalar sayılmaz. Çok sayıda sorgu işlerken, her zaman `Distributed` masa vaktinden önce, ve kullanmayın `remote` tablo işlevi. + +Bu `remote` tablo işlevi aşağıdaki durumlarda yararlı olabilir: + +- Veri karşılaştırma, hata ayıklama ve sınama için belirli bir sunucuya erişme. +- Araştırma amaçlı çeşitli ClickHouse kümeleri arasındaki sorgular. +- El ile yapılan seyrek dağıtılmış istekler. +- Sunucu kümesinin her seferinde yeniden tanımlandığı dağıtılmış istekler. + +Kullanıcı belirtilmemişse, `default` kullanılır. +Parola belirtilmezse, boş bir parola kullanılır. + +`remoteSecure` - aynı `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) yapılandırma veya 9440’ten. + +[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/tr/sql_reference/table_functions/url.md b/docs/tr/sql-reference/table-functions/url.md similarity index 100% rename from docs/tr/sql_reference/table_functions/url.md rename to docs/tr/sql-reference/table-functions/url.md diff --git a/docs/tr/sql_reference/aggregate_functions/combinators.md b/docs/tr/sql_reference/aggregate_functions/combinators.md deleted file mode 100644 index 693bf5e0348..00000000000 --- a/docs/tr/sql_reference/aggregate_functions/combinators.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 37 -toc_title: "Toplama fonksiyonu birle\u015Ftiriciler" ---- - -# Toplama Fonksiyonu Birleştiriciler {#aggregate_functions_combinators} - -Bir toplama işlevinin adı, ona eklenmiş bir sonek olabilir. Bu, toplama işlevinin çalışma şeklini değiştirir. - -## -Eğer {#agg-functions-combinator-if} - -The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). - -Örnekler: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` ve böyle devam eder. - -Koşullu toplama işlevleriyle, alt sorgular kullanmadan aynı anda birkaç koşul için toplamları hesaplayabilirsiniz ve `JOIN`s. Örneğin, Üye olarak.Metrica, koşullu toplama işlevleri segment karşılaştırma işlevselliğini uygulamak için kullanılır. - -## -Dizi {#agg-functions-combinator-array} - -\- Array soneki herhangi bir toplama işlevine eklenebilir. Bu durumda, toplama işlevi, ‘Array(T)’ type (ar arraysra )ys) yerine ‘T’ bağımsız değişkenleri yazın. Toplama işlevi birden çok bağımsız değişken kabul ederse, bu eşit uzunlukta diziler olmalıdır. Dizileri işlerken, toplama işlevi tüm dizi öğelerinde orijinal toplama işlevi gibi çalışır. - -Örnek 1: `sumArray(arr)` - Tüm unsurları toplamları ‘arr’ diziler. Bu örnekte, daha basit yazılmış olabilir: `sum(arraySum(arr))`. - -Örnek 2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ diziler. Bu daha kolay bir şekilde yapılabilir: `uniq(arrayJoin(arr))`, ancak eklemek her zaman mümkün değildir ‘arrayJoin’ bir sorguya. - -\- Eğer ve-dizi kombine edilebilir. Ancak, ‘Array’ önce gel mustmeli, sonra ‘If’. Örnekler: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. Nedeniyle bu sipariş için, ‘cond’ argüman bir dizi olmayacak. - -## -Devlet {#agg-functions-combinator-state} - -Bu birleştiriciyi uygularsanız, toplama işlevi elde edilen değeri döndürmez (örneğin, [uniq](reference.md#agg_function-uniq) fonksiyonu), ancak top aggreglamanın bir ara durumu (for `uniq`, bu benzersiz değerlerin sayısını hesaplamak için karma tablodur). Bu bir `AggregateFunction(...)` bu, daha fazla işlem için kullanılabilir veya daha sonra toplanmayı bitirmek için bir tabloda saklanabilir. - -Bu durumlarla çalışmak için şunları kullanın: - -- [AggregatingMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) masa motoru. -- [finalizeAggregation](../../sql_reference/functions/other_functions.md#function-finalizeaggregation) işlev. -- [runningAccumulate](../../sql_reference/functions/other_functions.md#function-runningaccumulate) işlev. -- [-Birleştirmek](#aggregate_functions_combinators_merge) birleştirici. -- [- MergeState](#aggregate_functions_combinators_mergestate) birleştirici. - -## -Birleştirmek {#aggregate_functions_combinators-merge} - -Bu birleştiriciyi uygularsanız, toplama işlevi Ara toplama durumunu bağımsız değişken olarak alır, toplama işlemini tamamlamak için durumları birleştirir ve elde edilen değeri döndürür. - -## - MergeState {#aggregate_functions_combinators-mergestate} - -Ara toplama durumlarını-birleştirme Birleştiricisi ile aynı şekilde birleştirir. Bununla birlikte, elde edilen değeri döndürmez, ancak-State combinator'a benzer bir ara toplama durumu döndürür. - -## - ForEach {#agg-functions-combinator-foreach} - -Tablolar için bir toplama işlevi, karşılık gelen dizi öğelerini toplayan ve bir dizi sonuç döndüren diziler için bir toplama işlevine dönüştürür. Mesela, `sumForEach` diz theiler için `[1, 2]`, `[3, 4, 5]`ve`[6, 7]`sonucu döndürür `[10, 13, 5]` karşılık gelen dizi öğelerini bir araya getirdikten sonra. - -## - OrDefault {#agg-functions-combinator-ordefault} - -Toplamak için hiçbir şey yoksa, toplama işlevinin dönüş türünün Varsayılan değerini doldurur. - -``` sql -SELECT avg(number), avgOrDefault(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrDefault(number)─┐ -│ nan │ 0 │ -└─────────────┴──────────────────────┘ -``` - -## - OrNull {#agg-functions-combinator-ornull} - -Doldurmalar `null` toplamak için hiçbir şey varsa. Dönüş sütun null olur. - -``` sql -SELECT avg(number), avgOrNull(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrNull(number)─┐ -│ nan │ ᴺᵁᴸᴸ │ -└─────────────┴───────────────────┘ -``` - -\- OrDefault ve-OrNull diğer birleştiriciler ile kombine edilebilir. Toplama işlevi boş girişi kabul etmediğinde yararlıdır. - -``` sql -SELECT avgOrNullIf(x, x > 10) -FROM -( - SELECT toDecimal32(1.23, 2) AS x -) -``` - -``` text -┌─avgOrNullIf(x, greater(x, 10))─┐ -│ ᴺᵁᴸᴸ │ -└────────────────────────────────┘ -``` - -## - Resample {#agg-functions-combinator-resample} - -Verileri gruplara ayırmanızı sağlar ve ardından bu gruplardaki verileri ayrı ayrı toplar. Gruplar, değerleri bir sütundan aralıklara bölerek oluşturulur. - -``` sql -Resample(start, end, step)(, resampling_key) -``` - -**Parametre** - -- `start` — Starting value of the whole required interval for `resampling_key` değerler. -- `stop` — Ending value of the whole required interval for `resampling_key` değerler. Tüm Aralık içermez `stop` değer `[start, stop)`. -- `step` — Step for separating the whole interval into subintervals. The `aggFunction` bu alt aralıkların her biri üzerinde bağımsız olarak yürütülür. -- `resampling_key` — Column whose values are used for separating data into intervals. -- `aggFunction_params` — `aggFunction` parametre. - -**Döndürülen değerler** - -- Ar arrayray of `aggFunction` her subinterval için sonuçlar. - -**Örnek** - -Düşünün `people` aşağıdaki verilerle tablo: - -``` text -┌─name───┬─age─┬─wage─┐ -│ John │ 16 │ 10 │ -│ Alice │ 30 │ 15 │ -│ Mary │ 35 │ 8 │ -│ Evelyn │ 48 │ 11.5 │ -│ David │ 62 │ 9.9 │ -│ Brian │ 60 │ 16 │ -└────────┴─────┴──────┘ -``` - -Yaş aralığı içinde olan kişilerin isimlerini alalım `[30,60)` ve `[60,75)`. Yaş için tamsayı temsilini kullandığımızdan, yaşları `[30, 59]` ve `[60,74]` aralıklılar. - -Bir dizideki isimleri toplamak için, [groupArray](reference.md#agg_function-grouparray) toplama işlevi. Bir argüman alır. Bizim durumumuzda, bu `name` sütun. Bu `groupArrayResample` fonksiyon kullanmalıdır `age` yaşlara göre isimleri toplamak için sütun. Gerekli aralıkları tanımlamak için `30, 75, 30` argü themanlar içine `groupArrayResample` işlev. - -``` sql -SELECT groupArrayResample(30, 75, 30)(name, age) FROM people -``` - -``` text -┌─groupArrayResample(30, 75, 30)(name, age)─────┐ -│ [['Alice','Mary','Evelyn'],['David','Brian']] │ -└───────────────────────────────────────────────┘ -``` - -Sonuçları düşünün. - -`Jonh` çok genç olduğu için numunenin dışında. Diğer insanlar belirtilen yaş aralıklarına göre dağıtılır. - -Şimdi toplam insan sayısını ve ortalama ücretlerini belirtilen yaş aralıklarında sayalım. - -``` sql -SELECT - countResample(30, 75, 30)(name, age) AS amount, - avgResample(30, 75, 30)(wage, age) AS avg_wage -FROM people -``` - -``` text -┌─amount─┬─avg_wage──────────────────┐ -│ [3,2] │ [11.5,12.949999809265137] │ -└────────┴───────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/tr/sql_reference/aggregate_functions/index.md b/docs/tr/sql_reference/aggregate_functions/index.md deleted file mode 100644 index b1699ab5b62..00000000000 --- a/docs/tr/sql_reference/aggregate_functions/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "Toplama Fonksiyonlar\u0131" -toc_priority: 33 -toc_title: "Giri\u015F" ---- - -# Toplama fonksiyonları {#aggregate-functions} - -Toplama fonksiyonları [normal](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) veritabanı uzmanları tarafından beklendiği gibi. - -ClickHouse da destekler: - -- [Parametrik agrega fonksiyonları](parametric_functions.md#aggregate_functions_parametric), sütunlara ek olarak diğer parametreleri kabul eder. -- [Birleştiriciler](combinators.md#aggregate_functions_combinators) toplama işlevlerinin davranışını değiştiren. - -## NULL işleme {#null-processing} - -Toplama sırasında, tüm `NULL`s atlanır. - -**Örnekler:** - -Bu tabloyu düşünün: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -Diyelim ki değerleri toplamanız gerekiyor `y` sütun: - -``` sql -SELECT sum(y) FROM t_null_big -``` - - ┌─sum(y)─┐ - │ 7 │ - └────────┘ - -Bu `sum` fonksiyon yorumlar `NULL` olarak `0`. Özellikle, bu, işlevin tüm değerlerin bulunduğu bir seçimin girişini aldığı anlamına gelir `NULL`, sonra sonuç olacak `0`, değil `NULL`. - -Şimdi kullanabilirsiniz `groupArray` bir dizi oluşturmak için işlev `y` sütun: - -``` sql -SELECT groupArray(y) FROM t_null_big -``` - -``` text -┌─groupArray(y)─┐ -│ [2,2,3] │ -└───────────────┘ -``` - -`groupArray` içermez `NULL` elde edilen dizi. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/tr/sql_reference/aggregate_functions/parametric_functions.md b/docs/tr/sql_reference/aggregate_functions/parametric_functions.md deleted file mode 100644 index 557b844ef00..00000000000 --- a/docs/tr/sql_reference/aggregate_functions/parametric_functions.md +++ /dev/null @@ -1,499 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 38 -toc_title: "Parametrik agrega fonksiyonlar\u0131" ---- - -# Parametrik Agrega Fonksiyonları {#aggregate_functions_parametric} - -Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. - -## çubuk {#histogram} - -Uyarlanabilir bir histogram hesaplar. Kesin sonuçları garanti etmez. - -``` sql -histogram(number_of_bins)(values) -``` - -İşlevleri kullanır [Bir Akış Paralel Karar Ağacı Algoritması](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). Histogram kutularının sınırları, yeni veriler bir işleve girdiğinde ayarlanır. Ortak durumda, kutu genişlikleri eşit değildir. - -**Parametre** - -`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. -`values` — [İfade](../syntax.md#syntax-expressions) giriş değerleri ile sonuçlanır. - -**Döndürülen değerler** - -- [Dizi](../../sql_reference/data_types/array.md) -den [Demetler](../../sql_reference/data_types/tuple.md) aşağıdaki format oftan: - - ``` - [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] - ``` - - - `lower` — Lower bound of the bin. - - `upper` — Upper bound of the bin. - - `height` — Calculated height of the bin. - -**Örnek** - -``` sql -SELECT histogram(5)(number + 1) -FROM ( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ -│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -Bir histogram ile görselleştirebilirsiniz [bar](../../sql_reference/functions/other_functions.md#function-bar) fonksiyon, örneğin: - -``` sql -WITH histogram(5)(rand() % 100) AS hist -SELECT - arrayJoin(hist).3 AS height, - bar(height, 0, 6, 5) AS bar -FROM -( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─height─┬─bar───┐ -│ 2.125 │ █▋ │ -│ 3.25 │ ██▌ │ -│ 5.625 │ ████▏ │ -│ 5.625 │ ████▏ │ -│ 3.375 │ ██▌ │ -└────────┴───────┘ -``` - -Bu durumda, histogram kutusu kenarlıklarını bilmediğinizi unutmamalısınız. - -## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} - -Dizinin desenle eşleşen bir olay zinciri içerip içermediğini denetler. - -``` sql -sequenceMatch(pattern)(timestamp, cond1, cond2, ...) -``` - -!!! warning "Uyarıcı" - Aynı saniyede meydana gelen olaylar sonucu etkileyen tanımsız bir sırada sırayla yatıyordu. - -**Parametre** - -- `pattern` — Pattern string. See [Desen sözdizimi](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` ve `DateTime`. Ayrıca desteklenen herhangi birini kullanabilirsiniz [Uİnt](../../sql_reference/data_types/int_uint.md) veri türleri. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. En fazla 32 koşul argümanını iletebilirsiniz. İşlev yalnızca bu koşullarda açıklanan olayları dikkate alır. Sıra, bir koşulda açıklanmayan veriler içeriyorsa, işlev bunları atlar. - -**Döndürülen değerler** - -- 1, Eğer desen eşleşti. -- Desen eşleşmezse 0. - -Tür: `UInt8`. - - -**Desen sözdizimi** - -- `(?N)` — Matches the condition argument at position `N`. Şartlar numaralandırılmıştır `[1, 32]` Aralık. Mesela, `(?1)` argü theman thela eşleş their `cond1` parametre. - -- `.*` — Matches any number of events. You don't need conditional arguments to match this element of the pattern. - -- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` birbirinden 1800 saniyeden fazla meydana gelen olayları eşleşir. Bu olaylar arasında herhangi bir olayın keyfi bir sayısı olabilir. Kullanabilirsiniz `>=`, `>`, `<`, `<=` operatörler. - -**Örnekler** - -Verileri göz önünde bulundurun `t` Tablo: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -└──────┴────────┘ -``` - -Sorguyu gerçekleştir: - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 1 │ -└───────────────────────────────────────────────────────────────────────┘ -``` - -İşlev, 2 numarasının 1 numarayı takip ettiği olay zincirini buldu. Sayı bir olay olarak tanımlanmadığı için aralarında 3 sayısını atladı. Örnekte verilen olay zincirini ararken bu numarayı dikkate almak istiyorsak, bunun için bir koşul oluşturmalıyız. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ -│ 0 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -Bu durumda, işlev desenle eşleşen olay zincirini bulamadı, çünkü 3 numaralı olay 1 ile 2 arasında gerçekleşti. Aynı durumda 4 numaralı koşulu kontrol edersek, sıra desenle eşleşir. - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ -│ 1 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [sequenceCount](#function-sequencecount) - -## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} - -Desenle eşleşen olay zincirlerinin sayısını sayar. İşlev, çakışmayan olay zincirlerini arar. Geçerli zincir eşleştirildikten sonra bir sonraki zinciri aramaya başlar. - -!!! warning "Uyarıcı" - Aynı saniyede meydana gelen olaylar sonucu etkileyen tanımsız bir sırada sırayla yatıyordu. - -``` sql -sequenceCount(pattern)(timestamp, cond1, cond2, ...) -``` - -**Parametre** - -- `pattern` — Pattern string. See [Desen sözdizimi](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` ve `DateTime`. Ayrıca desteklenen herhangi birini kullanabilirsiniz [Uİnt](../../sql_reference/data_types/int_uint.md) veri türleri. - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. En fazla 32 koşul argümanını iletebilirsiniz. İşlev yalnızca bu koşullarda açıklanan olayları dikkate alır. Sıra, bir koşulda açıklanmayan veriler içeriyorsa, işlev bunları atlar. - -**Döndürülen değerler** - -- Eşleşen çakışmayan olay zincirlerinin sayısı. - -Tür: `UInt64`. - -**Örnek** - -Verileri göz önünde bulundurun `t` Tablo: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -│ 4 │ 1 │ -│ 5 │ 3 │ -│ 6 │ 2 │ -└──────┴────────┘ -``` - -2 numara aralarında diğer sayıların herhangi bir miktarda 1 numaradan sonra meydana kaç kez Sayın: - -``` sql -SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 2 │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [sequenceMatch](#function-sequencematch) - -## windowFunnel {#windowfunnel} - -Kayan bir zaman penceresinde olay zincirlerini arar ve zincirden meydana gelen en fazla olay sayısını hesaplar. - -Fonksiyon algoritmaya göre çalışır: - -- İşlev, zincirdeki ilk koşulu tetikleyen ve olay sayacını 1'e ayarlayan verileri arar. Sürgülü pencerenin başladığı an budur. - -- Zincirdeki olaylar pencerede sırayla gerçekleşirse, sayaç artırılır. Olayların sırası bozulursa, sayaç artırılmaz. - -- Verilerin çeşitli tamamlanma noktalarında birden çok olay zinciri varsa, işlev yalnızca en uzun zincirin boyutunu çıkarır. - -**Sözdizimi** - -``` sql -windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) -``` - -**Parametre** - -- `window` — Length of the sliding window in seconds. -- `mode` - Bu isteğe bağlı bir argüman. - - `'strict'` - Zaman `'strict'` ayarlanırsa, windowFunnel () yalnızca benzersiz değerler için koşullar uygular. -- `timestamp` — Name of the column containing the timestamp. Data types supported: [Tarihli](../../sql_reference/data_types/date.md), [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) ve diğer imzasız tamsayı türleri (timestamp'ın `UInt64` yazın, değeri 2^63 - 1 olan Int64 maksimum değerini aşamaz). -- `cond` — Conditions or data describing the chain of events. [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değer** - -Sürgülü zaman penceresi içindeki zincirden ardışık tetiklenen koşulların maksimum sayısı. -Seçimdeki tüm zincirler analiz edilir. - -Tür: `Integer`. - -**Örnek** - -Kullanıcının bir telefon seçmesi ve çevrimiçi mağazada iki kez satın alması için belirli bir süre yeterli olup olmadığını belirleyin. - -Aşağıdaki olaylar zincirini ayarlayın: - -1. Mağaz theadaki Hesabına giriş yapan kullanıcı (`eventID = 1003`). -2. Kullanıcı bir telefon arar (`eventID = 1007, product = 'phone'`). -3. Kullanıcı sipariş verdi (`eventID = 1009`). -4. Kullanıcı tekrar sipariş yaptı (`eventID = 1010`). - -Giriş tablosu: - -``` text -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -``` - -Kullanıcının ne kadar uzakta olduğunu öğrenin `user_id` 2019 yılının Ocak-Şubat aylarında bir dönemde zincirden geçebilir. - -Sorgu: - -``` sql -SELECT - level, - count() AS c -FROM -( - SELECT - user_id, - windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level - FROM trend - WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') - GROUP BY user_id -) -GROUP BY level -ORDER BY level ASC -``` - -Sonuç: - -``` text -┌─level─┬─c─┐ -│ 4 │ 1 │ -└───────┴───┘ -``` - -## saklama {#retention} - -İşlev, bağımsız değişken olarak 1'den 32'ye kadar bir dizi koşul türünü alır `UInt8` bu, etkinlik için belirli bir koşulun karşılanıp karşılanmadığını gösterir. -Herhangi bir koşul bir argüman olarak belirtilebilir (aşağıdaki gibi [WHERE](../../sql_reference/statements/select.md#select-where)). - -İlk hariç, koşullar çiftler halinde geçerlidir: birinci ve ikinci doğruysa, ikincinin sonucu, birinci ve fird doğruysa, üçüncüsü doğru olacaktır. - -**Sözdizimi** - -``` sql -retention(cond1, cond2, ..., cond32); -``` - -**Parametre** - -- `cond` — an expression that returns a `UInt8` sonuç (1 veya 0). - -**Döndürülen değer** - -1 veya 0 dizisi. - -- 1 — condition was met for the event. -- 0 — condition wasn't met for the event. - -Tür: `UInt8`. - -**Örnek** - -Hesaplamanın bir örneğini düşünelim `retention` site trafiğini belirlemek için işlev. - -**1.** Сreate a table to illustrate an example. - -``` sql -CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; - -INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); -INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); -INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); -``` - -Giriş tablosu: - -Sorgu: - -``` sql -SELECT * FROM retention_test -``` - -Sonuç: - -``` text -┌───────date─┬─uid─┐ -│ 2020-01-01 │ 0 │ -│ 2020-01-01 │ 1 │ -│ 2020-01-01 │ 2 │ -│ 2020-01-01 │ 3 │ -│ 2020-01-01 │ 4 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-02 │ 0 │ -│ 2020-01-02 │ 1 │ -│ 2020-01-02 │ 2 │ -│ 2020-01-02 │ 3 │ -│ 2020-01-02 │ 4 │ -│ 2020-01-02 │ 5 │ -│ 2020-01-02 │ 6 │ -│ 2020-01-02 │ 7 │ -│ 2020-01-02 │ 8 │ -│ 2020-01-02 │ 9 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-03 │ 0 │ -│ 2020-01-03 │ 1 │ -│ 2020-01-03 │ 2 │ -│ 2020-01-03 │ 3 │ -│ 2020-01-03 │ 4 │ -│ 2020-01-03 │ 5 │ -│ 2020-01-03 │ 6 │ -│ 2020-01-03 │ 7 │ -│ 2020-01-03 │ 8 │ -│ 2020-01-03 │ 9 │ -│ 2020-01-03 │ 10 │ -│ 2020-01-03 │ 11 │ -│ 2020-01-03 │ 12 │ -│ 2020-01-03 │ 13 │ -│ 2020-01-03 │ 14 │ -└────────────┴─────┘ -``` - -**2.** Kullanıcıları benzersiz kimliğe göre grupla `uid` kullanarak `retention` işlev. - -Sorgu: - -``` sql -SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r -FROM retention_test -WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') -GROUP BY uid -ORDER BY uid ASC -``` - -Sonuç: - -``` text -┌─uid─┬─r───────┐ -│ 0 │ [1,1,1] │ -│ 1 │ [1,1,1] │ -│ 2 │ [1,1,1] │ -│ 3 │ [1,1,1] │ -│ 4 │ [1,1,1] │ -│ 5 │ [0,0,0] │ -│ 6 │ [0,0,0] │ -│ 7 │ [0,0,0] │ -│ 8 │ [0,0,0] │ -│ 9 │ [0,0,0] │ -│ 10 │ [0,0,0] │ -│ 11 │ [0,0,0] │ -│ 12 │ [0,0,0] │ -│ 13 │ [0,0,0] │ -│ 14 │ [0,0,0] │ -└─────┴─────────┘ -``` - -**3.** Günde toplam site ziyaret sayısını hesaplayın. - -Sorgu: - -``` sql -SELECT - sum(r[1]) AS r1, - sum(r[2]) AS r2, - sum(r[3]) AS r3 -FROM -( - SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r - FROM retention_test - WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') - GROUP BY uid -) -``` - -Sonuç: - -``` text -┌─r1─┬─r2─┬─r3─┐ -│ 5 │ 5 │ 5 │ -└────┴────┴────┘ -``` - -Nerede: - -- `r1`- 2020-01-01 sırasında siteyi ziyaret eden tekil ziyaretçi sayısı ( `cond1` koşul). -- `r2`- 2020-01-01 ve 2020-01-02 arasında belirli bir süre boyunca siteyi ziyaret eden tekil ziyaretçi sayısı (`cond1` ve `cond2` şartlar). -- `r3`- 2020-01-01 ve 2020-01-03 arasında belirli bir süre boyunca siteyi ziyaret eden tekil ziyaretçi sayısı (`cond1` ve `cond3` şartlar). - -## uniqUpTo(N) (x) {#uniquptonx} - -Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. - -Küçük Ns ile kullanım için tavsiye, kadar 10. N'nin maksimum değeri 100'dür. - -Bir toplama işlevinin durumu için, 1 + n \* bir bayt değerinin boyutuna eşit bellek miktarını kullanır. -Dizeler için, 8 baytlık kriptografik olmayan bir karma saklar. Yani, hesaplama dizeler için yaklaşık olarak hesaplanır. - -İşlev ayrıca birkaç argüman için de çalışır. - -Büyük bir N değeri kullanıldığında ve benzersiz değerlerin sayısı n'den biraz daha az olduğu durumlar dışında mümkün olduğunca hızlı çalışır. - -Kullanım örneği: - -``` text -Problem: Generate a report that shows only keywords that produced at least 5 unique users. -Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) - -## sumMapFiltered (keys\_to\_keep) (anahtarlar, değerler) {#summapfilteredkeys-to-keepkeys-values} - -Aynı davranış [sumMap](reference.md#agg_functions-summap) dışında bir dizi anahtar parametre olarak geçirilir. Bu, özellikle yüksek bir Anahtarlık ile çalışırken yararlı olabilir. diff --git a/docs/tr/sql_reference/aggregate_functions/reference.md b/docs/tr/sql_reference/aggregate_functions/reference.md deleted file mode 100644 index d52b82be996..00000000000 --- a/docs/tr/sql_reference/aggregate_functions/reference.md +++ /dev/null @@ -1,1878 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 36 -toc_title: "Ba\u015Fvurma" ---- - -# Fonksiyon Referans {#function-reference} - -## sayma {#agg_function-count} - -Satır veya NOT-NULL değerleri sayar. - -ClickHouse için aşağıdaki sözdizimleri destekler `count`: -- `count(expr)` veya `COUNT(DISTINCT expr)`. -- `count()` veya `COUNT(*)`. Bu `count()` sözdizimi ClickHouse özeldir. - -**Parametre** - -Fonksiyon alabilir: - -- Sıfır parametreler. -- Bir [ifade](../syntax.md#syntax-expressions). - -**Döndürülen değer** - -- Fonksiyon parametreleri olmadan çağrılırsa, satır sayısını sayar. -- Eğer... [ifade](../syntax.md#syntax-expressions) geçirilir, daha sonra işlev bu ifadenin kaç kez NOT null döndürdüğünü sayar. İfad aede bir [Nullable](../../sql_reference/data_types/nullable.md)- type değeri, sonra sonucu `count` kalır değil `Nullable`. İfade döndürülürse işlev 0 döndürür `NULL` tüm satırlar için. - -Her iki durumda da döndürülen değerin türü [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Ayrıntı** - -ClickHouse destekler `COUNT(DISTINCT ...)` sözdizimi. Bu yapının davranışı Aşağıdakilere bağlıdır [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) ayar. Aşağıdakilerden hang theisini tanımlar [uniq\*](#agg_function-uniq) fonksiyonlar işlemi gerçekleştirmek için kullanılır. Varsayılan değer [uniqExact](#agg_function-uniqexact) işlev. - -Bu `SELECT count() FROM table` tablodaki girdi sayısı ayrı olarak depolanmadığı için sorgu en iyi duruma getirilmez. Tablodan küçük bir sütun seçer ve içindeki değerlerin sayısını sayar. - -**Örnekler** - -Örnek 1: - -``` sql -SELECT count() FROM t -``` - -``` text -┌─count()─┐ -│ 5 │ -└─────────┘ -``` - -Örnek 2: - -``` sql -SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' -``` - -``` text -┌─name──────────────────────────┬─value─────┐ -│ count_distinct_implementation │ uniqExact │ -└───────────────────────────────┴───────────┘ -``` - -``` sql -SELECT count(DISTINCT num) FROM t -``` - -``` text -┌─uniqExact(num)─┐ -│ 3 │ -└────────────────┘ -``` - -Bu örnek gösteriyor ki `count(DISTINCT num)` tarafından gerçekleştirilir `uniqExact` fonksiyonu göre `count_distinct_implementation` ayar değeri. - -## herhangi(x) {#agg_function-any} - -İlk karşılaşılan değeri seçer. -Sorgu herhangi bir sırada ve hatta her seferinde farklı bir sırada çalıştırılabilir, bu nedenle bu işlevin sonucu belirsizdir. -Belirli bir sonuç elde etmek için ‘min’ veya ‘max’ fonksiyon yerine ‘any’. - -Bazı durumlarda, yürütme sırasına güvenebilirsiniz. Bu, select ORDER BY kullanan bir alt sorgudan geldiğinde durumlar için geçerlidir. - -Ne zaman bir `SELECT` sorgu vardır `GROUP BY` yan tümce veya en az bir toplama işlevi, ClickHouse (Mysql'in aksine), tüm ifadelerin `SELECT`, `HAVING`, ve `ORDER BY` anahtar functionslardan veya toplama işlev .lerinden hesaplan .malıdır. Başka bir deyişle, tablodan seçilen her sütun, anahtarlarda veya toplama işlevlerinde kullanılmalıdır. Mysql'de olduğu gibi davranış elde etmek için, diğer sütunları `any` toplama işlevi. - -## anyHeavy (x) {#anyheavyx} - -Kullanarak sık oluşan bir değer seçer [ağır vurucular](http://www.cs.umd.edu/~samir/498/karp.pdf) algoritma. Sorgunun yürütme iş parçacığı her durumda yarısından fazlasını oluşan bir değer varsa, bu değer döndürülür. Normalde, sonuç belirsizdir. - -``` sql -anyHeavy(column) -``` - -**Değişkenler** - -- `column` – The column name. - -**Örnek** - -Tak thee the [OnTime](../../getting_started/example_datasets/ontime.md) veri kümesi ve herhangi bir sık oluşan değeri seçin `AirlineID` sütun. - -``` sql -SELECT anyHeavy(AirlineID) AS res -FROM ontime -``` - -``` text -┌───res─┐ -│ 19690 │ -└───────┘ -``` - -## anyLast(x) {#anylastx} - -Karşılaşılan son değeri seçer. -Sonuç için olduğu kadar belirsiz `any` işlev. - -## groupBitAnd {#groupbitand} - -Bitwise uygular `AND` sayı serisi için. - -``` sql -groupBitAnd(expr) -``` - -**Parametre** - -`expr` – An expression that results in `UInt*` tür. - -**Dönüş değeri** - -Bu değer `UInt*` tür. - -**Örnek** - -Test verileri: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Sorgu: - -``` sql -SELECT groupBitAnd(num) FROM t -``` - -Nerede `num` test verileri ile sütundur. - -Sonuç: - -``` text -binary decimal -00000100 = 4 -``` - -## groupBitOr {#groupbitor} - -Bitwise uygular `OR` sayı serisi için. - -``` sql -groupBitOr(expr) -``` - -**Parametre** - -`expr` – An expression that results in `UInt*` tür. - -**Dönüş değeri** - -Bu değer `UInt*` tür. - -**Örnek** - -Test verileri: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Sorgu: - -``` sql -SELECT groupBitOr(num) FROM t -``` - -Nerede `num` test verileri ile sütundur. - -Sonuç: - -``` text -binary decimal -01111101 = 125 -``` - -## groupBitXor {#groupbitxor} - -Bitwise uygular `XOR` sayı serisi için. - -``` sql -groupBitXor(expr) -``` - -**Parametre** - -`expr` – An expression that results in `UInt*` tür. - -**Dönüş değeri** - -Bu değer `UInt*` tür. - -**Örnek** - -Test verileri: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -Sorgu: - -``` sql -SELECT groupBitXor(num) FROM t -``` - -Nerede `num` test verileri ile sütundur. - -Sonuç: - -``` text -binary decimal -01101000 = 104 -``` - -## groupBitmap {#groupbitmap} - -İşaretsiz tamsayı sütun, Uınt64 tür iade önem, gelen bit eşlem veya Toplama hesaplamaları suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmap(expr) -``` - -**Parametre** - -`expr` – An expression that results in `UInt*` tür. - -**Dönüş değeri** - -Bu değer `UInt64` tür. - -**Örnek** - -Test verileri: - -``` text -UserID -1 -1 -2 -3 -``` - -Sorgu: - -``` sql -SELECT groupBitmap(UserID) as num FROM t -``` - -Sonuç: - -``` text -num -3 -``` - -## min (x) {#agg_function-min} - -Minimum hesaplar. - -## max (x) {#agg_function-max} - -Maksimum hesaplar. - -## argMin (arg, val) {#agg-function-argmin} - -Hesaplar ‘arg’ minimum değer ‘val’ değer. Birkaç farklı değer varsa ‘arg’ minimum değerler için ‘val’, karşılaşılan bu değerlerin ilki çıktıdır. - -**Örnek:** - -``` text -┌─user─────┬─salary─┐ -│ director │ 5000 │ -│ manager │ 3000 │ -│ worker │ 1000 │ -└──────────┴────────┘ -``` - -``` sql -SELECT argMin(user, salary) FROM salary -``` - -``` text -┌─argMin(user, salary)─┐ -│ worker │ -└──────────────────────┘ -``` - -## argMax (arg, val) {#agg-function-argmax} - -Hesaplar ‘arg’ maksimum değer ‘val’ değer. Birkaç farklı değer varsa ‘arg’ maksimum değerler için ‘val’, karşılaşılan bu değerlerin ilki çıktıdır. - -## s (um (x) {#agg_function-sum} - -Toplamı hesaplar. -Sadece sayılar için çalışır. - -## sumWithOverflow(x) {#sumwithoverflowx} - -Giriş parametreleri için olduğu gibi sonuç için aynı veri türünü kullanarak sayıların toplamını hesaplar. Toplam bu veri türü için en büyük değeri aşarsa, işlev bir hata döndürür. - -Sadece sayılar için çalışır. - -## sumMap (anahtar, değer) {#agg_functions-summap} - -Toplam thelar ‘value’ belirtilen tuş accordinglara göre dizi ‘key’ dizi. -Eleman sayısı ‘key’ ve ‘value’ toplam her satır için aynı olmalıdır. -Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. - -Örnek: - -``` sql -CREATE TABLE sum_map( - date Date, - timeslot DateTime, - statusMap Nested( - status UInt16, - requests UInt64 - ) -) ENGINE = Log; -INSERT INTO sum_map VALUES - ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); -SELECT - timeslot, - sumMap(statusMap.status, statusMap.requests) -FROM sum_map -GROUP BY timeslot -``` - -``` text -┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ -│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ -│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ -└─────────────────────┴──────────────────────────────────────────────┘ -``` - -## skewPop {#skewpop} - -Hesaplar [çarpıklık](https://en.wikipedia.org/wiki/Skewness) bir sıra. - -``` sql -skewPop(expr) -``` - -**Parametre** - -`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. - -**Döndürülen değer** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**Örnek** - -``` sql -SELECT skewPop(value) FROM series_with_value_column -``` - -## skewSamp {#skewsamp} - -Hesaplar [örnek çarpıklık](https://en.wikipedia.org/wiki/Skewness) bir sıra. - -Bir rassal değişkenin çarpıklığının tarafsız bir tahminini temsil eder. - -``` sql -skewSamp(expr) -``` - -**Parametre** - -`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. - -**Döndürülen değer** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). Eğer `n <= 1` (`n` örnek boyutudur), daha sonra işlev döner `nan`. - -**Örnek** - -``` sql -SELECT skewSamp(value) FROM series_with_value_column -``` - -## kurtPop {#kurtpop} - -Hesaplar [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) bir sıra. - -``` sql -kurtPop(expr) -``` - -**Parametre** - -`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. - -**Döndürülen değer** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**Örnek** - -``` sql -SELECT kurtPop(value) FROM series_with_value_column -``` - -## kurtSamp {#kurtsamp} - -Hesaplar [örnek kurtoz](https://en.wikipedia.org/wiki/Kurtosis) bir sıra. - -Eğer geçen değerleri örnek oluşturur, eğer bir rassal değişken kurtosis tarafsız bir tahmini temsil eder. - -``` sql -kurtSamp(expr) -``` - -**Parametre** - -`expr` — [İfade](../syntax.md#syntax-expressions) bir numara döndürüyor. - -**Döndürülen değer** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). Eğer `n <= 1` (`n` örnek bir boyutudur), daha sonra işlev döner `nan`. - -**Örnek** - -``` sql -SELECT kurtSamp(value) FROM series_with_value_column -``` - -## timeSeriesGroupSum(uıd, zaman damgası, değer) {#agg-function-timeseriesgroupsum} - -`timeSeriesGroupSum` örnek zaman damgası değil hizalama farklı zaman serileri toplayabilir. -İki örnek zaman damgası arasında doğrusal enterpolasyon kullanacak ve daha sonra zaman serilerini birlikte toplayacaktır. - -- `uid` zaman serisi benzersiz kimliği mi, `UInt64`. -- `timestamp` milisaniye veya mikrosaniye desteklemek için Int64 türüdür. -- `value` metr .iktir. - -İşlev, tuples dizisini döndürür `(timestamp, aggregated_value)` çiftliler. - -Bu işlevi kullanmadan önce emin olun `timestamp` artan düzende. - -Örnek: - -``` text -┌─uid─┬─timestamp─┬─value─┐ -│ 1 │ 2 │ 0.2 │ -│ 1 │ 7 │ 0.7 │ -│ 1 │ 12 │ 1.2 │ -│ 1 │ 17 │ 1.7 │ -│ 1 │ 25 │ 2.5 │ -│ 2 │ 3 │ 0.6 │ -│ 2 │ 8 │ 1.6 │ -│ 2 │ 12 │ 2.4 │ -│ 2 │ 18 │ 3.6 │ -│ 2 │ 24 │ 4.8 │ -└─────┴───────────┴───────┘ -``` - -``` sql -CREATE TABLE time_series( - uid UInt64, - timestamp Int64, - value Float64 -) ENGINE = Memory; -INSERT INTO time_series VALUES - (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), - (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); - -SELECT timeSeriesGroupSum(uid, timestamp, value) -FROM ( - SELECT * FROM time_series order by timestamp ASC -); -``` - -Ve sonuç olacak: - -``` text -[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] -``` - -## timeSeriesGroupRateSum(uıd, ts, val) {#agg-function-timeseriesgroupratesum} - -Benzer şekilde timeSeriesGroupRateSum, timeSeriesGroupRateSum zaman serisi ve daha sonra toplam oranları birlikte oranını hesaplar. -Ayrıca, bu işlevi kullanmadan önce zaman damgası yükseliş sırasına göre olmalıdır. - -Bu işlevi kullanın, yukarıdaki sonuç olacaktır: - -``` text -[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] -``` - -## avg (x) {#agg_function-avg} - -Ortalama hesaplar. -Sadece sayılar için çalışır. -Sonuç Her zaman Float64. - -## avgWeighted {#avgweighted} - -Hesaplar [ağırlıklı aritmetik ortalama](https://en.wikipedia.org/wiki/Weighted_arithmetic_mean). - -**Sözdizimi** - -``` sql -avgWeighted(x, weight) -``` - -**Parametre** - -- `x` — Values. [Tamsayı](../data_types/int_uint.md) veya [kayan nokta](../data_types/float.md). -- `weight` — Weights of the values. [Tamsayı](../data_types/int_uint.md) veya [kayan nokta](../data_types/float.md). - -Türü `x` ve `weight` aynı olmalıdır. - -**Döndürülen değer** - -- Ağırlıklı ortalama. -- `NaN`. Tüm ağırlıklar 0'a eşitse. - -Tür: [Float64](../data_types/float.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT avgWeighted(x, w) -FROM values('x Int8, w Int8', (4, 1), (1, 0), (10, 2)) -``` - -Sonuç: - -``` text -┌─avgWeighted(x, weight)─┐ -│ 8 │ -└────────────────────────┘ -``` - -## uniq {#agg_function-uniq} - -Bağımsız değişken farklı değerlerin yaklaşık sayısını hesaplar. - -``` sql -uniq(x[, ...]) -``` - -**Parametre** - -Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. - -**Döndürülen değer** - -- A [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip numarası. - -**Uygulama Detayları** - -İşlev: - -- Toplamdaki tüm parametreler için bir karma hesaplar, daha sonra hesaplamalarda kullanır. - -- Bir adaptif örnekleme algoritması kullanır. Hesaplama durumu için işlev, 65536'ya kadar öğe karma değerlerinin bir örneğini kullanır. - - This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. - -- Sonucu deterministically sağlar (sorgu işleme sırasına bağlı değildir). - -Bu işlevi hemen hemen tüm senaryolarda kullanmanızı öneririz. - -**Ayrıca Bakınız** - -- [uniqCombined](#agg_function-uniqcombined) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined {#agg_function-uniqcombined} - -Farklı bağımsız değişken değerlerinin yaklaşık sayısını hesaplar. - -``` sql -uniqCombined(HLL_precision)(x[, ...]) -``` - -Bu `uniqCombined` fonksiyon, farklı değerlerin sayısını hesaplamak için iyi bir seçimdir. - -**Parametre** - -Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. - -`HLL_precision` hücre sayısının baz-2 logaritmasıdır. [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). İsteğe bağlı olarak işlevi kullanabilirsiniz `uniqCombined(x[, ...])`. İçin varsayılan değer `HLL_precision` etkin bir şekilde 96 KiB alan olan 17'dir (2^17 hücre, her biri 6 bit). - -**Döndürülen değer** - -- Numara [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip numarası. - -**Uygulama Detayları** - -İşlev: - -- Bir karma hesaplar (64-bit karma için `String` ve 32-bit aksi halde) agregadaki tüm parametreler için, hesaplamalarda kullanır. - -- Bir hata düzeltme tablosu ile dizi, karma tablo ve HyperLogLog: üç algoritmaları bir arada kullanır. - - For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. - -- Sonucu deterministically sağlar (sorgu işleme sırasına bağlı değildir). - -!!! note "Not" - Olmayan için 32-bit karma kullandığından-`String` tipi, sonuç cardinalities önemli ölçüde daha büyük için çok yüksek hata olacak `UINT_MAX` (birkaç on milyarlarca farklı değerden sonra hata hızla artacaktır), bu durumda kullanmanız gerekir [uniqCombined64](#agg_function-uniqcombined64) - -İle karşılaştırıldığında [uniq](#agg_function-uniq) fonksiyonu, `uniqCombined`: - -- Birkaç kez daha az bellek tüketir. -- Birkaç kat daha yüksek doğrulukla hesaplar. -- Genellikle biraz daha düşük performansa sahiptir. Bazı senaryolarda, `uniqCombined` daha iyi performans gösterebilir `uniq` örneğin, ağ üzerinden çok sayıda toplama durumu ileten dağıtılmış sorgularla. - -**Ayrıca Bakınız** - -- [uniq](#agg_function-uniq) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined64 {#agg_function-uniqcombined64} - -Aynı olarak [uniqCombined](#agg_function-uniqcombined), ancak tüm veri türleri için 64 bit karma kullanır. - -## uniqHLL12 {#agg_function-uniqhll12} - -Farklı argüman değerlerinin yaklaşık sayısını hesaplar [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) algoritma. - -``` sql -uniqHLL12(x[, ...]) -``` - -**Parametre** - -Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. - -**Döndürülen değer** - -- A [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip numarası. - -**Uygulama Detayları** - -İşlev: - -- Toplamdaki tüm parametreler için bir karma hesaplar, daha sonra hesaplamalarda kullanır. - -- Farklı bağımsız değişken değerlerinin sayısını yaklaştırmak için HyperLogLog algoritmasını kullanır. - - 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). - -- Belirli sonucu sağlar (sorgu işleme sırasına bağlı değildir). - -Bu işlevi kullanmanızı önermiyoruz. Çoğu durumda, kullan [uniq](#agg_function-uniq) veya [uniqCombined](#agg_function-uniqcombined) işlev. - -**Ayrıca Bakınız** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqExact](#agg_function-uniqexact) - -## uniqExact {#agg_function-uniqexact} - -Farklı bağımsız değişken değerlerinin tam sayısını hesaplar. - -``` sql -uniqExact(x[, ...]) -``` - -Kullan... `uniqExact` kesinlikle kesin bir sonuca ihtiyacınız varsa işlev. Aksi takdirde kullanın [uniq](#agg_function-uniq) işlev. - -Bu `uniqExact` fonksiyonu daha fazla bellek kullanır `uniq`, çünkü farklı değerlerin sayısı arttıkça devletin büyüklüğü sınırsız büyümeye sahiptir. - -**Parametre** - -Fonksiyon değişken sayıda parametre alır. Parametreler olabilir `Tuple`, `Array`, `Date`, `DateTime`, `String` veya sayısal türleri. - -**Ayrıca Bakınız** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqHLL12](#agg_function-uniqhll12) - -## groupArray (x), groupArray (max\_size)(x) {#agg_function-grouparray} - -Bağımsız değişken değerleri dizisi oluşturur. -Değerler diziye herhangi bir (belirsiz) sırayla eklenebilir. - -İkinci versiyonu (ile `max_size` parametre), elde edilen dizinin boyutunu sınırlar `max_size` öğeler. -Mesela, `groupArray (1) (x)` eşdeğ toer equivalentdir `[any (x)]`. - -Bazı durumlarda, hala yürütme sırasına güvenebilirsiniz. Bu, aşağıdaki durumlar için geçerlidir `SELECT` kullanan bir alt sorgudan gelir `ORDER BY`. - -## grouparrayınsertat (değer, konum) {#grouparrayinsertatvalue-position} - -Belirtilen konumda diziye bir değer ekler. - -!!! note "Not" - Bu işlev, SQL dizileri için geleneksel tek tabanlı konumların aksine sıfır tabanlı konumlar kullanır. - -Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. - -İsteğe bağlı parametreler: - -- Boş pozisyonlarda ikame için varsayılan değer. -- Elde edilen dizinin uzunluğu. Bu, tüm toplama anahtarları için aynı boyuttaki dizileri almanızı sağlar. Bu parametreyi kullanırken, varsayılan değer belirtilmelidir. - -## groupArrayMovingSum {#agg_function-grouparraymovingsum} - -Giriş değerlerinin hareketli toplamını hesaplar. - -``` sql -groupArrayMovingSum(numbers_for_summing) -groupArrayMovingSum(window_size)(numbers_for_summing) -``` - -İşlev, pencere boyutunu bir parametre olarak alabilir. Belirtilmemiş bırakılırsa, işlev, sütundaki satır sayısına eşit pencere boyutunu alır. - -**Parametre** - -- `numbers_for_summing` — [İfade](../syntax.md#syntax-expressions) sayısal veri türü değeri ile sonuçlanır. -- `window_size` — Size of the calculation window. - -**Döndürülen değerler** - -- Giriş verileri ile aynı boyut ve türdeki dizi. - -**Örnek** - -Örnek tablo: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Sorgu: - -``` sql -SELECT - groupArrayMovingSum(int) AS I, - groupArrayMovingSum(float) AS F, - groupArrayMovingSum(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingSum(2)(int) AS I, - groupArrayMovingSum(2)(float) AS F, - groupArrayMovingSum(2)(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -## groupArrayMovingAvg {#agg_function-grouparraymovingavg} - -Giriş değerlerinin hareketli ortalamasını hesaplar. - -``` sql -groupArrayMovingAvg(numbers_for_summing) -groupArrayMovingAvg(window_size)(numbers_for_summing) -``` - -İşlev, pencere boyutunu bir parametre olarak alabilir. Belirtilmemiş bırakılırsa, işlev, sütundaki satır sayısına eşit pencere boyutunu alır. - -**Parametre** - -- `numbers_for_summing` — [İfade](../syntax.md#syntax-expressions) sayısal veri türü değeri ile sonuçlanır. -- `window_size` — Size of the calculation window. - -**Döndürülen değerler** - -- Giriş verileri ile aynı boyut ve türdeki dizi. - -İşlev kullanır [sıfıra doğru yuvarlama](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). Sonuç veri türü için önemsiz ondalık basamaklar keser. - -**Örnek** - -Örnek tablo `b`: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -Sorgu: - -``` sql -SELECT - groupArrayMovingAvg(int) AS I, - groupArrayMovingAvg(float) AS F, - groupArrayMovingAvg(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ -│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ -└───────────┴─────────────────────────────────────┴───────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingAvg(2)(int) AS I, - groupArrayMovingAvg(2)(float) AS F, - groupArrayMovingAvg(2)(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ -│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ -└───────────┴──────────────────────────────────┴───────────────────────┘ -``` - -## groupUniqArray (x), groupUniqArray (max\_size)(x) {#groupuniqarrayx-groupuniqarraymax-sizex} - -Farklı bağımsız değişken değerlerinden bir dizi oluşturur. Bellek tüketimi için aynıdır `uniqExact` işlev. - -İkinci versiyonu (ile `max_size` parametre), elde edilen dizinin boyutunu sınırlar `max_size` öğeler. -Mesela, `groupUniqArray(1)(x)` eşdeğ toer equivalentdir `[any(x)]`. - -## quantile {#quantile} - -Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. - -Bu işlev geçerlidir [rezerv reservoiruar örnek samplinglemesi](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192'ye kadar bir rezervuar boyutu ve örnekleme için rastgele sayı üreteci ile. Sonuç deterministik değildir. Tam bir miktar elde etmek için [quantileExact](#quantileexact) işlev. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantile(level)(expr) -``` - -Takma ad: `median`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql_reference/data_types/index.md#data_types), [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). - -**Döndürülen değer** - -- Belirtilen seviyenin yaklaşık miktarı. - -Tür: - -- [Float64](../../sql_reference/data_types/float.md) sayısal veri türü girişi için. -- [Tarihli](../../sql_reference/data_types/date.md) giriş değerleri varsa `Date` tür. -- [DateTime](../../sql_reference/data_types/datetime.md) giriş değerleri varsa `DateTime` tür. - -**Örnek** - -Giriş tablosu: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Sorgu: - -``` sql -SELECT quantile(val) FROM t -``` - -Sonuç: - -``` text -┌─quantile(val)─┐ -│ 1.5 │ -└───────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## quantileDeterministic {#quantiledeterministic} - -Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. - -Bu işlev geçerlidir [rezerv reservoiruar örnek samplinglemesi](https://en.wikipedia.org/wiki/Reservoir_sampling) 8192'ye kadar bir rezervuar boyutu ve örnekleme deterministik algoritması ile. Sonuç deterministiktir. Tam bir miktar elde etmek için [quantileExact](#quantileexact) işlev. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantileDeterministic(level)(expr, determinator) -``` - -Takma ad: `medianDeterministic`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql_reference/data_types/index.md#data_types), [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). -- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. - -**Döndürülen değer** - -- Belirtilen seviyenin yaklaşık miktarı. - -Tür: - -- [Float64](../../sql_reference/data_types/float.md) sayısal veri türü girişi için. -- [Tarihli](../../sql_reference/data_types/date.md) giriş değerleri varsa `Date` tür. -- [DateTime](../../sql_reference/data_types/datetime.md) giriş değerleri varsa `DateTime` tür. - -**Örnek** - -Giriş tablosu: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Sorgu: - -``` sql -SELECT quantileDeterministic(val, 1) FROM t -``` - -Sonuç: - -``` text -┌─quantileDeterministic(val, 1)─┐ -│ 1.5 │ -└───────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## quantileExact {#quantileexact} - -Tam olarak hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` bellek, nerede `n` geçirilen değerler say .ısıdır. Bununla birlikte, az sayıda değer için, işlev çok etkilidir. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantileExact(level)(expr) -``` - -Takma ad: `medianExact`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql_reference/data_types/index.md#data_types), [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). - -**Döndürülen değer** - -- Belirtilen seviyenin miktarı. - -Tür: - -- [Float64](../../sql_reference/data_types/float.md) sayısal veri türü girişi için. -- [Tarihli](../../sql_reference/data_types/date.md) giriş değerleri varsa `Date` tür. -- [DateTime](../../sql_reference/data_types/datetime.md) giriş değerleri varsa `DateTime` tür. - -**Örnek** - -Sorgu: - -``` sql -SELECT quantileExact(number) FROM numbers(10) -``` - -Sonuç: - -``` text -┌─quantileExact(number)─┐ -│ 5 │ -└───────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## quantilexactweighted {#quantileexactweighted} - -Tam olarak hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) her elemanın ağırlığını dikkate alarak sayısal bir veri dizisinin. - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). Bunun yerine bu işlevi kullanabilirsiniz `quantileExact` ve 1 ağırlığını belirtin. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantileExactWeighted(level)(expr, weight) -``` - -Takma ad: `medianExactWeighted`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql_reference/data_types/index.md#data_types), [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. - -**Döndürülen değer** - -- Belirtilen seviyenin miktarı. - -Tür: - -- [Float64](../../sql_reference/data_types/float.md) sayısal veri türü girişi için. -- [Tarihli](../../sql_reference/data_types/date.md) giriş değerleri varsa `Date` tür. -- [DateTime](../../sql_reference/data_types/datetime.md) giriş değerleri varsa `DateTime` tür. - -**Örnek** - -Giriş tablosu: - -``` text -┌─n─┬─val─┐ -│ 0 │ 3 │ -│ 1 │ 2 │ -│ 2 │ 1 │ -│ 5 │ 4 │ -└───┴─────┘ -``` - -Sorgu: - -``` sql -SELECT quantileExactWeighted(n, val) FROM t -``` - -Sonuç: - -``` text -┌─quantileExactWeighted(n, val)─┐ -│ 1 │ -└───────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## quantileTiming {#quantiletiming} - -Belirlenen hassas hesaplar ile [quantile](https://en.wikipedia.org/wiki/Quantile) sayısal veri dizisinin. - -Sonuç deterministiktir (sorgu işleme sırasına bağlı değildir). Fonksiyon yükleme web sayfaları kez veya arka uç yanıt süreleri gibi dağılımları tanımlamak dizileri ile çalışmak için optimize edilmiştir. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantileTiming(level)(expr) -``` - -Takma ad: `medianTiming`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). - -- `expr` — [İfade](../syntax.md#syntax-expressions) bir sütun değerleri üzerinde dönen bir [Yüzdürmek\*](../../sql_reference/data_types/float.md)- tip numarası. - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -**Doğruluk** - -Hesaplama doğru ise: - -- Toplam değer sayısı 5670'i geçmez. -- Toplam değer sayısı 5670'i aşıyor, ancak sayfa yükleme süresi 1024 ms'den az. - -Aksi takdirde, hesaplamanın sonucu 16 MS'nin en yakın katlarına yuvarlanır. - -!!! note "Not" - Sayfa yükleme süresi nicelerini hesaplamak için, bu işlev daha etkili ve doğrudur [quantile](#quantile). - -**Döndürülen değer** - -- Belirtilen seviyenin miktarı. - -Tür: `Float32`. - -!!! note "Not" - İşlev valuese hiçbir değer geçir (ilmem (işse (kullanırken `quantileTimingIf`), [Nine](../../sql_reference/data_types/float.md#data_type-float-nan-inf) döndürülür. Bunun amacı, bu vakaları sıfır ile sonuçlanan vakalardan ayırmaktır. Görmek [ORDER BY FLA BYGE](../statements/select.md#select-order-by) sıralama ile ilgili notlar için `NaN` değerler. - -**Örnek** - -Giriş tablosu: - -``` text -┌─response_time─┐ -│ 72 │ -│ 112 │ -│ 126 │ -│ 145 │ -│ 104 │ -│ 242 │ -│ 313 │ -│ 168 │ -│ 108 │ -└───────────────┘ -``` - -Sorgu: - -``` sql -SELECT quantileTiming(response_time) FROM t -``` - -Sonuç: - -``` text -┌─quantileTiming(response_time)─┐ -│ 126 │ -└───────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## niceletimingweighted {#quantiletimingweighted} - -Belirlenen hassas hesaplar ile [quantile](https://en.wikipedia.org/wiki/Quantile) her sıra üyesi ağırlığına göre sayısal veri dizisi. - -Sonuç deterministiktir (sorgu işleme sırasına bağlı değildir). Fonksiyon yükleme web sayfaları kez veya arka uç yanıt süreleri gibi dağılımları tanımlamak dizileri ile çalışmak için optimize edilmiştir. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantileTimingWeighted(level)(expr, weight) -``` - -Takma ad: `medianTimingWeighted`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). - -- `expr` — [İfade](../syntax.md#syntax-expressions) bir sütun değerleri üzerinde dönen bir [Yüzdürmek\*](../../sql_reference/data_types/float.md)- tip numarası. - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**Doğruluk** - -Hesaplama doğru ise: - -- Toplam değer sayısı 5670'i geçmez. -- Toplam değer sayısı 5670'i aşıyor, ancak sayfa yükleme süresi 1024 ms'den az. - -Aksi takdirde, hesaplamanın sonucu 16 MS'nin en yakın katlarına yuvarlanır. - -!!! note "Not" - Sayfa yükleme süresi nicelerini hesaplamak için, bu işlev daha etkili ve doğrudur [quantile](#quantile). - -**Döndürülen değer** - -- Belirtilen seviyenin miktarı. - -Tür: `Float32`. - -!!! note "Not" - İşlev valuese hiçbir değer geçir (ilmem (işse (kullanırken `quantileTimingIf`), [Nine](../../sql_reference/data_types/float.md#data_type-float-nan-inf) döndürülür. Bunun amacı, bu vakaları sıfır ile sonuçlanan vakalardan ayırmaktır. Görmek [ORDER BY FLA BYGE](../statements/select.md#select-order-by) sıralama ile ilgili notlar için `NaN` değerler. - -**Örnek** - -Giriş tablosu: - -``` text -┌─response_time─┬─weight─┐ -│ 68 │ 1 │ -│ 104 │ 2 │ -│ 112 │ 3 │ -│ 126 │ 2 │ -│ 138 │ 1 │ -│ 162 │ 1 │ -└───────────────┴────────┘ -``` - -Sorgu: - -``` sql -SELECT quantileTimingWeighted(response_time, weight) FROM t -``` - -Sonuç: - -``` text -┌─quantileTimingWeighted(response_time, weight)─┐ -│ 112 │ -└───────────────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## quantileTDigest {#quantiletdigest} - -Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) kullanarak sayısal veri diz ofisinin [t-dig -est](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritma. - -Maksimum hata %1'dir. Bellek tüketimi `log(n)`, nere `n` değer say isısıdır. Sonuç, sorguyu çalıştırma sırasına bağlıdır ve nondeterministic. - -Fonksiyonun performansı, performanstan daha düşüktür [quantile](#quantile) veya [quantileTiming](#quantiletiming). Durum boyutunun hassasiyete oranı açısından, bu işlev çok daha iyidir `quantile`. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantileTDigest(level)(expr) -``` - -Takma ad: `medianTDigest`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql_reference/data_types/index.md#data_types), [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). - -**Döndürülen değer** - -- Belirtilen seviyenin yaklaşık miktarı. - -Tür: - -- [Float64](../../sql_reference/data_types/float.md) sayısal veri türü girişi için. -- [Tarihli](../../sql_reference/data_types/date.md) giriş değerleri varsa `Date` tür. -- [DateTime](../../sql_reference/data_types/datetime.md) giriş değerleri varsa `DateTime` tür. - -**Örnek** - -Sorgu: - -``` sql -SELECT quantileTDigest(number) FROM numbers(10) -``` - -Sonuç: - -``` text -┌─quantileTDigest(number)─┐ -│ 4.5 │ -└─────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## quantileTDigestWeighted {#quantiletdigestweighted} - -Yaklaşık hesaplar [quantile](https://en.wikipedia.org/wiki/Quantile) kullanarak sayısal veri diz ofisinin [t-dig -est](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) algoritma. İşlev, her sıra üyesinin ağırlığını dikkate alır. Maksimum hata %1'dir. Bellek tüketimi `log(n)`, nere `n` değer say isısıdır. - -Fonksiyonun performansı, performanstan daha düşüktür [quantile](#quantile) veya [quantileTiming](#quantiletiming). Durum boyutunun hassasiyete oranı açısından, bu işlev çok daha iyidir `quantile`. - -Sonuç, sorguyu çalıştırma sırasına bağlıdır ve nondeterministic. - -Çoklu kullanırken `quantile*` bir sorguda farklı düzeylerde işlevler, iç durumları birleştirilmez (diğer bir deyişle, sorgu olabilir daha az verimli çalışır). Bu durumda, kullan [quantiles](#quantiles) işlev. - -**Sözdizimi** - -``` sql -quantileTDigest(level)(expr) -``` - -Takma ad: `medianTDigest`. - -**Parametre** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` aralığında değer `[0.01, 0.99]`. Varsayılan değer: 0.5. Yanında `level=0.5` fonksiyon hesaplar [medyan](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [veri türleri](../../sql_reference/data_types/index.md#data_types), [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**Döndürülen değer** - -- Belirtilen seviyenin yaklaşık miktarı. - -Tür: - -- [Float64](../../sql_reference/data_types/float.md) sayısal veri türü girişi için. -- [Tarihli](../../sql_reference/data_types/date.md) giriş değerleri varsa `Date` tür. -- [DateTime](../../sql_reference/data_types/datetime.md) giriş değerleri varsa `DateTime` tür. - -**Örnek** - -Sorgu: - -``` sql -SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) -``` - -Sonuç: - -``` text -┌─quantileTDigestWeighted(number, 1)─┐ -│ 4.5 │ -└────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [medyan](#median) -- [quantiles](#quantiles) - -## medyan {#median} - -Bu `median*` fonksiyonlar karşılık gelen takma adlardır `quantile*` işlevler. Sayısal bir veri örneğinin medyanını hesaplarlar. - -İşlevler: - -- `median` — Alias for [quantile](#quantile). -- `medianDeterministic` — Alias for [quantileDeterministic](#quantiledeterministic). -- `medianExact` — Alias for [quantileExact](#quantileexact). -- `medianExactWeighted` — Alias for [quantilexactweighted](#quantileexactweighted). -- `medianTiming` — Alias for [quantileTiming](#quantiletiming). -- `medianTimingWeighted` — Alias for [niceletimingweighted](#quantiletimingweighted). -- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). -- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). - -**Örnek** - -Giriş tablosu: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -Sorgu: - -``` sql -SELECT medianDeterministic(val, 1) FROM t -``` - -Sonuç: - -``` text -┌─medianDeterministic(val, 1)─┐ -│ 1.5 │ -└─────────────────────────────┘ -``` - -## quantiles(level1, level2, …)(x) {#quantiles} - -Tüm quantile fonksiyonları da karşılık gelen quantile fonksiyonlarına sahiptir: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. Bu işlevler, listelenen seviyelerin tüm nicelerini tek geçişte hesaplar ve elde edilen değerlerin bir dizisini döndürür. - -## varSamp (x) {#varsampx} - -Miktarı hesaplar `Σ((x - x̅)^2) / (n - 1)`, nere `n` örneklem büyüklüğü ve `x̅`ortalama değer isidir `x`. - -Bir rassal değişkenin varyansının tarafsız bir tahminini temsil eder, eğer geçirilen değerler numunesini oluşturursa. - -Dönüşler `Float64`. Ne zaman `n <= 1`, dönüşler `+∞`. - -## varPop (x) {#varpopx} - -Miktarı hesaplar `Σ((x - x̅)^2) / n`, nere `n` örneklem büyüklüğü ve `x̅`ortalama değer isidir `x`. - -Başka bir deyişle, bir dizi değer için dağılım. Dönüşler `Float64`. - -## stddevSamp(x) {#stddevsampx} - -Sonuç kareköküne eşittir `varSamp(x)`. - -## stddevPop(x) {#stddevpopx} - -Sonuç kareköküne eşittir `varPop(x)`. - -## topK (N) (x) {#topknx} - -Belirtilen sütundaki yaklaşık en sık değerleri bir dizi döndürür. Elde edilen dizi, değerlerin yaklaşık frekansının azalan sırasına göre sıralanır (değerlerin kendileri tarafından değil). - -Uygular [Filtrelenmiş Yerden Tasarruf](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) TopK analiz etmek için algoritma, azaltmak ve birleştirmek algoritması dayalı [Paralel Alan Tasarrufu](https://arxiv.org/pdf/1401.0702.pdf). - -``` sql -topK(N)(column) -``` - -Bu işlev garantili bir sonuç sağlamaz. Bazı durumlarda, hatalar oluşabilir ve en sık kullanılan değerler olmayan sık değerler döndürebilir. - -Biz kullanmanızı öneririz `N < 10` değer; performans büyük ile azalır `N` değerler. Maksimum değeri `N = 65536`. - -**Parametre** - -- ‘N’ dönmek için Öğe sayısıdır. - -Parametre atlanırsa, varsayılan değer 10 kullanılır. - -**Değişkenler** - -- ' x ' – The value to calculate frequency. - -**Örnek** - -Tak thee the [OnTime](../../getting_started/example_datasets/ontime.md) veri kümesi ve üç en sık oluşan değerleri seçin `AirlineID` sütun. - -``` sql -SELECT topK(3)(AirlineID) AS res -FROM ontime -``` - -``` text -┌─res─────────────────┐ -│ [19393,19790,19805] │ -└─────────────────────┘ -``` - -## topKWeighted {#topkweighted} - -Benzer `topK` ancak tamsayı türünde bir ek argüman alır - `weight`. Her değer muhasebeleştirilir `weight` frekans hesaplaması için zamanlar. - -**Sözdizimi** - -``` sql -topKWeighted(N)(x, weight) -``` - -**Parametre** - -- `N` — The number of elements to return. - -**Değişkenler** - -- `x` – The value. -- `weight` — The weight. [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değer** - -Maksimum yaklaşık ağırlık toplamına sahip değerlerin bir dizisini döndürür. - -**Örnek** - -Sorgu: - -``` sql -SELECT topKWeighted(10)(number, number) FROM numbers(1000) -``` - -Sonuç: - -``` text -┌─topKWeighted(10)(number, number)──────────┐ -│ [999,998,997,996,995,994,993,992,991,990] │ -└───────────────────────────────────────────┘ -``` - -## covarSamp(x, y) {#covarsampx-y} - -Değerini hesaplar `Σ((x - x̅)(y - y̅)) / (n - 1)`. - -Float64 Döndürür. Ne zaman `n <= 1`, returns +∞. - -## covarPop (x, y) {#covarpopx-y} - -Değerini hesaplar `Σ((x - x̅)(y - y̅)) / n`. - -## corr(x, y) {#corrx-y} - -Pearson korelasyon katsayısını hesaplar: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. - -## categoricalınformationvalue {#categoricalinformationvalue} - -Değerini hesaplar `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` her kategori için. - -``` sql -categoricalInformationValue(category1, category2, ..., tag) -``` - -Sonuç, ayrık (kategorik) bir özelliğin nasıl olduğunu gösterir `[category1, category2, ...]` değerini öngör aen bir öğrenme modeline katkıda `tag`. - -## simpleLinearRegression {#simplelinearregression} - -Basit (tek boyutlu) doğrusal regresyon gerçekleştirir. - -``` sql -simpleLinearRegression(x, y) -``` - -Parametre: - -- `x` — Column with dependent variable values. -- `y` — Column with explanatory variable values. - -Döndürülen değerler: - -Devamlılar `(a, b)` ortaya çıkan hat linetın `y = a*x + b`. - -**Örnekler** - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ -│ (1,0) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ -│ (1,3) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## stokastiklinearregression {#agg_functions-stochasticlinearregression} - -Bu fonksiyon stokastik doğrusal regresyon uygular. Öğrenme oranı, L2 regularization katsayısı, mini-batch boyutu için özel parametreleri destekler ve ağırlıkları güncellemek için birkaç yöntem vardır ([Adem](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (varsayılan olarak kullanılır), [basit SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [İvme](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). - -### Parametre {#agg_functions-stochasticlinearregression-parameters} - -4 özelleştirilebilir parametre vardır. Onlar sırayla işleve geçirilir, ancak dört varsayılan değerleri kullanılacak geçmek gerek yoktur, ancak iyi bir model bazı parametre ayarlama gerekli. - -``` text -stochasticLinearRegression(1.0, 1.0, 10, 'SGD') -``` - -1. `learning rate` Gradyan iniş adımı gerçekleştirildiğinde adım uzunluğundaki katsayıdır. Çok büyük öğrenme oranı, modelin sonsuz ağırlıklarına neden olabilir. Default is `0.00001`. -2. `l2 regularization coefficient` hangi overfitting önlemek için yardımcı olabilir. Default is `0.1`. -3. `mini-batch size` gradyanların hesaplanacağı ve Gradyan inişinin bir adımını gerçekleştirmek için toplanacağı öğelerin sayısını ayarlar. Saf stokastik iniş bir eleman kullanır, ancak küçük partilere(yaklaşık 10 eleman) sahip olmak degrade adımları daha kararlı hale getirir. Default is `15`. -4. `method for updating weights` onlar : `Adam` (varsayılan olarak), `SGD`, `Momentum`, `Nesterov`. `Momentum` ve `Nesterov` biraz daha fazla hesaplama ve bellek gerektirir, ancak stokastik Gradyan yöntemlerinin yakınsama hızı ve kararlılığı açısından yararlı olurlar. - -### Kullanma {#agg_functions-stochasticlinearregression-usage} - -`stochasticLinearRegression` iki adımda kullanılır: modelin takılması ve yeni verilerin tahmin edilmesi. Modeli sığdırmak ve daha sonra kullanım için durumunu kaydetmek için kullandığımız `-State` temel olarak durumu kurtaran birleştirici (model ağırlıkları, vb.). -Fonksiyonu kullan wedığımızı tahmin etmek [evalMLMethod](../functions/machine_learning_functions.md#machine_learning_methods-evalmlmethod), bir argüman olarak bir durumu yanı sıra tahmin etmek için özellikler alır. - - - -**1.** Uydurma - -Böyle bir sorgu kullanılabilir. - -``` sql -CREATE TABLE IF NOT EXISTS train_data -( - param1 Float64, - param2 Float64, - target Float64 -) ENGINE = Memory; - -CREATE TABLE your_model ENGINE = Memory AS SELECT -stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) -AS state FROM train_data; -``` - -Burada ayrıca veri eklememiz gerekiyor `train_data` Tablo. Parametrelerin sayısı sabit değildir, sadece argümanların sayısına bağlıdır, `linearRegressionState`. Hepsi sayısal değerler olmalıdır. -Hedef değere sahip sütunun(tahmin etmeyi öğrenmek istediğimiz) ilk argüman olarak eklendiğini unutmayın. - -**2.** Öngören - -Bir durumu tabloya kaydettikten sonra, tahmin için birden çok kez kullanabilir, hatta diğer durumlarla birleşebilir ve yeni daha iyi modeller oluşturabiliriz. - -``` sql -WITH (SELECT state FROM your_model) AS model SELECT -evalMLMethod(model, param1, param2) FROM test_data -``` - -Sorgu, tahmin edilen değerlerin bir sütununu döndürür. Not ilk argüman `evalMLMethod` oluyor `AggregateFunctionState` nesne, sonraki özelliklerin sütunlarıdır. - -`test_data` bir tablo gibi mi `train_data` ancak hedef değer içermeyebilir. - -### Not {#agg_functions-stochasticlinearregression-notes} - -1. İki modeli birleştirmek için Kullanıcı böyle bir sorgu oluşturabilir: - `sql SELECT state1 + state2 FROM your_models` - nerede `your_models` tablo her iki modeli de içerir. Bu sorgu yeni dönecektir `AggregateFunctionState` nesne. - -2. Kullanıcı, modeli kaydetmeden oluşturulan modelin ağırlıklarını kendi amaçları için alabilir `-State` birleştirici kullanılır. - `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` - Bu sorgu modele uyacak ve ağırlıklarını geri getirecektir-ilk önce modelin parametrelerine karşılık gelen ağırlıklar, sonuncusu önyargıdır. Yani yukarıdaki örnekte sorgu 3 değer içeren bir sütun döndürecektir. - -**Ayrıca Bakınız** - -- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) -- [Doğrusal ve lojistik regresyonlar arasındaki fark](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} - -Bu işlev stokastik lojistik regresyon uygular. İkili sınıflandırma problemi için kullanılabilir, stochasticLinearRegression ile aynı özel parametreleri destekler ve aynı şekilde çalışır. - -### Parametre {#agg_functions-stochasticlogisticregression-parameters} - -Parametreler tam olarak stochasticLinearRegression ile aynıdır: -`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. -Daha fazla bilgi için bkz. [parametre](#agg_functions-stochasticlinearregression-parameters). - -``` text -stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') -``` - -1. Uydurma - - - - See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. - - Predicted labels have to be in \[-1, 1\]. - -1. Öngören - - - - Using saved state we can predict probability of object having label `1`. - - ``` sql - WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) FROM test_data - ``` - - The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. - - We can also set a bound of probability, which assigns elements to different labels. - - ``` sql - SELECT ans < 1.1 AND ans > 0.5 FROM - (WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) AS ans FROM test_data) - ``` - - Then the result will be labels. - - `test_data` is a table like `train_data` but may not contain target value. - -**Ayrıca Bakınız** - -- [stokastiklinearregression](#agg_functions-stochasticlinearregression) -- [Doğrusal ve lojistik regresyonlar arasındaki fark.](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## groupBitmapAnd {#groupbitmapand} - -Bu VE bir bitmap sütun, Uınt64 tür iade önem, hesaplamaları suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapAnd(expr) -``` - -**Parametre** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tür. - -**Dönüş değeri** - -Bu değer `UInt64` tür. - -**Örnek** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapAnd(z)─┐ -│ 3 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ -│ [6,8,10] │ -└──────────────────────────────────────────────────┘ -``` - -## groupBitmapOr {#groupbitmapor} - -YA da bir bitmap sütun, Uınt64 tür iade önem, hesaplamaları suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql_reference/functions/bitmap_functions.md). Bu eşdeğerdir `groupBitmapMerge`. - -``` sql -groupBitmapOr(expr) -``` - -**Parametre** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tür. - -**Dönüş değeri** - -Bu değer `UInt64` tür. - -**Örnek** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapOr(z)─┐ -│ 15 │ -└──────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ -│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ -└─────────────────────────────────────────────────┘ -``` - -## groupBitmapXor {#groupbitmapxor} - -Bir bitmap sütun, Uınt64 tür iade önem hesaplamaları XOR, suffix ekleme -Devlet, sonra iade [bitmap nesnesi](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapOr(expr) -``` - -**Parametre** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` tür. - -**Dönüş değeri** - -Bu değer `UInt64` tür. - -**Örnek** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapXor(z)─┐ -│ 10 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ -│ [1,3,5,6,8,10,11,13,14,15] │ -└──────────────────────────────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/tr/sql_reference/ansi.md b/docs/tr/sql_reference/ansi.md deleted file mode 120000 index ee0f9c8cb7e..00000000000 --- a/docs/tr/sql_reference/ansi.md +++ /dev/null @@ -1 +0,0 @@ -../../en/sql_reference/ansi.md \ No newline at end of file diff --git a/docs/tr/sql_reference/data_types/aggregatefunction.md b/docs/tr/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index 622e02d9674..00000000000 --- a/docs/tr/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 52 -toc_title: AggregateFunction (ad, types_of_arguments...) ---- - -# AggregateFunction(name, types\_of\_arguments…) {#data-type-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 [materyalize bir görünüm](../../sql_reference/statements/select.md#create-view). Bir toplama işlevi durumu üretmek için ortak yolu ile toplama işlevi çağırarak olduğunu `-State` sonek. Gelecekte toplanmanın nihai sonucunu elde etmek için, aynı toplama işlevini `-Merge`sonek. - -`AggregateFunction` — parametric data type. - -**Parametre** - -- Toplama işlevinin adı. - - If the function is parametric, specify its parameters too. - -- Toplama işlevi bağımsız değişkenleri türleri. - -**Örnek** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -[uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq), anyİf ([herhangi](../../sql_reference/aggregate_functions/reference.md#agg_function-any)+[Eğer](../../sql_reference/aggregate_functions/combinators.md#agg-functions-combinator-if)) ve [quantiles](../../sql_reference/aggregate_functions/reference.md) ClickHouse desteklenen toplam işlevleri vardır. - -## Kullanma {#usage} - -### Veri Ekleme {#data-insertion} - -Veri eklemek için şunları kullanın `INSERT SELECT` agr aggregateega ile `-State`- işlevler. - -**Fonksiyon örnekleri** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -Karşılık gelen fonksiyonların aksine `uniq` ve `quantiles`, `-State`- fonksiyonlar son değer yerine durumu döndürür. Başka bir deyişle, bir değer döndürür `AggregateFunction` tür. - -Sonuç inlarında `SELECT` sorgu, değerleri `AggregateFunction` türü, Tüm ClickHouse çıktı biçimleri için uygulamaya özgü ikili gösterime sahiptir. Örneğin, veri dökümü, `TabSeparated` ile format `SELECT` sorgu, daha sonra bu dökümü kullanarak geri yüklenebilir `INSERT` sorgu. - -### Veri Seçimi {#data-selection} - -Veri seçerken `AggregatingMergeTree` tablo kullanın `GROUP BY` yan tümce ve veri eklerken aynı toplama işlevleri, ancak kullanarak `-Merge`sonek. - -Bir toplama fonksiyonu ile `-Merge` sonek, bir dizi durum alır, bunları birleştirir ve tam veri toplama sonucunu döndürür. - -Örneğin, aşağıdaki iki sorgu aynı sonucu döndürür: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## Kullanım Örneği {#usage-example} - -Görmek [AggregatingMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) motor açıklaması. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/tr/sql_reference/data_types/array.md b/docs/tr/sql_reference/data_types/array.md deleted file mode 100644 index 1db16ebd1fc..00000000000 --- a/docs/tr/sql_reference/data_types/array.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 51 -toc_title: Dizi(T) ---- - -# Dizi(t) {#data-type-array} - -Bir dizi `T`- tip öğeleri. `T` herhangi bir veri türü, bir dizi dahil edilebilir. - -## Bir dizi oluşturma {#creating-an-array} - -Bir dizi oluşturmak için bir işlev kullanabilirsiniz: - -``` sql -array(T) -``` - -Köşeli parantez de kullanabilirsiniz. - -``` sql -[] -``` - -Bir dizi oluşturma örneği: - -``` sql -SELECT array(1, 2) AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName(array(1, 2))─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴─────────────────────────┘ -``` - -``` sql -SELECT [1, 2] AS x, toTypeName(x) -``` - -``` text -┌─x─────┬─toTypeName([1, 2])─┐ -│ [1,2] │ Array(UInt8) │ -└───────┴────────────────────┘ -``` - -## Veri Türleri İle Çalışma {#working-with-data-types} - -Anında bir dizi oluştururken, ClickHouse bağımsız değişken türünü otomatik olarak listelenen tüm bağımsız değişkenleri depolayabilen en dar veri türü olarak tanımlar. Eğer herhangi bir [Nullable](nullable.md#data_type-nullable) veya edebi [NULL](../../sql_reference/syntax.md#null-literal) değerler, bir dizi öğesinin türü de olur [Nullable](nullable.md). - -ClickHouse veri türünü belirleyemedi, bir özel durum oluşturur. Örneğin, aynı anda dizeler ve sayılarla bir dizi oluşturmaya çalışırken bu olur (`SELECT array(1, 'a')`). - -Otomatik veri türü algılama örnekleri: - -``` sql -SELECT array(1, 2, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ -│ [1,2,NULL] │ Array(Nullable(UInt8)) │ -└────────────┴───────────────────────────────┘ -``` - -Uyumsuz veri türleri dizisi oluşturmaya çalışırsanız, ClickHouse bir özel durum atar: - -``` sql -SELECT array(1, 'a') -``` - -``` text -Received exception from server (version 1.1.54388): -Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/array/) diff --git a/docs/tr/sql_reference/data_types/date.md b/docs/tr/sql_reference/data_types/date.md deleted file mode 100644 index fd47a49313c..00000000000 --- a/docs/tr/sql_reference/data_types/date.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 47 -toc_title: Tarihli ---- - -# Tarihli {#date} - -Tarihli. 1970-01-01 (imzasız) gün sayısı olarak iki bayt olarak saklanır. Unix döneminin başlangıcından hemen sonra, derleme aşamasında bir sabit tarafından tanımlanan üst eşiğe kadar değerlerin depolanmasına izin verir (şu anda, bu 2106 yılına kadar, ancak tam olarak desteklenen son yıl 2105'tir). -Minimum değer 0000-00-00 olarak çıktıdır. - -Tarih değeri saat dilimi olmadan depolanır. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/date/) diff --git a/docs/tr/sql_reference/data_types/datetime.md b/docs/tr/sql_reference/data_types/datetime.md deleted file mode 100644 index bc5feeed3b5..00000000000 --- a/docs/tr/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 48 -toc_title: DateTime ---- - -# Datetime {#data_type-datetime} - -Bir takvim tarih ve bir günün bir saat olarak ifade edilebilir, zaman içinde bir anlık saklamak için izin verir. - -Sözdizimi: - -``` sql -DateTime([timezone]) -``` - -Desteklenen değerler aralığı: \[1970-01-01 00:00:00, 2105-12-31 23:59:59\]. - -Çözünürlük: 1 saniye. - -## Kullanım Açıklamaları {#usage-remarks} - -Zaman içindeki nokta bir [Unix zaman damgası](https://en.wikipedia.org/wiki/Unix_time), ne olursa olsun saat dilimi veya gün ışığından yararlanma saati. Ayrıca, `DateTime` tür, tüm sütun için aynı olan saat dilimini depolayabilir, bu da `DateTime` tür değerleri metin biçiminde görüntülenir ve dizeler olarak belirtilen değerlerin nasıl ayrıştırılır (‘2020-01-01 05:00:01’). Saat dilimi tablo (veya resultset) satırlarında depolanır, ancak sütun meta verileri depolanır. -Desteklenen saat dilimlerinin bir listesi şu adreste bulunabilir: [IANA Saat Dilimi veritabanı](https://www.iana.org/time-zones). -Bu `tzdata` paket, içeren [IANA Saat Dilimi veritabanı](https://www.iana.org/time-zones), sisteme Kurul .malıdır. Kullan... `timedatectl list-timezones` yerel bir sistem tarafından bilinen zaman dilimlerini listelemek için komut. - -İçin bir saat dilimi açıkça ayarlayabilirsiniz `DateTime`- bir tablo oluştururken sütunları yazın. Saat dilimi ayarlanmamışsa, ClickHouse değerini kullanır [saat dilimi](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) sunucu ayarlarında veya ClickHouse sunucusunun başlatıldığı anda işletim sistemi ayarlarında parametre. - -Bu [clickhouse-müşteri](../../interfaces/cli.md) veri türünü başlatırken bir saat dilimi açıkça ayarlanmamışsa, sunucu saat dilimini varsayılan olarak uygular. İstemci saat dilimini kullanmak için `clickhouse-client` ile... `--use_client_time_zone` parametre. - -ClickHouse çıkış değerleri `YYYY-MM-DD hh:mm:ss` varsayılan olarak metin biçimi. Çıkış ile değiştirebilirsiniz [formatDateTime](../../sql_reference/functions/date_time_functions.md#formatdatetime) işlev. - -Clickhouse'a veri eklerken, Tarih ve saat dizelerinin farklı biçimlerini kullanabilirsiniz. [date\_time\_input\_format](../../operations/settings/settings.md#settings-date_time_input_format) ayar. - -## Örnekler {#examples} - -**1.** Bir tablo ile bir tablo oluşturma `DateTime`- sütun yazın ve içine veri ekleme: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime('Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog; -``` - -``` sql -INSERT INTO dt Values (1546300800, 1), ('2019-01-01 00:00:00', 2); -``` - -``` sql -SELECT * FROM dt; -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -- Bir tamsayı olarak datetime eklerken, Unıx Zaman Damgası (UTC) olarak kabul edilir. `1546300800` temsil etmek `'2019-01-01 00:00:00'` UTC. Ancak, `timestamp` sütun vardır `Europe/Moscow` (UTC+3) belirtilen zaman dilimi, dize olarak çıkış yaparken değer olarak gösterilecektir `'2019-01-01 03:00:00'` -- Dize değerini datetime olarak eklerken, sütun saat diliminde olduğu kabul edilir. `'2019-01-01 00:00:00'` will gibi muamele `Europe/Moscow` saat dilimi ve farklı kaydedildi `1546290000`. - -**2.** Üzerinde filtreleme `DateTime` değerler - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime('2019-01-01 00:00:00', 'Europe/Moscow') -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00 │ 2 │ -└─────────────────────┴──────────┘ -``` - -`DateTime` sütun değerleri, bir dize değeri kullanılarak filtrelenebilir `WHERE` yüklem. Dönüştürül willecektir `DateTime` otomatik olarak: - -``` sql -SELECT * FROM dt WHERE timestamp = '2019-01-01 00:00:00' -``` - -``` text -┌───────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00 │ 1 │ -└─────────────────────┴──────────┘ -``` - -**3.** Bir saat dilimi almak `DateTime`- type Col columnum columnn: - -``` sql -SELECT toDateTime(now(), 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────column─┬─x─────────────────────────┐ -│ 2019-10-16 04:12:04 │ DateTime('Europe/Moscow') │ -└─────────────────────┴───────────────────────────┘ -``` - -**4.** Zaman dilimi dönüştürme - -``` sql -SELECT -toDateTime(timestamp, 'Europe/London') as lon_time, -toDateTime(timestamp, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────lon_time──┬────────────mos_time─┐ -│ 2019-01-01 00:00:00 │ 2019-01-01 03:00:00 │ -│ 2018-12-31 21:00:00 │ 2019-01-01 00:00:00 │ -└─────────────────────┴─────────────────────┘ -``` - -## Ayrıca Bakınız {#see-also} - -- [Tip dönüştürme fonksiyonları](../../sql_reference/functions/type_conversion_functions.md) -- [Tarih ve saatlerle çalışmak için işlevler](../../sql_reference/functions/date_time_functions.md) -- [Dizilerle çalışmak için işlevler](../../sql_reference/functions/array_functions.md) -- [Bu `date_time_input_format` ayar](../../operations/settings/settings.md#settings-date_time_input_format) -- [Bu `timezone` sunucu yapılandırma parametresi](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Tarih ve saatlerle çalışmak için operatörler](../../sql_reference/operators.md#operators-datetime) -- [Bu `Date` veri türü](date.md) - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/datetime/) diff --git a/docs/tr/sql_reference/data_types/datetime64.md b/docs/tr/sql_reference/data_types/datetime64.md deleted file mode 100644 index 82839e174da..00000000000 --- a/docs/tr/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 49 -toc_title: DateTime64 ---- - -# Datetime64 {#data_type-datetime64} - -Tanımlanmış alt saniye hassasiyetle, bir takvim tarihi ve bir günün saati olarak ifade edilebilir, zaman içinde bir anlık saklamak için izin verir - -Kene boyutu (hassas): 10-hassaslık ikincilikler - -Sözdizimi: - -``` sql -DateTime64(precision, [timezone]) -``` - -DAHİLİ olarak, verileri bir dizi olarak saklar ‘ticks’ epoch başlangıçtan beri (1970-01-01 00:00:00 UTC) Int64 olarak. Kene çözünürlüğü hassasiyet parametresi tarafından belirlenir. Ayrıca, `DateTime64` tür, tüm sütun için aynı olan saat dilimini depolayabilir, bu da `DateTime64` tür değerleri metin biçiminde görüntülenir ve dizeler olarak belirtilen değerlerin nasıl ayrıştırılır (‘2020-01-01 05:00:01.000’). Saat dilimi tablo (veya resultset) satırlarında depolanır, ancak sütun meta verileri depolanır. Ayrıntıları görün [DateTime](datetime.md). - -## Örnekler {#examples} - -**1.** İle bir tablo oluşturma `DateTime64`- sütun yazın ve içine veri ekleme: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- Bir tamsayı olarak datetime eklerken, uygun şekilde ölçeklendirilmiş bir Unıx Zaman Damgası (UTC) olarak kabul edilir. `1546300800000` (hassas 3 ile) temsil eder `'2019-01-01 00:00:00'` UTC. Ancak, `timestamp` sütun vardır `Europe/Moscow` (UTC+3) belirtilen zaman dilimi, bir dize olarak çıkış yaparken değer olarak gösterilir `'2019-01-01 03:00:00'` -- Dize değerini datetime olarak eklerken, sütun saat diliminde olduğu kabul edilir. `'2019-01-01 00:00:00'` will gibi muamele `Europe/Moscow` saat dilimi ve olarak saklanır `1546290000000`. - -**2.** Üzerinde filtreleme `DateTime64` değerler - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -Aksine `DateTime`, `DateTime64` değerler dönüştürülmez `String` otomatik olarak - -**3.** Bir saat dilimi almak `DateTime64`- tip değeri: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** Zaman dilimi dönüştürme - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## Ayrıca Bakınız {#see-also} - -- [Tip dönüştürme fonksiyonları](../../sql_reference/functions/type_conversion_functions.md) -- [Tarih ve saatlerle çalışmak için işlevler](../../sql_reference/functions/date_time_functions.md) -- [Dizilerle çalışmak için işlevler](../../sql_reference/functions/array_functions.md) -- [Bu `date_time_input_format` ayar](../../operations/settings/settings.md#settings-date_time_input_format) -- [Bu `timezone` sunucu yapılandırma parametresi](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [Tarih ve saatlerle çalışmak için operatörler](../../sql_reference/operators.md#operators-datetime) -- [`Date` veri türü](date.md) -- [`DateTime` veri türü](datetime.md) diff --git a/docs/tr/sql_reference/data_types/decimal.md b/docs/tr/sql_reference/data_types/decimal.md deleted file mode 100644 index 6ec15a52e12..00000000000 --- a/docs/tr/sql_reference/data_types/decimal.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 42 -toc_title: "Ondal\u0131k" ---- - -# Ondalık(P, S), Decimal32 (S), Decimal64( S), Decimal128 (S) {#decimalp-s-decimal32s-decimal64s-decimal128s} - -Ekleme, çıkarma ve çarpma işlemleri sırasında hassasiyeti koruyan imzalı sabit noktalı sayılar. Bölünme için en az önemli basamak atılır (yuvarlatılmamış). - -## Parametre {#parameters} - -- P-hassas. Geçerli Aralık: \[1: 38 \]. Kaç ondalık basamak sayısı (kesir dahil) olabilir belirler. -- S-scale. Geçerli Aralık: \[0: P\]. Kaç ondalık basamak kesir olabilir belirler. - -P parametre değerine bağlı olarak ondalık (P, S) bir eşanlamlıdır: -- P \[ 1 : 9\] - Decimal32(S) için) -- P \[ 10 : 18\] - Decimal64(ler) için) -- P \[ 19 : 38\] - Decimal128(ler) için) - -## Ondalık değer aralıkları {#decimal-value-ranges} - -- Decimal32(S) - ( -1 \* 10^(9 - S), 1 \* 10^(9-S) ) -- Decimal64(S) - ( -1 \* 10^(18 - S), 1 \* 10^(18-S) ) -- Decimal128(S) - ( -1 \* 10^(38 - S), 1 \* 10^(38-S) ) - -Örneğin, Decimal32 (4) -99999.9999 99999.9999 0.0001 adım ile sayılar içerebilir. - -## İç temsil {#internal-representation} - -Dahili veri, ilgili bit genişliğine sahip normal imzalı tamsayılar olarak temsil edilir. Bellekte saklanabilen gerçek değer aralıkları, yukarıda belirtilenden biraz daha büyüktür ve yalnızca bir dizeden dönüştürmede kontrol edilir. - -Modern CPU 128-bit tamsayıları doğal olarak desteklemediğinden, Decimal128 üzerindeki işlemler öykünülür. Bu Decimal128 nedeniyle Decimal32/Decimal64'ten önemli ölçüde daha yavaş çalışır. - -## İşlemler ve sonuç türü {#operations-and-result-type} - -Ondalık sonuçtaki ikili işlemler daha geniş sonuç türünde (herhangi bir bağımsız değişken sırası ile) sonuçlanır. - -- Decimal64(S1) Decimal32 (S2) - \> Decimal64 (S) -- Decimal128(S1) Decimal32 (S2) - \> Decimal128(S) -- Decimal128(S1) Decimal64 (S2) - \> Decimal128(S) - -Ölçek kuralları: - -- ekleme, çıkarma: s = max (S1, S2). -- multuply: S = S1 + S2. -- böl: S = S1. - -Ondalık ve tamsayılar arasındaki benzer işlemler için sonuç, bir bağımsız değişkenle aynı boyutta ondalık olur. - -Ondalık ve Float32 / Float64 arasındaki işlemler tanımlanmamıştır. Bunlara ihtiyacınız varsa, todecimal32, toDecimal64, toDecimal128 veya toFloat32, toFloat64 builtins kullanarak bağımsız değişkenlerden birini açıkça yayınlayabilirsiniz. Sonucun hassasiyeti kaybedeceğini ve tür dönüşümünün hesaplamalı olarak pahalı bir işlem olduğunu unutmayın. - -Float64 (örneğin, var veya stddev) ondalık dönüş sonucu bazı işlevler. Ara hesaplamalar hala Float64 ve aynı değerlere sahip ondalık girişler arasında farklı sonuçlara yol açabilecek ondalık olarak gerçekleştirilebilir. - -## Taşma kontrolleri {#overflow-checks} - -Ondalık hesaplamalar sırasında tamsayı taşmaları gerçekleşebilir. Bir kesirdeki aşırı rakamlar atılır (yuvarlatılmamış). Tamsayı bölümünde aşırı basamak bir istisna yol açacaktır. - -``` sql -SELECT toDecimal32(2, 4) AS x, x / 3 -``` - -``` text -┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ -│ 2.0000 │ 0.6666 │ -└────────┴──────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, x * x -``` - -``` text -DB::Exception: Scale is out of bounds. -``` - -``` sql -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -DB::Exception: Decimal math overflow. -``` - -Taşma kontrolleri operasyonların yavaşlamasına neden olur. Taşmaların mümkün olmadığı biliniyorsa, kontrolleri kullanarak devre dışı bırakmak mantıklıdır `decimal_check_overflow` ayar. Kontroller devre dışı bırakıldığında ve taşma gerçekleştiğinde, sonuç yanlış olacaktır: - -``` sql -SET decimal_check_overflow = 0; -SELECT toDecimal32(4.2, 8) AS x, 6 * x -``` - -``` text -┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ -│ 4.20000000 │ -17.74967296 │ -└────────────┴──────────────────────────────────┘ -``` - -Taşma kontrolleri sadece aritmetik işlemlerde değil, değer karşılaştırmasında da gerçekleşir: - -``` sql -SELECT toDecimal32(1, 8) < 100 -``` - -``` text -DB::Exception: Can't compare. -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/decimal/) diff --git a/docs/tr/sql_reference/data_types/domains/overview.md b/docs/tr/sql_reference/data_types/domains/overview.md deleted file mode 100644 index 97e3ef5018a..00000000000 --- a/docs/tr/sql_reference/data_types/domains/overview.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 58 -toc_title: "Genel bak\u0131\u015F" ---- - -# Etkiler {#domains} - -Etki alanları, varolan temel türün üstüne bazı ek özellikler ekleyen, ancak temel veri türünün kablolu ve disk üstü biçimini sağlam bırakan özel amaçlı türlerdir. Şu anda, ClickHouse kullanıcı tanımlı etki alanlarını desteklemiyor. - -Örneğin, ilgili taban türünün kullanılabileceği her yerde etki alanlarını kullanabilirsiniz: - -- Etki alanı türünde bir sütun oluşturma -- Alan sütunundan/alanına değerleri okuma / yazma -- Bir temel türü bir dizin olarak kullanılabilir, bir dizin olarak kullanın -- Etki alanı sütun değerleri ile çağrı fonksiyonları - -### Alanların ekstra özellikleri {#extra-features-of-domains} - -- Açık sütun türü adı `SHOW CREATE TABLE` veya `DESCRIBE TABLE` -- İle insan dostu format inputtan giriş `INSERT INTO domain_table(domain_column) VALUES(...)` -- İçin insan dostu forma outputta çıktı `SELECT domain_column FROM domain_table` -- Harici bir kaynaktan insan dostu biçimde veri yükleme: `INSERT INTO domain_table FORMAT CSV ...` - -### Sınırlamalar {#limitations} - -- Temel türün dizin sütununu etki alanı türüne dönüştürülemiyor `ALTER TABLE`. -- Başka bir sütun veya tablodan veri eklerken dize değerlerini dolaylı olarak etki alanı değerlerine dönüştüremez. -- Etki alanı, depolanan değerler üzerinde hiçbir kısıtlama ekler. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/tr/sql_reference/data_types/enum.md b/docs/tr/sql_reference/data_types/enum.md deleted file mode 100644 index 65c687835dc..00000000000 --- a/docs/tr/sql_reference/data_types/enum.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 50 -toc_title: Enum ---- - -# Enum {#enum} - -Adlandırılmış değerlerden oluşan numaralandırılmış tür. - -Adlandırılmış değerler olarak bildirilmelidir `'string' = integer` çiftliler. ClickHouse yalnızca sayıları saklar, ancak adları aracılığıyla değerlerle işlemleri destekler. - -ClickHouse destekler: - -- 8-bit `Enum`. En fazla 256 değerleri numaralandırılmış içerebilir `[-128, 127]` Aralık. -- 16-bit `Enum`. En fazla 65536 değerleri numaralandırılmış içerebilir `[-32768, 32767]` Aralık. - -ClickHouse otomatik olarak türünü seçer `Enum` veri eklendiğinde. Ayrıca kullanabilirsiniz `Enum8` veya `Enum16` türleri depolama boyutunda emin olmak için. - -## Kullanım Örnekleri {#usage-examples} - -Burada bir tablo oluşturuyoruz `Enum8('hello' = 1, 'world' = 2)` type Col columnum columnn: - -``` sql -CREATE TABLE t_enum -( - x Enum('hello' = 1, 'world' = 2) -) -ENGINE = TinyLog -``` - -Sütun `x` yalnızca tür tanımında listelenen değerleri depolayabilir: `'hello'` veya `'world'`. Başka bir değer kaydetmeye çalışırsanız, ClickHouse bir özel durum yükseltir. Bunun için 8-bit boyutu `Enum` otomatik olarak seçilir. - -``` sql -INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') -``` - -``` text -Ok. -``` - -``` sql -INSERT INTO t_enum values('a') -``` - -``` text -Exception on client: -Code: 49. DB::Exception: Unknown element 'a' for type Enum('hello' = 1, 'world' = 2) -``` - -Tablodan veri sorguladığınızda, ClickHouse dize değerleri `Enum`. - -``` sql -SELECT * FROM t_enum -``` - -``` text -┌─x─────┐ -│ hello │ -│ world │ -│ hello │ -└───────┘ -``` - -Satırların sayısal eşdeğerlerini görmeniz gerekiyorsa, `Enum` tamsayı türüne değer. - -``` sql -SELECT CAST(x, 'Int8') FROM t_enum -``` - -``` text -┌─CAST(x, 'Int8')─┐ -│ 1 │ -│ 2 │ -│ 1 │ -└─────────────────┘ -``` - -Bir sorguda bir Enum değeri oluşturmak için, ayrıca kullanmanız gerekir `CAST`. - -``` sql -SELECT toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)')) -``` - -``` text -┌─toTypeName(CAST('a', 'Enum(\'a\' = 1, \'b\' = 2)'))─┐ -│ Enum8('a' = 1, 'b' = 2) │ -└─────────────────────────────────────────────────────┘ -``` - -## Genel Kurallar ve kullanım {#general-rules-and-usage} - -Değerlerin her birine aralıkta bir sayı atanır `-128 ... 127` için `Enum8` veya aralık inta `-32768 ... 32767` için `Enum16`. Tüm dizeler ve sayılar farklı olmalıdır. Boş bir dize izin verilir. Bu tür belirtilmişse (bir tablo tanımında), sayılar rasgele bir sırada olabilir. Ancak, sipariş önemli değil. - -Ne dize ne de sayısal değer bir `Enum` olabilir [NULL](../../sql_reference/syntax.md). - -Bir `Enum` içerdiği olabilir [Nullable](nullable.md) tür. Yani sorguyu kullanarak bir tablo oluşturursanız - -``` sql -CREATE TABLE t_enum_nullable -( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) -) -ENGINE = TinyLog -``` - -bu mağaza değil sadece `'hello'` ve `'world'`, ama `NULL`, yanında. - -``` sql -INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) -``` - -RAM, bir `Enum` sütun aynı şekilde saklanır `Int8` veya `Int16` karşılık gelen sayısal değerlerin. - -Metin formunda okurken, ClickHouse değeri bir dize olarak ayrıştırır ve karşılık gelen dizeyi Enum değerleri kümesinden arar. Bulunmazsa, bir istisna atılır. Metin biçiminde okurken, dize okunur ve karşılık gelen sayısal değer aranır. Bulunmazsa bir istisna atılır. -Metin formunda yazarken, değeri karşılık gelen dize olarak yazar. Sütun verileri çöp içeriyorsa (geçerli kümeden olmayan sayılar), bir özel durum atılır. İkili formda okurken ve yazarken, Int8 ve Int16 veri türleri ile aynı şekilde çalışır. -Örtülü varsayılan değer, en düşük sayıya sahip değerdir. - -Sırasında `ORDER BY`, `GROUP BY`, `IN`, `DISTINCT` ve böylece, Enumlar karşılık gelen sayılarla aynı şekilde davranır. Örneğin, sipariş onları sayısal olarak sıralar. Eşitlik ve karşılaştırma işleçleri, alttaki sayısal değerler üzerinde yaptıkları gibi Enumlarda aynı şekilde çalışır. - -Enum değerleri sayılarla karşılaştırılamaz. Enums sabit bir dize ile karşılaştırılabilir. Karşılaştırılan dize Enum için geçerli bir değer değilse, bir özel durum atılır. IN operatörü, sol taraftaki Enum ve sağ taraftaki bir dizi dizeyle desteklenir. Dizeler, karşılık gelen Enumun değerleridir. - -Most numeric and string operations are not defined for Enum values, e.g. adding a number to an Enum or concatenating a string to an Enum. -Ancak, Enum doğal bir `toString` dize değerini döndüren işlev. - -Enum değerleri de kullanarak sayısal türlere dönüştürülebilir `toT` fonksiyon, burada t sayısal bir türdür. T enum'un temel sayısal türüne karşılık geldiğinde, bu dönüşüm sıfır maliyetlidir. -Enum türü, yalnızca değer kümesi değiştirilirse, alter kullanılarak maliyet olmadan değiştirilebilir. Her iki ekleme ve Alter kullanarak Enum üyeleri kaldırmak mümkündür (kaldırma yalnızca kaldırılan değer tabloda hiç kullanılmadıysa güvenlidir). Bir koruma olarak, önceden tanımlanmış bir Enum üyesinin sayısal değerini değiştirmek bir istisna atar. - -ALTER kullanarak, bir Enum8 için bir Enum16 veya tam tersi, Int8 için Int16 değiştirme gibi değiştirmek mümkündür. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/enum/) diff --git a/docs/tr/sql_reference/data_types/fixedstring.md b/docs/tr/sql_reference/data_types/fixedstring.md deleted file mode 100644 index bf716f4d591..00000000000 --- a/docs/tr/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 45 -toc_title: FixedString(N) ---- - -# Fixedstring {#fixedstring} - -Sabit uzunlukta bir dize `N` bayt (ne karakter ne de kod noktaları). - -Bir sütun bildirmek için `FixedString` yazın, aşağıdaki sözdizimini kullanın: - -``` sql - FixedString(N) -``` - -Nerede `N` doğal bir sayıdır. - -Bu `FixedString` veri tam olarak uzunluğa sahip olduğunda tür etkilidir `N` baytlar. Diğer tüm durumlarda, verimliliği düşürmesi muhtemeldir. - -Verimli bir şekilde depolan theabilen değerlere örnekler `FixedString`- yazılan sütunlar: - -- IP adreslerinin ikili gösterimi (`FixedString(16)` IPv6 için). -- Language codes (ru\_RU, en\_US … ). -- Currency codes (USD, RUB … ). -- Karma ikili gösterimi (`FixedString(16)` MD5 için, `FixedString(32)` SHA256 için). - -UUID değerlerini depolamak için [UUID](uuid.md) veri türü. - -Verileri eklerken, ClickHouse: - -- Dize daha az içeriyorsa, boş bayt ile bir dize tamamlar `N` baytlar. -- Atar `Too large value for FixedString(N)` dize birden fazla içeriyorsa, özel durum `N` baytlar. - -Verileri seçerken, ClickHouse dize sonunda boş bayt kaldırmaz. Eğer kullanıyorsanız `WHERE` yan tümcesi, null bayt el ile eşleştirmek için eklemelisiniz `FixedString` değer. Kullanımı için aşağıdaki örnek, nasıl gösterir `WHERE` fık withra ile `FixedString`. - -Aşağıdaki tabloyu tek ile düşünelim `FixedString(2)` sütun: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -Sorgu `SELECT * FROM FixedStringTable WHERE a = 'b'` sonuç olarak herhangi bir veri döndürmez. Filtre desenini boş baytlarla tamamlamalıyız. - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -Bu davranış için MySQL farklıdır `CHAR` tür (burada dizeler boşluklarla doldurulur ve boşluklar çıktı için kaldırılır). - -Not uzunluğu `FixedString(N)` değer sabittir. Bu [uzunluk](../../sql_reference/functions/array_functions.md#array_functions-length) fonksiyon döndürür `N` hatta eğer `FixedString(N)` değer yalnızca boş baytlarla doldurulur, ancak [boş](../../sql_reference/functions/string_functions.md#empty) fonksiyon döndürür `1` bu durumda. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/tr/sql_reference/data_types/float.md b/docs/tr/sql_reference/data_types/float.md deleted file mode 100644 index 0b5bd76be86..00000000000 --- a/docs/tr/sql_reference/data_types/float.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 41 -toc_title: Float32, Float64 ---- - -# Float32, Float64 {#float32-float64} - -[Kayan nokta numaraları](https://en.wikipedia.org/wiki/IEEE_754). - -Türleri C türlerine eşdeğerdir: - -- `Float32` - `float` -- `Float64` - `double` - -Verileri mümkün olduğunda tamsayı biçiminde saklamanızı öneririz. Örneğin, sabit hassas sayıları parasal tutarlar veya sayfa yükleme süreleri gibi milisaniye cinsinden tamsayı değerlerine dönüştürün. - -## Kayan noktalı sayıları kullanma {#using-floating-point-numbers} - -- Kayan noktalı sayılarla yapılan hesaplamalar yuvarlama hatası oluşturabilir. - - - -``` sql -SELECT 1 - 0.9 -``` - -``` text -┌───────minus(1, 0.9)─┐ -│ 0.09999999999999998 │ -└─────────────────────┘ -``` - -- Hesaplamanın sonucu hesaplama yöntemine (bilgisayar sisteminin işlemci tipi ve mimarisi) bağlıdır. -- Kayan nokta hesaplamaları, sonsuzluk gibi sayılarla sonuçlanabilir (`Inf`) ve “not-a-number” (`NaN`). Hesaplamaların sonuçlarını işlerken bu dikkate alınmalıdır. -- Kayan noktalı sayıları metinden ayrıştırırken, sonuç en yakın makine tarafından temsil edilebilir sayı olmayabilir. - -## N andan ve In andf {#data_type-float-nan-inf} - -Standart SQL aksine, ClickHouse kayan noktalı sayılar aşağıdaki kategorileri destekler: - -- `Inf` – Infinity. - - - -``` sql -SELECT 0.5 / 0 -``` - -``` text -┌─divide(0.5, 0)─┐ -│ inf │ -└────────────────┘ -``` - -- `-Inf` – Negative infinity. - - - -``` sql -SELECT -0.5 / 0 -``` - -``` text -┌─divide(-0.5, 0)─┐ -│ -inf │ -└─────────────────┘ -``` - -- `NaN` – Not a number. - - - -``` sql -SELECT 0 / 0 -``` - -``` text -┌─divide(0, 0)─┐ -│ nan │ -└──────────────┘ -``` - - See the rules for `NaN` sorting in the section [ORDER BY clause](../sql_reference/statements/select.md). - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/float/) diff --git a/docs/tr/sql_reference/data_types/nested_data_structures/nested.md b/docs/tr/sql_reference/data_types/nested_data_structures/nested.md deleted file mode 100644 index 8cd2dc3a558..00000000000 --- a/docs/tr/sql_reference/data_types/nested_data_structures/nested.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 57 -toc_title: "\u0130\xE7 \u0130\xE7e (Name1 Type1, Name2 Type2,...)" ---- - -# Nested(name1 Type1, Name2 Type2, …) {#nestedname1-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.md) sorgu. Her tablo satırı, iç içe geçmiş veri yapısındaki herhangi bir sayıda satıra karşılık gelebilir. - -Örnek: - -``` sql -CREATE TABLE test.visits -( - CounterID UInt32, - StartDate Date, - Sign Int8, - IsNew UInt8, - VisitID UInt64, - UserID UInt64, - ... - Goals Nested - ( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32 - ), - ... -) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) -``` - -Bu örnek bildirir `Goals` dönüşümlerle ilgili verileri içeren iç içe veri yapısı (ulaşılan hedefler). Her satır içinde ‘visits’ tablo sıfır veya dönüşüm herhangi bir sayıda karşılık gelebilir. - -Sadece tek bir yuvalama seviyesi desteklenir. Diziler içeren iç içe geçmiş yapıların sütunları çok boyutlu dizilere eşdeğerdir, bu nedenle sınırlı desteğe sahiptirler (bu sütunları MergeTree altyapısı ile tablolarda depolamak için destek yoktur). - -Çoğu durumda, iç içe geçmiş bir veri yapısıyla çalışırken, sütunları bir nokta ile ayrılmış sütun adlarıyla belirtilir. Bu sütunlar eşleşen türleri bir dizi oluşturur. Tek bir iç içe geçmiş veri yapısının tüm sütun dizileri aynı uzunluğa sahiptir. - -Örnek: - -``` sql -SELECT - Goals.ID, - Goals.EventTime -FROM test.visits -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ -│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ -│ [1073752] │ ['2014-03-17 00:28:25'] │ -│ [1073752] │ ['2014-03-17 10:46:20'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ -│ [] │ [] │ -│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ -│ [] │ [] │ -│ [] │ [] │ -│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ -└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -İç içe geçmiş bir veri yapısını aynı uzunlukta birden çok sütun dizisi kümesi olarak düşünmek en kolay yoldur. - -Bir SELECT sorgusunun tek tek sütunlar yerine tüm iç içe geçmiş veri yapısının adını belirtebileceği tek yer array JOIN yan tümcesi. Daha fazla bilgi için, bkz. “ARRAY JOIN clause”. Örnek: - -``` sql -SELECT - Goal.ID, - Goal.EventTime -FROM test.visits -ARRAY JOIN Goals AS Goal -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goal.ID─┬──────Goal.EventTime─┐ -│ 1073752 │ 2014-03-17 16:38:10 │ -│ 591325 │ 2014-03-17 16:38:48 │ -│ 591325 │ 2014-03-17 16:42:27 │ -│ 1073752 │ 2014-03-17 00:28:25 │ -│ 1073752 │ 2014-03-17 10:46:20 │ -│ 1073752 │ 2014-03-17 13:59:20 │ -│ 591325 │ 2014-03-17 22:17:55 │ -│ 591325 │ 2014-03-17 22:18:07 │ -│ 591325 │ 2014-03-17 22:18:51 │ -│ 1073752 │ 2014-03-17 11:37:06 │ -└─────────┴─────────────────────┘ -``` - -İç içe geçmiş veri yapısının tamamı için SELECT gerçekleştiremezsiniz. Yalnızca bir parçası olan tek tek sütunları açıkça listeleyebilirsiniz. - -Bir INSERT sorgusu için, iç içe geçmiş bir veri yapısının tüm bileşen sütun dizilerini ayrı ayrı (tek tek sütun dizileri gibi) iletmelisiniz. Ekleme sırasında, sistem aynı uzunluğa sahip olduklarını kontrol eder. - -Bir tanımlama sorgusu için, iç içe geçmiş bir veri yapısındaki sütunlar aynı şekilde ayrı olarak listelenir. - -İç içe geçmiş bir veri yapısındaki öğeler için ALTER sorgusu sınırlamaları vardır. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/nested_data_structures/nested/) diff --git a/docs/tr/sql_reference/data_types/nullable.md b/docs/tr/sql_reference/data_types/nullable.md deleted file mode 100644 index 1950e2b1b77..00000000000 --- a/docs/tr/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 54 -toc_title: Nullable ---- - -# Nullable (typename) {#data_type-nullable} - -Özel işaretleyici saklamak için izin verir ([NULL](../../sql_reference/syntax.md)) bu ifade eder “missing value” tarafından izin verilen normal değerlerin yanında `TypeName`. Örneğin, bir `Nullable(Int8)` tipi sütun saklayabilirsiniz `Int8` değerleri yazın ve değeri olmayan satırlar depolayacaktır `NULL`. - -İçin... `TypeName`, bileşik veri türlerini kullanamazsınız [Dizi](array.md) ve [Demet](tuple.md). Bileşik veri türleri şunları içerebilir `Nullable` gibi tür değerleri `Array(Nullable(Int8))`. - -A `Nullable` tür alanı tablo dizinlerine dahil edilemez. - -`NULL` herhangi biri için varsayılan değer mi `Nullable` ClickHouse sunucu yapılandırmasında aksi belirtilmediği sürece yazın. - -## Depolama Özellikleri {#storage-features} - -İçermek `Nullable` bir tablo sütunundaki değerleri yazın, ClickHouse ile ayrı bir dosya kullanır `NULL` değerleri ile normal dosyaya ek olarak Maskeler. Maskeli girişleri ClickHouse ayırt izin dosyası `NULL` ve her tablo satırı için karşılık gelen veri türünün varsayılan değeri. Ek bir dosya nedeniyle, `Nullable` sütun, benzer bir normal olana kıyasla ek depolama alanı tüketir. - -!!! info "Not" - Kullanım `Nullable` neredeyse her zaman performansı olumsuz etkiler, veritabanlarınızı tasarlarken bunu aklınızda bulundurun. - -## Kullanım Örneği {#usage-example} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y FROM t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/tr/sql_reference/data_types/simpleaggregatefunction.md b/docs/tr/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 120000 index 02fad64d50e..00000000000 --- a/docs/tr/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/sql_reference/data_types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/tr/sql_reference/data_types/special_data_types/expression.md b/docs/tr/sql_reference/data_types/special_data_types/expression.md deleted file mode 100644 index a098b0c6365..00000000000 --- a/docs/tr/sql_reference/data_types/special_data_types/expression.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 58 -toc_title: "\u0130fade" ---- - -# İfade {#expression} - -İfadeler, lambda'ları yüksek mertebeden işlevlerde temsil etmek için kullanılır. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/special_data_types/expression/) diff --git a/docs/tr/sql_reference/data_types/special_data_types/interval.md b/docs/tr/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index e95f5a98cfd..00000000000 --- a/docs/tr/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 61 -toc_title: "Aral\u0131kl\u0131" ---- - -# Aralıklı {#data-type-interval} - -Zaman ve Tarih aralıklarını temsil eden veri türleri ailesi. Ortaya çıkan türleri [INTERVAL](../../../sql_reference/operators.md#operator-interval) operatör. - -!!! warning "Uyarıcı" - `Interval` veri türü değerleri tablolarda saklanamaz. - -Yapılı: - -- İmzasız bir tamsayı değeri olarak zaman aralığı. -- Bir aralık türü. - -Desteklenen Aralık türleri: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -Her Aralık türü için ayrı bir veri türü vardır. Örneğin, `DAY` Aralık karşılık gelir `IntervalDay` veri türü: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## Kullanım Açıklamaları {#data-type-interval-usage-remarks} - -Kullanabilirsiniz `Interval`- aritmetik işlemlerde değerler yazın [Tarihli](../../../sql_reference/data_types/date.md) ve [DateTime](../../../sql_reference/data_types/datetime.md)- tip değerleri. Örneğin, geçerli saate 4 gün ekleyebilirsiniz: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -Farklı tiplere sahip aralıklar birleştirilemez. Gibi aralıklarla kullanamazsınız `4 DAY 1 HOUR`. Aralıkların, örneğin aralığın en küçük birimine eşit veya daha küçük olan birimlerdeki aralıkları belirtin `1 day and an hour` aralık olarak ifade edilebilir `25 HOUR` veya `90000 SECOND`. - -İle aritmetik işlemler yapamazsınız `Interval`- değerleri yazın, ancak farklı türde aralıklar ekleyebilirsiniz. `Date` veya `DateTime` veri türleri. Mesela: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -Aşağıdaki sorgu bir özel duruma neden olur: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## Ayrıca Bakınız {#see-also} - -- [INTERVAL](../../../sql_reference/operators.md#operator-interval) operatör -- [toİnterval](../../../sql_reference/functions/type_conversion_functions.md#function-tointerval) tip dönüştürme işlevleri diff --git a/docs/tr/sql_reference/data_types/special_data_types/nothing.md b/docs/tr/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index 046c36ab047..00000000000 --- a/docs/tr/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 60 -toc_title: "Hi\xE7bir \u015Fey" ---- - -# Hiçbir şey {#nothing} - -Bu veri türünün tek amacı, bir değerin beklenmediği durumları temsil etmektir. Yani bir oluşturamazsınız `Nothing` type value. - -Örneğin, literal [NULL](../../../sql_reference/syntax.md#null-literal) türü vardır `Nullable(Nothing)`. Daha fazla görmek [Nullable](../../../sql_reference/data_types/nullable.md). - -Bu `Nothing` tür boş dizileri belirtmek için de kullanılabilir: - -``` sql -SELECT toTypeName(array()) -``` - -``` text -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/special_data_types/nothing/) diff --git a/docs/tr/sql_reference/data_types/special_data_types/set.md b/docs/tr/sql_reference/data_types/special_data_types/set.md deleted file mode 100644 index f12fac0e56f..00000000000 --- a/docs/tr/sql_reference/data_types/special_data_types/set.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 59 -toc_title: Koymak ---- - -# Koymak {#set} - -Sağ yarısı için kullanılan bir [IN](../../../sql_reference/statements/select.md#select-in-operators) ifade. - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/special_data_types/set/) diff --git a/docs/tr/sql_reference/data_types/tuple.md b/docs/tr/sql_reference/data_types/tuple.md deleted file mode 100644 index 64f2b2b2aec..00000000000 --- a/docs/tr/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 53 -toc_title: Tuple (T1, T2, ...) ---- - -# Tuple(t1, T2, …) {#tuplet1-t2} - -Elemanlarının bir demet, her bir birey olması [tür](index.md#data_types). - -Tuples geçici sütun gruplama için kullanılır. Sütunlar, bir sorguda bir In ifadesi kullanıldığında ve lambda işlevlerinin belirli resmi parametrelerini belirtmek için gruplandırılabilir. Daha fazla bilgi için bölümlere bakın [Operatör İNLERDE](../../sql_reference/statements/select.md) ve [Yüksek mertebeden fonksiyonlar](../../sql_reference/functions/higher_order_functions.md). - -Tuples bir sorgunun sonucu olabilir. Bu durumda, json dışındaki metin formatları için değerler köşeli parantez içinde virgülle ayrılır. JSON formatlarında, tuples diziler olarak çıktılanır (köşeli parantez içinde). - -## Bir Tuple oluşturma {#creating-a-tuple} - -Bir tuple oluşturmak için bir işlev kullanabilirsiniz: - -``` sql -tuple(T1, T2, ...) -``` - -Bir tuple oluşturma örneği: - -``` sql -SELECT tuple(1,'a') AS x, toTypeName(x) -``` - -``` text -┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ -│ (1,'a') │ Tuple(UInt8, String) │ -└─────────┴───────────────────────────┘ -``` - -## Veri Türleri İle Çalışma {#working-with-data-types} - -Anında bir tuple oluştururken, ClickHouse her bağımsız değişkenin türünü bağımsız değişken değerini depolayabilen türlerin en azı olarak otomatik olarak algılar. Argüman ise [NULL](../../sql_reference/syntax.md#null-literal), tuple elemanının türü [Nullable](nullable.md). - -Otomatik veri türü algılama örneği: - -``` sql -SELECT tuple(1, NULL) AS x, toTypeName(x) -``` - -``` text -┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ -│ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ -└──────────┴─────────────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/tuple/) diff --git a/docs/tr/sql_reference/data_types/uuid.md b/docs/tr/sql_reference/data_types/uuid.md deleted file mode 100644 index 9fb502227be..00000000000 --- a/docs/tr/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 46 -toc_title: UUID ---- - -# UUID {#uuid-data-type} - -Evrensel olarak benzersiz bir tanımlayıcı (UUID), kayıtları tanımlamak için kullanılan 16 baytlık bir sayıdır. UUID hakkında ayrıntılı bilgi için bkz [Vikipedi](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -UUID türü değeri örneği aşağıda temsil edilmektedir: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -Yeni bir kayıt eklerken UUID sütun değerini belirtmezseniz, UUID değeri sıfır ile doldurulur: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## Nasıl Oluşturulur {#how-to-generate} - -UUID değerini oluşturmak için ClickHouse, [generateuuıdv4](../../sql_reference/functions/uuid_functions.md) işlev. - -## Kullanım Örneği {#usage-example} - -**Örnek 1** - -Bu örnek, UUID türü sütunuyla bir tablo oluşturma ve tabloya bir değer ekleme gösterir. - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**Örnek 2** - -Bu örnekte, yeni bir kayıt eklerken UUID sütun değeri belirtilmedi. - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## Kısıtlama {#restrictions} - -UUID veri türü sadece hangi fonksiyonları destekler [Dize](string.md) veri türü de destekler (örneğin, [dakika](../../sql_reference/aggregate_functions/reference.md#agg_function-min), [maksimum](../../sql_reference/aggregate_functions/reference.md#agg_function-max), ve [sayma](../../sql_reference/aggregate_functions/reference.md#agg_function-count)). - -UUID veri türü aritmetik işlemler tarafından desteklenmez (örneğin, [abs](../../sql_reference/functions/arithmetic_functions.md#arithm_func-abs)) veya toplama fonksiyonları gibi [toplam](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) ve [avg](../../sql_reference/aggregate_functions/reference.md#agg_function-avg). - -[Orijinal makale](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index ac85ccd1724..00000000000 --- a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 39 -toc_title: "Genel A\xE7\u0131klama" ---- - -# Dış Söz Dictionarieslükler {#dicts-external-dicts} - -Çeşitli veri kaynaklarından kendi sözlükleri ekleyebilirsiniz. Bir sözlük için veri kaynağı, yerel bir metin veya yürütülebilir dosya, bir HTTP(s) kaynağı veya başka bir DBMS olabilir. Daha fazla bilgi için, bkz. “[Dış sözlükler için kaynaklar](external_dicts_dict_sources.md)”. - -ClickHouse: - -- Sözlükleri RAM'de tamamen veya kısmen saklar. -- Sözlükleri periyodik olarak günceller ve eksik değerleri dinamik olarak yükler. Başka bir deyişle, sözlükler dinamik olarak yüklenebilir. -- Xml dosyaları ile harici sözlükler oluşturmak için izin verir veya [DDL sorguları](../../statements/create.md#create-dictionary-query). - -Dış sözlüklerin yapılandırması bir veya daha fazla xml dosyasında bulunabilir. Yapılandırma yolu belirtilen [dictionaries\_config](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_config) parametre. - -Sözlükler sunucu başlangıçta veya ilk kullanımda, bağlı olarak yüklenebilir [dictionaries\_lazy\_load](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) ayar. - -Sözlük yapılandırma dosyası aşağıdaki biçime sahiptir: - -``` xml - - An optional element with any content. Ignored by the ClickHouse server. - - - /etc/metrika.xml - - - - - - - - -``` - -Yapabilirsin [yapılandırmak](external_dicts_dict.md) aynı dosyada sözlükler herhangi bir sayıda. - -[Sözlükler için DDL sorguları](../../statements/create.md#create-dictionary-query) sunucu yapılandırmasında herhangi bir ek kayıt gerektirmez. Tablolar veya görünümler gibi birinci sınıf varlıklar olarak sözlüklerle çalışmaya izin verirler. - -!!! attention "Dikkat" - Küçük bir sözlük için değerleri, bir `SELECT` sorgu (bkz. [dönüştürmek](../../../sql_reference/functions/other_functions.md) işlev). Bu işlevsellik harici sözlüklerle ilgili değildir. - -## Ayrıca Bakınız {#ext-dicts-see-also} - -- [Harici bir sözlük yapılandırma](external_dicts_dict.md) -- [Sözlükleri bellekte saklama](external_dicts_dict_layout.md) -- [Sözlük Güncellemeleri](external_dicts_dict_lifetime.md) -- [Dış Sözlüklerin kaynakları](external_dicts_dict_sources.md) -- [Sözlük anahtarı ve alanları](external_dicts_dict_structure.md) -- [Harici Sözlüklerle çalışmak için işlevler](../../../sql_reference/functions/ext_dict_functions.md) - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index b931143903e..00000000000 --- a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 40 -toc_title: "Harici bir s\xF6zl\xFCk yap\u0131land\u0131rma" ---- - -# Harici bir sözlük yapılandırma {#dicts-external-dicts-dict} - -Sözlük xml dosyası kullanılarak yapılandırılmışsa, sözlük yapılandırması aşağıdaki yapıya sahiptir: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -İlgili [DDL-sorgu](../../statements/create.md#create-dictionary-query) aşağıdaki yapıya sahiptir: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. -- [kaynaklı](external_dicts_dict_sources.md) — Source of the dictionary. -- [düzen](external_dicts_dict_layout.md) — Dictionary layout in memory. -- [yapılı](external_dicts_dict_structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. -- [ömür](external_dicts_dict_lifetime.md) — Frequency of dictionary updates. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index 6945173c529..00000000000 --- a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 45 -toc_title: "Hiyerar\u015Fik s\xF6zl\xFCkler" ---- - -# Hiyerarşik Sözlükler {#hierarchical-dictionaries} - -ClickHouse bir hiyerarşik sözlükler destekler [sayısal tuş](external_dicts_dict_structure.md#ext_dict-numeric-key). - -Aşağıdaki hiyerarşik yapıya bakın: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -Bu hiyerarşi aşağıdaki sözlük tablosu olarak ifade edilebilir. - -| region\_id | parent\_region | region\_name | -|------------|----------------|--------------| -| 1 | 0 | Rusya | -| 2 | 1 | Moskova | -| 3 | 2 | Merkezli | -| 4 | 0 | İngiltere | -| 5 | 4 | Londra | - -Bu tablo bir sütun içerir `parent_region` bu öğe için en yakın ebeveynin anahtarını içerir. - -ClickHouse destekler [hiyerarşik](external_dicts_dict_structure.md#hierarchical-dict-attr) için mülkiyet [dış sözlük](index.md) öznitelik. Bu özellik, yukarıda açıklanana benzer hiyerarşik sözlüğü yapılandırmanıza izin verir. - -Bu [dictGetHierarchy](../../../sql_reference/functions/ext_dict_functions.md#dictgethierarchy) fonksiyonu bir elemanın üst zincir almak için izin verir. - -Örneğimiz için, sözlüğün yapısı aşağıdaki gibi olabilir: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index 174d6830839..00000000000 --- a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,373 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 41 -toc_title: "S\xF6zl\xFCkleri bellekte saklama" ---- - -# Sözlükleri Bellekte Saklama {#dicts-external-dicts-dict-layout} - -Sözlükleri bellekte saklamanın çeşitli yolları vardır. - -Biz tavsiye [düzlük](#flat), [karıştırıyordu](#dicts-external_dicts_dict_layout-hashed) ve [complex\_key\_hashed](#complex-key-hashed). hangi optimum işleme hızı sağlamak. - -Önbelleğe alma, potansiyel olarak düşük performans ve en uygun parametreleri seçmede zorluklar nedeniyle önerilmez. Bölümünde devamını oku “[önbellek](#cache)”. - -Sözlük performansını artırmanın birkaç yolu vardır: - -- Sonra sözlük ile çalışmak için işlevi çağırın `GROUP BY`. -- Mark enjektif olarak ayıklamak için nitelikler. Farklı öznitelik değerleri farklı anahtarlara karşılık geliyorsa, bir öznitelik ınjective olarak adlandırılır. Yani ne zaman `GROUP BY` anahtar tarafından bir öznitelik değeri getiren bir işlev kullanır, bu işlev otomatik olarak dışarı alınır `GROUP BY`. - -ClickHouse, sözlüklerdeki hatalar için bir istisna oluşturur. Hata örnekleri: - -- Erişilen sözlük yüklenemedi. -- Bir sorgulama hatası `cached` sözlük. - -Sen dış sözlükler ve durumları listesini görüntüleyebilirsiniz `system.dictionaries` Tablo. - -Yapılandırma şöyle görünüyor: - -``` xml - - - ... - - - - - - ... - - -``` - -İlgili [DDL-sorgu](../../statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## Sözlükleri Bellekte Saklamanın Yolları {#ways-to-store-dictionaries-in-memory} - -- [düzlük](#flat) -- [karıştırıyordu](#dicts-external_dicts_dict_layout-hashed) -- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) -- [önbellek](#cache) -- [range\_hashed](#range-hashed) -- [complex\_key\_hashed](#complex-key-hashed) -- [complex\_key\_cache](#complex-key-cache) -- [ıp\_trie](#ip-trie) - -### düzlük {#flat} - -Sözlük tamamen düz diziler şeklinde bellekte saklanır. Sözlük ne kadar bellek kullanıyor? Miktar, en büyük anahtarın boyutuyla orantılıdır (kullanılan alanda). - -Sözlük anahtarı vardır `UInt64` yazın ve değeri 500.000 ile sınırlıdır. Sözlük oluştururken daha büyük bir anahtar bulunursa, ClickHouse bir özel durum atar ve sözlüğü oluşturmaz. - -Her türlü kaynak desteklenmektedir. Güncellerken, veriler (bir dosyadan veya bir tablodan) bütünüyle okunur. - -Bu yöntem, sözlüğü saklamak için mevcut tüm yöntemler arasında en iyi performansı sağlar. - -Yapılandırma örneği: - -``` xml - - - -``` - -veya - -``` sql -LAYOUT(FLAT()) -``` - -### karıştırıyordu {#dicts-external_dicts_dict_layout-hashed} - -Sözlük tamamen bir karma tablo şeklinde bellekte saklanır. Sözlük, uygulamada herhangi bir tanımlayıcıya sahip herhangi bir sayıda öğe içerebilir, anahtar sayısı on milyonlarca öğeye ulaşabilir. - -Her türlü kaynak desteklenmektedir. Güncellerken, veriler (bir dosyadan veya bir tablodan) bütünüyle okunur. - -Yapılandırma örneği: - -``` xml - - - -``` - -veya - -``` sql -LAYOUT(HASHED()) -``` - -### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} - -Benzer `hashed`, ancak daha fazla CPU kullanımı lehine daha az bellek kullanır. - -Yapılandırma örneği: - -``` xml - - - -``` - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### complex\_key\_hashed {#complex-key-hashed} - -Bu tür depolama kompozit ile kullanım içindir [anahtarlar](external_dicts_dict_structure.md). Benzer `hashed`. - -Yapılandırma örneği: - -``` xml - - - -``` - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### range\_hashed {#range-hashed} - -Sözlük, sıralı bir aralık dizisi ve bunlara karşılık gelen değerleri olan bir karma tablo şeklinde bellekte saklanır. - -Bu depolama yöntemi, hashed ile aynı şekilde çalışır ve anahtara ek olarak tarih/saat (rasgele sayısal tür) aralıklarının kullanılmasına izin verir. - -Örnek: tablo, her reklamveren için biçimdeki indirimleri içerir: - -``` text -+---------|-------------|-------------|------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------|-------------|-------------|------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------|-------------|-------------|------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------|-------------|-------------|------+ -``` - -Tarih aralıkları için bir örnek kullanmak için, `range_min` ve `range_max` element inler [yapılı](external_dicts_dict_structure.md). Bu elemanlar elemanları içermelidir `name` ve`type` (eğer `type` belirtilmemişse, varsayılan tür kullanılır-Tarih). `type` herhangi bir sayısal tür olabilir (Date / DateTime / Uint64 / Int32 / others). - -Örnek: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -veya - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -Bu sözlüklerle çalışmak için, `dictGetT` bir aralığın seçildiği işlev: - -``` sql -dictGetT('dict_name', 'attr_name', id, date) -``` - -Bu işlev belirtilen değerin değerini döndürür `id`s ve geçirilen tarihi içeren tarih aralığı. - -Algoritmanın detayları: - -- Eğer... `id` not fo orund veya a range is not fo aund for the `id`, sözlük için varsayılan değeri döndürür. -- Çakışan aralıklar varsa, herhangi birini kullanabilirsiniz. -- Aralık sınırlayıcı ise `NULL` veya geçersiz bir tarih (örneğin 1900-01-01 veya 2039-01-01), Aralık açık bırakılır. Aralık her iki tarafta da açık olabilir. - -Yapılandırma örneği: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -veya - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### önbellek {#cache} - -Sözlük, sabit sayıda hücre içeren bir önbellekte saklanır. Bu hücreler sık kullanılan elementleri içerir. - -Bir sözlük ararken, önce önbellek aranır. Her veri bloğu için, önbellekte bulunmayan veya güncel olmayan tüm anahtarlar, kaynak kullanılarak istenir `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. Alınan veriler daha sonra önbelleğe yazılır. - -Önbellek sözlükleri için, sona erme [ömür](external_dicts_dict_lifetime.md) önbellekteki verilerin ayarlanabilir. Eğer daha fazla zaman `lifetime` bir hücrede veri yüklenmesinden bu yana geçti, hücrenin değeri kullanılmaz ve bir dahaki sefere kullanılması gerektiğinde yeniden istenir. -Bu, sözlükleri saklamanın tüm yollarından en az etkilidir. Önbelleğin hızı, doğru ayarlara ve kullanım senaryosuna bağlıdır. Bir önbellek türü sözlüğü, yalnızca isabet oranları yeterince yüksek olduğunda (önerilen %99 ve daha yüksek) iyi performans gösterir. Sen ortalama isabet oranı görebilirsiniz `system.dictionaries` Tablo. - -Önbellek performansını artırmak için bir alt sorgu ile kullanın `LIMIT`, ve harici sözlük ile işlevini çağırın. - -Destek [kaynaklılar](external_dicts_dict_sources.md): MySQL, ClickHouse, yürütülebilir, HTTP. - -Ayarlar örneği: - -``` xml - - - - 1000000000 - - -``` - -veya - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -Yeterince büyük bir önbellek boyutu ayarlayın. Sen hücre sayısını seçmek için deneme gerekir: - -1. Bazı değer ayarlayın. -2. Önbellek tamamen doluncaya kadar sorguları çalıştırın. -3. Kullanarak bellek tüketimini değerlendirmek `system.dictionaries` Tablo. -4. Gerekli bellek tüketimine ulaşılana kadar hücre sayısını artırın veya azaltın. - -!!! warning "Uyarıcı" - Rasgele okuma ile sorguları işlemek için yavaş olduğundan, ClickHouse kaynak olarak kullanmayın. - -### complex\_key\_cache {#complex-key-cache} - -Bu tür depolama kompozit ile kullanım içindir [anahtarlar](external_dicts_dict_structure.md). Benzer `cache`. - -### ıp\_trie {#ip-trie} - -Bu tür depolama, ağ öneklerini (IP adresleri) asn gibi meta verilere eşlemek içindir. - -Örnek: tablo, ağ önekleri ve bunlara karşılık gelen sayı ve ülke kodu içerir: - -``` text - +-----------|-----|------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------|-----|------+ - | 2620:0:870::/48 | 3856 | US | - +-----------|-----|------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------|-----|------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------|-----|------+ -``` - -Bu tür bir düzen kullanırken, yapının bileşik bir anahtarı olmalıdır. - -Örnek: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -veya - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -Anahtarın izin verilen bir IP öneki içeren yalnızca bir dize türü özniteliği olması gerekir. Diğer türler henüz desteklenmiyor. - -Sorgular için aynı işlevleri kullanmanız gerekir (`dictGetT` bir tuple ile) kompozit tuşları ile sözlükler gelince: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -İşlev ya alır `UInt32` IPv4 için veya `FixedString(16)` IPv6 için: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -Diğer türler henüz desteklenmiyor. İşlev, bu IP adresine karşılık gelen önek için özniteliği döndürür. Örtüşen önekler varsa, en spesifik olanı döndürülür. - -Veri bir saklanan `trie`. Tamamen RAM'e uyması gerekir. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index d630e9e0128..00000000000 --- a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 42 -toc_title: "S\xF6zl\xFCk G\xFCncellemeleri" ---- - -# Sözlük Güncellemeleri {#dictionary-updates} - -ClickHouse sözlükleri periyodik olarak günceller. Tam olarak karşıdan yüklenen sözlükler için Güncelleştirme aralığı ve önbelleğe alınmış sözlükler için geçersiz kılma aralığı `` saniyeler içinde etiketleyin. - -Sözlük güncelleştirmeleri (ilk kullanım için yükleme dışında) sorguları engellemez. Güncellemeler sırasında, bir sözlüğün eski sürümü kullanılır. Güncelleştirme sırasında bir hata oluşursa, hata sunucu günlüğüne yazılır ve sorgular sözlüklerin eski sürümünü kullanmaya devam eder. - -Ayarlar örneği: - -``` xml - - ... - 300 - ... - -``` - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -Ayar `0` (`LIFETIME(0)`) söz dictionarieslük .lerin güncel updatinglenmesini engeller. - -Yükseltmeler için bir zaman aralığı ayarlayabilirsiniz ve ClickHouse bu aralıkta eşit rastgele bir zaman seçecektir. Bu, çok sayıda sunucuda yükseltme yaparken yükü sözlük kaynağına dağıtmak için gereklidir. - -Ayarlar örneği: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -veya - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -Eğer `0` ve `0`, ClickHouse sözlüğü zaman aşımı ile yeniden yüklemez. -Bu durumda, Sözlük yapılandırma dosyası değiştirilmişse veya ClickHouse sözlüğü daha önce yeniden yükleyebilir. `SYSTEM RELOAD DICTIONARY` komut yürütüldü. - -Sözlükleri yükseltirken, ClickHouse sunucusu türüne bağlı olarak farklı mantık uygular [kaynaklı](external_dicts_dict_sources.md): - -Sözlükleri yükseltirken, ClickHouse sunucusu türüne bağlı olarak farklı mantık uygular [kaynaklı](external_dicts_dict_sources.md): - -- Bir metin dosyası için değişiklik zamanını kontrol eder. Zaman önceden kaydedilmiş zaman farklıysa, sözlük güncelleştirilir. -- Myısam tabloları için, değişiklik zamanı bir `SHOW TABLE STATUS` sorgu. -- Diğer kaynaklardan gelen sözlükler varsayılan olarak her zaman güncellenir. - -MySQL (InnoDB), ODBC ve ClickHouse kaynakları için, sözlükleri her seferinde değil, gerçekten değiştiyse güncelleyecek bir sorgu ayarlayabilirsiniz. Bunu yapmak için şu adımları izleyin: - -- Sözlük tablosu, kaynak verileri güncelleştirildiğinde her zaman değişen bir alana sahip olmalıdır. -- Kaynak ayarları, değişen alanı alan bir sorgu belirtmeniz gerekir. ClickHouse sunucu sorgu sonucu bir satır olarak yorumlar ve bu satır önceki durumuna göre değişmişse, sözlük güncelleştirilir. Sorguda belirtme `` için ayar fieldlardaki alan [kaynaklı](external_dicts_dict_sources.md). - -Ayarlar örneği: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -veya - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index d2ea01c54ce..00000000000 --- a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,608 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 43 -toc_title: "D\u0131\u015F S\xF6zl\xFCklerin kaynaklar\u0131" ---- - -# Dış Sözlüklerin Kaynakları {#dicts-external-dicts-dict-sources} - -Harici bir sözlük birçok farklı kaynaktan bağlanabilir. - -Sözlük xml dosyası kullanılarak yapılandırılmışsa, yapılandırma şöyle görünür: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -Durumunda [DDL-sorgu](../../statements/create.md#create-dictionary-query), eşit yapılandırma gibi görünüyor olacak: - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -Kaynak yapılandırılmış `source` bölme. - -Kaynak türleri (`source_type`): - -- [Yerel dosya](#dicts-external_dicts_dict_sources-local_file) -- [Yürütülebilir dosya](#dicts-external_dicts_dict_sources-executable) -- [HTTP (s)](#dicts-external_dicts_dict_sources-http) -- DBMS - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) - - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) - - [Redis](#dicts-external_dicts_dict_sources-redis) - -## Yerel Dosya {#dicts-external_dicts_dict_sources-local_file} - -Ayarlar örneği: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -veya - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Ayar alanları: - -- `path` – The absolute path to the file. -- `format` – The file format. All the formats described in “[Biçimliler](../../../interfaces/formats.md#formats)” desteklenir. - -## Yürütülebilir Dosya {#dicts-external_dicts_dict_sources-executable} - -Yürütülebilir dosyalarla çalışmak Aşağıdakilere bağlıdır [sözlük bellekte nasıl saklanır](external_dicts_dict_layout.md). Sözlük kullanılarak saklan theıyorsa `cache` ve `complex_key_cache` ClickHouse, yürütülebilir dosyanın STDIN'SİNE bir istek göndererek gerekli anahtarları ister. Aksi takdirde, clickhouse yürütülebilir dosyayı başlatır ve çıktısını sözlük verileri olarak değerlendirir. - -Ayarlar örneği: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -veya - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -Ayar alanları: - -- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). -- `format` – The file format. All the formats described in “[Biçimliler](../../../interfaces/formats.md#formats)” desteklenir. - -## Http (s) {#dicts-external_dicts_dict_sources-http} - -Bir HTTP (s) sunucusuyla çalışmak Aşağıdakilere bağlıdır [sözlük bellekte nasıl saklanır](external_dicts_dict_layout.md). Sözlük kullanılarak saklan theıyorsa `cache` ve `complex_key_cache`, ClickHouse aracılığıyla bir istek göndererek gerekli anahtarları ister `POST` yöntem. - -Ayarlar örneği: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -veya - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -Clickhouse'un bir HTTPS kaynağına erişebilmesi için şunları yapmanız gerekir [openssl'yi yapılandırma](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-openssl) sunucu yapılandırmasında. - -Ayar alanları: - -- `url` – The source URL. -- `format` – The file format. All the formats described in “[Biçimliler](../../../interfaces/formats.md#formats)” desteklenir. -- `credentials` – Basic HTTP authentication. Optional parameter. - - `user` – Username required for the authentication. - - `password` – Password required for the authentication. -- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. - - `header` – Single HTTP header entry. - - `name` – Identifiant name used for the header send on the request. - - `value` – Value set for a specific identifiant name. - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -ODBC sürücüsü olan herhangi bir veritabanını bağlamak için bu yöntemi kullanabilirsiniz. - -Ayarlar örneği: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -veya - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -Ayar alanları: - -- `db` – Name of the database. Omit it if the database name is set in the `` parametre. -- `table` – Name of the table and schema if exists. -- `connection_string` – Connection string. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Sözlükleri güncelleme](external_dicts_dict_lifetime.md). - -ClickHouse, ODBC sürücüsünden alıntı sembolleri alır ve sorgulardaki tüm ayarları sürücüye aktarır, bu nedenle tablo adını veritabanındaki tablo adı durumuna göre ayarlamak gerekir. - -Oracle kullanırken kodlamalarla ilgili bir sorununuz varsa, ilgili [FAQ](../../../faq/general.md#oracle-odbc-encodings) makale. - -### ODBC Sözlük işlevselliği bilinen güvenlik açığı {#known-vulnerability-of-the-odbc-dictionary-functionality} - -!!! attention "Dikkat" - ODBC sürücüsü bağlantı parametresi aracılığıyla veritabanına bağlanırken `Servername` yerine. Bu durumda değerler `USERNAME` ve `PASSWORD` itibaren `odbc.ini` uzak sunucuya gönderilir ve tehlikeye girebilir. - -**Güvensiz kullanım örneği** - -PostgreSQL için unixodbc'yi yapılandıralım. İçeriği `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -Daha sonra aşağıdaki gibi bir sorgu yaparsanız - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -ODBC sürücüsü değerleri gönderir `USERNAME` ve `PASSWORD` itibaren `odbc.ini` -e doğru `some-server.com`. - -### PostgreSQL Bağlanma Örneği {#example-of-connecting-postgresql} - -UB .untu OS. - -PostgreSQL için UNİXODBC ve ODBC sürücüsünü yükleme: - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -Yapılandırma `/etc/odbc.ini` (veya `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -Clickhouse'da sözlük yapılandırması: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -veya - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) -``` - -Düzenlemeniz gerekebilir `odbc.ini` sürücü ile kitaplığın tam yolunu belirtmek için `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### MS SQL Server bağlanma örneği {#example-of-connecting-ms-sql-server} - -UB .untu OS. - -Sürücüyü yükleme: : - -``` bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -Sürücüyü yapılandırma: - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -Clickhouse'da sözlüğü yapılandırma: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -veya - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## DBMS {#dbms} - -### Mysql {#dicts-external_dicts_dict_sources-mysql} - -Ayarlar örneği: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -veya - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -Ayar alanları: - -- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). - -- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `replica` – Section of replica configurations. There can be multiple sections. - - - `replica/host` – The MySQL host. - - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. - -- `db` – Name of the database. - -- `table` – Name of the table. - -- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` MySQL, örneğin, `id > 10 AND id < 20`. İsteğe bağlı parametre. - -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Sözlükleri güncelleme](external_dicts_dict_lifetime.md). - -MySQL yuva üzerinden yerel bir ana bilgisayara bağlanabilir. Bunu yapmak için, ayarlayın `host` ve `socket`. - -Ayarlar örneği: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -veya - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### ClickHouse {#dicts-external_dicts_dict_sources-clickhouse} - -Ayarlar örneği: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -veya - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -Ayar alanları: - -- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [Dağılı](../../../engines/table_engines/special/distributed.md) tablo ve sonraki yapılandırmalarda girin. -- `port` – The port on the ClickHouse server. -- `user` – Name of the ClickHouse user. -- `password` – Password of the ClickHouse user. -- `db` – Name of the database. -- `table` – Name of the table. -- `where` – The selection criteria. May be omitted. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [Sözlükleri güncelleme](external_dicts_dict_lifetime.md). - -### Mongodb {#dicts-external_dicts_dict_sources-mongodb} - -Ayarlar örneği: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -veya - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -Ayar alanları: - -- `host` – The MongoDB host. -- `port` – The port on the MongoDB server. -- `user` – Name of the MongoDB user. -- `password` – Password of the MongoDB user. -- `db` – Name of the database. -- `collection` – Name of the collection. - -### Redis {#dicts-external_dicts_dict_sources-redis} - -Ayarlar örneği: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -veya - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -Ayar alanları: - -- `host` – The Redis host. -- `port` – The port on the Redis server. -- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` basit kaynaklar ve karma tek anahtar kaynaklar içindir, `hash_map` iki anahtarlı karma kaynaklar içindir. Ranged kaynakları ve karmaşık anahtarlı önbellek kaynakları desteklenmez. İhmal edilebilir, varsayılan değer `simple`. -- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index bd404e3b822..00000000000 --- a/docs/tr/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 44 -toc_title: "S\xF6zl\xFCk anahtar\u0131 ve alanlar\u0131" ---- - -# Sözlük anahtarı ve alanları {#dictionary-key-and-fields} - -Bu `` yan tümcesi sözlük anahtarı ve sorgular için kullanılabilir alanları açıklar. - -XML açıklaması: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -Nitelikler elemanlarda açıklanmıştır: - -- `` — [Anahtar sütun](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [Veri sütunu](external_dicts_dict_structure.md#ext_dict_structure-attributes). Birden fazla sayıda özellik olabilir. - -DDL sorgusu: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -Öznitelikler sorgu gövdesinde açıklanmıştır: - -- `PRIMARY KEY` — [Anahtar sütun](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [Veri sütunu](external_dicts_dict_structure.md#ext_dict_structure-attributes). Birden fazla sayıda özellik olabilir. - -## Anahtar {#ext_dict_structure-key} - -ClickHouse aşağıdaki anahtar türlerini destekler: - -- Sayısal tuş. `UInt64`. Tanımlanan `` etiket veya kullanma `PRIMARY KEY` kelime. -- Kompozit anahtar. Farklı türde değerler kümesi. Etiket definedinde tanımlı `` veya `PRIMARY KEY` kelime. - -Bir xml yapısı şunları içerebilir `` veya ``. DDL sorgusu tek içermelidir `PRIMARY KEY`. - -!!! warning "Uyarıcı" - Anahtarı bir öznitelik olarak tanımlamamalısınız. - -### Sayısal Tuş {#ext_dict-numeric-key} - -Tür: `UInt64`. - -Yapılandırma örneği: - -``` xml - - Id - -``` - -Yapılandırma alanları: - -- `name` – The name of the column with keys. - -DDL sorgusu için: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – The name of the column with keys. - -### Kompozit Anahtar {#composite-key} - -Anahtar bir olabilir `tuple` her türlü alandan. Bu [düzen](external_dicts_dict_layout.md) bu durumda olmalıdır `complex_key_hashed` veya `complex_key_cache`. - -!!! tip "Uç" - Bileşik bir anahtar tek bir elemandan oluşabilir. Bu, örneğin bir dizeyi anahtar olarak kullanmayı mümkün kılar. - -Anahtar yapısı eleman ayarlanır ``. Anahtar alanlar sözlük ile aynı biçimde belirtilir [öznitelik](external_dicts_dict_structure.md). Örnek: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -veya - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -Bir sorgu için `dictGet*` fonksiyon, bir tuple anahtar olarak geçirilir. Örnek: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## Öznitelik {#ext_dict_structure-attributes} - -Yapılandırma örneği: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -veya - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -Yapılandırma alanları: - -| Etiket | Açıklama | Gerekli | -|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| -| `name` | Sütun adı. | Evet | -| `type` | ClickHouse veri türü.
ClickHouse, sözlükten belirtilen veri türüne değer atmaya çalışır. Örneğin, MySQL için alan olabilir `TEXT`, `VARCHAR`, veya `BLOB` MySQL kaynak tablosunda, ancak şu şekilde yüklenebilir `String` Clickhouse'da.
[Nullable](../../../sql_reference/data_types/nullable.md) desteklenmiyor. | Evet | -| `null_value` | Varolan olmayan bir öğe için varsayılan değer.
Örnekte, boş bir dizedir. Kullanamazsınız `NULL` bu alanda. | Evet | -| `expression` | [İfade](../../syntax.md#syntax-expressions) bu ClickHouse değeri yürütür.
İfade, uzak SQL veritabanında bir sütun adı olabilir. Bu nedenle, uzak sütun için bir diğer ad oluşturmak için kullanabilirsiniz.

Varsayılan değer: ifade yok. | Hayır | -| `hierarchical` | Eğer `true`, öznitelik, geçerli anahtar için bir üst anahtarın değerini içerir. Görmek [Hiyerarşik Sözlükler](external_dicts_dict_hierarchical.md).

Varsayılan değer: `false`. | Hayır | -| `injective` | Olup olmadığını gösteren bayrak `id -> attribute` ima isge is [enjektif](https://en.wikipedia.org/wiki/Injective_function).
Eğer `true`, ClickHouse sonra otomatik olarak yerleştirebilirsiniz `GROUP BY` fık .ra ile ilgili istek dictionariesleriniz Genellikle bu tür taleplerin miktarını önemli ölçüde azaltır.

Varsayılan değer: `false`. | Hayır | -| `is_object_id` | Bir MongoDB belgesi için sorgunun yürütülüp yürütülmediğini gösteren bayrak `ObjectID`.

Varsayılan değer: `false`. | Hayır | - -## Ayrıca Bakınız {#see-also} - -- [Harici sözlüklerle çalışmak için işlevler](../../../sql_reference/functions/ext_dict_functions.md). - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/tr/sql_reference/dictionaries/index.md b/docs/tr/sql_reference/dictionaries/index.md deleted file mode 100644 index a8a6c3605b4..00000000000 --- a/docs/tr/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "S\xF6zl\xFCkler" -toc_priority: 35 -toc_title: "Giri\u015F" ---- - -# Sözlükler {#dictionaries} - -Bir sözlük bir haritalama (`key -> attributes`) bu referans listeleri çeşitli türleri için uygundur. - -ClickHouse, sorgularda kullanılabilecek sözlüklerle çalışmak için özel işlevleri destekler. Sözlükleri işlevlerle kullanmak daha kolay ve daha verimlidir. `JOIN` referans tabloları ile. - -[NULL](../syntax.md#null) değerler sözlükte saklanamaz. - -ClickHouse destekler: - -- [Dahili sözlükler](internal_dicts.md#internal_dicts) bir özel ile [fonksiyonlar kümesi](../../sql_reference/functions/ym_dict_functions.md). -- [Eklenti (harici) söz dictionarieslükler](external_dictionaries/external_dicts.md) ile bir [fonksiyonlar net](../../sql_reference/functions/ext_dict_functions.md). - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/tr/sql_reference/dictionaries/internal_dicts.md b/docs/tr/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index b7a1d46207c..00000000000 --- a/docs/tr/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 39 -toc_title: "\u0130\xE7 S\xF6z Dictionariesl\xFCkler" ---- - -# İç söz dictionarieslükler {#internal_dicts} - -ClickHouse, bir geobase ile çalışmak için yerleşik bir özellik içerir. - -Bu size sağlar: - -- Adını istediğiniz dilde almak için bölgenin kimliğini kullanın. -- Bir şehir, bölge, federal bölge, ülke veya kıtanın kimliğini almak için bölgenin kimliğini kullanın. -- Bir bölgenin başka bir bölgenin parçası olup olmadığını kontrol edin. -- Ana bölgeler zinciri alın. - -Tüm fonksiyonları destek “translocality,” aynı anda bölge mülkiyeti farklı bakış açıları kullanma yeteneği. Daha fazla bilgi için bölüme bakın “Functions for working with Yandex.Metrica dictionaries”. - -İç sözlükler varsayılan pakette devre dışı bırakılır. -Bunları etkinleştirmek için, parametreleri uncomment `path_to_regions_hierarchy_file` ve `path_to_regions_names_files` sunucu yapılandırma dosyasında. - -Geobase metin dosyalarından yüklenir. - -Place the `regions_hierarchy*.txt` dosyaları içine `path_to_regions_hierarchy_file` dizin. Bu yapılandırma parametresi, `regions_hierarchy.txt` dosya (varsayılan bölgesel hiyerarşi) ve diğer dosyalar (`regions_hierarchy_ua.txt`) aynı dizinde bulunmalıdır. - -Koy... `regions_names_*.txt` dosyalar içinde `path_to_regions_names_files` dizin. - -Bu dosyaları kendiniz de oluşturabilirsiniz. Dosya biçimi aşağıdaki gibidir: - -`regions_hierarchy*.txt`: TabSeparated (başlık yok), sütunlar: - -- bölge kimliği (`UInt32`) -- üst bölge kimliği (`UInt32`) -- bölge tipi (`UInt8`): 1 - kıta, 3-ülke, 4-federal bölge, 5-bölge, 6-şehir; diğer türlerin değerleri yoktur -- nüfuslu (`UInt32`) — optional column - -`regions_names_*.txt`: TabSeparated (başlık yok), sütunlar: - -- bölge kimliği (`UInt32`) -- bölge adı (`String`) — Can't contain tabs or line feeds, even escaped ones. - -RAM'de depolamak için düz bir dizi kullanılır. Bu nedenle, IDs bir milyondan fazla olmamalıdır. - -Sözlükler sunucuyu yeniden başlatmadan güncellenebilir. Ancak, kullanılabilir sözlükler kümesi güncelleştirilmez. -Güncellemeler için dosya değiştirme süreleri kontrol edilir. Bir dosya değiştiyse, sözlük güncelleştirilir. -Değişiklikleri kontrol etmek için Aralık `builtin_dictionaries_reload_interval` parametre. -Sözlük güncelleştirmeleri (ilk kullanımda yükleme dışında) sorguları engellemez. Güncelleştirmeler sırasında, sorgular sözlüklerin eski sürümlerini kullanır. Güncelleştirme sırasında bir hata oluşursa, hata sunucu günlüğüne yazılır ve sorgular sözlüklerin eski sürümünü kullanmaya devam eder. - -Sözlükleri geobase ile periyodik olarak güncellemenizi öneririz. Bir güncelleme sırasında yeni dosyalar oluşturun ve bunları ayrı bir konuma yazın. Her şey hazır olduğunda, bunları sunucu tarafından kullanılan dosyalara yeniden adlandırın. - -OS tanımlayıcıları ve Yandex ile çalışmak için işlevler de vardır.Metrica arama motorları, ancak kullanılmamalıdır. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/tr/sql_reference/functions/arithmetic_functions.md b/docs/tr/sql_reference/functions/arithmetic_functions.md deleted file mode 100644 index 594e9bd4699..00000000000 --- a/docs/tr/sql_reference/functions/arithmetic_functions.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 35 -toc_title: Aritmetik ---- - -# Aritmetik fonksiyonlar {#arithmetic-functions} - -Tüm aritmetik işlevler için, sonuç türü, böyle bir tür varsa, sonucun sığdığı en küçük sayı türü olarak hesaplanır. Minimum, bit sayısına, imzalanıp imzalanmadığına ve yüzüp yüzmediğine bağlı olarak aynı anda alınır. Yeterli bit yoksa, en yüksek bit türü alınır. - -Örnek: - -``` sql -SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) -``` - -``` text -┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ -│ UInt8 │ UInt16 │ UInt32 │ UInt64 │ -└───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ -``` - -Aritmetik fonksiyonlar, uint8, Uİnt16, Uİnt32, Uint64, Int8, Int16, Int32, Int64, Float32 veya Float64 türlerinden herhangi bir çift için çalışır. - -Taşma, C++ile aynı şekilde üretilir. - -## artı (a, b), A + B operatörü {#plusa-b-a-b-operator} - -Sayıların toplamını hesaplar. -Ayrıca bir tarih veya tarih ve Saat ile tamsayı numaraları ekleyebilirsiniz. Bir tarih durumunda, bir tamsayı eklemek, karşılık gelen gün sayısını eklemek anlamına gelir. Zamanla bir tarih için, karşılık gelen saniye sayısını eklemek anlamına gelir. - -## eksi (a, b), A - B operatörü {#minusa-b-a-b-operator} - -Farkı hesaplar. Sonuç her zaman imzalanır. - -You can also calculate integer numbers from a date or date with time. The idea is the same – see above for ‘plus’. - -## çarp operatorma (a, b), A \* B operatörü {#multiplya-b-a-b-operator} - -Sayıların ürününü hesaplar. - -## böl (a, b), A / B operatörü {#dividea-b-a-b-operator} - -Sayıların bölümünü hesaplar. Sonuç türü her zaman bir kayan nokta türüdür. -Tam sayı bölümü değildir. Tamsayı bölümü için, ‘intDiv’ işlev. -Sıfıra bölerek zaman olsun ‘inf’, ‘-inf’, veya ‘nan’. - -## ıntdiv(a, b) {#intdiva-b} - -Sayıların bölümünü hesaplar. Tamsayılara bölünür, yuvarlanır (mutlak değere göre). -Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. - -## ıntdivorzero(a, b) {#intdivorzeroa-b} - -Farklıdır ‘intDiv’ bu, sıfıra bölünürken veya en az bir negatif sayıyı eksi bir ile bölerek sıfır döndürür. - -## modulo (a, b), A % B operatörü {#moduloa-b-a-b-operator} - -Bölünmeden sonra kalan hesaplar. -Bağımsız değişkenler kayan nokta sayılarıysa, ondalık bölümü bırakarak tamsayılara önceden dönüştürülürler. -Kalan C++ile aynı anlamda alınır. Kesik bölme negatif sayılar için kullanılır. -Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. - -## moduloOrZero(a, b) {#moduloorzeroa-b} - -Farklıdır ‘modulo’ bölen sıfır olduğunda sıfır döndürür. - -## negate (a), - bir operatör {#negatea-a-operator} - -Ters işareti ile bir sayı hesaplar. Sonuç her zaman imzalanır. - -## abs (a) {#arithm_func-abs} - -\(A\) sayısının mutlak değerini hesaplar. Yani, \< 0 ise,- A döndürür. imzasız türler için hiçbir şey yapmaz. İmzalı tamsayı türleri için imzasız bir sayı döndürür. - -## gcd (a, b) {#gcda-b} - -Sayıların en büyük ortak böleni döndürür. -Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. - -## lcm(a, b) {#lcma-b} - -Sayıların en az ortak katını döndürür. -Sıfıra bölünürken veya en az negatif sayıyı eksi bir ile bölürken bir istisna atılır. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/tr/sql_reference/functions/array_functions.md b/docs/tr/sql_reference/functions/array_functions.md deleted file mode 100644 index 9e3221435ed..00000000000 --- a/docs/tr/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,1061 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 46 -toc_title: "Dizilerle \xE7al\u0131\u015Fma" ---- - -# Dizilerle çalışmak için işlevler {#functions-for-working-with-arrays} - -## boş {#function-empty} - -Boş bir dizi için 1 veya boş olmayan bir dizi için 0 döndürür. -Sonuç türü Uint8'dir. -İşlev ayrıca dizeler için de çalışır. - -## notEmpty {#function-notempty} - -Boş bir dizi için 0 veya boş olmayan bir dizi için 1 döndürür. -Sonuç türü Uint8'dir. -İşlev ayrıca dizeler için de çalışır. - -## uzunluk {#array_functions-length} - -Dizideki öğe sayısını döndürür. -Sonuç türü Uint64'tür. -İşlev ayrıca dizeler için de çalışır. - -## emptyArrayUİnt8, emptyArrayUİnt16, emptyArrayUİnt32, emptyArrayUİnt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## emptyArrayİnt8, emptyArrayİnt16, emptyArrayİnt32, emptyArrayİnt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## emptyArrayFloat32, emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} - -## emptyArrayDate, emptyArrayDateTime {#emptyarraydate-emptyarraydatetime} - -## emptyArrayString {#emptyarraystring} - -Sıfır bağımsız değişkeni kabul eder ve uygun türde boş bir dizi döndürür. - -## emptyArrayToSingle {#emptyarraytosingle} - -Boş bir dizi kabul eder ve varsayılan değere eşit bir tek öğe dizisi döndürür. - -## Aralık (bitiş), Aralık(başlangıç, bitiş \[, adım\]) {#rangeend-rangestart-end-step} - -1 Adım-başından sonuna kadar sayıların bir dizi döndürür. -Eğer argüman `start` belirtilmemiş, varsayılan olarak 0. -Eğer argüman `step` belirtilmemiş, varsayılan olarak 1. -Neredeyse pythonic gibi davranışlar `range`. Ancak fark, tüm argümanların tipinin olması gerektiğidir `UInt` şiir. -Bir veri bloğunda toplam uzunluğu 100.000.000'den fazla öğe olan diziler oluşturulursa, bir istisna atılır. - -## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} - -İşlev bağımsız değişkenlerinden bir dizi oluşturur. -Bağımsız değişkenler sabit olmalı ve en küçük ortak türe sahip türlere sahip olmalıdır. En az bir argüman geçirilmelidir, çünkü aksi takdirde hangi tür dizinin oluşturulacağı açık değildir. Yani, boş bir dizi oluşturmak için bu işlevi kullanamazsınız (bunu yapmak için, ‘emptyArray\*’ fonksiyon yukarıda açıklandığı. -Ret anur anns an ‘Array(T)’ sonucu yazın, nerede ‘T’ geçirilen bağımsız değişkenlerin en küçük ortak türüdür. - -## arrayConcat {#arrayconcat} - -Argüman olarak geçirilen dizileri birleştirir. - -``` sql -arrayConcat(arrays) -``` - -**Parametre** - -- `arrays` – Arbitrary number of arguments of [Dizi](../../sql_reference/data_types/array.md) tür. - **Örnek** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,3,4,5,6] │ -└───────────────┘ -``` - -## arrayElement (arr, n), operatör arr\[n\] {#arrayelementarr-n-operator-arrn} - -İnd theex ile eleman alın `n` diz theiden `arr`. `n` herhangi bir tamsayı türü olmalıdır. -Bir dizideki dizinler birinden başlar. -Negatif dizinler desteklenir. Bu durumda, sondan numaralandırılmış ilgili elemanı seçer. Mesela, `arr[-1]` dizideki son öğedir. - -Dizin bir dizinin sınırlarının dışına düşerse, bazı varsayılan değer döndürür (sayılar için 0, dizeler için boş bir dize vb.).), sabit olmayan bir dizi ve sabit bir dizin 0 olan durum hariç (bu durumda bir hata olacaktır `Array indices are 1-based`). - -## has (arr, elem) {#hasarr-elem} - -Olup olmadığını denetler ‘arr’ dizi var ‘elem’ öğe. -Öğe dizide değilse 0 veya varsa 1 değerini döndürür. - -`NULL` değer olarak iş islenir. - -``` sql -SELECT has([1, 2, NULL], NULL) -``` - -``` text -┌─has([1, 2, NULL], NULL)─┐ -│ 1 │ -└─────────────────────────┘ -``` - -## hasAll {#hasall} - -Bir dizi başka bir alt kümesi olup olmadığını denetler. - -``` sql -hasAll(set, subset) -``` - -**Parametre** - -- `set` – Array of any type with a set of elements. -- `subset` – Array of any type with elements that should be tested to be a subset of `set`. - -**Dönüş değerleri** - -- `1`, eğer `set` tüm öğeleri içerir `subset`. -- `0`, başka. - -**Tuhaf özellikler** - -- Boş bir dizi, herhangi bir dizinin bir alt kümesidir. -- `Null` bir değer olarak işlenir. -- Her iki dizideki değerlerin sırası önemli değil. - -**Örnekler** - -`SELECT hasAll([], [])` döner 1. - -`SELECT hasAll([1, Null], [Null])` döner 1. - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` döner 1. - -`SELECT hasAll(['a', 'b'], ['a'])` döner 1. - -`SELECT hasAll([1], ['a'])` 0 döndürür. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` 0 döndürür. - -## hasAny {#hasany} - -İki dizinin bazı öğelerle kesiştiği olup olmadığını kontrol eder. - -``` sql -hasAny(array1, array2) -``` - -**Parametre** - -- `array1` – Array of any type with a set of elements. -- `array2` – Array of any type with a set of elements. - -**Dönüş değerleri** - -- `1`, eğer `array1` ve `array2` en azından benzer bir öğeye sahip olun. -- `0`, başka. - -**Tuhaf özellikler** - -- `Null` bir değer olarak işlenir. -- Her iki dizideki değerlerin sırası önemli değil. - -**Örnekler** - -`SELECT hasAny([1], [])` dönüşler `0`. - -`SELECT hasAny([Null], [Null, 1])` dönüşler `1`. - -`SELECT hasAny([-128, 1., 512], [1])` dönüşler `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` dönüşler `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` dönüşler `1`. - -## ındexof(arr, x) {#indexofarr-x} - -İlk dizini döndürür ‘x’ dizide ise öğe (1'den başlayarak) veya değilse 0. - -Örnek: - -``` sql -SELECT indexOf([1, 3, NULL, NULL], NULL) -``` - -``` text -┌─indexOf([1, 3, NULL, NULL], NULL)─┐ -│ 3 │ -└───────────────────────────────────┘ -``` - -Elem setents set to `NULL` normal değerler olarak ele alınır. - -## countEqual(arr, x) {#countequalarr-x} - -X eşit dizideki öğelerin sayısını döndürür. Arraycount eşdeğer (elem - \> elem = x, arr). - -`NULL` öğeler ayrı değerler olarak işlenir. - -Örnek: - -``` sql -SELECT countEqual([1, 2, NULL, NULL], NULL) -``` - -``` text -┌─countEqual([1, 2, NULL, NULL], NULL)─┐ -│ 2 │ -└──────────────────────────────────────┘ -``` - -## arrayEnumerate(arr) {#array_functions-arrayenumerate} - -Returns the array \[1, 2, 3, …, length (arr) \] - -Bu işlev normalde ARRAY JOIN ile kullanılır. ARRAY JOİN uyguladıktan sonra her dizi için sadece bir kez bir şey saymaya izin verir. Örnek: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -Bu örnekte, Reaches dönüşümlerin sayısıdır (ARRAY JOİN uygulandıktan sonra alınan dizeler) ve İsabetler sayfa görüntüleme sayısıdır (ARRAY JOİN önce dizeler). Bu özel durumda, aynı sonucu daha kolay bir şekilde alabilirsiniz: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - -``` text -┌─Reaches─┬──Hits─┐ -│ 95606 │ 31406 │ -└─────────┴───────┘ -``` - -Bu fonksiyon aynı zamanda yüksek mertebeden fonksiyonlarda da kullanılabilir. Örneğin, bir koşulla eşleşen öğeler için dizi dizinleri almak için kullanabilirsiniz. - -## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} - -Kaynak diziyle aynı boyutta bir dizi döndürür ve her öğe için aynı değere sahip öğeler arasında konumunun ne olduğunu gösterir. -Örneğin: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\]. - -Bu işlev, dizi birleştirme ve dizi öğelerinin toplanmasını kullanırken kullanışlıdır. -Örnek: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - -``` text -┌──GoalID─┬─Reaches─┬─Visits─┐ -│ 53225 │ 3214 │ 1097 │ -│ 2825062 │ 3188 │ 1097 │ -│ 56600 │ 2803 │ 488 │ -│ 1989037 │ 2401 │ 365 │ -│ 2830064 │ 2396 │ 910 │ -│ 1113562 │ 2372 │ 373 │ -│ 3270895 │ 2262 │ 812 │ -│ 1084657 │ 2262 │ 345 │ -│ 56599 │ 2260 │ 799 │ -│ 3271094 │ 2256 │ 812 │ -└─────────┴─────────┴────────┘ -``` - -Bu örnekte, her hedef kimliğinin dönüşüm sayısı (hedefler iç içe geçmiş veri yapısındaki her öğe, bir dönüşüm olarak adlandırdığımız ulaşılan bir hedeftir) ve oturum sayısı Hesaplaması vardır. ARRAY JOİN olmadan, oturum sayısını sum(Sign) olarak sayardık. Ancak bu özel durumda, satırlar iç içe geçmiş hedefler yapısıyla çarpıldı, bu nedenle her oturumu bir kez saymak için arrayenumerateuniq değerine bir koşul uyguluyoruz(Goals.ID) fonksiyonu. - -Arrayenumerateuniq işlevi, bağımsız değişkenlerle aynı boyutta birden çok dizi alabilir. Bu durumda, tüm dizilerde aynı konumlardaki elemanların tuplesleri için benzersizlik düşünülür. - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - -``` text -┌─res───────────┐ -│ [1,2,1,1,2,1] │ -└───────────────┘ -``` - -Bu, iç içe geçmiş bir veri yapısı ve bu yapıdaki birden çok öğe arasında daha fazla toplama ile dizi birleşimini kullanırken gereklidir. - -## arrayPopBack {#arraypopback} - -Son öğeyi diziden kaldırır. - -``` sql -arrayPopBack(array) -``` - -**Parametre** - -- `array` – Array. - -**Örnek** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## arrayPopFront {#arraypopfront} - -İlk öğeyi diziden kaldırır. - -``` sql -arrayPopFront(array) -``` - -**Parametre** - -- `array` – Array. - -**Örnek** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - -``` text -┌─res───┐ -│ [2,3] │ -└───────┘ -``` - -## arrayPushBack {#arraypushback} - -Dizinin sonuna bir öğe ekler. - -``` sql -arrayPushBack(array, single_value) -``` - -**Parametre** - -- `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` dizinin veri türü için yazın. Clickhouse'daki veri türleri hakkında daha fazla bilgi için bkz. “[Veri türleri](../../sql_reference/data_types/index.md#data_types)”. Olabilir `NULL`. Fonksiyon bir ekler `NULL` bir dizi için öğe ve dizi öğeleri türü dönüştürür `Nullable`. - -**Örnek** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayPushFront {#arraypushfront} - -Dizinin başına bir öğe ekler. - -``` sql -arrayPushFront(array, single_value) -``` - -**Parametre** - -- `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` dizinin veri türü için yazın. Clickhouse'daki veri türleri hakkında daha fazla bilgi için bkz. “[Veri türleri](../../sql_reference/data_types/index.md#data_types)”. Olabilir `NULL`. Fonksiyon bir ekler `NULL` bir dizi için öğe ve dizi öğeleri türü dönüştürür `Nullable`. - -**Örnek** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - -``` text -┌─res───────┐ -│ ['a','b'] │ -└───────────┘ -``` - -## arrayResize {#arrayresize} - -Dizinin uzunluğunu değiştirir. - -``` sql -arrayResize(array, size[, extender]) -``` - -**Parametre:** - -- `array` — Array. -- `size` — Required length of the array. - - Eğer `size` dizinin orijinal boyutundan daha az, dizi sağdan kesilir. -- Eğer `size` dizinin başlangıç boyutundan daha büyük, dizi sağa uzatılır `extender` dizi öğelerinin veri türü için değerler veya varsayılan değerler. -- `extender` — Value for extending an array. Can be `NULL`. - -**Döndürülen değer:** - -Bir dizi uzunluk `size`. - -**Arama örnekleri** - -``` sql -SELECT arrayResize([1], 3) -``` - -``` text -┌─arrayResize([1], 3)─┐ -│ [1,0,0] │ -└─────────────────────┘ -``` - -``` sql -SELECT arrayResize([1], 3, NULL) -``` - -``` text -┌─arrayResize([1], 3, NULL)─┐ -│ [1,NULL,NULL] │ -└───────────────────────────┘ -``` - -## arraySlice {#arrayslice} - -Dizinin bir dilimini döndürür. - -``` sql -arraySlice(array, offset[, length]) -``` - -**Parametre** - -- `array` – Array of data. -- `offset` – Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1. -- `length` - Gerekli dilimin uzunluğu. Negatif bir değer belirtirseniz, işlev açık bir dilim döndürür `[offset, array_length - length)`. Değeri atlarsanız, işlev dilimi döndürür `[offset, the_end_of_array]`. - -**Örnek** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - -``` text -┌─res────────┐ -│ [2,NULL,4] │ -└────────────┘ -``` - -Ar arrayray elem toents set to `NULL` normal değerler olarak ele alınır. - -## arraySort(\[func,\] arr, …) {#array_functions-sort} - -Elemanları sıralar `arr` artan düzende dizi. Eğer... `func` fonksiyonu belirtilir, sıralama düzeni sonucu belirlenir `func` fonksiyon dizinin elemanlarına uygulanır. Eğer `func` birden fazla argüman kabul eder, `arraySort` fonksiyon argümanları birkaç diziler geçirilir `func` karşılık gelir. Ayrıntılı örnekler sonunda gösterilir `arraySort` açıklama. - -Tamsayı değerleri sıralama örneği: - -``` sql -SELECT arraySort([1, 3, 3, 0]); -``` - -``` text -┌─arraySort([1, 3, 3, 0])─┐ -│ [0,1,3,3] │ -└─────────────────────────┘ -``` - -Dize değerleri sıralama örneği: - -``` sql -SELECT arraySort(['hello', 'world', '!']); -``` - -``` text -┌─arraySort(['hello', 'world', '!'])─┐ -│ ['!','hello','world'] │ -└────────────────────────────────────┘ -``` - -Aşağıdaki sıralama sırasını göz önünde bulundurun `NULL`, `NaN` ve `Inf` değerler: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - -``` text -┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ -│ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────────────────────────┘ -``` - -- `-Inf` değerler dizide ilk sırada yer alır. -- `NULL` değerler dizideki son değerlerdir. -- `NaN` değerler hemen önce `NULL`. -- `Inf` değerler hemen önce `NaN`. - -Not thate that `arraySort` is a [yüksek sipariş fonksiyonu](higher_order_functions.md). Bir lambda işlevini ilk argüman olarak iletebilirsiniz. Bu durumda, sıralama sırası, dizinin elemanlarına uygulanan lambda işlevinin sonucu ile belirlenir. - -Aşağıdaki örneği ele alalım: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,2,1] │ -└─────────┘ -``` - -For each element of the source array, the lambda function returns the sorting key, that is, \[1 –\> -1, 2 –\> -2, 3 –\> -3\]. Since the `arraySort` fonksiyon tuşları artan sırayla sıralar, sonuç \[3, 2, 1\]. Böylece, `(x) –> -x` lambda fonksiyonu setleri [azalan düzen](#array_functions-reverse-sort) bir sıralama içinde. - -Lambda işlevi birden çok bağımsız değişken kabul edebilir. Bu durumda, geçmek gerekir `arraySort` işlev lambda işlevinin argümanlarının karşılık geleceği aynı uzunlukta birkaç dizi. Elde edilen dizi ilk giriş dizisinden elemanlardan oluşacaktır; bir sonraki giriş dizilerinden elemanlar sıralama anahtarlarını belirtir. Mesela: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Burada, ikinci dizide (\[2, 1\]) geçirilen öğeler, kaynak diziden karşılık gelen öğe için bir sıralama anahtarı tanımlar (\[‘hello’, ‘world’\]), bu, \[‘hello’ –\> 2, ‘world’ –\> 1\]. Since the lambda function doesn't use `x`, kaynak dizinin gerçek değerleri sonuçtaki sırayı etkilemez. Böyle, ‘hello’ sonuçtaki ikinci eleman olacak ve ‘world’ ilk olacak. - -Diğer örnekler aşağıda gösterilmiştir. - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! note "Not" - Sıralama verimliliğini artırmak için, [Schwartzian dönüşümü](https://en.wikipedia.org/wiki/Schwartzian_transform) kullanılır. - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} - -Elemanları sıralar `arr` azalan sırayla dizi. Eğer... `func` fonksiyon belirtilir, `arr` sonucuna göre sıra islanır. `func` işlev dizinin öğelerine uygulanır ve sonra sıralanmış dizi tersine çevrilir. Eğer `func` birden fazla argüman kabul eder, `arrayReverseSort` fonksiyon argümanları birkaç diziler geçirilir `func` karşılık gelir. Ayrıntılı örnekler sonunda gösterilir `arrayReverseSort` açıklama. - -Tamsayı değerleri sıralama örneği: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - -``` text -┌─arrayReverseSort([1, 3, 3, 0])─┐ -│ [3,3,1,0] │ -└────────────────────────────────┘ -``` - -Dize değerleri sıralama örneği: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - -``` text -┌─arrayReverseSort(['hello', 'world', '!'])─┐ -│ ['world','hello','!'] │ -└───────────────────────────────────────────┘ -``` - -Aşağıdaki sıralama sırasını göz önünde bulundurun `NULL`, `NaN` ve `Inf` değerler: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` text -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- `Inf` değerler dizide ilk sırada yer alır. -- `NULL` değerler dizideki son değerlerdir. -- `NaN` değerler hemen önce `NULL`. -- `-Inf` değerler hemen önce `NaN`. - -Not `arrayReverseSort` is a [yüksek sipariş fonksiyonu](higher_order_functions.md). Bir lambda işlevini ilk argüman olarak iletebilirsiniz. Örnek aşağıda gösterilmiştir. - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [1,2,3] │ -└─────────┘ -``` - -Dizi aşağıdaki şekilde sıralanır: - -1. İlk başta, kaynak dizi (\[1, 2, 3\]), dizinin elemanlarına uygulanan lambda işlevinin sonucuna göre sıralanır. Sonuç bir dizidir \[3, 2, 1\]. -2. Önceki adımda elde edilen dizi tersine çevrilir. Yani, nihai sonuç \[1, 2, 3\]. - -Lambda işlevi birden çok bağımsız değişken kabul edebilir. Bu durumda, geçmek gerekir `arrayReverseSort` işlev lambda işlevinin argümanlarının karşılık geleceği aynı uzunlukta birkaç dizi. Elde edilen dizi ilk giriş dizisinden elemanlardan oluşacaktır; bir sonraki giriş dizilerinden elemanlar sıralama anahtarlarını belirtir. Mesela: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -Bu örnekte, dizi aşağıdaki şekilde sıralanır: - -1. İlk başta, kaynak dizi (\[‘hello’, ‘world’\]) dizilerin elemanlarına uygulanan lambda işlevinin sonucuna göre sıralanır. İkinci dizide geçirilen öğeler (\[2, 1\]), kaynak diziden karşılık gelen öğeler için sıralama anahtarlarını tanımlar. Sonuç bir dizidir \[‘world’, ‘hello’\]. -2. Önceki adımda sıralanmış dizi tersine çevrilir. Yani, nihai sonuç \[‘hello’, ‘world’\]. - -Diğer örnekler aşağıda gösterilmiştir. - -``` sql -SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; -``` - -``` text -┌─res─────┐ -│ [5,3,4] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` text -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#arrayuniqarr} - -Bir bağımsız değişken geçirilirse, dizideki farklı öğelerin sayısını sayar. -Birden çok bağımsız değişken geçirilirse, birden çok dizideki karşılık gelen konumlardaki farklı öğe kümelerinin sayısını sayar. - -Bir dizideki benzersiz öğelerin bir listesini almak istiyorsanız, arrayreduce kullanabilirsiniz(‘groupUniqArray’, arr). - -## arrayJoin(arr) {#array-functions-join} - -Özel bir işlev. Bölümüne bakınız [“ArrayJoin function”](array_join.md#functions_arrayjoin). - -## arrayDifference {#arraydifference} - -Bitişik dizi öğeleri arasındaki farkı hesaplar. İlk öğenin 0 olacağı bir dizi döndürür, ikincisi arasındaki farktır `a[1] - a[0]`, etc. The type of elements in the resulting array is determined by the type inference rules for subtraction (e.g. `UInt8` - `UInt8` = `Int16`). - -**Sözdizimi** - -``` sql -arrayDifference(array) -``` - -**Parametre** - -- `array` – [Dizi](https://clickhouse.yandex/docs/en/data_types/array/). - -**Döndürülen değerler** - -Bitişik öğeler arasındaki farklar dizisini döndürür. - -Tür: [Uİnt\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#uint-ranges), [Tamsayı\*](https://clickhouse.yandex/docs/en/data_types/int_uint/#int-ranges), [Yüzdürmek\*](https://clickhouse.yandex/docs/en/data_types/float/). - -**Örnek** - -Sorgu: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - -Sonuç: - -``` text -┌─arrayDifference([1, 2, 3, 4])─┐ -│ [0,1,1,1] │ -└───────────────────────────────┘ -``` - -Sonuç türü Int64 nedeniyle taşma örneği: - -Sorgu: - -``` sql -SELECT arrayDifference([0, 10000000000000000000]) -``` - -Sonuç: - -``` text -┌─arrayDifference([0, 10000000000000000000])─┐ -│ [0,-8446744073709551616] │ -└────────────────────────────────────────────┘ -``` - -## arrayDistinct {#arraydistinct} - -Bir dizi alır, yalnızca farklı öğeleri içeren bir dizi döndürür. - -**Sözdizimi** - -``` sql -arrayDistinct(array) -``` - -**Parametre** - -- `array` – [Dizi](https://clickhouse.yandex/docs/en/data_types/array/). - -**Döndürülen değerler** - -Farklı öğeleri içeren bir dizi döndürür. - -**Örnek** - -Sorgu: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - -Sonuç: - -``` text -┌─arrayDistinct([1, 2, 2, 3, 1])─┐ -│ [1,2,3] │ -└────────────────────────────────┘ -``` - -## arrayEnumerateDense(arr) {#array_functions-arrayenumeratedense} - -Kaynak diziyle aynı boyutta bir dizi döndürür ve her öğenin kaynak dizide ilk olarak nerede göründüğünü gösterir. - -Örnek: - -``` sql -SELECT arrayEnumerateDense([10, 20, 10, 30]) -``` - -``` text -┌─arrayEnumerateDense([10, 20, 10, 30])─┐ -│ [1,2,1,3] │ -└───────────────────────────────────────┘ -``` - -## arrayıntersect(arr) {#array-functions-arrayintersect} - -Birden çok dizi alır, tüm kaynak dizilerde bulunan öğeleri içeren bir dizi döndürür. Elde edilen dizideki öğeler sırası ilk dizideki ile aynıdır. - -Örnek: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - -``` text -┌─no_intersect─┬─intersect─┐ -│ [] │ [1] │ -└──────────────┴───────────┘ -``` - -## arrayReduce {#arrayreduce} - -Dizi öğelerine bir toplama işlevi uygular ve sonucunu döndürür. Toplama işlevinin adı, tek tırnak içinde bir dize olarak geçirilir `'max'`, `'sum'`. Parametrik toplama işlevleri kullanıldığında, parametre parantez içinde işlev adından sonra gösterilir `'uniqUpTo(6)'`. - -**Sözdizimi** - -``` sql -arrayReduce(agg_func, arr1, arr2, ..., arrN) -``` - -**Parametre** - -- `agg_func` — The name of an aggregate function which should be a constant [dize](../../sql_reference/data_types/string.md). -- `arr` — Any number of [dizi](../../sql_reference/data_types/array.md) sütunları toplama işlevinin parametreleri olarak yazın. - -**Döndürülen değer** - -**Örnek** - -``` sql -SELECT arrayReduce('max', [1, 2, 3]) -``` - -``` text -┌─arrayReduce('max', [1, 2, 3])─┐ -│ 3 │ -└───────────────────────────────┘ -``` - -Bir toplama işlevi birden çok bağımsız değişken alırsa, bu işlev aynı boyuttaki birden çok diziye uygulanmalıdır. - -``` sql -SELECT arrayReduce('maxIf', [3, 5], [1, 0]) -``` - -``` text -┌─arrayReduce('maxIf', [3, 5], [1, 0])─┐ -│ 3 │ -└──────────────────────────────────────┘ -``` - -Parametrik toplama fonksiyonu ile örnek: - -``` sql -SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -``` - -``` text -┌─arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])─┐ -│ 4 │ -└─────────────────────────────────────────────────────────────┘ -``` - -## arrayReduceİnRanges {#arrayreduceinranges} - -Belirli aralıklardaki dizi öğelerine bir toplama işlevi uygular ve her aralığa karşılık gelen sonucu içeren bir dizi döndürür. Fonksiyon aynı sonucu birden fazla olarak döndürür `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`. - -**Sözdizimi** - -``` sql -arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN) -``` - -**Parametre** - -- `agg_func` — The name of an aggregate function which should be a constant [dize](../../sql_reference/data_types/string.md). -- `ranges` — The ranges to aggretate which should be an [dizi](../../sql_reference/data_types/array.md) -den [Demetler](../../sql_reference/data_types/tuple.md) indeks ve her aralığın uzunluğunu içeren. -- `arr` — Any number of [dizi](../../sql_reference/data_types/array.md) sütunları toplama işlevinin parametreleri olarak yazın. - -**Döndürülen değer** - -**Örnek** - -``` sql -SELECT arrayReduceInRanges( - 'sum', - [(1, 5), (2, 3), (3, 4), (4, 4)], - [1000000, 200000, 30000, 4000, 500, 60, 7] -) AS res -``` - -``` text -┌─res─────────────────────────┐ -│ [1234500,234000,34560,4567] │ -└─────────────────────────────┘ -``` - -## arrayReverse(arr) {#arrayreverse} - -Öğeleri ters sırada içeren orijinal diziyle aynı boyutta bir dizi döndürür. - -Örnek: - -``` sql -SELECT arrayReverse([1, 2, 3]) -``` - -``` text -┌─arrayReverse([1, 2, 3])─┐ -│ [3,2,1] │ -└─────────────────────────┘ -``` - -## ters (arr) {#array-functions-reverse} - -Eşanlamlı [“arrayReverse”](#array_functions-arrayreverse) - -## arrayFlatten {#arrayflatten} - -Bir dizi diziyi düz bir diziye dönüştürür. - -İşlev: - -- İç içe geçmiş dizilerin herhangi bir derinliği için geçerlidir. -- Zaten düz olan dizileri değiştirmez. - -Düzleştirilmiş dizi, tüm kaynak dizilerdeki tüm öğeleri içerir. - -**Sözdizimi** - -``` sql -flatten(array_of_arrays) -``` - -Takma ad: `flatten`. - -**Parametre** - -- `array_of_arrays` — [Dizi](../../sql_reference/data_types/array.md) dizilerin. Mesela, `[[1,2,3], [4,5]]`. - -**Örnekler** - -``` sql -SELECT flatten([[[1]], [[2], [3]]]) -``` - -``` text -┌─flatten(array(array([1]), array([2], [3])))─┐ -│ [1,2,3] │ -└─────────────────────────────────────────────┘ -``` - -## arrayCompact {#arraycompact} - -Ardışık yinelenen öğeleri bir diziden kaldırır. Sonuç değerlerinin sırası, kaynak dizideki sıraya göre belirlenir. - -**Sözdizimi** - -``` sql -arrayCompact(arr) -``` - -**Parametre** - -`arr` — The [dizi](../../sql_reference/data_types/array.md) incelemek. - -**Döndürülen değer** - -Yinelenen olmadan dizi. - -Tür: `Array`. - -**Örnek** - -Sorgu: - -``` sql -SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]) -``` - -Sonuç: - -``` text -┌─arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])─┐ -│ [1,nan,nan,2,3] │ -└────────────────────────────────────────────┘ -``` - -## arrayZip {#arrayzip} - -Birden çok diziyi tek bir dizide birleştirir. Elde edilen dizi, listelenen bağımsız değişken sırasına göre gruplandırılmış kaynak dizilerin karşılık gelen öğelerini içerir. - -**Sözdizimi** - -``` sql -arrayZip(arr1, arr2, ..., arrN) -``` - -**Parametre** - -- `arrN` — [Dizi](../data_types/array.md). - -İşlev, farklı türde herhangi bir dizi alabilir. Tüm giriş dizileri eşit boyutta olmalıdır. - -**Döndürülen değer** - -- Gruplandırılmış kaynak dizilerden öğelerle dizi [Demetler](../data_types/tuple.md). Veri türleri tuple giriş dizileri türleri ile aynıdır ve diziler geçirilir aynı sırada. - -Tür: [Dizi](../data_types/array.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]) -``` - -Sonuç: - -``` text -┌─arrayZip(['a', 'b', 'c'], [5, 2, 1])─┐ -│ [('a',5),('b',2),('c',1)] │ -└──────────────────────────────────────┘ -``` - -## arrayAUC {#arrayauc} - -Auc'yi hesaplayın (makine öğreniminde bir kavram olan eğrinin altındaki alan, daha fazla ayrıntıya bakın: https://en.wikipedia.org/wiki/Receiver\_operating\_characteristic\#Area\_under\_the\_curve). - -**Sözdizimi** - -``` sql -arrayAUC(arr_scores, arr_labels) -``` - -**Parametre** -- `arr_scores` — scores prediction model gives. -- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample. - -**Döndürülen değer** -Float64 türü ile AUC değerini döndürür. - -**Örnek** -Sorgu: - -``` sql -select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]) -``` - -Sonuç: - -``` text -┌─arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])─┐ -│ 0.75 │ -└────────────────────────────────────────---──┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/tr/sql_reference/functions/bit_functions.md b/docs/tr/sql_reference/functions/bit_functions.md deleted file mode 100644 index 1e8d9761d5d..00000000000 --- a/docs/tr/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 48 -toc_title: Bitlik ---- - -# Bit fonksiyonları {#bit-functions} - -Bit işlevleri, uint8, Uİnt16, Uİnt32, Uint64, Int8, Int16, Int32, Int64, Float32 veya Float64 türlerinden herhangi bir çift için çalışır. - -Sonuç türü, bağımsız değişkenlerinin maksimum bitlerine eşit bit içeren bir tamsayıdır. Bağımsız değişkenlerden en az biri imzalanırsa, sonuç imzalı bir sayıdır. Bir bağımsız değişken bir kayan noktalı sayı ise, Int64 için cast. - -## bıtor(a, b) {#bitanda-b} - -## bitOr(a, b) {#bitora-b} - -## bitXor(a, b) {#bitxora-b} - -## bitNot (a) {#bitnota} - -## bitShiftLeft(a, b) {#bitshiftlefta-b} - -## bitShiftRight(a, b) {#bitshiftrighta-b} - -## bitRotateLeft(a, b) {#bitrotatelefta-b} - -## bitRotateRight(a, b) {#bitrotaterighta-b} - -## bitTest {#bittest} - -Herhangi bir tamsayı alır ve dönüştürür [ikili form](https://en.wikipedia.org/wiki/Binary_number), belirtilen konumda bir bit değerini döndürür. Geri sayım sağdan sola 0 başlar. - -**Sözdizimi** - -``` sql -SELECT bitTest(number, index) -``` - -**Parametre** - -- `number` – integer number. -- `index` – position of bit. - -**Döndürülen değerler** - -Belirtilen konumda bit değeri döndürür. - -Tür: `UInt8`. - -**Örnek** - -Örneğin, taban-2 (ikili) sayı sistemindeki 43 sayısı 101011'dir. - -Sorgu: - -``` sql -SELECT bitTest(43, 1) -``` - -Sonuç: - -``` text -┌─bitTest(43, 1)─┐ -│ 1 │ -└────────────────┘ -``` - -Başka bir örnek: - -Sorgu: - -``` sql -SELECT bitTest(43, 2) -``` - -Sonuç: - -``` text -┌─bitTest(43, 2)─┐ -│ 0 │ -└────────────────┘ -``` - -## bitTestAll {#bittestall} - -Sonucu döndürür [mantıksal conjuction](https://en.wikipedia.org/wiki/Logical_conjunction) Verilen pozisyonlarda tüm bitlerin (ve operatörü). Geri sayım sağdan sola 0 başlar. - -Bitsel işlemler için conjuction: - -0 AND 0 = 0 - -0 AND 1 = 0 - -1 AND 0 = 0 - -1 AND 1 = 1 - -**Sözdizimi** - -``` sql -SELECT bitTestAll(number, index1, index2, index3, index4, ...) -``` - -**Parametre** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) doğru ise ve sadece tüm pozisyon trueları doğru ise (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`). - -**Döndürülen değerler** - -Mantıksal conjuction sonucunu döndürür. - -Tür: `UInt8`. - -**Örnek** - -Örneğin, taban-2 (ikili) sayı sistemindeki 43 sayısı 101011'dir. - -Sorgu: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5) -``` - -Sonuç: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5)─┐ -│ 1 │ -└────────────────────────────┘ -``` - -Başka bir örnek: - -Sorgu: - -``` sql -SELECT bitTestAll(43, 0, 1, 3, 5, 2) -``` - -Sonuç: - -``` text -┌─bitTestAll(43, 0, 1, 3, 5, 2)─┐ -│ 0 │ -└───────────────────────────────┘ -``` - -## bitTestAny {#bittestany} - -Sonucu döndürür [mantıksal ayrılma](https://en.wikipedia.org/wiki/Logical_disjunction) Verilen konumlardaki tüm bitlerin (veya operatör). Geri sayım sağdan sola 0 başlar. - -Bitsel işlemler için ayrılma: - -0 OR 0 = 0 - -0 OR 1 = 1 - -1 OR 0 = 1 - -1 OR 1 = 1 - -**Sözdizimi** - -``` sql -SELECT bitTestAny(number, index1, index2, index3, index4, ...) -``` - -**Parametre** - -- `number` – integer number. -- `index1`, `index2`, `index3`, `index4` – positions of bit. - -**Döndürülen değerler** - -Mantıksal disjuction sonucunu döndürür. - -Tür: `UInt8`. - -**Örnek** - -Örneğin, taban-2 (ikili) sayı sistemindeki 43 sayısı 101011'dir. - -Sorgu: - -``` sql -SELECT bitTestAny(43, 0, 2) -``` - -Sonuç: - -``` text -┌─bitTestAny(43, 0, 2)─┐ -│ 1 │ -└──────────────────────┘ -``` - -Başka bir örnek: - -Sorgu: - -``` sql -SELECT bitTestAny(43, 4, 2) -``` - -Sonuç: - -``` text -┌─bitTestAny(43, 4, 2)─┐ -│ 0 │ -└──────────────────────┘ -``` - -## bitCount {#bitcount} - -Bir sayının ikili gösteriminde birine ayarlanmış bit sayısını hesaplar. - -**Sözdizimi** - -``` sql -bitCount(x) -``` - -**Parametre** - -- `x` — [Tamsayı](../../sql_reference/data_types/int_uint.md) veya [kayan nokta](../../sql_reference/data_types/float.md) numara. İşlev, bellekteki değer gösterimini kullanır. Kayan noktalı sayıları desteklemeye izin verir. - -**Döndürülen değer** - -- Giriş numarasında birine ayarlanmış bit sayısı. - -İşlev, giriş değerini daha büyük bir türe dönüştürmez ([işaret uzantısı](https://en.wikipedia.org/wiki/Sign_extension)). Bu yüzden, örneğin , `bitCount(toUInt8(-1)) = 8`. - -Tür: `UInt8`. - -**Örnek** - -Örneğin 333 sayısını alın. İkili gösterimi: 0000000101001101. - -Sorgu: - -``` sql -SELECT bitCount(333) -``` - -Sonuç: - -``` text -┌─bitCount(333)─┐ -│ 5 │ -└───────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/tr/sql_reference/functions/bitmap_functions.md b/docs/tr/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index 1b4fb53e0e3..00000000000 --- a/docs/tr/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,496 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 49 -toc_title: "E\u015Flem" ---- - -# Bitmap işlevleri {#bitmap-functions} - -Bitmap işlevleri iki bit eşlemler nesne değeri hesaplama için çalışmak, yeni bitmap veya kardinality formül hesaplama, and, or, xor ve not, vb gibi kullanırken döndürmektir. - -Bitmap nesnesi için 2 çeşit inşaat yöntemi vardır. Biri-State ile toplama işlevi groupBitmap tarafından inşa edilecek, diğeri Array nesnesi tarafından inşa edilecek. Ayrıca bitmap nesnesini dizi nesnesine dönüştürmektir. - -Roaringbitmap, Bitmap nesnelerinin gerçek depolanması sırasında bir veri yapısına sarılır. Önemlilik 32'den küçük veya eşit olduğunda, Set objet kullanır. Kardinality 32'den büyük olduğunda, roaringbitmap nesnesi kullanır. Bu nedenle düşük kardinalite kümesinin depolanması daha hızlıdır. - -RoaringBitmap hakkında daha fazla bilgi için bkz: [CRoaring](https://github.com/RoaringBitmap/CRoaring). - -## bitmapBuild {#bitmap_functions-bitmapbuild} - -İmzasız tamsayı dizisinden bir bit eşlem oluşturun. - -``` sql -bitmapBuild(array) -``` - -**Parametre** - -- `array` – unsigned integer array. - -**Örnek** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res) -``` - -``` text -┌─res─┬─toTypeName(bitmapBuild([1, 2, 3, 4, 5]))─────┐ -│  │ AggregateFunction(groupBitmap, UInt8) │ -└─────┴──────────────────────────────────────────────┘ -``` - -## bitmapToArray {#bitmaptoarray} - -Bitmap'i tamsayı dizisine dönüştürün. - -``` sql -bitmapToArray(bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapsubsetınrange {#bitmap-functions-bitmapsubsetinrange} - -Belirtilen aralıktaki alt kümesi döndürür (range\_end içermez). - -``` sql -bitmapSubsetInRange(bitmap, range_start, range_end) -``` - -**Parametre** - -- `bitmap` – [Bitmap nesnesi](#bitmap_functions-bitmapbuild). -- `range_start` – range start point. Type: [Uİnt32](../../sql_reference/data_types/int_uint.md). -- `range_end` – range end point(excluded). Type: [Uİnt32](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -``` text -┌─res───────────────┐ -│ [30,31,32,33,100] │ -└───────────────────┘ -``` - -## bitmapSubsetLimit {#bitmapsubsetlimit} - -Arasında alınan n öğeleri ile bitmap bir alt kümesi oluşturur `range_start` ve `cardinality_limit`. - -**Sözdizimi** - -``` sql -bitmapSubsetLimit(bitmap, range_start, cardinality_limit) -``` - -**Parametre** - -- `bitmap` – [Bitmap nesnesi](#bitmap_functions-bitmapbuild). -- `range_start` – The subset starting point. Type: [Uİnt32](../../sql_reference/data_types/int_uint.md). -- `cardinality_limit` – The subset cardinality upper limit. Type: [Uİnt32](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değer** - -Alt. - -Tür: `Bitmap object`. - -**Örnek** - -Sorgu: - -``` sql -SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - -Sonuç: - -``` text -┌─res───────────────────────┐ -│ [30,31,32,33,100,200,500] │ -└───────────────────────────┘ -``` - -## bitmapContains {#bitmap_functions-bitmapcontains} - -Bit eşlem bir öğe içerip içermediğini denetler. - -``` sql -bitmapContains(haystack, needle) -``` - -**Parametre** - -- `haystack` – [Bitmap nesnesi](#bitmap_functions-bitmapbuild), fonksiyon arar nerede. -- `needle` – Value that the function searches. Type: [Uİnt32](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- 0 — If `haystack` içermez `needle`. -- 1 — If `haystack` içeriyor `needle`. - -Tür: `UInt8`. - -**Örnek** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAny {#bitmaphasany} - -İki bit eşlemin bazı öğelerle kesiştiği olup olmadığını kontrol eder. - -``` sql -bitmapHasAny(bitmap1, bitmap2) -``` - -Eğer eminseniz `bitmap2` kesinlikle bir öğe içerir, kullanmayı düşünün [bitmapContains](#bitmap_functions-bitmapcontains) işlev. Daha verimli çalışır. - -**Parametre** - -- `bitmap*` – bitmap object. - -**Dönüş değerleri** - -- `1`, eğer `bitmap1` ve `bitmap2` en azından benzer bir öğeye sahip olun. -- `0`, başka. - -**Örnek** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAll {#bitmaphasall} - -Benzer `hasAll(array, array)` ilk bit eşlem, ikincisinin tüm öğelerini içeriyorsa, 1 değerini döndürür, aksi halde 0. -İkinci bağımsız değişken boş bir bit eşlem ise, 1 döndürür. - -``` sql -bitmapHasAll(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - -``` text -┌─res─┐ -│ 0 │ -└─────┘ -``` - -## bitmapCardinality {#bitmapcardinality} - -Retrun bit eşlem kardinalite türü Uİnt64. - -``` sql -bitmapCardinality(bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapMin {#bitmapmin} - -Kümedeki uint64 türünün en küçük değerini yeniden çalıştırın, küme boşsa UİNT32\_MAX. - - bitmapMin(bitmap) - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapMax {#bitmapmax} - -Küme boşsa, kümedeki uint64 türünün en büyük değerini 0 olarak yeniden çalıştırın. - - bitmapMax(bitmap) - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## bitmapTransform {#bitmaptransform} - -Bitmap'teki bir değer dizisini başka bir değer dizisine dönüştürün, sonuç yeni bir bitmap'tir. - - bitmapTransform(bitmap, from_array, to_array) - -**Parametre** - -- `bitmap` – bitmap object. -- `from_array` – UInt32 array. For idx in range \[0, from\_array.size()), if bitmap contains from\_array\[idx\], then replace it with to\_array\[idx\]. Note that the result depends on array ordering if there are common elements between from\_array and to\_array. -- `to_array` – UInt32 array, its size shall be the same to from\_array. - -**Örnek** - -``` sql -SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res -``` - - ┌─res───────────────────┐ - │ [1,3,4,6,7,8,9,10,20] │ - └───────────────────────┘ - -## bitmapAnd {#bitmapand} - -İki bitmap ve hesaplama, sonuç yeni bir bitmap'tir. - -``` sql -bitmapAnd(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─┐ -│ [3] │ -└─────┘ -``` - -## bitmapOr {#bitmapor} - -İki bitmap veya hesaplama, sonuç yeni bir bitmap'tir. - -``` sql -bitmapOr(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res─────────┐ -│ [1,2,3,4,5] │ -└─────────────┘ -``` - -## bitmapXor {#bitmapxor} - -İki bitmap XOR hesaplama, sonuç yeni bir bitmap. - -``` sql -bitmapXor(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,4,5] │ -└───────────┘ -``` - -## bitmapAndnot {#bitmapandnot} - -İki bit eşlem andnot hesaplama, sonuç yeni bir bit eşlem. - -``` sql -bitmapAndnot(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - -``` text -┌─res───┐ -│ [1,2] │ -└───────┘ -``` - -## bitmapAndCardinality {#bitmapandcardinality} - -İki bitmap ve hesaplama, uint64 türünün kardinalliğini döndürür. - -``` sql -bitmapAndCardinality(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapOrCardinality {#bitmaporcardinality} - -İki bitmap veya hesaplama, uint64 türünün kardinalliğini döndürür. - -``` sql -bitmapOrCardinality(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 5 │ -└─────┘ -``` - -## bitmapXorCardinality {#bitmapxorcardinality} - -İki bitmap XOR hesaplama, uint64 türünün kardinalliğini döndürür. - -``` sql -bitmapXorCardinality(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 4 │ -└─────┘ -``` - -## bitmapAndnotCardinality {#bitmapandnotcardinality} - -İki bitmap andnot hesaplama, uint64 türünün kardinalliğini döndürür. - -``` sql -bitmapAndnotCardinality(bitmap,bitmap) -``` - -**Parametre** - -- `bitmap` – bitmap object. - -**Örnek** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - -``` text -┌─res─┐ -│ 2 │ -└─────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/tr/sql_reference/functions/conditional_functions.md b/docs/tr/sql_reference/functions/conditional_functions.md deleted file mode 100644 index b2e918666a0..00000000000 --- a/docs/tr/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,207 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 43 -toc_title: "Ko\u015Fullu " ---- - -# Koşullu fonksiyonlar {#conditional-functions} - -## eğer {#if} - -Koşullu dallanmayı kontrol eder. Çoğu sistemin aksine, ClickHouse her zaman her iki ifadeyi de değerlendirir `then` ve `else`. - -**Sözdizimi** - -``` sql -SELECT if(cond, then, else) -``` - -Eğer durum `cond` sıfır olmayan bir değere değerlendirir, ifadenin sonucunu döndürür `then` ve ifad andenin sonucu `else` varsa, atlanır. Eğer... `cond` sıfır veya `NULL` fakat daha sonra sonucu `then` ifade atlanır ve sonucu `else` Ifade, varsa, döndürülür. - -**Parametre** - -- `cond` – The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL. -- `then` - Koşul karşılanırsa dönmek için ifade. -- `else` - Koşul karşılanmazsa dönmek için ifade. - -**Döndürülen değerler** - -İşlev yürütür `then` ve `else` ifadeler ve koşulun olup olmadığına bağlı olarak sonucunu döndürür `cond` sıfır ya da değil. - -**Örnek** - -Sorgu: - -``` sql -SELECT if(1, plus(2, 2), plus(2, 6)) -``` - -Sonuç: - -``` text -┌─plus(2, 2)─┐ -│ 4 │ -└────────────┘ -``` - -Sorgu: - -``` sql -SELECT if(0, plus(2, 2), plus(2, 6)) -``` - -Sonuç: - -``` text -┌─plus(2, 6)─┐ -│ 8 │ -└────────────┘ -``` - -- `then` ve `else` en düşük ortak türe sahip olmalıdır. - -**Örnek:** - -Bunu al `LEFT_RIGHT` Tablo: - -``` sql -SELECT * -FROM LEFT_RIGHT - -┌─left─┬─right─┐ -│ ᴺᵁᴸᴸ │ 4 │ -│ 1 │ 3 │ -│ 2 │ 2 │ -│ 3 │ 1 │ -│ 4 │ ᴺᵁᴸᴸ │ -└──────┴───────┘ -``` - -Aşağıdaki sorgu karşılaştırır `left` ve `right` değerler: - -``` sql -SELECT - left, - right, - if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller -FROM LEFT_RIGHT -WHERE isNotNull(left) AND isNotNull(right) - -┌─left─┬─right─┬─is_smaller──────────────────────────┐ -│ 1 │ 3 │ left is smaller than right │ -│ 2 │ 2 │ right is greater or equal than left │ -│ 3 │ 1 │ right is greater or equal than left │ -└──────┴───────┴─────────────────────────────────────┘ -``` - -Not: `NULL` bu örnekte değerler kullanılmaz, kontrol edin [Koşullardaki boş değerler](#null-values-in-conditionals) bölme. - -## Üçlü Operatör {#ternary-operator} - -Aynı gibi çalışıyor. `if` işlev. - -Sözdizimi: `cond ? then : else` - -Dönüşler `then` eğer... `cond` true (sıfırdan büyük) olarak değerlendirir, aksi takdirde döndürür `else`. - -- `cond` türü olmalıdır `UInt8`, ve `then` ve `else` en düşük ortak türe sahip olmalıdır. - -- `then` ve `else` olabilir `NULL` - -**Ayrıca bakınız** - -- [ifNotFinite](other_functions.md#ifnotfinite). - -## multiİf {#multiif} - -Yaz allowsmanızı sağlar [CASE](../operators.md#operator_case) operatör sorguda daha kompakt. - -Sözdizimi: `multiIf(cond_1, then_1, cond_2, then_2, ..., else)` - -**Parametre:** - -- `cond_N` — The condition for the function to return `then_N`. -- `then_N` — The result of the function when executed. -- `else` — The result of the function if none of the conditions is met. - -İşlev kabul eder `2N+1` parametre. - -**Döndürülen değerler** - -İşlev, değerlerden birini döndürür `then_N` veya `else` bu koşullara bağlı olarak `cond_N`. - -**Örnek** - -Yine kullanarak `LEFT_RIGHT` Tablo. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─result──────────┐ -│ ᴺᵁᴸᴸ │ 4 │ Null value │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ left is greater │ -│ 4 │ ᴺᵁᴸᴸ │ Null value │ -└──────┴───────┴─────────────────┘ -``` - -## Koşullu sonuçları doğrudan kullanma {#using-conditional-results-directly} - -Koşullar her zaman sonuç `0`, `1` veya `NULL`. Böylece koşullu sonuçları doğrudan bu şekilde kullanabilirsiniz: - -``` sql -SELECT left < right AS is_small -FROM LEFT_RIGHT - -┌─is_small─┐ -│ ᴺᵁᴸᴸ │ -│ 1 │ -│ 0 │ -│ 0 │ -│ ᴺᵁᴸᴸ │ -└──────────┘ -``` - -## Koşullardaki boş değerler {#null-values-in-conditionals} - -Ne zaman `NULL` değerler koşullarla ilgilidir, sonuç da olacaktır `NULL`. - -``` sql -SELECT - NULL < 1, - 2 < NULL, - NULL < NULL, - NULL = NULL - -┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ -│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└───────────────┴───────────────┴──────────────────┴────────────────────┘ -``` - -Bu nedenle, sorgularınızı türleri dikkatli bir şekilde oluşturmalısınız `Nullable`. - -Aşağıdaki örnek, eşittir koşulu eklemek başarısız tarafından bu gösterir `multiIf`. - -``` sql -SELECT - left, - right, - multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result -FROM LEFT_RIGHT - -┌─left─┬─right─┬─faulty_result────┐ -│ ᴺᵁᴸᴸ │ 4 │ Both equal │ -│ 1 │ 3 │ left is smaller │ -│ 2 │ 2 │ Both equal │ -│ 3 │ 1 │ right is smaller │ -│ 4 │ ᴺᵁᴸᴸ │ Both equal │ -└──────┴───────┴──────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/tr/sql_reference/functions/date_time_functions.md b/docs/tr/sql_reference/functions/date_time_functions.md deleted file mode 100644 index fdcbacc7749..00000000000 --- a/docs/tr/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,450 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 39 -toc_title: "Tarih ve Saatlerle \xE7al\u0131\u015Fma" ---- - -# Tarih ve saatlerle çalışmak için işlevler {#functions-for-working-with-dates-and-times} - -Saat dilimleri için destek - -Saat dilimi için mantıksal kullanımı olan tarih ve Saat ile çalışmak için tüm işlevler, ikinci bir isteğe bağlı saat dilimi bağımsız değişkeni kabul edebilir. Örnek: Asya / Yekaterinburg. Bu durumda, yerel (varsayılan) yerine belirtilen saat dilimini kullanırlar. - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - -``` text -┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ -└─────────────────────┴────────────┴────────────┴─────────────────────┘ -``` - -UTC'DEN saat sayısına göre farklı olan yalnızca saat dilimleri desteklenir. - -## toTimeZone {#totimezone} - -Saat veya tarih ve saati belirtilen saat dilimine dönüştürün. - -## toYear {#toyear} - -Bir tarihi veya tarihi zamanla yıl numarasını (AD) içeren bir Uınt16 numarasına dönüştürür. - -## toQuarter {#toquarter} - -Bir tarihi veya tarihi zaman ile çeyrek sayısını içeren bir Uİnt8 numarasına dönüştürür. - -## toMonth {#tomonth} - -Bir tarih veya tarih ile saati, ay numarasını (1-12) içeren bir Uİnt8 numarasına dönüştürür. - -## bugünyıl {#todayofyear} - -Bir tarih veya tarih ile saat, yılın gün sayısını (1-366) içeren bir Uınt16 numarasına dönüştürür. - -## bugünay {#todayofmonth} - -Bir tarih veya tarih ile saat, Ayın gün sayısını (1-31) içeren bir Uınt8 numarasına dönüştürür. - -## bugünhafta {#todayofweek} - -Bir tarih veya tarih ile saat, haftanın gününün sayısını içeren bir Uınt8 numarasına dönüştürür (Pazartesi 1 ve pazar 7'dir). - -## toHour {#tohour} - -Saatli bir tarihi, 24 saatlik süre (0-23) saat sayısını içeren bir Uınt8 numarasına dönüştürür. -This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time). - -## toMinute {#tominute} - -Saatli bir tarihi, saatin dakika sayısını (0-59) içeren bir Uınt8 numarasına dönüştürür. - -## toSecond {#tosecond} - -Dakika (0-59) ikinci sayısını içeren bir uınt8 numarasına zaman ile bir tarih dönüştürür. -Sıçrama saniye hesaba değildir. - -## toUnixTimestamp {#to-unix-timestamp} - -DateTime argümanı için: değeri dahili sayısal gösterimine dönüştürür (Unıx Zaman Damgası). -String argümanı için: datetime'ı dizeden saat dilimine göre ayrıştırın (isteğe bağlı ikinci argüman, sunucu zaman dilimi varsayılan olarak kullanılır) ve karşılık gelen unıx zaman damgasını döndürür. -Tarih argümanı için: davranış belirtilmemiş. - -**Sözdizimi** - -``` sql -toUnixTimestamp(datetime) -toUnixTimestamp(str, [timezone]) -``` - -**Döndürülen değer** - -- Unix zaman damgasını döndürür. - -Tür: `UInt32`. - -**Örnek** - -Sorgu: - -``` sql -SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Asia/Tokyo') AS unix_timestamp -``` - -Sonuç: - -``` text -┌─unix_timestamp─┐ -│ 1509836867 │ -└────────────────┘ -``` - -## toStartOfYear {#tostartofyear} - -Yılın ilk gününe kadar bir tarih veya tarih aşağı yuvarlar. -Tarihi döndürür. - -## toStartOfİSOYear {#tostartofisoyear} - -ISO yılın ilk gününe kadar bir tarih veya tarih aşağı yuvarlar. -Tarihi döndürür. - -## toStartOfQuarter {#tostartofquarter} - -Çeyrek ilk güne kadar bir tarih veya tarih aşağı yuvarlar. -Çeyreğin ilk günü 1 Ocak, 1 Nisan, 1 Temmuz veya 1 ekim'dir. -Tarihi döndürür. - -## toStartOfMonth {#tostartofmonth} - -Ayın ilk gününe kadar bir tarih veya tarih aşağı yuvarlar. -Tarihi döndürür. - -!!! attention "Dikkat" - Yanlış tarihleri ayrıştırma davranışı uygulamaya özeldir. ClickHouse sıfır tarihi döndürebilir, bir istisna atabilir veya yapabilir “natural” taşmak. - -## toMonday {#tomonday} - -En yakın Pazartesi günü bir tarih veya tarih aşağı yuvarlar. -Tarihi döndürür. - -## toStartOfWeek(t \[, mod\]) {#tostartofweektmode} - -Modu ile en yakın pazar veya Pazartesi zaman bir tarih veya tarih aşağı yuvarlar. -Tarihi döndürür. -Mod bağımsız değişkeni, toWeek () için mod bağımsız değişkeni gibi çalışır. Tek bağımsız değişken sözdizimi için 0 mod değeri kullanılır. - -## toStartOfDay {#tostartofday} - -Günün başlangıcına kadar bir tarih aşağı yuvarlar. - -## toStartOfHour {#tostartofhour} - -Saat başlangıcına kadar bir tarih aşağı yuvarlar. - -## toStartOfMinute {#tostartofminute} - -Dakikanın başlangıcına kadar bir tarih aşağı yuvarlar. - -## toStartOfFiveMinute {#tostartoffiveminute} - -Beş dakikalık aralığın başlangıcına kadar bir tarih aşağı yuvarlar. - -## toStartOfTenMinutes {#tostartoftenminutes} - -On dakikalık aralığın başlangıcına kadar bir tarih aşağı yuvarlar. - -## toStartOfFifteenMinutes {#tostartoffifteenminutes} - -On beş dakikalık aralığın başlangıcına kadar tarih aşağı yuvarlar. - -## toStartOfİnterval (time\_or\_data, Aralık x birimi \[, time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -Bu, diğer işlevlerin bir genellemesidir `toStartOf*`. Mesela, -`toStartOfInterval(t, INTERVAL 1 year)` aynı döndürür `toStartOfYear(t)`, -`toStartOfInterval(t, INTERVAL 1 month)` aynı döndürür `toStartOfMonth(t)`, -`toStartOfInterval(t, INTERVAL 1 day)` aynı döndürür `toStartOfDay(t)`, -`toStartOfInterval(t, INTERVAL 15 minute)` aynı döndürür `toStartOfFifteenMinutes(t)` vb. - -## toTime {#totime} - -Belirli bir sabit tarihe zaman ile bir tarih dönüştürür, zaman korurken. - -## toRelativeYearNum {#torelativeyearnum} - -Geçmişte belirli bir sabit noktadan başlayarak, yıl sayısına saat veya tarih ile bir tarih dönüştürür. - -## toRelativeQuarterNum {#torelativequarternum} - -Geçmişte belirli bir sabit noktadan başlayarak, çeyrek sayısına saat veya tarih ile bir tarih dönüştürür. - -## toRelativeMonthNum {#torelativemonthnum} - -Geçmişte belirli bir sabit noktadan başlayarak, Ayın sayısına saat veya tarih ile bir tarih dönüştürür. - -## toRelativeWeekNum {#torelativeweeknum} - -Geçmişte belirli bir sabit noktadan başlayarak, haftanın sayısına saat veya tarih ile bir tarih dönüştürür. - -## toRelativeDayNum {#torelativedaynum} - -Geçmişte belirli bir sabit noktadan başlayarak, günün sayısına saat veya tarih ile bir tarih dönüştürür. - -## toRelativeHourNum {#torelativehournum} - -Geçmişte belirli bir sabit noktadan başlayarak, saat veya tarih ile bir tarih saat sayısına dönüştürür. - -## toRelativeMinuteNum {#torelativeminutenum} - -Geçmişte belirli bir sabit noktadan başlayarak, dakika sayısına saat veya tarih ile bir tarih dönüştürür. - -## toRelativeSecondNum {#torelativesecondnum} - -Geçmişte belirli bir sabit noktadan başlayarak, ikinci sayısına saat veya tarih ile bir tarih dönüştürür. - -## toİSOYear {#toisoyear} - -ISO yıl numarasını içeren bir uınt16 numarasına bir tarih veya tarih zaman dönüştürür. - -## toİSOWeek {#toisoweek} - -ISO hafta numarasını içeren bir uınt8 numarasına bir tarih veya tarih zaman dönüştürür. - -## toWeek (tarih \[, mod\]) {#toweekdatemode} - -Bu işlev, date veya datetime için hafta numarasını döndürür. ToWeek () ' in iki bağımsız değişkenli formu, haftanın pazar veya Pazartesi günü başlayıp başlamadığını ve dönüş değerinin 0 ile 53 arasında mı yoksa 1 ile 53 arasında mı olması gerektiğini belirlemenizi sağlar. Mod bağımsız değişkeni atlanırsa, varsayılan mod 0'dır. -`toISOWeek()`eşdeğer bir uyumluluk işlevidir `toWeek(date,3)`. -Aşağıdaki tabloda mod bağımsız değişkeni nasıl çalıştığını açıklar. - -| Modu | Haftanın ilk günü | Aralık | Week 1 is the first week … | -|------|-------------------|--------|----------------------------------| -| 0 | Pazar | 0-53 | bu yıl bir pazar günü ile | -| 1 | Pazartesi | 0-53 | bu yıl 4 veya daha fazla gün ile | -| 2 | Pazar | 1-53 | bu yıl bir pazar günü ile | -| 3 | Pazartesi | 1-53 | bu yıl 4 veya daha fazla gün ile | -| 4 | Pazar | 0-53 | bu yıl 4 veya daha fazla gün ile | -| 5 | Pazartesi | 0-53 | bu yıl bir Pazartesi ile | -| 6 | Pazar | 1-53 | bu yıl 4 veya daha fazla gün ile | -| 7 | Pazartesi | 1-53 | bu yıl bir Pazartesi ile | -| 8 | Pazar | 1-53 | 1 Ocak içerir | -| 9 | Pazartesi | 1-53 | 1 Ocak içerir | - -Bir anlamı olan mod değerleri için “with 4 or more days this year,” haftalar ISO 8601: 1988'e göre numaralandırılmıştır: - -- 1 Ocak içeren haftanın yeni yılda 4 veya daha fazla günü varsa, 1. haftadır. - -- Aksi takdirde, bir önceki yılın son haftasıdır ve bir sonraki hafta 1. haftadır. - -Bir anlamı olan mod değerleri için “contains January 1”, 1 Ocak haftanın 1.haft .asıdır. Haftanın yeni yılda kaç gün içerdiği önemli değil, sadece bir gün içerse bile. - -``` sql -toWeek(date, [, mode][, Timezone]) -``` - -**Parametre** - -- `date` – Date or DateTime. -- `mode` – Optional parameter, Range of values is \[0,9\], default is 0. -- `Timezone` – Optional parameter, it behaves like any other conversion function. - -**Örnek** - -``` sql -SELECT toDate('2016-12-27') AS date, toWeek(date) AS week0, toWeek(date,1) AS week1, toWeek(date,9) AS week9; -``` - -``` text -┌───────date─┬─week0─┬─week1─┬─week9─┐ -│ 2016-12-27 │ 52 │ 52 │ 1 │ -└────────────┴───────┴───────┴───────┘ -``` - -## toYearWeek (tarih \[, mod\]) {#toyearweekdatemode} - -Bir tarih için yıl ve hafta döndürür. Sonuçtaki yıl, yılın ilk ve son haftası için tarih argümanındaki yıldan farklı olabilir. - -Mod bağımsız değişkeni, toWeek () için mod bağımsız değişkeni gibi çalışır. Tek bağımsız değişken sözdizimi için 0 mod değeri kullanılır. - -`toISOYear()`eşdeğer bir uyumluluk işlevidir `intDiv(toYearWeek(date,3),100)`. - -**Örnek** - -``` sql -SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9; -``` - -``` text -┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┐ -│ 2016-12-27 │ 201652 │ 201652 │ 201701 │ -└────────────┴───────────┴───────────┴───────────┘ -``` - -## şimdi {#now} - -Sıfır bağımsız değişkeni kabul eder ve geçerli saati istek yürütme anlarından birinde döndürür. -Bu işlev, isteğin tamamlanması uzun zaman alsa bile bir sabit döndürür. - -## bugünkü {#today} - -Sıfır bağımsız değişkeni kabul eder ve geçerli tarihi, istek yürütme anlarından birinde döndürür. -Olarak aynı ‘toDate(now())’. - -## dün {#yesterday} - -Sıfır bağımsız değişkeni kabul eder ve istek yürütme anlarından birinde dünün tarihini döndürür. -Olarak aynı ‘today() - 1’. - -## zaman dilimi {#timeslot} - -Yarım saat için zaman yuvarlar. -Bu fonksiyon (kayıt olmak için özeldir.Metrica, yarım saat, bir izleme etiketi, tek bir kullanıcının ardışık sayfa görüntülemelerini, zaman içinde bu miktardan kesinlikle daha fazla farklılık gösteriyorsa, bir oturumu iki oturuma bölmek için minimum zaman miktarıdır. Bu, ilgili oturumda bulunan sayfa görüntülemelerini aramak için tuples (etiket kimliği, kullanıcı kimliği ve zaman dilimi) kullanılabileceği anlamına gelir. - -## toYYYYMM {#toyyyymm} - -Bir tarih veya tarih ile saat, yıl ve ay numarasını (YYYY \* 100 + MM) içeren bir Uınt32 numarasına dönüştürür. - -## toYYYYMMDD {#toyyyymmdd} - -Bir tarih veya tarih ile saat, yıl ve ay numarasını içeren bir Uınt32 numarasına dönüştürür (YYYY \* 10000 + MM \* 100 + DD). - -## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} - -Bir tarihi veya tarihi, yıl ve ay numarasını içeren bir Uınt64 numarasına dönüştürür (YYYY \* 1000000 + MM \* 1000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss). - -## addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addQuarters {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} - -İşlev, bir tarih/DateTime aralığına bir tarih/DateTime ekler ve ardından Tarih/Datetime'ı döndürür. Mesela: - -``` sql -WITH - toDate('2018-01-01') AS date, - toDateTime('2018-01-01 00:00:00') AS date_time -SELECT - addYears(date, 1) AS add_years_with_date, - addYears(date_time, 1) AS add_years_with_date_time -``` - -``` text -┌─add_years_with_date─┬─add_years_with_date_time─┐ -│ 2019-01-01 │ 2019-01-01 00:00:00 │ -└─────────────────────┴──────────────────────────┘ -``` - -## subtractYears, subtractMonths, subtractWeeks, subtractDays, subtractHours, subtractMinutes, subtractSeconds, subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} - -Fonksiyon bir tarih/DateTime aralığını bir tarih/DateTime olarak çıkarır ve ardından Tarih/Datetime'ı döndürür. Mesela: - -``` sql -WITH - toDate('2019-01-01') AS date, - toDateTime('2019-01-01 00:00:00') AS date_time -SELECT - subtractYears(date, 1) AS subtract_years_with_date, - subtractYears(date_time, 1) AS subtract_years_with_date_time -``` - -``` text -┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ -│ 2018-01-01 │ 2018-01-01 00:00:00 │ -└──────────────────────────┴───────────────────────────────┘ -``` - -## dateDiff {#datediff} - -İki Date veya DateTime değerleri arasındaki farkı döndürür. - -**Sözdizimi** - -``` sql -dateDiff('unit', startdate, enddate, [timezone]) -``` - -**Parametre** - -- `unit` — Time unit, in which the returned value is expressed. [Dize](../syntax.md#syntax-string-literal). - - Supported values: - - | unit | - | ---- | - |second | - |minute | - |hour | - |day | - |week | - |month | - |quarter | - |year | - -- `startdate` — The first time value to compare. [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). - -- `enddate` — The second time value to compare. [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). - -- `timezone` — Optional parameter. If specified, it is applied to both `startdate` ve `enddate`. Belirtilmemişse, saat dilimleri `startdate` ve `enddate` kullanılır. Aynı değilse, sonuç belirtilmemiştir. - -**Döndürülen değer** - -Arasındaki fark `startdate` ve `enddate` ifade edilen `unit`. - -Tür: `int`. - -**Örnek** - -Sorgu: - -``` sql -SELECT dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00')); -``` - -Sonuç: - -``` text -┌─dateDiff('hour', toDateTime('2018-01-01 22:00:00'), toDateTime('2018-01-02 23:00:00'))─┐ -│ 25 │ -└────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## (StartTime, Süresi,\[, Boyutu zaman yuvasının\]) {#timeslotsstarttime-duration-size} - -Başlayan bir zaman aralığı için ‘StartTime’ ve devam etmek için ‘Duration’ saniye, bu aralıktan aşağı yuvarlanan noktalardan oluşan zaman içinde bir dizi moment döndürür ‘Size’ saniyeler içinde. ‘Size’ isteğe bağlı bir parametredir: varsayılan olarak 1800 olarak ayarlanmış bir sabit Uİnt32. -Mesela, `timeSlots(toDateTime('2012-01-01 12:20:00'), 600) = [toDateTime('2012-01-01 12:00:00'), toDateTime('2012-01-01 12:30:00')]`. -Bu, ilgili oturumda sayfa görüntülemelerini aramak için gereklidir. - -## formatDateTime (saat, Biçim \[, Saat Dilimi\]) {#formatdatetime} - -Function formats a Time according given Format string. N.B.: Format is a constant expression, e.g. you can not have multiple formats for single result column. - -Biçim için desteklenen değiştiriciler: -(“Example” sütun, zaman için biçimlendirme sonucunu gösterir `2018-01-02 22:33:44`) - -| Değiştirici | Açıklama | Örnek | -|-------------|----------------------------------------------------------|------------| -| %C | yıl 100'e bölünür ve tamsayıya kesilir (00-99) | 20 | -| %d | Ayın günü, sıfır yastıklı (01-31) | 02 | -| %D | Kısa MM/DD/YY tarih, eşdeğer %m / %d / % y | 01/02/18 | -| %e | Ayın günü, boşluk dolgulu (1-31) | 2 | -| %F | kısa YYYY-AA-DD tarih, eşdeğer %Y-%m - %d | 2018-01-02 | -| %H | 24 saat formatında saat (00-23) | 22 | -| %I | 12h formatında saat (01-12) | 10 | -| %j | yılın günü (001-366) | 002 | -| %metre | ondalık sayı olarak ay (01-12) | 01 | -| %M | dakika (00-59) | 33 | -| %ve | new-line char (ac (ter (") | | -| %p | AM veya PM atama | PM | -| %R | 24-hour HH: MM Zaman, eşdeğer %H:%M | 22:33 | -| %S | ikinci (00-59) | 44 | -| %t | yatay-sekme karakteri (') | | -| %T | ISO 8601 saat biçimi (HH:MM:SS), eşdeğer %H:%M: % S | 22:33:44 | -| %u | ISO 8601 hafta içi sayı olarak Pazartesi olarak 1 (1-7) | 2 | -| %V | ISO 8601 hafta numarası (01-53) | 01 | -| %g | Pazar günü 0 (0-6) olarak ondalık sayı olarak hafta içi) | 2 | -| %y | Yıl, son iki basamak (00-99) | 18 | -| %Y | Yıllık | 2018 | -| %% | im | % | - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/tr/sql_reference/functions/encoding_functions.md b/docs/tr/sql_reference/functions/encoding_functions.md deleted file mode 100644 index 49ad1467957..00000000000 --- a/docs/tr/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 52 -toc_title: "Kodlam\u0131\u015F" ---- - -# Kodlama fonksiyonları {#encoding-functions} - -## kömürleşmek {#char} - -Geçirilen bağımsız değişkenlerin sayısı olarak uzunluğu olan dizeyi döndürür ve her bayt karşılık gelen bağımsız değişken değerine sahiptir. Sayısal türlerin birden çok bağımsız değişkeni kabul eder. Bağımsız değişken değeri uint8 veri türü aralığının dışındaysa, Olası yuvarlama ve taşma ile Uint8'e dönüştürülür. - -**Sözdizimi** - -``` sql -char(number_1, [number_2, ..., number_n]); -``` - -**Parametre** - -- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Tamsayı](../../sql_reference/data_types/int_uint.md), [Yüzdürmek](../../sql_reference/data_types/float.md). - -**Döndürülen değer** - -- verilen bayt dizisi. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello -``` - -Sonuç: - -``` text -┌─hello─┐ -│ hello │ -└───────┘ -``` - -Karşılık gelen baytları geçirerek bir rasgele kodlama dizesi oluşturabilirsiniz. İşte UTF-8 için örnek: - -Sorgu: - -``` sql -SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; -``` - -Sonuç: - -``` text -┌─hello──┐ -│ привет │ -└────────┘ -``` - -Sorgu: - -``` sql -SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; -``` - -Sonuç: - -``` text -┌─hello─┐ -│ 你好 │ -└───────┘ -``` - -## büyü {#hex} - -Bağımsız değişkenin onaltılık gösterimini içeren bir dize döndürür. - -**Sözdizimi** - -``` sql -hex(arg) -``` - -İşlev büyük harfler kullanıyor `A-F` ve herhangi bir önek kullanmamak (gibi `0x`) veya sonekler (gibi `h`). - -Tamsayı argümanları için, onaltılık basamak yazdırır (“nibbles”) en önemliden en önemlisine (big endian veya “human readable” sipariş). En önemli sıfır olmayan baytla başlar (önde gelen sıfır bayt atlanır), ancak önde gelen basamak sıfır olsa bile her baytın her iki basamağını da yazdırır. - -Örnek: - -**Örnek** - -Sorgu: - -``` sql -SELECT hex(1); -``` - -Sonuç: - -``` text -01 -``` - -Tip değerleri `Date` ve `DateTime` karşılık gelen tamsayılar olarak biçimlendirilir (tarih için çağdan bu yana geçen gün sayısı ve datetime için Unix zaman damgasının değeri). - -İçin `String` ve `FixedString`, tüm bayt sadece iki onaltılık sayı olarak kodlanır. Sıfır bayt ihmal edilmez. - -Kayan nokta ve ondalık türlerinin değerleri, bellekteki gösterimi olarak kodlanır. Küçük endian mimarisini desteklediğimiz için, bunlar küçük endian'da kodlanmıştır. Sıfır önde gelen / sondaki bayt ihmal edilmez. - -**Parametre** - -- `arg` — A value to convert to hexadecimal. Types: [Dize](../../sql_reference/data_types/string.md), [Uİnt](../../sql_reference/data_types/int_uint.md), [Yüzdürmek](../../sql_reference/data_types/float.md), [Ondalık](../../sql_reference/data_types/decimal.md), [Tarihli](../../sql_reference/data_types/date.md) veya [DateTime](../../sql_reference/data_types/datetime.md). - -**Döndürülen değer** - -- Bağımsız değişken onaltılık gösterimi ile bir dize. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT hex(toFloat32(number)) as hex_presentation FROM numbers(15, 2); -``` - -Sonuç: - -``` text -┌─hex_presentation─┐ -│ 00007041 │ -│ 00008041 │ -└──────────────────┘ -``` - -Sorgu: - -``` sql -SELECT hex(toFloat64(number)) as hex_presentation FROM numbers(15, 2); -``` - -Sonuç: - -``` text -┌─hex_presentation─┐ -│ 0000000000002E40 │ -│ 0000000000003040 │ -└──────────────────┘ -``` - -## unhex (str) {#unhexstr} - -Onaltılık basamak herhangi bir sayıda içeren bir dize kabul eder ve karşılık gelen bayt içeren bir dize döndürür. Hem büyük hem de küçük harfleri destekler a-F. onaltılık basamak sayısı bile olmak zorunda değildir. Tek ise, son rakam 00-0F baytın en az önemli yarısı olarak yorumlanır. Bağımsız değişken dizesi onaltılık basamaklardan başka bir şey içeriyorsa, uygulama tanımlı bazı sonuçlar döndürülür (bir özel durum atılmaz). -Sonucu bir sayıya dönüştürmek istiyorsanız, ‘reverse’ ve ‘reinterpretAsType’ işlevler. - -## UUİDStringToNum (str) {#uuidstringtonumstr} - -Biçiminde 36 karakter içeren bir dize kabul eder `123e4567-e89b-12d3-a456-426655440000` ve bir fixedstring(16) bayt kümesi olarak döndürür. - -## UUİDNumToString (str) {#uuidnumtostringstr} - -FixedString(16) değerini kabul eder. Metin biçiminde 36 karakter içeren bir dize döndürür. - -## bitmaskToList (num) {#bitmasktolistnum} - -Bir tamsayı kabul eder. Özetlendiğinde kaynak sayısını toplayan iki güç listesini içeren bir dize döndürür. Artan düzende metin biçiminde boşluk bırakmadan virgülle ayrılırlar. - -## bitmaskToArray (num) {#bitmasktoarraynum} - -Bir tamsayı kabul eder. Özetlendiğinde kaynak sayısını toplayan iki güç listesini içeren bir uint64 sayı dizisi döndürür. Dizideki sayılar artan düzendedir. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/tr/sql_reference/functions/ext_dict_functions.md b/docs/tr/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index 564ec9d5df0..00000000000 --- a/docs/tr/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 58 -toc_title: "Harici S\xF6zl\xFCklerle \xE7al\u0131\u015Fma" ---- - -# Harici Sözlüklerle Çalışmak İçin İşlevler {#ext_dict_functions} - -Dış sözlükleri bağlama ve yapılandırma hakkında bilgi için bkz. [Dış söz dictionarieslükler](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -## dictGet {#dictget} - -Harici bir sözlükten bir değer alır. - -``` sql -dictGet('dict_name', 'attr_name', id_expr) -dictGetOrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Parametre** - -- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql_reference/data_types/int_uint.md) veya [Demet](../../sql_reference/data_types/tuple.md)- sözlük yapılandırmasına bağlı olarak değer yazın. -- `default_value_expr` — Value returned if the dictionary doesn't contain a row with the `id_expr` anahtar. [İfade](../syntax.md#syntax-expressions) veri türü için yapılandırılmış değeri döndürme `attr_name` öznitelik. - -**Döndürülen değer** - -- ClickHouse özniteliği başarıyla ayrıştırırsa [öznitelik veri türü](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), fonksiyonlar karşılık gelen sözlük özniteliğinin değerini döndürür `id_expr`. - -- Anahtar yoksa, karşılık gelen `id_expr`, söz thelükte, sonra: - - - `dictGet` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGetOrDefault` returns the value passed as the `default_value_expr` parameter. - -Clickhouse, özniteliğin değerini ayrıştıramazsa veya değer öznitelik veri türüyle eşleşmiyorsa bir özel durum atar. - -**Örnek** - -Metin dosyası oluşturma `ext-dict-text.csv` aşağıdakileri içeren: - -``` text -1,1 -2,2 -``` - -İlk sütun `id` ikinci sütun `c1`. - -Dış sözlüğü yapılandırma: - -``` xml - - - ext-dict-test - - - /path-to/ext-dict-test.csv - CSV - - - - - - - - id - - - c1 - UInt32 - - - - 0 - - -``` - -Sorguyu gerçekleştir: - -``` sql -SELECT - dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val, - toTypeName(val) AS type -FROM system.numbers -LIMIT 3 -``` - -``` text -┌─val─┬─type───┐ -│ 1 │ UInt32 │ -│ 2 │ UInt32 │ -│ 20 │ UInt32 │ -└─────┴────────┘ -``` - -**Ayrıca Bakınız** - -- [Dış Söz Dictionarieslükler](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) - -## dictHas {#dicthas} - -Bir anahtar sözlükte mevcut olup olmadığını denetler. - -``` sql -dictHas('dict_name', id_expr) -``` - -**Parametre** - -- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip değeri. - -**Döndürülen değer** - -- 0, anahtar yoksa. -- 1, bir anahtar varsa. - -Tür: `UInt8`. - -## dictGetHierarchy {#dictgethierarchy} - -Bir anahtarın tüm ebeveynlerini içeren bir dizi oluşturur. [hiyerarş dictionaryik sözlük](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md). - -**Sözdizimi** - -``` sql -dictGetHierarchy('dict_name', key) -``` - -**Parametre** - -- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). -- `key` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip değeri. - -**Döndürülen değer** - -- Anahtar için ebeveynler. - -Tür: [Dizi (Uİnt64)](../../sql_reference/data_types/array.md). - -## dictİsİn {#dictisin} - -Sözlükteki tüm hiyerarşik zincir boyunca bir anahtarın atasını kontrol eder. - -``` sql -dictIsIn('dict_name', child_id_expr, ancestor_id_expr) -``` - -**Parametre** - -- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). -- `child_id_expr` — Key to be checked. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip değeri. -- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` anahtar. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip değeri. - -**Döndürülen değer** - -- 0, eğer `child_id_expr` bir çocuk değil mi `ancestor_id_expr`. -- 1, Eğer `child_id_expr` bir çocuk `ancestor_id_expr` veya eğer `child_id_expr` is an `ancestor_id_expr`. - -Tür: `UInt8`. - -## Diğer Fonksiyonlar {#ext_dict_functions-other} - -ClickHouse sözlük yapılandırma ne olursa olsun belirli bir veri türü için sözlük öznitelik değerlerini dönüştürmek özel işlevleri destekler. - -İşlevler: - -- `dictGetInt8`, `dictGetInt16`, `dictGetInt32`, `dictGetInt64` -- `dictGetUInt8`, `dictGetUInt16`, `dictGetUInt32`, `dictGetUInt64` -- `dictGetFloat32`, `dictGetFloat64` -- `dictGetDate` -- `dictGetDateTime` -- `dictGetUUID` -- `dictGetString` - -Tüm bu işlevler `OrDefault` değişiklik. Mesela, `dictGetDateOrDefault`. - -Sözdizimi: - -``` sql -dictGet[Type]('dict_name', 'attr_name', id_expr) -dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr) -``` - -**Parametre** - -- `dict_name` — Name of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). -- `attr_name` — Name of the column of the dictionary. [String lit literal](../syntax.md#syntax-string-literal). -- `id_expr` — Key value. [İfade](../syntax.md#syntax-expressions) dönen bir [Uİnt64](../../sql_reference/data_types/int_uint.md)- tip değeri. -- `default_value_expr` — Value which is returned if the dictionary doesn't contain a row with the `id_expr` anahtar. [İfade](../syntax.md#syntax-expressions) veri türü için yapılandırılmış bir değer döndürme `attr_name` öznitelik. - -**Döndürülen değer** - -- ClickHouse özniteliği başarıyla ayrıştırırsa [öznitelik veri türü](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md#ext_dict_structure-attributes), fonksiyonlar karşılık gelen sözlük özniteliğinin değerini döndürür `id_expr`. - -- İsten nomiyorsa `id_expr` söz thelükte o zaman: - - - `dictGet[Type]` returns the content of the `` element specified for the attribute in the dictionary configuration. - - `dictGet[Type]OrDefault` returns the value passed as the `default_value_expr` parameter. - -Clickhouse, özniteliğin değerini ayrıştıramazsa veya değer öznitelik veri türüyle eşleşmiyorsa bir özel durum atar. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/tr/sql_reference/functions/functions_for_nulls.md b/docs/tr/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 59567067c42..00000000000 --- a/docs/tr/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,312 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 63 -toc_title: "Null arg\xFCmanlarla \xE7al\u0131\u015Fma" ---- - -# Null agregalarla çalışmak için işlevler {#functions-for-working-with-nullable-aggregates} - -## isNull {#isnull} - -Bağımsız değişken olup olmadığını denetler [NULL](../syntax.md#null). - -``` sql -isNull(x) -``` - -**Parametre** - -- `x` — A value with a non-compound data type. - -**Döndürülen değer** - -- `1` eğer `x` oluyor `NULL`. -- `0` eğer `x` değildir `NULL`. - -**Örnek** - -Giriş tablosu - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Sorgu - -``` sql -SELECT x FROM t_null WHERE isNull(y) -``` - -``` text -┌─x─┐ -│ 1 │ -└───┘ -``` - -## isNotNull {#isnotnull} - -Bağımsız değişken olup olmadığını denetler [NULL](../syntax.md#null). - -``` sql -isNotNull(x) -``` - -**Parametre:** - -- `x` — A value with a non-compound data type. - -**Döndürülen değer** - -- `0` eğer `x` oluyor `NULL`. -- `1` eğer `x` değildir `NULL`. - -**Örnek** - -Giriş tablosu - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Sorgu - -``` sql -SELECT x FROM t_null WHERE isNotNull(y) -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## birleşmek {#coalesce} - -Olup olmadığını soldan sağa denetler `NULL` argümanlar geçti ve ilk olmayan döndürür-`NULL` değişken. - -``` sql -coalesce(x,...) -``` - -**Parametre:** - -- Bileşik olmayan tipte herhangi bir sayıda parametre. Tüm parametreler veri türüne göre uyumlu olmalıdır. - -**Döndürülen değerler** - -- İlk sigara-`NULL` değişken. -- `NULL`, eğer tüm argümanlar `NULL`. - -**Örnek** - -Bir müşteriyle iletişim kurmak için birden çok yol belirtebilecek kişilerin listesini düşünün. - -``` text -┌─name─────┬─mail─┬─phone─────┬──icq─┐ -│ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ -│ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ -└──────────┴──────┴───────────┴──────┘ -``` - -Bu `mail` ve `phone` alanlar String tip ofindedir, ancak `icq` Fi fieldeld is `UInt32`, bu yüzden dönüştürülmesi gerekiyor `String`. - -Müşteri için ilk kullanılabilir iletişim yöntemini kişi listesinden alın: - -``` sql -SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook -``` - -``` text -┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ -│ client 1 │ 123-45-67 │ -│ client 2 │ ᴺᵁᴸᴸ │ -└──────────┴──────────────────────────────────────────────────────┘ -``` - -## ifNull {#ifnull} - -Ana bağımsız değişken ise alternatif bir değer döndürür `NULL`. - -``` sql -ifNull(x,alt) -``` - -**Parametre:** - -- `x` — The value to check for `NULL`. -- `alt` — The value that the function returns if `x` oluyor `NULL`. - -**Döndürülen değerler** - -- Değer `x`, eğer `x` değildir `NULL`. -- Değer `alt`, eğer `x` oluyor `NULL`. - -**Örnek** - -``` sql -SELECT ifNull('a', 'b') -``` - -``` text -┌─ifNull('a', 'b')─┐ -│ a │ -└──────────────────┘ -``` - -``` sql -SELECT ifNull(NULL, 'b') -``` - -``` text -┌─ifNull(NULL, 'b')─┐ -│ b │ -└───────────────────┘ -``` - -## nullİf {#nullif} - -Dönüşler `NULL` argümanlar eşitse. - -``` sql -nullIf(x, y) -``` - -**Parametre:** - -`x`, `y` — Values for comparison. They must be compatible types, or ClickHouse will generate an exception. - -**Döndürülen değerler** - -- `NULL`, argümanlar eşitse. -- Bu `x` bağımsız değişkenler eşit değilse, değer. - -**Örnek** - -``` sql -SELECT nullIf(1, 1) -``` - -``` text -┌─nullIf(1, 1)─┐ -│ ᴺᵁᴸᴸ │ -└──────────────┘ -``` - -``` sql -SELECT nullIf(1, 2) -``` - -``` text -┌─nullIf(1, 2)─┐ -│ 1 │ -└──────────────┘ -``` - -## assumeNotNull {#assumenotnull} - -Bir tür değeri ile sonuçlanır [Nullable](../../sql_reference/data_types/nullable.md) bir sigara için- `Nullable` eğer değer değil `NULL`. - -``` sql -assumeNotNull(x) -``` - -**Parametre:** - -- `x` — The original value. - -**Döndürülen değerler** - -- Olmayan orijinal değeri-`Nullable` tipi, değilse `NULL`. -- Olmayan için varsayılan değer-`Nullable` özgün değer ise yazın `NULL`. - -**Örnek** - -Düşünün `t_null` Tablo. - -``` sql -SHOW CREATE TABLE t_null -``` - -``` text -┌─statement─────────────────────────────────────────────────────────────────┐ -│ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ -└───────────────────────────────────────────────────────────────────────────┘ -``` - -``` text -┌─x─┬────y─┐ -│ 1 │ ᴺᵁᴸᴸ │ -│ 2 │ 3 │ -└───┴──────┘ -``` - -Uygula `assumeNotNull` fonksiyonu için `y` sütun. - -``` sql -SELECT assumeNotNull(y) FROM t_null -``` - -``` text -┌─assumeNotNull(y)─┐ -│ 0 │ -│ 3 │ -└──────────────────┘ -``` - -``` sql -SELECT toTypeName(assumeNotNull(y)) FROM t_null -``` - -``` text -┌─toTypeName(assumeNotNull(y))─┐ -│ Int8 │ -│ Int8 │ -└──────────────────────────────┘ -``` - -## toNullable {#tonullable} - -Bağımsız değişken türünü dönüştürür `Nullable`. - -``` sql -toNullable(x) -``` - -**Parametre:** - -- `x` — The value of any non-compound type. - -**Döndürülen değer** - -- Bir ile giriş değeri `Nullable` tür. - -**Örnek** - -``` sql -SELECT toTypeName(10) -``` - -``` text -┌─toTypeName(10)─┐ -│ UInt8 │ -└────────────────┘ -``` - -``` sql -SELECT toTypeName(toNullable(10)) -``` - -``` text -┌─toTypeName(toNullable(10))─┐ -│ Nullable(UInt8) │ -└────────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/tr/sql_reference/functions/geo.md b/docs/tr/sql_reference/functions/geo.md deleted file mode 100644 index 353418c7b97..00000000000 --- a/docs/tr/sql_reference/functions/geo.md +++ /dev/null @@ -1,510 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 62 -toc_title: "Co\u011Frafi koordinatlar ile \xE7al\u0131\u015Fma" ---- - -# Coğrafi Koordinatlarla çalışmak için fonksiyonlar {#functions-for-working-with-geographical-coordinates} - -## greatCircleDistance {#greatcircledistance} - -Dünya yüzeyindeki iki nokta arasındaki mesafeyi kullanarak hesaplayın [büyük daire formülü](https://en.wikipedia.org/wiki/Great-circle_distance). - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**Giriş parametreleri** - -- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`. -- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`. -- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`. -- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`. - -Pozitif değerler Kuzey enlemi ve Doğu boylamına karşılık gelir ve negatif değerler Güney enlemi ve Batı boylamına karşılık gelir. - -**Döndürülen değer** - -Dünya yüzeyindeki iki nokta arasındaki mesafe, metre cinsinden. - -Girdi parametre değerleri aralığın dışına düştüğünde bir özel durum oluşturur. - -**Örnek** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## pointİnEllipses {#pointinellipses} - -Noktanın elipslerden en az birine ait olup olmadığını kontrol eder. -Koordinatlar kartezyen koordinat sisteminde geometriktir. - -``` sql -pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) -``` - -**Giriş parametreleri** - -- `x, y` — Coordinates of a point on the plane. -- `xᵢ, yᵢ` — Coordinates of the center of the `i`-inci üç nokta. -- `aᵢ, bᵢ` — Axes of the `i`- x, y koordinatları birimlerinde üç nokta. - -Giriş parametreleri olmalıdır `2+4⋅n`, nere `n` elips sayısıdır. - -**Döndürülen değerler** - -`1` nokta elipslerden en az birinin içindeyse; `0`hayır değil. - -**Örnek** - -``` sql -SELECT pointInEllipses(10., 10., 10., 9.1, 1., 0.9999) -``` - -``` text -┌─pointInEllipses(10., 10., 10., 9.1, 1., 0.9999)─┐ -│ 1 │ -└─────────────────────────────────────────────────┘ -``` - -## pointİnPolygon {#pointinpolygon} - -Noktanın düzlemdeki poligona ait olup olmadığını kontrol eder. - -``` sql -pointInPolygon((x, y), [(a, b), (c, d) ...], ...) -``` - -**Giriş değerleri** - -- `(x, y)` — Coordinates of a point on the plane. Data type — [Demet](../../sql_reference/data_types/tuple.md) — A tuple of two numbers. -- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [Dizi](../../sql_reference/data_types/array.md). Her köşe bir çift koordinat ile temsil edilir `(a, b)`. Köşeler saat yönünde veya saat yönünün tersine sırayla belirtilmelidir. Minimum köşe sayısı 3'tür. Çokgen sabit olmalıdır. -- Fonksiyon ayrıca delikli çokgenleri de destekler (bölümleri keser). Bu durumda, işlevin ek argümanlarını kullanarak kesilen bölümleri tanımlayan çokgenler ekleyin. İşlev, basit olmayan bağlı çokgenleri desteklemez. - -**Döndürülen değerler** - -`1` nokta çokgenin içinde ise, `0` hayır değil. -Nokta çokgen sınırında ise, işlev 0 veya 1 döndürebilir. - -**Örnek** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## geohashEncode {#geohashencode} - -Enlem ve boylamı bir geohash-string olarak kodlar, Lütfen bakınız (http://geohash.org/, https://en.wikipedia.org/wiki/Geohash). - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**Giriş değerleri** - -- boylam-kodlamak istediğiniz koordinatın boylam kısmı. Aralık floatingta yüz floatingen`[-180°, 180°]` -- latitude-kodlamak istediğiniz koordinatın enlem kısmı. Aralık floatingta yüz floatingen `[-90°, 90°]` -- hassas-isteğe bağlı, elde edilen kodlanmış dizenin uzunluğu, varsayılan olarak `12`. Aralıktaki tamsayı `[1, 12]`. Herhangi bir değer daha az `1` veya daha büyük `12` sessizce dönüştürülür `12`. - -**Döndürülen değerler** - -- alfanümerik `String` kodlanmış koordinat (base32-kodlama alfabesinin değiştirilmiş versiyonu kullanılır). - -**Örnek** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## geohashDecode {#geohashdecode} - -Herhangi bir geohash kodlu dizeyi boylam ve enlem olarak çözer. - -**Giriş değerleri** - -- kodlanmış dize-geohash kodlanmış dize. - -**Döndürülen değerler** - -- (boylam, enlem) - 2-tuple `Float64` boylam ve enlem değerleri. - -**Örnek** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## geoToH3 {#geotoh3} - -Dönüşler [H3](https://uber.github.io/h3/#/documentation/overview/introduction) nokta Endeksi `(lon, lat)` belirtilen çözünürlük ile. - -[H3](https://uber.github.io/h3/#/documentation/overview/introduction) Dünya yüzeyinin altıgen fayanslara bile bölündüğü coğrafi bir indeksleme sistemidir. Bu sistem hiyerarşiktir, örn. üst seviyedeki her altıgen yedi hatta daha küçük olanlara bölünebilir. - -Bu endeks öncelikle kovalama yerleri ve diğer coğrafi manipülasyonlar için kullanılır. - -**Sözdizimi** - -``` sql -geoToH3(lon, lat, resolution) -``` - -**Parametre** - -- `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]`. Tür: [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- Altıgen dizin numarası. -- Hata durumunda 0. - -Tür: `UInt64`. - -**Örnek** - -Sorgu: - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -Sonuç: - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## geohashesİnBox {#geohashesinbox} - -Verilen kutunun içine giren ve verilen kutunun sınırlarını kesişen, temel olarak diziye düzleştirilmiş bir 2D ızgarası olan bir dizi geohash kodlu dizeler dizisi döndürür. - -**Giriş değerleri** - -- longitude\_min - min boylam, aralıkta kayan değer `[-180°, 180°]` -- latitude\_min - min enlem, aralıkta kayan değer `[-90°, 90°]` -- longitude\_max-maksimum boylam, aralıkta kayan değer `[-180°, 180°]` -- latitude\_max-maksimum enlem, aralıkta kayan değer `[-90°, 90°]` -- hassas-geohash hassas, `UInt8` Aralık inta `[1, 12]` - -Lütfen tüm koordinat parametrelerinin aynı tipte olması gerektiğini unutmayın: `Float32` veya `Float64`. - -**Döndürülen değerler** - -- verilen alanı kapsayan geohash kutularının hassas uzun dizeleri dizisi, öğelerin sırasına güvenmemelisiniz. -- \[\]- eğer boş dizi *dakika* değerleri *enlem* ve *Boylam* karşılık gelenden daha az değil *maksimum* değerler. - -Ortaya çıkan dizi 10'000' 000 ürün uzunluğundaysa, işlevin bir istisna atacağını lütfen unutmayın. - -**Örnek** - -``` sql -SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos -``` - -``` text -┌─thasos──────────────────────────────────────┐ -│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ -└─────────────────────────────────────────────┘ -``` - -## h3GetBaseCell {#h3getbasecell} - -Dizin temel hücre numarasını döndürür. - -**Sözdizimi** - -``` sql -h3GetBaseCell(index) -``` - -**Parametre** - -- `index` — Hexagon index number. Type: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- Altıgen baz hücre numarası. Tür: [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT h3GetBaseCell(612916788725809151) as basecell -``` - -Sonuç: - -``` text -┌─basecell─┐ -│ 12 │ -└──────────┘ -``` - -## h3HexAreaM2 {#h3hexaream2} - -Verilen çözünürlükte metrekare ortalama altıgen alan. - -**Sözdizimi** - -``` sql -h3HexAreaM2(resolution) -``` - -**Parametre** - -- `resolution` — Index resolution. Range: `[0, 15]`. Tür: [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- Area in m². Type: [Float64](../../sql_reference/data_types/float.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT h3HexAreaM2(13) as area -``` - -Sonuç: - -``` text -┌─area─┐ -│ 43.9 │ -└──────┘ -``` - -## h3İndexesAreNeighbors {#h3indexesareneighbors} - -Sağlanan H3indexlerin komşu olup olmadığını döndürür. - -**Sözdizimi** - -``` sql -h3IndexesAreNeighbors(index1, index2) -``` - -**Parametre** - -- `index1` — Hexagon index number. Type: [Uİnt64](../../sql_reference/data_types/int_uint.md). -- `index2` — Hexagon index number. Type: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- Dönüşler `1` dizinler komşu ise, `0` başka. Tür: [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n -``` - -Sonuç: - -``` text -┌─n─┐ -│ 1 │ -└───┘ -``` - -## h3ToChildren {#h3tochildren} - -Verilen dizinin alt dizinlerini içeren bir dizi döndürür. - -**Sözdizimi** - -``` sql -h3ToChildren(index, resolution) -``` - -**Parametre** - -- `index` — Hexagon index number. Type: [Uİnt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. Tür: [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- Alt H3 dizinleri ile dizi. Dizi türü: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT h3ToChildren(599405990164561919, 6) AS children -``` - -Sonuç: - -``` text -┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## h3ToParent {#h3toparent} - -Verilen dizini içeren üst (kaba) dizini döndürür. - -**Sözdizimi** - -``` sql -h3ToParent(index, resolution) -``` - -**Parametre** - -- `index` — Hexagon index number. Type: [Uİnt64](../../sql_reference/data_types/int_uint.md). -- `resolution` — Index resolution. Range: `[0, 15]`. Tür: [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- Ana H3 Endeksi. Tür: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT h3ToParent(599405990164561919, 3) as parent -``` - -Sonuç: - -``` text -┌─────────────parent─┐ -│ 590398848891879423 │ -└────────────────────┘ -``` - -## h3ToString {#h3tostring} - -Dizinin H3ındex gösterimini dize gösterimine dönüştürür. - -``` sql -h3ToString(index) -``` - -**Parametre** - -- `index` — Hexagon index number. Type: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- H3 dizininin dize gösterimi. Tür: [Dize](../../sql_reference/data_types/string.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT h3ToString(617420388352917503) as h3_string -``` - -Sonuç: - -``` text -┌─h3_string───────┐ -│ 89184926cdbffff │ -└─────────────────┘ -``` - -## stringToH3 {#stringtoh3} - -Dize gösterimini H3ındex (Uİnt64) gösterimine dönüştürür. - -``` sql -stringToH3(index_str) -``` - -**Parametre** - -- `index_str` — String representation of the H3 index. Type: [Dize](../../sql_reference/data_types/string.md). - -**Döndürülen değerler** - -- Altıgen dizin numarası. Hata 0 döndürür. Tür: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT stringToH3('89184926cc3ffff') as index -``` - -Sonuç: - -``` text -┌──────────────index─┐ -│ 617420388351344639 │ -└────────────────────┘ -``` - -## h3GetResolution {#h3getresolution} - -Dizin çözünürlüğünü döndürür. - -**Sözdizimi** - -``` sql -h3GetResolution(index) -``` - -**Parametre** - -- `index` — Hexagon index number. Type: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değerler** - -- Dizin çözünürlüğü. Aralık: `[0, 15]`. Tür: [Uİnt8](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT h3GetResolution(617420388352917503) as res -``` - -Sonuç: - -``` text -┌─res─┐ -│ 9 │ -└─────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/tr/sql_reference/functions/hash_functions.md b/docs/tr/sql_reference/functions/hash_functions.md deleted file mode 100644 index fbb21597943..00000000000 --- a/docs/tr/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,446 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 50 -toc_title: Karma ---- - -# Karma fonksiyonlar {#hash-functions} - -Hash fonksiyonları elementlerin deterministik sözde rastgele karıştırma için kullanılabilir. - -## halfMD5 {#hash-functions-halfmd5} - -[Yorumluyor](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) tüm giriş parametrelerini dizeler olarak hesaplar ve [MD5](https://en.wikipedia.org/wiki/MD5) her biri için karma değeri. Sonra karmaları birleştirir, elde edilen dizenin karmasının ilk 8 baytını alır ve bunları şöyle yorumlar `UInt64` büyük endian bayt sırasına göre. - -``` sql -halfMD5(par1, ...) -``` - -İşlev nispeten yavaştır (işlemci çekirdeği başına saniyede 5 milyon kısa dizge). -Kullanmayı düşünün [sifash64](#hash_functions-siphash64) bunun yerine işlev. - -**Parametre** - -Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql_reference/data_types/index.md). - -**Döndürülen Değer** - -A [Uİnt64](../../sql_reference/data_types/int_uint.md) veri türü karma değeri. - -**Örnek** - -``` sql -SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type -``` - -``` text -┌────────halfMD5hash─┬─type───┐ -│ 186182704141653334 │ UInt64 │ -└────────────────────┴────────┘ -``` - -## MD5 {#hash_functions-md5} - -MD5 bir dizeden hesaplar ve elde edilen bayt kümesini FixedString(16) olarak döndürür. -Özellikle MD5'E ihtiyacınız yoksa, ancak iyi bir şifreleme 128 bit karmasına ihtiyacınız varsa, ‘sipHash128’ bunun yerine işlev. -Md5sum yardımcı programı tarafından çıktı ile aynı sonucu elde etmek istiyorsanız, lower(hex(MD5(s))) kullanın. - -## sifash64 {#hash_functions-siphash64} - -64-bit üretir [Sifash](https://131002.net/siphash/) karma değeri. - -``` sql -sipHash64(par1,...) -``` - -Bu bir şifreleme karma işlevidir. En az üç kat daha hızlı çalışır [MD5](#hash_functions-md5) işlev. - -İşlev [yorumluyor](../../sql_reference/functions/type_conversion_functions.md#type_conversion_functions-reinterpretAsString) tüm giriş parametreleri dizeleri olarak ve bunların her biri için karma değerini hesaplar. Sonra aşağıdaki algoritma ile karmaları birleştirir: - -1. Tüm giriş parametrelerini karma yaptıktan sonra, işlev karma dizisini alır. -2. Fonksiyon birinci ve ikinci öğeleri alır ve bunların dizisi için bir karma hesaplar. -3. Daha sonra işlev, önceki adımda hesaplanan karma değeri ve ilk karma dizinin üçüncü öğesini alır ve bunların dizisi için bir karma hesaplar. -4. Önceki adım, ilk karma dizinin kalan tüm öğeleri için tekrarlanır. - -**Parametre** - -Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql_reference/data_types/index.md). - -**Döndürülen Değer** - -A [Uİnt64](../../sql_reference/data_types/int_uint.md) veri türü karma değeri. - -**Örnek** - -``` sql -SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type -``` - -``` text -┌──────────────SipHash─┬─type───┐ -│ 13726873534472839665 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## sifash128 {#hash_functions-siphash128} - -Bir dizeden Sifash hesaplar. -Bir dize türü bağımsız değişkeni kabul eder. Fixedstring(16) Döndürür. -Sifash64'ten farklıdır, çünkü son xor katlama durumu sadece 128 bit'e kadar yapılır. - -## cityHash64 {#cityhash64} - -64-bit üretir [CityHash](https://github.com/google/cityhash) karma değeri. - -``` sql -cityHash64(par1,...) -``` - -Bu hızlı olmayan şifreleme karma işlevidir. Dize parametreleri için CityHash algoritmasını ve diğer veri türleriyle parametreler için uygulamaya özgü hızlı kriptografik olmayan karma işlevini kullanır. İşlev, nihai sonuçları almak için CityHash birleştiricisini kullanır. - -**Parametre** - -Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql_reference/data_types/index.md). - -**Döndürülen Değer** - -A [Uİnt64](../../sql_reference/data_types/int_uint.md) veri türü karma değeri. - -**Örnekler** - -Çağrı örneği: - -``` sql -SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type -``` - -``` text -┌─────────────CityHash─┬─type───┐ -│ 12072650598913549138 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -Aşağıdaki örnek, tüm tablonun sağlama toplamının satır sırasına kadar doğrulukla nasıl hesaplanacağını gösterir: - -``` sql -SELECT groupBitXor(cityHash64(*)) FROM table -``` - -## intHash32 {#inthash32} - -Herhangi bir tamsayı türünden 32 bit karma kodu hesaplar. -Bu, sayılar için ortalama kalitenin nispeten hızlı bir kriptografik olmayan karma işlevidir. - -## intHash64 {#inthash64} - -Herhangi bir tamsayı türünden 64 bit karma kodu hesaplar. -Inthash32'den daha hızlı çalışır. Ortalama kalite. - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -Bir dizeden SHA-1, SHA-224 veya SHA-256 hesaplar ve elde edilen bayt kümesini FixedString(20), FixedString(28) veya FixedString(32) olarak döndürür. -İşlev oldukça yavaş çalışır (SHA-1, işlemci çekirdeği başına saniyede yaklaşık 5 milyon kısa dizgiyi işler, SHA-224 ve SHA-256 ise yaklaşık 2.2 milyon işlem yapar). -Bu işlevi yalnızca belirli bir karma işleve ihtiyacınız olduğunda ve bunu seçemediğinizde kullanmanızı öneririz. -Bu gibi durumlarda bile, SELECTS'TE uygulamak yerine, tabloya eklerken işlev çevrimdışı ve ön hesaplama değerlerini uygulamanızı öneririz. - -## URLHash(url \[, N\]) {#urlhashurl-n} - -Bir tür normalleştirme kullanarak bir URL'den elde edilen bir dize için hızlı, iyi kalitede olmayan şifreleme karma işlevi. -`URLHash(s)` – Calculates a hash from a string without one of the trailing symbols `/`,`?` veya `#` sonunda, varsa. -`URLHash(s, N)` – Calculates a hash from a string up to the N level in the URL hierarchy, without one of the trailing symbols `/`,`?` veya `#` sonunda, varsa. -Düzeyleri URLHierarchy aynıdır. Bu fonksiyon (kayıt olmak için özeldir.Metrica. - -## farmHash64 {#farmhash64} - -64-bit üretir [FarmHash](https://github.com/google/farmhash) karma değeri. - -``` sql -farmHash64(par1, ...) -``` - -Fonksiyonu kullanır `Hash64` tüm yöntem [mevcut yöntemler](https://github.com/google/farmhash/blob/master/src/farmhash.h). - -**Parametre** - -Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql_reference/data_types/index.md). - -**Döndürülen Değer** - -A [Uİnt64](../../sql_reference/data_types/int_uint.md) veri türü karma değeri. - -**Örnek** - -``` sql -SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type -``` - -``` text -┌─────────────FarmHash─┬─type───┐ -│ 17790458267262532859 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## javaHash {#hash_functions-javahash} - -Hesaplıyor [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) bir ipten. Bu karma işlevi ne hızlı ne de iyi bir kaliteye sahip değildir. Bunu kullanmanın tek nedeni, bu algoritmanın zaten başka bir sistemde kullanılmasıdır ve tam olarak aynı sonucu hesaplamanız gerekir. - -**Sözdizimi** - -``` sql -SELECT javaHash(''); -``` - -**Döndürülen değer** - -A `Int32` veri türü karma değeri. - -**Örnek** - -Sorgu: - -``` sql -SELECT javaHash('Hello, world!'); -``` - -Sonuç: - -``` text -┌─javaHash('Hello, world!')─┐ -│ -1880044555 │ -└───────────────────────────┘ -``` - -## javaHashUTF16LE {#javahashutf16le} - -Hesaplıyor [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) bir dizeden, UTF-16LE kodlamasında bir dizeyi temsil eden bayt içerdiğini varsayarak. - -**Sözdizimi** - -``` sql -javaHashUTF16LE(stringUtf16le) -``` - -**Parametre** - -- `stringUtf16le` — a string in UTF-16LE encoding. - -**Döndürülen değer** - -A `Int32` veri türü karma değeri. - -**Örnek** - -UTF-16LE kodlanmış dize ile doğru sorgu. - -Sorgu: - -``` sql -SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le')) -``` - -Sonuç: - -``` text -┌─javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))─┐ -│ 3556498 │ -└──────────────────────────────────────────────────────────────┘ -``` - -## hiveHash {#hash-functions-hivehash} - -Hesaplıyor `HiveHash` bir ipten. - -``` sql -SELECT hiveHash(''); -``` - -Bu sadece [JavaHash](#hash_functions-javahash) sıfırlanmış işaret biti ile. Bu işlev kullanılır [Apache Kov Hanı](https://en.wikipedia.org/wiki/Apache_Hive) 3.0 öncesi sürümler için. Bu karma işlevi ne hızlı ne de iyi bir kaliteye sahip değildir. Bunu kullanmanın tek nedeni, bu algoritmanın zaten başka bir sistemde kullanılmasıdır ve tam olarak aynı sonucu hesaplamanız gerekir. - -**Döndürülen değer** - -A `Int32` veri türü karma değeri. - -Tür: `hiveHash`. - -**Örnek** - -Sorgu: - -``` sql -SELECT hiveHash('Hello, world!'); -``` - -Sonuç: - -``` text -┌─hiveHash('Hello, world!')─┐ -│ 267439093 │ -└───────────────────────────┘ -``` - -## metroHash64 {#metrohash64} - -64-bit üretir [MetroHash](http://www.jandrewrogers.com/2015/05/27/metrohash/) karma değeri. - -``` sql -metroHash64(par1, ...) -``` - -**Parametre** - -Fonksiyon, değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql_reference/data_types/index.md). - -**Döndürülen Değer** - -A [Uİnt64](../../sql_reference/data_types/int_uint.md) veri türü karma değeri. - -**Örnek** - -``` sql -SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type -``` - -``` text -┌────────────MetroHash─┬─type───┐ -│ 14235658766382344533 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## jumpConsistentHash {#jumpconsistenthash} - -Bir Uint64 Formu jumpconsistenthash hesaplar. -İki bağımsız değişkeni kabul eder: bir uint64 tipi anahtar ve kova sayısı. Int32 Döndürür. -Daha fazla bilgi için bağlantıya bakın: [JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) - -## murmurHash2\_32, murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} - -Üreten bir [MurmurHash2](https://github.com/aappleby/smhasher) karma değeri. - -``` sql -murmurHash2_32(par1, ...) -murmurHash2_64(par1, ...) -``` - -**Parametre** - -Her iki işlev de değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql_reference/data_types/index.md). - -**Döndürülen Değer** - -- Bu `murmurHash2_32` fonksiyon hash değerini döndürür [Uİnt32](../../sql_reference/data_types/int_uint.md) veri türü. -- Bu `murmurHash2_64` fonksiyon hash değerini döndürür [Uİnt64](../../sql_reference/data_types/int_uint.md) veri türü. - -**Örnek** - -``` sql -SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type -``` - -``` text -┌──────────MurmurHash2─┬─type───┐ -│ 11832096901709403633 │ UInt64 │ -└──────────────────────┴────────┘ -``` - -## murmurHash3\_32, murmurHash3\_64 {#murmurhash3-32-murmurhash3-64} - -Üreten bir [MurmurHash3](https://github.com/aappleby/smhasher) karma değeri. - -``` sql -murmurHash3_32(par1, ...) -murmurHash3_64(par1, ...) -``` - -**Parametre** - -Her iki işlev de değişken sayıda giriş parametresi alır. Parametreler herhangi biri olabilir [desteklenen veri türleri](../../sql_reference/data_types/index.md). - -**Döndürülen Değer** - -- Bu `murmurHash3_32` fonksiyon bir [Uİnt32](../../sql_reference/data_types/int_uint.md) veri türü karma değeri. -- Bu `murmurHash3_64` fonksiyon bir [Uİnt64](../../sql_reference/data_types/int_uint.md) veri türü karma değeri. - -**Örnek** - -``` sql -SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3─┬─type───┐ -│ 2152717 │ UInt32 │ -└─────────────┴────────┘ -``` - -## murmurHash3\_128 {#murmurhash3-128} - -128-bit üretir [MurmurHash3](https://github.com/aappleby/smhasher) karma değeri. - -``` sql -murmurHash3_128( expr ) -``` - -**Parametre** - -- `expr` — [İfadeler](../syntax.md#syntax-expressions) dönen bir [Dize](../../sql_reference/data_types/string.md)- tip değeri. - -**Döndürülen Değer** - -A [FixedString (16)](../../sql_reference/data_types/fixedstring.md) veri türü karma değeri. - -**Örnek** - -``` sql -SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type -``` - -``` text -┌─MurmurHash3──────┬─type────────────┐ -│ 6�1�4"S5KT�~~q │ FixedString(16) │ -└──────────────────┴─────────────────┘ -``` - -## xxHash32, xxHash64 {#hash-functions-xxhash32} - -Hesaplıyor `xxHash` bir ipten. İki tat, 32 ve 64 bit olarak önerilmiştir. - -``` sql -SELECT xxHash32(''); - -OR - -SELECT xxHash64(''); -``` - -**Döndürülen değer** - -A `Uint32` veya `Uint64` veri türü karma değeri. - -Tür: `xxHash`. - -**Örnek** - -Sorgu: - -``` sql -SELECT xxHash32('Hello, world!'); -``` - -Sonuç: - -``` text -┌─xxHash32('Hello, world!')─┐ -│ 834093149 │ -└───────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [xxHash](http://cyan4973.github.io/xxHash/). - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/tr/sql_reference/functions/higher_order_functions.md b/docs/tr/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index e5faadc689a..00000000000 --- a/docs/tr/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 57 -toc_title: "Y\xFCksek Sipari\u015F" ---- - -# Yüksek mertebeden fonksiyonlar {#higher-order-functions} - -## `->` operatör, lambda (params, expr) fonksiyonu {#operator-lambdaparams-expr-function} - -Allows describing a lambda function for passing to a higher-order function. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns. - -Örnekler: `x -> 2 * x, str -> str != Referer.` - -Daha yüksek mertebeden işlevler yalnızca Lambda işlevlerini işlevsel argümanları olarak kabul edebilir. - -Birden çok bağımsız değişkeni kabul eden bir lambda işlevi, daha yüksek mertebeden bir işleve geçirilebilir. Bu durumda, yüksek mertebeden işlev, bu bağımsız değişkenlerin karşılık geleceği aynı uzunlukta birkaç diziden geçirilir. - -Gibi bazı işlevler için [arrayCount](#higher_order_functions-array-count) veya [arraySum](#higher_order_functions-array-count), ilk argüman (lambda işlevi) ihmal edilebilir. Bu durumda, aynı eşleme varsayılır. - -Aşağıdaki işlevler için bir lambda işlevi ihmal edilemez: - -- [arrayMap](#higher_order_functions-array-map) -- [arrayFilter](#higher_order_functions-array-filter) -- [arrayFill](#higher_order_functions-array-fill) -- [arrayReverseFill](#higher_order_functions-array-reverse-fill) -- [arraySplit](#higher_order_functions-array-split) -- [arrayReverseSplit](#higher_order_functions-array-reverse-split) -- [arrayFirst](#higher_order_functions-array-first) -- [arrayFirstİndex](#higher_order_functions-array-first-index) - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -Özgün uygulamadan elde edilen bir dizi döndürür `func` fonksiyon inunda her ele elementmana `arr` dizi. - -Örnekler: - -``` sql -SELECT arrayMap(x -> (x + 2), [1, 2, 3]) as res; -``` - -``` text -┌─res─────┐ -│ [3,4,5] │ -└─────────┘ -``` - -Aşağıdaki örnek, farklı dizilerden bir öğe kümesinin nasıl oluşturulacağını gösterir: - -``` sql -SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res -``` - -``` text -┌─res─────────────────┐ -│ [(1,4),(2,5),(3,6)] │ -└─────────────────────┘ -``` - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayMap` işlev. - -### arrayFilter(func, arr1, …) {#higher_order_functions-array-filter} - -Yalnızca öğeleri içeren bir dizi döndürür `arr1` hangi için `func` 0'dan başka bir şey döndürür. - -Örnekler: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - -``` text -┌─res───────────┐ -│ ['abc World'] │ -└───────────────┘ -``` - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - -``` text -┌─res─┐ -│ [2] │ -└─────┘ -``` - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFilter` işlev. - -### arrayFill(func, arr1, …) {#higher_order_functions-array-fill} - -Tarama yoluyla `arr1` ilk öğeden son öğeye ve değiştir `arr1[i]` tarafından `arr1[i - 1]` eğer `func` 0 döndürür. İlk eleman `arr1` değiştir notilm .eyecektir. - -Örnekler: - -``` sql -SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res──────────────────────────────┐ -│ [1,1,3,11,12,12,12,5,6,14,14,14] │ -└──────────────────────────────────┘ -``` - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFill` işlev. - -### arrayReverseFill(func, arr1, …) {#higher_order_functions-array-reverse-fill} - -Tarama yoluyla `arr1` son öğeden ilk öğeye ve değiştir `arr1[i]` tarafından `arr1[i + 1]` eğer `func` 0 döndürür. The La lastst element of `arr1` değiştir notilm .eyecektir. - -Örnekler: - -``` sql -SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14, null, null]) AS res -``` - -``` text -┌─res────────────────────────────────┐ -│ [1,3,3,11,12,5,5,5,6,14,NULL,NULL] │ -└────────────────────────────────────┘ -``` - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayReverseFill` işlev. - -### arraySplit(func, arr1, …) {#higher_order_functions-array-split} - -Bölme `arr1` birden fazla diziye. Ne zaman `func` 0'dan başka bir şey döndürür, dizi öğenin sol tarafında bölünecektir. Dizi ilk öğeden önce bölünmez. - -Örnekler: - -``` sql -SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res─────────────┐ -│ [[1,2,3],[4,5]] │ -└─────────────────┘ -``` - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arraySplit` işlev. - -### arrayReverseSplit(func, arr1, …) {#higher_order_functions-array-reverse-split} - -Bölme `arr1` birden fazla diziye. Ne zaman `func` 0'dan başka bir şey döndürür, dizi öğenin sağ tarafında bölünecektir. Dizi son öğeden sonra bölünmez. - -Örnekler: - -``` sql -SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res -``` - -``` text -┌─res───────────────┐ -│ [[1],[2,3,4],[5]] │ -└───────────────────┘ -``` - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arraySplit` işlev. - -### arrayCount(\[func,\] arr1, …) {#higher_order_functions-array-count} - -Func 0'dan başka bir şey döndüren arr dizisindeki öğelerin sayısını döndürür. Eğer ‘func’ belirtilmemişse, dizideki sıfır olmayan öğelerin sayısını döndürür. - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -İçinde en az bir öğe varsa 1 değerini döndürür ‘arr’ hangi için ‘func’ 0'dan başka bir şey döndürür. Aksi takdirde, 0 döndürür. - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -Döner 1 Eğer ‘func’ içindeki tüm öğeler için 0'dan başka bir şey döndürür ‘arr’. Aksi takdirde, 0 döndürür. - -### arraySum(\[func,\] arr1, …) {#higher-order-functions-array-sum} - -Toplamını döndürür ‘func’ değerler. İşlev atlanırsa, sadece dizi öğelerinin toplamını döndürür. - -### arrayFirst(func, arr1, …) {#higher_order_functions-array-first} - -İlk öğeyi döndürür ‘arr1’ dizi hangi ‘func’ 0'dan başka bir şey döndürür. - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFirst` işlev. - -### arrayFirstIndex(func, arr1, …) {#higher_order_functions-array-first-index} - -İlk öğenin dizinini döndürür ‘arr1’ dizi hangi ‘func’ 0'dan başka bir şey döndürür. - -İlk argümanın (lambda işlevi) atlanamayacağını unutmayın. `arrayFirstIndex` işlev. - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -Kaynak dizideki öğelerin kısmi toplamlarının bir dizisini döndürür (çalışan bir toplam). Eğer... `func` işlev belirtilir, daha sonra dizi öğelerinin değerleri toplanmadan önce bu işlev tarafından dönüştürülür. - -Örnek: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - -``` text -┌─res──────────┐ -│ [1, 2, 3, 4] │ -└──────────────┘ -``` - -### arrayCumSumNonNegative(arr) {#arraycumsumnonnegativearr} - -Aynı olarak `arrayCumSum`, kaynak dizideki öğelerin kısmi toplamlarının bir dizisini döndürür (çalışan bir toplam). Farklı `arrayCumSum`, daha sonra döndürülen değer sıfırdan küçük bir değer içerdiğinde, değer sıfır ile değiştirilir ve sonraki hesaplama sıfır parametrelerle gerçekleştirilir. Mesela: - -``` sql -SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res -``` - -``` text -┌─res───────┐ -│ [1,2,0,1] │ -└───────────┘ -``` - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -Öğeleri sıralama sonucu bir dizi döndürür `arr1` artan düzende. Eğer... `func` fonksiyon belirtilir, sıralama sırası fonksiyonun sonucu ile belirlenir `func` dizi elemanlarına uygulanır (diziler) - -Bu [Schwartzian dönüşümü](https://en.wikipedia.org/wiki/Schwartzian_transform) sıralama verimliliğini artırmak için kullanılır. - -Örnek: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - -``` text -┌─res────────────────┐ -│ ['world', 'hello'] │ -└────────────────────┘ -``` - -Hakkında daha fazla bilgi için `arraySort` yöntem, görmek [Dizilerle çalışmak için işlevler](array_functions.md#array_functions-sort) bölme. - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -Öğeleri sıralama sonucu bir dizi döndürür `arr1` azalan sırada. Eğer... `func` fonksiyon belirtilir, sıralama sırası fonksiyonun sonucu ile belirlenir `func` dizi (diziler) elemanlarına uygulanır. - -Örnek: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` text -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -Hakkında daha fazla bilgi için `arrayReverseSort` yöntem, görmek [Dizilerle çalışmak için işlevler](array_functions.md#array_functions-reverse-sort) bölme. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/tr/sql_reference/functions/in_functions.md b/docs/tr/sql_reference/functions/in_functions.md deleted file mode 100644 index 481c1b61802..00000000000 --- a/docs/tr/sql_reference/functions/in_functions.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 60 -toc_title: "In \u0130\u015Flet theic implementingisinin uygulanmas\u0131" ---- - -# In operatörünü uygulamak için işlevler {#functions-for-implementing-the-in-operator} - -## içinde, notİn, globalİn, globalNotİn {#in-functions} - -Bölümüne bakınız [Operatör İNLERDE](../statements/select.md#select-in-operators). - -## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} - -Birden çok sütun gruplama sağlayan bir işlev. -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 normalde bir argüman için Ara değerler olarak kullanılır operatörler, veya lambda fonksiyonlarının resmi parametrelerin bir listesini oluşturmak için. Tuples bir masaya yazılamaz. - -## tupleElement (tuple, n), operatör x. N {#tupleelementtuple-n-operator-x-n} - -Bir tuple bir sütun alma sağlayan bir işlev. -‘N’ 1'den başlayarak sütun dizinidir. N sabit olmalıdır. ‘N’ bir sabit olması gerekir. ‘N’ tuple boyutundan daha büyük olmayan katı bir pozitif tamsayı olmalıdır. -İşlevi yürütmek için hiçbir maliyet yoktur. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/tr/sql_reference/functions/index.md b/docs/tr/sql_reference/functions/index.md deleted file mode 100644 index 01961c69526..00000000000 --- a/docs/tr/sql_reference/functions/index.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "\u0130\u015Flevler" -toc_priority: 32 -toc_title: "Giri\u015F" ---- - -# İşlevler {#functions} - -En az\* iki tür fonksiyon vardır-düzenli Fonksiyonlar (sadece denir “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function doesn't depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows). - -Bu bölümde düzenli işlevleri tartışıyoruz. Toplama işlevleri için bölüme bakın “Aggregate functions”. - -\* - Üçüncü bir işlev türü vardır ‘arrayJoin’ fonksiyon aittir; tablo fonksiyonları da ayrı ayrı belirtilebilir.\* - -## Güçlü yazarak {#strong-typing} - -Standart SQL aksine, ClickHouse güçlü yazarak vardır. Başka bir deyişle, türler arasında örtük dönüşümler yapmaz. Her işlev belirli bir tür kümesi için çalışır. Bu, bazen tür dönüştürme işlevlerini kullanmanız gerektiği anlamına gelir. - -## Ortak subexpression eliminasyonu {#common-subexpression-elimination} - -Aynı AST (aynı kayıt veya sözdizimsel ayrıştırma aynı sonucu) olan bir sorgudaki tüm ifadeler aynı değerlere sahip olarak kabul edilir. Bu tür ifadeler bir kez birleştirilir ve yürütülür. Aynı alt sorgular da bu şekilde elimine edilir. - -## Sonuç türleri {#types-of-results} - -Tüm işlevler sonuç olarak tek bir dönüş döndürür (birkaç değer değil, sıfır değer değil). Sonuç türü genellikle değerlerle değil, yalnızca bağımsız değişken türleriyle tanımlanır. Özel durumlar tupleElement işlevi (a.n işleci) ve tofixedstring işlevidir. - -## Devamlılar {#constants} - -Basitlik için, bazı işlevler yalnızca bazı argümanlar için sabitlerle çalışabilir. Örneğin, LİKE operatörünün doğru argümanı sabit olmalıdır. -Hemen hemen tüm işlevler sabit argümanlar için bir sabit döndürür. İstisna, rasgele sayılar üreten işlevlerdir. -Bu ‘now’ işlev, farklı zamanlarda çalıştırılan sorgular için farklı değerler döndürür, ancak sonuç sabit olarak kabul edilir, çünkü sabitlik yalnızca tek bir sorguda önemlidir. -Sabit bir ifade de sabit olarak kabul edilir (örneğin, LİKE operatörünün sağ yarısı birden fazla sabitten oluşturulabilir). - -Fonksiyonlar sabit ve sabit olmayan argümanlar için farklı şekillerde uygulanabilir (farklı kod yürütülür). Ancak, bir sabit ve yalnızca aynı değeri içeren gerçek bir sütun için sonuçlar birbiriyle eşleşmelidir. - -## NULL işleme {#null-processing} - -Fonksiyonlar aşağıdaki davranışlara sahiptir: - -- İşlevin argümanlarından en az biri ise `NULL`, fonksiyon sonucu da `NULL`. -- Her işlevin açıklamasında ayrı ayrı belirtilen özel davranış. ClickHouse kaynak kodunda, bu işlevler `UseDefaultImplementationForNulls=false`. - -## Süreklilik {#constancy} - -Functions can't change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query. - -## Hata işleme {#error-handling} - -Veriler geçersizse bazı işlevler bir istisna oluşturabilir. Bu durumda, sorgu iptal edilir ve bir hata metni istemciye döndürülür. Dağıtılmış işlem için sunuculardan birinde bir özel durum oluştuğunda, diğer sunucular da sorguyu iptal etmeye çalışır. - -## Argüman ifadelerinin değerlendirilmesi {#evaluation-of-argument-expressions} - -Hemen hemen tüm programlama dillerinde, argümanlardan biri belirli operatörler için değerlendirilmeyebilir. Bu genellikle operatörler `&&`, `||`, ve `?:`. -Ancak Clickhouse'da, fonksiyonların (operatörler) argümanları her zaman değerlendirilir. Bunun nedeni, sütunların tüm bölümlerinin her satırı ayrı ayrı hesaplamak yerine bir kerede değerlendirilmesidir. - -## Dağıtılmış sorgu işleme işlevleri gerçekleştirme {#performing-functions-for-distributed-query-processing} - -Dağıtılmış sorgu işleme için, sorgu işlemenin mümkün olduğu kadar çok aşaması uzak sunucularda gerçekleştirilir ve aşamaların geri kalanı (Ara sonuçları ve bundan sonra her şeyi birleştirme) istek sahibi sunucuda gerçekleştirilir. - -Bu, işlevlerin farklı sunucularda gerçekleştirilebileceği anlamına gelir. -Örneğin, sorguda `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),` - -- eğer bir `distributed_table` en az iki parçaya sahiptir, fonksiyonlar ‘g’ ve ‘h’ uzak sunucularda gerçekleştirilir ve işlev ‘f’ ıstekçi sunucuda gerçekleştirilir. -- eğer bir `distributed_table` sadece bir parça var, tüm ‘f’, ‘g’, ve ‘h’ fonksiyonlar bu shard'ın sunucusunda gerçekleştirilir. - -Bir işlevin sonucu genellikle hangi sunucuda gerçekleştirildiğine bağlı değildir. Ancak, bazen bu önemlidir. -Örneğin, sözlüklerle çalışan işlevler, üzerinde çalışmakta oldukları sunucuda bulunan sözlüğü kullanır. -Başka bir örnek ise `hostName` yapmak için üzerinde çalıştığı sunucunun adını döndüren işlev `GROUP BY` sunucular tarafından bir `SELECT` sorgu. - -Eğer sorguda bir işlevi istemcisi sunucu üzerinde yapılır, ama uzak sunucularda bunu gerçekleştirmek için ihtiyacınız varsa, bir saramaz mısın ‘any’ toplama işlevi veya bir anahtara ekleyin `GROUP BY`. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/tr/sql_reference/functions/introspection.md b/docs/tr/sql_reference/functions/introspection.md deleted file mode 100644 index fdc68fe76fb..00000000000 --- a/docs/tr/sql_reference/functions/introspection.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 65 -toc_title: "\u0130\xE7g\xF6zlem" ---- - -# İç Gözlem Fonksiyonları {#introspection-functions} - -İç gözlem için bu bölümde açıklanan işlevleri kullanabilirsiniz [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) ve [DWARF](https://en.wikipedia.org/wiki/DWARF) sorgu profilleme için. - -!!! warning "Uyarıcı" - Bu işlevler yavaştır ve güvenlik konuları getirebilir. - -İç gözlem fonksiyonlarının düzgün çalışması için: - -- Yüklemek `clickhouse-common-static-dbg` paket. - -- Ayarla... [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) ayar 1. - - For security reasons introspection functions are disabled by default. - -ClickHouse için profiler raporları kaydeder [trace\_log](../../operations/system_tables.md#system_tables-trace_log) sistem tablosu. Tablo ve profiler düzgün yapılandırıldığından emin olun. - -## addressToLine {#addresstoline} - -ClickHouse sunucu işleminin içindeki sanal bellek adresini dosya adına ve clickhouse kaynak kodundaki satır numarasına dönüştürür. - -Resmi ClickHouse paketleri kullanırsanız, yüklemeniz gerekir `clickhouse-common-static-dbg` paket. - -**Sözdizimi** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**Parametre** - -- `address_of_binary_instruction` ([Uİnt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**Döndürülen değer** - -- Kaynak kodu dosya adı ve bu dosyadaki satır numarası iki nokta üst üste ile sınırlandırılmıştır. - - For example, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, where `199` is a line number. - -- Işlev hata ayıklama bilgilerini bulamadıysanız, bir ikili adı. - -- Adres geçerli değilse, boş dize. - -Tür: [Dize](../../sql_reference/data_types/string.md). - -**Örnek** - -İç gözlem işlevlerini etkinleştirme: - -``` sql -SET allow_introspection_functions=1 -``` - -İlk dizeyi seçme `trace_log` sistem tablosu: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -Bu `trace` alan, örnekleme anında yığın izini içerir. - -Tek bir adres için kaynak kodu dosya adını ve satır numarasını alma: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -``` - -İşlevin tüm yığın izine uygulanması: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -Bu [arrayMap](higher_order_functions.md#higher_order_functions-array-map) işlev, her bir elemanın işlenmesini sağlar `trace` ar arrayray by the `addressToLine` işlev. Gördüğünüz bu işlemin sonucu `trace_source_code_lines` çıktı sütunu. - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## addressToSymbol {#addresstosymbol} - -Clickhouse sunucu işlemi içindeki sanal bellek adresini ClickHouse nesne dosyalarından gelen simgeye dönüştürür. - -**Sözdizimi** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**Parametre** - -- `address_of_binary_instruction` ([Uİnt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**Döndürülen değer** - -- ClickHouse nesne dosyalarından sembol. -- Adres geçerli değilse, boş dize. - -Tür: [Dize](../../sql_reference/data_types/string.md). - -**Örnek** - -İç gözlem işlevlerini etkinleştirme: - -``` sql -SET allow_introspection_functions=1 -``` - -İlk dizeyi seçme `trace_log` sistem tablosu: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -Bu `trace` alan, örnekleme anında yığın izini içerir. - -Tek bir adres için sembol alma: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -İşlevin tüm yığın izine uygulanması: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -Bu [arrayMap](higher_order_functions.md#higher_order_functions-array-map) işlev, her bir elemanın işlenmesini sağlar `trace` ar arrayray by the `addressToSymbols` işlev. Gördüğünüz bu işlemin sonucu `trace_symbols` çıktı sütunu. - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## demangle {#demangle} - -Kullanarak alabileceğiniz bir sembolü dönüştürür [addressToSymbol](#addresstosymbol) C++ işlev adına işlev. - -**Sözdizimi** - -``` sql -demangle(symbol) -``` - -**Parametre** - -- `symbol` ([Dize](../../sql_reference/data_types/string.md)) — Symbol from an object file. - -**Döndürülen değer** - -- C++ işlevinin adı. -- Bir sembol geçerli değilse boş dize. - -Tür: [Dize](../../sql_reference/data_types/string.md). - -**Örnek** - -İç gözlem işlevlerini etkinleştirme: - -``` sql -SET allow_introspection_functions=1 -``` - -İlk dizeyi seçme `trace_log` sistem tablosu: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -Bu `trace` alan, örnekleme anında yığın izini içerir. - -Tek bir adres için bir işlev adı alma: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -İşlevin tüm yığın izine uygulanması: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -Bu [arrayMap](higher_order_functions.md#higher_order_functions-array-map) işlev, her bir elemanın işlenmesini sağlar `trace` ar arrayray by the `demangle` işlev. Gördüğünüz bu işlemin sonucu `trace_functions` çıktı sütunu. - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/tr/sql_reference/functions/ip_address_functions.md b/docs/tr/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index 2caa7c49b2a..00000000000 --- a/docs/tr/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 55 -toc_title: "IP adresleriyle \xE7al\u0131\u015Fma" ---- - -# IP adresleriyle çalışmak için işlevler {#functions-for-working-with-ip-addresses} - -## Ipv4numtostring (num) {#ipv4numtostringnum} - -Bir Uınt32 numarası alır. Big endian'da bir IPv4 adresi olarak yorumlar. Karşılık gelen IPv4 adresini a. B. C. d biçiminde içeren bir dize döndürür (ondalık formda nokta ile ayrılmış sayılar). - -## Ipv4stringtonum (s) {#ipv4stringtonums} - -IPv4NumToString ters işlevi. IPv4 adresi geçersiz bir biçime sahipse, 0 döndürür. - -## Ipv4numtostringclassc (num) {#ipv4numtostringclasscnum} - -Ipv4numtostring'e benzer, ancak son sekizli yerine xxx kullanıyor. - -Örnek: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─k──────────────┬─────c─┐ -│ 83.149.9.xxx │ 26238 │ -│ 217.118.81.xxx │ 26074 │ -│ 213.87.129.xxx │ 25481 │ -│ 83.149.8.xxx │ 24984 │ -│ 217.118.83.xxx │ 22797 │ -│ 78.25.120.xxx │ 22354 │ -│ 213.87.131.xxx │ 21285 │ -│ 78.25.121.xxx │ 20887 │ -│ 188.162.65.xxx │ 19694 │ -│ 83.149.48.xxx │ 17406 │ -└────────────────┴───────┘ -``` - -Kullanıl sincedığından beri ‘xxx’ son derece sıradışı, bu gelecekte değiştirilebilir. Bu parçanın tam biçimine güvenmemenizi öneririz. - -### Ipv6numtostring (x) {#ipv6numtostringx} - -IPv6 adresini ikili biçimde içeren bir FixedString(16) değerini kabul eder. Bu adresi metin biçiminde içeren bir dize döndürür. -IPv6 eşlemeli IPv4 adresleri ::ffff:111.222.33.44 biçiminde çıktıdır. Örnekler: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - -``` text -┌─addr─────────┐ -│ 2a02:6b8::11 │ -└──────────────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ -│ 2a02:2168:aaa:bbbb::2 │ 24695 │ -│ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ -│ 2a02:6b8:0:fff::ff │ 16389 │ -│ 2a01:4f8:111:6666::2 │ 16016 │ -│ 2a02:2168:888:222::1 │ 15896 │ -│ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ -│ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ -│ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ -│ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ -│ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ -└─────────────────────────────────────────┴───────┘ -``` - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - -``` text -┌─IPv6NumToString(ClientIP6)─┬──────c─┐ -│ ::ffff:94.26.111.111 │ 747440 │ -│ ::ffff:37.143.222.4 │ 529483 │ -│ ::ffff:5.166.111.99 │ 317707 │ -│ ::ffff:46.38.11.77 │ 263086 │ -│ ::ffff:79.105.111.111 │ 186611 │ -│ ::ffff:93.92.111.88 │ 176773 │ -│ ::ffff:84.53.111.33 │ 158709 │ -│ ::ffff:217.118.11.22 │ 154004 │ -│ ::ffff:217.118.11.33 │ 148449 │ -│ ::ffff:217.118.11.44 │ 148243 │ -└────────────────────────────┴────────┘ -``` - -## Ipv6stringtonum (s) {#ipv6stringtonums} - -IPv6NumToString ters işlevi. IPv6 adresi geçersiz bir biçime sahipse, bir boş bayt dizesi döndürür. -HEX büyük veya küçük harf olabilir. - -## Ipv4toıpv6 (x) {#ipv4toipv6x} - -Alır bir `UInt32` numara. Bir IPv4 adresi olarak yorumlar [büyük endian](https://en.wikipedia.org/wiki/Endianness). Ret aur ANS a `FixedString(16)` IPv6 adresini ikili biçimde içeren değer. Örnekler: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - -``` text -┌─addr───────────────┐ -│ ::ffff:192.168.0.1 │ -└────────────────────┘ -``` - -## cutİPv6 (x, bytesToCutForİPv6, bytesToCutForİPv4) {#cutipv6x-bytestocutforipv6-bytestocutforipv4} - -IPv6 adresini ikili biçimde içeren bir FixedString(16) değerini kabul eder. Metin biçiminde kaldırılan belirtilen bayt sayısının adresini içeren bir dize döndürür. Mesela: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - -``` text -┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ -│ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ -└─────────────────────────────────────┴─────────────────────┘ -``` - -## Ipv4cidrtorange(ıpv4, cıdr), {#ipv4cidrtorangeipv4-cidr} - -İçeren bir IPv4 ve bir Uint8 değerini kabul eder [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Alt ağın alt aralığını ve daha yüksek aralığını içeren iki IPv4 içeren bir tuple döndürür. - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - -``` text -┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ -│ ('192.168.0.0','192.168.255.255') │ -└────────────────────────────────────────────┘ -``` - -## Ipv6cidrtorange(ıpv6, cıdr), {#ipv6cidrtorangeipv6-cidr} - -CIDR'Yİ içeren bir IPv6 ve bir Uİnt8 değerini kabul eder. Alt ağın alt aralığını ve daha yüksek aralığını içeren iki IPv6 içeren bir tuple döndürür. - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); -``` - -``` text -┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ -│ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -## toıpv4 (dize) {#toipv4string} - -İçin bir takma ad `IPv4StringToNum()` bu, IPv4 adresinin bir dize formunu alır ve değerini döndürür [Ipv44](../../sql_reference/data_types/domains/ipv4.md) tarafından döndürülen değere eşit ikili olan tür `IPv4StringToNum()`. - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - -``` text -┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ -│ UInt32 │ IPv4 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - -``` text -┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ -│ ABE1822D │ ABE1822D │ -└───────────────────────────────────┴──────────────────────────┘ -``` - -## toıpv6 (dize) {#toipv6string} - -İçin bir takma ad `IPv6StringToNum()` bu, IPv6 adresinin bir dize formunu alır ve değerini döndürür [IPv6](../../sql_reference/data_types/domains/ipv6.md) tarafından döndürülen değere eşit ikili olan tür `IPv6StringToNum()`. - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - -``` text -┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ -│ FixedString(16) │ IPv6 │ -└──────────────────────────────────────────┴─────────────────────────────────┘ -``` - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - -``` text -┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ -│ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ -└───────────────────────────────────┴──────────────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/tr/sql_reference/functions/json_functions.md b/docs/tr/sql_reference/functions/json_functions.md deleted file mode 100644 index 95aaa1768f2..00000000000 --- a/docs/tr/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 56 -toc_title: "JSON ile \xE7al\u0131\u015Fmak." ---- - -# Json ile çalışmak için fonksiyonlar {#functions-for-working-with-json} - -Üye Olarak.Metrica, JSON kullanıcılar tarafından oturum parametreleri olarak iletilir. Bu JSON ile çalışmak için bazı özel fonksiyonlar var. (Çoğu durumda, JSONs ek olarak önceden işlenir ve elde edilen değerler işlenmiş biçimlerinde ayrı sütunlara konur .) Tüm bu işlevler, JSON'UN ne olabileceğine dair güçlü varsayımlara dayanır, ancak işi yapmak için mümkün olduğunca az şey yapmaya çalışırlar. - -Aşağıdaki varsayımlar yapılır: - -1. Alan adı (işlev bağımsız değişkeni) sabit olmalıdır. -2. Alan adı bir şekilde json'da kanonik olarak kodlanmıştır. Mesela: `visitParamHas('{"abc":"def"}', 'abc') = 1`, ama `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. Alanlar, herhangi bir yuvalama düzeyinde, ayrım gözetmeksizin aranır. Birden çok eşleşen alan varsa, ilk olay kullanılır. -4. JSON, dize değişmezleri dışında boşluk karakterlerine sahip değildir. - -## visitParamHas (params, isim) {#visitparamhasparams-name} - -İle bir alan olup olmadığını denetler ‘name’ ad. - -## visitParamExtractUİnt (params, isim) {#visitparamextractuintparams-name} - -Uint64 adlı alanın değerinden ayrıştırır ‘name’. Bu bir dize alanı ise, dizenin başlangıcından itibaren bir sayıyı ayrıştırmaya çalışır. Alan yoksa veya varsa ancak bir sayı içermiyorsa, 0 döndürür. - -## visitParamExtractİnt (params, isim) {#visitparamextractintparams-name} - -Int64 için olduğu gibi. - -## visitParamExtractFloat (params, isim) {#visitparamextractfloatparams-name} - -Float64 için olduğu gibi. - -## visitParamExtractBool (params, isim) {#visitparamextractboolparams-name} - -True/false değerini ayrıştırır. Sonuç Uİnt8. - -## visitParamExtractRaw (params, isim) {#visitparamextractrawparams-name} - -Ayırıcılar da dahil olmak üzere bir alanın değerini döndürür. - -Örnekler: - -``` sql -visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' -visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' -``` - -## visitParamExtractString (params, isim) {#visitparamextractstringparams-name} - -Dizeyi çift tırnak içinde ayrıştırır. Değeri unescaped. Unescaping başarısız olursa, boş bir dize döndürür. - -Örnekler: - -``` sql -visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' -visitParamExtractString('{"abc":"hello}', 'abc') = '' -``` - -Şu anda biçimdeki kod noktaları için destek yok `\uXXXX\uYYYY` bu temel çok dilli düzlemden değildir(UTF-8 yerine CESU-8'e dönüştürülürler). - -Aşağıdaki işlevler dayanmaktadır [simdjson](https://github.com/lemire/simdjson) daha karmaşık json ayrıştırma gereksinimleri için tasarlanmıştır. Yukarıda belirtilen varsayım 2 hala geçerlidir. - -## ısvalidjson(json) {#isvalidjsonjson} - -Dize geçirilen kontroller geçerli bir json'dur. - -Örnekler: - -``` sql -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} - -Değer JSON belgesinde varsa, `1` iade edilecektir. - -Değer yoksa, `0` iade edilecektir. - -Örnekler: - -``` sql -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 -SELECT JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 -``` - -`indices_or_keys` sıfır veya daha fazla argüman listesi her biri dize veya tamsayı olabilir. - -- String = nesne üyesine anahtarla erişin. -- Pozitif tamsayı = n-inci üyesine / anahtarına baştan erişin. -- Negatif tamsayı = sondan n-inci üye/anahtara erişin. - -Elemanın minimum Endeksi 1'dir. Böylece 0 öğesi mevcut değildir. - -Hem json dizilerine hem de JSON nesnelerine erişmek için tamsayılar kullanabilirsiniz. - -Bu yüzden, örneğin : - -``` sql -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' -SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' -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} - -Bir json dizisinin veya bir JSON nesnesinin uzunluğunu döndürür. - -Değer yoksa veya yanlış bir türe sahipse, `0` iade edilecektir. - -Örnekler: - -``` sql -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} - -Bir JSON değerinin türünü döndürür. - -Değer yoksa, `Null` iade edilecektir. - -Örnekler: - -``` sql -SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' -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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -Bir JSON ayrıştırır ve bir değer ayıklayın. Bu işlevler benzer `visitParam` işlevler. - -Değer yoksa veya yanlış bir türe sahipse, `0` iade edilecektir. - -Örnekler: - -``` sql -SELECT JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 -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} - -Bir json ayrıştırır ve bir dize ayıklayın. Bu işlev benzer `visitParamExtractString` işlevler. - -Değer yoksa veya yanlış bir tür varsa, boş bir dize döndürülür. - -Değeri unescaped. Unescaping başarısız olursa, boş bir dize döndürür. - -Örnekler: - -``` sql -SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' -SELECT JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' -SELECT JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' -SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = '' -SELECT JSONExtractString('{"abc":"hello}', 'abc') = '' -``` - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -Bir Json ayrıştırır ve verilen ClickHouse veri türünün bir değerini çıkarır. - -Bu, önceki bir genellemedir `JSONExtract` işlevler. -Bu demektir -`JSONExtract(..., 'String')` tam olarak aynı döndürür `JSONExtractString()`, -`JSONExtract(..., 'Float64')` tam olarak aynı döndürür `JSONExtractFloat()`. - -Örnekler: - -``` sql -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] -SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL -SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 -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} - -Değerlerin verilen ClickHouse veri türünde olduğu bir json'dan anahtar değer çiftlerini ayrıştırın. - -Örnek: - -``` sql -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} - -Json'un bir bölümünü döndürür. - -Bölüm yoksa veya yanlış bir türe sahipse, boş bir dize döndürülür. - -Örnek: - -``` sql -SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' -``` - -## JSONExtractArrayRaw(json\[, indices\_or\_keys\]…) {#jsonextractarrayrawjson-indices-or-keys} - -Her biri ayrıştırılmamış dize olarak temsil edilen json dizisinin öğeleriyle bir dizi döndürür. - -Bölüm yoksa veya dizi değilse, boş bir dizi döndürülür. - -Örnek: - -``` sql -SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']' -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/tr/sql_reference/functions/logical_functions.md b/docs/tr/sql_reference/functions/logical_functions.md deleted file mode 100644 index 543226319da..00000000000 --- a/docs/tr/sql_reference/functions/logical_functions.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 37 -toc_title: "Mant\u0131kl\u0131" ---- - -# Mantıksal fonksiyonlar {#logical-functions} - -Mantıksal işlevler herhangi bir sayısal türü kabul eder, ancak 0 veya 1'e eşit bir Uİnt8 numarası döndürür. - -Bir argüman olarak sıfır kabul edilir “false,” sıfır olmayan herhangi bir değer dikkate alınırken “true”. - -## ve, ve operatör {#and-and-operator} - -## or, or operat ,or {#or-or-operator} - -## değil, operatör değil {#not-not-operator} - -## xor {#xor} - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) diff --git a/docs/tr/sql_reference/functions/machine_learning_functions.md b/docs/tr/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index a1d2857ed82..00000000000 --- a/docs/tr/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 64 -toc_title: "Makine \xD6\u011Frenme Fonksiyonlar\u0131" ---- - -# Makine Öğrenme Fonksiyonları {#machine-learning-functions} - -## evalMLMethod (tahmin) {#machine_learning_methods-evalmlmethod} - -Tak fittedılmış regresyon model usinglerini kullanarak tahmin `evalMLMethod` işlev. Lin seeke bakınız `linearRegression`. - -### Stokastik Doğrusal Regresyon {#stochastic-linear-regression} - -Bu [stokastiklinearregression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlinearregression) toplama fonksiyonu, doğrusal model ve MSE kayıp fonksiyonunu kullanarak stokastik Gradyan iniş yöntemini uygular. Kullanma `evalMLMethod` yeni veri üzerinde tahmin etmek için. - -### Stokastik Lojistik Regresyon {#stochastic-logistic-regression} - -Bu [stochasticLogisticRegression](../../sql_reference/aggregate_functions/reference.md#agg_functions-stochasticlogisticregression) toplama işlevi, ikili sınıflandırma problemi için stokastik Gradyan iniş yöntemini uygular. Kullanma `evalMLMethod` yeni veri üzerinde tahmin etmek için. diff --git a/docs/tr/sql_reference/functions/math_functions.md b/docs/tr/sql_reference/functions/math_functions.md deleted file mode 100644 index dee89681e73..00000000000 --- a/docs/tr/sql_reference/functions/math_functions.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 44 -toc_title: Matematiksel ---- - -# Matematiksel fonksiyonlar {#mathematical-functions} - -Tüm işlevler bir Float64 numarası döndürür. Sonucun doğruluğu mümkün olan en yüksek hassasiyete yakındır, ancak sonuç, ilgili gerçek sayıya en yakın makine temsil edilebilir numarası ile çakışmayabilir. - -## e() {#e} - -E numarasına yakın bir Float64 numarası döndürür. - -## pi sayısı() {#pi} - -Returns a Float64 number that is close to the number π. - -## exp(x) {#expx} - -Sayısal bir bağımsız değişken kabul eder ve bir Float64 sayı argümanın üs yakın döndürür. - -## log (x), L (n(x) {#logx-lnx} - -Sayısal bir bağımsız değişken kabul eder ve bağımsız değişken doğal logaritma yakın bir Float64 sayı döndürür. - -## exp2 (x) {#exp2x} - -Sayısal bir bağımsız değişkeni kabul eder ve X gücüne 2'ye yakın bir Float64 numarası döndürür. - -## log2 (x) {#log2x} - -Sayısal bir bağımsız değişken kabul eder ve değişken ikili logaritma yakın bir Float64 sayı döndürür. - -## exp10 (x) {#exp10x} - -Sayısal bir bağımsız değişkeni kabul eder ve 10'a yakın Float64 numarasını x gücüne döndürür. - -## log10(x) {#log10x} - -Sayısal bir bağımsız değişken kabul eder ve bir float64 sayı bağımsız değişken ondalık logaritması yakın döndürür. - -## sqrt(x) {#sqrtx} - -Sayısal bir bağımsız değişken kabul eder ve bağımsız değişken kareköküne yakın bir Float64 numarası döndürür. - -## TCMB (x) {#cbrtx} - -Sayısal bir bağımsız değişkeni kabul eder ve bağımsız değişken kübik köküne yakın bir Float64 numarası döndürür. - -## erf (x) {#erfx} - -Eğer ‘x’ is non-negative, then erf(x / σ√2) standart sapma ile normal dağılıma sahip bir rasgele değişkenin olasılığı var mı ‘σ’ beklenen değerden daha fazla ayrılan değeri alır ‘x’. - -Örnek (üç sigma kuralı): - -``` sql -SELECT erf(3 / sqrt(2)) -``` - -``` text -┌─erf(divide(3, sqrt(2)))─┐ -│ 0.9973002039367398 │ -└─────────────────────────┘ -``` - -## erfc (x) {#erfcx} - -Sayısal bir bağımsız değişkeni kabul eder ve 1 - erf(x) yakın bir Float64 numarası döndürür, ancak büyük için hassasiyet kaybı olmadan ‘x’ değerler. - -## lgamma (x) {#lgammax} - -Gama fonksiyonunun logaritması. - -## tgamma (x) {#tgammax} - -Gama fonksiyonu. - -## günah(x) {#sinx} - -Sinüs. - -## C (os (x) {#cosx} - -Kosinüs. - -## tan (x) {#tanx} - -Teğet. - -## asin (x) {#asinx} - -Ark sinüsü. - -## acos (x) {#acosx} - -Ark kosinüsü. - -## atan (x) {#atanx} - -Ark teğet. - -## pow (x, y), güç (x, y)) {#powx-y-powerx-y} - -İki sayısal bağımsız değişken X ve y alır.X'e yakın bir Float64 numarasını y gücüne döndürür. - -## ıntexp2 {#intexp2} - -Sayısal bir bağımsız değişkeni kabul eder ve X'in gücüne 2'ye yakın bir uint64 numarası döndürür. - -## ıntexp10 {#intexp10} - -Sayısal bir bağımsız değişkeni kabul eder ve X gücüne 10'a yakın bir uint64 numarası döndürür. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/tr/sql_reference/functions/other_functions.md b/docs/tr/sql_reference/functions/other_functions.md deleted file mode 100644 index 052f289c64f..00000000000 --- a/docs/tr/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,1079 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 66 -toc_title: "Di\u011Fer" ---- - -# Diğer fonksiyonlar {#other-functions} - -## hostnamename() {#hostname} - -Bu işlevin gerçekleştirildiği ana bilgisayarın adını içeren bir dize döndürür. Dağıtılmış işlem için, bu işlev uzak bir sunucuda gerçekleştirilirse, uzak sunucu ana bilgisayarının adıdır. - -## FQDN {#fqdn} - -Tam etki alanı adını döndürür. - -**Sözdizimi** - -``` sql -fqdn(); -``` - -Bu işlev büyük / küçük harf duyarsızdır. - -**Döndürülen değer** - -- Tam etki alanı adı ile dize. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT FQDN(); -``` - -Sonuç: - -``` text -┌─FQDN()──────────────────────────┐ -│ clickhouse.ru-central1.internal │ -└─────────────────────────────────┘ -``` - -## basename {#basename} - -Son eğik çizgi veya ters eğik çizgiden sonra bir dizenin sondaki kısmını ayıklar. Bu işlev, genellikle bir yoldan dosya adını ayıklamak için kullanılır. - -``` sql -basename( expr ) -``` - -**Parametre** - -- `expr` — Expression resulting in a [Dize](../../sql_reference/data_types/string.md) type value. Tüm ters eğik çizgilerin ortaya çıkan değerden kaçması gerekir. - -**Döndürülen Değer** - -İçeren bir dize: - -- Son eğik çizgi veya ters eğik çizgiden sonra bir dizenin sondaki kısmı. - - If the input string contains a path ending with slash or backslash, for example, `/` or `c:\`, the function returns an empty string. - -- Eğik çizgi veya ters eğik çizgi yoksa orijinal dize. - -**Örnek** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## visibleWidth(x) {#visiblewidthx} - -Değerleri konsola metin biçiminde (sekmeyle ayrılmış) çıkarırken yaklaşık genişliği hesaplar. -Bu işlev, sistem tarafından güzel formatların uygulanması için kullanılır. - -`NULL` karşılık gelen bir dize olarak temsil edilir `NULL` içinde `Pretty` biçimliler. - -``` sql -SELECT visibleWidth(NULL) -``` - -``` text -┌─visibleWidth(NULL)─┐ -│ 4 │ -└────────────────────┘ -``` - -## toTypeName (x) {#totypenamex} - -Geçirilen bağımsız değişken türü adını içeren bir dize döndürür. - -Eğer `NULL` fonksiyona girdi olarak geçirilir, daha sonra `Nullable(Nothing)` bir iç karşılık gelen türü `NULL` Clickhouse'da temsil. - -## blockSize() {#function-blocksize} - -Bloğun boyutunu alır. -Clickhouse'da, sorgular her zaman bloklarda (sütun parçaları kümeleri) çalıştırılır. Bu işlev, aradığınız bloğun boyutunu almanızı sağlar. - -## materialize (x) {#materializex} - -Bir sabiti yalnızca bir değer içeren tam bir sütuna dönüştürür. -Clickhouse'da, tam sütunlar ve sabitler bellekte farklı şekilde temsil edilir. İşlevler, sabit argümanlar ve normal argümanlar için farklı şekilde çalışır (farklı kod yürütülür), ancak sonuç hemen hemen her zaman aynıdır. Bu işlev, bu davranış hata ayıklama içindir. - -## ignore(…) {#ignore} - -Dahil olmak üzere herhangi bir argümanı kabul eder `NULL`. Her zaman 0 döndürür. -Ancak, argüman hala değerlendirilir. Bu kriterler için kullanılabilir. - -## uyku (saniye) {#sleepseconds} - -Uykular ‘seconds’ her veri bloğunda saniye. Bir tamsayı veya kayan noktalı sayı belirtebilirsiniz. - -## sleepEachRow (saniye) {#sleepeachrowseconds} - -Uykular ‘seconds’ her satırda saniye. Bir tamsayı veya kayan noktalı sayı belirtebilirsiniz. - -## currentDatabase() {#currentdatabase} - -Geçerli veritabanının adını döndürür. -Bu işlevi, veritabanını belirtmeniz gereken bir tablo oluştur sorgusunda tablo altyapısı parametrelerinde kullanabilirsiniz. - -## currentUser() {#other-function-currentuser} - -Geçerli kullanıcının oturum açma döndürür. Kullanıcı girişi, bu başlatılan sorgu, durumda distibuted sorguda iade edilecektir. - -``` sql -SELECT currentUser(); -``` - -Takma ad: `user()`, `USER()`. - -**Döndürülen değerler** - -- Geçerli kullanıcının girişi. -- Disributed sorgu durumunda sorgu başlatılan kullanıcının giriş. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT currentUser(); -``` - -Sonuç: - -``` text -┌─currentUser()─┐ -│ default │ -└───────────────┘ -``` - -## isFinite (x) {#isfinitex} - -Float32 ve Float64 kabul eder ve bağımsız değişken sonsuz değilse ve bir NaN değilse, Uint8'i 1'e eşit olarak döndürür, aksi halde 0. - -## isİnfinite (x) {#isinfinitex} - -Float32 ve Float64 kabul eder ve bağımsız değişken sonsuz ise 1'e eşit Uİnt8 döndürür, aksi takdirde 0. Bir NaN için 0 döndürüldüğünü unutmayın. - -## ifNotFinite {#ifnotfinite} - -Kayan nokta değerinin sonlu olup olmadığını kontrol eder. - -**Sözdizimi** - - ifNotFinite(x,y) - -**Parametre** - -- `x` — Value to be checked for infinity. Type: [Yüzdürmek\*](../../sql_reference/data_types/float.md). -- `y` — Fallback value. Type: [Yüzdürmek\*](../../sql_reference/data_types/float.md). - -**Döndürülen değer** - -- `x` eğer `x` son isludur. -- `y` eğer `x` sonlu değildir. - -**Örnek** - -Sorgu: - - SELECT 1/0 as infimum, ifNotFinite(infimum,42) - -Sonuç: - - ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐ - │ inf │ 42 │ - └─────────┴───────────────────────────────┘ - -Kullanarak benzer sonuç alabilirsiniz [üçlü operatör](conditional_functions.md#ternary-operator): `isFinite(x) ? x : y`. - -## ısnan (x) {#isnanx} - -Float32 ve Float64 kabul eder ve bağımsız değişken bir NaN, aksi takdirde 0 ise 1'e eşit uint8 döndürür. - -## hasColumnİnTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -Sabit dizeleri kabul eder: veritabanı adı, tablo adı ve sütun adı. Bir sütun varsa 1'e eşit bir uint8 sabit ifadesi döndürür, aksi halde 0. Hostname parametresi ayarlanmışsa, sınama uzak bir sunucuda çalışır. -Tablo yoksa, işlev bir özel durum atar. -İç içe veri yapısındaki öğeler için işlev, bir sütunun varlığını denetler. İç içe veri yapısının kendisi için işlev 0 döndürür. - -## bar {#function-bar} - -Unicode-art diyagramı oluşturmaya izin verir. - -`bar(x, min, max, width)` genişliği orantılı olan bir bant çizer `(x - min)` ve eşit `width` karakterler ne zaman `x = max`. - -Parametre: - -- `x` — Size to display. -- `min, max` — Integer constants. The value must fit in `Int64`. -- `width` — Constant, positive integer, can be fractional. - -Bant, bir sembolün sekizde birine doğrulukla çizilir. - -Örnek: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - -``` text -┌──h─┬──────c─┬─bar────────────────┐ -│ 0 │ 292907 │ █████████▋ │ -│ 1 │ 180563 │ ██████ │ -│ 2 │ 114861 │ ███▋ │ -│ 3 │ 85069 │ ██▋ │ -│ 4 │ 68543 │ ██▎ │ -│ 5 │ 78116 │ ██▌ │ -│ 6 │ 113474 │ ███▋ │ -│ 7 │ 170678 │ █████▋ │ -│ 8 │ 278380 │ █████████▎ │ -│ 9 │ 391053 │ █████████████ │ -│ 10 │ 457681 │ ███████████████▎ │ -│ 11 │ 493667 │ ████████████████▍ │ -│ 12 │ 509641 │ ████████████████▊ │ -│ 13 │ 522947 │ █████████████████▍ │ -│ 14 │ 539954 │ █████████████████▊ │ -│ 15 │ 528460 │ █████████████████▌ │ -│ 16 │ 539201 │ █████████████████▊ │ -│ 17 │ 523539 │ █████████████████▍ │ -│ 18 │ 506467 │ ████████████████▊ │ -│ 19 │ 520915 │ █████████████████▎ │ -│ 20 │ 521665 │ █████████████████▍ │ -│ 21 │ 542078 │ ██████████████████ │ -│ 22 │ 493642 │ ████████████████▍ │ -│ 23 │ 400397 │ █████████████▎ │ -└────┴────────┴────────────────────┘ -``` - -## dönüştürmek {#transform} - -Bir değeri, bazı öğelerin açıkça tanımlanmış eşlemesine göre diğer öğelere dönüştürür. -Bu fonksiyonun iki varyasyonu vardır: - -### transform (x, array\_from, array\_to, varsayılan) {#transformx-array-from-array-to-default} - -`x` – What to transform. - -`array_from` – Constant array of values for converting. - -`array_to` – Constant array of values to convert the values in ‘from’ -e doğru. - -`default` – Which value to use if ‘x’ değer anylerden hiçbir equaline eşit değildir. ‘from’. - -`array_from` ve `array_to` – Arrays of the same size. - -Türler: - -`transform(T, Array(T), Array(U), U) -> U` - -`T` ve `U` sayısal, dize veya tarih veya DateTime türleri olabilir. -Aynı harfin belirtildiği (t veya U), sayısal türler için bunlar eşleşen türler değil, ortak bir türe sahip türler olabilir. -Örneğin, ilk bağımsız değişken Int64 türüne sahip olabilir, ikincisi ise Array(Uİnt16) türüne sahiptir. - -Eğer... ‘x’ değer, içindeki öğelerden birine eşittir. ‘array\_from’ array, varolan öğeyi döndürür (aynı numaralandırılır) ‘array\_to’ dizi. Aksi takdirde, döner ‘default’. İçinde birden fazla eşleşen öğe varsa ‘array\_from’, maçlardan birini döndürür. - -Örnek: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - -``` text -┌─title─────┬──────c─┐ -│ Yandex │ 498635 │ -│ Google │ 229872 │ -│ Other │ 104472 │ -└───────────┴────────┘ -``` - -### transform (x, array\_from, array\_to) {#transformx-array-from-array-to} - -İlk vary thatasyon differsdan farklıdır. ‘default’ argüman atlandı. -Eğer... ‘x’ değer, içindeki öğelerden birine eşittir. ‘array\_from’ array, eşleşen öğeyi (aynı numaralandırılmış) döndürür ‘array\_to’ dizi. Aksi takdirde, döner ‘x’. - -Türler: - -`transform(T, Array(T), Array(T)) -> T` - -Örnek: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -┌─s──────────────┬───────c─┐ -│ │ 2906259 │ -│ www.yandex │ 867767 │ -│ ███████.ru │ 313599 │ -│ mail.yandex.ru │ 107147 │ -│ ██████.ru │ 100355 │ -│ █████████.ru │ 65040 │ -│ news.yandex.ru │ 64515 │ -│ ██████.net │ 59141 │ -│ example.com │ 57316 │ -└────────────────┴─────────┘ -``` - -## formatReadableSize (x) {#formatreadablesizex} - -Boyutu (bayt sayısı) kabul eder. Bir sonek (KiB, MıB, vb.) ile yuvarlak bir boyut döndürür.) bir dize olarak. - -Örnek: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - -``` text -┌─filesize_bytes─┬─filesize───┐ -│ 1 │ 1.00 B │ -│ 1024 │ 1.00 KiB │ -│ 1048576 │ 1.00 MiB │ -│ 192851925 │ 183.92 MiB │ -└────────────────┴────────────┘ -``` - -## en az (a, b) {#leasta-b} - -A ve B'den en küçük değeri döndürür. - -## en büyük (a, b) {#greatesta-b} - -A ve B'nin en büyük değerini döndürür. - -## çalışma süresi() {#uptime} - -Sunucunun çalışma süresini saniyeler içinde döndürür. - -## sürüm() {#version} - -Sunucu sürümünü bir dize olarak döndürür. - -## saat dilimi() {#timezone} - -Sunucunun saat dilimini döndürür. - -## blockNumber {#blocknumber} - -Satırın bulunduğu veri bloğunun sıra numarasını döndürür. - -## rowNumberİnBlock {#function-rownumberinblock} - -Veri bloğundaki satırın sıra numarasını döndürür. Farklı veri blokları her zaman yeniden hesaplanır. - -## rownumberınallblocks() {#rownumberinallblocks} - -Veri bloğundaki satırın sıra numarasını döndürür. Bu işlev yalnızca etkilenen veri bloklarını dikkate alır. - -## komşuluk {#neighbor} - -Belirli bir sütunun geçerli satırından önce veya sonra gelen belirli bir ofsette bir satıra erişim sağlayan pencere işlevi. - -**Sözdizimi** - -``` sql -neighbor(column, offset[, default_value]) -``` - -İşlevin sonucu, etkilenen veri bloklarına ve bloktaki veri sırasına bağlıdır. -ORDER BY ile bir alt sorgu yaparsanız ve alt sorgunun dışından işlevi çağırırsanız, beklenen sonucu alabilirsiniz. - -**Parametre** - -- `column` — A column name or scalar expression. -- `offset` — The number of rows forwards or backwards from the current row of `column`. [Int64](../../sql_reference/data_types/int_uint.md). -- `default_value` — Optional. The value to be returned if offset goes beyond the scope of the block. Type of data blocks affected. - -**Döndürülen değerler** - -- İçin değer `column` içinde `offset` eğer geçerli satırdan uzaklık `offset` değer blok sınırları dışında değil. -- İçin varsayılan değer `column` eğer `offset` değer, blok sınırlarının dışındadır. Eğer `default_value` verilir, daha sonra kullanılacaktır. - -Tür: etkilenen veri bloklarının türü veya varsayılan değer türü. - -**Örnek** - -Sorgu: - -``` sql -SELECT number, neighbor(number, 2) FROM system.numbers LIMIT 10; -``` - -Sonuç: - -``` text -┌─number─┬─neighbor(number, 2)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 0 │ -│ 9 │ 0 │ -└────────┴─────────────────────┘ -``` - -Sorgu: - -``` sql -SELECT number, neighbor(number, 2, 999) FROM system.numbers LIMIT 10; -``` - -Sonuç: - -``` text -┌─number─┬─neighbor(number, 2, 999)─┐ -│ 0 │ 2 │ -│ 1 │ 3 │ -│ 2 │ 4 │ -│ 3 │ 5 │ -│ 4 │ 6 │ -│ 5 │ 7 │ -│ 6 │ 8 │ -│ 7 │ 9 │ -│ 8 │ 999 │ -│ 9 │ 999 │ -└────────┴──────────────────────────┘ -``` - -Bu işlev, yıldan yıla metrik değeri hesaplamak için kullanılabilir: - -Sorgu: - -``` sql -WITH toDate('2018-01-01') AS start_date -SELECT - toStartOfMonth(start_date + (number * 32)) AS month, - toInt32(month) % 100 AS money, - neighbor(money, -12) AS prev_year, - round(prev_year / money, 2) AS year_over_year -FROM numbers(16) -``` - -Sonuç: - -``` text -┌──────month─┬─money─┬─prev_year─┬─year_over_year─┐ -│ 2018-01-01 │ 32 │ 0 │ 0 │ -│ 2018-02-01 │ 63 │ 0 │ 0 │ -│ 2018-03-01 │ 91 │ 0 │ 0 │ -│ 2018-04-01 │ 22 │ 0 │ 0 │ -│ 2018-05-01 │ 52 │ 0 │ 0 │ -│ 2018-06-01 │ 83 │ 0 │ 0 │ -│ 2018-07-01 │ 13 │ 0 │ 0 │ -│ 2018-08-01 │ 44 │ 0 │ 0 │ -│ 2018-09-01 │ 75 │ 0 │ 0 │ -│ 2018-10-01 │ 5 │ 0 │ 0 │ -│ 2018-11-01 │ 36 │ 0 │ 0 │ -│ 2018-12-01 │ 66 │ 0 │ 0 │ -│ 2019-01-01 │ 97 │ 32 │ 0.33 │ -│ 2019-02-01 │ 28 │ 63 │ 2.25 │ -│ 2019-03-01 │ 56 │ 91 │ 1.62 │ -│ 2019-04-01 │ 87 │ 22 │ 0.25 │ -└────────────┴───────┴───────────┴────────────────┘ -``` - -## runningDifference (x) {#other_functions-runningdifference} - -Calculates the difference between successive row values ​​in the data block. -İlk satır için 0 ve sonraki her satır için önceki satırdan farkı döndürür. - -İşlevin sonucu, etkilenen veri bloklarına ve bloktaki veri sırasına bağlıdır. -ORDER BY ile bir alt sorgu yaparsanız ve alt sorgunun dışından işlevi çağırırsanız, beklenen sonucu alabilirsiniz. - -Örnek: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - -``` text -┌─EventID─┬───────────EventTime─┬─delta─┐ -│ 1106 │ 2016-11-24 00:00:04 │ 0 │ -│ 1107 │ 2016-11-24 00:00:05 │ 1 │ -│ 1108 │ 2016-11-24 00:00:05 │ 0 │ -│ 1109 │ 2016-11-24 00:00:09 │ 4 │ -│ 1110 │ 2016-11-24 00:00:10 │ 1 │ -└─────────┴─────────────────────┴───────┘ -``` - -Lütfen dikkat - blok boyutu sonucu etkiler. Her yeni blok ile, `runningDifference` durum sıfırlandı. - -``` sql -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -┌─number─┬─diff─┐ -│ 65536 │ 0 │ -└────────┴──────┘ -``` - -``` sql -set max_block_size=100000 -- default value is 65536! - -SELECT - number, - runningDifference(number + 1) AS diff -FROM numbers(100000) -WHERE diff != 1 -``` - -``` text -┌─number─┬─diff─┐ -│ 0 │ 0 │ -└────────┴──────┘ -``` - -## runningDifferenceStartingWithFirstvalue {#runningdifferencestartingwithfirstvalue} - -İçin aynı [runningDifference](./other_functions.md#other_functions-runningdifference), fark ilk satırın değeridir, ilk satırın değerini döndürdü ve sonraki her satır önceki satırdan farkı döndürür. - -## MACNumToString (num) {#macnumtostringnum} - -Bir uınt64 numarasını kabul eder. Big endian'da bir MAC adresi olarak yorumlar. AA:BB:CC:DD:EE:FF biçiminde karşılık gelen MAC adresini içeren bir dize döndürür (onaltılık formda iki nokta üst üste ayrılmış sayılar). - -## MACStringToNum (s) {#macstringtonums} - -MACNumToString ters işlevi. MAC adresi geçersiz bir biçime sahipse, 0 döndürür. - -## MACStringToOUİ (s) {#macstringtoouis} - -AA:BB:CC:DD:EE:FF (onaltılık formda iki nokta üst üste ayrılmış sayılar) biçiminde bir MAC adresi kabul eder. İlk üç sekizli uint64 numarası olarak döndürür. MAC adresi geçersiz bir biçime sahipse, 0 döndürür. - -## getSizeOfEnumType {#getsizeofenumtype} - -Alan sayısını döndürür [Enum](../../sql_reference/data_types/enum.md). - -``` sql -getSizeOfEnumType(value) -``` - -**Parametre:** - -- `value` — Value of type `Enum`. - -**Döndürülen değerler** - -- İle alan sayısı `Enum` giriş değerleri. -- Tür değilse bir istisna atılır `Enum`. - -**Örnek** - -``` sql -SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## blockSerializedSize {#blockserializedsize} - -Diskteki boyutu döndürür (sıkıştırmayı hesaba katmadan). - -``` sql -blockSerializedSize(value[, value[, ...]]) -``` - -**Parametre:** - -- `value` — Any value. - -**Döndürülen değerler** - -- (Sıkıştırma olmadan) değerler bloğu için diske yazılacak bayt sayısı. - -**Örnek** - -``` sql -SELECT blockSerializedSize(maxState(1)) as x -``` - -``` text -┌─x─┐ -│ 2 │ -└───┘ -``` - -## toColumnTypeName {#tocolumntypename} - -RAM'DEKİ sütunun veri türünü temsil eden sınıfın adını döndürür. - -``` sql -toColumnTypeName(value) -``` - -**Parametre:** - -- `value` — Any type of value. - -**Döndürülen değerler** - -- Temsil etmek için kullanılan sınıfın adını içeren bir dize `value` RAM veri türü. - -**Arasındaki fark örneği`toTypeName ' and ' toColumnTypeName`** - -``` sql -SELECT toTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime │ -└─────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toColumnTypeName(CAST('2018-01-01 01:02:03' AS DateTime)) -``` - -``` text -┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ Const(UInt32) │ -└───────────────────────────────────────────────────────────┘ -``` - -Örnek gösteriyor ki `DateTime` veri türü olarak bellekte saklanır `Const(UInt32)`. - -## dumpColumnStructure {#dumpcolumnstructure} - -Ram'deki veri yapılarının ayrıntılı bir açıklamasını verir - -``` sql -dumpColumnStructure(value) -``` - -**Parametre:** - -- `value` — Any type of value. - -**Döndürülen değerler** - -- Temsil etmek için kullanılan yapıyı açıklayan bir dize `value` RAM veri türü. - -**Örnek** - -``` sql -SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) -``` - -``` text -┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ -│ DateTime, Const(size = 1, UInt32(size = 1)) │ -└──────────────────────────────────────────────────────────────┘ -``` - -## defaultValueOfArgumentType {#defaultvalueofargumenttype} - -Veri türü için varsayılan değeri verir. - -Kullanıcı tarafından ayarlanan özel sütunlar için varsayılan değerleri içermez. - -``` sql -defaultValueOfArgumentType(expression) -``` - -**Parametre:** - -- `expression` — Arbitrary type of value or an expression that results in a value of an arbitrary type. - -**Döndürülen değerler** - -- `0` sayılar için. -- Dizeler için boş dize. -- `ᴺᵁᴸᴸ` için [Nullable](../../sql_reference/data_types/nullable.md). - -**Örnek** - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ -│ 0 │ -└─────────────────────────────────────────────┘ -``` - -``` sql -SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) -``` - -``` text -┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ -│ ᴺᵁᴸᴸ │ -└───────────────────────────────────────────────────────┘ -``` - -## çoğaltmak {#other-functions-replicate} - -Tek bir değere sahip bir dizi oluşturur. - -İç uygulama için kullanılan [arrayJoin](array_join.md#functions_arrayjoin). - -``` sql -SELECT replicate(x, arr); -``` - -**Parametre:** - -- `arr` — Original array. ClickHouse creates a new array of the same length as the original and fills it with the value `x`. -- `x` — The value that the resulting array will be filled with. - -**Döndürülen değer** - -Değerle dolu bir dizi `x`. - -Tür: `Array`. - -**Örnek** - -Sorgu: - -``` sql -SELECT replicate(1, ['a', 'b', 'c']) -``` - -Sonuç: - -``` text -┌─replicate(1, ['a', 'b', 'c'])─┐ -│ [1,1,1] │ -└───────────────────────────────┘ -``` - -## filesystemAvailable {#filesystemavailable} - -Veritabanlarının dosyalarının bulunduğu dosya sisteminde kalan alan miktarını döndürür. Her zaman toplam boş alandan daha küçüktür ([filesystemFree](#filesystemfree)) çünkü OS için biraz alan ayrılmıştır. - -**Sözdizimi** - -``` sql -filesystemAvailable() -``` - -**Döndürülen değer** - -- Bayt olarak kullanılabilir kalan alan miktarı. - -Tür: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT formatReadableSize(filesystemAvailable()) AS "Available space", toTypeName(filesystemAvailable()) AS "Type"; -``` - -Sonuç: - -``` text -┌─Available space─┬─Type───┐ -│ 30.75 GiB │ UInt64 │ -└─────────────────┴────────┘ -``` - -## filesystemFree {#filesystemfree} - -Veritabanlarının dosyalarının bulunduğu dosya sistemindeki boş alanın toplam miktarını döndürür. Ayrıca bakınız `filesystemAvailable` - -**Sözdizimi** - -``` sql -filesystemFree() -``` - -**Döndürülen değer** - -- Bayt cinsinden boş alan miktarı. - -Tür: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT formatReadableSize(filesystemFree()) AS "Free space", toTypeName(filesystemFree()) AS "Type"; -``` - -Sonuç: - -``` text -┌─Free space─┬─Type───┐ -│ 32.39 GiB │ UInt64 │ -└────────────┴────────┘ -``` - -## filesystemCapacity {#filesystemcapacity} - -Dosya sisteminin kapasitesini bayt cinsinden döndürür. Değerlendirme için, [yol](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-path) veri dizinine yapılandırılmalıdır. - -**Sözdizimi** - -``` sql -filesystemCapacity() -``` - -**Döndürülen değer** - -- Dosya sisteminin bayt cinsinden kapasite bilgisi. - -Tür: [Uİnt64](../../sql_reference/data_types/int_uint.md). - -**Örnek** - -Sorgu: - -``` sql -SELECT formatReadableSize(filesystemCapacity()) AS "Capacity", toTypeName(filesystemCapacity()) AS "Type" -``` - -Sonuç: - -``` text -┌─Capacity──┬─Type───┐ -│ 39.32 GiB │ UInt64 │ -└───────────┴────────┘ -``` - -## finalizeAggregation {#function-finalizeaggregation} - -Toplama işlevinin durumunu alır. Toplama sonucunu döndürür (kesinleşmiş durum). - -## runningAccumulate {#function-runningaccumulate} - -Toplama işlevinin durumlarını alır ve değerleri olan bir sütun döndürür, bu durumların bir dizi blok satırı için ilk satırdan geçerli satıra birikmesinin sonucudur. -Örneğin, toplama işlevinin durumunu alır (örnek runningAccumulate (uniqState (Userıd))) ve her blok satırı için, önceki tüm Satırların ve geçerli satırın durumlarının birleştirilmesinde toplama işlevinin sonucunu döndürür. -Bu nedenle, işlevin sonucu, verilerin bloklara bölünmesine ve blok içindeki verilerin sırasına bağlıdır. - -## joinGet {#joinget} - -İşlev, tablodan verileri bir tablodan aynı şekilde ayıklamanızı sağlar [sözlük](../../sql_reference/dictionaries/index.md). - -Veri alır [Katmak](../../engines/table_engines/special/join.md#creating-a-table) belirtilen birleştirme anahtarını kullanarak tablolar. - -Sadece ile oluşturulan tabloları destekler `ENGINE = Join(ANY, LEFT, )` deyim. - -**Sözdizimi** - -``` sql -joinGet(join_storage_table_name, `value_column`, join_keys) -``` - -**Parametre** - -- `join_storage_table_name` — an [tanıtıcı](../syntax.md#syntax-identifiers) aramanın nerede yapıldığını gösterir. Tanımlayıcı varsayılan veritabanında aranır (bkz. parametre `default_database` config dosyası). Varsayılan veritabanını geçersiz kılmak için `USE db_name` veya ayırıcı aracılığıyla veritabanını ve tabloyu belirtin `db_name.db_table` örnek bakın. -- `value_column` — name of the column of the table that contains required data. -- `join_keys` — list of keys. - -**Döndürülen değer** - -Anahtarların listesine karşılık gelen değerlerin listesini döndürür. - -Kaynak tabloda kesin yoksa o zaman `0` veya `null` esas alınarak iade edilecektir [join\_use\_nulls](../../operations/settings/settings.md#join_use_nulls) ayar. - -Hakkında daha fazla bilgi `join_use_nulls` içinde [Birleştirme işlemi](../../engines/table_engines/special/join.md). - -**Örnek** - -Giriş tablosu: - -``` sql -CREATE DATABASE db_test -CREATE TABLE db_test.id_val(`id` UInt32, `val` UInt32) ENGINE = Join(ANY, LEFT, id) SETTINGS join_use_nulls = 1 -INSERT INTO db_test.id_val VALUES (1,11)(2,12)(4,13) -``` - -``` text -┌─id─┬─val─┐ -│ 4 │ 13 │ -│ 2 │ 12 │ -│ 1 │ 11 │ -└────┴─────┘ -``` - -Sorgu: - -``` sql -SELECT joinGet(db_test.id_val,'val',toUInt32(number)) from numbers(4) SETTINGS join_use_nulls = 1 -``` - -Sonuç: - -``` text -┌─joinGet(db_test.id_val, 'val', toUInt32(number))─┐ -│ 0 │ -│ 11 │ -│ 12 │ -│ 0 │ -└──────────────────────────────────────────────────┘ -``` - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -Dış modeli değerlendirin. -Bir model adı ve model bağımsız değişkenleri kabul eder. Float64 Döndürür. - -## throwİf(x \[, custom\_message\]) {#throwifx-custom-message} - -Argüman sıfır değilse bir istisna atın. -custom\_message-isteğe bağlı bir parametredir: sabit bir dize, bir hata mesajı sağlar - -``` sql -SELECT throwIf(number = 3, 'Too many') FROM numbers(10); -``` - -``` text -↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.14.1): -Code: 395. DB::Exception: Received from localhost:9000. DB::Exception: Too many. -``` - -## kimlik {#identity} - -Bağımsız değişkeni olarak kullanılan aynı değeri döndürür. Hata ayıklama ve test için kullanılan, dizin kullanarak iptal ve tam bir tarama sorgu performansını almak için izin verir. Olası dizin kullanımı için sorgu analiz edildiğinde, analizör içeriye bakmaz `identity` işlevler. - -**Sözdizimi** - -``` sql -identity(x) -``` - -**Örnek** - -Sorgu: - -``` sql -SELECT identity(42) -``` - -Sonuç: - -``` text -┌─identity(42)─┐ -│ 42 │ -└──────────────┘ -``` - -## randomPrintableASCİİ {#randomascii} - -Rastgele bir dizi ile bir dize oluşturur [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) yazdırılabilir karakterler. - -**Sözdizimi** - -``` sql -randomPrintableASCII(length) -``` - -**Parametre** - -- `length` — Resulting string length. Positive integer. - - If you pass `length < 0`, behavior of the function is undefined. - -**Döndürülen değer** - -- Rastgele bir dizi dize [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) yazdırılabilir karakterler. - -Tür: [Dize](../../sql_reference/data_types/string.md) - -**Örnek** - -``` sql -SELECT number, randomPrintableASCII(30) as str, length(str) FROM system.numbers LIMIT 3 -``` - -``` text -┌─number─┬─str────────────────────────────┬─length(randomPrintableASCII(30))─┐ -│ 0 │ SuiCOSTvC0csfABSw=UcSzp2.`rv8x │ 30 │ -│ 1 │ 1Ag NlJ &RCN:*>HVPG;PE-nO"SUFD │ 30 │ -│ 2 │ /"+<"wUTh:=LjJ Vm!c&hI*m#XTfzz │ 30 │ -└────────┴────────────────────────────────┴──────────────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/tr/sql_reference/functions/random_functions.md b/docs/tr/sql_reference/functions/random_functions.md deleted file mode 100644 index e57106426f4..00000000000 --- a/docs/tr/sql_reference/functions/random_functions.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 51 -toc_title: "S\xF6zde Rasgele Say\u0131lar Olu\u015Fturma" ---- - -# Sözde rasgele sayılar üretmek için fonksiyonlar {#functions-for-generating-pseudo-random-numbers} - -Sözde rasgele sayıların kriptografik olmayan jeneratörleri kullanılır. - -Tüm işlevler sıfır bağımsız değişkeni veya bir bağımsız değişkeni kabul eder. -Bir argüman geçirilirse, herhangi bir tür olabilir ve değeri hiçbir şey için kullanılmaz. -Bu argümanın tek amacı, aynı işlevin iki farklı örneğinin farklı rasgele sayılarla farklı sütunlar döndürmesi için ortak alt ifade eliminasyonunu önlemektir. - -## Güney Afrika parası {#rand} - -Tüm uint32 tipi sayılar arasında eşit olarak dağıtılan bir sözde rasgele uint32 numarası döndürür. -Doğrusal bir uyumlu jeneratör kullanır. - -## rand64 {#rand64} - -Tüm uint64 tipi sayılar arasında eşit olarak dağıtılan sözde rasgele bir uint64 numarası döndürür. -Doğrusal bir uyumlu jeneratör kullanır. - -## randConstant {#randconstant} - -Bir sözde rastgele uint32 numarası döndürür, değer farklı bloklar için birdir. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/tr/sql_reference/functions/rounding_functions.md b/docs/tr/sql_reference/functions/rounding_functions.md deleted file mode 100644 index 6d47ae54dae..00000000000 --- a/docs/tr/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 45 -toc_title: "D\xF6nm\xFC\u015F" ---- - -# Yuvarlama fonksiyonları {#rounding-functions} - -## kat(x \[, N\]) {#floorx-n} - -Küçük veya eşit olan en büyük yuvarlak sayıyı döndürür `x`. Yuvarlak bir sayı, 1/10N'NİN katları veya 1 / 10N tam değilse, uygun veri türünün en yakın sayısıdır. -‘N’ bir tamsayı sabiti, isteğe bağlı parametredir. Varsayılan olarak sıfırdır, bu da bir tam sayıya yuvarlamak anlamına gelir. -‘N’ negatif olabilir. - -Örnekler: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x` herhangi bir sayısal türüdür. Sonuç aynı türden bir sayıdır. -Tamsayı argümanları için, bir negatif ile yuvarlamak mantıklıdır `N` değer (negatif olmayan için `N`, işlev hiçbir şey yapmaz). -Yuvarlama taşmasına neden olursa (örneğin, floor (-128, -1)), uygulamaya özgü bir sonuç döndürülür. - -## tavan(x \[, N\]), tavan (x \[, N\]) {#ceilx-n-ceilingx-n} - -Büyük veya eşit olan en küçük yuvarlak sayıyı döndürür `x`. Diğer her şekilde, aynı `floor` (yukarıda) işlevi. - -## trunc(x \[, N\]), truncate(x \[, N\]) {#truncx-n-truncatex-n} - -Mutlak değeri küçük veya eşit olan en büyük mutlak değere sahip yuvarlak sayıyı döndürür `x`‘s. In every other way, it is the same as the ’floor’ (yukarıda) işlevi. - -## Yuvarlak(x \[, N\]) {#rounding_functions-round} - -Belirtilen sayıda ondalık basamak için bir değer yuvarlar. - -İşlev, belirtilen siparişin en yakın numarasını döndürür. Verilen sayı çevreleyen sayılara eşit mesafeye sahip olduğunda, işlev, float sayı türleri için bankacının yuvarlamasını kullanır ve diğer sayı türleri için sıfırdan uzaklaşır. - -``` sql -round(expression [, decimal_places]) -``` - -**Parametre:** - -- `expression` — A number to be rounded. Can be any [ifade](../syntax.md#syntax-expressions) sayısal dönen [veri türü](../../sql_reference/data_types/index.md#data_types). -- `decimal-places` — An integer value. - - Eğer `decimal-places > 0` sonra işlev değeri ondalık noktanın sağına yuvarlar. - - Eğer `decimal-places < 0` ardından işlev değeri ondalık noktanın soluna yuvarlar. - - Eğer `decimal-places = 0` sonra işlev değeri tamsayı olarak yuvarlar. Bu durumda argüman ihmal edilebilir. - -**Döndürülen değer:** - -Giriş numarası ile aynı türden yuvarlatılmış sayı. - -### Örnekler {#examples} - -**Kullanım örneği** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - -``` text -┌───x─┬─round(divide(number, 2))─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -└─────┴──────────────────────────┘ -``` - -**Yuvarlama örnekleri** - -En yakın numaraya yuvarlama. - -``` text -round(3.2, 0) = 3 -round(4.1267, 2) = 4.13 -round(22,-1) = 20 -round(467,-2) = 500 -round(-467,-2) = -500 -``` - -Bankacı yuvarlanıyor. - -``` text -round(3.5) = 4 -round(4.5) = 4 -round(3.55, 1) = 3.6 -round(3.65, 1) = 3.6 -``` - -**Ayrıca Bakınız** - -- [roundBankers](#roundbankers) - -## roundBankers {#roundbankers} - -Bir sayıyı belirtilen ondalık konuma yuvarlar. - -- Yuvarlama sayısı iki sayı arasında yarıya ise, işlev banker yuvarlama kullanır. - - Banker's rounding is a method of rounding fractional numbers. When the rounding number is halfway between two numbers, it's rounded to the nearest even digit at the specified decimal position. For example: 3.5 rounds up to 4, 2.5 rounds down to 2. - - It's the default rounding method for floating point numbers defined in [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754#Roundings_to_nearest). The [round](#rounding_functions-round) function performs the same rounding for floating point numbers. The `roundBankers` function also rounds integers the same way, for example, `roundBankers(45, -1) = 40`. - -- Diğer durumlarda, işlev sayıları en yakın tam sayıya yuvarlar. - -Banker yuvarlama kullanarak, yuvarlama numaraları toplama veya bu sayıları çıkarma sonuçları üzerindeki etkisini azaltabilir. - -Örneğin, farklı yuvarlama ile 1.5, 2.5, 3.5, 4.5 sayılarını topla: - -- Yuvarlama yok: 1.5 + 2.5 + 3.5 + 4.5 = 12. -- Bankacı yuvarlama: 2 + 2 + 4 + 4 = 12. -- En yakın tam sayıya yuvarlama: 2 + 3 + 4 + 5 = 14. - -**Sözdizimi** - -``` sql -roundBankers(expression [, decimal_places]) -``` - -**Parametre** - -- `expression` — A number to be rounded. Can be any [ifade](../syntax.md#syntax-expressions) sayısal dönen [veri türü](../../sql_reference/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`. - - `decimal-places = 0` — The function rounds the number to an integer. In this case the argument can be omitted. Example: `roundBankers(2.5) = 2`. - -**Döndürülen değer** - -Banker yuvarlama yöntemi tarafından yuvarlanan bir değer. - -### Örnekler {#examples-1} - -**Kullanım örneği** - -Sorgu: - -``` sql - SELECT number / 2 AS x, roundBankers(x, 0) AS b fROM system.numbers limit 10 -``` - -Sonuç: - -``` text -┌───x─┬─b─┐ -│ 0 │ 0 │ -│ 0.5 │ 0 │ -│ 1 │ 1 │ -│ 1.5 │ 2 │ -│ 2 │ 2 │ -│ 2.5 │ 2 │ -│ 3 │ 3 │ -│ 3.5 │ 4 │ -│ 4 │ 4 │ -│ 4.5 │ 4 │ -└─────┴───┘ -``` - -**Bankacı yuvarlama örnekleri** - -``` text -roundBankers(0.4) = 0 -roundBankers(-3.5) = -4 -roundBankers(4.5) = 4 -roundBankers(3.55, 1) = 3.6 -roundBankers(3.65, 1) = 3.6 -roundBankers(10.35, 1) = 10.4 -roundBankers(10.755, 2) = 11,76 -``` - -**Ayrıca Bakınız** - -- [turlu](#rounding_functions-round) - -## roundToExp2 (num) {#roundtoexp2num} - -Bir sayı kabul eder. Sayı birden az ise, 0 döndürür. Aksi takdirde, sayıyı en yakın (negatif olmayan) iki dereceye yuvarlar. - -## roundDuration (num) {#rounddurationnum} - -Bir sayı kabul eder. Sayı birden az ise, 0 döndürür. Aksi takdirde, sayıyı kümeden sayılara yuvarlar: 1, 10, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 18000, 36000. Bu fonksiyon (kayıt olmak için özeldir.Metrica ve oturum uzunluğu raporu uygulamak için kullanılır. - -## roundAge (num) {#roundagenum} - -Bir sayı kabul eder. Sayı 18'den küçükse, 0 döndürür. Aksi takdirde, sayıyı kümeden bir sayıya yuvarlar: 18, 25, 35, 45, 55. Bu fonksiyon (kayıt olmak için özeldir.Metrica ve kullanıcı yaş raporu uygulamak için kullanılır. - -## roundDown (num, arr) {#rounddownnum-arr} - -Bir sayıyı kabul eder ve belirtilen Dizideki bir öğeye yuvarlar. Değer en düşük sınırdan küçükse, en düşük sınır döndürülür. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/tr/sql_reference/functions/splitting_merging_functions.md b/docs/tr/sql_reference/functions/splitting_merging_functions.md deleted file mode 100644 index 81269606d98..00000000000 --- a/docs/tr/sql_reference/functions/splitting_merging_functions.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 47 -toc_title: "Dizeleri ve dizileri b\xF6lme ve birle\u015Ftirme" ---- - -# Dizeleri ve dizileri bölme ve birleştirme işlevleri {#functions-for-splitting-and-merging-strings-and-arrays} - -## splitByChar (ayırıcı, s) {#splitbycharseparator-s} - -Bir dizeyi belirtilen bir karakterle ayrılmış alt dizelere böler. Sabit bir dize kullanır `separator` tam olarak bir karakterden oluşan. -Seçili alt dizelerin bir dizisini döndürür. Ayırıcı dizenin başında veya sonunda oluşursa veya ardışık birden çok ayırıcı varsa, boş alt dizeler seçilebilir. - -**Sözdizimi** - -``` sql -splitByChar(, ) -``` - -**Parametre** - -- `separator` — The separator which should contain exactly one character. [Dize](../../sql_reference/data_types/string.md). -- `s` — The string to split. [Dize](../../sql_reference/data_types/string.md). - -**Döndürülen değer (ler)** - -Seçili alt dizelerin bir dizisini döndürür. Boş alt dizeler şu durumlarda seçilebilir: - -- Dizenin başında veya sonunda bir ayırıcı oluşur; -- Birden fazla ardışık ayırıcı vardır; -- Orijinal dize `s` boş. - -Tür: [Dizi](../../sql_reference/data_types/array.md) -den [Dize](../../sql_reference/data_types/string.md). - -**Örnek** - -``` sql -SELECT splitByChar(',', '1,2,3,abcde') -``` - -``` text -┌─splitByChar(',', '1,2,3,abcde')─┐ -│ ['1','2','3','abcde'] │ -└─────────────────────────────────┘ -``` - -## splitByString (ayırıcı, s) {#splitbystringseparator-s} - -Bir dizeyi bir dizeyle ayrılmış alt dizelere böler. Sabit bir dize kullanır `separator` ayırıcı olarak birden fazla karakter. Eğer dize `separator` boş olduğunu, bu bölünmüş dize `s` tek karakter dizisine. - -**Sözdizimi** - -``` sql -splitByString(, ) -``` - -**Parametre** - -- `separator` — The separator. [Dize](../../sql_reference/data_types/string.md). -- `s` — The string to split. [Dize](../../sql_reference/data_types/string.md). - -**Döndürülen değer (ler)** - -Seçili alt dizelerin bir dizisini döndürür. Boş alt dizeler şu durumlarda seçilebilir: - -Tür: [Dizi](../../sql_reference/data_types/array.md) -den [Dize](../../sql_reference/data_types/string.md). - -- Boş olmayan bir ayırıcı dizenin başında veya sonunda oluşur; -- Birden fazla ardışık boş olmayan ayırıcı vardır; -- Orijinal dize `s` ayırıcı boş değilken boş. - -**Örnek** - -``` sql -SELECT splitByString(', ', '1, 2 3, 4,5, abcde') -``` - -``` text -┌─splitByString(', ', '1, 2 3, 4,5, abcde')─┐ -│ ['1','2 3','4,5','abcde'] │ -└───────────────────────────────────────────┘ -``` - -``` sql -SELECT splitByString('', 'abcde') -``` - -``` text -┌─splitByString('', 'abcde')─┐ -│ ['a','b','c','d','e'] │ -└────────────────────────────┘ -``` - -## arrayStringConcat(arr \[, ayırıcı\]) {#arraystringconcatarr-separator} - -Dizide listelenen dizeleri ayırıcı ile birleştirir.'separator' isteğe bağlı bir parametredir: varsayılan olarak boş bir dizeye ayarlanmış sabit bir dize. -Dizeyi döndürür. - -## alphaTokens (s) {#alphatokenss} - -A-z ve A-Z aralıklarından ardışık baytların alt dizelerini seçer. - -**Örnek** - -``` sql -SELECT alphaTokens('abca1abc') -``` - -``` text -┌─alphaTokens('abca1abc')─┐ -│ ['abca','abc'] │ -└─────────────────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/tr/sql_reference/functions/string_functions.md b/docs/tr/sql_reference/functions/string_functions.md deleted file mode 100644 index 012c8210537..00000000000 --- a/docs/tr/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,489 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 40 -toc_title: "Dizeleri ile \xE7al\u0131\u015Fma" ---- - -# Dizelerle çalışmak için işlevler {#functions-for-working-with-strings} - -## boş {#empty} - -Boş bir dize için 1 veya boş olmayan bir dize için 0 döndürür. -Sonuç türü Uint8'dir. -Bir boşluk veya boş bayt olsa bile, en az bir bayt içeriyorsa, bir dize boş olarak kabul edilir. -İşlev ayrıca diziler için de çalışır. - -## notEmpty {#notempty} - -Boş bir dize için 0 veya boş olmayan bir dize için 1 döndürür. -Sonuç türü Uint8'dir. -İşlev ayrıca diziler için de çalışır. - -## uzunluk {#length} - -Bir dizenin uzunluğunu bayt cinsinden döndürür (karakterlerde değil, kod noktalarında değil). -Sonuç türü Uint64'tür. -İşlev ayrıca diziler için de çalışır. - -## lengthUTF8 {#lengthutf8} - -Dizenin UTF-8 kodlanmış metni oluşturan bir bayt kümesi içerdiğini varsayarak, Unicode kod noktalarında (karakterlerde değil) bir dizenin uzunluğunu döndürür. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). -Sonuç türü Uint64'tür. - -## char\_length, CHAR\_LENGTH {#char-length} - -Dizenin UTF-8 kodlanmış metni oluşturan bir bayt kümesi içerdiğini varsayarak, Unicode kod noktalarında (karakterlerde değil) bir dizenin uzunluğunu döndürür. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). -Sonuç türü Uint64'tür. - -## character\_length, CHARACTER\_LENGTH {#character-length} - -Dizenin UTF-8 kodlanmış metni oluşturan bir bayt kümesi içerdiğini varsayarak, Unicode kod noktalarında (karakterlerde değil) bir dizenin uzunluğunu döndürür. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). -Sonuç türü Uint64'tür. - -## alt, lcase {#lower} - -Bir dizedeki ASCII Latin sembollerini küçük harfe dönüştürür. - -## üst, ucase {#upper} - -Bir dizedeki ASCII Latin sembollerini büyük harfe dönüştürür. - -## lowerUTF8 {#lowerutf8} - -Dizenin UTF-8 kodlu bir metni oluşturan bir bayt kümesi içerdiğini varsayarak bir dizeyi küçük harfe dönüştürür. -Dili algılamaz. Yani Türkçe için sonuç tam olarak doğru olmayabilir. -UTF-8 bayt dizisinin uzunluğu bir kod noktasının büyük ve küçük harf için farklıysa, sonuç bu kod noktası için yanlış olabilir. -Dize, UTF-8 olmayan bir bayt kümesi içeriyorsa, davranış tanımsızdır. - -## upperUTF8 {#upperutf8} - -Dize, UTF-8 kodlanmış bir metni oluşturan bir bayt kümesi içerdiğini varsayarak bir dizeyi büyük harfe dönüştürür. -Dili algılamaz. Yani Türkçe için sonuç tam olarak doğru olmayabilir. -UTF-8 bayt dizisinin uzunluğu bir kod noktasının büyük ve küçük harf için farklıysa, sonuç bu kod noktası için yanlış olabilir. -Dize, UTF-8 olmayan bir bayt kümesi içeriyorsa, davranış tanımsızdır. - -## ısvalidutf8 {#isvalidutf8} - -Bayt kümesi geçerli UTF-8 kodlanmış, aksi takdirde 0 ise, 1 döndürür. - -## toValidUTF8 {#tovalidutf8} - -Geçersiz UTF-8 karakterlerini değiştirir `�` (U+FFFD) karakteri. Bir satırda çalışan tüm geçersiz karakterler bir yedek karaktere daraltılır. - -``` sql -toValidUTF8( input_string ) -``` - -Parametre: - -- input\_string — Any set of bytes represented as the [Dize](../../sql_reference/data_types/string.md) veri türü nesnesi. - -Döndürülen değer: geçerli UTF-8 dizesi. - -**Örnek** - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## tekrarlama {#repeat} - -Bir dizeyi belirtilen kadar çok tekrarlar ve çoğaltılmış değerleri tek bir dize olarak birleştirir. - -**Sözdizimi** - -``` sql -repeat(s, n) -``` - -**Parametre** - -- `s` — The string to repeat. [Dize](../../sql_reference/data_types/string.md). -- `n` — The number of times to repeat the string. [Uİnt](../../sql_reference/data_types/int_uint.md). - -**Döndürülen değer** - -Dize içeren tek dize `s` tekrarlanan `n` kez. Eğer `n` \< 1, işlev boş dize döndürür. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT repeat('abc', 10) -``` - -Sonuç: - -``` text -┌─repeat('abc', 10)──────────────┐ -│ abcabcabcabcabcabcabcabcabcabc │ -└────────────────────────────────┘ -``` - -## tersi {#reverse} - -Dizeyi tersine çevirir (bayt dizisi olarak). - -## reverseUTF8 {#reverseutf8} - -Dizenin UTF-8 metnini temsil eden bir bayt kümesi içerdiğini varsayarak bir Unicode kod noktası dizisini tersine çevirir. Aksi takdirde, başka bir şey yapar(bir istisna atmaz). - -## format(pattern, s0, s1, …) {#format} - -Bağımsız değişkenlerde listelenen dize ile sabit desen biçimlendirme. `pattern` basitleştirilmiş bir Python biçimi desenidir. Biçim dizesi içerir “replacement fields” kıvırcık parantez ile çevrili `{}`. Parantez içinde bulunmayan herhangi bir şey, çıktıya değişmeden kopyalanan hazır metin olarak kabul edilir. Literal metne bir ayraç karakteri eklemeniz gerekiyorsa, iki katına çıkararak kaçabilir: `{{ '{{' }}` ve `{{ '}}' }}`. Alan adları sayılar (sıfırdan başlayarak) veya boş olabilir (daha sonra sonuç numaraları olarak kabul edilir). - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') -``` - -``` text -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ -``` - -``` sql -SELECT format('{} {}', 'Hello', 'World') -``` - -``` text -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## concat {#concat} - -Bağımsız değişkenlerde listelenen dizeleri ayırıcı olmadan birleştirir. - -**Sözdizimi** - -``` sql -concat(s1, s2, ...) -``` - -**Parametre** - -String veya FixedString türünün değerleri. - -**Döndürülen değerler** - -Bağımsız değişkenlerin birleştirilmesinden kaynaklanan dizeyi döndürür. - -Argüman değerlerinden herhangi biri ise `NULL`, `concat` dönüşler `NULL`. - -**Örnek** - -Sorgu: - -``` sql -SELECT concat('Hello, ', 'World!') -``` - -Sonuç: - -``` text -┌─concat('Hello, ', 'World!')─┐ -│ Hello, World! │ -└─────────────────────────────┘ -``` - -## concatassumeınjective {#concatassumeinjective} - -Aynı olarak [concat](#concat) emin olun bu ihtiyaç fark var `concat(s1, s2, ...) → sn` enjekte edilir, grup tarafından optimizasyonu için kullanılacaktır. - -İşlev adlı “injective” bağımsız değişkenlerin farklı değerleri için her zaman farklı sonuç döndürürse. Başka bir deyişle: farklı argümanlar asla aynı sonucu vermez. - -**Sözdizimi** - -``` sql -concatAssumeInjective(s1, s2, ...) -``` - -**Parametre** - -String veya FixedString türünün değerleri. - -**Döndürülen değerler** - -Bağımsız değişkenlerin birleştirilmesinden kaynaklanan dizeyi döndürür. - -Argüman değerlerinden herhangi biri ise `NULL`, `concatAssumeInjective` dönüşler `NULL`. - -**Örnek** - -Giriş tablosu: - -``` sql -CREATE TABLE key_val(`key1` String, `key2` String, `value` UInt32) ENGINE = TinyLog; -INSERT INTO key_val VALUES ('Hello, ','World',1), ('Hello, ','World',2), ('Hello, ','World!',3), ('Hello',', World!',2); -SELECT * from key_val; -``` - -``` text -┌─key1────┬─key2─────┬─value─┐ -│ Hello, │ World │ 1 │ -│ Hello, │ World │ 2 │ -│ Hello, │ World! │ 3 │ -│ Hello │ , World! │ 2 │ -└─────────┴──────────┴───────┘ -``` - -Sorgu: - -``` sql -SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2) -``` - -Sonuç: - -``` text -┌─concat(key1, key2)─┬─sum(value)─┐ -│ Hello, World! │ 3 │ -│ Hello, World! │ 2 │ -│ Hello, World │ 3 │ -└────────────────────┴────────────┘ -``` - -## alt dize (s, ofset, uzunluk), orta (s, ofset, uzunluk), substr (s, ofset, uzunluk) {#substring} - -Bayttan başlayarak bir alt dize döndürür ‘offset’ ind thatex yani ‘length’ uzun bayt. Karakter indeksleme birinden başlar (standart SQL'DE olduğu gibi). Bu ‘offset’ ve ‘length’ bağımsız değişkenler sabit olmalıdır. - -## substringUTF8(s, ofset, uzunluk) {#substringutf8} - -Olarak aynı ‘substring’, ancak Unicode kod noktaları için. Dizenin UTF-8 kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa, bir sonuç döndürür (bir istisna atmaz). - -## appendTrailingCharİfAbsent (s, c) {#appendtrailingcharifabsent} - -Eğer... ‘s’ dize boş değildir ve ‘c’ sonunda karakter, ekler ‘c’ sonuna kadar karakter. - -## convertCharset (s, from, to) {#convertcharset} - -Dize döndürür ‘s’ bu kodlamadan dönüştürüldü ‘from’ kod encodinglamaya ‘to’. - -## base64Encode (s) {#base64encode} - -Kodluyor ‘s’ Base64 içine dize - -## base64Decode (s) {#base64decode} - -Base64 kodlu dizeyi çözme ‘s’ orijinal dizeye. Başarısızlık durumunda bir istisna yükseltir. - -## tryBase64Decode (s) {#trybase64decode} - -Base64decode'a benzer, ancak hata durumunda boş bir dize döndürülür. - -## endsWith (s, sonek) {#endswith} - -Belirtilen sonek ile bitip bitmeyeceğini döndürür. Dize belirtilen sonek ile biterse 1 değerini döndürür, aksi takdirde 0 değerini döndürür. - -## startsWith (str, önek) {#startswith} - -Dize belirtilen önek ile başlayıp başlamadığını 1 döndürür, aksi halde 0 döndürür. - -``` sql -SELECT startsWith('Spider-Man', 'Spi'); -``` - -**Döndürülen değerler** - -- 1, dize belirtilen önek ile başlarsa. -- 0, dize belirtilen önek ile başlamazsa. - -**Örnek** - -Sorgu: - -``` sql -SELECT startsWith('Hello, world!', 'He'); -``` - -Sonuç: - -``` text -┌─startsWith('Hello, world!', 'He')─┐ -│ 1 │ -└───────────────────────────────────┘ -``` - -## kırpmak {#trim} - -Belirtilen tüm karakterleri bir dizenin başlangıcından veya sonundan kaldırır. -Varsayılan olarak, bir dizenin her iki ucundan ortak boşlukların (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. - -**Sözdizimi** - -``` sql -trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string) -``` - -**Parametre** - -- `trim_character` — specified characters for trim. [Dize](../../sql_reference/data_types/string.md). -- `input_string` — string for trim. [Dize](../../sql_reference/data_types/string.md). - -**Döndürülen değer** - -Önde gelen ve (veya) belirtilen karakterleri izleyen bir dize. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT trim(BOTH ' ()' FROM '( Hello, world! )') -``` - -Sonuç: - -``` text -┌─trim(BOTH ' ()' FROM '( Hello, world! )')─┐ -│ Hello, world! │ -└───────────────────────────────────────────────┘ -``` - -## trimLeft {#trimleft} - -Bir dizenin başlangıcından ortak boşluk (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. Diğer boşluk karakterlerini (sekme, boşluksuz boşluk, vb.) kaldırmaz.). - -**Sözdizimi** - -``` sql -trimLeft(input_string) -``` - -Takma ad: `ltrim(input_string)`. - -**Parametre** - -- `input_string` — string to trim. [Dize](../../sql_reference/data_types/string.md). - -**Döndürülen değer** - -Bir dize olmadan lider ortak whitespaces. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT trimLeft(' Hello, world! ') -``` - -Sonuç: - -``` text -┌─trimLeft(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## trimRight {#trimright} - -Bir dizenin sonundan ortak boşluk (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. Diğer boşluk karakterlerini (sekme, boşluksuz boşluk, vb.) kaldırmaz.). - -**Sözdizimi** - -``` sql -trimRight(input_string) -``` - -Takma ad: `rtrim(input_string)`. - -**Parametre** - -- `input_string` — string to trim. [Dize](../../sql_reference/data_types/string.md). - -**Döndürülen değer** - -Ortak whitespaces firar olmadan bir dize. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT trimRight(' Hello, world! ') -``` - -Sonuç: - -``` text -┌─trimRight(' Hello, world! ')─┐ -│ Hello, world! │ -└──────────────────────────────────────┘ -``` - -## trimBoth {#trimboth} - -Bir dizenin her iki ucundan ortak boşluk (ASCII karakteri 32) tüm ardışık tekrarlarını kaldırır. Diğer boşluk karakterlerini (sekme, boşluksuz boşluk, vb.) kaldırmaz.). - -**Sözdizimi** - -``` sql -trimBoth(input_string) -``` - -Takma ad: `trim(input_string)`. - -**Parametre** - -- `input_string` — string to trim. [Dize](../../sql_reference/data_types/string.md). - -**Döndürülen değer** - -Bir dize olmadan lider ve sondaki ortak whitespaces. - -Tür: `String`. - -**Örnek** - -Sorgu: - -``` sql -SELECT trimBoth(' Hello, world! ') -``` - -Sonuç: - -``` text -┌─trimBoth(' Hello, world! ')─┐ -│ Hello, world! │ -└─────────────────────────────────────┘ -``` - -## CRC32 (s) {#crc32} - -CRC-32-IEEE 802.3 polinom ve başlangıç değerini kullanarak bir dizenin CRC32 sağlama toplamını döndürür `0xffffffff` (zlib uygulaması). - -Sonuç türü Uint32'dir. - -## Crc32ieee (s) {#crc32ieee} - -CRC-32-IEEE 802.3 polinomunu kullanarak bir dizenin CRC32 sağlama toplamını döndürür. - -Sonuç türü Uint32'dir. - -## CRC64 (s) {#crc64} - -CRC-64-ECMA polinomunu kullanarak bir dizenin CRC64 sağlama toplamını döndürür. - -Sonuç türü Uint64'tür. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/tr/sql_reference/functions/string_replace_functions.md b/docs/tr/sql_reference/functions/string_replace_functions.md deleted file mode 100644 index 6a6c0e56aec..00000000000 --- a/docs/tr/sql_reference/functions/string_replace_functions.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 42 -toc_title: "Dizelerde de\u011Fi\u015Ftirilmesi i\xE7in" ---- - -# Dizelerde arama ve değiştirme işlevleri {#functions-for-searching-and-replacing-in-strings} - -## replaceOne(Samanlık, desen, değiştirme) {#replaceonehaystack-pattern-replacement} - -Varsa, ilk oluş replacesumun yerini ‘pattern’ substring içinde ‘haystack’ ile... ‘replacement’ dize. -Ahiret, ‘pattern’ ve ‘replacement’ sabitleri olması gerekir. - -## replaceAll (Samanlık, desen, değiştirme), değiştirin (Samanlık, desen, değiştirme) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} - -Tüm oluşumları değiştirir ‘pattern’ substring içinde ‘haystack’ ile... ‘replacement’ dize. - -## replaceRegexpOne(Samanlık, desen, değiştirme) {#replaceregexponehaystack-pattern-replacement} - -Kullanarak değiştirme ‘pattern’ düzenli ifade. Re2 düzenli ifade. -Varsa, yalnızca ilk oluşumu değiştirir. -Bir desen olarak belirtilebilir ‘replacement’. Bu desen değiştirmeleri içerebilir `\0-\9`. -İkame `\0` tüm düzenli ifadeyi içerir. İkameler `\1-\9` alt desene karşılık gelir numbers.To use the `\` bir şablondaki karakter, kullanarak kaçış `\`. -Ayrıca, bir dize literalinin ekstra bir kaçış gerektirdiğini unutmayın. - -Örnek 1. Tarihi Amerikan format convertingına dönüştürme: - -``` sql -SELECT DISTINCT - EventDate, - replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res -FROM test.hits -LIMIT 7 -FORMAT TabSeparated -``` - -``` text -2014-03-17 03/17/2014 -2014-03-18 03/18/2014 -2014-03-19 03/19/2014 -2014-03-20 03/20/2014 -2014-03-21 03/21/2014 -2014-03-22 03/22/2014 -2014-03-23 03/23/2014 -``` - -Örnek 2. Bir dize on kez kopyalama: - -``` sql -SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res -``` - -``` text -┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ -└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -## replaceRegexpAll(Samanlık, desen, değiştirme) {#replaceregexpallhaystack-pattern-replacement} - -Bu aynı şeyi yapar, ancak tüm oluşumların yerini alır. Örnek: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res -``` - -``` text -┌─res────────────────────────┐ -│ HHeelllloo,, WWoorrlldd!! │ -└────────────────────────────┘ -``` - -Normal bir ifade boş bir alt dize üzerinde çalıştıysa, bir istisna olarak, değiştirme birden çok kez yapılmaz. -Örnek: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res -``` - -``` text -┌─res─────────────────┐ -│ here: Hello, World! │ -└─────────────────────┘ -``` - -## regexpQuoteMeta (s) {#regexpquotemetas} - -İşlev, dizedeki bazı önceden tanımlanmış karakterlerden önce bir ters eğik çizgi ekler. -Önceden tanımlanmış karakterler: ‘0’, ‘\\’, ‘\|’, ‘(’, ‘)’, ‘^’, ‘$’, ‘.’, ‘\[’, '\]', ‘?’, '\*‘,’+‘,’{‘,’:‘,’-'. -Bu uygulama biraz re2::RE2::QuoteMeta farklıdır. Sıfır bayttan 00 yerine \\0 olarak çıkar ve yalnızca gerekli karakterlerden kaçar. -Daha fazla bilgi için bağlantıya bakın: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473) - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/tr/sql_reference/functions/string_search_functions.md b/docs/tr/sql_reference/functions/string_search_functions.md deleted file mode 100644 index bfa3d8d0bd7..00000000000 --- a/docs/tr/sql_reference/functions/string_search_functions.md +++ /dev/null @@ -1,379 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 41 -toc_title: "Arama Dizeleri \u0130\xE7in" ---- - -# Dizeleri aramak için işlevler {#functions-for-searching-strings} - -Arama, tüm bu işlevlerde varsayılan olarak büyük / küçük harf duyarlıdır. Büyük / küçük harf duyarlı arama için ayrı Varyantlar vardır. - -## pozisyon (Samanlık, iğne), bulun (Samanlık, iğne) {#position} - -1'den başlayarak dizedeki bulunan alt dizenin konumunu (bayt cinsinden) döndürür. - -Dize, tek baytlık kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa ve bir karakter tek bir bayt kullanılarak temsil edilemezse, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki bayt kullanılarak temsil edilebilirse, iki bayt vb. kullanır. - -Büyük / küçük harf duyarsız arama için işlevi kullanın [positionCaseİnsensitive](#positioncaseinsensitive). - -**Sözdizimi** - -``` sql -position(haystack, needle) -``` - -Takma ad: `locate(haystack, needle)`. - -**Parametre** - -- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). - -**Döndürülen değerler** - -- Alt dize bulunursa, bayt cinsinden başlangıç pozisyonu (1'den sayma). -- 0, alt dize bulunamadı. - -Tür: `Integer`. - -**Örnekler** - -İfade “Hello, world!” tek baytla kodlanmış bir metni temsil eden bir bayt kümesi içerir. İşlev beklenen bazı sonuçları döndürür: - -Sorgu: - -``` sql -SELECT position('Hello, world!', '!') -``` - -Sonuç: - -``` text -┌─position('Hello, world!', '!')─┐ -│ 13 │ -└────────────────────────────────┘ -``` - -Rusça'daki aynı ifade, tek bir bayt kullanılarak temsil edilemeyen karakterler içerir. İşlev beklenmedik bir sonuç verir (kullanım [positionUTF8](#positionutf8) çok bayt kodlu metin için işlev): - -Sorgu: - -``` sql -SELECT position('Привет, мир!', '!') -``` - -Sonuç: - -``` text -┌─position('Привет, мир!', '!')─┐ -│ 21 │ -└───────────────────────────────┘ -``` - -## positionCaseİnsensitive {#positioncaseinsensitive} - -Olarak aynı [konum](#position) 1'den başlayarak dizedeki bulunan alt dizenin konumunu (bayt cinsinden) döndürür. Büyük / küçük harf duyarlı bir arama için işlevi kullanın. - -Dize, tek baytlık kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa ve bir karakter tek bir bayt kullanılarak temsil edilemezse, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki bayt kullanılarak temsil edilebilirse, iki bayt vb. kullanır. - -**Sözdizimi** - -``` sql -positionCaseInsensitive(haystack, needle) -``` - -**Parametre** - -- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). - -**Döndürülen değerler** - -- Alt dize bulunursa, bayt cinsinden başlangıç pozisyonu (1'den sayma). -- 0, alt dize bulunamadı. - -Tür: `Integer`. - -**Örnek** - -Sorgu: - -``` sql -SELECT positionCaseInsensitive('Hello, world!', 'hello') -``` - -Sonuç: - -``` text -┌─positionCaseInsensitive('Hello, world!', 'hello')─┐ -│ 1 │ -└───────────────────────────────────────────────────┘ -``` - -## positionUTF8 {#positionutf8} - -1'den başlayarak dizedeki bulunan alt dizenin konumunu (Unicode noktalarında) döndürür. - -Dizenin UTF-8 kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki Unicode noktası kullanılarak temsil edilebilirse, iki vb. kullanır. - -Büyük / küçük harf duyarsız arama için işlevi kullanın [positionCaseİnsensitiveUTF8](#positioncaseinsensitiveutf8). - -**Sözdizimi** - -``` sql -positionUTF8(haystack, needle) -``` - -**Parametre** - -- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). - -**Döndürülen değerler** - -- Unicode noktalarında başlangıç pozisyonu (1'den sayma), eğer alt dize bulundu. -- 0, alt dize bulunamadı. - -Tür: `Integer`. - -**Örnekler** - -İfade “Hello, world!” rusça'da, tek noktalı kodlanmış bir metni temsil eden bir dizi Unicode noktası bulunur. İşlev beklenen bazı sonuçları döndürür: - -Sorgu: - -``` sql -SELECT positionUTF8('Привет, мир!', '!') -``` - -Sonuç: - -``` text -┌─positionUTF8('Привет, мир!', '!')─┐ -│ 12 │ -└───────────────────────────────────┘ -``` - -İfade “Salut, étudiante!” karakter nerede `é` bir nokta kullanılarak temsil edilebilir (`U+00E9`) veya iki puan (`U+0065U+0301`) fonksiyon bazı beklenmedik sonuç iade edilebilir: - -Mektup için sorgu `é` bir Unicode noktasını temsil eden `U+00E9`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Sonuç: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 17 │ -└────────────────────────────────────────┘ -``` - -Mektup için sorgu `é`, iki Unicode noktası temsil edilen `U+0065U+0301`: - -``` sql -SELECT positionUTF8('Salut, étudiante!', '!') -``` - -Sonuç: - -``` text -┌─positionUTF8('Salut, étudiante!', '!')─┐ -│ 18 │ -└────────────────────────────────────────┘ -``` - -## positionCaseİnsensitiveUTF8 {#positioncaseinsensitiveutf8} - -Olarak aynı [positionUTF8](#positionutf8) ama büyük küçük harf duyarlı. 1'den başlayarak dizedeki bulunan alt dizenin konumunu (Unicode noktalarında) döndürür. - -Dizenin UTF-8 kodlanmış bir metni temsil eden bir bayt kümesi içerdiği varsayımı altında çalışır. Bu varsayım karşılanmazsa, işlev bir istisna atmaz ve beklenmeyen bir sonuç döndürür. Karakter iki Unicode noktası kullanılarak temsil edilebilirse, iki vb. kullanır. - -**Sözdizimi** - -``` sql -positionCaseInsensitiveUTF8(haystack, needle) -``` - -**Parametre** - -- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). - -**Döndürülen değer** - -- Unicode noktalarında başlangıç pozisyonu (1'den sayma), eğer alt dize bulundu. -- 0, alt dize bulunamadı. - -Tür: `Integer`. - -**Örnek** - -Sorgu: - -``` sql -SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир') -``` - -Sonuç: - -``` text -┌─positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')─┐ -│ 9 │ -└────────────────────────────────────────────────────┘ -``` - -## multiSearchAllPositions {#multisearchallpositions} - -Olarak aynı [konum](string_search_functions.md#position) ama döner `Array` dizede bulunan karşılık gelen alt dizelerin konumlarının (bayt cinsinden). Pozisyonlar 1'den başlayarak endekslenir. - -Arama, dize kodlaması ve harmanlama ile ilgili olmayan bayt dizileri üzerinde gerçekleştirilir. - -- Büyük / küçük harf duyarlı ASCII arama için işlevi kullanın `multiSearchAllPositionsCaseInsensitive`. -- UTF-8'de arama yapmak için işlevi kullanın [multiSearchAllPositionsUTF8](#multiSearchAllPositionsUTF8). -- Büyük / küçük harf duyarlı UTF-8 arama için multisearchallpositionscaseınsensitiveutf8 işlevini kullanın. - -**Sözdizimi** - -``` sql -multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen]) -``` - -**Parametre** - -- `haystack` — string, in which substring will to be searched. [Dize](../syntax.md#syntax-string-literal). -- `needle` — substring to be searched. [Dize](../syntax.md#syntax-string-literal). - -**Döndürülen değerler** - -- Bayt cinsinden başlangıç pozisyonları dizisi (1'den sayma), karşılık gelen alt dize bulunursa ve 0 bulunmazsa. - -**Örnek** - -Sorgu: - -``` sql -SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']) -``` - -Sonuç: - -``` text -┌─multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])─┐ -│ [0,13,0] │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## multiSearchAllPositionsUTF8 {#multiSearchAllPositionsUTF8} - -Görmek `multiSearchAllPositions`. - -## multiSearchFirstPosition (Samanlık, \[iğne1, iğne2, …, needleve\]) {#multisearchfirstposition} - -Olarak aynı `position` ancak dizenin en soldaki ofsetini döndürür `haystack` bu bazı iğnelerle eşleşti. - -Büyük/küçük harfe duyarsız arama veya / VE UTF-8 biçiminde kullanım işlevleri için `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`. - -## multiSearchFirstİndex (Samanlık, \[iğne1, iğne2, …, needleve\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} - -Dizini döndürür `i` en soldaki bulunan iğnenin (1'den başlayarak)ben diz inede `haystack` ve 0 aksi takdirde. - -Büyük/küçük harfe duyarsız arama veya / VE UTF-8 biçiminde kullanım işlevleri için `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`. - -## multiSearchAny (Samanlık, \[iğne1, iğne2, …, needleve\]) {#function-multisearchany} - -Döner 1, Eğer en az bir dize iğneben dize ile eşleşir `haystack` ve 0 aksi takdirde. - -Büyük/küçük harfe duyarsız arama veya / VE UTF-8 biçiminde kullanım işlevleri için `multiSearchAnyCaseInsensitive, multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8`. - -!!! note "Not" - Tamamı `multiSearch*` fonksiyonlar iğne sayısı 2'den az olmalıdır8 uygulama şartname nedeniyle. - -## maç (Samanlık, desen) {#matchhaystack-pattern} - -Dize eşleşip eşleşmediğini denetler `pattern` düzenli ifade. Bir `re2` düzenli ifade. Bu [sözdizimi](https://github.com/google/re2/wiki/Syntax) of the `re2` düzenli ifadeler, Perl düzenli ifadelerin sözdiziminden daha sınırlıdır. - -Eşleşmezse 0 veya eşleşirse 1 değerini döndürür. - -Ters eğik çizgi sembolünün (`\`) normal ifadede kaçmak için kullanılır. Aynı sembol, dize değişmezlerinde kaçmak için kullanılır. Bu nedenle, normal bir ifadede sembolden kaçmak için, bir dize literalinde iki ters eğik çizgi (\\) yazmanız gerekir. - -Normal ifade, bir bayt kümesiymiş gibi dizeyle çalışır. Normal ifade boş bayt içeremez. -Bir dizedeki alt dizeleri aramak için desenler için, LİKE veya ‘position’, çok daha hızlı çalıştıkları için. - -## multiMatchAny (Samanlık, \[desen1, desen2, …, patternve\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} - -Olarak aynı `match`, ancak normal ifadelerin hiçbiri eşleşmezse 0 ve desenlerden herhangi biri eşleşirse 1 değerini döndürür. Kullanır [hyperscan](https://github.com/intel/hyperscan) kitaplık. Bir dizede alt dizeleri aramak için desenler için, kullanmak daha iyidir `multiSearchAny` çok daha hızlı çalıştığı için. - -!!! note "Not" - Herhangi birinin uzunluğu `haystack` dize 2'den az olmalıdır32 bayt aksi takdirde özel durum atılır. Bu kısıtlama, hyperscan API nedeniyle gerçekleşir. - -## multimatchanyındex (haystack, \[desen1, desen2, …, patternve\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} - -Olarak aynı `multiMatchAny`, ancak Samanlık eşleşen herhangi bir dizin döndürür. - -## multiMatchAllİndices (haystack, \[desen1, desen2, …, patternve\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn} - -Olarak aynı `multiMatchAny`, ancak herhangi bir sırada Samanlık eşleşen tüm indicies dizisini döndürür. - -## multiFuzzyMatchAny (Samanlık, mesafe, \[desen1, desen2, …, patternve\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} - -Olarak aynı `multiMatchAny`, ancak herhangi bir desen samanlıkta bir sabitle eşleşirse 1 döndürür [mesafeyi Düzenle](https://en.wikipedia.org/wiki/Edit_distance). Bu fonksiyon aynı zamanda deneysel bir moddadır ve son derece yavaş olabilir. Daha fazla bilgi için bkz. [hyperscan belgeleri](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching). - -## multifuzzymatchanyındex (Samanlık, mesafe, \[desen1, desen2, …, patternve\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} - -Olarak aynı `multiFuzzyMatchAny`, ancak sabit bir düzenleme mesafesi içinde Samanlık eşleşen herhangi bir dizin döndürür. - -## multiFuzzyMatchAllİndices (Samanlık, mesafe, \[desen1, desen2, …, patternve\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn} - -Olarak aynı `multiFuzzyMatchAny`, ancak sabit bir düzenleme mesafesi içinde saman yığını ile eşleşen herhangi bir sırada tüm dizinlerin dizisini döndürür. - -!!! note "Not" - `multiFuzzyMatch*` işlevler UTF-8 normal ifadeleri desteklemez ve bu tür ifadeler hyperscan kısıtlaması nedeniyle bayt olarak kabul edilir. - -!!! note "Not" - Hyperscan kullanan tüm işlevleri kapatmak için, ayarı kullanın `SET allow_hyperscan = 0;`. - -## özü (Samanlık, desen) {#extracthaystack-pattern} - -Normal ifade kullanarak bir dize parçasını ayıklar. Eğer ‘haystack’ eşleşmiyor ‘pattern’ regex, boş bir dize döndürülür. Regex alt desenler içermiyorsa, tüm regex ile eşleşen parçayı alır. Aksi takdirde, ilk alt desenle eşleşen parçayı alır. - -## extractAll(Samanlık, desen) {#extractallhaystack-pattern} - -Normal bir ifade kullanarak bir dizenin tüm parçalarını ayıklar. Eğer ‘haystack’ eşleşmiyor ‘pattern’ regex, boş bir dize döndürülür. Regex için tüm eşleşmelerden oluşan bir dizi dizeyi döndürür. Genel olarak, davranış ile aynıdır ‘extract’ işlev (bir alt desen yoksa ilk alt deseni veya tüm ifadeyi alır). - -## gibi (Samanlık, desen), Samanlık gibi desen operatörü {#function-like} - -Bir dizenin basit bir normal ifadeyle eşleşip eşleşmediğini denetler. -Normal ifade metasymbols içerebilir `%` ve `_`. - -`%` herhangi bir bayt miktarını (sıfır karakter dahil) gösterir. - -`_` herhangi bir bayt gösterir. - -Ters eğik çizgi kullanın (`\`) metasimbollerden kaçmak için. Açıklamasında kaçan nota bakın ‘match’ işlev. - -Gibi düzenli ifadeler için `%needle%`, kod daha optimal ve hızlı olarak çalışır `position` işlev. -Diğer normal ifadeler için kod, ‘match’ işlev. - -## notLike (Samanlık, desen), Samanlık desen operatörü gibi değil {#function-notlike} - -Aynı şey ‘like’ ama negatif. - -## ngramDistance(Samanlık, iğne) {#ngramdistancehaystack-needle} - -Arasındaki 4 gram distancelık mesaf theeyi hesaplar `haystack` ve `needle`: counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns float number from 0 to 1 – the closer to zero, the more strings are similar to each other. If the constant `needle` veya `haystack` 32kb'den fazla, bir istisna atar. Sabit olmayan bazı `haystack` veya `needle` dizeler 32kb'den daha fazladır, mesafe her zaman birdir. - -Büyük/küçük harf duyarsız arama veya / VE UTF-8 formatında kullanım işlevleri için `ngramDistanceCaseInsensitive, ngramDistanceUTF8, ngramDistanceCaseInsensitiveUTF8`. - -## ngramsearch(Samanlık, iğne) {#ngramsearchhaystack-needle} - -Aynı olarak `ngramDistance` ama arasındaki simetrik olmayan farkı hesaplar `needle` ve `haystack` – the number of n-grams from needle minus the common number of n-grams normalized by the number of `needle` n-büyükanne. Daha yakın, daha `needle` is in the `haystack`. Bulanık dize arama için yararlı olabilir. - -Büyük/küçük harf duyarsız arama veya / VE UTF-8 formatında kullanım işlevleri için `ngramSearchCaseInsensitive, ngramSearchUTF8, ngramSearchCaseInsensitiveUTF8`. - -!!! note "Not" - For UTF-8 case we use 3-gram distance. All these are not perfectly fair n-gram distances. We use 2-byte hashes to hash n-grams and then calculate the (non-)symmetric difference between these hash tables – collisions may occur. With UTF-8 case-insensitive format we do not use fair `tolower` function – we zero the 5-th bit (starting from zero) of each codepoint byte and first bit of zeroth byte if bytes more than one – this works for Latin and mostly for all Cyrillic letters. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/tr/sql_reference/functions/type_conversion_functions.md b/docs/tr/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index 643ddf9dbc0..00000000000 --- a/docs/tr/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,534 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 38 -toc_title: "Tip D\xF6n\xFC\u015Ft\xFCrme" ---- - -# Tip Dönüştürme Fonksiyonları {#type-conversion-functions} - -## Sayısal dönüşümlerin ortak sorunları {#numeric-conversion-issues} - -Bir değeri birinden başka bir veri türüne dönüştürdüğünüzde, ortak durumda, veri kaybına neden olabilecek güvenli olmayan bir işlem olduğunu unutmamalısınız. Değeri daha büyük bir veri türünden daha küçük bir veri türüne sığdırmaya çalışırsanız veya değerleri farklı veri türleri arasında dönüştürürseniz, veri kaybı oluşabilir. - -ClickHouse vardır [C++ programları ile aynı davranış](https://en.cppreference.com/w/cpp/language/implicit_conversion). - -## toİnt(8/16/32/64) {#toint8163264} - -Bir giriş değeri dönüştürür [Tamsayı](../../sql_reference/data_types/int_uint.md) veri türü. Bu işlev ailesi şunları içerir: - -- `toInt8(expr)` — Results in the `Int8` veri türü. -- `toInt16(expr)` — Results in the `Int16` veri türü. -- `toInt32(expr)` — Results in the `Int32` veri türü. -- `toInt64(expr)` — Results in the `Int64` veri türü. - -**Parametre** - -- `expr` — [İfade](../syntax.md#syntax-expressions) bir sayının ondalık gösterimiyle bir sayı veya dize döndürülmesi. Sayıların ikili, sekizli ve onaltılık gösterimleri desteklenmez. Önde gelen sıfırlar soyulur. - -**Döndürülen değer** - -Tamsayı değeri `Int8`, `Int16`, `Int32`, veya `Int64` veri türü. - -Fonksiyonlar kullanımı [sıfıra doğru yuvarlama](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), yani sayıların kesirli rakamlarını keserler. - -Fonksiyon behaviorların davranışı [N andan ve In andf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) argümanlar tanımsızdır. Hakkında hatırla [sayısal convertions sorunları](#numeric-conversion-issues), fonksiyonları kullanırken. - -**Örnek** - -``` sql -SELECT toInt64(nan), toInt32(32), toInt16('16'), toInt8(8.8) -``` - -``` text -┌─────────toInt64(nan)─┬─toInt32(32)─┬─toInt16('16')─┬─toInt8(8.8)─┐ -│ -9223372036854775808 │ 32 │ 16 │ 8 │ -└──────────────────────┴─────────────┴───────────────┴─────────────┘ -``` - -## toİnt (8/16/32/64)OrZero {#toint8163264orzero} - -String türünde bir argüman alır ve İnt içine ayrıştırmaya çalışır(8 \| 16 \| 32 \| 64). Başarısız olursa, 0 döndürür. - -**Örnek** - -``` sql -select toInt64OrZero('123123'), toInt8OrZero('123qwe123') -``` - -``` text -┌─toInt64OrZero('123123')─┬─toInt8OrZero('123qwe123')─┐ -│ 123123 │ 0 │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toİnt(8/16/32/64) OrNull {#toint8163264ornull} - -String türünde bir argüman alır ve İnt içine ayrıştırmaya çalışır(8 \| 16 \| 32 \| 64). Başarısız olursa, NULL döndürür. - -**Örnek** - -``` sql -select toInt64OrNull('123123'), toInt8OrNull('123qwe123') -``` - -``` text -┌─toInt64OrNull('123123')─┬─toInt8OrNull('123qwe123')─┐ -│ 123123 │ ᴺᵁᴸᴸ │ -└─────────────────────────┴───────────────────────────┘ -``` - -## toUİnt(8/16/32/64) {#touint8163264} - -Bir giriş değeri dönüştürür [Uİnt](../../sql_reference/data_types/int_uint.md) veri türü. Bu işlev ailesi şunları içerir: - -- `toUInt8(expr)` — Results in the `UInt8` veri türü. -- `toUInt16(expr)` — Results in the `UInt16` veri türü. -- `toUInt32(expr)` — Results in the `UInt32` veri türü. -- `toUInt64(expr)` — Results in the `UInt64` veri türü. - -**Parametre** - -- `expr` — [İfade](../syntax.md#syntax-expressions) bir sayının ondalık gösterimiyle bir sayı veya dize döndürülmesi. Sayıların ikili, sekizli ve onaltılık gösterimleri desteklenmez. Önde gelen sıfırlar soyulur. - -**Döndürülen değer** - -Tamsayı değeri `UInt8`, `UInt16`, `UInt32`, veya `UInt64` veri türü. - -Fonksiyonlar kullanımı [sıfıra doğru yuvarlama](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), yani sayıların kesirli rakamlarını keserler. - -Olumsuz agruments için işlevlerin davranışı ve [N andan ve In andf](../../sql_reference/data_types/float.md#data_type-float-nan-inf) argümanlar tanımsızdır. Örneğin, negatif bir sayı ile bir dize geçirirseniz `'-32'`, ClickHouse bir özel durum yükseltir. Hakkında hatırla [sayısal convertions sorunları](#numeric-conversion-issues), fonksiyonları kullanırken. - -**Örnek** - -``` sql -SELECT toUInt64(nan), toUInt32(-32), toUInt16('16'), toUInt8(8.8) -``` - -``` text -┌───────toUInt64(nan)─┬─toUInt32(-32)─┬─toUInt16('16')─┬─toUInt8(8.8)─┐ -│ 9223372036854775808 │ 4294967264 │ 16 │ 8 │ -└─────────────────────┴───────────────┴────────────────┴──────────────┘ -``` - -## toUİnt (8/16/32/64)OrZero {#touint8163264orzero} - -## toUİnt(8/16/32/64) OrNull {#touint8163264ornull} - -## toFloat(32/64) {#tofloat3264} - -## toFloat (32/64)OrZero {#tofloat3264orzero} - -## toFloat(32/64) OrNull {#tofloat3264ornull} - -## toDate {#todate} - -## toDateOrZero {#todateorzero} - -## toDateOrNull {#todateornull} - -## toDateTime {#todatetime} - -## toDateTimeOrZero {#todatetimeorzero} - -## toDateTimeOrNull {#todatetimeornull} - -## toDecimal(32/64/128) {#todecimal3264128} - -Dönüşüyo `value` to the [Ondalık](../../sql_reference/data_types/decimal.md) hassas veri türü `S`. Bu `value` bir sayı veya bir dize olabilir. Bu `S` (scale) parametresi ondalık basamak sayısını belirtir. - -- `toDecimal32(value, S)` -- `toDecimal64(value, S)` -- `toDecimal128(value, S)` - -## toDecimal(32/64/128) OrNull {#todecimal3264128ornull} - -Bir giriş dizesini bir [Nullable (Ondalık (P, S))](../../sql_reference/data_types/decimal.md) veri türü değeri. Bu işlev ailesi şunları içerir: - -- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` veri türü. -- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` veri türü. -- `toDecimal128OrNull(expr, S)` — Results in `Nullable(Decimal128(S))` veri türü. - -Bu işlevler yerine kullanılmalıdır `toDecimal*()` fonksiyonlar, eğer bir almak için tercih `NULL` bir giriş değeri ayrıştırma hatası durumunda bir özel durum yerine değer. - -**Parametre** - -- `expr` — [İfade](../syntax.md#syntax-expressions) bir değeri döndürür [Dize](../../sql_reference/data_types/string.md) veri türü. ClickHouse ondalık sayının metinsel temsilini bekler. Mesela, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**Döndürülen değer** - -İçinde bir değer `Nullable(Decimal(P,S))` veri türü. Değeri içerir: - -- İle sayı `S` ondalık basamaklar, ClickHouse giriş dizesi bir sayı olarak yorumlar. -- `NULL`, ClickHouse giriş dizesini bir sayı olarak yorumlayamazsa veya giriş numarası birden fazla içeriyorsa `S` ondalık basamaklar. - -**Örnekler** - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 5))─┐ -│ -1.11100 │ Nullable(Decimal(9, 5)) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrNull(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrNull(toString(-1.111), 2))─┐ -│ ᴺᵁᴸᴸ │ Nullable(Decimal(9, 2)) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toDecimal (32/64/128)OrZero {#todecimal3264128orzero} - -Bir giriş değeri dönüştürür [Ondalık(P, S)](../../sql_reference/data_types/decimal.md) veri türü. Bu işlev ailesi şunları içerir: - -- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` veri türü. -- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` veri türü. -- `toDecimal128OrZero( expr, S)` — Results in `Decimal128(S)` veri türü. - -Bu işlevler yerine kullanılmalıdır `toDecimal*()` fonksiyonlar, eğer bir almak için tercih `0` bir giriş değeri ayrıştırma hatası durumunda bir özel durum yerine değer. - -**Parametre** - -- `expr` — [İfade](../syntax.md#syntax-expressions) bir değeri döndürür [Dize](../../sql_reference/data_types/string.md) veri türü. ClickHouse ondalık sayının metinsel temsilini bekler. Mesela, `'1.111'`. -- `S` — Scale, the number of decimal places in the resulting value. - -**Döndürülen değer** - -İçinde bir değer `Nullable(Decimal(P,S))` veri türü. Değeri içerir: - -- İle sayı `S` ondalık basamaklar, ClickHouse giriş dizesi bir sayı olarak yorumlar. -- 0 ile `S` ondalık basamaklar, ClickHouse giriş dizesini bir sayı olarak yorumlayamazsa veya giriş numarası birden fazla içeriyorsa `S` ondalık basamaklar. - -**Örnek** - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 5) AS val, toTypeName(val) -``` - -``` text -┌──────val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 5))─┐ -│ -1.11100 │ Decimal(9, 5) │ -└──────────┴────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT toDecimal32OrZero(toString(-1.111), 2) AS val, toTypeName(val) -``` - -``` text -┌──val─┬─toTypeName(toDecimal32OrZero(toString(-1.111), 2))─┐ -│ 0.00 │ Decimal(9, 2) │ -└──────┴────────────────────────────────────────────────────┘ -``` - -## toString {#tostring} - -Sayılar, dizeler (ancak sabit olmayan dizeler), tarihler ve tarihlerle saatler arasında dönüştürme işlevleri. -Tüm bu işlevler bir argümanı kabul eder. - -Bir dizeye veya dizeye dönüştürürken, değer, sekmeyle aynı kuralları kullanarak biçimlendirilir veya ayrıştırılır. ayrı biçim (ve hemen hemen tüm diğer metin biçimleri). Dize ayrıştırılamazsa, bir istisna atılır ve istek iptal edilir. - -Tarihleri sayılara dönüştürürken veya tam tersi, Tarih Unix döneminin başlangıcından bu yana geçen gün sayısına karşılık gelir. -Tarihleri zamanlarla sayılara dönüştürürken veya tam tersi olduğunda, zaman ile tarih, Unix döneminin başlangıcından bu yana geçen saniye sayısına karşılık gelir. - -ToDate / toDateTime işlevleri için tarih ve saatli tarih biçimleri aşağıdaki gibi tanımlanır: - -``` text -YYYY-MM-DD -YYYY-MM-DD hh:mm:ss -``` - -Özel durum olarak, uınt32, Int32, Uınt64 veya Int64 sayısal türlerinden bugüne dönüştürme ve sayı 65536'dan büyük veya eşitse, sayı Unıx zaman damgası (ve gün sayısı olarak değil) olarak yorumlanır ve tarihe yuvarlanır. Bu, yaygın yazı oluşumu için destek sağlar ‘toDate(unix\_timestamp)’, aksi takdirde bir hata olur ve daha hantal yazmayı gerektirir ‘toDate(toDateTime(unix\_timestamp))’. - -Bir tarih ve tarih ile saat arasında dönüştürme doğal bir şekilde gerçekleştirilir: boş bir zaman ekleyerek veya saati bırakarak. - -Sayısal türler arasındaki dönüştürme, C++ ' daki farklı sayısal türler arasındaki atamalarla aynı kuralları kullanır. - -Ayrıca, Tostring işlevi DateTime bağımsız değişkeni, saat dilimi adını içeren ikinci bir dize bağımsız değişkeni alabilir. Örnek: `Asia/Yekaterinburg` Bu durumda, saat belirtilen saat dilimine göre biçimlendirilir. - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - -``` text -┌───────────now_local─┬─now_yekat───────────┐ -│ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ -└─────────────────────┴─────────────────────┘ -``` - -Ayrıca bakınız `toUnixTimestamp` işlev. - -## toFixedString(s, N) {#tofixedstrings-n} - -Bir dize türü bağımsız değişkeni dönüştürür bir FixedString(N) türü (sabit uzunlukta bir dize N). N sabit olmalıdır. -Dize n'den daha az bayt varsa, sağa boş bayt ile geçirilir. Dize n'den daha fazla bayt varsa, bir özel durum atılır. - -## tostringcuttozero (s) {#tostringcuttozeros} - -Bir dize veya fixedstring bağımsız değişkeni kabul eder. Bulunan ilk sıfır baytta kesilmiş içeriği olan dizeyi döndürür. - -Örnek: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s─────────────┬─s_cut─┐ -│ foo\0\0\0\0\0 │ foo │ -└───────────────┴───────┘ -``` - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - -``` text -┌─s──────────┬─s_cut─┐ -│ foo\0bar\0 │ foo │ -└────────────┴───────┘ -``` - -## reinterpretAsUİnt(8/16/32/64) {#reinterpretasuint8163264} - -## reinterpretAsİnt(8/16/32/64) {#reinterpretasint8163264} - -## reinterpretAsFloat (32/64) {#reinterpretasfloat3264} - -## reinterpretAsDate {#reinterpretasdate} - -## reinterpretAsDateTime {#reinterpretasdatetime} - -Bu işlevler bir dizeyi kabul eder ve dizenin başına yerleştirilen baytları ana bilgisayar düzeninde (little endian) bir sayı olarak yorumlar. Dize yeterince uzun değilse, işlevler dize gerekli sayıda boş baytla doldurulmuş gibi çalışır. Dize gerekenden daha uzunsa, ek bayt yoksayılır. Bir tarih, Unix döneminin başlangıcından bu yana geçen gün sayısı olarak yorumlanır ve zamana sahip bir tarih, Unix döneminin başlangıcından bu yana geçen saniye sayısı olarak yorumlanır. - -## reinterpretAsString {#type_conversion_functions-reinterpretAsString} - -Bu işlev, bir sayı veya tarih veya tarih saat ile kabul eder ve ana bilgisayar düzeninde (little endian) karşılık gelen değeri temsil eden bayt içeren bir dize döndürür. Boş bayt sondan bırakılır. Örneğin, 255 uint32 türü değeri bir bayt uzunluğunda bir dizedir. - -## reinterpretAsFixedString {#reinterpretasfixedstring} - -Bu işlev, bir sayı veya tarih veya tarih saat ile kabul eder ve karşılık gelen değeri ana bilgisayar sırasına (little endian) temsil eden bayt içeren bir FixedString döndürür. Boş bayt sondan bırakılır. Örneğin, 255 uint32 türü değeri bir bayt uzunluğunda bir FixedString. - -## CAS (t(x, t) {#type_conversion_function-cast} - -Dönüşüyo ‘x’ to the ‘t’ veri türü. Sözdizimi CAST (x AS t) da desteklenmektedir. - -Örnek: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - -``` text -┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ -│ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ -└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ -``` - -Fixedstring(N) ' ye dönüştürme yalnızca String veya FixedString(N) türünde argümanlar için çalışır. - -Type con conversionvers conversionion to [Nullable](../../sql_reference/data_types/nullable.md) ve geri desteklenmektedir. Örnek: - -``` sql -SELECT toTypeName(x) FROM t_null -``` - -``` text -┌─toTypeName(x)─┐ -│ Int8 │ -│ Int8 │ -└───────────────┘ -``` - -``` sql -SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null -``` - -``` text -┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ -│ Nullable(UInt16) │ -│ Nullable(UInt16) │ -└─────────────────────────────────────────┘ -``` - -## toİnterval(yıl\|Çeyrek\|Ay\|hafta\|Gün\|Saat\|Dakika / Saniye) {#function-tointerval} - -Bir sayı türü argümanını bir [Aralıklı](../../sql_reference/data_types/special_data_types/interval.md) veri türü. - -**Sözdizimi** - -``` sql -toIntervalSecond(number) -toIntervalMinute(number) -toIntervalHour(number) -toIntervalDay(number) -toIntervalWeek(number) -toIntervalMonth(number) -toIntervalQuarter(number) -toIntervalYear(number) -``` - -**Parametre** - -- `number` — Duration of interval. Positive integer number. - -**Döndürülen değerler** - -- Değeri `Interval` veri türü. - -**Örnek** - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - -``` text -┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ -│ 2019-01-08 │ 2019-01-08 │ -└───────────────────────────┴──────────────────────────────┘ -``` - -## parseDateTimeBestEffort {#parsedatetimebesteffort} - -Bir tarih ve saati dönüştürür [Dize](../../sql_reference/data_types/string.md) temsil etmek [DateTime](../../sql_reference/data_types/datetime.md#data_type-datetime) veri türü. - -İşlev ayrıştırır [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC 1123-5.2.14 RFC-822 Tarih ve Saat özellikleri](https://tools.ietf.org/html/rfc1123#page-55), ClickHouse ve diğer bazı tarih ve saat biçimleri. - -**Sözdizimi** - -``` sql -parseDateTimeBestEffort(time_string [, time_zone]); -``` - -**Parametre** - -- `time_string` — String containing a date and time to convert. [Dize](../../sql_reference/data_types/string.md). -- `time_zone` — Time zone. The function parses `time_string` saat dilimine göre. [Dize](../../sql_reference/data_types/string.md). - -**Desteklenen standart dışı formatlar** - -- 9 içeren bir dize..10 haneli [unix zaman damgası](https://en.wikipedia.org/wiki/Unix_time). -- Tarih ve saat bileşeni olan bir dize: `YYYYMMDDhhmmss`, `DD/MM/YYYY hh:mm:ss`, `DD-MM-YY hh:mm`, `YYYY-MM-DD hh:mm:ss` vb. -- Bir tarih, ancak hiçbir zaman bileşeni ile bir dize: `YYYY`, `YYYYMM`, `YYYY*MM`, `DD/MM/YYYY`, `DD-MM-YY` vb. -- Bir gün ve Saat ile bir dize: `DD`, `DD hh`, `DD hh:mm`. Bu durumda `YYYY-MM` olarak ikame edilir `2000-01`. -- Tarih ve Saat Saat Dilimi uzaklık bilgileri ile birlikte içeren bir dize: `YYYY-MM-DD hh:mm:ss ±h:mm` vb. Mesela, `2020-12-12 17:36:00 -5:00`. - -Ayırıcılı tüm formatlar için işlev, tam adlarıyla veya bir ay adının ilk üç harfiyle ifade edilen ay adlarını ayrıştırır. Örnekler: `24/DEC/18`, `24-Dec-18`, `01-September-2018`. - -**Döndürülen değer** - -- `time_string` dönüştürül thedü `DateTime` veri türü. - -**Örnekler** - -Sorgu: - -``` sql -SELECT parseDateTimeBestEffort('12/12/2020 12:12:57') -AS parseDateTimeBestEffort; -``` - -Sonuç: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2020-12-12 12:12:57 │ -└─────────────────────────┘ -``` - -Sorgu: - -``` sql -SELECT parseDateTimeBestEffort('Sat, 18 Aug 2018 07:22:16 GMT', 'Europe/Moscow') -AS parseDateTimeBestEffort -``` - -Sonuç: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-08-18 10:22:16 │ -└─────────────────────────┘ -``` - -Sorgu: - -``` sql -SELECT parseDateTimeBestEffort('1284101485') -AS parseDateTimeBestEffort -``` - -Sonuç: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2015-07-07 12:04:41 │ -└─────────────────────────┘ -``` - -Sorgu: - -``` sql -SELECT parseDateTimeBestEffort('2018-12-12 10:12:12') -AS parseDateTimeBestEffort -``` - -Sonuç: - -``` text -┌─parseDateTimeBestEffort─┐ -│ 2018-12-12 10:12:12 │ -└─────────────────────────┘ -``` - -Sorgu: - -``` sql -SELECT parseDateTimeBestEffort('10 20:19') -``` - -Sonuç: - -``` text -┌─parseDateTimeBestEffort('10 20:19')─┐ -│ 2000-01-10 20:19:00 │ -└─────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- \[ISO 8601 announcement by @xkcd\](https://xkcd.com/1179/) -- [RFC 1123](https://tools.ietf.org/html/rfc1123) -- [toDate](#todate) -- [toDateTime](#todatetime) - -## parseDateTimeBestEffortOrNull {#parsedatetimebesteffortornull} - -İçin aynı [parseDateTimeBestEffort](#parsedatetimebesteffort) işlenemeyen bir tarih biçimiyle karşılaştığında null döndürmesi dışında. - -## parseDateTimeBestEffortOrZero {#parsedatetimebesteffortorzero} - -İçin aynı [parseDateTimeBestEffort](#parsedatetimebesteffort) bunun dışında, işlenemeyen bir tarih biçimiyle karşılaştığında sıfır tarih veya sıfır tarih saati döndürür. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/tr/sql_reference/functions/url_functions.md b/docs/tr/sql_reference/functions/url_functions.md deleted file mode 100644 index 47f127f1667..00000000000 --- a/docs/tr/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 54 -toc_title: "URL'ler ile \xE7al\u0131\u015Fma" ---- - -# URL'ler ile çalışmak için işlevler {#functions-for-working-with-urls} - -Tüm bu işlevler RFC'Yİ takip etmez. Geliştirilmiş performans için maksimum derecede basitleştirilmişlerdir. - -## Bir URL'nin bölümlerini Ayıklayan işlevler {#functions-that-extract-parts-of-a-url} - -İlgili bölüm bir URL'de yoksa, boş bir dize döndürülür. - -### protokol {#protocol} - -Protokolü bir URL'den ayıklar. - -Examples of typical returned values: http, https, ftp, mailto, tel, magnet… - -### etki {#domain} - -Ana bilgisayar adını bir URL'den ayıklar. - -``` sql -domain(url) -``` - -**Parametre** - -- `url` — URL. Type: [Dize](../../sql_reference/data_types/string.md). - -URL, bir şema ile veya şema olmadan belirtilebilir. Örnekler: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -Bu örnekler için, `domain` işlev aşağıdaki sonuçları döndürür: - -``` text -some.svn-hosting.com -some.svn-hosting.com -yandex.com -``` - -**Döndürülen değerler** - -- Adı ana. ClickHouse giriş dizesini bir URL olarak ayrıştırırsa. -- Boş dize. ClickHouse giriş dizesini bir URL olarak ayrıştıramazsa. - -Tür: `String`. - -**Örnek** - -``` sql -SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')─┐ -│ some.svn-hosting.com │ -└────────────────────────────────────────────────────────┘ -``` - -### domainWithoutWWW {#domainwithoutwww} - -Etki alanını döndürür ve birden fazla kaldırır ‘www.’ başlangıcına, eğer var dan. - -### topLevelDomain {#topleveldomain} - -Üst düzey etki alanını bir URL'den ayıklar. - -``` sql -topLevelDomain(url) -``` - -**Parametre** - -- `url` — URL. Type: [Dize](../../sql_reference/data_types/string.md). - -URL, bir şema ile veya şema olmadan belirtilebilir. Örnekler: - -``` text -svn+ssh://some.svn-hosting.com:80/repo/trunk -some.svn-hosting.com:80/repo/trunk -https://yandex.com/time/ -``` - -**Döndürülen değerler** - -- Etki alanı adı. ClickHouse giriş dizesini bir URL olarak ayrıştırırsa. -- Boş dize. ClickHouse giriş dizesini bir URL olarak ayrıştıramazsa. - -Tür: `String`. - -**Örnek** - -``` sql -SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk') -``` - -``` text -┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐ -│ com │ -└────────────────────────────────────────────────────────────────────┘ -``` - -### firstSignificantSubdomain {#firstsignificantsubdomain} - -Ret theur thens the “first significant subdomain”. Bu, Yandex'e özgü standart olmayan bir kavramdır.Metrica. İlk önemli alt etki alanı ise ikinci düzey bir etki alanıdır ‘com’, ‘net’, ‘org’, veya ‘co’. Aksi takdirde, üçüncü düzey bir alandır. Mesela, `firstSignificantSubdomain (‘https://news.yandex.ru/’) = ‘yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’`. Listesi “insignificant” ikinci düzey etki alanları ve diğer uygulama ayrıntıları gelecekte değişebilir. - -### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} - -En üst düzey alt etki alanlarını içeren etki alanının bir bölümünü döndürür. “first significant subdomain” (yukarıdaki açıklamaya bakınız). - -Mesela, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### yol {#path} - -Yolu döndürür. Örnek: `/top/news.html` Yol sorgu dizesini içermez. - -### pathFull {#pathfull} - -Yukarıdaki ile aynı, ancak sorgu dizesi ve parça dahil. Örnek: / top / haberler.html?Sayfa = 2 \# yorumlar - -### queryString {#querystring} - -Sorgu dizesini döndürür. Örnek: Sayfa = 1 & lr = 213. sorgu dizesi, ilk soru işaretinin yanı sıra \# ve \# sonrası her şeyi içermez. - -### parça {#fragment} - -Parça tanımlayıcısını döndürür. fragment ilk karma sembolü içermez. - -### queryStringAndFragment {#querystringandfragment} - -Sorgu dizesini ve parça tanımlayıcısını döndürür. Örnek: Sayfa = 1\#29390. - -### extractURLParameter (URL, isim) {#extracturlparameterurl-name} - -Değerini döndürür ‘name’ varsa, URL'DEKİ parametre. Aksi takdirde, boş bir dize. Bu ada sahip birçok parametre varsa, ilk oluşumu döndürür. Bu işlev, parametre adının URL'de geçirilen bağımsız değişkenle aynı şekilde kodlandığı varsayımı altında çalışır. - -### extractURLParameters (URL) {#extracturlparametersurl} - -Bir dizi döndürür name = URL parametrelerine karşılık gelen değer dizeleri. Değerler hiçbir şekilde deşifre edilmez. - -### extractURLParameterNames(URL) {#extracturlparameternamesurl} - -URL parametrelerinin adlarına karşılık gelen bir dizi ad dizesi döndürür. Değerler hiçbir şekilde deşifre edilmez. - -### URLHierarchy(URL) {#urlhierarchyurl} - -Sonunda/,? simgeleriyle kesilen URL'yi içeren bir dizi döndürür yol ve sorgu dizesinde. Ardışık ayırıcı karakterler bir olarak sayılır. Kesim, tüm ardışık ayırıcı karakterlerden sonra pozisyonda yapılır. - -### URLPathHierarchy(URL) {#urlpathhierarchyurl} - -Yukarıdaki ile aynı, ancak sonuçta protokol ve ana bilgisayar olmadan. / Eleman (kök) dahil değildir. Örnek: işlev, yandex'te URL'yi ağaç raporları uygulamak için kullanılır. Ölçü. - -``` text -URLPathHierarchy('https://example.com/browse/CONV-6788') = -[ - '/browse/', - '/browse/CONV-6788' -] -``` - -### decodeURLComponent (URL) {#decodeurlcomponenturl} - -Çözülmüş URL'yi döndürür. -Örnek: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - -``` text -┌─DecodedURL─────────────────────────────┐ -│ http://127.0.0.1:8123/?query=SELECT 1; │ -└────────────────────────────────────────┘ -``` - -## URL'nin bir bölümünü kaldıran işlevler {#functions-that-remove-part-of-a-url} - -URL'de benzer bir şey yoksa, URL değişmeden kalır. - -### cutWWW {#cutwww} - -Birden fazla kaldırır ‘www.’ varsa, URL'nin etki alanının başından itibaren. - -### cutQueryString {#cutquerystring} - -Sorgu dizesini kaldırır. Soru işareti de kaldırılır. - -### cutFragment {#cutfragment} - -Parça tanımlayıcısını kaldırır. Sayı işareti de kaldırılır. - -### cutQueryStringAndFragment {#cutquerystringandfragment} - -Sorgu dizesini ve parça tanımlayıcısını kaldırır. Soru işareti ve sayı işareti de kaldırılır. - -### cutURLParameter (URL, isim) {#cuturlparameterurl-name} - -Kaldırır ‘name’ Varsa URL parametresi. Bu işlev, parametre adının URL'de geçirilen bağımsız değişkenle aynı şekilde kodlandığı varsayımı altında çalışır. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/tr/sql_reference/functions/uuid_functions.md b/docs/tr/sql_reference/functions/uuid_functions.md deleted file mode 100644 index 93969dd4640..00000000000 --- a/docs/tr/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 53 -toc_title: "UUID ile \xE7al\u0131\u015Fma" ---- - -# UUID ile çalışmak için fonksiyonlar {#functions-for-working-with-uuid} - -UUID ile çalışmak için işlevler aşağıda listelenmiştir. - -## generateuuıdv4 {#uuid-function-generate} - -Üretir [UUID](../../sql_reference/data_types/uuid.md) -den [sürüm 4](https://tools.ietf.org/html/rfc4122#section-4.4). - -``` sql -generateUUIDv4() -``` - -**Döndürülen değer** - -UUID türü değeri. - -**Kullanım örneği** - -Bu örnek, UUID türü sütunuyla bir tablo oluşturma ve tabloya bir değer ekleme gösterir. - -``` sql -CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -INSERT INTO t_uuid SELECT generateUUIDv4() - -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## toUUİD (x) {#touuid-x} - -Dize türü değerini UUID türüne dönüştürür. - -``` sql -toUUID(String) -``` - -**Döndürülen değer** - -UUID türü değeri. - -**Kullanım örneği** - -``` sql -SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid -``` - -``` text -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## UUİDStringToNum {#uuidstringtonum} - -Biçiminde 36 karakter içeren bir dize kabul eder `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` ve bir bayt kümesi olarak döndürür [FixedString (16)](../../sql_reference/data_types/fixedstring.md). - -``` sql -UUIDStringToNum(String) -``` - -**Döndürülen değer** - -FixedString (16) - -**Kullanım örnekleri** - -``` sql -SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes -``` - -``` text -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## UUİDNumToString {#uuidnumtostring} - -Kabul eder bir [FixedString (16)](../../sql_reference/data_types/fixedstring.md) değer ve metin biçiminde 36 karakter içeren bir dize döndürür. - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**Döndürülen değer** - -Dize. - -**Kullanım örneği** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid -``` - -``` text -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## Ayrıca bakınız {#see-also} - -- [dictGetUUİD](ext_dict_functions.md#ext_dict_functions-other) - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/tr/sql_reference/functions/ym_dict_functions.md b/docs/tr/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index 46384107029..00000000000 --- a/docs/tr/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 59 -toc_title: "Yandex ile \xE7al\u0131\u015Fmak.Metrica S\xF6zl\xFCkleri" ---- - -# Yandex ile çalışmak için fonksiyonlar.Metrica sözlükleri {#functions-for-working-with-yandex-metrica-dictionaries} - -Aşağıdaki işlevlerin çalışması için, sunucu yapılandırmasının tüm Yandex'i almak için yolları ve adresleri belirtmesi gerekir.Metrica sözlükler. Sözlükler, bu işlevlerden herhangi birinin ilk çağrısında yüklenir. Başvuru listeleri yüklenemiyorsa, bir özel durum atılır. - -Başvuru listeleri oluşturma hakkında daha fazla bilgi için bölüme bakın “Dictionaries”. - -## Çoklu geobazlar {#multiple-geobases} - -ClickHouse, belirli bölgelerin hangi ülkelere ait olduğu konusunda çeşitli perspektifleri desteklemek için aynı anda birden fazla alternatif jeobaz (bölgesel hiyerarşiler) ile çalışmayı destekler. - -Bu ‘clickhouse-server’ config, dosyayı bölgesel hiyerarşi ile belirtir::`/opt/geo/regions_hierarchy.txt` - -Bu dosyanın yanı sıra, yakındaki \_ sembolüne ve isme eklenen herhangi bir sonek (dosya uzantısından önce) olan dosyaları da arar. -Örneğin, dosyayı da bulacaktır `/opt/geo/regions_hierarchy_ua.txt` varsa. - -`ua` sözlük anahtarı denir. Soneksiz bir sözlük için anahtar boş bir dizedir. - -Tüm sözlükler çalışma zamanında yeniden yüklenir (buıltın\_dıctıonarıes\_reload\_ınterval yapılandırma parametresinde tanımlandığı gibi belirli sayıda saniyede bir kez veya varsayılan olarak saatte bir kez). Ancak, sunucu başladığında kullanılabilir sözlüklerin listesi bir kez tanımlanır. - -All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. -Örnek: - -``` sql -regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt -regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt -``` - -### regionToCity (id \[, geobase\]) {#regiontocityid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. - -### regionToArea (id \[, geobase\]) {#regiontoareaid-geobase} - -Bir bölgeyi bir alana dönüştürür (geobase içinde 5 yazın). Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ -│ │ -│ Moscow and Moscow region │ -│ St. Petersburg and Leningrad region │ -│ Belgorod region │ -│ Ivanovsk region │ -│ Kaluga region │ -│ Kostroma region │ -│ Kursk region │ -│ Lipetsk region │ -│ Orlov region │ -│ Ryazan region │ -│ Smolensk region │ -│ Tambov region │ -│ Tver region │ -│ Tula region │ -└──────────────────────────────────────────────────────┘ -``` - -### regionToDistrict (id \[, geobase\]) {#regiontodistrictid-geobase} - -Bir bölgeyi federal bir bölgeye dönüştürür (geobase içinde tip 4). Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - -``` text -┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ -│ │ -│ Central federal district │ -│ Northwest federal district │ -│ South federal district │ -│ North Caucases federal district │ -│ Privolga federal district │ -│ Ural federal district │ -│ Siberian federal district │ -│ Far East federal district │ -│ Scotland │ -│ Faroe Islands │ -│ Flemish region │ -│ Brussels capital region │ -│ Wallonia │ -│ Federation of Bosnia and Herzegovina │ -└──────────────────────────────────────────────────────────┘ -``` - -### regionToCountry (ıd \[, geobase\]) {#regiontocountryid-geobase} - -Bir bölgeyi bir ülkeye dönüştürür. Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. -Örnek: `regionToCountry(toUInt32(213)) = 225` Moskova'yı (213) Rusya'ya (225) dönüştürür. - -### regionToContinent (id \[, geobase\]) {#regiontocontinentid-geobase} - -Bir bölgeyi bir kıtaya dönüştürür. Diğer her şekilde, bu işlev aynıdır ‘regionToCity’. -Örnek: `regionToContinent(toUInt32(213)) = 10001` Moskova'yı (213) Avrasya'ya (10001) dönüştürür. - -### regionToTopContinent (\#regiontotopcontinent) {#regiontotopcontinent-regiontotopcontinent} - -Bölgenin hiyerarşisinde en yüksek kıtayı bulur. - -**Sözdizimi** - -``` sql -regionToTopContinent(id[, geobase]); -``` - -**Parametre** - -- `id` — Region ID from the Yandex geobase. [Uİnt32](../../sql_reference/data_types/int_uint.md). -- `geobase` — Dictionary key. See [Çoklu Geobazlar](#multiple-geobases). [Dize](../../sql_reference/data_types/string.md). İsteğe bağlı. - -**Döndürülen değer** - -- Üst düzey kıtanın tanımlayıcısı (bölgeler hiyerarşisine tırmandığınızda ikincisi). -- 0, yoksa. - -Tür: `UInt32`. - -### regionToPopulation (id \[, geobase\]) {#regiontopopulationid-geobase} - -Bir bölge için nüfusu alır. -Nüfus geobase ile dosyalarda kaydedilebilir. Bölümüne bakınız “External dictionaries”. -Bölge için nüfus kaydedilmezse, 0 döndürür. -Yandex geobase'de, nüfus alt bölgeler için kaydedilebilir, ancak üst bölgeler için kaydedilemez. - -### regionİn (lhs, rhs \[, geobase\]) {#regioninlhs-rhs-geobase} - -Olup olmadığını denetler bir ‘lhs’ bölge bir ‘rhs’ bölge. Aitse 1'e eşit bir Uİnt8 numarası veya ait değilse 0 döndürür. -The relationship is reflexive – any region also belongs to itself. - -### regionHierarchy (id \[, geobase\]) {#regionhierarchyid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. -Örnek: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### regionToName (id \[, lang\]) {#regiontonameid-lang} - -Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn't exist, an empty string is returned. - -`ua` ve `uk` hem Ukrayna demek. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/tr/sql_reference/index.md b/docs/tr/sql_reference/index.md deleted file mode 100644 index 25b886b9c9d..00000000000 --- a/docs/tr/sql_reference/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "SQL ba\u015Fvurusu" -toc_hidden: true -toc_priority: 28 -toc_title: "gizlenmi\u015F" ---- - -# SQL başvurusu {#sql-reference} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md#query_language_queries_alter) -- [Diğer sorgu türleri](statements/misc.md) - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/tr/sql_reference/operators.md b/docs/tr/sql_reference/operators.md deleted file mode 100644 index 63100e9e9ea..00000000000 --- a/docs/tr/sql_reference/operators.md +++ /dev/null @@ -1,277 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 37 -toc_title: "Operat\xF6rler" ---- - -# Operatörler {#operators} - -ClickHouse onların öncelik, öncelik ve ilişkilendirme göre sorgu ayrıştırma aşamasında karşılık gelen işlevlere işleçleri dönüştürür. - -## Erişim Operatörleri {#access-operators} - -`a[N]` – Access to an element of an array. The `arrayElement(a, N)` işlev. - -`a.N` – Access to a tuple element. The `tupleElement(a, N)` işlev. - -## Sayısal Olumsuzlama Operatörü {#numeric-negation-operator} - -`-a` – The `negate (a)` işlev. - -## Çarpma ve bölme operatörleri {#multiplication-and-division-operators} - -`a * b` – The `multiply (a, b)` işlev. - -`a / b` – The `divide(a, b)` işlev. - -`a % b` – The `modulo(a, b)` işlev. - -## Toplama ve çıkarma operatörleri {#addition-and-subtraction-operators} - -`a + b` – The `plus(a, b)` işlev. - -`a - b` – The `minus(a, b)` işlev. - -## Karşılaştırma Operatörleri {#comparison-operators} - -`a = b` – The `equals(a, b)` işlev. - -`a == b` – The `equals(a, b)` işlev. - -`a != b` – The `notEquals(a, b)` işlev. - -`a <> b` – The `notEquals(a, b)` işlev. - -`a <= b` – The `lessOrEquals(a, b)` işlev. - -`a >= b` – The `greaterOrEquals(a, b)` işlev. - -`a < b` – The `less(a, b)` işlev. - -`a > b` – The `greater(a, b)` işlev. - -`a LIKE s` – The `like(a, b)` işlev. - -`a NOT LIKE s` – The `notLike(a, b)` işlev. - -`a BETWEEN b AND c` – The same as `a >= b AND a <= c`. - -`a NOT BETWEEN b AND c` – The same as `a < b OR a > c`. - -## Veri kümeleriyle çalışmak için operatörler {#operators-for-working-with-data-sets} - -*Görmek [Operatör İNLERDE](statements/select.md#select-in-operators).* - -`a IN ...` – The `in(a, b)` işlev. - -`a NOT IN ...` – The `notIn(a, b)` işlev. - -`a GLOBAL IN ...` – The `globalIn(a, b)` işlev. - -`a GLOBAL NOT IN ...` – The `globalNotIn(a, b)` işlev. - -## Tarih ve Saatlerle çalışmak için operatörler {#operators-datetime} - -### EXTRACT {#operator-extract} - -``` sql -EXTRACT(part FROM date); -``` - -Belirli bir tarihten parçaları ayıklayın. Örneğin, belirli bir tarihten bir ay veya bir zamandan bir saniye alabilirsiniz. - -Bu `part` parametre almak için tarihin hangi bölümünü belirtir. Aşağıdaki değerler kullanılabilir: - -- `DAY` — The day of the month. Possible values: 1–31. -- `MONTH` — The number of a month. Possible values: 1–12. -- `YEAR` — The year. -- `SECOND` — The second. Possible values: 0–59. -- `MINUTE` — The minute. Possible values: 0–59. -- `HOUR` — The hour. Possible values: 0–23. - -Bu `part` parametre büyük / küçük harf duyarsızdır. - -Bu `date` parametre, işlenecek tarihi veya saati belirtir. Ya [Tarihli](../sql_reference/data_types/date.md) veya [DateTime](../sql_reference/data_types/datetime.md) türü desteklenir. - -Örnekler: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -Aşağıdaki örnekte bir tablo oluşturuyoruz ve içine bir değer ekliyoruz `DateTime` tür. - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -Daha fazla örnek görebilirsiniz [testler](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -Oluşturur bir [Aralıklı](../sql_reference/data_types/special_data_types/interval.md)- aritmetik işlemlerde kullanılması gereken tip değeri [Tarihli](../sql_reference/data_types/date.md) ve [DateTime](../sql_reference/data_types/datetime.md)- tip değerleri. - -Aralık türleri: -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -!!! warning "Uyarıcı" - Farklı tiplere sahip aralıklar birleştirilemez. Gibi ifadeler kullanamazsınız `INTERVAL 4 DAY 1 HOUR`. Aralıkların, örneğin aralığın en küçük birimine eşit veya daha küçük olan birimlerdeki aralıkları belirtin, `INTERVAL 25 HOUR`. Aşağıdaki örnekte olduğu gibi ardışık işlemleri kullanabilirsiniz. - -Örnek: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**Ayrıca Bakınız** - -- [Aralıklı](../sql_reference/data_types/special_data_types/interval.md) veri türü -- [toİnterval](../sql_reference/functions/type_conversion_functions.md#function-tointerval) tip dönüştürme işlevleri - -## Mantıksal Olumsuzlama Operatörü {#logical-negation-operator} - -`NOT a` – The `not(a)` işlev. - -## Mantıksal ve operatör {#logical-and-operator} - -`a AND b` – The`and(a, b)` işlev. - -## Mantıksal veya operatör {#logical-or-operator} - -`a OR b` – The `or(a, b)` işlev. - -## Koşullu Operatör {#conditional-operator} - -`a ? b : c` – The `if(a, b, c)` işlev. - -Not: - -Koşullu işleç B ve c değerlerini hesaplar, ardından a koşulunun karşılanıp karşılanmadığını kontrol eder ve ardından karşılık gelen değeri döndürür. Eğer `b` veya `C` is an [arrayJoin()](../sql_reference/functions/array_join.md#functions_arrayjoin) işlev, her satır ne olursa olsun çoğaltılır “a” koşul. - -## Koşullu İfade {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -Eğer `x` belirtilen sonra `transform(x, [a, ...], [b, ...], c)` function is used. Otherwise – `multiIf(a, b, ..., c)`. - -Eğer herhangi bir `ELSE c` ifadedeki yan tümce, varsayılan değer `NULL`. - -Bu `transform` fonksiyonu ile çalışmıyor `NULL`. - -## Birleştirme Operatörü {#concatenation-operator} - -`s1 || s2` – The `concat(s1, s2) function.` - -## Lambda Oluşturma Operatörü {#lambda-creation-operator} - -`x -> expr` – The `lambda(x, expr) function.` - -Parantez oldukları için aşağıdaki operatörler bir önceliğe sahip değildir: - -## Dizi Oluşturma Operatörü {#array-creation-operator} - -`[x1, ...]` – The `array(x1, ...) function.` - -## Tuple Oluşturma Operatörü {#tuple-creation-operator} - -`(x1, x2, ...)` – The `tuple(x2, x2, ...) function.` - -## İlişkisellik {#associativity} - -Tüm ikili operatörler ilişkisellikten ayrıldı. Mesela, `1 + 2 + 3` dönüştür toülür `plus(plus(1, 2), 3)`. -Bazen bu beklediğiniz gibi çalışmaz. Mesela, `SELECT 4 > 2 > 3` 0 ile sonuç willlanır. - -Verimlilik için, `and` ve `or` işlevler herhangi bir sayıda bağımsız değişkeni kabul eder. İlgili zincirler `AND` ve `OR` operatörler bu işlevlerin tek bir çağrısına dönüştürülür. - -## İçin kontrol `NULL` {#checking-for-null} - -ClickHouse destekler `IS NULL` ve `IS NOT NULL` operatörler. - -### IS NULL {#operator-is-null} - -- İçin [Nullable](../sql_reference/data_types/nullable.md) türü değerleri `IS NULL` operatör döner: - - `1` değeri ise `NULL`. - - `0` başka. -- Diğer değerler için, `IS NULL` operatör her zaman döner `0`. - - - -``` sql -SELECT x+100 FROM t_null WHERE y IS NULL -``` - -``` text -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ -``` - -### IS NOT NULL {#is-not-null} - -- İçin [Nullable](../sql_reference/data_types/nullable.md) türü değerleri `IS NOT NULL` operatör döner: - - `0` değeri ise `NULL`. - - `1` başka. -- Diğer değerler için, `IS NOT NULL` operatör her zaman döner `1`. - - - -``` sql -SELECT * FROM t_null WHERE y IS NOT NULL -``` - -``` text -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/tr/sql_reference/statements/alter.md b/docs/tr/sql_reference/statements/alter.md deleted file mode 100644 index b61a3784af9..00000000000 --- a/docs/tr/sql_reference/statements/alter.md +++ /dev/null @@ -1,504 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -Bu `ALTER` sorgu yalnızca için desteklenir `*MergeTree` tablo gibi `Merge`ve`Distributed`. Sorgunun çeşitli varyasyonları vardır. - -### Sütun Manipülasyonları {#column-manipulations} - -Tablo yapısını değiştirme. - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -Sorguda, bir veya daha fazla virgülle ayrılmış eylemlerin bir listesini belirtin. -Her eylem bir sütun üzerinde bir işlemdir. - -Aşağıdaki eylemler desteklenir: - -- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. -- [DROP COLUMN](#alter_drop-column) — Deletes the column. -- [CLEAR COLUMN](#alter_clear-column) — Resets column values. -- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. -- [MODIFY COLUMN](#alter_modify-column) — Changes column's type, default expression and TTL. - -Bu eylemler aşağıda ayrıntılı olarak açıklanmıştır. - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -Belirtilen tabloya yeni bir sütun ekler `name`, `type`, [`codec`](create.md#codecs) ve `default_expr` (bkz [Varsayılan ifadeler](create.md#create-default-values)). - -Eğer... `IF NOT EXISTS` yan tümcesi dahil, sütun zaten varsa sorgu bir hata döndürmez. Belirtir specifyseniz `AFTER name_after` (başka bir sütunun adı), sütun tablo sütunları listesinde belirtilen sonra eklenir. Aksi takdirde, sütun tablonun sonuna eklenir. Bir tablonun başına bir sütun eklemek için bir yol olduğunu unutmayın. Bir eylem zinciri için, `name_after` önceki eylemlerden birine eklenen bir sütunun adı olabilir. - -Bir sütun eklemek, verilerle herhangi bir işlem yapmadan tablo yapısını değiştirir. Sonra veriler diskte görünmüyor `ALTER`. Tablodan okurken bir sütun için veri eksikse, varsayılan değerlerle doldurulur (varsa, varsayılan ifadeyi gerçekleştirerek veya sıfır veya boş dizeler kullanarak). Sütun, veri parçalarını birleştirdikten sonra diskte görünür (bkz. [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)). - -Bu yaklaşım bize tamamlamak için izin verir `ALTER` eski verilerin hacmini arttırmadan anında sorgulayın. - -Örnek: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -Sütun adı ile siler `name`. Eğer... `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. - -Dosya sisteminden veri siler. Bu, tüm dosyaları sildiğinden, sorgu neredeyse anında tamamlanır. - -Örnek: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -Belirtilen bölüm için bir sütundaki tüm verileri sıfırlar. Bölümdeki bölüm adını ayarlama hakkında daha fazla bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). - -Eğer... `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. - -Örnek: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'comment' -``` - -Sütuna bir yorum ekler. Eğer... `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. - -Her sütunun bir yorumu olabilir. Sütun için bir yorum zaten varsa, yeni bir yorum önceki yorumun üzerine yazar. - -Yorumlar saklanır `comment_expression` tarafından döndürülen sütun [DESCRIBE TABLE](misc.md#misc-describe-table) sorgu. - -Örnek: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -Bu sorgu değişiklikleri `name` sütun özellikleri: - -- Tür - -- Varsayılan ifade - -- TTL - - For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). - -Eğer... `IF EXISTS` yan tümcesi belirtilir, sütun yoksa sorgu bir hata döndürmez. - -Türü değiştirirken, değerler sanki [toType](../../sql_reference/functions/type_conversion_functions.md) fonksiyonlar onlara uygulandı. Yalnızca varsayılan ifade değiştirilirse, sorgu karmaşık bir şey yapmaz ve neredeyse anında tamamlanır. - -Örnek: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. - -Birkaç işlem aşaması vardır: - -- Geçici (yeni) dosyaları değiştirilmiş verilerle hazırlama. -- Eski dosyaları yeniden adlandırma. -- Geçici (yeni) dosyaları eski adlara yeniden adlandırma. -- Eski dosyaları silme. - -Sadece ilk aşama zaman alır. Bu aşamada bir hata varsa, veriler değişmez. -Ardışık aşamalardan biri sırasında bir hata varsa, veriler el ile geri yüklenebilir. Eski dosyalar dosya sisteminden silindi, ancak yeni dosyaların verileri diske yazılmadı ve kaybolduysa istisnadır. - -Bu `ALTER` sütunları değiştirmek için sorgu çoğaltılır. Talimatlar ZooKeeper kaydedilir, daha sonra her kopya bunları uygular. Tüm `ALTER` sorgular aynı sırada çalıştırılır. Sorgu, diğer yinelemeler üzerinde tamamlanması uygun eylemleri bekler. Ancak, yinelenen bir tablodaki sütunları değiştirmek için bir sorgu kesilebilir ve tüm eylemler zaman uyumsuz olarak gerçekleştirilir. - -#### Sorgu sınırlamalarını değiştir {#alter-query-limitations} - -Bu `ALTER` sorgu oluşturmak ve iç içe veri yapıları, ancak tüm iç içe veri yapıları ayrı öğeleri (sütunlar) silmenizi sağlar. İç içe geçmiş bir veri yapısı eklemek için, aşağıdaki gibi bir ada sahip sütunlar ekleyebilirsiniz `name.nested_name` ve türü `Array(T)`. İç içe geçmiş bir veri yapısı, noktadan önce aynı öneki olan bir ada sahip birden çok dizi sütununa eşdeğerdir. - -Birincil anahtardaki veya örnekleme anahtarındaki sütunları silmek için destek yoktur. `ENGINE` ifade). Birincil anahtarda bulunan sütunların türünü değiştirmek, yalnızca bu değişiklik verilerin değiştirilmesine neden olmazsa mümkündür (örneğin, bir numaraya değer eklemenize veya bir türden değiştirmenize izin verilir `DateTime` -e doğru `UInt32`). - -Eğer... `ALTER` sorgu, ihtiyacınız olan tablo değişikliklerini yapmak için yeterli değildir, yeni bir tablo oluşturabilir, verileri kullanarak kopyalayabilirsiniz. [INSERT SELECT](insert_into.md#insert_query_insert-select) sorgu, daha sonra tabloları kullanarak geçiş [RENAME](misc.md#misc_operations-rename) sorgu ve eski tabloyu silin. Kullanabilirsiniz [clickhouse-fotokopi makinesi](../../operations/utilities/clickhouse-copier.md) bir alternatif olarak `INSERT SELECT` sorgu. - -Bu `ALTER` sorgu tüm okur ve tablo için yazar engeller. Başka bir deyişle, Eğer uzun `SELECT` zamanda çalışıyor `ALTER` sorgu `ALTER` sorgu tamamlanmasını bekleyecektir. Aynı zamanda, aynı tablodaki tüm yeni sorgular bu sırada bekleyecektir `ALTER` çalışıyor. - -Verileri kendileri saklamayan tablolar için (örneğin `Merge` ve `Distributed`), `ALTER` sadece tablo yapısını değiştirir ve alt tabloların yapısını değiştirmez. Örneğin, ALTER for a çalıştırırken `Distributed` tablo, ayrıca çalıştırmak gerekir `ALTER` tüm uzak sunuculardaki tablolar için. - -### Anahtar İfadelerle Manipülasyonlar {#manipulations-with-key-expressions} - -Aşağıdaki komut desteklenir: - -``` sql -MODIFY ORDER BY new_expression -``` - -Sadece tablolar için çalışır [`MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) aile (dahil -[çoğaltıyordu](../../engines/table_engines/mergetree_family/replication.md) Tablolar). Komutu değiştirir -[sıralama anahtarı](../../engines/table_engines/mergetree_family/mergetree.md) tablonun --e doğru `new_expression` (bir ifade veya ifadelerin bir tuple). Birincil anahtar aynı kalır. - -Komut, yalnızca meta verileri değiştirdiği bir anlamda hafiftir. Veri parçası özelliği tutmak için -satırlar sıralama anahtarı ifadesi tarafından sıralanır varolan sütunları içeren ifadeler ekleyemezsiniz -sıralama anahtarına (yalnızca sütun tarafından eklenen `ADD COLUMN` aynı komut `ALTER` sorgu). - -### Veri Atlama Endeksleri İle Manipülasyonlar {#manipulations-with-data-skipping-indices} - -Sadece tablolar için çalışır [`*MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) aile (dahil -[çoğaltıyordu](../../engines/table_engines/mergetree_family/replication.md) Tablolar). Aşağıdaki işlemler -mevcuttur: - -- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` - Tablolar meta dizin açıklama ekler. - -- `ALTER TABLE [db].name DROP INDEX name` - Tablolar meta dizin açıklama kaldırır ve diskten dizin dosyalarını siler. - -Bu komutlar, yalnızca meta verileri değiştirdikleri veya dosyaları kaldırdıkları bir anlamda hafiftir. -Ayrıca, çoğaltılırlar (ZooKeeper aracılığıyla indeks meta verilerini senkronize etme). - -### Kısıtlamalar İle Manipülasyonlar {#manipulations-with-constraints} - -Daha fazla görmek [kısıtlamalar](create.md#constraints) - -Kısıtlamalar eklenebilir veya aşağıdaki sözdizimi kullanılarak silinebilir: - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -Sorgular eklemek veya hemen işlenir, böylece tablodan kısıtlamaları hakkında meta verileri kaldırın. - -Kısıtlama kontrolü *idam edilm willeyecek* eklen .mişse mevcut ver .ilerde - -Çoğaltılmış tablolardaki tüm değişiklikler Zookeeper'a yayınlanır, bu nedenle diğer kopyalara uygulanır. - -### Bölümler ve parçalar ile manipülasyonlar {#alter_manipulations-with-partitions} - -Aşağıdaki işlemler ile [bölümler](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) mevcuttur: - -- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` dizin ve unutun. -- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. -- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` tabloya dizin. -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. -- [REPLACE PARTITION](#alter_replace-partition) - Veri bölümünü bir tablodan diğerine kopyalar ve değiştirir. -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition) - veri bölümünü bir tablodan diğerine taşıyın. -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) - Bir bölümdeki belirtilen sütunun değerini sıfırlar. -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) - Bir bölümde belirtilen ikincil dizini sıfırlar. -- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. -- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. -- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. - - - -#### Bölüm ayırmak {\#alter\_detach-bölüm} {#detach-partition-alter-detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -Belirtilen bölüm için tüm verileri `detached` dizin. Sunucu, yok gibi ayrılmış veri Bölümü hakkında unutur. Sunucu, bu verileri siz yapana kadar bilmeyecektir. [ATTACH](#alter_attach-partition) sorgu. - -Örnek: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -Bir bölümdeki bölüm ifadesini ayarlama hakkında bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). - -Sorgu yürütüldükten sonra, veri ile istediğiniz her şeyi yapabilirsiniz `detached` directory — delete it from the file system, or just leave it. - -This query is replicated – it moves the data to the `detached` tüm kopyalarda dizin. Bu sorguyu yalnızca bir lider yinelemesinde yürütebileceğinizi unutmayın. Bir kopya bir lider olup olmadığını öğrenmek için `SELECT` sorgu için [sistem.yinelemeler](../../operations/system_tables.md#system_tables-replicas) Tablo. Alternatif olarak, bir yapmak daha kolaydır `DETACH` tüm yinelemelerde sorgu - tüm yinelemeler, lider yinelemesi dışında bir özel durum oluşturur. - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -Belirtilen bölümü tablodan siler. Bu sorgu bölümü etkin olarak etiketler ve verileri tamamen yaklaşık 10 dakika içinde siler. - -Bir bölümdeki bölüm ifadesini ayarlama hakkında bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). - -The query is replicated – it deletes data on all replicas. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -Belirtilen bölümü veya belirtilen bölümün tüm bölümlerini kaldırır `detached`. -Bir bölümdeki bölüm ifadesini ayarlama hakkında daha fazla bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -Tablodan veri ekler `detached` dizin. Tüm bir bölüm veya ayrı bir bölüm için veri eklemek mümkündür. Örnekler: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -Bir bölümdeki bölüm ifadesini ayarlama hakkında daha fazla bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). - -Bu sorgu çoğaltılır. Çoğaltma başlatıcısı, veri olup olmadığını denetler. `detached` dizin. Veri varsa, sorgu bütünlüğünü denetler. Her şey doğruysa, sorgu verileri tabloya ekler. Diğer tüm yinelemeler, çoğaltma başlatıcısından verileri karşıdan yükleyin. - -Böylece veri koyabilirsiniz `detached` bir kopya üzerinde dizin ve `ALTER ... ATTACH` tüm yinelemelerde tabloya eklemek için sorgu. - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -Bu sorgu, veri bölümünü `table1` -e doğru `table2` exsisting için veri ekler `table2`. Verilerin silinmeyeceğini unutmayın `table1`. - -Sorgunun başarıyla çalışması için aşağıdaki koşulların karşılanması gerekir: - -- Her iki tablo da aynı yapıya sahip olmalıdır. -- Her iki tablo da aynı bölüm anahtarına sahip olmalıdır. - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -Bu sorgu, veri bölümünü `table1` -e doğru `table2` ve mevcut bölümün yerini alır `table2`. Verilerin silinmeyeceğini unutmayın `table1`. - -Sorgunun başarıyla çalışması için aşağıdaki koşulların karşılanması gerekir: - -- Her iki tablo da aynı yapıya sahip olmalıdır. -- Her iki tablo da aynı bölüm anahtarına sahip olmalıdır. - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -Bu sorgu, veri bölümünü `table_source` -e doğru `table_dest` verileri silme ile `table_source`. - -Sorgunun başarıyla çalışması için aşağıdaki koşulların karşılanması gerekir: - -- Her iki tablo da aynı yapıya sahip olmalıdır. -- Her iki tablo da aynı bölüm anahtarına sahip olmalıdır. -- Her iki tablo da aynı motor ailesi olmalıdır. (çoğaltılmış veya çoğaltılmamış) -- Her iki tablo da aynı depolama ilkesine sahip olmalıdır. - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -Bir bölümdeki belirtilen sütundaki tüm değerleri sıfırlar. Eğer... `DEFAULT` bir tablo oluştururken yan tümcesi belirlendi, bu sorgu sütun değerini belirtilen varsayılan değere ayarlar. - -Örnek: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -Bu sorgu, belirtilen bir bölümün yerel yedeğini oluşturur. Eğer... `PARTITION` yan tümcesi atlandı, sorgu aynı anda tüm bölümlerin yedeğini oluşturur. - -!!! note "Not" - Tüm yedekleme işlemi sunucuyu durdurmadan gerçekleştirilir. - -Eski tarz tablolar için bölüm adının önekini belirtebileceğinizi unutmayın (örneğin, ‘2019’)- daha sonra sorgu tüm ilgili bölümler için yedek oluşturur. Bir bölümdeki bölüm ifadesini ayarlama hakkında bilgi edinin [Bölüm ifadesi nasıl belirlenir](#alter-how-to-specify-part-expr). - -Yürütme sırasında, bir veri anlık görüntüsü için sorgu, bir tablo verilerine sabit bağlantılar oluşturur. Hardlinks dizine yerleştirilir `/var/lib/clickhouse/shadow/N/...`, nere: - -- `/var/lib/clickhouse/` yapılandırmada belirtilen çalışma ClickHouse dizinidir. -- `N` yedeklemenin artımlı sayısıdır. - -!!! note "Not" - Kullanıyorsanız [bir tablodaki veri depolama için disk kümesi](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes), bu `shadow/N` dizin tarafından eşleşen veri parçalarını depolamak, her diskte görünür `PARTITION` ifade. - -Dizinlerin aynı yapısı, içinde olduğu gibi yedek içinde oluşturulur `/var/lib/clickhouse/`. Sorgu gerçekleştirir ‘chmod’ tüm dosyalar için, onlara yazmayı yasaklamak. - -Yedeklemeyi oluşturduktan sonra, verileri `/var/lib/clickhouse/shadow/` uzak sunucuya ve sonra yerel sunucudan silin. Not `ALTER t FREEZE PARTITION` sorgu çoğaltılmaz. Yalnızca yerel sunucuda yerel bir yedekleme oluşturur. - -Sorgu neredeyse anında yedekleme oluşturur (ancak önce geçerli sorguları ilgili tabloya çalışmayı bitirmek için bekler). - -`ALTER TABLE t FREEZE PARTITION` tablo meta verilerini değil, yalnızca verileri kopyalar. Tablo meta verilerinin yedeğini almak için dosyayı kopyalayın `/var/lib/clickhouse/metadata/database/table.sql` - -Bir yedekten veri geri yüklemek için aşağıdakileri yapın: - -1. Yoksa tablo oluşturun. Sorguyu görüntülemek için kullanın .sql dosyası (değiştir `ATTACH` içinde ile `CREATE`). -2. Veri kopyalama `data/database/table/` yedekleme içindeki dizin `/var/lib/clickhouse/data/database/table/detached/` dizin. -3. Koşmak `ALTER TABLE t ATTACH PARTITION` verileri bir tabloya eklemek için sorgular. - -Yedeklemeden geri yükleme, sunucuyu durdurmayı gerektirmez. - -Yedekleme ve geri yükleme verileri hakkında daha fazla bilgi için bkz: [Veri Yedekleme](../../operations/backup.md) bölme. - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -Sorgu benzer çalışır `CLEAR COLUMN`, ancak bir sütun verileri yerine bir dizini sıfırlar. - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -Başka bir sunucudan bir bölüm indirir. Bu sorgu yalnızca çoğaltılmış tablolar için çalışır. - -Sorgu aşağıdakileri yapar: - -1. Bölümü belirtilen parçadan indirir. İçinde ‘path-in-zookeeper’ zookeeper içinde shard için bir yol belirtmeniz gerekir. -2. Sonra sorgu indirilen verileri `detached` directory of the `table_name` Tablo. Kullan... [ATTACH PARTITION\|PART](#alter_attach-partition) tabloya veri eklemek için sorgu. - -Mesela: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -Not thate that: - -- Bu `ALTER ... FETCH PARTITION` sorgu çoğaltılmaz. Bu bölüm için yerleştirir `detached` yalnızca yerel sunucuda dizin. -- Bu `ALTER TABLE ... ATTACH` sorgu çoğaltılır. Verileri tüm yinelemelere ekler. Veriler, kopyalardan birine eklenir. `detached` dizin ve diğerlerine - komşu kopyalardan. - -İndirmeden önce, sistem bölümün olup olmadığını ve tablo yapısının eşleşip eşleşmediğini kontrol eder. En uygun yineleme, sağlıklı yinelemeler otomatik olarak seçilir. - -Sorgu çağrılsa da `ALTER TABLE`, tablo yapısını değiştirmez ve tabloda bulunan verileri hemen değiştirmez. - -#### MOVE PARTITION\|PART {#alter_move-partition} - -Bölümleri veya veri parçalarını başka bir birime veya diske taşır. `MergeTree`- motor masaları. Görmek [Veri depolama için birden fazla blok cihazı kullanma](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -Bu `ALTER TABLE t MOVE` sorgu: - -- Çoğaltılamaz, çünkü farklı çoğaltmalar farklı depolama ilkelerine sahip olabilir. -- Belirtilen disk veya birim yapılandırılmamışsa bir hata döndürür. Depolama ilkesinde belirtilen veri taşıma koşulları uygulanamazsa, sorgu da bir hata döndürür. -- Durumda bir hata döndürebilir, taşınacak veriler zaten bir arka plan işlemi tarafından taşındığında, eşzamanlı `ALTER TABLE t MOVE` sorgu veya arka plan veri birleştirme sonucu. Bir kullanıcı bu durumda herhangi bir ek eylem gerçekleştirmemelidir. - -Örnek: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### Bölüm İfadesi Nasıl Ayarlanır {#alter-how-to-specify-part-expr} - -Bölüm ifadesini şu şekilde belirtebilirsiniz `ALTER ... PARTITION` farklı şekillerde sorgular: - -- Bu gibi bir değer `partition` sütun `system.parts` Tablo. Mesela, `ALTER TABLE visits DETACH PARTITION 201901`. -- Tablo sütunundan ifade olarak. Sabitler ve sabit ifadeler desteklenir. Mesela, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- Bölüm kimliğini kullanma. Partition ID, dosya sistemindeki ve Zookeeper'daki bölümlerin adları olarak kullanılan bölümün (mümkünse insan tarafından okunabilir) bir dize tanımlayıcısıdır. Bölüm kimliği belirtilmelidir `PARTITION ID` fık .ra, tek tırnak içinde. Mesela, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- İn the [ALTER ATTACH PART](#alter_attach-partition) ve [DROP DETACHED PART](#alter_drop-detached) sorgu, bir parçanın adını belirtmek için, bir değer ile dize literal kullanın `name` sütun [sistem.detached\_parts](../../operations/system_tables.md#system_tables-detached_parts) Tablo. Mesela, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -Bölüm belirtilirken tırnak kullanımı bölüm ifadesi türüne bağlıdır. Örneğin, için `String` yazın, adını tırnak içinde belirtmeniz gerekir (`'`). İçin `Date` ve `Int*` türleri hiçbir tırnak gereklidir. - -Eski stil tablolar için, bölümü bir sayı olarak belirtebilirsiniz `201901` veya bir dize `'201901'`. Yeni stil tabloları için sözdizimi türleri ile daha sıkı (değerleri giriş biçimi için ayrıştırıcı benzer). - -Yukarıdaki tüm kurallar için de geçerlidir [OPTIMIZE](misc.md#misc_operations-optimize) sorgu. Bölümlenmemiş bir tabloyu en iyi duruma getirirken tek bölümü belirtmeniz gerekiyorsa, ifadeyi ayarlayın `PARTITION tuple()`. Mesela: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -Örnekleri `ALTER ... PARTITION` sorgular testlerde gösterilmiştir [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) ve [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### Tablo TTL ile manipülasyonlar {#manipulations-with-table-ttl} - -Değiştirebilirsiniz [tablo TTL](../../engines/table_engines/mergetree_family/mergetree.md#mergetree-table-ttl) aşağıdaki formun bir isteği ile: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### Alter sorgularının eşzamanlılığı {#synchronicity-of-alter-queries} - -Replicatable olmayan tablolar için, tüm `ALTER` sorgular eşzamanlı olarak gerçekleştirilir. Replicatable tablolar için, sorgu yalnızca uygun eylemler için yönergeler ekler `ZooKeeper` ve eylemlerin kendileri mümkün olan en kısa sürede gerçekleştirilir. Ancak, sorgu tüm yinelemeler üzerinde tamamlanması için bu eylemleri bekleyebilir. - -İçin `ALTER ... ATTACH|DETACH|DROP` sorgular, kullanabilirsiniz `replication_alter_partitions_sync` bekleyen kurmak için ayarlama. -Olası değerler: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. - -### Mutasyonlar {#alter-mutations} - -Mutasyonlar, bir tablodaki satırların değiştirilmesine veya silinmesine izin veren bir alter query varyantıdır. Standart aksine `UPDATE` ve `DELETE` nokta veri değişikliklerine yönelik sorgular, mutasyonlar, bir tablodaki çok sayıda satırı değiştiren ağır işlemler için tasarlanmıştır. İçin desteklenen `MergeTree` çoğaltma desteği olan motorlar da dahil olmak üzere tablo motorları ailesi. - -Varolan tablolar olduğu gibi mutasyonlar için hazırdır(dönüştürme gerekmez), ancak ilk mutasyon bir tabloya uygulandıktan sonra Meta Veri formatı önceki sunucu sürümleriyle uyumsuz hale gelir ve önceki bir sürüme geri dönmek imkansız hale gelir. - -Şu anda mevcut komutlar: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -Bu `filter_expr` tip olmalıdır `UInt8`. Sorgu, bu ifadenin sıfır olmayan bir değer aldığı tablodaki satırları siler. - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -Bu `filter_expr` tip olmalıdır `UInt8`. Bu sorgu, belirtilen sütunların değerlerini, satırlardaki karşılık gelen ifadelerin değerlerine güncelleştirir. `filter_expr` sıfır olmayan bir değer alır. Değerleri kullanarak sütun türüne döküm `CAST` operatör. Birincil veya bölüm anahtarının hesaplanmasında kullanılan sütunları güncelleştirme desteklenmiyor. - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -Sorgu ikincil dizini yeniden oluşturur `name` bölümünde `partition_name`. - -Bir sorgu virgülle ayrılmış birkaç komut içerebilir. - -\* MergeTree tabloları mutasyonları için tüm veri parçalarını yeniden yazarak yürütün. Atomiklik yoktur-parçalar, hazır oldukları anda mutasyona uğramış parçalar için ikame edilir ve bir `SELECT` bir mutasyon sırasında yürütülmeye başlayan sorgu, henüz mutasyona uğramamış olan parçalardan gelen verilerle birlikte mutasyona uğramış olan parçalardan gelen verileri görecektir. - -Mutasyonlar tamamen yaratılış sırasına göre sıralanır ve her bir parçaya bu sırayla uygulanır. Mutasyonlar da kısmen ekler ile sıralanır-mutasyon gönderilmeden önce tabloya eklenen veriler mutasyona uğrayacak ve bundan sonra eklenen veriler mutasyona uğramayacaktır. Mutasyonların ekleri hiçbir şekilde engellemediğini unutmayın. - -Mutasyon girişi eklendikten hemen sonra bir mutasyon sorgusu döner(çoğaltılmış tablolar Zookeeper'a, çoğaltılmamış tablolar için-dosya sistemine). Mutasyonun kendisi sistem profili ayarlarını kullanarak eşzamansız olarak yürütür. Mutasyonların ilerlemesini izlemek için kullanabilirsiniz [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) Tablo. Başarıyla gönderilen BIR mutasyon, ClickHouse sunucuları yeniden başlatılmış olsa bile yürütmeye devam edecektir. Gönderildikten sonra mutasyonu geri almanın bir yolu yoktur, ancak mutasyon herhangi bir nedenle sıkışmışsa, [`KILL MUTATION`](misc.md#kill-mutation) sorgu. - -Bitmiş mutasyonlar için girişler hemen silinmez (korunmuş girişlerin sayısı, `finished_mutations_to_keep` depolama motoru parametresi). Eski mutasyon girişleri silinir. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/tr/sql_reference/statements/create.md b/docs/tr/sql_reference/statements/create.md deleted file mode 100644 index 5479034ad98..00000000000 --- a/docs/tr/sql_reference/statements/create.md +++ /dev/null @@ -1,305 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 35 -toc_title: CREATE ---- - -# Sorgu oluştur {#create-queries} - -## CREATE DATABASE {#query-language-create-database} - -Veritabanı oluşturur. - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] -``` - -### Yanlar {#clauses} - -- `IF NOT EXISTS` - Eğer... `db_name` veritabanı zaten var, daha sonra ClickHouse yeni bir veritabanı oluşturmuyor ve: - - - If yan tümcesi belirtilmişse bir istisna atmaz. - - Bir istisna atar if yan tümcesi belirtilmemiş. - -- `ON CLUSTER` - ClickHouse oluşturur `db_name` belirtilen bir kümenin tüm sunucularında veritabanı. - -- `ENGINE` - - - [MySQL](../../engines/database_engines/mysql.md) - Uzak MySQL sunucusundan veri almanızı sağlar. - Varsayılan olarak, ClickHouse kendi kullanır [Veritabanı Altyapısı](../../engines/database_engines/index.md). - -## CREATE TABLE {#create-table-query} - -Bu `CREATE TABLE` sorgu çeşitli formlara sahip olabilir. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2], - ... -) ENGINE = engine -``` - -Adlı bir tablo oluşturur ‘name’ in the ‘db’ veritabanı veya geçerli veritabanı ise ‘db’ küme değil, parantez içinde belirtilen yapı ve ‘engine’ motor. -Tablonun yapısı sütun açıklamalarının bir listesidir. Dizinler altyapısı tarafından destekleniyorsa, tablo altyapısı için parametreler olarak gösterilir. - -Bir sütun açıklaması `name type` en basit durumda. Örnek: `RegionID UInt32`. -İfadeler varsayılan değerler için de tanımlanabilir (aşağıya bakın). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -Başka bir tablo ile aynı yapıya sahip bir tablo oluşturur. Tablo için farklı bir motor belirtebilirsiniz. Motor belirtilmemişse, aynı motor için olduğu gibi kullanılacaktır `db2.name2` Tablo. - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS table_function() -``` - -Yapısı ve veri tarafından döndürülen bir tablo oluşturur. [tablo fonksiyonu](../table_functions/index.md). - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -Sonucu gibi bir yapıya sahip bir tablo oluşturur `SELECT` Sorgu, ile ‘engine’ motor ve SELECT verilerle doldurur. - -Her durumda, eğer `IF NOT EXISTS` tablo zaten varsa, sorgu bir hata döndürmez. Bu durumda, sorgu hiçbir şey yapmaz. - -Sonra başka maddeler olabilir `ENGINE` sorguda yan tümcesi. Açıklamalarda tabloların nasıl oluşturulacağına ilişkin ayrıntılı belgelere bakın [masa motorları](../../engines/table_engines/index.md#table_engines). - -### Varsayılan Değerler {#create-default-values} - -Sütun açıklaması, aşağıdaki yollardan biriyle varsayılan değer için bir ifade belirtebilir:`DEFAULT expr`, `MATERIALIZED expr`, `ALIAS expr`. -Örnek: `URLDomain String DEFAULT domain(URL)`. - -Varsayılan değer için bir ifade tanımlanmamışsa, varsayılan değerler sayılar için sıfırlar, dizeler için boş dizeler, diziler için boş diziler ve `0000-00-00` tarihler için veya `0000-00-00 00:00:00` zamanla tarihler için. Boş alanlar desteklenmez. - -Varsayılan ifade tanımlanmışsa, sütun türü isteğe bağlıdır. Açıkça tanımlanmış bir tür yoksa, varsayılan ifade türü kullanılır. Örnek: `EventDate DEFAULT toDate(EventTime)` – the ‘Date’ türü için kullanılacak ‘EventDate’ sütun. - -Veri türü ve varsayılan ifade açıkça tanımlanırsa, bu ifade type casting işlevleri kullanılarak belirtilen türe aktarılır. Örnek: `Hits UInt32 DEFAULT 0` aynı şeyi ifade eder `Hits UInt32 DEFAULT toUInt32(0)`. - -Default expressions may be defined as an arbitrary expression from table constants and columns. When creating and changing the table structure, it checks that expressions don't contain loops. For INSERT, it checks that expressions are resolvable – that all columns they can be calculated from have been passed. - -`DEFAULT expr` - -Normal varsayılan değer. INSERT sorgusu karşılık gelen sütunu belirtmezse, ilgili ifadeyi hesaplayarak doldurulur. - -`MATERIALIZED expr` - -Somut ifade. Böyle bir sütun INSERT için belirtilemez, çünkü her zaman hesaplanır. -Sütun listesi olmayan bir ekleme için bu sütunlar dikkate alınmaz. -Buna ek olarak, bir SELECT sorgusunda Yıldız İşareti kullanıldığında bu sütun değiştirilmez. Bu, dökümü kullanarak elde edilen değişmezi korumaktır `SELECT *` sütun listesini belirtmeden INSERT kullanarak tabloya geri eklenebilir. - -`ALIAS expr` - -Eşanlamlı sözcük. Böyle bir sütun tabloda hiç depolanmaz. -Değerleri bir tabloya eklenemez ve bir SELECT sorgusunda Yıldız İşareti kullanılırken değiştirilmez. -Sorgu ayrıştırma sırasında diğer ad genişletilirse, seçimlerde kullanılabilir. - -Yeni sütunlar eklemek için ALTER sorgusunu kullanırken, bu sütunlar için eski veriler yazılmaz. Bunun yerine, yeni sütunlar için değerleri olmayan eski verileri okurken, ifadeler varsayılan olarak anında hesaplanır. Ancak, ifadeleri çalıştırmak sorguda belirtilmeyen farklı sütunlar gerektiriyorsa, bu sütunlar ayrıca okunur, ancak yalnızca buna ihtiyaç duyan veri blokları için okunur. - -Bir tabloya yeni bir sütun eklerseniz, ancak daha sonra varsayılan ifadesini değiştirirseniz, eski veriler için kullanılan değerler değişir (değerlerin diskte depolanmadığı veriler için). Arka plan birleştirmeleri çalıştırırken, birleştirme parçalarından birinde eksik olan sütunların verileri birleştirilmiş parçaya yazıldığını unutmayın. - -İç içe geçmiş veri yapılarındaki öğeler için varsayılan değerleri ayarlamak mümkün değildir. - -### Kısıtlamalar {#constraints} - -Sütun açıklamaları kısıtlamaları ile birlikte tanımlanabilir: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` herhangi bir Boole ifadesi ile olabilir. Tablo için kısıtlamalar tanımlanırsa, her biri her satır için kontrol edilir `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. - -Büyük miktarda kısıtlama eklemek, büyük `INSERT` sorgular. - -### TTL ifadesi {#ttl-expression} - -Değerler için depolama süresini tanımlar. Sadece MergeTree-family tabloları için belirtilebilir. Ayrıntılı açıklama için, bkz. [Sütunlar ve tablolar için TTL](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). - -### Sütun Sıkıştırma Kodekleri {#codecs} - -Varsayılan olarak, ClickHouse `lz4` sıkıştırma yöntemi. İçin `MergeTree`- motor ailesi varsayılan sıkıştırma yöntemini değiştirebilirsiniz [sıkıştırma](../../operations/server_configuration_parameters/settings.md#server-settings-compression) bir sunucu yapılandırması bölümü. Her bir sütun için sıkıştırma yöntemini de tanımlayabilirsiniz. `CREATE TABLE` sorgu. - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -Bir codec bileşeni belirtilmişse, varsayılan codec bileşeni geçerli değildir. Kodekler bir boru hattında birleştirilebilir, örneğin, `CODEC(Delta, ZSTD)`. Projeniz için en iyi codec kombinasyonunu seçmek için, Altınlıkta açıklanana benzer kriterler geçirin [ClickHouse verimliliğini artırmak için yeni Kodlamalar](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) makale. - -!!! warning "Uyarıcı" - ClickHouse veritabanı dosyalarını harici yardımcı programlarla açamazsınız `lz4`. Bunun yerine, özel kullanın [clickhouse-kompresör](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) program. - -Sıkıştırma Aşağıdaki tablo motorları için desteklenir: - -- [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) aile. Sütun sıkıştırma kodeklerini destekler ve varsayılan sıkıştırma yöntemini seçerek [sıkıştırma](../../operations/server_configuration_parameters/settings.md#server-settings-compression) ayarlar. -- [Günlük](../../engines/table_engines/log_family/log_family.md) aile. Kullanır `lz4` sıkıştırma yöntemi varsayılan olarak ve sütun sıkıştırma codec destekler. -- [Koymak](../../engines/table_engines/special/set.md). Yalnızca varsayılan sıkıştırmayı destekledi. -- [Katmak](../../engines/table_engines/special/join.md). Yalnızca varsayılan sıkıştırmayı destekledi. - -ClickHouse ortak amaçlı codec ve özel codec destekler. - -#### Özel Kodekler {#create-query-specialized-codecs} - -Bu kodekler, verilerin belirli özelliklerini kullanarak sıkıştırmayı daha etkili hale getirmek için tasarlanmıştır. Bu kodeklerden bazıları verileri kendileri sıkıştırmaz. Bunun yerine, verileri ortak bir amaç için hazırlarlar codec, bu hazırlık olmadan daha iyi sıkıştırır. - -Özel kodekler: - -- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` delta değerlerini saklamak için kullanılır, böylece `delta_bytes` ham değerlerin maksimum boyutudur. Olası `delta_bytes` değerler: 1, 2, 4, 8. İçin varsayılan değer `delta_bytes` oluyor `sizeof(type)` 1, 2, 4 veya 8'e eşitse. Diğer tüm durumlarda, 1. -- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla: Hızlı, Ölçeklenebilir, Bellek İçi Zaman Serisi Veritabanı](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla: Hızlı, Ölçeklenebilir, Bellek İçi Zaman Serisi Veritabanı](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` ve `DateTime`). Algoritmasının her adımında, codec 64 değerden oluşan bir blok alır, 64x64 bit matrisine koyar, aktarır, kullanılmayan değer bitlerini kırpar ve gerisini bir dizi olarak döndürür. Kullanılmayan bitler, sıkıştırmanın kullanıldığı tüm veri bölümündeki maksimum ve minimum değerler arasında farklılık göstermeyen bitlerdir. - -`DoubleDelta` ve `Gorilla` kodekler, Gorilla TSDB'DE sıkıştırma algoritmasının bileşenleri olarak kullanılır. Gorilla yaklaşımı, zaman damgaları ile yavaş yavaş değişen değerler dizisi olduğunda senaryolarda etkilidir. Zaman damgaları tarafından etkili bir şekilde sıkıştırılır `DoubleDelta` codec ve değerler etkin bir şekilde sıkıştırılır `Gorilla` codec. Örneğin, etkili bir şekilde saklanan bir tablo elde etmek için, aşağıdaki yapılandırmada oluşturabilirsiniz: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### Ortak Amaç {#create-query-common-purpose-codecs} - -Cod codecsec codecs'ler: - -- `NONE` — No compression. -- `LZ4` — Lossless [veri sıkıştırma algoritması](https://github.com/lz4/lz4) varsayılan olarak kullanılır. Lz4 hızlı sıkıştırma uygular. -- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` varsayılan düzeyi uygular. Olası seviyeleri: \[1, 12\]. Önerilen seviye aralığı: \[4, 9\]. -- `ZSTD[(level)]` — [Zstd sıkıştırma algoritması](https://en.wikipedia.org/wiki/Zstandard) yapılandırılabilir ile `level`. Olası seviyeler: \[1, 22\]. Varsayılan değer: 1. - -Yüksek Sıkıştırma seviyeleri asimetrik senaryolar için kullanışlıdır, örneğin bir kez sıkıştırın, tekrar tekrar sıkıştırın. Daha yüksek seviyeler daha iyi sıkıştırma ve daha yüksek CPU kullanımı anlamına gelir. - -## Geçici Tablolar {#temporary-tables} - -ClickHouse aşağıdaki özelliklere sahip geçici tabloları destekler: - -- Bağlantı kaybolursa da dahil olmak üzere oturum sona erdiğinde geçici tablolar kaybolur. -- Geçici bir tablo yalnızca bellek altyapısını kullanır. -- DB geçici bir tablo için belirtilemez. Veritabanları dışında oluşturulur. -- Tüm küme sunucularında dağıtılmış DDL sorgusu ile geçici bir tablo oluşturmak imkansız (kullanarak `ON CLUSTER`): bu tablo yalnızca geçerli oturumda bulunur. -- Geçici bir tablo başka bir ile aynı ada sahip ve bir sorgu DB belirtmeden tablo adını belirtir, geçici tablo kullanılır. -- Dağıtılmış sorgu işleme için bir sorguda kullanılan geçici tablolar uzak sunuculara geçirilir. - -Geçici bir tablo oluşturmak için aşağıdaki sözdizimini kullanın: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -Çoğu durumda, geçici tablolar el ile oluşturulmaz, ancak bir sorgu için veya dağıtılmış için dış verileri kullanırken `(GLOBAL) IN`. Daha fazla bilgi için uygun bölümlere bakın - -İle tabloları kullanmak mümkündür [Motor = bellek](../../engines/table_engines/special/memory.md) geçici tablolar yerine. - -## Dağıtılmış DDL sorguları (küme yan tümcesinde) {#distributed-ddl-queries-on-cluster-clause} - -Bu `CREATE`, `DROP`, `ALTER`, ve `RENAME` sorgular, bir kümede dağıtılmış yürütmeyi destekler. -Örneğin, aşağıdaki sorgu oluşturur `all_hits` `Distributed` her ana bilgisayarda tablo `cluster`: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -Bu sorguları doğru bir şekilde çalıştırmak için, her ana bilgisayarın aynı küme tanımına sahip olması gerekir (senkronizasyon yapılandırmalarını basitleştirmek için zookeeper'dan değiştirmeleri kullanabilirsiniz). Ayrıca ZooKeeper sunucularına bağlanmaları gerekir. -Bazı ana bilgisayarlar şu anda mevcut olmasa bile, sorgunun yerel sürümü sonunda kümedeki her ana bilgisayarda uygulanır. Tek bir ana makine içinde sorguları yürütme sırası garanti edilir. - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -Bir görünüm oluşturur. İki tür görüş vardır: normal ve SOMUTLAŞTIRILMIŞ. - -Normal görünümler herhangi bir veri depolamaz, ancak başka bir tablodan bir okuma gerçekleştirir. Başka bir deyişle, normal bir görünüm kaydedilmiş bir sorgudan başka bir şey değildir. Bir görünümden okurken, bu kaydedilmiş sorgu FROM yan tümcesinde bir alt sorgu olarak kullanılır. - -Örnek olarak, bir görünüm oluşturduğunuzu varsayalım: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -ve bir sorgu yazdı: - -``` sql -SELECT a, b, c FROM view -``` - -Bu sorgu, alt sorguyu kullanmaya tam olarak eşdeğerdir: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -Materialized görünümler, ilgili SELECT sorgusu tarafından dönüştürülmüş verileri depolar. - -Olmadan hayata bir görünüm oluştururken `TO [db].[table]`, you must specify ENGINE – the table engine for storing data. - -İle somutlaştırılmış bir görünüm oluştururken `TO [db].[table]`, kullanma mustmalısınız `POPULATE`. - -Materialized görünüm aşağıdaki gibi düzenlenmiştir: SELECT belirtilen tabloya veri eklerken, eklenen verilerin bir kısmı bu SELECT sorgusu tarafından dönüştürülür ve sonuç görünümde eklenir. - -Doldur belirtirseniz, varolan tablo verilerini oluştururken görünümde, sanki bir `CREATE TABLE ... AS SELECT ...` . Aksi takdirde, sorgu yalnızca görünümü oluşturduktan sonra tabloya eklenen verileri içerir. Görünüm oluşturma sırasında tabloya eklenen veriler EKLENMEYECEĞİNDEN, doldur kullanmanızı önermiyoruz. - -A `SELECT` sorgu içerebilir `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Note that the corresponding conversions are performed independently on each block of inserted data. For example, if `GROUP BY` ayarlanır, veri ekleme sırasında toplanır, ancak yalnızca tek bir eklenen veri paketi içinde toplanır. Veriler daha fazla toplanmayacaktır. Özel durum, bağımsız olarak veri toplama, gibi gerçekleştiren bir motor kullanırken olur `SummingMergeTree`. - -Yürütme `ALTER` somut görünümlerle ilgili sorgular tam olarak geliştirilmemiştir, bu nedenle rahatsız edici olabilirler. Eğer hayata görünüm inşaat kullanıyorsa `TO [db.]name` yapabilirsiniz `DETACH` the view, run `ALTER` hedef tablo için ve sonra `ATTACH` daha önce müstakil (`DETACH`) görünüm. - -Görünümler normal tablolarla aynı görünür. Örneğin, bunlar sonucu listelenir `SHOW TABLES` sorgu. - -Görünümleri silmek için ayrı bir sorgu yok. Bir görünümü silmek için şunları kullanın `DROP TABLE`. - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` - -Oluşturuyor [dış sözlük](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) verilen ile [yapılı](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md), [kaynaklı](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md), [düzen](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) ve [ömür](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md). - -Dış sözlük yapısı özniteliklerden oluşur. Sözlük öznitelikleri tablo sütunlarına benzer şekilde belirtilir. Tek gerekli öznitelik özelliği türüdür, diğer tüm özelliklerin varsayılan değerleri olabilir. - -Sözlüğe bağlı olarak [düzen](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md) bir veya daha fazla öznitelik sözlük anahtarları olarak belirtilebilir. - -Daha fazla bilgi için, bkz. [Dış Söz Dictionarieslükler](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md) bölme. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/create/) diff --git a/docs/tr/sql_reference/statements/insert_into.md b/docs/tr/sql_reference/statements/insert_into.md deleted file mode 100644 index 1aafdc368e9..00000000000 --- a/docs/tr/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 34 -toc_title: INSERT INTO ---- - -## INSERT {#insert} - -Veri ekleme. - -Temel sorgu biçimi: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -Sorgu eklemek için sütunların bir listesini belirtebilirsiniz `[(c1, c2, c3)]`. Bu durumda, sütunların geri kalanı ile doldurulur: - -- Hesaplanan değerler `DEFAULT` tablo tanımında belirtilen ifadeler. -- Sıfırlar ve boş dizeler, eğer `DEFAULT` ifadeler tanımlanmamıştır. - -Eğer [strict\_ınsert\_defaults = 1](../../operations/settings/settings.md), sahip olmayan sütunlar `DEFAULT` tanımlanan sorguda listelenmelidir. - -Veri herhangi bir İNSERT geçirilebilir [biçimli](../../interfaces/formats.md#formats) ClickHouse tarafından desteklenmektedir. Biçim sorguda açıkça belirtilmelidir: - -``` sql -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: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -ClickHouse, veriden önce tüm boşlukları ve bir satır beslemesini (varsa) kaldırır. Bir sorgu oluştururken, sorgu işleçlerinden sonra verileri yeni bir satıra koymanızı öneririz (veriler boşluklarla başlarsa bu önemlidir). - -Örnek: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -Komut satırı istemcisini veya HTTP arabirimini kullanarak verileri sorgudan ayrı olarak ekleyebilirsiniz. Daha fazla bilgi için bölüme bakın “[Arabirimler](../../interfaces/index.md#interfaces)”. - -### Kısıtlamalar {#constraints} - -Tablo varsa [kısıtlamalar](create.md#constraints), their expressions will be checked for each row of inserted data. If any of those constraints is not satisfied — server will raise an exception containing constraint name and expression, the query will be stopped. - -### Sonuçları Ekleme `SELECT` {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -Sütunlar, SELECT yan tümcesindeki konumlarına göre eşleştirilir. Ancak, SELECT ifadesi ve INSERT için tablo adları farklı olabilir. Gerekirse, tip döküm yapılır. - -Değerler dışındaki veri biçimlerinin hiçbiri, aşağıdaki gibi ifadelere değerler ayarlamasına izin vermez `now()`, `1 + 2` ve bu yüzden. Değerler biçimi, ifadelerin sınırlı kullanımına izin verir, ancak bu önerilmez, çünkü bu durumda verimsiz kod yürütme için kullanılır. - -Veri bölümlerini değiştirmek için diğer sorgular desteklenmiyor: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. -Ancak, eski verileri kullanarak silebilirsiniz `ALTER TABLE ... DROP PARTITION`. - -`FORMAT` yan tümcesi sorgu sonunda belirtilmelidir eğer `SELECT` yan tümcesi tablo işlevi içerir [girdi()](../table_functions/input.md). - -### Performans Konuları {#performance-considerations} - -`INSERT` giriş verilerini birincil anahtarla sıralar ve bunları bir bölüm anahtarı ile bölümlere ayırır. Bir kerede birkaç bölüme veri eklerseniz, bu veri tabanının performansını önemli ölçüde azaltabilir. `INSERT` sorgu. Bunu önlemek için: - -- Bir seferde 100.000 satır gibi oldukça büyük gruplar halinde veri ekleyin. -- Clickhouse'a yüklemeden önce verileri bir bölüm anahtarıyla gruplandırın. - -Eğer performans azalmaz: - -- Veri gerçek zamanlı olarak eklenir. -- Genellikle zamana göre sıralanır veri yükleyin. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/tr/sql_reference/statements/misc.md b/docs/tr/sql_reference/statements/misc.md deleted file mode 100644 index 689fc8cd77d..00000000000 --- a/docs/tr/sql_reference/statements/misc.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 39 -toc_title: "Di\u011Fer" ---- - -# Çeşitli Sorgular {#miscellaneous-queries} - -## ATTACH {#attach} - -Bu sorgu tam olarak aynıdır `CREATE`, ama - -- Kelime yerine `CREATE` kelime kullanır `ATTACH`. -- Sorgu diskte veri oluşturmaz, ancak verilerin zaten uygun yerlerde olduğunu ve yalnızca tablo hakkında bilgi sunucuya eklediğini varsayar. - Bir ekleme sorgusu çalıştırdıktan sonra, sunucu tablonun varlığı hakkında bilgi sahibi olacaktır. - -Tablo daha önce ayrılmış olsaydı (`DETACH`), yapısının bilindiği anlamına gelir, yapıyı tanımlamadan steno kullanabilirsiniz. - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Bu sorgu, sunucu başlatılırken kullanılır. Sunucu, tablo meta verilerini dosyalar olarak depolar `ATTACH` başlangıçta çalıştığı sorgular (sunucuda açıkça oluşturulan sistem tabloları hariç). - -## CHECK TABLE {#check-table} - -Tablodaki verilerin bozuk olup olmadığını denetler. - -``` sql -CHECK TABLE [db.]name -``` - -Bu `CHECK TABLE` sorgu, gerçek dosya boyutlarını sunucuda depolanan beklenen değerlerle karşılaştırır. Dosya boyutları depolanan değerlerle eşleşmiyorsa, verilerin bozuk olduğu anlamına gelir. Bu, örneğin, sorgu yürütme sırasında bir sistem çökmesine neden olabilir. - -Sorgu yanıtı içerir `result` tek satırlı sütun. Satır bir değere sahiptir -[Boeanoleanean](../../sql_reference/data_types/boolean.md) tür: - -- 0-tablodaki veriler bozuk. -- 1 - veri bütünlüğünü korur. - -Bu `CHECK TABLE` sorgu Aşağıdaki tablo motorlarını destekler: - -- [Günlük](../../engines/table_engines/log_family/log.md) -- [TinyLog](../../engines/table_engines/log_family/tinylog.md) -- [StripeLog](../../engines/table_engines/log_family/stripelog.md) -- [MergeTree ailesi](../../engines/table_engines/mergetree_family/mergetree.md) - -Başka bir tablo motorları ile tablolar üzerinde gerçekleştirilen bir özel duruma neden olur. - -Motor fromlardan `*Log` aile başarısızlık otomatik veri kurtarma sağlamaz. Kullan... `CHECK TABLE` veri kaybını zamanında izlemek için sorgu. - -İçin `MergeTree` aile motorları, `CHECK TABLE` sorgu, yerel sunucudaki bir tablonun her bir veri bölümü için bir kontrol durumunu gösterir. - -**Veri bozuksa** - -Tablo bozuksa, bozuk olmayan verileri başka bir tabloya kopyalayabilirsiniz. Bunu yapmak için : - -1. Bozuk tablo ile aynı yapıya sahip yeni bir tablo oluşturun. Bunu yapmak için sorguyu yürütün `CREATE TABLE AS `. -2. Ayarla... [max\_threads](../../operations/settings/settings.md#settings-max_threads) bir sonraki sorguyu tek bir iş parçacığında işlemek için 1 değeri. Bunu yapmak için sorguyu çalıştırın `SET max_threads = 1`. -3. Sorgu yürütme `INSERT INTO SELECT * FROM `. Bu istek bozuk olmayan verileri bozuk tablodan başka bir tabloya kopyalar. Yalnızca bozuk parçadan önceki veriler kopyalanır. -4. Yeniden Başlat `clickhouse-client` sıfırlamak için `max_threads` değer. - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Aşağıdaki döndürür `String` sütun tipi: - -- `name` — Column name. -- `type`— Column type. -- `default_type` — Clause that is used in [varsayılan ifade](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` veya `ALIAS`). Varsayılan ifade belirtilmemişse, sütun boş bir dize içerir. -- `default_expression` — Value specified in the `DEFAULT` yan. -- `comment_expression` — Comment text. - -İç içe veri yapıları çıktı “expanded” biçimli. Her sütun ayrı ayrı gösterilir, bir noktadan sonra adı ile. - -## DETACH {#detach} - -Hakkında bilgi siler ‘name’ sunucudan tablo. Sunucu, tablonun varlığını bilmeyi durdurur. - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Bu tablonun veri veya meta verileri silmez. Bir sonraki sunucu lansmanında, sunucu meta verileri okuyacak ve tablo hakkında tekrar bilgi edinecektir. -Benzer şekilde, bir “detached” tablo kullanılarak yeniden eklenebilir `ATTACH` sorgu (bunlar için depolanan meta verilere sahip olmayan sistem tabloları hariç). - -Hiç yok... `DETACH DATABASE` sorgu. - -## DROP {#drop} - -Bu sorgu iki türü vardır: `DROP DATABASE` ve `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -İçindeki tüm tabloları siler ‘db’ veritabanı, daha sonra siler ‘db’ veritabanı kendisi. -Eğer `IF EXISTS` belirtilen, veritabanı yoksa bir hata döndürmez. - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Tabloyu siler. -Eğer `IF EXISTS` belirtilmişse, tablo yoksa veya veritabanı yoksa bir hata döndürmez. - - DROP DICTIONARY [IF EXISTS] [db.]name - -Sözlük Delets. -Eğer `IF EXISTS` belirtilmişse, tablo yoksa veya veritabanı yoksa bir hata döndürmez. - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -Bir tek döndürür `UInt8`- tek değeri içeren sütun yazın `0` tablo veya veritabanı yoksa veya `1` tablo belirtilen veritabanında varsa. - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -Şu anda çalışan sorguları zorla sonlandırmaya çalışır. -Sonlandırılacak sorgular sistemden seçilir.tanımlanan kriterleri kullanarak işlemler tablosu `WHERE` fıkra ofsı `KILL` sorgu. - -Örnekler: - -``` sql --- Forcibly terminates all queries with the specified query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Synchronously terminates all queries run by 'username': -KILL QUERY WHERE user='username' SYNC -``` - -Salt okunur kullanıcılar yalnızca kendi sorgularını durdurabilir. - -Varsayılan olarak, sorguların zaman uyumsuz sürümü kullanılır (`ASYNC`), sorguların durduğuna dair onay beklemez. - -Senkron versiyonu (`SYNC`) tüm sorguların durmasını bekler ve durduğunda her işlem hakkında bilgi görüntüler. -Yanıt içerir `kill_status` aşağıdaki değerleri alabilen sütun: - -1. ‘finished’ – The query was terminated successfully. -2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. -3. The other values ​​explain why the query can't be stopped. - -Bir test sorgusu (`TEST`) yalnızca kullanıcının haklarını denetler ve durdurulacak sorguların bir listesini görüntüler. - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -İptal etmek ve kaldırmak için çalışır [mutasyonlar](alter.md#alter-mutations) şu anda yürütülüyor. İptal etmek için mutationsasyonlar seçilir [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) tablo tarafından belirtilen filtreyi kullanarak `WHERE` fıkra ofsı `KILL` sorgu. - -Bir test sorgusu (`TEST`) yalnızca kullanıcının haklarını denetler ve durdurulacak sorguların bir listesini görüntüler. - -Örnekler: - -``` sql --- Cancel and remove all mutations of the single table: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Cancel the specific mutation: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). - -Mutasyon tarafından yapılan değişiklikler geri alınmaz. - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -Bu sorgu, bir tablo altyapısı ile tablolar için veri parçaları planlanmamış birleştirme başlatmaya çalışır. [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) aile. - -Bu `OPTMIZE` sorgu için de desteklenmektedir [MaterializedView](../../engines/table_engines/special/materializedview.md) ve... [Arabellek](../../engines/table_engines/special/buffer.md) motorlar. Diğer tablo motorları desteklenmiyor. - -Ne zaman `OPTIMIZE` ile kullanılır [ReplicatedMergeTree](../../engines/table_engines/mergetree_family/replication.md) Tablo motorları ailesi, ClickHouse birleştirme için bir görev oluşturur ve tüm düğümlerde yürütülmeyi bekler (eğer `replication_alter_partitions_sync` ayar etkinse) ' dir. - -- Eğer `OPTIMIZE` herhangi bir nedenle bir birleştirme gerçekleştirmez, müşteriye bildirmez. Bildirimleri etkinleştirmek için [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) ayar. -- Belirtir aseniz bir `PARTITION`, sadece belirtilen bölüm optimize edilmiştir. [Bölüm ifadesi nasıl ayarlanır](alter.md#alter-how-to-specify-part-expr). -- Belirtir specifyseniz `FINAL`, optimizasyon, tüm veriler zaten bir parçada olsa bile gerçekleştirilir. -- Belirtir specifyseniz `DEDUPLICATE`, sonra tamamen aynı satırlar tekilleştirilecektir (tüm sütunlar karşılaştırılır), sadece MergeTree motoru için anlamlıdır. - -!!! warning "Uyarıcı" - `OPTIMIZE` Düzelt canemiyorum “Too many parts” hatasız. - -## RENAME {#misc_operations-rename} - -Bir veya daha fazla tabloyu yeniden adlandırır. - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -Tüm tablolar genel kilitleme altında yeniden adlandırılır. Tabloları yeniden adlandırma hafif bir işlemdir. İÇİN'DEN sonra başka bir veritabanı belirttiyseniz, tablo bu veritabanına taşınacaktır. Ancak, veritabanlarına sahip dizinlerin aynı dosya sisteminde bulunması gerekir (aksi takdirde bir hata döndürülür). - -## SET {#query-set} - -``` sql -SET param = value -``` - -Atıyor `value` to the `param` [ayar](../../operations/settings/index.md) geçerli oturum için. Değiştiremezsiniz [sunucu ayarları](../../operations/server_configuration_parameters/index.md) bu şekilde. - -Belirtilen ayarlar profilindeki tüm değerleri tek bir sorguda da ayarlayabilirsiniz. - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -Daha fazla bilgi için, bkz. [Ayarlar](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -Bir tablodaki tüm verileri kaldırır. Fık thera ne zaman `IF EXISTS` tablo yoksa, sorgu bir hata döndürür. - -Bu `TRUNCATE` sorgu için desteklenmiyor [Görünüm](../../engines/table_engines/special/view.md), [Dosya](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) ve [Boş](../../engines/table_engines/special/null.md) masa motorları. - -## USE {#use} - -``` sql -USE db -``` - -Oturum için geçerli veritabanını ayarlamanızı sağlar. -Geçerli veritabanı, veritabanı sorguda tablo adından önce bir nokta ile açıkça tanımlanmamışsa, tabloları aramak için kullanılır. -Bir oturum kavramı olmadığından, bu sorgu HTTP protokolünü kullanırken yapılamaz. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/tr/sql_reference/statements/select.md b/docs/tr/sql_reference/statements/select.md deleted file mode 100644 index 287a8029ee9..00000000000 --- a/docs/tr/sql_reference/statements/select.md +++ /dev/null @@ -1,610 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 33 -toc_title: SELECT ---- - -# Select Queries sözdizimi {#select-queries-syntax} - -`SELECT` veri alma gerçekleştirir. - -``` sql -[WITH expr_list|(subquery)] -SELECT [DISTINCT] expr_list -[FROM [db.]table | (subquery) | table_function] [FINAL] -[SAMPLE sample_coeff] -[ARRAY JOIN ...] -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN (subquery)|table USING columns_list -[PREWHERE expr] -[WHERE expr] -[GROUP BY expr_list] [WITH TOTALS] -[HAVING expr] -[ORDER BY expr_list] -[LIMIT [offset_value, ]n BY columns] -[LIMIT [n, ]m] -[UNION ALL ...] -[INTO OUTFILE filename] -[FORMAT format] -``` - -Tüm yan tümceleri isteğe bağlıdır, hemen sonra ifadelerin gerekli listesi hariç seçin. -Aşağıdaki yan tümceleri sorgu yürütme konveyör hemen hemen aynı sırada açıklanmıştır. - -Sorgu atlarsa `DISTINCT`, `GROUP BY` ve `ORDER BY` CLA andus Andes and the `IN` ve `JOIN` alt sorgular, sorgu o (1) RAM miktarını kullanarak tamamen akış işlenecektir. -Aksi takdirde, uygun kısıtlamalar belirtilmezse, sorgu çok fazla RAM tüketebilir: `max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`. Daha fazla bilgi için bölüme bakın “Settings”. Harici sıralama (geçici tabloları bir diske kaydetme) ve harici toplama kullanmak mümkündür. `The system does not have "merge join"`. - -### Fık WİTHRA ile {#with-clause} - -Bu bölüm, ortak tablo ifadeleri için destek sağlar ([CTE](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL)), bazı sınırlamalar ile: -1. Özyinelemeli sorgular desteklenmiyor -2. Alt sorgu bölüm ile birlikte kullanıldığında, sonuç tam olarak bir satır ile skaler olmalıdır -3. İfadenin sonuçları alt sorgularda kullanılamaz -WITH yan tümcesi ifadeleri sonuçları SELECT yan tümcesi içinde kullanılabilir. - -Örnek 1: Sabit ifadeyi aşağıdaki gibi kullanma “variable” - -``` sql -WITH '2019-08-01 15:23:00' as ts_upper_bound -SELECT * -FROM hits -WHERE - EventDate = toDate(ts_upper_bound) AND - EventTime <= ts_upper_bound -``` - -Örnek 2: SELECT yan tümcesi sütun listesinden toplam(bayt) ifade sonucunu çıkarma - -``` sql -WITH sum(bytes) as s -SELECT - formatReadableSize(s), - table -FROM system.parts -GROUP BY table -ORDER BY s -``` - -Örnek 3: skaler alt sorgu sonuçlarını kullanma - -``` sql -/* this example would return TOP 10 of most huge tables */ -WITH - ( - SELECT sum(bytes) - FROM system.parts - WHERE active - ) AS total_disk_usage -SELECT - (sum(bytes) / total_disk_usage) * 100 AS table_disk_usage, - table -FROM system.parts -GROUP BY table -ORDER BY table_disk_usage DESC -LIMIT 10 -``` - -Örnek 4: alt sorguda ifadeyi yeniden kullanma -Alt sorgularda ifade kullanımı için geçerli sınırlama için bir geçici çözüm olarak çoğaltabilirsiniz. - -``` sql -WITH ['hello'] AS hello -SELECT - hello, - * -FROM -( - WITH ['hello'] AS hello - SELECT hello -) -``` - -``` text -┌─hello─────┬─hello─────┐ -│ ['hello'] │ ['hello'] │ -└───────────┴───────────┘ -``` - -### Fık FROMRAS FROMINDAN {#select-from} - -FROM yan tümcesi atlanırsa, veriler `system.one` Tablo. -Bu `system.one` tablo tam olarak bir satır içerir (bu tablo diğer Dbms'lerde bulunan çift tablo ile aynı amacı yerine getirir). - -Bu `FROM` yan tümcesi veri okumak için kaynak belirtir: - -- Tablo -- Alt sorgu -- [Tablo fonksiyonu](../table_functions/index.md) - -`ARRAY JOIN` ve düzenli `JOIN` ayrıca dahil edilebilir (aşağıya bakınız). - -Bunun yerine bir tablo, `SELECT` alt sorgu parantez içinde belirtilebilir. -Standart SQL aksine, bir eşanlamlı bir alt sorgudan sonra belirtilmesi gerekmez. - -Bir sorguyu yürütmek için, sorguda listelenen tüm sütunlar uygun tablodan ayıklanır. Dış sorgu için gerekli olmayan tüm sütunlar alt sorgulardan atılır. -Bir sorgu herhangi bir sütun listelemezse (örneğin, `SELECT count() FROM t`), satır sayısını hesaplamak için yine de tablodan bir sütun çıkarılır (en küçük olanı tercih edilir). - -#### Son değiştirici {#select-from-final} - -Tablolardan veri seçerken uygulanabilir [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)- motor ailesi dışında `GraphiteMergeTree`. Ne zaman `FINAL` belirtilen, ClickHouse sonucu döndürmeden önce verileri tam olarak birleştirir ve böylece verilen tablo altyapısı için birleştirmeler sırasında gerçekleşen tüm veri dönüşümlerini gerçekleştirir. - -Ayrıca için desteklenen: -- [Çoğaltıyordu](../../engines/table_engines/mergetree_family/replication.md) sürümleri `MergeTree` motorlar. -- [Görünüm](../../engines/table_engines/special/view.md), [Arabellek](../../engines/table_engines/special/buffer.md), [Dağılı](../../engines/table_engines/special/distributed.md), ve [MaterializedView](../../engines/table_engines/special/materializedview.md) üzerinden oluşturul ,maları koşuluyla diğer motorlar üzerinde çalışan motorlar `MergeTree`- motor masaları. - -Kullanan sorgular `FINAL` olmayan benzer sorgular kadar hızlı Yürüt ,ülür, çünkü: - -- Sorgu tek bir iş parçacığında yürütülür ve veri sorgu yürütme sırasında birleştirilir. -- İle sorgular `FINAL` sorguda belirtilen sütunlara ek olarak birincil anahtar sütunlarını okuyun. - -Çoğu durumda, kullanmaktan kaçının `FINAL`. - -### Örnek Madde {#select-sample-clause} - -Bu `SAMPLE` yan tümcesi yaklaşık sorgu işleme için izin verir. - -Veri örneklemesi etkinleştirildiğinde, sorgu tüm veriler üzerinde değil, yalnızca belirli bir veri kesirinde (örnek) gerçekleştirilir. Örneğin, tüm ziyaretler için istatistikleri hesaplamanız gerekiyorsa, sorguyu tüm ziyaretlerin 1/10 kesirinde yürütmek ve ardından sonucu 10 ile çarpmak yeterlidir. - -Yaklaşık sorgu işleme aşağıdaki durumlarda yararlı olabilir: - -- Sıkı zamanlama gereksinimleriniz olduğunda (\<100ms gibi), ancak bunları karşılamak için ek donanım kaynaklarının maliyetini haklı çıkaramazsınız. -- Ham verileriniz doğru olmadığında, yaklaşım kaliteyi belirgin şekilde düşürmez. -- İş gereksinimleri yaklaşık sonuçları hedef alır (maliyet etkinliği için veya kesin sonuçları premium kullanıcılara pazarlamak için). - -!!! note "Not" - Örneklemeyi yalnızca aşağıdaki tablolarla kullanabilirsiniz: [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) tablo oluşturma sırasında örnekleme ifadesi belirtilmişse (bkz [MergeTree motoru](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table)). - -Veri örneklemesinin özellikleri aşağıda listelenmiştir: - -- Veri örneklemesi deterministik bir mekanizmadır. Aynı sonucu `SELECT .. SAMPLE` sorgu her zaman aynıdır. -- Örnekleme, farklı tablolar için sürekli olarak çalışır. Tek bir örnekleme anahtarına sahip tablolar için, aynı katsayıya sahip bir örnek her zaman olası verilerin aynı alt kümesini seçer. Örneğin, kullanıcı kimlikleri örneği, farklı tablolardan olası tüm kullanıcı kimliklerinin aynı alt kümesine sahip satırları alır. Bu, örneği alt sorgularda kullanabileceğiniz anlamına gelir. [IN](#select-in-operators) yan. Ayrıca, kullanarak örnekleri katılabilir [JOIN](#select-join) yan. -- Örnekleme, bir diskten daha az veri okumayı sağlar. Örnekleme anahtarını doğru belirtmeniz gerektiğini unutmayın. Daha fazla bilgi için, bkz. [MergeTree tablosu oluşturma](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). - -İçin `SAMPLE` yan tümcesi aşağıdaki sözdizimi desteklenir: - -| SAMPLE Clause Syntax | Açıklama | -|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `SAMPLE k` | Burada `k` 0'dan 1'e kadar olan sayıdır.
Sorgu üzerinde yürütülür `k` verilerin kesir. Mesela, `SAMPLE 0.1` sorguyu verilerin %10'unda çalıştırır. [Daha fazla bilgi edinin](#select-sample-k) | -| `SAMPLE n` | Burada `n` yeterince büyük bir tamsayıdır.
Sorgu en az bir örnek üzerinde yürütülür `n` satırlar (ancak bundan önemli ölçüde daha fazla değil). Mesela, `SAMPLE 10000000` sorguyu en az 10.000.000 satır çalıştırır. [Daha fazla bilgi edinin](#select-sample-n) | -| `SAMPLE k OFFSET m` | Burada `k` ve `m` 0'dan 1'e kadar olan sayılardır.
Sorgu bir örnek üzerinde yürütülür `k` verilerin kesir. Örnek için kullanılan veriler, `m` bölme. [Daha fazla bilgi edinin](#select-sample-offset) | - -#### SAMPLE K {#select-sample-k} - -Burada `k` 0'dan 1'e kadar olan sayıdır (hem kesirli hem de ondalık gösterimler desteklenir). Mesela, `SAMPLE 1/2` veya `SAMPLE 0.5`. - -İn a `SAMPLE k` fık ,ra, örnek alınır `k` verilerin kesir. Örnek aşağıda gösterilmiştir: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -Bu örnekte, sorgu 0.1 (%10) veri örneği üzerinde yürütülür. Toplam fonksiyonların değerleri otomatik olarak düzeltilmez, bu nedenle yaklaşık bir sonuç elde etmek için, değer `count()` elle 10 ile çarpılır. - -#### SAMPLE N {#select-sample-n} - -Burada `n` yeterince büyük bir tamsayıdır. Mesela, `SAMPLE 10000000`. - -Bu durumda, sorgu en az bir örnek üzerinde yürütülür `n` satırlar (ancak bundan önemli ölçüde daha fazla değil). Mesela, `SAMPLE 10000000` sorguyu en az 10.000.000 satır çalıştırır. - -Veri okuma için minimum birim bir granül olduğundan (boyutu `index_granularity` ayar), granülün boyutundan çok daha büyük bir örnek ayarlamak mantıklıdır. - -Kullanırken `SAMPLE n` yan tümce, verilerin hangi göreli yüzde işlendiğini bilmiyorsunuz. Yani toplam fonksiyonların çarpılması gereken katsayıyı bilmiyorsunuz. Kullan... `_sample_factor` sanal sütun yaklaşık sonucu almak için. - -Bu `_sample_factor` sütun dinamik olarak hesaplanan göreli katsayıları içerir. Bu sütun otomatik olarak oluşturulduğunda [oluşturmak](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table) belirtilen örnekleme anahtarına sahip bir tablo. Kullanım örnekleri `_sample_factor` sütun aşağıda gösterilmiştir. - -Masayı düşünelim `visits`, site ziyaretleri ile ilgili istatistikleri içerir. İlk örnek, sayfa görünümlerinin sayısını nasıl hesaplayacağınızı gösterir: - -``` sql -SELECT sum(PageViews * _sample_factor) -FROM visits -SAMPLE 10000000 -``` - -Bir sonraki örnek, toplam ziyaret sayısını nasıl hesaplayacağınızı gösterir: - -``` sql -SELECT sum(_sample_factor) -FROM visits -SAMPLE 10000000 -``` - -Aşağıdaki örnek, ortalama oturum süresinin nasıl hesaplanacağını göstermektedir. Ortalama değerleri hesaplamak için göreli katsayıyı kullanmanız gerekmediğini unutmayın. - -``` sql -SELECT avg(Duration) -FROM visits -SAMPLE 10000000 -``` - -#### SAMPLE K OFFSET M {#select-sample-offset} - -Burada `k` ve `m` 0'dan 1'e kadar olan sayılardır. Örnekler aşağıda gösterilmiştir. - -**Örnek 1** - -``` sql -SAMPLE 1/10 -``` - -Bu örnekte, örnek tüm verilerin 1/10'udur: - -`[++------------]` - -**Örnek 2** - -``` sql -SAMPLE 1/10 OFFSET 1/2 -``` - -Burada, verilerin ikinci yarısından %10'luk bir örnek alınır. - -`[------++------]` - -### Dizi Jo JOİNİN yan tüm Clausecesi {#select-array-join-clause} - -Yürüt allowsmeyi sağlar `JOIN` bir dizi veya iç içe veri yapısı ile. Niyet benzer [arrayJoin](../../sql_reference/functions/array_join.md#functions_arrayjoin) işlev, ancak işlevselliği daha geniştir. - -``` sql -SELECT -FROM -[LEFT] ARRAY JOIN -[WHERE|PREWHERE ] -... -``` - -Yalnızca bir tek belirtebilirsiniz `ARRAY JOIN` bir sorguda yan tümcesi. - -Sorgu yürütme sırası çalışırken en iyi duruma getirilmiştir `ARRAY JOIN`. Rağmen `ARRAY JOIN` her zaman önce belirtilmelidir `WHERE/PREWHERE` fık ,ra, daha önce de yapılabilir `WHERE/PREWHERE` (sonuç bu maddede gerekliyse) veya tamamladıktan sonra (hesaplamaların hacmini azaltmak için). İşlem sırası sorgu iyileştiricisi tarafından denetlenir. - -Desteklenen türleri `ARRAY JOIN` aşağıda listelenmiştir: - -- `ARRAY JOIN` - Bu durumda, boş diziler sonucu dahil değildir `JOIN`. -- `LEFT ARRAY JOIN` Bunun sonucu `JOIN` boş dizilere sahip satırlar içerir. Boş bir dizinin değeri, dizi öğesi türü için varsayılan değere ayarlanır (genellikle 0, boş dize veya NULL). - -Aşağıdaki örnekler kullanımını göstermektedir `ARRAY JOIN` ve `LEFT ARRAY JOIN` yanlar. Bir tablo oluşturalım [Dizi](../../sql_reference/data_types/array.md) sütun yazın ve içine değerler ekleyin: - -``` sql -CREATE TABLE arrays_test -( - s String, - arr Array(UInt8) -) ENGINE = Memory; - -INSERT INTO arrays_test -VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []); -``` - -``` text -┌─s───────────┬─arr─────┐ -│ Hello │ [1,2] │ -│ World │ [3,4,5] │ -│ Goodbye │ [] │ -└─────────────┴─────────┘ -``` - -Aşağıdaki örnek kullanır `ARRAY JOIN` yan: - -``` sql -SELECT s, arr -FROM arrays_test -ARRAY JOIN arr; -``` - -``` text -┌─s─────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -└───────┴─────┘ -``` - -Sonraki örnek kullanımlar `LEFT ARRAY JOIN` yan: - -``` sql -SELECT s, arr -FROM arrays_test -LEFT ARRAY JOIN arr; -``` - -``` text -┌─s───────────┬─arr─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ World │ 3 │ -│ World │ 4 │ -│ World │ 5 │ -│ Goodbye │ 0 │ -└─────────────┴─────┘ -``` - -#### Takma Ad Kullanma {#using-aliases} - -Bir dizi için bir diğer ad belirtilebilir `ARRAY JOIN` yan. Bu durumda, bir dizi öğesine bu diğer adla erişilebilir, ancak dizinin kendisine özgün adla erişilir. Örnek: - -``` sql -SELECT s, arr, a -FROM arrays_test -ARRAY JOIN arr AS a; -``` - -``` text -┌─s─────┬─arr─────┬─a─┐ -│ Hello │ [1,2] │ 1 │ -│ Hello │ [1,2] │ 2 │ -│ World │ [3,4,5] │ 3 │ -│ World │ [3,4,5] │ 4 │ -│ World │ [3,4,5] │ 5 │ -└───────┴─────────┴───┘ -``` - -Takma adlar kullanarak şunları yapabilirsiniz `ARRAY JOIN` harici bir dizi ile. Mesela: - -``` sql -SELECT s, arr_external -FROM arrays_test -ARRAY JOIN [1, 2, 3] AS arr_external; -``` - -``` text -┌─s───────────┬─arr_external─┐ -│ Hello │ 1 │ -│ Hello │ 2 │ -│ Hello │ 3 │ -│ World │ 1 │ -│ World │ 2 │ -│ World │ 3 │ -│ Goodbye │ 1 │ -│ Goodbye │ 2 │ -│ Goodbye │ 3 │ -└─────────────┴──────────────┘ -``` - -Birden çok diziler virgülle ayrılmış olabilir `ARRAY JOIN` yan. Bu durumda, `JOIN` onlarla aynı anda gerçekleştirilir (doğrudan toplam, kartezyen ürün değil). Tüm dizilerin aynı boyuta sahip olması gerektiğini unutmayın. Örnek: - -``` sql -SELECT s, arr, a, num, mapped -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ -│ Hello │ [1,2] │ 1 │ 1 │ 2 │ -│ Hello │ [1,2] │ 2 │ 2 │ 3 │ -│ World │ [3,4,5] │ 3 │ 1 │ 4 │ -│ World │ [3,4,5] │ 4 │ 2 │ 5 │ -│ World │ [3,4,5] │ 5 │ 3 │ 6 │ -└───────┴─────────┴───┴─────┴────────┘ -``` - -Aşağıdaki örnek kullanır [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) işlev: - -``` sql -SELECT s, arr, a, num, arrayEnumerate(arr) -FROM arrays_test -ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num; -``` - -``` text -┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ -│ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ -│ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ -│ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ -│ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ -│ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ -└───────┴─────────┴───┴─────┴─────────────────────┘ -``` - -#### İç içe veri yapısı ile dizi birleştirme {#array-join-with-nested-data-structure} - -`ARRAY`Jo "in " ile de çalışır [iç içe veri yapıları](../../sql_reference/data_types/nested_data_structures/nested.md). Örnek: - -``` sql -CREATE TABLE nested_test -( - s String, - nest Nested( - x UInt8, - y UInt32) -) ENGINE = Memory; - -INSERT INTO nested_test -VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []); -``` - -``` text -┌─s───────┬─nest.x──┬─nest.y─────┐ -│ Hello │ [1,2] │ [10,20] │ -│ World │ [3,4,5] │ [30,40,50] │ -│ Goodbye │ [] │ [] │ -└─────────┴─────────┴────────────┘ -``` - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -İç içe geçmiş veri yapılarının adlarını belirtirken `ARRAY JOIN` anlam aynıdır `ARRAY JOIN` içerdiği tüm dizi öğeleri ile. Örnekler aşağıda listelenmiştir: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`, `nest.y`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─┐ -│ Hello │ 1 │ 10 │ -│ Hello │ 2 │ 20 │ -│ World │ 3 │ 30 │ -│ World │ 4 │ 40 │ -│ World │ 5 │ 50 │ -└───────┴────────┴────────┘ -``` - -Bu varyasyon da mantıklı: - -``` sql -SELECT s, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN `nest.x`; -``` - -``` text -┌─s─────┬─nest.x─┬─nest.y─────┐ -│ Hello │ 1 │ [10,20] │ -│ Hello │ 2 │ [10,20] │ -│ World │ 3 │ [30,40,50] │ -│ World │ 4 │ [30,40,50] │ -│ World │ 5 │ [30,40,50] │ -└───────┴────────┴────────────┘ -``` - -Bir diğer ad, iç içe geçmiş bir veri yapısı için kullanılabilir. `JOIN` sonuç veya kaynak dizi. Örnek: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` -FROM nested_test -ARRAY JOIN nest AS n; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ -└───────┴─────┴─────┴─────────┴────────────┘ -``` - -Kullanma örneği [arrayEnumerate](../../sql_reference/functions/array_functions.md#array_functions-arrayenumerate) işlev: - -``` sql -SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num -FROM nested_test -ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num; -``` - -``` text -┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ -│ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ -│ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ -│ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ -│ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ -│ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ -└───────┴─────┴─────┴─────────┴────────────┴─────┘ -``` - -### Jo {#select-join} - -Verileri normal olarak birleştirir [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) anlama. - -!!! info "Not" - İlgili [ARRAY JOIN](#select-array-join-clause). - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER] JOIN -(ON )|(USING ) ... -``` - -Tablo adları yerine belirtilebilir `` ve ``. Bu eşdeğerdir `SELECT * FROM table` alt sorgu, tablonun sahip olduğu özel bir durum dışında [Katmak](../../engines/table_engines/special/join.md) engine – an array prepared for joining. - -#### Desteklenen Türleri `JOIN` {#select-join-types} - -- `INNER JOIN` (veya `JOIN`) -- `LEFT JOIN` (veya `LEFT OUTER JOIN`) -- `RIGHT JOIN` (veya `RIGHT OUTER JOIN`) -- `FULL JOIN` (veya `FULL OUTER JOIN`) -- `CROSS JOIN` (veya `,` ) - -Standarda bakın [SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL)) açıklama. - -#### Çoklu birleştirme {#multiple-join} - -Sorguları gerçekleştiren ClickHouse, çoklu tablo birleşimlerini iki tablo birleşimlerinin sırasına yeniden yazar. Örneğin, JOIN ClickHouse için dört tablo varsa birinci ve ikinci katılır, ardından üçüncü tablo ile sonuç katılır ve son adımda dördüncü bir katılır. - -Bir sorgu içeriyorsa `WHERE` yan tümcesi, ClickHouse Ara birleştirme aracılığıyla bu yan tümcesi filtreleri pushdown çalışır. Filtreyi her Ara birleşime uygulayamazsa, tüm birleşimler tamamlandıktan sonra clickhouse filtreleri uygular. - -Biz tavsiye `JOIN ON` veya `JOIN USING` sorguları oluşturmak için sözdizimi. Mesela: - -``` sql -SELECT * FROM t1 JOIN t2 ON t1.a = t2.a JOIN t3 ON t1.a = t3.a -``` - -Virgülle ayrılmış tablo listelerini kullanabilirsiniz. `FROM` yan. Mesela: - -``` sql -SELECT * FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a -``` - -Bu sözdizimleri karıştırmayın. - -ClickHouse virgülle sözdizimini doğrudan desteklemez, bu yüzden bunları kullanmanızı önermiyoruz. Algoritma, sorguyu şu şekilde yeniden yazmaya çalışır: `CROSS JOIN` ve `INNER JOIN` yan tümceleri ve sonra sorgu işleme devam eder. Sorguyu yeniden yazarken, ClickHouse performansı ve bellek tüketimini en iyi duruma getirmeye çalışır. Varsayılan olarak, ClickHouse virgülleri bir `INNER JOIN` CLA anduse and conver andts `INNER JOIN` -e doğru `CROSS JOIN` algoritma bunu garanti edemez zaman `INNER JOIN` gerekli verileri döndürür. - -#### Katılık {#select-join-strictness} - -- `ALL` — If the right table has several matching rows, ClickHouse creates a [Kartezyen ürün](https://en.wikipedia.org/wiki/Cartesian_product) eşleşen satırlardan. Bu standart `JOIN` SQL davranış. -- `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of queries with `ANY` ve `ALL` anahtar kelimeler aynıdır. -- `ASOF` — For joining sequences with a non-exact match. `ASOF JOIN` kullanım aşağıda açıklanmıştır. - -**ASOF JOIN kullanımı** - -`ASOF JOIN` tam olarak eşleşmeyen kayıtlara katılmanız gerektiğinde kullanışlıdır. - -İçin tablolar `ASOF JOIN` sıralı bir sıra sütunu olmalıdır. Bu sütun bir tabloda tek başına olamaz ve veri türlerinden biri olmalıdır: `UInt32`, `UInt64`, `Float32`, `Float64`, `Date`, ve `DateTime`. - -Sözdizimi `ASOF JOIN ... ON`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF LEFT JOIN table_2 -ON equi_cond AND closest_match_cond -``` - -Herhangi bir sayıda eşitlik koşulunu ve tam olarak en yakın eşleşme koşulunu kullanabilirsiniz. Mesela, `SELECT count() FROM table_1 ASOF LEFT JOIN table_2 ON table_1.a == table_2.b AND table_2.t <= table_1.t`. - -En yakın maç için desteklenen koşullar: `>`, `>=`, `<`, `<=`. - -Sözdizimi `ASOF JOIN ... USING`: - -``` sql -SELECT expressions_list -FROM table_1 -ASOF JOIN table_2 -USING (equi_column1, ... equi_columnN, asof_column) -``` - -`ASOF JOIN` kullanma `equi_columnX` eşit onliğe katılma ve `asof_column` ile en yakın maça katılmak için `table_1.asof_column >= table_2.asof_column` koşul. Bu `asof_column` sütun her zaman sonuncusu `USING` yan. - -Örneğin, aşağıdaki tabloları göz önünde bulundurun: - -\`\`\` Metin -table\_1 table\_2 - -olay / ev\_time / user\_id olay / ev\_time / user\_id diff --git a/docs/tr/sql_reference/statements/show.md b/docs/tr/sql_reference/statements/show.md deleted file mode 100644 index 155b28886d9..00000000000 --- a/docs/tr/sql_reference/statements/show.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 38 -toc_title: SHOW ---- - -# Sorguları göster {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -Bir tek döndürür `String`-tür ‘statement’ column, which contains a single value – the `CREATE` belirtilen nesneyi oluşturmak için kullanılan sorgu. - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -Tüm veritabanlarının bir listesini yazdırır. -Bu sorgu ile aynıdır `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -İçeriği verir [sistem.işleyişler](../../operations/system_tables.md#system_tables-processes) şu anda işlenmekte olan sorguların bir listesini içeren tablo, hariç `SHOW PROCESSLIST` sorgular. - -Bu `SELECT * FROM system.processes` sorgu, geçerli tüm sorgular hakkında veri döndürür. - -İpucu (konsolda Yürüt): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -Tablo listesini görüntüler. - -``` sql -SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Eğer... `FROM` yan tümcesi belirtilmemiş, sorgu geçerli veritabanından tabloların listesini döndürür. - -Aynı sonuçları elde edebilirsiniz `SHOW TABLES` aşağıdaki şekilde sorgu: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Örnek** - -Aşağıdaki sorgu, tablo listesinden ilk iki satırı seçer. `system` adları içeren veritabanı `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -Bir listesini görüntüler [dış söz dictionarieslükler](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -Eğer... `FROM` yan tümcesi belirtilmemiş, sorgu geçerli veritabanından sözlükler listesini döndürür. - -Aynı sonuçları elde edebilirsiniz `SHOW DICTIONARIES` aşağıdaki şekilde sorgu: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**Örnek** - -Aşağıdaki sorgu, tablo listesinden ilk iki satırı seçer. `system` adları içeren veritabanı `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/tr/sql_reference/statements/system.md b/docs/tr/sql_reference/statements/system.md deleted file mode 100644 index 761f6e77737..00000000000 --- a/docs/tr/sql_reference/statements/system.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 37 -toc_title: SYSTEM ---- - -# Sistem sorguları {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -Daha önce başarıyla yüklenen tüm sözlükleri yeniden yükler. -Varsayılan olarak, sözlükler tembel yüklenir (bkz [dictionaries\_lazy\_load](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)), bu nedenle başlangıçta otomatik olarak yüklenmek yerine, dictGet işlevi aracılığıyla ilk erişimde başlatılır veya ENGİNE = Dictionary ile tablolardan seçim yapılır. Bu `SYSTEM RELOAD DICTIONARIES` sorgu bu sözlükleri yeniden yükler (yüklü). -Her zaman döner `Ok.` sözlük güncellemesinin sonucu ne olursa olsun. - -## Sözlük Dictionary\_name yeniden yükle {#query_language-system-reload-dictionary} - -Tamamen bir sözlük reloads `dictionary_name`, sözlük durumuna bakılmaksızın (LOADED / NOT\_LOADED / FAİLED). -Her zaman döner `Ok.` ne olursa olsun sözlük güncelleme sonucu. -Sözlüğün durumu sorgulanarak kontrol edilebilir `system.dictionaries` Tablo. - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -Clickhouse'un iç DNS önbelleğini sıfırlar. Bazen (eski ClickHouse sürümleri için) altyapıyı değiştirirken (başka bir ClickHouse sunucusunun IP adresini veya sözlükler tarafından kullanılan sunucuyu değiştirirken) bu komutu kullanmak gerekir. - -Daha uygun (otomatik) önbellek yönetimi için bkz: disable\_internal\_dns\_cache, dns\_cache\_update\_period parametreleri. - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -İşaret önbelleğini sıfırlar. ClickHouse ve performans testlerinin geliştirilmesinde kullanılır. - -## FLUSH LOGS {#query_language-system-flush_logs} - -Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. - -## RELOAD CONFIG {#query_language-system-reload-config} - -ClickHouse yapılandırmasını yeniden yükler. Yapılandırma ZooKeeeper saklandığında kullanılır. - -## SHUTDOWN {#query_language-system-shutdown} - -Normalde Clickhouse'u kapatır (gibi `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -ClickHouse işlemini iptal eder (gibi `kill -9 {$ pid_clickhouse-server}`) - -## Dağıtılmış Tabloları Yönetme {#query-language-system-distributed} - -ClickHouse yönetebilir [dağılı](../../engines/table_engines/special/distributed.md) Tablolar. Bir kullanıcı bu tablolara veri eklediğinde, ClickHouse önce küme düğümlerine gönderilmesi gereken verilerin bir sırası oluşturur, sonra zaman uyumsuz olarak gönderir. İle kuyruk işleme yönetebilirsiniz [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed), ve [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) sorgular. Ayrıca, dağıtılmış verileri eşzamanlı olarak `insert_distributed_sync` ayar. - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -Dağıtılmış tablolara veri eklerken arka plan veri dağıtımını devre dışı bırakır. - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -Küme düğümlerine eşzamanlı olarak veri göndermek için Clickhouse'u zorlar. Herhangi bir düğüm kullanılamıyorsa, ClickHouse bir özel durum atar ve sorgu yürütülmesini durdurur. Tüm düğümler tekrar çevrimiçi olduğunda gerçekleşecek olan başarılı olana kadar sorguyu yeniden deneyebilirsiniz. - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -Dağıtılmış tablolara veri eklerken arka plan veri dağıtımını etkinleştirir. - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -MergeTree ailesindeki tablolar için arka plan birleşmelerini durdurma imkanı sağlar: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "Not" - `DETACH / ATTACH` tablo, daha önce tüm MergeTree tabloları için birleştirmeler durdurulduğunda bile tablo için arka plan birleştirmelerini başlatır. - -### START MERGES {#query_language-system-start-merges} - -MergeTree ailesindeki tablolar için arka plan birleştirmelerini başlatma imkanı sağlar: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/tr/sql_reference/syntax.md b/docs/tr/sql_reference/syntax.md deleted file mode 100644 index a7d725fe696..00000000000 --- a/docs/tr/sql_reference/syntax.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 31 -toc_title: "S\xF6zdizimi" ---- - -# Sözdizimi {#syntax} - -Sistemde iki tür ayrıştırıcı vardır: tam SQL ayrıştırıcısı (özyinelemeli bir iniş ayrıştırıcısı) ve veri biçimi ayrıştırıcısı (hızlı akış ayrıştırıcısı). -Dışında her durumda `INSERT` sorgu, sadece tam SQL ayrıştırıcı kullanılır. -Bu `INSERT` sorgu her iki ayrıştırıcıyı da kullanır: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -Bu `INSERT INTO t VALUES` parça tam ayrıştırıcı tarafından ayrıştırılır ve veriler `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` hızlı akış ayrıştırıcısı tarafından ayrıştırılır. Ayrıca kullanarak veriler için tam ayrıştırıcı açabilirsiniz [ınput\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) ayar. Ne zaman `input_format_values_interpret_expressions = 1`, ClickHouse önce hızlı akış ayrıştırıcısı ile değerleri ayrıştırmaya çalışır. Başarısız olursa, ClickHouse veriler için tam ayrıştırıcıyı kullanmaya çalışır ve bir SQL gibi davranır [ifade](#syntax-expressions). - -Veri herhangi bir biçime sahip olabilir. Bir sorgu alındığında, sunucu daha fazla hesaplar [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) istek bayt RAM (varsayılan olarak, 1 MB) ve geri kalanı akış ayrıştırılır. -Bu büyük sorunları önlemek için izin verir `INSERT` sorgular. - -Kullanırken `Values` biçim içinde bir `INSERT` sorgu, verilerin bir ifadedeki ifadelerle aynı şekilde ayrıştırıldığı görünebilir `SELECT` sorgu, ancak bu doğru değil. Bu `Values` biçim çok daha sınırlıdır. - -Bu makalenin geri kalanı tam çözümleyici kapsar. Biçim ayrıştırıcıları hakkında daha fazla bilgi için bkz: [Biçimliler](../interfaces/formats.md) bölme. - -## Alanlar {#spaces} - -Sözdizimsel yapılar arasında (bir sorgunun başlangıcı ve sonu dahil) herhangi bir sayıda boşluk simgesi olabilir. Boşluk sembolleri boşluk, sekme, satır beslemesi, CR ve form beslemesini içerir. - -## Yorumlar {#comments} - -ClickHouse, SQL stili ve C stili yorumlarını destekler. -SQL tarzı yorumlar ile başlar `--` ve hattın sonuna kadar devam, bir boşluk sonra `--` atlanmış olabilir. -C-style dan `/*` -e doğru `*/`ve çok satırlı olabilir, boşluklar da gerekli değildir. - -## Kelimeler {#syntax-keywords} - -Anahtar kelimeler karşılık geldiğinde büyük / küçük harf duyarsızdır: - -- SQL standardı. Mesela, `SELECT`, `select` ve `SeLeCt` hepsi geçerlidir. -- Bazı popüler DBMS'DE (MySQL veya Postgres) uygulama. Mesela, `DateTime` ile aynıdır `datetime`. - -Veri türü adı büyük / küçük harf duyarlı olup olmadığını denetlenebilir `system.data_type_families` Tablo. - -Standart SQL'İN aksine, diğer tüm anahtar kelimeler (işlev adları dahil) şunlardır **büyük küçük harf duyarlı**. - -Anahtar kelimeler ayrılmış değildir; sadece karşılık gelen bağlamda bu şekilde ele alınır. Kullanıyorsanız [tanıtıcılar](#syntax-identifiers) anahtar kelimelerle aynı ada sahip olarak, bunları çift tırnak veya backticks içine alın. Örneğin, sorgu `SELECT "FROM" FROM table_name` tablo geçerli ise `table_name` adı ile sütun vardır `"FROM"`. - -## Tanıtıcılar {#syntax-identifiers} - -Tanımlay areıcılar: - -- Küme, veritabanı, tablo, bölüm ve sütun adları. -- İşlevler. -- Veri türleri. -- [İfade takma adları](#syntax-expression_aliases). - -Tanımlayıcılar alıntılanabilir veya alıntılanamaz. İkincisi tercih edilir. - -Alıntılanmamış tanımlayıcılar regex ile eşleşmelidir `^[a-zA-Z_][0-9a-zA-Z_]*$` ve eşit olamaz [kelimeler](#syntax-keywords). Örnekler: `x, _1, X_y__Z123_.` - -Tanımlayıcıları anahtar kelimelerle aynı şekilde kullanmak istiyorsanız veya tanımlayıcılarda başka semboller kullanmak istiyorsanız, örneğin çift tırnak işaretleri veya backticks kullanarak alıntı yapın, `"id"`, `` `id` ``. - -## Harfler {#literals} - -Sayısal, dize, bileşik ve `NULL` harfler. - -### Sayısal {#numeric} - -Sayısal literal ayrıştırılmaya çalışılıyor: - -- İlk olarak, 64-bit imzalı bir sayı olarak, [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) işlev. -- Başarısız olursa, 64-bit imzasız bir sayı olarak, [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) işlev. -- Başarısız olursa, kayan noktalı sayı olarak [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) işlev. -- Aksi takdirde, bir hata döndürür. - -Hazır bilgi değeri, değerin sığdığı en küçük türe sahiptir. -Örneğin, 1 olarak ayrıştırılır `UInt8`, ancak 256 olarak ayrıştırılır `UInt16`. Daha fazla bilgi için, bkz. [Veri türleri](../sql_reference/data_types/index.md). - -Örnekler: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### Dize {#syntax-string-literal} - -Tek tırnak yalnızca dize değişmezleri desteklenir. Kapalı karakterler ters eğik çizgi kaçabilir. Aşağıdaki kaçış dizileri karşılık gelen özel bir değere sahiptir: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. Diğer tüm durumlarda, çıkış dizileri biçiminde `\c`, nere `c` herhangi bir karakter, dönüştürülür `c`. Bu dizileri kullanabileceğiniz anlamına gelir `\'`ve`\\`. Değeri olacak [Dize](../sql_reference/data_types/string.md) tür. - -Dize değişmezlerinde, en azından kaçmanız gerekir `'` ve `\`. Tek tırnak tek Alıntı ile kaçabilir, değişmez `'It\'s'` ve `'It''s'` eşittir. - -### Bileşik {#compound} - -Diziler köşeli parantez ile inşa edilmiştir `[1, 2, 3]`. Nuples yuvarlak parantez ile inşa edilmiştir `(1, 'Hello, world!', 2)`. -Teknik olarak bunlar değişmezler değil, sırasıyla dizi oluşturma işleci ve tuple oluşturma işleci ile ifadeler. -Bir dizi en az bir öğeden oluşmalı ve bir tuple en az iki öğeye sahip olmalıdır. -İçinde tuples göründüğünde ayrı bir durum var `IN` CLA ause of a `SELECT` sorgu. Sorgu sonuçları tuples içerebilir, ancak tuples bir veritabanına kaydedilemez (tablolar hariç [Bellek](../engines/table_engines/special/memory.md) motor). - -### NULL {#null-literal} - -Değerin eksik olduğunu gösterir. - -Saklamak için `NULL` bir tablo alanında, bu olmalıdır [Nullable](../sql_reference/data_types/nullable.md) tür. - -Veri formatına bağlı olarak (giriş veya çıkış), `NULL` farklı bir temsili olabilir. Daha fazla bilgi için belgelere bakın [veri formatları](../interfaces/formats.md#formats). - -İşleme için birçok nüans var `NULL`. Örneğin, bir karşılaştırma işleminin argümanlarından en az biri ise `NULL`, bu işlemin sonucu da `NULL`. Aynı şey çarpma, toplama ve diğer işlemler için de geçerlidir. Daha fazla bilgi için her işlem için belgeleri okuyun. - -Sorgularda, kontrol edebilirsiniz `NULL` kullanarak [IS NULL](operators.md#operator-is-null) ve [IS NOT NULL](operators.md) operatörler ve ilgili fonksiyonlar `isNull` ve `isNotNull`. - -## İşlevler {#functions} - -İşlev çağrıları, yuvarlak parantez içinde bir argüman listesi (muhtemelen boş) olan bir tanımlayıcı gibi yazılır. Standart SQL'İN aksine, boş bir argüman listesi için bile parantezler gereklidir. Örnek: `now()`. -Düzenli ve agrega işlevleri vardır (bkz. “Aggregate functions”). Bazı toplama işlevleri parantez içinde iki bağımsız değişken listesi içerebilir. Örnek: `quantile (0.9) (x)`. Bu toplama fonksiyonları denir “parametric” fonksiyonlar ve ilk listedeki argümanlar çağrılır “parameters”. Parametresiz toplama işlevlerinin sözdizimi, normal işlevlerle aynıdır. - -## Operatörler {#operators} - -Operatörler, sorgu ayrıştırma sırasında önceliklerini ve ilişkilendirmelerini dikkate alarak karşılık gelen işlevlerine dönüştürülür. -Örneğin, ifade `1 + 2 * 3 + 4` dönüştür toülür `plus(plus(1, multiply(2, 3)), 4)`. - -## Veri türleri ve veritabanı tablosu motorları {#data_types-and-database-table-engines} - -Veri türleri ve tablo motorları `CREATE` sorgu tanımlayıcıları veya işlevleri aynı şekilde yazılır. Başka bir deyişle, parantez içinde bir argüman listesi içerebilir veya içermeyebilir. Daha fazla bilgi için bölümlere bakın “Data types,” “Table engines,” ve “CREATE”. - -## İfade Takma Adları {#syntax-expression_aliases} - -Diğer ad, sorgudaki ifade için kullanıcı tanımlı bir addır. - -``` sql -expr AS alias -``` - -- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` kullanmadan fık thera `AS` kelime. - - For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. - -- `expr` — Any expression supported by ClickHouse. - - For example, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — Name for `expr`. Takma adlar ile uyumlu olmalıdır [tanıtıcılar](#syntax-identifiers) sözdizimi. - - For example, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### Kullanımı ile ilgili notlar {#notes-on-usage} - -Diğer adlar bir sorgu veya alt sorgu için geneldir ve herhangi bir ifade için sorgunun herhangi bir bölümünde bir diğer ad tanımlayabilirsiniz. Mesela, `SELECT (1 AS n) + 2, n`. - -Diğer adlar alt sorgularda ve alt sorgular arasında görünmez. Örneğin, sorgu yürütülürken `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse istisna oluşturur `Unknown identifier: num`. - -Sonuç sütunları için bir diğer ad tanımlanmışsa `SELECT` bir alt sorgunun yan tümcesi, bu sütunlar dış sorguda görülebilir. Mesela, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -Sütun veya tablo adlarıyla aynı olan diğer adlara dikkat edin. Aşağıdaki örneği ele alalım: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -Bu örnekte, tablo ilan ettik `t` sütun ile `b`. Ardından, veri seçerken, `sum(b) AS b` takma ad. Takma adlar küresel olduğundan, ClickHouse literal yerine `b` ifad theesinde `argMax(a, b)` ifad theesiyle `sum(b)`. Bu ikame istisnaya neden oldu. - -## Yıldız işareti {#asterisk} - -İn a `SELECT` sorgu, bir yıldız ifadesinin yerini alabilir. Daha fazla bilgi için bölüme bakın “SELECT”. - -## İfadeler {#syntax-expressions} - -Bir ifade, bir işlev, tanımlayıcı, değişmez, bir operatörün uygulaması, parantez içindeki ifade, alt sorgu veya yıldız işaretidir. Ayrıca bir takma ad içerebilir. -İfadelerin listesi, virgülle ayrılmış bir veya daha fazla ifadedir. -Fonksiyonlar ve operatörler, sırayla, argüman olarak ifadelere sahip olabilirler. - -[Orijinal makale](https://clickhouse.tech/docs/en/sql_reference/syntax/) diff --git a/docs/tr/sql_reference/table_functions/file.md b/docs/tr/sql_reference/table_functions/file.md deleted file mode 100644 index 67d67ccd7cd..00000000000 --- a/docs/tr/sql_reference/table_functions/file.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 37 -toc_title: Dosya ---- - -# Dosya {#file} - -Bir dosyadan bir tablo oluşturur. Bu tablo işlevi benzer [url](url.md) ve [hdf'ler](hdfs.md) biri. - -``` sql -file(path, format, structure) -``` - -**Giriş parametreleri** - -- `path` — The relative path to the file from [user\_files\_path](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-user_files_path). Readonly modunda glob'ları takip eden dosya desteğine giden yol: `*`, `?`, `{abc,def}` ve `{N..M}` nerede `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [biçimli](../../interfaces/formats.md#formats) dosya. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Döndürülen değer** - -Belirtilen dosyada veri okumak veya yazmak için belirtilen yapıya sahip bir tablo. - -**Örnek** - -Ayar `user_files_path` ve dosyanın içeriği `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -Tablo fromdan`test.csv` ve ondan ilk iki satır seçimi: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -``` sql --- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file -SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 -``` - -**Yolda Globs** - -Birden çok yol bileşenleri globs olabilir. İşlenmek için dosya var olmalı ve tüm yol deseniyle eşleşmelidir (sadece sonek veya önek değil). - -- `*` — Substitutes any number of any characters except `/` boş dize dahil. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -İle yapılar `{}` benzer olan [uzaktan masa fonksiyonu](../../sql_reference/table_functions/remote.md)). - -**Örnek** - -1. Aşağıdaki göreli yollara sahip birkaç dosyamız olduğunu varsayalım: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. Bu dosyalardaki satır miktarını sorgula: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Bu iki dizinin tüm dosyalarındaki satır miktarını sorgula: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Uyarıcı" - Dosya listenizde önde gelen sıfırlar içeren sayı aralıkları varsa, her basamak için parantez içeren yapıyı ayrı ayrı kullanın veya kullanın `?`. - -**Örnek** - -Adlı dosy thealardan verileri sorgu thelamak `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Sanal Sütunlar {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Ayrıca Bakınız** - -- [Sanal sütunlar](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/tr/sql_reference/table_functions/hdfs.md b/docs/tr/sql_reference/table_functions/hdfs.md deleted file mode 100644 index e15d721135a..00000000000 --- a/docs/tr/sql_reference/table_functions/hdfs.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 45 -toc_title: hdf'ler ---- - -# hdf'ler {#hdfs} - -Hdfs'deki dosyalardan bir tablo oluşturur. Bu tablo işlevi benzer [url](url.md) ve [Dosya](file.md) biri. - -``` sql -hdfs(URI, format, structure) -``` - -**Giriş parametreleri** - -- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` ve `{N..M}` nerede `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [biçimli](../../interfaces/formats.md#formats) dosya. -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**Döndürülen değer** - -Belirtilen dosyada veri okumak veya yazmak için belirtilen yapıya sahip bir tablo. - -**Örnek** - -Tablo fromdan `hdfs://hdfs1:9000/test` ve ondan ilk iki satır seçimi: - -``` sql -SELECT * -FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -**Yolda Globs** - -Birden çok yol bileşenleri globs olabilir. İşlenmek için dosya var olmalı ve tüm yol deseniyle eşleşmelidir (sadece sonek veya önek değil). - -- `*` — Substitutes any number of any characters except `/` boş dize dahil. -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -İle yapılar `{}` benzer olan [uzaktan masa fonksiyonu](../../sql_reference/table_functions/remote.md)). - -**Örnek** - -1. HDFS'DE aşağıdaki Urı'lere sahip birkaç dosyamız olduğunu varsayalım: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. Bu dosyalardaki satır miktarını sorgula: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. Bu iki dizinin tüm dosyalarındaki satır miktarını sorgula: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "Uyarıcı" - Dosya listenizde önde gelen sıfırlar içeren sayı aralıkları varsa, her basamak için parantez içeren yapıyı ayrı ayrı kullanın veya kullanın `?`. - -**Örnek** - -Adlı dosy thealardan verileri sorgu thelamak `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## Sanal Sütunlar {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**Ayrıca Bakınız** - -- [Sanal sütunlar](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/tr/sql_reference/table_functions/index.md b/docs/tr/sql_reference/table_functions/index.md deleted file mode 100644 index 3108903713f..00000000000 --- a/docs/tr/sql_reference/table_functions/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: "Tablo Fonksiyonlar\u0131" -toc_priority: 34 -toc_title: "Giri\u015F" ---- - -# Tablo Fonksiyonları {#table-functions} - -Tablo işlevleri tabloları oluşturmak için yöntemlerdir. - -Tablo işlevlerini kullanabilirsiniz: - -- [FROM](../statements/select.md#select-from) fıkra ofsı `SELECT` sorgu. - - The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. - -- [Tablo oluştur \](../statements/create.md#create-table-query) sorgu. - - It's one of the methods of creating a table. - -!!! warning "Uyarıcı" - Eğer tablo işlevlerini kullanamazsınız [allow\_ddl](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) ayarı devre dışı. - -| İşlev | Açıklama | -|--------------------------|-----------------------------------------------------------------------------------------------------------------------------| -| [Dosya](file.md) | Oluşturur bir [Dosya](../../engines/table_engines/special/file.md)- motor masası. | -| [birleştirmek](merge.md) | Oluşturur bir [Birleştirmek](../../engines/table_engines/special/merge.md)- motor masası. | -| [şiir](numbers.md) | Tamsayı sayılarla dolu tek bir sütun içeren bir tablo oluşturur. | -| [uzak](remote.md) | Oluşturmadan uzak sunuculara erişmenizi sağlar. [Dağılı](../../engines/table_engines/special/distributed.md)- motor masası. | -| [url](url.md) | Oluşturur bir [Url](../../engines/table_engines/special/url.md)- motor masası. | -| [mysql](mysql.md) | Oluşturur bir [MySQL](../../engines/table_engines/integrations/mysql.md)- motor masası. | -| [jdbc](jdbc.md) | Oluşturur bir [JDBC](../../engines/table_engines/integrations/jdbc.md)- motor masası. | -| [odbc](odbc.md) | Oluşturur bir [ODBC](../../engines/table_engines/integrations/odbc.md)- motor masası. | -| [hdf'ler](hdfs.md) | Oluşturur bir [HDFS](../../engines/table_engines/integrations/hdfs.md)- motor masası. | - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/tr/sql_reference/table_functions/mysql.md b/docs/tr/sql_reference/table_functions/mysql.md deleted file mode 100644 index aee7311dc56..00000000000 --- a/docs/tr/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 42 -toc_title: mysql ---- - -# mysql {#mysql} - -Veriyor `SELECT` uzak bir MySQL sunucusunda depolanan veriler üzerinde gerçekleştirilecek sorgular. - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**Parametre** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` için sorgular `REPLACE INTO`. Eğer `replace_query=1`, sorgu değiştirilir. - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` eklenen ifade `INSERT` sorgu. - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -Basit `WHERE` gibi maddeler `=, !=, >, >=, <, <=` şu anda MySQL sunucusunda yürütülür. - -Geri kalan şartlar ve `LIMIT` örnekleme kısıtlaması, yalnızca MySQL sorgusu bittikten sonra Clickhouse'da yürütülür. - -**Döndürülen Değer** - -Orijinal MySQL tablosu ile aynı sütunlara sahip bir tablo nesnesi. - -## Kullanım Örneği {#usage-example} - -MySQL tablo: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Clickhouse'dan veri seçme: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Ayrıca Bakınız {#see-also} - -- [Bu ‘MySQL’ masa motoru](../../engines/table_engines/integrations/mysql.md) -- [Harici sözlük kaynağı olarak MySQL kullanma](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/tr/sql_reference/table_functions/numbers.md b/docs/tr/sql_reference/table_functions/numbers.md deleted file mode 100644 index 45ca2f5f45d..00000000000 --- a/docs/tr/sql_reference/table_functions/numbers.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 39 -toc_title: "\u015Fiir" ---- - -# şiir {#numbers} - -`numbers(N)` – Returns a table with the single ‘number’ 0'dan n-1'e kadar tamsayılar içeren sütun (Uİnt64). -`numbers(N, M)` - Tek bir tablo döndürür ‘number’ n'den (n + M - 1) tamsayıları içeren sütun (Uİnt64). - -Benzer `system.numbers` tablo, ardışık değerleri test etmek ve üretmek için kullanılabilir, `numbers(N, M)` daha verimli `system.numbers`. - -Aşağıdaki sorgular eşdeğerdir: - -``` sql -SELECT * FROM numbers(10); -SELECT * FROM numbers(0, 10); -SELECT * FROM system.numbers LIMIT 10; -``` - -Örnekler: - -``` sql --- Generate a sequence of dates from 2010-01-01 to 2010-12-31 -select toDate('2010-01-01') + number as d FROM numbers(365); -``` - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/numbers/) diff --git a/docs/tr/sql_reference/table_functions/odbc.md b/docs/tr/sql_reference/table_functions/odbc.md deleted file mode 100644 index d250ce21311..00000000000 --- a/docs/tr/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 44 -toc_title: odbc ---- - -# odbc {#table-functions-odbc} - -Üzerinden bağlanan tabloyu döndürür [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -Parametre: - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` Dosya. -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -ODBC bağlantılarını güvenli bir şekilde uygulamak için ClickHouse ayrı bir program kullanır `clickhouse-odbc-bridge`. ODBC sürücüsü doğrudan yüklenmişse `clickhouse-server`, sürücü sorunları ClickHouse sunucu çökmesine neden olabilir. ClickHouse otomatik olarak başlar `clickhouse-odbc-bridge` gerekli olduğunda. ODBC Köprüsü programı aynı paketten yüklenir `clickhouse-server`. - -Alanları ile `NULL` dış tablodaki değerler, temel veri türü için varsayılan değerlere dönüştürülür. Örneğin, uzak bir MySQL tablo alanı `INT NULL` yazın 0'a dönüştürülür (ClickHouse için varsayılan değer `Int32` veri türü). - -## Kullanım örneği {#usage-example} - -**ODBC üzerinden yerel MySQL kurulumundan veri alma** - -Bu örnek Ubuntu Linux 18.04 ve MySQL server 5.7 için kontrol edilir. - -UnixODBC ve MySQL Connector yüklü olduğundan emin olun. - -Varsayılan olarak (paketlerden yüklüyse), ClickHouse kullanıcı olarak başlar `clickhouse`. Bu nedenle, bu kullanıcıyı MySQL sunucusunda oluşturmanız ve yapılandırmanız gerekir. - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -Sonra bağlantıyı yapılandırın `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -Kullanarak bağlantıyı kontrol edebilirsiniz `isql` unixodbc yüklemesinden yardımcı program. - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -MySQL tablo: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -Clickhouse'daki MySQL tablosundan veri alma: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## Ayrıca Bakınız {#see-also} - -- [ODBC harici sözlükler](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBC tablo motoru](../../engines/table_engines/integrations/odbc.md). - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/tr/sql_reference/table_functions/remote.md b/docs/tr/sql_reference/table_functions/remote.md deleted file mode 100644 index 58c4154643c..00000000000 --- a/docs/tr/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 40 -toc_title: uzak ---- - -# uzaktan, remoteSecure {#remote-remotesecure} - -Oluşturmadan uzak sunuculara erişmenizi sağlar. `Distributed` Tablo. - -İmzalar: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port` ya da sadece `host`. Ana bilgisayar sunucu adı veya IPv4 veya IPv6 adresi olarak belirtilebilir. Köşeli parantez içinde bir IPv6 adresi belirtilir. Bağlantı noktası, uzak sunucudaki TCP bağlantı noktasıdır. Bağlantı noktası atlanırsa, kullanır `tcp_port` sunucunun yapılandırma dosyasından (varsayılan olarak, 9000). - -!!! important "Önemli" - Bir IPv6 adresi için bağlantı noktası gereklidir. - -Örnekler: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -Birden çok Adres virgülle ayrılmış olabilir. Bu durumda, ClickHouse dağıtılmış işleme kullanır, bu nedenle sorguyu belirtilen tüm adreslere gönderir (farklı verilerle kırıklar gibi). - -Örnek: - -``` text -example01-01-1,example01-02-1 -``` - -İfadenin bir kısmı kıvırcık parantez içinde belirtilebilir. Önceki örnek aşağıdaki gibi yazılabilir: - -``` text -example01-0{1,2}-1 -``` - -Kıvırcık parantez iki nokta (negatif olmayan tamsayılar) ile ayrılmış bir sayı aralığı içerebilir. Bu durumda, Aralık, shard adresleri üreten bir değer kümesine genişletilir. İlk sayı sıfır ile başlarsa, değerler aynı sıfır hizalamasıyla oluşturulur. Önceki örnek aşağıdaki gibi yazılabilir: - -``` text -example01-{01..02}-1 -``` - -Birden fazla kıvırcık parantez çiftiniz varsa, ilgili kümelerin doğrudan ürününü oluşturur. - -Adresler ve kıvırcık parantez içindeki adreslerin parçaları boru sembolü (\|) ile ayrılabilir. Bu durumda, karşılık gelen Adres kümeleri yinelemeler olarak yorumlanır ve sorgu ilk sağlıklı yinelemeye gönderilir. Ancak, yinelemeler şu anda ayarlanmış sırayla yinelenir [dengeleme](../../operations/settings/settings.md) ayar. - -Örnek: - -``` text -example01-{01..02}-{1|2} -``` - -Bu örnek, her birinin iki kopyası olan iki parçayı belirtir. - -Oluşturulan Adres sayısı bir sabit tarafından sınırlıdır. Şu anda bu 1000 Adres. - -Kullanarak `remote` tablo işlevi, bir `Distributed` tablo, çünkü bu durumda, her istek için sunucu bağlantısı yeniden kurulur. Buna ek olarak, ana bilgisayar adları ayarlanmışsa, adlar giderilir ve çeşitli yinelemelerle çalışırken hatalar sayılmaz. Çok sayıda sorgu işlerken, her zaman `Distributed` masa vaktinden önce, ve kullanmayın `remote` tablo işlevi. - -Bu `remote` tablo işlevi aşağıdaki durumlarda yararlı olabilir: - -- Veri karşılaştırma, hata ayıklama ve sınama için belirli bir sunucuya erişme. -- Araştırma amaçlı çeşitli ClickHouse kümeleri arasındaki sorgular. -- El ile yapılan seyrek dağıtılmış istekler. -- Sunucu kümesinin her seferinde yeniden tanımlandığı dağıtılmış istekler. - -Kullanıcı belirtilmemişse, `default` kullanılır. -Parola belirtilmezse, boş bir parola kullanılır. - -`remoteSecure` - aynı `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) yapılandırma veya 9440'ten. - -[Orijinal makale](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/tr/whats-new/changelog/2017.md b/docs/tr/whats-new/changelog/2017.md new file mode 100644 index 00000000000..6fe2054fd3c --- /dev/null +++ b/docs/tr/whats-new/changelog/2017.md @@ -0,0 +1,268 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 79 +toc_title: '2017' +--- + +### ClickHouse sürüm 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} + +Bu sürüm önceki sürüm 1.1.54318 için hata düzeltmeleri içerir: + +- Veri kaybına yol açabilir çoğaltma Olası yarış koşulu ile Sabit hata. Bu sorun sürümleri 1.1.54310 ve 1.1.54318 etkiler. Bu sürümlerden birini çoğaltılmış tablolarla kullanırsanız, güncelleştirme önerilir. Bu sorun, aşağıdaki gibi uyarı iletilerindeki günlüklerde gösterilir `Part ... from own log doesn't exist.` Bu iletileri günlüklerde görmeseniz bile sorun geçerlidir. + +### ClickHouse sürümü 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} + +Bu sürüm önceki sürüm 1.1.54310 için hata düzeltmeleri içerir: + +- SummingMergeTree motorunda birleştirmeler sırasında hatalı satır silme işlemleri düzeltildi +- Unreplicated MergeTree motorlarında bir bellek sızıntısı düzeltildi +- MergeTree motorlarında sık sık eklerle sabit performans düşüşü +- Çoğaltma kuyruğunun çalışmayı durdurmasına neden olan bir sorun giderildi +- Sunucu günlüklerinin sabit rotasyonu ve arşivlenmesi + +### ClickHouse sürümü 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} + +#### Yenilik: {#new-features} + +- Tablo motorları MergeTree ailesi için özel bölümleme anahtarı. +- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) masa motoru. +- Yükleme için destek eklendi [CatBoost](https://catboost.yandex/) modelleri ve ClickHouse saklanan verilere uygulayarak. +- UTC olmayan tamsayı uzaklıklar ile saat dilimleri için destek eklendi. +- Zaman aralıklarıyla aritmetik işlemler için destek eklendi. +- Tarih ve DateTime türleri için değer aralığı 2105 yılına genişletilir. +- Add theed the `CREATE MATERIALIZED VIEW x TO y` sorgu (materyalleştirilmiş bir görünümün verilerini depolamak için varolan bir tabloyu belirtir). +- Add theed the `ATTACH TABLE` argüman olmadan sorgu. +- Bir SummingMergeTree tablosunda-Map biten adları ile iç içe sütunlar için işleme mantığı için ayıklandı sumMap toplama işlevi. Şimdi bu tür sütunları açıkça belirtebilirsiniz. +- IP trie sözlüğünün maksimum boyutu 128M girişlerine yükseltilir. +- GetSizeOfEnumType işlevi eklendi. +- SumWithOverflow toplama işlevi eklendi. +- Cap’n Proto giriş biçimi için destek eklendi. +- Artık zstd algoritmasını kullanırken sıkıştırma seviyesini özelleştirebilirsiniz. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes} + +- Bellek dışında bir motor ile geçici tablolar oluşturulmasına izin verilmez. +- View veya MaterializedView altyapısı ile tabloların açık oluşturulmasına izin verilmez. +- Tablo oluşturma sırasında yeni bir onay örnekleme anahtar ifadesinin birincil anahtara dahil edildiğini doğrular. + +#### Hata düzeltmeleri: {#bug-fixes} + +- Sabit hangups zaman eşzamanlı bir dağıtılmış tabloya ekleme. +- Sabit atomik olmayan ekleme ve çoğaltılmış tablolarda parçaların çıkarılması. +- Materialized görünümüne eklenen veriler gereksiz tekilleştirme tabi değildir. +- Yerel yinelemenin geciktiği ve uzak yinelemelerin kullanılamadığı dağıtılmış bir tabloya bir sorgu yürütmek artık bir hataya neden olmaz. +- Kullanıcıların erişim izinlerine ihtiyacı yoktur `default` veritabanı artık geçici tablolar oluşturmak için. +- Bağımsız değişkenler olmadan dizi türünü belirtirken çökmesini düzeltildi. +- Sunucu günlüklerini içeren disk birimi dolu olduğunda sabit hangups. +- Unix döneminin ilk haftası için toRelativeWeekNum işlevinde bir taşma düzeltildi. + +#### İyileştirmeler oluşturun: {#build-improvements} + +- Birkaç üçüncü taraf Kütüphanesi (özellikle Poco) güncellendi ve git alt modüllerine dönüştürüldü. + +### ClickHouse sürümü 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} + +#### Yenilik: {#new-features-1} + +- Yerel protokolde TLS desteği (etkinleştirmek, ayarlamak için `tcp_ssl_port` içinde `config.xml` ). + +#### Hata düzeltmeleri: {#bug-fixes-1} + +- `ALTER` çoğaltılmış tablolar için şimdi en kısa sürede çalışmaya başlamak çalışır. +- Ayarı ile veri okurken çökmesini sabit `preferred_block_size_bytes=0.` +- Sabit çöker `clickhouse-client` bas whenarken `Page Down` +- Bazı karmaşık sorguların doğru yorumlanması `GLOBAL IN` ve `UNION ALL` +- `FREEZE PARTITION` her zaman atomik olarak çalışır. +- Boş posta istekleri şimdi 411 koduyla bir yanıt döndürür. +- Gibi ifadeler için sabit yorumlama hataları `CAST(1 AS Nullable(UInt8)).` +- Okurken bir hata düzeltildi `Array(Nullable(String))` Col fromum fromns from `MergeTree` Tablolar. +- Gibi sorguları ayrıştırırken sabit çökmesini `SELECT dummy AS dummy, dummy AS b` +- Kullanıcılar geçersiz ile doğru güncellenir `users.xml` +- Yürütülebilir bir sözlük sıfır olmayan bir yanıt kodu döndürdüğünde doğru işleme. + +### ClickHouse yayın 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} + +#### Yenilik: {#new-features-2} + +- Add theed the `pointInPolygon` koordinat düzleminde koordinatlarla çalışmak için işlev. +- Add theed the `sumMap` benzer dizilerin toplamını hesaplamak için toplama işlevi `SummingMergeTree`. +- Add theed the `trunc` işlev. Yuvarlama fonksiyonlarının geliştirilmiş performansı (`round`, `floor`, `ceil`, `roundToExp2`) ve nasıl çalıştıklarının mantığını düzeltti. Mantığını değiştirdi `roundToExp2` kesirler ve negatif sayılar için işlev. +- ClickHouse yürütülebilir dosyası artık libc sürümüne daha az bağımlıdır. Aynı ClickHouse yürütülebilir dosya Linux sistemleri çok çeşitli çalıştırabilirsiniz. Derlenmiş sorguları kullanırken hala bir bağımlılık var (ayar ile `compile = 1` , varsayılan olarak kullanılmaz). +- Sorguların dinamik derlenmesi için gereken süreyi azalttı. + +#### Hata düzeltmeleri: {#bug-fixes-2} + +- Bazen üretilen bir hata düzeltildi `part ... intersects previous part` mesajlar ve kopya tutarlılığı zayıfladı. +- ZooKeeper kapatma sırasında kullanılamıyorsa sunucunun kilitlenmesine neden olan bir hata düzeltildi. +- Kopyaları geri yüklerken aşırı günlüğü kaldırıldı. +- Birlik tüm uygulamasında bir hata düzeltildi. +- Bir bloktaki ilk sütun dizi türüne sahipse, concat işlevinde bir hata düzeltildi. +- İlerleme şimdi sistemde doğru görüntülenir.tablo birleştirir. + +### ClickHouse yayın 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} + +#### Yenilik: {#new-features-3} + +- `SYSTEM` sunucu yönetimi için sorgular: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. +- Dizilerle çalışmak için işlevler eklendi: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. +- Katma `root` ve `identity` ZooKeeper yapılandırması için parametreler. Bu, aynı ZooKeeper kümesinde tek tek kullanıcıları izole etmenizi sağlar. +- Toplam fonksiyonları eklendi `groupBitAnd`, `groupBitOr`, ve `groupBitXor` (uyumluluk için, isimler altında da mevcuttur `BIT_AND`, `BIT_OR`, ve `BIT_XOR`). +- Dış sözlükler dosya sisteminde bir soket belirterek Mysql’den yüklenebilir. +- Harici sözlükler SSL üzerinden MySQL yüklenebilir (`ssl_cert`, `ssl_key`, `ssl_ca` parametre). +- Add theed the `max_network_bandwidth_for_user` kullanıcı başına sorgular için genel bant genişliği kullanımını kısıtlamak için ayarlama. +- İçin destek `DROP TABLE` geçici tablolar için. +- Okuma desteği `DateTime` Unix zaman damgası biçimindeki değerler `CSV` ve `JSONEachRow` biçimliler. +- Dağıtılmış sorgularda gecikmeli yinelemeler artık varsayılan olarak dışlanır (varsayılan eşik 5 dakikadır). +- FIFO kilitleme sırasında kullanılır ALTER: bir ALTER sorgusu sürekli çalışan sorgular için süresiz olarak engellenmez. +- Seçeneği ayarlamak için `umask` yapılandırma dosyasında. +- İle sorgular için geliştirilmiş performans `DISTINCT` . + +#### Hata düzeltmeleri: {#bug-fixes-3} + +- ZooKeeper eski düğümleri silme işlemi geliştirildi. Daha önce, eski düğümler bazen çok sık ekler varsa silinmedi, bu da sunucunun diğer şeylerin yanı sıra kapanması için yavaş olmasına neden oldu. +- ZooKeeper bağlantı için ana seçerken sabit randomizasyon. +- Çoğaltma localhost ise, dağıtılmış sorgularda gecikmiş kopyaların dışlanması düzeltildi. +- Bir veri parçası bir hata düzeltildi `ReplicatedMergeTree` tablo çalıştırdıktan sonra kırık olabilir `ALTER MODIFY` bir element üzerinde `Nested` yapılı. +- SELECT sorgularına neden olabilecek bir hata düzeltildi “hang”. +- Dağıtılmış DDL sorguları için iyileştirmeler. +- Sorgu düzeltildi `CREATE TABLE ... AS `. +- Çık themaz theı Çöz thedü `ALTER ... CLEAR COLUMN IN PARTITION` sorgu için `Buffer` Tablolar. +- İçin geçersiz varsayılan değer düzeltildi `Enum` kullanırken s (minimum yerine 0) `JSONEachRow` ve `TSKV` biçimliler. +- Bir sözlük ile bir sözlük kullanırken zombi süreçlerinin görünümünü çözdü `executable` kaynaklı. +- Kafa sorgusu için sabit segfault. + +#### ClickHouse geliştirmek Ve birleştirmek için geliştirilmiş iş akışı: {#improved-workflow-for-developing-and-assembling-clickhouse} + +- Kullanabilirsiniz `pbuilder` ClickHouse inşa etmek. +- Kullanabilirsiniz `libc++` yerine `libstdc++` Linux üzerine inşa edilmiştir. +- Statik kod analiz araçlarını kullanma talimatları eklendi: `Coverage`, `clang-tidy`, `cppcheck`. + +#### Yükseltme Yaparken lütfen unutmayın: {#please-note-when-upgrading} + +- MergeTree ayarı için artık daha yüksek bir varsayılan değer var `max_bytes_to_merge_at_max_space_in_pool` (bayt olarak birleştirilecek veri parçalarının maksimum toplam boyutu): 100 Gib’den 150 Gib’e yükseldi. Bu, disk Alt Sisteminde artan bir yüke neden olabilecek sunucu yükseltmesinden sonra çalışan büyük birleştirmelere neden olabilir. Sunucuda kullanılabilir boş alan, çalışan birleştirmelerin toplam miktarının iki katından azsa, bu, diğer tüm birleştirmelerin, küçük veri parçalarının birleştirmeleri de dahil olmak üzere çalışmayı durdurmasına neden olur. Sonuç olarak, INSERT sorguları iletiyle başarısız olur “Merges are processing significantly slower than inserts.” Kullan… `SELECT * FROM system.merges` durumu izlemek için sorgu. Ayrıca kontrol edebilirsiniz `DiskSpaceReservedForMerge` metr theik `system.metrics` tablo veya Grafit. Bunu düzeltmek için hiçbir şey yapmanıza gerek yoktur, çünkü büyük birleşimler bittikten sonra sorun kendiliğinden çözülür. Bu kabul edilemez bulursanız, önceki değeri geri yükleyebilirsiniz `max_bytes_to_merge_at_max_space_in_pool` ayar. Bunu yapmak için, gidin config bölümünde.xml, set ``` ``107374182400 ``` ve sunucuyu yeniden başlatın. + +### ClickHouse sürümü 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} + +- Bu, önceki 1.1.54282 sürümü için bir hata düzeltme sürümüdür. Bu ZooKeeper parçalar dizininde sızıntıları giderir. + +### ClickHouse yayın 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} + +Bu sürüm önceki sürüm 1.1.54276 için hata düzeltmeleri içerir: + +- Sabit `DB::Exception: Assertion violation: !_path.empty()` dağıtılmış bir tabloya eklerken. +- Giriş verileri’; ’ ile başlarsa RowBinary biçiminde eklerken ayrıştırma düzeltildi. +- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). + +### ClickHouse Yayın 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} + +#### Yenilik: {#new-features-4} + +- Bir seçme sorgusu için bölüm ile isteğe bağlı eklendi. Örnek sorgu: `WITH 1+1 AS a SELECT a, a*a` +- INSERT, dağıtılmış bir tabloda eşzamanlı olarak gerçekleştirilebilir: Tamam, yalnızca tüm veriler tüm parçalara kaydedildikten sonra döndürülür. Bu ayar tarafından etkinleştirilir ınsert\_distributed\_sync = 1. +- 16 baytlık tanımlayıcılarla çalışmak için UUID veri türü eklendi. +- Tablo ile uyumluluk için CHAR, FLOAT ve diğer türlerin takma adları eklendi. +- Sayılara zaman dönüştürmek için fonksiyonları toYYYYMM, toYYYYMMDD ve toYYYYMMDDhhmmss eklendi. +- Kümelenmiş DDL sorguları için sunucuları tanımlamak için IP adreslerini (ana bilgisayar adı ile birlikte) kullanabilirsiniz. +- İşlevde sabit olmayan argümanlar ve negatif uzaklıklar için destek eklendi `substring(str, pos, len).` +- İçin max\_size parametresi eklendi `groupArray(max_size)(column)` toplama işlevi ve performansını optimize etti. + +#### Ana değişiklikler: {#main-changes} + +- Güvenlik iyileştirmeleri: tüm sunucu dosyaları 0640 izinleriyle oluşturulur (üzerinden değiştirilebilir config parametresi). +- Geçersiz sözdizimi ile sorgular için geliştirilmiş hata mesajları. +- MergeTree verilerinin büyük bölümlerini birleştirirken bellek tüketimini önemli ölçüde azalttı ve performansı artırdı. +- ReplacingMergeTree motoru için veri birleştirmelerinin performansını önemli ölçüde artırdı. +- Birden çok kaynak ekler birleştirerek dağıtılmış bir tablodan zaman uyumsuz ekler için geliştirilmiş performans. Bu işlevi etkinleştirmek için distributed\_directory\_monitor\_batch\_ınserts = 1 ayarını kullanın. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-1} + +- Toplam durumların ikili biçimini değiştirdi `groupArray(array_column)` diziler için fonksiyonlar. + +#### Değişikliklerin Tam Listesi: {#complete-list-of-changes} + +- Add theed the `output_format_json_quote_denormals` json formatında nan ve ınf değerleri çıktısı sağlayan ayar. +- Dağıtılmış bir tablodan okurken optimize edilmiş akış tahsisi. +- Değer değişmezse ayarlar salt okunur modda yapılandırılabilir. +- Preferred\_block\_size\_bytes ayarında belirtilen blok boyutu üzerindeki kısıtlamaları karşılamak için mergetree motorunun tamsayı olmayan granüllerini alma yeteneği eklendi. Amaç, RAM tüketimini azaltmak ve büyük sütunlu tablolardan gelen sorguları işlerken önbellek konumunu arttırmaktır. +- Gibi ifadeler içeren dizinlerin verimli kullanımı `toStartOfHour(x)` gibi koşullar için `toStartOfHour(x) op сonstexpr.` +- MergeTree motorları için yeni ayarlar eklendi (yapılandırmada merge\_tree bölümü.xml): + - replicated\_deduplication\_window\_seconds yinelenen tablolar ekler tekilleştirme için izin verilen saniye sayısını ayarlar. + - cleanup\_delay\_period, eski verileri kaldırmak için temizleme işleminin ne sıklıkta başlatılacağını ayarlar. + - replicated\_can\_become\_leader, bir kopyanın lider olmasını (ve birleştirme atamasını) engelleyebilir. +- Hızlandırılmış Temizleme ZooKeeper eski verileri kaldırmak için. +- Kümelenmiş DDL sorguları için birden fazla iyileştirme ve düzeltme. Özellikle ilgi çekici olan yeni ayardır distributed\_ddl\_task\_timeout, kümedeki sunuculardan bir yanıt beklemek için zamanı sınırlar. Tüm ana bilgisayarlarda bir ddl isteği gerçekleştirilmediyse, bir yanıt bir zaman aşımı hatası içerir ve bir zaman uyumsuz modunda bir istek yürütülür. +- Sunucu günlüklerinde yığın izlerinin geliştirilmiş gösterimi. +- Add theed the “none” sıkıştırma yöntemi için değer. +- Yapılandırmada birden çok dictionaries\_config bölümünü kullanabilirsiniz.xml. +- Bu dosya sisteminde bir soket üzerinden MySQL bağlanmak mümkündür. +- Sistem.parçalar tablosu, bayt cinsinden işaretlerin boyutu hakkında bilgi içeren yeni bir sütuna sahiptir. + +#### Hata düzeltmeleri: {#bug-fixes-4} + +- Bir birleştirme tablosu kullanarak dağıtılmış tablolar artık bir koşulla bir SELECT sorgusu için doğru şekilde çalışır. `_table` alan. +- Veri parçalarını kontrol ederken ReplicatedMergeTree nadir bir yarış durumu düzeltildi. +- Sabit Olası donma “leader election” bir sunucu başlatırken. +- Veri kaynağının yerel bir kopyasını kullanırken max\_replica\_delay\_for\_distributed\_queries ayarı göz ardı edildi. Bu sorun giderildi. +- Sabit yanlış davranış `ALTER TABLE CLEAR COLUMN IN PARTITION` varolan olmayan bir sütunu temizlemeye çalışırken. +- Boş diziler veya dizeleri kullanırken multiİf işlevinde bir istisna düzeltildi. +- Sabit aşırı bellek ayırmaları yerel biçimi serisini kaldırırken. +- Trie sözlüklerin sabit yanlış otomatik güncelleme. +- Örnek kullanırken bir birleştirme tablosundan bir GROUP BY yan tümcesi ile sorguları çalıştırırken bir özel durum düzeltildi. +- Distributed\_aggregation\_memory\_efficient = 1 kullanırken grup çökmesi düzeltildi. +- Şimdi veritabanını belirtebilirsiniz.ın ve JOİN sağ tarafında tablo. +- Paralel toplama için çok fazla iplik kullanıldı. Bu sorun giderildi. +- Sabit nasıl “if” işlev FixedString argümanları ile çalışır. +- 0 ağırlığında kırıkları için dağıtılmış bir tablodan yanlış çalıştı seçin. Bu sorun giderildi. +- Çalışma `CREATE VIEW IF EXISTS no longer causes crashes.` +- Sabit yanlış davranış input\_format\_skip\_unknown\_fields=1 ayarlanır ve negatif sayılar vardır. +- Sabit bir sonsuz döngü içinde `dictGetHierarchy()` sözlükte bazı geçersiz veriler varsa işlev. +- Sabit `Syntax error: unexpected (...)` bir In veya JOIN yan tümcesi ve birleştirme tablolarındaki alt sorgularla dağıtılmış sorguları çalıştırırken hatalar. +- Sözlük tablolarından bir seçme sorgusunun yanlış yorumlanması düzeltildi. +- Sabit “Cannot mremap” 2 milyardan fazla öğe içeren ın ve JOIN yan tümcelerinde diziler kullanılırken hata oluştu. +- Kaynak olarak MySQL ile sözlükler için yük devretme düzeltildi. + +#### ClickHouse geliştirmek Ve birleştirmek için geliştirilmiş iş akışı: {#improved-workflow-for-developing-and-assembling-clickhouse-1} + +- Yapılar Arcadia’da monte edilebilir. +- Clickhouse’u derlemek için gcc 7’yi kullanabilirsiniz. +- Ccache+distcc kullanarak paralel yapılar artık daha hızlı. + +### ClickHouse yayın 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} + +#### Yenilik: {#new-features-5} + +- Dağıtılmış DDL (örneğin, `CREATE TABLE ON CLUSTER`) +- Çoğaltılan sorgu `ALTER TABLE CLEAR COLUMN IN PARTITION.` +- Sözlük tabloları için motor (bir tablo şeklinde sözlük verilerine erişim). +- Sözlük veritabanı motoru (bu tür veritabanı otomatik olarak bağlı tüm dış sözlükler için sözlük tabloları vardır). +- Kaynağa bir istek göndererek sözlükteki güncellemeleri kontrol edebilirsiniz. +- Nitelikli sütun adları +- Çift tırnak işaretleri kullanarak tanımlayıcıları alıntı. +- HTTP arabirimindeki oturumlar. +- Çoğaltılmış bir tablo için en iyi duruma getirme sorgusu yalnızca lider üzerinde çalışabilir. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-2} + +- Kaldırıldı set GLOBAL. + +#### Küçük değişiklikler: {#minor-changes} + +- Şimdi bir uyarı tetiklendikten sonra günlük tam yığın izleme yazdırır. +- Başlangıçta hasarlı / ekstra veri parçalarının sayısının doğrulanmasını rahatlattı(çok fazla yanlış pozitif vardı). + +#### Hata düzeltmeleri: {#bug-fixes-5} + +- Kötü bir bağlantı düzeltildi “sticking” dağıtılmış bir tabloya eklerken. +- GLOBAL IN şimdi dağıtılmış bir tabloya bakan bir birleştirme tablosundan bir sorgu için çalışır. +- Bir Google Compute Engine sanal makinesinde yanlış sayıda çekirdek tespit edildi. Bu sorun giderildi. +- Önbelleğe alınmış harici sözlüklerin yürütülebilir bir kaynağının nasıl çalıştığındaki değişiklikler. +- Null karakter içeren dizelerin karşılaştırması düzeltildi. +- Float32 birincil anahtar alanlarının sabitler ile karşılaştırılması düzeltildi. +- Önceden, bir alanın boyutunun yanlış bir tahmini, aşırı büyük tahsisatlara neden olabilir. +- Alter kullanarak bir tabloya eklenen null bir sütun sorgularken bir kilitlenme düzeltildi. +- Satır sayısı sınırdan az ise, null bir sütuna göre sıralama yaparken bir kilitlenme düzeltildi. +- Yalnızca sabit değerlerden oluşan alt sorgu ile bir sipariş düzeltildi. +- Daha önce, çoğaltılmış bir tablo başarısız bir bırakma tablosundan sonra geçersiz durumda kalabilir. +- Boş sonuçları olan skaler alt sorgular için takma adlar artık kaybolmaz. +- Şimdi derleme kullanılan bir sorgu .so dosyası zarar görürse bir hata ile başarısız değil. diff --git a/docs/tr/whats-new/changelog/2018.md b/docs/tr/whats-new/changelog/2018.md new file mode 100644 index 00000000000..5cd417fb525 --- /dev/null +++ b/docs/tr/whats-new/changelog/2018.md @@ -0,0 +1,1063 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 78 +toc_title: '2018' +--- + +## ClickHouse sürümü 18.16 {#clickhouse-release-18-16} + +### ClickHouse sürümü 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} + +#### Hata düzeltmeleri: {#bug-fixes} + +- ODBC kaynağı ile sözlükleri güncelleme ile ilgili sorunlara yol açan bir hata düzeltildi. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- Toplama işlevlerinin JIT derlemesi artık LowCardinality sütunlarıyla çalışır. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) + +#### Geliştirmeler: {#improvements} + +- Add theed the `low_cardinality_allow_in_native_format` ayar (varsayılan: etkin). Devre dışı bırakıldığında, LOWCARDİNALİTY sütunları, SELECT sorguları için sıradan sütunlara dönüştürülür ve INSERT sorguları için sıradan sütunlar beklenir. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) + +#### İyileştirmeler oluşturun: {#build-improvements} + +- MacOS ve ARM üzerine inşa için düzeltmeler. + +### ClickHouse yayın 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} + +#### Yenilik: {#new-features} + +- `DEFAULT` ifadeler, yarı yapılandırılmış giriş biçimlerinde veri yüklenirken eksik alanlar için değerlendirilir (`JSONEachRow`, `TSKV`). Özelliği ile etkin `insert_sample_with_metadata` ayar. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) +- Bu `ALTER TABLE` sorgu şimdi var `MODIFY ORDER BY` bir tablo sütunu eklerken veya kaldırırken sıralama anahtarını değiştirme eylemi. Bu tablolar için yararlıdır `MergeTree` bu sıralama anahtarına dayalı olarak birleştirilirken ek görevler gerçekleştiren aile `SummingMergeTree`, `AggregatingMergeTree` ve bu yüzden. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) +- Tablolar için `MergeTree` aile, şimdi farklı bir sıralama anahtarı belirtebilirsiniz (`ORDER BY` ve dizin (`PRIMARY KEY`). Sıralama anahtarı dizin daha uzun olabilir. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) +- Add theed the `hdfs` tablo fonksiyonu ve `HDFS` hdfs’ye veri içe ve dışa aktarmak için tablo motoru. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) +- Base64 ile çalışmak için fonksiyonlar eklendi: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) +- Şimdi hassasiyetini yapılandırmak için bir parametre kullanabilirsiniz `uniqCombined` toplama işlevi (HyperLogLog hücrelerinin sayısını seçin). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) +- Add theed the `system.contributors` ClickHouse taahhüt yapılan herkesin adlarını içeren tablo. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) +- Bölüm için ihmal yeteneği eklendi `ALTER TABLE ... FREEZE` tüm bölümleri bir kerede yedeklemek için sorgu. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) +- Katma `dictGet` ve `dictGetOrDefault` dönüş değeri türünü belirtmeyi gerektirmeyen işlevler. Tür sözlük açıklamasından otomatik olarak belirlenir. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3564) +- Şimdi tablo açıklamasında bir sütun için yorum belirtmek ve kullanarak değiştirebilirsiniz `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) +- Okuma için desteklenir `Join` basit tuşlarla tabloları yazın. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Şimdi seçenekleri belirtebilirsiniz `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, ve `join_overflow_mode` oluştururken bir `Join` tablo yazın. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Add theed the `joinGet` kullan allowsmanıza olanak sağlayan bir işlev `Join` bir sözlük gibi tablo yazın. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3728) +- Add theed the `partition_key`, `sorting_key`, `primary_key`, ve `sampling_key` Col theum thens to the `system.tables` tablo tuşları hakkında bilgi vermek için tablo. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Add theed the `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, ve `is_in_sampling_key` Col theum thens to the `system.columns` Tablo. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) +- Add theed the `min_time` ve `max_time` Col theum thens to the `system.parts` Tablo. Bölümleme anahtarı aşağıdakilerden oluşan bir ifade olduğunda bu sütunlar doldurulur `DateTime` sütun. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) + +#### Hata düzeltmeleri: {#bug-fixes-1} + +- Düzeltmeler ve performans iyileştirmeleri için `LowCardinality` veri türü. `GROUP BY` kullanım `LowCardinality(Nullable(...))`. Değerlerini almak `extremes`. Yüksek mertebeden fonksiyonların işlenmesi. `LEFT ARRAY JOIN`. Dağılı `GROUP BY`. Dönen işlevler `Array`. Yürütme `ORDER BY`. Yazma `Distributed` tablolar (nicelulu). Geriye dönük uyumluluk için `INSERT` uygulayan eski istemcilerden gelen sorgular `Native` protokol. İçin destek `LowCardinality` için `JOIN`. Tek bir akışta çalışırken geliştirilmiş performans. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) +- Sabit nasıl `select_sequential_consistency` seçenek çalışır. Daha önce, bu ayar etkinleştirildiğinde, bazen yeni bir bölüme yazmaya başladıktan sonra tamamlanmamış bir sonuç döndürüldü. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) +- DDL yürütülürken veritabanları doğru belirtilir `ON CLUSTER` sorgular ve `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Veritabanları doğru bir görünüm içinde alt sorgular için belirtilir. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Bir hata düzeltildi `PREWHERE` ile `FINAL` için `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) +- Şimdi kullanabilirsiniz `KILL QUERY` henüz başlatılmamış olan sorguları iptal etmek için, tablonun kilitlenmesini bekliyorlar. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) +- Saatlerin gece yarısı geri hareket ettirilmesi durumunda düzeltilmiş tarih ve saat hesaplamaları (bu İran’da olur ve Moskova’da 1981’den 1983’e kadar olur). Önceden, bu, gerekenden bir gün önce sıfırlanma süresine yol açtı ve ayrıca tarih ve saatin metin biçiminde yanlış biçimlendirilmesine neden oldu. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) +- Bazı durumlarda sabit hatalar `VIEW` ve veritabanını atlayan alt sorgular. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) +- Aynı anda bir yarıştan okurken bir yarış durumu düzeltildi `MATERIALIZED VIEW` ve Silme bir `MATERIALIZED VIEW` nedeniyle değil kilitleme iç `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) +- Hata düzeltildi `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) +- Sabit sorgu işleme zaman `compile_expressions` seçenek etkindir (varsayılan olarak etkindir). Gibi Nondeterministic sabit ifadeler `now` işlev artık açılmıyor. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) +- Sabit olmayan bir ölçek argümanı belirtilirken bir kilitlenme düzeltildi `toDecimal32/64/128` işlevler. +- Bir dizi eklemeye çalışırken bir hata düzeltildi `NULL` element inler `Values` bir sütuna Biçimlendir türü `Array` olarak `Nullable` (eğer `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) +- Sabit sürekli hata günlüğü `DDLWorker` ZooKeeper mevcut değilse. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) +- Sabit dönüş türü için `quantile*` gelen fonksiyonlar `Date` ve `DateTime` argüman türleri. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) +- Sabit `WITH` Ifade olmadan basit bir takma ad belirtirse yan tümcesi. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) +- Adlandırılmış alt sorgular ve nitelikli sütun adları ile sorguların sabit işleme `enable_optimize_predicate_expression` etkindir. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) +- Hata düzeltildi `Attempt to attach to nullptr thread group` maddi görüşlerle çalışırken. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) +- Belirli yanlış argümanları iletirken bir kilitlenme düzeltildi `arrayReverse` işlev. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- Tampon taş theması Düzelt theildi `extractURLParameter` işlev. Geliştirilmiş performans. Sıfır bayt içeren dizelerin doğru işlenmesi eklendi. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) +- Sabit tampon taşması `lowerUTF8` ve `upperUTF8` işlevler. Üzerinde bu işlevleri yürütmek için yeteneği kaldırıldı `FixedString` bağımsız değişkenleri yazın. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) +- Silerken nadir bir yarış durumu düzeltildi `MergeTree` Tablolar. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) +- Okuma sırasında bir yarış durumu düzeltildi `Buffer` tablolar ve aynı anda performans `ALTER` veya `DROP` hedef masalarda. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) +- Sabit bir segfault eğer `max_temporary_non_const_columns` sınır aşıldı. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### Geliştirmeler: {#improvements-1} + +- Sunucu için işlenmiş yapılandırma dosyalarını yazmaz `/etc/clickhouse-server/` dizin. Bunun yerine, onları kaydeder `preprocessed_configs` içindeki dizin `path`. Bu demektir `/etc/clickhouse-server/` dizin için yazma erişimi yok `clickhouse` güvenliği artıran kullanıcı. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) +- Bu `min_merge_bytes_to_use_direct_io` seçenek varsayılan olarak 10 GiB olarak ayarlanır. Mergetree ailesinden tabloların büyük bölümlerini oluşturan bir birleştirme gerçekleştirilir `O_DIRECT` aşırı sayfa önbellek tahliyesini önleyen mod. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) +- Hızlandırılmış sunucu, çok sayıda tablo olduğunda başlar. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) +- Bir bağlantı havuzu ve HTTP eklendi `Keep-Alive` yinelemeler arasındaki bağlantılar için. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) +- Sorgu sözdizimi geçersiz ise, `400 Bad Request` kod iade edilir `HTTP` arabirim (500 daha önce iade edildi). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) +- Bu `join_default_strictness` option is set to `ALL` uyumluluk için varsayılan olarak. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) +- Kaldırılan günlüğü `stderr` şuradan `re2` geçersiz veya karmaşık düzenli ifadeler için kütüphane. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) +- İçin eklendi `Kafka` tablo altyapısı: kafka’dan okumaya başlamadan önce abonelikleri denetler; tablo için kafka\_max\_block\_size ayarı. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) +- Bu `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, ve `murmurHash3_64` işlevler artık herhangi bir sayıda bağımsız değişken ve bağımsız değişkenler için tuples şeklinde çalışır. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) +- Bu `arrayReverse` işlev artık herhangi bir dizi türü ile çalışır. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) +- İsteğe bağlı bir parametre eklendi: yuva boyutu için `timeSlots` işlev. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) +- İçin `FULL` ve `RIGHT JOIN`, bu `max_block_size` ayar, sağ tablodan birleştirilmemiş veri akışı için kullanılır. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3699) +- Add theed the `--secure` komut satırı parametresi `clickhouse-benchmark` ve `clickhouse-performance-test` TLS’Yİ etkinleştirmek için. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) +- Tür dönüştürme zaman yapısı bir `Buffer` tür tablo hedef tablonun yapısıyla eşleşmiyor. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) +- Add theed the `tcp_keep_alive_timeout` belirtilen zaman aralığı için hareketsizlikten sonra canlı tutma paketlerini etkinleştirme seçeneği. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) +- Bölüm anahtarı için değerlerin gereksiz alıntı kaldırıldı `system.parts` tablo tek bir sütundan oluşuyorsa. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) +- Modulo fonksiyonu için çalışır `Date` ve `DateTime` veri türleri. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) +- İçin eş anlamlı eklendi `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, ve `MID` işlevler. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Bazı işlev adları, SQL standardı ile uyumluluk için büyük / küçük harf duyarsızdır. Sözdizimsel şeker eklendi `SUBSTRING(expr FROM start FOR length)` SQL ile uyumluluk için. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) +- Yeteneği eklendi `mlock` karşılık gelen bellek sayfaları `clickhouse-server` bellek yetersiz zorla önlemek için yürütülebilir kod. Bu özellik varsayılan olarak devre dışıdır. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) +- Okuma sırasında geliştirilmiş performans `O_DIRECT` (ile `min_bytes_to_use_direct_io` seçeneği etkin). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) +- Geliştirilmiş performans `dictGet...OrDefault` sabit anahtar bağımsız değişkeni ve sabit olmayan bir varsayılan bağımsız değişken için işlev. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3563) +- Bu `firstSignificantSubdomain` işlev artık etki alanlarını işler `gov`, `mil`, ve `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Geliştirilmiş performans. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) +- Başlangıç için özel ortam değişkenlerini belirleme yeteneği `clickhouse-server` kullanarak `SYS-V init.d` tanım bylayarak script `CLICKHOUSE_PROGRAM_ENV` içinde `/etc/default/clickhouse`. + [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) +- Clickhouse-server init komut dosyası için doğru dönüş kodu. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) +- Bu `system.metrics` tablo şimdi var `VersionInteger` metr andik ve `system.build_options` eklenen satır var `VERSION_INTEGER`, ClickHouse sürümünün sayısal formunu içeren, örneğin `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) +- Karşılaştırma yeteneği kaldırıldı `Date` gibi olası hataları önlemek için bir sayı ile yazın `date = 2018-12-17`, tarih etrafında tırnak yanlışlıkla ihmal nerede. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) +- Durumsal işlevlerin davranışı gibi düzeltildi `rowNumberInAllBlocks`. Daha önce sorgu analizi sırasında başlatma nedeniyle bir sayı daha büyük olan bir sonuç çıkardılar. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3729) +- Eğer… `force_restore_data` dosya silinemez, bir hata mesajı görüntülenir. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3794) + +#### İyileştirmeler oluşturun: {#build-improvements-1} + +- Güncelleme `jemalloc` olası bir bellek sızıntısını gideren kitaplık. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3557) +- İle profil profilingleme `jemalloc` hata ayıklama yapıları için varsayılan olarak etkindir. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) +- Yalnızca entegrasyon testlerini çalıştırma yeteneği eklendi `Docker` sistemde yüklü. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) +- Select sorgularında fuzz ifade testi eklendi. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) +- Daha fazla yarış koşullarını tespit etmek için paralel ve rastgele sırayla fonksiyonel testler gerçekleştiren taahhütler için bir stres testi eklendi. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) +- Bir Docker görüntüsünde clickhouse-server başlatmak için yöntem geliştirildi. [Elghazal Ahmed](https://github.com/ClickHouse/ClickHouse/pull/3663) +- Bir Docker görüntüsü için, dosyaları kullanarak veritabanlarını başlatmak için destek eklendi `/docker-entrypoint-initdb.d` dizin. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) +- Arm üzerine inşa için düzeltmeler. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes} + +- Karşılaştırma yeteneği kaldırıldı `Date` bir sayı ile yazın. Yerine `toDate('2018-12-18') = 17883`, açık tür dönüştürme kullanmanız gerekir `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) + +## ClickHouse sürümü 18.14 {#clickhouse-release-18-14} + +### ClickHouse yayın 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} + +#### Hata düzeltmeleri: {#bug-fixes-2} + +- ODBC kaynağı ile sözlükleri güncelleme ile ilgili sorunlara yol açan bir hata düzeltildi. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) +- DDL yürütülürken veritabanları doğru belirtilir `ON CLUSTER` sorgular. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) +- Sabit bir segfault eğer `max_temporary_non_const_columns` sınır aşıldı. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) + +#### İyileştirmeler oluşturun: {#build-improvements-2} + +- Arm üzerine inşa için düzeltmeler. + +### ClickHouse yayın 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} + +#### Hata düzeltmeleri: {#bug-fixes-3} + +- Sabit hata `dictGet...` tip sözlükler için işlev `range`, argümanlardan biri sabit ve diğeri değilse. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) +- Mesajlara neden olan Sabit hata `netlink: '...': attribute type 1 has an invalid length` Linux çekirdeği günlüğüne yazdırılmak üzere, bu sadece Linux çekirdeğinin yeterince taze sürümlerinde gerçekleşiyordu. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) +- Fonksiyon sabit segfault `empty` argüman için `FixedString` tür. [Daniel, Dao Quang Minh.](https://github.com/ClickHouse/ClickHouse/pull/3703) +- Büyük bir değer kullanırken sabit aşırı bellek ayırma `max_query_size` ayar (bir bellek yığını `max_query_size` bayt bir kerede önceden tahsis edildi). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) + +#### Yapı değişiklikleri: {#build-changes} + +- OS paketlerinden sürüm 7 LLVM/Clang kütüphaneleri ile sabit yapı (bu kütüphaneler çalışma zamanı sorgu derleme için kullanılır). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### ClickHouse yayın 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} + +#### Hata düzeltmeleri: {#bug-fixes-4} + +- ODBC köprü işlemi ana sunucu işlemi ile sonlandırmak değil sabit durumlar. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) +- Sabit senkron ekleme içine `Distributed` uzak tablonun sütun listesinden farklı bir sütun listesi içeren tablo. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) +- Bir MergeTree tablosunu düşürürken bir kazaya yol açabilecek nadir bir yarış durumu düzeltildi. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Sorgu iş parçacığı oluşturma ile başarısız olduğunda bir sorgu kilitlenme düzeltildi `Resource temporarily unavailable` hatasız. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) +- Sabit ayrıştırma `ENGINE` fık thera ne zaman `CREATE AS table` sözdizimi kullanıldı ve `ENGINE` fık thera daha önce belirt theilmişti `AS table` (hata, belirtilen motoru yok saymakla sonuçlandı). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) + +### ClickHouse yayın 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} + +#### Hata düzeltmeleri: {#bug-fixes-5} + +- Bellek yığınının boyutu, türün sütununu seri hale getirirken fazla tahmin edildi `Array(String)` bu yol açar “Memory limit exceeded” hatasızlar. Sorun 18.12.13 sürümünde ortaya çıktı. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) + +### ClickHouse yayın 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} + +#### Hata düzeltmeleri: {#bug-fixes-6} + +- Sabit `ON CLUSTER` küme güvenli (bayrak) olarak yapılandırıldığında sorgular ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) + +#### Yapı değişiklikleri: {#build-changes-1} + +- Sabit sorunlar (sistemden llvm-7, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) + +### ClickHouse yayın 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} + +#### Hata düzeltmeleri: {#bug-fixes-7} + +- Sabit `Block structure mismatch in MergingSorted stream` hatasız. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) +- Sabit `ON CLUSTER` küme yapılandırmasında güvenli bağlantıların açık olması durumunda sorgular ( `` bayrak). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) +- Kullanılan sorgularda bir hata düzeltildi `SAMPLE`, `PREWHERE` ve alias sütunları. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) +- Sabit bir nadir `unknown compression method` hata ne zaman `min_bytes_to_use_direct_io` ayar etkinleştirildi. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) + +#### Performans iyileştirmeleri: {#performance-improvements} + +- Sorguların sabit performans gerilemesi `GROUP BY` AMD EPYC işlemciler üzerinde yürütülürken uint16 veya tarih türü sütunların. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) +- Uzun dizeleri işleyen sorguların sabit performans gerilemesi. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) + +#### İyileştirmeler oluşturun: {#build-improvements-3} + +- Arcadia yapı basitleştirilmesi için iyileştirmeler. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) + +### ClickHouse yayın 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} + +#### Hata düzeltmeleri: {#bug-fixes-8} + +- İki isimsiz alt sorgu katılmadan bir kilitlenme düzeltildi. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) +- Hatalı sorgular oluşturma sabit (boş `WHERE` yan tümcesi) dış veritabanlarını sorgularken. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) +- ODBC sözlüklerinde yanlış bir zaman aşımı değeri kullanılarak düzeltildi. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) + +### ClickHouse yayın 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} + +#### Hata düzeltmeleri: {#bug-fixes-9} + +- Hata düzeltildi `Block structure mismatch in UNION stream: different number of columns` sınır sorgularında. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) +- İç içe geçmiş yapılar içinde diziler içeren tablolarda veri birleştirirken sabit hatalar. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) +- Sabit yanlış sorgu sonuçları eğer `merge_tree_uniform_read_distribution` ayar devre dışı (varsayılan: etkin). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) +- Yerel formatta dağıtılmış bir tabloya ekler üzerinde bir hata düzeltildi. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) + +### ClickHouse yayın 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} + +- Bu `compile_expressions` ayar (ifadelerin JIT derlemesi) varsayılan olarak devre dışıdır. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) +- Bu `enable_optimize_predicate_expression` ayar varsayılan olarak devre dışıdır. + +### ClickHouse yayın 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} + +#### Yenilik: {#new-features-1} + +- Bu `WITH CUBE` değiştirici için `GROUP BY` (alternatif sözdizimi `GROUP BY CUBE(...)` ayrıca kullanılabilir) vardır. [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) +- Add theed the `formatDateTime` işlev. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) +- Add theed the `JDBC` masa motoru ve `jdbc` tablo işlevi (clickhouse-jdbc-bridge yüklenmesini gerektirir). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- ISO hafta numarası ile çalışmak için fonksiyonlar eklendi: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, ve `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) +- Şimdi kullanabilirsiniz `Nullable` Col forum forns for `MySQL` ve `ODBC` Tablolar. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- İç içe geçmiş veri yapıları, iç içe geçmiş nesneler olarak okunabilir `JSONEachRow` biçimli. Add theed the `input_format_import_nested_json` ayar. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) +- Paralel işleme birçok kişi için kullanılabilir `MATERIALIZED VIEW`s veri eklerken. Görmek `parallel_view_processing` ayar. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) +- Add theed the `SYSTEM FLUSH LOGS` sorgu (sistem tablolarına zorla günlük basması gibi `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) +- Şimdi önceden tanımlanmış kullanabilirsiniz `database` ve `table` bildirirken makrolar `Replicated` Tablolar. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) +- Okuma yeteneği eklendi `Decimal` mühendislik notasyonunda değerleri yazın (on yetkilerini gösterir). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) + +#### Deneysel özellikler: {#experimental-features} + +- GROUP BY CLA clauseuse for `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) +- İçin ifadelerin optimize hesaplama `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) + +#### Geliştirmeler: {#improvements-2} + +- İle sorgular için önemli ölçüde azaltılmış bellek tüketimi `ORDER BY` ve `LIMIT`. Görmek `max_bytes_before_remerge_sort` ayar. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- Yokluğ theunda `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` kabul edilir. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) +- Nitelikli yıldız işaretleri ile sorgularda düzgün çalışır `JOIN`. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) +- Bu `ODBC` table engine doğru bir uzak veritabanı SQL lehçesinde tanımlayıcıları alıntı yöntemi seçer. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) +- Bu `compile_expressions` ayar (ifadelerin JIT derlemesi) varsayılan olarak etkindir. +- Varsa eşzamanlı damla veritabanı/tablo için sabit davranış ve varsa veritabanı/tablo oluşturun. Daha önce, bir `CREATE DATABASE ... IF NOT EXISTS` sorgu hata iletisi döndürebilir “File … already exists” ve `CREATE TABLE ... IF NOT EXISTS` ve `DROP TABLE IF EXISTS` sorgular dönebilir `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) +- MySQL veya ODBC tablolarından sorgularken sabit bir sağ yarıya sahip ifadelerde ve ifadelerde uzak sunucuya geçirilir. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- MySQL ve ODBC tablolarından sorgularken bir WHERE yan tümcesinde sabit ifadelerle karşılaştırmalar uzak sunucuya geçirilir. Önceden, sadece sabitler ile karşılaştırmalar geçirildi. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) +- Terminalde satır genişliğinin doğru hesaplanması `Pretty` hiyeroglifli dizeler de dahil olmak üzere formatlar. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3257). +- `ON CLUSTER` için belirt forilebilir `ALTER UPDATE` sorgular. +- Verileri okumak için geliştirilmiş performans `JSONEachRow` biçimli. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) +- İçin eş anlamlı eklendi `LENGTH` ve `CHARACTER_LENGTH` uyumluluk için fonksiyonlar. Bu `CONCAT` işlev artık büyük / küçük harfe duyarlı değildir. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) +- Add theed the `TIMESTAMP` eşanlamlı `DateTime` tür. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) +- Günlük satırı bir sorgu ile ilişkili olmasa bile, sunucu günlüklerinde query\_id için ayrılmış alan her zaman vardır. Bu, sunucu metin günlüklerini üçüncü taraf araçlarla Ayrıştırmayı kolaylaştırır. +- Gigabayt bir tamsayı sonraki düzeyini aştığında, bir sorgu tarafından bellek tüketimi kaydedilir. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) +- Yerel protokolü kullanan istemci kitaplığı sunucu ekleme sorgusu için beklediğinden daha az sütun yanlışlıkla gönderdiğinde durum için uyumluluk modu eklendi. Bu senaryo, clickhouse-cpp kitaplığını kullanırken mümkün oldu. Daha önce, bu senaryo sunucunun çökmesine neden oldu. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) +- Kullanıcı tanımlı bir ifade içinde `clickhouse-copier` şimdi kullanabilirsiniz `partition_key` alias (kaynak tablo bölümüne göre ek filtreleme için). Bu, bölümleme şeması kopyalama sırasında değişirse, ancak yalnızca biraz değişirse yararlıdır. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) +- Bu iş akışı `Kafka` motor, yüksek yüklerde veri okuma hızını otomatik olarak azaltmak için bir arka plan iş parçacığı havuzuna taşındı. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- Okuma desteği `Tuple` ve `Nested` gibi yapıların değerleri `struct` in the `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) +- İçin en üst düzey etki alanlarının listesi `firstSignificantSubdomain` işlev artık etki alanını içerir `biz`. [decaseal](https://github.com/ClickHouse/ClickHouse/pull/3219) +- Dış sözlüklerin yapılandırmasında, `null_value` varsayılan veri türü değeri olarak yorumlanır. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) +- İçin destek `intDiv` ve `intDivOrZero` fonksiyonlar için `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) +- İçin destek `Date`, `DateTime`, `UUID`, ve `Decimal` anahtar olarak türleri `sumMap` toplama işlevi. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) +- İçin destek `Decimal` harici sözlüklerde veri türü. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) +- İçin destek `Decimal` veri türü `SummingMergeTree` Tablolar. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) +- İçin uzmanlık eklendi `UUID` içinde `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) +- Sayısı azal thedı `open` ve `close` bir gelen okurken sistem çağrıları `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) +- A `TRUNCATE TABLE` sorgu (sorgu için lider yineleme geçirilir) herhangi bir yineleme üzerinde çalıştırılabilir. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) + +#### Hata düzeltmeleri: {#bug-fixes-10} + +- İle bir sorun düzeltildi `Dictionary` için tablolar `range_hashed` sözlükler. Bu hata 18.12.17 sürümünde oluştu. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) +- Yüklerken bir hata düzeltildi `range_hashed` söz dictionarieslükler (mesaj `Unsupported type Nullable (...)`). Bu hata 18.12.17 sürümünde oluştu. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) +- Sabit hatalar `pointInPolygon` birbirine yakın bulunan çok sayıda köşe ile çokgenler için yanlış hesaplamaların birikmesi nedeniyle işlev. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) +- Veri parçalarını birleştirdikten sonra, elde edilen parçanın sağlama toplamı, başka bir kopyadaki aynı birleştirme sonucundan farklıysa, birleştirme sonucu silinir ve veri kısmı diğer kopyadan indirilir (bu doğru davranıştır). Ancak, veri bölümünü indirdikten sonra, parçanın zaten var olduğu bir hata nedeniyle çalışma kümesine eklenemedi(çünkü veri kısmı birleşmeden sonra bir miktar gecikmeyle silindi). Bu, aynı verileri indirmek için döngüsel girişimlere yol açtı. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) +- Sorgularla toplam bellek tüketiminin yanlış hesaplanması düzeltildi (yanlış hesaplama nedeniyle, `max_memory_usage_for_all_queries` ayar yanlış çalıştı ve `MemoryTracking` metrik yanlış bir değere sahipti). Bu hata, 18.12.13 sürümünde oluştu. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) +- İşlevselliğini sabit `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` Bu hata, 18.12.13 sürümünde oluştu. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) +- İçin veri yapılarının sabit gereksiz hazırlanması `JOIN`eğer sorgu başlatan sunucuda s `JOIN` yalnızca uzak sunucularda gerçekleştirilir. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) +- Sabit hatalar `Kafka` motor: verileri okumaya başladığınızda istisnalardan sonra kilitlenmeler ve tamamlandıktan sonra kilitler [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). +- İçin `Kafka` tablolar, isteğe bağlı `schema` parametre geç notilm (edi (şema `Cap'n'Proto` biçimli). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) +- ZooKeeper sunucularının topluluğu, bağlantıyı kabul eden ancak el sıkışmaya yanıt vermek yerine hemen kapatan sunuculara sahipse, ClickHouse başka bir sunucuya bağlanmayı seçer. Daha önce, bu hata üretti `Cannot read all data. Bytes read: 0. Bytes expected: 4.` ve sunucu başlatılamadı. [8218cf3a](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) +- Zookeeper sunucularının topluluğu, DNS sorgusunun bir hata döndürdüğü sunucular içeriyorsa, bu sunucular yoksayılır. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) +- Arasında sabit tip dönüşüm `Date` ve `DateTime` veri eklerken `VALUES` biçim (eğer `input_format_values_interpret_expressions = 1`). Daha önce, dönüşüm Unix dönem zamanındaki gün sayısının sayısal değeri ile Unix zaman damgası arasında gerçekleştirildi ve bu da beklenmedik sonuçlara yol açtı. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) +- Arasında düzeltilmiş tip dönüşümü `Decimal` ve tam sayı. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) +- Sabit hatalar `enable_optimize_predicate_expression` ayar. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) +- Varsayılan olmayan bir CSV ayırıcı kullanılıyorsa, kayan noktalı sayılarla CSV formatında bir ayrıştırma hatası düzeltildi `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) +- Sabit `arrayCumSumNonNegative` fonksiyon (akümülatör sıfırdan az ise negatif değerler biriktirmez). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) +- Sabit nasıl `Merge` tablolar üstünde çalışır `Distributed` kullanırken tablolar `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) +- Hata düzeltmeleri `ALTER UPDATE` sorgu. +- Sabit hatalar `odbc` 18.12 sürümünde görünen tablo işlevi. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) +- İle toplama fonksiyon operationlarının çalışmasını sabit `StateArray` birleştiriciler. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) +- Bir bölme sırasında bir kilitlenme düzeltildi `Decimal` sıfır değeri. [69dd6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) +- Kullanarak işlemler için sabit çıktı türleri `Decimal` ve tamsayı argümanları. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) +- Sırasında segfault sabit `GROUP BY` üzerinde `Decimal128`. [3359ba06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) +- Bu `log_query_threads` ayar (sorgu yürütme her iş parçacığı hakkında bilgi günlüğe kaydetme) şimdi yalnızca `log_queries` (sorgularla ilgili bilgileri günlüğe kaydetme) seçeneği 1 olarak ayarlanır. Sin thece the `log_query_threads` seçenek varsayılan olarak etkindir, sorgu günlüğü devre dışı bırakılmış olsa bile iş parçacıkları hakkında bilgi daha önce günlüğe kaydedildi. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) +- Quantiles toplama fonksiyonunun dağıtılmış işleminde bir hata düzeltildi (hata mesajı `Not found column quantile...`). [292a8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) +- Aynı anda sürüm 18.12.17 sunucuları ve eski sunuculardan oluşan bir küme üzerinde çalışırken uyumluluk sorunu düzeltildi. Hem sabit hem de sabit olmayan uzunluktaki GROUP BY anahtarlarıyla dağıtılmış sorgular için, toplanacak büyük miktarda veri varsa, döndürülen veriler her zaman tam olarak toplanmadı (iki farklı satır aynı toplama anahtarlarını içeriyordu). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) +- Değiştirmelerin sabit kullanımı `clickhouse-performance-test`, sorgu testte bildirilen değiştirmelerin yalnızca bir kısmını içeriyorsa. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) +- Kullanırken bir hata düzeltildi `FINAL` ile `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Kullanırken bir hata düzeltildi `PREWHERE` sırasında eklenen sütun overların üzerinde `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) +- Olmaması için bir çek eklendi `arrayJoin` için `DEFAULT` ve `MATERIALIZED` ifadeler. Önceden, `arrayJoin` veri eklerken bir hataya yol açtı. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) +- Olmaması için bir çek eklendi `arrayJoin` in a `PREWHERE` yan. Daha önce, bu gibi mesajlara yol açtı `Size ... doesn't match` veya `Unknown compression method` sorguları yürütürken. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) +- Değiştirilen optimizasyon ve eşitlik değerlendirmelerinden karşılık gelen ifadeyle zincirler sonra nadir durumlarda ortaya çıkabilecek sabit segfault. [liuyimin-bytedance](https://github.com/ClickHouse/ClickHouse/pull/3339) +- İçin küçük düzeltmeler `clickhouse-benchmark`: daha önce, istemci bilgileri sunucuya gönderilmedi; şimdi yürütülen sorguların sayısı kapatılırken ve yineleme sayısını sınırlamak için daha doğru hesaplanır. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-1} + +- Kaldır theılan `allow_experimental_decimal_type` seçenek. Bu `Decimal` veri türü varsayılan kullanım için kullanılabilir. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) + +## ClickHouse sürümü 18.12 {#clickhouse-release-18-12} + +### ClickHouse yayın 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} + +#### Yenilik: {#new-features-2} + +- `invalidate_query` (bir dış sözlük güncelleştirilmesi gerekip gerekmediğini denetlemek için bir sorgu belirtmek için yeteneği) `clickhouse` kaynaklı. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) +- Kullanma yeteneği eklendi `UInt*`, `Int*`, ve `DateTime` veri türleri (birlikte `Date` type) as a `range_hashed` aralıkların sınırlarını tanımlayan dış sözlük anahtarı. Şimdi `NULL` açık bir aralık belirlemek için kullanılabilir. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) +- Bu `Decimal` şimdi yazın destekler `var*` ve `stddev*` toplama fonksiyonları. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- Bu `Decimal` tip artık matematiksel fonksiyonları destekliyor (`exp`, `sin` ve böyle devam eder.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) +- Bu `system.part_log` tablo şimdi var `partition_id` sütun. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Hata düzeltmeleri: {#bug-fixes-11} + +- `Merge` şimdi düzgün çalışıyor `Distributed` Tablolar. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) +- Sabit uyumsuzluk (gereksiz bağımlılık `glibc` sürüm) bu Clickhouse’u çalıştırmayı imkansız hale getirdi `Ubuntu Precise` ve eski sürümleri. Uyumsuzluk 18.12.13 sürümünde ortaya çıktı. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) +- Sabit hatalar `enable_optimize_predicate_expression` ayar. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) +- 18.12.13’ten önceki sürümlerde bir kopya kümesiyle çalışırken ve aynı anda daha yeni bir sürüme sahip bir sunucuda bir tablonun yeni bir kopyasını oluştururken ortaya çıkan geriye dönük uyumluluğa sahip küçük bir sorun düzeltildi (mesajda gösterilir `Can not clone replica, because the ... updated to new ClickHouse version`, mantıklı, ama olmamalı). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-2} + +- Bu `enable_optimize_predicate_expression` seçenek varsayılan olarak etkindir (oldukça iyimser olan). Sütun adları için arama için ilgili sorgu çözümleme hataları oluşursa, ayarla `enable_optimize_predicate_expression` 0’a. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) + +### ClickHouse yayın 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} + +#### Yenilik: {#new-features-3} + +- İçin destek eklendi `ALTER UPDATE` sorgular. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) +- Add theed the `allow_ddl` kullanıcının DDL sorgularına erişimini kısıtlayan seçenek. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) +- Add theed the `min_merge_bytes_to_use_direct_io` seçeneği için `MergeTree` birleştirmenin toplam boyutu için bir eşik ayarlamanıza izin veren motorlar(eşiğin üstünde olduğunda, veri parçası dosyaları o\_direct kullanılarak işlenecektir). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) +- Bu `system.merges` sistem tablosu şimdi içerir `partition_id` sütun. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) + +#### Geliştirmeler {#improvements-3} + +- Bir veri parçası mutasyon sırasında değişmeden kalırsa, yinelemeler tarafından indirilmez. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) +- Otomatik tamamlama ile çalışırken ayarların adları için kullanılabilir `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) + +#### Hata düzeltmeleri: {#bug-fixes-12} + +- Elemanları olan dizilerin boyutları için bir kontrol eklendi `Nested` eklerken alanları yazın. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) +- İle harici sözlükler güncellenmesi bir hata düzeltildi `ODBC` kaynak ve `hashed` depolama. Bu hata, 18.12.13 sürümünde oluştu. +- Bir sorgudan geçici bir tablo oluştururken bir kilitlenme düzeltildi `IN` koşul. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) +- Olabilecek diziler için toplam işlevlerde bir hata düzeltildi `NULL` öğeler. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) + +### ClickHouse yayın 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} + +#### Yenilik: {#new-features-4} + +- Add theed the `DECIMAL(digits, scale)` veri türü (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). Etkinleştirmek için ayarı kullanın `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) +- Yeni `WITH ROLLUP` değiştirici için `GROUP BY` (alternatif sözdizimi: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) +- JOIN ile sorgularda, yıldız karakteri SQL standardına uygun olarak tüm tablolardaki sütunların bir listesine genişletir. Ayarlayarak eski davranışı geri yükleyebilirsiniz `asterisk_left_columns_only` kullanıcı yapılandırma düzeyinde 1’e. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) +- Tablo fonksiyonları ile katılmak için destek eklendi. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- Clickhouse-client sekmesine basarak otomatik tamamlama. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) +- CTRL + C clickhouse-client girilen bir sorguyu temizler. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) +- Add theed the `join_default_strictness` ayar (değerler: `"`, `'any'`, `'all'`). Bu belirtmemenizi sağlar `ANY` veya `ALL` için `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) +- Sorgu işleme ile ilgili sunucu günlüğünün her satırı sorgu kimliğini gösterir. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Artık clickhouse-client’da sorgu yürütme günlükleri alabilirsiniz ( `send_logs_level` ayar). Dağıtılmış sorgu işleme ile günlükleri tüm sunuculardan basamaklandırılır. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Bu `system.query_log` ve `system.processes` (`SHOW PROCESSLIST`) bir sorgu çalıştırdığınızda tablolar artık tüm değiştirilen ayarları hakkında bilgi var (iç içe geçmiş yapısı `Settings` veriler). Add theed the `log_query_settings` ayar. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Bu `system.query_log` ve `system.processes` tablolar artık sorgu yürütülmesine katılan iş parçacığı sayısı hakkında bilgi gösterir (bkz. `thread_numbers` sütun). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Katma `ProfileEvents` ağ üzerinden okuma ve yazma ve diske okuma ve yazma için harcanan zamanı, ağ hatalarının sayısını ve ağ bant genişliği sınırlı olduğunda bekleyen harcanan zamanı ölçen sayaçlar. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Katma `ProfileEvents`rusage gelen ((bekle zaman G/Ç hakkında daha fazla bilgi edinmek için bu kullanım, CPU zamanı bekle ve veri miktarını okuma ve kaydedilen, sayfa önbelleği olan ve olmayan) kullanıcı alanı ve çekirdek, sayfa hataları ve bağlam anahtarlarının yanı sıra taskstats ölçülerine CPU kullanımı hakkında bilgi almak için onları kullanabilirsiniz) sistem ölçümlerini içeren sayaçları. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Bu `ProfileEvents` sayaçlar, genel olarak ve her sorgu için ve ayrıca sorguya göre kaynak tüketimini ayrıntılı olarak profillemenize izin veren her sorgu yürütme iş parçacığı için uygulanır. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Add theed the `system.query_thread_log` her sorgu yürütme iş parçacığı hakkında bilgi içeren tablo. Add theed the `log_query_threads` ayar. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) +- Bu `system.metrics` ve `system.events` tablolar artık yerleşik belgelere sahiptir. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) +- Add theed the `arrayEnumerateDense` işlev. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2975) +- Add theed the `arrayCumSumNonNegative` ve `arrayDifference` işlevler. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) +- Add theed the `retention` toplama işlevi. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) +- Artık Plus operatörünü kullanarak toplama işlevlerinin durumlarını ekleyebilir (birleştirebilirsiniz) ve toplama işlevlerinin durumlarını negatif olmayan bir sabitle çarpabilirsiniz. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) +- Mergetree ailesindeki tablolar artık sanal sütuna sahip `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) + +#### Deneysel özellikler: {#experimental-features-1} + +- Add theed the `LowCardinality(T)` veri türü. Bu veri türü otomatik olarak yerel bir değer sözlüğü oluşturur ve sözlüğü açmadan veri işlemeye izin verir. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) +- JIT derlenmiş işlevlerin bir önbellek ve derlemeden önce kullanım sayısı için bir sayaç eklendi. JIT derleme ifadeleri için `compile_expressions` ayar. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) + +#### Geliştirmeler: {#improvements-4} + +- Terkedilmiş yinelemeler olduğunda çoğaltma günlüğünün sınırsız birikimi ile ilgili sorun giderildi. Uzun bir gecikme ile kopyaları için etkili bir kurtarma modu eklendi. +- Geliştirilmiş performans `GROUP BY` bunlardan biri dize ve diğerleri sabit uzunlukta olduğunda birden fazla toplama alanı ile. +- Kullanırken geliştirilmiş performans `PREWHERE` ve ifad ofelerin örtülü olarak aktar ofılmasıyla `PREWHERE`. +- Metin formatları için geliştirilmiş ayrıştırma performansı (`CSV`, `TSV`). [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) +- İkili biçimlerde okuma dizeleri ve diziler geliştirilmiş performans. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2955) +- Sorgular için artan performans ve azaltılmış bellek tüketimi `system.tables` ve `system.columns` tek bir sunucuda çok sayıda tablo olduğunda. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) +- Bir hataya neden olan büyük bir sorgu akışı durumunda bir performans sorunu düzeltildi ( `_dl_addr` fonksiyon görünür `perf top`, ancak sunucu çok fazla CPU kullanmıyor). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) +- Koşullar Görünüm içine atılır (ne zaman `enable_optimize_predicate_expression` etkin) değildir. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) +- İçin işlevsellik geliştirmeleri `UUID` veri türü. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) +- Bu `UUID` veri türü-Simyacı sözlüklerde desteklenir. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) +- Bu `visitParamExtractRaw` işlev iç içe geçmiş yapılarla düzgün çalışır. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) +- Ne zaman `input_format_skip_unknown_fields` ayarı etkin, nesne alanları `JSONEachRow` biçim doğru atlanır. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) +- İçin… `CASE` koşullarla ifade, şimdi atlayabilirsiniz `ELSE` eşdeğer olan `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) +- ZooKeeper ile çalışırken operasyon zaman aşımı artık yapılandırılabilir. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) +- İçin bir ofset belirtebilirsiniz `LIMIT n, m` olarak `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- Kullanabilirsiniz `SELECT TOP n` için alternatif olarak sözdizimi `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) +- Sistem tablolarına yazmak için sıranın boyutunu arttırdı, böylece `SystemLog parameter queue is full` hata sık sık olmaz. +- Bu `windowFunnel` toplama işlevi artık birden çok koşulu karşılayan olayları destekler. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2801) +- Yinelenen sütunlar bir `USING` için fık forra `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) +- `Pretty` biçimlerin artık genişliğe göre sütun hizalaması üzerinde bir sınırı vardır. Kullan… `output_format_pretty_max_column_pad_width` ayar. Bir değer daha genişse, yine de bütünüyle görüntülenecektir, ancak tablodaki diğer hücreler çok geniş olmayacaktır. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) +- Bu `odbc` tablo işlevi artık veritabanı/şema adını belirtmenizi sağlar. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2885) +- Belirtilen bir kullanıcı adı kullanma yeteneği eklendi `clickhouse-client` yapılandırma dosyası. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) +- Bu `ZooKeeperExceptions` sayaç üç sayaçlara ayrılmıştır: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, ve `ZooKeeperOtherExceptions`. +- `ALTER DELETE` sorgular hayata görünümler için çalışır. +- Temizleme ipliğini periyodik olarak çalıştırırken randomizasyon eklendi `ReplicatedMergeTree` çok sayıda olduğunda periyodik yük ani önlemek için tablolar `ReplicatedMergeTree` Tablolar. +- İçin destek `ATTACH TABLE ... ON CLUSTER` sorgular. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) + +#### Hata düzeltmeleri: {#bug-fixes-13} + +- İle bir sorun düzeltildi `Dictionary` tablolar (atar `Size of offsets doesn't match size of column` veya `Unknown compression method` özel). Bu hata 18.10.3 sürümünde göründü. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) +- Birleştirirken bir hata düzeltildi `CollapsingMergeTree` veri parçalarından biri boşsa tablolar (bu parçalar birleştirme sırasında oluşturulur veya `ALTER DELETE` tüm veriler silindiyse) ve `vertical` birleştirme için algoritma kullanıldı. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) +- Sırasında bir yarış durumu düzeltildi `DROP` veya `TRUNCATE` için `Memory` eş zamanlı tablolar `SELECT`, sunucu çökmelerine neden olabilir. Bu hata 1.1.54388 sürümünde göründü. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) +- Takarken veri kaybı olasılığı düzeltildi `Replicated` tablolar ise `Session is expired` hata döndürülür (veri kaybı tarafından tespit edilebilir `ReplicatedDataLoss` ölçü). Bu hata 1.1.54378 sürümünde oluştu. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) +- Sırasında bir segfault sabit `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) +- Sütun adlarını ararken hata düzeltildi `WHERE` ifade tamamen nitelikli bir sütun adından oluşur, örneğin `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) +- Sabit “Not found column” uzak bir sunucudan bir alt sorgu ile bir In ifadesinden oluşan tek bir sütun isteniyorsa, dağıtılmış sorgular yürütülürken oluşan hata. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) +- Sabit `Block structure mismatch in UNION stream: different number of columns` kırıklardan biri yerel ve diğeri değilse dağıtılmış sorgular için oluşan hata ve taşınmanın en iyi duruma getirilmesi `PREWHERE` tetik .lenir. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) +- Sabit `pointInPolygon` dışbükey olmayan poligonların belirli durumları için işlev. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) +- Karşılaştırırken yanlış sonuç düzeltildi `nan` tamsayılarla. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) +- Sabit bir hata `zlib-ng` nadir durumlarda segfault yol açabilir kütüphane. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) +- Bir tabloya eklerken bir bellek sızıntısı düzeltildi `AggregateFunction` sütunlar, toplama işlevinin durumu basit değilse (belleği ayrı olarak ayırır) ve tek bir ekleme isteği birden çok küçük blokla sonuçlanırsa. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) +- Aynı şeyi oluştururken ve silerken bir yarış durumu düzeltildi `Buffer` veya `MergeTree` aynı anda tablo. +- Tuples gibi bazı önemsiz olmayan türlerinden oluşan tuples karşılaştırırken bir segfault olasılığını düzeltildi. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) +- Belirli çalıştırırken bir segfault olasılığı düzeltildi `ON CLUSTER` sorgular. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) +- Sabit bir hata `arrayDistinct` fonksiyonu için `Nullable` dizi elemanları. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) +- Bu `enable_optimize_predicate_expression` seçenek şimdi doğru olan durumları destekler `SELECT *`. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) +- Zookeeper oturumunu yeniden başlatırken segfault düzeltildi. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) +- ZooKeeper ile çalışırken sabit potansiyel engelleme. +- Bir iç içe veri yapıları eklemek için sabit yanlış kod `SummingMergeTree`. +- Toplama işlevlerinin durumları için bellek ayırırken, hizalama doğru bir şekilde dikkate alınır, bu da toplama işlevlerinin durumlarını uygularken hizalama gerektiren işlemlerin kullanılmasını mümkün kılar. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) + +#### Güvenlik düzeltme: {#security-fix} + +- ODBC veri kaynaklarının güvenli kullanımı. ODBC sürücüleri ile etkileşim ayrı bir `clickhouse-odbc-bridge` işleyiş. Üçüncü taraf ODBC sürücülerindeki hatalar artık sunucu kararlılığı veya güvenlik açıklarıyla ilgili sorunlara neden olmaz. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) +- Dosya yolunun yanlış doğrulanması düzeltildi `catBoostPool` tablo işlevi. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) +- Sistem tablolarının içeriği (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, ve `replication_queue`) kullanıcının veri tabanlarına yapılandırılmış erişimine göre filtrelenir (`allow_databases`). [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-3} + +- JOIN ile sorgularda, yıldız karakteri SQL standardına uygun olarak tüm tablolardaki sütunların bir listesine genişletir. Ayarlayarak eski davranışı geri yükleyebilirsiniz `asterisk_left_columns_only` kullanıcı yapılandırma düzeyinde 1’e. + +#### Yapı değişiklikleri: {#build-changes-2} + +- Çoğu entegrasyon testleri artık commit tarafından çalıştırılabilir. +- Kod stili kontrolleri de commit tarafından çalıştırılabilir. +- Bu `memcpy` CentOS7/Fedora üzerinde inşa ederken uygulama doğru seçilir. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) +- Oluşturmak için clang kullanırken, bazı uyarılar `-Weverything` düzenli ek olarak, eklenmiştir `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) +- Yapı hata ayıklama kullanır `jemalloc` hata ayıklama seçeneği. +- ZooKeeper ile etkileşim için kütüphanenin arayüzü soyut olarak ilan edilir. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) + +## ClickHouse sürümü 18.10 {#clickhouse-release-18-10} + +### ClickHouse yayın 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} + +#### Yenilik: {#new-features-5} + +- HTTPS çoğaltma için kullanılabilir. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) +- Fonksiyonları eklendi `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, ve `murmurHash3_128` mevcut ek olarak `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) +- ClickHouse ODBC sürücüsündeki null türleri için destek (`ODBCDriver2` çıkış biçimi). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) +- İçin destek `UUID` anahtar sütunlarda. + +#### Geliştirmeler: {#improvements-5} + +- Kümeler, yapılandırma dosyalarından silindiğinde sunucuyu yeniden başlatmadan kaldırılabilir. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) +- Dış sözlükler, yapılandırma dosyalarından kaldırıldıklarında sunucuyu yeniden başlatmadan kaldırılabilir. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) +- Katma `SETTINGS` için destek `Kafka` masa motoru. [Alexander Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) +- İçin iyileştirmeler `UUID` veri türü (henüz tamamlanmadı). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) +- Birleştikten sonra boş parçalar için destek `SummingMergeTree`, `CollapsingMergeTree` ve `VersionedCollapsingMergeTree` motorlar. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) +- Tamamlanan Mut recordsasyon recordsların eski kayıtları silinir (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) +- Add theed the `system.merge_tree_settings` Tablo. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) +- Bu `system.tables` tablo artık bağımlılık sütunları var: `dependencies_database` ve `dependencies_table`. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) +- Add theed the `max_partition_size_to_drop` yapılandırma seçeneği. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) +- Add theed the `output_format_json_escape_forward_slashes` seçenek. [Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2812) +- Add theed the `max_fetch_partition_retries_count` ayar. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) +- Add theed the `prefer_localhost_replica` yerel bir yineleme tercihini devre dışı bırakmak ve işlemler arası etkileşim olmadan yerel bir yinelemeye gitmek için ayarlama. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) +- Bu `quantileExact` toplama işlevi döndürür `nan` boş bir toplama durumunda `Float32` veya `Float64` koymak. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) + +#### Hata düzeltmeleri: {#bug-fixes-14} + +- ODBC için bağlantı dizesi parametrelerinin gereksiz bir şekilde kaçması kaldırıldı, bu da bağlantı kurmayı imkansız hale getirdi. Bu hata 18.6.0 sürümünde oluştu. +- İşleme mantığı düzeltildi `REPLACE PARTITION` çoğaltma sırasındaki komutlar. İki tane varsa `REPLACE` aynı bölüm için komutlar, yanlış mantık, bunlardan birinin çoğaltma kuyruğunda kalmasına ve yürütülmesine neden olabilir. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) +- Tüm veri parçaları boş olduğunda bir birleştirme hatası düzeltildi (birleştirme veya `ALTER DELETE` tüm veriler silindiyse). Bu hata 18.1.0 sürümünde göründü. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) +- Eşzamanlı için bir hata düzeltildi `Set` veya `Join`. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2823) +- Sabit `Block structure mismatch in UNION stream: different number of columns` için oluşan hata `UNION ALL` bir alt sorgu içindeki sorgular `SELECT` sorgular yinelenen sütun adları içerir. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) +- Bir MySQL sunucusuna bağlanırken bir istisna oluşursa bir bellek sızıntısı düzeltildi. +- Bir sorgu hatası durumunda sabit yanlış clickhouse-istemci yanıt kodu. +- Farklı içeren hayata görünümleri sabit yanlış davranış. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) + +#### Geriye dönük Uyumsuz değişiklikler {#backward-incompatible-changes-4} + +- Dağıtılmış tablolar için kontrol tablosu sorguları için destek kaldırıldı. + +#### Yapı değişiklikleri: {#build-changes-3} + +- Ayırıcı değiştirildi: `jemalloc` şimdi yerine kullanılır `tcmalloc`. Bazı senaryolarda, bu hız %20’ye kadar artar. Ancak, %20’ye kadar yavaşlamış sorgular vardır. Bellek tüketimi, bazı senaryolarda geliştirilmiş kararlılık ile yaklaşık %10 oranında azaltılmıştır. Son derece rekabetçi yüklerle, userspace ve sistemdeki CPU kullanımı sadece hafif bir artış gösterir. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) +- Bir alt modülden libressl kullanımı. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) +- Bir alt modülden unixodbc kullanımı. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) +- Bir alt modülden mariadb-connector-c kullanımı. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) +- Test verilerinin kullanılabilirliğine bağlı olan depoya işlevsel test dosyaları eklendi (şimdilik, test verilerinin kendisi olmadan). + +## ClickHouse sürümü 18.6 {#clickhouse-release-18-6} + +### ClickHouse yayın 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} + +#### Yenilik: {#new-features-6} + +- Sözdizimi üzerinde katılmak için ifadeler için destek eklendi: + `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` + İfade, and operatörü tarafından birleştirilen bir eşitlik zinciri olmalıdır. Eşitliğin her bir tarafı, tablolardan birinin sütunları üzerinde keyfi bir ifade olabilir. Tam sütun adlarının kullanımı desteklenir (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) doğru tablo için. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) +- HTTPS çoğaltma için etkinleştirilebilir. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) + +#### Geliştirmeler: {#improvements-6} + +- Sunucu, sürümünün düzeltme eki bileşenini istemciye geçirir. Yama sürümü bileşeni ile ilgili veriler `system.processes` ve `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) + +## ClickHouse sürümü 18.5 {#clickhouse-release-18-5} + +### ClickHouse sürümü 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} + +#### Yenilik: {#new-features-7} + +- Karma fonksiyonu eklendi `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). + +#### Geliştirmeler: {#improvements-7} + +- Şimdi kullanabilirsiniz `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) ortam değişkenlerinden yapılandırma dosyalarındaki değerleri ayarlamak için öznitelik. +- Eklenen büyük / küçük harf duyarlı sürümleri `coalesce`, `ifNull`, ve `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). + +#### Hata düzeltmeleri: {#bug-fixes-15} + +- Bir kopya başlatırken olası bir hata düzeltildi [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). + +## ClickHouse sürümü 18.4 {#clickhouse-release-18-4} + +### ClickHouse yayın 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} + +#### Yenilik: {#new-features-8} + +- Eklenen sistem tabloları: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). +- Bir argüman olarak bir tablo yerine bir tablo işlevini kullanma yeteneği eklendi `remote` veya `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). +- İçin destek `HTTP Basic` çoğaltma protokolünde kimlik doğrulama [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). +- Bu `has` fonksiyon artık bir dizi sayısal bir değer için arama sağlar `Enum` değerler [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). +- Gelen okurken keyfi mesaj ayırıcılar eklemek için destek `Kafka` [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2701). + +#### Geliştirmeler: {#improvements-8} + +- Bu `ALTER TABLE t DELETE WHERE` sorgu, where koşulundan etkilenmeyen veri bölümlerini yeniden yazmaz [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). +- Bu `use_minimalistic_checksums_in_zookeeper` seçeneği için `ReplicatedMergeTree` tablolar varsayılan olarak etkindir. Bu ayar 1.1.54378, 2018-04-16 sürümüne eklendi. 1.1.54378’den eski sürümler artık yüklenemez. +- Koşu için destek `KILL` ve `OPTIMIZE` belirten sorgular `ON CLUSTER` [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). + +#### Hata düzeltmeleri: {#bug-fixes-16} + +- Hata düzeltildi `Column ... is not under an aggregate function and not in GROUP BY` bir in ifadesi ile toplama için. Bu hata 18.1.0 sürümünde göründü. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) +- Bu bir hata düzeltildi `windowFunnel aggregate function` [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). +- Bu bir hata düzeltildi `anyHeavy` toplama fonksiyonu ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) +- Kullanırken sabit sunucu çökmesi `countArray()` toplama işlevi. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-5} + +- İçin parametreler `Kafka` motor değiştirildi `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` -e doğru `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. Tablolar kullanıyorsanız `kafka_schema` veya `kafka_num_consumers` parametreleri, elle meta dosyaları düzenlemek zorunda `path/metadata/database/table.sql` ve Ekle `kafka_row_delimiter` parametre ile `''` değer. + +## ClickHouse sürümü 18.1 {#clickhouse-release-18-1} + +### ClickHouse sürümü 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} + +#### Yenilik: {#new-features-9} + +- İçin destek `ALTER TABLE t DELETE WHERE` çoğaltılmamış MergeTree tabloları için sorgu ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). +- İçin keyfi türleri için destek `uniq*` agrega fonksiyonları ailesi ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). +- Karşılaştırma operatörlerinde keyfi türler için destek ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). +- Bu `users.xml` dosya biçiminde bir alt ağ maskesi ayarlama sağlar `10.0.0.1/255.255.255.0`. Bu, ortada sıfır olan IPv6 ağları için Maskeler kullanmak için gereklidir ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). +- Add theed the `arrayDistinct` işlev ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). +- SummingMergeTree altyapısı artık AggregateFunction türü sütunları ile çalışabilir ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). + +#### Geliştirmeler: {#improvements-9} + +- Sürüm sürümleri için numaralandırma düzenini değiştirdi. Şimdi ilk bölüm sürüm yılını içeriyor (A. D., Moskova saat dilimi, eksi 2000), ikinci bölüm büyük değişikliklerin sayısını içeriyor (çoğu sürüm için artar) ve üçüncü bölüm yama sürümüdür. Aksi changelog belirtilmediği sürece bültenleri hala geriye dönük uyumludur. +- Kayan noktalı sayıların bir dizeye daha hızlı dönüştürülmesi ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2664)). +- Ayrıştırma hataları nedeniyle bir ekleme sırasında bazı satırlar atlanmışsa (bu, `input_allow_errors_num` ve `input_allow_errors_ratio` ayarları etkin), atlanan satır sayısı şimdi sunucu günlüğüne yazılır ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). + +#### Hata düzeltmeleri: {#bug-fixes-17} + +- Geçici tablolar için TRUNCATE komutu düzeltildi ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2624)). +- Yanıtı okurken bir ağ hatası olduğunda meydana gelen ZooKeeper istemci kütüphanesinde nadir bir kilitlenme düzeltildi ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). +- Null türleri için bir döküm sırasında bir hata düzeltildi ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). +- Yanlış sonuç düzeltildi `maxIntersection()` aralıkların sınırları çakıştığında işlev ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). +- Bir işlev argümanında or ifade zincirinin yanlış dönüşümü düzeltildi ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). +- İçeren sorgular için sabit performans düşüşü `IN (subquery)` başka bir alt sorgu içindeki ifadeler ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). +- Bir kullanan dağıtılmış sorgularda farklı sürümleri ile sunucular arasında sabit uyumsuzluk `CAST` büyük harflerle olmayan işlev ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). +- Harici bir DBMS sorguları için tanımlayıcıları alıntı eksik eklendi ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-6} + +- DateTime için sıfır sayısını içeren bir dize dönüştürme çalışmaz. Örnek: `SELECT toDateTime('0')`. Bu da nedeni `DateTime DEFAULT '0'` tablolarda da çalışmıyor `0` sözlüklerde. Çözüm: değiştirin `0` ile `0000-00-00 00:00:00`. + +## ClickHouse sürüm 1.1 {#clickhouse-release-1-1} + +### ClickHouse sürümü 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} + +#### Yenilik: {#new-features-10} + +- Add theed the `histogram` toplama fonksiyonu ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). +- Şimdi `OPTIMIZE TABLE ... FINAL` için bölümler belirt specifyingmeden kullanılabilir `ReplicatedMergeTree` ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2600)). + +#### Hata düzeltmeleri: {#bug-fixes-18} + +- Çoğaltılmış verileri gönderirken ve indirirken okumak ve yazmak için soketler için çok küçük bir zaman aşımı (bir saniye) ile ilgili bir sorun düzeltildi, bu da ağ veya diskte bir yük varsa daha büyük parçaları indirmeyi imkansız hale getirdi (parçaları indirmek için döngüsel girişimlerle sonuçlandı). Bu hata 1.1.54388 sürümünde oluştu. +- Tabloda yinelenen veri blokları eklediyseniz zookeeper chroot kullanırken sorunlar giderildi. +- Bu `has` işlev artık boş öğelere sahip bir dizi için doğru çalışıyor ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). +- Bu `system.tables` tablo şimdi dağıtılmış sorgularda kullanıldığında düzgün çalışır. Bu `metadata_modification_time` ve `engine_full` sütunlar artık sanal değil. Tablodan yalnızca bu sütunlar sorgulanırsa oluşan bir hata düzeltildi. +- Sabit nasıl boş `TinyLog` tablo boş bir veri bloğu ekledikten sonra çalışır ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). +- Bu `system.zookeeper` zookeeper düğümün değeri NULL ise Tablo çalışır. + +### ClickHouse sürümü 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} + +#### Yenilik: {#new-features-11} + +- Sorgular gönderilebilir `multipart/form-data` biçim (içinde `query` alan), sorgu işleme için harici veriler de gönderilirse yararlıdır ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). +- CSV formatında veri okurken tek veya çift tırnak işleme etkinleştirmek veya devre dışı bırakmak için yeteneği eklendi. Bunu şu şekilde yapılandırabilirsiniz: `format_csv_allow_single_quotes` ve `format_csv_allow_double_quotes` ayarlar ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2574)). +- Şimdi `OPTIMIZE TABLE ... FINAL` olmayan çoğaltılmış varyantları için bölüm belirtmeden kullanılabilir `MergeTree` ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2599)). + +#### Geliştirmeler: {#improvements-10} + +- Geliştirilmiş performans, azaltılmış bellek tüketimi, ve doğru bellek tüketimi izleme kullanımı ile In operatör zaman bir tablo Endeksi kullanılabilir ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). +- Bir veri parçası eklerken sağlama toplamlarının gereksiz denetimi kaldırıldı. Bu, çok sayıda çoğaltma olduğunda önemlidir,çünkü bu durumlarda toplam kontrol sayısı n^2’ye eşittir. +- İçin destek eklendi `Array(Tuple(...))` arg theum argumentsents for the `arrayEnumerateUniq` işlev ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). +- Katma `Nullable` için destek `runningDifference` işlev ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). +- Çok sayıda ifade olduğunda geliştirilmiş sorgu analizi performansı ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). +- Birleştirme için veri parçalarının daha hızlı seçimi `ReplicatedMergeTree` Tablolar. ZooKeeper oturumunun daha hızlı iyileşmesi ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). +- Bu `format_version.txt` için dosya `MergeTree` eksikse tablolar yeniden oluşturulur, bu da dizin yapısını dosyalar olmadan kopyaladıktan sonra ClickHouse başlatılırsa mantıklı olur ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). + +#### Hata düzeltmeleri: {#bug-fixes-19} + +- ZooKeeper ile çalışırken, sunucuyu yeniden başlatmadan önce oturumu ve readonly tablo durumlarını kurtarmayı imkansız hale getirebilecek bir hata düzeltildi. +- Oturum kesilirse eski düğümlerin silinmemesine neden olabilecek ZooKeeper ile çalışırken bir hata düzeltildi. +- Sabit bir hata `quantileTDigest` Float argümanları için işlev (bu hata 1.1.54388 sürümünde tanıtıldı) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). +- Birincil anahtar sütunu, aynı boyuttaki imzalı ve imzasız tamsayılar arasındaki türleri dönüştürmek için işlevin içinde bulunuyorsa, mergetree tabloları için dizinde bir hata düzeltildi ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). +- Sabit segfault eğer `macros` kullanılır ancak yapılandırma dosyasında değildir ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). +- İstemci yeniden bağlanırken varsayılan veritabanına sabit anahtarlama ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). +- Ne zaman meydana gelen bir hata düzeltildi `use_index_for_in_with_subqueries` ayar devre dışı bırakıldı. + +#### Güvenlik düzeltme: {#security-fix-1} + +- Mysql’e bağlandığında dosya göndermek artık mümkün değil (`LOAD DATA LOCAL INFILE`). + +### ClickHouse sürümü 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} + +#### Yenilik: {#new-features-12} + +- İçin destek `ALTER TABLE t DELETE WHERE` çoğaltılmış tablolar için sorgu. Add theed the `system.mutations` bu tür sorguların ilerlemesini izlemek için tablo. +- İçin destek `ALTER TABLE t [REPLACE|ATTACH] PARTITION` \*MergeTree tabloları için sorgu. +- İçin destek `TRUNCATE TABLE` sorgu ([Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) +- Birkaç yeni `SYSTEM` çoğaltılmış tablolar için sorgular (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). +- MySQL motoru ve ilgili tablo fonksiyonu ile bir tabloya yazma yeteneği eklendi ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). +- Add theed the `url()` tablo fonksiyonu ve `URL` masa motoru ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). +- Add theed the `windowFunnel` toplama fonksiyonu ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). +- Yeni `startsWith` ve `endsWith` dizeler için işlevler ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). +- Bu `numbers()` tablo işlevi artık ofset belirtmenizi sağlar ([Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). +- Şifre için `clickhouse-client` etkileşimli olarak girilebilir. +- Sunucu günlükleri artık syslog’a gönderilebilir ([Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). +- Paylaşılan kitaplık kaynağı ile sözlüklerde oturum açma desteği ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). +- Özel CSV sınırlayıcılar için destek ([Ivan Zhukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) +- Add theed the `date_time_input_format` ayar. Bu ayarı şu şekilde değiştirirseniz `'best_effort'`, DateTime değerleri biçimleri geniş bir yelpazede okunacaktır. +- Add theed the `clickhouse-obfuscator` veri gizleme için yardımcı program. Kullanım örneği: performans testlerinde kullanılan verileri yayınlama. + +#### Deneysel özellikler: {#experimental-features-2} + +- Hesaplamak için yeteneği eklendi `and` argümanlar sadece ihtiyaç duydukları yerde ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) +- Yerel kod JIT derleme bazı ifadeler için artık kullanılabilir ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). + +#### Hata düzeltmeleri: {#bug-fixes-20} + +- Yinelemeler artık bir sorgu için görünmüyor `DISTINCT` ve `ORDER BY`. +- İle sorgular `ARRAY JOIN` ve `arrayFilter` artık yanlış bir sonuç döndürmez. +- İç içe geçmiş bir yapıdan bir dizi sütunu okurken bir hata düzeltildi ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). +- Gibi bir having yan tümcesi ile sorguları analiz ederken bir hata düzeltildi `HAVING tuple IN (...)`. +- Özyinelemeli takma adlarla sorguları analiz ederken bir hata düzeltildi. +- Tüm satırları filtreleyen PREWHERE bir koşul ile ReplacingMergeTree okurken bir hata düzeltildi ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). +- HTTP arabirimindeki oturumları kullanırken kullanıcı profili ayarları uygulanmadı. +- Clickhouse-local’deki komut satırı parametrelerinden ayarların nasıl uygulandığı düzeltildi. +- ZooKeeper istemci kitaplığı artık sunucudan alınan oturum zaman aşımını kullanır. +- İstemci zaman aşımı daha uzun sunucu yanıt bekledi ZooKeeper istemci kütüphanesinde bir hata düzeltildi. +- Bölüm anahtar sütunlarındaki koşullarla sorgular için parçaların sabit budaması ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). +- Birleşmeler şimdi mümkün `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). +- ODBC tablo işlevinde tür eşleme düzeltildi ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). +- Tür karşılaştır formaları Düzelt forildi `DateTime` saat dilimi ile ve olmadan ([Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). +- Sabit sözdizimsel ayrıştırma ve biçimlendirme `CAST` operatör. +- Dağıtılmış tablo motoru için somutlaştırılmış bir görünüme sabit ekleme ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). +- Veri yazarken bir yarış durumu düzeltildi `Kafka` motor için hayata görünümleri ([Yangkuan Liu](https://github.com/ClickHouse/ClickHouse/pull/2448)). +- Uzak () tablo işlevinde sabit SSRF. +- Sabit çıkış davranışı `clickhouse-client` çok satırlı modda ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). + +#### Geliştirmeler: {#improvements-11} + +- Çoğaltılmış tablolardaki arka plan görevleri artık ayrı iş parçacıkları yerine bir iş parçacığı havuzunda gerçekleştirilir ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). +- Geliştirilmiş lz4 sıkıştırma performansı. +- Çok sayıda birleştirme ve alt sorgu ile sorgular için daha hızlı analiz. +- Çok fazla ağ hatası olduğunda DNS önbelleği artık otomatik olarak güncellenir. +- Çok fazla parçaya sahip olduğundan, materialized görünümlerden birine ekleme mümkün değilse, tablo ekleri artık oluşmaz. +- Olay sayaçlarındaki tutarsızlık düzeltildi `Query`, `SelectQuery`, ve `InsertQuery`. +- Gibi ifadeler `tuple IN (SELECT tuple)` tuple türleri eşleşirse izin verilir. +- Çoğaltılmış tabloları olan bir sunucu, Zookeeper’ı yapılandırmasanız bile başlayabilir. +- Mevcut CPU çekirdeklerinin sayısını hesaplarken, C gruplarındaki sınırlar şimdi dikkate alınmaktadır ([Atri Sharma](https://github.com/ClickHouse/ClickHouse/pull/2325)). +- Systemd yapılandırma dosyasında yapılandırma dizinleri için chown eklendi ([Mikhail Shiryaev](https://github.com/ClickHouse/ClickHouse/pull/2421)). + +#### Yapı değişiklikleri: {#build-changes-4} + +- Gcc8 derleyicisi yapılar için kullanılabilir. +- Alt modülden llvm oluşturma yeteneği eklendi. +- Librdkafka kütüphanesinin sürümü v0.11.4 olarak güncellendi. +- Sistem libcpuid kütüphanesini kullanma yeteneği eklendi. Kütüphane sürümü 0.4.0 olarak güncellendi. +- Vectorclass kütüphanesini kullanarak yapı düzeltildi ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). +- Cmake şimdi varsayılan olarak ninja için dosyalar üretir (kullanırken olduğu gibi `-G Ninja`). +- Libtermcap yerine libtınfo kütüphanesini kullanma yeteneği eklendi ([Georgy Kondratiev](https://github.com/ClickHouse/ClickHouse/pull/2519)). +- Fedora Rawhide bir başlık dosyası çakışması düzeltildi ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-7} + +- Çıkar escapingıldı `Vertical` ve `Pretty*` format Andlar ve silinen `VerticalRaw` biçimli. +- 1.1.54388 (veya daha yeni) sürümüne sahip sunucular ve daha eski bir sürüme sahip sunucular dağıtılmış bir sorguda aynı anda kullanılıyorsa ve sorgunun `cast(x, 'Type')` ifade olmadan `AS` anahtar kelime ve kelime yok `cast` büyük harfle, bir istisna gibi bir mesajla atılır `Not found column cast(0, 'UInt8') in block`. Çözüm: tüm kümedeki sunucuyu güncelleyin. + +### ClickHouse sürümü 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} + +#### Hata düzeltmeleri: {#bug-fixes-21} + +- Bazı durumlarda zookeeper işlemlerinin engellenmesine neden olan bir hata düzeltildi. + +### ClickHouse sürümü 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} + +#### Hata düzeltmeleri: {#bug-fixes-22} + +- Bir tablo birçok yinelemeler varsa çoğaltma kuyruğunun bir yavaşlama düzeltildi. + +### ClickHouse sürümü 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} + +#### Hata düzeltmeleri: {#bug-fixes-23} + +- ClickHouse ZooKeeper sunucusuna bağlantı kaybettiğinde ZooKeeper bir düğüm sızıntısı düzeltildi. + +### ClickHouse sürüm 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} + +#### Yenilik: {#new-features-13} + +- Tablo fonksiyonu eklendi `file(path, format, structure)`. Örnek okuma baytları `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. + +#### Geliştirmeler: {#improvements-12} + +- Alt sorgular sarılabilir `()` sorgu okunabilirliğini artırmak için parantez. Mesela: `(SELECT 1) UNION ALL (SELECT 1)`. +- Basit `SELECT` gelen sorgular `system.processes` tablo dahil değildir `max_concurrent_queries` sınır. + +#### Hata düzeltmeleri: {#bug-fixes-24} + +- Sabit yanlış davranış `IN` operatör ne zaman seçin `MATERIALIZED VIEW`. +- Gibi ifadelerde bölüm indeksi ile sabit yanlış filtreleme `partition_key_column IN (...)`. +- Sabit yetersizlik yürütmek için `OPTIMIZE` eğer lider olmayan çoğaltma üzerinde sorgu `REANAME` masaya yapıldı. +- Yürütülürken yetkilendirme hatası düzeltildi `OPTIMIZE` veya `ALTER` olmayan bir lider çoğaltma sorgular. +- Sabit donma `KILL QUERY`. +- Saatlerin kaybına yol açan ZooKeeper istemci kütüphanesinde bir hata, dağıtılmış DDL kuyruğunun dondurulması ve boş olmayan bir çoğaltma kuyruğundaki yavaşlamalar düzeltildi `chroot` önek ZooKeeper yapılandırmasında kullanılır. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-8} + +- Gibi ifadeler için destek kaldırıldı `(a, b) IN (SELECT (a, b))` (eşdeğer ifadeyi kullanabilirsiniz `(a, b) IN (SELECT a, b)`). Önceki sürümlerde, bu ifadeler belirsizliğe yol açtı `WHERE` filtreleme veya neden olan hatalar. + +### ClickHouse sürümü 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} + +#### Yenilik: {#new-features-14} + +- Günlük düzeyi sunucuyu yeniden başlatmadan değiştirilebilir. +- Add theed the `SHOW CREATE DATABASE` sorgu. +- Bu `query_id` geç canilebilir `clickhouse-client` (elBroom). +- Yeni ayar: `max_network_bandwidth_for_all_users`. +- İçin destek eklendi `ALTER TABLE ... PARTITION ...` için `MATERIALIZED VIEW`. +- Sistem tablosunda sıkıştırılmamış formdaki veri parçalarının boyutu hakkında bilgi eklendi. +- Dağıtılmış tablolar için sunucudan sunucuya şifreleme desteği (`1` rep thelik thea config in ``). +- Tablo düzeyi için yapılandırma `ReplicatedMergeTree` Zookeeper saklanan veri miktarını en aza indirmek için aile: : `use_minimalistic_checksums_in_zookeeper = 1` +- Yapılandırma `clickhouse-client` istem. Varsayılan olarak, sunucu adları artık istemine çıktı. Sunucunun görünen adı değiştirilebilir. Ayrıca gönderilen `X-ClickHouse-Display-Name` HTTP Başlığı (Kirill Shvakov). +- Birden çok virgülle ayrılmış `topics` için belirt theilebilir `Kafka` motor (Tobias Adamson) +- Bir sorgu tarafından durdurulduğunda `KILL QUERY` veya `replace_running_query`, müşteri alır `Query was canceled` eksik bir sonuç yerine istisna. + +#### Geliştirmeler: {#improvements-13} + +- `ALTER TABLE ... DROP/DETACH PARTITION` sorgular, çoğaltma kuyruğunun önünde çalıştırılır. +- `SELECT ... FINAL` ve `OPTIMIZE ... FINAL` tablo tek bir veri parçası olduğunda bile kullanılabilir. +- A `query_log` el ile silindiyse tablo anında yeniden oluşturulur (Kirill Shvakov). +- Bu `lengthUTF8` fonksiyon daha hızlı çalışır (zhang2014). +- Senkron ekler geliştirilmiş performans `Distributed` Tablolar (`insert_distributed_sync = 1`) çok sayıda parça olduğunda. +- Sunucu kabul eder `send_timeout` ve `receive_timeout` istemciden ayarlar ve istemciye bağlanırken bunları uygular (bunlar ters sırada uygulanır: sunucu soketinin `send_timeout` için ayarlanır `receive_timeout` müşteriden alınan değer ve tersi). +- Asenkron ekleme için daha sağlam kilitlenme kurtarma `Distributed` Tablolar. +- Dönüş türü `countEqual` fonksiyon değiştirildi `UInt32` -e doğru `UInt64` (谢磊). + +#### Hata düzeltmeleri: {#bug-fixes-25} + +- Bir hata düzeltildi `IN` ifadenin sol tarafı olduğunda `Nullable`. +- Tuples ile birlikte kullanıldığında doğru sonuçlar şimdi döndürülür `IN` bazı tuple bileşenleri tablo dizininde olduğunda. +- Bu `max_execution_time` limit şimdi dağıtılmış sorgularla düzgün çalışır. +- Bileşik sütunların boyutunu hesaplarken sabit hatalar `system.columns` Tablo. +- Geçici bir tablo oluştururken bir hata düzeltildi `CREATE TEMPORARY TABLE IF NOT EXISTS.` +- Sabit hatalar `StorageKafka` (\#\#2075) +- Sabit sunucu, belirli toplam işlevlerin geçersiz argümanlarından çöker. +- Engellenen hata düzeltildi `DETACH DATABASE` için arka plan görevlerini durdurma sorgusu `ReplicatedMergeTree` Tablolar. +- `Too many parts` toplu materialized görünümler (\#\#2084) eklerken durum daha az olasıdır. +- Bir ikame aynı düzeyde başka bir ikame tarafından takip edilmesi gerekiyorsa, yapılandırmada değiştirmelerin düzeltilmiş özyinelemeli işleme. +- Bir oluştururken meta veri dosyasında sözdizimi düzeltildi `VIEW` bu bir sorgu ile kullanır `UNION ALL`. +- `SummingMergeTree` şimdi bir bileşik anahtar ile iç içe veri yapılarının toplamı için doğru çalışır. +- Lider seçerken bir yarış durumu olasılığı sabit `ReplicatedMergeTree` Tablolar. + +#### Yapı değişiklikleri: {#build-changes-5} + +- Yapı destekler `ninja` yerine `make` ve kullanımları `ninja` sürümleri oluşturmak için varsayılan olarak. +- Yeniden adlandırılan paketler: `clickhouse-server-base` içinde `clickhouse-common-static`; `clickhouse-server-common` içinde `clickhouse-server`; `clickhouse-common-dbg` içinde `clickhouse-common-static-dbg`. Yüklemek için kullanın `clickhouse-server clickhouse-client`. Eski adlara sahip paketler, geriye dönük uyumluluk için depolara yüklenmeye devam edecektir. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-9} + +- Sol tarafta bir dizi belirtilmişse, bir In ifadesinin özel yorumunu kaldırıldı. Daha önce, ifade `arr IN (set)` olarak yorum waslandı “at least one `arr` element belongs to the `set`”. Yeni sürümde aynı davranışı elde etmek için şunları yazın `arrayExists(x -> x IN (set), arr)`. +- Soket seçeneğinin yanlış kullanımı devre dışı bırakıldı `SO_REUSEPORT`, poco kitaplığında varsayılan olarak yanlış etkinleştirildi. Linux’ta artık adresleri aynı anda belirtmek için herhangi bir neden olmadığını unutmayın `::` ve `0.0.0.0` for listen – use just `::`(varsayılan çekirdek yapılandırma ayarları ile) IPv4 ve IPv6 üzerinden hem bağlantı dinleme sağlar. Belirterek önceki sürümlerden davranışa da geri dönebilirsiniz `1` config. + +### ClickHouse sürümü 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} + +#### Yenilik: {#new-features-15} + +- Add theed the `system.macros` tablo ve yapılandırma dosyası değiştirildiğinde makroların otomatik güncellenmesi. +- Add theed the `SYSTEM RELOAD CONFIG` sorgu. +- Add theed the `maxIntersections(left_col, right_col)` aynı anda kesişen aralıkların maksimum sayısını döndüren toplama işlevi `[left; right]`. Bu `maxIntersectionsPosition(left, right)` fonksiyonun başlangıcını döndürür “maximum” aralıklı. ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). + +#### Geliştirmeler: {#improvements-14} + +- Bir veri eklerken `Replicated` tablo, daha az istek yapılır `ZooKeeper` (ve kullanıcı düzeyinde hataların çoğu `ZooKeeper` günlük). +- Veri kümeleri için takma ad oluşturma yeteneği eklendi. Örnek: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. + +#### Hata düzeltmeleri: {#bug-fixes-26} + +- Sabit `Illegal PREWHERE` birleştirme tablolarından okunurken hata `Distributed`Tablolar. +- Eğer IPv4 sadece Docker kaplarda clickhouse-server başlatmak için izin eklendi düzeltmeler. +- Sistemden okurken bir yarış durumu düzeltildi `system.parts_columns tables.` +- Bir senkron ekleme sırasında çift tamponlama kaldırıldı `Distributed` zaman aşımı için bağlantı neden olabilir tablo. +- Başlamadan önce kullanılamayan bir kopya için aşırı uzun beklemelere neden olan bir hata düzeltildi `SELECT` sorgu. +- Sabit yanlış tarihler `system.parts` Tablo. +- İmkansız bir veri eklemek için yapılan bir hata düzeltildi `Replicated` tablo ise `chroot` yapılandırmada boş değildi `ZooKeeper` küme. +- Boş bir dikey birleştirme algoritması düzeltildi `ORDER BY` Tablo. +- Uzak tablo, bu sözlük istemcisi sunucu üzerinde yoksa bile sorgular sözlük kullanma olanağı sağlandı. Bu işlevsellik 1.1.54362 sürümünde kayboldu. +- Gibi sorgular için davranışı geri `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` ne zaman sağ tarafı `IN` bir uzaktan kumanda kullanmalı `default.table` yerel bir yerine. Bu davranış 1.1.54358 sürümünde bozuldu. +- Kaldırılan gereksiz hata düzeyi günlüğü `Not found column ... in block`. + +### ClickHouse Yayın 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} + +#### Yenilik: {#new-features-16} + +- Olmadan toplama `GROUP BY` boş bir set için (örneğin `SELECT count(*) FROM table WHERE 0`) şimdi SQL standardına uygun olarak toplam işlevler için boş değerlere sahip bir satırla bir sonuç döndürür. Eski davranışı geri yüklemek için (boş bir sonuç döndürür), `empty_result_for_aggregation_by_empty_set` 1’e. +- İçin Tip dönüştürme eklendi `UNION ALL`. Farklı takma ad adlarına izin verilir `SELECT` pozisyon inlar `UNION ALL`, SQL standardına uygun olarak. +- Keyfi ifadeler desteklenir `LIMIT BY` yanlar. Daha önce, yalnızca aşağıdakilerden kaynaklanan sütunları kullanmak mümkündü `SELECT`. +- Dizini `MergeTree` tablolar şu durumlarda kullanılır `IN` birincil anahtarın sütunlarından bir ifade kümesine uygulanır. Örnek: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). +- Add theed the `clickhouse-copier` kümeleri ve resharding veri (beta) arasında kopyalama aracı. +- Tutarlı karma fonksiyonları eklendi: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. Onlar sonraki reshardings sırasında ağ trafiği miktarını azaltmak için bir sharding anahtar olarak kullanılabilir. +- Eklenen fonksiyonlar: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. +- Add theed the `arrayCumSum` fonksiyon (Javi Santana). +- Add theed the `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, ve `parseDateTimeBestEffortOrNull` çok çeşitli Olası biçimlerde metin içeren bir dizeden datetime okumak için işlevler. +- Veriler, güncelleme sırasında harici sözlüklerden kısmen yeniden yüklenebilir (yalnızca belirtilen alanın değerinin önceki indirmeden daha büyük olduğu kayıtları yükleyin) (Arsen Hakobyan). +- Add theed the `cluster` tablo işlevi. Örnek: `cluster(cluster_name, db, table)`. Bu `remote` tablo işlevi, bir tanımlayıcı olarak belirtilirse, küme adını ilk bağımsız değişken olarak kabul edebilir. +- Bu `remote` ve `cluster` tablo fonksiyonları kullanılabilir `INSERT` sorgular. +- Add theed the `create_table_query` ve `engine_full` sanal sütunlar için `system.tables`Tablo . Bu `metadata_modification_time` sütun sanal. +- Add theed the `data_path` ve `metadata_path` sütunlar için `system.tables`ve`system.databases` tablolar ve eklenen `path` Col theum then to the `system.parts` ve `system.parts_columns` Tablolar. +- Birleştirme hakkında ek bilgi eklendi `system.part_log` Tablo. +- Keyfi bir bölümleme anahtarı için kullanılabilir `system.query_log` tablo (Kirill Shvakov). +- Bu `SHOW TABLES` sorgu şimdi de geçici tablolar gösterir. Geçici tablolar eklendi ve `is_temporary` sütun için `system.tables` (zhang2014). +- Katma `DROP TEMPORARY TABLE` ve `EXISTS TEMPORARY TABLE` sorgular (zhang2014). +- İçin destek `SHOW CREATE TABLE` geçici tablolar için (zhang2014). +- Add theed the `system_profile` iç işlemler tarafından kullanılan ayarlar için yapılandırma parametresi. +- Yükleme desteği `object_id` bir nitelik olarak `MongoDB` sözlükler (Pavel Litvinenko). +- Okuma `null` harici bir sözlük için veri yüklerken varsayılan değer olarak `MongoDB` kaynak (Pavel Litvinenko). +- Okuma `DateTime` değerleri `Values` tek tırnak işaretleri olmadan bir Unix zaman damgasından biçimlendirin. +- Yük devretme desteklenir `remote` tablo işlevleri bazı yinelemeler istenen tablo eksik olduğunda durumlar için. +- Çalıştırdığınızda yapılandırma ayarları komut satırında geçersiz kılınabilir `clickhouse-server`. Örnek: `clickhouse-server -- --logger.level=information`. +- Uygulanan `empty` fonksiyonu bir `FixedString` argüman: dize tamamen boş bayttan oluşuyorsa (zhang2014) işlev 1 döndürür. +- Add theed the `listen_try`bazı adresler dinlenemiyorsa (IPv4 veya IPv6 için engelli desteği olan sistemler için kullanışlıdır), dinleme adreslerinden en az birini bırakmadan dinlemek için yapılandırma parametresi. +- Add theed the `VersionedCollapsingMergeTree` masa motoru. +- Satır ve rasgele sayısal türleri için destek `library` sözlük kaynağı. +- `MergeTree` tablolar birincil anahtar olmadan kullanılabilir (belirtmeniz gerekir `ORDER BY tuple()`). +- A `Nullable` tipi olabilir `CAST` olmayan -`Nullable` bağımsız değişken değilse yazın `NULL`. +- `RENAME TABLE` için yapılabilir `VIEW`. +- Add theed the `throwIf` işlev. +- Add theed the `odbc_default_field_size` bir ODBC kaynağından yüklenen değerin en büyük boyutunu genişletmenizi sağlayan seçenek (varsayılan olarak, 1024’tür). +- Bu `system.processes` masa ve `SHOW PROCESSLIST` şimdi var `is_cancelled` ve `peak_memory_usage` sütun. + +#### Geliştirmeler: {#improvements-15} + +- Sonuç üzerindeki sınırlar ve kotalar artık Ara verilere uygulanmıyor `INSERT SELECT` sorgular veya `SELECT` alt sorgular. +- Daha az yanlış tetikleyici `force_restore_data` durumunu kontrol ederken `Replicated` sunucu başladığında tablolar. +- Add theed the `allow_distributed_ddl` seçenek. +- Nondeterministic işlevleri için ifadelerde izin verilmez `MergeTree` masa tuşları. +- Değiştirmeleri olan dosyalar `config.d` dizinler alfabetik sırayla yüklenir. +- Geliştirilmiş performans `arrayElement` elemanlardan biri olarak boş bir dizi ile sabit çok boyutlu bir dizi durumunda işlev. Örnek: `[[1], []][x]`. +- Sunucu, yapılandırma dosyalarını çok büyük ikamelerle (örneğin, çok büyük IP ağları listeleri) kullanırken daha hızlı başlar. +- Bir sorgu çalıştırırken, tablo değerli işlevleri bir kez çalıştırın. Önceden, `remote` ve `mysql` tablo değerli işlevler, tablo yapısını uzak bir sunucudan almak için aynı sorguyu iki kez gerçekleştirdi. +- Bu `MkDocs` belg .eleme üret .eci kullanılır. +- Bir tablo sütunu silmeye çalıştığınızda, `DEFAULT`/`MATERIALIZED` diğer sütunların ifadeleri bağlıdır, bir istisna atılır (zhang2014). +- İçin sayı 0 olarak metin biçimlerinde boş bir satır ayrıştırmak için yeteneği eklendi `Float` veri türleri. Bu özellik daha önce mevcuttu, ancak 1.1.54342 sürümünde kayboldu. +- `Enum` değerleri kullanılabilir `min`, `max`, `sum` ve diğer bazı fonksiyonlar. Bu durumlarda, karşılık gelen sayısal değerleri kullanır. Bu özellik daha önce mevcuttu, ancak 1.1.54337 sürümünde kayboldu. +- Katma `max_expanded_ast_elements` yinelemeli genişleyen takma adlar sonra AST boyutunu kısıtlamak için. + +#### Hata düzeltmeleri: {#bug-fixes-27} + +- Gereksiz sütunlar hatalı alt sorgulardan kaldırıldığında veya içeren alt sorgulardan kaldırılmadığında sabit durumlar `UNION ALL`. +- İçin birleştirir bir hata düzeltildi `ReplacingMergeTree` Tablolar. +- Sabit senkron eklemeler `Distributed` Tablolar (`insert_distributed_sync = 1`). +- Belirli kullanımlar için sabit segfault `FULL` ve `RIGHT JOIN` alt sorgularda yinelenen sütunlarla. +- Belirli kullanımlar için sabit segfault `replace_running_query` ve `KILL QUERY`. +- Sabit sipariş `source` ve `last_exception` Col theum thens in the `system.dictionaries` Tablo. +- Sabit hata zaman `DROP DATABASE` sorgu meta verileri ile dosyayı silmedi. +- Sabit `DROP DATABASE` sorgu için `Dictionary` veritabanılar. +- Sabit düşük hassasiyet `uniqHLL12` ve `uniqCombined` 100 milyondan fazla öğe için işlevler (Alex Bocharov). +- Aynı anda varsayılan açık ifadeleri hesaplamak için gerektiğinde örtülü varsayılan değerlerin hesaplanması düzeltildi `INSERT` sorgular (zhang2014). +- Bir sorgu için nadir bir durum düzeltildi `MergeTree` tablo bitiremedi (chenxing-xc). +- Bir çalışırken meydana gelen bir kilitlenme düzeltildi `CHECK` sorgu için `Distributed` tüm parçalar yerel ise tablolar (chenxing.xcc). +- Düzenli ifadeler kullanan işlevlerle hafif bir performans gerilemesi düzeltildi. +- Karmaşık ifadelerden çok boyutlu diziler oluştururken bir performans gerilemesi düzeltildi. +- Ekstra bir neden olabilecek bir hata düzeltildi `FORMAT` bir bölümde görün toecek bölüm `.sql` meta veriler içeren dosya. +- Neden bir hata düzeltildi `max_table_size_to_drop` s deleteilmeye çalış aılırken uygulanacak sınır `MATERIALIZED VIEW` açıkça belirtilen bir tabloya bakıyor. +- Eski istemcilerle sabit uyumsuzluk (eski istemciler bazen `DateTime('timezone')` anlamadıkları tür). +- Okurken bir hata düzeltildi `Nested` kullanılarak eklenen yapıların sütun elemanları `ALTER` ancak, bu sütunların koşulları taşındığında eski bölümler için boş `PREWHERE`. +- Tabloları sanal olarak filtrelerken bir hata düzeltildi `_table` sorgu columnslardaki sütunlar `Merge` Tablolar. +- Kullanırken bir hata düzeltildi `ALIAS` Col inum inns in `Distributed` Tablolar. +- Gelen toplam fonksiyonları ile sorgular için dinamik derleme imkansız hale bir hata düzeltildi `quantile` aile. +- Kullanırken çok nadir durumlarda meydana gelen sorgu yürütme boru hattında bir yarış durumu düzeltildi `Merge` çok sayıda tablo içeren tablolar ve kullanırken `GLOBAL` alt sorgular. +- Farklı boyutlarda dizileri geçerken bir kilitlenme düzeltildi `arrayReduce` birden çok bağımsız değişkenden toplam işlevleri kullanırken işlev. +- İle sorgu useların kullanılması yasaktır `UNION ALL` in a `MATERIALIZED VIEW`. +- Başlatma sırasında bir hata düzeltildi `part_log` sunucu başlatıldığında sistem tablosu (varsayılan olarak, `part_log` devre dışı) olur. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-10} + +- Kaldır theılan `distributed_ddl_allow_replicated_alter` seçenek. Bu davranış varsayılan olarak etkindir. +- Kaldır theılan `strict_insert_defaults` ayar. Bu işlevi kullanıyorsanız, `clickhouse-feedback@yandex-team.com`. +- Kaldır theılan `UnsortedMergeTree` motor. + +### ClickHouse Yayın 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} + +- Dağıtılmış DDL sorgularında ve dağıtılmış tabloların oluşturucularında küme adlarını tanımlamak için makro desteği eklendi: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. +- Şimdi gibi sorgular `SELECT ... FROM table WHERE expr IN (subquery)` kullanılarak iş arelenir `table` dizin. +- Çoğaltılmış tablolara eklerken çoğaltmaların işlenmesi geliştirildi, böylece artık çoğaltma kuyruğunun yürütülmesini yavaşlatmazlar. + +### ClickHouse Sürümü 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} + +Bu sürüm önceki sürüm 1.1.54337 için hata düzeltmeleri içerir: + +- 1.1.54337’de bir gerileme düzeltildi: varsayılan kullanıcı salt okunur erişime sahipse, sunucu mesajla başlamayı reddediyor `Cannot create database in readonly mode`. +- 1.1.54337 bir gerileme sabit: systemd ile sistemlerde, günlükleri her zaman ne olursa olsun yapılandırma syslog yazılır; watchdog komut dosyası hala init kullanır.d. +- Docker görüntüde yanlış varsayılan yapılandırma: 1.1.54337 bir gerileme düzeltildi. +- Graphıtemergetree sabit nondeterministic davranış (günlük mesajları görebilirsiniz `Data after merge is not byte-identical to the data on another replicas`). +- Çoğaltılmış tablolara sorguyu OPTİMİZE ettikten sonra tutarsız birleştirmelere yol açabilecek bir hata düzeltildi (günlük iletilerinde görebilirsiniz `Part ... intersects the previous part`). +- (ZHANG2014 tarafından) hedef tabloda MATERİALİZED sütunlar mevcut olduğunda arabellek tabloları şimdi düzgün çalışır. +- NULL uygulanmasında bir hata düzeltildi. + +### ClickHouse Sürümü 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} + +#### Yenilik: {#new-features-17} + +- Çok boyutlu diziler ve tuples depolanması için destek eklendi (`Tuple` veri türü) tablolarda. +- Masa fonksiyonları için destek `DESCRIBE` ve `INSERT` sorgular. Alt sorgular için destek eklendi `DESCRIBE`. Örnekler: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. İçin destek `INSERT INTO TABLE` ayrıca `INSERT INTO`. +- Saat dilimleri için geliştirilmiş destek. Bu `DateTime` veri türü ayrıştırma ve metin biçimlerinde biçimlendirme için kullanılan saat dilimi ile açıklamalı. Örnek: `DateTime('Europe/Moscow')`. Zaman dilimleri için işlevlerde belirtildiğinde `DateTime` bağımsız değişkenler, dönüş türü saat dilimini izler ve değer beklendiği gibi görüntülenir. +- Fonksiyonları eklendi `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. Bu `toRelativeHour`/`Minute`/`Second` fonksiyonlar bir tür değeri alabilir `Date` bir argüman olarak. Bu `now` işlev adı büyük / küçük harf duyarlıdır. +- Add theed the `toStartOfFifteenMinutes` fonksiyon (Kirill Shvakov). +- Add theed the `clickhouse format` sorguları biçimlendirme aracı. +- Add theed the `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` biçimli. Şema dosyaları yalnızca belirtilen dizinde bulunabilir. +- Yapılandırma değiştirmeleri için destek eklendi (`incl` ve `conf.d`) dış sözlüklerin ve modellerin konfigürasyonu için (Pavel Yakunin). +- İçin belgeler içeren bir sütun eklendi `system.settings` tablo (Kirill Shvakov). +- Add theed the `system.parts_columns` her veri bölümünde sütun boyutları hakkında bilgi içeren tablo `MergeTree` Tablolar. +- Add theed the `system.models` yüklenen hakkında bilgi içeren tablo `CatBoost` makine öğrenme modelleri. +- Add theed the `mysql` ve `odbc` tablo fonksiyonu ve karşılık gelen `MySQL` ve `ODBC` uzak veritabanlarına erişmek için tablo motorları. Bu işlevsellik beta aşamasındadır. +- Türünde bir argüman geçme imkanı eklendi `AggregateFunction` için `groupArray` toplama işlevi (böylece bazı toplama işlevinin bir dizi durumunu oluşturabilirsiniz). +- Agrega fonksiyon birleştiricilerinin çeşitli kombinasyonlarındaki kısıtlamalar kaldırıldı. Örneğin, kullanabilirsiniz `avgForEachIf` keza `avgIfForEach` farklı davranışlara sahip toplam fonksiyonlar. +- Bu `-ForEach` toplama işlevi Birleştiricisi, birden çok bağımsız değişkenin toplama işlevleri için genişletilir. +- Toplam fonksiyonları için destek eklendi `Nullable` işlevin bir non döndürdüğü durumlarda bile argümanlar-`Nullable` sonuç (Silviu Caragea’nın katkısıyla eklendi). Örnek: `groupArray`, `groupUniqArray`, `topK`. +- Add theed the `max_client_network_bandwidth` için `clickhouse-client` (Kirill Shvakov). +- İle kullanıcılar `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). +- İle birden fazla tüketici kullanmak için destek eklendi `Kafka` motor. İçin genişletilmiş yapılandırma seçenekleri `Kafka` (Marek Vavruša). +- Add theed the `intExp3` ve `intExp4` işlevler. +- Add theed the `sumKahan` toplama işlevi. +- To \* Number\* ornull işlevleri eklendi, burada \* Number \* sayısal bir türdür. +- İçin destek eklendi `WITH` CLA anus anes for an `INSERT SELECT` sorgu (yazar: zhang2014). +- Eklenen ayarlar: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. Özellikle, bu ayarlar çoğaltma için veri parçalarını indirmek için kullanılır. Bu ayarları değiştirmek, ağ aşırı yüklenmişse daha hızlı yük devretme olanağı sağlar. +- İçin destek eklendi `ALTER` tip tablolar için `Null` (Anastasiya Tsarkova). +- Bu `reinterpretAsString` işlev, bellekte bitişik olarak depolanan tüm veri türleri için genişletilir. +- Add theed the `--silent` seçeneği için `clickhouse-local` aracı. Bu stderr yazdırma sorgu yürütme bilgi bastırır. +- Tip değerlerini okumak için destek eklendi `Date` ay ve/veya Ayın gün iki basamak (Amos kuş) yerine tek bir basamak kullanılarak belirtilen bir biçimde metinden. + +#### Performans iyileştirmeleri: {#performance-optimizations} + +- Agrega fonksiyonlarının geliştirilmiş performansı `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` dize argümanlarından. +- Fonksiyonların geliştirilmiş performansı `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. +- Ayrıştırma ve biçimlendirmenin geliştirilmiş performansı `Date` ve `DateTime` değerleri metin biçiminde yazın. +- Kayan nokta sayılarının ayrıştırılmasında geliştirilmiş performans ve hassasiyet. +- İçin bellek kullanımını azalt fortı `JOIN` sol ve sağ parçaların, içinde bulunmayan aynı adlara sahip sütunlara sahip olması durumunda `USING` . +- Agrega fonksiyonlarının geliştirilmiş performansı `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` hesaplama kararlılığını azaltarak. Eski fonksiyonlar isimler altında mevcuttur `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. + +#### Hata düzeltmeleri: {#bug-fixes-28} + +- Bir çalıştırdıktan sonra sabit veri tekilleştirme `DROP` veya `DETACH PARTITION` sorgu. Önceki sürümde, bir bölümü bırakmak ve aynı verileri tekrar eklemek işe yaramadı çünkü eklenen bloklar kopya olarak kabul edildi. +- Yanlış yorumlanmasına yol açabilecek bir hata düzeltildi `WHERE` için fık forra `CREATE MATERIALIZED VIEW` ile sorgular `POPULATE` . +- Kullanarak bir hata düzeltildi `root_path` param parametereter in the `zookeeper_servers` yapılandırma. +- Geçen sabit beklenmedik sonuçlar `Date` arg toum argumentent to `toStartOfDay` . +- Sabit `addMonths` ve `subtractMonths` fonksiyonlar ve aritmetik `INTERVAL n MONTH` sonuç bir önceki yıla sahip olduğu durumlarda. +- İçin eksik destek eklendi `UUID` için veri türü `DISTINCT` , `JOIN` , ve `uniq` agrega fonksiyonları ve dış sözlükler (Evgeniy Ivanov). İçin destek `UUID` hala eksik. +- Sabit `SummingMergeTree` satırların sıfıra toplandığı durumlarda davranış. +- İçin çeşitli düzeltmeler `Kafka` engine (Marek Vavruša). +- Sabit yanlış davranış `Join` masa motoru (Amos kuş). +- FreeBSD ve OS X altında yanlış ayırıcı davranışı düzeltildi. +- Bu `extractAll` fonksiyon artık boş eşleşmeleri destekliyor. +- Kullanımını engelleyen bir hata düzeltildi `libressl` yerine `openssl` . +- Sabit `CREATE TABLE AS SELECT` geçici tablolardan sorgu. +- Çoğaltma kuyruğunu güncelleme sabit olmayan atomicity. Bu, sunucu yeniden başlatılıncaya kadar eşlemelerin eşitlenmemesine neden olabilir. +- Sabit Olası taşma `gcd` , `lcm` ve `modulo` (`%` operatör) (Maks Skorokhod). +- `-preprocessed` dosyalar şimdi değiştirdikten sonra oluşturulur `umask` (`umask` config değişmiş) olabilir. +- Parçaların arka plan kontrol bir hata düzeltildi (`MergeTreePartChecker` ) özel bir bölüm anahtarı kullanırken. +- Tuples sabit ayrıştırma (değerleri `Tuple` veri türü) metin biçimlerinde. +- Uyumsuz türlerle ilgili geliştirilmiş hata mesajları `multiIf` , `array` ve diğer bazı fonksiyonlar. +- İçin yeniden tasarlanmış destek `Nullable` türler. Bir sunucu çökmesine yol açabilir sabit hatalar. İlgili hemen hemen tüm diğer hatalar düzeltildi `NULL` destek: INSERT SELECT yanlış tür dönüşümleri, sahip ve PREWHERE içinde Nullable için yetersiz destek, `join_use_nulls` mod, argümanlar olarak Nullable türleri `OR` operatör, vb. +- Veri türlerinin iç semantiği ile ilgili çeşitli hatalar düzeltildi. Örnekler: gereksiz toplama `Enum` type Fi fieldsel fieldsds in `SummingMergeTree` ; hizalama `Enum` yazmak `Pretty` format ,lar vb. +- Bileşik sütunların izin verilen kombinasyonları için daha sıkı kontroller. +- İçin çok büyük bir parametre belirlerken taşma düzeltildi `FixedString` veri türü. +- Bu bir hata düzeltildi `topK` genel bir durumda toplama işlevi. +- Toplam fonksiyonların n-ary varyantlarının argümanlarında dizi boyutlarının eşitliği için eksik kontrol eklendi `-Array` birleştirici. +- Bir hata düzeltildi `--pager` için `clickhouse-client` (yazar: ks1322). +- Sabit hassasiyet `exp10` işlev. +- Davranışı Düzelt theildi `visitParamExtract` belgelere daha iyi uyum için işlev. +- Yanlış veri türleri belirtildiğinde kilitlenme düzeltildi. +- Davranışı düzeltildi `DISTINCT` tüm sütunların sabitler olması durumunda. +- Kullanarak durumunda sabit sorgu biçimlendirme `tupleElement` tuple öğesi dizini olarak karmaşık bir sabit ifadeyle işlev. +- Bir hata düzeltildi `Dictionary` için tablolar `range_hashed` sözlükler. +- Sonucunda aşırı satırlara yol açan bir hata düzeltildi `FULL` ve `RIGHT JOIN` (Amos Kuşu). +- Geçici dosyaları oluştururken ve kaldırırken bir sunucu çökmesi düzeltildi `config.d` yapılandırma yeniden yükleme sırasında dizinler. +- Sabit `SYSTEM DROP DNS CACHE` sorgu: önbellek temizlendi, ancak küme düğümlerinin adresleri güncelleştirilmedi. +- Davranışı düzeltildi `MATERIALIZED VIEW` çalıştırdıktan sonra `DETACH TABLE` for the table under the view (Marek Vavruša). + +#### İyileştirmeler oluşturun: {#build-improvements-4} + +- Bu `pbuilder` aracı oluşturur için kullanılır. Yapı işlemi, yapı ana bilgisayarı ortamından neredeyse tamamen bağımsızdır. +- Farklı işletim sistemi sürümleri için tek bir yapı kullanılır. Paketler ve ikili Linux sistemleri geniş bir yelpazede ile uyumlu yapılmıştır. +- Add theed the `clickhouse-test` paket. Fonksiyonel testleri çalıştırmak için kullanılabilir. +- Kaynak tarball artık depoya yayınlanabilir. Github kullanmadan yapıyı yeniden oluşturmak için kullanılabilir. +- Travis CI ile sınırlı entegrasyon eklendi. Travis oluşturma süresi sınırları nedeniyle, yalnızca hata ayıklama yapı sınanır ve sınamaların sınırlı bir alt kümesi çalıştırılır. +- İçin destek eklendi `Cap'n'Proto` varsayılan yapı içinde. +- Dokümantasyon kaynaklarının biçimini değiştirdi `Restricted Text` -e doğru `Markdown`. +- İçin destek eklendi `systemd` (Vladimir Smirnov). Bazı işletim sistemi görüntüleri ile uyumsuzluk nedeniyle varsayılan olarak devre dışı bırakılır ve manuel olarak etkinleştirilebilir. +- Dinamik kod üretimi için, `clang` ve `lld` içine gömülü `clickhouse` ikilik. Olarak da çağr alsoıla invokedbilirler `clickhouse clang` ve `clickhouse lld` . +- GNU uzantılarının koddan kaldırılması. Etkin `-Wextra` seçenek. İle inşa ederken `clang` varsayılan değer `libc++` yerine `libstdc++`. +- Elde `clickhouse_parsers` ve `clickhouse_common_io` kütüphaneler hızlandırmak için çeşitli araçlar oluşturur. + +#### Geriye dönük Uyumsuz değişiklikler: {#backward-incompatible-changes-11} + +- İşaret formatlerin biçimi `Log` içeren tabloları yazın `Nullable` sütunlar geriye dönük uyumsuz bir şekilde değiştirildi. Bu tablolar varsa, bunları dönüştürmek gerekir `TinyLog` yeni sunucu sürümünü başlatmadan önce yazın. Bunu yapmak için değiştirin `ENGINE = Log` ile `ENGINE = TinyLog` karşılık gelen `.sql` dosya içinde `metadata` dizin. Masanız yoksa `Nullable` sütun veya tablonuzun türü değilse `Log` o zaman hiçbir şey yapmanıza gerek yok. +- Kaldır theılan `experimental_allow_extended_storage_definition_syntax` ayar. Şimdi bu özellik varsayılan olarak etkindir. +- Bu `runningIncome` işlev olarak yeniden adlandırıldı `runningDifferenceStartingWithFirstvalue` karışıklığı önlemek için. +- Kaldır theılan `FROM ARRAY JOIN arr` array JOİN, tablo olmadan (Amos Bird) doğrudan FROM sonra belirtildiğinde sözdizimi. +- Kaldır theılan `BlockTabSeparated` sadece gösteri amaçlı kullanılan format. +- Toplu işlevler için durum biçimini değiştirdi `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Bu toplama işlevlerinin durumlarını tablolarda depoladıysanız ( `AggregateFunction` veri türü veya ilgili durumları ile hayata görünümleri), yazınız clickhouse-feedback@yandex-team.com. +- Önceki sunucu sürümlerinde belgelenmemiş bir özellik vardı: bir toplama işlevi parametrelere bağlıysa, yine de AggregateFunction veri türünde parametreler olmadan belirtebilirsiniz. Örnek: `AggregateFunction(quantiles, UInt64)` yerine `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. Bu özellik kayboldu. Belgesiz olmasına rağmen, gelecek sürümlerde tekrar desteklemeyi planlıyoruz. +- Enum veri türleri min / max toplama işlevlerinde kullanılamaz. Bu yetenek bir sonraki sürümde iade edilecektir. + +#### Yükseltme Yaparken lütfen unutmayın: {#please-note-when-upgrading} + +- Bir kümede, bazı yinelemelerin Clickhouse’un eski sürümünü çalıştırdığı ve bazılarının yeni sürümü çalıştırdığı noktada yuvarlanan bir güncelleme yaparken, çoğaltma geçici olarak durdurulur ve ileti `unknown parameter 'shard'` günlüğünde görünür. Kümenin tüm yinelemeleri güncelleştirildikten sonra çoğaltma devam eder. +- Clickhouse’un farklı sürümleri küme sunucularında çalışıyorsa, aşağıdaki işlevleri kullanarak dağıtılmış sorguların yanlış sonuçları olması olasıdır: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Tüm küme düğümlerini güncelleştirmelisiniz. + +## [2017 için Changelog](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/tr/whats-new/changelog/2019.md b/docs/tr/whats-new/changelog/2019.md new file mode 100644 index 00000000000..baa85482869 --- /dev/null +++ b/docs/tr/whats-new/changelog/2019.md @@ -0,0 +1,2074 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 77 +toc_title: '2019' +--- + +## ClickHouse sürüm V19. 17 {#clickhouse-release-v19-17} + +### ClickHouse sürümü V19.17.6. 36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} + +#### Hata Düzeltme {#bug-fix} + +- Sıkıştırmada sabit potansiyel tampon taşması. Kötü niyetli kullanıcı, arabellekten sonra okunmasına neden olabilecek sıkıştırılmış verileri iletebilir. Bu sorun Yandex bilgi güvenliği ekibinden Eldar Zaitov tarafından bulundu. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit Olası sunucu çökmesi (`std::terminate`) sunucu, dize veri türü (UTF-8 doğrulaması gerektiren) değerleriyle json veya XML biçiminde veri gönderemez veya yazamaz veya sonuç verilerini Brotli algoritması ile sıkıştırırken veya diğer bazı nadir durumlarda. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bir clickhouse kaynak ile sabit sözlükler `VIEW`, şimdi bu tür sözlükleri okumak hataya neden olmaz `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Bir istemci ana bilgisayar kullanıcıları belirtilen host\_regexp tarafından izin verilip verilmediğini kontrol sabit.xml. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- `RENAME TABLE` dağıtılmış bir tablo için artık parçalara göndermeden önce eklenen verileri içeren klasörü yeniden adlandırır. Bu, ardışık yeniden adlarla ilgili bir sorunu giderir `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- `range_hashed` DDL sorguları tarafından oluşturulan dış sözlükler artık rasgele sayısal tür aralıklarına izin verir. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- Sabit `INSERT INTO table SELECT ... FROM mysql(...)` tablo işlevi. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- Sabit segfault içinde `INSERT INTO TABLE FUNCTION file()` mevcut olmayan bir dosyaya eklerken. Şimdi bu durumda dosya oluşturulur ve daha sonra insert işlenir. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Birleştirilmiş bir bitmap ve bir skaler bitmap kesişen sabit bitmapAnd hatası. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Sabit segfault zaman `EXISTS` sorgu olmadan kullanıldı `TABLE` veya `DICTIONARY` niteleyici, tıpkı `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fonksiyonlar için sabit dönüş tipi `rand` ve `randConstant` geçersiz argüman durumunda. Şimdi fonksiyonlar her zaman geri döner `UInt32` ve asla `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Sabit `DROP DICTIONARY IF EXISTS db.dict`, şimdi Eğer istisna atmaz `db` yok. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- Sunucu çökmesi nedeniyle bir tablo tamamen düşmediyse, sunucu geri yüklemeyi ve yüklemeyi deneyecektir [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- İkiden fazla shard yerel tablo varsa, dağıtılmış bir tablo için önemsiz bir sayım sorgusu düzeltildi. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- DB::Blockstreamprofileınfo::calculateRowsBeforeLimit bir veri yarış yol Sabit hata() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- Sabit `ALTER table MOVE part` belirtilen parçayı birleştirdikten hemen sonra yürütülür, bu da belirtilen parçanın birleştirildiği bir parçanın taşınmasına neden olabilir. Şimdi belirtilen kısmı doğru hareket ettirir. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Sözlükler için ifadeler şimdi dizeler olarak belirtilebilir. Bu, ClickHouse olmayan kaynaklardan veri ayıklarken özniteliklerin hesaplanması için yararlıdır, çünkü bu ifadeler için ClickHouse olmayan sözdizimini kullanmanıza izin verir. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- Çok nadir bir yarış sabit `clickhouse-copier` zxıd’de bir taşma nedeniyle. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Sorgu başarısız olduktan sonra hata düzeltildi (nedeniyle “Too many simultaneous queries” örneğin) harici tablolar bilgisini okumaz ve + sonraki istek, bu bilgiyi bir sonraki sorgunun başlangıcı olarak yorumlayacak ve aşağıdaki gibi bir hataya neden olacaktır `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Sonra null dereference kaçının “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Tüm YBÜ yerel destek Geri Yükleme, sabit ifadeler için harmanlama uygulamak ve sisteme dil adı eklemek için yeteneği ekleyin.harmanlama tablosu. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- Okuma için akış sayısı `StorageFile` ve `StorageHDFS` bellek sınırını aşmamak için artık sınırlıdır. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- Sabit `CHECK TABLE` sorgu için `*MergeTree` anahtarsız tablolar. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- Mutasyon olmaması durumunda bir parça adından mutasyon numarası kaldırıldı. Bu kaldırma eski sürümleri ile uyumluluk geliştirilmiş. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- Mutasyonlar nedeniyle data\_version bazı ekli parçalar için atlanır hata tablo mutasyon sürümü daha büyüktür düzeltildi. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) +- Başka bir cihaza taşıdıktan sonra yedek parça kopyalarıyla sunucuyu başlatmaya izin verin. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Hata düzeltildi “Sizes of columns doesn’t match” bu, toplama işlevi sütunlarını kullanırken görünebilir. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Şimdi LİMİT BY yanında bağları ile kullanılması durumunda bir istisna atılır. Ve şimdi LİMİT ile üst kullanmak mümkündür. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Varsa sözlük yeniden yükle `invalidate_query`, güncellemeleri durdurdu ve önceki güncelleme denemelerinde bazı istisnalar. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) + +### ClickHouse sürümü V19.17.4. 11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change} + +- Daha iyi performans için skaler alt sorgu sonuçlarını depolamak için AST yerine sütun kullanma. Ayar `enable_scalar_subquery_optimization` 19.17’de eklendi ve varsayılan olarak etkinleştirildi. Gibi hat toalara yol açar [bu](https://github.com/ClickHouse/ClickHouse/issues/7851) önceki sürümlerden 19.17.2 veya 19.17.3’e yükseltme sırasında. Bu ayar, 19.17.4’te, 19.16 ve daha eski sürümlerden hatasız yükseltme yapılmasını sağlamak için varsayılan olarak devre dışı bırakıldı. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos Kuşu](https://github.com/amosbird)) + +#### Yenilik {#new-feature} + +- DDL sorguları ile sözlükler oluşturma yeteneği ekleyin. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) +- Yapmak `bloom_filter` endeks destek türü `LowCardinality` ve `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fonksiyon Ekle `isValidJSON` geçirilen dizenin geçerli bir json olduğunu kontrol etmek için. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) +- Uygulamak `arrayCompact` işlev [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Not](https://github.com/Joeywzr)) +- Oluşturulan işlev `hex` ondalık sayılar için. Gibi çalışır `hex(reinterpretAsString())`, ancak son sıfır bayt silmez. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) +- Eklemek `arrayFill` ve `arrayReverseFill` dizideki ön / arka öğelerdeki diğer öğelerle öğeleri değiştiren işlevler. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) +- Eklemek `CRC32IEEE()`/`CRC64()` destek [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) +- Uygulamak `char` fonksiyon birine benzer [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) +- Eklemek `bitmapTransform` işlev. Değerler bir dizi için bir bit eşlem değerler dizisi dönüştüren, sonuçta yeni bir bit eşlem [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) +- Uyguluyordu `javaHashUTF16LE()` işlev [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) +- Eklemek `_shard_num` dağıtılmış motor için sanal sütun [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) + +#### Deneysel Özellik {#experimental-feature} + +- İşlemciler için destek (yeni sorgu yürütme boru hattı) `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Hata Düzeltme {#bug-fix-1} + +- Yanlış float ayrıştırma düzeltme `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- Trace\_log etkinleştirildiğinde oluşabilecek nadir kilitlenmeyi düzeltin. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Kafka tablosu üretirken mesaj çoğaltmasını önle, ondan seçim yapan herhangi bir MVs var [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([I ivanvan](https://github.com/abyss7)) +- İçin destek `Array(LowCardinality(Nullable(String)))` içinde `IN`. Gideriyor [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) +- Add hand ofling of `SQL_TINYINT` ve `SQL_BIGINT`, ve düzeltme işleme `SQL_FLOAT` ODBC köprüsünde veri kaynağı türleri. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Toplama düzeltme (`avg` ve quantiles) boş ondalık sütunlar üzerinde [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Düzeltmek `INSERT` ile dağıtılan içine `MATERIALIZED` sütun [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Yapmak `MOVE PARTITION` bölümün bazı bölümleri zaten hedef disk veya birimde ise çalışın [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- İçinde mutasyonlar sırasında oluşturulacak başarısız hardlinks ile Sabit hata `ReplicatedMergeTree` çoklu disk yapılandırmalarında. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Bütün parça değişmeden kalır ve en iyi alan başka bir diskte bulunurken bir MergeTree üzerinde bir mutasyon ile bir hata düzeltildi [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Sabit hata ile `keep_free_space_ratio` disk yapılandırmasından okunmuyor [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Tablo ile Fix hata sadece içerir `Tuple` karmaşık yolları olan sütunlar veya sütunlar. Düzeltiyor [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) +- Bellek Max\_memory\_usage sınırında arabellek altyapısı için hesap değil [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) +- Son işaret kullanımını düzeltin `MergeTree` tarafından sipariş edilen tablolar `tuple()`. Nadir durumlarda yol açabilir `Can't adjust last granule` seçerken hata. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) +- Çökmelere veya garip istisnalara yol açabilecek bağlam gerektiren eylemlerle (örneğin json için işlevler) yüklü olan mutasyonlardaki hatayı düzeltin. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) +- Kaçan veritabanı ve tablo adlarının uyumsuzluğunu düzeltin `data/` ve `shadow/` dizinler [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Bu durumda kazayı düzeltin. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) +- Düzeltmek `Not found column in block` ifadeye doğru veya tam birleştirme ile katılırken. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) +- Sonsuz döngüyü düzeltmek için bir girişim daha `PrettySpace` biçimli [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) +- Hatayı düzeltin `concat` tüm argümanlar olduğunda işlev `FixedString` aynı boyutta. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) +- S3, URL ve HDFS depolarını tanımlarken 1 argüman kullanılması durumunda sabit istisna. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Sorgu ile görünümler için Interpretersselectquery’nin kapsamını düzeltin [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) + +#### Geliştirme {#improvement} + +- `Nullable` ODBC-bridge tarafından doğru işlenen sütunlar tanınan ve NULL değerleri [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- Atomically dağıtılmış göndermek için geçerli toplu yazma [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) +- Sorguda sütun adı için tablo algılayamazsak bir istisna atın. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) +- Eklemek `merge_max_block_size` ayarı için `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) +- İle sorgular `HAVING` ve olmadan `GROUP BY` sabit olarak grup varsayalım. Böyle, `SELECT 1 HAVING 1` şimdi bir sonuç döndürür. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos Kuşu](https://github.com/amosbird)) +- Destek ayrıştırma `(X,)` python’a benzer tuple olarak. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos Kuşu](https://github.com/amosbird)) +- Yapmak `range` işlev davranışları neredeyse pythonic gibi. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) +- Eklemek `constraints` tabloya sütunlar `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) +- Tcp işleyicisi için daha iyi boş biçim, böylece kullanmak mümkün `select ignore() from table format Null` clickhouse-client ile perf ölçümü için [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos Kuşu](https://github.com/amosbird)) +- Gibi sorgular `CREATE TABLE ... AS (SELECT (1, 2))` doğru ayrıştırılır [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) + +#### Performans İyileştirme {#performance-improvement} + +- Kısa dize anahtarları üzerinde toplama performansı artırıldı. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [Amos Kuşu](https://github.com/amosbird)) +- Sabit yüklemler katlandıktan sonra olası optimizasyonları almak için sözdizimi/ifade analizinin başka bir geçişini çalıştırın. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos Kuşu](https://github.com/amosbird)) +- Önemsiz değerlendirmek için depolama meta bilgisi kullanın `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos Kuşu](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) +- Vectorize işleme `arrayReduce` toplayıcı benzer `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Kuşu](https://github.com/amosbird)) +- Performansında küçük iyileştirmeler `Kafka` tüketim [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([I ivanvan](https://github.com/abyss7)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement} + +- AARCH64 CPU mimarisine çapraz derleme için destek ekleyin. Refactor packager komut. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([I ivanvan](https://github.com/abyss7)) +- Paketleri oluştururken darwin-x86\_64 ve linux-aarch64 araç zincirlerini monte edilmiş Docker hacmine açın [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([I ivanvan](https://github.com/abyss7)) +- İkili Paketleyici için Docker görüntüsünü güncelle [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([I ivanvan](https://github.com/abyss7)) +- MacOS Catalina’da sabit derleme hataları [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) +- Sorgu analizi mantığında bazı yeniden düzenleme: karmaşık sınıfı birkaç basit sınıfa ayırın. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) +- Submodules olmadan yapı düzeltme [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) +- İyileştirmek `add_globs` cmake dosyalarında [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos Kuşu](https://github.com/amosbird)) +- Kodlanmış yolları Kaldır `unwind` hedef [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) +- Ssl olmadan mysql formatını kullanmasına izin ver [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) + +#### Diğer {#other} + +- ClickHouse SQL lehçesi için ANTLR4 dilbilgisi eklendi [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouse sürüm V19. 16 {#clickhouse-release-v19-16} + +#### ClickHouse yayın V19. 16. 14. 65, 2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} + +- Birden argümanlar (10’dan fazla) üçlü mantıksal OPs toplu hesaplamalarda bir hata düzeltildi. [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) Bu hata düzeltme Altınity özel bir istek ile sürüm 19.16 backported edildi. + +#### ClickHouse yayın V19. 16. 14. 65, 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} + +- Dağıtılmış alt sorgular uyumsuzluğunu eski CH sürümleriyle düzeltin. Düzeltiyor [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) + [(tabplubix)](https://github.com/tavplubix) +- Yürüt whenürken `CREATE` sorgu, depolama motoru argümanlarında sabit ifadeleri katlayın. Boş veritabanı adı geçerli veritabanı ile değiştirin. Düzeltiyor [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Ayrıca yerel adresi kontrol edin `ClickHouseDictionarySource`. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Şimdi arka plan birleşir `*MergeTree` tablo motorları ailesi depolama ilkesi hacim sırasını daha doğru bir şekilde korur. + [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Veri kaybını önlemek `Kafka` nadir durumlarda istisna sonek okuduktan sonra ancak taahhütten önce gerçekleşir. Düzeltiyor [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). İlgili: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Kullanmaya / bırakmaya çalışırken sunucu sonlandırmasına giden hatayı düzeltin `Kafka` tablo yanlış parametrelerle oluşturuldu. Düzeltiyor [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Birleşiyor [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) +- Kullanmaya izin ver `MaterializedView` yukarıdaki alt sorgularla `Kafka` Tablolar. + [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) + +#### Yenilik {#new-feature-1} + +- Eklemek `deduplicate_blocks_in_dependent_materialized_views` hayata manzaralı tablolara idempotent ekler davranışlarını kontrol etmek için Seçenek. Bu yeni özellik, altınity’den özel bir istek ile bugfix sürümüne eklendi. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### ClickHouse sürümü V19.16.2. 2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-1} + +- Count/counİf için eksik arity doğrulama ekleyin. + [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) + [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) +- Eski Kaldır `asterisk_left_columns_only` ayar (varsayılan olarak devre dışıdır). + [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem + Zuikov](https://github.com/4ertus2)) +- Şablon veri biçimi için Biçim dizeleri artık dosyalarda belirtilmiştir. + [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) + +#### Yenilik {#new-feature-2} + +- Uint\_max büyük önemlilik hesaplamak için uniqcombined64() tanıtmak. + [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), + [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat + Khuzhin](https://github.com/azat)) +- Dizi sütunlarında Bloom filtre indekslerini destekleyin. + [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) + ([achimbab](https://github.com/achimbab)) +- Bir işlev Ekle `getMacro(name)` bu karşılık gelen değeri ile dize döndürür `` + sunucu yapılandırmasından. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bir HTTP kaynağına dayalı bir sözlük için iki yapılandırma seçeneği belirleyin: `credentials` ve + `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- Yeni bir ProfileEvent Ekle `Merge` bu, başlatılan arka plan birleşimlerinin sayısını sayar. + [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mikhail + Korotov](https://github.com/millb)) +- Tam etki alanı adı döndüren fullHostName işlevi ekleyin. + [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) + [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) +- Fonksiyon Ekle `arraySplit` ve `arrayReverseSplit` bir diz byiyi böl anen “cut off” + şartlar. Zaman dizisinin işlenmesinde kullanışlıdırlar. + [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) +- Multimatch işlev ailesine eşleşen tüm dizinlerin dizisini döndüren yeni işlevler ekleyin. + [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila. + Kutenin](https://github.com/danlark1)) +- Yeni bir veritabanı altyapısı Ekle `Lazy` bu, çok sayıda küçük günlük depolamak için optimize edilmiştir + Tablolar. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nikita + Vasilev](https://github.com/nikvas0)) +- Bitmap sütunları için groupBitmapAnd, - veya-Xor toplam işlevleri ekleyin. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang + Yu](https://github.com/yuzhichang)) +- Null döndüren toplam işlev birleştiricileri-OrNull ve-OrDefault ekleyin + veya toplamak için hiçbir şey olmadığında varsayılan değerler. + [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) + ([hcz](https://github.com/hczhcz)) +- Özel kaçan destekleyen CustomSeparated veri biçimini tanıtmak ve + sınırlayıcı kuralları. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) +- Destek Redis harici sözlük kaynağı olarak. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton + Popov](https://github.com/CurtizJ)) + +#### Hata Düzeltme {#bug-fix-2} + +- Varsa yanlış sorgu sonucunu düzeltin `WHERE IN (SELECT ...)` bölüm ve `optimize_read_in_order` oluyor + kullanılmış. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton + Popov](https://github.com/CurtizJ)) +- Proje dışındaki dosyalara bağlı olarak engelli MariaDB kimlik doğrulama eklentisi. + [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Yuriy + Baranov](https://github.com/yurriy)) +- İstisnayı düzeltin `Cannot convert column ... because it is constant but values of constants are different in source and result` fonksiyonlar olduğunda nadiren olabilir `now()`, `today()`, + `yesterday()`, `randConstant()` kullanılır. + [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolay + Kochetov](https://github.com/KochetovNicolai)) +- TCP yerine HTTP keep alive timeout kullanarak sabit sorunu alive timeout tutun. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily + Nemkov](https://github.com/Enmk)) +- Groupbitmapor’da bir segmentasyon hatası düzeltildi (sorun [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). + [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang + Yu](https://github.com/yuzhichang)) +- Materyalize edilmiş görünümler için, tüm veriler yazıldıktan sonra Kafka için taahhüt denir. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([I ivanvan](https://github.com/abyss7)) +- Sabit yanlış `duration_ms` değer içinde `system.part_log` Tablo. On kez kapalıydı. + [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Canlı Görünüm tablosundaki çökmeyi çözmek ve tüm Canlı Görünüm testlerini yeniden etkinleştirmek için hızlı bir düzeltme. + [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) + ([vzakaznikov](https://github.com/vzakaznikov)) +- MERGETREE parçalarının min/max dizinlerinde NULL değerleri doğru şekilde seri hale getirin. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([İskender + Kuzmenkov](https://github.com/akuzm)) +- Sanal sütunları koymayın .tablo olarak oluşturulduğunda sql meta verileri `CREATE TABLE AS`. + [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([I ivanvan](https://github.com/abyss7)) +- Segmentasyon hatasını düzeltin `ATTACH PART` sorgu. + [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) + ([alesapin](https://github.com/alesapin)) +- Alt sorgularda boş ve boş optimizasyonu ile verilen bazı sorgular için yanlış sonucu düzeltin + INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolay + Kochetov](https://github.com/KochetovNicolai)) +- Live VİEW getHeader() yönteminde AddressSanitizer hatası düzeltildi. + [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) + ([vzakaznikov](https://github.com/vzakaznikov)) + +#### Geliştirme {#improvement-1} + +- Queue\_wait\_max\_ms bekleme durumunda bir ileti ekleme gerçekleşir. + [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat + Khuzhin](https://github.com/azat)) +- Yapılan ayar `s3_min_upload_part_size` masa seviyesi. + [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- STORAGEFACTORY TTL kontrol edin. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) + ([sundyli](https://github.com/sundy-li)) +- Kısmi birleştirme birleşiminde Squash sol blokları (optimizasyon). + [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem + Zuikov](https://github.com/4ertus2)) +- Çoğaltılmış tablo motorlarının mutasyonlarında deterministik olmayan işlevlere izin vermeyin, çünkü bu + kopyaları arasındaki tutarsızlıkları tanıtabilir. + [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([İskender + Kazakov](https://github.com/Akazz)) +- Özel durum yığını izini dizeye dönüştürürken bellek izleyicisini devre dışı bırakın. Bu kaybı önleyebilir + Tür hata mesaj oflarının `Memory limit exceeded` neden olan sunucuda `Attempt to read after eof` istemci üzerinde istisna. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) + ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Çeşitli biçim geliştirmeleri. Gideriyor + [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), + [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), + [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), + [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) + [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) + ([tavplubix](https://github.com/tavplubix)) +- ClickHouse sola dönüştürülebilir olmayan In işlecinin sağ tarafındaki değerleri yok sayar + side type. Make it work properly for compound types – Array and Tuple. + [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([İskender + Kuzmenkov](https://github.com/akuzm)) +- ASOF JOİN için eksik eşitsizlikleri destekleyin. Daha az veya eşit varyant ve katı katılmak mümkündür + sözdiziminde asof sütunu için daha büyük ve daha az varyant. + [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem + Zuikov](https://github.com/4ertus2)) +- Kısmi birleştirme birleşimini Optimize edin. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) + ([Artem Zuikov](https://github.com/4ertus2)) +- UNİQCOMBİNED işlevlerinde 98 k’dan fazla bellek kullanmayın. + [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), + [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat + Khuzhin](https://github.com/azat)) +- Partialmergejoin diskteki sağ birleştirme tablosunun parçalarını yıkayın (yeterli değilse + bellek). Gerektiğinde verileri geri yükleyin. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) + ([Artem Zuikov](https://github.com/4ertus2)) + +#### Performans İyileştirme {#performance-improvement-1} + +- Veri çoğaltma kaçınarak const argümanları ile joinget hızlandırın. + [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos + Kuş](https://github.com/amosbird)) +- Alt sorgu boşsa erken dönün. + [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) +- Değerlerdeki SQL ifadesinin ayrıştırılmasını Optimize edin. + [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) + ([tavplubix](https://github.com/tavplubix)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-1} + +- Mac OS için çapraz derleme için bazı katkılar devre dışı bırakın. + [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([I ivanvan](https://github.com/abyss7)) +- Clickhouse\_common\_ıo için pocoxml ile eksik bağlantı ekleyin. + [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat + Khuzhin](https://github.com/azat)) +- Clickhouse-test’te birden fazla test filtresi argümanını kabul edin. + [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([İskender + Kuzmenkov](https://github.com/akuzm)) +- Kol için musl ve jemalloc’u etkinleştirin. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) + ([Amos Kuşu](https://github.com/amosbird)) +- Katma `--client-option` parametre için `clickhouse-test` müşteriye ek parametreler aktarmak için. + [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolay + Kochetov](https://github.com/KochetovNicolai)) +- Rpm paket yükseltmesinde mevcut yapılandırmaları koruyun. + [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) + ([filimonov](https://github.com/filimonov)) +- PVS tarafından tespit edilen hataları düzeltin. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem + Zuikov](https://github.com/4ertus2)) +- Darwin için yapı düzeltin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) + ([I ivanvan](https://github.com/abyss7)) +- glibc 2.29 uyumluluk. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos + Kuş](https://github.com/amosbird)) +- Dh\_clean potansiyel kaynak dosyaları dokunmaz emin olun. + [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos + Kuş](https://github.com/amosbird)) +- Altınity rpm’den güncellerken çakışmayı önlemeye çalışın-ayrı olarak paketlenmiş yapılandırma dosyası vardır + clickhouse-sunucu-ortak. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) + ([filimonov](https://github.com/filimonov)) +- Daha hızlı yeniden oluşturmak için bazı başlık dosyalarını Optimize edin. + [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), + [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([İskender + Kuzmenkov](https://github.com/akuzm)) +- Tarih ve DateTime için performans testleri ekleyin. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vasily + Nemkov](https://github.com/Enmk)) +- Deterministik olmayan mutasyonlar içeren bazı testleri düzeltin. + [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([İskender + Kazakov](https://github.com/Akazz)) +- MemorySanitizer ile CI için yapı ekleyin. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) + ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Metricstransmitter başlatılmamış değerleri kullanmaktan kaçının. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat + Khuzhin](https://github.com/azat)) +- MemorySanitizer tarafından bulunan alanlarda bazı sorunları düzeltin. + [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), + [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([İskender + Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) + ([Amos Kuşu](https://github.com/amosbird)) +- Murmurhash32’de tanımsız davranışı düzeltin. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos + Kuş](https://github.com/amosbird)) +- Storagesınfostream tanımsız davranışı düzeltin. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) + ([tavplubix](https://github.com/tavplubix)) +- Harici veritabanı motorları (MySQL, ODBC, JDBC) için katlama sabit sabit ifadeler. Önceki + sürümler birden fazla sabit ifade için çalışmadı ve Tarih için hiç çalışmadı, + DateTime ve UUID. Bu düzeltmeler [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- No\_users\_thread değişkenine erişirken canlı görünümde ThreadSanitizer veri yarışı hatası düzeltildi. + [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) + ([vzakaznikov](https://github.com/vzakaznikov)) +- Libcommon’daki malloc sembollerinden kurtulun + [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), + [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos + Kuş](https://github.com/amosbird)) +- Tüm kitaplıkları devre dışı bırakmak için genel bayrak ENABLE\_LİBRARİES ekleyin. + [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) + ([proller](https://github.com/proller)) + +#### Kod Temizleme {#code-cleanup} + +- Sözlükler için DDL’YE hazırlanmak için yapılandırma deposunu genelleştirin. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) + ([alesapin](https://github.com/alesapin)) +- Herhangi bir anlamsal olmadan sözlükler DDL için ayrıştırıcı. + [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) + ([alesapin](https://github.com/alesapin)) +- Bölünmüş ParserCreateQuery farklı küçük ayrıştırıcılar içine. + [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) + ([alesapin](https://github.com/alesapin)) +- Küçük refactoring ve dış sözlükler yakın yeniden adlandırma. + [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) + ([alesapin](https://github.com/alesapin)) +- Refactor bazı kod rol tabanlı erişim kontrolü için hazırlamak. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly. + Baranov](https://github.com/vitlibar)) +- Veritabanında bazı geliştirmelersıradan kod. + [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nikita + Vasilev](https://github.com/nikvas0)) +- Karma tabloların find() ve emplace() yöntemlerinde yineleyiciler kullanmayın. + [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([İskender + Kuzmenkov](https://github.com/akuzm)) +- Parametre kökü boş olmadığında getmultiplevaluesfromconfig’i düzeltin. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) + ([Mikhail Korotov](https://github.com/millb)) +- Bazı kopyala yapıştır (TemporaryFile ve TemporaryFileStream) kaldırın) + [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem + Zuikov](https://github.com/4ertus2)) +- Geliştirilmiş kod okunabilirliği biraz (`MergeTreeData::getActiveContainingPart`). + [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir + Chebotarev](https://github.com/excitoon)) +- Yerel nesneler kullanan tüm zamanlanmış işleri bekleyin, eğer `ThreadPool::schedule(...)` atmalar + özel. Adlandırmak `ThreadPool::schedule(...)` -e doğru `ThreadPool::scheduleOrThrowOnError(...)` ve + atabileceği açık hale getirmek için yorumları düzeltin. + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) + ([tavplubix](https://github.com/tavplubix)) + +## ClickHouse sürümü 19.15 {#clickhouse-release-19-15} + +### ClickHouse sürümü 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} + +#### Hata Düzeltme {#bug-fix-3} + +- SQL\_TINYINT ve SQL\_BIGINT işleme eklendi ve ODBC Köprüsü SQL\_FLOAT veri kaynağı türlerinin işlenmesini düzeltin. + [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- Taşıma bölümünde hedef disk veya birim üzerinde bazı parçaların olmasına izin verilir. + [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- ODBC köprüsü aracılığıyla null sütunlarda sabit NULL değerleri. + [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) +- SOMUTLAŞTIRILMIŞ sütunlarla dağıtılmış yerel olmayan düğüme sabit ekleme. + [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- Sabit fonksiyon getMultipleValuesFromConfig. + [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) +- TCP yerine HTTP keep alive timeout kullanarak sabit sorunu alive timeout tutun. + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) +- Tüm işlerin istisnada bitmesini bekleyin (nadir segfault’ları düzeltir). + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) +- Kafka tabloya eklerken MVs için itmeyin. + [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([I ivanvan](https://github.com/abyss7)) +- İstisna yığını için bellek izleyicisini devre dışı bırakın. + [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Harici veritabanı için sorgu dönüştürme sabit kötü kod. + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Metricstransmitter başlatılmamış değerleri kullanmaktan kaçının. + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) +- Testler için makrolarla örnek yapılandırma eklendi ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} + +#### Hata Düzeltme {#bug-fix-4} + +- Karma sözlükte sabit bad\_variant. + ([alesapin](https://github.com/alesapin)) +- Bölüm sorgu Ekle segmentasyon hatası ile hata düzeltildi. + ([alesapin](https://github.com/alesapin)) +- Sabit zaman hesaplama `MergeTreeData`. + ([Vladimir Chebotarev](https://github.com/excitoon)) +- Yazma tamamlandıktan sonra açıkça Kafka’ya taahhüt edin. + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([I ivanvan](https://github.com/abyss7)) +- MERGETREE parçalarının min/max dizinlerinde NULL değerleri doğru şekilde seri hale getirin. + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +### ClickHouse sürümü 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} + +#### Yenilik {#new-feature-3} + +- Katmanlı depolama: MergeTree motoru ile tablolar için birden fazla depolama birimleri kullanmak için destek. Yeni verileri SSD’DE saklamak ve eski verileri otomatik olarak HDD’ye taşımak mümkündür. ([örnek](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) +- Tablo fonksiyonu Ekle `input` gelen verileri okumak için `INSERT SELECT` sorgu. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) +- Add a `sparse_hashed` sözlük düzeni, bu işlevsel olarak eşdeğerdir `hashed` düzen, ancak daha fazla bellek verimli. Daha yavaş değer alma pahasına yaklaşık iki kat daha az bellek kullanır. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) +- Sözlüklere erişim için kullanıcıların listesini tanımlama yeteneğini uygular. Sadece geçerli bağlı veritabanı kullanarak. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Eklemek `LIMIT` seçeneği `SHOW` sorgu. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- Eklemek `bitmapSubsetLimit(bitmap, range_start, limit)` en küçük alt kümesini döndüren işlev `limit` küm valuesedeki değer smallerlerden daha küçük olmayan değerler `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) +- Eklemek `bitmapMin` ve `bitmapMax` işlevler. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) +- Fonksiyon Ekle `repeat` ile ilgili [sayı-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL)) + +#### Deneysel Özellik {#experimental-feature-1} + +- Geçerli boru hattını değiştirmeyen birleştirme birleştirme varyantını (bellekte) uygulayın. Sonuç kısmen birleştirme anahtarına göre sıralanır. Koymak `partial_merge_join = 1` bu özelliği kullanmak için. Birleştirme birleştirme hala geliştirme aşamasındadır. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) +- Eklemek `S3` motor ve masa fonksiyonu. Hala geliştirme aşamasında (henüz kimlik doğrulama desteği yok). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) + +#### Geliştirme {#improvement-2} + +- Kafka’dan okunan her mesaj atomik olarak eklenir. Bu, Kafka engine ile bilinen hemen hemen tüm sorunları çözer. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([I ivanvan](https://github.com/abyss7)) +- Dağıtılmış sorguların yerine çalışma için iyileştirmeler. Kurtarma süresini kısaltın, ayrıca şimdi yapılandırılabilir ve görülebilir `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) +- Doğrudan Enums için sayısal değerleri destekleyin `IN` bölme. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) +- Destek (isteğe bağlı, varsayılan olarak devre dışı) URL depolama yönlendirir. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([makroll](https://github.com/maqroll)) +- Eski bir sürümü olan istemci bir sunucuya bağlandığında bilgi iletisi ekleyin. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- Dağıtılmış tablolarda veri göndermek için maksimum geri dönüş uyku süresi sınırını kaldırın [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) +- Grafit kümülatif değerleri ile profil olayları (sayaçlar) göndermek için yeteneği ekleyin. Altında etkinleştir canilebilir `` server inda `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) +- Otomatik döküm türü Ekle `T` -e doğru `LowCardinality(T)` veri türü sütununa eklerken `LowCardinality(T)` HTTP üzerinden yerel formatta. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fonksiyonu kullanma yeteneği ekleyin `hex` kullanmadan `reinterpretAsString` için `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-2} + +- Hata ayıklama bilgisi ile clickhouse ikili için gdb-ındex ekleyin. Bu başlangıç süresini hızlandıracaktır `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) +- Kullanan yamalı dpkg-deb ile deb ambalajını hızlandırın `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) +- Koymak `enable_fuzzing = 1` tüm proje kodu libfuzzer enstrümantasyon etkinleştirmek için. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) +- CI bölünmüş yapı duman testi ekleyin. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) +- MemorySanitizer ile CI için yapı ekleyin. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Değişmek `libsparsehash` ile `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) + +#### Hata Düzeltme {#bug-fix-5} + +- Büyük tablolarda karmaşık anahtarlar üzerinde endeks analizi sabit performans düşüşü. Bu düzeltmeler \# 6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kafka boş konudan seçerken segfaults’a neden olan mantıksal hatayı düzeltin. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([I ivanvan](https://github.com/abyss7)) +- Çok erken MySQL bağlantısını düzeltin `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Çok eski Linux çekirdekleri için geri destek (düzeltme [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Olası veri kaybını düzeltin `insert select` giriş akışında boş blok durumunda sorgu. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fonksiyon için düzeltme `АrrayEnumerateUniqRanked` params boş diziler ile [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- Dizi birleşimleri ve genel alt sorgularla karmaşık sorguları düzeltin. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([I ivanvan](https://github.com/abyss7)) +- Düzeltmek `Unknown identifier` birden fazla birleşim ile ORDER BY ve GROUP BY hatası [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) +- Sabit `MSan` fonksiyonu çalıştırırken uyarı `LowCardinality` değişken. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-2} + +- Bitmap’in seri hale getirme biçimi değiştirildi \* performansı artırmak için toplama işlevi durumları. Önceki sürümlerden bitmap\* seri hale getirilmiş durumları okunamıyor. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) + +## ClickHouse sürümü 19.14 {#clickhouse-release-19-14} + +### ClickHouse sürümü 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} + +#### Hata Düzeltme {#bug-fix-6} + +- Bu sürüm aynı zamanda 19.11.12.69 tüm hata düzeltmeleri içerir. +- 19.14 ve önceki sürümleri arasında dağıtılmış sorgular için sabit uyumluluk. Bu düzeltmeler [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} + +#### Hata Düzeltme {#bug-fix-7} + +- Fonksiyon için düzeltme `АrrayEnumerateUniqRanked` params boş diziler ile. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- Sorgularda sabit alt sorgu adı `ARRAY JOIN` ve `GLOBAL IN subquery` takma ad ile. Belirtilirse, dış tablo adı için alt sorgu takma adını kullanın. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([I ivanvan](https://github.com/abyss7)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-3} + +- Düzeltmek [çırpan](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) test `00715_fetch_merged_or_mutated_part_zookeeper` mutasyonların uygulanmasını beklemek zorunda olduğu için bir kabuk komut dosyasına yeniden yazarak. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) +- Fonksiyon sabit UBSan ve MemSan hatası `groupUniqArray` emtpy dizi argümanı ile. Bu boş yerleştirerek neden oldu `PaddedPODArray` sıfır hücre değeri için yapıcı çağrılmadığı için karma tabloya sıfır hücre. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos Kuşu](https://github.com/amosbird)) + +### ClickHouse sürümü 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} + +#### Yenilik {#new-feature-4} + +- `WITH FILL` değiştirici için `ORDER BY`. (devam [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- `WITH TIES` değiştirici için `LIMIT`. (devam [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) +- Ayrıştırılmamış `NULL` NULL olarak değişmez (eğer ayar `format_csv_unquoted_null_literal_as_null=1`). Bu alanın veri türü null değilse, null alanları varsayılan değerlerle başlatın (eğer ayar `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) +- Tablo işlevlerinin yollarındaki joker karakterler için destek `file` ve `hdfs`. Yol joker karakterler içeriyorsa, tablo salt okunur olacaktır. Kullanım örneği: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` ve `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) +- Yeni `system.metric_log` değerleri depo tablelayan tablo `system.events` ve `system.metrics` belirtilen zaman aralığı ile. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse metin günlükleri yazmak için izin ver `system.text_log` Tablo. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yığın izlerinde özel sembolleri göster (bu, elf dosyalarının sembol tablolarını ayrıştırma yoluyla yapılır). Hata ayıklama bilgisi varsa yığın izlerinde dosya ve satır numarası hakkında bilgi eklendi. Programda mevcut indeksleme sembolleri ile Speedup sembol adı arama. İç gözlem için yeni SQL işlevleri eklendi: `demangle` ve `addressToLine`. Yeniden adlandırılan işlev `symbolizeAddress` -e doğru `addressToSymbol` tutarlılık için. İşlev `addressToSymbol` performans nedenleriyle karıştırılmış adını döndürür ve uygulamak zorunda `demangle`. Ayar eklendi `allow_introspection_functions` varsayılan olarak kapalı olan. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tablo fonksiyonu `values` (adı büyük / küçük harf duyarsız). Bu okumak için izin verir `VALUES` önerilen liste [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Örnek: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) +- Depolama ayarlarını değiştirmek için bir yetenek eklendi. Sözdizimi: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) +- Müstakil parçaların çıkarılması için destek. Sözdizimi: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) +- Tablo kısıtlamaları. Ekleme sırasında kontrol edilecek tablo tanımına kısıtlama eklemenize izin verir. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Basamaklı hayata görünümler için Suppport. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos Kuşu](https://github.com/amosbird)) +- Her sorgu yürütme iş parçacığı saniyede bir örnek için varsayılan olarak sorgu profiler’ı açın. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Giriş biçimi `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) +- İki yeni fonksiyon eklendi: `sigmoid` ve `tanh` (bu makine öğrenme uygulamaları için yararlıdır). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İşlev `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` verilen jetonun samanlıkta olup olmadığını kontrol etmek için. Token, iki alfasayısal olmayan ASCII karakteri (veya samanlığın sınırları) arasında maksimum uzunlukta bir alt dizedir. Token sabit bir dize olmalıdır. Tokenbf\_v1 Endeksi uzmanlaşma tarafından desteklenmektedir. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) +- Yeni fonksiyon `neighbor(value, offset[, default_value])`. Bir veri bloğunda sütun içindeki önceki / sonraki değere ulaşmayı sağlar. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) +- Bir işlev oluşturuldu `currentUser()`, yetkili kullanıcının giriş dönen. Add aliased al aliasias `user()` MySQL ile uyumluluk için. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) +- Yeni toplama fonksiyonları `quantilesExactInclusive` ve `quantilesExactExclusive` hangi teklif edildi [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) +- İşlev `bitmapRange(bitmap, range_begin, range_end)` hangi döner yeni set ile belirtilen aralığı (dahil değil `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) +- İşlev `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` hangi verilen alanı kapsayan geohash-kutuları hassas uzun dizeleri dizisi oluşturur. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) +- INSERT query ile destek uygulamak `Kafka` Tablolar. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([I ivanvan](https://github.com/abyss7)) +- İçin destek eklendi `_partition` ve `_timestamp` Kafka motoruna sanal sütunlar. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([I ivanvan](https://github.com/abyss7)) +- Hassas verileri kaldırma imkanı `query_log`, sunucu günlükleri, regexp tabanlı kurallar ile işlem listesi. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) + +#### Deneysel Özellik {#experimental-feature-2} + +- Giriş ve çıkış Veri formatı `Template`. Bu giriş ve çıkış için özel biçim dizesi belirtmek için izin verir. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) +- Uygulanması `LIVE VIEW` başlangıçta önerilen tablolar [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) hazırlıklı olarak [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), ve daha sonra güncellendi [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). Görmek [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) detaylı açıklama için. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov) Not bu `LIVE VIEW` özellik sonraki sürümlerinde kaldırılabilir. + +#### Hata Düzeltme {#bug-fix-8} + +- Bu sürüm aynı zamanda 19.13 ve 19.11 tüm hata düzeltmeleri içerir. +- Tablo atlama endeksleri ve dikey birleştirme gerçekleştiğinde segmentasyon hatasını düzeltin. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) +- Önemsiz olmayan sütun varsayılanlarıyla sütun başına TTL’Yİ düzeltin. Daha önce kuvvet durumunda `OPTIMIZE ... FINAL` sorgu, süresi dolmuş değerler, kullanıcı tarafından belirtilen sütun varsayılanları yerine tür varsayılanları ile değiştirildi. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) +- Normal sunucu yeniden başlatmada Kafka mesajları çoğaltma sorununu düzeltin. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([I ivanvan](https://github.com/abyss7)) +- Kafka mesajlarını okurken sabit sonsuz döngü. Tüketiciyi abonelikte hiç duraklatmayın/devam ettirmeyin - aksi takdirde bazı senaryolarda süresiz olarak duraklatılabilir. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([I ivanvan](https://github.com/abyss7)) +- Düzeltmek `Key expression contains comparison between inconvertible types` istisna içinde `bitmapContains` işlev. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) +- Etkin olan segfault’u düzeltin `optimize_skip_unused_shards` ve kayıp sharding anahtarı. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) +- Bellek bozulmasına yol açabilecek mutasyonlarda yanlış kod düzeltildi. Adresin okunması ile sabit segfault `0x14c0` bu eşzamanlı nedeniyle happed olabilir `DROP TABLE` ve `SELECT` itibaren `system.parts` veya `system.parts_columns`. Mutasyon sorgularının hazırlanmasında sabit yarış durumu. Sabit kilitlenme neden `OPTIMIZE` çoğaltılmış tablolar ve değiştirir gibi eşzamanlı değişiklik işlemleri. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MySQL arayüzü kaldırıldı ekstra ayrıntılı günlüğü [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Boolean ayarlarını ayrıştırma yeteneğini döndürür ‘true’ ve ‘false’ yapılandırma dosyasında. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- Çökmeyi düzeltin `quantile` ve `median` fonksiyonu üzerinde `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) +- Tarafından iade edilen Olası eksik sonuç düzeltildi `SELECT` ile sorgu `WHERE` birincil anahtarda durum, Float türüne dönüşüm içeriyordu. Bu Monotonluk yanlış kontrol neden oldu `toFloat` işlev. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- Kontrol `max_expanded_ast_elements` mutasyonlar için ayarlama. Sonra açık mutasyonlar `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([Kış Zhang](https://github.com/zhang2014)) +- İle kullanıldığında anahtar sütunlar için birleştirme sonuçlarını düzeltin `join_use_nulls`. Sütun varsayılanları yerine Boşları ekleyin. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) +- Dikey birleştirme ve değiştirme ile atlama endeksleri için düzeltin. Fix for `Bad size of marks file` özel. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) +- Nadir kazayı düzeltin `ALTER MODIFY COLUMN` ve birleştirilmiş/değiştirilmiş parçalardan biri boş olduğunda dikey birleştirme (0 satır) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- Dönüşüm Sabit hata `LowCardinality` yazmak `AggregateFunctionFactory`. Bu düzeltmeler [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Yanlış davranışı ve olası segfault’ları düzeltin `topK` ve `topKWeighted` toplu fonksiyonlar. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) +- Sabit güvensiz kod etrafında `getIdentifier` işlev. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MySQL Tel protokolünde Sabit hata (ClickHouse form MySQL istemcisine bağlanırken kullanılır). Yığın arabellek taşması nedeniyle `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) +- Sabit bellek sızıntısı `bitmapSubsetInRange` işlev. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) +- Granülerlik değişiminden sonra mutasyon yürütüldüğünde nadir hatayı düzeltin. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) +- Varsayılan olarak tüm alanlarla protobuf iletisine izin ver. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) +- İle bir hatayı gidermek `nullIf` fonksiyonu zaman biz göndermek bir `NULL` ikinci argüman üzerinde argüman. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Sonsuz bellek tüketimine yol açan dize alanları ile karmaşık anahtar önbellek sözlüklerinde yanlış bellek ayırma/ayırma ile nadir hatayı düzeltin (bellek sızıntısı gibi görünüyor). Dize boyutu sekizden (8, 16, 32, vb.) başlayarak iki güç olduğunda hata çoğalır. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- İstisnaya neden olan küçük dizilerde sabit goril kodlaması `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) +- Birleşimlerde null olmayan türleri kullanmasına izin ver `join_use_nulls` etkin. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) +- Sakatlamak `Poco::AbstractConfiguration` sorguda yer değiştirmeler `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kilitlenmeyi önlemek `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kullanım `arrayReduce` sabit argümanlar için segfault yol açabilir. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Replica sonra geri yüklenmişse görünebilecek tutarsız parçaları düzeltin `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- Sabit asmak `JSONExtractRaw` işlev. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yanlış atlama endeksleri seri hale getirme ve adaptif tanecikli toplama ile hatayı düzeltin. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) +- Düzeltmek `WITH ROLLUP` ve `WITH CUBE` değiştiriciler `GROUP BY` iki seviyeli toplama ile. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Adaptif tanecikli ikincil endeksler işaretleri yazma ile hatayı düzeltin. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- Sunucu başlatma sırasında başlatma sırasını düzeltin. Beri `StorageMergeTree::background_task_handle` içinde Başlat isılmıştır `startup()` bu `MergeTreeBlockOutputStream::write()` başlatmadan önce kullanmayı deneyebilir. Eğer başlatıldı ise sadece kontrol. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([I ivanvan](https://github.com/abyss7)) +- Bir hata ile tamamlanan önceki okuma işleminden veri arabelleğini temizleme. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) +- Çoğaltılan \* MergeTree tablo için yeni bir çoğaltma oluştururken adaptif taneciklik sağlayan Fix hata. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- İstisna durumunda sunucu başlatma sırasında Olası kilitlenme düzeltildi `libunwind` başlatılmamış erişim sırasında istisna sırasında `ThreadStatus` yapılı. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Çökmeyi düzeltin `yandexConsistentHash` işlev. Fuzz testi ile bulundu. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sunucu aşırı ve küresel iş parçacığı havuzu tam yakın olduğunda sorguları asılı olasılığı düzeltildi. Dağıtılmış sorgular, her bir parçaya bağlantı başına bir iş parçacığı ayırdığından, çok sayıda parçaya (yüzlerce) sahip kümelerde daha yüksek şansa sahiptir. Örneğin, bir küme 330 kırıkları 30 eşzamanlı dağıtılmış sorgu işleme, bu sorun yeniden oluşturabilir. Bu sorun, 19.2’den başlayarak tüm sürümleri etkiler. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit mantık `arrayEnumerateUniqRanked` işlev. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sembol tablosunu çözerken segfault’u düzeltin. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos Kuşu](https://github.com/amosbird)) +- Döküm sabit alakasız istisna `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Kaldırılan ekstra açıklamadan alıntı `system.settings` Tablo. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Olası kilitlenmeyi önlemek `TRUNCATE` çoğaltılan tablonun. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Anahtarı sıralama sırasına göre okumayı düzeltin. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) +- Düzeltmek `ALTER TABLE ... UPDATE` ile tablolar için sorgu `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Tarafından açılan hatayı düzeltin [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (19.4.0’dan beri). Herhangi bir sütunu sorgulamadığımızda Mergetree tabloları üzerinden dağıtılmış tablolara sorgularda çoğaltır (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- İmzalı türün imzasız türe tamsayı bölümünde sabit taşma. Davranış tam olarak C veya C++ dilinde (tamsayı promosyon kuralları) olduğu gibi şaşırtıcı olabilir. Büyük imzalı numarayı büyük imzasız numaraya bölerken veya tam tersi durumda taşmanın hala mümkün olduğunu lütfen unutmayın (ancak bu durum daha az olağandır). Sorun tüm sunucu sürümlerinde mevcuttu. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Limit maksimum uyku süresi için kısma zaman `max_execution_speed` veya `max_execution_speed_bytes` ayar .lanmıştır. Gibi sabit yanlış hatalar `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kullanma ile ilgili sabit sorunlar `MATERIALIZED` sütunlar ve Takma adlar `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos Kuşu](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltmek `FormatFactory` işlemci olarak uygulanmayan giriş akışları için davranış. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Sabit yazım hatası. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) +- Hata iletisinde yazım hatası (is -\> are ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) +- Tür bir virgül içeriyorsa, sütun listesinin dizeden ayrıştırılması sırasında hata düzeltildi (bu sorun AŞAĞIDAKİLERLE ilgiliydi `File`, `URL`, `HDFS` depolamalar) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) + +#### Güvenlik Düzeltme {#security-fix} + +- Bu sürüm aynı zamanda 19.13 ve 19.11 tüm hata güvenlik düzeltmeleri içerir. +- SQL ayrıştırıcısında yığın taşması nedeniyle sunucu çökmesine neden olmak için fabrikasyon bir sorgu olasılığı düzeltildi. Birleştirme ve dağıtılmış tablolarda yığın taşması olasılığı, alt sorguları içeren satır düzeyinde güvenlik için somutlaştırılmış görünümler ve koşullar düzeltildi. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Geliştirme {#improvement-3} + +- İçin üçlü mantığın doğru uygulanması `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) +- Şimdi değerler ve süresi dolmuş TTL ile satırlar sonra kaldırılacak `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` sorgu. Eklenen sorgular `SYSTEM STOP/START TTL MERGES` izin vermek/izin vermek için tüm birleştirmelerde TTL ve filtre süresi dolmuş değerleri ile birleşmeleri atayın. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) +- Imkanı kullanarak istemci için ClickHouse geçmiş dosyasının konumunu değiştirmek için `CLICKHOUSE_HISTORY_FILE` en .v. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) +- Kaldırmak `dry_run` ’dan bayrak `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Destek `ASOF JOIN` ile `ON` bölme. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) +- Mutasyonlar ve çoğaltma için Atlama dizinlerinin daha iyi desteği. İçin destek `MATERIALIZE/CLEAR INDEX ... IN PARTITION` sorgu. `UPDATE x = x` sütun kullanan tüm indeksleri yeniden hesaplar `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) +- İzin ver `ATTACH` canlı görünümler (örneğin, sunucu başlangıçta) ne olursa olsun `allow_experimental_live_view` ayar. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sorgu profiler tarafından toplanan yığın izlemeleri için sorgu profiler kendisi tarafından oluşturulan yığın çerçeveleri içermez. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi tablo fonksiyonları `values`, `file`, `url`, `hdfs` ALİAS sütunları için destek var. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eğer bir istisna atmak `config.d` dosya, yapılandırma dosyası olarak ilgili kök öğeye sahip değildir. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) +- İçin özel durum iletisinde ekstra bilgi Yazdır `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) +- Bir kırıkları belirlerken `Distributed` bir okuma sorgusu tarafından kapsanacak tablo (için `optimize_skip_unused_shards` = 1) ClickHouse şimdi her ikisinden de koşulları kontrol eder `prewhere` ve `where` select deyimi yan tümceleri. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) +- Etkin `SIMDJSON` avx2 olmayan ancak sse 4.2 ve PCLMUL komut seti ile makineler için. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse olmadan dosya sistemleri üzerinde çalışabilir `O_DIRECT` ek ayar yapmadan destek (ZFS ve BtrFS gibi). [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Destek son alt sorgu için yüklemi aşağı itin. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İyileştirmek `JOIN ON` anahtarlar çıkarma [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) +- Güncel `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin en küçük sütunun seçilmesini Optimize edin `SELECT count()` sorgu. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos Kuşu](https://github.com/amosbird)) +- Katma `strict` param parametereter in `windowFunnel()`. Ne zaman `strict` ayarlanırsa, `windowFunnel()` yalnızca benzersiz değerler için koşulları uygular. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) +- Daha güvenli arayüzü `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) +- Seçenekler satır boyutu ile yürütülürken `--help` seçenek şimdi terminal boyutuna karşılık gelir. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) +- Sakatlamak “read in order” anahtarsız toplama için optimizasyon. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) +- İçin HTTP durum kodu `INCORRECT_DATA` ve `TYPE_MISMATCH` hata kodları varsayılan olarak değiştirildi `500 Internal Server Error` -e doğru `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) +- Birleştirme nesnesini taşı `ExpressionAction` için `AnalyzedJoin`. `ExpressionAnalyzer` ve `ExpressionAction` hakkında bilmiyorum `Join` sınıf artık. Mantığı giz bylidir `AnalyzedJoin` ifface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) +- Kırıklardan biri localhost olduğunda ancak sorgu ağ bağlantısı üzerinden gönderildiğinde dağıtılmış sorguların Olası kilitlenmesi düzeltildi. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Birden çok tablonun semantik değişti `RENAME` Olası kilitlenmeleri önlemek için. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bellekte tam paket yükü yüklenmesini önlemek için yeniden yazılan MySQL uyumluluk sunucusu. Her bağlantı için bellek tüketiminin yaklaşık olarak azalması `2 * DBMS_DEFAULT_BUFFER_SIZE` (okuma / yazma tamponları). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) +- Sorgu semantiği hakkında hiçbir şey bilmek zorunda olmayan ayrıştırıcıdan AST alias yorumlama mantığını taşıyın. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) +- Biraz daha güvenli ayrıştırma `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-copier`: Kullanımına izin ver `where_condition` config ile `partition_key` bölüm varlığını kontrol etmek için sorgudaki diğer ad (daha önce yalnızca veri sorgularını okumada kullanıldı). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) +- İsteğe bağlı mesaj argümanı eklendi `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) +- Ekleme verilerini gönderirken sunucu istisnası şimdi istemcide de işleniyor. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) +- Bir metrik eklendi `DistributedFilesToInsert` bu, dağıtılmış tablolarla uzak sunuculara göndermek için seçilen dosya sistemindeki toplam dosya sayısını gösterir. Sayı tüm parçalar arasında toplanır. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Birleş ofimlerin çoğunu taşı `ExpressionAction/ExpressionAnalyzer` -e doğru `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) +- Tsan’ı Düzeltin [uyarıcı](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) +- Linux yetenekleri eksikliği hakkında daha iyi bilgi mesajları. İle önemli hataları günlüğe kaydetme “fatal” seviye, bu daha kolay bulmak için yapacak `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sırasında bellek kullanımını kısıtlamak için diske geçici veri damping etkinleştirdiğinizde `GROUP BY`, `ORDER BY`, boş disk alanını kontrol etmedi. Düzeltme yeni bir ayar Ekle `min_free_disk_space`, boş disk alanı daha küçük olduğunda eşik, sorgu durur ve atar `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İş parçacığı tarafından özyinelemeli rwlock kaldırıldı. Hiçbir anlam ifade etmiyor, çünkü iş parçacıkları sorgular arasında yeniden kullanılıyor. `SELECT` sorgu bir iş parçacığında bir kilit edinebilir, başka bir iş parçacığından bir kilit tutabilir ve ilk iş parçacığından çıkabilir. Aynı zamanda, ilk iş parçacığı tarafından yeniden kullanılabilir `DROP` sorgu. Bu yanlış yol açacaktır “Attempt to acquire exclusive lock recursively” iletiler. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bölme `ExpressionAnalyzer.appendJoin()`. Bir yer hazırlayın `ExpressionAnalyzer` için `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) +- Katma `mysql_native_password` MySQL uyumluluk sunucusuna kimlik doğrulama eklentisi. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) +- Daha az sayıda `clock_gettime` aramalar; hata ayıklama / sürüm arasındaki sabit ABİ uyumluluğu `Allocator` (önemsiz konu). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Taşınmak `collectUsedColumns` itibaren `ExpressionAnalyzer` -e doğru `SyntaxAnalyzer`. `SyntaxAnalyzer` yapıyor `required_source_columns` şimdi kendisi. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) +- Ayar Ekle `joined_subquery_requires_alias` alt seçimler ve tablo işlevleri için takma adlar istemek için `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) +- Ayıklamak `GetAggregatesVisitor` sınıf fromından `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) +- `system.query_log`: veri türünü değiştir `type` sütun için `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Statik bağlama `sha256_password` kimlik doğrulama eklentisi. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) +- Ayar için ekstra bağımlılıktan kaçının `compile` çalışmak. Önceki sürümlerde, kullanıcı gibi hata alabilirsiniz `cannot open crti.o`, `unable to find library -lc` vb. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kötü amaçlı kopyadan gelebilecek girdinin daha fazla doğrulaması. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi `clickhouse-obfuscator` dosya mevcuttur `clickhouse-client` paket. Önceki sürümlerde şu şekilde mevcuttu `clickhouse obfuscator` (boşluk ile). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) +- Farklı sırayla en az iki tablo ve tablolardan birinde DDL işlemi gerçekleştiren başka bir sorgu okumak en az iki sorgu olduğunda sabit kilitlenme. Başka bir çok nadir kilitlenme düzeltildi. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Katma `os_thread_ids` sütun için `system.processes` ve `system.query_log` daha iyi hata ayıklama olanakları için. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- PHP mysqlnd uzantısı hataları için bir geçici çözüm `sha256_password` varsayılan kimlik doğrulama eklentisi olarak kullanılır ( [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) +- Değiştirilen nullability sütunlarıyla gereksiz yeri kaldırın. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) +- Set default value of `queue_max_wait_ms` sıfıra, çünkü mevcut değer (beş saniye) hiçbir anlam ifade etmiyor. Bu ayarların herhangi bir kullanımı olduğunda nadir durumlar vardır. Eklenen ayarlar `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` ve `connection_pool_max_wait_ms` anlam ayrımı için. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ayıklamak `SelectQueryExpressionAnalyzer` itibaren `ExpressionAnalyzer`. Seçilmemiş sorgular için sonuncusu tutun. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) +- Giriş ve çıkış formatlarını çoğaltarak kaldırıldı. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Kullanıcının geçersiz kılmasına izin ver `poll_interval` ve `idle_connection_timeout` bağlantı ayarları. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `MergeTree` şimdi ek bir seçenek var `ttl_only_drop_parts` (varsayılan olarak devre dışı) parçaların kısmi budamasını önlemek için, böylece bir parçadaki tüm satırların süresi dolduğunda tamamen düştüler. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) +- Tür set dizin işlevleri için denetler. Fonksiyon yanlış bir türe sahipse istisna atın. Bu UBSan ile fuzz testini düzeltir. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Performans İyileştirme {#performance-improvement-2} + +- İle Optimize sorguları `ORDER BY expressions` fık ,ra, nerede `expressions` sıralama anahtarı ile çakışan önek var `MergeTree` Tablolar. Bu optimizasyon tarafından kontrol edilir `optimize_read_in_order` ayar. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) +- Parça yükleme ve çıkarma sırasında birden fazla diş kullanmasına izin verin. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Toplu işlev durumlarının güncellenmesi için uygulanan toplu varyant. Performans avantaj .larına yol açabilir. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kullanım `FastOps` fonksiyonlar için kütüphane `exp`, `log`, `sigmoid`, `tanh`. FastOps Michael Parakhin (Yandex CTO) bir hızlı vektör matematik kütüphanesidir. Geliştirilmiş performans `exp` ve `log` fonksiyonları fazla 6 kez. İşlev `exp` ve `log` itibaren `Float32` argüman geri dönecek `Float32` (önceki sürümlerde her zaman geri dönerler `Float64`). Şimdi `exp(nan)` dön mayebilir `inf`. Sonucu `exp` ve `log` fonksiyonlar, gerçek cevaba en yakın makine temsil edilebilir numarası olmayabilir. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) Fastops çalışmasını sağlamak için Danila Kutenin varyantını kullanma [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ardışık anahtar optimizasyonunu devre dışı bırak `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) +- Geliştirilmiş performans `simdjson` içinde dinamik tahs ofis ridat ridtan Kurtul ofarak kütüphane `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) +- Bellek ayırırken ön hata sayfaları `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) +- Performans hatasını düzeltin `Decimal` karşılaştırma. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-4} + +- Derleyici (çalışma zamanı şablonu örneği) kaldırın, çünkü performansı kazandık. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Gcc-9’daki performansın daha izole bir şekilde bozulmasını göstermek için performans testi eklendi. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eklenen tablo fonksiyonu `numbers_mt`, çok iş parçacıklı sürümü olan `numbers`. Karma fonksiyonları ile güncellenmiş performans testleri. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Karşılaştırma modu `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) +- Yığın izlerini yazdırmak için en iyi çaba. Ayrıca eklendi `SIGPROF` çalışan bir iş parçacığının yığın izini yazdırmak için hata ayıklama sinyali olarak. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Her fonksiyon kendi dosyasında, Bölüm 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İki katına çıkar const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) +- İçin biçimlendirme değişiklikleri `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) +- Birleştirme oluşturma için daha iyi alt sorgu `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) +- Gereksiz bir koşulu kaldırın (PVS Studio tarafından bulunur). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) +- İçin karma tablo arayüzünü ayırın `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) +- Ayarların yeniden düzenlenmesi. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) +- İçin yorum ekle `set` dizin fonksiyonları. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) +- Linux’ta hata ayıklama sürümünde oom puanını artırın. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) +- HDFS ha şimdi hata ayıklama yapısında çalışıyor. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) +- Bir test eklendi `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kafka tablosu için birden fazla somutlaştırılmış görünüm için test ekleyin. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([I ivanvan](https://github.com/abyss7)) +- Daha iyi bir yapı şeması yapın. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([I ivanvan](https://github.com/abyss7)) +- Sabit `test_external_dictionaries` kök olmayan kullanıcı altında çalıştırılması durumunda entegrasyon. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Yazılı paketlerin toplam boyutu aştığında hata çoğalır `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) +- İçin bir test eklendi `RENAME` tablo yarış durumu [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ayarlarda veri yarışından kaçının `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bir önbellek sözlüğü ile hataları işlemek için entegrasyon testi ekleyin. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) +- Mac OS’de elf nesne dosyalarının ayrıştırılmasını devre dışı bırakın, çünkü mantıklı değil. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Changelog jeneratörünü daha iyi hale getirmeye çalışın. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ekleme `-Wshadow` GCC’YE geçin. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- İçin eski kod kaldırıldı `mimalloc` destek. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `zlib-ng` x86 yeteneklerini belirler ve bu bilgiyi genel değişkenlere kaydeder. Bu, aynı anda farklı iş parçacıkları tarafından yapılabilen defalteınit çağrısında yapılır. Çok iş parçacıklı yazılardan kaçınmak için, kitaplık başlangıcında yapın. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) +- İçinde gider wasilen bir hata için regresyon testi [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) +- Sabit MSan raporu. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltme çırparak TTL testi. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) +- Sabit yanlış veri yarışı `MergeTreeDataPart::is_frozen` alan. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fuzz testinde sabit zaman aşımları. Önceki sürümde, sorguda yanlış hangup bulmayı başardı `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hata ayıklama kontrolleri eklendi `static_cast` sütunların. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Resmi RPM paketlerinde Oracle Linux için destek. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Değiştirilen json perftests `once` -e doğru `loop` tür. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `odbc-bridge.cpp` tanımlıyor `main()` bu yüzden dahil edilmemelidir `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) +- Çarpışma testi `FULL|RIGHT JOIN` sağ tablonun tuşlarında boş alanlar var. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) +- Her ihtimale karşı takma adların genişletilmesiyle ilgili sınır için bir test eklendi. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Anahtar fromlı `boost::filesystem` -e doğru `std::filesystem` uygun olan yerlerde. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Web sitesine RPM paketleri eklendi. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit için bir test Ekle `Unknown identifier` istisna içinde `IN` bölme. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) +- Basitleştirmek `shared_ptr_helper` çünkü insanlar bunu anlamakta zorluk çekiyorlar. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit Gorilla ve DoubleDelta codec için performans testleri eklendi. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) +- Entegrasyon testini bölün `test_dictionaries` 4 ayrı test içine. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) +- Pvs-Studio uyarısını düzeltin `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Kullanmasına izin ver `library` asan ile sözlük kaynağı. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- PRs listesinden changelog oluşturmak için seçenek eklendi. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Lock the `TinyLog` depolama okurken. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) +- CI kırık symlinks için kontrol edin. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin zaman aşımını artırın “stack overflow” hata ayıklama yapı uzun zaman alabilir, çünkü sınayın. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Çift whitespaces için bir çek eklendi. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltmek `new/delete` bellek izleme zaman sanitizers ile inşa. İzleme net değil. Sadece testlerde bellek sınırı istisnalarını önler. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) +- Bağlantı sırasında tanımlanmamış sembollerin kontrolünü geri etkinleştirin. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([I ivanvan](https://github.com/abyss7)) +- Yeniden inşa etmekten kaçının `hyperscan` hergün. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit UBSan raporu `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Uyumlu olmadığı için sanitizers ile sorgu profiler kullanmak için izin vermeyin. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Zamanlayıcı tarafından başarısız olduktan sonra bir sözlüğü yeniden yüklemek için test ekleyin. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) +- Tutarsızlığı düzeltin `PipelineExecutor::prepareProcessor` argüman türü. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Kötü Urı’ler için bir test eklendi. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Daha fazla kontrol eklendi `CAST` işlev. Bu, bulanık testte segmentasyon hatası hakkında daha fazla bilgi almalıdır. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Katma `gcc-9` güçlendirmek `docker/builder` yerel olarak görüntü oluşturan konteyner. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Birincil anahtar için Test `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) +- Yavaş yığın izleri yazdırma etkilenen sabit testler. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kilitlenme için bir test durumu ekleyin `groupUniqArray` sabit içinde [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) +- Sabit endeks mutasyonlar testleri. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) +- Performans testinde, çalıştırmadığımız sorgular için sorgu günlüğünü okuma. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) +- Materialized görünüm şimdi şüpheli düşük kardinalite türleri hakkında ayar ne olursa olsun herhangi bir düşük kardinalite türleri ile oluşturulabilir. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) +- İçin güncel testslenmiş testler `send_logs_level` ayar. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Gcc-8.2 altında yapı düzeltin. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) +- Dahili libc++ile yapı düzeltin. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([I ivanvan](https://github.com/abyss7)) +- Paylaşılan yapıyı düzeltin `rdkafka` kitaplık [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([I ivanvan](https://github.com/abyss7)) +- Mac OS build için düzeltmeler (eksik). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) +- Düzeltmek “splitted” yapmak. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Diğer yapı düzeltmeleri: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos Kuşu](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([I ivanvan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-3} + +- Kaldırıldı nadiren kullanılan tablo fonksiyonu `catBoostPool` ve depolama `CatBoostPool`. Bu tablo işlevini kullandıysanız, lütfen e-posta yazınız `clickhouse-feedback@yandex-team.com`. CatBoost entegrasyonunun devam ettiğini ve destekleneceğini unutmayın. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sakatlamak `ANY RIGHT JOIN` ve `ANY FULL JOIN` varsayılan olarak. Koymak `any_join_distinct_right_table_keys` bunları etkinleştirmek için ayarlama. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) + +## ClickHouse sürümü 19.13 {#clickhouse-release-19-13} + +### ClickHouse sürümü 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} + +#### Hata Düzeltme {#bug-fix-9} + +- Bu sürüm aynı zamanda 19.11.12.69 tüm hata düzeltmeleri içerir. + +### ClickHouse sürümü 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} + +#### Hata Düzeltme {#bug-fix-10} + +- Bu sürüm aynı zamanda 19.14.6.12 tüm hata düzeltmeleri içerir. +- Yürütülürken tablonun Olası tutarsız durumu düzeltildi `DROP` zookeeper erişilebilir değilken çoğaltılmış tablo için sorgu. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Storagemerge’de veri yarışı için düzeltme [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Soketten sonsuz recv yol açar sorgu profiler tanıtılan Fix hata. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) +- Çalışırken aşırı CPU kullanımını düzeltin `JSONExtractRaw` bir Boole değeri üzerinde işlev. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) +- Gerçekleşmiş görünüme iterken gerilemeyi düzeltir. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([I ivanvan](https://github.com/abyss7)) +- Tablo fonksiyonu `url` güvenlik açığı saldırganın istekte rasgele HTTP üstbilgileri enjekte etmesine izin vermişti. Bu konu tarafından bulundu [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İşe yaramaz düzeltmek `AST` set dizini kontrol edin. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) +- Sabit ayrıştırma `AggregateFunction` sorguya gömülü değerler. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) +- Sabit yanlış davranış `trim` fonksiyonlar aile. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} + +#### Hata Düzeltme {#bug-fix-11} + +- Bu sürüm aynı zamanda 19.11.9.52 ve 19.11.10.54 tüm hata güvenlik düzeltmeleri içerir. +- Sabit veri yarışı `system.parts` masa ve `ALTER` sorgu. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Akışlarda sabit eşleşmeyen başlık, örnek ve prewhere ile boş dağıtılmış tablodan okuma durumunda oldu. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Kullanırken sabit çökme `IN` bir tuple ile bir alt sorgu ile yan tümce. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Aynı sütun adlarıyla durumu düzeltin `GLOBAL JOIN ON` bölme. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) +- Türleri döküm yaparken çökmeyi düzeltin `Decimal` bu onu desteklemiyor. Bunun yerine istisna atın. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) +- Sabit çökme `extractAll()` işlev. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) +- İçin sorgu dönüşümü `MySQL`, `ODBC`, `JDBC` tablo işlevleri artık düzgün çalışıyor `SELECT WHERE` birden fazla sorgu `AND` ifadeler. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) +- MySQL 8 entegrasyonu için önceki beyan kontrolleri eklendi. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) + +#### Güvenlik Düzeltme {#security-fix-1} + +- Dekompresyon aşamasında kodeklerdeki iki güvenlik açığını düzeltin (kötü niyetli kullanıcı, dekompresyonda tampon taşmasına yol açacak sıkıştırılmış verileri üretebilir). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouse sürümü 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} + +#### Hata Düzeltme {#bug-fix-12} + +- Düzeltmek `ALTER TABLE ... UPDATE` ile tablolar için sorgu `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Bir tuple ile bir alt sorgu ile yan tümcesinde kullanırken npe düzeltin. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Eski bir kopya canlı hale gelirse, yine de açılan bölüm tarafından kaldırılan veri parçalarına sahip olabileceği sorunu düzeltildi. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- CSV ayrıştırma ile ilgili sorun giderildi [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- Sistemde sabit veri yarışı.parçalar tablo ve alter sorgu. Bu düzeltmeler [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bellek bozulmasına yol açabilecek mutasyonlarda yanlış kod düzeltildi. Adresin okunması ile sabit segfault `0x14c0` bu eşzamanlı nedeniyle happed olabilir `DROP TABLE` ve `SELECT` itibaren `system.parts` veya `system.parts_columns`. Mutasyon sorgularının hazırlanmasında sabit yarış durumu. Sabit kilitlenme neden `OPTIMIZE` çoğaltılmış tablolar ve değiştirir gibi eşzamanlı değişiklik işlemleri. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sonra sabit olası veri kaybı `ALTER DELETE` tabloda dizin atlama ile sorgu. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Güvenlik Düzeltme {#security-fix-2} + +- Saldırganın Zookeeper’a yazma erişimi varsa ve Clickhouse’un çalıştığı ağdan kullanılabilen özel sunucuyu çalıştırabiliyorsa, ClickHouse replica olarak hareket edecek ve Zookeeper’a kaydedecek özel olarak oluşturulmuş kötü amaçlı sunucu oluşturabilir. Başka bir çoğaltma, kötü amaçlı kopyadan veri bölümünü getirdiğinde, clickhouse-Server’ı dosya sistemindeki keyfi yola yazmaya zorlayabilir. Yandex’teki bilgi güvenliği ekibi Eldar Zaitov tarafından bulundu. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} + +#### Yenilik {#new-feature-5} + +- Sorgu düzeyinde örnekleme profiler. [Örnek](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) +- Sütunların bir listesini belirtmek için izin ver `COLUMNS('regexp')` daha sofistike bir varyantı gibi çalışan ifade `*` Yıldız işareti. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CREATE TABLE AS table_function()` artık mümkün [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) +- Stokastik Gradyan iniş için Adam optimizer varsayılan olarak kullanılır `stochasticLinearRegression()` ve `stochasticLogisticRegression()` agrega fonksiyonları, çünkü neredeyse herhangi bir ayar yapmadan iyi kalite gösterir. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) +- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Andy Yang](https://github.com/andyyzh)) +- `RENAME` sorgular artık tüm depolarla çalışır. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([I ivanvan](https://github.com/abyss7)) +- Şimdi istemci ayarlayarak istenilen düzeyde sunucudan günlükleri almak `send_logs_level` sunucu ayarlarında belirtilen günlük düzeyine bakılmaksızın. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-4} + +- Ayar `input_format_defaults_for_omitted_fields` varsayılan olarak etkinleştirilir. Dağıtılmış tablolardaki ekler bu ayarın kümede aynı olması gerekir (güncellemeyi çalıştırmadan önce ayarlamanız gerekir). Atlanmış alanlar için karmaşık varsayılan ifadelerin hesaplanmasını sağlar `JSONEachRow` ve `CSV*` biçimliler. Beklenen davranış olmalı, ancak ihmal edilebilir performans farkına yol açabilir. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) + +#### Deneysel özellikler {#experimental-features} + +- Yeni sorgu işleme boru hattı. Kullanmak `experimental_use_processors=1` etkinleştirmek için Seçenek. Kendi sorun için kullanın. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Hata Düzeltme {#bug-fix-13} + +- Kafka entegrasyonu bu sürümde düzeltildi. +- Sabit `DoubleDelta` kodlama `Int64` büyük için `DoubleDelta` değerler, geliştirilmiş `DoubleDelta` rastgele veri için kodlama `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) +- Sabit aşırı tahmin `max_rows_to_read` eğer ayar `merge_tree_uniform_read_distribution` 0 olarak ayarlanır. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Geliştirme {#improvement-4} + +- Eğer bir istisna atar `config.d` dosya, yapılandırma dosyası olarak ilgili kök öğeye sahip değil [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) + +#### Performans İyileştirme {#performance-improvement-3} + +- Getirmek `count()`. Şimdi en küçük sütunu kullanır (mümkünse). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos Kuşu](https://github.com/amosbird)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-5} + +- Performans testlerinde bellek kullanımını bildirin. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) +- Harici yapı ile Düzeltme `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([I ivanvan](https://github.com/abyss7)) +- Paylaşılan yapıyı düzeltin `rdkafka` kitaplık [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([I ivanvan](https://github.com/abyss7)) + +## ClickHouse yayın 19.11 {#clickhouse-release-19-11} + +### ClickHouse sürümü 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} + +#### Hata Düzeltme {#bug-fix-14} + +- Sabit nadir kazasında `ALTER MODIFY COLUMN` ve birleştirilmiş/değiştirilmiş parçalardan biri boş olduğunda dikey birleştirme (0 satır). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) +- Manuel güncelleme `SIMDJSON`. Bu sahte json teşhis mesajları ile stderr dosyalarının Olası sel giderir. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) +- Sabit hata ile `mrk` Mut fileasyonlar için dosya uzantısı ([alesapin](https://github.com/alesapin)) + +### ClickHouse yayın 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} + +#### Hata Düzeltme {#bug-fix-15} + +- Büyük tablolarda karmaşık anahtarlar üzerinde endeks analizi sabit performans düşüşü. Bu düzeltmeler [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Dağıtılmış motorlu tablolarda veri gönderirken nadir SIGSEGV’DEN kaçının (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) +- Düzeltmek `Unknown identifier` birden fazla birleşim ile. Bu düzeltmeler [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouse sürümü 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} + +- Kafka boş konudan seçerken segfaults’a neden olan mantıksal hatayı düzeltin. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([I ivanvan](https://github.com/abyss7)) +- Fonksiyon için düzeltme `АrrayEnumerateUniqRanked` params boş diziler ile. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) + +### ClickHouse sürümü 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} + +#### Hata Düzeltme {#bug-fix-16} + +- Tüm bölümler için hepsini bir kerede işlemek için Kafka mesajları için uzaklıkları manuel olarak saklayın. Potansiyel çoğaltmayı giderir “one consumer - many partitions” senaryo. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([I ivanvan](https://github.com/abyss7)) + +### ClickHouse yayın 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} + +- Önbellek sözlüklerde hata işleme geliştirin. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) +- Fonksiyonu Sabit hata `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) +- Düzeltmek `JSONExtract` bir ayıklarken işlev `Tuple` JSON dan. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) +- Sonra sabit olası veri kaybı `ALTER DELETE` tabloda dizin atlama ile sorgu. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) +- Sabit performans testi. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Parke: Boolean sütunlarını okumayı düzeltin. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit yanlış davranış `nullIf` sabit argümanlar için işlev. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Normal sunucu yeniden başlatmada Kafka mesajları çoğaltma sorununu düzeltin. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([I ivanvan](https://github.com/abyss7)) +- Uzun zaman bir sorun düzeltildi `ALTER UPDATE` veya `ALTER DELETE` düzenli birleştirmelerin çalışmasını engelleyebilir. Yeterli boş iş parçacığı yoksa mutasyonların yürütülmesini önleyin. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) +- İşleme ile Sabit hata “timezone” sunucu yapılandırma dosyasında. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kafka testlerini düzeltin. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([I ivanvan](https://github.com/abyss7)) + +#### Güvenlik Düzeltme {#security-fix-3} + +- Saldırganın Zookeeper’a yazma erişimi varsa ve Clickhouse’un çalıştığı ağdan kullanılabilen özel sunucuyu çalıştırabiliyorsa, ClickHouse replica olarak hareket edecek ve Zookeeper’a kaydedecek özel olarak oluşturulmuş kötü amaçlı sunucu oluşturabilir. Başka bir çoğaltma, kötü amaçlı kopyadan veri bölümünü getirdiğinde, clickhouse-Server’ı dosya sistemindeki keyfi yola yazmaya zorlayabilir. Yandex’teki bilgi güvenliği ekibi Eldar Zaitov tarafından bulundu. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} + +#### Hata Düzeltme {#bug-fix-17} + +- Düzeltmek `ALTER TABLE ... UPDATE` ile tablolar için sorgu `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) +- Bir tuple ile bir alt sorgu ile yan tümcesinde kullanırken npe düzeltin. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- Eski bir kopya canlı hale gelirse, yine de açılan bölüm tarafından kaldırılan veri parçalarına sahip olabileceği sorunu düzeltildi. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- CSV ayrıştırma ile ilgili sorun giderildi [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- Sistemde sabit veri yarışı.parçalar tablo ve alter sorgu. Bu düzeltmeler [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bellek bozulmasına yol açabilecek mutasyonlarda yanlış kod düzeltildi. Adresin okunması ile sabit segfault `0x14c0` bu eşzamanlı nedeniyle happed olabilir `DROP TABLE` ve `SELECT` itibaren `system.parts` veya `system.parts_columns`. Mutasyon sorgularının hazırlanmasında sabit yarış durumu. Sabit kilitlenme neden `OPTIMIZE` çoğaltılmış tablolar ve değiştirir gibi eşzamanlı değişiklik işlemleri. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} + +#### Hata düzeltme {#bug-fix-18} + +- Kafka entegrasyonu bu sürümde düzeltildi. +- Kullanırken segfault’u düzeltin `arrayReduce` sürekli argümanlar için. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit `toFloat()` Monotonluk. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- Etkin olan segfault’u düzeltin `optimize_skip_unused_shards` ve kayıp sharding anahtarı. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) +- Sabit mantık `arrayEnumerateUniqRanked` işlev. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MySQL işleyicisinden ekstra ayrıntılı günlük kaydı kaldırıldı. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yanlış davranışı ve olası segfault’ları düzeltin `topK` ve `topKWeighted` toplu fonksiyonlar. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) +- Sanal sütunları göstermeyin `system.columns` Tablo. Bu geriye dönük uyumluluk için gereklidir. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Karmaşık anahtar önbellek sözlüğünde dize alanları için bellek tahsisi ile hatayı düzeltin. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) +- İçin yeni bir çoğaltma oluştururken uyarlamalı ayrıntıyı etkinleştirerek hatayı düzeltin `Replicated*MergeTree` Tablo. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) +- Kafka mesajlarını okurken sonsuz döngüyü düzeltin. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) +- SQL ayrıştırıcısında yığın taşması ve yığın taşması olasılığı nedeniyle sunucu çökmesine neden olmak için fabrikasyon bir sorgu olasılığı düzeltildi `Merge` ve `Distributed` Tablolar [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Küçük dizilerde sabit goril kodlama hatası. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) + +#### Geliştirme {#improvement-5} + +- Kullanıcının geçersiz kılmasına izin ver `poll_interval` ve `idle_connection_timeout` bağlantı ayarları. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} + +#### Hata düzeltme {#bug-fix-19} + +- Sunucu aşırı yüklendiğinde sorguları asılı olasılığı düzeltildi. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- YANDEXCONSİSTENTHASH işlevinde FPE’Yİ düzeltin. Bu düzeltmeler [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Dönüşüm Sabit hata `LowCardinality` yazmak `AggregateFunctionFactory`. Bu düzeltmeler [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ayrıştırmayı düzeltin `bool` ayarlar `true` ve `false` yapılandırma dosyalarındaki dizeler. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) +- Sorgularda uyumsuz akış başlıklarıyla nadir hatayı düzeltin `Distributed` masa üstü `MergeTree` tablo parça `WHERE` MOV toes to `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) +- İmzalı türün imzasız türe tamsayı bölümünde sabit taşma. Bu düzeltmeler [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-5} + +- `Kafka` hala kırık. + +### ClickHouse sürümü 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} + +#### Hata Düzeltme {#bug-fix-20} + +- Adaptif tanecikli ikincil endeksler işaretleri yazma ile hatayı düzeltin. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) +- Düzeltmek `WITH ROLLUP` ve `WITH CUBE` değiştiriciler `GROUP BY` iki seviyeli toplama ile. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) +- Sabit asmak `JSONExtractRaw` işlev. Sabit [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ExternalLoader::reloadOutdated () içinde segfault Fix. [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) +- Sunucu dinleme soketlerini kapatabilir, ancak kapanmaz ve kalan sorguları sunmaya devam edebilir. İki çalışan clickhouse-server süreçleri ile sona erebilir. Bazen, sunucu bir hata döndürebilir `bad_function_call` kalan sorgular için. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ODBC, MySQL, ClickHouse ve HTTP üzerinden harici sözlüklerin ilk yüklenmesi için güncelleme alanında işe yaramaz ve yanlış durum düzeltildi. Bu düzeltmeler [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Döküm sabit alakasız istisna `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Deterministik olmayan sonucu düzeltin “uniq” aşırı nadir durumlarda toplama fonksiyonu. Hata tüm ClickHouse sürümlerinde mevcuttu. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Segfault biz fonksiyonu üzerinde biraz fazla yüksek CIDR ayarladığınızda `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Sunucu birçok farklı bağlamdan birçok istisna attığında sabit küçük bellek sızıntısı. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tüketici abonelikten önce duraklatıldığında ve daha sonra devam etmediğinde durumu düzeltin. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([I ivanvan](https://github.com/abyss7)) Kafka’nın bu sürümde bozulduğunu unutmayın. +- Bir hatayla tamamlanan önceki okuma işleminden Kafka veri arabelleğini temizleme [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Kafka’nın bu sürümde bozulduğunu unutmayın. +- Beri `StorageMergeTree::background_task_handle` içinde Başlat isılmıştır `startup()` bu `MergeTreeBlockOutputStream::write()` başlatmadan önce kullanmayı deneyebilir. Eğer başlatıldı ise sadece kontrol. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([I ivanvan](https://github.com/abyss7)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-6} + +- Resmi eklendi `rpm` paketler. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) +- Oluşturmak için bir yetenek ekleyin `.rpm` ve `.tgz` paketleri ile `packager` komut. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) +- İçin düzeltmeler “Arcadia” sistemi oluşturmak. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-6} + +- `Kafka` bu sürümde bozuldu. + +### ClickHouse sürümü 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} + +#### Yenilik {#new-feature-6} + +- Hazırlanan ifadeler için destek eklendi. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([İskender](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `DoubleDelta` ve `Gorilla` sütun kodekleri [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) +- Katma `os_thread_priority` kontrol etmeyi sağlayan ayar “nice” dinamik zamanlama önceliğini ayarlamak için OS tarafından kullanılan sorgu işleme iş parçacıklarının değeri. Bu gerektirir `CAP_SYS_NICE` yetenekleri çalışmak. Bu uygular [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Uygulamak `_topic`, `_offset`, `_key` Kafka motoru için sütunlar [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([I ivanvan](https://github.com/abyss7)) Kafka’nın bu sürümde bozulduğunu unutmayın. +- Toplama fonksiyonu birleştirici Ekle `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) +- Toplama fonksiyonları `groupArrayMovingSum(win_size)(x)` ve `groupArrayMovingAvg(win_size)(x)`, pencere boyutu sınırlaması olan veya olmayan hareketli toplamı/AVG’yi hesaplar. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([ınv2004](https://github.com/inv2004)) +- Synonim Ekle `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) +- Intergate H3 fonksiyonu `geoToH3` Uber gelen. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Hata Düzeltme {#bug-fix-21} + +- Zaman uyumsuz güncelleştirme ile DNS önbelleğini uygulayın. Ayrı iş parçacığı tüm ana bilgisayarları çözer ve DNS önbelleğini nokta (ayar) ile günceller `dns_cache_update_period`). Ana bilgisayarların IP’si sık sık değiştiğinde yardımcı olmalıdır. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) +- Segfault’u düzeltin `Delta` 32 bit boyutundan daha küçük değerlere sahip sütunları etkileyen codec bileşeni. Hata rastgele bellek bozulmasına yol açtı. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- TTL fix segfault blok fiziksel olmayan sütunlarla birleştirme. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Parçanın kontrol edilmesinde nadir hatayı düzeltin `LowCardinality` sütun. Önceden `checkDataPart` her zaman ile parçası için başarısız `LowCardinality` sütun. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- Sunucu iş parçacığı havuzu dolduğunda bağlantıları asılı kaçının. Bağlantılar için önemlidir `remote` uzun bağlantı zaman aşımı olduğunda, tablo işlevi veya kopyaları olmayan bir parçaya bağlantılar. Bu düzeltmeler [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit argümanlar için destek `evalMLModel` işlev. Bu düzeltmeler [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse varsayılan saat dilimini belirlediğinde sorun giderildi `UCT` yerine `UTC`. Bu düzeltmeler [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit tampon underflow içinde `visitParamExtractRaw`. Bu düzeltmeler [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi dağıtılmış `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` sorgular doğrudan lider çoğaltma üzerinde yürütülür. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- Düzeltmek `coalesce` için `ColumnConst` ile `ColumnNullable` + ilgili değişiklikler. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) +- Fix the `ReadBufferFromKafkaConsumer` böylece sonra yeni mesajlar okumaya devam ediyor `commit()` daha önce durmuş olsa bile [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([I ivanvan](https://github.com/abyss7)) +- Düzeltmek `FULL` ve `RIGHT` Üzerinde katılırken sonuçları katılın `Nullable` sağ tablodaki tuşlar. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) +- Düşük öncelikli sorguların sonsuz uyku Olası düzeltme. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bazı sorguların query\_log’da görünmemesine neden olan Yarış durumunu düzeltin `SYSTEM FLUSH LOGS` sorgu. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Sabit `heap-use-after-free` Clustercopier’de asan uyarısı, zaten kaldırılmış fotokopi nesnesini kullanmaya çalışan saatin neden olduğu. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Sabit yanlış `StringRef` bazı uygulamalar tarafından döndürülen işaretçi `IColumn::deserializeAndInsertFromArena`. Bu hata sadece birim testlerini etkiledi. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Aynı ad sütunlarını maskeleme kaynak ve ara dizi birleştirme sütunlarını önleyin. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) +- Insert Fix ve MySQL stil tanımlayıcı Alıntı ile MySQL motoruna sorgu seçin. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([Kış Zhang](https://github.com/zhang2014)) +- Şimdi `CHECK TABLE` sorgu MergeTree engine ailesi ile çalışabilir. Her bir parça için (veya simplier motorları durumunda dosya) varsa kontrol durumunu ve mesajı döndürür. Ayrıca, kırık bir parçanın getirilmesinde hatayı düzeltin. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) +- Split\_shared\_libraries çalışma zamanını düzeltme [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) +- Sabit zaman dilimi başlatma `/etc/localtime` göreceli bir sembolik bağ gibi mi `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- clickhouse-fotokopi makinesi: kullanımı düzeltin-kapatmadan sonra ücretsiz [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) +- Güncel `simdjson`. Sıfır bayt ile bazı geçersiz JSONs başarıyla ayrıştırmak sorunu düzeltildi. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sistem günlüklerinin kapatılmasını düzeltin [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) +- Invalidate\_query’deki koşul bir sözlüğe bağlı olduğunda askıda kalmayı düzeltin. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Geliştirme {#improvement-6} + +- Küme yapılandırmasında çözümlenemeyen adreslere izin ver. Onlar kullanılamaz kabul ve her bağlantı girişimi çözmek için çalışılacaktır. Bu özellikle Kubernetes için yararlıdır. Bu düzeltmeler [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Boş TCP bağlantılarını kapatın (varsayılan olarak bir saat zaman aşımı ile). Bu, her sunucuda birden çok dağıtılmış tablo bulunan büyük kümeler için özellikle önemlidir, çünkü her sunucu bir bağlantı havuzunu diğer her sunucuya saklayabilir ve en yüksek sorgu eşzamanlılığından sonra bağlantılar duracaktır. Bu düzeltmeler [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Daha kaliteli `topK` işlev. Yeni öğenin daha büyük bir ağırlığı varsa, son öğeyi kaldırmak için SavingSpace set davranışını değiştirdi. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Etki alanlarıyla çalışmak için URL işlevleri artık şema olmadan tamamlanmamış URL’ler için çalışabilir [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) +- Checksums eklendi `system.parts_columns` Tablo. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Katma `Enum` veri türü için bir synonim olarak `Enum8` veya `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) +- Tam bit transpose varyantı için `T64` codec. İle daha iyi sıkıştırma yol açabilir `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) +- Cond conditionition on `startsWith` fonksiyon şimdi birincil anahtar kullanır. Bu düzeltmeler [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) ve [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) +- Kullanmasına izin ver `clickhouse-copier` boş veritabanı adı izin vererek çapraz çoğaltma küme topolojisi ile. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) +- Kullanmak `UTC` olmadan bir sistemde varsayılan zaman dilimi olarak `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` yazdırıldı ve sunucu veya istemci başlatmayı reddetti. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fonksiyonda kayan nokta argümanı için geri destek döndü `quantileTiming` geriye dönük uyumluluk için. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hata iletilerinde hangi tablonun eksik olduğunu göster. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([I ivanvan](https://github.com/abyss7)) +- Çeşitli kullanıcılar tarafından aynı query\_id ile sorgu çalıştırmasına izin verme [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) +- Grafite metrikleri göndermek için daha sağlam kod. Uzun çoklu sırasında bile çalışacaktır `RENAME TABLE` işleyiş. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ThreadPool yürütme için bir görev zamanlayamıyor, daha bilgilendirici hata iletileri görüntülenir. Bu düzeltmeler [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ngramsearch’i daha sezgisel olarak tersine çevirmek [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) +- HDFS engine builder’da kullanıcı ayrıştırma Ekle [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) +- Güncelleme varsayılan değeri `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) +- Eski ayarlar kavramı eklendi. Eski ayar `allow_experimental_low_cardinality_type` hiçbir etkisi ile kullanılabilir. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) + +#### Performans İyileştirme {#performance-improvement-4} + +- İş parçacıklarının daha düzgün dağılımı için birleştirme tablosundan seçilecek akış sayısını artırın. Ayar eklendi `max_streams_multiplier_for_merge_tables`. Bu düzeltmeler [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-7} + +- Clickhouse’un farklı sürümleriyle istemci-sunucu etkileşimi için geriye dönük uyumluluk testi ekleyin. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) +- Her taahhüt ve çekme isteğinde Test kapsamı bilgileri. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) +- Özel ayırıcılarımızı desteklemek için adres dezenfektanı ile işbirliği yapın (`Arena` ve `ArenaWithFreeLists`) daha iyi hata ayıklama için “use-after-free” hatasızlar. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) +- Değiştirmek [Llvm libunwind uygulaması](https://github.com/llvm-mirror/libunwind) C++ özel durum işleme ve yığın izleri yazdırma için [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) +- \- Weverything’den iki uyarı daha ekleyin [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bellek dezenfektanı ile ClickHouse oluşturmak için izin verin. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit ubsan raporu hakkında `bitTest` fuzz testinde işlev. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Docker: kimlik doğrulaması gerektiren bir ClickHouse örneğini başlatmak için olasılık eklendi. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) +- Librdkafka’yı 1.1.0 sürümüne güncelleyin [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([I ivanvan](https://github.com/abyss7)) +- Entegrasyon testleri için genel zaman aşımı ekleyin ve test kodunda bazılarını devre dışı bırakın. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) +- Bazı iş parçacıklarını düzeltinnitizer arızaları. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) +- Bu `--no-undefined` seçenek, bağlayıcıyı, bağlantı sırasında varoluş için tüm dış adları denetlemeye zorlar. Bölünmüş yapı modunda kütüphaneler arasındaki gerçek bağımlılıkları izlemek çok yararlıdır. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([I ivanvan](https://github.com/abyss7)) +- İçin performans testi eklendi [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Gcc-7 ile sabit uyumluluk. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Gcc-9 için destek eklendi. Bu düzeltmeler [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Libunwind yanlış bağlanabilir Sabit hata. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- PVS-Studio tarafından bulunan birkaç uyarı düzeltildi. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin ilk destek eklendi `clang-tidy` statik analiz cihazı. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- BSD/Linux endian makrolarını dönüştürme( ‘be64toh’ ve ‘htobe64’) Mac OS X eşdeğentser thelerine [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fu Ch Chenen](https://github.com/fredchenbj)) +- Geliştirilmiş entegrasyon testleri kılavuzu. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) +- MacOSX + gcc9’da yapı sabitleme [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) +- Sabit bir nokta yazım hatası düzeltin: aggreAGte - \> agrega. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) +- Freebsd yapısını düzeltin [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) +- Web sitesine deneysel YouTube kanalına bağlantı Ekle [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) +- Cmake: kapsama bayrakları için Seçenek Ekle: WİTH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) +- Bazı satır içi Podarray’ın başlangıç boyutunu düzeltin. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) +- clickhouse-sunucu.postınst: centos 6 için işletim sistemi algılamasını düzeltin [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) +- Arch linux paketi üretimi eklendi. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Split Common/config.libs tarafından h (dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) +- İçin düzeltmeler “Arcadia” yapı platformu [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) +- Alışılmamış yapı için düzeltmeler (gcc9, alt modül yok) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) +- Hata eğilimli olduğu kanıtlanmış olduğu için unalignedstore’da açık tip gerektirir [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) +- Düzeltmeler MacOS yapı [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) +- Burada istendiği gibi, daha büyük veri kümesine sahip yeni JIT özelliği ile ilgili performans testi [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Stres testinde durumsal testler çalıştırın [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-7} + +- `Kafka` bu sürümde bozuldu. +- Etkinleştirmek `adaptive_index_granularity` = Yeni için varsayılan olarak 10MB `MergeTree` Tablolar. 19.11 + sürümünde yeni MergeTree tabloları oluşturduysanız, 19.6’dan önceki sürümlere düşürme imkansız olacaktır. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) +- Yandex tarafından kullanılan eski belgesiz gömülü sözlükler kaldırıldı.Metrica. İşlev `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` artık kullanılamaz. Bu işlevleri kullanıyorsanız, e-posta yazın clickhouse-feedback@yandex-team.com. not: son anda bu işlevleri bir süre tutmaya karar verdik. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouse yayın 19.10 {#clickhouse-release-19-10} + +### ClickHouse sürümü 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} + +#### Yenilik {#new-feature-7} + +- Yeni sütun codec Ekle: `T64`. (U)IntX/EnumX/Data(Time)/DecimalX sütunları için yapılmıştır. Sabit veya küçük Aralık değerlerine sahip sütunlar için iyi olmalıdır. Codec kendisi büyütmek veya yeniden sıkıştırma olmadan veri türünü küçültmek sağlar. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) +- Veritabanı Altyapısı Ekle `MySQL` uzak MySQL sunucusundaki tüm tabloları görüntülemenize izin veren [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([Kış Zhang](https://github.com/zhang2014)) +- `bitmapContains` uygulanış. 2x daha hızlı `bitmapHasAny` ikinci bit eşlem bir öğe içeriyorsa. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) +- İçin destek `crc32` işlev (tam olarak MySQL veya PHP’DE olduğu gibi davranışla). Bir karma işlevine ihtiyacınız varsa kullanmayın. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) +- Uyguluyordu `SYSTEM START/STOP DISTRIBUTED SENDS` zaman uyumsuz ekler içine denetlemek için sorgular `Distributed` Tablolar. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([Kış Zhang](https://github.com/zhang2014)) + +#### Hata Düzeltme {#bug-fix-22} + +- Mutasyonları yürütürken birleştirme sınırları için sorgu yürütme sınırlarını ve en fazla parça boyutunu yoksayın. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) +- Normal blokların tekilleştirilmesine (son derece nadir) ve yinelenen blokların eklenmesine (daha sık) yol açabilecek hatayı düzeltin. [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) +- Fonksiyonun düzeltilmesi `arrayEnumerateUniqRanked` boş dizilere sahip argümanlar için [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) +- Herhangi bir mesaj yoklamak niyetiyle olmadan Kafka konulara abone etmeyin. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([I ivanvan](https://github.com/abyss7)) +- Ayar yap `join_use_nulls` Nullable içinde olamaz türleri için hiçbir etkisi olsun [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) +- Sabit `Incorrect size of index granularity` hatasızlar [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) +- Float’ı ondalık dönüştürme taşmasına düzeltin [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) +- Floş tampon zaman `WriteBufferFromHDFS`’In yıkıcı denir. Bu düzeltmeler içine yazma `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) + +#### Geliştirme {#improvement-7} + +- Boş hücreleri tedavi edin `CSV` varsayılan değerler olarak zaman ayarı `input_format_defaults_for_omitted_fields` etkindir. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) +- Harici sözlüklerin engellenmeyen yüklenmesi. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ayarlara göre önceden kurulmuş bağlantılar için Ağ zaman aşımları dinamik olarak değiştirilebilir. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) +- Kullanım “public\_suffix\_list” fonksiyonlar için `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. Tarafından oluşturulan mükemmel bir karma tablo kullanıyor `gperf` dosyadan oluşturulan bir liste ile: https://publicsuffix.org/list/public\_suffix\_list.dat. (örneğin, şimdi etki alanını tanıyoruz `ac.uk` olmayan önemli). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Kabul edilen `IPv6` sistem tablolarında veri türü; Birleşik istemci bilgi sütunları `system.processes` ve `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MySQL uyumluluk protokolü ile bağlantılar için oturumları kullanma. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) +- Destek daha fazla `ALTER` sorgular `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) +- Destek `` bölümünde `clickhouse-local` yapılandırma dosyası. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) +- Sorgu çalıştırmasına izin ver `remote` tablo fonksiyonu `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) + +#### Performans İyileştirme {#performance-improvement-5} + +- Mergetree sütunların sonunda son işareti yazma imkanı ekleyin. İşe yaramaz önlemek için tablo veri aralığı anahtarları için okuma sağlar. Yalnızca uyarlamalı dizin parçalı yapı kullanımda ise etkinleştirilir. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) +- Sayısını azaltarak çok yavaş dosya sistemlerinde mergetree tabloları geliştirilmiş performans `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sürüm 19.6 tanıtıldı MergeTree tablolardan okuma sabit performans düşüşü. Düzeltmeler \# 5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-8} + +- Uyguluyordu `TestKeeper` test için kullanılan ZooKeeper arayüzünün bir uygulaması olarak [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) +- Bundan sonra `.sql` testler rasgele veritabanı ile paralel olarak, sunucu tarafından izole çalıştırılabilir. Onları daha hızlı çalıştırmanıza, özel sunucu yapılandırmaları ile yeni testler eklemenize ve farklı testlerin birbirini etkilemediğinden emin olmanızı sağlar. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([I ivanvan](https://github.com/abyss7)) +- Kaldırmak `` ve `` performans test fromlerinden [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) +- Sabit “select\_format” performans testi için `Pretty` biçimliler [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## ClickHouse sürüm 19.9 {#clickhouse-release-19-9} + +### ClickHouse yayın 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} + +#### Hata Düzeltme {#bug-fix-23} + +- 32 bit boyutundan daha küçük değerlere sahip sütunları etkileyen Delta codec’te segfault’u düzeltin. Hata rastgele bellek bozulmasına yol açtı. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) +- LowCardinality sütunu ile parçanın kontrol nadir hata düzeltin. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) +- TTL fix segfault blok fiziksel olmayan sütunlarla birleştirme. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) +- Düşük öncelikli sorguların potansiyel sonsuz uykusunu düzeltin. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Clickhouse’un varsayılan saat dilimini UTC yerine UCT olarak nasıl belirlediğini düzeltin. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Lider çoğaltma önce takipçi çoğaltma üzerinde küme sorguları üzerinde dağıtılmış damla/ALTER/TRUNCATE/OPTİMİZE yürütme hakkında Fix hata. Şimdi doğrudan lider kopya üzerinde idam edilecektir. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) +- Bazı sorgular anında sistem floş günlükleri sorgu sonra query\_log görünmeyebilir neden yarış durumu, düzeltin. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) +- Sabit argümanlar için eksik destek eklendi `evalMLModel` işlev. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} + +#### Yenilik {#new-feature-8} + +- Dondurulmuş parçalar hakkında bilgi Yazdır `system.parts` Tablo. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) +- Clickhouse’da istemci şifresini sor-argümanlarda ayarlanmamışsa tty üzerinde istemci Başlat [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) +- Uygulamak `dictGet` ve `dictGetOrDefault` ondalık türleri için fonksiyonlar. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Geliştirme {#improvement-8} + +- Debian init: servis durdurma zaman aşımı Ekle [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) +- Lowcardinality için şüpheli türlerle tablo oluşturmak için varsayılan olarak yasaklanan ayar Ekle [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) +- Regresyon işlevleri, işlevde durum olarak kullanılmadığında model ağırlıklarını döndürür `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) +- Regresyon yöntemlerini yeniden adlandırın ve geliştirin. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) +- Dize arayanların daha net arayüzleri. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) + +#### Hata Düzeltme {#bug-fix-24} + +- Kafka’daki potansiyel veri kaybını düzeltin [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([I ivanvan](https://github.com/abyss7)) +- Potansiyel sonsuz döngüyü düzeltin `PrettySpace` sıfır sütun ile çağrıldığında Biçimlendir [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) +- Doğrusal modellerde sabit uint32 taşma hatası. Const olmayan model argümanı için eval ML modeline izin verin. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- `ALTER TABLE ... DROP INDEX IF EXISTS ...` sağlanan dizin yoksa bir özel durum yükseltmek değil [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Segfault ile Düzeltme `bitmapHasAny` skaler alt sorguda [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Sabit hata çoğaltma bağlantı havuzu DNS önbellek düştü bile, ana bilgisayarı çözmek için yeniden deneme değil. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- Sabit `ALTER ... MODIFY TTL` ReplicatedMergeTree üzerinde. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) +- SOMUTLAŞTIRILMIŞ sütun ile dağıtılmış tabloya ekleme düzeltin [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) +- Birleştirme depolama alanını keserken hatalı ayırma düzeltildi [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) +- Tzdata paketinin son sürümlerinde bazı dosyalar artık sembolik bağlardır. Varsayılan zaman dilimini tespit etmek için geçerli mekanizma bozulur ve bazı zaman dilimleri için yanlış isimler verir. Şimdi en azından saat dilimi adını, sağlanırsa TZ içeriğine zorlarız. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([I ivanvan](https://github.com/abyss7)) +- Toplamı sabit iğneler en az 16KB uzun olduğunda MultiVolnitsky searcher ile bazı son derece nadir durumlarda düzeltin. Algoritma cevapsız veya yanlış sonuca yol açabilir önceki sonuçları overwrote `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) +- ExternalData istekleri için ayarlar ClickHouse ayarlarını kullanamadığında sorunu düzeltin. Ayrıca, şimdilik, ayarlar `date_time_input_format` ve `low_cardinality_allow_in_native_format` adların belirsizliği nedeniyle kullanılamaz (dış verilerde tablo biçimi olarak yorumlanabilir ve sorguda bir ayar olabilir). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) +- Parçaları Zookeeper onları düşürmeden sadece FS kaldırıldı hata düzeltin. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- MySQL protokolünden hata ayıklama günlüğü kaldırma [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- DDL sorgu işleme sırasında znonode atla [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Fix mix `UNION ALL` sonuç sütun türü. Tutarsız veri ve sonuç sütunlarının sütun türleri olan durumlar vardı. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- Yanlış tamsayılar üzerinde bir istisna atmak `dictGetT` çökme yerine işlevler. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Karma sözlük için yanlış element\_count ve load\_factor Fix `system.dictionaries` Tablo. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-9} + +- Olmadan sabit yapı `Brotli` HTTP sıkıştırma desteği (`ENABLE_BROTLI=OFF` cmake değişkeni). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) +- Kükreyen dahil.kükreyen/kükreyen olarak h.sa [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) +- Hyperscan’daki gcc9 uyarılarını düzeltin (\#line yönergesi kötüdür!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) +- Gcc-9 ile derlerken tüm uyarıları düzeltin. Bazı contrib sorunları düzeltin. Gcc9 ICE’Yİ düzeltin ve bugzilla’ya gönderin. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) +- Lld ile sabit bağlantı [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sözlüklerde kullanılmayan uzmanlıkları kaldırma [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) +- Farklı dosya türleri için tabloları biçimlendirme ve ayrıştırma için iyileştirme performans testleri [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) +- Paralel test çalışması için düzeltmeler [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) +- Docker: clickhouse-test’ten yapılandırmaları kullanın [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) +- FreeBSD için derlemeyi düzeltin [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) +- Yükseltme boost için 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) +- Yapı clickhouse’u submodule olarak düzeltin [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) +- Jsonextract performans testlerini geliştirin [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) + +## ClickHouse yayın 19.8 {#clickhouse-release-19-8} + +### ClickHouse yayın 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} + +#### Yenilik {#new-features} + +- Json ile çalışmak için fonksiyonlar eklendi [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) +- Bir çok dilde var olan bir basename işlevine benzer bir davranışa sahip bir işlev basename ekleyin (`os.path.basename` PY inth inon’da, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Katma `LIMIT n, m BY` veya `LIMIT m OFFSET n BY` limit BY yan tümcesi için n ofset ayarlamak için sözdizimi. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) +- Yeni veri türü eklendi `SimpleAggregateFunction`, bir ışık toplama ile sütunlara sahip olmasını sağlar `AggregatingMergeTree`. Bu sadece aşağıdaki gibi basit işlevlerle kullanılabilir `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) +- Fonksiyonda sabit olmayan argümanlar için destek eklendi `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) +- Eklenen fonksiyonlar `skewPop`, `skewSamp`, `kurtPop` ve `kurtSamp` sıra eğriliği, örnek eğrilik, kurtozis ve örnek kurtozis sırasıyla hesaplamak için. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) +- Destek yeniden adlandırma işlemi için `MaterializeView` depolama. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) +- MySQL istemcisini kullanarak Clickhouse’a bağlanmayı sağlayan sunucu eklendi. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) +- Eklemek `toDecimal*OrZero` ve `toDecimal*OrNull` işlevler. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) +- Destek ondalık türleri fonksiyonları: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) +- Katma `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) +- Katma `format` işlev. Argümanlarda listelenen dizelerle sabit desen (basitleştirilmiş Python biçim deseni) biçimlendirme. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) +- Katma `system.detached_parts` ayrılmış bölümleri hakkında bilgi içeren tablo `MergeTree` Tablolar. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) +- Katma `ngramSearch` iğne ve Samanlık arasındaki simetrik olmayan farkı hesaplamak için işlev. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) +- Temel makine öğrenimi yöntemlerinin (stokastik doğrusal regresyon ve lojistik regresyon) agrega fonksiyonları arayüzünü kullanarak uygulanması. Model ağırlıklarını güncellemek için farklı stratejilere sahiptir (basit Gradyan iniş, momentum yöntemi, Nesterov yöntemi). Ayrıca özel boyuttaki mini partileri de destekler. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) +- Uygulanması `geohashEncode` ve `geohashDecode` işlevler. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) +- Toplama fonksiyonu eklendi `timeSeriesGroupSum`, hangi zaman damgası hizalama değil örnek farklı zaman serileri toplayabilir. İki örnek zaman damgası arasında doğrusal enterpolasyon kullanacak ve daha sonra zaman serilerini birlikte toplayacaktır. Toplama fonksiyonu eklendi `timeSeriesGroupRateSum`, zaman serisi ve daha sonra toplam oranları birlikte oranını hesaplar. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Yangkuan Liu](https://github.com/LiuYangkuan)) +- Eklenen fonksiyonlar `IPv4CIDRtoIPv4Range` ve `IPv6CIDRtoIPv6Range` bir CIDR kullanarak alt ağdaki bir IP için alt ve üst sınırları hesaplamak için. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Etkin ayar ile HTTP kullanarak bir sorgu gönderdiğimizde bir X-ClickHouse-Summary Başlığı ekleyin `send_progress_in_http_headers`. Sorguda kaç satır ve bayt eklendiği gibi ek bilgilerle birlikte, x-ClickHouse-Progress’in olağan bilgilerini döndürün. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Geliştirmeler {#improvements} + +- Katma `max_parts_in_total` bölüm anahtarı \#5166 güvenli olmayan belirtimini engelleyen mergetree ailesi tabloları (varsayılan: 100 000) için ayarlama. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-obfuscator`: ilk tohum sütun adı, sütun konumu ile birleştirerek tek tek sütunlar için tohum türetmek. Bu, veri kümelerini birden çok ilgili tablolarla dönüştürmek için tasarlanmıştır, böylece tablolar dönüşümden sonra birleştirilebilir kalır. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eklenen fonksiyonlar `JSONExtractRaw`, `JSONExtractKeyAndValues`. Yeniden adlandırılan işlevler `jsonExtract` -e doğru `JSONExtract`. Bir şeyler ters gittiğinde bu işlevler muhabir değerleri döndürür, değil `NULL`. Modifiye fonksiyonu `JSONExtract`, şimdi son parametresinden dönüş türünü alır ve nullables enjekte etmez. Avx2 talimatlarının mevcut olmaması durumunda Rapidjson’a geri dönüş uygulandı. Simdjson KÜTÜPHANESİ yeni bir sürüme güncellendi. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) +- Şimdi `if` ve `multiIf` fonksiyonlar koşulun güvenmeyin `Nullable`, ancak SQL uyumluluğu için şubelere güvenin. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu.](https://github.com/janplus)) +- `In` yüklemi şimdi üretir `Null` sonucu `Null` gibi girdi `Equal` işlev. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu.](https://github.com/janplus)) +- Kafka’dan her (flush\_interval / poll\_timeout) satır sayısını zaman sınırını kontrol edin. Bu, Kafka tüketicisinden okumayı daha sık kırmaya ve üst düzey akışların zaman sınırlarını kontrol etmeye izin verir [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([I ivanvan](https://github.com/abyss7)) +- Paketlenmiş SASL ile bağlantı RDKAFKA. SASL SCRAM kimlik doğrulamasını kullanmasına izin vermelidir [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([I ivanvan](https://github.com/abyss7)) +- Tüm birleşimler için rowreflist’in toplu sürümü. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) +- clickhouse-sunucu: daha bilgilendirici dinleme hata mesajları. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) +- Clickhouse destek sözlükler-fonksiyonlar için fotokopi `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) +- Yeni ayar Ekle `kafka_commit_every_batch` Kafka’nın taahhüt politikasını düzenlemek. + Taahhüt modunu ayarlamanıza izin verir: her mesaj Partisi işlendikten sonra veya tüm blok depolamaya yazıldıktan sonra. Bazı mesajları kaybetmek veya bazı aşırı durumlarda iki kez okumak arasında bir takas. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([I ivanvan](https://github.com/abyss7)) +- Yapmak `windowFunnel` diğer imzasız tamsayı türlerini destekleyin. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) +- Sanal sütunun gölgesine izin ver `_table` birleştirme motorunda. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([I ivanvan](https://github.com/abyss7)) +- Yapmak `sequenceMatch` toplu işlevler diğer imzasız tamsayı türlerini destekler [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) +- Sağlama toplamı uyuşmazlığı büyük olasılıkla donanım hatalarından kaynaklanıyorsa daha iyi hata iletileri. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Altta yatan tabloların örneklemeyi desteklediğini kontrol edin `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([I ivanvan](https://github.com/abyss7)) +- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- MySQL Wire protokolünün iyileştirmeleri. MySQLWire biçiminin adını değiştirdi. Rsa\_free çağırmak için RAII kullanma. Bağlam oluşturulamıyorsa SSL’Yİ devre dışı bırakma. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) +- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) +- Dağıtılmış tablolara zaman uyumsuz ekler sorgu ayarlarını saygı. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) +- Yeniden adlandırılan işlevler `leastSqr` -e doğru `simpleLinearRegression`, `LinearRegression` -e doğru `linearRegression`, `LogisticRegression` -e doğru `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Performans İyileştirmeleri {#performance-improvements} + +- Parallelize işleme parçaları olmayan çoğaltılmış MergeTree tabloları alter değiştirme sorgu. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) +- Düzenli ifadeler çıkarma optimizasyonlar. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) +- Yalnızca joın on bölümünde kullanılıyorsa, sonucu birleştirmek için doğru joın anahtar sütunu eklemeyin. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) +- İlk boş yanıttan sonra Kafka tamponunu dondurun. Bu birden invokations önler `ReadBuffer::next()` bazı satır ayrıştırma akışlarında boş sonuç için. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([I ivanvan](https://github.com/abyss7)) +- `concat` birden çok argüman için işlev optimizasyonu. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) +- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) +- Daha hızlı dekompresyona sahip olmak için lz4 uygulamamızı referansla yükseltin. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) +- Uygulanan MSD radix sıralama (kxsort dayalı) ve kısmi sıralama. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) + +#### Hata Düzeltmeleri {#bug-fixes} + +- Fix itme birleştirme ile sütunlar gerektirir [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Kış Zhang](https://github.com/zhang2014)) +- ClickHouse systemd tarafından çalıştırıldığında Sabit hata, komut `sudo service clickhouse-server forcerestart` beklendiği gibi çalışmadı. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) +- Datapartsexchange’deki http hata kodlarını düzeltin (9009 bağlantı noktasındaki ınterserver http Sunucusu, hatalarda bile her zaman 200 kodunu döndürdü). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) +- Max\_small\_string\_size daha uzun dize için SimpleAggregateFunction Fix [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) +- İçin hatayı Düzelt fixin `Decimal` -e doğru `Nullable(Decimal)` içinde dönüşüm. (Farklı ölçekler dahil) ondalık dönüşümler diğer ondalık destekleyin. [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) +- Yanlış hesaplama yol simdjson kütüphanesinde sabit FPU clobbering `uniqHLL` ve `uniqCombined` toplama fonksiyonu ve matematik fonksiyonları gibi `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Json işlevlerinde karışık const / nonconst durumlarda sabit taşıma. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) +- Düzeltmek `retention` işlev. Şimdi bir veri satırında tatmin eden tüm koşullar veri durumuna eklenir. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) +- Sonuç türünü düzeltme `quantileExact` ondalık sayılarla. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Belge {#documentation} + +- İçin belgeleri tercüme `CollapsingMergeTree` Çin. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) +- Tablo motorları ile ilgili bazı belgeleri çince’ye çevirin. + [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) + [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) + ([Nev leeer lee](https://github.com/neverlee)) + +#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements} + +- Olası kullanım sonrası ücretsiz gösteren bazı dezenfektan raporlarını düzeltin.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([I ivanvan](https://github.com/abyss7)) +- Kolaylık sağlamak için performans testlerini ayrı dizinlerden çıkarın. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yanlış performans testlerini düzeltin. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) +- Donanım Sorunlarını ayıklamak için bit flips’in neden olduğu sağlama toplamlarını hesaplamak için bir araç eklendi. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Runner betiğini daha kullanışlı hale getirin. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) +- Performans testlerinin nasıl yazılacağı konusunda küçük talimatlar ekleyin. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) +- Performans testlerinde create, fill ve drop sorgularında değişiklik yapma yeteneği ekleme [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) + +## ClickHouse yayın 19.7 {#clickhouse-release-19-7} + +### ClickHouse yayın 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} + +#### Hata Düzeltme {#bug-fix-25} + +- JOIN ile bazı sorgularda performans gerilemesini düzeltin. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Kış Zhang](https://github.com/zhang2014)) + +### ClickHouse yayın 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} + +#### Yenilik {#new-features-1} + +- Bitmap ile ilgili işlevler eklendi `bitmapHasAny` ve `bitmapHasAll` benzer `hasAny` ve `hasAll` diziler için fonksiyonlar. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) + +#### Hata Düzeltmeleri {#bug-fixes-1} + +- Segfault’u düzeltin `minmax` Null değeri ile dizin. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) +- Tüm giriş sütunlarını LİMİT olarak gerekli çıktı olarak işaretleyin. Düzelt itiyor ‘Not found column’ bazı dağıtılmış sorgularda hata. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) +- Düzeltmek “Column ‘0’ already exists” er errorror in `SELECT .. PREWHERE` ÖNTAN columnımlı süt onunda [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) +- Düzeltmek `ALTER MODIFY TTL` sorgu üzerinde `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) +- Kafka tüketiciler başlatmak için başarısız olduğunda sunucu çökmesine etmeyin. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([I ivanvan](https://github.com/abyss7)) +- Sabit bitmap işlevleri yanlış sonuç üretir. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Andy Yang](https://github.com/andyyzh)) +- Karma sözlük için element\_count’u düzeltin (çiftleri dahil etmeyin) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) +- Ortam değişkeni TZ içeriğini saat dilimi adı olarak kullanın. Bazı durumlarda varsayılan zaman dilimini doğru bir şekilde tespit etmeye yardımcı olur.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([I ivanvan](https://github.com/abyss7)) +- Tamsayıları dönüştürmeye çalışmayın `dictGetT` fonksiyonlar, çünkü düzgün çalışmıyor. Bunun yerine bir istisna atın. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- Harici ayarları düzeltinveri HTTP isteği. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila. + Kutenin](https://github.com/danlark1)) +- Parçaları Zookeeper onları düşürmeden sadece FS kaldırıldı hata düzeltin. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) +- Segmentasyon hatasını düzeltin `bitmapHasAny` işlev. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) +- Sabit hata çoğaltma bağlantı havuzu DNS önbellek düştü bile, ana bilgisayarı çözmek için yeniden deneme değil. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) +- Sabit `DROP INDEX IF EXISTS` sorgu. Şimdi `ALTER TABLE ... DROP INDEX IF EXISTS ...` sağlanan dizin yoksa, sorgu bir özel durum oluşturmaz. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) +- Birliği tüm supertype sütununu düzeltin. Tutarsız veri ve sonuç sütunlarının sütun türleri olan durumlar vardı. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- DDL sorgu işleme sırasında znonode atlayın. Başka bir düğüm, görev sırasındaki znode’u kaldırmadan önce, + bunu işlemedi, ancak zaten çocukların listesini al, DDLWorker iş parçacığını sonlandıracak. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- Somutlaştırılmış sütun ile dağıtılmış() tabloya Ekle düzeltin. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) + +### ClickHouse yayın 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} + +#### Yenilik {#new-features-2} + +- Kullanıcı tarafından belirtilebilecek bir ayar aralığını sınırlamaya izin verin. + Bu kısıtlamalar kullanıcı ayarları profilinde ayarlanabilir. + [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly. + Baranov](https://github.com/vitlibar)) +- İşlevin ikinci bir sürümünü ekleyin `groupUniqArray` isteğe bağlı + `max_size` elde edilen dizinin boyutunu sınırlayan parametre. Bu + davranış benzer `groupArray(max_size)(x)` işlev. + [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume + Tassery](https://github.com/YiuRULE)) +- Tsvwithnames / CSVWithNames giriş dosya formatları için, sütun sırası şimdi olabilir + dosya başlığından belirlenir. Bu tarafından kontrol edilir + `input_format_with_names_use_header` parametre. + [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) + ([İskender](https://github.com/Akazz)) + +#### Hata Düzeltmeleri {#bug-fixes-2} + +- Birleştirme sırasında uncompressed\_cache + JOİN ile kilitlenme (\#5197) + [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila. + Kutenin](https://github.com/danlark1)) +- Sistem tablolarına bir clickhouse-istemci sorgusunda segmentasyon hatası. \#5066 + [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) + ([I ivanvan](https://github.com/abyss7)) +- KafkaEngine üzerinden ağır yükte veri kaybı (\#4736) + [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) + ([I ivanvan](https://github.com/abyss7)) +- Sistemden en az iki seçmeyi içeren UNION ile bir sorgu yürütülürken gerçekleşebilecek çok nadir veri yarışı durumu düzeltildi.sütunlar, sistem.tablolar, sistem.parçalar, sistem.parts\_tables veya birleştirme ailesinin tabloları ve ilgili tabloların sütunlarının aynı anda değiştirilmesi. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Performans İyileştirmeleri {#performance-improvements-1} + +- Tek bir sayısal sütuna göre sıralama için radix sıralamasını kullanın `ORDER BY` olarak + `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), + [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) + ([Evgenii Pravda](https://github.com/kvinty), + [alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Belge {#documentation-1} + +- Bazı tablo motorları için belgeleri Çince’ye çevirin. + [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), + [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), + [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) + ([张风啸](https://github.com/AlexZFX)), + [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([asla + lee](https://github.com/neverlee)) + +#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-1} + +- UTF-8 karakterlerini düzgün bir şekilde yazdırın `clickhouse-test`. + [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Her zaman öneri yüklemek için clickhouse-client için komut satırı parametresi ekleyin + veriler. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bazı PVS-Studio uyarılarını çözün. + [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) + ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Güncelleme LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila. + Kutenin](https://github.com/danlark1)) +- Yaklaşan çekme isteği \#5030 için gereksinimleri oluşturmak için gperf ekleyin. + [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) + ([proller](https://github.com/proller)) + +## ClickHouse yayın 19.6 {#clickhouse-release-19-6} + +### ClickHouse yayın 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} + +#### Hata Düzeltmeleri {#bug-fixes-3} + +- Tablo işlevlerinden sorgular için koşul pushdown sabit `mysql` ve `odbc` ve ilgili masa motorları. Bu düzeltmeler \# 3540 ve \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Zookeeper kilitlenme Fix. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) +- CSV’DE alıntı ondalık sayılara izin ver. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) +- Float Inf/Nan’dan ondalık sayılara dönüştürmeye izin verme (istisna atma). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) +- Yeniden adlandırma sorgusunda veri yarışını düzeltin. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([Kış Zhang](https://github.com/zhang2014)) +- Lfalloc’u geçici olarak devre dışı bırakın. Lfalloc kullanımı, UncompressedCache tahsis edilmesinde ve yüksek yüklü sunuculardaki sorguların çökmesine neden olan bir çok MAP\_FAİLED’E yol açabilir. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) + +### ClickHouse yayın 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} + +#### Yenilik {#new-features-3} + +- Sütunlar ve tablolar için TTL ifadeleri. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) +- İçin destek eklendi `brotli` http yanıtları için sıkıştırma (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mikhail](https://github.com/fandyushin)) +- Yeni fonksiyon eklendi `isValidUTF8` bir bayt kümesinin doğru utf-8 kodlanmış olup olmadığını kontrol etmek için. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) +- Yeni Yük Dengeleme ilkesi Ekle `first_or_random` bu, belirtilen ilk ana bilgisayara sorgular gönderir ve erişilemezse, rasgele ana bilgisayarlara sorgular gönderir. Çapraz çoğaltma topoloji kurulumları için kullanışlıdır. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) + +#### Deneysel Özellikler {#experimental-features-1} + +- Ayar Ekle `index_granularity_bytes` (adaptive ındex granularity) MergeTree\* tablolar ailesi için. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) + +#### Geliştirmeler {#improvements-1} + +- Fonksiyon için sabit olmayan ve negatif boyut ve uzunluk argümanları için destek eklendi `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sol joın sağ tablo, sol tablo sağ joın ve her iki tablo tam joın push-aşağı devre dışı bırakın. Bu, bazı durumlarda yanlış birleştirme sonuçlarını düzeltir. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([I ivanvan](https://github.com/abyss7)) +- `clickhouse-copier`: otomatik yükleme görev yapılandırması `--task-file` seçenek [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) +- Depolama Fabrikası ve masa fonksiyonları Fabrikası için yazım hataları işleyicisi eklendi. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) +- Alt sorgular olmadan birden fazla birleşim için yıldız işaretlerini ve nitelikli yıldız işaretlerini destekleyin [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) +- Eksik sütun hata mesajını daha kullanıcı dostu hale getirin. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Performans İyileştirmeleri {#performance-improvements-2} + +- ASOF JOİN önemli hızlanma [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) + +#### Geriye Dönük Uyumsuz Değişiklikler {#backward-incompatible-changes} + +- HTTP Başlığı `Query-Id` olarak değiştirildi `X-ClickHouse-Query-Id` tutarlılık için. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mikhail](https://github.com/fandyushin)) + +#### Hata Düzeltmeleri {#bug-fixes-4} + +- Sabit potansiyel boş işaretçi dereference `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) +- JOİN + ARRAY JOİN ile sorguda Sabit hata [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) +- Bir sözlük engine=Dictionary ile bir veritabanı üzerinden başka bir sözlüğe bağlı olduğunda sunucunun başlangıcında asılı sabit. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) +- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) +- Potansiyel olarak yanlış sonucu düzeltin `SELECT DISTINCT` ile `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) +- Sistemden en az iki seçmeyi içeren UNION ile bir sorgu yürütülürken gerçekleşebilecek çok nadir veri yarışı durumu düzeltildi.sütunlar, sistem.tablolar, sistem.parçalar, sistem.parts\_tables veya birleştirme ailesinin tabloları ve ilgili tabloların sütunlarının aynı anda değiştirilmesi. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-2} + +- Farklı ana bilgisayarda clickhouse-server çalıştırırken sabit test hataları [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) +- clickhouse-test: tty olmayan ortamda renk kontrol dizilerini devre dışı bırakın. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) +- clickhouse-test: herhangi bir test veritabanını kullanmasına izin ver (Kaldır `test.` mümkün olduğu yerde yeterlilik) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) +- Ubsan hatalarını düzeltin [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Yandex LFAlloc, Segfault’ları daha güvenilir yakalamak için MarkCache ve UncompressedCache verilerini farklı şekillerde ayırmak için Clickhouse’a eklendi [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) +- Python util backports ve changelogs ile yardımcı olmak için. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([I ivanvan](https://github.com/abyss7)) + +## ClickHouse sürümü 19.5 {#clickhouse-release-19-5} + +### ClickHouse yayın 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} + +#### Hata düzeltmeleri {#bug-fixes-5} + +- Bitmap sabit Olası kazasında \* fonksiyonlar [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Andy Yang](https://github.com/andyyzh)) +- Sistemden en az iki seçmeyi içeren UNION ile bir sorgu yürütülürken gerçekleşebilecek çok nadir veri yarışı durumu düzeltildi.sütunlar, sistem.tablolar, sistem.parçalar, sistem.parts\_tables veya birleştirme ailesinin tabloları ve ilgili tabloların sütunlarının aynı anda değiştirilmesi. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit hata `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. Bu hata, lowcardinality sütunu birincil anahtarın bir parçasıysa oldu. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Tutma işlevinin değiştirilmesi: bir satır hem ilk hem de n. koşulu yerine getirirse, veri durumuna yalnızca ilk tatmin edilen koşul eklenir. Şimdi bir veri satırında tatmin eden tüm koşullar veri durumuna eklenir. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) + +### ClickHouse yayın 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} + +#### Hata düzeltmeleri {#bug-fixes-6} + +- Sabit ayar türü `max_partitions_per_insert_block` boolean’dan Uint64’e. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Muhammed Hüseyin Sekhavat](https://github.com/mhsekhavat)) + +### ClickHouse yayın 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} + +#### Yenilik {#new-features-4} + +- [Hyperscan](https://github.com/intel/hyperscan) çoklu düzenli ifade eşleştirme eklendi (fonksiyonlar `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) +- `multiSearchFirstPosition` işlevi eklendi. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) +- Tablolar için satır başına önceden tanımlanmış ifade filtresini uygulayın. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([I ivanvan](https://github.com/abyss7)) +- Bloom filtrelerine dayalı endeksleri atlama veri yeni bir tür (için kullanılabilir `equal`, `in` ve `like` işlevler). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) +- Katma `ASOF JOIN` bilinen en son değere katılan sorguları çalıştırmaya izin verir. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) +- Birden fazla yeniden yaz `COMMA JOIN` -e doğru `CROSS JOIN`. Sonra onları yeniden yaz `INNER JOIN` mümkünse. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Geliştirme {#improvement-9} + +- `topK` ve `topKWeighted` Şimdi özel destekler `loadFactor` (düzeltmeler sorunu [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) +- Kullanmasına izin ver `parallel_replicas_count > 1` örnekleme olmadan tablolar için bile (ayar sadece onlar için göz ardı edilir). Önceki sürümlerde istisna yol oldu. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) +- İçin destek `CREATE OR REPLACE VIEW`. Bir görünüm oluşturmak veya tek bir deyimde yeni bir tanım ayarlamak için izin ver. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) +- `Buffer` tablo motoru şimdi destekler `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Yangkuan Liu](https://github.com/LiuYangkuan)) +- Zookeeper içinde meta veri olmadan çoğaltılmış tablo başlatmak için yeteneği ekleyin `readonly` modu. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) +- Clickhouse-client ilerleme çubuğunun sabit titreme. Kullanırken sorun en dikkat çekiciydi `FORMAT Null` akış sorguları ile. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İle işlevleri devre dışı bırakmak için izin ver `hyperscan` potansiyel olarak aşırı ve kontrolsüz kaynak kullanımını sınırlamak için kullanıcı bazında kütüphane. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tüm hatalarda sürüm numarası günlüğü ekleyin. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) +- Kısıtlama eklendi `multiMatch` içine sığacak şekilde dize boyutu gerektiren işlevler `unsigned int`. Ayrıca bağımsız değişken sayısı sınırı eklendi `multiSearch` işlevler. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) +- Hyperscan çizik alanı ve hata işleme geliştirilmiş kullanımı. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) +- Doldurma `system.graphite_detentions` bir tablo yapılandırmasından `*GraphiteMergeTree` motor tabloları. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Adlandırmak `trigramDistance` fonksiyonu için `ngramDistance` ve daha fazla fonksiyon ekleyin `CaseInsensitive` ve `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) +- Geliştirilmiş veri endeksleri hesaplama atlama. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) +- Sıradan tutmak, `DEFAULT`, `MATERIALIZED` ve `ALIAS` tek bir listedeki sütunlar (düzeltmeler sorunu [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +#### Hata Düzeltme {#bug-fix-26} + +- Önlemek `std::terminate` bellek ayırma hatası durumunda. Şimdi `std::bad_alloc` istisna beklendiği gibi atılır. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tampondan capnproto okumasını düzeltir. Bazen dosyalar HTTP tarafından başarıyla yüklenmedi. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Hatayı Düzelt `Unknown log entry type: 0` sonra `OPTIMIZE TABLE FINAL` sorgu. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Kuşu](https://github.com/amosbird)) +- Yanlış argümanlar `hasAny` veya `hasAll` fonksiyonlar segfault yol açabilir. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yürütme sırasında kilitlenme oluşabilir `DROP DATABASE dictionary` sorgu. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tanımsız davranışı düzeltin `median` ve `quantile` işlevler. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- Sıkıştırma seviyesi algılamasını ne zaman düzeltin `network_compression_method` küçük harfle. V19. 1’de kırık. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- Sabit ceh ofalet `UTC` ayar (düzeltmeler sorunu [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- Düzeltmek `histogram` fonksiyon davranışı ile `Distributed` Tablolar. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- Sabit tsan raporu `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Nedeniyle sistem günlükleri kullanımında yarış durumuna kapatma sabit TSan raporu. Part\_log etkinleştirildiğinde kapatma sırasında sabit potansiyel kullanım sonrası serbest. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Parçaları tekrar kontrol edin `ReplicatedMergeTreeAlterThread` hata durumunda. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ara toplama işlev durumlarındaki aritmetik işlemler sabit argümanlar (alt sorgu sonuçları gibi) için çalışmadı. [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Her zaman meta veri sütun adlarını backquote. Aksi takdirde, adlandırılmış sütunlu bir tablo oluşturmak imkansızdır `index` (sunucu hatalı biçimlendirilmiş nedeniyle yeniden başlatılmaz `ATTACH` metadata sorgu). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Çökmeyi düzeltin `ALTER ... MODIFY ORDER BY` üzerinde `Distributed` Tablo. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- Segfault’u düzeltin `JOIN ON` ile etkin `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Kış Zhang](https://github.com/zhang2014)) +- Kafka’dan bir protobuf mesajı tükettikten sonra yabancı bir satır ekleyerek hatayı düzeltin. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- ’Nin çökmesini düzeltin `JOIN` null olmayan vs null sütun üzerinde. Düzeltmek `NULLs` sağ tuş inlarda `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) +- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Sabit yarış durumu `SELECT` itibaren `system.tables` tablo aynı anda yeniden adlandırılırsa veya değiştirilirse. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Zaten eskimiş olan veri bölümünü getirirken sabit veri yarışı. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sırasında meydana gelebilecek sabit nadir veri yarışı `RENAME` MergeTree ailesinin tablo. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fonksiyonda sabit segmentasyon hatası `arrayIntersect`. Fonksiyon karışık sabit ve sıradan argümanlarla çağrılırsa segmentasyon hatası olabilir. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Çökmeyi düzeltin `FULL/RIGHT JOIN` biz nullable vs değil nullable üzerinde katılırken. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Düzeltmek `No message received` kopyaları arasındaki parçaları getirirken istisna. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- Sabit `arrayIntersect` tek dizide birkaç tekrarlanan değerler durumunda işlev yanlış sonuç. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Eşzamanlı sırasında bir yarış durumunu düzeltin `ALTER COLUMN` bir sunucu çökmesine neden olabilecek sorgular (düzeltmeler sorunu [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- Yanlış sonucu düzeltin `FULL/RIGHT JOIN` const sütunu ile. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) +- Çiftleri düzeltin `GLOBAL JOIN` yıldız işareti ile. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) +- Parametre kesintisini düzeltin `ALTER MODIFY` of Col ofum ofn `CODEC` sütun türü belirtilmediğinde. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- İşlevler `cutQueryStringAndFragment()` ve `queryStringAndFragment()` şimdi ne zaman doğru çalışıyor `URL` bir parça ve hiçbir sorgu içerir. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ayarlarken nadir hatayı düzeltin `min_bytes_to_use_direct_io` iş parçacığı sütun dosyasında geriye aramak zorunda olduğunda oluşan sıfırdan büyüktür. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- Toplama işlevleri için yanlış argüman türlerini düzeltin `LowCardinality` argümanlar (düzeltmeler sorunu [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Yanlış isim kalifikasyonunu düzeltin `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) +- Düzeltme fonksiyonu `toISOWeek` 1970 yılı için sonuç. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltmek `DROP`, `TRUNCATE` ve `OPTIMIZE` sorgular, çoğaltma, dosya üzerinde `ON CLUSTER` için `ReplicatedMergeTree*` tablolar aile. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-8} + +- Ayarı yeniden adlandır `insert_sample_with_metadata` ayarlamak `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) +- Ayar eklendi `max_partitions_per_insert_block` (varsayılan değer 100 ile). Eklenen blok daha fazla sayıda bölüm içeriyorsa, bir özel durum atılır. Sınırı kaldırmak istiyorsanız 0 olarak ayarlayın (önerilmez). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Çoklu arama işlevleri yeniden adlandırıldı (`multiPosition` -e doğru `multiSearchAllPositions`, `multiSearch` -e doğru `multiSearchAny`, `firstMatch` -e doğru `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) + +#### Performans İyileştirme {#performance-improvement-6} + +- Birçok İğne veya birçok benzer bigrams ile sorgular için yaklaşık %5-10 arama iyileştirme vererek, inlining tarafından volnitsky searcher Optimize edin. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) +- Ayarlarken performans sorununu düzeltin `use_uncompressed_cache` önbellekte bulunan tüm okuma verileri göründüğünde ortaya çıkan sıfırdan büyüktür. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-10} + +- Sertleştirme hata ayıklama yapı: daha ayrıntılı bellek eşlemeleri ve ASLR; ışareti önbellek ve dizin için bellek koruması ekleyin. Bu ASan ve MSan bunu yapamaz durumda daha fazla bellek stomping hata bulmanızı sağlar. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cmake değişkenleri için destek Ekle `ENABLE_PROTOBUF`, `ENABLE_PARQUET` ve `ENABLE_BROTLI` yukarıdaki özellikleri etkinleştirmeye / devre dışı bırakmaya izin verir (librdkafka, mysql, vb.için yapabileceğimiz gibi). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) +- Bazı sorgular test çalıştırıldıktan sonra asılırsa, işlem listesi ve tüm iş parçacıklarının stacktraces yazdırmak için yeteneği ekleyin. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) +- Yeniden deneme Ekle `Connection loss` er errorror in `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) +- Vagrant ile freebsd build ekleyin ve packager komut dosyasına iş parçacığı sanitizer ile oluşturun. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) +- Şimdi kullanıcı kullanıcı için şifre istedi `'default'` kurulum sırasında. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) +- İçinde uyarı bastır warningmak `rdkafka` kitaplık. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ssl olmadan oluşturma yeteneğine izin ver. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) +- Clickhouse-sunucu görüntüsünü özel bir kullanıcıdan başlatmanın bir yolunu ekleyin. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Contrib Boost’u 1.69’a yükseltin. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) +- Kullanımını devre dışı bırak `mremap` iplik dezenfektanı ile derlendiğinde. Şaşırtıcı bir şekilde, TSan kesişmiyor `mremap` (kes doesmesine rağmen `mmap`, `munmap`) bu yanlış pozitiflere yol açar. Durumsal testlerde sabit TSan raporu. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- HTTP arayüzü üzerinden biçim şemasını kullanarak test denetimi ekleyin. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) + +## ClickHouse sürüm 19.4 {#clickhouse-release-19-4} + +### ClickHouse yayın 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} + +#### Hata Düzeltmeleri {#bug-fixes-7} + +- Önlemek `std::terminate` bellek ayırma hatası durumunda. Şimdi `std::bad_alloc` istisna beklendiği gibi atılır. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tampondan capnproto okumasını düzeltir. Bazen dosyalar HTTP tarafından başarıyla yüklenmedi. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) +- Hatayı Düzelt `Unknown log entry type: 0` sonra `OPTIMIZE TABLE FINAL` sorgu. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Kuşu](https://github.com/amosbird)) +- Yanlış argümanlar `hasAny` veya `hasAll` fonksiyonlar segfault yol açabilir. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yürütme sırasında kilitlenme oluşabilir `DROP DATABASE dictionary` sorgu. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tanımsız davranışı düzeltin `median` ve `quantile` işlevler. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- Sıkıştırma seviyesi algılamasını ne zaman düzeltin `network_compression_method` küçük harfle. V19. 1’de kırık. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- Sabit ceh ofalet `UTC` ayar (düzeltmeler sorunu [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- Düzeltmek `histogram` fonksiyon davranışı ile `Distributed` Tablolar. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- Sabit tsan raporu `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Nedeniyle sistem günlükleri kullanımında yarış durumuna kapatma sabit TSan raporu. Part\_log etkinleştirildiğinde kapatma sırasında sabit potansiyel kullanım sonrası serbest. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Parçaları tekrar kontrol edin `ReplicatedMergeTreeAlterThread` hata durumunda. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ara toplama işlev durumlarındaki aritmetik işlemler sabit argümanlar (alt sorgu sonuçları gibi) için çalışmadı. [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Her zaman meta veri sütun adlarını backquote. Aksi takdirde, adlandırılmış sütunlu bir tablo oluşturmak imkansızdır `index` (sunucu hatalı biçimlendirilmiş nedeniyle yeniden başlatılmaz `ATTACH` metadata sorgu). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Çökmeyi düzeltin `ALTER ... MODIFY ORDER BY` üzerinde `Distributed` Tablo. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- Segfault’u düzeltin `JOIN ON` ile etkin `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Kış Zhang](https://github.com/zhang2014)) +- Kafka’dan bir protobuf mesajı tükettikten sonra yabancı bir satır ekleyerek hatayı düzeltin. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) +- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Sabit yarış durumu `SELECT` itibaren `system.tables` tablo aynı anda yeniden adlandırılırsa veya değiştirilirse. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Zaten eskimiş olan veri bölümünü getirirken sabit veri yarışı. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sırasında meydana gelebilecek sabit nadir veri yarışı `RENAME` MergeTree ailesinin tablo. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fonksiyonda sabit segmentasyon hatası `arrayIntersect`. Fonksiyon karışık sabit ve sıradan argümanlarla çağrılırsa segmentasyon hatası olabilir. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) +- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Düzeltmek `No message received` kopyaları arasındaki parçaları getirirken istisna. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) +- Sabit `arrayIntersect` tek dizide birkaç tekrarlanan değerler durumunda işlev yanlış sonuç. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Eşzamanlı sırasında bir yarış durumunu düzeltin `ALTER COLUMN` bir sunucu çökmesine neden olabilecek sorgular (düzeltmeler sorunu [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- Parametre kesintisini düzeltin `ALTER MODIFY` of Col ofum ofn `CODEC` sütun türü belirtilmediğinde. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) +- İşlevler `cutQueryStringAndFragment()` ve `queryStringAndFragment()` şimdi ne zaman doğru çalışıyor `URL` bir parça ve hiçbir sorgu içerir. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) +- Ayarlarken nadir hatayı düzeltin `min_bytes_to_use_direct_io` iş parçacığı sütun dosyasında geriye aramak zorunda olduğunda oluşan sıfırdan büyüktür. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) +- Toplama işlevleri için yanlış argüman türlerini düzeltin `LowCardinality` argümanlar (düzeltmeler sorunu [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Düzeltme fonksiyonu `toISOWeek` 1970 yılı için sonuç. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltmek `DROP`, `TRUNCATE` ve `OPTIMIZE` sorgular, çoğaltma, dosya üzerinde `ON CLUSTER` için `ReplicatedMergeTree*` tablolar aile. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) + +#### Geliştirmeler {#improvements-2} + +- Sıradan tutmak, `DEFAULT`, `MATERIALIZED` ve `ALIAS` tek bir listedeki sütunlar (düzeltmeler sorunu [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +### ClickHouse yayın 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} + +#### Hata Düzeltmeleri {#bug-fixes-8} + +- Çökmeyi düzeltin `FULL/RIGHT JOIN` biz nullable vs değil nullable üzerinde katılırken. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-11} + +- Clickhouse-sunucu görüntüsünü özel bir kullanıcıdan başlatmanın bir yolunu ekleyin. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### ClickHouse sürümü 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} + +#### Hata Düzeltmeleri {#bug-fixes-9} + +- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### ClickHouse yayın 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} + +#### Hata Düzeltmeleri {#bug-fixes-10} + +- Her ikisini de içeren sabit uzak sorgular `LIMIT BY` ve `LIMIT`. Daha önce `LIMIT BY` ve `LIMIT` uzak sorgu için kullanıldı, `LIMIT` daha önce olabilirdi `LIMIT BY`, çok filtrelenmiş sonuca yol açtı. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) + +### ClickHouse yayın 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} + +#### Yenilik {#new-features-5} + +- İçin tam destek eklendi `Protobuf` biçim (giriş ve çıkış, iç içe veri yapıları). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) +- Kükreyen bitmapler ile bitmap fonksiyonları eklendi. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Andy Yang](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) +- Parke formatı desteği. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) +- Bulanık dize karşılaştırması için N-gram mesafesi eklendi. R dilinde q-gram ölçümlerine benzer. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) +- Özel toplama ve tutma kalıplarından grafit toplaması için kuralları birleştirin. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Katma `max_execution_speed` ve `max_execution_speed_bytes` kaynak kullanımını sınırlamak için. Katma `min_execution_speed_bytes` Tamam tolayacak ayar `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([Kış Zhang](https://github.com/zhang2014)) +- Uygulanan işlev `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) +- Eklenen fonksiyonlar `arrayEnumerateDenseRanked` ve `arrayEnumerateUniqRanked` (sanki `arrayEnumerateUniq` ancak, çok boyutlu dizilerin içine bakmak için dizi derinliğini ince ayarlamaya izin verir). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Hata Düzeltmeleri {#bug-fixes-11} + +- Bu sürüm aynı zamanda 19.3 ve 19.1 tüm hata düzeltmeleri içerir. +- Veri atlama endekslerinde Sabit hata: İNSERTTEN sonra granüllerin sırası yanlıştı. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) +- Sabit `set` Ind Forex for `Nullable` ve `LowCardinality` sütun. Ondan önce, `set` ile ind withex `Nullable` veya `LowCardinality` sütun hataya yol açtı `Data type must be deserialized with multiple streams` seçerken. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Update\_time’ı tam olarak doğru şekilde ayarlayın `executable` sözlük güncelleme. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) +- 19.3’te kırık ilerleme çubuğunu düzeltin. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) +- Belirli durumlarda bellek bölgesi küçüldüğünde Memorytracker’ın tutarsız değerleri düzeltildi. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ThreadPool sabit tanımsız davranış. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mesajla çok nadir bir kaza düzeltildi `mutex lock failed: Invalid argument` bu, bir MERGETREE tablosu bir SELECT ile aynı anda bırakıldığında gerçekleşebilir. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) +- ODBC sürücüsü ile uyumluluk `LowCardinality` veri türü. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) +- FreeBSD: için düzeltme `AIOcontextPool: Found io_event with unknown id 0` hatasız. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `system.part_log` tablo yapılandırmaya bakılmaksızın oluşturuldu. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tanımsız davranışı düzeltin `dictIsIn` önbellek sözlükler için işlev. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) +- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) +- Biz kendi elde edene kadar varsayılan olarak compile\_expressions devre dışı bırakın `llvm` contrib ve ile test edebilirsiniz `clang` ve `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) +- Önlemek `std::terminate` ne zaman `invalidate_query` için `clickhouse` dış sözlük kaynağı yanlış resultset döndürdü (boş veya birden fazla satır veya birden fazla sütun). Sabit sorun ne zaman `invalidate_query` ne olursa olsun her beş saniyede yapıldı `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kilitlenme önlemek zaman `invalidate_query` ile bir sözlük için `clickhouse` kaynak içeren oldu `system.dictionaries` tablo veya `Dictionaries` veritabanı (nadir durum). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Çapraz için düzeltmeler boş nerede ile katılmak. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) +- Fonksiyon sabit segfault “replicate” sabit argüman geçirildiğinde. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yükleme doktoru ile Lambda işlevini düzeltin. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([Kış Zhang](https://github.com/zhang2014)) +- Birden çok düzeltmeleri katıldı. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Geliştirmeler {#improvements-3} + +- Sağ tablo sütunları için JOİN on bölümündeki takma adları destekleyin. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) +- Birden fazla sonuç subselects kullanılacak doğru sonucu ismi Katıldı. Düz takma adları kaynak adları ile sonuç olarak değiştirin. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) +- Birleştirilmiş ifadeler için aşağı itme mantığını geliştirin. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([I ivanvan](https://github.com/abyss7)) + +#### Performans İyileştirmeleri {#performance-improvements-3} + +- Geliştirilmiş sezgisel “move to PREWHERE” optimizasyon. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- 8-bit ve 16-bit anahtarlar için HashTable API kullanan uygun arama tabloları kullanın. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos Kuşu](https://github.com/amosbird)) +- Dize karşılaştırma geliştirilmiş performans. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Ayrı bir iş parçacığında dağıtılmış DDL kuyruğunu temizleme, böylece dağıtılmış DDL görevlerini işleyen ana döngüyü yavaşlatmaz. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) +- Ne zaman `min_bytes_to_use_direct_io` 1 olarak ayarlanır, her dosya O\_DİRECT modu ile açılmamıştır, çünkü okunacak veri boyutu bazen sıkıştırılmış bir bloğun boyutuna göre hafife alınmıştır. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-12} + +- Clang-9 için destek eklendi [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yanlış Düzelt `__asm__` talimatlar (tekrar) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) +- Ayarları belirtmek için yeteneği ekleyin `clickhouse-performance-test` komut satırından. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) +- Entegrasyon testlerine sözlükler testleri ekleyin. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) +- Otomatik performans testlerine web sitesinde kriter sorguları eklendi. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `xxhash.h` harici lz4’te mevcut değildir, çünkü bir uygulama ayrıntısıdır ve sembolleri ile adlandır `XXH_NAMESPACE` makro. Lz4 harici olduğunda, xxHash da harici olmalı ve bağımlıların buna bağlanması gerekir. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) +- Sabit bir durumda zaman `quantileTiming` toplama işlevi, negatif veya kayan nokta argümanı ile çağrılabilir (bu, tanımsız davranış dezenfektanı ile fuzz testini düzeltir). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yazım hatası düzeltme. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) +- Mac’te derlemeyi düzeltin. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) +- FreeBSD ve çeşitli sıradışı yapı yapılandırmaları için düzeltmeler oluşturun. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) + +## ClickHouse sürümü 19.3 {#clickhouse-release-19-3} + +### ClickHouse yayın 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} + +#### Hata Düzeltmeleri {#bug-fixes-12} + +- Çökmeyi düzeltin `FULL/RIGHT JOIN` biz nullable vs değil nullable üzerinde katılırken. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-13} + +- Özel bir kullanıcıdan clickhouse-server görüntüsünü başlatmak için bir yol ekleyin [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### ClickHouse yayın 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} + +#### Hata düzeltmeleri {#bug-fixes-13} + +- \#3920’de Sabit hata. Bu hata kendisini rasgele önbellek bozulması (mesajlar) olarak gösterir `Unknown codec family code`, `Cannot seek through file`) ve segfaults. Bu hata ilk olarak 19.1 sürümünde ortaya çıktı ve 19.1.10 ve 19.3.6’ya kadar olan sürümlerde mevcut. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse yayın 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} + +#### Hata düzeltmeleri {#bug-fixes-14} + +- Bir iş parçacığı havuzunda 1000’den fazla iş parçacığı olduğunda, `std::terminate` iş parçacığı çıkışında meydana gelebilir. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi oluşturmak mümkün `ReplicatedMergeTree*` varsayılanları olmayan sütunlarda yorumlar içeren tablolar ve yorum ve varsayılanları olmayan sütun kodekleri içeren tablolar. Ayrıca codec karşılaştırmasını düzeltin. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) +- Dizi veya tuple ile katılmak sabit kazasında. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) +- Clickhouse sabit kazasında-mesaj ile fotokopi `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) +- Dağıtılmış DDL kullanılmışsa, sunucu kapanmasında sabit kapatma. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) +- Yanlış sütun numaraları, 10’dan büyük sayı ile sütunlar için ayrıştırma metin biçimi hakkında hata iletisinde yazdırıldı. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-3} + +- Avx etkin sabit yapı. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Genişletilmiş muhasebe ve IO muhasebesini, derlendiği çekirdek yerine iyi bilinen sürüme göre etkinleştirin. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) +- Core\_dump ayarını atlamaya izin ver.size\_limit, limit set başarısız olursa atmak yerine uyarı. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) +- Kaldır theılan `inline` tags of `void readBinary(...)` içinde `Field.cpp`. Ayrıca birleştirilmiş gereksiz `namespace DB` Bloklar. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) + +### ClickHouse yayın 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} + +#### Hata düzeltmeleri {#bug-fixes-15} + +- Büyük http ekleme sorguları işleme ile Sabit hata. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) +- Yanlış uygulama nedeniyle eski sürümlerle geriye dönük uyumsuzluk düzeltildi `send_logs_level` ayar. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tablo fonksiyonunun geriye dönük uyumsuzluğu düzeltildi `remote` sütun yorumları ile tanıtıldı. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse yayın 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} + +#### Geliştirmeler {#improvements-4} + +- Yaparken tablo dizin boyutu bellek sınırları için hesaplandı değil `ATTACH TABLE` sorgu. Bir tablo müstakil sonra eklenemez olasılığını Kaçınılması. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Zookeeper’dan alınan maksimum dize ve dizi boyutu üzerindeki sınırı hafifçe yükseltti. Bu artan boyutu ile çalışmaya devam sağlar `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` ZooKeeper üzerinde. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Zaten kendi kuyruğunda düğümlerin çok sayıda olsa bile terk edilmiş çoğaltma onarmak için izin verin. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bir gerekli argüman Ekle `SET` dizin (en fazla saklanan satır numarası). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) + +#### Hata Düzeltmeleri {#bug-fixes-16} + +- Sabit `WITH ROLLUP` tek grup için sonuç `LowCardinality` anahtar. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Set dizinindeki Sabit hata (daha fazlasını içeriyorsa bir granül bırakarak `max_rows` satırlar). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) +- Bir sürü FreeBSD yapı düzeltmesi. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) +- Aynı takma ad içeren alt sorgularla sorgularda sabit takma ad değiştirme (sorun [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-4} + +- Çalıştırmak için yeteneği ekleyin `clickhouse-server` docker ımage vatansız testler için. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) + +### ClickHouse yayın 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} + +#### Yenilik {#new-features-6} + +- Add theed the `KILL MUTATION` bazı nedenlerle sıkışmış olan mutasyonların giderilmesine izin veren ifade. Katma `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` alanlar için `system.mutations` daha kolay sorun giderme için tablo. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) +- Toplama fonksiyonu eklendi `entropy` Shannon entropisini hesaplar. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) +- Sorguları göndermek için yeteneği eklendi `INSERT INTO tbl VALUES (....` yarat withoutmadan sunucuya `query` ve `data` parçalar. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) +- Genel uygulama `arrayWithConstant` işlevi eklendi. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Uyguluyordu `NOT BETWEEN` karşılaştırma operatörü. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) +- Uygulamak `sumMapFiltered` değerlerin toplanacağı anahtar sayısını sınırlayabilmek için `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Desteği eklendi `Nullable` yazmak `mysql` tablo işlevi. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) +- İçinde keyfi sabit ifadeler için destek `LIMIT` yan. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) +- Katma `topKWeighted` (imzasız tamsayı) ağırlığı ile ek argüman alır toplama işlevi. [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Andrew Golman](https://github.com/andrewgolman)) +- `StorageJoin` şimdi destekler `join_any_take_last_row` aynı anahtarın varolan değerlerinin üzerine yazmayı sağlayan ayar. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos Kuşu](https://github.com/amosbird) +- Eklendi fonksiyonu `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) +- Katma `RowBinaryWithNamesAndTypes` biçimli. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) +- Katma `IPv4` ve `IPv6` veri türleri. Daha etkili uygulamalar `IPv*` işlevler. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) +- Eklendi fonksiyonu `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) +- Katma `Protobuf` çıkış biçimi. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) +- Veri içe aktarma (ekler) için HTTP arayüzü için brotli desteği eklendi. [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mikhail](https://github.com/fandyushin)) +- Kullanıcı işlev adına yazım hatası yaparken veya komut satırı istemcisinde yazarken ipuçları eklendi. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) +- Katma `Query-Id` sunucunun HTTP yanıt başlığına. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mikhail](https://github.com/fandyushin)) + +#### Deneysel özellikler {#experimental-features-2} + +- Katma `minmax` ve `set` MergeTree tablo motorları ailesi için veri atlama endeksleri. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- Eklenen dönüşüm `CROSS JOIN` -e doğru `INNER JOIN` mümkünse. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Hata Düzeltmeleri {#bug-fixes-17} + +- Sabit `Not found column` yinelenen sütunlar için `JOIN ON` bölme. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Yapmak `START REPLICATED SENDS` komut Başlat çoğaltılmış gönderir. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- Sabit toplam fonksiyonları yürütme ile `Array(LowCardinality)` değişkenler. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Yaparken yanlış davranış düzeltildi `INSERT ... SELECT ... FROM file(...)` sorgu ve dosya var `CSVWithNames` veya `TSVWIthNames` biçim ve ilk veri satırı eksik. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sözlük mevcut değilse sözlük yeniden sabit kazasında. Bu hata 19.1.6’da ortaya çıktı. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- Sabit `ALL JOIN` sağ tabloda çiftleri ile. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Sabit segmentasyon hatası `use_uncompressed_cache=1` ve yanlış sıkıştırılmamış boyutta istisna. Bu hata 19.1.6’da ortaya çıktı. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- Sabit `compile_expressions` büyük (ınt16’dan daha fazla) tarihlerin karşılaştırılması ile hata. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- Tablo işlevinden seçerken sabit sonsuz döngü `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yüklem optimizasyonunu geçici olarak devre dışı bırak `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Kış Zhang](https://github.com/zhang2014)) +- Sabit `Illegal instruction` eski CPU’larda base64 işlevlerini kullanırken hata. Bu hata yalnızca ClickHouse gcc-8 ile derlendiğinde yeniden üretildi. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit `No message received` TLS bağlantısı üzerinden PostgreSQL ODBC sürücüsü ile etkileşimde bulunurken hata. MySQL ODBC sürücüsü kullanırken de segfault giderir. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit yanlış sonuç ne zaman `Date` ve `DateTime` argümanlar koşullu operatörün dallarında kullanılır (işlev `if`). Fonksiyon için genel durum eklendi `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse sözlükler şimdi içinde yük `clickhouse` işleyiş. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit kilitlenme zaman `SELECT` ile bir tablo fromdan `File` motor sonra yeniden denendi `No such file or directory` hatasız. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Seçerken sabit yarış durumu `system.tables` verebilir `table doesn't exist` hatasız. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `clickhouse-client` etkileşimli modda çalıştırıldıysa, komut satırı önerileri için veri yüklerken çıkışta segfault yapabilir. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçeren mutasyonların yürütülmesi bir hata düzeltildi `IN` operatörler yanlış sonuçlar üretiyordu. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- Sabit hata: bir veritabanı varsa `Dictionary` motor, tüm sözlükler sunucu başlangıçta yüklemeye zorlanır ve localhost’tan ClickHouse kaynağı olan bir sözlük varsa, sözlük yüklenemez. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sistem günlükleri sunucu kapatma yeniden oluşturmak için denendiğinde hata düzeltildi. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Doğru türü doğru şekilde döndürün ve kilitleri düzgün şekilde tutun `joinGet` işlev. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Kuşu](https://github.com/amosbird)) +- Katma `sumMapWithOverflow` işlev. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Sabit segfault ile `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) +- Yanlış ile Sabit hata `Date` ve `DateTime` karşılaştırma. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- Tanımsız davranış sanitizer altında sabit fuzz testi: eklendi parametre tipi kontrol için `quantile*Weighted` fonksiyonlar ailesi. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eski veri parçalarının çıkarılması ile başarısız olabilir sabit nadir yarış durumu `File not found` hatasız. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eksik /etc/clickhouse-server/config ile paketi yükleyin.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-5} + +- Debian paketi: yapılandırmaya göre /etc/clickhouse-server/preprocessed bağlantısını düzeltin. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- FreeBSD için çeşitli yapı düzeltmeleri. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) +- Perftest’te tablolar oluşturma, doldurma ve bırakma yeteneği eklendi. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) +- Yinelenen kontrol etmek için bir komut dosyası eklendi içerir. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Performans testinde dizin sorguları çalıştırmak için yeteneği eklendi. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) +- Hata ayıklama sembolleri ile paket yüklü olması önerilir. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Performansın yeniden düzenlenmesi-test. Daha iyi günlüğü ve sinyalleri işleme. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) +- Anonimleştirilmiş yandex’e dokümanlar eklendi.Metrika veri setleri. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) +- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) +- S3’te iki veri kümesi hakkında dokümanlar eklendi. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) +- Çekme istekleri açıklamasından changelog oluşturan komut dosyası eklendi. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- ClickHouse için kukla modülü eklendi. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- Bir grup belgesiz işlev için dokümanlar eklendi. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([Kış Zhang](https://github.com/zhang2014)) +- Arm yapı düzeltmeleri. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) +- Sözlük testleri artık çalıştırmak mümkün `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) +- Şimdi `/etc/ssl` SSL sertifikaları ile varsayılan dizin olarak kullanılır. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Başlangıçta SSE ve AVX talimat kontrol eklendi. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) +- İnit betiği, başlayana kadar sunucuyu bekleyecektir. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) + +#### Geriye Dönük Uyumsuz Değişiklikler {#backward-incompatible-changes-1} + +- Kaldırıyordu `allow_experimental_low_cardinality_type` ayar. `LowCardinality` veri türleri üretime hazırdır. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kullanılabilir bellek miktarına göre işaretle önbellek boyutunu ve sıkıştırılmamış önbellek boyutunu azaltın. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) +- Eklenen anahtar kelime `INDEX` içinde `CREATE TABLE` sorgu. Adı olan bir sütun `index` backticks veya çift tırnak ile alıntı olmalıdır: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) +- `sumMap` şimdi taşma yerine sonuç türünü tanıtın. Eskiler `sumMap` davranış kullanılarak elde edilebilir `sumMapWithOverflow` işlev. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) + +#### Performans İyileştirmeleri {#performance-improvements-4} + +- `std::sort` yerine göre `pdqsort` olmadan sorgular için `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) +- Şimdi sunucu, genel iş parçacığı havuzundan iş parçacıklarını yeniden kullanır. Bu, bazı köşe durumlarda performansı etkiler. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Geliştirmeler {#improvements-5} + +- FreeBSD için AIO desteği uygulandı. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `SELECT * FROM a JOIN b USING a, b` şimdi geri dön `a` ve `b` sadece sol tablodan sütunlar. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) +- Vermek `-C` olarak çalışmak için müşterinin seçeneği `-c` seçenek. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) +- Şimdi seçenek `--password` değer olmadan kullanılan stdın’den şifre gerektirir. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) +- İçeren dize değişmezleri unescaped metacharacters eklendi vurgulama `LIKE` ifadeler veya regexps. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İstemci soketi kaybolursa HTTP salt okunur sorgularının iptal edilmesi eklendi. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) +- Şimdi sunucu, istemci bağlantılarını canlı tutmak için ilerlemeyi bildiriyor. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([I ivanvan](https://github.com/abyss7)) +- Sorgu ile OPTİMİZE etmek için biraz daha iyi mesaj `optimize_throw_if_noop` ayar Etkin. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Desteği eklendi `--version` clickhouse sunucusu için Seçenek. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) +- Katma `--help/-h` seçeneği `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) +- Toplam işlev durumu sonucu ile skaler alt sorgular için destek eklendi. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Geliştirilmiş sunucu kapatma süresi ve bekleme süresini değiştirir. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sisteme replicated\_can\_become\_leader ayarı hakkında bilgi eklendi.yinelemeler ve çoğaltma lider olmaya çalışmayacaksa günlüğü ekleyin. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) + +## ClickHouse sürümü 19.1 {#clickhouse-release-19-1} + +### ClickHouse sürümü 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} + +- Sabit hata `Column ... queried more than once` bu ayar eğer gerçekleşebilir `asterisk_left_columns_only` kullanılması durumunda 1 olarak ayarlanır `GLOBAL JOIN` ile `SELECT *` (nadir bir durum). Sorun 19.3 ve daha yeni sürümlerde mevcut değil. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) + +### ClickHouse sürümü 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} + +Bu sürüm, 19.3.7 ile tam olarak aynı yamalar kümesini içerir. + +### ClickHouse sürümü 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} + +Bu sürüm, 19.3.6 ile tam olarak aynı yamalar kümesini içerir. + +## ClickHouse sürümü 19.1 {#clickhouse-release-19-1-1} + +### ClickHouse sürümü 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} + +#### Hata düzeltmeleri {#bug-fixes-18} + +- Yanlış uygulama nedeniyle eski sürümlerle geriye dönük uyumsuzluk düzeltildi `send_logs_level` ayar. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tablo fonksiyonunun geriye dönük uyumsuzluğu düzeltildi `remote` sütun yorumları ile tanıtıldı. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} + +#### Hata Düzeltmeleri {#bug-fixes-19} + +- Eksik /etc/clickhouse-server/config ile paketi yükleyin.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +## ClickHouse sürümü 19.1 {#clickhouse-release-19-1-2} + +### ClickHouse sürümü 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} + +#### Hata Düzeltmeleri {#bug-fixes-20} + +- Doğru türü doğru şekilde döndürün ve kilitleri düzgün şekilde tutun `joinGet` işlev. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Kuşu](https://github.com/amosbird)) +- Sistem günlükleri sunucu kapatma yeniden oluşturmak için denendiğinde hata düzeltildi. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit hata: bir veritabanı varsa `Dictionary` motor, tüm sözlükler sunucu başlangıçta yüklemeye zorlanır ve localhost’tan ClickHouse kaynağı olan bir sözlük varsa, sözlük yüklenemez. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçeren mutasyonların yürütülmesi bir hata düzeltildi `IN` operatörler yanlış sonuçlar üretiyordu. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- `clickhouse-client` etkileşimli modda çalıştırıldıysa, komut satırı önerileri için veri yüklerken çıkışta segfault yapabilir. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Seçerken sabit yarış durumu `system.tables` verebilir `table doesn't exist` hatasız. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit kilitlenme zaman `SELECT` ile bir tablo fromdan `File` motor sonra yeniden denendi `No such file or directory` hatasız. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bir sorun düzeltildi: yerel ClickHouse sözlükleri TCP üzerinden yüklenir, ancak işlem içinde yüklenmelidir. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit `No message received` TLS bağlantısı üzerinden PostgreSQL ODBC sürücüsü ile etkileşimde bulunurken hata. MySQL ODBC sürücüsü kullanırken de segfault giderir. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yüklem optimizasyonunu geçici olarak devre dışı bırak `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Kış Zhang](https://github.com/zhang2014)) +- Tablo işlevinden seçerken sabit sonsuz döngü `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit `compile_expressions` büyük (ınt16’dan daha fazla) tarihlerin karşılaştırılması ile hata. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) +- Sabit segmentasyon hatası `uncompressed_cache=1` ve yanlış sıkıştırılmamış boyutta istisna. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) +- Sabit `ALL JOIN` sağ tabloda çiftleri ile. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- Yaparken yanlış davranış düzeltildi `INSERT ... SELECT ... FROM file(...)` sorgu ve dosya var `CSVWithNames` veya `TSVWIthNames` biçim ve ilk veri satırı eksik. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit toplam fonksiyonları yürütme ile `Array(LowCardinality)` değişkenler. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Debian paketi: yapılandırmaya göre /etc/clickhouse-server/preprocessed bağlantısını düzeltin. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- Tanımsız davranış sanitizer altında sabit fuzz testi: eklendi parametre tipi kontrol için `quantile*Weighted` fonksiyonlar ailesi. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yapmak `START REPLICATED SENDS` komut Başlat çoğaltılmış gönderir. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) +- Sabit `Not found column` join on bölümündeki yinelenen sütunlar için. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- Şimdi `/etc/ssl` SSL sertifikaları ile varsayılan dizin olarak kullanılır. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sözlük mevcut değilse sözlük yeniden sabit kazasında. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- Yanlış ile Sabit hata `Date` ve `DateTime` karşılaştırma. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- Sabit yanlış sonuç ne zaman `Date` ve `DateTime` argümanlar koşullu operatörün dallarında kullanılır (işlev `if`). Fonksiyon için genel durum eklendi `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +### ClickHouse sürümü 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} + +#### Yenilik {#new-features-7} + +- Tablolar için sütun sıkıştırma codec başına özel. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [Kış Zhang](https://github.com/zhang2014), [Anatoly](https://github.com/Sindbag)) +- Eklendi sıkıştırma codec `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) +- İzin ver `ALTER` sıkıştırma codec. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) +- Eklenen fonksiyonlar `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` SQL standart uyumluluk için. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) +- Yazma desteği `HDFS` tablolar ve `hdfs` tablo işlevi. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) +- Büyük samanlıkta birden fazla sabit dizeleri aramak için fonksiyonlar eklendi: `multiPosition`, `multiSearch` ,`firstMatch` ayrıca ile `-UTF8`, `-CaseInsensitive`, ve `-CaseInsensitiveUTF8` varyantlar. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) +- Kullanılmayan parçaların budaması `SELECT` sharding anahtarına göre sorgu filtreleri (ayar `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [I ivanvan](https://github.com/abyss7)) +- Vermek `Kafka` blok başına bazı ayrıştırma hatalarını görmezden gelmek için motor. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([I ivanvan](https://github.com/abyss7)) +- İçin destek eklendi `CatBoost` multiclass modelleri değerlendirme. İşlev `modelEvaluate` multiclass modelleri için sınıf başına ham tahminleri ile tuple döndürür. `libcatboostmodel.so` ile inşa edilmelidir [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Eklenen fonksiyonlar `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) +- Karma fonksiyonları eklendi `xxHash64` ve `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) +- Katma `gccMurmurHash` aynı karma tohumu kullanan karma işlevi (GCC aromalı üfürüm hash) [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) +- Karma fonksiyonları eklendi `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) +- Eklenen tablo fonksiyonu `remoteSecure`. Fonksiyonu olarak çalışır `remote`, ancak güvenli bağlantı kullanır. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) + +#### Deneysel özellikler {#experimental-features-3} + +- Birden fazla Katıl emımlı em emülasyon eklendi (`allow_experimental_multiple_joins_emulation` ayar). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) + +#### Hata Düzeltmeleri {#bug-fixes-21} + +- Yapmak `compiled_expression_cache_size` bellek tüketimini azaltmak için varsayılan olarak sınırlı ayarı. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) +- Çoğaltılmış tabloların değiştirmelerini gerçekleştiren iş parçacıklarında ve zookeeper’dan yapılandırmayı güncelleyen iş parçacıklarında hangup’lara yol açan bir hatayı düzeltin. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) +- Dağıtılmış bir ALTER görevi yürütürken bir yarış durumu düzeltildi. Yarış durumu, görevi yürütmeye çalışan birden fazla kopyaya ve bir ZooKeeper hatasıyla başarısız olan tüm kopyalara yol açtı. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) +- Bir hatayı düzeltin `from_zk` zookeeper zaman aşımına uğradıktan sonra yapılandırma öğeleri yenilenmedi. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) +- IPv4 alt ağ maskeleri için yanlış önek ile hatayı düzeltin. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) +- Sabit kaza (`std::terminate`) nadir durumlarda, tükenmiş kaynaklar nedeniyle yeni bir iş parçacığı oluşturulamazsa. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fix hata ne zaman `remote` In için yanlış kısıtlamalar kullanıldığında tablo işlevi yürütme `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) +- Netlink soketleri sızıntısını düzeltin. Hiçbir zaman silinmedikleri bir havuza yerleştirildiler ve tüm geçerli soketler kullanımda olduğunda yeni bir iş parçacığının başlangıcında yeni soketler oluşturuldu. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) +- Kapanış ile hatayı düzeltin `/proc/self/fd` tüm fds’den önceki dizin okundu `/proc` çatal sonra `odbc-bridge` alt işlem. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) +- Birincil anahtarda kullanım dizesi durumunda uint monotonik dönüşüm için sabit dize. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([Kış Zhang](https://github.com/zhang2014)) +- Tamsayı dönüşüm fonksiyonu Monotonluk hesaplanmasında Sabit hata. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit segfault içinde `arrayEnumerateUniq`, `arrayEnumerateDense` bazı geçersiz argümanlar durumunda işlevler. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- STORAGEMERGE’DE ub’yi düzeltin. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos Kuşu](https://github.com/amosbird)) +- Fonksiyonlarda sabit segfault `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit hata: fonksiyonlar `round`, `floor`, `trunc`, `ceil` tamsayı argümanı ve büyük negatif ölçekte yürütüldüğünde sahte sonuç döndürebilir. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tarafından uyarılan bir hata düzeltildi ‘kill query sync’ bu da bir çekirdek çöplüğüne yol açar. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) +- Boş çoğaltma kuyruğundan sonra uzun gecikmeyle hatayı düzeltin. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) +- İle tabloya ekleme durumunda sabit aşırı bellek kullanımı `LowCardinality` birincil anahtar. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Sabit `LowCardinality` için serileştirme `Native` boş diziler durumunda format. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Tek LowCardinality sayısal sütun tarafından dıstınct kullanırken yanlış sonuç düzeltildi. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- LowCardinality anahtarı ile sabit özel toplama (durumunda `compile` ayar etkinse) ’ dir. [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Çoğaltılmış tablo sorguları için kullanıcı ve şifre iletimini düzeltin. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) +- Sözlükleri yeniden yüklerken sözlük veritabanındaki tabloları listelerken oluşabilecek çok nadir yarış durumu düzeltildi. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Toplaması veya küp ile kullanıldığında yanlış sonuç düzeltildi. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Sam Chou](https://github.com/reflection)) +- Sorgu için sabit sütun takma adları `JOIN ON` sözdizimi ve dağıtılmış tablolar. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([Kış Zhang](https://github.com/zhang2014)) +- Dahili uygulamada Sabit hata `quantileTDigest` (Artem Vakhrushev tarafından bulundu). Bu hata hiçbir zaman Clickhouse’da olmaz ve yalnızca ClickHouse kod tabanını doğrudan bir kütüphane olarak kullananlar için geçerlidir. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Geliştirmeler {#improvements-6} + +- İçin destek `IF NOT EXISTS` içinde `ALTER TABLE ADD COLUMN` ile birlikte ifadeler `IF EXISTS` içinde `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) +- İşlev `parseDateTimeBestEffort`: format desteği `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` ve benzeri. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- `CapnProtoInputStream` şimdi pürüzlü yapıları destekleyin. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) +- Kullanılabilirlik iyileştirme: sunucu işleminin veri dizininin sahibinden başlatıldığı bir kontrol eklendi. Veriler kök olmayan kullanıcıya aitse, sunucunun kökünden başlatılmasına izin vermeyin. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-v-galtsev](https://github.com/sergey-v-galtsev)) +- Birleştirme ile sorguların analizi sırasında gerekli sütunları kontrol etmenin daha iyi mantığı. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) +- Tek bir sunucuda çok sayıda dağıtılmış tablo durumunda bağlantı sayısını azalttı. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([Kış Zhang](https://github.com/zhang2014)) +- Desteklenen toplamlar için satır `WITH TOTALS` ODBC sürücüsü için sorgu. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) +- Kullanmasına izin `Enum`eğer fonksiyon içinde tamsayılar olarak s. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([I ivanvan](https://github.com/abyss7)) +- Katma `low_cardinality_allow_in_native_format` ayar. Devre dışı bırakılırsa, kullanmayın `LowCadrinality` yazmak `Native` biçimli. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Daha düşük bellek kullanımı için derlenmiş ifadeler önbelleğinden bazı gereksiz nesneleri kaldırıldı. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) +- Add check that `SET send_logs_level = 'value'` sorgu uygun değeri kabul eder. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) +- Sabit veri türü türü dönüştürme işlevleri kontrol edin. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([Kış Zhang](https://github.com/zhang2014)) + +#### Performans İyileştirmeleri {#performance-improvements-5} + +- MergeTree ayarı ekleme `use_minimalistic_part_header_in_zookeeper`. Etkinse, çoğaltılmış tablolar kompakt parça meta verilerini tek parça znode depolar. Bu, ZooKeeper anlık görüntü boyutunu önemli ölçüde azaltabilir (özellikle tablolarda çok fazla sütun varsa). Bu ayarı etkinleştirdikten sonra, desteklemeyen bir sürüme indiremeyeceğinizi unutmayın. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) +- İşlevler için DFA tabanlı bir uygulama ekleyin `sequenceMatch` ve `sequenceCount` durumda desen zaman içermez. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- Tam sayı serileştirme için performans iyileştirme. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos Kuşu](https://github.com/amosbird)) +- Sıfır sol dolgu PODArray böylece -1 öğesi her zaman geçerli ve sıfırlanır. Ofsetlerin dalsız hesaplanması için kullanılır. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos Kuşu](https://github.com/amosbird)) +- Döndürüyordu `jemalloc` performans düşüşüne yol sürüm. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Geriye Dönük Uyumsuz Değişiklikler {#backward-incompatible-changes-2} + +- Kaldırılan belgesiz özellik `ALTER MODIFY PRIMARY KEY` çünkü onun yerini aldı. `ALTER MODIFY ORDER BY` komut. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) +- Kaldırılan işlev `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Türün sonucu ile skaler alt sorguları kullanmayı yasaklayın `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([I ivanvan](https://github.com/abyss7)) + +#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-6} + +- PowerPC için destek eklendi (`ppc64le`) yapmak. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) +- Duruma göre fonksiyonel testlerin ortak kullanılabilir veri kümesi üzerinde çalışır. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sunucu ile başlatılamıyor Sabit hata `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` Docker veya systemd-nspawn içindeki mesaj. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Güncel `rdkafka` kütüphane v1.0.0-RC5 için. Ham c arayüzü yerine cppkafka kullanılır. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([I ivanvan](https://github.com/abyss7)) +- Güncel `mariadb-client` kitaplık. UBSan tarafından bulunan sorunlardan biri düzeltildi. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- UBSan için bazı düzeltmeler oluşturur. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- UBSan yapı ile testlerin başına taahhüt ishal eklendi. +- PVS-Studio statik analyzer başına taahhüt ishal eklendi. +- PVS-Studio tarafından bulunan sabit hatalar. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit glibc uyumluluk sorunları. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Docker resimlerini 18.10’a taşıyın ve glibc \>= 2.28 için uyumluluk dosyası ekleyin [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) +- Kullanıcı sunucu Docker görüntü dizinleri chown istemiyorsanız env değişken ekleyin. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) +- Gelen uyar theıların en etkin `-Weverything` çınlama içinde. Etkin `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sadece clang 8’de bulunan birkaç uyarı daha eklendi. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bağlanmak `libLLVM` paylaşılan bağlantı kullanırken bireysel LLVM libs yerine. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) +- Test görüntüleri için sanitizer değişkenleri eklendi. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) +- `clickhouse-server` debian paketi tavsiye edecek `libcap2-bin` kullanmak için paket `setcap` yetenekleri ayarlamak için bir araç. Bu isteğe bağlıdır. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Geliştirilmiş derleme süresi, sabit içerir. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) +- Karma fonksiyonlar için performans testleri eklendi. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) +- Sabit döngüsel kütüphane bağımlılıkları. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) +- Düşük kullanılabilir bellek ile geliştirilmiş derleme. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) +- Performans düşüşünü yeniden oluşturmak için test betiği eklendi `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yorumlarda ve dize değişmezlerinde sabit yazım hataları `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) +- Yorumlarda sabit yazım hataları. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) + +## [2018 için Changelog](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/tr/whats-new/changelog/index.md b/docs/tr/whats-new/changelog/index.md new file mode 100644 index 00000000000..f569702f7e7 --- /dev/null +++ b/docs/tr/whats-new/changelog/index.md @@ -0,0 +1,668 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_folder_title: Changelog +toc_priority: 74 +toc_title: '2020' +--- + +## ClickHouse sürüm V20. 3 {#clickhouse-release-v20-3} + +### ClickHouse yayın V20.3. 4. 10, 2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} + +#### Hata Düzeltme {#bug-fix} + +- Bu sürüm ayrıca 20.1.8.41 tüm hata düzeltmeleri içerir +- Eksik düzeltme `rows_before_limit_at_least` http üzerinden sorgular için (işlemciler boru hattı ile). Bu düzeltmeler [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +### ClickHouse yayın V20.3. 3. 6, 2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} + +#### Hata Düzeltme {#bug-fix-1} + +- Bu sürüm ayrıca 20.1.7.38 tüm hata düzeltmeleri içerir +- Kullanıcı önceki sürümde mutasyonlar yürüttüyse, çoğaltmanın çalışmasına izin vermeyen bir çoğaltmada hatayı düzeltin. Bu düzeltmeler [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). 20.3 sürümünü tekrar geriye dönük uyumlu hale getirir. +- Ayar Ekle `use_compact_format_in_distributed_parts_names` hangi dosyaları yazmak için izin verir `INSERT` içine sorgular `Distributed` daha kompakt formatlı tablo. Bu düzeltmeler [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). 20.3 sürümünü tekrar geriye dönük uyumlu hale getirir. + +### ClickHouse yayın V20.3. 2. 1, 2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change} + +- Sorunu düzelt fixedildi `file name too long` için veri gönderirken `Distributed` çok sayıda çoğaltma için tablolar. Çoğaltma kimlik bilgileri sunucu günlüğüne maruz sorunu düzeltildi. Diskteki dizin adı biçimi değiştirildi `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) Yeni sürüme yükselttikten sonra, eski sunucu sürümü yeni dizin biçimini tanımadığı için manuel müdahale olmadan düşüremezsiniz. Downgrade yapmak istiyorsanız, ilgili dizinleri eski biçime el ile yeniden adlandırmanız gerekir. Bu değişiklik yalnızca zaman uyumsuz kullandıysanız geçerlidir `INSERT`s to `Distributed` Tablolar. 20.3.3 sürümünde, yeni formatı kademeli olarak etkinleştirmenize izin verecek bir ayar sunacağız. +- Mutasyon komutları için çoğaltma günlük girişlerinin biçimini değiştirdi. Yeni sürümü yüklemeden önce eski mutasyonların işlenmesini beklemeniz gerekir. +- Stacktraces döker basit bellek profiler uygulamak `system.trace_log` her n bayt yumuşak ayırma sınırı üzerinde [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([I ivanvan](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov) Olan ) sütun `system.trace_log` ’den değiştirildi `timer_type` -e doğru `trace_type`. Bu, üçüncü taraf performans analizi ve flamegraph işleme araçlarında değişiklikler gerektirecektir. +- İç iş parçacığı numarası yerine her yerde OS iş parçacığı kimliğini kullanın. Bu düzeltmeler [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Yaş `clickhouse-client` sunucu ne zaman ayarı gönderme günlükleri alınamıyor `send_logs_level` yapılandırılmış günlük iletilerinin adları ve türleri değiştirildiğinden etkindir. Öte yandan, farklı sunucu sürümleri birbirine farklı türlerde günlükleri gönderebilir. Kullan whenmay theınca `send_logs_level` ayar, umursamamalısın. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kaldırmak `indexHint` işlev [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kaldırmak `findClusterIndex`, `findClusterValue` işlevler. Bu düzeltmeler [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). Bu işlevleri kullanıyorsanız, bir e-posta gönderin `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi sütun oluşturmak veya sütun eklemek için izin verilmez `SELECT` varsayılan ifade olarak alt sorgu. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) +- JOİN alt sorgular için takma adlar gerektirir. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) +- Gelişmiş `ALTER MODIFY/ADD` sorgu mantığı. Şimdi yapamazsın `ADD` türü olmayan sütun, `MODIFY` varsayılan ifade sütun türünü değiştirmez ve `MODIFY` tür varsayılan ifade değerini kaybetmez. Düzeltiyor [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) +- Günlük yapılandırma değişiklikleri uygulamak için yeniden başlatılması için sunucu gerektirir. Bu, sunucunun silinmiş bir günlük dosyasına oturum açtığı hatayı önlemek için geçici bir geçici çözümdür (bkz. [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Ayar `experimental_use_processors` varsayılan olarak etkinleştirilir. Bu ayar, yeni sorgu potansiyel kullanımını sağlar. Bu dahili refactoring ve görünür bir değişiklik beklemiyoruz. Eğer herhangi bir sorun göreceksiniz, sıfır geri ayarlayın. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Yenilik {#new-feature} + +- Eklemek `Avro` ve `AvroConfluent` giriş / çıkış biçimleri [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Süresi dolmuş anahtarların çok iş parçacıklı ve engellenmeyen güncellemeleri `cache` sözlükler (eskileri okumak için isteğe bağlı izin ile). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Sorgu Ekle `ALTER ... MATERIALIZE TTL`. Süresi dolmuş verileri TTL ile kaldırmaya zorlayan mutasyonu çalıştırır ve TTL ile ilgili meta bilgileri tüm kısımlarda yeniden hesaplar. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) +- Gerekirse Hashjoin’den Mergejoin’e (diskte) geçin [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) +- Katma `MOVE PARTITION` için komut `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Anında yapılandırma dosyasından depolama yapılandırmasını yeniden yükleme. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Değiştirmek için izin `storage_policy` daha az zengin olana. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) +- S3 depolama ve masa fonksiyonu için globs/joker karakterler için destek eklendi. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Uygulamak `bitAnd`, `bitOr`, `bitXor`, `bitNot` için `FixedString(N)` datatype. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Eklendi fonksiyonu `bitCount`. Bu düzeltmeler [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ıkopylov](https://github.com/ikopylov)) +- Eklemek `generateRandom` verilen şema ile rastgele satırlar oluşturmak için tablo işlevi. Rasgele test tablosunu verilerle doldurmaya izin verir. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) +- `JSONEachRowFormat`: destek özel durumda zaman nesneleri üst düzey dizi içine. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) +- Şimdi bir sütun oluşturmak mümkün `DEFAULT` varsayılan bir sütuna bağlı olan ifade `ALIAS` ifade. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) +- Belirtmek için izin ver `--limit` kaynak veri boyutundan daha fazla `clickhouse-obfuscator`. Veri farklı rastgele tohum ile kendini tekrar edecektir. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Katma `groupArraySample` fonksiyonu (benzer `groupArray`) rezervuar örnekleme algoritması ile. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos Kuşu](https://github.com/amosbird)) +- Şimdi güncelleme kuyruğunun boyutunu izleyebilirsiniz `cache`/`complex_key_cache` sistem metrikleri aracılığıyla sözlükler. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Crlf’yi CSV çıkış biçiminde bir hat ayırıcı olarak ayarlamaya izin ver `output_format_csv_crlf_end_of_line` 1 set [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) +- Daha fazla işlev uygulamak [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` ve `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) +- Yeni ayar tanıt introducedıldı: `max_parser_depth` maksimum yığın boyutunu kontrol etmek ve büyük karmaşık sorgulara izin vermek. Bu düzeltmeler [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) ve [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) +- Ayar ekleme `force_optimize_skip_unused_shards` kullanılmayan parçaların atlanması mümkün değilse atma ayarı [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) +- Göndermek için veri depolamak için birden fazla Disk/birim yapılandırmaya izin ver `Distributed` motor [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) +- Destek depolama politikası (``) geçici veri depolamak için. [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) +- Katma `X-ClickHouse-Exception-Code` Özel durum veri göndermeden önce atıldı, ayarlanmış http üstbilgisi. Bu uygular [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) +- Eklendi fonksiyonu `ifNotFinite`. Bu sadece sözdizimsel bir şeker: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Katma `last_successful_update_time` sütun içinde `system.dictionaries` Tablo [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Eklemek `blockSerializedSize` işlev (sıkıştırma olmadan diskte boyut) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) +- Fonksiyon Ekle `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) +- Eklenen sistem tabloları `system.zeros` ve `system.zeros_mt` yanı sıra masal fonksiyonları `zeros()` ve `zeros_mt()`. Tablolar (ve tablo işlevleri) adı ile tek sütun içerir `zero` ve tip `UInt8`. Bu sütun sıfır içerir. Birçok satır oluşturmak için en hızlı yöntem olarak test amaçları için gereklidir. Bu düzeltmeler [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) + +#### Deneysel Özellik {#experimental-feature} + +- Yeni kompakt parça formatı ekleyin `MergeTree`- tüm sütunların tek bir dosyada saklandığı aile tabloları. Küçük ve sık insertlerin performansını artırmaya yardımcı olur. Eski biçim (sütun başına bir dosya) şimdi geniş olarak adlandırılır. Veri depolama biçimi ayarları tarafından kontrol edilir `min_bytes_for_wide_part` ve `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) +- S3 depolama için destek `Log`, `TinyLog` ve `StripeLog` Tablolar. [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) + +#### Hata Düzeltme {#bug-fix-2} + +- Günlük mesajlarında sabit tutarsız whitespaces. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İsimsiz dizilerin dizilerinin tablo oluşturulmasında iç içe geçmiş yapılar olarak düzleştirildiği hatayı düzeltin. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) +- Sorunu ne zaman düzeltildi “Too many open files” glob deseniyle eşleşen çok fazla dosya varsa hata oluşabilir `File` tablo veya `file` tablo işlevi. Şimdi dosyalar tembel açılır. Bu düzeltmeler [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bırak geçici tablo şimdi sadece geçici tablo düşer. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) +- Sunucuyu kapattığımızda veya bir tabloyu AYIRDIĞIMIZDA/EKLEDİĞİMİZDE eski bölümü kaldırın. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Varsayılan diskin boş alanı nasıl hesapladığı için `data` dizin. Boş alan miktarı doğru hesaplanmazsa sorunu düzeltildi `data` dizin ayrı bir cihaza monte edilir (nadir durum). Bu düzeltmeler [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) +- In () ınside ile virgül (çapraz) birleşmesine izin ver. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) +- WHERE bölümünde operatör gibi \[değil\] varsa, iç BİRLEŞİME çapraz yeniden yazmaya izin verin. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) +- Sonra olası yanlış sonucu düzeltin `GROUP BY` etkin ayarı ile `distributed_aggregation_memory_efficient`. Düzeltiyor [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Bulunan anahtarlar önbellek sözlüklerinin metriklerinde cevapsız olarak sayıldı. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Çoğaltma protokolü uyumsuzluğunu düzeltme [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- Sabit yarış durumu `queue_task_handle` başlangıçta `ReplicatedMergeTree` Tablolar. [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Belirteç `NOT` işe yar inamadı `SHOW TABLES NOT LIKE` sorgu [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fonksiyona Aralık kontrolü eklendi `h3EdgeLengthM`. Bu kontrol olmadan, arabellek taşması mümkündür. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Birden argümanlar (10’dan fazla) üçlü mantıksal OPs toplu hesaplamalarda bir hata düzeltildi. [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) +- Segfaults’a yol açabilecek prewhere optimizasyonunun hatasını düzeltin veya `Inconsistent number of columns got from MergeTreeRangeReader` özel. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) +- Beklenmeyen düzeltme `Timeout exceeded while reading from socket` zaman aşımı gerçekten aşıldı ve sorgu profiler etkinleştirildiğinde önce güvenli bağlantıda rasgele olur özel durum. Ayrıca ekleyin `connect_timeout_with_failover_secure_ms` ayarlar (varsayılan 100 MS), hangi benzer `connect_timeout_with_failover_ms`, ancak güvenli bağlantılar için kullanılır (çünkü SSL el sıkışması normal TCP bağlantısından daha yavaştır) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) +- Mutasyon ile devlet asmak olabilir mutasyonlar sonuçlandırılması ile Fix hata `parts_to_do=0` ve `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) +- İle Yeni herhangi bir birleştirme mantığı kullanın `partial_merge_join` ayar. Yapmak mümkün `ANY|ALL|SEMI LEFT` ve `ALL INNER` ile birleş joinsir `partial_merge_join=1` şimdi. [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) +- Shard şimdi bir istisna atmak yerine başlatıcıdan gelen ayarları shard’ın constaintlerine sıkıştırıyor. Bu düzeltme, başka bir kısıtlamalarla bir parçaya sorgular göndermeye izin verir. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) +- Sabit bellek yönetimi sorunu `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Düzeltmek `toDecimal*OrNull()` dize ile çağrıldığında işlevler ailesi `e`. Düzeltiyor [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) +- Emin olun `FORMAT Null` istemciye hiçbir veri gönderir. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Bu zaman damgasını düzeltin `LiveViewBlockInputStream` güncellenmeyecek. `LIVE VIEW` deneysel bir özelliktir. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) +- Sabit `ALTER MODIFY TTL` eski TTL ifadelerini silmeye izin vermeyen yanlış davranış. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Mergetreeındexset sabit UBSan raporu. Bu düzeltmeler [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Davranışı Düzelt theildi `match` ve `extract` haystack sıfır bayt olduğunda işlevler. Haystack sabit olduğunda davranış yanlıştı. Bu düzeltmeler [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Apache Avro 3. parti kütüphanesinde yıkıcıdan atmaktan kaçının. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) +- Bir toplu işlem yoklama `Kafka` kısmen verilerde deliklere yol açabilir. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) +- Düzeltmek `joinGet` null dönüş türleri ile. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos Kuşu](https://github.com/amosbird)) +- Sıkıştırıldığında veri uyumsuzluğunu düzeltin `T64` codec. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Veri türü kimliklerini düzeltin `T64` etkilenen sürümlerde yanlış (de)sıkıştırmaya yol açan sıkıştırma codec bileşeni. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) +- Ayar Ekle `enable_early_constant_folding` ve hatalara yol açan bazı durumlarda devre dışı bırakın. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) +- Pushdown predicate optimizer’ı görünümle düzeltin ve Testi etkinleştirin [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([Kış Zhang](https://github.com/zhang2014)) +- Segfault’u düzeltin `Merge` tablo readinglardan, okuma sırasında meydana gelebilecek `File` depolamalar [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) +- Depolama politikası için bir kontrol eklendi `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. Aksi takdirde, yeniden başlatıldıktan sonra parçanın verilerini erişilemez hale getirebilir ve Clickhouse’un başlatılmasını önleyebilir. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Tablo için ayarlanmış TTL varsa, değişiklikleri düzeltin. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) +- Ne zaman gerçekleşebilecek yarış durumunu düzeltin `SYSTEM RELOAD ALL DICTIONARIES` bazı sözlük değiştirilirken/eklenirken/kaldırılırken yürütülür. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) +- Önceki sürümlerde `Memory` Veritabanı Altyapısı boş veri yolu kullanır, böylece tablolar `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) +- Varsayılan disk veya ilke eksik hakkında sabit yanlış günlük mesajları. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Dizi türlerinin bloom\_filter dizini için değil(has()) düzeltin. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) +- Bir tablodaki ilk sütunlara izin ver `Log` motor takma isim ol [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([I ivanvan](https://github.com/abyss7)) +- Okurken aralıkların sırasını düzeltin `MergeTree` bir iş parçacığı tablo. İstisn fromalara yol açabilir `MergeTreeRangeReader` veya yanlış sorgu sonuçları. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) +- Yapmak `reinterpretAsFixedString` dönmek `FixedString` yerine `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) +- Kullanıcı yanlış hata mesajı alabildiğinde son derece nadir durumlardan kaçının (`Success` ayrıntılı hata açıklaması yerine). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kullanırken çökmesine etmeyin `Template` boş satır şablonu ile biçimlendirin. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Sistem tabloları için meta veri dosyaları yanlış yerde oluşturulabilir [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix)) Düzeltiyor [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). +- Önbellek sözlüğünde exception\_ptr üzerindeki veri yarışını düzeltin [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Sorgu için bir özel durum atmayın `ATTACH TABLE IF NOT EXISTS`. Daha önce tablo zaten varsa atıldı, buna rağmen `IF NOT EXISTS` yan. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) +- Özel durum mesajında eksik kapanış paren düzeltildi. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mesajdan kaçının `Possible deadlock avoided` etkileşimli modda clickhouse-client başlangıcında. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Base64 kodlanmış değerin sonunda dolgu hatalı biçimlendirilmiş olabilir sorunu düzeltildi. Base64 kütüphanesini güncelleyin. Bu düzeltmeler [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), yaklar [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Veri kaybını önlemek `Kafka` nadir durumlarda istisna sonek okuduktan sonra ancak taahhütten önce gerçekleşir. Düzeltiyor [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) +- Sabit istisna `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) +- Bir kullanıcı denediğinde çökmeyi düzeltin `ALTER MODIFY SETTING` eski formatlı için `MergeTree` masa motorları ailesi. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- Json ile ilgili işlevlerde Int64’e uymayan Uİnt64 numaraları için destek. Master simdjson güncelleyin. Bu düzeltmeler [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kesinlikle monotinik olmayan fonksiyonel indeks kullanıldığında ters yüklemlerin sabit yürütülmesi. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) +- Kat trylamaya çalış trymayın `IN` sabit in `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos Kuşu](https://github.com/amosbird)) +- Hatayı düzeltin `ALTER DELETE` endeks bozulmasına yol açan mutasyonlar. Bu düzeltmeler [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) ve [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). Ayrıca son derece nadir yarış koşullarını düzeltin `ReplicatedMergeTree` `ALTER` sorgular. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) +- Zaman ayarı `compile_expressions` etkin mi, alabilirsiniz `unexpected column` içinde `LLVMExecutableFunction` kullan whendığımızda `Nullable` tür [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) +- İçin çoklu düzeltmeler `Kafka` motor: 1) tüketici grubu rebalance sırasında görünen çiftleri düzeltin. 2) nadir düzeltmek ‘holes’ veriler bir anket ile birkaç bölümden yoklandığında ve kısmen işlendiğinde ortaya çıktı (şimdi her zaman tüm anketli mesaj bloğunu işliyoruz / işliyoruz). 3) blok boyutuna göre yıkamaları düzeltin (bundan önce sadece zaman aşımı ile kızarma düzgün çalışıyordu). 4) daha iyi abonelik prosedürü (atama geri bildirimi ile). 5) testlerin daha hızlı çalışmasını sağlayın (varsayılan aralıklarla ve zaman aşımlarıyla). Verilerin daha önce blok boyutuna göre temizlenmemesi nedeniyle (belgelere göre olması gerektiği gibi), bu PR, varsayılan ayarlarla bazı performans düşüşlerine yol açabilir(daha sık ve daha az optimal olan daha küçük yıkama nedeniyle). Bu değişiklikten sonra performans sorunuyla karşılaşırsanız-lütfen artırın `kafka_max_block_size` tabloda daha büyük değere (örneğin `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Düzeltiyor [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) +- Düzeltmek `Parameter out of bound` prewhere optimizasyonlarından sonra bazı sorgularda istisna. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) +- Fonksiyon argümanlarının karışık sabitliği durumu düzeltildi `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yürüt whenürken `CREATE` sorgu, depolama motoru argümanlarında sabit ifadeleri katlayın. Boş veritabanı adı geçerli veritabanı ile değiştirin. Düzeltiyor [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) +- Artık basit döngüsel takma adlarla sütunlar oluşturmak veya eklemek mümkün değil `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- Bozuk orijinal parçası olabilir çift hareket ile bir hata düzeltildi. Eğer kullanıyorsanız bu önemlidir `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Vermek `interval` backticks olmadan doğru ayrıştırmak için tanımlayıcı. Bir sorgu bile yürütülemez sabit sorun `interval` tanımlayıcı backticks veya çift tırnak içine alınır. Bu düzeltmeler [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit fuzz testi ve yanlış davranış `bitTestAll`/`bitTestAny` işlevler. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Olası kilitlenme/yanlış satır sayısını düzeltin `LIMIT n WITH TIES` n’th satırına eşit çok sayıda satır olduğunda. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- Enabled ile yazılmış parçalarla mutasyonları düzeltin `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) +- İmha veri yarışı Fix `Poco::HTTPServer`. Sunucu başlatıldığında ve hemen kapatıldığında gerçekleşebilir. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Çalışırken yanıltıcı bir hata mesajının gösterildiği hatayı düzeltin `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) +- Sabit `Parameters are out of bound` bazı nadir durumlarda istisna `SELECT` CLA anuse when we have an `ORDER BY` ve bir `LIMIT` yan. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Mutasyonlar kesinleşmesini düzeltin, zaten mutasyon yapıldığında durum olabilir `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) +- Yürütül executingmesini engellemek `ALTER ADD INDEX` eski sözdizimi ile MergeTree tabloları için, çünkü çalışmıyor. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) +- Sunucu başlatma sırasında erişim tablosu, hangi `LIVE VIEW` bağlıdır, böylece sunucu başlatmak mümkün olacak. Ayrıca kaldırmak `LIVE VIEW` ayırma sırasında bağımlılıklar `LIVE VIEW`. `LIVE VIEW` deneysel bir özelliktir. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) +- Olası segfault’u düzeltin `MergeTreeRangeReader`, Yürüt whileürken `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) +- Sütun TTLs ile olası eşleşmeyen sağlama toplamlarını düzeltin. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Sadece bir birim olduğunda parçalar durumunda TTL kurallarına göre arka planda taşınmadığında bir hata düzeltildi. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Sorunu düzelt fixedildi `Method createColumn() is not implemented for data type Set`. Bu düzeltmeler [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi mutasyonları daha sık sonuçlandırmaya çalışacağız. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- Düzeltmek `intDiv` eksi bir sabit tarafından [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) +- Olası yarış durumunu düzeltin `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Kullanmaya / bırakmaya çalışırken sunucu sonlandırmasına giden hatayı düzeltin `Kafka` tablo yanlış parametrelerle oluşturuldu. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) +- OS için yanlış sonuç döndürürse geçici çözüm eklendi `timer_create` işlev. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kullanımında Sabit hata `min_marks_for_seek` parametre. Dağıtılmış tabloda sharding anahtarı olmadığında hata mesajı düzeltildi ve kullanılmayan parçaları atlamaya çalışıyoruz. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) + +#### Geliştirme {#improvement} + +- Uygulamak `ALTER MODIFY/DROP` için Mut topasyon topların üstüne sorgular `ReplicatedMergeTree*` motorlar ailesi. Şimdi `ALTERS` yalnızca meta veri güncelleme aşamasında engeller ve bundan sonra engellemez. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) +- İle iç Birleşimlere çapraz yeniden yazma yeteneği ekleyin `WHERE` unqialified adları içeren bölüm. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) +- Yapmak `SHOW TABLES` ve `SHOW DATABASES` sorgular destek `WHERE` ifadeler ve `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) +- Bir ayar eklendi `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) +- Son değişikliklerden sonra MySQL istemcisi onaltılık ikili dizeleri yazdırmaya başladı ve böylece onları okunabilir hale getirdi ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). Clickhouse’daki geçici çözüm, dize sütunlarını her zaman değil, genellikle durum olan UTF-8 olarak işaretlemektir. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) +- İçin dize ve FixedString tuşları desteği ekleyin `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) +- SummingMergeTree haritalarında dize anahtarlarını destekleyin [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) +- İş parçacığı özel durum atılmış olsa bile iş parçacığı havuzu için iş parçacığı sonlandırma sinyali [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Ayarlamak için izin ver `query_id` içinde `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) +- Garip ifadelere izin verme `ALTER TABLE ... PARTITION partition` sorgu. Bu adresler [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tablo `system.table_engines` şimdi özellik desteği (gibi) hakkında bilgi sağlar `supports_ttl` veya `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) +- Etkinleştirmek `system.metric_log` varsayılan olarak. ProfileEvents, CurrentMetrics değerleri ile toplanan satırları içerecektir “collect\_interval\_milliseconds” aralığı (varsayılan olarak bir saniye). Tablo çok küçüktür (genellikle megabayt sırasına göre) ve bu verileri varsayılan olarak toplamak mantıklıdır. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([I ivanvan](https://github.com/abyss7)) +- Şimdi geçici `LIVE VIEW` tarafından oluşturulur `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` yerine `CREATE TEMPORARY LIVE VIEW ...`, önceki sözdizimi ile tutarlı olmadığı için `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) +- Text\_log ekleyin.giden girişleri sınırlamak için seviye yapılandırma parametresi `system.text_log` Tablo [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) +- İndir partdiğiniz parçayı TTL kurallarına göre disk /lere/birim putlere koy allowmaya izin verin [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Harici MySQL sözlükleri için, MySQL bağlantı havuzunun mutualize edilmesine izin verin “share” sözlükler arasında. Bu seçenek, MySQL sunucularına bağlantı sayısını önemli ölçüde azaltır. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- Quantiles için en yakın sorgu yürütme süresini göster `clickhouse-benchmark` enterpolasyonlu değerler yerine çıktı. Bazı sorguların yürütme süresine karşılık gelen değerleri göstermek daha iyidir. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kafka’ya veri eklerken mesaj için anahtar ve zaman damgası ekleme imkanı. Düzeltiyor [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) +- Sunucu terminalden çalıştırılırsa, iş parçacığı numarası, sorgu kimliği ve günlük önceliğini renklere göre vurgulayın. Bu, geliştiriciler için ilişkili günlük iletilerinin daha iyi okunabilirliği içindir. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tablolar yüklenirken daha iyi istisna mesajı `Ordinary` veritabanı. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Uygulamak `arraySlice` toplama işlev durumları olan diziler için. Bu düzeltmeler [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- In operatörünün sağ tarafında sabit işlevlerin ve sabit dizilerin kullanılmasına izin verin. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) +- Sistem için veri getirilirken zookeeper istisnası olduysa.yinelemeler, ayrı bir sütunda görüntüler. Bu uygular [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Atomically kaldırmak mergetree veri parçaları üzerinde yok. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Dağıtılmış tablolar için satır düzeyinde güvenliği destekleyin. [\#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([I ivanvan](https://github.com/abyss7)) +- Now we recognize suffix (like KB, KiB…) in settings values. [\#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) +- Büyük bir birleştirme sonucu oluştururken bellek yetersizliğini önleyin. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) +- Etkileşimli modda önerilere kümelerin isimleri eklendi `clickhouse-client`. [\#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexey-milovidov](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) ([I ivanvan](https://github.com/abyss7)) +- Eklenen sütun `exception_code` içinde `system.query_log` Tablo. [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) +- Bağlantı noktasında etkin MySQL uyumluluk sunucusu `9004` varsayılan sunucu yapılandırma dosyasında. Yapılandırmada örnekte sabit şifre oluşturma komutu. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) +- Dosya sistemi readonly ise kapatma üzerinde iptal önleyin. Bu düzeltmeler [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- HTTP POST sorgusunda uzunluk gerektiğinde daha iyi özel durum iletisi. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eklemek `_path` ve `_file` sanal sütunlar için `HDFS` ve `File` motorlar ve `hdfs` ve `file` tablo fonksiyonları [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) +- Hatayı Düzelt `Cannot find column` içine takarken `MATERIALIZED VIEW` durumda yeni sütun view’ın iç tabloya eklendi eğer. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Son güncellemeden sonra ilerleme göndererek (günlük gibi) yerel istemci-sunucu protokolü üzerinden ilerlemeyi düzeltin. Bu, yalnızca yerel protokolü kullanan bazı üçüncü taraf araçlarla ilgili olabilir. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) +- MySQL protokolünü kullanarak istemci bağlantılarının sayısını izleyen bir sistem metriği ekleyin ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) +- Şu andan itibaren, HTTP yanıtları olacak `X-ClickHouse-Timezone` başlık, aynı zaman dilimi değerine ayarlanmış `SELECT timezone()` rapor verecek. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) + +#### Performans İyileştirme {#performance-improvement} + +- In ile analiz endeksinin performansını artırın [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) +- Mantıksal işlevlerde daha basit ve daha verimli kod + kod temizleme. Bir takip için [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) +- Genel performans iyileştirme (%5 aralığında..Etkilenen sorgular için %200) C++20 özellikleri ile daha sıkı takma sağlayarak. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos Kuşu](https://github.com/amosbird)) +- Karşılaştırma işlevlerinin iç döngüleri için daha sıkı takma ad. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Aritmetik fonksiyonların iç döngüleri için daha sıkı takma ad. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- A ~ 3 kat daha hızlı uygulama için ColumnVector::replicate(), hangi aracılığıyla ColumnConst:: convertToFullColumn () uygulanır. Sabitleri gerçekleştirirken testlerde de yararlı olacaktır. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) +- Bir başka küçük performans iyileştirme `ColumnVector::replicate()` (bu hızlandırır `materialize` fonksiyonu ve daha yüksek mertebeden fonksiyonları) daha da geliştirilmesi için [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) +- Geliştirilmiş performans `stochasticLinearRegression` toplama işlevi. Bu yama Intel tarafından katkıda bulunmuştur. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Performansını artırmak `reinterpretAsFixedString` işlev. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin istemciye blok gönder notmeyin `Null` işlemciler boru hattında Biçimlendir. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement} + +- Özel durum işleme artık Linux için Windows Alt Sisteminde düzgün çalışıyor. Bkz. https://github.com/ClickHouse-Extras/libunwind/pull/3 bu düzeltmeler [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) +- Değişmek `readline` ile `replxx` etkileşimli çizgi düzenleme için `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([I ivanvan](https://github.com/abyss7)) +- FunctionsComparison daha iyi inşa süresi ve daha az şablon örnekleri. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İle entegrasyon eklendi `clang-tidy` CI. Ayrıca bakınız [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi kullanarak cı içinde ClickHouse bağlantı `lld` için bile `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) +- İş parçacığı zamanlama rastgele izin ve glitches eklemek zaman `THREAD_FUZZER_*` ortam değişkenleri ayarlanır. Bu test yardımcı olur. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Durumsuz testlerde güvenli soketleri etkinleştirme [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) +- Split\_shared\_libraries = daha sağlam yap [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) +- Yapmak “performance\_introspection\_and\_logging” rastgele sunucuya güvenilir test sıkışmış. Bu CI ortamında gerçekleşebilir. Ayrıca bakınız [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- XML stil onayında doğrulayın. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Testte sabit yarış durumu `00738_lock_for_inner_table`. Bu test uykuya dayanıyordu. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tür performans testlerini kaldırın `once`. Bu, tüm performans testlerini istatistiksel karşılaştırma modunda çalıştırmak için gereklidir (daha güvenilir). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Aritmetik fonksiyonlar için performans testi eklendi. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin performans testi eklendi `sumMap` ve `sumMapWithOverflow` toplama fonksiyonları. İçin takip [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Üslup ile ErrorCodes stil sağlamak. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Testler geçmişi için komut dosyası ekleyin. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) +- GCC uyarısı Ekle `-Wsuggest-override` tüm yerleri bulmak ve düzeltmek için `override` anahtar kelime kullanılmalıdır. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Tanımlanmalıdır çünkü Mac OS X altında zayıf sembolü Yoksay [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Silinmiş kullanıcı](https://github.com/ghost)) +- Performans testlerinde bazı sorguların çalışma süresini normalleştirin. Bu, tüm performans testlerini karşılaştırma modunda çalıştırmak için hazırlık olarak yapılır. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sorgu testleriyle pytest’i desteklemek için bazı testleri düzeltin [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([I ivanvan](https://github.com/abyss7)) +- Ssl’yi msan ile oluşturmada etkinleştirin, böylece durumsuz testler çalıştırırken sunucu başlangıçta başarısız olmaz [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) +- Test sonuçlarında veritabanı ikamesini düzeltin [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) +- Çeşitli platformlar için düzeltmeler oluşturun [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) +- Stateless-with-coverage test docker görüntüsüne diskler bölümü eklendi [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) +- GRPC ile oluştururken kaynak ağacı dosyalarından kurtulun [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos Kuşu](https://github.com/amosbird)) +- Sessioncleaner’ı bağlamdan kaldırarak biraz daha hızlı oluşturma süresi. SessionCleaner kodunu daha basit hale getirin. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Clickhouse-test komut dosyasında asılı sorgular için güncelleme denetimi [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) +- Depodan bazı gereksiz dosyaları kaldırıldı. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Değişen matematik perftests türü `once` -e doğru `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Bizim kod tabanı için interaktif kod tarayıcı HTML raporu oluşturmanıza olanak sağlar docker görüntü ekleyin. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin)) Görmek [Woboq Kod Tarayıcı](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) +- MSan altında bazı test hatalarını bastırın. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Hızlanma “exception while insert” test. Bu sınama genellikle hata ayıklama-with-coverage derlemede zaman aşımına uğradı. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Güncel `libcxx` ve `libcxxabi` yenmek. Hazırlan preparationmasında [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Flacky testi düzeltin `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yinelenen bağlayıcı bayrakları temizleyin. Bağlayıcının beklenmedik bir sembol aramayacağından emin olun. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos Kuşu](https://github.com/amosbird)) +- Eklemek `clickhouse-odbc` test görüntüleri içine sürücü. Bu, ClickHouse ile clickhouse etkileşimini kendi ODBC sürücüsü aracılığıyla test etmeyi sağlar. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) +- Birim testlerinde birkaç hatayı düzeltin. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) +- Etkinleştirmek `-Wmissing-include-dirs` Mevcut olmayan tüm içeriklerin ortadan kaldırılması için GCC uyarısı-çoğunlukla cmake komut dosyası hatalarının bir sonucu olarak [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Sorgu profiler çalışamaz, nedenleri açıklayın. Bu için tasarlanmıştır [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Openssl’yi upstream master’a güncelleyin. TLS bağlantıları mesajla başarısız olabilir sorunu düzeltildi `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` ve `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. Sorun 20.1 sürümünde mevcuttu. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sunucu için Dockerfile güncelleme [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) +- Build-gcc-from-sources komut dosyasında küçük düzeltmeler [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) +- Değişmek `numbers` -e doğru `zeros` perftests nerede `number` sütun kullanılmaz. Bu daha temiz test sonuçlarına yol açacaktır. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Sütun yapıcılarında ınitializer\_list kullanırken yığın taşması sorununu düzeltin. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Silinmiş kullanıcı](https://github.com/ghost)) +- V1.3.0 için librdkafka yükseltin. Birlikte etkinleştir `rdkafka` ve `gsasl` Mac OS X kitaplıkları. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) +- gcc 9.2.0 üzerinde düzeltme oluşturun [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) + +## ClickHouse yayın V20. 1 {#clickhouse-release-v20-1} + +### ClickHouse yayın V20. 1. 8. 41, 2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} + +#### Hata Düzeltme {#bug-fix-3} + +- Olası kalıcı düzeltme `Cannot schedule a task` hata (işlenmeyen özel durum nedeniyle `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). Bu düzeltmeler [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) +- Aşırı bellek tüketimini düzeltin `ALTER` sorgular (Mut (asyonlar). Bu düzeltmeler [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) ve [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) +- Dış sözlükler DDL backquoting hatayı düzeltin. Bu düzeltmeler [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) + +### ClickHouse yayın V20.1. 7. 38, 2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} + +#### Hata Düzeltme {#bug-fix-4} + +- Sabit yanlış iç işlev adları için `sumKahan` ve `sumWithOverflow`. Bu işlevleri uzak sorgularda kullanırken istisnaya yol açarım. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). Bu sorun tüm ClickHouse sürümlerindeydi. +- Vermek `ALTER ON CLUSTER` -den `Distributed` iç çoğaltma ile tablolar. Bu düzeltmeler [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). Bu sorun tüm ClickHouse sürümlerindeydi. +- Olası istisnaları düzeltin `Size of filter doesn't match size of column` ve `Invalid number of rows in Chunk` içinde `MergeTreeRangeReader`. Yürüt whileürken görün theyebilirler `PREWHERE` bazı durumlarda. Düzeltiyor [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) +- Sorunu düzeltildi: Eğer gibi basit bir aritmetik ifade yazarsanız zaman dilimi korunmuş değildi `time + 1` (gibi bir ifadenin aksine `time + INTERVAL 1 SECOND`). Bu düzeltmeler [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). Bu sorun tüm ClickHouse sürümlerindeydi. +- Artık basit döngüsel takma adlarla sütunlar oluşturmak veya eklemek mümkün değil `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) +- Base64 kodlanmış değerin sonunda dolgu hatalı biçimlendirilmiş olabilir sorunu düzeltildi. Base64 kütüphanesini güncelleyin. Bu düzeltmeler [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), yaklar [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İmha veri yarışı Fix `Poco::HTTPServer`. Sunucu başlatıldığında ve hemen kapatıldığında gerçekleşebilir. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) +- Olası kilitlenme/yanlış satır sayısını düzeltin `LIMIT n WITH TIES` n’th satırına eşit çok sayıda satır olduğunda. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) +- Sütun TTLs ile olası eşleşmeyen sağlama toplamlarını düzeltin. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) +- Bir kullanıcı denediğinde çökmeyi düzeltin `ALTER MODIFY SETTING` eski formatlı için `MergeTree` masa motorları ailesi. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) +- Şimdi mutasyonları daha sık sonuçlandırmaya çalışacağız. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) +- Çoğaltma protokolü uyumsuzluğunu düzeltme [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) +- Dizi türlerinin bloom\_filter dizini için değil(has()) düzeltin. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) +- Davranışı Düzelt theildi `match` ve `extract` haystack sıfır bayt olduğunda işlevler. Haystack sabit olduğunda davranış yanlıştı. Bu düzeltmeler [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-1} + +- Özel durum işleme artık Linux için Windows Alt Sisteminde düzgün çalışıyor. Bkz. https://github.com/ClickHouse-Extras/libunwind/pull/3 bu düzeltmeler [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) + +### ClickHouse yayın V20. 1. 6. 30, 2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} + +#### Hata Düzeltme {#bug-fix-5} + +- Sıkıştırıldığında veri uyumsuzluğunu düzeltin `T64` codec. + [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) +- Mergetree tablosundan bir iş parçacığında okurken aralıkların sırasını düzeltin. Düzeltiyor [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). + [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) +- Olası segfault’u düzeltin `MergeTreeRangeReader`, Yürüt whileürken `PREWHERE`. Düzeltiyor [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). + [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) +- Düzeltmek `reinterpretAsFixedString` dönmek `FixedString` yerine `String`. + [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) +- Düzeltmek `joinGet` null dönüş türleri ile. Düzeltiyor [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) + [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) +- Fuzz testini ve bittestall/bitTestAny işlevlerinin yanlış davranışını düzeltin. + [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Haystack sıfır bayt olduğunda match ve extract işlevlerinin davranışını düzeltin. Haystack sabit olduğunda davranış yanlıştı. Düzeltiyor [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) + [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Kesinlikle monotinik olmayan fonksiyonel indeks kullanıldığında ters yüklemlerin sabit yürütülmesi. Düzeltiyor [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) + [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) +- Yeniden yazmak için izin ver `CROSS` -e doğru `INNER JOIN` varsa `[NOT] LIKE` operat inor in `WHERE` bölme. Düzeltiyor [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) + [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) +- Log engine ile bir tablodaki ilk sütunların bir diğer ad olmasına izin verin. + [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) +- Virgülle birleşmeye izin ver `IN()` için. Düzeltiyor [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). + [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) +- Geliştirmek `ALTER MODIFY/ADD` sorgu mantığı. Şimdi yapamazsın `ADD` türü olmayan sütun, `MODIFY` varsayılan ifade sütun türünü değiştirmez ve `MODIFY` tür varsayılan ifade değerini kaybetmez. Düzeltiyor [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). + [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) +- Mutasyonlar kesinleşmesini düzeltin, zaten mutasyon yapıldığında is\_done = 0 durumuna sahip olabilir. + [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) +- Destek “Processors” sistem için boru hattı.sayılar ve sistem.numbers\_mt. Bu aynı zamanda hatayı giderir `max_execution_time` saygın değildir. + [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- Yanlış saymayı düzeltin `DictCacheKeysRequestedFound` ölçü. + [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) +- Depolama politikası için bir kontrol eklendi `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` aksi halde, yeniden başlatıldıktan sonra parçanın verilerini erişilemez hale getirebilir ve Clickhouse’un başlatılmasını önleyebilir. + [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) +- Sabit UBSan raporu `MergeTreeIndexSet`. Bu düzeltmeler [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) + [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- BlockİO Olası datarace Fix. + [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) +- İçin destek `UInt64` json ile ilgili işlevlerde Int64’e uymayan sayılar. Güncelleştirme `SIMDJSON` yenmek. Bu düzeltmeler [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) + [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Veri dizini ayrı bir aygıta takılıysa, boş alan miktarı doğru hesaplanmadığında sorunu düzeltin. Varsayılan disk için veri alt dizinindeki boş alanı hesaplayın. Bu düzeltmeler [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) + [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) +- Mesajla TLS bağlantıları başarısız olduğunda sorunu düzeltin `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Openssl’yi upstream master’a güncelleyin. + [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) +- Yürüt whenürken `CREATE` sorgu, depolama motoru argümanlarında sabit ifadeleri katlayın. Boş veritabanı adı geçerli veritabanı ile değiştirin. Düzeltiyor [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Ayrıca ClickHouseDictionarySource yerel adresi için onay düzeltin. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- Segfault’u düzeltin `StorageMerge`, StorageFile okurken olabilir. + [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) +- Veri kaybını önlemek `Kafka` nadir durumlarda istisna sonek okuduktan sonra ancak taahhütten önce gerçekleşir. Düzeltiyor [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). İlgili: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) +- Kullanmaya / bırakmaya çalışırken sunucu sonlandırmasına giden hatayı düzeltin `Kafka` tablo yanlış parametrelerle oluşturuldu. Düzeltiyor [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Birleşiyor [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) + +#### Yenilik {#new-feature-1} + +- Eklemek `deduplicate_blocks_in_dependent_materialized_views` hayata manzaralı tablolara idempotent ekler davranışlarını kontrol etmek için Seçenek. Bu yeni özellik, altınity’den özel bir istek ile bugfix sürümüne eklendi. + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### ClickHouse yayın V20.1. 2. 4, 2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} + +#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-1} + +- Ayarı yap `merge_tree_uniform_read_distribution` eski. Sunucu hala bu ayarı tanır, ancak hiçbir etkisi yoktur. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Fonksiyonun dönüş türünü değiştirdi `greatCircleDistance` -e doğru `Float32` çünkü şimdi hesaplamanın sonucu `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi sorgu parametrelerinin şu şekilde temsil edilmesi bekleniyor “escaped” biçimli. Örneğin, dize geçmek için `ab` yazmak zorundasın `a\tb` veya `a\b` ve sırasıyla, `a%5Ctb` veya `a%5C%09b` URL in’de. Bu, NULL olarak geçme olasılığını eklemek için gereklidir `\N`. Bu düzeltmeler [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Etkinleştirmek `use_minimalistic_part_header_in_zookeeper` için ayar `ReplicatedMergeTree` varsayılan olarak. Bu, Zookeeper’da depolanan veri miktarını önemli ölçüde azaltacaktır. Bu ayar 19.1 sürümünden beri desteklenmektedir ve zaten yarım yıldan fazla bir süredir herhangi bir sorun yaşamadan birden fazla hizmette üretimde kullanıyoruz. 19.1’den eski sürümlere geçiş yapma şansınız varsa bu ayarı devre dışı bırakın. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Veri atlama endeksleri üretim hazır ve varsayılan olarak etkindir. Ayar `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` ve `allow_experimental_multiple_joins_emulation` artık eskimiş ve hiçbir şey yapma. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yeni Ekle `ANY JOIN` için mantık `StorageJoin` ile tutarlı `JOIN` işleyiş. Davranış değişiklikleri olmadan yükseltmek için eklemeniz gerekir `SETTINGS any_join_distinct_right_table_keys = 1` motor tabloları meta katılmak veya yükseltmeden sonra bu tabloları yeniden oluşturmak için. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) +- Günlük yapılandırma değişiklikleri uygulamak için yeniden başlatılması için sunucu gerektirir. Bu, sunucunun silinmiş bir günlük dosyasına oturum açtığı hatayı önlemek için geçici bir geçici çözümdür (bkz. [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +#### Yenilik {#new-feature-2} + +- Parça yolları hakkında bilgi eklendi `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Yürütme yeteneği Ekle `SYSTEM RELOAD DICTIONARY` sorgu içinde `ON CLUSTER` modu. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) +- Yürütme yeteneği Ekle `CREATE DICTIONARY` sorgular `ON CLUSTER` modu. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) +- Şimdi kullanıcının profili `users.xml` birden çok profil devralır. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- Katma `system.stack_trace` tüm sunucu iş parçacıklarının yığın izlerine bakmayı sağlayan tablo. Bu, geliştiricilerin sunucu durumunu iç gözlemlemesi için kullanışlıdır. Bu düzeltmeler [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eklemek `DateTime64` yapılandırılabilir alt ikinci hassasiyetle veri türü. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) +- Tablo fonksiyonu Ekle `clusterAllReplicas` kümedeki tüm düğümleri sorgulamaya izin verir. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari)) +- Toplama işlevi Ekle `categoricalInformationValue` ayrık bir özelliğin bilgi değerini hesaplar. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) +- Veri dosyalarının ayrıştırılmasını hızlandırın `CSV`, `TSV` ve `JSONEachRow` paralel olarak yaparak Biçimlendir .in. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Fonksiyon Ekle `bankerRound` bankacı yuvarlama yapar. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) +- Bölge adları için gömülü sözlükte daha fazla dil desteği: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tutarlılıktaki gelişmeler `ANY JOIN` mantıksal. Şimdi `t1 ANY LEFT JOIN t2` eşitlikler `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Ayar Ekle `any_join_distinct_right_table_keys` için eski davranışları sağlayan `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Yeni Ekle `SEMI` ve `ANTI JOIN`. Yaş `ANY INNER JOIN` davranış şu anda mevcut `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) +- Katma `Distributed` format for `File` motor ve `file` okumak için izin veren tablo işlevi `.bin` asenkron ekler tarafından oluşturulan dosyalar `Distributed` Tablo. [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- İsteğe bağlı Sıfırla sütun argümanı Ekle `runningAccumulate` hangi her yeni anahtar değeri için toplama sonuçlarını sıfırlamak için izin verir. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) +- Prometheus bitiş noktası olarak ClickHouse kullanma yeteneği ekleyin. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) +- Bölüm Ekle `` içinde `config.xml` uzak tablo motorları ve tablo işlevleri için izin verilen ana bilgisayarları kısıtlayan `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) +- Eklendi fonksiyonu `greatCircleAngle` bir küre üzerindeki mesafeyi derece cinsinden hesaplar. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- H3 kütüphanesi ile tutarlı olacak şekilde dünya yarıçapı değiştirildi. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Katma `JSONCompactEachRow` ve `JSONCompactEachRowWithNamesAndTypes` giriş ve çıkış biçimleri. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) +- Dosya ile ilgili tablo motorları ve tablo işlevleri için özellik eklendi (`File`, `S3`, `URL`, `HDFS`) okuma ve yaz allowsmayı sağlayan `gzip` ek motor parametresi veya dosya uzantısına dayalı dosyalar. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) +- Add theed the `randomASCII(length)` fonksiyon, rastgele bir dizi ile bir dize oluşturma [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) yazdırılabilir karakterler. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([Süngü](https://github.com/BayoNet)) +- Eklendi fonksiyonu `JSONExtractArrayRaw` ayrıştırılmamış json dizi öğelerinde bir dizi döndürür `JSON` dize. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) +- Eklemek `arrayZip` eşit uzunluktaki birden fazla diziyi bir dizi diziye birleştirmeyi sağlayan işlev. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([Kış Zhang](https://github.com/zhang2014)) +- Yapılandırılmış göre diskler arasında veri taşımak için yeteneği ekleyin `TTL`- ifadeler için `*MergeTree` masa motorları ailesi. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Yeni toplama fonksiyonu eklendi `avgWeighted` hangi ağırlıklı ortalama hesaplamak için izin verir. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) +- Şimdi paralel ayrıştırma için varsayılan olarak etkindir `TSV`, `TSKV`, `CSV` ve `JSONEachRow` biçimliler. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Birkaç coğrafi işlev Ekle `H3` kitaplık: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` ve `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) +- Brotli için destek eklendi (`br`) dosya ile ilgili Depolarda ve tablo işlevlerinde sıkıştırma. Bu düzeltmeler [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Eklemek `groupBit*` fonksiyonlar için `SimpleAggregationFunction` tür. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) + +#### Hata Düzeltme {#bug-fix-6} + +- Tabloların yeniden adlandırılmasını düzeltin `Distributed` motor. Düzeltmeler sorunu [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- Şimdi sözlükler desteği `EXPRESSION` non-ClickHouse SQL lehçesinde keyfi dizedeki öznitelikler için. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) +- Kırık düzeltmek `INSERT SELECT FROM mysql(...)` sorgu. Bu düzeltmeler [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) ve [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- Hatayı Düzelt “Mismatch column sizes” varsayılan eklerken `Tuple` itibaren `JSONEachRow`. Bu düzeltmeler [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) +- Şimdi kullanılması durumunda bir istisna atılacaktır `WITH TIES` birlikte `LIMIT BY`. Ayrıca kullanma yeteneği ekleyin `TOP` ile `LIMIT BY`. Bu düzeltmeler [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Taze glibc sürümünden istenmeyen bağımlılığı düzeltin `clickhouse-odbc-bridge` ikilik. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos Kuşu](https://github.com/amosbird)) +- Kontrol fonksiyonunda hatayı düzeltin `*MergeTree` motorlar ailesi. Şimdi, son granül ve son işarette (nihai olmayan) eşit miktarda satıra sahip olduğumuzda başarısız olmaz. [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) +- Insert Into Fix `Enum*` sonra sütunlar `ALTER` sorgu, altta yatan sayısal tür tablo belirtilen türe eşit olduğunda. Bu düzeltmeler [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) +- İzin verilen sabit olmayan negatif “size” fonksiyon için argüman `substring`. Yanlışlıkla izin verilmedi. Bu düzeltmeler [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yanlış sayıda argüman geçtiğinde ayrıştırma hatasını düzeltin `(O|J)DBC` masa motoru. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) +- Syslog için günlükleri gönderirken çalışan clickhouse işleminin komut adını kullanma. Önceki sürümlerde, komut adı yerine boş dize kullanıldı. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) +- İzin verilen ana bilgisayarların kontrolünü düzeltin `localhost`. Bu PR, sağlanan çözümü düzeltir [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) +- Nadir kazayı düzeltin `argMin` ve `argMax` sonuç kullanıldığında, uzun dize bağımsız değişkenleri için işlevler `runningAccumulate` işlev. Bu düzeltmeler [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinozor](https://github.com/769344359)) +- İle tablolar için bellek overcommit Fix `Buffer` motor. [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) +- Alabilir fonksiyonları sabit potansiyel hata `NULL` bağımsız değişkenlerden biri olarak ve NULL olmayan döndürür. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Arka plan işlemleri için iş parçacığı havuzunda daha iyi metrik hesaplamaları `MergeTree` masa motorları. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Düzeltme fonksiyonu `IN` için `WHERE` satır düzeyinde tablo filtresi varsa deyimi. Düzeltiyor [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([I ivanvan](https://github.com/abyss7)) +- Şimdi, integral değeri ayarlar değerleri için tamamen ayrıştırılmazsa bir istisna atılır. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) +- Toplama işlevi, sorguda ikiden fazla yerel parça içeren dağıtılmış tabloya kullanıldığında özel durumu düzeltin. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- Şimdi bloom filtresi sıfır uzunluk dizilerini işleyebilir ve gereksiz hesaplamalar yapmaz. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbab](https://github.com/achimbab)) +- Bir istemci ana bilgisayar için istemci ana bilgisayar eşleştirerek izin verilip verilmediğini kontrol sabit `host_regexp` belirtilen `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) +- Çoklu olarak yanlış pozitiflere yol açan belirsiz sütun kontrolünü rahatlatın `JOIN ON` bölme. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) +- Sabit Olası sunucu çökmesi (`std::terminate`) sunucu veri gönder cannotem whenediğinde veya yaz theama thedığında `JSON` veya `XML` değerleri ile biçim `String` veri türü (gerektiren `UTF-8` doğrulama) veya sonuç verilerini Brotli algoritması ile sıkıştırırken veya diğer bazı nadir durumlarda. Bu düzeltmeler [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yarış durumunu düzeltin `StorageDistributedDirectoryMonitor` CI tarafından bulundu. Bu düzeltmeler [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Şimdi arka plan birleşir `*MergeTree` tablo motorları ailesi depolama ilkesi hacim sırasını daha doğru bir şekilde korur. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Şimdi masa motoru `Kafka` ile düzgün çalışır `Native` biçimli. Bu düzeltmeler [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Başlıklarla sabit formatlar (gibi `CSVWithNames`) tablo motoru için EOF hakkında istisna atıyorlardı `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) +- Sağ kısmında alt sorgudan set yapma ile bir hata düzeltildi `IN` bölme. Bu düzeltmeler [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) ve [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Depolama alanından okurken Olası kazayı düzeltin `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Dosyaların sabit okuma `Parquet` tür sütunları içeren biçim `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([maxulan](https://github.com/maxulan)) +- Hatayı Düzelt `Not found column` ile dağıtılmış sorgular için `PREWHERE` örnekleme anahtarına bağımlı durum `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Hatayı Düzelt `Not found column` sorgu kullanılırsa `PREWHERE` tablonun diğer adı ve sonuç kümesi bağımlı birincil anahtar koşulu nedeniyle boştu. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Fonksiyonlar için sabit dönüş tipi `rand` ve `randConstant` durumunda `Nullable` değişken. Şimdi fonksiyonlar her zaman geri döner `UInt32` ve asla `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Engelli yüklem push-down için `WITH FILL` ifade. Bu düzeltmeler [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([Kış Zhang](https://github.com/zhang2014)) +- Sabit yanlış `count()` res forult for `SummingMergeTree` ne zaman `FINAL` bölüm kullanılır. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Uzak sunuculardan sabit işlevler için olası yanlış sonucu düzeltin. Gibi işlevlerle sorgular için oldu `version()`, `uptime()` vb. farklı sunucular için farklı sabit değerler döndürür. Bu düzeltmeler [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Yanlış sonuçlara yol açan push-down yüklemi optimizasyonunda karmaşık hatayı düzeltin. Bu, push-down yüklemi optimizasyonu ile ilgili birçok sorunu giderir. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([Kış Zhang](https://github.com/zhang2014)) +- Çökmeyi düzeltin `CREATE TABLE .. AS dictionary` sorgu. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) +- Çeşitli iyileştirmeler clickhouse dilbilgisi `.g4` Dosya. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) +- Çökmelere yol açan hatayı düzeltin `JOIN`motorlu tablolar ile s `Join`. Bu düzeltmeler [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) +- Gereksiz sözlükleri yeniden yükleyin `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) +- Okuma için maksimum akış sayısını sınırlayın `StorageFile` ve `StorageHDFS`. Düzeltmeler https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) +- Hatayı düzeltin `ALTER ... MODIFY ... CODEC` sorgu, kullanıcı hem varsayılan ifade hem de codec belirttiğinde. Düzeltiyor [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) +- Sütunların arka plan birleşimindeki hatayı düzeltin `SimpleAggregateFunction(LowCardinality)` tür. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Sabit tip kontrol fonksiyonu `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) +- Şimdi sunucu üzerinde çökme yok `LEFT` veya `FULL JOIN` ve Birleştirme motoru ve desteklenmeyen `join_use_nulls` ayarlar. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) +- Şimdi `DROP DICTIONARY IF EXISTS db.dict` sorgu, istisna atmıyor `db` yok. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) +- Tablo işlevlerinde Olası çökmeleri düzeltin (`file`, `mysql`, `remote`) referans kullanımı nedeniyle Kaldır toılan `IStorage` nesne. Tablo işlevine ekleme sırasında belirtilen sütunların yanlış ayrıştırılmasını düzeltin. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) +- Başlamadan önce ağ olun `clickhouse-server`. Bu düzeltmeler [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) +- Güvenli bağlantılar için zaman aşımlarını düzeltin, böylece sorgular belirsiz bir şekilde askıda kalmaz. Bu düzeltmeler [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltmek `clickhouse-copier`’In eşzamanlı işçiler arasındaki gereksiz çekişme. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- Şimdi mutasyonlar, mutasyon versiyonları mevcut mutasyon versiyonundan daha büyük olsa bile, ekli parçaları atlamaz. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) +- Gereksiz kopyaları Yoksay `*MergeTree` başka bir diske ve sunucuya taşındıktan sonra veri parçaları yeniden başlatılır. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Çökmeyi düzeltin `FULL JOIN` ile `LowCardinality` içinde `JOIN` anahtar. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) +- Sütun adını birden çok kez ekleme sorgusu gibi kullanmak yasaktır `INSERT INTO tbl (x, y, x)`. Bu düzeltmeler [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) +- Bilinmeyen CPU’lar için fiziksel CPU çekirdeği sayısını tespit etmek için geri dönüş eklendi (mantıksal CPU çekirdeği sayısını kullanarak). Bu düzeltmeler [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltmek `There's no column` materialized ve alias sütunlar için hata. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) +- Sabit sever kazasında zaman `EXISTS` sorgu olmadan kullanıldı `TABLE` veya `DICTIONARY` niteleyici. Gibi `EXISTS t`. Bu düzeltmeler [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). Bu hata 19.17 sürümünde tanıtıldı. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Nadir hatayı hata ile düzeltin `"Sizes of columns doesn't match"` kullanırken bu görünebilir `SimpleAggregateFunction` sütun. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- Boş olan kullanıcının bulunduğu hatayı düzeltin `allow_databases` tüm veritabanlarına erişim var (ve aynı `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) +- Sunucu zaten istemciden bağlantısı kesildiğinde istemci çökmesini düzeltin. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- Düzeltmek `ORDER BY` birincil anahtar öneki ve birincil anahtar soneki ile sıralama durumunda davranış. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) +- Tabloda nitelikli sütun mevcut olup olmadığını kontrol edin. Bu düzeltmeler [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) +- İle sabit davranış `ALTER MOVE` belirtilen birleştirme bitiş hamle superpart hemen sonra koştu. Düzeltiyor [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Kullanırken Olası sunucu çökmesini düzeltin `UNION` farklı sayıda sütun ile. Düzeltiyor [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- İşlev için sonuç alt dizesinin boyutunu düzeltin `substr` negatif boyutu ile. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Şimdi server part Mut mutasyonu Yürüt inmüyor `MergeTree` arka plan havuzunda yeterli boş iş parçacığı yoksa. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) +- Biçimlendirmede küçük bir yazım hatası düzeltildi `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) +- Negatif sayılar için sabit yanlış bloom filtre sonuçları. Bu düzeltmeler [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([Kış Zhang](https://github.com/zhang2014)) +- Sıkıştırmada sabit potansiyel tampon taşması. Kötü niyetli kullanıcı, arabellekten sonra okunmasına neden olacak sıkıştırılmış verileri iletebilir. Bu sorun Yandex bilgi güvenliği ekibinden Eldar Zaitov tarafından bulundu. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Tamsayılar taşması nedeniyle yanlış sonucu düzeltin `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Şimdi `OPTIMIZE TABLE` sorgu işlemi gerçekleştirmek çevrimdışı yinelemeler için beklemez. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) +- Sabit `ALTER TTL` par forser for `Replicated*MergeTree` Tablolar. [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Sunucu ve istemci arasındaki iletişimi düzeltin, böylece sunucu sorgu hatasından sonra geçici tablolar bilgilerini okur. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- Düzeltmek `bitmapAnd` birleştirilmiş bir bit eşlem ve bir skaler bit eşlem kesişen işlev hatası. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) +- Tanımı rafine `ZXid` hata düzeltmeleri ZooKeeper programcı Kılavuzu göre `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) +- `odbc` tablo fonksiyonu şimdi saygı `external_table_functions_use_nulls` ayar. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) +- Nadir bir veri yarışına yol açan Sabit hata. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) +- Şimdi `SYSTEM RELOAD DICTIONARY` göz ardı ederek bir sözlüğü tamamen yeniden yükler `update_field`. Bu düzeltmeler [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) +- Sözlüğün sorgu oluştur’da olup olmadığını kontrol etme yeteneği ekleyin. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) +- Düzeltmek `Float*` ayrıştırma `Values` biçimli. Bu düzeltmeler [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- Bazı arka plan işlemlerinde yer ayıramadığımızda çökmeyi düzeltin `*MergeTree` masa motorları ailesi. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Tablo içerdiğinde birleştirme işleminin çökmesini düzeltin `SimpleAggregateFunction(LowCardinality)` sütun. Bu düzeltmeler [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) +- Tüm YBÜ yerel destek geri yükleme ve sabit ifadeler için harmanlama uygulamak için yeteneği ekleyin. Ayrıca dil adı ekleyin `system.collations` Tablo. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) +- Sıfır minimum ömrü olan harici sözlükler olduğunda hatayı düzeltin (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) arka planda güncelleme yapmayın. [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) +- ClickHouse kaynağı ile harici sözlük sorguda alt sorgu olduğunda çökmesini düzeltin. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Motor ile tablodaki dosya uzantısının yanlış ayrıştırılmasını düzeltin `URL`. Bu düzeltmeler [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) +- Düzeltmek `CHECK TABLE` sorgu için `*MergeTree` anahtarsız tablolar. Düzeltiyor [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) +- Sabit dönüşüm `Float64` MySQL türü için. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) +- Şimdi Eğer tablo tamamen sunucu çökmesi nedeniyle düştü değildi, sunucu geri yüklemek ve yüklemek için çalışacağız. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- Tablo işlevinde sabit çökme `file` mevcut olmayan dosyaya eklerken. Şimdi bu durumda dosya oluşturulur ve daha sonra insert işlenir. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- Ne zaman olabilir nadir kilitlenme Fix `trace_log` etkin olduğunu. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- Yanında farklı türleri ile çalışmak için yeteneği ekleyin `Date` içinde `RangeHashed` DDL sorgusundan oluşturulan dış sözlük. Düzeltiyor [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) +- Düzeltmeler çökme zaman `now64()` başka bir işlevin sonucu ile çağrılır. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) +- Mysql Tel protokolü üzerinden bağlantılar için istemci IP tespit ile Sabit hata. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) +- Boş dizi işlemeyi düzeltin `arraySplit` işlev. Bu düzeltmeler [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) +- Sorunu ne zaman düzeltildi `pid-file` başka bir koşu `clickhouse-server` silinebilir. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) +- Varsa sözlük yeniden yükle `invalidate_query`, güncellemeleri durdurdu ve önceki güncelleme denemelerinde bazı istisnalar. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) +- Fonksiyonda Sabit hata `arrayReduce` bu yol açabilir “double free” ve toplu işlev birleştiricisinde hata `Resample` bu bellek sızıntısına neden olabilir. Toplama fonksiyonu eklendi `aggThrow`. Bu fonksiyon test amaçlı kullanılabilir. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Geliştirme {#improvement-1} + +- İle çalışırken geliştirilmiş günlük kaydı `S3` masa motoru. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Çağrılırken hiçbir bağımsız değişken geçirildiğinde yazdırılan yardım iletisi `clickhouse-local`. Bu düzeltmeler [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) +- Ayar Ekle `mutations_sync` hangi beklemek sağlar `ALTER UPDATE/DELETE` eşzamanlı sorgular. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) +- Göreli ayarlamak için izin ver `user_files_path` içinde `config.xml` (bir şekilde benzer `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) +- Dönüştürme işlevleri için yasadışı türler için istisna Ekle `-OrZero` postfix. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) +- Bir dağıtılmış sorgu bir parça için veri gönderme başlığındaki kolay bir biçim. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) +- `Live View` tablo motoru refactoring. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) +- DDL sorgularından oluşturulan dış sözlükler için ek kontroller ekleyin. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) +- Hatayı Düzelt `Column ... already exists` kullanırken `FINAL` ve `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Düzeltiyor [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Şimdi tablo ilk argüman `joinGet` fonksiyon tablo indentifier olabilir. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos Kuşu](https://github.com/amosbird)) +- Kullanmaya izin ver `MaterializedView` yukarıdaki alt sorgularla `Kafka` Tablolar. [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) +- Şimdi arka plan diskler arasında hareket eder, seprate iş parçacığı havuzunu çalıştırır. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) +- `SYSTEM RELOAD DICTIONARY` şimdi eşzamanlı olarak yürütür. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) +- Yığın izleri artık sanal bellek adresleri yerine (nesne dosyasının yüklendiği) fiziksel adresleri (nesne dosyasındaki uzaklıklar) görüntüler. Bu kullanımına izin verir `addr2line` ikili konum bağımsız ve ASLR etkin olduğunda. Bu düzeltmeler [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Satır düzeyinde güvenlik filtreleri için yeni sözdizimi desteği: `
`. Düzeltiyor [\#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [\#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([I ivanvan](https://github.com/abyss7)) +- Şimdi `cityHash` fonksiyonu ile çalışabilir `Decimal` ve `UUID` türler. Düzeltiyor [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) +- Uyarlanabilir tanecikliliğin uygulanmasından sonra eskimiş olduğu için sistem günlüklerinden sabit dizin tanecikliliği (1024 idi) kaldırıldı. [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- ClickHouse SSL olmadan derlendiğinde etkin MySQL uyumluluk sunucusu. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) +- Şimdi sunucu sağlama toplamları toplu halde bozuk veri durumunda daha ayrıntılı hatalar veren partiler dağıttı. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) +- Destek `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` ve `ATTACH TABLE` için `MySQL` veritabanı motoru. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([Kış Zhang](https://github.com/zhang2014)) +- S3 tablo fonksiyonu ve tablo motoru kimlik doğrulama ekleyin. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) +- İlave parçalar için kontrol eklendi `MergeTree` farklı disklerde, tanımlanmamış disklerdeki veri parçalarını kaçırmamak için. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Mac istemci ve sunucu için SSL desteğini etkinleştirin. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([I ivanvan](https://github.com/abyss7)) +- Şimdi ClickHouse MySQL Federe sunucu olarak çalışabilir (bkz https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- `clickhouse-client` şimdi sadece etkinleştir `bracketed-paste` multiquery açık ve çok satırlı kapalı olduğunda. Bu düzeltmeler (\#7757) \[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos Kuşu](https://github.com/amosbird)) +- Destek `Array(Decimal)` içinde `if` işlev. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) +- Destek ondalık `arrayDifference`, `arrayCumSum` ve `arrayCumSumNegative` işlevler. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) +- Katma `lifetime` sütun için `system.dictionaries` Tablo. [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekule](https://github.com/kekekekule)) +- İçin farklı disklerde mevcut parçalar için geliştirilmiş kontrol `*MergeTree` masa motorları. Kur [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) +- İle entegrasyon `AWS SDK` için `S3` tüm S3 özelliklerini kutudan çıkarmaya izin veren etkileşimler. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) +- Alt sorgular için destek eklendi `Live View` Tablolar. [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) +- Kullanmak için kontrol edin `Date` veya `DateTime` sütun fromundan `TTL` ifadeler kaldırıldı. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Disk hakkında bilgi eklendi `system.detached_parts` Tablo. [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Şimdi ayarlar `max_(table|partition)_size_to_drop` yeniden başlatma olmadan değiştirilebilir. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) +- Hata mesajlarının biraz daha iyi kullanılabilirliği. Kullanıcıdan aşağıdaki satırları kaldırmamasını isteyin `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Daha iyi okuma mesajları `Kafka` sonra çeşitli biçim enginelerde motor [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([I ivanvan](https://github.com/abyss7)) +- Desteklemeyen MySQL istemcileri ile daha iyi uyumluluk `sha2_password` auth eklentisi. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) +- MySQL uyumluluk sunucusunda daha fazla sütun türünü destekleyin. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) +- Uygulamak `ORDER BY` için optimizasyon `Merge`, `Buffer` ve `Materilized View` altta yatan depolar `MergeTree` Tablolar. [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) +- Şimdi her zaman POSIX uygulamasını kullanıyoruz `getrandom` eski çekirdeklerle daha iyi uyumluluğa sahip olmak (\<3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos Kuşu](https://github.com/amosbird)) +- Bir hareket TTL kuralında geçerli hedef için daha iyi kontrol edin. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) +- Kırık ekleme partileri için daha iyi kontroller `Distributed` masa motoru. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) +- Gelecekte işlem mustesi gereken parça adı diz ofisiyle sütun ekleme `system.mutations` Tablo. [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) +- İşlemciler için paralel birleştirme sıralama optimizasyonu. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Ayar `mark_cache_min_lifetime` artık eskimiş ve hiçbir şey yapmıyor. Önceki sürümlerde, Mark cache bellek daha büyük büyüyebilir `mark_cache_size` içinde veri karşılamak için `mark_cache_min_lifetime` ikincilikler. Bu, karışıklığa ve beklenenden daha yüksek bellek kullanımına yol açıyordu, bu özellikle bellek kısıtlı sistemlerde kötüydü. Bu sürümü yükledikten sonra performans düşüşü görecekseniz, `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kullanıma hazırlık `tid` her yerde. Bu için gereklidir [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +#### Performans İyileştirme {#performance-improvement-1} + +- İşlemciler boru hattında performans iyileştirmeleri. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Önbellek sözlüklerinde süresi dolmuş anahtarların engellenmeyen güncellemeleri (eskileri okuma izni ile). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Olmadan ClickHouse derlemek `-fno-omit-frame-pointer` küresel bir daha kayıt yedek. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos Kuşu](https://github.com/amosbird)) +- Hızlanma `greatCircleDistance` fonksiyon ve bunun için performans testleri ekleyin. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) +- Fonksiyonun geliştirilmiş performansı `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Geliştirilmiş performans `max`, `min`, `argMin`, `argMax` için `DateTime64` veri türü. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) +- Bir sınırı olmadan veya büyük sınırı ve dış sıralama ile sıralama geliştirilmiş performans. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kayan nokta sayılarını 6 kata kadar biçimlendirmenin geliştirilmiş performansı. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Geliştirilmiş performans `modulo` işlev. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos Kuşu](https://github.com/amosbird)) +- Optimum `ORDER BY` ve tek sütun tuşu ile birleştirme. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin daha iyi uygulama `arrayReduce`, `-Array` ve `-State` birleştiriciler. [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos Kuşu](https://github.com/amosbird)) +- Şimdi `PREWHERE` olarak en az verimli olacak şekilde optimize edilmelidir `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos Kuşu](https://github.com/amosbird)) +- Yolu geliştirmek `round` ve `roundBankers` negatif sayılar işleme. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) +- Geliştirilmiş çözme performansı `DoubleDelta` ve `Gorilla` codec bileşenleri yaklaşık %30-40 oranında. Bu düzeltmeler [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) +- Geliştirilmiş performans `base64` ilgili fonksiyonlar. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Bir işlev eklendi `geoDistance`. Bu benzer `greatCircleDistance` ancak wgs-84 elipsoid modeline yaklaşım kullanır. Her iki fonksiyonun performansı da aynıdır. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Hızla `min` ve `max` için toplama fonksiyonları `Decimal` veri türü. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) +- Vectorize işleme `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Kuşu](https://github.com/amosbird)) +- `if` zincirler şimdi olarak optimize edilmiştir `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) +- Performans gerilemesini düzeltin `Kafka` masa motoru 19.15’te tanıtıldı. Bu düzeltmeler [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) +- Kaldırıyordu “pie” kod üretimi `gcc` Debian paketlerinden bazen varsayılan olarak getirir. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Paralel ayrıştırma veri formatları [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) +- Optimize edilmiş ayrıştırıcıyı etkinleştir `Values` varsayılan olarak ifadelerle (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) + +#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-2} + +- İçin düzeltmeler oluşturun `ARM` ve minimal modda. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) +- İçin kapsama dosyası Ekle `clickhouse-server` std:: atexit çağrılmadığında. Ayrıca kapsama ile vatansız testlerde biraz geliştirilmiş günlüğü. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) +- Contrib’de llvm kütüphanesini güncelleyin. OS paketlerinden LLVM kullanmaktan kaçının. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Paket yapmak `curl` tamamen sessiz inşa. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) +- Bazı düzeltmek `MemorySanitizer` uyarmalar. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Kullanmak `add_warning` ve `no_warning` makro inlar içinde `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([I ivanvan](https://github.com/abyss7)) +- Minio S3 uyumlu nesne desteği ekleyin (https://min.io/) daha iyi entegrasyon testleri için. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) +- İthal `libc` başlıklar contrib için. Oluşturur daha tutarlı (sadece için çeşitli sistemler üzerinde yapmak için izin verir `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kaldırmak `-fPIC` bazı kütüphanelerden. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Temizlemek `CMakeLists.txt` kıvırmak için. Bkz. https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sessiz uyarılar `CapNProto` kitaplık. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kısa dize optimize karma tablolar için performans testleri ekleyin. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos Kuşu](https://github.com/amosbird)) +- Şimdi ClickHouse üzerine inşa edecek `AArch64` bile `MADV_FREE` kullanılamaz. Bu düzeltmeler [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos Kuşu](https://github.com/amosbird)) +- Güncelleştirme `zlib-ng` bellek dezenfektanı sorunları düzeltmek için. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Linux olmayan sistemde dahili MySQL kütüphanesini etkinleştirin, çünkü OS paketlerinin kullanımı çok kırılgandır ve genellikle hiç çalışmaz. Bu düzeltmeler [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Etkinleştirildikten sonra bazı sistemlerde sabit yapı `libc++`. Bu yerini alır [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yapmak `Field` yöntemleri daha fazla tür-daha fazla hata bulmak için güvenli. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Eksik dosyalar eklendi `libc-headers` alt modül. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yanlış Düzelt `JSON` performans testi çıktısında alıntı. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Şimdi yığın izleme için görüntülenir `std::exception` ve `Poco::Exception`. Önceki sürümlerde sadece mevcuttu `DB::Exception`. Bu teşhis geliştirir. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Taşıma `clock_gettime` ve `clock_nanosleep` taze glibc sürümleri için. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos Kuşu](https://github.com/amosbird)) +- Etkinleştirmek `part_log` geliştiriciler için örnek yapılandırmada. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yeniden yüklemenin async doğasını düzeltin `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) +- Sabit codec performans testleri. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) +- İçin yükleme s scriptscript addleri Ekle `.tgz` onlar için yapı ve belgeler. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) +- Eski kaldırıldı `ZSTD` test (2016 yılında zstd’nin 1.0 sürümünün olduğu hatayı yeniden üretmek için oluşturuldu). Bu düzeltmeler [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Mac OS Catalina üzerinde sabit yapı. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) +- Sonuç fark yapmak için codec performans testlerinde satır sayısı arttı. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) +- Hata ayıklama yapılarında, tedavi `LOGICAL_ERROR` onaylama işlemi hatası gibi özel durumlar, dikkat kolaylaştırmak. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Biçimlerle ilgili performans testini daha deterministik hale getirin. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Güncelleştirme `lz4` bir hafızayı düzeltmek İçinvatandaş arızası. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Bilinen bir MemorySanitizer yanlış pozitif özel durum işleme bastırın. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Güncelleştirme `gcc` ve `g++` sürüm 9 için `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) +- Bunu test etmek için performans testi örneği ekleyin `PREWHERE` daha kötü `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos Kuşu](https://github.com/amosbird)) +- Bir gevşek testi düzeltmek için ilerleme. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Veri için MemorySanitizer raporundan kaçının `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Güncel `libc++` en son sürüme. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Kaynaklardan YBÜ Kütüphanesi oluşturun. Bu düzeltmeler [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Anahtar fromlı `libressl` -e doğru `openssl`. ClickHouse, bu değişiklikten sonra TLS 1.3 ve SNI’Yİ desteklemelidir. Bu düzeltmeler [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Sabit UBSan raporu kullanırken `chacha20_poly1305` SS SSLL (’den (Bağlan (ış happensta olur https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin varsayılan şifre dosyasının düzeltme modu `.deb` linux dağıtımları. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) +- Almak için geliştirilmiş ifade `clickhouse-server` Pidıd ın `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) +- V1.10.0 için contrib/googletest güncellendi. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Sabit ThreadSaninitizer raporu `base64` kitaplık. Ayrıca bu kütüphaneyi en son sürüme güncelledi, ancak önemli değil. Bu düzeltmeler [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Düzeltmek `00600_replace_running_query` işlemciler için. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- İçin destek Kaldır `tcmalloc` yapmak `CMakeLists.txt` basit. [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yayın gcc şimdi kullanmak oluşturur `libc++` yerine `libstdc++`. Son zamanlarda `libc++` sadece clang ile kullanıldı. Bu yapı yapılandırmaları ve taşınabilirlik tutarlılığını artıracaktır. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- MemorySanitizer ile inşa etmek için YBÜ kütüphanesini etkinleştirin. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Gelen uyarıları bastır `CapNProto` kitaplık. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- İçin özel kod durumları kaldırıldı `tcmalloc`, çünkü artık desteklenmiyor. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- CI kapsama görevinde, kapsama raporunu kaydetmesine izin vermek için sunucuyu incelikle öldürün. Bu, son zamanlarda gördüğümüz eksik kapsama raporlarını düzeltir. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) +- Karşı tüm codec bileşenleri için performans testleri `Float64` ve `UInt64` değerler. [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) +- `termcap` (f çeşitli sorunlar için çok kaldırılmış ve kurşundur.g. eksik “up” kap ve yankılanan `^J` çok satır yerine). İyilik `terminfo` veya paketlenmiş `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos Kuşu](https://github.com/amosbird)) +- Düzeltmek `test_storage_s3` entegrasyon testi. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Destek `StorageFile(, null)` aslında Diske yazmadan verilen format dosyasına blok eklemek için. Bu performans testleri için gereklidir. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos Kuşu](https://github.com/amosbird)) +- Eklenen argüman `--print-time` test başına yürütme süresini basan işlevsel testlere. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Eklenen iddialar `KeyCondition` rpn değerlendirirken. Bu, gcc-9’dan gelen uyarıyı düzeltir. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Cı yapılarında cmake seçeneklerini dökümü. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Bazı fat kitaplıkları için hata ayıklama bilgisi oluşturmayın. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Yapmak `log_to_console.xml` her zaman ne olursa olsun interaktif ya da değil, stderr oturum açın. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- Kullanılmayan bazı özellikler kaldırıldı `clickhouse-performance-test` aracı. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Şimdi de arayacağız `lld-X` karşılık gelen ile `clang-X` sürüm. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) +- Parke inşa iyileştirme. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([maxulan](https://github.com/maxulan)) +- Daha fazla GCC uyarısı [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- Arch Linux için paket şimdi ClickHouse sunucusu çalıştırmak için izin verir, ve sadece istemci. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) +- İşlemcilerle testi düzeltin. Küçük performans düzeltmeleri. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) +- Contrib/protobuf güncelleyin. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) +- Yeni yıl kutlaması olarak C++20’ye geçmenin hazırlanmasında. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos Kuşu](https://github.com/amosbird)) + +#### Deneysel Özellik {#experimental-feature-1} + +- Deneysel ayar eklendi `min_bytes_to_use_mmap_io`. Bu userspace çekirdekten veri kopyalamadan büyük dosyaları okumak için izin verir. Bu ayar varsayılan olarak devre dışıdır. Önerilen eşik yaklaşık 64 MB’dir, çünkü mmap / munmap yavaştır. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) +- Erişim kontrol sisteminin bir parçası olarak yeniden işlenmiş kotalar. Yeni tablo eklendi `system.quotas` yeni fonksiyonlar `currentQuota`, `currentQuotaKey`, yeni SQL sözdizimi `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) +- İstisnalar atmak yerine bilinmeyen ayarları uyarılarla atlamaya izin verin. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) +- Erişim kontrol sisteminin bir parçası olarak reworked satır politikaları. Yeni tablo eklendi `system.row_policies` yeni işlev `currentRowPolicies()`, yeni SQL sözdizimi `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) + +#### Güvenlik Düzeltme {#security-fix} + +- İle tablolarda dizin yapısını okuma imkanı Düzelt theildi `File` masa motoru. Bu düzeltmeler [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) + +## [2019 için Changelog](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/tr/whats_new/index.md b/docs/tr/whats-new/index.md similarity index 100% rename from docs/tr/whats_new/index.md rename to docs/tr/whats-new/index.md diff --git a/docs/tr/whats_new/roadmap.md b/docs/tr/whats-new/roadmap.md similarity index 100% rename from docs/tr/whats_new/roadmap.md rename to docs/tr/whats-new/roadmap.md diff --git a/docs/tr/whats-new/security-changelog.md b/docs/tr/whats-new/security-changelog.md new file mode 100644 index 00000000000..a48aa97a650 --- /dev/null +++ b/docs/tr/whats-new/security-changelog.md @@ -0,0 +1,76 @@ +--- +machine_translated: true +machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 +toc_priority: 76 +toc_title: "G\xFCvenlik Changelog" +--- + +## ClickHouse sürümünde düzeltildi 19.14.3.3, 2019-09-10 {#fixed-in-clickhouse-release-19-14-3-3-2019-09-10} + +### CVE-2019-15024 {#cve-2019-15024} + +Аn attacker that has write access to ZooKeeper and who ican run a custom server available from the network where ClickHouse runs, can create a custom-built malicious server that will act as a ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from the malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. + +Kredi: Yandex Bilgi Güvenliği ekibinden Eldar Zaitov + +### CVE-2019-16535 {#cve-2019-16535} + +Аn OOB read, OOB write and integer underflow in decompression algorithms can be used to achieve RCE or DoS via native protocol. + +Kredi: Yandex Bilgi Güvenliği ekibinden Eldar Zaitov + +### CVE-2019-16536 {#cve-2019-16536} + +DOS’A giden yığın taşması, kötü amaçlı kimliği doğrulanmış bir istemci tarafından tetiklenebilir. + +Kredi: Yandex Bilgi Güvenliği ekibinden Eldar Zaitov + +## ClickHouse sürümü 19.13.6.1, 2019-09-20’de düzeltildi {#fixed-in-clickhouse-release-19-13-6-1-2019-09-20} + +### CVE-2019-18657 {#cve-2019-18657} + +Tablo fonksiyonu `url` güvenlik açığı saldırganın istekte rasgele HTTP üstbilgileri enjekte etmesine izin vermişti. + +Krediler: [Nikita Tikhomirov](https://github.com/NSTikhomirov) + +## ClickHouse sürümünde Sabit 18.12.13, 2018-09-10 {#fixed-in-clickhouse-release-18-12-13-2018-09-10} + +### CVE-2018-14672 {#cve-2018-14672} + +Catboost modellerini yüklemek için işlevler, yol geçişine izin verdi ve hata mesajları aracılığıyla keyfi dosyaları okudu. + +Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov + +## ClickHouse sürüm 18.10.3, 2018-08-13 Sabit {#fixed-in-clickhouse-release-18-10-3-2018-08-13} + +### CVE-2018-14671 {#cve-2018-14671} + +unixODBC, dosya sisteminden rasgele paylaşılan nesnelerin yüklenmesine izin verdi ve bu da uzaktan kod yürütme güvenlik açığına yol açtı. + +Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov ve Evgeny Sidorov + +## ClickHouse sürüm 1.1.54388, 2018-06-28 Sabit {#fixed-in-clickhouse-release-1-1-54388-2018-06-28} + +### CVE-2018-14668 {#cve-2018-14668} + +“remote” tablo fonksiyonu izin keyfi semboller “user”, “password” ve “default\_database” çapraz Protokol isteği sahtecilik saldırılarına yol açan alanlar. + +Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov + +## ClickHouse sürüm 1.1.54390, 2018-07-06 Sabit {#fixed-in-clickhouse-release-1-1-54390-2018-07-06} + +### CVE-2018-14669 {#cve-2018-14669} + +ClickHouse MySQL istemcisi vardı “LOAD DATA LOCAL INFILE” işlevsellik, kötü niyetli bir MySQL veritabanının bağlı ClickHouse sunucusundan rasgele dosyaları okumasına izin verdi. + +Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov ve Evgeny Sidorov + +## ClickHouse sürüm 1.1.54131, 2017-01-10 Sabit {#fixed-in-clickhouse-release-1-1-54131-2017-01-10} + +### CVE-2018-14670 {#cve-2018-14670} + +Deb paketindeki yanlış yapılandırma, veritabanının yetkisiz kullanımına neden olabilir. + +Kredi: İngiltere’nin Ulusal siber güvenlik merkezi (NCSC) + +{## [Orijinal makale](https://clickhouse.tech/docs/en/security_changelog/) ##} diff --git a/docs/tr/whats_new/changelog/2017.md b/docs/tr/whats_new/changelog/2017.md deleted file mode 100644 index 2f31be7f6de..00000000000 --- a/docs/tr/whats_new/changelog/2017.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 79 -toc_title: '2017' ---- - -### ClickHouse sürüm 1.1.54327, 2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} - -Bu sürüm önceki sürüm 1.1.54318 için hata düzeltmeleri içerir: - -- Veri kaybına yol açabilir çoğaltma Olası yarış koşulu ile Sabit hata. Bu sorun sürümleri 1.1.54310 ve 1.1.54318 etkiler. Bu sürümlerden birini çoğaltılmış tablolarla kullanırsanız, güncelleştirme önerilir. Bu sorun, aşağıdaki gibi uyarı iletilerindeki günlüklerde gösterilir `Part ... from own log doesn't exist.` Bu iletileri günlüklerde görmeseniz bile sorun geçerlidir. - -### ClickHouse sürümü 1.1.54318, 2017-11-30 {#clickhouse-release-1-1-54318-2017-11-30} - -Bu sürüm önceki sürüm 1.1.54310 için hata düzeltmeleri içerir: - -- SummingMergeTree motorunda birleştirmeler sırasında hatalı satır silme işlemleri düzeltildi -- Unreplicated MergeTree motorlarında bir bellek sızıntısı düzeltildi -- MergeTree motorlarında sık sık eklerle sabit performans düşüşü -- Çoğaltma kuyruğunun çalışmayı durdurmasına neden olan bir sorun giderildi -- Sunucu günlüklerinin sabit rotasyonu ve arşivlenmesi - -### ClickHouse sürümü 1.1.54310, 2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} - -#### Yenilik: {#new-features} - -- Tablo motorları MergeTree ailesi için özel bölümleme anahtarı. -- [Kafka](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) masa motoru. -- Yükleme için destek eklendi [CatBoost](https://catboost.yandex/) modelleri ve ClickHouse saklanan verilere uygulayarak. -- UTC olmayan tamsayı uzaklıklar ile saat dilimleri için destek eklendi. -- Zaman aralıklarıyla aritmetik işlemler için destek eklendi. -- Tarih ve DateTime türleri için değer aralığı 2105 yılına genişletilir. -- Add theed the `CREATE MATERIALIZED VIEW x TO y` sorgu (materyalleştirilmiş bir görünümün verilerini depolamak için varolan bir tabloyu belirtir). -- Add theed the `ATTACH TABLE` argüman olmadan sorgu. -- Bir SummingMergeTree tablosunda-Map biten adları ile iç içe sütunlar için işleme mantığı için ayıklandı sumMap toplama işlevi. Şimdi bu tür sütunları açıkça belirtebilirsiniz. -- IP trie sözlüğünün maksimum boyutu 128M girişlerine yükseltilir. -- GetSizeOfEnumType işlevi eklendi. -- SumWithOverflow toplama işlevi eklendi. -- Cap'n Proto giriş biçimi için destek eklendi. -- Artık zstd algoritmasını kullanırken sıkıştırma seviyesini özelleştirebilirsiniz. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes} - -- Bellek dışında bir motor ile geçici tablolar oluşturulmasına izin verilmez. -- View veya MaterializedView altyapısı ile tabloların açık oluşturulmasına izin verilmez. -- Tablo oluşturma sırasında yeni bir onay örnekleme anahtar ifadesinin birincil anahtara dahil edildiğini doğrular. - -#### Hata düzeltmeleri: {#bug-fixes} - -- Sabit hangups zaman eşzamanlı bir dağıtılmış tabloya ekleme. -- Sabit atomik olmayan ekleme ve çoğaltılmış tablolarda parçaların çıkarılması. -- Materialized görünümüne eklenen veriler gereksiz tekilleştirme tabi değildir. -- Yerel yinelemenin geciktiği ve uzak yinelemelerin kullanılamadığı dağıtılmış bir tabloya bir sorgu yürütmek artık bir hataya neden olmaz. -- Kullanıcıların erişim izinlerine ihtiyacı yoktur `default` veritabanı artık geçici tablolar oluşturmak için. -- Bağımsız değişkenler olmadan dizi türünü belirtirken çökmesini düzeltildi. -- Sunucu günlüklerini içeren disk birimi dolu olduğunda sabit hangups. -- Unix döneminin ilk haftası için toRelativeWeekNum işlevinde bir taşma düzeltildi. - -#### İyileştirmeler oluşturun: {#build-improvements} - -- Birkaç üçüncü taraf Kütüphanesi (özellikle Poco) güncellendi ve git alt modüllerine dönüştürüldü. - -### ClickHouse sürümü 1.1.54304, 2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} - -#### Yenilik: {#new-features-1} - -- Yerel protokolde TLS desteği (etkinleştirmek, ayarlamak için `tcp_ssl_port` içinde `config.xml` ). - -#### Hata düzeltmeleri: {#bug-fixes-1} - -- `ALTER` çoğaltılmış tablolar için şimdi en kısa sürede çalışmaya başlamak çalışır. -- Ayarı ile veri okurken çökmesini sabit `preferred_block_size_bytes=0.` -- Sabit çöker `clickhouse-client` bas whenarken `Page Down` -- Bazı karmaşık sorguların doğru yorumlanması `GLOBAL IN` ve `UNION ALL` -- `FREEZE PARTITION` her zaman atomik olarak çalışır. -- Boş posta istekleri şimdi 411 koduyla bir yanıt döndürür. -- Gibi ifadeler için sabit yorumlama hataları `CAST(1 AS Nullable(UInt8)).` -- Okurken bir hata düzeltildi `Array(Nullable(String))` Col fromum fromns from `MergeTree` Tablolar. -- Gibi sorguları ayrıştırırken sabit çökmesini `SELECT dummy AS dummy, dummy AS b` -- Kullanıcılar geçersiz ile doğru güncellenir `users.xml` -- Yürütülebilir bir sözlük sıfır olmayan bir yanıt kodu döndürdüğünde doğru işleme. - -### ClickHouse yayın 1.1.54292, 2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} - -#### Yenilik: {#new-features-2} - -- Add theed the `pointInPolygon` koordinat düzleminde koordinatlarla çalışmak için işlev. -- Add theed the `sumMap` benzer dizilerin toplamını hesaplamak için toplama işlevi `SummingMergeTree`. -- Add theed the `trunc` işlev. Yuvarlama fonksiyonlarının geliştirilmiş performansı (`round`, `floor`, `ceil`, `roundToExp2`) ve nasıl çalıştıklarının mantığını düzeltti. Mantığını değiştirdi `roundToExp2` kesirler ve negatif sayılar için işlev. -- ClickHouse yürütülebilir dosyası artık libc sürümüne daha az bağımlıdır. Aynı ClickHouse yürütülebilir dosya Linux sistemleri çok çeşitli çalıştırabilirsiniz. Derlenmiş sorguları kullanırken hala bir bağımlılık var (ayar ile `compile = 1` , varsayılan olarak kullanılmaz). -- Sorguların dinamik derlenmesi için gereken süreyi azalttı. - -#### Hata düzeltmeleri: {#bug-fixes-2} - -- Bazen üretilen bir hata düzeltildi `part ... intersects previous part` mesajlar ve kopya tutarlılığı zayıfladı. -- ZooKeeper kapatma sırasında kullanılamıyorsa sunucunun kilitlenmesine neden olan bir hata düzeltildi. -- Kopyaları geri yüklerken aşırı günlüğü kaldırıldı. -- Birlik tüm uygulamasında bir hata düzeltildi. -- Bir bloktaki ilk sütun dizi türüne sahipse, concat işlevinde bir hata düzeltildi. -- İlerleme şimdi sistemde doğru görüntülenir.tablo birleştirir. - -### ClickHouse yayın 1.1.54289, 2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} - -#### Yenilik: {#new-features-3} - -- `SYSTEM` sunucu yönetimi için sorgular: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. -- Dizilerle çalışmak için işlevler eklendi: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. -- Katma `root` ve `identity` ZooKeeper yapılandırması için parametreler. Bu, aynı ZooKeeper kümesinde tek tek kullanıcıları izole etmenizi sağlar. -- Toplam fonksiyonları eklendi `groupBitAnd`, `groupBitOr`, ve `groupBitXor` (uyumluluk için, isimler altında da mevcuttur `BIT_AND`, `BIT_OR`, ve `BIT_XOR`). -- Dış sözlükler dosya sisteminde bir soket belirterek Mysql'den yüklenebilir. -- Harici sözlükler SSL üzerinden MySQL yüklenebilir (`ssl_cert`, `ssl_key`, `ssl_ca` parametre). -- Add theed the `max_network_bandwidth_for_user` kullanıcı başına sorgular için genel bant genişliği kullanımını kısıtlamak için ayarlama. -- İçin destek `DROP TABLE` geçici tablolar için. -- Okuma desteği `DateTime` Unix zaman damgası biçimindeki değerler `CSV` ve `JSONEachRow` biçimliler. -- Dağıtılmış sorgularda gecikmeli yinelemeler artık varsayılan olarak dışlanır (varsayılan eşik 5 dakikadır). -- FIFO kilitleme sırasında kullanılır ALTER: bir ALTER sorgusu sürekli çalışan sorgular için süresiz olarak engellenmez. -- Seçeneği ayarlamak için `umask` yapılandırma dosyasında. -- İle sorgular için geliştirilmiş performans `DISTINCT` . - -#### Hata düzeltmeleri: {#bug-fixes-3} - -- ZooKeeper eski düğümleri silme işlemi geliştirildi. Daha önce, eski düğümler bazen çok sık ekler varsa silinmedi, bu da sunucunun diğer şeylerin yanı sıra kapanması için yavaş olmasına neden oldu. -- ZooKeeper bağlantı için ana seçerken sabit randomizasyon. -- Çoğaltma localhost ise, dağıtılmış sorgularda gecikmiş kopyaların dışlanması düzeltildi. -- Bir veri parçası bir hata düzeltildi `ReplicatedMergeTree` tablo çalıştırdıktan sonra kırık olabilir `ALTER MODIFY` bir element üzerinde `Nested` yapılı. -- SELECT sorgularına neden olabilecek bir hata düzeltildi “hang”. -- Dağıtılmış DDL sorguları için iyileştirmeler. -- Sorgu düzeltildi `CREATE TABLE ... AS `. -- Çık themaz theı Çöz thedü `ALTER ... CLEAR COLUMN IN PARTITION` sorgu için `Buffer` Tablolar. -- İçin geçersiz varsayılan değer düzeltildi `Enum` kullanırken s (minimum yerine 0) `JSONEachRow` ve `TSKV` biçimliler. -- Bir sözlük ile bir sözlük kullanırken zombi süreçlerinin görünümünü çözdü `executable` kaynaklı. -- Kafa sorgusu için sabit segfault. - -#### ClickHouse geliştirmek ve birleştirmek için geliştirilmiş iş akışı: {#improved-workflow-for-developing-and-assembling-clickhouse} - -- Kullanabilirsiniz `pbuilder` ClickHouse inşa etmek. -- Kullanabilirsiniz `libc++` yerine `libstdc++` Linux üzerine inşa edilmiştir. -- Statik kod analiz araçlarını kullanma talimatları eklendi: `Coverage`, `clang-tidy`, `cppcheck`. - -#### Yükseltme yaparken lütfen unutmayın: {#please-note-when-upgrading} - -- MergeTree ayarı için artık daha yüksek bir varsayılan değer var `max_bytes_to_merge_at_max_space_in_pool` (bayt olarak birleştirilecek veri parçalarının maksimum toplam boyutu): 100 Gib'den 150 Gib'e yükseldi. Bu, disk Alt Sisteminde artan bir yüke neden olabilecek sunucu yükseltmesinden sonra çalışan büyük birleştirmelere neden olabilir. Sunucuda kullanılabilir boş alan, çalışan birleştirmelerin toplam miktarının iki katından azsa, bu, diğer tüm birleştirmelerin, küçük veri parçalarının birleştirmeleri de dahil olmak üzere çalışmayı durdurmasına neden olur. Sonuç olarak, INSERT sorguları iletiyle başarısız olur “Merges are processing significantly slower than inserts.” Kullan... `SELECT * FROM system.merges` durumu izlemek için sorgu. Ayrıca kontrol edebilirsiniz `DiskSpaceReservedForMerge` metr theik `system.metrics` tablo veya Grafit. Bunu düzeltmek için hiçbir şey yapmanıza gerek yoktur, çünkü büyük birleşimler bittikten sonra sorun kendiliğinden çözülür. Bu kabul edilemez bulursanız, önceki değeri geri yükleyebilirsiniz `max_bytes_to_merge_at_max_space_in_pool` ayar. Bunu yapmak için, gidin config bölümünde.xml, set ``` ``107374182400 ``` ve sunucuyu yeniden başlatın. - -### ClickHouse sürümü 1.1.54284, 2017-08-29 {#clickhouse-release-1-1-54284-2017-08-29} - -- Bu, önceki 1.1.54282 sürümü için bir hata düzeltme sürümüdür. Bu ZooKeeper parçalar dizininde sızıntıları giderir. - -### ClickHouse yayın 1.1.54282, 2017-08-23 {#clickhouse-release-1-1-54282-2017-08-23} - -Bu sürüm önceki sürüm 1.1.54276 için hata düzeltmeleri içerir: - -- Sabit `DB::Exception: Assertion violation: !_path.empty()` dağıtılmış bir tabloya eklerken. -- Giriş verileri'; ' ile başlarsa RowBinary biçiminde eklerken ayrıştırma düzeltildi. -- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). - -### ClickHouse Yayın 1.1.54276, 2017-08-16 {#clickhouse-release-1-1-54276-2017-08-16} - -#### Yenilik: {#new-features-4} - -- Bir seçme sorgusu için bölüm ile isteğe bağlı eklendi. Örnek sorgu: `WITH 1+1 AS a SELECT a, a*a` -- INSERT, dağıtılmış bir tabloda eşzamanlı olarak gerçekleştirilebilir: Tamam, yalnızca tüm veriler tüm parçalara kaydedildikten sonra döndürülür. Bu ayar tarafından etkinleştirilir ınsert\_distributed\_sync = 1. -- 16 baytlık tanımlayıcılarla çalışmak için UUID veri türü eklendi. -- Tablo ile uyumluluk için CHAR, FLOAT ve diğer türlerin takma adları eklendi. -- Sayılara zaman dönüştürmek için fonksiyonları toYYYYMM, toYYYYMMDD ve toYYYYMMDDhhmmss eklendi. -- Kümelenmiş DDL sorguları için sunucuları tanımlamak için IP adreslerini (ana bilgisayar adı ile birlikte) kullanabilirsiniz. -- İşlevde sabit olmayan argümanlar ve negatif uzaklıklar için destek eklendi `substring(str, pos, len).` -- İçin max\_size parametresi eklendi `groupArray(max_size)(column)` toplama işlevi ve performansını optimize etti. - -#### Ana değişiklikler: {#main-changes} - -- Güvenlik iyileştirmeleri: tüm sunucu dosyaları 0640 izinleriyle oluşturulur (üzerinden değiştirilebilir config parametresi). -- Geçersiz sözdizimi ile sorgular için geliştirilmiş hata mesajları. -- MergeTree verilerinin büyük bölümlerini birleştirirken bellek tüketimini önemli ölçüde azalttı ve performansı artırdı. -- ReplacingMergeTree motoru için veri birleştirmelerinin performansını önemli ölçüde artırdı. -- Birden çok kaynak ekler birleştirerek dağıtılmış bir tablodan zaman uyumsuz ekler için geliştirilmiş performans. Bu işlevi etkinleştirmek için distributed\_directory\_monitor\_batch\_ınserts = 1 ayarını kullanın. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-1} - -- Toplam durumların ikili biçimini değiştirdi `groupArray(array_column)` diziler için fonksiyonlar. - -#### Değişikliklerin tam listesi: {#complete-list-of-changes} - -- Add theed the `output_format_json_quote_denormals` json formatında nan ve ınf değerleri çıktısı sağlayan ayar. -- Dağıtılmış bir tablodan okurken optimize edilmiş akış tahsisi. -- Değer değişmezse ayarlar salt okunur modda yapılandırılabilir. -- Preferred\_block\_size\_bytes ayarında belirtilen blok boyutu üzerindeki kısıtlamaları karşılamak için mergetree motorunun tamsayı olmayan granüllerini alma yeteneği eklendi. Amaç, RAM tüketimini azaltmak ve büyük sütunlu tablolardan gelen sorguları işlerken önbellek konumunu arttırmaktır. -- Gibi ifadeler içeren dizinlerin verimli kullanımı `toStartOfHour(x)` gibi koşullar için `toStartOfHour(x) op сonstexpr.` -- MergeTree motorları için yeni ayarlar eklendi (yapılandırmada merge\_tree bölümü.xml): - - replicated\_deduplication\_window\_seconds yinelenen tablolar ekler tekilleştirme için izin verilen saniye sayısını ayarlar. - - cleanup\_delay\_period, eski verileri kaldırmak için temizleme işleminin ne sıklıkta başlatılacağını ayarlar. - - replicated\_can\_become\_leader, bir kopyanın lider olmasını (ve birleştirme atamasını) engelleyebilir. -- Hızlandırılmış Temizleme ZooKeeper eski verileri kaldırmak için. -- Kümelenmiş DDL sorguları için birden fazla iyileştirme ve düzeltme. Özellikle ilgi çekici olan yeni ayardır distributed\_ddl\_task\_timeout, kümedeki sunuculardan bir yanıt beklemek için zamanı sınırlar. Tüm ana bilgisayarlarda bir ddl isteği gerçekleştirilmediyse, bir yanıt bir zaman aşımı hatası içerir ve bir zaman uyumsuz modunda bir istek yürütülür. -- Sunucu günlüklerinde yığın izlerinin geliştirilmiş gösterimi. -- Add theed the “none” sıkıştırma yöntemi için değer. -- Yapılandırmada birden çok dictionaries\_config bölümünü kullanabilirsiniz.xml. -- Bu dosya sisteminde bir soket üzerinden MySQL bağlanmak mümkündür. -- Sistem.parçalar tablosu, bayt cinsinden işaretlerin boyutu hakkında bilgi içeren yeni bir sütuna sahiptir. - -#### Hata düzeltmeleri: {#bug-fixes-4} - -- Bir birleştirme tablosu kullanarak dağıtılmış tablolar artık bir koşulla bir SELECT sorgusu için doğru şekilde çalışır. `_table` alan. -- Veri parçalarını kontrol ederken ReplicatedMergeTree nadir bir yarış durumu düzeltildi. -- Sabit Olası donma “leader election” bir sunucu başlatırken. -- Veri kaynağının yerel bir kopyasını kullanırken max\_replica\_delay\_for\_distributed\_queries ayarı göz ardı edildi. Bu sorun giderildi. -- Sabit yanlış davranış `ALTER TABLE CLEAR COLUMN IN PARTITION` varolan olmayan bir sütunu temizlemeye çalışırken. -- Boş diziler veya dizeleri kullanırken multiİf işlevinde bir istisna düzeltildi. -- Sabit aşırı bellek ayırmaları yerel biçimi serisini kaldırırken. -- Trie sözlüklerin sabit yanlış otomatik güncelleme. -- Örnek kullanırken bir birleştirme tablosundan bir GROUP BY yan tümcesi ile sorguları çalıştırırken bir özel durum düzeltildi. -- Distributed\_aggregation\_memory\_efficient = 1 kullanırken grup çökmesi düzeltildi. -- Şimdi veritabanını belirtebilirsiniz.ın ve JOİN sağ tarafında tablo. -- Paralel toplama için çok fazla iplik kullanıldı. Bu sorun giderildi. -- Sabit nasıl “if” işlev FixedString argümanları ile çalışır. -- 0 ağırlığında kırıkları için dağıtılmış bir tablodan yanlış çalıştı seçin. Bu sorun giderildi. -- Çalışma `CREATE VIEW IF EXISTS no longer causes crashes.` -- Sabit yanlış davranış input\_format\_skip\_unknown\_fields=1 ayarlanır ve negatif sayılar vardır. -- Sabit bir sonsuz döngü içinde `dictGetHierarchy()` sözlükte bazı geçersiz veriler varsa işlev. -- Sabit `Syntax error: unexpected (...)` bir In veya JOIN yan tümcesi ve birleştirme tablolarındaki alt sorgularla dağıtılmış sorguları çalıştırırken hatalar. -- Sözlük tablolarından bir seçme sorgusunun yanlış yorumlanması düzeltildi. -- Sabit “Cannot mremap” 2 milyardan fazla öğe içeren ın ve JOIN yan tümcelerinde diziler kullanılırken hata oluştu. -- Kaynak olarak MySQL ile sözlükler için yük devretme düzeltildi. - -#### ClickHouse geliştirmek ve birleştirmek için geliştirilmiş iş akışı: {#improved-workflow-for-developing-and-assembling-clickhouse-1} - -- Yapılar Arcadia'da monte edilebilir. -- Clickhouse'u derlemek için gcc 7'yi kullanabilirsiniz. -- Ccache+distcc kullanarak paralel yapılar artık daha hızlı. - -### ClickHouse yayın 1.1.54245, 2017-07-04 {#clickhouse-release-1-1-54245-2017-07-04} - -#### Yenilik: {#new-features-5} - -- Dağıtılmış DDL (örneğin, `CREATE TABLE ON CLUSTER`) -- Çoğaltılan sorgu `ALTER TABLE CLEAR COLUMN IN PARTITION.` -- Sözlük tabloları için motor (bir tablo şeklinde sözlük verilerine erişim). -- Sözlük veritabanı motoru (bu tür veritabanı otomatik olarak bağlı tüm dış sözlükler için sözlük tabloları vardır). -- Kaynağa bir istek göndererek sözlükteki güncellemeleri kontrol edebilirsiniz. -- Nitelikli sütun adları -- Çift tırnak işaretleri kullanarak tanımlayıcıları alıntı. -- HTTP arabirimindeki oturumlar. -- Çoğaltılmış bir tablo için en iyi duruma getirme sorgusu yalnızca lider üzerinde çalışabilir. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-2} - -- Kaldırıldı set GLOBAL. - -#### Küçük değişiklikler: {#minor-changes} - -- Şimdi bir uyarı tetiklendikten sonra günlük tam yığın izleme yazdırır. -- Başlangıçta hasarlı / ekstra veri parçalarının sayısının doğrulanmasını rahatlattı(çok fazla yanlış pozitif vardı). - -#### Hata düzeltmeleri: {#bug-fixes-5} - -- Kötü bir bağlantı düzeltildi “sticking” dağıtılmış bir tabloya eklerken. -- GLOBAL IN şimdi dağıtılmış bir tabloya bakan bir birleştirme tablosundan bir sorgu için çalışır. -- Bir Google Compute Engine sanal makinesinde yanlış sayıda çekirdek tespit edildi. Bu sorun giderildi. -- Önbelleğe alınmış harici sözlüklerin yürütülebilir bir kaynağının nasıl çalıştığındaki değişiklikler. -- Null karakter içeren dizelerin karşılaştırması düzeltildi. -- Float32 birincil anahtar alanlarının sabitler ile karşılaştırılması düzeltildi. -- Önceden, bir alanın boyutunun yanlış bir tahmini, aşırı büyük tahsisatlara neden olabilir. -- Alter kullanarak bir tabloya eklenen null bir sütun sorgularken bir kilitlenme düzeltildi. -- Satır sayısı sınırdan az ise, null bir sütuna göre sıralama yaparken bir kilitlenme düzeltildi. -- Yalnızca sabit değerlerden oluşan alt sorgu ile bir sipariş düzeltildi. -- Daha önce, çoğaltılmış bir tablo başarısız bir bırakma tablosundan sonra geçersiz durumda kalabilir. -- Boş sonuçları olan skaler alt sorgular için takma adlar artık kaybolmaz. -- Şimdi derleme kullanılan bir sorgu .so dosyası zarar görürse bir hata ile başarısız değil. diff --git a/docs/tr/whats_new/changelog/2018.md b/docs/tr/whats_new/changelog/2018.md deleted file mode 100644 index 884c1725bbd..00000000000 --- a/docs/tr/whats_new/changelog/2018.md +++ /dev/null @@ -1,1063 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 78 -toc_title: '2018' ---- - -## ClickHouse sürümü 18.16 {#clickhouse-release-18-16} - -### ClickHouse sürümü 18.16.1, 2018-12-21 {#clickhouse-release-18-16-1-2018-12-21} - -#### Hata düzeltmeleri: {#bug-fixes} - -- ODBC kaynağı ile sözlükleri güncelleme ile ilgili sorunlara yol açan bir hata düzeltildi. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- Toplama işlevlerinin JIT derlemesi artık LowCardinality sütunlarıyla çalışır. [\#3838](https://github.com/ClickHouse/ClickHouse/issues/3838) - -#### Geliştirmeler: {#improvements} - -- Add theed the `low_cardinality_allow_in_native_format` ayar (varsayılan: etkin). Devre dışı bırakıldığında, LOWCARDİNALİTY sütunları, SELECT sorguları için sıradan sütunlara dönüştürülür ve INSERT sorguları için sıradan sütunlar beklenir. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) - -#### İyileştirmeler oluşturun: {#build-improvements} - -- MacOS ve ARM üzerine inşa için düzeltmeler. - -### ClickHouse yayın 18.16.0, 2018-12-14 {#clickhouse-release-18-16-0-2018-12-14} - -#### Yenilik: {#new-features} - -- `DEFAULT` ifadeler, yarı yapılandırılmış giriş biçimlerinde veri yüklenirken eksik alanlar için değerlendirilir (`JSONEachRow`, `TSKV`). Özelliği ile etkin `insert_sample_with_metadata` ayar. [\#3555](https://github.com/ClickHouse/ClickHouse/pull/3555) -- Bu `ALTER TABLE` sorgu şimdi var `MODIFY ORDER BY` bir tablo sütunu eklerken veya kaldırırken sıralama anahtarını değiştirme eylemi. Bu tablolar için yararlıdır `MergeTree` bu sıralama anahtarına dayalı olarak birleştirilirken ek görevler gerçekleştiren aile `SummingMergeTree`, `AggregatingMergeTree` ve bu yüzden. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) [\#3755](https://github.com/ClickHouse/ClickHouse/pull/3755) -- Tablolar için `MergeTree` aile, şimdi farklı bir sıralama anahtarı belirtebilirsiniz (`ORDER BY` ve dizin (`PRIMARY KEY`). Sıralama anahtarı dizin daha uzun olabilir. [\#3581](https://github.com/ClickHouse/ClickHouse/pull/3581) -- Add theed the `hdfs` tablo fonksiyonu ve `HDFS` hdfs'ye veri içe ve dışa aktarmak için tablo motoru. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/3617) -- Base64 ile çalışmak için fonksiyonlar eklendi: `base64Encode`, `base64Decode`, `tryBase64Decode`. [Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3350) -- Şimdi hassasiyetini yapılandırmak için bir parametre kullanabilirsiniz `uniqCombined` toplama işlevi (HyperLogLog hücrelerinin sayısını seçin). [\#3406](https://github.com/ClickHouse/ClickHouse/pull/3406) -- Add theed the `system.contributors` ClickHouse taahhüt yapılan herkesin adlarını içeren tablo. [\#3452](https://github.com/ClickHouse/ClickHouse/pull/3452) -- Bölüm için ihmal yeteneği eklendi `ALTER TABLE ... FREEZE` tüm bölümleri bir kerede yedeklemek için sorgu. [\#3514](https://github.com/ClickHouse/ClickHouse/pull/3514) -- Katma `dictGet` ve `dictGetOrDefault` dönüş değeri türünü belirtmeyi gerektirmeyen işlevler. Tür sözlük açıklamasından otomatik olarak belirlenir. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3564) -- Şimdi tablo açıklamasında bir sütun için yorum belirtmek ve kullanarak değiştirebilirsiniz `ALTER`. [\#3377](https://github.com/ClickHouse/ClickHouse/pull/3377) -- Okuma için desteklenir `Join` basit tuşlarla tabloları yazın. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Şimdi seçenekleri belirtebilirsiniz `join_use_nulls`, `max_rows_in_join`, `max_bytes_in_join`, ve `join_overflow_mode` oluştururken bir `Join` tablo yazın. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Add theed the `joinGet` kullan allowsmanıza olanak sağlayan bir işlev `Join` bir sözlük gibi tablo yazın. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3728) -- Add theed the `partition_key`, `sorting_key`, `primary_key`, ve `sampling_key` Col theum thens to the `system.tables` tablo tuşları hakkında bilgi vermek için tablo. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Add theed the `is_in_partition_key`, `is_in_sorting_key`, `is_in_primary_key`, ve `is_in_sampling_key` Col theum thens to the `system.columns` Tablo. [\#3609](https://github.com/ClickHouse/ClickHouse/pull/3609) -- Add theed the `min_time` ve `max_time` Col theum thens to the `system.parts` Tablo. Bölümleme anahtarı aşağıdakilerden oluşan bir ifade olduğunda bu sütunlar doldurulur `DateTime` sütun. [Emmanuel Donin de Rosière](https://github.com/ClickHouse/ClickHouse/pull/3800) - -#### Hata düzeltmeleri: {#bug-fixes-1} - -- Düzeltmeler ve performans iyileştirmeleri için `LowCardinality` veri türü. `GROUP BY` kullanım `LowCardinality(Nullable(...))`. Değerlerini almak `extremes`. Yüksek mertebeden fonksiyonların işlenmesi. `LEFT ARRAY JOIN`. Dağılı `GROUP BY`. Dönen işlevler `Array`. Yürütme `ORDER BY`. Yazma `Distributed` tablolar (nicelulu). Geriye dönük uyumluluk için `INSERT` uygulayan eski istemcilerden gelen sorgular `Native` protokol. İçin destek `LowCardinality` için `JOIN`. Tek bir akışta çalışırken geliştirilmiş performans. [\#3823](https://github.com/ClickHouse/ClickHouse/pull/3823) [\#3803](https://github.com/ClickHouse/ClickHouse/pull/3803) [\#3799](https://github.com/ClickHouse/ClickHouse/pull/3799) [\#3769](https://github.com/ClickHouse/ClickHouse/pull/3769) [\#3744](https://github.com/ClickHouse/ClickHouse/pull/3744) [\#3681](https://github.com/ClickHouse/ClickHouse/pull/3681) [\#3651](https://github.com/ClickHouse/ClickHouse/pull/3651) [\#3649](https://github.com/ClickHouse/ClickHouse/pull/3649) [\#3641](https://github.com/ClickHouse/ClickHouse/pull/3641) [\#3632](https://github.com/ClickHouse/ClickHouse/pull/3632) [\#3568](https://github.com/ClickHouse/ClickHouse/pull/3568) [\#3523](https://github.com/ClickHouse/ClickHouse/pull/3523) [\#3518](https://github.com/ClickHouse/ClickHouse/pull/3518) -- Sabit nasıl `select_sequential_consistency` seçenek çalışır. Daha önce, bu ayar etkinleştirildiğinde, bazen yeni bir bölüme yazmaya başladıktan sonra tamamlanmamış bir sonuç döndürüldü. [\#2863](https://github.com/ClickHouse/ClickHouse/pull/2863) -- DDL yürütülürken veritabanları doğru belirtilir `ON CLUSTER` sorgular ve `ALTER UPDATE/DELETE`. [\#3772](https://github.com/ClickHouse/ClickHouse/pull/3772) [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Veritabanları doğru bir görünüm içinde alt sorgular için belirtilir. [\#3521](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Bir hata düzeltildi `PREWHERE` ile `FINAL` için `VersionedCollapsingMergeTree`. [7167bfd7](https://github.com/ClickHouse/ClickHouse/commit/7167bfd7b365538f7a91c4307ad77e552ab4e8c1) -- Şimdi kullanabilirsiniz `KILL QUERY` henüz başlatılmamış olan sorguları iptal etmek için, tablonun kilitlenmesini bekliyorlar. [\#3517](https://github.com/ClickHouse/ClickHouse/pull/3517) -- Saatlerin gece yarısı geri hareket ettirilmesi durumunda düzeltilmiş tarih ve saat hesaplamaları (bu İran'da olur ve Moskova'da 1981'den 1983'e kadar olur). Önceden, bu, gerekenden bir gün önce sıfırlanma süresine yol açtı ve ayrıca tarih ve saatin metin biçiminde yanlış biçimlendirilmesine neden oldu. [\#3819](https://github.com/ClickHouse/ClickHouse/pull/3819) -- Bazı durumlarda sabit hatalar `VIEW` ve veritabanını atlayan alt sorgular. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3521) -- Aynı anda bir yarıştan okurken bir yarış durumu düzeltildi `MATERIALIZED VIEW` ve Silme bir `MATERIALIZED VIEW` nedeniyle değil kilitleme iç `MATERIALIZED VIEW`. [\#3404](https://github.com/ClickHouse/ClickHouse/pull/3404) [\#3694](https://github.com/ClickHouse/ClickHouse/pull/3694) -- Hata düzeltildi `Lock handler cannot be nullptr.` [\#3689](https://github.com/ClickHouse/ClickHouse/pull/3689) -- Sabit sorgu işleme zaman `compile_expressions` seçenek etkindir (varsayılan olarak etkindir). Gibi Nondeterministic sabit ifadeler `now` işlev artık açılmıyor. [\#3457](https://github.com/ClickHouse/ClickHouse/pull/3457) -- Sabit olmayan bir ölçek argümanı belirtilirken bir kilitlenme düzeltildi `toDecimal32/64/128` işlevler. -- Bir dizi eklemeye çalışırken bir hata düzeltildi `NULL` element inler `Values` bir sütuna Biçimlendir türü `Array` olarak `Nullable` (eğer `input_format_values_interpret_expressions` = 1). [\#3487](https://github.com/ClickHouse/ClickHouse/pull/3487) [\#3503](https://github.com/ClickHouse/ClickHouse/pull/3503) -- Sabit sürekli hata günlüğü `DDLWorker` ZooKeeper mevcut değilse. [8f50c620](https://github.com/ClickHouse/ClickHouse/commit/8f50c620334988b28018213ec0092fe6423847e2) -- Sabit dönüş türü için `quantile*` gelen fonksiyonlar `Date` ve `DateTime` argüman türleri. [\#3580](https://github.com/ClickHouse/ClickHouse/pull/3580) -- Sabit `WITH` Ifade olmadan basit bir takma ad belirtirse yan tümcesi. [\#3570](https://github.com/ClickHouse/ClickHouse/pull/3570) -- Adlandırılmış alt sorgular ve nitelikli sütun adları ile sorguların sabit işleme `enable_optimize_predicate_expression` etkindir. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3588) -- Hata düzeltildi `Attempt to attach to nullptr thread group` maddi görüşlerle çalışırken. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3623) -- Belirli yanlış argümanları iletirken bir kilitlenme düzeltildi `arrayReverse` işlev. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- Tampon taş theması Düzelt theildi `extractURLParameter` işlev. Geliştirilmiş performans. Sıfır bayt içeren dizelerin doğru işlenmesi eklendi. [141e9799](https://github.com/ClickHouse/ClickHouse/commit/141e9799e49201d84ea8e951d1bed4fb6d3dacb5) -- Sabit tampon taşması `lowerUTF8` ve `upperUTF8` işlevler. Üzerinde bu işlevleri yürütmek için yeteneği kaldırıldı `FixedString` bağımsız değişkenleri yazın. [\#3662](https://github.com/ClickHouse/ClickHouse/pull/3662) -- Silerken nadir bir yarış durumu düzeltildi `MergeTree` Tablolar. [\#3680](https://github.com/ClickHouse/ClickHouse/pull/3680) -- Okuma sırasında bir yarış durumu düzeltildi `Buffer` tablolar ve aynı anda performans `ALTER` veya `DROP` hedef masalarda. [\#3719](https://github.com/ClickHouse/ClickHouse/pull/3719) -- Sabit bir segfault eğer `max_temporary_non_const_columns` sınır aşıldı. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### Geliştirmeler: {#improvements-1} - -- Sunucu için işlenmiş yapılandırma dosyalarını yazmaz `/etc/clickhouse-server/` dizin. Bunun yerine, onları kaydeder `preprocessed_configs` içindeki dizin `path`. Bu demektir `/etc/clickhouse-server/` dizin için yazma erişimi yok `clickhouse` güvenliği artıran kullanıcı. [\#2443](https://github.com/ClickHouse/ClickHouse/pull/2443) -- Bu `min_merge_bytes_to_use_direct_io` seçenek varsayılan olarak 10 GiB olarak ayarlanır. Mergetree ailesinden tabloların büyük bölümlerini oluşturan bir birleştirme gerçekleştirilir `O_DIRECT` aşırı sayfa önbellek tahliyesini önleyen mod. [\#3504](https://github.com/ClickHouse/ClickHouse/pull/3504) -- Hızlandırılmış sunucu, çok sayıda tablo olduğunda başlar. [\#3398](https://github.com/ClickHouse/ClickHouse/pull/3398) -- Bir bağlantı havuzu ve HTTP eklendi `Keep-Alive` yinelemeler arasındaki bağlantılar için. [\#3594](https://github.com/ClickHouse/ClickHouse/pull/3594) -- Sorgu sözdizimi geçersiz ise, `400 Bad Request` kod iade edilir `HTTP` arabirim (500 daha önce iade edildi). [31bc680a](https://github.com/ClickHouse/ClickHouse/commit/31bc680ac5f4bb1d0360a8ba4696fa84bb47d6ab) -- Bu `join_default_strictness` option is set to `ALL` uyumluluk için varsayılan olarak. [120e2cbe](https://github.com/ClickHouse/ClickHouse/commit/120e2cbe2ff4fbad626c28042d9b28781c805afe) -- Kaldırılan günlüğü `stderr` şuradan `re2` geçersiz veya karmaşık düzenli ifadeler için kütüphane. [\#3723](https://github.com/ClickHouse/ClickHouse/pull/3723) -- İçin eklendi `Kafka` tablo altyapısı: kafka'dan okumaya başlamadan önce abonelikleri denetler; tablo için kafka\_max\_block\_size ayarı. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3396) -- Bu `cityHash64`, `farmHash64`, `metroHash64`, `sipHash64`, `halfMD5`, `murmurHash2_32`, `murmurHash2_64`, `murmurHash3_32`, ve `murmurHash3_64` işlevler artık herhangi bir sayıda bağımsız değişken ve bağımsız değişkenler için tuples şeklinde çalışır. [\#3451](https://github.com/ClickHouse/ClickHouse/pull/3451) [\#3519](https://github.com/ClickHouse/ClickHouse/pull/3519) -- Bu `arrayReverse` işlev artık herhangi bir dizi türü ile çalışır. [73e3a7b6](https://github.com/ClickHouse/ClickHouse/commit/73e3a7b662161d6005e7727d8a711b930386b871) -- İsteğe bağlı bir parametre eklendi: yuva boyutu için `timeSlots` işlev. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3724) -- İçin `FULL` ve `RIGHT JOIN`, bu `max_block_size` ayar, sağ tablodan birleştirilmemiş veri akışı için kullanılır. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3699) -- Add theed the `--secure` komut satırı parametresi `clickhouse-benchmark` ve `clickhouse-performance-test` TLS'Yİ etkinleştirmek için. [\#3688](https://github.com/ClickHouse/ClickHouse/pull/3688) [\#3690](https://github.com/ClickHouse/ClickHouse/pull/3690) -- Tür dönüştürme zaman yapısı bir `Buffer` tür tablo hedef tablonun yapısıyla eşleşmiyor. [Vitaly Baranov](https://github.com/ClickHouse/ClickHouse/pull/3603) -- Add theed the `tcp_keep_alive_timeout` belirtilen zaman aralığı için hareketsizlikten sonra canlı tutma paketlerini etkinleştirme seçeneği. [\#3441](https://github.com/ClickHouse/ClickHouse/pull/3441) -- Bölüm anahtarı için değerlerin gereksiz alıntı kaldırıldı `system.parts` tablo tek bir sütundan oluşuyorsa. [\#3652](https://github.com/ClickHouse/ClickHouse/pull/3652) -- Modulo fonksiyonu için çalışır `Date` ve `DateTime` veri türleri. [\#3385](https://github.com/ClickHouse/ClickHouse/pull/3385) -- İçin eş anlamlı eklendi `POWER`, `LN`, `LCASE`, `UCASE`, `REPLACE`, `LOCATE`, `SUBSTR`, ve `MID` işlevler. [\#3774](https://github.com/ClickHouse/ClickHouse/pull/3774) [\#3763](https://github.com/ClickHouse/ClickHouse/pull/3763) Bazı işlev adları, SQL standardı ile uyumluluk için büyük / küçük harf duyarsızdır. Sözdizimsel şeker eklendi `SUBSTRING(expr FROM start FOR length)` SQL ile uyumluluk için. [\#3804](https://github.com/ClickHouse/ClickHouse/pull/3804) -- Yeteneği eklendi `mlock` karşılık gelen bellek sayfaları `clickhouse-server` bellek yetersiz zorla önlemek için yürütülebilir kod. Bu özellik varsayılan olarak devre dışıdır. [\#3553](https://github.com/ClickHouse/ClickHouse/pull/3553) -- Okuma sırasında geliştirilmiş performans `O_DIRECT` (ile `min_bytes_to_use_direct_io` seçeneği etkin). [\#3405](https://github.com/ClickHouse/ClickHouse/pull/3405) -- Geliştirilmiş performans `dictGet...OrDefault` sabit anahtar bağımsız değişkeni ve sabit olmayan bir varsayılan bağımsız değişken için işlev. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3563) -- Bu `firstSignificantSubdomain` işlev artık etki alanlarını işler `gov`, `mil`, ve `edu`. [Igor Hatarist](https://github.com/ClickHouse/ClickHouse/pull/3601) Geliştirilmiş performans. [\#3628](https://github.com/ClickHouse/ClickHouse/pull/3628) -- Başlangıç için özel ortam değişkenlerini belirleme yeteneği `clickhouse-server` kullanarak `SYS-V init.d` tanım bylayarak script `CLICKHOUSE_PROGRAM_ENV` içinde `/etc/default/clickhouse`. - [Pavlo Bashynskyi](https://github.com/ClickHouse/ClickHouse/pull/3612) -- Clickhouse-server init komut dosyası için doğru dönüş kodu. [\#3516](https://github.com/ClickHouse/ClickHouse/pull/3516) -- Bu `system.metrics` tablo şimdi var `VersionInteger` metr andik ve `system.build_options` eklenen satır var `VERSION_INTEGER`, ClickHouse sürümünün sayısal formunu içeren, örneğin `18016000`. [\#3644](https://github.com/ClickHouse/ClickHouse/pull/3644) -- Karşılaştırma yeteneği kaldırıldı `Date` gibi olası hataları önlemek için bir sayı ile yazın `date = 2018-12-17`, tarih etrafında tırnak yanlışlıkla ihmal nerede. [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) -- Durumsal işlevlerin davranışı gibi düzeltildi `rowNumberInAllBlocks`. Daha önce sorgu analizi sırasında başlatma nedeniyle bir sayı daha büyük olan bir sonuç çıkardılar. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3729) -- Eğer... `force_restore_data` dosya silinemez, bir hata mesajı görüntülenir. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3794) - -#### İyileştirmeler oluşturun: {#build-improvements-1} - -- Güncelleme `jemalloc` olası bir bellek sızıntısını gideren kitaplık. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3557) -- İle profil profilingleme `jemalloc` hata ayıklama yapıları için varsayılan olarak etkindir. [2cc82f5c](https://github.com/ClickHouse/ClickHouse/commit/2cc82f5cbe266421cd4c1165286c2c47e5ffcb15) -- Yalnızca entegrasyon testlerini çalıştırma yeteneği eklendi `Docker` sistemde yüklü. [\#3650](https://github.com/ClickHouse/ClickHouse/pull/3650) -- Select sorgularında fuzz ifade testi eklendi. [\#3442](https://github.com/ClickHouse/ClickHouse/pull/3442) -- Daha fazla yarış koşullarını tespit etmek için paralel ve rastgele sırayla fonksiyonel testler gerçekleştiren taahhütler için bir stres testi eklendi. [\#3438](https://github.com/ClickHouse/ClickHouse/pull/3438) -- Bir Docker görüntüsünde clickhouse-server başlatmak için yöntem geliştirildi. [Elghazal Ahmed](https://github.com/ClickHouse/ClickHouse/pull/3663) -- Bir Docker görüntüsü için, dosyaları kullanarak veritabanlarını başlatmak için destek eklendi `/docker-entrypoint-initdb.d` dizin. [Konstantin Lebedev](https://github.com/ClickHouse/ClickHouse/pull/3695) -- Arm üzerine inşa için düzeltmeler. [\#3709](https://github.com/ClickHouse/ClickHouse/pull/3709) - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes} - -- Karşılaştırma yeteneği kaldırıldı `Date` bir sayı ile yazın. Yerine `toDate('2018-12-18') = 17883`, açık tür dönüştürme kullanmanız gerekir `= toDate(17883)` [\#3687](https://github.com/ClickHouse/ClickHouse/pull/3687) - -## ClickHouse sürümü 18.14 {#clickhouse-release-18-14} - -### ClickHouse yayın 18.14.19, 2018-12-19 {#clickhouse-release-18-14-19-2018-12-19} - -#### Hata düzeltmeleri: {#bug-fixes-2} - -- ODBC kaynağı ile sözlükleri güncelleme ile ilgili sorunlara yol açan bir hata düzeltildi. [\#3825](https://github.com/ClickHouse/ClickHouse/issues/3825), [\#3829](https://github.com/ClickHouse/ClickHouse/issues/3829) -- DDL yürütülürken veritabanları doğru belirtilir `ON CLUSTER` sorgular. [\#3460](https://github.com/ClickHouse/ClickHouse/pull/3460) -- Sabit bir segfault eğer `max_temporary_non_const_columns` sınır aşıldı. [\#3788](https://github.com/ClickHouse/ClickHouse/pull/3788) - -#### İyileştirmeler oluşturun: {#build-improvements-2} - -- Arm üzerine inşa için düzeltmeler. - -### ClickHouse yayın 18.14.18, 2018-12-04 {#clickhouse-release-18-14-18-2018-12-04} - -#### Hata düzeltmeleri: {#bug-fixes-3} - -- Sabit hata `dictGet...` tip sözlükler için işlev `range`, argümanlardan biri sabit ve diğeri değilse. [\#3751](https://github.com/ClickHouse/ClickHouse/pull/3751) -- Mesajlara neden olan Sabit hata `netlink: '...': attribute type 1 has an invalid length` Linux çekirdeği günlüğüne yazdırılmak üzere, bu sadece Linux çekirdeğinin yeterince taze sürümlerinde gerçekleşiyordu. [\#3749](https://github.com/ClickHouse/ClickHouse/pull/3749) -- Fonksiyon sabit segfault `empty` argüman için `FixedString` tür. [Daniel, Dao Quang Minh.](https://github.com/ClickHouse/ClickHouse/pull/3703) -- Büyük bir değer kullanırken sabit aşırı bellek ayırma `max_query_size` ayar (bir bellek yığını `max_query_size` bayt bir kerede önceden tahsis edildi). [\#3720](https://github.com/ClickHouse/ClickHouse/pull/3720) - -#### Yapı değişiklikleri: {#build-changes} - -- OS paketlerinden sürüm 7 LLVM/Clang kütüphaneleri ile sabit yapı (bu kütüphaneler çalışma zamanı sorgu derleme için kullanılır). [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### ClickHouse yayın 18.14.17, 2018-11-30 {#clickhouse-release-18-14-17-2018-11-30} - -#### Hata düzeltmeleri: {#bug-fixes-4} - -- ODBC köprü işlemi ana sunucu işlemi ile sonlandırmak değil sabit durumlar. [\#3642](https://github.com/ClickHouse/ClickHouse/pull/3642) -- Sabit senkron ekleme içine `Distributed` uzak tablonun sütun listesinden farklı bir sütun listesi içeren tablo. [\#3673](https://github.com/ClickHouse/ClickHouse/pull/3673) -- Bir MergeTree tablosunu düşürürken bir kazaya yol açabilecek nadir bir yarış durumu düzeltildi. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Sorgu iş parçacığı oluşturma ile başarısız olduğunda bir sorgu kilitlenme düzeltildi `Resource temporarily unavailable` hatasız. [\#3643](https://github.com/ClickHouse/ClickHouse/pull/3643) -- Sabit ayrıştırma `ENGINE` fık thera ne zaman `CREATE AS table` sözdizimi kullanıldı ve `ENGINE` fık thera daha önce belirt theilmişti `AS table` (hata, belirtilen motoru yok saymakla sonuçlandı). [\#3692](https://github.com/ClickHouse/ClickHouse/pull/3692) - -### ClickHouse yayın 18.14.15, 2018-11-21 {#clickhouse-release-18-14-15-2018-11-21} - -#### Hata düzeltmeleri: {#bug-fixes-5} - -- Bellek yığınının boyutu, türün sütununu seri hale getirirken fazla tahmin edildi `Array(String)` bu yol açar “Memory limit exceeded” hatasızlar. Sorun 18.12.13 sürümünde ortaya çıktı. [\#3589](https://github.com/ClickHouse/ClickHouse/issues/3589) - -### ClickHouse yayın 18.14.14, 2018-11-20 {#clickhouse-release-18-14-14-2018-11-20} - -#### Hata düzeltmeleri: {#bug-fixes-6} - -- Sabit `ON CLUSTER` küme güvenli (bayrak) olarak yapılandırıldığında sorgular ``). [\#3599](https://github.com/ClickHouse/ClickHouse/pull/3599) - -#### Yapı değişiklikleri: {#build-changes-1} - -- Sabit sorunlar (sistemden llvm-7, macos) [\#3582](https://github.com/ClickHouse/ClickHouse/pull/3582) - -### ClickHouse yayın 18.14.13, 2018-11-08 {#clickhouse-release-18-14-13-2018-11-08} - -#### Hata düzeltmeleri: {#bug-fixes-7} - -- Sabit `Block structure mismatch in MergingSorted stream` hatasız. [\#3162](https://github.com/ClickHouse/ClickHouse/issues/3162) -- Sabit `ON CLUSTER` küme yapılandırmasında güvenli bağlantıların açık olması durumunda sorgular ( `` bayrak). [\#3465](https://github.com/ClickHouse/ClickHouse/pull/3465) -- Kullanılan sorgularda bir hata düzeltildi `SAMPLE`, `PREWHERE` ve alias sütunları. [\#3543](https://github.com/ClickHouse/ClickHouse/pull/3543) -- Sabit bir nadir `unknown compression method` hata ne zaman `min_bytes_to_use_direct_io` ayar etkinleştirildi. [3544](https://github.com/ClickHouse/ClickHouse/pull/3544) - -#### Performans iyileştirmeleri: {#performance-improvements} - -- Sorguların sabit performans gerilemesi `GROUP BY` AMD EPYC işlemciler üzerinde yürütülürken uint16 veya tarih türü sütunların. [Igor Lapko](https://github.com/ClickHouse/ClickHouse/pull/3512) -- Uzun dizeleri işleyen sorguların sabit performans gerilemesi. [\#3530](https://github.com/ClickHouse/ClickHouse/pull/3530) - -#### İyileştirmeler oluşturun: {#build-improvements-3} - -- Arcadia yapı basitleştirilmesi için iyileştirmeler. [\#3475](https://github.com/ClickHouse/ClickHouse/pull/3475), [\#3535](https://github.com/ClickHouse/ClickHouse/pull/3535) - -### ClickHouse yayın 18.14.12, 2018-11-02 {#clickhouse-release-18-14-12-2018-11-02} - -#### Hata düzeltmeleri: {#bug-fixes-8} - -- İki isimsiz alt sorgu katılmadan bir kilitlenme düzeltildi. [\#3505](https://github.com/ClickHouse/ClickHouse/pull/3505) -- Hatalı sorgular oluşturma sabit (boş `WHERE` yan tümcesi) dış veritabanlarını sorgularken. [hotid](https://github.com/ClickHouse/ClickHouse/pull/3477) -- ODBC sözlüklerinde yanlış bir zaman aşımı değeri kullanılarak düzeltildi. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3511) - -### ClickHouse yayın 18.14.11, 2018-10-29 {#clickhouse-release-18-14-11-2018-10-29} - -#### Hata düzeltmeleri: {#bug-fixes-9} - -- Hata düzeltildi `Block structure mismatch in UNION stream: different number of columns` sınır sorgularında. [\#2156](https://github.com/ClickHouse/ClickHouse/issues/2156) -- İç içe geçmiş yapılar içinde diziler içeren tablolarda veri birleştirirken sabit hatalar. [\#3397](https://github.com/ClickHouse/ClickHouse/pull/3397) -- Sabit yanlış sorgu sonuçları eğer `merge_tree_uniform_read_distribution` ayar devre dışı (varsayılan: etkin). [\#3429](https://github.com/ClickHouse/ClickHouse/pull/3429) -- Yerel formatta dağıtılmış bir tabloya ekler üzerinde bir hata düzeltildi. [\#3411](https://github.com/ClickHouse/ClickHouse/issues/3411) - -### ClickHouse yayın 18.14.10, 2018-10-23 {#clickhouse-release-18-14-10-2018-10-23} - -- Bu `compile_expressions` ayar (ifadelerin JIT derlemesi) varsayılan olarak devre dışıdır. [\#3410](https://github.com/ClickHouse/ClickHouse/pull/3410) -- Bu `enable_optimize_predicate_expression` ayar varsayılan olarak devre dışıdır. - -### ClickHouse yayın 18.14.9, 2018-10-16 {#clickhouse-release-18-14-9-2018-10-16} - -#### Yenilik: {#new-features-1} - -- Bu `WITH CUBE` değiştirici için `GROUP BY` (alternatif sözdizimi `GROUP BY CUBE(...)` ayrıca kullanılabilir) vardır. [\#3172](https://github.com/ClickHouse/ClickHouse/pull/3172) -- Add theed the `formatDateTime` işlev. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2770) -- Add theed the `JDBC` masa motoru ve `jdbc` tablo işlevi (clickhouse-jdbc-bridge yüklenmesini gerektirir). [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- ISO hafta numarası ile çalışmak için fonksiyonlar eklendi: `toISOWeek`, `toISOYear`, `toStartOfISOYear`, ve `toDayOfYear`. [\#3146](https://github.com/ClickHouse/ClickHouse/pull/3146) -- Şimdi kullanabilirsiniz `Nullable` Col forum forns for `MySQL` ve `ODBC` Tablolar. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- İç içe geçmiş veri yapıları, iç içe geçmiş nesneler olarak okunabilir `JSONEachRow` biçimli. Add theed the `input_format_import_nested_json` ayar. [Veloman Yunkan](https://github.com/ClickHouse/ClickHouse/pull/3144) -- Paralel işleme birçok kişi için kullanılabilir `MATERIALIZED VIEW`s veri eklerken. Görmek `parallel_view_processing` ayar. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3208) -- Add theed the `SYSTEM FLUSH LOGS` sorgu (sistem tablolarına zorla günlük basması gibi `query_log`) [\#3321](https://github.com/ClickHouse/ClickHouse/pull/3321) -- Şimdi önceden tanımlanmış kullanabilirsiniz `database` ve `table` bildirirken makrolar `Replicated` Tablolar. [\#3251](https://github.com/ClickHouse/ClickHouse/pull/3251) -- Okuma yeteneği eklendi `Decimal` mühendislik notasyonunda değerleri yazın (on yetkilerini gösterir). [\#3153](https://github.com/ClickHouse/ClickHouse/pull/3153) - -#### Deneysel özellikler: {#experimental-features} - -- GROUP BY CLA clauseuse for `LowCardinality data types.` [\#3138](https://github.com/ClickHouse/ClickHouse/pull/3138) -- İçin ifadelerin optimize hesaplama `LowCardinality data types.` [\#3200](https://github.com/ClickHouse/ClickHouse/pull/3200) - -#### Geliştirmeler: {#improvements-2} - -- İle sorgular için önemli ölçüde azaltılmış bellek tüketimi `ORDER BY` ve `LIMIT`. Görmek `max_bytes_before_remerge_sort` ayar. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- Yokluğ theunda `JOIN` (`LEFT`, `INNER`, …), `INNER JOIN` kabul edilir. [\#3147](https://github.com/ClickHouse/ClickHouse/pull/3147) -- Nitelikli yıldız işaretleri ile sorgularda düzgün çalışır `JOIN`. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3202) -- Bu `ODBC` table engine doğru bir uzak veritabanı SQL lehçesinde tanımlayıcıları alıntı yöntemi seçer. [Alexandr Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/3210) -- Bu `compile_expressions` ayar (ifadelerin JIT derlemesi) varsayılan olarak etkindir. -- Varsa eşzamanlı damla veritabanı/tablo için sabit davranış ve varsa veritabanı/tablo oluşturun. Daha önce, bir `CREATE DATABASE ... IF NOT EXISTS` sorgu hata iletisi döndürebilir “File … already exists” ve `CREATE TABLE ... IF NOT EXISTS` ve `DROP TABLE IF EXISTS` sorgular dönebilir `Table ... is creating or attaching right now`. [\#3101](https://github.com/ClickHouse/ClickHouse/pull/3101) -- MySQL veya ODBC tablolarından sorgularken sabit bir sağ yarıya sahip ifadelerde ve ifadelerde uzak sunucuya geçirilir. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- MySQL ve ODBC tablolarından sorgularken bir WHERE yan tümcesinde sabit ifadelerle karşılaştırmalar uzak sunucuya geçirilir. Önceden, sadece sabitler ile karşılaştırmalar geçirildi. [\#3182](https://github.com/ClickHouse/ClickHouse/pull/3182) -- Terminalde satır genişliğinin doğru hesaplanması `Pretty` hiyeroglifli dizeler de dahil olmak üzere formatlar. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/3257). -- `ON CLUSTER` için belirt forilebilir `ALTER UPDATE` sorgular. -- Verileri okumak için geliştirilmiş performans `JSONEachRow` biçimli. [\#3332](https://github.com/ClickHouse/ClickHouse/pull/3332) -- İçin eş anlamlı eklendi `LENGTH` ve `CHARACTER_LENGTH` uyumluluk için fonksiyonlar. Bu `CONCAT` işlev artık büyük / küçük harfe duyarlı değildir. [\#3306](https://github.com/ClickHouse/ClickHouse/pull/3306) -- Add theed the `TIMESTAMP` eşanlamlı `DateTime` tür. [\#3390](https://github.com/ClickHouse/ClickHouse/pull/3390) -- Günlük satırı bir sorgu ile ilişkili olmasa bile, sunucu günlüklerinde query\_id için ayrılmış alan her zaman vardır. Bu, sunucu metin günlüklerini üçüncü taraf araçlarla Ayrıştırmayı kolaylaştırır. -- Gigabayt bir tamsayı sonraki düzeyini aştığında, bir sorgu tarafından bellek tüketimi kaydedilir. [\#3205](https://github.com/ClickHouse/ClickHouse/pull/3205) -- Yerel protokolü kullanan istemci kitaplığı sunucu ekleme sorgusu için beklediğinden daha az sütun yanlışlıkla gönderdiğinde durum için uyumluluk modu eklendi. Bu senaryo, clickhouse-cpp kitaplığını kullanırken mümkün oldu. Daha önce, bu senaryo sunucunun çökmesine neden oldu. [\#3171](https://github.com/ClickHouse/ClickHouse/pull/3171) -- Kullanıcı tanımlı bir ifade içinde `clickhouse-copier` şimdi kullanabilirsiniz `partition_key` alias (kaynak tablo bölümüne göre ek filtreleme için). Bu, bölümleme şeması kopyalama sırasında değişirse, ancak yalnızca biraz değişirse yararlıdır. [\#3166](https://github.com/ClickHouse/ClickHouse/pull/3166) -- Bu iş akışı `Kafka` motor, yüksek yüklerde veri okuma hızını otomatik olarak azaltmak için bir arka plan iş parçacığı havuzuna taşındı. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- Okuma desteği `Tuple` ve `Nested` gibi yapıların değerleri `struct` in the `Cap'n'Proto format`. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3216) -- İçin en üst düzey etki alanlarının listesi `firstSignificantSubdomain` işlev artık etki alanını içerir `biz`. [decaseal](https://github.com/ClickHouse/ClickHouse/pull/3219) -- Dış sözlüklerin yapılandırmasında, `null_value` varsayılan veri türü değeri olarak yorumlanır. [\#3330](https://github.com/ClickHouse/ClickHouse/pull/3330) -- İçin destek `intDiv` ve `intDivOrZero` fonksiyonlar için `Decimal`. [b48402e8](https://github.com/ClickHouse/ClickHouse/commit/b48402e8712e2b9b151e0eef8193811d433a1264) -- İçin destek `Date`, `DateTime`, `UUID`, ve `Decimal` anahtar olarak türleri `sumMap` toplama işlevi. [\#3281](https://github.com/ClickHouse/ClickHouse/pull/3281) -- İçin destek `Decimal` harici sözlüklerde veri türü. [\#3324](https://github.com/ClickHouse/ClickHouse/pull/3324) -- İçin destek `Decimal` veri türü `SummingMergeTree` Tablolar. [\#3348](https://github.com/ClickHouse/ClickHouse/pull/3348) -- İçin uzmanlık eklendi `UUID` içinde `if`. [\#3366](https://github.com/ClickHouse/ClickHouse/pull/3366) -- Sayısı azal thedı `open` ve `close` bir gelen okurken sistem çağrıları `MergeTree table`. [\#3283](https://github.com/ClickHouse/ClickHouse/pull/3283) -- A `TRUNCATE TABLE` sorgu (sorgu için lider yineleme geçirilir) herhangi bir yineleme üzerinde çalıştırılabilir. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/3375) - -#### Hata düzeltmeleri: {#bug-fixes-10} - -- İle bir sorun düzeltildi `Dictionary` için tablolar `range_hashed` sözlükler. Bu hata 18.12.17 sürümünde oluştu. [\#1702](https://github.com/ClickHouse/ClickHouse/pull/1702) -- Yüklerken bir hata düzeltildi `range_hashed` söz dictionarieslükler (mesaj `Unsupported type Nullable (...)`). Bu hata 18.12.17 sürümünde oluştu. [\#3362](https://github.com/ClickHouse/ClickHouse/pull/3362) -- Sabit hatalar `pointInPolygon` birbirine yakın bulunan çok sayıda köşe ile çokgenler için yanlış hesaplamaların birikmesi nedeniyle işlev. [\#3331](https://github.com/ClickHouse/ClickHouse/pull/3331) [\#3341](https://github.com/ClickHouse/ClickHouse/pull/3341) -- Veri parçalarını birleştirdikten sonra, elde edilen parçanın sağlama toplamı, başka bir kopyadaki aynı birleştirme sonucundan farklıysa, birleştirme sonucu silinir ve veri kısmı diğer kopyadan indirilir (bu doğru davranıştır). Ancak, veri bölümünü indirdikten sonra, parçanın zaten var olduğu bir hata nedeniyle çalışma kümesine eklenemedi(çünkü veri kısmı birleşmeden sonra bir miktar gecikmeyle silindi). Bu, aynı verileri indirmek için döngüsel girişimlere yol açtı. [\#3194](https://github.com/ClickHouse/ClickHouse/pull/3194) -- Sorgularla toplam bellek tüketiminin yanlış hesaplanması düzeltildi (yanlış hesaplama nedeniyle, `max_memory_usage_for_all_queries` ayar yanlış çalıştı ve `MemoryTracking` metrik yanlış bir değere sahipti). Bu hata, 18.12.13 sürümünde oluştu. [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3344) -- İşlevselliğini sabit `CREATE TABLE ... ON CLUSTER ... AS SELECT ...` Bu hata, 18.12.13 sürümünde oluştu. [\#3247](https://github.com/ClickHouse/ClickHouse/pull/3247) -- İçin veri yapılarının sabit gereksiz hazırlanması `JOIN`eğer sorgu başlatan sunucuda s `JOIN` yalnızca uzak sunucularda gerçekleştirilir. [\#3340](https://github.com/ClickHouse/ClickHouse/pull/3340) -- Sabit hatalar `Kafka` motor: verileri okumaya başladığınızda istisnalardan sonra kilitlenmeler ve tamamlandıktan sonra kilitler [Marek Vavruša](https://github.com/ClickHouse/ClickHouse/pull/3215). -- İçin `Kafka` tablolar, isteğe bağlı `schema` parametre geç notilm (edi (şema `Cap'n'Proto` biçimli). [Vojtech Splichal](https://github.com/ClickHouse/ClickHouse/pull/3150) -- ZooKeeper sunucularının topluluğu, bağlantıyı kabul eden ancak el sıkışmaya yanıt vermek yerine hemen kapatan sunuculara sahipse, ClickHouse başka bir sunucuya bağlanmayı seçer. Daha önce, bu hata üretti `Cannot read all data. Bytes read: 0. Bytes expected: 4.` ve sunucu başlatılamadı. [8218cf3a](https://github.com/ClickHouse/ClickHouse/commit/8218cf3a5f39a43401953769d6d12a0bb8d29da9) -- Zookeeper sunucularının topluluğu, DNS sorgusunun bir hata döndürdüğü sunucular içeriyorsa, bu sunucular yoksayılır. [17b8e209](https://github.com/ClickHouse/ClickHouse/commit/17b8e209221061325ad7ba0539f03c6e65f87f29) -- Arasında sabit tip dönüşüm `Date` ve `DateTime` veri eklerken `VALUES` biçim (eğer `input_format_values_interpret_expressions = 1`). Daha önce, dönüşüm Unix dönem zamanındaki gün sayısının sayısal değeri ile Unix zaman damgası arasında gerçekleştirildi ve bu da beklenmedik sonuçlara yol açtı. [\#3229](https://github.com/ClickHouse/ClickHouse/pull/3229) -- Arasında düzeltilmiş tip dönüşümü `Decimal` ve tam sayı. [\#3211](https://github.com/ClickHouse/ClickHouse/pull/3211) -- Sabit hatalar `enable_optimize_predicate_expression` ayar. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3231) -- Varsayılan olmayan bir CSV ayırıcı kullanılıyorsa, kayan noktalı sayılarla CSV formatında bir ayrıştırma hatası düzeltildi `;` [\#3155](https://github.com/ClickHouse/ClickHouse/pull/3155) -- Sabit `arrayCumSumNonNegative` fonksiyon (akümülatör sıfırdan az ise negatif değerler biriktirmez). [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/3163) -- Sabit nasıl `Merge` tablolar üstünde çalışır `Distributed` kullanırken tablolar `PREWHERE`. [\#3165](https://github.com/ClickHouse/ClickHouse/pull/3165) -- Hata düzeltmeleri `ALTER UPDATE` sorgu. -- Sabit hatalar `odbc` 18.12 sürümünde görünen tablo işlevi. [\#3197](https://github.com/ClickHouse/ClickHouse/pull/3197) -- İle toplama fonksiyon operationlarının çalışmasını sabit `StateArray` birleştiriciler. [\#3188](https://github.com/ClickHouse/ClickHouse/pull/3188) -- Bir bölme sırasında bir kilitlenme düzeltildi `Decimal` sıfır değeri. [69dd6609](https://github.com/ClickHouse/ClickHouse/commit/69dd6609193beb4e7acd3e6ad216eca0ccfb8179) -- Kullanarak işlemler için sabit çıktı türleri `Decimal` ve tamsayı argümanları. [\#3224](https://github.com/ClickHouse/ClickHouse/pull/3224) -- Sırasında segfault sabit `GROUP BY` üzerinde `Decimal128`. [3359ba06](https://github.com/ClickHouse/ClickHouse/commit/3359ba06c39fcd05bfdb87d6c64154819621e13a) -- Bu `log_query_threads` ayar (sorgu yürütme her iş parçacığı hakkında bilgi günlüğe kaydetme) şimdi yalnızca `log_queries` (sorgularla ilgili bilgileri günlüğe kaydetme) seçeneği 1 olarak ayarlanır. Sin thece the `log_query_threads` seçenek varsayılan olarak etkindir, sorgu günlüğü devre dışı bırakılmış olsa bile iş parçacıkları hakkında bilgi daha önce günlüğe kaydedildi. [\#3241](https://github.com/ClickHouse/ClickHouse/pull/3241) -- Quantiles toplama fonksiyonunun dağıtılmış işleminde bir hata düzeltildi (hata mesajı `Not found column quantile...`). [292a8855](https://github.com/ClickHouse/ClickHouse/commit/292a885533b8e3b41ce8993867069d14cbd5a664) -- Aynı anda sürüm 18.12.17 sunucuları ve eski sunuculardan oluşan bir küme üzerinde çalışırken uyumluluk sorunu düzeltildi. Hem sabit hem de sabit olmayan uzunluktaki GROUP BY anahtarlarıyla dağıtılmış sorgular için, toplanacak büyük miktarda veri varsa, döndürülen veriler her zaman tam olarak toplanmadı (iki farklı satır aynı toplama anahtarlarını içeriyordu). [\#3254](https://github.com/ClickHouse/ClickHouse/pull/3254) -- Değiştirmelerin sabit kullanımı `clickhouse-performance-test`, sorgu testte bildirilen değiştirmelerin yalnızca bir kısmını içeriyorsa. [\#3263](https://github.com/ClickHouse/ClickHouse/pull/3263) -- Kullanırken bir hata düzeltildi `FINAL` ile `PREWHERE`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Kullanırken bir hata düzeltildi `PREWHERE` sırasında eklenen sütun overların üzerinde `ALTER`. [\#3298](https://github.com/ClickHouse/ClickHouse/pull/3298) -- Olmaması için bir çek eklendi `arrayJoin` için `DEFAULT` ve `MATERIALIZED` ifadeler. Önceden, `arrayJoin` veri eklerken bir hataya yol açtı. [\#3337](https://github.com/ClickHouse/ClickHouse/pull/3337) -- Olmaması için bir çek eklendi `arrayJoin` in a `PREWHERE` yan. Daha önce, bu gibi mesajlara yol açtı `Size ... doesn't match` veya `Unknown compression method` sorguları yürütürken. [\#3357](https://github.com/ClickHouse/ClickHouse/pull/3357) -- Değiştirilen optimizasyon ve eşitlik değerlendirmelerinden karşılık gelen ifadeyle zincirler sonra nadir durumlarda ortaya çıkabilecek sabit segfault. [liuyimin-bytedance](https://github.com/ClickHouse/ClickHouse/pull/3339) -- İçin küçük düzeltmeler `clickhouse-benchmark`: daha önce, istemci bilgileri sunucuya gönderilmedi; şimdi yürütülen sorguların sayısı kapatılırken ve yineleme sayısını sınırlamak için daha doğru hesaplanır. [\#3351](https://github.com/ClickHouse/ClickHouse/pull/3351) [\#3352](https://github.com/ClickHouse/ClickHouse/pull/3352) - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-1} - -- Kaldır theılan `allow_experimental_decimal_type` seçenek. Bu `Decimal` veri türü varsayılan kullanım için kullanılabilir. [\#3329](https://github.com/ClickHouse/ClickHouse/pull/3329) - -## ClickHouse sürümü 18.12 {#clickhouse-release-18-12} - -### ClickHouse yayın 18.12.17, 2018-09-16 {#clickhouse-release-18-12-17-2018-09-16} - -#### Yenilik: {#new-features-2} - -- `invalidate_query` (bir dış sözlük güncelleştirilmesi gerekip gerekmediğini denetlemek için bir sorgu belirtmek için yeteneği) `clickhouse` kaynaklı. [\#3126](https://github.com/ClickHouse/ClickHouse/pull/3126) -- Kullanma yeteneği eklendi `UInt*`, `Int*`, ve `DateTime` veri türleri (birlikte `Date` type) as a `range_hashed` aralıkların sınırlarını tanımlayan dış sözlük anahtarı. Şimdi `NULL` açık bir aralık belirlemek için kullanılabilir. [Vasily Nemkov](https://github.com/ClickHouse/ClickHouse/pull/3123) -- Bu `Decimal` şimdi yazın destekler `var*` ve `stddev*` toplama fonksiyonları. [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- Bu `Decimal` tip artık matematiksel fonksiyonları destekliyor (`exp`, `sin` ve böyle devam eder.) [\#3129](https://github.com/ClickHouse/ClickHouse/pull/3129) -- Bu `system.part_log` tablo şimdi var `partition_id` sütun. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Hata düzeltmeleri: {#bug-fixes-11} - -- `Merge` şimdi düzgün çalışıyor `Distributed` Tablolar. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3159) -- Sabit uyumsuzluk (gereksiz bağımlılık `glibc` sürüm) bu Clickhouse'u çalıştırmayı imkansız hale getirdi `Ubuntu Precise` ve eski sürümleri. Uyumsuzluk 18.12.13 sürümünde ortaya çıktı. [\#3130](https://github.com/ClickHouse/ClickHouse/pull/3130) -- Sabit hatalar `enable_optimize_predicate_expression` ayar. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) -- 18.12.13'ten önceki sürümlerde bir kopya kümesiyle çalışırken ve aynı anda daha yeni bir sürüme sahip bir sunucuda bir tablonun yeni bir kopyasını oluştururken ortaya çıkan geriye dönük uyumluluğa sahip küçük bir sorun düzeltildi (mesajda gösterilir `Can not clone replica, because the ... updated to new ClickHouse version`, mantıklı, ama olmamalı). [\#3122](https://github.com/ClickHouse/ClickHouse/pull/3122) - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-2} - -- Bu `enable_optimize_predicate_expression` seçenek varsayılan olarak etkindir (oldukça iyimser olan). Sütun adları için arama için ilgili sorgu çözümleme hataları oluşursa, ayarla `enable_optimize_predicate_expression` 0'a. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3107) - -### ClickHouse yayın 18.12.14, 2018-09-13 {#clickhouse-release-18-12-14-2018-09-13} - -#### Yenilik: {#new-features-3} - -- İçin destek eklendi `ALTER UPDATE` sorgular. [\#3035](https://github.com/ClickHouse/ClickHouse/pull/3035) -- Add theed the `allow_ddl` kullanıcının DDL sorgularına erişimini kısıtlayan seçenek. [\#3104](https://github.com/ClickHouse/ClickHouse/pull/3104) -- Add theed the `min_merge_bytes_to_use_direct_io` seçeneği için `MergeTree` birleştirmenin toplam boyutu için bir eşik ayarlamanıza izin veren motorlar(eşiğin üstünde olduğunda, veri parçası dosyaları o\_direct kullanılarak işlenecektir). [\#3117](https://github.com/ClickHouse/ClickHouse/pull/3117) -- Bu `system.merges` sistem tablosu şimdi içerir `partition_id` sütun. [\#3099](https://github.com/ClickHouse/ClickHouse/pull/3099) - -#### Geliştirmeler {#improvements-3} - -- Bir veri parçası mutasyon sırasında değişmeden kalırsa, yinelemeler tarafından indirilmez. [\#3103](https://github.com/ClickHouse/ClickHouse/pull/3103) -- Otomatik tamamlama ile çalışırken ayarların adları için kullanılabilir `clickhouse-client`. [\#3106](https://github.com/ClickHouse/ClickHouse/pull/3106) - -#### Hata düzeltmeleri: {#bug-fixes-12} - -- Elemanları olan dizilerin boyutları için bir kontrol eklendi `Nested` eklerken alanları yazın. [\#3118](https://github.com/ClickHouse/ClickHouse/pull/3118) -- İle harici sözlükler güncellenmesi bir hata düzeltildi `ODBC` kaynak ve `hashed` depolama. Bu hata, 18.12.13 sürümünde oluştu. -- Bir sorgudan geçici bir tablo oluştururken bir kilitlenme düzeltildi `IN` koşul. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3098) -- Olabilecek diziler için toplam işlevlerde bir hata düzeltildi `NULL` öğeler. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/3097) - -### ClickHouse yayın 18.12.13, 2018-09-10 {#clickhouse-release-18-12-13-2018-09-10} - -#### Yenilik: {#new-features-4} - -- Add theed the `DECIMAL(digits, scale)` veri türü (`Decimal32(scale)`, `Decimal64(scale)`, `Decimal128(scale)`). Etkinleştirmek için ayarı kullanın `allow_experimental_decimal_type`. [\#2846](https://github.com/ClickHouse/ClickHouse/pull/2846) [\#2970](https://github.com/ClickHouse/ClickHouse/pull/2970) [\#3008](https://github.com/ClickHouse/ClickHouse/pull/3008) [\#3047](https://github.com/ClickHouse/ClickHouse/pull/3047) -- Yeni `WITH ROLLUP` değiştirici için `GROUP BY` (alternatif sözdizimi: `GROUP BY ROLLUP(...)`). [\#2948](https://github.com/ClickHouse/ClickHouse/pull/2948) -- JOIN ile sorgularda, yıldız karakteri SQL standardına uygun olarak tüm tablolardaki sütunların bir listesine genişletir. Ayarlayarak eski davranışı geri yükleyebilirsiniz `asterisk_left_columns_only` kullanıcı yapılandırma düzeyinde 1'e. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2787) -- Tablo fonksiyonları ile katılmak için destek eklendi. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- Clickhouse-client sekmesine basarak otomatik tamamlama. [Sergey Shcherbin](https://github.com/ClickHouse/ClickHouse/pull/2447) -- CTRL + C clickhouse-client girilen bir sorguyu temizler. [\#2877](https://github.com/ClickHouse/ClickHouse/pull/2877) -- Add theed the `join_default_strictness` ayar (değerler: `"`, `'any'`, `'all'`). Bu belirtmemenizi sağlar `ANY` veya `ALL` için `JOIN`. [\#2982](https://github.com/ClickHouse/ClickHouse/pull/2982) -- Sorgu işleme ile ilgili sunucu günlüğünün her satırı sorgu kimliğini gösterir. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Artık clickhouse-client'da sorgu yürütme günlükleri alabilirsiniz ( `send_logs_level` ayar). Dağıtılmış sorgu işleme ile günlükleri tüm sunuculardan basamaklandırılır. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Bu `system.query_log` ve `system.processes` (`SHOW PROCESSLIST`) bir sorgu çalıştırdığınızda tablolar artık tüm değiştirilen ayarları hakkında bilgi var (iç içe geçmiş yapısı `Settings` veriler). Add theed the `log_query_settings` ayar. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Bu `system.query_log` ve `system.processes` tablolar artık sorgu yürütülmesine katılan iş parçacığı sayısı hakkında bilgi gösterir (bkz. `thread_numbers` sütun). [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Katma `ProfileEvents` ağ üzerinden okuma ve yazma ve diske okuma ve yazma için harcanan zamanı, ağ hatalarının sayısını ve ağ bant genişliği sınırlı olduğunda bekleyen harcanan zamanı ölçen sayaçlar. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Katma `ProfileEvents`rusage gelen ((bekle zaman G/Ç hakkında daha fazla bilgi edinmek için bu kullanım, CPU zamanı bekle ve veri miktarını okuma ve kaydedilen, sayfa önbelleği olan ve olmayan) kullanıcı alanı ve çekirdek, sayfa hataları ve bağlam anahtarlarının yanı sıra taskstats ölçülerine CPU kullanımı hakkında bilgi almak için onları kullanabilirsiniz) sistem ölçümlerini içeren sayaçları. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Bu `ProfileEvents` sayaçlar, genel olarak ve her sorgu için ve ayrıca sorguya göre kaynak tüketimini ayrıntılı olarak profillemenize izin veren her sorgu yürütme iş parçacığı için uygulanır. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Add theed the `system.query_thread_log` her sorgu yürütme iş parçacığı hakkında bilgi içeren tablo. Add theed the `log_query_threads` ayar. [\#2482](https://github.com/ClickHouse/ClickHouse/pull/2482) -- Bu `system.metrics` ve `system.events` tablolar artık yerleşik belgelere sahiptir. [\#3016](https://github.com/ClickHouse/ClickHouse/pull/3016) -- Add theed the `arrayEnumerateDense` işlev. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2975) -- Add theed the `arrayCumSumNonNegative` ve `arrayDifference` işlevler. [Aleksey Studnev](https://github.com/ClickHouse/ClickHouse/pull/2942) -- Add theed the `retention` toplama işlevi. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2887) -- Artık Plus operatörünü kullanarak toplama işlevlerinin durumlarını ekleyebilir (birleştirebilirsiniz) ve toplama işlevlerinin durumlarını negatif olmayan bir sabitle çarpabilirsiniz. [\#3062](https://github.com/ClickHouse/ClickHouse/pull/3062) [\#3034](https://github.com/ClickHouse/ClickHouse/pull/3034) -- Mergetree ailesindeki tablolar artık sanal sütuna sahip `_partition_id`. [\#3089](https://github.com/ClickHouse/ClickHouse/pull/3089) - -#### Deneysel özellikler: {#experimental-features-1} - -- Add theed the `LowCardinality(T)` veri türü. Bu veri türü otomatik olarak yerel bir değer sözlüğü oluşturur ve sözlüğü açmadan veri işlemeye izin verir. [\#2830](https://github.com/ClickHouse/ClickHouse/pull/2830) -- JIT derlenmiş işlevlerin bir önbellek ve derlemeden önce kullanım sayısı için bir sayaç eklendi. JIT derleme ifadeleri için `compile_expressions` ayar. [\#2990](https://github.com/ClickHouse/ClickHouse/pull/2990) [\#3077](https://github.com/ClickHouse/ClickHouse/pull/3077) - -#### Geliştirmeler: {#improvements-4} - -- Terkedilmiş yinelemeler olduğunda çoğaltma günlüğünün sınırsız birikimi ile ilgili sorun giderildi. Uzun bir gecikme ile kopyaları için etkili bir kurtarma modu eklendi. -- Geliştirilmiş performans `GROUP BY` bunlardan biri dize ve diğerleri sabit uzunlukta olduğunda birden fazla toplama alanı ile. -- Kullanırken geliştirilmiş performans `PREWHERE` ve ifad ofelerin örtülü olarak aktar ofılmasıyla `PREWHERE`. -- Metin formatları için geliştirilmiş ayrıştırma performansı (`CSV`, `TSV`). [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2977) [\#2980](https://github.com/ClickHouse/ClickHouse/pull/2980) -- İkili biçimlerde okuma dizeleri ve diziler geliştirilmiş performans. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2955) -- Sorgular için artan performans ve azaltılmış bellek tüketimi `system.tables` ve `system.columns` tek bir sunucuda çok sayıda tablo olduğunda. [\#2953](https://github.com/ClickHouse/ClickHouse/pull/2953) -- Bir hataya neden olan büyük bir sorgu akışı durumunda bir performans sorunu düzeltildi ( `_dl_addr` fonksiyon görünür `perf top`, ancak sunucu çok fazla CPU kullanmıyor). [\#2938](https://github.com/ClickHouse/ClickHouse/pull/2938) -- Koşullar Görünüm içine atılır (ne zaman `enable_optimize_predicate_expression` etkin) değildir. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2907) -- İçin işlevsellik geliştirmeleri `UUID` veri türü. [\#3074](https://github.com/ClickHouse/ClickHouse/pull/3074) [\#2985](https://github.com/ClickHouse/ClickHouse/pull/2985) -- Bu `UUID` veri türü-Simyacı sözlüklerde desteklenir. [\#2822](https://github.com/ClickHouse/ClickHouse/pull/2822) -- Bu `visitParamExtractRaw` işlev iç içe geçmiş yapılarla düzgün çalışır. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2974) -- Ne zaman `input_format_skip_unknown_fields` ayarı etkin, nesne alanları `JSONEachRow` biçim doğru atlanır. [BlahGeek](https://github.com/ClickHouse/ClickHouse/pull/2958) -- İçin... `CASE` koşullarla ifade, şimdi atlayabilirsiniz `ELSE` eşdeğer olan `ELSE NULL`. [\#2920](https://github.com/ClickHouse/ClickHouse/pull/2920) -- ZooKeeper ile çalışırken operasyon zaman aşımı artık yapılandırılabilir. [urykhy](https://github.com/ClickHouse/ClickHouse/pull/2971) -- İçin bir ofset belirtebilirsiniz `LIMIT n, m` olarak `LIMIT n OFFSET m`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- Kullanabilirsiniz `SELECT TOP n` için alternatif olarak sözdizimi `LIMIT`. [\#2840](https://github.com/ClickHouse/ClickHouse/pull/2840) -- Sistem tablolarına yazmak için sıranın boyutunu arttırdı, böylece `SystemLog parameter queue is full` hata sık sık olmaz. -- Bu `windowFunnel` toplama işlevi artık birden çok koşulu karşılayan olayları destekler. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2801) -- Yinelenen sütunlar bir `USING` için fık forra `JOIN`. [\#3006](https://github.com/ClickHouse/ClickHouse/pull/3006) -- `Pretty` biçimlerin artık genişliğe göre sütun hizalaması üzerinde bir sınırı vardır. Kullan... `output_format_pretty_max_column_pad_width` ayar. Bir değer daha genişse, yine de bütünüyle görüntülenecektir, ancak tablodaki diğer hücreler çok geniş olmayacaktır. [\#3003](https://github.com/ClickHouse/ClickHouse/pull/3003) -- Bu `odbc` tablo işlevi artık veritabanı/şema adını belirtmenizi sağlar. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2885) -- Belirtilen bir kullanıcı adı kullanma yeteneği eklendi `clickhouse-client` yapılandırma dosyası. [Vladimir Kozbin](https://github.com/ClickHouse/ClickHouse/pull/2909) -- Bu `ZooKeeperExceptions` sayaç üç sayaçlara ayrılmıştır: `ZooKeeperUserExceptions`, `ZooKeeperHardwareExceptions`, ve `ZooKeeperOtherExceptions`. -- `ALTER DELETE` sorgular hayata görünümler için çalışır. -- Temizleme ipliğini periyodik olarak çalıştırırken randomizasyon eklendi `ReplicatedMergeTree` çok sayıda olduğunda periyodik yük ani önlemek için tablolar `ReplicatedMergeTree` Tablolar. -- İçin destek `ATTACH TABLE ... ON CLUSTER` sorgular. [\#3025](https://github.com/ClickHouse/ClickHouse/pull/3025) - -#### Hata düzeltmeleri: {#bug-fixes-13} - -- İle bir sorun düzeltildi `Dictionary` tablolar (atar `Size of offsets doesn't match size of column` veya `Unknown compression method` özel). Bu hata 18.10.3 sürümünde göründü. [\#2913](https://github.com/ClickHouse/ClickHouse/issues/2913) -- Birleştirirken bir hata düzeltildi `CollapsingMergeTree` veri parçalarından biri boşsa tablolar (bu parçalar birleştirme sırasında oluşturulur veya `ALTER DELETE` tüm veriler silindiyse) ve `vertical` birleştirme için algoritma kullanıldı. [\#3049](https://github.com/ClickHouse/ClickHouse/pull/3049) -- Sırasında bir yarış durumu düzeltildi `DROP` veya `TRUNCATE` için `Memory` eş zamanlı tablolar `SELECT`, sunucu çökmelerine neden olabilir. Bu hata 1.1.54388 sürümünde göründü. [\#3038](https://github.com/ClickHouse/ClickHouse/pull/3038) -- Takarken veri kaybı olasılığı düzeltildi `Replicated` tablolar ise `Session is expired` hata döndürülür (veri kaybı tarafından tespit edilebilir `ReplicatedDataLoss` ölçü). Bu hata 1.1.54378 sürümünde oluştu. [\#2939](https://github.com/ClickHouse/ClickHouse/pull/2939) [\#2949](https://github.com/ClickHouse/ClickHouse/pull/2949) [\#2964](https://github.com/ClickHouse/ClickHouse/pull/2964) -- Sırasında bir segfault sabit `JOIN ... ON`. [\#3000](https://github.com/ClickHouse/ClickHouse/pull/3000) -- Sütun adlarını ararken hata düzeltildi `WHERE` ifade tamamen nitelikli bir sütun adından oluşur, örneğin `WHERE table.column`. [\#2994](https://github.com/ClickHouse/ClickHouse/pull/2994) -- Sabit “Not found column” uzak bir sunucudan bir alt sorgu ile bir In ifadesinden oluşan tek bir sütun isteniyorsa, dağıtılmış sorgular yürütülürken oluşan hata. [\#3087](https://github.com/ClickHouse/ClickHouse/pull/3087) -- Sabit `Block structure mismatch in UNION stream: different number of columns` kırıklardan biri yerel ve diğeri değilse dağıtılmış sorgular için oluşan hata ve taşınmanın en iyi duruma getirilmesi `PREWHERE` tetik .lenir. [\#2226](https://github.com/ClickHouse/ClickHouse/pull/2226) [\#3037](https://github.com/ClickHouse/ClickHouse/pull/3037) [\#3055](https://github.com/ClickHouse/ClickHouse/pull/3055) [\#3065](https://github.com/ClickHouse/ClickHouse/pull/3065) [\#3073](https://github.com/ClickHouse/ClickHouse/pull/3073) [\#3090](https://github.com/ClickHouse/ClickHouse/pull/3090) [\#3093](https://github.com/ClickHouse/ClickHouse/pull/3093) -- Sabit `pointInPolygon` dışbükey olmayan poligonların belirli durumları için işlev. [\#2910](https://github.com/ClickHouse/ClickHouse/pull/2910) -- Karşılaştırırken yanlış sonuç düzeltildi `nan` tamsayılarla. [\#3024](https://github.com/ClickHouse/ClickHouse/pull/3024) -- Sabit bir hata `zlib-ng` nadir durumlarda segfault yol açabilir kütüphane. [\#2854](https://github.com/ClickHouse/ClickHouse/pull/2854) -- Bir tabloya eklerken bir bellek sızıntısı düzeltildi `AggregateFunction` sütunlar, toplama işlevinin durumu basit değilse (belleği ayrı olarak ayırır) ve tek bir ekleme isteği birden çok küçük blokla sonuçlanırsa. [\#3084](https://github.com/ClickHouse/ClickHouse/pull/3084) -- Aynı şeyi oluştururken ve silerken bir yarış durumu düzeltildi `Buffer` veya `MergeTree` aynı anda tablo. -- Tuples gibi bazı önemsiz olmayan türlerinden oluşan tuples karşılaştırırken bir segfault olasılığını düzeltildi. [\#2989](https://github.com/ClickHouse/ClickHouse/pull/2989) -- Belirli çalıştırırken bir segfault olasılığı düzeltildi `ON CLUSTER` sorgular. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2960) -- Sabit bir hata `arrayDistinct` fonksiyonu için `Nullable` dizi elemanları. [\#2845](https://github.com/ClickHouse/ClickHouse/pull/2845) [\#2937](https://github.com/ClickHouse/ClickHouse/pull/2937) -- Bu `enable_optimize_predicate_expression` seçenek şimdi doğru olan durumları destekler `SELECT *`. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2929) -- Zookeeper oturumunu yeniden başlatırken segfault düzeltildi. [\#2917](https://github.com/ClickHouse/ClickHouse/pull/2917) -- ZooKeeper ile çalışırken sabit potansiyel engelleme. -- Bir iç içe veri yapıları eklemek için sabit yanlış kod `SummingMergeTree`. -- Toplama işlevlerinin durumları için bellek ayırırken, hizalama doğru bir şekilde dikkate alınır, bu da toplama işlevlerinin durumlarını uygularken hizalama gerektiren işlemlerin kullanılmasını mümkün kılar. [chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2808) - -#### Güvenlik düzeltme: {#security-fix} - -- ODBC veri kaynaklarının güvenli kullanımı. ODBC sürücüleri ile etkileşim ayrı bir `clickhouse-odbc-bridge` işleyiş. Üçüncü taraf ODBC sürücülerindeki hatalar artık sunucu kararlılığı veya güvenlik açıklarıyla ilgili sorunlara neden olmaz. [\#2828](https://github.com/ClickHouse/ClickHouse/pull/2828) [\#2879](https://github.com/ClickHouse/ClickHouse/pull/2879) [\#2886](https://github.com/ClickHouse/ClickHouse/pull/2886) [\#2893](https://github.com/ClickHouse/ClickHouse/pull/2893) [\#2921](https://github.com/ClickHouse/ClickHouse/pull/2921) -- Dosya yolunun yanlış doğrulanması düzeltildi `catBoostPool` tablo işlevi. [\#2894](https://github.com/ClickHouse/ClickHouse/pull/2894) -- Sistem tablolarının içeriği (`tables`, `databases`, `parts`, `columns`, `parts_columns`, `merges`, `mutations`, `replicas`, ve `replication_queue`) kullanıcının veri tabanlarına yapılandırılmış erişimine göre filtrelenir (`allow_databases`). [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2856) - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-3} - -- JOIN ile sorgularda, yıldız karakteri SQL standardına uygun olarak tüm tablolardaki sütunların bir listesine genişletir. Ayarlayarak eski davranışı geri yükleyebilirsiniz `asterisk_left_columns_only` kullanıcı yapılandırma düzeyinde 1'e. - -#### Yapı değişiklikleri: {#build-changes-2} - -- Çoğu entegrasyon testleri artık commit tarafından çalıştırılabilir. -- Kod stili kontrolleri de commit tarafından çalıştırılabilir. -- Bu `memcpy` CentOS7/Fedora üzerinde inşa ederken uygulama doğru seçilir. [Etienne Champetier](https://github.com/ClickHouse/ClickHouse/pull/2912) -- Oluşturmak için clang kullanırken, bazı uyarılar `-Weverything` düzenli ek olarak, eklenmiştir `-Wall-Wextra -Werror`. [\#2957](https://github.com/ClickHouse/ClickHouse/pull/2957) -- Yapı hata ayıklama kullanır `jemalloc` hata ayıklama seçeneği. -- ZooKeeper ile etkileşim için kütüphanenin arayüzü soyut olarak ilan edilir. [\#2950](https://github.com/ClickHouse/ClickHouse/pull/2950) - -## ClickHouse sürümü 18.10 {#clickhouse-release-18-10} - -### ClickHouse yayın 18.10.3, 2018-08-13 {#clickhouse-release-18-10-3-2018-08-13} - -#### Yenilik: {#new-features-5} - -- HTTPS çoğaltma için kullanılabilir. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) -- Fonksiyonları eklendi `murmurHash2_64`, `murmurHash3_32`, `murmurHash3_64`, ve `murmurHash3_128` mevcut ek olarak `murmurHash2_32`. [\#2791](https://github.com/ClickHouse/ClickHouse/pull/2791) -- ClickHouse ODBC sürücüsündeki null türleri için destek (`ODBCDriver2` çıkış biçimi). [\#2834](https://github.com/ClickHouse/ClickHouse/pull/2834) -- İçin destek `UUID` anahtar sütunlarda. - -#### Geliştirmeler: {#improvements-5} - -- Kümeler, yapılandırma dosyalarından silindiğinde sunucuyu yeniden başlatmadan kaldırılabilir. [\#2777](https://github.com/ClickHouse/ClickHouse/pull/2777) -- Dış sözlükler, yapılandırma dosyalarından kaldırıldıklarında sunucuyu yeniden başlatmadan kaldırılabilir. [\#2779](https://github.com/ClickHouse/ClickHouse/pull/2779) -- Katma `SETTINGS` için destek `Kafka` masa motoru. [Alexander Marshalov](https://github.com/ClickHouse/ClickHouse/pull/2781) -- İçin iyileştirmeler `UUID` veri türü (henüz tamamlanmadı). [\#2618](https://github.com/ClickHouse/ClickHouse/pull/2618) -- Birleştikten sonra boş parçalar için destek `SummingMergeTree`, `CollapsingMergeTree` ve `VersionedCollapsingMergeTree` motorlar. [\#2815](https://github.com/ClickHouse/ClickHouse/pull/2815) -- Tamamlanan Mut recordsasyon recordsların eski kayıtları silinir (`ALTER DELETE`). [\#2784](https://github.com/ClickHouse/ClickHouse/pull/2784) -- Add theed the `system.merge_tree_settings` Tablo. [Kirill Shvakov](https://github.com/ClickHouse/ClickHouse/pull/2841) -- Bu `system.tables` tablo artık bağımlılık sütunları var: `dependencies_database` ve `dependencies_table`. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2851) -- Add theed the `max_partition_size_to_drop` yapılandırma seçeneği. [\#2782](https://github.com/ClickHouse/ClickHouse/pull/2782) -- Add theed the `output_format_json_escape_forward_slashes` seçenek. [Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2812) -- Add theed the `max_fetch_partition_retries_count` ayar. [\#2831](https://github.com/ClickHouse/ClickHouse/pull/2831) -- Add theed the `prefer_localhost_replica` yerel bir yineleme tercihini devre dışı bırakmak ve işlemler arası etkileşim olmadan yerel bir yinelemeye gitmek için ayarlama. [\#2832](https://github.com/ClickHouse/ClickHouse/pull/2832) -- Bu `quantileExact` toplama işlevi döndürür `nan` boş bir toplama durumunda `Float32` veya `Float64` koymak. [Sundy Li](https://github.com/ClickHouse/ClickHouse/pull/2855) - -#### Hata düzeltmeleri: {#bug-fixes-14} - -- ODBC için bağlantı dizesi parametrelerinin gereksiz bir şekilde kaçması kaldırıldı, bu da bağlantı kurmayı imkansız hale getirdi. Bu hata 18.6.0 sürümünde oluştu. -- İşleme mantığı düzeltildi `REPLACE PARTITION` çoğaltma sırasındaki komutlar. İki tane varsa `REPLACE` aynı bölüm için komutlar, yanlış mantık, bunlardan birinin çoğaltma kuyruğunda kalmasına ve yürütülmesine neden olabilir. [\#2814](https://github.com/ClickHouse/ClickHouse/pull/2814) -- Tüm veri parçaları boş olduğunda bir birleştirme hatası düzeltildi (birleştirme veya `ALTER DELETE` tüm veriler silindiyse). Bu hata 18.1.0 sürümünde göründü. [\#2930](https://github.com/ClickHouse/ClickHouse/pull/2930) -- Eşzamanlı için bir hata düzeltildi `Set` veya `Join`. [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2823) -- Sabit `Block structure mismatch in UNION stream: different number of columns` için oluşan hata `UNION ALL` bir alt sorgu içindeki sorgular `SELECT` sorgular yinelenen sütun adları içerir. [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2094) -- Bir MySQL sunucusuna bağlanırken bir istisna oluşursa bir bellek sızıntısı düzeltildi. -- Bir sorgu hatası durumunda sabit yanlış clickhouse-istemci yanıt kodu. -- Farklı içeren hayata görünümleri sabit yanlış davranış. [\#2795](https://github.com/ClickHouse/ClickHouse/issues/2795) - -#### Geriye dönük uyumsuz değişiklikler {#backward-incompatible-changes-4} - -- Dağıtılmış tablolar için kontrol tablosu sorguları için destek kaldırıldı. - -#### Yapı değişiklikleri: {#build-changes-3} - -- Ayırıcı değiştirildi: `jemalloc` şimdi yerine kullanılır `tcmalloc`. Bazı senaryolarda, bu hız %20'ye kadar artar. Ancak, %20'ye kadar yavaşlamış sorgular vardır. Bellek tüketimi, bazı senaryolarda geliştirilmiş kararlılık ile yaklaşık %10 oranında azaltılmıştır. Son derece rekabetçi yüklerle, userspace ve sistemdeki CPU kullanımı sadece hafif bir artış gösterir. [\#2773](https://github.com/ClickHouse/ClickHouse/pull/2773) -- Bir alt modülden libressl kullanımı. [\#1983](https://github.com/ClickHouse/ClickHouse/pull/1983) [\#2807](https://github.com/ClickHouse/ClickHouse/pull/2807) -- Bir alt modülden unixodbc kullanımı. [\#2789](https://github.com/ClickHouse/ClickHouse/pull/2789) -- Bir alt modülden mariadb-connector-c kullanımı. [\#2785](https://github.com/ClickHouse/ClickHouse/pull/2785) -- Test verilerinin kullanılabilirliğine bağlı olan depoya işlevsel test dosyaları eklendi (şimdilik, test verilerinin kendisi olmadan). - -## ClickHouse sürümü 18.6 {#clickhouse-release-18-6} - -### ClickHouse yayın 18.6.0, 2018-08-02 {#clickhouse-release-18-6-0-2018-08-02} - -#### Yenilik: {#new-features-6} - -- Sözdizimi üzerinde katılmak için ifadeler için destek eklendi: - `JOIN ON Expr([table.]column ...) = Expr([table.]column, ...) [AND Expr([table.]column, ...) = Expr([table.]column, ...) ...]` - İfade, and operatörü tarafından birleştirilen bir eşitlik zinciri olmalıdır. Eşitliğin her bir tarafı, tablolardan birinin sütunları üzerinde keyfi bir ifade olabilir. Tam sütun adlarının kullanımı desteklenir (`table.name`, `database.table.name`, `table_alias.name`, `subquery_alias.name`) doğru tablo için. [\#2742](https://github.com/ClickHouse/ClickHouse/pull/2742) -- HTTPS çoğaltma için etkinleştirilebilir. [\#2760](https://github.com/ClickHouse/ClickHouse/pull/2760) - -#### Geliştirmeler: {#improvements-6} - -- Sunucu, sürümünün düzeltme eki bileşenini istemciye geçirir. Yama sürümü bileşeni ile ilgili veriler `system.processes` ve `query_log`. [\#2646](https://github.com/ClickHouse/ClickHouse/pull/2646) - -## ClickHouse sürümü 18.5 {#clickhouse-release-18-5} - -### ClickHouse sürümü 18.5.1, 2018-07-31 {#clickhouse-release-18-5-1-2018-07-31} - -#### Yenilik: {#new-features-7} - -- Karma fonksiyonu eklendi `murmurHash2_32` [\#2756](https://github.com/ClickHouse/ClickHouse/pull/2756). - -#### Geliştirmeler: {#improvements-7} - -- Şimdi kullanabilirsiniz `from_env` [\#2741](https://github.com/ClickHouse/ClickHouse/pull/2741) ortam değişkenlerinden yapılandırma dosyalarındaki değerleri ayarlamak için öznitelik. -- Eklenen büyük / küçük harf duyarlı sürümleri `coalesce`, `ifNull`, ve `nullIf functions` [\#2752](https://github.com/ClickHouse/ClickHouse/pull/2752). - -#### Hata düzeltmeleri: {#bug-fixes-15} - -- Bir kopya başlatırken olası bir hata düzeltildi [\#2759](https://github.com/ClickHouse/ClickHouse/pull/2759). - -## ClickHouse sürümü 18.4 {#clickhouse-release-18-4} - -### ClickHouse yayın 18.4.0, 2018-07-28 {#clickhouse-release-18-4-0-2018-07-28} - -#### Yenilik: {#new-features-8} - -- Eklenen sistem tabloları: `formats`, `data_type_families`, `aggregate_function_combinators`, `table_functions`, `table_engines`, `collations` [\#2721](https://github.com/ClickHouse/ClickHouse/pull/2721). -- Bir argüman olarak bir tablo yerine bir tablo işlevini kullanma yeteneği eklendi `remote` veya `cluster table function` [\#2708](https://github.com/ClickHouse/ClickHouse/pull/2708). -- İçin destek `HTTP Basic` çoğaltma protokolünde kimlik doğrulama [\#2727](https://github.com/ClickHouse/ClickHouse/pull/2727). -- Bu `has` fonksiyon artık bir dizi sayısal bir değer için arama sağlar `Enum` değerler [Maxim Khrisanfov](https://github.com/ClickHouse/ClickHouse/pull/2699). -- Gelen okurken keyfi mesaj ayırıcılar eklemek için destek `Kafka` [Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2701). - -#### Geliştirmeler: {#improvements-8} - -- Bu `ALTER TABLE t DELETE WHERE` sorgu, where koşulundan etkilenmeyen veri bölümlerini yeniden yazmaz [\#2694](https://github.com/ClickHouse/ClickHouse/pull/2694). -- Bu `use_minimalistic_checksums_in_zookeeper` seçeneği için `ReplicatedMergeTree` tablolar varsayılan olarak etkindir. Bu ayar 1.1.54378, 2018-04-16 sürümüne eklendi. 1.1.54378'den eski sürümler artık yüklenemez. -- Koşu için destek `KILL` ve `OPTIMIZE` belirten sorgular `ON CLUSTER` [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2689). - -#### Hata düzeltmeleri: {#bug-fixes-16} - -- Hata düzeltildi `Column ... is not under an aggregate function and not in GROUP BY` bir in ifadesi ile toplama için. Bu hata 18.1.0 sürümünde göründü. ([bbdd780b](https://github.com/ClickHouse/ClickHouse/commit/bbdd780be0be06a0f336775941cdd536878dd2c2)) -- Bu bir hata düzeltildi `windowFunnel aggregate function` [Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2735). -- Bu bir hata düzeltildi `anyHeavy` toplama fonksiyonu ([a2101df2](https://github.com/ClickHouse/ClickHouse/commit/a2101df25a6a0fba99aa71f8793d762af2b801ee)) -- Kullanırken sabit sunucu çökmesi `countArray()` toplama işlevi. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-5} - -- İçin parametreler `Kafka` motor değiştirildi `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_schema, kafka_num_consumers])` -e doğru `Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format[, kafka_row_delimiter, kafka_schema, kafka_num_consumers])`. Tablolar kullanıyorsanız `kafka_schema` veya `kafka_num_consumers` parametreleri, elle meta dosyaları düzenlemek zorunda `path/metadata/database/table.sql` ve Ekle `kafka_row_delimiter` parametre ile `''` değer. - -## ClickHouse sürümü 18.1 {#clickhouse-release-18-1} - -### ClickHouse sürümü 18.1.0, 2018-07-23 {#clickhouse-release-18-1-0-2018-07-23} - -#### Yenilik: {#new-features-9} - -- İçin destek `ALTER TABLE t DELETE WHERE` çoğaltılmamış MergeTree tabloları için sorgu ([\#2634](https://github.com/ClickHouse/ClickHouse/pull/2634)). -- İçin keyfi türleri için destek `uniq*` agrega fonksiyonları ailesi ([\#2010](https://github.com/ClickHouse/ClickHouse/issues/2010)). -- Karşılaştırma operatörlerinde keyfi türler için destek ([\#2026](https://github.com/ClickHouse/ClickHouse/issues/2026)). -- Bu `users.xml` dosya biçiminde bir alt ağ maskesi ayarlama sağlar `10.0.0.1/255.255.255.0`. Bu, ortada sıfır olan IPv6 ağları için Maskeler kullanmak için gereklidir ([\#2637](https://github.com/ClickHouse/ClickHouse/pull/2637)). -- Add theed the `arrayDistinct` işlev ([\#2670](https://github.com/ClickHouse/ClickHouse/pull/2670)). -- SummingMergeTree altyapısı artık AggregateFunction türü sütunları ile çalışabilir ([Constantin S. Pan](https://github.com/ClickHouse/ClickHouse/pull/2566)). - -#### Geliştirmeler: {#improvements-9} - -- Sürüm sürümleri için numaralandırma düzenini değiştirdi. Şimdi ilk bölüm sürüm yılını içeriyor (A. D., Moskova saat dilimi, eksi 2000), ikinci bölüm büyük değişikliklerin sayısını içeriyor (çoğu sürüm için artar) ve üçüncü bölüm yama sürümüdür. Aksi changelog belirtilmediği sürece bültenleri hala geriye dönük uyumludur. -- Kayan noktalı sayıların bir dizeye daha hızlı dönüştürülmesi ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2664)). -- Ayrıştırma hataları nedeniyle bir ekleme sırasında bazı satırlar atlanmışsa (bu, `input_allow_errors_num` ve `input_allow_errors_ratio` ayarları etkin), atlanan satır sayısı şimdi sunucu günlüğüne yazılır ([Leonardo Cecchi](https://github.com/ClickHouse/ClickHouse/pull/2669)). - -#### Hata düzeltmeleri: {#bug-fixes-17} - -- Geçici tablolar için TRUNCATE komutu düzeltildi ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2624)). -- Yanıtı okurken bir ağ hatası olduğunda meydana gelen ZooKeeper istemci kütüphanesinde nadir bir kilitlenme düzeltildi ([c315200](https://github.com/ClickHouse/ClickHouse/commit/c315200e64b87e44bdf740707fc857d1fdf7e947)). -- Null türleri için bir döküm sırasında bir hata düzeltildi ([\#1322](https://github.com/ClickHouse/ClickHouse/issues/1322)). -- Yanlış sonuç düzeltildi `maxIntersection()` aralıkların sınırları çakıştığında işlev ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2657)). -- Bir işlev argümanında or ifade zincirinin yanlış dönüşümü düzeltildi ([chenxing-xc](https://github.com/ClickHouse/ClickHouse/pull/2663)). -- İçeren sorgular için sabit performans düşüşü `IN (subquery)` başka bir alt sorgu içindeki ifadeler ([\#2571](https://github.com/ClickHouse/ClickHouse/issues/2571)). -- Bir kullanan dağıtılmış sorgularda farklı sürümleri ile sunucular arasında sabit uyumsuzluk `CAST` büyük harflerle olmayan işlev ([fe8c4d6](https://github.com/ClickHouse/ClickHouse/commit/fe8c4d64e434cacd4ceef34faa9005129f2190a5)). -- Harici bir DBMS sorguları için tanımlayıcıları alıntı eksik eklendi ([\#2635](https://github.com/ClickHouse/ClickHouse/issues/2635)). - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-6} - -- DateTime için sıfır sayısını içeren bir dize dönüştürme çalışmaz. Örnek: `SELECT toDateTime('0')`. Bu da nedeni `DateTime DEFAULT '0'` tablolarda da çalışmıyor `0` sözlüklerde. Çözüm: değiştirin `0` ile `0000-00-00 00:00:00`. - -## ClickHouse sürüm 1.1 {#clickhouse-release-1-1} - -### ClickHouse sürümü 1.1.54394, 2018-07-12 {#clickhouse-release-1-1-54394-2018-07-12} - -#### Yenilik: {#new-features-10} - -- Add theed the `histogram` toplama fonksiyonu ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2521)). -- Şimdi `OPTIMIZE TABLE ... FINAL` için bölümler belirt specifyingmeden kullanılabilir `ReplicatedMergeTree` ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2600)). - -#### Hata düzeltmeleri: {#bug-fixes-18} - -- Çoğaltılmış verileri gönderirken ve indirirken okumak ve yazmak için soketler için çok küçük bir zaman aşımı (bir saniye) ile ilgili bir sorun düzeltildi, bu da ağ veya diskte bir yük varsa daha büyük parçaları indirmeyi imkansız hale getirdi (parçaları indirmek için döngüsel girişimlerle sonuçlandı). Bu hata 1.1.54388 sürümünde oluştu. -- Tabloda yinelenen veri blokları eklediyseniz zookeeper chroot kullanırken sorunlar giderildi. -- Bu `has` işlev artık boş öğelere sahip bir dizi için doğru çalışıyor ([\#2115](https://github.com/ClickHouse/ClickHouse/issues/2115)). -- Bu `system.tables` tablo şimdi dağıtılmış sorgularda kullanıldığında düzgün çalışır. Bu `metadata_modification_time` ve `engine_full` sütunlar artık sanal değil. Tablodan yalnızca bu sütunlar sorgulanırsa oluşan bir hata düzeltildi. -- Sabit nasıl boş `TinyLog` tablo boş bir veri bloğu ekledikten sonra çalışır ([\#2563](https://github.com/ClickHouse/ClickHouse/issues/2563)). -- Bu `system.zookeeper` zookeeper düğümün değeri NULL ise Tablo çalışır. - -### ClickHouse sürümü 1.1.54390, 2018-07-06 {#clickhouse-release-1-1-54390-2018-07-06} - -#### Yenilik: {#new-features-11} - -- Sorgular gönderilebilir `multipart/form-data` biçim (içinde `query` alan), sorgu işleme için harici veriler de gönderilirse yararlıdır ([Olga Hvostikova](https://github.com/ClickHouse/ClickHouse/pull/2490)). -- CSV formatında veri okurken tek veya çift tırnak işleme etkinleştirmek veya devre dışı bırakmak için yeteneği eklendi. Bunu şu şekilde yapılandırabilirsiniz: `format_csv_allow_single_quotes` ve `format_csv_allow_double_quotes` ayarlar ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2574)). -- Şimdi `OPTIMIZE TABLE ... FINAL` olmayan çoğaltılmış varyantları için bölüm belirtmeden kullanılabilir `MergeTree` ([Amos Kuşu](https://github.com/ClickHouse/ClickHouse/pull/2599)). - -#### Geliştirmeler: {#improvements-10} - -- Geliştirilmiş performans, azaltılmış bellek tüketimi, ve doğru bellek tüketimi izleme kullanımı ile In operatör zaman bir tablo Endeksi kullanılabilir ([\#2584](https://github.com/ClickHouse/ClickHouse/pull/2584)). -- Bir veri parçası eklerken sağlama toplamlarının gereksiz denetimi kaldırıldı. Bu, çok sayıda çoğaltma olduğunda önemlidir,çünkü bu durumlarda toplam kontrol sayısı n^2'ye eşittir. -- İçin destek eklendi `Array(Tuple(...))` arg theum argumentsents for the `arrayEnumerateUniq` işlev ([\#2573](https://github.com/ClickHouse/ClickHouse/pull/2573)). -- Katma `Nullable` için destek `runningDifference` işlev ([\#2594](https://github.com/ClickHouse/ClickHouse/pull/2594)). -- Çok sayıda ifade olduğunda geliştirilmiş sorgu analizi performansı ([\#2572](https://github.com/ClickHouse/ClickHouse/pull/2572)). -- Birleştirme için veri parçalarının daha hızlı seçimi `ReplicatedMergeTree` Tablolar. ZooKeeper oturumunun daha hızlı iyileşmesi ([\#2597](https://github.com/ClickHouse/ClickHouse/pull/2597)). -- Bu `format_version.txt` için dosya `MergeTree` eksikse tablolar yeniden oluşturulur, bu da dizin yapısını dosyalar olmadan kopyaladıktan sonra ClickHouse başlatılırsa mantıklı olur ([Ciprian Hacman](https://github.com/ClickHouse/ClickHouse/pull/2593)). - -#### Hata düzeltmeleri: {#bug-fixes-19} - -- ZooKeeper ile çalışırken, sunucuyu yeniden başlatmadan önce oturumu ve readonly tablo durumlarını kurtarmayı imkansız hale getirebilecek bir hata düzeltildi. -- Oturum kesilirse eski düğümlerin silinmemesine neden olabilecek ZooKeeper ile çalışırken bir hata düzeltildi. -- Sabit bir hata `quantileTDigest` Float argümanları için işlev (bu hata 1.1.54388 sürümünde tanıtıldı) ([Mikhail Surin](https://github.com/ClickHouse/ClickHouse/pull/2553)). -- Birincil anahtar sütunu, aynı boyuttaki imzalı ve imzasız tamsayılar arasındaki türleri dönüştürmek için işlevin içinde bulunuyorsa, mergetree tabloları için dizinde bir hata düzeltildi ([\#2603](https://github.com/ClickHouse/ClickHouse/pull/2603)). -- Sabit segfault eğer `macros` kullanılır ancak yapılandırma dosyasında değildir ([\#2570](https://github.com/ClickHouse/ClickHouse/pull/2570)). -- İstemci yeniden bağlanırken varsayılan veritabanına sabit anahtarlama ([\#2583](https://github.com/ClickHouse/ClickHouse/pull/2583)). -- Ne zaman meydana gelen bir hata düzeltildi `use_index_for_in_with_subqueries` ayar devre dışı bırakıldı. - -#### Güvenlik düzeltme: {#security-fix-1} - -- Mysql'e bağlandığında dosya göndermek artık mümkün değil (`LOAD DATA LOCAL INFILE`). - -### ClickHouse sürümü 1.1.54388, 2018-06-28 {#clickhouse-release-1-1-54388-2018-06-28} - -#### Yenilik: {#new-features-12} - -- İçin destek `ALTER TABLE t DELETE WHERE` çoğaltılmış tablolar için sorgu. Add theed the `system.mutations` bu tür sorguların ilerlemesini izlemek için tablo. -- İçin destek `ALTER TABLE t [REPLACE|ATTACH] PARTITION` \*MergeTree tabloları için sorgu. -- İçin destek `TRUNCATE TABLE` sorgu ([Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2260)) -- Birkaç yeni `SYSTEM` çoğaltılmış tablolar için sorgular (`RESTART REPLICAS`, `SYNC REPLICA`, `[STOP|START] [MERGES|FETCHES|SENDS REPLICATED|REPLICATION QUEUES]`). -- MySQL motoru ve ilgili tablo fonksiyonu ile bir tabloya yazma yeteneği eklendi ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2294)). -- Add theed the `url()` tablo fonksiyonu ve `URL` masa motoru ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2501)). -- Add theed the `windowFunnel` toplama fonksiyonu ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2352)). -- Yeni `startsWith` ve `endsWith` dizeler için işlevler ([Vadim Plakhtinsky](https://github.com/ClickHouse/ClickHouse/pull/2429)). -- Bu `numbers()` tablo işlevi artık ofset belirtmenizi sağlar ([Kış Zhang](https://github.com/ClickHouse/ClickHouse/pull/2535)). -- Şifre için `clickhouse-client` etkileşimli olarak girilebilir. -- Sunucu günlükleri artık syslog'a gönderilebilir ([Alexander Krasheninnikov](https://github.com/ClickHouse/ClickHouse/pull/2459)). -- Paylaşılan kitaplık kaynağı ile sözlüklerde oturum açma desteği ([Alexander Sapin](https://github.com/ClickHouse/ClickHouse/pull/2472)). -- Özel CSV sınırlayıcılar için destek ([Ivan Zhukov](https://github.com/ClickHouse/ClickHouse/pull/2263)) -- Add theed the `date_time_input_format` ayar. Bu ayarı şu şekilde değiştirirseniz `'best_effort'`, DateTime değerleri biçimleri geniş bir yelpazede okunacaktır. -- Add theed the `clickhouse-obfuscator` veri gizleme için yardımcı program. Kullanım örneği: performans testlerinde kullanılan verileri yayınlama. - -#### Deneysel özellikler: {#experimental-features-2} - -- Hesaplamak için yeteneği eklendi `and` argümanlar sadece ihtiyaç duydukları yerde ([Anastasia Tsarkova](https://github.com/ClickHouse/ClickHouse/pull/2272)) -- Yerel kod JIT derleme bazı ifadeler için artık kullanılabilir ([pyos](https://github.com/ClickHouse/ClickHouse/pull/2277)). - -#### Hata düzeltmeleri: {#bug-fixes-20} - -- Yinelemeler artık bir sorgu için görünmüyor `DISTINCT` ve `ORDER BY`. -- İle sorgular `ARRAY JOIN` ve `arrayFilter` artık yanlış bir sonuç döndürmez. -- İç içe geçmiş bir yapıdan bir dizi sütunu okurken bir hata düzeltildi ([\#2066](https://github.com/ClickHouse/ClickHouse/issues/2066)). -- Gibi bir having yan tümcesi ile sorguları analiz ederken bir hata düzeltildi `HAVING tuple IN (...)`. -- Özyinelemeli takma adlarla sorguları analiz ederken bir hata düzeltildi. -- Tüm satırları filtreleyen PREWHERE bir koşul ile ReplacingMergeTree okurken bir hata düzeltildi ([\#2525](https://github.com/ClickHouse/ClickHouse/issues/2525)). -- HTTP arabirimindeki oturumları kullanırken kullanıcı profili ayarları uygulanmadı. -- Clickhouse-local'deki komut satırı parametrelerinden ayarların nasıl uygulandığı düzeltildi. -- ZooKeeper istemci kitaplığı artık sunucudan alınan oturum zaman aşımını kullanır. -- İstemci zaman aşımı daha uzun sunucu yanıt bekledi ZooKeeper istemci kütüphanesinde bir hata düzeltildi. -- Bölüm anahtar sütunlarındaki koşullarla sorgular için parçaların sabit budaması ([\#2342](https://github.com/ClickHouse/ClickHouse/issues/2342)). -- Birleşmeler şimdi mümkün `CLEAR COLUMN IN PARTITION` ([\#2315](https://github.com/ClickHouse/ClickHouse/issues/2315)). -- ODBC tablo işlevinde tür eşleme düzeltildi ([sundy-li](https://github.com/ClickHouse/ClickHouse/pull/2268)). -- Tür karşılaştır formaları Düzelt forildi `DateTime` saat dilimi ile ve olmadan ([Alexander Bocharov](https://github.com/ClickHouse/ClickHouse/pull/2400)). -- Sabit sözdizimsel ayrıştırma ve biçimlendirme `CAST` operatör. -- Dağıtılmış tablo motoru için somutlaştırılmış bir görünüme sabit ekleme ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2411)). -- Veri yazarken bir yarış durumu düzeltildi `Kafka` motor için hayata görünümleri ([Yangkuan Liu](https://github.com/ClickHouse/ClickHouse/pull/2448)). -- Uzak () tablo işlevinde sabit SSRF. -- Sabit çıkış davranışı `clickhouse-client` çok satırlı modda ([\#2510](https://github.com/ClickHouse/ClickHouse/issues/2510)). - -#### Geliştirmeler: {#improvements-11} - -- Çoğaltılmış tablolardaki arka plan görevleri artık ayrı iş parçacıkları yerine bir iş parçacığı havuzunda gerçekleştirilir ([Silviu Caragea](https://github.com/ClickHouse/ClickHouse/pull/1722)). -- Geliştirilmiş lz4 sıkıştırma performansı. -- Çok sayıda birleştirme ve alt sorgu ile sorgular için daha hızlı analiz. -- Çok fazla ağ hatası olduğunda DNS önbelleği artık otomatik olarak güncellenir. -- Çok fazla parçaya sahip olduğundan, materialized görünümlerden birine ekleme mümkün değilse, tablo ekleri artık oluşmaz. -- Olay sayaçlarındaki tutarsızlık düzeltildi `Query`, `SelectQuery`, ve `InsertQuery`. -- Gibi ifadeler `tuple IN (SELECT tuple)` tuple türleri eşleşirse izin verilir. -- Çoğaltılmış tabloları olan bir sunucu, Zookeeper'ı yapılandırmasanız bile başlayabilir. -- Mevcut CPU çekirdeklerinin sayısını hesaplarken, C gruplarındaki sınırlar şimdi dikkate alınmaktadır ([Atri Sharma](https://github.com/ClickHouse/ClickHouse/pull/2325)). -- Systemd yapılandırma dosyasında yapılandırma dizinleri için chown eklendi ([Mikhail Shiryaev](https://github.com/ClickHouse/ClickHouse/pull/2421)). - -#### Yapı değişiklikleri: {#build-changes-4} - -- Gcc8 derleyicisi yapılar için kullanılabilir. -- Alt modülden llvm oluşturma yeteneği eklendi. -- Librdkafka kütüphanesinin sürümü v0.11.4 olarak güncellendi. -- Sistem libcpuid kütüphanesini kullanma yeteneği eklendi. Kütüphane sürümü 0.4.0 olarak güncellendi. -- Vectorclass kütüphanesini kullanarak yapı düzeltildi ([Babacar Diassé](https://github.com/ClickHouse/ClickHouse/pull/2274)). -- Cmake şimdi varsayılan olarak ninja için dosyalar üretir (kullanırken olduğu gibi `-G Ninja`). -- Libtermcap yerine libtınfo kütüphanesini kullanma yeteneği eklendi ([Georgy Kondratiev](https://github.com/ClickHouse/ClickHouse/pull/2519)). -- Fedora Rawhide bir başlık dosyası çakışması düzeltildi ([\#2520](https://github.com/ClickHouse/ClickHouse/issues/2520)). - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-7} - -- Çıkar escapingıldı `Vertical` ve `Pretty*` format Andlar ve silinen `VerticalRaw` biçimli. -- 1.1.54388 (veya daha yeni) sürümüne sahip sunucular ve daha eski bir sürüme sahip sunucular dağıtılmış bir sorguda aynı anda kullanılıyorsa ve sorgunun `cast(x, 'Type')` ifade olmadan `AS` anahtar kelime ve kelime yok `cast` büyük harfle, bir istisna gibi bir mesajla atılır `Not found column cast(0, 'UInt8') in block`. Çözüm: tüm kümedeki sunucuyu güncelleyin. - -### ClickHouse sürümü 1.1.54385, 2018-06-01 {#clickhouse-release-1-1-54385-2018-06-01} - -#### Hata düzeltmeleri: {#bug-fixes-21} - -- Bazı durumlarda zookeeper işlemlerinin engellenmesine neden olan bir hata düzeltildi. - -### ClickHouse sürümü 1.1.54383, 2018-05-22 {#clickhouse-release-1-1-54383-2018-05-22} - -#### Hata düzeltmeleri: {#bug-fixes-22} - -- Bir tablo birçok yinelemeler varsa çoğaltma kuyruğunun bir yavaşlama düzeltildi. - -### ClickHouse sürümü 1.1.54381, 2018-05-14 {#clickhouse-release-1-1-54381-2018-05-14} - -#### Hata düzeltmeleri: {#bug-fixes-23} - -- ClickHouse ZooKeeper sunucusuna bağlantı kaybettiğinde ZooKeeper bir düğüm sızıntısı düzeltildi. - -### ClickHouse sürüm 1.1.54380, 2018-04-21 {#clickhouse-release-1-1-54380-2018-04-21} - -#### Yenilik: {#new-features-13} - -- Tablo fonksiyonu eklendi `file(path, format, structure)`. Örnek okuma baytları `/dev/urandom`: ``` ln -s /dev/urandom /var/lib/clickhouse/user_files/random``clickhouse-client -q "SELECT * FROM file('random', 'RowBinary', 'd UInt8') LIMIT 10" ```. - -#### Geliştirmeler: {#improvements-12} - -- Alt sorgular sarılabilir `()` sorgu okunabilirliğini artırmak için parantez. Mesela: `(SELECT 1) UNION ALL (SELECT 1)`. -- Basit `SELECT` gelen sorgular `system.processes` tablo dahil değildir `max_concurrent_queries` sınır. - -#### Hata düzeltmeleri: {#bug-fixes-24} - -- Sabit yanlış davranış `IN` operatör ne zaman seçin `MATERIALIZED VIEW`. -- Gibi ifadelerde bölüm indeksi ile sabit yanlış filtreleme `partition_key_column IN (...)`. -- Sabit yetersizlik yürütmek için `OPTIMIZE` eğer lider olmayan çoğaltma üzerinde sorgu `REANAME` masaya yapıldı. -- Yürütülürken yetkilendirme hatası düzeltildi `OPTIMIZE` veya `ALTER` olmayan bir lider çoğaltma sorgular. -- Sabit donma `KILL QUERY`. -- Saatlerin kaybına yol açan ZooKeeper istemci kütüphanesinde bir hata, dağıtılmış DDL kuyruğunun dondurulması ve boş olmayan bir çoğaltma kuyruğundaki yavaşlamalar düzeltildi `chroot` önek ZooKeeper yapılandırmasında kullanılır. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-8} - -- Gibi ifadeler için destek kaldırıldı `(a, b) IN (SELECT (a, b))` (eşdeğer ifadeyi kullanabilirsiniz `(a, b) IN (SELECT a, b)`). Önceki sürümlerde, bu ifadeler belirsizliğe yol açtı `WHERE` filtreleme veya neden olan hatalar. - -### ClickHouse sürümü 1.1.54378, 2018-04-16 {#clickhouse-release-1-1-54378-2018-04-16} - -#### Yenilik: {#new-features-14} - -- Günlük düzeyi sunucuyu yeniden başlatmadan değiştirilebilir. -- Add theed the `SHOW CREATE DATABASE` sorgu. -- Bu `query_id` geç canilebilir `clickhouse-client` (elBroom). -- Yeni ayar: `max_network_bandwidth_for_all_users`. -- İçin destek eklendi `ALTER TABLE ... PARTITION ...` için `MATERIALIZED VIEW`. -- Sistem tablosunda sıkıştırılmamış formdaki veri parçalarının boyutu hakkında bilgi eklendi. -- Dağıtılmış tablolar için sunucudan sunucuya şifreleme desteği (`1` rep thelik thea config in ``). -- Tablo düzeyi için yapılandırma `ReplicatedMergeTree` Zookeeper saklanan veri miktarını en aza indirmek için aile: : `use_minimalistic_checksums_in_zookeeper = 1` -- Yapılandırma `clickhouse-client` istem. Varsayılan olarak, sunucu adları artık istemine çıktı. Sunucunun görünen adı değiştirilebilir. Ayrıca gönderilen `X-ClickHouse-Display-Name` HTTP Başlığı (Kirill Shvakov). -- Birden çok virgülle ayrılmış `topics` için belirt theilebilir `Kafka` motor (Tobias Adamson) -- Bir sorgu tarafından durdurulduğunda `KILL QUERY` veya `replace_running_query`, müşteri alır `Query was canceled` eksik bir sonuç yerine istisna. - -#### Geliştirmeler: {#improvements-13} - -- `ALTER TABLE ... DROP/DETACH PARTITION` sorgular, çoğaltma kuyruğunun önünde çalıştırılır. -- `SELECT ... FINAL` ve `OPTIMIZE ... FINAL` tablo tek bir veri parçası olduğunda bile kullanılabilir. -- A `query_log` el ile silindiyse tablo anında yeniden oluşturulur (Kirill Shvakov). -- Bu `lengthUTF8` fonksiyon daha hızlı çalışır (zhang2014). -- Senkron ekler geliştirilmiş performans `Distributed` Tablolar (`insert_distributed_sync = 1`) çok sayıda parça olduğunda. -- Sunucu kabul eder `send_timeout` ve `receive_timeout` istemciden ayarlar ve istemciye bağlanırken bunları uygular (bunlar ters sırada uygulanır: sunucu soketinin `send_timeout` için ayarlanır `receive_timeout` müşteriden alınan değer ve tersi). -- Asenkron ekleme için daha sağlam kilitlenme kurtarma `Distributed` Tablolar. -- Dönüş türü `countEqual` fonksiyon değiştirildi `UInt32` -e doğru `UInt64` (谢磊). - -#### Hata düzeltmeleri: {#bug-fixes-25} - -- Bir hata düzeltildi `IN` ifadenin sol tarafı olduğunda `Nullable`. -- Tuples ile birlikte kullanıldığında doğru sonuçlar şimdi döndürülür `IN` bazı tuple bileşenleri tablo dizininde olduğunda. -- Bu `max_execution_time` limit şimdi dağıtılmış sorgularla düzgün çalışır. -- Bileşik sütunların boyutunu hesaplarken sabit hatalar `system.columns` Tablo. -- Geçici bir tablo oluştururken bir hata düzeltildi `CREATE TEMPORARY TABLE IF NOT EXISTS.` -- Sabit hatalar `StorageKafka` (\#\#2075) -- Sabit sunucu, belirli toplam işlevlerin geçersiz argümanlarından çöker. -- Engellenen hata düzeltildi `DETACH DATABASE` için arka plan görevlerini durdurma sorgusu `ReplicatedMergeTree` Tablolar. -- `Too many parts` toplu materialized görünümler (\#\#2084) eklerken durum daha az olasıdır. -- Bir ikame aynı düzeyde başka bir ikame tarafından takip edilmesi gerekiyorsa, yapılandırmada değiştirmelerin düzeltilmiş özyinelemeli işleme. -- Bir oluştururken meta veri dosyasında sözdizimi düzeltildi `VIEW` bu bir sorgu ile kullanır `UNION ALL`. -- `SummingMergeTree` şimdi bir bileşik anahtar ile iç içe veri yapılarının toplamı için doğru çalışır. -- Lider seçerken bir yarış durumu olasılığı sabit `ReplicatedMergeTree` Tablolar. - -#### Yapı değişiklikleri: {#build-changes-5} - -- Yapı destekler `ninja` yerine `make` ve kullanımları `ninja` sürümleri oluşturmak için varsayılan olarak. -- Yeniden adlandırılan paketler: `clickhouse-server-base` içinde `clickhouse-common-static`; `clickhouse-server-common` içinde `clickhouse-server`; `clickhouse-common-dbg` içinde `clickhouse-common-static-dbg`. Yüklemek için kullanın `clickhouse-server clickhouse-client`. Eski adlara sahip paketler, geriye dönük uyumluluk için depolara yüklenmeye devam edecektir. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-9} - -- Sol tarafta bir dizi belirtilmişse, bir In ifadesinin özel yorumunu kaldırıldı. Daha önce, ifade `arr IN (set)` olarak yorum waslandı “at least one `arr` element belongs to the `set`”. Yeni sürümde aynı davranışı elde etmek için şunları yazın `arrayExists(x -> x IN (set), arr)`. -- Soket seçeneğinin yanlış kullanımı devre dışı bırakıldı `SO_REUSEPORT`, poco kitaplığında varsayılan olarak yanlış etkinleştirildi. Linux'ta artık adresleri aynı anda belirtmek için herhangi bir neden olmadığını unutmayın `::` ve `0.0.0.0` for listen – use just `::`(varsayılan çekirdek yapılandırma ayarları ile) IPv4 ve IPv6 üzerinden hem bağlantı dinleme sağlar. Belirterek önceki sürümlerden davranışa da geri dönebilirsiniz `1` config. - -### ClickHouse sürümü 1.1.54370, 2018-03-16 {#clickhouse-release-1-1-54370-2018-03-16} - -#### Yenilik: {#new-features-15} - -- Add theed the `system.macros` tablo ve yapılandırma dosyası değiştirildiğinde makroların otomatik güncellenmesi. -- Add theed the `SYSTEM RELOAD CONFIG` sorgu. -- Add theed the `maxIntersections(left_col, right_col)` aynı anda kesişen aralıkların maksimum sayısını döndüren toplama işlevi `[left; right]`. Bu `maxIntersectionsPosition(left, right)` fonksiyonun başlangıcını döndürür “maximum” aralıklı. ([Michael Furmur](https://github.com/ClickHouse/ClickHouse/pull/2012)). - -#### Geliştirmeler: {#improvements-14} - -- Bir veri eklerken `Replicated` tablo, daha az istek yapılır `ZooKeeper` (ve kullanıcı düzeyinde hataların çoğu `ZooKeeper` günlük). -- Veri kümeleri için takma ad oluşturma yeteneği eklendi. Örnek: `WITH (1, 2, 3) AS set SELECT number IN set FROM system.numbers LIMIT 10`. - -#### Hata düzeltmeleri: {#bug-fixes-26} - -- Sabit `Illegal PREWHERE` birleştirme tablolarından okunurken hata `Distributed`Tablolar. -- Eğer IPv4 sadece Docker kaplarda clickhouse-server başlatmak için izin eklendi düzeltmeler. -- Sistemden okurken bir yarış durumu düzeltildi `system.parts_columns tables.` -- Bir senkron ekleme sırasında çift tamponlama kaldırıldı `Distributed` zaman aşımı için bağlantı neden olabilir tablo. -- Başlamadan önce kullanılamayan bir kopya için aşırı uzun beklemelere neden olan bir hata düzeltildi `SELECT` sorgu. -- Sabit yanlış tarihler `system.parts` Tablo. -- İmkansız bir veri eklemek için yapılan bir hata düzeltildi `Replicated` tablo ise `chroot` yapılandırmada boş değildi `ZooKeeper` küme. -- Boş bir dikey birleştirme algoritması düzeltildi `ORDER BY` Tablo. -- Uzak tablo, bu sözlük istemcisi sunucu üzerinde yoksa bile sorgular sözlük kullanma olanağı sağlandı. Bu işlevsellik 1.1.54362 sürümünde kayboldu. -- Gibi sorgular için davranışı geri `SELECT * FROM remote('server2', default.table) WHERE col IN (SELECT col2 FROM default.table)` ne zaman sağ tarafı `IN` bir uzaktan kumanda kullanmalı `default.table` yerel bir yerine. Bu davranış 1.1.54358 sürümünde bozuldu. -- Kaldırılan gereksiz hata düzeyi günlüğü `Not found column ... in block`. - -### ClickHouse Yayın 1.1.54362, 2018-03-11 {#clickhouse-release-1-1-54362-2018-03-11} - -#### Yenilik: {#new-features-16} - -- Olmadan toplama `GROUP BY` boş bir set için (örneğin `SELECT count(*) FROM table WHERE 0`) şimdi SQL standardına uygun olarak toplam işlevler için boş değerlere sahip bir satırla bir sonuç döndürür. Eski davranışı geri yüklemek için (boş bir sonuç döndürür), `empty_result_for_aggregation_by_empty_set` 1'e. -- İçin Tip dönüştürme eklendi `UNION ALL`. Farklı takma ad adlarına izin verilir `SELECT` pozisyon inlar `UNION ALL`, SQL standardına uygun olarak. -- Keyfi ifadeler desteklenir `LIMIT BY` yanlar. Daha önce, yalnızca aşağıdakilerden kaynaklanan sütunları kullanmak mümkündü `SELECT`. -- Dizini `MergeTree` tablolar şu durumlarda kullanılır `IN` birincil anahtarın sütunlarından bir ifade kümesine uygulanır. Örnek: `WHERE (UserID, EventDate) IN ((123, '2000-01-01'), ...)` (Anastasiya Tsarkova). -- Add theed the `clickhouse-copier` kümeleri ve resharding veri (beta) arasında kopyalama aracı. -- Tutarlı karma fonksiyonları eklendi: `yandexConsistentHash`, `jumpConsistentHash`, `sumburConsistentHash`. Onlar sonraki reshardings sırasında ağ trafiği miktarını azaltmak için bir sharding anahtar olarak kullanılabilir. -- Eklenen fonksiyonlar: `arrayAny`, `arrayAll`, `hasAny`, `hasAll`, `arrayIntersect`, `arrayResize`. -- Add theed the `arrayCumSum` fonksiyon (Javi Santana). -- Add theed the `parseDateTimeBestEffort`, `parseDateTimeBestEffortOrZero`, ve `parseDateTimeBestEffortOrNull` çok çeşitli Olası biçimlerde metin içeren bir dizeden datetime okumak için işlevler. -- Veriler, güncelleme sırasında harici sözlüklerden kısmen yeniden yüklenebilir (yalnızca belirtilen alanın değerinin önceki indirmeden daha büyük olduğu kayıtları yükleyin) (Arsen Hakobyan). -- Add theed the `cluster` tablo işlevi. Örnek: `cluster(cluster_name, db, table)`. Bu `remote` tablo işlevi, bir tanımlayıcı olarak belirtilirse, küme adını ilk bağımsız değişken olarak kabul edebilir. -- Bu `remote` ve `cluster` tablo fonksiyonları kullanılabilir `INSERT` sorgular. -- Add theed the `create_table_query` ve `engine_full` sanal sütunlar için `system.tables`Tablo . Bu `metadata_modification_time` sütun sanal. -- Add theed the `data_path` ve `metadata_path` sütunlar için `system.tables`ve`system.databases` tablolar ve eklenen `path` Col theum then to the `system.parts` ve `system.parts_columns` Tablolar. -- Birleştirme hakkında ek bilgi eklendi `system.part_log` Tablo. -- Keyfi bir bölümleme anahtarı için kullanılabilir `system.query_log` tablo (Kirill Shvakov). -- Bu `SHOW TABLES` sorgu şimdi de geçici tablolar gösterir. Geçici tablolar eklendi ve `is_temporary` sütun için `system.tables` (zhang2014). -- Katma `DROP TEMPORARY TABLE` ve `EXISTS TEMPORARY TABLE` sorgular (zhang2014). -- İçin destek `SHOW CREATE TABLE` geçici tablolar için (zhang2014). -- Add theed the `system_profile` iç işlemler tarafından kullanılan ayarlar için yapılandırma parametresi. -- Yükleme desteği `object_id` bir nitelik olarak `MongoDB` sözlükler (Pavel Litvinenko). -- Okuma `null` harici bir sözlük için veri yüklerken varsayılan değer olarak `MongoDB` kaynak (Pavel Litvinenko). -- Okuma `DateTime` değerleri `Values` tek tırnak işaretleri olmadan bir Unix zaman damgasından biçimlendirin. -- Yük devretme desteklenir `remote` tablo işlevleri bazı yinelemeler istenen tablo eksik olduğunda durumlar için. -- Çalıştırdığınızda yapılandırma ayarları komut satırında geçersiz kılınabilir `clickhouse-server`. Örnek: `clickhouse-server -- --logger.level=information`. -- Uygulanan `empty` fonksiyonu bir `FixedString` argüman: dize tamamen boş bayttan oluşuyorsa (zhang2014) işlev 1 döndürür. -- Add theed the `listen_try`bazı adresler dinlenemiyorsa (IPv4 veya IPv6 için engelli desteği olan sistemler için kullanışlıdır), dinleme adreslerinden en az birini bırakmadan dinlemek için yapılandırma parametresi. -- Add theed the `VersionedCollapsingMergeTree` masa motoru. -- Satır ve rasgele sayısal türleri için destek `library` sözlük kaynağı. -- `MergeTree` tablolar birincil anahtar olmadan kullanılabilir (belirtmeniz gerekir `ORDER BY tuple()`). -- A `Nullable` tipi olabilir `CAST` olmayan -`Nullable` bağımsız değişken değilse yazın `NULL`. -- `RENAME TABLE` için yapılabilir `VIEW`. -- Add theed the `throwIf` işlev. -- Add theed the `odbc_default_field_size` bir ODBC kaynağından yüklenen değerin en büyük boyutunu genişletmenizi sağlayan seçenek (varsayılan olarak, 1024'tür). -- Bu `system.processes` masa ve `SHOW PROCESSLIST` şimdi var `is_cancelled` ve `peak_memory_usage` sütun. - -#### Geliştirmeler: {#improvements-15} - -- Sonuç üzerindeki sınırlar ve kotalar artık Ara verilere uygulanmıyor `INSERT SELECT` sorgular veya `SELECT` alt sorgular. -- Daha az yanlış tetikleyici `force_restore_data` durumunu kontrol ederken `Replicated` sunucu başladığında tablolar. -- Add theed the `allow_distributed_ddl` seçenek. -- Nondeterministic işlevleri için ifadelerde izin verilmez `MergeTree` masa tuşları. -- Değiştirmeleri olan dosyalar `config.d` dizinler alfabetik sırayla yüklenir. -- Geliştirilmiş performans `arrayElement` elemanlardan biri olarak boş bir dizi ile sabit çok boyutlu bir dizi durumunda işlev. Örnek: `[[1], []][x]`. -- Sunucu, yapılandırma dosyalarını çok büyük ikamelerle (örneğin, çok büyük IP ağları listeleri) kullanırken daha hızlı başlar. -- Bir sorgu çalıştırırken, tablo değerli işlevleri bir kez çalıştırın. Önceden, `remote` ve `mysql` tablo değerli işlevler, tablo yapısını uzak bir sunucudan almak için aynı sorguyu iki kez gerçekleştirdi. -- Bu `MkDocs` belg .eleme üret .eci kullanılır. -- Bir tablo sütunu silmeye çalıştığınızda, `DEFAULT`/`MATERIALIZED` diğer sütunların ifadeleri bağlıdır, bir istisna atılır (zhang2014). -- İçin sayı 0 olarak metin biçimlerinde boş bir satır ayrıştırmak için yeteneği eklendi `Float` veri türleri. Bu özellik daha önce mevcuttu, ancak 1.1.54342 sürümünde kayboldu. -- `Enum` değerleri kullanılabilir `min`, `max`, `sum` ve diğer bazı fonksiyonlar. Bu durumlarda, karşılık gelen sayısal değerleri kullanır. Bu özellik daha önce mevcuttu, ancak 1.1.54337 sürümünde kayboldu. -- Katma `max_expanded_ast_elements` yinelemeli genişleyen takma adlar sonra AST boyutunu kısıtlamak için. - -#### Hata düzeltmeleri: {#bug-fixes-27} - -- Gereksiz sütunlar hatalı alt sorgulardan kaldırıldığında veya içeren alt sorgulardan kaldırılmadığında sabit durumlar `UNION ALL`. -- İçin birleştirir bir hata düzeltildi `ReplacingMergeTree` Tablolar. -- Sabit senkron eklemeler `Distributed` Tablolar (`insert_distributed_sync = 1`). -- Belirli kullanımlar için sabit segfault `FULL` ve `RIGHT JOIN` alt sorgularda yinelenen sütunlarla. -- Belirli kullanımlar için sabit segfault `replace_running_query` ve `KILL QUERY`. -- Sabit sipariş `source` ve `last_exception` Col theum thens in the `system.dictionaries` Tablo. -- Sabit hata zaman `DROP DATABASE` sorgu meta verileri ile dosyayı silmedi. -- Sabit `DROP DATABASE` sorgu için `Dictionary` veritabanılar. -- Sabit düşük hassasiyet `uniqHLL12` ve `uniqCombined` 100 milyondan fazla öğe için işlevler (Alex Bocharov). -- Aynı anda varsayılan açık ifadeleri hesaplamak için gerektiğinde örtülü varsayılan değerlerin hesaplanması düzeltildi `INSERT` sorgular (zhang2014). -- Bir sorgu için nadir bir durum düzeltildi `MergeTree` tablo bitiremedi (chenxing-xc). -- Bir çalışırken meydana gelen bir kilitlenme düzeltildi `CHECK` sorgu için `Distributed` tüm parçalar yerel ise tablolar (chenxing.xcc). -- Düzenli ifadeler kullanan işlevlerle hafif bir performans gerilemesi düzeltildi. -- Karmaşık ifadelerden çok boyutlu diziler oluştururken bir performans gerilemesi düzeltildi. -- Ekstra bir neden olabilecek bir hata düzeltildi `FORMAT` bir bölümde görün toecek bölüm `.sql` meta veriler içeren dosya. -- Neden bir hata düzeltildi `max_table_size_to_drop` s deleteilmeye çalış aılırken uygulanacak sınır `MATERIALIZED VIEW` açıkça belirtilen bir tabloya bakıyor. -- Eski istemcilerle sabit uyumsuzluk (eski istemciler bazen `DateTime('timezone')` anlamadıkları tür). -- Okurken bir hata düzeltildi `Nested` kullanılarak eklenen yapıların sütun elemanları `ALTER` ancak, bu sütunların koşulları taşındığında eski bölümler için boş `PREWHERE`. -- Tabloları sanal olarak filtrelerken bir hata düzeltildi `_table` sorgu columnslardaki sütunlar `Merge` Tablolar. -- Kullanırken bir hata düzeltildi `ALIAS` Col inum inns in `Distributed` Tablolar. -- Gelen toplam fonksiyonları ile sorgular için dinamik derleme imkansız hale bir hata düzeltildi `quantile` aile. -- Kullanırken çok nadir durumlarda meydana gelen sorgu yürütme boru hattında bir yarış durumu düzeltildi `Merge` çok sayıda tablo içeren tablolar ve kullanırken `GLOBAL` alt sorgular. -- Farklı boyutlarda dizileri geçerken bir kilitlenme düzeltildi `arrayReduce` birden çok bağımsız değişkenden toplam işlevleri kullanırken işlev. -- İle sorgu useların kullanılması yasaktır `UNION ALL` in a `MATERIALIZED VIEW`. -- Başlatma sırasında bir hata düzeltildi `part_log` sunucu başlatıldığında sistem tablosu (varsayılan olarak, `part_log` devre dışı) olur. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-10} - -- Kaldır theılan `distributed_ddl_allow_replicated_alter` seçenek. Bu davranış varsayılan olarak etkindir. -- Kaldır theılan `strict_insert_defaults` ayar. Bu işlevi kullanıyorsanız, `clickhouse-feedback@yandex-team.com`. -- Kaldır theılan `UnsortedMergeTree` motor. - -### ClickHouse Yayın 1.1.54343, 2018-02-05 {#clickhouse-release-1-1-54343-2018-02-05} - -- Dağıtılmış DDL sorgularında ve dağıtılmış tabloların oluşturucularında küme adlarını tanımlamak için makro desteği eklendi: `CREATE TABLE distr ON CLUSTER '{cluster}' (...) ENGINE = Distributed('{cluster}', 'db', 'table')`. -- Şimdi gibi sorgular `SELECT ... FROM table WHERE expr IN (subquery)` kullanılarak iş arelenir `table` dizin. -- Çoğaltılmış tablolara eklerken çoğaltmaların işlenmesi geliştirildi, böylece artık çoğaltma kuyruğunun yürütülmesini yavaşlatmazlar. - -### ClickHouse Sürümü 1.1.54342, 2018-01-22 {#clickhouse-release-1-1-54342-2018-01-22} - -Bu sürüm önceki sürüm 1.1.54337 için hata düzeltmeleri içerir: - -- 1.1.54337'de bir gerileme düzeltildi: varsayılan kullanıcı salt okunur erişime sahipse, sunucu mesajla başlamayı reddediyor `Cannot create database in readonly mode`. -- 1.1.54337 bir gerileme sabit: systemd ile sistemlerde, günlükleri her zaman ne olursa olsun yapılandırma syslog yazılır; watchdog komut dosyası hala init kullanır.d. -- Docker görüntüde yanlış varsayılan yapılandırma: 1.1.54337 bir gerileme düzeltildi. -- Graphıtemergetree sabit nondeterministic davranış (günlük mesajları görebilirsiniz `Data after merge is not byte-identical to the data on another replicas`). -- Çoğaltılmış tablolara sorguyu OPTİMİZE ettikten sonra tutarsız birleştirmelere yol açabilecek bir hata düzeltildi (günlük iletilerinde görebilirsiniz `Part ... intersects the previous part`). -- (ZHANG2014 tarafından) hedef tabloda MATERİALİZED sütunlar mevcut olduğunda arabellek tabloları şimdi düzgün çalışır. -- NULL uygulanmasında bir hata düzeltildi. - -### ClickHouse Sürümü 1.1.54337, 2018-01-18 {#clickhouse-release-1-1-54337-2018-01-18} - -#### Yenilik: {#new-features-17} - -- Çok boyutlu diziler ve tuples depolanması için destek eklendi (`Tuple` veri türü) tablolarda. -- Masa fonksiyonları için destek `DESCRIBE` ve `INSERT` sorgular. Alt sorgular için destek eklendi `DESCRIBE`. Örnekler: `DESC TABLE remote('host', default.hits)`; `DESC TABLE (SELECT 1)`; `INSERT INTO TABLE FUNCTION remote('host', default.hits)`. İçin destek `INSERT INTO TABLE` ayrıca `INSERT INTO`. -- Saat dilimleri için geliştirilmiş destek. Bu `DateTime` veri türü ayrıştırma ve metin biçimlerinde biçimlendirme için kullanılan saat dilimi ile açıklamalı. Örnek: `DateTime('Europe/Moscow')`. Zaman dilimleri için işlevlerde belirtildiğinde `DateTime` bağımsız değişkenler, dönüş türü saat dilimini izler ve değer beklendiği gibi görüntülenir. -- Fonksiyonları eklendi `toTimeZone`, `timeDiff`, `toQuarter`, `toRelativeQuarterNum`. Bu `toRelativeHour`/`Minute`/`Second` fonksiyonlar bir tür değeri alabilir `Date` bir argüman olarak. Bu `now` işlev adı büyük / küçük harf duyarlıdır. -- Add theed the `toStartOfFifteenMinutes` fonksiyon (Kirill Shvakov). -- Add theed the `clickhouse format` sorguları biçimlendirme aracı. -- Add theed the `format_schema_path` configuration parameter (Marek Vavruşa). It is used for specifying a schema in `Cap'n Proto` biçimli. Şema dosyaları yalnızca belirtilen dizinde bulunabilir. -- Yapılandırma değiştirmeleri için destek eklendi (`incl` ve `conf.d`) dış sözlüklerin ve modellerin konfigürasyonu için (Pavel Yakunin). -- İçin belgeler içeren bir sütun eklendi `system.settings` tablo (Kirill Shvakov). -- Add theed the `system.parts_columns` her veri bölümünde sütun boyutları hakkında bilgi içeren tablo `MergeTree` Tablolar. -- Add theed the `system.models` yüklenen hakkında bilgi içeren tablo `CatBoost` makine öğrenme modelleri. -- Add theed the `mysql` ve `odbc` tablo fonksiyonu ve karşılık gelen `MySQL` ve `ODBC` uzak veritabanlarına erişmek için tablo motorları. Bu işlevsellik beta aşamasındadır. -- Türünde bir argüman geçme imkanı eklendi `AggregateFunction` için `groupArray` toplama işlevi (böylece bazı toplama işlevinin bir dizi durumunu oluşturabilirsiniz). -- Agrega fonksiyon birleştiricilerinin çeşitli kombinasyonlarındaki kısıtlamalar kaldırıldı. Örneğin, kullanabilirsiniz `avgForEachIf` keza `avgIfForEach` farklı davranışlara sahip toplam fonksiyonlar. -- Bu `-ForEach` toplama işlevi Birleştiricisi, birden çok bağımsız değişkenin toplama işlevleri için genişletilir. -- Toplam fonksiyonları için destek eklendi `Nullable` işlevin bir non döndürdüğü durumlarda bile argümanlar-`Nullable` sonuç (Silviu Caragea'nın katkısıyla eklendi). Örnek: `groupArray`, `groupUniqArray`, `topK`. -- Add theed the `max_client_network_bandwidth` için `clickhouse-client` (Kirill Shvakov). -- İle kullanıcılar `readonly = 2` setting are allowed to work with TEMPORARY tables (CREATE, DROP, INSERT…) (Kirill Shvakov). -- İle birden fazla tüketici kullanmak için destek eklendi `Kafka` motor. İçin genişletilmiş yapılandırma seçenekleri `Kafka` (Marek Vavruša). -- Add theed the `intExp3` ve `intExp4` işlevler. -- Add theed the `sumKahan` toplama işlevi. -- To \* Number\* ornull işlevleri eklendi, burada \* Number \* sayısal bir türdür. -- İçin destek eklendi `WITH` CLA anus anes for an `INSERT SELECT` sorgu (yazar: zhang2014). -- Eklenen ayarlar: `http_connection_timeout`, `http_send_timeout`, `http_receive_timeout`. Özellikle, bu ayarlar çoğaltma için veri parçalarını indirmek için kullanılır. Bu ayarları değiştirmek, ağ aşırı yüklenmişse daha hızlı yük devretme olanağı sağlar. -- İçin destek eklendi `ALTER` tip tablolar için `Null` (Anastasiya Tsarkova). -- Bu `reinterpretAsString` işlev, bellekte bitişik olarak depolanan tüm veri türleri için genişletilir. -- Add theed the `--silent` seçeneği için `clickhouse-local` aracı. Bu stderr yazdırma sorgu yürütme bilgi bastırır. -- Tip değerlerini okumak için destek eklendi `Date` ay ve/veya Ayın gün iki basamak (Amos kuş) yerine tek bir basamak kullanılarak belirtilen bir biçimde metinden. - -#### Performans iyileştirmeleri: {#performance-optimizations} - -- Agrega fonksiyonlarının geliştirilmiş performansı `min`, `max`, `any`, `anyLast`, `anyHeavy`, `argMin`, `argMax` dize argümanlarından. -- Fonksiyonların geliştirilmiş performansı `isInfinite`, `isFinite`, `isNaN`, `roundToExp2`. -- Ayrıştırma ve biçimlendirmenin geliştirilmiş performansı `Date` ve `DateTime` değerleri metin biçiminde yazın. -- Kayan nokta sayılarının ayrıştırılmasında geliştirilmiş performans ve hassasiyet. -- İçin bellek kullanımını azalt fortı `JOIN` sol ve sağ parçaların, içinde bulunmayan aynı adlara sahip sütunlara sahip olması durumunda `USING` . -- Agrega fonksiyonlarının geliştirilmiş performansı `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr` hesaplama kararlılığını azaltarak. Eski fonksiyonlar isimler altında mevcuttur `varSampStable`, `varPopStable`, `stddevSampStable`, `stddevPopStable`, `covarSampStable`, `covarPopStable`, `corrStable`. - -#### Hata düzeltmeleri: {#bug-fixes-28} - -- Bir çalıştırdıktan sonra sabit veri tekilleştirme `DROP` veya `DETACH PARTITION` sorgu. Önceki sürümde, bir bölümü bırakmak ve aynı verileri tekrar eklemek işe yaramadı çünkü eklenen bloklar kopya olarak kabul edildi. -- Yanlış yorumlanmasına yol açabilecek bir hata düzeltildi `WHERE` için fık forra `CREATE MATERIALIZED VIEW` ile sorgular `POPULATE` . -- Kullanarak bir hata düzeltildi `root_path` param parametereter in the `zookeeper_servers` yapılandırma. -- Geçen sabit beklenmedik sonuçlar `Date` arg toum argumentent to `toStartOfDay` . -- Sabit `addMonths` ve `subtractMonths` fonksiyonlar ve aritmetik `INTERVAL n MONTH` sonuç bir önceki yıla sahip olduğu durumlarda. -- İçin eksik destek eklendi `UUID` için veri türü `DISTINCT` , `JOIN` , ve `uniq` agrega fonksiyonları ve dış sözlükler (Evgeniy Ivanov). İçin destek `UUID` hala eksik. -- Sabit `SummingMergeTree` satırların sıfıra toplandığı durumlarda davranış. -- İçin çeşitli düzeltmeler `Kafka` engine (Marek Vavruša). -- Sabit yanlış davranış `Join` masa motoru (Amos kuş). -- FreeBSD ve OS X altında yanlış ayırıcı davranışı düzeltildi. -- Bu `extractAll` fonksiyon artık boş eşleşmeleri destekliyor. -- Kullanımını engelleyen bir hata düzeltildi `libressl` yerine `openssl` . -- Sabit `CREATE TABLE AS SELECT` geçici tablolardan sorgu. -- Çoğaltma kuyruğunu güncelleme sabit olmayan atomicity. Bu, sunucu yeniden başlatılıncaya kadar eşlemelerin eşitlenmemesine neden olabilir. -- Sabit Olası taşma `gcd` , `lcm` ve `modulo` (`%` operatör) (Maks Skorokhod). -- `-preprocessed` dosyalar şimdi değiştirdikten sonra oluşturulur `umask` (`umask` config değişmiş) olabilir. -- Parçaların arka plan kontrol bir hata düzeltildi (`MergeTreePartChecker` ) özel bir bölüm anahtarı kullanırken. -- Tuples sabit ayrıştırma (değerleri `Tuple` veri türü) metin biçimlerinde. -- Uyumsuz türlerle ilgili geliştirilmiş hata mesajları `multiIf` , `array` ve diğer bazı fonksiyonlar. -- İçin yeniden tasarlanmış destek `Nullable` türler. Bir sunucu çökmesine yol açabilir sabit hatalar. İlgili hemen hemen tüm diğer hatalar düzeltildi `NULL` destek: INSERT SELECT yanlış tür dönüşümleri, sahip ve PREWHERE içinde Nullable için yetersiz destek, `join_use_nulls` mod, argümanlar olarak Nullable türleri `OR` operatör, vb. -- Veri türlerinin iç semantiği ile ilgili çeşitli hatalar düzeltildi. Örnekler: gereksiz toplama `Enum` type Fi fieldsel fieldsds in `SummingMergeTree` ; hizalama `Enum` yazmak `Pretty` format ,lar vb. -- Bileşik sütunların izin verilen kombinasyonları için daha sıkı kontroller. -- İçin çok büyük bir parametre belirlerken taşma düzeltildi `FixedString` veri türü. -- Bu bir hata düzeltildi `topK` genel bir durumda toplama işlevi. -- Toplam fonksiyonların n-ary varyantlarının argümanlarında dizi boyutlarının eşitliği için eksik kontrol eklendi `-Array` birleştirici. -- Bir hata düzeltildi `--pager` için `clickhouse-client` (yazar: ks1322). -- Sabit hassasiyet `exp10` işlev. -- Davranışı Düzelt theildi `visitParamExtract` belgelere daha iyi uyum için işlev. -- Yanlış veri türleri belirtildiğinde kilitlenme düzeltildi. -- Davranışı düzeltildi `DISTINCT` tüm sütunların sabitler olması durumunda. -- Kullanarak durumunda sabit sorgu biçimlendirme `tupleElement` tuple öğesi dizini olarak karmaşık bir sabit ifadeyle işlev. -- Bir hata düzeltildi `Dictionary` için tablolar `range_hashed` sözlükler. -- Sonucunda aşırı satırlara yol açan bir hata düzeltildi `FULL` ve `RIGHT JOIN` (Amos Kuşu). -- Geçici dosyaları oluştururken ve kaldırırken bir sunucu çökmesi düzeltildi `config.d` yapılandırma yeniden yükleme sırasında dizinler. -- Sabit `SYSTEM DROP DNS CACHE` sorgu: önbellek temizlendi, ancak küme düğümlerinin adresleri güncelleştirilmedi. -- Davranışı düzeltildi `MATERIALIZED VIEW` çalıştırdıktan sonra `DETACH TABLE` for the table under the view (Marek Vavruša). - -#### İyileştirmeler oluşturun: {#build-improvements-4} - -- Bu `pbuilder` aracı oluşturur için kullanılır. Yapı işlemi, yapı ana bilgisayarı ortamından neredeyse tamamen bağımsızdır. -- Farklı işletim sistemi sürümleri için tek bir yapı kullanılır. Paketler ve ikili Linux sistemleri geniş bir yelpazede ile uyumlu yapılmıştır. -- Add theed the `clickhouse-test` paket. Fonksiyonel testleri çalıştırmak için kullanılabilir. -- Kaynak tarball artık depoya yayınlanabilir. Github kullanmadan yapıyı yeniden oluşturmak için kullanılabilir. -- Travis CI ile sınırlı entegrasyon eklendi. Travis oluşturma süresi sınırları nedeniyle, yalnızca hata ayıklama yapı sınanır ve sınamaların sınırlı bir alt kümesi çalıştırılır. -- İçin destek eklendi `Cap'n'Proto` varsayılan yapı içinde. -- Dokümantasyon kaynaklarının biçimini değiştirdi `Restricted Text` -e doğru `Markdown`. -- İçin destek eklendi `systemd` (Vladimir Smirnov). Bazı işletim sistemi görüntüleri ile uyumsuzluk nedeniyle varsayılan olarak devre dışı bırakılır ve manuel olarak etkinleştirilebilir. -- Dinamik kod üretimi için, `clang` ve `lld` içine gömülü `clickhouse` ikilik. Olarak da çağr alsoıla invokedbilirler `clickhouse clang` ve `clickhouse lld` . -- GNU uzantılarının koddan kaldırılması. Etkin `-Wextra` seçenek. İle inşa ederken `clang` varsayılan değer `libc++` yerine `libstdc++`. -- Elde `clickhouse_parsers` ve `clickhouse_common_io` kütüphaneler hızlandırmak için çeşitli araçlar oluşturur. - -#### Geriye dönük uyumsuz değişiklikler: {#backward-incompatible-changes-11} - -- İşaret formatlerin biçimi `Log` içeren tabloları yazın `Nullable` sütunlar geriye dönük uyumsuz bir şekilde değiştirildi. Bu tablolar varsa, bunları dönüştürmek gerekir `TinyLog` yeni sunucu sürümünü başlatmadan önce yazın. Bunu yapmak için değiştirin `ENGINE = Log` ile `ENGINE = TinyLog` karşılık gelen `.sql` dosya içinde `metadata` dizin. Masanız yoksa `Nullable` sütun veya tablonuzun türü değilse `Log` o zaman hiçbir şey yapmanıza gerek yok. -- Kaldır theılan `experimental_allow_extended_storage_definition_syntax` ayar. Şimdi bu özellik varsayılan olarak etkindir. -- Bu `runningIncome` işlev olarak yeniden adlandırıldı `runningDifferenceStartingWithFirstvalue` karışıklığı önlemek için. -- Kaldır theılan `FROM ARRAY JOIN arr` array JOİN, tablo olmadan (Amos Bird) doğrudan FROM sonra belirtildiğinde sözdizimi. -- Kaldır theılan `BlockTabSeparated` sadece gösteri amaçlı kullanılan format. -- Toplu işlevler için durum biçimini değiştirdi `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Bu toplama işlevlerinin durumlarını tablolarda depoladıysanız ( `AggregateFunction` veri türü veya ilgili durumları ile hayata görünümleri), yazınız clickhouse-feedback@yandex-team.com. -- Önceki sunucu sürümlerinde belgelenmemiş bir özellik vardı: bir toplama işlevi parametrelere bağlıysa, yine de AggregateFunction veri türünde parametreler olmadan belirtebilirsiniz. Örnek: `AggregateFunction(quantiles, UInt64)` yerine `AggregateFunction(quantiles(0.5, 0.9), UInt64)`. Bu özellik kayboldu. Belgesiz olmasına rağmen, gelecek sürümlerde tekrar desteklemeyi planlıyoruz. -- Enum veri türleri min / max toplama işlevlerinde kullanılamaz. Bu yetenek bir sonraki sürümde iade edilecektir. - -#### Yükseltme yaparken lütfen unutmayın: {#please-note-when-upgrading} - -- Bir kümede, bazı yinelemelerin Clickhouse'un eski sürümünü çalıştırdığı ve bazılarının yeni sürümü çalıştırdığı noktada yuvarlanan bir güncelleme yaparken, çoğaltma geçici olarak durdurulur ve ileti `unknown parameter 'shard'` günlüğünde görünür. Kümenin tüm yinelemeleri güncelleştirildikten sonra çoğaltma devam eder. -- Clickhouse'un farklı sürümleri küme sunucularında çalışıyorsa, aşağıdaki işlevleri kullanarak dağıtılmış sorguların yanlış sonuçları olması olasıdır: `varSamp`, `varPop`, `stddevSamp`, `stddevPop`, `covarSamp`, `covarPop`, `corr`. Tüm küme düğümlerini güncelleştirmelisiniz. - -## [2017 için Changelog](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2017.md) {#changelog-for-2017} diff --git a/docs/tr/whats_new/changelog/2019.md b/docs/tr/whats_new/changelog/2019.md deleted file mode 100644 index 065cb822bc1..00000000000 --- a/docs/tr/whats_new/changelog/2019.md +++ /dev/null @@ -1,2074 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 77 -toc_title: '2019' ---- - -## ClickHouse sürüm v19. 17 {#clickhouse-release-v19-17} - -### ClickHouse sürümü v19.17.6. 36, 2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} - -#### Hata Düzeltme {#bug-fix} - -- Sıkıştırmada sabit potansiyel tampon taşması. Kötü niyetli kullanıcı, arabellekten sonra okunmasına neden olabilecek sıkıştırılmış verileri iletebilir. Bu sorun Yandex bilgi güvenliği ekibinden Eldar Zaitov tarafından bulundu. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit Olası sunucu çökmesi (`std::terminate`) sunucu, dize veri türü (UTF-8 doğrulaması gerektiren) değerleriyle json veya XML biçiminde veri gönderemez veya yazamaz veya sonuç verilerini Brotli algoritması ile sıkıştırırken veya diğer bazı nadir durumlarda. [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bir clickhouse kaynak ile sabit sözlükler `VIEW`, şimdi bu tür sözlükleri okumak hataya neden olmaz `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Bir istemci ana bilgisayar kullanıcıları belirtilen host\_regexp tarafından izin verilip verilmediğini kontrol sabit.xml. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- `RENAME TABLE` dağıtılmış bir tablo için artık parçalara göndermeden önce eklenen verileri içeren klasörü yeniden adlandırır. Bu, ardışık yeniden adlarla ilgili bir sorunu giderir `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- `range_hashed` DDL sorguları tarafından oluşturulan dış sözlükler artık rasgele sayısal tür aralıklarına izin verir. [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -- Sabit `INSERT INTO table SELECT ... FROM mysql(...)` tablo işlevi. [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- Sabit segfault içinde `INSERT INTO TABLE FUNCTION file()` mevcut olmayan bir dosyaya eklerken. Şimdi bu durumda dosya oluşturulur ve daha sonra insert işlenir. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- Birleştirilmiş bir bitmap ve bir skaler bitmap kesişen sabit bitmapAnd hatası. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -- Sabit segfault zaman `EXISTS` sorgu olmadan kullanıldı `TABLE` veya `DICTIONARY` niteleyici, tıpkı `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fonksiyonlar için sabit dönüş tipi `rand` ve `randConstant` geçersiz argüman durumunda. Şimdi fonksiyonlar her zaman geri döner `UInt32` ve asla `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Sabit `DROP DICTIONARY IF EXISTS db.dict`, şimdi Eğer istisna atmaz `db` yok. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- Sunucu çökmesi nedeniyle bir tablo tamamen düşmediyse, sunucu geri yüklemeyi ve yüklemeyi deneyecektir [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- İkiden fazla shard yerel tablo varsa, dağıtılmış bir tablo için önemsiz bir sayım sorgusu düzeltildi. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- DB::Blockstreamprofileınfo::calculateRowsBeforeLimit bir veri yarış yol Sabit hata() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -- Sabit `ALTER table MOVE part` belirtilen parçayı birleştirdikten hemen sonra yürütülür, bu da belirtilen parçanın birleştirildiği bir parçanın taşınmasına neden olabilir. Şimdi belirtilen kısmı doğru hareket ettirir. [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Sözlükler için ifadeler şimdi dizeler olarak belirtilebilir. Bu, ClickHouse olmayan kaynaklardan veri ayıklarken özniteliklerin hesaplanması için yararlıdır, çünkü bu ifadeler için ClickHouse olmayan sözdizimini kullanmanıza izin verir. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -- Çok nadir bir yarış sabit `clickhouse-copier` zxıd'de bir taşma nedeniyle. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- Sorgu başarısız olduktan sonra hata düzeltildi (nedeniyle “Too many simultaneous queries” örneğin) harici tablolar bilgisini okumaz ve - sonraki istek, bu bilgiyi bir sonraki sorgunun başlangıcı olarak yorumlayacak ve aşağıdaki gibi bir hataya neden olacaktır `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- Sonra null dereference kaçının “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- Tüm YBÜ yerel destek Geri Yükleme, sabit ifadeler için harmanlama uygulamak ve sisteme dil adı eklemek için yeteneği ekleyin.harmanlama tablosu. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -- Okuma için akış sayısı `StorageFile` ve `StorageHDFS` bellek sınırını aşmamak için artık sınırlıdır. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -- Sabit `CHECK TABLE` sorgu için `*MergeTree` anahtarsız tablolar. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -- Mutasyon olmaması durumunda bir parça adından mutasyon numarası kaldırıldı. Bu kaldırma eski sürümleri ile uyumluluk geliştirilmiş. [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -- Mutasyonlar nedeniyle data\_version bazı ekli parçalar için atlanır hata tablo mutasyon sürümü daha büyüktür düzeltildi. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) -- Başka bir cihaza taşıdıktan sonra yedek parça kopyalarıyla sunucuyu başlatmaya izin verin. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Hata düzeltildi “Sizes of columns doesn’t match” bu, toplama işlevi sütunlarını kullanırken görünebilir. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- Şimdi LİMİT BY yanında bağları ile kullanılması durumunda bir istisna atılır. Ve şimdi LİMİT ile üst kullanmak mümkündür. [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Varsa sözlük yeniden yükle `invalidate_query`, güncellemeleri durdurdu ve önceki güncelleme denemelerinde bazı istisnalar. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) - -### ClickHouse sürümü v19.17.4. 11, 2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change} - -- Daha iyi performans için skaler alt sorgu sonuçlarını depolamak için AST yerine sütun kullanma. Ayar `enable_scalar_subquery_optimization` 19.17'de eklendi ve varsayılan olarak etkinleştirildi. Gibi hat toalara yol açar [bu](https://github.com/ClickHouse/ClickHouse/issues/7851) önceki sürümlerden 19.17.2 veya 19.17.3'e yükseltme sırasında. Bu ayar, 19.17.4'te, 19.16 ve daha eski sürümlerden hatasız yükseltme yapılmasını sağlamak için varsayılan olarak devre dışı bırakıldı. [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([Amos Kuşu](https://github.com/amosbird)) - -#### Yenilik {#new-feature} - -- DDL sorguları ile sözlükler oluşturma yeteneği ekleyin. [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([alesapin](https://github.com/alesapin)) -- Yapmak `bloom_filter` endeks destek türü `LowCardinality` ve `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fonksiyon Ekle `isValidJSON` geçirilen dizenin geçerli bir json olduğunu kontrol etmek için. [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) -- Uygulamak `arrayCompact` işlev [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([Not](https://github.com/Joeywzr)) -- Oluşturulan işlev `hex` ondalık sayılar için. Gibi çalışır `hex(reinterpretAsString())`, ancak son sıfır bayt silmez. [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([Mikhail Korotov](https://github.com/millb)) -- Eklemek `arrayFill` ve `arrayReverseFill` dizideki ön / arka öğelerdeki diğer öğelerle öğeleri değiştiren işlevler. [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) -- Eklemek `CRC32IEEE()`/`CRC64()` destek [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) -- Uygulamak `char` fonksiyon birine benzer [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) -- Eklemek `bitmapTransform` işlev. Değerler bir dizi için bir bit eşlem değerler dizisi dönüştüren, sonuçta yeni bir bit eşlem [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([Zhichang Yu](https://github.com/yuzhichang)) -- Uyguluyordu `javaHashUTF16LE()` işlev [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) -- Eklemek `_shard_num` dağıtılmış motor için sanal sütun [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) - -#### Deneysel Özellik {#experimental-feature} - -- İşlemciler için destek (yeni sorgu yürütme boru hattı) `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Hata Düzeltme {#bug-fix-1} - -- Yanlış float ayrıştırma düzeltme `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- Trace\_log etkinleştirildiğinde oluşabilecek nadir kilitlenmeyi düzeltin. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- Kafka tablosu üretirken mesaj çoğaltmasını önle, ondan seçim yapan herhangi bir MVs var [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([I ivanvan](https://github.com/abyss7)) -- İçin destek `Array(LowCardinality(Nullable(String)))` içinde `IN`. Gideriyor [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) -- Add hand ofling of `SQL_TINYINT` ve `SQL_BIGINT`, ve düzeltme işleme `SQL_FLOAT` ODBC köprüsünde veri kaynağı türleri. [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Toplama düzeltme (`avg` ve quantiles) boş ondalık sütunlar üzerinde [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([Andrey Konyaev](https://github.com/akonyaev90)) -- Düzeltmek `INSERT` ile dağıtılan içine `MATERIALIZED` sütun [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Yapmak `MOVE PARTITION` bölümün bazı bölümleri zaten hedef disk veya birimde ise çalışın [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- İçinde mutasyonlar sırasında oluşturulacak başarısız hardlinks ile Sabit hata `ReplicatedMergeTree` çoklu disk yapılandırmalarında. [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Bütün parça değişmeden kalır ve en iyi alan başka bir diskte bulunurken bir MergeTree üzerinde bir mutasyon ile bir hata düzeltildi [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Sabit hata ile `keep_free_space_ratio` disk yapılandırmasından okunmuyor [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Tablo ile Fix hata sadece içerir `Tuple` karmaşık yolları olan sütunlar veya sütunlar. Düzeltiyor [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([alesapin](https://github.com/alesapin)) -- Bellek Max\_memory\_usage sınırında arabellek altyapısı için hesap değil [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) -- Son işaret kullanımını düzeltin `MergeTree` tarafından sipariş edilen tablolar `tuple()`. Nadir durumlarda yol açabilir `Can't adjust last granule` seçerken hata. [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([Anton Popov](https://github.com/CurtizJ)) -- Çökmelere veya garip istisnalara yol açabilecek bağlam gerektiren eylemlerle (örneğin json için işlevler) yüklü olan mutasyonlardaki hatayı düzeltin. [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([alesapin](https://github.com/alesapin)) -- Kaçan veritabanı ve tablo adlarının uyumsuzluğunu düzeltin `data/` ve `shadow/` dizinler [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. Bu durumda kazayı düzeltin. [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) -- Düzeltmek `Not found column in block` ifadeye doğru veya tam birleştirme ile katılırken. [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) -- Sonsuz döngüyü düzeltmek için bir girişim daha `PrettySpace` biçimli [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) -- Hatayı düzeltin `concat` tüm argümanlar olduğunda işlev `FixedString` aynı boyutta. [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([alesapin](https://github.com/alesapin)) -- S3, URL ve HDFS depolarını tanımlarken 1 argüman kullanılması durumunda sabit istisna. [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Sorgu ile görünümler için Interpretersselectquery'nin kapsamını düzeltin [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) - -#### Geliştirme {#improvement} - -- `Nullable` ODBC-bridge tarafından doğru işlenen sütunlar tanınan ve NULL değerleri [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- Atomically dağıtılmış göndermek için geçerli toplu yazma [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) -- Sorguda sütun adı için tablo algılayamazsak bir istisna atın. [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) -- Eklemek `merge_max_block_size` ayarı için `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) -- İle sorgular `HAVING` ve olmadan `GROUP BY` sabit olarak grup varsayalım. Böyle, `SELECT 1 HAVING 1` şimdi bir sonuç döndürür. [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([Amos Kuşu](https://github.com/amosbird)) -- Destek ayrıştırma `(X,)` python'a benzer tuple olarak. [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([Amos Kuşu](https://github.com/amosbird)) -- Yapmak `range` işlev davranışları neredeyse pythonic gibi. [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) -- Eklemek `constraints` tabloya sütunlar `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([Vitaly Baranov](https://github.com/vitlibar)) -- Tcp işleyicisi için daha iyi boş biçim, böylece kullanmak mümkün `select ignore() from table format Null` clickhouse-client ile perf ölçümü için [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([Amos Kuşu](https://github.com/amosbird)) -- Gibi sorgular `CREATE TABLE ... AS (SELECT (1, 2))` doğru ayrıştırılır [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) - -#### Performans İyileştirme {#performance-improvement} - -- Kısa dize anahtarları üzerinde toplama performansı artırıldı. [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [Amos Kuşu](https://github.com/amosbird)) -- Sabit yüklemler katlandıktan sonra olası optimizasyonları almak için sözdizimi/ifade analizinin başka bir geçişini çalıştırın. [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([Amos Kuşu](https://github.com/amosbird)) -- Önemsiz değerlendirmek için depolama meta bilgisi kullanın `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([Amos Kuşu](https://github.com/amosbird), [alexey-milovidov](https://github.com/alexey-milovidov)) -- Vectorize işleme `arrayReduce` toplayıcı benzer `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Kuşu](https://github.com/amosbird)) -- Performansında küçük iyileştirmeler `Kafka` tüketim [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([I ivanvan](https://github.com/abyss7)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement} - -- AARCH64 CPU mimarisine çapraz derleme için destek ekleyin. Refactor packager komut. [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([I ivanvan](https://github.com/abyss7)) -- Paketleri oluştururken darwin-x86\_64 ve linux-aarch64 araç zincirlerini monte edilmiş Docker hacmine açın [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([I ivanvan](https://github.com/abyss7)) -- İkili Paketleyici için Docker görüntüsünü güncelle [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([I ivanvan](https://github.com/abyss7)) -- MacOS Catalina'da sabit derleme hataları [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([Ernest Poletaev](https://github.com/ernestp)) -- Sorgu analizi mantığında bazı yeniden düzenleme: karmaşık sınıfı birkaç basit sınıfa ayırın. [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) -- Submodules olmadan yapı düzeltme [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) -- İyileştirmek `add_globs` cmake dosyalarında [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([Amos Kuşu](https://github.com/amosbird)) -- Kodlanmış yolları Kaldır `unwind` hedef [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) -- Ssl olmadan mysql formatını kullanmasına izin ver [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) - -#### Diğer {#other} - -- ClickHouse SQL lehçesi için ANTLR4 dilbilgisi eklendi [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouse sürüm v19. 16 {#clickhouse-release-v19-16} - -#### ClickHouse yayın v19. 16. 14. 65, 2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} - -- Birden argümanlar (10'dan fazla) üçlü mantıksal OPs toplu hesaplamalarda bir hata düzeltildi. [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) Bu hata düzeltme Altınity özel bir istek ile sürüm 19.16 backported edildi. - -#### ClickHouse yayın v19. 16. 14. 65, 2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} - -- Dağıtılmış alt sorgular uyumsuzluğunu eski CH sürümleriyle düzeltin. Düzeltiyor [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) - [(tabplubix)](https://github.com/tavplubix) -- Yürüt whenürken `CREATE` sorgu, depolama motoru argümanlarında sabit ifadeleri katlayın. Boş veritabanı adı geçerli veritabanı ile değiştirin. Düzeltiyor [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Ayrıca yerel adresi kontrol edin `ClickHouseDictionarySource`. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Şimdi arka plan birleşir `*MergeTree` tablo motorları ailesi depolama ilkesi hacim sırasını daha doğru bir şekilde korur. - [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Veri kaybını önlemek `Kafka` nadir durumlarda istisna sonek okuduktan sonra ancak taahhütten önce gerçekleşir. Düzeltiyor [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). İlgili: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -- Kullanmaya / bırakmaya çalışırken sunucu sonlandırmasına giden hatayı düzeltin `Kafka` tablo yanlış parametrelerle oluşturuldu. Düzeltiyor [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Birleşiyor [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) -- Kullanmaya izin ver `MaterializedView` yukarıdaki alt sorgularla `Kafka` Tablolar. - [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) - -#### Yenilik {#new-feature-1} - -- Eklemek `deduplicate_blocks_in_dependent_materialized_views` hayata manzaralı tablolara idempotent ekler davranışlarını kontrol etmek için Seçenek. Bu yeni özellik, altınity'den özel bir istek ile bugfix sürümüne eklendi. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### ClickHouse sürümü v19.16.2. 2, 2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-1} - -- Count/counİf için eksik arity doğrulama ekleyin. - [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) - [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) -- Eski Kaldır `asterisk_left_columns_only` ayar (varsayılan olarak devre dışıdır). - [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([Artem - Zuikov](https://github.com/4ertus2)) -- Şablon veri biçimi için Biçim dizeleri artık dosyalarda belirtilmiştir. - [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) - -#### Yenilik {#new-feature-2} - -- Uint\_max büyük önemlilik hesaplamak için uniqcombined64() tanıtmak. - [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), - [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat - Khuzhin](https://github.com/azat)) -- Dizi sütunlarında Bloom filtre indekslerini destekleyin. - [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) - ([achimbab](https://github.com/achimbab)) -- Bir işlev Ekle `getMacro(name)` bu karşılık gelen değeri ile dize döndürür `` - sunucu yapılandırmasından. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bir HTTP kaynağına dayalı bir sözlük için iki yapılandırma seçeneği belirleyin: `credentials` ve - `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- Yeni bir ProfileEvent Ekle `Merge` bu, başlatılan arka plan birleşimlerinin sayısını sayar. - [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([Mikhail - Korotov](https://github.com/millb)) -- Tam etki alanı adı döndüren fullHostName işlevi ekleyin. - [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) - [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) -- Fonksiyon Ekle `arraySplit` ve `arrayReverseSplit` bir diz byiyi böl anen “cut off” - şartlar. Zaman dizisinin işlenmesinde kullanışlıdırlar. - [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) -- Multimatch işlev ailesine eşleşen tüm dizinlerin dizisini döndüren yeni işlevler ekleyin. - [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila. - Kutenin](https://github.com/danlark1)) -- Yeni bir veritabanı altyapısı Ekle `Lazy` bu, çok sayıda küçük günlük depolamak için optimize edilmiştir - Tablolar. [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([Nikita - Vasilev](https://github.com/nikvas0)) -- Bitmap sütunları için groupBitmapAnd, - veya-Xor toplam işlevleri ekleyin. [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([Zhichang - Yu](https://github.com/yuzhichang)) -- Null döndüren toplam işlev birleştiricileri-OrNull ve-OrDefault ekleyin - veya toplamak için hiçbir şey olmadığında varsayılan değerler. - [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) - ([hcz](https://github.com/hczhcz)) -- Özel kaçan destekleyen CustomSeparated veri biçimini tanıtmak ve - sınırlayıcı kuralları. [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) -- Destek Redis harici sözlük kaynağı olarak. [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [Anton - Popov](https://github.com/CurtizJ)) - -#### Hata Düzeltme {#bug-fix-2} - -- Varsa yanlış sorgu sonucunu düzeltin `WHERE IN (SELECT ...)` bölüm ve `optimize_read_in_order` oluyor - kullanılmış. [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([Anton - Popov](https://github.com/CurtizJ)) -- Proje dışındaki dosyalara bağlı olarak engelli MariaDB kimlik doğrulama eklentisi. - [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([Yuriy - Baranov](https://github.com/yurriy)) -- İstisnayı düzeltin `Cannot convert column ... because it is constant but values of constants are different in source and result` fonksiyonlar olduğunda nadiren olabilir `now()`, `today()`, - `yesterday()`, `randConstant()` kullanılır. - [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([Nikolay - Kochetov](https://github.com/KochetovNicolai)) -- TCP yerine HTTP keep alive timeout kullanarak sabit sorunu alive timeout tutun. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily - Nemkov](https://github.com/Enmk)) -- Groupbitmapor'da bir segmentasyon hatası düzeltildi (sorun [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). - [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([Zhichang - Yu](https://github.com/yuzhichang)) -- Materyalize edilmiş görünümler için, tüm veriler yazıldıktan sonra Kafka için taahhüt denir. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([I ivanvan](https://github.com/abyss7)) -- Sabit yanlış `duration_ms` değer içinde `system.part_log` Tablo. On kez kapalıydı. - [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Canlı Görünüm tablosundaki çökmeyi çözmek ve tüm Canlı Görünüm testlerini yeniden etkinleştirmek için hızlı bir düzeltme. - [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) - ([vzakaznikov](https://github.com/vzakaznikov)) -- MERGETREE parçalarının min/max dizinlerinde NULL değerleri doğru şekilde seri hale getirin. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([İskender - Kuzmenkov](https://github.com/akuzm)) -- Sanal sütunları koymayın .tablo olarak oluşturulduğunda sql meta verileri `CREATE TABLE AS`. - [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([I ivanvan](https://github.com/abyss7)) -- Segmentasyon hatasını düzeltin `ATTACH PART` sorgu. - [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) - ([alesapin](https://github.com/alesapin)) -- Alt sorgularda boş ve boş optimizasyonu ile verilen bazı sorgular için yanlış sonucu düzeltin - INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([Nikolay - Kochetov](https://github.com/KochetovNicolai)) -- Live VİEW getHeader() yönteminde AddressSanitizer hatası düzeltildi. - [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) - ([vzakaznikov](https://github.com/vzakaznikov)) - -#### Geliştirme {#improvement-1} - -- Queue\_wait\_max\_ms bekleme durumunda bir ileti ekleme gerçekleşir. - [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat - Khuzhin](https://github.com/azat)) -- Yapılan ayar `s3_min_upload_part_size` masa seviyesi. - [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- STORAGEFACTORY TTL kontrol edin. [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) - ([sundyli](https://github.com/sundy-li)) -- Kısmi birleştirme birleşiminde Squash sol blokları (optimizasyon). - [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([Artem - Zuikov](https://github.com/4ertus2)) -- Çoğaltılmış tablo motorlarının mutasyonlarında deterministik olmayan işlevlere izin vermeyin, çünkü bu - kopyaları arasındaki tutarsızlıkları tanıtabilir. - [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([İskender - Kazakov](https://github.com/Akazz)) -- Özel durum yığını izini dizeye dönüştürürken bellek izleyicisini devre dışı bırakın. Bu kaybı önleyebilir - Tür hata mesaj oflarının `Memory limit exceeded` neden olan sunucuda `Attempt to read after eof` istemci üzerinde istisna. [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) - ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Çeşitli biçim geliştirmeleri. Gideriyor - [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), - [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), - [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), - [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) - [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) - ([tavplubix](https://github.com/tavplubix)) -- ClickHouse sola dönüştürülebilir olmayan In işlecinin sağ tarafındaki değerleri yok sayar - side type. Make it work properly for compound types – Array and Tuple. - [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([İskender - Kuzmenkov](https://github.com/akuzm)) -- ASOF JOİN için eksik eşitsizlikleri destekleyin. Daha az veya eşit varyant ve katı katılmak mümkündür - sözdiziminde asof sütunu için daha büyük ve daha az varyant. - [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([Artem - Zuikov](https://github.com/4ertus2)) -- Kısmi birleştirme birleşimini Optimize edin. [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) - ([Artem Zuikov](https://github.com/4ertus2)) -- UNİQCOMBİNED işlevlerinde 98 k'dan fazla bellek kullanmayın. - [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), - [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat - Khuzhin](https://github.com/azat)) -- Partialmergejoin diskteki sağ birleştirme tablosunun parçalarını yıkayın (yeterli değilse - bellek). Gerektiğinde verileri geri yükleyin. [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) - ([Artem Zuikov](https://github.com/4ertus2)) - -#### Performans İyileştirme {#performance-improvement-1} - -- Veri çoğaltma kaçınarak const argümanları ile joinget hızlandırın. - [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([Amos - Kuş](https://github.com/amosbird)) -- Alt sorgu boşsa erken dönün. - [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) -- Değerlerdeki SQL ifadesinin ayrıştırılmasını Optimize edin. - [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) - ([tavplubix](https://github.com/tavplubix)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-1} - -- Mac OS için çapraz derleme için bazı katkılar devre dışı bırakın. - [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([I ivanvan](https://github.com/abyss7)) -- Clickhouse\_common\_ıo için pocoxml ile eksik bağlantı ekleyin. - [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat - Khuzhin](https://github.com/azat)) -- Clickhouse-test'te birden fazla test filtresi argümanını kabul edin. - [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([İskender - Kuzmenkov](https://github.com/akuzm)) -- Kol için musl ve jemalloc'u etkinleştirin. [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) - ([Amos Kuşu](https://github.com/amosbird)) -- Katma `--client-option` parametre için `clickhouse-test` müşteriye ek parametreler aktarmak için. - [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([Nikolay - Kochetov](https://github.com/KochetovNicolai)) -- Rpm paket yükseltmesinde mevcut yapılandırmaları koruyun. - [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) - ([filimonov](https://github.com/filimonov)) -- PVS tarafından tespit edilen hataları düzeltin. [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([Artem - Zuikov](https://github.com/4ertus2)) -- Darwin için yapı düzeltin. [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) - ([I ivanvan](https://github.com/abyss7)) -- glibc 2.29 uyumluluk. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([Amos - Kuş](https://github.com/amosbird)) -- Dh\_clean potansiyel kaynak dosyaları dokunmaz emin olun. - [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([Amos - Kuş](https://github.com/amosbird)) -- Altınity rpm'den güncellerken çakışmayı önlemeye çalışın-ayrı olarak paketlenmiş yapılandırma dosyası vardır - clickhouse-sunucu-ortak. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) - ([filimonov](https://github.com/filimonov)) -- Daha hızlı yeniden oluşturmak için bazı başlık dosyalarını Optimize edin. - [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), - [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([İskender - Kuzmenkov](https://github.com/akuzm)) -- Tarih ve DateTime için performans testleri ekleyin. [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([Vasily - Nemkov](https://github.com/Enmk)) -- Deterministik olmayan mutasyonlar içeren bazı testleri düzeltin. - [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([İskender - Kazakov](https://github.com/Akazz)) -- MemorySanitizer ile CI için yapı ekleyin. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) - ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Metricstransmitter başlatılmamış değerleri kullanmaktan kaçının. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat - Khuzhin](https://github.com/azat)) -- MemorySanitizer tarafından bulunan alanlarda bazı sorunları düzeltin. - [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), - [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([İskender - Kuzmenkov](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) - ([Amos Kuşu](https://github.com/amosbird)) -- Murmurhash32'de tanımsız davranışı düzeltin. [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([Amos - Kuş](https://github.com/amosbird)) -- Storagesınfostream tanımsız davranışı düzeltin. [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) - ([tavplubix](https://github.com/tavplubix)) -- Harici veritabanı motorları (MySQL, ODBC, JDBC) için katlama sabit sabit ifadeler. Önceki - sürümler birden fazla sabit ifade için çalışmadı ve Tarih için hiç çalışmadı, - DateTime ve UUID. Bu düzeltmeler [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- No\_users\_thread değişkenine erişirken canlı görünümde ThreadSanitizer veri yarışı hatası düzeltildi. - [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) - ([vzakaznikov](https://github.com/vzakaznikov)) -- Libcommon'daki malloc sembollerinden kurtulun - [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), - [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([Amos - Kuş](https://github.com/amosbird)) -- Tüm kitaplıkları devre dışı bırakmak için genel bayrak ENABLE\_LİBRARİES ekleyin. - [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) - ([proller](https://github.com/proller)) - -#### Kod temizleme {#code-cleanup} - -- Sözlükler için DDL'YE hazırlanmak için yapılandırma deposunu genelleştirin. [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) - ([alesapin](https://github.com/alesapin)) -- Herhangi bir anlamsal olmadan sözlükler DDL için ayrıştırıcı. - [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) - ([alesapin](https://github.com/alesapin)) -- Bölünmüş ParserCreateQuery farklı küçük ayrıştırıcılar içine. - [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) - ([alesapin](https://github.com/alesapin)) -- Küçük refactoring ve dış sözlükler yakın yeniden adlandırma. - [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) - ([alesapin](https://github.com/alesapin)) -- Refactor bazı kod rol tabanlı erişim kontrolü için hazırlamak. [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([Vitaly. - Baranov](https://github.com/vitlibar)) -- Veritabanında bazı geliştirmelersıradan kod. - [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([Nikita - Vasilev](https://github.com/nikvas0)) -- Karma tabloların find() ve emplace() yöntemlerinde yineleyiciler kullanmayın. - [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([İskender - Kuzmenkov](https://github.com/akuzm)) -- Parametre kökü boş olmadığında getmultiplevaluesfromconfig'i düzeltin. [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) - ([Mikhail Korotov](https://github.com/millb)) -- Bazı kopyala yapıştır (TemporaryFile ve TemporaryFileStream) kaldırın) - [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([Artem - Zuikov](https://github.com/4ertus2)) -- Geliştirilmiş kod okunabilirliği biraz (`MergeTreeData::getActiveContainingPart`). - [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([Vladimir - Chebotarev](https://github.com/excitoon)) -- Yerel nesneler kullanan tüm zamanlanmış işleri bekleyin, eğer `ThreadPool::schedule(...)` atmalar - özel. Adlandırmak `ThreadPool::schedule(...)` -e doğru `ThreadPool::scheduleOrThrowOnError(...)` ve - atabileceği açık hale getirmek için yorumları düzeltin. - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) - ([tavplubix](https://github.com/tavplubix)) - -## ClickHouse sürümü 19.15 {#clickhouse-release-19-15} - -### ClickHouse sürümü 19.15.4.10, 2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} - -#### Hata Düzeltme {#bug-fix-3} - -- SQL\_TINYINT ve SQL\_BIGINT işleme eklendi ve ODBC Köprüsü SQL\_FLOAT veri kaynağı türlerinin işlenmesini düzeltin. - [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- Taşıma bölümünde hedef disk veya birim üzerinde bazı parçaların olmasına izin verilir. - [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- ODBC köprüsü aracılığıyla null sütunlarda sabit NULL değerleri. - [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([Vasily Nemkov](https://github.com/Enmk)) -- SOMUTLAŞTIRILMIŞ sütunlarla dağıtılmış yerel olmayan düğüme sabit ekleme. - [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- Sabit fonksiyon getMultipleValuesFromConfig. - [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([Mikhail Korotov](https://github.com/millb)) -- TCP yerine HTTP keep alive timeout kullanarak sabit sorunu alive timeout tutun. - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([Vasily Nemkov](https://github.com/Enmk)) -- Tüm işlerin istisnada bitmesini bekleyin (nadir segfault'ları düzeltir). - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) -- Kafka tabloya eklerken MVs için itmeyin. - [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([I ivanvan](https://github.com/abyss7)) -- İstisna yığını için bellek izleyicisini devre dışı bırakın. - [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Harici veritabanı için sorgu dönüştürme sabit kötü kod. - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Metricstransmitter başlatılmamış değerleri kullanmaktan kaçının. - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) -- Testler için makrolarla örnek yapılandırma eklendi ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.15.3.6, 2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} - -#### Hata Düzeltme {#bug-fix-4} - -- Karma sözlükte sabit bad\_variant. - ([alesapin](https://github.com/alesapin)) -- Bölüm sorgu Ekle segmentasyon hatası ile hata düzeltildi. - ([alesapin](https://github.com/alesapin)) -- Sabit zaman hesaplama `MergeTreeData`. - ([Vladimir Chebotarev](https://github.com/excitoon)) -- Yazma tamamlandıktan sonra açıkça Kafka'ya taahhüt edin. - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([I ivanvan](https://github.com/abyss7)) -- MERGETREE parçalarının min/max dizinlerinde NULL değerleri doğru şekilde seri hale getirin. - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -### ClickHouse sürümü 19.15.2.2, 2019-10-01 {#clickhouse-release-19-15-2-2-2019-10-01} - -#### Yenilik {#new-feature-3} - -- Katmanlı depolama: MergeTree motoru ile tablolar için birden fazla depolama birimleri kullanmak için destek. Yeni verileri SSD'DE saklamak ve eski verileri otomatik olarak HDD'ye taşımak mümkündür. ([örnek](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([alesapin](https://github.com/alesapin)) -- Tablo fonksiyonu Ekle `input` gelen verileri okumak için `INSERT SELECT` sorgu. [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([Anton Popov](https://github.com/CurtizJ)) -- Add a `sparse_hashed` sözlük düzeni, bu işlevsel olarak eşdeğerdir `hashed` düzen, ancak daha fazla bellek verimli. Daha yavaş değer alma pahasına yaklaşık iki kat daha az bellek kullanır. [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) -- Sözlüklere erişim için kullanıcıların listesini tanımlama yeteneğini uygular. Sadece geçerli bağlı veritabanı kullanarak. [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Eklemek `LIMIT` seçeneği `SHOW` sorgu. [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- Eklemek `bitmapSubsetLimit(bitmap, range_start, limit)` en küçük alt kümesini döndüren işlev `limit` küm valuesedeki değer smallerlerden daha küçük olmayan değerler `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang)) -- Eklemek `bitmapMin` ve `bitmapMax` işlevler. [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang)) -- Fonksiyon Ekle `repeat` ile ilgili [sayı-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL)) - -#### Deneysel Özellik {#experimental-feature-1} - -- Geçerli boru hattını değiştirmeyen birleştirme birleştirme varyantını (bellekte) uygulayın. Sonuç kısmen birleştirme anahtarına göre sıralanır. Koymak `partial_merge_join = 1` bu özelliği kullanmak için. Birleştirme birleştirme hala geliştirme aşamasındadır. [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) -- Eklemek `S3` motor ve masa fonksiyonu. Hala geliştirme aşamasında (henüz kimlik doğrulama desteği yok). [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) - -#### Geliştirme {#improvement-2} - -- Kafka'dan okunan her mesaj atomik olarak eklenir. Bu, Kafka engine ile bilinen hemen hemen tüm sorunları çözer. [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([I ivanvan](https://github.com/abyss7)) -- Dağıtılmış sorguların yerine çalışma için iyileştirmeler. Kurtarma süresini kısaltın, ayrıca şimdi yapılandırılabilir ve görülebilir `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([Vasily Nemkov](https://github.com/Enmk)) -- Doğrudan Enums için sayısal değerleri destekleyin `IN` bölme. \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) -- Destek (isteğe bağlı, varsayılan olarak devre dışı) URL depolama yönlendirir. [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([makroll](https://github.com/maqroll)) -- Eski bir sürümü olan istemci bir sunucuya bağlandığında bilgi iletisi ekleyin. [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- Dağıtılmış tablolarda veri göndermek için maksimum geri dönüş uyku süresi sınırını kaldırın [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) -- Grafit kümülatif değerleri ile profil olayları (sayaçlar) göndermek için yeteneği ekleyin. Altında etkinleştir canilebilir `` server inda `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) -- Otomatik döküm türü Ekle `T` -e doğru `LowCardinality(T)` veri türü sütununa eklerken `LowCardinality(T)` HTTP üzerinden yerel formatta. [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fonksiyonu kullanma yeteneği ekleyin `hex` kullanmadan `reinterpretAsString` için `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([Mikhail Korotov](https://github.com/millb)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-2} - -- Hata ayıklama bilgisi ile clickhouse ikili için gdb-ındex ekleyin. Bu başlangıç süresini hızlandıracaktır `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([alesapin](https://github.com/alesapin)) -- Kullanan yamalı dpkg-deb ile deb ambalajını hızlandırın `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([alesapin](https://github.com/alesapin)) -- Koymak `enable_fuzzing = 1` tüm proje kodu libfuzzer enstrümantasyon etkinleştirmek için. [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) -- CI bölünmüş yapı duman testi ekleyin. [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([alesapin](https://github.com/alesapin)) -- MemorySanitizer ile CI için yapı ekleyin. [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Değişmek `libsparsehash` ile `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) - -#### Hata Düzeltme {#bug-fix-5} - -- Büyük tablolarda karmaşık anahtarlar üzerinde endeks analizi sabit performans düşüşü. Bu düzeltmeler \# 6924. [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kafka boş konudan seçerken segfaults'a neden olan mantıksal hatayı düzeltin. [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([I ivanvan](https://github.com/abyss7)) -- Çok erken MySQL bağlantısını düzeltin `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Çok eski Linux çekirdekleri için geri destek (düzeltme [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Olası veri kaybını düzeltin `insert select` giriş akışında boş blok durumunda sorgu. \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fonksiyon için düzeltme `АrrayEnumerateUniqRanked` params boş diziler ile [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- Dizi birleşimleri ve genel alt sorgularla karmaşık sorguları düzeltin. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([I ivanvan](https://github.com/abyss7)) -- Düzeltmek `Unknown identifier` birden fazla birleşim ile ORDER BY ve GROUP BY hatası [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) -- Sabit `MSan` fonksiyonu çalıştırırken uyarı `LowCardinality` değişken. [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-2} - -- Bitmap'in seri hale getirme biçimi değiştirildi \* performansı artırmak için toplama işlevi durumları. Önceki sürümlerden bitmap\* seri hale getirilmiş durumları okunamıyor. [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([Zhichang Yu](https://github.com/yuzhichang)) - -## ClickHouse sürümü 19.14 {#clickhouse-release-19-14} - -### ClickHouse sürümü 19.14.7.15, 2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} - -#### Hata Düzeltme {#bug-fix-6} - -- Bu sürüm aynı zamanda 19.11.12.69 tüm hata düzeltmeleri içerir. -- 19.14 ve önceki sürümleri arasında dağıtılmış sorgular için sabit uyumluluk. Bu düzeltmeler [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.14.6.12, 2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} - -#### Hata Düzeltme {#bug-fix-7} - -- Fonksiyon için düzeltme `АrrayEnumerateUniqRanked` params boş diziler ile. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- Sorgularda sabit alt sorgu adı `ARRAY JOIN` ve `GLOBAL IN subquery` takma ad ile. Belirtilirse, dış tablo adı için alt sorgu takma adını kullanın. [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([I ivanvan](https://github.com/abyss7)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-3} - -- Düzeltmek [çırpan](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) test `00715_fetch_merged_or_mutated_part_zookeeper` mutasyonların uygulanmasını beklemek zorunda olduğu için bir kabuk komut dosyasına yeniden yazarak. [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([Alexander Kazakov](https://github.com/Akazz)) -- Fonksiyon sabit UBSan ve MemSan hatası `groupUniqArray` emtpy dizi argümanı ile. Bu boş yerleştirerek neden oldu `PaddedPODArray` sıfır hücre değeri için yapıcı çağrılmadığı için karma tabloya sıfır hücre. [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([Amos Kuşu](https://github.com/amosbird)) - -### ClickHouse sürümü 19.14.3.3, 2019-09-10 {#clickhouse-release-19-14-3-3-2019-09-10} - -#### Yenilik {#new-feature-4} - -- `WITH FILL` değiştirici için `ORDER BY`. (devam [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- `WITH TIES` değiştirici için `LIMIT`. (devam [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([Anton Popov](https://github.com/CurtizJ)) -- Ayrıştırılmamış `NULL` NULL olarak değişmez (eğer ayar `format_csv_unquoted_null_literal_as_null=1`). Bu alanın veri türü null değilse, null alanları varsayılan değerlerle başlatın (eğer ayar `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) -- Tablo işlevlerinin yollarındaki joker karakterler için destek `file` ve `hdfs`. Yol joker karakterler içeriyorsa, tablo salt okunur olacaktır. Kullanım örneği: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` ve `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) -- Yeni `system.metric_log` değerleri depo tablelayan tablo `system.events` ve `system.metrics` belirtilen zaman aralığı ile. [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse metin günlükleri yazmak için izin ver `system.text_log` Tablo. [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yığın izlerinde özel sembolleri göster (bu, elf dosyalarının sembol tablolarını ayrıştırma yoluyla yapılır). Hata ayıklama bilgisi varsa yığın izlerinde dosya ve satır numarası hakkında bilgi eklendi. Programda mevcut indeksleme sembolleri ile Speedup sembol adı arama. İç gözlem için yeni SQL işlevleri eklendi: `demangle` ve `addressToLine`. Yeniden adlandırılan işlev `symbolizeAddress` -e doğru `addressToSymbol` tutarlılık için. İşlev `addressToSymbol` performans nedenleriyle karıştırılmış adını döndürür ve uygulamak zorunda `demangle`. Ayar eklendi `allow_introspection_functions` varsayılan olarak kapalı olan. [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tablo fonksiyonu `values` (adı büyük / küçük harf duyarsız). Bu okumak için izin verir `VALUES` önerilen liste [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). Örnek: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) -- Depolama ayarlarını değiştirmek için bir yetenek eklendi. Sözdizimi: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([alesapin](https://github.com/alesapin)) -- Müstakil parçaların çıkarılması için destek. Sözdizimi: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) -- Tablo kısıtlamaları. Ekleme sırasında kontrol edilecek tablo tanımına kısıtlama eklemenize izin verir. [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([Gleb Novikov](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Basamaklı hayata görünümler için Suppport. [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([Amos Kuşu](https://github.com/amosbird)) -- Her sorgu yürütme iş parçacığı saniyede bir örnek için varsayılan olarak sorgu profiler'ı açın. [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Giriş biçimi `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) -- İki yeni fonksiyon eklendi: `sigmoid` ve `tanh` (bu makine öğrenme uygulamaları için yararlıdır). [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İşlev `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` verilen jetonun samanlıkta olup olmadığını kontrol etmek için. Token, iki alfasayısal olmayan ASCII karakteri (veya samanlığın sınırları) arasında maksimum uzunlukta bir alt dizedir. Token sabit bir dize olmalıdır. Tokenbf\_v1 Endeksi uzmanlaşma tarafından desteklenmektedir. [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([Vasily Nemkov](https://github.com/Enmk)) -- Yeni fonksiyon `neighbor(value, offset[, default_value])`. Bir veri bloğunda sütun içindeki önceki / sonraki değere ulaşmayı sağlar. [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) -- Bir işlev oluşturuldu `currentUser()`, yetkili kullanıcının giriş dönen. Add aliased al aliasias `user()` MySQL ile uyumluluk için. [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) -- Yeni toplama fonksiyonları `quantilesExactInclusive` ve `quantilesExactExclusive` hangi teklif edildi [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) -- İşlev `bitmapRange(bitmap, range_begin, range_end)` hangi döner yeni set ile belirtilen aralığı (dahil değil `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([Zhichang Yu](https://github.com/yuzhichang)) -- İşlev `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` hangi verilen alanı kapsayan geohash-kutuları hassas uzun dizeleri dizisi oluşturur. [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([Vasily Nemkov](https://github.com/Enmk)) -- INSERT query ile destek uygulamak `Kafka` Tablolar. [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([I ivanvan](https://github.com/abyss7)) -- İçin destek eklendi `_partition` ve `_timestamp` Kafka motoruna sanal sütunlar. [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([I ivanvan](https://github.com/abyss7)) -- Hassas verileri kaldırma imkanı `query_log`, sunucu günlükleri, regexp tabanlı kurallar ile işlem listesi. [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) - -#### Deneysel Özellik {#experimental-feature-2} - -- Giriş ve çıkış Veri formatı `Template`. Bu giriş ve çıkış için özel biçim dizesi belirtmek için izin verir. [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) -- Uygulanması `LIVE VIEW` başlangıçta önerilen tablolar [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898) hazırlıklı olarak [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925), ve daha sonra güncellendi [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). Görmek [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) detaylı açıklama için. [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov) Not bu `LIVE VIEW` özellik sonraki sürümlerinde kaldırılabilir. - -#### Hata Düzeltme {#bug-fix-8} - -- Bu sürüm aynı zamanda 19.13 ve 19.11 tüm hata düzeltmeleri içerir. -- Tablo atlama endeksleri ve dikey birleştirme gerçekleştiğinde segmentasyon hatasını düzeltin. [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([alesapin](https://github.com/alesapin)) -- Önemsiz olmayan sütun varsayılanlarıyla sütun başına TTL'Yİ düzeltin. Daha önce kuvvet durumunda `OPTIMIZE ... FINAL` sorgu, süresi dolmuş değerler, kullanıcı tarafından belirtilen sütun varsayılanları yerine tür varsayılanları ile değiştirildi. [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([Anton Popov](https://github.com/CurtizJ)) -- Normal sunucu yeniden başlatmada Kafka mesajları çoğaltma sorununu düzeltin. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([I ivanvan](https://github.com/abyss7)) -- Kafka mesajlarını okurken sabit sonsuz döngü. Tüketiciyi abonelikte hiç duraklatmayın/devam ettirmeyin - aksi takdirde bazı senaryolarda süresiz olarak duraklatılabilir. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([I ivanvan](https://github.com/abyss7)) -- Düzeltmek `Key expression contains comparison between inconvertible types` istisna içinde `bitmapContains` işlev. [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) -- Etkin olan segfault'u düzeltin `optimize_skip_unused_shards` ve kayıp sharding anahtarı. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([Anton Popov](https://github.com/CurtizJ)) -- Bellek bozulmasına yol açabilecek mutasyonlarda yanlış kod düzeltildi. Adresin okunması ile sabit segfault `0x14c0` bu eşzamanlı nedeniyle happed olabilir `DROP TABLE` ve `SELECT` itibaren `system.parts` veya `system.parts_columns`. Mutasyon sorgularının hazırlanmasında sabit yarış durumu. Sabit kilitlenme neden `OPTIMIZE` çoğaltılmış tablolar ve değiştirir gibi eşzamanlı değişiklik işlemleri. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MySQL arayüzü kaldırıldı ekstra ayrıntılı günlüğü [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Boolean ayarlarını ayrıştırma yeteneğini döndürür ‘true’ ve ‘false’ yapılandırma dosyasında. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- Çökmeyi düzeltin `quantile` ve `median` fonksiyonu üzerinde `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) -- Tarafından iade edilen Olası eksik sonuç düzeltildi `SELECT` ile sorgu `WHERE` birincil anahtarda durum, Float türüne dönüşüm içeriyordu. Bu Monotonluk yanlış kontrol neden oldu `toFloat` işlev. [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- Kontrol `max_expanded_ast_elements` mutasyonlar için ayarlama. Sonra açık mutasyonlar `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([Kış Zhang](https://github.com/zhang2014)) -- İle kullanıldığında anahtar sütunlar için birleştirme sonuçlarını düzeltin `join_use_nulls`. Sütun varsayılanları yerine Boşları ekleyin. [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) -- Dikey birleştirme ve değiştirme ile atlama endeksleri için düzeltin. Fix for `Bad size of marks file` özel. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([alesapin](https://github.com/alesapin)) -- Nadir kazayı düzeltin `ALTER MODIFY COLUMN` ve birleştirilmiş/değiştirilmiş parçalardan biri boş olduğunda dikey birleştirme (0 satır) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- Dönüşüm Sabit hata `LowCardinality` yazmak `AggregateFunctionFactory`. Bu düzeltmeler [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Yanlış davranışı ve olası segfault'ları düzeltin `topK` ve `topKWeighted` toplu fonksiyonlar. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([Anton Popov](https://github.com/CurtizJ)) -- Sabit güvensiz kod etrafında `getIdentifier` işlev. [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MySQL Tel protokolünde Sabit hata (ClickHouse form MySQL istemcisine bağlanırken kullanılır). Yığın arabellek taşması nedeniyle `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([Yuriy Baranov](https://github.com/yurriy)) -- Sabit bellek sızıntısı `bitmapSubsetInRange` işlev. [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([Zhichang Yu](https://github.com/yuzhichang)) -- Granülerlik değişiminden sonra mutasyon yürütüldüğünde nadir hatayı düzeltin. [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([alesapin](https://github.com/alesapin)) -- Varsayılan olarak tüm alanlarla protobuf iletisine izin ver. [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([Vitaly Baranov](https://github.com/vitlibar)) -- İle bir hatayı gidermek `nullIf` fonksiyonu zaman biz göndermek bir `NULL` ikinci argüman üzerinde argüman. [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Sonsuz bellek tüketimine yol açan dize alanları ile karmaşık anahtar önbellek sözlüklerinde yanlış bellek ayırma/ayırma ile nadir hatayı düzeltin (bellek sızıntısı gibi görünüyor). Dize boyutu sekizden (8, 16, 32, vb.) başlayarak iki güç olduğunda hata çoğalır. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- İstisnaya neden olan küçük dizilerde sabit goril kodlaması `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Vasily Nemkov](https://github.com/Enmk)) -- Birleşimlerde null olmayan türleri kullanmasına izin ver `join_use_nulls` etkin. [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) -- Sakatlamak `Poco::AbstractConfiguration` sorguda yer değiştirmeler `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kilitlenmeyi önlemek `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kullanım `arrayReduce` sabit argümanlar için segfault yol açabilir. [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Replica sonra geri yüklenmişse görünebilecek tutarsız parçaları düzeltin `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- Sabit asmak `JSONExtractRaw` işlev. [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yanlış atlama endeksleri seri hale getirme ve adaptif tanecikli toplama ile hatayı düzeltin. [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([alesapin](https://github.com/alesapin)) -- Düzeltmek `WITH ROLLUP` ve `WITH CUBE` değiştiriciler `GROUP BY` iki seviyeli toplama ile. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Adaptif tanecikli ikincil endeksler işaretleri yazma ile hatayı düzeltin. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- Sunucu başlatma sırasında başlatma sırasını düzeltin. Beri `StorageMergeTree::background_task_handle` içinde Başlat isılmıştır `startup()` bu `MergeTreeBlockOutputStream::write()` başlatmadan önce kullanmayı deneyebilir. Eğer başlatıldı ise sadece kontrol. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([I ivanvan](https://github.com/abyss7)) -- Bir hata ile tamamlanan önceki okuma işleminden veri arabelleğini temizleme. [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) -- Çoğaltılan \* MergeTree tablo için yeni bir çoğaltma oluştururken adaptif taneciklik sağlayan Fix hata. [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- İstisna durumunda sunucu başlatma sırasında Olası kilitlenme düzeltildi `libunwind` başlatılmamış erişim sırasında istisna sırasında `ThreadStatus` yapılı. [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Çökmeyi düzeltin `yandexConsistentHash` işlev. Fuzz testi ile bulundu. [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sunucu aşırı ve küresel iş parçacığı havuzu tam yakın olduğunda sorguları asılı olasılığı düzeltildi. Dağıtılmış sorgular, her bir parçaya bağlantı başına bir iş parçacığı ayırdığından, çok sayıda parçaya (yüzlerce) sahip kümelerde daha yüksek şansa sahiptir. Örneğin, bir küme 330 kırıkları 30 eşzamanlı dağıtılmış sorgu işleme, bu sorun yeniden oluşturabilir. Bu sorun, 19.2'den başlayarak tüm sürümleri etkiler. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit mantık `arrayEnumerateUniqRanked` işlev. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sembol tablosunu çözerken segfault'u düzeltin. [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([Amos Kuşu](https://github.com/amosbird)) -- Döküm sabit alakasız istisna `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Kaldırılan ekstra açıklamadan alıntı `system.settings` Tablo. [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Olası kilitlenmeyi önlemek `TRUNCATE` çoğaltılan tablonun. [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Anahtarı sıralama sırasına göre okumayı düzeltin. [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([Anton Popov](https://github.com/CurtizJ)) -- Düzeltmek `ALTER TABLE ... UPDATE` ile tablolar için sorgu `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Tarafından açılan hatayı düzeltin [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (19.4.0'dan beri). Herhangi bir sütunu sorgulamadığımızda Mergetree tabloları üzerinden dağıtılmış tablolara sorgularda çoğaltır (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- İmzalı türün imzasız türe tamsayı bölümünde sabit taşma. Davranış tam olarak C veya C++ dilinde (tamsayı promosyon kuralları) olduğu gibi şaşırtıcı olabilir. Büyük imzalı numarayı büyük imzasız numaraya bölerken veya tam tersi durumda taşmanın hala mümkün olduğunu lütfen unutmayın (ancak bu durum daha az olağandır). Sorun tüm sunucu sürümlerinde mevcuttu. [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Limit maksimum uyku süresi için kısma zaman `max_execution_speed` veya `max_execution_speed_bytes` ayar .lanmıştır. Gibi sabit yanlış hatalar `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kullanma ile ilgili sabit sorunlar `MATERIALIZED` sütunlar ve Takma adlar `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([Amos Kuşu](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltmek `FormatFactory` işlemci olarak uygulanmayan giriş akışları için davranış. [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Sabit yazım hatası. [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) -- Hata iletisinde yazım hatası (is -\> are ). [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) -- Tür bir virgül içeriyorsa, sütun listesinin dizeden ayrıştırılması sırasında hata düzeltildi (bu sorun AŞAĞIDAKİLERLE ilgiliydi `File`, `URL`, `HDFS` depolamalar) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) - -#### Güvenlik Düzeltme {#security-fix} - -- Bu sürüm aynı zamanda 19.13 ve 19.11 tüm hata güvenlik düzeltmeleri içerir. -- SQL ayrıştırıcısında yığın taşması nedeniyle sunucu çökmesine neden olmak için fabrikasyon bir sorgu olasılığı düzeltildi. Birleştirme ve dağıtılmış tablolarda yığın taşması olasılığı, alt sorguları içeren satır düzeyinde güvenlik için somutlaştırılmış görünümler ve koşullar düzeltildi. [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Geliştirme {#improvement-3} - -- İçin üçlü mantığın doğru uygulanması `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([Alexander Kazakov](https://github.com/Akazz)) -- Şimdi değerler ve süresi dolmuş TTL ile satırlar sonra kaldırılacak `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` sorgu. Eklenen sorgular `SYSTEM STOP/START TTL MERGES` izin vermek/izin vermek için tüm birleştirmelerde TTL ve filtre süresi dolmuş değerleri ile birleşmeleri atayın. [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([Anton Popov](https://github.com/CurtizJ)) -- Imkanı kullanarak istemci için ClickHouse geçmiş dosyasının konumunu değiştirmek için `CLICKHOUSE_HISTORY_FILE` en .v. [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) -- Kaldırmak `dry_run` 'dan bayrak `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Destek `ASOF JOIN` ile `ON` bölme. [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) -- Mutasyonlar ve çoğaltma için Atlama dizinlerinin daha iyi desteği. İçin destek `MATERIALIZE/CLEAR INDEX ... IN PARTITION` sorgu. `UPDATE x = x` sütun kullanan tüm indeksleri yeniden hesaplar `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([Nikita Vasilev](https://github.com/nikvas0)) -- İzin ver `ATTACH` canlı görünümler (örneğin, sunucu başlangıçta) ne olursa olsun `allow_experimental_live_view` ayar. [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sorgu profiler tarafından toplanan yığın izlemeleri için sorgu profiler kendisi tarafından oluşturulan yığın çerçeveleri içermez. [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi tablo fonksiyonları `values`, `file`, `url`, `hdfs` ALİAS sütunları için destek var. [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eğer bir istisna atmak `config.d` dosya, yapılandırma dosyası olarak ilgili kök öğeye sahip değildir. [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) -- İçin özel durum iletisinde ekstra bilgi Yazdır `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) -- Bir kırıkları belirlerken `Distributed` bir okuma sorgusu tarafından kapsanacak tablo (için `optimize_skip_unused_shards` = 1) ClickHouse şimdi her ikisinden de koşulları kontrol eder `prewhere` ve `where` select deyimi yan tümceleri. [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([Alexander Kazakov](https://github.com/Akazz)) -- Etkin `SIMDJSON` avx2 olmayan ancak sse 4.2 ve PCLMUL komut seti ile makineler için. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse olmadan dosya sistemleri üzerinde çalışabilir `O_DIRECT` ek ayar yapmadan destek (ZFS ve BtrFS gibi). [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Destek son alt sorgu için yüklemi aşağı itin. [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İyileştirmek `JOIN ON` anahtarlar çıkarma [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) -- Güncel `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin en küçük sütunun seçilmesini Optimize edin `SELECT count()` sorgu. [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([Amos Kuşu](https://github.com/amosbird)) -- Katma `strict` param parametereter in `windowFunnel()`. Ne zaman `strict` ayarlanırsa, `windowFunnel()` yalnızca benzersiz değerler için koşulları uygular. [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) -- Daha güvenli arayüzü `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) -- Seçenekler satır boyutu ile yürütülürken `--help` seçenek şimdi terminal boyutuna karşılık gelir. [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) -- Sakatlamak “read in order” anahtarsız toplama için optimizasyon. [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([Anton Popov](https://github.com/CurtizJ)) -- İçin HTTP durum kodu `INCORRECT_DATA` ve `TYPE_MISMATCH` hata kodları varsayılan olarak değiştirildi `500 Internal Server Error` -e doğru `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([Alexander Rodin](https://github.com/a-rodin)) -- Birleştirme nesnesini taşı `ExpressionAction` için `AnalyzedJoin`. `ExpressionAnalyzer` ve `ExpressionAction` hakkında bilmiyorum `Join` sınıf artık. Mantığı giz bylidir `AnalyzedJoin` ifface. [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) -- Kırıklardan biri localhost olduğunda ancak sorgu ağ bağlantısı üzerinden gönderildiğinde dağıtılmış sorguların Olası kilitlenmesi düzeltildi. [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Birden çok tablonun semantik değişti `RENAME` Olası kilitlenmeleri önlemek için. [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bellekte tam paket yükü yüklenmesini önlemek için yeniden yazılan MySQL uyumluluk sunucusu. Her bağlantı için bellek tüketiminin yaklaşık olarak azalması `2 * DBMS_DEFAULT_BUFFER_SIZE` (okuma / yazma tamponları). [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([Yuriy Baranov](https://github.com/yurriy)) -- Sorgu semantiği hakkında hiçbir şey bilmek zorunda olmayan ayrıştırıcıdan AST alias yorumlama mantığını taşıyın. [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) -- Biraz daha güvenli ayrıştırma `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-copier`: Kullanımına izin ver `where_condition` config ile `partition_key` bölüm varlığını kontrol etmek için sorgudaki diğer ad (daha önce yalnızca veri sorgularını okumada kullanıldı). [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) -- İsteğe bağlı mesaj argümanı eklendi `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) -- Ekleme verilerini gönderirken sunucu istisnası şimdi istemcide de işleniyor. [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) -- Bir metrik eklendi `DistributedFilesToInsert` bu, dağıtılmış tablolarla uzak sunuculara göndermek için seçilen dosya sistemindeki toplam dosya sayısını gösterir. Sayı tüm parçalar arasında toplanır. [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Birleş ofimlerin çoğunu taşı `ExpressionAction/ExpressionAnalyzer` -e doğru `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) -- Tsan'ı Düzeltin [uyarıcı](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([Vasily Nemkov](https://github.com/Enmk)) -- Linux yetenekleri eksikliği hakkında daha iyi bilgi mesajları. İle önemli hataları günlüğe kaydetme “fatal” seviye, bu daha kolay bulmak için yapacak `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sırasında bellek kullanımını kısıtlamak için diske geçici veri damping etkinleştirdiğinizde `GROUP BY`, `ORDER BY`, boş disk alanını kontrol etmedi. Düzeltme yeni bir ayar Ekle `min_free_disk_space`, boş disk alanı daha küçük olduğunda eşik, sorgu durur ve atar `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([Weiqing Xu](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İş parçacığı tarafından özyinelemeli rwlock kaldırıldı. Hiçbir anlam ifade etmiyor, çünkü iş parçacıkları sorgular arasında yeniden kullanılıyor. `SELECT` sorgu bir iş parçacığında bir kilit edinebilir, başka bir iş parçacığından bir kilit tutabilir ve ilk iş parçacığından çıkabilir. Aynı zamanda, ilk iş parçacığı tarafından yeniden kullanılabilir `DROP` sorgu. Bu yanlış yol açacaktır “Attempt to acquire exclusive lock recursively” iletiler. [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bölme `ExpressionAnalyzer.appendJoin()`. Bir yer hazırlayın `ExpressionAnalyzer` için `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) -- Katma `mysql_native_password` MySQL uyumluluk sunucusuna kimlik doğrulama eklentisi. [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([Yuriy Baranov](https://github.com/yurriy)) -- Daha az sayıda `clock_gettime` aramalar; hata ayıklama / sürüm arasındaki sabit ABİ uyumluluğu `Allocator` (önemsiz konu). [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Taşınmak `collectUsedColumns` itibaren `ExpressionAnalyzer` -e doğru `SyntaxAnalyzer`. `SyntaxAnalyzer` yapıyor `required_source_columns` şimdi kendisi. [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) -- Ayar Ekle `joined_subquery_requires_alias` alt seçimler ve tablo işlevleri için takma adlar istemek için `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) -- Ayıklamak `GetAggregatesVisitor` sınıf fromından `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) -- `system.query_log`: veri türünü değiştir `type` sütun için `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Statik bağlama `sha256_password` kimlik doğrulama eklentisi. [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([Yuriy Baranov](https://github.com/yurriy)) -- Ayar için ekstra bağımlılıktan kaçının `compile` çalışmak. Önceki sürümlerde, kullanıcı gibi hata alabilirsiniz `cannot open crti.o`, `unable to find library -lc` vb. [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kötü amaçlı kopyadan gelebilecek girdinin daha fazla doğrulaması. [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi `clickhouse-obfuscator` dosya mevcuttur `clickhouse-client` paket. Önceki sürümlerde şu şekilde mevcuttu `clickhouse obfuscator` (boşluk ile). [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) -- Farklı sırayla en az iki tablo ve tablolardan birinde DDL işlemi gerçekleştiren başka bir sorgu okumak en az iki sorgu olduğunda sabit kilitlenme. Başka bir çok nadir kilitlenme düzeltildi. [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Katma `os_thread_ids` sütun için `system.processes` ve `system.query_log` daha iyi hata ayıklama olanakları için. [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- PHP mysqlnd uzantısı hataları için bir geçici çözüm `sha256_password` varsayılan kimlik doğrulama eklentisi olarak kullanılır ( [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([Yuriy Baranov](https://github.com/yurriy)) -- Değiştirilen nullability sütunlarıyla gereksiz yeri kaldırın. [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) -- Set default value of `queue_max_wait_ms` sıfıra, çünkü mevcut değer (beş saniye) hiçbir anlam ifade etmiyor. Bu ayarların herhangi bir kullanımı olduğunda nadir durumlar vardır. Eklenen ayarlar `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` ve `connection_pool_max_wait_ms` anlam ayrımı için. [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ayıklamak `SelectQueryExpressionAnalyzer` itibaren `ExpressionAnalyzer`. Seçilmemiş sorgular için sonuncusu tutun. [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) -- Giriş ve çıkış formatlarını çoğaltarak kaldırıldı. [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Kullanıcının geçersiz kılmasına izin ver `poll_interval` ve `idle_connection_timeout` bağlantı ayarları. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `MergeTree` şimdi ek bir seçenek var `ttl_only_drop_parts` (varsayılan olarak devre dışı) parçaların kısmi budamasını önlemek için, böylece bir parçadaki tüm satırların süresi dolduğunda tamamen düştüler. [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([Sergi Vladykin](https://github.com/svladykin)) -- Tür set dizin işlevleri için denetler. Fonksiyon yanlış bir türe sahipse istisna atın. Bu UBSan ile fuzz testini düzeltir. [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Performans İyileştirme {#performance-improvement-2} - -- İle Optimize sorguları `ORDER BY expressions` fık ,ra, nerede `expressions` sıralama anahtarı ile çakışan önek var `MergeTree` Tablolar. Bu optimizasyon tarafından kontrol edilir `optimize_read_in_order` ayar. [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([Anton Popov](https://github.com/CurtizJ)) -- Parça yükleme ve çıkarma sırasında birden fazla diş kullanmasına izin verin. [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Toplu işlev durumlarının güncellenmesi için uygulanan toplu varyant. Performans avantaj .larına yol açabilir. [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kullanım `FastOps` fonksiyonlar için kütüphane `exp`, `log`, `sigmoid`, `tanh`. FastOps Michael Parakhin (Yandex CTO) bir hızlı vektör matematik kütüphanesidir. Geliştirilmiş performans `exp` ve `log` fonksiyonları fazla 6 kez. İşlev `exp` ve `log` itibaren `Float32` argüman geri dönecek `Float32` (önceki sürümlerde her zaman geri dönerler `Float64`). Şimdi `exp(nan)` dön mayebilir `inf`. Sonucu `exp` ve `log` fonksiyonlar, gerçek cevaba en yakın makine temsil edilebilir numarası olmayabilir. [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([alexey-milovidov](https://github.com/alexey-milovidov)) Fastops çalışmasını sağlamak için Danila Kutenin varyantını kullanma [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ardışık anahtar optimizasyonunu devre dışı bırak `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) -- Geliştirilmiş performans `simdjson` içinde dinamik tahs ofis ridat ridtan Kurtul ofarak kütüphane `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([Vitaly Baranov](https://github.com/vitlibar)) -- Bellek ayırırken ön hata sayfaları `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) -- Performans hatasını düzeltin `Decimal` karşılaştırma. [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-4} - -- Derleyici (çalışma zamanı şablonu örneği) kaldırın, çünkü performansı kazandık. [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Gcc-9'daki performansın daha izole bir şekilde bozulmasını göstermek için performans testi eklendi. [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eklenen tablo fonksiyonu `numbers_mt`, çok iş parçacıklı sürümü olan `numbers`. Karma fonksiyonları ile güncellenmiş performans testleri. [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Karşılaştırma modu `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) -- Yığın izlerini yazdırmak için en iyi çaba. Ayrıca eklendi `SIGPROF` çalışan bir iş parçacığının yığın izini yazdırmak için hata ayıklama sinyali olarak. [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Her fonksiyon kendi dosyasında, Bölüm 10. [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İki katına çıkar const `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) -- İçin biçimlendirme değişiklikleri `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) -- Birleştirme oluşturma için daha iyi alt sorgu `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) -- Gereksiz bir koşulu kaldırın (PVS Studio tarafından bulunur). [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) -- İçin karma tablo arayüzünü ayırın `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) -- Ayarların yeniden düzenlenmesi. [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([alesapin](https://github.com/alesapin)) -- İçin yorum ekle `set` dizin fonksiyonları. [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([Nikita Vasilev](https://github.com/nikvas0)) -- Linux'ta hata ayıklama sürümünde oom puanını artırın. [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) -- HDFS ha şimdi hata ayıklama yapısında çalışıyor. [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([Weiqing Xu](https://github.com/weiqxu)) -- Bir test eklendi `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kafka tablosu için birden fazla somutlaştırılmış görünüm için test ekleyin. [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([I ivanvan](https://github.com/abyss7)) -- Daha iyi bir yapı şeması yapın. [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([I ivanvan](https://github.com/abyss7)) -- Sabit `test_external_dictionaries` kök olmayan kullanıcı altında çalıştırılması durumunda entegrasyon. [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Yazılı paketlerin toplam boyutu aştığında hata çoğalır `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([Yuriy Baranov](https://github.com/yurriy)) -- İçin bir test eklendi `RENAME` tablo yarış durumu [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ayarlarda veri yarışından kaçının `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bir önbellek sözlüğü ile hataları işlemek için entegrasyon testi ekleyin. [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([Vitaly Baranov](https://github.com/vitlibar)) -- Mac OS'de elf nesne dosyalarının ayrıştırılmasını devre dışı bırakın, çünkü mantıklı değil. [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Changelog jeneratörünü daha iyi hale getirmeye çalışın. [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ekleme `-Wshadow` GCC'YE geçin. [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- İçin eski kod kaldırıldı `mimalloc` destek. [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `zlib-ng` x86 yeteneklerini belirler ve bu bilgiyi genel değişkenlere kaydeder. Bu, aynı anda farklı iş parçacıkları tarafından yapılabilen defalteınit çağrısında yapılır. Çok iş parçacıklı yazılardan kaçınmak için, kitaplık başlangıcında yapın. [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) -- İçinde gider wasilen bir hata için regresyon testi [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) -- Sabit MSan raporu. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltme çırparak TTL testi. [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([Anton Popov](https://github.com/CurtizJ)) -- Sabit yanlış veri yarışı `MergeTreeDataPart::is_frozen` alan. [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fuzz testinde sabit zaman aşımları. Önceki sürümde, sorguda yanlış hangup bulmayı başardı `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hata ayıklama kontrolleri eklendi `static_cast` sütunların. [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Resmi RPM paketlerinde Oracle Linux için destek. [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Değiştirilen json perftests `once` -e doğru `loop` tür. [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `odbc-bridge.cpp` tanımlıyor `main()` bu yüzden dahil edilmemelidir `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Orivej Desh](https://github.com/orivej)) -- Çarpışma testi `FULL|RIGHT JOIN` sağ tablonun tuşlarında boş alanlar var. [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) -- Her ihtimale karşı takma adların genişletilmesiyle ilgili sınır için bir test eklendi. [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Anahtar fromlı `boost::filesystem` -e doğru `std::filesystem` uygun olan yerlerde. [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Web sitesine RPM paketleri eklendi. [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit için bir test Ekle `Unknown identifier` istisna içinde `IN` bölme. [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) -- Basitleştirmek `shared_ptr_helper` çünkü insanlar bunu anlamakta zorluk çekiyorlar. [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit Gorilla ve DoubleDelta codec için performans testleri eklendi. [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([Vasily Nemkov](https://github.com/Enmk)) -- Entegrasyon testini bölün `test_dictionaries` 4 ayrı test içine. [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([Vitaly Baranov](https://github.com/vitlibar)) -- Pvs-Studio uyarısını düzeltin `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Kullanmasına izin ver `library` asan ile sözlük kaynağı. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- PRs listesinden changelog oluşturmak için seçenek eklendi. [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Lock the `TinyLog` depolama okurken. [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) -- CI kırık symlinks için kontrol edin. [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin zaman aşımını artırın “stack overflow” hata ayıklama yapı uzun zaman alabilir, çünkü sınayın. [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Çift whitespaces için bir çek eklendi. [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltmek `new/delete` bellek izleme zaman sanitizers ile inşa. İzleme net değil. Sadece testlerde bellek sınırı istisnalarını önler. [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) -- Bağlantı sırasında tanımlanmamış sembollerin kontrolünü geri etkinleştirin. [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([I ivanvan](https://github.com/abyss7)) -- Yeniden inşa etmekten kaçının `hyperscan` hergün. [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit UBSan raporu `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Uyumlu olmadığı için sanitizers ile sorgu profiler kullanmak için izin vermeyin. [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Zamanlayıcı tarafından başarısız olduktan sonra bir sözlüğü yeniden yüklemek için test ekleyin. [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([Vitaly Baranov](https://github.com/vitlibar)) -- Tutarsızlığı düzeltin `PipelineExecutor::prepareProcessor` argüman türü. [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Kötü Urı'ler için bir test eklendi. [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Daha fazla kontrol eklendi `CAST` işlev. Bu, bulanık testte segmentasyon hatası hakkında daha fazla bilgi almalıdır. [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Katma `gcc-9` güçlendirmek `docker/builder` yerel olarak görüntü oluşturan konteyner. [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Birincil anahtar için Test `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) -- Yavaş yığın izleri yazdırma etkilenen sabit testler. [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kilitlenme için bir test durumu ekleyin `groupUniqArray` sabit içinde [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) -- Sabit endeks mutasyonlar testleri. [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([Nikita Vasilev](https://github.com/nikvas0)) -- Performans testinde, çalıştırmadığımız sorgular için sorgu günlüğünü okuma. [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) -- Materialized görünüm şimdi şüpheli düşük kardinalite türleri hakkında ayar ne olursa olsun herhangi bir düşük kardinalite türleri ile oluşturulabilir. [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) -- İçin güncel testslenmiş testler `send_logs_level` ayar. [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Gcc-8.2 altında yapı düzeltin. [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) -- Dahili libc++ile yapı düzeltin. [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([I ivanvan](https://github.com/abyss7)) -- Paylaşılan yapıyı düzeltin `rdkafka` kitaplık [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([I ivanvan](https://github.com/abyss7)) -- Mac OS build için düzeltmeler (eksik). [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) -- Düzeltmek “splitted” yapmak. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Diğer yapı düzeltmeleri: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([Amos Kuşu](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([I ivanvan](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-3} - -- Kaldırıldı nadiren kullanılan tablo fonksiyonu `catBoostPool` ve depolama `CatBoostPool`. Bu tablo işlevini kullandıysanız, lütfen e-posta yazınız `clickhouse-feedback@yandex-team.com`. CatBoost entegrasyonunun devam ettiğini ve destekleneceğini unutmayın. [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sakatlamak `ANY RIGHT JOIN` ve `ANY FULL JOIN` varsayılan olarak. Koymak `any_join_distinct_right_table_keys` bunları etkinleştirmek için ayarlama. [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) - -## ClickHouse sürümü 19.13 {#clickhouse-release-19-13} - -### ClickHouse sürümü 19.13.6.51, 2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} - -#### Hata Düzeltme {#bug-fix-9} - -- Bu sürüm aynı zamanda 19.11.12.69 tüm hata düzeltmeleri içerir. - -### ClickHouse sürümü 19.13.5.44, 2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} - -#### Hata Düzeltme {#bug-fix-10} - -- Bu sürüm aynı zamanda 19.14.6.12 tüm hata düzeltmeleri içerir. -- Yürütülürken tablonun Olası tutarsız durumu düzeltildi `DROP` zookeeper erişilebilir değilken çoğaltılmış tablo için sorgu. [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Storagemerge'de veri yarışı için düzeltme [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Soketten sonsuz recv yol açar sorgu profiler tanıtılan Fix hata. [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([alesapin](https://github.com/alesapin)) -- Çalışırken aşırı CPU kullanımını düzeltin `JSONExtractRaw` bir Boole değeri üzerinde işlev. [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([Vitaly Baranov](https://github.com/vitlibar)) -- Gerçekleşmiş görünüme iterken gerilemeyi düzeltir. [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([I ivanvan](https://github.com/abyss7)) -- Tablo fonksiyonu `url` güvenlik açığı saldırganın istekte rasgele HTTP üstbilgileri enjekte etmesine izin vermişti. Bu konu tarafından bulundu [Nikita Tikhomirov](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İşe yaramaz düzeltmek `AST` set dizini kontrol edin. [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([Nikita Vasilev](https://github.com/nikvas0)) -- Sabit ayrıştırma `AggregateFunction` sorguya gömülü değerler. [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([Zhichang Yu](https://github.com/yuzhichang)) -- Sabit yanlış davranış `trim` fonksiyonlar aile. [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.13.4.32, 2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} - -#### Hata Düzeltme {#bug-fix-11} - -- Bu sürüm aynı zamanda 19.11.9.52 ve 19.11.10.54 tüm hata güvenlik düzeltmeleri içerir. -- Sabit veri yarışı `system.parts` masa ve `ALTER` sorgu. [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Akışlarda sabit eşleşmeyen başlık, örnek ve prewhere ile boş dağıtılmış tablodan okuma durumunda oldu. [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([Lixiang Qian](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Kullanırken sabit çökme `IN` bir tuple ile bir alt sorgu ile yan tümce. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Aynı sütun adlarıyla durumu düzeltin `GLOBAL JOIN ON` bölme. [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) -- Türleri döküm yaparken çökmeyi düzeltin `Decimal` bu onu desteklemiyor. Bunun yerine istisna atın. [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) -- Sabit çökme `extractAll()` işlev. [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) -- İçin sorgu dönüşümü `MySQL`, `ODBC`, `JDBC` tablo işlevleri artık düzgün çalışıyor `SELECT WHERE` birden fazla sorgu `AND` ifadeler. [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) -- MySQL 8 entegrasyonu için önceki beyan kontrolleri eklendi. [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([Rafael David Tinoco](https://github.com/rafaeldtinoco)) - -#### Güvenlik Düzeltme {#security-fix-1} - -- Dekompresyon aşamasında kodeklerdeki iki güvenlik açığını düzeltin (kötü niyetli kullanıcı, dekompresyonda tampon taşmasına yol açacak sıkıştırılmış verileri üretebilir). [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouse sürümü 19.13.3.26, 2019-08-22 {#clickhouse-release-19-13-3-26-2019-08-22} - -#### Hata Düzeltme {#bug-fix-12} - -- Düzeltmek `ALTER TABLE ... UPDATE` ile tablolar için sorgu `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Bir tuple ile bir alt sorgu ile yan tümcesinde kullanırken npe düzeltin. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Eski bir kopya canlı hale gelirse, yine de açılan bölüm tarafından kaldırılan veri parçalarına sahip olabileceği sorunu düzeltildi. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- CSV ayrıştırma ile ilgili sorun giderildi [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- Sistemde sabit veri yarışı.parçalar tablo ve alter sorgu. Bu düzeltmeler [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bellek bozulmasına yol açabilecek mutasyonlarda yanlış kod düzeltildi. Adresin okunması ile sabit segfault `0x14c0` bu eşzamanlı nedeniyle happed olabilir `DROP TABLE` ve `SELECT` itibaren `system.parts` veya `system.parts_columns`. Mutasyon sorgularının hazırlanmasında sabit yarış durumu. Sabit kilitlenme neden `OPTIMIZE` çoğaltılmış tablolar ve değiştirir gibi eşzamanlı değişiklik işlemleri. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sonra sabit olası veri kaybı `ALTER DELETE` tabloda dizin atlama ile sorgu. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Güvenlik Düzeltme {#security-fix-2} - -- Saldırganın Zookeeper'a yazma erişimi varsa ve Clickhouse'un çalıştığı ağdan kullanılabilen özel sunucuyu çalıştırabiliyorsa, ClickHouse replica olarak hareket edecek ve Zookeeper'a kaydedecek özel olarak oluşturulmuş kötü amaçlı sunucu oluşturabilir. Başka bir çoğaltma, kötü amaçlı kopyadan veri bölümünü getirdiğinde, clickhouse-Server'ı dosya sistemindeki keyfi yola yazmaya zorlayabilir. Yandex'teki bilgi güvenliği ekibi Eldar Zaitov tarafından bulundu. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.13.2.19, 2019-08-14 {#clickhouse-release-19-13-2-19-2019-08-14} - -#### Yenilik {#new-feature-5} - -- Sorgu düzeyinde örnekleme profiler. [Örnek](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) -- Sütunların bir listesini belirtmek için izin ver `COLUMNS('regexp')` daha sofistike bir varyantı gibi çalışan ifade `*` Yıldız işareti. [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CREATE TABLE AS table_function()` artık mümkün [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) -- Stokastik Gradyan iniş için Adam optimizer varsayılan olarak kullanılır `stochasticLinearRegression()` ve `stochasticLogisticRegression()` agrega fonksiyonları, çünkü neredeyse herhangi bir ayar yapmadan iyi kalite gösterir. [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) -- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([Andy Yang](https://github.com/andyyzh)) -- `RENAME` sorgular artık tüm depolarla çalışır. [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([I ivanvan](https://github.com/abyss7)) -- Şimdi istemci ayarlayarak istenilen düzeyde sunucudan günlükleri almak `send_logs_level` sunucu ayarlarında belirtilen günlük düzeyine bakılmaksızın. [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-4} - -- Ayar `input_format_defaults_for_omitted_fields` varsayılan olarak etkinleştirilir. Dağıtılmış tablolardaki ekler bu ayarın kümede aynı olması gerekir (güncellemeyi çalıştırmadan önce ayarlamanız gerekir). Atlanmış alanlar için karmaşık varsayılan ifadelerin hesaplanmasını sağlar `JSONEachRow` ve `CSV*` biçimliler. Beklenen davranış olmalı, ancak ihmal edilebilir performans farkına yol açabilir. [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) - -#### Deneysel özellikler {#experimental-features} - -- Yeni sorgu işleme boru hattı. Kullanmak `experimental_use_processors=1` etkinleştirmek için Seçenek. Kendi sorun için kullanın. [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Hata Düzeltme {#bug-fix-13} - -- Kafka entegrasyonu bu sürümde düzeltildi. -- Sabit `DoubleDelta` kodlama `Int64` büyük için `DoubleDelta` değerler, geliştirilmiş `DoubleDelta` rastgele veri için kodlama `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([Vasily Nemkov](https://github.com/Enmk)) -- Sabit aşırı tahmin `max_rows_to_read` eğer ayar `merge_tree_uniform_read_distribution` 0 olarak ayarlanır. [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Geliştirme {#improvement-4} - -- Eğer bir istisna atar `config.d` dosya, yapılandırma dosyası olarak ilgili kök öğeye sahip değil [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) - -#### Performans İyileştirme {#performance-improvement-3} - -- Getirmek `count()`. Şimdi en küçük sütunu kullanır (mümkünse). [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([Amos Kuşu](https://github.com/amosbird)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-5} - -- Performans testlerinde bellek kullanımını bildirin. [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) -- Harici yapı ile Düzeltme `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([I ivanvan](https://github.com/abyss7)) -- Paylaşılan yapıyı düzeltin `rdkafka` kitaplık [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([I ivanvan](https://github.com/abyss7)) - -## ClickHouse yayın 19.11 {#clickhouse-release-19-11} - -### ClickHouse sürümü 19.11.13.74, 2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} - -#### Hata Düzeltme {#bug-fix-14} - -- Sabit nadir kazasında `ALTER MODIFY COLUMN` ve birleştirilmiş/değiştirilmiş parçalardan biri boş olduğunda dikey birleştirme (0 satır). [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([alesapin](https://github.com/alesapin)) -- Manuel güncelleme `SIMDJSON`. Bu sahte json teşhis mesajları ile stderr dosyalarının Olası sel giderir. [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([Alexander Kazakov](https://github.com/Akazz)) -- Sabit hata ile `mrk` Mut fileasyonlar için dosya uzantısı ([alesapin](https://github.com/alesapin)) - -### ClickHouse yayın 19.11.12.69, 2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} - -#### Hata Düzeltme {#bug-fix-15} - -- Büyük tablolarda karmaşık anahtarlar üzerinde endeks analizi sabit performans düşüşü. Bu düzeltmeler [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Dağıtılmış motorlu tablolarda veri gönderirken nadir SIGSEGV'DEN kaçının (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) -- Düzeltmek `Unknown identifier` birden fazla birleşim ile. Bu düzeltmeler [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouse sürümü 19.11.11.57, 2019-09-13 {#clickhouse-release-19-11-11-57-2019-09-13} - -- Kafka boş konudan seçerken segfaults'a neden olan mantıksal hatayı düzeltin. [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([I ivanvan](https://github.com/abyss7)) -- Fonksiyon için düzeltme `АrrayEnumerateUniqRanked` params boş diziler ile. [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) - -### ClickHouse sürümü 19.11.10.54, 2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} - -#### Hata Düzeltme {#bug-fix-16} - -- Tüm bölümler için hepsini bir kerede işlemek için Kafka mesajları için uzaklıkları manuel olarak saklayın. Potansiyel çoğaltmayı giderir “one consumer - many partitions” senaryo. [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([I ivanvan](https://github.com/abyss7)) - -### ClickHouse yayın 19.11.9.52, 2019-09-6 {#clickhouse-release-19-11-9-52-2019-09-6} - -- Önbellek sözlüklerde hata işleme geliştirin. [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([Vitaly Baranov](https://github.com/vitlibar)) -- Fonksiyonu Sabit hata `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) -- Düzeltmek `JSONExtract` bir ayıklarken işlev `Tuple` JSON dan. [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([Vitaly Baranov](https://github.com/vitlibar)) -- Sonra sabit olası veri kaybı `ALTER DELETE` tabloda dizin atlama ile sorgu. [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([Nikita Vasilev](https://github.com/nikvas0)) -- Sabit performans testi. [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Parke: Boolean sütunlarını okumayı düzeltin. [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit yanlış davranış `nullIf` sabit argümanlar için işlev. [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([Guillaume Tassery](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Normal sunucu yeniden başlatmada Kafka mesajları çoğaltma sorununu düzeltin. [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([I ivanvan](https://github.com/abyss7)) -- Uzun zaman bir sorun düzeltildi `ALTER UPDATE` veya `ALTER DELETE` düzenli birleştirmelerin çalışmasını engelleyebilir. Yeterli boş iş parçacığı yoksa mutasyonların yürütülmesini önleyin. [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) -- İşleme ile Sabit hata “timezone” sunucu yapılandırma dosyasında. [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kafka testlerini düzeltin. [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([I ivanvan](https://github.com/abyss7)) - -#### Güvenlik Düzeltme {#security-fix-3} - -- Saldırganın Zookeeper'a yazma erişimi varsa ve Clickhouse'un çalıştığı ağdan kullanılabilen özel sunucuyu çalıştırabiliyorsa, ClickHouse replica olarak hareket edecek ve Zookeeper'a kaydedecek özel olarak oluşturulmuş kötü amaçlı sunucu oluşturabilir. Başka bir çoğaltma, kötü amaçlı kopyadan veri bölümünü getirdiğinde, clickhouse-Server'ı dosya sistemindeki keyfi yola yazmaya zorlayabilir. Yandex'teki bilgi güvenliği ekibi Eldar Zaitov tarafından bulundu. [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.11.8.46, 2019-08-22 {#clickhouse-release-19-11-8-46-2019-08-22} - -#### Hata Düzeltme {#bug-fix-17} - -- Düzeltmek `ALTER TABLE ... UPDATE` ile tablolar için sorgu `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([alesapin](https://github.com/alesapin)) -- Bir tuple ile bir alt sorgu ile yan tümcesinde kullanırken npe düzeltin. [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- Eski bir kopya canlı hale gelirse, yine de açılan bölüm tarafından kaldırılan veri parçalarına sahip olabileceği sorunu düzeltildi. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- CSV ayrıştırma ile ilgili sorun giderildi [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- Sistemde sabit veri yarışı.parçalar tablo ve alter sorgu. Bu düzeltmeler [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bellek bozulmasına yol açabilecek mutasyonlarda yanlış kod düzeltildi. Adresin okunması ile sabit segfault `0x14c0` bu eşzamanlı nedeniyle happed olabilir `DROP TABLE` ve `SELECT` itibaren `system.parts` veya `system.parts_columns`. Mutasyon sorgularının hazırlanmasında sabit yarış durumu. Sabit kilitlenme neden `OPTIMIZE` çoğaltılmış tablolar ve değiştirir gibi eşzamanlı değişiklik işlemleri. [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.11.7.40, 2019-08-14 {#clickhouse-release-19-11-7-40-2019-08-14} - -#### Hata düzeltme {#bug-fix-18} - -- Kafka entegrasyonu bu sürümde düzeltildi. -- Kullanırken segfault'u düzeltin `arrayReduce` sürekli argümanlar için. [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit `toFloat()` Monotonluk. [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- Etkin olan segfault'u düzeltin `optimize_skip_unused_shards` ve kayıp sharding anahtarı. [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) -- Sabit mantık `arrayEnumerateUniqRanked` işlev. [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MySQL işleyicisinden ekstra ayrıntılı günlük kaydı kaldırıldı. [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yanlış davranışı ve olası segfault'ları düzeltin `topK` ve `topKWeighted` toplu fonksiyonlar. [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) -- Sanal sütunları göstermeyin `system.columns` Tablo. Bu geriye dönük uyumluluk için gereklidir. [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Karmaşık anahtar önbellek sözlüğünde dize alanları için bellek tahsisi ile hatayı düzeltin. [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([alesapin](https://github.com/alesapin)) -- İçin yeni bir çoğaltma oluştururken uyarlamalı ayrıntıyı etkinleştirerek hatayı düzeltin `Replicated*MergeTree` Tablo. [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([alesapin](https://github.com/alesapin)) -- Kafka mesajlarını okurken sonsuz döngüyü düzeltin. [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) -- SQL ayrıştırıcısında yığın taşması ve yığın taşması olasılığı nedeniyle sunucu çökmesine neden olmak için fabrikasyon bir sorgu olasılığı düzeltildi `Merge` ve `Distributed` Tablolar [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Küçük dizilerde sabit goril kodlama hatası. [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) - -#### Geliştirme {#improvement-5} - -- Kullanıcının geçersiz kılmasına izin ver `poll_interval` ve `idle_connection_timeout` bağlantı ayarları. [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.11.5.28, 2019-08-05 {#clickhouse-release-19-11-5-28-2019-08-05} - -#### Hata düzeltme {#bug-fix-19} - -- Sunucu aşırı yüklendiğinde sorguları asılı olasılığı düzeltildi. [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- YANDEXCONSİSTENTHASH işlevinde FPE'Yİ düzeltin. Bu düzeltmeler [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Dönüşüm Sabit hata `LowCardinality` yazmak `AggregateFunctionFactory`. Bu düzeltmeler [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ayrıştırmayı düzeltin `bool` ayarlar `true` ve `false` yapılandırma dosyalarındaki dizeler. [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin)) -- Sorgularda uyumsuz akış başlıklarıyla nadir hatayı düzeltin `Distributed` masa üstü `MergeTree` tablo parça `WHERE` MOV toes to `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin)) -- İmzalı türün imzasız türe tamsayı bölümünde sabit taşma. Bu düzeltmeler [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-5} - -- `Kafka` hala kırık. - -### ClickHouse sürümü 19.11.4.24, 2019-08-01 {#clickhouse-release-19-11-4-24-2019-08-01} - -#### Hata Düzeltme {#bug-fix-20} - -- Adaptif tanecikli ikincil endeksler işaretleri yazma ile hatayı düzeltin. [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([alesapin](https://github.com/alesapin)) -- Düzeltmek `WITH ROLLUP` ve `WITH CUBE` değiştiriciler `GROUP BY` iki seviyeli toplama ile. [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([Anton Popov](https://github.com/CurtizJ)) -- Sabit asmak `JSONExtractRaw` işlev. Sabit [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ExternalLoader::reloadOutdated () içinde segfault Fix. [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([Vitaly Baranov](https://github.com/vitlibar)) -- Sunucu dinleme soketlerini kapatabilir, ancak kapanmaz ve kalan sorguları sunmaya devam edebilir. İki çalışan clickhouse-server süreçleri ile sona erebilir. Bazen, sunucu bir hata döndürebilir `bad_function_call` kalan sorgular için. [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ODBC, MySQL, ClickHouse ve HTTP üzerinden harici sözlüklerin ilk yüklenmesi için güncelleme alanında işe yaramaz ve yanlış durum düzeltildi. Bu düzeltmeler [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Döküm sabit alakasız istisna `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Deterministik olmayan sonucu düzeltin “uniq” aşırı nadir durumlarda toplama fonksiyonu. Hata tüm ClickHouse sürümlerinde mevcuttu. [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Segfault biz fonksiyonu üzerinde biraz fazla yüksek CIDR ayarladığınızda `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Sunucu birçok farklı bağlamdan birçok istisna attığında sabit küçük bellek sızıntısı. [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tüketici abonelikten önce duraklatıldığında ve daha sonra devam etmediğinde durumu düzeltin. [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([I ivanvan](https://github.com/abyss7)) Kafka'nın bu sürümde bozulduğunu unutmayın. -- Bir hatayla tamamlanan önceki okuma işleminden Kafka veri arabelleğini temizleme [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([Nikolay](https://github.com/bopohaa)) Kafka'nın bu sürümde bozulduğunu unutmayın. -- Beri `StorageMergeTree::background_task_handle` içinde Başlat isılmıştır `startup()` bu `MergeTreeBlockOutputStream::write()` başlatmadan önce kullanmayı deneyebilir. Eğer başlatıldı ise sadece kontrol. [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([I ivanvan](https://github.com/abyss7)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-6} - -- Resmi eklendi `rpm` paketler. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([alesapin](https://github.com/alesapin)) -- Oluşturmak için bir yetenek ekleyin `.rpm` ve `.tgz` paketleri ile `packager` komut. [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([alesapin](https://github.com/alesapin)) -- İçin düzeltmeler “Arcadia” sistemi oluşturmak. [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-6} - -- `Kafka` bu sürümde bozuldu. - -### ClickHouse sürümü 19.11.3.11, 2019-07-18 {#clickhouse-release-19-11-3-11-2019-07-18} - -#### Yenilik {#new-feature-6} - -- Hazırlanan ifadeler için destek eklendi. [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([İskender](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `DoubleDelta` ve `Gorilla` sütun kodekleri [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([Vasily Nemkov](https://github.com/Enmk)) -- Katma `os_thread_priority` kontrol etmeyi sağlayan ayar “nice” dinamik zamanlama önceliğini ayarlamak için OS tarafından kullanılan sorgu işleme iş parçacıklarının değeri. Bu gerektirir `CAP_SYS_NICE` yetenekleri çalışmak. Bu uygular [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Uygulamak `_topic`, `_offset`, `_key` Kafka motoru için sütunlar [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([I ivanvan](https://github.com/abyss7)) Kafka'nın bu sürümde bozulduğunu unutmayın. -- Toplama fonksiyonu birleştirici Ekle `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) -- Toplama fonksiyonları `groupArrayMovingSum(win_size)(x)` ve `groupArrayMovingAvg(win_size)(x)`, pencere boyutu sınırlaması olan veya olmayan hareketli toplamı/AVG'yi hesaplar. [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([ınv2004](https://github.com/inv2004)) -- Synonim Ekle `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) -- Intergate H3 fonksiyonu `geoToH3` Uber gelen. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Hata Düzeltme {#bug-fix-21} - -- Zaman uyumsuz güncelleştirme ile DNS önbelleğini uygulayın. Ayrı iş parçacığı tüm ana bilgisayarları çözer ve DNS önbelleğini nokta (ayar) ile günceller `dns_cache_update_period`). Ana bilgisayarların IP'si sık sık değiştiğinde yardımcı olmalıdır. [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([Anton Popov](https://github.com/CurtizJ)) -- Segfault'u düzeltin `Delta` 32 bit boyutundan daha küçük değerlere sahip sütunları etkileyen codec bileşeni. Hata rastgele bellek bozulmasına yol açtı. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- TTL fix segfault blok fiziksel olmayan sütunlarla birleştirme. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Parçanın kontrol edilmesinde nadir hatayı düzeltin `LowCardinality` sütun. Önceden `checkDataPart` her zaman ile parçası için başarısız `LowCardinality` sütun. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- Sunucu iş parçacığı havuzu dolduğunda bağlantıları asılı kaçının. Bağlantılar için önemlidir `remote` uzun bağlantı zaman aşımı olduğunda, tablo işlevi veya kopyaları olmayan bir parçaya bağlantılar. Bu düzeltmeler [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit argümanlar için destek `evalMLModel` işlev. Bu düzeltmeler [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse varsayılan saat dilimini belirlediğinde sorun giderildi `UCT` yerine `UTC`. Bu düzeltmeler [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit tampon underflow içinde `visitParamExtractRaw`. Bu düzeltmeler [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi dağıtılmış `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` sorgular doğrudan lider çoğaltma üzerinde yürütülür. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- Düzeltmek `coalesce` için `ColumnConst` ile `ColumnNullable` + ilgili değişiklikler. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) -- Fix the `ReadBufferFromKafkaConsumer` böylece sonra yeni mesajlar okumaya devam ediyor `commit()` daha önce durmuş olsa bile [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([I ivanvan](https://github.com/abyss7)) -- Düzeltmek `FULL` ve `RIGHT` Üzerinde katılırken sonuçları katılın `Nullable` sağ tablodaki tuşlar. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) -- Düşük öncelikli sorguların sonsuz uyku Olası düzeltme. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bazı sorguların query\_log'da görünmemesine neden olan Yarış durumunu düzeltin `SYSTEM FLUSH LOGS` sorgu. [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Sabit `heap-use-after-free` Clustercopier'de asan uyarısı, zaten kaldırılmış fotokopi nesnesini kullanmaya çalışan saatin neden olduğu. [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Sabit yanlış `StringRef` bazı uygulamalar tarafından döndürülen işaretçi `IColumn::deserializeAndInsertFromArena`. Bu hata sadece birim testlerini etkiledi. [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Aynı ad sütunlarını maskeleme kaynak ve ara dizi birleştirme sütunlarını önleyin. [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) -- Insert Fix ve MySQL stil tanımlayıcı Alıntı ile MySQL motoruna sorgu seçin. [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([Kış Zhang](https://github.com/zhang2014)) -- Şimdi `CHECK TABLE` sorgu MergeTree engine ailesi ile çalışabilir. Her bir parça için (veya simplier motorları durumunda dosya) varsa kontrol durumunu ve mesajı döndürür. Ayrıca, kırık bir parçanın getirilmesinde hatayı düzeltin. [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([alesapin](https://github.com/alesapin)) -- Split\_shared\_libraries çalışma zamanını düzeltme [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) -- Sabit zaman dilimi başlatma `/etc/localtime` göreceli bir sembolik bağ gibi mi `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- clickhouse-fotokopi makinesi: kullanımı düzeltin-kapatmadan sonra ücretsiz [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) -- Güncel `simdjson`. Sıfır bayt ile bazı geçersiz JSONs başarıyla ayrıştırmak sorunu düzeltildi. [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sistem günlüklerinin kapatılmasını düzeltin [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([Anton Popov](https://github.com/CurtizJ)) -- Invalidate\_query'deki koşul bir sözlüğe bağlı olduğunda askıda kalmayı düzeltin. [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Geliştirme {#improvement-6} - -- Küme yapılandırmasında çözümlenemeyen adreslere izin ver. Onlar kullanılamaz kabul ve her bağlantı girişimi çözmek için çalışılacaktır. Bu özellikle Kubernetes için yararlıdır. Bu düzeltmeler [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Boş TCP bağlantılarını kapatın (varsayılan olarak bir saat zaman aşımı ile). Bu, her sunucuda birden çok dağıtılmış tablo bulunan büyük kümeler için özellikle önemlidir, çünkü her sunucu bir bağlantı havuzunu diğer her sunucuya saklayabilir ve en yüksek sorgu eşzamanlılığından sonra bağlantılar duracaktır. Bu düzeltmeler [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Daha kaliteli `topK` işlev. Yeni öğenin daha büyük bir ağırlığı varsa, son öğeyi kaldırmak için SavingSpace set davranışını değiştirdi. [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Etki alanlarıyla çalışmak için URL işlevleri artık şema olmadan tamamlanmamış URL'ler için çalışabilir [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([alesapin](https://github.com/alesapin)) -- Checksums eklendi `system.parts_columns` Tablo. [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Katma `Enum` veri türü için bir synonim olarak `Enum8` veya `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) -- Tam bit transpose varyantı için `T64` codec. İle daha iyi sıkıştırma yol açabilir `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) -- Cond conditionition on `startsWith` fonksiyon şimdi birincil anahtar kullanır. Bu düzeltmeler [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) ve [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) -- Kullanmasına izin ver `clickhouse-copier` boş veritabanı adı izin vererek çapraz çoğaltma küme topolojisi ile. [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([nvartolomei](https://github.com/nvartolomei)) -- Kullanmak `UTC` olmadan bir sistemde varsayılan zaman dilimi olarak `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` yazdırıldı ve sunucu veya istemci başlatmayı reddetti. [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fonksiyonda kayan nokta argümanı için geri destek döndü `quantileTiming` geriye dönük uyumluluk için. [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hata iletilerinde hangi tablonun eksik olduğunu göster. [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([I ivanvan](https://github.com/abyss7)) -- Çeşitli kullanıcılar tarafından aynı query\_id ile sorgu çalıştırmasına izin verme [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) -- Grafite metrikleri göndermek için daha sağlam kod. Uzun çoklu sırasında bile çalışacaktır `RENAME TABLE` işleyiş. [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ThreadPool yürütme için bir görev zamanlayamıyor, daha bilgilendirici hata iletileri görüntülenir. Bu düzeltmeler [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ngramsearch'i daha sezgisel olarak tersine çevirmek [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) -- HDFS engine builder'da kullanıcı ayrıştırma Ekle [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) -- Güncelleme varsayılan değeri `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) -- Eski ayarlar kavramı eklendi. Eski ayar `allow_experimental_low_cardinality_type` hiçbir etkisi ile kullanılabilir. [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) - -#### Performans İyileştirme {#performance-improvement-4} - -- İş parçacıklarının daha düzgün dağılımı için birleştirme tablosundan seçilecek akış sayısını artırın. Ayar eklendi `max_streams_multiplier_for_merge_tables`. Bu düzeltmeler [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-7} - -- Clickhouse'un farklı sürümleriyle istemci-sunucu etkileşimi için geriye dönük uyumluluk testi ekleyin. [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([alesapin](https://github.com/alesapin)) -- Her taahhüt ve çekme isteğinde Test kapsamı bilgileri. [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([alesapin](https://github.com/alesapin)) -- Özel ayırıcılarımızı desteklemek için adres dezenfektanı ile işbirliği yapın (`Arena` ve `ArenaWithFreeLists`) daha iyi hata ayıklama için “use-after-free” hatasızlar. [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) -- Değiştirmek [Llvm libunwind uygulaması](https://github.com/llvm-mirror/libunwind) C++ özel durum işleme ve yığın izleri yazdırma için [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([Nikita Lapkov](https://github.com/laplab)) -- \- Weverything'den iki uyarı daha ekleyin [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bellek dezenfektanı ile ClickHouse oluşturmak için izin verin. [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit ubsan raporu hakkında `bitTest` fuzz testinde işlev. [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Docker: kimlik doğrulaması gerektiren bir ClickHouse örneğini başlatmak için olasılık eklendi. [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([Korviakov Andrey](https://github.com/shurshun)) -- Librdkafka'yı 1.1.0 sürümüne güncelleyin [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([I ivanvan](https://github.com/abyss7)) -- Entegrasyon testleri için genel zaman aşımı ekleyin ve test kodunda bazılarını devre dışı bırakın. [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([alesapin](https://github.com/alesapin)) -- Bazı iş parçacıklarını düzeltinnitizer arızaları. [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) -- Bu `--no-undefined` seçenek, bağlayıcıyı, bağlantı sırasında varoluş için tüm dış adları denetlemeye zorlar. Bölünmüş yapı modunda kütüphaneler arasındaki gerçek bağımlılıkları izlemek çok yararlıdır. [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([I ivanvan](https://github.com/abyss7)) -- İçin performans testi eklendi [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Gcc-7 ile sabit uyumluluk. [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Gcc-9 için destek eklendi. Bu düzeltmeler [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Libunwind yanlış bağlanabilir Sabit hata. [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- PVS-Studio tarafından bulunan birkaç uyarı düzeltildi. [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin ilk destek eklendi `clang-tidy` statik analiz cihazı. [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- BSD/Linux endian makrolarını dönüştürme( ‘be64toh’ ve ‘htobe64’) Mac OS X eşdeğentser thelerine [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([Fu Ch Chenen](https://github.com/fredchenbj)) -- Geliştirilmiş entegrasyon testleri kılavuzu. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) -- MacOSX + gcc9'da yapı sabitleme [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) -- Sabit bir nokta yazım hatası düzeltin: aggreAGte - \> agrega. [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) -- Freebsd yapısını düzeltin [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) -- Web sitesine deneysel YouTube kanalına bağlantı Ekle [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([Ivan Blinkov](https://github.com/blinkov)) -- Cmake: kapsama bayrakları için Seçenek Ekle: WİTH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) -- Bazı satır içi Podarray'ın başlangıç boyutunu düzeltin. [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) -- clickhouse-sunucu.postınst: centos 6 için işletim sistemi algılamasını düzeltin [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) -- Arch linux paketi üretimi eklendi. [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Split Common/config.libs tarafından h (dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) -- İçin düzeltmeler “Arcadia” yapı platformu [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) -- Alışılmamış yapı için düzeltmeler (gcc9, alt modül yok) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) -- Hata eğilimli olduğu kanıtlanmış olduğu için unalignedstore'da açık tip gerektirir [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) -- Düzeltmeler MacOS yapı [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) -- Burada istendiği gibi, daha büyük veri kümesine sahip yeni JIT özelliği ile ilgili performans testi [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Stres testinde durumsal testler çalıştırın [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([alesapin](https://github.com/alesapin)) - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-7} - -- `Kafka` bu sürümde bozuldu. -- Etkinleştirmek `adaptive_index_granularity` = Yeni için varsayılan olarak 10MB `MergeTree` Tablolar. 19.11 + sürümünde yeni MergeTree tabloları oluşturduysanız, 19.6'dan önceki sürümlere düşürme imkansız olacaktır. [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([alesapin](https://github.com/alesapin)) -- Yandex tarafından kullanılan eski belgesiz gömülü sözlükler kaldırıldı.Metrica. İşlev `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` artık kullanılamaz. Bu işlevleri kullanıyorsanız, e-posta yazın clickhouse-feedback@yandex-team.com. not: son anda bu işlevleri bir süre tutmaya karar verdik. [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouse yayın 19.10 {#clickhouse-release-19-10} - -### ClickHouse sürümü 19.10.1.5, 2019-07-12 {#clickhouse-release-19-10-1-5-2019-07-12} - -#### Yenilik {#new-feature-7} - -- Yeni sütun codec Ekle: `T64`. (U)IntX/EnumX/Data(Time)/DecimalX sütunları için yapılmıştır. Sabit veya küçük Aralık değerlerine sahip sütunlar için iyi olmalıdır. Codec kendisi büyütmek veya yeniden sıkıştırma olmadan veri türünü küçültmek sağlar. [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) -- Veritabanı Altyapısı Ekle `MySQL` uzak MySQL sunucusundaki tüm tabloları görüntülemenize izin veren [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([Kış Zhang](https://github.com/zhang2014)) -- `bitmapContains` uygulanış. 2x daha hızlı `bitmapHasAny` ikinci bit eşlem bir öğe içeriyorsa. [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([Zhichang Yu](https://github.com/yuzhichang)) -- İçin destek `crc32` işlev (tam olarak MySQL veya PHP'DE olduğu gibi davranışla). Bir karma işlevine ihtiyacınız varsa kullanmayın. [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) -- Uyguluyordu `SYSTEM START/STOP DISTRIBUTED SENDS` zaman uyumsuz ekler içine denetlemek için sorgular `Distributed` Tablolar. [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([Kış Zhang](https://github.com/zhang2014)) - -#### Hata Düzeltme {#bug-fix-22} - -- Mutasyonları yürütürken birleştirme sınırları için sorgu yürütme sınırlarını ve en fazla parça boyutunu yoksayın. [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([Anton Popov](https://github.com/CurtizJ)) -- Normal blokların tekilleştirilmesine (son derece nadir) ve yinelenen blokların eklenmesine (daha sık) yol açabilecek hatayı düzeltin. [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([alesapin](https://github.com/alesapin)) -- Fonksiyonun düzeltilmesi `arrayEnumerateUniqRanked` boş dizilere sahip argümanlar için [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) -- Herhangi bir mesaj yoklamak niyetiyle olmadan Kafka konulara abone etmeyin. [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([I ivanvan](https://github.com/abyss7)) -- Ayar yap `join_use_nulls` Nullable içinde olamaz türleri için hiçbir etkisi olsun [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) -- Sabit `Incorrect size of index granularity` hatasızlar [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) -- Float'ı ondalık dönüştürme taşmasına düzeltin [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) -- Floş tampon zaman `WriteBufferFromHDFS`'In yıkıcı denir. Bu düzeltmeler içine yazma `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([Xindong Peng](https://github.com/eejoin)) - -#### Geliştirme {#improvement-7} - -- Boş hücreleri tedavi edin `CSV` varsayılan değerler olarak zaman ayarı `input_format_defaults_for_omitted_fields` etkindir. [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) -- Harici sözlüklerin engellenmeyen yüklenmesi. [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ayarlara göre önceden kurulmuş bağlantılar için Ağ zaman aşımları dinamik olarak değiştirilebilir. [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) -- Kullanım “public\_suffix\_list” fonksiyonlar için `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. Tarafından oluşturulan mükemmel bir karma tablo kullanıyor `gperf` dosyadan oluşturulan bir liste ile: https://publicsuffix.org/list/public\_suffix\_list.dat. (örneğin, şimdi etki alanını tanıyoruz `ac.uk` olmayan önemli). [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Kabul edilen `IPv6` sistem tablolarında veri türü; Birleşik istemci bilgi sütunları `system.processes` ve `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MySQL uyumluluk protokolü ile bağlantılar için oturumları kullanma. \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([Yuriy Baranov](https://github.com/yurriy)) -- Destek daha fazla `ALTER` sorgular `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) -- Destek `` bölümünde `clickhouse-local` yapılandırma dosyası. [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) -- Sorgu çalıştırmasına izin ver `remote` tablo fonksiyonu `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) - -#### Performans İyileştirme {#performance-improvement-5} - -- Mergetree sütunların sonunda son işareti yazma imkanı ekleyin. İşe yaramaz önlemek için tablo veri aralığı anahtarları için okuma sağlar. Yalnızca uyarlamalı dizin parçalı yapı kullanımda ise etkinleştirilir. [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([alesapin](https://github.com/alesapin)) -- Sayısını azaltarak çok yavaş dosya sistemlerinde mergetree tabloları geliştirilmiş performans `stat` syscalls. [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sürüm 19.6 tanıtıldı MergeTree tablolardan okuma sabit performans düşüşü. Düzeltmeler \# 5631. [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-8} - -- Uyguluyordu `TestKeeper` test için kullanılan ZooKeeper arayüzünün bir uygulaması olarak [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([alexey-milovidov](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) -- Bundan sonra `.sql` testler rasgele veritabanı ile paralel olarak, sunucu tarafından izole çalıştırılabilir. Onları daha hızlı çalıştırmanıza, özel sunucu yapılandırmaları ile yeni testler eklemenize ve farklı testlerin birbirini etkilemediğinden emin olmanızı sağlar. [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([I ivanvan](https://github.com/abyss7)) -- Kaldırmak `` ve `` performans test fromlerinden [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) -- Sabit “select\_format” performans testi için `Pretty` biçimliler [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## ClickHouse sürüm 19.9 {#clickhouse-release-19-9} - -### ClickHouse yayın 19.9.3.31, 2019-07-05 {#clickhouse-release-19-9-3-31-2019-07-05} - -#### Hata Düzeltme {#bug-fix-23} - -- 32 bit boyutundan daha küçük değerlere sahip sütunları etkileyen Delta codec'te segfault'u düzeltin. Hata rastgele bellek bozulmasına yol açtı. [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([alesapin](https://github.com/alesapin)) -- LowCardinality sütunu ile parçanın kontrol nadir hata düzeltin. [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([alesapin](https://github.com/alesapin)) -- TTL fix segfault blok fiziksel olmayan sütunlarla birleştirme. [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([Anton Popov](https://github.com/CurtizJ)) -- Düşük öncelikli sorguların potansiyel sonsuz uykusunu düzeltin. [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Clickhouse'un varsayılan saat dilimini UTC yerine UCT olarak nasıl belirlediğini düzeltin. [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Lider çoğaltma önce takipçi çoğaltma üzerinde küme sorguları üzerinde dağıtılmış damla/ALTER/TRUNCATE/OPTİMİZE yürütme hakkında Fix hata. Şimdi doğrudan lider kopya üzerinde idam edilecektir. [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([alesapin](https://github.com/alesapin)) -- Bazı sorgular anında sistem floş günlükleri sorgu sonra query\_log görünmeyebilir neden yarış durumu, düzeltin. [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([Anton Popov](https://github.com/CurtizJ)) -- Sabit argümanlar için eksik destek eklendi `evalMLModel` işlev. [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.9.2.4, 2019-06-24 {#clickhouse-release-19-9-2-4-2019-06-24} - -#### Yenilik {#new-feature-8} - -- Dondurulmuş parçalar hakkında bilgi Yazdır `system.parts` Tablo. [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) -- Clickhouse'da istemci şifresini sor-argümanlarda ayarlanmamışsa tty üzerinde istemci Başlat [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) -- Uygulamak `dictGet` ve `dictGetOrDefault` ondalık türleri için fonksiyonlar. [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Geliştirme {#improvement-8} - -- Debian init: servis durdurma zaman aşımı Ekle [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) -- Lowcardinality için şüpheli türlerle tablo oluşturmak için varsayılan olarak yasaklanan ayar Ekle [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) -- Regresyon işlevleri, işlevde durum olarak kullanılmadığında model ağırlıklarını döndürür `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) -- Regresyon yöntemlerini yeniden adlandırın ve geliştirin. [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) -- Dize arayanların daha net arayüzleri. [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) - -#### Hata Düzeltme {#bug-fix-24} - -- Kafka'daki potansiyel veri kaybını düzeltin [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([I ivanvan](https://github.com/abyss7)) -- Potansiyel sonsuz döngüyü düzeltin `PrettySpace` sıfır sütun ile çağrıldığında Biçimlendir [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) -- Doğrusal modellerde sabit uint32 taşma hatası. Const olmayan model argümanı için eval ML modeline izin verin. [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- `ALTER TABLE ... DROP INDEX IF EXISTS ...` sağlanan dizin yoksa bir özel durum yükseltmek değil [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Segfault ile Düzeltme `bitmapHasAny` skaler alt sorguda [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Sabit hata çoğaltma bağlantı havuzu DNS önbellek düştü bile, ana bilgisayarı çözmek için yeniden deneme değil. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- Sabit `ALTER ... MODIFY TTL` ReplicatedMergeTree üzerinde. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([Anton Popov](https://github.com/CurtizJ)) -- SOMUTLAŞTIRILMIŞ sütun ile dağıtılmış tabloya ekleme düzeltin [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) -- Birleştirme depolama alanını keserken hatalı ayırma düzeltildi [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) -- Tzdata paketinin son sürümlerinde bazı dosyalar artık sembolik bağlardır. Varsayılan zaman dilimini tespit etmek için geçerli mekanizma bozulur ve bazı zaman dilimleri için yanlış isimler verir. Şimdi en azından saat dilimi adını, sağlanırsa TZ içeriğine zorlarız. [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([I ivanvan](https://github.com/abyss7)) -- Toplamı sabit iğneler en az 16KB uzun olduğunda MultiVolnitsky searcher ile bazı son derece nadir durumlarda düzeltin. Algoritma cevapsız veya yanlış sonuca yol açabilir önceki sonuçları overwrote `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) -- ExternalData istekleri için ayarlar ClickHouse ayarlarını kullanamadığında sorunu düzeltin. Ayrıca, şimdilik, ayarlar `date_time_input_format` ve `low_cardinality_allow_in_native_format` adların belirsizliği nedeniyle kullanılamaz (dış verilerde tablo biçimi olarak yorumlanabilir ve sorguda bir ayar olabilir). [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) -- Parçaları Zookeeper onları düşürmeden sadece FS kaldırıldı hata düzeltin. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- MySQL protokolünden hata ayıklama günlüğü kaldırma [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- DDL sorgu işleme sırasında znonode atla [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Fix mix `UNION ALL` sonuç sütun türü. Tutarsız veri ve sonuç sütunlarının sütun türleri olan durumlar vardı. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- Yanlış tamsayılar üzerinde bir istisna atmak `dictGetT` çökme yerine işlevler. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Karma sözlük için yanlış element\_count ve load\_factor Fix `system.dictionaries` Tablo. [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-9} - -- Olmadan sabit yapı `Brotli` HTTP sıkıştırma desteği (`ENABLE_BROTLI=OFF` cmake değişkeni). [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) -- Kükreyen dahil.kükreyen/kükreyen olarak h.sa [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Orivej Desh](https://github.com/orivej)) -- Hyperscan'daki gcc9 uyarılarını düzeltin (\#line yönergesi kötüdür!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) -- Gcc-9 ile derlerken tüm uyarıları düzeltin. Bazı contrib sorunları düzeltin. Gcc9 ICE'Yİ düzeltin ve bugzilla'ya gönderin. [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) -- Lld ile sabit bağlantı [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sözlüklerde kullanılmayan uzmanlıkları kaldırma [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) -- Farklı dosya türleri için tabloları biçimlendirme ve ayrıştırma için iyileştirme performans testleri [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) -- Paralel test çalışması için düzeltmeler [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) -- Docker: clickhouse-test'ten yapılandırmaları kullanın [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) -- FreeBSD için derlemeyi düzeltin [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) -- Yükseltme boost için 1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) -- Yapı clickhouse'u submodule olarak düzeltin [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) -- Jsonextract performans testlerini geliştirin [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([Vitaly Baranov](https://github.com/vitlibar)) - -## ClickHouse yayın 19.8 {#clickhouse-release-19-8} - -### ClickHouse yayın 19.8.3.8, 2019-06-11 {#clickhouse-release-19-8-3-8-2019-06-11} - -#### Yenilik {#new-features} - -- Json ile çalışmak için fonksiyonlar eklendi [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([Vitaly Baranov](https://github.com/vitlibar)) -- Bir çok dilde var olan bir basename işlevine benzer bir davranışa sahip bir işlev basename ekleyin (`os.path.basename` PY inth inon'da, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Katma `LIMIT n, m BY` veya `LIMIT m OFFSET n BY` limit BY yan tümcesi için n ofset ayarlamak için sözdizimi. [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([Anton Popov](https://github.com/CurtizJ)) -- Yeni veri türü eklendi `SimpleAggregateFunction`, bir ışık toplama ile sütunlara sahip olmasını sağlar `AggregatingMergeTree`. Bu sadece aşağıdaki gibi basit işlevlerle kullanılabilir `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) -- Fonksiyonda sabit olmayan argümanlar için destek eklendi `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) -- Eklenen fonksiyonlar `skewPop`, `skewSamp`, `kurtPop` ve `kurtSamp` sıra eğriliği, örnek eğrilik, kurtozis ve örnek kurtozis sırasıyla hesaplamak için. [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) -- Destek yeniden adlandırma işlemi için `MaterializeView` depolama. [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([Guillaume Tassery](https://github.com/YiuRULE)) -- MySQL istemcisini kullanarak Clickhouse'a bağlanmayı sağlayan sunucu eklendi. [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([Yuriy Baranov](https://github.com/yurriy)) -- Eklemek `toDecimal*OrZero` ve `toDecimal*OrNull` işlevler. [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) -- Destek ondalık türleri fonksiyonları: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted`, medianExactWeighted. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) -- Katma `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) -- Katma `format` işlev. Argümanlarda listelenen dizelerle sabit desen (basitleştirilmiş Python biçim deseni) biçimlendirme. [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) -- Katma `system.detached_parts` ayrılmış bölümleri hakkında bilgi içeren tablo `MergeTree` Tablolar. [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) -- Katma `ngramSearch` iğne ve Samanlık arasındaki simetrik olmayan farkı hesaplamak için işlev. [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) -- Temel makine öğrenimi yöntemlerinin (stokastik doğrusal regresyon ve lojistik regresyon) agrega fonksiyonları arayüzünü kullanarak uygulanması. Model ağırlıklarını güncellemek için farklı stratejilere sahiptir (basit Gradyan iniş, momentum yöntemi, Nesterov yöntemi). Ayrıca özel boyuttaki mini partileri de destekler. [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) -- Uygulanması `geohashEncode` ve `geohashDecode` işlevler. [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([Vasily Nemkov](https://github.com/Enmk)) -- Toplama fonksiyonu eklendi `timeSeriesGroupSum`, hangi zaman damgası hizalama değil örnek farklı zaman serileri toplayabilir. İki örnek zaman damgası arasında doğrusal enterpolasyon kullanacak ve daha sonra zaman serilerini birlikte toplayacaktır. Toplama fonksiyonu eklendi `timeSeriesGroupRateSum`, zaman serisi ve daha sonra toplam oranları birlikte oranını hesaplar. [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([Yangkuan Liu](https://github.com/LiuYangkuan)) -- Eklenen fonksiyonlar `IPv4CIDRtoIPv4Range` ve `IPv6CIDRtoIPv6Range` bir CIDR kullanarak alt ağdaki bir IP için alt ve üst sınırları hesaplamak için. [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Etkin ayar ile HTTP kullanarak bir sorgu gönderdiğimizde bir X-ClickHouse-Summary Başlığı ekleyin `send_progress_in_http_headers`. Sorguda kaç satır ve bayt eklendiği gibi ek bilgilerle birlikte, x-ClickHouse-Progress'in olağan bilgilerini döndürün. [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Geliştirmeler {#improvements} - -- Katma `max_parts_in_total` bölüm anahtarı \#5166 güvenli olmayan belirtimini engelleyen mergetree ailesi tabloları (varsayılan: 100 000) için ayarlama. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-obfuscator`: ilk tohum sütun adı, sütun konumu ile birleştirerek tek tek sütunlar için tohum türetmek. Bu, veri kümelerini birden çok ilgili tablolarla dönüştürmek için tasarlanmıştır, böylece tablolar dönüşümden sonra birleştirilebilir kalır. [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eklenen fonksiyonlar `JSONExtractRaw`, `JSONExtractKeyAndValues`. Yeniden adlandırılan işlevler `jsonExtract` -e doğru `JSONExtract`. Bir şeyler ters gittiğinde bu işlevler muhabir değerleri döndürür, değil `NULL`. Modifiye fonksiyonu `JSONExtract`, şimdi son parametresinden dönüş türünü alır ve nullables enjekte etmez. Avx2 talimatlarının mevcut olmaması durumunda Rapidjson'a geri dönüş uygulandı. Simdjson KÜTÜPHANESİ yeni bir sürüme güncellendi. [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([Vitaly Baranov](https://github.com/vitlibar)) -- Şimdi `if` ve `multiIf` fonksiyonlar koşulun güvenmeyin `Nullable`, ancak SQL uyumluluğu için şubelere güvenin. [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([Jian Wu.](https://github.com/janplus)) -- `In` yüklemi şimdi üretir `Null` sonucu `Null` gibi girdi `Equal` işlev. [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([Jian Wu.](https://github.com/janplus)) -- Kafka'dan her (flush\_interval / poll\_timeout) satır sayısını zaman sınırını kontrol edin. Bu, Kafka tüketicisinden okumayı daha sık kırmaya ve üst düzey akışların zaman sınırlarını kontrol etmeye izin verir [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([I ivanvan](https://github.com/abyss7)) -- Paketlenmiş SASL ile bağlantı RDKAFKA. SASL SCRAM kimlik doğrulamasını kullanmasına izin vermelidir [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([I ivanvan](https://github.com/abyss7)) -- Tüm birleşimler için rowreflist'in toplu sürümü. [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) -- clickhouse-sunucu: daha bilgilendirici dinleme hata mesajları. [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) -- Clickhouse destek sözlükler-fonksiyonlar için fotokopi `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) -- Yeni ayar Ekle `kafka_commit_every_batch` Kafka'nın taahhüt politikasını düzenlemek. - Taahhüt modunu ayarlamanıza izin verir: her mesaj Partisi işlendikten sonra veya tüm blok depolamaya yazıldıktan sonra. Bazı mesajları kaybetmek veya bazı aşırı durumlarda iki kez okumak arasında bir takas. [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([I ivanvan](https://github.com/abyss7)) -- Yapmak `windowFunnel` diğer imzasız tamsayı türlerini destekleyin. [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) -- Sanal sütunun gölgesine izin ver `_table` birleştirme motorunda. [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([I ivanvan](https://github.com/abyss7)) -- Yapmak `sequenceMatch` toplu işlevler diğer imzasız tamsayı türlerini destekler [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) -- Sağlama toplamı uyuşmazlığı büyük olasılıkla donanım hatalarından kaynaklanıyorsa daha iyi hata iletileri. [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Altta yatan tabloların örneklemeyi desteklediğini kontrol edin `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([I ivanvan](https://github.com/abyss7)) -- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- MySQL Wire protokolünün iyileştirmeleri. MySQLWire biçiminin adını değiştirdi. Rsa\_free çağırmak için RAII kullanma. Bağlam oluşturulamıyorsa SSL'Yİ devre dışı bırakma. [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([Yuriy Baranov](https://github.com/yurriy)) -- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) -- Dağıtılmış tablolara zaman uyumsuz ekler sorgu ayarlarını saygı. [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) -- Yeniden adlandırılan işlevler `leastSqr` -e doğru `simpleLinearRegression`, `LinearRegression` -e doğru `linearRegression`, `LogisticRegression` -e doğru `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Performans İyileştirmeleri {#performance-improvements} - -- Parallelize işleme parçaları olmayan çoğaltılmış MergeTree tabloları alter değiştirme sorgu. [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([Ivan Kush](https://github.com/IvanKush)) -- Düzenli ifadeler çıkarma optimizasyonlar. [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) -- Yalnızca joın on bölümünde kullanılıyorsa, sonucu birleştirmek için doğru joın anahtar sütunu eklemeyin. [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) -- İlk boş yanıttan sonra Kafka tamponunu dondurun. Bu birden invokations önler `ReadBuffer::next()` bazı satır ayrıştırma akışlarında boş sonuç için. [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([I ivanvan](https://github.com/abyss7)) -- `concat` birden çok argüman için işlev optimizasyonu. [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) -- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) -- Daha hızlı dekompresyona sahip olmak için lz4 uygulamamızı referansla yükseltin. [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) -- Uygulanan MSD radix sıralama (kxsort dayalı) ve kısmi sıralama. [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) - -#### Hata Düzeltmeleri {#bug-fixes} - -- Fix itme birleştirme ile sütunlar gerektirir [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Kış Zhang](https://github.com/zhang2014)) -- ClickHouse systemd tarafından çalıştırıldığında Sabit hata, komut `sudo service clickhouse-server forcerestart` beklendiği gibi çalışmadı. [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) -- Datapartsexchange'deki http hata kodlarını düzeltin (9009 bağlantı noktasındaki ınterserver http Sunucusu, hatalarda bile her zaman 200 kodunu döndürdü). [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) -- Max\_small\_string\_size daha uzun dize için SimpleAggregateFunction Fix [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) -- İçin hatayı Düzelt fixin `Decimal` -e doğru `Nullable(Decimal)` içinde dönüşüm. (Farklı ölçekler dahil) ondalık dönüşümler diğer ondalık destekleyin. [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) -- Yanlış hesaplama yol simdjson kütüphanesinde sabit FPU clobbering `uniqHLL` ve `uniqCombined` toplama fonksiyonu ve matematik fonksiyonları gibi `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Json işlevlerinde karışık const / nonconst durumlarda sabit taşıma. [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([Vitaly Baranov](https://github.com/vitlibar)) -- Düzeltmek `retention` işlev. Şimdi bir veri satırında tatmin eden tüm koşullar veri durumuna eklenir. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) -- Sonuç türünü düzeltme `quantileExact` ondalık sayılarla. [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Belge {#documentation} - -- İçin belgeleri tercüme `CollapsingMergeTree` Çin. [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) -- Tablo motorları ile ilgili bazı belgeleri çince'ye çevirin. - [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) - [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) - ([Nev leeer lee](https://github.com/neverlee)) - -#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements} - -- Olası kullanım sonrası ücretsiz gösteren bazı dezenfektan raporlarını düzeltin.[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([I ivanvan](https://github.com/abyss7)) -- Kolaylık sağlamak için performans testlerini ayrı dizinlerden çıkarın. [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yanlış performans testlerini düzeltin. [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([alesapin](https://github.com/alesapin)) -- Donanım Sorunlarını ayıklamak için bit flips'in neden olduğu sağlama toplamlarını hesaplamak için bir araç eklendi. [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Runner betiğini daha kullanışlı hale getirin. [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) -- Performans testlerinin nasıl yazılacağı konusunda küçük talimatlar ekleyin. [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([alesapin](https://github.com/alesapin)) -- Performans testlerinde create, fill ve drop sorgularında değişiklik yapma yeteneği ekleme [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) - -## ClickHouse yayın 19.7 {#clickhouse-release-19-7} - -### ClickHouse yayın 19.7.5.29, 2019-07-05 {#clickhouse-release-19-7-5-29-2019-07-05} - -#### Hata Düzeltme {#bug-fix-25} - -- JOIN ile bazı sorgularda performans gerilemesini düzeltin. [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([Kış Zhang](https://github.com/zhang2014)) - -### ClickHouse yayın 19.7.5.27, 2019-06-09 {#clickhouse-release-19-7-5-27-2019-06-09} - -#### Yenilik {#new-features-1} - -- Bitmap ile ilgili işlevler eklendi `bitmapHasAny` ve `bitmapHasAll` benzer `hasAny` ve `hasAll` diziler için fonksiyonlar. [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([Sergi Vladykin](https://github.com/svladykin)) - -#### Hata Düzeltmeleri {#bug-fixes-1} - -- Segfault'u düzeltin `minmax` Null değeri ile dizin. [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([Nikita Vasilev](https://github.com/nikvas0)) -- Tüm giriş sütunlarını LİMİT olarak gerekli çıktı olarak işaretleyin. Düzelt itiyor ‘Not found column’ bazı dağıtılmış sorgularda hata. [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([Constantin S. Pan](https://github.com/kvap)) -- Düzeltmek “Column ‘0’ already exists” er errorror in `SELECT .. PREWHERE` ÖNTAN columnımlı süt onunda [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) -- Düzeltmek `ALTER MODIFY TTL` sorgu üzerinde `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([Anton Popov](https://github.com/CurtizJ)) -- Kafka tüketiciler başlatmak için başarısız olduğunda sunucu çökmesine etmeyin. [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([I ivanvan](https://github.com/abyss7)) -- Sabit bitmap işlevleri yanlış sonuç üretir. [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([Andy Yang](https://github.com/andyyzh)) -- Karma sözlük için element\_count'u düzeltin (çiftleri dahil etmeyin) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) -- Ortam değişkeni TZ içeriğini saat dilimi adı olarak kullanın. Bazı durumlarda varsayılan zaman dilimini doğru bir şekilde tespit etmeye yardımcı olur.[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([I ivanvan](https://github.com/abyss7)) -- Tamsayıları dönüştürmeye çalışmayın `dictGetT` fonksiyonlar, çünkü düzgün çalışmıyor. Bunun yerine bir istisna atın. [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- Harici ayarları düzeltinveri HTTP isteği. [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila. - Kutenin](https://github.com/danlark1)) -- Parçaları Zookeeper onları düşürmeden sadece FS kaldırıldı hata düzeltin. [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([alesapin](https://github.com/alesapin)) -- Segmentasyon hatasını düzeltin `bitmapHasAny` işlev. [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([Zhichang Yu](https://github.com/yuzhichang)) -- Sabit hata çoğaltma bağlantı havuzu DNS önbellek düştü bile, ana bilgisayarı çözmek için yeniden deneme değil. [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([alesapin](https://github.com/alesapin)) -- Sabit `DROP INDEX IF EXISTS` sorgu. Şimdi `ALTER TABLE ... DROP INDEX IF EXISTS ...` sağlanan dizin yoksa, sorgu bir özel durum oluşturmaz. [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([Gleb Novikov](https://github.com/NanoBjorn)) -- Birliği tüm supertype sütununu düzeltin. Tutarsız veri ve sonuç sütunlarının sütun türleri olan durumlar vardı. [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- DDL sorgu işleme sırasında znonode atlayın. Başka bir düğüm, görev sırasındaki znode'u kaldırmadan önce, - bunu işlemedi, ancak zaten çocukların listesini al, DDLWorker iş parçacığını sonlandıracak. [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- Somutlaştırılmış sütun ile dağıtılmış() tabloya Ekle düzeltin. [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) - -### ClickHouse yayın 19.7.3.9, 2019-05-30 {#clickhouse-release-19-7-3-9-2019-05-30} - -#### Yenilik {#new-features-2} - -- Kullanıcı tarafından belirtilebilecek bir ayar aralığını sınırlamaya izin verin. - Bu kısıtlamalar kullanıcı ayarları profilinde ayarlanabilir. - [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([Vitaly. - Baranov](https://github.com/vitlibar)) -- İşlevin ikinci bir sürümünü ekleyin `groupUniqArray` isteğe bağlı - `max_size` elde edilen dizinin boyutunu sınırlayan parametre. Bu - davranış benzer `groupArray(max_size)(x)` işlev. - [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([Guillaume - Tassery](https://github.com/YiuRULE)) -- Tsvwithnames / CSVWithNames giriş dosya formatları için, sütun sırası şimdi olabilir - dosya başlığından belirlenir. Bu tarafından kontrol edilir - `input_format_with_names_use_header` parametre. - [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) - ([İskender](https://github.com/Akazz)) - -#### Hata Düzeltmeleri {#bug-fixes-2} - -- Birleştirme sırasında uncompressed\_cache + JOİN ile kilitlenme (\#5197) - [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila. - Kutenin](https://github.com/danlark1)) -- Sistem tablolarına bir clickhouse-istemci sorgusunda segmentasyon hatası. \#5066 - [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) - ([I ivanvan](https://github.com/abyss7)) -- KafkaEngine üzerinden ağır yükte veri kaybı (\#4736) - [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) - ([I ivanvan](https://github.com/abyss7)) -- Sistemden en az iki seçmeyi içeren UNION ile bir sorgu yürütülürken gerçekleşebilecek çok nadir veri yarışı durumu düzeltildi.sütunlar, sistem.tablolar, sistem.parçalar, sistem.parts\_tables veya birleştirme ailesinin tabloları ve ilgili tabloların sütunlarının aynı anda değiştirilmesi. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Performans İyileştirmeleri {#performance-improvements-1} - -- Tek bir sayısal sütuna göre sıralama için radix sıralamasını kullanın `ORDER BY` olarak - `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), - [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) - ([Evgenii Pravda](https://github.com/kvinty), - [alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Belge {#documentation-1} - -- Bazı tablo motorları için belgeleri Çince'ye çevirin. - [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), - [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), - [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) - ([张风啸](https://github.com/AlexZFX)), - [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([asla - lee](https://github.com/neverlee)) - -#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-1} - -- UTF-8 karakterlerini düzgün bir şekilde yazdırın `clickhouse-test`. - [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Her zaman öneri yüklemek için clickhouse-client için komut satırı parametresi ekleyin - veriler. [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bazı PVS-Studio uyarılarını çözün. - [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) - ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Güncelleme LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila. - Kutenin](https://github.com/danlark1)) -- Yaklaşan çekme isteği \#5030 için gereksinimleri oluşturmak için gperf ekleyin. - [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) - ([proller](https://github.com/proller)) - -## ClickHouse yayın 19.6 {#clickhouse-release-19-6} - -### ClickHouse yayın 19.6.3.18, 2019-06-13 {#clickhouse-release-19-6-3-18-2019-06-13} - -#### Hata Düzeltmeleri {#bug-fixes-3} - -- Tablo işlevlerinden sorgular için koşul pushdown sabit `mysql` ve `odbc` ve ilgili masa motorları. Bu düzeltmeler \# 3540 ve \# 2384. [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Zookeeper kilitlenme Fix. [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) -- CSV'DE alıntı ondalık sayılara izin ver. [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) -- Float Inf/Nan'dan ondalık sayılara dönüştürmeye izin verme (istisna atma). [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) -- Yeniden adlandırma sorgusunda veri yarışını düzeltin. [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([Kış Zhang](https://github.com/zhang2014)) -- Lfalloc'u geçici olarak devre dışı bırakın. Lfalloc kullanımı, UncompressedCache tahsis edilmesinde ve yüksek yüklü sunuculardaki sorguların çökmesine neden olan bir çok MAP\_FAİLED'E yol açabilir. [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) - -### ClickHouse yayın 19.6.2.11, 2019-05-13 {#clickhouse-release-19-6-2-11-2019-05-13} - -#### Yenilik {#new-features-3} - -- Sütunlar ve tablolar için TTL ifadeleri. [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([Anton Popov](https://github.com/CurtizJ)) -- İçin destek eklendi `brotli` http yanıtları için sıkıştırma (Accept-Encoding: br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([Mikhail](https://github.com/fandyushin)) -- Yeni fonksiyon eklendi `isValidUTF8` bir bayt kümesinin doğru utf-8 kodlanmış olup olmadığını kontrol etmek için. [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) -- Yeni Yük Dengeleme ilkesi Ekle `first_or_random` bu, belirtilen ilk ana bilgisayara sorgular gönderir ve erişilemezse, rasgele ana bilgisayarlara sorgular gönderir. Çapraz çoğaltma topoloji kurulumları için kullanışlıdır. [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([nvartolomei](https://github.com/nvartolomei)) - -#### Deneysel Özellikler {#experimental-features-1} - -- Ayar Ekle `index_granularity_bytes` (adaptive ındex granularity) MergeTree\* tablolar ailesi için. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([alesapin](https://github.com/alesapin)) - -#### Geliştirmeler {#improvements-1} - -- Fonksiyon için sabit olmayan ve negatif boyut ve uzunluk argümanları için destek eklendi `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sol joın sağ tablo, sol tablo sağ joın ve her iki tablo tam joın push-aşağı devre dışı bırakın. Bu, bazı durumlarda yanlış birleştirme sonuçlarını düzeltir. [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([I ivanvan](https://github.com/abyss7)) -- `clickhouse-copier`: otomatik yükleme görev yapılandırması `--task-file` seçenek [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) -- Depolama Fabrikası ve masa fonksiyonları Fabrikası için yazım hataları işleyicisi eklendi. [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) -- Alt sorgular olmadan birden fazla birleşim için yıldız işaretlerini ve nitelikli yıldız işaretlerini destekleyin [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) -- Eksik sütun hata mesajını daha kullanıcı dostu hale getirin. [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Performans İyileştirmeleri {#performance-improvements-2} - -- ASOF JOİN önemli hızlanma [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) - -#### Geriye Dönük Uyumsuz Değişiklikler {#backward-incompatible-changes} - -- HTTP Başlığı `Query-Id` olarak değiştirildi `X-ClickHouse-Query-Id` tutarlılık için. [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([Mikhail](https://github.com/fandyushin)) - -#### Hata Düzeltmeleri {#bug-fixes-4} - -- Sabit potansiyel boş işaretçi dereference `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) -- JOİN + ARRAY JOİN ile sorguda Sabit hata [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) -- Bir sözlük engine=Dictionary ile bir veritabanı üzerinden başka bir sözlüğe bağlı olduğunda sunucunun başlangıcında asılı sabit. [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([Vitaly Baranov](https://github.com/vitlibar)) -- Partially fix distributed\_product\_mode = local. It's possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There's not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) -- Potansiyel olarak yanlış sonucu düzeltin `SELECT DISTINCT` ile `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) -- Sistemden en az iki seçmeyi içeren UNION ile bir sorgu yürütülürken gerçekleşebilecek çok nadir veri yarışı durumu düzeltildi.sütunlar, sistem.tablolar, sistem.parçalar, sistem.parts\_tables veya birleştirme ailesinin tabloları ve ilgili tabloların sütunlarının aynı anda değiştirilmesi. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-2} - -- Farklı ana bilgisayarda clickhouse-server çalıştırırken sabit test hataları [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([Vasily Nemkov](https://github.com/Enmk)) -- clickhouse-test: tty olmayan ortamda renk kontrol dizilerini devre dışı bırakın. [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([alesapin](https://github.com/alesapin)) -- clickhouse-test: herhangi bir test veritabanını kullanmasına izin ver (Kaldır `test.` mümkün olduğu yerde yeterlilik) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) -- Ubsan hatalarını düzeltin [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Yandex LFAlloc, Segfault'ları daha güvenilir yakalamak için MarkCache ve UncompressedCache verilerini farklı şekillerde ayırmak için Clickhouse'a eklendi [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) -- Python util backports ve changelogs ile yardımcı olmak için. [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([I ivanvan](https://github.com/abyss7)) - -## ClickHouse sürümü 19.5 {#clickhouse-release-19-5} - -### ClickHouse yayın 19.5.4.22, 2019-05-13 {#clickhouse-release-19-5-4-22-2019-05-13} - -#### Hata düzeltmeleri {#bug-fixes-5} - -- Bitmap sabit Olası kazasında \* fonksiyonlar [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([Andy Yang](https://github.com/andyyzh)) -- Sistemden en az iki seçmeyi içeren UNION ile bir sorgu yürütülürken gerçekleşebilecek çok nadir veri yarışı durumu düzeltildi.sütunlar, sistem.tablolar, sistem.parçalar, sistem.parts\_tables veya birleştirme ailesinin tabloları ve ilgili tabloların sütunlarının aynı anda değiştirilmesi. [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit hata `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. Bu hata, lowcardinality sütunu birincil anahtarın bir parçasıysa oldu. \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Tutma işlevinin değiştirilmesi: bir satır hem ilk hem de n. koşulu yerine getirirse, veri durumuna yalnızca ilk tatmin edilen koşul eklenir. Şimdi bir veri satırında tatmin eden tüm koşullar veri durumuna eklenir. [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) - -### ClickHouse yayın 19.5.3.8, 2019-04-18 {#clickhouse-release-19-5-3-8-2019-04-18} - -#### Hata düzeltmeleri {#bug-fixes-6} - -- Sabit ayar türü `max_partitions_per_insert_block` boolean'dan Uint64'e. [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([Muhammed Hüseyin Sekhavat](https://github.com/mhsekhavat)) - -### ClickHouse yayın 19.5.2.6, 2019-04-15 {#clickhouse-release-19-5-2-6-2019-04-15} - -#### Yenilik {#new-features-4} - -- [Hyperscan](https://github.com/intel/hyperscan) çoklu düzenli ifade eşleştirme eklendi (fonksiyonlar `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) -- `multiSearchFirstPosition` işlevi eklendi. [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) -- Tablolar için satır başına önceden tanımlanmış ifade filtresini uygulayın. [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([I ivanvan](https://github.com/abyss7)) -- Bloom filtrelerine dayalı endeksleri atlama veri yeni bir tür (için kullanılabilir `equal`, `in` ve `like` işlevler). [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([Nikita Vasilev](https://github.com/nikvas0)) -- Katma `ASOF JOIN` bilinen en son değere katılan sorguları çalıştırmaya izin verir. [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) -- Birden fazla yeniden yaz `COMMA JOIN` -e doğru `CROSS JOIN`. Sonra onları yeniden yaz `INNER JOIN` mümkünse. [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Geliştirme {#improvement-9} - -- `topK` ve `topKWeighted` Şimdi özel destekler `loadFactor` (düzeltmeler sorunu [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([Kirill Danshin](https://github.com/kirillDanshin)) -- Kullanmasına izin ver `parallel_replicas_count > 1` örnekleme olmadan tablolar için bile (ayar sadece onlar için göz ardı edilir). Önceki sürümlerde istisna yol oldu. [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) -- İçin destek `CREATE OR REPLACE VIEW`. Bir görünüm oluşturmak veya tek bir deyimde yeni bir tanım ayarlamak için izin ver. [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) -- `Buffer` tablo motoru şimdi destekler `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([Yangkuan Liu](https://github.com/LiuYangkuan)) -- Zookeeper içinde meta veri olmadan çoğaltılmış tablo başlatmak için yeteneği ekleyin `readonly` modu. [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([alesapin](https://github.com/alesapin)) -- Clickhouse-client ilerleme çubuğunun sabit titreme. Kullanırken sorun en dikkat çekiciydi `FORMAT Null` akış sorguları ile. [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İle işlevleri devre dışı bırakmak için izin ver `hyperscan` potansiyel olarak aşırı ve kontrolsüz kaynak kullanımını sınırlamak için kullanıcı bazında kütüphane. [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tüm hatalarda sürüm numarası günlüğü ekleyin. [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) -- Kısıtlama eklendi `multiMatch` içine sığacak şekilde dize boyutu gerektiren işlevler `unsigned int`. Ayrıca bağımsız değişken sayısı sınırı eklendi `multiSearch` işlevler. [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) -- Hyperscan çizik alanı ve hata işleme geliştirilmiş kullanımı. [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) -- Doldurma `system.graphite_detentions` bir tablo yapılandırmasından `*GraphiteMergeTree` motor tabloları. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Adlandırmak `trigramDistance` fonksiyonu için `ngramDistance` ve daha fazla fonksiyon ekleyin `CaseInsensitive` ve `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) -- Geliştirilmiş veri endeksleri hesaplama atlama. [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([Nikita Vasilev](https://github.com/nikvas0)) -- Sıradan tutmak, `DEFAULT`, `MATERIALIZED` ve `ALIAS` tek bir listedeki sütunlar (düzeltmeler sorunu [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -#### Hata Düzeltme {#bug-fix-26} - -- Önlemek `std::terminate` bellek ayırma hatası durumunda. Şimdi `std::bad_alloc` istisna beklendiği gibi atılır. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tampondan capnproto okumasını düzeltir. Bazen dosyalar HTTP tarafından başarıyla yüklenmedi. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Hatayı Düzelt `Unknown log entry type: 0` sonra `OPTIMIZE TABLE FINAL` sorgu. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Kuşu](https://github.com/amosbird)) -- Yanlış argümanlar `hasAny` veya `hasAll` fonksiyonlar segfault yol açabilir. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yürütme sırasında kilitlenme oluşabilir `DROP DATABASE dictionary` sorgu. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tanımsız davranışı düzeltin `median` ve `quantile` işlevler. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- Sıkıştırma seviyesi algılamasını ne zaman düzeltin `network_compression_method` küçük harfle. V19. 1'de kırık. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- Sabit ceh ofalet `UTC` ayar (düzeltmeler sorunu [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- Düzeltmek `histogram` fonksiyon davranışı ile `Distributed` Tablolar. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- Sabit tsan raporu `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Nedeniyle sistem günlükleri kullanımında yarış durumuna kapatma sabit TSan raporu. Part\_log etkinleştirildiğinde kapatma sırasında sabit potansiyel kullanım sonrası serbest. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Parçaları tekrar kontrol edin `ReplicatedMergeTreeAlterThread` hata durumunda. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ara toplama işlev durumlarındaki aritmetik işlemler sabit argümanlar (alt sorgu sonuçları gibi) için çalışmadı. [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Her zaman meta veri sütun adlarını backquote. Aksi takdirde, adlandırılmış sütunlu bir tablo oluşturmak imkansızdır `index` (sunucu hatalı biçimlendirilmiş nedeniyle yeniden başlatılmaz `ATTACH` metadata sorgu). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Çökmeyi düzeltin `ALTER ... MODIFY ORDER BY` üzerinde `Distributed` Tablo. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- Segfault'u düzeltin `JOIN ON` ile etkin `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Kış Zhang](https://github.com/zhang2014)) -- Kafka'dan bir protobuf mesajı tükettikten sonra yabancı bir satır ekleyerek hatayı düzeltin. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- 'Nin çökmesini düzeltin `JOIN` null olmayan vs null sütun üzerinde. Düzeltmek `NULLs` sağ tuş inlarda `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) -- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Sabit yarış durumu `SELECT` itibaren `system.tables` tablo aynı anda yeniden adlandırılırsa veya değiştirilirse. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Zaten eskimiş olan veri bölümünü getirirken sabit veri yarışı. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sırasında meydana gelebilecek sabit nadir veri yarışı `RENAME` MergeTree ailesinin tablo. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fonksiyonda sabit segmentasyon hatası `arrayIntersect`. Fonksiyon karışık sabit ve sıradan argümanlarla çağrılırsa segmentasyon hatası olabilir. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Çökmeyi düzeltin `FULL/RIGHT JOIN` biz nullable vs değil nullable üzerinde katılırken. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Düzeltmek `No message received` kopyaları arasındaki parçaları getirirken istisna. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- Sabit `arrayIntersect` tek dizide birkaç tekrarlanan değerler durumunda işlev yanlış sonuç. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Eşzamanlı sırasında bir yarış durumunu düzeltin `ALTER COLUMN` bir sunucu çökmesine neden olabilecek sorgular (düzeltmeler sorunu [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- Yanlış sonucu düzeltin `FULL/RIGHT JOIN` const sütunu ile. [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) -- Çiftleri düzeltin `GLOBAL JOIN` yıldız işareti ile. [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) -- Parametre kesintisini düzeltin `ALTER MODIFY` of Col ofum ofn `CODEC` sütun türü belirtilmediğinde. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- İşlevler `cutQueryStringAndFragment()` ve `queryStringAndFragment()` şimdi ne zaman doğru çalışıyor `URL` bir parça ve hiçbir sorgu içerir. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ayarlarken nadir hatayı düzeltin `min_bytes_to_use_direct_io` iş parçacığı sütun dosyasında geriye aramak zorunda olduğunda oluşan sıfırdan büyüktür. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- Toplama işlevleri için yanlış argüman türlerini düzeltin `LowCardinality` argümanlar (düzeltmeler sorunu [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Yanlış isim kalifikasyonunu düzeltin `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) -- Düzeltme fonksiyonu `toISOWeek` 1970 yılı için sonuç. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltmek `DROP`, `TRUNCATE` ve `OPTIMIZE` sorgular, çoğaltma, dosya üzerinde `ON CLUSTER` için `ReplicatedMergeTree*` tablolar aile. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-8} - -- Ayarı yeniden adlandır `insert_sample_with_metadata` ayarlamak `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) -- Ayar eklendi `max_partitions_per_insert_block` (varsayılan değer 100 ile). Eklenen blok daha fazla sayıda bölüm içeriyorsa, bir özel durum atılır. Sınırı kaldırmak istiyorsanız 0 olarak ayarlayın (önerilmez). [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Çoklu arama işlevleri yeniden adlandırıldı (`multiPosition` -e doğru `multiSearchAllPositions`, `multiSearch` -e doğru `multiSearchAny`, `firstMatch` -e doğru `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) - -#### Performans İyileştirme {#performance-improvement-6} - -- Birçok İğne veya birçok benzer bigrams ile sorgular için yaklaşık %5-10 arama iyileştirme vererek, inlining tarafından volnitsky searcher Optimize edin. [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) -- Ayarlarken performans sorununu düzeltin `use_uncompressed_cache` önbellekte bulunan tüm okuma verileri göründüğünde ortaya çıkan sıfırdan büyüktür. [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([alesapin](https://github.com/alesapin)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-10} - -- Sertleştirme hata ayıklama yapı: daha ayrıntılı bellek eşlemeleri ve ASLR; ışareti önbellek ve dizin için bellek koruması ekleyin. Bu ASan ve MSan bunu yapamaz durumda daha fazla bellek stomping hata bulmanızı sağlar. [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cmake değişkenleri için destek Ekle `ENABLE_PROTOBUF`, `ENABLE_PARQUET` ve `ENABLE_BROTLI` yukarıdaki özellikleri etkinleştirmeye / devre dışı bırakmaya izin verir (librdkafka, mysql, vb.için yapabileceğimiz gibi). [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) -- Bazı sorgular test çalıştırıldıktan sonra asılırsa, işlem listesi ve tüm iş parçacıklarının stacktraces yazdırmak için yeteneği ekleyin. [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([alesapin](https://github.com/alesapin)) -- Yeniden deneme Ekle `Connection loss` er errorror in `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([alesapin](https://github.com/alesapin)) -- Vagrant ile freebsd build ekleyin ve packager komut dosyasına iş parçacığı sanitizer ile oluşturun. [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([alesapin](https://github.com/alesapin)) -- Şimdi kullanıcı kullanıcı için şifre istedi `'default'` kurulum sırasında. [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) -- İçinde uyarı bastır warningmak `rdkafka` kitaplık. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ssl olmadan oluşturma yeteneğine izin ver. [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) -- Clickhouse-sunucu görüntüsünü özel bir kullanıcıdan başlatmanın bir yolunu ekleyin. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Contrib Boost'u 1.69'a yükseltin. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) -- Kullanımını devre dışı bırak `mremap` iplik dezenfektanı ile derlendiğinde. Şaşırtıcı bir şekilde, TSan kesişmiyor `mremap` (kes doesmesine rağmen `mmap`, `munmap`) bu yanlış pozitiflere yol açar. Durumsal testlerde sabit TSan raporu. [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- HTTP arayüzü üzerinden biçim şemasını kullanarak test denetimi ekleyin. [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([Vitaly Baranov](https://github.com/vitlibar)) - -## ClickHouse sürüm 19.4 {#clickhouse-release-19-4} - -### ClickHouse yayın 19.4.4.33, 2019-04-17 {#clickhouse-release-19-4-4-33-2019-04-17} - -#### Hata Düzeltmeleri {#bug-fixes-7} - -- Önlemek `std::terminate` bellek ayırma hatası durumunda. Şimdi `std::bad_alloc` istisna beklendiği gibi atılır. [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tampondan capnproto okumasını düzeltir. Bazen dosyalar HTTP tarafından başarıyla yüklenmedi. [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([Vladislav](https://github.com/smirnov-vs)) -- Hatayı Düzelt `Unknown log entry type: 0` sonra `OPTIMIZE TABLE FINAL` sorgu. [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([Amos Kuşu](https://github.com/amosbird)) -- Yanlış argümanlar `hasAny` veya `hasAll` fonksiyonlar segfault yol açabilir. [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yürütme sırasında kilitlenme oluşabilir `DROP DATABASE dictionary` sorgu. [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tanımsız davranışı düzeltin `median` ve `quantile` işlevler. [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- Sıkıştırma seviyesi algılamasını ne zaman düzeltin `network_compression_method` küçük harfle. V19. 1'de kırık. [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- Sabit ceh ofalet `UTC` ayar (düzeltmeler sorunu [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- Düzeltmek `histogram` fonksiyon davranışı ile `Distributed` Tablolar. [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- Sabit tsan raporu `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Nedeniyle sistem günlükleri kullanımında yarış durumuna kapatma sabit TSan raporu. Part\_log etkinleştirildiğinde kapatma sırasında sabit potansiyel kullanım sonrası serbest. [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Parçaları tekrar kontrol edin `ReplicatedMergeTreeAlterThread` hata durumunda. [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ara toplama işlev durumlarındaki aritmetik işlemler sabit argümanlar (alt sorgu sonuçları gibi) için çalışmadı. [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Her zaman meta veri sütun adlarını backquote. Aksi takdirde, adlandırılmış sütunlu bir tablo oluşturmak imkansızdır `index` (sunucu hatalı biçimlendirilmiş nedeniyle yeniden başlatılmaz `ATTACH` metadata sorgu). [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Çökmeyi düzeltin `ALTER ... MODIFY ORDER BY` üzerinde `Distributed` Tablo. [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- Segfault'u düzeltin `JOIN ON` ile etkin `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([Kış Zhang](https://github.com/zhang2014)) -- Kafka'dan bir protobuf mesajı tükettikten sonra yabancı bir satır ekleyerek hatayı düzeltin. [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([Vitaly Baranov](https://github.com/vitlibar)) -- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Sabit yarış durumu `SELECT` itibaren `system.tables` tablo aynı anda yeniden adlandırılırsa veya değiştirilirse. [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Zaten eskimiş olan veri bölümünü getirirken sabit veri yarışı. [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sırasında meydana gelebilecek sabit nadir veri yarışı `RENAME` MergeTree ailesinin tablo. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fonksiyonda sabit segmentasyon hatası `arrayIntersect`. Fonksiyon karışık sabit ve sıradan argümanlarla çağrılırsa segmentasyon hatası olabilir. [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([Lixiang Qian](https://github.com/fancyqlx)) -- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Düzeltmek `No message received` kopyaları arasındaki parçaları getirirken istisna. [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([alesapin](https://github.com/alesapin)) -- Sabit `arrayIntersect` tek dizide birkaç tekrarlanan değerler durumunda işlev yanlış sonuç. [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Eşzamanlı sırasında bir yarış durumunu düzeltin `ALTER COLUMN` bir sunucu çökmesine neden olabilecek sorgular (düzeltmeler sorunu [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- Parametre kesintisini düzeltin `ALTER MODIFY` of Col ofum ofn `CODEC` sütun türü belirtilmediğinde. [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([alesapin](https://github.com/alesapin)) -- İşlevler `cutQueryStringAndFragment()` ve `queryStringAndFragment()` şimdi ne zaman doğru çalışıyor `URL` bir parça ve hiçbir sorgu içerir. [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([Vitaly Baranov](https://github.com/vitlibar)) -- Ayarlarken nadir hatayı düzeltin `min_bytes_to_use_direct_io` iş parçacığı sütun dosyasında geriye aramak zorunda olduğunda oluşan sıfırdan büyüktür. [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([alesapin](https://github.com/alesapin)) -- Toplama işlevleri için yanlış argüman türlerini düzeltin `LowCardinality` argümanlar (düzeltmeler sorunu [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Düzeltme fonksiyonu `toISOWeek` 1970 yılı için sonuç. [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltmek `DROP`, `TRUNCATE` ve `OPTIMIZE` sorgular, çoğaltma, dosya üzerinde `ON CLUSTER` için `ReplicatedMergeTree*` tablolar aile. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([alesapin](https://github.com/alesapin)) - -#### Geliştirmeler {#improvements-2} - -- Sıradan tutmak, `DEFAULT`, `MATERIALIZED` ve `ALIAS` tek bir listedeki sütunlar (düzeltmeler sorunu [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -### ClickHouse yayın 19.4.3.11, 2019-04-02 {#clickhouse-release-19-4-3-11-2019-04-02} - -#### Hata Düzeltmeleri {#bug-fixes-8} - -- Çökmeyi düzeltin `FULL/RIGHT JOIN` biz nullable vs değil nullable üzerinde katılırken. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-11} - -- Clickhouse-sunucu görüntüsünü özel bir kullanıcıdan başlatmanın bir yolunu ekleyin. [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### ClickHouse sürümü 19.4.2.7, 2019-03-30 {#clickhouse-release-19-4-2-7-2019-03-30} - -#### Hata Düzeltmeleri {#bug-fixes-9} - -- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### ClickHouse yayın 19.4.1.3, 2019-03-19 {#clickhouse-release-19-4-1-3-2019-03-19} - -#### Hata Düzeltmeleri {#bug-fixes-10} - -- Her ikisini de içeren sabit uzak sorgular `LIMIT BY` ve `LIMIT`. Daha önce `LIMIT BY` ve `LIMIT` uzak sorgu için kullanıldı, `LIMIT` daha önce olabilirdi `LIMIT BY`, çok filtrelenmiş sonuca yol açtı. [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([Constantin S. Pan](https://github.com/kvap)) - -### ClickHouse yayın 19.4.0.49, 2019-03-09 {#clickhouse-release-19-4-0-49-2019-03-09} - -#### Yenilik {#new-features-5} - -- İçin tam destek eklendi `Protobuf` biçim (giriş ve çıkış, iç içe veri yapıları). [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([Vitaly Baranov](https://github.com/vitlibar)) -- Kükreyen bitmapler ile bitmap fonksiyonları eklendi. [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([Andy Yang](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([Vitaly Baranov](https://github.com/vitlibar)) -- Parke formatı desteği. [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) -- Bulanık dize karşılaştırması için N-gram mesafesi eklendi. R dilinde q-gram ölçümlerine benzer. [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) -- Özel toplama ve tutma kalıplarından grafit toplaması için kuralları birleştirin. [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Katma `max_execution_speed` ve `max_execution_speed_bytes` kaynak kullanımını sınırlamak için. Katma `min_execution_speed_bytes` Tamam tolayacak ayar `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([Kış Zhang](https://github.com/zhang2014)) -- Uygulanan işlev `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([alexey-milovidov](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) -- Eklenen fonksiyonlar `arrayEnumerateDenseRanked` ve `arrayEnumerateUniqRanked` (sanki `arrayEnumerateUniq` ancak, çok boyutlu dizilerin içine bakmak için dizi derinliğini ince ayarlamaya izin verir). [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Hata Düzeltmeleri {#bug-fixes-11} - -- Bu sürüm aynı zamanda 19.3 ve 19.1 tüm hata düzeltmeleri içerir. -- Veri atlama endekslerinde Sabit hata: İNSERTTEN sonra granüllerin sırası yanlıştı. [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([Nikita Vasilev](https://github.com/nikvas0)) -- Sabit `set` Ind Forex for `Nullable` ve `LowCardinality` sütun. Ondan önce, `set` ile ind withex `Nullable` veya `LowCardinality` sütun hataya yol açtı `Data type must be deserialized with multiple streams` seçerken. [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Update\_time'ı tam olarak doğru şekilde ayarlayın `executable` sözlük güncelleme. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) -- 19.3'te kırık ilerleme çubuğunu düzeltin. [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) -- Belirli durumlarda bellek bölgesi küçüldüğünde Memorytracker'ın tutarsız değerleri düzeltildi. [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ThreadPool sabit tanımsız davranış. [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mesajla çok nadir bir kaza düzeltildi `mutex lock failed: Invalid argument` bu, bir MERGETREE tablosu bir SELECT ile aynı anda bırakıldığında gerçekleşebilir. [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) -- ODBC sürücüsü ile uyumluluk `LowCardinality` veri türü. [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) -- FreeBSD: için düzeltme `AIOcontextPool: Found io_event with unknown id 0` hatasız. [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `system.part_log` tablo yapılandırmaya bakılmaksızın oluşturuldu. [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tanımsız davranışı düzeltin `dictIsIn` önbellek sözlükler için işlev. [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([alesapin](https://github.com/alesapin)) -- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) -- Biz kendi elde edene kadar varsayılan olarak compile\_expressions devre dışı bırakın `llvm` contrib ve ile test edebilirsiniz `clang` ve `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([alesapin](https://github.com/alesapin)) -- Önlemek `std::terminate` ne zaman `invalidate_query` için `clickhouse` dış sözlük kaynağı yanlış resultset döndürdü (boş veya birden fazla satır veya birden fazla sütun). Sabit sorun ne zaman `invalidate_query` ne olursa olsun her beş saniyede yapıldı `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kilitlenme önlemek zaman `invalidate_query` ile bir sözlük için `clickhouse` kaynak içeren oldu `system.dictionaries` tablo veya `Dictionaries` veritabanı (nadir durum). [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Çapraz için düzeltmeler boş nerede ile katılmak. [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) -- Fonksiyon sabit segfault “replicate” sabit argüman geçirildiğinde. [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yükleme doktoru ile Lambda işlevini düzeltin. [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([Kış Zhang](https://github.com/zhang2014)) -- Birden çok düzeltmeleri katıldı. [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Geliştirmeler {#improvements-3} - -- Sağ tablo sütunları için JOİN on bölümündeki takma adları destekleyin. [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) -- Birden fazla sonuç subselects kullanılacak doğru sonucu ismi Katıldı. Düz takma adları kaynak adları ile sonuç olarak değiştirin. [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) -- Birleştirilmiş ifadeler için aşağı itme mantığını geliştirin. [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([I ivanvan](https://github.com/abyss7)) - -#### Performans İyileştirmeleri {#performance-improvements-3} - -- Geliştirilmiş sezgisel “move to PREWHERE” optimizasyon. [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- 8-bit ve 16-bit anahtarlar için HashTable API kullanan uygun arama tabloları kullanın. [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([Amos Kuşu](https://github.com/amosbird)) -- Dize karşılaştırma geliştirilmiş performans. [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Ayrı bir iş parçacığında dağıtılmış DDL kuyruğunu temizleme, böylece dağıtılmış DDL görevlerini işleyen ana döngüyü yavaşlatmaz. [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) -- Ne zaman `min_bytes_to_use_direct_io` 1 olarak ayarlanır, her dosya O\_DİRECT modu ile açılmamıştır, çünkü okunacak veri boyutu bazen sıkıştırılmış bir bloğun boyutuna göre hafife alınmıştır. [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-12} - -- Clang-9 için destek eklendi [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yanlış Düzelt `__asm__` talimatlar (tekrar) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) -- Ayarları belirtmek için yeteneği ekleyin `clickhouse-performance-test` komut satırından. [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([alesapin](https://github.com/alesapin)) -- Entegrasyon testlerine sözlükler testleri ekleyin. [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([alesapin](https://github.com/alesapin)) -- Otomatik performans testlerine web sitesinde kriter sorguları eklendi. [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `xxhash.h` harici lz4'te mevcut değildir, çünkü bir uygulama ayrıntısıdır ve sembolleri ile adlandır `XXH_NAMESPACE` makro. Lz4 harici olduğunda, xxHash da harici olmalı ve bağımlıların buna bağlanması gerekir. [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Orivej Desh](https://github.com/orivej)) -- Sabit bir durumda zaman `quantileTiming` toplama işlevi, negatif veya kayan nokta argümanı ile çağrılabilir (bu, tanımsız davranış dezenfektanı ile fuzz testini düzeltir). [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yazım hatası düzeltme. [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) -- Mac'te derlemeyi düzeltin. [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([Vitaly Baranov](https://github.com/vitlibar)) -- FreeBSD ve çeşitli sıradışı yapı yapılandırmaları için düzeltmeler oluşturun. [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) - -## ClickHouse sürümü 19.3 {#clickhouse-release-19-3} - -### ClickHouse yayın 19.3.9.1, 2019-04-02 {#clickhouse-release-19-3-9-1-2019-04-02} - -#### Hata Düzeltmeleri {#bug-fixes-12} - -- Çökmeyi düzeltin `FULL/RIGHT JOIN` biz nullable vs değil nullable üzerinde katılırken. [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- Segmentasyon hatasını düzeltin `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- Sabit okuma `Array(LowCardinality)` sütun nadir durumda, sütun uzun bir boş diziler dizisi içerdiğinde. [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-13} - -- Özel bir kullanıcıdan clickhouse-server görüntüsünü başlatmak için bir yol ekleyin [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### ClickHouse yayın 19.3.7, 2019-03-12 {#clickhouse-release-19-3-7-2019-03-12} - -#### Hata düzeltmeleri {#bug-fixes-13} - -- \#3920'de Sabit hata. Bu hata kendisini rasgele önbellek bozulması (mesajlar) olarak gösterir `Unknown codec family code`, `Cannot seek through file`) ve segfaults. Bu hata ilk olarak 19.1 sürümünde ortaya çıktı ve 19.1.10 ve 19.3.6'ya kadar olan sürümlerde mevcut. [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse yayın 19.3.6, 2019-03-02 {#clickhouse-release-19-3-6-2019-03-02} - -#### Hata düzeltmeleri {#bug-fixes-14} - -- Bir iş parçacığı havuzunda 1000'den fazla iş parçacığı olduğunda, `std::terminate` iş parçacığı çıkışında meydana gelebilir. [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi oluşturmak mümkün `ReplicatedMergeTree*` varsayılanları olmayan sütunlarda yorumlar içeren tablolar ve yorum ve varsayılanları olmayan sütun kodekleri içeren tablolar. Ayrıca codec karşılaştırmasını düzeltin. [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([alesapin](https://github.com/alesapin)) -- Dizi veya tuple ile katılmak sabit kazasında. [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) -- Clickhouse sabit kazasında-mesaj ile fotokopi `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) -- Dağıtılmış DDL kullanılmışsa, sunucu kapanmasında sabit kapatma. [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) -- Yanlış sütun numaraları, 10'dan büyük sayı ile sütunlar için ayrıştırma metin biçimi hakkında hata iletisinde yazdırıldı. [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-3} - -- Avx etkin sabit yapı. [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Genişletilmiş muhasebe ve IO muhasebesini, derlendiği çekirdek yerine iyi bilinen sürüme göre etkinleştirin. [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([nvartolomei](https://github.com/nvartolomei)) -- Core\_dump ayarını atlamaya izin ver.size\_limit, limit set başarısız olursa atmak yerine uyarı. [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) -- Kaldır theılan `inline` tags of `void readBinary(...)` içinde `Field.cpp`. Ayrıca birleştirilmiş gereksiz `namespace DB` Bloklar. [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) - -### ClickHouse yayın 19.3.5, 2019-02-21 {#clickhouse-release-19-3-5-2019-02-21} - -#### Hata düzeltmeleri {#bug-fixes-15} - -- Büyük http ekleme sorguları işleme ile Sabit hata. [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([alesapin](https://github.com/alesapin)) -- Yanlış uygulama nedeniyle eski sürümlerle geriye dönük uyumsuzluk düzeltildi `send_logs_level` ayar. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tablo fonksiyonunun geriye dönük uyumsuzluğu düzeltildi `remote` sütun yorumları ile tanıtıldı. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse yayın 19.3.4, 2019-02-16 {#clickhouse-release-19-3-4-2019-02-16} - -#### Geliştirmeler {#improvements-4} - -- Yaparken tablo dizin boyutu bellek sınırları için hesaplandı değil `ATTACH TABLE` sorgu. Bir tablo müstakil sonra eklenemez olasılığını Kaçınılması. [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Zookeeper'dan alınan maksimum dize ve dizi boyutu üzerindeki sınırı hafifçe yükseltti. Bu artan boyutu ile çalışmaya devam sağlar `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` ZooKeeper üzerinde. [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Zaten kendi kuyruğunda düğümlerin çok sayıda olsa bile terk edilmiş çoğaltma onarmak için izin verin. [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bir gerekli argüman Ekle `SET` dizin (en fazla saklanan satır numarası). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) - -#### Hata Düzeltmeleri {#bug-fixes-16} - -- Sabit `WITH ROLLUP` tek grup için sonuç `LowCardinality` anahtar. [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Set dizinindeki Sabit hata (daha fazlasını içeriyorsa bir granül bırakarak `max_rows` satırlar). [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([Nikita Vasilev](https://github.com/nikvas0)) -- Bir sürü FreeBSD yapı düzeltmesi. [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) -- Aynı takma ad içeren alt sorgularla sorgularda sabit takma ad değiştirme (sorun [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-4} - -- Çalıştırmak için yeteneği ekleyin `clickhouse-server` docker ımage vatansız testler için. [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([Vasily Nemkov](https://github.com/Enmk)) - -### ClickHouse yayın 19.3.3, 2019-02-13 {#clickhouse-release-19-3-3-2019-02-13} - -#### Yenilik {#new-features-6} - -- Add theed the `KILL MUTATION` bazı nedenlerle sıkışmış olan mutasyonların giderilmesine izin veren ifade. Katma `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` alanlar için `system.mutations` daha kolay sorun giderme için tablo. [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) -- Toplama fonksiyonu eklendi `entropy` Shannon entropisini hesaplar. [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) -- Sorguları göndermek için yeteneği eklendi `INSERT INTO tbl VALUES (....` yarat withoutmadan sunucuya `query` ve `data` parçalar. [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([alesapin](https://github.com/alesapin)) -- Genel uygulama `arrayWithConstant` işlevi eklendi. [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Uyguluyordu `NOT BETWEEN` karşılaştırma operatörü. [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) -- Uygulamak `sumMapFiltered` değerlerin toplanacağı anahtar sayısını sınırlayabilmek için `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Desteği eklendi `Nullable` yazmak `mysql` tablo işlevi. [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) -- İçinde keyfi sabit ifadeler için destek `LIMIT` yan. [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) -- Katma `topKWeighted` (imzasız tamsayı) ağırlığı ile ek argüman alır toplama işlevi. [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([Andrew Golman](https://github.com/andrewgolman)) -- `StorageJoin` şimdi destekler `join_any_take_last_row` aynı anahtarın varolan değerlerinin üzerine yazmayı sağlayan ayar. [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([Amos Kuşu](https://github.com/amosbird) -- Eklendi fonksiyonu `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([Vitaly Baranov](https://github.com/vitlibar)) -- Katma `RowBinaryWithNamesAndTypes` biçimli. [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V. Kozlyuk](https://github.com/DarkWanderer)) -- Katma `IPv4` ve `IPv6` veri türleri. Daha etkili uygulamalar `IPv*` işlevler. [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([Vasily Nemkov](https://github.com/Enmk)) -- Eklendi fonksiyonu `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([Vitaly Baranov](https://github.com/vitlibar)) -- Katma `Protobuf` çıkış biçimi. [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([Vitaly Baranov](https://github.com/vitlibar)) -- Veri içe aktarma (ekler) için HTTP arayüzü için brotli desteği eklendi. [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([Mikhail](https://github.com/fandyushin)) -- Kullanıcı işlev adına yazım hatası yaparken veya komut satırı istemcisinde yazarken ipuçları eklendi. [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) -- Katma `Query-Id` sunucunun HTTP yanıt başlığına. [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([Mikhail](https://github.com/fandyushin)) - -#### Deneysel özellikler {#experimental-features-2} - -- Katma `minmax` ve `set` MergeTree tablo motorları ailesi için veri atlama endeksleri. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- Eklenen dönüşüm `CROSS JOIN` -e doğru `INNER JOIN` mümkünse. [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Hata Düzeltmeleri {#bug-fixes-17} - -- Sabit `Not found column` yinelenen sütunlar için `JOIN ON` bölme. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Yapmak `START REPLICATED SENDS` komut Başlat çoğaltılmış gönderir. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- Sabit toplam fonksiyonları yürütme ile `Array(LowCardinality)` değişkenler. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Yaparken yanlış davranış düzeltildi `INSERT ... SELECT ... FROM file(...)` sorgu ve dosya var `CSVWithNames` veya `TSVWIthNames` biçim ve ilk veri satırı eksik. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sözlük mevcut değilse sözlük yeniden sabit kazasında. Bu hata 19.1.6'da ortaya çıktı. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- Sabit `ALL JOIN` sağ tabloda çiftleri ile. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Sabit segmentasyon hatası `use_uncompressed_cache=1` ve yanlış sıkıştırılmamış boyutta istisna. Bu hata 19.1.6'da ortaya çıktı. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- Sabit `compile_expressions` büyük (ınt16'dan daha fazla) tarihlerin karşılaştırılması ile hata. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- Tablo işlevinden seçerken sabit sonsuz döngü `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yüklem optimizasyonunu geçici olarak devre dışı bırak `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Kış Zhang](https://github.com/zhang2014)) -- Sabit `Illegal instruction` eski CPU'larda base64 işlevlerini kullanırken hata. Bu hata yalnızca ClickHouse gcc-8 ile derlendiğinde yeniden üretildi. [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit `No message received` TLS bağlantısı üzerinden PostgreSQL ODBC sürücüsü ile etkileşimde bulunurken hata. MySQL ODBC sürücüsü kullanırken de segfault giderir. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit yanlış sonuç ne zaman `Date` ve `DateTime` argümanlar koşullu operatörün dallarında kullanılır (işlev `if`). Fonksiyon için genel durum eklendi `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse sözlükler şimdi içinde yük `clickhouse` işleyiş. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit kilitlenme zaman `SELECT` ile bir tablo fromdan `File` motor sonra yeniden denendi `No such file or directory` hatasız. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Seçerken sabit yarış durumu `system.tables` verebilir `table doesn't exist` hatasız. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `clickhouse-client` etkileşimli modda çalıştırıldıysa, komut satırı önerileri için veri yüklerken çıkışta segfault yapabilir. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçeren mutasyonların yürütülmesi bir hata düzeltildi `IN` operatörler yanlış sonuçlar üretiyordu. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- Sabit hata: bir veritabanı varsa `Dictionary` motor, tüm sözlükler sunucu başlangıçta yüklemeye zorlanır ve localhost'tan ClickHouse kaynağı olan bir sözlük varsa, sözlük yüklenemez. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sistem günlükleri sunucu kapatma yeniden oluşturmak için denendiğinde hata düzeltildi. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Doğru türü doğru şekilde döndürün ve kilitleri düzgün şekilde tutun `joinGet` işlev. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Kuşu](https://github.com/amosbird)) -- Katma `sumMapWithOverflow` işlev. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Sabit segfault ile `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) -- Yanlış ile Sabit hata `Date` ve `DateTime` karşılaştırma. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- Tanımsız davranış sanitizer altında sabit fuzz testi: eklendi parametre tipi kontrol için `quantile*Weighted` fonksiyonlar ailesi. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eski veri parçalarının çıkarılması ile başarısız olabilir sabit nadir yarış durumu `File not found` hatasız. [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eksik /etc/clickhouse-server/config ile paketi yükleyin.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-5} - -- Debian paketi: yapılandırmaya göre /etc/clickhouse-server/preprocessed bağlantısını düzeltin. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- FreeBSD için çeşitli yapı düzeltmeleri. [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) -- Perftest'te tablolar oluşturma, doldurma ve bırakma yeteneği eklendi. [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([alesapin](https://github.com/alesapin)) -- Yinelenen kontrol etmek için bir komut dosyası eklendi içerir. [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Performans testinde dizin sorguları çalıştırmak için yeteneği eklendi. [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([alesapin](https://github.com/alesapin)) -- Hata ayıklama sembolleri ile paket yüklü olması önerilir. [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Performansın yeniden düzenlenmesi-test. Daha iyi günlüğü ve sinyalleri işleme. [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([alesapin](https://github.com/alesapin)) -- Anonimleştirilmiş yandex'e dokümanlar eklendi.Metrika veri setleri. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([alesapin](https://github.com/alesapin)) -- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) -- S3'te iki veri kümesi hakkında dokümanlar eklendi. [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([alesapin](https://github.com/alesapin)) -- Çekme istekleri açıklamasından changelog oluşturan komut dosyası eklendi. [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- ClickHouse için kukla modülü eklendi. [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- Bir grup belgesiz işlev için dokümanlar eklendi. [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([Kış Zhang](https://github.com/zhang2014)) -- Arm yapı düzeltmeleri. [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) -- Sözlük testleri artık çalıştırmak mümkün `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) -- Şimdi `/etc/ssl` SSL sertifikaları ile varsayılan dizin olarak kullanılır. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Başlangıçta SSE ve AVX talimat kontrol eklendi. [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) -- İnit betiği, başlayana kadar sunucuyu bekleyecektir. [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) - -#### Geriye Dönük Uyumsuz Değişiklikler {#backward-incompatible-changes-1} - -- Kaldırıyordu `allow_experimental_low_cardinality_type` ayar. `LowCardinality` veri türleri üretime hazırdır. [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kullanılabilir bellek miktarına göre işaretle önbellek boyutunu ve sıkıştırılmamış önbellek boyutunu azaltın. [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) -- Eklenen anahtar kelime `INDEX` içinde `CREATE TABLE` sorgu. Adı olan bir sütun `index` backticks veya çift tırnak ile alıntı olmalıdır: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([Nikita Vasilev](https://github.com/nikvas0)) -- `sumMap` şimdi taşma yerine sonuç türünü tanıtın. Eskiler `sumMap` davranış kullanılarak elde edilebilir `sumMapWithOverflow` işlev. [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) - -#### Performans İyileştirmeleri {#performance-improvements-4} - -- `std::sort` yerine göre `pdqsort` olmadan sorgular için `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) -- Şimdi sunucu, genel iş parçacığı havuzundan iş parçacıklarını yeniden kullanır. Bu, bazı köşe durumlarda performansı etkiler. [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Geliştirmeler {#improvements-5} - -- FreeBSD için AIO desteği uygulandı. [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `SELECT * FROM a JOIN b USING a, b` şimdi geri dön `a` ve `b` sadece sol tablodan sütunlar. [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) -- Vermek `-C` olarak çalışmak için müşterinin seçeneği `-c` seçenek. [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) -- Şimdi seçenek `--password` değer olmadan kullanılan stdın'den şifre gerektirir. [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) -- İçeren dize değişmezleri unescaped metacharacters eklendi vurgulama `LIKE` ifadeler veya regexps. [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İstemci soketi kaybolursa HTTP salt okunur sorgularının iptal edilmesi eklendi. [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([nvartolomei](https://github.com/nvartolomei)) -- Şimdi sunucu, istemci bağlantılarını canlı tutmak için ilerlemeyi bildiriyor. [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([I ivanvan](https://github.com/abyss7)) -- Sorgu ile OPTİMİZE etmek için biraz daha iyi mesaj `optimize_throw_if_noop` ayar Etkin. [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Desteği eklendi `--version` clickhouse sunucusu için Seçenek. [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) -- Katma `--help/-h` seçeneği `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([Yuriy Baranov](https://github.com/yurriy)) -- Toplam işlev durumu sonucu ile skaler alt sorgular için destek eklendi. [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Geliştirilmiş sunucu kapatma süresi ve bekleme süresini değiştirir. [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sisteme replicated\_can\_become\_leader ayarı hakkında bilgi eklendi.yinelemeler ve çoğaltma lider olmaya çalışmayacaksa günlüğü ekleyin. [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) - -## ClickHouse sürümü 19.1 {#clickhouse-release-19-1} - -### ClickHouse sürümü 19.1.14, 2019-03-14 {#clickhouse-release-19-1-14-2019-03-14} - -- Sabit hata `Column ... queried more than once` bu ayar eğer gerçekleşebilir `asterisk_left_columns_only` kullanılması durumunda 1 olarak ayarlanır `GLOBAL JOIN` ile `SELECT *` (nadir bir durum). Sorun 19.3 ve daha yeni sürümlerde mevcut değil. [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) - -### ClickHouse sürümü 19.1.13, 2019-03-12 {#clickhouse-release-19-1-13-2019-03-12} - -Bu sürüm, 19.3.7 ile tam olarak aynı yamalar kümesini içerir. - -### ClickHouse sürümü 19.1.10, 2019-03-03 {#clickhouse-release-19-1-10-2019-03-03} - -Bu sürüm, 19.3.6 ile tam olarak aynı yamalar kümesini içerir. - -## ClickHouse sürümü 19.1 {#clickhouse-release-19-1-1} - -### ClickHouse sürümü 19.1.9, 2019-02-21 {#clickhouse-release-19-1-9-2019-02-21} - -#### Hata düzeltmeleri {#bug-fixes-18} - -- Yanlış uygulama nedeniyle eski sürümlerle geriye dönük uyumsuzluk düzeltildi `send_logs_level` ayar. [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tablo fonksiyonunun geriye dönük uyumsuzluğu düzeltildi `remote` sütun yorumları ile tanıtıldı. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.1.8, 2019-02-16 {#clickhouse-release-19-1-8-2019-02-16} - -#### Hata Düzeltmeleri {#bug-fixes-19} - -- Eksik /etc/clickhouse-server/config ile paketi yükleyin.xml. [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -## ClickHouse sürümü 19.1 {#clickhouse-release-19-1-2} - -### ClickHouse sürümü 19.1.7, 2019-02-15 {#clickhouse-release-19-1-7-2019-02-15} - -#### Hata Düzeltmeleri {#bug-fixes-20} - -- Doğru türü doğru şekilde döndürün ve kilitleri düzgün şekilde tutun `joinGet` işlev. [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([Amos Kuşu](https://github.com/amosbird)) -- Sistem günlükleri sunucu kapatma yeniden oluşturmak için denendiğinde hata düzeltildi. [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit hata: bir veritabanı varsa `Dictionary` motor, tüm sözlükler sunucu başlangıçta yüklemeye zorlanır ve localhost'tan ClickHouse kaynağı olan bir sözlük varsa, sözlük yüklenemez. [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçeren mutasyonların yürütülmesi bir hata düzeltildi `IN` operatörler yanlış sonuçlar üretiyordu. [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- `clickhouse-client` etkileşimli modda çalıştırıldıysa, komut satırı önerileri için veri yüklerken çıkışta segfault yapabilir. [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Seçerken sabit yarış durumu `system.tables` verebilir `table doesn't exist` hatasız. [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit kilitlenme zaman `SELECT` ile bir tablo fromdan `File` motor sonra yeniden denendi `No such file or directory` hatasız. [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bir sorun düzeltildi: yerel ClickHouse sözlükleri TCP üzerinden yüklenir, ancak işlem içinde yüklenmelidir. [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit `No message received` TLS bağlantısı üzerinden PostgreSQL ODBC sürücüsü ile etkileşimde bulunurken hata. MySQL ODBC sürücüsü kullanırken de segfault giderir. [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yüklem optimizasyonunu geçici olarak devre dışı bırak `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([Kış Zhang](https://github.com/zhang2014)) -- Tablo işlevinden seçerken sabit sonsuz döngü `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit `compile_expressions` büyük (ınt16'dan daha fazla) tarihlerin karşılaştırılması ile hata. [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([alesapin](https://github.com/alesapin)) -- Sabit segmentasyon hatası `uncompressed_cache=1` ve yanlış sıkıştırılmamış boyutta istisna. [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([alesapin](https://github.com/alesapin)) -- Sabit `ALL JOIN` sağ tabloda çiftleri ile. [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- Yaparken yanlış davranış düzeltildi `INSERT ... SELECT ... FROM file(...)` sorgu ve dosya var `CSVWithNames` veya `TSVWIthNames` biçim ve ilk veri satırı eksik. [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit toplam fonksiyonları yürütme ile `Array(LowCardinality)` değişkenler. [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Debian paketi: yapılandırmaya göre /etc/clickhouse-server/preprocessed bağlantısını düzeltin. [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- Tanımsız davranış sanitizer altında sabit fuzz testi: eklendi parametre tipi kontrol için `quantile*Weighted` fonksiyonlar ailesi. [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yapmak `START REPLICATED SENDS` komut Başlat çoğaltılmış gönderir. [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([nvartolomei](https://github.com/nvartolomei)) -- Sabit `Not found column` join on bölümündeki yinelenen sütunlar için. [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- Şimdi `/etc/ssl` SSL sertifikaları ile varsayılan dizin olarak kullanılır. [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sözlük mevcut değilse sözlük yeniden sabit kazasında. [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- Yanlış ile Sabit hata `Date` ve `DateTime` karşılaştırma. [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- Sabit yanlış sonuç ne zaman `Date` ve `DateTime` argümanlar koşullu operatörün dallarında kullanılır (işlev `if`). Fonksiyon için genel durum eklendi `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -### ClickHouse sürümü 19.1.6, 2019-01-24 {#clickhouse-release-19-1-6-2019-01-24} - -#### Yenilik {#new-features-7} - -- Tablolar için sütun sıkıştırma codec başına özel. [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([alesapin](https://github.com/alesapin), [Kış Zhang](https://github.com/zhang2014), [Anatoly](https://github.com/Sindbag)) -- Eklendi sıkıştırma codec `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([alesapin](https://github.com/alesapin)) -- İzin ver `ALTER` sıkıştırma codec. [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([alesapin](https://github.com/alesapin)) -- Eklenen fonksiyonlar `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` SQL standart uyumluluk için. [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([Ivan Blinkov](https://github.com/blinkov)) -- Yazma desteği `HDFS` tablolar ve `hdfs` tablo işlevi. [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([alesapin](https://github.com/alesapin)) -- Büyük samanlıkta birden fazla sabit dizeleri aramak için fonksiyonlar eklendi: `multiPosition`, `multiSearch` ,`firstMatch` ayrıca ile `-UTF8`, `-CaseInsensitive`, ve `-CaseInsensitiveUTF8` varyantlar. [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) -- Kullanılmayan parçaların budaması `SELECT` sharding anahtarına göre sorgu filtreleri (ayar `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [I ivanvan](https://github.com/abyss7)) -- Vermek `Kafka` blok başına bazı ayrıştırma hatalarını görmezden gelmek için motor. [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([I ivanvan](https://github.com/abyss7)) -- İçin destek eklendi `CatBoost` multiclass modelleri değerlendirme. İşlev `modelEvaluate` multiclass modelleri için sınıf başına ham tahminleri ile tuple döndürür. `libcatboostmodel.so` ile inşa edilmelidir [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Eklenen fonksiyonlar `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) -- Karma fonksiyonları eklendi `xxHash64` ve `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) -- Katma `gccMurmurHash` aynı karma tohumu kullanan karma işlevi (GCC aromalı üfürüm hash) [gcc](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) -- Karma fonksiyonları eklendi `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([shangshujie365](https://github.com/shangshujie365)) -- Eklenen tablo fonksiyonu `remoteSecure`. Fonksiyonu olarak çalışır `remote`, ancak güvenli bağlantı kullanır. [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) - -#### Deneysel özellikler {#experimental-features-3} - -- Birden fazla Katıl emımlı em emülasyon eklendi (`allow_experimental_multiple_joins_emulation` ayar). [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) - -#### Hata Düzeltmeleri {#bug-fixes-21} - -- Yapmak `compiled_expression_cache_size` bellek tüketimini azaltmak için varsayılan olarak sınırlı ayarı. [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([alesapin](https://github.com/alesapin)) -- Çoğaltılmış tabloların değiştirmelerini gerçekleştiren iş parçacıklarında ve zookeeper'dan yapılandırmayı güncelleyen iş parçacıklarında hangup'lara yol açan bir hatayı düzeltin. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) -- Dağıtılmış bir ALTER görevi yürütürken bir yarış durumu düzeltildi. Yarış durumu, görevi yürütmeye çalışan birden fazla kopyaya ve bir ZooKeeper hatasıyla başarısız olan tüm kopyalara yol açtı. [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) -- Bir hatayı düzeltin `from_zk` zookeeper zaman aşımına uğradıktan sonra yapılandırma öğeleri yenilenmedi. [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) -- IPv4 alt ağ maskeleri için yanlış önek ile hatayı düzeltin. [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([alesapin](https://github.com/alesapin)) -- Sabit kaza (`std::terminate`) nadir durumlarda, tükenmiş kaynaklar nedeniyle yeni bir iş parçacığı oluşturulamazsa. [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fix hata ne zaman `remote` In için yanlış kısıtlamalar kullanıldığında tablo işlevi yürütme `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([alesapin](https://github.com/alesapin)) -- Netlink soketleri sızıntısını düzeltin. Hiçbir zaman silinmedikleri bir havuza yerleştirildiler ve tüm geçerli soketler kullanımda olduğunda yeni bir iş parçacığının başlangıcında yeni soketler oluşturuldu. [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) -- Kapanış ile hatayı düzeltin `/proc/self/fd` tüm fds'den önceki dizin okundu `/proc` çatal sonra `odbc-bridge` alt işlem. [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([alesapin](https://github.com/alesapin)) -- Birincil anahtarda kullanım dizesi durumunda uint monotonik dönüşüm için sabit dize. [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([Kış Zhang](https://github.com/zhang2014)) -- Tamsayı dönüşüm fonksiyonu Monotonluk hesaplanmasında Sabit hata. [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit segfault içinde `arrayEnumerateUniq`, `arrayEnumerateDense` bazı geçersiz argümanlar durumunda işlevler. [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- STORAGEMERGE'DE ub'yi düzeltin. [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([Amos Kuşu](https://github.com/amosbird)) -- Fonksiyonlarda sabit segfault `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit hata: fonksiyonlar `round`, `floor`, `trunc`, `ceil` tamsayı argümanı ve büyük negatif ölçekte yürütüldüğünde sahte sonuç döndürebilir. [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tarafından uyarılan bir hata düzeltildi ‘kill query sync’ bu da bir çekirdek çöplüğüne yol açar. [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) -- Boş çoğaltma kuyruğundan sonra uzun gecikmeyle hatayı düzeltin. [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([alesapin](https://github.com/alesapin)) -- İle tabloya ekleme durumunda sabit aşırı bellek kullanımı `LowCardinality` birincil anahtar. [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Sabit `LowCardinality` için serileştirme `Native` boş diziler durumunda format. [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Tek LowCardinality sayısal sütun tarafından dıstınct kullanırken yanlış sonuç düzeltildi. [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- LowCardinality anahtarı ile sabit özel toplama (durumunda `compile` ayar etkinse) ' dir. [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Çoğaltılmış tablo sorguları için kullanıcı ve şifre iletimini düzeltin. [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([alesapin](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) -- Sözlükleri yeniden yüklerken sözlük veritabanındaki tabloları listelerken oluşabilecek çok nadir yarış durumu düzeltildi. [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Toplaması veya küp ile kullanıldığında yanlış sonuç düzeltildi. [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([Sam Chou](https://github.com/reflection)) -- Sorgu için sabit sütun takma adları `JOIN ON` sözdizimi ve dağıtılmış tablolar. [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([Kış Zhang](https://github.com/zhang2014)) -- Dahili uygulamada Sabit hata `quantileTDigest` (Artem Vakhrushev tarafından bulundu). Bu hata hiçbir zaman Clickhouse'da olmaz ve yalnızca ClickHouse kod tabanını doğrudan bir kütüphane olarak kullananlar için geçerlidir. [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Geliştirmeler {#improvements-6} - -- İçin destek `IF NOT EXISTS` içinde `ALTER TABLE ADD COLUMN` ile birlikte ifadeler `IF EXISTS` içinde `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) -- İşlev `parseDateTimeBestEffort`: format desteği `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` ve benzeri. [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- `CapnProtoInputStream` şimdi pürüzlü yapıları destekleyin. [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) -- Kullanılabilirlik iyileştirme: sunucu işleminin veri dizininin sahibinden başlatıldığı bir kontrol eklendi. Veriler kök olmayan kullanıcıya aitse, sunucunun kökünden başlatılmasına izin vermeyin. [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([sergey-v-galtsev](https://github.com/sergey-v-galtsev)) -- Birleştirme ile sorguların analizi sırasında gerekli sütunları kontrol etmenin daha iyi mantığı. [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) -- Tek bir sunucuda çok sayıda dağıtılmış tablo durumunda bağlantı sayısını azalttı. [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([Kış Zhang](https://github.com/zhang2014)) -- Desteklenen toplamlar için satır `WITH TOTALS` ODBC sürücüsü için sorgu. [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) -- Kullanmasına izin `Enum`eğer fonksiyon içinde tamsayılar olarak s. [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([I ivanvan](https://github.com/abyss7)) -- Katma `low_cardinality_allow_in_native_format` ayar. Devre dışı bırakılırsa, kullanmayın `LowCadrinality` yazmak `Native` biçimli. [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Daha düşük bellek kullanımı için derlenmiş ifadeler önbelleğinden bazı gereksiz nesneleri kaldırıldı. [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([alesapin](https://github.com/alesapin)) -- Add check that `SET send_logs_level = 'value'` sorgu uygun değeri kabul eder. [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin Maxim](https://github.com/s-mx)) -- Sabit veri türü türü dönüştürme işlevleri kontrol edin. [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([Kış Zhang](https://github.com/zhang2014)) - -#### Performans İyileştirmeleri {#performance-improvements-5} - -- MergeTree ayarı ekleme `use_minimalistic_part_header_in_zookeeper`. Etkinse, çoğaltılmış tablolar kompakt parça meta verilerini tek parça znode depolar. Bu, ZooKeeper anlık görüntü boyutunu önemli ölçüde azaltabilir (özellikle tablolarda çok fazla sütun varsa). Bu ayarı etkinleştirdikten sonra, desteklemeyen bir sürüme indiremeyeceğinizi unutmayın. [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) -- İşlevler için DFA tabanlı bir uygulama ekleyin `sequenceMatch` ve `sequenceCount` durumda desen zaman içermez. [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- Tam sayı serileştirme için performans iyileştirme. [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([Amos Kuşu](https://github.com/amosbird)) -- Sıfır sol dolgu PODArray böylece -1 öğesi her zaman geçerli ve sıfırlanır. Ofsetlerin dalsız hesaplanması için kullanılır. [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([Amos Kuşu](https://github.com/amosbird)) -- Döndürüyordu `jemalloc` performans düşüşüne yol sürüm. [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Geriye Dönük Uyumsuz Değişiklikler {#backward-incompatible-changes-2} - -- Kaldırılan belgesiz özellik `ALTER MODIFY PRIMARY KEY` çünkü onun yerini aldı. `ALTER MODIFY ORDER BY` komut. [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) -- Kaldırılan işlev `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Türün sonucu ile skaler alt sorguları kullanmayı yasaklayın `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([I ivanvan](https://github.com/abyss7)) - -#### Yapı / Test / Ambalaj Geliştirmeleri {#buildtestingpackaging-improvements-6} - -- PowerPC için destek eklendi (`ppc64le`) yapmak. [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) -- Duruma göre fonksiyonel testlerin ortak kullanılabilir veri kümesi üzerinde çalışır. [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sunucu ile başlatılamıyor Sabit hata `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` Docker veya systemd-nspawn içindeki mesaj. [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Güncel `rdkafka` kütüphane v1.0.0-RC5 için. Ham c arayüzü yerine cppkafka kullanılır. [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([I ivanvan](https://github.com/abyss7)) -- Güncel `mariadb-client` kitaplık. UBSan tarafından bulunan sorunlardan biri düzeltildi. [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- UBSan için bazı düzeltmeler oluşturur. [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- UBSan yapı ile testlerin başına taahhüt ishal eklendi. -- PVS-Studio statik analyzer başına taahhüt ishal eklendi. -- PVS-Studio tarafından bulunan sabit hatalar. [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit glibc uyumluluk sorunları. [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Docker resimlerini 18.10'a taşıyın ve glibc \>= 2.28 için uyumluluk dosyası ekleyin [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([alesapin](https://github.com/alesapin)) -- Kullanıcı sunucu Docker görüntü dizinleri chown istemiyorsanız env değişken ekleyin. [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([alesapin](https://github.com/alesapin)) -- Gelen uyar theıların en etkin `-Weverything` çınlama içinde. Etkin `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sadece clang 8'de bulunan birkaç uyarı daha eklendi. [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bağlanmak `libLLVM` paylaşılan bağlantı kullanırken bireysel LLVM libs yerine. [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Orivej Desh](https://github.com/orivej)) -- Test görüntüleri için sanitizer değişkenleri eklendi. [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([alesapin](https://github.com/alesapin)) -- `clickhouse-server` debian paketi tavsiye edecek `libcap2-bin` kullanmak için paket `setcap` yetenekleri ayarlamak için bir araç. Bu isteğe bağlıdır. [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Geliştirilmiş derleme süresi, sabit içerir. [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) -- Karma fonksiyonlar için performans testleri eklendi. [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) -- Sabit döngüsel kütüphane bağımlılıkları. [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) -- Düşük kullanılabilir bellek ile geliştirilmiş derleme. [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) -- Performans düşüşünü yeniden oluşturmak için test betiği eklendi `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yorumlarda ve dize değişmezlerinde sabit yazım hataları `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) -- Yorumlarda sabit yazım hataları. [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) - -## [2018 için Changelog](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/tr/whats_new/changelog/index.md b/docs/tr/whats_new/changelog/index.md deleted file mode 100644 index 5f446b526c7..00000000000 --- a/docs/tr/whats_new/changelog/index.md +++ /dev/null @@ -1,668 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_folder_title: Changelog -toc_priority: 74 -toc_title: '2020' ---- - -## ClickHouse sürüm v20. 3 {#clickhouse-release-v20-3} - -### ClickHouse yayın v20.3. 4. 10, 2020-03-20 {#clickhouse-release-v20-3-4-10-2020-03-20} - -#### Hata Düzeltme {#bug-fix} - -- Bu sürüm ayrıca 20.1.8.41 tüm hata düzeltmeleri içerir -- Eksik düzeltme `rows_before_limit_at_least` http üzerinden sorgular için (işlemciler boru hattı ile). Bu düzeltmeler [\#9730](https://github.com/ClickHouse/ClickHouse/issues/9730). [\#9757](https://github.com/ClickHouse/ClickHouse/pull/9757) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -### ClickHouse yayın v20.3. 3. 6, 2020-03-17 {#clickhouse-release-v20-3-3-6-2020-03-17} - -#### Hata Düzeltme {#bug-fix-1} - -- Bu sürüm ayrıca 20.1.7.38 tüm hata düzeltmeleri içerir -- Kullanıcı önceki sürümde mutasyonlar yürüttüyse, çoğaltmanın çalışmasına izin vermeyen bir çoğaltmada hatayı düzeltin. Bu düzeltmeler [\#9645](https://github.com/ClickHouse/ClickHouse/issues/9645). [\#9652](https://github.com/ClickHouse/ClickHouse/pull/9652) ([alesapin](https://github.com/alesapin)). 20.3 sürümünü tekrar geriye dönük uyumlu hale getirir. -- Ayar Ekle `use_compact_format_in_distributed_parts_names` hangi dosyaları yazmak için izin verir `INSERT` içine sorgular `Distributed` daha kompakt formatlı tablo. Bu düzeltmeler [\#9647](https://github.com/ClickHouse/ClickHouse/issues/9647). [\#9653](https://github.com/ClickHouse/ClickHouse/pull/9653) ([alesapin](https://github.com/alesapin)). 20.3 sürümünü tekrar geriye dönük uyumlu hale getirir. - -### ClickHouse yayın v20.3. 2. 1, 2020-03-12 {#clickhouse-release-v20-3-2-1-2020-03-12} - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change} - -- Sorunu düzelt fixedildi `file name too long` için veri gönderirken `Distributed` çok sayıda çoğaltma için tablolar. Çoğaltma kimlik bilgileri sunucu günlüğüne maruz sorunu düzeltildi. Diskteki dizin adı biçimi değiştirildi `[shard{shard_index}[_replica{replica_index}]]`. [\#8911](https://github.com/ClickHouse/ClickHouse/pull/8911) ([Mikhail Korotov](https://github.com/millb)) Yeni sürüme yükselttikten sonra, eski sunucu sürümü yeni dizin biçimini tanımadığı için manuel müdahale olmadan düşüremezsiniz. Downgrade yapmak istiyorsanız, ilgili dizinleri eski biçime el ile yeniden adlandırmanız gerekir. Bu değişiklik yalnızca zaman uyumsuz kullandıysanız geçerlidir `INSERT`s to `Distributed` Tablolar. 20.3.3 sürümünde, yeni formatı kademeli olarak etkinleştirmenize izin verecek bir ayar sunacağız. -- Mutasyon komutları için çoğaltma günlük girişlerinin biçimini değiştirdi. Yeni sürümü yüklemeden önce eski mutasyonların işlenmesini beklemeniz gerekir. -- Stacktraces döker basit bellek profiler uygulamak `system.trace_log` her n bayt yumuşak ayırma sınırı üzerinde [\#8765](https://github.com/ClickHouse/ClickHouse/pull/8765) ([I ivanvan](https://github.com/abyss7)) [\#9472](https://github.com/ClickHouse/ClickHouse/pull/9472) ([alexey-milovidov](https://github.com/alexey-milovidov) Olan ) sütun `system.trace_log` 'den değiştirildi `timer_type` -e doğru `trace_type`. Bu, üçüncü taraf performans analizi ve flamegraph işleme araçlarında değişiklikler gerektirecektir. -- İç iş parçacığı numarası yerine her yerde OS iş parçacığı kimliğini kullanın. Bu düzeltmeler [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477) Yaş `clickhouse-client` sunucu ne zaman ayarı gönderme günlükleri alınamıyor `send_logs_level` yapılandırılmış günlük iletilerinin adları ve türleri değiştirildiğinden etkindir. Öte yandan, farklı sunucu sürümleri birbirine farklı türlerde günlükleri gönderebilir. Kullan whenmay theınca `send_logs_level` ayar, umursamamalısın. [\#8954](https://github.com/ClickHouse/ClickHouse/pull/8954) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kaldırmak `indexHint` işlev [\#9542](https://github.com/ClickHouse/ClickHouse/pull/9542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kaldırmak `findClusterIndex`, `findClusterValue` işlevler. Bu düzeltmeler [\#8641](https://github.com/ClickHouse/ClickHouse/issues/8641). Bu işlevleri kullanıyorsanız, bir e-posta gönderin `clickhouse-feedback@yandex-team.com` [\#9543](https://github.com/ClickHouse/ClickHouse/pull/9543) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi sütun oluşturmak veya sütun eklemek için izin verilmez `SELECT` varsayılan ifade olarak alt sorgu. [\#9481](https://github.com/ClickHouse/ClickHouse/pull/9481) ([alesapin](https://github.com/alesapin)) -- JOİN alt sorgular için takma adlar gerektirir. [\#9274](https://github.com/ClickHouse/ClickHouse/pull/9274) ([Artem Zuikov](https://github.com/4ertus2)) -- Gelişmiş `ALTER MODIFY/ADD` sorgu mantığı. Şimdi yapamazsın `ADD` türü olmayan sütun, `MODIFY` varsayılan ifade sütun türünü değiştirmez ve `MODIFY` tür varsayılan ifade değerini kaybetmez. Düzeltiyor [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) ([alesapin](https://github.com/alesapin)) -- Günlük yapılandırma değişiklikleri uygulamak için yeniden başlatılması için sunucu gerektirir. Bu, sunucunun silinmiş bir günlük dosyasına oturum açtığı hatayı önlemek için geçici bir geçici çözümdür (bkz. [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Ayar `experimental_use_processors` varsayılan olarak etkinleştirilir. Bu ayar, yeni sorgu potansiyel kullanımını sağlar. Bu dahili refactoring ve görünür bir değişiklik beklemiyoruz. Eğer herhangi bir sorun göreceksiniz, sıfır geri ayarlayın. [\#8768](https://github.com/ClickHouse/ClickHouse/pull/8768) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Yenilik {#new-feature} - -- Eklemek `Avro` ve `AvroConfluent` giriş / çıkış biçimleri [\#8571](https://github.com/ClickHouse/ClickHouse/pull/8571) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8957](https://github.com/ClickHouse/ClickHouse/pull/8957) ([Andrew Onyshchuk](https://github.com/oandrew)) [\#8717](https://github.com/ClickHouse/ClickHouse/pull/8717) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Süresi dolmuş anahtarların çok iş parçacıklı ve engellenmeyen güncellemeleri `cache` sözlükler (eskileri okumak için isteğe bağlı izin ile). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Sorgu Ekle `ALTER ... MATERIALIZE TTL`. Süresi dolmuş verileri TTL ile kaldırmaya zorlayan mutasyonu çalıştırır ve TTL ile ilgili meta bilgileri tüm kısımlarda yeniden hesaplar. [\#8775](https://github.com/ClickHouse/ClickHouse/pull/8775) ([Anton Popov](https://github.com/CurtizJ)) -- Gerekirse Hashjoin'den Mergejoin'e (diskte) geçin [\#9082](https://github.com/ClickHouse/ClickHouse/pull/9082) ([Artem Zuikov](https://github.com/4ertus2)) -- Katma `MOVE PARTITION` için komut `ALTER TABLE` [\#4729](https://github.com/ClickHouse/ClickHouse/issues/4729) [\#6168](https://github.com/ClickHouse/ClickHouse/pull/6168) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Anında yapılandırma dosyasından depolama yapılandırmasını yeniden yükleme. [\#8594](https://github.com/ClickHouse/ClickHouse/pull/8594) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Değiştirmek için izin `storage_policy` daha az zengin olana. [\#8107](https://github.com/ClickHouse/ClickHouse/pull/8107) ([Vladimir Chebotarev](https://github.com/excitoon)) -- S3 depolama ve masa fonksiyonu için globs/joker karakterler için destek eklendi. [\#8851](https://github.com/ClickHouse/ClickHouse/pull/8851) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Uygulamak `bitAnd`, `bitOr`, `bitXor`, `bitNot` için `FixedString(N)` datatype. [\#9091](https://github.com/ClickHouse/ClickHouse/pull/9091) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Eklendi fonksiyonu `bitCount`. Bu düzeltmeler [\#8702](https://github.com/ClickHouse/ClickHouse/issues/8702). [\#8708](https://github.com/ClickHouse/ClickHouse/pull/8708) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#8749](https://github.com/ClickHouse/ClickHouse/pull/8749) ([ıkopylov](https://github.com/ikopylov)) -- Eklemek `generateRandom` verilen şema ile rastgele satırlar oluşturmak için tablo işlevi. Rasgele test tablosunu verilerle doldurmaya izin verir. [\#8994](https://github.com/ClickHouse/ClickHouse/pull/8994) ([Ilya Yatsishin](https://github.com/qoega)) -- `JSONEachRowFormat`: destek özel durumda zaman nesneleri üst düzey dizi içine. [\#8860](https://github.com/ClickHouse/ClickHouse/pull/8860) ([Kruglov Pavel](https://github.com/Avogar)) -- Şimdi bir sütun oluşturmak mümkün `DEFAULT` varsayılan bir sütuna bağlı olan ifade `ALIAS` ifade. [\#9489](https://github.com/ClickHouse/ClickHouse/pull/9489) ([alesapin](https://github.com/alesapin)) -- Belirtmek için izin ver `--limit` kaynak veri boyutundan daha fazla `clickhouse-obfuscator`. Veri farklı rastgele tohum ile kendini tekrar edecektir. [\#9155](https://github.com/ClickHouse/ClickHouse/pull/9155) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Katma `groupArraySample` fonksiyonu (benzer `groupArray`) rezervuar örnekleme algoritması ile. [\#8286](https://github.com/ClickHouse/ClickHouse/pull/8286) ([Amos Kuşu](https://github.com/amosbird)) -- Şimdi güncelleme kuyruğunun boyutunu izleyebilirsiniz `cache`/`complex_key_cache` sistem metrikleri aracılığıyla sözlükler. [\#9413](https://github.com/ClickHouse/ClickHouse/pull/9413) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Crlf'yi CSV çıkış biçiminde bir hat ayırıcı olarak ayarlamaya izin ver `output_format_csv_crlf_end_of_line` 1 set [\#8934](https://github.com/ClickHouse/ClickHouse/pull/8934) [\#8935](https://github.com/ClickHouse/ClickHouse/pull/8935) [\#8963](https://github.com/ClickHouse/ClickHouse/pull/8963) ([Mikhail Korotov](https://github.com/millb)) -- Daha fazla işlev uygulamak [H3](https://github.com/uber/h3) API: `h3GetBaseCell`, `h3HexAreaM2`, `h3IndexesAreNeighbors`, `h3ToChildren`, `h3ToString` ve `stringToH3` [\#8938](https://github.com/ClickHouse/ClickHouse/pull/8938) ([Nico Mandery](https://github.com/nmandery)) -- Yeni ayar tanıt introducedıldı: `max_parser_depth` maksimum yığın boyutunu kontrol etmek ve büyük karmaşık sorgulara izin vermek. Bu düzeltmeler [\#6681](https://github.com/ClickHouse/ClickHouse/issues/6681) ve [\#7668](https://github.com/ClickHouse/ClickHouse/issues/7668). [\#8647](https://github.com/ClickHouse/ClickHouse/pull/8647) ([Maxim Smirnov](https://github.com/qMBQx8GH)) -- Ayar ekleme `force_optimize_skip_unused_shards` kullanılmayan parçaların atlanması mümkün değilse atma ayarı [\#8805](https://github.com/ClickHouse/ClickHouse/pull/8805) ([Azat Khuzhin](https://github.com/azat)) -- Göndermek için veri depolamak için birden fazla Disk/birim yapılandırmaya izin ver `Distributed` motor [\#8756](https://github.com/ClickHouse/ClickHouse/pull/8756) ([Azat Khuzhin](https://github.com/azat)) -- Destek depolama politikası (``) geçici veri depolamak için. [\#8750](https://github.com/ClickHouse/ClickHouse/pull/8750) ([Azat Khuzhin](https://github.com/azat)) -- Katma `X-ClickHouse-Exception-Code` Özel durum veri göndermeden önce atıldı, ayarlanmış http üstbilgisi. Bu uygular [\#4971](https://github.com/ClickHouse/ClickHouse/issues/4971). [\#8786](https://github.com/ClickHouse/ClickHouse/pull/8786) ([Mikhail Korotov](https://github.com/millb)) -- Eklendi fonksiyonu `ifNotFinite`. Bu sadece sözdizimsel bir şeker: `ifNotFinite(x, y) = isFinite(x) ? x : y`. [\#8710](https://github.com/ClickHouse/ClickHouse/pull/8710) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Katma `last_successful_update_time` sütun içinde `system.dictionaries` Tablo [\#9394](https://github.com/ClickHouse/ClickHouse/pull/9394) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Eklemek `blockSerializedSize` işlev (sıkıştırma olmadan diskte boyut) [\#8952](https://github.com/ClickHouse/ClickHouse/pull/8952) ([Azat Khuzhin](https://github.com/azat)) -- Fonksiyon Ekle `moduloOrZero` [\#9358](https://github.com/ClickHouse/ClickHouse/pull/9358) ([hcz](https://github.com/hczhcz)) -- Eklenen sistem tabloları `system.zeros` ve `system.zeros_mt` yanı sıra masal fonksiyonları `zeros()` ve `zeros_mt()`. Tablolar (ve tablo işlevleri) adı ile tek sütun içerir `zero` ve tip `UInt8`. Bu sütun sıfır içerir. Birçok satır oluşturmak için en hızlı yöntem olarak test amaçları için gereklidir. Bu düzeltmeler [\#6604](https://github.com/ClickHouse/ClickHouse/issues/6604) [\#9593](https://github.com/ClickHouse/ClickHouse/pull/9593) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) - -#### Deneysel Özellik {#experimental-feature} - -- Yeni kompakt parça formatı ekleyin `MergeTree`- tüm sütunların tek bir dosyada saklandığı aile tabloları. Küçük ve sık insertlerin performansını artırmaya yardımcı olur. Eski biçim (sütun başına bir dosya) şimdi geniş olarak adlandırılır. Veri depolama biçimi ayarları tarafından kontrol edilir `min_bytes_for_wide_part` ve `min_rows_for_wide_part`. [\#8290](https://github.com/ClickHouse/ClickHouse/pull/8290) ([Anton Popov](https://github.com/CurtizJ)) -- S3 depolama için destek `Log`, `TinyLog` ve `StripeLog` Tablolar. [\#8862](https://github.com/ClickHouse/ClickHouse/pull/8862) ([Pavel Kovalenko](https://github.com/Jokser)) - -#### Hata Düzeltme {#bug-fix-2} - -- Günlük mesajlarında sabit tutarsız whitespaces. [\#9322](https://github.com/ClickHouse/ClickHouse/pull/9322) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İsimsiz dizilerin dizilerinin tablo oluşturulmasında iç içe geçmiş yapılar olarak düzleştirildiği hatayı düzeltin. [\#8866](https://github.com/ClickHouse/ClickHouse/pull/8866) ([achulkov2](https://github.com/achulkov2)) -- Sorunu ne zaman düzeltildi “Too many open files” glob deseniyle eşleşen çok fazla dosya varsa hata oluşabilir `File` tablo veya `file` tablo işlevi. Şimdi dosyalar tembel açılır. Bu düzeltmeler [\#8857](https://github.com/ClickHouse/ClickHouse/issues/8857) [\#8861](https://github.com/ClickHouse/ClickHouse/pull/8861) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bırak geçici tablo şimdi sadece geçici tablo düşer. [\#8907](https://github.com/ClickHouse/ClickHouse/pull/8907) ([Vitaly Baranov](https://github.com/vitlibar)) -- Sunucuyu kapattığımızda veya bir tabloyu AYIRDIĞIMIZDA/EKLEDİĞİMİZDE eski bölümü kaldırın. [\#8602](https://github.com/ClickHouse/ClickHouse/pull/8602) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Varsayılan diskin boş alanı nasıl hesapladığı için `data` dizin. Boş alan miktarı doğru hesaplanmazsa sorunu düzeltildi `data` dizin ayrı bir cihaza monte edilir (nadir durum). Bu düzeltmeler [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) ([Mikhail Korotov](https://github.com/millb)) -- In () ınside ile virgül (çapraz) birleşmesine izin ver. [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) ([Artem Zuikov](https://github.com/4ertus2)) -- WHERE bölümünde operatör gibi \[değil\] varsa, iç BİRLEŞİME çapraz yeniden yazmaya izin verin. [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) ([Artem Zuikov](https://github.com/4ertus2)) -- Sonra olası yanlış sonucu düzeltin `GROUP BY` etkin ayarı ile `distributed_aggregation_memory_efficient`. Düzeltiyor [\#9134](https://github.com/ClickHouse/ClickHouse/issues/9134). [\#9289](https://github.com/ClickHouse/ClickHouse/pull/9289) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Bulunan anahtarlar önbellek sözlüklerinin metriklerinde cevapsız olarak sayıldı. [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Çoğaltma protokolü uyumsuzluğunu düzeltme [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -- Sabit yarış durumu `queue_task_handle` başlangıçta `ReplicatedMergeTree` Tablolar. [\#9552](https://github.com/ClickHouse/ClickHouse/pull/9552) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Belirteç `NOT` işe yar inamadı `SHOW TABLES NOT LIKE` sorgu [\#8727](https://github.com/ClickHouse/ClickHouse/issues/8727) [\#8940](https://github.com/ClickHouse/ClickHouse/pull/8940) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fonksiyona Aralık kontrolü eklendi `h3EdgeLengthM`. Bu kontrol olmadan, arabellek taşması mümkündür. [\#8945](https://github.com/ClickHouse/ClickHouse/pull/8945) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Birden argümanlar (10'dan fazla) üçlü mantıksal OPs toplu hesaplamalarda bir hata düzeltildi. [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([Alexander Kazakov](https://github.com/Akazz)) -- Segfaults'a yol açabilecek prewhere optimizasyonunun hatasını düzeltin veya `Inconsistent number of columns got from MergeTreeRangeReader` özel. [\#9024](https://github.com/ClickHouse/ClickHouse/pull/9024) ([Anton Popov](https://github.com/CurtizJ)) -- Beklenmeyen düzeltme `Timeout exceeded while reading from socket` zaman aşımı gerçekten aşıldı ve sorgu profiler etkinleştirildiğinde önce güvenli bağlantıda rasgele olur özel durum. Ayrıca ekleyin `connect_timeout_with_failover_secure_ms` ayarlar (varsayılan 100 MS), hangi benzer `connect_timeout_with_failover_ms`, ancak güvenli bağlantılar için kullanılır (çünkü SSL el sıkışması normal TCP bağlantısından daha yavaştır) [\#9026](https://github.com/ClickHouse/ClickHouse/pull/9026) ([tavplubix](https://github.com/tavplubix)) -- Mutasyon ile devlet asmak olabilir mutasyonlar sonuçlandırılması ile Fix hata `parts_to_do=0` ve `is_done=0`. [\#9022](https://github.com/ClickHouse/ClickHouse/pull/9022) ([alesapin](https://github.com/alesapin)) -- İle Yeni herhangi bir birleştirme mantığı kullanın `partial_merge_join` ayar. Yapmak mümkün `ANY|ALL|SEMI LEFT` ve `ALL INNER` ile birleş joinsir `partial_merge_join=1` şimdi. [\#8932](https://github.com/ClickHouse/ClickHouse/pull/8932) ([Artem Zuikov](https://github.com/4ertus2)) -- Shard şimdi bir istisna atmak yerine başlatıcıdan gelen ayarları shard'ın constaintlerine sıkıştırıyor. Bu düzeltme, başka bir kısıtlamalarla bir parçaya sorgular göndermeye izin verir. [\#9447](https://github.com/ClickHouse/ClickHouse/pull/9447) ([Vitaly Baranov](https://github.com/vitlibar)) -- Sabit bellek yönetimi sorunu `MergeTreeReadPool`. [\#8791](https://github.com/ClickHouse/ClickHouse/pull/8791) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Düzeltmek `toDecimal*OrNull()` dize ile çağrıldığında işlevler ailesi `e`. Düzeltiyor [\#8312](https://github.com/ClickHouse/ClickHouse/issues/8312) [\#8764](https://github.com/ClickHouse/ClickHouse/pull/8764) ([Artem Zuikov](https://github.com/4ertus2)) -- Emin olun `FORMAT Null` istemciye hiçbir veri gönderir. [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Bu zaman damgasını düzeltin `LiveViewBlockInputStream` güncellenmeyecek. `LIVE VIEW` deneysel bir özelliktir. [\#8644](https://github.com/ClickHouse/ClickHouse/pull/8644) ([vxider](https://github.com/Vxider)) [\#8625](https://github.com/ClickHouse/ClickHouse/pull/8625) ([vxider](https://github.com/Vxider)) -- Sabit `ALTER MODIFY TTL` eski TTL ifadelerini silmeye izin vermeyen yanlış davranış. [\#8422](https://github.com/ClickHouse/ClickHouse/pull/8422) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Mergetreeındexset sabit UBSan raporu. Bu düzeltmeler [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Davranışı Düzelt theildi `match` ve `extract` haystack sıfır bayt olduğunda işlevler. Haystack sabit olduğunda davranış yanlıştı. Bu düzeltmeler [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Apache Avro 3. parti kütüphanesinde yıkıcıdan atmaktan kaçının. [\#9066](https://github.com/ClickHouse/ClickHouse/pull/9066) ([Andrew Onyshchuk](https://github.com/oandrew)) -- Bir toplu işlem yoklama `Kafka` kısmen verilerde deliklere yol açabilir. [\#8876](https://github.com/ClickHouse/ClickHouse/pull/8876) ([filimonov](https://github.com/filimonov)) -- Düzeltmek `joinGet` null dönüş türleri ile. https://github.com/ClickHouse/ClickHouse/issues/8919 [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) ([Amos Kuşu](https://github.com/amosbird)) -- Sıkıştırıldığında veri uyumsuzluğunu düzeltin `T64` codec. [\#9016](https://github.com/ClickHouse/ClickHouse/pull/9016) ([Artem Zuikov](https://github.com/4ertus2)) Veri türü kimliklerini düzeltin `T64` etkilenen sürümlerde yanlış (de)sıkıştırmaya yol açan sıkıştırma codec bileşeni. [\#9033](https://github.com/ClickHouse/ClickHouse/pull/9033) ([Artem Zuikov](https://github.com/4ertus2)) -- Ayar Ekle `enable_early_constant_folding` ve hatalara yol açan bazı durumlarda devre dışı bırakın. [\#9010](https://github.com/ClickHouse/ClickHouse/pull/9010) ([Artem Zuikov](https://github.com/4ertus2)) -- Pushdown predicate optimizer'ı görünümle düzeltin ve Testi etkinleştirin [\#9011](https://github.com/ClickHouse/ClickHouse/pull/9011) ([Kış Zhang](https://github.com/zhang2014)) -- Segfault'u düzeltin `Merge` tablo readinglardan, okuma sırasında meydana gelebilecek `File` depolamalar [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) ([tavplubix](https://github.com/tavplubix)) -- Depolama politikası için bir kontrol eklendi `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE`. Aksi takdirde, yeniden başlatıldıktan sonra parçanın verilerini erişilemez hale getirebilir ve Clickhouse'un başlatılmasını önleyebilir. [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Tablo için ayarlanmış TTL varsa, değişiklikleri düzeltin. [\#8800](https://github.com/ClickHouse/ClickHouse/pull/8800) ([Anton Popov](https://github.com/CurtizJ)) -- Ne zaman gerçekleşebilecek yarış durumunu düzeltin `SYSTEM RELOAD ALL DICTIONARIES` bazı sözlük değiştirilirken/eklenirken/kaldırılırken yürütülür. [\#8801](https://github.com/ClickHouse/ClickHouse/pull/8801) ([Vitaly Baranov](https://github.com/vitlibar)) -- Önceki sürümlerde `Memory` Veritabanı Altyapısı boş veri yolu kullanır, böylece tablolar `path` directory (e.g. `/var/lib/clickhouse/`), not in data directory of database (e.g. `/var/lib/clickhouse/db_name`). [\#8753](https://github.com/ClickHouse/ClickHouse/pull/8753) ([tavplubix](https://github.com/tavplubix)) -- Varsayılan disk veya ilke eksik hakkında sabit yanlış günlük mesajları. [\#9530](https://github.com/ClickHouse/ClickHouse/pull/9530) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Dizi türlerinin bloom\_filter dizini için değil(has()) düzeltin. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) -- Bir tablodaki ilk sütunlara izin ver `Log` motor takma isim ol [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) ([I ivanvan](https://github.com/abyss7)) -- Okurken aralıkların sırasını düzeltin `MergeTree` bir iş parçacığı tablo. İstisn fromalara yol açabilir `MergeTreeRangeReader` veya yanlış sorgu sonuçları. [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) ([Anton Popov](https://github.com/CurtizJ)) -- Yapmak `reinterpretAsFixedString` dönmek `FixedString` yerine `String`. [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) ([Andrew Onyshchuk](https://github.com/oandrew)) -- Kullanıcı yanlış hata mesajı alabildiğinde son derece nadir durumlardan kaçının (`Success` ayrıntılı hata açıklaması yerine). [\#9457](https://github.com/ClickHouse/ClickHouse/pull/9457) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kullanırken çökmesine etmeyin `Template` boş satır şablonu ile biçimlendirin. [\#8785](https://github.com/ClickHouse/ClickHouse/pull/8785) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Sistem tabloları için meta veri dosyaları yanlış yerde oluşturulabilir [\#8653](https://github.com/ClickHouse/ClickHouse/pull/8653) ([tavplubix](https://github.com/tavplubix)) Düzeltiyor [\#8581](https://github.com/ClickHouse/ClickHouse/issues/8581). -- Önbellek sözlüğünde exception\_ptr üzerindeki veri yarışını düzeltin [\#8303](https://github.com/ClickHouse/ClickHouse/issues/8303). [\#9379](https://github.com/ClickHouse/ClickHouse/pull/9379) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Sorgu için bir özel durum atmayın `ATTACH TABLE IF NOT EXISTS`. Daha önce tablo zaten varsa atıldı, buna rağmen `IF NOT EXISTS` yan. [\#8967](https://github.com/ClickHouse/ClickHouse/pull/8967) ([Anton Popov](https://github.com/CurtizJ)) -- Özel durum mesajında eksik kapanış paren düzeltildi. [\#8811](https://github.com/ClickHouse/ClickHouse/pull/8811) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mesajdan kaçının `Possible deadlock avoided` etkileşimli modda clickhouse-client başlangıcında. [\#9455](https://github.com/ClickHouse/ClickHouse/pull/9455) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Base64 kodlanmış değerin sonunda dolgu hatalı biçimlendirilmiş olabilir sorunu düzeltildi. Base64 kütüphanesini güncelleyin. Bu düzeltmeler [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), yaklar [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Veri kaybını önlemek `Kafka` nadir durumlarda istisna sonek okuduktan sonra ancak taahhütten önce gerçekleşir. Düzeltiyor [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378) [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) ([filimonov](https://github.com/filimonov)) -- Sabit istisna `DROP TABLE IF EXISTS` [\#8663](https://github.com/ClickHouse/ClickHouse/pull/8663) ([Nikita Vasilev](https://github.com/nikvas0)) -- Bir kullanıcı denediğinde çökmeyi düzeltin `ALTER MODIFY SETTING` eski formatlı için `MergeTree` masa motorları ailesi. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -- Json ile ilgili işlevlerde Int64'e uymayan Uİnt64 numaraları için destek. Master simdjson güncelleyin. Bu düzeltmeler [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kesinlikle monotinik olmayan fonksiyonel indeks kullanıldığında ters yüklemlerin sabit yürütülmesi. [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) ([Alexander Kazakov](https://github.com/Akazz)) -- Kat trylamaya çalış trymayın `IN` sabit in `GROUP BY` [\#8868](https://github.com/ClickHouse/ClickHouse/pull/8868) ([Amos Kuşu](https://github.com/amosbird)) -- Hatayı düzeltin `ALTER DELETE` endeks bozulmasına yol açan mutasyonlar. Bu düzeltmeler [\#9019](https://github.com/ClickHouse/ClickHouse/issues/9019) ve [\#8982](https://github.com/ClickHouse/ClickHouse/issues/8982). Ayrıca son derece nadir yarış koşullarını düzeltin `ReplicatedMergeTree` `ALTER` sorgular. [\#9048](https://github.com/ClickHouse/ClickHouse/pull/9048) ([alesapin](https://github.com/alesapin)) -- Zaman ayarı `compile_expressions` etkin mi, alabilirsiniz `unexpected column` içinde `LLVMExecutableFunction` kullan whendığımızda `Nullable` tür [\#8910](https://github.com/ClickHouse/ClickHouse/pull/8910) ([Guillaume Tassery](https://github.com/YiuRULE)) -- İçin çoklu düzeltmeler `Kafka` motor: 1) tüketici grubu rebalance sırasında görünen çiftleri düzeltin. 2) nadir düzeltmek ‘holes’ veriler bir anket ile birkaç bölümden yoklandığında ve kısmen işlendiğinde ortaya çıktı (şimdi her zaman tüm anketli mesaj bloğunu işliyoruz / işliyoruz). 3) blok boyutuna göre yıkamaları düzeltin (bundan önce sadece zaman aşımı ile kızarma düzgün çalışıyordu). 4) daha iyi abonelik prosedürü (atama geri bildirimi ile). 5) testlerin daha hızlı çalışmasını sağlayın (varsayılan aralıklarla ve zaman aşımlarıyla). Verilerin daha önce blok boyutuna göre temizlenmemesi nedeniyle (belgelere göre olması gerektiği gibi), bu PR, varsayılan ayarlarla bazı performans düşüşlerine yol açabilir(daha sık ve daha az optimal olan daha küçük yıkama nedeniyle). Bu değişiklikten sonra performans sorunuyla karşılaşırsanız-lütfen artırın `kafka_max_block_size` tabloda daha büyük değere (örneğin `CREATE TABLE ...Engine=Kafka ... SETTINGS ... kafka_max_block_size=524288`). Düzeltiyor [\#7259](https://github.com/ClickHouse/ClickHouse/issues/7259) [\#8917](https://github.com/ClickHouse/ClickHouse/pull/8917) ([filimonov](https://github.com/filimonov)) -- Düzeltmek `Parameter out of bound` prewhere optimizasyonlarından sonra bazı sorgularda istisna. [\#8914](https://github.com/ClickHouse/ClickHouse/pull/8914) ([Baudouin Giard](https://github.com/bgiard)) -- Fonksiyon argümanlarının karışık sabitliği durumu düzeltildi `arrayZip`. [\#8705](https://github.com/ClickHouse/ClickHouse/pull/8705) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yürüt whenürken `CREATE` sorgu, depolama motoru argümanlarında sabit ifadeleri katlayın. Boş veritabanı adı geçerli veritabanı ile değiştirin. Düzeltiyor [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492) [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) ([tavplubix](https://github.com/tavplubix)) -- Artık basit döngüsel takma adlarla sütunlar oluşturmak veya eklemek mümkün değil `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -- Bozuk orijinal parçası olabilir çift hareket ile bir hata düzeltildi. Eğer kullanıyorsanız bu önemlidir `ALTER TABLE MOVE` [\#8680](https://github.com/ClickHouse/ClickHouse/pull/8680) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Vermek `interval` backticks olmadan doğru ayrıştırmak için tanımlayıcı. Bir sorgu bile yürütülemez sabit sorun `interval` tanımlayıcı backticks veya çift tırnak içine alınır. Bu düzeltmeler [\#9124](https://github.com/ClickHouse/ClickHouse/issues/9124). [\#9142](https://github.com/ClickHouse/ClickHouse/pull/9142) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit fuzz testi ve yanlış davranış `bitTestAll`/`bitTestAny` işlevler. [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Olası kilitlenme/yanlış satır sayısını düzeltin `LIMIT n WITH TIES` n'th satırına eşit çok sayıda satır olduğunda. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -- Enabled ile yazılmış parçalarla mutasyonları düzeltin `insert_quorum`. [\#9463](https://github.com/ClickHouse/ClickHouse/pull/9463) ([alesapin](https://github.com/alesapin)) -- İmha veri yarışı Fix `Poco::HTTPServer`. Sunucu başlatıldığında ve hemen kapatıldığında gerçekleşebilir. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -- Çalışırken yanıltıcı bir hata mesajının gösterildiği hatayı düzeltin `SHOW CREATE TABLE a_table_that_does_not_exist`. [\#8899](https://github.com/ClickHouse/ClickHouse/pull/8899) ([achulkov2](https://github.com/achulkov2)) -- Sabit `Parameters are out of bound` bazı nadir durumlarda istisna `SELECT` CLA anuse when we have an `ORDER BY` ve bir `LIMIT` yan. [\#8892](https://github.com/ClickHouse/ClickHouse/pull/8892) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Mutasyonlar kesinleşmesini düzeltin, zaten mutasyon yapıldığında durum olabilir `is_done=0`. [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) ([alesapin](https://github.com/alesapin)) -- Yürütül executingmesini engellemek `ALTER ADD INDEX` eski sözdizimi ile MergeTree tabloları için, çünkü çalışmıyor. [\#8822](https://github.com/ClickHouse/ClickHouse/pull/8822) ([Mikhail Korotov](https://github.com/millb)) -- Sunucu başlatma sırasında erişim tablosu, hangi `LIVE VIEW` bağlıdır, böylece sunucu başlatmak mümkün olacak. Ayrıca kaldırmak `LIVE VIEW` ayırma sırasında bağımlılıklar `LIVE VIEW`. `LIVE VIEW` deneysel bir özelliktir. [\#8824](https://github.com/ClickHouse/ClickHouse/pull/8824) ([tavplubix](https://github.com/tavplubix)) -- Olası segfault'u düzeltin `MergeTreeRangeReader`, Yürüt whileürken `PREWHERE`. [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) ([Anton Popov](https://github.com/CurtizJ)) -- Sütun TTLs ile olası eşleşmeyen sağlama toplamlarını düzeltin. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -- Sadece bir birim olduğunda parçalar durumunda TTL kurallarına göre arka planda taşınmadığında bir hata düzeltildi. [\#8672](https://github.com/ClickHouse/ClickHouse/pull/8672) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Sorunu düzelt fixedildi `Method createColumn() is not implemented for data type Set`. Bu düzeltmeler [\#7799](https://github.com/ClickHouse/ClickHouse/issues/7799). [\#8674](https://github.com/ClickHouse/ClickHouse/pull/8674) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi mutasyonları daha sık sonuçlandırmaya çalışacağız. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -- Düzeltmek `intDiv` eksi bir sabit tarafından [\#9351](https://github.com/ClickHouse/ClickHouse/pull/9351) ([hcz](https://github.com/hczhcz)) -- Olası yarış durumunu düzeltin `BlockIO`. [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Kullanmaya / bırakmaya çalışırken sunucu sonlandırmasına giden hatayı düzeltin `Kafka` tablo yanlış parametrelerle oluşturuldu. [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) ([filimonov](https://github.com/filimonov)) -- OS için yanlış sonuç döndürürse geçici çözüm eklendi `timer_create` işlev. [\#8837](https://github.com/ClickHouse/ClickHouse/pull/8837) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kullanımında Sabit hata `min_marks_for_seek` parametre. Dağıtılmış tabloda sharding anahtarı olmadığında hata mesajı düzeltildi ve kullanılmayan parçaları atlamaya çalışıyoruz. [\#8908](https://github.com/ClickHouse/ClickHouse/pull/8908) ([Azat Khuzhin](https://github.com/azat)) - -#### Geliştirme {#improvement} - -- Uygulamak `ALTER MODIFY/DROP` için Mut topasyon topların üstüne sorgular `ReplicatedMergeTree*` motorlar ailesi. Şimdi `ALTERS` yalnızca meta veri güncelleme aşamasında engeller ve bundan sonra engellemez. [\#8701](https://github.com/ClickHouse/ClickHouse/pull/8701) ([alesapin](https://github.com/alesapin)) -- İle iç Birleşimlere çapraz yeniden yazma yeteneği ekleyin `WHERE` unqialified adları içeren bölüm. [\#9512](https://github.com/ClickHouse/ClickHouse/pull/9512) ([Artem Zuikov](https://github.com/4ertus2)) -- Yapmak `SHOW TABLES` ve `SHOW DATABASES` sorgular destek `WHERE` ifadeler ve `FROM`/`IN` [\#9076](https://github.com/ClickHouse/ClickHouse/pull/9076) ([sundyli](https://github.com/sundy-li)) -- Bir ayar eklendi `deduplicate_blocks_in_dependent_materialized_views`. [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) ([urykhy](https://github.com/urykhy)) -- Son değişikliklerden sonra MySQL istemcisi onaltılık ikili dizeleri yazdırmaya başladı ve böylece onları okunabilir hale getirdi ([\#9032](https://github.com/ClickHouse/ClickHouse/issues/9032)). Clickhouse'daki geçici çözüm, dize sütunlarını her zaman değil, genellikle durum olan UTF-8 olarak işaretlemektir. [\#9079](https://github.com/ClickHouse/ClickHouse/pull/9079) ([Yuriy Baranov](https://github.com/yurriy)) -- İçin dize ve FixedString tuşları desteği ekleyin `sumMap` [\#8903](https://github.com/ClickHouse/ClickHouse/pull/8903) ([Baudouin Giard](https://github.com/bgiard)) -- SummingMergeTree haritalarında dize anahtarlarını destekleyin [\#8933](https://github.com/ClickHouse/ClickHouse/pull/8933) ([Baudouin Giard](https://github.com/bgiard)) -- İş parçacığı özel durum atılmış olsa bile iş parçacığı havuzu için iş parçacığı sonlandırma sinyali [\#8736](https://github.com/ClickHouse/ClickHouse/pull/8736) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- Ayarlamak için izin ver `query_id` içinde `clickhouse-benchmark` [\#9416](https://github.com/ClickHouse/ClickHouse/pull/9416) ([Anton Popov](https://github.com/CurtizJ)) -- Garip ifadelere izin verme `ALTER TABLE ... PARTITION partition` sorgu. Bu adresler [\#7192](https://github.com/ClickHouse/ClickHouse/issues/7192) [\#8835](https://github.com/ClickHouse/ClickHouse/pull/8835) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tablo `system.table_engines` şimdi özellik desteği (gibi) hakkında bilgi sağlar `supports_ttl` veya `supports_sort_order`). [\#8830](https://github.com/ClickHouse/ClickHouse/pull/8830) ([Max Akhmedov](https://github.com/zlobober)) -- Etkinleştirmek `system.metric_log` varsayılan olarak. ProfileEvents, CurrentMetrics değerleri ile toplanan satırları içerecektir “collect\_interval\_milliseconds” aralığı (varsayılan olarak bir saniye). Tablo çok küçüktür (genellikle megabayt sırasına göre) ve bu verileri varsayılan olarak toplamak mantıklıdır. [\#9225](https://github.com/ClickHouse/ClickHouse/pull/9225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries. Fixes [\#6964](https://github.com/ClickHouse/ClickHouse/issues/6964) [\#8874](https://github.com/ClickHouse/ClickHouse/pull/8874) ([I ivanvan](https://github.com/abyss7)) -- Şimdi geçici `LIVE VIEW` tarafından oluşturulur `CREATE LIVE VIEW name WITH TIMEOUT [42] ...` yerine `CREATE TEMPORARY LIVE VIEW ...`, önceki sözdizimi ile tutarlı olmadığı için `CREATE TEMPORARY TABLE ...` [\#9131](https://github.com/ClickHouse/ClickHouse/pull/9131) ([tavplubix](https://github.com/tavplubix)) -- Text\_log ekleyin.giden girişleri sınırlamak için seviye yapılandırma parametresi `system.text_log` Tablo [\#8809](https://github.com/ClickHouse/ClickHouse/pull/8809) ([Azat Khuzhin](https://github.com/azat)) -- İndir partdiğiniz parçayı TTL kurallarına göre disk /lere/birim putlere koy allowmaya izin verin [\#8598](https://github.com/ClickHouse/ClickHouse/pull/8598) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Harici MySQL sözlükleri için, MySQL bağlantı havuzunun mutualize edilmesine izin verin “share” sözlükler arasında. Bu seçenek, MySQL sunucularına bağlantı sayısını önemli ölçüde azaltır. [\#9409](https://github.com/ClickHouse/ClickHouse/pull/9409) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- Quantiles için en yakın sorgu yürütme süresini göster `clickhouse-benchmark` enterpolasyonlu değerler yerine çıktı. Bazı sorguların yürütme süresine karşılık gelen değerleri göstermek daha iyidir. [\#8712](https://github.com/ClickHouse/ClickHouse/pull/8712) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kafka'ya veri eklerken mesaj için anahtar ve zaman damgası ekleme imkanı. Düzeltiyor [\#7198](https://github.com/ClickHouse/ClickHouse/issues/7198) [\#8969](https://github.com/ClickHouse/ClickHouse/pull/8969) ([filimonov](https://github.com/filimonov)) -- Sunucu terminalden çalıştırılırsa, iş parçacığı numarası, sorgu kimliği ve günlük önceliğini renklere göre vurgulayın. Bu, geliştiriciler için ilişkili günlük iletilerinin daha iyi okunabilirliği içindir. [\#8961](https://github.com/ClickHouse/ClickHouse/pull/8961) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tablolar yüklenirken daha iyi istisna mesajı `Ordinary` veritabanı. [\#9527](https://github.com/ClickHouse/ClickHouse/pull/9527) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Uygulamak `arraySlice` toplama işlev durumları olan diziler için. Bu düzeltmeler [\#9388](https://github.com/ClickHouse/ClickHouse/issues/9388) [\#9391](https://github.com/ClickHouse/ClickHouse/pull/9391) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- In operatörünün sağ tarafında sabit işlevlerin ve sabit dizilerin kullanılmasına izin verin. [\#8813](https://github.com/ClickHouse/ClickHouse/pull/8813) ([Anton Popov](https://github.com/CurtizJ)) -- Sistem için veri getirilirken zookeeper istisnası olduysa.yinelemeler, ayrı bir sütunda görüntüler. Bu uygular [\#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [\#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Atomically kaldırmak mergetree veri parçaları üzerinde yok. [\#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Dağıtılmış tablolar için satır düzeyinde güvenliği destekleyin. [\#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([I ivanvan](https://github.com/abyss7)) -- Now we recognize suffix (like KB, KiB…) in settings values. [\#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([Mikhail Korotov](https://github.com/millb)) -- Büyük bir birleştirme sonucu oluştururken bellek yetersizliğini önleyin. [\#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2)) -- Etkileşimli modda önerilere kümelerin isimleri eklendi `clickhouse-client`. [\#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([alexey-milovidov](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) ([I ivanvan](https://github.com/abyss7)) -- Eklenen sütun `exception_code` içinde `system.query_log` Tablo. [\#8770](https://github.com/ClickHouse/ClickHouse/pull/8770) ([Mikhail Korotov](https://github.com/millb)) -- Bağlantı noktasında etkin MySQL uyumluluk sunucusu `9004` varsayılan sunucu yapılandırma dosyasında. Yapılandırmada örnekte sabit şifre oluşturma komutu. [\#8771](https://github.com/ClickHouse/ClickHouse/pull/8771) ([Yuriy Baranov](https://github.com/yurriy)) -- Dosya sistemi readonly ise kapatma üzerinde iptal önleyin. Bu düzeltmeler [\#9094](https://github.com/ClickHouse/ClickHouse/issues/9094) [\#9100](https://github.com/ClickHouse/ClickHouse/pull/9100) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- HTTP POST sorgusunda uzunluk gerektiğinde daha iyi özel durum iletisi. [\#9453](https://github.com/ClickHouse/ClickHouse/pull/9453) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eklemek `_path` ve `_file` sanal sütunlar için `HDFS` ve `File` motorlar ve `hdfs` ve `file` tablo fonksiyonları [\#8489](https://github.com/ClickHouse/ClickHouse/pull/8489) ([Olga Khvostikova](https://github.com/stavrolia)) -- Hatayı Düzelt `Cannot find column` içine takarken `MATERIALIZED VIEW` durumda yeni sütun view'ın iç tabloya eklendi eğer. [\#8766](https://github.com/ClickHouse/ClickHouse/pull/8766) [\#8788](https://github.com/ClickHouse/ClickHouse/pull/8788) ([vzakaznikov](https://github.com/vzakaznikov)) [\#8788](https://github.com/ClickHouse/ClickHouse/issues/8788) [\#8806](https://github.com/ClickHouse/ClickHouse/pull/8806) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8803](https://github.com/ClickHouse/ClickHouse/pull/8803) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Son güncellemeden sonra ilerleme göndererek (günlük gibi) yerel istemci-sunucu protokolü üzerinden ilerlemeyi düzeltin. Bu, yalnızca yerel protokolü kullanan bazı üçüncü taraf araçlarla ilgili olabilir. [\#9495](https://github.com/ClickHouse/ClickHouse/pull/9495) ([Azat Khuzhin](https://github.com/azat)) -- MySQL protokolünü kullanarak istemci bağlantılarının sayısını izleyen bir sistem metriği ekleyin ([\#9013](https://github.com/ClickHouse/ClickHouse/issues/9013)). [\#9015](https://github.com/ClickHouse/ClickHouse/pull/9015) ([Eugene Klimov](https://github.com/Slach)) -- Şu andan itibaren, HTTP yanıtları olacak `X-ClickHouse-Timezone` başlık, aynı zaman dilimi değerine ayarlanmış `SELECT timezone()` rapor verecek. [\#9493](https://github.com/ClickHouse/ClickHouse/pull/9493) ([Denis Glazachev](https://github.com/traceon)) - -#### Performans İyileştirme {#performance-improvement} - -- In ile analiz endeksinin performansını artırın [\#9261](https://github.com/ClickHouse/ClickHouse/pull/9261) ([Anton Popov](https://github.com/CurtizJ)) -- Mantıksal işlevlerde daha basit ve daha verimli kod + kod temizleme. Bir takip için [\#8718](https://github.com/ClickHouse/ClickHouse/issues/8718) [\#8728](https://github.com/ClickHouse/ClickHouse/pull/8728) ([Alexander Kazakov](https://github.com/Akazz)) -- Genel performans iyileştirme (%5 aralığında..Etkilenen sorgular için %200) C++20 özellikleri ile daha sıkı takma sağlayarak. [\#9304](https://github.com/ClickHouse/ClickHouse/pull/9304) ([Amos Kuşu](https://github.com/amosbird)) -- Karşılaştırma işlevlerinin iç döngüleri için daha sıkı takma ad. [\#9327](https://github.com/ClickHouse/ClickHouse/pull/9327) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Aritmetik fonksiyonların iç döngüleri için daha sıkı takma ad. [\#9325](https://github.com/ClickHouse/ClickHouse/pull/9325) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- A ~ 3 kat daha hızlı uygulama için ColumnVector::replicate(), hangi aracılığıyla ColumnConst:: convertToFullColumn () uygulanır. Sabitleri gerçekleştirirken testlerde de yararlı olacaktır. [\#9293](https://github.com/ClickHouse/ClickHouse/pull/9293) ([Alexander Kazakov](https://github.com/Akazz)) -- Bir başka küçük performans iyileştirme `ColumnVector::replicate()` (bu hızlandırır `materialize` fonksiyonu ve daha yüksek mertebeden fonksiyonları) daha da geliştirilmesi için [\#9293](https://github.com/ClickHouse/ClickHouse/issues/9293) [\#9442](https://github.com/ClickHouse/ClickHouse/pull/9442) ([Alexander Kazakov](https://github.com/Akazz)) -- Geliştirilmiş performans `stochasticLinearRegression` toplama işlevi. Bu yama Intel tarafından katkıda bulunmuştur. [\#8652](https://github.com/ClickHouse/ClickHouse/pull/8652) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Performansını artırmak `reinterpretAsFixedString` işlev. [\#9342](https://github.com/ClickHouse/ClickHouse/pull/9342) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin istemciye blok gönder notmeyin `Null` işlemciler boru hattında Biçimlendir. [\#8797](https://github.com/ClickHouse/ClickHouse/pull/8797) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) [\#8767](https://github.com/ClickHouse/ClickHouse/pull/8767) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement} - -- Özel durum işleme artık Linux için Windows Alt Sisteminde düzgün çalışıyor. Bkz. https://github.com/ClickHouse-Extras/libunwind/pull/3 bu düzeltmeler [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) -- Değişmek `readline` ile `replxx` etkileşimli çizgi düzenleme için `clickhouse-client` [\#8416](https://github.com/ClickHouse/ClickHouse/pull/8416) ([I ivanvan](https://github.com/abyss7)) -- FunctionsComparison daha iyi inşa süresi ve daha az şablon örnekleri. [\#9324](https://github.com/ClickHouse/ClickHouse/pull/9324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İle entegrasyon eklendi `clang-tidy` CI. Ayrıca bakınız [\#6044](https://github.com/ClickHouse/ClickHouse/issues/6044) [\#9566](https://github.com/ClickHouse/ClickHouse/pull/9566) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi kullanarak cı içinde ClickHouse bağlantı `lld` için bile `gcc`. [\#9049](https://github.com/ClickHouse/ClickHouse/pull/9049) ([alesapin](https://github.com/alesapin)) -- İş parçacığı zamanlama rastgele izin ve glitches eklemek zaman `THREAD_FUZZER_*` ortam değişkenleri ayarlanır. Bu test yardımcı olur. [\#9459](https://github.com/ClickHouse/ClickHouse/pull/9459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Durumsuz testlerde güvenli soketleri etkinleştirme [\#9288](https://github.com/ClickHouse/ClickHouse/pull/9288) ([tavplubix](https://github.com/tavplubix)) -- Split\_shared\_libraries = daha sağlam yap [\#9156](https://github.com/ClickHouse/ClickHouse/pull/9156) ([Azat Khuzhin](https://github.com/azat)) -- Yapmak “performance\_introspection\_and\_logging” rastgele sunucuya güvenilir test sıkışmış. Bu CI ortamında gerçekleşebilir. Ayrıca bakınız [\#9515](https://github.com/ClickHouse/ClickHouse/issues/9515) [\#9528](https://github.com/ClickHouse/ClickHouse/pull/9528) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- XML stil onayında doğrulayın. [\#9550](https://github.com/ClickHouse/ClickHouse/pull/9550) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Testte sabit yarış durumu `00738_lock_for_inner_table`. Bu test uykuya dayanıyordu. [\#9555](https://github.com/ClickHouse/ClickHouse/pull/9555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tür performans testlerini kaldırın `once`. Bu, tüm performans testlerini istatistiksel karşılaştırma modunda çalıştırmak için gereklidir (daha güvenilir). [\#9557](https://github.com/ClickHouse/ClickHouse/pull/9557) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Aritmetik fonksiyonlar için performans testi eklendi. [\#9326](https://github.com/ClickHouse/ClickHouse/pull/9326) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin performans testi eklendi `sumMap` ve `sumMapWithOverflow` toplama fonksiyonları. İçin takip [\#8933](https://github.com/ClickHouse/ClickHouse/issues/8933) [\#8947](https://github.com/ClickHouse/ClickHouse/pull/8947) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Üslup ile ErrorCodes stil sağlamak. [\#9370](https://github.com/ClickHouse/ClickHouse/pull/9370) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Testler geçmişi için komut dosyası ekleyin. [\#8796](https://github.com/ClickHouse/ClickHouse/pull/8796) ([alesapin](https://github.com/alesapin)) -- GCC uyarısı Ekle `-Wsuggest-override` tüm yerleri bulmak ve düzeltmek için `override` anahtar kelime kullanılmalıdır. [\#8760](https://github.com/ClickHouse/ClickHouse/pull/8760) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Tanımlanmalıdır çünkü Mac OS X altında zayıf sembolü Yoksay [\#9538](https://github.com/ClickHouse/ClickHouse/pull/9538) ([Silinmiş kullanıcı](https://github.com/ghost)) -- Performans testlerinde bazı sorguların çalışma süresini normalleştirin. Bu, tüm performans testlerini karşılaştırma modunda çalıştırmak için hazırlık olarak yapılır. [\#9565](https://github.com/ClickHouse/ClickHouse/pull/9565) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sorgu testleriyle pytest'i desteklemek için bazı testleri düzeltin [\#9062](https://github.com/ClickHouse/ClickHouse/pull/9062) ([I ivanvan](https://github.com/abyss7)) -- Ssl'yi msan ile oluşturmada etkinleştirin, böylece durumsuz testler çalıştırırken sunucu başlangıçta başarısız olmaz [\#9531](https://github.com/ClickHouse/ClickHouse/pull/9531) ([tavplubix](https://github.com/tavplubix)) -- Test sonuçlarında veritabanı ikamesini düzeltin [\#9384](https://github.com/ClickHouse/ClickHouse/pull/9384) ([Ilya Yatsishin](https://github.com/qoega)) -- Çeşitli platformlar için düzeltmeler oluşturun [\#9381](https://github.com/ClickHouse/ClickHouse/pull/9381) ([proller](https://github.com/proller)) [\#8755](https://github.com/ClickHouse/ClickHouse/pull/8755) ([proller](https://github.com/proller)) [\#8631](https://github.com/ClickHouse/ClickHouse/pull/8631) ([proller](https://github.com/proller)) -- Stateless-with-coverage test docker görüntüsüne diskler bölümü eklendi [\#9213](https://github.com/ClickHouse/ClickHouse/pull/9213) ([Pavel Kovalenko](https://github.com/Jokser)) -- GRPC ile oluştururken kaynak ağacı dosyalarından kurtulun [\#9588](https://github.com/ClickHouse/ClickHouse/pull/9588) ([Amos Kuşu](https://github.com/amosbird)) -- Sessioncleaner'ı bağlamdan kaldırarak biraz daha hızlı oluşturma süresi. SessionCleaner kodunu daha basit hale getirin. [\#9232](https://github.com/ClickHouse/ClickHouse/pull/9232) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Clickhouse-test komut dosyasında asılı sorgular için güncelleme denetimi [\#8858](https://github.com/ClickHouse/ClickHouse/pull/8858) ([Alexander Kazakov](https://github.com/Akazz)) -- Depodan bazı gereksiz dosyaları kaldırıldı. [\#8843](https://github.com/ClickHouse/ClickHouse/pull/8843) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Değişen matematik perftests türü `once` -e doğru `loop`. [\#8783](https://github.com/ClickHouse/ClickHouse/pull/8783) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Bizim kod tabanı için interaktif kod tarayıcı HTML raporu oluşturmanıza olanak sağlar docker görüntü ekleyin. [\#8781](https://github.com/ClickHouse/ClickHouse/pull/8781) ([alesapin](https://github.com/alesapin)) Görmek [Woboq Kod Tarayıcı](https://clickhouse.tech/codebrowser/html_report///ClickHouse/dbms/src/index.html) -- MSan altında bazı test hatalarını bastırın. [\#8780](https://github.com/ClickHouse/ClickHouse/pull/8780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Hızlanma “exception while insert” test. Bu sınama genellikle hata ayıklama-with-coverage derlemede zaman aşımına uğradı. [\#8711](https://github.com/ClickHouse/ClickHouse/pull/8711) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Güncel `libcxx` ve `libcxxabi` yenmek. Hazırlan preparationmasında [\#9304](https://github.com/ClickHouse/ClickHouse/issues/9304) [\#9308](https://github.com/ClickHouse/ClickHouse/pull/9308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Flacky testi düzeltin `00910_zookeeper_test_alter_compression_codecs`. [\#9525](https://github.com/ClickHouse/ClickHouse/pull/9525) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yinelenen bağlayıcı bayrakları temizleyin. Bağlayıcının beklenmedik bir sembol aramayacağından emin olun. [\#9433](https://github.com/ClickHouse/ClickHouse/pull/9433) ([Amos Kuşu](https://github.com/amosbird)) -- Eklemek `clickhouse-odbc` test görüntüleri içine sürücü. Bu, ClickHouse ile clickhouse etkileşimini kendi ODBC sürücüsü aracılığıyla test etmeyi sağlar. [\#9348](https://github.com/ClickHouse/ClickHouse/pull/9348) ([filimonov](https://github.com/filimonov)) -- Birim testlerinde birkaç hatayı düzeltin. [\#9047](https://github.com/ClickHouse/ClickHouse/pull/9047) ([alesapin](https://github.com/alesapin)) -- Etkinleştirmek `-Wmissing-include-dirs` Mevcut olmayan tüm içeriklerin ortadan kaldırılması için GCC uyarısı-çoğunlukla cmake komut dosyası hatalarının bir sonucu olarak [\#8704](https://github.com/ClickHouse/ClickHouse/pull/8704) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Sorgu profiler çalışamaz, nedenleri açıklayın. Bu için tasarlanmıştır [\#9049](https://github.com/ClickHouse/ClickHouse/issues/9049) [\#9144](https://github.com/ClickHouse/ClickHouse/pull/9144) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Openssl'yi upstream master'a güncelleyin. TLS bağlantıları mesajla başarısız olabilir sorunu düzeltildi `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error` ve `SSL Exception: error:2400006E:random number generator::error retrieving entropy`. Sorun 20.1 sürümünde mevcuttu. [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sunucu için Dockerfile güncelleme [\#8893](https://github.com/ClickHouse/ClickHouse/pull/8893) ([Ilya Mazaev](https://github.com/ne-ray)) -- Build-gcc-from-sources komut dosyasında küçük düzeltmeler [\#8774](https://github.com/ClickHouse/ClickHouse/pull/8774) ([Michael Nacharov](https://github.com/mnach)) -- Değişmek `numbers` -e doğru `zeros` perftests nerede `number` sütun kullanılmaz. Bu daha temiz test sonuçlarına yol açacaktır. [\#9600](https://github.com/ClickHouse/ClickHouse/pull/9600) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Sütun yapıcılarında ınitializer\_list kullanırken yığın taşması sorununu düzeltin. [\#9367](https://github.com/ClickHouse/ClickHouse/pull/9367) ([Silinmiş kullanıcı](https://github.com/ghost)) -- V1.3.0 için librdkafka yükseltin. Birlikte etkinleştir `rdkafka` ve `gsasl` Mac OS X kitaplıkları. [\#9000](https://github.com/ClickHouse/ClickHouse/pull/9000) ([Andrew Onyshchuk](https://github.com/oandrew)) -- gcc 9.2.0 üzerinde düzeltme oluşturun [\#9306](https://github.com/ClickHouse/ClickHouse/pull/9306) ([vxider](https://github.com/Vxider)) - -## ClickHouse yayın v20. 1 {#clickhouse-release-v20-1} - -### ClickHouse yayın v20. 1. 8. 41, 2020-03-20 {#clickhouse-release-v20-1-8-41-2020-03-20} - -#### Hata Düzeltme {#bug-fix-3} - -- Olası kalıcı düzeltme `Cannot schedule a task` hata (işlenmeyen özel durum nedeniyle `ParallelAggregatingBlockInputStream::Handler::onFinish/onFinishThread`). Bu düzeltmeler [\#6833](https://github.com/ClickHouse/ClickHouse/issues/6833). [\#9154](https://github.com/ClickHouse/ClickHouse/pull/9154) ([Azat Khuzhin](https://github.com/azat)) -- Aşırı bellek tüketimini düzeltin `ALTER` sorgular (Mut (asyonlar). Bu düzeltmeler [\#9533](https://github.com/ClickHouse/ClickHouse/issues/9533) ve [\#9670](https://github.com/ClickHouse/ClickHouse/issues/9670). [\#9754](https://github.com/ClickHouse/ClickHouse/pull/9754) ([alesapin](https://github.com/alesapin)) -- Dış sözlükler DDL backquoting hatayı düzeltin. Bu düzeltmeler [\#9619](https://github.com/ClickHouse/ClickHouse/issues/9619). [\#9734](https://github.com/ClickHouse/ClickHouse/pull/9734) ([alesapin](https://github.com/alesapin)) - -### ClickHouse yayın v20.1. 7. 38, 2020-03-18 {#clickhouse-release-v20-1-7-38-2020-03-18} - -#### Hata Düzeltme {#bug-fix-4} - -- Sabit yanlış iç işlev adları için `sumKahan` ve `sumWithOverflow`. Bu işlevleri uzak sorgularda kullanırken istisnaya yol açarım. [\#9636](https://github.com/ClickHouse/ClickHouse/pull/9636) ([Azat Khuzhin](https://github.com/azat)). Bu sorun tüm ClickHouse sürümlerindeydi. -- Vermek `ALTER ON CLUSTER` -den `Distributed` iç çoğaltma ile tablolar. Bu düzeltmeler [\#3268](https://github.com/ClickHouse/ClickHouse/issues/3268). [\#9617](https://github.com/ClickHouse/ClickHouse/pull/9617) ([shinoi2](https://github.com/shinoi2)). Bu sorun tüm ClickHouse sürümlerindeydi. -- Olası istisnaları düzeltin `Size of filter doesn't match size of column` ve `Invalid number of rows in Chunk` içinde `MergeTreeRangeReader`. Yürüt whileürken görün theyebilirler `PREWHERE` bazı durumlarda. Düzeltiyor [\#9132](https://github.com/ClickHouse/ClickHouse/issues/9132). [\#9612](https://github.com/ClickHouse/ClickHouse/pull/9612) ([Anton Popov](https://github.com/CurtizJ)) -- Sorunu düzeltildi: Eğer gibi basit bir aritmetik ifade yazarsanız zaman dilimi korunmuş değildi `time + 1` (gibi bir ifadenin aksine `time + INTERVAL 1 SECOND`). Bu düzeltmeler [\#5743](https://github.com/ClickHouse/ClickHouse/issues/5743). [\#9323](https://github.com/ClickHouse/ClickHouse/pull/9323) ([alexey-milovidov](https://github.com/alexey-milovidov)). Bu sorun tüm ClickHouse sürümlerindeydi. -- Artık basit döngüsel takma adlarla sütunlar oluşturmak veya eklemek mümkün değil `a DEFAULT b, b DEFAULT a`. [\#9603](https://github.com/ClickHouse/ClickHouse/pull/9603) ([alesapin](https://github.com/alesapin)) -- Base64 kodlanmış değerin sonunda dolgu hatalı biçimlendirilmiş olabilir sorunu düzeltildi. Base64 kütüphanesini güncelleyin. Bu düzeltmeler [\#9491](https://github.com/ClickHouse/ClickHouse/issues/9491), yaklar [\#9492](https://github.com/ClickHouse/ClickHouse/issues/9492) [\#9500](https://github.com/ClickHouse/ClickHouse/pull/9500) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İmha veri yarışı Fix `Poco::HTTPServer`. Sunucu başlatıldığında ve hemen kapatıldığında gerçekleşebilir. [\#9468](https://github.com/ClickHouse/ClickHouse/pull/9468) ([Anton Popov](https://github.com/CurtizJ)) -- Olası kilitlenme/yanlış satır sayısını düzeltin `LIMIT n WITH TIES` n'th satırına eşit çok sayıda satır olduğunda. [\#9464](https://github.com/ClickHouse/ClickHouse/pull/9464) ([tavplubix](https://github.com/tavplubix)) -- Sütun TTLs ile olası eşleşmeyen sağlama toplamlarını düzeltin. [\#9451](https://github.com/ClickHouse/ClickHouse/pull/9451) ([Anton Popov](https://github.com/CurtizJ)) -- Bir kullanıcı denediğinde çökmeyi düzeltin `ALTER MODIFY SETTING` eski formatlı için `MergeTree` masa motorları ailesi. [\#9435](https://github.com/ClickHouse/ClickHouse/pull/9435) ([alesapin](https://github.com/alesapin)) -- Şimdi mutasyonları daha sık sonuçlandırmaya çalışacağız. [\#9427](https://github.com/ClickHouse/ClickHouse/pull/9427) ([alesapin](https://github.com/alesapin)) -- Çoğaltma protokolü uyumsuzluğunu düzeltme [\#8598](https://github.com/ClickHouse/ClickHouse/issues/8598). [\#9412](https://github.com/ClickHouse/ClickHouse/pull/9412) ([alesapin](https://github.com/alesapin)) -- Dizi türlerinin bloom\_filter dizini için değil(has()) düzeltin. [\#9407](https://github.com/ClickHouse/ClickHouse/pull/9407) ([achimbab](https://github.com/achimbab)) -- Davranışı Düzelt theildi `match` ve `extract` haystack sıfır bayt olduğunda işlevler. Haystack sabit olduğunda davranış yanlıştı. Bu düzeltmeler [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) ([alexey-milovidov](https://github.com/alexey-milovidov)) [\#9345](https://github.com/ClickHouse/ClickHouse/pull/9345) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-1} - -- Özel durum işleme artık Linux için Windows Alt Sisteminde düzgün çalışıyor. Bkz. https://github.com/ClickHouse-Extras/libunwind/pull/3 bu düzeltmeler [\#6480](https://github.com/ClickHouse/ClickHouse/issues/6480) [\#9564](https://github.com/ClickHouse/ClickHouse/pull/9564) ([sobolevsv](https://github.com/sobolevsv)) - -### ClickHouse yayın v20. 1. 6. 30, 2020-03-05 {#clickhouse-release-v20-1-6-30-2020-03-05} - -#### Hata Düzeltme {#bug-fix-5} - -- Sıkıştırıldığında veri uyumsuzluğunu düzeltin `T64` codec. - [\#9039](https://github.com/ClickHouse/ClickHouse/pull/9039) [(abyss7)](https://github.com/abyss7) -- Mergetree tablosundan bir iş parçacığında okurken aralıkların sırasını düzeltin. Düzeltiyor [\#8964](https://github.com/ClickHouse/ClickHouse/issues/8964). - [\#9050](https://github.com/ClickHouse/ClickHouse/pull/9050) [(CurtizJ)](https://github.com/CurtizJ) -- Olası segfault'u düzeltin `MergeTreeRangeReader`, Yürüt whileürken `PREWHERE`. Düzeltiyor [\#9064](https://github.com/ClickHouse/ClickHouse/issues/9064). - [\#9106](https://github.com/ClickHouse/ClickHouse/pull/9106) [(CurtizJ)](https://github.com/CurtizJ) -- Düzeltmek `reinterpretAsFixedString` dönmek `FixedString` yerine `String`. - [\#9052](https://github.com/ClickHouse/ClickHouse/pull/9052) [(oandrew)](https://github.com/oandrew) -- Düzeltmek `joinGet` null dönüş türleri ile. Düzeltiyor [\#8919](https://github.com/ClickHouse/ClickHouse/issues/8919) - [\#9014](https://github.com/ClickHouse/ClickHouse/pull/9014) [(amosbird)](https://github.com/amosbird) -- Fuzz testini ve bittestall/bitTestAny işlevlerinin yanlış davranışını düzeltin. - [\#9143](https://github.com/ClickHouse/ClickHouse/pull/9143) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Haystack sıfır bayt olduğunda match ve extract işlevlerinin davranışını düzeltin. Haystack sabit olduğunda davranış yanlıştı. Düzeltiyor [\#9160](https://github.com/ClickHouse/ClickHouse/issues/9160) - [\#9163](https://github.com/ClickHouse/ClickHouse/pull/9163) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Kesinlikle monotinik olmayan fonksiyonel indeks kullanıldığında ters yüklemlerin sabit yürütülmesi. Düzeltiyor [\#9034](https://github.com/ClickHouse/ClickHouse/issues/9034) - [\#9223](https://github.com/ClickHouse/ClickHouse/pull/9223) [(Akazz)](https://github.com/Akazz) -- Yeniden yazmak için izin ver `CROSS` -e doğru `INNER JOIN` varsa `[NOT] LIKE` operat inor in `WHERE` bölme. Düzeltiyor [\#9191](https://github.com/ClickHouse/ClickHouse/issues/9191) - [\#9229](https://github.com/ClickHouse/ClickHouse/pull/9229) [(4ertus2)](https://github.com/4ertus2) -- Log engine ile bir tablodaki ilk sütunların bir diğer ad olmasına izin verin. - [\#9231](https://github.com/ClickHouse/ClickHouse/pull/9231) [(abyss7)](https://github.com/abyss7) -- Virgülle birleşmeye izin ver `IN()` için. Düzeltiyor [\#7314](https://github.com/ClickHouse/ClickHouse/issues/7314). - [\#9251](https://github.com/ClickHouse/ClickHouse/pull/9251) [(4ertus2)](https://github.com/4ertus2) -- Geliştirmek `ALTER MODIFY/ADD` sorgu mantığı. Şimdi yapamazsın `ADD` türü olmayan sütun, `MODIFY` varsayılan ifade sütun türünü değiştirmez ve `MODIFY` tür varsayılan ifade değerini kaybetmez. Düzeltiyor [\#8669](https://github.com/ClickHouse/ClickHouse/issues/8669). - [\#9227](https://github.com/ClickHouse/ClickHouse/pull/9227) [(alesapin)](https://github.com/alesapin) -- Mutasyonlar kesinleşmesini düzeltin, zaten mutasyon yapıldığında is\_done = 0 durumuna sahip olabilir. - [\#9217](https://github.com/ClickHouse/ClickHouse/pull/9217) [(alesapin)](https://github.com/alesapin) -- Destek “Processors” sistem için boru hattı.sayılar ve sistem.numbers\_mt. Bu aynı zamanda hatayı giderir `max_execution_time` saygın değildir. - [\#7796](https://github.com/ClickHouse/ClickHouse/pull/7796) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- Yanlış saymayı düzeltin `DictCacheKeysRequestedFound` ölçü. - [\#9411](https://github.com/ClickHouse/ClickHouse/pull/9411) [(nikitamikhaylov)](https://github.com/nikitamikhaylov) -- Depolama politikası için bir kontrol eklendi `ATTACH PARTITION FROM`, `REPLACE PARTITION`, `MOVE TO TABLE` aksi halde, yeniden başlatıldıktan sonra parçanın verilerini erişilemez hale getirebilir ve Clickhouse'un başlatılmasını önleyebilir. - [\#9383](https://github.com/ClickHouse/ClickHouse/pull/9383) [(excitoon)](https://github.com/excitoon) -- Sabit UBSan raporu `MergeTreeIndexSet`. Bu düzeltmeler [\#9250](https://github.com/ClickHouse/ClickHouse/issues/9250) - [\#9365](https://github.com/ClickHouse/ClickHouse/pull/9365) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- BlockİO Olası datarace Fix. - [\#9356](https://github.com/ClickHouse/ClickHouse/pull/9356) [(KochetovNicolai)](https://github.com/KochetovNicolai) -- İçin destek `UInt64` json ile ilgili işlevlerde Int64'e uymayan sayılar. Güncelleştirme `SIMDJSON` yenmek. Bu düzeltmeler [\#9209](https://github.com/ClickHouse/ClickHouse/issues/9209) - [\#9344](https://github.com/ClickHouse/ClickHouse/pull/9344) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Veri dizini ayrı bir aygıta takılıysa, boş alan miktarı doğru hesaplanmadığında sorunu düzeltin. Varsayılan disk için veri alt dizinindeki boş alanı hesaplayın. Bu düzeltmeler [\#7441](https://github.com/ClickHouse/ClickHouse/issues/7441) - [\#9257](https://github.com/ClickHouse/ClickHouse/pull/9257) [(millb)](https://github.com/millb) -- Mesajla TLS bağlantıları başarısız olduğunda sorunu düzeltin `OpenSSL SSL_read: error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error and SSL Exception: error:2400006E:random number generator::error retrieving entropy.` Openssl'yi upstream master'a güncelleyin. - [\#8956](https://github.com/ClickHouse/ClickHouse/pull/8956) [(alexey-milovidov)](https://github.com/alexey-milovidov) -- Yürüt whenürken `CREATE` sorgu, depolama motoru argümanlarında sabit ifadeleri katlayın. Boş veritabanı adı geçerli veritabanı ile değiştirin. Düzeltiyor [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). Ayrıca ClickHouseDictionarySource yerel adresi için onay düzeltin. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- Segfault'u düzeltin `StorageMerge`, StorageFile okurken olabilir. - [\#9387](https://github.com/ClickHouse/ClickHouse/pull/9387) [(tabplubix)](https://github.com/tavplubix) -- Veri kaybını önlemek `Kafka` nadir durumlarda istisna sonek okuduktan sonra ancak taahhütten önce gerçekleşir. Düzeltiyor [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). İlgili: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(filimonov)](https://github.com/filimonov) -- Kullanmaya / bırakmaya çalışırken sunucu sonlandırmasına giden hatayı düzeltin `Kafka` tablo yanlış parametrelerle oluşturuldu. Düzeltiyor [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). Birleşiyor [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(filimonov)](https://github.com/filimonov) - -#### Yenilik {#new-feature-1} - -- Eklemek `deduplicate_blocks_in_dependent_materialized_views` hayata manzaralı tablolara idempotent ekler davranışlarını kontrol etmek için Seçenek. Bu yeni özellik, altınity'den özel bir istek ile bugfix sürümüne eklendi. - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### ClickHouse yayın v20.1. 2. 4, 2020-01-22 {#clickhouse-release-v20-1-2-4-2020-01-22} - -#### Geriye Dönük Uyumsuz Değişim {#backward-incompatible-change-1} - -- Ayarı yap `merge_tree_uniform_read_distribution` eski. Sunucu hala bu ayarı tanır, ancak hiçbir etkisi yoktur. [\#8308](https://github.com/ClickHouse/ClickHouse/pull/8308) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Fonksiyonun dönüş türünü değiştirdi `greatCircleDistance` -e doğru `Float32` çünkü şimdi hesaplamanın sonucu `Float32`. [\#7993](https://github.com/ClickHouse/ClickHouse/pull/7993) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi sorgu parametrelerinin şu şekilde temsil edilmesi bekleniyor “escaped” biçimli. Örneğin, dize geçmek için `ab` yazmak zorundasın `a\tb` veya `a\b` ve sırasıyla, `a%5Ctb` veya `a%5C%09b` URL in'de. Bu, NULL olarak geçme olasılığını eklemek için gereklidir `\N`. Bu düzeltmeler [\#7488](https://github.com/ClickHouse/ClickHouse/issues/7488). [\#8517](https://github.com/ClickHouse/ClickHouse/pull/8517) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Etkinleştirmek `use_minimalistic_part_header_in_zookeeper` için ayar `ReplicatedMergeTree` varsayılan olarak. Bu, Zookeeper'da depolanan veri miktarını önemli ölçüde azaltacaktır. Bu ayar 19.1 sürümünden beri desteklenmektedir ve zaten yarım yıldan fazla bir süredir herhangi bir sorun yaşamadan birden fazla hizmette üretimde kullanıyoruz. 19.1'den eski sürümlere geçiş yapma şansınız varsa bu ayarı devre dışı bırakın. [\#6850](https://github.com/ClickHouse/ClickHouse/pull/6850) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Veri atlama endeksleri üretim hazır ve varsayılan olarak etkindir. Ayar `allow_experimental_data_skipping_indices`, `allow_experimental_cross_to_join_conversion` ve `allow_experimental_multiple_joins_emulation` artık eskimiş ve hiçbir şey yapma. [\#7974](https://github.com/ClickHouse/ClickHouse/pull/7974) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yeni Ekle `ANY JOIN` için mantık `StorageJoin` ile tutarlı `JOIN` işleyiş. Davranış değişiklikleri olmadan yükseltmek için eklemeniz gerekir `SETTINGS any_join_distinct_right_table_keys = 1` motor tabloları meta katılmak veya yükseltmeden sonra bu tabloları yeniden oluşturmak için. [\#8400](https://github.com/ClickHouse/ClickHouse/pull/8400) ([Artem Zuikov](https://github.com/4ertus2)) -- Günlük yapılandırma değişiklikleri uygulamak için yeniden başlatılması için sunucu gerektirir. Bu, sunucunun silinmiş bir günlük dosyasına oturum açtığı hatayı önlemek için geçici bir geçici çözümdür (bkz. [\#8696](https://github.com/ClickHouse/ClickHouse/issues/8696)). [\#8707](https://github.com/ClickHouse/ClickHouse/pull/8707) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -#### Yenilik {#new-feature-2} - -- Parça yolları hakkında bilgi eklendi `system.merges`. [\#8043](https://github.com/ClickHouse/ClickHouse/pull/8043) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Yürütme yeteneği Ekle `SYSTEM RELOAD DICTIONARY` sorgu içinde `ON CLUSTER` modu. [\#8288](https://github.com/ClickHouse/ClickHouse/pull/8288) ([Guillaume Tassery](https://github.com/YiuRULE)) -- Yürütme yeteneği Ekle `CREATE DICTIONARY` sorgular `ON CLUSTER` modu. [\#8163](https://github.com/ClickHouse/ClickHouse/pull/8163) ([alesapin](https://github.com/alesapin)) -- Şimdi kullanıcının profili `users.xml` birden çok profil devralır. [\#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- Katma `system.stack_trace` tüm sunucu iş parçacıklarının yığın izlerine bakmayı sağlayan tablo. Bu, geliştiricilerin sunucu durumunu iç gözlemlemesi için kullanışlıdır. Bu düzeltmeler [\#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [\#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eklemek `DateTime64` yapılandırılabilir alt ikinci hassasiyetle veri türü. [\#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk)) -- Tablo fonksiyonu Ekle `clusterAllReplicas` kümedeki tüm düğümleri sorgulamaya izin verir. [\#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari)) -- Toplama işlevi Ekle `categoricalInformationValue` ayrık bir özelliğin bilgi değerini hesaplar. [\#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz)) -- Veri dosyalarının ayrıştırılmasını hızlandırın `CSV`, `TSV` ve `JSONEachRow` paralel olarak yaparak Biçimlendir .in. [\#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Fonksiyon Ekle `bankerRound` bankacı yuvarlama yapar. [\#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz)) -- Bölge adları için gömülü sözlükte daha fazla dil desteği: ‘ru’, ‘en’, ‘ua’, ‘uk’, ‘by’, ‘kz’, ‘tr’, ‘de’, ‘uz’, ‘lv’, ‘lt’, ‘et’, ‘pt’, ‘he’, ‘vi’. [\#8189](https://github.com/ClickHouse/ClickHouse/pull/8189) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tutarlılıktaki gelişmeler `ANY JOIN` mantıksal. Şimdi `t1 ANY LEFT JOIN t2` eşitlikler `t2 ANY RIGHT JOIN t1`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Ayar Ekle `any_join_distinct_right_table_keys` için eski davranışları sağlayan `ANY INNER JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Yeni Ekle `SEMI` ve `ANTI JOIN`. Yaş `ANY INNER JOIN` davranış şu anda mevcut `SEMI LEFT JOIN`. [\#7665](https://github.com/ClickHouse/ClickHouse/pull/7665) ([Artem Zuikov](https://github.com/4ertus2)) -- Katma `Distributed` format for `File` motor ve `file` okumak için izin veren tablo işlevi `.bin` asenkron ekler tarafından oluşturulan dosyalar `Distributed` Tablo. [\#8535](https://github.com/ClickHouse/ClickHouse/pull/8535) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- İsteğe bağlı Sıfırla sütun argümanı Ekle `runningAccumulate` hangi her yeni anahtar değeri için toplama sonuçlarını sıfırlamak için izin verir. [\#8326](https://github.com/ClickHouse/ClickHouse/pull/8326) ([Sergey Kononenko](https://github.com/kononencheg)) -- Prometheus bitiş noktası olarak ClickHouse kullanma yeteneği ekleyin. [\#7900](https://github.com/ClickHouse/ClickHouse/pull/7900) ([vdimir](https://github.com/Vdimir)) -- Bölüm Ekle `` içinde `config.xml` uzak tablo motorları ve tablo işlevleri için izin verilen ana bilgisayarları kısıtlayan `URL`, `S3`, `HDFS`. [\#7154](https://github.com/ClickHouse/ClickHouse/pull/7154) ([Mikhail Korotov](https://github.com/millb)) -- Eklendi fonksiyonu `greatCircleAngle` bir küre üzerindeki mesafeyi derece cinsinden hesaplar. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- H3 kütüphanesi ile tutarlı olacak şekilde dünya yarıçapı değiştirildi. [\#8105](https://github.com/ClickHouse/ClickHouse/pull/8105) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Katma `JSONCompactEachRow` ve `JSONCompactEachRowWithNamesAndTypes` giriş ve çıkış biçimleri. [\#7841](https://github.com/ClickHouse/ClickHouse/pull/7841) ([Mikhail Korotov](https://github.com/millb)) -- Dosya ile ilgili tablo motorları ve tablo işlevleri için özellik eklendi (`File`, `S3`, `URL`, `HDFS`) okuma ve yaz allowsmayı sağlayan `gzip` ek motor parametresi veya dosya uzantısına dayalı dosyalar. [\#7840](https://github.com/ClickHouse/ClickHouse/pull/7840) ([Andrey Bodrov](https://github.com/apbodrov)) -- Add theed the `randomASCII(length)` fonksiyon, rastgele bir dizi ile bir dize oluşturma [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) yazdırılabilir karakterler. [\#8401](https://github.com/ClickHouse/ClickHouse/pull/8401) ([Süngü](https://github.com/BayoNet)) -- Eklendi fonksiyonu `JSONExtractArrayRaw` ayrıştırılmamış json dizi öğelerinde bir dizi döndürür `JSON` dize. [\#8081](https://github.com/ClickHouse/ClickHouse/pull/8081) ([Oleg Matrokhin](https://github.com/errx)) -- Eklemek `arrayZip` eşit uzunluktaki birden fazla diziyi bir dizi diziye birleştirmeyi sağlayan işlev. [\#8149](https://github.com/ClickHouse/ClickHouse/pull/8149) ([Kış Zhang](https://github.com/zhang2014)) -- Yapılandırılmış göre diskler arasında veri taşımak için yeteneği ekleyin `TTL`- ifadeler için `*MergeTree` masa motorları ailesi. [\#8140](https://github.com/ClickHouse/ClickHouse/pull/8140) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Yeni toplama fonksiyonu eklendi `avgWeighted` hangi ağırlıklı ortalama hesaplamak için izin verir. [\#7898](https://github.com/ClickHouse/ClickHouse/pull/7898) ([Andrey Bodrov](https://github.com/apbodrov)) -- Şimdi paralel ayrıştırma için varsayılan olarak etkindir `TSV`, `TSKV`, `CSV` ve `JSONEachRow` biçimliler. [\#7894](https://github.com/ClickHouse/ClickHouse/pull/7894) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Birkaç coğrafi işlev Ekle `H3` kitaplık: `h3GetResolution`, `h3EdgeAngle`, `h3EdgeLength`, `h3IsValid` ve `h3kRing`. [\#8034](https://github.com/ClickHouse/ClickHouse/pull/8034) ([Konstantin Malanchev](https://github.com/hombit)) -- Brotli için destek eklendi (`br`) dosya ile ilgili Depolarda ve tablo işlevlerinde sıkıştırma. Bu düzeltmeler [\#8156](https://github.com/ClickHouse/ClickHouse/issues/8156). [\#8526](https://github.com/ClickHouse/ClickHouse/pull/8526) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Eklemek `groupBit*` fonksiyonlar için `SimpleAggregationFunction` tür. [\#8485](https://github.com/ClickHouse/ClickHouse/pull/8485) ([Guillaume Tassery](https://github.com/YiuRULE)) - -#### Hata Düzeltme {#bug-fix-6} - -- Tabloların yeniden adlandırılmasını düzeltin `Distributed` motor. Düzeltmeler sorunu [\#7868](https://github.com/ClickHouse/ClickHouse/issues/7868). [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- Şimdi sözlükler desteği `EXPRESSION` non-ClickHouse SQL lehçesinde keyfi dizedeki öznitelikler için. [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([alesapin](https://github.com/alesapin)) -- Kırık düzeltmek `INSERT SELECT FROM mysql(...)` sorgu. Bu düzeltmeler [\#8070](https://github.com/ClickHouse/ClickHouse/issues/8070) ve [\#7960](https://github.com/ClickHouse/ClickHouse/issues/7960). [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- Hatayı Düzelt “Mismatch column sizes” varsayılan eklerken `Tuple` itibaren `JSONEachRow`. Bu düzeltmeler [\#5653](https://github.com/ClickHouse/ClickHouse/issues/5653). [\#8606](https://github.com/ClickHouse/ClickHouse/pull/8606) ([tavplubix](https://github.com/tavplubix)) -- Şimdi kullanılması durumunda bir istisna atılacaktır `WITH TIES` birlikte `LIMIT BY`. Ayrıca kullanma yeteneği ekleyin `TOP` ile `LIMIT BY`. Bu düzeltmeler [\#7472](https://github.com/ClickHouse/ClickHouse/issues/7472). [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Taze glibc sürümünden istenmeyen bağımlılığı düzeltin `clickhouse-odbc-bridge` ikilik. [\#8046](https://github.com/ClickHouse/ClickHouse/pull/8046) ([Amos Kuşu](https://github.com/amosbird)) -- Kontrol fonksiyonunda hatayı düzeltin `*MergeTree` motorlar ailesi. Şimdi, son granül ve son işarette (nihai olmayan) eşit miktarda satıra sahip olduğumuzda başarısız olmaz. [\#8047](https://github.com/ClickHouse/ClickHouse/pull/8047) ([alesapin](https://github.com/alesapin)) -- Insert Into Fix `Enum*` sonra sütunlar `ALTER` sorgu, altta yatan sayısal tür tablo belirtilen türe eşit olduğunda. Bu düzeltmeler [\#7836](https://github.com/ClickHouse/ClickHouse/issues/7836). [\#7908](https://github.com/ClickHouse/ClickHouse/pull/7908) ([Anton Popov](https://github.com/CurtizJ)) -- İzin verilen sabit olmayan negatif “size” fonksiyon için argüman `substring`. Yanlışlıkla izin verilmedi. Bu düzeltmeler [\#4832](https://github.com/ClickHouse/ClickHouse/issues/4832). [\#7703](https://github.com/ClickHouse/ClickHouse/pull/7703) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yanlış sayıda argüman geçtiğinde ayrıştırma hatasını düzeltin `(O|J)DBC` masa motoru. [\#7709](https://github.com/ClickHouse/ClickHouse/pull/7709) ([alesapin](https://github.com/alesapin)) -- Syslog için günlükleri gönderirken çalışan clickhouse işleminin komut adını kullanma. Önceki sürümlerde, komut adı yerine boş dize kullanıldı. [\#8460](https://github.com/ClickHouse/ClickHouse/pull/8460) ([Michael Nacharov](https://github.com/mnach)) -- İzin verilen ana bilgisayarların kontrolünü düzeltin `localhost`. Bu PR, sağlanan çözümü düzeltir [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241). [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([Vitaly Baranov](https://github.com/vitlibar)) -- Nadir kazayı düzeltin `argMin` ve `argMax` sonuç kullanıldığında, uzun dize bağımsız değişkenleri için işlevler `runningAccumulate` işlev. Bu düzeltmeler [\#8325](https://github.com/ClickHouse/ClickHouse/issues/8325) [\#8341](https://github.com/ClickHouse/ClickHouse/pull/8341) ([dinozor](https://github.com/769344359)) -- İle tablolar için bellek overcommit Fix `Buffer` motor. [\#8345](https://github.com/ClickHouse/ClickHouse/pull/8345) ([Azat Khuzhin](https://github.com/azat)) -- Alabilir fonksiyonları sabit potansiyel hata `NULL` bağımsız değişkenlerden biri olarak ve NULL olmayan döndürür. [\#8196](https://github.com/ClickHouse/ClickHouse/pull/8196) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Arka plan işlemleri için iş parçacığı havuzunda daha iyi metrik hesaplamaları `MergeTree` masa motorları. [\#8194](https://github.com/ClickHouse/ClickHouse/pull/8194) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Düzeltme fonksiyonu `IN` için `WHERE` satır düzeyinde tablo filtresi varsa deyimi. Düzeltiyor [\#6687](https://github.com/ClickHouse/ClickHouse/issues/6687) [\#8357](https://github.com/ClickHouse/ClickHouse/pull/8357) ([I ivanvan](https://github.com/abyss7)) -- Şimdi, integral değeri ayarlar değerleri için tamamen ayrıştırılmazsa bir istisna atılır. [\#7678](https://github.com/ClickHouse/ClickHouse/pull/7678) ([Mikhail Korotov](https://github.com/millb)) -- Toplama işlevi, sorguda ikiden fazla yerel parça içeren dağıtılmış tabloya kullanıldığında özel durumu düzeltin. [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- Şimdi bloom filtresi sıfır uzunluk dizilerini işleyebilir ve gereksiz hesaplamalar yapmaz. [\#8242](https://github.com/ClickHouse/ClickHouse/pull/8242) ([achimbab](https://github.com/achimbab)) -- Bir istemci ana bilgisayar için istemci ana bilgisayar eşleştirerek izin verilip verilmediğini kontrol sabit `host_regexp` belirtilen `users.xml`. [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241) ([Vitaly Baranov](https://github.com/vitlibar)) -- Çoklu olarak yanlış pozitiflere yol açan belirsiz sütun kontrolünü rahatlatın `JOIN ON` bölme. [\#8385](https://github.com/ClickHouse/ClickHouse/pull/8385) ([Artem Zuikov](https://github.com/4ertus2)) -- Sabit Olası sunucu çökmesi (`std::terminate`) sunucu veri gönder cannotem whenediğinde veya yaz theama thedığında `JSON` veya `XML` değerleri ile biçim `String` veri türü (gerektiren `UTF-8` doğrulama) veya sonuç verilerini Brotli algoritması ile sıkıştırırken veya diğer bazı nadir durumlarda. Bu düzeltmeler [\#7603](https://github.com/ClickHouse/ClickHouse/issues/7603) [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yarış durumunu düzeltin `StorageDistributedDirectoryMonitor` CI tarafından bulundu. Bu düzeltmeler [\#8364](https://github.com/ClickHouse/ClickHouse/issues/8364). [\#8383](https://github.com/ClickHouse/ClickHouse/pull/8383) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Şimdi arka plan birleşir `*MergeTree` tablo motorları ailesi depolama ilkesi hacim sırasını daha doğru bir şekilde korur. [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Şimdi masa motoru `Kafka` ile düzgün çalışır `Native` biçimli. Bu düzeltmeler [\#6731](https://github.com/ClickHouse/ClickHouse/issues/6731) [\#7337](https://github.com/ClickHouse/ClickHouse/issues/7337) [\#8003](https://github.com/ClickHouse/ClickHouse/issues/8003). [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -- Başlıklarla sabit formatlar (gibi `CSVWithNames`) tablo motoru için EOF hakkında istisna atıyorlardı `Kafka`. [\#8016](https://github.com/ClickHouse/ClickHouse/pull/8016) ([filimonov](https://github.com/filimonov)) -- Sağ kısmında alt sorgudan set yapma ile bir hata düzeltildi `IN` bölme. Bu düzeltmeler [\#5767](https://github.com/ClickHouse/ClickHouse/issues/5767) ve [\#2542](https://github.com/ClickHouse/ClickHouse/issues/2542). [\#7755](https://github.com/ClickHouse/ClickHouse/pull/7755) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Depolama alanından okurken Olası kazayı düzeltin `File`. [\#7756](https://github.com/ClickHouse/ClickHouse/pull/7756) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Dosyaların sabit okuma `Parquet` tür sütunları içeren biçim `list`. [\#8334](https://github.com/ClickHouse/ClickHouse/pull/8334) ([maxulan](https://github.com/maxulan)) -- Hatayı Düzelt `Not found column` ile dağıtılmış sorgular için `PREWHERE` örnekleme anahtarına bağımlı durum `max_parallel_replicas > 1`. [\#7913](https://github.com/ClickHouse/ClickHouse/pull/7913) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Hatayı Düzelt `Not found column` sorgu kullanılırsa `PREWHERE` tablonun diğer adı ve sonuç kümesi bağımlı birincil anahtar koşulu nedeniyle boştu. [\#7911](https://github.com/ClickHouse/ClickHouse/pull/7911) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Fonksiyonlar için sabit dönüş tipi `rand` ve `randConstant` durumunda `Nullable` değişken. Şimdi fonksiyonlar her zaman geri döner `UInt32` ve asla `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Engelli yüklem push-down için `WITH FILL` ifade. Bu düzeltmeler [\#7784](https://github.com/ClickHouse/ClickHouse/issues/7784). [\#7789](https://github.com/ClickHouse/ClickHouse/pull/7789) ([Kış Zhang](https://github.com/zhang2014)) -- Sabit yanlış `count()` res forult for `SummingMergeTree` ne zaman `FINAL` bölüm kullanılır. [\#3280](https://github.com/ClickHouse/ClickHouse/issues/3280) [\#7786](https://github.com/ClickHouse/ClickHouse/pull/7786) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Uzak sunuculardan sabit işlevler için olası yanlış sonucu düzeltin. Gibi işlevlerle sorgular için oldu `version()`, `uptime()` vb. farklı sunucular için farklı sabit değerler döndürür. Bu düzeltmeler [\#7666](https://github.com/ClickHouse/ClickHouse/issues/7666). [\#7689](https://github.com/ClickHouse/ClickHouse/pull/7689) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Yanlış sonuçlara yol açan push-down yüklemi optimizasyonunda karmaşık hatayı düzeltin. Bu, push-down yüklemi optimizasyonu ile ilgili birçok sorunu giderir. [\#8503](https://github.com/ClickHouse/ClickHouse/pull/8503) ([Kış Zhang](https://github.com/zhang2014)) -- Çökmeyi düzeltin `CREATE TABLE .. AS dictionary` sorgu. [\#8508](https://github.com/ClickHouse/ClickHouse/pull/8508) ([Azat Khuzhin](https://github.com/azat)) -- Çeşitli iyileştirmeler clickhouse dilbilgisi `.g4` Dosya. [\#8294](https://github.com/ClickHouse/ClickHouse/pull/8294) ([taiyang-li](https://github.com/taiyang-li)) -- Çökmelere yol açan hatayı düzeltin `JOIN`motorlu tablolar ile s `Join`. Bu düzeltmeler [\#7556](https://github.com/ClickHouse/ClickHouse/issues/7556) [\#8254](https://github.com/ClickHouse/ClickHouse/issues/8254) [\#7915](https://github.com/ClickHouse/ClickHouse/issues/7915) [\#8100](https://github.com/ClickHouse/ClickHouse/issues/8100). [\#8298](https://github.com/ClickHouse/ClickHouse/pull/8298) ([Artem Zuikov](https://github.com/4ertus2)) -- Gereksiz sözlükleri yeniden yükleyin `CREATE DATABASE`. [\#7916](https://github.com/ClickHouse/ClickHouse/pull/7916) ([Azat Khuzhin](https://github.com/azat)) -- Okuma için maksimum akış sayısını sınırlayın `StorageFile` ve `StorageHDFS`. Düzeltmeler https://github.com/ClickHouse/ClickHouse/issues/7650. [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([alesapin](https://github.com/alesapin)) -- Hatayı düzeltin `ALTER ... MODIFY ... CODEC` sorgu, kullanıcı hem varsayılan ifade hem de codec belirttiğinde. Düzeltiyor [8593](https://github.com/ClickHouse/ClickHouse/issues/8593). [\#8614](https://github.com/ClickHouse/ClickHouse/pull/8614) ([alesapin](https://github.com/alesapin)) -- Sütunların arka plan birleşimindeki hatayı düzeltin `SimpleAggregateFunction(LowCardinality)` tür. [\#8613](https://github.com/ClickHouse/ClickHouse/pull/8613) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Sabit tip kontrol fonksiyonu `toDateTime64`. [\#8375](https://github.com/ClickHouse/ClickHouse/pull/8375) ([Vasily Nemkov](https://github.com/Enmk)) -- Şimdi sunucu üzerinde çökme yok `LEFT` veya `FULL JOIN` ve Birleştirme motoru ve desteklenmeyen `join_use_nulls` ayarlar. [\#8479](https://github.com/ClickHouse/ClickHouse/pull/8479) ([Artem Zuikov](https://github.com/4ertus2)) -- Şimdi `DROP DICTIONARY IF EXISTS db.dict` sorgu, istisna atmıyor `db` yok. [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([Vitaly Baranov](https://github.com/vitlibar)) -- Tablo işlevlerinde Olası çökmeleri düzeltin (`file`, `mysql`, `remote`) referans kullanımı nedeniyle Kaldır toılan `IStorage` nesne. Tablo işlevine ekleme sırasında belirtilen sütunların yanlış ayrıştırılmasını düzeltin. [\#7762](https://github.com/ClickHouse/ClickHouse/pull/7762) ([tavplubix](https://github.com/tavplubix)) -- Başlamadan önce ağ olun `clickhouse-server`. Bu düzeltmeler [\#7507](https://github.com/ClickHouse/ClickHouse/issues/7507). [\#8570](https://github.com/ClickHouse/ClickHouse/pull/8570) ([Zhichang Yu](https://github.com/yuzhichang)) -- Güvenli bağlantılar için zaman aşımlarını düzeltin, böylece sorgular belirsiz bir şekilde askıda kalmaz. Bu düzeltmeler [\#8126](https://github.com/ClickHouse/ClickHouse/issues/8126). [\#8128](https://github.com/ClickHouse/ClickHouse/pull/8128) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltmek `clickhouse-copier`'In eşzamanlı işçiler arasındaki gereksiz çekişme. [\#7816](https://github.com/ClickHouse/ClickHouse/pull/7816) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- Şimdi mutasyonlar, mutasyon versiyonları mevcut mutasyon versiyonundan daha büyük olsa bile, ekli parçaları atlamaz. [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([Zhichang Yu](https://github.com/yuzhichang)) [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([alesapin](https://github.com/alesapin)) -- Gereksiz kopyaları Yoksay `*MergeTree` başka bir diske ve sunucuya taşındıktan sonra veri parçaları yeniden başlatılır. [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Çökmeyi düzeltin `FULL JOIN` ile `LowCardinality` içinde `JOIN` anahtar. [\#8252](https://github.com/ClickHouse/ClickHouse/pull/8252) ([Artem Zuikov](https://github.com/4ertus2)) -- Sütun adını birden çok kez ekleme sorgusu gibi kullanmak yasaktır `INSERT INTO tbl (x, y, x)`. Bu düzeltmeler [\#5465](https://github.com/ClickHouse/ClickHouse/issues/5465), [\#7681](https://github.com/ClickHouse/ClickHouse/issues/7681). [\#7685](https://github.com/ClickHouse/ClickHouse/pull/7685) ([alesapin](https://github.com/alesapin)) -- Bilinmeyen CPU'lar için fiziksel CPU çekirdeği sayısını tespit etmek için geri dönüş eklendi (mantıksal CPU çekirdeği sayısını kullanarak). Bu düzeltmeler [\#5239](https://github.com/ClickHouse/ClickHouse/issues/5239). [\#7726](https://github.com/ClickHouse/ClickHouse/pull/7726) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltmek `There's no column` materialized ve alias sütunlar için hata. [\#8210](https://github.com/ClickHouse/ClickHouse/pull/8210) ([Artem Zuikov](https://github.com/4ertus2)) -- Sabit sever kazasında zaman `EXISTS` sorgu olmadan kullanıldı `TABLE` veya `DICTIONARY` niteleyici. Gibi `EXISTS t`. Bu düzeltmeler [\#8172](https://github.com/ClickHouse/ClickHouse/issues/8172). Bu hata 19.17 sürümünde tanıtıldı. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Nadir hatayı hata ile düzeltin `"Sizes of columns doesn't match"` kullanırken bu görünebilir `SimpleAggregateFunction` sütun. [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- Boş olan kullanıcının bulunduğu hatayı düzeltin `allow_databases` tüm veritabanlarına erişim var (ve aynı `allow_dictionaries`). [\#7793](https://github.com/ClickHouse/ClickHouse/pull/7793) ([DeifyTheGod](https://github.com/DeifyTheGod)) -- Sunucu zaten istemciden bağlantısı kesildiğinde istemci çökmesini düzeltin. [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- Düzeltmek `ORDER BY` birincil anahtar öneki ve birincil anahtar soneki ile sıralama durumunda davranış. [\#7759](https://github.com/ClickHouse/ClickHouse/pull/7759) ([Anton Popov](https://github.com/CurtizJ)) -- Tabloda nitelikli sütun mevcut olup olmadığını kontrol edin. Bu düzeltmeler [\#6836](https://github.com/ClickHouse/ClickHouse/issues/6836). [\#7758](https://github.com/ClickHouse/ClickHouse/pull/7758) ([Artem Zuikov](https://github.com/4ertus2)) -- İle sabit davranış `ALTER MOVE` belirtilen birleştirme bitiş hamle superpart hemen sonra koştu. Düzeltiyor [\#8103](https://github.com/ClickHouse/ClickHouse/issues/8103). [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Kullanırken Olası sunucu çökmesini düzeltin `UNION` farklı sayıda sütun ile. Düzeltiyor [\#7279](https://github.com/ClickHouse/ClickHouse/issues/7279). [\#7929](https://github.com/ClickHouse/ClickHouse/pull/7929) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- İşlev için sonuç alt dizesinin boyutunu düzeltin `substr` negatif boyutu ile. [\#8589](https://github.com/ClickHouse/ClickHouse/pull/8589) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Şimdi server part Mut mutasyonu Yürüt inmüyor `MergeTree` arka plan havuzunda yeterli boş iş parçacığı yoksa. [\#8588](https://github.com/ClickHouse/ClickHouse/pull/8588) ([tavplubix](https://github.com/tavplubix)) -- Biçimlendirmede küçük bir yazım hatası düzeltildi `UNION ALL` AST. [\#7999](https://github.com/ClickHouse/ClickHouse/pull/7999) ([litao91](https://github.com/litao91)) -- Negatif sayılar için sabit yanlış bloom filtre sonuçları. Bu düzeltmeler [\#8317](https://github.com/ClickHouse/ClickHouse/issues/8317). [\#8566](https://github.com/ClickHouse/ClickHouse/pull/8566) ([Kış Zhang](https://github.com/zhang2014)) -- Sıkıştırmada sabit potansiyel tampon taşması. Kötü niyetli kullanıcı, arabellekten sonra okunmasına neden olacak sıkıştırılmış verileri iletebilir. Bu sorun Yandex bilgi güvenliği ekibinden Eldar Zaitov tarafından bulundu. [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Tamsayılar taşması nedeniyle yanlış sonucu düzeltin `arrayIntersect`. [\#7777](https://github.com/ClickHouse/ClickHouse/pull/7777) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Şimdi `OPTIMIZE TABLE` sorgu işlemi gerçekleştirmek çevrimdışı yinelemeler için beklemez. [\#8314](https://github.com/ClickHouse/ClickHouse/pull/8314) ([javi santana](https://github.com/javisantana)) -- Sabit `ALTER TTL` par forser for `Replicated*MergeTree` Tablolar. [\#8318](https://github.com/ClickHouse/ClickHouse/pull/8318) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Sunucu ve istemci arasındaki iletişimi düzeltin, böylece sunucu sorgu hatasından sonra geçici tablolar bilgilerini okur. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- Düzeltmek `bitmapAnd` birleştirilmiş bir bit eşlem ve bir skaler bit eşlem kesişen işlev hatası. [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([Yue Huang](https://github.com/moon03432)) -- Tanımı rafine `ZXid` hata düzeltmeleri ZooKeeper programcı Kılavuzu göre `clickhouse-cluster-copier`. [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([Ding Xiang Fei](https://github.com/dingxiangfei2009)) -- `odbc` tablo fonksiyonu şimdi saygı `external_table_functions_use_nulls` ayar. [\#7506](https://github.com/ClickHouse/ClickHouse/pull/7506) ([Vasily Nemkov](https://github.com/Enmk)) -- Nadir bir veri yarışına yol açan Sabit hata. [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([Alexander Kazakov](https://github.com/Akazz)) -- Şimdi `SYSTEM RELOAD DICTIONARY` göz ardı ederek bir sözlüğü tamamen yeniden yükler `update_field`. Bu düzeltmeler [\#7440](https://github.com/ClickHouse/ClickHouse/issues/7440). [\#8037](https://github.com/ClickHouse/ClickHouse/pull/8037) ([Vitaly Baranov](https://github.com/vitlibar)) -- Sözlüğün sorgu oluştur'da olup olmadığını kontrol etme yeteneği ekleyin. [\#8032](https://github.com/ClickHouse/ClickHouse/pull/8032) ([alesapin](https://github.com/alesapin)) -- Düzeltmek `Float*` ayrıştırma `Values` biçimli. Bu düzeltmeler [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817). [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- Bazı arka plan işlemlerinde yer ayıramadığımızda çökmeyi düzeltin `*MergeTree` masa motorları ailesi. [\#7873](https://github.com/ClickHouse/ClickHouse/pull/7873) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Tablo içerdiğinde birleştirme işleminin çökmesini düzeltin `SimpleAggregateFunction(LowCardinality)` sütun. Bu düzeltmeler [\#8515](https://github.com/ClickHouse/ClickHouse/issues/8515). [\#8522](https://github.com/ClickHouse/ClickHouse/pull/8522) ([Azat Khuzhin](https://github.com/azat)) -- Tüm YBÜ yerel destek geri yükleme ve sabit ifadeler için harmanlama uygulamak için yeteneği ekleyin. Ayrıca dil adı ekleyin `system.collations` Tablo. [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([alesapin](https://github.com/alesapin)) -- Sıfır minimum ömrü olan harici sözlükler olduğunda hatayı düzeltin (`LIFETIME(MIN 0 MAX N)`, `LIFETIME(N)`) arka planda güncelleme yapmayın. [\#7983](https://github.com/ClickHouse/ClickHouse/pull/7983) ([alesapin](https://github.com/alesapin)) -- ClickHouse kaynağı ile harici sözlük sorguda alt sorgu olduğunda çökmesini düzeltin. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Motor ile tablodaki dosya uzantısının yanlış ayrıştırılmasını düzeltin `URL`. Bu düzeltmeler [\#8157](https://github.com/ClickHouse/ClickHouse/issues/8157). [\#8419](https://github.com/ClickHouse/ClickHouse/pull/8419) ([Andrey Bodrov](https://github.com/apbodrov)) -- Düzeltmek `CHECK TABLE` sorgu için `*MergeTree` anahtarsız tablolar. Düzeltiyor [\#7543](https://github.com/ClickHouse/ClickHouse/issues/7543). [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([alesapin](https://github.com/alesapin)) -- Sabit dönüşüm `Float64` MySQL türü için. [\#8079](https://github.com/ClickHouse/ClickHouse/pull/8079) ([Yuriy Baranov](https://github.com/yurriy)) -- Şimdi Eğer tablo tamamen sunucu çökmesi nedeniyle düştü değildi, sunucu geri yüklemek ve yüklemek için çalışacağız. [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- Tablo işlevinde sabit çökme `file` mevcut olmayan dosyaya eklerken. Şimdi bu durumda dosya oluşturulur ve daha sonra insert işlenir. [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- Ne zaman olabilir nadir kilitlenme Fix `trace_log` etkin olduğunu. [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- Yanında farklı türleri ile çalışmak için yeteneği ekleyin `Date` içinde `RangeHashed` DDL sorgusundan oluşturulan dış sözlük. Düzeltiyor [7899](https://github.com/ClickHouse/ClickHouse/issues/7899). [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([alesapin](https://github.com/alesapin)) -- Düzeltmeler çökme zaman `now64()` başka bir işlevin sonucu ile çağrılır. [\#8270](https://github.com/ClickHouse/ClickHouse/pull/8270) ([Vasily Nemkov](https://github.com/Enmk)) -- Mysql Tel protokolü üzerinden bağlantılar için istemci IP tespit ile Sabit hata. [\#7743](https://github.com/ClickHouse/ClickHouse/pull/7743) ([Dmitry Muzyka](https://github.com/dmitriy-myz)) -- Boş dizi işlemeyi düzeltin `arraySplit` işlev. Bu düzeltmeler [\#7708](https://github.com/ClickHouse/ClickHouse/issues/7708). [\#7747](https://github.com/ClickHouse/ClickHouse/pull/7747) ([hcz](https://github.com/hczhcz)) -- Sorunu ne zaman düzeltildi `pid-file` başka bir koşu `clickhouse-server` silinebilir. [\#8487](https://github.com/ClickHouse/ClickHouse/pull/8487) ([Weiqing Xu](https://github.com/weiqxu)) -- Varsa sözlük yeniden yükle `invalidate_query`, güncellemeleri durdurdu ve önceki güncelleme denemelerinde bazı istisnalar. [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([alesapin](https://github.com/alesapin)) -- Fonksiyonda Sabit hata `arrayReduce` bu yol açabilir “double free” ve toplu işlev birleştiricisinde hata `Resample` bu bellek sızıntısına neden olabilir. Toplama fonksiyonu eklendi `aggThrow`. Bu fonksiyon test amaçlı kullanılabilir. [\#8446](https://github.com/ClickHouse/ClickHouse/pull/8446) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Geliştirme {#improvement-1} - -- İle çalışırken geliştirilmiş günlük kaydı `S3` masa motoru. [\#8251](https://github.com/ClickHouse/ClickHouse/pull/8251) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- Çağrılırken hiçbir bağımsız değişken geçirildiğinde yazdırılan yardım iletisi `clickhouse-local`. Bu düzeltmeler [\#5335](https://github.com/ClickHouse/ClickHouse/issues/5335). [\#8230](https://github.com/ClickHouse/ClickHouse/pull/8230) ([Andrey Nagorny](https://github.com/Melancholic)) -- Ayar Ekle `mutations_sync` hangi beklemek sağlar `ALTER UPDATE/DELETE` eşzamanlı sorgular. [\#8237](https://github.com/ClickHouse/ClickHouse/pull/8237) ([alesapin](https://github.com/alesapin)) -- Göreli ayarlamak için izin ver `user_files_path` içinde `config.xml` (bir şekilde benzer `format_schema_path`). [\#7632](https://github.com/ClickHouse/ClickHouse/pull/7632) ([hcz](https://github.com/hczhcz)) -- Dönüştürme işlevleri için yasadışı türler için istisna Ekle `-OrZero` postfix. [\#7880](https://github.com/ClickHouse/ClickHouse/pull/7880) ([Andrey Konyaev](https://github.com/akonyaev90)) -- Bir dağıtılmış sorgu bir parça için veri gönderme başlığındaki kolay bir biçim. [\#8044](https://github.com/ClickHouse/ClickHouse/pull/8044) ([Vitaly Baranov](https://github.com/vitlibar)) -- `Live View` tablo motoru refactoring. [\#8519](https://github.com/ClickHouse/ClickHouse/pull/8519) ([vzakaznikov](https://github.com/vzakaznikov)) -- DDL sorgularından oluşturulan dış sözlükler için ek kontroller ekleyin. [\#8127](https://github.com/ClickHouse/ClickHouse/pull/8127) ([alesapin](https://github.com/alesapin)) -- Hatayı Düzelt `Column ... already exists` kullanırken `FINAL` ve `SAMPLE` together, e.g. `select count() from table final sample 1/2`. Düzeltiyor [\#5186](https://github.com/ClickHouse/ClickHouse/issues/5186). [\#7907](https://github.com/ClickHouse/ClickHouse/pull/7907) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Şimdi tablo ilk argüman `joinGet` fonksiyon tablo indentifier olabilir. [\#7707](https://github.com/ClickHouse/ClickHouse/pull/7707) ([Amos Kuşu](https://github.com/amosbird)) -- Kullanmaya izin ver `MaterializedView` yukarıdaki alt sorgularla `Kafka` Tablolar. [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) -- Şimdi arka plan diskler arasında hareket eder, seprate iş parçacığı havuzunu çalıştırır. [\#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon)) -- `SYSTEM RELOAD DICTIONARY` şimdi eşzamanlı olarak yürütür. [\#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([Vitaly Baranov](https://github.com/vitlibar)) -- Yığın izleri artık sanal bellek adresleri yerine (nesne dosyasının yüklendiği) fiziksel adresleri (nesne dosyasındaki uzaklıklar) görüntüler. Bu kullanımına izin verir `addr2line` ikili konum bağımsız ve ASLR etkin olduğunda. Bu düzeltmeler [\#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [\#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Satır düzeyinde güvenlik filtreleri için yeni sözdizimi desteği: `
`. Düzeltiyor [\#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [\#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([I ivanvan](https://github.com/abyss7)) -- Şimdi `cityHash` fonksiyonu ile çalışabilir `Decimal` ve `UUID` türler. Düzeltiyor [\#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [\#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([Mikhail Korotov](https://github.com/millb)) -- Uyarlanabilir tanecikliliğin uygulanmasından sonra eskimiş olduğu için sistem günlüklerinden sabit dizin tanecikliliği (1024 idi) kaldırıldı. [\#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- ClickHouse SSL olmadan derlendiğinde etkin MySQL uyumluluk sunucusu. [\#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([Yuriy Baranov](https://github.com/yurriy)) -- Şimdi sunucu sağlama toplamları toplu halde bozuk veri durumunda daha ayrıntılı hatalar veren partiler dağıttı. [\#7914](https://github.com/ClickHouse/ClickHouse/pull/7914) ([Azat Khuzhin](https://github.com/azat)) -- Destek `DROP DATABASE`, `DETACH TABLE`, `DROP TABLE` ve `ATTACH TABLE` için `MySQL` veritabanı motoru. [\#8202](https://github.com/ClickHouse/ClickHouse/pull/8202) ([Kış Zhang](https://github.com/zhang2014)) -- S3 tablo fonksiyonu ve tablo motoru kimlik doğrulama ekleyin. [\#7623](https://github.com/ClickHouse/ClickHouse/pull/7623) ([Vladimir Chebotarev](https://github.com/excitoon)) -- İlave parçalar için kontrol eklendi `MergeTree` farklı disklerde, tanımlanmamış disklerdeki veri parçalarını kaçırmamak için. [\#8118](https://github.com/ClickHouse/ClickHouse/pull/8118) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Mac istemci ve sunucu için SSL desteğini etkinleştirin. [\#8297](https://github.com/ClickHouse/ClickHouse/pull/8297) ([I ivanvan](https://github.com/abyss7)) -- Şimdi ClickHouse MySQL Federe sunucu olarak çalışabilir (bkz https://dev.mysql.com/doc/refman/5.7/en/federated-create-server.html). [\#7717](https://github.com/ClickHouse/ClickHouse/pull/7717) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- `clickhouse-client` şimdi sadece etkinleştir `bracketed-paste` multiquery açık ve çok satırlı kapalı olduğunda. Bu düzeltmeler (\#7757) \[https://github.com/ClickHouse/ClickHouse/issues/7757\]. [\#7761](https://github.com/ClickHouse/ClickHouse/pull/7761) ([Amos Kuşu](https://github.com/amosbird)) -- Destek `Array(Decimal)` içinde `if` işlev. [\#7721](https://github.com/ClickHouse/ClickHouse/pull/7721) ([Artem Zuikov](https://github.com/4ertus2)) -- Destek ondalık `arrayDifference`, `arrayCumSum` ve `arrayCumSumNegative` işlevler. [\#7724](https://github.com/ClickHouse/ClickHouse/pull/7724) ([Artem Zuikov](https://github.com/4ertus2)) -- Katma `lifetime` sütun için `system.dictionaries` Tablo. [\#6820](https://github.com/ClickHouse/ClickHouse/issues/6820) [\#7727](https://github.com/ClickHouse/ClickHouse/pull/7727) ([kekekule](https://github.com/kekekekule)) -- İçin farklı disklerde mevcut parçalar için geliştirilmiş kontrol `*MergeTree` masa motorları. Kur [\#7660](https://github.com/ClickHouse/ClickHouse/issues/7660). [\#8440](https://github.com/ClickHouse/ClickHouse/pull/8440) ([Vladimir Chebotarev](https://github.com/excitoon)) -- İle entegrasyon `AWS SDK` için `S3` tüm S3 özelliklerini kutudan çıkarmaya izin veren etkileşimler. [\#8011](https://github.com/ClickHouse/ClickHouse/pull/8011) ([Pavel Kovalenko](https://github.com/Jokser)) -- Alt sorgular için destek eklendi `Live View` Tablolar. [\#7792](https://github.com/ClickHouse/ClickHouse/pull/7792) ([vzakaznikov](https://github.com/vzakaznikov)) -- Kullanmak için kontrol edin `Date` veya `DateTime` sütun fromundan `TTL` ifadeler kaldırıldı. [\#7920](https://github.com/ClickHouse/ClickHouse/pull/7920) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Disk hakkında bilgi eklendi `system.detached_parts` Tablo. [\#7833](https://github.com/ClickHouse/ClickHouse/pull/7833) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Şimdi ayarlar `max_(table|partition)_size_to_drop` yeniden başlatma olmadan değiştirilebilir. [\#7779](https://github.com/ClickHouse/ClickHouse/pull/7779) ([Grigory Pervakov](https://github.com/GrigoryPervakov)) -- Hata mesajlarının biraz daha iyi kullanılabilirliği. Kullanıcıdan aşağıdaki satırları kaldırmamasını isteyin `Stack trace:`. [\#7897](https://github.com/ClickHouse/ClickHouse/pull/7897) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Daha iyi okuma mesajları `Kafka` sonra çeşitli biçim enginelerde motor [\#7935](https://github.com/ClickHouse/ClickHouse/issues/7935). [\#8035](https://github.com/ClickHouse/ClickHouse/pull/8035) ([I ivanvan](https://github.com/abyss7)) -- Desteklemeyen MySQL istemcileri ile daha iyi uyumluluk `sha2_password` auth eklentisi. [\#8036](https://github.com/ClickHouse/ClickHouse/pull/8036) ([Yuriy Baranov](https://github.com/yurriy)) -- MySQL uyumluluk sunucusunda daha fazla sütun türünü destekleyin. [\#7975](https://github.com/ClickHouse/ClickHouse/pull/7975) ([Yuriy Baranov](https://github.com/yurriy)) -- Uygulamak `ORDER BY` için optimizasyon `Merge`, `Buffer` ve `Materilized View` altta yatan depolar `MergeTree` Tablolar. [\#8130](https://github.com/ClickHouse/ClickHouse/pull/8130) ([Anton Popov](https://github.com/CurtizJ)) -- Şimdi her zaman POSIX uygulamasını kullanıyoruz `getrandom` eski çekirdeklerle daha iyi uyumluluğa sahip olmak (\<3.17). [\#7940](https://github.com/ClickHouse/ClickHouse/pull/7940) ([Amos Kuşu](https://github.com/amosbird)) -- Bir hareket TTL kuralında geçerli hedef için daha iyi kontrol edin. [\#8410](https://github.com/ClickHouse/ClickHouse/pull/8410) ([Vladimir Chebotarev](https://github.com/excitoon)) -- Kırık ekleme partileri için daha iyi kontroller `Distributed` masa motoru. [\#7933](https://github.com/ClickHouse/ClickHouse/pull/7933) ([Azat Khuzhin](https://github.com/azat)) -- Gelecekte işlem mustesi gereken parça adı diz ofisiyle sütun ekleme `system.mutations` Tablo. [\#8179](https://github.com/ClickHouse/ClickHouse/pull/8179) ([alesapin](https://github.com/alesapin)) -- İşlemciler için paralel birleştirme sıralama optimizasyonu. [\#8552](https://github.com/ClickHouse/ClickHouse/pull/8552) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Ayar `mark_cache_min_lifetime` artık eskimiş ve hiçbir şey yapmıyor. Önceki sürümlerde, Mark cache bellek daha büyük büyüyebilir `mark_cache_size` içinde veri karşılamak için `mark_cache_min_lifetime` ikincilikler. Bu, karışıklığa ve beklenenden daha yüksek bellek kullanımına yol açıyordu, bu özellikle bellek kısıtlı sistemlerde kötüydü. Bu sürümü yükledikten sonra performans düşüşü görecekseniz, `mark_cache_size`. [\#8484](https://github.com/ClickHouse/ClickHouse/pull/8484) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kullanıma hazırlık `tid` her yerde. Bu için gereklidir [\#7477](https://github.com/ClickHouse/ClickHouse/issues/7477). [\#8276](https://github.com/ClickHouse/ClickHouse/pull/8276) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -#### Performans İyileştirme {#performance-improvement-1} - -- İşlemciler boru hattında performans iyileştirmeleri. [\#7988](https://github.com/ClickHouse/ClickHouse/pull/7988) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Önbellek sözlüklerinde süresi dolmuş anahtarların engellenmeyen güncellemeleri (eskileri okuma izni ile). [\#8303](https://github.com/ClickHouse/ClickHouse/pull/8303) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Olmadan ClickHouse derlemek `-fno-omit-frame-pointer` küresel bir daha kayıt yedek. [\#8097](https://github.com/ClickHouse/ClickHouse/pull/8097) ([Amos Kuşu](https://github.com/amosbird)) -- Hızlanma `greatCircleDistance` fonksiyon ve bunun için performans testleri ekleyin. [\#7307](https://github.com/ClickHouse/ClickHouse/pull/7307) ([Olga Khvostikova](https://github.com/stavrolia)) -- Fonksiyonun geliştirilmiş performansı `roundDown`. [\#8465](https://github.com/ClickHouse/ClickHouse/pull/8465) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Geliştirilmiş performans `max`, `min`, `argMin`, `argMax` için `DateTime64` veri türü. [\#8199](https://github.com/ClickHouse/ClickHouse/pull/8199) ([Vasily Nemkov](https://github.com/Enmk)) -- Bir sınırı olmadan veya büyük sınırı ve dış sıralama ile sıralama geliştirilmiş performans. [\#8545](https://github.com/ClickHouse/ClickHouse/pull/8545) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kayan nokta sayılarını 6 kata kadar biçimlendirmenin geliştirilmiş performansı. [\#8542](https://github.com/ClickHouse/ClickHouse/pull/8542) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Geliştirilmiş performans `modulo` işlev. [\#7750](https://github.com/ClickHouse/ClickHouse/pull/7750) ([Amos Kuşu](https://github.com/amosbird)) -- Optimum `ORDER BY` ve tek sütun tuşu ile birleştirme. [\#8335](https://github.com/ClickHouse/ClickHouse/pull/8335) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin daha iyi uygulama `arrayReduce`, `-Array` ve `-State` birleştiriciler. [\#7710](https://github.com/ClickHouse/ClickHouse/pull/7710) ([Amos Kuşu](https://github.com/amosbird)) -- Şimdi `PREWHERE` olarak en az verimli olacak şekilde optimize edilmelidir `WHERE`. [\#7769](https://github.com/ClickHouse/ClickHouse/pull/7769) ([Amos Kuşu](https://github.com/amosbird)) -- Yolu geliştirmek `round` ve `roundBankers` negatif sayılar işleme. [\#8229](https://github.com/ClickHouse/ClickHouse/pull/8229) ([hcz](https://github.com/hczhcz)) -- Geliştirilmiş çözme performansı `DoubleDelta` ve `Gorilla` codec bileşenleri yaklaşık %30-40 oranında. Bu düzeltmeler [\#7082](https://github.com/ClickHouse/ClickHouse/issues/7082). [\#8019](https://github.com/ClickHouse/ClickHouse/pull/8019) ([Vasily Nemkov](https://github.com/Enmk)) -- Geliştirilmiş performans `base64` ilgili fonksiyonlar. [\#8444](https://github.com/ClickHouse/ClickHouse/pull/8444) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Bir işlev eklendi `geoDistance`. Bu benzer `greatCircleDistance` ancak wgs-84 elipsoid modeline yaklaşım kullanır. Her iki fonksiyonun performansı da aynıdır. [\#8086](https://github.com/ClickHouse/ClickHouse/pull/8086) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Hızla `min` ve `max` için toplama fonksiyonları `Decimal` veri türü. [\#8144](https://github.com/ClickHouse/ClickHouse/pull/8144) ([Artem Zuikov](https://github.com/4ertus2)) -- Vectorize işleme `arrayReduce`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([Amos Kuşu](https://github.com/amosbird)) -- `if` zincirler şimdi olarak optimize edilmiştir `multiIf`. [\#8355](https://github.com/ClickHouse/ClickHouse/pull/8355) ([kamalov-ruslan](https://github.com/kamalov-ruslan)) -- Performans gerilemesini düzeltin `Kafka` masa motoru 19.15'te tanıtıldı. Bu düzeltmeler [\#7261](https://github.com/ClickHouse/ClickHouse/issues/7261). [\#7935](https://github.com/ClickHouse/ClickHouse/pull/7935) ([filimonov](https://github.com/filimonov)) -- Kaldırıyordu “pie” kod üretimi `gcc` Debian paketlerinden bazen varsayılan olarak getirir. [\#8483](https://github.com/ClickHouse/ClickHouse/pull/8483) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Paralel ayrıştırma veri formatları [\#6553](https://github.com/ClickHouse/ClickHouse/pull/6553) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)) -- Optimize edilmiş ayrıştırıcıyı etkinleştir `Values` varsayılan olarak ifadelerle (`input_format_values_deduce_templates_of_expressions=1`). [\#8231](https://github.com/ClickHouse/ClickHouse/pull/8231) ([tavplubix](https://github.com/tavplubix)) - -#### Yapı / Test / Ambalaj Geliştirme {#buildtestingpackaging-improvement-2} - -- İçin düzeltmeler oluşturun `ARM` ve minimal modda. [\#8304](https://github.com/ClickHouse/ClickHouse/pull/8304) ([proller](https://github.com/proller)) -- İçin kapsama dosyası Ekle `clickhouse-server` std:: atexit çağrılmadığında. Ayrıca kapsama ile vatansız testlerde biraz geliştirilmiş günlüğü. [\#8267](https://github.com/ClickHouse/ClickHouse/pull/8267) ([alesapin](https://github.com/alesapin)) -- Contrib'de llvm kütüphanesini güncelleyin. OS paketlerinden LLVM kullanmaktan kaçının. [\#8258](https://github.com/ClickHouse/ClickHouse/pull/8258) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Paket yapmak `curl` tamamen sessiz inşa. [\#8232](https://github.com/ClickHouse/ClickHouse/pull/8232) [\#8203](https://github.com/ClickHouse/ClickHouse/pull/8203) ([Pavel Kovalenko](https://github.com/Jokser)) -- Bazı düzeltmek `MemorySanitizer` uyarmalar. [\#8235](https://github.com/ClickHouse/ClickHouse/pull/8235) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Kullanmak `add_warning` ve `no_warning` makro inlar içinde `CMakeLists.txt`. [\#8604](https://github.com/ClickHouse/ClickHouse/pull/8604) ([I ivanvan](https://github.com/abyss7)) -- Minio S3 uyumlu nesne desteği ekleyin (https://min.io/) daha iyi entegrasyon testleri için. [\#7863](https://github.com/ClickHouse/ClickHouse/pull/7863) [\#7875](https://github.com/ClickHouse/ClickHouse/pull/7875) ([Pavel Kovalenko](https://github.com/Jokser)) -- İthal `libc` başlıklar contrib için. Oluşturur daha tutarlı (sadece için çeşitli sistemler üzerinde yapmak için izin verir `x86_64-linux-gnu`). [\#5773](https://github.com/ClickHouse/ClickHouse/pull/5773) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kaldırmak `-fPIC` bazı kütüphanelerden. [\#8464](https://github.com/ClickHouse/ClickHouse/pull/8464) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Temizlemek `CMakeLists.txt` kıvırmak için. Bkz. https://github.com/ClickHouse/ClickHouse/pull/8011\#issuecomment-569478910 [\#8459](https://github.com/ClickHouse/ClickHouse/pull/8459) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sessiz uyarılar `CapNProto` kitaplık. [\#8220](https://github.com/ClickHouse/ClickHouse/pull/8220) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kısa dize optimize karma tablolar için performans testleri ekleyin. [\#7679](https://github.com/ClickHouse/ClickHouse/pull/7679) ([Amos Kuşu](https://github.com/amosbird)) -- Şimdi ClickHouse üzerine inşa edecek `AArch64` bile `MADV_FREE` kullanılamaz. Bu düzeltmeler [\#8027](https://github.com/ClickHouse/ClickHouse/issues/8027). [\#8243](https://github.com/ClickHouse/ClickHouse/pull/8243) ([Amos Kuşu](https://github.com/amosbird)) -- Güncelleştirme `zlib-ng` bellek dezenfektanı sorunları düzeltmek için. [\#7182](https://github.com/ClickHouse/ClickHouse/pull/7182) [\#8206](https://github.com/ClickHouse/ClickHouse/pull/8206) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Linux olmayan sistemde dahili MySQL kütüphanesini etkinleştirin, çünkü OS paketlerinin kullanımı çok kırılgandır ve genellikle hiç çalışmaz. Bu düzeltmeler [\#5765](https://github.com/ClickHouse/ClickHouse/issues/5765). [\#8426](https://github.com/ClickHouse/ClickHouse/pull/8426) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Etkinleştirildikten sonra bazı sistemlerde sabit yapı `libc++`. Bu yerini alır [\#8374](https://github.com/ClickHouse/ClickHouse/issues/8374). [\#8380](https://github.com/ClickHouse/ClickHouse/pull/8380) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yapmak `Field` yöntemleri daha fazla tür-daha fazla hata bulmak için güvenli. [\#7386](https://github.com/ClickHouse/ClickHouse/pull/7386) [\#8209](https://github.com/ClickHouse/ClickHouse/pull/8209) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Eksik dosyalar eklendi `libc-headers` alt modül. [\#8507](https://github.com/ClickHouse/ClickHouse/pull/8507) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yanlış Düzelt `JSON` performans testi çıktısında alıntı. [\#8497](https://github.com/ClickHouse/ClickHouse/pull/8497) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Şimdi yığın izleme için görüntülenir `std::exception` ve `Poco::Exception`. Önceki sürümlerde sadece mevcuttu `DB::Exception`. Bu teşhis geliştirir. [\#8501](https://github.com/ClickHouse/ClickHouse/pull/8501) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Taşıma `clock_gettime` ve `clock_nanosleep` taze glibc sürümleri için. [\#8054](https://github.com/ClickHouse/ClickHouse/pull/8054) ([Amos Kuşu](https://github.com/amosbird)) -- Etkinleştirmek `part_log` geliştiriciler için örnek yapılandırmada. [\#8609](https://github.com/ClickHouse/ClickHouse/pull/8609) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yeniden yüklemenin async doğasını düzeltin `01036_no_superfluous_dict_reload_on_create_database*`. [\#8111](https://github.com/ClickHouse/ClickHouse/pull/8111) ([Azat Khuzhin](https://github.com/azat)) -- Sabit codec performans testleri. [\#8615](https://github.com/ClickHouse/ClickHouse/pull/8615) ([Vasily Nemkov](https://github.com/Enmk)) -- İçin yükleme s scriptscript addleri Ekle `.tgz` onlar için yapı ve belgeler. [\#8612](https://github.com/ClickHouse/ClickHouse/pull/8612) [\#8591](https://github.com/ClickHouse/ClickHouse/pull/8591) ([alesapin](https://github.com/alesapin)) -- Eski kaldırıldı `ZSTD` test (2016 yılında zstd'nin 1.0 sürümünün olduğu hatayı yeniden üretmek için oluşturuldu). Bu düzeltmeler [\#8618](https://github.com/ClickHouse/ClickHouse/issues/8618). [\#8619](https://github.com/ClickHouse/ClickHouse/pull/8619) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Mac OS Catalina üzerinde sabit yapı. [\#8600](https://github.com/ClickHouse/ClickHouse/pull/8600) ([meo](https://github.com/meob)) -- Sonuç fark yapmak için codec performans testlerinde satır sayısı arttı. [\#8574](https://github.com/ClickHouse/ClickHouse/pull/8574) ([Vasily Nemkov](https://github.com/Enmk)) -- Hata ayıklama yapılarında, tedavi `LOGICAL_ERROR` onaylama işlemi hatası gibi özel durumlar, dikkat kolaylaştırmak. [\#8475](https://github.com/ClickHouse/ClickHouse/pull/8475) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Biçimlerle ilgili performans testini daha deterministik hale getirin. [\#8477](https://github.com/ClickHouse/ClickHouse/pull/8477) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Güncelleştirme `lz4` bir hafızayı düzeltmek İçinvatandaş arızası. [\#8181](https://github.com/ClickHouse/ClickHouse/pull/8181) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Bilinen bir MemorySanitizer yanlış pozitif özel durum işleme bastırın. [\#8182](https://github.com/ClickHouse/ClickHouse/pull/8182) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Güncelleştirme `gcc` ve `g++` sürüm 9 için `build/docker/build.sh` [\#7766](https://github.com/ClickHouse/ClickHouse/pull/7766) ([TLightSky](https://github.com/tlightsky)) -- Bunu test etmek için performans testi örneği ekleyin `PREWHERE` daha kötü `WHERE`. [\#7768](https://github.com/ClickHouse/ClickHouse/pull/7768) ([Amos Kuşu](https://github.com/amosbird)) -- Bir gevşek testi düzeltmek için ilerleme. [\#8621](https://github.com/ClickHouse/ClickHouse/pull/8621) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Veri için MemorySanitizer raporundan kaçının `libunwind`. [\#8539](https://github.com/ClickHouse/ClickHouse/pull/8539) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Güncel `libc++` en son sürüme. [\#8324](https://github.com/ClickHouse/ClickHouse/pull/8324) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Kaynaklardan YBÜ Kütüphanesi oluşturun. Bu düzeltmeler [\#6460](https://github.com/ClickHouse/ClickHouse/issues/6460). [\#8219](https://github.com/ClickHouse/ClickHouse/pull/8219) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Anahtar fromlı `libressl` -e doğru `openssl`. ClickHouse, bu değişiklikten sonra TLS 1.3 ve SNI'Yİ desteklemelidir. Bu düzeltmeler [\#8171](https://github.com/ClickHouse/ClickHouse/issues/8171). [\#8218](https://github.com/ClickHouse/ClickHouse/pull/8218) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Sabit UBSan raporu kullanırken `chacha20_poly1305` SS SSLL ('den (Bağlan (ış happensta olur https://yandex.ru/). [\#8214](https://github.com/ClickHouse/ClickHouse/pull/8214) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin varsayılan şifre dosyasının düzeltme modu `.deb` linux dağıtımları. [\#8075](https://github.com/ClickHouse/ClickHouse/pull/8075) ([proller](https://github.com/proller)) -- Almak için geliştirilmiş ifade `clickhouse-server` Pidıd ın `clickhouse-test`. [\#8063](https://github.com/ClickHouse/ClickHouse/pull/8063) ([Alexander Kazakov](https://github.com/Akazz)) -- V1.10.0 için contrib/googletest güncellendi. [\#8587](https://github.com/ClickHouse/ClickHouse/pull/8587) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- Sabit ThreadSaninitizer raporu `base64` kitaplık. Ayrıca bu kütüphaneyi en son sürüme güncelledi, ancak önemli değil. Bu düzeltmeler [\#8397](https://github.com/ClickHouse/ClickHouse/issues/8397). [\#8403](https://github.com/ClickHouse/ClickHouse/pull/8403) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Düzeltmek `00600_replace_running_query` işlemciler için. [\#8272](https://github.com/ClickHouse/ClickHouse/pull/8272) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- İçin destek Kaldır `tcmalloc` yapmak `CMakeLists.txt` basit. [\#8310](https://github.com/ClickHouse/ClickHouse/pull/8310) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yayın gcc şimdi kullanmak oluşturur `libc++` yerine `libstdc++`. Son zamanlarda `libc++` sadece clang ile kullanıldı. Bu yapı yapılandırmaları ve taşınabilirlik tutarlılığını artıracaktır. [\#8311](https://github.com/ClickHouse/ClickHouse/pull/8311) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- MemorySanitizer ile inşa etmek için YBÜ kütüphanesini etkinleştirin. [\#8222](https://github.com/ClickHouse/ClickHouse/pull/8222) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Gelen uyarıları bastır `CapNProto` kitaplık. [\#8224](https://github.com/ClickHouse/ClickHouse/pull/8224) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- İçin özel kod durumları kaldırıldı `tcmalloc`, çünkü artık desteklenmiyor. [\#8225](https://github.com/ClickHouse/ClickHouse/pull/8225) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- CI kapsama görevinde, kapsama raporunu kaydetmesine izin vermek için sunucuyu incelikle öldürün. Bu, son zamanlarda gördüğümüz eksik kapsama raporlarını düzeltir. [\#8142](https://github.com/ClickHouse/ClickHouse/pull/8142) ([alesapin](https://github.com/alesapin)) -- Karşı tüm codec bileşenleri için performans testleri `Float64` ve `UInt64` değerler. [\#8349](https://github.com/ClickHouse/ClickHouse/pull/8349) ([Vasily Nemkov](https://github.com/Enmk)) -- `termcap` (f çeşitli sorunlar için çok kaldırılmış ve kurşundur.g. eksik “up” kap ve yankılanan `^J` çok satır yerine). İyilik `terminfo` veya paketlenmiş `ncurses`. [\#7737](https://github.com/ClickHouse/ClickHouse/pull/7737) ([Amos Kuşu](https://github.com/amosbird)) -- Düzeltmek `test_storage_s3` entegrasyon testi. [\#7734](https://github.com/ClickHouse/ClickHouse/pull/7734) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Destek `StorageFile(, null)` aslında Diske yazmadan verilen format dosyasına blok eklemek için. Bu performans testleri için gereklidir. [\#8455](https://github.com/ClickHouse/ClickHouse/pull/8455) ([Amos Kuşu](https://github.com/amosbird)) -- Eklenen argüman `--print-time` test başına yürütme süresini basan işlevsel testlere. [\#8001](https://github.com/ClickHouse/ClickHouse/pull/8001) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Eklenen iddialar `KeyCondition` rpn değerlendirirken. Bu, gcc-9'dan gelen uyarıyı düzeltir. [\#8279](https://github.com/ClickHouse/ClickHouse/pull/8279) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Cı yapılarında cmake seçeneklerini dökümü. [\#8273](https://github.com/ClickHouse/ClickHouse/pull/8273) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Bazı fat kitaplıkları için hata ayıklama bilgisi oluşturmayın. [\#8271](https://github.com/ClickHouse/ClickHouse/pull/8271) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Yapmak `log_to_console.xml` her zaman ne olursa olsun interaktif ya da değil, stderr oturum açın. [\#8395](https://github.com/ClickHouse/ClickHouse/pull/8395) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- Kullanılmayan bazı özellikler kaldırıldı `clickhouse-performance-test` aracı. [\#8555](https://github.com/ClickHouse/ClickHouse/pull/8555) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Şimdi de arayacağız `lld-X` karşılık gelen ile `clang-X` sürüm. [\#8092](https://github.com/ClickHouse/ClickHouse/pull/8092) ([alesapin](https://github.com/alesapin)) -- Parke inşa iyileştirme. [\#8421](https://github.com/ClickHouse/ClickHouse/pull/8421) ([maxulan](https://github.com/maxulan)) -- Daha fazla GCC uyarısı [\#8221](https://github.com/ClickHouse/ClickHouse/pull/8221) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- Arch Linux için paket şimdi ClickHouse sunucusu çalıştırmak için izin verir, ve sadece istemci. [\#8534](https://github.com/ClickHouse/ClickHouse/pull/8534) ([Vladimir Chebotarev](https://github.com/excitoon)) -- İşlemcilerle testi düzeltin. Küçük performans düzeltmeleri. [\#7672](https://github.com/ClickHouse/ClickHouse/pull/7672) ([Nikolai Kochetov](https://github.com/KochetovNicolai)) -- Contrib/protobuf güncelleyin. [\#8256](https://github.com/ClickHouse/ClickHouse/pull/8256) ([Matwey V. Kornilov](https://github.com/matwey)) -- Yeni yıl kutlaması olarak C++20'ye geçmenin hazırlanmasında. “May the C++ force be with ClickHouse.” [\#8447](https://github.com/ClickHouse/ClickHouse/pull/8447) ([Amos Kuşu](https://github.com/amosbird)) - -#### Deneysel Özellik {#experimental-feature-1} - -- Deneysel ayar eklendi `min_bytes_to_use_mmap_io`. Bu userspace çekirdekten veri kopyalamadan büyük dosyaları okumak için izin verir. Bu ayar varsayılan olarak devre dışıdır. Önerilen eşik yaklaşık 64 MB'dir, çünkü mmap / munmap yavaştır. [\#8520](https://github.com/ClickHouse/ClickHouse/pull/8520) ([alexey-milovidov](https://github.com/alexey-milovidov)) -- Erişim kontrol sisteminin bir parçası olarak yeniden işlenmiş kotalar. Yeni tablo eklendi `system.quotas` yeni fonksiyonlar `currentQuota`, `currentQuotaKey`, yeni SQL sözdizimi `CREATE QUOTA`, `ALTER QUOTA`, `DROP QUOTA`, `SHOW QUOTA`. [\#7257](https://github.com/ClickHouse/ClickHouse/pull/7257) ([Vitaly Baranov](https://github.com/vitlibar)) -- İstisnalar atmak yerine bilinmeyen ayarları uyarılarla atlamaya izin verin. [\#7653](https://github.com/ClickHouse/ClickHouse/pull/7653) ([Vitaly Baranov](https://github.com/vitlibar)) -- Erişim kontrol sisteminin bir parçası olarak reworked satır politikaları. Yeni tablo eklendi `system.row_policies` yeni işlev `currentRowPolicies()`, yeni SQL sözdizimi `CREATE POLICY`, `ALTER POLICY`, `DROP POLICY`, `SHOW CREATE POLICY`, `SHOW POLICIES`. [\#7808](https://github.com/ClickHouse/ClickHouse/pull/7808) ([Vitaly Baranov](https://github.com/vitlibar)) - -#### Güvenlik Düzeltme {#security-fix} - -- İle tablolarda dizin yapısını okuma imkanı Düzelt theildi `File` masa motoru. Bu düzeltmeler [\#8536](https://github.com/ClickHouse/ClickHouse/issues/8536). [\#8537](https://github.com/ClickHouse/ClickHouse/pull/8537) ([alexey-milovidov](https://github.com/alexey-milovidov)) - -## [2019 için Changelog](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2019.md) {#changelog-for-2019} diff --git a/docs/tr/whats_new/security_changelog.md b/docs/tr/whats_new/security_changelog.md deleted file mode 100644 index 117d1766cdb..00000000000 --- a/docs/tr/whats_new/security_changelog.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: e8cd92bba3269f47787db090899f7c242adf7818 -toc_priority: 76 -toc_title: "G\xFCvenlik Changelog" ---- - -## ClickHouse sürümünde düzeltildi 19.14.3.3, 2019-09-10 {#fixed-in-clickhouse-release-19-14-3-3-2019-09-10} - -### CVE-2019-15024 {#cve-2019-15024} - -Аn attacker that has write access to ZooKeeper and who ican run a custom server available from the network where ClickHouse runs, can create a custom-built malicious server that will act as a ClickHouse replica and register it in ZooKeeper. When another replica will fetch data part from the malicious replica, it can force clickhouse-server to write to arbitrary path on filesystem. - -Kredi: Yandex Bilgi Güvenliği ekibinden Eldar Zaitov - -### CVE-2019-16535 {#cve-2019-16535} - -Аn OOB read, OOB write and integer underflow in decompression algorithms can be used to achieve RCE or DoS via native protocol. - -Kredi: Yandex Bilgi Güvenliği ekibinden Eldar Zaitov - -### CVE-2019-16536 {#cve-2019-16536} - -DOS'A giden yığın taşması, kötü amaçlı kimliği doğrulanmış bir istemci tarafından tetiklenebilir. - -Kredi: Yandex Bilgi Güvenliği ekibinden Eldar Zaitov - -## ClickHouse sürümü 19.13.6.1, 2019-09-20'de düzeltildi {#fixed-in-clickhouse-release-19-13-6-1-2019-09-20} - -### CVE-2019-18657 {#cve-2019-18657} - -Tablo fonksiyonu `url` güvenlik açığı saldırganın istekte rasgele HTTP üstbilgileri enjekte etmesine izin vermişti. - -Krediler: [Nikita Tikhomirov](https://github.com/NSTikhomirov) - -## ClickHouse sürümünde sabit 18.12.13, 2018-09-10 {#fixed-in-clickhouse-release-18-12-13-2018-09-10} - -### CVE-2018-14672 {#cve-2018-14672} - -Catboost modellerini yüklemek için işlevler, yol geçişine izin verdi ve hata mesajları aracılığıyla keyfi dosyaları okudu. - -Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov - -## ClickHouse sürüm 18.10.3, 2018-08-13 sabit {#fixed-in-clickhouse-release-18-10-3-2018-08-13} - -### CVE-2018-14671 {#cve-2018-14671} - -unixODBC, dosya sisteminden rasgele paylaşılan nesnelerin yüklenmesine izin verdi ve bu da uzaktan kod yürütme güvenlik açığına yol açtı. - -Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov ve Evgeny Sidorov - -## ClickHouse sürüm 1.1.54388, 2018-06-28 sabit {#fixed-in-clickhouse-release-1-1-54388-2018-06-28} - -### CVE-2018-14668 {#cve-2018-14668} - -“remote” tablo fonksiyonu izin keyfi semboller “user”, “password” ve “default\_database” çapraz Protokol isteği sahtecilik saldırılarına yol açan alanlar. - -Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov - -## ClickHouse sürüm 1.1.54390, 2018-07-06 sabit {#fixed-in-clickhouse-release-1-1-54390-2018-07-06} - -### CVE-2018-14669 {#cve-2018-14669} - -ClickHouse MySQL istemcisi vardı “LOAD DATA LOCAL INFILE” işlevsellik, kötü niyetli bir MySQL veritabanının bağlı ClickHouse sunucusundan rasgele dosyaları okumasına izin verdi. - -Kredi: Yandex Bilgi Güvenliği ekibinden Andrey Krasichkov ve Evgeny Sidorov - -## ClickHouse sürüm 1.1.54131, 2017-01-10 sabit {#fixed-in-clickhouse-release-1-1-54131-2017-01-10} - -### CVE-2018-14670 {#cve-2018-14670} - -Deb paketindeki yanlış yapılandırma, veritabanının yetkisiz kullanımına neden olabilir. - -Kredi: İngiltere'nin Ulusal siber güvenlik merkezi (NCSC) - -{## [Orijinal makale](https://clickhouse.tech/docs/en/security_changelog/) ##} diff --git a/docs/zh/changelog/index.md b/docs/zh/changelog/index.md index c79e32ceaf3..2f2b7384a76 100644 --- a/docs/zh/changelog/index.md +++ b/docs/zh/changelog/index.md @@ -1,7 +1,7 @@ --- machine_translated: true machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_title: '变更日志' +toc_title: "\u53D8\u66F4\u65E5\u5FD7" --- ## 碌莽禄release拢.0755-88888888 {#clickhouse-release-v20-3} diff --git a/docs/zh/commercial/cloud.md b/docs/zh/commercial/cloud.md index 765c352d098..d3639fe4296 100644 --- a/docs/zh/commercial/cloud.md +++ b/docs/zh/commercial/cloud.md @@ -12,7 +12,7 @@ machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 [Yandex的ClickHouse托管服务](https://cloud.yandex.com/services/managed-clickhouse?utm_source=referrals&utm_medium=clickhouseofficialsite&utm_campaign=link3) 提供以下主要功能: -- 全面管理的动物园管理员服务 [ClickHouse复制](../engines/table_engines/mergetree_family/replication.md) +- 全面管理的动物园管理员服务 [ClickHouse复制](../engines/table-engines/mergetree-family/replication.md) - 多种存储类型选择 - 不同可用区中的副本 - 加密和隔离 diff --git a/docs/zh/development/architecture.md b/docs/zh/development/architecture.md index 66d5cac13b5..882728a6e2b 100644 --- a/docs/zh/development/architecture.md +++ b/docs/zh/development/architecture.md @@ -1,4 +1,3 @@ - # ClickHouse 架构概述 {#clickhouse-jia-gou-gai-shu} ClickHouse 是一个真正的列式数据库管理系统(DBMS)。在 ClickHouse 中,数据始终是按列存储的,包括矢量(向量或列块)执行的过程。只要有可能,操作都是基于矢量进行分派的,而不是单个的值,这被称为«矢量化查询执行»,它有利于降低实际的数据处理开销。 @@ -116,7 +115,7 @@ ClickHouse 是一个真正的列式数据库管理系统(DBMS)。在 ClickHous 普通函数不会改变行数 - 它们的执行看起来就像是独立地处理每一行数据。实际上,函数不会作用于一个单独的行上,而是作用在以 `Block` 为单位的数据上,以实现向量查询执行。 -还有一些杂项函数,比如 [块大小](../sql_reference/functions/other_functions.md#function-blocksize)、[rowNumberInBlock](../sql_reference/functions/other_functions.md#function-rownumberinblock),以及 [跑累积](../sql_reference/functions/other_functions.md#function-runningaccumulate),它们对块进行处理,并且不遵从行的独立性。 +还有一些杂项函数,比如 [块大小](../sql-reference/functions/other-functions.md#function-blocksize)、[rowNumberInBlock](../sql-reference/functions/other-functions.md#function-rownumberinblock),以及 [跑累积](../sql-reference/functions/other-functions.md#function-runningaccumulate),它们对块进行处理,并且不遵从行的独立性。 ClickHouse 具有强类型,因此隐式类型转换不会发生。如果函数不支持某个特定的类型组合,则会抛出异常。但函数可以通过重载以支持许多不同的类型组合。比如,`plus` 函数(用于实现 `+` 运算符)支持任意数字类型的组合:`UInt8` + `Float32`,`UInt16` + `Int8` 等。同时,一些可变参数的函数能够级接收任意数目的参数,比如 `concat` 函数。 diff --git a/docs/zh/development/browse_code.md b/docs/zh/development/browse-code.md similarity index 100% rename from docs/zh/development/browse_code.md rename to docs/zh/development/browse-code.md diff --git a/docs/zh/development/build_cross_arm.md b/docs/zh/development/build-cross-arm.md similarity index 100% rename from docs/zh/development/build_cross_arm.md rename to docs/zh/development/build-cross-arm.md diff --git a/docs/zh/development/build-cross-osx.md b/docs/zh/development/build-cross-osx.md new file mode 100644 index 00000000000..124c9742b2d --- /dev/null +++ b/docs/zh/development/build-cross-osx.md @@ -0,0 +1,53 @@ +# 如何在Linux中编译Mac OS X ClickHouse {#ru-he-zai-linuxzhong-bian-yi-mac-os-x-clickhouse} + +Linux机器也可以编译运行在OS X系统的`clickhouse`二进制包,这可以用于在Linux上跑持续集成测试。如果要在Mac OS X上直接构建ClickHouse,请参考另外一篇指南: https://clickhouse.tech/docs/zh/development/build\_osx/ + +Mac OS X的交叉编译基于以下构建说明,请首先遵循它们。 + +# 安装Clang-8 {#install-clang-8} + +按照https://apt.llvm.org/中的说明进行Ubuntu或Debian安装。 +例如,安装Bionic的命令如下: + +``` bash +sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list +sudo apt-get install clang-8 +``` + +# 安装交叉编译工具集 {#an-zhuang-jiao-cha-bian-yi-gong-ju-ji} + +我们假设安装 `cctools` 在 ${CCTOOLS} 路径下 + +``` bash +mkdir ${CCTOOLS} + +git clone https://github.com/tpoechtrager/apple-libtapi.git +cd apple-libtapi +INSTALLPREFIX=${CCTOOLS} ./build.sh +./install.sh +cd .. + +git clone https://github.com/tpoechtrager/cctools-port.git +cd cctools-port/cctools +./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin +make install + +cd ${CCTOOLS} +wget https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz +tar xJf MacOSX10.14.sdk.tar.xz +``` + +# 编译 ClickHouse {#bian-yi-clickhouse} + +``` bash +cd ClickHouse +mkdir build-osx +CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_SYSTEM_NAME=Darwin \ + -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ + -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ + -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld \ + -DSDK_PATH=${CCTOOLS}/MacOSX10.14.sdk +ninja -C build-osx +``` + +生成的二进制文件将具有Mach-O可执行格式,并且不能在Linux上运行。 diff --git a/docs/zh/development/build-osx.md b/docs/zh/development/build-osx.md new file mode 100644 index 00000000000..2fc68f6d2fb --- /dev/null +++ b/docs/zh/development/build-osx.md @@ -0,0 +1,82 @@ +# 在 Mac OS X 中编译 ClickHouse {#zai-mac-os-x-zhong-bian-yi-clickhouse} + +ClickHouse 支持在 Mac OS X 10.12 版本中编译。若您在用更早的操作系统版本,可以尝试在指令中使用 `Gentoo Prefix` 和 `clang sl`. +通过适当的更改,它应该可以适用于任何其他的 Linux 发行版。 + +## 安装 Homebrew {#an-zhuang-homebrew} + +``` bash +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +## 安装编译器,工具库 {#an-zhuang-bian-yi-qi-gong-ju-ku} + +``` bash +brew install cmake ninja gcc icu4c mariadb-connector-c openssl libtool gettext +``` + +## 拉取 ClickHouse 源码 {#la-qu-clickhouse-yuan-ma} + +``` bash +git clone --recursive git@github.com:ClickHouse/ClickHouse.git +# or: git clone --recursive https://github.com/ClickHouse/ClickHouse.git + +cd ClickHouse +``` + +## 编译 ClickHouse {#bian-yi-clickhouse} + +``` bash +mkdir build +cd build +cmake .. -DCMAKE_CXX_COMPILER=`which g++-8` -DCMAKE_C_COMPILER=`which gcc-8` +ninja +cd .. +``` + +## 注意事项 {#zhu-yi-shi-xiang} + +若你想运行 clickhouse-server,请先确保增加系统的最大文件数配置。 + +!!! 注意 "注意" + 可能需要用 sudo + +为此,请创建以下文件: + +/图书馆/LaunchDaemons/限制.maxfilesplist: + +``` xml + + + + + Label + limit.maxfiles + ProgramArguments + + launchctl + limit + maxfiles + 524288 + 524288 + + RunAtLoad + + ServiceIPC + + + +``` + +执行以下命令: + +``` bash +$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist +``` + +然后重启。 + +可以通过 `ulimit -n` 命令来检查是否生效。 + +[来源文章](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/zh/development/build.md b/docs/zh/development/build.md index 05581985a35..639b33e3ef7 100644 --- a/docs/zh/development/build.md +++ b/docs/zh/development/build.md @@ -1,4 +1,3 @@ - # 如何构建 ClickHouse 发布包 {#ru-he-gou-jian-clickhouse-fa-bu-bao} ## 安装 Git 和 Pbuilder {#an-zhuang-git-he-pbuilder} diff --git a/docs/zh/development/build_cross_osx.md b/docs/zh/development/build_cross_osx.md deleted file mode 100644 index c74ff934c0d..00000000000 --- a/docs/zh/development/build_cross_osx.md +++ /dev/null @@ -1,54 +0,0 @@ - -# 如何在Linux中编译Mac OS X ClickHouse {#ru-he-zai-linuxzhong-bian-yi-mac-os-x-clickhouse} - -Linux机器也可以编译运行在OS X系统的`clickhouse`二进制包,这可以用于在Linux上跑持续集成测试。如果要在Mac OS X上直接构建ClickHouse,请参考另外一篇指南: https://clickhouse.tech/docs/zh/development/build\_osx/ - -Mac OS X的交叉编译基于以下构建说明,请首先遵循它们。 - -# 安装Clang-8 {#install-clang-8} - -按照https://apt.llvm.org/中的说明进行Ubuntu或Debian安装。 -例如,安装Bionic的命令如下: - -``` bash -sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" >> /etc/apt/sources.list -sudo apt-get install clang-8 -``` - -# 安装交叉编译工具集 {#an-zhuang-jiao-cha-bian-yi-gong-ju-ji} - -我们假设安装 `cctools` 在 ${CCTOOLS} 路径下 - -``` bash -mkdir ${CCTOOLS} - -git clone https://github.com/tpoechtrager/apple-libtapi.git -cd apple-libtapi -INSTALLPREFIX=${CCTOOLS} ./build.sh -./install.sh -cd .. - -git clone https://github.com/tpoechtrager/cctools-port.git -cd cctools-port/cctools -./configure --prefix=${CCTOOLS} --with-libtapi=${CCTOOLS} --target=x86_64-apple-darwin -make install - -cd ${CCTOOLS} -wget https://github.com/phracker/MacOSX-SDKs/releases/download/10.14-beta4/MacOSX10.14.sdk.tar.xz -tar xJf MacOSX10.14.sdk.tar.xz -``` - -# 编译 ClickHouse {#bian-yi-clickhouse} - -``` bash -cd ClickHouse -mkdir build-osx -CC=clang-8 CXX=clang++-8 cmake . -Bbuild-osx -DCMAKE_SYSTEM_NAME=Darwin \ - -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar \ - -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib \ - -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld \ - -DSDK_PATH=${CCTOOLS}/MacOSX10.14.sdk -ninja -C build-osx -``` - -生成的二进制文件将具有Mach-O可执行格式,并且不能在Linux上运行。 diff --git a/docs/zh/development/build_osx.md b/docs/zh/development/build_osx.md deleted file mode 100644 index 0c1c840912e..00000000000 --- a/docs/zh/development/build_osx.md +++ /dev/null @@ -1,83 +0,0 @@ - -# 在 Mac OS X 中编译 ClickHouse {#zai-mac-os-x-zhong-bian-yi-clickhouse} - -ClickHouse 支持在 Mac OS X 10.12 版本中编译。若您在用更早的操作系统版本,可以尝试在指令中使用 `Gentoo Prefix` 和 `clang sl`. -通过适当的更改,它应该可以适用于任何其他的 Linux 发行版。 - -## 安装 Homebrew {#an-zhuang-homebrew} - -``` bash -/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - -## 安装编译器,工具库 {#an-zhuang-bian-yi-qi-gong-ju-ku} - -``` bash -brew install cmake ninja gcc icu4c mariadb-connector-c openssl libtool gettext -``` - -## 拉取 ClickHouse 源码 {#la-qu-clickhouse-yuan-ma} - -``` bash -git clone --recursive git@github.com:ClickHouse/ClickHouse.git -# or: git clone --recursive https://github.com/ClickHouse/ClickHouse.git - -cd ClickHouse -``` - -## 编译 ClickHouse {#bian-yi-clickhouse} - -``` bash -mkdir build -cd build -cmake .. -DCMAKE_CXX_COMPILER=`which g++-8` -DCMAKE_C_COMPILER=`which gcc-8` -ninja -cd .. -``` - -## 注意事项 {#zhu-yi-shi-xiang} - -若你想运行 clickhouse-server,请先确保增加系统的最大文件数配置。 - -!!! 注意 "注意" - 可能需要用 sudo - -为此,请创建以下文件: - -/图书馆/LaunchDaemons/限制.maxfilesplist: - -``` xml - - - - - Label - limit.maxfiles - ProgramArguments - - launchctl - limit - maxfiles - 524288 - 524288 - - RunAtLoad - - ServiceIPC - - - -``` - -执行以下命令: - -``` bash -$ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist -``` - -然后重启。 - -可以通过 `ulimit -n` 命令来检查是否生效。 - -[来源文章](https://clickhouse.tech/docs/en/development/build_osx/) diff --git a/docs/zh/development/contrib.md b/docs/zh/development/contrib.md index e282856c0e8..d382facdcc9 100644 --- a/docs/zh/development/contrib.md +++ b/docs/zh/development/contrib.md @@ -1,4 +1,3 @@ - # 使用的三方库 {#shi-yong-de-san-fang-ku} | 图书馆 | 许可 | diff --git a/docs/zh/development/developer-instruction.md b/docs/zh/development/developer-instruction.md new file mode 100644 index 00000000000..6911a0e4dc9 --- /dev/null +++ b/docs/zh/development/developer-instruction.md @@ -0,0 +1,270 @@ +ClickHose支持Linux,FreeBSD 及 Mac OS X 系统。 + +# Windows使用指引 {#windowsshi-yong-zhi-yin} + +如果您的系统是Windows,则需要创建Ubuntu虚拟机。可以安装VirtualBox来构建虚拟机。Ubuntu的下载链接为:https://www.ubuntu.com/\#download 。请使用下载好的镜像创建一个虚拟机(请确保虚拟机有至少4GB的内存容量)。在Ubuntu中使用«terminal»程序(gnome-terminal,konsole等)运行命令行终端,或使用快捷键Ctrl+Alt+T。 + +# 在GitHub上创建源码库 {#zai-githubshang-chuang-jian-yuan-ma-ku} + +您需要(申请)一个GitHub账户来使用ClickHouse。 + +如果没有账户,请在https://github.com上注册一个。如果没有SSH密钥,请在本地创建密钥并将公钥上传到GitHub上。这有助于你提交更新代码。并且在不同的SSH服务端,你也可以使用相同的SSH密钥。 + +要创建ClickHouse源码库的分支,请在https://github.com/ClickHouse/ClickHouse页面上点击右上角的«fork»按钮。它会在本账户上创建您个人的ClickHouse/ClickHouse分支。 + +若要参与开发,首先请在ClickHouse的分支中提交您期望的变更,然后创建一个«pull请求»,以便这些变更能够被(ClickHouse/ClickHouse)主库接受。 + +请先安装`git`来使用git源码库。 + +请在Ubuntu终端上使用下列的指令来安装`git`: + + sudo apt update + sudo apt install git + +在https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf中找到有关使用Git的简易手册。有关Git的详细手册,请参见: https://git-scm.com/book/ru/v2 。 + +# 拷贝源码库到开发机 {#kao-bei-yuan-ma-ku-dao-kai-fa-ji} + +接下来,请将源码下载到开发机上。这步操作被称为«拷贝源码库»,是因为它在您的开发机上创建了源码库的本地副本。 + +在终端命令行输入下列指令: + + git clone --recursive git@guthub.com:your_github_username/ClickHouse.git + cd ClickHouse + +请注意,您需要将*your\_github\_username* 替换成实际使用的账户名! + +这个指令将创建一个包含项目副本的`ClickHouse`工作目录。 + +重要的是,工作目录的路径中不应包含空格,因为这可能会导致运行构建系统时出现问题。 + +请注意,ClickHouse源码库使用了`submodules`。这是对其他库的引用(即项目所依赖的外部库)。即在拷贝源码库时,需要如上述指令中那样指定`--recursive`。如果在拷贝源码库时没有包含子模块,需要执行使用下列的指令: + + git submodule init + git submodule update + +可以通过 `git submodule status`来检查子模块的状态。 + +如果提示下列的错误信息: + + Permission denied (publickey). + fatal: Could not read from remote repository. + + Please make sure you have the correct access rights + and the repository exists. + +这通常表示缺少用于连接GitHub的SSH密钥。这些密钥一般都在`~/.ssh`中。要接受SSH密钥,请在GitHub UI的设置页面中上传它们。 + +您还可以通过https协议来拷贝源码库: + + git clone https://github.com/ClickHouse/ClickHouse.git + +但是,这无法将变更提交到服务器上。您仍然可以暂时使用,并后续再添加SSH密钥,用`git remote`命令替换源码库的远程地址。 + +还可以将原始ClickHouse库的地址添加到本地库中,以便从那里获取更新: + + git remote add upstream git@github.com:ClickHouse/ClickHouse.git + +命令执行成功后,可以通过执行`git pull upstream master`,从ClickHouse的主分支中拉去更新。 + +## 使用子模块 {#working-with-submodules} + +在git中使用子模块可能会很痛苦。 接下来的命令将有助于管理它: + + # ! each command accepts --recursive + # Update remote URLs for submodules. Barely rare case + git submodule sync + # Add new submodules + git submodule init + # Update existing submodules to the current state + git submodule update + # Two last commands could be merged together + git submodule update --init + +接下来的命令将帮助您将所有子模块重置为初始状态(!华林! -里面的任何chenges将被删除): + + # Synchronizes submodules' remote URL with .gitmodules + git submodule sync --recursive + # Update the registered submodules with initialize not yet initialized + git submodule update --init --recursive + # Reset all changes done after HEAD + git submodule foreach git reset --hard + # Clean files from .gitignore + git submodule foreach git clean -xfd + # Repeat last 4 commands for all submodule + git submodule foreach git submodule sync --recursive + git submodule foreach git submodule update --init --recursive + git submodule foreach git submodule foreach git reset --hard + git submodule foreach git submodule foreach git clean -xfd + +# 构建系统 {#gou-jian-xi-tong} + +ClickHouse使用 CMake 和 Ninja 来构建系统。 + +CMake - 一个可以生成Ninja文件的元构建系统(构建任务)。 +Ninja - 一个轻量级的构建系统,专注于速度,用于执行这些cmake生成的任务。 + +在Ubuntu,Debian或者Mint系统上执行`sudo apt install cmake ninja-build`来安装ninja。 + +在CentOS,RedHat系统上执行`sudo yum install cmake ninja-build`。 + +如果您曾经使用过Arch或Gentoo,那么也许知道如何安装CMake。 + +若要在Mac OS X上安装CMake和Ninja,请先安装Homebrew,然后再通过brew安装其他内容: + + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + brew install cmake ninja + +接下来,检查CMake的版本:`cmake --version`。如果版本低于3.3,则需要从以下网站安装更新版本:https://cmake.org/download/ 。 + +# 可供选择的外部库 {#ke-gong-xuan-ze-de-wai-bu-ku} + +ClickHouse使用多个外部库进行构建。大多数外部库不需要单独安装,而是和ClickHouse一起在子模块中构建。可以查看`contrib`中罗列的清单。 + +# C++ 编译器 {#c-bian-yi-qi} + +GCC编译器从版本9开始,以及Clang版本\>=8都可支持构建ClickHouse。 + +Yandex官方当前使用GCC构建ClickHouse,因为它生成的机器代码性能较好(根据测评,最多可以相差几个百分点)。Clang通常可以更加便捷的开发。我们的持续集成(CI)平台会运行大约十二种构建组合的检查。 + +在Ubuntu上安装GCC,请执行:`sudo apt install gcc g++` + +请使用`gcc --version`查看gcc的版本。如果gcc版本低于9,请参考此处的指示:https://clickhouse.tech/docs/en/development/build/\#install-gcc-9 。 + +在Mac OS X上安装GCC,请执行:`brew install gcc` + +如果您决定使用Clang,还可以同时安装 `libc++`以及`lld`,前提是您也熟悉它们。此外,也推荐使用`ccache`。 + +# 构建的过程 {#gou-jian-de-guo-cheng} + +如果当前已经准备好构建ClickHouse,我们建议您在`ClickHouse`中创建一个单独的目录`build`,其中包含所有构建组件: + + mkdir build + cd build + +您也可以有多个不同类型的构建目录(例如,build\_release, build\_debug等等)。 + +在`build`目录下,通过运行CMake配置构建。 在第一次运行之前,请定义用于指定编译器的环境变量(本示例中为gcc 9 编译器)。 + + export CC=gcc-9 CXX=g++-9 + cmake .. + +`CC`变量指代C的编译器(C Compiler的缩写),而`CXX`变量指代要使用哪个C++编译器进行编译。 + +为了更快的构建,请使用`debug`构建类型-不含优化的构建。为此提供以下的参数`-D CMAKE_BUILD_TYPE=Debug`: + + cmake -D CMAKE_BUILD_TYPE=Debug .. + +您可以通过在`build`目录中运行此命令来更改构建类型。 + +运行ninja进行构建: + + ninja clickhouse-server clickhouse-client + +在此示例中,仅将构建所需的二进制文件。 + +如果您需要构建所有的二进制文件(utilities和tests),请运行不带参数的ninja: + + ninja + +全量构建需要大约30GB的可用磁盘空间或15GB的空间来构建主要的二进制文件。 + +当构建的机器上有大量内存时,可考虑设置与`-j`参数并行运行的构建任务数量: + + ninja -j 1 clickhouse-server clickhouse-client + +在拥有4GB内存的机器上,建议设置成1,在拥有8GB内存的机器上,建议按`-j 2`设置。 + +如果您收到以下消息: + +`ninja:error:loading'build.ninja':No such file or directory` + +则表示生成构建配置失败,请检查上述消息。 + +成功启动构建过程后,您将看到构建进度-已处理任务的数量和任务总数。 + +在libhdfs2库中生成有关protobuf文件的消息时,可能会显示诸如`libprotobuf WARNING`。它们没有影响,可以忽略不计。 + +成功构建后,会得到一个可执行文件`ClickHouse//programs/clickhouse`: + + ls -l programs/clickhouse + +# 运行ClickHouse可执行文件 {#yun-xing-clickhouseke-zhi-xing-wen-jian} + +要以当前的用户身份运行服务,请进入到`ClickHouse/programs/server/` 目录(在`build`文件夹外)并运行: + + ../../../build/programs/clickhouse server + +在这种情况下,ClickHouse将使用位于当前目录中的配置文件。您可以从任何目录运行`Clickhouse server`,并将配置文件`--config-file`的路径指定为命令行参数。 + +在另外一个终端上连接ClickHouse的clickhouse-client客户端,请进入到`ClickHouse/build/programs/` 并运行`clickhouse client`。 + +如果您在Mac OS X 或者 FreeBSD上收到`Connection refused`的消息,请尝试指定主机地址为127.0.0.1: + + clickhouse client --host 127.0.0.1 + +您可以使用自定义构建的ClickHouse二进制文件替换系统中安装的ClickHouse二进制文件的生成版本。为此,请参照官方网站上的说明在计算机上安装ClickHouse。 接下来,运行以下命令: + + sudo service clickhouse-server stop + sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ + sudo service clickhouse-server start + +请注意,`clickhouse-client`,`clickhouse-server`和其他服务通常共享`clickhouse`二进制文件的符号链接。 + +您还可以使用系统上安装的ClickHouse软件包中的配置文件运行自定义构建的ClickHouse二进制文件: + + sudo service clickhouse-server stop + sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml + +# IDE (集成开发环境) {#ide-ji-cheng-kai-fa-huan-jing} + +如果您还不知道使用哪款IDE,我们推荐使用CLion。CLion是一款商业软件,但能够有30天的免费使用时间。它同时也对学生免费。CLion可以在Linux和Mac OS X上使用。 + +KDevelop和QTCreator是另外两款适合开发ClickHouse的替代IDE。尽管不太稳定,但KDevelop还是作为一款非常便捷的IDE。如果KDevelop在打开项目后不久崩溃,则您应该在打开项目文件列表后立即单击«全部停止»按钮。按此处理后,KDevelop可以正常使用。 + +作为简易的代码编辑器,您可以使用Sublime Text或Visual Studio Code或Kate(在Linux上都可用)。 + +值得一提的是CLion会创建自己的`build`路径,它还会自行选择`debug`作为构建类型。对于配置,它使用CLion中定义的CMake版本,而不是您安装的版本。最后,CLion会使用`make`而不是`ninja`去构建任务。这属于正常的现象,请记住这一点,以免造成混淆。 + +# 编写代码 {#bian-xie-dai-ma} + +ClickHouse的架构描述可以在此处查看:https://clickhouse.tech/docs/en/development/architecture/ + +代码风格指引:https://clickhouse.tech/docs/en/development/style/ + +编写测试用例:https://clickhouse.tech/docs/en/development/tests/ + +任务列表:https://github.com/ClickHouse/ClickHouse/blob/master/tests/instructions/easy\_tasks\_sorted\_en.md + +# 测试数据 {#ce-shi-shu-ju} + +开发ClickHouse通常需要加载现实的数据集,尤其是在性能测试的场景。我们可以从Yandex.Metrica获取一组特别准备的匿名数据。这些数据需要额外使用3GB的空闲磁盘空间。请注意,完成大多数开发任务并不需要此数据。 + + sudo apt install wget xz-utils + + wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz + wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz + + xz -v -d hits_v1.tsv.xz + xz -v -d visits_v1.tsv.xz + + clickhouse-client + + CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); + + CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); + + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv + clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv + +# 创建拉取请求 {#chuang-jian-la-qu-qing-qiu} + +进入到GitHub 用户界面中的fork库。如果您已经在某个分支中进行开发,则需要选择该分支。在屏幕中有一个 «拉取请求»的按钮。实际上这等价于«创建一个请求以接受对主库的变更»。 + +即使工作尚未完成,也可以创建拉取请求。在这种情况下,请在标题的开头加上«WIP»(正在进行中),以便后续更改。这对于协同审查和讨论更改以及运行所有可用测试用例很有用。提供有关变更的简短描述很重要,这将在后续用于生成重新发布变更日志。 + +Yandex成员一旦在您的拉取请求上贴上«可以测试»标签,就会开始测试。一些初始检查项(例如,代码类型)的结果会在几分钟内反馈。构建的检查结果将在半小时内完成。而主要的测试用例集结果将在一小时内报告给您。 + +系统将分别为您的拉取请求准备ClickHouse二进制版本。若要检索这些构建信息,请在检查列表中单击« ClickHouse构建检查»旁边的«详细信息»链接。在这里,您会找到指向ClickHouse的.deb软件包的直接链接,此外,甚至可以将其部署在生产服务器上(如果您不担心)。 + +某些构建项很可能会在首次构建时失败。这是因为我们同时检查了基于gcc和clang的构建,几乎所有现有的被clang启用的警告(总是带有`-Werror`标志)。在同一页面上,您可以找到所有构建的日志,因此不必以所有可能的方式构建ClickHouse。 diff --git a/docs/zh/development/developer_instruction.md b/docs/zh/development/developer_instruction.md deleted file mode 100644 index f39ab665ee6..00000000000 --- a/docs/zh/development/developer_instruction.md +++ /dev/null @@ -1,271 +0,0 @@ - -ClickHose支持Linux,FreeBSD 及 Mac OS X 系统。 - -# Windows使用指引 {#windowsshi-yong-zhi-yin} - -如果您的系统是Windows,则需要创建Ubuntu虚拟机。可以安装VirtualBox来构建虚拟机。Ubuntu的下载链接为:https://www.ubuntu.com/\#download 。请使用下载好的镜像创建一个虚拟机(请确保虚拟机有至少4GB的内存容量)。在Ubuntu中使用«terminal»程序(gnome-terminal,konsole等)运行命令行终端,或使用快捷键Ctrl+Alt+T。 - -# 在GitHub上创建源码库 {#zai-githubshang-chuang-jian-yuan-ma-ku} - -您需要(申请)一个GitHub账户来使用ClickHouse。 - -如果没有账户,请在https://github.com上注册一个。如果没有SSH密钥,请在本地创建密钥并将公钥上传到GitHub上。这有助于你提交更新代码。并且在不同的SSH服务端,你也可以使用相同的SSH密钥。 - -要创建ClickHouse源码库的分支,请在https://github.com/ClickHouse/ClickHouse页面上点击右上角的«fork»按钮。它会在本账户上创建您个人的ClickHouse/ClickHouse分支。 - -若要参与开发,首先请在ClickHouse的分支中提交您期望的变更,然后创建一个«pull请求»,以便这些变更能够被(ClickHouse/ClickHouse)主库接受。 - -请先安装`git`来使用git源码库。 - -请在Ubuntu终端上使用下列的指令来安装`git`: - - sudo apt update - sudo apt install git - -在https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf中找到有关使用Git的简易手册。有关Git的详细手册,请参见: https://git-scm.com/book/ru/v2 。 - -# 拷贝源码库到开发机 {#kao-bei-yuan-ma-ku-dao-kai-fa-ji} - -接下来,请将源码下载到开发机上。这步操作被称为«拷贝源码库»,是因为它在您的开发机上创建了源码库的本地副本。 - -在终端命令行输入下列指令: - - git clone --recursive git@guthub.com:your_github_username/ClickHouse.git - cd ClickHouse - -请注意,您需要将*your\_github\_username* 替换成实际使用的账户名! - -这个指令将创建一个包含项目副本的`ClickHouse`工作目录。 - -重要的是,工作目录的路径中不应包含空格,因为这可能会导致运行构建系统时出现问题。 - -请注意,ClickHouse源码库使用了`submodules`。这是对其他库的引用(即项目所依赖的外部库)。即在拷贝源码库时,需要如上述指令中那样指定`--recursive`。如果在拷贝源码库时没有包含子模块,需要执行使用下列的指令: - - git submodule init - git submodule update - -可以通过 `git submodule status`来检查子模块的状态。 - -如果提示下列的错误信息: - - Permission denied (publickey). - fatal: Could not read from remote repository. - - Please make sure you have the correct access rights - and the repository exists. - -这通常表示缺少用于连接GitHub的SSH密钥。这些密钥一般都在`~/.ssh`中。要接受SSH密钥,请在GitHub UI的设置页面中上传它们。 - -您还可以通过https协议来拷贝源码库: - - git clone https://github.com/ClickHouse/ClickHouse.git - -但是,这无法将变更提交到服务器上。您仍然可以暂时使用,并后续再添加SSH密钥,用`git remote`命令替换源码库的远程地址。 - -还可以将原始ClickHouse库的地址添加到本地库中,以便从那里获取更新: - - git remote add upstream git@github.com:ClickHouse/ClickHouse.git - -命令执行成功后,可以通过执行`git pull upstream master`,从ClickHouse的主分支中拉去更新。 - -## 使用子模块 {#working-with-submodules} - -在git中使用子模块可能会很痛苦。 接下来的命令将有助于管理它: - - # ! each command accepts --recursive - # Update remote URLs for submodules. Barely rare case - git submodule sync - # Add new submodules - git submodule init - # Update existing submodules to the current state - git submodule update - # Two last commands could be merged together - git submodule update --init - -接下来的命令将帮助您将所有子模块重置为初始状态(!华林! -里面的任何chenges将被删除): - - # Synchronizes submodules' remote URL with .gitmodules - git submodule sync --recursive - # Update the registered submodules with initialize not yet initialized - git submodule update --init --recursive - # Reset all changes done after HEAD - git submodule foreach git reset --hard - # Clean files from .gitignore - git submodule foreach git clean -xfd - # Repeat last 4 commands for all submodule - git submodule foreach git submodule sync --recursive - git submodule foreach git submodule update --init --recursive - git submodule foreach git submodule foreach git reset --hard - git submodule foreach git submodule foreach git clean -xfd - -# 构建系统 {#gou-jian-xi-tong} - -ClickHouse使用 CMake 和 Ninja 来构建系统。 - -CMake - 一个可以生成Ninja文件的元构建系统(构建任务)。 -Ninja - 一个轻量级的构建系统,专注于速度,用于执行这些cmake生成的任务。 - -在Ubuntu,Debian或者Mint系统上执行`sudo apt install cmake ninja-build`来安装ninja。 - -在CentOS,RedHat系统上执行`sudo yum install cmake ninja-build`。 - -如果您曾经使用过Arch或Gentoo,那么也许知道如何安装CMake。 - -若要在Mac OS X上安装CMake和Ninja,请先安装Homebrew,然后再通过brew安装其他内容: - - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install cmake ninja - -接下来,检查CMake的版本:`cmake --version`。如果版本低于3.3,则需要从以下网站安装更新版本:https://cmake.org/download/ 。 - -# 可供选择的外部库 {#ke-gong-xuan-ze-de-wai-bu-ku} - -ClickHouse使用多个外部库进行构建。大多数外部库不需要单独安装,而是和ClickHouse一起在子模块中构建。可以查看`contrib`中罗列的清单。 - -# C++ 编译器 {#c-bian-yi-qi} - -GCC编译器从版本9开始,以及Clang版本\>=8都可支持构建ClickHouse。 - -Yandex官方当前使用GCC构建ClickHouse,因为它生成的机器代码性能较好(根据测评,最多可以相差几个百分点)。Clang通常可以更加便捷的开发。我们的持续集成(CI)平台会运行大约十二种构建组合的检查。 - -在Ubuntu上安装GCC,请执行:`sudo apt install gcc g++` - -请使用`gcc --version`查看gcc的版本。如果gcc版本低于9,请参考此处的指示:https://clickhouse.tech/docs/en/development/build/\#install-gcc-9 。 - -在Mac OS X上安装GCC,请执行:`brew install gcc` - -如果您决定使用Clang,还可以同时安装 `libc++`以及`lld`,前提是您也熟悉它们。此外,也推荐使用`ccache`。 - -# 构建的过程 {#gou-jian-de-guo-cheng} - -如果当前已经准备好构建ClickHouse,我们建议您在`ClickHouse`中创建一个单独的目录`build`,其中包含所有构建组件: - - mkdir build - cd build - -您也可以有多个不同类型的构建目录(例如,build\_release, build\_debug等等)。 - -在`build`目录下,通过运行CMake配置构建。 在第一次运行之前,请定义用于指定编译器的环境变量(本示例中为gcc 9 编译器)。 - - export CC=gcc-9 CXX=g++-9 - cmake .. - -`CC`变量指代C的编译器(C Compiler的缩写),而`CXX`变量指代要使用哪个C++编译器进行编译。 - -为了更快的构建,请使用`debug`构建类型-不含优化的构建。为此提供以下的参数`-D CMAKE_BUILD_TYPE=Debug`: - - cmake -D CMAKE_BUILD_TYPE=Debug .. - -您可以通过在`build`目录中运行此命令来更改构建类型。 - -运行ninja进行构建: - - ninja clickhouse-server clickhouse-client - -在此示例中,仅将构建所需的二进制文件。 - -如果您需要构建所有的二进制文件(utilities和tests),请运行不带参数的ninja: - - ninja - -全量构建需要大约30GB的可用磁盘空间或15GB的空间来构建主要的二进制文件。 - -当构建的机器上有大量内存时,可考虑设置与`-j`参数并行运行的构建任务数量: - - ninja -j 1 clickhouse-server clickhouse-client - -在拥有4GB内存的机器上,建议设置成1,在拥有8GB内存的机器上,建议按`-j 2`设置。 - -如果您收到以下消息: - -`ninja:error:loading'build.ninja':No such file or directory` - -则表示生成构建配置失败,请检查上述消息。 - -成功启动构建过程后,您将看到构建进度-已处理任务的数量和任务总数。 - -在libhdfs2库中生成有关protobuf文件的消息时,可能会显示诸如`libprotobuf WARNING`。它们没有影响,可以忽略不计。 - -成功构建后,会得到一个可执行文件`ClickHouse//programs/clickhouse`: - - ls -l programs/clickhouse - -# 运行ClickHouse可执行文件 {#yun-xing-clickhouseke-zhi-xing-wen-jian} - -要以当前的用户身份运行服务,请进入到`ClickHouse/programs/server/` 目录(在`build`文件夹外)并运行: - - ../../../build/programs/clickhouse server - -在这种情况下,ClickHouse将使用位于当前目录中的配置文件。您可以从任何目录运行`Clickhouse server`,并将配置文件`--config-file`的路径指定为命令行参数。 - -在另外一个终端上连接ClickHouse的clickhouse-client客户端,请进入到`ClickHouse/build/programs/` 并运行`clickhouse client`。 - -如果您在Mac OS X 或者 FreeBSD上收到`Connection refused`的消息,请尝试指定主机地址为127.0.0.1: - - clickhouse client --host 127.0.0.1 - -您可以使用自定义构建的ClickHouse二进制文件替换系统中安装的ClickHouse二进制文件的生成版本。为此,请参照官方网站上的说明在计算机上安装ClickHouse。 接下来,运行以下命令: - - sudo service clickhouse-server stop - sudo cp ClickHouse/build/programs/clickhouse /usr/bin/ - sudo service clickhouse-server start - -请注意,`clickhouse-client`,`clickhouse-server`和其他服务通常共享`clickhouse`二进制文件的符号链接。 - -您还可以使用系统上安装的ClickHouse软件包中的配置文件运行自定义构建的ClickHouse二进制文件: - - sudo service clickhouse-server stop - sudo -u clickhouse ClickHouse/build/programs/clickhouse server --config-file /etc/clickhouse-server/config.xml - -# IDE (集成开发环境) {#ide-ji-cheng-kai-fa-huan-jing} - -如果您还不知道使用哪款IDE,我们推荐使用CLion。CLion是一款商业软件,但能够有30天的免费使用时间。它同时也对学生免费。CLion可以在Linux和Mac OS X上使用。 - -KDevelop和QTCreator是另外两款适合开发ClickHouse的替代IDE。尽管不太稳定,但KDevelop还是作为一款非常便捷的IDE。如果KDevelop在打开项目后不久崩溃,则您应该在打开项目文件列表后立即单击«全部停止»按钮。按此处理后,KDevelop可以正常使用。 - -作为简易的代码编辑器,您可以使用Sublime Text或Visual Studio Code或Kate(在Linux上都可用)。 - -值得一提的是CLion会创建自己的`build`路径,它还会自行选择`debug`作为构建类型。对于配置,它使用CLion中定义的CMake版本,而不是您安装的版本。最后,CLion会使用`make`而不是`ninja`去构建任务。这属于正常的现象,请记住这一点,以免造成混淆。 - -# 编写代码 {#bian-xie-dai-ma} - -ClickHouse的架构描述可以在此处查看:https://clickhouse.tech/docs/en/development/architecture/ - -代码风格指引:https://clickhouse.tech/docs/en/development/style/ - -编写测试用例:https://clickhouse.tech/docs/en/development/tests/ - -任务列表:https://github.com/ClickHouse/ClickHouse/blob/master/tests/instructions/easy\_tasks\_sorted\_en.md - -# 测试数据 {#ce-shi-shu-ju} - -开发ClickHouse通常需要加载现实的数据集,尤其是在性能测试的场景。我们可以从Yandex.Metrica获取一组特别准备的匿名数据。这些数据需要额外使用3GB的空闲磁盘空间。请注意,完成大多数开发任务并不需要此数据。 - - sudo apt install wget xz-utils - - wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz - wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz - - xz -v -d hits_v1.tsv.xz - xz -v -d visits_v1.tsv.xz - - clickhouse-client - - CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID), EventTime); - - CREATE TABLE test.visits ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), `Goals.ID` Array(UInt32), `Goals.Serial` Array(UInt32), `Goals.EventTime` Array(DateTime), `Goals.Price` Array(Int64), `Goals.OrderID` Array(String), `Goals.CurrencyID` Array(UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, `TraficSource.ID` Array(Int8), `TraficSource.SearchEngineID` Array(UInt16), `TraficSource.AdvEngineID` Array(UInt8), `TraficSource.PlaceID` Array(UInt16), `TraficSource.SocialSourceNetworkID` Array(UInt8), `TraficSource.Domain` Array(String), `TraficSource.SearchPhrase` Array(String), `TraficSource.SocialSourcePage` Array(String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, `ParsedParams.Key1` Array(String), `ParsedParams.Key2` Array(String), `ParsedParams.Key3` Array(String), `ParsedParams.Key4` Array(String), `ParsedParams.Key5` Array(String), `ParsedParams.ValueDouble` Array(Float64), `Market.Type` Array(UInt8), `Market.GoalID` Array(UInt32), `Market.OrderID` Array(String), `Market.OrderPrice` Array(Int64), `Market.PP` Array(UInt32), `Market.DirectPlaceID` Array(UInt32), `Market.DirectOrderID` Array(UInt32), `Market.DirectBannerID` Array(UInt32), `Market.GoodID` Array(String), `Market.GoodName` Array(String), `Market.GoodQuantity` Array(Int32), `Market.GoodPrice` Array(Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) SAMPLE BY intHash32(UserID) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID); - - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.hits FORMAT TSV" < hits_v1.tsv - clickhouse-client --max_insert_block_size 100000 --query "INSERT INTO test.visits FORMAT TSV" < visits_v1.tsv - -# 创建拉取请求 {#chuang-jian-la-qu-qing-qiu} - -进入到GitHub 用户界面中的fork库。如果您已经在某个分支中进行开发,则需要选择该分支。在屏幕中有一个 «拉取请求»的按钮。实际上这等价于«创建一个请求以接受对主库的变更»。 - -即使工作尚未完成,也可以创建拉取请求。在这种情况下,请在标题的开头加上«WIP»(正在进行中),以便后续更改。这对于协同审查和讨论更改以及运行所有可用测试用例很有用。提供有关变更的简短描述很重要,这将在后续用于生成重新发布变更日志。 - -Yandex成员一旦在您的拉取请求上贴上«可以测试»标签,就会开始测试。一些初始检查项(例如,代码类型)的结果会在几分钟内反馈。构建的检查结果将在半小时内完成。而主要的测试用例集结果将在一小时内报告给您。 - -系统将分别为您的拉取请求准备ClickHouse二进制版本。若要检索这些构建信息,请在检查列表中单击« ClickHouse构建检查»旁边的«详细信息»链接。在这里,您会找到指向ClickHouse的.deb软件包的直接链接,此外,甚至可以将其部署在生产服务器上(如果您不担心)。 - -某些构建项很可能会在首次构建时失败。这是因为我们同时检查了基于gcc和clang的构建,几乎所有现有的被clang启用的警告(总是带有`-Werror`标志)。在同一页面上,您可以找到所有构建的日志,因此不必以所有可能的方式构建ClickHouse。 diff --git a/docs/zh/development/index.md b/docs/zh/development/index.md index cf3b2fae1d9..187ee1b3e25 100644 --- a/docs/zh/development/index.md +++ b/docs/zh/development/index.md @@ -1,4 +1,3 @@ - # ClickHouse 开发 {#clickhouse-kai-fa} [来源文章](https://clickhouse.tech/docs/en/development/) diff --git a/docs/zh/development/style.md b/docs/zh/development/style.md index 10c036fef3b..4bb8079c237 100644 --- a/docs/zh/development/style.md +++ b/docs/zh/development/style.md @@ -1,4 +1,3 @@ - # 如何编写 C++ 代码 {#ru-he-bian-xie-c-dai-ma} ## 一般建议 {#yi-ban-jian-yi} diff --git a/docs/zh/development/tests.md b/docs/zh/development/tests.md index f54e273a77a..d06af4c02dd 100644 --- a/docs/zh/development/tests.md +++ b/docs/zh/development/tests.md @@ -1,4 +1,3 @@ - # ClickHouse 测试 {#clickhouse-ce-shi} ## 功能性测试 {#gong-neng-xing-ce-shi} diff --git a/docs/zh/engines/database-engines/index.md b/docs/zh/engines/database-engines/index.md new file mode 100644 index 00000000000..25c9ff6c6bc --- /dev/null +++ b/docs/zh/engines/database-engines/index.md @@ -0,0 +1,11 @@ +# 数据库引擎 {#shu-ju-ku-yin-qing} + +您使用的所有表都是由数据库引擎所提供的 + +默认情况下,ClickHouse使用自己的数据库引擎,该引擎提供可配置的[表引擎](../../engines/database-engines/index.md)和[所有支持的SQL语法](../../engines/database-engines/index.md). + +除此之外,您还可以选择使用以下的数据库引擎: + +- [MySQL](mysql.md) + +[来源文章](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/zh/engines/database_engines/lazy.md b/docs/zh/engines/database-engines/lazy.md similarity index 100% rename from docs/zh/engines/database_engines/lazy.md rename to docs/zh/engines/database-engines/lazy.md diff --git a/docs/zh/engines/database-engines/mysql.md b/docs/zh/engines/database-engines/mysql.md new file mode 100644 index 00000000000..fa2cb1ea8e5 --- /dev/null +++ b/docs/zh/engines/database-engines/mysql.md @@ -0,0 +1,126 @@ +# MySQL {#mysql} + +MySQL引擎用于将远程的MySQL服务器中的表映射到ClickHouse中,并允许您对表进行`INSERT`和`SELECT`查询,以方便您在ClickHouse与MySQL之间进行数据交换。 + +`MySQL`数据库引擎会将对其的查询转换为MySQL语法并发送到MySQL服务器中,因此您可以执行诸如`SHOW TABLES`或`SHOW CREATE TABLE`之类的操作。 + +但您无法对其执行以下操作: + +- `RENAME` +- `CREATE TABLE` +- `ALTER` + +## CREATE DATABASE {#create-database} + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] +ENGINE = MySQL('host:port', ['database' | database], 'user', 'password') +``` + +**MySQL数据库引擎参数** + +- `host:port` — 链接的MySQL地址。 +- `database` — 链接的MySQL数据库。 +- `user` — 链接的MySQL用户。 +- `password` — 链接的MySQL用户密码。 + +## 支持的类型对应 {#zhi-chi-de-lei-xing-dui-ying} + +| MySQL | ClickHouse | +|----------------------------------|-------------------------------------------------------------| +| UNSIGNED TINYINT | [UInt8](../../sql-reference/data-types/int-uint.md) | +| TINYINT | [Int8](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED SMALLINT | [UInt16](../../sql-reference/data-types/int-uint.md) | +| SMALLINT | [Int16](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql-reference/data-types/int-uint.md) | +| INT, MEDIUMINT | [Int32](../../sql-reference/data-types/int-uint.md) | +| UNSIGNED BIGINT | [UInt64](../../sql-reference/data-types/int-uint.md) | +| BIGINT | [Int64](../../sql-reference/data-types/int-uint.md) | +| FLOAT | [Float32](../../sql-reference/data-types/float.md) | +| DOUBLE | [Float64](../../sql-reference/data-types/float.md) | +| DATE | [日期](../../sql-reference/data-types/date.md) | +| DATETIME, TIMESTAMP | [日期时间](../../sql-reference/data-types/datetime.md) | +| BINARY | [固定字符串](../../sql-reference/data-types/fixedstring.md) | + +其他的MySQL数据类型将全部都转换为[字符串](../../sql-reference/data-types/string.md)。 + +同时以上的所有类型都支持[可为空](../../sql-reference/data-types/nullable.md)。 + +## 使用示例 {#shi-yong-shi-li} + +在MySQL中创建表: + + mysql> USE test; + Database changed + + mysql> CREATE TABLE `mysql_table` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `float` FLOAT NOT NULL, + -> PRIMARY KEY (`int_id`)); + Query OK, 0 rows affected (0,09 sec) + + mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); + Query OK, 1 row affected (0,00 sec) + + mysql> select * from mysql_table; + +--------+-------+ + | int_id | value | + +--------+-------+ + | 1 | 2 | + +--------+-------+ + 1 row in set (0,00 sec) + +在ClickHouse中创建MySQL类型的数据库,同时与MySQL服务器交换数据: + +``` sql +CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') +``` + +``` sql +SHOW DATABASES +``` + +``` text +┌─name─────┐ +│ default │ +│ mysql_db │ +│ system │ +└──────────┘ +``` + +``` sql +SHOW TABLES FROM mysql_db +``` + +``` text +┌─name─────────┐ +│ mysql_table │ +└──────────────┘ +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +└────────┴───────┘ +``` + +``` sql +INSERT INTO mysql_db.mysql_table VALUES (3,4) +``` + +``` sql +SELECT * FROM mysql_db.mysql_table +``` + +``` text +┌─int_id─┬─value─┐ +│ 1 │ 2 │ +│ 3 │ 4 │ +└────────┴───────┘ +``` + +[来源文章](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/zh/engines/database_engines/index.md b/docs/zh/engines/database_engines/index.md deleted file mode 100644 index 2431b96a43d..00000000000 --- a/docs/zh/engines/database_engines/index.md +++ /dev/null @@ -1,12 +0,0 @@ - -# 数据库引擎 {#shu-ju-ku-yin-qing} - -您使用的所有表都是由数据库引擎所提供的 - -默认情况下,ClickHouse使用自己的数据库引擎,该引擎提供可配置的[表引擎](../../engines/database_engines/index.md)和[所有支持的SQL语法](../../engines/database_engines/index.md). - -除此之外,您还可以选择使用以下的数据库引擎: - -- [MySQL](mysql.md) - -[来源文章](https://clickhouse.tech/docs/en/database_engines/) diff --git a/docs/zh/engines/database_engines/mysql.md b/docs/zh/engines/database_engines/mysql.md deleted file mode 100644 index 80ff82ec2d3..00000000000 --- a/docs/zh/engines/database_engines/mysql.md +++ /dev/null @@ -1,127 +0,0 @@ - -# MySQL {#mysql} - -MySQL引擎用于将远程的MySQL服务器中的表映射到ClickHouse中,并允许您对表进行`INSERT`和`SELECT`查询,以方便您在ClickHouse与MySQL之间进行数据交换。 - -`MySQL`数据库引擎会将对其的查询转换为MySQL语法并发送到MySQL服务器中,因此您可以执行诸如`SHOW TABLES`或`SHOW CREATE TABLE`之类的操作。 - -但您无法对其执行以下操作: - -- `RENAME` -- `CREATE TABLE` -- `ALTER` - -## CREATE DATABASE {#create-database} - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] -ENGINE = MySQL('host:port', ['database' | database], 'user', 'password') -``` - -**MySQL数据库引擎参数** - -- `host:port` — 链接的MySQL地址。 -- `database` — 链接的MySQL数据库。 -- `user` — 链接的MySQL用户。 -- `password` — 链接的MySQL用户密码。 - -## 支持的类型对应 {#zhi-chi-de-lei-xing-dui-ying} - -| MySQL | ClickHouse | -|----------------------------------|-------------------------------------------------------------| -| UNSIGNED TINYINT | [UInt8](../../sql_reference/data_types/int_uint.md) | -| TINYINT | [Int8](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED SMALLINT | [UInt16](../../sql_reference/data_types/int_uint.md) | -| SMALLINT | [Int16](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED INT, UNSIGNED MEDIUMINT | [UInt32](../../sql_reference/data_types/int_uint.md) | -| INT, MEDIUMINT | [Int32](../../sql_reference/data_types/int_uint.md) | -| UNSIGNED BIGINT | [UInt64](../../sql_reference/data_types/int_uint.md) | -| BIGINT | [Int64](../../sql_reference/data_types/int_uint.md) | -| FLOAT | [Float32](../../sql_reference/data_types/float.md) | -| DOUBLE | [Float64](../../sql_reference/data_types/float.md) | -| DATE | [日期](../../sql_reference/data_types/date.md) | -| DATETIME, TIMESTAMP | [日期时间](../../sql_reference/data_types/datetime.md) | -| BINARY | [固定字符串](../../sql_reference/data_types/fixedstring.md) | - -其他的MySQL数据类型将全部都转换为[字符串](../../sql_reference/data_types/string.md)。 - -同时以上的所有类型都支持[可为空](../../sql_reference/data_types/nullable.md)。 - -## 使用示例 {#shi-yong-shi-li} - -在MySQL中创建表: - - mysql> USE test; - Database changed - - mysql> CREATE TABLE `mysql_table` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `float` FLOAT NOT NULL, - -> PRIMARY KEY (`int_id`)); - Query OK, 0 rows affected (0,09 sec) - - mysql> insert into mysql_table (`int_id`, `float`) VALUES (1,2); - Query OK, 1 row affected (0,00 sec) - - mysql> select * from mysql_table; - +--------+-------+ - | int_id | value | - +--------+-------+ - | 1 | 2 | - +--------+-------+ - 1 row in set (0,00 sec) - -在ClickHouse中创建MySQL类型的数据库,同时与MySQL服务器交换数据: - -``` sql -CREATE DATABASE mysql_db ENGINE = MySQL('localhost:3306', 'test', 'my_user', 'user_password') -``` - -``` sql -SHOW DATABASES -``` - -``` text -┌─name─────┐ -│ default │ -│ mysql_db │ -│ system │ -└──────────┘ -``` - -``` sql -SHOW TABLES FROM mysql_db -``` - -``` text -┌─name─────────┐ -│ mysql_table │ -└──────────────┘ -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -└────────┴───────┘ -``` - -``` sql -INSERT INTO mysql_db.mysql_table VALUES (3,4) -``` - -``` sql -SELECT * FROM mysql_db.mysql_table -``` - -``` text -┌─int_id─┬─value─┐ -│ 1 │ 2 │ -│ 3 │ 4 │ -└────────┴───────┘ -``` - -[来源文章](https://clickhouse.tech/docs/en/database_engines/mysql/) diff --git a/docs/zh/engines/table-engines/index.md b/docs/zh/engines/table-engines/index.md new file mode 100644 index 00000000000..d2546e21db4 --- /dev/null +++ b/docs/zh/engines/table-engines/index.md @@ -0,0 +1,73 @@ +# 表引擎 {#biao-yin-qing} + +表引擎(即表的类型)决定了: + +- 数据的存储方式和位置,写到哪里以及从哪里读取数据 +- 支持哪些查询以及如何支持。 +- 并发数据访问。 +- 索引的使用(如果存在)。 +- 是否可以执行多线程请求。 +- 数据复制参数。 + +# 引擎类型 {#yin-qing-lei-xing} + +## MergeTree {#mergetree} + +适用于高负载任务的最通用和功能最强大的表引擎。这些引擎的共同特点是可以快速插入数据并进行后续的后台数据处理。 MergeTree系列引擎支持数据复制(使用[Replicated\*](mergetree-family/replication.md) 的引擎版本),分区和一些其他引擎不支持的其他功能。 + +该类型的引擎: +- [MergeTree](mergetree-family/mergetree.md) +- [ReplacingMergeTree](mergetree-family/replacingmergetree.md) +- [SummingMergeTree](mergetree-family/summingmergetree.md) +- [AggregatingMergeTree](mergetree-family/aggregatingmergetree.md) +- [CollapsingMergeTree](mergetree-family/collapsingmergetree.md) +- [VersionedCollapsingMergeTree](mergetree-family/versionedcollapsingmergetree.md) +- [GraphiteMergeTree](mergetree-family/graphitemergetree.md) + +## 日志 {#log} + +具有最小功能的[轻量级引擎](log-family/index.md)。当您需要快速写入许多小表(最多约100万行)并在以后整体读取它们时,该类型的引擎是最有效的。 + +该类型的引擎: + +- [TinyLog](log-family/tinylog.md) +- [StripeLog](log-family/stripelog.md) +- [Log](log-family/log.md) + +## 集成引擎 {#integration-engines} + +用于与其他的数据存储与处理系统集成的引擎。 +该类型的引擎: + +- [Kafka](integrations/kafka.md) +- [MySQL](integrations/mysql.md) +- [ODBC](integrations/odbc.md) +- [JDBC](integrations/jdbc.md) +- [HDFS](integrations/hdfs.md) + +## 用于其他特定功能的引擎 {#yong-yu-qi-ta-te-ding-gong-neng-de-yin-qing} + +该类型的引擎: + +- [Distributed](special/distributed.md) +- [MaterializedView](special/materializedview.md) +- [Dictionary](special/dictionary.md) +- [Merge](special/merge.md) +- [File](special/file.md) +- [Null](special/null.md) +- [Set](special/set.md) +- [Join](special/join.md) +- [URL](special/url.md) +- [View](special/view.md) +- [Memory](special/memory.md) +- [Buffer](special/buffer.md) + +# 虚拟列 {#xu-ni-lie} + +虚拟列是表引擎组成的一部分,它在对应的表引擎的源代码中定义。 + +您不能在 `CREATE TABLE` 中指定虚拟列,并且虚拟列不会包含在 `SHOW CREATE TABLE` 和 `DESCRIBE TABLE` 的查询结果中。虚拟列是只读的,所以您不能向虚拟列中写入数据。 + +如果想要查询虚拟列中的数据,您必须在SELECT查询中包含虚拟列的名字。`SELECT *` 不会返回虚拟列的内容。 + +若您创建的表中有一列与虚拟列的名字相同,那么虚拟列将不能再被访问。我们不建议您这样做。为了避免这种列名的冲突,虚拟列的名字一般都以下划线开头。 diff --git a/docs/zh/engines/table-engines/integrations/hdfs.md b/docs/zh/engines/table-engines/integrations/hdfs.md new file mode 100644 index 00000000000..d7966fd799b --- /dev/null +++ b/docs/zh/engines/table-engines/integrations/hdfs.md @@ -0,0 +1,123 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 36 +toc_title: HDFS +--- + +# HDFS {#table_engines-hdfs} + +该引擎提供了集成 [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) 生态系统通过允许管理数据 [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)通过ClickHouse. 这个引擎是相似的 +到 [文件](../special/file.md) 和 [URL](../special/url.md) 引擎,但提供Hadoop特定的功能。 + +## 用途 {#usage} + +``` sql +ENGINE = HDFS(URI, format) +``` + +该 `URI` 参数是HDFS中的整个文件URI。 +该 `format` 参数指定一种可用的文件格式。 执行 +`SELECT` 查询时,格式必须支持输入,并执行 +`INSERT` queries – for output. The available formats are listed in the +[格式](../../../interfaces/formats.md#formats) 科。 +路径部分 `URI` 可能包含水珠。 在这种情况下,表将是只读的。 + +**示例:** + +**1.** 设置 `hdfs_engine_table` 表: + +``` sql +CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') +``` + +**2.** 填充文件: + +``` sql +INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) +``` + +**3.** 查询数据: + +``` sql +SELECT * FROM hdfs_engine_table LIMIT 2 +``` + +``` text +┌─name─┬─value─┐ +│ one │ 1 │ +│ two │ 2 │ +└──────┴───────┘ +``` + +## 实施细节 {#implementation-details} + +- 读取和写入可以并行 +- 不支持: + - `ALTER` 和 `SELECT...SAMPLE` 操作。 + - 索引。 + - 复制。 + +**路径中的水珠** + +多个路径组件可以具有globs。 对于正在处理的文件应该存在并匹配到整个路径模式。 文件列表确定在 `SELECT` (不在 `CREATE` 时刻)。 + +- `*` — Substitutes any number of any characters except `/` 包括空字符串。 +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +建筑与 `{}` 类似于 [远程](../../../sql-reference/table-functions/remote.md) 表功能。 + +**示例** + +1. 假设我们在HDFS上有几个TSV格式的文件,其中包含以下Uri: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. 有几种方法可以创建由所有六个文件组成的表: + + + +``` sql +CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') +``` + +另一种方式: + +``` sql +CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') +``` + +表由两个目录中的所有文件组成(所有文件都应满足query中描述的格式和模式): + +``` sql +CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') +``` + +!!! warning "警告" + 如果文件列表包含带有前导零的数字范围,请单独使用带有大括号的构造或使用 `?`. + +**示例** + +创建具有名为文件的表 `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') +``` + +## 虚拟列 {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**另请参阅** + +- [虚拟列](../index.md#table_engines-virtual_columns) + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/zh/engines/table_engines/integrations/index.md b/docs/zh/engines/table-engines/integrations/index.md similarity index 100% rename from docs/zh/engines/table_engines/integrations/index.md rename to docs/zh/engines/table-engines/integrations/index.md diff --git a/docs/zh/engines/table-engines/integrations/jdbc.md b/docs/zh/engines/table-engines/integrations/jdbc.md new file mode 100644 index 00000000000..cd2bc5ae2a3 --- /dev/null +++ b/docs/zh/engines/table-engines/integrations/jdbc.md @@ -0,0 +1,90 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 34 +toc_title: JDBC +--- + +# JDBC {#table-engine-jdbc} + +允许ClickHouse通过以下方式连接到外部数据库 [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). + +要实现JDBC连接,ClickHouse使用单独的程序 [ツ暗ェツ氾环催ツ団ツ法ツ人](https://github.com/alex-krash/clickhouse-jdbc-bridge) 这应该作为守护进程运行。 + +该引擎支持 [可为空](../../../sql-reference/data-types/nullable.md) 数据类型。 + +## 创建表 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name +( + columns list... +) +ENGINE = JDBC(dbms_uri, external_database, external_table) +``` + +**发动机参数** + +- `dbms_uri` — URI of an external DBMS. + + 格式: `jdbc:://:/?user=&password=`. + Mysql的示例: `jdbc:mysql://localhost:3306/?user=root&password=root`. + +- `external_database` — Database in an external DBMS. + +- `external_table` — Name of the table in `external_database`. + +## 用法示例 {#usage-example} + +通过直接与它的控制台客户端连接在MySQL服务器中创建一个表: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +在ClickHouse服务器中创建表并从中选择数据: + +``` sql +CREATE TABLE jdbc_table +( + `int_id` Int32, + `int_nullable` Nullable(Int32), + `float` Float32, + `float_nullable` Nullable(Float32) +) +ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') +``` + +``` sql +SELECT * +FROM jdbc_table +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## 另请参阅 {#see-also} + +- [JDBC表函数](../../../sql-reference/table-functions/jdbc.md). + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/zh/engines/table-engines/integrations/kafka.md b/docs/zh/engines/table-engines/integrations/kafka.md new file mode 100644 index 00000000000..da19e2a24b9 --- /dev/null +++ b/docs/zh/engines/table-engines/integrations/kafka.md @@ -0,0 +1,135 @@ +# 卡夫卡 {#kafka} + +此引擎与 [Apache Kafka](http://kafka.apache.org/) 结合使用。 + +Kafka 特性: + +- 发布或者订阅数据流。 +- 容错存储机制。 +- 处理流数据。 + + + +老版格式: + + Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format + [, kafka_row_delimiter, kafka_schema, kafka_num_consumers]) + +新版格式: + + Kafka SETTINGS + kafka_broker_list = 'localhost:9092', + kafka_topic_list = 'topic1,topic2', + kafka_group_name = 'group1', + kafka_format = 'JSONEachRow', + kafka_row_delimiter = '\n', + kafka_schema = '', + kafka_num_consumers = 2 + +必要参数: + +- `kafka_broker_list` – 以逗号分隔的 brokers 列表 (`localhost:9092`)。 +- `kafka_topic_list` – topic 列表 (`my_topic`)。 +- `kafka_group_name` – Kafka 消费组名称 (`group1`)。如果不希望消息在集群中重复,请在每个分片中使用相同的组名。 +- `kafka_format` – 消息体格式。使用与 SQL 部分的 `FORMAT` 函数相同表示方法,例如 `JSONEachRow`。了解详细信息,请参考 `Formats` 部分。 + +可选参数: + +- `kafka_row_delimiter` - 每个消息体(记录)之间的分隔符。 +- `kafka_schema` – 如果解析格式需要一个 schema 时,此参数必填。例如,[普罗托船长](https://capnproto.org/) 需要 schema 文件路径以及根对象 `schema.capnp:Message` 的名字。 +- `kafka_num_consumers` – 单个表的消费者数量。默认值是:`1`,如果一个消费者的吞吐量不足,则指定更多的消费者。消费者的总数不应该超过 topic 中分区的数量,因为每个分区只能分配一个消费者。 + +示例: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + SELECT * FROM queue LIMIT 5; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', + kafka_topic_list = 'topic', + kafka_group_name = 'group1', + kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; + + CREATE TABLE queue2 ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') + SETTINGS kafka_format = 'JSONEachRow', + kafka_num_consumers = 4; +``` + +消费的消息会被自动追踪,因此每个消息在不同的消费组里只会记录一次。如果希望获得两次数据,则使用另一个组名创建副本。 + +消费组可以灵活配置并且在集群之间同步。例如,如果群集中有10个主题和5个表副本,则每个副本将获得2个主题。 如果副本数量发生变化,主题将自动在副本中重新分配。了解更多信息请访问 http://kafka.apache.org/intro。 + +`SELECT` 查询对于读取消息并不是很有用(调试除外),因为每条消息只能被读取一次。使用物化视图创建实时线程更实用。您可以这样做: + +1. 使用引擎创建一个 Kafka 消费者并作为一条数据流。 +2. 创建一个结构表。 +3. 创建物化视图,改视图会在后台转换引擎中的数据并将其放入之前创建的表中。 + +当 `MATERIALIZED VIEW` 添加至引擎,它将会在后台收集数据。可以持续不断地从 Kafka 收集数据并通过 `SELECT` 将数据转换为所需要的格式。 + +示例: + +``` sql + CREATE TABLE queue ( + timestamp UInt64, + level String, + message String + ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); + + CREATE TABLE daily ( + day Date, + level String, + total UInt64 + ) ENGINE = SummingMergeTree(day, (day, level), 8192); + + CREATE MATERIALIZED VIEW consumer TO daily + AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total + FROM queue GROUP BY day, level; + + SELECT level, sum(total) FROM daily GROUP BY level; +``` + +为了提高性能,接受的消息被分组为 [max\_insert\_block\_size](../../../operations/settings/settings.md#settings-max_insert_block_size) 大小的块。如果未在 [stream\_flush\_interval\_ms](../../../operations/settings/settings.md) 毫秒内形成块,则不关心块的完整性,都会将数据刷新到表中。 + +停止接收主题数据或更改转换逻辑,请 detach 物化视图: + + DETACH TABLE consumer; + ATTACH TABLE consumer; + +如果使用 `ALTER` 更改目标表,为了避免目标表与视图中的数据之间存在差异,推荐停止物化视图。 + +## 配置 {#pei-zhi} + +与 `GraphiteMergeTree` 类似,Kafka 引擎支持使用ClickHouse配置文件进行扩展配置。可以使用两个配置键:全局 (`kafka`) 和 主题级别 (`kafka_*`)。首先应用全局配置,然后应用主题级配置(如果存在)。 + +``` xml + + + cgrp + smallest + + + + + 250 + 100000 + +``` + +有关详细配置选项列表,请参阅 [librdkafka配置参考](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md)。在 ClickHouse 配置中使用下划线 (`_`) ,并不是使用点 (`.`)。例如,`check.crcs=true` 将是 `true`。 + +[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/kafka/) diff --git a/docs/zh/engines/table-engines/integrations/mysql.md b/docs/zh/engines/table-engines/integrations/mysql.md new file mode 100644 index 00000000000..526e2d6f865 --- /dev/null +++ b/docs/zh/engines/table-engines/integrations/mysql.md @@ -0,0 +1,25 @@ +# MySQL {#mysql} + +MySQL 引擎可以对存储在远程 MySQL 服务器上的数据执行 `SELECT` 查询。 + +调用格式: + + MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); + +**调用参数** + +- `host:port` — MySQL 服务器地址。 +- `database` — 数据库的名称。 +- `table` — 表名称。 +- `user` — 数据库用户。 +- `password` — 用户密码。 +- `replace_query` — 将 `INSERT INTO` 查询是否替换为 `REPLACE INTO` 的标志。如果 `replace_query=1`,则替换查询 +- `'on_duplicate_clause'` — 将 `ON DUPLICATE KEY UPDATE 'on_duplicate_clause'` 表达式添加到 `INSERT` 查询语句中。例如:`impression = VALUES(impression) + impression`。如果需要指定 `'on_duplicate_clause'`,则需要设置 `replace_query=0`。如果同时设置 `replace_query = 1` 和 `'on_duplicate_clause'`,则会抛出异常。 + +此时,简单的 `WHERE` 子句(例如 `=, !=, >, >=, <, <=`)是在 MySQL 服务器上执行。 + +其余条件以及 `LIMIT` 采样约束语句仅在对MySQL的查询完成后才在ClickHouse中执行。 + +`MySQL` 引擎不支持 [可为空](../../../engines/table-engines/integrations/mysql.md) 数据类型,因此,当从MySQL表中读取数据时,`NULL` 将转换为指定列类型的默认值(通常为0或空字符串)。 + +[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/mysql/) diff --git a/docs/zh/engines/table-engines/integrations/odbc.md b/docs/zh/engines/table-engines/integrations/odbc.md new file mode 100644 index 00000000000..a4f71e50d7f --- /dev/null +++ b/docs/zh/engines/table-engines/integrations/odbc.md @@ -0,0 +1,132 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 35 +toc_title: ODBC +--- + +# ODBC {#table-engine-odbc} + +允许ClickHouse通过以下方式连接到外部数据库 [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +为了安全地实现ODBC连接,ClickHouse使用单独的程序 `clickhouse-odbc-bridge`. 如果直接从ODBC驱动程序加载 `clickhouse-server`,驱动程序问题可能会导致ClickHouse服务器崩溃。 ClickHouse自动启动 `clickhouse-odbc-bridge` 当它是必需的。 ODBC桥程序是从相同的软件包作为安装 `clickhouse-server`. + +该引擎支持 [可为空](../../../sql-reference/data-types/nullable.md) 数据类型。 + +## 创建表 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1], + name2 [type2], + ... +) +ENGINE = ODBC(connection_settings, external_database, external_table) +``` + +请参阅的详细说明 [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) 查询。 + +表结构可以与源表结构不同: + +- 列名应与源表中的列名相同,但您可以按任何顺序使用其中的一些列。 +- 列类型可能与源表中的列类型不同。 ClickHouse尝试 [投](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) ClickHouse数据类型的值。 + +**发动机参数** + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` 文件 +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +## 用法示例 {#usage-example} + +**通过ODBC从本地MySQL安装中检索数据** + +此示例检查Ubuntu Linux18.04和MySQL服务器5.7。 + +确保安装了unixODBC和MySQL连接器。 + +默认情况下(如果从软件包安装),ClickHouse以用户身份启动 `clickhouse`. 因此,您需要在MySQL服务器中创建和配置此用户。 + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +然后配置连接 `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +您可以使用 `isql` unixodbc安装中的实用程序。 + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +MySQL中的表: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +ClickHouse中的表,从MySQL表中检索数据: + +``` sql +CREATE TABLE odbc_t +( + `int_id` Int32, + `float_nullable` Nullable(Float32) +) +ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') +``` + +``` sql +SELECT * FROM odbc_t +``` + +``` text +┌─int_id─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ +└────────┴────────────────┘ +``` + +## 另请参阅 {#see-also} + +- [ODBC外部字典](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [ODBC表函数](../../../sql-reference/table-functions/odbc.md) + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/zh/engines/table_engines/log_family/index.md b/docs/zh/engines/table-engines/log-family/index.md similarity index 100% rename from docs/zh/engines/table_engines/log_family/index.md rename to docs/zh/engines/table-engines/log-family/index.md diff --git a/docs/zh/engines/table-engines/log-family/log-family.md b/docs/zh/engines/table-engines/log-family/log-family.md new file mode 100644 index 00000000000..b749cf42219 --- /dev/null +++ b/docs/zh/engines/table-engines/log-family/log-family.md @@ -0,0 +1,45 @@ +# 日志引擎系列 {#table_engines-log-engine-family} + +这些引擎是为了需要写入许多小数据量(少于一百万行)的表的场景而开发的。 + +这系列的引擎有: + +- [StripeLog](stripelog.md) +- [日志](log.md) +- [TinyLog](tinylog.md) + +## 共同属性 {#table_engines-log-engine-family-common-properties} + +引擎: + +- 数据存储在磁盘上。 + +- 写入时将数据追加在文件末尾。 + +- 不支持[突变](../../../engines/table-engines/log-family/log-family.md#alter-mutations)操作。 + +- 不支持索引。 + + 这意味着 `SELECT` 在范围查询时效率不高。 + +- 非原子地写入数据。 + + 如果某些事情破坏了写操作,例如服务器的异常关闭,你将会得到一张包含了损坏数据的表。 + +## 差异 {#table_engines-log-engine-family-differences} + +`Log` 和 `StripeLog` 引擎支持: + +- 并发访问数据的锁。 + + `INSERT` 请求执行过程中表会被锁定,并且其他的读写数据的请求都会等待直到锁定被解除。如果没有写数据的请求,任意数量的读请求都可以并发执行。 + +- 并行读取数据。 + + 在读取数据时,ClickHouse 使用多线程。 每个线程处理不同的数据块。 + +`Log` 引擎为表中的每一列使用不同的文件。`StripeLog` 将所有的数据存储在一个文件中。因此 `StripeLog` 引擎在操作系统中使用更少的描述符,但是 `Log` 引擎提供更高的读性能。 + +`TingLog` 引擎是该系列中最简单的引擎并且提供了最少的功能和最低的性能。`TingLog` 引擎不支持并行读取和并发数据访问,并将每一列存储在不同的文件中。它比其余两种支持并行读取的引擎的读取速度更慢,并且使用了和 `Log` 引擎同样多的描述符。你可以在简单的低负载的情景下使用它。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/zh/engines/table-engines/log-family/log.md b/docs/zh/engines/table-engines/log-family/log.md new file mode 100644 index 00000000000..4a3855c4bfa --- /dev/null +++ b/docs/zh/engines/table-engines/log-family/log.md @@ -0,0 +1,5 @@ +# 日志 {#log} + +日志与 TinyLog 的不同之处在于,«标记» 的小文件与列文件存在一起。这些标记写在每个数据块上,并且包含偏移量,这些偏移量指示从哪里开始读取文件以便跳过指定的行数。这使得可以在多个线程中读取表数据。对于并发数据访问,可以同时执行读取操作,而写入操作则阻塞读取和其它写入。Log 引擎不支持索引。同样,如果写入表失败,则该表将被破坏,并且从该表读取将返回错误。Log 引擎适用于临时数据,write-once 表以及测试或演示目的。 + +[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/log/) diff --git a/docs/zh/engines/table-engines/log-family/stripelog.md b/docs/zh/engines/table-engines/log-family/stripelog.md new file mode 100644 index 00000000000..389642d5b6e --- /dev/null +++ b/docs/zh/engines/table-engines/log-family/stripelog.md @@ -0,0 +1,82 @@ +# StripeLog {#table_engines-stripelog} + +该引擎属于日志引擎系列。请在[日志引擎系列](log-family.md)文章中查看引擎的共同属性和差异。 + +在你需要写入许多小数据量(小于一百万行)的表的场景下使用这个引擎。 + +## 建表 {#table_engines-stripelog-creating-a-table} + + CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] + ( + column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... + ) ENGINE = StripeLog + +查看[建表](../../../engines/table-engines/log-family/stripelog.md#create-table-query)请求的详细说明。 + +## 写数据 {#table_engines-stripelog-writing-the-data} + +`StripeLog` 引擎将所有列存储在一个文件中。对每一次 `Insert` 请求,ClickHouse 将数据块追加在表文件的末尾,逐列写入。 + +ClickHouse 为每张表写入以下文件: + +- `data.bin` — 数据文件。 +- `index.mrk` — 带标记的文件。标记包含了已插入的每个数据块中每列的偏移量。 + +`StripeLog` 引擎不支持 `ALTER UPDATE` 和 `ALTER DELETE` 操作。 + +## 读数据 {#table_engines-stripelog-reading-the-data} + +带标记的文件使得 ClickHouse 可以并行的读取数据。这意味着 `SELECT` 请求返回行的顺序是不可预测的。使用 `ORDER BY` 子句对行进行排序。 + +## 使用示例 {#table_engines-stripelog-example-of-use} + +建表: + +``` sql +CREATE TABLE stripe_log_table +( + timestamp DateTime, + message_type String, + message String +) +ENGINE = StripeLog +``` + +插入数据: + +``` sql +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') +INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') +``` + +我们使用两次 `INSERT` 请求从而在 `data.bin` 文件中创建两个数据块。 + +ClickHouse 在查询数据时使用多线程。每个线程读取单独的数据块并在完成后独立的返回结果行。这样的结果是,大多数情况下,输出中块的顺序和输入时相应块的顺序是不同的。例如: + +``` sql +SELECT * FROM stripe_log_table +``` + + ┌───────────timestamp─┬─message_type─┬─message────────────────────┐ + │ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ + │ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ + └─────────────────────┴──────────────┴────────────────────────────┘ + ┌───────────timestamp─┬─message_type─┬─message───────────────────┐ + │ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ + └─────────────────────┴──────────────┴───────────────────────────┘ + +对结果排序(默认增序): + +``` sql +SELECT * FROM stripe_log_table ORDER BY timestamp +``` + + ┌───────────timestamp─┬─message_type─┬─message────────────────────┐ + │ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ + │ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ + │ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ + └─────────────────────┴──────────────┴────────────────────────────┘ + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/zh/engines/table-engines/log-family/tinylog.md b/docs/zh/engines/table-engines/log-family/tinylog.md new file mode 100644 index 00000000000..bb67eaa67a5 --- /dev/null +++ b/docs/zh/engines/table-engines/log-family/tinylog.md @@ -0,0 +1,13 @@ +# TinyLog {#tinylog} + +最简单的表引擎,用于将数据存储在磁盘上。每列都存储在单独的压缩文件中。写入时,数据将附加到文件末尾。 + +并发数据访问不受任何限制: +- 如果同时从表中读取并在不同的查询中写入,则读取操作将抛出异常 +- 如果同时写入多个查询中的表,则数据将被破坏。 + +这种表引擎的典型用法是 write-once:首先只写入一次数据,然后根据需要多次读取。查询在单个流中执行。换句话说,此引擎适用于相对较小的表(建议最多1,000,000行)。如果您有许多小表,则使用此表引擎是适合的,因为它比Log引擎更简单(需要打开的文件更少)。当您拥有大量小表时,可能会导致性能低下,但在可能已经在其它 DBMS 时使用过,则您可能会发现切换使用 TinyLog 类型的表更容易。**不支持索引**。 + +在 Yandex.Metrica 中,TinyLog 表用于小批量处理的中间数据。 + +[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/tinylog/) diff --git a/docs/zh/engines/table-engines/mergetree-family/aggregatingmergetree.md b/docs/zh/engines/table-engines/mergetree-family/aggregatingmergetree.md new file mode 100644 index 00000000000..e931b6f6710 --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/aggregatingmergetree.md @@ -0,0 +1,94 @@ +# AggregatingMergeTree {#aggregatingmergetree} + +该引擎继承自 [MergeTree](mergetree.md),并改变了数据片段的合并逻辑。 ClickHouse 会将相同主键的所有行(在一个数据片段内)替换为单个存储一系列聚合函数状态的行。 + +可以使用 `AggregatingMergeTree` 表来做增量数据统计聚合,包括物化视图的数据聚合。 + +引擎需使用 [AggregateFunction](../../../engines/table-engines/mergetree-family/aggregatingmergetree.md) 类型来处理所有列。 + +如果要按一组规则来合并减少行数,则使用 `AggregatingMergeTree` 是合适的。 + +## 建表 {#jian-biao} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = AggregatingMergeTree() +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +语句参数的说明,请参阅 [语句描述](../../../engines/table-engines/mergetree-family/aggregatingmergetree.md)。 + +**子句** + +创建 `AggregatingMergeTree` 表时,需用跟创建 `MergeTree` 表一样的[子句](mergetree.md)。 + +
+ +已弃用的建表方法 + +!!! 注意 "注意" + 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) +``` + +上面的所有参数跟 `MergeTree` 中的一样。 +
+ +## SELECT 和 INSERT {#select-he-insert} + +插入数据,需使用带有聚合 -State- 函数的 [INSERT SELECT](../../../engines/table-engines/mergetree-family/aggregatingmergetree.md) 语句。 +从 `AggregatingMergeTree` 表中查询数据时,需使用 `GROUP BY` 子句并且要使用与插入时相同的聚合函数,但后缀要改为 `-Merge` 。 + +在 `SELECT` 查询的结果中,对于 ClickHouse 的所有输出格式 `AggregateFunction` 类型的值都实现了特定的二进制表示法。如果直接用 `SELECT` 导出这些数据,例如如用 `TabSeparated` 格式,那么这些导出数据也能直接用 `INSERT` 语句加载导入。 + +## 聚合物化视图的示例 {#ju-he-wu-hua-shi-tu-de-shi-li} + +创建一个跟踪 `test.visits` 表的 `AggregatingMergeTree` 物化视图: + +``` sql +CREATE MATERIALIZED VIEW test.basic +ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) +AS SELECT + CounterID, + StartDate, + sumState(Sign) AS Visits, + uniqState(UserID) AS Users +FROM test.visits +GROUP BY CounterID, StartDate; +``` + +向 `test.visits` 表中插入数据。 + +``` sql +INSERT INTO test.visits ... +``` + +数据会同时插入到表和视图中,并且视图 `test.basic` 会将里面的数据聚合。 + +要获取聚合数据,我们需要在 `test.basic` 视图上执行类似 `SELECT ... GROUP BY ...` 这样的查询 : + +``` sql +SELECT + StartDate, + sumMerge(Visits) AS Visits, + uniqMerge(Users) AS Users +FROM test.basic +GROUP BY StartDate +ORDER BY StartDate; +``` + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/zh/engines/table-engines/mergetree-family/collapsingmergetree.md b/docs/zh/engines/table-engines/mergetree-family/collapsingmergetree.md new file mode 100644 index 00000000000..6d1dfac7686 --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/collapsingmergetree.md @@ -0,0 +1,206 @@ +# 折叠树 {#table_engine-collapsingmergetree} + +该引擎继承于 [MergeTree](mergetree.md),并在数据块合并算法中添加了折叠行的逻辑。 + +`CollapsingMergeTree` 会异步的删除(折叠)这些除了特定列 `Sign` 有 `1` 和 `-1` 的值以外,其余所有字段的值都相等的成对的行。没有成对的行会被保留。更多的细节请看本文的[折叠](#table_engine-collapsingmergetree-collapsing)部分。 + +因此,该引擎可以显著的降低存储量并提高 `SELECT` 查询效率。 + +## 建表 {#jian-biao} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = CollapsingMergeTree(sign) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +请求参数的描述,参考[请求参数](../../../engines/table-engines/mergetree-family/collapsingmergetree.md)。 + +**CollapsingMergeTree 参数** + +- `sign` — 类型列的名称: `1` 是«状态»行,`-1` 是«取消»行。 + + 列数据类型 — `Int8`。 + +**子句** + +创建 `CollapsingMergeTree` 表时,需要与创建 `MergeTree` 表时相同的[子句](mergetree.md#table_engine-mergetree-creating-a-table)。 + +
+ +已弃用的建表方法 + +!!! attention "注意" + 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) +``` + +除了 `sign` 的所有参数都与 `MergeTree` 中的含义相同。 + +- `sign` — 类型列的名称: `1` 是«状态»行,`-1` 是«取消»行。 + + 列数据类型 — `Int8`。 + +
+ +## 折叠 {#table_engine-collapsingmergetree-collapsing} + +### 数据 {#shu-ju} + +考虑你需要为某个对象保存不断变化的数据的情景。似乎为一个对象保存一行记录并在其发生任何变化时更新记录是合乎逻辑的,但是更新操作对 DBMS 来说是昂贵且缓慢的,因为它需要重写存储中的数据。如果你需要快速的写入数据,则更新操作是不可接受的,但是你可以按下面的描述顺序地更新一个对象的变化。 + +在写入行的时候使用特定的列 `Sign`。如果 `Sign = 1` 则表示这一行是对象的状态,我们称之为«状态»行。如果 `Sign = -1` 则表示是对具有相同属性的状态行的取消,我们称之为«取消»行。 + +例如,我们想要计算用户在某个站点访问的页面页面数以及他们在那里停留的时间。在某个时候,我们将用户的活动状态写入下面这样的行。 + + ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ + │ 4324182021466249494 │ 5 │ 146 │ 1 │ + └─────────────────────┴───────────┴──────────┴──────┘ + +一段时间后,我们写入下面的两行来记录用户活动的变化。 + + ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ + │ 4324182021466249494 │ 5 │ 146 │ -1 │ + │ 4324182021466249494 │ 6 │ 185 │ 1 │ + └─────────────────────┴───────────┴──────────┴──────┘ + +第一行取消了这个对象(用户)的状态。它需要复制被取消的状态行的所有除了 `Sign` 的属性。 + +第二行包含了当前的状态。 + +因为我们只需要用户活动的最后状态,这些行 + + ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ + │ 4324182021466249494 │ 5 │ 146 │ 1 │ + │ 4324182021466249494 │ 5 │ 146 │ -1 │ + └─────────────────────┴───────────┴──────────┴──────┘ + +可以在折叠对象的失效(老的)状态的时候被删除。`CollapsingMergeTree` 会在合并数据片段的时候做这件事。 + +为什么我们每次改变需要 2 行可以阅读[算法](#table_engine-collapsingmergetree-collapsing-algorithm)段。 + +**这种方法的特殊属性** + +1. 写入的程序应该记住对象的状态从而可以取消它。«取消»字符串应该是«状态»字符串的复制,除了相反的 `Sign`。它增加了存储的初始数据的大小,但使得写入数据更快速。 +2. 由于写入的负载,列中长的增长阵列会降低引擎的效率。数据越简单,效率越高。 +3. `SELECT` 的结果很大程度取决于对象变更历史的一致性。在准备插入数据时要准确。在不一致的数据中会得到不可预料的结果,例如,像会话深度这种非负指标的负值。 + +### 算法 {#table_engine-collapsingmergetree-collapsing-algorithm} + +当 ClickHouse 合并数据片段时,每组具有相同主键的连续行被减少到不超过两行,一行 `Sign = 1`(«状态»行),另一行 `Sign = -1` («取消»行),换句话说,数据项被折叠了。 + +对每个结果的数据部分 ClickHouse 保存: + + 1. 第一个«取消»和最后一个«状态»行,如果«状态»和«取消»行的数量匹配和最后一个行是«状态»行 + 2. 最后一个«状态»行,如果«状态»行比«取消»行多一个或一个以上。 + 3. 第一个«取消»行,如果«取消»行比«状态»行多一个或一个以上。 + 4. 没有行,在其他所有情况下。 + + 合并会继续,但是 ClickHouse 会把此情况视为逻辑错误并将其记录在服务日志中。这个错误会在相同的数据被插入超过一次时出现。 + +因此,折叠不应该改变统计数据的结果。 +变化逐渐地被折叠,因此最终几乎每个对象都只剩下了最后的状态。 + +`Sign` 是必须的因为合并算法不保证所有有相同主键的行都会在同一个结果数据片段中,甚至是在同一台物理服务器上。ClickHouse 用多线程来处理 `SELECT` 请求,所以它不能预测结果中行的顺序。如果要从 `CollapsingMergeTree` 表中获取完全«折叠»后的数据,则需要聚合。 + +要完成折叠,请使用 `GROUP BY` 子句和用于处理符号的聚合函数编写请求。例如,要计算数量,使用 `sum(Sign)` 而不是 `count()`。要计算某物的总和,使用 `sum(Sign * x)` 而不是 `sum(x)`,并添加 `HAVING sum(Sign) > 0` 子句。 + +聚合体 `count`,`sum` 和 `avg` 可以用这种方式计算。如果一个对象至少有一个未被折叠的状态,则可以计算 `uniq` 聚合。`min` 和 `max` 聚合无法计算,因为 `CollaspingMergeTree` 不会保存折叠状态的值的历史记录。 + +如果你需要在不进行聚合的情况下获取数据(例如,要检查是否存在最新值与特定条件匹配的行),你可以在 `FROM` 从句中使用 `FINAL` 修饰符。这种方法显然是更低效的。 + +## 示例 {#shi-li} + +示例数据: + + ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ + │ 4324182021466249494 │ 5 │ 146 │ 1 │ + │ 4324182021466249494 │ 5 │ 146 │ -1 │ + │ 4324182021466249494 │ 6 │ 185 │ 1 │ + └─────────────────────┴───────────┴──────────┴──────┘ + +建表: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8 +) +ENGINE = CollapsingMergeTree(Sign) +ORDER BY UserID +``` + +插入数据: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) +``` + +我们使用两次 `INSERT` 请求来创建两个不同的数据片段。如果我们使用一个请求插入数据,ClickHouse 只会创建一个数据片段且不会执行任何合并操作。 + +获取数据: + + SELECT * FROM UAct + + ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ + │ 4324182021466249494 │ 5 │ 146 │ -1 │ + │ 4324182021466249494 │ 6 │ 185 │ 1 │ + └─────────────────────┴───────────┴──────────┴──────┘ + ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ + │ 4324182021466249494 │ 5 │ 146 │ 1 │ + └─────────────────────┴───────────┴──────────┴──────┘ + +我们看到了什么,哪里有折叠? + +通过两个 `INSERT` 请求,我们创建了两个数据片段。`SELECT` 请求在两个线程中被执行,我们得到了随机顺序的行。没有发生折叠是因为还没有合并数据片段。ClickHouse 在一个我们无法预料的未知时刻合并数据片段。 + +因此我们需要聚合: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration +FROM UAct +GROUP BY UserID +HAVING sum(Sign) > 0 +``` + + ┌──────────────UserID─┬─PageViews─┬─Duration─┐ + │ 4324182021466249494 │ 6 │ 185 │ + └─────────────────────┴───────────┴──────────┘ + +如果我们不需要聚合并想要强制进行折叠,我们可以在 `FROM` 从句中使用 `FINAL` 修饰语。 + +``` sql +SELECT * FROM UAct FINAL +``` + + ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ + │ 4324182021466249494 │ 6 │ 185 │ 1 │ + └─────────────────────┴───────────┴──────────┴──────┘ + +这种查询数据的方法是非常低效的。不要在大表中使用它。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) 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 new file mode 100644 index 00000000000..0fff14b77c0 --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/custom-partitioning-key.md @@ -0,0 +1,116 @@ +# 自定义分区键 {#zi-ding-yi-fen-qu-jian} + +[MergeTree](mergetree.md) 系列的表(包括 [可复制表](replication.md) )可以使用分区。基于 MergeTree 表的 [物化视图](../special/materializedview.md) 也支持分区。 + +一个分区是指按指定规则逻辑组合一起的表的记录集。可以按任意标准进行分区,如按月,按日或按事件类型。为了减少需要操作的数据,每个分区都是分开存储的。访问数据时,ClickHouse 尽量使用这些分区的最小子集。 + +分区是在 [建表](mergetree.md#table_engine-mergetree-creating-a-table) 的 `PARTITION BY expr` 子句中指定。分区键可以是关于列的任何表达式。例如,指定按月分区,表达式为 `toYYYYMM(date_column)`: + +``` sql +CREATE TABLE visits +( + VisitDate Date, + Hour UInt8, + ClientID UUID +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(VisitDate) +ORDER BY Hour; +``` + +分区键也可以是表达式元组(类似 [主键](mergetree.md#primary-keys-and-indexes-in-queries) )。例如: + +``` sql +ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) +PARTITION BY (toMonday(StartDate), EventType) +ORDER BY (CounterID, StartDate, intHash32(UserID)); +``` + +上例中,我们设置按一周内的事件类型分区。 + +新数据插入到表中时,这些数据会存储为按主键排序的新片段(块)。插入后 10-15 分钟,同一分区的各个片段会合并为一整个片段。 + +!!! attention "注意" + 那些有相同分区表达式值的数据片段才会合并。这意味着 **你不应该用太精细的分区方案**(超过一千个分区)。否则,会因为文件系统中的文件数量和需要找开的文件描述符过多,导致 `SELECT` 查询效率不佳。 + +可以通过 [系统。零件](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#system_tables-parts) 表查看表片段和分区信息。例如,假设我们有一个 `visits` 表,按月分区。对 `system.parts` 表执行 `SELECT`: + +``` sql +SELECT + partition, + name, + active +FROM system.parts +WHERE table = 'visits' +``` + + ┌─partition─┬─name───────────┬─active─┐ + │ 201901 │ 201901_1_3_1 │ 0 │ + │ 201901 │ 201901_1_9_2 │ 1 │ + │ 201901 │ 201901_8_8_0 │ 0 │ + │ 201901 │ 201901_9_9_0 │ 0 │ + │ 201902 │ 201902_4_6_1 │ 1 │ + │ 201902 │ 201902_10_10_0 │ 1 │ + │ 201902 │ 201902_11_11_0 │ 1 │ + └───────────┴────────────────┴────────┘ + +`partition` 列存储分区的名称。此示例中有两个分区:`201901` 和 `201902`。在 [ALTER … PARTITION](#alter_manipulations-with-partitions) 语句中你可以使用该列值来指定分区名称。 + +`name` 列为分区中数据片段的名称。在 [ALTER ATTACH PART](#alter_attach-partition) 语句中你可以使用此列值中来指定片段名称。 + +这里我们拆解下第一部分的名称:`201901_1_3_1`: + +- `201901` 是分区名称。 +- `1` 是数据块的最小编号。 +- `3` 是数据块的最大编号。 +- `1` 是块级别(即在由块组成的合并树中,该块在树中的深度)。 + +!!! attention "注意" + 旧类型表的片段名称为:`20190117_20190123_2_2_0`(最小日期 - 最大日期 - 最小块编号 - 最大块编号 - 块级别)。 + +`active` 列为片段状态。`1` 激活状态;`0` 非激活状态。非激活片段是那些在合并到较大片段之后剩余的源数据片段。损坏的数据片段也表示为非活动状态。 + +正如在示例中所看到的,同一分区中有几个独立的片段(例如,`201901_1_3_1`和`201901_1_9_2`)。这意味着这些片段尚未合并。ClickHouse 大约在插入后15分钟定期报告合并操作,合并插入的数据片段。此外,你也可以使用 [OPTIMIZE](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#misc_operations-optimize) 语句直接执行合并。例: + +``` sql +OPTIMIZE TABLE visits PARTITION 201902; +``` + + ┌─partition─┬─name───────────┬─active─┐ + │ 201901 │ 201901_1_3_1 │ 0 │ + │ 201901 │ 201901_1_9_2 │ 1 │ + │ 201901 │ 201901_8_8_0 │ 0 │ + │ 201901 │ 201901_9_9_0 │ 0 │ + │ 201902 │ 201902_4_6_1 │ 0 │ + │ 201902 │ 201902_4_11_2 │ 1 │ + │ 201902 │ 201902_10_10_0 │ 0 │ + │ 201902 │ 201902_11_11_0 │ 0 │ + └───────────┴────────────────┴────────┘ + +非激活片段会在合并后的10分钟左右删除。 + +查看片段和分区信息的另一种方法是进入表的目录:`/var/lib/clickhouse/data///`。例如: + +``` bash +dev:/var/lib/clickhouse/data/default/visits$ ls -l +total 40 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 +drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached +``` + +文件夹 ‘201901\_1\_1\_0’,‘201901\_1\_7\_1’ 等是片段的目录。每个片段都与一个对应的分区相关,并且只包含这个月的数据(本例中的表按月分区)。 + +`detached` 目录存放着使用 [DETACH](#alter_detach-partition) 语句从表中分离的片段。损坏的片段也会移到该目录,而不是删除。服务器不使用`detached`目录中的片段。可以随时添加,删除或修改此目录中的数据 – 在运行 [ATTACH](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#alter_attach-partition) 语句前,服务器不会感知到。 + +注意,在操作服务器时,你不能手动更改文件系统上的片段集或其数据,因为服务器不会感知到这些修改。对于非复制表,可以在服务器停止时执行这些操作,但不建议这样做。对于复制表,在任何情况下都不要更改片段文件。 + +ClickHouse 支持对分区执行这些操作:删除分区,从一个表复制到另一个表,或创建备份。了解分区的所有操作,请参阅 [分区和片段的操作](../../../engines/table-engines/mergetree-family/custom-partitioning-key.md#alter_manipulations-with-partitions) 一节。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/zh/engines/table-engines/mergetree-family/graphitemergetree.md b/docs/zh/engines/table-engines/mergetree-family/graphitemergetree.md new file mode 100644 index 00000000000..ef6e4fdb939 --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/graphitemergetree.md @@ -0,0 +1,174 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 38 +toc_title: GraphiteMergeTree +--- + +# GraphiteMergeTree {#graphitemergetree} + +此引擎专为细化和聚合/平均(rollup) [石墨](http://graphite.readthedocs.io/en/latest/index.html) 戴达 对于想要使用ClickHouse作为Graphite的数据存储的开发人员来说,这可能会有所帮助。 + +您可以使用任何ClickHouse表引擎来存储石墨数据,如果你不需要汇总,但如果你需要一个汇总使用 `GraphiteMergeTree`. 该引擎减少了存储量,并提高了Graphite查询的效率。 + +引擎继承从属性 [MergeTree](mergetree.md). + +## 创建表 {#creating-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE = GraphiteMergeTree(config_section) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +请参阅的详细说明 [CREATE TABLE](../../../sql-reference/statements/create.md#create-table-query) 查询。 + +Graphite数据的表应具有以下数据的列: + +- 公制名称(石墨传感器)。 数据类型: `String`. + +- 测量度量的时间。 数据类型: `DateTime`. + +- 度量值。 数据类型:任何数字。 + +- 指标的版本。 数据类型:任何数字。 + + 如果版本相同,ClickHouse会保存版本最高或最后写入的行。 其他行在数据部分合并期间被删除。 + +应在汇总配置中设置这些列的名称。 + +**GraphiteMergeTree参数** + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +**查询子句** + +当创建一个 `GraphiteMergeTree` 表,相同 [条款](mergetree.md#table_engine-mergetree-creating-a-table) 是必需的,因为当创建 `MergeTree` 桌子 + +
+ +不推荐使用的创建表的方法 + +!!! attention "注意" + 不要在新项目中使用此方法,如果可能的话,请将旧项目切换到上述方法。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + EventDate Date, + Path String, + Time DateTime, + Value , + Version + ... +) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) +``` + +所有参数除外 `config_section` 具有相同的含义 `MergeTree`. + +- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. + +
+ +## 汇总配置 {#rollup-configuration} + +汇总的设置由 [graphite\_rollup](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) 服务器配置中的参数。 参数的名称可以是any。 您可以创建多个配置并将它们用于不同的表。 + +汇总配置结构: + + required-columns + patterns + +### 必填列 {#required-columns} + +- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. +- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. +- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. 默认值: `Value`. +- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. + +### 模式 {#patterns} + +的结构 `patterns` 科: + +``` text +pattern + regexp + function +pattern + regexp + age + precision + ... +pattern + regexp + function + age + precision + ... +pattern + ... +default + function + age + precision + ... +``` + +!!! warning "注意" + 模式必须严格排序: + + 1. Patterns without `function` or `retention`. + 1. Patterns with both `function` and `retention`. + 1. Pattern `default`. + +在处理行时,ClickHouse会检查以下内容中的规则 `pattern` 部分。 每个 `pattern` (包括 `default`)部分可以包含 `function` 聚合参数, `retention` 参数或两者兼而有之。 如果指标名称匹配 `regexp`,从规则 `pattern` 部分(sections节)的应用;否则,从规则 `default` 部分被使用。 + +字段为 `pattern` 和 `default` 科: + +- `regexp`– A pattern for the metric name. +- `age` – The minimum age of the data in seconds. +- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). +- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. + +### 配置示例 {#configuration-example} + +``` xml + + Version + + click_cost + any + + 0 + 5 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/zh/engines/table_engines/mergetree_family/index.md b/docs/zh/engines/table-engines/mergetree-family/index.md similarity index 100% rename from docs/zh/engines/table_engines/mergetree_family/index.md rename to docs/zh/engines/table-engines/mergetree-family/index.md diff --git a/docs/zh/engines/table-engines/mergetree-family/mergetree.md b/docs/zh/engines/table-engines/mergetree-family/mergetree.md new file mode 100644 index 00000000000..265dd44f94f --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/mergetree.md @@ -0,0 +1,394 @@ +# MergeTree {#table_engines-mergetree} + +Clickhouse 中最强大的表引擎当属 `MergeTree` (合并树)引擎及该系列(`*MergeTree`)中的其他引擎。 + +`MergeTree` 引擎系列的基本理念如下。当你有巨量数据要插入到表中,你要高效地一批批写入数据片段,并希望这些数据片段在后台按照一定规则合并。相比在插入时不断修改(重写)数据进存储,这种策略会高效很多。 + +主要特点: + +- 存储的数据按主键排序。 + + 这让你可以创建一个用于快速检索数据的小稀疏索引。 + +- 允许使用分区,如果指定了 [分区键](custom-partitioning-key.md) 的话。 + + 在相同数据集和相同结果集的情况下 ClickHouse 中某些带分区的操作会比普通操作更快。查询中指定了分区键时 ClickHouse 会自动截取分区数据。这也有效增加了查询性能。 + +- 支持数据副本。 + + `ReplicatedMergeTree` 系列的表便是用于此。更多信息,请参阅 [数据副本](replication.md) 一节。 + +- 支持数据采样。 + + 需要的话,你可以给表设置一个采样方法。 + +!!! 注意 "注意" + [合并](../special/merge.md) 引擎并不属于 `*MergeTree` 系列。 + +## 建表 {#table_engine-mergetree-creating-a-table} + + CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] + ( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... + INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, + INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 + ) ENGINE = MergeTree() + [PARTITION BY expr] + [ORDER BY expr] + [PRIMARY KEY expr] + [SAMPLE BY expr] + [SETTINGS name=value, ...] + +请求参数的描述,参考 [请求描述](../../../engines/table-engines/mergetree-family/mergetree.md) 。 + + + +**子句** + +- `ENGINE` - 引擎名和参数。 `ENGINE = MergeTree()`. `MergeTree` 引擎没有参数。 + +- `PARTITION BY` — [分区键](custom-partitioning-key.md) 。 + + 要按月分区,可以使用表达式 `toYYYYMM(date_column)` ,这里的 `date_column` 是一个 [Date](../../../engines/table_engines/mergetree_family/mergetree.md) 类型的列。这里该分区名格式会是 `"YYYYMM"` 这样。 + +- `ORDER BY` — 表的排序键。 + + 可以是一组列的元组或任意的表达式。 例如: `ORDER BY (CounterID, EventDate)` 。 + +- `PRIMARY KEY` - 主键,如果要设成 [跟排序键不相同](#xuan-ze-gen-pai-xu-jian-bu-yi-yang-zhu-jian)。 + + 默认情况下主键跟排序键(由 `ORDER BY` 子句指定)相同。 + 因此,大部分情况下不需要再专门指定一个 `PRIMARY KEY` 子句。 + +- `SAMPLE BY` — 用于抽样的表达式。 + + 如果要用抽样表达式,主键中必须包含这个表达式。例如: + `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))` 。 + +- `SETTINGS` — 影响 `MergeTree` 性能的额外参数: + + - `index_granularity` — 索引粒度。即索引中相邻『标记』间的数据行数。默认值,8192 。该列表中所有可用的参数可以从这里查看 [MergeTreeSettings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Storages/MergeTree/MergeTreeSettings.h) 。 + - `index_granularity_bytes` — 索引粒度,以字节为单位,默认值: 10Mb。如果仅按数据行数限制索引粒度, 请设置为0(不建议)。 + - `enable_mixed_granularity_parts` — 启用或禁用通过 `index_granularity_bytes` 控制索引粒度的大小。在19.11版本之前, 只有 `index_granularity` 配置能够用于限制索引粒度的大小。当从大表(数十或数百兆)中查询数据时候,`index_granularity_bytes` 配置能够提升ClickHouse的性能。如果你的表内数据量很大,可以开启这项配置用以提升`SELECT` 查询的性能。 + - `use_minimalistic_part_header_in_zookeeper` — 数据片段头在 ZooKeeper 中的存储方式。如果设置了 `use_minimalistic_part_header_in_zookeeper=1` ,ZooKeeper 会存储更少的数据。更多信息参考『服务配置参数』这章中的 [设置描述](../../../operations/server-configuration-parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) 。 + - `min_merge_bytes_to_use_direct_io` — 使用直接 I/O 来操作磁盘的合并操作时要求的最小数据量。合并数据片段时,ClickHouse 会计算要被合并的所有数据的总存储空间。如果大小超过了 `min_merge_bytes_to_use_direct_io` 设置的字节数,则 ClickHouse 将使用直接 I/O 接口(`O_DIRECT` 选项)对磁盘读写。如果设置 `min_merge_bytes_to_use_direct_io = 0` ,则会禁用直接 I/O。默认值:`10 * 1024 * 1024 * 1024` 字节。 + + - `merge_with_ttl_timeout` — TTL合并频率的最小间隔时间。默认值: 86400 (1 天)。 + - `write_final_mark` — 启用或禁用在数据片段尾部写入最终索引标记。默认值: 1(不建议更改)。 + - `storage_policy` — 存储策略。 参见 [使用多个区块装置进行数据存储](#table_engine-mergetree-multiple-volumes). + +**示例配置** + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 + +示例中,我们设为按月分区。 + +同时我们设置了一个按用户ID哈希的抽样表达式。这让你可以有该表中每个 `CounterID` 和 `EventDate` 下面的数据的伪随机分布。如果你在查询时指定了 [SAMPLE](../../../engines/table-engines/mergetree-family/mergetree.md#select-sample-clause) 子句。 ClickHouse会返回对于用户子集的一个均匀的伪随机数据采样。 + +`index_granularity` 可省略,默认值为 8192 。 + +
+ +已弃用的建表方法 + +!!! attention "注意" + 不要在新版项目中使用该方法,可能的话,请将旧项目切换到上述方法。 + + CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] + ( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... + ) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) + +**MergeTree() 参数** + +- `date-column` — 类型为 [日期](../../../engines/table-engines/mergetree-family/mergetree.md) 的列名。ClickHouse 会自动依据这个列按月创建分区。分区名格式为 `"YYYYMM"` 。 +- `sampling_expression` — 采样表达式。 +- `(primary, key)` — 主键。类型 — [元组()](../../../engines/table-engines/mergetree-family/mergetree.md) +- `index_granularity` — 索引粒度。即索引中相邻『标记』间的数据行数。设为 8192 可以适用大部分场景。 + +**示例** + + MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) + +对于主要的配置方法,这里 `MergeTree` 引擎跟前面的例子一样,可以以同样的方式配置。 +
+ +## 数据存储 {#mergetree-data-storage} + +表由按主键排序的数据 *片段* 组成。 + +当数据被插入到表中时,会分成数据片段并按主键的字典序排序。例如,主键是 `(CounterID, Date)` 时,片段中数据按 `CounterID` 排序,具有相同 `CounterID` 的部分按 `Date` 排序。 + +不同分区的数据会被分成不同的片段,ClickHouse 在后台合并数据片段以便更高效存储。不会合并来自不同分区的数据片段。这个合并机制并不保证相同主键的所有行都会合并到同一个数据片段中。 + +ClickHouse 会为每个数据片段创建一个索引文件,索引文件包含每个索引行(『标记』)的主键值。索引行号定义为 `n * index_granularity` 。最大的 `n` 等于总行数除以 `index_granularity` 的值的整数部分。对于每列,跟主键相同的索引行处也会写入『标记』。这些『标记』让你可以直接找到数据所在的列。 + +你可以只用一单一大表并不断地一块块往里面加入数据 – `MergeTree` 引擎的就是为了这样的场景。 + +## 主键和索引在查询中的表现 {#primary-keys-and-indexes-in-queries} + +我们以 `(CounterID, Date)` 以主键。排序好的索引的图示会是下面这样: + + 全部数据 : [-------------------------------------------------------------------------] + CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] + Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] + 标记: | | | | | | | | | | | + a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 + 标记号: 0 1 2 3 4 5 6 7 8 9 10 + +如果指定查询如下: + +- `CounterID in ('a', 'h')`,服务器会读取标记号在 `[0, 3)` 和 `[6, 8)` 区间中的数据。 +- `CounterID IN ('a', 'h') AND Date = 3`,服务器会读取标记号在 `[1, 3)` 和 `[7, 8)` 区间中的数据。 +- `Date = 3`,服务器会读取标记号在 `[1, 10]` 区间中的数据。 + +上面例子可以看出使用索引通常会比全表描述要高效。 + +稀疏索引会引起额外的数据读取。当读取主键单个区间范围的数据时,每个数据块中最多会多读 `index_granularity * 2` 行额外的数据。大部分情况下,当 `index_granularity = 8192` 时,ClickHouse的性能并不会降级。 + +稀疏索引让你能操作有巨量行的表。因为这些索引是常驻内存(RAM)的。 + +ClickHouse 不要求主键惟一。所以,你可以插入多条具有相同主键的行。 + +### 主键的选择 {#zhu-jian-de-xuan-ze} + +主键中列的数量并没有明确的限制。依据数据结构,你应该让主键包含多些或少些列。这样可以: + +- 改善索引的性能。 + + 如果当前主键是 `(a, b)` ,然后加入另一个 `c` 列,满足下面条件时,则可以改善性能: + - 有带有 `c` 列条件的查询。 + - 很长的数据范围( `index_granularity` 的数倍)里 `(a, b)` 都是相同的值,并且这种的情况很普遍。换言之,就是加入另一列后,可以让你的查询略过很长的数据范围。 + +- 改善数据压缩。 + + ClickHouse 以主键排序片段数据,所以,数据的一致性越高,压缩越好。 + +- [折叠树](collapsingmergetree.md#table_engine-collapsingmergetree) 和 [SummingMergeTree](summingmergetree.md) 引擎里,数据合并时,会有额外的处理逻辑。 + + 在这种情况下,指定一个跟主键不同的 *排序键* 也是有意义的。 + +长的主键会对插入性能和内存消耗有负面影响,但主键中额外的列并不影响 `SELECT` 查询的性能。 + +### 选择跟排序键不一样主键 {#xuan-ze-gen-pai-xu-jian-bu-yi-yang-zhu-jian} + +指定一个跟排序键(用于排序数据片段中行的表达式) +不一样的主键(用于计算写到索引文件的每个标记值的表达式)是可以的。 +这种情况下,主键表达式元组必须是排序键表达式元组的一个前缀。 + +当使用 [SummingMergeTree](summingmergetree.md) 和 +[AggregatingMergeTree](aggregatingmergetree.md) 引擎时,这个特性非常有用。 +通常,使用这类引擎时,表里列分两种:*维度* 和 *度量* 。 +典型的查询是在 `GROUP BY` 并过虑维度的情况下统计度量列的值。 +像 SummingMergeTree 和 AggregatingMergeTree ,用相同的排序键值统计行时, +通常会加上所有的维度。结果就是,这键的表达式会是一长串的列组成, +并且这组列还会因为新加维度必须频繁更新。 + +这种情况下,主键中仅预留少量列保证高效范围扫描, +剩下的维度列放到排序键元组里。这样是合理的。 + +[排序键的修改](../../../engines/table-engines/mergetree-family/mergetree.md) 是轻量级的操作,因为一个新列同时被加入到表里和排序键后时,已存在的数据片段并不需要修改。由于旧的排序键是新排序键的前缀,并且刚刚添加的列中没有数据,因此在表修改时的数据对于新旧的排序键来说都是有序的。 + +### 索引和分区在查询中的应用 {#suo-yin-he-fen-qu-zai-cha-xun-zhong-de-ying-yong} + +对于 `SELECT` 查询,ClickHouse 分析是否可以使用索引。如果 `WHERE/PREWHERE` 子句具有下面这些表达式(作为谓词链接一子项或整个)则可以使用索引:基于主键或分区键的列或表达式的部分的等式或比较运算表达式;基于主键或分区键的列或表达式的固定前缀的 `IN` 或 `LIKE` 表达式;基于主键或分区键的列的某些函数;基于主键或分区键的表达式的逻辑表达式。 + +因此,在索引键的一个或多个区间上快速地跑查询都是可能的。下面例子中,指定标签;指定标签和日期范围;指定标签和日期;指定多个标签和日期范围等运行查询,都会非常快。 + +当引擎配置如下时: + + ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 + +这种情况下,这些查询: + +``` sql +SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 +SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) +SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) +``` + +ClickHouse 会依据主键索引剪掉不符合的数据,依据按月分区的分区键剪掉那些不包含符合数据的分区。 + +上文的查询显示,即使索引用于复杂表达式。因为读表操作是组织好的,所以,使用索引不会比完整扫描慢。 + +下面这个例子中,不会使用索引。 + +``` sql +SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' +``` + +要检查 ClickHouse 执行一个查询时能否使用索引,可设置 [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) 和 [force\_primary\_key](../../../operations/settings/settings.md) 。 + +按月分区的分区键是只能读取包含适当范围日期的数据块。这种情况下,数据块会包含很多天(最多整月)的数据。在块中,数据按主键排序,主键第一列可能不包含日期。因此,仅使用日期而没有带主键前缀条件的查询将会导致读取超过这个日期范围。 + +### 跳数索引(分段汇总索引,实验性的) {#tiao-shu-suo-yin-fen-duan-hui-zong-suo-yin-shi-yan-xing-de} + +需要设置 `allow_experimental_data_skipping_indices` 为 1 才能使用此索引。(执行 `SET allow_experimental_data_skipping_indices = 1`)。 + +此索引在 `CREATE` 语句的列部分里定义。 + +``` sql +INDEX index_name expr TYPE type(...) GRANULARITY granularity_value +``` + +`*MergeTree` 系列的表都能指定跳数索引。 + +这些索引是由数据块按粒度分割后的每部分在指定表达式上汇总信息 `granularity_value` 组成(粒度大小用表引擎里 `index_granularity` 的指定)。 +这些汇总信息有助于用 `where` 语句跳过大片不满足的数据,从而减少 `SELECT` 查询从磁盘读取的数据量, + +示例 + +``` sql +CREATE TABLE table_name +( + u64 UInt64, + i32 Int32, + s String, + ... + INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, + INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 +) ENGINE = MergeTree() +... +``` + +上例中的索引能让 ClickHouse 执行下面这些查询时减少读取数据量。 + +``` sql +SELECT count() FROM table WHERE s < 'z' +SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 +``` + +#### 索引的可用类型 {#table_engine-mergetree-data_skipping-indexes} + +- `minmax` + 存储指定表达式的极值(如果表达式是 `tuple` ,则存储 `tuple` 中每个元素的极值),这些信息用于跳过数据块,类似主键。 + +- `set(max_rows)` + 存储指定表达式的惟一值(不超过 `max_rows` 个,`max_rows=0` 则表示『无限制』)。这些信息可用于检查 `WHERE` 表达式是否满足某个数据块。 + +- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + 存储包含数据块中所有 n 元短语的 [布隆过滤器](https://en.wikipedia.org/wiki/Bloom_filter) 。只可用在字符串上。 + 可用于优化 `equals` , `like` 和 `in` 表达式的性能。 + `n` – 短语长度。 + `size_of_bloom_filter_in_bytes` – 布隆过滤器大小,单位字节。(因为压缩得好,可以指定比较大的值,如256或512)。 + `number_of_hash_functions` – 布隆过滤器中使用的 hash 函数的个数。 + `random_seed` – hash 函数的随机种子。 + +- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` + 跟 `ngrambf_v1` 类似,不同于 ngrams 存储字符串指定长度的所有片段。它只存储被非字母数据字符分割的片段。 + + + +``` sql +INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 +INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 +INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 +``` + +## 并发数据访问 {#bing-fa-shu-ju-fang-wen} + +应对表的并发访问,我们使用多版本机制。换言之,当同时读和更新表时,数据从当前查询到的一组片段中读取。没有冗长的的锁。插入不会阻碍读取。 + +对表的读操作是自动并行的。 + +## 列和表的TTL {#table_engine-mergetree-ttl} + +TTL可以设置值的生命周期,它既可以为整张表设置,也可以为每个列字段单独设置。如果`TTL`同时作用于表和字段,ClickHouse会使用先到期的那个。 + +被设置TTL的表,必须拥有[日期](../../../engines/table-engines/mergetree-family/mergetree.md) 或 [日期时间](../../../engines/table-engines/mergetree-family/mergetree.md) 类型的字段。要定义数据的生命周期,需要在这个日期字段上使用操作符,例如: + +``` sql +TTL time_column +TTL time_column + interval +``` + +要定义`interval`, 需要使用 [时间间隔](../../../engines/table-engines/mergetree-family/mergetree.md#operators-datetime) 操作符。 + +``` sql +TTL date_time + INTERVAL 1 MONTH +TTL date_time + INTERVAL 15 HOUR +``` + +### 列字段 TTL {#mergetree-column-ttl} + +当列字段中的值过期时, ClickHouse会将它们替换成数据类型的默认值。如果分区内,某一列的所有值均已过期,则ClickHouse会从文件系统中删除这个分区目录下的列文件。 + +`TTL`子句不能被用于主键字段。 + +示例说明: + +创建一张包含 `TTL` 的表 + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int TTL d + INTERVAL 1 MONTH, + b Int TTL d + INTERVAL 1 MONTH, + c String +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d; +``` + +为表中已存在的列字段添加 `TTL` + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 DAY; +``` + +修改列字段的 `TTL` + +``` sql +ALTER TABLE example_table + MODIFY COLUMN + c String TTL d + INTERVAL 1 MONTH; +``` + +### 表 TTL {#mergetree-table-ttl} + +当表内的数据过期时, ClickHouse会删除所有对应的行。 + +举例说明: + +创建一张包含 `TTL` 的表 + +``` sql +CREATE TABLE example_table +( + d DateTime, + a Int +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(d) +ORDER BY d +TTL d + INTERVAL 1 MONTH; +``` + +修改表的 `TTL` + +``` sql +ALTER TABLE example_table + MODIFY TTL d + INTERVAL 1 DAY; +``` + +**删除数据** + +当ClickHouse合并数据分区时, 会删除TTL过期的数据。 + +当ClickHouse发现数据过期时, 它将会执行一个计划外的合并。要控制这类合并的频率, 你可以设置 [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout)。如果该值被设置的太低, 它将导致执行许多的计划外合并,这可能会消耗大量资源。 + +如果在合并的时候执行`SELECT` 查询, 则可能会得到过期的数据。为了避免这种情况,可以在`SELECT`之前使用 [OPTIMIZE](../../../engines/table-engines/mergetree-family/mergetree.md#misc_operations-optimize) 查询。 + +## 使用多个块设备进行数据存储 {#table_engine-mergetree-multiple-volumes} + +### 配置 {#table_engine-mergetree-multiple-volumes-configure} + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/mergetree/) diff --git a/docs/zh/engines/table-engines/mergetree-family/replacingmergetree.md b/docs/zh/engines/table-engines/mergetree-family/replacingmergetree.md new file mode 100644 index 00000000000..8cf1ab8af57 --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/replacingmergetree.md @@ -0,0 +1,60 @@ +# 更换麦树 {#replacingmergetree} + +该引擎和[MergeTree](mergetree.md)的不同之处在于它会删除具有相同主键的重复项。 + +数据的去重只会在合并的过程中出现。合并会在未知的时间在后台进行,因此你无法预先作出计划。有一些数据可能仍未被处理。尽管你可以调用 `OPTIMIZE` 语句发起计划外的合并,但请不要指望使用它,因为 `OPTIMIZE` 语句会引发对大量数据的读和写。 + +因此,`ReplacingMergeTree` 适用于在后台清除重复的数据以节省空间,但是它不保证没有重复的数据出现。 + +## 建表 {#jian-biao} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = ReplacingMergeTree([ver]) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +请求参数的描述,参考[请求参数](../../../engines/table-engines/mergetree-family/replacingmergetree.md)。 + +**替换树参数** + +- `ver` — 版本列。类型为 `UInt*`, `Date` 或 `DateTime`。可选参数。 + + 合并的时候,`ReplacingMergeTree` 从所有具有相同主键的行中选择一行留下: + - 如果 `ver` 列未指定,选择最后一条。 + - 如果 `ver` 列已指定,选择 `ver` 值最大的版本。 + +**子句** + +创建 `ReplacingMergeTree` 表时,需要与创建 `MergeTree` 表时相同的[子句](mergetree.md)。 + +
+ +已弃用的建表方法 + +!!! attention "注意" + 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) +``` + +除了 `ver` 的所有参数都与 `MergeTree` 中的含义相同。 + +- `ver` - 版本列。可选参数,有关说明,请参阅上文。 + +
+ +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/zh/engines/table-engines/mergetree-family/replication.md b/docs/zh/engines/table-engines/mergetree-family/replication.md new file mode 100644 index 00000000000..cc327bcadf5 --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/replication.md @@ -0,0 +1,202 @@ +# 数据副本 {#table_engines-replication} + +只有 MergeTree 系列里的表可支持副本: + +- ReplicatedMergeTree +- ReplicatedSummingMergeTree +- ReplicatedReplacingMergeTree +- ReplicatedAggregatingMergeTree +- ReplicatedCollapsingMergeTree +- ReplicatedVersionedCollapsingMergetree +- ReplicatedGraphiteMergeTree + +副本是表级别的,不是整个服务器级的。所以,服务器里可以同时有复制表和非复制表。 + +副本不依赖分片。每个分片有它自己的独立副本。 + +对于 `INSERT` 和 `ALTER` 语句操作数据的会在压缩的情况下被复制(更多信息,看 [ALTER](../../../engines/table-engines/mergetree-family/replication.md#query_language_queries_alter) )。 + +而 `CREATE`,`DROP`,`ATTACH`,`DETACH` 和 `RENAME` 语句只会在单个服务器上执行,不会被复制。 + +- `The CREATE TABLE` 在运行此语句的服务器上创建一个新的可复制表。如果此表已存在其他服务器上,则给该表添加新副本。 +- `The DROP TABLE` 删除运行此查询的服务器上的副本。 +- `The RENAME` 重命名一个副本。换句话说,可复制表不同的副本可以有不同的名称。 + +要使用副本,需在配置文件中设置 ZooKeeper 集群的地址。例如: + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + + example3 + 2181 + + +``` + +需要 ZooKeeper 3.4.5 或更高版本。 + +你可以配置任何现有的 ZooKeeper 集群,系统会使用里面的目录来存取元数据(该目录在创建可复制表时指定)。 + +如果配置文件中没有设置 ZooKeeper ,则无法创建复制表,并且任何现有的复制表都将变为只读。 + +`SELECT` 查询并不需要借助 ZooKeeper ,复本并不影响 `SELECT` 的性能,查询复制表与非复制表速度是一样的。查询分布式表时,ClickHouse的处理方式可通过设置 [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) 和 [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md) 修改。 + +对于每个 `INSERT` 语句,会通过几个事务将十来个记录添加到 ZooKeeper。(确切地说,这是针对每个插入的数据块; 每个 INSERT 语句的每 `max_insert_block_size = 1048576` 行和最后剩余的都各算作一个块。)相比非复制表,写 zk 会导致 `INSERT` 的延迟略长一些。但只要你按照建议每秒不超过一个 `INSERT` 地批量插入数据,不会有任何问题。一个 ZooKeeper 集群能给整个 ClickHouse 集群支撑协调每秒几百个 `INSERT`。数据插入的吞吐量(每秒的行数)可以跟不用复制的数据一样高。 + +对于非常大的集群,你可以把不同的 ZooKeeper 集群用于不同的分片。然而,即使 Yandex.Metrica 集群(大约300台服务器)也证明还不需要这么做。 + +复制是多主异步。 `INSERT` 语句(以及 `ALTER` )可以发给任意可用的服务器。数据会先插入到执行该语句的服务器上,然后被复制到其他服务器。由于它是异步的,在其他副本上最近插入的数据会有一些延迟。如果部分副本不可用,则数据在其可用时再写入。副本可用的情况下,则延迟时长是通过网络传输压缩数据块所需的时间。 + +默认情况下,INSERT 语句仅等待一个副本写入成功后返回。如果数据只成功写入一个副本后该副本所在的服务器不再存在,则存储的数据会丢失。要启用数据写入多个副本才确认返回,使用 `insert_quorum` 选项。 + +单个数据块写入是原子的。 INSERT 的数据按每块最多 `max_insert_block_size = 1048576` 行进行分块,换句话说,如果 `INSERT` 插入的行少于 1048576,则该 INSERT 是原子的。 + +数据块会去重。对于被多次写的相同数据块(大小相同且具有相同顺序的相同行的数据块),该块仅会写入一次。这样设计的原因是万一在网络故障时客户端应用程序不知道数据是否成功写入DB,此时可以简单地重复 `INSERT` 。把相同的数据发送给多个副本 INSERT 并不会有问题。因为这些 `INSERT` 是完全相同的(会被去重)。去重参数参看服务器设置 [merge\_tree](../../../operations/server-configuration-parameters/settings.md) 。(注意:Replicated\*MergeTree 才会去重,不需要 zookeeper 的不带 MergeTree 不会去重) + +在复制期间,只有要插入的源数据通过网络传输。进一步的数据转换(合并)会在所有副本上以相同的方式进行处理执行。这样可以最大限度地减少网络使用,这意味着即使副本在不同的数据中心,数据同步也能工作良好。(能在不同数据中心中的同步数据是副本机制的主要目标。) + +你可以给数据做任意多的副本。Yandex.Metrica 在生产中使用双副本。某一些情况下,给每台服务器都使用 RAID-5 或 RAID-6 和 RAID-10。是一种相对可靠和方便的解决方案。 + +系统会监视副本数据同步情况,并能在发生故障后恢复。故障转移是自动的(对于小的数据差异)或半自动的(当数据差异很大时,这可能意味是有配置错误)。 + +## 创建复制表 {#creating-replicated-tables} + +在表引擎名称上加上 `Replicated` 前缀。例如:`ReplicatedMergeTree`。 + +**Replicated\*MergeTree 参数** + +- `zoo_path` — ZooKeeper 中该表的路径。 +- `replica_name` — ZooKeeper 中的该表的副本名称。 + +示例: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +``` + +已弃用的建表语法示例: + +``` sql +CREATE TABLE table_name +( + EventDate DateTime, + CounterID UInt32, + UserID UInt32 +) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) +``` + +如上例所示,这些参数可以包含宏替换的占位符,即大括号的部分。它们会被替换为配置文件里 ‘macros’ 那部分配置的值。示例: + +``` xml + + 05 + 02 + example05-02-1.yandex.ru + +``` + +«ZooKeeper 中该表的路径»对每个可复制表都要是唯一的。不同分片上的表要有不同的路径。 +这种情况下,路径包含下面这些部分: + +`/clickhouse/tables/` 是公共前缀,我们推荐使用这个。 + +`{layer}-{shard}` 是分片标识部分。在此示例中,由于 Yandex.Metrica 集群使用了两级分片,所以它是由两部分组成的。但对于大多数情况来说,你只需保留 {shard} 占位符即可,它会替换展开为分片标识。 + +`table_name` 是该表在 ZooKeeper 中的名称。使其与 ClickHouse 中的表名相同比较好。 这里它被明确定义,跟 ClickHouse 表名不一样,它并不会被 RENAME 语句修改。 +*HINT*:你可以在前面添加一个数据库名称 `table_name` 也是 例如。 `db_name.table_name` + +副本名称用于标识同一个表分片的不同副本。你可以使用服务器名称,如上例所示。同个分片中不同副本的副本名称要唯一。 + +你也可以显式指定这些参数,而不是使用宏替换。对于测试和配置小型集群这可能会很方便。但是,这种情况下,则不能使用分布式 DDL 语句(`ON CLUSTER`)。 + +使用大型集群时,我们建议使用宏替换,因为它可以降低出错的可能性。 + +在每个副本服务器上运行 `CREATE TABLE` 查询。将创建新的复制表,或给现有表添加新副本。 + +如果其他副本上已包含了某些数据,在表上添加新副本,则在运行语句后,数据会从其他副本复制到新副本。换句话说,新副本会与其他副本同步。 + +要删除副本,使用 `DROP TABLE`。但它只删除那个 – 位于运行该语句的服务器上的副本。 + +## 故障恢复 {#gu-zhang-hui-fu} + +如果服务器启动时 ZooKeeper 不可用,则复制表会切换为只读模式。系统会定期尝试去连接 ZooKeeper。 + +如果在 `INSERT` 期间 ZooKeeper 不可用,或者在与 ZooKeeper 交互时发生错误,则抛出异常。 + +连接到 ZooKeeper 后,系统会检查本地文件系统中的数据集是否与预期的数据集( ZooKeeper 存储此信息)一致。如果存在轻微的不一致,系统会通过与副本同步数据来解决。 + +如果系统检测到损坏的数据片段(文件大小错误)或无法识别的片段(写入文件系统但未记录在 ZooKeeper 中的部分),则会把它们移动到 ‘detached’ 子目录(不会删除)。而副本中其他任何缺少的但正常数据片段都会被复制同步。 + +注意,ClickHouse 不会执行任何破坏性操作,例如自动删除大量数据。 + +当服务器启动(或与 ZooKeeper 建立新会话)时,它只检查所有文件的数量和大小。 如果文件大小一致但中间某处已有字节被修改过,不会立即被检测到,只有在尝试读取 `SELECT` 查询的数据时才会检测到。该查询会引发校验和不匹配或压缩块大小不一致的异常。这种情况下,数据片段会添加到验证队列中,并在必要时从其他副本中复制。 + +如果本地数据集与预期数据的差异太大,则会触发安全机制。服务器在日志中记录此内容并拒绝启动。这种情况很可能是配置错误,例如,一个分片上的副本意外配置为别的分片上的副本。然而,此机制的阈值设置得相当低,在正常故障恢复期间可能会出现这种情况。在这种情况下,数据恢复则是半自动模式,通过用户主动操作触发。 + +要触发启动恢复,可在 ZooKeeper 中创建节点 `/path_to_table/replica_name/flags/force_restore_data`,节点值可以是任何内容,或运行命令来恢复所有的可复制表: + +``` bash +sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data +``` + +然后重启服务器。启动时,服务器会删除这些标志并开始恢复。 + +## 在数据完全丢失后的恢复 {#zai-shu-ju-wan-quan-diu-shi-hou-de-hui-fu} + +如果其中一个服务器的所有数据和元数据都消失了,请按照以下步骤进行恢复: + +1. 在服务器上安装 ClickHouse。在包含分片标识符和副本的配置文件中正确定义宏配置,如果有用到的话, +2. 如果服务器上有非复制表则必须手动复制,可以从副本服务器上(在 `/var/lib/clickhouse/data/db_name/table_name/` 目录中)复制它们的数据。 +3. 从副本服务器上中复制位于 `/var/lib/clickhouse/metadata/` 中的表定义信息。如果在表定义信息中显式指定了分片或副本标识符,请更正它以使其对应于该副本。(另外,启动服务器,然后会在 `/var/lib/clickhouse/metadata/` 中的.sql文件中生成所有的 `ATTACH TABLE` 语句。) + 4.要开始恢复,ZooKeeper 中创建节点 `/path_to_table/replica_name/flags/force_restore_data`,节点内容不限,或运行命令来恢复所有复制的表:`sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` + +然后启动服务器(如果它已运行则重启)。数据会从副本中下载。 + +另一种恢复方式是从 ZooKeeper(`/path_to_table/replica_name`)中删除有数据丢的副本的所有元信息,然后再按照«[创建可复制表](#creating-replicated-tables)»中的描述重新创建副本。 + +恢复期间的网络带宽没有限制。特别注意这一点,尤其是要一次恢复很多副本。 + +## MergeTree 转换为 ReplicatedMergeTree {#mergetree-zhuan-huan-wei-replicatedmergetree} + +我们使用 `MergeTree` 来表示 `MergeTree系列` 中的所有表引擎,`ReplicatedMergeTree` 同理。 + +如果你有一个手动同步的 `MergeTree` 表,您可以将其转换为可复制表。如果你已经在 `MergeTree` 表中收集了大量数据,并且现在要启用复制,则可以执行这些操作。 + +如果各个副本上的数据不一致,则首先对其进行同步,或者除保留的一个副本外,删除其他所有副本上的数据。 + +重命名现有的 MergeTree 表,然后使用旧名称创建 `ReplicatedMergeTree` 表。 +将数据从旧表移动到新表(`/var/lib/clickhouse/data/db_name/table_name/`)目录内的 ‘detached’ 目录中。 +然后在其中一个副本上运行`ALTER TABLE ATTACH PARTITION`,将这些数据片段添加到工作集中。 + +## ReplicatedMergeTree 转换为 MergeTree {#replicatedmergetree-zhuan-huan-wei-mergetree} + +使用其他名称创建 MergeTree 表。将具有`ReplicatedMergeTree`表数据的目录中的所有数据移动到新表的数据目录中。然后删除`ReplicatedMergeTree`表并重新启动服务器。 + +如果你想在不启动服务器的情况下清除 `ReplicatedMergeTree` 表: + +- 删除元数据目录中的相应 `.sql` 文件(`/var/lib/clickhouse/metadata/`)。 +- 删除 ZooKeeper 中的相应路径(`/path_to_table/replica_name`)。 + +之后,你可以启动服务器,创建一个 `MergeTree` 表,将数据移动到其目录,然后重新启动服务器。 + +## 当 ZooKeeper 集群中的元数据丢失或损坏时恢复方法 {#dang-zookeeper-ji-qun-zhong-de-yuan-shu-ju-diu-shi-huo-sun-pi-shi-hui-fu-fang-fa} + +如果 ZooKeeper 中的数据丢失或损坏,如上所述,你可以通过将数据转移到非复制表来保存数据。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/zh/engines/table-engines/mergetree-family/summingmergetree.md b/docs/zh/engines/table-engines/mergetree-family/summingmergetree.md new file mode 100644 index 00000000000..d05e718c59b --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/summingmergetree.md @@ -0,0 +1,124 @@ +# SummingMergeTree {#summingmergetree} + +该引擎继承自 [MergeTree](mergetree.md)。区别在于,当合并 `SummingMergeTree` 表的数据片段时,ClickHouse 会把所有具有相同主键的行合并为一行,该行包含了被合并的行中具有数值数据类型的列的汇总值。如果主键的组合方式使得单个键值对应于大量的行,则可以显著的减少存储空间并加快数据查询的速度。 + +我们推荐将该引擎和 `MergeTree` 一起使用。例如,在准备做报告的时候,将完整的数据存储在 `MergeTree` 表中,并且使用 `SummingMergeTree` 来存储聚合数据。这种方法可以使你避免因为使用不正确的主键组合方式而丢失有价值的数据。 + +## 建表 {#jian-biao} + + CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] + ( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... + ) ENGINE = SummingMergeTree([columns]) + [PARTITION BY expr] + [ORDER BY expr] + [SAMPLE BY expr] + [SETTINGS name=value, ...] + +请求参数的描述,参考 [请求描述](../../../engines/table-engines/mergetree-family/summingmergetree.md)。 + +**SummingMergeTree 的参数** + +- `columns` - 包含了将要被汇总的列的列名的元组。可选参数。 + 所选的列必须是数值类型,并且不可位于主键中。 + + 如果没有指定 `columns`,ClickHouse 会把所有不在主键中的数值类型的列都进行汇总。 + +**子句** + +创建 `SummingMergeTree` 表时,需要与创建 `MergeTree` 表时相同的[子句](mergetree.md)。 + +
+ +已弃用的建表方法 + +!!! attention "注意" + 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 + + CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] + ( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... + ) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) + +除 `columns` 外的所有参数都与 `MergeTree` 中的含义相同。 + +- `columns` — 包含将要被汇总的列的列名的元组。可选参数。有关说明,请参阅上文。 + +
+ +## 用法示例 {#yong-fa-shi-li} + +考虑如下的表: + +``` sql +CREATE TABLE summtt +( + key UInt32, + value UInt32 +) +ENGINE = SummingMergeTree() +ORDER BY key +``` + +向其中插入数据: + + :) INSERT INTO summtt Values(1,1),(1,2),(2,1) + +ClickHouse可能不会完整的汇总所有行([见下文](#data-processing)),因此我们在查询中使用了聚合函数 `sum` 和 `GROUP BY` 子句。 + +``` sql +SELECT key, sum(value) FROM summtt GROUP BY key +``` + + ┌─key─┬─sum(value)─┐ + │ 2 │ 1 │ + │ 1 │ 3 │ + └─────┴────────────┘ + +## 数据处理 {#data-processing} + +当数据被插入到表中时,他们将被原样保存。ClickHouse 定期合并插入的数据片段,并在这个时候对所有具有相同主键的行中的列进行汇总,将这些行替换为包含汇总数据的一行记录。 + +ClickHouse 会按片段合并数据,以至于不同的数据片段中会包含具有相同主键的行,即单个汇总片段将会是不完整的。因此,聚合函数 [sum()](../../../engines/table-engines/mergetree-family/summingmergetree.md#agg_function-sum) 和 `GROUP BY` 子句应该在(`SELECT`)查询语句中被使用,如上文中的例子所述。 + +### 汇总的通用规则 {#hui-zong-de-tong-yong-gui-ze} + +列中数值类型的值会被汇总。这些列的集合在参数 `columns` 中被定义。 + +如果用于汇总的所有列中的值均为0,则该行会被删除。 + +如果列不在主键中且无法被汇总,则会在现有的值中任选一个。 + +主键所在的列中的值不会被汇总。 + +### AggregateFunction 列中的汇总 {#aggregatefunction-lie-zhong-de-hui-zong} + +对于 [AggregateFunction 类型](../../../engines/table-engines/mergetree-family/summingmergetree.md)的列,ClickHouse 根据对应函数表现为 [AggregatingMergeTree](aggregatingmergetree.md) 引擎的聚合。 + +### 嵌套结构 {#qian-tao-jie-gou} + +表中可以具有以特殊方式处理的嵌套数据结构。 + +如果嵌套表的名称以 `Map` 结尾,并且包含至少两个符合以下条件的列: + +- 第一列是数值类型 `(*Int*, Date, DateTime)`,我们称之为 `key`, +- 其他的列是可计算的 `(*Int*, Float32/64)`,我们称之为 `(values...)`, + +然后这个嵌套表会被解释为一个 `key => (values...)` 的映射,当合并它们的行时,两个数据集中的元素会被根据 `key` 合并为相应的 `(values...)` 的汇总值。 + +示例: + + [(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] + [(1, 100)] + [(1, 150)] -> [(1, 250)] + [(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] + [(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] + +请求数据时,使用 [sumMap(key,value)](../../../engines/table-engines/mergetree-family/summingmergetree.md) 函数来对 `Map` 进行聚合。 + +对于嵌套数据结构,你无需在列的元组中指定列以进行汇总。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/zh/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md b/docs/zh/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md new file mode 100644 index 00000000000..f4556c2b94c --- /dev/null +++ b/docs/zh/engines/table-engines/mergetree-family/versionedcollapsingmergetree.md @@ -0,0 +1,238 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 37 +toc_title: "\u7248\u672C\u96C6\u5408\u5728\u65B0\u6811" +--- + +# 版本集合在新树 {#versionedcollapsingmergetree} + +这个引擎: + +- 允许快速写入不断变化的对象状态。 +- 删除后台中的旧对象状态。 这显着降低了存储体积。 + +请参阅部分 [崩溃](#table_engines_versionedcollapsingmergetree) 有关详细信息。 + +引擎继承自 [MergeTree](mergetree.md#table_engines-mergetree) 并将折叠行的逻辑添加到合并数据部分的算法中。 `VersionedCollapsingMergeTree` 用于相同的目的 [折叠树](collapsingmergetree.md) 但使用不同的折叠算法,允许以多个线程的任何顺序插入数据。 特别是, `Version` 列有助于正确折叠行,即使它们以错误的顺序插入。 相比之下, `CollapsingMergeTree` 只允许严格连续插入。 + +## 创建表 {#creating-a-table} + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = VersionedCollapsingMergeTree(sign, version) +[PARTITION BY expr] +[ORDER BY expr] +[SAMPLE BY expr] +[SETTINGS name=value, ...] +``` + +有关查询参数的说明,请参阅 [查询说明](../../../sql-reference/statements/create.md). + +**发动机参数** + +``` sql +VersionedCollapsingMergeTree(sign, version) +``` + +- `sign` — Name of the column with the type of row: `1` 是一个 “state” 行, `-1` 是一个 “cancel” 划 + + 列数据类型应为 `Int8`. + +- `version` — Name of the column with the version of the object state. + + 列数据类型应为 `UInt*`. + +**查询子句** + +当创建一个 `VersionedCollapsingMergeTree` 表,相同 [条款](mergetree.md) 需要创建一个时 `MergeTree` 桌子 + +
+ +不推荐使用的创建表的方法 + +!!! attention "注意" + 不要在新项目中使用此方法。 如果可能,请将旧项目切换到上述方法。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) +``` + +所有的参数,除了 `sign` 和 `version` 具有相同的含义 `MergeTree`. + +- `sign` — Name of the column with the type of row: `1` 是一个 “state” 行, `-1` 是一个 “cancel” 划 + + Column Data Type — `Int8`. + +- `version` — Name of the column with the version of the object state. + + 列数据类型应为 `UInt*`. + +
+ +## 崩溃 {#table_engines-versionedcollapsingmergetree} + +### 数据 {#data} + +考虑一种情况,您需要为某个对象保存不断变化的数据。 对于一个对象有一行,并在发生更改时更新该行是合理的。 但是,对于数据库管理系统来说,更新操作非常昂贵且速度很慢,因为它需要重写存储中的数据。 如果需要快速写入数据,则不能接受更新,但可以按如下顺序将更改写入对象。 + +使用 `Sign` 列写入行时。 如果 `Sign = 1` 这意味着该行是一个对象的状态(让我们把它称为 “state” 行)。 如果 `Sign = -1` 它指示具有相同属性的对象的状态的取消(让我们称之为 “cancel” 行)。 还可以使用 `Version` 列,它应该用单独的数字标识对象的每个状态。 + +例如,我们要计算用户在某个网站上访问了多少页面以及他们在那里的时间。 在某个时间点,我们用用户活动的状态写下面的行: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +在稍后的某个时候,我们注册用户活动的变化,并用以下两行写入它。 + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +第一行取消对象(用户)的先前状态。 它应该复制已取消状态的所有字段,除了 `Sign`. + +第二行包含当前状态。 + +因为我们只需要用户活动的最后一个状态,行 + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +可以删除,折叠对象的无效(旧)状态。 `VersionedCollapsingMergeTree` 在合并数据部分时执行此操作。 + +要了解为什么每次更改都需要两行,请参阅 [算法](#table_engines-versionedcollapsingmergetree-algorithm). + +**使用注意事项** + +1. 写入数据的程序应该记住对象的状态以取消它。 该 “cancel” 字符串应该是 “state” 与相反的字符串 `Sign`. 这增加了存储的初始大小,但允许快速写入数据。 +2. 列中长时间增长的数组由于写入负载而降低了引擎的效率。 数据越简单,效率就越高。 +3. `SELECT` 结果很大程度上取决于对象变化历史的一致性。 准备插入数据时要准确。 您可以通过不一致的数据获得不可预测的结果,例如会话深度等非负指标的负值。 + +### 算法 {#table_engines-versionedcollapsingmergetree-algorithm} + +当ClickHouse合并数据部分时,它会删除具有相同主键和版本且不同主键和版本的每对行 `Sign`. 行的顺序并不重要。 + +当ClickHouse插入数据时,它会按主键对行进行排序。 如果 `Version` 列不在主键中,ClickHouse将其隐式添加到主键作为最后一个字段并使用它进行排序。 + +## 选择数据 {#selecting-data} + +ClickHouse不保证具有相同主键的所有行都将位于相同的结果数据部分中,甚至位于相同的物理服务器上。 对于写入数据和随后合并数据部分都是如此。 此外,ClickHouse流程 `SELECT` 具有多个线程的查询,并且无法预测结果中的行顺序。 这意味着聚合是必需的,如果有必要得到完全 “collapsed” 从数据 `VersionedCollapsingMergeTree` 桌子 + +要完成折叠,请使用 `GROUP BY` 考虑符号的子句和聚合函数。 例如,要计算数量,请使用 `sum(Sign)` 而不是 `count()`. 要计算的东西的总和,使用 `sum(Sign * x)` 而不是 `sum(x)`,并添加 `HAVING sum(Sign) > 0`. + +聚合 `count`, `sum` 和 `avg` 可以这样计算。 聚合 `uniq` 如果对象至少具有一个非折叠状态,则可以计算。 聚合 `min` 和 `max` 无法计算是因为 `VersionedCollapsingMergeTree` 不保存折叠状态值的历史记录。 + +如果您需要提取数据 “collapsing” 但是,如果没有聚合(例如,要检查是否存在其最新值与某些条件匹配的行),则可以使用 `FINAL` 修饰符 `FROM` 条款 这种方法效率低下,不应与大型表一起使用。 + +## 使用示例 {#example-of-use} + +示例数据: + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +创建表: + +``` sql +CREATE TABLE UAct +( + UserID UInt64, + PageViews UInt8, + Duration UInt8, + Sign Int8, + Version UInt8 +) +ENGINE = VersionedCollapsingMergeTree(Sign, Version) +ORDER BY UserID +``` + +插入数据: + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) +``` + +``` sql +INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) +``` + +我们用两个 `INSERT` 查询以创建两个不同的数据部分。 如果我们使用单个查询插入数据,ClickHouse将创建一个数据部分,并且永远不会执行任何合并。 + +获取数据: + +``` sql +SELECT * FROM UAct +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +我们在这里看到了什么,折叠的部分在哪里? +我们使用两个创建了两个数据部分 `INSERT` 查询。 该 `SELECT` 查询是在两个线程中执行的,结果是行的随机顺序。 +由于数据部分尚未合并,因此未发生折叠。 ClickHouse在我们无法预测的未知时间点合并数据部分。 + +这就是为什么我们需要聚合: + +``` sql +SELECT + UserID, + sum(PageViews * Sign) AS PageViews, + sum(Duration * Sign) AS Duration, + Version +FROM UAct +GROUP BY UserID, Version +HAVING sum(Sign) > 0 +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 2 │ +└─────────────────────┴───────────┴──────────┴─────────┘ +``` + +如果我们不需要聚合,并希望强制折叠,我们可以使用 `FINAL` 修饰符 `FROM` 条款 + +``` sql +SELECT * FROM UAct FINAL +``` + +``` text +┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ +│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ +└─────────────────────┴───────────┴──────────┴──────┴─────────┘ +``` + +这是一个非常低效的方式来选择数据。 不要把它用于大桌子。 + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/zh/engines/table-engines/special/buffer.md b/docs/zh/engines/table-engines/special/buffer.md new file mode 100644 index 00000000000..611813cbac4 --- /dev/null +++ b/docs/zh/engines/table-engines/special/buffer.md @@ -0,0 +1,53 @@ +# 缓冲区 {#buffer} + +缓冲数据写入 RAM 中,周期性地将数据刷新到另一个表。在读取操作时,同时从缓冲区和另一个表读取数据。 + + Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) + +引擎的参数:database,table - 要刷新数据的表。可以使用返回字符串的常量表达式而不是数据库名称。 num\_layers - 并行层数。在物理上,该表将表示为 num\_layers 个独立缓冲区。建议值为16。min\_time,max\_time,min\_rows,max\_rows,min\_bytes,max\_bytes - 从缓冲区刷新数据的条件。 + +如果满足所有 «min» 条件或至少一个 «max» 条件,则从缓冲区刷新数据并将其写入目标表。min\_time,max\_time — 从第一次写入缓冲区时起以秒为单位的时间条件。min\_rows,max\_rows - 缓冲区中行数的条件。min\_bytes,max\_bytes - 缓冲区中字节数的条件。 + +写入时,数据从 num\_layers 个缓冲区中随机插入。或者,如果插入数据的大小足够大(大于 max\_rows 或 max\_bytes ),则会绕过缓冲区将其写入目标表。 + +每个 «num\_layers» 缓冲区刷新数据的条件是分别计算。例如,如果 num\_layers = 16 且 max\_bytes = 100000000,则最大RAM消耗将为1.6 GB。 + +示例: + +``` sql +CREATE TABLE merge.hits_buffer AS merge.hits ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000) +``` + +创建一个 «merge.hits\_buffer» 表,其结构与 «merge.hits» 相同,并使用 Buffer 引擎。写入此表时,数据缓冲在 RAM 中,然后写入 «merge.hits» 表。创建了16个缓冲区。如果已经过了100秒,或者已写入100万行,或者已写入100 MB数据,则刷新每个缓冲区的数据;或者如果同时已经过了10秒并且已经写入了10,000行和10 MB的数据。例如,如果只写了一行,那么在100秒之后,都会被刷新。但是如果写了很多行,数据将会更快地刷新。 + +当服务器停止时,使用 DROP TABLE 或 DETACH TABLE,缓冲区数据也会刷新到目标表。 + +可以为数据库和表名在单个引号中设置空字符串。这表示没有目的地表。在这种情况下,当达到数据刷新条件时,缓冲器被简单地清除。这可能对于保持数据窗口在内存中是有用的。 + +从 Buffer 表读取时,将从缓冲区和目标表(如果有)处理数据。 +请注意,Buffer 表不支持索引。换句话说,缓冲区中的数据被完全扫描,对于大缓冲区来说可能很慢。(对于目标表中的数据,将使用它支持的索引。) + +如果 Buffer 表中的列集与目标表中的列集不匹配,则会插入两个表中存在的列的子集。 + +如果类型与 Buffer 表和目标表中的某列不匹配,则会在服务器日志中输入错误消息并清除缓冲区。 +如果在刷新缓冲区时目标表不存在,则会发生同样的情况。 + +如果需要为目标表和 Buffer 表运行 ALTER,我们建议先删除 Buffer 表,为目标表运行 ALTER,然后再次创建 Buffer 表。 + +如果服务器异常重启,缓冲区中的数据将丢失。 + +PREWHERE,FINAL 和 SAMPLE 对缓冲表不起作用。这些条件将传递到目标表,但不用于处理缓冲区中的数据。因此,我们建议只使用Buffer表进行写入,同时从目标表进行读取。 + +将数据添加到缓冲区时,其中一个缓冲区被锁定。如果同时从表执行读操作,则会导致延迟。 + +插入到 Buffer 表中的数据可能以不同的顺序和不同的块写入目标表中。因此,Buffer 表很难用于正确写入 CollapsingMergeTree。为避免出现问题,您可以将 «num\_layers» 设置为1。 + +如果目标表是复制表,则在写入 Buffer 表时会丢失复制表的某些预期特征。数据部分的行次序和大小的随机变化导致数据不能去重,这意味着无法对复制表进行可靠的 «exactly once» 写入。 + +由于这些缺点,我们只建议在极少数情况下使用 Buffer 表。 + +当在单位时间内从大量服务器接收到太多 INSERTs 并且在插入之前无法缓冲数据时使用 Buffer 表,这意味着这些 INSERTs 不能足够快地执行。 + +请注意,一次插入一行数据是没有意义的,即使对于 Buffer 表也是如此。这将只产生每秒几千行的速度,而插入更大的数据块每秒可以产生超过一百万行(参见 «性能» 部分)。 + +[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/buffer/) diff --git a/docs/zh/engines/table-engines/special/dictionary.md b/docs/zh/engines/table-engines/special/dictionary.md new file mode 100644 index 00000000000..4908276ef97 --- /dev/null +++ b/docs/zh/engines/table-engines/special/dictionary.md @@ -0,0 +1,101 @@ +# 字典 {#dictionary} + +`Dictionary` 引擎将字典数据展示为一个ClickHouse的表。 + +例如,考虑使用一个具有以下配置的 `products` 字典: + +``` xml + + + products + + +
products
+ DSN=some-db-server + + + + 300 + 360 + + + + + + + product_id + + + title + String + + + + + +``` + +查询字典中的数据: + +``` sql +select name, type, key, attribute.names, attribute.types, bytes_allocated, element_count,source from system.dictionaries where name = 'products'; + +SELECT + name, + type, + key, + attribute.names, + attribute.types, + bytes_allocated, + element_count, + source +FROM system.dictionaries +WHERE name = 'products' +``` + + ┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ + │ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ + └──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ + +你可以使用 [dictGet\*](../../../engines/table-engines/special/dictionary.md) 函数来获取这种格式的字典数据。 + +当你需要获取原始数据,或者是想要使用 `JOIN` 操作的时候,这种视图并没有什么帮助。对于这些情况,你可以使用 `Dictionary` 引擎,它可以将字典数据展示在表中。 + +语法: + + CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` + +示例: + +``` sql +create table products (product_id UInt64, title String) Engine = Dictionary(products); + +CREATE TABLE products +( + product_id UInt64, + title String, +) +ENGINE = Dictionary(products) +``` + + Ok. + + 0 rows in set. Elapsed: 0.004 sec. + +看一看表中的内容。 + +``` sql +select * from products limit 1; + +SELECT * +FROM products +LIMIT 1 +``` + + ┌────product_id─┬─title───────────┐ + │ 152689 │ Some item │ + └───────────────┴─────────────────┘ + + 1 rows in set. Elapsed: 0.006 sec. + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/zh/engines/table-engines/special/distributed.md b/docs/zh/engines/table-engines/special/distributed.md new file mode 100644 index 00000000000..22558e1c706 --- /dev/null +++ b/docs/zh/engines/table-engines/special/distributed.md @@ -0,0 +1,120 @@ +# 分布 {#distributed} + +**分布式引擎本身不存储数据**, 但可以在多个服务器上进行分布式查询。 +读是自动并行的。读取时,远程服务器表的索引(如果有的话)会被使用。 +分布式引擎参数:服务器配置文件中的集群名,远程数据库名,远程表名,数据分片键(可选)。 +示例: + + Distributed(logs, default, hits[, sharding_key]) + +将会从位于«logs»集群中 default.hits 表所有服务器上读取数据。 +远程服务器不仅用于读取数据,还会对尽可能数据做部分处理。 +例如,对于使用 GROUP BY 的查询,数据首先在远程服务器聚合,之后返回聚合函数的中间状态给查询请求的服务器。再在请求的服务器上进一步汇总数据。 + +数据库名参数除了用数据库名之外,也可用返回字符串的常量表达式。例如:currentDatabase()。 + +logs – 服务器配置文件中的集群名称。 + +集群示例配置如下: + +``` xml + + + + + 1 + + false + + example01-01-1 + 9000 + + + example01-01-2 + 9000 + + + + 2 + false + + example01-02-1 + 9000 + + + example01-02-2 + 1 + 9440 + + + + +``` + +这里定义了一个名为’logs’的集群,它由两个分片组成,每个分片包含两个副本。 +分片是指包含数据不同部分的服务器(要读取所有数据,必须访问所有分片)。 +副本是存储复制数据的服务器(要读取所有数据,访问任一副本上的数据即可)。 + +集群名称不能包含点号。 + +每个服务器需要指定 `host`,`port`,和可选的 `user`,`password`,`secure`,`compression` 的参数: +- `host` – 远程服务器地址。可以域名、IPv4或IPv6。如果指定域名,则服务在启动时发起一个 DNS 请求,并且请求结果会在服务器运行期间一直被记录。如果 DNS 请求失败,则服务不会启动。如果你修改了 DNS 记录,则需要重启服务。 +- `port` – 消息传递的 TCP 端口(「tcp\_port」配置通常设为 9000)。不要跟 http\_port 混淆。 +- `user` – 用于连接远程服务器的用户名。默认值:default。该用户必须有权限访问该远程服务器。访问权限配置在 users.xml 文件中。更多信息,请查看«访问权限»部分。 +- `password` – 用于连接远程服务器的密码。默认值:空字符串。 +- `secure` – 是否使用ssl进行连接,设为true时,通常也应该设置 `port` = 9440。服务器也要监听 9440 并有正确的证书。 +- `compression` - 是否使用数据压缩。默认值:true。 + +配置了副本,读取操作会从每个分片里选择一个可用的副本。可配置负载平衡算法(挑选副本的方式) - 请参阅«load\_balancing»设置。 +如果跟服务器的连接不可用,则在尝试短超时的重连。如果重连失败,则选择下一个副本,依此类推。如果跟所有副本的连接尝试都失败,则尝试用相同的方式再重复几次。 +该机制有利于系统可用性,但不保证完全容错:如有远程服务器能够接受连接,但无法正常工作或状况不佳。 + +你可以配置一个(这种情况下,查询操作更应该称为远程查询,而不是分布式查询)或任意多个分片。在每个分片中,可以配置一个或任意多个副本。不同分片可配置不同数量的副本。 + +可以在配置中配置任意数量的集群。 + +要查看集群,可使用«system.clusters»表。 + +通过分布式引擎可以像使用本地服务器一样使用集群。但是,集群不是自动扩展的:你必须编写集群配置到服务器配置文件中(最好,给所有集群的服务器写上完整配置)。 + +不支持用分布式表查询别的分布式表(除非该表只有一个分片)。或者说,要用分布表查查询«最终»的数据表。 + +分布式引擎需要将集群信息写入配置文件。配置文件中的集群信息会即时更新,无需重启服务器。如果你每次是要向不确定的一组分片和副本发送查询,则不适合创建分布式表 - 而应该使用«远程»表函数。 请参阅«表函数»部分。 + +向集群写数据的方法有两种: + +一,自已指定要将哪些数据写入哪些服务器,并直接在每个分片上执行写入。换句话说,在分布式表上«查询»,在数据表上 INSERT。 +这是最灵活的解决方案 – 你可以使用任何分片方案,对于复杂业务特性的需求,这可能是非常重要的。 +这也是最佳解决方案,因为数据可以完全独立地写入不同的分片。 + +二,在分布式表上执行 INSERT。在这种情况下,分布式表会跨服务器分发插入数据。 +为了写入分布式表,必须要配置分片键(最后一个参数)。当然,如果只有一个分片,则写操作在没有分片键的情况下也能工作,因为这种情况下分片键没有意义。 + +每个分片都可以在配置文件中定义权重。默认情况下,权重等于1。数据依据分片权重按比例分发到分片上。例如,如果有两个分片,第一个分片的权重是9,而第二个分片的权重是10,则发送 9 / 19 的行到第一个分片, 10 / 19 的行到第二个分片。 + +分片可在配置文件中定义 ‘internal\_replication’ 参数。 + +此参数设置为«true»时,写操作只选一个正常的副本写入数据。如果分布式表的子表是复制表(\*ReplicaMergeTree),请使用此方案。换句话说,这其实是把数据的复制工作交给实际需要写入数据的表本身而不是分布式表。 + +若此参数设置为«false»(默认值),写操作会将数据写入所有副本。实质上,这意味着要分布式表本身来复制数据。这种方式不如使用复制表的好,因为不会检查副本的一致性,并且随着时间的推移,副本数据可能会有些不一样。 + +选择将一行数据发送到哪个分片的方法是,首先计算分片表达式,然后将这个计算结果除以所有分片的权重总和得到余数。该行会发送到那个包含该余数的从’prev\_weight’到’prev\_weights + weight’的半闭半开区间对应的分片上,其中 ‘prev\_weights’ 是该分片前面的所有分片的权重和,‘weight’ 是该分片的权重。例如,如果有两个分片,第一个分片权重为9,而第二个分片权重为10,则余数在 \[0,9) 中的行发给第一个分片,余数在 \[9,19) 中的行发给第二个分片。 + +分片表达式可以是由常量和表列组成的任何返回整数表达式。例如,您可以使用表达式 ‘rand()’ 来随机分配数据,或者使用 ‘UserID’ 来按用户 ID 的余数分布(相同用户的数据将分配到单个分片上,这可降低带有用户信息的 IN 和 JOIN 的语句运行的复杂度)。如果该列数据分布不够均匀,可以将其包装在散列函数中:intHash64(UserID)。 + +这种简单的用余数来选择分片的方案是有局限的,并不总适用。它适用于中型和大型数据(数十台服务器)的场景,但不适用于巨量数据(数百台或更多服务器)的场景。后一种情况下,应根据业务特性需求考虑的分片方案,而不是直接用分布式表的多分片。 + +SELECT 查询会被发送到所有分片,并且无论数据在分片中如何分布(即使数据完全随机分布)都可正常工作。添加新分片时,不必将旧数据传输到该分片。你可以给新分片分配大权重然后写新数据 - 数据可能会稍分布不均,但查询会正确高效地运行。 + +下面的情况,你需要关注分片方案: + +- 使用需要特定键连接数据( IN 或 JOIN )的查询。如果数据是用该键进行分片,则应使用本地 IN 或 JOIN 而不是 GLOBAL IN 或 GLOBAL JOIN,这样效率更高。 +- 使用大量服务器(上百或更多),但有大量小查询(个别客户的查询 - 网站,广告商或合作伙伴)。为了使小查询不影响整个集群,让单个客户的数据处于单个分片上是有意义的。或者,正如我们在 Yandex.Metrica 中所做的那样,你可以配置两级分片:将整个集群划分为«层»,一个层可以包含多个分片。单个客户的数据位于单个层上,根据需要将分片添加到层中,层中的数据随机分布。然后给每层创建分布式表,再创建一个全局的分布式表用于全局的查询。 + +数据是异步写入的。对于分布式表的 INSERT,数据块只写本地文件系统。之后会尽快地在后台发送到远程服务器。你可以通过查看表目录中的文件列表(等待发送的数据)来检查数据是否成功发送:/var/lib/clickhouse/data/database/table/ 。 + +如果在 INSERT 到分布式表时服务器节点丢失或重启(如,设备故障),则插入的数据可能会丢失。如果在表目录中检测到损坏的数据分片,则会将其转移到«broken»子目录,并不再使用。 + +启用 max\_parallel\_replicas 选项后,会在分表的所有副本上并行查询处理。更多信息,请参阅«设置,max\_parallel\_replicas»部分。 + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/zh/engines/table-engines/special/external-data.md b/docs/zh/engines/table-engines/special/external-data.md new file mode 100644 index 00000000000..8527c6a6676 --- /dev/null +++ b/docs/zh/engines/table-engines/special/external-data.md @@ -0,0 +1,61 @@ +# 用于查询处理的外部数据 {#external-data-for-query-processing} + +ClickHouse 允许向服务器发送处理查询所需的数据以及 SELECT 查询。这些数据放在一个临时表中(请参阅 «临时表» 一节),可以在查询中使用(例如,在 IN 操作符中)。 + +例如,如果您有一个包含重要用户标识符的文本文件,则可以将其与使用此列表过滤的查询一起上传到服务器。 + +如果需要使用大量外部数据运行多个查询,请不要使用该特性。最好提前把数据上传到数据库。 + +可以使用命令行客户端(在非交互模式下)或使用 HTTP 接口上传外部数据。 + +在命令行客户端中,您可以指定格式的参数部分 + +``` bash +--external --file=... [--name=...] [--format=...] [--types=...|--structure=...] +``` + +对于传输的表的数量,可能有多个这样的部分。 + +**–external** – 标记子句的开始。 +**–file** – 带有表存储的文件的路径,或者,它指的是STDIN。 +只能从 stdin 中检索单个表。 + +以下的参数是可选的:**–name** – 表的名称,如果省略,则采用 \_data。 +**–format** – 文件中的数据格式。 如果省略,则使用 TabSeparated。 + +以下的参数必选一个:**–types** – 逗号分隔列类型的列表。例如:`UInt64,String`。列将被命名为 \_1,\_2,… +**–structure**– 表结构的格式 `UserID UInt64`,`URL String`。定义列的名字以及类型。 + +在 «file» 中指定的文件将由 «format» 中指定的格式解析,使用在 «types» 或 «structure» 中指定的数据类型。该表将被上传到服务器,并在作为名称为 «name»临时表。 + +示例: + +``` bash +echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 +849897 +cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +当使用HTTP接口时,外部数据以 multipart/form-data 格式传递。每个表作为一个单独的文件传输。表名取自文件名。«query\_string» 传递参数 «name\_format»、«name\_types»和«name\_structure»,其中 «name» 是这些参数对应的表的名称。参数的含义与使用命令行客户端时的含义相同。 + +示例: + +``` bash +cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv + +curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' +/bin/sh 20 +/bin/false 5 +/bin/bash 4 +/usr/sbin/nologin 1 +/bin/sync 1 +``` + +对于分布式查询,将临时表发送到所有远程服务器。 + +[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/external_data/) diff --git a/docs/zh/engines/table-engines/special/file.md b/docs/zh/engines/table-engines/special/file.md new file mode 100644 index 00000000000..08f0a58070f --- /dev/null +++ b/docs/zh/engines/table-engines/special/file.md @@ -0,0 +1,73 @@ +# 文件(输入格式) {#table_engines-file} + +数据源是以 Clickhouse 支持的一种输入格式(TabSeparated,Native等)存储数据的文件。 + +用法示例: + +- 从 ClickHouse 导出数据到文件。 +- 将数据从一种格式转换为另一种格式。 +- 通过编辑磁盘上的文件来更新 ClickHouse 中的数据。 + +## 在 ClickHouse 服务器中的使用 {#zai-clickhouse-fu-wu-qi-zhong-de-shi-yong} + + File(Format) + +选用的 `Format` 需要支持 `INSERT` 或 `SELECT` 。有关支持格式的完整列表,请参阅 [格式](../../../interfaces/formats.md#formats)。 + +ClickHouse 不支持给 `File` 指定文件系统路径。它使用服务器配置中 [路径](../../../operations/server-configuration-parameters/settings.md) 设定的文件夹。 + +使用 `File(Format)` 创建表时,它会在该文件夹中创建空的子目录。当数据写入该表时,它会写到该子目录中的 `data.Format` 文件中。 + +你也可以在服务器文件系统中手动创建这些子文件夹和文件,然后通过 [ATTACH](../../../engines/table-engines/special/file.md) 将其创建为具有对应名称的表,这样你就可以从该文件中查询数据了。 + +!!! 注意 "注意" + 注意这个功能,因为 ClickHouse 不会跟踪这些文件在外部的更改。在 ClickHouse 中和 ClickHouse 外部同时写入会造成结果是不确定的。 + +**示例:** + +**1.** 创建 `file_engine_table` 表: + +``` sql +CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) +``` + +默认情况下,Clickhouse 会创建目录 `/var/lib/clickhouse/data/default/file_engine_table` 。 + +**2.** 手动创建 `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` 文件,并且包含内容: + +``` bash +$ cat data.TabSeparated +one 1 +two 2 +``` + +**3.** 查询这些数据: + +``` sql +SELECT * FROM file_engine_table +``` + + ┌─name─┬─value─┐ + │ one │ 1 │ + │ two │ 2 │ + └──────┴───────┘ + +## 在 Clickhouse-local 中的使用 {#zai-clickhouse-local-zhong-de-shi-yong} + +使用 [ツ环板-ョツ嘉ッツ偲](../../../engines/table-engines/special/file.md) 时,File 引擎除了 `Format` 之外,还可以接受文件路径参数。可以使用数字或人类可读的名称来指定标准输入/输出流,例如 `0` 或 `stdin`,`1` 或 `stdout`。 +**例如:** + +``` bash +$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" +``` + +## 功能实现 {#gong-neng-shi-xian} + +- 读操作可支持并发,但写操作不支持 +- 不支持: + - `ALTER` + - `SELECT ... SAMPLE` + - 索引 + - 副本 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/zh/engines/table-engines/special/generate.md b/docs/zh/engines/table-engines/special/generate.md new file mode 100644 index 00000000000..130f8e5eb77 --- /dev/null +++ b/docs/zh/engines/table-engines/special/generate.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 46 +toc_title: GenerateRandom +--- + +# Generaterandom {#table_engines-generate} + +GenerateRandom表引擎为给定的表架构生成随机数据。 + +使用示例: + +- 在测试中使用填充可重复的大表。 +- 为模糊测试生成随机输入。 + +## 在ClickHouse服务器中的使用 {#usage-in-clickhouse-server} + +``` sql +ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) +``` + +该 `max_array_length` 和 `max_string_length` 参数指定所有的最大长度 +数组列和字符串相应地在生成的数据中。 + +生成表引擎仅支持 `SELECT` 查询。 + +它支持所有 [数据类型](../../../sql-reference/data-types/index.md) 可以存储在一个表中,除了 `LowCardinality` 和 `AggregateFunction`. + +**示例:** + +**1.** 设置 `generate_engine_table` 表: + +``` sql +CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) +``` + +**2.** 查询数据: + +``` sql +SELECT * FROM generate_engine_table LIMIT 3 +``` + +``` text +┌─name─┬──────value─┐ +│ c4xJ │ 1412771199 │ +│ r │ 1791099446 │ +│ 7#$ │ 124312908 │ +└──────┴────────────┘ +``` + +## 实施细节 {#details-of-implementation} + +- 不支持: + - `ALTER` + - `SELECT ... SAMPLE` + - `INSERT` + - 指数 + - 复制 + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/zh/engines/table_engines/special/index.md b/docs/zh/engines/table-engines/special/index.md similarity index 100% rename from docs/zh/engines/table_engines/special/index.md rename to docs/zh/engines/table-engines/special/index.md diff --git a/docs/zh/engines/table-engines/special/join.md b/docs/zh/engines/table-engines/special/join.md new file mode 100644 index 00000000000..f9621069353 --- /dev/null +++ b/docs/zh/engines/table-engines/special/join.md @@ -0,0 +1,28 @@ +# 加入我们 {#join} + +加载好的 JOIN 表数据会常驻内存中。 + + Join(ANY|ALL, LEFT|INNER, k1[, k2, ...]) + +引擎参数:`ANY|ALL` – 连接修饰;`LEFT|INNER` – 连接类型。更多信息可参考 [JOIN子句](../../../engines/table-engines/special/join.md#select-join)。 +这些参数设置不用带引号,但必须与要 JOIN 表匹配。 k1,k2,……是 USING 子句中要用于连接的关键列。 + +此引擎表不能用于 GLOBAL JOIN 。 + +类似于 Set 引擎,可以使用 INSERT 向表中添加数据。设置为 ANY 时,重复键的数据会被忽略(仅一条用于连接)。设置为 ALL 时,重复键的数据都会用于连接。不能直接对 JOIN 表进行 SELECT。检索其数据的唯一方法是将其作为 JOIN 语句右边的表。 + +跟 Set 引擎类似,Join 引擎把数据存储在磁盘中。 + +### 限制和设置 {#join-limitations-and-settings} + +创建表时,将应用以下设置: + +- join\_use\_nulls +- max\_rows\_in\_join +- max\_bytes\_in\_join +- join\_overflow\_mode +- join\_any\_take\_last\_row + +该 `Join`-发动机表不能用于 `GLOBAL JOIN` 操作。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/zh/engines/table-engines/special/materializedview.md b/docs/zh/engines/table-engines/special/materializedview.md new file mode 100644 index 00000000000..518e9281095 --- /dev/null +++ b/docs/zh/engines/table-engines/special/materializedview.md @@ -0,0 +1,5 @@ +# 物化视图 {#wu-hua-shi-tu} + +物化视图的使用(更多信息请参阅 [CREATE TABLE](../../../engines/table-engines/special/materializedview.md) )。它需要使用一个不同的引擎来存储数据,这个引擎要在创建物化视图时指定。当从表中读取时,它就会使用该引擎。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/zh/engines/table-engines/special/memory.md b/docs/zh/engines/table-engines/special/memory.md new file mode 100644 index 00000000000..a7ae74d355c --- /dev/null +++ b/docs/zh/engines/table-engines/special/memory.md @@ -0,0 +1,7 @@ +# 记忆 {#memory} + +Memory 引擎以未压缩的形式将数据存储在 RAM 中。数据完全以读取时获得的形式存储。换句话说,从这张表中读取是很轻松的。并发数据访问是同步的。锁范围小:读写操作不会相互阻塞。不支持索引。阅读是并行化的。在简单查询上达到最大生产率(超过10 GB /秒),因为没有磁盘读取,不需要解压缩或反序列化数据。(值得注意的是,在许多情况下,与 MergeTree 引擎的性能几乎一样高)。重新启动服务器时,表中的数据消失,表将变为空。通常,使用此表引擎是不合理的。但是,它可用于测试,以及在相对较少的行(最多约100,000,000)上需要最高性能的查询。 + +Memory 引擎是由系统用于临时表进行外部数据的查询(请参阅 «外部数据用于请求处理» 部分),以及用于实现 `GLOBAL IN`(请参见 «IN 运算符» 部分)。 + +[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/memory/) diff --git a/docs/zh/engines/table-engines/special/merge.md b/docs/zh/engines/table-engines/special/merge.md new file mode 100644 index 00000000000..236d238d211 --- /dev/null +++ b/docs/zh/engines/table-engines/special/merge.md @@ -0,0 +1,63 @@ +# 合并 {#merge} + +`Merge` 引擎 (不要跟 `MergeTree` 引擎混淆) 本身不存储数据,但可用于同时从任意多个其他的表中读取数据。 +读是自动并行的,不支持写入。读取时,那些被真正读取到数据的表的索引(如果有的话)会被使用。 +`Merge` 引擎的参数:一个数据库名和一个用于匹配表名的正则表达式。 + +示例: + + Merge(hits, '^WatchLog') + +数据会从 `hits` 数据库中表名匹配正则 ‘`^WatchLog`’ 的表中读取。 + +除了数据库名,你也可以用一个返回字符串的常量表达式。例如, `currentDatabase()` 。 + +正则表达式 — [re2](https://github.com/google/re2) (支持 PCRE 一个子集的功能),大小写敏感。 +了解关于正则表达式中转义字符的说明可参看 «match» 一节。 + +当选择需要读的表时,`Merge` 表本身会被排除,即使它匹配上了该正则。这样设计为了避免循环。 +当然,是能够创建两个相互无限递归读取对方数据的 `Merge` 表的,但这并没有什么意义。 + +`Merge` 引擎的一个典型应用是可以像使用一张表一样使用大量的 `TinyLog` 表。 + +示例 2 : + +我们假定你有一个旧表(WatchLog\_old),你想改变数据分区了,但又不想把旧数据转移到新表(WatchLog\_new)里,并且你需要同时能看到这两个表的数据。 + + CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) + ENGINE=MergeTree(date, (UserId, EventType), 8192); + INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); + + CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) + ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; + INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); + + CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); + + SELECT * + FROM WatchLog + + ┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ + │ 2018-01-01 │ 1 │ hit │ 3 │ + └────────────┴────────┴───────────┴─────┘ + ┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ + │ 2018-01-02 │ 2 │ hit │ 3 │ + └────────────┴────────┴───────────┴─────┘ + +## 虚拟列 {#xu-ni-lie} + +虚拟列是一种由表引擎提供而不是在表定义中的列。换种说法就是,这些列并没有在 `CREATE TABLE` 中指定,但可以在 `SELECT` 中使用。 + +下面列出虚拟列跟普通列的不同点: + +- 虚拟列不在表结构定义里指定。 +- 不能用 `INSERT` 向虚拟列写数据。 +- 使用不指定列名的 `INSERT` 语句时,虚拟列要会被忽略掉。 +- 使用星号通配符( `SELECT *` )时虚拟列不会包含在里面。 +- 虚拟列不会出现在 `SHOW CREATE TABLE` 和 `DESC TABLE` 的查询结果里。 + +`Merge` 类型的表包括一个 `String` 类型的 `_table` 虚拟列。(如果该表本来已有了一个 `_table` 的列,那这个虚拟列会命名为 `_table1` ;如果 `_table1` 也本就存在了,那这个虚拟列会被命名为 `_table2` ,依此类推)该列包含被读数据的表名。 + +如果 `WHERE/PREWHERE` 子句包含了带 `_table` 的条件,并且没有依赖其他的列(如作为表达式谓词链接的一个子项或作为整个的表达式),这些条件的作用会像索引一样。这些条件会在那些可能被读数据的表的表名上执行,并且读操作只会在那些满足了该条件的表上去执行。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/zh/engines/table-engines/special/null.md b/docs/zh/engines/table-engines/special/null.md new file mode 100644 index 00000000000..c9fee734f1a --- /dev/null +++ b/docs/zh/engines/table-engines/special/null.md @@ -0,0 +1,7 @@ +# Null {#null} + +当写入 Null 类型的表时,将忽略数据。从 Null 类型的表中读取时,返回空。 + +但是,可以在 Null 类型的表上创建物化视图。写入表的数据将转发到视图中。 + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/null/) diff --git a/docs/zh/engines/table-engines/special/set.md b/docs/zh/engines/table-engines/special/set.md new file mode 100644 index 00000000000..71271b0d7ca --- /dev/null +++ b/docs/zh/engines/table-engines/special/set.md @@ -0,0 +1,11 @@ +# 设置 {#set} + +始终存在于 RAM 中的数据集。它适用于IN运算符的右侧(请参见 «IN运算符» 部分)。 + +可以使用 INSERT 向表中插入数据。新元素将添加到数据集中,而重复项将被忽略。但是不能对此类型表执行 SELECT 语句。检索数据的唯一方法是在 IN 运算符的右半部分使用它。 + +数据始终存在于 RAM 中。对于 INSERT,插入数据块也会写入磁盘上的表目录。启动服务器时,此数据将加载到 RAM。也就是说,重新启动后,数据仍然存在。 + +对于强制服务器重启,磁盘上的数据块可能会丢失或损坏。在数据块损坏的情况下,可能需要手动删除包含损坏数据的文件。 + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/set/) diff --git a/docs/zh/engines/table-engines/special/url.md b/docs/zh/engines/table-engines/special/url.md new file mode 100644 index 00000000000..9e0b953043e --- /dev/null +++ b/docs/zh/engines/table-engines/special/url.md @@ -0,0 +1,71 @@ +# URL(URL,格式) {#table_engines-url} + +用于管理远程 HTTP/HTTPS 服务器上的数据。该引擎类似 +[文件](file.md) 引擎。 + +## 在 ClickHouse 服务器中使用引擎 {#zai-clickhouse-fu-wu-qi-zhong-shi-yong-yin-qing} + +`Format` 必须是 ClickHouse 可以用于 +`SELECT` 查询的一种格式,若有必要,还要可用于 `INSERT` 。有关支持格式的完整列表,请查看 +[格式](../../../interfaces/formats.md#formats)。 + +`URL` 必须符合统一资源定位符的结构。指定的URL必须指向一个 +HTTP 或 HTTPS 服务器。对于服务端响应, +不需要任何额外的 HTTP 头标记。 + +`INSERT` 和 `SELECT` 查询会分别转换为 `POST` 和 `GET` 请求。 +对于 `POST` 请求的处理,远程服务器必须支持 +[分块传输编码](https://en.wikipedia.org/wiki/Chunked_transfer_encoding)。 + +**示例:** + +**1.** 在 Clickhouse 服务上创建一个 `url_engine_table` 表: + +``` sql +CREATE TABLE url_engine_table (word String, value UInt64) +ENGINE=URL('http://127.0.0.1:12345/', CSV) +``` + +**2.** 用标准的 Python 3 工具库创建一个基本的 HTTP 服务并 +启动它: + +``` python3 +from http.server import BaseHTTPRequestHandler, HTTPServer + +class CSVHTTPServer(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-type', 'text/csv') + self.end_headers() + + self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) + +if __name__ == "__main__": + server_address = ('127.0.0.1', 12345) + HTTPServer(server_address, CSVHTTPServer).serve_forever() +``` + +``` bash +python3 server.py +``` + +**3.** 查询请求: + +``` sql +SELECT * FROM url_engine_table +``` + + ┌─word──┬─value─┐ + │ Hello │ 1 │ + │ World │ 2 │ + └───────┴───────┘ + +## 功能实现 {#gong-neng-shi-xian} + +- 读写操作都支持并发 +- 不支持: + - `ALTER` 和 `SELECT...SAMPLE` 操作。 + - 索引。 + - 副本。 + +[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/zh/engines/table-engines/special/view.md b/docs/zh/engines/table-engines/special/view.md new file mode 100644 index 00000000000..a6a06ce7af6 --- /dev/null +++ b/docs/zh/engines/table-engines/special/view.md @@ -0,0 +1,5 @@ +# 查看 {#view} + +用于构建视图(有关更多信息,请参阅 `CREATE VIEW 查询`)。 它不存储数据,仅存储指定的 `SELECT` 查询。 从表中读取时,它会运行此查询(并从查询中删除所有不必要的列)。 + +[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/view/) diff --git a/docs/zh/engines/table_engines/index.md b/docs/zh/engines/table_engines/index.md deleted file mode 100644 index bb0443e4868..00000000000 --- a/docs/zh/engines/table_engines/index.md +++ /dev/null @@ -1,73 +0,0 @@ -# 表引擎 {#biao-yin-qing} - -表引擎(即表的类型)决定了: - -- 数据的存储方式和位置,写到哪里以及从哪里读取数据 -- 支持哪些查询以及如何支持。 -- 并发数据访问。 -- 索引的使用(如果存在)。 -- 是否可以执行多线程请求。 -- 数据复制参数。 - -# 引擎类型 {#yin-qing-lei-xing} - -## MergeTree {#mergetree} - -适用于高负载任务的最通用和功能最强大的表引擎。这些引擎的共同特点是可以快速插入数据并进行后续的后台数据处理。 MergeTree系列引擎支持数据复制(使用[Replicated\*](mergetree_family/replication.md) 的引擎版本),分区和一些其他引擎不支持的其他功能。 - -该类型的引擎: -- [MergeTree](mergetree_family/mergetree.md) -- [ReplacingMergeTree](mergetree_family/replacingmergetree.md) -- [SummingMergeTree](mergetree_family/summingmergetree.md) -- [AggregatingMergeTree](mergetree_family/aggregatingmergetree.md) -- [CollapsingMergeTree](mergetree_family/collapsingmergetree.md) -- [VersionedCollapsingMergeTree](mergetree_family/versionedcollapsingmergetree.md) -- [GraphiteMergeTree](mergetree_family/graphitemergetree.md) - -## 日志 {#log} - -具有最小功能的[轻量级引擎](log_family/index.md)。当您需要快速写入许多小表(最多约100万行)并在以后整体读取它们时,该类型的引擎是最有效的。 - -该类型的引擎: - -- [TinyLog](log_family/tinylog.md) -- [StripeLog](log_family/stripelog.md) -- [Log](log_family/log.md) - -## 集成引擎 {#integration-engines} - -用于与其他的数据存储与处理系统集成的引擎。 -该类型的引擎: - -- [Kafka](integrations/kafka.md) -- [MySQL](integrations/mysql.md) -- [ODBC](integrations/odbc.md) -- [JDBC](integrations/jdbc.md) -- [HDFS](integrations/hdfs.md) - -## 用于其他特定功能的引擎 {#yong-yu-qi-ta-te-ding-gong-neng-de-yin-qing} - -该类型的引擎: - -- [Distributed](special/distributed.md) -- [MaterializedView](special/materializedview.md) -- [Dictionary](special/dictionary.md) -- [Merge](special/merge.md) -- [File](special/file.md) -- [Null](special/null.md) -- [Set](special/set.md) -- [Join](special/join.md) -- [URL](special/url.md) -- [View](special/view.md) -- [Memory](special/memory.md) -- [Buffer](special/buffer.md) - -# 虚拟列 {#xu-ni-lie} - -虚拟列是表引擎组成的一部分,它在对应的表引擎的源代码中定义。 - -您不能在 `CREATE TABLE` 中指定虚拟列,并且虚拟列不会包含在 `SHOW CREATE TABLE` 和 `DESCRIBE TABLE` 的查询结果中。虚拟列是只读的,所以您不能向虚拟列中写入数据。 - -如果想要查询虚拟列中的数据,您必须在SELECT查询中包含虚拟列的名字。`SELECT *` 不会返回虚拟列的内容。 - -若您创建的表中有一列与虚拟列的名字相同,那么虚拟列将不能再被访问。我们不建议您这样做。为了避免这种列名的冲突,虚拟列的名字一般都以下划线开头。 diff --git a/docs/zh/engines/table_engines/integrations/hdfs.md b/docs/zh/engines/table_engines/integrations/hdfs.md deleted file mode 100644 index 5cd60a855bc..00000000000 --- a/docs/zh/engines/table_engines/integrations/hdfs.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 36 -toc_title: HDFS ---- - -# HDFS {#table_engines-hdfs} - -该引擎提供了集成 [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) 生态系统通过允许管理数据 [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)通过ClickHouse. 这个引擎是相似的 -到 [文件](../special/file.md) 和 [URL](../special/url.md) 引擎,但提供Hadoop特定的功能。 - -## 用途 {#usage} - -``` sql -ENGINE = HDFS(URI, format) -``` - -该 `URI` 参数是HDFS中的整个文件URI。 -该 `format` 参数指定一种可用的文件格式。 执行 -`SELECT` 查询时,格式必须支持输入,并执行 -`INSERT` queries – for output. The available formats are listed in the -[格式](../../../interfaces/formats.md#formats) 科。 -路径部分 `URI` 可能包含水珠。 在这种情况下,表将是只读的。 - -**示例:** - -**1.** 设置 `hdfs_engine_table` 表: - -``` sql -CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV') -``` - -**2.** 填充文件: - -``` sql -INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3) -``` - -**3.** 查询数据: - -``` sql -SELECT * FROM hdfs_engine_table LIMIT 2 -``` - -``` text -┌─name─┬─value─┐ -│ one │ 1 │ -│ two │ 2 │ -└──────┴───────┘ -``` - -## 实施细节 {#implementation-details} - -- 读取和写入可以并行 -- 不支持: - - `ALTER` 和 `SELECT...SAMPLE` 操作。 - - 索引。 - - 复制。 - -**路径中的水珠** - -多个路径组件可以具有globs。 对于正在处理的文件应该存在并匹配到整个路径模式。 文件列表确定在 `SELECT` (不在 `CREATE` 时刻)。 - -- `*` — Substitutes any number of any characters except `/` 包括空字符串。 -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -建筑与 `{}` 类似于 [远程](../../../sql_reference/table_functions/remote.md) 表功能。 - -**示例** - -1. 假设我们在HDFS上有几个TSV格式的文件,其中包含以下Uri: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. 有几种方法可以创建由所有六个文件组成的表: - - - -``` sql -CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV') -``` - -另一种方式: - -``` sql -CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV') -``` - -表由两个目录中的所有文件组成(所有文件都应满足query中描述的格式和模式): - -``` sql -CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV') -``` - -!!! warning "警告" - 如果文件列表包含带有前导零的数字范围,请单独使用带有大括号的构造或使用 `?`. - -**示例** - -创建具有名为文件的表 `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') -``` - -## 虚拟列 {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**另请参阅** - -- [虚拟列](../index.md#table_engines-virtual_columns) - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) diff --git a/docs/zh/engines/table_engines/integrations/jdbc.md b/docs/zh/engines/table_engines/integrations/jdbc.md deleted file mode 100644 index 00363bb988a..00000000000 --- a/docs/zh/engines/table_engines/integrations/jdbc.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 34 -toc_title: JDBC ---- - -# JDBC {#table-engine-jdbc} - -允许ClickHouse通过以下方式连接到外部数据库 [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity). - -要实现JDBC连接,ClickHouse使用单独的程序 [ツ暗ェツ氾环催ツ団ツ法ツ人](https://github.com/alex-krash/clickhouse-jdbc-bridge) 这应该作为守护进程运行。 - -该引擎支持 [可为空](../../../sql_reference/data_types/nullable.md) 数据类型。 - -## 创建表 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name -( - columns list... -) -ENGINE = JDBC(dbms_uri, external_database, external_table) -``` - -**发动机参数** - -- `dbms_uri` — URI of an external DBMS. - - 格式: `jdbc:://:/?user=&password=`. - Mysql的示例: `jdbc:mysql://localhost:3306/?user=root&password=root`. - -- `external_database` — Database in an external DBMS. - -- `external_table` — Name of the table in `external_database`. - -## 用法示例 {#usage-example} - -通过直接与它的控制台客户端连接在MySQL服务器中创建一个表: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -在ClickHouse服务器中创建表并从中选择数据: - -``` sql -CREATE TABLE jdbc_table -( - `int_id` Int32, - `int_nullable` Nullable(Int32), - `float` Float32, - `float_nullable` Nullable(Float32) -) -ENGINE JDBC('jdbc:mysql://localhost:3306/?user=root&password=root', 'test', 'test') -``` - -``` sql -SELECT * -FROM jdbc_table -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## 另请参阅 {#see-also} - -- [JDBC表函数](../../../sql_reference/table_functions/jdbc.md). - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) diff --git a/docs/zh/engines/table_engines/integrations/kafka.md b/docs/zh/engines/table_engines/integrations/kafka.md deleted file mode 100644 index bf50fd366a2..00000000000 --- a/docs/zh/engines/table_engines/integrations/kafka.md +++ /dev/null @@ -1,136 +0,0 @@ - -# 卡夫卡 {#kafka} - -此引擎与 [Apache Kafka](http://kafka.apache.org/) 结合使用。 - -Kafka 特性: - -- 发布或者订阅数据流。 -- 容错存储机制。 -- 处理流数据。 - - - -老版格式: - - Kafka(kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format - [, kafka_row_delimiter, kafka_schema, kafka_num_consumers]) - -新版格式: - - Kafka SETTINGS - kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic1,topic2', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_row_delimiter = '\n', - kafka_schema = '', - kafka_num_consumers = 2 - -必要参数: - -- `kafka_broker_list` – 以逗号分隔的 brokers 列表 (`localhost:9092`)。 -- `kafka_topic_list` – topic 列表 (`my_topic`)。 -- `kafka_group_name` – Kafka 消费组名称 (`group1`)。如果不希望消息在集群中重复,请在每个分片中使用相同的组名。 -- `kafka_format` – 消息体格式。使用与 SQL 部分的 `FORMAT` 函数相同表示方法,例如 `JSONEachRow`。了解详细信息,请参考 `Formats` 部分。 - -可选参数: - -- `kafka_row_delimiter` - 每个消息体(记录)之间的分隔符。 -- `kafka_schema` – 如果解析格式需要一个 schema 时,此参数必填。例如,[普罗托船长](https://capnproto.org/) 需要 schema 文件路径以及根对象 `schema.capnp:Message` 的名字。 -- `kafka_num_consumers` – 单个表的消费者数量。默认值是:`1`,如果一个消费者的吞吐量不足,则指定更多的消费者。消费者的总数不应该超过 topic 中分区的数量,因为每个分区只能分配一个消费者。 - -示例: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - SELECT * FROM queue LIMIT 5; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka SETTINGS kafka_broker_list = 'localhost:9092', - kafka_topic_list = 'topic', - kafka_group_name = 'group1', - kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; - - CREATE TABLE queue2 ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1') - SETTINGS kafka_format = 'JSONEachRow', - kafka_num_consumers = 4; -``` - -消费的消息会被自动追踪,因此每个消息在不同的消费组里只会记录一次。如果希望获得两次数据,则使用另一个组名创建副本。 - -消费组可以灵活配置并且在集群之间同步。例如,如果群集中有10个主题和5个表副本,则每个副本将获得2个主题。 如果副本数量发生变化,主题将自动在副本中重新分配。了解更多信息请访问 http://kafka.apache.org/intro。 - -`SELECT` 查询对于读取消息并不是很有用(调试除外),因为每条消息只能被读取一次。使用物化视图创建实时线程更实用。您可以这样做: - -1. 使用引擎创建一个 Kafka 消费者并作为一条数据流。 -2. 创建一个结构表。 -3. 创建物化视图,改视图会在后台转换引擎中的数据并将其放入之前创建的表中。 - -当 `MATERIALIZED VIEW` 添加至引擎,它将会在后台收集数据。可以持续不断地从 Kafka 收集数据并通过 `SELECT` 将数据转换为所需要的格式。 - -示例: - -``` sql - CREATE TABLE queue ( - timestamp UInt64, - level String, - message String - ) ENGINE = Kafka('localhost:9092', 'topic', 'group1', 'JSONEachRow'); - - CREATE TABLE daily ( - day Date, - level String, - total UInt64 - ) ENGINE = SummingMergeTree(day, (day, level), 8192); - - CREATE MATERIALIZED VIEW consumer TO daily - AS SELECT toDate(toDateTime(timestamp)) AS day, level, count() as total - FROM queue GROUP BY day, level; - - SELECT level, sum(total) FROM daily GROUP BY level; -``` - -为了提高性能,接受的消息被分组为 [max\_insert\_block\_size](../../../operations/settings/settings.md#settings-max_insert_block_size) 大小的块。如果未在 [stream\_flush\_interval\_ms](../../../operations/settings/settings.md) 毫秒内形成块,则不关心块的完整性,都会将数据刷新到表中。 - -停止接收主题数据或更改转换逻辑,请 detach 物化视图: - - DETACH TABLE consumer; - ATTACH TABLE consumer; - -如果使用 `ALTER` 更改目标表,为了避免目标表与视图中的数据之间存在差异,推荐停止物化视图。 - -## 配置 {#pei-zhi} - -与 `GraphiteMergeTree` 类似,Kafka 引擎支持使用ClickHouse配置文件进行扩展配置。可以使用两个配置键:全局 (`kafka`) 和 主题级别 (`kafka_*`)。首先应用全局配置,然后应用主题级配置(如果存在)。 - -``` xml - - - cgrp - smallest - - - - - 250 - 100000 - -``` - -有关详细配置选项列表,请参阅 [librdkafka配置参考](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md)。在 ClickHouse 配置中使用下划线 (`_`) ,并不是使用点 (`.`)。例如,`check.crcs=true` 将是 `true`。 - -[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/kafka/) diff --git a/docs/zh/engines/table_engines/integrations/mysql.md b/docs/zh/engines/table_engines/integrations/mysql.md deleted file mode 100644 index bfd3e6445a5..00000000000 --- a/docs/zh/engines/table_engines/integrations/mysql.md +++ /dev/null @@ -1,26 +0,0 @@ - -# MySQL {#mysql} - -MySQL 引擎可以对存储在远程 MySQL 服务器上的数据执行 `SELECT` 查询。 - -调用格式: - - MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); - -**调用参数** - -- `host:port` — MySQL 服务器地址。 -- `database` — 数据库的名称。 -- `table` — 表名称。 -- `user` — 数据库用户。 -- `password` — 用户密码。 -- `replace_query` — 将 `INSERT INTO` 查询是否替换为 `REPLACE INTO` 的标志。如果 `replace_query=1`,则替换查询 -- `'on_duplicate_clause'` — 将 `ON DUPLICATE KEY UPDATE 'on_duplicate_clause'` 表达式添加到 `INSERT` 查询语句中。例如:`impression = VALUES(impression) + impression`。如果需要指定 `'on_duplicate_clause'`,则需要设置 `replace_query=0`。如果同时设置 `replace_query = 1` 和 `'on_duplicate_clause'`,则会抛出异常。 - -此时,简单的 `WHERE` 子句(例如 `=, !=, >, >=, <, <=`)是在 MySQL 服务器上执行。 - -其余条件以及 `LIMIT` 采样约束语句仅在对MySQL的查询完成后才在ClickHouse中执行。 - -`MySQL` 引擎不支持 [可为空](../../../engines/table_engines/integrations/mysql.md) 数据类型,因此,当从MySQL表中读取数据时,`NULL` 将转换为指定列类型的默认值(通常为0或空字符串)。 - -[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/mysql/) diff --git a/docs/zh/engines/table_engines/integrations/odbc.md b/docs/zh/engines/table_engines/integrations/odbc.md deleted file mode 100644 index 1488ab0d856..00000000000 --- a/docs/zh/engines/table_engines/integrations/odbc.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 35 -toc_title: ODBC ---- - -# ODBC {#table-engine-odbc} - -允许ClickHouse通过以下方式连接到外部数据库 [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -为了安全地实现ODBC连接,ClickHouse使用单独的程序 `clickhouse-odbc-bridge`. 如果直接从ODBC驱动程序加载 `clickhouse-server`,驱动程序问题可能会导致ClickHouse服务器崩溃。 ClickHouse自动启动 `clickhouse-odbc-bridge` 当它是必需的。 ODBC桥程序是从相同的软件包作为安装 `clickhouse-server`. - -该引擎支持 [可为空](../../../sql_reference/data_types/nullable.md) 数据类型。 - -## 创建表 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1], - name2 [type2], - ... -) -ENGINE = ODBC(connection_settings, external_database, external_table) -``` - -请参阅的详细说明 [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) 查询。 - -表结构可以与源表结构不同: - -- 列名应与源表中的列名相同,但您可以按任何顺序使用其中的一些列。 -- 列类型可能与源表中的列类型不同。 ClickHouse尝试 [投](../../../sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) ClickHouse数据类型的值。 - -**发动机参数** - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` 文件 -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -## 用法示例 {#usage-example} - -**通过ODBC从本地MySQL安装中检索数据** - -此示例检查Ubuntu Linux18.04和MySQL服务器5.7。 - -确保安装了unixODBC和MySQL连接器。 - -默认情况下(如果从软件包安装),ClickHouse以用户身份启动 `clickhouse`. 因此,您需要在MySQL服务器中创建和配置此用户。 - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -然后配置连接 `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -您可以使用 `isql` unixodbc安装中的实用程序。 - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -MySQL中的表: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -ClickHouse中的表,从MySQL表中检索数据: - -``` sql -CREATE TABLE odbc_t -( - `int_id` Int32, - `float_nullable` Nullable(Float32) -) -ENGINE = ODBC('DSN=mysqlconn', 'test', 'test') -``` - -``` sql -SELECT * FROM odbc_t -``` - -``` text -┌─int_id─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ -└────────┴────────────────┘ -``` - -## 另请参阅 {#see-also} - -- [ODBC外部字典](../../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBC表函数](../../../sql_reference/table_functions/odbc.md) - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) diff --git a/docs/zh/engines/table_engines/log_family/log.md b/docs/zh/engines/table_engines/log_family/log.md deleted file mode 100644 index 90f892615c9..00000000000 --- a/docs/zh/engines/table_engines/log_family/log.md +++ /dev/null @@ -1,6 +0,0 @@ - -# 日志 {#log} - -日志与 TinyLog 的不同之处在于,«标记» 的小文件与列文件存在一起。这些标记写在每个数据块上,并且包含偏移量,这些偏移量指示从哪里开始读取文件以便跳过指定的行数。这使得可以在多个线程中读取表数据。对于并发数据访问,可以同时执行读取操作,而写入操作则阻塞读取和其它写入。Log 引擎不支持索引。同样,如果写入表失败,则该表将被破坏,并且从该表读取将返回错误。Log 引擎适用于临时数据,write-once 表以及测试或演示目的。 - -[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/log/) diff --git a/docs/zh/engines/table_engines/log_family/log_family.md b/docs/zh/engines/table_engines/log_family/log_family.md deleted file mode 100644 index 60cecab5faf..00000000000 --- a/docs/zh/engines/table_engines/log_family/log_family.md +++ /dev/null @@ -1,46 +0,0 @@ - -# 日志引擎系列 {#table_engines-log-engine-family} - -这些引擎是为了需要写入许多小数据量(少于一百万行)的表的场景而开发的。 - -这系列的引擎有: - -- [StripeLog](stripelog.md) -- [日志](log.md) -- [TinyLog](tinylog.md) - -## 共同属性 {#table_engines-log-engine-family-common-properties} - -引擎: - -- 数据存储在磁盘上。 - -- 写入时将数据追加在文件末尾。 - -- 不支持[突变](../../../engines/table_engines/log_family/log_family.md#alter-mutations)操作。 - -- 不支持索引。 - - 这意味着 `SELECT` 在范围查询时效率不高。 - -- 非原子地写入数据。 - - 如果某些事情破坏了写操作,例如服务器的异常关闭,你将会得到一张包含了损坏数据的表。 - -## 差异 {#table_engines-log-engine-family-differences} - -`Log` 和 `StripeLog` 引擎支持: - -- 并发访问数据的锁。 - - `INSERT` 请求执行过程中表会被锁定,并且其他的读写数据的请求都会等待直到锁定被解除。如果没有写数据的请求,任意数量的读请求都可以并发执行。 - -- 并行读取数据。 - - 在读取数据时,ClickHouse 使用多线程。 每个线程处理不同的数据块。 - -`Log` 引擎为表中的每一列使用不同的文件。`StripeLog` 将所有的数据存储在一个文件中。因此 `StripeLog` 引擎在操作系统中使用更少的描述符,但是 `Log` 引擎提供更高的读性能。 - -`TingLog` 引擎是该系列中最简单的引擎并且提供了最少的功能和最低的性能。`TingLog` 引擎不支持并行读取和并发数据访问,并将每一列存储在不同的文件中。它比其余两种支持并行读取的引擎的读取速度更慢,并且使用了和 `Log` 引擎同样多的描述符。你可以在简单的低负载的情景下使用它。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/log_family/) diff --git a/docs/zh/engines/table_engines/log_family/stripelog.md b/docs/zh/engines/table_engines/log_family/stripelog.md deleted file mode 100644 index ab4deb67ebb..00000000000 --- a/docs/zh/engines/table_engines/log_family/stripelog.md +++ /dev/null @@ -1,83 +0,0 @@ - -# StripeLog {#table_engines-stripelog} - -该引擎属于日志引擎系列。请在[日志引擎系列](log_family.md)文章中查看引擎的共同属性和差异。 - -在你需要写入许多小数据量(小于一百万行)的表的场景下使用这个引擎。 - -## 建表 {#table_engines-stripelog-creating-a-table} - - CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] - ( - column1_name [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - column2_name [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... - ) ENGINE = StripeLog - -查看[建表](../../../engines/table_engines/log_family/stripelog.md#create-table-query)请求的详细说明。 - -## 写数据 {#table_engines-stripelog-writing-the-data} - -`StripeLog` 引擎将所有列存储在一个文件中。对每一次 `Insert` 请求,ClickHouse 将数据块追加在表文件的末尾,逐列写入。 - -ClickHouse 为每张表写入以下文件: - -- `data.bin` — 数据文件。 -- `index.mrk` — 带标记的文件。标记包含了已插入的每个数据块中每列的偏移量。 - -`StripeLog` 引擎不支持 `ALTER UPDATE` 和 `ALTER DELETE` 操作。 - -## 读数据 {#table_engines-stripelog-reading-the-data} - -带标记的文件使得 ClickHouse 可以并行的读取数据。这意味着 `SELECT` 请求返回行的顺序是不可预测的。使用 `ORDER BY` 子句对行进行排序。 - -## 使用示例 {#table_engines-stripelog-example-of-use} - -建表: - -``` sql -CREATE TABLE stripe_log_table -( - timestamp DateTime, - message_type String, - message String -) -ENGINE = StripeLog -``` - -插入数据: - -``` sql -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The first regular message') -INSERT INTO stripe_log_table VALUES (now(),'REGULAR','The second regular message'),(now(),'WARNING','The first warning message') -``` - -我们使用两次 `INSERT` 请求从而在 `data.bin` 文件中创建两个数据块。 - -ClickHouse 在查询数据时使用多线程。每个线程读取单独的数据块并在完成后独立的返回结果行。这样的结果是,大多数情况下,输出中块的顺序和输入时相应块的顺序是不同的。例如: - -``` sql -SELECT * FROM stripe_log_table -``` - - ┌───────────timestamp─┬─message_type─┬─message────────────────────┐ - │ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ - │ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ - └─────────────────────┴──────────────┴────────────────────────────┘ - ┌───────────timestamp─┬─message_type─┬─message───────────────────┐ - │ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ - └─────────────────────┴──────────────┴───────────────────────────┘ - -对结果排序(默认增序): - -``` sql -SELECT * FROM stripe_log_table ORDER BY timestamp -``` - - ┌───────────timestamp─┬─message_type─┬─message────────────────────┐ - │ 2019-01-18 14:23:43 │ REGULAR │ The first regular message │ - │ 2019-01-18 14:27:32 │ REGULAR │ The second regular message │ - │ 2019-01-18 14:34:53 │ WARNING │ The first warning message │ - └─────────────────────┴──────────────┴────────────────────────────┘ - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/stripelog/) diff --git a/docs/zh/engines/table_engines/log_family/tinylog.md b/docs/zh/engines/table_engines/log_family/tinylog.md deleted file mode 100644 index 9a1b27fd418..00000000000 --- a/docs/zh/engines/table_engines/log_family/tinylog.md +++ /dev/null @@ -1,14 +0,0 @@ - -# TinyLog {#tinylog} - -最简单的表引擎,用于将数据存储在磁盘上。每列都存储在单独的压缩文件中。写入时,数据将附加到文件末尾。 - -并发数据访问不受任何限制: -- 如果同时从表中读取并在不同的查询中写入,则读取操作将抛出异常 -- 如果同时写入多个查询中的表,则数据将被破坏。 - -这种表引擎的典型用法是 write-once:首先只写入一次数据,然后根据需要多次读取。查询在单个流中执行。换句话说,此引擎适用于相对较小的表(建议最多1,000,000行)。如果您有许多小表,则使用此表引擎是适合的,因为它比Log引擎更简单(需要打开的文件更少)。当您拥有大量小表时,可能会导致性能低下,但在可能已经在其它 DBMS 时使用过,则您可能会发现切换使用 TinyLog 类型的表更容易。**不支持索引**。 - -在 Yandex.Metrica 中,TinyLog 表用于小批量处理的中间数据。 - -[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/tinylog/) diff --git a/docs/zh/engines/table_engines/mergetree_family/aggregatingmergetree.md b/docs/zh/engines/table_engines/mergetree_family/aggregatingmergetree.md deleted file mode 100644 index 2d898a5d168..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/aggregatingmergetree.md +++ /dev/null @@ -1,95 +0,0 @@ - -# AggregatingMergeTree {#aggregatingmergetree} - -该引擎继承自 [MergeTree](mergetree.md),并改变了数据片段的合并逻辑。 ClickHouse 会将相同主键的所有行(在一个数据片段内)替换为单个存储一系列聚合函数状态的行。 - -可以使用 `AggregatingMergeTree` 表来做增量数据统计聚合,包括物化视图的数据聚合。 - -引擎需使用 [AggregateFunction](../../../engines/table_engines/mergetree_family/aggregatingmergetree.md) 类型来处理所有列。 - -如果要按一组规则来合并减少行数,则使用 `AggregatingMergeTree` 是合适的。 - -## 建表 {#jian-biao} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = AggregatingMergeTree() -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -语句参数的说明,请参阅 [语句描述](../../../engines/table_engines/mergetree_family/aggregatingmergetree.md)。 - -**子句** - -创建 `AggregatingMergeTree` 表时,需用跟创建 `MergeTree` 表一样的[子句](mergetree.md)。 - -
- -已弃用的建表方法 - -!!! 注意 "注意" - 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] AggregatingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity) -``` - -上面的所有参数跟 `MergeTree` 中的一样。 -
- -## SELECT 和 INSERT {#select-he-insert} - -插入数据,需使用带有聚合 -State- 函数的 [INSERT SELECT](../../../engines/table_engines/mergetree_family/aggregatingmergetree.md) 语句。 -从 `AggregatingMergeTree` 表中查询数据时,需使用 `GROUP BY` 子句并且要使用与插入时相同的聚合函数,但后缀要改为 `-Merge` 。 - -在 `SELECT` 查询的结果中,对于 ClickHouse 的所有输出格式 `AggregateFunction` 类型的值都实现了特定的二进制表示法。如果直接用 `SELECT` 导出这些数据,例如如用 `TabSeparated` 格式,那么这些导出数据也能直接用 `INSERT` 语句加载导入。 - -## 聚合物化视图的示例 {#ju-he-wu-hua-shi-tu-de-shi-li} - -创建一个跟踪 `test.visits` 表的 `AggregatingMergeTree` 物化视图: - -``` sql -CREATE MATERIALIZED VIEW test.basic -ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate) -AS SELECT - CounterID, - StartDate, - sumState(Sign) AS Visits, - uniqState(UserID) AS Users -FROM test.visits -GROUP BY CounterID, StartDate; -``` - -向 `test.visits` 表中插入数据。 - -``` sql -INSERT INTO test.visits ... -``` - -数据会同时插入到表和视图中,并且视图 `test.basic` 会将里面的数据聚合。 - -要获取聚合数据,我们需要在 `test.basic` 视图上执行类似 `SELECT ... GROUP BY ...` 这样的查询 : - -``` sql -SELECT - StartDate, - sumMerge(Visits) AS Visits, - uniqMerge(Users) AS Users -FROM test.basic -GROUP BY StartDate -ORDER BY StartDate; -``` - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/aggregatingmergetree/) diff --git a/docs/zh/engines/table_engines/mergetree_family/collapsingmergetree.md b/docs/zh/engines/table_engines/mergetree_family/collapsingmergetree.md deleted file mode 100644 index 85b5ce076e8..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/collapsingmergetree.md +++ /dev/null @@ -1,207 +0,0 @@ - -# 折叠树 {#table_engine-collapsingmergetree} - -该引擎继承于 [MergeTree](mergetree.md),并在数据块合并算法中添加了折叠行的逻辑。 - -`CollapsingMergeTree` 会异步的删除(折叠)这些除了特定列 `Sign` 有 `1` 和 `-1` 的值以外,其余所有字段的值都相等的成对的行。没有成对的行会被保留。更多的细节请看本文的[折叠](#table_engine-collapsingmergetree-collapsing)部分。 - -因此,该引擎可以显著的降低存储量并提高 `SELECT` 查询效率。 - -## 建表 {#jian-biao} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = CollapsingMergeTree(sign) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -请求参数的描述,参考[请求参数](../../../engines/table_engines/mergetree_family/collapsingmergetree.md)。 - -**CollapsingMergeTree 参数** - -- `sign` — 类型列的名称: `1` 是«状态»行,`-1` 是«取消»行。 - - 列数据类型 — `Int8`。 - -**子句** - -创建 `CollapsingMergeTree` 表时,需要与创建 `MergeTree` 表时相同的[子句](mergetree.md#table_engine-mergetree-creating-a-table)。 - -
- -已弃用的建表方法 - -!!! attention "注意" - 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] CollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign) -``` - -除了 `sign` 的所有参数都与 `MergeTree` 中的含义相同。 - -- `sign` — 类型列的名称: `1` 是«状态»行,`-1` 是«取消»行。 - - 列数据类型 — `Int8`。 - -
- -## 折叠 {#table_engine-collapsingmergetree-collapsing} - -### 数据 {#shu-ju} - -考虑你需要为某个对象保存不断变化的数据的情景。似乎为一个对象保存一行记录并在其发生任何变化时更新记录是合乎逻辑的,但是更新操作对 DBMS 来说是昂贵且缓慢的,因为它需要重写存储中的数据。如果你需要快速的写入数据,则更新操作是不可接受的,但是你可以按下面的描述顺序地更新一个对象的变化。 - -在写入行的时候使用特定的列 `Sign`。如果 `Sign = 1` 则表示这一行是对象的状态,我们称之为«状态»行。如果 `Sign = -1` 则表示是对具有相同属性的状态行的取消,我们称之为«取消»行。 - -例如,我们想要计算用户在某个站点访问的页面页面数以及他们在那里停留的时间。在某个时候,我们将用户的活动状态写入下面这样的行。 - - ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ - │ 4324182021466249494 │ 5 │ 146 │ 1 │ - └─────────────────────┴───────────┴──────────┴──────┘ - -一段时间后,我们写入下面的两行来记录用户活动的变化。 - - ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ - │ 4324182021466249494 │ 5 │ 146 │ -1 │ - │ 4324182021466249494 │ 6 │ 185 │ 1 │ - └─────────────────────┴───────────┴──────────┴──────┘ - -第一行取消了这个对象(用户)的状态。它需要复制被取消的状态行的所有除了 `Sign` 的属性。 - -第二行包含了当前的状态。 - -因为我们只需要用户活动的最后状态,这些行 - - ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ - │ 4324182021466249494 │ 5 │ 146 │ 1 │ - │ 4324182021466249494 │ 5 │ 146 │ -1 │ - └─────────────────────┴───────────┴──────────┴──────┘ - -可以在折叠对象的失效(老的)状态的时候被删除。`CollapsingMergeTree` 会在合并数据片段的时候做这件事。 - -为什么我们每次改变需要 2 行可以阅读[算法](#table_engine-collapsingmergetree-collapsing-algorithm)段。 - -**这种方法的特殊属性** - -1. 写入的程序应该记住对象的状态从而可以取消它。«取消»字符串应该是«状态»字符串的复制,除了相反的 `Sign`。它增加了存储的初始数据的大小,但使得写入数据更快速。 -2. 由于写入的负载,列中长的增长阵列会降低引擎的效率。数据越简单,效率越高。 -3. `SELECT` 的结果很大程度取决于对象变更历史的一致性。在准备插入数据时要准确。在不一致的数据中会得到不可预料的结果,例如,像会话深度这种非负指标的负值。 - -### 算法 {#table_engine-collapsingmergetree-collapsing-algorithm} - -当 ClickHouse 合并数据片段时,每组具有相同主键的连续行被减少到不超过两行,一行 `Sign = 1`(«状态»行),另一行 `Sign = -1` («取消»行),换句话说,数据项被折叠了。 - -对每个结果的数据部分 ClickHouse 保存: - - 1. 第一个«取消»和最后一个«状态»行,如果«状态»和«取消»行的数量匹配和最后一个行是«状态»行 - 2. 最后一个«状态»行,如果«状态»行比«取消»行多一个或一个以上。 - 3. 第一个«取消»行,如果«取消»行比«状态»行多一个或一个以上。 - 4. 没有行,在其他所有情况下。 - - 合并会继续,但是 ClickHouse 会把此情况视为逻辑错误并将其记录在服务日志中。这个错误会在相同的数据被插入超过一次时出现。 - -因此,折叠不应该改变统计数据的结果。 -变化逐渐地被折叠,因此最终几乎每个对象都只剩下了最后的状态。 - -`Sign` 是必须的因为合并算法不保证所有有相同主键的行都会在同一个结果数据片段中,甚至是在同一台物理服务器上。ClickHouse 用多线程来处理 `SELECT` 请求,所以它不能预测结果中行的顺序。如果要从 `CollapsingMergeTree` 表中获取完全«折叠»后的数据,则需要聚合。 - -要完成折叠,请使用 `GROUP BY` 子句和用于处理符号的聚合函数编写请求。例如,要计算数量,使用 `sum(Sign)` 而不是 `count()`。要计算某物的总和,使用 `sum(Sign * x)` 而不是 `sum(x)`,并添加 `HAVING sum(Sign) > 0` 子句。 - -聚合体 `count`,`sum` 和 `avg` 可以用这种方式计算。如果一个对象至少有一个未被折叠的状态,则可以计算 `uniq` 聚合。`min` 和 `max` 聚合无法计算,因为 `CollaspingMergeTree` 不会保存折叠状态的值的历史记录。 - -如果你需要在不进行聚合的情况下获取数据(例如,要检查是否存在最新值与特定条件匹配的行),你可以在 `FROM` 从句中使用 `FINAL` 修饰符。这种方法显然是更低效的。 - -## 示例 {#shi-li} - -示例数据: - - ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ - │ 4324182021466249494 │ 5 │ 146 │ 1 │ - │ 4324182021466249494 │ 5 │ 146 │ -1 │ - │ 4324182021466249494 │ 6 │ 185 │ 1 │ - └─────────────────────┴───────────┴──────────┴──────┘ - -建表: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8 -) -ENGINE = CollapsingMergeTree(Sign) -ORDER BY UserID -``` - -插入数据: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, 6, 185, 1) -``` - -我们使用两次 `INSERT` 请求来创建两个不同的数据片段。如果我们使用一个请求插入数据,ClickHouse 只会创建一个数据片段且不会执行任何合并操作。 - -获取数据: - - SELECT * FROM UAct - - ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ - │ 4324182021466249494 │ 5 │ 146 │ -1 │ - │ 4324182021466249494 │ 6 │ 185 │ 1 │ - └─────────────────────┴───────────┴──────────┴──────┘ - ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ - │ 4324182021466249494 │ 5 │ 146 │ 1 │ - └─────────────────────┴───────────┴──────────┴──────┘ - -我们看到了什么,哪里有折叠? - -通过两个 `INSERT` 请求,我们创建了两个数据片段。`SELECT` 请求在两个线程中被执行,我们得到了随机顺序的行。没有发生折叠是因为还没有合并数据片段。ClickHouse 在一个我们无法预料的未知时刻合并数据片段。 - -因此我们需要聚合: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration -FROM UAct -GROUP BY UserID -HAVING sum(Sign) > 0 -``` - - ┌──────────────UserID─┬─PageViews─┬─Duration─┐ - │ 4324182021466249494 │ 6 │ 185 │ - └─────────────────────┴───────────┴──────────┘ - -如果我们不需要聚合并想要强制进行折叠,我们可以在 `FROM` 从句中使用 `FINAL` 修饰语。 - -``` sql -SELECT * FROM UAct FINAL -``` - - ┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┐ - │ 4324182021466249494 │ 6 │ 185 │ 1 │ - └─────────────────────┴───────────┴──────────┴──────┘ - -这种查询数据的方法是非常低效的。不要在大表中使用它。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/collapsingmergetree/) 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 deleted file mode 100644 index 3844506c782..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/custom_partitioning_key.md +++ /dev/null @@ -1,117 +0,0 @@ - -# 自定义分区键 {#zi-ding-yi-fen-qu-jian} - -[MergeTree](mergetree.md) 系列的表(包括 [可复制表](replication.md) )可以使用分区。基于 MergeTree 表的 [物化视图](../special/materializedview.md) 也支持分区。 - -一个分区是指按指定规则逻辑组合一起的表的记录集。可以按任意标准进行分区,如按月,按日或按事件类型。为了减少需要操作的数据,每个分区都是分开存储的。访问数据时,ClickHouse 尽量使用这些分区的最小子集。 - -分区是在 [建表](mergetree.md#table_engine-mergetree-creating-a-table) 的 `PARTITION BY expr` 子句中指定。分区键可以是关于列的任何表达式。例如,指定按月分区,表达式为 `toYYYYMM(date_column)`: - -``` sql -CREATE TABLE visits -( - VisitDate Date, - Hour UInt8, - ClientID UUID -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(VisitDate) -ORDER BY Hour; -``` - -分区键也可以是表达式元组(类似 [主键](mergetree.md#primary-keys-and-indexes-in-queries) )。例如: - -``` sql -ENGINE = ReplicatedCollapsingMergeTree('/clickhouse/tables/name', 'replica1', Sign) -PARTITION BY (toMonday(StartDate), EventType) -ORDER BY (CounterID, StartDate, intHash32(UserID)); -``` - -上例中,我们设置按一周内的事件类型分区。 - -新数据插入到表中时,这些数据会存储为按主键排序的新片段(块)。插入后 10-15 分钟,同一分区的各个片段会合并为一整个片段。 - -!!! attention "注意" - 那些有相同分区表达式值的数据片段才会合并。这意味着 **你不应该用太精细的分区方案**(超过一千个分区)。否则,会因为文件系统中的文件数量和需要找开的文件描述符过多,导致 `SELECT` 查询效率不佳。 - -可以通过 [系统。零件](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#system_tables-parts) 表查看表片段和分区信息。例如,假设我们有一个 `visits` 表,按月分区。对 `system.parts` 表执行 `SELECT`: - -``` sql -SELECT - partition, - name, - active -FROM system.parts -WHERE table = 'visits' -``` - - ┌─partition─┬─name───────────┬─active─┐ - │ 201901 │ 201901_1_3_1 │ 0 │ - │ 201901 │ 201901_1_9_2 │ 1 │ - │ 201901 │ 201901_8_8_0 │ 0 │ - │ 201901 │ 201901_9_9_0 │ 0 │ - │ 201902 │ 201902_4_6_1 │ 1 │ - │ 201902 │ 201902_10_10_0 │ 1 │ - │ 201902 │ 201902_11_11_0 │ 1 │ - └───────────┴────────────────┴────────┘ - -`partition` 列存储分区的名称。此示例中有两个分区:`201901` 和 `201902`。在 [ALTER … PARTITION](#alter_manipulations-with-partitions) 语句中你可以使用该列值来指定分区名称。 - -`name` 列为分区中数据片段的名称。在 [ALTER ATTACH PART](#alter_attach-partition) 语句中你可以使用此列值中来指定片段名称。 - -这里我们拆解下第一部分的名称:`201901_1_3_1`: - -- `201901` 是分区名称。 -- `1` 是数据块的最小编号。 -- `3` 是数据块的最大编号。 -- `1` 是块级别(即在由块组成的合并树中,该块在树中的深度)。 - -!!! attention "注意" - 旧类型表的片段名称为:`20190117_20190123_2_2_0`(最小日期 - 最大日期 - 最小块编号 - 最大块编号 - 块级别)。 - -`active` 列为片段状态。`1` 激活状态;`0` 非激活状态。非激活片段是那些在合并到较大片段之后剩余的源数据片段。损坏的数据片段也表示为非活动状态。 - -正如在示例中所看到的,同一分区中有几个独立的片段(例如,`201901_1_3_1`和`201901_1_9_2`)。这意味着这些片段尚未合并。ClickHouse 大约在插入后15分钟定期报告合并操作,合并插入的数据片段。此外,你也可以使用 [OPTIMIZE](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#misc_operations-optimize) 语句直接执行合并。例: - -``` sql -OPTIMIZE TABLE visits PARTITION 201902; -``` - - ┌─partition─┬─name───────────┬─active─┐ - │ 201901 │ 201901_1_3_1 │ 0 │ - │ 201901 │ 201901_1_9_2 │ 1 │ - │ 201901 │ 201901_8_8_0 │ 0 │ - │ 201901 │ 201901_9_9_0 │ 0 │ - │ 201902 │ 201902_4_6_1 │ 0 │ - │ 201902 │ 201902_4_11_2 │ 1 │ - │ 201902 │ 201902_10_10_0 │ 0 │ - │ 201902 │ 201902_11_11_0 │ 0 │ - └───────────┴────────────────┴────────┘ - -非激活片段会在合并后的10分钟左右删除。 - -查看片段和分区信息的另一种方法是进入表的目录:`/var/lib/clickhouse/data///`。例如: - -``` bash -dev:/var/lib/clickhouse/data/default/visits$ ls -l -total 40 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 201901_1_3_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201901_1_9_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_8_8_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 15:52 201901_9_9_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_10_10_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:17 201902_11_11_0 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 16:19 201902_4_11_2 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 5 12:09 201902_4_6_1 -drwxr-xr-x 2 clickhouse clickhouse 4096 Feb 1 16:48 detached -``` - -文件夹 ‘201901\_1\_1\_0’,‘201901\_1\_7\_1’ 等是片段的目录。每个片段都与一个对应的分区相关,并且只包含这个月的数据(本例中的表按月分区)。 - -`detached` 目录存放着使用 [DETACH](#alter_detach-partition) 语句从表中分离的片段。损坏的片段也会移到该目录,而不是删除。服务器不使用`detached`目录中的片段。可以随时添加,删除或修改此目录中的数据 – 在运行 [ATTACH](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#alter_attach-partition) 语句前,服务器不会感知到。 - -注意,在操作服务器时,你不能手动更改文件系统上的片段集或其数据,因为服务器不会感知到这些修改。对于非复制表,可以在服务器停止时执行这些操作,但不建议这样做。对于复制表,在任何情况下都不要更改片段文件。 - -ClickHouse 支持对分区执行这些操作:删除分区,从一个表复制到另一个表,或创建备份。了解分区的所有操作,请参阅 [分区和片段的操作](../../../engines/table_engines/mergetree_family/custom_partitioning_key.md#alter_manipulations-with-partitions) 一节。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/custom_partitioning_key/) diff --git a/docs/zh/engines/table_engines/mergetree_family/graphitemergetree.md b/docs/zh/engines/table_engines/mergetree_family/graphitemergetree.md deleted file mode 100644 index b578414a203..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/graphitemergetree.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 38 -toc_title: GraphiteMergeTree ---- - -# GraphiteMergeTree {#graphitemergetree} - -此引擎专为细化和聚合/平均(rollup) [石墨](http://graphite.readthedocs.io/en/latest/index.html) 戴达 对于想要使用ClickHouse作为Graphite的数据存储的开发人员来说,这可能会有所帮助。 - -您可以使用任何ClickHouse表引擎来存储石墨数据,如果你不需要汇总,但如果你需要一个汇总使用 `GraphiteMergeTree`. 该引擎减少了存储量,并提高了Graphite查询的效率。 - -引擎继承从属性 [MergeTree](mergetree.md). - -## 创建表 {#creating-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE = GraphiteMergeTree(config_section) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -请参阅的详细说明 [CREATE TABLE](../../../sql_reference/statements/create.md#create-table-query) 查询。 - -Graphite数据的表应具有以下数据的列: - -- 公制名称(石墨传感器)。 数据类型: `String`. - -- 测量度量的时间。 数据类型: `DateTime`. - -- 度量值。 数据类型:任何数字。 - -- 指标的版本。 数据类型:任何数字。 - - 如果版本相同,ClickHouse会保存版本最高或最后写入的行。 其他行在数据部分合并期间被删除。 - -应在汇总配置中设置这些列的名称。 - -**GraphiteMergeTree参数** - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -**查询子句** - -当创建一个 `GraphiteMergeTree` 表,相同 [条款](mergetree.md#table_engine-mergetree-creating-a-table) 是必需的,因为当创建 `MergeTree` 桌子 - -
- -不推荐使用的创建表的方法 - -!!! attention "注意" - 不要在新项目中使用此方法,如果可能的话,请将旧项目切换到上述方法。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - EventDate Date, - Path String, - Time DateTime, - Value , - Version - ... -) ENGINE [=] GraphiteMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, config_section) -``` - -所有参数除外 `config_section` 具有相同的含义 `MergeTree`. - -- `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - -
- -## 汇总配置 {#rollup-configuration} - -汇总的设置由 [graphite\_rollup](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) 服务器配置中的参数。 参数的名称可以是any。 您可以创建多个配置并将它们用于不同的表。 - -汇总配置结构: - - required-columns - patterns - -### 必填列 {#required-columns} - -- `path_column_name` — The name of the column storing the metric name (Graphite sensor). Default value: `Path`. -- `time_column_name` — The name of the column storing the time of measuring the metric. Default value: `Time`. -- `value_column_name` — The name of the column storing the value of the metric at the time set in `time_column_name`. 默认值: `Value`. -- `version_column_name` — The name of the column storing the version of the metric. Default value: `Timestamp`. - -### 模式 {#patterns} - -的结构 `patterns` 科: - -``` text -pattern - regexp - function -pattern - regexp - age + precision - ... -pattern - regexp - function - age + precision - ... -pattern - ... -default - function - age + precision - ... -``` - -!!! warning "注意" - 模式必须严格排序: - - 1. Patterns without `function` or `retention`. - 1. Patterns with both `function` and `retention`. - 1. Pattern `default`. - -在处理行时,ClickHouse会检查以下内容中的规则 `pattern` 部分。 每个 `pattern` (包括 `default`)部分可以包含 `function` 聚合参数, `retention` 参数或两者兼而有之。 如果指标名称匹配 `regexp`,从规则 `pattern` 部分(sections节)的应用;否则,从规则 `default` 部分被使用。 - -字段为 `pattern` 和 `default` 科: - -- `regexp`– A pattern for the metric name. -- `age` – The minimum age of the data in seconds. -- `precision`– How precisely to define the age of the data in seconds. Should be a divisor for 86400 (seconds in a day). -- `function` – The name of the aggregating function to apply to data whose age falls within the range `[age, age + precision]`. - -### 配置示例 {#configuration-example} - -``` xml - - Version - - click_cost - any - - 0 - 5 - - - 86400 - 60 - - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/graphitemergetree/) diff --git a/docs/zh/engines/table_engines/mergetree_family/mergetree.md b/docs/zh/engines/table_engines/mergetree_family/mergetree.md deleted file mode 100644 index 5dcbd090176..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/mergetree.md +++ /dev/null @@ -1,395 +0,0 @@ - -# MergeTree {#table_engines-mergetree} - -Clickhouse 中最强大的表引擎当属 `MergeTree` (合并树)引擎及该系列(`*MergeTree`)中的其他引擎。 - -`MergeTree` 引擎系列的基本理念如下。当你有巨量数据要插入到表中,你要高效地一批批写入数据片段,并希望这些数据片段在后台按照一定规则合并。相比在插入时不断修改(重写)数据进存储,这种策略会高效很多。 - -主要特点: - -- 存储的数据按主键排序。 - - 这让你可以创建一个用于快速检索数据的小稀疏索引。 - -- 允许使用分区,如果指定了 [分区键](custom_partitioning_key.md) 的话。 - - 在相同数据集和相同结果集的情况下 ClickHouse 中某些带分区的操作会比普通操作更快。查询中指定了分区键时 ClickHouse 会自动截取分区数据。这也有效增加了查询性能。 - -- 支持数据副本。 - - `ReplicatedMergeTree` 系列的表便是用于此。更多信息,请参阅 [数据副本](replication.md) 一节。 - -- 支持数据采样。 - - 需要的话,你可以给表设置一个采样方法。 - -!!! 注意 "注意" - [合并](../special/merge.md) 引擎并不属于 `*MergeTree` 系列。 - -## 建表 {#table_engine-mergetree-creating-a-table} - - CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] - ( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... - INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1, - INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2 - ) ENGINE = MergeTree() - [PARTITION BY expr] - [ORDER BY expr] - [PRIMARY KEY expr] - [SAMPLE BY expr] - [SETTINGS name=value, ...] - -请求参数的描述,参考 [请求描述](../../../engines/table_engines/mergetree_family/mergetree.md) 。 - - - -**子句** - -- `ENGINE` - 引擎名和参数。 `ENGINE = MergeTree()`. `MergeTree` 引擎没有参数。 - -- `PARTITION BY` — [分区键](custom_partitioning_key.md) 。 - - 要按月分区,可以使用表达式 `toYYYYMM(date_column)` ,这里的 `date_column` 是一个 [Date](../../../engines/table_engines/mergetree_family/mergetree.md) 类型的列。这里该分区名格式会是 `"YYYYMM"` 这样。 - -- `ORDER BY` — 表的排序键。 - - 可以是一组列的元组或任意的表达式。 例如: `ORDER BY (CounterID, EventDate)` 。 - -- `PRIMARY KEY` - 主键,如果要设成 [跟排序键不相同](#xuan-ze-gen-pai-xu-jian-bu-yi-yang-zhu-jian)。 - - 默认情况下主键跟排序键(由 `ORDER BY` 子句指定)相同。 - 因此,大部分情况下不需要再专门指定一个 `PRIMARY KEY` 子句。 - -- `SAMPLE BY` — 用于抽样的表达式。 - - 如果要用抽样表达式,主键中必须包含这个表达式。例如: - `SAMPLE BY intHash32(UserID) ORDER BY (CounterID, EventDate, intHash32(UserID))` 。 - -- `SETTINGS` — 影响 `MergeTree` 性能的额外参数: - - - `index_granularity` — 索引粒度。即索引中相邻『标记』间的数据行数。默认值,8192 。该列表中所有可用的参数可以从这里查看 [MergeTreeSettings.h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Storages/MergeTree/MergeTreeSettings.h) 。 - - `index_granularity_bytes` — 索引粒度,以字节为单位,默认值: 10Mb。如果仅按数据行数限制索引粒度, 请设置为0(不建议)。 - - `enable_mixed_granularity_parts` — 启用或禁用通过 `index_granularity_bytes` 控制索引粒度的大小。在19.11版本之前, 只有 `index_granularity` 配置能够用于限制索引粒度的大小。当从大表(数十或数百兆)中查询数据时候,`index_granularity_bytes` 配置能够提升ClickHouse的性能。如果你的表内数据量很大,可以开启这项配置用以提升`SELECT` 查询的性能。 - - `use_minimalistic_part_header_in_zookeeper` — 数据片段头在 ZooKeeper 中的存储方式。如果设置了 `use_minimalistic_part_header_in_zookeeper=1` ,ZooKeeper 会存储更少的数据。更多信息参考『服务配置参数』这章中的 [设置描述](../../../operations/server_configuration_parameters/settings.md#server-settings-use_minimalistic_part_header_in_zookeeper) 。 - - `min_merge_bytes_to_use_direct_io` — 使用直接 I/O 来操作磁盘的合并操作时要求的最小数据量。合并数据片段时,ClickHouse 会计算要被合并的所有数据的总存储空间。如果大小超过了 `min_merge_bytes_to_use_direct_io` 设置的字节数,则 ClickHouse 将使用直接 I/O 接口(`O_DIRECT` 选项)对磁盘读写。如果设置 `min_merge_bytes_to_use_direct_io = 0` ,则会禁用直接 I/O。默认值:`10 * 1024 * 1024 * 1024` 字节。 - - - `merge_with_ttl_timeout` — TTL合并频率的最小间隔时间。默认值: 86400 (1 天)。 - - `write_final_mark` — 启用或禁用在数据片段尾部写入最终索引标记。默认值: 1(不建议更改)。 - - `storage_policy` — 存储策略。 参见 [使用多个区块装置进行数据存储](#table_engine-mergetree-multiple-volumes). - -**示例配置** - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity=8192 - -示例中,我们设为按月分区。 - -同时我们设置了一个按用户ID哈希的抽样表达式。这让你可以有该表中每个 `CounterID` 和 `EventDate` 下面的数据的伪随机分布。如果你在查询时指定了 [SAMPLE](../../../engines/table_engines/mergetree_family/mergetree.md#select-sample-clause) 子句。 ClickHouse会返回对于用户子集的一个均匀的伪随机数据采样。 - -`index_granularity` 可省略,默认值为 8192 。 - -
- -已弃用的建表方法 - -!!! attention "注意" - 不要在新版项目中使用该方法,可能的话,请将旧项目切换到上述方法。 - - CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] - ( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... - ) ENGINE [=] MergeTree(date-column [, sampling_expression], (primary, key), index_granularity) - -**MergeTree() 参数** - -- `date-column` — 类型为 [日期](../../../engines/table_engines/mergetree_family/mergetree.md) 的列名。ClickHouse 会自动依据这个列按月创建分区。分区名格式为 `"YYYYMM"` 。 -- `sampling_expression` — 采样表达式。 -- `(primary, key)` — 主键。类型 — [元组()](../../../engines/table_engines/mergetree_family/mergetree.md) -- `index_granularity` — 索引粒度。即索引中相邻『标记』间的数据行数。设为 8192 可以适用大部分场景。 - -**示例** - - MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID)), 8192) - -对于主要的配置方法,这里 `MergeTree` 引擎跟前面的例子一样,可以以同样的方式配置。 -
- -## 数据存储 {#mergetree-data-storage} - -表由按主键排序的数据 *片段* 组成。 - -当数据被插入到表中时,会分成数据片段并按主键的字典序排序。例如,主键是 `(CounterID, Date)` 时,片段中数据按 `CounterID` 排序,具有相同 `CounterID` 的部分按 `Date` 排序。 - -不同分区的数据会被分成不同的片段,ClickHouse 在后台合并数据片段以便更高效存储。不会合并来自不同分区的数据片段。这个合并机制并不保证相同主键的所有行都会合并到同一个数据片段中。 - -ClickHouse 会为每个数据片段创建一个索引文件,索引文件包含每个索引行(『标记』)的主键值。索引行号定义为 `n * index_granularity` 。最大的 `n` 等于总行数除以 `index_granularity` 的值的整数部分。对于每列,跟主键相同的索引行处也会写入『标记』。这些『标记』让你可以直接找到数据所在的列。 - -你可以只用一单一大表并不断地一块块往里面加入数据 – `MergeTree` 引擎的就是为了这样的场景。 - -## 主键和索引在查询中的表现 {#primary-keys-and-indexes-in-queries} - -我们以 `(CounterID, Date)` 以主键。排序好的索引的图示会是下面这样: - - 全部数据 : [-------------------------------------------------------------------------] - CounterID: [aaaaaaaaaaaaaaaaaabbbbcdeeeeeeeeeeeeefgggggggghhhhhhhhhiiiiiiiiikllllllll] - Date: [1111111222222233331233211111222222333211111112122222223111112223311122333] - 标记: | | | | | | | | | | | - a,1 a,2 a,3 b,3 e,2 e,3 g,1 h,2 i,1 i,3 l,3 - 标记号: 0 1 2 3 4 5 6 7 8 9 10 - -如果指定查询如下: - -- `CounterID in ('a', 'h')`,服务器会读取标记号在 `[0, 3)` 和 `[6, 8)` 区间中的数据。 -- `CounterID IN ('a', 'h') AND Date = 3`,服务器会读取标记号在 `[1, 3)` 和 `[7, 8)` 区间中的数据。 -- `Date = 3`,服务器会读取标记号在 `[1, 10]` 区间中的数据。 - -上面例子可以看出使用索引通常会比全表描述要高效。 - -稀疏索引会引起额外的数据读取。当读取主键单个区间范围的数据时,每个数据块中最多会多读 `index_granularity * 2` 行额外的数据。大部分情况下,当 `index_granularity = 8192` 时,ClickHouse的性能并不会降级。 - -稀疏索引让你能操作有巨量行的表。因为这些索引是常驻内存(RAM)的。 - -ClickHouse 不要求主键惟一。所以,你可以插入多条具有相同主键的行。 - -### 主键的选择 {#zhu-jian-de-xuan-ze} - -主键中列的数量并没有明确的限制。依据数据结构,你应该让主键包含多些或少些列。这样可以: - -- 改善索引的性能。 - - 如果当前主键是 `(a, b)` ,然后加入另一个 `c` 列,满足下面条件时,则可以改善性能: - - 有带有 `c` 列条件的查询。 - - 很长的数据范围( `index_granularity` 的数倍)里 `(a, b)` 都是相同的值,并且这种的情况很普遍。换言之,就是加入另一列后,可以让你的查询略过很长的数据范围。 - -- 改善数据压缩。 - - ClickHouse 以主键排序片段数据,所以,数据的一致性越高,压缩越好。 - -- [折叠树](collapsingmergetree.md#table_engine-collapsingmergetree) 和 [SummingMergeTree](summingmergetree.md) 引擎里,数据合并时,会有额外的处理逻辑。 - - 在这种情况下,指定一个跟主键不同的 *排序键* 也是有意义的。 - -长的主键会对插入性能和内存消耗有负面影响,但主键中额外的列并不影响 `SELECT` 查询的性能。 - -### 选择跟排序键不一样主键 {#xuan-ze-gen-pai-xu-jian-bu-yi-yang-zhu-jian} - -指定一个跟排序键(用于排序数据片段中行的表达式) -不一样的主键(用于计算写到索引文件的每个标记值的表达式)是可以的。 -这种情况下,主键表达式元组必须是排序键表达式元组的一个前缀。 - -当使用 [SummingMergeTree](summingmergetree.md) 和 -[AggregatingMergeTree](aggregatingmergetree.md) 引擎时,这个特性非常有用。 -通常,使用这类引擎时,表里列分两种:*维度* 和 *度量* 。 -典型的查询是在 `GROUP BY` 并过虑维度的情况下统计度量列的值。 -像 SummingMergeTree 和 AggregatingMergeTree ,用相同的排序键值统计行时, -通常会加上所有的维度。结果就是,这键的表达式会是一长串的列组成, -并且这组列还会因为新加维度必须频繁更新。 - -这种情况下,主键中仅预留少量列保证高效范围扫描, -剩下的维度列放到排序键元组里。这样是合理的。 - -[排序键的修改](../../../engines/table_engines/mergetree_family/mergetree.md) 是轻量级的操作,因为一个新列同时被加入到表里和排序键后时,已存在的数据片段并不需要修改。由于旧的排序键是新排序键的前缀,并且刚刚添加的列中没有数据,因此在表修改时的数据对于新旧的排序键来说都是有序的。 - -### 索引和分区在查询中的应用 {#suo-yin-he-fen-qu-zai-cha-xun-zhong-de-ying-yong} - -对于 `SELECT` 查询,ClickHouse 分析是否可以使用索引。如果 `WHERE/PREWHERE` 子句具有下面这些表达式(作为谓词链接一子项或整个)则可以使用索引:基于主键或分区键的列或表达式的部分的等式或比较运算表达式;基于主键或分区键的列或表达式的固定前缀的 `IN` 或 `LIKE` 表达式;基于主键或分区键的列的某些函数;基于主键或分区键的表达式的逻辑表达式。 - -因此,在索引键的一个或多个区间上快速地跑查询都是可能的。下面例子中,指定标签;指定标签和日期范围;指定标签和日期;指定多个标签和日期范围等运行查询,都会非常快。 - -当引擎配置如下时: - - ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate) SETTINGS index_granularity=8192 - -这种情况下,这些查询: - -``` sql -SELECT count() FROM table WHERE EventDate = toDate(now()) AND CounterID = 34 -SELECT count() FROM table WHERE EventDate = toDate(now()) AND (CounterID = 34 OR CounterID = 42) -SELECT count() FROM table WHERE ((EventDate >= toDate('2014-01-01') AND EventDate <= toDate('2014-01-31')) OR EventDate = toDate('2014-05-01')) AND CounterID IN (101500, 731962, 160656) AND (CounterID = 101500 OR EventDate != toDate('2014-05-01')) -``` - -ClickHouse 会依据主键索引剪掉不符合的数据,依据按月分区的分区键剪掉那些不包含符合数据的分区。 - -上文的查询显示,即使索引用于复杂表达式。因为读表操作是组织好的,所以,使用索引不会比完整扫描慢。 - -下面这个例子中,不会使用索引。 - -``` sql -SELECT count() FROM table WHERE CounterID = 34 OR URL LIKE '%upyachka%' -``` - -要检查 ClickHouse 执行一个查询时能否使用索引,可设置 [force\_index\_by\_date](../../../operations/settings/settings.md#settings-force_index_by_date) 和 [force\_primary\_key](../../../operations/settings/settings.md) 。 - -按月分区的分区键是只能读取包含适当范围日期的数据块。这种情况下,数据块会包含很多天(最多整月)的数据。在块中,数据按主键排序,主键第一列可能不包含日期。因此,仅使用日期而没有带主键前缀条件的查询将会导致读取超过这个日期范围。 - -### 跳数索引(分段汇总索引,实验性的) {#tiao-shu-suo-yin-fen-duan-hui-zong-suo-yin-shi-yan-xing-de} - -需要设置 `allow_experimental_data_skipping_indices` 为 1 才能使用此索引。(执行 `SET allow_experimental_data_skipping_indices = 1`)。 - -此索引在 `CREATE` 语句的列部分里定义。 - -``` sql -INDEX index_name expr TYPE type(...) GRANULARITY granularity_value -``` - -`*MergeTree` 系列的表都能指定跳数索引。 - -这些索引是由数据块按粒度分割后的每部分在指定表达式上汇总信息 `granularity_value` 组成(粒度大小用表引擎里 `index_granularity` 的指定)。 -这些汇总信息有助于用 `where` 语句跳过大片不满足的数据,从而减少 `SELECT` 查询从磁盘读取的数据量, - -示例 - -``` sql -CREATE TABLE table_name -( - u64 UInt64, - i32 Int32, - s String, - ... - INDEX a (u64 * i32, s) TYPE minmax GRANULARITY 3, - INDEX b (u64 * length(s)) TYPE set(1000) GRANULARITY 4 -) ENGINE = MergeTree() -... -``` - -上例中的索引能让 ClickHouse 执行下面这些查询时减少读取数据量。 - -``` sql -SELECT count() FROM table WHERE s < 'z' -SELECT count() FROM table WHERE u64 * i32 == 10 AND u64 * length(s) >= 1234 -``` - -#### 索引的可用类型 {#table_engine-mergetree-data_skipping-indexes} - -- `minmax` - 存储指定表达式的极值(如果表达式是 `tuple` ,则存储 `tuple` 中每个元素的极值),这些信息用于跳过数据块,类似主键。 - -- `set(max_rows)` - 存储指定表达式的惟一值(不超过 `max_rows` 个,`max_rows=0` 则表示『无限制』)。这些信息可用于检查 `WHERE` 表达式是否满足某个数据块。 - -- `ngrambf_v1(n, size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - 存储包含数据块中所有 n 元短语的 [布隆过滤器](https://en.wikipedia.org/wiki/Bloom_filter) 。只可用在字符串上。 - 可用于优化 `equals` , `like` 和 `in` 表达式的性能。 - `n` – 短语长度。 - `size_of_bloom_filter_in_bytes` – 布隆过滤器大小,单位字节。(因为压缩得好,可以指定比较大的值,如256或512)。 - `number_of_hash_functions` – 布隆过滤器中使用的 hash 函数的个数。 - `random_seed` – hash 函数的随机种子。 - -- `tokenbf_v1(size_of_bloom_filter_in_bytes, number_of_hash_functions, random_seed)` - 跟 `ngrambf_v1` 类似,不同于 ngrams 存储字符串指定长度的所有片段。它只存储被非字母数据字符分割的片段。 - - - -``` sql -INDEX sample_index (u64 * length(s)) TYPE minmax GRANULARITY 4 -INDEX sample_index2 (u64 * length(str), i32 + f64 * 100, date, str) TYPE set(100) GRANULARITY 4 -INDEX sample_index3 (lower(str), str) TYPE ngrambf_v1(3, 256, 2, 0) GRANULARITY 4 -``` - -## 并发数据访问 {#bing-fa-shu-ju-fang-wen} - -应对表的并发访问,我们使用多版本机制。换言之,当同时读和更新表时,数据从当前查询到的一组片段中读取。没有冗长的的锁。插入不会阻碍读取。 - -对表的读操作是自动并行的。 - -## 列和表的TTL {#table_engine-mergetree-ttl} - -TTL可以设置值的生命周期,它既可以为整张表设置,也可以为每个列字段单独设置。如果`TTL`同时作用于表和字段,ClickHouse会使用先到期的那个。 - -被设置TTL的表,必须拥有[日期](../../../engines/table_engines/mergetree_family/mergetree.md) 或 [日期时间](../../../engines/table_engines/mergetree_family/mergetree.md) 类型的字段。要定义数据的生命周期,需要在这个日期字段上使用操作符,例如: - -``` sql -TTL time_column -TTL time_column + interval -``` - -要定义`interval`, 需要使用 [时间间隔](../../../engines/table_engines/mergetree_family/mergetree.md#operators-datetime) 操作符。 - -``` sql -TTL date_time + INTERVAL 1 MONTH -TTL date_time + INTERVAL 15 HOUR -``` - -### 列字段 TTL {#mergetree-column-ttl} - -当列字段中的值过期时, ClickHouse会将它们替换成数据类型的默认值。如果分区内,某一列的所有值均已过期,则ClickHouse会从文件系统中删除这个分区目录下的列文件。 - -`TTL`子句不能被用于主键字段。 - -示例说明: - -创建一张包含 `TTL` 的表 - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int TTL d + INTERVAL 1 MONTH, - b Int TTL d + INTERVAL 1 MONTH, - c String -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d; -``` - -为表中已存在的列字段添加 `TTL` - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 DAY; -``` - -修改列字段的 `TTL` - -``` sql -ALTER TABLE example_table - MODIFY COLUMN - c String TTL d + INTERVAL 1 MONTH; -``` - -### 表 TTL {#mergetree-table-ttl} - -当表内的数据过期时, ClickHouse会删除所有对应的行。 - -举例说明: - -创建一张包含 `TTL` 的表 - -``` sql -CREATE TABLE example_table -( - d DateTime, - a Int -) -ENGINE = MergeTree -PARTITION BY toYYYYMM(d) -ORDER BY d -TTL d + INTERVAL 1 MONTH; -``` - -修改表的 `TTL` - -``` sql -ALTER TABLE example_table - MODIFY TTL d + INTERVAL 1 DAY; -``` - -**删除数据** - -当ClickHouse合并数据分区时, 会删除TTL过期的数据。 - -当ClickHouse发现数据过期时, 它将会执行一个计划外的合并。要控制这类合并的频率, 你可以设置 [merge\_with\_ttl\_timeout](#mergetree_setting-merge_with_ttl_timeout)。如果该值被设置的太低, 它将导致执行许多的计划外合并,这可能会消耗大量资源。 - -如果在合并的时候执行`SELECT` 查询, 则可能会得到过期的数据。为了避免这种情况,可以在`SELECT`之前使用 [OPTIMIZE](../../../engines/table_engines/mergetree_family/mergetree.md#misc_operations-optimize) 查询。 - -## 使用多个块设备进行数据存储 {#table_engine-mergetree-multiple-volumes} - -### 配置 {#table_engine-mergetree-multiple-volumes-configure} - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/mergetree/) diff --git a/docs/zh/engines/table_engines/mergetree_family/replacingmergetree.md b/docs/zh/engines/table_engines/mergetree_family/replacingmergetree.md deleted file mode 100644 index 720560bf1a4..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/replacingmergetree.md +++ /dev/null @@ -1,61 +0,0 @@ - -# 更换麦树 {#replacingmergetree} - -该引擎和[MergeTree](mergetree.md)的不同之处在于它会删除具有相同主键的重复项。 - -数据的去重只会在合并的过程中出现。合并会在未知的时间在后台进行,因此你无法预先作出计划。有一些数据可能仍未被处理。尽管你可以调用 `OPTIMIZE` 语句发起计划外的合并,但请不要指望使用它,因为 `OPTIMIZE` 语句会引发对大量数据的读和写。 - -因此,`ReplacingMergeTree` 适用于在后台清除重复的数据以节省空间,但是它不保证没有重复的数据出现。 - -## 建表 {#jian-biao} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = ReplacingMergeTree([ver]) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -请求参数的描述,参考[请求参数](../../../engines/table_engines/mergetree_family/replacingmergetree.md)。 - -**替换树参数** - -- `ver` — 版本列。类型为 `UInt*`, `Date` 或 `DateTime`。可选参数。 - - 合并的时候,`ReplacingMergeTree` 从所有具有相同主键的行中选择一行留下: - - 如果 `ver` 列未指定,选择最后一条。 - - 如果 `ver` 列已指定,选择 `ver` 值最大的版本。 - -**子句** - -创建 `ReplacingMergeTree` 表时,需要与创建 `MergeTree` 表时相同的[子句](mergetree.md)。 - -
- -已弃用的建表方法 - -!!! attention "注意" - 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] ReplacingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [ver]) -``` - -除了 `ver` 的所有参数都与 `MergeTree` 中的含义相同。 - -- `ver` - 版本列。可选参数,有关说明,请参阅上文。 - -
- -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/zh/engines/table_engines/mergetree_family/replication.md b/docs/zh/engines/table_engines/mergetree_family/replication.md deleted file mode 100644 index e518eb805c4..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/replication.md +++ /dev/null @@ -1,203 +0,0 @@ - -# 数据副本 {#table_engines-replication} - -只有 MergeTree 系列里的表可支持副本: - -- ReplicatedMergeTree -- ReplicatedSummingMergeTree -- ReplicatedReplacingMergeTree -- ReplicatedAggregatingMergeTree -- ReplicatedCollapsingMergeTree -- ReplicatedVersionedCollapsingMergetree -- ReplicatedGraphiteMergeTree - -副本是表级别的,不是整个服务器级的。所以,服务器里可以同时有复制表和非复制表。 - -副本不依赖分片。每个分片有它自己的独立副本。 - -对于 `INSERT` 和 `ALTER` 语句操作数据的会在压缩的情况下被复制(更多信息,看 [ALTER](../../../engines/table_engines/mergetree_family/replication.md#query_language_queries_alter) )。 - -而 `CREATE`,`DROP`,`ATTACH`,`DETACH` 和 `RENAME` 语句只会在单个服务器上执行,不会被复制。 - -- `The CREATE TABLE` 在运行此语句的服务器上创建一个新的可复制表。如果此表已存在其他服务器上,则给该表添加新副本。 -- `The DROP TABLE` 删除运行此查询的服务器上的副本。 -- `The RENAME` 重命名一个副本。换句话说,可复制表不同的副本可以有不同的名称。 - -要使用副本,需在配置文件中设置 ZooKeeper 集群的地址。例如: - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - - example3 - 2181 - - -``` - -需要 ZooKeeper 3.4.5 或更高版本。 - -你可以配置任何现有的 ZooKeeper 集群,系统会使用里面的目录来存取元数据(该目录在创建可复制表时指定)。 - -如果配置文件中没有设置 ZooKeeper ,则无法创建复制表,并且任何现有的复制表都将变为只读。 - -`SELECT` 查询并不需要借助 ZooKeeper ,复本并不影响 `SELECT` 的性能,查询复制表与非复制表速度是一样的。查询分布式表时,ClickHouse的处理方式可通过设置 [max\_replica\_delay\_for\_distributed\_queries](../../../operations/settings/settings.md#settings-max_replica_delay_for_distributed_queries) 和 [fallback\_to\_stale\_replicas\_for\_distributed\_queries](../../../operations/settings/settings.md) 修改。 - -对于每个 `INSERT` 语句,会通过几个事务将十来个记录添加到 ZooKeeper。(确切地说,这是针对每个插入的数据块; 每个 INSERT 语句的每 `max_insert_block_size = 1048576` 行和最后剩余的都各算作一个块。)相比非复制表,写 zk 会导致 `INSERT` 的延迟略长一些。但只要你按照建议每秒不超过一个 `INSERT` 地批量插入数据,不会有任何问题。一个 ZooKeeper 集群能给整个 ClickHouse 集群支撑协调每秒几百个 `INSERT`。数据插入的吞吐量(每秒的行数)可以跟不用复制的数据一样高。 - -对于非常大的集群,你可以把不同的 ZooKeeper 集群用于不同的分片。然而,即使 Yandex.Metrica 集群(大约300台服务器)也证明还不需要这么做。 - -复制是多主异步。 `INSERT` 语句(以及 `ALTER` )可以发给任意可用的服务器。数据会先插入到执行该语句的服务器上,然后被复制到其他服务器。由于它是异步的,在其他副本上最近插入的数据会有一些延迟。如果部分副本不可用,则数据在其可用时再写入。副本可用的情况下,则延迟时长是通过网络传输压缩数据块所需的时间。 - -默认情况下,INSERT 语句仅等待一个副本写入成功后返回。如果数据只成功写入一个副本后该副本所在的服务器不再存在,则存储的数据会丢失。要启用数据写入多个副本才确认返回,使用 `insert_quorum` 选项。 - -单个数据块写入是原子的。 INSERT 的数据按每块最多 `max_insert_block_size = 1048576` 行进行分块,换句话说,如果 `INSERT` 插入的行少于 1048576,则该 INSERT 是原子的。 - -数据块会去重。对于被多次写的相同数据块(大小相同且具有相同顺序的相同行的数据块),该块仅会写入一次。这样设计的原因是万一在网络故障时客户端应用程序不知道数据是否成功写入DB,此时可以简单地重复 `INSERT` 。把相同的数据发送给多个副本 INSERT 并不会有问题。因为这些 `INSERT` 是完全相同的(会被去重)。去重参数参看服务器设置 [merge\_tree](../../../operations/server_configuration_parameters/settings.md) 。(注意:Replicated\*MergeTree 才会去重,不需要 zookeeper 的不带 MergeTree 不会去重) - -在复制期间,只有要插入的源数据通过网络传输。进一步的数据转换(合并)会在所有副本上以相同的方式进行处理执行。这样可以最大限度地减少网络使用,这意味着即使副本在不同的数据中心,数据同步也能工作良好。(能在不同数据中心中的同步数据是副本机制的主要目标。) - -你可以给数据做任意多的副本。Yandex.Metrica 在生产中使用双副本。某一些情况下,给每台服务器都使用 RAID-5 或 RAID-6 和 RAID-10。是一种相对可靠和方便的解决方案。 - -系统会监视副本数据同步情况,并能在发生故障后恢复。故障转移是自动的(对于小的数据差异)或半自动的(当数据差异很大时,这可能意味是有配置错误)。 - -## 创建复制表 {#creating-replicated-tables} - -在表引擎名称上加上 `Replicated` 前缀。例如:`ReplicatedMergeTree`。 - -**Replicated\*MergeTree 参数** - -- `zoo_path` — ZooKeeper 中该表的路径。 -- `replica_name` — ZooKeeper 中的该表的副本名称。 - -示例: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}') -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -``` - -已弃用的建表语法示例: - -``` sql -CREATE TABLE table_name -( - EventDate DateTime, - CounterID UInt32, - UserID UInt32 -) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/table_name', '{replica}', EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID), EventTime), 8192) -``` - -如上例所示,这些参数可以包含宏替换的占位符,即大括号的部分。它们会被替换为配置文件里 ‘macros’ 那部分配置的值。示例: - -``` xml - - 05 - 02 - example05-02-1.yandex.ru - -``` - -«ZooKeeper 中该表的路径»对每个可复制表都要是唯一的。不同分片上的表要有不同的路径。 -这种情况下,路径包含下面这些部分: - -`/clickhouse/tables/` 是公共前缀,我们推荐使用这个。 - -`{layer}-{shard}` 是分片标识部分。在此示例中,由于 Yandex.Metrica 集群使用了两级分片,所以它是由两部分组成的。但对于大多数情况来说,你只需保留 {shard} 占位符即可,它会替换展开为分片标识。 - -`table_name` 是该表在 ZooKeeper 中的名称。使其与 ClickHouse 中的表名相同比较好。 这里它被明确定义,跟 ClickHouse 表名不一样,它并不会被 RENAME 语句修改。 -*HINT*:你可以在前面添加一个数据库名称 `table_name` 也是 例如。 `db_name.table_name` - -副本名称用于标识同一个表分片的不同副本。你可以使用服务器名称,如上例所示。同个分片中不同副本的副本名称要唯一。 - -你也可以显式指定这些参数,而不是使用宏替换。对于测试和配置小型集群这可能会很方便。但是,这种情况下,则不能使用分布式 DDL 语句(`ON CLUSTER`)。 - -使用大型集群时,我们建议使用宏替换,因为它可以降低出错的可能性。 - -在每个副本服务器上运行 `CREATE TABLE` 查询。将创建新的复制表,或给现有表添加新副本。 - -如果其他副本上已包含了某些数据,在表上添加新副本,则在运行语句后,数据会从其他副本复制到新副本。换句话说,新副本会与其他副本同步。 - -要删除副本,使用 `DROP TABLE`。但它只删除那个 – 位于运行该语句的服务器上的副本。 - -## 故障恢复 {#gu-zhang-hui-fu} - -如果服务器启动时 ZooKeeper 不可用,则复制表会切换为只读模式。系统会定期尝试去连接 ZooKeeper。 - -如果在 `INSERT` 期间 ZooKeeper 不可用,或者在与 ZooKeeper 交互时发生错误,则抛出异常。 - -连接到 ZooKeeper 后,系统会检查本地文件系统中的数据集是否与预期的数据集( ZooKeeper 存储此信息)一致。如果存在轻微的不一致,系统会通过与副本同步数据来解决。 - -如果系统检测到损坏的数据片段(文件大小错误)或无法识别的片段(写入文件系统但未记录在 ZooKeeper 中的部分),则会把它们移动到 ‘detached’ 子目录(不会删除)。而副本中其他任何缺少的但正常数据片段都会被复制同步。 - -注意,ClickHouse 不会执行任何破坏性操作,例如自动删除大量数据。 - -当服务器启动(或与 ZooKeeper 建立新会话)时,它只检查所有文件的数量和大小。 如果文件大小一致但中间某处已有字节被修改过,不会立即被检测到,只有在尝试读取 `SELECT` 查询的数据时才会检测到。该查询会引发校验和不匹配或压缩块大小不一致的异常。这种情况下,数据片段会添加到验证队列中,并在必要时从其他副本中复制。 - -如果本地数据集与预期数据的差异太大,则会触发安全机制。服务器在日志中记录此内容并拒绝启动。这种情况很可能是配置错误,例如,一个分片上的副本意外配置为别的分片上的副本。然而,此机制的阈值设置得相当低,在正常故障恢复期间可能会出现这种情况。在这种情况下,数据恢复则是半自动模式,通过用户主动操作触发。 - -要触发启动恢复,可在 ZooKeeper 中创建节点 `/path_to_table/replica_name/flags/force_restore_data`,节点值可以是任何内容,或运行命令来恢复所有的可复制表: - -``` bash -sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data -``` - -然后重启服务器。启动时,服务器会删除这些标志并开始恢复。 - -## 在数据完全丢失后的恢复 {#zai-shu-ju-wan-quan-diu-shi-hou-de-hui-fu} - -如果其中一个服务器的所有数据和元数据都消失了,请按照以下步骤进行恢复: - -1. 在服务器上安装 ClickHouse。在包含分片标识符和副本的配置文件中正确定义宏配置,如果有用到的话, -2. 如果服务器上有非复制表则必须手动复制,可以从副本服务器上(在 `/var/lib/clickhouse/data/db_name/table_name/` 目录中)复制它们的数据。 -3. 从副本服务器上中复制位于 `/var/lib/clickhouse/metadata/` 中的表定义信息。如果在表定义信息中显式指定了分片或副本标识符,请更正它以使其对应于该副本。(另外,启动服务器,然后会在 `/var/lib/clickhouse/metadata/` 中的.sql文件中生成所有的 `ATTACH TABLE` 语句。) - 4.要开始恢复,ZooKeeper 中创建节点 `/path_to_table/replica_name/flags/force_restore_data`,节点内容不限,或运行命令来恢复所有复制的表:`sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data` - -然后启动服务器(如果它已运行则重启)。数据会从副本中下载。 - -另一种恢复方式是从 ZooKeeper(`/path_to_table/replica_name`)中删除有数据丢的副本的所有元信息,然后再按照«[创建可复制表](#creating-replicated-tables)»中的描述重新创建副本。 - -恢复期间的网络带宽没有限制。特别注意这一点,尤其是要一次恢复很多副本。 - -## MergeTree 转换为 ReplicatedMergeTree {#mergetree-zhuan-huan-wei-replicatedmergetree} - -我们使用 `MergeTree` 来表示 `MergeTree系列` 中的所有表引擎,`ReplicatedMergeTree` 同理。 - -如果你有一个手动同步的 `MergeTree` 表,您可以将其转换为可复制表。如果你已经在 `MergeTree` 表中收集了大量数据,并且现在要启用复制,则可以执行这些操作。 - -如果各个副本上的数据不一致,则首先对其进行同步,或者除保留的一个副本外,删除其他所有副本上的数据。 - -重命名现有的 MergeTree 表,然后使用旧名称创建 `ReplicatedMergeTree` 表。 -将数据从旧表移动到新表(`/var/lib/clickhouse/data/db_name/table_name/`)目录内的 ‘detached’ 目录中。 -然后在其中一个副本上运行`ALTER TABLE ATTACH PARTITION`,将这些数据片段添加到工作集中。 - -## ReplicatedMergeTree 转换为 MergeTree {#replicatedmergetree-zhuan-huan-wei-mergetree} - -使用其他名称创建 MergeTree 表。将具有`ReplicatedMergeTree`表数据的目录中的所有数据移动到新表的数据目录中。然后删除`ReplicatedMergeTree`表并重新启动服务器。 - -如果你想在不启动服务器的情况下清除 `ReplicatedMergeTree` 表: - -- 删除元数据目录中的相应 `.sql` 文件(`/var/lib/clickhouse/metadata/`)。 -- 删除 ZooKeeper 中的相应路径(`/path_to_table/replica_name`)。 - -之后,你可以启动服务器,创建一个 `MergeTree` 表,将数据移动到其目录,然后重新启动服务器。 - -## 当 ZooKeeper 集群中的元数据丢失或损坏时恢复方法 {#dang-zookeeper-ji-qun-zhong-de-yuan-shu-ju-diu-shi-huo-sun-pi-shi-hui-fu-fang-fa} - -如果 ZooKeeper 中的数据丢失或损坏,如上所述,你可以通过将数据转移到非复制表来保存数据。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/replication/) diff --git a/docs/zh/engines/table_engines/mergetree_family/summingmergetree.md b/docs/zh/engines/table_engines/mergetree_family/summingmergetree.md deleted file mode 100644 index 73576b00346..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/summingmergetree.md +++ /dev/null @@ -1,125 +0,0 @@ - -# SummingMergeTree {#summingmergetree} - -该引擎继承自 [MergeTree](mergetree.md)。区别在于,当合并 `SummingMergeTree` 表的数据片段时,ClickHouse 会把所有具有相同主键的行合并为一行,该行包含了被合并的行中具有数值数据类型的列的汇总值。如果主键的组合方式使得单个键值对应于大量的行,则可以显著的减少存储空间并加快数据查询的速度。 - -我们推荐将该引擎和 `MergeTree` 一起使用。例如,在准备做报告的时候,将完整的数据存储在 `MergeTree` 表中,并且使用 `SummingMergeTree` 来存储聚合数据。这种方法可以使你避免因为使用不正确的主键组合方式而丢失有价值的数据。 - -## 建表 {#jian-biao} - - CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] - ( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... - ) ENGINE = SummingMergeTree([columns]) - [PARTITION BY expr] - [ORDER BY expr] - [SAMPLE BY expr] - [SETTINGS name=value, ...] - -请求参数的描述,参考 [请求描述](../../../engines/table_engines/mergetree_family/summingmergetree.md)。 - -**SummingMergeTree 的参数** - -- `columns` - 包含了将要被汇总的列的列名的元组。可选参数。 - 所选的列必须是数值类型,并且不可位于主键中。 - - 如果没有指定 `columns`,ClickHouse 会把所有不在主键中的数值类型的列都进行汇总。 - -**子句** - -创建 `SummingMergeTree` 表时,需要与创建 `MergeTree` 表时相同的[子句](mergetree.md)。 - -
- -已弃用的建表方法 - -!!! attention "注意" - 不要在新项目中使用该方法,可能的话,请将旧项目切换到上述方法。 - - CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] - ( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... - ) ENGINE [=] SummingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, [columns]) - -除 `columns` 外的所有参数都与 `MergeTree` 中的含义相同。 - -- `columns` — 包含将要被汇总的列的列名的元组。可选参数。有关说明,请参阅上文。 - -
- -## 用法示例 {#yong-fa-shi-li} - -考虑如下的表: - -``` sql -CREATE TABLE summtt -( - key UInt32, - value UInt32 -) -ENGINE = SummingMergeTree() -ORDER BY key -``` - -向其中插入数据: - - :) INSERT INTO summtt Values(1,1),(1,2),(2,1) - -ClickHouse可能不会完整的汇总所有行([见下文](#data-processing)),因此我们在查询中使用了聚合函数 `sum` 和 `GROUP BY` 子句。 - -``` sql -SELECT key, sum(value) FROM summtt GROUP BY key -``` - - ┌─key─┬─sum(value)─┐ - │ 2 │ 1 │ - │ 1 │ 3 │ - └─────┴────────────┘ - -## 数据处理 {#data-processing} - -当数据被插入到表中时,他们将被原样保存。ClickHouse 定期合并插入的数据片段,并在这个时候对所有具有相同主键的行中的列进行汇总,将这些行替换为包含汇总数据的一行记录。 - -ClickHouse 会按片段合并数据,以至于不同的数据片段中会包含具有相同主键的行,即单个汇总片段将会是不完整的。因此,聚合函数 [sum()](../../../engines/table_engines/mergetree_family/summingmergetree.md#agg_function-sum) 和 `GROUP BY` 子句应该在(`SELECT`)查询语句中被使用,如上文中的例子所述。 - -### 汇总的通用规则 {#hui-zong-de-tong-yong-gui-ze} - -列中数值类型的值会被汇总。这些列的集合在参数 `columns` 中被定义。 - -如果用于汇总的所有列中的值均为0,则该行会被删除。 - -如果列不在主键中且无法被汇总,则会在现有的值中任选一个。 - -主键所在的列中的值不会被汇总。 - -### AggregateFunction 列中的汇总 {#aggregatefunction-lie-zhong-de-hui-zong} - -对于 [AggregateFunction 类型](../../../engines/table_engines/mergetree_family/summingmergetree.md)的列,ClickHouse 根据对应函数表现为 [AggregatingMergeTree](aggregatingmergetree.md) 引擎的聚合。 - -### 嵌套结构 {#qian-tao-jie-gou} - -表中可以具有以特殊方式处理的嵌套数据结构。 - -如果嵌套表的名称以 `Map` 结尾,并且包含至少两个符合以下条件的列: - -- 第一列是数值类型 `(*Int*, Date, DateTime)`,我们称之为 `key`, -- 其他的列是可计算的 `(*Int*, Float32/64)`,我们称之为 `(values...)`, - -然后这个嵌套表会被解释为一个 `key => (values...)` 的映射,当合并它们的行时,两个数据集中的元素会被根据 `key` 合并为相应的 `(values...)` 的汇总值。 - -示例: - - [(1, 100)] + [(2, 150)] -> [(1, 100), (2, 150)] - [(1, 100)] + [(1, 150)] -> [(1, 250)] - [(1, 100)] + [(1, 150), (2, 150)] -> [(1, 250), (2, 150)] - [(1, 100), (2, 150)] + [(1, -100)] -> [(2, 150)] - -请求数据时,使用 [sumMap(key,value)](../../../engines/table_engines/mergetree_family/summingmergetree.md) 函数来对 `Map` 进行聚合。 - -对于嵌套数据结构,你无需在列的元组中指定列以进行汇总。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/summingmergetree/) diff --git a/docs/zh/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md b/docs/zh/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md deleted file mode 100644 index 37f11bc21ad..00000000000 --- a/docs/zh/engines/table_engines/mergetree_family/versionedcollapsingmergetree.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 37 -toc_title: "\u7248\u672C\u96C6\u5408\u5728\u65B0\u6811" ---- - -# 版本集合在新树 {#versionedcollapsingmergetree} - -这个引擎: - -- 允许快速写入不断变化的对象状态。 -- 删除后台中的旧对象状态。 这显着降低了存储体积。 - -请参阅部分 [崩溃](#table_engines_versionedcollapsingmergetree) 有关详细信息。 - -引擎继承自 [MergeTree](mergetree.md#table_engines-mergetree) 并将折叠行的逻辑添加到合并数据部分的算法中。 `VersionedCollapsingMergeTree` 用于相同的目的 [折叠树](collapsingmergetree.md) 但使用不同的折叠算法,允许以多个线程的任何顺序插入数据。 特别是, `Version` 列有助于正确折叠行,即使它们以错误的顺序插入。 相比之下, `CollapsingMergeTree` 只允许严格连续插入。 - -## 创建表 {#creating-a-table} - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = VersionedCollapsingMergeTree(sign, version) -[PARTITION BY expr] -[ORDER BY expr] -[SAMPLE BY expr] -[SETTINGS name=value, ...] -``` - -有关查询参数的说明,请参阅 [查询说明](../../../sql_reference/statements/create.md). - -**发动机参数** - -``` sql -VersionedCollapsingMergeTree(sign, version) -``` - -- `sign` — Name of the column with the type of row: `1` 是一个 “state” 行, `-1` 是一个 “cancel” 划 - - 列数据类型应为 `Int8`. - -- `version` — Name of the column with the version of the object state. - - 列数据类型应为 `UInt*`. - -**查询子句** - -当创建一个 `VersionedCollapsingMergeTree` 表,相同 [条款](mergetree.md) 需要创建一个时 `MergeTree` 桌子 - -
- -不推荐使用的创建表的方法 - -!!! attention "注意" - 不要在新项目中使用此方法。 如果可能,请将旧项目切换到上述方法。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE [=] VersionedCollapsingMergeTree(date-column [, sampling_expression], (primary, key), index_granularity, sign, version) -``` - -所有的参数,除了 `sign` 和 `version` 具有相同的含义 `MergeTree`. - -- `sign` — Name of the column with the type of row: `1` 是一个 “state” 行, `-1` 是一个 “cancel” 划 - - Column Data Type — `Int8`. - -- `version` — Name of the column with the version of the object state. - - 列数据类型应为 `UInt*`. - -
- -## 崩溃 {#table_engines-versionedcollapsingmergetree} - -### 数据 {#data} - -考虑一种情况,您需要为某个对象保存不断变化的数据。 对于一个对象有一行,并在发生更改时更新该行是合理的。 但是,对于数据库管理系统来说,更新操作非常昂贵且速度很慢,因为它需要重写存储中的数据。 如果需要快速写入数据,则不能接受更新,但可以按如下顺序将更改写入对象。 - -使用 `Sign` 列写入行时。 如果 `Sign = 1` 这意味着该行是一个对象的状态(让我们把它称为 “state” 行)。 如果 `Sign = -1` 它指示具有相同属性的对象的状态的取消(让我们称之为 “cancel” 行)。 还可以使用 `Version` 列,它应该用单独的数字标识对象的每个状态。 - -例如,我们要计算用户在某个网站上访问了多少页面以及他们在那里的时间。 在某个时间点,我们用用户活动的状态写下面的行: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -在稍后的某个时候,我们注册用户活动的变化,并用以下两行写入它。 - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -第一行取消对象(用户)的先前状态。 它应该复制已取消状态的所有字段,除了 `Sign`. - -第二行包含当前状态。 - -因为我们只需要用户活动的最后一个状态,行 - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -可以删除,折叠对象的无效(旧)状态。 `VersionedCollapsingMergeTree` 在合并数据部分时执行此操作。 - -要了解为什么每次更改都需要两行,请参阅 [算法](#table_engines-versionedcollapsingmergetree-algorithm). - -**使用注意事项** - -1. 写入数据的程序应该记住对象的状态以取消它。 该 “cancel” 字符串应该是 “state” 与相反的字符串 `Sign`. 这增加了存储的初始大小,但允许快速写入数据。 -2. 列中长时间增长的数组由于写入负载而降低了引擎的效率。 数据越简单,效率就越高。 -3. `SELECT` 结果很大程度上取决于对象变化历史的一致性。 准备插入数据时要准确。 您可以通过不一致的数据获得不可预测的结果,例如会话深度等非负指标的负值。 - -### 算法 {#table_engines-versionedcollapsingmergetree-algorithm} - -当ClickHouse合并数据部分时,它会删除具有相同主键和版本且不同主键和版本的每对行 `Sign`. 行的顺序并不重要。 - -当ClickHouse插入数据时,它会按主键对行进行排序。 如果 `Version` 列不在主键中,ClickHouse将其隐式添加到主键作为最后一个字段并使用它进行排序。 - -## 选择数据 {#selecting-data} - -ClickHouse不保证具有相同主键的所有行都将位于相同的结果数据部分中,甚至位于相同的物理服务器上。 对于写入数据和随后合并数据部分都是如此。 此外,ClickHouse流程 `SELECT` 具有多个线程的查询,并且无法预测结果中的行顺序。 这意味着聚合是必需的,如果有必要得到完全 “collapsed” 从数据 `VersionedCollapsingMergeTree` 桌子 - -要完成折叠,请使用 `GROUP BY` 考虑符号的子句和聚合函数。 例如,要计算数量,请使用 `sum(Sign)` 而不是 `count()`. 要计算的东西的总和,使用 `sum(Sign * x)` 而不是 `sum(x)`,并添加 `HAVING sum(Sign) > 0`. - -聚合 `count`, `sum` 和 `avg` 可以这样计算。 聚合 `uniq` 如果对象至少具有一个非折叠状态,则可以计算。 聚合 `min` 和 `max` 无法计算是因为 `VersionedCollapsingMergeTree` 不保存折叠状态值的历史记录。 - -如果您需要提取数据 “collapsing” 但是,如果没有聚合(例如,要检查是否存在其最新值与某些条件匹配的行),则可以使用 `FINAL` 修饰符 `FROM` 条款 这种方法效率低下,不应与大型表一起使用。 - -## 使用示例 {#example-of-use} - -示例数据: - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 | -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 | -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 | -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -创建表: - -``` sql -CREATE TABLE UAct -( - UserID UInt64, - PageViews UInt8, - Duration UInt8, - Sign Int8, - Version UInt8 -) -ENGINE = VersionedCollapsingMergeTree(Sign, Version) -ORDER BY UserID -``` - -插入数据: - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, 1, 1) -``` - -``` sql -INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1, 1),(4324182021466249494, 6, 185, 1, 2) -``` - -我们用两个 `INSERT` 查询以创建两个不同的数据部分。 如果我们使用单个查询插入数据,ClickHouse将创建一个数据部分,并且永远不会执行任何合并。 - -获取数据: - -``` sql -SELECT * FROM UAct -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ 1 │ 1 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 5 │ 146 │ -1 │ 1 │ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -我们在这里看到了什么,折叠的部分在哪里? -我们使用两个创建了两个数据部分 `INSERT` 查询。 该 `SELECT` 查询是在两个线程中执行的,结果是行的随机顺序。 -由于数据部分尚未合并,因此未发生折叠。 ClickHouse在我们无法预测的未知时间点合并数据部分。 - -这就是为什么我们需要聚合: - -``` sql -SELECT - UserID, - sum(PageViews * Sign) AS PageViews, - sum(Duration * Sign) AS Duration, - Version -FROM UAct -GROUP BY UserID, Version -HAVING sum(Sign) > 0 -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 2 │ -└─────────────────────┴───────────┴──────────┴─────────┘ -``` - -如果我们不需要聚合,并希望强制折叠,我们可以使用 `FINAL` 修饰符 `FROM` 条款 - -``` sql -SELECT * FROM UAct FINAL -``` - -``` text -┌──────────────UserID─┬─PageViews─┬─Duration─┬─Sign─┬─Version─┐ -│ 4324182021466249494 │ 6 │ 185 │ 1 │ 2 │ -└─────────────────────┴───────────┴──────────┴──────┴─────────┘ -``` - -这是一个非常低效的方式来选择数据。 不要把它用于大桌子。 - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/versionedcollapsingmergetree/) diff --git a/docs/zh/engines/table_engines/special/buffer.md b/docs/zh/engines/table_engines/special/buffer.md deleted file mode 100644 index 6b53883be7b..00000000000 --- a/docs/zh/engines/table_engines/special/buffer.md +++ /dev/null @@ -1,54 +0,0 @@ - -# 缓冲区 {#buffer} - -缓冲数据写入 RAM 中,周期性地将数据刷新到另一个表。在读取操作时,同时从缓冲区和另一个表读取数据。 - - Buffer(database, table, num_layers, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes) - -引擎的参数:database,table - 要刷新数据的表。可以使用返回字符串的常量表达式而不是数据库名称。 num\_layers - 并行层数。在物理上,该表将表示为 num\_layers 个独立缓冲区。建议值为16。min\_time,max\_time,min\_rows,max\_rows,min\_bytes,max\_bytes - 从缓冲区刷新数据的条件。 - -如果满足所有 «min» 条件或至少一个 «max» 条件,则从缓冲区刷新数据并将其写入目标表。min\_time,max\_time — 从第一次写入缓冲区时起以秒为单位的时间条件。min\_rows,max\_rows - 缓冲区中行数的条件。min\_bytes,max\_bytes - 缓冲区中字节数的条件。 - -写入时,数据从 num\_layers 个缓冲区中随机插入。或者,如果插入数据的大小足够大(大于 max\_rows 或 max\_bytes ),则会绕过缓冲区将其写入目标表。 - -每个 «num\_layers» 缓冲区刷新数据的条件是分别计算。例如,如果 num\_layers = 16 且 max\_bytes = 100000000,则最大RAM消耗将为1.6 GB。 - -示例: - -``` sql -CREATE TABLE merge.hits_buffer AS merge.hits ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000) -``` - -创建一个 «merge.hits\_buffer» 表,其结构与 «merge.hits» 相同,并使用 Buffer 引擎。写入此表时,数据缓冲在 RAM 中,然后写入 «merge.hits» 表。创建了16个缓冲区。如果已经过了100秒,或者已写入100万行,或者已写入100 MB数据,则刷新每个缓冲区的数据;或者如果同时已经过了10秒并且已经写入了10,000行和10 MB的数据。例如,如果只写了一行,那么在100秒之后,都会被刷新。但是如果写了很多行,数据将会更快地刷新。 - -当服务器停止时,使用 DROP TABLE 或 DETACH TABLE,缓冲区数据也会刷新到目标表。 - -可以为数据库和表名在单个引号中设置空字符串。这表示没有目的地表。在这种情况下,当达到数据刷新条件时,缓冲器被简单地清除。这可能对于保持数据窗口在内存中是有用的。 - -从 Buffer 表读取时,将从缓冲区和目标表(如果有)处理数据。 -请注意,Buffer 表不支持索引。换句话说,缓冲区中的数据被完全扫描,对于大缓冲区来说可能很慢。(对于目标表中的数据,将使用它支持的索引。) - -如果 Buffer 表中的列集与目标表中的列集不匹配,则会插入两个表中存在的列的子集。 - -如果类型与 Buffer 表和目标表中的某列不匹配,则会在服务器日志中输入错误消息并清除缓冲区。 -如果在刷新缓冲区时目标表不存在,则会发生同样的情况。 - -如果需要为目标表和 Buffer 表运行 ALTER,我们建议先删除 Buffer 表,为目标表运行 ALTER,然后再次创建 Buffer 表。 - -如果服务器异常重启,缓冲区中的数据将丢失。 - -PREWHERE,FINAL 和 SAMPLE 对缓冲表不起作用。这些条件将传递到目标表,但不用于处理缓冲区中的数据。因此,我们建议只使用Buffer表进行写入,同时从目标表进行读取。 - -将数据添加到缓冲区时,其中一个缓冲区被锁定。如果同时从表执行读操作,则会导致延迟。 - -插入到 Buffer 表中的数据可能以不同的顺序和不同的块写入目标表中。因此,Buffer 表很难用于正确写入 CollapsingMergeTree。为避免出现问题,您可以将 «num\_layers» 设置为1。 - -如果目标表是复制表,则在写入 Buffer 表时会丢失复制表的某些预期特征。数据部分的行次序和大小的随机变化导致数据不能去重,这意味着无法对复制表进行可靠的 «exactly once» 写入。 - -由于这些缺点,我们只建议在极少数情况下使用 Buffer 表。 - -当在单位时间内从大量服务器接收到太多 INSERTs 并且在插入之前无法缓冲数据时使用 Buffer 表,这意味着这些 INSERTs 不能足够快地执行。 - -请注意,一次插入一行数据是没有意义的,即使对于 Buffer 表也是如此。这将只产生每秒几千行的速度,而插入更大的数据块每秒可以产生超过一百万行(参见 «性能» 部分)。 - -[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/buffer/) diff --git a/docs/zh/engines/table_engines/special/dictionary.md b/docs/zh/engines/table_engines/special/dictionary.md deleted file mode 100644 index 27da9b40e52..00000000000 --- a/docs/zh/engines/table_engines/special/dictionary.md +++ /dev/null @@ -1,102 +0,0 @@ - -# 字典 {#dictionary} - -`Dictionary` 引擎将字典数据展示为一个ClickHouse的表。 - -例如,考虑使用一个具有以下配置的 `products` 字典: - -``` xml - - - products - - -
products
- DSN=some-db-server - - - - 300 - 360 - - - - - - - product_id - - - title - String - - - - - -``` - -查询字典中的数据: - -``` sql -select name, type, key, attribute.names, attribute.types, bytes_allocated, element_count,source from system.dictionaries where name = 'products'; - -SELECT - name, - type, - key, - attribute.names, - attribute.types, - bytes_allocated, - element_count, - source -FROM system.dictionaries -WHERE name = 'products' -``` - - ┌─name─────┬─type─┬─key────┬─attribute.names─┬─attribute.types─┬─bytes_allocated─┬─element_count─┬─source──────────┐ - │ products │ Flat │ UInt64 │ ['title'] │ ['String'] │ 23065376 │ 175032 │ ODBC: .products │ - └──────────┴──────┴────────┴─────────────────┴─────────────────┴─────────────────┴───────────────┴─────────────────┘ - -你可以使用 [dictGet\*](../../../engines/table_engines/special/dictionary.md) 函数来获取这种格式的字典数据。 - -当你需要获取原始数据,或者是想要使用 `JOIN` 操作的时候,这种视图并没有什么帮助。对于这些情况,你可以使用 `Dictionary` 引擎,它可以将字典数据展示在表中。 - -语法: - - CREATE TABLE %table_name% (%fields%) engine = Dictionary(%dictionary_name%)` - -示例: - -``` sql -create table products (product_id UInt64, title String) Engine = Dictionary(products); - -CREATE TABLE products -( - product_id UInt64, - title String, -) -ENGINE = Dictionary(products) -``` - - Ok. - - 0 rows in set. Elapsed: 0.004 sec. - -看一看表中的内容。 - -``` sql -select * from products limit 1; - -SELECT * -FROM products -LIMIT 1 -``` - - ┌────product_id─┬─title───────────┐ - │ 152689 │ Some item │ - └───────────────┴─────────────────┘ - - 1 rows in set. Elapsed: 0.006 sec. - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/dictionary/) diff --git a/docs/zh/engines/table_engines/special/distributed.md b/docs/zh/engines/table_engines/special/distributed.md deleted file mode 100644 index f31dae7c1ef..00000000000 --- a/docs/zh/engines/table_engines/special/distributed.md +++ /dev/null @@ -1,121 +0,0 @@ - -# 分布 {#distributed} - -**分布式引擎本身不存储数据**, 但可以在多个服务器上进行分布式查询。 -读是自动并行的。读取时,远程服务器表的索引(如果有的话)会被使用。 -分布式引擎参数:服务器配置文件中的集群名,远程数据库名,远程表名,数据分片键(可选)。 -示例: - - Distributed(logs, default, hits[, sharding_key]) - -将会从位于«logs»集群中 default.hits 表所有服务器上读取数据。 -远程服务器不仅用于读取数据,还会对尽可能数据做部分处理。 -例如,对于使用 GROUP BY 的查询,数据首先在远程服务器聚合,之后返回聚合函数的中间状态给查询请求的服务器。再在请求的服务器上进一步汇总数据。 - -数据库名参数除了用数据库名之外,也可用返回字符串的常量表达式。例如:currentDatabase()。 - -logs – 服务器配置文件中的集群名称。 - -集群示例配置如下: - -``` xml - - - - - 1 - - false - - example01-01-1 - 9000 - - - example01-01-2 - 9000 - - - - 2 - false - - example01-02-1 - 9000 - - - example01-02-2 - 1 - 9440 - - - - -``` - -这里定义了一个名为'logs'的集群,它由两个分片组成,每个分片包含两个副本。 -分片是指包含数据不同部分的服务器(要读取所有数据,必须访问所有分片)。 -副本是存储复制数据的服务器(要读取所有数据,访问任一副本上的数据即可)。 - -集群名称不能包含点号。 - -每个服务器需要指定 `host`,`port`,和可选的 `user`,`password`,`secure`,`compression` 的参数: -- `host` – 远程服务器地址。可以域名、IPv4或IPv6。如果指定域名,则服务在启动时发起一个 DNS 请求,并且请求结果会在服务器运行期间一直被记录。如果 DNS 请求失败,则服务不会启动。如果你修改了 DNS 记录,则需要重启服务。 -- `port` – 消息传递的 TCP 端口(「tcp\_port」配置通常设为 9000)。不要跟 http\_port 混淆。 -- `user` – 用于连接远程服务器的用户名。默认值:default。该用户必须有权限访问该远程服务器。访问权限配置在 users.xml 文件中。更多信息,请查看«访问权限»部分。 -- `password` – 用于连接远程服务器的密码。默认值:空字符串。 -- `secure` – 是否使用ssl进行连接,设为true时,通常也应该设置 `port` = 9440。服务器也要监听 9440 并有正确的证书。 -- `compression` - 是否使用数据压缩。默认值:true。 - -配置了副本,读取操作会从每个分片里选择一个可用的副本。可配置负载平衡算法(挑选副本的方式) - 请参阅«load\_balancing»设置。 -如果跟服务器的连接不可用,则在尝试短超时的重连。如果重连失败,则选择下一个副本,依此类推。如果跟所有副本的连接尝试都失败,则尝试用相同的方式再重复几次。 -该机制有利于系统可用性,但不保证完全容错:如有远程服务器能够接受连接,但无法正常工作或状况不佳。 - -你可以配置一个(这种情况下,查询操作更应该称为远程查询,而不是分布式查询)或任意多个分片。在每个分片中,可以配置一个或任意多个副本。不同分片可配置不同数量的副本。 - -可以在配置中配置任意数量的集群。 - -要查看集群,可使用«system.clusters»表。 - -通过分布式引擎可以像使用本地服务器一样使用集群。但是,集群不是自动扩展的:你必须编写集群配置到服务器配置文件中(最好,给所有集群的服务器写上完整配置)。 - -不支持用分布式表查询别的分布式表(除非该表只有一个分片)。或者说,要用分布表查查询«最终»的数据表。 - -分布式引擎需要将集群信息写入配置文件。配置文件中的集群信息会即时更新,无需重启服务器。如果你每次是要向不确定的一组分片和副本发送查询,则不适合创建分布式表 - 而应该使用«远程»表函数。 请参阅«表函数»部分。 - -向集群写数据的方法有两种: - -一,自已指定要将哪些数据写入哪些服务器,并直接在每个分片上执行写入。换句话说,在分布式表上«查询»,在数据表上 INSERT。 -这是最灵活的解决方案 – 你可以使用任何分片方案,对于复杂业务特性的需求,这可能是非常重要的。 -这也是最佳解决方案,因为数据可以完全独立地写入不同的分片。 - -二,在分布式表上执行 INSERT。在这种情况下,分布式表会跨服务器分发插入数据。 -为了写入分布式表,必须要配置分片键(最后一个参数)。当然,如果只有一个分片,则写操作在没有分片键的情况下也能工作,因为这种情况下分片键没有意义。 - -每个分片都可以在配置文件中定义权重。默认情况下,权重等于1。数据依据分片权重按比例分发到分片上。例如,如果有两个分片,第一个分片的权重是9,而第二个分片的权重是10,则发送 9 / 19 的行到第一个分片, 10 / 19 的行到第二个分片。 - -分片可在配置文件中定义 ‘internal\_replication’ 参数。 - -此参数设置为«true»时,写操作只选一个正常的副本写入数据。如果分布式表的子表是复制表(\*ReplicaMergeTree),请使用此方案。换句话说,这其实是把数据的复制工作交给实际需要写入数据的表本身而不是分布式表。 - -若此参数设置为«false»(默认值),写操作会将数据写入所有副本。实质上,这意味着要分布式表本身来复制数据。这种方式不如使用复制表的好,因为不会检查副本的一致性,并且随着时间的推移,副本数据可能会有些不一样。 - -选择将一行数据发送到哪个分片的方法是,首先计算分片表达式,然后将这个计算结果除以所有分片的权重总和得到余数。该行会发送到那个包含该余数的从'prev\_weight'到'prev\_weights + weight'的半闭半开区间对应的分片上,其中 ‘prev\_weights’ 是该分片前面的所有分片的权重和,‘weight’ 是该分片的权重。例如,如果有两个分片,第一个分片权重为9,而第二个分片权重为10,则余数在 \[0,9) 中的行发给第一个分片,余数在 \[9,19) 中的行发给第二个分片。 - -分片表达式可以是由常量和表列组成的任何返回整数表达式。例如,您可以使用表达式 ‘rand()’ 来随机分配数据,或者使用 ‘UserID’ 来按用户 ID 的余数分布(相同用户的数据将分配到单个分片上,这可降低带有用户信息的 IN 和 JOIN 的语句运行的复杂度)。如果该列数据分布不够均匀,可以将其包装在散列函数中:intHash64(UserID)。 - -这种简单的用余数来选择分片的方案是有局限的,并不总适用。它适用于中型和大型数据(数十台服务器)的场景,但不适用于巨量数据(数百台或更多服务器)的场景。后一种情况下,应根据业务特性需求考虑的分片方案,而不是直接用分布式表的多分片。 - -SELECT 查询会被发送到所有分片,并且无论数据在分片中如何分布(即使数据完全随机分布)都可正常工作。添加新分片时,不必将旧数据传输到该分片。你可以给新分片分配大权重然后写新数据 - 数据可能会稍分布不均,但查询会正确高效地运行。 - -下面的情况,你需要关注分片方案: - -- 使用需要特定键连接数据( IN 或 JOIN )的查询。如果数据是用该键进行分片,则应使用本地 IN 或 JOIN 而不是 GLOBAL IN 或 GLOBAL JOIN,这样效率更高。 -- 使用大量服务器(上百或更多),但有大量小查询(个别客户的查询 - 网站,广告商或合作伙伴)。为了使小查询不影响整个集群,让单个客户的数据处于单个分片上是有意义的。或者,正如我们在 Yandex.Metrica 中所做的那样,你可以配置两级分片:将整个集群划分为«层»,一个层可以包含多个分片。单个客户的数据位于单个层上,根据需要将分片添加到层中,层中的数据随机分布。然后给每层创建分布式表,再创建一个全局的分布式表用于全局的查询。 - -数据是异步写入的。对于分布式表的 INSERT,数据块只写本地文件系统。之后会尽快地在后台发送到远程服务器。你可以通过查看表目录中的文件列表(等待发送的数据)来检查数据是否成功发送:/var/lib/clickhouse/data/database/table/ 。 - -如果在 INSERT 到分布式表时服务器节点丢失或重启(如,设备故障),则插入的数据可能会丢失。如果在表目录中检测到损坏的数据分片,则会将其转移到«broken»子目录,并不再使用。 - -启用 max\_parallel\_replicas 选项后,会在分表的所有副本上并行查询处理。更多信息,请参阅«设置,max\_parallel\_replicas»部分。 - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/distributed/) diff --git a/docs/zh/engines/table_engines/special/external_data.md b/docs/zh/engines/table_engines/special/external_data.md deleted file mode 100644 index 399ffd8c0f3..00000000000 --- a/docs/zh/engines/table_engines/special/external_data.md +++ /dev/null @@ -1,62 +0,0 @@ - -# 用于查询处理的外部数据 {#external-data-for-query-processing} - -ClickHouse 允许向服务器发送处理查询所需的数据以及 SELECT 查询。这些数据放在一个临时表中(请参阅 «临时表» 一节),可以在查询中使用(例如,在 IN 操作符中)。 - -例如,如果您有一个包含重要用户标识符的文本文件,则可以将其与使用此列表过滤的查询一起上传到服务器。 - -如果需要使用大量外部数据运行多个查询,请不要使用该特性。最好提前把数据上传到数据库。 - -可以使用命令行客户端(在非交互模式下)或使用 HTTP 接口上传外部数据。 - -在命令行客户端中,您可以指定格式的参数部分 - -``` bash ---external --file=... [--name=...] [--format=...] [--types=...|--structure=...] -``` - -对于传输的表的数量,可能有多个这样的部分。 - -**–external** – 标记子句的开始。 -**–file** – 带有表存储的文件的路径,或者,它指的是STDIN。 -只能从 stdin 中检索单个表。 - -以下的参数是可选的:**–name** – 表的名称,如果省略,则采用 \_data。 -**–format** – 文件中的数据格式。 如果省略,则使用 TabSeparated。 - -以下的参数必选一个:**–types** – 逗号分隔列类型的列表。例如:`UInt64,String`。列将被命名为 \_1,\_2,… -**–structure**– 表结构的格式 `UserID UInt64`,`URL String`。定义列的名字以及类型。 - -在 «file» 中指定的文件将由 «format» 中指定的格式解析,使用在 «types» 或 «structure» 中指定的数据类型。该表将被上传到服务器,并在作为名称为 «name»临时表。 - -示例: - -``` bash -echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT count() FROM test.visits WHERE TraficSourceID IN _data" --external --file=- --types=Int8 -849897 -cat /etc/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -当使用HTTP接口时,外部数据以 multipart/form-data 格式传递。每个表作为一个单独的文件传输。表名取自文件名。«query\_string» 传递参数 «name\_format»、«name\_types»和«name\_structure»,其中 «name» 是这些参数对应的表的名称。参数的含义与使用命令行客户端时的含义相同。 - -示例: - -``` bash -cat /etc/passwd | sed 's/:/\t/g' > passwd.tsv - -curl -F 'passwd=@passwd.tsv;' 'http://localhost:8123/?query=SELECT+shell,+count()+AS+c+FROM+passwd+GROUP+BY+shell+ORDER+BY+c+DESC&passwd_structure=login+String,+unused+String,+uid+UInt16,+gid+UInt16,+comment+String,+home+String,+shell+String' -/bin/sh 20 -/bin/false 5 -/bin/bash 4 -/usr/sbin/nologin 1 -/bin/sync 1 -``` - -对于分布式查询,将临时表发送到所有远程服务器。 - -[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/external_data/) diff --git a/docs/zh/engines/table_engines/special/file.md b/docs/zh/engines/table_engines/special/file.md deleted file mode 100644 index 71c96f8ab43..00000000000 --- a/docs/zh/engines/table_engines/special/file.md +++ /dev/null @@ -1,74 +0,0 @@ - -# 文件(输入格式) {#table_engines-file} - -数据源是以 Clickhouse 支持的一种输入格式(TabSeparated,Native等)存储数据的文件。 - -用法示例: - -- 从 ClickHouse 导出数据到文件。 -- 将数据从一种格式转换为另一种格式。 -- 通过编辑磁盘上的文件来更新 ClickHouse 中的数据。 - -## 在 ClickHouse 服务器中的使用 {#zai-clickhouse-fu-wu-qi-zhong-de-shi-yong} - - File(Format) - -选用的 `Format` 需要支持 `INSERT` 或 `SELECT` 。有关支持格式的完整列表,请参阅 [格式](../../../interfaces/formats.md#formats)。 - -ClickHouse 不支持给 `File` 指定文件系统路径。它使用服务器配置中 [路径](../../../operations/server_configuration_parameters/settings.md) 设定的文件夹。 - -使用 `File(Format)` 创建表时,它会在该文件夹中创建空的子目录。当数据写入该表时,它会写到该子目录中的 `data.Format` 文件中。 - -你也可以在服务器文件系统中手动创建这些子文件夹和文件,然后通过 [ATTACH](../../../engines/table_engines/special/file.md) 将其创建为具有对应名称的表,这样你就可以从该文件中查询数据了。 - -!!! 注意 "注意" - 注意这个功能,因为 ClickHouse 不会跟踪这些文件在外部的更改。在 ClickHouse 中和 ClickHouse 外部同时写入会造成结果是不确定的。 - -**示例:** - -**1.** 创建 `file_engine_table` 表: - -``` sql -CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated) -``` - -默认情况下,Clickhouse 会创建目录 `/var/lib/clickhouse/data/default/file_engine_table` 。 - -**2.** 手动创建 `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` 文件,并且包含内容: - -``` bash -$ cat data.TabSeparated -one 1 -two 2 -``` - -**3.** 查询这些数据: - -``` sql -SELECT * FROM file_engine_table -``` - - ┌─name─┬─value─┐ - │ one │ 1 │ - │ two │ 2 │ - └──────┴───────┘ - -## 在 Clickhouse-local 中的使用 {#zai-clickhouse-local-zhong-de-shi-yong} - -使用 [ツ环板-ョツ嘉ッツ偲](../../../engines/table_engines/special/file.md) 时,File 引擎除了 `Format` 之外,还可以接受文件路径参数。可以使用数字或人类可读的名称来指定标准输入/输出流,例如 `0` 或 `stdin`,`1` 或 `stdout`。 -**例如:** - -``` bash -$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table" -``` - -## 功能实现 {#gong-neng-shi-xian} - -- 读操作可支持并发,但写操作不支持 -- 不支持: - - `ALTER` - - `SELECT ... SAMPLE` - - 索引 - - 副本 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/file/) diff --git a/docs/zh/engines/table_engines/special/generate.md b/docs/zh/engines/table_engines/special/generate.md deleted file mode 100644 index 6a31e270066..00000000000 --- a/docs/zh/engines/table_engines/special/generate.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 46 -toc_title: GenerateRandom ---- - -# Generaterandom {#table_engines-generate} - -GenerateRandom表引擎为给定的表架构生成随机数据。 - -使用示例: - -- 在测试中使用填充可重复的大表。 -- 为模糊测试生成随机输入。 - -## 在ClickHouse服务器中的使用 {#usage-in-clickhouse-server} - -``` sql -ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length) -``` - -该 `max_array_length` 和 `max_string_length` 参数指定所有的最大长度 -数组列和字符串相应地在生成的数据中。 - -生成表引擎仅支持 `SELECT` 查询。 - -它支持所有 [数据类型](../../../sql_reference/data_types/index.md) 可以存储在一个表中,除了 `LowCardinality` 和 `AggregateFunction`. - -**示例:** - -**1.** 设置 `generate_engine_table` 表: - -``` sql -CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3) -``` - -**2.** 查询数据: - -``` sql -SELECT * FROM generate_engine_table LIMIT 3 -``` - -``` text -┌─name─┬──────value─┐ -│ c4xJ │ 1412771199 │ -│ r │ 1791099446 │ -│ 7#$ │ 124312908 │ -└──────┴────────────┘ -``` - -## 实施细节 {#details-of-implementation} - -- 不支持: - - `ALTER` - - `SELECT ... SAMPLE` - - `INSERT` - - 指数 - - 复制 - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/generate/) diff --git a/docs/zh/engines/table_engines/special/join.md b/docs/zh/engines/table_engines/special/join.md deleted file mode 100644 index 33cc0685a52..00000000000 --- a/docs/zh/engines/table_engines/special/join.md +++ /dev/null @@ -1,29 +0,0 @@ - -# 加入我们 {#join} - -加载好的 JOIN 表数据会常驻内存中。 - - Join(ANY|ALL, LEFT|INNER, k1[, k2, ...]) - -引擎参数:`ANY|ALL` – 连接修饰;`LEFT|INNER` – 连接类型。更多信息可参考 [JOIN子句](../../../engines/table_engines/special/join.md#select-join)。 -这些参数设置不用带引号,但必须与要 JOIN 表匹配。 k1,k2,……是 USING 子句中要用于连接的关键列。 - -此引擎表不能用于 GLOBAL JOIN 。 - -类似于 Set 引擎,可以使用 INSERT 向表中添加数据。设置为 ANY 时,重复键的数据会被忽略(仅一条用于连接)。设置为 ALL 时,重复键的数据都会用于连接。不能直接对 JOIN 表进行 SELECT。检索其数据的唯一方法是将其作为 JOIN 语句右边的表。 - -跟 Set 引擎类似,Join 引擎把数据存储在磁盘中。 - -### 限制和设置 {#join-limitations-and-settings} - -创建表时,将应用以下设置: - -- join\_use\_nulls -- max\_rows\_in\_join -- max\_bytes\_in\_join -- join\_overflow\_mode -- join\_any\_take\_last\_row - -该 `Join`-发动机表不能用于 `GLOBAL JOIN` 操作。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/join/) diff --git a/docs/zh/engines/table_engines/special/materializedview.md b/docs/zh/engines/table_engines/special/materializedview.md deleted file mode 100644 index 5dc4e261fbd..00000000000 --- a/docs/zh/engines/table_engines/special/materializedview.md +++ /dev/null @@ -1,6 +0,0 @@ - -# 物化视图 {#wu-hua-shi-tu} - -物化视图的使用(更多信息请参阅 [CREATE TABLE](../../../engines/table_engines/special/materializedview.md) )。它需要使用一个不同的引擎来存储数据,这个引擎要在创建物化视图时指定。当从表中读取时,它就会使用该引擎。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/materializedview/) diff --git a/docs/zh/engines/table_engines/special/memory.md b/docs/zh/engines/table_engines/special/memory.md deleted file mode 100644 index 3fd29813d00..00000000000 --- a/docs/zh/engines/table_engines/special/memory.md +++ /dev/null @@ -1,8 +0,0 @@ - -# 记忆 {#memory} - -Memory 引擎以未压缩的形式将数据存储在 RAM 中。数据完全以读取时获得的形式存储。换句话说,从这张表中读取是很轻松的。并发数据访问是同步的。锁范围小:读写操作不会相互阻塞。不支持索引。阅读是并行化的。在简单查询上达到最大生产率(超过10 GB /秒),因为没有磁盘读取,不需要解压缩或反序列化数据。(值得注意的是,在许多情况下,与 MergeTree 引擎的性能几乎一样高)。重新启动服务器时,表中的数据消失,表将变为空。通常,使用此表引擎是不合理的。但是,它可用于测试,以及在相对较少的行(最多约100,000,000)上需要最高性能的查询。 - -Memory 引擎是由系统用于临时表进行外部数据的查询(请参阅 «外部数据用于请求处理» 部分),以及用于实现 `GLOBAL IN`(请参见 «IN 运算符» 部分)。 - -[原始文章](https://clickhouse.tech/docs/zh/operations/table_engines/memory/) diff --git a/docs/zh/engines/table_engines/special/merge.md b/docs/zh/engines/table_engines/special/merge.md deleted file mode 100644 index e4ee3fe92a5..00000000000 --- a/docs/zh/engines/table_engines/special/merge.md +++ /dev/null @@ -1,64 +0,0 @@ - -# 合并 {#merge} - -`Merge` 引擎 (不要跟 `MergeTree` 引擎混淆) 本身不存储数据,但可用于同时从任意多个其他的表中读取数据。 -读是自动并行的,不支持写入。读取时,那些被真正读取到数据的表的索引(如果有的话)会被使用。 -`Merge` 引擎的参数:一个数据库名和一个用于匹配表名的正则表达式。 - -示例: - - Merge(hits, '^WatchLog') - -数据会从 `hits` 数据库中表名匹配正则 ‘`^WatchLog`’ 的表中读取。 - -除了数据库名,你也可以用一个返回字符串的常量表达式。例如, `currentDatabase()` 。 - -正则表达式 — [re2](https://github.com/google/re2) (支持 PCRE 一个子集的功能),大小写敏感。 -了解关于正则表达式中转义字符的说明可参看 «match» 一节。 - -当选择需要读的表时,`Merge` 表本身会被排除,即使它匹配上了该正则。这样设计为了避免循环。 -当然,是能够创建两个相互无限递归读取对方数据的 `Merge` 表的,但这并没有什么意义。 - -`Merge` 引擎的一个典型应用是可以像使用一张表一样使用大量的 `TinyLog` 表。 - -示例 2 : - -我们假定你有一个旧表(WatchLog\_old),你想改变数据分区了,但又不想把旧数据转移到新表(WatchLog\_new)里,并且你需要同时能看到这两个表的数据。 - - CREATE TABLE WatchLog_old(date Date, UserId Int64, EventType String, Cnt UInt64) - ENGINE=MergeTree(date, (UserId, EventType), 8192); - INSERT INTO WatchLog_old VALUES ('2018-01-01', 1, 'hit', 3); - - CREATE TABLE WatchLog_new(date Date, UserId Int64, EventType String, Cnt UInt64) - ENGINE=MergeTree PARTITION BY date ORDER BY (UserId, EventType) SETTINGS index_granularity=8192; - INSERT INTO WatchLog_new VALUES ('2018-01-02', 2, 'hit', 3); - - CREATE TABLE WatchLog as WatchLog_old ENGINE=Merge(currentDatabase(), '^WatchLog'); - - SELECT * - FROM WatchLog - - ┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ - │ 2018-01-01 │ 1 │ hit │ 3 │ - └────────────┴────────┴───────────┴─────┘ - ┌───────date─┬─UserId─┬─EventType─┬─Cnt─┐ - │ 2018-01-02 │ 2 │ hit │ 3 │ - └────────────┴────────┴───────────┴─────┘ - -## 虚拟列 {#xu-ni-lie} - -虚拟列是一种由表引擎提供而不是在表定义中的列。换种说法就是,这些列并没有在 `CREATE TABLE` 中指定,但可以在 `SELECT` 中使用。 - -下面列出虚拟列跟普通列的不同点: - -- 虚拟列不在表结构定义里指定。 -- 不能用 `INSERT` 向虚拟列写数据。 -- 使用不指定列名的 `INSERT` 语句时,虚拟列要会被忽略掉。 -- 使用星号通配符( `SELECT *` )时虚拟列不会包含在里面。 -- 虚拟列不会出现在 `SHOW CREATE TABLE` 和 `DESC TABLE` 的查询结果里。 - -`Merge` 类型的表包括一个 `String` 类型的 `_table` 虚拟列。(如果该表本来已有了一个 `_table` 的列,那这个虚拟列会命名为 `_table1` ;如果 `_table1` 也本就存在了,那这个虚拟列会被命名为 `_table2` ,依此类推)该列包含被读数据的表名。 - -如果 `WHERE/PREWHERE` 子句包含了带 `_table` 的条件,并且没有依赖其他的列(如作为表达式谓词链接的一个子项或作为整个的表达式),这些条件的作用会像索引一样。这些条件会在那些可能被读数据的表的表名上执行,并且读操作只会在那些满足了该条件的表上去执行。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/merge/) diff --git a/docs/zh/engines/table_engines/special/null.md b/docs/zh/engines/table_engines/special/null.md deleted file mode 100644 index 3fd891db393..00000000000 --- a/docs/zh/engines/table_engines/special/null.md +++ /dev/null @@ -1,8 +0,0 @@ - -# Null {#null} - -当写入 Null 类型的表时,将忽略数据。从 Null 类型的表中读取时,返回空。 - -但是,可以在 Null 类型的表上创建物化视图。写入表的数据将转发到视图中。 - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/null/) diff --git a/docs/zh/engines/table_engines/special/set.md b/docs/zh/engines/table_engines/special/set.md deleted file mode 100644 index b6ef859b85a..00000000000 --- a/docs/zh/engines/table_engines/special/set.md +++ /dev/null @@ -1,12 +0,0 @@ - -# 设置 {#set} - -始终存在于 RAM 中的数据集。它适用于IN运算符的右侧(请参见 «IN运算符» 部分)。 - -可以使用 INSERT 向表中插入数据。新元素将添加到数据集中,而重复项将被忽略。但是不能对此类型表执行 SELECT 语句。检索数据的唯一方法是在 IN 运算符的右半部分使用它。 - -数据始终存在于 RAM 中。对于 INSERT,插入数据块也会写入磁盘上的表目录。启动服务器时,此数据将加载到 RAM。也就是说,重新启动后,数据仍然存在。 - -对于强制服务器重启,磁盘上的数据块可能会丢失或损坏。在数据块损坏的情况下,可能需要手动删除包含损坏数据的文件。 - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/set/) diff --git a/docs/zh/engines/table_engines/special/url.md b/docs/zh/engines/table_engines/special/url.md deleted file mode 100644 index 0e02693aea0..00000000000 --- a/docs/zh/engines/table_engines/special/url.md +++ /dev/null @@ -1,72 +0,0 @@ - -# URL(URL,格式) {#table_engines-url} - -用于管理远程 HTTP/HTTPS 服务器上的数据。该引擎类似 -[文件](file.md) 引擎。 - -## 在 ClickHouse 服务器中使用引擎 {#zai-clickhouse-fu-wu-qi-zhong-shi-yong-yin-qing} - -`Format` 必须是 ClickHouse 可以用于 -`SELECT` 查询的一种格式,若有必要,还要可用于 `INSERT` 。有关支持格式的完整列表,请查看 -[格式](../../../interfaces/formats.md#formats)。 - -`URL` 必须符合统一资源定位符的结构。指定的URL必须指向一个 -HTTP 或 HTTPS 服务器。对于服务端响应, -不需要任何额外的 HTTP 头标记。 - -`INSERT` 和 `SELECT` 查询会分别转换为 `POST` 和 `GET` 请求。 -对于 `POST` 请求的处理,远程服务器必须支持 -[分块传输编码](https://en.wikipedia.org/wiki/Chunked_transfer_encoding)。 - -**示例:** - -**1.** 在 Clickhouse 服务上创建一个 `url_engine_table` 表: - -``` sql -CREATE TABLE url_engine_table (word String, value UInt64) -ENGINE=URL('http://127.0.0.1:12345/', CSV) -``` - -**2.** 用标准的 Python 3 工具库创建一个基本的 HTTP 服务并 -启动它: - -``` python3 -from http.server import BaseHTTPRequestHandler, HTTPServer - -class CSVHTTPServer(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type', 'text/csv') - self.end_headers() - - self.wfile.write(bytes('Hello,1\nWorld,2\n', "utf-8")) - -if __name__ == "__main__": - server_address = ('127.0.0.1', 12345) - HTTPServer(server_address, CSVHTTPServer).serve_forever() -``` - -``` bash -python3 server.py -``` - -**3.** 查询请求: - -``` sql -SELECT * FROM url_engine_table -``` - - ┌─word──┬─value─┐ - │ Hello │ 1 │ - │ World │ 2 │ - └───────┴───────┘ - -## 功能实现 {#gong-neng-shi-xian} - -- 读写操作都支持并发 -- 不支持: - - `ALTER` 和 `SELECT...SAMPLE` 操作。 - - 索引。 - - 副本。 - -[来源文章](https://clickhouse.tech/docs/en/operations/table_engines/url/) diff --git a/docs/zh/engines/table_engines/special/view.md b/docs/zh/engines/table_engines/special/view.md deleted file mode 100644 index a17dab21ce2..00000000000 --- a/docs/zh/engines/table_engines/special/view.md +++ /dev/null @@ -1,6 +0,0 @@ - -# 查看 {#view} - -用于构建视图(有关更多信息,请参阅 `CREATE VIEW 查询`)。 它不存储数据,仅存储指定的 `SELECT` 查询。 从表中读取时,它会运行此查询(并从查询中删除所有不必要的列)。 - -[原始文章](https://clickhouse.tech/docs/en/operations/table_engines/view/) diff --git a/docs/zh/faq/general.md b/docs/zh/faq/general.md index b81d521fa80..51f4e0b153f 100644 --- a/docs/zh/faq/general.md +++ b/docs/zh/faq/general.md @@ -1,4 +1,3 @@ - # 常见问题 {#chang-jian-wen-ti} ## 为什么不使用MapReduce之类的产品呢? {#wei-shi-yao-bu-shi-yong-mapreducezhi-lei-de-chan-pin-ni} diff --git a/docs/zh/getting-started/example-datasets/amplab-benchmark.md b/docs/zh/getting-started/example-datasets/amplab-benchmark.md new file mode 100644 index 00000000000..f8722df680e --- /dev/null +++ b/docs/zh/getting-started/example-datasets/amplab-benchmark.md @@ -0,0 +1,122 @@ +# AMPLab大数据基准测试 {#amplab-da-shu-ju-ji-zhun-ce-shi} + +参考 https://amplab.cs.berkeley.edu/benchmark/ + +需要您在https://aws.amazon.com注册一个免费的账号。注册时需要您提供信用卡、邮箱、电话等信息。之后可以在https://console.aws.amazon.com/iam/home?nc2=h\_m\_sc\#security\_credential获取新的访问密钥 + +在控制台运行以下命令: + +``` bash +$ sudo apt-get install s3cmd +$ mkdir tiny; cd tiny; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/tiny/ . +$ cd .. +$ mkdir 1node; cd 1node; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/1node/ . +$ cd .. +$ mkdir 5nodes; cd 5nodes; +$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/5nodes/ . +$ cd .. +``` + +在ClickHouse运行如下查询: + +``` sql +CREATE TABLE rankings_tiny +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_tiny +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); + +CREATE TABLE rankings_1node +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_1node +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); + +CREATE TABLE rankings_5nodes_on_single +( + pageURL String, + pageRank UInt32, + avgDuration UInt32 +) ENGINE = Log; + +CREATE TABLE uservisits_5nodes_on_single +( + sourceIP String, + destinationURL String, + visitDate Date, + adRevenue Float32, + UserAgent String, + cCode FixedString(3), + lCode FixedString(6), + searchWord String, + duration UInt32 +) ENGINE = MergeTree(visitDate, visitDate, 8192); +``` + +回到控制台运行如下命令: + +``` bash +$ for i in tiny/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_tiny FORMAT CSV"; done +$ for i in tiny/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_tiny FORMAT CSV"; done +$ for i in 1node/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_1node FORMAT CSV"; done +$ for i in 1node/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_1node FORMAT CSV"; done +$ for i in 5nodes/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_5nodes_on_single FORMAT CSV"; done +$ for i in 5nodes/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_5nodes_on_single FORMAT CSV"; done +``` + +简单的查询示例: + +``` sql +SELECT pageURL, pageRank FROM rankings_1node WHERE pageRank > 1000 + +SELECT substring(sourceIP, 1, 8), sum(adRevenue) FROM uservisits_1node GROUP BY substring(sourceIP, 1, 8) + +SELECT + sourceIP, + sum(adRevenue) AS totalRevenue, + avg(pageRank) AS pageRank +FROM rankings_1node ALL INNER JOIN +( + SELECT + sourceIP, + destinationURL AS pageURL, + adRevenue + FROM uservisits_1node + WHERE (visitDate > '1980-01-01') AND (visitDate < '1980-04-01') +) USING pageURL +GROUP BY sourceIP +ORDER BY totalRevenue DESC +LIMIT 1 +``` + +[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/amplab_benchmark/) diff --git a/docs/zh/getting-started/example-datasets/criteo.md b/docs/zh/getting-started/example-datasets/criteo.md new file mode 100644 index 00000000000..8135634f9c4 --- /dev/null +++ b/docs/zh/getting-started/example-datasets/criteo.md @@ -0,0 +1,74 @@ +# Criteo TB级别点击日志 {#criteo-tbji-bie-dian-ji-ri-zhi} + +可以从http://labs.criteo.com/downloads/download-terabyte-click-logs/上下载数据 + +创建原始数据对应的表结构: + +``` sql +CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log +``` + +下载数据: + +``` bash +$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done +``` + +创建转换后的数据对应的表结构: + +``` sql +CREATE TABLE criteo +( + date Date, + clicked UInt8, + int1 Int32, + int2 Int32, + int3 Int32, + int4 Int32, + int5 Int32, + int6 Int32, + int7 Int32, + int8 Int32, + int9 Int32, + int10 Int32, + int11 Int32, + int12 Int32, + int13 Int32, + icat1 UInt32, + icat2 UInt32, + icat3 UInt32, + icat4 UInt32, + icat5 UInt32, + icat6 UInt32, + icat7 UInt32, + icat8 UInt32, + icat9 UInt32, + icat10 UInt32, + icat11 UInt32, + icat12 UInt32, + icat13 UInt32, + icat14 UInt32, + icat15 UInt32, + icat16 UInt32, + icat17 UInt32, + icat18 UInt32, + icat19 UInt32, + icat20 UInt32, + icat21 UInt32, + icat22 UInt32, + icat23 UInt32, + icat24 UInt32, + icat25 UInt32, + icat26 UInt32 +) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) +``` + +将第一张表中的原始数据转化写入到第二张表中去: + +``` sql +INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; + +DROP TABLE criteo_log; +``` + +[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/zh/getting-started/example-datasets/index.md b/docs/zh/getting-started/example-datasets/index.md new file mode 100644 index 00000000000..15f4d483312 --- /dev/null +++ b/docs/zh/getting-started/example-datasets/index.md @@ -0,0 +1,20 @@ +--- +toc_folder_title: "\u793A\u4F8B\u6570\u636E\u96C6" +toc_priority: 12 +toc_title: "\u5BFC\u8A00" +--- + +# 示例数据集 {#example-datasets} + +本节介绍如何获取示例数据集并将其导入ClickHouse。 +对于某些数据集示例查询也可用。 + +- [脱敏的Yandex.Metrica数据集](metrica.md) +- [星型基准测试](star-schema.md) +- [维基访问数据](wikistat.md) +- [Criteo TB级别点击日志](criteo.md) +- [AMPLab大数据基准测试](amplab-benchmark.md) +- [纽约出租车数据](nyc-taxi.md) +- [航班飞行数据](ontime.md) + +[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/zh/getting-started/example-datasets/metrica.md b/docs/zh/getting-started/example-datasets/metrica.md new file mode 100644 index 00000000000..325b6231bec --- /dev/null +++ b/docs/zh/getting-started/example-datasets/metrica.md @@ -0,0 +1,68 @@ +--- +toc_priority: 21 +toc_title: "Yandex\u6885\u7279\u91CC\u5361\u6570\u636E" +--- + +# 脱敏的Yandex.Metrica数据集 {#anonymized-yandex-metrica-data} + +Dataset由两个表组成,其中包含有关命中的匿名数据 (`hits_v1`)和访问 (`visits_v1`)的Yandex的。梅特里卡 你可以阅读更多关于Yandex的。梅特里卡 [ClickHouse历史](../../introduction/history.md) 科。 + +数据集由两个表组成,其中任何一个都可以作为压缩表下载 `tsv.xz` 文件或作为准备的分区。 除此之外,该扩展版本 `hits` 包含1亿行的表可作为TSV在https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz 并作为准备的分区在https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. + +## 从准备好的分区获取表 {#obtaining-tables-from-prepared-partitions} + +下载和导入点击表: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar +tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +下载和导入访问: + +``` bash +curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar +tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory +# check permissions on unpacked data, fix if required +sudo service clickhouse-server restart +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## 从压缩TSV文件获取表 {#obtaining-tables-from-compressed-tsv-file} + +从压缩的TSV文件下载并导入命中: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" +``` + +从压缩tsv文件下载和导入访问: + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +# now create table +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" +clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" +# import data +cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 +# optionally you can optimize table +clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" +clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" +``` + +## 查询示例 {#example-queries} + +[点击教程](../../getting-started/tutorial.md) 是基于Yandex的。Metrica数据集和开始使用此数据集的推荐方式是通过教程。 + +查询这些表的其他示例可以在 [有状态测试](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) ClickHouse的(它们被命名为 `test.hists` 和 `test.visits` 那里)。 diff --git a/docs/zh/getting-started/example-datasets/nyc-taxi.md b/docs/zh/getting-started/example-datasets/nyc-taxi.md new file mode 100644 index 00000000000..31f81c1d5c8 --- /dev/null +++ b/docs/zh/getting-started/example-datasets/nyc-taxi.md @@ -0,0 +1,384 @@ +# 纽约市出租车数据 {#niu-yue-shi-chu-zu-che-shu-ju} + +纽约市出租车数据有以下两个方式获取: + +从原始数据导入 +下载预处理好的分区数据 + +## 怎样导入原始数据 {#zen-yang-dao-ru-yuan-shi-shu-ju} + +可以参考https://github.com/toddwschneider/nyc-taxi-data和http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html中的关于数据集结构描述与数据下载指令说明。 + +数据集包含227GB的CSV文件。这大约需要一个小时的下载时间(1Gbit带宽下,并行下载大概是一半时间)。 +下载时注意损坏的文件。可以检查文件大小并重新下载损坏的文件。 + +有些文件中包含一些无效的行,您可以使用如下语句修复他们: + +``` bash +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ +sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ +mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv +mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv +``` + +然后您必须在PostgreSQL中预处理这些数据。这将创建多边形中的点(以匹配在地图中纽约市中范围),然后通过使用JOIN查询将数据关联组合到一个规范的表中。为了完成这部分操作,您需要安装PostgreSQL的同时安装PostGIS插件。 + +运行`initialize_database.sh`时要小心,并手动重新检查是否正确创建了所有表。 + +在PostgreSQL中处理每个月的数据大约需要20-30分钟,总共大约需要48小时。 + +您可以按如下方式检查下载的行数: + +``` bash +$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" +## Count + 1298979494 +(1 row) + +real 7m9.164s +``` + +(根据Mark Litwintschik的系列博客报道数据略多余11亿行) + +PostgreSQL处理这些数据大概需要370GB的磁盘空间。 + +从PostgreSQL中导出数据: + +``` sql +COPY +( + SELECT trips.id, + trips.vendor_id, + trips.pickup_datetime, + trips.dropoff_datetime, + trips.store_and_fwd_flag, + trips.rate_code_id, + trips.pickup_longitude, + trips.pickup_latitude, + trips.dropoff_longitude, + trips.dropoff_latitude, + trips.passenger_count, + trips.trip_distance, + trips.fare_amount, + trips.extra, + trips.mta_tax, + trips.tip_amount, + trips.tolls_amount, + trips.ehail_fee, + trips.improvement_surcharge, + trips.total_amount, + trips.payment_type, + trips.trip_type, + trips.pickup, + trips.dropoff, + + cab_types.type cab_type, + + weather.precipitation_tenths_of_mm rain, + weather.snow_depth_mm, + weather.snowfall_mm, + weather.max_temperature_tenths_degrees_celsius max_temp, + weather.min_temperature_tenths_degrees_celsius min_temp, + weather.average_wind_speed_tenths_of_meters_per_second wind, + + pick_up.gid pickup_nyct2010_gid, + pick_up.ctlabel pickup_ctlabel, + pick_up.borocode pickup_borocode, + pick_up.boroname pickup_boroname, + pick_up.ct2010 pickup_ct2010, + pick_up.boroct2010 pickup_boroct2010, + pick_up.cdeligibil pickup_cdeligibil, + pick_up.ntacode pickup_ntacode, + pick_up.ntaname pickup_ntaname, + pick_up.puma pickup_puma, + + drop_off.gid dropoff_nyct2010_gid, + drop_off.ctlabel dropoff_ctlabel, + drop_off.borocode dropoff_borocode, + drop_off.boroname dropoff_boroname, + drop_off.ct2010 dropoff_ct2010, + drop_off.boroct2010 dropoff_boroct2010, + drop_off.cdeligibil dropoff_cdeligibil, + drop_off.ntacode dropoff_ntacode, + drop_off.ntaname dropoff_ntaname, + drop_off.puma dropoff_puma + FROM trips + LEFT JOIN cab_types + ON trips.cab_type_id = cab_types.id + LEFT JOIN central_park_weather_observations_raw weather + ON weather.date = trips.pickup_datetime::date + LEFT JOIN nyct2010 pick_up + ON pick_up.gid = trips.pickup_nyct2010_gid + LEFT JOIN nyct2010 drop_off + ON drop_off.gid = trips.dropoff_nyct2010_gid +) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; +``` + +数据快照的创建速度约为每秒50 MB。 在创建快照时,PostgreSQL以每秒约28 MB的速度从磁盘读取数据。 +这大约需要5个小时。 最终生成的TSV文件为590612904969 bytes。 + +在ClickHouse中创建临时表: + +``` sql +CREATE TABLE trips +( +trip_id UInt32, +vendor_id String, +pickup_datetime DateTime, +dropoff_datetime Nullable(DateTime), +store_and_fwd_flag Nullable(FixedString(1)), +rate_code_id Nullable(UInt8), +pickup_longitude Nullable(Float64), +pickup_latitude Nullable(Float64), +dropoff_longitude Nullable(Float64), +dropoff_latitude Nullable(Float64), +passenger_count Nullable(UInt8), +trip_distance Nullable(Float64), +fare_amount Nullable(Float32), +extra Nullable(Float32), +mta_tax Nullable(Float32), +tip_amount Nullable(Float32), +tolls_amount Nullable(Float32), +ehail_fee Nullable(Float32), +improvement_surcharge Nullable(Float32), +total_amount Nullable(Float32), +payment_type Nullable(String), +trip_type Nullable(UInt8), +pickup Nullable(String), +dropoff Nullable(String), +cab_type Nullable(String), +precipitation Nullable(UInt8), +snow_depth Nullable(UInt8), +snowfall Nullable(UInt8), +max_temperature Nullable(UInt8), +min_temperature Nullable(UInt8), +average_wind_speed Nullable(UInt8), +pickup_nyct2010_gid Nullable(UInt8), +pickup_ctlabel Nullable(String), +pickup_borocode Nullable(UInt8), +pickup_boroname Nullable(String), +pickup_ct2010 Nullable(String), +pickup_boroct2010 Nullable(String), +pickup_cdeligibil Nullable(FixedString(1)), +pickup_ntacode Nullable(String), +pickup_ntaname Nullable(String), +pickup_puma Nullable(String), +dropoff_nyct2010_gid Nullable(UInt8), +dropoff_ctlabel Nullable(String), +dropoff_borocode Nullable(UInt8), +dropoff_boroname Nullable(String), +dropoff_ct2010 Nullable(String), +dropoff_boroct2010 Nullable(String), +dropoff_cdeligibil Nullable(String), +dropoff_ntacode Nullable(String), +dropoff_ntaname Nullable(String), +dropoff_puma Nullable(String) +) ENGINE = Log; +``` + +接下来,需要将字段转换为更正确的数据类型,并且在可能的情况下,消除NULL。 + +``` bash +$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv + +real 75m56.214s +``` + +数据的读取速度为112-140 Mb/秒。 +通过这种方式将数据加载到Log表中需要76分钟。 +这个表中的数据需要使用142 GB的磁盘空间. + +(也可以直接使用`COPY ... TO PROGRAM`从Postgres中导入数据) + +由于数据中与天气相关的所有数据(precipitation……average\_wind\_speed)都填充了NULL。 所以,我们将从最终数据集中删除它们 + +首先,我们使用单台服务器创建表,后面我们将在多台节点上创建这些表。 + +创建表结构并写入数据: + +``` sql +CREATE TABLE trips_mergetree +ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +AS SELECT + +trip_id, +CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, +toDate(pickup_datetime) AS pickup_date, +ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, +toDate(dropoff_datetime) AS dropoff_date, +ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, +assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, +assumeNotNull(rate_code_id) AS rate_code_id, +assumeNotNull(pickup_longitude) AS pickup_longitude, +assumeNotNull(pickup_latitude) AS pickup_latitude, +assumeNotNull(dropoff_longitude) AS dropoff_longitude, +assumeNotNull(dropoff_latitude) AS dropoff_latitude, +assumeNotNull(passenger_count) AS passenger_count, +assumeNotNull(trip_distance) AS trip_distance, +assumeNotNull(fare_amount) AS fare_amount, +assumeNotNull(extra) AS extra, +assumeNotNull(mta_tax) AS mta_tax, +assumeNotNull(tip_amount) AS tip_amount, +assumeNotNull(tolls_amount) AS tolls_amount, +assumeNotNull(ehail_fee) AS ehail_fee, +assumeNotNull(improvement_surcharge) AS improvement_surcharge, +assumeNotNull(total_amount) AS total_amount, +CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, +assumeNotNull(trip_type) AS trip_type, +ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, +ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, +CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, + +assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, +toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, +assumeNotNull(pickup_borocode) AS pickup_borocode, +CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, +toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, +toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, +CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, +toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, + +CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, + +toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, + +assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, +toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, +assumeNotNull(dropoff_borocode) AS dropoff_borocode, +CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, +toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, +toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, +CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, +toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, + +CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, + +toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma + +FROM trips +``` + +这需要3030秒,速度约为每秒428,000行。 +要加快速度,可以使用`Log`引擎替换’MergeTree\`引擎来创建表。 在这种情况下,下载速度超过200秒。 + +这个表需要使用126GB的磁盘空间。 + +``` sql +SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active +``` + +``` text +┌─formatReadableSize(sum(bytes))─┐ +│ 126.18 GiB │ +└────────────────────────────────┘ +``` + +除此之外,你还可以在MergeTree上运行OPTIMIZE查询来进行优化。但这不是必须的,因为即使在没有进行优化的情况下它的表现依然是很好的。 + +## 下载预处理好的分区数据 {#xia-zai-yu-chu-li-hao-de-fen-qu-shu-ju} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar +$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" +``` + +!!! info "信息" + 如果要运行下面的SQL查询,必须使用完整的表名, +`datasets.trips_mergetree`。 + +## 单台服务器运行结果 {#dan-tai-fu-wu-qi-yun-xing-jie-guo} + +Q1: + +``` sql +SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type +``` + +0.490秒 + +Q2: + +``` sql +SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count +``` + +1.224秒 + +Q3: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year +``` + +2.104秒 + +Q4: + +``` sql +SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) +FROM trips_mergetree +GROUP BY passenger_count, year, distance +ORDER BY year, count(*) DESC +``` + +3.593秒 + +我们使用的是如下配置的服务器: + +两个英特尔(R)至强(R)CPU E5-2650v2@2.60GHz,总共有16个物理内核,128GiB RAM,硬件RAID-5上的8X6TB HD + +执行时间是取三次运行中最好的值,但是从第二次查询开始,查询就讲从文件系统的缓存中读取数据。同时在每次读取和处理后不在进行缓存。 + +在三台服务器中创建表结构: + +在每台服务器中运行: + +``` sql +CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) +``` + +在之前的服务器中运行: + +``` sql +CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) +``` + +运行如下查询重新分布数据: + +``` sql +INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree +``` + +这个查询需要运行2454秒。 + +在三台服务器集群中运行的结果: + +Q1:0.212秒. +Q2:0.438秒。 +Q3:0.733秒。 +Q4:1.241秒. + +不出意料,查询是线性扩展的。 + +我们同时在140台服务器的集群中运行的结果: + +Q1:0.028秒。 +Q2:0.043秒。 +Q3:0.051秒。 +Q4:0.072秒。 + +在这种情况下,查询处理时间首先由网络延迟确定。 +我们使用位于芬兰的Yandex数据中心中的客户端去位于俄罗斯的集群上运行查询,这增加了大约20毫秒的延迟。 + +## 总结 {#zong-jie} + +| 服务器 | Q1 | Q2 | Q3 | Q4 | +|--------|-------|-------|-------|-------| +| 1 | 0.490 | 1.224 | 2.104 | 3.593 | +| 3 | 0.212 | 0.438 | 0.733 | 1.241 | +| 140 | 0.028 | 0.043 | 0.051 | 0.072 | + +[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/zh/getting-started/example-datasets/ontime.md b/docs/zh/getting-started/example-datasets/ontime.md new file mode 100644 index 00000000000..51749d9013b --- /dev/null +++ b/docs/zh/getting-started/example-datasets/ontime.md @@ -0,0 +1,404 @@ +# 航班飞行数据 {#hang-ban-fei-xing-shu-ju} + +航班飞行数据有以下两个方式获取: + +- 从原始数据导入 +- 下载预处理好的分区数据 + +## 从原始数据导入 {#cong-yuan-shi-shu-ju-dao-ru} + +下载数据: + +``` bash +for s in `seq 1987 2018` +do +for m in `seq 1 12` +do +wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip +done +done +``` + +(引用 https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) + +创建表结构: + +``` sql +CREATE TABLE `ontime` ( + `Year` UInt16, + `Quarter` UInt8, + `Month` UInt8, + `DayofMonth` UInt8, + `DayOfWeek` UInt8, + `FlightDate` Date, + `UniqueCarrier` FixedString(7), + `AirlineID` Int32, + `Carrier` FixedString(2), + `TailNum` String, + `FlightNum` String, + `OriginAirportID` Int32, + `OriginAirportSeqID` Int32, + `OriginCityMarketID` Int32, + `Origin` FixedString(5), + `OriginCityName` String, + `OriginState` FixedString(2), + `OriginStateFips` String, + `OriginStateName` String, + `OriginWac` Int32, + `DestAirportID` Int32, + `DestAirportSeqID` Int32, + `DestCityMarketID` Int32, + `Dest` FixedString(5), + `DestCityName` String, + `DestState` FixedString(2), + `DestStateFips` String, + `DestStateName` String, + `DestWac` Int32, + `CRSDepTime` Int32, + `DepTime` Int32, + `DepDelay` Int32, + `DepDelayMinutes` Int32, + `DepDel15` Int32, + `DepartureDelayGroups` String, + `DepTimeBlk` String, + `TaxiOut` Int32, + `WheelsOff` Int32, + `WheelsOn` Int32, + `TaxiIn` Int32, + `CRSArrTime` Int32, + `ArrTime` Int32, + `ArrDelay` Int32, + `ArrDelayMinutes` Int32, + `ArrDel15` Int32, + `ArrivalDelayGroups` Int32, + `ArrTimeBlk` String, + `Cancelled` UInt8, + `CancellationCode` FixedString(1), + `Diverted` UInt8, + `CRSElapsedTime` Int32, + `ActualElapsedTime` Int32, + `AirTime` Int32, + `Flights` Int32, + `Distance` Int32, + `DistanceGroup` UInt8, + `CarrierDelay` Int32, + `WeatherDelay` Int32, + `NASDelay` Int32, + `SecurityDelay` Int32, + `LateAircraftDelay` Int32, + `FirstDepTime` String, + `TotalAddGTime` String, + `LongestAddGTime` String, + `DivAirportLandings` String, + `DivReachedDest` String, + `DivActualElapsedTime` String, + `DivArrDelay` String, + `DivDistance` String, + `Div1Airport` String, + `Div1AirportID` Int32, + `Div1AirportSeqID` Int32, + `Div1WheelsOn` String, + `Div1TotalGTime` String, + `Div1LongestGTime` String, + `Div1WheelsOff` String, + `Div1TailNum` String, + `Div2Airport` String, + `Div2AirportID` Int32, + `Div2AirportSeqID` Int32, + `Div2WheelsOn` String, + `Div2TotalGTime` String, + `Div2LongestGTime` String, + `Div2WheelsOff` String, + `Div2TailNum` String, + `Div3Airport` String, + `Div3AirportID` Int32, + `Div3AirportSeqID` Int32, + `Div3WheelsOn` String, + `Div3TotalGTime` String, + `Div3LongestGTime` String, + `Div3WheelsOff` String, + `Div3TailNum` String, + `Div4Airport` String, + `Div4AirportID` Int32, + `Div4AirportSeqID` Int32, + `Div4WheelsOn` String, + `Div4TotalGTime` String, + `Div4LongestGTime` String, + `Div4WheelsOff` String, + `Div4TailNum` String, + `Div5Airport` String, + `Div5AirportID` Int32, + `Div5AirportSeqID` Int32, + `Div5WheelsOn` String, + `Div5TotalGTime` String, + `Div5LongestGTime` String, + `Div5WheelsOff` String, + `Div5TailNum` String +) ENGINE = MergeTree +PARTITION BY Year +ORDER BY (Carrier, FlightDate) +SETTINGS index_granularity = 8192; +``` + +加载数据: + +``` bash +$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done +``` + +## 下载预处理好的分区数据 {#xia-zai-yu-chu-li-hao-de-fen-qu-shu-ju} + +``` bash +$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar +$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory +$ # check permissions of unpacked data, fix if required +$ sudo service clickhouse-server restart +$ clickhouse-client --query "select count(*) from datasets.ontime" +``` + +!!! info "信息" + 如果要运行下面的SQL查询,必须使用完整的表名, +`datasets.ontime`。 + +## 查询: {#cha-xun} + +Q0. + +``` sql +SELECT avg(c1) +FROM +( + SELECT Year, Month, count(*) AS c1 + FROM ontime + GROUP BY Year, Month +); +``` + +Q1. 查询从2000年到2008年每天的航班数 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +Q2. 查询从2000年到2008年每周延误超过10分钟的航班数。 + +``` sql +SELECT DayOfWeek, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY DayOfWeek +ORDER BY c DESC; +``` + +Q3. 查询2000年到2008年每个机场延误超过10分钟以上的次数 + +``` sql +SELECT Origin, count(*) AS c +FROM ontime +WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 +GROUP BY Origin +ORDER BY c DESC +LIMIT 10; +``` + +Q4. 查询2007年各航空公司延误超过10分钟以上的次数 + +``` sql +SELECT Carrier, count(*) +FROM ontime +WHERE DepDelay>10 AND Year=2007 +GROUP BY Carrier +ORDER BY count(*) DESC; +``` + +Q5. 查询2007年各航空公司延误超过10分钟以上的百分比 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year=2007 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year=2007 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +更好的查询版本: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year=2007 +GROUP BY Carrier +ORDER BY c3 DESC +``` + +Q6. 同上一个查询一致,只是查询范围扩大到2000年到2008年 + +``` sql +SELECT Carrier, c, c2, c*100/c2 as c3 +FROM +( + SELECT + Carrier, + count(*) AS c + FROM ontime + WHERE DepDelay>10 + AND Year>=2000 AND Year<=2008 + GROUP BY Carrier +) +JOIN +( + SELECT + Carrier, + count(*) AS c2 + FROM ontime + WHERE Year>=2000 AND Year<=2008 + GROUP BY Carrier +) USING Carrier +ORDER BY c3 DESC; +``` + +更好的查询版本: + +``` sql +SELECT Carrier, avg(DepDelay>10)*100 AS c3 +FROM ontime +WHERE Year>=2000 AND Year<=2008 +GROUP BY Carrier +ORDER BY c3 DESC; +``` + +Q7. 每年航班延误超过10分钟的百分比 + +``` sql +SELECT Year, c1/c2 +FROM +( + select + Year, + count(*)*100 as c1 + from ontime + WHERE DepDelay>10 + GROUP BY Year +) +JOIN +( + select + Year, + count(*) as c2 + from ontime + GROUP BY Year +) USING (Year) +ORDER BY Year; +``` + +更好的查询版本: + +``` sql +SELECT Year, avg(DepDelay>10)*100 +FROM ontime +GROUP BY Year +ORDER BY Year; +``` + +Q8. 每年更受人们喜爱的目的地 + +``` sql +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +WHERE Year >= 2000 and Year <= 2010 +GROUP BY DestCityName +ORDER BY u DESC LIMIT 10; +``` + +Q9. + +``` sql +SELECT Year, count(*) AS c1 +FROM ontime +GROUP BY Year; +``` + +Q10. + +``` sql +SELECT + min(Year), max(Year), Carrier, count(*) AS cnt, + sum(ArrDelayMinutes>30) AS flights_delayed, + round(sum(ArrDelayMinutes>30)/count(*),2) AS rate +FROM ontime +WHERE + DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') + AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') + AND FlightDate < '2010-01-01' +GROUP by Carrier +HAVING cnt>100000 and max(Year)>1990 +ORDER by rate DESC +LIMIT 1000; +``` + +奖金: + +``` sql +SELECT avg(cnt) +FROM +( + SELECT Year,Month,count(*) AS cnt + FROM ontime + WHERE DepDel15=1 + GROUP BY Year,Month +); + +SELECT avg(c1) FROM +( + SELECT Year,Month,count(*) AS c1 + FROM ontime + GROUP BY Year,Month +); + +SELECT DestCityName, uniqExact(OriginCityName) AS u +FROM ontime +GROUP BY DestCityName +ORDER BY u DESC +LIMIT 10; + +SELECT OriginCityName, DestCityName, count() AS c +FROM ontime +GROUP BY OriginCityName, DestCityName +ORDER BY c DESC +LIMIT 10; + +SELECT OriginCityName, count() AS c +FROM ontime +GROUP BY OriginCityName +ORDER BY c DESC +LIMIT 10; +``` + +这个性能测试由Vadim Tkachenko提供。参考: + +- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ +- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ +- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ +- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ +- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ +- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html diff --git a/docs/zh/getting-started/example-datasets/star-schema.md b/docs/zh/getting-started/example-datasets/star-schema.md new file mode 100644 index 00000000000..71dd58160a6 --- /dev/null +++ b/docs/zh/getting-started/example-datasets/star-schema.md @@ -0,0 +1,193 @@ +# 星型基准测试 {#star-schema-benchmark} + +编译 dbgen: + +``` bash +$ git clone git@github.com:vadimtk/ssb-dbgen.git +$ cd ssb-dbgen +$ make +``` + +开始生成数据: + +``` bash +$ ./dbgen -s 1000 -T c +$ ./dbgen -s 1000 -T l +$ ./dbgen -s 1000 -T p +$ ./dbgen -s 1000 -T s +$ ./dbgen -s 1000 -T d +``` + +在ClickHouse中创建表结构: + +``` sql +CREATE TABLE customer +( + C_CUSTKEY UInt32, + C_NAME String, + C_ADDRESS String, + C_CITY LowCardinality(String), + C_NATION LowCardinality(String), + C_REGION LowCardinality(String), + C_PHONE String, + C_MKTSEGMENT LowCardinality(String) +) +ENGINE = MergeTree ORDER BY (C_CUSTKEY); + +CREATE TABLE lineorder +( + LO_ORDERKEY UInt32, + LO_LINENUMBER UInt8, + LO_CUSTKEY UInt32, + LO_PARTKEY UInt32, + LO_SUPPKEY UInt32, + LO_ORDERDATE Date, + LO_ORDERPRIORITY LowCardinality(String), + LO_SHIPPRIORITY UInt8, + LO_QUANTITY UInt8, + LO_EXTENDEDPRICE UInt32, + LO_ORDTOTALPRICE UInt32, + LO_DISCOUNT UInt8, + LO_REVENUE UInt32, + LO_SUPPLYCOST UInt32, + LO_TAX UInt8, + LO_COMMITDATE Date, + LO_SHIPMODE LowCardinality(String) +) +ENGINE = MergeTree PARTITION BY toYear(LO_ORDERDATE) ORDER BY (LO_ORDERDATE, LO_ORDERKEY); + +CREATE TABLE part +( + P_PARTKEY UInt32, + P_NAME String, + P_MFGR LowCardinality(String), + P_CATEGORY LowCardinality(String), + P_BRAND LowCardinality(String), + P_COLOR LowCardinality(String), + P_TYPE LowCardinality(String), + P_SIZE UInt8, + P_CONTAINER LowCardinality(String) +) +ENGINE = MergeTree ORDER BY P_PARTKEY; + +CREATE TABLE supplier +( + S_SUPPKEY UInt32, + S_NAME String, + S_ADDRESS String, + S_CITY LowCardinality(String), + S_NATION LowCardinality(String), + S_REGION LowCardinality(String), + S_PHONE String +) +ENGINE = MergeTree ORDER BY S_SUPPKEY; +``` + +写入数据: + +``` bash +$ clickhouse-client --query "INSERT INTO customer FORMAT CSV" < customer.tbl +$ clickhouse-client --query "INSERT INTO part FORMAT CSV" < part.tbl +$ clickhouse-client --query "INSERT INTO supplier FORMAT CSV" < supplier.tbl +$ clickhouse-client --query "INSERT INTO lineorder FORMAT CSV" < lineorder.tbl +``` + +将«星型模型»转换为非规范化的«平面模型»: + +``` sql +SET max_memory_usage = 20000000000, allow_experimental_multiple_joins_emulation = 1; + +CREATE TABLE lineorder_flat +ENGINE = MergeTree +PARTITION BY toYear(LO_ORDERDATE) +ORDER BY (LO_ORDERDATE, LO_ORDERKEY) AS +SELECT l.*, c.*, s.*, p.* +FROM lineorder l + ANY INNER JOIN customer c ON (c.C_CUSTKEY = l.LO_CUSTKEY) + ANY INNER JOIN supplier s ON (s.S_SUPPKEY = l.LO_SUPPKEY) + ANY INNER JOIN part p ON (p.P_PARTKEY = l.LO_PARTKEY); + +ALTER TABLE lineorder_flat DROP COLUMN C_CUSTKEY, DROP COLUMN S_SUPPKEY, DROP COLUMN P_PARTKEY; +``` + +运行查询: + +Q1.1 + +``` sql +SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue FROM lineorder_flat WHERE toYear(LO_ORDERDATE) = 1993 AND LO_DISCOUNT BETWEEN 1 AND 3 AND LO_QUANTITY < 25; +``` + +Q1.2 + +``` sql +SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue FROM lineorder_flat WHERE toYYYYMM(LO_ORDERDATE) = 199401 AND LO_DISCOUNT BETWEEN 4 AND 6 AND LO_QUANTITY BETWEEN 26 AND 35; +``` + +Q1.3 + +``` sql +SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue FROM lineorder_flat WHERE toISOWeek(LO_ORDERDATE) = 6 AND toYear(LO_ORDERDATE) = 1994 AND LO_DISCOUNT BETWEEN 5 AND 7 AND LO_QUANTITY BETWEEN 26 AND 35; +``` + +Q2.1 + +``` sql +SELECT sum(LO_REVENUE), toYear(LO_ORDERDATE) AS year, P_BRAND FROM lineorder_flat WHERE P_CATEGORY = 'MFGR#12' AND S_REGION = 'AMERICA' GROUP BY year, P_BRAND ORDER BY year, P_BRAND; +``` + +Q2.2 + +``` sql +SELECT sum(LO_REVENUE), toYear(LO_ORDERDATE) AS year, P_BRAND FROM lineorder_flat WHERE P_BRAND BETWEEN 'MFGR#2221' AND 'MFGR#2228' AND S_REGION = 'ASIA' GROUP BY year, P_BRAND ORDER BY year, P_BRAND; +``` + +Q2.3 + +``` sql +SELECT sum(LO_REVENUE), toYear(LO_ORDERDATE) AS year, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#2239' AND S_REGION = 'EUROPE' GROUP BY year, P_BRAND ORDER BY year, P_BRAND; +``` + +Q3.1 + +``` sql +SELECT C_NATION, S_NATION, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE C_REGION = 'ASIA' AND S_REGION = 'ASIA' AND year >= 1992 AND year <= 1997 GROUP BY C_NATION, S_NATION, year ORDER BY year asc, revenue desc; +``` + +Q3.2 + +``` sql +SELECT C_CITY, S_CITY, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE C_NATION = 'UNITED STATES' AND S_NATION = 'UNITED STATES' AND year >= 1992 AND year <= 1997 GROUP BY C_CITY, S_CITY, year ORDER BY year asc, revenue desc; +``` + +Q3.3 + +``` sql +SELECT C_CITY, S_CITY, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND year >= 1992 AND year <= 1997 GROUP BY C_CITY, S_CITY, year ORDER BY year asc, revenue desc; +``` + +Q3.4 + +``` sql +SELECT C_CITY, S_CITY, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND toYYYYMM(LO_ORDERDATE) = '199712' GROUP BY C_CITY, S_CITY, year ORDER BY year asc, revenue desc; +``` + +Q4.1 + +``` sql +SELECT toYear(LO_ORDERDATE) AS year, C_NATION, sum(LO_REVENUE - LO_SUPPLYCOST) AS profit FROM lineorder_flat WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') GROUP BY year, C_NATION ORDER BY year, C_NATION; +``` + +Q4.2 + +``` sql +SELECT toYear(LO_ORDERDATE) AS year, S_NATION, P_CATEGORY, sum(LO_REVENUE - LO_SUPPLYCOST) AS profit FROM lineorder_flat WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (year = 1997 OR year = 1998) AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') GROUP BY year, S_NATION, P_CATEGORY ORDER BY year, S_NATION, P_CATEGORY; +``` + +Q4.3 + +``` sql +SELECT toYear(LO_ORDERDATE) AS year, S_CITY, P_BRAND, sum(LO_REVENUE - LO_SUPPLYCOST) AS profit FROM lineorder_flat WHERE S_NATION = 'UNITED STATES' AND (year = 1997 OR year = 1998) AND P_CATEGORY = 'MFGR#14' GROUP BY year, S_CITY, P_BRAND ORDER BY year, S_CITY, P_BRAND; +``` + +[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/star_schema/) diff --git a/docs/zh/getting-started/example-datasets/wikistat.md b/docs/zh/getting-started/example-datasets/wikistat.md new file mode 100644 index 00000000000..2986f90ef9f --- /dev/null +++ b/docs/zh/getting-started/example-datasets/wikistat.md @@ -0,0 +1,28 @@ +# 维基访问数据 {#wei-ji-fang-wen-shu-ju} + +参考: http://dumps.wikimedia.org/other/pagecounts-raw/ + +创建表结构: + +``` sql +CREATE TABLE wikistat +( + date Date, + time DateTime, + project String, + subproject String, + path String, + hits UInt64, + size UInt64 +) ENGINE = MergeTree(date, (path, time), 8192); +``` + +加载数据: + +``` bash +$ for i in {2007..2016}; do for j in {01..12}; do echo $i-$j >&2; curl -sSL "http://dumps.wikimedia.org/other/pagecounts-raw/$i/$i-$j/" | grep -oE 'pagecounts-[0-9]+-[0-9]+\.gz'; done; done | sort | uniq | tee links.txt +$ cat links.txt | while read link; do wget http://dumps.wikimedia.org/other/pagecounts-raw/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1/')/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1-\2/')/$link; done +$ ls -1 /opt/wikistat/ | grep gz | while read i; do echo $i; gzip -cd /opt/wikistat/$i | ./wikistat-loader --time="$(echo -n $i | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2})\.gz/\1-\2-\3 \4-00-00/')" | clickhouse-client --query="INSERT INTO wikistat FORMAT TabSeparated"; done +``` + +[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/wikistat/) diff --git a/docs/zh/getting-started/index.md b/docs/zh/getting-started/index.md new file mode 100644 index 00000000000..ac70394c785 --- /dev/null +++ b/docs/zh/getting-started/index.md @@ -0,0 +1,10 @@ +# 入门 {#ru-men} + +如果您是ClickHouse的新手,并希望亲身体验它的性能,首先您需要通过 [安装过程](install.md). + +之后,您可以选择以下选项之一: + +- [通过详细的教程](tutorial.md) +- [试验示例数据集](example-datasets/ontime.md) + +[来源文章](https://clickhouse.tech/docs/zh/getting_started/) diff --git a/docs/zh/getting-started/install.md b/docs/zh/getting-started/install.md new file mode 100644 index 00000000000..931cf6853e3 --- /dev/null +++ b/docs/zh/getting-started/install.md @@ -0,0 +1,140 @@ +# 安装 {#clickhouse-an-zhuang} + +## 系统要求 {#xi-tong-yao-qiu} + +ClickHouse可以在任何具有x86\_64,AArch64或PowerPC64LE CPU架构的Linux,FreeBSD或Mac OS X上运行。 + +虽然预构建的二进制文件通常是为x86  \_64编译并利用SSE 4.2指令集,但除非另有说明,否则使用支持它的CPU将成为额外的系统要求。这是检查当前CPU是否支持SSE 4.2的命令: + +``` bash +$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" +``` + +要在不支持SSE 4.2或具有AArch64或PowerPC64LE体系结构的处理器上运行ClickHouse,您应该[通过源构建ClickHouse](#from-sources)进行适当的配置调整。 + +## 可用的安装选项 {#ke-yong-de-an-zhuang-xuan-xiang} + +建议为Debian或Ubuntu使用官方的预编译`deb`软件包。 运行以下命令以安装软件包: + +然后运行: + +``` bash +{% include 'install/deb.sh' %} +``` + +你也可以从这里手动下载安装包:https://repo.clickhouse.tech/deb/stable/main/。 + +如果你想使用最新的测试版本,请使用`testing`替换`stable`。 + +### 来自RPM包 {#from-rpm-packages} + +Yandex ClickHouse团队建议使用官方预编译的`rpm`软件包,用于CentOS,RedHat和所有其他基于rpm的Linux发行版。 + +首先,您需要添加官方存储库: + +``` bash +sudo yum install yum-utils +sudo rpm --import https://repo.yandex.ru/clickhouse/CLICKHOUSE-KEY.GPG +sudo yum-config-manager --add-repo https://repo.yandex.ru/clickhouse/rpm/stable/x86_64 +``` + +如果您想使用最新版本,请将`stable`替换为`testing`(建议您在测试环境中使用)。 + +然后运行这些命令以实际安装包: + +``` bash +sudo yum install clickhouse-server clickhouse-client +``` + +您也可以从此处手动下载和安装软件包:https://repo.yandex.ru/clickhouse/rpm/stable/x86\_64。 + +### 来自Docker {#from-docker-image} + +要在Docker中运行ClickHouse,请遵循[码头工人中心](https://hub.docker.com/r/yandex/clickhouse-server/)上的指南。那些图像使用官方的`deb`包。 + +### 使用源码安装 {#from-sources} + +具体编译方式可以参考build.md。 + +你可以编译并安装它们。 +你也可以直接使用而不进行安装。 + +``` text +Client: programs/clickhouse-client +Server: programs/clickhouse-server +``` + +在服务器中为数据创建如下目录: + +``` text +/opt/clickhouse/data/default/ +/opt/clickhouse/metadata/default/ +``` + +(它们可以在server config中配置。) +为需要的用户运行’chown’ + +日志的路径可以在server config (src/programs/server/config.xml)中配置。 + +## 启动 {#qi-dong} + +可以运行如下命令在后台启动服务: + +``` bash +sudo service clickhouse-server start +``` + +可以在`/var/log/clickhouse-server/`目录中查看日志。 + +如果服务没有启动,请检查配置文件 `/etc/clickhouse-server/config.xml`。 + +你也可以在控制台中直接启动服务: + +``` bash +clickhouse-server --config-file=/etc/clickhouse-server/config.xml +``` + +在这种情况下,日志将被打印到控制台中,这在开发过程中很方便。 +如果配置文件在当前目录中,你可以不指定’–config-file’参数。它默认使用’./config.xml’。 + +你可以使用命令行客户端连接到服务: + +``` bash +clickhouse-client +``` + +默认情况下它使用’default’用户无密码的与localhost:9000服务建立连接。 +客户端也可以用于连接远程服务,例如: + +``` bash +clickhouse-client --host=example.com +``` + +有关更多信息,请参考«Command-line client»部分。 + +检查系统是否工作: + +``` bash +milovidov@hostname:~/work/metrica/src/src/Client$ ./clickhouse-client +ClickHouse client version 0.0.18749. +Connecting to localhost:9000. +Connected to ClickHouse server version 0.0.18749. + +:) SELECT 1 + +SELECT 1 + +┌─1─┐ +│ 1 │ +└───┘ + +1 rows in set. Elapsed: 0.003 sec. + +:) +``` + +**恭喜,系统已经工作了!** + +为了继续进行实验,你可以尝试下载测试数据集。 + +[原始文章](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/zh/getting-started/playground.md b/docs/zh/getting-started/playground.md new file mode 100644 index 00000000000..192203c6fe6 --- /dev/null +++ b/docs/zh/getting-started/playground.md @@ -0,0 +1,46 @@ +--- +toc_priority: 14 +toc_title: "\u266A\u64CD\u573A\u266A" +--- + +# ClickHouse体验平台 {#clickhouse-playground} + +[ClickHouse体验平台](https://play.clickhouse.tech?file=welcome) 允许人们通过即时运行查询来尝试ClickHouse,而无需设置他们的服务器或集群。 +体验平台中提供了几个示例数据集以及显示ClickHouse特性的示例查询。 + +查询以只读用户身份执行。 这意味着一些局限性: + +- 不允许DDL查询 +- 不允许插入查询 + +还强制执行以下设置: +- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) +- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) +- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) +- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) + +ClickHouse体验还有如下: +[ClickHouse管理服务](https://cloud.yandex.com/services/managed-clickhouse) +实例托管 [Yandex云](https://cloud.yandex.com/). +更多信息 [云提供商](../commercial/cloud.md). + +ClickHouse体验平台界面实际上是通过ClickHouse [HTTP API](../interfaces/http.md)接口实现的. +体验平台后端只是一个ClickHouse集群,没有任何额外的服务器端应用程序。 +体验平台也同样提供了ClickHouse HTTPS服务端口。 + +您可以使用任何HTTP客户端向体验平台进行查询,例如 [curl](https://curl.haxx.se) 或 [wget](https://www.gnu.org/software/wget/),或使用以下方式建立连接 [JDBC](../interfaces/jdbc.md) 或 [ODBC](../interfaces/odbc.md) 司机 +有关支持ClickHouse的软件产品的更多信息,请访问 [这里](../interfaces/index.md). + +| 参数 | 值 | +|:---------|:--------------------------------------| +| 服务端口 | https://play-api.clickhouse.tech:8443 | +| 用户 | `playground` | +| 密码 | `clickhouse` | + +请注意,此服务端口需要安全连接。 + +示例: + +``` bash +curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" +``` diff --git a/docs/zh/getting-started/tutorial.md b/docs/zh/getting-started/tutorial.md new file mode 100644 index 00000000000..49cb43d925c --- /dev/null +++ b/docs/zh/getting-started/tutorial.md @@ -0,0 +1,665 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 12 +toc_title: "\u6559\u7A0B" +--- + +# 教程 {#clickhouse-tutorial} + +## 从本教程中可以期待什么? {#what-to-expect-from-this-tutorial} + +通过本教程,您将学习如何设置一个简单的ClickHouse集群。 它会很小,但容错和可扩展。 然后,我们将使用其中一个示例数据集来填充数据并执行一些演示查询。 + +## 单节点设置 {#single-node-setup} + +为了推迟分布式环境的复杂性,我们将首先在单个服务器或虚拟机上部署ClickHouse。 ClickHouse通常是从安装 [黛布](install.md#install-from-deb-packages) 或 [rpm](install.md#from-rpm-packages) 包,但也有 [替代办法](install.md#from-docker-image) 对于不支持它们的操作系统。 + +例如,您选择了 `deb` 包和执行: + +``` bash +{% include 'install/deb.sh' %} +``` + +我们在安装的软件包中有什么: + +- `clickhouse-client` 包包含 [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 应用程序,交互式ClickHouse控制台客户端。 +- `clickhouse-common` 包包含一个ClickHouse可执行文件。 +- `clickhouse-server` 包包含要作为服务器运行ClickHouse的配置文件。 + +服务器配置文件位于 `/etc/clickhouse-server/`. 在进一步讨论之前,请注意 `` 元素in `config.xml`. Path确定数据存储的位置,因此应该位于磁盘容量较大的卷上;默认值为 `/var/lib/clickhouse/`. 如果你想调整配置,直接编辑并不方便 `config.xml` 文件,考虑到它可能会在未来的软件包更新中被重写。 复盖配置元素的推荐方法是创建 [在配置文件。d目录](../operations/configuration-files.md) 它作为 “patches” 要配置。xml + +你可能已经注意到了, `clickhouse-server` 安装包后不会自动启动。 它也不会在更新后自动重新启动。 您启动服务器的方式取决于您的init系统,通常情况下,它是: + +``` bash +sudo service clickhouse-server start +``` + +或 + +``` bash +sudo /etc/init.d/clickhouse-server start +``` + +服务器日志的默认位置是 `/var/log/clickhouse-server/`. 服务器已准备好处理客户端连接一旦它记录 `Ready for connections` 消息 + +一旦 `clickhouse-server` 正在运行我们可以利用 `clickhouse-client` 连接到服务器并运行一些测试查询,如 `SELECT "Hello, world!";`. + +
+ +Clickhouse-客户端的快速提示 +交互模式: + +``` bash +clickhouse-client +clickhouse-client --host=... --port=... --user=... --password=... +``` + +启用多行查询: + +``` bash +clickhouse-client -m +clickhouse-client --multiline +``` + +以批处理模式运行查询: + +``` bash +clickhouse-client --query='SELECT 1' +echo 'SELECT 1' | clickhouse-client +clickhouse-client <<< 'SELECT 1' +``` + +从指定格式的文件中插入数据: + +``` bash +clickhouse-client --query='INSERT INTO table VALUES' < data.txt +clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv +``` + +
+ +## 导入示例数据集 {#import-sample-dataset} + +现在是时候用一些示例数据填充我们的ClickHouse服务器。 在本教程中,我们将使用Yandex的匿名数据。Metrica,在成为开源之前以生产方式运行ClickHouse的第一个服务(更多关于这一点 [历史科](../introduction/history.md)). 有 [多种导入Yandex的方式。梅里卡数据集](example-datasets/metrica.md),为了本教程,我们将使用最现实的一个。 + +### 下载并提取表数据 {#download-and-extract-table-data} + +``` bash +curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv +curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv +``` + +提取的文件大小约为10GB。 + +### 创建表 {#create-tables} + +与大多数数据库管理系统一样,ClickHouse在逻辑上将表分组为 “databases”. 有一个 `default` 数据库,但我们将创建一个名为新的 `tutorial`: + +``` bash +clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" +``` + +与数据库相比,创建表的语法要复杂得多(请参阅 [参考资料](../sql-reference/statements/create.md). 一般 `CREATE TABLE` 声明必须指定三个关键的事情: + +1. 要创建的表的名称。 +2. Table schema, i.e. list of columns and their [数据类型](../sql-reference/data-types/index.md). +3. [表引擎](../engines/table-engines/index.md) 它是settings,它决定了如何物理执行对此表的查询的所有细节。 + +YandexMetrica是一个网络分析服务,样本数据集不包括其全部功能,因此只有两个表可以创建: + +- `hits` 是一个表格,其中包含所有用户在服务所涵盖的所有网站上完成的每个操作。 +- `visits` 是一个包含预先构建的会话而不是单个操作的表。 + +让我们看看并执行这些表的实际创建表查询: + +``` sql +CREATE TABLE tutorial.hits_v1 +( + `WatchID` UInt64, + `JavaEnable` UInt8, + `Title` String, + `GoodEvent` Int16, + `EventTime` DateTime, + `EventDate` Date, + `CounterID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RegionID` UInt32, + `UserID` UInt64, + `CounterClass` Int8, + `OS` UInt8, + `UserAgent` UInt8, + `URL` String, + `Referer` String, + `URLDomain` String, + `RefererDomain` String, + `Refresh` UInt8, + `IsRobot` UInt8, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `FlashMinor2` String, + `NetMajor` UInt8, + `NetMinor` UInt8, + `UserAgentMajor` UInt16, + `UserAgentMinor` FixedString(2), + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `MobilePhone` UInt8, + `MobilePhoneModel` String, + `Params` String, + `IPNetworkID` UInt32, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `IsArtifical` UInt8, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `ClientTimeZone` Int16, + `ClientEventTime` DateTime, + `SilverlightVersion1` UInt8, + `SilverlightVersion2` UInt8, + `SilverlightVersion3` UInt32, + `SilverlightVersion4` UInt16, + `PageCharset` String, + `CodeVersion` UInt32, + `IsLink` UInt8, + `IsDownload` UInt8, + `IsNotBounce` UInt8, + `FUniqID` UInt64, + `HID` UInt32, + `IsOldCounter` UInt8, + `IsEvent` UInt8, + `IsParameter` UInt8, + `DontCountHits` UInt8, + `WithHash` UInt8, + `HitColor` FixedString(1), + `UTCEventTime` DateTime, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `WindowName` Int32, + `OpenerName` Int32, + `HistoryLength` Int16, + `BrowserLanguage` FixedString(2), + `BrowserCountry` FixedString(2), + `SocialNetwork` String, + `SocialAction` String, + `HTTPError` UInt16, + `SendTiming` Int32, + `DNSTiming` Int32, + `ConnectTiming` Int32, + `ResponseStartTiming` Int32, + `ResponseEndTiming` Int32, + `FetchTiming` Int32, + `RedirectTiming` Int32, + `DOMInteractiveTiming` Int32, + `DOMContentLoadedTiming` Int32, + `DOMCompleteTiming` Int32, + `LoadEventStartTiming` Int32, + `LoadEventEndTiming` Int32, + `NSToDOMContentLoadedTiming` Int32, + `FirstPaintTiming` Int32, + `RedirectCount` Int8, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `ParamPrice` Int64, + `ParamOrderID` String, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `GoalsReached` Array(UInt32), + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `RefererHash` UInt64, + `URLHash` UInt64, + `CLID` UInt32, + `YCLID` UInt64, + `ShareService` String, + `ShareURL` String, + `ShareTitle` String, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `IslandID` FixedString(16), + `RequestNum` UInt32, + `RequestTry` UInt8 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(EventDate) +ORDER BY (CounterID, EventDate, intHash32(UserID)) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +``` sql +CREATE TABLE tutorial.visits_v1 +( + `CounterID` UInt32, + `StartDate` Date, + `Sign` Int8, + `IsNew` UInt8, + `VisitID` UInt64, + `UserID` UInt64, + `StartTime` DateTime, + `Duration` UInt32, + `UTCStartTime` DateTime, + `PageViews` Int32, + `Hits` Int32, + `IsBounce` UInt8, + `Referer` String, + `StartURL` String, + `RefererDomain` String, + `StartURLDomain` String, + `EndURL` String, + `LinkURL` String, + `IsDownload` UInt8, + `TraficSourceID` Int8, + `SearchEngineID` UInt16, + `SearchPhrase` String, + `AdvEngineID` UInt8, + `PlaceID` Int32, + `RefererCategories` Array(UInt16), + `URLCategories` Array(UInt16), + `URLRegions` Array(UInt32), + `RefererRegions` Array(UInt32), + `IsYandex` UInt8, + `GoalReachesDepth` Int32, + `GoalReachesURL` Int32, + `GoalReachesAny` Int32, + `SocialSourceNetworkID` UInt8, + `SocialSourcePage` String, + `MobilePhoneModel` String, + `ClientEventTime` DateTime, + `RegionID` UInt32, + `ClientIP` UInt32, + `ClientIP6` FixedString(16), + `RemoteIP` UInt32, + `RemoteIP6` FixedString(16), + `IPNetworkID` UInt32, + `SilverlightVersion3` UInt32, + `CodeVersion` UInt32, + `ResolutionWidth` UInt16, + `ResolutionHeight` UInt16, + `UserAgentMajor` UInt16, + `UserAgentMinor` UInt16, + `WindowClientWidth` UInt16, + `WindowClientHeight` UInt16, + `SilverlightVersion2` UInt8, + `SilverlightVersion4` UInt16, + `FlashVersion3` UInt16, + `FlashVersion4` UInt16, + `ClientTimeZone` Int16, + `OS` UInt8, + `UserAgent` UInt8, + `ResolutionDepth` UInt8, + `FlashMajor` UInt8, + `FlashMinor` UInt8, + `NetMajor` UInt8, + `NetMinor` UInt8, + `MobilePhone` UInt8, + `SilverlightVersion1` UInt8, + `Age` UInt8, + `Sex` UInt8, + `Income` UInt8, + `JavaEnable` UInt8, + `CookieEnable` UInt8, + `JavascriptEnable` UInt8, + `IsMobile` UInt8, + `BrowserLanguage` UInt16, + `BrowserCountry` UInt16, + `Interests` UInt16, + `Robotness` UInt8, + `GeneralInterests` Array(UInt16), + `Params` Array(String), + `Goals` Nested( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32), + `WatchIDs` Array(UInt64), + `ParamSumPrice` Int64, + `ParamCurrency` FixedString(3), + `ParamCurrencyID` UInt16, + `ClickLogID` UInt64, + `ClickEventID` Int32, + `ClickGoodEvent` Int32, + `ClickEventTime` DateTime, + `ClickPriorityID` Int32, + `ClickPhraseID` Int32, + `ClickPageID` Int32, + `ClickPlaceID` Int32, + `ClickTypeID` Int32, + `ClickResourceID` Int32, + `ClickCost` UInt32, + `ClickClientIP` UInt32, + `ClickDomainID` UInt32, + `ClickURL` String, + `ClickAttempt` UInt8, + `ClickOrderID` UInt32, + `ClickBannerID` UInt32, + `ClickMarketCategoryID` UInt32, + `ClickMarketPP` UInt32, + `ClickMarketCategoryName` String, + `ClickMarketPPName` String, + `ClickAWAPSCampaignName` String, + `ClickPageName` String, + `ClickTargetType` UInt16, + `ClickTargetPhraseID` UInt64, + `ClickContextType` UInt8, + `ClickSelectType` Int8, + `ClickOptions` String, + `ClickGroupBannerID` Int32, + `OpenstatServiceName` String, + `OpenstatCampaignID` String, + `OpenstatAdID` String, + `OpenstatSourceID` String, + `UTMSource` String, + `UTMMedium` String, + `UTMCampaign` String, + `UTMContent` String, + `UTMTerm` String, + `FromTag` String, + `HasGCLID` UInt8, + `FirstVisit` DateTime, + `PredLastVisit` Date, + `LastVisit` Date, + `TotalVisits` UInt32, + `TraficSource` Nested( + ID Int8, + SearchEngineID UInt16, + AdvEngineID UInt8, + PlaceID UInt16, + SocialSourceNetworkID UInt8, + Domain String, + SearchPhrase String, + SocialSourcePage String), + `Attendance` FixedString(16), + `CLID` UInt32, + `YCLID` UInt64, + `NormalizedRefererHash` UInt64, + `SearchPhraseHash` UInt64, + `RefererDomainHash` UInt64, + `NormalizedStartURLHash` UInt64, + `StartURLDomainHash` UInt64, + `NormalizedEndURLHash` UInt64, + `TopLevelDomain` UInt64, + `URLScheme` UInt64, + `OpenstatServiceNameHash` UInt64, + `OpenstatCampaignIDHash` UInt64, + `OpenstatAdIDHash` UInt64, + `OpenstatSourceIDHash` UInt64, + `UTMSourceHash` UInt64, + `UTMMediumHash` UInt64, + `UTMCampaignHash` UInt64, + `UTMContentHash` UInt64, + `UTMTermHash` UInt64, + `FromHash` UInt64, + `WebVisorEnabled` UInt8, + `WebVisorActivity` UInt32, + `ParsedParams` Nested( + Key1 String, + Key2 String, + Key3 String, + Key4 String, + Key5 String, + ValueDouble Float64), + `Market` Nested( + Type UInt8, + GoalID UInt32, + OrderID String, + OrderPrice Int64, + PP UInt32, + DirectPlaceID UInt32, + DirectOrderID UInt32, + DirectBannerID UInt32, + GoodID String, + GoodName String, + GoodQuantity Int32, + GoodPrice Int64), + `IslandID` FixedString(16) +) +ENGINE = CollapsingMergeTree(Sign) +PARTITION BY toYYYYMM(StartDate) +ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) +SAMPLE BY intHash32(UserID) +SETTINGS index_granularity = 8192 +``` + +您可以使用以下交互模式执行这些查询 `clickhouse-client` (只需在终端中启动它,而不需要提前指定查询)或尝试一些 [替代接口](../interfaces/index.md) 如果你愿意的话 + +正如我们所看到的, `hits_v1` 使用 [基本MergeTree引擎](../engines/table-engines/mergetree-family/mergetree.md),而 `visits_v1` 使用 [崩溃](../engines/table-engines/mergetree-family/collapsingmergetree.md) 变体。 + +### 导入数据 {#import-data} + +数据导入到ClickHouse是通过以下方式完成的 [INSERT INTO](../sql-reference/statements/insert-into.md) 查询像许多其他SQL数据库。 然而,数据通常是在一个提供 [支持的序列化格式](../interfaces/formats.md) 而不是 `VALUES` 子句(也支持)。 + +我们之前下载的文件是以制表符分隔的格式,所以这里是如何通过控制台客户端导入它们: + +``` bash +clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv +clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv +``` + +ClickHouse有很多 [要调整的设置](../operations/settings/index.md) 在控制台客户端中指定它们的一种方法是通过参数,我们可以看到 `--max_insert_block_size`. 找出可用的设置,它们意味着什么以及默认值的最简单方法是查询 `system.settings` 表: + +``` sql +SELECT name, value, changed, description +FROM system.settings +WHERE name LIKE '%max_insert_b%' +FORMAT TSV + +max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." +``` + +您也可以 [OPTIMIZE](../sql-reference/statements/misc.md#misc_operations-optimize) 导入后的表。 使用MergeTree-family引擎配置的表总是在后台合并数据部分以优化数据存储(或至少检查是否有意义)。 这些查询强制表引擎立即进行存储优化,而不是稍后进行一段时间: + +``` bash +clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" +clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" +``` + +这些查询开始一个I/O和CPU密集型操作,所以如果表一直接收到新数据,最好不要管它,让合并在后台运行。 + +现在我们可以检查表导入是否成功: + +``` bash +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" +clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" +``` + +## 查询示例 {#example-queries} + +``` sql +SELECT + StartURL AS URL, + AVG(Duration) AS AvgDuration +FROM tutorial.visits_v1 +WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' +GROUP BY URL +ORDER BY AvgDuration DESC +LIMIT 10 +``` + +``` sql +SELECT + sum(Sign) AS visits, + sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, + (100. * goal_visits) / visits AS goal_percent +FROM tutorial.visits_v1 +WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') +``` + +## 集群部署 {#cluster-deployment} + +ClickHouse集群是一个同质集群。 设置步骤: + +1. 在群集的所有计算机上安装ClickHouse服务器 +2. 在配置文件中设置群集配置 +3. 在每个实例上创建本地表 +4. 创建一个 [分布式表](../engines/table-engines/special/distributed.md) + +[分布式表](../engines/table-engines/special/distributed.md) 实际上是一种 “view” 到ClickHouse集群的本地表。 从分布式表中选择查询使用集群所有分片的资源执行。 您可以为多个集群指定configs,并创建多个分布式表,为不同的集群提供视图。 + +具有三个分片的集群的示例配置,每个分片一个副本: + +``` xml + + + + + example-perftest01j.yandex.ru + 9000 + + + + + example-perftest02j.yandex.ru + 9000 + + + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +为了进一步演示,让我们创建一个新的本地表 `CREATE TABLE` 我们用于查询 `hits_v1`,但不同的表名: + +``` sql +CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... +``` + +创建提供集群本地表视图的分布式表: + +``` sql +CREATE TABLE tutorial.hits_all AS tutorial.hits_local +ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); +``` + +常见的做法是在集群的所有计算机上创建类似的分布式表。 它允许在群集的任何计算机上运行分布式查询。 还有一个替代选项可以使用以下方法为给定的SELECT查询创建临时分布式表 [远程](../sql-reference/table-functions/remote.md) 表功能。 + +我们走吧 [INSERT SELECT](../sql-reference/statements/insert-into.md) 将该表传播到多个服务器。 + +``` sql +INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; +``` + +!!! warning "碌莽禄Notice:" + 这种方法不适合大型表的分片。 有一个单独的工具 [ツ环板-ョツ嘉ッツ偲](../operations/utilities/clickhouse-copier.md) 这可以重新分片任意大表。 + +正如您所期望的那样,如果计算量大的查询使用3台服务器而不是一个,则运行速度快N倍。 + +在这种情况下,我们使用了具有3个分片的集群,每个分片都包含一个副本。 + +为了在生产环境中提供弹性,我们建议每个分片应包含分布在多个可用区或数据中心(或至少机架)之间的2-3个副本。 请注意,ClickHouse支持无限数量的副本。 + +包含三个副本的一个分片集群的示例配置: + +``` xml + + ... + + + + example-perftest01j.yandex.ru + 9000 + + + example-perftest02j.yandex.ru + 9000 + + + example-perftest03j.yandex.ru + 9000 + + + + +``` + +启用本机复制 [动物园管理员](http://zookeeper.apache.org/) 是必需的。 ClickHouse负责所有副本的数据一致性,并在失败后自动运行恢复过程。 建议将ZooKeeper集群部署在单独的服务器上(其中没有其他进程,包括ClickHouse正在运行)。 + +!!! note "注" + ZooKeeper不是一个严格的requirement:在某些简单的情况下,您可以通过将数据写入应用程序代码中的所有副本来复制数据。 这种方法是 **不** 建议,在这种情况下,ClickHouse将无法保证所有副本上的数据一致性。 因此,它成为您的应用程序的责任。 + +ZooKeeper位置在配置文件中指定: + +``` xml + + + zoo01.yandex.ru + 2181 + + + zoo02.yandex.ru + 2181 + + + zoo03.yandex.ru + 2181 + + +``` + +此外,我们需要设置宏来识别每个用于创建表的分片和副本: + +``` xml + + 01 + 01 + +``` + +如果在创建复制表时没有副本,则会实例化新的第一个副本。 如果已有实时副本,则新副本将克隆现有副本中的数据。 您可以选择首先创建所有复制的表,然后向其中插入数据。 另一种选择是创建一些副本,并在数据插入之后或期间添加其他副本。 + +``` sql +CREATE TABLE tutorial.hits_replica (...) +ENGINE = ReplcatedMergeTree( + '/clickhouse_perftest/tables/{shard}/hits', + '{replica}' +) +... +``` + +在这里,我们使用 [ReplicatedMergeTree](../engines/table-engines/mergetree-family/replication.md) 表引擎。 在参数中,我们指定包含分片和副本标识符的ZooKeeper路径。 + +``` sql +INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; +``` + +复制在多主机模式下运行。 数据可以加载到任何副本中,然后系统会自动将其与其他实例同步。 复制是异步的,因此在给定时刻,并非所有副本都可能包含最近插入的数据。 至少应有一个副本允许数据摄取。 其他人将同步数据和修复一致性,一旦他们将再次变得活跃。 请注意,这种方法允许最近插入的数据丢失的可能性很低。 + +[原始文章](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/zh/getting_started/example_datasets/amplab_benchmark.md b/docs/zh/getting_started/example_datasets/amplab_benchmark.md deleted file mode 100644 index 30d55f8b28d..00000000000 --- a/docs/zh/getting_started/example_datasets/amplab_benchmark.md +++ /dev/null @@ -1,123 +0,0 @@ - -# AMPLab大数据基准测试 {#amplab-da-shu-ju-ji-zhun-ce-shi} - -参考 https://amplab.cs.berkeley.edu/benchmark/ - -需要您在https://aws.amazon.com注册一个免费的账号。注册时需要您提供信用卡、邮箱、电话等信息。之后可以在https://console.aws.amazon.com/iam/home?nc2=h\_m\_sc\#security\_credential获取新的访问密钥 - -在控制台运行以下命令: - -``` bash -$ sudo apt-get install s3cmd -$ mkdir tiny; cd tiny; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/tiny/ . -$ cd .. -$ mkdir 1node; cd 1node; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/1node/ . -$ cd .. -$ mkdir 5nodes; cd 5nodes; -$ s3cmd sync s3://big-data-benchmark/pavlo/text-deflate/5nodes/ . -$ cd .. -``` - -在ClickHouse运行如下查询: - -``` sql -CREATE TABLE rankings_tiny -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_tiny -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); - -CREATE TABLE rankings_1node -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_1node -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); - -CREATE TABLE rankings_5nodes_on_single -( - pageURL String, - pageRank UInt32, - avgDuration UInt32 -) ENGINE = Log; - -CREATE TABLE uservisits_5nodes_on_single -( - sourceIP String, - destinationURL String, - visitDate Date, - adRevenue Float32, - UserAgent String, - cCode FixedString(3), - lCode FixedString(6), - searchWord String, - duration UInt32 -) ENGINE = MergeTree(visitDate, visitDate, 8192); -``` - -回到控制台运行如下命令: - -``` bash -$ for i in tiny/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_tiny FORMAT CSV"; done -$ for i in tiny/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_tiny FORMAT CSV"; done -$ for i in 1node/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_1node FORMAT CSV"; done -$ for i in 1node/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_1node FORMAT CSV"; done -$ for i in 5nodes/rankings/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO rankings_5nodes_on_single FORMAT CSV"; done -$ for i in 5nodes/uservisits/*.deflate; do echo $i; zlib-flate -uncompress < $i | clickhouse-client --host=example-perftest01j --query="INSERT INTO uservisits_5nodes_on_single FORMAT CSV"; done -``` - -简单的查询示例: - -``` sql -SELECT pageURL, pageRank FROM rankings_1node WHERE pageRank > 1000 - -SELECT substring(sourceIP, 1, 8), sum(adRevenue) FROM uservisits_1node GROUP BY substring(sourceIP, 1, 8) - -SELECT - sourceIP, - sum(adRevenue) AS totalRevenue, - avg(pageRank) AS pageRank -FROM rankings_1node ALL INNER JOIN -( - SELECT - sourceIP, - destinationURL AS pageURL, - adRevenue - FROM uservisits_1node - WHERE (visitDate > '1980-01-01') AND (visitDate < '1980-04-01') -) USING pageURL -GROUP BY sourceIP -ORDER BY totalRevenue DESC -LIMIT 1 -``` - -[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/amplab_benchmark/) diff --git a/docs/zh/getting_started/example_datasets/criteo.md b/docs/zh/getting_started/example_datasets/criteo.md deleted file mode 100644 index 0ae2650b390..00000000000 --- a/docs/zh/getting_started/example_datasets/criteo.md +++ /dev/null @@ -1,75 +0,0 @@ - -# Criteo TB级别点击日志 {#criteo-tbji-bie-dian-ji-ri-zhi} - -可以从http://labs.criteo.com/downloads/download-terabyte-click-logs/上下载数据 - -创建原始数据对应的表结构: - -``` sql -CREATE TABLE criteo_log (date Date, clicked UInt8, int1 Int32, int2 Int32, int3 Int32, int4 Int32, int5 Int32, int6 Int32, int7 Int32, int8 Int32, int9 Int32, int10 Int32, int11 Int32, int12 Int32, int13 Int32, cat1 String, cat2 String, cat3 String, cat4 String, cat5 String, cat6 String, cat7 String, cat8 String, cat9 String, cat10 String, cat11 String, cat12 String, cat13 String, cat14 String, cat15 String, cat16 String, cat17 String, cat18 String, cat19 String, cat20 String, cat21 String, cat22 String, cat23 String, cat24 String, cat25 String, cat26 String) ENGINE = Log -``` - -下载数据: - -``` bash -$ for i in {00..23}; do echo $i; zcat datasets/criteo/day_${i#0}.gz | sed -r 's/^/2000-01-'${i/00/24}'\t/' | clickhouse-client --host=example-perftest01j --query="INSERT INTO criteo_log FORMAT TabSeparated"; done -``` - -创建转换后的数据对应的表结构: - -``` sql -CREATE TABLE criteo -( - date Date, - clicked UInt8, - int1 Int32, - int2 Int32, - int3 Int32, - int4 Int32, - int5 Int32, - int6 Int32, - int7 Int32, - int8 Int32, - int9 Int32, - int10 Int32, - int11 Int32, - int12 Int32, - int13 Int32, - icat1 UInt32, - icat2 UInt32, - icat3 UInt32, - icat4 UInt32, - icat5 UInt32, - icat6 UInt32, - icat7 UInt32, - icat8 UInt32, - icat9 UInt32, - icat10 UInt32, - icat11 UInt32, - icat12 UInt32, - icat13 UInt32, - icat14 UInt32, - icat15 UInt32, - icat16 UInt32, - icat17 UInt32, - icat18 UInt32, - icat19 UInt32, - icat20 UInt32, - icat21 UInt32, - icat22 UInt32, - icat23 UInt32, - icat24 UInt32, - icat25 UInt32, - icat26 UInt32 -) ENGINE = MergeTree(date, intHash32(icat1), (date, intHash32(icat1)), 8192) -``` - -将第一张表中的原始数据转化写入到第二张表中去: - -``` sql -INSERT INTO criteo SELECT date, clicked, int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, reinterpretAsUInt32(unhex(cat1)) AS icat1, reinterpretAsUInt32(unhex(cat2)) AS icat2, reinterpretAsUInt32(unhex(cat3)) AS icat3, reinterpretAsUInt32(unhex(cat4)) AS icat4, reinterpretAsUInt32(unhex(cat5)) AS icat5, reinterpretAsUInt32(unhex(cat6)) AS icat6, reinterpretAsUInt32(unhex(cat7)) AS icat7, reinterpretAsUInt32(unhex(cat8)) AS icat8, reinterpretAsUInt32(unhex(cat9)) AS icat9, reinterpretAsUInt32(unhex(cat10)) AS icat10, reinterpretAsUInt32(unhex(cat11)) AS icat11, reinterpretAsUInt32(unhex(cat12)) AS icat12, reinterpretAsUInt32(unhex(cat13)) AS icat13, reinterpretAsUInt32(unhex(cat14)) AS icat14, reinterpretAsUInt32(unhex(cat15)) AS icat15, reinterpretAsUInt32(unhex(cat16)) AS icat16, reinterpretAsUInt32(unhex(cat17)) AS icat17, reinterpretAsUInt32(unhex(cat18)) AS icat18, reinterpretAsUInt32(unhex(cat19)) AS icat19, reinterpretAsUInt32(unhex(cat20)) AS icat20, reinterpretAsUInt32(unhex(cat21)) AS icat21, reinterpretAsUInt32(unhex(cat22)) AS icat22, reinterpretAsUInt32(unhex(cat23)) AS icat23, reinterpretAsUInt32(unhex(cat24)) AS icat24, reinterpretAsUInt32(unhex(cat25)) AS icat25, reinterpretAsUInt32(unhex(cat26)) AS icat26 FROM criteo_log; - -DROP TABLE criteo_log; -``` - -[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/criteo/) diff --git a/docs/zh/getting_started/example_datasets/index.md b/docs/zh/getting_started/example_datasets/index.md deleted file mode 100644 index c610af8a269..00000000000 --- a/docs/zh/getting_started/example_datasets/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -toc_folder_title: "\u793A\u4F8B\u6570\u636E\u96C6" -toc_priority: 12 -toc_title: "\u5BFC\u8A00" ---- - -# 示例数据集 {#example-datasets} - -本节介绍如何获取示例数据集并将其导入ClickHouse。 -对于某些数据集示例查询也可用。 - -- [脱敏的Yandex.Metrica数据集](metrica.md) -- [星型基准测试](star_schema.md) -- [维基访问数据](wikistat.md) -- [Criteo TB级别点击日志](criteo.md) -- [AMPLab大数据基准测试](amplab_benchmark.md) -- [纽约出租车数据](nyc_taxi.md) -- [航班飞行数据](ontime.md) - -[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets) diff --git a/docs/zh/getting_started/example_datasets/metrica.md b/docs/zh/getting_started/example_datasets/metrica.md deleted file mode 100644 index 6e349a1135d..00000000000 --- a/docs/zh/getting_started/example_datasets/metrica.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -toc_priority: 21 -toc_title: "Yandex\u6885\u7279\u91CC\u5361\u6570\u636E" ---- - -# 脱敏的Yandex.Metrica数据集 {#anonymized-yandex-metrica-data} - -Dataset由两个表组成,其中包含有关命中的匿名数据 (`hits_v1`)和访问 (`visits_v1`)的Yandex的。梅特里卡 你可以阅读更多关于Yandex的。梅特里卡 [ClickHouse历史](../../introduction/history.md) 科。 - -数据集由两个表组成,其中任何一个都可以作为压缩表下载 `tsv.xz` 文件或作为准备的分区。 除此之外,该扩展版本 `hits` 包含1亿行的表可作为TSV在https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits\_100m\_obfuscated\_v1.tsv.xz 并作为准备的分区在https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits\_100m\_obfuscated\_v1.tar.xz. - -## 从准备好的分区获取表 {#obtaining-tables-from-prepared-partitions} - -下载和导入点击表: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar -tar xvf hits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -下载和导入访问: - -``` bash -curl -O https://clickhouse-datasets.s3.yandex.net/visits/partitions/visits_v1.tar -tar xvf visits_v1.tar -C /var/lib/clickhouse # path to ClickHouse data directory -# check permissions on unpacked data, fix if required -sudo service clickhouse-server restart -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## 从压缩TSV文件获取表 {#obtaining-tables-from-compressed-tsv-file} - -从压缩的TSV文件下载并导入命中: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.hits_v1 ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat hits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.hits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.hits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.hits_v1" -``` - -从压缩tsv文件下载和导入访问: - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -# now create table -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS datasets" -clickhouse-client --query "CREATE TABLE datasets.visits_v1 ( CounterID UInt32, StartDate Date, Sign Int8, IsNew UInt8, VisitID UInt64, UserID UInt64, StartTime DateTime, Duration UInt32, UTCStartTime DateTime, PageViews Int32, Hits Int32, IsBounce UInt8, Referer String, StartURL String, RefererDomain String, StartURLDomain String, EndURL String, LinkURL String, IsDownload UInt8, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, PlaceID Int32, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), IsYandex UInt8, GoalReachesDepth Int32, GoalReachesURL Int32, GoalReachesAny Int32, SocialSourceNetworkID UInt8, SocialSourcePage String, MobilePhoneModel String, ClientEventTime DateTime, RegionID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RemoteIP UInt32, RemoteIP6 FixedString(16), IPNetworkID UInt32, SilverlightVersion3 UInt32, CodeVersion UInt32, ResolutionWidth UInt16, ResolutionHeight UInt16, UserAgentMajor UInt16, UserAgentMinor UInt16, WindowClientWidth UInt16, WindowClientHeight UInt16, SilverlightVersion2 UInt8, SilverlightVersion4 UInt16, FlashVersion3 UInt16, FlashVersion4 UInt16, ClientTimeZone Int16, OS UInt8, UserAgent UInt8, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, NetMajor UInt8, NetMinor UInt8, MobilePhone UInt8, SilverlightVersion1 UInt8, Age UInt8, Sex UInt8, Income UInt8, JavaEnable UInt8, CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, BrowserLanguage UInt16, BrowserCountry UInt16, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), Params Array(String), Goals Nested(ID UInt32, Serial UInt32, EventTime DateTime, Price Int64, OrderID String, CurrencyID UInt32), WatchIDs Array(UInt64), ParamSumPrice Int64, ParamCurrency FixedString(3), ParamCurrencyID UInt16, ClickLogID UInt64, ClickEventID Int32, ClickGoodEvent Int32, ClickEventTime DateTime, ClickPriorityID Int32, ClickPhraseID Int32, ClickPageID Int32, ClickPlaceID Int32, ClickTypeID Int32, ClickResourceID Int32, ClickCost UInt32, ClickClientIP UInt32, ClickDomainID UInt32, ClickURL String, ClickAttempt UInt8, ClickOrderID UInt32, ClickBannerID UInt32, ClickMarketCategoryID UInt32, ClickMarketPP UInt32, ClickMarketCategoryName String, ClickMarketPPName String, ClickAWAPSCampaignName String, ClickPageName String, ClickTargetType UInt16, ClickTargetPhraseID UInt64, ClickContextType UInt8, ClickSelectType Int8, ClickOptions String, ClickGroupBannerID Int32, OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, FirstVisit DateTime, PredLastVisit Date, LastVisit Date, TotalVisits UInt32, TraficSource Nested(ID Int8, SearchEngineID UInt16, AdvEngineID UInt8, PlaceID UInt16, SocialSourceNetworkID UInt8, Domain String, SearchPhrase String, SocialSourcePage String), Attendance FixedString(16), CLID UInt32, YCLID UInt64, NormalizedRefererHash UInt64, SearchPhraseHash UInt64, RefererDomainHash UInt64, NormalizedStartURLHash UInt64, StartURLDomainHash UInt64, NormalizedEndURLHash UInt64, TopLevelDomain UInt64, URLScheme UInt64, OpenstatServiceNameHash UInt64, OpenstatCampaignIDHash UInt64, OpenstatAdIDHash UInt64, OpenstatSourceIDHash UInt64, UTMSourceHash UInt64, UTMMediumHash UInt64, UTMCampaignHash UInt64, UTMContentHash UInt64, UTMTermHash UInt64, FromHash UInt64, WebVisorEnabled UInt8, WebVisorActivity UInt32, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), Market Nested(Type UInt8, GoalID UInt32, OrderID String, OrderPrice Int64, PP UInt32, DirectPlaceID UInt32, DirectOrderID UInt32, DirectBannerID UInt32, GoodID String, GoodName String, GoodQuantity Int32, GoodPrice Int64), IslandID FixedString(16)) ENGINE = CollapsingMergeTree(Sign) PARTITION BY toYYYYMM(StartDate) ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192" -# import data -cat visits_v1.tsv | clickhouse-client --query "INSERT INTO datasets.visits_v1 FORMAT TSV" --max_insert_block_size=100000 -# optionally you can optimize table -clickhouse-client --query "OPTIMIZE TABLE datasets.visits_v1 FINAL" -clickhouse-client --query "SELECT COUNT(*) FROM datasets.visits_v1" -``` - -## 查询示例 {#example-queries} - -[点击教程](../../getting_started/tutorial.md) 是基于Yandex的。Metrica数据集和开始使用此数据集的推荐方式是通过教程。 - -查询这些表的其他示例可以在 [有状态测试](https://github.com/ClickHouse/ClickHouse/tree/master/tests/queries/1_stateful) ClickHouse的(它们被命名为 `test.hists` 和 `test.visits` 那里)。 diff --git a/docs/zh/getting_started/example_datasets/nyc_taxi.md b/docs/zh/getting_started/example_datasets/nyc_taxi.md deleted file mode 100644 index e486dbef9a7..00000000000 --- a/docs/zh/getting_started/example_datasets/nyc_taxi.md +++ /dev/null @@ -1,385 +0,0 @@ - -# 纽约市出租车数据 {#niu-yue-shi-chu-zu-che-shu-ju} - -纽约市出租车数据有以下两个方式获取: - -从原始数据导入 -下载预处理好的分区数据 - -## 怎样导入原始数据 {#zen-yang-dao-ru-yuan-shi-shu-ju} - -可以参考https://github.com/toddwschneider/nyc-taxi-data和http://tech.marksblogg.com/billion-nyc-taxi-rides-redshift.html中的关于数据集结构描述与数据下载指令说明。 - -数据集包含227GB的CSV文件。这大约需要一个小时的下载时间(1Gbit带宽下,并行下载大概是一半时间)。 -下载时注意损坏的文件。可以检查文件大小并重新下载损坏的文件。 - -有些文件中包含一些无效的行,您可以使用如下语句修复他们: - -``` bash -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-02.csv > data/yellow_tripdata_2010-02.csv_ -sed -E '/(.*,){18,}/d' data/yellow_tripdata_2010-03.csv > data/yellow_tripdata_2010-03.csv_ -mv data/yellow_tripdata_2010-02.csv_ data/yellow_tripdata_2010-02.csv -mv data/yellow_tripdata_2010-03.csv_ data/yellow_tripdata_2010-03.csv -``` - -然后您必须在PostgreSQL中预处理这些数据。这将创建多边形中的点(以匹配在地图中纽约市中范围),然后通过使用JOIN查询将数据关联组合到一个规范的表中。为了完成这部分操作,您需要安装PostgreSQL的同时安装PostGIS插件。 - -运行`initialize_database.sh`时要小心,并手动重新检查是否正确创建了所有表。 - -在PostgreSQL中处理每个月的数据大约需要20-30分钟,总共大约需要48小时。 - -您可以按如下方式检查下载的行数: - -``` bash -$ time psql nyc-taxi-data -c "SELECT count(*) FROM trips;" -## Count - 1298979494 -(1 row) - -real 7m9.164s -``` - -(根据Mark Litwintschik的系列博客报道数据略多余11亿行) - -PostgreSQL处理这些数据大概需要370GB的磁盘空间。 - -从PostgreSQL中导出数据: - -``` sql -COPY -( - SELECT trips.id, - trips.vendor_id, - trips.pickup_datetime, - trips.dropoff_datetime, - trips.store_and_fwd_flag, - trips.rate_code_id, - trips.pickup_longitude, - trips.pickup_latitude, - trips.dropoff_longitude, - trips.dropoff_latitude, - trips.passenger_count, - trips.trip_distance, - trips.fare_amount, - trips.extra, - trips.mta_tax, - trips.tip_amount, - trips.tolls_amount, - trips.ehail_fee, - trips.improvement_surcharge, - trips.total_amount, - trips.payment_type, - trips.trip_type, - trips.pickup, - trips.dropoff, - - cab_types.type cab_type, - - weather.precipitation_tenths_of_mm rain, - weather.snow_depth_mm, - weather.snowfall_mm, - weather.max_temperature_tenths_degrees_celsius max_temp, - weather.min_temperature_tenths_degrees_celsius min_temp, - weather.average_wind_speed_tenths_of_meters_per_second wind, - - pick_up.gid pickup_nyct2010_gid, - pick_up.ctlabel pickup_ctlabel, - pick_up.borocode pickup_borocode, - pick_up.boroname pickup_boroname, - pick_up.ct2010 pickup_ct2010, - pick_up.boroct2010 pickup_boroct2010, - pick_up.cdeligibil pickup_cdeligibil, - pick_up.ntacode pickup_ntacode, - pick_up.ntaname pickup_ntaname, - pick_up.puma pickup_puma, - - drop_off.gid dropoff_nyct2010_gid, - drop_off.ctlabel dropoff_ctlabel, - drop_off.borocode dropoff_borocode, - drop_off.boroname dropoff_boroname, - drop_off.ct2010 dropoff_ct2010, - drop_off.boroct2010 dropoff_boroct2010, - drop_off.cdeligibil dropoff_cdeligibil, - drop_off.ntacode dropoff_ntacode, - drop_off.ntaname dropoff_ntaname, - drop_off.puma dropoff_puma - FROM trips - LEFT JOIN cab_types - ON trips.cab_type_id = cab_types.id - LEFT JOIN central_park_weather_observations_raw weather - ON weather.date = trips.pickup_datetime::date - LEFT JOIN nyct2010 pick_up - ON pick_up.gid = trips.pickup_nyct2010_gid - LEFT JOIN nyct2010 drop_off - ON drop_off.gid = trips.dropoff_nyct2010_gid -) TO '/opt/milovidov/nyc-taxi-data/trips.tsv'; -``` - -数据快照的创建速度约为每秒50 MB。 在创建快照时,PostgreSQL以每秒约28 MB的速度从磁盘读取数据。 -这大约需要5个小时。 最终生成的TSV文件为590612904969 bytes。 - -在ClickHouse中创建临时表: - -``` sql -CREATE TABLE trips -( -trip_id UInt32, -vendor_id String, -pickup_datetime DateTime, -dropoff_datetime Nullable(DateTime), -store_and_fwd_flag Nullable(FixedString(1)), -rate_code_id Nullable(UInt8), -pickup_longitude Nullable(Float64), -pickup_latitude Nullable(Float64), -dropoff_longitude Nullable(Float64), -dropoff_latitude Nullable(Float64), -passenger_count Nullable(UInt8), -trip_distance Nullable(Float64), -fare_amount Nullable(Float32), -extra Nullable(Float32), -mta_tax Nullable(Float32), -tip_amount Nullable(Float32), -tolls_amount Nullable(Float32), -ehail_fee Nullable(Float32), -improvement_surcharge Nullable(Float32), -total_amount Nullable(Float32), -payment_type Nullable(String), -trip_type Nullable(UInt8), -pickup Nullable(String), -dropoff Nullable(String), -cab_type Nullable(String), -precipitation Nullable(UInt8), -snow_depth Nullable(UInt8), -snowfall Nullable(UInt8), -max_temperature Nullable(UInt8), -min_temperature Nullable(UInt8), -average_wind_speed Nullable(UInt8), -pickup_nyct2010_gid Nullable(UInt8), -pickup_ctlabel Nullable(String), -pickup_borocode Nullable(UInt8), -pickup_boroname Nullable(String), -pickup_ct2010 Nullable(String), -pickup_boroct2010 Nullable(String), -pickup_cdeligibil Nullable(FixedString(1)), -pickup_ntacode Nullable(String), -pickup_ntaname Nullable(String), -pickup_puma Nullable(String), -dropoff_nyct2010_gid Nullable(UInt8), -dropoff_ctlabel Nullable(String), -dropoff_borocode Nullable(UInt8), -dropoff_boroname Nullable(String), -dropoff_ct2010 Nullable(String), -dropoff_boroct2010 Nullable(String), -dropoff_cdeligibil Nullable(String), -dropoff_ntacode Nullable(String), -dropoff_ntaname Nullable(String), -dropoff_puma Nullable(String) -) ENGINE = Log; -``` - -接下来,需要将字段转换为更正确的数据类型,并且在可能的情况下,消除NULL。 - -``` bash -$ time clickhouse-client --query="INSERT INTO trips FORMAT TabSeparated" < trips.tsv - -real 75m56.214s -``` - -数据的读取速度为112-140 Mb/秒。 -通过这种方式将数据加载到Log表中需要76分钟。 -这个表中的数据需要使用142 GB的磁盘空间. - -(也可以直接使用`COPY ... TO PROGRAM`从Postgres中导入数据) - -由于数据中与天气相关的所有数据(precipitation……average\_wind\_speed)都填充了NULL。 所以,我们将从最终数据集中删除它们 - -首先,我们使用单台服务器创建表,后面我们将在多台节点上创建这些表。 - -创建表结构并写入数据: - -``` sql -CREATE TABLE trips_mergetree -ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -AS SELECT - -trip_id, -CAST(vendor_id AS Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14)) AS vendor_id, -toDate(pickup_datetime) AS pickup_date, -ifNull(pickup_datetime, toDateTime(0)) AS pickup_datetime, -toDate(dropoff_datetime) AS dropoff_date, -ifNull(dropoff_datetime, toDateTime(0)) AS dropoff_datetime, -assumeNotNull(store_and_fwd_flag) IN ('Y', '1', '2') AS store_and_fwd_flag, -assumeNotNull(rate_code_id) AS rate_code_id, -assumeNotNull(pickup_longitude) AS pickup_longitude, -assumeNotNull(pickup_latitude) AS pickup_latitude, -assumeNotNull(dropoff_longitude) AS dropoff_longitude, -assumeNotNull(dropoff_latitude) AS dropoff_latitude, -assumeNotNull(passenger_count) AS passenger_count, -assumeNotNull(trip_distance) AS trip_distance, -assumeNotNull(fare_amount) AS fare_amount, -assumeNotNull(extra) AS extra, -assumeNotNull(mta_tax) AS mta_tax, -assumeNotNull(tip_amount) AS tip_amount, -assumeNotNull(tolls_amount) AS tolls_amount, -assumeNotNull(ehail_fee) AS ehail_fee, -assumeNotNull(improvement_surcharge) AS improvement_surcharge, -assumeNotNull(total_amount) AS total_amount, -CAST((assumeNotNull(payment_type) AS pt) IN ('CSH', 'CASH', 'Cash', 'CAS', 'Cas', '1') ? 'CSH' : (pt IN ('CRD', 'Credit', 'Cre', 'CRE', 'CREDIT', '2') ? 'CRE' : (pt IN ('NOC', 'No Charge', 'No', '3') ? 'NOC' : (pt IN ('DIS', 'Dispute', 'Dis', '4') ? 'DIS' : 'UNK'))) AS Enum8('CSH' = 1, 'CRE' = 2, 'UNK' = 0, 'NOC' = 3, 'DIS' = 4)) AS payment_type_, -assumeNotNull(trip_type) AS trip_type, -ifNull(toFixedString(unhex(pickup), 25), toFixedString('', 25)) AS pickup, -ifNull(toFixedString(unhex(dropoff), 25), toFixedString('', 25)) AS dropoff, -CAST(assumeNotNull(cab_type) AS Enum8('yellow' = 1, 'green' = 2, 'uber' = 3)) AS cab_type, - -assumeNotNull(pickup_nyct2010_gid) AS pickup_nyct2010_gid, -toFloat32(ifNull(pickup_ctlabel, '0')) AS pickup_ctlabel, -assumeNotNull(pickup_borocode) AS pickup_borocode, -CAST(assumeNotNull(pickup_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS pickup_boroname, -toFixedString(ifNull(pickup_ct2010, '000000'), 6) AS pickup_ct2010, -toFixedString(ifNull(pickup_boroct2010, '0000000'), 7) AS pickup_boroct2010, -CAST(assumeNotNull(ifNull(pickup_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS pickup_cdeligibil, -toFixedString(ifNull(pickup_ntacode, '0000'), 4) AS pickup_ntacode, - -CAST(assumeNotNull(pickup_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS pickup_ntaname, - -toUInt16(ifNull(pickup_puma, '0')) AS pickup_puma, - -assumeNotNull(dropoff_nyct2010_gid) AS dropoff_nyct2010_gid, -toFloat32(ifNull(dropoff_ctlabel, '0')) AS dropoff_ctlabel, -assumeNotNull(dropoff_borocode) AS dropoff_borocode, -CAST(assumeNotNull(dropoff_boroname) AS Enum8('Manhattan' = 1, 'Queens' = 4, 'Brooklyn' = 3, '' = 0, 'Bronx' = 2, 'Staten Island' = 5)) AS dropoff_boroname, -toFixedString(ifNull(dropoff_ct2010, '000000'), 6) AS dropoff_ct2010, -toFixedString(ifNull(dropoff_boroct2010, '0000000'), 7) AS dropoff_boroct2010, -CAST(assumeNotNull(ifNull(dropoff_cdeligibil, ' ')) AS Enum8(' ' = 0, 'E' = 1, 'I' = 2)) AS dropoff_cdeligibil, -toFixedString(ifNull(dropoff_ntacode, '0000'), 4) AS dropoff_ntacode, - -CAST(assumeNotNull(dropoff_ntaname) AS Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195)) AS dropoff_ntaname, - -toUInt16(ifNull(dropoff_puma, '0')) AS dropoff_puma - -FROM trips -``` - -这需要3030秒,速度约为每秒428,000行。 -要加快速度,可以使用`Log`引擎替换'MergeTree\`引擎来创建表。 在这种情况下,下载速度超过200秒。 - -这个表需要使用126GB的磁盘空间。 - -``` sql -SELECT formatReadableSize(sum(bytes)) FROM system.parts WHERE table = 'trips_mergetree' AND active -``` - -``` text -┌─formatReadableSize(sum(bytes))─┐ -│ 126.18 GiB │ -└────────────────────────────────┘ -``` - -除此之外,你还可以在MergeTree上运行OPTIMIZE查询来进行优化。但这不是必须的,因为即使在没有进行优化的情况下它的表现依然是很好的。 - -## 下载预处理好的分区数据 {#xia-zai-yu-chu-li-hao-de-fen-qu-shu-ju} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/trips_mergetree/partitions/trips_mergetree.tar -$ tar xvf trips_mergetree.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.trips_mergetree" -``` - -!!! info "信息" - 如果要运行下面的SQL查询,必须使用完整的表名, -`datasets.trips_mergetree`。 - -## 单台服务器运行结果 {#dan-tai-fu-wu-qi-yun-xing-jie-guo} - -Q1: - -``` sql -SELECT cab_type, count(*) FROM trips_mergetree GROUP BY cab_type -``` - -0.490秒 - -Q2: - -``` sql -SELECT passenger_count, avg(total_amount) FROM trips_mergetree GROUP BY passenger_count -``` - -1.224秒 - -Q3: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, count(*) FROM trips_mergetree GROUP BY passenger_count, year -``` - -2.104秒 - -Q4: - -``` sql -SELECT passenger_count, toYear(pickup_date) AS year, round(trip_distance) AS distance, count(*) -FROM trips_mergetree -GROUP BY passenger_count, year, distance -ORDER BY year, count(*) DESC -``` - -3.593秒 - -我们使用的是如下配置的服务器: - -两个英特尔(R)至强(R)CPU E5-2650v2@2.60GHz,总共有16个物理内核,128GiB RAM,硬件RAID-5上的8X6TB HD - -执行时间是取三次运行中最好的值,但是从第二次查询开始,查询就讲从文件系统的缓存中读取数据。同时在每次读取和处理后不在进行缓存。 - -在三台服务器中创建表结构: - -在每台服务器中运行: - -``` sql -CREATE TABLE default.trips_mergetree_third ( trip_id UInt32, vendor_id Enum8('1' = 1, '2' = 2, 'CMT' = 3, 'VTS' = 4, 'DDS' = 5, 'B02512' = 10, 'B02598' = 11, 'B02617' = 12, 'B02682' = 13, 'B02764' = 14), pickup_date Date, pickup_datetime DateTime, dropoff_date Date, dropoff_datetime DateTime, store_and_fwd_flag UInt8, rate_code_id UInt8, pickup_longitude Float64, pickup_latitude Float64, dropoff_longitude Float64, dropoff_latitude Float64, passenger_count UInt8, trip_distance Float64, fare_amount Float32, extra Float32, mta_tax Float32, tip_amount Float32, tolls_amount Float32, ehail_fee Float32, improvement_surcharge Float32, total_amount Float32, payment_type_ Enum8('UNK' = 0, 'CSH' = 1, 'CRE' = 2, 'NOC' = 3, 'DIS' = 4), trip_type UInt8, pickup FixedString(25), dropoff FixedString(25), cab_type Enum8('yellow' = 1, 'green' = 2, 'uber' = 3), pickup_nyct2010_gid UInt8, pickup_ctlabel Float32, pickup_borocode UInt8, pickup_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), pickup_ct2010 FixedString(6), pickup_boroct2010 FixedString(7), pickup_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), pickup_ntacode FixedString(4), pickup_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), pickup_puma UInt16, dropoff_nyct2010_gid UInt8, dropoff_ctlabel Float32, dropoff_borocode UInt8, dropoff_boroname Enum8('' = 0, 'Manhattan' = 1, 'Bronx' = 2, 'Brooklyn' = 3, 'Queens' = 4, 'Staten Island' = 5), dropoff_ct2010 FixedString(6), dropoff_boroct2010 FixedString(7), dropoff_cdeligibil Enum8(' ' = 0, 'E' = 1, 'I' = 2), dropoff_ntacode FixedString(4), dropoff_ntaname Enum16('' = 0, 'Airport' = 1, 'Allerton-Pelham Gardens' = 2, 'Annadale-Huguenot-Prince\'s Bay-Eltingville' = 3, 'Arden Heights' = 4, 'Astoria' = 5, 'Auburndale' = 6, 'Baisley Park' = 7, 'Bath Beach' = 8, 'Battery Park City-Lower Manhattan' = 9, 'Bay Ridge' = 10, 'Bayside-Bayside Hills' = 11, 'Bedford' = 12, 'Bedford Park-Fordham North' = 13, 'Bellerose' = 14, 'Belmont' = 15, 'Bensonhurst East' = 16, 'Bensonhurst West' = 17, 'Borough Park' = 18, 'Breezy Point-Belle Harbor-Rockaway Park-Broad Channel' = 19, 'Briarwood-Jamaica Hills' = 20, 'Brighton Beach' = 21, 'Bronxdale' = 22, 'Brooklyn Heights-Cobble Hill' = 23, 'Brownsville' = 24, 'Bushwick North' = 25, 'Bushwick South' = 26, 'Cambria Heights' = 27, 'Canarsie' = 28, 'Carroll Gardens-Columbia Street-Red Hook' = 29, 'Central Harlem North-Polo Grounds' = 30, 'Central Harlem South' = 31, 'Charleston-Richmond Valley-Tottenville' = 32, 'Chinatown' = 33, 'Claremont-Bathgate' = 34, 'Clinton' = 35, 'Clinton Hill' = 36, 'Co-op City' = 37, 'College Point' = 38, 'Corona' = 39, 'Crotona Park East' = 40, 'Crown Heights North' = 41, 'Crown Heights South' = 42, 'Cypress Hills-City Line' = 43, 'DUMBO-Vinegar Hill-Downtown Brooklyn-Boerum Hill' = 44, 'Douglas Manor-Douglaston-Little Neck' = 45, 'Dyker Heights' = 46, 'East Concourse-Concourse Village' = 47, 'East Elmhurst' = 48, 'East Flatbush-Farragut' = 49, 'East Flushing' = 50, 'East Harlem North' = 51, 'East Harlem South' = 52, 'East New York' = 53, 'East New York (Pennsylvania Ave)' = 54, 'East Tremont' = 55, 'East Village' = 56, 'East Williamsburg' = 57, 'Eastchester-Edenwald-Baychester' = 58, 'Elmhurst' = 59, 'Elmhurst-Maspeth' = 60, 'Erasmus' = 61, 'Far Rockaway-Bayswater' = 62, 'Flatbush' = 63, 'Flatlands' = 64, 'Flushing' = 65, 'Fordham South' = 66, 'Forest Hills' = 67, 'Fort Greene' = 68, 'Fresh Meadows-Utopia' = 69, 'Ft. Totten-Bay Terrace-Clearview' = 70, 'Georgetown-Marine Park-Bergen Beach-Mill Basin' = 71, 'Glen Oaks-Floral Park-New Hyde Park' = 72, 'Glendale' = 73, 'Gramercy' = 74, 'Grasmere-Arrochar-Ft. Wadsworth' = 75, 'Gravesend' = 76, 'Great Kills' = 77, 'Greenpoint' = 78, 'Grymes Hill-Clifton-Fox Hills' = 79, 'Hamilton Heights' = 80, 'Hammels-Arverne-Edgemere' = 81, 'Highbridge' = 82, 'Hollis' = 83, 'Homecrest' = 84, 'Hudson Yards-Chelsea-Flatiron-Union Square' = 85, 'Hunters Point-Sunnyside-West Maspeth' = 86, 'Hunts Point' = 87, 'Jackson Heights' = 88, 'Jamaica' = 89, 'Jamaica Estates-Holliswood' = 90, 'Kensington-Ocean Parkway' = 91, 'Kew Gardens' = 92, 'Kew Gardens Hills' = 93, 'Kingsbridge Heights' = 94, 'Laurelton' = 95, 'Lenox Hill-Roosevelt Island' = 96, 'Lincoln Square' = 97, 'Lindenwood-Howard Beach' = 98, 'Longwood' = 99, 'Lower East Side' = 100, 'Madison' = 101, 'Manhattanville' = 102, 'Marble Hill-Inwood' = 103, 'Mariner\'s Harbor-Arlington-Port Ivory-Graniteville' = 104, 'Maspeth' = 105, 'Melrose South-Mott Haven North' = 106, 'Middle Village' = 107, 'Midtown-Midtown South' = 108, 'Midwood' = 109, 'Morningside Heights' = 110, 'Morrisania-Melrose' = 111, 'Mott Haven-Port Morris' = 112, 'Mount Hope' = 113, 'Murray Hill' = 114, 'Murray Hill-Kips Bay' = 115, 'New Brighton-Silver Lake' = 116, 'New Dorp-Midland Beach' = 117, 'New Springville-Bloomfield-Travis' = 118, 'North Corona' = 119, 'North Riverdale-Fieldston-Riverdale' = 120, 'North Side-South Side' = 121, 'Norwood' = 122, 'Oakland Gardens' = 123, 'Oakwood-Oakwood Beach' = 124, 'Ocean Hill' = 125, 'Ocean Parkway South' = 126, 'Old Astoria' = 127, 'Old Town-Dongan Hills-South Beach' = 128, 'Ozone Park' = 129, 'Park Slope-Gowanus' = 130, 'Parkchester' = 131, 'Pelham Bay-Country Club-City Island' = 132, 'Pelham Parkway' = 133, 'Pomonok-Flushing Heights-Hillcrest' = 134, 'Port Richmond' = 135, 'Prospect Heights' = 136, 'Prospect Lefferts Gardens-Wingate' = 137, 'Queens Village' = 138, 'Queensboro Hill' = 139, 'Queensbridge-Ravenswood-Long Island City' = 140, 'Rego Park' = 141, 'Richmond Hill' = 142, 'Ridgewood' = 143, 'Rikers Island' = 144, 'Rosedale' = 145, 'Rossville-Woodrow' = 146, 'Rugby-Remsen Village' = 147, 'Schuylerville-Throgs Neck-Edgewater Park' = 148, 'Seagate-Coney Island' = 149, 'Sheepshead Bay-Gerritsen Beach-Manhattan Beach' = 150, 'SoHo-TriBeCa-Civic Center-Little Italy' = 151, 'Soundview-Bruckner' = 152, 'Soundview-Castle Hill-Clason Point-Harding Park' = 153, 'South Jamaica' = 154, 'South Ozone Park' = 155, 'Springfield Gardens North' = 156, 'Springfield Gardens South-Brookville' = 157, 'Spuyten Duyvil-Kingsbridge' = 158, 'St. Albans' = 159, 'Stapleton-Rosebank' = 160, 'Starrett City' = 161, 'Steinway' = 162, 'Stuyvesant Heights' = 163, 'Stuyvesant Town-Cooper Village' = 164, 'Sunset Park East' = 165, 'Sunset Park West' = 166, 'Todt Hill-Emerson Hill-Heartland Village-Lighthouse Hill' = 167, 'Turtle Bay-East Midtown' = 168, 'University Heights-Morris Heights' = 169, 'Upper East Side-Carnegie Hill' = 170, 'Upper West Side' = 171, 'Van Cortlandt Village' = 172, 'Van Nest-Morris Park-Westchester Square' = 173, 'Washington Heights North' = 174, 'Washington Heights South' = 175, 'West Brighton' = 176, 'West Concourse' = 177, 'West Farms-Bronx River' = 178, 'West New Brighton-New Brighton-St. George' = 179, 'West Village' = 180, 'Westchester-Unionport' = 181, 'Westerleigh' = 182, 'Whitestone' = 183, 'Williamsbridge-Olinville' = 184, 'Williamsburg' = 185, 'Windsor Terrace' = 186, 'Woodhaven' = 187, 'Woodlawn-Wakefield' = 188, 'Woodside' = 189, 'Yorkville' = 190, 'park-cemetery-etc-Bronx' = 191, 'park-cemetery-etc-Brooklyn' = 192, 'park-cemetery-etc-Manhattan' = 193, 'park-cemetery-etc-Queens' = 194, 'park-cemetery-etc-Staten Island' = 195), dropoff_puma UInt16) ENGINE = MergeTree(pickup_date, pickup_datetime, 8192) -``` - -在之前的服务器中运行: - -``` sql -CREATE TABLE trips_mergetree_x3 AS trips_mergetree_third ENGINE = Distributed(perftest, default, trips_mergetree_third, rand()) -``` - -运行如下查询重新分布数据: - -``` sql -INSERT INTO trips_mergetree_x3 SELECT * FROM trips_mergetree -``` - -这个查询需要运行2454秒。 - -在三台服务器集群中运行的结果: - -Q1:0.212秒. -Q2:0.438秒。 -Q3:0.733秒。 -Q4:1.241秒. - -不出意料,查询是线性扩展的。 - -我们同时在140台服务器的集群中运行的结果: - -Q1:0.028秒。 -Q2:0.043秒。 -Q3:0.051秒。 -Q4:0.072秒。 - -在这种情况下,查询处理时间首先由网络延迟确定。 -我们使用位于芬兰的Yandex数据中心中的客户端去位于俄罗斯的集群上运行查询,这增加了大约20毫秒的延迟。 - -## 总结 {#zong-jie} - -| 服务器 | Q1 | Q2 | Q3 | Q4 | -|--------|-------|-------|-------|-------| -| 1 | 0.490 | 1.224 | 2.104 | 3.593 | -| 3 | 0.212 | 0.438 | 0.733 | 1.241 | -| 140 | 0.028 | 0.043 | 0.051 | 0.072 | - -[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/nyc_taxi/) diff --git a/docs/zh/getting_started/example_datasets/ontime.md b/docs/zh/getting_started/example_datasets/ontime.md deleted file mode 100644 index 31684129bb7..00000000000 --- a/docs/zh/getting_started/example_datasets/ontime.md +++ /dev/null @@ -1,405 +0,0 @@ - -# 航班飞行数据 {#hang-ban-fei-xing-shu-ju} - -航班飞行数据有以下两个方式获取: - -- 从原始数据导入 -- 下载预处理好的分区数据 - -## 从原始数据导入 {#cong-yuan-shi-shu-ju-dao-ru} - -下载数据: - -``` bash -for s in `seq 1987 2018` -do -for m in `seq 1 12` -do -wget https://transtats.bts.gov/PREZIP/On_Time_Reporting_Carrier_On_Time_Performance_1987_present_${s}_${m}.zip -done -done -``` - -(引用 https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh ) - -创建表结构: - -``` sql -CREATE TABLE `ontime` ( - `Year` UInt16, - `Quarter` UInt8, - `Month` UInt8, - `DayofMonth` UInt8, - `DayOfWeek` UInt8, - `FlightDate` Date, - `UniqueCarrier` FixedString(7), - `AirlineID` Int32, - `Carrier` FixedString(2), - `TailNum` String, - `FlightNum` String, - `OriginAirportID` Int32, - `OriginAirportSeqID` Int32, - `OriginCityMarketID` Int32, - `Origin` FixedString(5), - `OriginCityName` String, - `OriginState` FixedString(2), - `OriginStateFips` String, - `OriginStateName` String, - `OriginWac` Int32, - `DestAirportID` Int32, - `DestAirportSeqID` Int32, - `DestCityMarketID` Int32, - `Dest` FixedString(5), - `DestCityName` String, - `DestState` FixedString(2), - `DestStateFips` String, - `DestStateName` String, - `DestWac` Int32, - `CRSDepTime` Int32, - `DepTime` Int32, - `DepDelay` Int32, - `DepDelayMinutes` Int32, - `DepDel15` Int32, - `DepartureDelayGroups` String, - `DepTimeBlk` String, - `TaxiOut` Int32, - `WheelsOff` Int32, - `WheelsOn` Int32, - `TaxiIn` Int32, - `CRSArrTime` Int32, - `ArrTime` Int32, - `ArrDelay` Int32, - `ArrDelayMinutes` Int32, - `ArrDel15` Int32, - `ArrivalDelayGroups` Int32, - `ArrTimeBlk` String, - `Cancelled` UInt8, - `CancellationCode` FixedString(1), - `Diverted` UInt8, - `CRSElapsedTime` Int32, - `ActualElapsedTime` Int32, - `AirTime` Int32, - `Flights` Int32, - `Distance` Int32, - `DistanceGroup` UInt8, - `CarrierDelay` Int32, - `WeatherDelay` Int32, - `NASDelay` Int32, - `SecurityDelay` Int32, - `LateAircraftDelay` Int32, - `FirstDepTime` String, - `TotalAddGTime` String, - `LongestAddGTime` String, - `DivAirportLandings` String, - `DivReachedDest` String, - `DivActualElapsedTime` String, - `DivArrDelay` String, - `DivDistance` String, - `Div1Airport` String, - `Div1AirportID` Int32, - `Div1AirportSeqID` Int32, - `Div1WheelsOn` String, - `Div1TotalGTime` String, - `Div1LongestGTime` String, - `Div1WheelsOff` String, - `Div1TailNum` String, - `Div2Airport` String, - `Div2AirportID` Int32, - `Div2AirportSeqID` Int32, - `Div2WheelsOn` String, - `Div2TotalGTime` String, - `Div2LongestGTime` String, - `Div2WheelsOff` String, - `Div2TailNum` String, - `Div3Airport` String, - `Div3AirportID` Int32, - `Div3AirportSeqID` Int32, - `Div3WheelsOn` String, - `Div3TotalGTime` String, - `Div3LongestGTime` String, - `Div3WheelsOff` String, - `Div3TailNum` String, - `Div4Airport` String, - `Div4AirportID` Int32, - `Div4AirportSeqID` Int32, - `Div4WheelsOn` String, - `Div4TotalGTime` String, - `Div4LongestGTime` String, - `Div4WheelsOff` String, - `Div4TailNum` String, - `Div5Airport` String, - `Div5AirportID` Int32, - `Div5AirportSeqID` Int32, - `Div5WheelsOn` String, - `Div5TotalGTime` String, - `Div5LongestGTime` String, - `Div5WheelsOff` String, - `Div5TailNum` String -) ENGINE = MergeTree -PARTITION BY Year -ORDER BY (Carrier, FlightDate) -SETTINGS index_granularity = 8192; -``` - -加载数据: - -``` bash -$ for i in *.zip; do echo $i; unzip -cq $i '*.csv' | sed 's/\.00//g' | clickhouse-client --host=example-perftest01j --query="INSERT INTO ontime FORMAT CSVWithNames"; done -``` - -## 下载预处理好的分区数据 {#xia-zai-yu-chu-li-hao-de-fen-qu-shu-ju} - -``` bash -$ curl -O https://clickhouse-datasets.s3.yandex.net/ontime/partitions/ontime.tar -$ tar xvf ontime.tar -C /var/lib/clickhouse # path to ClickHouse data directory -$ # check permissions of unpacked data, fix if required -$ sudo service clickhouse-server restart -$ clickhouse-client --query "select count(*) from datasets.ontime" -``` - -!!! info "信息" - 如果要运行下面的SQL查询,必须使用完整的表名, -`datasets.ontime`。 - -## 查询: {#cha-xun} - -Q0. - -``` sql -SELECT avg(c1) -FROM -( - SELECT Year, Month, count(*) AS c1 - FROM ontime - GROUP BY Year, Month -); -``` - -Q1. 查询从2000年到2008年每天的航班数 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -Q2. 查询从2000年到2008年每周延误超过10分钟的航班数。 - -``` sql -SELECT DayOfWeek, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY DayOfWeek -ORDER BY c DESC; -``` - -Q3. 查询2000年到2008年每个机场延误超过10分钟以上的次数 - -``` sql -SELECT Origin, count(*) AS c -FROM ontime -WHERE DepDelay>10 AND Year>=2000 AND Year<=2008 -GROUP BY Origin -ORDER BY c DESC -LIMIT 10; -``` - -Q4. 查询2007年各航空公司延误超过10分钟以上的次数 - -``` sql -SELECT Carrier, count(*) -FROM ontime -WHERE DepDelay>10 AND Year=2007 -GROUP BY Carrier -ORDER BY count(*) DESC; -``` - -Q5. 查询2007年各航空公司延误超过10分钟以上的百分比 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year=2007 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year=2007 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -更好的查询版本: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year=2007 -GROUP BY Carrier -ORDER BY c3 DESC -``` - -Q6. 同上一个查询一致,只是查询范围扩大到2000年到2008年 - -``` sql -SELECT Carrier, c, c2, c*100/c2 as c3 -FROM -( - SELECT - Carrier, - count(*) AS c - FROM ontime - WHERE DepDelay>10 - AND Year>=2000 AND Year<=2008 - GROUP BY Carrier -) -JOIN -( - SELECT - Carrier, - count(*) AS c2 - FROM ontime - WHERE Year>=2000 AND Year<=2008 - GROUP BY Carrier -) USING Carrier -ORDER BY c3 DESC; -``` - -更好的查询版本: - -``` sql -SELECT Carrier, avg(DepDelay>10)*100 AS c3 -FROM ontime -WHERE Year>=2000 AND Year<=2008 -GROUP BY Carrier -ORDER BY c3 DESC; -``` - -Q7. 每年航班延误超过10分钟的百分比 - -``` sql -SELECT Year, c1/c2 -FROM -( - select - Year, - count(*)*100 as c1 - from ontime - WHERE DepDelay>10 - GROUP BY Year -) -JOIN -( - select - Year, - count(*) as c2 - from ontime - GROUP BY Year -) USING (Year) -ORDER BY Year; -``` - -更好的查询版本: - -``` sql -SELECT Year, avg(DepDelay>10)*100 -FROM ontime -GROUP BY Year -ORDER BY Year; -``` - -Q8. 每年更受人们喜爱的目的地 - -``` sql -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -WHERE Year >= 2000 and Year <= 2010 -GROUP BY DestCityName -ORDER BY u DESC LIMIT 10; -``` - -Q9. - -``` sql -SELECT Year, count(*) AS c1 -FROM ontime -GROUP BY Year; -``` - -Q10. - -``` sql -SELECT - min(Year), max(Year), Carrier, count(*) AS cnt, - sum(ArrDelayMinutes>30) AS flights_delayed, - round(sum(ArrDelayMinutes>30)/count(*),2) AS rate -FROM ontime -WHERE - DayOfWeek NOT IN (6,7) AND OriginState NOT IN ('AK', 'HI', 'PR', 'VI') - AND DestState NOT IN ('AK', 'HI', 'PR', 'VI') - AND FlightDate < '2010-01-01' -GROUP by Carrier -HAVING cnt>100000 and max(Year)>1990 -ORDER by rate DESC -LIMIT 1000; -``` - -奖金: - -``` sql -SELECT avg(cnt) -FROM -( - SELECT Year,Month,count(*) AS cnt - FROM ontime - WHERE DepDel15=1 - GROUP BY Year,Month -); - -SELECT avg(c1) FROM -( - SELECT Year,Month,count(*) AS c1 - FROM ontime - GROUP BY Year,Month -); - -SELECT DestCityName, uniqExact(OriginCityName) AS u -FROM ontime -GROUP BY DestCityName -ORDER BY u DESC -LIMIT 10; - -SELECT OriginCityName, DestCityName, count() AS c -FROM ontime -GROUP BY OriginCityName, DestCityName -ORDER BY c DESC -LIMIT 10; - -SELECT OriginCityName, count() AS c -FROM ontime -GROUP BY OriginCityName -ORDER BY c DESC -LIMIT 10; -``` - -这个性能测试由Vadim Tkachenko提供。参考: - -- https://www.percona.com/blog/2009/10/02/analyzing-air-traffic-performance-with-infobright-and-monetdb/ -- https://www.percona.com/blog/2009/10/26/air-traffic-queries-in-luciddb/ -- https://www.percona.com/blog/2009/11/02/air-traffic-queries-in-infinidb-early-alpha/ -- https://www.percona.com/blog/2014/04/21/using-apache-hadoop-and-impala-together-with-mysql-for-data-analysis/ -- https://www.percona.com/blog/2016/01/07/apache-spark-with-air-ontime-performance-data/ -- http://nickmakos.blogspot.ru/2012/08/analyzing-air-traffic-performance-with.html diff --git a/docs/zh/getting_started/example_datasets/star_schema.md b/docs/zh/getting_started/example_datasets/star_schema.md deleted file mode 100644 index b575abe63fa..00000000000 --- a/docs/zh/getting_started/example_datasets/star_schema.md +++ /dev/null @@ -1,194 +0,0 @@ - -# 星型基准测试 {#star-schema-benchmark} - -编译 dbgen: - -``` bash -$ git clone git@github.com:vadimtk/ssb-dbgen.git -$ cd ssb-dbgen -$ make -``` - -开始生成数据: - -``` bash -$ ./dbgen -s 1000 -T c -$ ./dbgen -s 1000 -T l -$ ./dbgen -s 1000 -T p -$ ./dbgen -s 1000 -T s -$ ./dbgen -s 1000 -T d -``` - -在ClickHouse中创建表结构: - -``` sql -CREATE TABLE customer -( - C_CUSTKEY UInt32, - C_NAME String, - C_ADDRESS String, - C_CITY LowCardinality(String), - C_NATION LowCardinality(String), - C_REGION LowCardinality(String), - C_PHONE String, - C_MKTSEGMENT LowCardinality(String) -) -ENGINE = MergeTree ORDER BY (C_CUSTKEY); - -CREATE TABLE lineorder -( - LO_ORDERKEY UInt32, - LO_LINENUMBER UInt8, - LO_CUSTKEY UInt32, - LO_PARTKEY UInt32, - LO_SUPPKEY UInt32, - LO_ORDERDATE Date, - LO_ORDERPRIORITY LowCardinality(String), - LO_SHIPPRIORITY UInt8, - LO_QUANTITY UInt8, - LO_EXTENDEDPRICE UInt32, - LO_ORDTOTALPRICE UInt32, - LO_DISCOUNT UInt8, - LO_REVENUE UInt32, - LO_SUPPLYCOST UInt32, - LO_TAX UInt8, - LO_COMMITDATE Date, - LO_SHIPMODE LowCardinality(String) -) -ENGINE = MergeTree PARTITION BY toYear(LO_ORDERDATE) ORDER BY (LO_ORDERDATE, LO_ORDERKEY); - -CREATE TABLE part -( - P_PARTKEY UInt32, - P_NAME String, - P_MFGR LowCardinality(String), - P_CATEGORY LowCardinality(String), - P_BRAND LowCardinality(String), - P_COLOR LowCardinality(String), - P_TYPE LowCardinality(String), - P_SIZE UInt8, - P_CONTAINER LowCardinality(String) -) -ENGINE = MergeTree ORDER BY P_PARTKEY; - -CREATE TABLE supplier -( - S_SUPPKEY UInt32, - S_NAME String, - S_ADDRESS String, - S_CITY LowCardinality(String), - S_NATION LowCardinality(String), - S_REGION LowCardinality(String), - S_PHONE String -) -ENGINE = MergeTree ORDER BY S_SUPPKEY; -``` - -写入数据: - -``` bash -$ clickhouse-client --query "INSERT INTO customer FORMAT CSV" < customer.tbl -$ clickhouse-client --query "INSERT INTO part FORMAT CSV" < part.tbl -$ clickhouse-client --query "INSERT INTO supplier FORMAT CSV" < supplier.tbl -$ clickhouse-client --query "INSERT INTO lineorder FORMAT CSV" < lineorder.tbl -``` - -将«星型模型»转换为非规范化的«平面模型»: - -``` sql -SET max_memory_usage = 20000000000, allow_experimental_multiple_joins_emulation = 1; - -CREATE TABLE lineorder_flat -ENGINE = MergeTree -PARTITION BY toYear(LO_ORDERDATE) -ORDER BY (LO_ORDERDATE, LO_ORDERKEY) AS -SELECT l.*, c.*, s.*, p.* -FROM lineorder l - ANY INNER JOIN customer c ON (c.C_CUSTKEY = l.LO_CUSTKEY) - ANY INNER JOIN supplier s ON (s.S_SUPPKEY = l.LO_SUPPKEY) - ANY INNER JOIN part p ON (p.P_PARTKEY = l.LO_PARTKEY); - -ALTER TABLE lineorder_flat DROP COLUMN C_CUSTKEY, DROP COLUMN S_SUPPKEY, DROP COLUMN P_PARTKEY; -``` - -运行查询: - -Q1.1 - -``` sql -SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue FROM lineorder_flat WHERE toYear(LO_ORDERDATE) = 1993 AND LO_DISCOUNT BETWEEN 1 AND 3 AND LO_QUANTITY < 25; -``` - -Q1.2 - -``` sql -SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue FROM lineorder_flat WHERE toYYYYMM(LO_ORDERDATE) = 199401 AND LO_DISCOUNT BETWEEN 4 AND 6 AND LO_QUANTITY BETWEEN 26 AND 35; -``` - -Q1.3 - -``` sql -SELECT sum(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue FROM lineorder_flat WHERE toISOWeek(LO_ORDERDATE) = 6 AND toYear(LO_ORDERDATE) = 1994 AND LO_DISCOUNT BETWEEN 5 AND 7 AND LO_QUANTITY BETWEEN 26 AND 35; -``` - -Q2.1 - -``` sql -SELECT sum(LO_REVENUE), toYear(LO_ORDERDATE) AS year, P_BRAND FROM lineorder_flat WHERE P_CATEGORY = 'MFGR#12' AND S_REGION = 'AMERICA' GROUP BY year, P_BRAND ORDER BY year, P_BRAND; -``` - -Q2.2 - -``` sql -SELECT sum(LO_REVENUE), toYear(LO_ORDERDATE) AS year, P_BRAND FROM lineorder_flat WHERE P_BRAND BETWEEN 'MFGR#2221' AND 'MFGR#2228' AND S_REGION = 'ASIA' GROUP BY year, P_BRAND ORDER BY year, P_BRAND; -``` - -Q2.3 - -``` sql -SELECT sum(LO_REVENUE), toYear(LO_ORDERDATE) AS year, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#2239' AND S_REGION = 'EUROPE' GROUP BY year, P_BRAND ORDER BY year, P_BRAND; -``` - -Q3.1 - -``` sql -SELECT C_NATION, S_NATION, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE C_REGION = 'ASIA' AND S_REGION = 'ASIA' AND year >= 1992 AND year <= 1997 GROUP BY C_NATION, S_NATION, year ORDER BY year asc, revenue desc; -``` - -Q3.2 - -``` sql -SELECT C_CITY, S_CITY, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE C_NATION = 'UNITED STATES' AND S_NATION = 'UNITED STATES' AND year >= 1992 AND year <= 1997 GROUP BY C_CITY, S_CITY, year ORDER BY year asc, revenue desc; -``` - -Q3.3 - -``` sql -SELECT C_CITY, S_CITY, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND year >= 1992 AND year <= 1997 GROUP BY C_CITY, S_CITY, year ORDER BY year asc, revenue desc; -``` - -Q3.4 - -``` sql -SELECT C_CITY, S_CITY, toYear(LO_ORDERDATE) AS year, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND toYYYYMM(LO_ORDERDATE) = '199712' GROUP BY C_CITY, S_CITY, year ORDER BY year asc, revenue desc; -``` - -Q4.1 - -``` sql -SELECT toYear(LO_ORDERDATE) AS year, C_NATION, sum(LO_REVENUE - LO_SUPPLYCOST) AS profit FROM lineorder_flat WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') GROUP BY year, C_NATION ORDER BY year, C_NATION; -``` - -Q4.2 - -``` sql -SELECT toYear(LO_ORDERDATE) AS year, S_NATION, P_CATEGORY, sum(LO_REVENUE - LO_SUPPLYCOST) AS profit FROM lineorder_flat WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND (year = 1997 OR year = 1998) AND (P_MFGR = 'MFGR#1' OR P_MFGR = 'MFGR#2') GROUP BY year, S_NATION, P_CATEGORY ORDER BY year, S_NATION, P_CATEGORY; -``` - -Q4.3 - -``` sql -SELECT toYear(LO_ORDERDATE) AS year, S_CITY, P_BRAND, sum(LO_REVENUE - LO_SUPPLYCOST) AS profit FROM lineorder_flat WHERE S_NATION = 'UNITED STATES' AND (year = 1997 OR year = 1998) AND P_CATEGORY = 'MFGR#14' GROUP BY year, S_CITY, P_BRAND ORDER BY year, S_CITY, P_BRAND; -``` - -[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/star_schema/) diff --git a/docs/zh/getting_started/example_datasets/wikistat.md b/docs/zh/getting_started/example_datasets/wikistat.md deleted file mode 100644 index c2681a912e2..00000000000 --- a/docs/zh/getting_started/example_datasets/wikistat.md +++ /dev/null @@ -1,29 +0,0 @@ - -# 维基访问数据 {#wei-ji-fang-wen-shu-ju} - -参考: http://dumps.wikimedia.org/other/pagecounts-raw/ - -创建表结构: - -``` sql -CREATE TABLE wikistat -( - date Date, - time DateTime, - project String, - subproject String, - path String, - hits UInt64, - size UInt64 -) ENGINE = MergeTree(date, (path, time), 8192); -``` - -加载数据: - -``` bash -$ for i in {2007..2016}; do for j in {01..12}; do echo $i-$j >&2; curl -sSL "http://dumps.wikimedia.org/other/pagecounts-raw/$i/$i-$j/" | grep -oE 'pagecounts-[0-9]+-[0-9]+\.gz'; done; done | sort | uniq | tee links.txt -$ cat links.txt | while read link; do wget http://dumps.wikimedia.org/other/pagecounts-raw/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1/')/$(echo $link | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})[0-9]{2}-[0-9]+\.gz/\1-\2/')/$link; done -$ ls -1 /opt/wikistat/ | grep gz | while read i; do echo $i; gzip -cd /opt/wikistat/$i | ./wikistat-loader --time="$(echo -n $i | sed -r 's/pagecounts-([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2})\.gz/\1-\2-\3 \4-00-00/')" | clickhouse-client --query="INSERT INTO wikistat FORMAT TabSeparated"; done -``` - -[原始文章](https://clickhouse.tech/docs/en/getting_started/example_datasets/wikistat/) diff --git a/docs/zh/getting_started/index.md b/docs/zh/getting_started/index.md deleted file mode 100644 index 35ae08bde7b..00000000000 --- a/docs/zh/getting_started/index.md +++ /dev/null @@ -1,11 +0,0 @@ - -# 入门 {#ru-men} - -如果您是ClickHouse的新手,并希望亲身体验它的性能,首先您需要通过 [安装过程](install.md). - -之后,您可以选择以下选项之一: - -- [通过详细的教程](tutorial.md) -- [试验示例数据集](example_datasets/ontime.md) - -[来源文章](https://clickhouse.tech/docs/zh/getting_started/) diff --git a/docs/zh/getting_started/install.md b/docs/zh/getting_started/install.md deleted file mode 100644 index 111c362caf7..00000000000 --- a/docs/zh/getting_started/install.md +++ /dev/null @@ -1,154 +0,0 @@ -# 安装 {#clickhouse-an-zhuang} - -## 系统要求 {#xi-tong-yao-qiu} - -ClickHouse可以在任何具有x86\_64,AArch64或PowerPC64LE CPU架构的Linux,FreeBSD或Mac OS X上运行。 - -虽然预构建的二进制文件通常是为x86  \_64编译并利用SSE 4.2指令集,但除非另有说明,否则使用支持它的CPU将成为额外的系统要求。这是检查当前CPU是否支持SSE 4.2的命令: - -``` bash -$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported" -``` - -要在不支持SSE 4.2或具有AArch64或PowerPC64LE体系结构的处理器上运行ClickHouse,您应该[通过源构建ClickHouse](#from-sources)进行适当的配置调整。 - -## 可用的安装选项 {#ke-yong-de-an-zhuang-xuan-xiang} - - -\#\#\# 为Debian/Ubuntu安装 {\#from-deb-packages} - -在`/etc/apt/sources.list` (或创建`/etc/apt/sources.list.d/clickhouse.list`文件)中添加仓库: - -``` text -deb http://repo.yandex.ru/clickhouse/deb/stable/ main/ -``` - -如果你想使用最新的测试版本,请使用'testing'替换'stable'。 - -然后运行: - -``` bash -sudo apt-get install dirmngr # optional -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 # optional -sudo apt-get update -sudo apt-get install clickhouse-client clickhouse-server -``` - -你也可以从这里手动下载安装包:https://repo.yandex.ru/clickhouse/deb/stable/main/。 - -ClickHouse包含访问控制配置,它们位于`users.xml`文件中(与'config.xml'同目录)。 -默认情况下,允许从任何地方使用默认的'default'用户无密码的访问ClickHouse。参考'user/default/networks'。 -有关更多信息,请参考«Configuration files»部分。 - -### 来自RPM包 {#from-rpm-packages} - -Yandex ClickHouse团队建议使用官方预编译的`rpm`软件包,用于CentOS,RedHat和所有其他基于rpm的Linux发行版。 - -首先,您需要添加官方存储库: - -``` bash -sudo yum install yum-utils -sudo rpm --import https://repo.yandex.ru/clickhouse/CLICKHOUSE-KEY.GPG -sudo yum-config-manager --add-repo https://repo.yandex.ru/clickhouse/rpm/stable/x86_64 -``` - -如果您想使用最新版本,请将`stable`替换为`testing`(建议您在测试环境中使用)。 - -然后运行这些命令以实际安装包: - -``` bash -sudo yum install clickhouse-server clickhouse-client -``` - -您也可以从此处手动下载和安装软件包:https://repo.yandex.ru/clickhouse/rpm/stable/x86\_64。 - -### 来自Docker {#from-docker-image} - -要在Docker中运行ClickHouse,请遵循[码头工人中心](https://hub.docker.com/r/yandex/clickhouse-server/)上的指南。那些图像使用官方的`deb`包。 - -### 使用源码安装 {#from-sources} - -具体编译方式可以参考build.md。 - -你可以编译并安装它们。 -你也可以直接使用而不进行安装。 - -``` text -Client: programs/clickhouse-client -Server: programs/clickhouse-server -``` - -在服务器中为数据创建如下目录: - -``` text -/opt/clickhouse/data/default/ -/opt/clickhouse/metadata/default/ -``` - -(它们可以在server config中配置。) -为需要的用户运行'chown' - -日志的路径可以在server config (src/programs/server/config.xml)中配置。 - -## 启动 {#qi-dong} - -可以运行如下命令在后台启动服务: - -``` bash -sudo service clickhouse-server start -``` - -可以在`/var/log/clickhouse-server/`目录中查看日志。 - -如果服务没有启动,请检查配置文件 `/etc/clickhouse-server/config.xml`。 - -你也可以在控制台中直接启动服务: - -``` bash -clickhouse-server --config-file=/etc/clickhouse-server/config.xml -``` - -在这种情况下,日志将被打印到控制台中,这在开发过程中很方便。 -如果配置文件在当前目录中,你可以不指定'–config-file'参数。它默认使用'./config.xml'。 - -你可以使用命令行客户端连接到服务: - -``` bash -clickhouse-client -``` - -默认情况下它使用'default'用户无密码的与localhost:9000服务建立连接。 -客户端也可以用于连接远程服务,例如: - -``` bash -clickhouse-client --host=example.com -``` - -有关更多信息,请参考«Command-line client»部分。 - -检查系统是否工作: - -``` bash -milovidov@hostname:~/work/metrica/src/src/Client$ ./clickhouse-client -ClickHouse client version 0.0.18749. -Connecting to localhost:9000. -Connected to ClickHouse server version 0.0.18749. - -:) SELECT 1 - -SELECT 1 - -┌─1─┐ -│ 1 │ -└───┘ - -1 rows in set. Elapsed: 0.003 sec. - -:) -``` - -**恭喜,系统已经工作了!** - -为了继续进行实验,你可以尝试下载测试数据集。 - -[原始文章](https://clickhouse.tech/docs/en/getting_started/install/) diff --git a/docs/zh/getting_started/playground.md b/docs/zh/getting_started/playground.md deleted file mode 100644 index 252b2eae611..00000000000 --- a/docs/zh/getting_started/playground.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -toc_priority: 14 -toc_title: "\u266A\u64CD\u573A\u266A" ---- - -# ClickHouse体验平台 {#clickhouse-playground} - -[ClickHouse体验平台](https://play.clickhouse.tech?file=welcome) 允许人们通过即时运行查询来尝试ClickHouse,而无需设置他们的服务器或集群。 -体验平台中提供了几个示例数据集以及显示ClickHouse特性的示例查询。 - -查询以只读用户身份执行。 这意味着一些局限性: - -- 不允许DDL查询 -- 不允许插入查询 - -还强制执行以下设置: -- [`max_result_bytes=10485760`](../operations/settings/query_complexity/#max-result-bytes) -- [`max_result_rows=2000`](../operations/settings/query_complexity/#setting-max_result_rows) -- [`result_overflow_mode=break`](../operations/settings/query_complexity/#result-overflow-mode) -- [`max_execution_time=60000`](../operations/settings/query_complexity/#max-execution-time) - -ClickHouse体验还有如下: -[ClickHouse管理服务](https://cloud.yandex.com/services/managed-clickhouse) -实例托管 [Yandex云](https://cloud.yandex.com/). -更多信息 [云提供商](../commercial/cloud.md). - -ClickHouse体验平台界面实际上是通过ClickHouse [HTTP API](../interfaces/http.md)接口实现的. -体验平台后端只是一个ClickHouse集群,没有任何额外的服务器端应用程序。 -体验平台也同样提供了ClickHouse HTTPS服务端口。 - - -您可以使用任何HTTP客户端向体验平台进行查询,例如 [curl](https://curl.haxx.se) 或 [wget](https://www.gnu.org/software/wget/),或使用以下方式建立连接 [JDBC](../interfaces/jdbc.md) 或 [ODBC](../interfaces/odbc.md) 司机 -有关支持ClickHouse的软件产品的更多信息,请访问 [这里](../interfaces/index.md). - -| 参数 | 值 | -|:-----|:--------------------------------------| -| 服务端口 | https://play-api.clickhouse.tech:8443 | -| 用户 | `playground` | -| 密码 | `clickhouse` | - -请注意,此服务端口需要安全连接。 - -示例: - -``` bash -curl "https://play-api.clickhouse.tech:8443/?query=SELECT+'Play+ClickHouse!';&user=playground&password=clickhouse&database=datasets" -``` diff --git a/docs/zh/getting_started/tutorial.md b/docs/zh/getting_started/tutorial.md deleted file mode 100644 index bd86e19a037..00000000000 --- a/docs/zh/getting_started/tutorial.md +++ /dev/null @@ -1,671 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 12 -toc_title: "\u6559\u7A0B" ---- - -# 教程 {#clickhouse-tutorial} - -## 从本教程中可以期待什么? {#what-to-expect-from-this-tutorial} - -通过本教程,您将学习如何设置一个简单的ClickHouse集群。 它会很小,但容错和可扩展。 然后,我们将使用其中一个示例数据集来填充数据并执行一些演示查询。 - -## 单节点设置 {#single-node-setup} - -为了推迟分布式环境的复杂性,我们将首先在单个服务器或虚拟机上部署ClickHouse。 ClickHouse通常是从安装 [黛布](index.md#install-from-deb-packages) 或 [rpm](index.md#from-rpm-packages) 包,但也有 [替代办法](index.md#from-docker-image) 对于不支持它们的操作系统。 - -例如,您选择了 `deb` 包和执行: - -``` bash -sudo apt-get install dirmngr -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 - -echo "deb http://repo.clickhouse.tech/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list -sudo apt-get update - -sudo apt-get install -y clickhouse-server clickhouse-client -``` - -我们在安装的软件包中有什么: - -- `clickhouse-client` 包包含 [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 应用程序,交互式ClickHouse控制台客户端。 -- `clickhouse-common` 包包含一个ClickHouse可执行文件。 -- `clickhouse-server` 包包含要作为服务器运行ClickHouse的配置文件。 - -服务器配置文件位于 `/etc/clickhouse-server/`. 在进一步讨论之前,请注意 `` 元素in `config.xml`. Path确定数据存储的位置,因此应该位于磁盘容量较大的卷上;默认值为 `/var/lib/clickhouse/`. 如果你想调整配置,直接编辑并不方便 `config.xml` 文件,考虑到它可能会在未来的软件包更新中被重写。 复盖配置元素的推荐方法是创建 [在配置文件。d目录](../operations/configuration_files.md) 它作为 “patches” 要配置。xml - -你可能已经注意到了, `clickhouse-server` 安装包后不会自动启动。 它也不会在更新后自动重新启动。 您启动服务器的方式取决于您的init系统,通常情况下,它是: - -``` bash -sudo service clickhouse-server start -``` - -或 - -``` bash -sudo /etc/init.d/clickhouse-server start -``` - -服务器日志的默认位置是 `/var/log/clickhouse-server/`. 服务器已准备好处理客户端连接一旦它记录 `Ready for connections` 消息 - -一旦 `clickhouse-server` 正在运行我们可以利用 `clickhouse-client` 连接到服务器并运行一些测试查询,如 `SELECT "Hello, world!";`. - -
- -Clickhouse-客户端的快速提示 -交互模式: - -``` bash -clickhouse-client -clickhouse-client --host=... --port=... --user=... --password=... -``` - -启用多行查询: - -``` bash -clickhouse-client -m -clickhouse-client --multiline -``` - -以批处理模式运行查询: - -``` bash -clickhouse-client --query='SELECT 1' -echo 'SELECT 1' | clickhouse-client -clickhouse-client <<< 'SELECT 1' -``` - -从指定格式的文件中插入数据: - -``` bash -clickhouse-client --query='INSERT INTO table VALUES' < data.txt -clickhouse-client --query='INSERT INTO table FORMAT TabSeparated' < data.tsv -``` - -
- -## 导入示例数据集 {#import-sample-dataset} - -现在是时候用一些示例数据填充我们的ClickHouse服务器。 在本教程中,我们将使用Yandex的匿名数据。Metrica,在成为开源之前以生产方式运行ClickHouse的第一个服务(更多关于这一点 [历史科](../introduction/history.md)). 有 [多种导入Yandex的方式。梅里卡数据集](example_datasets/metrica.md),为了本教程,我们将使用最现实的一个。 - -### 下载并提取表数据 {#download-and-extract-table-data} - -``` bash -curl https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz | unxz --threads=`nproc` > hits_v1.tsv -curl https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz | unxz --threads=`nproc` > visits_v1.tsv -``` - -提取的文件大小约为10GB。 - -### 创建表 {#create-tables} - -与大多数数据库管理系统一样,ClickHouse在逻辑上将表分组为 “databases”. 有一个 `default` 数据库,但我们将创建一个名为新的 `tutorial`: - -``` bash -clickhouse-client --query "CREATE DATABASE IF NOT EXISTS tutorial" -``` - -与数据库相比,创建表的语法要复杂得多(请参阅 [参考资料](../sql_reference/statements/create.md). 一般 `CREATE TABLE` 声明必须指定三个关键的事情: - -1. 要创建的表的名称。 -2. Table schema, i.e. list of columns and their [数据类型](../sql_reference/data_types/index.md). -3. [表引擎](../engines/table_engines/index.md) 它是settings,它决定了如何物理执行对此表的查询的所有细节。 - -YandexMetrica是一个网络分析服务,样本数据集不包括其全部功能,因此只有两个表可以创建: - -- `hits` 是一个表格,其中包含所有用户在服务所涵盖的所有网站上完成的每个操作。 -- `visits` 是一个包含预先构建的会话而不是单个操作的表。 - -让我们看看并执行这些表的实际创建表查询: - -``` sql -CREATE TABLE tutorial.hits_v1 -( - `WatchID` UInt64, - `JavaEnable` UInt8, - `Title` String, - `GoodEvent` Int16, - `EventTime` DateTime, - `EventDate` Date, - `CounterID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RegionID` UInt32, - `UserID` UInt64, - `CounterClass` Int8, - `OS` UInt8, - `UserAgent` UInt8, - `URL` String, - `Referer` String, - `URLDomain` String, - `RefererDomain` String, - `Refresh` UInt8, - `IsRobot` UInt8, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `FlashMinor2` String, - `NetMajor` UInt8, - `NetMinor` UInt8, - `UserAgentMajor` UInt16, - `UserAgentMinor` FixedString(2), - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `MobilePhone` UInt8, - `MobilePhoneModel` String, - `Params` String, - `IPNetworkID` UInt32, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `IsArtifical` UInt8, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `ClientTimeZone` Int16, - `ClientEventTime` DateTime, - `SilverlightVersion1` UInt8, - `SilverlightVersion2` UInt8, - `SilverlightVersion3` UInt32, - `SilverlightVersion4` UInt16, - `PageCharset` String, - `CodeVersion` UInt32, - `IsLink` UInt8, - `IsDownload` UInt8, - `IsNotBounce` UInt8, - `FUniqID` UInt64, - `HID` UInt32, - `IsOldCounter` UInt8, - `IsEvent` UInt8, - `IsParameter` UInt8, - `DontCountHits` UInt8, - `WithHash` UInt8, - `HitColor` FixedString(1), - `UTCEventTime` DateTime, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `WindowName` Int32, - `OpenerName` Int32, - `HistoryLength` Int16, - `BrowserLanguage` FixedString(2), - `BrowserCountry` FixedString(2), - `SocialNetwork` String, - `SocialAction` String, - `HTTPError` UInt16, - `SendTiming` Int32, - `DNSTiming` Int32, - `ConnectTiming` Int32, - `ResponseStartTiming` Int32, - `ResponseEndTiming` Int32, - `FetchTiming` Int32, - `RedirectTiming` Int32, - `DOMInteractiveTiming` Int32, - `DOMContentLoadedTiming` Int32, - `DOMCompleteTiming` Int32, - `LoadEventStartTiming` Int32, - `LoadEventEndTiming` Int32, - `NSToDOMContentLoadedTiming` Int32, - `FirstPaintTiming` Int32, - `RedirectCount` Int8, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `ParamPrice` Int64, - `ParamOrderID` String, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `GoalsReached` Array(UInt32), - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `RefererHash` UInt64, - `URLHash` UInt64, - `CLID` UInt32, - `YCLID` UInt64, - `ShareService` String, - `ShareURL` String, - `ShareTitle` String, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `IslandID` FixedString(16), - `RequestNum` UInt32, - `RequestTry` UInt8 -) -ENGINE = MergeTree() -PARTITION BY toYYYYMM(EventDate) -ORDER BY (CounterID, EventDate, intHash32(UserID)) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -``` sql -CREATE TABLE tutorial.visits_v1 -( - `CounterID` UInt32, - `StartDate` Date, - `Sign` Int8, - `IsNew` UInt8, - `VisitID` UInt64, - `UserID` UInt64, - `StartTime` DateTime, - `Duration` UInt32, - `UTCStartTime` DateTime, - `PageViews` Int32, - `Hits` Int32, - `IsBounce` UInt8, - `Referer` String, - `StartURL` String, - `RefererDomain` String, - `StartURLDomain` String, - `EndURL` String, - `LinkURL` String, - `IsDownload` UInt8, - `TraficSourceID` Int8, - `SearchEngineID` UInt16, - `SearchPhrase` String, - `AdvEngineID` UInt8, - `PlaceID` Int32, - `RefererCategories` Array(UInt16), - `URLCategories` Array(UInt16), - `URLRegions` Array(UInt32), - `RefererRegions` Array(UInt32), - `IsYandex` UInt8, - `GoalReachesDepth` Int32, - `GoalReachesURL` Int32, - `GoalReachesAny` Int32, - `SocialSourceNetworkID` UInt8, - `SocialSourcePage` String, - `MobilePhoneModel` String, - `ClientEventTime` DateTime, - `RegionID` UInt32, - `ClientIP` UInt32, - `ClientIP6` FixedString(16), - `RemoteIP` UInt32, - `RemoteIP6` FixedString(16), - `IPNetworkID` UInt32, - `SilverlightVersion3` UInt32, - `CodeVersion` UInt32, - `ResolutionWidth` UInt16, - `ResolutionHeight` UInt16, - `UserAgentMajor` UInt16, - `UserAgentMinor` UInt16, - `WindowClientWidth` UInt16, - `WindowClientHeight` UInt16, - `SilverlightVersion2` UInt8, - `SilverlightVersion4` UInt16, - `FlashVersion3` UInt16, - `FlashVersion4` UInt16, - `ClientTimeZone` Int16, - `OS` UInt8, - `UserAgent` UInt8, - `ResolutionDepth` UInt8, - `FlashMajor` UInt8, - `FlashMinor` UInt8, - `NetMajor` UInt8, - `NetMinor` UInt8, - `MobilePhone` UInt8, - `SilverlightVersion1` UInt8, - `Age` UInt8, - `Sex` UInt8, - `Income` UInt8, - `JavaEnable` UInt8, - `CookieEnable` UInt8, - `JavascriptEnable` UInt8, - `IsMobile` UInt8, - `BrowserLanguage` UInt16, - `BrowserCountry` UInt16, - `Interests` UInt16, - `Robotness` UInt8, - `GeneralInterests` Array(UInt16), - `Params` Array(String), - `Goals` Nested( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32), - `WatchIDs` Array(UInt64), - `ParamSumPrice` Int64, - `ParamCurrency` FixedString(3), - `ParamCurrencyID` UInt16, - `ClickLogID` UInt64, - `ClickEventID` Int32, - `ClickGoodEvent` Int32, - `ClickEventTime` DateTime, - `ClickPriorityID` Int32, - `ClickPhraseID` Int32, - `ClickPageID` Int32, - `ClickPlaceID` Int32, - `ClickTypeID` Int32, - `ClickResourceID` Int32, - `ClickCost` UInt32, - `ClickClientIP` UInt32, - `ClickDomainID` UInt32, - `ClickURL` String, - `ClickAttempt` UInt8, - `ClickOrderID` UInt32, - `ClickBannerID` UInt32, - `ClickMarketCategoryID` UInt32, - `ClickMarketPP` UInt32, - `ClickMarketCategoryName` String, - `ClickMarketPPName` String, - `ClickAWAPSCampaignName` String, - `ClickPageName` String, - `ClickTargetType` UInt16, - `ClickTargetPhraseID` UInt64, - `ClickContextType` UInt8, - `ClickSelectType` Int8, - `ClickOptions` String, - `ClickGroupBannerID` Int32, - `OpenstatServiceName` String, - `OpenstatCampaignID` String, - `OpenstatAdID` String, - `OpenstatSourceID` String, - `UTMSource` String, - `UTMMedium` String, - `UTMCampaign` String, - `UTMContent` String, - `UTMTerm` String, - `FromTag` String, - `HasGCLID` UInt8, - `FirstVisit` DateTime, - `PredLastVisit` Date, - `LastVisit` Date, - `TotalVisits` UInt32, - `TraficSource` Nested( - ID Int8, - SearchEngineID UInt16, - AdvEngineID UInt8, - PlaceID UInt16, - SocialSourceNetworkID UInt8, - Domain String, - SearchPhrase String, - SocialSourcePage String), - `Attendance` FixedString(16), - `CLID` UInt32, - `YCLID` UInt64, - `NormalizedRefererHash` UInt64, - `SearchPhraseHash` UInt64, - `RefererDomainHash` UInt64, - `NormalizedStartURLHash` UInt64, - `StartURLDomainHash` UInt64, - `NormalizedEndURLHash` UInt64, - `TopLevelDomain` UInt64, - `URLScheme` UInt64, - `OpenstatServiceNameHash` UInt64, - `OpenstatCampaignIDHash` UInt64, - `OpenstatAdIDHash` UInt64, - `OpenstatSourceIDHash` UInt64, - `UTMSourceHash` UInt64, - `UTMMediumHash` UInt64, - `UTMCampaignHash` UInt64, - `UTMContentHash` UInt64, - `UTMTermHash` UInt64, - `FromHash` UInt64, - `WebVisorEnabled` UInt8, - `WebVisorActivity` UInt32, - `ParsedParams` Nested( - Key1 String, - Key2 String, - Key3 String, - Key4 String, - Key5 String, - ValueDouble Float64), - `Market` Nested( - Type UInt8, - GoalID UInt32, - OrderID String, - OrderPrice Int64, - PP UInt32, - DirectPlaceID UInt32, - DirectOrderID UInt32, - DirectBannerID UInt32, - GoodID String, - GoodName String, - GoodQuantity Int32, - GoodPrice Int64), - `IslandID` FixedString(16) -) -ENGINE = CollapsingMergeTree(Sign) -PARTITION BY toYYYYMM(StartDate) -ORDER BY (CounterID, StartDate, intHash32(UserID), VisitID) -SAMPLE BY intHash32(UserID) -SETTINGS index_granularity = 8192 -``` - -您可以使用以下交互模式执行这些查询 `clickhouse-client` (只需在终端中启动它,而不需要提前指定查询)或尝试一些 [替代接口](../interfaces/index.md) 如果你愿意的话 - -正如我们所看到的, `hits_v1` 使用 [基本MergeTree引擎](../engines/table_engines/mergetree_family/mergetree.md),而 `visits_v1` 使用 [崩溃](../engines/table_engines/mergetree_family/collapsingmergetree.md) 变体。 - -### 导入数据 {#import-data} - -数据导入到ClickHouse是通过以下方式完成的 [INSERT INTO](../sql_reference/statements/insert_into.md) 查询像许多其他SQL数据库。 然而,数据通常是在一个提供 [支持的序列化格式](../interfaces/formats.md) 而不是 `VALUES` 子句(也支持)。 - -我们之前下载的文件是以制表符分隔的格式,所以这里是如何通过控制台客户端导入它们: - -``` bash -clickhouse-client --query "INSERT INTO tutorial.hits_v1 FORMAT TSV" --max_insert_block_size=100000 < hits_v1.tsv -clickhouse-client --query "INSERT INTO tutorial.visits_v1 FORMAT TSV" --max_insert_block_size=100000 < visits_v1.tsv -``` - -ClickHouse有很多 [要调整的设置](../operations/settings/index.md) 在控制台客户端中指定它们的一种方法是通过参数,我们可以看到 `--max_insert_block_size`. 找出可用的设置,它们意味着什么以及默认值的最简单方法是查询 `system.settings` 表: - -``` sql -SELECT name, value, changed, description -FROM system.settings -WHERE name LIKE '%max_insert_b%' -FORMAT TSV - -max_insert_block_size 1048576 0 "The maximum block size for insertion, if we control the creation of blocks for insertion." -``` - -您也可以 [OPTIMIZE](../sql_reference/statements/misc.md#misc_operations-optimize) 导入后的表。 使用MergeTree-family引擎配置的表总是在后台合并数据部分以优化数据存储(或至少检查是否有意义)。 这些查询强制表引擎立即进行存储优化,而不是稍后进行一段时间: - -``` bash -clickhouse-client --query "OPTIMIZE TABLE tutorial.hits_v1 FINAL" -clickhouse-client --query "OPTIMIZE TABLE tutorial.visits_v1 FINAL" -``` - -这些查询开始一个I/O和CPU密集型操作,所以如果表一直接收到新数据,最好不要管它,让合并在后台运行。 - -现在我们可以检查表导入是否成功: - -``` bash -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.hits_v1" -clickhouse-client --query "SELECT COUNT(*) FROM tutorial.visits_v1" -``` - -## 查询示例 {#example-queries} - -``` sql -SELECT - StartURL AS URL, - AVG(Duration) AS AvgDuration -FROM tutorial.visits_v1 -WHERE StartDate BETWEEN '2014-03-23' AND '2014-03-30' -GROUP BY URL -ORDER BY AvgDuration DESC -LIMIT 10 -``` - -``` sql -SELECT - sum(Sign) AS visits, - sumIf(Sign, has(Goals.ID, 1105530)) AS goal_visits, - (100. * goal_visits) / visits AS goal_percent -FROM tutorial.visits_v1 -WHERE (CounterID = 912887) AND (toYYYYMM(StartDate) = 201403) AND (domain(StartURL) = 'yandex.ru') -``` - -## 集群部署 {#cluster-deployment} - -ClickHouse集群是一个同质集群。 设置步骤: - -1. 在群集的所有计算机上安装ClickHouse服务器 -2. 在配置文件中设置群集配置 -3. 在每个实例上创建本地表 -4. 创建一个 [分布式表](../engines/table_engines/special/distributed.md) - -[分布式表](../engines/table_engines/special/distributed.md) 实际上是一种 “view” 到ClickHouse集群的本地表。 从分布式表中选择查询使用集群所有分片的资源执行。 您可以为多个集群指定configs,并创建多个分布式表,为不同的集群提供视图。 - -具有三个分片的集群的示例配置,每个分片一个副本: - -``` xml - - - - - example-perftest01j.yandex.ru - 9000 - - - - - example-perftest02j.yandex.ru - 9000 - - - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -为了进一步演示,让我们创建一个新的本地表 `CREATE TABLE` 我们用于查询 `hits_v1`,但不同的表名: - -``` sql -CREATE TABLE tutorial.hits_local (...) ENGINE = MergeTree() ... -``` - -创建提供集群本地表视图的分布式表: - -``` sql -CREATE TABLE tutorial.hits_all AS tutorial.hits_local -ENGINE = Distributed(perftest_3shards_1replicas, tutorial, hits_local, rand()); -``` - -常见的做法是在集群的所有计算机上创建类似的分布式表。 它允许在群集的任何计算机上运行分布式查询。 还有一个替代选项可以使用以下方法为给定的SELECT查询创建临时分布式表 [远程](../sql_reference/table_functions/remote.md) 表功能。 - -我们走吧 [INSERT SELECT](../sql_reference/statements/insert_into.md) 将该表传播到多个服务器。 - -``` sql -INSERT INTO tutorial.hits_all SELECT * FROM tutorial.hits_v1; -``` - -!!! warning "碌莽禄Notice:" - 这种方法不适合大型表的分片。 有一个单独的工具 [ツ环板-ョツ嘉ッツ偲](../operations/utilities/clickhouse-copier.md) 这可以重新分片任意大表。 - -正如您所期望的那样,如果计算量大的查询使用3台服务器而不是一个,则运行速度快N倍。 - -在这种情况下,我们使用了具有3个分片的集群,每个分片都包含一个副本。 - -为了在生产环境中提供弹性,我们建议每个分片应包含分布在多个可用区或数据中心(或至少机架)之间的2-3个副本。 请注意,ClickHouse支持无限数量的副本。 - -包含三个副本的一个分片集群的示例配置: - -``` xml - - ... - - - - example-perftest01j.yandex.ru - 9000 - - - example-perftest02j.yandex.ru - 9000 - - - example-perftest03j.yandex.ru - 9000 - - - - -``` - -启用本机复制 [动物园管理员](http://zookeeper.apache.org/) 是必需的。 ClickHouse负责所有副本的数据一致性,并在失败后自动运行恢复过程。 建议将ZooKeeper集群部署在单独的服务器上(其中没有其他进程,包括ClickHouse正在运行)。 - -!!! note "注" - ZooKeeper不是一个严格的requirement:在某些简单的情况下,您可以通过将数据写入应用程序代码中的所有副本来复制数据。 这种方法是 **不** 建议,在这种情况下,ClickHouse将无法保证所有副本上的数据一致性。 因此,它成为您的应用程序的责任。 - -ZooKeeper位置在配置文件中指定: - -``` xml - - - zoo01.yandex.ru - 2181 - - - zoo02.yandex.ru - 2181 - - - zoo03.yandex.ru - 2181 - - -``` - -此外,我们需要设置宏来识别每个用于创建表的分片和副本: - -``` xml - - 01 - 01 - -``` - -如果在创建复制表时没有副本,则会实例化新的第一个副本。 如果已有实时副本,则新副本将克隆现有副本中的数据。 您可以选择首先创建所有复制的表,然后向其中插入数据。 另一种选择是创建一些副本,并在数据插入之后或期间添加其他副本。 - -``` sql -CREATE TABLE tutorial.hits_replica (...) -ENGINE = ReplcatedMergeTree( - '/clickhouse_perftest/tables/{shard}/hits', - '{replica}' -) -... -``` - -在这里,我们使用 [ReplicatedMergeTree](../engines/table_engines/mergetree_family/replication.md) 表引擎。 在参数中,我们指定包含分片和副本标识符的ZooKeeper路径。 - -``` sql -INSERT INTO tutorial.hits_replica SELECT * FROM tutorial.hits_local; -``` - -复制在多主机模式下运行。 数据可以加载到任何副本中,然后系统会自动将其与其他实例同步。 复制是异步的,因此在给定时刻,并非所有副本都可能包含最近插入的数据。 至少应有一个副本允许数据摄取。 其他人将同步数据和修复一致性,一旦他们将再次变得活跃。 请注意,这种方法允许最近插入的数据丢失的可能性很低。 - -[原始文章](https://clickhouse.tech/docs/en/getting_started/tutorial/) diff --git a/docs/zh/guides/apply-catboost-model.md b/docs/zh/guides/apply-catboost-model.md new file mode 100644 index 00000000000..232860c86e0 --- /dev/null +++ b/docs/zh/guides/apply-catboost-model.md @@ -0,0 +1,239 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 41 +toc_title: "\u5E94\u7528CatBoost\u6A21\u578B" +--- + +# 在ClickHouse中应用Catboost模型 {#applying-catboost-model-in-clickhouse} + +[CatBoost](https://catboost.ai) 是一个自由和开源的梯度提升库开发 [Yandex](https://yandex.com/company/) 用于机器学习。 + +通过此指令,您将学习如何通过从SQL运行模型推理在ClickHouse中应用预先训练好的模型。 + +在ClickHouse中应用CatBoost模型: + +1. [创建表](#create-table). +2. [将数据插入到表中](#insert-data-to-table). +3. [碌莽禄into拢Integrate010-68520682\](#integrate-catboost-into-clickhouse) (可选步骤)。 +4. [从SQL运行模型推理](#run-model-inference). + +有关训练CatBoost模型的详细信息,请参阅 [培训和应用模型](https://catboost.ai/docs/features/training.html#training). + +## 先决条件 {#prerequisites} + +如果你没有 [Docker](https://docs.docker.com/install/) 然而,安装它。 + +!!! note "注" + [Docker](https://www.docker.com) 是一个软件平台,允许您创建容器,将CatBoost和ClickHouse安装与系统的其余部分隔离。 + +在应用CatBoost模型之前: + +**1.** 拉 [码头窗口映像](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) 从注册表: + +``` bash +$ docker pull yandex/tutorial-catboost-clickhouse +``` + +此Docker映像包含运行CatBoost和ClickHouse所需的所有内容:代码、运行时、库、环境变量和配置文件。 + +**2.** 确保已成功拉取Docker映像: + +``` bash +$ docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB +``` + +**3.** 基于此映像启动一个Docker容器: + +``` bash +$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse +``` + +## 1. 创建表 {#create-table} + +为训练样本创建ClickHouse表: + +**1.** 在交互模式下启动ClickHouse控制台客户端: + +``` bash +$ clickhouse client +``` + +!!! note "注" + ClickHouse服务器已经在Docker容器内运行。 + +**2.** 使用以下命令创建表: + +``` sql +:) CREATE TABLE amazon_train +( + date Date MATERIALIZED today(), + ACTION UInt8, + RESOURCE UInt32, + MGR_ID UInt32, + ROLE_ROLLUP_1 UInt32, + ROLE_ROLLUP_2 UInt32, + ROLE_DEPTNAME UInt32, + ROLE_TITLE UInt32, + ROLE_FAMILY_DESC UInt32, + ROLE_FAMILY UInt32, + ROLE_CODE UInt32 +) +ENGINE = MergeTree ORDER BY date +``` + +**3.** 从ClickHouse控制台客户端退出: + +``` sql +:) exit +``` + +## 2. 将数据插入到表中 {#insert-data-to-table} + +插入数据: + +**1.** 运行以下命令: + +``` bash +$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv +``` + +**2.** 在交互模式下启动ClickHouse控制台客户端: + +``` bash +$ clickhouse client +``` + +**3.** 确保数据已上传: + +``` sql +:) SELECT count() FROM amazon_train + +SELECT count() +FROM amazon_train + ++-count()-+ +| 65538 | ++-------+ +``` + +## 3. 碌莽禄into拢Integrate010-68520682\ {#integrate-catboost-into-clickhouse} + +!!! note "注" + **可选步骤。** Docker映像包含运行CatBoost和ClickHouse所需的所有内容。 + +碌莽禄to拢integrate010-68520682\: + +**1.** 构建评估库。 + +评估CatBoost模型的最快方法是编译 `libcatboostmodel.` 图书馆. 有关如何构建库的详细信息,请参阅 [CatBoost文件](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). + +**2.** 例如,在任何地方和任何名称创建一个新目录, `data` 并将创建的库放入其中。 Docker映像已经包含了库 `data/libcatboostmodel.so`. + +**3.** 例如,在任何地方和任何名称为config model创建一个新目录, `models`. + +**4.** 创建具有任意名称的模型配置文件,例如, `models/amazon_model.xml`. + +**5.** 描述模型配置: + +``` xml + + + + catboost + + amazon + + /home/catboost/tutorial/catboost_model.bin + + 0 + + +``` + +**6.** 将CatBoost的路径和模型配置添加到ClickHouse配置: + +``` xml + +/home/catboost/data/libcatboostmodel.so +/home/catboost/models/*_model.xml +``` + +## 4. 从SQL运行模型推理 {#run-model-inference} + +对于测试模型,运行ClickHouse客户端 `$ clickhouse client`. + +让我们确保模型正常工作: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) > 0 AS prediction, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "注" + 功能 [模型值](../sql-reference/functions/other-functions.md#function-modelevaluate) 返回带有多类模型的每类原始预测的元组。 + +让我们预测一下: + +``` sql +:) SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1 + exp(-prediction)) AS probability, + ACTION AS target +FROM amazon_train +LIMIT 10 +``` + +!!! note "注" + 更多信息 [exp()](../sql-reference/functions/math-functions.md) 功能。 + +让我们计算样本的LogLoss: + +``` sql +:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss +FROM +( + SELECT + modelEvaluate('amazon', + RESOURCE, + MGR_ID, + ROLE_ROLLUP_1, + ROLE_ROLLUP_2, + ROLE_DEPTNAME, + ROLE_TITLE, + ROLE_FAMILY_DESC, + ROLE_FAMILY, + ROLE_CODE) AS prediction, + 1. / (1. + exp(-prediction)) AS prob, + ACTION AS tg + FROM amazon_train +) +``` + +!!! note "注" + 更多信息 [avg()](../sql-reference/aggregate-functions/reference.md#agg_function-avg) 和 [日志()](../sql-reference/functions/math-functions.md) 功能。 + +[原始文章](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/zh/guides/apply_catboost_model.md b/docs/zh/guides/apply_catboost_model.md deleted file mode 100644 index 4ac7d926961..00000000000 --- a/docs/zh/guides/apply_catboost_model.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 41 -toc_title: "\u5E94\u7528CatBoost\u6A21\u578B" ---- - -# 在ClickHouse中应用Catboost模型 {#applying-catboost-model-in-clickhouse} - -[CatBoost](https://catboost.ai) 是一个自由和开源的梯度提升库开发 [Yandex](https://yandex.com/company/) 用于机器学习。 - -通过此指令,您将学习如何通过从SQL运行模型推理在ClickHouse中应用预先训练好的模型。 - -在ClickHouse中应用CatBoost模型: - -1. [创建表](#create-table). -2. [将数据插入到表中](#insert-data-to-table). -3. [碌莽禄into拢Integrate010-68520682\](#integrate-catboost-into-clickhouse) (可选步骤)。 -4. [从SQL运行模型推理](#run-model-inference). - -有关训练CatBoost模型的详细信息,请参阅 [培训和应用模型](https://catboost.ai/docs/features/training.html#training). - -## 先决条件 {#prerequisites} - -如果你没有 [Docker](https://docs.docker.com/install/) 然而,安装它。 - -!!! note "注" - [Docker](https://www.docker.com) 是一个软件平台,允许您创建容器,将CatBoost和ClickHouse安装与系统的其余部分隔离。 - -在应用CatBoost模型之前: - -**1.** 拉 [码头窗口映像](https://hub.docker.com/r/yandex/tutorial-catboost-clickhouse) 从注册表: - -``` bash -$ docker pull yandex/tutorial-catboost-clickhouse -``` - -此Docker映像包含运行CatBoost和ClickHouse所需的所有内容:代码、运行时、库、环境变量和配置文件。 - -**2.** 确保已成功拉取Docker映像: - -``` bash -$ docker image ls -REPOSITORY TAG IMAGE ID CREATED SIZE -yandex/tutorial-catboost-clickhouse latest 622e4d17945b 22 hours ago 1.37GB -``` - -**3.** 基于此映像启动一个Docker容器: - -``` bash -$ docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse -``` - -## 1. 创建表 {#create-table} - -为训练样本创建ClickHouse表: - -**1.** 在交互模式下启动ClickHouse控制台客户端: - -``` bash -$ clickhouse client -``` - -!!! note "注" - ClickHouse服务器已经在Docker容器内运行。 - -**2.** 使用以下命令创建表: - -``` sql -:) CREATE TABLE amazon_train -( - date Date MATERIALIZED today(), - ACTION UInt8, - RESOURCE UInt32, - MGR_ID UInt32, - ROLE_ROLLUP_1 UInt32, - ROLE_ROLLUP_2 UInt32, - ROLE_DEPTNAME UInt32, - ROLE_TITLE UInt32, - ROLE_FAMILY_DESC UInt32, - ROLE_FAMILY UInt32, - ROLE_CODE UInt32 -) -ENGINE = MergeTree ORDER BY date -``` - -**3.** 从ClickHouse控制台客户端退出: - -``` sql -:) exit -``` - -## 2. 将数据插入到表中 {#insert-data-to-table} - -插入数据: - -**1.** 运行以下命令: - -``` bash -$ clickhouse client --host 127.0.0.1 --query 'INSERT INTO amazon_train FORMAT CSVWithNames' < ~/amazon/train.csv -``` - -**2.** 在交互模式下启动ClickHouse控制台客户端: - -``` bash -$ clickhouse client -``` - -**3.** 确保数据已上传: - -``` sql -:) SELECT count() FROM amazon_train - -SELECT count() -FROM amazon_train - -+-count()-+ -| 65538 | -+-------+ -``` - -## 3. 碌莽禄into拢Integrate010-68520682\ {#integrate-catboost-into-clickhouse} - -!!! note "注" - **可选步骤。** Docker映像包含运行CatBoost和ClickHouse所需的所有内容。 - -碌莽禄to拢integrate010-68520682\: - -**1.** 构建评估库。 - -评估CatBoost模型的最快方法是编译 `libcatboostmodel.` 图书馆. 有关如何构建库的详细信息,请参阅 [CatBoost文件](https://catboost.ai/docs/concepts/c-plus-plus-api_dynamic-c-pluplus-wrapper.html). - -**2.** 例如,在任何地方和任何名称创建一个新目录, `data` 并将创建的库放入其中。 Docker映像已经包含了库 `data/libcatboostmodel.so`. - -**3.** 例如,在任何地方和任何名称为config model创建一个新目录, `models`. - -**4.** 创建具有任意名称的模型配置文件,例如, `models/amazon_model.xml`. - -**5.** 描述模型配置: - -``` xml - - - - catboost - - amazon - - /home/catboost/tutorial/catboost_model.bin - - 0 - - -``` - -**6.** 将CatBoost的路径和模型配置添加到ClickHouse配置: - -``` xml - -/home/catboost/data/libcatboostmodel.so -/home/catboost/models/*_model.xml -``` - -## 4. 从SQL运行模型推理 {#run-model-inference} - -对于测试模型,运行ClickHouse客户端 `$ clickhouse client`. - -让我们确保模型正常工作: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) > 0 AS prediction, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "注" - 功能 [模型值](../sql_reference/functions/other_functions.md#function-modelevaluate) 返回带有多类模型的每类原始预测的元组。 - -让我们预测一下: - -``` sql -:) SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1 + exp(-prediction)) AS probability, - ACTION AS target -FROM amazon_train -LIMIT 10 -``` - -!!! note "注" - 更多信息 [exp()](../sql_reference/functions/math_functions.md) 功能。 - -让我们计算样本的LogLoss: - -``` sql -:) SELECT -avg(tg * log(prob) + (1 - tg) * log(1 - prob)) AS logloss -FROM -( - SELECT - modelEvaluate('amazon', - RESOURCE, - MGR_ID, - ROLE_ROLLUP_1, - ROLE_ROLLUP_2, - ROLE_DEPTNAME, - ROLE_TITLE, - ROLE_FAMILY_DESC, - ROLE_FAMILY, - ROLE_CODE) AS prediction, - 1. / (1. + exp(-prediction)) AS prob, - ACTION AS tg - FROM amazon_train -) -``` - -!!! note "注" - 更多信息 [avg()](../sql_reference/aggregate_functions/reference.md#agg_function-avg) 和 [日志()](../sql_reference/functions/math_functions.md) 功能。 - -[原始文章](https://clickhouse.tech/docs/en/guides/apply_catboost_model/) diff --git a/docs/zh/guides/index.md b/docs/zh/guides/index.md index 00fe071434d..9f6afb5a384 100644 --- a/docs/zh/guides/index.md +++ b/docs/zh/guides/index.md @@ -10,7 +10,7 @@ toc_title: "\u6982\u8FF0" 详细的一步一步的说明,帮助解决使用ClickHouse的各种任务列表: -- [简单集群设置教程](../getting_started/tutorial.md) -- [在ClickHouse中应用CatBoost模型](apply_catboost_model.md) +- [简单集群设置教程](../getting-started/tutorial.md) +- [在ClickHouse中应用CatBoost模型](apply-catboost-model.md) [原始文章](https://clickhouse.tech/docs/en/guides/) diff --git a/docs/zh/images/column_oriented.gif b/docs/zh/images/column-oriented.gif similarity index 100% rename from docs/zh/images/column_oriented.gif rename to docs/zh/images/column-oriented.gif diff --git a/docs/zh/images/logo.svg b/docs/zh/images/logo.svg index b5ab923ff65..17da9417e2d 100644 --- a/docs/zh/images/logo.svg +++ b/docs/zh/images/logo.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/docs/zh/images/row_oriented.gif b/docs/zh/images/row-oriented.gif similarity index 100% rename from docs/zh/images/row_oriented.gif rename to docs/zh/images/row-oriented.gif diff --git a/docs/zh/index.md b/docs/zh/index.md index c6cc5069b14..522affa6250 100644 --- a/docs/zh/index.md +++ b/docs/zh/index.md @@ -60,11 +60,11 @@ ClickHouse是一个用于联机分析(OLAP)的列式数据库管理系统(DBMS) **行式** -![Row oriented](images/row_oriented.gif#) +![Row oriented](images/row-oriented.gif#) **列式** -![Column oriented](images/column_oriented.gif#) +![Column oriented](images/column-oriented.gif#) 看到差别了么?下面将详细介绍为什么会发生这种情况。 diff --git a/docs/zh/interfaces/cli.md b/docs/zh/interfaces/cli.md index fef8e404aef..fd777df9172 100644 --- a/docs/zh/interfaces/cli.md +++ b/docs/zh/interfaces/cli.md @@ -1,4 +1,3 @@ - # 命令行客户端 {#ming-ling-xing-ke-hu-duan} 通过命令行来访问 ClickHouse,您可以使用 `clickhouse-client` @@ -62,7 +61,7 @@ cat file.csv | clickhouse-client --database=test --query="INSERT INTO test FORMA 您可以通过 Ctrl+C 来取消一个长时间的查询。然而,您依然需要等待服务端来中止请求。在某个阶段去取消查询是不可能的。如果您不等待并再次按下 Ctrl + C,客户端将会退出。 -命令行客户端允许通过外部数据 (外部临时表) 来查询。更多相关信息,请参考 «[外部数据查询处理](../engines/table_engines/special/external_data.md)». +命令行客户端允许通过外部数据 (外部临时表) 来查询。更多相关信息,请参考 «[外部数据查询处理](../engines/table-engines/special/external-data.md)». ## 配置 {#interfaces_cli_configuration} diff --git a/docs/zh/interfaces/cpp.md b/docs/zh/interfaces/cpp.md index 4aa4f15a456..97914c37164 100644 --- a/docs/zh/interfaces/cpp.md +++ b/docs/zh/interfaces/cpp.md @@ -1,4 +1,3 @@ - # C ++客户端库 {#c-ke-hu-duan-ku} 请参阅以下网站的自述文件[ツ暗ェツ氾环催ツ団](https://github.com/ClickHouse/clickhouse-cpp)资料库。 diff --git a/docs/zh/interfaces/formats.md b/docs/zh/interfaces/formats.md index 64c1940df86..af514503442 100644 --- a/docs/zh/interfaces/formats.md +++ b/docs/zh/interfaces/formats.md @@ -1,4 +1,3 @@ - # 输入输出格式 {#formats} ClickHouse 可以接受多种数据格式,可以在 (`INSERT`) 以及 (`SELECT`) 请求中使用。 @@ -71,7 +70,7 @@ SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORD 整数以十进制形式写入。数字在开头可以包含额外的 `+` 字符(解析时忽略,格式化时不记录)。非负数不能包含负号。 读取时,允许将空字符串解析为零,或者(对于带符号的类型)将仅包含负号的字符串解析为零。 不符合相应数据类型的数字可能会被解析为不同的数字,而不会显示错误消息。 -浮点数以十进制形式写入。点号用作小数点分隔符。支持指数等符号,如'inf',‘+ inf’,‘-inf’和’nan’。 浮点数的输入可以以小数点开始或结束。 +浮点数以十进制形式写入。点号用作小数点分隔符。支持指数等符号,如’inf’,‘+ inf’,‘-inf’和’nan’。 浮点数的输入可以以小数点开始或结束。 格式化的时候,浮点数的精确度可能会丢失。 解析的时候,没有严格需要去读取与机器可以表示的最接近的数值。 @@ -97,7 +96,7 @@ SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORD 数组写在方括号内的逗号分隔值列表中。 通常情况下,数组中的数字项目会被拼凑,但日期,带时间的日期以及字符串将使用与上面相同的转义规则用单引号引起来。 -[NULL](../sql_reference/syntax.md) 将输出为 `\N`。 +[NULL](../sql-reference/syntax.md) 将输出为 `\N`。 ## TabSeparatedRaw {#tabseparatedraw} @@ -255,7 +254,7 @@ format_schema_rows_between_delimiter = ',' SearchPhrase=curtain designs count()=1064 SearchPhrase=baku count()=1000 -[NULL](../sql_reference/syntax.md) 输出为 `\N`。 +[NULL](../sql-reference/syntax.md) 输出为 `\N`。 ``` sql SELECT * FROM t_null FORMAT TSKV @@ -379,7 +378,7 @@ JSON 与 JavaScript 兼容。为了确保这一点,一些字符被另外转义 该格式仅适用于输出查询结果,但不适用于解析输入(将数据插入到表中)。 -ClickHouse 支持 [NULL](../sql_reference/syntax.md), 在 JSON 格式中以 `null` 输出来表示. +ClickHouse 支持 [NULL](../sql-reference/syntax.md), 在 JSON 格式中以 `null` 输出来表示. 参考 JSONEachRow 格式。 @@ -452,7 +451,7 @@ ClickHouse 支持 [NULL](../sql_reference/syntax.md), 在 JSON 格式中以 `nul ### 嵌套结构的使用 {#jsoneachrow-nested} -如果你有一张桌子 [嵌套式](../sql_reference/data_types/nested_data_structures/nested.md) 数据类型列,可以插入具有相同结构的JSON数据。 启用此功能与 [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) 设置。 +如果你有一张桌子 [嵌套式](../sql-reference/data-types/nested-data-structures/nested.md) 数据类型列,可以插入具有相同结构的JSON数据。 启用此功能与 [input\_format\_import\_nested\_json](../operations/settings/settings.md#settings-input_format_import_nested_json) 设置。 例如,请考虑下表: @@ -526,7 +525,7 @@ SELECT * FROM json_each_row_nested 它会绘制一个完整的表格,每行数据在终端中占用两行。 每一个结果块都会以单独的表格输出。这是很有必要的,以便结果块不用缓冲结果输出(缓冲在可以预见结果集宽度的时候是很有必要的)。 -[NULL](../sql_reference/syntax.md) 输出为 `ᴺᵁᴸᴸ`。 +[NULL](../sql-reference/syntax.md) 输出为 `ᴺᵁᴸᴸ`。 ``` sql SELECT * FROM t_null @@ -611,7 +610,7 @@ FixedString 被简单地表示为一个字节序列。 数组表示为 varint 长度(无符号 [LEB128](https://en.wikipedia.org/wiki/LEB128)),后跟有序的数组元素。 -对于 [NULL](../sql_reference/syntax.md#null-literal) 的支持, 一个为 1 或 0 的字节会加在每个 [可为空](../sql_reference/data_types/nullable.md) 值前面。如果为 1, 那么该值就是 `NULL`。 如果为 0,则不为 `NULL`。 +对于 [NULL](../sql-reference/syntax.md#null-literal) 的支持, 一个为 1 或 0 的字节会加在每个 [可为空](../sql-reference/data-types/nullable.md) 值前面。如果为 1, 那么该值就是 `NULL`。 如果为 0,则不为 `NULL`。 ## RowBinaryWithNamesAndTypes {#rowbinarywithnamesandtypes} @@ -623,7 +622,7 @@ FixedString 被简单地表示为一个字节序列。 ## 值 {#data-format-values} -在括号中打印每一行。行由逗号分隔。最后一行之后没有逗号。括号内的值也用逗号分隔。数字以十进制格式输出,不含引号。 数组以方括号输出。带有时间的字符串,日期和时间用引号包围输出。转义字符的解析规则与 [TabSeparated](#tabseparated) 格式类似。 在格式化过程中,不插入额外的空格,但在解析过程中,空格是被允许并跳过的(除了数组值之外的空格,这是不允许的)。[NULL](../sql_reference/syntax.md) 为 `NULL`。 +在括号中打印每一行。行由逗号分隔。最后一行之后没有逗号。括号内的值也用逗号分隔。数字以十进制格式输出,不含引号。 数组以方括号输出。带有时间的字符串,日期和时间用引号包围输出。转义字符的解析规则与 [TabSeparated](#tabseparated) 格式类似。 在格式化过程中,不插入额外的空格,但在解析过程中,空格是被允许并跳过的(除了数组值之外的空格,这是不允许的)。[NULL](../sql-reference/syntax.md) 为 `NULL`。 以 Values 格式传递数据时需要转义的最小字符集是:单引号和反斜线。 @@ -633,7 +632,7 @@ FixedString 被简单地表示为一个字节序列。 使用指定的列名在单独的行上打印每个值。如果每行都包含大量列,则此格式便于打印一行或几行。 -[NULL](../sql_reference/syntax.md) 输出为 `ᴺᵁᴸᴸ`。 +[NULL](../sql-reference/syntax.md) 输出为 `ᴺᵁᴸᴸ`。 示例: @@ -748,9 +747,9 @@ SELECT * FROM t_null FORMAT Vertical ## CapnProto {#capnproto} -Cap'n Proto 是一种二进制消息格式,类似 Protocol Buffers 和 Thriftis,但与 JSON 或 MessagePack 格式不一样。 +Cap’n Proto 是一种二进制消息格式,类似 Protocol Buffers 和 Thriftis,但与 JSON 或 MessagePack 格式不一样。 -Cap'n Proto 消息格式是严格类型的,而不是自我描述,这意味着它们不需要外部的描述。这种格式可以实时地应用,并针对每个查询进行缓存。 +Cap’n Proto 消息格式是严格类型的,而不是自我描述,这意味着它们不需要外部的描述。这种格式可以实时地应用,并针对每个查询进行缓存。 ``` sql SELECT SearchPhrase, count() AS c FROM test.hits @@ -764,9 +763,9 @@ SELECT SearchPhrase, count() AS c FROM test.hits c @1 :Uint64; } -格式文件存储的目录可以在服务配置中的 [format\_schema\_path](../operations/server_configuration_parameters/settings.md) 指定。 +格式文件存储的目录可以在服务配置中的 [format\_schema\_path](../operations/server-configuration-parameters/settings.md) 指定。 -Cap'n Proto 反序列化是很高效的,通常不会增加系统的负载。 +Cap’n Proto 反序列化是很高效的,通常不会增加系统的负载。 ## Protobuf {#protobuf} @@ -817,7 +816,7 @@ message MessageType { ``` ClickHouse尝试找到一个名为 `x.y.z` (或 `x_y_z` 或 `X.y_Z` 等)。 -嵌套消息适用于输入或输出一个 [嵌套数据结构](../sql_reference/data_types/nested_data_structures/nested.md). +嵌套消息适用于输入或输出一个 [嵌套数据结构](../sql-reference/data-types/nested-data-structures/nested.md). 在protobuf模式中定义的默认值,如下所示 @@ -829,7 +828,7 @@ message MessageType { } ``` -不应用;该 [表默认值](../sql_reference/statements/create.md#create-default-values) 用来代替它们。 +不应用;该 [表默认值](../sql-reference/statements/create.md#create-default-values) 用来代替它们。 ClickHouse在输入和输出protobuf消息 `length-delimited` 格式。 这意味着每个消息之前,应该写它的长度作为一个 [varint](https://developers.google.com/protocol-buffers/docs/encoding#varints). @@ -843,23 +842,23 @@ ClickHouse Avro格式支持读取和写入 [Avro数据文件](http://avro.apache ### 数据类型匹配{\#sql\_reference/data\_types-matching} {#data-types-matching-sql_referencedata_types-matching} -下表显示了支持的数据类型以及它们如何匹配ClickHouse [数据类型](../sql_reference/data_types/index.md) 在 `INSERT` 和 `SELECT` 查询。 +下表显示了支持的数据类型以及它们如何匹配ClickHouse [数据类型](../sql-reference/data-types/index.md) 在 `INSERT` 和 `SELECT` 查询。 | Avro数据类型 `INSERT` | ClickHouse数据类型 | Avro数据类型 `SELECT` | |---------------------------------------------|-------------------------------------------------------------------------------------------------------------------|------------------------------| -| `boolean`, `int`, `long`, `float`, `double` | [Int(8/16/32)](../sql_reference/data_types/int_uint.md), [UInt(8/16/32)](../sql_reference/data_types/int_uint.md) | `int` | -| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql_reference/data_types/int_uint.md), [UInt64](../sql_reference/data_types/int_uint.md) | `long` | -| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql_reference/data_types/float.md) | `float` | -| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql_reference/data_types/float.md) | `double` | -| `bytes`, `string`, `fixed`, `enum` | [字符串](../sql_reference/data_types/string.md) | `bytes` | -| `bytes`, `string`, `fixed` | [固定字符串(N)](../sql_reference/data_types/fixedstring.md) | `fixed(N)` | -| `enum` | [枚举(8/16)](../sql_reference/data_types/enum.md) | `enum` | -| `array(T)` | [阵列(T)](../sql_reference/data_types/array.md) | `array(T)` | -| `union(null, T)`, `union(T, null)` | [可为空(T)](../sql_reference/data_types/date.md) | `union(null, T)` | -| `null` | [可为空(无)](../sql_reference/data_types/special_data_types/nothing.md) | `null` | -| `int (date)` \* | [日期](../sql_reference/data_types/date.md) | `int (date)` \* | -| `long (timestamp-millis)` \* | [DateTime64(3)](../sql_reference/data_types/datetime.md) | `long (timestamp-millis)` \* | -| `long (timestamp-micros)` \* | [DateTime64(6)](../sql_reference/data_types/datetime.md) | `long (timestamp-micros)` \* | +| `boolean`, `int`, `long`, `float`, `double` | [Int(8/16/32)](../sql-reference/data-types/int-uint.md), [UInt(8/16/32)](../sql-reference/data-types/int-uint.md) | `int` | +| `boolean`, `int`, `long`, `float`, `double` | [Int64](../sql-reference/data-types/int-uint.md), [UInt64](../sql-reference/data-types/int-uint.md) | `long` | +| `boolean`, `int`, `long`, `float`, `double` | [Float32](../sql-reference/data-types/float.md) | `float` | +| `boolean`, `int`, `long`, `float`, `double` | [Float64](../sql-reference/data-types/float.md) | `double` | +| `bytes`, `string`, `fixed`, `enum` | [字符串](../sql-reference/data-types/string.md) | `bytes` | +| `bytes`, `string`, `fixed` | [固定字符串(N)](../sql-reference/data-types/fixedstring.md) | `fixed(N)` | +| `enum` | [枚举(8/16)](../sql-reference/data-types/enum.md) | `enum` | +| `array(T)` | [阵列(T)](../sql-reference/data-types/array.md) | `array(T)` | +| `union(null, T)`, `union(T, null)` | [可为空(T)](../sql-reference/data-types/date.md) | `union(null, T)` | +| `null` | [可为空(无)](../sql-reference/data-types/special-data-types/nothing.md) | `null` | +| `int (date)` \* | [日期](../sql-reference/data-types/date.md) | `int (date)` \* | +| `long (timestamp-millis)` \* | [DateTime64(3)](../sql-reference/data-types/datetime.md) | `long (timestamp-millis)` \* | +| `long (timestamp-micros)` \* | [DateTime64(6)](../sql-reference/data-types/datetime.md) | `long (timestamp-micros)` \* | \* [Avro逻辑类型](http://avro.apache.org/docs/current/spec.html#Logical+Types) @@ -922,7 +921,7 @@ $ kafkacat -b kafka-broker -C -t topic1 -o beginning -f '%s' -c 3 | clickhouse- 3 c ``` -使用 `AvroConfluent` 与 [卡夫卡](../engines/table_engines/integrations/kafka.md): +使用 `AvroConfluent` 与 [卡夫卡](../engines/table-engines/integrations/kafka.md): ``` sql CREATE TABLE topic1_stream @@ -951,25 +950,25 @@ SELECT * FROM topic1_stream; ### 数据类型匹配{\#sql\_reference/data\_types-matching-2} {#data-types-matching-sql_referencedata_types-matching-2} -下表显示了支持的数据类型以及它们如何匹配ClickHouse [数据类型](../sql_reference/data_types/index.md) 在 `INSERT` 和 `SELECT` 查询。 +下表显示了支持的数据类型以及它们如何匹配ClickHouse [数据类型](../sql-reference/data-types/index.md) 在 `INSERT` 和 `SELECT` 查询。 | Parquet数据类型 (`INSERT`) | ClickHouse数据类型 | Parquet数据类型 (`SELECT`) | |----------------------------|----------------------------------------------------------|----------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | `UINT8` | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | `INT8` | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | `UINT16` | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | `INT16` | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | `UINT32` | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | `INT32` | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | `UINT64` | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | `INT64` | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | `FLOAT` | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | `DOUBLE` | -| `DATE32` | [日期](../sql_reference/data_types/date.md) | `UINT16` | -| `DATE64`, `TIMESTAMP` | [日期时间](../sql_reference/data_types/datetime.md) | `UINT32` | -| `STRING`, `BINARY` | [字符串](../sql_reference/data_types/string.md) | `STRING` | -| — | [固定字符串](../sql_reference/data_types/fixedstring.md) | `STRING` | -| `DECIMAL` | [十进制](../sql_reference/data_types/decimal.md) | `DECIMAL` | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | `UINT8` | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | `INT8` | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | `UINT16` | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | `INT16` | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | `UINT32` | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | `INT32` | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | `UINT64` | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | `INT64` | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | `FLOAT` | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | `DOUBLE` | +| `DATE32` | [日期](../sql-reference/data-types/date.md) | `UINT16` | +| `DATE64`, `TIMESTAMP` | [日期时间](../sql-reference/data-types/datetime.md) | `UINT32` | +| `STRING`, `BINARY` | [字符串](../sql-reference/data-types/string.md) | `STRING` | +| — | [固定字符串](../sql-reference/data-types/fixedstring.md) | `STRING` | +| `DECIMAL` | [十进制](../sql-reference/data-types/decimal.md) | `DECIMAL` | ClickHouse支持可配置的精度 `Decimal` 类型。 该 `INSERT` 查询对待实木复合地板 `DECIMAL` 键入为ClickHouse `Decimal128` 类型。 @@ -991,7 +990,7 @@ $ cat {filename} | clickhouse-client --query="INSERT INTO {some_table} FORMAT Pa $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_file.pq} ``` -要与Hadoop交换数据,您可以使用 [HDFS表引擎](../engines/table_engines/integrations/hdfs.md). +要与Hadoop交换数据,您可以使用 [HDFS表引擎](../engines/table-engines/integrations/hdfs.md). ## ORC {#data-format-orc} @@ -999,24 +998,24 @@ $ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Parquet" > {some_ ### 数据类型匹配{\#sql\_reference/data\_types-matching-3} {#data-types-matching-sql_referencedata_types-matching-3} -下表显示了支持的数据类型以及它们如何匹配ClickHouse [数据类型](../sql_reference/data_types/index.md) 在 `INSERT` 查询。 +下表显示了支持的数据类型以及它们如何匹配ClickHouse [数据类型](../sql-reference/data-types/index.md) 在 `INSERT` 查询。 | ORC数据类型 (`INSERT`) | ClickHouse数据类型 | |------------------------|-----------------------------------------------------| -| `UINT8`, `BOOL` | [UInt8](../sql_reference/data_types/int_uint.md) | -| `INT8` | [Int8](../sql_reference/data_types/int_uint.md) | -| `UINT16` | [UInt16](../sql_reference/data_types/int_uint.md) | -| `INT16` | [Int16](../sql_reference/data_types/int_uint.md) | -| `UINT32` | [UInt32](../sql_reference/data_types/int_uint.md) | -| `INT32` | [Int32](../sql_reference/data_types/int_uint.md) | -| `UINT64` | [UInt64](../sql_reference/data_types/int_uint.md) | -| `INT64` | [Int64](../sql_reference/data_types/int_uint.md) | -| `FLOAT`, `HALF_FLOAT` | [Float32](../sql_reference/data_types/float.md) | -| `DOUBLE` | [Float64](../sql_reference/data_types/float.md) | -| `DATE32` | [日期](../sql_reference/data_types/date.md) | -| `DATE64`, `TIMESTAMP` | [日期时间](../sql_reference/data_types/datetime.md) | -| `STRING`, `BINARY` | [字符串](../sql_reference/data_types/string.md) | -| `DECIMAL` | [十进制](../sql_reference/data_types/decimal.md) | +| `UINT8`, `BOOL` | [UInt8](../sql-reference/data-types/int-uint.md) | +| `INT8` | [Int8](../sql-reference/data-types/int-uint.md) | +| `UINT16` | [UInt16](../sql-reference/data-types/int-uint.md) | +| `INT16` | [Int16](../sql-reference/data-types/int-uint.md) | +| `UINT32` | [UInt32](../sql-reference/data-types/int-uint.md) | +| `INT32` | [Int32](../sql-reference/data-types/int-uint.md) | +| `UINT64` | [UInt64](../sql-reference/data-types/int-uint.md) | +| `INT64` | [Int64](../sql-reference/data-types/int-uint.md) | +| `FLOAT`, `HALF_FLOAT` | [Float32](../sql-reference/data-types/float.md) | +| `DOUBLE` | [Float64](../sql-reference/data-types/float.md) | +| `DATE32` | [日期](../sql-reference/data-types/date.md) | +| `DATE64`, `TIMESTAMP` | [日期时间](../sql-reference/data-types/datetime.md) | +| `STRING`, `BINARY` | [字符串](../sql-reference/data-types/string.md) | +| `DECIMAL` | [十进制](../sql-reference/data-types/decimal.md) | ClickHouse支持的可配置精度 `Decimal` 类型。 该 `INSERT` 查询对待兽人 `DECIMAL` 键入为ClickHouse `Decimal128` 类型。 @@ -1032,7 +1031,7 @@ ClickHouse表列的数据类型不必匹配相应的ORC数据字段。 插入数 $ cat filename.orc | clickhouse-client --query="INSERT INTO some_table FORMAT ORC" ``` -要与Hadoop交换数据,您可以使用 [HDFS表引擎](../engines/table_engines/integrations/hdfs.md). +要与Hadoop交换数据,您可以使用 [HDFS表引擎](../engines/table-engines/integrations/hdfs.md). ## 格式架构 {#formatschema} @@ -1048,7 +1047,7 @@ e.g. `schemafile.proto:MessageType`. 如果在批处理模式下使用客户端,则由于安全原因,架构的路径必须是相对的。 如果您通过输入或输出数据 [HTTP接口](../interfaces/http.md) 格式架构中指定的文件名 -应该位于指定的目录中 [format\_schema\_path](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-format_schema_path) +应该位于指定的目录中 [format\_schema\_path](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-format_schema_path) 在服务器配置中。 [原始文章](https://clickhouse.tech/docs/en/interfaces/formats/) diff --git a/docs/zh/interfaces/http.md b/docs/zh/interfaces/http.md index ca8a9076fba..0fecb1873db 100644 --- a/docs/zh/interfaces/http.md +++ b/docs/zh/interfaces/http.md @@ -1,4 +1,3 @@ - # HTTP 客户端 {#http-ke-hu-duan} HTTP 接口可以让你通过任何平台和编程语言来使用 ClickHouse。我们用 Java 和 Perl 以及 shell 脚本来访问它。在其他的部门中,HTTP 接口会用在 Perl,Python 以及 Go 中。HTTP 接口比 TCP 原生接口更为局限,但是却有更好的兼容性。 @@ -201,7 +200,7 @@ $ echo 'SELECT number FROM system.numbers LIMIT 10' | curl 'http://localhost:812 可选的 `quota_key` 参数可能当做 quota key 传入(或者任何字符串)。更多信息,参见 «[配额](../operations/quotas.md#quotas)» 部分。 -HTTP 接口允许传入额外的数据(外部临时表)来查询。更多信息,参见 «[外部数据查询处理](../engines/table_engines/special/external_data.md)» 部分。 +HTTP 接口允许传入额外的数据(外部临时表)来查询。更多信息,参见 «[外部数据查询处理](../engines/table-engines/special/external-data.md)» 部分。 ## 响应缓冲 {#xiang-ying-huan-chong} diff --git a/docs/zh/interfaces/index.md b/docs/zh/interfaces/index.md index a4131e833e7..8dd8e38b34c 100644 --- a/docs/zh/interfaces/index.md +++ b/docs/zh/interfaces/index.md @@ -1,4 +1,3 @@ - # 客户端 {#interfaces} ClickHouse提供了两个网络接口(两者都可以选择包装在TLS中以提高安全性): @@ -13,7 +12,7 @@ ClickHouse提供了两个网络接口(两者都可以选择包装在TLS中以 \* [C++客户端库](cpp.md) 还有许多第三方库可供使用ClickHouse: -\* [客户端库](third-party/client_libraries.md) +\* [客户端库](third-party/client-libraries.md) \* [集成](third-party/integrations.md) \* [可视界面](third-party/gui.md) diff --git a/docs/zh/interfaces/jdbc.md b/docs/zh/interfaces/jdbc.md index 932ab53b9af..93bbc7487be 100644 --- a/docs/zh/interfaces/jdbc.md +++ b/docs/zh/interfaces/jdbc.md @@ -1,9 +1,8 @@ - # JDBC 驱动 {#jdbc-qu-dong} - **[官方JDBC 的驱动](https://github.com/ClickHouse/clickhouse-jdbc)** - 三方提供的 JDBC 驱动: - - [掳胫--禄脢鹿脷露胫鲁隆鹿--酶](https://github.com/housepower/ClickHouse-Native-JDBC) + - [掳胫–禄脢鹿脷露胫鲁隆鹿–酶](https://github.com/housepower/ClickHouse-Native-JDBC) - [clickhouse4j](https://github.com/blynkkk/clickhouse4j) [来源文章](https://clickhouse.tech/docs/zh/interfaces/jdbc/) diff --git a/docs/zh/interfaces/mysql.md b/docs/zh/interfaces/mysql.md index 8996ad6ae6f..5587656137c 100644 --- a/docs/zh/interfaces/mysql.md +++ b/docs/zh/interfaces/mysql.md @@ -7,7 +7,7 @@ toc_title: "MySQL\u63A5\u53E3" # MySQL接口 {#mysql-interface} -ClickHouse支持MySQL线协议。 它可以通过启用 [mysql\_port](../operations/server_configuration_parameters/settings.md#server_configuration_parameters-mysql_port) 在配置文件中设置: +ClickHouse支持MySQL线协议。 它可以通过启用 [mysql\_port](../operations/server-configuration-parameters/settings.md#server_configuration_parameters-mysql_port) 在配置文件中设置: ``` xml 9004 @@ -37,8 +37,8 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -为了与所有MySQL客户端兼容,建议使用以下命令指定用户密码 [双SHA1](../operations/settings/settings_users.md#password_double_sha1_hex) 在配置文件中。 -如果使用用户密码指定 [SHA256](../operations/settings/settings_users.md#password_sha256_hex),一些客户端将无法进行身份验证(mysqljs和旧版本的命令行工具mysql)。 +为了与所有MySQL客户端兼容,建议使用以下命令指定用户密码 [双SHA1](../operations/settings/settings-users.md#password_double_sha1_hex) 在配置文件中。 +如果使用用户密码指定 [SHA256](../operations/settings/settings-users.md#password_sha256_hex),一些客户端将无法进行身份验证(mysqljs和旧版本的命令行工具mysql)。 限制: diff --git a/docs/zh/interfaces/odbc.md b/docs/zh/interfaces/odbc.md index 5cba3a499f1..b45c54f8507 100644 --- a/docs/zh/interfaces/odbc.md +++ b/docs/zh/interfaces/odbc.md @@ -1,4 +1,3 @@ - # ODBC 驱动 {#odbc-qu-dong} - ClickHouse官方有 ODBC 的驱动。 见 [这里](https://github.com/ClickHouse/clickhouse-odbc)。 diff --git a/docs/zh/interfaces/tcp.md b/docs/zh/interfaces/tcp.md index b926a63c476..b783a8c3959 100644 --- a/docs/zh/interfaces/tcp.md +++ b/docs/zh/interfaces/tcp.md @@ -1,4 +1,3 @@ - # 原生客户端接口(TCP) {#yuan-sheng-ke-hu-duan-jie-kou-tcp} 本机协议用于 [命令行客户端](cli.md),用于分布式查询处理期间的服务器间通信,以及其他C ++程序。 不幸的是,本机ClickHouse协议还没有正式的规范,但它可以从ClickHouse源代码进行逆向工程 [从这里开始](https://github.com/ClickHouse/ClickHouse/tree/master/src/Client))和/或拦截和分析TCP流量。 diff --git a/docs/zh/interfaces/third-party/client-libraries.md b/docs/zh/interfaces/third-party/client-libraries.md new file mode 100644 index 00000000000..007bc986452 --- /dev/null +++ b/docs/zh/interfaces/third-party/client-libraries.md @@ -0,0 +1,50 @@ +# 第三方开发的库 {#di-san-fang-kai-fa-de-ku} + +!!! warning "放弃" + Yandex不维护下面列出的库,也没有进行任何广泛的测试以确保其质量。 + +- Python + - [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm) + - [ツ环板driverョツ嘉ッツ偲](https://github.com/mymarilyn/clickhouse-driver) + - [ツ环板clientョツ嘉ッツ偲](https://github.com/yurial/clickhouse-client) +- PHP + - [smi2/phpclickhouse](https://packagist.org/packages/smi2/phpClickHouse) + - [8bitov/clickhouse-php客户端](https://packagist.org/packages/8bitov/clickhouse-php-client) + - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://packagist.org/packages/bozerkins/clickhouse-client) + - [ツ环板clientョツ嘉ッツ偲](https://packagist.org/packages/simpod/clickhouse-client) + - [seva-code/php-click-house-client](https://packagist.org/packages/seva-code/php-click-house-client) + - [ツ环板clientョツ嘉ッツ偲](https://github.com/SeasX/SeasClick) +- 走吧 + - [clickhouse](https://github.com/kshvakov/clickhouse/) + - [ツ环板-ョツ嘉ッツ偲](https://github.com/roistat/go-clickhouse) + - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://github.com/mailru/go-clickhouse) + - [golang-clickhouse](https://github.com/leprosus/golang-clickhouse) +- NodeJs + - [ツ暗ェツ氾环催ツ団ツ法ツ人)](https://github.com/TimonKK/clickhouse) + - [ツ环板-ョツ嘉ッツ偲](https://github.com/apla/node-clickhouse) +- Perl + - [perl-DBD-ClickHouse](https://github.com/elcamlost/perl-DBD-ClickHouse) + - [HTTP-ClickHouse](https://metacpan.org/release/HTTP-ClickHouse) + - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://metacpan.org/release/AnyEvent-ClickHouse) +- Ruby + - [ツ暗ェツ氾环催ツ団)](https://github.com/shlima/click_house) + - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://github.com/PNixx/clickhouse-activerecord) +- R + - [clickhouse-r](https://github.com/hannesmuehleisen/clickhouse-r) + - [RClickhouse](https://github.com/IMSMWU/RClickhouse) +- Java + - [clickhouse-client-java](https://github.com/VirtusAI/clickhouse-client-java) +- 斯卡拉 + - [掳胫client-禄脢鹿脷露胫鲁隆鹿-client酶](https://github.com/crobox/clickhouse-scala-client) +- Kotlin + - [AORM](https://github.com/TanVD/AORM) +- C\# + - [克莱克豪斯Ado](https://github.com/killwort/ClickHouse-Net) + - [ClickHouse.Net](https://github.com/ilyabreev/ClickHouse.Net) + - [克莱克豪斯客户](https://github.com/DarkWanderer/ClickHouse.Client) +- 仙丹 + - [clickhousex](https://github.com/appodeal/clickhousex/) +- 尼姆 + - [nim-clickhouse](https://github.com/leonardoce/nim-clickhouse) + +[来源文章](https://clickhouse.tech/docs/zh/interfaces/third-party/client_libraries/) diff --git a/docs/zh/interfaces/third-party/client_libraries.md b/docs/zh/interfaces/third-party/client_libraries.md deleted file mode 100644 index 8e48bb8735e..00000000000 --- a/docs/zh/interfaces/third-party/client_libraries.md +++ /dev/null @@ -1,51 +0,0 @@ - -# 第三方开发的库 {#di-san-fang-kai-fa-de-ku} - -!!! warning "放弃" - Yandex不维护下面列出的库,也没有进行任何广泛的测试以确保其质量。 - -- Python - - [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm) - - [ツ环板driverョツ嘉ッツ偲](https://github.com/mymarilyn/clickhouse-driver) - - [ツ环板clientョツ嘉ッツ偲](https://github.com/yurial/clickhouse-client) -- PHP - - [smi2/phpclickhouse](https://packagist.org/packages/smi2/phpClickHouse) - - [8bitov/clickhouse-php客户端](https://packagist.org/packages/8bitov/clickhouse-php-client) - - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://packagist.org/packages/bozerkins/clickhouse-client) - - [ツ环板clientョツ嘉ッツ偲](https://packagist.org/packages/simpod/clickhouse-client) - - [seva-code/php-click-house-client](https://packagist.org/packages/seva-code/php-click-house-client) - - [ツ环板clientョツ嘉ッツ偲](https://github.com/SeasX/SeasClick) -- 走吧 - - [clickhouse](https://github.com/kshvakov/clickhouse/) - - [ツ环板-ョツ嘉ッツ偲](https://github.com/roistat/go-clickhouse) - - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://github.com/mailru/go-clickhouse) - - [golang-clickhouse](https://github.com/leprosus/golang-clickhouse) -- NodeJs - - [ツ暗ェツ氾环催ツ団ツ法ツ人)](https://github.com/TimonKK/clickhouse) - - [ツ环板-ョツ嘉ッツ偲](https://github.com/apla/node-clickhouse) -- Perl - - [perl-DBD-ClickHouse](https://github.com/elcamlost/perl-DBD-ClickHouse) - - [HTTP-ClickHouse](https://metacpan.org/release/HTTP-ClickHouse) - - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://metacpan.org/release/AnyEvent-ClickHouse) -- Ruby - - [ツ暗ェツ氾环催ツ団)](https://github.com/shlima/click_house) - - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://github.com/PNixx/clickhouse-activerecord) -- R - - [clickhouse-r](https://github.com/hannesmuehleisen/clickhouse-r) - - [RClickhouse](https://github.com/IMSMWU/RClickhouse) -- Java - - [clickhouse-client-java](https://github.com/VirtusAI/clickhouse-client-java) -- 斯卡拉 - - [掳胫client-禄脢鹿脷露胫鲁隆鹿-client酶](https://github.com/crobox/clickhouse-scala-client) -- Kotlin - - [AORM](https://github.com/TanVD/AORM) -- C\# - - [克莱克豪斯Ado](https://github.com/killwort/ClickHouse-Net) - - [ClickHouse.Net](https://github.com/ilyabreev/ClickHouse.Net) - - [克莱克豪斯客户](https://github.com/DarkWanderer/ClickHouse.Client) -- 仙丹 - - [clickhousex](https://github.com/appodeal/clickhousex/) -- 尼姆 - - [nim-clickhouse](https://github.com/leonardoce/nim-clickhouse) - -[来源文章](https://clickhouse.tech/docs/zh/interfaces/third-party/client_libraries/) diff --git a/docs/zh/interfaces/third-party/gui.md b/docs/zh/interfaces/third-party/gui.md index bbbd78f650e..e85f8b2ec79 100644 --- a/docs/zh/interfaces/third-party/gui.md +++ b/docs/zh/interfaces/third-party/gui.md @@ -1,4 +1,3 @@ - # 第三方开发的可视化界面 {#di-san-fang-kai-fa-de-ke-shi-hua-jie-mian} ## 开源 {#kai-yuan} diff --git a/docs/zh/interfaces/third-party/integrations.md b/docs/zh/interfaces/third-party/integrations.md index 128a4060c2d..0d551829991 100644 --- a/docs/zh/interfaces/third-party/integrations.md +++ b/docs/zh/interfaces/third-party/integrations.md @@ -20,7 +20,7 @@ - [卡夫卡](https://kafka.apache.org) - [clickhouse\_sinker](https://github.com/housepower/clickhouse_sinker) (使用 [去客户](https://github.com/ClickHouse/clickhouse-go/)) - 流处理 - - [Flink](https://flink.apache.org) + - [Flink](https://flink.apache.org) - [flink-clickhouse-sink](https://github.com/ivi-ru/flink-clickhouse-sink) - 对象存储 - [S3](https://en.wikipedia.org/wiki/Amazon_S3) @@ -37,7 +37,7 @@ - [graphouse](https://github.com/yandex/graphouse) - [ツ暗ェツ氾环催ツ団](https://github.com/lomik/carbon-clickhouse) + - [ツ环板-ョツ嘉ッツ偲](https://github.com/lomik/graphite-clickhouse) - - [石墨-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) -优化静态分区 [\*GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md#graphitemergetree) 如果从规则 [汇总配置](../../engines/table_engines/mergetree_family/graphitemergetree.md#rollup-configuration) 可以应用 + - [石墨-ch-optimizer](https://github.com/innogames/graphite-ch-optimizer) -优化静态分区 [\*GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md#graphitemergetree) 如果从规则 [汇总配置](../../engines/table-engines/mergetree-family/graphitemergetree.md#rollup-configuration) 可以应用 - [Grafana](https://grafana.com/) - [clickhouse-grafana](https://github.com/Vertamedia/clickhouse-grafana) - [普罗米修斯号](https://prometheus.io/) @@ -69,7 +69,7 @@ - [ツ暗ェツ氾环催ツ団ツ法ツ人](https://github.com/cloudflare/sqlalchemy-clickhouse) (使用 [infi.clickhouse\_orm](https://github.com/Infinidat/infi.clickhouse_orm)) - [熊猫](https://pandas.pydata.org) - [pandahouse](https://github.com/kszucs/pandahouse) -- PHP +- PHP - [Doctrine](https://www.doctrine-project.org/) - [dbal-clickhouse](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse) - R @@ -77,7 +77,7 @@ - [RClickhouse](https://github.com/IMSMWU/RClickhouse) (使用 [ツ暗ェツ氾环催ツ団](https://github.com/artpaul/clickhouse-cpp)) - Java - [Hadoop](http://hadoop.apache.org) - - [clickhouse-hdfs-装载机](https://github.com/jaykelin/clickhouse-hdfs-loader) (使用 [JDBC](../../sql_reference/table_functions/jdbc.md)) + - [clickhouse-hdfs-装载机](https://github.com/jaykelin/clickhouse-hdfs-loader) (使用 [JDBC](../../sql-reference/table-functions/jdbc.md)) - 斯卡拉 - [Akka](https://akka.io) - [掳胫client-禄脢鹿脷露胫鲁隆鹿-client酶](https://github.com/crobox/clickhouse-scala-client) diff --git a/docs/zh/interfaces/third-party/proxy.md b/docs/zh/interfaces/third-party/proxy.md index e954444c46f..798717c0602 100644 --- a/docs/zh/interfaces/third-party/proxy.md +++ b/docs/zh/interfaces/third-party/proxy.md @@ -1,4 +1,3 @@ - # 来自第三方开发人员的代理服务器 {#lai-zi-di-san-fang-kai-fa-ren-yuan-de-dai-li-fu-wu-qi} [chproxy](https://github.com/Vertamedia/chproxy) 是ClickHouse数据库的http代理和负载均衡器。 diff --git a/docs/zh/introduction/adopters.md b/docs/zh/introduction/adopters.md index 7e18cd9cdef..895ec961751 100644 --- a/docs/zh/introduction/adopters.md +++ b/docs/zh/introduction/adopters.md @@ -8,77 +8,77 @@ toc_title: "\u91C7\u7528\u8005" !!! warning "免责声明" 如下使用ClickHouse的公司和他们的成功案例来源于公开资源,因此和实际情况可能有所出入。如果您分享您公司使用ClickHouse的故事,我们将不胜感激 [将其添加到列表](https://github.com/ClickHouse/ClickHouse/edit/master/docs/en/introduction/adopters.md),但请确保你这样做不会有任何保密协议的问题。也欢迎提供来自其他公司的出版物的更新。 -| 公司简介 | 行业 | 用例 | 群集大小 | (Un)压缩数据大小\* | 参考资料 | -|-----------------------------------------------------------------|-------------------|----------------|---------------------------------------------------|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [2gis](https://2gis.ru) | 地图 | 监测 | — | — | [俄文,2019年7月](https://youtu.be/58sPkXfq6nw) | -| [Aloha 浏览器](https://alohabrowser.com/) | 移动应用程序 | 浏览器后端 | — | — | [俄文幻灯片,2019年5月](https://github.com/yandex/clickhouse-presentations/blob/master/meetup22/aloha.pdf) | -| [阿玛迪斯](https://amadeus.com/) | 旅行 | 分析 | — | — | [新闻稿,四月2018](https://www.altinity.com/blog/2018/4/5/amadeus-technologies-launches-investment-and-insights-tool-based-on-machine-learning-and-strategy-algorithms) | -| [Appsflyer](https://www.appsflyer.com) | 移动分析 | 主要产品 | — | — | [俄文,2019年7月](https://www.youtube.com/watch?v=M3wbRlcpBbY) | -| [ArenaData](https://arenadata.tech/) | 数据平台 | 主要产品 | — | — | [俄文幻灯片,十二月2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup38/indexes.pdf) | -| [Badoo](https://badoo.com) | 约会 | 时间序列 | — | — | [俄文幻灯片,十二月2019](https://presentations.clickhouse.tech/meetup38/forecast.pdf) | -| [Benocs](https://www.benocs.com/) | 网络遥测和分析 | 主要产品 | — | — | [英文幻灯片,2017年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup9/lpm.pdf) | -| [彭博社](https://www.bloomberg.com/) | 金融、媒体 | 监测 | 102个服务器 | — | [幻灯片,2018年5月](https://www.slideshare.net/Altinity/http-analytics-for-6m-requests-per-second-using-clickhouse-by-alexander-bocharov) | -| [Bloxy](https://bloxy.info) | 区块链 | 分析 | — | — | [俄文幻灯片,八月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/4_bloxy.pptx) | -| `Dataliance/UltraPower` | 电信 | 分析 | — | — | [中文幻灯片,2018年1月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/telecom.pdf) | -| [CARTO](https://carto.com/) | 商业智能 | 地理分析 | — | — | [地理空间处理与ClickHouse](https://carto.com/blog/geospatial-processing-with-clickhouse/) | -| [CERN](http://public.web.cern.ch/public/) | 研究 | 实验 | — | — | [新闻稿,四月2012](https://www.yandex.com/company/press_center/press_releases/2012/2012-04-10/) | -| [思科](http://cisco.com/) | 网络 | 流量分析 | — | — | [闪电对话,十月2019](https://youtu.be/-hI1vDR2oPY?t=5057) | -| [城堡证券](https://www.citadelsecurities.com/) | 金融 | — | — | — | [贡献,2019年3月](https://github.com/ClickHouse/ClickHouse/pull/4774) | -| [Citymobil](https://city-mobil.ru) | 出租车 | 分析 | — | — | [俄文博客文章,三月2020](https://habr.com/en/company/citymobil/blog/490660/) | -| [内容广场](https://contentsquare.com) | 网站分析 | 主要产品 | — | — | [法文博客文章,十一月2018](http://souslecapot.net/2018/11/21/patrick-chatain-vp-engineering-chez-contentsquare-penser-davantage-amelioration-continue-que-revolution-constante/) | -| [Cloudflare](https://cloudflare.com) | CDN | 流量分析 | 36服务器 | — | [博客文章,五月2017](https://blog.cloudflare.com/how-cloudflare-analyzes-1m-dns-queries-per-second/), [博客文章,三月2018](https://blog.cloudflare.com/http-analytics-for-6m-requests-per-second-using-clickhouse/) | -| [Corunet](https://coru.net/) | 分析 | 主要产品 | — | — | [英文幻灯片,2019年4月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup21/predictive_models.pdf) | -| [CraiditX 氪信](https://www.creditx.com) | 金融AI | 分析 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/udf.pptx) | -| [Criteo/Storetail](https://www.criteo.com/) | 零售 | 主要产品 | — | — | [英文幻灯片,十月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/3_storetail.pptx) | -| [德意志银行](https://db.com) | 金融 | 商业智能分析 | — | — | [英文幻灯片,十月2019](https://bigdatadays.ru/wp-content/uploads/2019/10/D2-H3-3_Yakunin-Goihburg.pdf) | -| [Diva-e](https://www.diva-e.com) | 数字咨询 | 主要产品 | — | — | [英文幻灯片,2019年9月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup29/ClickHouse-MeetUp-Unusual-Applications-sd-2019-09-17.pdf) | -| [Exness](https://www.exness.com) | 交易 | 指标,日志记录 | — | — | [俄语交谈,2019年5月](https://youtu.be/_rpU-TvSfZ8?t=3215) | -| [精灵](https://geniee.co.jp) | 广告网络 | 主要产品 | — | — | [日文博客,2017年7月](https://tech.geniee.co.jp/entry/2017/07/20/160100) | -| [虎牙](https://www.huya.com/) | 视频流 | 分析 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/7.%20ClickHouse万亿数据分析实践%20李本旺(sundy-li)%20虎牙.pdf) | -| [Idealista](https://www.idealista.com) | 房地产 | 分析 | — | — | [英文博客文章,四月2019](https://clickhouse.yandex/blog/en/clickhouse-meetup-in-madrid-on-april-2-2019) | -| [Infovista](https://www.infovista.com/) | 网络 | 分析 | — | — | [英文幻灯片,十月2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup30/infovista.pdf) | -| [InnoGames](https://www.innogames.com) | 游戏 | 指标,日志记录 | — | — | [俄文幻灯片,2019年9月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/graphite_and_clickHouse.pdf) | -| [Integros](https://integros.com) | 视频服务平台 | 分析 | — | — | [俄文幻灯片,2019年5月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | -| [科迪亚克数据](https://www.kodiakdata.com/) | 云 | 主要产品 | — | — | [虏茅驴麓卤戮碌禄路戮鲁拢](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup13/kodiak_data.pdf) | -| [Kontur](https://kontur.ru) | 软件开发 | 指标 | — | — | [俄语交谈,2018年11月](https://www.youtube.com/watch?v=U4u4Bd0FtrY) | -| [LifeStreet](https://lifestreet.com/) | 广告网络 | 主要产品 | 75台服务器(3个副本) | 5.27PiB | [俄文博客文章,2017年2月](https://habr.com/en/post/322620/) | -| [Mail.ru 云解决方案](https://mcs.mail.ru/) | 云服务 | 主要产品 | — | — | [运行ClickHouse实例,俄语](https://mcs.mail.ru/help/db-create/clickhouse#) | -| [MessageBird](https://www.messagebird.com) | 电信 | 统计 | — | — | [英文幻灯片,2018年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup20/messagebird.pdf) | -| [MGID](https://www.mgid.com/) | 广告网络 | 网络分析 | — | — | [我们在实施分析DBMS ClickHouse的经验,俄文](http://gs-studio.com/news-about-it/32777----clickhouse---c) | -| [OneAPM](https://www.oneapm.com/) | 监测和数据分析 | 主要产品 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/8.%20clickhouse在OneAPM的应用%20杜龙.pdf) | -| [Pragma Innovation](http://www.pragma-innovation.fr/) | 遥测和大数据分析 | 主要产品 | — | — | [英文幻灯片,十月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/4_pragma_innovation.pdf) | -| [青云](https://www.qingcloud.com/) | 云服务 | 主要产品 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/4.%20Cloud%20%2B%20TSDB%20for%20ClickHouse%20张健%20QingCloud.pdf) | -| [Qrator](https://qrator.net) | DDoS保护 | 主要产品 | — | — | [博客文章,三月2019](https://blog.qrator.net/en/clickhouse-ddos-mitigation_37/) | -| [百分点](https://www.percent.cn/) | 分析 | 主要产品 | — | — | [中文幻灯片,2019年6月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/4.%20ClickHouse万亿数据双中心的设计与实践%20.pdf) | -| [漫步者](https://rambler.ru) | 互联网服务 | 分析 | — | — | [俄语讲座,2018年4月](https://medium.com/@ramblertop/разработка-api-clickhouse-для-рамблер-топ-100-f4c7e56f3141) | -| [腾讯](https://www.tencent.com) | 通讯软件 | 日志记录 | — | — | [中文讲座,2019年11月](https://youtu.be/T-iVQRuw-QY?t=5050) | -| [流量之星](https://trafficstars.com/) | 广告网络 | — | — | — | [俄文幻灯片,2018年5月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup15/lightning/ninja.pdf) | -| [S7航空公司](https://www.s7.ru) | 航空公司 | 指标,日志记录 | — | — | [俄文,2019年3月](https://www.youtube.com/watch?v=nwG68klRpPg&t=15s) | -| [SEMrush](https://www.semrush.com/) | 营销 | 主要产品 | — | — | [俄文幻灯片,八月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/5_semrush.pdf) | -| [scireum GmbH](https://www.scireum.de/) | 电子商务 | 主要产品 | — | — | [德语讲座,2020年2月](https://www.youtube.com/watch?v=7QWAn5RbyR4) | +| 公司简介 | 行业 | 用例 | 群集大小 | (Un)压缩数据大小\* | 参考资料 | +|-----------------------------------------------------------------|------------------|----------------|---------------------------------------------------|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [2gis](https://2gis.ru) | 地图 | 监测 | — | — | [俄文,2019年7月](https://youtu.be/58sPkXfq6nw) | +| [Aloha 浏览器](https://alohabrowser.com/) | 移动应用程序 | 浏览器后端 | — | — | [俄文幻灯片,2019年5月](https://github.com/yandex/clickhouse-presentations/blob/master/meetup22/aloha.pdf) | +| [阿玛迪斯](https://amadeus.com/) | 旅行 | 分析 | — | — | [新闻稿,四月2018](https://www.altinity.com/blog/2018/4/5/amadeus-technologies-launches-investment-and-insights-tool-based-on-machine-learning-and-strategy-algorithms) | +| [Appsflyer](https://www.appsflyer.com) | 移动分析 | 主要产品 | — | — | [俄文,2019年7月](https://www.youtube.com/watch?v=M3wbRlcpBbY) | +| [ArenaData](https://arenadata.tech/) | 数据平台 | 主要产品 | — | — | [俄文幻灯片,十二月2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup38/indexes.pdf) | +| [Badoo](https://badoo.com) | 约会 | 时间序列 | — | — | [俄文幻灯片,十二月2019](https://presentations.clickhouse.tech/meetup38/forecast.pdf) | +| [Benocs](https://www.benocs.com/) | 网络遥测和分析 | 主要产品 | — | — | [英文幻灯片,2017年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup9/lpm.pdf) | +| [彭博社](https://www.bloomberg.com/) | 金融、媒体 | 监测 | 102个服务器 | — | [幻灯片,2018年5月](https://www.slideshare.net/Altinity/http-analytics-for-6m-requests-per-second-using-clickhouse-by-alexander-bocharov) | +| [Bloxy](https://bloxy.info) | 区块链 | 分析 | — | — | [俄文幻灯片,八月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/4_bloxy.pptx) | +| `Dataliance/UltraPower` | 电信 | 分析 | — | — | [中文幻灯片,2018年1月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/telecom.pdf) | +| [CARTO](https://carto.com/) | 商业智能 | 地理分析 | — | — | [地理空间处理与ClickHouse](https://carto.com/blog/geospatial-processing-with-clickhouse/) | +| [CERN](http://public.web.cern.ch/public/) | 研究 | 实验 | — | — | [新闻稿,四月2012](https://www.yandex.com/company/press_center/press_releases/2012/2012-04-10/) | +| [思科](http://cisco.com/) | 网络 | 流量分析 | — | — | [闪电对话,十月2019](https://youtu.be/-hI1vDR2oPY?t=5057) | +| [城堡证券](https://www.citadelsecurities.com/) | 金融 | — | — | — | [贡献,2019年3月](https://github.com/ClickHouse/ClickHouse/pull/4774) | +| [Citymobil](https://city-mobil.ru) | 出租车 | 分析 | — | — | [俄文博客文章,三月2020](https://habr.com/en/company/citymobil/blog/490660/) | +| [内容广场](https://contentsquare.com) | 网站分析 | 主要产品 | — | — | [法文博客文章,十一月2018](http://souslecapot.net/2018/11/21/patrick-chatain-vp-engineering-chez-contentsquare-penser-davantage-amelioration-continue-que-revolution-constante/) | +| [Cloudflare](https://cloudflare.com) | CDN | 流量分析 | 36服务器 | — | [博客文章,五月2017](https://blog.cloudflare.com/how-cloudflare-analyzes-1m-dns-queries-per-second/), [博客文章,三月2018](https://blog.cloudflare.com/http-analytics-for-6m-requests-per-second-using-clickhouse/) | +| [Corunet](https://coru.net/) | 分析 | 主要产品 | — | — | [英文幻灯片,2019年4月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup21/predictive_models.pdf) | +| [CraiditX 氪信](https://www.creditx.com) | 金融AI | 分析 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/udf.pptx) | +| [Criteo/Storetail](https://www.criteo.com/) | 零售 | 主要产品 | — | — | [英文幻灯片,十月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/3_storetail.pptx) | +| [德意志银行](https://db.com) | 金融 | 商业智能分析 | — | — | [英文幻灯片,十月2019](https://bigdatadays.ru/wp-content/uploads/2019/10/D2-H3-3_Yakunin-Goihburg.pdf) | +| [Diva-e](https://www.diva-e.com) | 数字咨询 | 主要产品 | — | — | [英文幻灯片,2019年9月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup29/ClickHouse-MeetUp-Unusual-Applications-sd-2019-09-17.pdf) | +| [Exness](https://www.exness.com) | 交易 | 指标,日志记录 | — | — | [俄语交谈,2019年5月](https://youtu.be/_rpU-TvSfZ8?t=3215) | +| [精灵](https://geniee.co.jp) | 广告网络 | 主要产品 | — | — | [日文博客,2017年7月](https://tech.geniee.co.jp/entry/2017/07/20/160100) | +| [虎牙](https://www.huya.com/) | 视频流 | 分析 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/7.%20ClickHouse万亿数据分析实践%20李本旺(sundy-li)%20虎牙.pdf) | +| [Idealista](https://www.idealista.com) | 房地产 | 分析 | — | — | [英文博客文章,四月2019](https://clickhouse.yandex/blog/en/clickhouse-meetup-in-madrid-on-april-2-2019) | +| [Infovista](https://www.infovista.com/) | 网络 | 分析 | — | — | [英文幻灯片,十月2019](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup30/infovista.pdf) | +| [InnoGames](https://www.innogames.com) | 游戏 | 指标,日志记录 | — | — | [俄文幻灯片,2019年9月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/graphite_and_clickHouse.pdf) | +| [Integros](https://integros.com) | 视频服务平台 | 分析 | — | — | [俄文幻灯片,2019年5月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | +| [科迪亚克数据](https://www.kodiakdata.com/) | 云 | 主要产品 | — | — | [虏茅驴麓卤戮碌禄路戮鲁拢](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup13/kodiak_data.pdf) | +| [Kontur](https://kontur.ru) | 软件开发 | 指标 | — | — | [俄语交谈,2018年11月](https://www.youtube.com/watch?v=U4u4Bd0FtrY) | +| [LifeStreet](https://lifestreet.com/) | 广告网络 | 主要产品 | 75台服务器(3个副本) | 5.27PiB | [俄文博客文章,2017年2月](https://habr.com/en/post/322620/) | +| [Mail.ru 云解决方案](https://mcs.mail.ru/) | 云服务 | 主要产品 | — | — | [运行ClickHouse实例,俄语](https://mcs.mail.ru/help/db-create/clickhouse#) | +| [MessageBird](https://www.messagebird.com) | 电信 | 统计 | — | — | [英文幻灯片,2018年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup20/messagebird.pdf) | +| [MGID](https://www.mgid.com/) | 广告网络 | 网络分析 | — | — | [我们在实施分析DBMS ClickHouse的经验,俄文](http://gs-studio.com/news-about-it/32777----clickhouse---c) | +| [OneAPM](https://www.oneapm.com/) | 监测和数据分析 | 主要产品 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/8.%20clickhouse在OneAPM的应用%20杜龙.pdf) | +| [Pragma Innovation](http://www.pragma-innovation.fr/) | 遥测和大数据分析 | 主要产品 | — | — | [英文幻灯片,十月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup18/4_pragma_innovation.pdf) | +| [青云](https://www.qingcloud.com/) | 云服务 | 主要产品 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/4.%20Cloud%20%2B%20TSDB%20for%20ClickHouse%20张健%20QingCloud.pdf) | +| [Qrator](https://qrator.net) | DDoS保护 | 主要产品 | — | — | [博客文章,三月2019](https://blog.qrator.net/en/clickhouse-ddos-mitigation_37/) | +| [百分点](https://www.percent.cn/) | 分析 | 主要产品 | — | — | [中文幻灯片,2019年6月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/4.%20ClickHouse万亿数据双中心的设计与实践%20.pdf) | +| [漫步者](https://rambler.ru) | 互联网服务 | 分析 | — | — | [俄语讲座,2018年4月](https://medium.com/@ramblertop/разработка-api-clickhouse-для-рамблер-топ-100-f4c7e56f3141) | +| [腾讯](https://www.tencent.com) | 通讯软件 | 日志记录 | — | — | [中文讲座,2019年11月](https://youtu.be/T-iVQRuw-QY?t=5050) | +| [流量之星](https://trafficstars.com/) | 广告网络 | — | — | — | [俄文幻灯片,2018年5月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup15/lightning/ninja.pdf) | +| [S7航空公司](https://www.s7.ru) | 航空公司 | 指标,日志记录 | — | — | [俄文,2019年3月](https://www.youtube.com/watch?v=nwG68klRpPg&t=15s) | +| [SEMrush](https://www.semrush.com/) | 营销 | 主要产品 | — | — | [俄文幻灯片,八月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/5_semrush.pdf) | +| [scireum GmbH](https://www.scireum.de/) | 电子商务 | 主要产品 | — | — | [德语讲座,2020年2月](https://www.youtube.com/watch?v=7QWAn5RbyR4) | | [Sentry](https://sentry.io/) | 软件开发 | 产品后端 | — | — | [英文博客文章,五月2019](https://blog.sentry.io/2019/05/16/introducing-snuba-sentrys-new-search-infrastructure) | -| [SGK](http://www.sgk.gov.tr/wps/portal/sgk/tr) | 政府社会保障 | 分析 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/ClickHouse%20Meetup-Ramazan%20POLAT.pdf) | -| [seo.do](https://seo.do/) | 分析 | 主要产品 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/CH%20Presentation-%20Metehan%20Çetinkaya.pdf) | -| [新浪](http://sina.com/) | 新闻 | — | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/6.%20ClickHouse最佳实践%20高鹏_新浪.pdf) | -| [SMI2](https://smi2.ru/) | 新闻 | 分析 | — | — | [俄文博客文章,2017年11月](https://habr.com/ru/company/smi2/blog/314558/) | -| [Splunk](https://www.splunk.com/) | 业务分析 | 主要产品 | — | — | [英文幻灯片,2018年1月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/splunk.pdf) | -| [Spotify](https://www.spotify.com) | 音乐 | 实验 | — | — | [幻灯片,七月2018](https://www.slideshare.net/glebus/using-clickhouse-for-experimentation-104247173) | -| [腾讯](https://www.tencent.com) | 大数据 | 数据处理 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/5.%20ClickHouse大数据集群应用_李俊飞腾讯网媒事业部.pdf) | -| [优步](https://www.uber.com) | 出租车 | 日志记录 | — | — | [幻灯片,二月2020](https://presentations.clickhouse.tech/meetup40/uber.pdf) | -| [VKontakte](https://vk.com) | 社交网络 | 统计,日志记录 | — | — | [俄文幻灯片,八月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/3_vk.pdf) | -| [Wisebits](https://wisebits.com/) | IT解决方案 | 分析 | — | — | [俄文幻灯片,2019年5月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | -| [晓信科技](https://www.xiaoheiban.cn/) | 教育 | 共同目的 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/sync-clickhouse-with-mysql-mongodb.pptx) | -| [喜马拉雅](https://www.ximalaya.com/) | 音频共享 | OLAP | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/ximalaya.pdf) | -| [Yandex云](https://cloud.yandex.ru/services/managed-clickhouse) | 公有云 | 主要产品 | — | — | [俄文,2019年12月](https://www.youtube.com/watch?v=pgnak9e_E0o) | -| [Yandex DataLens](https://cloud.yandex.ru/services/datalens) | 商业智能 | 主要产品 | — | — | [俄文幻灯片,十二月2019](https://presentations.clickhouse.tech/meetup38/datalens.pdf) | -| [Yandex市场](https://market.yandex.ru/) | 电子商务 | 指标,日志记录 | — | — | [俄文,2019年1月](https://youtu.be/_l1qP0DyBcA?t=478) | -| [Yandex Metrica](https://metrica.yandex.com) | 网站分析 | 主要产品 | 一个集群中的360台服务器,一个部门中的1862台服务器 | 66.41PiB/5.68PiB | [幻灯片,二月2020](https://presentations.clickhouse.tech/meetup40/introduction/#13) | -| [ЦВТ](https://htc-cs.ru/) | 软件开发 | 指标,日志记录 | — | — | [博客文章,三月2019,俄文](https://vc.ru/dev/62715-kak-my-stroili-monitoring-na-prometheus-clickhouse-i-elk) | -| [МКБ](https://mkb.ru/) | 银行 | 网络系统监控 | — | — | [俄文幻灯片,2019年9月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/mkb.pdf) | -| [金数据](https://jinshuju.net) | 商业智能分析 | 主要产品 | — | — | [中文幻灯片,2019年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/3.%20金数据数据架构调整方案Public.pdf) | -| [Instana](https://www.instana.com) | APM 平台 | 主要产品 | — | — | [推特消息](https://twitter.com/mieldonkers/status/1248884119158882304) | -| [Wargaming](https://wargaming.com/en/) | 游戏 | | — | — | [采访](https://habr.com/en/post/496954/) | -| [Crazypanda](https://crazypanda.ru/en/) | 游戏 | | — | — | ClickHouse 社区会议 | -| [FunCorp](https://fun.co/rp) | 游戏 | | — | — | [文章](https://www.altinity.com/blog/migrating-from-redshift-to-clickhouse) | +| [SGK](http://www.sgk.gov.tr/wps/portal/sgk/tr) | 政府社会保障 | 分析 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/ClickHouse%20Meetup-Ramazan%20POLAT.pdf) | +| [seo.do](https://seo.do/) | 分析 | 主要产品 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup35/CH%20Presentation-%20Metehan%20Çetinkaya.pdf) | +| [新浪](http://sina.com/) | 新闻 | — | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/6.%20ClickHouse最佳实践%20高鹏_新浪.pdf) | +| [SMI2](https://smi2.ru/) | 新闻 | 分析 | — | — | [俄文博客文章,2017年11月](https://habr.com/ru/company/smi2/blog/314558/) | +| [Splunk](https://www.splunk.com/) | 业务分析 | 主要产品 | — | — | [英文幻灯片,2018年1月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup12/splunk.pdf) | +| [Spotify](https://www.spotify.com) | 音乐 | 实验 | — | — | [幻灯片,七月2018](https://www.slideshare.net/glebus/using-clickhouse-for-experimentation-104247173) | +| [腾讯](https://www.tencent.com) | 大数据 | 数据处理 | — | — | [中文幻灯片,2018年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup19/5.%20ClickHouse大数据集群应用_李俊飞腾讯网媒事业部.pdf) | +| [优步](https://www.uber.com) | 出租车 | 日志记录 | — | — | [幻灯片,二月2020](https://presentations.clickhouse.tech/meetup40/uber.pdf) | +| [VKontakte](https://vk.com) | 社交网络 | 统计,日志记录 | — | — | [俄文幻灯片,八月2018](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup17/3_vk.pdf) | +| [Wisebits](https://wisebits.com/) | IT解决方案 | 分析 | — | — | [俄文幻灯片,2019年5月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup22/strategies.pdf) | +| [晓信科技](https://www.xiaoheiban.cn/) | 教育 | 共同目的 | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/sync-clickhouse-with-mysql-mongodb.pptx) | +| [喜马拉雅](https://www.ximalaya.com/) | 音频共享 | OLAP | — | — | [英文幻灯片,2019年11月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup33/ximalaya.pdf) | +| [Yandex云](https://cloud.yandex.ru/services/managed-clickhouse) | 公有云 | 主要产品 | — | — | [俄文,2019年12月](https://www.youtube.com/watch?v=pgnak9e_E0o) | +| [Yandex DataLens](https://cloud.yandex.ru/services/datalens) | 商业智能 | 主要产品 | — | — | [俄文幻灯片,十二月2019](https://presentations.clickhouse.tech/meetup38/datalens.pdf) | +| [Yandex市场](https://market.yandex.ru/) | 电子商务 | 指标,日志记录 | — | — | [俄文,2019年1月](https://youtu.be/_l1qP0DyBcA?t=478) | +| [Yandex Metrica](https://metrica.yandex.com) | 网站分析 | 主要产品 | 一个集群中的360台服务器,一个部门中的1862台服务器 | 66.41PiB/5.68PiB | [幻灯片,二月2020](https://presentations.clickhouse.tech/meetup40/introduction/#13) | +| [ЦВТ](https://htc-cs.ru/) | 软件开发 | 指标,日志记录 | — | — | [博客文章,三月2019,俄文](https://vc.ru/dev/62715-kak-my-stroili-monitoring-na-prometheus-clickhouse-i-elk) | +| [МКБ](https://mkb.ru/) | 银行 | 网络系统监控 | — | — | [俄文幻灯片,2019年9月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup28/mkb.pdf) | +| [金数据](https://jinshuju.net) | 商业智能分析 | 主要产品 | — | — | [中文幻灯片,2019年10月](https://github.com/ClickHouse/clickhouse-presentations/blob/master/meetup24/3.%20金数据数据架构调整方案Public.pdf) | +| [Instana](https://www.instana.com) | APM 平台 | 主要产品 | — | — | [推特消息](https://twitter.com/mieldonkers/status/1248884119158882304) | +| [Wargaming](https://wargaming.com/en/) | 游戏 | | — | — | [采访](https://habr.com/en/post/496954/) | +| [Crazypanda](https://crazypanda.ru/en/) | 游戏 | | — | — | ClickHouse 社区会议 | +| [FunCorp](https://fun.co/rp) | 游戏 | | — | — | [文章](https://www.altinity.com/blog/migrating-from-redshift-to-clickhouse) | [原始文章](https://clickhouse.tech/docs/en/introduction/adopters/) diff --git a/docs/zh/introduction/distinctive-features.md b/docs/zh/introduction/distinctive-features.md new file mode 100644 index 00000000000..7396008f3b9 --- /dev/null +++ b/docs/zh/introduction/distinctive-features.md @@ -0,0 +1,70 @@ +# ClickHouse的特性 {#clickhouse-de-te-xing} + +## 真正的列式数据库管理系统 {#zhen-zheng-de-lie-shi-shu-ju-ku-guan-li-xi-tong} + +在一个真正的列式数据库管理系统中,除了数据本身外不应该存在其他额外的数据。这意味着为了避免在值旁边存储它们的长度«number»,你必须支持固定长度数值类型。例如,10亿个UInt8类型的数据在未压缩的情况下大约消耗1GB左右的空间,如果不是这样的话,这将对CPU的使用产生强烈影响。即使是在未压缩的情况下,紧凑的存储数据也是非常重要的,因为解压缩的速度主要取决于未压缩数据的大小。 + +这是非常值得注意的,因为在一些其他系统中也可以将不同的列分别进行存储,但由于对其他场景进行的优化,使其无法有效的处理分析查询。例如: HBase,BigTable,Cassandra,HyperTable。在这些系统中,你可以得到每秒数十万的吞吐能力,但是无法得到每秒几亿行的吞吐能力。 + +需要说明的是,ClickHouse不单单是一个数据库, 它是一个数据库管理系统。因为它允许在运行时创建表和数据库、加载数据和运行查询,而无需重新配置或重启服务。 + +## 数据压缩 {#shu-ju-ya-suo} + +在一些列式数据库管理系统中(例如:InfiniDB CE 和 MonetDB) 并没有使用数据压缩。但是, 若想达到比较优异的性能,数据压缩确实起到了至关重要的作用。 + +## 数据的磁盘存储 {#shu-ju-de-ci-pan-cun-chu} + +许多的列式数据库(如 SAP HANA, Google PowerDrill)只能在内存中工作,这种方式会造成比实际更多的设备预算。ClickHouse被设计用于工作在传统磁盘上的系统,它提供每GB更低的存储成本,但如果有可以使用SSD和内存,它也会合理的利用这些资源。 + +## 多核心并行处理 {#duo-he-xin-bing-xing-chu-li} + +ClickHouse会使用服务器上一切可用的资源,从而以最自然的方式并行处理大型查询。 + +## 多服务器分布式处理 {#duo-fu-wu-qi-fen-bu-shi-chu-li} + +上面提到的列式数据库管理系统中,几乎没有一个支持分布式的查询处理。 +在ClickHouse中,数据可以保存在不同的shard上,每一个shard都由一组用于容错的replica组成,查询可以并行地在所有shard上进行处理。这些对用户来说是透明的 + +## 支持SQL {#zhi-chi-sql} + +ClickHouse支持基于SQL的声明式查询语言,该语言大部分情况下是与SQL标准兼容的。 +支持的查询包括 GROUP BY,ORDER BY,IN,JOIN以及非相关子查询。 +不支持窗口函数和相关子查询。 + +## 向量引擎 {#xiang-liang-yin-qing} + +为了高效的使用CPU,数据不仅仅按列存储,同时还按向量(列的一部分)进行处理,这样可以更加高效地使用CPU。 + +## 实时的数据更新 {#shi-shi-de-shu-ju-geng-xin} + +ClickHouse支持在表中定义主键。为了使查询能够快速在主键中进行范围查找,数据总是以增量的方式有序的存储在MergeTree中。因此,数据可以持续不断地高效的写入到表中,并且写入的过程中不会存在任何加锁的行为。 + +## 索引 {#suo-yin} + +按照主键对数据进行排序,这将帮助ClickHouse在几十毫秒以内完成对数据特定值或范围的查找。 + +## 适合在线查询 {#gua-he-zai-xian-cha-xun} + +在线查询意味着在没有对数据做任何预处理的情况下以极低的延迟处理查询并将结果加载到用户的页面中。 + +## 支持近似计算 {#zhi-chi-jin-si-ji-suan} + +ClickHouse提供各种各样在允许牺牲数据精度的情况下对查询进行加速的方法: + +1. 用于近似计算的各类聚合函数,如:distinct values, medians, quantiles +2. 基于数据的部分样本进行近似查询。这时,仅会从磁盘检索少部分比例的数据。 +3. 不使用全部的聚合条件,通过随机选择有限个数据聚合条件进行聚合。这在数据聚合条件满足某些分布条件下,在提供相当准确的聚合结果的同时降低了计算资源的使用。 + +## 支持数据复制和数据完整性 {#zhi-chi-shu-ju-fu-zhi-he-shu-ju-wan-zheng-xing} + +ClickHouse使用异步的多主复制技术。当数据被写入任何一个可用副本后,系统会在后台将数据分发给其他副本,以保证系统在不同副本上保持相同的数据。在大多数情况下ClickHouse能在故障后自动恢复,在一些少数的复杂情况下需要手动恢复。 + +更多信息,参见 [数据复制](../engines/table-engines/mergetree-family/replication.md)。 + +# 限制 {#clickhouseke-xian-zhi} + +1. 没有完整的事务支持。 +2. 缺少高频率,低延迟的修改或删除已存在数据的能力。仅能用于批量删除或修改数据,但这符合 [GDPR](https://gdpr-info.eu)。 +3. 稀疏索引使得ClickHouse不适合通过其键检索单行的点查询。 + +[来源文章](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/zh/introduction/distinctive_features.md b/docs/zh/introduction/distinctive_features.md deleted file mode 100644 index e27f3317bf0..00000000000 --- a/docs/zh/introduction/distinctive_features.md +++ /dev/null @@ -1,71 +0,0 @@ - -# ClickHouse的特性 {#clickhouse-de-te-xing} - -## 真正的列式数据库管理系统 {#zhen-zheng-de-lie-shi-shu-ju-ku-guan-li-xi-tong} - -在一个真正的列式数据库管理系统中,除了数据本身外不应该存在其他额外的数据。这意味着为了避免在值旁边存储它们的长度«number»,你必须支持固定长度数值类型。例如,10亿个UInt8类型的数据在未压缩的情况下大约消耗1GB左右的空间,如果不是这样的话,这将对CPU的使用产生强烈影响。即使是在未压缩的情况下,紧凑的存储数据也是非常重要的,因为解压缩的速度主要取决于未压缩数据的大小。 - -这是非常值得注意的,因为在一些其他系统中也可以将不同的列分别进行存储,但由于对其他场景进行的优化,使其无法有效的处理分析查询。例如: HBase,BigTable,Cassandra,HyperTable。在这些系统中,你可以得到每秒数十万的吞吐能力,但是无法得到每秒几亿行的吞吐能力。 - -需要说明的是,ClickHouse不单单是一个数据库, 它是一个数据库管理系统。因为它允许在运行时创建表和数据库、加载数据和运行查询,而无需重新配置或重启服务。 - -## 数据压缩 {#shu-ju-ya-suo} - -在一些列式数据库管理系统中(例如:InfiniDB CE 和 MonetDB) 并没有使用数据压缩。但是, 若想达到比较优异的性能,数据压缩确实起到了至关重要的作用。 - -## 数据的磁盘存储 {#shu-ju-de-ci-pan-cun-chu} - -许多的列式数据库(如 SAP HANA, Google PowerDrill)只能在内存中工作,这种方式会造成比实际更多的设备预算。ClickHouse被设计用于工作在传统磁盘上的系统,它提供每GB更低的存储成本,但如果有可以使用SSD和内存,它也会合理的利用这些资源。 - -## 多核心并行处理 {#duo-he-xin-bing-xing-chu-li} - -ClickHouse会使用服务器上一切可用的资源,从而以最自然的方式并行处理大型查询。 - -## 多服务器分布式处理 {#duo-fu-wu-qi-fen-bu-shi-chu-li} - -上面提到的列式数据库管理系统中,几乎没有一个支持分布式的查询处理。 -在ClickHouse中,数据可以保存在不同的shard上,每一个shard都由一组用于容错的replica组成,查询可以并行地在所有shard上进行处理。这些对用户来说是透明的 - -## 支持SQL {#zhi-chi-sql} - -ClickHouse支持基于SQL的声明式查询语言,该语言大部分情况下是与SQL标准兼容的。 -支持的查询包括 GROUP BY,ORDER BY,IN,JOIN以及非相关子查询。 -不支持窗口函数和相关子查询。 - -## 向量引擎 {#xiang-liang-yin-qing} - -为了高效的使用CPU,数据不仅仅按列存储,同时还按向量(列的一部分)进行处理,这样可以更加高效地使用CPU。 - -## 实时的数据更新 {#shi-shi-de-shu-ju-geng-xin} - -ClickHouse支持在表中定义主键。为了使查询能够快速在主键中进行范围查找,数据总是以增量的方式有序的存储在MergeTree中。因此,数据可以持续不断地高效的写入到表中,并且写入的过程中不会存在任何加锁的行为。 - -## 索引 {#suo-yin} - -按照主键对数据进行排序,这将帮助ClickHouse在几十毫秒以内完成对数据特定值或范围的查找。 - -## 适合在线查询 {#gua-he-zai-xian-cha-xun} - -在线查询意味着在没有对数据做任何预处理的情况下以极低的延迟处理查询并将结果加载到用户的页面中。 - -## 支持近似计算 {#zhi-chi-jin-si-ji-suan} - -ClickHouse提供各种各样在允许牺牲数据精度的情况下对查询进行加速的方法: - -1. 用于近似计算的各类聚合函数,如:distinct values, medians, quantiles -2. 基于数据的部分样本进行近似查询。这时,仅会从磁盘检索少部分比例的数据。 -3. 不使用全部的聚合条件,通过随机选择有限个数据聚合条件进行聚合。这在数据聚合条件满足某些分布条件下,在提供相当准确的聚合结果的同时降低了计算资源的使用。 - -## 支持数据复制和数据完整性 {#zhi-chi-shu-ju-fu-zhi-he-shu-ju-wan-zheng-xing} - -ClickHouse使用异步的多主复制技术。当数据被写入任何一个可用副本后,系统会在后台将数据分发给其他副本,以保证系统在不同副本上保持相同的数据。在大多数情况下ClickHouse能在故障后自动恢复,在一些少数的复杂情况下需要手动恢复。 - -更多信息,参见 [数据复制](../engines/table_engines/mergetree_family/replication.md)。 - -# 限制 {#clickhouseke-xian-zhi} - -1. 没有完整的事务支持。 -2. 缺少高频率,低延迟的修改或删除已存在数据的能力。仅能用于批量删除或修改数据,但这符合 [GDPR](https://gdpr-info.eu)。 -3. 稀疏索引使得ClickHouse不适合通过其键检索单行的点查询。 - -[来源文章](https://clickhouse.tech/docs/en/introduction/distinctive_features/) diff --git a/docs/zh/introduction/history.md b/docs/zh/introduction/history.md index 673e070addb..1871bd75588 100644 --- a/docs/zh/introduction/history.md +++ b/docs/zh/introduction/history.md @@ -1,4 +1,3 @@ - # ClickHouse历史 {#clickhouseli-shi} ClickHouse最初是为 [YandexMetrica](https://metrica.yandex.com/) [世界第二大Web分析平台](http://w3techs.com/technologies/overview/traffic_analysis/all) 而开发的。多年来一直作为该系统的核心组件被该系统持续使用着。目前为止,该系统在ClickHouse中有超过13万亿条记录,并且每天超过200多亿个事件被处理。它允许直接从原始数据中动态查询并生成报告。本文简要介绍了ClickHouse在其早期发展阶段的目标。 diff --git a/docs/zh/introduction/performance.md b/docs/zh/introduction/performance.md index ef48661d304..a5960cfa52e 100644 --- a/docs/zh/introduction/performance.md +++ b/docs/zh/introduction/performance.md @@ -1,4 +1,3 @@ - # 性能 {#performance} 根据Yandex的内部测试结果,ClickHouse表现出了比同类可比较产品更优的性能。你可以在 [这里](https://clickhouse.tech/benchmark/dbms/) 查看具体的测试结果。 diff --git a/docs/zh/operations/access-rights.md b/docs/zh/operations/access-rights.md new file mode 100644 index 00000000000..f596e16c269 --- /dev/null +++ b/docs/zh/operations/access-rights.md @@ -0,0 +1,101 @@ +# 访问权限 {#access-rights} + +用户和访问权限在用户配置中设置。 这通常是 `users.xml`. + +用户被记录在 `users` 科。 这里是一个片段 `users.xml` 文件: + +``` xml + + + + + + + + + + + + default + + + default + + + + + + + web + default + + test + + +``` + +您可以看到两个用户的声明: `default`和`web`. 我们添加了 `web` 用户分开。 + +该 `default` 在用户名未通过的情况下选择用户。 该 `default` 如果服务器或群集的配置没有指定分布式查询处理,则user也用于分布式查询处理 `user` 和 `password` (见上的部分 [分布](../engines/table-engines/special/distributed.md) 发动机)。 + +The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. + +密码以明文(不推荐)或SHA-256形式指定。 哈希没有腌制。 在这方面,您不应将这些密码视为提供了针对潜在恶意攻击的安全性。 相反,他们是必要的保护员工。 + +指定允许访问的网络列表。 在此示例中,将从单独的文件加载两个用户的网络列表 (`/etc/metrika.xml`)包含 `networks` 替代。 这里是它的一个片段: + +``` xml + + ... + + ::/64 + 203.0.113.0/24 + 2001:DB8::/32 + ... + + +``` + +您可以直接在以下内容中定义此网络列表 `users.xml`,或在文件中 `users.d` directory (for more information, see the section «[配置文件](configuration-files.md#configuration_files)»). + +该配置包括解释如何从任何地方打开访问的注释。 + +对于在生产中使用,仅指定 `ip` 元素(IP地址及其掩码),因为使用 `host` 和 `hoost_regexp` 可能会导致额外的延迟。 + +Next the user settings profile is specified (see the section «[设置配置文件](settings/settings-profiles.md)»). You can specify the default profile, `default'`. 配置文件可以有任何名称。 您可以为不同的用户指定相同的配置文件。 您可以在设置配置文件中编写的最重要的事情是 `readonly=1`,这确保只读访问。 +Then specify the quota to be used (see the section «[配额](quotas.md#quotas)»). You can specify the default quota: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. + +在可选 `` 您还可以指定用户可以访问的数据库列表。 默认情况下,所有数据库都可供用户使用。 您可以指定 `default` 数据库。 在这种情况下,默认情况下,用户将接收对数据库的访问权限。 + +访问 `system` 始终允许数据库(因为此数据库用于处理查询)。 + +用户可以通过以下方式获取其中所有数据库和表的列表 `SHOW` 查询或系统表,即使不允许访问单个数据库。 + +数据库访问是不相关的 [只读](settings/permissions-for-queries.md#settings_readonly) 设置。 您不能授予对一个数据库的完全访问权限,并 `readonly` 进入另一个。 + +[原始文章](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/zh/operations/access_rights.md b/docs/zh/operations/access_rights.md deleted file mode 100644 index 0178001e74f..00000000000 --- a/docs/zh/operations/access_rights.md +++ /dev/null @@ -1,102 +0,0 @@ - -# 访问权限 {#access-rights} - -用户和访问权限在用户配置中设置。 这通常是 `users.xml`. - -用户被记录在 `users` 科。 这里是一个片段 `users.xml` 文件: - -``` xml - - - - - - - - - - - - default - - - default - - - - - - - web - default - - test - - -``` - -您可以看到两个用户的声明: `default`和`web`. 我们添加了 `web` 用户分开。 - -该 `default` 在用户名未通过的情况下选择用户。 该 `default` 如果服务器或群集的配置没有指定分布式查询处理,则user也用于分布式查询处理 `user` 和 `password` (见上的部分 [分布](../engines/table_engines/special/distributed.md) 发动机)。 - -The user that is used for exchanging information between servers combined in a cluster must not have substantial restrictions or quotas – otherwise, distributed queries will fail. - -密码以明文(不推荐)或SHA-256形式指定。 哈希没有腌制。 在这方面,您不应将这些密码视为提供了针对潜在恶意攻击的安全性。 相反,他们是必要的保护员工。 - -指定允许访问的网络列表。 在此示例中,将从单独的文件加载两个用户的网络列表 (`/etc/metrika.xml`)包含 `networks` 替代。 这里是它的一个片段: - -``` xml - - ... - - ::/64 - 203.0.113.0/24 - 2001:DB8::/32 - ... - - -``` - -您可以直接在以下内容中定义此网络列表 `users.xml`,或在文件中 `users.d` directory (for more information, see the section «[配置文件](configuration_files.md#configuration_files)»). - -该配置包括解释如何从任何地方打开访问的注释。 - -对于在生产中使用,仅指定 `ip` 元素(IP地址及其掩码),因为使用 `host` 和 `hoost_regexp` 可能会导致额外的延迟。 - -Next the user settings profile is specified (see the section «[设置配置文件](settings/settings_profiles.md)»). You can specify the default profile, `default'`. 配置文件可以有任何名称。 您可以为不同的用户指定相同的配置文件。 您可以在设置配置文件中编写的最重要的事情是 `readonly=1`,这确保只读访问。 -Then specify the quota to be used (see the section «[配额](quotas.md#quotas)»). You can specify the default quota: `default`. It is set in the config by default to only count resource usage, without restricting it. The quota can have any name. You can specify the same quota for different users – in this case, resource usage is calculated for each user individually. - -在可选 `` 您还可以指定用户可以访问的数据库列表。 默认情况下,所有数据库都可供用户使用。 您可以指定 `default` 数据库。 在这种情况下,默认情况下,用户将接收对数据库的访问权限。 - -访问 `system` 始终允许数据库(因为此数据库用于处理查询)。 - -用户可以通过以下方式获取其中所有数据库和表的列表 `SHOW` 查询或系统表,即使不允许访问单个数据库。 - -数据库访问是不相关的 [只读](settings/permissions_for_queries.md#settings_readonly) 设置。 您不能授予对一个数据库的完全访问权限,并 `readonly` 进入另一个。 - -[原始文章](https://clickhouse.tech/docs/en/operations/access_rights/) diff --git a/docs/zh/operations/backup.md b/docs/zh/operations/backup.md index 256ddddd2c2..b758948aecd 100644 --- a/docs/zh/operations/backup.md +++ b/docs/zh/operations/backup.md @@ -7,7 +7,7 @@ toc_title: "\u6570\u636E\u5907\u4EFD" # 数据备份 {#data-backup} -碌莽禄While: [复制](../engines/table_engines/mergetree_family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [您不能使用类似MergeTree的引擎删除包含超过50Gb数据的表](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). 但是,这些保障措施并不涵盖所有可能的情况,可以规避。 +碌莽禄While: [复制](../engines/table-engines/mergetree-family/replication.md) provides protection from hardware failures, it does not protect against human errors: accidental deletion of data, deletion of the wrong table or a table on the wrong cluster, and software bugs that result in incorrect data processing or data corruption. In many cases mistakes like these will affect all replicas. ClickHouse has built-in safeguards to prevent some types of mistakes — for example, by default [您不能使用类似MergeTree的引擎删除包含超过50Gb数据的表](https://github.com/ClickHouse/ClickHouse/blob/v18.14.18-stable/programs/server/config.xml#L322-L330). 但是,这些保障措施并不涵盖所有可能的情况,可以规避。 为了有效地减少可能的人为错误,您应该仔细准备备份和还原数据的策略 **提前**. @@ -22,7 +22,7 @@ toc_title: "\u6570\u636E\u5907\u4EFD" ## 文件系统快照 {#filesystem-snapshots} -某些本地文件系统提供快照功能(例如, [ZFS](https://en.wikipedia.org/wiki/ZFS)),但它们可能不是提供实时查询的最佳选择。 一个可能的解决方案是使用这种文件系统创建额外的副本,并将它们从 [分布](../engines/table_engines/special/distributed.md) 用于以下目的的表 `SELECT` 查询。 任何修改数据的查询都无法访问此类副本上的快照。 作为奖励,这些副本可能具有特殊的硬件配置,每个服务器附加更多的磁盘,这将是经济高效的。 +某些本地文件系统提供快照功能(例如, [ZFS](https://en.wikipedia.org/wiki/ZFS)),但它们可能不是提供实时查询的最佳选择。 一个可能的解决方案是使用这种文件系统创建额外的副本,并将它们从 [分布](../engines/table-engines/special/distributed.md) 用于以下目的的表 `SELECT` 查询。 任何修改数据的查询都无法访问此类副本上的快照。 作为奖励,这些副本可能具有特殊的硬件配置,每个服务器附加更多的磁盘,这将是经济高效的。 ## ツ环板-ョツ嘉ッツ偲 {#clickhouse-copier} @@ -34,7 +34,7 @@ toc_title: "\u6570\u636E\u5907\u4EFD" ClickHouse允许使用 `ALTER TABLE ... FREEZE PARTITION ...` 查询以创建表分区的本地副本。 这是使用硬链接来实现 `/var/lib/clickhouse/shadow/` 文件夹中,所以它通常不会占用旧数据的额外磁盘空间。 创建的文件副本不由ClickHouse服务器处理,所以你可以把它们留在那里:你将有一个简单的备份,不需要任何额外的外部系统,但它仍然会容易出现硬件问题。 出于这个原因,最好将它们远程复制到另一个位置,然后删除本地副本。 分布式文件系统和对象存储仍然是一个不错的选择,但是具有足够大容量的正常附加文件服务器也可以工作(在这种情况下,传输将通过网络文件系统 [rsync](https://en.wikipedia.org/wiki/Rsync)). -有关与分区操作相关的查询的详细信息,请参阅 [更改文档](../sql_reference/statements/alter.md#alter_manipulations-with-partitions). +有关与分区操作相关的查询的详细信息,请参阅 [更改文档](../sql-reference/statements/alter.md#alter_manipulations-with-partitions). 第三方工具可用于自动化此方法: [ツ环板backupョツ嘉ッツ偲](https://github.com/AlexAkulov/clickhouse-backup). diff --git a/docs/zh/operations/configuration-files.md b/docs/zh/operations/configuration-files.md new file mode 100644 index 00000000000..16a903b6528 --- /dev/null +++ b/docs/zh/operations/configuration-files.md @@ -0,0 +1,43 @@ +# 配置文件 {#configuration_files} + +主服务器配置文件是 `config.xml`. 它驻留在 `/etc/clickhouse-server/` 目录。 + +单个设置可以在复盖 `*.xml` 和 `*.conf` 在文件 `conf.d` 和 `config.d` 配置文件旁边的目录。 + +该 `replace` 或 `remove` 可以为这些配置文件的元素指定属性。 + +如果两者都未指定,则递归组合元素的内容,替换重复子项的值。 + +如果 `replace` 如果指定,则将整个元素替换为指定的元素。 + +如果 `remove` 如果指定,则删除该元素。 + +The config can also define «substitutions». If an element has the `incl` 属性时,从文件中的相应替换将被用作该值。 默认情况下,具有替换的文件的路径为 `/etc/metrika.xml`. 这可以在改变 [包括\_从](server-configuration-parameters/settings.md#server_configuration_parameters-include_from) 服务器配置中的元素。 替换值在指定 `/yandex/substitution_name` 这个文件中的元素。 如果在指定的替换 `incl` 不存在,则将其记录在日志中。 要防止ClickHouse记录丢失的替换,请指定 `optional="true"` 属性(例如,设置 [宏](#macros) server\_settings/settings.md))。 + +替换也可以从ZooKeeper执行。 为此,请指定属性 `from_zk = "/path/to/node"`. 元素值被替换为节点的内容 `/path/to/node` 在动物园管理员。 您还可以将整个XML子树放在ZooKeeper节点上,并将其完全插入到源元素中。 + +该 `config.xml` 文件可以指定具有用户设置、配置文件和配额的单独配置。 这个配置的相对路径在 ‘users\_config’ 元素。 默认情况下,它是 `users.xml`. 如果 `users_config` 被省略,用户设置,配置文件和配额直接在指定 `config.xml`. + +此外, `users_config` 可以从文件中复盖 `users_config.d` 目录(例如, `users.d`)和替换。 例如,您可以为每个用户提供单独的配置文件,如下所示: + +``` xml +$ cat /etc/clickhouse-server/users.d/alice.xml + + + + analytics + + ::/0 + + ... + analytics + + + +``` + +对于每个配置文件,服务器还会生成 `file-preprocessed.xml` 启动时的文件。 这些文件包含所有已完成的替换和复盖,并且它们旨在提供信息。 如果zookeeper替换在配置文件中使用,但ZooKeeper在服务器启动时不可用,则服务器将从预处理的文件中加载配置。 + +服务器跟踪配置文件中的更改,以及执行替换和复盖时使用的文件和ZooKeeper节点,并动态重新加载用户和集群的设置。 这意味着您可以在不重新启动服务器的情况下修改群集、用户及其设置。 + +[原始文章](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/zh/operations/configuration_files.md b/docs/zh/operations/configuration_files.md deleted file mode 100644 index 6505cfb1fb9..00000000000 --- a/docs/zh/operations/configuration_files.md +++ /dev/null @@ -1,44 +0,0 @@ - -# 配置文件 {#configuration_files} - -主服务器配置文件是 `config.xml`. 它驻留在 `/etc/clickhouse-server/` 目录。 - -单个设置可以在复盖 `*.xml` 和 `*.conf` 在文件 `conf.d` 和 `config.d` 配置文件旁边的目录。 - -该 `replace` 或 `remove` 可以为这些配置文件的元素指定属性。 - -如果两者都未指定,则递归组合元素的内容,替换重复子项的值。 - -如果 `replace` 如果指定,则将整个元素替换为指定的元素。 - -如果 `remove` 如果指定,则删除该元素。 - -The config can also define «substitutions». If an element has the `incl` 属性时,从文件中的相应替换将被用作该值。 默认情况下,具有替换的文件的路径为 `/etc/metrika.xml`. 这可以在改变 [包括\_从](server_configuration_parameters/settings.md#server_configuration_parameters-include_from) 服务器配置中的元素。 替换值在指定 `/yandex/substitution_name` 这个文件中的元素。 如果在指定的替换 `incl` 不存在,则将其记录在日志中。 要防止ClickHouse记录丢失的替换,请指定 `optional="true"` 属性(例如,设置 [宏](#macros) server\_settings/settings.md))。 - -替换也可以从ZooKeeper执行。 为此,请指定属性 `from_zk = "/path/to/node"`. 元素值被替换为节点的内容 `/path/to/node` 在动物园管理员。 您还可以将整个XML子树放在ZooKeeper节点上,并将其完全插入到源元素中。 - -该 `config.xml` 文件可以指定具有用户设置、配置文件和配额的单独配置。 这个配置的相对路径在 ‘users\_config’ 元素。 默认情况下,它是 `users.xml`. 如果 `users_config` 被省略,用户设置,配置文件和配额直接在指定 `config.xml`. - -此外, `users_config` 可以从文件中复盖 `users_config.d` 目录(例如, `users.d`)和替换。 例如,您可以为每个用户提供单独的配置文件,如下所示: - -``` xml -$ cat /etc/clickhouse-server/users.d/alice.xml - - - - analytics - - ::/0 - - ... - analytics - - - -``` - -对于每个配置文件,服务器还会生成 `file-preprocessed.xml` 启动时的文件。 这些文件包含所有已完成的替换和复盖,并且它们旨在提供信息。 如果zookeeper替换在配置文件中使用,但ZooKeeper在服务器启动时不可用,则服务器将从预处理的文件中加载配置。 - -服务器跟踪配置文件中的更改,以及执行替换和复盖时使用的文件和ZooKeeper节点,并动态重新加载用户和集群的设置。 这意味着您可以在不重新启动服务器的情况下修改群集、用户及其设置。 - -[原始文章](https://clickhouse.tech/docs/en/operations/configuration_files/) diff --git a/docs/zh/operations/index.md b/docs/zh/operations/index.md index 4d31fce45af..2544cfd1c20 100644 --- a/docs/zh/operations/index.md +++ b/docs/zh/operations/index.md @@ -1,4 +1,3 @@ - # 操作 {#operations} [原始文章](https://clickhouse.tech/docs/en/operations/) diff --git a/docs/zh/operations/monitoring.md b/docs/zh/operations/monitoring.md index 6683903f531..1db80399c36 100644 --- a/docs/zh/operations/monitoring.md +++ b/docs/zh/operations/monitoring.md @@ -1,4 +1,3 @@ - # 监控 {#jian-kong} 可以监控到: @@ -29,9 +28,9 @@ ClickHouse 收集的指标项: - 服务用于计算的资源占用的各种指标。 - 关于查询处理的常见统计信息。 -可以在 [系统。指标](system_tables.md#system_tables-metrics) ,[系统。活动](system_tables.md#system_tables-events) 以及[系统。asynchronous\_metrics](system_tables.md#system_tables-asynchronous_metrics) 等系统表查看所有的指标项。 +可以在 [系统。指标](system-tables.md#system_tables-metrics) ,[系统。活动](system-tables.md#system_tables-events) 以及[系统。asynchronous\_metrics](system-tables.md#system_tables-asynchronous_metrics) 等系统表查看所有的指标项。 -可以配置ClickHouse 往 [石墨](https://github.com/graphite-project)导入指标。 参考 [石墨部分](server_configuration_parameters/settings.md#server_configuration_parameters-graphite) 配置文件。在配置指标导出之前,需要参考Graphite[官方教程](https://graphite.readthedocs.io/en/latest/install.html)搭建服务。 +可以配置ClickHouse 往 [石墨](https://github.com/graphite-project)导入指标。 参考 [石墨部分](server-configuration-parameters/settings.md#server_configuration_parameters-graphite) 配置文件。在配置指标导出之前,需要参考Graphite[官方教程](https://graphite.readthedocs.io/en/latest/install.html)搭建服务。 此外,您可以通过HTTP API监视服务器可用性。 将HTTP GET请求发送到 `/ping`。 如果服务器可用,它将以 `200 OK` 响应。 diff --git a/docs/zh/operations/optimizing_performance/index.md b/docs/zh/operations/optimizing-performance/index.md similarity index 100% rename from docs/zh/operations/optimizing_performance/index.md rename to docs/zh/operations/optimizing-performance/index.md diff --git a/docs/zh/operations/optimizing-performance/sampling-query-profiler.md b/docs/zh/operations/optimizing-performance/sampling-query-profiler.md new file mode 100644 index 00000000000..14c3701e1e2 --- /dev/null +++ b/docs/zh/operations/optimizing-performance/sampling-query-profiler.md @@ -0,0 +1,64 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 54 +toc_title: "\u67E5\u8BE2\u5206\u6790" +--- + +# 采样查询探查器 {#sampling-query-profiler} + +ClickHouse运行允许分析查询执行的采样探查器。 使用探查器,您可以找到在查询执行期间使用最频繁的源代码例程。 您可以跟踪CPU时间和挂钟花费的时间,包括空闲时间。 + +使用概要分析器: + +- 设置 [trace\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) 服务器配置部分。 + + 本节配置 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) 系统表包含探查器运行的结果。 它是默认配置的。 请记住,此表中的数据仅对正在运行的服务器有效。 服务器重新启动后,ClickHouse不会清理表,所有存储的虚拟内存地址都可能无效。 + +- 设置 [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) 或 [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) 设置。 这两种设置可以同时使用。 + + 这些设置允许您配置探查器计时器。 由于这些是会话设置,您可以为整个服务器、单个用户或用户配置文件、交互式会话以及每个单个查询获取不同的采样频率。 + +默认采样频率为每秒一个采样,CPU和实时定时器都启用。 该频率允许收集有关ClickHouse集群的足够信息。 同时,使用此频率,profiler不会影响ClickHouse服务器的性能。 如果您需要分析每个单独的查询,请尝试使用更高的采样频率。 + +分析 `trace_log` 系统表: + +- 安装 `clickhouse-common-static-dbg` 包。 看 [从DEB软件包安装](../../getting-started/install.md#install-from-deb-packages). + +- 允许由内省功能 [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) 设置。 + + 出于安全原因,默认情况下禁用内省功能。 + +- 使用 `addressToLine`, `addressToSymbol` 和 `demangle` [内省功能](../../sql-reference/functions/introspection.md) 获取函数名称及其在ClickHouse代码中的位置。 要获取某些查询的配置文件,您需要从以下内容汇总数据 `trace_log` 桌子 您可以通过单个函数或整个堆栈跟踪聚合数据。 + +如果你需要想象 `trace_log` 信息,尝试 [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) 和 [测速镜](https://github.com/laplab/clickhouse-speedscope). + +## 示例 {#example} + +在这个例子中,我们: + +- 过滤 `trace_log` 数据由查询标识符和当前日期组成。 + +- 通过堆栈跟踪聚合。 + +- 使用内省功能,我们将得到一个报告: + + - 符号名称和相应的源代码函数。 + - 这些函数的源代码位置。 + + + +``` sql +SELECT + count(), + arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym +FROM system.trace_log +WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) +GROUP BY trace +ORDER BY count() DESC +LIMIT 10 +``` + +``` text +{% include "examples/sampling_query_profiler_result.txt" %} +``` diff --git a/docs/zh/operations/optimizing_performance/sampling_query_profiler.md b/docs/zh/operations/optimizing_performance/sampling_query_profiler.md deleted file mode 100644 index e5aa92c16cb..00000000000 --- a/docs/zh/operations/optimizing_performance/sampling_query_profiler.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 54 -toc_title: "\u67E5\u8BE2\u5206\u6790" ---- - -# 采样查询探查器 {#sampling-query-profiler} - -ClickHouse运行允许分析查询执行的采样探查器。 使用探查器,您可以找到在查询执行期间使用最频繁的源代码例程。 您可以跟踪CPU时间和挂钟花费的时间,包括空闲时间。 - -使用概要分析器: - -- 设置 [trace\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) 服务器配置部分。 - - 本节配置 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) 系统表包含探查器运行的结果。 它是默认配置的。 请记住,此表中的数据仅对正在运行的服务器有效。 服务器重新启动后,ClickHouse不会清理表,所有存储的虚拟内存地址都可能无效。 - -- 设置 [query\_profiler\_cpu\_time\_period\_ns](../settings/settings.md#query_profiler_cpu_time_period_ns) 或 [query\_profiler\_real\_time\_period\_ns](../settings/settings.md#query_profiler_real_time_period_ns) 设置。 这两种设置可以同时使用。 - - 这些设置允许您配置探查器计时器。 由于这些是会话设置,您可以为整个服务器、单个用户或用户配置文件、交互式会话以及每个单个查询获取不同的采样频率。 - -默认采样频率为每秒一个采样,CPU和实时定时器都启用。 该频率允许收集有关ClickHouse集群的足够信息。 同时,使用此频率,profiler不会影响ClickHouse服务器的性能。 如果您需要分析每个单独的查询,请尝试使用更高的采样频率。 - -分析 `trace_log` 系统表: - -- 安装 `clickhouse-common-static-dbg` 包。 看 [从DEB软件包安装](../../getting_started/install.md#install-from-deb-packages). - -- 允许由内省功能 [allow\_introspection\_functions](../settings/settings.md#settings-allow_introspection_functions) 设置。 - - 出于安全原因,默认情况下禁用内省功能。 - -- 使用 `addressToLine`, `addressToSymbol` 和 `demangle` [内省功能](../../sql_reference/functions/introspection.md) 获取函数名称及其在ClickHouse代码中的位置。 要获取某些查询的配置文件,您需要从以下内容汇总数据 `trace_log` 桌子 您可以通过单个函数或整个堆栈跟踪聚合数据。 - -如果你需要想象 `trace_log` 信息,尝试 [flamegraph](../../interfaces/third-party/gui/#clickhouse-flamegraph) 和 [测速镜](https://github.com/laplab/clickhouse-speedscope). - -## 示例 {#example} - -在这个例子中,我们: - -- 过滤 `trace_log` 数据由查询标识符和当前日期组成。 - -- 通过堆栈跟踪聚合。 - -- 使用内省功能,我们将得到一个报告: - - - 符号名称和相应的源代码函数。 - - 这些函数的源代码位置。 - - - -``` sql -SELECT - count(), - arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym -FROM system.trace_log -WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today()) -GROUP BY trace -ORDER BY count() DESC -LIMIT 10 -``` - -``` text -{% include "examples/sampling_query_profiler_result.txt" %} -``` diff --git a/docs/zh/operations/performance-test.md b/docs/zh/operations/performance-test.md new file mode 100644 index 00000000000..7445a445951 --- /dev/null +++ b/docs/zh/operations/performance-test.md @@ -0,0 +1,82 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 54 +toc_title: "\u6D4B\u8BD5\u786C\u4EF6" +--- + +# 如何使用ClickHouse测试您的硬件 {#how-to-test-your-hardware-with-clickhouse} + +使用此指令,您可以在任何服务器上运行基本的ClickHouse性能测试,而无需安装ClickHouse软件包。 + +1. 转到 “commits” 页数:https://github.com/ClickHouse/ClickHouse/commits/master + +2. 点击第一个绿色复选标记或红色十字与绿色 “ClickHouse Build Check” 然后点击 “Details” 附近链接 “ClickHouse Build Check”. 在一些提交中没有这样的链接,例如与文档的提交。 在这种情况下,请选择具有此链接的最近提交。 + +3. 将链接复制到 “clickhouse” 二进制为amd64或aarch64. + +4. ssh到服务器并使用wget下载它: + + + + # For amd64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse + # For aarch64: + wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse + # Then do: + chmod a+x clickhouse + +1. 下载配置: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml + mkdir config.d + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml + +1. 下载基准测试文件: + + + + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh + chmod a+x benchmark-new.sh + wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql + +1. 根据下载测试数据 [Yandex梅里卡数据集](../getting-started/example-datasets/metrica.md) 说明 (“hits” 表包含100万行)。 + + + + wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz + tar xvf hits_100m_obfuscated_v1.tar.xz -C . + mv hits_100m_obfuscated_v1/* . + +1. 运行服务器: + + + + ./clickhouse server + +1. 检查数据:ssh到另一个终端中的服务器 + + + + ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" + 100000000 + +1. 编辑benchmark-new.sh,改变 “clickhouse-client” 到 “./clickhouse client” 并添加 “–max\_memory\_usage 100000000000” 参数。 + + + + mcedit benchmark-new.sh + +1. 运行基准测试: + + + + ./benchmark-new.sh hits_100m_obfuscated + +1. 将有关硬件配置的编号和信息发送到clickhouse-feedback@yandex-team.com + +所有结果都在这里公布:https://clickhouse.技术/benchmark\_hardware.html diff --git a/docs/zh/operations/performance_test.md b/docs/zh/operations/performance_test.md deleted file mode 100644 index f567a9528a0..00000000000 --- a/docs/zh/operations/performance_test.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 54 -toc_title: "\u6D4B\u8BD5\u786C\u4EF6" ---- - -# 如何使用ClickHouse测试您的硬件 {#how-to-test-your-hardware-with-clickhouse} - -使用此指令,您可以在任何服务器上运行基本的ClickHouse性能测试,而无需安装ClickHouse软件包。 - -1. 转到 “commits” 页数:https://github.com/ClickHouse/ClickHouse/commits/master - -2. 点击第一个绿色复选标记或红色十字与绿色 “ClickHouse Build Check” 然后点击 “Details” 附近链接 “ClickHouse Build Check”. 在一些提交中没有这样的链接,例如与文档的提交。 在这种情况下,请选择具有此链接的最近提交。 - -3. 将链接复制到 “clickhouse” 二进制为amd64或aarch64. - -4. ssh到服务器并使用wget下载它: - - - - # For amd64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578163263_binary/clickhouse - # For aarch64: - wget https://clickhouse-builds.s3.yandex.net/0/00ba767f5d2a929394ea3be193b1f79074a1c4bc/1578161264_binary/clickhouse - # Then do: - chmod a+x clickhouse - -1. 下载配置: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/users.xml - mkdir config.d - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/path.xml -O config.d/path.xml - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/programs/server/config.d/log_to_console.xml -O config.d/log_to_console.xml - -1. 下载基准测试文件: - - - - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/benchmark-new.sh - chmod a+x benchmark-new.sh - wget https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/benchmark/clickhouse/queries.sql - -1. 根据下载测试数据 [Yandex梅里卡数据集](../getting_started/example_datasets/metrica.md) 说明 (“hits” 表包含100万行)。 - - - - wget https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_100m_obfuscated_v1.tar.xz - tar xvf hits_100m_obfuscated_v1.tar.xz -C . - mv hits_100m_obfuscated_v1/* . - -1. 运行服务器: - - - - ./clickhouse server - -1. 检查数据:ssh到另一个终端中的服务器 - - - - ./clickhouse client --query "SELECT count() FROM hits_100m_obfuscated" - 100000000 - -1. 编辑benchmark-new.sh,改变 “clickhouse-client” 到 “./clickhouse client” 并添加 “–max\_memory\_usage 100000000000” 参数。 - - - - mcedit benchmark-new.sh - -1. 运行基准测试: - - - - ./benchmark-new.sh hits_100m_obfuscated - -1. 将有关硬件配置的编号和信息发送到clickhouse-feedback@yandex-team.com - -所有结果都在这里公布:https://clickhouse.技术/benchmark\_hardware.html diff --git a/docs/zh/operations/quotas.md b/docs/zh/operations/quotas.md index 3838da00e56..21405ae106f 100644 --- a/docs/zh/operations/quotas.md +++ b/docs/zh/operations/quotas.md @@ -1,4 +1,3 @@ - # 配额 {#quotas} 配额允许您在一段时间内限制资源使用情况,或者只是跟踪资源的使用。 diff --git a/docs/zh/operations/requirements.md b/docs/zh/operations/requirements.md index d48de98f85c..00ed3a43c04 100644 --- a/docs/zh/operations/requirements.md +++ b/docs/zh/operations/requirements.md @@ -24,9 +24,9 @@ RAM所需的体积取决于: - 查询的复杂性。 - 在查询中处理的数据量。 -要计算所需的RAM体积,您应该估计临时数据的大小 [GROUP BY](../sql_reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql_reference/statements/select.md#select-distinct), [JOIN](../sql_reference/statements/select.md#select-join) 和您使用的其他操作。 +要计算所需的RAM体积,您应该估计临时数据的大小 [GROUP BY](../sql-reference/statements/select.md#select-group-by-clause), [DISTINCT](../sql-reference/statements/select.md#select-distinct), [JOIN](../sql-reference/statements/select.md#select-join) 和您使用的其他操作。 -ClickHouse可以使用外部存储器来存储临时数据。 看 [在外部存储器中分组](../sql_reference/statements/select.md#select-group-by-in-external-memory) 有关详细信息。 +ClickHouse可以使用外部存储器来存储临时数据。 看 [在外部存储器中分组](../sql-reference/statements/select.md#select-group-by-in-external-memory) 有关详细信息。 ## 交换文件 {#swap-file} @@ -58,4 +58,4 @@ ClickHouse可以使用外部存储器来存储临时数据。 看 [在外部存 ClickHouse主要是为Linux系列操作系统开发的。 推荐的Linux发行版是Ubuntu。 该 `tzdata` 软件包应安装在系统中。 -ClickHouse也可以在其他操作系统系列中工作。 查看详细信息 [开始](../getting_started/index.md) 文档的部分。 +ClickHouse也可以在其他操作系统系列中工作。 查看详细信息 [开始](../getting-started/index.md) 文档的部分。 diff --git a/docs/zh/operations/server-configuration-parameters/index.md b/docs/zh/operations/server-configuration-parameters/index.md new file mode 100644 index 00000000000..82e698055fa --- /dev/null +++ b/docs/zh/operations/server-configuration-parameters/index.md @@ -0,0 +1,11 @@ +# 服务器配置参数 {#server-settings} + +本节包含无法在会话或查询级别更改的服务器设置的说明。 + +这些设置存储在 `config.xml` ClickHouse服务器上的文件。 + +Other settings are described in the «[设置](../settings/index.md#settings)» section. + +在研究设置之前,请阅读 [配置文件](../configuration-files.md#configuration_files) 部分和注意使用替换(的 `incl` 和 `optional` 属性)。 + +[原始文章](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/zh/operations/server-configuration-parameters/settings.md b/docs/zh/operations/server-configuration-parameters/settings.md new file mode 100644 index 00000000000..09782717af4 --- /dev/null +++ b/docs/zh/operations/server-configuration-parameters/settings.md @@ -0,0 +1,870 @@ +--- +toc_priority: 57 +toc_title: "\u670D\u52A1\u5668\u8BBE\u7F6E" +--- + +# 服务器配置 {#server-settings} + +## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} + +重新加载内置字典的间隔时间(以秒为单位)。 + +ClickHouse每x秒重新加载内置字典。 这使得编辑字典 “on the fly”,而无需重新启动服务器。 + +默认值:3600. + +**示例** + +``` xml +3600 +``` + +## 压缩 {#server-settings-compression} + +数据压缩配置 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-引擎表。 + +!!! warning "警告" + 如果您刚开始使用ClickHouse,请不要使用它。 + +配置模板: + +``` xml + + + ... + ... + ... + + ... + +``` + +`` 参数: + +- `min_part_size` – The minimum size of a data part. +- `min_part_size_ratio` – The ratio of the data part size to the table size. +- `method` – Compression method. Acceptable values: `lz4` 或 `zstd`. + +您可以配置多个 `` 部分。 + +满足条件时的操作: + +- 如果数据部分与条件集匹配,ClickHouse将使用指定的压缩方法。 +- 如果数据部分匹配多个条件集,ClickHouse将使用第一个匹配的条件集。 + +如果没有满足数据部分的条件,ClickHouse使用 `lz4` 压缩。 + +**示例** + +``` xml + + + 10000000000 + 0.01 + zstd + + +``` + +## default\_database {#default-database} + +默认数据库。 + +要获取数据库列表,请使用 [SHOW DATABASES](../../sql-reference/statements/show.md#show-databases) 查询。 + +**示例** + +``` xml +default +``` + +## default\_profile {#default-profile} + +默认配置文件。 + +配置文件位于`user_config`参数指定的文件中 . + +**示例** + +``` xml +default +``` + +## dictionaries\_config {#server_configuration_parameters-dictionaries_config} + +外部字典的配置文件的路径。 + +路径: + +- 指定相对于服务器配置文件的绝对路径或路径。 +- 路径可以包含通配符\*和?. + +另请参阅 “[外部字典](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md)”. + +**示例** + +``` xml +*_dictionary.xml +``` + +## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} + +延迟加载字典。 + +如果 `true`,然后在第一次使用时创建每个字典。 如果字典创建失败,则使用该字典的函数将引发异常。 + +如果 `false`,服务器启动时创建所有字典,如果出现错误,服务器将关闭。 + +默认值为 `true`. + +**示例** + +``` xml +true +``` + +## format\_schema\_path {#server_configuration_parameters-format_schema_path} + +包含输入数据方案的目录路径,例如输入数据的方案 [CapnProto](../../interfaces/formats.md#capnproto) 格式。 + +**示例** + +``` xml + + format_schemas/ +``` + +## 石墨 {#server_configuration_parameters-graphite} + +将数据发送到 [石墨](https://github.com/graphite-project). + +设置: + +- host – The Graphite server. +- port – The port on the Graphite server. +- interval – The interval for sending, in seconds. +- timeout – The timeout for sending data, in seconds. +- root\_path – Prefix for keys. +- metrics – Sending data from the [系统。指标](../../operations/system-tables.md#system_tables-metrics) 桌子 +- events – Sending deltas data accumulated for the time period from the [系统。活动](../../operations/system-tables.md#system_tables-events) 桌子 +- events\_cumulative – Sending cumulative data from the [系统。活动](../../operations/system-tables.md#system_tables-events) 桌子 +- asynchronous\_metrics – Sending data from the [系统。asynchronous\_metrics](../../operations/system-tables.md#system_tables-asynchronous_metrics) 桌子 + +您可以配置多个 `` 条款 例如,您可以使用它以不同的时间间隔发送不同的数据。 + +**示例** + +``` xml + + localhost + 42000 + 0.1 + 60 + one_min + true + true + false + true + +``` + +## graphite\_rollup {#server_configuration_parameters-graphite-rollup} + +石墨细化数据的设置。 + +有关详细信息,请参阅 [GraphiteMergeTree](../../engines/table-engines/mergetree-family/graphitemergetree.md). + +**示例** + +``` xml + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + +``` + +## http\_port/https\_port {#http-porthttps-port} + +通过HTTP连接到服务器的端口。 + +如果 `https_port` 被指定, [openSSL](#server_configuration_parameters-openssl) 必须配置。 + +如果 `http_port` 指定时,即使设置了OpenSSL配置,也会忽略该配置。 + +**示例** + +``` xml +0000 +``` + +## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} + +访问ClickHouse HTTP(s)服务器时默认显示的页面。 +默认值为 “Ok.” (最后有换行符) + +**示例** + +打开 `https://tabix.io/` 访问时 `http://localhost: http_port`. + +``` xml + +
]]> +
+``` + +## 包括\_从 {#server_configuration_parameters-include_from} + +带替换的文件的路径。 + +有关详细信息,请参阅部分 “[配置文件](../configuration-files.md#configuration_files)”. + +**示例** + +``` xml +/etc/metrica.xml +``` + +## interserver\_http\_port {#interserver-http-port} + +用于在ClickHouse服务器之间交换数据的端口。 + +**示例** + +``` xml +9009 +``` + +## interserver\_http\_host {#interserver-http-host} + +其他服务器可用于访问此服务器的主机名。 + +如果省略,它以相同的方式作为定义 `hostname-f` 指挥部 + +用于脱离特定的网络接口。 + +**示例** + +``` xml +example.yandex.ru +``` + +## interserver\_http\_credentials {#server-settings-interserver-http-credentials} + +用户名和密码用于在以下期间进行身份验证 [复制](../../engines/table-engines/mergetree-family/replication.md) 与复制\*引擎。 这些凭据仅用于副本之间的通信,与ClickHouse客户端的凭据无关。 服务器正在检查这些凭据以连接副本,并在连接到其他副本时使用相同的凭据。 因此,这些凭据应该为集群中的所有副本设置相同。 +默认情况下,不使用身份验证。 + +本节包含以下参数: + +- `user` — username. +- `password` — password. + +**示例** + +``` xml + + admin + 222 + +``` + +## keep\_alive\_timeout {#keep-alive-timeout} + +ClickHouse在关闭连接之前等待传入请求的秒数。 默认为3秒。 + +**示例** + +``` xml +3 +``` + +## listen\_host {#server_configuration_parameters-listen_host} + +对请求可能来自的主机的限制。 如果您希望服务器回答所有这些问题,请指定 `::`. + +例: + +``` xml +::1 +127.0.0.1 +``` + +## 记录器 {#server_configuration_parameters-logger} + +日志记录设置。 + +键: + +- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. +- log – The log file. Contains all the entries according to `level`. +- errorlog – Error log file. +- size – Size of the file. Applies to `log`和`errorlog`. 一旦文件到达 `size`,ClickHouse存档并重命名它,并在其位置创建一个新的日志文件。 +- count – The number of archived log files that ClickHouse stores. + +**示例** + +``` xml + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + +``` + +还支持写入系统日志。 配置示例: + +``` xml + + 1 + +
syslog.remote:10514
+ myhost.local + LOG_LOCAL6 + syslog +
+
+``` + +键: + +- use\_syslog — Required setting if you want to write to the syslog. +- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. +- hostname — Optional. The name of the host that logs are sent from. +- facility — [系统日志工具关键字](https://en.wikipedia.org/wiki/Syslog#Facility) 在大写字母与 “LOG\_” 前缀: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`,等等)。 + 默认值: `LOG_USER` 如果 `address` 被指定, `LOG_DAEMON otherwise.` +- format – Message format. Possible values: `bsd` 和 `syslog.` + +## 宏 {#macros} + +复制表的参数替换。 + +如果不使用复制的表,则可以省略。 + +有关详细信息,请参阅部分 “[创建复制的表](../../engines/table-engines/mergetree-family/replication.md)”. + +**示例** + +``` xml + +``` + +## mark\_cache\_size {#server-mark-cache-size} + +表引擎使用的标记缓存的近似大小(以字节为单位) [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) 家人 + +缓存为服务器共享,并根据需要分配内存。 缓存大小必须至少为5368709120。 + +**示例** + +``` xml +5368709120 +``` + +## max\_concurrent\_queries {#max-concurrent-queries} + +同时处理的请求的最大数量。 + +**示例** + +``` xml +100 +``` + +## max\_connections {#max-connections} + +入站连接的最大数量。 + +**示例** + +``` xml +4096 +``` + +## max\_open\_files {#max-open-files} + +打开文件的最大数量。 + +默认情况下: `maximum`. + +我们建议在Mac OS X中使用此选项,因为 `getrlimit()` 函数返回一个不正确的值。 + +**示例** + +``` xml +262144 +``` + +## max\_table\_size\_to\_drop {#max-table-size-to-drop} + +限制删除表。 + +如果一个大小 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) 表超过 `max_table_size_to_drop` (以字节为单位),您无法使用删除查询将其删除。 + +如果仍然需要在不重新启动ClickHouse服务器的情况下删除表,请创建 `/flags/force_drop_table` 文件并运行DROP查询。 + +默认值:50GB。 + +值0表示您可以删除所有表而不受任何限制。 + +**示例** + +``` xml +0 +``` + +## merge\_tree {#server_configuration_parameters-merge_tree} + +微调中的表 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +有关详细信息,请参阅MergeTreeSettings。h头文件。 + +**示例** + +``` xml + + 5 + +``` + +## openSSL {#server_configuration_parameters-openssl} + +SSL客户端/服务器配置。 + +对SSL的支持由 `libpoco` 图书馆. 该接口在文件中描述 [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) + +服务器/客户端设置的密钥: + +- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. +- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` 包含证书。 +- caConfig – The path to the file or directory that contains trusted root certificates. +- verificationMode – The method for checking the node’s certificates. Details are in the description of the [A.背景](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) 同学们 可能的值: `none`, `relaxed`, `strict`, `once`. +- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. +- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| +- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. +- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. 可接受的值: `true`, `false`. +- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. 始终建议使用此参数,因为如果服务器缓存会话,以及客户端请求缓存,它有助于避免出现问题。 默认值: `${application.name}`. +- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. +- sessionTimeout – Time for caching the session on the server. +- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. +- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. +- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. +- fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS. +- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. +- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . +- disableProtocols – Protocols that are not allowed to use. +- preferServerCiphers – Preferred server ciphers on the client. + +**设置示例:** + +``` xml + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + /etc/clickhouse-server/dhparam.pem + none + true + true + sslv2,sslv3 + true + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + +``` + +## part\_log {#server_configuration_parameters-part-log} + +记录与之关联的事件 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). 例如,添加或合并数据。 您可以使用日志来模拟合并算法并比较它们的特征。 您可以可视化合并过程。 + +查询记录在 [系统。part\_log](../../operations/system-tables.md#system_tables-part-log) 表,而不是在一个单独的文件。 您可以在以下命令中配置此表的名称 `table` 参数(见下文)。 + +使用以下参数配置日志记录: + +- `database` – Name of the database. +- `table` – Name of the system table. +- `partition_by` – Sets a [自定义分区键](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +**示例** + +``` xml + + system + part_log
+ toMonday(event_date) + 7500 +
+``` + +## 路径 {#server_configuration_parameters-path} + +包含数据的目录的路径。 + +!!! note "注" + 尾部斜杠是强制性的。 + +**示例** + +``` xml +/var/lib/clickhouse/ +``` + +## query\_log {#server_configuration_parameters-query-log} + +用于记录接收到的查询的设置 [log\_queries=1](../settings/settings.md) 设置。 + +查询记录在 [系统。query\_log](../../operations/system-tables.md#system_tables-query_log) 表,而不是在一个单独的文件。 您可以更改表的名称 `table` 参数(见下文)。 + +使用以下参数配置日志记录: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [自定义分区键](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) 为了一张桌子 +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +如果该表不存在,ClickHouse将创建它。 如果在ClickHouse服务器更新时查询日志的结构发生了更改,则会重命名具有旧结构的表,并自动创建新表。 + +**示例** + +``` xml + + system + query_log
+ toMonday(event_date) + 7500 +
+``` + +## query\_thread\_log {#server_configuration_parameters-query-thread-log} + +设置用于记录接收到的查询的线程 [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) 设置。 + +查询记录在 [系统。query\_thread\_log](../../operations/system-tables.md#system_tables-query-thread-log) 表,而不是在一个单独的文件。 您可以更改表的名称 `table` 参数(见下文)。 + +使用以下参数配置日志记录: + +- `database` – Name of the database. +- `table` – Name of the system table the queries will be logged in. +- `partition_by` – Sets a [自定义分区键](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) 对于一个系统表。 +- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. + +如果该表不存在,ClickHouse将创建它。 如果更新ClickHouse服务器时查询线程日志的结构发生了更改,则会重命名具有旧结构的表,并自动创建新表。 + +**示例** + +``` xml + + system + query_thread_log
+ toMonday(event_date) + 7500 +
+``` + +## trace\_log {#server_configuration_parameters-trace_log} + +设置为 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) 系统表操作。 + +参数: + +- `database` — Database for storing a table. +- `table` — Table name. +- `partition_by` — [自定义分区键](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) 对于一个系统表。 +- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. + +默认服务器配置文件 `config.xml` 包含以下设置部分: + +``` xml + + system + trace_log
+ toYYYYMM(event_date) + 7500 +
+``` + +## query\_masking\_rules {#query-masking-rules} + +基于正则表达式的规则,在将查询以及所有日志消息存储在服务器日志中之前,这些规则将应用于查询以及所有日志消息, +`system.query_log`, `system.text_log`, `system.processes` 表,并在日志中发送给客户端。 这允许防止 +从SQL查询敏感数据泄漏(如姓名,电子邮件,个人 +标识符或信用卡号码)记录。 + +**示例** + +``` xml + + + hide SSN + (^|\D)\d{3}-\d{2}-\d{4}($|\D) + 000-00-0000 + + +``` + +配置字段: +- `name` -规则的名称(可选) +- `regexp` -RE2兼容正则表达式(强制性) +- `replace` -敏感数据的替换字符串(可选,默认情况下-六个星号) + +屏蔽规则应用于整个查询(以防止敏感数据从格式错误/不可解析的查询泄漏)。 + +`system.events` 表有计数器 `QueryMaskingRulesMatch` 其中具有匹配的查询屏蔽规则的总数。 + +对于分布式查询,每个服务器必须单独配置,否则,子查询传递给其他 +节点将被存储而不屏蔽。 + +## remote\_servers {#server-settings-remote-servers} + +所使用的集群的配置 [分布](../../engines/table-engines/special/distributed.md) 表引擎和由 `cluster` 表功能。 + +**示例** + +``` xml + +``` + +对于该值 `incl` 属性,请参阅部分 “[配置文件](../configuration-files.md#configuration_files)”. + +**另请参阅** + +- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) + +## 时区 {#server_configuration_parameters-timezone} + +服务器的时区。 + +指定为UTC时区或地理位置(例如,非洲/阿比让)的IANA标识符。 + +当DateTime字段输出为文本格式(打印在屏幕上或文件中)时,以及从字符串获取DateTime时,时区对于字符串和DateTime格式之间的转换是必需的。 此外,如果在输入参数中没有收到时区,则时区用于处理时间和日期的函数。 + +**示例** + +``` xml +Europe/Moscow +``` + +## tcp\_port {#server_configuration_parameters-tcp_port} + +通过TCP协议与客户端通信的端口。 + +**示例** + +``` xml +9000 +``` + +## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} + +TCP端口,用于与客户端进行安全通信。 使用它与 [OpenSSL](#server_configuration_parameters-openssl) 设置。 + +**可能的值** + +整数。 + +**默认值** + +``` xml +9440 +``` + +## mysql\_port {#server_configuration_parameters-mysql_port} + +通过MySQL协议与客户端通信的端口。 + +**可能的值** + +整数。 + +示例 + +``` xml +9004 +``` + +## tmp\_path {#server-settings-tmp_path} + +用于处理大型查询的临时数据的路径。 + +!!! note "注" + 尾部斜杠是强制性的。 + +**示例** + +``` xml +/var/lib/clickhouse/tmp/ +``` + +## tmp\_policy {#server-settings-tmp-policy} + +从政策 [`storage_configuration`](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) 存储临时文件。 +如果没有设置 [`tmp_path`](#server-settings-tmp_path) 被使用,否则被忽略。 + +!!! note "注" + - `move_factor` 被忽略 +- `keep_free_space_bytes` 被忽略 +- `max_data_part_size_bytes` 被忽略 +-您必须在该政策中只有一个卷 + +## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} + +表引擎使用的未压缩数据的缓存大小(以字节为单位) [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). + +服务器有一个共享缓存。 内存按需分配。 如果选项使用缓存 [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) 被启用。 + +在个别情况下,未压缩的缓存对于非常短的查询是有利的。 + +**示例** + +``` xml +8589934592 +``` + +## user\_files\_path {#server_configuration_parameters-user_files_path} + +包含用户文件的目录。 在表函数中使用 [文件()](../../sql-reference/table-functions/file.md). + +**示例** + +``` xml +/var/lib/clickhouse/user_files/ +``` + +## users\_config {#users-config} + +包含文件的路径: + +- 用户配置。 +- 访问权限。 +- 设置配置文件。 +- 配额设置。 + +**示例** + +``` xml +users.xml +``` + +## zookeeper {#server-settings_zookeeper} + +包含允许ClickHouse与 [zookpeer](http://zookeeper.apache.org/) 集群。 + +ClickHouse使用ZooKeeper存储复制表副本的元数据。 如果未使用复制的表,则可以省略此部分参数。 + +本节包含以下参数: + +- `node` — ZooKeeper endpoint. You can set multiple endpoints. + + 例如: + + + +``` xml + + example_host + 2181 + +``` + + The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. + +- `session_timeout` — Maximum timeout for the client session in milliseconds. +- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) 隆隆隆隆路虏脢..陇.貌.垄拢卢虏禄.陇.貌路.隆拢脳枚脢虏.麓脢for脱 可选。 +- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. + +**配置示例** + +``` xml + + + example1 + 2181 + + + example2 + 2181 + + 30000 + 10000 + + /path/to/zookeeper/node + + user:password + +``` + +**另请参阅** + +- [复制](../../engines/table-engines/mergetree-family/replication.md) +- [动物园管理员程序员指南](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) + +## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} + +ZooKeeper中数据部分头的存储方法。 + +此设置仅适用于 `MergeTree` 家人 它可以指定: + +- 在全球范围内 [merge\_tree](#server_configuration_parameters-merge_tree) 一节 `config.xml` 文件 + + ClickHouse使用服务器上所有表的设置。 您可以随时更改设置。 当设置更改时,现有表会更改其行为。 + +- 对于每个表。 + + 创建表时,指定相应的 [发动机设置](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). 即使全局设置更改,具有此设置的现有表的行为也不会更改。 + +**可能的值** + +- 0 — Functionality is turned off. +- 1 — Functionality is turned on. + +如果 `use_minimalistic_part_header_in_zookeeper = 1`,然后 [复制](../../engines/table-engines/mergetree-family/replication.md) 表存储的数据部分的头紧凑使用一个单一的 `znode`. 如果表包含许多列,则此存储方法显着减少了Zookeeper中存储的数据量。 + +!!! attention "注意" + 申请后 `use_minimalistic_part_header_in_zookeeper = 1`,您不能将ClickHouse服务器降级到不支持此设置的版本。 在集群中的服务器上升级ClickHouse时要小心。 不要一次升级所有服务器。 在测试环境中或在集群的几台服务器上测试ClickHouse的新版本更安全。 + + Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. + +**默认值:** 0. + +## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} + +禁用内部DNS缓存。 推荐用于在系统中运行ClickHouse +随着频繁变化的基础设施,如Kubernetes。 + +**默认值:** 0. + +## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} + +更新存储在ClickHouse内部DNS缓存中的IP地址的周期(以秒为单位)。 +更新是在一个单独的系统线程中异步执行的。 + +**默认值**: 15. + +[原始文章](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/zh/operations/server_configuration_parameters/index.md b/docs/zh/operations/server_configuration_parameters/index.md deleted file mode 100644 index cf3f158b37c..00000000000 --- a/docs/zh/operations/server_configuration_parameters/index.md +++ /dev/null @@ -1,12 +0,0 @@ - -# 服务器配置参数 {#server-settings} - -本节包含无法在会话或查询级别更改的服务器设置的说明。 - -这些设置存储在 `config.xml` ClickHouse服务器上的文件。 - -Other settings are described in the «[设置](../settings/index.md#settings)» section. - -在研究设置之前,请阅读 [配置文件](../configuration_files.md#configuration_files) 部分和注意使用替换(的 `incl` 和 `optional` 属性)。 - -[原始文章](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/) diff --git a/docs/zh/operations/server_configuration_parameters/settings.md b/docs/zh/operations/server_configuration_parameters/settings.md deleted file mode 100644 index f10b6311b27..00000000000 --- a/docs/zh/operations/server_configuration_parameters/settings.md +++ /dev/null @@ -1,870 +0,0 @@ ---- -toc_priority: 57 -toc_title: "\u670D\u52A1\u5668\u8BBE\u7F6E" ---- - -# 服务器配置 {#server-settings} - -## builtin\_dictionaries\_reload\_interval {#builtin-dictionaries-reload-interval} - -重新加载内置字典的间隔时间(以秒为单位)。 - -ClickHouse每x秒重新加载内置字典。 这使得编辑字典 “on the fly”,而无需重新启动服务器。 - -默认值:3600. - -**示例** - -``` xml -3600 -``` - -## 压缩 {#server-settings-compression} - -数据压缩配置 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-引擎表。 - -!!! warning "警告" - 如果您刚开始使用ClickHouse,请不要使用它。 - -配置模板: - -``` xml - - - ... - ... - ... - - ... - -``` - -`` 参数: - -- `min_part_size` – The minimum size of a data part. -- `min_part_size_ratio` – The ratio of the data part size to the table size. -- `method` – Compression method. Acceptable values: `lz4` 或 `zstd`. - -您可以配置多个 `` 部分。 - -满足条件时的操作: - -- 如果数据部分与条件集匹配,ClickHouse将使用指定的压缩方法。 -- 如果数据部分匹配多个条件集,ClickHouse将使用第一个匹配的条件集。 - -如果没有满足数据部分的条件,ClickHouse使用 `lz4` 压缩。 - -**示例** - -``` xml - - - 10000000000 - 0.01 - zstd - - -``` - -## default\_database {#default-database} - -默认数据库。 - -要获取数据库列表,请使用 [SHOW DATABASES](../../sql_reference/statements/show.md#show-databases) 查询。 - -**示例** - -``` xml -default -``` - -## default\_profile {#default-profile} - -默认配置文件。 - -配置文件位于`user_config`参数指定的文件中 . - -**示例** - -``` xml -default -``` - -## dictionaries\_config {#server_configuration_parameters-dictionaries_config} - -外部字典的配置文件的路径。 - -路径: - -- 指定相对于服务器配置文件的绝对路径或路径。 -- 路径可以包含通配符\*和?. - -另请参阅 “[外部字典](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md)”. - -**示例** - -``` xml -*_dictionary.xml -``` - -## dictionaries\_lazy\_load {#server_configuration_parameters-dictionaries_lazy_load} - -延迟加载字典。 - -如果 `true`,然后在第一次使用时创建每个字典。 如果字典创建失败,则使用该字典的函数将引发异常。 - -如果 `false`,服务器启动时创建所有字典,如果出现错误,服务器将关闭。 - -默认值为 `true`. - -**示例** - -``` xml -true -``` - -## format\_schema\_path {#server_configuration_parameters-format_schema_path} - -包含输入数据方案的目录路径,例如输入数据的方案 [CapnProto](../../interfaces/formats.md#capnproto) 格式。 - -**示例** - -``` xml - - format_schemas/ -``` - -## 石墨 {#server_configuration_parameters-graphite} - -将数据发送到 [石墨](https://github.com/graphite-project). - -设置: - -- host – The Graphite server. -- port – The port on the Graphite server. -- interval – The interval for sending, in seconds. -- timeout – The timeout for sending data, in seconds. -- root\_path – Prefix for keys. -- metrics – Sending data from the [系统。指标](../../operations/system_tables.md#system_tables-metrics) 桌子 -- events – Sending deltas data accumulated for the time period from the [系统。活动](../../operations/system_tables.md#system_tables-events) 桌子 -- events\_cumulative – Sending cumulative data from the [系统。活动](../../operations/system_tables.md#system_tables-events) 桌子 -- asynchronous\_metrics – Sending data from the [系统。asynchronous\_metrics](../../operations/system_tables.md#system_tables-asynchronous_metrics) 桌子 - -您可以配置多个 `` 条款 例如,您可以使用它以不同的时间间隔发送不同的数据。 - -**示例** - -``` xml - - localhost - 42000 - 0.1 - 60 - one_min - true - true - false - true - -``` - -## graphite\_rollup {#server_configuration_parameters-graphite-rollup} - -石墨细化数据的设置。 - -有关详细信息,请参阅 [GraphiteMergeTree](../../engines/table_engines/mergetree_family/graphitemergetree.md). - -**示例** - -``` xml - - - max - - 0 - 60 - - - 3600 - 300 - - - 86400 - 3600 - - - -``` - -## http\_port/https\_port {#http-porthttps-port} - -通过HTTP连接到服务器的端口。 - -如果 `https_port` 被指定, [openSSL](#server_configuration_parameters-openssl) 必须配置。 - -如果 `http_port` 指定时,即使设置了OpenSSL配置,也会忽略该配置。 - -**示例** - -``` xml -0000 -``` - -## http\_server\_default\_response {#server_configuration_parameters-http_server_default_response} - -访问ClickHouse HTTP(s)服务器时默认显示的页面。 -默认值为 “Ok.” (最后有换行符) - -**示例** - -打开 `https://tabix.io/` 访问时 `http://localhost: http_port`. - -``` xml - -
]]> -
-``` - -## 包括\_从 {#server_configuration_parameters-include_from} - -带替换的文件的路径。 - -有关详细信息,请参阅部分 “[配置文件](../configuration_files.md#configuration_files)”. - -**示例** - -``` xml -/etc/metrica.xml -``` - -## interserver\_http\_port {#interserver-http-port} - -用于在ClickHouse服务器之间交换数据的端口。 - -**示例** - -``` xml -9009 -``` - -## interserver\_http\_host {#interserver-http-host} - -其他服务器可用于访问此服务器的主机名。 - -如果省略,它以相同的方式作为定义 `hostname-f` 指挥部 - -用于脱离特定的网络接口。 - -**示例** - -``` xml -example.yandex.ru -``` - -## interserver\_http\_credentials {#server-settings-interserver-http-credentials} - -用户名和密码用于在以下期间进行身份验证 [复制](../../engines/table_engines/mergetree_family/replication.md) 与复制\*引擎。 这些凭据仅用于副本之间的通信,与ClickHouse客户端的凭据无关。 服务器正在检查这些凭据以连接副本,并在连接到其他副本时使用相同的凭据。 因此,这些凭据应该为集群中的所有副本设置相同。 -默认情况下,不使用身份验证。 - -本节包含以下参数: - -- `user` — username. -- `password` — password. - -**示例** - -``` xml - - admin - 222 - -``` - -## keep\_alive\_timeout {#keep-alive-timeout} - -ClickHouse在关闭连接之前等待传入请求的秒数。 默认为3秒。 - -**示例** - -``` xml -3 -``` - -## listen\_host {#server_configuration_parameters-listen_host} - -对请求可能来自的主机的限制。 如果您希望服务器回答所有这些问题,请指定 `::`. - -例: - -``` xml -::1 -127.0.0.1 -``` - -## 记录器 {#server_configuration_parameters-logger} - -日志记录设置。 - -键: - -- level – Logging level. Acceptable values: `trace`, `debug`, `information`, `warning`, `error`. -- log – The log file. Contains all the entries according to `level`. -- errorlog – Error log file. -- size – Size of the file. Applies to `log`和`errorlog`. 一旦文件到达 `size`,ClickHouse存档并重命名它,并在其位置创建一个新的日志文件。 -- count – The number of archived log files that ClickHouse stores. - -**示例** - -``` xml - - trace - /var/log/clickhouse-server/clickhouse-server.log - /var/log/clickhouse-server/clickhouse-server.err.log - 1000M - 10 - -``` - -还支持写入系统日志。 配置示例: - -``` xml - - 1 - -
syslog.remote:10514
- myhost.local - LOG_LOCAL6 - syslog -
-
-``` - -键: - -- use\_syslog — Required setting if you want to write to the syslog. -- address — The host\[:port\] of syslogd. If omitted, the local daemon is used. -- hostname — Optional. The name of the host that logs are sent from. -- facility — [系统日志工具关键字](https://en.wikipedia.org/wiki/Syslog#Facility) 在大写字母与 “LOG\_” 前缀: (`LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`,等等)。 - 默认值: `LOG_USER` 如果 `address` 被指定, `LOG_DAEMON otherwise.` -- format – Message format. Possible values: `bsd` 和 `syslog.` - -## 宏 {#macros} - -复制表的参数替换。 - -如果不使用复制的表,则可以省略。 - -有关详细信息,请参阅部分 “[创建复制的表](../../engines/table_engines/mergetree_family/replication.md)”. - -**示例** - -``` xml - -``` - -## mark\_cache\_size {#server-mark-cache-size} - -表引擎使用的标记缓存的近似大小(以字节为单位) [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) 家人 - -缓存为服务器共享,并根据需要分配内存。 缓存大小必须至少为5368709120。 - -**示例** - -``` xml -5368709120 -``` - -## max\_concurrent\_queries {#max-concurrent-queries} - -同时处理的请求的最大数量。 - -**示例** - -``` xml -100 -``` - -## max\_connections {#max-connections} - -入站连接的最大数量。 - -**示例** - -``` xml -4096 -``` - -## max\_open\_files {#max-open-files} - -打开文件的最大数量。 - -默认情况下: `maximum`. - -我们建议在Mac OS X中使用此选项,因为 `getrlimit()` 函数返回一个不正确的值。 - -**示例** - -``` xml -262144 -``` - -## max\_table\_size\_to\_drop {#max-table-size-to-drop} - -限制删除表。 - -如果一个大小 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) 表超过 `max_table_size_to_drop` (以字节为单位),您无法使用删除查询将其删除。 - -如果仍然需要在不重新启动ClickHouse服务器的情况下删除表,请创建 `/flags/force_drop_table` 文件并运行DROP查询。 - -默认值:50GB。 - -值0表示您可以删除所有表而不受任何限制。 - -**示例** - -``` xml -0 -``` - -## merge\_tree {#server_configuration_parameters-merge_tree} - -微调中的表 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -有关详细信息,请参阅MergeTreeSettings。h头文件。 - -**示例** - -``` xml - - 5 - -``` - -## openSSL {#server_configuration_parameters-openssl} - -SSL客户端/服务器配置。 - -对SSL的支持由 `libpoco` 图书馆. 该接口在文件中描述 [SSLManager.h](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h) - -服务器/客户端设置的密钥: - -- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time. -- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if `privateKeyFile` 包含证书。 -- caConfig – The path to the file or directory that contains trusted root certificates. -- verificationMode – The method for checking the node's certificates. Details are in the description of the [A.背景](https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL_OpenSSL/include/Poco/Net/Context.h) 同学们 可能的值: `none`, `relaxed`, `strict`, `once`. -- verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value. -- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values: `true`, `false`. \| -- cipherList – Supported OpenSSL encryptions. For example: `ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH`. -- cacheSessions – Enables or disables caching sessions. Must be used in combination with `sessionIdContext`. 可接受的值: `true`, `false`. -- sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed `SSL_MAX_SSL_SESSION_ID_LENGTH`. 始终建议使用此参数,因为如果服务器缓存会话,以及客户端请求缓存,它有助于避免出现问题。 默认值: `${application.name}`. -- sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024\*20. 0 – Unlimited sessions. -- sessionTimeout – Time for caching the session on the server. -- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1 connection. Acceptable values: `true`, `false`. -- requireTLSv1\_1 – Require a TLSv1.1 connection. Acceptable values: `true`, `false`. -- requireTLSv1 – Require a TLSv1.2 connection. Acceptable values: `true`, `false`. -- fips – Activates OpenSSL FIPS mode. Supported if the library's OpenSSL version supports FIPS. -- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example: ``, `KeyFileHandler`, `test`, ``. -- invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example: ` ConsoleCertificateHandler ` . -- disableProtocols – Protocols that are not allowed to use. -- preferServerCiphers – Preferred server ciphers on the client. - -**设置示例:** - -``` xml - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - -``` - -## part\_log {#server_configuration_parameters-part-log} - -记录与之关联的事件 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). 例如,添加或合并数据。 您可以使用日志来模拟合并算法并比较它们的特征。 您可以可视化合并过程。 - -查询记录在 [系统。part\_log](../../operations/system_tables.md#system_tables-part-log) 表,而不是在一个单独的文件。 您可以在以下命令中配置此表的名称 `table` 参数(见下文)。 - -使用以下参数配置日志记录: - -- `database` – Name of the database. -- `table` – Name of the system table. -- `partition_by` – Sets a [自定义分区键](../../engines/table_engines/mergetree_family/custom_partitioning_key.md). -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -**示例** - -``` xml - - system - part_log
- toMonday(event_date) - 7500 -
-``` - -## 路径 {#server_configuration_parameters-path} - -包含数据的目录的路径。 - -!!! note "注" - 尾部斜杠是强制性的。 - -**示例** - -``` xml -/var/lib/clickhouse/ -``` - -## query\_log {#server_configuration_parameters-query-log} - -用于记录接收到的查询的设置 [log\_queries=1](../settings/settings.md) 设置。 - -查询记录在 [系统。query\_log](../../operations/system_tables.md#system_tables-query_log) 表,而不是在一个单独的文件。 您可以更改表的名称 `table` 参数(见下文)。 - -使用以下参数配置日志记录: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [自定义分区键](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) 为了一张桌子 -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -如果该表不存在,ClickHouse将创建它。 如果在ClickHouse服务器更新时查询日志的结构发生了更改,则会重命名具有旧结构的表,并自动创建新表。 - -**示例** - -``` xml - - system - query_log
- toMonday(event_date) - 7500 -
-``` - -## query\_thread\_log {#server_configuration_parameters-query-thread-log} - -设置用于记录接收到的查询的线程 [log\_query\_threads=1](../settings/settings.md#settings-log-query-threads) 设置。 - -查询记录在 [系统。query\_thread\_log](../../operations/system_tables.md#system_tables-query-thread-log) 表,而不是在一个单独的文件。 您可以更改表的名称 `table` 参数(见下文)。 - -使用以下参数配置日志记录: - -- `database` – Name of the database. -- `table` – Name of the system table the queries will be logged in. -- `partition_by` – Sets a [自定义分区键](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) 对于一个系统表。 -- `flush_interval_milliseconds` – Interval for flushing data from the buffer in memory to the table. - -如果该表不存在,ClickHouse将创建它。 如果更新ClickHouse服务器时查询线程日志的结构发生了更改,则会重命名具有旧结构的表,并自动创建新表。 - -**示例** - -``` xml - - system - query_thread_log
- toMonday(event_date) - 7500 -
-``` - -## trace\_log {#server_configuration_parameters-trace_log} - -设置为 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) 系统表操作。 - -参数: - -- `database` — Database for storing a table. -- `table` — Table name. -- `partition_by` — [自定义分区键](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) 对于一个系统表。 -- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table. - -默认服务器配置文件 `config.xml` 包含以下设置部分: - -``` xml - - system - trace_log
- toYYYYMM(event_date) - 7500 -
-``` - -## query\_masking\_rules {#query-masking-rules} - -基于正则表达式的规则,在将查询以及所有日志消息存储在服务器日志中之前,这些规则将应用于查询以及所有日志消息, -`system.query_log`, `system.text_log`, `system.processes` 表,并在日志中发送给客户端。 这允许防止 -从SQL查询敏感数据泄漏(如姓名,电子邮件,个人 -标识符或信用卡号码)记录。 - -**示例** - -``` xml - - - hide SSN - (^|\D)\d{3}-\d{2}-\d{4}($|\D) - 000-00-0000 - - -``` - -配置字段: -- `name` -规则的名称(可选) -- `regexp` -RE2兼容正则表达式(强制性) -- `replace` -敏感数据的替换字符串(可选,默认情况下-六个星号) - -屏蔽规则应用于整个查询(以防止敏感数据从格式错误/不可解析的查询泄漏)。 - -`system.events` 表有计数器 `QueryMaskingRulesMatch` 其中具有匹配的查询屏蔽规则的总数。 - -对于分布式查询,每个服务器必须单独配置,否则,子查询传递给其他 -节点将被存储而不屏蔽。 - -## remote\_servers {#server-settings-remote-servers} - -所使用的集群的配置 [分布](../../engines/table_engines/special/distributed.md) 表引擎和由 `cluster` 表功能。 - -**示例** - -``` xml - -``` - -对于该值 `incl` 属性,请参阅部分 “[配置文件](../configuration_files.md#configuration_files)”. - -**另请参阅** - -- [skip\_unavailable\_shards](../settings/settings.md#settings-skip_unavailable_shards) - -## 时区 {#server_configuration_parameters-timezone} - -服务器的时区。 - -指定为UTC时区或地理位置(例如,非洲/阿比让)的IANA标识符。 - -当DateTime字段输出为文本格式(打印在屏幕上或文件中)时,以及从字符串获取DateTime时,时区对于字符串和DateTime格式之间的转换是必需的。 此外,如果在输入参数中没有收到时区,则时区用于处理时间和日期的函数。 - -**示例** - -``` xml -Europe/Moscow -``` - -## tcp\_port {#server_configuration_parameters-tcp_port} - -通过TCP协议与客户端通信的端口。 - -**示例** - -``` xml -9000 -``` - -## tcp\_port\_secure {#server_configuration_parameters-tcp_port-secure} - -TCP端口,用于与客户端进行安全通信。 使用它与 [OpenSSL](#server_configuration_parameters-openssl) 设置。 - -**可能的值** - -整数。 - -**默认值** - -``` xml -9440 -``` - -## mysql\_port {#server_configuration_parameters-mysql_port} - -通过MySQL协议与客户端通信的端口。 - -**可能的值** - -整数。 - -示例 - -``` xml -9004 -``` - -## tmp\_path {#server-settings-tmp_path} - -用于处理大型查询的临时数据的路径。 - -!!! note "注" - 尾部斜杠是强制性的。 - -**示例** - -``` xml -/var/lib/clickhouse/tmp/ -``` - -## tmp\_policy {#server-settings-tmp-policy} - -从政策 [`storage_configuration`](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) 存储临时文件。 -如果没有设置 [`tmp_path`](#server-settings-tmp_path) 被使用,否则被忽略。 - -!!! note "注" - - `move_factor` 被忽略 -- `keep_free_space_bytes` 被忽略 -- `max_data_part_size_bytes` 被忽略 --您必须在该政策中只有一个卷 - -## uncompressed\_cache\_size {#server-settings-uncompressed_cache_size} - -表引擎使用的未压缩数据的缓存大小(以字节为单位) [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). - -服务器有一个共享缓存。 内存按需分配。 如果选项使用缓存 [use\_uncompressed\_cache](../settings/settings.md#setting-use_uncompressed_cache) 被启用。 - -在个别情况下,未压缩的缓存对于非常短的查询是有利的。 - -**示例** - -``` xml -8589934592 -``` - -## user\_files\_path {#server_configuration_parameters-user_files_path} - -包含用户文件的目录。 在表函数中使用 [文件()](../../sql_reference/table_functions/file.md). - -**示例** - -``` xml -/var/lib/clickhouse/user_files/ -``` - -## users\_config {#users-config} - -包含文件的路径: - -- 用户配置。 -- 访问权限。 -- 设置配置文件。 -- 配额设置。 - -**示例** - -``` xml -users.xml -``` - -## zookeeper {#server-settings_zookeeper} - -包含允许ClickHouse与 [zookpeer](http://zookeeper.apache.org/) 集群。 - -ClickHouse使用ZooKeeper存储复制表副本的元数据。 如果未使用复制的表,则可以省略此部分参数。 - -本节包含以下参数: - -- `node` — ZooKeeper endpoint. You can set multiple endpoints. - - 例如: - - - -``` xml - - example_host - 2181 - -``` - - The `index` attribute specifies the node order when trying to connect to the ZooKeeper cluster. - -- `session_timeout` — Maximum timeout for the client session in milliseconds. -- `root` — The [znode](http://zookeeper.apache.org/doc/r3.5.5/zookeeperOver.html#Nodes+and+ephemeral+nodes) 隆隆隆隆路虏脢..陇.貌.垄拢卢虏禄.陇.貌路.隆拢脳枚脢虏.麓脢for脱 可选。 -- `identity` — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional. - -**配置示例** - -``` xml - - - example1 - 2181 - - - example2 - 2181 - - 30000 - 10000 - - /path/to/zookeeper/node - - user:password - -``` - -**另请参阅** - -- [复制](../../engines/table_engines/mergetree_family/replication.md) -- [动物园管理员程序员指南](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html) - -## use\_minimalistic\_part\_header\_in\_zookeeper {#server-settings-use_minimalistic_part_header_in_zookeeper} - -ZooKeeper中数据部分头的存储方法。 - -此设置仅适用于 `MergeTree` 家人 它可以指定: - -- 在全球范围内 [merge\_tree](#server_configuration_parameters-merge_tree) 一节 `config.xml` 文件 - - ClickHouse使用服务器上所有表的设置。 您可以随时更改设置。 当设置更改时,现有表会更改其行为。 - -- 对于每个表。 - - 创建表时,指定相应的 [发动机设置](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-creating-a-table). 即使全局设置更改,具有此设置的现有表的行为也不会更改。 - -**可能的值** - -- 0 — Functionality is turned off. -- 1 — Functionality is turned on. - -如果 `use_minimalistic_part_header_in_zookeeper = 1`,然后 [复制](../../engines/table_engines/mergetree_family/replication.md) 表存储的数据部分的头紧凑使用一个单一的 `znode`. 如果表包含许多列,则此存储方法显着减少了Zookeeper中存储的数据量。 - -!!! attention "注意" - 申请后 `use_minimalistic_part_header_in_zookeeper = 1`,您不能将ClickHouse服务器降级到不支持此设置的版本。 在集群中的服务器上升级ClickHouse时要小心。 不要一次升级所有服务器。 在测试环境中或在集群的几台服务器上测试ClickHouse的新版本更安全。 - - Data part headers already stored with this setting can't be restored to their previous (non-compact) representation. - -**默认值:** 0. - -## disable\_internal\_dns\_cache {#server-settings-disable-internal-dns-cache} - -禁用内部DNS缓存。 推荐用于在系统中运行ClickHouse -随着频繁变化的基础设施,如Kubernetes。 - -**默认值:** 0. - -## dns\_cache\_update\_period {#server-settings-dns-cache-update-period} - -更新存储在ClickHouse内部DNS缓存中的IP地址的周期(以秒为单位)。 -更新是在一个单独的系统线程中异步执行的。 - -**默认值**: 15. - -[原始文章](https://clickhouse.tech/docs/en/operations/server_configuration_parameters/settings/) diff --git a/docs/zh/operations/settings/constraints_on_settings.md b/docs/zh/operations/settings/constraints-on-settings.md similarity index 100% rename from docs/zh/operations/settings/constraints_on_settings.md rename to docs/zh/operations/settings/constraints-on-settings.md diff --git a/docs/zh/operations/settings/index.md b/docs/zh/operations/settings/index.md index 9c598d241d1..3528be0c641 100644 --- a/docs/zh/operations/settings/index.md +++ b/docs/zh/operations/settings/index.md @@ -1,6 +1,7 @@ --- -toc_folder_title: "\u8bbe\u7f6e" +toc_folder_title: "\u8BBE\u7F6E" --- + # 设置 {#settings} 有多种方法可以进行以下所述的所有设置。 diff --git a/docs/zh/operations/settings/permissions-for-queries.md b/docs/zh/operations/settings/permissions-for-queries.md new file mode 100644 index 00000000000..ee7a9a0622d --- /dev/null +++ b/docs/zh/operations/settings/permissions-for-queries.md @@ -0,0 +1,61 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 58 +toc_title: "\u67E5\u8BE2\u6743\u9650" +--- + +# 查询权限 {#permissions_for_queries} + +ClickHouse中的查询可以分为几种类型: + +1. 读取数据查询: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. +2. 写入数据查询: `INSERT`, `OPTIMIZE`. +3. 更改设置查询: `SET`, `USE`. +4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) 查询: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. +5. `KILL QUERY`. + +以下设置按查询类型规范用户权限: + +- [只读](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. +- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. + +`KILL QUERY` 可以与任何设置进行。 + +## 只读 {#settings_readonly} + +限制读取数据、写入数据和更改设置查询的权限。 + +查看查询如何划分为多种类型 [以上](#permissions_for_queries). + +可能的值: + +- 0 — All queries are allowed. +- 1 — Only read data queries are allowed. +- 2 — Read data and change settings queries are allowed. + +设置后 `readonly = 1`,用户无法更改 `readonly` 和 `allow_ddl` 当前会话中的设置。 + +使用时 `GET` 方法中的 [HTTP接口](../../interfaces/http.md), `readonly = 1` 自动设置。 要修改数据,请使用 `POST` 方法。 + +设置 `readonly = 1` 禁止用户更改所有设置。 有一种方法可以禁止用户 +从只更改特定设置,有关详细信息,请参阅 [对设置的限制](constraints-on-settings.md). + +默认值:0 + +## allow\_ddl {#settings_allow_ddl} + +允许或拒绝 [DDL](https://en.wikipedia.org/wiki/Data_definition_language) 查询。 + +查看查询如何划分为多种类型 [以上](#permissions_for_queries). + +可能的值: + +- 0 — DDL queries are not allowed. +- 1 — DDL queries are allowed. + +你不能执行 `SET allow_ddl = 1` 如果 `allow_ddl = 0` 对于当前会话。 + +默认值:1 + +[原始文章](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/zh/operations/settings/permissions_for_queries.md b/docs/zh/operations/settings/permissions_for_queries.md deleted file mode 100644 index a7d2e843b66..00000000000 --- a/docs/zh/operations/settings/permissions_for_queries.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 58 -toc_title: "\u67E5\u8BE2\u6743\u9650" ---- - -# 查询权限 {#permissions_for_queries} - -ClickHouse中的查询可以分为几种类型: - -1. 读取数据查询: `SELECT`, `SHOW`, `DESCRIBE`, `EXISTS`. -2. 写入数据查询: `INSERT`, `OPTIMIZE`. -3. 更改设置查询: `SET`, `USE`. -4. [DDL](https://en.wikipedia.org/wiki/Data_definition_language) 查询: `CREATE`, `ALTER`, `RENAME`, `ATTACH`, `DETACH`, `DROP` `TRUNCATE`. -5. `KILL QUERY`. - -以下设置按查询类型规范用户权限: - -- [只读](#settings_readonly) — Restricts permissions for all types of queries except DDL queries. -- [allow\_ddl](#settings_allow_ddl) — Restricts permissions for DDL queries. - -`KILL QUERY` 可以与任何设置进行。 - -## 只读 {#settings_readonly} - -限制读取数据、写入数据和更改设置查询的权限。 - -查看查询如何划分为多种类型 [以上](#permissions_for_queries). - -可能的值: - -- 0 — All queries are allowed. -- 1 — Only read data queries are allowed. -- 2 — Read data and change settings queries are allowed. - -设置后 `readonly = 1`,用户无法更改 `readonly` 和 `allow_ddl` 当前会话中的设置。 - -使用时 `GET` 方法中的 [HTTP接口](../../interfaces/http.md), `readonly = 1` 自动设置。 要修改数据,请使用 `POST` 方法。 - -设置 `readonly = 1` 禁止用户更改所有设置。 有一种方法可以禁止用户 -从只更改特定设置,有关详细信息,请参阅 [对设置的限制](constraints_on_settings.md). - -默认值:0 - -## allow\_ddl {#settings_allow_ddl} - -允许或拒绝 [DDL](https://en.wikipedia.org/wiki/Data_definition_language) 查询。 - -查看查询如何划分为多种类型 [以上](#permissions_for_queries). - -可能的值: - -- 0 — DDL queries are not allowed. -- 1 — DDL queries are allowed. - -你不能执行 `SET allow_ddl = 1` 如果 `allow_ddl = 0` 对于当前会话。 - -默认值:1 - -[原始文章](https://clickhouse.tech/docs/en/operations/settings/permissions_for_queries/) diff --git a/docs/zh/operations/settings/query-complexity.md b/docs/zh/operations/settings/query-complexity.md new file mode 100644 index 00000000000..c54da792fc3 --- /dev/null +++ b/docs/zh/operations/settings/query-complexity.md @@ -0,0 +1,193 @@ +# 查询复杂性的限制 {#restrictions-on-query-complexity} + +对查询复杂性的限制是设置的一部分。 +它们被用来从用户界面提供更安全的执行。 +几乎所有的限制只适用于选择。对于分布式查询处理,每个服务器上分别应用限制。 + +Restrictions on the «maximum amount of something» can take the value 0, which means «unrestricted». +大多数限制也有一个 ‘overflow\_mode’ 设置,这意味着超过限制时该怎么做。 +它可以采用以下两个值之一: `throw` 或 `break`. 对聚合的限制(group\_by\_overflow\_mode)也具有以下值 `any`. + +`throw` – Throw an exception (default). + +`break` – Stop executing the query and return the partial result, as if the source data ran out. + +`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don’t add new keys to the set. + +## 只读 {#query-complexity-readonly} + +值为0时,可以执行任何查询。 +如果值为1,则只能执行读取请求(如SELECT和SHOW)。 禁止写入和更改设置(插入,设置)的请求。 +值为2时,可以处理读取查询(选择、显示)和更改设置(设置)。 + +启用只读模式后,您无法在当前会话中禁用它。 + +在HTTP接口中使用GET方法时, ‘readonly = 1’ 自动设置。 换句话说,对于修改数据的查询,您只能使用POST方法。 您可以在POST正文或URL参数中发送查询本身。 + +## max\_memory\_usage {#settings_max_memory_usage} + +用于在单个服务器上运行查询的最大RAM量。 + +在默认配置文件中,最大值为10GB。 + +该设置不考虑计算机上的可用内存量或内存总量。 +该限制适用于单个服务器中的单个查询。 +您可以使用 `SHOW PROCESSLIST` 查看每个查询的当前内存消耗。 +此外,还会跟踪每个查询的内存消耗峰值并将其写入日志。 + +不监视某些聚合函数的状态的内存使用情况。 + +未完全跟踪聚合函数的状态的内存使用情况 `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` 从 `String` 和 `Array` 争论。 + +内存消耗也受到参数的限制 `max_memory_usage_for_user` 和 `max_memory_usage_for_all_queries`. + +## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} + +用于在单个服务器上运行用户查询的最大RAM量。 + +默认值定义在 [设置。h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/Settings.h#L244). 默认情况下,金额不受限制 (`max_memory_usage_for_user = 0`). + +另请参阅说明 [max\_memory\_usage](#settings_max_memory_usage). + +## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} + +用于在单个服务器上运行所有查询的最大RAM数量。 + +默认值定义在 [设置。h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/Settings.h#L245). 默认情况下,金额不受限制 (`max_memory_usage_for_all_queries = 0`). + +另请参阅说明 [max\_memory\_usage](#settings_max_memory_usage). + +## max\_rows\_to\_read {#max-rows-to-read} + +可以在每个块(而不是每行)上检查以下限制。 也就是说,限制可以打破一点。 +在多个线程中运行查询时,以下限制单独应用于每个线程。 + +运行查询时可从表中读取的最大行数。 + +## max\_bytes\_to\_read {#max-bytes-to-read} + +运行查询时可以从表中读取的最大字节数(未压缩数据)。 + +## read\_overflow\_mode {#read-overflow-mode} + +读取的数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 + +## max\_rows\_to\_group\_by {#max-rows-to-group-by} + +从聚合接收的唯一密钥的最大数量。 此设置允许您在聚合时限制内存消耗。 + +## group\_by\_overflow\_mode {#group-by-overflow-mode} + +当聚合的唯一键数超过限制时该怎么办: ‘throw’, ‘break’,或 ‘any’. 默认情况下,扔。 +使用 ‘any’ 值允许您运行GROUP BY的近似值。 这种近似值的质量取决于数据的统计性质。 + +## max\_rows\_to\_sort {#max-rows-to-sort} + +排序前的最大行数。 这允许您在排序时限制内存消耗。 + +## max\_bytes\_to\_sort {#max-bytes-to-sort} + +排序前的最大字节数。 + +## sort\_overflow\_mode {#sort-overflow-mode} + +如果排序前收到的行数超过其中一个限制,该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 + +## max\_result\_rows {#max-result-rows} + +限制结果中的行数。 还检查子查询,并在运行分布式查询的部分时在远程服务器上。 + +## max\_result\_bytes {#max-result-bytes} + +限制结果中的字节数。 与之前的设置相同。 + +## result\_overflow\_mode {#result-overflow-mode} + +如果结果的体积超过其中一个限制,该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 +使用 ‘break’ 类似于使用限制。 + +## max\_execution\_time {#max-execution-time} + +最大查询执行时间(以秒为单位)。 +此时,不会检查其中一个排序阶段,也不会在合并和最终确定聚合函数时进行检查。 + +## timeout\_overflow\_mode {#timeout-overflow-mode} + +如果查询的运行时间长于 ‘max\_execution\_time’: ‘throw’ 或 ‘break’. 默认情况下,扔。 + +## min\_execution\_speed {#min-execution-speed} + +以每秒行为单位的最小执行速度。 检查每个数据块时 ‘timeout\_before\_checking\_execution\_speed’ 到期。 如果执行速度较低,则会引发异常。 + +## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} + +检查执行速度是不是太慢(不低于 ‘min\_execution\_speed’),在指定的时间以秒为单位已过期之后。 + +## max\_columns\_to\_read {#max-columns-to-read} + +单个查询中可从表中读取的最大列数。 如果查询需要读取更多列,则会引发异常。 + +## max\_temporary\_columns {#max-temporary-columns} + +运行查询时必须同时保留在RAM中的最大临时列数,包括常量列。 如果有比这更多的临时列,它会引发异常。 + +## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} + +同样的事情 ‘max\_temporary\_columns’,但不计数常数列。 +请注意,常量列在运行查询时经常形成,但它们需要大约零计算资源。 + +## max\_subquery\_depth {#max-subquery-depth} + +子查询的最大嵌套深度。 如果子查询更深,则会引发异常。 默认情况下,100。 + +## max\_pipeline\_depth {#max-pipeline-depth} + +最大管道深度。 对应于查询处理期间每个数据块经历的转换数。 在单个服务器的限制范围内计算。 如果管道深度较大,则会引发异常。 默认情况下,1000。 + +## max\_ast\_depth {#max-ast-depth} + +查询语法树的最大嵌套深度。 如果超出,将引发异常。 +此时,在解析过程中不会对其进行检查,而是仅在解析查询之后进行检查。 也就是说,在分析过程中可以创建一个太深的语法树,但查询将失败。 默认情况下,1000。 + +## max\_ast\_elements {#max-ast-elements} + +查询语法树中的最大元素数。 如果超出,将引发异常。 +与前面的设置相同,只有在解析查询后才会检查它。 默认情况下,50,000。 + +## max\_rows\_in\_set {#max-rows-in-set} + +从子查询创建的IN子句中数据集的最大行数。 + +## max\_bytes\_in\_set {#max-bytes-in-set} + +从子查询创建的IN子句中的集合使用的最大字节数(未压缩数据)。 + +## set\_overflow\_mode {#set-overflow-mode} + +当数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 + +## max\_rows\_in\_distinct {#max-rows-in-distinct} + +使用DISTINCT时的最大不同行数。 + +## max\_bytes\_in\_distinct {#max-bytes-in-distinct} + +使用DISTINCT时哈希表使用的最大字节数。 + +## distinct\_overflow\_mode {#distinct-overflow-mode} + +当数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 + +## max\_rows\_to\_transfer {#max-rows-to-transfer} + +使用GLOBAL IN时,可以传递到远程服务器或保存在临时表中的最大行数。 + +## max\_bytes\_to\_transfer {#max-bytes-to-transfer} + +使用GLOBAL IN时,可以传递到远程服务器或保存在临时表中的最大字节数(未压缩数据)。 + +## transfer\_overflow\_mode {#transfer-overflow-mode} + +当数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 + +[原始文章](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/zh/operations/settings/query_complexity.md b/docs/zh/operations/settings/query_complexity.md deleted file mode 100644 index b17f5b7aa70..00000000000 --- a/docs/zh/operations/settings/query_complexity.md +++ /dev/null @@ -1,194 +0,0 @@ - -# 查询复杂性的限制 {#restrictions-on-query-complexity} - -对查询复杂性的限制是设置的一部分。 -它们被用来从用户界面提供更安全的执行。 -几乎所有的限制只适用于选择。对于分布式查询处理,每个服务器上分别应用限制。 - -Restrictions on the «maximum amount of something» can take the value 0, which means «unrestricted». -大多数限制也有一个 ‘overflow\_mode’ 设置,这意味着超过限制时该怎么做。 -它可以采用以下两个值之一: `throw` 或 `break`. 对聚合的限制(group\_by\_overflow\_mode)也具有以下值 `any`. - -`throw` – Throw an exception (default). - -`break` – Stop executing the query and return the partial result, as if the source data ran out. - -`any (only for group_by_overflow_mode)` – Continuing aggregation for the keys that got into the set, but don't add new keys to the set. - -## 只读 {#query-complexity-readonly} - -值为0时,可以执行任何查询。 -如果值为1,则只能执行读取请求(如SELECT和SHOW)。 禁止写入和更改设置(插入,设置)的请求。 -值为2时,可以处理读取查询(选择、显示)和更改设置(设置)。 - -启用只读模式后,您无法在当前会话中禁用它。 - -在HTTP接口中使用GET方法时, ‘readonly = 1’ 自动设置。 换句话说,对于修改数据的查询,您只能使用POST方法。 您可以在POST正文或URL参数中发送查询本身。 - -## max\_memory\_usage {#settings_max_memory_usage} - -用于在单个服务器上运行查询的最大RAM量。 - -在默认配置文件中,最大值为10GB。 - -该设置不考虑计算机上的可用内存量或内存总量。 -该限制适用于单个服务器中的单个查询。 -您可以使用 `SHOW PROCESSLIST` 查看每个查询的当前内存消耗。 -此外,还会跟踪每个查询的内存消耗峰值并将其写入日志。 - -不监视某些聚合函数的状态的内存使用情况。 - -未完全跟踪聚合函数的状态的内存使用情况 `min`, `max`, `any`, `anyLast`, `argMin`, `argMax` 从 `String` 和 `Array` 争论。 - -内存消耗也受到参数的限制 `max_memory_usage_for_user` 和 `max_memory_usage_for_all_queries`. - -## max\_memory\_usage\_for\_user {#max-memory-usage-for-user} - -用于在单个服务器上运行用户查询的最大RAM量。 - -默认值定义在 [设置。h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/Settings.h#L244). 默认情况下,金额不受限制 (`max_memory_usage_for_user = 0`). - -另请参阅说明 [max\_memory\_usage](#settings_max_memory_usage). - -## max\_memory\_usage\_for\_all\_queries {#max-memory-usage-for-all-queries} - -用于在单个服务器上运行所有查询的最大RAM数量。 - -默认值定义在 [设置。h](https://github.com/ClickHouse/ClickHouse/blob/master/src/Interpreters/Settings.h#L245). 默认情况下,金额不受限制 (`max_memory_usage_for_all_queries = 0`). - -另请参阅说明 [max\_memory\_usage](#settings_max_memory_usage). - -## max\_rows\_to\_read {#max-rows-to-read} - -可以在每个块(而不是每行)上检查以下限制。 也就是说,限制可以打破一点。 -在多个线程中运行查询时,以下限制单独应用于每个线程。 - -运行查询时可从表中读取的最大行数。 - -## max\_bytes\_to\_read {#max-bytes-to-read} - -运行查询时可以从表中读取的最大字节数(未压缩数据)。 - -## read\_overflow\_mode {#read-overflow-mode} - -读取的数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 - -## max\_rows\_to\_group\_by {#max-rows-to-group-by} - -从聚合接收的唯一密钥的最大数量。 此设置允许您在聚合时限制内存消耗。 - -## group\_by\_overflow\_mode {#group-by-overflow-mode} - -当聚合的唯一键数超过限制时该怎么办: ‘throw’, ‘break’,或 ‘any’. 默认情况下,扔。 -使用 ‘any’ 值允许您运行GROUP BY的近似值。 这种近似值的质量取决于数据的统计性质。 - -## max\_rows\_to\_sort {#max-rows-to-sort} - -排序前的最大行数。 这允许您在排序时限制内存消耗。 - -## max\_bytes\_to\_sort {#max-bytes-to-sort} - -排序前的最大字节数。 - -## sort\_overflow\_mode {#sort-overflow-mode} - -如果排序前收到的行数超过其中一个限制,该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 - -## max\_result\_rows {#max-result-rows} - -限制结果中的行数。 还检查子查询,并在运行分布式查询的部分时在远程服务器上。 - -## max\_result\_bytes {#max-result-bytes} - -限制结果中的字节数。 与之前的设置相同。 - -## result\_overflow\_mode {#result-overflow-mode} - -如果结果的体积超过其中一个限制,该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 -使用 ‘break’ 类似于使用限制。 - -## max\_execution\_time {#max-execution-time} - -最大查询执行时间(以秒为单位)。 -此时,不会检查其中一个排序阶段,也不会在合并和最终确定聚合函数时进行检查。 - -## timeout\_overflow\_mode {#timeout-overflow-mode} - -如果查询的运行时间长于 ‘max\_execution\_time’: ‘throw’ 或 ‘break’. 默认情况下,扔。 - -## min\_execution\_speed {#min-execution-speed} - -以每秒行为单位的最小执行速度。 检查每个数据块时 ‘timeout\_before\_checking\_execution\_speed’ 到期。 如果执行速度较低,则会引发异常。 - -## timeout\_before\_checking\_execution\_speed {#timeout-before-checking-execution-speed} - -检查执行速度是不是太慢(不低于 ‘min\_execution\_speed’),在指定的时间以秒为单位已过期之后。 - -## max\_columns\_to\_read {#max-columns-to-read} - -单个查询中可从表中读取的最大列数。 如果查询需要读取更多列,则会引发异常。 - -## max\_temporary\_columns {#max-temporary-columns} - -运行查询时必须同时保留在RAM中的最大临时列数,包括常量列。 如果有比这更多的临时列,它会引发异常。 - -## max\_temporary\_non\_const\_columns {#max-temporary-non-const-columns} - -同样的事情 ‘max\_temporary\_columns’,但不计数常数列。 -请注意,常量列在运行查询时经常形成,但它们需要大约零计算资源。 - -## max\_subquery\_depth {#max-subquery-depth} - -子查询的最大嵌套深度。 如果子查询更深,则会引发异常。 默认情况下,100。 - -## max\_pipeline\_depth {#max-pipeline-depth} - -最大管道深度。 对应于查询处理期间每个数据块经历的转换数。 在单个服务器的限制范围内计算。 如果管道深度较大,则会引发异常。 默认情况下,1000。 - -## max\_ast\_depth {#max-ast-depth} - -查询语法树的最大嵌套深度。 如果超出,将引发异常。 -此时,在解析过程中不会对其进行检查,而是仅在解析查询之后进行检查。 也就是说,在分析过程中可以创建一个太深的语法树,但查询将失败。 默认情况下,1000。 - -## max\_ast\_elements {#max-ast-elements} - -查询语法树中的最大元素数。 如果超出,将引发异常。 -与前面的设置相同,只有在解析查询后才会检查它。 默认情况下,50,000。 - -## max\_rows\_in\_set {#max-rows-in-set} - -从子查询创建的IN子句中数据集的最大行数。 - -## max\_bytes\_in\_set {#max-bytes-in-set} - -从子查询创建的IN子句中的集合使用的最大字节数(未压缩数据)。 - -## set\_overflow\_mode {#set-overflow-mode} - -当数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 - -## max\_rows\_in\_distinct {#max-rows-in-distinct} - -使用DISTINCT时的最大不同行数。 - -## max\_bytes\_in\_distinct {#max-bytes-in-distinct} - -使用DISTINCT时哈希表使用的最大字节数。 - -## distinct\_overflow\_mode {#distinct-overflow-mode} - -当数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 - -## max\_rows\_to\_transfer {#max-rows-to-transfer} - -使用GLOBAL IN时,可以传递到远程服务器或保存在临时表中的最大行数。 - -## max\_bytes\_to\_transfer {#max-bytes-to-transfer} - -使用GLOBAL IN时,可以传递到远程服务器或保存在临时表中的最大字节数(未压缩数据)。 - -## transfer\_overflow\_mode {#transfer-overflow-mode} - -当数据量超过其中一个限制时该怎么办: ‘throw’ 或 ‘break’. 默认情况下,扔。 - -[原始文章](https://clickhouse.tech/docs/en/operations/settings/query_complexity/) diff --git a/docs/zh/operations/settings/settings_profiles.md b/docs/zh/operations/settings/settings-profiles.md similarity index 100% rename from docs/zh/operations/settings/settings_profiles.md rename to docs/zh/operations/settings/settings-profiles.md diff --git a/docs/zh/operations/settings/settings-users.md b/docs/zh/operations/settings/settings-users.md new file mode 100644 index 00000000000..84e547fd232 --- /dev/null +++ b/docs/zh/operations/settings/settings-users.md @@ -0,0 +1,148 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 63 +toc_title: "\u7528\u6237\u8BBE\u7F6E" +--- + +# 用户设置 {#user-settings} + +该 `users` 一节 `user.xml` 配置文件包含用户设置。 + +的结构 `users` 科: + +``` xml + + + + + + + + + + + profile_name + + default + + + + + expression + + + + + + +``` + +### 用户名称/密码 {#user-namepassword} + +密码可以以明文或SHA256(十六进制格式)指定。 + +- 以明文形式分配密码 (**不推荐**),把它放在一个 `password` 元素。 + + 例如, `qwerty`. 密码可以留空。 + + + +- 要使用其SHA256散列分配密码,请将其放置在 `password_sha256_hex` 元素。 + + 例如, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. + + 如何从shell生成密码的示例: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' + + 结果的第一行是密码。 第二行是相应的SHA256哈希。 + + + +- 为了与MySQL客户端兼容,密码可以在双SHA1哈希中指定。 放进去 `password_double_sha1_hex` 元素。 + + 例如, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. + + 如何从shell生成密码的示例: + + PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' + + 结果的第一行是密码。 第二行是相应的双SHA1哈希。 + +### 用户名称/网络 {#user-namenetworks} + +用户可以从中连接到ClickHouse服务器的网络列表。 + +列表中的每个元素都可以具有以下形式之一: + +- `` — IP address or network mask. + + 例: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. + +- `` — Hostname. + + 示例: `example01.host.ru`. + + 要检查访问,将执行DNS查询,并将所有返回的IP地址与对等地址进行比较。 + +- `` — Regular expression for hostnames. + + 示例, `^example\d\d-\d\d-\d\.host\.ru$` + + 要检查访问,a [DNS PTR查询](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) 对对等体地址执行,然后应用指定的正则表达式。 然后,对PTR查询的结果执行另一个DNS查询,并将所有接收到的地址与对等地址进行比较。 我们强烈建议正则表达式以$结尾。 + +DNS请求的所有结果都将被缓存,直到服务器重新启动。 + +**例** + +要从任何网络打开用户的访问权限,请指定: + +``` xml +::/0 +``` + +!!! warning "警告" + 从任何网络开放访问是不安全的,除非你有一个防火墙正确配置或服务器没有直接连接到互联网。 + +若要仅从本地主机打开访问权限,请指定: + +``` xml +::1 +127.0.0.1 +``` + +### user\_name/profile {#user-nameprofile} + +您可以为用户分配设置配置文件。 设置配置文件在单独的部分配置 `users.xml` 文件 有关详细信息,请参阅 [设置配置文件](settings-profiles.md). + +### 用户名称/配额 {#user-namequota} + +配额允许您在一段时间内跟踪或限制资源使用情况。 配额在配置 `quotas` +一节 `users.xml` 配置文件。 + +您可以为用户分配配额。 有关配额配置的详细说明,请参阅 [配额](../quotas.md#quotas). + +### 用户名/数据库 {#user-namedatabases} + +在本节中,您可以限制ClickHouse返回的行 `SELECT` 由当前用户进行的查询,从而实现基本的行级安全性。 + +**示例** + +以下配置强制该用户 `user1` 只能看到的行 `table1` 作为结果 `SELECT` 查询,其中的值 `id` 场是1000。 + +``` xml + + + + + id = 1000 + + + + +``` + +该 `filter` 可以是导致任何表达式 [UInt8](../../sql-reference/data-types/int-uint.md)-键入值。 它通常包含比较和逻辑运算符。 从行 `database_name.table1` 其中,不会为此用户返回为0的筛选结果。 过滤是不兼容的 `PREWHERE` 操作和禁用 `WHERE→PREWHERE` 优化。 + +[原始文章](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/zh/operations/settings/settings.md b/docs/zh/operations/settings/settings.md index 8e0a60d4f03..e88727395a4 100644 --- a/docs/zh/operations/settings/settings.md +++ b/docs/zh/operations/settings/settings.md @@ -9,7 +9,7 @@ toc_title: "\u8BBE\u7F6E" ## 分布\_产品\_模式 {#distributed-product-mode} -改变的行为 [分布式子查询](../../sql_reference/statements/select.md). +改变的行为 [分布式子查询](../../sql-reference/statements/select.md). ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table. @@ -18,7 +18,7 @@ ClickHouse applies this setting when the query contains the product of distribut - 仅适用于IN和JOIN子查询。 - 仅当FROM部分使用包含多个分片的分布式表时。 - 如果子查询涉及包含多个分片的分布式表。 -- 不用于表值 [远程](../../sql_reference/table_functions/remote.md) 功能。 +- 不用于表值 [远程](../../sql-reference/table-functions/remote.md) 功能。 可能的值: @@ -53,7 +53,7 @@ ClickHouse applies this setting when the query contains the product of distribut ## fallback\_to\_stale\_replicas\_for\_distributed\_queries {#settings-fallback_to_stale_replicas_for_distributed_queries} -如果更新的数据不可用,则强制对过期副本进行查询。 看 [复制](../../engines/table_engines/mergetree_family/replication.md). +如果更新的数据不可用,则强制对过期副本进行查询。 看 [复制](../../engines/table-engines/mergetree-family/replication.md). ClickHouse从表的过时副本中选择最相关的副本。 @@ -67,7 +67,7 @@ ClickHouse从表的过时副本中选择最相关的副本。 适用于MergeTree系列中的表。 -如果 `force_index_by_date=1`,ClickHouse检查查询是否具有可用于限制数据范围的date键条件。 如果没有合适的条件,则会引发异常。 但是,它不检查条件是否减少了要读取的数据量。 例如,条件 `Date != ' 2000-01-01 '` 即使它与表中的所有数据匹配(即运行查询需要完全扫描),也是可以接受的。 有关MergeTree表中数据范围的详细信息,请参阅 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +如果 `force_index_by_date=1`,ClickHouse检查查询是否具有可用于限制数据范围的date键条件。 如果没有合适的条件,则会引发异常。 但是,它不检查条件是否减少了要读取的数据量。 例如,条件 `Date != ' 2000-01-01 '` 即使它与表中的所有数据匹配(即运行查询需要完全扫描),也是可以接受的。 有关MergeTree表中数据范围的详细信息,请参阅 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## force\_primary\_key {#force-primary-key} @@ -75,7 +75,7 @@ ClickHouse从表的过时副本中选择最相关的副本。 适用于MergeTree系列中的表。 -如果 `force_primary_key=1`,ClickHouse检查查询是否具有可用于限制数据范围的主键条件。 如果没有合适的条件,则会引发异常。 但是,它不检查条件是否减少了要读取的数据量。 有关MergeTree表中数据范围的详细信息,请参阅 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md). +如果 `force_primary_key=1`,ClickHouse检查查询是否具有可用于限制数据范围的主键条件。 如果没有合适的条件,则会引发异常。 但是,它不检查条件是否减少了要读取的数据量。 有关MergeTree表中数据范围的详细信息,请参阅 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md). ## format\_schema {#format-schema} @@ -136,7 +136,7 @@ ClickHouse从表的过时副本中选择最相关的副本。 ## max\_http\_get\_redirects {#setting-max_http_get_redirects} -限制HTTP GET重定向跳数的最大数量 [URL](../../engines/table_engines/special/url.md)-发动机表。 该设置适用于两种类型的表:由 [CREATE TABLE](../../sql_reference/statements/create.md#create-table-query) 查询和由 [url](../../sql_reference/table_functions/url.md) 表功能。 +限制HTTP GET重定向跳数的最大数量 [URL](../../engines/table-engines/special/url.md)-发动机表。 该设置适用于两种类型的表:由 [CREATE TABLE](../../sql-reference/statements/create.md#create-table-query) 查询和由 [url](../../sql-reference/table-functions/url.md) 表功能。 可能的值: @@ -172,7 +172,7 @@ ClickHouse从表的过时副本中选择最相关的副本。 ## input\_format\_values\_interpret\_expressions {#settings-input_format_values_interpret_expressions} -如果快速流解析器无法解析数据,则启用或禁用完整SQL解析器。 此设置仅用于 [值](../../interfaces/formats.md#data-format-values) 格式在数据插入。 有关语法分析的详细信息,请参阅 [语法](../../sql_reference/syntax.md) 科。 +如果快速流解析器无法解析数据,则启用或禁用完整SQL解析器。 此设置仅用于 [值](../../interfaces/formats.md#data-format-values) 格式在数据插入。 有关语法分析的详细信息,请参阅 [语法](../../sql-reference/syntax.md) 科。 可能的值: @@ -188,7 +188,7 @@ ClickHouse从表的过时副本中选择最相关的副本。 使用示例 -插入 [日期时间](../../sql_reference/data_types/datetime.md) 使用不同的设置键入值。 +插入 [日期时间](../../sql-reference/data-types/datetime.md) 使用不同的设置键入值。 ``` sql SET input_format_values_interpret_expressions = 0; @@ -333,7 +333,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl 允许选择日期和时间的文本表示的解析器。 -该设置不适用于 [日期和时间功能](../../sql_reference/functions/date_time_functions.md). +该设置不适用于 [日期和时间功能](../../sql-reference/functions/date-time-functions.md). 可能的值: @@ -349,12 +349,12 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl 另请参阅: -- [日期时间数据类型。](../../sql_reference/data_types/datetime.md) -- [用于处理日期和时间的函数。](../../sql_reference/functions/date_time_functions.md) +- [日期时间数据类型。](../../sql-reference/data-types/datetime.md) +- [用于处理日期和时间的函数。](../../sql-reference/functions/date-time-functions.md) ## join\_default\_strictness {#settings-join_default_strictness} -设置默认严格性 [加入子句](../../sql_reference/statements/select.md#select-join). +设置默认严格性 [加入子句](../../sql-reference/statements/select.md#select-join). 可能的值: @@ -370,7 +370,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl 更改联接操作的行为 `ANY` 严格。 !!! warning "注意" - 此设置仅适用于 `JOIN` 操作与 [加入我们](../../engines/table_engines/special/join.md) 发动机表. + 此设置仅适用于 `JOIN` 操作与 [加入我们](../../engines/table-engines/special/join.md) 发动机表. 可能的值: @@ -381,18 +381,18 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl 另请参阅: -- [JOIN子句](../../sql_reference/statements/select.md#select-join) -- [联接表引擎](../../engines/table_engines/special/join.md) +- [JOIN子句](../../sql-reference/statements/select.md#select-join) +- [联接表引擎](../../engines/table-engines/special/join.md) - [join\_default\_strictness](#settings-join_default_strictness) ## join\_use\_nulls {#join_use_nulls} -设置类型 [JOIN](../../sql_reference/statements/select.md) 行为 合并表时,可能会出现空单元格。 ClickHouse根据此设置以不同的方式填充它们。 +设置类型 [JOIN](../../sql-reference/statements/select.md) 行为 合并表时,可能会出现空单元格。 ClickHouse根据此设置以不同的方式填充它们。 可能的值: - 0 — The empty cells are filled with the default value of the corresponding field type. -- 1 — `JOIN` 其行为方式与标准SQL中的行为方式相同。 相应字段的类型将转换为 [可为空](../../sql_reference/data_types/nullable.md#data_type-nullable),和空单元格填充 [NULL](../../sql_reference/syntax.md). +- 1 — `JOIN` 其行为方式与标准SQL中的行为方式相同。 相应字段的类型将转换为 [可为空](../../sql-reference/data-types/nullable.md#data_type-nullable),和空单元格填充 [NULL](../../sql-reference/syntax.md). 默认值:0。 @@ -412,7 +412,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl ## merge\_tree\_min\_rows\_for\_concurrent\_read {#setting-merge-tree-min-rows-for-concurrent-read} -如果从a的文件中读取的行数 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) 表超过 `merge_tree_min_rows_for_concurrent_read` 然后ClickHouse尝试在多个线程上从该文件执行并发读取。 +如果从a的文件中读取的行数 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) 表超过 `merge_tree_min_rows_for_concurrent_read` 然后ClickHouse尝试在多个线程上从该文件执行并发读取。 可能的值: @@ -422,7 +422,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl ## merge\_tree\_min\_bytes\_for\_concurrent\_read {#setting-merge-tree-min-bytes-for-concurrent-read} -如果从一个文件中读取的字节数 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)-发动机表超过 `merge_tree_min_bytes_for_concurrent_read`,然后ClickHouse尝试在多个线程中并发读取此文件。 +如果从一个文件中读取的字节数 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)-发动机表超过 `merge_tree_min_bytes_for_concurrent_read`,然后ClickHouse尝试在多个线程中并发读取此文件。 可能的值: @@ -464,7 +464,7 @@ When disabled, ClickHouse may use more general type for some literals (e.g. `Fl 如果克里克豪斯应该阅读更多 `merge_tree_max_rows_to_use_cache` 在一个查询中的行,它不使用未压缩块的缓存。 -未压缩块的缓存存储为查询提取的数据。 ClickHouse使用此缓存来加快对重复的小查询的响应。 此设置可保护缓存免受读取大量数据的查询的破坏。 该 [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) 服务器设置定义未压缩块的高速缓存的大小。 +未压缩块的缓存存储为查询提取的数据。 ClickHouse使用此缓存来加快对重复的小查询的响应。 此设置可保护缓存免受读取大量数据的查询的破坏。 该 [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) 服务器设置定义未压缩块的高速缓存的大小。 可能的值: @@ -476,7 +476,7 @@ Default value: 128 ✕ 8192. 如果克里克豪斯应该阅读更多 `merge_tree_max_bytes_to_use_cache` 在一个查询中的字节,它不使用未压缩块的缓存。 -未压缩块的缓存存储为查询提取的数据。 ClickHouse使用此缓存来加快对重复的小查询的响应。 此设置可保护缓存免受读取大量数据的查询的破坏。 该 [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) 服务器设置定义未压缩块的高速缓存的大小。 +未压缩块的缓存存储为查询提取的数据。 ClickHouse使用此缓存来加快对重复的小查询的响应。 此设置可保护缓存免受读取大量数据的查询的破坏。 该 [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) 服务器设置定义未压缩块的高速缓存的大小。 可能的值: @@ -501,7 +501,7 @@ ClickHouse在从表中读取数据时使用此设置。 如果要读取的所有 设置查询日志记录。 -使用此设置发送到ClickHouse的查询将根据以下内容中的规则记录 [query\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-log) 服务器配置参数。 +使用此设置发送到ClickHouse的查询将根据以下内容中的规则记录 [query\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-log) 服务器配置参数。 示例: @@ -513,7 +513,7 @@ log_queries=1 设置查询线程日志记录。 -ClickHouse使用此设置运行的查询线程将根据以下命令中的规则记录 [query\_thread\_log](../server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) 服务器配置参数。 +ClickHouse使用此设置运行的查询线程将根据以下命令中的规则记录 [query\_thread\_log](../server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) 服务器配置参数。 示例: @@ -535,7 +535,7 @@ log_query_threads=1 ## max\_replica\_delay\_for\_distributed\_queries {#settings-max_replica_delay_for_distributed_queries} -禁用分布式查询的滞后副本。 看 [复制](../../engines/table_engines/mergetree_family/replication.md). +禁用分布式查询的滞后副本。 看 [复制](../../engines/table-engines/mergetree-family/replication.md). 以秒为单位设置时间。 如果副本滞后超过设定值,则不使用此副本。 @@ -580,7 +580,7 @@ log_query_threads=1 ## min\_compress\_block\_size {#min-compress-block-size} -为 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)"表。 为了减少处理查询时的延迟,在写入下一个标记时,如果块的大小至少为 ‘min\_compress\_block\_size’. 默认情况下,65,536。 +为 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)"表。 为了减少处理查询时的延迟,在写入下一个标记时,如果块的大小至少为 ‘min\_compress\_block\_size’. 默认情况下,65,536。 块的实际大小,如果未压缩的数据小于 ‘max\_compress\_block\_size’,是不小于该值且不小于一个标记的数据量。 @@ -658,7 +658,7 @@ Cancels HTTP read-only queries (e.g. SELECT) when a client closes the connectio ## use\_uncompressed\_cache {#setting-use_uncompressed_cache} 是否使用未压缩块的缓存。 接受0或1。 默认情况下,0(禁用)。 -使用未压缩缓存(仅适用于MergeTree系列中的表)可以在处理大量短查询时显着减少延迟并提高吞吐量。 为频繁发送短请求的用户启用此设置。 还要注意 [uncompressed\_cache\_size](../server_configuration_parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. +使用未压缩缓存(仅适用于MergeTree系列中的表)可以在处理大量短查询时显着减少延迟并提高吞吐量。 为频繁发送短请求的用户启用此设置。 还要注意 [uncompressed\_cache\_size](../server-configuration-parameters/settings.md#server-settings-uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted. 对于至少读取大量数据(一百万行或更多行)的查询,将自动禁用未压缩缓存,以节省真正小型查询的空间。 这意味着你可以保持 ‘use\_uncompressed\_cache’ 设置始终设置为1。 @@ -667,7 +667,7 @@ Cancels HTTP read-only queries (e.g. SELECT) when a client closes the connectio 当使用HTTP接口时, ‘query\_id’ 参数可以传递。 这是用作查询标识符的任何字符串。 如果来自同一用户的查询具有相同的 ‘query\_id’ 已经存在在这个时候,行为取决于 ‘replace\_running\_query’ 参数。 -`0` (default) – Throw an exception (don't allow the query to run if a query with the same ‘query\_id’ 已经运行)。 +`0` (default) – Throw an exception (don’t allow the query to run if a query with the same ‘query\_id’ 已经运行)。 `1` – Cancel the old query and start running the new one. @@ -707,7 +707,7 @@ load_balancing = random load_balancing = nearest_hostname ``` -The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server's hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). +The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server’s hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames). 例如,例如01-01-1和example01-01-2.yandex.ru 在一个位置是不同的,而example01-01-1和example01-02-2在两个地方不同。 这种方法可能看起来很原始,但它不需要有关网络拓扑的外部数据,也不比较IP地址,这对于我们的IPv6地址来说会很复杂。 @@ -778,7 +778,7 @@ For testing, the value can be set to 0: compilation runs synchronously and the q 如果该值为1或更大,则编译在单独的线程中异步进行。 结果将在准备就绪后立即使用,包括当前正在运行的查询。 对于查询中使用的聚合函数的每个不同组合以及GROUP BY子句中的键类型,都需要编译代码。 -The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don't use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. +The results of the compilation are saved in the build directory in the form of .so files. There is no restriction on the number of compilation results since they don’t use very much space. Old results will be used after server restarts, except in the case of a server upgrade – in this case, the old results are deleted. ## output\_format\_json\_quote\_64bit\_integers {#session_settings-output_format_json_quote_64bit_integers} @@ -886,7 +886,7 @@ ClickHouse生成异常 默认情况下,重复数据删除不对实例化视图执行,而是在源表的上游执行。 如果由于源表中的重复数据删除而跳过了插入的块,则不会插入附加的实例化视图。 这种行为的存在是为了允许将高度聚合的数据插入到实例化视图中,对于在实例化视图聚合之后插入的块相同,但是从源表中的不同插入派生的情况。 -与此同时,这种行为 “breaks” `INSERT` 幂等性 如果一个 `INSERT` 进入主表是成功的, `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won't receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` 允许改变这种行为。 重试时,实例化视图将收到重复插入,并自行执行重复数据删除检查, +与此同时,这种行为 “breaks” `INSERT` 幂等性 如果一个 `INSERT` 进入主表是成功的, `INSERT` into a materialized view failed (e.g. because of communication failure with Zookeeper) a client will get an error and can retry the operation. However, the materialized view won’t receive the second insert because it will be discarded by deduplication in the main (source) table. The setting `deduplicate_blocks_in_dependent_materialized_views` 允许改变这种行为。 重试时,实例化视图将收到重复插入,并自行执行重复数据删除检查, 忽略源表的检查结果,并将插入由于第一次失败而丢失的行。 ## max\_network\_bytes {#settings-max-network-bytes} @@ -935,15 +935,15 @@ ClickHouse生成异常 ## count\_distinct\_implementation {#settings-count_distinct_implementation} -指定其中的 `uniq*` 函数应用于执行 [COUNT(DISTINCT …)](../../sql_reference/aggregate_functions/reference.md#agg_function-count) 建筑。 +指定其中的 `uniq*` 函数应用于执行 [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference.md#agg_function-count) 建筑。 可能的值: -- [uniq](../../sql_reference/aggregate_functions/reference.md#agg_function-uniq) -- [uniqCombined](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined) -- [uniqCombined64](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqcombined64) -- [uniqHLL12](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqhll12) -- [uniqExact](../../sql_reference/aggregate_functions/reference.md#agg_function-uniqexact) +- [uniq](../../sql-reference/aggregate-functions/reference.md#agg_function-uniq) +- [uniqCombined](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined) +- [uniqCombined64](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqcombined64) +- [uniqHLL12](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqhll12) +- [uniqExact](../../sql-reference/aggregate-functions/reference.md#agg_function-uniqexact) 默认值: `uniqExact`. @@ -1008,7 +1008,7 @@ ClickHouse生成异常 ## optimize\_throw\_if\_noop {#setting-optimize_throw_if_noop} -启用或禁用抛出异常,如果 [OPTIMIZE](../../sql_reference/statements/misc.md#misc_operations-optimize) 查询未执行合并。 +启用或禁用抛出异常,如果 [OPTIMIZE](../../sql-reference/statements/misc.md#misc_operations-optimize) 查询未执行合并。 默认情况下, `OPTIMIZE` 即使它没有做任何事情,也会成功返回。 此设置允许您区分这些情况并在异常消息中获取原因。 @@ -1028,7 +1028,7 @@ ClickHouse生成异常 另请参阅: -- [表引擎分布式](../../engines/table_engines/special/distributed.md) +- [表引擎分布式](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_cap](#settings-distributed_replica_error_cap) ## distributed\_replica\_error\_cap {#settings-distributed_replica_error_cap} @@ -1040,12 +1040,12 @@ ClickHouse生成异常 另请参阅: -- [表引擎分布式](../../engines/table_engines/special/distributed.md) +- [表引擎分布式](../../engines/table-engines/special/distributed.md) - [distributed\_replica\_error\_half\_life](#settings-distributed_replica_error_half_life) ## distributed\_directory\_monitor\_sleep\_time\_ms {#distributed_directory_monitor_sleep_time_ms} -对于基本间隔 [分布](../../engines/table_engines/special/distributed.md) 表引擎发送数据。 在发生错误时,实际间隔呈指数级增长。 +对于基本间隔 [分布](../../engines/table-engines/special/distributed.md) 表引擎发送数据。 在发生错误时,实际间隔呈指数级增长。 可能的值: @@ -1055,7 +1055,7 @@ ClickHouse生成异常 ## distributed\_directory\_monitor\_max\_sleep\_time\_ms {#distributed_directory_monitor_max_sleep_time_ms} -的最大间隔 [分布](../../engines/table_engines/special/distributed.md) 表引擎发送数据。 限制在设置的区间的指数增长 [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) 设置。 +的最大间隔 [分布](../../engines/table-engines/special/distributed.md) 表引擎发送数据。 限制在设置的区间的指数增长 [distributed\_directory\_monitor\_sleep\_time\_ms](#distributed_directory_monitor_sleep_time_ms) 设置。 可能的值: @@ -1067,7 +1067,7 @@ ClickHouse生成异常 启用/禁用批量发送插入的数据。 -当批量发送被启用时, [分布](../../engines/table_engines/special/distributed.md) 表引擎尝试在一个操作中发送插入数据的多个文件,而不是单独发送它们。 批量发送通过更好地利用服务器和网络资源来提高集群性能。 +当批量发送被启用时, [分布](../../engines/table-engines/special/distributed.md) 表引擎尝试在一个操作中发送插入数据的多个文件,而不是单独发送它们。 批量发送通过更好地利用服务器和网络资源来提高集群性能。 可能的值: @@ -1093,7 +1093,7 @@ ClickHouse生成异常 ## query\_profiler\_real\_time\_period\_ns {#query_profiler_real_time_period_ns} -设置周期的实时时钟定时器 [查询探查器](../../operations/optimizing_performance/sampling_query_profiler.md). 真正的时钟计时器计数挂钟时间。 +设置周期的实时时钟定时器 [查询探查器](../../operations/optimizing-performance/sampling-query-profiler.md). 真正的时钟计时器计数挂钟时间。 可能的值: @@ -1106,17 +1106,17 @@ ClickHouse生成异常 - 0用于关闭计时器。 -类型: [UInt64](../../sql_reference/data_types/int_uint.md). +类型: [UInt64](../../sql-reference/data-types/int-uint.md). 默认值:1000000000纳秒(每秒一次)。 另请参阅: -- 系统表 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- 系统表 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## query\_profiler\_cpu\_time\_period\_ns {#query_profiler_cpu_time_period_ns} -设置周期的CPU时钟定时器 [查询探查器](../../operations/optimizing_performance/sampling_query_profiler.md). 此计时器仅计算CPU时间。 +设置周期的CPU时钟定时器 [查询探查器](../../operations/optimizing-performance/sampling-query-profiler.md). 此计时器仅计算CPU时间。 可能的值: @@ -1129,17 +1129,17 @@ ClickHouse生成异常 - 0用于关闭计时器。 -类型: [UInt64](../../sql_reference/data_types/int_uint.md). +类型: [UInt64](../../sql-reference/data-types/int-uint.md). 默认值:1000000000纳秒。 另请参阅: -- 系统表 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- 系统表 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## allow\_introspection\_functions {#settings-allow_introspection_functions} -启用禁用 [反省函数](../../sql_reference/functions/introspection.md) 用于查询分析。 +启用禁用 [反省函数](../../sql-reference/functions/introspection.md) 用于查询分析。 可能的值: @@ -1150,8 +1150,8 @@ ClickHouse生成异常 **另请参阅** -- [采样查询探查器](../optimizing_performance/sampling_query_profiler.md) -- 系统表 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) +- [采样查询探查器](../optimizing-performance/sampling-query-profiler.md) +- 系统表 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) ## input\_format\_parallel\_parsing {#input-format-parallel-parsing} diff --git a/docs/zh/operations/settings/settings_users.md b/docs/zh/operations/settings/settings_users.md deleted file mode 100644 index 2dba689d08f..00000000000 --- a/docs/zh/operations/settings/settings_users.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 63 -toc_title: "\u7528\u6237\u8BBE\u7F6E" ---- - -# 用户设置 {#user-settings} - -该 `users` 一节 `user.xml` 配置文件包含用户设置。 - -的结构 `users` 科: - -``` xml - - - - - - - - - - - profile_name - - default - - - - - expression - - - - - - -``` - -### 用户名称/密码 {#user-namepassword} - -密码可以以明文或SHA256(十六进制格式)指定。 - -- 以明文形式分配密码 (**不推荐**),把它放在一个 `password` 元素。 - - 例如, `qwerty`. 密码可以留空。 - - - -- 要使用其SHA256散列分配密码,请将其放置在 `password_sha256_hex` 元素。 - - 例如, `65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5`. - - 如何从shell生成密码的示例: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-' - - 结果的第一行是密码。 第二行是相应的SHA256哈希。 - - - -- 为了与MySQL客户端兼容,密码可以在双SHA1哈希中指定。 放进去 `password_double_sha1_hex` 元素。 - - 例如, `08b4a0f1de6ad37da17359e592c8d74788a83eb0`. - - 如何从shell生成密码的示例: - - PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-' - - 结果的第一行是密码。 第二行是相应的双SHA1哈希。 - -### 用户名称/网络 {#user-namenetworks} - -用户可以从中连接到ClickHouse服务器的网络列表。 - -列表中的每个元素都可以具有以下形式之一: - -- `` — IP address or network mask. - - 例: `213.180.204.3`, `10.0.0.1/8`, `10.0.0.1/255.255.255.0`, `2a02:6b8::3`, `2a02:6b8::3/64`, `2a02:6b8::3/ffff:ffff:ffff:ffff::`. - -- `` — Hostname. - - 示例: `example01.host.ru`. - - 要检查访问,将执行DNS查询,并将所有返回的IP地址与对等地址进行比较。 - -- `` — Regular expression for hostnames. - - 示例, `^example\d\d-\d\d-\d\.host\.ru$` - - 要检查访问,a [DNS PTR查询](https://en.wikipedia.org/wiki/Reverse_DNS_lookup) 对对等体地址执行,然后应用指定的正则表达式。 然后,对PTR查询的结果执行另一个DNS查询,并将所有接收到的地址与对等地址进行比较。 我们强烈建议正则表达式以$结尾。 - -DNS请求的所有结果都将被缓存,直到服务器重新启动。 - -**例** - -要从任何网络打开用户的访问权限,请指定: - -``` xml -::/0 -``` - -!!! warning "警告" - 从任何网络开放访问是不安全的,除非你有一个防火墙正确配置或服务器没有直接连接到互联网。 - -若要仅从本地主机打开访问权限,请指定: - -``` xml -::1 -127.0.0.1 -``` - -### user\_name/profile {#user-nameprofile} - -您可以为用户分配设置配置文件。 设置配置文件在单独的部分配置 `users.xml` 文件 有关详细信息,请参阅 [设置配置文件](settings_profiles.md). - -### 用户名称/配额 {#user-namequota} - -配额允许您在一段时间内跟踪或限制资源使用情况。 配额在配置 `quotas` -一节 `users.xml` 配置文件。 - -您可以为用户分配配额。 有关配额配置的详细说明,请参阅 [配额](../quotas.md#quotas). - -### 用户名/数据库 {#user-namedatabases} - -在本节中,您可以限制ClickHouse返回的行 `SELECT` 由当前用户进行的查询,从而实现基本的行级安全性。 - -**示例** - -以下配置强制该用户 `user1` 只能看到的行 `table1` 作为结果 `SELECT` 查询,其中的值 `id` 场是1000。 - -``` xml - - - - - id = 1000 - - - - -``` - -该 `filter` 可以是导致任何表达式 [UInt8](../../sql_reference/data_types/int_uint.md)-键入值。 它通常包含比较和逻辑运算符。 从行 `database_name.table1` 其中,不会为此用户返回为0的筛选结果。 过滤是不兼容的 `PREWHERE` 操作和禁用 `WHERE→PREWHERE` 优化。 - -[原始文章](https://clickhouse.tech/docs/en/operations/settings/settings_users/) diff --git a/docs/zh/operations/system-tables.md b/docs/zh/operations/system-tables.md new file mode 100644 index 00000000000..eb84a62ac8f --- /dev/null +++ b/docs/zh/operations/system-tables.md @@ -0,0 +1,1126 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 52 +toc_title: "\u7CFB\u7EDF\u8868" +--- + +# 系统表 {#system-tables} + +系统表用于实现系统的部分功能,并提供对有关系统如何工作的信息的访问。 +您无法删除系统表(但可以执行分离)。 +系统表没有包含磁盘上数据的文件或包含元数据的文件。 服务器在启动时创建所有系统表。 +系统表是只读的。 +它们位于 ‘system’ 数据库。 + +## 系统。asynchronous\_metrics {#system_tables-asynchronous_metrics} + +包含在后台定期计算的指标。 例如,在使用的RAM量。 + +列: + +- `metric` ([字符串](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Float64](../sql-reference/data-types/float.md)) — Metric value. + +**示例** + +``` sql +SELECT * FROM system.asynchronous_metrics LIMIT 10 +``` + +``` text +┌─metric──────────────────────────────────┬──────value─┐ +│ jemalloc.background_thread.run_interval │ 0 │ +│ jemalloc.background_thread.num_runs │ 0 │ +│ jemalloc.background_thread.num_threads │ 0 │ +│ jemalloc.retained │ 422551552 │ +│ jemalloc.mapped │ 1682989056 │ +│ jemalloc.resident │ 1656446976 │ +│ jemalloc.metadata_thp │ 0 │ +│ jemalloc.metadata │ 10226856 │ +│ UncompressedCacheCells │ 0 │ +│ MarkCacheFiles │ 0 │ +└─────────────────────────────────────────┴────────────┘ +``` + +**另请参阅** + +- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. +- [系统。指标](#system_tables-metrics) — Contains instantly calculated metrics. +- [系统。活动](#system_tables-events) — Contains a number of events that have occurred. +- [系统。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. + +## 系统。集群 {#system-clusters} + +包含有关配置文件中可用的集群及其中的服务器的信息。 + +列: + +- `cluster` (String) — The cluster name. +- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. +- `shard_weight` (UInt32) — The relative weight of the shard when writing data. +- `replica_num` (UInt32) — The replica number in the shard, starting from 1. +- `host_name` (String) — The host name, as specified in the config. +- `host_address` (String) — The host IP address obtained from DNS. +- `port` (UInt16) — The port to use for connecting to the server. +- `user` (String) — The name of the user for connecting to the server. +- `errors_count` (UInt32)-此主机无法到达副本的次数。 +- `estimated_recovery_time` (UInt32)-剩下的秒数,直到副本错误计数归零,它被认为是恢复正常。 + +请注意 `errors_count` 每个查询集群更新一次,但 `estimated_recovery_time` 按需重新计算。 所以有可能是非零的情况 `errors_count` 和零 `estimated_recovery_time`,下一个查询将为零 `errors_count` 并尝试使用副本,就好像它没有错误。 + +**另请参阅** + +- [表引擎分布式](../engines/table-engines/special/distributed.md) +- [distributed\_replica\_error\_cap设置](settings/settings.md#settings-distributed_replica_error_cap) +- [distributed\_replica\_error\_half\_life设置](settings/settings.md#settings-distributed_replica_error_half_life) + +## 系统。列 {#system-columns} + +包含有关所有表中列的信息。 + +您可以使用此表获取类似于以下内容的信息 [DESCRIBE TABLE](../sql-reference/statements/misc.md#misc-describe-table) 查询,但对于多个表一次。 + +该 `system.columns` 表包含以下列(列类型显示在括号中): + +- `database` (String) — Database name. +- `table` (String) — Table name. +- `name` (String) — Column name. +- `type` (String) — Column type. +- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`)为默认值,如果没有定义,则为空字符串。 +- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. +- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. +- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. +- `marks_bytes` (UInt64) — The size of marks, in bytes. +- `comment` (String) — Comment on the column, or an empty string if it is not defined. +- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. +- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. +- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. +- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. + +## 系统。贡献者 {#system-contributors} + +包含有关贡献者的信息。 按随机顺序排列所有构造。 该顺序在查询执行时是随机的。 + +列: + +- `name` (String) — Contributor (author) name from git log. + +**示例** + +``` sql +SELECT * FROM system.contributors LIMIT 10 +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +│ Max Vetrov │ +│ LiuYangkuan │ +│ svladykin │ +│ zamulla │ +│ Šimon Podlipský │ +│ BayoNet │ +│ Ilya Khomutov │ +│ Amy Krishnevsky │ +│ Loud_Scream │ +└──────────────────┘ +``` + +要在表中找出自己,请使用查询: + +``` sql +SELECT * FROM system.contributors WHERE name='Olga Khvostikova' +``` + +``` text +┌─name─────────────┐ +│ Olga Khvostikova │ +└──────────────────┘ +``` + +## 系统。数据库 {#system-databases} + +此表包含一个名为“字符串”的列 ‘name’ – the name of a database. +服务器知道的每个数据库在表中都有相应的条目。 +该系统表用于实现 `SHOW DATABASES` 查询。 + +## 系统。detached\_parts {#system_tables-detached_parts} + +包含有关分离部分的信息 [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) 桌子 该 `reason` 列指定分离部件的原因。 对于用户分离的部件,原因是空的。 这些部件可以附加 [ALTER TABLE ATTACH PARTITION\|PART](../sql-reference/statements/alter.md#alter_attach-partition) 指挥部 有关其他列的说明,请参阅 [系统。零件](#system_tables-parts). 如果部件名称无效,某些列的值可能为 `NULL`. 这些部分可以删除 [ALTER TABLE DROP DETACHED PART](../sql-reference/statements/alter.md#alter_drop-detached). + +## 系统。字典 {#system-dictionaries} + +包含有关外部字典的信息。 + +列: + +- `name` (String) — Dictionary name. +- `type` (String) — Dictionary type: Flat, Hashed, Cache. +- `origin` (String) — Path to the configuration file that describes the dictionary. +- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. +- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. +- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. +- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. +- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. +- `element_count` (UInt64) — The number of items stored in the dictionary. +- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). +- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. +- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn’t be created. +- `source` (String) — Text describing the data source for the dictionary. + +请注意,字典使用的内存量与其中存储的项目数量不成正比。 因此,对于平面和缓存字典,所有的内存单元都是预先分配的,而不管字典实际上有多满。 + +## 系统。活动 {#system_tables-events} + +包含有关系统中发生的事件数的信息。 例如,在表中,您可以找到多少 `SELECT` 自ClickHouse服务器启动以来已处理查询。 + +列: + +- `event` ([字符串](../sql-reference/data-types/string.md)) — Event name. +- `value` ([UInt64](../sql-reference/data-types/int-uint.md)) — Number of events occurred. +- `description` ([字符串](../sql-reference/data-types/string.md)) — Event description. + +**示例** + +``` sql +SELECT * FROM system.events LIMIT 5 +``` + +``` text +┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ +│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ +│ FileOpen │ 73 │ Number of files opened. │ +│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ +│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ +└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**另请参阅** + +- [系统。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [系统。指标](#system_tables-metrics) — Contains instantly calculated metrics. +- [系统。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. + +## 系统。功能 {#system-functions} + +包含有关正常函数和聚合函数的信息。 + +列: + +- `name`(`String`) – The name of the function. +- `is_aggregate`(`UInt8`) — Whether the function is aggregate. + +## 系统。graphite\_retentions {#system-graphite-retentions} + +包含有关参数的信息 [graphite\_rollup](server-configuration-parameters/settings.md#server_configuration_parameters-graphite_rollup) 这是在表中使用 [\*GraphiteMergeTree](../engines/table-engines/mergetree-family/graphitemergetree.md) 引擎 + +列: + +- `config_name` (字符串) - `graphite_rollup` 参数名称。 +- `regexp` (String)-指标名称的模式。 +- `function` (String)-聚合函数的名称。 +- `age` (UInt64)-以秒为单位的数据的最小期限。 +- `precision` (UInt64)-如何精确地定义以秒为单位的数据的年龄。 +- `priority` (UInt16)-模式优先级。 +- `is_default` (UInt8)-模式是否为默认值。 +- `Tables.database` (Array(String))-使用数据库表名称的数组 `config_name` 参数。 +- `Tables.table` (Array(String))-使用表名称的数组 `config_name` 参数。 + +## 系统。合并 {#system-merges} + +包含有关MergeTree系列中表当前正在进行的合并和部件突变的信息。 + +列: + +- `database` (String) — The name of the database the table is in. +- `table` (String) — Table name. +- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. +- `progress` (Float64) — The percentage of completed work from 0 to 1. +- `num_parts` (UInt64) — The number of pieces to be merged. +- `result_part_name` (String) — The name of the part that will be formed as the result of merging. +- `is_mutation` (UInt8)-1如果这个过程是一个部分突变. +- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. +- `total_size_marks` (UInt64) — The total number of marks in the merged parts. +- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. +- `rows_read` (UInt64) — Number of rows read. +- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. +- `rows_written` (UInt64) — Number of rows written. + +## 系统。指标 {#system_tables-metrics} + +包含可以立即计算或具有当前值的指标。 例如,同时处理的查询的数量或当前副本的延迟。 此表始终是最新的。 + +列: + +- `metric` ([字符串](../sql-reference/data-types/string.md)) — Metric name. +- `value` ([Int64](../sql-reference/data-types/int-uint.md)) — Metric value. +- `description` ([字符串](../sql-reference/data-types/string.md)) — Metric description. + +支持的指标列表,您可以在 [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) ClickHouse的源文件。 + +**示例** + +``` sql +SELECT * FROM system.metrics LIMIT 10 +``` + +``` text +┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Query │ 1 │ Number of executing queries │ +│ Merge │ 0 │ Number of executing background merges │ +│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ +│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ +│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ +│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ +│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ +│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ +│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ +│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ +└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**另请参阅** + +- [系统。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [系统。活动](#system_tables-events) — Contains a number of events that occurred. +- [系统。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. +- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. + +## 系统。metric\_log {#system_tables-metric_log} + +包含表中度量值的历史记录 `system.metrics` 和 `system.events`,定期刷新到磁盘。 +打开指标历史记录收集 `system.metric_log`,创建 `/etc/clickhouse-server/config.d/metric_log.xml` 具有以下内容: + +``` xml + + + system + metric_log
+ 7500 + 1000 +
+
+``` + +**示例** + +``` sql +SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; +``` + +``` text +Row 1: +────── +event_date: 2020-02-18 +event_time: 2020-02-18 07:15:33 +milliseconds: 554 +ProfileEvent_Query: 0 +ProfileEvent_SelectQuery: 0 +ProfileEvent_InsertQuery: 0 +ProfileEvent_FileOpen: 0 +ProfileEvent_Seek: 0 +ProfileEvent_ReadBufferFromFileDescriptorRead: 1 +ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 +ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 +ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 +ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 +ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 +... +CurrentMetric_Query: 0 +CurrentMetric_Merge: 0 +CurrentMetric_PartMutation: 0 +CurrentMetric_ReplicatedFetch: 0 +CurrentMetric_ReplicatedSend: 0 +CurrentMetric_ReplicatedChecks: 0 +... +``` + +**另请参阅** + +- [系统。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. +- [系统。活动](#system_tables-events) — Contains a number of events that occurred. +- [系统。指标](#system_tables-metrics) — Contains instantly calculated metrics. +- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. + +## 系统。数字 {#system-numbers} + +此表包含一个名为UInt64的列 ‘number’ 它包含几乎所有从零开始的自然数。 +您可以使用此表进行测试,或者如果您需要进行暴力搜索。 +从此表中读取的内容不是并行的。 + +## 系统。numbers\_mt {#system-numbers-mt} + +一样的 ‘system.numbers’ 但读取是并行的。 这些数字可以以任何顺序返回。 +用于测试。 + +## 系统。一 {#system-one} + +此表包含一行,其中包含一行 ‘dummy’ UInt8列包含值0。 +如果SELECT查询未指定FROM子句,则使用此表。 +这与其他Dbms中的双表类似。 + +## 系统。零件 {#system_tables-parts} + +包含有关的部分信息 [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) 桌子 + +每行描述一个数据部分。 + +列: + +- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql-reference/statements/alter.md#query_language_queries_alter) 查询。 + + 格式: + + - `YYYYMM` 用于按月自动分区。 + - `any_string` 手动分区时。 + +- `name` (`String`) – Name of the data part. + +- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it’s used in a table. Otherwise, it’s deleted. Inactive data parts remain after merging. + +- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` 通过索引粒度(通常为8192)(此提示不适用于自适应粒度)。 + +- `rows` (`UInt64`) – The number of rows. + +- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. + +- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. + +- `marks_bytes` (`UInt64`) – The size of the file with marks. + +- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| + +- `remove_time` (`DateTime`) – The time when the data part became inactive. + +- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. + +- `min_date` (`Date`) – The minimum value of the date key in the data part. + +- `max_date` (`Date`) – The maximum value of the date key in the data part. + +- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. + +- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. + +- `partition_id` (`String`) – ID of the partition. + +- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. + +- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. + +- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. + +- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). + +- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. + +- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. + +- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn’t exist. For more details, see [FREEZE PARTITION](../sql-reference/statements/alter.md#alter_freeze-partition) + +- `database` (`String`) – Name of the database. + +- `table` (`String`) – Name of the table. + +- `engine` (`String`) – Name of the table engine without parameters. + +- `path` (`String`) – Absolute path to the folder with data part files. + +- `disk` (`String`) – Name of a disk that stores the data part. + +- `hash_of_all_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) 的压缩文件。 + +- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) 未压缩的文件(带标记的文件,索引文件等。). + +- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql-reference/functions/hash-functions.md#hash_functions-siphash128) 压缩文件中的数据,就好像它们是未压缩的。 + +- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. + +- `marks_size` (`UInt64`) – Alias for `marks_bytes`. + +## 系统。part\_log {#system_tables-part-log} + +该 `system.part_log` 表只有当创建 [part\_log](server-configuration-parameters/settings.md#server_configuration_parameters-part-log) 指定了服务器设置。 + +此表包含与以下情况发生的事件有关的信息 [数据部分](../engines/table-engines/mergetree-family/custom-partitioning-key.md) 在 [MergeTree](../engines/table-engines/mergetree-family/mergetree.md) 家庭表,例如添加或合并数据。 + +该 `system.part_log` 表包含以下列: + +- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: + - `NEW_PART` — Inserting of a new data part. + - `MERGE_PARTS` — Merging of data parts. + - `DOWNLOAD_PART` — Downloading a data part. + - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql-reference/statements/alter.md#alter_detach-partition). + - `MUTATE_PART` — Mutating of a data part. + - `MOVE_PART` — Moving the data part from the one disk to another one. +- `event_date` (Date) — Event date. +- `event_time` (DateTime) — Event time. +- `duration_ms` (UInt64) — Duration. +- `database` (String) — Name of the database the data part is in. +- `table` (String) — Name of the table the data part is in. +- `part_name` (String) — Name of the data part. +- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ 值,如果分区是由 `tuple()`. +- `rows` (UInt64) — The number of rows in the data part. +- `size_in_bytes` (UInt64) — Size of the data part in bytes. +- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). +- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. +- `read_rows` (UInt64) — The number of rows was read during the merge. +- `read_bytes` (UInt64) — The number of bytes was read during the merge. +- `error` (UInt16) — The code number of the occurred error. +- `exception` (String) — Text message of the occurred error. + +该 `system.part_log` 表的第一个插入数据到后创建 `MergeTree` 桌子 + +## 系统。流程 {#system_tables-processes} + +该系统表用于实现 `SHOW PROCESSLIST` 查询。 + +列: + +- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` 用户。 该字段包含特定查询的用户名,而不是此查询启动的查询的用户名。 +- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` 查询请求者服务器上。 +- `elapsed` (Float64) – The time in seconds since request execution started. +- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. +- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. +- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query-complexity.md#settings_max_memory_usage) 设置。 +- `query` (String) – The query text. For `INSERT`,它不包括要插入的数据。 +- `query_id` (String) – Query ID, if defined. + +## 系统。text\_log {#system-tables-text-log} + +包含日志记录条目。 进入该表的日志记录级别可以通过以下方式进行限制 `text_log.level` 服务器设置。 + +列: + +- `event_date` (`Date`)-条目的日期。 +- `event_time` (`DateTime`)-条目的时间。 +- `microseconds` (`UInt32`)-条目的微秒。 +- `thread_name` (String) — Name of the thread from which the logging was done. +- `thread_id` (UInt64) — OS thread ID. +- `level` (`Enum8`)-入门级。 + - `'Fatal' = 1` + - `'Critical' = 2` + - `'Error' = 3` + - `'Warning' = 4` + - `'Notice' = 5` + - `'Information' = 6` + - `'Debug' = 7` + - `'Trace' = 8` +- `query_id` (`String`)-查询的ID。 +- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) +- `message` (`String`)-消息本身。 +- `revision` (`UInt32`)-ClickHouse修订。 +- `source_file` (`LowCardinality(String)`)-从中完成日志记录的源文件。 +- `source_line` (`UInt64`)-从中完成日志记录的源代码行。 + +## 系统。query\_log {#system_tables-query_log} + +包含有关查询执行的信息。 对于每个查询,您可以看到处理开始时间,处理持续时间,错误消息和其他信息。 + +!!! note "注" + 该表不包含以下内容的输入数据 `INSERT` 查询。 + +ClickHouse仅在以下情况下创建此表 [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) 指定服务器参数。 此参数设置日志记录规则,例如日志记录间隔或将记录查询的表的名称。 + +要启用查询日志记录,请设置 [log\_queries](settings/settings.md#settings-log-queries) 参数为1。 有关详细信息,请参阅 [设置](settings/settings.md) 科。 + +该 `system.query_log` 表注册两种查询: + +1. 客户端直接运行的初始查询。 +2. 由其他查询启动的子查询(用于分布式查询执行)。 对于这些类型的查询,有关父查询的信息显示在 `initial_*` 列。 + +列: + +- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: + - `'QueryStart' = 1` — Successful start of query execution. + - `'QueryFinish' = 2` — Successful end of query execution. + - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. + - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. +- `event_date` (Date) — Query starting date. +- `event_time` (DateTime) — Query starting time. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` 查询,写入的行数。 对于其他查询,列值为0。 +- `written_bytes` (UInt64) — For `INSERT` 查询时,写入的字节数。 对于其他查询,列值为0。 +- `result_rows` (UInt64) — Number of rows in the result. +- `result_bytes` (UInt64) — Number of bytes in the result. +- `memory_usage` (UInt64) — Memory consumption by the query. +- `query` (String) — Query string. +- `exception` (String) — Exception message. +- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或者运行另一个TCP客户端。 +- `client_name` (String) — The [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端名称。 +- `client_revision` (UInt32) — Revision of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 +- `client_version_major` (UInt32) — Major version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 +- `client_version_minor` (UInt32) — Minor version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 +- `client_version_patch` (UInt32) — Patch component of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端版本。 +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` 方法被使用。 + - 2 — `POST` 方法被使用。 +- `http_user_agent` (String) — The `UserAgent` http请求中传递的标头。 +- `quota_key` (String) — The “quota key” 在指定 [配额](quotas.md) 设置(见 `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [系统。活动](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` 列。 +- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` 参数为1。 +- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` 列。 + +每个查询创建一个或两个行中 `query_log` 表,具体取决于查询的状态: + +1. 如果查询执行成功,将创建两个类型为1和2的事件(请参阅 `type` 列)。 +2. 如果在查询处理过程中发生错误,将创建两个类型为1和4的事件。 +3. 如果在启动查询之前发生错误,将创建类型为3的单个事件。 + +默认情况下,日志以7.5秒的间隔添加到表中。 您可以在设置此时间间隔 [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) 服务器设置(请参阅 `flush_interval_milliseconds` 参数)。 要强制将日志从内存缓冲区刷新到表中,请使用 `SYSTEM FLUSH LOGS` 查询。 + +当手动删除表时,它将自动动态创建。 请注意,所有以前的日志将被删除。 + +!!! note "注" + 日志的存储周期是无限的。 日志不会自动从表中删除。 您需要自己组织删除过时的日志。 + +您可以指定一个任意的分区键 `system.query_log` 表中的 [query\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-log) 服务器设置(请参阅 `partition_by` 参数)。 + +## 系统。query\_thread\_log {#system_tables-query-thread-log} + +该表包含有关每个查询执行线程的信息。 + +ClickHouse仅在以下情况下创建此表 [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) 指定服务器参数。 此参数设置日志记录规则,例如日志记录间隔或将记录查询的表的名称。 + +要启用查询日志记录,请设置 [log\_query\_threads](settings/settings.md#settings-log-query-threads) 参数为1。 有关详细信息,请参阅 [设置](settings/settings.md) 科。 + +列: + +- `event_date` (Date) — the date when the thread has finished execution of the query. +- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. +- `query_start_time` (DateTime) — Start time of query execution. +- `query_duration_ms` (UInt64) — Duration of query execution. +- `read_rows` (UInt64) — Number of read rows. +- `read_bytes` (UInt64) — Number of read bytes. +- `written_rows` (UInt64) — For `INSERT` 查询,写入的行数。 对于其他查询,列值为0。 +- `written_bytes` (UInt64) — For `INSERT` 查询时,写入的字节数。 对于其他查询,列值为0。 +- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. +- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. +- `thread_name` (String) — Name of the thread. +- `thread_number` (UInt32) — Internal thread ID. +- `os_thread_id` (Int32) — OS thread ID. +- `master_thread_id` (UInt64) — OS initial ID of initial thread. +- `query` (String) — Query string. +- `is_initial_query` (UInt8) — Query type. Possible values: + - 1 — Query was initiated by the client. + - 0 — Query was initiated by another query for distributed query execution. +- `user` (String) — Name of the user who initiated the current query. +- `query_id` (String) — ID of the query. +- `address` (IPv6) — IP address that was used to make the query. +- `port` (UInt16) — The client port that was used to make the query. +- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). +- `initial_query_id` (String) — ID of the initial query (for distributed query execution). +- `initial_address` (IPv6) — IP address that the parent query was launched from. +- `initial_port` (UInt16) — The client port that was used to make the parent query. +- `interface` (UInt8) — Interface that the query was initiated from. Possible values: + - 1 — TCP. + - 2 — HTTP. +- `os_user` (String) — OS’s username who runs [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md). +- `client_hostname` (String) — Hostname of the client machine where the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或者运行另一个TCP客户端。 +- `client_name` (String) — The [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端名称。 +- `client_revision` (UInt32) — Revision of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 +- `client_version_major` (UInt32) — Major version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 +- `client_version_minor` (UInt32) — Minor version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 +- `client_version_patch` (UInt32) — Patch component of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端版本。 +- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: + - 0 — The query was launched from the TCP interface. + - 1 — `GET` 方法被使用。 + - 2 — `POST` 方法被使用。 +- `http_user_agent` (String) — The `UserAgent` http请求中传递的标头。 +- `quota_key` (String) — The “quota key” 在指定 [配额](quotas.md) 设置(见 `keyed`). +- `revision` (UInt32) — ClickHouse revision. +- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [系统。活动](#system_tables-events) +- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` 列。 + +默认情况下,日志以7.5秒的间隔添加到表中。 您可以在设置此时间间隔 [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) 服务器设置(请参阅 `flush_interval_milliseconds` 参数)。 要强制将日志从内存缓冲区刷新到表中,请使用 `SYSTEM FLUSH LOGS` 查询。 + +当手动删除表时,它将自动动态创建。 请注意,所有以前的日志将被删除。 + +!!! note "注" + 日志的存储周期是无限的。 日志不会自动从表中删除。 您需要自己组织删除过时的日志。 + +您可以指定一个任意的分区键 `system.query_thread_log` 表中的 [query\_thread\_log](server-configuration-parameters/settings.md#server_configuration_parameters-query-thread-log) 服务器设置(请参阅 `partition_by` 参数)。 + +## 系统。trace\_log {#system_tables-trace_log} + +包含采样查询探查器收集的堆栈跟踪。 + +ClickHouse创建此表时 [trace\_log](server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) 服务器配置部分被设置。 也是 [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) 和 [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) 应设置设置。 + +要分析日志,请使用 `addressToLine`, `addressToSymbol` 和 `demangle` 内省功能。 + +列: + +- `event_date`([日期](../sql-reference/data-types/date.md)) — Date of sampling moment. + +- `event_time`([日期时间](../sql-reference/data-types/datetime.md)) — Timestamp of sampling moment. + +- `revision`([UInt32](../sql-reference/data-types/int-uint.md)) — ClickHouse server build revision. + + 通过以下方式连接到服务器 `clickhouse-client`,你看到的字符串类似于 `Connected to ClickHouse server version 19.18.1 revision 54429.`. 该字段包含 `revision`,但不是 `version` 的服务器。 + +- `timer_type`([枚举8](../sql-reference/data-types/enum.md)) — Timer type: + + - `Real` 表示挂钟时间。 + - `CPU` 表示CPU时间。 + +- `thread_number`([UInt32](../sql-reference/data-types/int-uint.md)) — Thread identifier. + +- `query_id`([字符串](../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) 系统表. + +- `trace`([数组(UInt64)](../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. + +**示例** + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-15 +event_time: 2019-11-15 15:09:38 +revision: 54428 +timer_type: Real +thread_number: 48 +query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 +trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] +``` + +## 系统。副本 {#system_tables-replicas} + +包含驻留在本地服务器上的复制表的信息和状态。 +此表可用于监视。 该表对于每个已复制的\*表都包含一行。 + +示例: + +``` sql +SELECT * +FROM system.replicas +WHERE table = 'visits' +FORMAT Vertical +``` + +``` text +Row 1: +────── +database: merge +table: visits +engine: ReplicatedCollapsingMergeTree +is_leader: 1 +can_become_leader: 1 +is_readonly: 0 +is_session_expired: 0 +future_parts: 1 +parts_to_check: 0 +zookeeper_path: /clickhouse/tables/01-06/visits +replica_name: example01-06-1.yandex.ru +replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru +columns_version: 9 +queue_size: 1 +inserts_in_queue: 0 +merges_in_queue: 1 +part_mutations_in_queue: 0 +queue_oldest_time: 2020-02-20 08:34:30 +inserts_oldest_time: 0000-00-00 00:00:00 +merges_oldest_time: 2020-02-20 08:34:30 +part_mutations_oldest_time: 0000-00-00 00:00:00 +oldest_part_to_get: +oldest_part_to_merge_to: 20200220_20284_20840_7 +oldest_part_to_mutate_to: +log_max_index: 596273 +log_pointer: 596274 +last_queue_update: 2020-02-20 08:34:32 +absolute_delay: 0 +total_replicas: 2 +active_replicas: 2 +``` + +列: + +- `database` (`String`)-数据库名称 +- `table` (`String`)-表名 +- `engine` (`String`)-表引擎名称 +- `is_leader` (`UInt8`)-副本是否是领导者。 + 一次只有一个副本可以成为领导者。 领导者负责选择要执行的后台合并。 + 请注意,可以对任何可用且在ZK中具有会话的副本执行写操作,而不管该副本是否为leader。 +- `can_become_leader` (`UInt8`)-副本是否可以当选为领导者。 +- `is_readonly` (`UInt8`)-副本是否处于只读模式。 + 如果配置没有ZooKeeper的部分,如果在ZooKeeper中重新初始化会话时发生未知错误,以及在ZooKeeper中重新初始化会话时发生未知错误,则此模式将打开。 +- `is_session_expired` (`UInt8`)-与ZooKeeper的会话已经过期。 基本上一样 `is_readonly`. +- `future_parts` (`UInt32`)-由于尚未完成的插入或合并而显示的数据部分的数量。 +- `parts_to_check` (`UInt32`)-队列中用于验证的数据部分的数量。 如果怀疑零件可能已损坏,则将其放入验证队列。 +- `zookeeper_path` (`String`)-在ZooKeeper中的表数据路径。 +- `replica_name` (`String`)-在动物园管理员副本名称. 同一表的不同副本具有不同的名称。 +- `replica_path` (`String`)-在ZooKeeper中的副本数据的路径。 与连接相同 ‘zookeeper\_path/replicas/replica\_path’. +- `columns_version` (`Int32`)-表结构的版本号。 指示执行ALTER的次数。 如果副本有不同的版本,这意味着一些副本还没有做出所有的改变。 +- `queue_size` (`UInt32`)-等待执行的操作的队列大小。 操作包括插入数据块、合并和某些其他操作。 它通常与 `future_parts`. +- `inserts_in_queue` (`UInt32`)-需要插入数据块的数量。 插入通常复制得相当快。 如果这个数字很大,这意味着有什么不对劲。 +- `merges_in_queue` (`UInt32`)-等待进行合并的数量。 有时合并时间很长,因此此值可能长时间大于零。 +- `part_mutations_in_queue` (`UInt32`)-等待进行的突变的数量。 +- `queue_oldest_time` (`DateTime`)-如果 `queue_size` 大于0,显示何时将最旧的操作添加到队列中。 +- `inserts_oldest_time` (`DateTime`)-看 `queue_oldest_time` +- `merges_oldest_time` (`DateTime`)-看 `queue_oldest_time` +- `part_mutations_oldest_time` (`DateTime`)-看 `queue_oldest_time` + +接下来的4列只有在有ZK活动会话的情况下才具有非零值。 + +- `log_max_index` (`UInt64`)-一般活动日志中的最大条目数。 +- `log_pointer` (`UInt64`)-副本复制到其执行队列的常规活动日志中的最大条目数加一。 如果 `log_pointer` 比 `log_max_index`,有点不对劲。 +- `last_queue_update` (`DateTime`)-上次更新队列时。 +- `absolute_delay` (`UInt64`)-当前副本有多大滞后秒。 +- `total_replicas` (`UInt8`)-此表的已知副本总数。 +- `active_replicas` (`UInt8`)-在ZooKeeper中具有会话的此表的副本的数量(即正常运行的副本的数量)。 + +如果您请求所有列,表可能会工作得有点慢,因为每行都会从ZooKeeper进行几次读取。 +如果您没有请求最后4列(log\_max\_index,log\_pointer,total\_replicas,active\_replicas),表工作得很快。 + +例如,您可以检查一切是否正常工作,如下所示: + +``` sql +SELECT + database, + table, + is_leader, + is_readonly, + is_session_expired, + future_parts, + parts_to_check, + columns_version, + queue_size, + inserts_in_queue, + merges_in_queue, + log_max_index, + log_pointer, + total_replicas, + active_replicas +FROM system.replicas +WHERE + is_readonly + OR is_session_expired + OR future_parts > 20 + OR parts_to_check > 10 + OR queue_size > 20 + OR inserts_in_queue > 10 + OR log_max_index - log_pointer > 10 + OR total_replicas < 2 + OR active_replicas < total_replicas +``` + +如果这个查询没有返回任何东西,这意味着一切都很好。 + +## 系统。设置 {#system-tables-system-settings} + +包含有关当前用户的会话设置的信息。 + +列: + +- `name` ([字符串](../sql-reference/data-types/string.md)) — Setting name. +- `value` ([字符串](../sql-reference/data-types/string.md)) — Setting value. +- `changed` ([UInt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — Shows whether a setting is changed from its default value. +- `description` ([字符串](../sql-reference/data-types/string.md)) — Short setting description. +- `min` ([可为空](../sql-reference/data-types/nullable.md)([字符串](../sql-reference/data-types/string.md))) — Minimum value of the setting, if any is set via [制约因素](settings/constraints-on-settings.md#constraints-on-settings). 如果设置没有最小值,则包含 [NULL](../sql-reference/syntax.md#null-literal). +- `max` ([可为空](../sql-reference/data-types/nullable.md)([字符串](../sql-reference/data-types/string.md))) — Maximum value of the setting, if any is set via [制约因素](settings/constraints-on-settings.md#constraints-on-settings). 如果设置没有最大值,则包含 [NULL](../sql-reference/syntax.md#null-literal). +- `readonly` ([UInt8](../sql-reference/data-types/int-uint.md#uint-ranges)) — Shows whether the current user can change the setting: + - `0` — Current user can change the setting. + - `1` — Current user can’t change the setting. + +**示例** + +下面的示例演示如何获取有关名称包含的设置的信息 `min_i`. + +``` sql +SELECT * +FROM system.settings +WHERE name LIKE '%min_i%' +``` + +``` text +┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ +│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ +└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ +``` + +使用 `WHERE changed` 可以是有用的,例如,当你想检查: + +- 配置文件中的设置是否正确加载并正在使用。 +- 在当前会话中更改的设置。 + + + +``` sql +SELECT * FROM system.settings WHERE changed AND name='load_balancing' +``` + +**另请参阅** + +- [设置](settings/index.md#settings) +- [查询权限](settings/permissions-for-queries.md#settings_readonly) +- [对设置的限制](settings/constraints-on-settings.md) + +## 系统。表\_engines {#system.table_engines} + +``` text +┌─name───────────────────┬─value───────┐ +│ max_threads │ 8 │ +│ use_uncompressed_cache │ 0 │ +│ load_balancing │ random │ +│ max_memory_usage │ 10000000000 │ +└────────────────────────┴─────────────┘ +``` + +## 系统。merge\_tree\_settings {#system-merge_tree_settings} + +包含有关以下设置的信息 `MergeTree` 桌子 + +列: + +- `name` (String) — Setting name. +- `value` (String) — Setting value. +- `description` (String) — Setting description. +- `type` (String) — Setting type (implementation specific string value). +- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. + +## 系统。表\_engines {#system-table-engines} + +包含服务器支持的表引擎的描述及其功能支持信息。 + +此表包含以下列(列类型显示在括号中): + +- `name` (String) — The name of table engine. +- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` 条款 +- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [跳过索引](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-data_skipping-indexes). +- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl). +- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` 和 `SAMPLE_BY`. +- `supports_replication` (UInt8) — Flag that indicates if table engine supports [数据复制](../engines/table-engines/mergetree-family/replication.md). +- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. + +示例: + +``` sql +SELECT * +FROM system.table_engines +WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') +``` + +``` text +┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ +│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ +│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ +│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ +└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ +``` + +**另请参阅** + +- 梅树家族 [查询子句](../engines/table-engines/mergetree-family/mergetree.md#mergetree-query-clauses) +- 卡夫卡 [设置](../engines/table-engines/integrations/kafka.md#table_engine-kafka-creating-a-table) +- 加入我们 [设置](../engines/table-engines/special/join.md#join-limitations-and-settings) + +## 系统。表 {#system-tables} + +包含服务器知道的每个表的元数据。 分离的表不显示在 `system.tables`. + +此表包含以下列(列类型显示在括号中): + +- `database` (String) — The name of the database the table is in. + +- `name` (String) — Table name. + +- `engine` (String) — Table engine name (without parameters). + +- `is_temporary` (UInt8)-指示表是否是临时的标志。 + +- `data_path` (String)-文件系统中表数据的路径。 + +- `metadata_path` (String)-文件系统中表元数据的路径。 + +- `metadata_modification_time` (DateTime)-表元数据的最新修改时间。 + +- `dependencies_database` (数组(字符串))-数据库依赖关系. + +- `dependencies_table` (数组(字符串))-表依赖关系 ([MaterializedView](../engines/table-engines/special/materializedview.md) 基于当前表的表)。 + +- `create_table_query` (String)-用于创建表的查询。 + +- `engine_full` (String)-表引擎的参数。 + +- `partition_key` (String)-表中指定的分区键表达式。 + +- `sorting_key` (String)-表中指定的排序键表达式。 + +- `primary_key` (String)-表中指定的主键表达式。 + +- `sampling_key` (String)-表中指定的采样键表达式。 + +- `storage_policy` (字符串)-存储策略: + + - [MergeTree](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes) + - [分布](../engines/table-engines/special/distributed.md#distributed) + +- `total_rows` (Nullable(UInt64))-总行数,如果可以快速确定表中的确切行数,否则 `Null` (包括内衣 `Buffer` 表)。 + +- `total_bytes` (Nullable(UInt64))-总字节数,如果可以快速确定存储表的确切字节数,否则 `Null` (**不** 包括任何底层存储)。 + + - If the table stores data on disk, returns used space on disk (i.e. compressed). + - 如果表在内存中存储数据,返回在内存中使用的近似字节数. + +该 `system.tables` 表中使用 `SHOW TABLES` 查询实现。 + +## 系统。动物园管理员 {#system-zookeeper} + +如果未配置ZooKeeper,则表不存在。 允许从配置中定义的ZooKeeper集群读取数据。 +查询必须具有 ‘path’ WHERE子句中的平等条件。 这是ZooKeeper中您想要获取数据的孩子的路径。 + +查询 `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` 输出对所有孩子的数据 `/clickhouse` 节点。 +要输出所有根节点的数据,write path= ‘/’. +如果在指定的路径 ‘path’ 不存在,将引发异常。 + +列: + +- `name` (String) — The name of the node. +- `path` (String) — The path to the node. +- `value` (String) — Node value. +- `dataLength` (Int32) — Size of the value. +- `numChildren` (Int32) — Number of descendants. +- `czxid` (Int64) — ID of the transaction that created the node. +- `mzxid` (Int64) — ID of the transaction that last changed the node. +- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. +- `ctime` (DateTime) — Time of node creation. +- `mtime` (DateTime) — Time of the last modification of the node. +- `version` (Int32) — Node version: the number of times the node was changed. +- `cversion` (Int32) — Number of added or removed descendants. +- `aversion` (Int32) — Number of changes to the ACL. +- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. + +示例: + +``` sql +SELECT * +FROM system.zookeeper +WHERE path = '/clickhouse/tables/01-08/visits/replicas' +FORMAT Vertical +``` + +``` text +Row 1: +────── +name: example01-08-1.yandex.ru +value: +czxid: 932998691229 +mzxid: 932998691229 +ctime: 2015-03-27 16:49:51 +mtime: 2015-03-27 16:49:51 +version: 0 +cversion: 47 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021031383 +path: /clickhouse/tables/01-08/visits/replicas + +Row 2: +────── +name: example01-08-2.yandex.ru +value: +czxid: 933002738135 +mzxid: 933002738135 +ctime: 2015-03-27 16:57:01 +mtime: 2015-03-27 16:57:01 +version: 0 +cversion: 37 +aversion: 0 +ephemeralOwner: 0 +dataLength: 0 +numChildren: 7 +pzxid: 987021252247 +path: /clickhouse/tables/01-08/visits/replicas +``` + +## 系统。突变 {#system_tables-mutations} + +该表包含以下信息 [突变](../sql-reference/statements/alter.md#alter-mutations) MergeTree表及其进展。 每个突变命令由一行表示。 该表具有以下列: + +**数据库**, **表** -应用突变的数据库和表的名称。 + +**mutation\_id** -变异的ID 对于复制的表,这些Id对应于znode中的名称 `/mutations/` 动物园管理员的目录。 对于未复制的表,Id对应于表的数据目录中的文件名。 + +**命令** -Mutation命令字符串(查询后的部分 `ALTER TABLE [db.]table`). + +**create\_time** -当这个突变命令被提交执行。 + +**block\_numbers.partition\_id**, **block\_numbers.编号** -嵌套列。 对于复制表的突变,它包含每个分区的一条记录:分区ID和通过突变获取的块编号(在每个分区中,只有包含编号小于该分区中突变获取的块编号的块的 在非复制表中,所有分区中的块编号形成一个序列。 这意味着对于非复制表的突变,该列将包含一条记录,其中包含由突变获取的单个块编号。 + +**parts\_to\_do** -为了完成突变,需要突变的数据部分的数量。 + +**is\_done** -变异完成了?? 请注意,即使 `parts_to_do = 0` 由于长时间运行的INSERT将创建需要突变的新数据部分,因此可能尚未完成复制表的突变。 + +如果在改变某些部分时出现问题,以下列将包含其他信息: + +**latest\_failed\_part** -不能变异的最新部分的名称。 + +**latest\_fail\_time** -最近的部分突变失败的时间。 + +**latest\_fail\_reason** -导致最近部件变异失败的异常消息。 + +## 系统。磁盘 {#system_tables-disks} + +包含有关在定义的磁盘信息 [服务器配置](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +列: + +- `name` ([字符串](../sql-reference/data-types/string.md)) — Name of a disk in the server configuration. +- `path` ([字符串](../sql-reference/data-types/string.md)) — Path to the mount point in the file system. +- `free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Free space on disk in bytes. +- `total_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Disk volume in bytes. +- `keep_free_space` ([UInt64](../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` 磁盘配置参数。 + +## 系统。storage\_policies {#system_tables-storage_policies} + +包含有关存储策略和卷中定义的信息 [服务器配置](../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). + +列: + +- `policy_name` ([字符串](../sql-reference/data-types/string.md)) — Name of the storage policy. +- `volume_name` ([字符串](../sql-reference/data-types/string.md)) — Volume name defined in the storage policy. +- `volume_priority` ([UInt64](../sql-reference/data-types/int-uint.md)) — Volume order number in the configuration. +- `disks` ([数组(字符串)](../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. +- `max_data_part_size` ([UInt64](../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). +- `move_factor` ([Float64](../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. + +如果存储策略包含多个卷,则每个卷的信息将存储在表的单独行中。 + +[原始文章](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/zh/operations/system_tables.md b/docs/zh/operations/system_tables.md deleted file mode 100644 index ba762ddb562..00000000000 --- a/docs/zh/operations/system_tables.md +++ /dev/null @@ -1,1126 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 52 -toc_title: "\u7CFB\u7EDF\u8868" ---- - -# 系统表 {#system-tables} - -系统表用于实现系统的部分功能,并提供对有关系统如何工作的信息的访问。 -您无法删除系统表(但可以执行分离)。 -系统表没有包含磁盘上数据的文件或包含元数据的文件。 服务器在启动时创建所有系统表。 -系统表是只读的。 -它们位于 ‘system’ 数据库。 - -## 系统。asynchronous\_metrics {#system_tables-asynchronous_metrics} - -包含在后台定期计算的指标。 例如,在使用的RAM量。 - -列: - -- `metric` ([字符串](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Float64](../sql_reference/data_types/float.md)) — Metric value. - -**示例** - -``` sql -SELECT * FROM system.asynchronous_metrics LIMIT 10 -``` - -``` text -┌─metric──────────────────────────────────┬──────value─┐ -│ jemalloc.background_thread.run_interval │ 0 │ -│ jemalloc.background_thread.num_runs │ 0 │ -│ jemalloc.background_thread.num_threads │ 0 │ -│ jemalloc.retained │ 422551552 │ -│ jemalloc.mapped │ 1682989056 │ -│ jemalloc.resident │ 1656446976 │ -│ jemalloc.metadata_thp │ 0 │ -│ jemalloc.metadata │ 10226856 │ -│ UncompressedCacheCells │ 0 │ -│ MarkCacheFiles │ 0 │ -└─────────────────────────────────────────┴────────────┘ -``` - -**另请参阅** - -- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. -- [系统。指标](#system_tables-metrics) — Contains instantly calculated metrics. -- [系统。活动](#system_tables-events) — Contains a number of events that have occurred. -- [系统。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. - -## 系统。集群 {#system-clusters} - -包含有关配置文件中可用的集群及其中的服务器的信息。 - -列: - -- `cluster` (String) — The cluster name. -- `shard_num` (UInt32) — The shard number in the cluster, starting from 1. -- `shard_weight` (UInt32) — The relative weight of the shard when writing data. -- `replica_num` (UInt32) — The replica number in the shard, starting from 1. -- `host_name` (String) — The host name, as specified in the config. -- `host_address` (String) — The host IP address obtained from DNS. -- `port` (UInt16) — The port to use for connecting to the server. -- `user` (String) — The name of the user for connecting to the server. -- `errors_count` (UInt32)-此主机无法到达副本的次数。 -- `estimated_recovery_time` (UInt32)-剩下的秒数,直到副本错误计数归零,它被认为是恢复正常。 - -请注意 `errors_count` 每个查询集群更新一次,但 `estimated_recovery_time` 按需重新计算。 所以有可能是非零的情况 `errors_count` 和零 `estimated_recovery_time`,下一个查询将为零 `errors_count` 并尝试使用副本,就好像它没有错误。 - -**另请参阅** - -- [表引擎分布式](../engines/table_engines/special/distributed.md) -- [distributed\_replica\_error\_cap设置](settings/settings.md#settings-distributed_replica_error_cap) -- [distributed\_replica\_error\_half\_life设置](settings/settings.md#settings-distributed_replica_error_half_life) - -## 系统。列 {#system-columns} - -包含有关所有表中列的信息。 - -您可以使用此表获取类似于以下内容的信息 [DESCRIBE TABLE](../sql_reference/statements/misc.md#misc-describe-table) 查询,但对于多个表一次。 - -该 `system.columns` 表包含以下列(列类型显示在括号中): - -- `database` (String) — Database name. -- `table` (String) — Table name. -- `name` (String) — Column name. -- `type` (String) — Column type. -- `default_kind` (String) — Expression type (`DEFAULT`, `MATERIALIZED`, `ALIAS`)为默认值,如果没有定义,则为空字符串。 -- `default_expression` (String) — Expression for the default value, or an empty string if it is not defined. -- `data_compressed_bytes` (UInt64) — The size of compressed data, in bytes. -- `data_uncompressed_bytes` (UInt64) — The size of decompressed data, in bytes. -- `marks_bytes` (UInt64) — The size of marks, in bytes. -- `comment` (String) — Comment on the column, or an empty string if it is not defined. -- `is_in_partition_key` (UInt8) — Flag that indicates whether the column is in the partition expression. -- `is_in_sorting_key` (UInt8) — Flag that indicates whether the column is in the sorting key expression. -- `is_in_primary_key` (UInt8) — Flag that indicates whether the column is in the primary key expression. -- `is_in_sampling_key` (UInt8) — Flag that indicates whether the column is in the sampling key expression. - -## 系统。贡献者 {#system-contributors} - -包含有关贡献者的信息。 按随机顺序排列所有构造。 该顺序在查询执行时是随机的。 - -列: - -- `name` (String) — Contributor (author) name from git log. - -**示例** - -``` sql -SELECT * FROM system.contributors LIMIT 10 -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -│ Max Vetrov │ -│ LiuYangkuan │ -│ svladykin │ -│ zamulla │ -│ Šimon Podlipský │ -│ BayoNet │ -│ Ilya Khomutov │ -│ Amy Krishnevsky │ -│ Loud_Scream │ -└──────────────────┘ -``` - -要在表中找出自己,请使用查询: - -``` sql -SELECT * FROM system.contributors WHERE name='Olga Khvostikova' -``` - -``` text -┌─name─────────────┐ -│ Olga Khvostikova │ -└──────────────────┘ -``` - -## 系统。数据库 {#system-databases} - -此表包含一个名为"字符串"的列 ‘name’ – the name of a database. -服务器知道的每个数据库在表中都有相应的条目。 -该系统表用于实现 `SHOW DATABASES` 查询。 - -## 系统。detached\_parts {#system_tables-detached_parts} - -包含有关分离部分的信息 [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) 桌子 该 `reason` 列指定分离部件的原因。 对于用户分离的部件,原因是空的。 这些部件可以附加 [ALTER TABLE ATTACH PARTITION\|PART](../sql_reference/statements/alter.md#alter_attach-partition) 指挥部 有关其他列的说明,请参阅 [系统。零件](#system_tables-parts). 如果部件名称无效,某些列的值可能为 `NULL`. 这些部分可以删除 [ALTER TABLE DROP DETACHED PART](../sql_reference/statements/alter.md#alter_drop-detached). - -## 系统。字典 {#system-dictionaries} - -包含有关外部字典的信息。 - -列: - -- `name` (String) — Dictionary name. -- `type` (String) — Dictionary type: Flat, Hashed, Cache. -- `origin` (String) — Path to the configuration file that describes the dictionary. -- `attribute.names` (Array(String)) — Array of attribute names provided by the dictionary. -- `attribute.types` (Array(String)) — Corresponding array of attribute types that are provided by the dictionary. -- `has_hierarchy` (UInt8) — Whether the dictionary is hierarchical. -- `bytes_allocated` (UInt64) — The amount of RAM the dictionary uses. -- `hit_rate` (Float64) — For cache dictionaries, the percentage of uses for which the value was in the cache. -- `element_count` (UInt64) — The number of items stored in the dictionary. -- `load_factor` (Float64) — The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table). -- `creation_time` (DateTime) — The time when the dictionary was created or last successfully reloaded. -- `last_exception` (String) — Text of the error that occurs when creating or reloading the dictionary if the dictionary couldn't be created. -- `source` (String) — Text describing the data source for the dictionary. - -请注意,字典使用的内存量与其中存储的项目数量不成正比。 因此,对于平面和缓存字典,所有的内存单元都是预先分配的,而不管字典实际上有多满。 - -## 系统。活动 {#system_tables-events} - -包含有关系统中发生的事件数的信息。 例如,在表中,您可以找到多少 `SELECT` 自ClickHouse服务器启动以来已处理查询。 - -列: - -- `event` ([字符串](../sql_reference/data_types/string.md)) — Event name. -- `value` ([UInt64](../sql_reference/data_types/int_uint.md)) — Number of events occurred. -- `description` ([字符串](../sql_reference/data_types/string.md)) — Event description. - -**示例** - -``` sql -SELECT * FROM system.events LIMIT 5 -``` - -``` text -┌─event─────────────────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 12 │ Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries. │ -│ SelectQuery │ 8 │ Same as Query, but only for SELECT queries. │ -│ FileOpen │ 73 │ Number of files opened. │ -│ ReadBufferFromFileDescriptorRead │ 155 │ Number of reads (read/pread) from a file descriptor. Does not include sockets. │ -│ ReadBufferFromFileDescriptorReadBytes │ 9931 │ Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size. │ -└───────────────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**另请参阅** - -- [系统。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [系统。指标](#system_tables-metrics) — Contains instantly calculated metrics. -- [系统。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. - -## 系统。功能 {#system-functions} - -包含有关正常函数和聚合函数的信息。 - -列: - -- `name`(`String`) – The name of the function. -- `is_aggregate`(`UInt8`) — Whether the function is aggregate. - -## 系统。graphite\_retentions {#system-graphite-retentions} - -包含有关参数的信息 [graphite\_rollup](server_configuration_parameters/settings.md#server_configuration_parameters-graphite_rollup) 这是在表中使用 [\*GraphiteMergeTree](../engines/table_engines/mergetree_family/graphitemergetree.md) 引擎 - -列: - -- `config_name` (字符串) - `graphite_rollup` 参数名称。 -- `regexp` (String)-指标名称的模式。 -- `function` (String)-聚合函数的名称。 -- `age` (UInt64)-以秒为单位的数据的最小期限。 -- `precision` (UInt64)-如何精确地定义以秒为单位的数据的年龄。 -- `priority` (UInt16)-模式优先级。 -- `is_default` (UInt8)-模式是否为默认值。 -- `Tables.database` (Array(String))-使用数据库表名称的数组 `config_name` 参数。 -- `Tables.table` (Array(String))-使用表名称的数组 `config_name` 参数。 - -## 系统。合并 {#system-merges} - -包含有关MergeTree系列中表当前正在进行的合并和部件突变的信息。 - -列: - -- `database` (String) — The name of the database the table is in. -- `table` (String) — Table name. -- `elapsed` (Float64) — The time elapsed (in seconds) since the merge started. -- `progress` (Float64) — The percentage of completed work from 0 to 1. -- `num_parts` (UInt64) — The number of pieces to be merged. -- `result_part_name` (String) — The name of the part that will be formed as the result of merging. -- `is_mutation` (UInt8)-1如果这个过程是一个部分突变. -- `total_size_bytes_compressed` (UInt64) — The total size of the compressed data in the merged chunks. -- `total_size_marks` (UInt64) — The total number of marks in the merged parts. -- `bytes_read_uncompressed` (UInt64) — Number of bytes read, uncompressed. -- `rows_read` (UInt64) — Number of rows read. -- `bytes_written_uncompressed` (UInt64) — Number of bytes written, uncompressed. -- `rows_written` (UInt64) — Number of rows written. - -## 系统。指标 {#system_tables-metrics} - -包含可以立即计算或具有当前值的指标。 例如,同时处理的查询的数量或当前副本的延迟。 此表始终是最新的。 - -列: - -- `metric` ([字符串](../sql_reference/data_types/string.md)) — Metric name. -- `value` ([Int64](../sql_reference/data_types/int_uint.md)) — Metric value. -- `description` ([字符串](../sql_reference/data_types/string.md)) — Metric description. - -支持的指标列表,您可以在 [src/Common/CurrentMetrics.cpp](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/CurrentMetrics.cpp) ClickHouse的源文件。 - -**示例** - -``` sql -SELECT * FROM system.metrics LIMIT 10 -``` - -``` text -┌─metric─────────────────────┬─value─┬─description──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Query │ 1 │ Number of executing queries │ -│ Merge │ 0 │ Number of executing background merges │ -│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │ -│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replicas │ -│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │ -│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │ -│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │ -│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │ -│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │ -│ DistributedSend │ 0 │ Number of connections to remote servers sending data that was INSERTed into Distributed tables. Both synchronous and asynchronous mode. │ -└────────────────────────────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**另请参阅** - -- [系统。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [系统。活动](#system_tables-events) — Contains a number of events that occurred. -- [系统。metric\_log](#system_tables-metric_log) — Contains a history of metrics values from tables `system.metrics` и `system.events`. -- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. - -## 系统。metric\_log {#system_tables-metric_log} - -包含表中度量值的历史记录 `system.metrics` 和 `system.events`,定期刷新到磁盘。 -打开指标历史记录收集 `system.metric_log`,创建 `/etc/clickhouse-server/config.d/metric_log.xml` 具有以下内容: - -``` xml - - - system - metric_log
- 7500 - 1000 -
-
-``` - -**示例** - -``` sql -SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical; -``` - -``` text -Row 1: -────── -event_date: 2020-02-18 -event_time: 2020-02-18 07:15:33 -milliseconds: 554 -ProfileEvent_Query: 0 -ProfileEvent_SelectQuery: 0 -ProfileEvent_InsertQuery: 0 -ProfileEvent_FileOpen: 0 -ProfileEvent_Seek: 0 -ProfileEvent_ReadBufferFromFileDescriptorRead: 1 -ProfileEvent_ReadBufferFromFileDescriptorReadFailed: 0 -ProfileEvent_ReadBufferFromFileDescriptorReadBytes: 0 -ProfileEvent_WriteBufferFromFileDescriptorWrite: 1 -ProfileEvent_WriteBufferFromFileDescriptorWriteFailed: 0 -ProfileEvent_WriteBufferFromFileDescriptorWriteBytes: 56 -... -CurrentMetric_Query: 0 -CurrentMetric_Merge: 0 -CurrentMetric_PartMutation: 0 -CurrentMetric_ReplicatedFetch: 0 -CurrentMetric_ReplicatedSend: 0 -CurrentMetric_ReplicatedChecks: 0 -... -``` - -**另请参阅** - -- [系统。asynchronous\_metrics](#system_tables-asynchronous_metrics) — Contains periodically calculated metrics. -- [系统。活动](#system_tables-events) — Contains a number of events that occurred. -- [系统。指标](#system_tables-metrics) — Contains instantly calculated metrics. -- [监测](monitoring.md) — Base concepts of ClickHouse monitoring. - -## 系统。数字 {#system-numbers} - -此表包含一个名为UInt64的列 ‘number’ 它包含几乎所有从零开始的自然数。 -您可以使用此表进行测试,或者如果您需要进行暴力搜索。 -从此表中读取的内容不是并行的。 - -## 系统。numbers\_mt {#system-numbers-mt} - -一样的 ‘system.numbers’ 但读取是并行的。 这些数字可以以任何顺序返回。 -用于测试。 - -## 系统。一 {#system-one} - -此表包含一行,其中包含一行 ‘dummy’ UInt8列包含值0。 -如果SELECT查询未指定FROM子句,则使用此表。 -这与其他Dbms中的双表类似。 - -## 系统。零件 {#system_tables-parts} - -包含有关的部分信息 [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) 桌子 - -每行描述一个数据部分。 - -列: - -- `partition` (String) – The partition name. To learn what a partition is, see the description of the [ALTER](../sql_reference/statements/alter.md#query_language_queries_alter) 查询。 - - 格式: - - - `YYYYMM` 用于按月自动分区。 - - `any_string` 手动分区时。 - -- `name` (`String`) – Name of the data part. - -- `active` (`UInt8`) – Flag that indicates whether the data part is active. If a data part is active, it's used in a table. Otherwise, it's deleted. Inactive data parts remain after merging. - -- `marks` (`UInt64`) – The number of marks. To get the approximate number of rows in a data part, multiply `marks` 通过索引粒度(通常为8192)(此提示不适用于自适应粒度)。 - -- `rows` (`UInt64`) – The number of rows. - -- `bytes_on_disk` (`UInt64`) – Total size of all the data part files in bytes. - -- `data_compressed_bytes` (`UInt64`) – Total size of compressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `data_uncompressed_bytes` (`UInt64`) – Total size of uncompressed data in the data part. All the auxiliary files (for example, files with marks) are not included. - -- `marks_bytes` (`UInt64`) – The size of the file with marks. - -- `modification_time` (`DateTime`) – The time the directory with the data part was modified. This usually corresponds to the time of data part creation.\| - -- `remove_time` (`DateTime`) – The time when the data part became inactive. - -- `refcount` (`UInt32`) – The number of places where the data part is used. A value greater than 2 indicates that the data part is used in queries or merges. - -- `min_date` (`Date`) – The minimum value of the date key in the data part. - -- `max_date` (`Date`) – The maximum value of the date key in the data part. - -- `min_time` (`DateTime`) – The minimum value of the date and time key in the data part. - -- `max_time`(`DateTime`) – The maximum value of the date and time key in the data part. - -- `partition_id` (`String`) – ID of the partition. - -- `min_block_number` (`UInt64`) – The minimum number of data parts that make up the current part after merging. - -- `max_block_number` (`UInt64`) – The maximum number of data parts that make up the current part after merging. - -- `level` (`UInt32`) – Depth of the merge tree. Zero means that the current part was created by insert rather than by merging other parts. - -- `data_version` (`UInt64`) – Number that is used to determine which mutations should be applied to the data part (mutations with a version higher than `data_version`). - -- `primary_key_bytes_in_memory` (`UInt64`) – The amount of memory (in bytes) used by primary key values. - -- `primary_key_bytes_in_memory_allocated` (`UInt64`) – The amount of memory (in bytes) reserved for primary key values. - -- `is_frozen` (`UInt8`) – Flag that shows that a partition data backup exists. 1, the backup exists. 0, the backup doesn't exist. For more details, see [FREEZE PARTITION](../sql_reference/statements/alter.md#alter_freeze-partition) - -- `database` (`String`) – Name of the database. - -- `table` (`String`) – Name of the table. - -- `engine` (`String`) – Name of the table engine without parameters. - -- `path` (`String`) – Absolute path to the folder with data part files. - -- `disk` (`String`) – Name of a disk that stores the data part. - -- `hash_of_all_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) 的压缩文件。 - -- `hash_of_uncompressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) 未压缩的文件(带标记的文件,索引文件等。). - -- `uncompressed_hash_of_compressed_files` (`String`) – [sipHash128](../sql_reference/functions/hash_functions.md#hash_functions-siphash128) 压缩文件中的数据,就好像它们是未压缩的。 - -- `bytes` (`UInt64`) – Alias for `bytes_on_disk`. - -- `marks_size` (`UInt64`) – Alias for `marks_bytes`. - -## 系统。part\_log {#system_tables-part-log} - -该 `system.part_log` 表只有当创建 [part\_log](server_configuration_parameters/settings.md#server_configuration_parameters-part-log) 指定了服务器设置。 - -此表包含与以下情况发生的事件有关的信息 [数据部分](../engines/table_engines/mergetree_family/custom_partitioning_key.md) 在 [MergeTree](../engines/table_engines/mergetree_family/mergetree.md) 家庭表,例如添加或合并数据。 - -该 `system.part_log` 表包含以下列: - -- `event_type` (Enum) — Type of the event that occurred with the data part. Can have one of the following values: - - `NEW_PART` — Inserting of a new data part. - - `MERGE_PARTS` — Merging of data parts. - - `DOWNLOAD_PART` — Downloading a data part. - - `REMOVE_PART` — Removing or detaching a data part using [DETACH PARTITION](../sql_reference/statements/alter.md#alter_detach-partition). - - `MUTATE_PART` — Mutating of a data part. - - `MOVE_PART` — Moving the data part from the one disk to another one. -- `event_date` (Date) — Event date. -- `event_time` (DateTime) — Event time. -- `duration_ms` (UInt64) — Duration. -- `database` (String) — Name of the database the data part is in. -- `table` (String) — Name of the table the data part is in. -- `part_name` (String) — Name of the data part. -- `partition_id` (String) — ID of the partition that the data part was inserted to. The column takes the ‘all’ 值,如果分区是由 `tuple()`. -- `rows` (UInt64) — The number of rows in the data part. -- `size_in_bytes` (UInt64) — Size of the data part in bytes. -- `merged_from` (Array(String)) — An array of names of the parts which the current part was made up from (after the merge). -- `bytes_uncompressed` (UInt64) — Size of uncompressed bytes. -- `read_rows` (UInt64) — The number of rows was read during the merge. -- `read_bytes` (UInt64) — The number of bytes was read during the merge. -- `error` (UInt16) — The code number of the occurred error. -- `exception` (String) — Text message of the occurred error. - -该 `system.part_log` 表的第一个插入数据到后创建 `MergeTree` 桌子 - -## 系统。流程 {#system_tables-processes} - -该系统表用于实现 `SHOW PROCESSLIST` 查询。 - -列: - -- `user` (String) – The user who made the query. Keep in mind that for distributed processing, queries are sent to remote servers under the `default` 用户。 该字段包含特定查询的用户名,而不是此查询启动的查询的用户名。 -- `address` (String) – The IP address the request was made from. The same for distributed processing. To track where a distributed query was originally made from, look at `system.processes` 查询请求者服务器上。 -- `elapsed` (Float64) – The time in seconds since request execution started. -- `rows_read` (UInt64) – The number of rows read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `bytes_read` (UInt64) – The number of uncompressed bytes read from the table. For distributed processing, on the requestor server, this is the total for all remote servers. -- `total_rows_approx` (UInt64) – The approximation of the total number of rows that should be read. For distributed processing, on the requestor server, this is the total for all remote servers. It can be updated during request processing, when new sources to process become known. -- `memory_usage` (UInt64) – Amount of RAM the request uses. It might not include some types of dedicated memory. See the [max\_memory\_usage](../operations/settings/query_complexity.md#settings_max_memory_usage) 设置。 -- `query` (String) – The query text. For `INSERT`,它不包括要插入的数据。 -- `query_id` (String) – Query ID, if defined. - -## 系统。text\_log {#system-tables-text-log} - -包含日志记录条目。 进入该表的日志记录级别可以通过以下方式进行限制 `text_log.level` 服务器设置。 - -列: - -- `event_date` (`Date`)-条目的日期。 -- `event_time` (`DateTime`)-条目的时间。 -- `microseconds` (`UInt32`)-条目的微秒。 -- `thread_name` (String) — Name of the thread from which the logging was done. -- `thread_id` (UInt64) — OS thread ID. -- `level` (`Enum8`)-入门级。 - - `'Fatal' = 1` - - `'Critical' = 2` - - `'Error' = 3` - - `'Warning' = 4` - - `'Notice' = 5` - - `'Information' = 6` - - `'Debug' = 7` - - `'Trace' = 8` -- `query_id` (`String`)-查询的ID。 -- `logger_name` (`LowCardinality(String)`) - Name of the logger (i.e. `DDLWorker`) -- `message` (`String`)-消息本身。 -- `revision` (`UInt32`)-ClickHouse修订。 -- `source_file` (`LowCardinality(String)`)-从中完成日志记录的源文件。 -- `source_line` (`UInt64`)-从中完成日志记录的源代码行。 - -## 系统。query\_log {#system_tables-query_log} - -包含有关查询执行的信息。 对于每个查询,您可以看到处理开始时间,处理持续时间,错误消息和其他信息。 - -!!! note "注" - 该表不包含以下内容的输入数据 `INSERT` 查询。 - -ClickHouse仅在以下情况下创建此表 [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) 指定服务器参数。 此参数设置日志记录规则,例如日志记录间隔或将记录查询的表的名称。 - -要启用查询日志记录,请设置 [log\_queries](settings/settings.md#settings-log-queries) 参数为1。 有关详细信息,请参阅 [设置](settings/settings.md) 科。 - -该 `system.query_log` 表注册两种查询: - -1. 客户端直接运行的初始查询。 -2. 由其他查询启动的子查询(用于分布式查询执行)。 对于这些类型的查询,有关父查询的信息显示在 `initial_*` 列。 - -列: - -- `type` (`Enum8`) — Type of event that occurred when executing the query. Values: - - `'QueryStart' = 1` — Successful start of query execution. - - `'QueryFinish' = 2` — Successful end of query execution. - - `'ExceptionBeforeStart' = 3` — Exception before the start of query execution. - - `'ExceptionWhileProcessing' = 4` — Exception during the query execution. -- `event_date` (Date) — Query starting date. -- `event_time` (DateTime) — Query starting time. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` 查询,写入的行数。 对于其他查询,列值为0。 -- `written_bytes` (UInt64) — For `INSERT` 查询时,写入的字节数。 对于其他查询,列值为0。 -- `result_rows` (UInt64) — Number of rows in the result. -- `result_bytes` (UInt64) — Number of bytes in the result. -- `memory_usage` (UInt64) — Memory consumption by the query. -- `query` (String) — Query string. -- `exception` (String) — Exception message. -- `stack_trace` (String) — Stack trace (a list of methods called before the error occurred). An empty string, if the query is completed successfully. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或者运行另一个TCP客户端。 -- `client_name` (String) — The [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端名称。 -- `client_revision` (UInt32) — Revision of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 -- `client_version_major` (UInt32) — Major version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 -- `client_version_minor` (UInt32) — Minor version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 -- `client_version_patch` (UInt32) — Patch component of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端版本。 -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` 方法被使用。 - - 2 — `POST` 方法被使用。 -- `http_user_agent` (String) — The `UserAgent` http请求中传递的标头。 -- `quota_key` (String) — The “quota key” 在指定 [配额](quotas.md) 设置(见 `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `thread_numbers` (Array(UInt32)) — Number of threads that are participating in query execution. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics. The description of them could be found in the table [系统。活动](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics that are listed in the `ProfileEvents.Names` 列。 -- `Settings.Names` (Array(String)) — Names of settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` 参数为1。 -- `Settings.Values` (Array(String)) — Values of settings that are listed in the `Settings.Names` 列。 - -每个查询创建一个或两个行中 `query_log` 表,具体取决于查询的状态: - -1. 如果查询执行成功,将创建两个类型为1和2的事件(请参阅 `type` 列)。 -2. 如果在查询处理过程中发生错误,将创建两个类型为1和4的事件。 -3. 如果在启动查询之前发生错误,将创建类型为3的单个事件。 - -默认情况下,日志以7.5秒的间隔添加到表中。 您可以在设置此时间间隔 [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) 服务器设置(请参阅 `flush_interval_milliseconds` 参数)。 要强制将日志从内存缓冲区刷新到表中,请使用 `SYSTEM FLUSH LOGS` 查询。 - -当手动删除表时,它将自动动态创建。 请注意,所有以前的日志将被删除。 - -!!! note "注" - 日志的存储周期是无限的。 日志不会自动从表中删除。 您需要自己组织删除过时的日志。 - -您可以指定一个任意的分区键 `system.query_log` 表中的 [query\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-log) 服务器设置(请参阅 `partition_by` 参数)。 - -## 系统。query\_thread\_log {#system_tables-query-thread-log} - -该表包含有关每个查询执行线程的信息。 - -ClickHouse仅在以下情况下创建此表 [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) 指定服务器参数。 此参数设置日志记录规则,例如日志记录间隔或将记录查询的表的名称。 - -要启用查询日志记录,请设置 [log\_query\_threads](settings/settings.md#settings-log-query-threads) 参数为1。 有关详细信息,请参阅 [设置](settings/settings.md) 科。 - -列: - -- `event_date` (Date) — the date when the thread has finished execution of the query. -- `event_time` (DateTime) — the date and time when the thread has finished execution of the query. -- `query_start_time` (DateTime) — Start time of query execution. -- `query_duration_ms` (UInt64) — Duration of query execution. -- `read_rows` (UInt64) — Number of read rows. -- `read_bytes` (UInt64) — Number of read bytes. -- `written_rows` (UInt64) — For `INSERT` 查询,写入的行数。 对于其他查询,列值为0。 -- `written_bytes` (UInt64) — For `INSERT` 查询时,写入的字节数。 对于其他查询,列值为0。 -- `memory_usage` (Int64) — The difference between the amount of allocated and freed memory in context of this thread. -- `peak_memory_usage` (Int64) — The maximum difference between the amount of allocated and freed memory in context of this thread. -- `thread_name` (String) — Name of the thread. -- `thread_number` (UInt32) — Internal thread ID. -- `os_thread_id` (Int32) — OS thread ID. -- `master_thread_id` (UInt64) — OS initial ID of initial thread. -- `query` (String) — Query string. -- `is_initial_query` (UInt8) — Query type. Possible values: - - 1 — Query was initiated by the client. - - 0 — Query was initiated by another query for distributed query execution. -- `user` (String) — Name of the user who initiated the current query. -- `query_id` (String) — ID of the query. -- `address` (IPv6) — IP address that was used to make the query. -- `port` (UInt16) — The client port that was used to make the query. -- `initial_user` (String) — Name of the user who ran the initial query (for distributed query execution). -- `initial_query_id` (String) — ID of the initial query (for distributed query execution). -- `initial_address` (IPv6) — IP address that the parent query was launched from. -- `initial_port` (UInt16) — The client port that was used to make the parent query. -- `interface` (UInt8) — Interface that the query was initiated from. Possible values: - - 1 — TCP. - - 2 — HTTP. -- `os_user` (String) — OS's username who runs [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md). -- `client_hostname` (String) — Hostname of the client machine where the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或者运行另一个TCP客户端。 -- `client_name` (String) — The [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端名称。 -- `client_revision` (UInt32) — Revision of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 -- `client_version_major` (UInt32) — Major version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 -- `client_version_minor` (UInt32) — Minor version of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端。 -- `client_version_patch` (UInt32) — Patch component of the [ツ环板clientョツ嘉ッツ偲](../interfaces/cli.md) 或另一个TCP客户端版本。 -- `http_method` (UInt8) — HTTP method that initiated the query. Possible values: - - 0 — The query was launched from the TCP interface. - - 1 — `GET` 方法被使用。 - - 2 — `POST` 方法被使用。 -- `http_user_agent` (String) — The `UserAgent` http请求中传递的标头。 -- `quota_key` (String) — The “quota key” 在指定 [配额](quotas.md) 设置(见 `keyed`). -- `revision` (UInt32) — ClickHouse revision. -- `ProfileEvents.Names` (Array(String)) — Counters that measure different metrics for this thread. The description of them could be found in the table [系统。活动](#system_tables-events) -- `ProfileEvents.Values` (Array(UInt64)) — Values of metrics for this thread that are listed in the `ProfileEvents.Names` 列。 - -默认情况下,日志以7.5秒的间隔添加到表中。 您可以在设置此时间间隔 [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) 服务器设置(请参阅 `flush_interval_milliseconds` 参数)。 要强制将日志从内存缓冲区刷新到表中,请使用 `SYSTEM FLUSH LOGS` 查询。 - -当手动删除表时,它将自动动态创建。 请注意,所有以前的日志将被删除。 - -!!! note "注" - 日志的存储周期是无限的。 日志不会自动从表中删除。 您需要自己组织删除过时的日志。 - -您可以指定一个任意的分区键 `system.query_thread_log` 表中的 [query\_thread\_log](server_configuration_parameters/settings.md#server_configuration_parameters-query-thread-log) 服务器设置(请参阅 `partition_by` 参数)。 - -## 系统。trace\_log {#system_tables-trace_log} - -包含采样查询探查器收集的堆栈跟踪。 - -ClickHouse创建此表时 [trace\_log](server_configuration_parameters/settings.md#server_configuration_parameters-trace_log) 服务器配置部分被设置。 也是 [query\_profiler\_real\_time\_period\_ns](settings/settings.md#query_profiler_real_time_period_ns) 和 [query\_profiler\_cpu\_time\_period\_ns](settings/settings.md#query_profiler_cpu_time_period_ns) 应设置设置。 - -要分析日志,请使用 `addressToLine`, `addressToSymbol` 和 `demangle` 内省功能。 - -列: - -- `event_date`([日期](../sql_reference/data_types/date.md)) — Date of sampling moment. - -- `event_time`([日期时间](../sql_reference/data_types/datetime.md)) — Timestamp of sampling moment. - -- `revision`([UInt32](../sql_reference/data_types/int_uint.md)) — ClickHouse server build revision. - - 通过以下方式连接到服务器 `clickhouse-client`,你看到的字符串类似于 `Connected to ClickHouse server version 19.18.1 revision 54429.`. 该字段包含 `revision`,但不是 `version` 的服务器。 - -- `timer_type`([枚举8](../sql_reference/data_types/enum.md)) — Timer type: - - - `Real` 表示挂钟时间。 - - `CPU` 表示CPU时间。 - -- `thread_number`([UInt32](../sql_reference/data_types/int_uint.md)) — Thread identifier. - -- `query_id`([字符串](../sql_reference/data_types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query\_log](#system_tables-query_log) 系统表. - -- `trace`([数组(UInt64)](../sql_reference/data_types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process. - -**示例** - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-15 -event_time: 2019-11-15 15:09:38 -revision: 54428 -timer_type: Real -thread_number: 48 -query_id: acc4d61f-5bd1-4a3e-bc91-2180be37c915 -trace: [94222141367858,94222152240175,94222152325351,94222152329944,94222152330796,94222151449980,94222144088167,94222151682763,94222144088167,94222151682763,94222144088167,94222144058283,94222144059248,94222091840750,94222091842302,94222091831228,94222189631488,140509950166747,140509942945935] -``` - -## 系统。副本 {#system_tables-replicas} - -包含驻留在本地服务器上的复制表的信息和状态。 -此表可用于监视。 该表对于每个已复制的\*表都包含一行。 - -示例: - -``` sql -SELECT * -FROM system.replicas -WHERE table = 'visits' -FORMAT Vertical -``` - -``` text -Row 1: -────── -database: merge -table: visits -engine: ReplicatedCollapsingMergeTree -is_leader: 1 -can_become_leader: 1 -is_readonly: 0 -is_session_expired: 0 -future_parts: 1 -parts_to_check: 0 -zookeeper_path: /clickhouse/tables/01-06/visits -replica_name: example01-06-1.yandex.ru -replica_path: /clickhouse/tables/01-06/visits/replicas/example01-06-1.yandex.ru -columns_version: 9 -queue_size: 1 -inserts_in_queue: 0 -merges_in_queue: 1 -part_mutations_in_queue: 0 -queue_oldest_time: 2020-02-20 08:34:30 -inserts_oldest_time: 0000-00-00 00:00:00 -merges_oldest_time: 2020-02-20 08:34:30 -part_mutations_oldest_time: 0000-00-00 00:00:00 -oldest_part_to_get: -oldest_part_to_merge_to: 20200220_20284_20840_7 -oldest_part_to_mutate_to: -log_max_index: 596273 -log_pointer: 596274 -last_queue_update: 2020-02-20 08:34:32 -absolute_delay: 0 -total_replicas: 2 -active_replicas: 2 -``` - -列: - -- `database` (`String`)-数据库名称 -- `table` (`String`)-表名 -- `engine` (`String`)-表引擎名称 -- `is_leader` (`UInt8`)-副本是否是领导者。 - 一次只有一个副本可以成为领导者。 领导者负责选择要执行的后台合并。 - 请注意,可以对任何可用且在ZK中具有会话的副本执行写操作,而不管该副本是否为leader。 -- `can_become_leader` (`UInt8`)-副本是否可以当选为领导者。 -- `is_readonly` (`UInt8`)-副本是否处于只读模式。 - 如果配置没有ZooKeeper的部分,如果在ZooKeeper中重新初始化会话时发生未知错误,以及在ZooKeeper中重新初始化会话时发生未知错误,则此模式将打开。 -- `is_session_expired` (`UInt8`)-与ZooKeeper的会话已经过期。 基本上一样 `is_readonly`. -- `future_parts` (`UInt32`)-由于尚未完成的插入或合并而显示的数据部分的数量。 -- `parts_to_check` (`UInt32`)-队列中用于验证的数据部分的数量。 如果怀疑零件可能已损坏,则将其放入验证队列。 -- `zookeeper_path` (`String`)-在ZooKeeper中的表数据路径。 -- `replica_name` (`String`)-在动物园管理员副本名称. 同一表的不同副本具有不同的名称。 -- `replica_path` (`String`)-在ZooKeeper中的副本数据的路径。 与连接相同 ‘zookeeper\_path/replicas/replica\_path’. -- `columns_version` (`Int32`)-表结构的版本号。 指示执行ALTER的次数。 如果副本有不同的版本,这意味着一些副本还没有做出所有的改变。 -- `queue_size` (`UInt32`)-等待执行的操作的队列大小。 操作包括插入数据块、合并和某些其他操作。 它通常与 `future_parts`. -- `inserts_in_queue` (`UInt32`)-需要插入数据块的数量。 插入通常复制得相当快。 如果这个数字很大,这意味着有什么不对劲。 -- `merges_in_queue` (`UInt32`)-等待进行合并的数量。 有时合并时间很长,因此此值可能长时间大于零。 -- `part_mutations_in_queue` (`UInt32`)-等待进行的突变的数量。 -- `queue_oldest_time` (`DateTime`)-如果 `queue_size` 大于0,显示何时将最旧的操作添加到队列中。 -- `inserts_oldest_time` (`DateTime`)-看 `queue_oldest_time` -- `merges_oldest_time` (`DateTime`)-看 `queue_oldest_time` -- `part_mutations_oldest_time` (`DateTime`)-看 `queue_oldest_time` - -接下来的4列只有在有ZK活动会话的情况下才具有非零值。 - -- `log_max_index` (`UInt64`)-一般活动日志中的最大条目数。 -- `log_pointer` (`UInt64`)-副本复制到其执行队列的常规活动日志中的最大条目数加一。 如果 `log_pointer` 比 `log_max_index`,有点不对劲。 -- `last_queue_update` (`DateTime`)-上次更新队列时。 -- `absolute_delay` (`UInt64`)-当前副本有多大滞后秒。 -- `total_replicas` (`UInt8`)-此表的已知副本总数。 -- `active_replicas` (`UInt8`)-在ZooKeeper中具有会话的此表的副本的数量(即正常运行的副本的数量)。 - -如果您请求所有列,表可能会工作得有点慢,因为每行都会从ZooKeeper进行几次读取。 -如果您没有请求最后4列(log\_max\_index,log\_pointer,total\_replicas,active\_replicas),表工作得很快。 - -例如,您可以检查一切是否正常工作,如下所示: - -``` sql -SELECT - database, - table, - is_leader, - is_readonly, - is_session_expired, - future_parts, - parts_to_check, - columns_version, - queue_size, - inserts_in_queue, - merges_in_queue, - log_max_index, - log_pointer, - total_replicas, - active_replicas -FROM system.replicas -WHERE - is_readonly - OR is_session_expired - OR future_parts > 20 - OR parts_to_check > 10 - OR queue_size > 20 - OR inserts_in_queue > 10 - OR log_max_index - log_pointer > 10 - OR total_replicas < 2 - OR active_replicas < total_replicas -``` - -如果这个查询没有返回任何东西,这意味着一切都很好。 - -## 系统。设置 {#system-tables-system-settings} - -包含有关当前用户的会话设置的信息。 - -列: - -- `name` ([字符串](../sql_reference/data_types/string.md)) — Setting name. -- `value` ([字符串](../sql_reference/data_types/string.md)) — Setting value. -- `changed` ([UInt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — Shows whether a setting is changed from its default value. -- `description` ([字符串](../sql_reference/data_types/string.md)) — Short setting description. -- `min` ([可为空](../sql_reference/data_types/nullable.md)([字符串](../sql_reference/data_types/string.md))) — Minimum value of the setting, if any is set via [制约因素](settings/constraints_on_settings.md#constraints-on-settings). 如果设置没有最小值,则包含 [NULL](../sql_reference/syntax.md#null-literal). -- `max` ([可为空](../sql_reference/data_types/nullable.md)([字符串](../sql_reference/data_types/string.md))) — Maximum value of the setting, if any is set via [制约因素](settings/constraints_on_settings.md#constraints-on-settings). 如果设置没有最大值,则包含 [NULL](../sql_reference/syntax.md#null-literal). -- `readonly` ([UInt8](../sql_reference/data_types/int_uint.md#uint-ranges)) — Shows whether the current user can change the setting: - - `0` — Current user can change the setting. - - `1` — Current user can't change the setting. - -**示例** - -下面的示例演示如何获取有关名称包含的设置的信息 `min_i`. - -``` sql -SELECT * -FROM system.settings -WHERE name LIKE '%min_i%' -``` - -``` text -┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐ -│ min_insert_block_size_rows │ 1048576 │ 0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ min_insert_block_size_bytes │ 268435456 │ 0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -│ read_backoff_min_interval_between_events_ms │ 1000 │ 0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 0 │ -└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘ -``` - -使用 `WHERE changed` 可以是有用的,例如,当你想检查: - -- 配置文件中的设置是否正确加载并正在使用。 -- 在当前会话中更改的设置。 - - - -``` sql -SELECT * FROM system.settings WHERE changed AND name='load_balancing' -``` - -**另请参阅** - -- [设置](settings/index.md#settings) -- [查询权限](settings/permissions_for_queries.md#settings_readonly) -- [对设置的限制](settings/constraints_on_settings.md) - -## 系统。表\_engines {#system.table_engines} - -``` text -┌─name───────────────────┬─value───────┐ -│ max_threads │ 8 │ -│ use_uncompressed_cache │ 0 │ -│ load_balancing │ random │ -│ max_memory_usage │ 10000000000 │ -└────────────────────────┴─────────────┘ -``` - -## 系统。merge\_tree\_settings {#system-merge_tree_settings} - -包含有关以下设置的信息 `MergeTree` 桌子 - -列: - -- `name` (String) — Setting name. -- `value` (String) — Setting value. -- `description` (String) — Setting description. -- `type` (String) — Setting type (implementation specific string value). -- `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. - -## 系统。表\_engines {#system-table-engines} - -包含服务器支持的表引擎的描述及其功能支持信息。 - -此表包含以下列(列类型显示在括号中): - -- `name` (String) — The name of table engine. -- `supports_settings` (UInt8) — Flag that indicates if table engine supports `SETTINGS` 条款 -- `supports_skipping_indices` (UInt8) — Flag that indicates if table engine supports [跳过索引](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-data_skipping-indexes). -- `supports_ttl` (UInt8) — Flag that indicates if table engine supports [TTL](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-ttl). -- `supports_sort_order` (UInt8) — Flag that indicates if table engine supports clauses `PARTITION_BY`, `PRIMARY_KEY`, `ORDER_BY` 和 `SAMPLE_BY`. -- `supports_replication` (UInt8) — Flag that indicates if table engine supports [数据复制](../engines/table_engines/mergetree_family/replication.md). -- `supports_duduplication` (UInt8) — Flag that indicates if table engine supports data deduplication. - -示例: - -``` sql -SELECT * -FROM system.table_engines -WHERE name in ('Kafka', 'MergeTree', 'ReplicatedCollapsingMergeTree') -``` - -``` text -┌─name──────────────────────────┬─supports_settings─┬─supports_skipping_indices─┬─supports_sort_order─┬─supports_ttl─┬─supports_replication─┬─supports_deduplication─┐ -│ Kafka │ 1 │ 0 │ 0 │ 0 │ 0 │ 0 │ -│ MergeTree │ 1 │ 1 │ 1 │ 1 │ 0 │ 0 │ -│ ReplicatedCollapsingMergeTree │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │ -└───────────────────────────────┴───────────────────┴───────────────────────────┴─────────────────────┴──────────────┴──────────────────────┴────────────────────────┘ -``` - -**另请参阅** - -- 梅树家族 [查询子句](../engines/table_engines/mergetree_family/mergetree.md#mergetree-query-clauses) -- 卡夫卡 [设置](../engines/table_engines/integrations/kafka.md#table_engine-kafka-creating-a-table) -- 加入我们 [设置](../engines/table_engines/special/join.md#join-limitations-and-settings) - -## 系统。表 {#system-tables} - -包含服务器知道的每个表的元数据。 分离的表不显示在 `system.tables`. - -此表包含以下列(列类型显示在括号中): - -- `database` (String) — The name of the database the table is in. - -- `name` (String) — Table name. - -- `engine` (String) — Table engine name (without parameters). - -- `is_temporary` (UInt8)-指示表是否是临时的标志。 - -- `data_path` (String)-文件系统中表数据的路径。 - -- `metadata_path` (String)-文件系统中表元数据的路径。 - -- `metadata_modification_time` (DateTime)-表元数据的最新修改时间。 - -- `dependencies_database` (数组(字符串))-数据库依赖关系. - -- `dependencies_table` (数组(字符串))-表依赖关系 ([MaterializedView](../engines/table_engines/special/materializedview.md) 基于当前表的表)。 - -- `create_table_query` (String)-用于创建表的查询。 - -- `engine_full` (String)-表引擎的参数。 - -- `partition_key` (String)-表中指定的分区键表达式。 - -- `sorting_key` (String)-表中指定的排序键表达式。 - -- `primary_key` (String)-表中指定的主键表达式。 - -- `sampling_key` (String)-表中指定的采样键表达式。 - -- `storage_policy` (字符串)-存储策略: - - - [MergeTree](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes) - - [分布](../engines/table_engines/special/distributed.md#distributed) - -- `total_rows` (Nullable(UInt64))-总行数,如果可以快速确定表中的确切行数,否则 `Null` (包括内衣 `Buffer` 表)。 - -- `total_bytes` (Nullable(UInt64))-总字节数,如果可以快速确定存储表的确切字节数,否则 `Null` (**不** 包括任何底层存储)。 - - - If the table stores data on disk, returns used space on disk (i.e. compressed). - - 如果表在内存中存储数据,返回在内存中使用的近似字节数. - -该 `system.tables` 表中使用 `SHOW TABLES` 查询实现。 - -## 系统。动物园管理员 {#system-zookeeper} - -如果未配置ZooKeeper,则表不存在。 允许从配置中定义的ZooKeeper集群读取数据。 -查询必须具有 ‘path’ WHERE子句中的平等条件。 这是ZooKeeper中您想要获取数据的孩子的路径。 - -查询 `SELECT * FROM system.zookeeper WHERE path = '/clickhouse'` 输出对所有孩子的数据 `/clickhouse` 节点。 -要输出所有根节点的数据,write path= ‘/’. -如果在指定的路径 ‘path’ 不存在,将引发异常。 - -列: - -- `name` (String) — The name of the node. -- `path` (String) — The path to the node. -- `value` (String) — Node value. -- `dataLength` (Int32) — Size of the value. -- `numChildren` (Int32) — Number of descendants. -- `czxid` (Int64) — ID of the transaction that created the node. -- `mzxid` (Int64) — ID of the transaction that last changed the node. -- `pzxid` (Int64) — ID of the transaction that last deleted or added descendants. -- `ctime` (DateTime) — Time of node creation. -- `mtime` (DateTime) — Time of the last modification of the node. -- `version` (Int32) — Node version: the number of times the node was changed. -- `cversion` (Int32) — Number of added or removed descendants. -- `aversion` (Int32) — Number of changes to the ACL. -- `ephemeralOwner` (Int64) — For ephemeral nodes, the ID of the session that owns this node. - -示例: - -``` sql -SELECT * -FROM system.zookeeper -WHERE path = '/clickhouse/tables/01-08/visits/replicas' -FORMAT Vertical -``` - -``` text -Row 1: -────── -name: example01-08-1.yandex.ru -value: -czxid: 932998691229 -mzxid: 932998691229 -ctime: 2015-03-27 16:49:51 -mtime: 2015-03-27 16:49:51 -version: 0 -cversion: 47 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021031383 -path: /clickhouse/tables/01-08/visits/replicas - -Row 2: -────── -name: example01-08-2.yandex.ru -value: -czxid: 933002738135 -mzxid: 933002738135 -ctime: 2015-03-27 16:57:01 -mtime: 2015-03-27 16:57:01 -version: 0 -cversion: 37 -aversion: 0 -ephemeralOwner: 0 -dataLength: 0 -numChildren: 7 -pzxid: 987021252247 -path: /clickhouse/tables/01-08/visits/replicas -``` - -## 系统。突变 {#system_tables-mutations} - -该表包含以下信息 [突变](../sql_reference/statements/alter.md#alter-mutations) MergeTree表及其进展。 每个突变命令由一行表示。 该表具有以下列: - -**数据库**, **表** -应用突变的数据库和表的名称。 - -**mutation\_id** -变异的ID 对于复制的表,这些Id对应于znode中的名称 `/mutations/` 动物园管理员的目录。 对于未复制的表,Id对应于表的数据目录中的文件名。 - -**命令** -Mutation命令字符串(查询后的部分 `ALTER TABLE [db.]table`). - -**create\_time** -当这个突变命令被提交执行。 - -**block\_numbers.partition\_id**, **block\_numbers.编号** -嵌套列。 对于复制表的突变,它包含每个分区的一条记录:分区ID和通过突变获取的块编号(在每个分区中,只有包含编号小于该分区中突变获取的块编号的块的 在非复制表中,所有分区中的块编号形成一个序列。 这意味着对于非复制表的突变,该列将包含一条记录,其中包含由突变获取的单个块编号。 - -**parts\_to\_do** -为了完成突变,需要突变的数据部分的数量。 - -**is\_done** -变异完成了?? 请注意,即使 `parts_to_do = 0` 由于长时间运行的INSERT将创建需要突变的新数据部分,因此可能尚未完成复制表的突变。 - -如果在改变某些部分时出现问题,以下列将包含其他信息: - -**latest\_failed\_part** -不能变异的最新部分的名称。 - -**latest\_fail\_time** -最近的部分突变失败的时间。 - -**latest\_fail\_reason** -导致最近部件变异失败的异常消息。 - -## 系统。磁盘 {#system_tables-disks} - -包含有关在定义的磁盘信息 [服务器配置](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -列: - -- `name` ([字符串](../sql_reference/data_types/string.md)) — Name of a disk in the server configuration. -- `path` ([字符串](../sql_reference/data_types/string.md)) — Path to the mount point in the file system. -- `free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Free space on disk in bytes. -- `total_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Disk volume in bytes. -- `keep_free_space` ([UInt64](../sql_reference/data_types/int_uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` 磁盘配置参数。 - -## 系统。storage\_policies {#system_tables-storage_policies} - -包含有关存储策略和卷中定义的信息 [服务器配置](../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes_configure). - -列: - -- `policy_name` ([字符串](../sql_reference/data_types/string.md)) — Name of the storage policy. -- `volume_name` ([字符串](../sql_reference/data_types/string.md)) — Volume name defined in the storage policy. -- `volume_priority` ([UInt64](../sql_reference/data_types/int_uint.md)) — Volume order number in the configuration. -- `disks` ([数组(字符串)](../sql_reference/data_types/array.md)) — Disk names, defined in the storage policy. -- `max_data_part_size` ([UInt64](../sql_reference/data_types/int_uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). -- `move_factor` ([Float64](../sql_reference/data_types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. - -如果存储策略包含多个卷,则每个卷的信息将存储在表的单独行中。 - -[原始文章](https://clickhouse.tech/docs/en/operations/system_tables/) diff --git a/docs/zh/operations/tips.md b/docs/zh/operations/tips.md index 05509399d85..eb3abab08c6 100644 --- a/docs/zh/operations/tips.md +++ b/docs/zh/operations/tips.md @@ -1,4 +1,3 @@ - # 使用建议 {#usage-recommendations} ## CPU {#cpu} @@ -105,7 +104,7 @@ XFS也是合适的,但它还没有经过ClickHouse的彻底测试。 您可能已经将ZooKeeper用于其他目的。 您可以使用相同的zookeeper安装,如果它还没有超载。 -It's best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. +It’s best to use a fresh version of ZooKeeper – 3.4.9 or later. The version in stable Linux distributions may be outdated. You should never use manually written scripts to transfer data between different ZooKeeper clusters, because the result will be incorrect for sequential nodes. Never use the «zkcopy» utility for the same reason: https://github.com/ksprojects/zkcopy/issues/15 diff --git a/docs/zh/operations/troubleshooting.md b/docs/zh/operations/troubleshooting.md index db7bf6c6bb9..a2b9a7b3187 100644 --- a/docs/zh/operations/troubleshooting.md +++ b/docs/zh/operations/troubleshooting.md @@ -17,7 +17,7 @@ toc_title: "\u7591\u96BE\u89E3\u7B54" ### 您无法使用Apt-get从ClickHouse存储库获取Deb软件包 {#you-cannot-get-deb-packages-from-clickhouse-repository-with-apt-get} - 检查防火墙设置。 -- 如果出于任何原因无法访问存储库,请按照以下文件中的描述下载软件包 [开始](../getting_started/index.md) 文章并使用手动安装它们 `sudo dpkg -i ` 指挥部 您还需要 `tzdata` 包。 +- 如果出于任何原因无法访问存储库,请按照以下文件中的描述下载软件包 [开始](../getting-started/index.md) 文章并使用手动安装它们 `sudo dpkg -i ` 指挥部 您还需要 `tzdata` 包。 ## 连接到服务器 {#troubleshooting-accepts-no-connections} @@ -105,7 +105,7 @@ $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-se - 端点设置。 - 检查 [listen\_host](server_configuration_parameters/settings.md#server_configuration_parameters-listen_host) 和 [tcp\_port](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port) 设置。 + 检查 [listen\_host](server-configuration-parameters/settings.md#server_configuration_parameters-listen_host) 和 [tcp\_port](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port) 设置。 ClickHouse服务器默认情况下仅接受本地主机连接。 @@ -117,8 +117,8 @@ $ sudo -u clickhouse /usr/bin/clickhouse-server --config-file /etc/clickhouse-se 检查: - - 该 [tcp\_port\_secure](server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) 设置。 - - 设置 [SSL序列](server_configuration_parameters/settings.md#server_configuration_parameters-openssl). + - 该 [tcp\_port\_secure](server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) 设置。 + - 设置 [SSL序列](server-configuration-parameters/settings.md#server_configuration_parameters-openssl). 连接时使用正确的参数。 例如,使用 `port_secure` 参数 `clickhouse_client`. diff --git a/docs/zh/operations/utilities/clickhouse-copier.md b/docs/zh/operations/utilities/clickhouse-copier.md index 9e982188499..f10e835a5b3 100644 --- a/docs/zh/operations/utilities/clickhouse-copier.md +++ b/docs/zh/operations/utilities/clickhouse-copier.md @@ -1,4 +1,3 @@ - # ツ环板-ョツ嘉ッツ偲 {#clickhouse-copier} 将数据从一个群集中的表复制到另一个(或相同)群集中的表。 diff --git a/docs/zh/operations/utilities/index.md b/docs/zh/operations/utilities/index.md index 8d70ef4a6bb..a2ab228f876 100644 --- a/docs/zh/operations/utilities/index.md +++ b/docs/zh/operations/utilities/index.md @@ -1,4 +1,3 @@ - # ツ环板Utilityョツ嘉ッ {#clickhouse-utility} - [ツ环板-ョツ嘉ッツ偲](clickhouse-local.md) — Allows running SQL queries on data without stopping the ClickHouse server, similar to how `awk` 做到这一点。 diff --git a/docs/zh/sql-reference/aggregate-functions/combinators.md b/docs/zh/sql-reference/aggregate-functions/combinators.md new file mode 100644 index 00000000000..47ea1d2e184 --- /dev/null +++ b/docs/zh/sql-reference/aggregate-functions/combinators.md @@ -0,0 +1,166 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 37 +toc_title: "\u805A\u5408\u51FD\u6570\u7EC4\u5408\u5668" +--- + +# 聚合函数组合器 {#aggregate_functions_combinators} + +聚合函数的名称可以附加一个后缀。 这改变了聚合函数的工作方式。 + +## -如果 {#agg-functions-combinator-if} + +The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). + +例: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` 等等。 + +使用条件聚合函数,您可以一次计算多个条件的聚合,而无需使用子查询和 `JOIN`例如,在Yandex的。Metrica,条件聚合函数用于实现段比较功能。 + +## -阵列 {#agg-functions-combinator-array} + +-Array后缀可以附加到任何聚合函数。 在这种情况下,聚合函数采用的参数 ‘Array(T)’ 类型(数组)而不是 ‘T’ 类型参数。 如果聚合函数接受多个参数,则它必须是长度相等的数组。 在处理数组时,聚合函数的工作方式与所有数组元素的原始聚合函数类似。 + +示例1: `sumArray(arr)` -总计所有的所有元素 ‘arr’ 阵列。 在这个例子中,它可以更简单地编写: `sum(arraySum(arr))`. + +示例2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ 阵列。 这可以做一个更简单的方法: `uniq(arrayJoin(arr))`,但它并不总是可以添加 ‘arrayJoin’ 到查询。 + +-如果和-阵列可以组合。 然而, ‘Array’ 必须先来,然后 ‘If’. 例: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. 由于这个顺序,该 ‘cond’ 参数不会是数组。 + +## -州 {#agg-functions-combinator-state} + +如果应用此combinator,则聚合函数不会返回结果值(例如唯一值的数量 [uniq](reference.md#agg_function-uniq) 函数),但聚合的中间状态(用于 `uniq`,这是用于计算唯一值的数量的散列表)。 这是一个 `AggregateFunction(...)` 可用于进一步处理或存储在表中以完成聚合。 + +要使用这些状态,请使用: + +- [AggregatingMergeTree](../../engines/table-engines/mergetree-family/aggregatingmergetree.md) 表引擎。 +- [最后聚会](../../sql-reference/functions/other-functions.md#function-finalizeaggregation) 功能。 +- [跑累积](../../sql-reference/functions/other-functions.md#function-runningaccumulate) 功能。 +- [-合并](#aggregate_functions_combinators_merge) combinator +- [-MergeState](#aggregate_functions_combinators_mergestate) combinator + +## -合并 {#aggregate_functions_combinators-merge} + +如果应用此组合器,则聚合函数将中间聚合状态作为参数,组合状态以完成聚合,并返回结果值。 + +## -MergeState {#aggregate_functions_combinators-mergestate} + +以与-Merge combinator相同的方式合并中间聚合状态。 但是,它不会返回结果值,而是返回中间聚合状态,类似于-State combinator。 + +## -ForEach {#agg-functions-combinator-foreach} + +将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sumForEach` 对于数组 `[1, 2]`, `[3, 4, 5]`和`[6, 7]`返回结果 `[10, 13, 5]` 之后将相应的数组项添加在一起。 + +## -OrDefault {#agg-functions-combinator-ordefault} + +如果没有要聚合的内容,则填充聚合函数的返回类型的默认值。 + +``` sql +SELECT avg(number), avgOrDefault(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrDefault(number)─┐ +│ nan │ 0 │ +└─────────────┴──────────────────────┘ +``` + +## -OrNull {#agg-functions-combinator-ornull} + +填充 `null` 如果没有什么聚合。 返回列将为空。 + +``` sql +SELECT avg(number), avgOrNull(number) FROM numbers(0) +``` + +``` text +┌─avg(number)─┬─avgOrNull(number)─┐ +│ nan │ ᴺᵁᴸᴸ │ +└─────────────┴───────────────────┘ +``` + +-OrDefault和-OrNull可以与其他组合器相结合。 当聚合函数不接受空输入时,它很有用。 + +``` sql +SELECT avgOrNullIf(x, x > 10) +FROM +( + SELECT toDecimal32(1.23, 2) AS x +) +``` + +``` text +┌─avgOrNullIf(x, greater(x, 10))─┐ +│ ᴺᵁᴸᴸ │ +└────────────────────────────────┘ +``` + +## -重新采样 {#agg-functions-combinator-resample} + +允许您将数据划分为组,然后单独聚合这些组中的数据。 通过将一列中的值拆分为间隔来创建组。 + +``` sql +Resample(start, end, step)(, resampling_key) +``` + +**参数** + +- `start` — Starting value of the whole required interval for `resampling_key` 值。 +- `stop` — Ending value of the whole required interval for `resampling_key` 值。 整个时间间隔不包括 `stop` 价值 `[start, stop)`. +- `step` — Step for separating the whole interval into subintervals. The `aggFunction` 在每个子区间上独立执行。 +- `resampling_key` — Column whose values are used for separating data into intervals. +- `aggFunction_params` — `aggFunction` 参数。 + +**返回值** + +- 阵列 `aggFunction` 每个子区间的结果。 + +**示例** + +考虑一下 `people` 具有以下数据的表: + +``` text +┌─name───┬─age─┬─wage─┐ +│ John │ 16 │ 10 │ +│ Alice │ 30 │ 15 │ +│ Mary │ 35 │ 8 │ +│ Evelyn │ 48 │ 11.5 │ +│ David │ 62 │ 9.9 │ +│ Brian │ 60 │ 16 │ +└────────┴─────┴──────┘ +``` + +让我们得到的人的名字,他们的年龄在于的时间间隔 `[30,60)` 和 `[60,75)`. 由于我们使用整数表示的年龄,我们得到的年龄 `[30, 59]` 和 `[60,74]` 间隔。 + +要在数组中聚合名称,我们使用 [groupArray](reference.md#agg_function-grouparray) 聚合函数。 这需要一个参数。 在我们的例子中,它是 `name` 列。 该 `groupArrayResample` 函数应该使用 `age` 按年龄聚合名称的列。 要定义所需的时间间隔,我们通过 `30, 75, 30` 参数到 `groupArrayResample` 功能。 + +``` sql +SELECT groupArrayResample(30, 75, 30)(name, age) FROM people +``` + +``` text +┌─groupArrayResample(30, 75, 30)(name, age)─────┐ +│ [['Alice','Mary','Evelyn'],['David','Brian']] │ +└───────────────────────────────────────────────┘ +``` + +考虑结果。 + +`Jonh` 是因为他太年轻了 其他人按照指定的年龄间隔进行分配。 + +现在让我们计算指定年龄间隔内的总人数和平均工资。 + +``` sql +SELECT + countResample(30, 75, 30)(name, age) AS amount, + avgResample(30, 75, 30)(wage, age) AS avg_wage +FROM people +``` + +``` text +┌─amount─┬─avg_wage──────────────────┐ +│ [3,2] │ [11.5,12.949999809265137] │ +└────────┴───────────────────────────┘ +``` + +[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/zh/sql-reference/aggregate-functions/index.md b/docs/zh/sql-reference/aggregate-functions/index.md new file mode 100644 index 00000000000..1e17609d3d6 --- /dev/null +++ b/docs/zh/sql-reference/aggregate-functions/index.md @@ -0,0 +1,62 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_folder_title: "\u805A\u5408\u51FD\u6570" +toc_priority: 33 +toc_title: "\u5BFC\u8A00" +--- + +# 聚合函数 {#aggregate-functions} + +聚合函数在 [正常](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) 方式如预期的数据库专家。 + +ClickHouse还支持: + +- [参数聚合函数](parametric-functions.md#aggregate_functions_parametric),它接受除列之外的其他参数。 +- [组合器](combinators.md#aggregate_functions_combinators),这改变了聚合函数的行为。 + +## 空处理 {#null-processing} + +在聚合过程中,所有 `NULL`s被跳过。 + +**例:** + +考虑这个表: + +``` text +┌─x─┬────y─┐ +│ 1 │ 2 │ +│ 2 │ ᴺᵁᴸᴸ │ +│ 3 │ 2 │ +│ 3 │ 3 │ +│ 3 │ ᴺᵁᴸᴸ │ +└───┴──────┘ +``` + +比方说,你需要在总的值 `y` 列: + +``` sql +SELECT sum(y) FROM t_null_big +``` + + ┌─sum(y)─┐ + │ 7 │ + └────────┘ + +该 `sum` 函数解释 `NULL` 作为 `0`. 特别是,这意味着,如果函数接收输入的选择,其中所有的值 `NULL`,那么结果将是 `0`,不 `NULL`. + +现在你可以使用 `groupArray` 函数从创建一个数组 `y` 列: + +``` sql +SELECT groupArray(y) FROM t_null_big +``` + +``` text +┌─groupArray(y)─┐ +│ [2,2,3] │ +└───────────────┘ +``` + +`groupArray` 不包括 `NULL` 在生成的数组中。 + +[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/zh/sql-reference/aggregate-functions/parametric-functions.md b/docs/zh/sql-reference/aggregate-functions/parametric-functions.md new file mode 100644 index 00000000000..6651a61c505 --- /dev/null +++ b/docs/zh/sql-reference/aggregate-functions/parametric-functions.md @@ -0,0 +1,499 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 38 +toc_title: "\u53C2\u6570\u805A\u5408\u51FD\u6570" +--- + +# 参数聚合函数 {#aggregate_functions_parametric} + +Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. + +## 直方图 {#histogram} + +计算自适应直方图。 它不能保证精确的结果。 + +``` sql +histogram(number_of_bins)(values) +``` + +该函数使用 [流式并行决策树算法](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). 当新数据输入函数时,hist图分区的边界将被调整。 在通常情况下,箱的宽度不相等。 + +**参数** + +`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. +`values` — [表达式](../syntax.md#syntax-expressions) 导致输入值。 + +**返回值** + +- [阵列](../../sql-reference/data-types/array.md) 的 [元组](../../sql-reference/data-types/tuple.md) 下面的格式: + + ``` + [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] + ``` + + - `lower` — Lower bound of the bin. + - `upper` — Upper bound of the bin. + - `height` — Calculated height of the bin. + +**示例** + +``` sql +SELECT histogram(5)(number + 1) +FROM ( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ +│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +您可以使用 [酒吧](../../sql-reference/functions/other-functions.md#function-bar) 功能,例如: + +``` sql +WITH histogram(5)(rand() % 100) AS hist +SELECT + arrayJoin(hist).3 AS height, + bar(height, 0, 6, 5) AS bar +FROM +( + SELECT * + FROM system.numbers + LIMIT 20 +) +``` + +``` text +┌─height─┬─bar───┐ +│ 2.125 │ █▋ │ +│ 3.25 │ ██▌ │ +│ 5.625 │ ████▏ │ +│ 5.625 │ ████▏ │ +│ 3.375 │ ██▌ │ +└────────┴───────┘ +``` + +在这种情况下,您应该记住您不知道直方图bin边界。 + +## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} + +检查序列是否包含与模式匹配的事件链。 + +``` sql +sequenceMatch(pattern)(timestamp, cond1, cond2, ...) +``` + +!!! warning "警告" + 在同一秒钟发生的事件可能以未定义的顺序排列在序列中,影响结果。 + +**参数** + +- `pattern` — Pattern string. See [模式语法](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` 和 `DateTime`. 您还可以使用任何支持的 [UInt](../../sql-reference/data-types/int-uint.md) 数据类型。 + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最多可以传递32个条件参数。 该函数只考虑这些条件中描述的事件。 如果序列包含未在条件中描述的数据,则函数将跳过这些数据。 + +**返回值** + +- 1,如果模式匹配。 +- 0,如果模式不匹配。 + +类型: `UInt8`. + + +**模式语法** + +- `(?N)` — Matches the condition argument at position `N`. 条件在编号 `[1, 32]` 范围。 例如, `(?1)` 匹配传递给 `cond1` 参数。 + +- `.*` — Matches any number of events. You don’t need conditional arguments to match this element of the pattern. + +- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` 匹配彼此发生超过1800秒的事件。 这些事件之间可以存在任意数量的任何事件。 您可以使用 `>=`, `>`, `<`, `<=` 运营商。 + +**例** + +考虑在数据 `t` 表: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +└──────┴────────┘ +``` + +执行查询: + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 1 │ +└───────────────────────────────────────────────────────────────────────┘ +``` + +该函数找到了数字2跟随数字1的事件链。 它跳过了它们之间的数字3,因为该数字没有被描述为事件。 如果我们想在搜索示例中给出的事件链时考虑这个数字,我们应该为它创建一个条件。 + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ +│ 0 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +在这种情况下,函数找不到与模式匹配的事件链,因为数字3的事件发生在1和2之间。 如果在相同的情况下,我们检查了数字4的条件,则序列将与模式匹配。 + +``` sql +SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t +``` + +``` text +┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ +│ 1 │ +└──────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +**另请参阅** + +- [sequenceCount](#function-sequencecount) + +## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} + +计数与模式匹配的事件链的数量。 该函数搜索不重叠的事件链。 当前链匹配后,它开始搜索下一个链。 + +!!! warning "警告" + 在同一秒钟发生的事件可能以未定义的顺序排列在序列中,影响结果。 + +``` sql +sequenceCount(pattern)(timestamp, cond1, cond2, ...) +``` + +**参数** + +- `pattern` — Pattern string. See [模式语法](#sequence-function-pattern-syntax). + +- `timestamp` — Column considered to contain time data. Typical data types are `Date` 和 `DateTime`. 您还可以使用任何支持的 [UInt](../../sql-reference/data-types/int-uint.md) 数据类型。 + +- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最多可以传递32个条件参数。 该函数只考虑这些条件中描述的事件。 如果序列包含未在条件中描述的数据,则函数将跳过这些数据。 + +**返回值** + +- 匹配的非重叠事件链数。 + +类型: `UInt64`. + +**示例** + +考虑在数据 `t` 表: + +``` text +┌─time─┬─number─┐ +│ 1 │ 1 │ +│ 2 │ 3 │ +│ 3 │ 2 │ +│ 4 │ 1 │ +│ 5 │ 3 │ +│ 6 │ 2 │ +└──────┴────────┘ +``` + +计算数字2在数字1之后出现的次数以及它们之间的任何其他数字: + +``` sql +SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t +``` + +``` text +┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ +│ 2 │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +**另请参阅** + +- [sequenceMatch](#function-sequencematch) + +## windowFunnel {#windowfunnel} + +搜索滑动时间窗中的事件链,并计算从链中发生的最大事件数。 + +该函数根据算法工作: + +- 该函数搜索触发链中的第一个条件并将事件计数器设置为1的数据。 这是滑动窗口启动的时刻。 + +- 如果来自链的事件在窗口内顺序发生,则计数器将递增。 如果事件序列中断,则计数器不会增加。 + +- 如果数据在不同的完成点具有多个事件链,则该函数将仅输出最长链的大小。 + +**语法** + +``` sql +windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) +``` + +**参数** + +- `window` — Length of the sliding window in seconds. +- `mode` -这是一个可选的参数。 + - `'strict'` -当 `'strict'` 设置时,windowFunnel()仅对唯一值应用条件。 +- `timestamp` — Name of the column containing the timestamp. Data types supported: [日期](../../sql-reference/data-types/date.md), [日期时间](../../sql-reference/data-types/datetime.md#data_type-datetime) 和其他无符号整数类型(请注意,即使时间戳支持 `UInt64` 类型,它的值不能超过Int64最大值,即2^63-1)。 +- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql-reference/data-types/int-uint.md). + +**返回值** + +滑动时间窗口内连续触发条件链的最大数目。 +对选择中的所有链进行了分析。 + +类型: `Integer`. + +**示例** + +确定设定的时间段是否足以让用户选择手机并在在线商店中购买两次。 + +设置以下事件链: + +1. 用户登录到其在应用商店中的帐户 (`eventID = 1003`). +2. 用户搜索手机 (`eventID = 1007, product = 'phone'`). +3. 用户下了订单 (`eventID = 1009`). +4. 用户再次下订单 (`eventID = 1010`). + +输入表: + +``` text +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ +│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ +└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ +``` + +了解用户有多远 `user_id` 可以在2019的1-2月期间通过链条。 + +查询: + +``` sql +SELECT + level, + count() AS c +FROM +( + SELECT + user_id, + windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level + FROM trend + WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') + GROUP BY user_id +) +GROUP BY level +ORDER BY level ASC +``` + +结果: + +``` text +┌─level─┬─c─┐ +│ 4 │ 1 │ +└───────┴───┘ +``` + +## 保留 {#retention} + +该函数将一组条件作为参数,类型为1到32个参数 `UInt8` 表示事件是否满足特定条件。 +任何条件都可以指定为参数(如 [WHERE](../../sql-reference/statements/select.md#select-where)). + +除了第一个以外,条件成对适用:如果第一个和第二个是真的,第二个结果将是真的,如果第一个和fird是真的,第三个结果将是真的,等等。 + +**语法** + +``` sql +retention(cond1, cond2, ..., cond32); +``` + +**参数** + +- `cond` — an expression that returns a `UInt8` 结果(1或0)。 + +**返回值** + +数组为1或0。 + +- 1 — condition was met for the event. +- 0 — condition wasn’t met for the event. + +类型: `UInt8`. + +**示例** + +让我们考虑计算的一个例子 `retention` 功能,以确定网站流量。 + +**1.** Сreate a table to illustrate an example. + +``` sql +CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; + +INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); +INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); +INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); +``` + +输入表: + +查询: + +``` sql +SELECT * FROM retention_test +``` + +结果: + +``` text +┌───────date─┬─uid─┐ +│ 2020-01-01 │ 0 │ +│ 2020-01-01 │ 1 │ +│ 2020-01-01 │ 2 │ +│ 2020-01-01 │ 3 │ +│ 2020-01-01 │ 4 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-02 │ 0 │ +│ 2020-01-02 │ 1 │ +│ 2020-01-02 │ 2 │ +│ 2020-01-02 │ 3 │ +│ 2020-01-02 │ 4 │ +│ 2020-01-02 │ 5 │ +│ 2020-01-02 │ 6 │ +│ 2020-01-02 │ 7 │ +│ 2020-01-02 │ 8 │ +│ 2020-01-02 │ 9 │ +└────────────┴─────┘ +┌───────date─┬─uid─┐ +│ 2020-01-03 │ 0 │ +│ 2020-01-03 │ 1 │ +│ 2020-01-03 │ 2 │ +│ 2020-01-03 │ 3 │ +│ 2020-01-03 │ 4 │ +│ 2020-01-03 │ 5 │ +│ 2020-01-03 │ 6 │ +│ 2020-01-03 │ 7 │ +│ 2020-01-03 │ 8 │ +│ 2020-01-03 │ 9 │ +│ 2020-01-03 │ 10 │ +│ 2020-01-03 │ 11 │ +│ 2020-01-03 │ 12 │ +│ 2020-01-03 │ 13 │ +│ 2020-01-03 │ 14 │ +└────────────┴─────┘ +``` + +**2.** 按唯一ID对用户进行分组 `uid` 使用 `retention` 功能。 + +查询: + +``` sql +SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r +FROM retention_test +WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') +GROUP BY uid +ORDER BY uid ASC +``` + +结果: + +``` text +┌─uid─┬─r───────┐ +│ 0 │ [1,1,1] │ +│ 1 │ [1,1,1] │ +│ 2 │ [1,1,1] │ +│ 3 │ [1,1,1] │ +│ 4 │ [1,1,1] │ +│ 5 │ [0,0,0] │ +│ 6 │ [0,0,0] │ +│ 7 │ [0,0,0] │ +│ 8 │ [0,0,0] │ +│ 9 │ [0,0,0] │ +│ 10 │ [0,0,0] │ +│ 11 │ [0,0,0] │ +│ 12 │ [0,0,0] │ +│ 13 │ [0,0,0] │ +│ 14 │ [0,0,0] │ +└─────┴─────────┘ +``` + +**3.** 计算每天的现场访问总数。 + +查询: + +``` sql +SELECT + sum(r[1]) AS r1, + sum(r[2]) AS r2, + sum(r[3]) AS r3 +FROM +( + SELECT + uid, + retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r + FROM retention_test + WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') + GROUP BY uid +) +``` + +结果: + +``` text +┌─r1─┬─r2─┬─r3─┐ +│ 5 │ 5 │ 5 │ +└────┴────┴────┘ +``` + +哪里: + +- `r1`-2020-01-01期间访问该网站的独立访问者数量( `cond1` 条件)。 +- `r2`-在2020-01-01和2020-01-02之间的特定时间段内访问该网站的唯一访问者的数量 (`cond1` 和 `cond2` 条件)。 +- `r3`-在2020-01-01和2020-01-03之间的特定时间段内访问该网站的唯一访问者的数量 (`cond1` 和 `cond3` 条件)。 + +## uniqUpTo(N)(x) {#uniquptonx} + +Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. + +建议使用小Ns,高达10。 N的最大值为100。 + +对于聚合函数的状态,它使用的内存量等于1+N\*一个字节值的大小。 +对于字符串,它存储8个字节的非加密哈希。 也就是说,计算是近似的字符串。 + +该函数也适用于多个参数。 + +它的工作速度尽可能快,除了使用较大的N值并且唯一值的数量略小于N的情况。 + +用法示例: + +``` text +Problem: Generate a report that shows only keywords that produced at least 5 unique users. +Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 +``` + +[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) + +## sumMapFiltered(keys\_to\_keep)(键值) {#summapfilteredkeys-to-keepkeys-values} + +同样的行为 [sumMap](reference.md#agg_functions-summap) 除了一个键数组作为参数传递。 这在使用高基数密钥时尤其有用。 diff --git a/docs/zh/sql-reference/aggregate-functions/reference.md b/docs/zh/sql-reference/aggregate-functions/reference.md new file mode 100644 index 00000000000..472bc4e4252 --- /dev/null +++ b/docs/zh/sql-reference/aggregate-functions/reference.md @@ -0,0 +1,1878 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 36 +toc_title: "\u53C2\u8003\u8D44\u6599" +--- + +# 函数参考 {#function-reference} + +## 计数 {#agg_function-count} + +计数行数或非空值。 + +ClickHouse支持以下语法 `count`: +- `count(expr)` 或 `COUNT(DISTINCT expr)`. +- `count()` 或 `COUNT(*)`. 该 `count()` 语法是ClickHouse特定的。 + +**参数** + +该功能可以采取: + +- 零参数。 +- 一 [表达式](../syntax.md#syntax-expressions). + +**返回值** + +- 如果没有参数调用函数,它会计算行数。 +- 如果 [表达式](../syntax.md#syntax-expressions) 被传递,则该函数计数此表达式返回的次数非null。 如果表达式返回 [可为空](../../sql-reference/data-types/nullable.md)-键入值,然后结果 `count` 保持不 `Nullable`. 如果返回表达式,则该函数返回0 `NULL` 对于所有的行。 + +在这两种情况下,返回值的类型为 [UInt64](../../sql-reference/data-types/int-uint.md). + +**详细信息** + +ClickHouse支持 `COUNT(DISTINCT ...)` 语法 这种结构的行为取决于 [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) 设置。 它定义了其中的 [uniq\*](#agg_function-uniq) 函数用于执行操作。 默认值为 [uniqExact](#agg_function-uniqexact) 功能。 + +该 `SELECT count() FROM table` 查询未被优化,因为表中的条目数没有单独存储。 它从表中选择一个小列并计算其中的值数。 + +**例** + +示例1: + +``` sql +SELECT count() FROM t +``` + +``` text +┌─count()─┐ +│ 5 │ +└─────────┘ +``` + +示例2: + +``` sql +SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' +``` + +``` text +┌─name──────────────────────────┬─value─────┐ +│ count_distinct_implementation │ uniqExact │ +└───────────────────────────────┴───────────┘ +``` + +``` sql +SELECT count(DISTINCT num) FROM t +``` + +``` text +┌─uniqExact(num)─┐ +│ 3 │ +└────────────────┘ +``` + +这个例子表明 `count(DISTINCT num)` 由执行 `uniqExact` 根据功能 `count_distinct_implementation` 设定值。 + +## 任何(x) {#agg_function-any} + +选择第一个遇到的值。 +查询可以以任何顺序执行,甚至每次都以不同的顺序执行,因此此函数的结果是不确定的。 +要获得确定的结果,您可以使用 ‘min’ 或 ‘max’ 功能,而不是 ‘any’. + +在某些情况下,可以依靠执行的顺序。 这适用于SELECT来自使用ORDER BY的子查询的情况。 + +当一个 `SELECT` 查询具有 `GROUP BY` 子句或至少一个聚合函数,ClickHouse(相对于MySQL)要求在所有表达式 `SELECT`, `HAVING`,和 `ORDER BY` 子句可以从键或聚合函数计算。 换句话说,从表中选择的每个列必须在键或聚合函数内使用。 要获得像MySQL这样的行为,您可以将其他列放在 `any` 聚合函数。 + +## anyHeavy(x) {#anyheavyx} + +使用选择一个频繁出现的值 [重打者](http://www.cs.umd.edu/~samir/498/karp.pdf) 算法。 如果某个值在查询的每个执行线程中出现的情况超过一半,则返回此值。 通常情况下,结果是不确定的。 + +``` sql +anyHeavy(column) +``` + +**参数** + +- `column` – The column name. + +**示例** + +就拿 [时间](../../getting-started/example-datasets/ontime.md) 数据集,并选择在任何频繁出现的值 `AirlineID` 列。 + +``` sql +SELECT anyHeavy(AirlineID) AS res +FROM ontime +``` + +``` text +┌───res─┐ +│ 19690 │ +└───────┘ +``` + +## anyLast(x) {#anylastx} + +选择遇到的最后一个值。 +其结果是一样不确定的 `any` 功能。 + +## 集团比特 {#groupbitand} + +按位应用 `AND` 对于一系列的数字。 + +``` sql +groupBitAnd(expr) +``` + +**参数** + +`expr` – An expression that results in `UInt*` 类型。 + +**返回值** + +的价值 `UInt*` 类型。 + +**示例** + +测试数据: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +查询: + +``` sql +SELECT groupBitAnd(num) FROM t +``` + +哪里 `num` 是包含测试数据的列。 + +结果: + +``` text +binary decimal +00000100 = 4 +``` + +## groupBitOr {#groupbitor} + +按位应用 `OR` 对于一系列的数字。 + +``` sql +groupBitOr(expr) +``` + +**参数** + +`expr` – An expression that results in `UInt*` 类型。 + +**返回值** + +的价值 `UInt*` 类型。 + +**示例** + +测试数据: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +查询: + +``` sql +SELECT groupBitOr(num) FROM t +``` + +哪里 `num` 是包含测试数据的列。 + +结果: + +``` text +binary decimal +01111101 = 125 +``` + +## groupBitXor {#groupbitxor} + +按位应用 `XOR` 对于一系列的数字。 + +``` sql +groupBitXor(expr) +``` + +**参数** + +`expr` – An expression that results in `UInt*` 类型。 + +**返回值** + +的价值 `UInt*` 类型。 + +**示例** + +测试数据: + +``` text +binary decimal +00101100 = 44 +00011100 = 28 +00001101 = 13 +01010101 = 85 +``` + +查询: + +``` sql +SELECT groupBitXor(num) FROM t +``` + +哪里 `num` 是包含测试数据的列。 + +结果: + +``` text +binary decimal +01101000 = 104 +``` + +## groupBitmap {#groupbitmap} + +从无符号整数列的位图或聚合计算,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmap(expr) +``` + +**参数** + +`expr` – An expression that results in `UInt*` 类型。 + +**返回值** + +的价值 `UInt64` 类型。 + +**示例** + +测试数据: + +``` text +UserID +1 +1 +2 +3 +``` + +查询: + +``` sql +SELECT groupBitmap(UserID) as num FROM t +``` + +结果: + +``` text +num +3 +``` + +## min(x) {#agg_function-min} + +计算最小值。 + +## max(x) {#agg_function-max} + +计算最大值。 + +## argMin(arg,val) {#agg-function-argmin} + +计算 ‘arg’ 最小值的值 ‘val’ 价值。 如果有几个不同的值 ‘arg’ 对于最小值 ‘val’,遇到的第一个值是输出。 + +**示例:** + +``` text +┌─user─────┬─salary─┐ +│ director │ 5000 │ +│ manager │ 3000 │ +│ worker │ 1000 │ +└──────────┴────────┘ +``` + +``` sql +SELECT argMin(user, salary) FROM salary +``` + +``` text +┌─argMin(user, salary)─┐ +│ worker │ +└──────────────────────┘ +``` + +## argMax(arg,val) {#agg-function-argmax} + +计算 ‘arg’ 最大值 ‘val’ 价值。 如果有几个不同的值 ‘arg’ 对于最大值 ‘val’,遇到的第一个值是输出。 + +## sum(x) {#agg_function-sum} + +计算总和。 +只适用于数字。 + +## sumWithOverflow(x) {#sumwithoverflowx} + +使用与输入参数相同的数据类型计算数字的总和。 如果总和超过此数据类型的最大值,则函数返回错误。 + +只适用于数字。 + +## sumMap(key,value) {#agg_functions-summap} + +总计 ‘value’ 数组根据在指定的键 ‘key’ 阵列。 +元素的数量 ‘key’ 和 ‘value’ 总计的每一行必须相同。 +Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. + +示例: + +``` sql +CREATE TABLE sum_map( + date Date, + timeslot DateTime, + statusMap Nested( + status UInt16, + requests UInt64 + ) +) ENGINE = Log; +INSERT INTO sum_map VALUES + ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), + ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); +SELECT + timeslot, + sumMap(statusMap.status, statusMap.requests) +FROM sum_map +GROUP BY timeslot +``` + +``` text +┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ +│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ +│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ +└─────────────────────┴──────────────────────────────────────────────┘ +``` + +## skewPop {#skewpop} + +计算 [歪斜](https://en.wikipedia.org/wiki/Skewness) 的序列。 + +``` sql +skewPop(expr) +``` + +**参数** + +`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 + +**返回值** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**示例** + +``` sql +SELECT skewPop(value) FROM series_with_value_column +``` + +## skewSamp {#skewsamp} + +计算 [样品偏度](https://en.wikipedia.org/wiki/Skewness) 的序列。 + +它表示随机变量的偏度的无偏估计,如果传递的值形成其样本。 + +``` sql +skewSamp(expr) +``` + +**参数** + +`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 + +**返回值** + +The skewness of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). 如果 `n <= 1` (`n` 是样本的大小),则该函数返回 `nan`. + +**示例** + +``` sql +SELECT skewSamp(value) FROM series_with_value_column +``` + +## kurtPop {#kurtpop} + +计算 [峰度](https://en.wikipedia.org/wiki/Kurtosis) 的序列。 + +``` sql +kurtPop(expr) +``` + +**参数** + +`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 + +**返回值** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md) + +**示例** + +``` sql +SELECT kurtPop(value) FROM series_with_value_column +``` + +## kurtSamp {#kurtsamp} + +计算 [峰度样本](https://en.wikipedia.org/wiki/Kurtosis) 的序列。 + +它表示随机变量峰度的无偏估计,如果传递的值形成其样本。 + +``` sql +kurtSamp(expr) +``` + +**参数** + +`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 + +**返回值** + +The kurtosis of the given distribution. Type — [Float64](../../sql-reference/data-types/float.md). 如果 `n <= 1` (`n` 是样本的大小),则该函数返回 `nan`. + +**示例** + +``` sql +SELECT kurtSamp(value) FROM series_with_value_column +``` + +## timeSeriesGroupSum(uid,timestamp,value) {#agg-function-timeseriesgroupsum} + +`timeSeriesGroupSum` 可以聚合不同的时间序列,即采样时间戳不对齐。 +它将在两个采样时间戳之间使用线性插值,然后将时间序列和在一起。 + +- `uid` 是时间序列唯一id, `UInt64`. +- `timestamp` 是Int64型,以支持毫秒或微秒。 +- `value` 是指标。 + +函数返回元组数组 `(timestamp, aggregated_value)` 对。 + +在使用此功能之前,请确保 `timestamp` 按升序排列 + +示例: + +``` text +┌─uid─┬─timestamp─┬─value─┐ +│ 1 │ 2 │ 0.2 │ +│ 1 │ 7 │ 0.7 │ +│ 1 │ 12 │ 1.2 │ +│ 1 │ 17 │ 1.7 │ +│ 1 │ 25 │ 2.5 │ +│ 2 │ 3 │ 0.6 │ +│ 2 │ 8 │ 1.6 │ +│ 2 │ 12 │ 2.4 │ +│ 2 │ 18 │ 3.6 │ +│ 2 │ 24 │ 4.8 │ +└─────┴───────────┴───────┘ +``` + +``` sql +CREATE TABLE time_series( + uid UInt64, + timestamp Int64, + value Float64 +) ENGINE = Memory; +INSERT INTO time_series VALUES + (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), + (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); + +SELECT timeSeriesGroupSum(uid, timestamp, value) +FROM ( + SELECT * FROM time_series order by timestamp ASC +); +``` + +其结果将是: + +``` text +[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] +``` + +## timeSeriesGroupRateSum(uid,ts,val) {#agg-function-timeseriesgroupratesum} + +同样,timeSeriesGroupRateSum,timeSeriesGroupRateSum将计算时间序列的速率,然后将速率总和在一起。 +此外,使用此函数之前,时间戳应该是上升顺序。 + +使用此函数,上述情况下的结果将是: + +``` text +[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] +``` + +## avg(x) {#agg_function-avg} + +计算平均值。 +只适用于数字。 +结果总是Float64。 + +## 平均加权 {#avgweighted} + +计算 [加权算术平均值](https://en.wikipedia.org/wiki/Weighted_arithmetic_mean). + +**语法** + +``` sql +avgWeighted(x, weight) +``` + +**参数** + +- `x` — Values. [整数](../data-types/int-uint.md) 或 [浮点](../data-types/float.md). +- `weight` — Weights of the values. [整数](../data-types/int-uint.md) 或 [浮点](../data-types/float.md). + +类型 `x` 和 `weight` 一定是一样的 + +**返回值** + +- 加权平均值。 +- `NaN`. 如果所有的权重都等于0。 + +类型: [Float64](../data-types/float.md). + +**示例** + +查询: + +``` sql +SELECT avgWeighted(x, w) +FROM values('x Int8, w Int8', (4, 1), (1, 0), (10, 2)) +``` + +结果: + +``` text +┌─avgWeighted(x, weight)─┐ +│ 8 │ +└────────────────────────┘ +``` + +## uniq {#agg_function-uniq} + +计算参数的不同值的近似数量。 + +``` sql +uniq(x[, ...]) +``` + +**参数** + +该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 + +**返回值** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-键入号码。 + +**实施细节** + +功能: + +- 计算聚合中所有参数的哈希值,然后在计算中使用它。 + +- 使用自适应采样算法。 对于计算状态,该函数使用最多65536个元素哈希值的样本。 + + This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. + +- 确定性地提供结果(它不依赖于查询处理顺序)。 + +我们建议在几乎所有情况下使用此功能。 + +**另请参阅** + +- [uniqCombined](#agg_function-uniqcombined) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined {#agg_function-uniqcombined} + +计算不同参数值的近似数量。 + +``` sql +uniqCombined(HLL_precision)(x[, ...]) +``` + +该 `uniqCombined` 函数是计算不同数值数量的不错选择。 + +**参数** + +该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 + +`HLL_precision` 是以2为底的单元格数的对数 [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). 可选,您可以将该函数用作 `uniqCombined(x[, ...])`. 默认值 `HLL_precision` 是17,这是有效的96KiB的空间(2^17个单元,每个6比特)。 + +**返回值** + +- 一个数字 [UInt64](../../sql-reference/data-types/int-uint.md)-键入号码。 + +**实施细节** + +功能: + +- 计算散列(64位散列 `String` 否则32位)对于聚合中的所有参数,然后在计算中使用它。 + +- 使用三种算法的组合:数组、哈希表和HyperLogLog与error错表。 + + For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. + +- 确定性地提供结果(它不依赖于查询处理顺序)。 + +!!! note "注" + 因为它使用32位散列非-`String` 类型,结果将有非常高的误差基数显着大于 `UINT_MAX` (错误将在几百亿不同值之后迅速提高),因此在这种情况下,您应该使用 [uniqCombined64](#agg_function-uniqcombined64) + +相比于 [uniq](#agg_function-uniq) 功能,该 `uniqCombined`: + +- 消耗少几倍的内存。 +- 计算精度高出几倍。 +- 通常具有略低的性能。 在某些情况下, `uniqCombined` 可以表现得比 `uniq`,例如,使用通过网络传输大量聚合状态的分布式查询。 + +**另请参阅** + +- [uniq](#agg_function-uniq) +- [uniqCombined64](#agg_function-uniqcombined64) +- [uniqHLL12](#agg_function-uniqhll12) +- [uniqExact](#agg_function-uniqexact) + +## uniqCombined64 {#agg_function-uniqcombined64} + +和 [uniqCombined](#agg_function-uniqcombined),但对所有数据类型使用64位哈希。 + +## uniqHLL12 {#agg_function-uniqhll12} + +计算不同参数值的近似数量,使用 [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) 算法。 + +``` sql +uniqHLL12(x[, ...]) +``` + +**参数** + +该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 + +**返回值** + +- A [UInt64](../../sql-reference/data-types/int-uint.md)-键入号码。 + +**实施细节** + +功能: + +- 计算聚合中所有参数的哈希值,然后在计算中使用它。 + +- 使用HyperLogLog算法来近似不同参数值的数量。 + + 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). + +- 提供确定结果(它不依赖于查询处理顺序)。 + +我们不建议使用此功能。 在大多数情况下,使用 [uniq](#agg_function-uniq) 或 [uniqCombined](#agg_function-uniqcombined) 功能。 + +**另请参阅** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqExact](#agg_function-uniqexact) + +## uniqExact {#agg_function-uniqexact} + +计算不同参数值的准确数目。 + +``` sql +uniqExact(x[, ...]) +``` + +使用 `uniqExact` 功能,如果你绝对需要一个确切的结果。 否则使用 [uniq](#agg_function-uniq) 功能。 + +该 `uniqExact` 功能使用更多的内存比 `uniq`,因为状态的大小随着不同值的数量的增加而无界增长。 + +**参数** + +该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 + +**另请参阅** + +- [uniq](#agg_function-uniq) +- [uniqCombined](#agg_function-uniqcombined) +- [uniqHLL12](#agg_function-uniqhll12) + +## 群交(x),群交(max\_size)(x) {#agg_function-grouparray} + +创建参数值的数组。 +值可以按任何(不确定)顺序添加到数组中。 + +第二个版本(与 `max_size` 参数)将结果数组的大小限制为 `max_size` 元素。 +例如, `groupArray (1) (x)` 相当于 `[any (x)]`. + +在某些情况下,您仍然可以依靠执行的顺序。 这适用于以下情况 `SELECT` 来自使用 `ORDER BY`. + +## groupArrayInsertAt(值,位置) {#grouparrayinsertatvalue-position} + +将值插入到数组中的指定位置中。 + +!!! note "注" + 此函数使用从零开始的位置,与传统SQL数组的从一开始的位置相反。 + +Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. + +可选参数: + +- 在空位置替换的默认值。 +- 生成数组的长度。 这允许您接收所有聚合键的相同大小的数组。 使用此参数时,必须指定默认值。 + +## groupArrayMovingSum {#agg_function-grouparraymovingsum} + +计算输入值的移动和。 + +``` sql +groupArrayMovingSum(numbers_for_summing) +groupArrayMovingSum(window_size)(numbers_for_summing) +``` + +该函数可以将窗口大小作为参数。 如果未指定,则该函数的窗口大小等于列中的行数。 + +**参数** + +- `numbers_for_summing` — [表达式](../syntax.md#syntax-expressions) 生成数值数据类型值。 +- `window_size` — Size of the calculation window. + +**返回值** + +- 与输入数据大小和类型相同的数组。 + +**示例** + +样品表: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +查询: + +``` sql +SELECT + groupArrayMovingSum(int) AS I, + groupArrayMovingSum(float) AS F, + groupArrayMovingSum(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingSum(2)(int) AS I, + groupArrayMovingSum(2)(float) AS F, + groupArrayMovingSum(2)(dec) AS D +FROM t +``` + +``` text +┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ +│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ +└────────────┴─────────────────────────────────┴────────────────────────┘ +``` + +## groupArrayMovingAvg {#agg_function-grouparraymovingavg} + +计算输入值的移动平均值。 + +``` sql +groupArrayMovingAvg(numbers_for_summing) +groupArrayMovingAvg(window_size)(numbers_for_summing) +``` + +该函数可以将窗口大小作为参数。 如果未指定,则该函数的窗口大小等于列中的行数。 + +**参数** + +- `numbers_for_summing` — [表达式](../syntax.md#syntax-expressions) 生成数值数据类型值。 +- `window_size` — Size of the calculation window. + +**返回值** + +- 与输入数据大小和类型相同的数组。 + +该函数使用 [四舍五入到零](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). 它截断结果数据类型的小数位数。 + +**示例** + +样品表 `b`: + +``` sql +CREATE TABLE t +( + `int` UInt8, + `float` Float32, + `dec` Decimal32(2) +) +ENGINE = TinyLog +``` + +``` text +┌─int─┬─float─┬──dec─┐ +│ 1 │ 1.1 │ 1.10 │ +│ 2 │ 2.2 │ 2.20 │ +│ 4 │ 4.4 │ 4.40 │ +│ 7 │ 7.77 │ 7.77 │ +└─────┴───────┴──────┘ +``` + +查询: + +``` sql +SELECT + groupArrayMovingAvg(int) AS I, + groupArrayMovingAvg(float) AS F, + groupArrayMovingAvg(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ +│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ +└───────────┴─────────────────────────────────────┴───────────────────────┘ +``` + +``` sql +SELECT + groupArrayMovingAvg(2)(int) AS I, + groupArrayMovingAvg(2)(float) AS F, + groupArrayMovingAvg(2)(dec) AS D +FROM t +``` + +``` text +┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ +│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ +└───────────┴──────────────────────────────────┴───────────────────────┘ +``` + +## 禄,赂麓ta脌麓,):脡,,拢脢,group媒group)galaxy s8碌胫脢)禄煤)酶脱脩) {#groupuniqarrayx-groupuniqarraymax-sizex} + +从不同的参数值创建一个数组。 内存消耗是一样的 `uniqExact` 功能。 + +第二个版本(与 `max_size` 参数)将结果数组的大小限制为 `max_size` 元素。 +例如, `groupUniqArray(1)(x)` 相当于 `[any(x)]`. + +## 分位数 {#quantile} + +计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 + +此功能适用 [油藏采样](https://en.wikipedia.org/wiki/Reservoir_sampling) 随着储存器大小高达8192和随机数发生器进行采样。 结果是非确定性的。 要获得精确的分位数,请使用 [quantileExact](#quantileexact) 功能。 + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantile(level)(expr) +``` + +别名: `median`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql-reference/data-types/index.md#data_types), [日期](../../sql-reference/data-types/date.md) 或 [日期时间](../../sql-reference/data-types/datetime.md). + +**返回值** + +- 指定电平的近似分位数。 + +类型: + +- [Float64](../../sql-reference/data-types/float.md) 对于数字数据类型输入。 +- [日期](../../sql-reference/data-types/date.md) 如果输入值具有 `Date` 类型。 +- [日期时间](../../sql-reference/data-types/datetime.md) 如果输入值具有 `DateTime` 类型。 + +**示例** + +输入表: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +查询: + +``` sql +SELECT quantile(val) FROM t +``` + +结果: + +``` text +┌─quantile(val)─┐ +│ 1.5 │ +└───────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## 量化确定 {#quantiledeterministic} + +计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 + +此功能适用 [油藏采样](https://en.wikipedia.org/wiki/Reservoir_sampling) 与储层大小高达8192和采样的确定性算法。 结果是确定性的。 要获得精确的分位数,请使用 [quantileExact](#quantileexact) 功能。 + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantileDeterministic(level)(expr, determinator) +``` + +别名: `medianDeterministic`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql-reference/data-types/index.md#data_types), [日期](../../sql-reference/data-types/date.md) 或 [日期时间](../../sql-reference/data-types/datetime.md). +- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. + +**返回值** + +- 指定电平的近似分位数。 + +类型: + +- [Float64](../../sql-reference/data-types/float.md) 对于数字数据类型输入。 +- [日期](../../sql-reference/data-types/date.md) 如果输入值具有 `Date` 类型。 +- [日期时间](../../sql-reference/data-types/datetime.md) 如果输入值具有 `DateTime` 类型。 + +**示例** + +输入表: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +查询: + +``` sql +SELECT quantileDeterministic(val, 1) FROM t +``` + +结果: + +``` text +┌─quantileDeterministic(val, 1)─┐ +│ 1.5 │ +└───────────────────────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## quantileExact {#quantileexact} + +正是计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` 内存,其中 `n` 是传递的多个值。 然而,对于少量的值,该函数是非常有效的。 + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantileExact(level)(expr) +``` + +别名: `medianExact`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql-reference/data-types/index.md#data_types), [日期](../../sql-reference/data-types/date.md) 或 [日期时间](../../sql-reference/data-types/datetime.md). + +**返回值** + +- 指定电平的分位数。 + +类型: + +- [Float64](../../sql-reference/data-types/float.md) 对于数字数据类型输入。 +- [日期](../../sql-reference/data-types/date.md) 如果输入值具有 `Date` 类型。 +- [日期时间](../../sql-reference/data-types/datetime.md) 如果输入值具有 `DateTime` 类型。 + +**示例** + +查询: + +``` sql +SELECT quantileExact(number) FROM numbers(10) +``` + +结果: + +``` text +┌─quantileExact(number)─┐ +│ 5 │ +└───────────────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## 分位数加权 {#quantileexactweighted} + +正是计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 数值数据序列,考虑到每个元素的权重。 + +To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). 您可以使用此功能,而不是 `quantileExact` 并指定重量1。 + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantileExactWeighted(level)(expr, weight) +``` + +别名: `medianExactWeighted`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql-reference/data-types/index.md#data_types), [日期](../../sql-reference/data-types/date.md) 或 [日期时间](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. + +**返回值** + +- 指定电平的分位数。 + +类型: + +- [Float64](../../sql-reference/data-types/float.md) 对于数字数据类型输入。 +- [日期](../../sql-reference/data-types/date.md) 如果输入值具有 `Date` 类型。 +- [日期时间](../../sql-reference/data-types/datetime.md) 如果输入值具有 `DateTime` 类型。 + +**示例** + +输入表: + +``` text +┌─n─┬─val─┐ +│ 0 │ 3 │ +│ 1 │ 2 │ +│ 2 │ 1 │ +│ 5 │ 4 │ +└───┴─────┘ +``` + +查询: + +``` sql +SELECT quantileExactWeighted(n, val) FROM t +``` + +结果: + +``` text +┌─quantileExactWeighted(n, val)─┐ +│ 1 │ +└───────────────────────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## 分位定时 {#quantiletiming} + +随着确定的精度计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 + +结果是确定性的(它不依赖于查询处理顺序)。 该函数针对描述加载网页时间或后端响应时间等分布的序列进行了优化。 + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantileTiming(level)(expr) +``` + +别名: `medianTiming`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). + +- `expr` — [表达式](../syntax.md#syntax-expressions) 在一个列值返回 [浮动\*](../../sql-reference/data-types/float.md)-键入号码。 + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +**精度** + +计算是准确的,如果: + +- 值的总数不超过5670。 +- 总数值超过5670,但页面加载时间小于1024ms。 + +否则,计算结果将四舍五入到16毫秒的最接近倍数。 + +!!! note "注" + 对于计算页面加载时间分位数,此函数比 [分位数](#quantile). + +**返回值** + +- 指定电平的分位数。 + +类型: `Float32`. + +!!! note "注" + 如果没有值传递给函数(当使用 `quantileTimingIf`), [阿南](../../sql-reference/data-types/float.md#data_type-float-nan-inf) 被返回。 这样做的目的是将这些案例与导致零的案例区分开来。 看 [按条款订购](../statements/select.md#select-order-by) 对于排序注意事项 `NaN` 值。 + +**示例** + +输入表: + +``` text +┌─response_time─┐ +│ 72 │ +│ 112 │ +│ 126 │ +│ 145 │ +│ 104 │ +│ 242 │ +│ 313 │ +│ 168 │ +│ 108 │ +└───────────────┘ +``` + +查询: + +``` sql +SELECT quantileTiming(response_time) FROM t +``` + +结果: + +``` text +┌─quantileTiming(response_time)─┐ +│ 126 │ +└───────────────────────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## 分位时间加权 {#quantiletimingweighted} + +随着确定的精度计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 根据每个序列成员的权重对数字数据序列进行处理。 + +结果是确定性的(它不依赖于查询处理顺序)。 该函数针对描述加载网页时间或后端响应时间等分布的序列进行了优化。 + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantileTimingWeighted(level)(expr, weight) +``` + +别名: `medianTimingWeighted`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). + +- `expr` — [表达式](../syntax.md#syntax-expressions) 在一个列值返回 [浮动\*](../../sql-reference/data-types/float.md)-键入号码。 + + - If negative values are passed to the function, the behavior is undefined. + - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. + +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**精度** + +计算是准确的,如果: + +- 值的总数不超过5670。 +- 总数值超过5670,但页面加载时间小于1024ms。 + +否则,计算结果将四舍五入到16毫秒的最接近倍数。 + +!!! note "注" + 对于计算页面加载时间分位数,此函数比 [分位数](#quantile). + +**返回值** + +- 指定电平的分位数。 + +类型: `Float32`. + +!!! note "注" + 如果没有值传递给函数(当使用 `quantileTimingIf`), [阿南](../../sql-reference/data-types/float.md#data_type-float-nan-inf) 被返回。 这样做的目的是将这些案例与导致零的案例区分开来。 看 [按条款订购](../statements/select.md#select-order-by) 对于排序注意事项 `NaN` 值。 + +**示例** + +输入表: + +``` text +┌─response_time─┬─weight─┐ +│ 68 │ 1 │ +│ 104 │ 2 │ +│ 112 │ 3 │ +│ 126 │ 2 │ +│ 138 │ 1 │ +│ 162 │ 1 │ +└───────────────┴────────┘ +``` + +查询: + +``` sql +SELECT quantileTimingWeighted(response_time, weight) FROM t +``` + +结果: + +``` text +┌─quantileTimingWeighted(response_time, weight)─┐ +│ 112 │ +└───────────────────────────────────────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## quantileTDigest {#quantiletdigest} + +计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 使用的数字数据序列 [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) 算法。 + +最大误差为1%。 内存消耗 `log(n)`,哪里 `n` 是多个值。 结果取决于运行查询的顺序,并且是不确定的。 + +该功能的性能低于性能 [分位数](#quantile) 或 [分位定时](#quantiletiming). 在状态大小与精度的比率方面,这个函数比 `quantile`. + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantileTDigest(level)(expr) +``` + +别名: `medianTDigest`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql-reference/data-types/index.md#data_types), [日期](../../sql-reference/data-types/date.md) 或 [日期时间](../../sql-reference/data-types/datetime.md). + +**返回值** + +- 指定电平的近似分位数。 + +类型: + +- [Float64](../../sql-reference/data-types/float.md) 对于数字数据类型输入。 +- [日期](../../sql-reference/data-types/date.md) 如果输入值具有 `Date` 类型。 +- [日期时间](../../sql-reference/data-types/datetime.md) 如果输入值具有 `DateTime` 类型。 + +**示例** + +查询: + +``` sql +SELECT quantileTDigest(number) FROM numbers(10) +``` + +结果: + +``` text +┌─quantileTDigest(number)─┐ +│ 4.5 │ +└─────────────────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## quantileTDigestWeighted {#quantiletdigestweighted} + +计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 使用的数字数据序列 [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) 算法。 该函数考虑了每个序列成员的权重。 最大误差为1%。 内存消耗 `log(n)`,哪里 `n` 是多个值。 + +该功能的性能低于性能 [分位数](#quantile) 或 [分位定时](#quantiletiming). 在状态大小与精度的比率方面,这个函数比 `quantile`. + +结果取决于运行查询的顺序,并且是不确定的。 + +当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 + +**语法** + +``` sql +quantileTDigest(level)(expr) +``` + +别名: `medianTDigest`. + +**参数** + +- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). +- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql-reference/data-types/index.md#data_types), [日期](../../sql-reference/data-types/date.md) 或 [日期时间](../../sql-reference/data-types/datetime.md). +- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. + +**返回值** + +- 指定电平的近似分位数。 + +类型: + +- [Float64](../../sql-reference/data-types/float.md) 对于数字数据类型输入。 +- [日期](../../sql-reference/data-types/date.md) 如果输入值具有 `Date` 类型。 +- [日期时间](../../sql-reference/data-types/datetime.md) 如果输入值具有 `DateTime` 类型。 + +**示例** + +查询: + +``` sql +SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) +``` + +结果: + +``` text +┌─quantileTDigestWeighted(number, 1)─┐ +│ 4.5 │ +└────────────────────────────────────┘ +``` + +**另请参阅** + +- [中位数](#median) +- [分位数](#quantiles) + +## 中位数 {#median} + +该 `median*` 函数是相应的别名 `quantile*` 功能。 它们计算数字数据样本的中位数。 + +功能: + +- `median` — Alias for [分位数](#quantile). +- `medianDeterministic` — Alias for [量化确定](#quantiledeterministic). +- `medianExact` — Alias for [quantileExact](#quantileexact). +- `medianExactWeighted` — Alias for [分位数加权](#quantileexactweighted). +- `medianTiming` — Alias for [分位定时](#quantiletiming). +- `medianTimingWeighted` — Alias for [分位时间加权](#quantiletimingweighted). +- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). +- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). + +**示例** + +输入表: + +``` text +┌─val─┐ +│ 1 │ +│ 1 │ +│ 2 │ +│ 3 │ +└─────┘ +``` + +查询: + +``` sql +SELECT medianDeterministic(val, 1) FROM t +``` + +结果: + +``` text +┌─medianDeterministic(val, 1)─┐ +│ 1.5 │ +└─────────────────────────────┘ +``` + +## quantiles(level1, level2, …)(x) {#quantiles} + +所有分位数函数也具有相应的分位数函数: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. 这些函数在一遍中计算所列电平的所有分位数,并返回结果值的数组。 + +## varSamp(x) {#varsampx} + +计算金额 `Σ((x - x̅)^2) / (n - 1)`,哪里 `n` 是样本大小和 `x̅`是平均值 `x`. + +它表示随机变量的方差的无偏估计,如果传递的值形成其样本。 + +返回 `Float64`. 当 `n <= 1`,返回 `+∞`. + +## varPop(x) {#varpopx} + +计算金额 `Σ((x - x̅)^2) / n`,哪里 `n` 是样本大小和 `x̅`是平均值 `x`. + +换句话说,分散为一组值。 返回 `Float64`. + +## stddevSamp(x) {#stddevsampx} + +结果等于平方根 `varSamp(x)`. + +## stddevPop(x) {#stddevpopx} + +结果等于平方根 `varPop(x)`. + +## topK(N)(x) {#topknx} + +返回指定列中近似最常见值的数组。 生成的数组按值的近似频率降序排序(而不是值本身)。 + +实现了 [过滤节省空间](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) 基于reduce-and-combine算法的TopK分析算法 [并行节省空间](https://arxiv.org/pdf/1401.0702.pdf). + +``` sql +topK(N)(column) +``` + +此函数不提供保证的结果。 在某些情况下,可能会发生错误,并且可能会返回不是最常见值的常见值。 + +我们建议使用 `N < 10` 值;性能降低了大 `N` 值。 的最大值 `N = 65536`. + +**参数** + +- ‘N’ 是要返回的元素数。 + +如果省略该参数,则使用默认值10。 + +**参数** + +- ’ x ’ – The value to calculate frequency. + +**示例** + +就拿 [时间](../../getting-started/example-datasets/ontime.md) 数据集,并选择在三个最频繁出现的值 `AirlineID` 列。 + +``` sql +SELECT topK(3)(AirlineID) AS res +FROM ontime +``` + +``` text +┌─res─────────────────┐ +│ [19393,19790,19805] │ +└─────────────────────┘ +``` + +## topKWeighted {#topkweighted} + +类似于 `topK` 但需要一个整数类型的附加参数 - `weight`. 每一价值是占 `weight` 次频率计算。 + +**语法** + +``` sql +topKWeighted(N)(x, weight) +``` + +**参数** + +- `N` — The number of elements to return. + +**参数** + +- `x` – The value. +- `weight` — The weight. [UInt8](../../sql-reference/data-types/int-uint.md). + +**返回值** + +返回具有最大近似权重总和的值数组。 + +**示例** + +查询: + +``` sql +SELECT topKWeighted(10)(number, number) FROM numbers(1000) +``` + +结果: + +``` text +┌─topKWeighted(10)(number, number)──────────┐ +│ [999,998,997,996,995,994,993,992,991,990] │ +└───────────────────────────────────────────┘ +``` + +## covarSamp(x,y) {#covarsampx-y} + +计算的值 `Σ((x - x̅)(y - y̅)) / (n - 1)`. + +返回Float64。 当 `n <= 1`, returns +∞. + +## covarPop(x,y) {#covarpopx-y} + +计算的值 `Σ((x - x̅)(y - y̅)) / n`. + +## corr(x,y) {#corrx-y} + +计算Pearson相关系数: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. + +## categoricalInformationValue {#categoricalinformationvalue} + +计算的值 `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` 对于每个类别。 + +``` sql +categoricalInformationValue(category1, category2, ..., tag) +``` + +结果指示离散(分类)要素如何使用 `[category1, category2, ...]` 有助于预测的价值的学习模型 `tag`. + +## simpleLinearRegression {#simplelinearregression} + +执行简单(一维)线性回归。 + +``` sql +simpleLinearRegression(x, y) +``` + +参数: + +- `x` — Column with dependent variable values. +- `y` — Column with explanatory variable values. + +返回值: + +常量 `(a, b)` 结果行的 `y = a*x + b`. + +**例** + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ +│ (1,0) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +``` sql +SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) +``` + +``` text +┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ +│ (1,3) │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## 随机指标线上回归 {#agg_functions-stochasticlinearregression} + +该函数实现随机线性回归。 它支持自定义参数的学习率,L2正则化系数,迷你批量大小,并具有更新权重的方法很少 ([亚当](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (默认使用), [简单SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [动量](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). + +### 参数 {#agg_functions-stochasticlinearregression-parameters} + +有4个可自定义的参数。 它们按顺序传递给函数,但是没有必要传递所有四个默认值将被使用,但是好的模型需要一些参数调整。 + +``` text +stochasticLinearRegression(1.0, 1.0, 10, 'SGD') +``` + +1. `learning rate` 当执行梯度下降步骤时,步长上的系数。 过大的学习率可能会导致模型的权重无限大。 默认值为 `0.00001`. +2. `l2 regularization coefficient` 这可能有助于防止过度拟合。 默认值为 `0.1`. +3. `mini-batch size` 设置元素的数量,这些元素将被计算和求和以执行梯度下降的一个步骤。 纯随机下降使用一个元素,但是具有小批量(约10个元素)使梯度步骤更稳定。 默认值为 `15`. +4. `method for updating weights` 他们是: `Adam` (默认情况下), `SGD`, `Momentum`, `Nesterov`. `Momentum` 和 `Nesterov` 需要更多的计算和内存,但是它们恰好在收敛速度和随机梯度方法的稳定性方面是有用的。 + +### 用途 {#agg_functions-stochasticlinearregression-usage} + +`stochasticLinearRegression` 用于两个步骤:拟合模型和预测新数据。 为了拟合模型并保存其状态以供以后使用,我们使用 `-State` combinator,它基本上保存了状态(模型权重等)。 +为了预测我们使用函数 [evalMLMethod](../functions/machine-learning-functions.md#machine_learning_methods-evalmlmethod),这需要一个状态作为参数以及特征来预测。 + + + +**1.** 适合 + +可以使用这种查询。 + +``` sql +CREATE TABLE IF NOT EXISTS train_data +( + param1 Float64, + param2 Float64, + target Float64 +) ENGINE = Memory; + +CREATE TABLE your_model ENGINE = Memory AS SELECT +stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) +AS state FROM train_data; +``` + +在这里,我们还需要将数据插入到 `train_data` 桌子 参数的数量不是固定的,它只取决于参数的数量,传递到 `linearRegressionState`. 它们都必须是数值。 +请注意,带有目标值的列(我们想要学习预测)被插入作为第一个参数。 + +**2.** 预测 + +在将状态保存到表中之后,我们可以多次使用它进行预测,甚至与其他状态合并并创建新的更好的模型。 + +``` sql +WITH (SELECT state FROM your_model) AS model SELECT +evalMLMethod(model, param1, param2) FROM test_data +``` + +查询将返回一列预测值。 请注意,第一个参数 `evalMLMethod` 是 `AggregateFunctionState` 对象,接下来是要素列。 + +`test_data` 是一个像表 `train_data` 但可能不包含目标值。 + +### 注 {#agg_functions-stochasticlinearregression-notes} + +1. 要合并两个模型,用户可以创建这样的查询: + `sql SELECT state1 + state2 FROM your_models` + 哪里 `your_models` 表包含这两个模型。 此查询将返回new `AggregateFunctionState` 对象。 + +2. 如果没有,用户可以获取创建的模型的权重用于自己的目的,而不保存模型 `-State` 使用combinator。 + `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` + 这种查询将拟合模型并返回其权重-首先是权重,它对应于模型的参数,最后一个是偏差。 所以在上面的例子中,查询将返回一个具有3个值的列。 + +**另请参阅** + +- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) +- [线性回归和逻辑回归之间的区别](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} + +该函数实现随机逻辑回归。 它可以用于二进制分类问题,支持与stochasticLinearRegression相同的自定义参数,并以相同的方式工作。 + +### 参数 {#agg_functions-stochasticlogisticregression-parameters} + +参数与stochasticLinearRegression中的参数完全相同: +`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. +欲了解更多信息,请参阅 [参数](#agg_functions-stochasticlinearregression-parameters). + +``` text +stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') +``` + +1. 适合 + + + + See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. + + Predicted labels have to be in \[-1, 1\]. + +1. 预测 + + + + Using saved state we can predict probability of object having label `1`. + + ``` sql + WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) FROM test_data + ``` + + The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. + + We can also set a bound of probability, which assigns elements to different labels. + + ``` sql + SELECT ans < 1.1 AND ans > 0.5 FROM + (WITH (SELECT state FROM your_model) AS model SELECT + evalMLMethod(model, param1, param2) AS ans FROM test_data) + ``` + + Then the result will be labels. + + `test_data` is a table like `train_data` but may not contain target value. + +**另请参阅** + +- [随机指标线上回归](#agg_functions-stochasticlinearregression) +- [线性回归和逻辑回归之间的差异。](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) + +## groupBitmapAnd {#groupbitmapand} + +计算位图列的AND,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapAnd(expr) +``` + +**参数** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` 类型。 + +**返回值** + +的价值 `UInt64` 类型。 + +**示例** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapAnd(z)─┐ +│ 3 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ +│ [6,8,10] │ +└──────────────────────────────────────────────────┘ +``` + +## groupBitmapOr {#groupbitmapor} + +计算位图列的OR,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql-reference/functions/bitmap-functions.md). 这相当于 `groupBitmapMerge`. + +``` sql +groupBitmapOr(expr) +``` + +**参数** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` 类型。 + +**返回值** + +的价值 `UInt64` 类型。 + +**示例** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapOr(z)─┐ +│ 15 │ +└──────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ +│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ +└─────────────────────────────────────────────────┘ +``` + +## groupBitmapXor {#groupbitmapxor} + +计算位图列的XOR,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql-reference/functions/bitmap-functions.md). + +``` sql +groupBitmapOr(expr) +``` + +**参数** + +`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` 类型。 + +**返回值** + +的价值 `UInt64` 类型。 + +**示例** + +``` sql +DROP TABLE IF EXISTS bitmap_column_expr_test2; +CREATE TABLE bitmap_column_expr_test2 +( + tag_id String, + z AggregateFunction(groupBitmap, UInt32) +) +ENGINE = MergeTree +ORDER BY tag_id; + +INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); +INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); + +SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─groupBitmapXor(z)─┐ +│ 10 │ +└───────────────────┘ + +SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); +┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ +│ [1,3,5,6,8,10,11,13,14,15] │ +└──────────────────────────────────────────────────┘ +``` + +[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/zh/sql-reference/ansi.md b/docs/zh/sql-reference/ansi.md new file mode 120000 index 00000000000..3cf6bffed67 --- /dev/null +++ b/docs/zh/sql-reference/ansi.md @@ -0,0 +1 @@ +../../en/sql-reference/ansi.md \ No newline at end of file diff --git a/docs/zh/sql-reference/data-types/aggregatefunction.md b/docs/zh/sql-reference/data-types/aggregatefunction.md new file mode 100644 index 00000000000..a7e1ee35c16 --- /dev/null +++ b/docs/zh/sql-reference/data-types/aggregatefunction.md @@ -0,0 +1,63 @@ +# AggregateFunction(name, types\_of\_arguments…) {#data-type-aggregatefunction} + +聚合函数的中间状态,可以通过聚合函数名称加`-State`后缀的形式得到它。与此同时,当您需要访问该类型的最终状态数据时,您需要以相同的聚合函数名加`-Merge`后缀的形式来得到最终状态数据。 + +`AggregateFunction` — 参数化的数据类型。 + +**参数** + +- 聚合函数名 + + 如果函数具备多个参数列表,请在此处指定其他参数列表中的值。 + +- 聚合函数参数的类型 + +**示例** + +``` sql +CREATE TABLE t +( + column1 AggregateFunction(uniq, UInt64), + column2 AggregateFunction(anyIf, String, UInt8), + column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) +) ENGINE = ... +``` + +上述中的[uniq](../../sql-reference/data-types/aggregatefunction.md#agg_function-uniq), anyIf ([任何](../../sql-reference/data-types/aggregatefunction.md#agg_function-any)+[如果](../../sql-reference/data-types/aggregatefunction.md#agg-functions-combinator-if)) 以及 [分位数](../../sql-reference/data-types/aggregatefunction.md) 都为ClickHouse中支持的聚合函数。 + +## 使用指南 {#shi-yong-zhi-nan} + +### 数据写入 {#shu-ju-xie-ru} + +当需要写入数据时,您需要将数据包含在`INSERT SELECT`语句中,同时对于`AggregateFunction`类型的数据,您需要使用对应的以`-State`为后缀的函数进行处理。 + +**函数使用示例** + +``` sql +uniqState(UserID) +quantilesState(0.5, 0.9)(SendTiming) +``` + +不同于`uniq`和`quantiles`函数返回聚合结果的最终值,以`-State`后缀的函数总是返回`AggregateFunction`类型的数据的中间状态。 + +对于`SELECT`而言,`AggregateFunction`类型总是以特定的二进制形式展现在所有的输出格式中。例如,您可以使用`SELECT`语句将函数的状态数据转储为`TabSeparated`格式的同时使用`INSERT`语句将数据转储回去。 + +### 数据查询 {#shu-ju-cha-xun} + +当从`AggregatingMergeTree`表中查询数据时,对于`AggregateFunction`类型的字段,您需要使用以`-Merge`为后缀的相同聚合函数来聚合数据。对于非`AggregateFunction`类型的字段,请将它们包含在`GROUP BY`子句中。 + +以`-Merge`为后缀的聚合函数,可以将多个`AggregateFunction`类型的中间状态组合计算为最终的聚合结果。 + +例如,如下的两个查询返回的结果总是一致: + +``` sql +SELECT uniq(UserID) FROM table + +SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) +``` + +## 使用示例 {#shi-yong-shi-li} + +请参阅 [AggregatingMergeTree](../../sql-reference/data-types/aggregatefunction.md) 的说明 + +[来源文章](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/zh/sql-reference/data-types/array.md b/docs/zh/sql-reference/data-types/array.md new file mode 100644 index 00000000000..41eeb72c045 --- /dev/null +++ b/docs/zh/sql-reference/data-types/array.md @@ -0,0 +1,72 @@ +# 阵列(T) {#data-type-array} + +由 `T` 类型元素组成的数组。 + +`T` 可以是任意类型,包含数组类型。 但不推荐使用多维数组,ClickHouse 对多维数组的支持有限。例如,不能存储在 `MergeTree` 表中存储多维数组。 + +## 创建数组 {#chuang-jian-shu-zu} + +您可以使用array函数来创建数组: + + array(T) + +您也可以使用方括号: + + [] + +创建数组示例: + + :) SELECT array(1, 2) AS x, toTypeName(x) + + SELECT + [1, 2] AS x, + toTypeName(x) + + ┌─x─────┬─toTypeName(array(1, 2))─┐ + │ [1,2] │ Array(UInt8) │ + └───────┴─────────────────────────┘ + + 1 rows in set. Elapsed: 0.002 sec. + + :) SELECT [1, 2] AS x, toTypeName(x) + + SELECT + [1, 2] AS x, + toTypeName(x) + + ┌─x─────┬─toTypeName([1, 2])─┐ + │ [1,2] │ Array(UInt8) │ + └───────┴────────────────────┘ + + 1 rows in set. Elapsed: 0.002 sec. + +## 使用数据类型 {#shi-yong-shu-ju-lei-xing} + +ClickHouse会自动检测数组元素,并根据元素计算出存储这些元素最小的数据类型。如果在元素中存在 [NULL](../../sql-reference/data-types/array.md#null-literal) 或存在 [可为空](nullable.md#data_type-nullable) 类型元素,那么数组的元素类型将会变成 [可为空](nullable.md)。 + +如果 ClickHouse 无法确定数据类型,它将产生异常。当尝试同时创建一个包含字符串和数字的数组时会发生这种情况 (`SELECT array(1, 'a')`)。 + +自动数据类型检测示例: + + :) SELECT array(1, 2, NULL) AS x, toTypeName(x) + + SELECT + [1, 2, NULL] AS x, + toTypeName(x) + + ┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ + │ [1,2,NULL] │ Array(Nullable(UInt8)) │ + └────────────┴───────────────────────────────┘ + + 1 rows in set. Elapsed: 0.002 sec. + +如果您尝试创建不兼容的数据类型数组,ClickHouse 将引发异常: + + :) SELECT array(1, 'a') + + SELECT [1, 'a'] + + Received exception from server (version 1.1.54388): + Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. + + 0 rows in set. Elapsed: 0.246 sec. diff --git a/docs/zh/sql-reference/data-types/boolean.md b/docs/zh/sql-reference/data-types/boolean.md new file mode 100644 index 00000000000..99aacad23a9 --- /dev/null +++ b/docs/zh/sql-reference/data-types/boolean.md @@ -0,0 +1,3 @@ +# 布尔值 {#boolean-values} + +没有单独的类型来存储布尔值。可以使用 UInt8 类型,取值限制为 0 或 1。 diff --git a/docs/zh/sql-reference/data-types/date.md b/docs/zh/sql-reference/data-types/date.md new file mode 100644 index 00000000000..dd70e5d7ef1 --- /dev/null +++ b/docs/zh/sql-reference/data-types/date.md @@ -0,0 +1,5 @@ +# 日期 {#date} + +日期类型,用两个字节存储,表示从 1970-01-01 (无符号) 到当前的日期值。允许存储从 Unix 纪元开始到编译阶段定义的上限阈值常量(目前上限是2106年,但最终完全支持的年份为2105)。最小值输出为0000-00-00。 + +日期中没有存储时区信息。 diff --git a/docs/zh/sql-reference/data-types/datetime.md b/docs/zh/sql-reference/data-types/datetime.md new file mode 100644 index 00000000000..a10eaa04c00 --- /dev/null +++ b/docs/zh/sql-reference/data-types/datetime.md @@ -0,0 +1,11 @@ +# 日期时间 {#data_type-datetime} + +时间戳类型。用四个字节(无符号的)存储 Unix 时间戳)。允许存储与日期类型相同的范围内的值。最小值为 0000-00-00 00:00:00。时间戳类型值精确到秒(没有闰秒)。 + +## 时区 {#shi-qu} + +使用启动客户端或服务器时的系统时区,时间戳是从文本(分解为组件)转换为二进制并返回。在文本格式中,有关夏令时的信息会丢失。 + +默认情况下,客户端连接到服务的时候会使用服务端时区。您可以通过启用客户端命令行选项 `--use_client_time_zone` 来设置使用客户端时间。 + +因此,在处理文本日期时(例如,在保存文本转储时),请记住在夏令时更改期间可能存在歧义,如果时区发生更改,则可能存在匹配数据的问题。 diff --git a/docs/zh/sql-reference/data-types/datetime64.md b/docs/zh/sql-reference/data-types/datetime64.md new file mode 100644 index 00000000000..6dc24148393 --- /dev/null +++ b/docs/zh/sql-reference/data-types/datetime64.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 49 +toc_title: DateTime64 +--- + +# Datetime64 {#data_type-datetime64} + +允许存储时间instant间,可以表示为日历日期和一天中的时间,具有定义的亚秒精度 + +刻度尺寸(精度):10-精度 秒 + +语法: + +``` sql +DateTime64(precision, [timezone]) +``` + +在内部,存储数据作为一些 ‘ticks’ 自纪元开始(1970-01-01 00:00:00UTC)作为Int64. 刻度分辨率由precision参数确定。 此外,该 `DateTime64` 类型可以存储时区是相同的整个列,影响如何的值 `DateTime64` 类型值以文本格式显示,以及如何解析指定为字符串的值 (‘2020-01-01 05:00:01.000’). 时区不存储在表的行中(或resultset中),而是存储在列元数据中。 查看详细信息 [日期时间](datetime.md). + +## 例 {#examples} + +**1.** 创建一个表 `DateTime64`-输入列并将数据插入其中: + +``` sql +CREATE TABLE dt +( + `timestamp` DateTime64(3, 'Europe/Moscow'), + `event_id` UInt8 +) +ENGINE = TinyLog +``` + +``` sql +INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) +``` + +``` sql +SELECT * FROM dt +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 03:00:00.000 │ 1 │ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +- 将日期时间作为整数插入时,将其视为适当缩放的Unix时间戳(UTC)。 `1546300800000` (精度为3)表示 `'2019-01-01 00:00:00'` UTC. 然而,作为 `timestamp` 列有 `Europe/Moscow` (UTC+3)指定的时区,当输出为字符串时,该值将显示为 `'2019-01-01 03:00:00'` +- 当插入字符串值作为日期时间时,它被视为处于列时区。 `'2019-01-01 00:00:00'` 将被视为 `Europe/Moscow` 时区并存储为 `1546290000000`. + +**2.** 过滤 `DateTime64` 值 + +``` sql +SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') +``` + +``` text +┌───────────────timestamp─┬─event_id─┐ +│ 2019-01-01 00:00:00.000 │ 2 │ +└─────────────────────────┴──────────┘ +``` + +不像 `DateTime`, `DateTime64` 值不转换为 `String` 自动 + +**3.** 获取一个时区 `DateTime64`-类型值: + +``` sql +SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x +``` + +``` text +┌──────────────────column─┬─x──────────────────────────────┐ +│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ +└─────────────────────────┴────────────────────────────────┘ +``` + +**4.** 时区转换 + +``` sql +SELECT +toDateTime64(timestamp, 3, 'Europe/London') as lon_time, +toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time +FROM dt +``` + +``` text +┌───────────────lon_time──┬────────────────mos_time─┐ +│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ +│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ +└─────────────────────────┴─────────────────────────┘ +``` + +## 另请参阅 {#see-also} + +- [类型转换函数](../../sql-reference/functions/type-conversion-functions.md) +- [用于处理日期和时间的函数](../../sql-reference/functions/date-time-functions.md) +- [用于处理数组的函数](../../sql-reference/functions/array-functions.md) +- [该 `date_time_input_format` 设置](../../operations/settings/settings.md#settings-date_time_input_format) +- [该 `timezone` 服务器配置参数](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) +- [使用日期和时间的操作员](../../sql-reference/operators.md#operators-datetime) +- [`Date` 数据类型](date.md) +- [`DateTime` 数据类型](datetime.md) diff --git a/docs/zh/sql-reference/data-types/decimal.md b/docs/zh/sql-reference/data-types/decimal.md new file mode 100644 index 00000000000..59f23b82a77 --- /dev/null +++ b/docs/zh/sql-reference/data-types/decimal.md @@ -0,0 +1,80 @@ +# Decimal(P,S),Decimal32(S),Decimal64(S),Decimal128(S) {#decimalp-s-decimal32s-decimal64s-decimal128s} + +有符号的定点数,可在加、减和乘法运算过程中保持精度。对于除法,最低有效数字会被丢弃(不舍入)。 + +## 参数 {#can-shu} + +- P - 精度。有效范围:\[1:38\],决定可以有多少个十进制数字(包括分数)。 +- S - 规模。有效范围:\[0:P\],决定数字的小数部分中包含的小数位数。 + +对于不同的 P 参数值 Decimal 表示,以下例子都是同义的: +-P从\[1:9\]-对于Decimal32(S) +-P从\[10:18\]-对于Decimal64(小号) +-P从\[19:38\]-对于Decimal128(S) + +## 十进制值范围 {#shi-jin-zhi-zhi-fan-wei} + +- Decimal32(S) - ( -1 \* 10^(9 - S),1\*10^(9-S) ) +- Decimal64(S) - ( -1 \* 10^(18 - S),1\*10^(18-S) ) +- Decimal128(S) - ( -1 \* 10^(38 - S),1\*10^(38-S) ) + +例如,Decimal32(4) 可以表示 -99999.9999 至 99999.9999 的数值,步长为0.0001。 + +## 内部表示方式 {#nei-bu-biao-shi-fang-shi} + +数据采用与自身位宽相同的有符号整数存储。这个数在内存中实际范围会高于上述范围,从 String 转换到十进制数的时候会做对应的检查。 + +由于现代CPU不支持128位数字,因此 Decimal128 上的操作由软件模拟。所以 Decimal128 的运算速度明显慢于 Decimal32/Decimal64。 + +## 运算和结果类型 {#yun-suan-he-jie-guo-lei-xing} + +对Decimal的二进制运算导致更宽的结果类型(无论参数的顺序如何)。 + +- Decimal64(S1) Decimal32(S2)-\>Decimal64(S) +- Decimal128(S1) Decimal32(S2)-\>Decimal128(S) +- Decimal128(S1) Decimal64(S2)-\>Decimal128(S) + +精度变化的规则: + +- 加法,减法:S = max(S1, S2)。 +- 乘法:S = S1 + S2。 +- 除法:S = S1。 + +对于 Decimal 和整数之间的类似操作,结果是与参数大小相同的十进制。 + +未定义Decimal和Float32/Float64之间的函数。要执行此类操作,您可以使用:toDecimal32、toDecimal64、toDecimal128 或 toFloat32,toFloat64,需要显式地转换其中一个参数。注意,结果将失去精度,类型转换是昂贵的操作。 + +Decimal上的一些函数返回结果为Float64(例如,var或stddev)。对于其中一些,中间计算发生在Decimal中。对于此类函数,尽管结果类型相同,但Float64和Decimal中相同数据的结果可能不同。 + +## 溢出检查 {#yi-chu-jian-cha} + +在对 Decimal 类型执行操作时,数值可能会发生溢出。分数中的过多数字被丢弃(不是舍入的)。整数中的过多数字将导致异常。 + + SELECT toDecimal32(2, 4) AS x, x / 3 + + ┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ + │ 2.0000 │ 0.6666 │ + └────────┴──────────────────────────────┘ + + SELECT toDecimal32(4.2, 8) AS x, x * x + + DB::Exception: Scale is out of bounds. + + SELECT toDecimal32(4.2, 8) AS x, 6 * x + + DB::Exception: Decimal math overflow. + +检查溢出会导致计算变慢。如果已知溢出不可能,则可以通过设置`decimal_check_overflow`来禁用溢出检查,在这种情况下,溢出将导致结果不正确: + + SET decimal_check_overflow = 0; + SELECT toDecimal32(4.2, 8) AS x, 6 * x + + ┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ + │ 4.20000000 │ -17.74967296 │ + └────────────┴──────────────────────────────────┘ + +溢出检查不仅发生在算术运算上,还发生在比较运算上: + + SELECT toDecimal32(1, 8) < 100 + + DB::Exception: Can't compare. diff --git a/docs/zh/sql_reference/data_types/domains/index.md b/docs/zh/sql-reference/data-types/domains/index.md similarity index 100% rename from docs/zh/sql_reference/data_types/domains/index.md rename to docs/zh/sql-reference/data-types/domains/index.md diff --git a/docs/zh/sql-reference/data-types/domains/ipv4.md b/docs/zh/sql-reference/data-types/domains/ipv4.md new file mode 100644 index 00000000000..65c066fb487 --- /dev/null +++ b/docs/zh/sql-reference/data-types/domains/ipv4.md @@ -0,0 +1,68 @@ +## IPv4 {#ipv4} + +`IPv4`是与`UInt32`类型保持二进制兼容的Domain类型,其用于存储IPv4地址的值。它提供了更为紧凑的二进制存储的同时支持识别可读性更加友好的输入输出格式。 + +### 基本使用 {#ji-ben-shi-yong} + +``` sql +CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY url; + +DESCRIBE TABLE hits; +``` + + ┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ + │ url │ String │ │ │ │ │ + │ from │ IPv4 │ │ │ │ │ + └──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ + +同时您也可以使用`IPv4`类型的列作为主键: + +``` sql +CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY from; +``` + +在写入与查询时,`IPv4`类型能够识别可读性更加友好的输入输出格式: + +``` sql +INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '116.253.40.133')('https://clickhouse.tech', '183.247.232.58')('https://clickhouse.yandex/docs/en/', '116.106.34.242'); + +SELECT * FROM hits; +``` + + ┌─url────────────────────────────────┬───────────from─┐ + │ https://clickhouse.tech/docs/en/ │ 116.106.34.242 │ + │ https://wikipedia.org │ 116.253.40.133 │ + │ https://clickhouse.tech │ 183.247.232.58 │ + └────────────────────────────────────┴────────────────┘ + +同时它提供更为紧凑的二进制存储格式: + +``` sql +SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; +``` + + ┌─toTypeName(from)─┬─hex(from)─┐ + │ IPv4 │ B7F7E83A │ + └──────────────────┴───────────┘ + +不可隐式转换为除`UInt32`以外的其他类型类型。如果要将`IPv4`类型的值转换成字符串,你可以使用`IPv4NumToString()`显示的进行转换: + +``` sql +SELECT toTypeName(s), IPv4NumToString(from) as s FROM hits LIMIT 1; +``` + + ┌─toTypeName(IPv4NumToString(from))─┬─s──────────────┐ + │ String │ 183.247.232.58 │ + └───────────────────────────────────┴────────────────┘ + +或可以使用`CAST`将它转换为`UInt32`类型: + +``` sql +SELECT toTypeName(i), CAST(from as UInt32) as i FROM hits LIMIT 1; +``` + + ┌─toTypeName(CAST(from, 'UInt32'))─┬──────────i─┐ + │ UInt32 │ 3086477370 │ + └──────────────────────────────────┴────────────┘ + +[来源文章](https://clickhouse.tech/docs/en/data_types/domains/ipv4) diff --git a/docs/zh/sql-reference/data-types/domains/ipv6.md b/docs/zh/sql-reference/data-types/domains/ipv6.md new file mode 100644 index 00000000000..bc0f95932aa --- /dev/null +++ b/docs/zh/sql-reference/data-types/domains/ipv6.md @@ -0,0 +1,68 @@ +## IPv6 {#ipv6} + +`IPv6`是与`FixedString(16)`类型保持二进制兼容的Domain类型,其用于存储IPv6地址的值。它提供了更为紧凑的二进制存储的同时支持识别可读性更加友好的输入输出格式。 + +### 基本用法 {#ji-ben-yong-fa} + +``` sql +CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY url; + +DESCRIBE TABLE hits; +``` + + ┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ + │ url │ String │ │ │ │ │ + │ from │ IPv6 │ │ │ │ │ + └──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ + +同时您也可以使用`IPv6`类型的列作为主键: + +``` sql +CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY from; +``` + +在写入与查询时,`IPv6`类型能够识别可读性更加友好的输入输出格式: + +``` sql +INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '2a02:aa08:e000:3100::2')('https://clickhouse.tech', '2001:44c8:129:2632:33:0:252:2')('https://clickhouse.yandex/docs/en/', '2a02:e980:1e::1'); + +SELECT * FROM hits; +``` + + ┌─url────────────────────────────────┬─from──────────────────────────┐ + │ https://clickhouse.tech │ 2001:44c8:129:2632:33:0:252:2 │ + │ https://clickhouse.tech/docs/en/ │ 2a02:e980:1e::1 │ + │ https://wikipedia.org │ 2a02:aa08:e000:3100::2 │ + └────────────────────────────────────┴───────────────────────────────┘ + +同时它提供更为紧凑的二进制存储格式: + +``` sql +SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; +``` + + ┌─toTypeName(from)─┬─hex(from)────────────────────────┐ + │ IPv6 │ 200144C8012926320033000002520002 │ + └──────────────────┴──────────────────────────────────┘ + +不可隐式转换为除`FixedString(16)`以外的其他类型类型。如果要将`IPv6`类型的值转换成字符串,你可以使用`IPv6NumToString()`显示的进行转换: + +``` sql +SELECT toTypeName(s), IPv6NumToString(from) as s FROM hits LIMIT 1; +``` + + ┌─toTypeName(IPv6NumToString(from))─┬─s─────────────────────────────┐ + │ String │ 2001:44c8:129:2632:33:0:252:2 │ + └───────────────────────────────────┴───────────────────────────────┘ + +或使用`CAST`将其转换为`FixedString(16)`: + +``` sql +SELECT toTypeName(i), CAST(from as FixedString(16)) as i FROM hits LIMIT 1; +``` + + ┌─toTypeName(CAST(from, 'FixedString(16)'))─┬─i───────┐ + │ FixedString(16) │ ��� │ + └───────────────────────────────────────────┴─────────┘ + +[来源文章](https://clickhouse.tech/docs/en/data_types/domains/ipv6) diff --git a/docs/zh/sql-reference/data-types/domains/overview.md b/docs/zh/sql-reference/data-types/domains/overview.md new file mode 100644 index 00000000000..689acb9cb60 --- /dev/null +++ b/docs/zh/sql-reference/data-types/domains/overview.md @@ -0,0 +1,26 @@ +# 域 {#domains} + +Domain类型是特定实现的类型,它总是与某个现存的基础类型保持二进制兼容的同时添加一些额外的特性,以能够在维持磁盘数据不变的情况下使用这些额外的特性。目前ClickHouse暂不支持自定义domain类型。 + +如果你可以在一个地方使用与Domain类型二进制兼容的基础类型,那么在相同的地方您也可以使用Domain类型,例如: + +- 使用Domain类型作为表中列的类型 +- 对Domain类型的列进行读/写数据 +- 如果与Domain二进制兼容的基础类型可以作为索引,那么Domain类型也可以作为索引 +- 将Domain类型作为参数传递给函数使用 +- 其他 + +### Domains的额外特性 {#domainsde-e-wai-te-xing} + +- 在执行SHOW CREATE TABLE 或 DESCRIBE TABLE时,其对应的列总是展示为Domain类型的名称 +- 在INSERT INTO domain\_table(domain\_column) VALUES(…)中输入数据总是以更人性化的格式进行输入 +- 在SELECT domain\_column FROM domain\_table中数据总是以更人性化的格式输出 +- 在INSERT INTO domain\_table FORMAT CSV …中,实现外部源数据以更人性化的格式载入 + +### Domains类型的限制 {#domainslei-xing-de-xian-zhi} + +- 无法通过`ALTER TABLE`将基础类型的索引转换为Domain类型的索引。 +- 当从其他列或表插入数据时,无法将string类型的值隐式地转换为Domain类型的值。 +- 无法对存储为Domain类型的值添加约束。 + +[来源文章](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/zh/sql-reference/data-types/enum.md b/docs/zh/sql-reference/data-types/enum.md new file mode 100644 index 00000000000..a362b60a81d --- /dev/null +++ b/docs/zh/sql-reference/data-types/enum.md @@ -0,0 +1,100 @@ +# Enum8,Enum16 {#enum8-enum16} + +包括 `Enum8` 和 `Enum16` 类型。`Enum` 保存 `'string'= integer` 的对应关系。在 ClickHouse 中,尽管用户使用的是字符串常量,但所有含有 `Enum` 数据类型的操作都是按照包含整数的值来执行。这在性能方面比使用 `String` 数据类型更有效。 + +- `Enum8` 用 `'String'= Int8` 对描述。 +- `Enum16` 用 `'String'= Int16` 对描述。 + +## 用法示例 {#yong-fa-shi-li} + +创建一个带有一个枚举 `Enum8('hello' = 1, 'world' = 2)` 类型的列: + + CREATE TABLE t_enum + ( + x Enum8('hello' = 1, 'world' = 2) + ) + ENGINE = TinyLog + +这个 `x` 列只能存储类型定义中列出的值:`'hello'`或`'world'`。如果您尝试保存任何其他值,ClickHouse 抛出异常。 + + :) INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') + + INSERT INTO t_enum VALUES + + Ok. + + 3 rows in set. Elapsed: 0.002 sec. + + :) insert into t_enum values('a') + + INSERT INTO t_enum VALUES + + + Exception on client: + Code: 49. DB::Exception: Unknown element 'a' for type Enum8('hello' = 1, 'world' = 2) + +当您从表中查询数据时,ClickHouse 从 `Enum` 中输出字符串值。 + + SELECT * FROM t_enum + + ┌─x─────┐ + │ hello │ + │ world │ + │ hello │ + └───────┘ + +如果需要看到对应行的数值,则必须将 `Enum` 值转换为整数类型。 + + SELECT CAST(x, 'Int8') FROM t_enum + + ┌─CAST(x, 'Int8')─┐ + │ 1 │ + │ 2 │ + │ 1 │ + └─────────────────┘ + +在查询中创建枚举值,您还需要使用 `CAST`。 + + SELECT toTypeName(CAST('a', 'Enum8(\'a\' = 1, \'b\' = 2)')) + + ┌─toTypeName(CAST('a', 'Enum8(\'a\' = 1, \'b\' = 2)'))─┐ + │ Enum8('a' = 1, 'b' = 2) │ + └──────────────────────────────────────────────────────┘ + +## 规则及用法 {#gui-ze-ji-yong-fa} + +`Enum8` 类型的每个值范围是 `-128 ... 127`,`Enum16` 类型的每个值范围是 `-32768 ... 32767`。所有的字符串或者数字都必须是不一样的。允许存在空字符串。如果某个 Enum 类型被指定了(在表定义的时候),数字可以是任意顺序。然而,顺序并不重要。 + +`Enum` 中的字符串和数值都不能是 [NULL](../../sql-reference/data-types/enum.md)。 + +`Enum` 包含在 [可为空](nullable.md) 类型中。因此,如果您使用此查询创建一个表 + + CREATE TABLE t_enum_nullable + ( + x Nullable( Enum8('hello' = 1, 'world' = 2) ) + ) + ENGINE = TinyLog + +不仅可以存储 `'hello'` 和 `'world'` ,还可以存储 `NULL`。 + + INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) + +在内存中,`Enum` 列的存储方式与相应数值的 `Int8` 或 `Int16` 相同。 + +当以文本方式读取的时候,ClickHouse 将值解析成字符串然后去枚举值的集合中搜索对应字符串。如果没有找到,会抛出异常。当读取文本格式的时候,会根据读取到的字符串去找对应的数值。如果没有找到,会抛出异常。 + +当以文本形式写入时,ClickHouse 将值解析成字符串写入。如果列数据包含垃圾数据(不是来自有效集合的数字),则抛出异常。Enum 类型以二进制读取和写入的方式与 `Int8` 和 `Int16` 类型一样的。 + +隐式默认值是数值最小的值。 + +在 `ORDER BY`,`GROUP BY`,`IN`,`DISTINCT` 等等中,Enum 的行为与相应的数字相同。例如,按数字排序。对于等式运算符和比较运算符,Enum 的工作机制与它们在底层数值上的工作机制相同。 + +枚举值不能与数字进行比较。枚举可以与常量字符串进行比较。如果与之比较的字符串不是有效Enum值,则将引发异常。可以使用 IN 运算符来判断一个 Enum 是否存在于某个 Enum 集合中,其中集合中的 Enum 需要用字符串表示。 + +大多数具有数字和字符串的运算并不适用于Enums;例如,Enum 类型不能和一个数值相加。但是,Enum有一个原生的 `toString` 函数,它返回它的字符串值。 + +Enum 值使用 `toT` 函数可以转换成数值类型,其中 T 是一个数值类型。若 `T` 恰好对应 Enum 的底层数值类型,这个转换是零消耗的。 + +Enum 类型可以被 `ALTER` 无成本地修改对应集合的值。可以通过 `ALTER` 操作来增加或删除 Enum 的成员(只要表没有用到该值,删除都是安全的)。作为安全保障,改变之前使用过的 Enum 成员将抛出异常。 + +通过 `ALTER` 操作,可以将 `Enum8` 转成 `Enum16`,反之亦然,就像 `Int8` 转 `Int16`一样。 diff --git a/docs/zh/sql-reference/data-types/fixedstring.md b/docs/zh/sql-reference/data-types/fixedstring.md new file mode 100644 index 00000000000..9eee4ab764a --- /dev/null +++ b/docs/zh/sql-reference/data-types/fixedstring.md @@ -0,0 +1,56 @@ +# 固定字符串 {#fixedstring} + +固定长度 N 的字符串(N 必须是严格的正自然数)。 + +您可以使用下面的语法对列声明为`FixedString`类型: + +``` sql + FixedString(N) +``` + +其中`N`表示自然数。 + +当数据的长度恰好为N个字节时,`FixedString`类型是高效的。 在其他情况下,这可能会降低效率。 + +可以有效存储在`FixedString`类型的列中的值的示例: + +- 二进制表示的IP地址(IPv6使用`FixedString(16)`) +- 语言代码(ru\_RU, en\_US … ) +- 货币代码(USD, RUB … ) +- 二进制表示的哈希值(MD5使用`FixedString(16)`,SHA256使用`FixedString(32)`) + +请使用[UUID](uuid.md)数据类型来存储UUID值,。 + +当向ClickHouse中插入数据时, + +- 如果字符串包含的字节数少于\`N’,将对字符串末尾进行空字节填充。 +- 如果字符串包含的字节数大于`N`,将抛出`Too large value for FixedString(N)`异常。 + +当做数据查询时,ClickHouse不会删除字符串末尾的空字节。 如果使用`WHERE`子句,则须要手动添加空字节以匹配`FixedString`的值。 以下示例阐明了如何将`WHERE`子句与`FixedString`一起使用。 + +考虑带有`FixedString(2)`列的表: + +``` text +┌─name──┐ +│ b │ +└───────┘ +``` + +查询语句`SELECT * FROM FixedStringTable WHERE a = 'b'` 不会返回任何结果。请使用空字节来填充筛选条件。 + +``` sql +SELECT * FROM FixedStringTable +WHERE a = 'b\0' +``` + +``` text +┌─a─┐ +│ b │ +└───┘ +``` + +这种方式与MySQL的`CHAR`类型的方式不同(MySQL中使用空格填充字符串,并在输出时删除空格)。 + +请注意,`FixedString(N)`的长度是个常量。仅由空字符组成的字符串,函数[长度](../../sql-reference/data-types/fixedstring.md#array_functions-length)返回值为`N`,而函数[空](../../sql-reference/data-types/fixedstring.md#string_functions-empty)的返回值为`1`。 + +[来源文章](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/zh/sql-reference/data-types/float.md b/docs/zh/sql-reference/data-types/float.md new file mode 100644 index 00000000000..e0924eb0178 --- /dev/null +++ b/docs/zh/sql-reference/data-types/float.md @@ -0,0 +1,70 @@ +# Float32,Float64 {#float32-float64} + +[浮点数](https://en.wikipedia.org/wiki/IEEE_754)。 + +类型与以下 C 语言中类型是相同的: + +- `Float32` - `float` +- `Float64` - `double` + +我们建议您尽可能以整数形式存储数据。例如,将固定精度的数字转换为整数值,例如货币数量或页面加载时间用毫秒为单位表示 + +## 使用浮点数 {#shi-yong-fu-dian-shu} + +- 对浮点数进行计算可能引起四舍五入的误差。 + + + +``` sql +SELECT 1 - 0.9 +``` + + ┌───────minus(1, 0.9)─┐ + │ 0.09999999999999998 │ + └─────────────────────┘ + +- 计算的结果取决于计算方法(计算机系统的处理器类型和体系结构) + +- 浮点计算结果可能是诸如无穷大(`INF`)和«非数字»(`NaN`)。对浮点数计算的时候应该考虑到这点。 + +- 当一行行阅读浮点数的时候,浮点数的结果可能不是机器最近显示的数值。 + +## 南和Inf {#data_type-float-nan-inf} + +与标准SQL相比,ClickHouse 支持以下类别的浮点数: + +- `Inf` – 正无穷 + + + +``` sql +SELECT 0.5 / 0 +``` + + ┌─divide(0.5, 0)─┐ + │ inf │ + └────────────────┘ + +- `-Inf` – 负无穷 + + + +``` sql +SELECT -0.5 / 0 +``` + + ┌─divide(-0.5, 0)─┐ + │ -inf │ + └─────────────────┘ + +- `NaN` – 非数字 + + + + SELECT 0 / 0 + + ┌─divide(0, 0)─┐ + │ nan │ + └──────────────┘ + +可以在 [ORDER BY 子句](../../sql-reference/data-types/float.md) 查看更多关于 `NaN` 排序的规则。 diff --git a/docs/zh/sql-reference/data-types/index.md b/docs/zh/sql-reference/data-types/index.md new file mode 100644 index 00000000000..70aa976cb11 --- /dev/null +++ b/docs/zh/sql-reference/data-types/index.md @@ -0,0 +1,5 @@ +# 数据类型 {#data_types} + +ClickHouse 可以在数据表中存储多种数据类型。 + +本节描述 ClickHouse 支持的数据类型,以及使用或者实现它们时(如果有的话)的注意事项。 diff --git a/docs/zh/sql-reference/data-types/int-uint.md b/docs/zh/sql-reference/data-types/int-uint.md new file mode 100644 index 00000000000..3c550a83cfb --- /dev/null +++ b/docs/zh/sql-reference/data-types/int-uint.md @@ -0,0 +1,17 @@ +# UInt8,UInt16,UInt32,UInt64,Int8,Int16,Int32,Int64 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64} + +固定长度的整型,包括有符号整型或无符号整型。 + +## 整型范围 {#zheng-xing-fan-wei} + +- Int8-\[-128:127\] +- Int16-\[-32768:32767\] +- Int32-\[-2147483648:2147483647\] +- Int64-\[-9223372036854775808:9223372036854775807\] + +## 无符号整型范围 {#wu-fu-hao-zheng-xing-fan-wei} + +- UInt8-\[0:255\] +- UInt16-\[0:65535\] +- UInt32-\[0:4294967295\] +- UInt64-\[0:18446744073709551615\] diff --git a/docs/zh/sql-reference/data-types/nested-data-structures/index.md b/docs/zh/sql-reference/data-types/nested-data-structures/index.md new file mode 100644 index 00000000000..3914064674e --- /dev/null +++ b/docs/zh/sql-reference/data-types/nested-data-structures/index.md @@ -0,0 +1 @@ +# 嵌套数据结构 {#qian-tao-shu-ju-jie-gou} 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 new file mode 100644 index 00000000000..d2fd1e3a630 --- /dev/null +++ b/docs/zh/sql-reference/data-types/nested-data-structures/nested.md @@ -0,0 +1,97 @@ +# Nested(Name1 Type1, Name2 Type2, …) {#nestedname1-type1-name2-type2} + +嵌套数据结构类似于嵌套表。嵌套数据结构的参数(列名和类型)与 CREATE 查询类似。每个表可以包含任意多行嵌套数据结构。 + +示例: + +``` sql +CREATE TABLE test.visits +( + CounterID UInt32, + StartDate Date, + Sign Int8, + IsNew UInt8, + VisitID UInt64, + UserID UInt64, + ... + Goals Nested + ( + ID UInt32, + Serial UInt32, + EventTime DateTime, + Price Int64, + OrderID String, + CurrencyID UInt32 + ), + ... +) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) +``` + +上述示例声明了 `Goals` 这种嵌套数据结构,它包含访客转化相关的数据(访客达到的目标)。在 ‘visits’ 表中每一行都可以对应零个或者任意个转化数据。 + +只支持一级嵌套。嵌套结构的列中,若列的类型是数组类型,那么该列其实和多维数组是相同的,所以目前嵌套层级的支持很局限(MergeTree 引擎中不支持存储这样的列) + +大多数情况下,处理嵌套数据结构时,会指定一个单独的列。为了这样实现,列的名称会与点号连接起来。这些列构成了一组匹配类型。在同一条嵌套数据中,所有的列都具有相同的长度。 + +示例: + +``` sql +SELECT + Goals.ID, + Goals.EventTime +FROM test.visits +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ +│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ +│ [1073752] │ ['2014-03-17 00:28:25'] │ +│ [1073752] │ ['2014-03-17 10:46:20'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ +│ [] │ [] │ +│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ +│ [] │ [] │ +│ [] │ [] │ +│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ +│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ +└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +所以可以简单地把嵌套数据结构当做是所有列都是相同长度的多列数组。 + +SELECT 查询只有在使用 ARRAY JOIN 的时候才可以指定整个嵌套数据结构的名称。更多信息,参考 «ARRAY JOIN 子句»。示例: + +``` sql +SELECT + Goal.ID, + Goal.EventTime +FROM test.visits +ARRAY JOIN Goals AS Goal +WHERE CounterID = 101500 AND length(Goals.ID) < 5 +LIMIT 10 +``` + +``` text +┌─Goal.ID─┬──────Goal.EventTime─┐ +│ 1073752 │ 2014-03-17 16:38:10 │ +│ 591325 │ 2014-03-17 16:38:48 │ +│ 591325 │ 2014-03-17 16:42:27 │ +│ 1073752 │ 2014-03-17 00:28:25 │ +│ 1073752 │ 2014-03-17 10:46:20 │ +│ 1073752 │ 2014-03-17 13:59:20 │ +│ 591325 │ 2014-03-17 22:17:55 │ +│ 591325 │ 2014-03-17 22:18:07 │ +│ 591325 │ 2014-03-17 22:18:51 │ +│ 1073752 │ 2014-03-17 11:37:06 │ +└─────────┴─────────────────────┘ +``` + +不能对整个嵌套数据结构执行 SELECT。只能明确列出属于它一部分列。 + +对于 INSERT 查询,可以单独地传入所有嵌套数据结构中的列数组(假如它们是单独的列数组)。在插入过程中,系统会检查它们是否有相同的长度。 + +对于 DESCRIBE 查询,嵌套数据结构中的列会以相同的方式分别列出来。 + +ALTER 查询对嵌套数据结构的操作非常有限。 diff --git a/docs/zh/sql-reference/data-types/nullable.md b/docs/zh/sql-reference/data-types/nullable.md new file mode 100644 index 00000000000..8e8e9d3b0af --- /dev/null +++ b/docs/zh/sql-reference/data-types/nullable.md @@ -0,0 +1,41 @@ +# 可为空(类型名称) {#data_type-nullable} + +允许用特殊标记 ([NULL](../../sql-reference/data-types/nullable.md)) 表示«缺失值»,可以与 `TypeName` 的正常值存放一起。例如,`Nullable(Int8)` 类型的列可以存储 `Int8` 类型值,而没有值的行将存储 `NULL`。 + +对于 `TypeName`,不能使用复合数据类型 [阵列](array.md) 和 [元组](tuple.md)。复合数据类型可以包含 `Nullable` 类型值,例如`Array(Nullable(Int8))`。 + +`Nullable` 类型字段不能包含在表索引中。 + +除非在 ClickHouse 服务器配置中另有说明,否则 `NULL` 是任何 `Nullable` 类型的默认值。 + +## 存储特性 {#cun-chu-te-xing} + +要在表的列中存储 `Nullable` 类型值,ClickHouse 除了使用带有值的普通文件外,还使用带有 `NULL` 掩码的单独文件。 掩码文件中的条目允许 ClickHouse 区分每个表行的 `NULL` 和相应数据类型的默认值。 由于附加了新文件,`Nullable` 列与类似的普通文件相比消耗额外的存储空间。 + +!!! 注意点 "注意点" + 使用 `Nullable` 几乎总是对性能产生负面影响,在设计数据库时请记住这一点 + +掩码文件中的条目允许ClickHouse区分每个表行的对应数据类型的«NULL»和默认值由于有额外的文件,«Nullable»列比普通列消耗更多的存储空间 + +## 用法示例 {#yong-fa-shi-li} + +``` sql +CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog +``` + +``` sql +INSERT INTO t_null VALUES (1, NULL), (2, 3) +``` + +``` sql +SELECT x + y FROM t_null +``` + +``` text +┌─plus(x, y)─┐ +│ ᴺᵁᴸᴸ │ +│ 5 │ +└────────────┘ +``` + +[来源文章](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/zh/sql-reference/data-types/simpleaggregatefunction.md b/docs/zh/sql-reference/data-types/simpleaggregatefunction.md new file mode 120000 index 00000000000..76a7ef3b802 --- /dev/null +++ b/docs/zh/sql-reference/data-types/simpleaggregatefunction.md @@ -0,0 +1 @@ +../../../en/sql-reference/data-types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/zh/sql-reference/data-types/special-data-types/expression.md b/docs/zh/sql-reference/data-types/special-data-types/expression.md new file mode 100644 index 00000000000..e0618aa2aaa --- /dev/null +++ b/docs/zh/sql-reference/data-types/special-data-types/expression.md @@ -0,0 +1,3 @@ +# 表达式 {#expression} + +用于表示高阶函数中的Lambd表达式。 diff --git a/docs/zh/sql-reference/data-types/special-data-types/index.md b/docs/zh/sql-reference/data-types/special-data-types/index.md new file mode 100644 index 00000000000..1c104f51d43 --- /dev/null +++ b/docs/zh/sql-reference/data-types/special-data-types/index.md @@ -0,0 +1,3 @@ +# 特殊数据类型 {#special-data-types} + +特殊数据类型的值既不能存在表中也不能在结果中输出,但可用于查询的中间结果。 diff --git a/docs/zh/sql-reference/data-types/special-data-types/interval.md b/docs/zh/sql-reference/data-types/special-data-types/interval.md new file mode 100644 index 00000000000..b814b8d47b1 --- /dev/null +++ b/docs/zh/sql-reference/data-types/special-data-types/interval.md @@ -0,0 +1,85 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 61 +toc_title: "\u95F4\u9694" +--- + +# 间隔 {#data-type-interval} + +表示时间和日期间隔的数据类型族。 由此产生的类型 [INTERVAL](../../../sql-reference/operators.md#operator-interval) 接线员 + +!!! warning "警告" + `Interval` 数据类型值不能存储在表中。 + +结构: + +- 时间间隔作为无符号整数值。 +- 间隔的类型。 + +支持的时间间隔类型: + +- `SECOND` +- `MINUTE` +- `HOUR` +- `DAY` +- `WEEK` +- `MONTH` +- `QUARTER` +- `YEAR` + +对于每个间隔类型,都有一个单独的数据类型。 例如, `DAY` 间隔对应于 `IntervalDay` 数据类型: + +``` sql +SELECT toTypeName(INTERVAL 4 DAY) +``` + +``` text +┌─toTypeName(toIntervalDay(4))─┐ +│ IntervalDay │ +└──────────────────────────────┘ +``` + +## 使用说明 {#data-type-interval-usage-remarks} + +您可以使用 `Interval`-在算术运算类型值 [日期](../../../sql-reference/data-types/date.md) 和 [日期时间](../../../sql-reference/data-types/datetime.md)-类型值。 例如,您可以将4天添加到当前时间: + +``` sql +SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY +``` + +``` text +┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ +│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ +└─────────────────────┴───────────────────────────────┘ +``` + +不同类型的间隔不能合并。 你不能使用间隔,如 `4 DAY 1 HOUR`. 以小于或等于间隔的最小单位的单位指定间隔,例如,间隔 `1 day and an hour` 间隔可以表示为 `25 HOUR` 或 `90000 SECOND`. + +你不能执行算术运算 `Interval`-类型值,但你可以添加不同类型的时间间隔,因此值 `Date` 或 `DateTime` 数据类型。 例如: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +以下查询将导致异常: + +``` sql +select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) +``` + +``` text +Received exception from server (version 19.14.1): +Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. +``` + +## 另请参阅 {#see-also} + +- [INTERVAL](../../../sql-reference/operators.md#operator-interval) 接线员 +- [toInterval](../../../sql-reference/functions/type-conversion-functions.md#function-tointerval) 类型转换函数 diff --git a/docs/zh/sql-reference/data-types/special-data-types/nothing.md b/docs/zh/sql-reference/data-types/special-data-types/nothing.md new file mode 100644 index 00000000000..52c705522e5 --- /dev/null +++ b/docs/zh/sql-reference/data-types/special-data-types/nothing.md @@ -0,0 +1,19 @@ +# 没什么 {#nothing} + +此数据类型的唯一目的是表示不是期望值的情况。 所以不能创建一个 `Nothing` 类型的值。 + +例如,文本 [NULL](../../../sql-reference/data-types/special-data-types/nothing.md#null-literal) 的类型为 `Nullable(Nothing)`。详情请见 [可为空](../../../sql-reference/data-types/special-data-types/nothing.md)。 + +`Nothing` 类型也可以用来表示空数组: + +``` bash +:) SELECT toTypeName(array()) + +SELECT toTypeName([]) + +┌─toTypeName(array())─┐ +│ Array(Nothing) │ +└─────────────────────┘ + +1 rows in set. Elapsed: 0.062 sec. +``` diff --git a/docs/zh/sql-reference/data-types/special-data-types/set.md b/docs/zh/sql-reference/data-types/special-data-types/set.md new file mode 100644 index 00000000000..f814ab04325 --- /dev/null +++ b/docs/zh/sql-reference/data-types/special-data-types/set.md @@ -0,0 +1,3 @@ +# 设置 {#set} + +可以用在 IN 表达式的右半部分。 diff --git a/docs/zh/sql-reference/data-types/string.md b/docs/zh/sql-reference/data-types/string.md new file mode 100644 index 00000000000..ab0fbc450e7 --- /dev/null +++ b/docs/zh/sql-reference/data-types/string.md @@ -0,0 +1,10 @@ +# 字符串 {#string} + +字符串可以任意长度的。它可以包含任意的字节集,包含空字节。因此,字符串类型可以代替其他 DBMSs 中的 VARCHAR、BLOB、CLOB 等类型。 + +## 编码 {#bian-ma} + +ClickHouse 没有编码的概念。字符串可以是任意的字节集,按它们原本的方式进行存储和输出。 +若需存储文本,我们建议使用 UTF-8 编码。至少,如果你的终端使用UTF-8(推荐),这样读写就不需要进行任何的转换了。 +同样,对不同的编码文本 ClickHouse 会有不同处理字符串的函数。 +比如,`length` 函数可以计算字符串包含的字节数组的长度,然而 `lengthUTF8` 函数是假设字符串以 UTF-8 编码,计算的是字符串包含的 Unicode 字符的长度。 diff --git a/docs/zh/sql-reference/data-types/tuple.md b/docs/zh/sql-reference/data-types/tuple.md new file mode 100644 index 00000000000..14e13e61d32 --- /dev/null +++ b/docs/zh/sql-reference/data-types/tuple.md @@ -0,0 +1,45 @@ +# Tuple(T1, T2, …) {#tuplet1-t2} + +元组,其中每个元素都有单独的 [类型](index.md#data_types)。 + +不能在表中存储元组(除了内存表)。它们可以用于临时列分组。在查询中,IN 表达式和带特定参数的 lambda 函数可以来对临时列进行分组。更多信息,请参阅 [IN 操作符](../../sql-reference/data-types/tuple.md) 和 [高阶函数](../../sql-reference/data-types/tuple.md)。 + +元组可以是查询的结果。在这种情况下,对于JSON以外的文本格式,括号中的值是逗号分隔的。在JSON格式中,元组作为数组输出(在方括号中)。 + +## 创建元组 {#chuang-jian-yuan-zu} + +可以使用函数来创建元组: + + tuple(T1, T2, ...) + +创建元组的示例: + + :) SELECT tuple(1,'a') AS x, toTypeName(x) + + SELECT + (1, 'a') AS x, + toTypeName(x) + + ┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ + │ (1,'a') │ Tuple(UInt8, String) │ + └─────────┴───────────────────────────┘ + + 1 rows in set. Elapsed: 0.021 sec. + +## 元组中的数据类型 {#yuan-zu-zhong-de-shu-ju-lei-xing} + +在动态创建元组时,ClickHouse 会自动为元组的每一个参数赋予最小可表达的类型。如果参数为 [NULL](../../sql-reference/data-types/tuple.md#null-literal),那这个元组对应元素是 [可为空](nullable.md)。 + +自动数据类型检测示例: + + SELECT tuple(1, NULL) AS x, toTypeName(x) + + SELECT + (1, NULL) AS x, + toTypeName(x) + + ┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ + │ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ + └──────────┴─────────────────────────────────┘ + + 1 rows in set. Elapsed: 0.002 sec. diff --git a/docs/zh/sql-reference/data-types/uuid.md b/docs/zh/sql-reference/data-types/uuid.md new file mode 100644 index 00000000000..6728a5bb178 --- /dev/null +++ b/docs/zh/sql-reference/data-types/uuid.md @@ -0,0 +1,77 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 46 +toc_title: UUID +--- + +# UUID {#uuid-data-type} + +通用唯一标识符(UUID)是用于标识记录的16字节数。 有关UUID的详细信息,请参阅 [维基百科](https://en.wikipedia.org/wiki/Universally_unique_identifier). + +UUID类型值的示例如下所示: + +``` text +61f0c404-5cb3-11e7-907b-a6006ad3dba0 +``` + +如果在插入新记录时未指定UUID列值,则UUID值将用零填充: + +``` text +00000000-0000-0000-0000-000000000000 +``` + +## 如何生成 {#how-to-generate} + +要生成UUID值,ClickHouse提供了 [generateuidv4](../../sql-reference/functions/uuid-functions.md) 功能。 + +## 用法示例 {#usage-example} + +**示例1** + +此示例演示如何创建具有UUID类型列的表并将值插入到表中。 + +``` sql +CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog +``` + +``` sql +INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +└──────────────────────────────────────┴───────────┘ +``` + +**示例2** + +在此示例中,插入新记录时未指定UUID列值。 + +``` sql +INSERT INTO t_uuid (y) VALUES ('Example 2') +``` + +``` sql +SELECT * FROM t_uuid +``` + +``` text +┌────────────────────────────────────x─┬─y─────────┐ +│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ +│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ +└──────────────────────────────────────┴───────────┘ +``` + +## 限制 {#restrictions} + +UUID数据类型仅支持以下功能 [字符串](string.md) 数据类型也支持(例如, [min](../../sql-reference/aggregate-functions/reference.md#agg_function-min), [max](../../sql-reference/aggregate-functions/reference.md#agg_function-max),和 [计数](../../sql-reference/aggregate-functions/reference.md#agg_function-count)). + +算术运算不支持UUID数据类型(例如, [abs](../../sql-reference/functions/arithmetic-functions.md#arithm_func-abs))或聚合函数,例如 [sum](../../sql-reference/aggregate-functions/reference.md#agg_function-sum) 和 [avg](../../sql-reference/aggregate-functions/reference.md#agg_function-avg). + +[原始文章](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md new file mode 100644 index 00000000000..99c4568ed8b --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-hierarchical.md @@ -0,0 +1,70 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 45 +toc_title: "\u5206\u5C42\u5B57\u5178" +--- + +# 分层字典 {#hierarchical-dictionaries} + +ClickHouse支持分层字典与 [数字键](external-dicts-dict-structure.md#ext_dict-numeric-key). + +看看下面的层次结构: + +``` text +0 (Common parent) +│ +├── 1 (Russia) +│ │ +│ └── 2 (Moscow) +│ │ +│ └── 3 (Center) +│ +└── 4 (Great Britain) + │ + └── 5 (London) +``` + +这种层次结构可以表示为下面的字典表。 + +| region\_id | parent\_region | region\_name | +|------------|----------------|--------------| +| 1 | 0 | 俄罗斯 | +| 2 | 1 | 莫斯科 | +| 3 | 2 | 中心 | +| 4 | 0 | 英国 | +| 5 | 4 | 伦敦 | + +此表包含一列 `parent_region` 包含该元素的最近父项的键。 + +ClickHouse支持 [等级](external-dicts-dict-structure.md#hierarchical-dict-attr) 属性为 [外部字典](index.md) 属性。 此属性允许您配置类似于上述的分层字典。 + +该 [独裁主义](../../../sql-reference/functions/ext-dict-functions.md#dictgethierarchy) 函数允许您获取元素的父链。 + +对于我们的例子,dictionary的结构可以是以下内容: + +``` xml + + + + region_id + + + + parent_region + UInt64 + 0 + true + + + + region_name + String + + + + + +``` + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md new file mode 100644 index 00000000000..956d6a7393e --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md @@ -0,0 +1,373 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 41 +toc_title: "\u5728\u5185\u5B58\u4E2D\u5B58\u50A8\u5B57\u5178" +--- + +# 在内存中存储字典 {#dicts-external-dicts-dict-layout} + +有多种方法可以将字典存储在内存中。 + +我们建议 [平](#flat), [散列](#dicts-external_dicts_dict_layout-hashed) 和 [complex\_key\_hashed](#complex-key-hashed). 其提供最佳的处理速度。 + +不建议使用缓存,因为性能可能较差,并且难以选择最佳参数。 阅读更多的部分 “[缓存](#cache)”. + +有几种方法可以提高字典性能: + +- 调用该函数以使用后的字典 `GROUP BY`. +- 将要提取的属性标记为“注射”。 如果不同的属性值对应于不同的键,则称为注射属性。 所以当 `GROUP BY` 使用由键获取属性值的函数,此函数会自动取出 `GROUP BY`. + +ClickHouse为字典中的错误生成异常。 错误示例: + +- 无法加载正在访问的字典。 +- 查询错误 `cached` 字典 + +您可以查看外部字典的列表及其状态 `system.dictionaries` 桌子 + +配置如下所示: + +``` xml + + + ... + + + + + + ... + + +``` + +相应的 [DDL-查询](../../statements/create.md#create-dictionary-query): + +``` sql +CREATE DICTIONARY (...) +... +LAYOUT(LAYOUT_TYPE(param value)) -- layout settings +... +``` + +## 在内存中存储字典的方法 {#ways-to-store-dictionaries-in-memory} + +- [平](#flat) +- [散列](#dicts-external_dicts_dict_layout-hashed) +- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) +- [缓存](#cache) +- [range\_hashed](#range-hashed) +- [complex\_key\_hashed](#complex-key-hashed) +- [complex\_key\_cache](#complex-key-cache) +- [ip\_trie](#ip-trie) + +### 平 {#flat} + +字典以平面数组的形式完全存储在内存中。 字典使用多少内存? 量与最大键的大小(在使用的空间中)成正比。 + +字典键具有 `UInt64` 类型和值限制为500,000。 如果在创建字典时发现较大的键,ClickHouse将引发异常,不会创建字典。 + +支持所有类型的来源。 更新时,数据(来自文件或表)将完整读取。 + +此方法在存储字典的所有可用方法中提供了最佳性能。 + +配置示例: + +``` xml + + + +``` + +或 + +``` sql +LAYOUT(FLAT()) +``` + +### 散列 {#dicts-external_dicts_dict_layout-hashed} + +该字典以哈希表的形式完全存储在内存中。 字典中可以包含任意数量的带有任意标识符的元素,在实践中,键的数量可以达到数千万项。 + +支持所有类型的来源。 更新时,数据(来自文件或表)将完整读取。 + +配置示例: + +``` xml + + + +``` + +或 + +``` sql +LAYOUT(HASHED()) +``` + +### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} + +类似于 `hashed`,但使用更少的内存,有利于更多的CPU使用率。 + +配置示例: + +``` xml + + + +``` + +``` sql +LAYOUT(SPARSE_HASHED()) +``` + +### complex\_key\_hashed {#complex-key-hashed} + +这种类型的存储是用于复合 [键](external-dicts-dict-structure.md). 类似于 `hashed`. + +配置示例: + +``` xml + + + +``` + +``` sql +LAYOUT(COMPLEX_KEY_HASHED()) +``` + +### range\_hashed {#range-hashed} + +字典以哈希表的形式存储在内存中,其中包含有序范围及其相应值的数组。 + +此存储方法的工作方式与散列方式相同,除了键之外,还允许使用日期/时间(任意数字类型)范围。 + +示例:该表格包含每个广告客户的折扣,格式为: + +``` text ++---------|-------------|-------------|------+ +| advertiser id | discount start date | discount end date | amount | ++===============+=====================+===================+========+ +| 123 | 2015-01-01 | 2015-01-15 | 0.15 | ++---------|-------------|-------------|------+ +| 123 | 2015-01-16 | 2015-01-31 | 0.25 | ++---------|-------------|-------------|------+ +| 456 | 2015-01-01 | 2015-01-15 | 0.05 | ++---------|-------------|-------------|------+ +``` + +要对日期范围使用示例,请定义 `range_min` 和 `range_max` 中的元素 [结构](external-dicts-dict-structure.md). 这些元素必须包含元素 `name` 和`type` (如果 `type` 如果没有指定,则默认类型将使用-Date)。 `type` 可以是任何数字类型(Date/DateTime/UInt64/Int32/others)。 + +示例: + +``` xml + + + Id + + + first + Date + + + last + Date + + ... +``` + +或 + +``` sql +CREATE DICTIONARY somedict ( + id UInt64, + first Date, + last Date +) +PRIMARY KEY id +LAYOUT(RANGE_HASHED()) +RANGE(MIN first MAX last) +``` + +要使用这些字典,您需要将附加参数传递给 `dictGetT` 函数,为其选择一个范围: + +``` sql +dictGetT('dict_name', 'attr_name', id, date) +``` + +此函数返回指定的值 `id`s和包含传递日期的日期范围。 + +算法的详细信息: + +- 如果 `id` 未找到或范围未找到 `id`,它返回字典的默认值。 +- 如果存在重叠范围,则可以使用任意范围。 +- 如果范围分隔符是 `NULL` 或无效日期(如1900-01-01或2039-01-01),范围保持打开状态。 范围可以在两侧打开。 + +配置示例: + +``` xml + + + + ... + + + + + + + + Abcdef + + + StartTimeStamp + UInt64 + + + EndTimeStamp + UInt64 + + + XXXType + String + + + + + + +``` + +或 + +``` sql +CREATE DICTIONARY somedict( + Abcdef UInt64, + StartTimeStamp UInt64, + EndTimeStamp UInt64, + XXXType String DEFAULT '' +) +PRIMARY KEY Abcdef +RANGE(MIN StartTimeStamp MAX EndTimeStamp) +``` + +### 缓存 {#cache} + +字典存储在具有固定数量的单元格的缓存中。 这些单元格包含经常使用的元素。 + +搜索字典时,首先搜索缓存。 对于每个数据块,所有在缓存中找不到或过期的密钥都从源请求,使用 `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. 然后将接收到的数据写入高速缓存。 + +对于缓存字典,过期 [使用寿命](external-dicts-dict-lifetime.md) 可以设置高速缓存中的数据。 如果更多的时间比 `lifetime` 自从在单元格中加载数据以来,单元格的值不被使用,并且在下次需要使用时重新请求它。 +这是存储字典的所有方法中最不有效的。 缓存的速度在很大程度上取决于正确的设置和使用场景。 缓存类型字典只有在命中率足够高(推荐99%或更高)时才能表现良好。 您可以查看平均命中率 `system.dictionaries` 桌子 + +要提高缓存性能,请使用以下子查询 `LIMIT`,并从外部调用字典函数。 + +支持 [来源](external-dicts-dict-sources.md):MySQL的,ClickHouse的,可执行文件,HTTP. + +设置示例: + +``` xml + + + + 1000000000 + + +``` + +或 + +``` sql +LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) +``` + +设置足够大的缓存大小。 你需要尝试选择细胞的数量: + +1. 设置一些值。 +2. 运行查询,直到缓存完全满。 +3. 使用评估内存消耗 `system.dictionaries` 桌子 +4. 增加或减少单元数,直到达到所需的内存消耗。 + +!!! warning "警告" + 不要使用ClickHouse作为源,因为处理随机读取的查询速度很慢。 + +### complex\_key\_cache {#complex-key-cache} + +这种类型的存储是用于复合 [键](external-dicts-dict-structure.md). 类似于 `cache`. + +### ip\_trie {#ip-trie} + +这种类型的存储用于将网络前缀(IP地址)映射到ASN等元数据。 + +示例:该表包含网络前缀及其对应的AS号码和国家代码: + +``` text + +-----------|-----|------+ + | prefix | asn | cca2 | + +=================+=======+========+ + | 202.79.32.0/20 | 17501 | NP | + +-----------|-----|------+ + | 2620:0:870::/48 | 3856 | US | + +-----------|-----|------+ + | 2a02:6b8:1::/48 | 13238 | RU | + +-----------|-----|------+ + | 2001:db8::/32 | 65536 | ZZ | + +-----------|-----|------+ +``` + +使用此类布局时,结构必须具有复合键。 + +示例: + +``` xml + + + + prefix + String + + + + asn + UInt32 + + + + cca2 + String + ?? + + ... +``` + +或 + +``` sql +CREATE DICTIONARY somedict ( + prefix String, + asn UInt32, + cca2 String DEFAULT '??' +) +PRIMARY KEY prefix +``` + +该键必须只有一个包含允许的IP前缀的字符串类型属性。 还不支持其他类型。 + +对于查询,必须使用相同的函数 (`dictGetT` 与元组)至于具有复合键的字典: + +``` sql +dictGetT('dict_name', 'attr_name', tuple(ip)) +``` + +该函数采用任一 `UInt32` 对于IPv4,或 `FixedString(16)` 碌莽禄Ipv6拢IPv6: + +``` sql +dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) +``` + +还不支持其他类型。 该函数返回与此IP地址对应的前缀的属性。 如果有重叠的前缀,则返回最具体的前缀。 + +数据存储在一个 `trie`. 它必须完全适合RAM。 + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md new file mode 100644 index 00000000000..1637d513b98 --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 42 +toc_title: "\u5B57\u5178\u66F4\u65B0" +--- + +# 字典更新 {#dictionary-updates} + +ClickHouse定期更新字典。 完全下载字典的更新间隔和缓存字典的无效间隔在 `` 在几秒钟内标记。 + +字典更新(除首次使用的加载之外)不会阻止查询。 在更新期间,将使用旧版本的字典。 如果在更新过程中发生错误,则将错误写入服务器日志,并使用旧版本的字典继续查询。 + +设置示例: + +``` xml + + ... + 300 + ... + +``` + +``` sql +CREATE DICTIONARY (...) +... +LIFETIME(300) +... +``` + +设置 `0` (`LIFETIME(0)`)防止字典更新。 + +您可以设置升级的时间间隔,ClickHouse将在此范围内选择一个统一的随机时间。 为了在大量服务器上升级时分配字典源上的负载,这是必要的。 + +设置示例: + +``` xml + + ... + + 300 + 360 + + ... + +``` + +或 + +``` sql +LIFETIME(MIN 300 MAX 360) +``` + +升级字典时,ClickHouse服务器根据字典的类型应用不同的逻辑 [来源](external-dicts-dict-sources.md): + +- 对于文本文件,它检查修改的时间。 如果时间与先前记录的时间不同,则更新字典。 +- 对于MyISAM表,修改的时间使用检查 `SHOW TABLE STATUS` 查询。 +- 默认情况下,每次都会更新来自其他来源的字典。 + +对于MySQL(InnoDB),ODBC和ClickHouse源代码,您可以设置一个查询,只有在字典真正改变时才会更新字典,而不是每次都更新。 为此,请按照下列步骤操作: + +- 字典表必须具有在源数据更新时始终更改的字段。 +- 源的设置必须指定检索更改字段的查询。 ClickHouse服务器将查询结果解释为一行,如果此行相对于其以前的状态发生了更改,则更新字典。 指定查询 `` 字段中的设置 [来源](external-dicts-dict-sources.md). + +设置示例: + +``` xml + + ... + + ... + SELECT update_time FROM dictionary_source where id = 1 + + ... + +``` + +或 + +``` sql +... +SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) +... +``` + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md new file mode 100644 index 00000000000..47fd4d5fe42 --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md @@ -0,0 +1,608 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 43 +toc_title: "\u5916\u90E8\u5B57\u5178\u7684\u6765\u6E90" +--- + +# 外部字典的来源 {#dicts-external-dicts-dict-sources} + +外部字典可以从许多不同的来源连接。 + +如果使用xml-file配置字典,则配置如下所示: + +``` xml + + + ... + + + + + + ... + + ... + +``` + +在情况下 [DDL-查询](../../statements/create.md#create-dictionary-query),相等的配置将看起来像: + +``` sql +CREATE DICTIONARY dict_name (...) +... +SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration +... +``` + +源配置在 `source` 科。 + +来源类型 (`source_type`): + +- [本地文件](#dicts-external_dicts_dict_sources-local_file) +- [可执行文件](#dicts-external_dicts_dict_sources-executable) +- [HTTP(s)](#dicts-external_dicts_dict_sources-http) +- DBMS + - [ODBC](#dicts-external_dicts_dict_sources-odbc) + - [MySQL](#dicts-external_dicts_dict_sources-mysql) + - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) + - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) + - [Redis](#dicts-external_dicts_dict_sources-redis) + +## 本地文件 {#dicts-external_dicts_dict_sources-local_file} + +设置示例: + +``` xml + + + /opt/dictionaries/os.tsv + TabSeparated + + +``` + +或 + +``` sql +SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +设置字段: + +- `path` – The absolute path to the file. +- `format` – The file format. All the formats described in “[格式](../../../interfaces/formats.md#formats)” 支持。 + +## 可执行文件 {#dicts-external_dicts_dict_sources-executable} + +使用可执行文件取决于 [字典如何存储在内存中](external-dicts-dict-layout.md). 如果字典存储使用 `cache` 和 `complex_key_cache`,ClickHouse通过向可执行文件的STDIN发送请求来请求必要的密钥。 否则,ClickHouse将启动可执行文件并将其输出视为字典数据。 + +设置示例: + +``` xml + + + cat /opt/dictionaries/os.tsv + TabSeparated + + +``` + +或 + +``` sql +SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) +``` + +设置字段: + +- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). +- `format` – The file format. All the formats described in “[格式](../../../interfaces/formats.md#formats)” 支持。 + +## Http(s) {#dicts-external_dicts_dict_sources-http} + +使用HTTP(s)服务器取决于 [字典如何存储在内存中](external-dicts-dict-layout.md). 如果字典存储使用 `cache` 和 `complex_key_cache`,ClickHouse通过通过发送请求请求必要的密钥 `POST` 方法。 + +设置示例: + +``` xml + + + http://[::1]/os.tsv + TabSeparated + + user + password + + +
+ API-KEY + key +
+
+
+ +``` + +或 + +``` sql +SOURCE(HTTP( + url 'http://[::1]/os.tsv' + format 'TabSeparated' + credentials(user 'user' password 'password') + headers(header(name 'API-KEY' value 'key')) +)) +``` + +为了让ClickHouse访问HTTPS资源,您必须 [配置openSSL](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-openssl) 在服务器配置中。 + +设置字段: + +- `url` – The source URL. +- `format` – The file format. All the formats described in “[格式](../../../interfaces/formats.md#formats)” 支持。 +- `credentials` – Basic HTTP authentication. Optional parameter. + - `user` – Username required for the authentication. + - `password` – Password required for the authentication. +- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. + - `header` – Single HTTP header entry. + - `name` – Identifiant name used for the header send on the request. + - `value` – Value set for a specific identifiant name. + +## ODBC {#dicts-external_dicts_dict_sources-odbc} + +您可以使用此方法连接具有ODBC驱动程序的任何数据库。 + +设置示例: + +``` xml + + + DatabaseName + ShemaName.TableName
+ DSN=some_parameters + SQL_QUERY +
+ +``` + +或 + +``` sql +SOURCE(ODBC( + db 'DatabaseName' + table 'SchemaName.TableName' + connection_string 'DSN=some_parameters' + invalidate_query 'SQL_QUERY' +)) +``` + +设置字段: + +- `db` – Name of the database. Omit it if the database name is set in the `` 参数。 +- `table` – Name of the table and schema if exists. +- `connection_string` – Connection string. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [更新字典](external-dicts-dict-lifetime.md). + +ClickHouse接收来自ODBC-driver的引用符号,并将查询中的所有设置引用到driver,因此有必要根据数据库中的表名大小写设置表名。 + +如果您在使用Oracle时遇到编码问题,请参阅相应的 [FAQ](../../../faq/general.md#oracle-odbc-encodings) 文章. + +### ODBC字典功能的已知漏洞 {#known-vulnerability-of-the-odbc-dictionary-functionality} + +!!! attention "注意" + 通过ODBC驱动程序连接参数连接到数据库时 `Servername` 可以取代。 在这种情况下,值 `USERNAME` 和 `PASSWORD` 从 `odbc.ini` 被发送到远程服务器,并且可能会受到损害。 + +**不安全使用示例** + +让我们为PostgreSQL配置unixODBC。 的内容 `/etc/odbc.ini`: + +``` text +[gregtest] +Driver = /usr/lib/psqlodbca.so +Servername = localhost +PORT = 5432 +DATABASE = test_db +#OPTION = 3 +USERNAME = test +PASSWORD = test +``` + +如果然后进行查询,例如 + +``` sql +SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); +``` + +ODBC驱动程序将发送的值 `USERNAME` 和 `PASSWORD` 从 `odbc.ini` 到 `some-server.com`. + +### 连接Postgresql的示例 {#example-of-connecting-postgresql} + +Ubuntu操作系统。 + +为PostgreSQL安装unixODBC和ODBC驱动程序: + +``` bash +$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql +``` + +配置 `/etc/odbc.ini` (或 `~/.odbc.ini`): + +``` text + [DEFAULT] + Driver = myconnection + + [myconnection] + Description = PostgreSQL connection to my_db + Driver = PostgreSQL Unicode + Database = my_db + Servername = 127.0.0.1 + UserName = username + Password = password + Port = 5432 + Protocol = 9.3 + ReadOnly = No + RowVersioning = No + ShowSystemTables = No + ConnSettings = +``` + +ClickHouse中的字典配置: + +``` xml + + + table_name + + + + + DSN=myconnection + postgresql_table
+
+ + + 300 + 360 + + + + + + + id + + + some_column + UInt64 + 0 + + +
+
+``` + +或 + +``` sql +CREATE DICTIONARY table_name ( + id UInt64, + some_column UInt64 DEFAULT 0 +) +PRIMARY KEY id +SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) +LAYOUT(HASHED()) +LIFETIME(MIN 300 MAX 360) +``` + +您可能需要编辑 `odbc.ini` 使用驱动程序指定库的完整路径 `DRIVER=/usr/local/lib/psqlodbcw.so`. + +### 连接MS SQL Server的示例 {#example-of-connecting-ms-sql-server} + +Ubuntu操作系统。 + +安装驱动程序: : + +``` bash +$ sudo apt-get install tdsodbc freetds-bin sqsh +``` + +配置驱动程序: + +``` bash + $ cat /etc/freetds/freetds.conf + ... + + [MSSQL] + host = 192.168.56.101 + port = 1433 + tds version = 7.0 + client charset = UTF-8 + + $ cat /etc/odbcinst.ini + ... + + [FreeTDS] + Description = FreeTDS + Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so + Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so + FileUsage = 1 + UsageCount = 5 + + $ cat ~/.odbc.ini + ... + + [MSSQL] + Description = FreeTDS + Driver = FreeTDS + Servername = MSSQL + Database = test + UID = test + PWD = test + Port = 1433 +``` + +在ClickHouse中配置字典: + +``` xml + + + test + + + dict
+ DSN=MSSQL;UID=test;PWD=test +
+ + + + 300 + 360 + + + + + + + + + k + + + s + String + + + +
+
+``` + +或 + +``` sql +CREATE DICTIONARY test ( + k UInt64, + s String DEFAULT '' +) +PRIMARY KEY k +SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) +LAYOUT(FLAT()) +LIFETIME(MIN 300 MAX 360) +``` + +## DBMS {#dbms} + +### Mysql {#dicts-external_dicts_dict_sources-mysql} + +设置示例: + +``` xml + + + 3306 + clickhouse + qwerty + + example01-1 + 1 + + + example01-2 + 1 + + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +或 + +``` sql +SOURCE(MYSQL( + port 3306 + user 'clickhouse' + password 'qwerty' + replica(host 'example01-1' priority 1) + replica(host 'example01-2' priority 1) + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +设置字段: + +- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). + +- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). + +- `replica` – Section of replica configurations. There can be multiple sections. + + - `replica/host` – The MySQL host. + - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. + +- `db` – Name of the database. + +- `table` – Name of the table. + +- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` 例如,mysql中的子句, `id > 10 AND id < 20`. 可选参数。 + +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [更新字典](external-dicts-dict-lifetime.md). + +MySQL可以通过套接字在本地主机上连接。 要做到这一点,设置 `host` 和 `socket`. + +设置示例: + +``` xml + + + localhost + /path/to/socket/file.sock + clickhouse + qwerty + db_name + table_name
+ id=10 + SQL_QUERY +
+ +``` + +或 + +``` sql +SOURCE(MYSQL( + host 'localhost' + socket '/path/to/socket/file.sock' + user 'clickhouse' + password 'qwerty' + db 'db_name' + table 'table_name' + where 'id=10' + invalidate_query 'SQL_QUERY' +)) +``` + +### ClickHouse {#dicts-external_dicts_dict_sources-clickhouse} + +设置示例: + +``` xml + + + example01-01-1 + 9000 + default + + default + ids
+ id=10 +
+ +``` + +或 + +``` sql +SOURCE(CLICKHOUSE( + host 'example01-01-1' + port 9000 + user 'default' + password '' + db 'default' + table 'ids' + where 'id=10' +)) +``` + +设置字段: + +- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [分布](../../../engines/table-engines/special/distributed.md) 表并在后续配置中输入它。 +- `port` – The port on the ClickHouse server. +- `user` – Name of the ClickHouse user. +- `password` – Password of the ClickHouse user. +- `db` – Name of the database. +- `table` – Name of the table. +- `where` – The selection criteria. May be omitted. +- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [更新字典](external-dicts-dict-lifetime.md). + +### Mongodb {#dicts-external_dicts_dict_sources-mongodb} + +设置示例: + +``` xml + + + localhost + 27017 + + + test + dictionary_source + + +``` + +或 + +``` sql +SOURCE(MONGO( + host 'localhost' + port 27017 + user '' + password '' + db 'test' + collection 'dictionary_source' +)) +``` + +设置字段: + +- `host` – The MongoDB host. +- `port` – The port on the MongoDB server. +- `user` – Name of the MongoDB user. +- `password` – Password of the MongoDB user. +- `db` – Name of the database. +- `collection` – Name of the collection. + +### Redis {#dicts-external_dicts_dict_sources-redis} + +设置示例: + +``` xml + + + localhost + 6379 + simple + 0 + + +``` + +或 + +``` sql +SOURCE(REDIS( + host 'localhost' + port 6379 + storage_type 'simple' + db_index 0 +)) +``` + +设置字段: + +- `host` – The Redis host. +- `port` – The port on the Redis server. +- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` 适用于简单源和散列单键源, `hash_map` 用于具有两个键的散列源。 不支持具有复杂键的范围源和缓存源。 可以省略,默认值为 `simple`. +- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md new file mode 100644 index 00000000000..48ae34fb92b --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md @@ -0,0 +1,175 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 44 +toc_title: "\u5B57\u5178\u952E\u548C\u5B57\u6BB5" +--- + +# 字典键和字段 {#dictionary-key-and-fields} + +该 `` 子句描述可用于查询的字典键和字段。 + +XML描述: + +``` xml + + + + Id + + + + + + + ... + + + +``` + +属性在元素中描述: + +- `` — [键列](external-dicts-dict-structure.md#ext_dict_structure-key). +- `` — [数据列](external-dicts-dict-structure.md#ext_dict_structure-attributes). 可以有多个属性。 + +DDL查询: + +``` sql +CREATE DICTIONARY dict_name ( + Id UInt64, + -- attributes +) +PRIMARY KEY Id +... +``` + +查询正文中描述了属性: + +- `PRIMARY KEY` — [键列](external-dicts-dict-structure.md#ext_dict_structure-key) +- `AttrName AttrType` — [数据列](external-dicts-dict-structure.md#ext_dict_structure-attributes). 可以有多个属性。 + +## 键 {#ext_dict_structure-key} + +ClickHouse支持以下类型的键: + +- 数字键。 `UInt64`. 在定义 `` 标记或使用 `PRIMARY KEY` 关键字。 +- 复合密钥。 组不同类型的值。 在标签中定义 `` 或 `PRIMARY KEY` 关键字。 + +Xml结构可以包含 `` 或 ``. DDL-查询必须包含单个 `PRIMARY KEY`. + +!!! warning "警告" + 不能将键描述为属性。 + +### 数字键 {#ext_dict-numeric-key} + +类型: `UInt64`. + +配置示例: + +``` xml + + Id + +``` + +配置字段: + +- `name` – The name of the column with keys. + +对于DDL-查询: + +``` sql +CREATE DICTIONARY ( + Id UInt64, + ... +) +PRIMARY KEY Id +... +``` + +- `PRIMARY KEY` – The name of the column with keys. + +### 复合密钥 {#composite-key} + +关键可以是一个 `tuple` 从任何类型的字段。 该 [布局](external-dicts-dict-layout.md) 在这种情况下,必须是 `complex_key_hashed` 或 `complex_key_cache`. + +!!! tip "提示" + 复合键可以由单个元素组成。 例如,这使得可以使用字符串作为键。 + +键结构在元素中设置 ``. 键字段的格式与字典的格式相同 [属性](external-dicts-dict-structure.md). 示例: + +``` xml + + + + field1 + String + + + field2 + UInt32 + + ... + +... +``` + +或 + +``` sql +CREATE DICTIONARY ( + field1 String, + field2 String + ... +) +PRIMARY KEY field1, field2 +... +``` + +对于查询 `dictGet*` 函数中,一个元组作为键传递。 示例: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. + +## 属性 {#ext_dict_structure-attributes} + +配置示例: + +``` xml + + ... + + Name + ClickHouseDataType + + rand64() + true + true + true + + +``` + +或 + +``` sql +CREATE DICTIONARY somename ( + Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID +) +``` + +配置字段: + +| 标签 | 产品描述 | 必填项 | +|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------| +| `name` | 列名称。 | 是 | +| `type` | ClickHouse数据类型。
ClickHouse尝试将字典中的值转换为指定的数据类型。 例如,对于MySQL,该字段可能是 `TEXT`, `VARCHAR`,或 `BLOB` 在MySQL源表中,但它可以上传为 `String` 在克里克豪斯
[可为空](../../../sql-reference/data-types/nullable.md) 不支持。 | 是 | +| `null_value` | 非现有元素的默认值。
在示例中,它是一个空字符串。 你不能使用 `NULL` 在这个领域。 | 是 | +| `expression` | [表达式](../../syntax.md#syntax-expressions) ClickHouse对该值执行。
表达式可以是远程SQL数据库中的列名。 因此,您可以使用它为远程列创建别名。

默认值:无表达式。 | 非也。 | +| `hierarchical` | 如果 `true`,该属性包含当前键的父键值。 看 [分层字典](external-dicts-dict-hierarchical.md).

默认值: `false`. | 非也。 | +| `injective` | 标志,显示是否 `id -> attribute` 图像是 [注射](https://en.wikipedia.org/wiki/Injective_function).
如果 `true`,ClickHouse可以自动放置后 `GROUP BY` 子句注入字典的请求。 通常它显着减少了这种请求的数量。

默认值: `false`. | 非也。 | +| `is_object_id` | 显示是否通过以下方式对MongoDB文档执行查询的标志 `ObjectID`.

默认值: `false`. | 非也。 | + +## 另请参阅 {#see-also} + +- [使用外部字典的函数](../../../sql-reference/functions/ext-dict-functions.md). + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md new file mode 100644 index 00000000000..8cc599adce3 --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts-dict.md @@ -0,0 +1,53 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 40 +toc_title: "\u914D\u7F6E\u5916\u90E8\u5B57\u5178" +--- + +# 配置外部字典 {#dicts-external-dicts-dict} + +如果使用xml文件配置字典,则比字典配置具有以下结构: + +``` xml + + dict_name + + + + + + + + + + + + + + + + + +``` + +相应的 [DDL-查询](../../statements/create.md#create-dictionary-query) 具有以下结构: + +``` sql +CREATE DICTIONARY dict_name +( + ... -- attributes +) +PRIMARY KEY ... -- complex or single key configuration +SOURCE(...) -- Source configuration +LAYOUT(...) -- Memory layout configuration +LIFETIME(...) -- Lifetime of dictionary in memory +``` + +- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. +- [来源](external-dicts-dict-sources.md) — Source of the dictionary. +- [布局](external-dicts-dict-layout.md) — Dictionary layout in memory. +- [结构](external-dicts-dict-structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. +- [使用寿命](external-dicts-dict-lifetime.md) — Frequency of dictionary updates. + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts.md new file mode 100644 index 00000000000..1fd50cf458a --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/external-dictionaries/external-dicts.md @@ -0,0 +1,56 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 39 +toc_title: "\u6982\u8FF0" +--- + +# 外部字典 {#dicts-external-dicts} + +您可以从各种数据源添加自己的字典。 字典的数据源可以是本地文本或可执行文件、HTTP(s)资源或其他DBMS。 有关详细信息,请参阅 “[外部字典的来源](external-dicts-dict-sources.md)”. + +ClickHouse: + +- 完全或部分存储在RAM中的字典。 +- 定期更新字典并动态加载缺失的值。 换句话说,字典可以动态加载。 +- 允许创建外部字典与xml文件或 [DDL查询](../../statements/create.md#create-dictionary-query). + +外部字典的配置可以位于一个或多个xml文件中。 配置的路径在指定 [dictionaries\_config](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_config) 参数。 + +字典可以在服务器启动或首次使用时加载,具体取决于 [dictionaries\_lazy\_load](../../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) 设置。 + +字典配置文件具有以下格式: + +``` xml + + An optional element with any content. Ignored by the ClickHouse server. + + + /etc/metrika.xml + + + + + + + + +``` + +你可以 [配置](external-dicts-dict.md) 同一文件中的任意数量的字典。 + +[字典的DDL查询](../../statements/create.md#create-dictionary-query) 在服务器配置中不需要任何其他记录。 它们允许使用字典作为一流的实体,如表或视图。 + +!!! attention "注意" + 您可以通过在一个小字典中描述它来转换小字典的值 `SELECT` 查询(见 [变换](../../../sql-reference/functions/other-functions.md) 功能)。 此功能与外部字典无关。 + +## 另请参阅 {#ext-dicts-see-also} + +- [配置外部字典](external-dicts-dict.md) +- [在内存中存储字典](external-dicts-dict-layout.md) +- [字典更新](external-dicts-dict-lifetime.md) +- [外部字典的来源](external-dicts-dict-sources.md) +- [字典键和字段](external-dicts-dict-structure.md) +- [使用外部字典的函数](../../../sql-reference/functions/ext-dict-functions.md) + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/index.md b/docs/zh/sql-reference/dictionaries/external-dictionaries/index.md similarity index 100% rename from docs/zh/sql_reference/dictionaries/external_dictionaries/index.md rename to docs/zh/sql-reference/dictionaries/external-dictionaries/index.md diff --git a/docs/zh/sql-reference/dictionaries/index.md b/docs/zh/sql-reference/dictionaries/index.md new file mode 100644 index 00000000000..ecdf691e90c --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/index.md @@ -0,0 +1,22 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_folder_title: "\u5B57\u5178" +toc_priority: 35 +toc_title: "\u5BFC\u8A00" +--- + +# 字典 {#dictionaries} + +字典是一个映射 (`key -> attributes`)这是方便各种类型的参考清单。 + +ClickHouse支持使用可用于查询的字典的特殊功能。 这是更容易和更有效地使用字典与功能比 `JOIN` 与参考表。 + +[NULL](../syntax.md#null) 值不能存储在字典中。 + +ClickHouse支持: + +- [内置字典](internal-dicts.md#internal_dicts) 具有特定的 [功能集](../../sql-reference/functions/ym-dict-functions.md). +- [插件(外部)字典](external-dictionaries/external-dicts.md) 用一个 [职能净额](../../sql-reference/functions/ext-dict-functions.md). + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/zh/sql-reference/dictionaries/internal-dicts.md b/docs/zh/sql-reference/dictionaries/internal-dicts.md new file mode 100644 index 00000000000..b5161e31611 --- /dev/null +++ b/docs/zh/sql-reference/dictionaries/internal-dicts.md @@ -0,0 +1,55 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 39 +toc_title: "\u5185\u90E8\u5B57\u5178" +--- + +# 内部字典 {#internal_dicts} + +ClickHouse包含用于处理地理数据库的内置功能。 + +这使您可以: + +- 使用区域的ID以所需语言获取其名称。 +- 使用区域ID获取城市、地区、联邦区、国家或大陆的ID。 +- 检查一个区域是否属于另一个区域。 +- 获取父区域链。 + +所有功能支持 “translocality,” 能够同时使用不同的角度对区域所有权。 有关详细信息,请参阅部分 “Functions for working with Yandex.Metrica dictionaries”. + +在默认包中禁用内部字典。 +要启用它们,请取消注释参数 `path_to_regions_hierarchy_file` 和 `path_to_regions_names_files` 在服务器配置文件中。 + +Geobase从文本文件加载。 + +将 `regions_hierarchy*.txt` 文件到 `path_to_regions_hierarchy_file` 目录。 此配置参数必须包含指向 `regions_hierarchy.txt` 文件(默认区域层次结构)和其他文件 (`regions_hierarchy_ua.txt`)必须位于同一目录中。 + +把 `regions_names_*.txt` 在文件 `path_to_regions_names_files` 目录。 + +您也可以自己创建这些文件。 文件格式如下: + +`regions_hierarchy*.txt`:TabSeparated(无标题),列: + +- 地区ID (`UInt32`) +- 父区域ID (`UInt32`) +- 区域类型 (`UInt8`):1-大陆,3-国家,4-联邦区,5-地区,6-城市;其他类型没有价值 +- 人口 (`UInt32`) — optional column + +`regions_names_*.txt`:TabSeparated(无标题),列: + +- 地区ID (`UInt32`) +- 地区名称 (`String`) — Can’t contain tabs or line feeds, even escaped ones. + +平面阵列用于存储在RAM中。 出于这个原因,Id不应该超过一百万。 + +字典可以在不重新启动服务器的情况下更新。 但是,不会更新可用字典集。 +对于更新,将检查文件修改时间。 如果文件已更改,则更新字典。 +检查更改的时间间隔在 `builtin_dictionaries_reload_interval` 参数。 +字典更新(首次使用时加载除外)不会阻止查询。 在更新期间,查询使用旧版本的字典。 如果在更新过程中发生错误,则将错误写入服务器日志,并使用旧版本的字典继续查询。 + +我们建议定期使用geobase更新字典。 在更新期间,生成新文件并将其写入单独的位置。 一切准备就绪后,将其重命名为服务器使用的文件。 + +还有与操作系统标识符和Yandex的工作功能。Metrica搜索引擎,但他们不应该被使用。 + +[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/zh/sql-reference/functions/arithmetic-functions.md b/docs/zh/sql-reference/functions/arithmetic-functions.md new file mode 100644 index 00000000000..1c2ed3fccfc --- /dev/null +++ b/docs/zh/sql-reference/functions/arithmetic-functions.md @@ -0,0 +1,76 @@ +# 算术函数 {#suan-zhu-han-shu} + +对于所有算术函数,结果类型为结果适合的最小数字类型(如果存在这样的类型)。最小数字类型是根据数字的位数,是否有符号以及是否是浮点类型而同时进行的。如果没有足够的位,则采用最高位类型。 + +例如: + +``` sql +SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) +``` + + ┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ + │ UInt8 │ UInt16 │ UInt32 │ UInt64 │ + └───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ + +算术函数适用于UInt8,UInt16,UInt32,UInt64,Int8,Int16,Int32,Int64,Float32或Float64中的任何类型。 + +溢出的产生方式与C++相同。 + +## 加(a,b),a+b {#plusa-b-a-b} + +计算数字的总和。 +您还可以将Date或DateTime与整数进行相加。在Date的情况下,添加的整数意味着添加相应的天数。对于DateTime,这意味这添加相应的描述。 + +## 减(a,b),a-b {#minusa-b-a-b} + +计算数字之间的差,结果总是有符号的。 + +您还可以将Date或DateTime与整数进行相减。见上面的’plus’。 + +## 乘(a,b),a\*b {#multiplya-b-a-b} + +计算数字的乘积。 + +## 除以(a,b),a/b {#dividea-b-a-b} + +计算数字的商。结果类型始终是浮点类型。 +它不是整数除法。对于整数除法,请使用’intDiv’函数。 +当除以零时,你得到’inf’,‘- inf’或’nan’。 + +## intDiv(a,b) {#intdiva-b} + +计算整数数字的商,向下舍入(按绝对值)。 +除以零或将最小负数除以-1时抛出异常。 + +## intDivOrZero(a,b) {#intdivorzeroa-b} + +与’intDiv’的不同之处在于它在除以零或将最小负数除以-1时返回零。 + +## 模(a,b),a%b {#moduloa-b-a-b} + +计算除法后的余数。 +如果参数是浮点数,则通过删除小数部分将它们预转换为整数。 +其余部分与C++中的含义相同。截断除法用于负数。 +除以零或将最小负数除以-1时抛出异常。 + +## 否定(a),-a {#negatea-a} + +计算一个数字的 +用反转符号计算一个数字。结果始终是签名的。 +计算具有反向符号的数字。 结果始终签名。 + +## abs(a) {#arithm_func-abs} + +计算数字(a)的绝对值。也就是说,如果a &lt; 0,它返回-a。对于无符号类型,它不执行任何操作。对于有符号整数类型,它返回无符号数。 + +## gcd(a,b) {#gcda-b} + +返回数字的最大公约数。 +除以零或将最小负数除以-1时抛出异常。 + +## lcm(a,b) {#lcma-b} + +返回数字的最小公倍数。 +除以零或将最小负数除以-1时抛出异常。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/zh/sql-reference/functions/array-functions.md b/docs/zh/sql-reference/functions/array-functions.md new file mode 100644 index 00000000000..546b916b942 --- /dev/null +++ b/docs/zh/sql-reference/functions/array-functions.md @@ -0,0 +1,665 @@ +# 数组函数 {#shu-zu-han-shu} + +## 空 {#empty} + +对于空数组返回1,对于非空数组返回0。 +结果类型是UInt8。 +该函数也适用于字符串。 + +## notEmpty {#notempty} + +对于空数组返回0,对于非空数组返回1。 +结果类型是UInt8。 +该函数也适用于字符串。 + +## 长度 {#array_functions-length} + +返回数组中的元素个数。 +结果类型是UInt64。 +该函数也适用于字符串。 + +## emptyArrayUInt8,emptyArrayUInt16,emptyArrayUInt32,emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} + +## emptyArrayInt8,emptyArrayInt16,emptyArrayInt32,emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} + +## emptyArrayFloat32,emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} + +## 空空漫步,空空漫步时间 {#emptyarraydate-emptyarraydatetime} + +## 空字符串 {#emptyarraystring} + +不接受任何参数并返回适当类型的空数组。 + +## emptyArrayToSingle {#emptyarraytosingle} + +接受一个空数组并返回一个仅包含一个默认值元素的数组。 + +## 范围(N) {#rangen} + +返回从0到N-1的数字数组。 +以防万一,如果在数据块中创建总长度超过100,000,000个元素的数组,则抛出异常。 + +## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} + +使用函数的参数作为数组元素创建一个数组。 +参数必须是常量,并且具有最小公共类型的类型。必须至少传递一个参数,否则将不清楚要创建哪种类型的数组。也就是说,你不能使用这个函数来创建一个空数组(为此,使用上面描述的’emptyArray  \*’函数)。 +返回’Array(T)’类型的结果,其中’T’是传递的参数中最小的公共类型。 + +## arrayConcat {#arrayconcat} + +合并参数中传递的所有数组。 + + arrayConcat(arrays) + +**参数** + +- `arrays` – 任意数量的[阵列](../../sql-reference/functions/array-functions.md)类型的参数. + **示例** + + + +``` sql +SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res +``` + + ┌─res───────────┐ + │ [1,2,3,4,5,6] │ + └───────────────┘ + +## arrayElement(arr,n),运算符arr\[n\] {#arrayelementarr-n-operator-arrn} + +从数组`arr`中获取索引为«n»的元素。 `n`必须是任何整数类型。 +数组中的索引从一开始。 +支持负索引。在这种情况下,它选择从末尾开始编号的相应元素。例如,`arr [-1]`是数组中的最后一项。 + +如果索引超出数组的边界,则返回默认值(数字为0,字符串为空字符串等)。 + +## 有(arr,elem) {#hasarr-elem} + +检查’arr’数组是否具有’elem’元素。 +如果元素不在数组中,则返回0;如果在,则返回1。 + +`NULL` 值的处理。 + + SELECT has([1, 2, NULL], NULL) + + ┌─has([1, 2, NULL], NULL)─┐ + │ 1 │ + └─────────────────────────┘ + +## hasAll {#hasall} + +检查一个数组是否是另一个数组的子集。 + + hasAll(set, subset) + +**参数** + +- `set` – 具有一组元素的任何类型的数组。 +- `subset` – 任何类型的数组,其元素应该被测试为`set`的子集。 + +**返回值** + +- `1`, 如果`set`包含`subset`中的所有元素。 +- `0`, 否则。 + +**特殊的定义** + +- 空数组是任何数组的子集。 +- «Null»作为数组中的元素值进行处理。 +- 忽略两个数组中的元素值的顺序。 + +**示例** + +`SELECT hasAll([], [])` 返回1。 + +`SELECT hasAll([1, Null], [Null])` 返回1。 + +`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` 返回1。 + +`SELECT hasAll(['a', 'b'], ['a'])` 返回1。 + +`SELECT hasAll([1], ['a'])` 返回0。 + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` 返回0。 + +## hasAny {#hasany} + +检查两个数组是否存在交集。 + + hasAny(array1, array2) + +**参数** + +- `array1` – 具有一组元素的任何类型的数组。 +- `array2` – 具有一组元素的任何类型的数组。 + +**返回值** + +- `1`, 如果`array1`和`array2`存在交集。 +- `0`, 否则。 + +**特殊的定义** + +- «Null»作为数组中的元素值进行处理。 +- 忽略两个数组中的元素值的顺序。 + +**示例** + +`SELECT hasAny([1], [])` 返回 `0`. + +`SELECT hasAny([Null], [Null, 1])` 返回 `1`. + +`SELECT hasAny([-128, 1., 512], [1])` 返回 `1`. + +`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` 返回 `0`. + +`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` 返回 `1`. + +## indexOf(arr,x) {#indexofarr-x} + +返回数组中第一个’x’元素的索引(从1开始),如果’x’元素不存在在数组中,则返回0。 + +示例: + + :) SELECT indexOf([1,3,NULL,NULL],NULL) + + SELECT indexOf([1, 3, NULL, NULL], NULL) + + ┌─indexOf([1, 3, NULL, NULL], NULL)─┐ + │ 3 │ + └───────────────────────────────────┘ + +设置为«NULL»的元素将作为普通的元素值处理。 + +## countEqual(arr,x) {#countequalarr-x} + +返回数组中等于x的元素的个数。相当于arrayCount(elem - \> elem = x,arr)。 + +`NULL`值将作为单独的元素值处理。 + +示例: + + SELECT countEqual([1, 2, NULL, NULL], NULL) + + ┌─countEqual([1, 2, NULL, NULL], NULL)─┐ + │ 2 │ + └──────────────────────────────────────┘ + +## ツ暗ェツ氾环催ツ団ツ法ツ人) {#array_functions-arrayenumerate} + +返回 Array \[1, 2, 3, …, length (arr) \] + +此功能通常与ARRAY JOIN一起使用。它允许在应用ARRAY JOIN后为每个数组计算一次。例如: + +``` sql +SELECT + count() AS Reaches, + countIf(num = 1) AS Hits +FROM test.hits +ARRAY JOIN + GoalsReached, + arrayEnumerate(GoalsReached) AS num +WHERE CounterID = 160656 +LIMIT 10 +``` + + ┌─Reaches─┬──Hits─┐ + │ 95606 │ 31406 │ + └─────────┴───────┘ + +在此示例中,Reaches是转换次数(应用ARRAY JOIN后接收的字符串),Hits是浏览量(ARRAY JOIN之前的字符串)。在这种特殊情况下,您可以更轻松地获得相同的结果: + +``` sql +SELECT + sum(length(GoalsReached)) AS Reaches, + count() AS Hits +FROM test.hits +WHERE (CounterID = 160656) AND notEmpty(GoalsReached) +``` + + ┌─Reaches─┬──Hits─┐ + │ 95606 │ 31406 │ + └─────────┴───────┘ + +此功能也可用于高阶函数。例如,您可以使用它来获取与条件匹配的元素的数组索引。 + +## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} + +返回与源数组大小相同的数组,其中每个元素表示与其下标对应的源数组元素在源数组中出现的次数。 +例如:arrayEnumerateUniq( \[10,20,10,30 \])=  \[1,1,2,1 \]。 + +使用ARRAY JOIN和数组元素的聚合时,此函数很有用。 + +示例: + +``` sql +SELECT + Goals.ID AS GoalID, + sum(Sign) AS Reaches, + sumIf(Sign, num = 1) AS Visits +FROM test.visits +ARRAY JOIN + Goals, + arrayEnumerateUniq(Goals.ID) AS num +WHERE CounterID = 160656 +GROUP BY GoalID +ORDER BY Reaches DESC +LIMIT 10 +``` + + ┌──GoalID─┬─Reaches─┬─Visits─┐ + │ 53225 │ 3214 │ 1097 │ + │ 2825062 │ 3188 │ 1097 │ + │ 56600 │ 2803 │ 488 │ + │ 1989037 │ 2401 │ 365 │ + │ 2830064 │ 2396 │ 910 │ + │ 1113562 │ 2372 │ 373 │ + │ 3270895 │ 2262 │ 812 │ + │ 1084657 │ 2262 │ 345 │ + │ 56599 │ 2260 │ 799 │ + │ 3271094 │ 2256 │ 812 │ + └─────────┴─────────┴────────┘ + +在此示例中,每个GoalID都计算转换次数(目标嵌套数据结构中的每个元素都是达到的目标,我们称之为转换)和会话数。如果没有ARRAY JOIN,我们会将会话数计为总和(Sign)。但在这种特殊情况下,行乘以嵌套的Goals结构,因此为了在此之后计算每个会话一次,我们将一个条件应用于arrayEnumerateUniq(Goals.ID)函数的值。 + +arrayEnumerateUniq函数可以使用与参数大小相同的多个数组。在这种情况下,对于所有阵列中相同位置的元素元组,考虑唯一性。 + +``` sql +SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res +``` + + ┌─res───────────┐ + │ [1,2,1,1,2,1] │ + └───────────────┘ + +当使用带有嵌套数据结构的ARRAY JOIN并在此结构中跨多个元素进一步聚合时,这是必需的。 + +## arrayPopBack {#arraypopback} + +从数组中删除最后一项。 + + arrayPopBack(array) + +**参数** + +- `array` – 数组。 + +**示例** + +``` sql +SELECT arrayPopBack([1, 2, 3]) AS res +``` + + ┌─res───┐ + │ [1,2] │ + └───────┘ + +## arrayPopFront {#arraypopfront} + +从数组中删除第一项。 + + arrayPopFront(array) + +**参数** + +- `array` – 数组。 + +**示例** + +``` sql +SELECT arrayPopFront([1, 2, 3]) AS res +``` + + ┌─res───┐ + │ [2,3] │ + └───────┘ + +## arrayPushBack {#arraypushback} + +添加一个元素到数组的末尾。 + + arrayPushBack(array, single_value) + +**参数** + +- `array` – 数组。 +- `single_value` – 单个值。只能将数字添加到带数字的数组中,并且只能将字符串添加到字符串数组中。添加数字时,ClickHouse会自动为数组的数据类型设置`single_value`类型。有关ClickHouse中数据类型的更多信息,请参阅«[数据类型](../../sql-reference/functions/array-functions.md#data_types)»。可以是’NULL`。该函数向数组添加一个«NULL»元素,数组元素的类型转换为`Nullable\`。 + +**示例** + +``` sql +SELECT arrayPushBack(['a'], 'b') AS res +``` + + ┌─res───────┐ + │ ['a','b'] │ + └───────────┘ + +## arrayPushFront {#arraypushfront} + +将一个元素添加到数组的开头。 + + arrayPushFront(array, single_value) + +**参数** + +- `array` – 数组。 +- `single_value` – 单个值。只能将数字添加到带数字的数组中,并且只能将字符串添加到字符串数组中。添加数字时,ClickHouse会自动为数组的数据类型设置`single_value`类型。有关ClickHouse中数据类型的更多信息,请参阅«[数据类型](../../sql-reference/functions/array-functions.md#data_types)»。可以是’NULL`。该函数向数组添加一个«NULL»元素,数组元素的类型转换为`Nullable\`。 + +**示例** + +``` sql +SELECT arrayPushFront(['b'], 'a') AS res +``` + + ┌─res───────┐ + │ ['a','b'] │ + └───────────┘ + +## arrayResize {#arrayresize} + +更改数组的长度。 + + arrayResize(array, size[, extender]) + +**参数:** + +- `array` — 数组. +- `size` — 数组所需的长度。 + - 如果`size`小于数组的原始大小,则数组将从右侧截断。 +- 如果`size`大于数组的初始大小,则使用`extender`值或数组项的数据类型的默认值将数组扩展到右侧。 +- `extender` — 扩展数组的值。可以是’NULL\`。 + +**返回值:** + +一个`size`长度的数组。 + +**调用示例** + + SELECT arrayResize([1], 3) + + ┌─arrayResize([1], 3)─┐ + │ [1,0,0] │ + └─────────────────────┘ + + SELECT arrayResize([1], 3, NULL) + + ┌─arrayResize([1], 3, NULL)─┐ + │ [1,NULL,NULL] │ + └───────────────────────────┘ + +## arraySlice {#arrayslice} + +返回一个子数组,包含从指定位置的指定长度的元素。 + + arraySlice(array, offset[, length]) + +**参数** + +- `array` – 数组。 +- `offset` – 数组的偏移。正值表示左侧的偏移量,负值表示右侧的缩进值。数组下标从1开始。 +- `length` - 子数组的长度。如果指定负值,则该函数返回`[offset,array_length - length`。如果省略该值,则该函数返回`[offset,the_end_of_array]`。 + +**示例** + +``` sql +SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res +``` + + ┌─res────────┐ + │ [2,NULL,4] │ + └────────────┘ + +设置为«NULL»的数组元素作为普通的数组元素值处理。 + +## arraySort(\[func,\] arr, …) {#array_functions-reverse-sort} + +以升序对`arr`数组的元素进行排序。如果指定了`func`函数,则排序顺序由`func`函数的调用结果决定。如果`func`接受多个参数,那么`arraySort`函数也将解析与`func`函数参数相同数量的数组参数。更详细的示例在`arraySort`的末尾。 + +整数排序示例: + +``` sql +SELECT arraySort([1, 3, 3, 0]); +``` + + ┌─arraySort([1, 3, 3, 0])─┐ + │ [0,1,3,3] │ + └─────────────────────────┘ + +字符串排序示例: + +``` sql +SELECT arraySort(['hello', 'world', '!']); +``` + + ┌─arraySort(['hello', 'world', '!'])─┐ + │ ['!','hello','world'] │ + └────────────────────────────────────┘ + +`NULL`,`NaN`和`Inf`的排序顺序: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); +``` + + ┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ + │ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ + └───────────────────────────────────────────────────────────┘ + +- `-Inf` 是数组中的第一个。 +- `NULL` 是数组中的最后一个。 +- `NaN` 在`NULL`的前面。 +- `Inf` 在`NaN`的前面。 + +注意:`arraySort`是[高阶函数](higher-order-functions.md)。您可以将lambda函数作为第一个参数传递给它。在这种情况下,排序顺序由lambda函数的调用结果决定。 + +让我们来看一下如下示例: + +``` sql +SELECT arraySort((x) -> -x, [1, 2, 3]) as res; +``` + + ┌─res─────┐ + │ [3,2,1] │ + └─────────┘ + +对于源数组的每个元素,lambda函数返回排序键,即\[1 -\> -1, 2 -\> -2, 3 -\> -3\]。由于`arraySort`函数按升序对键进行排序,因此结果为\[3,2,1\]。因此,`(x) -> -x` lambda函数将排序设置为[降序](#array_functions-reverse-sort)。 + +lambda函数可以接受多个参数。在这种情况下,您需要为`arraySort`传递与lambda参数个数相同的数组。函数使用第一个输入的数组中的元素组成返回结果;使用接下来传入的数组作为排序键。例如: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + + ┌─res────────────────┐ + │ ['world', 'hello'] │ + └────────────────────┘ + +这里,在第二个数组(\[2, 1\])中定义了第一个数组(\[‘hello’,‘world’\])的相应元素的排序键,即\[‘hello’ -\> 2,‘world’ -\> 1\]。 由于lambda函数中没有使用`x`,因此源数组中的实际值不会影响结果的顺序。所以,’world’将是结果中的第一个元素,’hello’将是结果中的第二个元素。 + +其他示例如下所示。 + +``` sql +SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; +``` + +``` sql +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +``` sql +SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; +``` + +``` sql +┌─res─────┐ +│ [2,1,0] │ +└─────────┘ +``` + +!!! 注意 "注意" + 为了提高排序效率, 使用了[施瓦茨变换](https://en.wikipedia.org/wiki/Schwartzian_transform)。 + +## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} + +以降序对`arr`数组的元素进行排序。如果指定了`func`函数,则排序顺序由`func`函数的调用结果决定。如果`func`接受多个参数,那么`arrayReverseSort`函数也将解析与`func`函数参数相同数量的数组作为参数。更详细的示例在`arrayReverseSort`的末尾。 + +整数排序示例: + +``` sql +SELECT arrayReverseSort([1, 3, 3, 0]); +``` + + ┌─arrayReverseSort([1, 3, 3, 0])─┐ + │ [3,3,1,0] │ + └────────────────────────────────┘ + +字符串排序示例: + +``` sql +SELECT arrayReverseSort(['hello', 'world', '!']); +``` + + ┌─arrayReverseSort(['hello', 'world', '!'])─┐ + │ ['world','hello','!'] │ + └───────────────────────────────────────────┘ + +`NULL`,`NaN`和`Inf`的排序顺序: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; +``` + +``` sql +┌─res───────────────────────────────────┐ +│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ +└───────────────────────────────────────┘ +``` + +- `Inf` 是数组中的第一个。 +- `NULL` 是数组中的最后一个。 +- `NaN` 在`NULL`的前面。 +- `-Inf` 在`NaN`的前面。 + +注意:`arraySort`是[高阶函数](higher-order-functions.md)。您可以将lambda函数作为第一个参数传递给它。如下示例所示。 + +``` sql +SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; +``` + + ┌─res─────┐ + │ [1,2,3] │ + └─────────┘ + +数组按以下方式排序: +数组按以下方式排序: + +1. 首先,根据lambda函数的调用结果对源数组(\[1, 2, 3\])进行排序。 结果是\[3, 2, 1\]。 +2. 反转上一步获得的数组。 所以,最终的结果是\[1, 2, 3\]。 + +lambda函数可以接受多个参数。在这种情况下,您需要为`arrayReverseSort`传递与lambda参数个数相同的数组。函数使用第一个输入的数组中的元素组成返回结果;使用接下来传入的数组作为排序键。例如: + +``` sql +SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; +``` + +``` sql +┌─res───────────────┐ +│ ['hello','world'] │ +└───────────────────┘ +``` + +在这个例子中,数组按以下方式排序: + +1. 首先,根据lambda函数的调用结果对源数组(\[‘hello’,‘world’\])进行排序。 其中,在第二个数组(\[2,1\])中定义了源数组中相应元素的排序键。 所以,排序结果\[‘world’,‘hello’\]。 +2. 反转上一步骤中获得的排序数组。 所以,最终的结果是\[‘hello’,‘world’\]。 + +其他示例如下所示。 + +``` sql +SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; +``` + +``` sql +┌─res─────┐ +│ [5,3,4] │ +└─────────┘ +``` + +``` sql +SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; +``` + +``` sql +┌─res─────┐ +│ [4,3,5] │ +└─────────┘ +``` + +## arrayUniq(arr, …) {#arrayuniqarr} + +如果传递一个参数,则计算数组中不同元素的数量。 +如果传递了多个参数,则它计算多个数组中相应位置的不同元素元组的数量。 + +如果要获取数组中唯一项的列表,可以使用arrayReduce(‘groupUniqArray’,arr)。 + +## arryjoin(arr) {#array-functions-join} + +一个特殊的功能。请参见[«ArrayJoin函数»](array-join.md#functions_arrayjoin)部分。 + +## arrayDifference(arr) {#arraydifferencearr} + +返回一个数组,其中包含所有相邻元素对之间的差值。例如: + +``` sql +SELECT arrayDifference([1, 2, 3, 4]) +``` + + ┌─arrayDifference([1, 2, 3, 4])─┐ + │ [0,1,1,1] │ + └───────────────────────────────┘ + +## arrayDistinct(arr) {#arraydistinctarr} + +返回一个包含所有数组中不同元素的数组。例如: + +``` sql +SELECT arrayDistinct([1, 2, 2, 3, 1]) +``` + + ┌─arrayDistinct([1, 2, 2, 3, 1])─┐ + │ [1,2,3] │ + └────────────────────────────────┘ + +## arrayEnumerateDense(arr) {#arrayenumeratedensearr} + +返回与源数组大小相同的数组,指示每个元素首次出现在源数组中的位置。例如:arrayEnumerateDense(\[10,20,10,30\])= \[1,2,1,3\]。 + +## arrayIntersect(arr) {#arrayintersectarr} + +返回所有数组元素的交集。例如: + +``` sql +SELECT + arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, + arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect +``` + + ┌─no_intersect─┬─intersect─┐ + │ [] │ [1] │ + └──────────────┴───────────┘ + +## arrayReduce(agg\_func, arr1, …) {#arrayreduceagg-func-arr1} + +将聚合函数应用于数组并返回其结果。如果聚合函数具有多个参数,则此函数可应用于相同大小的多个数组。 + +arrayReduce(‘agg\_func’,arr1,…) - 将聚合函数`agg_func`应用于数组`arr1 ...`。如果传递了多个数组,则相应位置上的元素将作为多个参数传递给聚合函数。例如:SELECT arrayReduce(‘max’,\[1,2,3\])= 3 + +## ツ暗ェツ氾环催ツ団ツ法ツ人) {#arrayreversearr} + +返回与源数组大小相同的数组,包含反转源数组的所有元素的结果。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/zh/sql-reference/functions/array-join.md b/docs/zh/sql-reference/functions/array-join.md new file mode 100644 index 00000000000..b7a4855efa5 --- /dev/null +++ b/docs/zh/sql-reference/functions/array-join.md @@ -0,0 +1,28 @@ +# arrayJoin函数 {#functions_arrayjoin} + +这是一个非常有用的函数。 + +普通函数不会更改结果集的行数,而只是计算每行中的值(map)。 +聚合函数将多行压缩到一行中(fold或reduce)。 +’arrayJoin’函数获取每一行并将他们展开到多行(unfold)。 + +此函数将数组作为参数,并将该行在结果集中复制数组元素个数。 +除了应用此函数的列中的值之外,简单地复制列中的所有值;它被替换为相应的数组值。 + +查询可以使用多个`arrayJoin`函数。在这种情况下,转换被执行多次。 + +请注意SELECT查询中的ARRAY JOIN语法,它提供了更广泛的可能性。 + +示例: + +``` sql +SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src +``` + + ┌─dst─┬─\'Hello\'─┬─src─────┐ + │ 1 │ Hello │ [1,2,3] │ + │ 2 │ Hello │ [1,2,3] │ + │ 3 │ Hello │ [1,2,3] │ + └─────┴───────────┴─────────┘ + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/array_join/) diff --git a/docs/zh/sql-reference/functions/bit-functions.md b/docs/zh/sql-reference/functions/bit-functions.md new file mode 100644 index 00000000000..08a6739c206 --- /dev/null +++ b/docs/zh/sql-reference/functions/bit-functions.md @@ -0,0 +1,29 @@ +# 位操作函数 {#wei-cao-zuo-han-shu} + +位操作函数适用于UInt8,UInt16,UInt32,UInt64,Int8,Int16,Int32,Int64,Float32或Float64中的任何类型。 + +结果类型是一个整数,其位数等于其参数的最大位。如果至少有一个参数为有符数字,则结果为有符数字。如果参数是浮点数,则将其强制转换为Int64。 + +## bitAnd(a,b) {#bitanda-b} + +## bitOr(a,b) {#bitora-b} + +## bitXor(a,b) {#bitxora-b} + +## bitNot(a) {#bitnota} + +## bitShiftLeft(a,b) {#bitshiftlefta-b} + +## bitShiftRight(a,b) {#bitshiftrighta-b} + +## bitRotateLeft(a,b) {#bitrotatelefta-b} + +## bitRotateRight(a,b) {#bitrotaterighta-b} + +## bitTest(a,b) {#bittesta-b} + +## bitTestAll(a,b) {#bittestalla-b} + +## bitTestAny(a,b) {#bittestanya-b} + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/zh/sql-reference/functions/bitmap-functions.md b/docs/zh/sql-reference/functions/bitmap-functions.md new file mode 100644 index 00000000000..239cd8b7d2d --- /dev/null +++ b/docs/zh/sql-reference/functions/bitmap-functions.md @@ -0,0 +1,384 @@ +# 位图函数 {#wei-tu-han-shu} + +位图函数用于对两个位图对象进行计算,对于任何一个位图函数,它都将返回一个位图对象,例如and,or,xor,not等等。 + +位图对象有两种构造方法。一个是由聚合函数groupBitmapState构造的,另一个是由Array Object构造的。同时还可以将位图对象转化为数组对象。 + +我们使用RoaringBitmap实际存储位图对象,当基数小于或等于32时,它使用Set保存。当基数大于32时,它使用RoaringBitmap保存。这也是为什么低基数集的存储更快的原因。 + +有关RoaringBitmap的更多信息,请参阅:[呻吟声](https://github.com/RoaringBitmap/CRoaring)。 + +## bitmapBuild {#bitmapbuild} + +从无符号整数数组构建位图对象。 + + bitmapBuild(array) + +**参数** + +- `array` – 无符号整数数组. + +**示例** + +``` sql +SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res +``` + +## bitmapToArray {#bitmaptoarray} + +将位图转换为整数数组。 + + bitmapToArray(bitmap) + +**参数** + +- `bitmap` – 位图对象. + +**示例** + +``` sql +SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─────────┐ + │ [1,2,3,4,5] │ + └─────────────┘ + +## bitmapSubsetInRange {#bitmapsubsetinrange} + +将位图指定范围(不包含range\_end)转换为另一个位图。 + + bitmapSubsetInRange(bitmap, range_start, range_end) + +**参数** + +- `bitmap` – 位图对象. +- `range_start` – 范围起始点(含). +- `range_end` – 范围结束点(不含). + +**示例** + +``` sql +SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + + ┌─res───────────────┐ + │ [30,31,32,33,100] │ + └───────────────────┘ + +## bitmapSubsetLimit {#bitmapsubsetlimit} + +将位图指定范围(起始点和数目上限)转换为另一个位图。 + + bitmapSubsetLimit(bitmap, range_start, limit) + +**参数** + +- `bitmap` – 位图对象. +- `range_start` – 范围起始点(含). +- `limit` – 子位图基数上限. + +**示例** + +``` sql +SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res +``` + + ┌─res───────────────────────┐ + │ [30,31,32,33,100,200,500] │ + └───────────────────────────┘ + +## bitmapContains {#bitmapcontains} + +检查位图是否包含指定元素。 + + bitmapContains(haystack, needle) + +**参数** + +- `haystack` – 位图对象. +- `needle` – 元素,类型UInt32. + +**示例** + +``` sql +SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## bitmapHasAny {#bitmaphasany} + +与`hasAny(array,array)`类似,如果位图有任何公共元素则返回1,否则返回0。 +对于空位图,返回0。 + + bitmapHasAny(bitmap,bitmap) + +**参数** + +- `bitmap` – bitmap对象。 + +**示例** + +``` sql +SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## bitmapHasAll {#bitmaphasall} + +与`hasAll(array,array)`类似,如果第一个位图包含第二个位图的所有元素,则返回1,否则返回0。 +如果第二个参数是空位图,则返回1。 + + bitmapHasAll(bitmap,bitmap) + +**参数** + +- `bitmap` – bitmap 对象。 + +**示例** + +``` sql +SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res +``` + + ┌─res─┐ + │ 0 │ + └─────┘ + +## 位图和 {#bitmapand} + +为两个位图对象进行与操作,返回一个新的位图对象。 + + bitmapAnd(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + + ┌─res─┐ + │ [3] │ + └─────┘ + +## 位图 {#bitmapor} + +为两个位图对象进行或操作,返回一个新的位图对象。 + + bitmapOr(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + + ┌─res─────────┐ + │ [1,2,3,4,5] │ + └─────────────┘ + +## bitmapXor {#bitmapxor} + +为两个位图对象进行异或操作,返回一个新的位图对象。 + + bitmapXor(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + + ┌─res───────┐ + │ [1,2,4,5] │ + └───────────┘ + +## bitmapAndnot {#bitmapandnot} + +计算两个位图的差异,返回一个新的位图对象。 + + bitmapAndnot(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res +``` + + ┌─res───┐ + │ [1,2] │ + └───────┘ + +## bitmapCardinality {#bitmapcardinality} + +返回一个UInt64类型的数值,表示位图对象的基数。 + + bitmapCardinality(bitmap) + +**参数** + +- `bitmap` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## bitmapMin {#bitmapmin} + +返回一个UInt64类型的数值,表示位图中的最小值。如果位图为空则返回UINT32\_MAX。 + + bitmapMin(bitmap) + +**参数** + +- `bitmap` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## bitmapMax {#bitmapmax} + +返回一个UInt64类型的数值,表示位图中的最大值。如果位图为空则返回0。 + + bitmapMax(bitmap) + +**参数** + +- `bitmap` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## 位图和标准性 {#bitmapandcardinality} + +为两个位图对象进行与操作,返回结果位图的基数。 + + bitmapAndCardinality(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + + ┌─res─┐ + │ 1 │ + └─────┘ + +## bitmapOrCardinality {#bitmaporcardinality} + +为两个位图进行或运算,返回结果位图的基数。 + + bitmapOrCardinality(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + + ┌─res─┐ + │ 5 │ + └─────┘ + +## bitmapXorCardinality {#bitmapxorcardinality} + +为两个位图进行异或运算,返回结果位图的基数。 + + bitmapXorCardinality(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` – 位图对象。 + +**示例** + +``` sql +SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + + ┌─res─┐ + │ 4 │ + └─────┘ + +## 位图和非标准性 {#bitmapandnotcardinality} + +计算两个位图的差异,返回结果位图的基数。 + + bitmapAndnotCardinality(bitmap1,bitmap2) + +**参数** + +- `bitmap1` – 位图对象。 +- `bitmap2` - 位图对象。 + +**示例** + +``` sql +SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; +``` + + ┌─res─┐ + │ 2 │ + └─────┘ + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/zh/sql-reference/functions/comparison-functions.md b/docs/zh/sql-reference/functions/comparison-functions.md new file mode 100644 index 00000000000..a3da3a3047a --- /dev/null +++ b/docs/zh/sql-reference/functions/comparison-functions.md @@ -0,0 +1,32 @@ +# 比较函数 {#bi-jiao-han-shu} + +比较函数始终返回0或1(UInt8)。 + +可以比较以下类型: + +- 数字 +- String 和 FixedString +- 日期 +- 日期时间 + +以上每个组内的类型均可互相比较,但是对于不同组的类型间不能够进行比较。 + +例如,您无法将日期与字符串进行比较。您必须使用函数将字符串转换为日期,反之亦然。 + +字符串按字节进行比较。较短的字符串小于以其开头并且至少包含一个字符的所有字符串。 + +注意。直到1.1.54134版本,有符号和无符号数字的比较方式与C++相同。换句话说,在SELECT 9223372036854775807 &gt; -1 等情况下,您可能会得到错误的结果。 此行为在版本1.1.54134中已更改,现在在数学上是正确的。 + +## 等于,a=b和a==b运算符 {#equals-a-b-and-a-b-operator} + +## notEquals,a! 运算符=b和a `<>` b {#notequals-a-operator-b-and-a-b} + +## 少, `< operator` {#less-operator} + +## 更大, `> operator` {#greater-operator} + +## 出租等级, `<= operator` {#lessorequals-operator} + +## 伟大的等级, `>= operator` {#greaterorequals-operator} + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) diff --git a/docs/zh/sql-reference/functions/conditional-functions.md b/docs/zh/sql-reference/functions/conditional-functions.md new file mode 100644 index 00000000000..05a26935f01 --- /dev/null +++ b/docs/zh/sql-reference/functions/conditional-functions.md @@ -0,0 +1,44 @@ +# 条件函数 {#tiao-jian-han-shu} + +## 如果(cond,那么,否则),cond? 运算符然后:else {#ifcond-then-else-cond-operator-then-else} + +如果`cond != 0`则返回`then`,如果`cond = 0`则返回`else`。 +`cond`必须是`UInt8`类型,`then`和`else`必须存在最低的共同类型。 + +`then`和`else`可以是`NULL` + +## 多 {#multiif} + +允许您在查询中更紧凑地编写[CASE](../operators.md#operator_case)运算符。 + + multiIf(cond_1, then_1, cond_2, then_2...else) + +**参数:** + +- `cond_N` — 函数返回`then_N`的条件。 +- `then_N` — 执行时函数的结果。 +- `else` — 如果没有满足任何条件,则为函数的结果。 + +该函数接受`2N + 1`参数。 + +**返回值** + +该函数返回值«then\_N»或«else»之一,具体取决于条件`cond_N`。 + +**示例** + +存在如下一张表 + + ┌─x─┬────y─┐ + │ 1 │ ᴺᵁᴸᴸ │ + │ 2 │ 3 │ + └───┴──────┘ + +执行查询 `SELECT multiIf(isNull(y) x, y < 3, y, NULL) FROM t_null`。结果: + + ┌─multiIf(isNull(y), x, less(y, 3), y, NULL)─┐ + │ 1 │ + │ ᴺᵁᴸᴸ │ + └────────────────────────────────────────────┘ + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/zh/sql-reference/functions/date-time-functions.md b/docs/zh/sql-reference/functions/date-time-functions.md new file mode 100644 index 00000000000..3fbe272ebe8 --- /dev/null +++ b/docs/zh/sql-reference/functions/date-time-functions.md @@ -0,0 +1,292 @@ +# 时间日期函数 {#shi-jian-ri-qi-han-shu} + +支持时区。 + +所有的时间日期函数都可以在第二个可选参数中接受时区参数。示例:Asia / Yekaterinburg。在这种情况下,它们使用指定的时区而不是本地(默认)时区。 + +``` sql +SELECT + toDateTime('2016-06-15 23:00:00') AS time, + toDate(time) AS date_local, + toDate(time, 'Asia/Yekaterinburg') AS date_yekat, + toString(time, 'US/Samoa') AS time_samoa +``` + + ┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ + │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ + └─────────────────────┴────────────┴────────────┴─────────────────────┘ + +仅支持与UTC相差一整小时的时区。 + +## toTimeZone {#totimezone} + +将Date或DateTime转换为指定的时区。 + +## 玩一年 {#toyear} + +将Date或DateTime转换为包含年份编号(AD)的UInt16类型的数字。 + +## 到四分钟 {#toquarter} + +将Date或DateTime转换为包含季度编号的UInt8类型的数字。 + +## toMonth {#tomonth} + +将Date或DateTime转换为包含月份编号(1-12)的UInt8类型的数字。 + +## 今天一年 {#todayofyear} + +将Date或DateTime转换为包含一年中的某一天的编号的UInt16(1-366)类型的数字。 + +## 今天月 {#todayofmonth} + +将Date或DateTime转换为包含一月中的某一天的编号的UInt8(1-31)类型的数字。 + +## 今天一周 {#todayofweek} + +将Date或DateTime转换为包含一周中的某一天的编号的UInt8(周一是1, 周日是7)类型的数字。 + +## toHour {#tohour} + +将DateTime转换为包含24小时制(0-23)小时数的UInt8数字。 +这个函数假设如果时钟向前移动,它是一个小时,发生在凌晨2点,如果时钟被移回,它是一个小时,发生在凌晨3点(这并非总是如此 - 即使在莫斯科时钟在不同的时间两次改变)。 + +## toMinute {#tominute} + +将DateTime转换为包含一小时中分钟数(0-59)的UInt8数字。 + +## 秒 {#tosecond} + +将DateTime转换为包含一分钟中秒数(0-59)的UInt8数字。 +闰秒不计算在内。 + +## toUnixTimestamp {#tounixtimestamp} + +将DateTime转换为unix时间戳。 + +## 开始一年 {#tostartofyear} + +将Date或DateTime向前取整到本年的第一天。 +返回Date类型。 + +## 今年开始 {#tostartofisoyear} + +将Date或DateTime向前取整到ISO本年的第一天。 +返回Date类型。 + +## 四分之一开始 {#tostartofquarter} + +将Date或DateTime向前取整到本季度的第一天。 +返回Date类型。 + +## 到月份开始 {#tostartofmonth} + +将Date或DateTime向前取整到本月的第一天。 +返回Date类型。 + +!!! 注意 "注意" +     解析不正确日期的行为是特定于实现的。 ClickHouse可能会返回零日期,抛出异常或执行«natural»溢出。 + +## toMonday {#tomonday} + +将Date或DateTime向前取整到本周的星期一。 +返回Date类型。 + +## 今天开始 {#tostartofday} + +将DateTime向前取整到当日的开始。 + +## 开始一小时 {#tostartofhour} + +将DateTime向前取整到当前小时的开始。 + +## to startofminute {#tostartofminute} + +将DateTime向前取整到当前分钟的开始。 + +## to startoffiveminute {#tostartoffiveminute} + +将DateTime以五分钟为单位向前取整到最接近的时间点。 + +## 开始分钟 {#tostartoftenminutes} + +将DateTime以十分钟为单位向前取整到最接近的时间点。 + +## 开始几分钟 {#tostartoffifteenminutes} + +将DateTime以十五分钟为单位向前取整到最接近的时间点。 + +## toStartOfInterval(time\_or\_data,间隔x单位\[,time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} + +这是名为`toStartOf*`的所有函数的通用函数。例如, +`toStartOfInterval(t,INTERVAL 1 year)`返回与`toStartOfYear(t)`相同的结果, +`toStartOfInterval(t,INTERVAL 1 month)`返回与`toStartOfMonth(t)`相同的结果, +`toStartOfInterval(t,INTERVAL 1 day)`返回与`toStartOfDay(t)`相同的结果, +`toStartOfInterval(t,INTERVAL 15 minute)`返回与`toStartOfFifteenMinutes(t)`相同的结果。 + +## toTime {#totime} + +将DateTime中的日期转换为一个固定的日期,同时保留时间部分。 + +## toRelativeYearNum {#torelativeyearnum} + +将Date或DateTime转换为年份的编号,从过去的某个固定时间点开始。 + +## toRelativeQuarterNum {#torelativequarternum} + +将Date或DateTime转换为季度的数字,从过去的某个固定时间点开始。 + +## toRelativeMonthNum {#torelativemonthnum} + +将Date或DateTime转换为月份的编号,从过去的某个固定时间点开始。 + +## toRelativeWeekNum {#torelativeweeknum} + +将Date或DateTime转换为星期数,从过去的某个固定时间点开始。 + +## toRelativeDayNum {#torelativedaynum} + +将Date或DateTime转换为当天的编号,从过去的某个固定时间点开始。 + +## toRelativeHourNum {#torelativehournum} + +将DateTime转换为小时数,从过去的某个固定时间点开始。 + +## toRelativeMinuteNum {#torelativeminutenum} + +将DateTime转换为分钟数,从过去的某个固定时间点开始。 + +## toRelativeSecondNum {#torelativesecondnum} + +将DateTime转换为秒数,从过去的某个固定时间点开始。 + +## toISOYear {#toisoyear} + +将Date或DateTime转换为包含ISO年份的UInt16类型的编号。 + +## toISOWeek {#toisoweek} + +将Date或DateTime转换为包含ISO周数的UInt8类型的编号。 + +## 现在 {#now} + +不接受任何参数并在请求执行时的某一刻返回当前时间(DateTime)。 +此函数返回一个常量,即时请求需要很长时间能够完成。 + +## 今天 {#today} + +不接受任何参数并在请求执行时的某一刻返回当前日期(Date)。 +其功能与’toDate(now())’相同。 + +## 昨天 {#yesterday} + +不接受任何参数并在请求执行时的某一刻返回昨天的日期(Date)。 +其功能与’today() - 1’相同。 + +## 时隙 {#timeslot} + +将时间向前取整半小时。 +此功能用于Yandex.Metrica,因为如果跟踪标记显示单个用户的连续综合浏览量在时间上严格超过此数量,则半小时是将会话分成两个会话的最短时间。这意味着(tag id,user id,time slot)可用于搜索相应会话中包含的综合浏览量。 + +## toyyymm {#toyyyymm} + +将Date或DateTime转换为包含年份和月份编号的UInt32类型的数字(YYYY \* 100 + MM)。 + +## toyyymmdd {#toyyyymmdd} + +将Date或DateTime转换为包含年份和月份编号的UInt32类型的数字(YYYY \* 10000 + MM \* 100 + DD)。 + +## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} + +将Date或DateTime转换为包含年份和月份编号的UInt64类型的数字(YYYY \* 10000000000 + MM \* 100000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss)。 + +## 隆隆隆隆路虏脢,,陇,貌,垄拢卢虏禄quar陇,貌路,隆拢脳枚脢虏,麓脢,脱,,,录,禄庐戮,utes, {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} + +函数将一段时间间隔添加到Date/DateTime,然后返回Date/DateTime。例如: + +``` sql +WITH + toDate('2018-01-01') AS date, + toDateTime('2018-01-01 00:00:00') AS date_time +SELECT + addYears(date, 1) AS add_years_with_date, + addYears(date_time, 1) AS add_years_with_date_time +``` + + ┌─add_years_with_date─┬─add_years_with_date_time─┐ + │ 2019-01-01 │ 2019-01-01 00:00:00 │ + └─────────────────────┴──────────────────────────┘ + +## subtractYears,subtractMonths,subtractWeeks,subtractDays,subtractours,subtractMinutes,subtractSeconds,subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} + +函数将Date/DateTime减去一段时间间隔,然后返回Date/DateTime。例如: + +``` sql +WITH + toDate('2019-01-01') AS date, + toDateTime('2019-01-01 00:00:00') AS date_time +SELECT + subtractYears(date, 1) AS subtract_years_with_date, + subtractYears(date_time, 1) AS subtract_years_with_date_time +``` + + ┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ + │ 2018-01-01 │ 2018-01-01 00:00:00 │ + └──────────────────────────┴───────────────────────────────┘ + +## dateDiff(‘unit’,t1,t2,\[时区\]) {#datediffunit-t1-t2-timezone} + +返回以’unit’为单位表示的两个时间之间的差异,例如`'hours'`。 ‘t1’和’t2’可以是Date或DateTime,如果指定’timezone’,它将应用于两个参数。如果不是,则使用来自数据类型’t1’和’t2’的时区。如果时区不相同,则结果将是未定义的。 + +支持的单位值: + +| 单位 | +|------| +| 第二 | +| 分钟 | +| 小时 | +| 日 | +| 周 | +| 月 | +| 季 | +| 年 | + +## 时隙(开始时间,持续时间,\[,大小\]) {#timeslotsstarttime-duration-size} + +它返回一个时间数组,其中包括从从«StartTime»开始到«StartTime + Duration 秒»内的所有符合«size»(以秒为单位)步长的时间点。其中«size»是一个可选参数,默认为1800。 +例如,`timeSlots(toDateTime('2012-01-01 12:20:00'),600) = [toDateTime('2012-01-01 12:00:00'),toDateTime('2012-01-01 12:30:00' )]`。 +这对于搜索在相应会话中综合浏览量是非常有用的。 + +## formatDateTime(时间,格式\[,时区\]) {#formatdatetimetime-format-timezone} + +函数根据给定的格式字符串来格式化时间。请注意:格式字符串必须是常量表达式,例如:单个结果列不能有多种格式字符串。 + +支持的格式修饰符: +(«Example» 列是对`2018-01-02 22:33:44`的格式化结果) + +| 修饰符 | 产品描述 | 示例 | +|--------|-------------------------------------------|------------| +| %C | 年除以100并截断为整数(00-99) | 20 | +| %d | 月中的一天,零填充(01-31) | 02 | +| %D | 短MM/DD/YY日期,相当于%m/%d/%y | 01/02/2018 | +| %e | 月中的一天,空格填充(1-31) | 2 | +| %F | 短YYYY-MM-DD日期,相当于%Y-%m-%d | 2018-01-02 | +| %H | 24小时格式(00-23) | 22 | +| %I | 小时12h格式(01-12) | 10 | +| %j | 一年(001-366) | 002 | +| %m | 月份为十进制数(01-12) | 01 | +| %M | 分钟(00-59) | 33 | +| %n | 换行符(") | | +| %p | AM或PM指定 | PM | +| %R | 24小时HH:MM时间,相当于%H:%M | 22:33 | +| %S | 第二(00-59) | 44 | +| %t | 水平制表符(’) | | +| %T | ISO8601时间格式(HH:MM:SS),相当于%H:%M:%S | 22:33:44 | +| %u | ISO8601平日as编号,星期一为1(1-7) | 2 | +| %V | ISO8601周编号(01-53) | 01 | +| %w | 周日为十进制数,周日为0(0-6) | 2 | +| %y | 年份,最后两位数字(00-99) | 18 | +| %Y | 年 | 2018 | +| %% | %符号 | % | + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/zh/sql-reference/functions/encoding-functions.md b/docs/zh/sql-reference/functions/encoding-functions.md new file mode 100644 index 00000000000..39065f1d8b9 --- /dev/null +++ b/docs/zh/sql-reference/functions/encoding-functions.md @@ -0,0 +1,28 @@ +# 编码函数 {#bian-ma-han-shu} + +## hex {#hex} + +接受`String`,`unsigned integer`,`Date`或`DateTime`类型的参数。返回包含参数的十六进制表示的字符串。使用大写字母`A-F`。不使用`0x`前缀或`h`后缀。对于字符串,所有字节都简单地编码为两个十六进制数字。数字转换为大端(«易阅读»)格式。对于数字,去除其中较旧的零,但仅限整个字节。例如,`hex(1)='01'`。 `Date`被编码为自Unix时间开始以来的天数。 `DateTime`编码为自Unix时间开始以来的秒数。 + +## unhex(str) {#unhexstr} + +接受包含任意数量的十六进制数字的字符串,并返回包含相应字节的字符串。支持大写和小写字母A-F。十六进制数字的数量不必是偶数。如果是奇数,则最后一位数被解释为00-0F字节的低位。如果参数字符串包含除十六进制数字以外的任何内容,则返回一些实现定义的结果(不抛出异常)。 +如果要将结果转换为数字,可以使用«reverse»和«reinterpretAsType»函数。 + +## UUIDStringToNum(str) {#uuidstringtonumstr} + +接受包含36个字符的字符串,格式为«123e4567-e89b-12d3-a456-426655440000»,并将其转化为FixedString(16)返回。 + +## UUIDNumToString(str) {#uuidnumtostringstr} + +接受FixedString(16)值。返回包含36个字符的文本格式的字符串。 + +## 位掩码列表(num) {#bitmasktolistnum} + +接受一个整数。返回一个字符串,其中包含一组2的幂列表,其列表中的所有值相加等于这个整数。列表使用逗号分割,按升序排列。 + +## 位掩码阵列(num) {#bitmasktoarraynum} + +接受一个整数。返回一个UInt64类型数组,其中包含一组2的幂列表,其列表中的所有值相加等于这个整数。数组中的数字按升序排列。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/zh/sql-reference/functions/ext-dict-functions.md b/docs/zh/sql-reference/functions/ext-dict-functions.md new file mode 100644 index 00000000000..cae193b2e22 --- /dev/null +++ b/docs/zh/sql-reference/functions/ext-dict-functions.md @@ -0,0 +1,46 @@ +# 字典函数 {#zi-dian-han-shu} + +有关连接和配置外部词典的信息,请参阅[外部词典](../../sql-reference/functions/ext-dict-functions.md)。 + +## dictGetUInt8,dictGetUInt16,dictGetUInt32,dictGetUInt64 {#dictgetuint8-dictgetuint16-dictgetuint32-dictgetuint64} + +## dictGetInt8,dictGetInt16,dictGetInt32,dictGetInt64 {#dictgetint8-dictgetint16-dictgetint32-dictgetint64} + +## dictGetFloat32,dictGetFloat64 {#dictgetfloat32-dictgetfloat64} + +## dictGetDate,dictGetDateTime {#dictgetdate-dictgetdatetime} + +## dictgetuid {#dictgetuuid} + +## dictGetString {#dictgetstring} + +`dictGetT('dict_name', 'attr_name', id)` + +- 使用’id’键获取dict\_name字典中attr\_name属性的值。`dict_name`和`attr_name`是常量字符串。`id`必须是UInt64。 + 如果字典中没有`id`键,则返回字典描述中指定的默认值。 + +## dictGetTOrDefault {#ext_dict_functions-dictgettordefault} + +`dictGetTOrDefault('dict_name', 'attr_name', id, default)` + +与`dictGetT`函数相同,但默认值取自函数的最后一个参数。 + +## dictIsIn {#dictisin} + +`dictIsIn ('dict_name', child_id, ancestor_id)` + +- 对于’dict\_name’分层字典,查找’child\_id’键是否位于’ancestor\_id’内(或匹配’ancestor\_id’)。返回UInt8。 + +## 独裁主义 {#dictgethierarchy} + +`dictGetHierarchy('dict_name', id)` + +- 对于’dict\_name’分层字典,返回从’id’开始并沿父元素链继续的字典键数组。返回Array(UInt64) + +## dictHas {#dicthas} + +`dictHas('dict_name', id)` + +- 检查字典是否存在指定的`id`。如果不存在,则返回0;如果存在,则返回1。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/zh/sql-reference/functions/functions-for-nulls.md b/docs/zh/sql-reference/functions/functions-for-nulls.md new file mode 100644 index 00000000000..e13f094f12c --- /dev/null +++ b/docs/zh/sql-reference/functions/functions-for-nulls.md @@ -0,0 +1,252 @@ +# Nullable处理函数 {#nullablechu-li-han-shu} + +## isNull {#isnull} + +检查参数是否为[NULL](../syntax.md#null)。 + + isNull(x) + +**参数** + +- `x` — 一个非复合数据类型的值。 + +**返回值** + +- `1` 如果`x`为`NULL`。 +- `0` 如果`x`不为`NULL`。 + +**示例** + +存在以下内容的表 + + ┌─x─┬────y─┐ + │ 1 │ ᴺᵁᴸᴸ │ + │ 2 │ 3 │ + └───┴──────┘ + +对其进行查询 + + :) SELECT x FROM t_null WHERE isNull(y) + + SELECT x + FROM t_null + WHERE isNull(y) + + ┌─x─┐ + │ 1 │ + └───┘ + + 1 rows in set. Elapsed: 0.010 sec. + +## isNotNull {#isnotnull} + +检查参数是否不为 [NULL](../syntax.md#null). + + isNotNull(x) + +**参数:** + +- `x` — 一个非复合数据类型的值。 + +**返回值** + +- `0` 如果`x`为`NULL`。 +- `1` 如果`x`不为`NULL`。 + +**示例** + +存在以下内容的表 + + ┌─x─┬────y─┐ + │ 1 │ ᴺᵁᴸᴸ │ + │ 2 │ 3 │ + └───┴──────┘ + +对其进行查询 + + :) SELECT x FROM t_null WHERE isNotNull(y) + + SELECT x + FROM t_null + WHERE isNotNull(y) + + ┌─x─┐ + │ 2 │ + └───┘ + + 1 rows in set. Elapsed: 0.010 sec. + +## 合并 {#coalesce} + +检查从左到右是否传递了«NULL»参数并返回第一个非`'NULL`参数。 + + coalesce(x,...) + +**参数:** + +- 任何数量的非复合类型的参数。所有参数必须与数据类型兼容。 + +**返回值** + +- 第一个非’NULL\`参数。 +- `NULL`,如果所有参数都是’NULL\`。 + +**示例** + +考虑可以指定多种联系客户的方式的联系人列表。 + + ┌─name─────┬─mail─┬─phone─────┬──icq─┐ + │ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ + │ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ + └──────────┴──────┴───────────┴──────┘ + +`mail`和`phone`字段是String类型,但`icq`字段是`UInt32`,所以它需要转换为`String`。 + +从联系人列表中获取客户的第一个可用联系方式: + + :) SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook + + SELECT coalesce(mail, phone, CAST(icq, 'Nullable(String)')) + FROM aBook + + ┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ + │ client 1 │ 123-45-67 │ + │ client 2 │ ᴺᵁᴸᴸ │ + └──────────┴──────────────────────────────────────────────────────┘ + + 2 rows in set. Elapsed: 0.006 sec. + +## ifNull {#ifnull} + +如果第一个参数为«NULL»,则返回第二个参数的值。 + + ifNull(x,alt) + +**参数:** + +- `x` — 要检查«NULL»的值。 +- `alt` — 如果`x`为’NULL\`,函数返回的值。 + +**返回值** + +- 价值 `x`,如果 `x` 不是 `NULL`. +- 价值 `alt`,如果 `x` 是 `NULL`. + +**示例** + + SELECT ifNull('a', 'b') + + ┌─ifNull('a', 'b')─┐ + │ a │ + └──────────────────┘ + + SELECT ifNull(NULL, 'b') + + ┌─ifNull(NULL, 'b')─┐ + │ b │ + └───────────────────┘ + +## nullIf {#nullif} + +如果参数相等,则返回`NULL`。 + + nullIf(x, y) + +**参数:** + +`x`, `y` — 用于比较的值。 它们必须是类型兼容的,否则将抛出异常。 + +**返回值** + +- 如果参数相等,则为`NULL`。 +- 如果参数不相等,则为`x`值。 + +**示例** + + SELECT nullIf(1, 1) + + ┌─nullIf(1, 1)─┐ + │ ᴺᵁᴸᴸ │ + └──────────────┘ + + SELECT nullIf(1, 2) + + ┌─nullIf(1, 2)─┐ + │ 1 │ + └──────────────┘ + +## assumeNotNull {#assumenotnull} + +将[可为空](../../sql-reference/functions/functions-for-nulls.md)类型的值转换为非`Nullable`类型的值。 + + assumeNotNull(x) + +**参数:** + +- `x` — 原始值。 + +**返回值** + +- 如果`x`不为`NULL`,返回非`Nullable`类型的原始值。 +- 如果`x`为`NULL`,返回对应非`Nullable`类型的默认值。 + +**示例** + +存在如下`t_null`表。 + + SHOW CREATE TABLE t_null + + ┌─statement─────────────────────────────────────────────────────────────────┐ + │ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ + └───────────────────────────────────────────────────────────────────────────┘ + + ┌─x─┬────y─┐ + │ 1 │ ᴺᵁᴸᴸ │ + │ 2 │ 3 │ + └───┴──────┘ + +将列`y`作为`assumeNotNull`函数的参数。 + + SELECT assumeNotNull(y) FROM t_null + + ┌─assumeNotNull(y)─┐ + │ 0 │ + │ 3 │ + └──────────────────┘ + + SELECT toTypeName(assumeNotNull(y)) FROM t_null + + ┌─toTypeName(assumeNotNull(y))─┐ + │ Int8 │ + │ Int8 │ + └──────────────────────────────┘ + +## 可调整 {#tonullable} + +将参数的类型转换为`Nullable`。 + + toNullable(x) + +**参数:** + +- `x` — 任何非复合类型的值。 + +**返回值** + +- 输入的值,但其类型为`Nullable`。 + +**示例** + + SELECT toTypeName(10) + + ┌─toTypeName(10)─┐ + │ UInt8 │ + └────────────────┘ + + SELECT toTypeName(toNullable(10)) + + ┌─toTypeName(toNullable(10))─┐ + │ Nullable(UInt8) │ + └────────────────────────────┘ + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/zh/sql-reference/functions/geo.md b/docs/zh/sql-reference/functions/geo.md new file mode 100644 index 00000000000..7cc094932fb --- /dev/null +++ b/docs/zh/sql-reference/functions/geo.md @@ -0,0 +1,222 @@ +# GEO函数 {#geohan-shu} + +## 大圆形距离 {#greatcircledistance} + +使用[great-circle distance公式](https://en.wikipedia.org/wiki/Great-circle_distance)计算地球表面两点之间的距离。 + +``` sql +greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) +``` + +**输入参数** + +- `lon1Deg` — 第一个点的经度,单位:度,范围: `[-180°, 180°]`。 +- `lat1Deg` — 第一个点的纬度,单位:度,范围: `[-90°, 90°]`。 +- `lon2Deg` — 第二个点的经度,单位:度,范围: `[-180°, 180°]`。 +- `lat2Deg` — 第二个点的纬度,单位:度,范围: `[-90°, 90°]`。 + +正值对应北纬和东经,负值对应南纬和西经。 + +**返回值** + +地球表面的两点之间的距离,以米为单位。 + +当输入参数值超出规定的范围时将抛出异常。 + +**示例** + +``` sql +SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) +``` + +``` text +┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ +│ 14132374.194975413 │ +└───────────────────────────────────────────────────────────────────┘ +``` + +## 尖尖的人 {#pointinellipses} + +检查指定的点是否至少包含在指定的一个椭圆中。 +下述中的坐标是几何图形在笛卡尔坐标系中的位置。 + +``` sql +pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) +``` + +**输入参数** + +- `x, y` — 平面上某个点的坐标。 +- `xᵢ, yᵢ` — 第i个椭圆的中心坐标。 +- `aᵢ, bᵢ` — 以x, y坐标为单位的第i个椭圆的轴。 + +输入参数的个数必须是`2+4⋅n`,其中`n`是椭圆的数量。 + +**返回值** + +如果该点至少包含在一个椭圆中,则返回`1`;否则,则返回`0`。 + +**示例** + +``` sql +SELECT pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1.0, 2.0) +``` + +``` text +┌─pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1., 2.)─┐ +│ 1 │ +└─────────────────────────────────────────────────────────────────────┘ +``` + +## pointInPolygon {#pointinpolygon} + +检查指定的点是否包含在指定的多边形中。 + +``` sql +pointInPolygon((x, y), [(a, b), (c, d) ...], ...) +``` + +**输入参数** + +- `(x, y)` — 平面上某个点的坐标。[元组](../../sql-reference/functions/geo.md)类型,包含坐标的两个数字。 +- `[(a, b), (c, d) ...]` — 多边形的顶点。[阵列](../../sql-reference/functions/geo.md)类型。每个顶点由一对坐标`(a, b)`表示。顶点可以按顺时针或逆时针指定。顶点的个数应该大于等于3。同时只能是常量的。 +- 该函数还支持镂空的多边形(切除部分)。如果需要,可以使用函数的其他参数定义需要切除部分的多边形。(The function does not support non-simply-connected polygons.) + +**返回值** + +如果坐标点存在在多边形范围内,则返回`1`。否则返回`0`。 +如果坐标位于多边形的边界上,则该函数可能返回`1`,或可能返回`0`。 + +**示例** + +``` sql +SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res +``` + +``` text +┌─res─┐ +│ 1 │ +└─────┘ +``` + +## geohashEncode {#geohashencode} + +将经度和纬度编码为geohash-string,请参阅(http://geohash.org/,https://en.wikipedia.org/wiki/Geohash)。 + +``` sql +geohashEncode(longitude, latitude, [precision]) +``` + +**输入值** + +- longitude - 要编码的坐标的经度部分。其值应在`[-180°,180°]`范围内 +- latitude - 要编码的坐标的纬度部分。其值应在`[-90°,90°]`范围内 +- precision - 可选,生成的geohash-string的长度,默认为`12`。取值范围为`[1,12]`。任何小于`1`或大于`12`的值都会默认转换为`12`。 + +**返回值** + +- 坐标编码的字符串(使用base32编码的修改版本)。 + +**示例** + +``` sql +SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res +``` + +``` text +┌─res──────────┐ +│ ezs42d000000 │ +└──────────────┘ +``` + +## geohashDecode {#geohashdecode} + +将任何geohash编码的字符串解码为经度和纬度。 + +**输入值** + +- encoded string - geohash编码的字符串。 + +**返回值** + +- (longitude, latitude) - 经度和纬度的`Float64`值的2元组。 + +**示例** + +``` sql +SELECT geohashDecode('ezs42') AS res +``` + +``` text +┌─res─────────────────────────────┐ +│ (-5.60302734375,42.60498046875) │ +└─────────────────────────────────┘ +``` + +## geoToH3 {#geotoh3} + +计算指定的分辨率的[H3](https://uber.github.io/h3/#/documentation/overview/introduction)索引`(lon, lat)`。 + +``` sql +geoToH3(lon, lat, resolution) +``` + +**输入值** + +- `lon` — 经度。 [Float64](../../sql-reference/functions/geo.md)类型。 +- `lat` — 纬度。 [Float64](../../sql-reference/functions/geo.md)类型。 +- `resolution` — 索引的分辨率。 取值范围为: `[0, 15]`。 [UInt8](../../sql-reference/functions/geo.md)类型。 + +**返回值** + +- H3中六边形的索引值。 +- 发生异常时返回0。 + +[UInt64](../../sql-reference/functions/geo.md)类型。 + +**示例** + +``` sql +SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index +``` + +``` text +┌────────────h3Index─┐ +│ 644325524701193974 │ +└────────────────────┘ +``` + +## geohashesInBox {#geohashesinbox} + +计算在指定精度下计算最小包含指定的经纬范围的最小图形的geohash数组。 + +**输入值** + +- longitude\_min - 最小经度。其值应在`[-180°,180°]`范围内 +- latitude\_min - 最小纬度。其值应在`[-90°,90°]`范围内 +- longitude\_max - 最大经度。其值应在`[-180°,180°]`范围内 +- latitude\_max - 最大纬度。其值应在`[-90°,90°]`范围内 +- precision - geohash的精度。其值应在`[1, 12]`内的`UInt8`类型的数字 + +请注意,上述所有的坐标参数必须同为`Float32`或`Float64`中的一种类型。 + +**返回值** + +- 包含指定范围内的指定精度的geohash字符串数组。注意,您不应该依赖返回数组中geohash的顺序。 +- \[\] - 当传入的最小经纬度大于最大经纬度时将返回一个空数组。 + +请注意,如果生成的数组长度超过10000时,则函数将抛出异常。 + +**示例** + +``` sql +SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos +``` + +``` text +┌─thasos──────────────────────────────────────┐ +│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ +└─────────────────────────────────────────────┘ +``` + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/zh/sql-reference/functions/hash-functions.md b/docs/zh/sql-reference/functions/hash-functions.md new file mode 100644 index 00000000000..5646eee6af8 --- /dev/null +++ b/docs/zh/sql-reference/functions/hash-functions.md @@ -0,0 +1,114 @@ +# Hash函数 {#hashhan-shu} + +Hash函数可以用于将元素不可逆的伪随机打乱。 + +## halfMD5 {#halfmd5} + +计算字符串的MD5。然后获取结果的前8个字节并将它们作为UInt64(大端)返回。 +此函数相当低效(500万个短字符串/秒/核心)。 +如果您不需要一定使用MD5,请使用’sipHash64’函数。 + +## MD5 {#md5} + +计算字符串的MD5并将结果放入FixedString(16)中返回。 +如果您只是需要一个128位的hash,同时不需要一定使用MD5,请使用’sipHash128’函数。 +如果您要获得与md5sum程序相同的输出结果,请使用lower(hex(MD5(s)))。 + +## sipHash64 {#siphash64} + +计算字符串的SipHash。 +接受String类型的参数,返回UInt64。 +SipHash是一种加密哈希函数。它的处理性能至少比MD5快三倍。 +有关详细信息,请参阅链接:https://131002.net/siphash/ + +## sipHash128 {#hash_functions-siphash128} + +计算字符串的SipHash。 +接受String类型的参数,返回FixedString(16)。 +与sipHash64函数的不同在于它的最终计算结果为128位。 + +## cityHash64 {#cityhash64} + +计算任意数量字符串的CityHash64或使用特定实现的Hash函数计算任意数量其他类型的Hash。 +对于字符串,使用CityHash算法。 这是一个快速的非加密哈希函数,用于字符串。 +对于其他类型的参数,使用特定实现的Hash函数,这是一种快速的非加密的散列函数。 +如果传递了多个参数,则使用CityHash组合这些参数的Hash结果。 +例如,您可以计算整个表的checksum,其结果取决于行的顺序:`SELECT sum(cityHash64(*)) FROM table`。 + +## intHash32 {#inthash32} + +为任何类型的整数计算32位的哈希。 +这是相对高效的非加密Hash函数。 + +## intHash64 {#inthash64} + +从任何类型的整数计算64位哈希码。 +它的工作速度比intHash32函数快。 + +## SHA1 {#sha1} + +## SHA224 {#sha224} + +## SHA256 {#sha256} + +计算字符串的SHA-1,SHA-224或SHA-256,并将结果字节集返回为FixedString(20),FixedString(28)或FixedString(32)。 +该函数相当低效(SHA-1大约500万个短字符串/秒/核心,而SHA-224和SHA-256大约220万个短字符串/秒/核心)。 +我们建议仅在必须使用这些Hash函数且无法更改的情况下使用这些函数。 +即使在这些情况下,我们仍建议将函数采用在写入数据时使用预计算的方式将其计算完毕。而不是在SELECT中计算它们。 + +## URLHash(url\[,N\]) {#urlhashurl-n} + +一种快速的非加密哈希函数,用于规范化的从URL获得的字符串。 +`URLHash(s)` - 从一个字符串计算一个哈希,如果结尾存在尾随符号`/`,`?`或`#`则忽略。 +`URLHash(s,N)` - 计算URL层次结构中字符串到N级别的哈希值,如果末尾存在尾随符号`/`,`?`或`#`则忽略。 +URL的层级与URLHierarchy中的层级相同。 此函数被用于Yandex.Metrica。 + +## farmHash64 {#farmhash64} + +计算字符串的FarmHash64。 +接受一个String类型的参数。返回UInt64。 +有关详细信息,请参阅链接:[FarmHash64](https://github.com/google/farmhash) + +## javaHash {#hash_functions-javahash} + +计算字符串的JavaHash。 +接受一个String类型的参数。返回Int32。 +有关更多信息,请参阅链接:[JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) + +## hiveHash {#hivehash} + +计算字符串的HiveHash。 +接受一个String类型的参数。返回Int32。 +与[JavaHash](#hash_functions-javahash)相同,但不会返回负数。 + +## metroHash64 {#metrohash64} + +计算字符串的MetroHash。 +接受一个String类型的参数。返回UInt64。 +有关详细信息,请参阅链接:[MetroHash64](http://www.jandrewrogers.com/2015/05/27/metrohash/) + +## jumpConsistentHash {#jumpconsistenthash} + +计算UInt64的JumpConsistentHash。 +接受UInt64类型的参数。返回Int32。 +有关更多信息,请参见链接:[JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) + +## murmurHash2\_32,murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} + +计算字符串的MurmurHash2。 +接受一个String类型的参数。返回UInt64或UInt32。 +有关更多信息,请参阅链接:[MurmurHash2](https://github.com/aappleby/smhasher) + +## murmurHash3\_32,murmurHash3\_64,murmurHash3\_128 {#murmurhash3-32-murmurhash3-64-murmurhash3-128} + +计算字符串的MurmurHash3。 +接受一个String类型的参数。返回UInt64或UInt32或FixedString(16)。 +有关更多信息,请参阅链接:[MurmurHash3](https://github.com/aappleby/smhasher) + +## xxHash32,xxHash64 {#xxhash32-xxhash64} + +计算字符串的xxHash。 +接受一个String类型的参数。返回UInt64或UInt32。 +有关更多信息,请参见链接:[xxHash](http://cyan4973.github.io/xxHash/) + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/zh/sql-reference/functions/higher-order-functions.md b/docs/zh/sql-reference/functions/higher-order-functions.md new file mode 100644 index 00000000000..fcf3ab3da15 --- /dev/null +++ b/docs/zh/sql-reference/functions/higher-order-functions.md @@ -0,0 +1,138 @@ +# 高阶函数 {#gao-jie-han-shu} + +## `->` 运算符, lambda(params, expr) 函数 {#yun-suan-fu-lambdaparams-expr-han-shu} + +用于描述一个lambda函数用来传递给其他高阶函数。箭头的左侧有一个形式参数,它可以是一个标识符或多个标识符所组成的元祖。箭头的右侧是一个表达式,在这个表达式中可以使用形式参数列表中的任何一个标识符或表的任何一个列名。 + +示例: `x -> 2 * x, str -> str != Referer.` + +高阶函数只能接受lambda函数作为其参数。 + +高阶函数可以接受多个参数的lambda函数作为其参数,在这种情况下,高阶函数需要同时传递几个长度相等的数组,这些数组将被传递给lambda参数。 + +除了’arrayMap’和’arrayFilter’以外的所有其他函数,都可以省略第一个参数(lambda函数)。在这种情况下,默认返回数组元素本身。 + +### arrayMap(func, arr1, …) {#higher_order_functions-array-map} + +将arr +将从’func’函数的原始应用程序获得的数组返回到’arr’数组中的每个元素。 +返回从原始应用程序获得的数组 ‘func’ 函数中的每个元素 ‘arr’ 阵列。 + +### arrayFilter(func, arr1, …) {#arrayfilterfunc-arr1} + +返回一个仅包含以下元素的数组 ‘arr1’ 对于哪个 ‘func’ 返回0以外的内容。 + +示例: + +``` sql +SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res +``` + + ┌─res───────────┐ + │ ['abc World'] │ + └───────────────┘ + +``` sql +SELECT + arrayFilter( + (i, x) -> x LIKE '%World%', + arrayEnumerate(arr), + ['Hello', 'abc World'] AS arr) + AS res +``` + + ┌─res─┐ + │ [2] │ + └─────┘ + +### arrayCount(\[func,\] arr1, …) {#arraycountfunc-arr1} + +返回数组arr中非零元素的数量,如果指定了’func’,则通过’func’的返回值确定元素是否为非零元素。 + +### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} + +返回数组’arr’中是否存在非零元素,如果指定了’func’,则使用’func’的返回值确定元素是否为非零元素。 + +### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} + +返回数组’arr’中是否存在为零的元素,如果指定了’func’,则使用’func’的返回值确定元素是否为零元素。 + +### arraySum(\[func,\] arr1, …) {#arraysumfunc-arr1} + +计算arr数组的总和,如果指定了’func’,则通过’func’的返回值计算数组的总和。 + +### arrayFirst(func, arr1, …) {#arrayfirstfunc-arr1} + +返回数组中第一个匹配的元素,函数使用’func’匹配所有元素,直到找到第一个匹配的元素。 + +### arrayFirstIndex(func, arr1, …) {#arrayfirstindexfunc-arr1} + +返回数组中第一个匹配的元素的下标索引,函数使用’func’匹配所有元素,直到找到第一个匹配的元素。 + +### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} + +返回源数组部分数据的总和,如果指定了`func`函数,则使用`func`的返回值计算总和。 + +示例: + +``` sql +SELECT arrayCumSum([1, 1, 1, 1]) AS res +``` + + ┌─res──────────┐ + │ [1, 2, 3, 4] │ + └──────────────┘ + +### arrayCumSumNonNegative(arr) {#arraycumsumnonnegativearr} + +与arrayCumSum相同,返回源数组部分数据的总和。不同于arrayCumSum,当返回值包含小于零的值时,该值替换为零,后续计算使用零继续计算。例如: + +``` sql +SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res +``` + + ┌─res───────┐ + │ [1,2,0,1] │ + └───────────┘ + +### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} + +返回升序排序`arr1`的结果。如果指定了`func`函数,则排序顺序由`func`的结果决定。 + +[Schwartzian变换](https://en.wikipedia.org/wiki/Schwartzian_transform)用于提高排序效率。 + +示例: + +``` sql +SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); +``` + + ┌─res────────────────┐ + │ ['world', 'hello'] │ + └────────────────────┘ + +请注意,NULL和NaN在最后(NaN在NULL之前)。例如: + +``` sql +SELECT arraySort([1, nan, 2, NULL, 3, nan, 4, NULL]) +``` + + ┌─arraySort([1, nan, 2, NULL, 3, nan, 4, NULL])─┐ + │ [1,2,3,4,nan,nan,NULL,NULL] │ + └───────────────────────────────────────────────┘ + +### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} + +返回降序排序`arr1`的结果。如果指定了`func`函数,则排序顺序由`func`的结果决定。 + +请注意,NULL和NaN在最后(NaN在NULL之前)。例如: + +``` sql +SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, 4, NULL]) +``` + + ┌─arrayReverseSort([1, nan, 2, NULL, 3, nan, 4, NULL])─┐ + │ [4,3,2,1,nan,nan,NULL,NULL] │ + └──────────────────────────────────────────────────────┘ + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/zh/sql-reference/functions/in-functions.md b/docs/zh/sql-reference/functions/in-functions.md new file mode 100644 index 00000000000..9f911cef06a --- /dev/null +++ b/docs/zh/sql-reference/functions/in-functions.md @@ -0,0 +1,19 @@ +# IN运算符相关函数 {#inyun-suan-fu-xiang-guan-han-shu} + +## in,notIn,globalIn,globalNotIn {#in-notin-globalin-globalnotin} + +请参阅[IN 运算符](../statements/select.md#select-in-operators)部分。 + +## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} + +函数用于对多个列进行分组。 +对于具有类型T1,T2,…的列,它返回包含这些列的元组(T1,T2,…)。 执行该函数没有任何成本。 +元组通常用作IN运算符的中间参数值,或用于创建lambda函数的形参列表。 元组不能写入表。 + +## 元组元素(元组,n),运算符x.N {#tupleelementtuple-n-operator-x-n} + +函数用于从元组中获取列。 +’N’是列索引,从1开始。N必须是常量正整数常数,并且不大于元组的大小。 +执行该函数没有任何成本。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/zh/sql-reference/functions/index.md b/docs/zh/sql-reference/functions/index.md new file mode 100644 index 00000000000..8d178592e92 --- /dev/null +++ b/docs/zh/sql-reference/functions/index.md @@ -0,0 +1,66 @@ +# 函数 {#han-shu} + +ClickHouse中至少存在两种类型的函数 - 常规函数(它们称之为«函数»)和聚合函数。 常规函数的工作就像分别为每一行执行一次函数计算一样(对于每一行,函数的结果不依赖于其他行)。 聚合函数则从各行累积一组值(即函数的结果以来整个结果集)。 + +在本节中,我们将讨论常规函数。 有关聚合函数,请参阅«聚合函数»一节。 + + \* - ’arrayJoin’函数与表函数均属于第三种类型的函数。 \* + +## 强类型 {#qiang-lei-xing} + +与标准SQL相比,ClickHouse具有强类型。 换句话说,它不会在类型之间进行隐式转换。 每个函数适用于特定的一组类型。 这意味着有时您需要使用类型转换函数。 + +## 常见的子表达式消除 {#chang-jian-de-zi-biao-da-shi-xiao-chu} + +查询中具有相同AST(相同语句或语法分析结果相同)的所有表达式都被视为具有相同的值。 这样的表达式被连接并执行一次。 通过这种方式也可以消除相同的子查询。 + +## 结果类型 {#jie-guo-lei-xing} + +所有函数都只能够返回一个返回值。 结果类型通常由参数的类型决定。 但tupleElement函数(a.N运算符)和toFixedString函数是例外的。 + +## 常量 {#chang-liang} + +为了简单起见,某些函数的某些参数只能是常量。 例如,LIKE运算符的右参数必须是常量。 +几乎所有函数都为常量参数返回常量。 除了用于生成随机数的函数。 +’now’函数为在不同时间运行的查询返回不同的值,但结果被视为常量,因为常量在单个查询中很重要。 +常量表达式也被视为常量(例如,LIKE运算符的右半部分可以由多个常量构造)。 + +对于常量和非常量参数,可以以不同方式实现函数(执行不同的代码)。 但是,对于包含相同数据的常量和非常量参数它们的结果应该是一致的。 + +## NULL值处理 {#nullzhi-chu-li} + +函数具有以下行为: + +- 如果函数的参数至少一个是«NULL»,则函数结果也是«NULL»。 +- 在每个函数的描述中单独指定的特殊行为。在ClickHouse源代码中,这些函数具有«UseDefaultImplementationForNulls = false»。 + +## 不可变性 {#bu-ke-bian-xing} + +函数不能更改其参数的值 - 任何更改都将作为结果返回。因此,计算单独函数的结果不依赖于在查询中写入函数的顺序。 + +## 错误处理 {#cuo-wu-chu-li} + +如果数据无效,某些函数可能会抛出异常。在这种情况下,将取消查询并将错误信息返回给客户端。对于分布式处理,当其中一个服务器发生异常时,其他服务器也会尝试中止查询。 + +## 表达式参数的计算 {#biao-da-shi-can-shu-de-ji-suan} + +在几乎所有编程语言中,某些函数可能无法预先计算其中一个参数。这通常是运算符`&&`,`||`和`? :`。 +但是在ClickHouse中,函数(运算符)的参数总是被预先计算。这是因为一次评估列的整个部分,而不是分别计算每一行。 + +## 执行分布式查询处理的功能 {#zhi-xing-fen-bu-shi-cha-xun-chu-li-de-gong-neng} + +对于分布式查询处理,在远程服务器上执行尽可能多的查询处理阶段,并且在请求者服务器上执行其余阶段(合并中间结果和之后的所有内容)。 + +这意味着可以在不同的服务器上执行功能。 +例如,在查询`SELECT f(sum(g(x)))FROM distributed_table GROUP BY h(y)中,` + +- 如果`distributed_table`至少有两个分片,则在远程服务器上执行函数’g’和’h’,并在请求服务器上执行函数’f’。 +- 如果`distributed_table`只有一个分片,则在该分片的服务器上执行所有’f’,’g’和’h’功能。 + +函数的结果通常不依赖于它在哪个服务器上执行。但是,有时这很重要。 +例如,使用字典的函数时将使用运行它们的服务器上存在的字典。 +另一个例子是`hostName`函数,它返回运行它的服务器的名称,以便在`SELECT`查询中对服务器进行`GROUP BY`。 + +如果查询中的函数在请求服务器上执行,但您需要在远程服务器上执行它,则可以将其包装在«any»聚合函数中,或将其添加到«GROUP BY»中。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/zh/sql-reference/functions/introspection.md b/docs/zh/sql-reference/functions/introspection.md new file mode 100644 index 00000000000..8ea252a1e63 --- /dev/null +++ b/docs/zh/sql-reference/functions/introspection.md @@ -0,0 +1,310 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 65 +toc_title: "\u81EA\u7701" +--- + +# 内省功能 {#introspection-functions} + +您可以使用本章中描述的函数来反省 [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) 和 [DWARF](https://en.wikipedia.org/wiki/DWARF) 用于查询分析。 + +!!! warning "警告" + 这些功能很慢,可能会强加安全考虑。 + +对于内省功能的正确操作: + +- 安装 `clickhouse-common-static-dbg` 包。 + +- 设置 [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) 设置为1。 + + For security reasons introspection functions are disabled by default. + +ClickHouse将探查器报告保存到 [trace\_log](../../operations/system-tables.md#system_tables-trace_log) 系统表. 确保正确配置了表和探查器。 + +## addressToLine {#addresstoline} + +将ClickHouse服务器进程内的虚拟内存地址转换为ClickHouse源代码中的文件名和行号。 + +如果您使用官方的ClickHouse软件包,您需要安装 `clickhouse-common-static-dbg` 包。 + +**语法** + +``` sql +addressToLine(address_of_binary_instruction) +``` + +**参数** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**返回值** + +- 源代码文件名和此文件中用冒号分隔的行号。 + + For example, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, where `199` is a line number. + +- 二进制文件的名称,如果函数找不到调试信息。 + +- 空字符串,如果地址无效。 + +类型: [字符串](../../sql-reference/data-types/string.md). + +**示例** + +启用内省功能: + +``` sql +SET allow_introspection_functions=1 +``` + +从中选择第一个字符串 `trace_log` 系统表: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-19 +event_time: 2019-11-19 18:57:23 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 421b6855-1858-45a5-8f37-f383409d6d72 +trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] +``` + +该 `trace` 字段包含采样时的堆栈跟踪。 + +获取单个地址的源代码文件名和行号: + +``` sql +SELECT addressToLine(94784076370703) \G +``` + +``` text +Row 1: +────── +addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +``` + +将函数应用于整个堆栈跟踪: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines +FROM system.trace_log +LIMIT 1 +\G +``` + +该 [arrayMap](higher-order-functions.md#higher_order_functions-array-map) 功能允许处理的每个单独的元素 `trace` 阵列由 `addressToLine` 功能。 这种处理的结果,你在看 `trace_source_code_lines` 列的输出。 + +``` text +Row 1: +────── +trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so +/usr/lib/debug/usr/bin/clickhouse +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 +/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 +/usr/include/c++/9/bits/atomic_base.h:551 +/usr/lib/debug/usr/bin/clickhouse +/lib/x86_64-linux-gnu/libpthread-2.27.so +/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 +``` + +## addressToSymbol {#addresstosymbol} + +将ClickHouse服务器进程内的虚拟内存地址转换为ClickHouse对象文件中的符号。 + +**语法** + +``` sql +addressToSymbol(address_of_binary_instruction) +``` + +**参数** + +- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process. + +**返回值** + +- 来自ClickHouse对象文件的符号。 +- 空字符串,如果地址无效。 + +类型: [字符串](../../sql-reference/data-types/string.md). + +**示例** + +启用内省功能: + +``` sql +SET allow_introspection_functions=1 +``` + +从中选择第一个字符串 `trace_log` 系统表: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +该 `trace` 字段包含采样时的堆栈跟踪。 + +获取单个地址的符号: + +``` sql +SELECT addressToSymbol(94138803686098) \G +``` + +``` text +Row 1: +────── +addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +``` + +将函数应用于整个堆栈跟踪: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols +FROM system.trace_log +LIMIT 1 +\G +``` + +该 [arrayMap](higher-order-functions.md#higher_order_functions-array-map) 功能允许处理的每个单独的元素 `trace` 阵列由 `addressToSymbols` 功能。 这种处理的结果,你在看 `trace_symbols` 列的输出。 + +``` text +Row 1: +────── +trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE +_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE +_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb +_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb +_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE +_ZN2DB27AggregatingBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB26ExpressionBlockInputStream8readImplEv +_ZN2DB17IBlockInputStream4readEv +_ZN2DB28AsynchronousBlockInputStream9calculateEv +_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data +_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E +_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv +_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E +execute_native_thread_routine +start_thread +clone +``` + +## demangle {#demangle} + +转换一个符号,您可以使用 [addressToSymbol](#addresstosymbol) 函数到C++函数名。 + +**语法** + +``` sql +demangle(symbol) +``` + +**参数** + +- `symbol` ([字符串](../../sql-reference/data-types/string.md)) — Symbol from an object file. + +**返回值** + +- C++函数的名称。 +- 如果符号无效,则为空字符串。 + +类型: [字符串](../../sql-reference/data-types/string.md). + +**示例** + +启用内省功能: + +``` sql +SET allow_introspection_functions=1 +``` + +从中选择第一个字符串 `trace_log` 系统表: + +``` sql +SELECT * FROM system.trace_log LIMIT 1 \G +``` + +``` text +Row 1: +────── +event_date: 2019-11-20 +event_time: 2019-11-20 16:57:59 +revision: 54429 +timer_type: Real +thread_number: 48 +query_id: 724028bf-f550-45aa-910d-2af6212b94ac +trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] +``` + +该 `trace` 字段包含采样时的堆栈跟踪。 + +获取单个地址的函数名称: + +``` sql +SELECT demangle(addressToSymbol(94138803686098)) \G +``` + +``` text +Row 1: +────── +demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +``` + +将函数应用于整个堆栈跟踪: + +``` sql +SELECT + arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions +FROM system.trace_log +LIMIT 1 +\G +``` + +该 [arrayMap](higher-order-functions.md#higher_order_functions-array-map) 功能允许处理的每个单独的元素 `trace` 阵列由 `demangle` 功能。 这种处理的结果,你在看 `trace_functions` 列的输出。 + +``` text +Row 1: +────── +trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const +DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const +DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) +DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) +DB::AggregatingBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::ExpressionBlockInputStream::readImpl() +DB::IBlockInputStream::read() +DB::AsynchronousBlockInputStream::calculate() +std::_Function_handler::_M_invoke(std::_Any_data const&) +ThreadPoolImpl::worker(std::_List_iterator) +ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const +ThreadPoolImpl::worker(std::_List_iterator) +execute_native_thread_routine +start_thread +clone +``` diff --git a/docs/zh/sql-reference/functions/ip-address-functions.md b/docs/zh/sql-reference/functions/ip-address-functions.md new file mode 100644 index 00000000000..d208e0e6939 --- /dev/null +++ b/docs/zh/sql-reference/functions/ip-address-functions.md @@ -0,0 +1,217 @@ +# IP函数 {#iphan-shu} + +## IPv4NumToString(num) {#ipv4numtostringnum} + +接受一个UInt32(大端)表示的IPv4的地址,返回相应IPv4的字符串表现形式,格式为A.B.C.D(以点分割的十进制数字)。 + +## IPv4StringToNum(s) {#ipv4stringtonums} + +与IPv4NumToString函数相反。如果IPv4地址格式无效,则返回0。 + +## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} + +与IPv4NumToString类似,但使用xxx替换最后一个字节。 + +示例: + +``` sql +SELECT + IPv4NumToStringClassC(ClientIP) AS k, + count() AS c +FROM test.hits +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + + ┌─k──────────────┬─────c─┐ + │ 83.149.9.xxx │ 26238 │ + │ 217.118.81.xxx │ 26074 │ + │ 213.87.129.xxx │ 25481 │ + │ 83.149.8.xxx │ 24984 │ + │ 217.118.83.xxx │ 22797 │ + │ 78.25.120.xxx │ 22354 │ + │ 213.87.131.xxx │ 21285 │ + │ 78.25.121.xxx │ 20887 │ + │ 188.162.65.xxx │ 19694 │ + │ 83.149.48.xxx │ 17406 │ + └────────────────┴───────┘ + +由于使用’xxx’是不规范的,因此将来可能会更改。我们建议您不要依赖此格式。 + +### IPv6NumToString(x) {#ipv6numtostringx} + +接受FixedString(16)类型的二进制格式的IPv6地址。以文本格式返回此地址的字符串。 +IPv6映射的IPv4地址以::ffff:111.222.33。例如: + +``` sql +SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr +``` + + ┌─addr─────────┐ + │ 2a02:6b8::11 │ + └──────────────┘ + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + + ┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ + │ 2a02:2168:aaa:bbbb::2 │ 24695 │ + │ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ + │ 2a02:6b8:0:fff::ff │ 16389 │ + │ 2a01:4f8:111:6666::2 │ 16016 │ + │ 2a02:2168:888:222::1 │ 15896 │ + │ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ + │ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ + │ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ + │ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ + │ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ + └─────────────────────────────────────────┴───────┘ + +``` sql +SELECT + IPv6NumToString(ClientIP6 AS k), + count() AS c +FROM hits_all +WHERE EventDate = today() +GROUP BY k +ORDER BY c DESC +LIMIT 10 +``` + + ┌─IPv6NumToString(ClientIP6)─┬──────c─┐ + │ ::ffff:94.26.111.111 │ 747440 │ + │ ::ffff:37.143.222.4 │ 529483 │ + │ ::ffff:5.166.111.99 │ 317707 │ + │ ::ffff:46.38.11.77 │ 263086 │ + │ ::ffff:79.105.111.111 │ 186611 │ + │ ::ffff:93.92.111.88 │ 176773 │ + │ ::ffff:84.53.111.33 │ 158709 │ + │ ::ffff:217.118.11.22 │ 154004 │ + │ ::ffff:217.118.11.33 │ 148449 │ + │ ::ffff:217.118.11.44 │ 148243 │ + └────────────────────────────┴────────┘ + +## IPv6StringToNum(s) {#ipv6stringtonums} + +与IPv6NumToString的相反。如果IPv6地址格式无效,则返回空字节字符串。 +十六进制可以是大写的或小写的。 + +## IPv4ToIPv6(x) {#ipv4toipv6x} + +接受一个UInt32类型的IPv4地址,返回FixedString(16)类型的IPv6地址。例如: + +``` sql +SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr +``` + + ┌─addr───────────────┐ + │ ::ffff:192.168.0.1 │ + └────────────────────┘ + +## cutIPv6(x,bitsToCutForIPv6,bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} + +接受一个FixedString(16)类型的IPv6地址,返回一个String,这个String中包含了删除指定位之后的地址的文本格式。例如: + +``` sql +WITH + IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, + IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 +SELECT + cutIPv6(ipv6, 2, 0), + cutIPv6(ipv4, 0, 2) +``` + + ┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ + │ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ + └─────────────────────────────────────┴─────────────────────┘ + +## ツ古カツ益ツ催ツ団ツ法ツ人), {#ipv4cidrtorangeipv4-cidr} + +接受一个IPv4地址以及一个UInt8类型的CIDR。返回包含子网最低范围以及最高范围的元组。 + +``` sql +SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) +``` + + ┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ + │ ('192.168.0.0','192.168.255.255') │ + └────────────────────────────────────────────┘ + +## ツ暗ェツ氾环催ツ団ツ法ツ人), {#ipv6cidrtorangeipv6-cidr} + +接受一个IPv6地址以及一个UInt8类型的CIDR。返回包含子网最低范围以及最高范围的元组。 + +``` sql +SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); +``` + + ┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ + │ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ + └────────────────────────────────────────────────────────────────────────┘ + +## toIPv4(字符串) {#toipv4string} + +`IPv4StringToNum()`的别名,它采用字符串形式的IPv4地址并返回[IPv4](../../sql-reference/functions/ip-address-functions.md)类型的值,该二进制值等于`IPv4StringToNum()`返回的值。 + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + toTypeName(IPv4StringToNum(IPv4_string)), + toTypeName(toIPv4(IPv4_string)) +``` + + ┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ + │ UInt32 │ IPv4 │ + └──────────────────────────────────────────┴─────────────────────────────────┘ + +``` sql +WITH + '171.225.130.45' as IPv4_string +SELECT + hex(IPv4StringToNum(IPv4_string)), + hex(toIPv4(IPv4_string)) +``` + + ┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ + │ ABE1822D │ ABE1822D │ + └───────────────────────────────────┴──────────────────────────┘ + +## toIPv6(字符串) {#toipv6string} + +`IPv6StringToNum()`的别名,它采用字符串形式的IPv6地址并返回[IPv6](../../sql-reference/functions/ip-address-functions.md)类型的值,该二进制值等于`IPv6StringToNum()`返回的值。 + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + toTypeName(IPv6StringToNum(IPv6_string)), + toTypeName(toIPv6(IPv6_string)) +``` + + ┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ + │ FixedString(16) │ IPv6 │ + └──────────────────────────────────────────┴─────────────────────────────────┘ + +``` sql +WITH + '2001:438:ffff::407d:1bc1' as IPv6_string +SELECT + hex(IPv6StringToNum(IPv6_string)), + hex(toIPv6(IPv6_string)) +``` + + ┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ + │ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ + └───────────────────────────────────┴──────────────────────────────────┘ + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/zh/sql-reference/functions/json-functions.md b/docs/zh/sql-reference/functions/json-functions.md new file mode 100644 index 00000000000..dcdbef6bb87 --- /dev/null +++ b/docs/zh/sql-reference/functions/json-functions.md @@ -0,0 +1,174 @@ +# JSON函数 {#jsonhan-shu} + +在Yandex.Metrica中,用户使用JSON作为访问参数。为了处理这些JSON,实现了一些函数。(尽管在大多数情况下,JSON是预先进行额外处理的,并将结果值放在单独的列中。)所有的这些函数都进行了尽可能的假设。以使函数能够尽快的完成工作。 + +我们对JSON格式做了如下假设: + +1. 字段名称(函数的参数)必须使常量。 +2. 字段名称必须使用规范的编码。例如:`visitParamHas('{"abc":"def"}', 'abc') = 1`,但是 `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` +3. 函数可以随意的在多层嵌套结构下查找字段。如果存在多个匹配字段,则返回第一个匹配字段。 +4. JSON除字符串文本外不存在空格字符。 + +## ツ环板(ョツ嘉ッツ偲青visャツ静ャツ青サツ催ャツ渉) {#visitparamhasparams-name} + +检查是否存在«name»名称的字段 + +## 访问paramextractuint(参数,名称) {#visitparamextractuintparams-name} + +将名为«name»的字段的值解析成UInt64。如果这是一个字符串字段,函数将尝试从字符串的开头解析一个数字。如果该字段不存在,或无法从它中解析到数字,则返回0。 + +## visitParamExtractInt(参数,名称) {#visitparamextractintparams-name} + +与visitParamExtractUInt相同,但返回Int64。 + +## 访问paramextractfloat(参数,名称) {#visitparamextractfloatparams-name} + +与visitParamExtractUInt相同,但返回Float64。 + +## ツ环板(ョツ嘉ッツ偲青妥-ツ姪(不ツ督ョツ産) {#visitparamextractboolparams-name} + +解析true/false值。其结果是UInt8类型的。 + +## 掳胫((禄脢鹿脷露胫鲁隆鹿((酶-11-16""\[脪陆(,,,) {#visitparamextractrawparams-name} + +返回字段的值,包含空格符。 + +示例: + + visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' + visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' + +## visitParamExtractString(参数,名称) {#visitparamextractstringparams-name} + +使用双引号解析字符串。这个值没有进行转义。如果转义失败,它将返回一个空白字符串。 + +示例: + + visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' + visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' + visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' + visitParamExtractString('{"abc":"hello}', 'abc') = '' + +目前不支持`\uXXXX\uYYYY`这些字符编码,这些编码不在基本多文种平面中(它们被转化为CESU-8而不是UTF-8)。 + +以下函数基于[simdjson](https://github.com/lemire/simdjson),专为更复杂的JSON解析要求而设计。但上述假设2仍然适用。 + +## JSONHas(json\[, indices\_or\_keys\]…) {#jsonhasjson-indices-or-keys} + +如果JSON中存在该值,则返回`1`。 + +如果该值不存在,则返回`0`。 + +示例: + + select JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 + select JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 + +`indices_or_keys`可以是零个或多个参数的列表,每个参数可以是字符串或整数。 + +- String = 按成员名称访问JSON对象成员。 +- 正整数 = 从头开始访问第n个成员/成员名称。 +- 负整数 = 从末尾访问第n个成员/成员名称。 + +您可以使用整数来访问JSON数组和JSON对象。 + +例如: + + select JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' + select JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' + select JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' + 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} + +返回JSON数组或JSON对象的长度。 + +如果该值不存在或类型错误,将返回`0`。 + +示例: + + 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} + +返回JSON值的类型。 + +如果该值不存在,将返回`Null`。 + +示例: + + select JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' + 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} + +## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} + +## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} + +## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} + +解析JSON并提取值。这些函数类似于`visitParam*`函数。 + +如果该值不存在或类型错误,将返回`0`。 + +示例: + + select JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 + 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} + +解析JSON并提取字符串。此函数类似于`visitParamExtractString`函数。 + +如果该值不存在或类型错误,则返回空字符串。 + +该值未转义。如果unescaping失败,则返回一个空字符串。 + +示例: + + select JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' + select JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' + select JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' + select JSONExtractString('{"abc":"\\u263"}', 'abc') = '' + select JSONExtractString('{"abc":"hello}', 'abc') = '' + +## JSONExtract(json\[, indices\_or\_keys…\], Return\_type) {#jsonextractjson-indices-or-keys-return-type} + +解析JSON并提取给定ClickHouse数据类型的值。 + +这是以前的`JSONExtract函数的变体。 这意味着`JSONExtract(…, ‘String’)`返回与`JSONExtractString()`返回完全相同。`JSONExtract(…, ‘Float64’)`返回于`JSONExtractFloat()\`返回完全相同。 + +示例: + + SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) + SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') + SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] + SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL + SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 + 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} + +从JSON中解析键值对,其中值是给定的ClickHouse数据类型。 + +示例: + + 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} + +返回JSON的部分。 + +如果部件不存在或类型错误,将返回空字符串。 + +示例: + + select JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/zh/sql-reference/functions/logical-functions.md b/docs/zh/sql-reference/functions/logical-functions.md new file mode 100644 index 00000000000..b14f1bb5d37 --- /dev/null +++ b/docs/zh/sql-reference/functions/logical-functions.md @@ -0,0 +1,15 @@ +# 逻辑函数 {#luo-ji-han-shu} + +逻辑函数可以接受任何数字类型的参数,并返回UInt8类型的0或1。 + +当向函数传递零时,函数将判定为«false»,否则,任何其他非零的值都将被判定为«true»。 + +## 和,和运营商 {#and-and-operator} + +## 或,或运营商 {#or-or-operator} + +## 不是,不是运营商 {#not-not-operator} + +## 异或 {#xor} + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) diff --git a/docs/zh/sql-reference/functions/machine-learning-functions.md b/docs/zh/sql-reference/functions/machine-learning-functions.md new file mode 100644 index 00000000000..77f8d76a722 --- /dev/null +++ b/docs/zh/sql-reference/functions/machine-learning-functions.md @@ -0,0 +1,15 @@ +# 机器学习函数 {#ji-qi-xue-xi-han-shu} + +## evalMLMethod(预测) {#machine_learning_methods-evalmlmethod} + +使用拟合回归模型的预测请使用`evalMLMethod`函数。 请参阅`linearRegression`中的链接。 + +## 随机线性回归 {#stochastic-linear-regression} + +`stochasticLinearRegression`聚合函数使用线性模型和MSE损失函数实现随机梯度下降法。 使用`evalMLMethod`来预测新数据。 +请参阅示例和注释[此处](../../sql-reference/functions/machine-learning-functions.md#agg_functions-stochasticlinearregression)。 + +## 随机逻辑回归 {#stochastic-logistic-regression} + +`stochasticLogisticRegression`聚合函数实现了二元分类问题的随机梯度下降法。 使用`evalMLMethod`来预测新数据。 +请参阅示例和注释[此处](../../sql-reference/functions/machine-learning-functions.md#agg_functions-stochasticlogisticregression)。 diff --git a/docs/zh/sql-reference/functions/math-functions.md b/docs/zh/sql-reference/functions/math-functions.md new file mode 100644 index 00000000000..fbcb90e5d2b --- /dev/null +++ b/docs/zh/sql-reference/functions/math-functions.md @@ -0,0 +1,107 @@ +# 数学函数 {#shu-xue-han-shu} + +以下所有的函数都返回一个Float64类型的数值。返回结果总是以尽可能最大精度返回,但还是可能与机器中可表示最接近该值的数字不同。 + +## e() {#e} + +返回一个接近数学常量e的Float64数字。 + +## pi() {#pi} + +返回一个接近数学常量π的Float64数字。 + +## exp(x) {#expx} + +接受一个数值类型的参数并返回它的指数。 + +## log(x),ln(x) {#logx-lnx} + +接受一个数值类型的参数并返回它的自然对数。 + +## exp2(x) {#exp2x} + +接受一个数值类型的参数并返回它的2的x次幂。 + +## log2(x) {#log2x} + +接受一个数值类型的参数并返回它的底2对数。 + +## exp10(x) {#exp10x} + +接受一个数值类型的参数并返回它的10的x次幂。 + +## log10(x) {#log10x} + +接受一个数值类型的参数并返回它的底10对数。 + +## sqrt(x) {#sqrtx} + +接受一个数值类型的参数并返回它的平方根。 + +## cbrt(x) {#cbrtx} + +接受一个数值类型的参数并返回它的立方根。 + +## erf(x) {#erfx} + +如果’x’是非负数,那么erf(x / σ√2)是具有正态分布且标准偏差为«σ»的随机变量的值与预期值之间的距离大于«x»。 + +示例 (三西格玛准则): + +``` sql +SELECT erf(3 / sqrt(2)) +``` + + ┌─erf(divide(3, sqrt(2)))─┐ + │ 0.9973002039367398 │ + └─────────────────────────┘ + +## erfc(x) {#erfcx} + +接受一个数值参数并返回一个接近1 - erf(x)的Float64数字,但不会丢失大«x»值的精度。 + +## lgamma(x) {#lgammax} + +返回x的绝对值的自然对数的伽玛函数。 + +## tgamma(x) {#tgammax} + +返回x的伽玛函数。 + +## sin(x) {#sinx} + +返回x的三角正弦值。 + +## cos(x) {#cosx} + +返回x的三角余弦值。 + +## 谭(x) {#tanx} + +返回x的三角正切值。 + +## asin(x) {#asinx} + +返回x的反三角正弦值。 + +## acos(x) {#acosx} + +返回x的反三角余弦值。 + +## 阿坦(x) {#atanx} + +返回x的反三角正切值。 + +## pow(x,y),power(x,y) {#powx-y-powerx-y} + +接受x和y两个参数。返回x的y次方。 + +## intExp2 {#intexp2} + +接受一个数值类型的参数并返回它的2的x次幂(UInt64)。 + +## intExp10 {#intexp10} + +接受一个数值类型的参数并返回它的10的x次幂(UInt64)。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/zh/sql-reference/functions/other-functions.md b/docs/zh/sql-reference/functions/other-functions.md new file mode 100644 index 00000000000..16ce90e6ced --- /dev/null +++ b/docs/zh/sql-reference/functions/other-functions.md @@ -0,0 +1,537 @@ +# 其他函数 {#qi-ta-han-shu} + +## 主机名() {#hostname} + +返回一个字符串,其中包含执行此函数的主机的名称。 对于分布式处理,如果在远程服务器上执行此函数,则将返回远程服务器主机的名称。 + +## basename {#basename} + +在最后一个斜杠或反斜杠后的字符串文本。 此函数通常用于从路径中提取文件名。 + + basename( expr ) + +**参数** + +- `expr` — 任何一个返回[字符串](../../sql-reference/functions/other-functions.md)结果的表达式。[字符串](../../sql-reference/functions/other-functions.md) + +**返回值** + +一个String类型的值,其包含: + +- 在最后一个斜杠或反斜杠后的字符串文本内容。 + + 如果输入的字符串以斜杆或反斜杆结尾,例如:`/`或`c:\`,函数将返回一个空字符串。 + +- 如果输入的字符串中不包含斜杆或反斜杠,函数返回输入字符串本身。 + +**示例** + +``` sql +SELECT 'some/long/path/to/file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some\\long\\path\\to\\file' AS a, basename(a) +``` + +``` text +┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ +│ some\long\path\to\file │ file │ +└────────────────────────┴────────────────────────────────────────┘ +``` + +``` sql +SELECT 'some-file-name' AS a, basename(a) +``` + +``` text +┌─a──────────────┬─basename('some-file-name')─┐ +│ some-file-name │ some-file-name │ +└────────────────┴────────────────────────────┘ +``` + +## visibleWidth(x) {#visiblewidthx} + +以文本格式(以制表符分隔)向控制台输出值时,计算近似宽度。 +系统使用此函数实现Pretty格式。 +以文本格式(制表符分隔)将值输出到控制台时,计算近似宽度。 +这个函数被系统用于实现漂亮的格式。 + +`NULL` 表示为对应于 `NULL` 在 `Pretty` 格式。 + + SELECT visibleWidth(NULL) + + ┌─visibleWidth(NULL)─┐ + │ 4 │ + └────────────────────┘ + +## toTypeName(x) {#totypenamex} + +返回包含参数的类型名称的字符串。 + +如果将`NULL`作为参数传递给函数,那么它返回`Nullable(Nothing)`类型,它对应于ClickHouse中的内部`NULL`。 + +## 块大小() {#function-blocksize} + +获取Block的大小。 +在ClickHouse中,查询始终工作在Block(包含列的部分的集合)上。此函数允许您获取调用其的块的大小。 + +## 实现(x) {#materializex} + +将一个常量列变为一个非常量列。 +在ClickHouse中,非常量列和常量列在内存中的表示方式不同。尽管函数对于常量列和非常量总是返回相同的结果,但它们的工作方式可能完全不同(执行不同的代码)。此函数用于调试这种行为。 + +## ignore(…) {#ignore} + +接受任何参数,包括`NULL`。始终返回0。 +但是,函数的参数总是被计算的。该函数可以用于基准测试。 + +## 睡眠(秒) {#sleepseconds} + +在每个Block上休眠’seconds’秒。可以是整数或浮点数。 + +## sleepEachRow(秒) {#sleepeachrowseconds} + +在每行上休眠’seconds’秒。可以是整数或浮点数。 + +## 当前数据库() {#currentdatabase} + +返回当前数据库的名称。 +当您需要在CREATE TABLE中的表引擎参数中指定数据库,您可以使用此函数。 + +## isFinite(x) {#isfinitex} + +接受Float32或Float64类型的参数,如果参数不是infinite且不是NaN,则返回1,否则返回0。 + +## isInfinite(x) {#isinfinitex} + +接受Float32或Float64类型的参数,如果参数是infinite,则返回1,否则返回0。注意NaN返回0。 + +## isNaN(x) {#isnanx} + +接受Float32或Float64类型的参数,如果参数是Nan,则返回1,否则返回0。 + +## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} + +接受常量字符串:数据库名称、表名称和列名称。 如果存在列,则返回等于1的UInt8常量表达式,否则返回0。 如果设置了hostname参数,则测试将在远程服务器上运行。 +如果表不存在,该函数将引发异常。 +对于嵌套数据结构中的元素,该函数检查是否存在列。 对于嵌套数据结构本身,函数返回0。 + +## 酒吧 {#function-bar} + +使用unicode构建图表。 + +`bar(x, min, max, width)` 当`x = max`时, 绘制一个宽度与`(x - min)`成正比且等于`width`的字符带。 + +参数: + +- `x` — 要显示的尺寸。 +- `min, max` — 整数常量,该值必须是`Int64`。 +- `width` — 常量,可以是正整数或小数。 + +字符带的绘制精度是符号的八分之一。 + +示例: + +``` sql +SELECT + toHour(EventTime) AS h, + count() AS c, + bar(c, 0, 600000, 20) AS bar +FROM test.hits +GROUP BY h +ORDER BY h ASC +``` + + ┌──h─┬──────c─┬─bar────────────────┐ + │ 0 │ 292907 │ █████████▋ │ + │ 1 │ 180563 │ ██████ │ + │ 2 │ 114861 │ ███▋ │ + │ 3 │ 85069 │ ██▋ │ + │ 4 │ 68543 │ ██▎ │ + │ 5 │ 78116 │ ██▌ │ + │ 6 │ 113474 │ ███▋ │ + │ 7 │ 170678 │ █████▋ │ + │ 8 │ 278380 │ █████████▎ │ + │ 9 │ 391053 │ █████████████ │ + │ 10 │ 457681 │ ███████████████▎ │ + │ 11 │ 493667 │ ████████████████▍ │ + │ 12 │ 509641 │ ████████████████▊ │ + │ 13 │ 522947 │ █████████████████▍ │ + │ 14 │ 539954 │ █████████████████▊ │ + │ 15 │ 528460 │ █████████████████▌ │ + │ 16 │ 539201 │ █████████████████▊ │ + │ 17 │ 523539 │ █████████████████▍ │ + │ 18 │ 506467 │ ████████████████▊ │ + │ 19 │ 520915 │ █████████████████▎ │ + │ 20 │ 521665 │ █████████████████▍ │ + │ 21 │ 542078 │ ██████████████████ │ + │ 22 │ 493642 │ ████████████████▍ │ + │ 23 │ 400397 │ █████████████▎ │ + └────┴────────┴────────────────────┘ + +## 变换 {#transform} + +根据定义,将某些元素转换为其他元素。 +此函数有两种使用方式: + +1. `transform(x, array_from, array_to, default)` + +`x` – 要转换的值。 + +`array_from` – 用于转换的常量数组。 + +`array_to` – 将’from’中的值转换为的常量数组。 + +`default` – 如果’x’不等于’from’中的任何值,则默认转换的值。 + +`array_from` 和 `array_to` – 拥有相同大小的数组。 + +类型约束: + +`transform(T, Array(T), Array(U), U) -> U` + +`T`和`U`可以是String,Date,DateTime或任意数值类型的。 +对于相同的字母(T或U),如果数值类型,那么它们不可不完全匹配的,只需要具备共同的类型即可。 +例如,第一个参数是Int64类型,第二个参数是Array(UInt16)类型。 + +如果’x’值等于’array\_from’数组中的一个元素,它将从’array\_to’数组返回一个对应的元素(下标相同)。否则,它返回’default’。如果’array\_from’匹配到了多个元素,则返回第一个匹配的元素。 + +示例: + +``` sql +SELECT + transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, + count() AS c +FROM test.hits +WHERE SearchEngineID != 0 +GROUP BY title +ORDER BY c DESC +``` + + ┌─title─────┬──────c─┐ + │ Yandex │ 498635 │ + │ Google │ 229872 │ + │ Other │ 104472 │ + └───────────┴────────┘ + +1. `transform(x, array_from, array_to)` + +与第一种不同在于省略了’default’参数。 +如果’x’值等于’array\_from’数组中的一个元素,它将从’array\_to’数组返回相应的元素(下标相同)。 否则,它返回’x’。 + +类型约束: + +`transform(T, Array(T), Array(T)) -> T` + +示例: + +``` sql +SELECT + transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, + count() AS c +FROM test.hits +GROUP BY domain(Referer) +ORDER BY count() DESC +LIMIT 10 +``` + + ┌─s──────────────┬───────c─┐ + │ │ 2906259 │ + │ www.yandex │ 867767 │ + │ ███████.ru │ 313599 │ + │ mail.yandex.ru │ 107147 │ + │ ██████.ru │ 100355 │ + │ █████████.ru │ 65040 │ + │ news.yandex.ru │ 64515 │ + │ ██████.net │ 59141 │ + │ example.com │ 57316 │ + └────────────────┴─────────┘ + +## formatReadableSize(x) {#formatreadablesizex} + +接受大小(字节数)。返回带有后缀(KiB, MiB等)的字符串。 + +示例: + +``` sql +SELECT + arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, + formatReadableSize(filesize_bytes) AS filesize +``` + + ┌─filesize_bytes─┬─filesize───┐ + │ 1 │ 1.00 B │ + │ 1024 │ 1.00 KiB │ + │ 1048576 │ 1.00 MiB │ + │ 192851925 │ 183.92 MiB │ + └────────────────┴────────────┘ + +## 至少(a,b) {#leasta-b} + +返回a和b中的最小值。 + +## 最伟大(a,b) {#greatesta-b} + +返回a和b的最大值。 + +## 碌莽禄time拢time() {#uptime} + +返回服务正常运行的秒数。 + +## 版本() {#version} + +以字符串形式返回服务器的版本。 + +## 时区() {#timezone} + +返回服务器的时区。 + +## blockNumber {#blocknumber} + +返回行所在的Block的序列号。 + +## rowNumberInBlock {#function-rownumberinblock} + +返回行所在Block中行的序列号。 针对不同的Block始终重新计算。 + +## rowNumberInAllBlocks() {#rownumberinallblocks} + +返回行所在结果集中的序列号。此函数仅考虑受影响的Block。 + +## 运行差异(x) {#other_functions-runningdifference} + +计算数据块中相邻行的值之间的差异。 +对于第一行返回0,并为每个后续行返回与前一行的差异。 + +函数的结果取决于受影响的Block和Block中的数据顺序。 +如果使用ORDER BY创建子查询并从子查询外部调用该函数,则可以获得预期结果。 + +示例: + +``` sql +SELECT + EventID, + EventTime, + runningDifference(EventTime) AS delta +FROM +( + SELECT + EventID, + EventTime + FROM events + WHERE EventDate = '2016-11-24' + ORDER BY EventTime ASC + LIMIT 5 +) +``` + + ┌─EventID─┬───────────EventTime─┬─delta─┐ + │ 1106 │ 2016-11-24 00:00:04 │ 0 │ + │ 1107 │ 2016-11-24 00:00:05 │ 1 │ + │ 1108 │ 2016-11-24 00:00:05 │ 0 │ + │ 1109 │ 2016-11-24 00:00:09 │ 4 │ + │ 1110 │ 2016-11-24 00:00:10 │ 1 │ + └─────────┴─────────────────────┴───────┘ + +## 运行差异启动与第一值 {#runningdifferencestartingwithfirstvalue} + +与[运行差异](./other-functions.md#other_functions-runningdifference)相同,区别在于第一行返回第一行的值,后续每个后续行返回与上一行的差值。 + +## MACNumToString(num) {#macnumtostringnum} + +接受一个UInt64类型的数字。 将其解释为big endian的MAC地址。 返回包含相应MAC地址的字符串,格式为AA:BB:CC:DD:EE:FF(以冒号分隔的十六进制形式的数字)。 + +## MACStringToNum(s) {#macstringtonums} + +与MACNumToString相反。 如果MAC地址格式无效,则返回0。 + +## MACStringToOUI(s) {#macstringtoouis} + +接受格式为AA:BB:CC:DD:EE:FF(十六进制形式的冒号分隔数字)的MAC地址。 返回前三个八位字节作为UInt64编号。 如果MAC地址格式无效,则返回0。 + +## getSizeOfEnumType {#getsizeofenumtype} + +返回[枚举](../../sql-reference/functions/other-functions.md)中的枚举数量。 + + getSizeOfEnumType(value) + +**参数:** + +- `value` — `Enum`类型的值。 + +**返回值** + +- `Enum`的枚举数量。 +- 如果类型不是`Enum`,则抛出异常。 + +**示例** + + SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x + + ┌─x─┐ + │ 2 │ + └───┘ + +## toColumnTypeName {#tocolumntypename} + +返回在RAM中列的数据类型的名称。 + + toColumnTypeName(value) + +**参数:** + +- `value` — 任何类型的值。 + +**返回值** + +- 一个字符串,其内容是`value`在RAM中的类型名称。 + +**`toTypeName ' 与 ' toColumnTypeName`的区别示例** + + :) select toTypeName(cast('2018-01-01 01:02:03' AS DateTime)) + + SELECT toTypeName(CAST('2018-01-01 01:02:03', 'DateTime')) + + ┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ + │ DateTime │ + └─────────────────────────────────────────────────────┘ + + 1 rows in set. Elapsed: 0.008 sec. + + :) select toColumnTypeName(cast('2018-01-01 01:02:03' AS DateTime)) + + SELECT toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime')) + + ┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ + │ Const(UInt32) │ + └───────────────────────────────────────────────────────────┘ + +该示例显示`DateTime`数据类型作为`Const(UInt32)`存储在内存中。 + +## dumpColumnStructure {#dumpcolumnstructure} + +输出在RAM中的数据结果的详细信息。 + + dumpColumnStructure(value) + +**参数:** + +- `value` — 任何类型的值. + +**返回值** + +- 一个字符串,其内容是`value`在RAM中的数据结构的详细描述。 + +**示例** + + SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) + + ┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ + │ DateTime, Const(size = 1, UInt32(size = 1)) │ + └──────────────────────────────────────────────────────────────┘ + +## defaultValueOfArgumentType {#defaultvalueofargumenttype} + +输出数据类型的默认值。 + +不包括用户设置的自定义列的默认值。 + + defaultValueOfArgumentType(expression) + +**参数:** + +- `expression` — 任意类型的值或导致任意类型值的表达式。 + +**返回值** + +- 数值类型返回`0`。 +- 字符串类型返回空的字符串。 +- [可为空](../../sql-reference/functions/other-functions.md)类型返回`ᴺᵁᴸᴸ`。 + +**示例** + + :) SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) + + SELECT defaultValueOfArgumentType(CAST(1, 'Int8')) + + ┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ + │ 0 │ + └─────────────────────────────────────────────┘ + + 1 rows in set. Elapsed: 0.002 sec. + + :) SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) + + SELECT defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)')) + + ┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ + │ ᴺᵁᴸᴸ │ + └───────────────────────────────────────────────────────┘ + + 1 rows in set. Elapsed: 0.002 sec. + +## 复制 {#replicate} + +使用单个值填充一个数组。 + +用于[arrayJoin](array-join.md#functions_arrayjoin)的内部实现。 + + replicate(x, arr) + +**参数:** + +- `arr` — 原始数组。 ClickHouse创建一个与原始数据长度相同的新数组,并用值`x`填充它。 +- `x` — 生成的数组将被填充的值。 + +**输出** + +- 一个被`x`填充的数组。 + +**示例** + + SELECT replicate(1, ['a', 'b', 'c']) + + ┌─replicate(1, ['a', 'b', 'c'])─┐ + │ [1,1,1] │ + └───────────────────────────────┘ + +## 文件系统可用 {#filesystemavailable} + +返回磁盘的剩余空间信息(以字节为单位)。使用配置文件中的path配置评估此信息。 + +## 文件系统容量 {#filesystemcapacity} + +返回磁盘的容量信息,以字节为单位。使用配置文件中的path配置评估此信息。 + +## 最后聚会 {#function-finalizeaggregation} + +获取聚合函数的状态。返回聚合结果(最终状态)。 + +## 跑累积 {#function-runningaccumulate} + +获取聚合函数的状态并返回其具体的值。这是从第一行到当前行的所有行累计的结果。 + +例如,获取聚合函数的状态(示例runningAccumulate(uniqState(UserID))),对于数据块的每一行,返回所有先前行和当前行的状态合并后的聚合函数的结果。 +因此,函数的结果取决于分区中数据块的顺序以及数据块中行的顺序。 + +## joinGet(‘join\_storage\_table\_name’, ‘get\_column’,join\_key) {#joingetjoin-storage-table-name-get-column-join-key} + +使用指定的连接键从Join类型引擎的表中获取数据。 + +## modelEvaluate(model\_name, …) {#function-modelevaluate} + +使用外部模型计算。 +接受模型的名称以及模型的参数。返回Float64类型的值。 + +## throwIf(x) {#throwifx} + +如果参数不为零则抛出异常。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/zh/sql-reference/functions/random-functions.md b/docs/zh/sql-reference/functions/random-functions.md new file mode 100644 index 00000000000..d2d9fdf87a6 --- /dev/null +++ b/docs/zh/sql-reference/functions/random-functions.md @@ -0,0 +1,21 @@ +# 随机函数 {#sui-ji-han-shu} + +随机函数使用非加密方式生成伪随机数字。 + +所有随机函数都只接受一个参数或不接受任何参数。 +您可以向它传递任何类型的参数,但传递的参数将不会使用在任何随机数生成过程中。 +此参数的唯一目的是防止公共子表达式消除,以便在相同的查询中使用相同的随机函数生成不同的随机数。 + +## 兰德 {#rand} + +返回一个UInt32类型的随机数字,所有UInt32类型的数字被生成的概率均相等。此函数线性同于的方式生成随机数。 + +## rand64 {#rand64} + +返回一个UInt64类型的随机数字,所有UInt64类型的数字被生成的概率均相等。此函数线性同于的方式生成随机数。 + +## randConstant {#randconstant} + +返回一个UInt32类型的随机数字,该函数不同之处在于仅为每个数据块参数一个随机数。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/zh/sql-reference/functions/rounding-functions.md b/docs/zh/sql-reference/functions/rounding-functions.md new file mode 100644 index 00000000000..c1bf6641135 --- /dev/null +++ b/docs/zh/sql-reference/functions/rounding-functions.md @@ -0,0 +1,86 @@ +# 取整函数 {#qu-zheng-han-shu} + +## 楼(x\[,N\]) {#floorx-n} + +返回小于或等于x的最大舍入数。该函数使用参数乘1/10N,如果1/10N不精确,则选择最接近的精确的适当数据类型的数。 +’N’是一个整数常量,可选参数。默认为0,这意味着不对其进行舍入。 +’N’可以是负数。 + +示例: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` + +`x`是任何数字类型。结果与其为相同类型。 +对于整数参数,使用负’N’值进行舍入是有意义的(对于非负«N»,该函数不执行任何操作)。 +如果取整导致溢出(例如,floor(-128,-1)),则返回特定于实现的结果。 + +## ceil(x\[,N\]),天花板(x\[,N\]) {#ceilx-n-ceilingx-n} + +返回大于或等于’x’的最小舍入数。在其他方面,它与’floor’功能相同(见上文)。 + +## 圆形(x\[,N\]) {#rounding_functions-round} + +将值取整到指定的小数位数。 + +该函数按顺序返回最近的数字。如果给定数字包含多个最近数字,则函数返回其中最接近偶数的数字(银行的取整方式)。 + + round(expression [, decimal_places]) + +**参数:** + +- `expression` — 要进行取整的数字。可以是任何返回数字[类型](../../sql-reference/functions/rounding-functions.md#data_types)的[表达式](../syntax.md#syntax-expressions)。 +- `decimal-places` — 整数类型。 + - 如果`decimal-places > 0`,则该函数将值舍入小数点右侧。 + - 如果`decimal-places < 0`,则该函数将小数点左侧的值四舍五入。 + - 如果`decimal-places = 0`,则该函数将该值舍入为整数。在这种情况下,可以省略参数。 + +**返回值:** + +与输入数字相同类型的取整后的数字。 + +### 示例 {#shi-li} + +**使用示例** + +``` sql +SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 +``` + + ┌───x─┬─round(divide(number, 2))─┐ + │ 0 │ 0 │ + │ 0.5 │ 0 │ + │ 1 │ 1 │ + └─────┴──────────────────────────┘ + +**取整的示例** + +取整到最近的数字。 + + round(3.2, 0) = 3 + round(4.1267, 2) = 4.13 + round(22,-1) = 20 + round(467,-2) = 500 + round(-467,-2) = -500 + +银行的取整。 + + round(3.5) = 4 + round(4.5) = 4 + round(3.55, 1) = 3.6 + round(3.65, 1) = 3.6 + +## roundToExp2(num) {#roundtoexp2num} + +接受一个数字。如果数字小于1,则返回0。否则,它将数字向下舍入到最接近的(整个非负)2的x次幂。 + +## 圆形饱和度(num) {#rounddurationnum} + +接受一个数字。如果数字小于1,则返回0。否则,它将数字向下舍入为集合中的数字:1,10,30,60,120,180,240,300,600,1200,1800,3600,7200,18000,36000。此函数用于Yandex.Metrica报表中计算会话的持续时长。 + +## 圆数(num) {#roundagenum} + +接受一个数字。如果数字小于18,则返回0。否则,它将数字向下舍入为集合中的数字:18,25,35,45,55。此函数用于Yandex.Metrica报表中用户年龄的计算。 + +## roundDown(num,arr) {#rounddownnum-arr} + +接受一个数字,将其向下舍入到指定数组中的元素。如果该值小于数组中的最低边界,则返回最低边界。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/zh/sql-reference/functions/splitting-merging-functions.md b/docs/zh/sql-reference/functions/splitting-merging-functions.md new file mode 100644 index 00000000000..a29f4057d55 --- /dev/null +++ b/docs/zh/sql-reference/functions/splitting-merging-functions.md @@ -0,0 +1,29 @@ +# 字符串拆分合并函数 {#zi-fu-chuan-chai-fen-he-bing-han-shu} + +## splitByChar(分隔符,s) {#splitbycharseparator-s} + +将字符串以’separator’拆分成多个子串。’separator’必须为仅包含一个字符的字符串常量。 +返回拆分后的子串的数组。 如果分隔符出现在字符串的开头或结尾,或者如果有多个连续的分隔符,则将在对应位置填充空的子串。 + +## splitByString(分隔符,s) {#splitbystringseparator-s} + +与上面相同,但它使用多个字符的字符串作为分隔符。 该字符串必须为非空。 + +## arrayStringConcat(arr\[,分隔符\]) {#arraystringconcatarr-separator} + +使用separator将数组中列出的字符串拼接起来。’separator’是一个可选参数:一个常量字符串,默认情况下设置为空字符串。 +返回拼接后的字符串。 + +## alphaTokens(s) {#alphatokenss} + +从范围a-z和A-Z中选择连续字节的子字符串。返回子字符串数组。 + +**示例:** + + SELECT alphaTokens('abca1abc') + + ┌─alphaTokens('abca1abc')─┐ + │ ['abca','abc'] │ + └─────────────────────────┘ + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/zh/sql-reference/functions/string-functions.md b/docs/zh/sql-reference/functions/string-functions.md new file mode 100644 index 00000000000..da379fba197 --- /dev/null +++ b/docs/zh/sql-reference/functions/string-functions.md @@ -0,0 +1,169 @@ +# 字符串函数 {#zi-fu-chuan-han-shu} + +## 空 {#string-functions-empty} + +对于空字符串返回1,对于非空字符串返回0。 +结果类型是UInt8。 +如果字符串包含至少一个字节,则该字符串被视为非空字符串,即使这是一个空格或空字符。 +该函数也适用于数组。 + +## notEmpty {#notempty} + +对于空字符串返回0,对于非空字符串返回1。 +结果类型是UInt8。 +该函数也适用于数组。 + +## 长度 {#length} + +返回字符串的字节长度。 +结果类型是UInt64。 +该函数也适用于数组。 + +## 长度8 {#lengthutf8} + +假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 +结果类型是UInt64。 + +## char\_length,CHAR\_LENGTH {#char-length-char-length} + +假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 +结果类型是UInt64。 + +## 字符长度,字符长度 {#character-length-character-length} + +假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 +结果类型是UInt64。 + +## 低一点 {#lower-lcase} + +将字符串中的ASCII转换为小写。 + +## 上,ucase {#upper-ucase} + +将字符串中的ASCII转换为大写。 + +## lowerUTF8 {#lowerutf8} + +将字符串转换为小写,函数假设字符串是以UTF-8编码文本的字符集。 +同时函数不检测语言。因此对土耳其人来说,结果可能不完全正确。 +如果UTF-8字节序列的长度对于代码点的大写和小写不同,则该代码点的结果可能不正确。 +如果字符串包含一组非UTF-8的字节,则将引发未定义行为。 + +## upperUTF8 {#upperutf8} + +将字符串转换为大写,函数假设字符串是以UTF-8编码文本的字符集。 +同时函数不检测语言。因此对土耳其人来说,结果可能不完全正确。 +如果UTF-8字节序列的长度对于代码点的大写和小写不同,则该代码点的结果可能不正确。 +如果字符串包含一组非UTF-8的字节,则将引发未定义行为。 + +## isValidUTF8 {#isvalidutf8} + +检查字符串是否为有效的UTF-8编码,是则返回1,否则返回0。 + +## toValidUTF8 {#tovalidutf8} + +用`�`(U+FFFD)字符替换无效的UTF-8字符。所有连续的无效字符都会被替换为一个替换字符。 + + toValidUTF8( input_string ) + +参数: + +- input\_string — 任何一个[字符串](../../sql-reference/functions/string-functions.md)类型的对象。 + +返回值: 有效的UTF-8字符串。 + +### 示例 {#shi-li} + +``` sql +SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') +``` + +``` text +┌─toValidUTF8('a����b')─┐ +│ a�b │ +└───────────────────────┘ +``` + +## 反向 {#reverse} + +反转字符串。 + +## reverseUTF8 {#reverseutf8} + +以Unicode字符为单位反转UTF-8编码的字符串。如果字符串不是UTF-8编码,则可能获取到一个非预期的结果(不会抛出异常)。 + +## format(pattern, s0, s1, …) {#formatpattern-s0-s1} + +使用常量字符串`pattern`格式化其他参数。`pattern`字符串中包含由大括号`{}`包围的«替换字段»。 未被包含在大括号中的任何内容都被视为文本内容,它将原样保留在返回值中。 如果你需要在文本内容中包含一个大括号字符,它可以通过加倍来转义:`{{ '{{' }}`和`{{ '{{' }} '}}' }}`。 字段名称可以是数字(从零开始)或空(然后将它们视为连续数字) + +``` sql +SELECT format('{1} {0} {1}', 'World', 'Hello') + +┌─format('{1} {0} {1}', 'World', 'Hello')─┐ +│ Hello World Hello │ +└─────────────────────────────────────────┘ + +SELECT format('{} {}', 'Hello', 'World') + +┌─format('{} {}', 'Hello', 'World')─┐ +│ Hello World │ +└───────────────────────────────────┘ +``` + +## concat(s1, s2, …) {#concats1-s2} + +将参数中的多个字符串拼接,不带分隔符。 + +## concatAssumeInjective(s1, s2, …) {#concatassumeinjectives1-s2} + +与[concat](./string-functions.md#concat-s1-s2)相同,区别在于,你需要保证concat(s1, s2, s3) -\> s4是单射的,它将用于GROUP BY的优化。 + +## 子串(s,offset,length),mid(s,offset,length),substr(s,offset,length) {#substrings-offset-length-mids-offset-length-substrs-offset-length} + +以字节为单位截取指定位置字符串,返回以’offset’位置为开头,长度为’length’的子串。’offset’从1开始(与标准SQL相同)。’offset’和’length’参数必须是常量。 + +## substringf8(s,offset,length) {#substringutf8s-offset-length} + +与’substring’相同,但其操作单位为Unicode字符,函数假设字符串是以UTF-8进行编码的文本。如果不是则可能返回一个预期外的结果(不会抛出异常)。 + +## appendTrailingCharIfAbsent(s,c) {#appendtrailingcharifabsents-c} + +如果’s’字符串非空并且末尾不包含’c’字符,则将’c’字符附加到末尾。 + +## convertCharset(s,from,to) {#convertcharsets-from-to} + +返回从’from’中的编码转换为’to’中的编码的字符串’s’。 + +## base64Encode(s) {#base64encodes} + +将字符串’s’编码成base64 + +## base64Decode(s) {#base64decodes} + +使用base64将字符串解码成原始字符串。如果失败则抛出异常。 + +## tryBase64Decode(s) {#trybase64decodes} + +使用base64将字符串解码成原始字符串。但如果出现错误,将返回空字符串。 + +## endsWith(s,后缀) {#endswiths-suffix} + +返回是否以指定的后缀结尾。如果字符串以指定的后缀结束,则返回1,否则返回0。 + +## 开始使用(s,前缀) {#startswiths-prefix} + +返回是否以指定的前缀开头。如果字符串以指定的前缀开头,则返回1,否则返回0。 + +## trimLeft(s) {#trimlefts} + +返回一个字符串,用于删除左侧的空白字符。 + +## trimRight(s) {#trimrights} + +返回一个字符串,用于删除右侧的空白字符。 + +## trimBoth(s) {#trimboths} + +返回一个字符串,用于删除任一侧的空白字符。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/zh/sql-reference/functions/string-replace-functions.md b/docs/zh/sql-reference/functions/string-replace-functions.md new file mode 100644 index 00000000000..67346f5c156 --- /dev/null +++ b/docs/zh/sql-reference/functions/string-replace-functions.md @@ -0,0 +1,79 @@ +# 字符串替换函数 {#zi-fu-chuan-ti-huan-han-shu} + +## replaceOne(大海捞针,模式,更换) {#replaceonehaystack-pattern-replacement} + +用’replacement’子串替换’haystack’中与’pattern’子串第一个匹配的匹配项(如果存在)。 +’pattern’和’replacement’必须是常量。 + +## replaceAll(大海捞针,模式,替换),替换(大海捞针,模式,替换) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} + +用’replacement’子串替换’haystack’中出现的所有’pattern’子串。 + +## replaceRegexpOne(大海捞针,模式,更换) {#replaceregexponehaystack-pattern-replacement} + +使用’pattern’正则表达式替换。 ‘pattern’可以是任意一个有效的re2正则表达式。 +如果存在与正则表达式匹配的匹配项,仅替换第一个匹配项。 +同时‘replacement’可以指定为正则表达式中的捕获组。可以包含`\0-\9`。 +在这种情况下,函数将使用正则表达式的整个匹配项替换‘\\0’。使用其他与之对应的子模式替换对应的’\\1-\\9’。要在模版中使用’‘字符,请使用’’将其转义。 +另外还请记住,字符串文字需要额外的转义。 + +示例1.将日期转换为美国格式: + +``` sql +SELECT DISTINCT + EventDate, + replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res +FROM test.hits +LIMIT 7 +FORMAT TabSeparated +``` + + 2014-03-17 03/17/2014 + 2014-03-18 03/18/2014 + 2014-03-19 03/19/2014 + 2014-03-20 03/20/2014 + 2014-03-21 03/21/2014 + 2014-03-22 03/22/2014 + 2014-03-23 03/23/2014 + +示例2.复制字符串十次: + +``` sql +SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res +``` + + ┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ + └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ + +## replaceRegexpAll(大海捞针,模式,替换) {#replaceregexpallhaystack-pattern-replacement} + +与replaceRegexpOne相同,但会替换所有出现的匹配项。例如: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res +``` + + ┌─res────────────────────────┐ + │ HHeelllloo,, WWoorrlldd!! │ + └────────────────────────────┘ + +例外的是,如果使用正则表达式捕获空白子串,则仅会进行一次替换。 +示例: + +``` sql +SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res +``` + + ┌─res─────────────────┐ + │ here: Hello, World! │ + └─────────────────────┘ + +## regexpQuoteMeta(s) {#regexpquotemetas} + +该函数用于在字符串中的某些预定义字符之前添加反斜杠。 +预定义字符:‘0’,‘\\’,‘\|’,‘(’,‘)’,‘^’,‘$’,‘。’,‘\[’,‘\]’,‘?’,‘\*’,‘+’,‘{’,‘:’,’ - ’。 +这个实现与re2 :: RE2 :: QuoteMeta略有不同。它以\\0而不是00转义零字节,它只转义所需的字符。 +有关详细信息,请参阅链接:\[RE2\](https://github.com/google/re2/blob/master/re2/re2.cc\#L473) + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/zh/sql-reference/functions/string-search-functions.md b/docs/zh/sql-reference/functions/string-search-functions.md new file mode 100644 index 00000000000..2e1e4c784bd --- /dev/null +++ b/docs/zh/sql-reference/functions/string-search-functions.md @@ -0,0 +1,122 @@ +# 字符串搜索函数 {#zi-fu-chuan-sou-suo-han-shu} + +下列所有函数在默认的情况下区分大小写。对于不区分大小写的搜索,存在单独的变体。 + +## 位置(大海捞针),定位(大海捞针) {#positionhaystack-needle-locatehaystack-needle} + +在字符串`haystack`中搜索子串`needle`。 +返回子串的位置(以字节为单位),从1开始,如果未找到子串,则返回0。 + +对于不区分大小写的搜索,请使用函数`positionCaseInsensitive`。 + +## positionUTF8(大海捞针) {#positionutf8haystack-needle} + +与`position`相同,但位置以Unicode字符返回。此函数工作在UTF-8编码的文本字符集中。如非此编码的字符集,则返回一些非预期结果(他不会抛出异常)。 + +对于不区分大小写的搜索,请使用函数`positionCaseInsensitiveUTF8`。 + +## 多搜索分配(干草堆,\[针1,针2, …, needlen\]) {#multisearchallpositionshaystack-needle1-needle2-needlen} + +与`position`相同,但函数返回一个数组,其中包含所有匹配needle的位置。 + +对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchAllPositionsCaseInsensitive,multiSearchAllPositionsUTF8,multiSearchAllPositionsCaseInsensitiveUTF8`。 + +## multiSearchFirstPosition(大海捞针,\[针1,针2, …, needlen\]) {#multisearchfirstpositionhaystack-needle1-needle2-needlen} + +与`position`相同,但返回在`haystack`中与needles字符串匹配的最左偏移。 + +对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchFirstPositionCaseInsensitive,multiSearchFirstPositionUTF8,multiSearchFirstPositionCaseInsensitiveUTF8`。 + +## multiSearchFirstIndex(大海捞针,\[针1,针2, …, needlen\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} + +返回在字符串`haystack`中最先查找到的needle的索引`i`(从1开始),没有找到任何匹配项则返回0。 + +对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchFirstIndexCaseInsensitive,multiSearchFirstIndexUTF8,multiSearchFirstIndexCaseInsensitiveUTF8`。 + +## 多搜索(大海捞针,\[针1,针2, …, needlen\]) {#multisearchanyhaystack-needle1-needle2-needlen} + +如果`haystack`中至少存在一个needle匹配则返回1,否则返回0。 + +对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchAnyCaseInsensitive,multiSearchAnyUTF8,multiSearchAnyCaseInsensitiveUTF8`。 + +!!! note "注意" + 在所有`multiSearch*`函数中,由于实现规范,needles的数量应小于28。 + +## 匹配(大海捞针,模式) {#matchhaystack-pattern} + +检查字符串是否与`pattern`正则表达式匹配。`pattern`可以是一个任意的`re2`正则表达式。 `re2`正则表达式的[语法](https://github.com/google/re2/wiki/Syntax)比Perl正则表达式的语法存在更多限制。 + +如果不匹配返回0,否则返回1。 + +请注意,反斜杠符号(`\`)用于在正则表达式中转义。由于字符串中采用相同的符号来进行转义。因此,为了在正则表达式中转义符号,必须在字符串文字中写入两个反斜杠(\\)。 + +正则表达式与字符串一起使用,就像它是一组字节一样。正则表达式中不能包含空字节。 +对于在字符串中搜索子字符串的模式,最好使用LIKE或«position»,因为它们更加高效。 + +## multiMatchAny(大海捞针,\[模式1,模式2, …, patternn\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} + +与`match`相同,但如果所有正则表达式都不匹配,则返回0;如果任何模式匹配,则返回1。它使用[超扫描](https://github.com/intel/hyperscan)库。对于在字符串中搜索子字符串的模式,最好使用«multisearchany»,因为它更高效。 + +!!! note "注意" + 任何`haystack`字符串的长度必须小于232\字节,否则抛出异常。这种限制是因为hyperscan API而产生的。 + +## multiMatchAnyIndex(大海捞针,\[模式1,模式2, …, patternn\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} + +与`multiMatchAny`相同,但返回与haystack匹配的任何内容的索引位置。 + +## multiFuzzyMatchAny(干草堆,距离,\[模式1,模式2, …, patternn\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} + +与`multiMatchAny`相同,但如果在haystack能够查找到任何模式匹配能够在指定的[编辑距离](https://en.wikipedia.org/wiki/Edit_distance)内进行匹配,则返回1。此功能也处于实验模式,可能非常慢。有关更多信息,请参阅[hyperscan文档](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching)。 + +## multiFuzzyMatchAnyIndex(大海捞针,距离,\[模式1,模式2, …, patternn\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} + +与`multiFuzzyMatchAny`相同,但返回匹配项的匹配能容的索引位置。 + +!!! note "注意" + `multiFuzzyMatch*`函数不支持UTF-8正则表达式,由于hyperscan限制,这些表达式被按字节解析。 + +!!! note "注意" + 如要关闭所有hyperscan函数的使用,请设置`SET allow_hyperscan = 0;`。 + +## 提取(大海捞针,图案) {#extracthaystack-pattern} + +使用正则表达式截取字符串。如果’haystack’与’pattern’不匹配,则返回空字符串。如果正则表达式中不包含子模式,它将获取与整个正则表达式匹配的子串。否则,它将获取与第一个子模式匹配的子串。 + +## extractAll(大海捞针,图案) {#extractallhaystack-pattern} + +使用正则表达式提取字符串的所有片段。如果’haystack’与’pattern’正则表达式不匹配,则返回一个空字符串。否则返回所有与正则表达式匹配的字符串数组。通常,行为与’extract’函数相同(它采用第一个子模式,如果没有子模式,则采用整个表达式)。 + +## 像(干草堆,模式),干草堆像模式运算符 {#likehaystack-pattern-haystack-like-pattern-operator} + +检查字符串是否与简单正则表达式匹配。 +正则表达式可以包含的元符号有`%`和`_`。 + +`%` 表示任何字节数(包括零字符)。 + +`_` 表示任何一个字节。 + +可以使用反斜杠(`\`)来对元符号进行转义。请参阅«match»函数说明中有关转义的说明。 + +对于像`%needle%`这样的正则表达式,改函数与`position`函数一样快。 +对于其他正则表达式,函数与’match’函数相同。 + +## 不喜欢(干草堆,模式),干草堆不喜欢模式运算符 {#notlikehaystack-pattern-haystack-not-like-pattern-operator} + +与’like’函数返回相反的结果。 + +## 大海捞针) {#ngramdistancehaystack-needle} + +基于4-gram计算`haystack`和`needle`之间的距离:计算两个4-gram集合之间的对称差异,并用它们的基数和对其进行归一化。返回0到1之间的任何浮点数 – 越接近0则表示越多的字符串彼此相似。如果常量的`needle`或`haystack`超过32KB,函数将抛出异常。如果非常量的`haystack`或`needle`字符串超过32Kb,则距离始终为1。 + +对于不区分大小写的搜索或/和UTF-8格式,使用函数`ngramDistanceCaseInsensitive,ngramDistanceUTF8,ngramDistanceCaseInsensitiveUTF8`。 + +## ツ暗ェツ氾环催ツ団ツ法ツ人) {#ngramsearchhaystack-needle} + +与`ngramDistance`相同,但计算`needle`和`haystack`之间的非对称差异——`needle`的n-gram减去`needle`归一化n-gram。可用于模糊字符串搜索。 + +对于不区分大小写的搜索或/和UTF-8格式,使用函数`ngramSearchCaseInsensitive,ngramSearchUTF8,ngramSearchCaseInsensitiveUTF8`。 + +!!! note "注意" + 对于UTF-8,我们使用3-gram。所有这些都不是完全公平的n-gram距离。我们使用2字节哈希来散列n-gram,然后计算这些哈希表之间的(非)对称差异 - 可能会发生冲突。对于UTF-8不区分大小写的格式,我们不使用公平的`tolower`函数 - 我们将每个Unicode字符字节的第5位(从零开始)和字节的第一位归零 - 这适用于拉丁语,主要用于所有西里尔字母。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/zh/sql-reference/functions/type-conversion-functions.md b/docs/zh/sql-reference/functions/type-conversion-functions.md new file mode 100644 index 00000000000..011b2951e74 --- /dev/null +++ b/docs/zh/sql-reference/functions/type-conversion-functions.md @@ -0,0 +1,169 @@ +# 类型转换函数 {#lei-xing-zhuan-huan-han-shu} + +## toUInt8,toUInt16,toUInt32,toUInt64 {#touint8-touint16-touint32-touint64} + +## toInt8,toInt16,toInt32,toInt64 {#toint8-toint16-toint32-toint64} + +## toFloat32,toFloat64 {#tofloat32-tofloat64} + +## 今天,今天 {#todate-todatetime} + +## toUInt8OrZero,toUInt16OrZero,toUInt32OrZero,toUInt64OrZero,toInt8OrZero,toInt16OrZero,toInt32OrZero,toInt64OrZero,toFloat32OrZero,toFloat64OrZero,toDateOrZero,toDateTimeOrZero {#touint8orzero-touint16orzero-touint32orzero-touint64orzero-toint8orzero-toint16orzero-toint32orzero-toint64orzero-tofloat32orzero-tofloat64orzero-todateorzero-todatetimeorzero} + +## toUInt8OrNull,toUInt16OrNull,toUInt32OrNull,toUInt64OrNull,toInt8OrNull,toInt16OrNull,toInt32OrNull,toInt64OrNull,toFloat32OrNull,toFloat64OrNull,toDateOrNull,toDateTimeOrNull {#touint8ornull-touint16ornull-touint32ornull-touint64ornull-toint8ornull-toint16ornull-toint32ornull-toint64ornull-tofloat32ornull-tofloat64ornull-todateornull-todatetimeornull} + +## toString {#tostring} + +这些函数用于在数字、字符串(不包含FixedString)、Date以及DateTime之间互相转换。 +所有的函数都接受一个参数。 + +当将其他类型转换到字符串或从字符串转换到其他类型时,使用与TabSeparated格式相同的规则对字符串的值进行格式化或解析。如果无法解析字符串则抛出异常并取消查询。 + +当将Date转换为数字或反之,Date对应Unix时间戳的天数。 +将DataTime转换为数字或反之,DateTime对应Unix时间戳的秒数。 + +toDate/toDateTime函数的日期和日期时间格式定义如下: + + YYYY-MM-DD + YYYY-MM-DD hh:mm:ss + +例外的是,如果将UInt32、Int32、UInt64或Int64类型的数值转换为Date类型,并且其对应的值大于等于65536,则该数值将被解析成unix时间戳(而不是对应的天数)。这意味着允许写入’toDate(unix\_timestamp)‘这种常见情况,否则这将是错误的,并且需要便携更加繁琐的’toDate(toDateTime(unix\_timestamp))’。 + +Date与DateTime之间的转换以更为自然的方式进行:通过添加空的time或删除time。 + +数值类型之间的转换与C++中不同数字类型之间的赋值相同的规则。 + +此外,DateTime参数的toString函数可以在第二个参数中包含时区名称。 例如:`Asia/Yekaterinburg`在这种情况下,时间根据指定的时区进行格式化。 + +``` sql +SELECT + now() AS now_local, + toString(now(), 'Asia/Yekaterinburg') AS now_yekat +``` + + ┌───────────now_local─┬─now_yekat───────────┐ + │ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ + └─────────────────────┴─────────────────────┘ + +另请参阅`toUnixTimestamp`函数。 + +## toDecimal32(value,S),toDecimal64(value,S),toDecimal128(value,S) {#todecimal32value-s-todecimal64value-s-todecimal128value-s} + +将`value`转换为精度为`S`的[十进制](../../sql-reference/functions/type-conversion-functions.md)。`value`可以是数字或字符串。`S`参数为指定的小数位数。 + +## toFixedString(s,N) {#tofixedstrings-n} + +将String类型的参数转换为FixedString(N)类型的值(具有固定长度N的字符串)。N必须是一个常量。 +如果字符串的字节数少于N,则向右填充空字节。如果字符串的字节数多于N,则抛出异常。 + +## toStringCutToZero(s) {#tostringcuttozeros} + +接受String或FixedString参数。返回String,其内容在找到的第一个零字节处被截断。 + +示例: + +``` sql +SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut +``` + + ┌─s─────────────┬─s_cut─┐ + │ foo\0\0\0\0\0 │ foo │ + └───────────────┴───────┘ + +``` sql +SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut +``` + + ┌─s──────────┬─s_cut─┐ + │ foo\0bar\0 │ foo │ + └────────────┴───────┘ + +## reinterpretAsUInt8,reinterpretAsUInt16,reinterpretAsUInt32,reinterpretAsUInt64 {#reinterpretasuint8-reinterpretasuint16-reinterpretasuint32-reinterpretasuint64} + +## reinterpretAsInt8,reinterpretAsInt16,reinterpretAsInt32,reinterpretAsInt64 {#reinterpretasint8-reinterpretasint16-reinterpretasint32-reinterpretasint64} + +## reinterpretAsFloat32,reinterpretAsFloat64 {#reinterpretasfloat32-reinterpretasfloat64} + +## 重新解释日期,重新解释日期时间 {#reinterpretasdate-reinterpretasdatetime} + +这些函数接受一个字符串,并将放在字符串开头的字节解释为主机顺序中的数字(little endian)。如果字符串不够长,则函数就像使用必要数量的空字节填充字符串一样。如果字符串比需要的长,则忽略额外的字节。Date被解释为Unix时间戳的天数,DateTime被解释为Unix时间戳。 + +## 重新解释字符串 {#reinterpretasstring} + +此函数接受数字、Date或DateTime,并返回一个字符串,其中包含表示主机顺序(小端)的相应值的字节。从末尾删除空字节。例如,UInt32类型值255是一个字节长的字符串。 + +## reinterpretAsFixedString {#reinterpretasfixedstring} + +此函数接受数字、Date或DateTime,并返回包含表示主机顺序(小端)的相应值的字节的FixedString。从末尾删除空字节。例如,UInt32类型值255是一个长度为一个字节的FixedString。 + +## 演员(x,t) {#type_conversion_function-cast} + +将’x’转换为’t’数据类型。还支持语法CAST(x AS t) + +示例: + +``` sql +SELECT + '2016-06-15 23:00:00' AS timestamp, + CAST(timestamp AS DateTime) AS datetime, + CAST(timestamp AS Date) AS date, + CAST(timestamp, 'String') AS string, + CAST(timestamp, 'FixedString(22)') AS fixed_string +``` + + ┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ + │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ + └─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ + +将参数转换为FixedString(N),仅适用于String或FixedString(N)类型的参数。 + +支持将数据转换为[可为空](../../sql-reference/functions/type-conversion-functions.md)。例如: + + SELECT toTypeName(x) FROM t_null + + ┌─toTypeName(x)─┐ + │ Int8 │ + │ Int8 │ + └───────────────┘ + + SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null + + ┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ + │ Nullable(UInt16) │ + │ Nullable(UInt16) │ + └─────────────────────────────────────────┘ + +## 每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每 {#function-tointerval} + +将数字类型参数转换为Interval类型(时间区间)。 +Interval类型实际上是非常有用的,您可以使用此类型的数据直接与Date或DateTime执行算术运算。同时,ClickHouse为Interval类型数据的声明提供了更方便的语法。例如: + +``` sql +WITH + toDate('2019-01-01') AS date, + INTERVAL 1 WEEK AS interval_week, + toIntervalWeek(1) AS interval_to_week +SELECT + date + interval_week, + date + interval_to_week +``` + + ┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ + │ 2019-01-08 │ 2019-01-08 │ + └───────────────────────────┴──────────────────────────────┘ + +## parsedatetimebestefort {#type_conversion_functions-parsedatetimebesteffort} + +将数字类型参数解析为Date或DateTime类型。 +与toDate和toDateTime不同,parseDateTimeBestEffort可以进行更复杂的日期格式。 +有关详细信息,请参阅链接:[复杂日期格式](https://xkcd.com/1179/)。 + +## parsedatetimebestefortornull {#parsedatetimebesteffortornull} + +与[parsedatetimebestefort](#type_conversion_functions-parsedatetimebesteffort)相同,但它遇到无法处理的日期格式时返回null。 + +## parsedatetimebestefortorzero {#parsedatetimebesteffortorzero} + +与[parsedatetimebestefort](#type_conversion_functions-parsedatetimebesteffort)相同,但它遇到无法处理的日期格式时返回零Date或零DateTime。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/zh/sql-reference/functions/url-functions.md b/docs/zh/sql-reference/functions/url-functions.md new file mode 100644 index 00000000000..f967ccd4964 --- /dev/null +++ b/docs/zh/sql-reference/functions/url-functions.md @@ -0,0 +1,118 @@ +# URL函数 {#urlhan-shu} + +所有这些功能都不遵循RFC。它们被最大程度简化以提高性能。 + +## URL截取函数 {#urljie-qu-han-shu} + +如果URL中没有要截取的内容则返回空字符串。 + +### 协议 {#protocol} + +返回URL的协议。例如: http、ftp、mailto、magnet… + +### 域 {#domain} + +获取域名。 + +### domainwithoutww {#domainwithoutwww} + +返回域名并删除第一个’www.’。 + +### topLevelDomain {#topleveldomain} + +返回顶级域名。例如:.ru。 + +### 第一重要的元素分区域 {#firstsignificantsubdomain} + +返回«第一个有效子域名»。这并不是一个标准概念,仅用于Yandex.Metrica。如果顶级域名为’com’,‘net’,‘org’或者‘co’则第一个有效子域名为二级域名。否则则返回三级域名。例如,irstSignificantSubdomain (’https://news.yandex.ru/‘) = ’yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’。一些实现细节在未来可能会进行改变。 + +### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} + +返回包含顶级域名与第一个有效子域名之间的内容(请参阅上面的内容)。 + +例如, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. + +### 路径 {#path} + +返回URL路径。例如:`/top/news.html`,不包含请求参数。 + +### pathFull {#pathfull} + +与上面相同,但包括请求参数和fragment。例如:/top/news.html?page=2\#comments + +### 查询字符串 {#querystring} + +返回请求参数。例如:page=1&lr=213。请求参数不包含问号已经\# 以及\# 之后所有的内容。 + +### 片段 {#fragment} + +返回URL的fragment标识。fragment不包含\#。 + +### querystring andfragment {#querystringandfragment} + +返回请求参数和fragment标识。例如:page=1\#29390。 + +### extractURLParameter(URL,name) {#extracturlparameterurl-name} + +返回URL请求参数中名称为’name’的参数。如果不存在则返回一个空字符串。如果存在多个匹配项则返回第一个相匹配的。此函数假设参数名称与参数值在url中的编码方式相同。 + +### extractURLParameters(URL) {#extracturlparametersurl} + +返回一个数组,其中以name=value的字符串形式返回url的所有请求参数。不以任何编码解析任何内容。 + +### extractURLParameterNames(URL) {#extracturlparameternamesurl} + +返回一个数组,其中包含url的所有请求参数的名称。不以任何编码解析任何内容。 + +### URLHierarchy(URL) {#urlhierarchyurl} + +返回一个数组,其中包含以/切割的URL的所有内容。?将被包含在URL路径以及请求参数中。连续的分割符号被记为一个。 + +### Urlpathhierarchy(URL) {#urlpathhierarchyurl} + +与上面相同,但结果不包含协议和host部分。 /element(root)不包括在内。该函数用于在Yandex.Metric中实现导出URL的树形结构。 + + URLPathHierarchy('https://example.com/browse/CONV-6788') = + [ + '/browse/', + '/browse/CONV-6788' + ] + +### decodeURLComponent(URL) {#decodeurlcomponenturl} + +返回已经解码的URL。 +例如: + +``` sql +SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; +``` + + ┌─DecodedURL─────────────────────────────┐ + │ http://127.0.0.1:8123/?query=SELECT 1; │ + └────────────────────────────────────────┘ + +## 删除URL中的部分内容 {#shan-chu-urlzhong-de-bu-fen-nei-rong} + +如果URL中不包含指定的部分,则URL不变。 + +### cutWWW {#cutwww} + +删除开始的第一个’www.’。 + +### cutQueryString {#cutquerystring} + +删除请求参数。问号也将被删除。 + +### cutFragment {#cutfragment} + +删除fragment标识。\#同样也会被删除。 + +### cutquerystring andfragment {#cutquerystringandfragment} + +删除请求参数以及fragment标识。问号以及\#也会被删除。 + +### cutURLParameter(URL,name) {#cuturlparameterurl-name} + +删除URL中名称为’name’的参数。改函数假设参数名称以及参数值经过URL相同的编码。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/zh/sql-reference/functions/uuid-functions.md b/docs/zh/sql-reference/functions/uuid-functions.md new file mode 100644 index 00000000000..fb7cdcc4eff --- /dev/null +++ b/docs/zh/sql-reference/functions/uuid-functions.md @@ -0,0 +1,107 @@ +# UUID函数 {#uuidhan-shu} + +下面列出了所有UUID的相关函数 + +## generateuidv4 {#uuid-function-generate} + +生成一个UUID([版本4](https://tools.ietf.org/html/rfc4122#section-4.4))。 + +``` sql +generateUUIDv4() +``` + +**返回值** + +UUID类型的值。 + +**使用示例** + +此示例演示如何在表中创建UUID类型的列,并对其写入数据。 + +``` sql +:) CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog + +:) INSERT INTO t_uuid SELECT generateUUIDv4() + +:) SELECT * FROM t_uuid + +┌────────────────────────────────────x─┐ +│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ +└──────────────────────────────────────┘ +``` + +## toUUID(x) {#touuid-x} + +将String类型的值转换为UUID类型的值。 + +``` sql +toUUID(String) +``` + +**返回值** + +UUID类型的值 + +**使用示例** + +``` sql +:) SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid + +┌─────────────────────────────────uuid─┐ +│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ +└──────────────────────────────────────┘ +``` + +## UUIDStringToNum {#uuidstringtonum} + +接受一个String类型的值,其中包含36个字符且格式为`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,将其转换为UUID的数值并以[固定字符串(16)](../../sql-reference/functions/uuid-functions.md)将其返回。 + +``` sql +UUIDStringToNum(String) +``` + +**返回值** + +固定字符串(16) + +**使用示例** + +``` sql +:) SELECT + '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, + UUIDStringToNum(uuid) AS bytes + +┌─uuid─────────────────────────────────┬─bytes────────────┐ +│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ +└──────────────────────────────────────┴──────────────────┘ +``` + +## UUIDNumToString {#uuidnumtostring} + +接受一个[固定字符串(16)](../../sql-reference/functions/uuid-functions.md)类型的值,返回其对应的String表现形式。 + +``` sql +UUIDNumToString(FixedString(16)) +``` + +**返回值** + +字符串。 + +**使用示例** + +``` sql +SELECT + 'a/<@];!~p{jTj={)' AS bytes, + UUIDNumToString(toFixedString(bytes, 16)) AS uuid + +┌─bytes────────────┬─uuid─────────────────────────────────┐ +│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ +└──────────────────┴──────────────────────────────────────┘ +``` + +## 另请参阅 {#ling-qing-can-yue} + +- [dictgetuid](ext-dict-functions.md) + +[来源文章](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/zh/sql-reference/functions/ym-dict-functions.md b/docs/zh/sql-reference/functions/ym-dict-functions.md new file mode 100644 index 00000000000..c04405d81b4 --- /dev/null +++ b/docs/zh/sql-reference/functions/ym-dict-functions.md @@ -0,0 +1,120 @@ +# 功能与Yandex的工作。梅特里卡词典 {#functions-for-working-with-yandex-metrica-dictionaries} + +为了使下面的功能正常工作,服务器配置必须指定获取所有Yandex的路径和地址。梅特里卡字典. 字典在任何这些函数的第一次调用时加载。 如果无法加载引用列表,则会引发异常。 + +For information about creating reference lists, see the section «Dictionaries». + +## 多个地理基 {#multiple-geobases} + +ClickHouse支持同时使用多个备选地理基(区域层次结构),以支持某些地区所属国家的各种观点。 + +该 ‘clickhouse-server’ config指定具有区域层次结构的文件::`/opt/geo/regions_hierarchy.txt` + +除了这个文件,它还搜索附近有\_符号和任何后缀附加到名称(文件扩展名之前)的文件。 +例如,它还会找到该文件 `/opt/geo/regions_hierarchy_ua.txt`,如果存在。 + +`ua` 被称为字典键。 对于没有后缀的字典,键是空字符串。 + +所有字典都在运行时重新加载(每隔一定数量的秒重新加载一次,如builtin\_dictionaries\_reload\_interval config参数中定义,或默认情况下每小时一次)。 但是,可用字典列表在服务器启动时定义一次。 + +All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. +示例: + + regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt + regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt + regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt + +### ツ环板(ョツ嘉ッツ偲青regionシツ氾カツ鉄ツ工ツ渉\]) {#regiontocityid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. + +### 虏茅驴麓卤戮碌禄路戮鲁拢\]) {#regiontoareaid-geobase} + +将区域转换为区域(地理数据库中的类型5)。 在所有其他方式,这个功能是一样的 ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + + ┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ + │ │ + │ Moscow and Moscow region │ + │ St. Petersburg and Leningrad region │ + │ Belgorod region │ + │ Ivanovsk region │ + │ Kaluga region │ + │ Kostroma region │ + │ Kursk region │ + │ Lipetsk region │ + │ Orlov region │ + │ Ryazan region │ + │ Smolensk region │ + │ Tambov region │ + │ Tver region │ + │ Tula region │ + └──────────────────────────────────────────────────────┘ + +### regionToDistrict(id\[,geobase\]) {#regiontodistrictid-geobase} + +将区域转换为联邦区(地理数据库中的类型4)。 在所有其他方式,这个功能是一样的 ‘regionToCity’. + +``` sql +SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) +FROM system.numbers +LIMIT 15 +``` + + ┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ + │ │ + │ Central federal district │ + │ Northwest federal district │ + │ South federal district │ + │ North Caucases federal district │ + │ Privolga federal district │ + │ Ural federal district │ + │ Siberian federal district │ + │ Far East federal district │ + │ Scotland │ + │ Faroe Islands │ + │ Flemish region │ + │ Brussels capital region │ + │ Wallonia │ + │ Federation of Bosnia and Herzegovina │ + └──────────────────────────────────────────────────────────┘ + +### 虏茅驴麓卤戮碌禄路戮鲁拢(陆毛隆隆(803)888-8325\]) {#regiontocountryid-geobase} + +将区域转换为国家。 在所有其他方式,这个功能是一样的 ‘regionToCity’. +示例: `regionToCountry(toUInt32(213)) = 225` 转换莫斯科(213)到俄罗斯(225)。 + +### 掳胫((禄脢鹿脷露胫鲁隆鹿((酶-11-16""\[脪陆,ase\]) {#regiontocontinentid-geobase} + +将区域转换为大陆。 在所有其他方式,这个功能是一样的 ‘regionToCity’. +示例: `regionToContinent(toUInt32(213)) = 10001` 将莫斯科(213)转换为欧亚大陆(10001)。 + +### ツ环板(ョツ嘉ッツ偲青regionャツ静ャツ青サツ催ャツ渉\]) {#regiontopopulationid-geobase} + +获取区域的人口。 +The population can be recorded in files with the geobase. See the section «External dictionaries». +如果没有为该区域记录人口,则返回0。 +在Yandex地理数据库中,可能会为子区域记录人口,但不会为父区域记录人口。 + +### regionIn(lhs,rhs\[,地理数据库\]) {#regioninlhs-rhs-geobase} + +检查是否 ‘lhs’ 属于一个区域 ‘rhs’ 区域。 如果属于UInt8,则返回等于1的数字,如果不属于则返回0。 +The relationship is reflexive – any region also belongs to itself. + +### ツ暗ェツ氾环催ツ団ツ法ツ人\]) {#regionhierarchyid-geobase} + +Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. +示例: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. + +### 地区名称(id\[,郎\]) {#regiontonameid-lang} + +Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn’t exist, an empty string is returned. + +`ua` 和 `uk` 都意味着乌克兰。 + +[原始文章](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/zh/sql-reference/index.md b/docs/zh/sql-reference/index.md new file mode 100644 index 00000000000..59662c886b5 --- /dev/null +++ b/docs/zh/sql-reference/index.md @@ -0,0 +1,18 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_folder_title: "SQL\u53C2\u8003" +toc_hidden: true +toc_priority: 28 +toc_title: "\u9690\u85CF" +--- + +# SQL参考 {#sql-reference} + +- [SELECT](statements/select.md) +- [INSERT INTO](statements/insert-into.md) +- [CREATE](statements/create.md) +- [ALTER](statements/alter.md#query_language_queries_alter) +- [其他类型的查询](statements/misc.md) + +[原始文章](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/zh/sql-reference/operators.md b/docs/zh/sql-reference/operators.md new file mode 100644 index 00000000000..af3608f73af --- /dev/null +++ b/docs/zh/sql-reference/operators.md @@ -0,0 +1,263 @@ +# 操作符 {#cao-zuo-fu} + +所有的操作符(运算符)都会在查询时依据他们的优先级及其结合顺序在被解析时转换为对应的函数。下面按优先级从高到低列出各组运算符及其对应的函数: + +## 下标运算符 {#xia-biao-yun-suan-fu} + +`a[N]` – 数组中的第N个元素; 对应函数 `arrayElement(a, N)` + +`a.N` – 元组中第N个元素; 对应函数 `tupleElement(a, N)` + +## 负号 {#fu-hao} + +`-a` – 对应函数 `negate(a)` + +## 乘号、除号和取余 {#cheng-hao-chu-hao-he-qu-yu} + +`a * b` – 对应函数 `multiply(a, b)` + +`a / b` – 对应函数 `divide(a, b)` + +`a % b` – 对应函数 `modulo(a, b)` + +## 加号和减号 {#jia-hao-he-jian-hao} + +`a + b` – 对应函数 `plus(a, b)` + +`a - b` – 对应函数 `minus(a, b)` + +## 关系运算符 {#guan-xi-yun-suan-fu} + +`a = b` – 对应函数 `equals(a, b)` + +`a == b` – 对应函数 `equals(a, b)` + +`a != b` – 对应函数 `notEquals(a, b)` + +`a <> b` – 对应函数 `notEquals(a, b)` + +`a <= b` – 对应函数 `lessOrEquals(a, b)` + +`a >= b` – 对应函数 `greaterOrEquals(a, b)` + +`a < b` – 对应函数 `less(a, b)` + +`a > b` – 对应函数 `greater(a, b)` + +`a LIKE s` – 对应函数 `like(a, b)` + +`a NOT LIKE s` – 对应函数 `notLike(a, b)` + +`a BETWEEN b AND c` – 等价于 `a >= b AND a <= c` + +## 集合关系运算符 {#ji-he-guan-xi-yun-suan-fu} + +*详见此节 [IN 相关操作符](statements/select.md#select-in-operators) 。* + +`a IN ...` – 对应函数 `in(a, b)` + +`a NOT IN ...` – 对应函数 `notIn(a, b)` + +`a GLOBAL IN ...` – 对应函数 `globalIn(a, b)` + +`a GLOBAL NOT IN ...` – 对应函数 `globalNotIn(a, b)` + +## 逻辑非 {#luo-ji-fei} + +`NOT a` – 对应函数 `not(a)` + +## 逻辑与 {#luo-ji-yu} + +`a AND b` – 对应函数`and(a, b)` + +## 逻辑或 {#luo-ji-huo} + +`a OR b` – 对应函数 `or(a, b)` + +## 条件运算符 {#tiao-jian-yun-suan-fu} + +`a ? b : c` – 对应函数 `if(a, b, c)` + +注意: + +条件运算符会先计算表达式b和表达式c的值,再根据表达式a的真假,返回相应的值。如果表达式b和表达式c是 [arrayJoin()](../sql-reference/functions/array-join.md#functions_arrayjoin) 函数,则不管表达式a是真是假,每行都会被复制展开。 + +## 使用日期和时间的操作员 {#operators-datetime} + +### EXTRACT {#operator-extract} + +``` sql +EXTRACT(part FROM date); +``` + +从给定日期中提取部件。 例如,您可以从给定日期检索一个月,或从时间检索一秒钟。 + +该 `part` 参数指定要检索的日期部分。 以下值可用: + +- `DAY` — The day of the month. Possible values: 1–31. +- `MONTH` — The number of a month. Possible values: 1–12. +- `YEAR` — The year. +- `SECOND` — The second. Possible values: 0–59. +- `MINUTE` — The minute. Possible values: 0–59. +- `HOUR` — The hour. Possible values: 0–23. + +该 `part` 参数不区分大小写。 + +该 `date` 参数指定要处理的日期或时间。 无论是 [日期](../sql-reference/data-types/date.md) 或 [日期时间](../sql-reference/data-types/datetime.md) 支持类型。 + +例: + +``` sql +SELECT EXTRACT(DAY FROM toDate('2017-06-15')); +SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); +SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); +``` + +在下面的例子中,我们创建一个表,并在其中插入一个值 `DateTime` 类型。 + +``` sql +CREATE TABLE test.Orders +( + OrderId UInt64, + OrderName String, + OrderDate DateTime +) +ENGINE = Log; +``` + +``` sql +INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); +``` + +``` sql +SELECT + toYear(OrderDate) AS OrderYear, + toMonth(OrderDate) AS OrderMonth, + toDayOfMonth(OrderDate) AS OrderDay, + toHour(OrderDate) AS OrderHour, + toMinute(OrderDate) AS OrderMinute, + toSecond(OrderDate) AS OrderSecond +FROM test.Orders; +``` + +``` text +┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ +│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ +└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ +``` + +你可以看到更多的例子 [测试](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). + +### INTERVAL {#operator-interval} + +创建一个 [间隔](../sql-reference/operators.md)-应在算术运算中使用的类型值 [日期](../sql-reference/data-types/date.md) 和 [日期时间](../sql-reference/data-types/datetime.md)-类型值。 + +示例: + +``` sql +SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR +``` + +``` text +┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ +│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +**另请参阅** + +- [间隔](../sql-reference/operators.md) 数据类型 +- [toInterval](../sql-reference/operators.md#function-tointerval) 类型转换函数 + +## CASE条件表达式 {#operator_case} + +``` sql +CASE [x] + WHEN a THEN b + [WHEN ... THEN ...] + [ELSE c] +END +``` + +如果指定了 `x` ,该表达式会转换为 `transform(x, [a, ...], [b, ...], c)` 函数。否则转换为 `multiIf(a, b, ..., c)` + +如果该表达式中没有 `ELSE c` 子句,则默认值就是 `NULL` + +但 `transform` 函数不支持 `NULL` + +## 连接运算符 {#lian-jie-yun-suan-fu} + +`s1 || s2` – 对应函数 `concat(s1, s2)` + +## 创建 Lambda 函数 {#chuang-jian-lambda-han-shu} + +`x -> expr` – 对应函数 `lambda(x, expr)` + +接下来的这些操作符因为其本身是括号没有优先级: + +## 创建数组 {#chuang-jian-shu-zu} + +`[x1, ...]` – 对应函数 `array(x1, ...)` + +## 创建元组 {#chuang-jian-yuan-zu} + +`(x1, x2, ...)` – 对应函数 `tuple(x2, x2, ...)` + +## 结合方式 {#jie-he-fang-shi} + +所有的同级操作符从左到右结合。例如, `1 + 2 + 3` 会转换成 `plus(plus(1, 2), 3)`。 +所以,有时他们会跟我们预期的不太一样。例如, `SELECT 4 > 2 > 3` 的结果是0。 + +为了高效, `and` 和 `or` 函数支持任意多参数,一连串的 `AND` 和 `OR` 运算符会转换成其对应的单个函数。 + +## 判断是否为 `NULL` {#pan-duan-shi-fou-wei-null} + +ClickHouse 支持 `IS NULL` 和 `IS NOT NULL` 。 + +### IS NULL {#operator-is-null} + +- 对于 [可为空](../sql-reference/operators.md) 类型的值, `IS NULL` 会返回: + - `1` 值为 `NULL` + - `0` 否则 +- 对于其他类型的值, `IS NULL` 总会返回 `0` + + + +``` bash +:) SELECT x+100 FROM t_null WHERE y IS NULL + +SELECT x + 100 +FROM t_null +WHERE isNull(y) + +┌─plus(x, 100)─┐ +│ 101 │ +└──────────────┘ + +1 rows in set. Elapsed: 0.002 sec. +``` + +### IS NOT NULL {#is-not-null} + +- 对于 [可为空](../sql-reference/operators.md) 类型的值, `IS NOT NULL` 会返回: + - `0` 值为 `NULL` + - `1` 否则 +- 对于其他类型的值,`IS NOT NULL` 总会返回 `1` + + + +``` bash +:) SELECT * FROM t_null WHERE y IS NOT NULL + +SELECT * +FROM t_null +WHERE isNotNull(y) + +┌─x─┬─y─┐ +│ 2 │ 3 │ +└───┴───┘ + +1 rows in set. Elapsed: 0.002 sec. +``` + +[来源文章](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/zh/sql-reference/statements/alter.md b/docs/zh/sql-reference/statements/alter.md new file mode 100644 index 00000000000..1f02216b813 --- /dev/null +++ b/docs/zh/sql-reference/statements/alter.md @@ -0,0 +1,505 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 36 +toc_title: ALTER +--- + +## ALTER {#query_language_queries_alter} + +该 `ALTER` 查询仅支持 `*MergeTree` 表,以及 `Merge`和`Distributed`. 查询有几个变体。 + +### 列操作 {#column-manipulations} + +更改表结构。 + +``` sql +ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... +``` + +在查询中,指定一个或多个逗号分隔操作的列表。 +每个操作都是对列的操作。 + +支持以下操作: + +- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. +- [DROP COLUMN](#alter_drop-column) — Deletes the column. +- [CLEAR COLUMN](#alter_clear-column) — Resets column values. +- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. +- [MODIFY COLUMN](#alter_modify-column) — Changes column’s type, default expression and TTL. + +下面详细描述这些动作。 + +#### ADD COLUMN {#alter_add-column} + +``` sql +ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] +``` + +将一个新列添加到表中,并指定 `name`, `type`, [`codec`](create.md#codecs) 和 `default_expr` (请参阅部分 [默认表达式](create.md#create-default-values)). + +如果 `IF NOT EXISTS` 如果列已经存在,则查询不会返回错误。 如果您指定 `AFTER name_after` (另一列的名称),该列被添加在表列表中指定的一列之后。 否则,该列将添加到表的末尾。 请注意,没有办法将列添加到表的开头。 为了一系列的行动, `name_after` 可将该名称一栏,加入一个以前的行动。 + +添加列只是更改表结构,而不对数据执行任何操作。 数据不会出现在磁盘上后 `ALTER`. 如果从表中读取某一列的数据缺失,则将使用默认值填充该列(如果存在默认表达式,则执行默认表达式,或使用零或空字符串)。 合并数据部分后,该列将出现在磁盘上(请参阅 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md)). + +这种方法使我们能够完成 `ALTER` 即时查询,不增加旧数据量。 + +示例: + +``` sql +ALTER TABLE visits ADD COLUMN browser String AFTER user_id +``` + +#### DROP COLUMN {#alter_drop-column} + +``` sql +DROP COLUMN [IF EXISTS] name +``` + +删除具有名称的列 `name`. 如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 + +从文件系统中删除数据。 由于这将删除整个文件,查询几乎立即完成。 + +示例: + +``` sql +ALTER TABLE visits DROP COLUMN browser +``` + +#### CLEAR COLUMN {#alter_clear-column} + +``` sql +CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name +``` + +重置指定分区的列中的所有数据。 了解有关设置分区名称的详细信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). + +如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 + +示例: + +``` sql +ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() +``` + +#### COMMENT COLUMN {#alter_comment-column} + +``` sql +COMMENT COLUMN [IF EXISTS] name 'comment' +``` + +向列添加注释。 如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 + +每列可以有一个注释。 如果列的注释已存在,则新注释将复盖以前的注释。 + +注释存储在 `comment_expression` 由返回的列 [DESCRIBE TABLE](misc.md#misc-describe-table) 查询。 + +示例: + +``` sql +ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' +``` + +#### MODIFY COLUMN {#alter_modify-column} + +``` sql +MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] +``` + +此查询更改 `name` 列属性: + +- 类型 + +- 默认表达式 + +- TTL + + For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). + +如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 + +更改类型时,值将被转换为 [toType](../../sql-reference/functions/type-conversion-functions.md) 函数被应用到它们。 如果仅更改默认表达式,则查询不会执行任何复杂的操作,并且几乎立即完成。 + +示例: + +``` sql +ALTER TABLE visits MODIFY COLUMN browser Array(String) +``` + +Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. + +有几个处理阶段: + +- 准备具有修改数据的临时(新)文件。 +- 重命名旧文件。 +- 将临时(新)文件重命名为旧名称。 +- 删除旧文件。 + +只有第一阶段需要时间。 如果在此阶段出现故障,则不会更改数据。 +如果在其中一个连续阶段中出现故障,可以手动恢复数据。 例外情况是,如果旧文件从文件系统中删除,但新文件的数据没有写入磁盘并丢失。 + +该 `ALTER` 复制更改列的查询。 这些指令保存在ZooKeeper中,然后每个副本应用它们。 全部 `ALTER` 查询以相同的顺序运行。 查询等待对其他副本完成适当的操作。 但是,更改复制表中的列的查询可能会中断,并且所有操作都将异步执行。 + +#### 更改查询限制 {#alter-query-limitations} + +该 `ALTER` query允许您在嵌套数据结构中创建和删除单独的元素(列),但不能创建整个嵌套数据结构。 要添加嵌套数据结构,可以添加名称如下的列 `name.nested_name` 和类型 `Array(T)`. 嵌套数据结构等效于名称在点之前具有相同前缀的多个数组列。 + +不支持删除主键或采样键中的列(在主键中使用的列 `ENGINE` 表达式)。 只有在此更改不会导致数据被修改时,才可以更改主键中包含的列的类型(例如,允许您向枚举添加值或更改类型 `DateTime` 到 `UInt32`). + +如果 `ALTER` 查询不足以使您需要的表更改,您可以创建一个新的表,使用 [INSERT SELECT](insert-into.md#insert_query_insert-select) 查询,然后使用切换表 [RENAME](misc.md#misc_operations-rename) 查询并删除旧表。 您可以使用 [ツ环板-ョツ嘉ッツ偲](../../operations/utilities/clickhouse-copier.md) 作为替代 `INSERT SELECT` 查询。 + +该 `ALTER` 查询阻止对表的所有读取和写入。 换句话说,如果长 `SELECT` 正在运行的时间 `ALTER` 查询,该 `ALTER` 查询将等待它完成。 同时,对同一个表的所有新查询将等待 `ALTER` 正在运行。 + +对于本身不存储数据的表(例如 `Merge` 和 `Distributed`), `ALTER` 只是改变了表结构,并且不改变从属表的结构。 例如,当运行ALTER时 `Distributed` 表,你还需要运行 `ALTER` 对于所有远程服务器上的表。 + +### 使用键表达式进行操作 {#manipulations-with-key-expressions} + +支持以下命令: + +``` sql +MODIFY ORDER BY new_expression +``` + +它只适用于在表 [`MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) 家庭(包括 +[复制](../../engines/table-engines/mergetree-family/replication.md) 表)。 该命令更改 +[排序键](../../engines/table-engines/mergetree-family/mergetree.md) 表 +到 `new_expression` (表达式或表达式元组)。 主键保持不变。 + +该命令是轻量级的,因为它只更改元数据。 要保持该数据部分的属性 +行按排序键表达式排序您不能添加包含现有列的表达式 +到排序键(仅由列添加 `ADD COLUMN` 命令在同一个 `ALTER` 查询)。 + +### 使用数据跳过索引进行操作 {#manipulations-with-data-skipping-indices} + +它只适用于在表 [`*MergeTree`](../../engines/table-engines/mergetree-family/mergetree.md) 家庭(包括 +[复制](../../engines/table-engines/mergetree-family/replication.md) 表)。 以下操作 +可用: + +- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` -将索引描述添加到表元数据。 + +- `ALTER TABLE [db].name DROP INDEX name` -从表元数据中删除索引描述并从磁盘中删除索引文件。 + +这些命令是轻量级的,因为它们只更改元数据或删除文件。 +此外,它们被复制(通过ZooKeeper同步索引元数据)。 + +### 使用约束进行操作 {#manipulations-with-constraints} + +查看更多 [制约因素](create.md#constraints) + +可以使用以下语法添加或删除约束: + +``` sql +ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; +ALTER TABLE [db].name DROP CONSTRAINT constraint_name; +``` + +查询将从表中添加或删除有关约束的元数据,以便立即处理它们。 + +约束检查 *不会被执行* 在现有数据上,如果它被添加。 + +复制表上的所有更改都广播到ZooKeeper,因此将应用于其他副本。 + +### 操作与分区和零件 {#alter_manipulations-with-partitions} + +下面的操作与 [分区](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) 可用: + +- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` 目录和忘记它。 +- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. +- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` 目录到表。 +- [REPLACE PARTITION](#alter_replace-partition) -将数据分区从一个表复制到另一个表。 +- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. +- [REPLACE PARTITION](#alter_replace-partition) -将数据分区从一个表复制到另一个表并替换。 +- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition)-将数据分区从一个表移动到另一个表。 +- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) -重置分区中指定列的值。 +- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) -重置分区中指定的二级索引。 +- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. +- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. +- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. + + + +#### 分离分区{\#alter\_detach-partition} {#detach-partition-alter-detach-partition} + +``` sql +ALTER TABLE table_name DETACH PARTITION partition_expr +``` + +将指定分区的所有数据移动到 `detached` 目录。 服务器会忘记分离的数据分区,就好像它不存在一样。 服务器不会知道这个数据,直到你做 [ATTACH](#alter_attach-partition) 查询。 + +示例: + +``` sql +ALTER TABLE visits DETACH PARTITION 201901 +``` + +阅读有关在一节中设置分区表达式的信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). + +执行查询后,您可以对查询中的数据进行任何操作 `detached` directory — delete it from the file system, or just leave it. + +This query is replicated – it moves the data to the `detached` 所有副本上的目录。 请注意,您只能对领导副本执行此查询。 要确定副本是否为领导者,请执行 `SELECT` 查询到 [系统。副本](../../operations/system-tables.md#system_tables-replicas) 桌子 或者,它更容易使 `DETACH` 对所有副本进行查询-除了领导副本之外,所有副本都会引发异常。 + +#### DROP PARTITION {#alter_drop-partition} + +``` sql +ALTER TABLE table_name DROP PARTITION partition_expr +``` + +从表中删除指定的分区。 此查询将分区标记为非活动分区,并在大约10分钟内完全删除数据。 + +阅读有关在一节中设置分区表达式的信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). + +The query is replicated – it deletes data on all replicas. + +#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} + +``` sql +ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr +``` + +从中删除指定分区的指定部分或所有部分 `detached`. +了解有关在一节中设置分区表达式的详细信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). + +#### ATTACH PARTITION\|PART {#alter_attach-partition} + +``` sql +ALTER TABLE table_name ATTACH PARTITION|PART partition_expr +``` + +将数据从 `detached` 目录。 可以为整个分区或单独的部分添加数据。 例: + +``` sql +ALTER TABLE visits ATTACH PARTITION 201901; +ALTER TABLE visits ATTACH PART 201901_2_2_0; +``` + +了解有关在一节中设置分区表达式的详细信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). + +此查询被复制。 副本发起程序检查是否有数据在 `detached` 目录。 如果数据存在,则查询将检查其完整性。 如果一切正确,则查询将数据添加到表中。 所有其他副本都从副本发起程序下载数据。 + +所以你可以把数据到 `detached` 在一个副本上的目录,并使用 `ALTER ... ATTACH` 查询以将其添加到所有副本上的表中。 + +#### ATTACH PARTITION FROM {#alter_attach-partition-from} + +``` sql +ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 +``` + +此查询将数据分区从 `table1` 到 `table2` 将数据添加到存在 `table2`. 请注意,数据不会从中删除 `table1`. + +要使查询成功运行,必须满足以下条件: + +- 两个表必须具有相同的结构。 +- 两个表必须具有相同的分区键。 + +#### REPLACE PARTITION {#alter_replace-partition} + +``` sql +ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 +``` + +此查询将数据分区从 `table1` 到 `table2` 并替换在现有的分区 `table2`. 请注意,数据不会从中删除 `table1`. + +要使查询成功运行,必须满足以下条件: + +- 两个表必须具有相同的结构。 +- 两个表必须具有相同的分区键。 + +#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} + +``` sql +ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest +``` + +此查询将数据分区从 `table_source` 到 `table_dest` 删除数据 `table_source`. + +要使查询成功运行,必须满足以下条件: + +- 两个表必须具有相同的结构。 +- 两个表必须具有相同的分区键。 +- 两个表必须是相同的引擎系列。 (已复制或未复制) +- 两个表必须具有相同的存储策略。 + +#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} + +``` sql +ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr +``` + +重置分区中指定列中的所有值。 如果 `DEFAULT` 创建表时确定了子句,此查询将列值设置为指定的默认值。 + +示例: + +``` sql +ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 +``` + +#### FREEZE PARTITION {#alter_freeze-partition} + +``` sql +ALTER TABLE table_name FREEZE [PARTITION partition_expr] +``` + +此查询创建指定分区的本地备份。 如果 `PARTITION` 子句被省略,查询一次创建所有分区的备份。 + +!!! note "注" + 在不停止服务器的情况下执行整个备份过程。 + +请注意,对于旧式表,您可以指定分区名称的前缀(例如, ‘2019’)-然后查询为所有相应的分区创建备份。 阅读有关在一节中设置分区表达式的信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). + +在执行时,对于数据快照,查询将创建指向表数据的硬链接。 硬链接被放置在目录中 `/var/lib/clickhouse/shadow/N/...`,哪里: + +- `/var/lib/clickhouse/` 是配置中指定的工作ClickHouse目录。 +- `N` 是备份的增量编号。 + +!!! note "注" + 如果您使用 [用于在表中存储数据的一组磁盘](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes),该 `shadow/N` 目录出现在每个磁盘上,存储由匹配的数据部分 `PARTITION` 表达。 + +在备份内部创建的目录结构与在备份内部创建的目录结构相同 `/var/lib/clickhouse/`. 查询执行 ‘chmod’ 对于所有文件,禁止写入它们。 + +创建备份后,您可以从以下位置复制数据 `/var/lib/clickhouse/shadow/` 然后将其从本地服务器中删除。 请注意, `ALTER t FREEZE PARTITION` 不复制查询。 它仅在本地服务器上创建本地备份。 + +查询几乎立即创建备份(但首先它会等待对相应表的当前查询完成运行)。 + +`ALTER TABLE t FREEZE PARTITION` 仅复制数据,而不复制表元数据。 若要备份表元数据,请复制该文件 `/var/lib/clickhouse/metadata/database/table.sql` + +要从备份还原数据,请执行以下操作: + +1. 如果表不存在,则创建该表。 要查看查询,请使用。sql文件(替换 `ATTACH` 在它与 `CREATE`). +2. 从复制数据 `data/database/table/` 目录内的备份到 `/var/lib/clickhouse/data/database/table/detached/` 目录。 +3. 快跑 `ALTER TABLE t ATTACH PARTITION` 将数据添加到表的查询。 + +从备份还原不需要停止服务器。 + +有关备份和还原数据的详细信息,请参阅 [数据备份](../../operations/backup.md) 科。 + +#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} + +``` sql +ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr +``` + +查询的工作原理类似于 `CLEAR COLUMN`,但它重置索引而不是列数据。 + +#### FETCH PARTITION {#alter_fetch-partition} + +``` sql +ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' +``` + +从另一台服务器下载分区。 此查询仅适用于复制的表。 + +查询执行以下操作: + +1. 从指定的分片下载分区。 在 ‘path-in-zookeeper’ 您必须在ZooKeeper中指定分片的路径。 +2. 然后查询将下载的数据放到 `detached` 的目录 `table_name` 桌子 使用 [ATTACH PARTITION\|PART](#alter_attach-partition) 查询将数据添加到表中。 + +例如: + +``` sql +ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; +ALTER TABLE users ATTACH PARTITION 201902; +``` + +请注意: + +- 该 `ALTER ... FETCH PARTITION` 查询不被复制。 它将分区放置在 `detached` 仅在本地服务器上的目录。 +- 该 `ALTER TABLE ... ATTACH` 复制查询。 它将数据添加到所有副本。 数据被添加到从副本之一 `detached` 目录,以及其他-从相邻的副本。 + +在下载之前,系统会检查分区是否存在并且表结构匹配。 从正常副本中自动选择最合适的副本。 + +虽然查询被调用 `ALTER TABLE`,它不会更改表结构,并且不会立即更改表中可用的数据。 + +#### MOVE PARTITION\|PART {#alter_move-partition} + +将分区或数据部分移动到另一个卷或磁盘 `MergeTree`-发动机表。 看 [使用多个块设备进行数据存储](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-multiple-volumes). + +``` sql +ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' +``` + +该 `ALTER TABLE t MOVE` 查询: + +- 不复制,因为不同的副本可能具有不同的存储策略。 +- 如果未配置指定的磁盘或卷,则返回错误。 如果无法应用存储策略中指定的数据移动条件,Query还会返回错误。 +- 可以在返回错误的情况下,当要移动的数据已经被后台进程移动时,并发 `ALTER TABLE t MOVE` 查询或作为后台数据合并的结果。 在这种情况下,用户不应该执行任何其他操作。 + +示例: + +``` sql +ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' +ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' +``` + +#### 如何设置分区表达式 {#alter-how-to-specify-part-expr} + +您可以在以下内容中指定分区表达式 `ALTER ... PARTITION` 以不同方式查询: + +- 作为从值 `partition` 列 `system.parts` 桌子 例如, `ALTER TABLE visits DETACH PARTITION 201901`. +- 作为来自表列的表达式。 支持常量和常量表达式。 例如, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. +- 使用分区ID。 分区ID是用作文件系统和ZooKeeper中分区名称的分区的字符串标识符(如果可能的话,人类可读)。 分区ID必须在指定 `PARTITION ID` 子句,用单引号。 例如, `ALTER TABLE visits DETACH PARTITION ID '201901'`. +- 在 [ALTER ATTACH PART](#alter_attach-partition) 和 [DROP DETACHED PART](#alter_drop-detached) 查询时,要指定部件的名称,请将字符串文字与来自 `name` 列 [系统。detached\_parts](../../operations/system-tables.md#system_tables-detached_parts) 桌子 例如, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. + +指定分区时引号的使用取决于分区表达式的类型。 例如,对于 `String` 类型,你必须在引号中指定其名称 (`'`). 为 `Date` 和 `Int*` 类型不需要引号。 + +对于旧式表,您可以将分区指定为数字 `201901` 或者一个字符串 `'201901'`. 对于类型,新样式表的语法更严格(类似于值输入格式的解析器)。 + +上述所有规则也适用于 [OPTIMIZE](misc.md#misc_operations-optimize) 查询。 如果在优化非分区表时需要指定唯一的分区,请设置表达式 `PARTITION tuple()`. 例如: + +``` sql +OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; +``` + +的例子 `ALTER ... PARTITION` 查询在测试中演示 [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) 和 [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). + +### 使用表TTL进行操作 {#manipulations-with-table-ttl} + +你可以改变 [表TTL](../../engines/table-engines/mergetree-family/mergetree.md#mergetree-table-ttl) 请填写以下表格: + +``` sql +ALTER TABLE table-name MODIFY TTL ttl-expression +``` + +### ALTER查询的同步性 {#synchronicity-of-alter-queries} + +对于不可复制的表,所有 `ALTER` 查询是同步执行的。 对于可复制的表,查询仅添加相应操作的说明 `ZooKeeper`,并尽快执行操作本身。 但是,查询可以等待在所有副本上完成这些操作。 + +为 `ALTER ... ATTACH|DETACH|DROP` 查询,您可以使用 `replication_alter_partitions_sync` 设置设置等待。 +可能的值: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. + +### 突变 {#alter-mutations} + +突变是允许更改或删除表中的行的ALTER查询变体。 与标准相比 `UPDATE` 和 `DELETE` 用于点数据更改的查询,mutations适用于更改表中大量行的繁重操作。 支持的 `MergeTree` 表引擎系列,包括具有复制支持的引擎。 + +现有表可以按原样进行突变(无需转换),但是在将第一次突变应用于表之后,其元数据格式将与以前的服务器版本不兼容,并且无法回退到以前的版本。 + +当前可用的命令: + +``` sql +ALTER TABLE [db.]table DELETE WHERE filter_expr +``` + +该 `filter_expr` 必须是类型 `UInt8`. 查询删除表中此表达式采用非零值的行。 + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr +``` + +该 `filter_expr` 必须是类型 `UInt8`. 此查询将指定列的值更新为行中相应表达式的值。 `filter_expr` 取非零值。 使用以下命令将值转换为列类型 `CAST` 接线员 不支持更新用于计算主键或分区键的列。 + +``` sql +ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name +``` + +查询将重新生成二级索引 `name` 在分区中 `partition_name`. + +一个查询可以包含多个用逗号分隔的命令。 + +For\*MergeTree表的突变通过重写整个数据部分来执行。 没有原子性-部分被取代为突变的部分,只要他们准备好和 `SELECT` 在突变期间开始执行的查询将看到来自已经突变的部件的数据以及来自尚未突变的部件的数据。 + +突变完全按其创建顺序排序,并以该顺序应用于每个部分。 突变也使用插入进行部分排序-在提交突变之前插入到表中的数据将被突变,之后插入的数据将不会被突变。 请注意,突变不会以任何方式阻止插入。 + +Mutation查询在添加mutation条目后立即返回(如果将复制的表复制到ZooKeeper,则将非复制的表复制到文件系统)。 突变本身使用系统配置文件设置异步执行。 要跟踪突变的进度,您可以使用 [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) 桌子 即使重新启动ClickHouse服务器,成功提交的突变仍将继续执行。 一旦提交,没有办法回滚突变,但如果突变由于某种原因被卡住,可以使用 [`KILL MUTATION`](misc.md#kill-mutation) 查询。 + +已完成突变的条目不会立即删除(保留条目的数量由 `finished_mutations_to_keep` 存储引擎参数)。 旧的突变条目将被删除。 + +[原始文章](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/zh/sql-reference/statements/create.md b/docs/zh/sql-reference/statements/create.md new file mode 100644 index 00000000000..37b9cbb734e --- /dev/null +++ b/docs/zh/sql-reference/statements/create.md @@ -0,0 +1,263 @@ +## CREATE DATABASE {#create-database} + +该查询用于根据指定名称创建数据库。 + +``` sql +CREATE DATABASE [IF NOT EXISTS] db_name +``` + +数据库其实只是用于存放表的一个目录。 +如果查询中存在`IF NOT EXISTS`,则当数据库已经存在时,该查询不会返回任何错误。 + +## CREATE TABLE {#create-table-query} + +对于`CREATE TABLE`,存在以下几种方式。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) ENGINE = engine +``` + +在指定的’db’数据库中创建一个名为’name’的表,如果查询中没有包含’db’,则默认使用当前选择的数据库作为’db’。后面的是包含在括号中的表结构以及表引擎的声明。 +其中表结构声明是一个包含一组列描述声明的组合。如果表引擎是支持索引的,那么可以在表引擎的参数中对其进行说明。 + +在最简单的情况下,列描述是指`名称 类型`这样的子句。例如: `RegionID UInt32`。 +但是也可以为列另外定义默认值表达式(见后文)。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] +``` + +创建一个与`db2.name2`具有相同结构的表,同时你可以对其指定不同的表引擎声明。如果没有表引擎声明,则创建的表将与`db2.name2`使用相同的表引擎。 + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... +``` + +使用指定的引擎创建一个与`SELECT`子句的结果具有相同结构的表,并使用`SELECT`子句的结果填充它。 + +以上所有情况,如果指定了`IF NOT EXISTS`,那么在该表已经存在的情况下,查询不会返回任何错误。在这种情况下,查询几乎不会做任何事情。 + +在`ENGINE`子句后还可能存在一些其他的子句,更详细的信息可以参考 [表引擎](../../sql-reference/statements/create.md) 中关于建表的描述。 + +### 默认值 {#create-default-values} + +在列描述中你可以通过以下方式之一为列指定默认表达式:`DEFAULT expr`,`MATERIALIZED expr`,`ALIAS expr`。 +示例:`URLDomain String DEFAULT domain(URL)`。 + +如果在列描述中未定义任何默认表达式,那么系统将会根据类型设置对应的默认值,如:数值类型为零、字符串类型为空字符串、数组类型为空数组、日期类型为’0000-00-00’以及时间类型为’0000-00-00 00:00:00’。不支持使用NULL作为普通类型的默认值。 + +如果定义了默认表达式,则可以不定义列的类型。如果没有明确的定义类的类型,则使用默认表达式的类型。例如:`EventDate DEFAULT toDate(EventTime)` - 最终’EventDate’将使用’Date’作为类型。 + +如果同时指定了默认表达式与列的类型,则将使用类型转换函数将默认表达式转换为指定的类型。例如:`Hits UInt32 DEFAULT 0`与`Hits UInt32 DEFAULT toUInt32(0)`意思相同。 + +默认表达式可以包含常量或表的任意其他列。当创建或更改表结构时,系统将会运行检查,确保不会包含循环依赖。对于INSERT, 它仅检查表达式是否是可以解析的 - 它们可以从中计算出所有需要的列的默认值。 + +`DEFAULT expr` + +普通的默认值,如果INSERT中不包含指定的列,那么将通过表达式计算它的默认值并填充它。 + +`MATERIALIZED expr` + +物化表达式,被该表达式指定的列不能包含在INSERT的列表中,因为它总是被计算出来的。 +对于INSERT而言,不需要考虑这些列。 +另外,在SELECT查询中如果包含星号,此列不会被用来替换星号,这是因为考虑到数据转储,在使用`SELECT *`查询出的结果总能够被’INSERT’回表。 + +`ALIAS expr` + +别名。这样的列不会存储在表中。 +它的值不能够通过INSERT写入,同时使用SELECT查询星号时,这些列也不会被用来替换星号。 +但是它们可以显示的用于SELECT中,在这种情况下,在查询分析中别名将被替换。 + +当使用ALTER查询对添加新的列时,不同于为所有旧数据添加这个列,对于需要在旧数据中查询新列,只会在查询时动态计算这个新列的值。但是如果新列的默认表示中依赖其他列的值进行计算,那么同样会加载这些依赖的列的数据。 + +如果你向表中添加一个新列,并在之后的一段时间后修改它的默认表达式,则旧数据中的值将会被改变。请注意,在运行后台合并时,缺少的列的值将被计算后写入到合并后的数据部分中。 + +不能够为nested类型的列设置默认值。 + +### 制约因素 {#constraints} + +随着列描述约束可以定义: + +``` sql +CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], + ... + CONSTRAINT constraint_name_1 CHECK boolean_expr_1, + ... +) ENGINE = engine +``` + +`boolean_expr_1` 可以通过任何布尔表达式。 如果为表定义了约束,则将为表中的每一行检查它们中的每一行 `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. + +添加大量的约束会对big的性能产生负面影响 `INSERT` 查询。 + +### Ttl表达式 {#ttl-expression} + +定义值的存储时间。 只能为MergeTree系列表指定。 有关详细说明,请参阅 [列和表的TTL](../../sql-reference/statements/create.md#table_engine-mergetree-ttl). + +### 列压缩编解ecs {#codecs} + +默认情况下,ClickHouse应用以下定义的压缩方法 [服务器设置](../../sql-reference/statements/create.md#server-settings-compression),列。 您还可以定义在每个单独的列的压缩方法 `CREATE TABLE` 查询。 + +``` sql +CREATE TABLE codec_example +( + dt Date CODEC(ZSTD), + ts DateTime CODEC(LZ4HC), + float_value Float32 CODEC(NONE), + double_value Float64 CODEC(LZ4HC(9)) + value Float32 CODEC(Delta, ZSTD) +) +ENGINE = +... +``` + +如果指定了编解ec,则默认编解码器不适用。 编解码器可以组合在一个流水线中,例如, `CODEC(Delta, ZSTD)`. 要为您的项目选择最佳的编解码器组合,请通过类似于Altinity中描述的基准测试 [新编码提高ClickHouse效率](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) 文章. + +!!! warning "警告" + 您无法使用外部实用程序解压缩ClickHouse数据库文件,如 `lz4`. 相反,使用特殊的 [ツ环板compressorョツ嘉ッツ偲](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) 实用程序。 + +下表引擎支持压缩: + +- [MergeTree](../../sql-reference/statements/create.md) 家庭 +- [日志](../../sql-reference/statements/create.md) 家庭 +- [设置](../../sql-reference/statements/create.md) +- [加入我们](../../sql-reference/statements/create.md) + +ClickHouse支持通用编解码器和专用编解ecs。 + +#### 专业编解ecs {#create-query-specialized-codecs} + +这些编解码器旨在通过使用数据的特定功能使压缩更有效。 其中一些编解码器不压缩数据本身。 相反,他们准备的数据用于共同目的的编解ec,其压缩它比没有这种准备更好。 + +专业编解ecs: + +- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` 用于存储增量值,所以 `delta_bytes` 是原始值的最大大小。 可能 `delta_bytes` 值:1,2,4,8. 默认值 `delta_bytes` 是 `sizeof(type)` 如果等于1,2,4或8。 在所有其他情况下,它是1。 +- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla:一个快速、可扩展的内存时间序列数据库](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla:一个快速、可扩展的内存时间序列数据库](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). +- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` 和 `DateTime`). 在算法的每个步骤中,编解码器采用64个值块,将它们放入64x64位矩阵中,对其进行转置,裁剪未使用的值位并将其余部分作为序列返回。 未使用的位是使用压缩的整个数据部分的最大值和最小值之间没有区别的位。 + +`DoubleDelta` 和 `Gorilla` 编解码器在Gorilla TSDB中用作其压缩算法的组件。 大猩猩的方法是有效的情况下,当有缓慢变化的值与他们的时间戳序列。 时间戳是由有效地压缩 `DoubleDelta` 编解ec,和值有效地由压缩 `Gorilla` 编解ec 例如,要获取有效存储的表,可以在以下配置中创建它: + +``` sql +CREATE TABLE codec_example +( + timestamp DateTime CODEC(DoubleDelta), + slow_values Float32 CODEC(Gorilla) +) +ENGINE = MergeTree() +``` + +#### 通用编解ecs {#create-query-common-purpose-codecs} + +编解ecs: + +- `NONE` — No compression. +- `LZ4` — Lossless [数据压缩算法](https://github.com/lz4/lz4) 默认情况下使用。 应用LZ4快速压缩。 +- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` 应用默认级别。 可能的水平:\[1,12\]。 推荐级别范围:\[4,9\]。 +- `ZSTD[(level)]` — [ZSTD压缩算法](https://en.wikipedia.org/wiki/Zstandard) 可配置 `level`. 可能的水平:\[1,22\]。 默认值:1。 + +高压缩级别对于非对称场景非常有用,例如压缩一次,重复解压缩。 更高的级别意味着更好的压缩和更高的CPU使用率。 + +## 临时表 {#lin-shi-biao} + +ClickHouse支持临时表,其具有以下特征: + +- 当回话结束时,临时表将随会话一起消失,这包含链接中断。 +- 临时表仅能够使用Memory表引擎。 +- 无法为临时表指定数据库。它是在数据库之外创建的。 +- 如果临时表与另一个表名称相同,那么当在查询时没有显示的指定db的情况下,将优先使用临时表。 +- 对于分布式处理,查询中使用的临时表将被传递到远程服务器。 + +可以使用下面的语法创建一个临时表: + +``` sql +CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name [ON CLUSTER cluster] +( + name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], + name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], + ... +) +``` + +大多数情况下,临时表不是手动创建的,只有在分布式查询处理中使用`(GLOBAL) IN`时为外部数据创建。更多信息,可以参考相关章节。 + +## 分布式DDL查询 (ON CLUSTER 子句) {#fen-bu-shi-ddlcha-xun-on-cluster-zi-ju} + +对于 `CREATE`, `DROP`, `ALTER`,以及`RENAME`查询,系统支持其运行在整个集群上。 +例如,以下查询将在`cluster`集群的所有节点上创建名为`all_hits`的`Distributed`表: + +``` sql +CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) +``` + +为了能够正确的运行这种查询,每台主机必须具有相同的cluster声明(为了简化配置的同步,你可以使用zookeeper的方式进行配置)。同时这些主机还必须链接到zookeeper服务器。 +这个查询将最终在集群的每台主机上运行,即使一些主机当前处于不可用状态。同时它还保证了所有的查询在单台主机中的执行顺序。 + +## CREATE VIEW {#create-view} + +``` sql +CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... +``` + +创建一个视图。它存在两种可选择的类型:普通视图与物化视图。 + +普通视图不存储任何数据,只是执行从另一个表中的读取。换句话说,普通视图只是保存了视图的查询,当从视图中查询时,此查询被作为子查询用于替换FROM子句。 + +举个例子,假设你已经创建了一个视图: + +``` sql +CREATE VIEW view AS SELECT ... +``` + +还有一个查询: + +``` sql +SELECT a, b, c FROM view +``` + +这个查询完全等价于: + +``` sql +SELECT a, b, c FROM (SELECT ...) +``` + +物化视图存储的数据是由相应的SELECT查询转换得来的。 + +在创建物化视图时,你还必须指定表的引擎 - 将会使用这个表引擎存储数据。 + +目前物化视图的工作原理:当将数据写入到物化视图中SELECT子句所指定的表时,插入的数据会通过SELECT子句查询进行转换并将最终结果插入到视图中。 + +如果创建物化视图时指定了POPULATE子句,则在创建时将该表的数据插入到物化视图中。就像使用`CREATE TABLE ... AS SELECT ...`一样。否则,物化视图只会包含在物化视图创建后的新写入的数据。我们不推荐使用POPULATE,因为在视图创建期间写入的数据将不会写入其中。 + +当一个`SELECT`子句包含`DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`时,请注意,这些仅会在插入数据时在每个单独的数据块上执行。例如,如果你在其中包含了`GROUP BY`,则只会在查询期间进行聚合,但聚合范围仅限于单个批的写入数据。数据不会进一步被聚合。但是当你使用一些其他数据聚合引擎时这是例外的,如:`SummingMergeTree`。 + +目前对物化视图执行`ALTER`是不支持的,因此这可能是不方便的。如果物化视图是使用的`TO [db.]name`的方式进行构建的,你可以使用`DETACH`语句现将视图剥离,然后使用`ALTER`运行在目标表上,然后使用`ATTACH`将之前剥离的表重新加载进来。 + +视图看起来和普通的表相同。例如,你可以通过`SHOW TABLES`查看到它们。 + +没有单独的删除视图的语法。如果要删除视图,请使用`DROP TABLE`。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/create/) + +## CREATE DICTIONARY {#create-dictionary-query} + +``` sql +CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] +( + key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], + attr1 type2 [DEFAULT|EXPRESSION expr3], + attr2 type2 [DEFAULT|EXPRESSION expr4] +) +PRIMARY KEY key1, key2 +SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) +LAYOUT(LAYOUT_NAME([param_name param_value])) +LIFETIME([MIN val1] MAX val2) +``` diff --git a/docs/zh/sql_reference/statements/index.md b/docs/zh/sql-reference/statements/index.md similarity index 100% rename from docs/zh/sql_reference/statements/index.md rename to docs/zh/sql-reference/statements/index.md diff --git a/docs/zh/sql-reference/statements/insert-into.md b/docs/zh/sql-reference/statements/insert-into.md new file mode 100644 index 00000000000..e8b5edfdb37 --- /dev/null +++ b/docs/zh/sql-reference/statements/insert-into.md @@ -0,0 +1,67 @@ +## INSERT {#insert} + +INSERT查询主要用于向系统中添加数据. + +查询的基本格式: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... +``` + +您可以在查询中指定插入的列的列表,如:`[(c1, c2, c3)]`。对于存在于表结构中但不存在于插入列表中的列,它们将会按照如下方式填充数据: + +- 如果存在`DEFAULT`表达式,根据`DEFAULT`表达式计算被填充的值。 +- 如果没有定义`DEFAULT`表达式,则填充零或空字符串。 + +如果 [strict\_insert\_defaults=1](../../operations/settings/settings.md),你必须在查询中列出所有没有定义`DEFAULT`表达式的列。 + +数据可以以ClickHouse支持的任何 [输入输出格式](../../interfaces/formats.md#formats) 传递给INSERT。格式的名称必须显示的指定在查询中: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT format_name data_set +``` + +例如,下面的查询所使用的输入格式就与上面INSERT … VALUES的中使用的输入格式相同: + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... +``` + +ClickHouse会清除数据前所有的空白字符与一行摘要信息(如果需要的话)。所以在进行查询时,我们建议您将数据放入到输入输出格式名称后的新的一行中去(如果数据是以空白字符开始的,这将非常重要)。 + +示例: + +``` sql +INSERT INTO t FORMAT TabSeparated +11 Hello, world! +22 Qwerty +``` + +在使用命令行客户端或HTTP客户端时,你可以将具体的查询语句与数据分开发送。更多具体信息,请参考«[客户端](../../interfaces/index.md#interfaces)»部分。 + +### 使用`SELECT`的结果写入 {#insert_query_insert-select} + +``` sql +INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... +``` + +写入与SELECT的列的对应关系是使用位置来进行对应的,尽管它们在SELECT表达式与INSERT中的名称可能是不同的。如果需要,会对它们执行对应的类型转换。 + +除了VALUES格式之外,其他格式中的数据都不允许出现诸如`now()`,`1 + 2`等表达式。VALUES格式允许您有限度的使用这些表达式,但是不建议您这么做,因为执行这些表达式总是低效的。 + +系统不支持的其他用于修改数据的查询:`UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`。 +但是,您可以使用 `ALTER TABLE ... DROP PARTITION`查询来删除一些旧的数据。 + +### 性能的注意事项 {#xing-neng-de-zhu-yi-shi-xiang} + +在进行`INSERT`时将会对写入的数据进行一些处理,按照主键排序,按照月份对数据进行分区等。所以如果在您的写入数据中包含多个月份的混合数据时,将会显著的降低`INSERT`的性能。为了避免这种情况: + +- 数据总是以尽量大的batch进行写入,如每次写入100,000行。 +- 数据在写入ClickHouse前预先的对数据进行分组。 + +在以下的情况下,性能不会下降: + +- 数据总是被实时的写入。 +- 写入的数据已经按照时间排序。 + +[来源文章](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/zh/sql-reference/statements/misc.md b/docs/zh/sql-reference/statements/misc.md new file mode 100644 index 00000000000..91812489e58 --- /dev/null +++ b/docs/zh/sql-reference/statements/misc.md @@ -0,0 +1,252 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 39 +toc_title: "\u5176\u4ED6" +--- + +# 杂项查询 {#miscellaneous-queries} + +## ATTACH {#attach} + +这个查询是完全一样的 `CREATE`,但是 + +- 而不是这个词 `CREATE` 它使用这个词 `ATTACH`. +- 查询不会在磁盘上创建数据,但假定数据已经在适当的位置,只是将有关表的信息添加到服务器。 + 执行附加查询后,服务器将知道表的存在。 + +如果表之前已分离 (`DETACH`),意味着其结构是已知的,可以使用速记而不限定该结构。 + +``` sql +ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] +``` + +启动服务器时使用此查询。 服务器将表元数据作为文件存储 `ATTACH` 查询,它只是在启动时运行(除了在服务器上显式创建的系统表)。 + +## CHECK TABLE {#check-table} + +检查表中的数据是否已损坏。 + +``` sql +CHECK TABLE [db.]name +``` + +该 `CHECK TABLE` 查询将实际文件大小与存储在服务器上的预期值进行比较。 如果文件大小与存储的值不匹配,则表示数据已损坏。 例如,这可能是由查询执行期间的系统崩溃引起的。 + +查询响应包含 `result` 具有单行的列。 该行的值为 +[布尔值](../../sql-reference/data-types/boolean.md) 类型: + +- 0-表中的数据已损坏。 +- 1-数据保持完整性。 + +该 `CHECK TABLE` 查询支持下表引擎: + +- [日志](../../engines/table-engines/log-family/log.md) +- [TinyLog](../../engines/table-engines/log-family/tinylog.md) +- [StripeLog](../../engines/table-engines/log-family/stripelog.md) +- [梅树家族](../../engines/table-engines/mergetree-family/mergetree.md) + +使用另一个表引擎对表执行会导致异常。 + +从发动机 `*Log` 家庭不提供故障自动数据恢复。 使用 `CHECK TABLE` 查询以及时跟踪数据丢失。 + +为 `MergeTree` 家庭发动机, `CHECK TABLE` 查询显示本地服务器上表的每个单独数据部分的检查状态。 + +**如果数据已损坏** + +如果表已损坏,则可以将未损坏的数据复制到另一个表。 要做到这一点: + +1. 创建具有与损坏的表相同结构的新表。 要执行此操作,请执行查询 `CREATE TABLE AS `. +2. 设置 [max\_threads](../../operations/settings/settings.md#settings-max_threads) 值为1以在单个线程中处理下一个查询。 要执行此操作,请运行查询 `SET max_threads = 1`. +3. 执行查询 `INSERT INTO SELECT * FROM `. 此请求将未损坏的数据从损坏的表复制到另一个表。 只有损坏部分之前的数据才会被复制。 +4. 重新启动 `clickhouse-client` 要重置 `max_threads` 价值。 + +## DESCRIBE TABLE {#misc-describe-table} + +``` sql +DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +返回以下内容 `String` 类型列: + +- `name` — Column name. +- `type`— Column type. +- `default_type` — Clause that is used in [默认表达式](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` 或 `ALIAS`). 如果未指定默认表达式,则Column包含一个空字符串。 +- `default_expression` — Value specified in the `DEFAULT` 条款 +- `comment_expression` — Comment text. + +嵌套的数据结构输出 “expanded” 格式。 每列分别显示,名称后面有一个点。 + +## DETACH {#detach} + +删除有关 ‘name’ 表从服务器。 服务器停止了解表的存在。 + +``` sql +DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +这不会删除表的数据或元数据。 在下一次服务器启动时,服务器将读取元数据并再次查找有关表的信息。 +同样,一个 “detached” 表可以使用重新连接 `ATTACH` 查询(系统表除外,它们没有为它们存储元数据)。 + +没有 `DETACH DATABASE` 查询。 + +## DROP {#drop} + +此查询有两种类型: `DROP DATABASE` 和 `DROP TABLE`. + +``` sql +DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] +``` + +删除内部的所有表 ‘db’ 数据库,然后删除 ‘db’ 数据库本身。 +如果 `IF EXISTS` 如果数据库不存在,则不会返回错误。 + +``` sql +DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +删除表。 +如果 `IF EXISTS` 如果表不存在或数据库不存在,则不会返回错误。 + + DROP DICTIONARY [IF EXISTS] [db.]name + +删除字典。 +如果 `IF EXISTS` 如果表不存在或数据库不存在,则不会返回错误。 + +## EXISTS {#exists} + +``` sql +EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] +``` + +返回单 `UInt8`-type column,其中包含单个值 `0` 如果表或数据库不存在,或 `1` 如果该表存在于指定的数据库中。 + +## KILL QUERY {#kill-query} + +``` sql +KILL QUERY [ON CLUSTER cluster] + WHERE + [SYNC|ASYNC|TEST] + [FORMAT format] +``` + +尝试强制终止当前正在运行的查询。 +要终止的查询是从系统中选择的。使用在定义的标准进程表 `WHERE` 《公约》条款 `KILL` 查询。 + +例: + +``` sql +-- Forcibly terminates all queries with the specified query_id: +KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' + +-- Synchronously terminates all queries run by 'username': +KILL QUERY WHERE user='username' SYNC +``` + +只读用户只能停止自己的查询。 + +默认情况下,使用异步版本的查询 (`ASYNC`),不等待确认查询已停止。 + +同步版本 (`SYNC`)等待所有查询停止,并在停止时显示有关每个进程的信息。 +响应包含 `kill_status` 列,它可以采用以下值: + +1. ‘finished’ – The query was terminated successfully. +2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. +3. The other values ​​explain why the query can’t be stopped. + +测试查询 (`TEST`)仅检查用户的权限并显示要停止的查询列表。 + +## KILL MUTATION {#kill-mutation} + +``` sql +KILL MUTATION [ON CLUSTER cluster] + WHERE + [TEST] + [FORMAT format] +``` + +尝试取消和删除 [突变](alter.md#alter-mutations) 当前正在执行。 要取消的突变选自 [`system.mutations`](../../operations/system-tables.md#system_tables-mutations) 表使用由指定的过滤器 `WHERE` 《公约》条款 `KILL` 查询。 + +测试查询 (`TEST`)仅检查用户的权限并显示要停止的查询列表。 + +例: + +``` sql +-- Cancel and remove all mutations of the single table: +KILL MUTATION WHERE database = 'default' AND table = 'table' + +-- Cancel the specific mutation: +KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' +``` + +The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). + +已经由突变所做的更改不会回滚。 + +## OPTIMIZE {#misc_operations-optimize} + +``` sql +OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] +``` + +此查询尝试使用来自表引擎的表初始化表的数据部分的非计划合并 [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) 家人 + +该 `OPTMIZE` 查询也支持 [MaterializedView](../../engines/table-engines/special/materializedview.md) 和 [缓冲区](../../engines/table-engines/special/buffer.md) 引擎 不支持其他表引擎。 + +当 `OPTIMIZE` 与使用 [ReplicatedMergeTree](../../engines/table-engines/mergetree-family/replication.md) 表引擎的家族,ClickHouse创建合并任务,并等待在所有节点上执行(如果 `replication_alter_partitions_sync` 设置已启用)。 + +- 如果 `OPTIMIZE` 出于任何原因不执行合并,它不通知客户端。 要启用通知,请使用 [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) 设置。 +- 如果您指定 `PARTITION`,仅优化指定的分区。 [如何设置分区表达式](alter.md#alter-how-to-specify-part-expr). +- 如果您指定 `FINAL`,即使所有数据已经在一个部分中,也会执行优化。 +- 如果您指定 `DEDUPLICATE`,然后完全相同的行将被重复数据删除(所有列进行比较),这仅适用于MergeTree引擎。 + +!!! warning "警告" + `OPTIMIZE` 无法修复 “Too many parts” 错误 + +## RENAME {#misc_operations-rename} + +重命名一个或多个表。 + +``` sql +RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] +``` + +所有表都在全局锁定下重命名。 重命名表是一个轻型操作。 如果您在TO之后指定了另一个数据库,则表将被移动到此数据库。 但是,包含数据库的目录必须位于同一文件系统中(否则,将返回错误)。 + +## SET {#query-set} + +``` sql +SET param = value +``` + +分配 `value` 到 `param` [设置](../../operations/settings/index.md) 对于当前会话。 你不能改变 [服务器设置](../../operations/server-configuration-parameters/index.md) 这边 + +您还可以在单个查询中设置指定设置配置文件中的所有值。 + +``` sql +SET profile = 'profile-name-from-the-settings-file' +``` + +有关详细信息,请参阅 [设置](../../operations/settings/settings.md). + +## TRUNCATE {#truncate} + +``` sql +TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] +``` + +从表中删除所有数据。 当条款 `IF EXISTS` 如果该表不存在,则查询返回错误。 + +该 `TRUNCATE` 查询不支持 [查看](../../engines/table-engines/special/view.md), [文件](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md) 和 [Null](../../engines/table-engines/special/null.md) 表引擎. + +## USE {#use} + +``` sql +USE db +``` + +用于设置会话的当前数据库。 +当前数据库用于搜索表,如果数据库没有在查询中明确定义与表名之前的点。 +使用HTTP协议时无法进行此查询,因为没有会话的概念。 + +[原始文章](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/zh/sql-reference/statements/select.md b/docs/zh/sql-reference/statements/select.md new file mode 100644 index 00000000000..4fea66de6b3 --- /dev/null +++ b/docs/zh/sql-reference/statements/select.md @@ -0,0 +1,936 @@ +# SELECT 查询语法 {#select-cha-xun-yu-fa} + +`SELECT` 语句用于执行数据的检索。 + +``` sql +SELECT [DISTINCT] expr_list + [FROM [db.]table | (subquery) | table_function] [FINAL] + [SAMPLE sample_coeff] + [ARRAY JOIN ...] + [GLOBAL] ANY|ALL INNER|LEFT JOIN (subquery)|table USING columns_list + [PREWHERE expr] + [WHERE expr] + [GROUP BY expr_list] [WITH TOTALS] + [HAVING expr] + [ORDER BY expr_list] + [LIMIT n BY columns] + [LIMIT [n, ]m] + [UNION ALL ...] + [INTO OUTFILE filename] + [FORMAT format] +``` + +所有的子句都是可选的,除了SELECT之后的表达式列表(expr\_list)。 +下面将按照查询运行的顺序逐一对各个子句进行说明。 + +如果查询中不包含`DISTINCT`,`GROUP BY`,`ORDER BY`子句以及`IN`和`JOIN`子查询,那么它将仅使用O(1)数量的内存来完全流式的处理查询 +否则,这个查询将消耗大量的内存,除非你指定了这些系统配置:`max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`。它们规定了可以使用外部排序(将临时表存储到磁盘中)以及外部聚合,`目前系统不存在关于Join的配置`,更多关于它们的信息,可以参见«配置»部分。 + +### FROM 子句 {#select-from} + +如果查询中不包含FROM子句,那么将读取`system.one`。 +`system.one`中仅包含一行数据(此表实现了与其他数据库管理系统中的DUAL相同的功能)。 + +FROM子句规定了将从哪个表、或子查询、或表函数中读取数据;同时ARRAY JOIN子句和JOIN子句也可以出现在这里(见后文)。 + +可以使用包含在括号里的子查询来替代表。 +在这种情况下,子查询的处理将会构建在外部的查询内部。 +不同于SQL标准,子查询后无需指定别名。为了兼容,你可以在子查询后添加’AS 别名’,但是指定的名字不能被使用在任何地方。 + +也可以使用表函数来代替表,有关信息,参见«表函数»。 + +执行查询时,在查询中列出的所有列都将从对应的表中提取数据;如果你使用的是子查询的方式,则任何在外部查询中没有使用的列,子查询将从查询中忽略它们; +如果你的查询没有列出任何的列(例如,SELECT count() FROM t),则将额外的从表中提取一些列(最好的情况下是最小的列),以便计算行数。 + +最后的FINAL修饰符仅能够被使用在SELECT from CollapsingMergeTree场景中。当你为FROM指定了FINAL修饰符时,你的查询结果将会在查询过程中被聚合。需要注意的是,在这种情况下,查询将在单个流中读取所有相关的主键列,同时对需要的数据进行合并。这意味着,当使用FINAL修饰符时,查询将会处理的更慢。在大多数情况下,你应该避免使用FINAL修饰符。更多信息,请参阅«CollapsingMergeTree引擎»部分。 + +### SAMPLE 子句 {#select-sample-clause} + +通过SAMPLE子句用户可以进行近似查询处理,近似查询处理仅能工作在MergeTree\*类型的表中,并且在创建表时需要您指定采样表达式(参见«MergeTree 引擎»部分)。 + +`SAMPLE`子句可以使用`SAMPLE k`来表示,其中k可以是0到1的小数值,或者是一个足够大的正整数值。 + +当k为0到1的小数时,查询将使用’k’作为百分比选取数据。例如,`SAMPLE 0.1`查询只会检索数据总量的10%。 +当k为一个足够大的正整数时,查询将使用’k’作为最大样本数。例如, `SAMPLE 10000000`查询只会检索最多10,000,000行数据。 + +示例: + +``` sql +SELECT + Title, + count() * 10 AS PageViews +FROM hits_distributed +SAMPLE 0.1 +WHERE + CounterID = 34 + AND toDate(EventDate) >= toDate('2013-01-29') + AND toDate(EventDate) <= toDate('2013-02-04') + AND NOT DontCountHits + AND NOT Refresh + AND Title != '' +GROUP BY Title +ORDER BY PageViews DESC LIMIT 1000 +``` + +在这个例子中,查询将检索数据总量的0.1 (10%)的数据。值得注意的是,查询不会自动校正聚合函数最终的结果,所以为了得到更加精确的结果,需要将`count()`的结果手动乘以10。 + +当使用像`SAMPLE 10000000`这样的方式进行近似查询时,由于没有了任何关于将会处理了哪些数据或聚合函数应该被乘以几的信息,所以这种方式不适合在这种场景下使用。 + +使用相同的采样率得到的结果总是一致的:如果我们能够看到所有可能存在在表中的数据,那么相同的采样率总是能够得到相同的结果(在建表时使用相同的采样表达式),换句话说,系统在不同的时间,不同的服务器,不同表上总以相同的方式对数据进行采样。 + +例如,我们可以使用采样的方式获取到与不进行采样相同的用户ID的列表。这将表明,你可以在IN子查询中使用采样,或者使用采样的结果与其他查询进行关联。 + +### ARRAY JOIN 子句 {#select-array-join-clause} + +ARRAY JOIN子句可以帮助查询进行与数组和nested数据类型的连接。它有点类似arrayJoin函数,但它的功能更广泛。 + +`ARRAY JOIN` 本质上等同于`INNERT JOIN`数组。 例如: + + :) CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory + + CREATE TABLE arrays_test + ( + s String, + arr Array(UInt8) + ) ENGINE = Memory + + Ok. + + 0 rows in set. Elapsed: 0.001 sec. + + :) INSERT INTO arrays_test VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []) + + INSERT INTO arrays_test VALUES + + Ok. + + 3 rows in set. Elapsed: 0.001 sec. + + :) SELECT * FROM arrays_test + + SELECT * + FROM arrays_test + + ┌─s───────┬─arr─────┐ + │ Hello │ [1,2] │ + │ World │ [3,4,5] │ + │ Goodbye │ [] │ + └─────────┴─────────┘ + + 3 rows in set. Elapsed: 0.001 sec. + + :) SELECT s, arr FROM arrays_test ARRAY JOIN arr + + SELECT s, arr + FROM arrays_test + ARRAY JOIN arr + + ┌─s─────┬─arr─┐ + │ Hello │ 1 │ + │ Hello │ 2 │ + │ World │ 3 │ + │ World │ 4 │ + │ World │ 5 │ + └───────┴─────┘ + + 5 rows in set. Elapsed: 0.001 sec. + +你还可以为ARRAY JOIN子句指定一个别名,这时你可以通过这个别名来访问数组中的数据,但是数据本身仍然可以通过原来的名称进行访问。例如: + + :) SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a + + SELECT s, arr, a + FROM arrays_test + ARRAY JOIN arr AS a + + ┌─s─────┬─arr─────┬─a─┐ + │ Hello │ [1,2] │ 1 │ + │ Hello │ [1,2] │ 2 │ + │ World │ [3,4,5] │ 3 │ + │ World │ [3,4,5] │ 4 │ + │ World │ [3,4,5] │ 5 │ + └───────┴─────────┴───┘ + + 5 rows in set. Elapsed: 0.001 sec. + +当多个具有相同大小的数组使用逗号分割出现在ARRAY JOIN子句中时,ARRAY JOIN会将它们同时执行(直接合并,而不是它们的笛卡尔积)。例如: + + :) SELECT s, arr, a, num, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped + + SELECT s, arr, a, num, mapped + FROM arrays_test + ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(lambda(tuple(x), plus(x, 1)), arr) AS mapped + + ┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ + │ Hello │ [1,2] │ 1 │ 1 │ 2 │ + │ Hello │ [1,2] │ 2 │ 2 │ 3 │ + │ World │ [3,4,5] │ 3 │ 1 │ 4 │ + │ World │ [3,4,5] │ 4 │ 2 │ 5 │ + │ World │ [3,4,5] │ 5 │ 3 │ 6 │ + └───────┴─────────┴───┴─────┴────────┘ + + 5 rows in set. Elapsed: 0.002 sec. + + :) SELECT s, arr, a, num, arrayEnumerate(arr) FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num + + SELECT s, arr, a, num, arrayEnumerate(arr) + FROM arrays_test + ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num + + ┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ + │ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ + │ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ + │ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ + │ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ + │ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ + └───────┴─────────┴───┴─────┴─────────────────────┘ + + 5 rows in set. Elapsed: 0.002 sec. + +另外ARRAY JOIN也可以工作在nested数据结构上。例如: + + :) CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory + + CREATE TABLE nested_test + ( + s String, + nest Nested( + x UInt8, + y UInt32) + ) ENGINE = Memory + + Ok. + + 0 rows in set. Elapsed: 0.006 sec. + + :) INSERT INTO nested_test VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []) + + INSERT INTO nested_test VALUES + + Ok. + + 3 rows in set. Elapsed: 0.001 sec. + + :) SELECT * FROM nested_test + + SELECT * + FROM nested_test + + ┌─s───────┬─nest.x──┬─nest.y─────┐ + │ Hello │ [1,2] │ [10,20] │ + │ World │ [3,4,5] │ [30,40,50] │ + │ Goodbye │ [] │ [] │ + └─────────┴─────────┴────────────┘ + + 3 rows in set. Elapsed: 0.001 sec. + + :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest + + SELECT s, `nest.x`, `nest.y` + FROM nested_test + ARRAY JOIN nest + + ┌─s─────┬─nest.x─┬─nest.y─┐ + │ Hello │ 1 │ 10 │ + │ Hello │ 2 │ 20 │ + │ World │ 3 │ 30 │ + │ World │ 4 │ 40 │ + │ World │ 5 │ 50 │ + └───────┴────────┴────────┘ + + 5 rows in set. Elapsed: 0.001 sec. + +当你在ARRAY JOIN指定nested数据类型的名称时,其作用与与包含所有数组元素的ARRAY JOIN相同,例如: + + :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y + + SELECT s, `nest.x`, `nest.y` + FROM nested_test + ARRAY JOIN `nest.x`, `nest.y` + + ┌─s─────┬─nest.x─┬─nest.y─┐ + │ Hello │ 1 │ 10 │ + │ Hello │ 2 │ 20 │ + │ World │ 3 │ 30 │ + │ World │ 4 │ 40 │ + │ World │ 5 │ 50 │ + └───────┴────────┴────────┘ + + 5 rows in set. Elapsed: 0.001 sec. + +这种方式也是可以运行的: + + :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x + + SELECT s, `nest.x`, `nest.y` + FROM nested_test + ARRAY JOIN `nest.x` + + ┌─s─────┬─nest.x─┬─nest.y─────┐ + │ Hello │ 1 │ [10,20] │ + │ Hello │ 2 │ [10,20] │ + │ World │ 3 │ [30,40,50] │ + │ World │ 4 │ [30,40,50] │ + │ World │ 5 │ [30,40,50] │ + └───────┴────────┴────────────┘ + + 5 rows in set. Elapsed: 0.001 sec. + +为了方便使用原来的nested类型的数组,你可以为nested类型定义一个别名。例如: + + :) SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n + + SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` + FROM nested_test + ARRAY JOIN nest AS n + + ┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ + │ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ + │ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ + │ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ + │ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ + │ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ + └───────┴─────┴─────┴─────────┴────────────┘ + + 5 rows in set. Elapsed: 0.001 sec. + +使用arrayEnumerate函数的示例: + + :) SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num + + SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num + FROM nested_test + ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num + + ┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ + │ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ + │ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ + │ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ + │ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ + │ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ + └───────┴─────┴─────┴─────────┴────────────┴─────┘ + + 5 rows in set. Elapsed: 0.002 sec. + +在一个查询中只能出现一个ARRAY JOIN子句。 + +如果在WHERE/PREWHERE子句中使用了ARRAY JOIN子句的结果,它将优先于WHERE/PREWHERE子句执行,否则它将在WHERE/PRWHERE子句之后执行,以便减少计算。 + +### JOIN 子句 {#select-join} + +JOIN子句用于连接数据,作用与[SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL))的定义相同。 + +!!! info "注意" + 与 [ARRAY JOIN](#select-array-join-clause) 没有关系. + +``` sql +SELECT +FROM +[GLOBAL] [ANY|ALL] INNER|LEFT|RIGHT|FULL|CROSS [OUTER] JOIN +(ON )|(USING ) ... +``` + +可以使用具体的表名来代替``与``。但这与使用`SELECT * FROM table`子查询的方式相同。除非你的表是\[Join\](../operations/table\_engines/join.md +**支持的`JOIN`类型** + +- `INNER JOIN` +- `LEFT OUTER JOIN` +- `RIGHT OUTER JOIN` +- `FULL OUTER JOIN` +- `CROSS JOIN` + +你可以跳过默认的`OUTER`关键字。 + +**`ANY` 与 `ALL`** + +在使用`ALL`修饰符对JOIN进行修饰时,如果右表中存在多个与左表关联的数据,那么系统则将右表中所有可以与左表关联的数据全部返回在结果中。这与SQL标准的JOIN行为相同。 +在使用`ANY`修饰符对JOIN进行修饰时,如果右表中存在多个与左表关联的数据,那么系统仅返回第一个与左表匹配的结果。如果左表与右表一一对应,不存在多余的行时,`ANY`与`ALL`的结果相同。 + +你可以在会话中通过设置 [join\_default\_strictness](../../operations/settings/settings.md) 来指定默认的JOIN修饰符。 + +**`GLOBAL` 分布** + +当使用普通的`JOIN`时,查询将被发送给远程的服务器。并在这些远程服务器上生成右表并与它们关联。换句话说,右表来自于各个服务器本身。 + +当使用`GLOBAL ... JOIN`,首先会在请求服务器上计算右表并以临时表的方式将其发送到所有服务器。这时每台服务器将直接使用它进行计算。 + +使用`GLOBAL`时需要小心。更多信息,参阅 [分布式子查询](#select-distributed-subqueries) 部分。 + +**使用建议** + +从子查询中删除所有`JOIN`不需要的列。 + +当执行`JOIN`查询时,因为与其他阶段相比没有进行执行顺序的优化:JOIN优先于WHERE与聚合执行。因此,为了显示的指定执行顺序,我们推荐你使用子查询的方式执行`JOIN`。 + +示例: + +``` sql +SELECT + CounterID, + hits, + visits +FROM +( + SELECT + CounterID, + count() AS hits + FROM test.hits + GROUP BY CounterID +) ANY LEFT JOIN +( + SELECT + CounterID, + sum(Sign) AS visits + FROM test.visits + GROUP BY CounterID +) USING CounterID +ORDER BY hits DESC +LIMIT 10 +``` + + ┌─CounterID─┬───hits─┬─visits─┐ + │ 1143050 │ 523264 │ 13665 │ + │ 731962 │ 475698 │ 102716 │ + │ 722545 │ 337212 │ 108187 │ + │ 722889 │ 252197 │ 10547 │ + │ 2237260 │ 196036 │ 9522 │ + │ 23057320 │ 147211 │ 7689 │ + │ 722818 │ 90109 │ 17847 │ + │ 48221 │ 85379 │ 4652 │ + │ 19762435 │ 77807 │ 7026 │ + │ 722884 │ 77492 │ 11056 │ + └───────────┴────────┴────────┘ + +子查询不允许您设置别名或在其他地方引用它们。 +`USING`中指定的列必须在两个子查询中具有相同的名称,而其他列必须具有不同的名称。您可以通过使用别名的方式来更改子查询中的列名(示例中就分别使用了’hits’与’visits’别名)。 + +`USING`子句用于指定要进行链接的一个或多个列,系统会将这些列在两张表中相等的值连接起来。如果列是一个列表,不需要使用括号包裹。同时JOIN不支持其他更复杂的Join方式。 + +右表(子查询的结果)将会保存在内存中。如果没有足够的内存,则无法运行`JOIN`。 + +只能在查询中指定一个`JOIN`。若要运行多个`JOIN`,你可以将它们放入子查询中。 + +每次运行相同的`JOIN`查询,总是会再次计算 - 没有缓存结果。 为了避免这种情况,可以使用’Join’引擎,它是一个预处理的Join数据结构,总是保存在内存中。更多信息,参见«Join引擎»部分。 + +在一些场景下,使用`IN`代替`JOIN`将会得到更高的效率。在各种类型的JOIN中,最高效的是`ANY LEFT JOIN`,然后是`ANY INNER JOIN`,效率最差的是`ALL LEFT JOIN`以及`ALL INNER JOIN`。 + +如果你需要使用`JOIN`来关联一些纬度表(包含纬度属性的一些相对比较小的表,例如广告活动的名称),那么`JOIN`可能不是好的选择,因为语法负责,并且每次查询都将重新访问这些表。对于这种情况,您应该使用«外部字典»的功能来替换`JOIN`。更多信息,参见 [外部字典](../../sql-reference/statements/select.md) 部分。 + +#### Null的处理 {#nullde-chu-li} + +JOIN的行为受 [join\_use\_nulls](../../operations/settings/settings.md) 的影响。当`join_use_nulls=1`时,`JOIN`的工作与SQL标准相同。 + +如果JOIN的key是 [可为空](../../sql-reference/statements/select.md) 类型的字段,则其中至少一个存在 [NULL](../syntax.md) 值的key不会被关联。 + +### WHERE 子句 {#select-where} + +如果存在WHERE子句, 则在该子句中必须包含一个UInt8类型的表达式。 这个表达是通常是一个带有比较和逻辑的表达式。 +这个表达式将会在所有数据转换前用来过滤数据。 + +如果在支持索引的数据库表引擎中,这个表达式将被评估是否使用索引。 + +### PREWHERE 子句 {#prewhere-zi-ju} + +这个子句与WHERE子句的意思相同。主要的不同之处在于表数据的读取。 +当使用PREWHERE时,首先只读取PREWHERE表达式中需要的列。然后在根据PREWHERE执行的结果读取其他需要的列。 + +如果在过滤条件中有少量不适合索引过滤的列,但是它们又可以提供很强的过滤能力。这时使用PREWHERE是有意义的,因为它将帮助减少数据的读取。 + +例如,在一个需要提取大量列的查询中为少部分列编写PREWHERE是很有作用的。 + +PREWHERE 仅支持`*MergeTree`系列引擎。 + +在一个查询中可以同时指定PREWHERE和WHERE,在这种情况下,PREWHERE优先于WHERE执行。 + +值得注意的是,PREWHERE不适合用于已经存在于索引中的列,因为当列已经存在于索引中的情况下,只有满足索引的数据块才会被读取。 + +如果将’optimize\_move\_to\_prewhere’设置为1,并且在查询中不包含PREWHERE,则系统将自动的把适合PREWHERE表达式的部分从WHERE中抽离到PREWHERE中。 + +### GROUP BY 子句 {#select-group-by-clause} + +这是列式数据库管理系统中最重要的一部分。 + +如果存在GROUP BY子句,则在该子句中必须包含一个表达式列表。其中每个表达式将会被称之为«key»。 +SELECT,HAVING,ORDER BY子句中的表达式列表必须来自于这些«key»或聚合函数。简而言之,被选择的列中不能包含非聚合函数或key之外的其他列。 + +如果查询表达式列表中仅包含聚合函数,则可以省略GROUP BY子句,这时会假定将所有数据聚合成一组空«key»。 + +示例: + +``` sql +SELECT + count(), + median(FetchTiming > 60 ? 60 : FetchTiming), + count() - sum(Refresh) +FROM hits +``` + +与SQL标准不同的是,如果表中不存在任何数据(可能表本身中就不存在任何数据,或者由于被WHERE条件过滤掉了),将返回一个空结果,而不是一个包含聚合函数初始值的结果。 + +与MySQL不同的是(实际上这是符合SQL标准的),你不能够获得一个不在key中的非聚合函数列(除了常量表达式)。但是你可以使用’any’(返回遇到的第一个值)、max、min等聚合函数使它工作。 + +示例: + +``` sql +SELECT + domainWithoutWWW(URL) AS domain, + count(), + any(Title) AS title -- getting the first occurred page header for each domain. +FROM hits +GROUP BY domain +``` + +GROUP BY子句会为遇到的每一个不同的key计算一组聚合函数的值。 + +在GROUP BY子句中不支持使用Array类型的列。 + +常量不能作为聚合函数的参数传入聚合函数中。例如: sum(1)。这种情况下你可以省略常量。例如:`count()`。 + +#### NULL 处理 {#null-chu-li} + +对于GROUP BY子句,ClickHouse将 [NULL](../syntax.md) 解释为一个值,并且支持`NULL=NULL`。 + +下面这个例子将说明这将意味着什么。 + +假设你有这样一张表: + + ┌─x─┬────y─┐ + │ 1 │ 2 │ + │ 2 │ ᴺᵁᴸᴸ │ + │ 3 │ 2 │ + │ 3 │ 3 │ + │ 3 │ ᴺᵁᴸᴸ │ + └───┴──────┘ + +运行`SELECT sum(x), y FROM t_null_big GROUP BY y`你将得到如下结果: + + ┌─sum(x)─┬────y─┐ + │ 4 │ 2 │ + │ 3 │ 3 │ + │ 5 │ ᴺᵁᴸᴸ │ + └────────┴──────┘ + +你可以看到GROUP BY为`y=NULL`的聚合了x。 + +如果你在向`GROUP BY`中放入几个key,结果将列出所有的组合可能。就像`NULL`是一个特定的值一样。 + +#### WITH TOTALS 修饰符 {#with-totals-xiu-shi-fu} + +如果你指定了WITH TOTALS修饰符,你将会在结果中得到一个被额外计算出的行。在这一行中将包含所有key的默认值(零或者空值),以及所有聚合函数对所有被选择数据行的聚合结果。 + +该行仅在JSON\*, TabSeparated\*, Pretty\*输出格式中与其他行分开输出。 + +在JSON\*输出格式中,这行将出现在Json的’totals’字段中。在TabSeparated\*输出格式中,这行将位于其他结果之后,同时与其他结果使用空白行分隔。在Pretty\*输出格式中,这行将作为单独的表在所有结果之后输出。 + +当`WITH TOTALS`与HAVING子句同时存在时,它的行为受’totals\_mode’配置的影响。 +默认情况下,`totals_mode = 'before_having'`,这时`WITH TOTALS`将会在HAVING前计算最多不超过`max_rows_to_group_by`行的数据。 + +在`group_by_overflow_mode = 'any'`并指定了`max_rows_to_group_by`的情况下,`WITH TOTALS`的行为受`totals_mode`的影响。 + +`after_having_exclusive` - 在HAVING后进行计算,计算不超过`max_rows_to_group_by`行的数据。 + +`after_having_inclusive` - 在HAVING后进行计算,计算不少于`max_rows_to_group_by`行的数据。 + +`after_having_auto` - 在HAVING后进行计算,采用统计通过HAVING的行数,在超过不超过’max\_rows\_to\_group\_by’指定值(默认为50%)的情况下,包含所有行的结果。否则排除这些结果。 + +`totals_auto_threshold` - 默认 0.5,是`after_having_auto`的参数。 + +如果`group_by_overflow_mode != 'any'`并没有指定`max_rows_to_group_by`情况下,所有的模式都与`after_having`相同。 + +你可以在子查询,包含子查询的JOIN子句中使用WITH TOTALS(在这种情况下,它们各自的总值会被组合在一起)。 + +#### GROUP BY 使用外部存储设备 {#select-group-by-in-external-memory} + +你可以在GROUP BY中允许将临时数据转存到磁盘上,以限制对内存的使用。 +`max_bytes_before_external_group_by`这个配置确定了在GROUP BY中启动将临时数据转存到磁盘上的内存阈值。如果你将它设置为0(这是默认值),这项功能将被禁用。 + +当使用`max_bytes_before_external_group_by`时,我们建议将max\_memory\_usage设置为它的两倍。这是因为一个聚合需要两个阶段来完成:(1)读取数据并形成中间数据 (2)合并中间数据。临时数据的转存只会发生在第一个阶段。如果没有发生临时文件的转存,那么阶段二将最多消耗与1阶段相同的内存大小。 + +例如:如果将`max_memory_usage`设置为10000000000并且你想要开启外部聚合,那么你需要将`max_bytes_before_external_group_by`设置为10000000000的同时将`max_memory_usage`设置为20000000000。当外部聚合被触发时(如果刚好只形成了一份临时数据),它的内存使用量将会稍高与`max_bytes_before_external_group_by`。 + +在分布式查询处理中,外部聚合将会在远程的服务器中执行。为了使请求服务器只使用较少的内存,可以设置`distributed_aggregation_memory_efficient`为1。 + +当合并被刷到磁盘的临时数据以及合并远程的服务器返回的结果时,如果在启动`distributed_aggregation_memory_efficient`的情况下,将会消耗1/256 \* 线程数的总内存大小。 + +当启动外部聚合时,如果数据的大小小于`max_bytes_before_external_group_by`设置的值(数据没有被刷到磁盘中),那么数据的聚合速度将会和没有启动外部聚合时一样快。如果有临时数据被刷到了磁盘中,那么这个查询的运行时间将会被延长几倍(大约是3倍)。 + +如果你在GROUP BY后面存在ORDER BY子句,并且ORDER BY后面存在一个极小限制的LIMIT,那么ORDER BY子句将不会使用太多内存。 +否则请不要忘记启动外部排序(`max_bytes_before_external_sort`)。 + +### LIMIT N BY 子句 {#limit-n-by-zi-ju} + +LIMIT N BY子句和LIMIT没有关系, LIMIT N BY COLUMNS 子句可以用来在每一个COLUMNS分组中求得最大的N行数据。我们可以将它们同时用在一个查询中。LIMIT N BY子句中可以包含任意多个分组字段表达式列表。 + +示例: + +``` sql +SELECT + domainWithoutWWW(URL) AS domain, + domainWithoutWWW(REFERRER_URL) AS referrer, + device_type, + count() cnt +FROM hits +GROUP BY domain, referrer, device_type +ORDER BY cnt DESC +LIMIT 5 BY domain, device_type +LIMIT 100 +``` + +查询将会为每个`domain, device_type`的组合选出前5个访问最多的数据,但是结果最多将不超过100行(`LIMIT n BY + LIMIT`)。 + +### HAVING 子句 {#having-zi-ju} + +HAVING子句可以用来过滤GROUP BY之后的数据,类似于WHERE子句。 +WHERE于HAVING不同之处在于WHERE在聚合前(GROUP BY)执行,HAVING在聚合后执行。 +如果不存在聚合,则不能使用HAVING。 + +### ORDER BY 子句 {#select-order-by} + +如果存在ORDER BY 子句,则该子句中必须存在一个表达式列表,表达式列表中每一个表达式都可以分配一个DESC或ASC(排序的方向)。如果没有指明排序的方向,将假定以ASC的方式进行排序。其中ASC表示按照升序排序,DESC按照降序排序。示例:`ORDER BY Visits DESC, SearchPhrase` + +对于字符串的排序来讲,你可以为其指定一个排序规则,在指定排序规则时,排序总是不会区分大小写。并且如果与ASC或DESC同时出现时,排序规则必须在它们的后面指定。例如:`ORDER BY SearchPhrase COLLATE 'tr'` - 使用土耳其字母表对它进行升序排序,同时排序时不会区分大小写,并按照UTF-8字符集进行编码。 + +我们推荐只在少量的数据集中使用COLLATE,因为COLLATE的效率远低于正常的字节排序。 + +针对排序表达式中相同值的行将以任意的顺序进行输出,这是不确定的(每次都可能不同)。 +如果省略ORDER BY子句,则结果的顺序也是不固定的。 + +`NaN` 和 `NULL` 的排序规则: + +- 当使用`NULLS FIRST`修饰符时,将会先输出`NULL`,然后是`NaN`,最后才是其他值。 +- 当使用`NULLS LAST`修饰符时,将会先输出其他值,然后是`NaN`,最后才是`NULL`。 +- 默认情况下与使用`NULLS LAST`修饰符相同。 + +示例: + +假设存在如下一张表 + + ┌─x─┬────y─┐ + │ 1 │ ᴺᵁᴸᴸ │ + │ 2 │ 2 │ + │ 1 │ nan │ + │ 2 │ 2 │ + │ 3 │ 4 │ + │ 5 │ 6 │ + │ 6 │ nan │ + │ 7 │ ᴺᵁᴸᴸ │ + │ 6 │ 7 │ + │ 8 │ 9 │ + └───┴──────┘ + +运行查询 `SELECT * FROM t_null_nan ORDER BY y NULLS FIRST` 将获得如下结果: + + ┌─x─┬────y─┐ + │ 1 │ ᴺᵁᴸᴸ │ + │ 7 │ ᴺᵁᴸᴸ │ + │ 1 │ nan │ + │ 6 │ nan │ + │ 2 │ 2 │ + │ 2 │ 2 │ + │ 3 │ 4 │ + │ 5 │ 6 │ + │ 6 │ 7 │ + │ 8 │ 9 │ + └───┴──────┘ + +当使用浮点类型的数值进行排序时,不管排序的顺序如何,NaNs总是出现在所有值的后面。换句话说,当你使用升序排列一个浮点数值列时,NaNs好像比所有值都要大。反之,当你使用降序排列一个浮点数值列时,NaNs好像比所有值都小。 + +如果你在ORDER BY子句后面存在LIMIT并给定了较小的数值,则将会使用较少的内存。否则,内存的使用量将与需要排序的数据成正比。对于分布式查询,如果省略了GROUP BY,则在远程服务器上执行部分排序,最后在请求服务器上合并排序结果。这意味这对于分布式查询而言,要排序的数据量可以大于单台服务器的内存。 + +如果没有足够的内存,可以使用外部排序(在磁盘中创建一些临时文件)。可以使用`max_bytes_before_external_sort`来设置外部排序,如果你讲它设置为0(默认),则表示禁用外部排序功能。如果启用该功能。当要排序的数据量达到所指定的字节数时,当前排序的结果会被转存到一个临时文件中去。当全部数据读取完毕后,所有的临时文件将会合并成最终输出结果。这些临时文件将会写到config文件配置的/var/lib/clickhouse/tmp/目录中(默认值,你可以通过修改’tmp\_path’配置调整该目录的位置)。 + +查询运行使用的内存要高于’max\_bytes\_before\_external\_sort’,为此,这个配置必须要远远小于’max\_memory\_usage’配置的值。例如,如果你的服务器有128GB的内存去运行一个查询,那么推荐你将’max\_memory\_usage’设置为100GB,’max\_bytes\_before\_external\_sort’设置为80GB。 + +外部排序效率要远低于在内存中排序。 + +### SELECT 子句 {#select-zi-ju} + +在完成上述列出的所有子句后,将对SELECT子句中的表达式进行分析。 +具体来讲,如果在存在聚合函数的情况下,将对聚合函数之前的表达式进行分析。 +聚合函数与聚合函数之前的表达式都将在聚合期间完成计算(GROUP BY)。 +就像他们本身就已经存在结果上一样。 + +### DISTINCT 子句 {#select-distinct} + +如果存在DISTINCT子句,则会对结果中的完全相同的行进行去重。 +在GROUP BY不包含聚合函数,并对全部SELECT部分都包含在GROUP BY中时的作用一样。但该子句还是与GROUP BY子句存在以下几点不同: + +- 可以与GROUP BY配合使用。 +- 当不存在ORDER BY子句并存在LIMIT子句时,查询将在同时满足DISTINCT与LIMIT的情况下立即停止查询。 +- 在处理数据的同时输出结果,并不是等待整个查询全部完成。 + +在SELECT表达式中存在Array类型的列时,不能使用DISTINCT。 + +`DISTINCT`可以与 [NULL](../syntax.md)一起工作,就好像`NULL`仅是一个特殊的值一样,并且`NULL=NULL`。换而言之,在`DISTINCT`的结果中,与`NULL`不同的组合仅能出现一次。 + +### LIMIT 子句 {#limit-zi-ju} + +LIMIT m 用于在查询结果中选择前m行数据。 +LIMIT n, m 用于在查询结果中选择从n行开始的m行数据。 + +’n’与’m’必须是正整数。 + +如果没有指定ORDER BY子句,则结果可能是任意的顺序,并且是不确定的。 + +### UNION ALL 子句 {#union-all-zi-ju} + +UNION ALL子句可以组合任意数量的查询,例如: + +``` sql +SELECT CounterID, 1 AS table, toInt64(count()) AS c + FROM test.hits + GROUP BY CounterID + +UNION ALL + +SELECT CounterID, 2 AS table, sum(Sign) AS c + FROM test.visits + GROUP BY CounterID + HAVING c > 0 +``` + +仅支持UNION ALL,不支持其他UNION规则(UNION DISTINCT)。如果你需要UNION DISTINCT,你可以使用UNION ALL中包含SELECT DISTINCT的子查询的方式。 + +UNION ALL中的查询可以同时运行,它们的结果将被混合到一起。 + +这些查询的结果结果必须相同(列的数量和类型)。列名可以是不同的。在这种情况下,最终结果的列名将从第一个查询中获取。UNION会为查询之间进行类型转换。例如,如果组合的两个查询中包含相同的字段,并且是类型兼容的`Nullable`和non-`Nullable`,则结果将会将该字段转换为`Nullable`类型的字段。 + +作为UNION ALL查询的部分不能包含在括号内。ORDER BY与LIMIT子句应该被应用在每个查询中,而不是最终的查询中。如果你需要做最终结果转换,你可以将UNION ALL作为一个子查询包含在FROM子句中。 + +### INTO OUTFILE 子句 {#into-outfile-zi-ju} + +`INTO OUTFILE filename` 子句用于将查询结果重定向输出到指定文件中(filename是一个字符串类型的值)。 +与MySQL不同,执行的结果文件将在客户端建立,如果文件已存在,查询将会失败。 +此命令可以工作在命令行客户端与clickhouse-local中(通过HTTP借口发送将会失败)。 + +默认的输出格式是TabSeparated(与命令行客户端的批处理模式相同)。 + +### FORMAT 子句 {#format-zi-ju} + +‘FORMAT format’ 子句用于指定返回数据的格式。 +你可以使用它方便的转换或创建数据的转储。 +更多信息,参见«输入输出格式»部分。 +如果不存在FORMAT子句,则使用默认的格式,这将取决与DB的配置以及所使用的客户端。对于批量模式的HTTP客户端和命令行客户端而言,默认的格式是TabSeparated。对于交互模式下的命令行客户端,默认的格式是PrettyCompact(它有更加美观的格式)。 + +当使用命令行客户端时,数据以内部高效的格式在服务器和客户端之间进行传递。客户端将单独的解析FORMAT子句,以帮助数据格式的转换(这将减轻网络和服务器的负载)。 + +### IN 运算符 {#select-in-operators} + +对于`IN`、`NOT IN`、`GLOBAL IN`、`GLOBAL NOT IN`操作符被分别实现,因为它们的功能非常丰富。 + +运算符的左侧是单列或列的元组。 + +示例: + +``` sql +SELECT UserID IN (123, 456) FROM ... +SELECT (CounterID, UserID) IN ((34, 123), (101500, 456)) FROM ... +``` + +如果左侧是单个列并且是一个索引,并且右侧是一组常量时,系统将使用索引来处理查询。 + +不要在列表中列出太多的值(百万)。如果数据集很大,将它们放入临时表中(可以参考«»), 然后使用子查询。 +Don’t list too many values explicitly (i.e. millions). If a data set is large, put it in a temporary table (for example, see the section «External data for query processing»), then use a subquery. + +右侧可以是一个由常量表达式组成的元组列表(像上面的例子一样),或者是一个数据库中的表的名称,或是一个包含在括号中的子查询。 + +如果右侧是一个表的名字(例如,`UserID IN users`),这相当于`UserID IN (SELECT * FROM users)`。在查询与外部数据表组合使用时可以使用该方法。例如,查询与包含user IDS的’users’临时表一起被发送的同时需要对结果进行过滤时。 + +如果操作符的右侧是一个Set引擎的表时(数据总是在内存中准备好),则不会每次都为查询创建新的数据集。 + +子查询可以指定一个列以上的元组来进行过滤。 +示例: + +``` sql +SELECT (CounterID, UserID) IN (SELECT CounterID, UserID FROM ...) FROM ... +``` + +IN操作符的左右两侧应具有相同的类型。 + +IN操作符的子查询中可以出现任意子句,包含聚合函数与lambda函数。 +示例: + +``` sql +SELECT + EventDate, + avg(UserID IN + ( + SELECT UserID + FROM test.hits + WHERE EventDate = toDate('2014-03-17') + )) AS ratio +FROM test.hits +GROUP BY EventDate +ORDER BY EventDate ASC +``` + + ┌──EventDate─┬────ratio─┐ + │ 2014-03-17 │ 1 │ + │ 2014-03-18 │ 0.807696 │ + │ 2014-03-19 │ 0.755406 │ + │ 2014-03-20 │ 0.723218 │ + │ 2014-03-21 │ 0.697021 │ + │ 2014-03-22 │ 0.647851 │ + │ 2014-03-23 │ 0.648416 │ + └────────────┴──────────┘ + +为3月17日之后的每一天计算与3月17日访问该网站的用户浏览网页的百分比。 +IN子句中的子查询仅在单个服务器上运行一次。不能够是相关子查询。 + +#### NULL 处理 {#null-chu-li-1} + +在处理中,IN操作符总是假定 [NULL](../syntax.md) 值的操作结果总是等于`0`,而不管`NULL`位于左侧还是右侧。`NULL`值不应该包含在任何数据集中,它们彼此不能够对应,并且不能够比较。 + +下面的示例中有一个`t_null`表: + + ┌─x─┬────y─┐ + │ 1 │ ᴺᵁᴸᴸ │ + │ 2 │ 3 │ + └───┴──────┘ + +运行查询`SELECT x FROM t_null WHERE y IN (NULL,3)`将得到如下结果: + + ┌─x─┐ + │ 2 │ + └───┘ + +你可以看到在查询结果中不存在`y = NULL`的结果。这是因为ClickHouse无法确定`NULL`是否包含在`(NULL,3)`数据集中,对于这次比较操作返回了`0`,并且在`SELECT`的最终输出中排除了这行。 + + SELECT y IN (NULL, 3) + FROM t_null + + ┌─in(y, tuple(NULL, 3))─┐ + │ 0 │ + │ 1 │ + └───────────────────────┘ + +#### 分布式子查询 {#select-distributed-subqueries} + +对于带有子查询的(类似与JOINs)IN中,有两种选择:普通的`IN`/`JOIN`与`GLOBAL IN` / `GLOBAL JOIN`。它们对于分布式查询的处理运行方式是不同的。 + +!!! 注意 "注意" + 请记住,下面描述的算法可能因为根据 [设置](../../operations/settings/settings.md) 配置的不同而不同。 + +当使用普通的IN时,查询总是被发送到远程的服务器,并且在每个服务器中运行«IN»或«JOIN»子句中的子查询。 + +当使用`GLOBAL IN` / `GLOBAL JOIN`时,首先会为`GLOBAL IN` / `GLOBAL JOIN`运行所有子查询,并将结果收集到临时表中,并将临时表发送到每个远程服务器,并使用该临时表运行查询。 + +对于非分布式查询,请使用普通的`IN` / `JOIN`。 + +在分布式查询中使用`IN` / `JOIN`子句中使用子查询需要小心。 + +让我们来看一些例子。假设集群中的每个服务器都存在一个正常表**local\_table**。与一个分布式表**distributed\_table**。 + +对于所有查询**distributed\_table**的查询,查询会被发送到所有的远程服务器并使用**local\_table**表运行查询。 + +例如,查询 + +``` sql +SELECT uniq(UserID) FROM distributed_table +``` + +将发送如下查询到所有远程服务器 + +``` sql +SELECT uniq(UserID) FROM local_table +``` + +这时将并行的执行它们,直到达到可以组合数据的中间结果状态。然后中间结果将返回到请求服务器并在请求服务器上进行合并,最终将结果发送给客户端。 + +现在让我运行一个带有IN的查询: + +``` sql +SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) +``` + +- 计算两个站点的用户交集。 + +此查询将被发送给所有的远程服务器 + +``` sql +SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) +``` + +换句话说,IN子句中的数据集将被在每台服务器上被独立的收集,仅与每台服务器上的本地存储上的数据计算交集。 + +如果您已经将数据分散到了集群的每台服务器上,并且单个UserID的数据完全分布在单个服务器上,那么这将是正确且最佳的查询方式。在这种情况下,所有需要的数据都可以在每台服务器的本地进行获取。否则,结果将是不准确的。我们将这种查询称为«local IN»。 + +为了修正这种在数据随机分布的集群中的工作,你可以在子查询中使用**distributed\_table**。查询将更改为这样: + +``` sql +SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) +``` + +此查询将被发送给所有的远程服务器 + +``` sql +SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) +``` + +子查询将在每个远程服务器上执行。因为子查询使用分布式表,所有每个远程服务器上的子查询将查询再次发送给所有的远程服务器 + +``` sql +SELECT UserID FROM local_table WHERE CounterID = 34 +``` + +例如,如果你拥有100台服务器的集群,执行整个查询将需要10,000次请求,这通常被认为是不可接受的。 + +在这种情况下,你应该使用GLOBAL IN来替代IN。让我们看一下它是如何工作的。 + +``` sql +SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID GLOBAL IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) +``` + +在请求服务器上运行子查询 + +``` sql +SELECT UserID FROM distributed_table WHERE CounterID = 34 +``` + +将结果放入内存中的临时表中。然后将请求发送到每一台远程服务器 + +``` sql +SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID GLOBAL IN _data1 +``` + +临时表`_data1`也会随着查询一起发送到每一台远程服务器(临时表的名称由具体实现定义)。 + +这比使用普通的IN更加理想,但是,请注意以下几点: + +1. 创建临时表时,数据不是唯一的,为了减少通过网络传输的数据量,请在子查询中使用DISTINCT(你不需要在普通的IN中这么做) +2. 临时表将发送到所有远程服务器。其中传输不考虑网络的拓扑结构。例如,如果你有10个远程服务器存在与请求服务器非常远的数据中心中,则数据将通过通道发送数据到远程数据中心10次。使用GLOBAL IN时应避免大数据集。 +3. 当向远程服务器发送数据时,网络带宽的限制是不可配置的,这可能会网络的负载造成压力。 +4. 尝试将数据跨服务器分布,这样你将不需要使用GLOBAL IN。 +5. 如果你需要经常使用GLOBAL IN,请规划你的ClickHouse集群位置,以便副本之间不存在跨数据中心,并且它们之间具有快速的网络交换能力,以便查询可以完全在一个数据中心内完成。 + +另外,在`GLOBAL IN`子句中使用本地表也是有用的,比如,本地表仅在请求服务器上可用,并且您希望在远程服务器上使用来自本地表的数据。 + +### 极端值 {#extreme-values} + +除了结果外,你还可以获得结果列的最大值与最小值,可以将**极端**配置设置成1来做到这一点。最大值最小值的计算是针对于数字类型,日期类型进行计算的,对于其他列,将会输出默认值。 + +额外计算的两行结果 - 最大值与最小值,这两行额外的结果仅在JSON\*, TabSeparated\*, and Pretty\* 格式与其他行分开的输出方式输出,不支持其他输出格式。 + +在JSON\*格式中,Extreme值在单独的’extremes’字段中。在TabSeparated\*格式中,在其他结果与’totals’之后输出,并使用空行与其分隔。在Pretty\* 格式中,将在其他结果与’totals’后以单独的表格输出。 + +如果在计算Extreme值的同时包含LIMIT。extremes的计算结果将包含offset跳过的行。在流式的请求中,它可能还包含多余LIMIT的少量行的值。 + +### 注意事项 {#zhu-yi-shi-xiang} + +不同于MySQL, `GROUP BY`与`ORDER BY`子句不支持使用列的位置信息作为参数,但这实际上是符合SQL标准的。 +例如,`GROUP BY 1, 2`将被解释为按照常量进行分组(即,所有的行将会被聚合成一行)。 + +可以在查询的任何部分使用AS。 + +可以在查询的任何部分添加星号,而不仅仅是表达式。在分析查询时,星号被替换为所有的列(不包含`MATERIALIZED`与`ALIAS`的列)。 +只有少数情况下使用星号是合理的: + +- 创建表转储时。 +- 对于仅包含几个列的表,如系统表. +- 获取表中的列信息。在这种情况下应该使用`LIMIT 1`。但是,更好的办法是使用`DESC TABLE`。 +- 当使用`PREWHERE`在少数的几个列上做强过滤时。 +- 在子查询中(因为外部查询不需要的列被排除在子查询之外)。 + +在所有的其他情况下,我们不建议使用星号,因为它是列式数据库的缺点而不是优点。 + +[来源文章](https://clickhouse.tech/docs/zh/query_language/select/) diff --git a/docs/zh/sql-reference/statements/show.md b/docs/zh/sql-reference/statements/show.md new file mode 100644 index 00000000000..fa8cc94a0b6 --- /dev/null +++ b/docs/zh/sql-reference/statements/show.md @@ -0,0 +1,105 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 38 +toc_title: SHOW +--- + +# 显示查询 {#show-queries} + +## SHOW CREATE TABLE {#show-create-table} + +``` sql +SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] +``` + +返回单 `String`-类型 ‘statement’ column, which contains a single value – the `CREATE` 用于创建指定对象的查询。 + +## SHOW DATABASES {#show-databases} + +``` sql +SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] +``` + +打印所有数据库的列表。 +这个查询是相同的 `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. + +## SHOW PROCESSLIST {#show-processlist} + +``` sql +SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] +``` + +输出的内容 [系统。流程](../../operations/system-tables.md#system_tables-processes) 表,包含目前正在处理的查询列表,除了 `SHOW PROCESSLIST` 查询。 + +该 `SELECT * FROM system.processes` 查询返回有关所有当前查询的数据。 + +提示(在控制台中执行): + +``` bash +$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" +``` + +## SHOW TABLES {#show-tables} + +显示表的列表。 + +``` sql +SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +如果 `FROM` 如果未指定子句,则查询返回当前数据库中的表列表。 + +你可以得到相同的结果 `SHOW TABLES` 通过以下方式进行查询: + +``` sql +SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**示例** + +下面的查询从表的列表中选择前两行 `system` 数据库,其名称包含 `co`. + +``` sql +SHOW TABLES FROM system LIKE '%co%' LIMIT 2 +``` + +``` text +┌─name───────────────────────────┐ +│ aggregate_function_combinators │ +│ collations │ +└────────────────────────────────┘ +``` + +## SHOW DICTIONARIES {#show-dictionaries} + +显示列表 [外部字典](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md). + +``` sql +SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +如果 `FROM` 如果未指定子句,则查询从当前数据库返回字典列表。 + +你可以得到相同的结果 `SHOW DICTIONARIES` 通过以下方式进行查询: + +``` sql +SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] +``` + +**示例** + +下面的查询从表的列表中选择前两行 `system` 数据库,其名称包含 `reg`. + +``` sql +SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 +``` + +``` text +┌─name─────────┐ +│ regions │ +│ region_names │ +└──────────────┘ +``` + +[原始文章](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/zh/sql-reference/statements/system.md b/docs/zh/sql-reference/statements/system.md new file mode 100644 index 00000000000..d502bad1e65 --- /dev/null +++ b/docs/zh/sql-reference/statements/system.md @@ -0,0 +1,113 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 37 +toc_title: SYSTEM +--- + +# 系统查询 {#query-language-system} + +- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) +- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) +- [DROP DNS CACHE](#query_language-system-drop-dns-cache) +- [DROP MARK CACHE](#query_language-system-drop-mark-cache) +- [FLUSH LOGS](#query_language-system-flush_logs) +- [RELOAD CONFIG](#query_language-system-reload-config) +- [SHUTDOWN](#query_language-system-shutdown) +- [KILL](#query_language-system-kill) +- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) +- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) +- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) +- [STOP MERGES](#query_language-system-stop-merges) +- [START MERGES](#query_language-system-start-merges) + +## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} + +重新加载之前已成功加载的所有字典。 +默认情况下,字典是懒惰加载的(请参阅 [dictionaries\_lazy\_load](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)),所以不是在启动时自动加载,而是通过dictGet函数在第一次访问时初始化,或者从ENGINE=Dictionary的表中选择。 该 `SYSTEM RELOAD DICTIONARIES` 查询重新加载这样的字典(加载)。 +总是返回 `Ok.` 无论字典更新的结果如何。 + +## 重新加载字典Dictionary\_name {#query_language-system-reload-dictionary} + +完全重新加载字典 `dictionary_name`,与字典的状态无关(LOADED/NOT\_LOADED/FAILED)。 +总是返回 `Ok.` 无论更新字典的结果如何。 +字典的状态可以通过查询 `system.dictionaries` 桌子 + +``` sql +SELECT name, status FROM system.dictionaries; +``` + +## DROP DNS CACHE {#query_language-system-drop-dns-cache} + +重置ClickHouse的内部DNS缓存。 有时(对于旧的ClickHouse版本)在更改基础架构(更改另一个ClickHouse服务器或字典使用的服务器的IP地址)时需要使用此命令。 + +有关更方便(自动)缓存管理,请参阅disable\_internal\_dns\_cache、dns\_cache\_update\_period参数。 + +## DROP MARK CACHE {#query_language-system-drop-mark-cache} + +重置标记缓存。 用于开发ClickHouse和性能测试。 + +## FLUSH LOGS {#query_language-system-flush_logs} + +Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. + +## RELOAD CONFIG {#query_language-system-reload-config} + +重新加载ClickHouse配置。 当配置存储在ZooKeeeper中时使用。 + +## SHUTDOWN {#query_language-system-shutdown} + +通常关闭ClickHouse(如 `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) + +## KILL {#query_language-system-kill} + +中止ClickHouse进程(如 `kill -9 {$ pid_clickhouse-server}`) + +## 管理分布式表 {#query-language-system-distributed} + +ClickHouse可以管理 [分布](../../engines/table-engines/special/distributed.md) 桌子 当用户将数据插入到这些表中时,ClickHouse首先创建应发送到群集节点的数据队列,然后异步发送它。 您可以使用 [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed),和 [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) 查询。 您也可以同步插入分布式数据与 `insert_distributed_sync` 设置。 + +### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} + +将数据插入分布式表时禁用后台数据分发。 + +``` sql +SYSTEM STOP DISTRIBUTED SENDS [db.] +``` + +### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} + +强制ClickHouse将数据同步发送到群集节点。 如果任何节点不可用,ClickHouse将引发异常并停止查询执行。 您可以重试查询,直到查询成功,这将在所有节点恢复联机时发生。 + +``` sql +SYSTEM FLUSH DISTRIBUTED [db.] +``` + +### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} + +将数据插入分布式表时启用后台数据分发。 + +``` sql +SYSTEM START DISTRIBUTED SENDS [db.] +``` + +### STOP MERGES {#query_language-system-stop-merges} + +提供停止MergeTree系列中表的后台合并的可能性: + +``` sql +SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +``` + +!!! note "注" + `DETACH / ATTACH` 即使在之前所有MergeTree表的合并已停止的情况下,table也会为表启动后台合并。 + +### START MERGES {#query_language-system-start-merges} + +为MergeTree系列中的表提供启动后台合并的可能性: + +``` sql +SYSTEM START MERGES [[db.]merge_tree_family_table_name] +``` + +[原始文章](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/zh/sql-reference/syntax.md b/docs/zh/sql-reference/syntax.md new file mode 100644 index 00000000000..2543b7e0f66 --- /dev/null +++ b/docs/zh/sql-reference/syntax.md @@ -0,0 +1,187 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 31 +toc_title: "\u8BED\u6CD5" +--- + +# 语法 {#syntax} + +系统中有两种类型的解析器:完整SQL解析器(递归下降解析器)和数据格式解析器(快速流解析器)。 +在所有情况下,除了 `INSERT` 查询时,只使用完整的SQL解析器。 +该 `INSERT` 查询使用的分析程序: + +``` sql +INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') +``` + +该 `INSERT INTO t VALUES` 片段由完整的解析器解析,并且数据 `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` 由快速流解析器解析。 您也可以通过使用 [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) 设置。 当 `input_format_values_interpret_expressions = 1`,ClickHouse首先尝试使用fast stream解析器解析值。 如果失败,ClickHouse将尝试对数据使用完整的解析器,将其视为SQL [表达式](#syntax-expressions). + +数据可以有任何格式。 当接收到查询时,服务器计算不超过 [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) RAM中请求的字节(默认为1MB),其余的是流解析。 +这意味着系统没有大的问题 `INSERT` 查询,就像MySQL一样。 + +使用时 `Values` 格式为 `INSERT` 查询,它可能看起来数据被解析相同的表达式 `SELECT` 查询,但事实并非如此。 该 `Values` 格式更为有限。 + +接下来我们将介绍完整的解析器。 有关格式解析器的详细信息,请参阅 [格式](../interfaces/formats.md) 科。 + +## 空间 {#spaces} + +语法结构之间可能有任意数量的空格符号(包括查询的开始和结束)。 空格符号包括空格、制表符、换行符、CR和换页符。 + +## 评论 {#comments} + +支持SQL样式和C样式注释。 +SQL风格的评论:来自 `--` 直到最后 后的空间 `--` 可以省略。 +C风格的评论:来自 `/*` 到 `*/`. 这些注释可以是多行。 这里也不需要空格。 + +## 关键词 {#syntax-keywords} + +当关键字对应于以下关键字时,不区分大小写: + +- SQL标准。 例如, `SELECT`, `select` 和 `SeLeCt` 都是有效的。 +- 在一些流行的DBMS(MySQL或Postgres)中实现。 例如, `DateTime` 是一样的 `datetime`. + +数据类型名称是否区分大小写可以在 `system.data_type_families` 桌子 + +与标准SQL相比,所有其他关键字(包括函数名称)都是 **区分大小写**. + +不保留关键字(它们只是在相应的上下文中解析为关键字)。 如果您使用 [标识符](#syntax-identifiers) 与关键字相同,将它们括在引号中。 例如,查询 `SELECT "FROM" FROM table_name` 是有效的,如果表 `table_name` 具有名称的列 `"FROM"`. + +## 标识符 {#syntax-identifiers} + +标识符是: + +- 集群、数据库、表、分区和列名称。 +- 功能。 +- 数据类型。 +- [表达式别名](#syntax-expression_aliases). + +标识符可以是引号或非引号。 建议使用非引号标识符。 + +非引号标识符必须与正则表达式匹配 `^[a-zA-Z_][0-9a-zA-Z_]*$` 并且不能等于 [关键词](#syntax-keywords). 例: `x, _1, X_y__Z123_.` + +如果要使用与关键字相同的标识符,或者要在标识符中使用其他符号,请使用双引号或反引号对其进行引用,例如, `"id"`, `` `id` ``. + +## 文字数 {#literals} + +有:数字,字符串,复合和 `NULL` 文字。 + +### 数字 {#numeric} + +数值文本尝试进行分析: + +- 首先作为一个64位有符号的数字,使用 [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) 功能。 +- 如果不成功,作为64位无符号数,使用 [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) 功能。 +- 如果不成功,作为一个浮点数使用 [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) 功能。 +- 否则,将返回错误。 + +相应的值将具有该值适合的最小类型。 +例如,1被解析为 `UInt8`,但256被解析为 `UInt16`. 有关详细信息,请参阅 [数据类型](../sql-reference/data-types/index.md). + +例: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. + +### 字符串 {#syntax-string-literal} + +仅支持单引号中的字符串文字。 封闭的字符可以反斜杠转义。 以下转义序列具有相应的特殊值: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. 在所有其他情况下,转义序列的格式为 `\c`,哪里 `c` 是任何字符,被转换为 `c`. 这意味着您可以使用序列 `\'`和`\\`. 该值将具有 [字符串](../sql-reference/data-types/string.md) 类型。 + +在字符串文字中需要转义的最小字符集: `'` 和 `\`. 单引号可以用单引号,文字转义 `'It\'s'` 和 `'It''s'` 是平等的。 + +### 化合物 {#compound} + +数组支持构造: `[1, 2, 3]` 和元组: `(1, 'Hello, world!', 2)`.. +实际上,这些不是文字,而是分别具有数组创建运算符和元组创建运算符的表达式。 +数组必须至少包含一个项目,元组必须至少包含两个项目。 +元组有一个特殊的用途用于 `IN` a条款 `SELECT` 查询。 元组可以作为查询的结果获得,但它们不能保存到数据库(除了 [记忆](../engines/table-engines/special/memory.md) 表)。 + +### NULL {#null-literal} + +指示该值丢失。 + +为了存储 `NULL` 在表字段中,它必须是 [可为空](../sql-reference/data-types/nullable.md) 类型。 + +根据数据格式(输入或输出), `NULL` 可能有不同的表示。 有关详细信息,请参阅以下文档 [数据格式](../interfaces/formats.md#formats). + +处理有许多细微差别 `NULL`. 例如,如果比较操作的至少一个参数是 `NULL`,此操作的结果也将是 `NULL`. 对于乘法,加法和其他操作也是如此。 有关详细信息,请阅读每个操作的文档。 + +在查询中,您可以检查 `NULL` 使用 [IS NULL](operators.md#operator-is-null) 和 [IS NOT NULL](operators.md) 运算符及相关功能 `isNull` 和 `isNotNull`. + +## 功能 {#functions} + +函数像标识符一样写入,并在括号中包含一个参数列表(可能是空的)。 与标准SQL相比,括号是必需的,即使是空的参数列表。 示例: `now()`. +有常规函数和聚合函数(请参阅部分 “Aggregate functions”). 某些聚合函数可以包含括号中的两个参数列表。 示例: `quantile (0.9) (x)`. 这些聚合函数被调用 “parametric” 函数,并在第一个列表中的参数被调用 “parameters”. 不带参数的聚合函数的语法与常规函数的语法相同。 + +## 运营商 {#operators} + +在查询解析过程中,运算符会转换为相应的函数,同时考虑它们的优先级和关联性。 +例如,表达式 `1 + 2 * 3 + 4` 转化为 `plus(plus(1, multiply(2, 3)), 4)`. + +## 数据类型和数据库表引擎 {#data_types-and-database-table-engines} + +数据类型和表引擎 `CREATE` 查询的编写方式与标识符或函数相同。 换句话说,它们可能包含也可能不包含括在括号中的参数列表。 有关详细信息,请参阅部分 “Data types,” “Table engines,” 和 “CREATE”. + +## 表达式别名 {#syntax-expression_aliases} + +别名是查询中表达式的用户定义名称。 + +``` sql +expr AS alias +``` + +- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` 子句不使用 `AS` 关键字。 + + For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. + + In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. + +- `expr` — Any expression supported by ClickHouse. + + For example, `SELECT column_name * 2 AS double FROM some_table`. + +- `alias` — Name for `expr`. 别名应符合 [标识符](#syntax-identifiers) 语法 + + For example, `SELECT "table t".column_name FROM table_name AS "table t"`. + +### 使用注意事项 {#notes-on-usage} + +别名对于查询或子查询是全局的,您可以在查询的任何部分中为任何表达式定义别名。 例如, `SELECT (1 AS n) + 2, n`. + +别名在子查询和子查询之间不可见。 例如,在执行查询时 `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse生成异常 `Unknown identifier: num`. + +如果为结果列定义了别名 `SELECT` 子查询的子句,这些列在外部查询中可见。 例如, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. + +小心使用与列或表名相同的别名。 让我们考虑以下示例: + +``` sql +CREATE TABLE t +( + a Int, + b Int +) +ENGINE = TinyLog() +``` + +``` sql +SELECT + argMax(a, b), + sum(b) AS b +FROM t +``` + +``` text +Received exception from server (version 18.14.17): +Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. +``` + +在这个例子中,我们声明表 `t` 带柱 `b`. 然后,在选择数据时,我们定义了 `sum(b) AS b` 别名 由于别名是全局的,ClickHouse替换了文字 `b` 在表达式中 `argMax(a, b)` 用表达式 `sum(b)`. 这种替换导致异常。 + +## 星号 {#asterisk} + +在一个 `SELECT` 查询中,星号可以替换表达式。 有关详细信息,请参阅部分 “SELECT”. + +## 表达式 {#syntax-expressions} + +表达式是函数、标识符、文字、运算符的应用程序、括号中的表达式、子查询或星号。 它还可以包含别名。 +表达式列表是一个或多个用逗号分隔的表达式。 +函数和运算符,反过来,可以有表达式作为参数。 + +[原始文章](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/zh/sql-reference/table-functions/file.md b/docs/zh/sql-reference/table-functions/file.md new file mode 100644 index 00000000000..d2f9ae7c0b0 --- /dev/null +++ b/docs/zh/sql-reference/table-functions/file.md @@ -0,0 +1,121 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 37 +toc_title: "\u6587\u4EF6" +--- + +# 文件 {#file} + +从文件创建表。 此表函数类似于 [url](url.md) 和 [hdfs](hdfs.md) 一些的。 + +``` sql +file(path, format, structure) +``` + +**输入参数** + +- `path` — The relative path to the file from [user\_files\_path](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_files_path). 只读模式下的globs后的文件支持路径: `*`, `?`, `{abc,def}` 和 `{N..M}` 哪里 `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [格式](../../interfaces/formats.md#formats) 的文件。 +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**返回值** + +具有指定结构的表,用于读取或写入指定文件中的数据。 + +**示例** + +设置 `user_files_path` 和文件的内容 `test.csv`: + +``` bash +$ grep user_files_path /etc/clickhouse-server/config.xml + /var/lib/clickhouse/user_files/ + +$ cat /var/lib/clickhouse/user_files/test.csv + 1,2,3 + 3,2,1 + 78,43,45 +``` + +表从`test.csv` 并从中选择前两行: + +``` sql +SELECT * +FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +``` sql +-- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file +SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 +``` + +**路径中的水珠** + +多个路径组件可以具有globs。 对于正在处理的文件应该存在并匹配到整个路径模式(不仅后缀或前缀)。 + +- `*` — Substitutes any number of any characters except `/` 包括空字符串。 +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +建筑与 `{}` 类似于 [远程表功能](../../sql-reference/table-functions/remote.md)). + +**示例** + +1. 假设我们有几个具有以下相对路径的文件: + +- ‘some\_dir/some\_file\_1’ +- ‘some\_dir/some\_file\_2’ +- ‘some\_dir/some\_file\_3’ +- ‘another\_dir/some\_file\_1’ +- ‘another\_dir/some\_file\_2’ +- ‘another\_dir/some\_file\_3’ + +1. 查询这些文件中的行数: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. 查询这两个目录的所有文件中的行数: + + + +``` sql +SELECT count(*) +FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "警告" + 如果您的文件列表包含带前导零的数字范围,请单独使用带大括号的构造或使用 `?`. + +**示例** + +从名为 `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## 虚拟列 {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**另请参阅** + +- [虚拟列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/zh/sql_reference/table_functions/generate.md b/docs/zh/sql-reference/table-functions/generate.md similarity index 100% rename from docs/zh/sql_reference/table_functions/generate.md rename to docs/zh/sql-reference/table-functions/generate.md diff --git a/docs/zh/sql-reference/table-functions/hdfs.md b/docs/zh/sql-reference/table-functions/hdfs.md new file mode 100644 index 00000000000..e9c987999cd --- /dev/null +++ b/docs/zh/sql-reference/table-functions/hdfs.md @@ -0,0 +1,104 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 45 +toc_title: hdfs +--- + +# hdfs {#hdfs} + +从HDFS中的文件创建表。 此表函数类似于 [url](url.md) 和 [文件](file.md) 一些的。 + +``` sql +hdfs(URI, format, structure) +``` + +**输入参数** + +- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` 和 `{N..M}` 哪里 `N`, `M` — numbers, \``'abc', 'def'` — strings. +- `format` — The [格式](../../interfaces/formats.md#formats) 的文件。 +- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. + +**返回值** + +具有指定结构的表,用于读取或写入指定文件中的数据。 + +**示例** + +表从 `hdfs://hdfs1:9000/test` 并从中选择前两行: + +``` sql +SELECT * +FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') +LIMIT 2 +``` + +``` text +┌─column1─┬─column2─┬─column3─┐ +│ 1 │ 2 │ 3 │ +│ 3 │ 2 │ 1 │ +└─────────┴─────────┴─────────┘ +``` + +**路径中的水珠** + +多个路径组件可以具有globs。 对于正在处理的文件应该存在并匹配到整个路径模式(不仅后缀或前缀)。 + +- `*` — Substitutes any number of any characters except `/` 包括空字符串。 +- `?` — Substitutes any single character. +- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. +- `{N..M}` — Substitutes any number in range from N to M including both borders. + +建筑与 `{}` 类似于 [远程表功能](../../sql-reference/table-functions/remote.md)). + +**示例** + +1. 假设我们在HDFS上有几个具有以下Uri的文件: + +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ +- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ + +1. 查询这些文件中的行数: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') +``` + +1. 查询这两个目录的所有文件中的行数: + + + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') +``` + +!!! warning "警告" + 如果您的文件列表包含带前导零的数字范围,请单独使用带大括号的构造或使用 `?`. + +**示例** + +从名为 `file000`, `file001`, … , `file999`: + +``` sql +SELECT count(*) +FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') +``` + +## 虚拟列 {#virtual-columns} + +- `_path` — Path to the file. +- `_file` — Name of the file. + +**另请参阅** + +- [虚拟列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) + +[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/zh/sql-reference/table-functions/index.md b/docs/zh/sql-reference/table-functions/index.md new file mode 100644 index 00000000000..5f20c49ba95 --- /dev/null +++ b/docs/zh/sql-reference/table-functions/index.md @@ -0,0 +1,38 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_folder_title: "\u8868\u51FD\u6570" +toc_priority: 34 +toc_title: "\u5BFC\u8A00" +--- + +# 表函数 {#table-functions} + +表函数是构造表的方法。 + +您可以使用表函数: + +- [FROM](../statements/select.md#select-from) 《公约》条款 `SELECT` 查询。 + + The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. + +- [创建表为\](../statements/create.md#create-table-query) 查询。 + + It's one of the methods of creating a table. + +!!! warning "警告" + 你不能使用表函数,如果 [allow\_ddl](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) 设置被禁用。 + +| 功能 | 产品描述 | +|--------------------|--------------------------------------------------------------------------------------------------------| +| [文件](file.md) | 创建一个 [文件](../../engines/table-engines/special/file.md)-发动机表。 | +| [合并](merge.md) | 创建一个 [合并](../../engines/table-engines/special/merge.md)-发动机表。 | +| [数字](numbers.md) | 创建一个包含整数填充的单列的表。 | +| [远程](remote.md) | 允许您访问远程服务器,而无需创建 [分布](../../engines/table-engines/special/distributed.md)-发动机表。 | +| [url](url.md) | 创建一个 [Url](../../engines/table-engines/special/url.md)-发动机表。 | +| [mysql](mysql.md) | 创建一个 [MySQL](../../engines/table-engines/integrations/mysql.md)-发动机表。 | +| [jdbc](jdbc.md) | 创建一个 [JDBC](../../engines/table-engines/integrations/jdbc.md)-发动机表。 | +| [odbc](odbc.md) | 创建一个 [ODBC](../../engines/table-engines/integrations/odbc.md)-发动机表。 | +| [hdfs](hdfs.md) | 创建一个 [HDFS](../../engines/table-engines/integrations/hdfs.md)-发动机表。 | + +[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/zh/sql_reference/table_functions/input.md b/docs/zh/sql-reference/table-functions/input.md similarity index 100% rename from docs/zh/sql_reference/table_functions/input.md rename to docs/zh/sql-reference/table-functions/input.md diff --git a/docs/zh/sql_reference/table_functions/jdbc.md b/docs/zh/sql-reference/table-functions/jdbc.md similarity index 100% rename from docs/zh/sql_reference/table_functions/jdbc.md rename to docs/zh/sql-reference/table-functions/jdbc.md diff --git a/docs/zh/sql_reference/table_functions/merge.md b/docs/zh/sql-reference/table-functions/merge.md similarity index 100% rename from docs/zh/sql_reference/table_functions/merge.md rename to docs/zh/sql-reference/table-functions/merge.md diff --git a/docs/zh/sql-reference/table-functions/mysql.md b/docs/zh/sql-reference/table-functions/mysql.md new file mode 100644 index 00000000000..995c45ac1a3 --- /dev/null +++ b/docs/zh/sql-reference/table-functions/mysql.md @@ -0,0 +1,86 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 42 +toc_title: mysql +--- + +# mysql {#mysql} + +允许 `SELECT` 要对存储在远程MySQL服务器上的数据执行的查询。 + +``` sql +mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); +``` + +**参数** + +- `host:port` — MySQL server address. + +- `database` — Remote database name. + +- `table` — Remote table name. + +- `user` — MySQL user. + +- `password` — User password. + +- `replace_query` — Flag that converts `INSERT INTO` 查询到 `REPLACE INTO`. 如果 `replace_query=1`,查询被替换。 + +- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` 表达式被添加到 `INSERT` 查询。 + + Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. + + To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. + +简单 `WHERE` 条款如 `=, !=, >, >=, <, <=` 当前在MySQL服务器上执行。 + +其余的条件和 `LIMIT` 只有在对MySQL的查询完成后,才会在ClickHouse中执行采样约束。 + +**返回值** + +与原始MySQL表具有相同列的table对象。 + +## 用法示例 {#usage-example} + +MySQL中的表: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +从ClickHouse中选择数据: + +``` sql +SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## 另请参阅 {#see-also} + +- [该 ‘MySQL’ 表引擎](../../engines/table-engines/integrations/mysql.md) +- [使用MySQL作为外部字典的来源](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql) + +[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/zh/sql_reference/table_functions/numbers.md b/docs/zh/sql-reference/table-functions/numbers.md similarity index 100% rename from docs/zh/sql_reference/table_functions/numbers.md rename to docs/zh/sql-reference/table-functions/numbers.md diff --git a/docs/zh/sql-reference/table-functions/odbc.md b/docs/zh/sql-reference/table-functions/odbc.md new file mode 100644 index 00000000000..30000845698 --- /dev/null +++ b/docs/zh/sql-reference/table-functions/odbc.md @@ -0,0 +1,108 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 44 +toc_title: odbc +--- + +# odbc {#table-functions-odbc} + +返回通过连接的表 [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). + +``` sql +odbc(connection_settings, external_database, external_table) +``` + +参数: + +- `connection_settings` — Name of the section with connection settings in the `odbc.ini` 文件 +- `external_database` — Name of a database in an external DBMS. +- `external_table` — Name of a table in the `external_database`. + +为了安全地实现ODBC连接,ClickHouse使用单独的程序 `clickhouse-odbc-bridge`. 如果直接从ODBC驱动程序加载 `clickhouse-server`,驱动程序问题可能会导致ClickHouse服务器崩溃。 ClickHouse自动启动 `clickhouse-odbc-bridge` 当它是必需的。 ODBC桥程序是从相同的软件包作为安装 `clickhouse-server`. + +与字段 `NULL` 外部表中的值将转换为基数据类型的默认值。 例如,如果远程MySQL表字段具有 `INT NULL` 键入它将转换为0(ClickHouse的默认值 `Int32` 数据类型)。 + +## 用法示例 {#usage-example} + +**通过ODBC从本地MySQL安装获取数据** + +此示例检查Ubuntu Linux18.04和MySQL服务器5.7。 + +确保安装了unixODBC和MySQL连接器。 + +默认情况下(如果从软件包安装),ClickHouse以用户身份启动 `clickhouse`. 因此,您需要在MySQL服务器中创建和配置此用户。 + +``` bash +$ sudo mysql +``` + +``` sql +mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; +mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; +``` + +然后配置连接 `/etc/odbc.ini`. + +``` bash +$ cat /etc/odbc.ini +[mysqlconn] +DRIVER = /usr/local/lib/libmyodbc5w.so +SERVER = 127.0.0.1 +PORT = 3306 +DATABASE = test +USERNAME = clickhouse +PASSWORD = clickhouse +``` + +您可以使用 `isql` unixodbc安装中的实用程序。 + +``` bash +$ isql -v mysqlconn ++-------------------------+ +| Connected! | +| | +... +``` + +MySQL中的表: + +``` text +mysql> CREATE TABLE `test`.`test` ( + -> `int_id` INT NOT NULL AUTO_INCREMENT, + -> `int_nullable` INT NULL DEFAULT NULL, + -> `float` FLOAT NOT NULL, + -> `float_nullable` FLOAT NULL DEFAULT NULL, + -> PRIMARY KEY (`int_id`)); +Query OK, 0 rows affected (0,09 sec) + +mysql> insert into test (`int_id`, `float`) VALUES (1,2); +Query OK, 1 row affected (0,00 sec) + +mysql> select * from test; ++------+----------+-----+----------+ +| int_id | int_nullable | float | float_nullable | ++------+----------+-----+----------+ +| 1 | NULL | 2 | NULL | ++------+----------+-----+----------+ +1 row in set (0,00 sec) +``` + +从ClickHouse中的MySQL表中检索数据: + +``` sql +SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') +``` + +``` text +┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ +│ 1 │ 0 │ 2 │ 0 │ +└────────┴──────────────┴───────┴────────────────┘ +``` + +## 另请参阅 {#see-also} + +- [ODBC外部字典](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc) +- [ODBC表引擎](../../engines/table-engines/integrations/odbc.md). + +[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/zh/sql-reference/table-functions/remote.md b/docs/zh/sql-reference/table-functions/remote.md new file mode 100644 index 00000000000..46f7cd05b74 --- /dev/null +++ b/docs/zh/sql-reference/table-functions/remote.md @@ -0,0 +1,83 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 40 +toc_title: "\u8FDC\u7A0B" +--- + +# 远程,远程安全 {#remote-remotesecure} + +允许您访问远程服务器,而无需创建 `Distributed` 桌子 + +签名: + +``` sql +remote('addresses_expr', db, table[, 'user'[, 'password']]) +remote('addresses_expr', db.table[, 'user'[, 'password']]) +``` + +`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port`,或者只是 `host`. 主机可以指定为服务器名称,也可以指定为IPv4或IPv6地址。 IPv6地址在方括号中指定。 端口是远程服务器上的TCP端口。 如果省略端口,它使用 `tcp_port` 从服务器的配置文件(默认情况下,9000)。 + +!!! important "重要事项" + IPv6地址需要该端口。 + +例: + +``` text +example01-01-1 +example01-01-1:9000 +localhost +127.0.0.1 +[::]:9000 +[2a02:6b8:0:1111::11]:9000 +``` + +多个地址可以用逗号分隔。 在这种情况下,ClickHouse将使用分布式处理,因此它将将查询发送到所有指定的地址(如具有不同数据的分片)。 + +示例: + +``` text +example01-01-1,example01-02-1 +``` + +表达式的一部分可以用大括号指定。 前面的示例可以写成如下: + +``` text +example01-0{1,2}-1 +``` + +大括号可以包含由两个点(非负整数)分隔的数字范围。 在这种情况下,范围将扩展为生成分片地址的一组值。 如果第一个数字以零开头,则使用相同的零对齐形成值。 前面的示例可以写成如下: + +``` text +example01-{01..02}-1 +``` + +如果您有多对大括号,它会生成相应集合的直接乘积。 + +大括号中的地址和部分地址可以用管道符号(\|)分隔。 在这种情况下,相应的地址集被解释为副本,并且查询将被发送到第一个正常副本。 但是,副本将按照当前设置的顺序进行迭代 [load\_balancing](../../operations/settings/settings.md) 设置。 + +示例: + +``` text +example01-{01..02}-{1|2} +``` + +此示例指定两个分片,每个分片都有两个副本。 + +生成的地址数由常量限制。 现在这是1000个地址。 + +使用 `remote` 表函数比创建一个不太优化 `Distributed` 表,因为在这种情况下,服务器连接被重新建立为每个请求。 此外,如果设置了主机名,则会解析这些名称,并且在使用各种副本时不会计算错误。 在处理大量查询时,始终创建 `Distributed` 表的时间提前,不要使用 `remote` 表功能。 + +该 `remote` 表函数可以在以下情况下是有用的: + +- 访问特定服务器进行数据比较、调试和测试。 +- 查询之间的各种ClickHouse群集用于研究目的。 +- 手动发出的罕见分布式请求。 +- 每次重新定义服务器集的分布式请求。 + +如果未指定用户, `default` 被使用。 +如果未指定密码,则使用空密码。 + +`remoteSecure` -相同 `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port_secure) 从配置或9440. + +[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/zh/sql_reference/table_functions/url.md b/docs/zh/sql-reference/table-functions/url.md similarity index 100% rename from docs/zh/sql_reference/table_functions/url.md rename to docs/zh/sql-reference/table-functions/url.md diff --git a/docs/zh/sql_reference/aggregate_functions/combinators.md b/docs/zh/sql_reference/aggregate_functions/combinators.md deleted file mode 100644 index a8be457ab23..00000000000 --- a/docs/zh/sql_reference/aggregate_functions/combinators.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 37 -toc_title: "\u805A\u5408\u51FD\u6570\u7EC4\u5408\u5668" ---- - -# 聚合函数组合器 {#aggregate_functions_combinators} - -聚合函数的名称可以附加一个后缀。 这改变了聚合函数的工作方式。 - -## -如果 {#agg-functions-combinator-if} - -The suffix -If can be appended to the name of any aggregate function. In this case, the aggregate function accepts an extra argument – a condition (Uint8 type). The aggregate function processes only the rows that trigger the condition. If the condition was not triggered even once, it returns a default value (usually zeros or empty strings). - -例: `sumIf(column, cond)`, `countIf(cond)`, `avgIf(x, cond)`, `quantilesTimingIf(level1, level2)(x, cond)`, `argMinIf(arg, val, cond)` 等等。 - -使用条件聚合函数,您可以一次计算多个条件的聚合,而无需使用子查询和 `JOIN`例如,在Yandex的。Metrica,条件聚合函数用于实现段比较功能。 - -## -阵列 {#agg-functions-combinator-array} - --Array后缀可以附加到任何聚合函数。 在这种情况下,聚合函数采用的参数 ‘Array(T)’ 类型(数组)而不是 ‘T’ 类型参数。 如果聚合函数接受多个参数,则它必须是长度相等的数组。 在处理数组时,聚合函数的工作方式与所有数组元素的原始聚合函数类似。 - -示例1: `sumArray(arr)` -总计所有的所有元素 ‘arr’ 阵列。 在这个例子中,它可以更简单地编写: `sum(arraySum(arr))`. - -示例2: `uniqArray(arr)` – Counts the number of unique elements in all ‘arr’ 阵列。 这可以做一个更简单的方法: `uniq(arrayJoin(arr))`,但它并不总是可以添加 ‘arrayJoin’ 到查询。 - --如果和-阵列可以组合。 然而, ‘Array’ 必须先来,然后 ‘If’. 例: `uniqArrayIf(arr, cond)`, `quantilesTimingArrayIf(level1, level2)(arr, cond)`. 由于这个顺序,该 ‘cond’ 参数不会是数组。 - -## -州 {#agg-functions-combinator-state} - -如果应用此combinator,则聚合函数不会返回结果值(例如唯一值的数量 [uniq](reference.md#agg_function-uniq) 函数),但聚合的中间状态(用于 `uniq`,这是用于计算唯一值的数量的散列表)。 这是一个 `AggregateFunction(...)` 可用于进一步处理或存储在表中以完成聚合。 - -要使用这些状态,请使用: - -- [AggregatingMergeTree](../../engines/table_engines/mergetree_family/aggregatingmergetree.md) 表引擎。 -- [最后聚会](../../sql_reference/functions/other_functions.md#function-finalizeaggregation) 功能。 -- [跑累积](../../sql_reference/functions/other_functions.md#function-runningaccumulate) 功能。 -- [-合并](#aggregate_functions_combinators_merge) combinator -- [-MergeState](#aggregate_functions_combinators_mergestate) combinator - -## -合并 {#aggregate_functions_combinators-merge} - -如果应用此组合器,则聚合函数将中间聚合状态作为参数,组合状态以完成聚合,并返回结果值。 - -## -MergeState {#aggregate_functions_combinators-mergestate} - -以与-Merge combinator相同的方式合并中间聚合状态。 但是,它不会返回结果值,而是返回中间聚合状态,类似于-State combinator。 - -## -ForEach {#agg-functions-combinator-foreach} - -将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sumForEach` 对于数组 `[1, 2]`, `[3, 4, 5]`和`[6, 7]`返回结果 `[10, 13, 5]` 之后将相应的数组项添加在一起。 - -## -OrDefault {#agg-functions-combinator-ordefault} - -如果没有要聚合的内容,则填充聚合函数的返回类型的默认值。 - -``` sql -SELECT avg(number), avgOrDefault(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrDefault(number)─┐ -│ nan │ 0 │ -└─────────────┴──────────────────────┘ -``` - -## -OrNull {#agg-functions-combinator-ornull} - -填充 `null` 如果没有什么聚合。 返回列将为空。 - -``` sql -SELECT avg(number), avgOrNull(number) FROM numbers(0) -``` - -``` text -┌─avg(number)─┬─avgOrNull(number)─┐ -│ nan │ ᴺᵁᴸᴸ │ -└─────────────┴───────────────────┘ -``` - --OrDefault和-OrNull可以与其他组合器相结合。 当聚合函数不接受空输入时,它很有用。 - -``` sql -SELECT avgOrNullIf(x, x > 10) -FROM -( - SELECT toDecimal32(1.23, 2) AS x -) -``` - -``` text -┌─avgOrNullIf(x, greater(x, 10))─┐ -│ ᴺᵁᴸᴸ │ -└────────────────────────────────┘ -``` - -## -重新采样 {#agg-functions-combinator-resample} - -允许您将数据划分为组,然后单独聚合这些组中的数据。 通过将一列中的值拆分为间隔来创建组。 - -``` sql -Resample(start, end, step)(, resampling_key) -``` - -**参数** - -- `start` — Starting value of the whole required interval for `resampling_key` 值。 -- `stop` — Ending value of the whole required interval for `resampling_key` 值。 整个时间间隔不包括 `stop` 价值 `[start, stop)`. -- `step` — Step for separating the whole interval into subintervals. The `aggFunction` 在每个子区间上独立执行。 -- `resampling_key` — Column whose values are used for separating data into intervals. -- `aggFunction_params` — `aggFunction` 参数。 - -**返回值** - -- 阵列 `aggFunction` 每个子区间的结果。 - -**示例** - -考虑一下 `people` 具有以下数据的表: - -``` text -┌─name───┬─age─┬─wage─┐ -│ John │ 16 │ 10 │ -│ Alice │ 30 │ 15 │ -│ Mary │ 35 │ 8 │ -│ Evelyn │ 48 │ 11.5 │ -│ David │ 62 │ 9.9 │ -│ Brian │ 60 │ 16 │ -└────────┴─────┴──────┘ -``` - -让我们得到的人的名字,他们的年龄在于的时间间隔 `[30,60)` 和 `[60,75)`. 由于我们使用整数表示的年龄,我们得到的年龄 `[30, 59]` 和 `[60,74]` 间隔。 - -要在数组中聚合名称,我们使用 [groupArray](reference.md#agg_function-grouparray) 聚合函数。 这需要一个参数。 在我们的例子中,它是 `name` 列。 该 `groupArrayResample` 函数应该使用 `age` 按年龄聚合名称的列。 要定义所需的时间间隔,我们通过 `30, 75, 30` 参数到 `groupArrayResample` 功能。 - -``` sql -SELECT groupArrayResample(30, 75, 30)(name, age) FROM people -``` - -``` text -┌─groupArrayResample(30, 75, 30)(name, age)─────┐ -│ [['Alice','Mary','Evelyn'],['David','Brian']] │ -└───────────────────────────────────────────────┘ -``` - -考虑结果。 - -`Jonh` 是因为他太年轻了 其他人按照指定的年龄间隔进行分配。 - -现在让我们计算指定年龄间隔内的总人数和平均工资。 - -``` sql -SELECT - countResample(30, 75, 30)(name, age) AS amount, - avgResample(30, 75, 30)(wage, age) AS avg_wage -FROM people -``` - -``` text -┌─amount─┬─avg_wage──────────────────┐ -│ [3,2] │ [11.5,12.949999809265137] │ -└────────┴───────────────────────────┘ -``` - -[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) diff --git a/docs/zh/sql_reference/aggregate_functions/index.md b/docs/zh/sql_reference/aggregate_functions/index.md deleted file mode 100644 index 7e53c8c8c53..00000000000 --- a/docs/zh/sql_reference/aggregate_functions/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_folder_title: "\u805A\u5408\u51FD\u6570" -toc_priority: 33 -toc_title: "\u5BFC\u8A00" ---- - -# 聚合函数 {#aggregate-functions} - -聚合函数在 [正常](http://www.sql-tutorial.com/sql-aggregate-functions-sql-tutorial) 方式如预期的数据库专家。 - -ClickHouse还支持: - -- [参数聚合函数](parametric_functions.md#aggregate_functions_parametric),它接受除列之外的其他参数。 -- [组合器](combinators.md#aggregate_functions_combinators),这改变了聚合函数的行为。 - -## 空处理 {#null-processing} - -在聚合过程中,所有 `NULL`s被跳过。 - -**例:** - -考虑这个表: - -``` text -┌─x─┬────y─┐ -│ 1 │ 2 │ -│ 2 │ ᴺᵁᴸᴸ │ -│ 3 │ 2 │ -│ 3 │ 3 │ -│ 3 │ ᴺᵁᴸᴸ │ -└───┴──────┘ -``` - -比方说,你需要在总的值 `y` 列: - -``` sql -SELECT sum(y) FROM t_null_big -``` - - ┌─sum(y)─┐ - │ 7 │ - └────────┘ - -该 `sum` 函数解释 `NULL` 作为 `0`. 特别是,这意味着,如果函数接收输入的选择,其中所有的值 `NULL`,那么结果将是 `0`,不 `NULL`. - -现在你可以使用 `groupArray` 函数从创建一个数组 `y` 列: - -``` sql -SELECT groupArray(y) FROM t_null_big -``` - -``` text -┌─groupArray(y)─┐ -│ [2,2,3] │ -└───────────────┘ -``` - -`groupArray` 不包括 `NULL` 在生成的数组中。 - -[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/) diff --git a/docs/zh/sql_reference/aggregate_functions/parametric_functions.md b/docs/zh/sql_reference/aggregate_functions/parametric_functions.md deleted file mode 100644 index 18adcd93487..00000000000 --- a/docs/zh/sql_reference/aggregate_functions/parametric_functions.md +++ /dev/null @@ -1,499 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 38 -toc_title: "\u53C2\u6570\u805A\u5408\u51FD\u6570" ---- - -# 参数聚合函数 {#aggregate_functions_parametric} - -Some aggregate functions can accept not only argument columns (used for compression), but a set of parameters – constants for initialization. The syntax is two pairs of brackets instead of one. The first is for parameters, and the second is for arguments. - -## 直方图 {#histogram} - -计算自适应直方图。 它不能保证精确的结果。 - -``` sql -histogram(number_of_bins)(values) -``` - -该函数使用 [流式并行决策树算法](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf). 当新数据输入函数时,hist图分区的边界将被调整。 在通常情况下,箱的宽度不相等。 - -**参数** - -`number_of_bins` — Upper limit for the number of bins in the histogram. The function automatically calculates the number of bins. It tries to reach the specified number of bins, but if it fails, it uses fewer bins. -`values` — [表达式](../syntax.md#syntax-expressions) 导致输入值。 - -**返回值** - -- [阵列](../../sql_reference/data_types/array.md) 的 [元组](../../sql_reference/data_types/tuple.md) 下面的格式: - - ``` - [(lower_1, upper_1, height_1), ... (lower_N, upper_N, height_N)] - ``` - - - `lower` — Lower bound of the bin. - - `upper` — Upper bound of the bin. - - `height` — Calculated height of the bin. - -**示例** - -``` sql -SELECT histogram(5)(number + 1) -FROM ( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─histogram(5)(plus(number, 1))───────────────────────────────────────────┐ -│ [(1,4.5,4),(4.5,8.5,4),(8.5,12.75,4.125),(12.75,17,4.625),(17,20,3.25)] │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -您可以使用 [酒吧](../../sql_reference/functions/other_functions.md#function-bar) 功能,例如: - -``` sql -WITH histogram(5)(rand() % 100) AS hist -SELECT - arrayJoin(hist).3 AS height, - bar(height, 0, 6, 5) AS bar -FROM -( - SELECT * - FROM system.numbers - LIMIT 20 -) -``` - -``` text -┌─height─┬─bar───┐ -│ 2.125 │ █▋ │ -│ 3.25 │ ██▌ │ -│ 5.625 │ ████▏ │ -│ 5.625 │ ████▏ │ -│ 3.375 │ ██▌ │ -└────────┴───────┘ -``` - -在这种情况下,您应该记住您不知道直方图bin边界。 - -## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch} - -检查序列是否包含与模式匹配的事件链。 - -``` sql -sequenceMatch(pattern)(timestamp, cond1, cond2, ...) -``` - -!!! warning "警告" - 在同一秒钟发生的事件可能以未定义的顺序排列在序列中,影响结果。 - -**参数** - -- `pattern` — Pattern string. See [模式语法](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` 和 `DateTime`. 您还可以使用任何支持的 [UInt](../../sql_reference/data_types/int_uint.md) 数据类型。 - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最多可以传递32个条件参数。 该函数只考虑这些条件中描述的事件。 如果序列包含未在条件中描述的数据,则函数将跳过这些数据。 - -**返回值** - -- 1,如果模式匹配。 -- 0,如果模式不匹配。 - -类型: `UInt8`. - - -**模式语法** - -- `(?N)` — Matches the condition argument at position `N`. 条件在编号 `[1, 32]` 范围。 例如, `(?1)` 匹配传递给 `cond1` 参数。 - -- `.*` — Matches any number of events. You don't need conditional arguments to match this element of the pattern. - -- `(?t operator value)` — Sets the time in seconds that should separate two events. For example, pattern `(?1)(?t>1800)(?2)` 匹配彼此发生超过1800秒的事件。 这些事件之间可以存在任意数量的任何事件。 您可以使用 `>=`, `>`, `<`, `<=` 运营商。 - -**例** - -考虑在数据 `t` 表: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -└──────┴────────┘ -``` - -执行查询: - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 1 │ -└───────────────────────────────────────────────────────────────────────┘ -``` - -该函数找到了数字2跟随数字1的事件链。 它跳过了它们之间的数字3,因为该数字没有被描述为事件。 如果我们想在搜索示例中给出的事件链时考虑这个数字,我们应该为它创建一个条件。 - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 3) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 3))─┐ -│ 0 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -在这种情况下,函数找不到与模式匹配的事件链,因为数字3的事件发生在1和2之间。 如果在相同的情况下,我们检查了数字4的条件,则序列将与模式匹配。 - -``` sql -SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM t -``` - -``` text -┌─sequenceMatch('(?1)(?2)')(time, equals(number, 1), equals(number, 2), equals(number, 4))─┐ -│ 1 │ -└──────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -**另请参阅** - -- [sequenceCount](#function-sequencecount) - -## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount} - -计数与模式匹配的事件链的数量。 该函数搜索不重叠的事件链。 当前链匹配后,它开始搜索下一个链。 - -!!! warning "警告" - 在同一秒钟发生的事件可能以未定义的顺序排列在序列中,影响结果。 - -``` sql -sequenceCount(pattern)(timestamp, cond1, cond2, ...) -``` - -**参数** - -- `pattern` — Pattern string. See [模式语法](#sequence-function-pattern-syntax). - -- `timestamp` — Column considered to contain time data. Typical data types are `Date` 和 `DateTime`. 您还可以使用任何支持的 [UInt](../../sql_reference/data_types/int_uint.md) 数据类型。 - -- `cond1`, `cond2` — Conditions that describe the chain of events. Data type: `UInt8`. 最多可以传递32个条件参数。 该函数只考虑这些条件中描述的事件。 如果序列包含未在条件中描述的数据,则函数将跳过这些数据。 - -**返回值** - -- 匹配的非重叠事件链数。 - -类型: `UInt64`. - -**示例** - -考虑在数据 `t` 表: - -``` text -┌─time─┬─number─┐ -│ 1 │ 1 │ -│ 2 │ 3 │ -│ 3 │ 2 │ -│ 4 │ 1 │ -│ 5 │ 3 │ -│ 6 │ 2 │ -└──────┴────────┘ -``` - -计算数字2在数字1之后出现的次数以及它们之间的任何其他数字: - -``` sql -SELECT sequenceCount('(?1).*(?2)')(time, number = 1, number = 2) FROM t -``` - -``` text -┌─sequenceCount('(?1).*(?2)')(time, equals(number, 1), equals(number, 2))─┐ -│ 2 │ -└─────────────────────────────────────────────────────────────────────────┘ -``` - -**另请参阅** - -- [sequenceMatch](#function-sequencematch) - -## windowFunnel {#windowfunnel} - -搜索滑动时间窗中的事件链,并计算从链中发生的最大事件数。 - -该函数根据算法工作: - -- 该函数搜索触发链中的第一个条件并将事件计数器设置为1的数据。 这是滑动窗口启动的时刻。 - -- 如果来自链的事件在窗口内顺序发生,则计数器将递增。 如果事件序列中断,则计数器不会增加。 - -- 如果数据在不同的完成点具有多个事件链,则该函数将仅输出最长链的大小。 - -**语法** - -``` sql -windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN) -``` - -**参数** - -- `window` — Length of the sliding window in seconds. -- `mode` -这是一个可选的参数。 - - `'strict'` -当 `'strict'` 设置时,windowFunnel()仅对唯一值应用条件。 -- `timestamp` — Name of the column containing the timestamp. Data types supported: [日期](../../sql_reference/data_types/date.md), [日期时间](../../sql_reference/data_types/datetime.md#data_type-datetime) 和其他无符号整数类型(请注意,即使时间戳支持 `UInt64` 类型,它的值不能超过Int64最大值,即2^63-1)。 -- `cond` — Conditions or data describing the chain of events. [UInt8](../../sql_reference/data_types/int_uint.md). - -**返回值** - -滑动时间窗口内连续触发条件链的最大数目。 -对选择中的所有链进行了分析。 - -类型: `Integer`. - -**示例** - -确定设定的时间段是否足以让用户选择手机并在在线商店中购买两次。 - -设置以下事件链: - -1. 用户登录到其在应用商店中的帐户 (`eventID = 1003`). -2. 用户搜索手机 (`eventID = 1007, product = 'phone'`). -3. 用户下了订单 (`eventID = 1009`). -4. 用户再次下订单 (`eventID = 1010`). - -输入表: - -``` text -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-28 │ 1 │ 2019-01-29 10:00:00 │ 1003 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-31 │ 1 │ 2019-01-31 09:00:00 │ 1007 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-01-30 │ 1 │ 2019-01-30 08:00:00 │ 1009 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -┌─event_date─┬─user_id─┬───────────timestamp─┬─eventID─┬─product─┐ -│ 2019-02-01 │ 1 │ 2019-02-01 08:00:00 │ 1010 │ phone │ -└────────────┴─────────┴─────────────────────┴─────────┴─────────┘ -``` - -了解用户有多远 `user_id` 可以在2019的1-2月期间通过链条。 - -查询: - -``` sql -SELECT - level, - count() AS c -FROM -( - SELECT - user_id, - windowFunnel(6048000000000000)(timestamp, eventID = 1003, eventID = 1009, eventID = 1007, eventID = 1010) AS level - FROM trend - WHERE (event_date >= '2019-01-01') AND (event_date <= '2019-02-02') - GROUP BY user_id -) -GROUP BY level -ORDER BY level ASC -``` - -结果: - -``` text -┌─level─┬─c─┐ -│ 4 │ 1 │ -└───────┴───┘ -``` - -## 保留 {#retention} - -该函数将一组条件作为参数,类型为1到32个参数 `UInt8` 表示事件是否满足特定条件。 -任何条件都可以指定为参数(如 [WHERE](../../sql_reference/statements/select.md#select-where)). - -除了第一个以外,条件成对适用:如果第一个和第二个是真的,第二个结果将是真的,如果第一个和fird是真的,第三个结果将是真的,等等。 - -**语法** - -``` sql -retention(cond1, cond2, ..., cond32); -``` - -**参数** - -- `cond` — an expression that returns a `UInt8` 结果(1或0)。 - -**返回值** - -数组为1或0。 - -- 1 — condition was met for the event. -- 0 — condition wasn't met for the event. - -类型: `UInt8`. - -**示例** - -让我们考虑计算的一个例子 `retention` 功能,以确定网站流量。 - -**1.** Сreate a table to illustrate an example. - -``` sql -CREATE TABLE retention_test(date Date, uid Int32) ENGINE = Memory; - -INSERT INTO retention_test SELECT '2020-01-01', number FROM numbers(5); -INSERT INTO retention_test SELECT '2020-01-02', number FROM numbers(10); -INSERT INTO retention_test SELECT '2020-01-03', number FROM numbers(15); -``` - -输入表: - -查询: - -``` sql -SELECT * FROM retention_test -``` - -结果: - -``` text -┌───────date─┬─uid─┐ -│ 2020-01-01 │ 0 │ -│ 2020-01-01 │ 1 │ -│ 2020-01-01 │ 2 │ -│ 2020-01-01 │ 3 │ -│ 2020-01-01 │ 4 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-02 │ 0 │ -│ 2020-01-02 │ 1 │ -│ 2020-01-02 │ 2 │ -│ 2020-01-02 │ 3 │ -│ 2020-01-02 │ 4 │ -│ 2020-01-02 │ 5 │ -│ 2020-01-02 │ 6 │ -│ 2020-01-02 │ 7 │ -│ 2020-01-02 │ 8 │ -│ 2020-01-02 │ 9 │ -└────────────┴─────┘ -┌───────date─┬─uid─┐ -│ 2020-01-03 │ 0 │ -│ 2020-01-03 │ 1 │ -│ 2020-01-03 │ 2 │ -│ 2020-01-03 │ 3 │ -│ 2020-01-03 │ 4 │ -│ 2020-01-03 │ 5 │ -│ 2020-01-03 │ 6 │ -│ 2020-01-03 │ 7 │ -│ 2020-01-03 │ 8 │ -│ 2020-01-03 │ 9 │ -│ 2020-01-03 │ 10 │ -│ 2020-01-03 │ 11 │ -│ 2020-01-03 │ 12 │ -│ 2020-01-03 │ 13 │ -│ 2020-01-03 │ 14 │ -└────────────┴─────┘ -``` - -**2.** 按唯一ID对用户进行分组 `uid` 使用 `retention` 功能。 - -查询: - -``` sql -SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r -FROM retention_test -WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') -GROUP BY uid -ORDER BY uid ASC -``` - -结果: - -``` text -┌─uid─┬─r───────┐ -│ 0 │ [1,1,1] │ -│ 1 │ [1,1,1] │ -│ 2 │ [1,1,1] │ -│ 3 │ [1,1,1] │ -│ 4 │ [1,1,1] │ -│ 5 │ [0,0,0] │ -│ 6 │ [0,0,0] │ -│ 7 │ [0,0,0] │ -│ 8 │ [0,0,0] │ -│ 9 │ [0,0,0] │ -│ 10 │ [0,0,0] │ -│ 11 │ [0,0,0] │ -│ 12 │ [0,0,0] │ -│ 13 │ [0,0,0] │ -│ 14 │ [0,0,0] │ -└─────┴─────────┘ -``` - -**3.** 计算每天的现场访问总数。 - -查询: - -``` sql -SELECT - sum(r[1]) AS r1, - sum(r[2]) AS r2, - sum(r[3]) AS r3 -FROM -( - SELECT - uid, - retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r - FROM retention_test - WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') - GROUP BY uid -) -``` - -结果: - -``` text -┌─r1─┬─r2─┬─r3─┐ -│ 5 │ 5 │ 5 │ -└────┴────┴────┘ -``` - -哪里: - -- `r1`-2020-01-01期间访问该网站的独立访问者数量( `cond1` 条件)。 -- `r2`-在2020-01-01和2020-01-02之间的特定时间段内访问该网站的唯一访问者的数量 (`cond1` 和 `cond2` 条件)。 -- `r3`-在2020-01-01和2020-01-03之间的特定时间段内访问该网站的唯一访问者的数量 (`cond1` 和 `cond3` 条件)。 - -## uniqUpTo(N)(x) {#uniquptonx} - -Calculates the number of different argument values ​​if it is less than or equal to N. If the number of different argument values is greater than N, it returns N + 1. - -建议使用小Ns,高达10。 N的最大值为100。 - -对于聚合函数的状态,它使用的内存量等于1+N\*一个字节值的大小。 -对于字符串,它存储8个字节的非加密哈希。 也就是说,计算是近似的字符串。 - -该函数也适用于多个参数。 - -它的工作速度尽可能快,除了使用较大的N值并且唯一值的数量略小于N的情况。 - -用法示例: - -``` text -Problem: Generate a report that shows only keywords that produced at least 5 unique users. -Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5 -``` - -[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) - -## sumMapFiltered(keys\_to\_keep)(键值) {#summapfilteredkeys-to-keepkeys-values} - -同样的行为 [sumMap](reference.md#agg_functions-summap) 除了一个键数组作为参数传递。 这在使用高基数密钥时尤其有用。 diff --git a/docs/zh/sql_reference/aggregate_functions/reference.md b/docs/zh/sql_reference/aggregate_functions/reference.md deleted file mode 100644 index b8071860d41..00000000000 --- a/docs/zh/sql_reference/aggregate_functions/reference.md +++ /dev/null @@ -1,1878 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 36 -toc_title: "\u53C2\u8003\u8D44\u6599" ---- - -# 函数参考 {#function-reference} - -## 计数 {#agg_function-count} - -计数行数或非空值。 - -ClickHouse支持以下语法 `count`: -- `count(expr)` 或 `COUNT(DISTINCT expr)`. -- `count()` 或 `COUNT(*)`. 该 `count()` 语法是ClickHouse特定的。 - -**参数** - -该功能可以采取: - -- 零参数。 -- 一 [表达式](../syntax.md#syntax-expressions). - -**返回值** - -- 如果没有参数调用函数,它会计算行数。 -- 如果 [表达式](../syntax.md#syntax-expressions) 被传递,则该函数计数此表达式返回的次数非null。 如果表达式返回 [可为空](../../sql_reference/data_types/nullable.md)-键入值,然后结果 `count` 保持不 `Nullable`. 如果返回表达式,则该函数返回0 `NULL` 对于所有的行。 - -在这两种情况下,返回值的类型为 [UInt64](../../sql_reference/data_types/int_uint.md). - -**详细信息** - -ClickHouse支持 `COUNT(DISTINCT ...)` 语法 这种结构的行为取决于 [count\_distinct\_implementation](../../operations/settings/settings.md#settings-count_distinct_implementation) 设置。 它定义了其中的 [uniq\*](#agg_function-uniq) 函数用于执行操作。 默认值为 [uniqExact](#agg_function-uniqexact) 功能。 - -该 `SELECT count() FROM table` 查询未被优化,因为表中的条目数没有单独存储。 它从表中选择一个小列并计算其中的值数。 - -**例** - -示例1: - -``` sql -SELECT count() FROM t -``` - -``` text -┌─count()─┐ -│ 5 │ -└─────────┘ -``` - -示例2: - -``` sql -SELECT name, value FROM system.settings WHERE name = 'count_distinct_implementation' -``` - -``` text -┌─name──────────────────────────┬─value─────┐ -│ count_distinct_implementation │ uniqExact │ -└───────────────────────────────┴───────────┘ -``` - -``` sql -SELECT count(DISTINCT num) FROM t -``` - -``` text -┌─uniqExact(num)─┐ -│ 3 │ -└────────────────┘ -``` - -这个例子表明 `count(DISTINCT num)` 由执行 `uniqExact` 根据功能 `count_distinct_implementation` 设定值。 - -## 任何(x) {#agg_function-any} - -选择第一个遇到的值。 -查询可以以任何顺序执行,甚至每次都以不同的顺序执行,因此此函数的结果是不确定的。 -要获得确定的结果,您可以使用 ‘min’ 或 ‘max’ 功能,而不是 ‘any’. - -在某些情况下,可以依靠执行的顺序。 这适用于SELECT来自使用ORDER BY的子查询的情况。 - -当一个 `SELECT` 查询具有 `GROUP BY` 子句或至少一个聚合函数,ClickHouse(相对于MySQL)要求在所有表达式 `SELECT`, `HAVING`,和 `ORDER BY` 子句可以从键或聚合函数计算。 换句话说,从表中选择的每个列必须在键或聚合函数内使用。 要获得像MySQL这样的行为,您可以将其他列放在 `any` 聚合函数。 - -## anyHeavy(x) {#anyheavyx} - -使用选择一个频繁出现的值 [重打者](http://www.cs.umd.edu/~samir/498/karp.pdf) 算法。 如果某个值在查询的每个执行线程中出现的情况超过一半,则返回此值。 通常情况下,结果是不确定的。 - -``` sql -anyHeavy(column) -``` - -**参数** - -- `column` – The column name. - -**示例** - -就拿 [时间](../../getting_started/example_datasets/ontime.md) 数据集,并选择在任何频繁出现的值 `AirlineID` 列。 - -``` sql -SELECT anyHeavy(AirlineID) AS res -FROM ontime -``` - -``` text -┌───res─┐ -│ 19690 │ -└───────┘ -``` - -## anyLast(x) {#anylastx} - -选择遇到的最后一个值。 -其结果是一样不确定的 `any` 功能。 - -## 集团比特 {#groupbitand} - -按位应用 `AND` 对于一系列的数字。 - -``` sql -groupBitAnd(expr) -``` - -**参数** - -`expr` – An expression that results in `UInt*` 类型。 - -**返回值** - -的价值 `UInt*` 类型。 - -**示例** - -测试数据: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -查询: - -``` sql -SELECT groupBitAnd(num) FROM t -``` - -哪里 `num` 是包含测试数据的列。 - -结果: - -``` text -binary decimal -00000100 = 4 -``` - -## groupBitOr {#groupbitor} - -按位应用 `OR` 对于一系列的数字。 - -``` sql -groupBitOr(expr) -``` - -**参数** - -`expr` – An expression that results in `UInt*` 类型。 - -**返回值** - -的价值 `UInt*` 类型。 - -**示例** - -测试数据: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -查询: - -``` sql -SELECT groupBitOr(num) FROM t -``` - -哪里 `num` 是包含测试数据的列。 - -结果: - -``` text -binary decimal -01111101 = 125 -``` - -## groupBitXor {#groupbitxor} - -按位应用 `XOR` 对于一系列的数字。 - -``` sql -groupBitXor(expr) -``` - -**参数** - -`expr` – An expression that results in `UInt*` 类型。 - -**返回值** - -的价值 `UInt*` 类型。 - -**示例** - -测试数据: - -``` text -binary decimal -00101100 = 44 -00011100 = 28 -00001101 = 13 -01010101 = 85 -``` - -查询: - -``` sql -SELECT groupBitXor(num) FROM t -``` - -哪里 `num` 是包含测试数据的列。 - -结果: - -``` text -binary decimal -01101000 = 104 -``` - -## groupBitmap {#groupbitmap} - -从无符号整数列的位图或聚合计算,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmap(expr) -``` - -**参数** - -`expr` – An expression that results in `UInt*` 类型。 - -**返回值** - -的价值 `UInt64` 类型。 - -**示例** - -测试数据: - -``` text -UserID -1 -1 -2 -3 -``` - -查询: - -``` sql -SELECT groupBitmap(UserID) as num FROM t -``` - -结果: - -``` text -num -3 -``` - -## min(x) {#agg_function-min} - -计算最小值。 - -## max(x) {#agg_function-max} - -计算最大值。 - -## argMin(arg,val) {#agg-function-argmin} - -计算 ‘arg’ 最小值的值 ‘val’ 价值。 如果有几个不同的值 ‘arg’ 对于最小值 ‘val’,遇到的第一个值是输出。 - -**示例:** - -``` text -┌─user─────┬─salary─┐ -│ director │ 5000 │ -│ manager │ 3000 │ -│ worker │ 1000 │ -└──────────┴────────┘ -``` - -``` sql -SELECT argMin(user, salary) FROM salary -``` - -``` text -┌─argMin(user, salary)─┐ -│ worker │ -└──────────────────────┘ -``` - -## argMax(arg,val) {#agg-function-argmax} - -计算 ‘arg’ 最大值 ‘val’ 价值。 如果有几个不同的值 ‘arg’ 对于最大值 ‘val’,遇到的第一个值是输出。 - -## sum(x) {#agg_function-sum} - -计算总和。 -只适用于数字。 - -## sumWithOverflow(x) {#sumwithoverflowx} - -使用与输入参数相同的数据类型计算数字的总和。 如果总和超过此数据类型的最大值,则函数返回错误。 - -只适用于数字。 - -## sumMap(key,value) {#agg_functions-summap} - -总计 ‘value’ 数组根据在指定的键 ‘key’ 阵列。 -元素的数量 ‘key’ 和 ‘value’ 总计的每一行必须相同。 -Returns a tuple of two arrays: keys in sorted order, and values ​​summed for the corresponding keys. - -示例: - -``` sql -CREATE TABLE sum_map( - date Date, - timeslot DateTime, - statusMap Nested( - status UInt16, - requests UInt64 - ) -) ENGINE = Log; -INSERT INTO sum_map VALUES - ('2000-01-01', '2000-01-01 00:00:00', [1, 2, 3], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:00:00', [3, 4, 5], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [4, 5, 6], [10, 10, 10]), - ('2000-01-01', '2000-01-01 00:01:00', [6, 7, 8], [10, 10, 10]); -SELECT - timeslot, - sumMap(statusMap.status, statusMap.requests) -FROM sum_map -GROUP BY timeslot -``` - -``` text -┌────────────timeslot─┬─sumMap(statusMap.status, statusMap.requests)─┐ -│ 2000-01-01 00:00:00 │ ([1,2,3,4,5],[10,10,20,10,10]) │ -│ 2000-01-01 00:01:00 │ ([4,5,6,7,8],[10,10,20,10,10]) │ -└─────────────────────┴──────────────────────────────────────────────┘ -``` - -## skewPop {#skewpop} - -计算 [歪斜](https://en.wikipedia.org/wiki/Skewness) 的序列。 - -``` sql -skewPop(expr) -``` - -**参数** - -`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 - -**返回值** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**示例** - -``` sql -SELECT skewPop(value) FROM series_with_value_column -``` - -## skewSamp {#skewsamp} - -计算 [样品偏度](https://en.wikipedia.org/wiki/Skewness) 的序列。 - -它表示随机变量的偏度的无偏估计,如果传递的值形成其样本。 - -``` sql -skewSamp(expr) -``` - -**参数** - -`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 - -**返回值** - -The skewness of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). 如果 `n <= 1` (`n` 是样本的大小),则该函数返回 `nan`. - -**示例** - -``` sql -SELECT skewSamp(value) FROM series_with_value_column -``` - -## kurtPop {#kurtpop} - -计算 [峰度](https://en.wikipedia.org/wiki/Kurtosis) 的序列。 - -``` sql -kurtPop(expr) -``` - -**参数** - -`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 - -**返回值** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md) - -**示例** - -``` sql -SELECT kurtPop(value) FROM series_with_value_column -``` - -## kurtSamp {#kurtsamp} - -计算 [峰度样本](https://en.wikipedia.org/wiki/Kurtosis) 的序列。 - -它表示随机变量峰度的无偏估计,如果传递的值形成其样本。 - -``` sql -kurtSamp(expr) -``` - -**参数** - -`expr` — [表达式](../syntax.md#syntax-expressions) 返回一个数字。 - -**返回值** - -The kurtosis of the given distribution. Type — [Float64](../../sql_reference/data_types/float.md). 如果 `n <= 1` (`n` 是样本的大小),则该函数返回 `nan`. - -**示例** - -``` sql -SELECT kurtSamp(value) FROM series_with_value_column -``` - -## timeSeriesGroupSum(uid,timestamp,value) {#agg-function-timeseriesgroupsum} - -`timeSeriesGroupSum` 可以聚合不同的时间序列,即采样时间戳不对齐。 -它将在两个采样时间戳之间使用线性插值,然后将时间序列和在一起。 - -- `uid` 是时间序列唯一id, `UInt64`. -- `timestamp` 是Int64型,以支持毫秒或微秒。 -- `value` 是指标。 - -函数返回元组数组 `(timestamp, aggregated_value)` 对。 - -在使用此功能之前,请确保 `timestamp` 按升序排列 - -示例: - -``` text -┌─uid─┬─timestamp─┬─value─┐ -│ 1 │ 2 │ 0.2 │ -│ 1 │ 7 │ 0.7 │ -│ 1 │ 12 │ 1.2 │ -│ 1 │ 17 │ 1.7 │ -│ 1 │ 25 │ 2.5 │ -│ 2 │ 3 │ 0.6 │ -│ 2 │ 8 │ 1.6 │ -│ 2 │ 12 │ 2.4 │ -│ 2 │ 18 │ 3.6 │ -│ 2 │ 24 │ 4.8 │ -└─────┴───────────┴───────┘ -``` - -``` sql -CREATE TABLE time_series( - uid UInt64, - timestamp Int64, - value Float64 -) ENGINE = Memory; -INSERT INTO time_series VALUES - (1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5), - (2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8); - -SELECT timeSeriesGroupSum(uid, timestamp, value) -FROM ( - SELECT * FROM time_series order by timestamp ASC -); -``` - -其结果将是: - -``` text -[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)] -``` - -## timeSeriesGroupRateSum(uid,ts,val) {#agg-function-timeseriesgroupratesum} - -同样,timeSeriesGroupRateSum,timeSeriesGroupRateSum将计算时间序列的速率,然后将速率总和在一起。 -此外,使用此函数之前,时间戳应该是上升顺序。 - -使用此函数,上述情况下的结果将是: - -``` text -[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)] -``` - -## avg(x) {#agg_function-avg} - -计算平均值。 -只适用于数字。 -结果总是Float64。 - -## 平均加权 {#avgweighted} - -计算 [加权算术平均值](https://en.wikipedia.org/wiki/Weighted_arithmetic_mean). - -**语法** - -``` sql -avgWeighted(x, weight) -``` - -**参数** - -- `x` — Values. [整数](../data_types/int_uint.md) 或 [浮点](../data_types/float.md). -- `weight` — Weights of the values. [整数](../data_types/int_uint.md) 或 [浮点](../data_types/float.md). - -类型 `x` 和 `weight` 一定是一样的 - -**返回值** - -- 加权平均值。 -- `NaN`. 如果所有的权重都等于0。 - -类型: [Float64](../data_types/float.md). - -**示例** - -查询: - -``` sql -SELECT avgWeighted(x, w) -FROM values('x Int8, w Int8', (4, 1), (1, 0), (10, 2)) -``` - -结果: - -``` text -┌─avgWeighted(x, weight)─┐ -│ 8 │ -└────────────────────────┘ -``` - -## uniq {#agg_function-uniq} - -计算参数的不同值的近似数量。 - -``` sql -uniq(x[, ...]) -``` - -**参数** - -该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 - -**返回值** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-键入号码。 - -**实施细节** - -功能: - -- 计算聚合中所有参数的哈希值,然后在计算中使用它。 - -- 使用自适应采样算法。 对于计算状态,该函数使用最多65536个元素哈希值的样本。 - - This algorithm is very accurate and very efficient on the CPU. When the query contains several of these functions, using `uniq` is almost as fast as using other aggregate functions. - -- 确定性地提供结果(它不依赖于查询处理顺序)。 - -我们建议在几乎所有情况下使用此功能。 - -**另请参阅** - -- [uniqCombined](#agg_function-uniqcombined) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined {#agg_function-uniqcombined} - -计算不同参数值的近似数量。 - -``` sql -uniqCombined(HLL_precision)(x[, ...]) -``` - -该 `uniqCombined` 函数是计算不同数值数量的不错选择。 - -**参数** - -该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 - -`HLL_precision` 是以2为底的单元格数的对数 [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog). 可选,您可以将该函数用作 `uniqCombined(x[, ...])`. 默认值 `HLL_precision` 是17,这是有效的96KiB的空间(2^17个单元,每个6比特)。 - -**返回值** - -- 一个数字 [UInt64](../../sql_reference/data_types/int_uint.md)-键入号码。 - -**实施细节** - -功能: - -- 计算散列(64位散列 `String` 否则32位)对于聚合中的所有参数,然后在计算中使用它。 - -- 使用三种算法的组合:数组、哈希表和HyperLogLog与error错表。 - - For a small number of distinct elements, an array is used. When the set size is larger, a hash table is used. For a larger number of elements, HyperLogLog is used, which will occupy a fixed amount of memory. - -- 确定性地提供结果(它不依赖于查询处理顺序)。 - -!!! note "注" - 因为它使用32位散列非-`String` 类型,结果将有非常高的误差基数显着大于 `UINT_MAX` (错误将在几百亿不同值之后迅速提高),因此在这种情况下,您应该使用 [uniqCombined64](#agg_function-uniqcombined64) - -相比于 [uniq](#agg_function-uniq) 功能,该 `uniqCombined`: - -- 消耗少几倍的内存。 -- 计算精度高出几倍。 -- 通常具有略低的性能。 在某些情况下, `uniqCombined` 可以表现得比 `uniq`,例如,使用通过网络传输大量聚合状态的分布式查询。 - -**另请参阅** - -- [uniq](#agg_function-uniq) -- [uniqCombined64](#agg_function-uniqcombined64) -- [uniqHLL12](#agg_function-uniqhll12) -- [uniqExact](#agg_function-uniqexact) - -## uniqCombined64 {#agg_function-uniqcombined64} - -和 [uniqCombined](#agg_function-uniqcombined),但对所有数据类型使用64位哈希。 - -## uniqHLL12 {#agg_function-uniqhll12} - -计算不同参数值的近似数量,使用 [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) 算法。 - -``` sql -uniqHLL12(x[, ...]) -``` - -**参数** - -该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 - -**返回值** - -- A [UInt64](../../sql_reference/data_types/int_uint.md)-键入号码。 - -**实施细节** - -功能: - -- 计算聚合中所有参数的哈希值,然后在计算中使用它。 - -- 使用HyperLogLog算法来近似不同参数值的数量。 - - 212 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements). - -- 提供确定结果(它不依赖于查询处理顺序)。 - -我们不建议使用此功能。 在大多数情况下,使用 [uniq](#agg_function-uniq) 或 [uniqCombined](#agg_function-uniqcombined) 功能。 - -**另请参阅** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqExact](#agg_function-uniqexact) - -## uniqExact {#agg_function-uniqexact} - -计算不同参数值的准确数目。 - -``` sql -uniqExact(x[, ...]) -``` - -使用 `uniqExact` 功能,如果你绝对需要一个确切的结果。 否则使用 [uniq](#agg_function-uniq) 功能。 - -该 `uniqExact` 功能使用更多的内存比 `uniq`,因为状态的大小随着不同值的数量的增加而无界增长。 - -**参数** - -该函数采用可变数量的参数。 参数可以是 `Tuple`, `Array`, `Date`, `DateTime`, `String`,或数字类型。 - -**另请参阅** - -- [uniq](#agg_function-uniq) -- [uniqCombined](#agg_function-uniqcombined) -- [uniqHLL12](#agg_function-uniqhll12) - -## 群交(x),群交(max\_size)(x) {#agg_function-grouparray} - -创建参数值的数组。 -值可以按任何(不确定)顺序添加到数组中。 - -第二个版本(与 `max_size` 参数)将结果数组的大小限制为 `max_size` 元素。 -例如, `groupArray (1) (x)` 相当于 `[any (x)]`. - -在某些情况下,您仍然可以依靠执行的顺序。 这适用于以下情况 `SELECT` 来自使用 `ORDER BY`. - -## groupArrayInsertAt(值,位置) {#grouparrayinsertatvalue-position} - -将值插入到数组中的指定位置中。 - -!!! note "注" - 此函数使用从零开始的位置,与传统SQL数组的从一开始的位置相反。 - -Accepts the value and position as input. If several values ​​are inserted into the same position, any of them might end up in the resulting array (the first one will be used in the case of single-threaded execution). If no value is inserted into a position, the position is assigned the default value. - -可选参数: - -- 在空位置替换的默认值。 -- 生成数组的长度。 这允许您接收所有聚合键的相同大小的数组。 使用此参数时,必须指定默认值。 - -## groupArrayMovingSum {#agg_function-grouparraymovingsum} - -计算输入值的移动和。 - -``` sql -groupArrayMovingSum(numbers_for_summing) -groupArrayMovingSum(window_size)(numbers_for_summing) -``` - -该函数可以将窗口大小作为参数。 如果未指定,则该函数的窗口大小等于列中的行数。 - -**参数** - -- `numbers_for_summing` — [表达式](../syntax.md#syntax-expressions) 生成数值数据类型值。 -- `window_size` — Size of the calculation window. - -**返回值** - -- 与输入数据大小和类型相同的数组。 - -**示例** - -样品表: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -查询: - -``` sql -SELECT - groupArrayMovingSum(int) AS I, - groupArrayMovingSum(float) AS F, - groupArrayMovingSum(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,7,14] │ [1.1,3.3000002,7.7000003,15.47] │ [1.10,3.30,7.70,15.47] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingSum(2)(int) AS I, - groupArrayMovingSum(2)(float) AS F, - groupArrayMovingSum(2)(dec) AS D -FROM t -``` - -``` text -┌─I──────────┬─F───────────────────────────────┬─D──────────────────────┐ -│ [1,3,6,11] │ [1.1,3.3000002,6.6000004,12.17] │ [1.10,3.30,6.60,12.17] │ -└────────────┴─────────────────────────────────┴────────────────────────┘ -``` - -## groupArrayMovingAvg {#agg_function-grouparraymovingavg} - -计算输入值的移动平均值。 - -``` sql -groupArrayMovingAvg(numbers_for_summing) -groupArrayMovingAvg(window_size)(numbers_for_summing) -``` - -该函数可以将窗口大小作为参数。 如果未指定,则该函数的窗口大小等于列中的行数。 - -**参数** - -- `numbers_for_summing` — [表达式](../syntax.md#syntax-expressions) 生成数值数据类型值。 -- `window_size` — Size of the calculation window. - -**返回值** - -- 与输入数据大小和类型相同的数组。 - -该函数使用 [四舍五入到零](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero). 它截断结果数据类型的小数位数。 - -**示例** - -样品表 `b`: - -``` sql -CREATE TABLE t -( - `int` UInt8, - `float` Float32, - `dec` Decimal32(2) -) -ENGINE = TinyLog -``` - -``` text -┌─int─┬─float─┬──dec─┐ -│ 1 │ 1.1 │ 1.10 │ -│ 2 │ 2.2 │ 2.20 │ -│ 4 │ 4.4 │ 4.40 │ -│ 7 │ 7.77 │ 7.77 │ -└─────┴───────┴──────┘ -``` - -查询: - -``` sql -SELECT - groupArrayMovingAvg(int) AS I, - groupArrayMovingAvg(float) AS F, - groupArrayMovingAvg(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F───────────────────────────────────┬─D─────────────────────┐ -│ [0,0,1,3] │ [0.275,0.82500005,1.9250001,3.8675] │ [0.27,0.82,1.92,3.86] │ -└───────────┴─────────────────────────────────────┴───────────────────────┘ -``` - -``` sql -SELECT - groupArrayMovingAvg(2)(int) AS I, - groupArrayMovingAvg(2)(float) AS F, - groupArrayMovingAvg(2)(dec) AS D -FROM t -``` - -``` text -┌─I─────────┬─F────────────────────────────────┬─D─────────────────────┐ -│ [0,1,3,5] │ [0.55,1.6500001,3.3000002,6.085] │ [0.55,1.65,3.30,6.08] │ -└───────────┴──────────────────────────────────┴───────────────────────┘ -``` - -## 禄,赂麓ta脌麓,):脡,,拢脢,group媒group)galaxy s8碌胫脢)禄煤)酶脱脩) {#groupuniqarrayx-groupuniqarraymax-sizex} - -从不同的参数值创建一个数组。 内存消耗是一样的 `uniqExact` 功能。 - -第二个版本(与 `max_size` 参数)将结果数组的大小限制为 `max_size` 元素。 -例如, `groupUniqArray(1)(x)` 相当于 `[any(x)]`. - -## 分位数 {#quantile} - -计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 - -此功能适用 [油藏采样](https://en.wikipedia.org/wiki/Reservoir_sampling) 随着储存器大小高达8192和随机数发生器进行采样。 结果是非确定性的。 要获得精确的分位数,请使用 [quantileExact](#quantileexact) 功能。 - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantile(level)(expr) -``` - -别名: `median`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql_reference/data_types/index.md#data_types), [日期](../../sql_reference/data_types/date.md) 或 [日期时间](../../sql_reference/data_types/datetime.md). - -**返回值** - -- 指定电平的近似分位数。 - -类型: - -- [Float64](../../sql_reference/data_types/float.md) 对于数字数据类型输入。 -- [日期](../../sql_reference/data_types/date.md) 如果输入值具有 `Date` 类型。 -- [日期时间](../../sql_reference/data_types/datetime.md) 如果输入值具有 `DateTime` 类型。 - -**示例** - -输入表: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -查询: - -``` sql -SELECT quantile(val) FROM t -``` - -结果: - -``` text -┌─quantile(val)─┐ -│ 1.5 │ -└───────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## 量化确定 {#quantiledeterministic} - -计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 - -此功能适用 [油藏采样](https://en.wikipedia.org/wiki/Reservoir_sampling) 与储层大小高达8192和采样的确定性算法。 结果是确定性的。 要获得精确的分位数,请使用 [quantileExact](#quantileexact) 功能。 - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantileDeterministic(level)(expr, determinator) -``` - -别名: `medianDeterministic`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql_reference/data_types/index.md#data_types), [日期](../../sql_reference/data_types/date.md) 或 [日期时间](../../sql_reference/data_types/datetime.md). -- `determinator` — Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occures too often, the function works incorrectly. - -**返回值** - -- 指定电平的近似分位数。 - -类型: - -- [Float64](../../sql_reference/data_types/float.md) 对于数字数据类型输入。 -- [日期](../../sql_reference/data_types/date.md) 如果输入值具有 `Date` 类型。 -- [日期时间](../../sql_reference/data_types/datetime.md) 如果输入值具有 `DateTime` 类型。 - -**示例** - -输入表: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -查询: - -``` sql -SELECT quantileDeterministic(val, 1) FROM t -``` - -结果: - -``` text -┌─quantileDeterministic(val, 1)─┐ -│ 1.5 │ -└───────────────────────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## quantileExact {#quantileexact} - -正是计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` 内存,其中 `n` 是传递的多个值。 然而,对于少量的值,该函数是非常有效的。 - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantileExact(level)(expr) -``` - -别名: `medianExact`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql_reference/data_types/index.md#data_types), [日期](../../sql_reference/data_types/date.md) 或 [日期时间](../../sql_reference/data_types/datetime.md). - -**返回值** - -- 指定电平的分位数。 - -类型: - -- [Float64](../../sql_reference/data_types/float.md) 对于数字数据类型输入。 -- [日期](../../sql_reference/data_types/date.md) 如果输入值具有 `Date` 类型。 -- [日期时间](../../sql_reference/data_types/datetime.md) 如果输入值具有 `DateTime` 类型。 - -**示例** - -查询: - -``` sql -SELECT quantileExact(number) FROM numbers(10) -``` - -结果: - -``` text -┌─quantileExact(number)─┐ -│ 5 │ -└───────────────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## 分位数加权 {#quantileexactweighted} - -正是计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 数值数据序列,考虑到每个元素的权重。 - -To get exact value, all the passed values ​​are combined into an array, which is then partially sorted. Each value is counted with its weight, as if it is present `weight` times. A hash table is used in the algorithm. Because of this, if the passed values ​​are frequently repeated, the function consumes less RAM than [quantileExact](#quantileexact). 您可以使用此功能,而不是 `quantileExact` 并指定重量1。 - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantileExactWeighted(level)(expr, weight) -``` - -别名: `medianExactWeighted`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql_reference/data_types/index.md#data_types), [日期](../../sql_reference/data_types/date.md) 或 [日期时间](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence members. Weight is a number of value occurrences. - -**返回值** - -- 指定电平的分位数。 - -类型: - -- [Float64](../../sql_reference/data_types/float.md) 对于数字数据类型输入。 -- [日期](../../sql_reference/data_types/date.md) 如果输入值具有 `Date` 类型。 -- [日期时间](../../sql_reference/data_types/datetime.md) 如果输入值具有 `DateTime` 类型。 - -**示例** - -输入表: - -``` text -┌─n─┬─val─┐ -│ 0 │ 3 │ -│ 1 │ 2 │ -│ 2 │ 1 │ -│ 5 │ 4 │ -└───┴─────┘ -``` - -查询: - -``` sql -SELECT quantileExactWeighted(n, val) FROM t -``` - -结果: - -``` text -┌─quantileExactWeighted(n, val)─┐ -│ 1 │ -└───────────────────────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## 分位定时 {#quantiletiming} - -随着确定的精度计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 的数字数据序列。 - -结果是确定性的(它不依赖于查询处理顺序)。 该函数针对描述加载网页时间或后端响应时间等分布的序列进行了优化。 - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantileTiming(level)(expr) -``` - -别名: `medianTiming`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). - -- `expr` — [表达式](../syntax.md#syntax-expressions) 在一个列值返回 [浮动\*](../../sql_reference/data_types/float.md)-键入号码。 - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -**精度** - -计算是准确的,如果: - -- 值的总数不超过5670。 -- 总数值超过5670,但页面加载时间小于1024ms。 - -否则,计算结果将四舍五入到16毫秒的最接近倍数。 - -!!! note "注" - 对于计算页面加载时间分位数,此函数比 [分位数](#quantile). - -**返回值** - -- 指定电平的分位数。 - -类型: `Float32`. - -!!! note "注" - 如果没有值传递给函数(当使用 `quantileTimingIf`), [阿南](../../sql_reference/data_types/float.md#data_type-float-nan-inf) 被返回。 这样做的目的是将这些案例与导致零的案例区分开来。 看 [按条款订购](../statements/select.md#select-order-by) 对于排序注意事项 `NaN` 值。 - -**示例** - -输入表: - -``` text -┌─response_time─┐ -│ 72 │ -│ 112 │ -│ 126 │ -│ 145 │ -│ 104 │ -│ 242 │ -│ 313 │ -│ 168 │ -│ 108 │ -└───────────────┘ -``` - -查询: - -``` sql -SELECT quantileTiming(response_time) FROM t -``` - -结果: - -``` text -┌─quantileTiming(response_time)─┐ -│ 126 │ -└───────────────────────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## 分位时间加权 {#quantiletimingweighted} - -随着确定的精度计算 [分位数](https://en.wikipedia.org/wiki/Quantile) 根据每个序列成员的权重对数字数据序列进行处理。 - -结果是确定性的(它不依赖于查询处理顺序)。 该函数针对描述加载网页时间或后端响应时间等分布的序列进行了优化。 - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantileTimingWeighted(level)(expr, weight) -``` - -别名: `medianTimingWeighted`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). - -- `expr` — [表达式](../syntax.md#syntax-expressions) 在一个列值返回 [浮动\*](../../sql_reference/data_types/float.md)-键入号码。 - - - If negative values are passed to the function, the behavior is undefined. - - If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. - -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**精度** - -计算是准确的,如果: - -- 值的总数不超过5670。 -- 总数值超过5670,但页面加载时间小于1024ms。 - -否则,计算结果将四舍五入到16毫秒的最接近倍数。 - -!!! note "注" - 对于计算页面加载时间分位数,此函数比 [分位数](#quantile). - -**返回值** - -- 指定电平的分位数。 - -类型: `Float32`. - -!!! note "注" - 如果没有值传递给函数(当使用 `quantileTimingIf`), [阿南](../../sql_reference/data_types/float.md#data_type-float-nan-inf) 被返回。 这样做的目的是将这些案例与导致零的案例区分开来。 看 [按条款订购](../statements/select.md#select-order-by) 对于排序注意事项 `NaN` 值。 - -**示例** - -输入表: - -``` text -┌─response_time─┬─weight─┐ -│ 68 │ 1 │ -│ 104 │ 2 │ -│ 112 │ 3 │ -│ 126 │ 2 │ -│ 138 │ 1 │ -│ 162 │ 1 │ -└───────────────┴────────┘ -``` - -查询: - -``` sql -SELECT quantileTimingWeighted(response_time, weight) FROM t -``` - -结果: - -``` text -┌─quantileTimingWeighted(response_time, weight)─┐ -│ 112 │ -└───────────────────────────────────────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## quantileTDigest {#quantiletdigest} - -计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 使用的数字数据序列 [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) 算法。 - -最大误差为1%。 内存消耗 `log(n)`,哪里 `n` 是多个值。 结果取决于运行查询的顺序,并且是不确定的。 - -该功能的性能低于性能 [分位数](#quantile) 或 [分位定时](#quantiletiming). 在状态大小与精度的比率方面,这个函数比 `quantile`. - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantileTDigest(level)(expr) -``` - -别名: `medianTDigest`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql_reference/data_types/index.md#data_types), [日期](../../sql_reference/data_types/date.md) 或 [日期时间](../../sql_reference/data_types/datetime.md). - -**返回值** - -- 指定电平的近似分位数。 - -类型: - -- [Float64](../../sql_reference/data_types/float.md) 对于数字数据类型输入。 -- [日期](../../sql_reference/data_types/date.md) 如果输入值具有 `Date` 类型。 -- [日期时间](../../sql_reference/data_types/datetime.md) 如果输入值具有 `DateTime` 类型。 - -**示例** - -查询: - -``` sql -SELECT quantileTDigest(number) FROM numbers(10) -``` - -结果: - -``` text -┌─quantileTDigest(number)─┐ -│ 4.5 │ -└─────────────────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## quantileTDigestWeighted {#quantiletdigestweighted} - -计算近似值 [分位数](https://en.wikipedia.org/wiki/Quantile) 使用的数字数据序列 [t-digest](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf) 算法。 该函数考虑了每个序列成员的权重。 最大误差为1%。 内存消耗 `log(n)`,哪里 `n` 是多个值。 - -该功能的性能低于性能 [分位数](#quantile) 或 [分位定时](#quantiletiming). 在状态大小与精度的比率方面,这个函数比 `quantile`. - -结果取决于运行查询的顺序,并且是不确定的。 - -当使用多个 `quantile*` 在查询中具有不同级别的函数,内部状态不会被组合(即查询的工作效率低于它可以)。 在这种情况下,使用 [分位数](#quantiles) 功能。 - -**语法** - -``` sql -quantileTDigest(level)(expr) -``` - -别名: `medianTDigest`. - -**参数** - -- `level` — Level of quantile. Optional parameter. Constant floating-point number from 0 to 1. We recommend using a `level` 值的范围 `[0.01, 0.99]`. 默认值:0.5。 在 `level=0.5` 该函数计算 [中位数](https://en.wikipedia.org/wiki/Median). -- `expr` — Expression over the column values resulting in numeric [数据类型](../../sql_reference/data_types/index.md#data_types), [日期](../../sql_reference/data_types/date.md) 或 [日期时间](../../sql_reference/data_types/datetime.md). -- `weight` — Column with weights of sequence elements. Weight is a number of value occurrences. - -**返回值** - -- 指定电平的近似分位数。 - -类型: - -- [Float64](../../sql_reference/data_types/float.md) 对于数字数据类型输入。 -- [日期](../../sql_reference/data_types/date.md) 如果输入值具有 `Date` 类型。 -- [日期时间](../../sql_reference/data_types/datetime.md) 如果输入值具有 `DateTime` 类型。 - -**示例** - -查询: - -``` sql -SELECT quantileTDigestWeighted(number, 1) FROM numbers(10) -``` - -结果: - -``` text -┌─quantileTDigestWeighted(number, 1)─┐ -│ 4.5 │ -└────────────────────────────────────┘ -``` - -**另请参阅** - -- [中位数](#median) -- [分位数](#quantiles) - -## 中位数 {#median} - -该 `median*` 函数是相应的别名 `quantile*` 功能。 它们计算数字数据样本的中位数。 - -功能: - -- `median` — Alias for [分位数](#quantile). -- `medianDeterministic` — Alias for [量化确定](#quantiledeterministic). -- `medianExact` — Alias for [quantileExact](#quantileexact). -- `medianExactWeighted` — Alias for [分位数加权](#quantileexactweighted). -- `medianTiming` — Alias for [分位定时](#quantiletiming). -- `medianTimingWeighted` — Alias for [分位时间加权](#quantiletimingweighted). -- `medianTDigest` — Alias for [quantileTDigest](#quantiletdigest). -- `medianTDigestWeighted` — Alias for [quantileTDigestWeighted](#quantiletdigestweighted). - -**示例** - -输入表: - -``` text -┌─val─┐ -│ 1 │ -│ 1 │ -│ 2 │ -│ 3 │ -└─────┘ -``` - -查询: - -``` sql -SELECT medianDeterministic(val, 1) FROM t -``` - -结果: - -``` text -┌─medianDeterministic(val, 1)─┐ -│ 1.5 │ -└─────────────────────────────┘ -``` - -## quantiles(level1, level2, …)(x) {#quantiles} - -所有分位数函数也具有相应的分位数函数: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`. 这些函数在一遍中计算所列电平的所有分位数,并返回结果值的数组。 - -## varSamp(x) {#varsampx} - -计算金额 `Σ((x - x̅)^2) / (n - 1)`,哪里 `n` 是样本大小和 `x̅`是平均值 `x`. - -它表示随机变量的方差的无偏估计,如果传递的值形成其样本。 - -返回 `Float64`. 当 `n <= 1`,返回 `+∞`. - -## varPop(x) {#varpopx} - -计算金额 `Σ((x - x̅)^2) / n`,哪里 `n` 是样本大小和 `x̅`是平均值 `x`. - -换句话说,分散为一组值。 返回 `Float64`. - -## stddevSamp(x) {#stddevsampx} - -结果等于平方根 `varSamp(x)`. - -## stddevPop(x) {#stddevpopx} - -结果等于平方根 `varPop(x)`. - -## topK(N)(x) {#topknx} - -返回指定列中近似最常见值的数组。 生成的数组按值的近似频率降序排序(而不是值本身)。 - -实现了 [过滤节省空间](http://www.l2f.inesc-id.pt/~fmmb/wiki/uploads/Work/misnis.ref0a.pdf) 基于reduce-and-combine算法的TopK分析算法 [并行节省空间](https://arxiv.org/pdf/1401.0702.pdf). - -``` sql -topK(N)(column) -``` - -此函数不提供保证的结果。 在某些情况下,可能会发生错误,并且可能会返回不是最常见值的常见值。 - -我们建议使用 `N < 10` 值;性能降低了大 `N` 值。 的最大值 `N = 65536`. - -**参数** - -- ‘N’ 是要返回的元素数。 - -如果省略该参数,则使用默认值10。 - -**参数** - -- ' x ' – The value to calculate frequency. - -**示例** - -就拿 [时间](../../getting_started/example_datasets/ontime.md) 数据集,并选择在三个最频繁出现的值 `AirlineID` 列。 - -``` sql -SELECT topK(3)(AirlineID) AS res -FROM ontime -``` - -``` text -┌─res─────────────────┐ -│ [19393,19790,19805] │ -└─────────────────────┘ -``` - -## topKWeighted {#topkweighted} - -类似于 `topK` 但需要一个整数类型的附加参数 - `weight`. 每一价值是占 `weight` 次频率计算。 - -**语法** - -``` sql -topKWeighted(N)(x, weight) -``` - -**参数** - -- `N` — The number of elements to return. - -**参数** - -- `x` – The value. -- `weight` — The weight. [UInt8](../../sql_reference/data_types/int_uint.md). - -**返回值** - -返回具有最大近似权重总和的值数组。 - -**示例** - -查询: - -``` sql -SELECT topKWeighted(10)(number, number) FROM numbers(1000) -``` - -结果: - -``` text -┌─topKWeighted(10)(number, number)──────────┐ -│ [999,998,997,996,995,994,993,992,991,990] │ -└───────────────────────────────────────────┘ -``` - -## covarSamp(x,y) {#covarsampx-y} - -计算的值 `Σ((x - x̅)(y - y̅)) / (n - 1)`. - -返回Float64。 当 `n <= 1`, returns +∞. - -## covarPop(x,y) {#covarpopx-y} - -计算的值 `Σ((x - x̅)(y - y̅)) / n`. - -## corr(x,y) {#corrx-y} - -计算Pearson相关系数: `Σ((x - x̅)(y - y̅)) / sqrt(Σ((x - x̅)^2) * Σ((y - y̅)^2))`. - -## categoricalInformationValue {#categoricalinformationvalue} - -计算的值 `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` 对于每个类别。 - -``` sql -categoricalInformationValue(category1, category2, ..., tag) -``` - -结果指示离散(分类)要素如何使用 `[category1, category2, ...]` 有助于预测的价值的学习模型 `tag`. - -## simpleLinearRegression {#simplelinearregression} - -执行简单(一维)线性回归。 - -``` sql -simpleLinearRegression(x, y) -``` - -参数: - -- `x` — Column with dependent variable values. -- `y` — Column with explanatory variable values. - -返回值: - -常量 `(a, b)` 结果行的 `y = a*x + b`. - -**例** - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐ -│ (1,0) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -``` sql -SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6]) -``` - -``` text -┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐ -│ (1,3) │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## 随机指标线上回归 {#agg_functions-stochasticlinearregression} - -该函数实现随机线性回归。 它支持自定义参数的学习率,L2正则化系数,迷你批量大小,并具有更新权重的方法很少 ([亚当](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam) (默认使用), [简单SGD](https://en.wikipedia.org/wiki/Stochastic_gradient_descent), [动量](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum), [Nesterov](https://mipt.ru/upload/medialibrary/d7e/41-91.pdf)). - -### 参数 {#agg_functions-stochasticlinearregression-parameters} - -有4个可自定义的参数。 它们按顺序传递给函数,但是没有必要传递所有四个默认值将被使用,但是好的模型需要一些参数调整。 - -``` text -stochasticLinearRegression(1.0, 1.0, 10, 'SGD') -``` - -1. `learning rate` 当执行梯度下降步骤时,步长上的系数。 过大的学习率可能会导致模型的权重无限大。 默认值为 `0.00001`. -2. `l2 regularization coefficient` 这可能有助于防止过度拟合。 默认值为 `0.1`. -3. `mini-batch size` 设置元素的数量,这些元素将被计算和求和以执行梯度下降的一个步骤。 纯随机下降使用一个元素,但是具有小批量(约10个元素)使梯度步骤更稳定。 默认值为 `15`. -4. `method for updating weights` 他们是: `Adam` (默认情况下), `SGD`, `Momentum`, `Nesterov`. `Momentum` 和 `Nesterov` 需要更多的计算和内存,但是它们恰好在收敛速度和随机梯度方法的稳定性方面是有用的。 - -### 用途 {#agg_functions-stochasticlinearregression-usage} - -`stochasticLinearRegression` 用于两个步骤:拟合模型和预测新数据。 为了拟合模型并保存其状态以供以后使用,我们使用 `-State` combinator,它基本上保存了状态(模型权重等)。 -为了预测我们使用函数 [evalMLMethod](../functions/machine_learning_functions.md#machine_learning_methods-evalmlmethod),这需要一个状态作为参数以及特征来预测。 - - - -**1.** 适合 - -可以使用这种查询。 - -``` sql -CREATE TABLE IF NOT EXISTS train_data -( - param1 Float64, - param2 Float64, - target Float64 -) ENGINE = Memory; - -CREATE TABLE your_model ENGINE = Memory AS SELECT -stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2) -AS state FROM train_data; -``` - -在这里,我们还需要将数据插入到 `train_data` 桌子 参数的数量不是固定的,它只取决于参数的数量,传递到 `linearRegressionState`. 它们都必须是数值。 -请注意,带有目标值的列(我们想要学习预测)被插入作为第一个参数。 - -**2.** 预测 - -在将状态保存到表中之后,我们可以多次使用它进行预测,甚至与其他状态合并并创建新的更好的模型。 - -``` sql -WITH (SELECT state FROM your_model) AS model SELECT -evalMLMethod(model, param1, param2) FROM test_data -``` - -查询将返回一列预测值。 请注意,第一个参数 `evalMLMethod` 是 `AggregateFunctionState` 对象,接下来是要素列。 - -`test_data` 是一个像表 `train_data` 但可能不包含目标值。 - -### 注 {#agg_functions-stochasticlinearregression-notes} - -1. 要合并两个模型,用户可以创建这样的查询: - `sql SELECT state1 + state2 FROM your_models` - 哪里 `your_models` 表包含这两个模型。 此查询将返回new `AggregateFunctionState` 对象。 - -2. 如果没有,用户可以获取创建的模型的权重用于自己的目的,而不保存模型 `-State` 使用combinator。 - `sql SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data` - 这种查询将拟合模型并返回其权重-首先是权重,它对应于模型的参数,最后一个是偏差。 所以在上面的例子中,查询将返回一个具有3个值的列。 - -**另请参阅** - -- [stochasticLogisticRegression](#agg_functions-stochasticlogisticregression) -- [线性回归和逻辑回归之间的区别](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## stochasticLogisticRegression {#agg_functions-stochasticlogisticregression} - -该函数实现随机逻辑回归。 它可以用于二进制分类问题,支持与stochasticLinearRegression相同的自定义参数,并以相同的方式工作。 - -### 参数 {#agg_functions-stochasticlogisticregression-parameters} - -参数与stochasticLinearRegression中的参数完全相同: -`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`. -欲了解更多信息,请参阅 [参数](#agg_functions-stochasticlinearregression-parameters). - -``` text -stochasticLogisticRegression(1.0, 1.0, 10, 'SGD') -``` - -1. 适合 - - - - See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description. - - Predicted labels have to be in \[-1, 1\]. - -1. 预测 - - - - Using saved state we can predict probability of object having label `1`. - - ``` sql - WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) FROM test_data - ``` - - The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features. - - We can also set a bound of probability, which assigns elements to different labels. - - ``` sql - SELECT ans < 1.1 AND ans > 0.5 FROM - (WITH (SELECT state FROM your_model) AS model SELECT - evalMLMethod(model, param1, param2) AS ans FROM test_data) - ``` - - Then the result will be labels. - - `test_data` is a table like `train_data` but may not contain target value. - -**另请参阅** - -- [随机指标线上回归](#agg_functions-stochasticlinearregression) -- [线性回归和逻辑回归之间的差异。](https://stackoverflow.com/questions/12146914/what-is-the-difference-between-linear-regression-and-logistic-regression) - -## groupBitmapAnd {#groupbitmapand} - -计算位图列的AND,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapAnd(expr) -``` - -**参数** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` 类型。 - -**返回值** - -的价值 `UInt64` 类型。 - -**示例** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapAnd(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapAnd(z)─┐ -│ 3 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapAndState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapAndState(z)))─┐ -│ [6,8,10] │ -└──────────────────────────────────────────────────┘ -``` - -## groupBitmapOr {#groupbitmapor} - -计算位图列的OR,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql_reference/functions/bitmap_functions.md). 这相当于 `groupBitmapMerge`. - -``` sql -groupBitmapOr(expr) -``` - -**参数** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` 类型。 - -**返回值** - -的价值 `UInt64` 类型。 - -**示例** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapOr(z)─┐ -│ 15 │ -└──────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐ -│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │ -└─────────────────────────────────────────────────┘ -``` - -## groupBitmapXor {#groupbitmapxor} - -计算位图列的XOR,返回UInt64类型的基数,如果添加后缀状态,则返回 [位图对象](../../sql_reference/functions/bitmap_functions.md). - -``` sql -groupBitmapOr(expr) -``` - -**参数** - -`expr` – An expression that results in `AggregateFunction(groupBitmap, UInt*)` 类型。 - -**返回值** - -的价值 `UInt64` 类型。 - -**示例** - -``` sql -DROP TABLE IF EXISTS bitmap_column_expr_test2; -CREATE TABLE bitmap_column_expr_test2 -( - tag_id String, - z AggregateFunction(groupBitmap, UInt32) -) -ENGINE = MergeTree -ORDER BY tag_id; - -INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32)))); -INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] as Array(UInt32)))); - -SELECT groupBitmapXor(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─groupBitmapXor(z)─┐ -│ 10 │ -└───────────────────┘ - -SELECT arraySort(bitmapToArray(groupBitmapXorState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%'); -┌─arraySort(bitmapToArray(groupBitmapXorState(z)))─┐ -│ [1,3,5,6,8,10,11,13,14,15] │ -└──────────────────────────────────────────────────┘ -``` - -[原始文章](https://clickhouse.tech/docs/en/query_language/agg_functions/reference/) diff --git a/docs/zh/sql_reference/ansi.md b/docs/zh/sql_reference/ansi.md deleted file mode 120000 index ee0f9c8cb7e..00000000000 --- a/docs/zh/sql_reference/ansi.md +++ /dev/null @@ -1 +0,0 @@ -../../en/sql_reference/ansi.md \ No newline at end of file diff --git a/docs/zh/sql_reference/data_types/aggregatefunction.md b/docs/zh/sql_reference/data_types/aggregatefunction.md deleted file mode 100644 index e1fb7b1d133..00000000000 --- a/docs/zh/sql_reference/data_types/aggregatefunction.md +++ /dev/null @@ -1,64 +0,0 @@ - -# AggregateFunction(name, types\_of\_arguments…) {#data-type-aggregatefunction} - -聚合函数的中间状态,可以通过聚合函数名称加`-State`后缀的形式得到它。与此同时,当您需要访问该类型的最终状态数据时,您需要以相同的聚合函数名加`-Merge`后缀的形式来得到最终状态数据。 - -`AggregateFunction` — 参数化的数据类型。 - -**参数** - -- 聚合函数名 - - 如果函数具备多个参数列表,请在此处指定其他参数列表中的值。 - -- 聚合函数参数的类型 - -**示例** - -``` sql -CREATE TABLE t -( - column1 AggregateFunction(uniq, UInt64), - column2 AggregateFunction(anyIf, String, UInt8), - column3 AggregateFunction(quantiles(0.5, 0.9), UInt64) -) ENGINE = ... -``` - -上述中的[uniq](../../sql_reference/data_types/aggregatefunction.md#agg_function-uniq), anyIf ([任何](../../sql_reference/data_types/aggregatefunction.md#agg_function-any)+[如果](../../sql_reference/data_types/aggregatefunction.md#agg-functions-combinator-if)) 以及 [分位数](../../sql_reference/data_types/aggregatefunction.md) 都为ClickHouse中支持的聚合函数。 - -## 使用指南 {#shi-yong-zhi-nan} - -### 数据写入 {#shu-ju-xie-ru} - -当需要写入数据时,您需要将数据包含在`INSERT SELECT`语句中,同时对于`AggregateFunction`类型的数据,您需要使用对应的以`-State`为后缀的函数进行处理。 - -**函数使用示例** - -``` sql -uniqState(UserID) -quantilesState(0.5, 0.9)(SendTiming) -``` - -不同于`uniq`和`quantiles`函数返回聚合结果的最终值,以`-State`后缀的函数总是返回`AggregateFunction`类型的数据的中间状态。 - -对于`SELECT`而言,`AggregateFunction`类型总是以特定的二进制形式展现在所有的输出格式中。例如,您可以使用`SELECT`语句将函数的状态数据转储为`TabSeparated`格式的同时使用`INSERT`语句将数据转储回去。 - -### 数据查询 {#shu-ju-cha-xun} - -当从`AggregatingMergeTree`表中查询数据时,对于`AggregateFunction`类型的字段,您需要使用以`-Merge`为后缀的相同聚合函数来聚合数据。对于非`AggregateFunction`类型的字段,请将它们包含在`GROUP BY`子句中。 - -以`-Merge`为后缀的聚合函数,可以将多个`AggregateFunction`类型的中间状态组合计算为最终的聚合结果。 - -例如,如下的两个查询返回的结果总是一致: - -``` sql -SELECT uniq(UserID) FROM table - -SELECT uniqMerge(state) FROM (SELECT uniqState(UserID) AS state FROM table GROUP BY RegionID) -``` - -## 使用示例 {#shi-yong-shi-li} - -请参阅 [AggregatingMergeTree](../../sql_reference/data_types/aggregatefunction.md) 的说明 - -[来源文章](https://clickhouse.tech/docs/en/data_types/nested_data_structures/aggregatefunction/) diff --git a/docs/zh/sql_reference/data_types/array.md b/docs/zh/sql_reference/data_types/array.md deleted file mode 100644 index 7a35647d20e..00000000000 --- a/docs/zh/sql_reference/data_types/array.md +++ /dev/null @@ -1,73 +0,0 @@ - -# 阵列(T) {#data-type-array} - -由 `T` 类型元素组成的数组。 - -`T` 可以是任意类型,包含数组类型。 但不推荐使用多维数组,ClickHouse 对多维数组的支持有限。例如,不能存储在 `MergeTree` 表中存储多维数组。 - -## 创建数组 {#chuang-jian-shu-zu} - -您可以使用array函数来创建数组: - - array(T) - -您也可以使用方括号: - - [] - -创建数组示例: - - :) SELECT array(1, 2) AS x, toTypeName(x) - - SELECT - [1, 2] AS x, - toTypeName(x) - - ┌─x─────┬─toTypeName(array(1, 2))─┐ - │ [1,2] │ Array(UInt8) │ - └───────┴─────────────────────────┘ - - 1 rows in set. Elapsed: 0.002 sec. - - :) SELECT [1, 2] AS x, toTypeName(x) - - SELECT - [1, 2] AS x, - toTypeName(x) - - ┌─x─────┬─toTypeName([1, 2])─┐ - │ [1,2] │ Array(UInt8) │ - └───────┴────────────────────┘ - - 1 rows in set. Elapsed: 0.002 sec. - -## 使用数据类型 {#shi-yong-shu-ju-lei-xing} - -ClickHouse会自动检测数组元素,并根据元素计算出存储这些元素最小的数据类型。如果在元素中存在 [NULL](../../sql_reference/data_types/array.md#null-literal) 或存在 [可为空](nullable.md#data_type-nullable) 类型元素,那么数组的元素类型将会变成 [可为空](nullable.md)。 - -如果 ClickHouse 无法确定数据类型,它将产生异常。当尝试同时创建一个包含字符串和数字的数组时会发生这种情况 (`SELECT array(1, 'a')`)。 - -自动数据类型检测示例: - - :) SELECT array(1, 2, NULL) AS x, toTypeName(x) - - SELECT - [1, 2, NULL] AS x, - toTypeName(x) - - ┌─x──────────┬─toTypeName(array(1, 2, NULL))─┐ - │ [1,2,NULL] │ Array(Nullable(UInt8)) │ - └────────────┴───────────────────────────────┘ - - 1 rows in set. Elapsed: 0.002 sec. - -如果您尝试创建不兼容的数据类型数组,ClickHouse 将引发异常: - - :) SELECT array(1, 'a') - - SELECT [1, 'a'] - - Received exception from server (version 1.1.54388): - Code: 386. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: There is no supertype for types UInt8, String because some of them are String/FixedString and some of them are not. - - 0 rows in set. Elapsed: 0.246 sec. diff --git a/docs/zh/sql_reference/data_types/boolean.md b/docs/zh/sql_reference/data_types/boolean.md deleted file mode 100644 index 26c8ac5cdd5..00000000000 --- a/docs/zh/sql_reference/data_types/boolean.md +++ /dev/null @@ -1,4 +0,0 @@ - -# 布尔值 {#boolean-values} - -没有单独的类型来存储布尔值。可以使用 UInt8 类型,取值限制为 0 或 1。 diff --git a/docs/zh/sql_reference/data_types/date.md b/docs/zh/sql_reference/data_types/date.md deleted file mode 100644 index 18bdb507f37..00000000000 --- a/docs/zh/sql_reference/data_types/date.md +++ /dev/null @@ -1,6 +0,0 @@ - -# 日期 {#date} - -日期类型,用两个字节存储,表示从 1970-01-01 (无符号) 到当前的日期值。允许存储从 Unix 纪元开始到编译阶段定义的上限阈值常量(目前上限是2106年,但最终完全支持的年份为2105)。最小值输出为0000-00-00。 - -日期中没有存储时区信息。 diff --git a/docs/zh/sql_reference/data_types/datetime.md b/docs/zh/sql_reference/data_types/datetime.md deleted file mode 100644 index 1122131614b..00000000000 --- a/docs/zh/sql_reference/data_types/datetime.md +++ /dev/null @@ -1,12 +0,0 @@ - -# 日期时间 {#data_type-datetime} - -时间戳类型。用四个字节(无符号的)存储 Unix 时间戳)。允许存储与日期类型相同的范围内的值。最小值为 0000-00-00 00:00:00。时间戳类型值精确到秒(没有闰秒)。 - -## 时区 {#shi-qu} - -使用启动客户端或服务器时的系统时区,时间戳是从文本(分解为组件)转换为二进制并返回。在文本格式中,有关夏令时的信息会丢失。 - -默认情况下,客户端连接到服务的时候会使用服务端时区。您可以通过启用客户端命令行选项 `--use_client_time_zone` 来设置使用客户端时间。 - -因此,在处理文本日期时(例如,在保存文本转储时),请记住在夏令时更改期间可能存在歧义,如果时区发生更改,则可能存在匹配数据的问题。 diff --git a/docs/zh/sql_reference/data_types/datetime64.md b/docs/zh/sql_reference/data_types/datetime64.md deleted file mode 100644 index dd87486cee5..00000000000 --- a/docs/zh/sql_reference/data_types/datetime64.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 49 -toc_title: DateTime64 ---- - -# Datetime64 {#data_type-datetime64} - -允许存储时间instant间,可以表示为日历日期和一天中的时间,具有定义的亚秒精度 - -刻度尺寸(精度):10-精度 秒 - -语法: - -``` sql -DateTime64(precision, [timezone]) -``` - -在内部,存储数据作为一些 ‘ticks’ 自纪元开始(1970-01-01 00:00:00UTC)作为Int64. 刻度分辨率由precision参数确定。 此外,该 `DateTime64` 类型可以存储时区是相同的整个列,影响如何的值 `DateTime64` 类型值以文本格式显示,以及如何解析指定为字符串的值 (‘2020-01-01 05:00:01.000’). 时区不存储在表的行中(或resultset中),而是存储在列元数据中。 查看详细信息 [日期时间](datetime.md). - -## 例 {#examples} - -**1.** 创建一个表 `DateTime64`-输入列并将数据插入其中: - -``` sql -CREATE TABLE dt -( - `timestamp` DateTime64(3, 'Europe/Moscow'), - `event_id` UInt8 -) -ENGINE = TinyLog -``` - -``` sql -INSERT INTO dt Values (1546300800000, 1), ('2019-01-01 00:00:00', 2) -``` - -``` sql -SELECT * FROM dt -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 03:00:00.000 │ 1 │ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -- 将日期时间作为整数插入时,将其视为适当缩放的Unix时间戳(UTC)。 `1546300800000` (精度为3)表示 `'2019-01-01 00:00:00'` UTC. 然而,作为 `timestamp` 列有 `Europe/Moscow` (UTC+3)指定的时区,当输出为字符串时,该值将显示为 `'2019-01-01 03:00:00'` -- 当插入字符串值作为日期时间时,它被视为处于列时区。 `'2019-01-01 00:00:00'` 将被视为 `Europe/Moscow` 时区并存储为 `1546290000000`. - -**2.** 过滤 `DateTime64` 值 - -``` sql -SELECT * FROM dt WHERE timestamp = toDateTime64('2019-01-01 00:00:00', 3, 'Europe/Moscow') -``` - -``` text -┌───────────────timestamp─┬─event_id─┐ -│ 2019-01-01 00:00:00.000 │ 2 │ -└─────────────────────────┴──────────┘ -``` - -不像 `DateTime`, `DateTime64` 值不转换为 `String` 自动 - -**3.** 获取一个时区 `DateTime64`-类型值: - -``` sql -SELECT toDateTime64(now(), 3, 'Europe/Moscow') AS column, toTypeName(column) AS x -``` - -``` text -┌──────────────────column─┬─x──────────────────────────────┐ -│ 2019-10-16 04:12:04.000 │ DateTime64(3, 'Europe/Moscow') │ -└─────────────────────────┴────────────────────────────────┘ -``` - -**4.** 时区转换 - -``` sql -SELECT -toDateTime64(timestamp, 3, 'Europe/London') as lon_time, -toDateTime64(timestamp, 3, 'Europe/Moscow') as mos_time -FROM dt -``` - -``` text -┌───────────────lon_time──┬────────────────mos_time─┐ -│ 2019-01-01 00:00:00.000 │ 2019-01-01 03:00:00.000 │ -│ 2018-12-31 21:00:00.000 │ 2019-01-01 00:00:00.000 │ -└─────────────────────────┴─────────────────────────┘ -``` - -## 另请参阅 {#see-also} - -- [类型转换函数](../../sql_reference/functions/type_conversion_functions.md) -- [用于处理日期和时间的函数](../../sql_reference/functions/date_time_functions.md) -- [用于处理数组的函数](../../sql_reference/functions/array_functions.md) -- [该 `date_time_input_format` 设置](../../operations/settings/settings.md#settings-date_time_input_format) -- [该 `timezone` 服务器配置参数](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-timezone) -- [使用日期和时间的操作员](../../sql_reference/operators.md#operators-datetime) -- [`Date` 数据类型](date.md) -- [`DateTime` 数据类型](datetime.md) diff --git a/docs/zh/sql_reference/data_types/decimal.md b/docs/zh/sql_reference/data_types/decimal.md deleted file mode 100644 index 24bc1f70415..00000000000 --- a/docs/zh/sql_reference/data_types/decimal.md +++ /dev/null @@ -1,81 +0,0 @@ - -# Decimal(P,S),Decimal32(S),Decimal64(S),Decimal128(S) {#decimalp-s-decimal32s-decimal64s-decimal128s} - -有符号的定点数,可在加、减和乘法运算过程中保持精度。对于除法,最低有效数字会被丢弃(不舍入)。 - -## 参数 {#can-shu} - -- P - 精度。有效范围:\[1:38\],决定可以有多少个十进制数字(包括分数)。 -- S - 规模。有效范围:\[0:P\],决定数字的小数部分中包含的小数位数。 - -对于不同的 P 参数值 Decimal 表示,以下例子都是同义的: --P从\[1:9\]-对于Decimal32(S) --P从\[10:18\]-对于Decimal64(小号) --P从\[19:38\]-对于Decimal128(S) - -## 十进制值范围 {#shi-jin-zhi-zhi-fan-wei} - -- Decimal32(S) - ( -1 \* 10^(9 - S),1\*10^(9-S) ) -- Decimal64(S) - ( -1 \* 10^(18 - S),1\*10^(18-S) ) -- Decimal128(S) - ( -1 \* 10^(38 - S),1\*10^(38-S) ) - -例如,Decimal32(4) 可以表示 -99999.9999 至 99999.9999 的数值,步长为0.0001。 - -## 内部表示方式 {#nei-bu-biao-shi-fang-shi} - -数据采用与自身位宽相同的有符号整数存储。这个数在内存中实际范围会高于上述范围,从 String 转换到十进制数的时候会做对应的检查。 - -由于现代CPU不支持128位数字,因此 Decimal128 上的操作由软件模拟。所以 Decimal128 的运算速度明显慢于 Decimal32/Decimal64。 - -## 运算和结果类型 {#yun-suan-he-jie-guo-lei-xing} - -对Decimal的二进制运算导致更宽的结果类型(无论参数的顺序如何)。 - -- Decimal64(S1) Decimal32(S2)-\>Decimal64(S) -- Decimal128(S1) Decimal32(S2)-\>Decimal128(S) -- Decimal128(S1) Decimal64(S2)-\>Decimal128(S) - -精度变化的规则: - -- 加法,减法:S = max(S1, S2)。 -- 乘法:S = S1 + S2。 -- 除法:S = S1。 - -对于 Decimal 和整数之间的类似操作,结果是与参数大小相同的十进制。 - -未定义Decimal和Float32/Float64之间的函数。要执行此类操作,您可以使用:toDecimal32、toDecimal64、toDecimal128 或 toFloat32,toFloat64,需要显式地转换其中一个参数。注意,结果将失去精度,类型转换是昂贵的操作。 - -Decimal上的一些函数返回结果为Float64(例如,var或stddev)。对于其中一些,中间计算发生在Decimal中。对于此类函数,尽管结果类型相同,但Float64和Decimal中相同数据的结果可能不同。 - -## 溢出检查 {#yi-chu-jian-cha} - -在对 Decimal 类型执行操作时,数值可能会发生溢出。分数中的过多数字被丢弃(不是舍入的)。整数中的过多数字将导致异常。 - - SELECT toDecimal32(2, 4) AS x, x / 3 - - ┌──────x─┬─divide(toDecimal32(2, 4), 3)─┐ - │ 2.0000 │ 0.6666 │ - └────────┴──────────────────────────────┘ - - SELECT toDecimal32(4.2, 8) AS x, x * x - - DB::Exception: Scale is out of bounds. - - SELECT toDecimal32(4.2, 8) AS x, 6 * x - - DB::Exception: Decimal math overflow. - -检查溢出会导致计算变慢。如果已知溢出不可能,则可以通过设置`decimal_check_overflow`来禁用溢出检查,在这种情况下,溢出将导致结果不正确: - - SET decimal_check_overflow = 0; - SELECT toDecimal32(4.2, 8) AS x, 6 * x - - ┌──────────x─┬─multiply(6, toDecimal32(4.2, 8))─┐ - │ 4.20000000 │ -17.74967296 │ - └────────────┴──────────────────────────────────┘ - -溢出检查不仅发生在算术运算上,还发生在比较运算上: - - SELECT toDecimal32(1, 8) < 100 - - DB::Exception: Can't compare. diff --git a/docs/zh/sql_reference/data_types/domains/ipv4.md b/docs/zh/sql_reference/data_types/domains/ipv4.md deleted file mode 100644 index 26ed4d84922..00000000000 --- a/docs/zh/sql_reference/data_types/domains/ipv4.md +++ /dev/null @@ -1,69 +0,0 @@ - -## IPv4 {#ipv4} - -`IPv4`是与`UInt32`类型保持二进制兼容的Domain类型,其用于存储IPv4地址的值。它提供了更为紧凑的二进制存储的同时支持识别可读性更加友好的输入输出格式。 - -### 基本使用 {#ji-ben-shi-yong} - -``` sql -CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY url; - -DESCRIBE TABLE hits; -``` - - ┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ - │ url │ String │ │ │ │ │ - │ from │ IPv4 │ │ │ │ │ - └──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ - -同时您也可以使用`IPv4`类型的列作为主键: - -``` sql -CREATE TABLE hits (url String, from IPv4) ENGINE = MergeTree() ORDER BY from; -``` - -在写入与查询时,`IPv4`类型能够识别可读性更加友好的输入输出格式: - -``` sql -INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '116.253.40.133')('https://clickhouse.tech', '183.247.232.58')('https://clickhouse.yandex/docs/en/', '116.106.34.242'); - -SELECT * FROM hits; -``` - - ┌─url────────────────────────────────┬───────────from─┐ - │ https://clickhouse.tech/docs/en/ │ 116.106.34.242 │ - │ https://wikipedia.org │ 116.253.40.133 │ - │ https://clickhouse.tech │ 183.247.232.58 │ - └────────────────────────────────────┴────────────────┘ - -同时它提供更为紧凑的二进制存储格式: - -``` sql -SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; -``` - - ┌─toTypeName(from)─┬─hex(from)─┐ - │ IPv4 │ B7F7E83A │ - └──────────────────┴───────────┘ - -不可隐式转换为除`UInt32`以外的其他类型类型。如果要将`IPv4`类型的值转换成字符串,你可以使用`IPv4NumToString()`显示的进行转换: - -``` sql -SELECT toTypeName(s), IPv4NumToString(from) as s FROM hits LIMIT 1; -``` - - ┌─toTypeName(IPv4NumToString(from))─┬─s──────────────┐ - │ String │ 183.247.232.58 │ - └───────────────────────────────────┴────────────────┘ - -或可以使用`CAST`将它转换为`UInt32`类型: - -``` sql -SELECT toTypeName(i), CAST(from as UInt32) as i FROM hits LIMIT 1; -``` - - ┌─toTypeName(CAST(from, 'UInt32'))─┬──────────i─┐ - │ UInt32 │ 3086477370 │ - └──────────────────────────────────┴────────────┘ - -[来源文章](https://clickhouse.tech/docs/en/data_types/domains/ipv4) diff --git a/docs/zh/sql_reference/data_types/domains/ipv6.md b/docs/zh/sql_reference/data_types/domains/ipv6.md deleted file mode 100644 index b147fb6db84..00000000000 --- a/docs/zh/sql_reference/data_types/domains/ipv6.md +++ /dev/null @@ -1,69 +0,0 @@ - -## IPv6 {#ipv6} - -`IPv6`是与`FixedString(16)`类型保持二进制兼容的Domain类型,其用于存储IPv6地址的值。它提供了更为紧凑的二进制存储的同时支持识别可读性更加友好的输入输出格式。 - -### 基本用法 {#ji-ben-yong-fa} - -``` sql -CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY url; - -DESCRIBE TABLE hits; -``` - - ┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┐ - │ url │ String │ │ │ │ │ - │ from │ IPv6 │ │ │ │ │ - └──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┘ - -同时您也可以使用`IPv6`类型的列作为主键: - -``` sql -CREATE TABLE hits (url String, from IPv6) ENGINE = MergeTree() ORDER BY from; -``` - -在写入与查询时,`IPv6`类型能够识别可读性更加友好的输入输出格式: - -``` sql -INSERT INTO hits (url, from) VALUES ('https://wikipedia.org', '2a02:aa08:e000:3100::2')('https://clickhouse.tech', '2001:44c8:129:2632:33:0:252:2')('https://clickhouse.yandex/docs/en/', '2a02:e980:1e::1'); - -SELECT * FROM hits; -``` - - ┌─url────────────────────────────────┬─from──────────────────────────┐ - │ https://clickhouse.tech │ 2001:44c8:129:2632:33:0:252:2 │ - │ https://clickhouse.tech/docs/en/ │ 2a02:e980:1e::1 │ - │ https://wikipedia.org │ 2a02:aa08:e000:3100::2 │ - └────────────────────────────────────┴───────────────────────────────┘ - -同时它提供更为紧凑的二进制存储格式: - -``` sql -SELECT toTypeName(from), hex(from) FROM hits LIMIT 1; -``` - - ┌─toTypeName(from)─┬─hex(from)────────────────────────┐ - │ IPv6 │ 200144C8012926320033000002520002 │ - └──────────────────┴──────────────────────────────────┘ - -不可隐式转换为除`FixedString(16)`以外的其他类型类型。如果要将`IPv6`类型的值转换成字符串,你可以使用`IPv6NumToString()`显示的进行转换: - -``` sql -SELECT toTypeName(s), IPv6NumToString(from) as s FROM hits LIMIT 1; -``` - - ┌─toTypeName(IPv6NumToString(from))─┬─s─────────────────────────────┐ - │ String │ 2001:44c8:129:2632:33:0:252:2 │ - └───────────────────────────────────┴───────────────────────────────┘ - -或使用`CAST`将其转换为`FixedString(16)`: - -``` sql -SELECT toTypeName(i), CAST(from as FixedString(16)) as i FROM hits LIMIT 1; -``` - - ┌─toTypeName(CAST(from, 'FixedString(16)'))─┬─i───────┐ - │ FixedString(16) │ ��� │ - └───────────────────────────────────────────┴─────────┘ - -[来源文章](https://clickhouse.tech/docs/en/data_types/domains/ipv6) diff --git a/docs/zh/sql_reference/data_types/domains/overview.md b/docs/zh/sql_reference/data_types/domains/overview.md deleted file mode 100644 index b330bad18c0..00000000000 --- a/docs/zh/sql_reference/data_types/domains/overview.md +++ /dev/null @@ -1,27 +0,0 @@ - -# 域 {#domains} - -Domain类型是特定实现的类型,它总是与某个现存的基础类型保持二进制兼容的同时添加一些额外的特性,以能够在维持磁盘数据不变的情况下使用这些额外的特性。目前ClickHouse暂不支持自定义domain类型。 - -如果你可以在一个地方使用与Domain类型二进制兼容的基础类型,那么在相同的地方您也可以使用Domain类型,例如: - -- 使用Domain类型作为表中列的类型 -- 对Domain类型的列进行读/写数据 -- 如果与Domain二进制兼容的基础类型可以作为索引,那么Domain类型也可以作为索引 -- 将Domain类型作为参数传递给函数使用 -- 其他 - -### Domains的额外特性 {#domainsde-e-wai-te-xing} - -- 在执行SHOW CREATE TABLE 或 DESCRIBE TABLE时,其对应的列总是展示为Domain类型的名称 -- 在INSERT INTO domain\_table(domain\_column) VALUES(…)中输入数据总是以更人性化的格式进行输入 -- 在SELECT domain\_column FROM domain\_table中数据总是以更人性化的格式输出 -- 在INSERT INTO domain\_table FORMAT CSV …中,实现外部源数据以更人性化的格式载入 - -### Domains类型的限制 {#domainslei-xing-de-xian-zhi} - -- 无法通过`ALTER TABLE`将基础类型的索引转换为Domain类型的索引。 -- 当从其他列或表插入数据时,无法将string类型的值隐式地转换为Domain类型的值。 -- 无法对存储为Domain类型的值添加约束。 - -[来源文章](https://clickhouse.tech/docs/en/data_types/domains/overview) diff --git a/docs/zh/sql_reference/data_types/enum.md b/docs/zh/sql_reference/data_types/enum.md deleted file mode 100644 index 87ada143638..00000000000 --- a/docs/zh/sql_reference/data_types/enum.md +++ /dev/null @@ -1,101 +0,0 @@ - -# Enum8,Enum16 {#enum8-enum16} - -包括 `Enum8` 和 `Enum16` 类型。`Enum` 保存 `'string'= integer` 的对应关系。在 ClickHouse 中,尽管用户使用的是字符串常量,但所有含有 `Enum` 数据类型的操作都是按照包含整数的值来执行。这在性能方面比使用 `String` 数据类型更有效。 - -- `Enum8` 用 `'String'= Int8` 对描述。 -- `Enum16` 用 `'String'= Int16` 对描述。 - -## 用法示例 {#yong-fa-shi-li} - -创建一个带有一个枚举 `Enum8('hello' = 1, 'world' = 2)` 类型的列: - - CREATE TABLE t_enum - ( - x Enum8('hello' = 1, 'world' = 2) - ) - ENGINE = TinyLog - -这个 `x` 列只能存储类型定义中列出的值:`'hello'`或`'world'`。如果您尝试保存任何其他值,ClickHouse 抛出异常。 - - :) INSERT INTO t_enum VALUES ('hello'), ('world'), ('hello') - - INSERT INTO t_enum VALUES - - Ok. - - 3 rows in set. Elapsed: 0.002 sec. - - :) insert into t_enum values('a') - - INSERT INTO t_enum VALUES - - - Exception on client: - Code: 49. DB::Exception: Unknown element 'a' for type Enum8('hello' = 1, 'world' = 2) - -当您从表中查询数据时,ClickHouse 从 `Enum` 中输出字符串值。 - - SELECT * FROM t_enum - - ┌─x─────┐ - │ hello │ - │ world │ - │ hello │ - └───────┘ - -如果需要看到对应行的数值,则必须将 `Enum` 值转换为整数类型。 - - SELECT CAST(x, 'Int8') FROM t_enum - - ┌─CAST(x, 'Int8')─┐ - │ 1 │ - │ 2 │ - │ 1 │ - └─────────────────┘ - -在查询中创建枚举值,您还需要使用 `CAST`。 - - SELECT toTypeName(CAST('a', 'Enum8(\'a\' = 1, \'b\' = 2)')) - - ┌─toTypeName(CAST('a', 'Enum8(\'a\' = 1, \'b\' = 2)'))─┐ - │ Enum8('a' = 1, 'b' = 2) │ - └──────────────────────────────────────────────────────┘ - -## 规则及用法 {#gui-ze-ji-yong-fa} - -`Enum8` 类型的每个值范围是 `-128 ... 127`,`Enum16` 类型的每个值范围是 `-32768 ... 32767`。所有的字符串或者数字都必须是不一样的。允许存在空字符串。如果某个 Enum 类型被指定了(在表定义的时候),数字可以是任意顺序。然而,顺序并不重要。 - -`Enum` 中的字符串和数值都不能是 [NULL](../../sql_reference/data_types/enum.md)。 - -`Enum` 包含在 [可为空](nullable.md) 类型中。因此,如果您使用此查询创建一个表 - - CREATE TABLE t_enum_nullable - ( - x Nullable( Enum8('hello' = 1, 'world' = 2) ) - ) - ENGINE = TinyLog - -不仅可以存储 `'hello'` 和 `'world'` ,还可以存储 `NULL`。 - - INSERT INTO t_enum_nullable Values('hello'),('world'),(NULL) - -在内存中,`Enum` 列的存储方式与相应数值的 `Int8` 或 `Int16` 相同。 - -当以文本方式读取的时候,ClickHouse 将值解析成字符串然后去枚举值的集合中搜索对应字符串。如果没有找到,会抛出异常。当读取文本格式的时候,会根据读取到的字符串去找对应的数值。如果没有找到,会抛出异常。 - -当以文本形式写入时,ClickHouse 将值解析成字符串写入。如果列数据包含垃圾数据(不是来自有效集合的数字),则抛出异常。Enum 类型以二进制读取和写入的方式与 `Int8` 和 `Int16` 类型一样的。 - -隐式默认值是数值最小的值。 - -在 `ORDER BY`,`GROUP BY`,`IN`,`DISTINCT` 等等中,Enum 的行为与相应的数字相同。例如,按数字排序。对于等式运算符和比较运算符,Enum 的工作机制与它们在底层数值上的工作机制相同。 - -枚举值不能与数字进行比较。枚举可以与常量字符串进行比较。如果与之比较的字符串不是有效Enum值,则将引发异常。可以使用 IN 运算符来判断一个 Enum 是否存在于某个 Enum 集合中,其中集合中的 Enum 需要用字符串表示。 - -大多数具有数字和字符串的运算并不适用于Enums;例如,Enum 类型不能和一个数值相加。但是,Enum有一个原生的 `toString` 函数,它返回它的字符串值。 - -Enum 值使用 `toT` 函数可以转换成数值类型,其中 T 是一个数值类型。若 `T` 恰好对应 Enum 的底层数值类型,这个转换是零消耗的。 - -Enum 类型可以被 `ALTER` 无成本地修改对应集合的值。可以通过 `ALTER` 操作来增加或删除 Enum 的成员(只要表没有用到该值,删除都是安全的)。作为安全保障,改变之前使用过的 Enum 成员将抛出异常。 - -通过 `ALTER` 操作,可以将 `Enum8` 转成 `Enum16`,反之亦然,就像 `Int8` 转 `Int16`一样。 diff --git a/docs/zh/sql_reference/data_types/fixedstring.md b/docs/zh/sql_reference/data_types/fixedstring.md deleted file mode 100644 index c8e71e69303..00000000000 --- a/docs/zh/sql_reference/data_types/fixedstring.md +++ /dev/null @@ -1,57 +0,0 @@ - -# 固定字符串 {#fixedstring} - -固定长度 N 的字符串(N 必须是严格的正自然数)。 - -您可以使用下面的语法对列声明为`FixedString`类型: - -``` sql - FixedString(N) -``` - -其中`N`表示自然数。 - -当数据的长度恰好为N个字节时,`FixedString`类型是高效的。 在其他情况下,这可能会降低效率。 - -可以有效存储在`FixedString`类型的列中的值的示例: - -- 二进制表示的IP地址(IPv6使用`FixedString(16)`) -- 语言代码(ru\_RU, en\_US … ) -- 货币代码(USD, RUB … ) -- 二进制表示的哈希值(MD5使用`FixedString(16)`,SHA256使用`FixedString(32)`) - -请使用[UUID](uuid.md)数据类型来存储UUID值,。 - -当向ClickHouse中插入数据时, - -- 如果字符串包含的字节数少于\`N',将对字符串末尾进行空字节填充。 -- 如果字符串包含的字节数大于`N`,将抛出`Too large value for FixedString(N)`异常。 - -当做数据查询时,ClickHouse不会删除字符串末尾的空字节。 如果使用`WHERE`子句,则须要手动添加空字节以匹配`FixedString`的值。 以下示例阐明了如何将`WHERE`子句与`FixedString`一起使用。 - -考虑带有`FixedString(2)`列的表: - -``` text -┌─name──┐ -│ b │ -└───────┘ -``` - -查询语句`SELECT * FROM FixedStringTable WHERE a = 'b'` 不会返回任何结果。请使用空字节来填充筛选条件。 - -``` sql -SELECT * FROM FixedStringTable -WHERE a = 'b\0' -``` - -``` text -┌─a─┐ -│ b │ -└───┘ -``` - -这种方式与MySQL的`CHAR`类型的方式不同(MySQL中使用空格填充字符串,并在输出时删除空格)。 - -请注意,`FixedString(N)`的长度是个常量。仅由空字符组成的字符串,函数[长度](../../sql_reference/data_types/fixedstring.md#array_functions-length)返回值为`N`,而函数[空](../../sql_reference/data_types/fixedstring.md#string_functions-empty)的返回值为`1`。 - -[来源文章](https://clickhouse.tech/docs/en/data_types/fixedstring/) diff --git a/docs/zh/sql_reference/data_types/float.md b/docs/zh/sql_reference/data_types/float.md deleted file mode 100644 index bdc8093a9a9..00000000000 --- a/docs/zh/sql_reference/data_types/float.md +++ /dev/null @@ -1,71 +0,0 @@ - -# Float32,Float64 {#float32-float64} - -[浮点数](https://en.wikipedia.org/wiki/IEEE_754)。 - -类型与以下 C 语言中类型是相同的: - -- `Float32` - `float` -- `Float64` - `double` - -我们建议您尽可能以整数形式存储数据。例如,将固定精度的数字转换为整数值,例如货币数量或页面加载时间用毫秒为单位表示 - -## 使用浮点数 {#shi-yong-fu-dian-shu} - -- 对浮点数进行计算可能引起四舍五入的误差。 - - - -``` sql -SELECT 1 - 0.9 -``` - - ┌───────minus(1, 0.9)─┐ - │ 0.09999999999999998 │ - └─────────────────────┘ - -- 计算的结果取决于计算方法(计算机系统的处理器类型和体系结构) - -- 浮点计算结果可能是诸如无穷大(`INF`)和«非数字»(`NaN`)。对浮点数计算的时候应该考虑到这点。 - -- 当一行行阅读浮点数的时候,浮点数的结果可能不是机器最近显示的数值。 - -## 南和Inf {#data_type-float-nan-inf} - -与标准SQL相比,ClickHouse 支持以下类别的浮点数: - -- `Inf` – 正无穷 - - - -``` sql -SELECT 0.5 / 0 -``` - - ┌─divide(0.5, 0)─┐ - │ inf │ - └────────────────┘ - -- `-Inf` – 负无穷 - - - -``` sql -SELECT -0.5 / 0 -``` - - ┌─divide(-0.5, 0)─┐ - │ -inf │ - └─────────────────┘ - -- `NaN` – 非数字 - - - - SELECT 0 / 0 - - ┌─divide(0, 0)─┐ - │ nan │ - └──────────────┘ - -可以在 [ORDER BY 子句](../../sql_reference/data_types/float.md) 查看更多关于 `NaN` 排序的规则。 diff --git a/docs/zh/sql_reference/data_types/index.md b/docs/zh/sql_reference/data_types/index.md deleted file mode 100644 index 8df3911ab36..00000000000 --- a/docs/zh/sql_reference/data_types/index.md +++ /dev/null @@ -1,6 +0,0 @@ - -# 数据类型 {#data_types} - -ClickHouse 可以在数据表中存储多种数据类型。 - -本节描述 ClickHouse 支持的数据类型,以及使用或者实现它们时(如果有的话)的注意事项。 diff --git a/docs/zh/sql_reference/data_types/int_uint.md b/docs/zh/sql_reference/data_types/int_uint.md deleted file mode 100644 index b74bbcf178f..00000000000 --- a/docs/zh/sql_reference/data_types/int_uint.md +++ /dev/null @@ -1,18 +0,0 @@ - -# UInt8,UInt16,UInt32,UInt64,Int8,Int16,Int32,Int64 {#uint8-uint16-uint32-uint64-int8-int16-int32-int64} - -固定长度的整型,包括有符号整型或无符号整型。 - -## 整型范围 {#zheng-xing-fan-wei} - -- Int8-\[-128:127\] -- Int16-\[-32768:32767\] -- Int32-\[-2147483648:2147483647\] -- Int64-\[-9223372036854775808:9223372036854775807\] - -## 无符号整型范围 {#wu-fu-hao-zheng-xing-fan-wei} - -- UInt8-\[0:255\] -- UInt16-\[0:65535\] -- UInt32-\[0:4294967295\] -- UInt64-\[0:18446744073709551615\] diff --git a/docs/zh/sql_reference/data_types/nested_data_structures/index.md b/docs/zh/sql_reference/data_types/nested_data_structures/index.md deleted file mode 100644 index fdeb9fe6ac5..00000000000 --- a/docs/zh/sql_reference/data_types/nested_data_structures/index.md +++ /dev/null @@ -1,2 +0,0 @@ - -# 嵌套数据结构 {#qian-tao-shu-ju-jie-gou} 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 deleted file mode 100644 index 6ac26c0eeba..00000000000 --- a/docs/zh/sql_reference/data_types/nested_data_structures/nested.md +++ /dev/null @@ -1,98 +0,0 @@ - -# Nested(Name1 Type1, Name2 Type2, …) {#nestedname1-type1-name2-type2} - -嵌套数据结构类似于嵌套表。嵌套数据结构的参数(列名和类型)与 CREATE 查询类似。每个表可以包含任意多行嵌套数据结构。 - -示例: - -``` sql -CREATE TABLE test.visits -( - CounterID UInt32, - StartDate Date, - Sign Int8, - IsNew UInt8, - VisitID UInt64, - UserID UInt64, - ... - Goals Nested - ( - ID UInt32, - Serial UInt32, - EventTime DateTime, - Price Int64, - OrderID String, - CurrencyID UInt32 - ), - ... -) ENGINE = CollapsingMergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192, Sign) -``` - -上述示例声明了 `Goals` 这种嵌套数据结构,它包含访客转化相关的数据(访客达到的目标)。在 ‘visits’ 表中每一行都可以对应零个或者任意个转化数据。 - -只支持一级嵌套。嵌套结构的列中,若列的类型是数组类型,那么该列其实和多维数组是相同的,所以目前嵌套层级的支持很局限(MergeTree 引擎中不支持存储这样的列) - -大多数情况下,处理嵌套数据结构时,会指定一个单独的列。为了这样实现,列的名称会与点号连接起来。这些列构成了一组匹配类型。在同一条嵌套数据中,所有的列都具有相同的长度。 - -示例: - -``` sql -SELECT - Goals.ID, - Goals.EventTime -FROM test.visits -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goals.ID───────────────────────┬─Goals.EventTime───────────────────────────────────────────────────────────────────────────┐ -│ [1073752,591325,591325] │ ['2014-03-17 16:38:10','2014-03-17 16:38:48','2014-03-17 16:42:27'] │ -│ [1073752] │ ['2014-03-17 00:28:25'] │ -│ [1073752] │ ['2014-03-17 10:46:20'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:59:20','2014-03-17 22:17:55','2014-03-17 22:18:07','2014-03-17 22:18:51'] │ -│ [] │ [] │ -│ [1073752,591325,591325] │ ['2014-03-17 11:37:06','2014-03-17 14:07:47','2014-03-17 14:36:21'] │ -│ [] │ [] │ -│ [] │ [] │ -│ [591325,1073752] │ ['2014-03-17 00:46:05','2014-03-17 00:46:05'] │ -│ [1073752,591325,591325,591325] │ ['2014-03-17 13:28:33','2014-03-17 13:30:26','2014-03-17 18:51:21','2014-03-17 18:51:45'] │ -└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘ -``` - -所以可以简单地把嵌套数据结构当做是所有列都是相同长度的多列数组。 - -SELECT 查询只有在使用 ARRAY JOIN 的时候才可以指定整个嵌套数据结构的名称。更多信息,参考 «ARRAY JOIN 子句»。示例: - -``` sql -SELECT - Goal.ID, - Goal.EventTime -FROM test.visits -ARRAY JOIN Goals AS Goal -WHERE CounterID = 101500 AND length(Goals.ID) < 5 -LIMIT 10 -``` - -``` text -┌─Goal.ID─┬──────Goal.EventTime─┐ -│ 1073752 │ 2014-03-17 16:38:10 │ -│ 591325 │ 2014-03-17 16:38:48 │ -│ 591325 │ 2014-03-17 16:42:27 │ -│ 1073752 │ 2014-03-17 00:28:25 │ -│ 1073752 │ 2014-03-17 10:46:20 │ -│ 1073752 │ 2014-03-17 13:59:20 │ -│ 591325 │ 2014-03-17 22:17:55 │ -│ 591325 │ 2014-03-17 22:18:07 │ -│ 591325 │ 2014-03-17 22:18:51 │ -│ 1073752 │ 2014-03-17 11:37:06 │ -└─────────┴─────────────────────┘ -``` - -不能对整个嵌套数据结构执行 SELECT。只能明确列出属于它一部分列。 - -对于 INSERT 查询,可以单独地传入所有嵌套数据结构中的列数组(假如它们是单独的列数组)。在插入过程中,系统会检查它们是否有相同的长度。 - -对于 DESCRIBE 查询,嵌套数据结构中的列会以相同的方式分别列出来。 - -ALTER 查询对嵌套数据结构的操作非常有限。 diff --git a/docs/zh/sql_reference/data_types/nullable.md b/docs/zh/sql_reference/data_types/nullable.md deleted file mode 100644 index 6ece5f3c178..00000000000 --- a/docs/zh/sql_reference/data_types/nullable.md +++ /dev/null @@ -1,42 +0,0 @@ - -# 可为空(类型名称) {#data_type-nullable} - -允许用特殊标记 ([NULL](../../sql_reference/data_types/nullable.md)) 表示«缺失值»,可以与 `TypeName` 的正常值存放一起。例如,`Nullable(Int8)` 类型的列可以存储 `Int8` 类型值,而没有值的行将存储 `NULL`。 - -对于 `TypeName`,不能使用复合数据类型 [阵列](array.md) 和 [元组](tuple.md)。复合数据类型可以包含 `Nullable` 类型值,例如`Array(Nullable(Int8))`。 - -`Nullable` 类型字段不能包含在表索引中。 - -除非在 ClickHouse 服务器配置中另有说明,否则 `NULL` 是任何 `Nullable` 类型的默认值。 - -## 存储特性 {#cun-chu-te-xing} - -要在表的列中存储 `Nullable` 类型值,ClickHouse 除了使用带有值的普通文件外,还使用带有 `NULL` 掩码的单独文件。 掩码文件中的条目允许 ClickHouse 区分每个表行的 `NULL` 和相应数据类型的默认值。 由于附加了新文件,`Nullable` 列与类似的普通文件相比消耗额外的存储空间。 - -!!! 注意点 "注意点" - 使用 `Nullable` 几乎总是对性能产生负面影响,在设计数据库时请记住这一点 - -掩码文件中的条目允许ClickHouse区分每个表行的对应数据类型的«NULL»和默认值由于有额外的文件,«Nullable»列比普通列消耗更多的存储空间 - -## 用法示例 {#yong-fa-shi-li} - -``` sql -CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog -``` - -``` sql -INSERT INTO t_null VALUES (1, NULL), (2, 3) -``` - -``` sql -SELECT x + y FROM t_null -``` - -``` text -┌─plus(x, y)─┐ -│ ᴺᵁᴸᴸ │ -│ 5 │ -└────────────┘ -``` - -[来源文章](https://clickhouse.tech/docs/en/data_types/nullable/) diff --git a/docs/zh/sql_reference/data_types/simpleaggregatefunction.md b/docs/zh/sql_reference/data_types/simpleaggregatefunction.md deleted file mode 120000 index 02fad64d50e..00000000000 --- a/docs/zh/sql_reference/data_types/simpleaggregatefunction.md +++ /dev/null @@ -1 +0,0 @@ -../../../en/sql_reference/data_types/simpleaggregatefunction.md \ No newline at end of file diff --git a/docs/zh/sql_reference/data_types/special_data_types/expression.md b/docs/zh/sql_reference/data_types/special_data_types/expression.md deleted file mode 100644 index d4fb3257f60..00000000000 --- a/docs/zh/sql_reference/data_types/special_data_types/expression.md +++ /dev/null @@ -1,4 +0,0 @@ - -# 表达式 {#expression} - -用于表示高阶函数中的Lambd表达式。 diff --git a/docs/zh/sql_reference/data_types/special_data_types/index.md b/docs/zh/sql_reference/data_types/special_data_types/index.md deleted file mode 100644 index 64d93783cb9..00000000000 --- a/docs/zh/sql_reference/data_types/special_data_types/index.md +++ /dev/null @@ -1,4 +0,0 @@ - -# 特殊数据类型 {#special-data-types} - -特殊数据类型的值既不能存在表中也不能在结果中输出,但可用于查询的中间结果。 diff --git a/docs/zh/sql_reference/data_types/special_data_types/interval.md b/docs/zh/sql_reference/data_types/special_data_types/interval.md deleted file mode 100644 index 7a7ac888775..00000000000 --- a/docs/zh/sql_reference/data_types/special_data_types/interval.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 61 -toc_title: "\u95F4\u9694" ---- - -# 间隔 {#data-type-interval} - -表示时间和日期间隔的数据类型族。 由此产生的类型 [INTERVAL](../../../sql_reference/operators.md#operator-interval) 接线员 - -!!! warning "警告" - `Interval` 数据类型值不能存储在表中。 - -结构: - -- 时间间隔作为无符号整数值。 -- 间隔的类型。 - -支持的时间间隔类型: - -- `SECOND` -- `MINUTE` -- `HOUR` -- `DAY` -- `WEEK` -- `MONTH` -- `QUARTER` -- `YEAR` - -对于每个间隔类型,都有一个单独的数据类型。 例如, `DAY` 间隔对应于 `IntervalDay` 数据类型: - -``` sql -SELECT toTypeName(INTERVAL 4 DAY) -``` - -``` text -┌─toTypeName(toIntervalDay(4))─┐ -│ IntervalDay │ -└──────────────────────────────┘ -``` - -## 使用说明 {#data-type-interval-usage-remarks} - -您可以使用 `Interval`-在算术运算类型值 [日期](../../../sql_reference/data_types/date.md) 和 [日期时间](../../../sql_reference/data_types/datetime.md)-类型值。 例如,您可以将4天添加到当前时间: - -``` sql -SELECT now() as current_date_time, current_date_time + INTERVAL 4 DAY -``` - -``` text -┌───current_date_time─┬─plus(now(), toIntervalDay(4))─┐ -│ 2019-10-23 10:58:45 │ 2019-10-27 10:58:45 │ -└─────────────────────┴───────────────────────────────┘ -``` - -不同类型的间隔不能合并。 你不能使用间隔,如 `4 DAY 1 HOUR`. 以小于或等于间隔的最小单位的单位指定间隔,例如,间隔 `1 day and an hour` 间隔可以表示为 `25 HOUR` 或 `90000 SECOND`. - -你不能执行算术运算 `Interval`-类型值,但你可以添加不同类型的时间间隔,因此值 `Date` 或 `DateTime` 数据类型。 例如: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -以下查询将导致异常: - -``` sql -select now() AS current_date_time, current_date_time + (INTERVAL 4 DAY + INTERVAL 3 HOUR) -``` - -``` text -Received exception from server (version 19.14.1): -Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Wrong argument types for function plus: if one argument is Interval, then another must be Date or DateTime.. -``` - -## 另请参阅 {#see-also} - -- [INTERVAL](../../../sql_reference/operators.md#operator-interval) 接线员 -- [toInterval](../../../sql_reference/functions/type_conversion_functions.md#function-tointerval) 类型转换函数 diff --git a/docs/zh/sql_reference/data_types/special_data_types/nothing.md b/docs/zh/sql_reference/data_types/special_data_types/nothing.md deleted file mode 100644 index ebc2b572983..00000000000 --- a/docs/zh/sql_reference/data_types/special_data_types/nothing.md +++ /dev/null @@ -1,20 +0,0 @@ - -# 没什么 {#nothing} - -此数据类型的唯一目的是表示不是期望值的情况。 所以不能创建一个 `Nothing` 类型的值。 - -例如,文本 [NULL](../../../sql_reference/data_types/special_data_types/nothing.md#null-literal) 的类型为 `Nullable(Nothing)`。详情请见 [可为空](../../../sql_reference/data_types/special_data_types/nothing.md)。 - -`Nothing` 类型也可以用来表示空数组: - -``` bash -:) SELECT toTypeName(array()) - -SELECT toTypeName([]) - -┌─toTypeName(array())─┐ -│ Array(Nothing) │ -└─────────────────────┘ - -1 rows in set. Elapsed: 0.062 sec. -``` diff --git a/docs/zh/sql_reference/data_types/special_data_types/set.md b/docs/zh/sql_reference/data_types/special_data_types/set.md deleted file mode 100644 index 0e1f9c6cc35..00000000000 --- a/docs/zh/sql_reference/data_types/special_data_types/set.md +++ /dev/null @@ -1,4 +0,0 @@ - -# 设置 {#set} - -可以用在 IN 表达式的右半部分。 diff --git a/docs/zh/sql_reference/data_types/string.md b/docs/zh/sql_reference/data_types/string.md deleted file mode 100644 index 3c9226787a2..00000000000 --- a/docs/zh/sql_reference/data_types/string.md +++ /dev/null @@ -1,11 +0,0 @@ - -# 字符串 {#string} - -字符串可以任意长度的。它可以包含任意的字节集,包含空字节。因此,字符串类型可以代替其他 DBMSs 中的 VARCHAR、BLOB、CLOB 等类型。 - -## 编码 {#bian-ma} - -ClickHouse 没有编码的概念。字符串可以是任意的字节集,按它们原本的方式进行存储和输出。 -若需存储文本,我们建议使用 UTF-8 编码。至少,如果你的终端使用UTF-8(推荐),这样读写就不需要进行任何的转换了。 -同样,对不同的编码文本 ClickHouse 会有不同处理字符串的函数。 -比如,`length` 函数可以计算字符串包含的字节数组的长度,然而 `lengthUTF8` 函数是假设字符串以 UTF-8 编码,计算的是字符串包含的 Unicode 字符的长度。 diff --git a/docs/zh/sql_reference/data_types/tuple.md b/docs/zh/sql_reference/data_types/tuple.md deleted file mode 100644 index e3520722c97..00000000000 --- a/docs/zh/sql_reference/data_types/tuple.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Tuple(T1, T2, …) {#tuplet1-t2} - -元组,其中每个元素都有单独的 [类型](index.md#data_types)。 - -不能在表中存储元组(除了内存表)。它们可以用于临时列分组。在查询中,IN 表达式和带特定参数的 lambda 函数可以来对临时列进行分组。更多信息,请参阅 [IN 操作符](../../sql_reference/data_types/tuple.md) 和 [高阶函数](../../sql_reference/data_types/tuple.md)。 - -元组可以是查询的结果。在这种情况下,对于JSON以外的文本格式,括号中的值是逗号分隔的。在JSON格式中,元组作为数组输出(在方括号中)。 - -## 创建元组 {#chuang-jian-yuan-zu} - -可以使用函数来创建元组: - - tuple(T1, T2, ...) - -创建元组的示例: - - :) SELECT tuple(1,'a') AS x, toTypeName(x) - - SELECT - (1, 'a') AS x, - toTypeName(x) - - ┌─x───────┬─toTypeName(tuple(1, 'a'))─┐ - │ (1,'a') │ Tuple(UInt8, String) │ - └─────────┴───────────────────────────┘ - - 1 rows in set. Elapsed: 0.021 sec. - -## 元组中的数据类型 {#yuan-zu-zhong-de-shu-ju-lei-xing} - -在动态创建元组时,ClickHouse 会自动为元组的每一个参数赋予最小可表达的类型。如果参数为 [NULL](../../sql_reference/data_types/tuple.md#null-literal),那这个元组对应元素是 [可为空](nullable.md)。 - -自动数据类型检测示例: - - SELECT tuple(1, NULL) AS x, toTypeName(x) - - SELECT - (1, NULL) AS x, - toTypeName(x) - - ┌─x────────┬─toTypeName(tuple(1, NULL))──────┐ - │ (1,NULL) │ Tuple(UInt8, Nullable(Nothing)) │ - └──────────┴─────────────────────────────────┘ - - 1 rows in set. Elapsed: 0.002 sec. diff --git a/docs/zh/sql_reference/data_types/uuid.md b/docs/zh/sql_reference/data_types/uuid.md deleted file mode 100644 index 4c35fcf2d9c..00000000000 --- a/docs/zh/sql_reference/data_types/uuid.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 46 -toc_title: UUID ---- - -# UUID {#uuid-data-type} - -通用唯一标识符(UUID)是用于标识记录的16字节数。 有关UUID的详细信息,请参阅 [维基百科](https://en.wikipedia.org/wiki/Universally_unique_identifier). - -UUID类型值的示例如下所示: - -``` text -61f0c404-5cb3-11e7-907b-a6006ad3dba0 -``` - -如果在插入新记录时未指定UUID列值,则UUID值将用零填充: - -``` text -00000000-0000-0000-0000-000000000000 -``` - -## 如何生成 {#how-to-generate} - -要生成UUID值,ClickHouse提供了 [generateuidv4](../../sql_reference/functions/uuid_functions.md) 功能。 - -## 用法示例 {#usage-example} - -**示例1** - -此示例演示如何创建具有UUID类型列的表并将值插入到表中。 - -``` sql -CREATE TABLE t_uuid (x UUID, y String) ENGINE=TinyLog -``` - -``` sql -INSERT INTO t_uuid SELECT generateUUIDv4(), 'Example 1' -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -└──────────────────────────────────────┴───────────┘ -``` - -**示例2** - -在此示例中,插入新记录时未指定UUID列值。 - -``` sql -INSERT INTO t_uuid (y) VALUES ('Example 2') -``` - -``` sql -SELECT * FROM t_uuid -``` - -``` text -┌────────────────────────────────────x─┬─y─────────┐ -│ 417ddc5d-e556-4d27-95dd-a34d84e46a50 │ Example 1 │ -│ 00000000-0000-0000-0000-000000000000 │ Example 2 │ -└──────────────────────────────────────┴───────────┘ -``` - -## 限制 {#restrictions} - -UUID数据类型仅支持以下功能 [字符串](string.md) 数据类型也支持(例如, [min](../../sql_reference/aggregate_functions/reference.md#agg_function-min), [max](../../sql_reference/aggregate_functions/reference.md#agg_function-max),和 [计数](../../sql_reference/aggregate_functions/reference.md#agg_function-count)). - -算术运算不支持UUID数据类型(例如, [abs](../../sql_reference/functions/arithmetic_functions.md#arithm_func-abs))或聚合函数,例如 [sum](../../sql_reference/aggregate_functions/reference.md#agg_function-sum) 和 [avg](../../sql_reference/aggregate_functions/reference.md#agg_function-avg). - -[原始文章](https://clickhouse.tech/docs/en/data_types/uuid/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts.md b/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts.md deleted file mode 100644 index afbdd082576..00000000000 --- a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 39 -toc_title: "\u6982\u8FF0" ---- - -# 外部字典 {#dicts-external-dicts} - -您可以从各种数据源添加自己的字典。 字典的数据源可以是本地文本或可执行文件、HTTP(s)资源或其他DBMS。 有关详细信息,请参阅 “[外部字典的来源](external_dicts_dict_sources.md)”. - -ClickHouse: - -- 完全或部分存储在RAM中的字典。 -- 定期更新字典并动态加载缺失的值。 换句话说,字典可以动态加载。 -- 允许创建外部字典与xml文件或 [DDL查询](../../statements/create.md#create-dictionary-query). - -外部字典的配置可以位于一个或多个xml文件中。 配置的路径在指定 [dictionaries\_config](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_config) 参数。 - -字典可以在服务器启动或首次使用时加载,具体取决于 [dictionaries\_lazy\_load](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load) 设置。 - -字典配置文件具有以下格式: - -``` xml - - An optional element with any content. Ignored by the ClickHouse server. - - - /etc/metrika.xml - - - - - - - - -``` - -你可以 [配置](external_dicts_dict.md) 同一文件中的任意数量的字典。 - -[字典的DDL查询](../../statements/create.md#create-dictionary-query) 在服务器配置中不需要任何其他记录。 它们允许使用字典作为一流的实体,如表或视图。 - -!!! attention "注意" - 您可以通过在一个小字典中描述它来转换小字典的值 `SELECT` 查询(见 [变换](../../../sql_reference/functions/other_functions.md) 功能)。 此功能与外部字典无关。 - -## 另请参阅 {#ext-dicts-see-also} - -- [配置外部字典](external_dicts_dict.md) -- [在内存中存储字典](external_dicts_dict_layout.md) -- [字典更新](external_dicts_dict_lifetime.md) -- [外部字典的来源](external_dicts_dict_sources.md) -- [字典键和字段](external_dicts_dict_structure.md) -- [使用外部字典的函数](../../../sql_reference/functions/ext_dict_functions.md) - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md b/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md deleted file mode 100644 index df64d31d2a9..00000000000 --- a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 40 -toc_title: "\u914D\u7F6E\u5916\u90E8\u5B57\u5178" ---- - -# 配置外部字典 {#dicts-external-dicts-dict} - -如果使用xml文件配置字典,则比字典配置具有以下结构: - -``` xml - - dict_name - - - - - - - - - - - - - - - - - -``` - -相应的 [DDL-查询](../../statements/create.md#create-dictionary-query) 具有以下结构: - -``` sql -CREATE DICTIONARY dict_name -( - ... -- attributes -) -PRIMARY KEY ... -- complex or single key configuration -SOURCE(...) -- Source configuration -LAYOUT(...) -- Memory layout configuration -LIFETIME(...) -- Lifetime of dictionary in memory -``` - -- `name` – The identifier that can be used to access the dictionary. Use the characters `[a-zA-Z0-9_\-]`. -- [来源](external_dicts_dict_sources.md) — Source of the dictionary. -- [布局](external_dicts_dict_layout.md) — Dictionary layout in memory. -- [结构](external_dicts_dict_structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key. -- [使用寿命](external_dicts_dict_lifetime.md) — Frequency of dictionary updates. - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md b/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md deleted file mode 100644 index 925e5f6c8f4..00000000000 --- a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_hierarchical.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 45 -toc_title: "\u5206\u5C42\u5B57\u5178" ---- - -# 分层字典 {#hierarchical-dictionaries} - -ClickHouse支持分层字典与 [数字键](external_dicts_dict_structure.md#ext_dict-numeric-key). - -看看下面的层次结构: - -``` text -0 (Common parent) -│ -├── 1 (Russia) -│ │ -│ └── 2 (Moscow) -│ │ -│ └── 3 (Center) -│ -└── 4 (Great Britain) - │ - └── 5 (London) -``` - -这种层次结构可以表示为下面的字典表。 - -| region\_id | parent\_region | region\_name | -|------------|----------------|--------------| -| 1 | 0 | 俄罗斯 | -| 2 | 1 | 莫斯科 | -| 3 | 2 | 中心 | -| 4 | 0 | 英国 | -| 5 | 4 | 伦敦 | - -此表包含一列 `parent_region` 包含该元素的最近父项的键。 - -ClickHouse支持 [等级](external_dicts_dict_structure.md#hierarchical-dict-attr) 属性为 [外部字典](index.md) 属性。 此属性允许您配置类似于上述的分层字典。 - -该 [独裁主义](../../../sql_reference/functions/ext_dict_functions.md#dictgethierarchy) 函数允许您获取元素的父链。 - -对于我们的例子,dictionary的结构可以是以下内容: - -``` xml - - - - region_id - - - - parent_region - UInt64 - 0 - true - - - - region_name - String - - - - - -``` - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md b/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md deleted file mode 100644 index 4dcf5f4c1b0..00000000000 --- a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_layout.md +++ /dev/null @@ -1,373 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 41 -toc_title: "\u5728\u5185\u5B58\u4E2D\u5B58\u50A8\u5B57\u5178" ---- - -# 在内存中存储字典 {#dicts-external-dicts-dict-layout} - -有多种方法可以将字典存储在内存中。 - -我们建议 [平](#flat), [散列](#dicts-external_dicts_dict_layout-hashed) 和 [complex\_key\_hashed](#complex-key-hashed). 其提供最佳的处理速度。 - -不建议使用缓存,因为性能可能较差,并且难以选择最佳参数。 阅读更多的部分 “[缓存](#cache)”. - -有几种方法可以提高字典性能: - -- 调用该函数以使用后的字典 `GROUP BY`. -- 将要提取的属性标记为"注射"。 如果不同的属性值对应于不同的键,则称为注射属性。 所以当 `GROUP BY` 使用由键获取属性值的函数,此函数会自动取出 `GROUP BY`. - -ClickHouse为字典中的错误生成异常。 错误示例: - -- 无法加载正在访问的字典。 -- 查询错误 `cached` 字典 - -您可以查看外部字典的列表及其状态 `system.dictionaries` 桌子 - -配置如下所示: - -``` xml - - - ... - - - - - - ... - - -``` - -相应的 [DDL-查询](../../statements/create.md#create-dictionary-query): - -``` sql -CREATE DICTIONARY (...) -... -LAYOUT(LAYOUT_TYPE(param value)) -- layout settings -... -``` - -## 在内存中存储字典的方法 {#ways-to-store-dictionaries-in-memory} - -- [平](#flat) -- [散列](#dicts-external_dicts_dict_layout-hashed) -- [sparse\_hashed](#dicts-external_dicts_dict_layout-sparse_hashed) -- [缓存](#cache) -- [range\_hashed](#range-hashed) -- [complex\_key\_hashed](#complex-key-hashed) -- [complex\_key\_cache](#complex-key-cache) -- [ip\_trie](#ip-trie) - -### 平 {#flat} - -字典以平面数组的形式完全存储在内存中。 字典使用多少内存? 量与最大键的大小(在使用的空间中)成正比。 - -字典键具有 `UInt64` 类型和值限制为500,000。 如果在创建字典时发现较大的键,ClickHouse将引发异常,不会创建字典。 - -支持所有类型的来源。 更新时,数据(来自文件或表)将完整读取。 - -此方法在存储字典的所有可用方法中提供了最佳性能。 - -配置示例: - -``` xml - - - -``` - -或 - -``` sql -LAYOUT(FLAT()) -``` - -### 散列 {#dicts-external_dicts_dict_layout-hashed} - -该字典以哈希表的形式完全存储在内存中。 字典中可以包含任意数量的带有任意标识符的元素,在实践中,键的数量可以达到数千万项。 - -支持所有类型的来源。 更新时,数据(来自文件或表)将完整读取。 - -配置示例: - -``` xml - - - -``` - -或 - -``` sql -LAYOUT(HASHED()) -``` - -### sparse\_hashed {#dicts-external_dicts_dict_layout-sparse_hashed} - -类似于 `hashed`,但使用更少的内存,有利于更多的CPU使用率。 - -配置示例: - -``` xml - - - -``` - -``` sql -LAYOUT(SPARSE_HASHED()) -``` - -### complex\_key\_hashed {#complex-key-hashed} - -这种类型的存储是用于复合 [键](external_dicts_dict_structure.md). 类似于 `hashed`. - -配置示例: - -``` xml - - - -``` - -``` sql -LAYOUT(COMPLEX_KEY_HASHED()) -``` - -### range\_hashed {#range-hashed} - -字典以哈希表的形式存储在内存中,其中包含有序范围及其相应值的数组。 - -此存储方法的工作方式与散列方式相同,除了键之外,还允许使用日期/时间(任意数字类型)范围。 - -示例:该表格包含每个广告客户的折扣,格式为: - -``` text -+---------|-------------|-------------|------+ -| advertiser id | discount start date | discount end date | amount | -+===============+=====================+===================+========+ -| 123 | 2015-01-01 | 2015-01-15 | 0.15 | -+---------|-------------|-------------|------+ -| 123 | 2015-01-16 | 2015-01-31 | 0.25 | -+---------|-------------|-------------|------+ -| 456 | 2015-01-01 | 2015-01-15 | 0.05 | -+---------|-------------|-------------|------+ -``` - -要对日期范围使用示例,请定义 `range_min` 和 `range_max` 中的元素 [结构](external_dicts_dict_structure.md). 这些元素必须包含元素 `name` 和`type` (如果 `type` 如果没有指定,则默认类型将使用-Date)。 `type` 可以是任何数字类型(Date/DateTime/UInt64/Int32/others)。 - -示例: - -``` xml - - - Id - - - first - Date - - - last - Date - - ... -``` - -或 - -``` sql -CREATE DICTIONARY somedict ( - id UInt64, - first Date, - last Date -) -PRIMARY KEY id -LAYOUT(RANGE_HASHED()) -RANGE(MIN first MAX last) -``` - -要使用这些字典,您需要将附加参数传递给 `dictGetT` 函数,为其选择一个范围: - -``` sql -dictGetT('dict_name', 'attr_name', id, date) -``` - -此函数返回指定的值 `id`s和包含传递日期的日期范围。 - -算法的详细信息: - -- 如果 `id` 未找到或范围未找到 `id`,它返回字典的默认值。 -- 如果存在重叠范围,则可以使用任意范围。 -- 如果范围分隔符是 `NULL` 或无效日期(如1900-01-01或2039-01-01),范围保持打开状态。 范围可以在两侧打开。 - -配置示例: - -``` xml - - - - ... - - - - - - - - Abcdef - - - StartTimeStamp - UInt64 - - - EndTimeStamp - UInt64 - - - XXXType - String - - - - - - -``` - -或 - -``` sql -CREATE DICTIONARY somedict( - Abcdef UInt64, - StartTimeStamp UInt64, - EndTimeStamp UInt64, - XXXType String DEFAULT '' -) -PRIMARY KEY Abcdef -RANGE(MIN StartTimeStamp MAX EndTimeStamp) -``` - -### 缓存 {#cache} - -字典存储在具有固定数量的单元格的缓存中。 这些单元格包含经常使用的元素。 - -搜索字典时,首先搜索缓存。 对于每个数据块,所有在缓存中找不到或过期的密钥都从源请求,使用 `SELECT attrs... FROM db.table WHERE id IN (k1, k2, ...)`. 然后将接收到的数据写入高速缓存。 - -对于缓存字典,过期 [使用寿命](external_dicts_dict_lifetime.md) 可以设置高速缓存中的数据。 如果更多的时间比 `lifetime` 自从在单元格中加载数据以来,单元格的值不被使用,并且在下次需要使用时重新请求它。 -这是存储字典的所有方法中最不有效的。 缓存的速度在很大程度上取决于正确的设置和使用场景。 缓存类型字典只有在命中率足够高(推荐99%或更高)时才能表现良好。 您可以查看平均命中率 `system.dictionaries` 桌子 - -要提高缓存性能,请使用以下子查询 `LIMIT`,并从外部调用字典函数。 - -支持 [来源](external_dicts_dict_sources.md):MySQL的,ClickHouse的,可执行文件,HTTP. - -设置示例: - -``` xml - - - - 1000000000 - - -``` - -或 - -``` sql -LAYOUT(CACHE(SIZE_IN_CELLS 1000000000)) -``` - -设置足够大的缓存大小。 你需要尝试选择细胞的数量: - -1. 设置一些值。 -2. 运行查询,直到缓存完全满。 -3. 使用评估内存消耗 `system.dictionaries` 桌子 -4. 增加或减少单元数,直到达到所需的内存消耗。 - -!!! warning "警告" - 不要使用ClickHouse作为源,因为处理随机读取的查询速度很慢。 - -### complex\_key\_cache {#complex-key-cache} - -这种类型的存储是用于复合 [键](external_dicts_dict_structure.md). 类似于 `cache`. - -### ip\_trie {#ip-trie} - -这种类型的存储用于将网络前缀(IP地址)映射到ASN等元数据。 - -示例:该表包含网络前缀及其对应的AS号码和国家代码: - -``` text - +-----------|-----|------+ - | prefix | asn | cca2 | - +=================+=======+========+ - | 202.79.32.0/20 | 17501 | NP | - +-----------|-----|------+ - | 2620:0:870::/48 | 3856 | US | - +-----------|-----|------+ - | 2a02:6b8:1::/48 | 13238 | RU | - +-----------|-----|------+ - | 2001:db8::/32 | 65536 | ZZ | - +-----------|-----|------+ -``` - -使用此类布局时,结构必须具有复合键。 - -示例: - -``` xml - - - - prefix - String - - - - asn - UInt32 - - - - cca2 - String - ?? - - ... -``` - -或 - -``` sql -CREATE DICTIONARY somedict ( - prefix String, - asn UInt32, - cca2 String DEFAULT '??' -) -PRIMARY KEY prefix -``` - -该键必须只有一个包含允许的IP前缀的字符串类型属性。 还不支持其他类型。 - -对于查询,必须使用相同的函数 (`dictGetT` 与元组)至于具有复合键的字典: - -``` sql -dictGetT('dict_name', 'attr_name', tuple(ip)) -``` - -该函数采用任一 `UInt32` 对于IPv4,或 `FixedString(16)` 碌莽禄Ipv6拢IPv6: - -``` sql -dictGetString('prefix', 'asn', tuple(IPv6StringToNum('2001:db8::1'))) -``` - -还不支持其他类型。 该函数返回与此IP地址对应的前缀的属性。 如果有重叠的前缀,则返回最具体的前缀。 - -数据存储在一个 `trie`. 它必须完全适合RAM。 - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md b/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md deleted file mode 100644 index 66ff7124ba1..00000000000 --- a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_lifetime.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 42 -toc_title: "\u5B57\u5178\u66F4\u65B0" ---- - -# 字典更新 {#dictionary-updates} - -ClickHouse定期更新字典。 完全下载字典的更新间隔和缓存字典的无效间隔在 `` 在几秒钟内标记。 - -字典更新(除首次使用的加载之外)不会阻止查询。 在更新期间,将使用旧版本的字典。 如果在更新过程中发生错误,则将错误写入服务器日志,并使用旧版本的字典继续查询。 - -设置示例: - -``` xml - - ... - 300 - ... - -``` - -``` sql -CREATE DICTIONARY (...) -... -LIFETIME(300) -... -``` - -设置 `0` (`LIFETIME(0)`)防止字典更新。 - -您可以设置升级的时间间隔,ClickHouse将在此范围内选择一个统一的随机时间。 为了在大量服务器上升级时分配字典源上的负载,这是必要的。 - -设置示例: - -``` xml - - ... - - 300 - 360 - - ... - -``` - -或 - -``` sql -LIFETIME(MIN 300 MAX 360) -``` - -升级字典时,ClickHouse服务器根据字典的类型应用不同的逻辑 [来源](external_dicts_dict_sources.md): - -- 对于文本文件,它检查修改的时间。 如果时间与先前记录的时间不同,则更新字典。 -- 对于MyISAM表,修改的时间使用检查 `SHOW TABLE STATUS` 查询。 -- 默认情况下,每次都会更新来自其他来源的字典。 - -对于MySQL(InnoDB),ODBC和ClickHouse源代码,您可以设置一个查询,只有在字典真正改变时才会更新字典,而不是每次都更新。 为此,请按照下列步骤操作: - -- 字典表必须具有在源数据更新时始终更改的字段。 -- 源的设置必须指定检索更改字段的查询。 ClickHouse服务器将查询结果解释为一行,如果此行相对于其以前的状态发生了更改,则更新字典。 指定查询 `` 字段中的设置 [来源](external_dicts_dict_sources.md). - -设置示例: - -``` xml - - ... - - ... - SELECT update_time FROM dictionary_source where id = 1 - - ... - -``` - -或 - -``` sql -... -SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source where id = 1')) -... -``` - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md b/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md deleted file mode 100644 index c8173749b33..00000000000 --- a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md +++ /dev/null @@ -1,608 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 43 -toc_title: "\u5916\u90E8\u5B57\u5178\u7684\u6765\u6E90" ---- - -# 外部字典的来源 {#dicts-external-dicts-dict-sources} - -外部字典可以从许多不同的来源连接。 - -如果使用xml-file配置字典,则配置如下所示: - -``` xml - - - ... - - - - - - ... - - ... - -``` - -在情况下 [DDL-查询](../../statements/create.md#create-dictionary-query),相等的配置将看起来像: - -``` sql -CREATE DICTIONARY dict_name (...) -... -SOURCE(SOURCE_TYPE(param1 val1 ... paramN valN)) -- Source configuration -... -``` - -源配置在 `source` 科。 - -来源类型 (`source_type`): - -- [本地文件](#dicts-external_dicts_dict_sources-local_file) -- [可执行文件](#dicts-external_dicts_dict_sources-executable) -- [HTTP(s)](#dicts-external_dicts_dict_sources-http) -- DBMS - - [ODBC](#dicts-external_dicts_dict_sources-odbc) - - [MySQL](#dicts-external_dicts_dict_sources-mysql) - - [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse) - - [MongoDB](#dicts-external_dicts_dict_sources-mongodb) - - [Redis](#dicts-external_dicts_dict_sources-redis) - -## 本地文件 {#dicts-external_dicts_dict_sources-local_file} - -设置示例: - -``` xml - - - /opt/dictionaries/os.tsv - TabSeparated - - -``` - -或 - -``` sql -SOURCE(FILE(path '/opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -设置字段: - -- `path` – The absolute path to the file. -- `format` – The file format. All the formats described in “[格式](../../../interfaces/formats.md#formats)” 支持。 - -## 可执行文件 {#dicts-external_dicts_dict_sources-executable} - -使用可执行文件取决于 [字典如何存储在内存中](external_dicts_dict_layout.md). 如果字典存储使用 `cache` 和 `complex_key_cache`,ClickHouse通过向可执行文件的STDIN发送请求来请求必要的密钥。 否则,ClickHouse将启动可执行文件并将其输出视为字典数据。 - -设置示例: - -``` xml - - - cat /opt/dictionaries/os.tsv - TabSeparated - - -``` - -或 - -``` sql -SOURCE(EXECUTABLE(command 'cat /opt/dictionaries/os.tsv' format 'TabSeparated')) -``` - -设置字段: - -- `command` – The absolute path to the executable file, or the file name (if the program directory is written to `PATH`). -- `format` – The file format. All the formats described in “[格式](../../../interfaces/formats.md#formats)” 支持。 - -## Http(s) {#dicts-external_dicts_dict_sources-http} - -使用HTTP(s)服务器取决于 [字典如何存储在内存中](external_dicts_dict_layout.md). 如果字典存储使用 `cache` 和 `complex_key_cache`,ClickHouse通过通过发送请求请求必要的密钥 `POST` 方法。 - -设置示例: - -``` xml - - - http://[::1]/os.tsv - TabSeparated - - user - password - - -
- API-KEY - key -
-
-
- -``` - -或 - -``` sql -SOURCE(HTTP( - url 'http://[::1]/os.tsv' - format 'TabSeparated' - credentials(user 'user' password 'password') - headers(header(name 'API-KEY' value 'key')) -)) -``` - -为了让ClickHouse访问HTTPS资源,您必须 [配置openSSL](../../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-openssl) 在服务器配置中。 - -设置字段: - -- `url` – The source URL. -- `format` – The file format. All the formats described in “[格式](../../../interfaces/formats.md#formats)” 支持。 -- `credentials` – Basic HTTP authentication. Optional parameter. - - `user` – Username required for the authentication. - - `password` – Password required for the authentication. -- `headers` – All custom HTTP headers entries used for the HTTP request. Optional parameter. - - `header` – Single HTTP header entry. - - `name` – Identifiant name used for the header send on the request. - - `value` – Value set for a specific identifiant name. - -## ODBC {#dicts-external_dicts_dict_sources-odbc} - -您可以使用此方法连接具有ODBC驱动程序的任何数据库。 - -设置示例: - -``` xml - - - DatabaseName - ShemaName.TableName
- DSN=some_parameters - SQL_QUERY -
- -``` - -或 - -``` sql -SOURCE(ODBC( - db 'DatabaseName' - table 'SchemaName.TableName' - connection_string 'DSN=some_parameters' - invalidate_query 'SQL_QUERY' -)) -``` - -设置字段: - -- `db` – Name of the database. Omit it if the database name is set in the `` 参数。 -- `table` – Name of the table and schema if exists. -- `connection_string` – Connection string. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [更新字典](external_dicts_dict_lifetime.md). - -ClickHouse接收来自ODBC-driver的引用符号,并将查询中的所有设置引用到driver,因此有必要根据数据库中的表名大小写设置表名。 - -如果您在使用Oracle时遇到编码问题,请参阅相应的 [FAQ](../../../faq/general.md#oracle-odbc-encodings) 文章. - -### ODBC字典功能的已知漏洞 {#known-vulnerability-of-the-odbc-dictionary-functionality} - -!!! attention "注意" - 通过ODBC驱动程序连接参数连接到数据库时 `Servername` 可以取代。 在这种情况下,值 `USERNAME` 和 `PASSWORD` 从 `odbc.ini` 被发送到远程服务器,并且可能会受到损害。 - -**不安全使用示例** - -让我们为PostgreSQL配置unixODBC。 的内容 `/etc/odbc.ini`: - -``` text -[gregtest] -Driver = /usr/lib/psqlodbca.so -Servername = localhost -PORT = 5432 -DATABASE = test_db -#OPTION = 3 -USERNAME = test -PASSWORD = test -``` - -如果然后进行查询,例如 - -``` sql -SELECT * FROM odbc('DSN=gregtest;Servername=some-server.com', 'test_db'); -``` - -ODBC驱动程序将发送的值 `USERNAME` 和 `PASSWORD` 从 `odbc.ini` 到 `some-server.com`. - -### 连接Postgresql的示例 {#example-of-connecting-postgresql} - -Ubuntu操作系统。 - -为PostgreSQL安装unixODBC和ODBC驱动程序: - -``` bash -$ sudo apt-get install -y unixodbc odbcinst odbc-postgresql -``` - -配置 `/etc/odbc.ini` (或 `~/.odbc.ini`): - -``` text - [DEFAULT] - Driver = myconnection - - [myconnection] - Description = PostgreSQL connection to my_db - Driver = PostgreSQL Unicode - Database = my_db - Servername = 127.0.0.1 - UserName = username - Password = password - Port = 5432 - Protocol = 9.3 - ReadOnly = No - RowVersioning = No - ShowSystemTables = No - ConnSettings = -``` - -ClickHouse中的字典配置: - -``` xml - - - table_name - - - - - DSN=myconnection - postgresql_table
-
- - - 300 - 360 - - - - - - - id - - - some_column - UInt64 - 0 - - -
-
-``` - -或 - -``` sql -CREATE DICTIONARY table_name ( - id UInt64, - some_column UInt64 DEFAULT 0 -) -PRIMARY KEY id -SOURCE(ODBC(connection_string 'DSN=myconnection' table 'postgresql_table')) -LAYOUT(HASHED()) -LIFETIME(MIN 300 MAX 360) -``` - -您可能需要编辑 `odbc.ini` 使用驱动程序指定库的完整路径 `DRIVER=/usr/local/lib/psqlodbcw.so`. - -### 连接MS SQL Server的示例 {#example-of-connecting-ms-sql-server} - -Ubuntu操作系统。 - -安装驱动程序: : - -``` bash -$ sudo apt-get install tdsodbc freetds-bin sqsh -``` - -配置驱动程序: - -``` bash - $ cat /etc/freetds/freetds.conf - ... - - [MSSQL] - host = 192.168.56.101 - port = 1433 - tds version = 7.0 - client charset = UTF-8 - - $ cat /etc/odbcinst.ini - ... - - [FreeTDS] - Description = FreeTDS - Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so - Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so - FileUsage = 1 - UsageCount = 5 - - $ cat ~/.odbc.ini - ... - - [MSSQL] - Description = FreeTDS - Driver = FreeTDS - Servername = MSSQL - Database = test - UID = test - PWD = test - Port = 1433 -``` - -在ClickHouse中配置字典: - -``` xml - - - test - - - dict
- DSN=MSSQL;UID=test;PWD=test -
- - - - 300 - 360 - - - - - - - - - k - - - s - String - - - -
-
-``` - -或 - -``` sql -CREATE DICTIONARY test ( - k UInt64, - s String DEFAULT '' -) -PRIMARY KEY k -SOURCE(ODBC(table 'dict' connection_string 'DSN=MSSQL;UID=test;PWD=test')) -LAYOUT(FLAT()) -LIFETIME(MIN 300 MAX 360) -``` - -## DBMS {#dbms} - -### Mysql {#dicts-external_dicts_dict_sources-mysql} - -设置示例: - -``` xml - - - 3306 - clickhouse - qwerty - - example01-1 - 1 - - - example01-2 - 1 - - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -或 - -``` sql -SOURCE(MYSQL( - port 3306 - user 'clickhouse' - password 'qwerty' - replica(host 'example01-1' priority 1) - replica(host 'example01-2' priority 1) - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -设置字段: - -- `port` – The port on the MySQL server. You can specify it for all replicas, or for each one individually (inside ``). - -- `user` – Name of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `password` – Password of the MySQL user. You can specify it for all replicas, or for each one individually (inside ``). - -- `replica` – Section of replica configurations. There can be multiple sections. - - - `replica/host` – The MySQL host. - - `replica/priority` – The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority. - -- `db` – Name of the database. - -- `table` – Name of the table. - -- `where` – The selection criteria. The syntax for conditions is the same as for `WHERE` 例如,mysql中的子句, `id > 10 AND id < 20`. 可选参数。 - -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [更新字典](external_dicts_dict_lifetime.md). - -MySQL可以通过套接字在本地主机上连接。 要做到这一点,设置 `host` 和 `socket`. - -设置示例: - -``` xml - - - localhost - /path/to/socket/file.sock - clickhouse - qwerty - db_name - table_name
- id=10 - SQL_QUERY -
- -``` - -或 - -``` sql -SOURCE(MYSQL( - host 'localhost' - socket '/path/to/socket/file.sock' - user 'clickhouse' - password 'qwerty' - db 'db_name' - table 'table_name' - where 'id=10' - invalidate_query 'SQL_QUERY' -)) -``` - -### ClickHouse {#dicts-external_dicts_dict_sources-clickhouse} - -设置示例: - -``` xml - - - example01-01-1 - 9000 - default - - default - ids
- id=10 -
- -``` - -或 - -``` sql -SOURCE(CLICKHOUSE( - host 'example01-01-1' - port 9000 - user 'default' - password '' - db 'default' - table 'ids' - where 'id=10' -)) -``` - -设置字段: - -- `host` – The ClickHouse host. If it is a local host, the query is processed without any network activity. To improve fault tolerance, you can create a [分布](../../../engines/table_engines/special/distributed.md) 表并在后续配置中输入它。 -- `port` – The port on the ClickHouse server. -- `user` – Name of the ClickHouse user. -- `password` – Password of the ClickHouse user. -- `db` – Name of the database. -- `table` – Name of the table. -- `where` – The selection criteria. May be omitted. -- `invalidate_query` – Query for checking the dictionary status. Optional parameter. Read more in the section [更新字典](external_dicts_dict_lifetime.md). - -### Mongodb {#dicts-external_dicts_dict_sources-mongodb} - -设置示例: - -``` xml - - - localhost - 27017 - - - test - dictionary_source - - -``` - -或 - -``` sql -SOURCE(MONGO( - host 'localhost' - port 27017 - user '' - password '' - db 'test' - collection 'dictionary_source' -)) -``` - -设置字段: - -- `host` – The MongoDB host. -- `port` – The port on the MongoDB server. -- `user` – Name of the MongoDB user. -- `password` – Password of the MongoDB user. -- `db` – Name of the database. -- `collection` – Name of the collection. - -### Redis {#dicts-external_dicts_dict_sources-redis} - -设置示例: - -``` xml - - - localhost - 6379 - simple - 0 - - -``` - -或 - -``` sql -SOURCE(REDIS( - host 'localhost' - port 6379 - storage_type 'simple' - db_index 0 -)) -``` - -设置字段: - -- `host` – The Redis host. -- `port` – The port on the Redis server. -- `storage_type` – The structure of internal Redis storage using for work with keys. `simple` 适用于简单源和散列单键源, `hash_map` 用于具有两个键的散列源。 不支持具有复杂键的范围源和缓存源。 可以省略,默认值为 `simple`. -- `db_index` – The specific numeric index of Redis logical database. May be omitted, default value is 0. - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) diff --git a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md b/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md deleted file mode 100644 index 0ac0226aa50..00000000000 --- a/docs/zh/sql_reference/dictionaries/external_dictionaries/external_dicts_dict_structure.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 44 -toc_title: "\u5B57\u5178\u952E\u548C\u5B57\u6BB5" ---- - -# 字典键和字段 {#dictionary-key-and-fields} - -该 `` 子句描述可用于查询的字典键和字段。 - -XML描述: - -``` xml - - - - Id - - - - - - - ... - - - -``` - -属性在元素中描述: - -- `` — [键列](external_dicts_dict_structure.md#ext_dict_structure-key). -- `` — [数据列](external_dicts_dict_structure.md#ext_dict_structure-attributes). 可以有多个属性。 - -DDL查询: - -``` sql -CREATE DICTIONARY dict_name ( - Id UInt64, - -- attributes -) -PRIMARY KEY Id -... -``` - -查询正文中描述了属性: - -- `PRIMARY KEY` — [键列](external_dicts_dict_structure.md#ext_dict_structure-key) -- `AttrName AttrType` — [数据列](external_dicts_dict_structure.md#ext_dict_structure-attributes). 可以有多个属性。 - -## 键 {#ext_dict_structure-key} - -ClickHouse支持以下类型的键: - -- 数字键。 `UInt64`. 在定义 `` 标记或使用 `PRIMARY KEY` 关键字。 -- 复合密钥。 组不同类型的值。 在标签中定义 `` 或 `PRIMARY KEY` 关键字。 - -Xml结构可以包含 `` 或 ``. DDL-查询必须包含单个 `PRIMARY KEY`. - -!!! warning "警告" - 不能将键描述为属性。 - -### 数字键 {#ext_dict-numeric-key} - -类型: `UInt64`. - -配置示例: - -``` xml - - Id - -``` - -配置字段: - -- `name` – The name of the column with keys. - -对于DDL-查询: - -``` sql -CREATE DICTIONARY ( - Id UInt64, - ... -) -PRIMARY KEY Id -... -``` - -- `PRIMARY KEY` – The name of the column with keys. - -### 复合密钥 {#composite-key} - -关键可以是一个 `tuple` 从任何类型的字段。 该 [布局](external_dicts_dict_layout.md) 在这种情况下,必须是 `complex_key_hashed` 或 `complex_key_cache`. - -!!! tip "提示" - 复合键可以由单个元素组成。 例如,这使得可以使用字符串作为键。 - -键结构在元素中设置 ``. 键字段的格式与字典的格式相同 [属性](external_dicts_dict_structure.md). 示例: - -``` xml - - - - field1 - String - - - field2 - UInt32 - - ... - -... -``` - -或 - -``` sql -CREATE DICTIONARY ( - field1 String, - field2 String - ... -) -PRIMARY KEY field1, field2 -... -``` - -对于查询 `dictGet*` 函数中,一个元组作为键传递。 示例: `dictGetString('dict_name', 'attr_name', tuple('string for field1', num_for_field2))`. - -## 属性 {#ext_dict_structure-attributes} - -配置示例: - -``` xml - - ... - - Name - ClickHouseDataType - - rand64() - true - true - true - - -``` - -或 - -``` sql -CREATE DICTIONARY somename ( - Name ClickHouseDataType DEFAULT '' EXPRESSION rand64() HIERARCHICAL INJECTIVE IS_OBJECT_ID -) -``` - -配置字段: - -| 标签 | 产品描述 | 必填项 | -|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------| -| `name` | 列名称。 | 是 | -| `type` | ClickHouse数据类型。
ClickHouse尝试将字典中的值转换为指定的数据类型。 例如,对于MySQL,该字段可能是 `TEXT`, `VARCHAR`,或 `BLOB` 在MySQL源表中,但它可以上传为 `String` 在克里克豪斯
[可为空](../../../sql_reference/data_types/nullable.md) 不支持。 | 是 | -| `null_value` | 非现有元素的默认值。
在示例中,它是一个空字符串。 你不能使用 `NULL` 在这个领域。 | 是 | -| `expression` | [表达式](../../syntax.md#syntax-expressions) ClickHouse对该值执行。
表达式可以是远程SQL数据库中的列名。 因此,您可以使用它为远程列创建别名。

默认值:无表达式。 | 非也。 | -| `hierarchical` | 如果 `true`,该属性包含当前键的父键值。 看 [分层字典](external_dicts_dict_hierarchical.md).

默认值: `false`. | 非也。 | -| `injective` | 标志,显示是否 `id -> attribute` 图像是 [注射](https://en.wikipedia.org/wiki/Injective_function).
如果 `true`,ClickHouse可以自动放置后 `GROUP BY` 子句注入字典的请求。 通常它显着减少了这种请求的数量。

默认值: `false`. | 非也。 | -| `is_object_id` | 显示是否通过以下方式对MongoDB文档执行查询的标志 `ObjectID`.

默认值: `false`. | 非也。 | - -## 另请参阅 {#see-also} - -- [使用外部字典的函数](../../../sql_reference/functions/ext_dict_functions.md). - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) diff --git a/docs/zh/sql_reference/dictionaries/index.md b/docs/zh/sql_reference/dictionaries/index.md deleted file mode 100644 index 9c9817ad0ad..00000000000 --- a/docs/zh/sql_reference/dictionaries/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_folder_title: "\u5B57\u5178" -toc_priority: 35 -toc_title: "\u5BFC\u8A00" ---- - -# 字典 {#dictionaries} - -字典是一个映射 (`key -> attributes`)这是方便各种类型的参考清单。 - -ClickHouse支持使用可用于查询的字典的特殊功能。 这是更容易和更有效地使用字典与功能比 `JOIN` 与参考表。 - -[NULL](../syntax.md#null) 值不能存储在字典中。 - -ClickHouse支持: - -- [内置字典](internal_dicts.md#internal_dicts) 具有特定的 [功能集](../../sql_reference/functions/ym_dict_functions.md). -- [插件(外部)字典](external_dictionaries/external_dicts.md) 用一个 [职能净额](../../sql_reference/functions/ext_dict_functions.md). - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/) diff --git a/docs/zh/sql_reference/dictionaries/internal_dicts.md b/docs/zh/sql_reference/dictionaries/internal_dicts.md deleted file mode 100644 index bcede3c14ad..00000000000 --- a/docs/zh/sql_reference/dictionaries/internal_dicts.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 39 -toc_title: "\u5185\u90E8\u5B57\u5178" ---- - -# 内部字典 {#internal_dicts} - -ClickHouse包含用于处理地理数据库的内置功能。 - -这使您可以: - -- 使用区域的ID以所需语言获取其名称。 -- 使用区域ID获取城市、地区、联邦区、国家或大陆的ID。 -- 检查一个区域是否属于另一个区域。 -- 获取父区域链。 - -所有功能支持 “translocality,” 能够同时使用不同的角度对区域所有权。 有关详细信息,请参阅部分 “Functions for working with Yandex.Metrica dictionaries”. - -在默认包中禁用内部字典。 -要启用它们,请取消注释参数 `path_to_regions_hierarchy_file` 和 `path_to_regions_names_files` 在服务器配置文件中。 - -Geobase从文本文件加载。 - -将 `regions_hierarchy*.txt` 文件到 `path_to_regions_hierarchy_file` 目录。 此配置参数必须包含指向 `regions_hierarchy.txt` 文件(默认区域层次结构)和其他文件 (`regions_hierarchy_ua.txt`)必须位于同一目录中。 - -把 `regions_names_*.txt` 在文件 `path_to_regions_names_files` 目录。 - -您也可以自己创建这些文件。 文件格式如下: - -`regions_hierarchy*.txt`:TabSeparated(无标题),列: - -- 地区ID (`UInt32`) -- 父区域ID (`UInt32`) -- 区域类型 (`UInt8`):1-大陆,3-国家,4-联邦区,5-地区,6-城市;其他类型没有价值 -- 人口 (`UInt32`) — optional column - -`regions_names_*.txt`:TabSeparated(无标题),列: - -- 地区ID (`UInt32`) -- 地区名称 (`String`) — Can't contain tabs or line feeds, even escaped ones. - -平面阵列用于存储在RAM中。 出于这个原因,Id不应该超过一百万。 - -字典可以在不重新启动服务器的情况下更新。 但是,不会更新可用字典集。 -对于更新,将检查文件修改时间。 如果文件已更改,则更新字典。 -检查更改的时间间隔在 `builtin_dictionaries_reload_interval` 参数。 -字典更新(首次使用时加载除外)不会阻止查询。 在更新期间,查询使用旧版本的字典。 如果在更新过程中发生错误,则将错误写入服务器日志,并使用旧版本的字典继续查询。 - -我们建议定期使用geobase更新字典。 在更新期间,生成新文件并将其写入单独的位置。 一切准备就绪后,将其重命名为服务器使用的文件。 - -还有与操作系统标识符和Yandex的工作功能。Metrica搜索引擎,但他们不应该被使用。 - -[原始文章](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) diff --git a/docs/zh/sql_reference/functions/arithmetic_functions.md b/docs/zh/sql_reference/functions/arithmetic_functions.md deleted file mode 100644 index 66bd42ec63a..00000000000 --- a/docs/zh/sql_reference/functions/arithmetic_functions.md +++ /dev/null @@ -1,77 +0,0 @@ - -# 算术函数 {#suan-zhu-han-shu} - -对于所有算术函数,结果类型为结果适合的最小数字类型(如果存在这样的类型)。最小数字类型是根据数字的位数,是否有符号以及是否是浮点类型而同时进行的。如果没有足够的位,则采用最高位类型。 - -例如: - -``` sql -SELECT toTypeName(0), toTypeName(0 + 0), toTypeName(0 + 0 + 0), toTypeName(0 + 0 + 0 + 0) -``` - - ┌─toTypeName(0)─┬─toTypeName(plus(0, 0))─┬─toTypeName(plus(plus(0, 0), 0))─┬─toTypeName(plus(plus(plus(0, 0), 0), 0))─┐ - │ UInt8 │ UInt16 │ UInt32 │ UInt64 │ - └───────────────┴────────────────────────┴─────────────────────────────────┴──────────────────────────────────────────┘ - -算术函数适用于UInt8,UInt16,UInt32,UInt64,Int8,Int16,Int32,Int64,Float32或Float64中的任何类型。 - -溢出的产生方式与C++相同。 - -## 加(a,b),a+b {#plusa-b-a-b} - -计算数字的总和。 -您还可以将Date或DateTime与整数进行相加。在Date的情况下,添加的整数意味着添加相应的天数。对于DateTime,这意味这添加相应的描述。 - -## 减(a,b),a-b {#minusa-b-a-b} - -计算数字之间的差,结果总是有符号的。 - -您还可以将Date或DateTime与整数进行相减。见上面的'plus'。 - -## 乘(a,b),a\*b {#multiplya-b-a-b} - -计算数字的乘积。 - -## 除以(a,b),a/b {#dividea-b-a-b} - -计算数字的商。结果类型始终是浮点类型。 -它不是整数除法。对于整数除法,请使用'intDiv'函数。 -当除以零时,你得到'inf',‘- inf’或’nan’。 - -## intDiv(a,b) {#intdiva-b} - -计算整数数字的商,向下舍入(按绝对值)。 -除以零或将最小负数除以-1时抛出异常。 - -## intDivOrZero(a,b) {#intdivorzeroa-b} - -与'intDiv'的不同之处在于它在除以零或将最小负数除以-1时返回零。 - -## 模(a,b),a%b {#moduloa-b-a-b} - -计算除法后的余数。 -如果参数是浮点数,则通过删除小数部分将它们预转换为整数。 -其余部分与C++中的含义相同。截断除法用于负数。 -除以零或将最小负数除以-1时抛出异常。 - -## 否定(a),-a {#negatea-a} - -计算一个数字的 -用反转符号计算一个数字。结果始终是签名的。 -计算具有反向符号的数字。 结果始终签名。 - -## abs(a) {#arithm_func-abs} - -计算数字(a)的绝对值。也就是说,如果a &lt; 0,它返回-a。对于无符号类型,它不执行任何操作。对于有符号整数类型,它返回无符号数。 - -## gcd(a,b) {#gcda-b} - -返回数字的最大公约数。 -除以零或将最小负数除以-1时抛出异常。 - -## lcm(a,b) {#lcma-b} - -返回数字的最小公倍数。 -除以零或将最小负数除以-1时抛出异常。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) diff --git a/docs/zh/sql_reference/functions/array_functions.md b/docs/zh/sql_reference/functions/array_functions.md deleted file mode 100644 index cb8f7347b72..00000000000 --- a/docs/zh/sql_reference/functions/array_functions.md +++ /dev/null @@ -1,666 +0,0 @@ - -# 数组函数 {#shu-zu-han-shu} - -## 空 {#empty} - -对于空数组返回1,对于非空数组返回0。 -结果类型是UInt8。 -该函数也适用于字符串。 - -## notEmpty {#notempty} - -对于空数组返回0,对于非空数组返回1。 -结果类型是UInt8。 -该函数也适用于字符串。 - -## 长度 {#array_functions-length} - -返回数组中的元素个数。 -结果类型是UInt64。 -该函数也适用于字符串。 - -## emptyArrayUInt8,emptyArrayUInt16,emptyArrayUInt32,emptyArrayUInt64 {#emptyarrayuint8-emptyarrayuint16-emptyarrayuint32-emptyarrayuint64} - -## emptyArrayInt8,emptyArrayInt16,emptyArrayInt32,emptyArrayInt64 {#emptyarrayint8-emptyarrayint16-emptyarrayint32-emptyarrayint64} - -## emptyArrayFloat32,emptyArrayFloat64 {#emptyarrayfloat32-emptyarrayfloat64} - -## 空空漫步,空空漫步时间 {#emptyarraydate-emptyarraydatetime} - -## 空字符串 {#emptyarraystring} - -不接受任何参数并返回适当类型的空数组。 - -## emptyArrayToSingle {#emptyarraytosingle} - -接受一个空数组并返回一个仅包含一个默认值元素的数组。 - -## 范围(N) {#rangen} - -返回从0到N-1的数字数组。 -以防万一,如果在数据块中创建总长度超过100,000,000个元素的数组,则抛出异常。 - -## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1} - -使用函数的参数作为数组元素创建一个数组。 -参数必须是常量,并且具有最小公共类型的类型。必须至少传递一个参数,否则将不清楚要创建哪种类型的数组。也就是说,你不能使用这个函数来创建一个空数组(为此,使用上面描述的'emptyArray  \*'函数)。 -返回'Array(T)'类型的结果,其中'T'是传递的参数中最小的公共类型。 - -## arrayConcat {#arrayconcat} - -合并参数中传递的所有数组。 - - arrayConcat(arrays) - -**参数** - -- `arrays` – 任意数量的[阵列](../../sql_reference/functions/array_functions.md)类型的参数. - **示例** - - - -``` sql -SELECT arrayConcat([1, 2], [3, 4], [5, 6]) AS res -``` - - ┌─res───────────┐ - │ [1,2,3,4,5,6] │ - └───────────────┘ - -## arrayElement(arr,n),运算符arr\[n\] {#arrayelementarr-n-operator-arrn} - -从数组`arr`中获取索引为«n»的元素。 `n`必须是任何整数类型。 -数组中的索引从一开始。 -支持负索引。在这种情况下,它选择从末尾开始编号的相应元素。例如,`arr [-1]`是数组中的最后一项。 - -如果索引超出数组的边界,则返回默认值(数字为0,字符串为空字符串等)。 - -## 有(arr,elem) {#hasarr-elem} - -检查'arr'数组是否具有'elem'元素。 -如果元素不在数组中,则返回0;如果在,则返回1。 - -`NULL` 值的处理。 - - SELECT has([1, 2, NULL], NULL) - - ┌─has([1, 2, NULL], NULL)─┐ - │ 1 │ - └─────────────────────────┘ - -## hasAll {#hasall} - -检查一个数组是否是另一个数组的子集。 - - hasAll(set, subset) - -**参数** - -- `set` – 具有一组元素的任何类型的数组。 -- `subset` – 任何类型的数组,其元素应该被测试为`set`的子集。 - -**返回值** - -- `1`, 如果`set`包含`subset`中的所有元素。 -- `0`, 否则。 - -**特殊的定义** - -- 空数组是任何数组的子集。 -- «Null»作为数组中的元素值进行处理。 -- 忽略两个数组中的元素值的顺序。 - -**示例** - -`SELECT hasAll([], [])` 返回1。 - -`SELECT hasAll([1, Null], [Null])` 返回1。 - -`SELECT hasAll([1.0, 2, 3, 4], [1, 3])` 返回1。 - -`SELECT hasAll(['a', 'b'], ['a'])` 返回1。 - -`SELECT hasAll([1], ['a'])` 返回0。 - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])` 返回0。 - -## hasAny {#hasany} - -检查两个数组是否存在交集。 - - hasAny(array1, array2) - -**参数** - -- `array1` – 具有一组元素的任何类型的数组。 -- `array2` – 具有一组元素的任何类型的数组。 - -**返回值** - -- `1`, 如果`array1`和`array2`存在交集。 -- `0`, 否则。 - -**特殊的定义** - -- «Null»作为数组中的元素值进行处理。 -- 忽略两个数组中的元素值的顺序。 - -**示例** - -`SELECT hasAny([1], [])` 返回 `0`. - -`SELECT hasAny([Null], [Null, 1])` 返回 `1`. - -`SELECT hasAny([-128, 1., 512], [1])` 返回 `1`. - -`SELECT hasAny([[1, 2], [3, 4]], ['a', 'c'])` 返回 `0`. - -`SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [1, 2]])` 返回 `1`. - -## indexOf(arr,x) {#indexofarr-x} - -返回数组中第一个'x'元素的索引(从1开始),如果'x'元素不存在在数组中,则返回0。 - -示例: - - :) SELECT indexOf([1,3,NULL,NULL],NULL) - - SELECT indexOf([1, 3, NULL, NULL], NULL) - - ┌─indexOf([1, 3, NULL, NULL], NULL)─┐ - │ 3 │ - └───────────────────────────────────┘ - -设置为«NULL»的元素将作为普通的元素值处理。 - -## countEqual(arr,x) {#countequalarr-x} - -返回数组中等于x的元素的个数。相当于arrayCount(elem - \> elem = x,arr)。 - -`NULL`值将作为单独的元素值处理。 - -示例: - - SELECT countEqual([1, 2, NULL, NULL], NULL) - - ┌─countEqual([1, 2, NULL, NULL], NULL)─┐ - │ 2 │ - └──────────────────────────────────────┘ - -## ツ暗ェツ氾环催ツ団ツ法ツ人) {#array_functions-arrayenumerate} - -返回 Array \[1, 2, 3, …, length (arr) \] - -此功能通常与ARRAY JOIN一起使用。它允许在应用ARRAY JOIN后为每个数组计算一次。例如: - -``` sql -SELECT - count() AS Reaches, - countIf(num = 1) AS Hits -FROM test.hits -ARRAY JOIN - GoalsReached, - arrayEnumerate(GoalsReached) AS num -WHERE CounterID = 160656 -LIMIT 10 -``` - - ┌─Reaches─┬──Hits─┐ - │ 95606 │ 31406 │ - └─────────┴───────┘ - -在此示例中,Reaches是转换次数(应用ARRAY JOIN后接收的字符串),Hits是浏览量(ARRAY JOIN之前的字符串)。在这种特殊情况下,您可以更轻松地获得相同的结果: - -``` sql -SELECT - sum(length(GoalsReached)) AS Reaches, - count() AS Hits -FROM test.hits -WHERE (CounterID = 160656) AND notEmpty(GoalsReached) -``` - - ┌─Reaches─┬──Hits─┐ - │ 95606 │ 31406 │ - └─────────┴───────┘ - -此功能也可用于高阶函数。例如,您可以使用它来获取与条件匹配的元素的数组索引。 - -## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr} - -返回与源数组大小相同的数组,其中每个元素表示与其下标对应的源数组元素在源数组中出现的次数。 -例如:arrayEnumerateUniq( \[10,20,10,30 \])=  \[1,1,2,1 \]。 - -使用ARRAY JOIN和数组元素的聚合时,此函数很有用。 - -示例: - -``` sql -SELECT - Goals.ID AS GoalID, - sum(Sign) AS Reaches, - sumIf(Sign, num = 1) AS Visits -FROM test.visits -ARRAY JOIN - Goals, - arrayEnumerateUniq(Goals.ID) AS num -WHERE CounterID = 160656 -GROUP BY GoalID -ORDER BY Reaches DESC -LIMIT 10 -``` - - ┌──GoalID─┬─Reaches─┬─Visits─┐ - │ 53225 │ 3214 │ 1097 │ - │ 2825062 │ 3188 │ 1097 │ - │ 56600 │ 2803 │ 488 │ - │ 1989037 │ 2401 │ 365 │ - │ 2830064 │ 2396 │ 910 │ - │ 1113562 │ 2372 │ 373 │ - │ 3270895 │ 2262 │ 812 │ - │ 1084657 │ 2262 │ 345 │ - │ 56599 │ 2260 │ 799 │ - │ 3271094 │ 2256 │ 812 │ - └─────────┴─────────┴────────┘ - -在此示例中,每个GoalID都计算转换次数(目标嵌套数据结构中的每个元素都是达到的目标,我们称之为转换)和会话数。如果没有ARRAY JOIN,我们会将会话数计为总和(Sign)。但在这种特殊情况下,行乘以嵌套的Goals结构,因此为了在此之后计算每个会话一次,我们将一个条件应用于arrayEnumerateUniq(Goals.ID)函数的值。 - -arrayEnumerateUniq函数可以使用与参数大小相同的多个数组。在这种情况下,对于所有阵列中相同位置的元素元组,考虑唯一性。 - -``` sql -SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]) AS res -``` - - ┌─res───────────┐ - │ [1,2,1,1,2,1] │ - └───────────────┘ - -当使用带有嵌套数据结构的ARRAY JOIN并在此结构中跨多个元素进一步聚合时,这是必需的。 - -## arrayPopBack {#arraypopback} - -从数组中删除最后一项。 - - arrayPopBack(array) - -**参数** - -- `array` – 数组。 - -**示例** - -``` sql -SELECT arrayPopBack([1, 2, 3]) AS res -``` - - ┌─res───┐ - │ [1,2] │ - └───────┘ - -## arrayPopFront {#arraypopfront} - -从数组中删除第一项。 - - arrayPopFront(array) - -**参数** - -- `array` – 数组。 - -**示例** - -``` sql -SELECT arrayPopFront([1, 2, 3]) AS res -``` - - ┌─res───┐ - │ [2,3] │ - └───────┘ - -## arrayPushBack {#arraypushback} - -添加一个元素到数组的末尾。 - - arrayPushBack(array, single_value) - -**参数** - -- `array` – 数组。 -- `single_value` – 单个值。只能将数字添加到带数字的数组中,并且只能将字符串添加到字符串数组中。添加数字时,ClickHouse会自动为数组的数据类型设置`single_value`类型。有关ClickHouse中数据类型的更多信息,请参阅«[数据类型](../../sql_reference/functions/array_functions.md#data_types)»。可以是'NULL`。该函数向数组添加一个«NULL»元素,数组元素的类型转换为`Nullable\`。 - -**示例** - -``` sql -SELECT arrayPushBack(['a'], 'b') AS res -``` - - ┌─res───────┐ - │ ['a','b'] │ - └───────────┘ - -## arrayPushFront {#arraypushfront} - -将一个元素添加到数组的开头。 - - arrayPushFront(array, single_value) - -**参数** - -- `array` – 数组。 -- `single_value` – 单个值。只能将数字添加到带数字的数组中,并且只能将字符串添加到字符串数组中。添加数字时,ClickHouse会自动为数组的数据类型设置`single_value`类型。有关ClickHouse中数据类型的更多信息,请参阅«[数据类型](../../sql_reference/functions/array_functions.md#data_types)»。可以是'NULL`。该函数向数组添加一个«NULL»元素,数组元素的类型转换为`Nullable\`。 - -**示例** - -``` sql -SELECT arrayPushFront(['b'], 'a') AS res -``` - - ┌─res───────┐ - │ ['a','b'] │ - └───────────┘ - -## arrayResize {#arrayresize} - -更改数组的长度。 - - arrayResize(array, size[, extender]) - -**参数:** - -- `array` — 数组. -- `size` — 数组所需的长度。 - - 如果`size`小于数组的原始大小,则数组将从右侧截断。 -- 如果`size`大于数组的初始大小,则使用`extender`值或数组项的数据类型的默认值将数组扩展到右侧。 -- `extender` — 扩展数组的值。可以是'NULL\`。 - -**返回值:** - -一个`size`长度的数组。 - -**调用示例** - - SELECT arrayResize([1], 3) - - ┌─arrayResize([1], 3)─┐ - │ [1,0,0] │ - └─────────────────────┘ - - SELECT arrayResize([1], 3, NULL) - - ┌─arrayResize([1], 3, NULL)─┐ - │ [1,NULL,NULL] │ - └───────────────────────────┘ - -## arraySlice {#arrayslice} - -返回一个子数组,包含从指定位置的指定长度的元素。 - - arraySlice(array, offset[, length]) - -**参数** - -- `array` – 数组。 -- `offset` – 数组的偏移。正值表示左侧的偏移量,负值表示右侧的缩进值。数组下标从1开始。 -- `length` - 子数组的长度。如果指定负值,则该函数返回`[offset,array_length - length`。如果省略该值,则该函数返回`[offset,the_end_of_array]`。 - -**示例** - -``` sql -SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res -``` - - ┌─res────────┐ - │ [2,NULL,4] │ - └────────────┘ - -设置为«NULL»的数组元素作为普通的数组元素值处理。 - -## arraySort(\[func,\] arr, …) {#array_functions-reverse-sort} - -以升序对`arr`数组的元素进行排序。如果指定了`func`函数,则排序顺序由`func`函数的调用结果决定。如果`func`接受多个参数,那么`arraySort`函数也将解析与`func`函数参数相同数量的数组参数。更详细的示例在`arraySort`的末尾。 - -整数排序示例: - -``` sql -SELECT arraySort([1, 3, 3, 0]); -``` - - ┌─arraySort([1, 3, 3, 0])─┐ - │ [0,1,3,3] │ - └─────────────────────────┘ - -字符串排序示例: - -``` sql -SELECT arraySort(['hello', 'world', '!']); -``` - - ┌─arraySort(['hello', 'world', '!'])─┐ - │ ['!','hello','world'] │ - └────────────────────────────────────┘ - -`NULL`,`NaN`和`Inf`的排序顺序: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]); -``` - - ┌─arraySort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf])─┐ - │ [-inf,-4,1,2,3,inf,nan,nan,NULL,NULL] │ - └───────────────────────────────────────────────────────────┘ - -- `-Inf` 是数组中的第一个。 -- `NULL` 是数组中的最后一个。 -- `NaN` 在`NULL`的前面。 -- `Inf` 在`NaN`的前面。 - -注意:`arraySort`是[高阶函数](higher_order_functions.md)。您可以将lambda函数作为第一个参数传递给它。在这种情况下,排序顺序由lambda函数的调用结果决定。 - -让我们来看一下如下示例: - -``` sql -SELECT arraySort((x) -> -x, [1, 2, 3]) as res; -``` - - ┌─res─────┐ - │ [3,2,1] │ - └─────────┘ - -对于源数组的每个元素,lambda函数返回排序键,即\[1 -\> -1, 2 -\> -2, 3 -\> -3\]。由于`arraySort`函数按升序对键进行排序,因此结果为\[3,2,1\]。因此,`(x) -> -x` lambda函数将排序设置为[降序](#array_functions-reverse-sort)。 - -lambda函数可以接受多个参数。在这种情况下,您需要为`arraySort`传递与lambda参数个数相同的数组。函数使用第一个输入的数组中的元素组成返回结果;使用接下来传入的数组作为排序键。例如: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - - ┌─res────────────────┐ - │ ['world', 'hello'] │ - └────────────────────┘ - -这里,在第二个数组(\[2, 1\])中定义了第一个数组(\[‘hello’,‘world’\])的相应元素的排序键,即\[‘hello’ -\> 2,‘world’ -\> 1\]。 由于lambda函数中没有使用`x`,因此源数组中的实际值不会影响结果的顺序。所以,'world'将是结果中的第一个元素,'hello'将是结果中的第二个元素。 - -其他示例如下所示。 - -``` sql -SELECT arraySort((x, y) -> y, [0, 1, 2], ['c', 'b', 'a']) as res; -``` - -``` sql -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -``` sql -SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res; -``` - -``` sql -┌─res─────┐ -│ [2,1,0] │ -└─────────┘ -``` - -!!! 注意 "注意" - 为了提高排序效率, 使用了[施瓦茨变换](https://en.wikipedia.org/wiki/Schwartzian_transform)。 - -## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort} - -以降序对`arr`数组的元素进行排序。如果指定了`func`函数,则排序顺序由`func`函数的调用结果决定。如果`func`接受多个参数,那么`arrayReverseSort`函数也将解析与`func`函数参数相同数量的数组作为参数。更详细的示例在`arrayReverseSort`的末尾。 - -整数排序示例: - -``` sql -SELECT arrayReverseSort([1, 3, 3, 0]); -``` - - ┌─arrayReverseSort([1, 3, 3, 0])─┐ - │ [3,3,1,0] │ - └────────────────────────────────┘ - -字符串排序示例: - -``` sql -SELECT arrayReverseSort(['hello', 'world', '!']); -``` - - ┌─arrayReverseSort(['hello', 'world', '!'])─┐ - │ ['world','hello','!'] │ - └───────────────────────────────────────────┘ - -`NULL`,`NaN`和`Inf`的排序顺序: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, -4, NULL, inf, -inf]) as res; -``` - -``` sql -┌─res───────────────────────────────────┐ -│ [inf,3,2,1,-4,-inf,nan,nan,NULL,NULL] │ -└───────────────────────────────────────┘ -``` - -- `Inf` 是数组中的第一个。 -- `NULL` 是数组中的最后一个。 -- `NaN` 在`NULL`的前面。 -- `-Inf` 在`NaN`的前面。 - -注意:`arraySort`是[高阶函数](higher_order_functions.md)。您可以将lambda函数作为第一个参数传递给它。如下示例所示。 - -``` sql -SELECT arrayReverseSort((x) -> -x, [1, 2, 3]) as res; -``` - - ┌─res─────┐ - │ [1,2,3] │ - └─────────┘ - -数组按以下方式排序: -数组按以下方式排序: - -1. 首先,根据lambda函数的调用结果对源数组(\[1, 2, 3\])进行排序。 结果是\[3, 2, 1\]。 -2. 反转上一步获得的数组。 所以,最终的结果是\[1, 2, 3\]。 - -lambda函数可以接受多个参数。在这种情况下,您需要为`arrayReverseSort`传递与lambda参数个数相同的数组。函数使用第一个输入的数组中的元素组成返回结果;使用接下来传入的数组作为排序键。例如: - -``` sql -SELECT arrayReverseSort((x, y) -> y, ['hello', 'world'], [2, 1]) as res; -``` - -``` sql -┌─res───────────────┐ -│ ['hello','world'] │ -└───────────────────┘ -``` - -在这个例子中,数组按以下方式排序: - -1. 首先,根据lambda函数的调用结果对源数组(\[‘hello’,‘world’\])进行排序。 其中,在第二个数组(\[2,1\])中定义了源数组中相应元素的排序键。 所以,排序结果\[‘world’,‘hello’\]。 -2. 反转上一步骤中获得的排序数组。 所以,最终的结果是\[‘hello’,‘world’\]。 - -其他示例如下所示。 - -``` sql -SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', 'b', 'c']) AS res; -``` - -``` sql -┌─res─────┐ -│ [5,3,4] │ -└─────────┘ -``` - -``` sql -SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res; -``` - -``` sql -┌─res─────┐ -│ [4,3,5] │ -└─────────┘ -``` - -## arrayUniq(arr, …) {#arrayuniqarr} - -如果传递一个参数,则计算数组中不同元素的数量。 -如果传递了多个参数,则它计算多个数组中相应位置的不同元素元组的数量。 - -如果要获取数组中唯一项的列表,可以使用arrayReduce(‘groupUniqArray’,arr)。 - -## arryjoin(arr) {#array-functions-join} - -一个特殊的功能。请参见[«ArrayJoin函数»](array_join.md#functions_arrayjoin)部分。 - -## arrayDifference(arr) {#arraydifferencearr} - -返回一个数组,其中包含所有相邻元素对之间的差值。例如: - -``` sql -SELECT arrayDifference([1, 2, 3, 4]) -``` - - ┌─arrayDifference([1, 2, 3, 4])─┐ - │ [0,1,1,1] │ - └───────────────────────────────┘ - -## arrayDistinct(arr) {#arraydistinctarr} - -返回一个包含所有数组中不同元素的数组。例如: - -``` sql -SELECT arrayDistinct([1, 2, 2, 3, 1]) -``` - - ┌─arrayDistinct([1, 2, 2, 3, 1])─┐ - │ [1,2,3] │ - └────────────────────────────────┘ - -## arrayEnumerateDense(arr) {#arrayenumeratedensearr} - -返回与源数组大小相同的数组,指示每个元素首次出现在源数组中的位置。例如:arrayEnumerateDense(\[10,20,10,30\])= \[1,2,1,3\]。 - -## arrayIntersect(arr) {#arrayintersectarr} - -返回所有数组元素的交集。例如: - -``` sql -SELECT - arrayIntersect([1, 2], [1, 3], [2, 3]) AS no_intersect, - arrayIntersect([1, 2], [1, 3], [1, 4]) AS intersect -``` - - ┌─no_intersect─┬─intersect─┐ - │ [] │ [1] │ - └──────────────┴───────────┘ - -## arrayReduce(agg\_func, arr1, …) {#arrayreduceagg-func-arr1} - -将聚合函数应用于数组并返回其结果。如果聚合函数具有多个参数,则此函数可应用于相同大小的多个数组。 - -arrayReduce(‘agg\_func’,arr1,…) - 将聚合函数`agg_func`应用于数组`arr1 ...`。如果传递了多个数组,则相应位置上的元素将作为多个参数传递给聚合函数。例如:SELECT arrayReduce(‘max’,\[1,2,3\])= 3 - -## ツ暗ェツ氾环催ツ団ツ法ツ人) {#arrayreversearr} - -返回与源数组大小相同的数组,包含反转源数组的所有元素的结果。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) diff --git a/docs/zh/sql_reference/functions/array_join.md b/docs/zh/sql_reference/functions/array_join.md deleted file mode 100644 index 1788b44f3e5..00000000000 --- a/docs/zh/sql_reference/functions/array_join.md +++ /dev/null @@ -1,29 +0,0 @@ - -# arrayJoin函数 {#functions_arrayjoin} - -这是一个非常有用的函数。 - -普通函数不会更改结果集的行数,而只是计算每行中的值(map)。 -聚合函数将多行压缩到一行中(fold或reduce)。 -'arrayJoin'函数获取每一行并将他们展开到多行(unfold)。 - -此函数将数组作为参数,并将该行在结果集中复制数组元素个数。 -除了应用此函数的列中的值之外,简单地复制列中的所有值;它被替换为相应的数组值。 - -查询可以使用多个`arrayJoin`函数。在这种情况下,转换被执行多次。 - -请注意SELECT查询中的ARRAY JOIN语法,它提供了更广泛的可能性。 - -示例: - -``` sql -SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src -``` - - ┌─dst─┬─\'Hello\'─┬─src─────┐ - │ 1 │ Hello │ [1,2,3] │ - │ 2 │ Hello │ [1,2,3] │ - │ 3 │ Hello │ [1,2,3] │ - └─────┴───────────┴─────────┘ - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/array_join/) diff --git a/docs/zh/sql_reference/functions/bit_functions.md b/docs/zh/sql_reference/functions/bit_functions.md deleted file mode 100644 index 1b280c8babd..00000000000 --- a/docs/zh/sql_reference/functions/bit_functions.md +++ /dev/null @@ -1,30 +0,0 @@ - -# 位操作函数 {#wei-cao-zuo-han-shu} - -位操作函数适用于UInt8,UInt16,UInt32,UInt64,Int8,Int16,Int32,Int64,Float32或Float64中的任何类型。 - -结果类型是一个整数,其位数等于其参数的最大位。如果至少有一个参数为有符数字,则结果为有符数字。如果参数是浮点数,则将其强制转换为Int64。 - -## bitAnd(a,b) {#bitanda-b} - -## bitOr(a,b) {#bitora-b} - -## bitXor(a,b) {#bitxora-b} - -## bitNot(a) {#bitnota} - -## bitShiftLeft(a,b) {#bitshiftlefta-b} - -## bitShiftRight(a,b) {#bitshiftrighta-b} - -## bitRotateLeft(a,b) {#bitrotatelefta-b} - -## bitRotateRight(a,b) {#bitrotaterighta-b} - -## bitTest(a,b) {#bittesta-b} - -## bitTestAll(a,b) {#bittestalla-b} - -## bitTestAny(a,b) {#bittestanya-b} - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) diff --git a/docs/zh/sql_reference/functions/bitmap_functions.md b/docs/zh/sql_reference/functions/bitmap_functions.md deleted file mode 100644 index 3415b590644..00000000000 --- a/docs/zh/sql_reference/functions/bitmap_functions.md +++ /dev/null @@ -1,385 +0,0 @@ - -# 位图函数 {#wei-tu-han-shu} - -位图函数用于对两个位图对象进行计算,对于任何一个位图函数,它都将返回一个位图对象,例如and,or,xor,not等等。 - -位图对象有两种构造方法。一个是由聚合函数groupBitmapState构造的,另一个是由Array Object构造的。同时还可以将位图对象转化为数组对象。 - -我们使用RoaringBitmap实际存储位图对象,当基数小于或等于32时,它使用Set保存。当基数大于32时,它使用RoaringBitmap保存。这也是为什么低基数集的存储更快的原因。 - -有关RoaringBitmap的更多信息,请参阅:[呻吟声](https://github.com/RoaringBitmap/CRoaring)。 - -## bitmapBuild {#bitmapbuild} - -从无符号整数数组构建位图对象。 - - bitmapBuild(array) - -**参数** - -- `array` – 无符号整数数组. - -**示例** - -``` sql -SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res -``` - -## bitmapToArray {#bitmaptoarray} - -将位图转换为整数数组。 - - bitmapToArray(bitmap) - -**参数** - -- `bitmap` – 位图对象. - -**示例** - -``` sql -SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─────────┐ - │ [1,2,3,4,5] │ - └─────────────┘ - -## bitmapSubsetInRange {#bitmapsubsetinrange} - -将位图指定范围(不包含range\_end)转换为另一个位图。 - - bitmapSubsetInRange(bitmap, range_start, range_end) - -**参数** - -- `bitmap` – 位图对象. -- `range_start` – 范围起始点(含). -- `range_end` – 范围结束点(不含). - -**示例** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - - ┌─res───────────────┐ - │ [30,31,32,33,100] │ - └───────────────────┘ - -## bitmapSubsetLimit {#bitmapsubsetlimit} - -将位图指定范围(起始点和数目上限)转换为另一个位图。 - - bitmapSubsetLimit(bitmap, range_start, limit) - -**参数** - -- `bitmap` – 位图对象. -- `range_start` – 范围起始点(含). -- `limit` – 子位图基数上限. - -**示例** - -``` sql -SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res -``` - - ┌─res───────────────────────┐ - │ [30,31,32,33,100,200,500] │ - └───────────────────────────┘ - -## bitmapContains {#bitmapcontains} - -检查位图是否包含指定元素。 - - bitmapContains(haystack, needle) - -**参数** - -- `haystack` – 位图对象. -- `needle` – 元素,类型UInt32. - -**示例** - -``` sql -SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## bitmapHasAny {#bitmaphasany} - -与`hasAny(array,array)`类似,如果位图有任何公共元素则返回1,否则返回0。 -对于空位图,返回0。 - - bitmapHasAny(bitmap,bitmap) - -**参数** - -- `bitmap` – bitmap对象。 - -**示例** - -``` sql -SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapHasAll {#bitmaphasall} - -与`hasAll(array,array)`类似,如果第一个位图包含第二个位图的所有元素,则返回1,否则返回0。 -如果第二个参数是空位图,则返回1。 - - bitmapHasAll(bitmap,bitmap) - -**参数** - -- `bitmap` – bitmap 对象。 - -**示例** - -``` sql -SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res -``` - - ┌─res─┐ - │ 0 │ - └─────┘ - -## 位图和 {#bitmapand} - -为两个位图对象进行与操作,返回一个新的位图对象。 - - bitmapAnd(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - - ┌─res─┐ - │ [3] │ - └─────┘ - -## 位图 {#bitmapor} - -为两个位图对象进行或操作,返回一个新的位图对象。 - - bitmapOr(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - - ┌─res─────────┐ - │ [1,2,3,4,5] │ - └─────────────┘ - -## bitmapXor {#bitmapxor} - -为两个位图对象进行异或操作,返回一个新的位图对象。 - - bitmapXor(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - - ┌─res───────┐ - │ [1,2,4,5] │ - └───────────┘ - -## bitmapAndnot {#bitmapandnot} - -计算两个位图的差异,返回一个新的位图对象。 - - bitmapAndnot(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res -``` - - ┌─res───┐ - │ [1,2] │ - └───────┘ - -## bitmapCardinality {#bitmapcardinality} - -返回一个UInt64类型的数值,表示位图对象的基数。 - - bitmapCardinality(bitmap) - -**参数** - -- `bitmap` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## bitmapMin {#bitmapmin} - -返回一个UInt64类型的数值,表示位图中的最小值。如果位图为空则返回UINT32\_MAX。 - - bitmapMin(bitmap) - -**参数** - -- `bitmap` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapMax {#bitmapmax} - -返回一个UInt64类型的数值,表示位图中的最大值。如果位图为空则返回0。 - - bitmapMax(bitmap) - -**参数** - -- `bitmap` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## 位图和标准性 {#bitmapandcardinality} - -为两个位图对象进行与操作,返回结果位图的基数。 - - bitmapAndCardinality(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapAndCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - - ┌─res─┐ - │ 1 │ - └─────┘ - -## bitmapOrCardinality {#bitmaporcardinality} - -为两个位图进行或运算,返回结果位图的基数。 - - bitmapOrCardinality(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapOrCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - - ┌─res─┐ - │ 5 │ - └─────┘ - -## bitmapXorCardinality {#bitmapxorcardinality} - -为两个位图进行异或运算,返回结果位图的基数。 - - bitmapXorCardinality(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` – 位图对象。 - -**示例** - -``` sql -SELECT bitmapXorCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - - ┌─res─┐ - │ 4 │ - └─────┘ - -## 位图和非标准性 {#bitmapandnotcardinality} - -计算两个位图的差异,返回结果位图的基数。 - - bitmapAndnotCardinality(bitmap1,bitmap2) - -**参数** - -- `bitmap1` – 位图对象。 -- `bitmap2` - 位图对象。 - -**示例** - -``` sql -SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res; -``` - - ┌─res─┐ - │ 2 │ - └─────┘ - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) diff --git a/docs/zh/sql_reference/functions/comparison_functions.md b/docs/zh/sql_reference/functions/comparison_functions.md deleted file mode 100644 index a73d983f386..00000000000 --- a/docs/zh/sql_reference/functions/comparison_functions.md +++ /dev/null @@ -1,33 +0,0 @@ - -# 比较函数 {#bi-jiao-han-shu} - -比较函数始终返回0或1(UInt8)。 - -可以比较以下类型: - -- 数字 -- String 和 FixedString -- 日期 -- 日期时间 - -以上每个组内的类型均可互相比较,但是对于不同组的类型间不能够进行比较。 - -例如,您无法将日期与字符串进行比较。您必须使用函数将字符串转换为日期,反之亦然。 - -字符串按字节进行比较。较短的字符串小于以其开头并且至少包含一个字符的所有字符串。 - -注意。直到1.1.54134版本,有符号和无符号数字的比较方式与C++相同。换句话说,在SELECT 9223372036854775807 &gt; -1 等情况下,您可能会得到错误的结果。 此行为在版本1.1.54134中已更改,现在在数学上是正确的。 - -## 等于,a=b和a==b运算符 {#equals-a-b-and-a-b-operator} - -## notEquals,a! 运算符=b和a `<>` b {#notequals-a-operator-b-and-a-b} - -## 少, `< operator` {#less-operator} - -## 更大, `> operator` {#greater-operator} - -## 出租等级, `<= operator` {#lessorequals-operator} - -## 伟大的等级, `>= operator` {#greaterorequals-operator} - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) diff --git a/docs/zh/sql_reference/functions/conditional_functions.md b/docs/zh/sql_reference/functions/conditional_functions.md deleted file mode 100644 index d9721fa3f60..00000000000 --- a/docs/zh/sql_reference/functions/conditional_functions.md +++ /dev/null @@ -1,45 +0,0 @@ - -# 条件函数 {#tiao-jian-han-shu} - -## 如果(cond,那么,否则),cond? 运算符然后:else {#ifcond-then-else-cond-operator-then-else} - -如果`cond != 0`则返回`then`,如果`cond = 0`则返回`else`。 -`cond`必须是`UInt8`类型,`then`和`else`必须存在最低的共同类型。 - -`then`和`else`可以是`NULL` - -## 多 {#multiif} - -允许您在查询中更紧凑地编写[CASE](../operators.md#operator_case)运算符。 - - multiIf(cond_1, then_1, cond_2, then_2...else) - -**参数:** - -- `cond_N` — 函数返回`then_N`的条件。 -- `then_N` — 执行时函数的结果。 -- `else` — 如果没有满足任何条件,则为函数的结果。 - -该函数接受`2N + 1`参数。 - -**返回值** - -该函数返回值«then\_N»或«else»之一,具体取决于条件`cond_N`。 - -**示例** - -存在如下一张表 - - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 2 │ 3 │ - └───┴──────┘ - -执行查询 `SELECT multiIf(isNull(y) x, y < 3, y, NULL) FROM t_null`。结果: - - ┌─multiIf(isNull(y), x, less(y, 3), y, NULL)─┐ - │ 1 │ - │ ᴺᵁᴸᴸ │ - └────────────────────────────────────────────┘ - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/zh/sql_reference/functions/date_time_functions.md b/docs/zh/sql_reference/functions/date_time_functions.md deleted file mode 100644 index ca974f563db..00000000000 --- a/docs/zh/sql_reference/functions/date_time_functions.md +++ /dev/null @@ -1,293 +0,0 @@ - -# 时间日期函数 {#shi-jian-ri-qi-han-shu} - -支持时区。 - -所有的时间日期函数都可以在第二个可选参数中接受时区参数。示例:Asia / Yekaterinburg。在这种情况下,它们使用指定的时区而不是本地(默认)时区。 - -``` sql -SELECT - toDateTime('2016-06-15 23:00:00') AS time, - toDate(time) AS date_local, - toDate(time, 'Asia/Yekaterinburg') AS date_yekat, - toString(time, 'US/Samoa') AS time_samoa -``` - - ┌────────────────time─┬─date_local─┬─date_yekat─┬─time_samoa──────────┐ - │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-16 │ 2016-06-15 09:00:00 │ - └─────────────────────┴────────────┴────────────┴─────────────────────┘ - -仅支持与UTC相差一整小时的时区。 - -## toTimeZone {#totimezone} - -将Date或DateTime转换为指定的时区。 - -## 玩一年 {#toyear} - -将Date或DateTime转换为包含年份编号(AD)的UInt16类型的数字。 - -## 到四分钟 {#toquarter} - -将Date或DateTime转换为包含季度编号的UInt8类型的数字。 - -## toMonth {#tomonth} - -将Date或DateTime转换为包含月份编号(1-12)的UInt8类型的数字。 - -## 今天一年 {#todayofyear} - -将Date或DateTime转换为包含一年中的某一天的编号的UInt16(1-366)类型的数字。 - -## 今天月 {#todayofmonth} - -将Date或DateTime转换为包含一月中的某一天的编号的UInt8(1-31)类型的数字。 - -## 今天一周 {#todayofweek} - -将Date或DateTime转换为包含一周中的某一天的编号的UInt8(周一是1, 周日是7)类型的数字。 - -## toHour {#tohour} - -将DateTime转换为包含24小时制(0-23)小时数的UInt8数字。 -这个函数假设如果时钟向前移动,它是一个小时,发生在凌晨2点,如果时钟被移回,它是一个小时,发生在凌晨3点(这并非总是如此 - 即使在莫斯科时钟在不同的时间两次改变)。 - -## toMinute {#tominute} - -将DateTime转换为包含一小时中分钟数(0-59)的UInt8数字。 - -## 秒 {#tosecond} - -将DateTime转换为包含一分钟中秒数(0-59)的UInt8数字。 -闰秒不计算在内。 - -## toUnixTimestamp {#tounixtimestamp} - -将DateTime转换为unix时间戳。 - -## 开始一年 {#tostartofyear} - -将Date或DateTime向前取整到本年的第一天。 -返回Date类型。 - -## 今年开始 {#tostartofisoyear} - -将Date或DateTime向前取整到ISO本年的第一天。 -返回Date类型。 - -## 四分之一开始 {#tostartofquarter} - -将Date或DateTime向前取整到本季度的第一天。 -返回Date类型。 - -## 到月份开始 {#tostartofmonth} - -将Date或DateTime向前取整到本月的第一天。 -返回Date类型。 - -!!! 注意 "注意" -     解析不正确日期的行为是特定于实现的。 ClickHouse可能会返回零日期,抛出异常或执行«natural»溢出。 - -## toMonday {#tomonday} - -将Date或DateTime向前取整到本周的星期一。 -返回Date类型。 - -## 今天开始 {#tostartofday} - -将DateTime向前取整到当日的开始。 - -## 开始一小时 {#tostartofhour} - -将DateTime向前取整到当前小时的开始。 - -## to startofminute {#tostartofminute} - -将DateTime向前取整到当前分钟的开始。 - -## to startoffiveminute {#tostartoffiveminute} - -将DateTime以五分钟为单位向前取整到最接近的时间点。 - -## 开始分钟 {#tostartoftenminutes} - -将DateTime以十分钟为单位向前取整到最接近的时间点。 - -## 开始几分钟 {#tostartoffifteenminutes} - -将DateTime以十五分钟为单位向前取整到最接近的时间点。 - -## toStartOfInterval(time\_or\_data,间隔x单位\[,time\_zone\]) {#tostartofintervaltime-or-data-interval-x-unit-time-zone} - -这是名为`toStartOf*`的所有函数的通用函数。例如, -`toStartOfInterval(t,INTERVAL 1 year)`返回与`toStartOfYear(t)`相同的结果, -`toStartOfInterval(t,INTERVAL 1 month)`返回与`toStartOfMonth(t)`相同的结果, -`toStartOfInterval(t,INTERVAL 1 day)`返回与`toStartOfDay(t)`相同的结果, -`toStartOfInterval(t,INTERVAL 15 minute)`返回与`toStartOfFifteenMinutes(t)`相同的结果。 - -## toTime {#totime} - -将DateTime中的日期转换为一个固定的日期,同时保留时间部分。 - -## toRelativeYearNum {#torelativeyearnum} - -将Date或DateTime转换为年份的编号,从过去的某个固定时间点开始。 - -## toRelativeQuarterNum {#torelativequarternum} - -将Date或DateTime转换为季度的数字,从过去的某个固定时间点开始。 - -## toRelativeMonthNum {#torelativemonthnum} - -将Date或DateTime转换为月份的编号,从过去的某个固定时间点开始。 - -## toRelativeWeekNum {#torelativeweeknum} - -将Date或DateTime转换为星期数,从过去的某个固定时间点开始。 - -## toRelativeDayNum {#torelativedaynum} - -将Date或DateTime转换为当天的编号,从过去的某个固定时间点开始。 - -## toRelativeHourNum {#torelativehournum} - -将DateTime转换为小时数,从过去的某个固定时间点开始。 - -## toRelativeMinuteNum {#torelativeminutenum} - -将DateTime转换为分钟数,从过去的某个固定时间点开始。 - -## toRelativeSecondNum {#torelativesecondnum} - -将DateTime转换为秒数,从过去的某个固定时间点开始。 - -## toISOYear {#toisoyear} - -将Date或DateTime转换为包含ISO年份的UInt16类型的编号。 - -## toISOWeek {#toisoweek} - -将Date或DateTime转换为包含ISO周数的UInt8类型的编号。 - -## 现在 {#now} - -不接受任何参数并在请求执行时的某一刻返回当前时间(DateTime)。 -此函数返回一个常量,即时请求需要很长时间能够完成。 - -## 今天 {#today} - -不接受任何参数并在请求执行时的某一刻返回当前日期(Date)。 -其功能与'toDate(now())'相同。 - -## 昨天 {#yesterday} - -不接受任何参数并在请求执行时的某一刻返回昨天的日期(Date)。 -其功能与'today() - 1'相同。 - -## 时隙 {#timeslot} - -将时间向前取整半小时。 -此功能用于Yandex.Metrica,因为如果跟踪标记显示单个用户的连续综合浏览量在时间上严格超过此数量,则半小时是将会话分成两个会话的最短时间。这意味着(tag id,user id,time slot)可用于搜索相应会话中包含的综合浏览量。 - -## toyyymm {#toyyyymm} - -将Date或DateTime转换为包含年份和月份编号的UInt32类型的数字(YYYY \* 100 + MM)。 - -## toyyymmdd {#toyyyymmdd} - -将Date或DateTime转换为包含年份和月份编号的UInt32类型的数字(YYYY \* 10000 + MM \* 100 + DD)。 - -## toYYYYMMDDhhmmss {#toyyyymmddhhmmss} - -将Date或DateTime转换为包含年份和月份编号的UInt64类型的数字(YYYY \* 10000000000 + MM \* 100000000 + DD \* 1000000 + hh \* 10000 + mm \* 100 + ss)。 - -## 隆隆隆隆路虏脢,,陇,貌,垄拢卢虏禄quar陇,貌路,隆拢脳枚脢虏,麓脢,脱,,,录,禄庐戮,utes, {#addyears-addmonths-addweeks-adddays-addhours-addminutes-addseconds-addquarters} - -函数将一段时间间隔添加到Date/DateTime,然后返回Date/DateTime。例如: - -``` sql -WITH - toDate('2018-01-01') AS date, - toDateTime('2018-01-01 00:00:00') AS date_time -SELECT - addYears(date, 1) AS add_years_with_date, - addYears(date_time, 1) AS add_years_with_date_time -``` - - ┌─add_years_with_date─┬─add_years_with_date_time─┐ - │ 2019-01-01 │ 2019-01-01 00:00:00 │ - └─────────────────────┴──────────────────────────┘ - -## subtractYears,subtractMonths,subtractWeeks,subtractDays,subtractours,subtractMinutes,subtractSeconds,subtractQuarters {#subtractyears-subtractmonths-subtractweeks-subtractdays-subtracthours-subtractminutes-subtractseconds-subtractquarters} - -函数将Date/DateTime减去一段时间间隔,然后返回Date/DateTime。例如: - -``` sql -WITH - toDate('2019-01-01') AS date, - toDateTime('2019-01-01 00:00:00') AS date_time -SELECT - subtractYears(date, 1) AS subtract_years_with_date, - subtractYears(date_time, 1) AS subtract_years_with_date_time -``` - - ┌─subtract_years_with_date─┬─subtract_years_with_date_time─┐ - │ 2018-01-01 │ 2018-01-01 00:00:00 │ - └──────────────────────────┴───────────────────────────────┘ - -## dateDiff(‘unit’,t1,t2,\[时区\]) {#datediffunit-t1-t2-timezone} - -返回以'unit'为单位表示的两个时间之间的差异,例如`'hours'`。 ‘t1’和’t2’可以是Date或DateTime,如果指定’timezone’,它将应用于两个参数。如果不是,则使用来自数据类型't1'和't2'的时区。如果时区不相同,则结果将是未定义的。 - -支持的单位值: - -| 单位 | -|------| -| 第二 | -| 分钟 | -| 小时 | -| 日 | -| 周 | -| 月 | -| 季 | -| 年 | - -## 时隙(开始时间,持续时间,\[,大小\]) {#timeslotsstarttime-duration-size} - -它返回一个时间数组,其中包括从从«StartTime»开始到«StartTime + Duration 秒»内的所有符合«size»(以秒为单位)步长的时间点。其中«size»是一个可选参数,默认为1800。 -例如,`timeSlots(toDateTime('2012-01-01 12:20:00'),600) = [toDateTime('2012-01-01 12:00:00'),toDateTime('2012-01-01 12:30:00' )]`。 -这对于搜索在相应会话中综合浏览量是非常有用的。 - -## formatDateTime(时间,格式\[,时区\]) {#formatdatetimetime-format-timezone} - -函数根据给定的格式字符串来格式化时间。请注意:格式字符串必须是常量表达式,例如:单个结果列不能有多种格式字符串。 - -支持的格式修饰符: -(«Example» 列是对`2018-01-02 22:33:44`的格式化结果) - -| 修饰符 | 产品描述 | 示例 | -|--------|-------------------------------------------|------------| -| %C | 年除以100并截断为整数(00-99) | 20 | -| %d | 月中的一天,零填充(01-31) | 02 | -| %D | 短MM/DD/YY日期,相当于%m/%d/%y | 01/02/2018 | -| %e | 月中的一天,空格填充(1-31) | 2 | -| %F | 短YYYY-MM-DD日期,相当于%Y-%m-%d | 2018-01-02 | -| %H | 24小时格式(00-23) | 22 | -| %I | 小时12h格式(01-12) | 10 | -| %j | 一年(001-366) | 002 | -| %m | 月份为十进制数(01-12) | 01 | -| %M | 分钟(00-59) | 33 | -| %n | 换行符(") | | -| %p | AM或PM指定 | PM | -| %R | 24小时HH:MM时间,相当于%H:%M | 22:33 | -| %S | 第二(00-59) | 44 | -| %t | 水平制表符(') | | -| %T | ISO8601时间格式(HH:MM:SS),相当于%H:%M:%S | 22:33:44 | -| %u | ISO8601平日as编号,星期一为1(1-7) | 2 | -| %V | ISO8601周编号(01-53) | 01 | -| %w | 周日为十进制数,周日为0(0-6) | 2 | -| %y | 年份,最后两位数字(00-99) | 18 | -| %Y | 年 | 2018 | -| %% | %符号 | % | - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) diff --git a/docs/zh/sql_reference/functions/encoding_functions.md b/docs/zh/sql_reference/functions/encoding_functions.md deleted file mode 100644 index 42d10c4408f..00000000000 --- a/docs/zh/sql_reference/functions/encoding_functions.md +++ /dev/null @@ -1,29 +0,0 @@ - -# 编码函数 {#bian-ma-han-shu} - -## hex {#hex} - -接受`String`,`unsigned integer`,`Date`或`DateTime`类型的参数。返回包含参数的十六进制表示的字符串。使用大写字母`A-F`。不使用`0x`前缀或`h`后缀。对于字符串,所有字节都简单地编码为两个十六进制数字。数字转换为大端(«易阅读»)格式。对于数字,去除其中较旧的零,但仅限整个字节。例如,`hex(1)='01'`。 `Date`被编码为自Unix时间开始以来的天数。 `DateTime`编码为自Unix时间开始以来的秒数。 - -## unhex(str) {#unhexstr} - -接受包含任意数量的十六进制数字的字符串,并返回包含相应字节的字符串。支持大写和小写字母A-F。十六进制数字的数量不必是偶数。如果是奇数,则最后一位数被解释为00-0F字节的低位。如果参数字符串包含除十六进制数字以外的任何内容,则返回一些实现定义的结果(不抛出异常)。 -如果要将结果转换为数字,可以使用«reverse»和«reinterpretAsType»函数。 - -## UUIDStringToNum(str) {#uuidstringtonumstr} - -接受包含36个字符的字符串,格式为«123e4567-e89b-12d3-a456-426655440000»,并将其转化为FixedString(16)返回。 - -## UUIDNumToString(str) {#uuidnumtostringstr} - -接受FixedString(16)值。返回包含36个字符的文本格式的字符串。 - -## 位掩码列表(num) {#bitmasktolistnum} - -接受一个整数。返回一个字符串,其中包含一组2的幂列表,其列表中的所有值相加等于这个整数。列表使用逗号分割,按升序排列。 - -## 位掩码阵列(num) {#bitmasktoarraynum} - -接受一个整数。返回一个UInt64类型数组,其中包含一组2的幂列表,其列表中的所有值相加等于这个整数。数组中的数字按升序排列。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) diff --git a/docs/zh/sql_reference/functions/ext_dict_functions.md b/docs/zh/sql_reference/functions/ext_dict_functions.md deleted file mode 100644 index 23077618722..00000000000 --- a/docs/zh/sql_reference/functions/ext_dict_functions.md +++ /dev/null @@ -1,47 +0,0 @@ - -# 字典函数 {#zi-dian-han-shu} - -有关连接和配置外部词典的信息,请参阅[外部词典](../../sql_reference/functions/ext_dict_functions.md)。 - -## dictGetUInt8,dictGetUInt16,dictGetUInt32,dictGetUInt64 {#dictgetuint8-dictgetuint16-dictgetuint32-dictgetuint64} - -## dictGetInt8,dictGetInt16,dictGetInt32,dictGetInt64 {#dictgetint8-dictgetint16-dictgetint32-dictgetint64} - -## dictGetFloat32,dictGetFloat64 {#dictgetfloat32-dictgetfloat64} - -## dictGetDate,dictGetDateTime {#dictgetdate-dictgetdatetime} - -## dictgetuid {#dictgetuuid} - -## dictGetString {#dictgetstring} - -`dictGetT('dict_name', 'attr_name', id)` - -- 使用'id'键获取dict\_name字典中attr\_name属性的值。`dict_name`和`attr_name`是常量字符串。`id`必须是UInt64。 - 如果字典中没有`id`键,则返回字典描述中指定的默认值。 - -## dictGetTOrDefault {#ext_dict_functions-dictgettordefault} - -`dictGetTOrDefault('dict_name', 'attr_name', id, default)` - -与`dictGetT`函数相同,但默认值取自函数的最后一个参数。 - -## dictIsIn {#dictisin} - -`dictIsIn ('dict_name', child_id, ancestor_id)` - -- 对于'dict\_name'分层字典,查找'child\_id'键是否位于'ancestor\_id'内(或匹配'ancestor\_id')。返回UInt8。 - -## 独裁主义 {#dictgethierarchy} - -`dictGetHierarchy('dict_name', id)` - -- 对于'dict\_name'分层字典,返回从'id'开始并沿父元素链继续的字典键数组。返回Array(UInt64) - -## dictHas {#dicthas} - -`dictHas('dict_name', id)` - -- 检查字典是否存在指定的`id`。如果不存在,则返回0;如果存在,则返回1。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) diff --git a/docs/zh/sql_reference/functions/functions_for_nulls.md b/docs/zh/sql_reference/functions/functions_for_nulls.md deleted file mode 100644 index 9252d8bfeb0..00000000000 --- a/docs/zh/sql_reference/functions/functions_for_nulls.md +++ /dev/null @@ -1,253 +0,0 @@ - -# Nullable处理函数 {#nullablechu-li-han-shu} - -## isNull {#isnull} - -检查参数是否为[NULL](../syntax.md#null)。 - - isNull(x) - -**参数** - -- `x` — 一个非复合数据类型的值。 - -**返回值** - -- `1` 如果`x`为`NULL`。 -- `0` 如果`x`不为`NULL`。 - -**示例** - -存在以下内容的表 - - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 2 │ 3 │ - └───┴──────┘ - -对其进行查询 - - :) SELECT x FROM t_null WHERE isNull(y) - - SELECT x - FROM t_null - WHERE isNull(y) - - ┌─x─┐ - │ 1 │ - └───┘ - - 1 rows in set. Elapsed: 0.010 sec. - -## isNotNull {#isnotnull} - -检查参数是否不为 [NULL](../syntax.md#null). - - isNotNull(x) - -**参数:** - -- `x` — 一个非复合数据类型的值。 - -**返回值** - -- `0` 如果`x`为`NULL`。 -- `1` 如果`x`不为`NULL`。 - -**示例** - -存在以下内容的表 - - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 2 │ 3 │ - └───┴──────┘ - -对其进行查询 - - :) SELECT x FROM t_null WHERE isNotNull(y) - - SELECT x - FROM t_null - WHERE isNotNull(y) - - ┌─x─┐ - │ 2 │ - └───┘ - - 1 rows in set. Elapsed: 0.010 sec. - -## 合并 {#coalesce} - -检查从左到右是否传递了«NULL»参数并返回第一个非`'NULL`参数。 - - coalesce(x,...) - -**参数:** - -- 任何数量的非复合类型的参数。所有参数必须与数据类型兼容。 - -**返回值** - -- 第一个非'NULL\`参数。 -- `NULL`,如果所有参数都是'NULL\`。 - -**示例** - -考虑可以指定多种联系客户的方式的联系人列表。 - - ┌─name─────┬─mail─┬─phone─────┬──icq─┐ - │ client 1 │ ᴺᵁᴸᴸ │ 123-45-67 │ 123 │ - │ client 2 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ - └──────────┴──────┴───────────┴──────┘ - -`mail`和`phone`字段是String类型,但`icq`字段是`UInt32`,所以它需要转换为`String`。 - -从联系人列表中获取客户的第一个可用联系方式: - - :) SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook - - SELECT coalesce(mail, phone, CAST(icq, 'Nullable(String)')) - FROM aBook - - ┌─name─────┬─coalesce(mail, phone, CAST(icq, 'Nullable(String)'))─┐ - │ client 1 │ 123-45-67 │ - │ client 2 │ ᴺᵁᴸᴸ │ - └──────────┴──────────────────────────────────────────────────────┘ - - 2 rows in set. Elapsed: 0.006 sec. - -## ifNull {#ifnull} - -如果第一个参数为«NULL»,则返回第二个参数的值。 - - ifNull(x,alt) - -**参数:** - -- `x` — 要检查«NULL»的值。 -- `alt` — 如果`x`为'NULL\`,函数返回的值。 - -**返回值** - -- 价值 `x`,如果 `x` 不是 `NULL`. -- 价值 `alt`,如果 `x` 是 `NULL`. - -**示例** - - SELECT ifNull('a', 'b') - - ┌─ifNull('a', 'b')─┐ - │ a │ - └──────────────────┘ - - SELECT ifNull(NULL, 'b') - - ┌─ifNull(NULL, 'b')─┐ - │ b │ - └───────────────────┘ - -## nullIf {#nullif} - -如果参数相等,则返回`NULL`。 - - nullIf(x, y) - -**参数:** - -`x`, `y` — 用于比较的值。 它们必须是类型兼容的,否则将抛出异常。 - -**返回值** - -- 如果参数相等,则为`NULL`。 -- 如果参数不相等,则为`x`值。 - -**示例** - - SELECT nullIf(1, 1) - - ┌─nullIf(1, 1)─┐ - │ ᴺᵁᴸᴸ │ - └──────────────┘ - - SELECT nullIf(1, 2) - - ┌─nullIf(1, 2)─┐ - │ 1 │ - └──────────────┘ - -## assumeNotNull {#assumenotnull} - -将[可为空](../../sql_reference/functions/functions_for_nulls.md)类型的值转换为非`Nullable`类型的值。 - - assumeNotNull(x) - -**参数:** - -- `x` — 原始值。 - -**返回值** - -- 如果`x`不为`NULL`,返回非`Nullable`类型的原始值。 -- 如果`x`为`NULL`,返回对应非`Nullable`类型的默认值。 - -**示例** - -存在如下`t_null`表。 - - SHOW CREATE TABLE t_null - - ┌─statement─────────────────────────────────────────────────────────────────┐ - │ CREATE TABLE default.t_null ( x Int8, y Nullable(Int8)) ENGINE = TinyLog │ - └───────────────────────────────────────────────────────────────────────────┘ - - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 2 │ 3 │ - └───┴──────┘ - -将列`y`作为`assumeNotNull`函数的参数。 - - SELECT assumeNotNull(y) FROM t_null - - ┌─assumeNotNull(y)─┐ - │ 0 │ - │ 3 │ - └──────────────────┘ - - SELECT toTypeName(assumeNotNull(y)) FROM t_null - - ┌─toTypeName(assumeNotNull(y))─┐ - │ Int8 │ - │ Int8 │ - └──────────────────────────────┘ - -## 可调整 {#tonullable} - -将参数的类型转换为`Nullable`。 - - toNullable(x) - -**参数:** - -- `x` — 任何非复合类型的值。 - -**返回值** - -- 输入的值,但其类型为`Nullable`。 - -**示例** - - SELECT toTypeName(10) - - ┌─toTypeName(10)─┐ - │ UInt8 │ - └────────────────┘ - - SELECT toTypeName(toNullable(10)) - - ┌─toTypeName(toNullable(10))─┐ - │ Nullable(UInt8) │ - └────────────────────────────┘ - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) diff --git a/docs/zh/sql_reference/functions/geo.md b/docs/zh/sql_reference/functions/geo.md deleted file mode 100644 index 3f6e6a3bb10..00000000000 --- a/docs/zh/sql_reference/functions/geo.md +++ /dev/null @@ -1,223 +0,0 @@ - -# GEO函数 {#geohan-shu} - -## 大圆形距离 {#greatcircledistance} - -使用[great-circle distance公式](https://en.wikipedia.org/wiki/Great-circle_distance)计算地球表面两点之间的距离。 - -``` sql -greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg) -``` - -**输入参数** - -- `lon1Deg` — 第一个点的经度,单位:度,范围: `[-180°, 180°]`。 -- `lat1Deg` — 第一个点的纬度,单位:度,范围: `[-90°, 90°]`。 -- `lon2Deg` — 第二个点的经度,单位:度,范围: `[-180°, 180°]`。 -- `lat2Deg` — 第二个点的纬度,单位:度,范围: `[-90°, 90°]`。 - -正值对应北纬和东经,负值对应南纬和西经。 - -**返回值** - -地球表面的两点之间的距离,以米为单位。 - -当输入参数值超出规定的范围时将抛出异常。 - -**示例** - -``` sql -SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) -``` - -``` text -┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐ -│ 14132374.194975413 │ -└───────────────────────────────────────────────────────────────────┘ -``` - -## 尖尖的人 {#pointinellipses} - -检查指定的点是否至少包含在指定的一个椭圆中。 -下述中的坐标是几何图形在笛卡尔坐标系中的位置。 - -``` sql -pointInEllipses(x, y, x₀, y₀, a₀, b₀,...,xₙ, yₙ, aₙ, bₙ) -``` - -**输入参数** - -- `x, y` — 平面上某个点的坐标。 -- `xᵢ, yᵢ` — 第i个椭圆的中心坐标。 -- `aᵢ, bᵢ` — 以x, y坐标为单位的第i个椭圆的轴。 - -输入参数的个数必须是`2+4⋅n`,其中`n`是椭圆的数量。 - -**返回值** - -如果该点至少包含在一个椭圆中,则返回`1`;否则,则返回`0`。 - -**示例** - -``` sql -SELECT pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1.0, 2.0) -``` - -``` text -┌─pointInEllipses(55.755831, 37.617673, 55.755831, 37.617673, 1., 2.)─┐ -│ 1 │ -└─────────────────────────────────────────────────────────────────────┘ -``` - -## pointInPolygon {#pointinpolygon} - -检查指定的点是否包含在指定的多边形中。 - -``` sql -pointInPolygon((x, y), [(a, b), (c, d) ...], ...) -``` - -**输入参数** - -- `(x, y)` — 平面上某个点的坐标。[元组](../../sql_reference/functions/geo.md)类型,包含坐标的两个数字。 -- `[(a, b), (c, d) ...]` — 多边形的顶点。[阵列](../../sql_reference/functions/geo.md)类型。每个顶点由一对坐标`(a, b)`表示。顶点可以按顺时针或逆时针指定。顶点的个数应该大于等于3。同时只能是常量的。 -- 该函数还支持镂空的多边形(切除部分)。如果需要,可以使用函数的其他参数定义需要切除部分的多边形。(The function does not support non-simply-connected polygons.) - -**返回值** - -如果坐标点存在在多边形范围内,则返回`1`。否则返回`0`。 -如果坐标位于多边形的边界上,则该函数可能返回`1`,或可能返回`0`。 - -**示例** - -``` sql -SELECT pointInPolygon((3., 3.), [(6, 0), (8, 4), (5, 8), (0, 2)]) AS res -``` - -``` text -┌─res─┐ -│ 1 │ -└─────┘ -``` - -## geohashEncode {#geohashencode} - -将经度和纬度编码为geohash-string,请参阅(http://geohash.org/,https://en.wikipedia.org/wiki/Geohash)。 - -``` sql -geohashEncode(longitude, latitude, [precision]) -``` - -**输入值** - -- longitude - 要编码的坐标的经度部分。其值应在`[-180°,180°]`范围内 -- latitude - 要编码的坐标的纬度部分。其值应在`[-90°,90°]`范围内 -- precision - 可选,生成的geohash-string的长度,默认为`12`。取值范围为`[1,12]`。任何小于`1`或大于`12`的值都会默认转换为`12`。 - -**返回值** - -- 坐标编码的字符串(使用base32编码的修改版本)。 - -**示例** - -``` sql -SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res -``` - -``` text -┌─res──────────┐ -│ ezs42d000000 │ -└──────────────┘ -``` - -## geohashDecode {#geohashdecode} - -将任何geohash编码的字符串解码为经度和纬度。 - -**输入值** - -- encoded string - geohash编码的字符串。 - -**返回值** - -- (longitude, latitude) - 经度和纬度的`Float64`值的2元组。 - -**示例** - -``` sql -SELECT geohashDecode('ezs42') AS res -``` - -``` text -┌─res─────────────────────────────┐ -│ (-5.60302734375,42.60498046875) │ -└─────────────────────────────────┘ -``` - -## geoToH3 {#geotoh3} - -计算指定的分辨率的[H3](https://uber.github.io/h3/#/documentation/overview/introduction)索引`(lon, lat)`。 - -``` sql -geoToH3(lon, lat, resolution) -``` - -**输入值** - -- `lon` — 经度。 [Float64](../../sql_reference/functions/geo.md)类型。 -- `lat` — 纬度。 [Float64](../../sql_reference/functions/geo.md)类型。 -- `resolution` — 索引的分辨率。 取值范围为: `[0, 15]`。 [UInt8](../../sql_reference/functions/geo.md)类型。 - -**返回值** - -- H3中六边形的索引值。 -- 发生异常时返回0。 - -[UInt64](../../sql_reference/functions/geo.md)类型。 - -**示例** - -``` sql -SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index -``` - -``` text -┌────────────h3Index─┐ -│ 644325524701193974 │ -└────────────────────┘ -``` - -## geohashesInBox {#geohashesinbox} - -计算在指定精度下计算最小包含指定的经纬范围的最小图形的geohash数组。 - -**输入值** - -- longitude\_min - 最小经度。其值应在`[-180°,180°]`范围内 -- latitude\_min - 最小纬度。其值应在`[-90°,90°]`范围内 -- longitude\_max - 最大经度。其值应在`[-180°,180°]`范围内 -- latitude\_max - 最大纬度。其值应在`[-90°,90°]`范围内 -- precision - geohash的精度。其值应在`[1, 12]`内的`UInt8`类型的数字 - -请注意,上述所有的坐标参数必须同为`Float32`或`Float64`中的一种类型。 - -**返回值** - -- 包含指定范围内的指定精度的geohash字符串数组。注意,您不应该依赖返回数组中geohash的顺序。 -- \[\] - 当传入的最小经纬度大于最大经纬度时将返回一个空数组。 - -请注意,如果生成的数组长度超过10000时,则函数将抛出异常。 - -**示例** - -``` sql -SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos -``` - -``` text -┌─thasos──────────────────────────────────────┐ -│ ['sx1q','sx1r','sx32','sx1w','sx1x','sx38'] │ -└─────────────────────────────────────────────┘ -``` - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/geo/) diff --git a/docs/zh/sql_reference/functions/hash_functions.md b/docs/zh/sql_reference/functions/hash_functions.md deleted file mode 100644 index 9dc4aa9b794..00000000000 --- a/docs/zh/sql_reference/functions/hash_functions.md +++ /dev/null @@ -1,115 +0,0 @@ - -# Hash函数 {#hashhan-shu} - -Hash函数可以用于将元素不可逆的伪随机打乱。 - -## halfMD5 {#halfmd5} - -计算字符串的MD5。然后获取结果的前8个字节并将它们作为UInt64(大端)返回。 -此函数相当低效(500万个短字符串/秒/核心)。 -如果您不需要一定使用MD5,请使用'sipHash64'函数。 - -## MD5 {#md5} - -计算字符串的MD5并将结果放入FixedString(16)中返回。 -如果您只是需要一个128位的hash,同时不需要一定使用MD5,请使用'sipHash128'函数。 -如果您要获得与md5sum程序相同的输出结果,请使用lower(hex(MD5(s)))。 - -## sipHash64 {#siphash64} - -计算字符串的SipHash。 -接受String类型的参数,返回UInt64。 -SipHash是一种加密哈希函数。它的处理性能至少比MD5快三倍。 -有关详细信息,请参阅链接:https://131002.net/siphash/ - -## sipHash128 {#hash_functions-siphash128} - -计算字符串的SipHash。 -接受String类型的参数,返回FixedString(16)。 -与sipHash64函数的不同在于它的最终计算结果为128位。 - -## cityHash64 {#cityhash64} - -计算任意数量字符串的CityHash64或使用特定实现的Hash函数计算任意数量其他类型的Hash。 -对于字符串,使用CityHash算法。 这是一个快速的非加密哈希函数,用于字符串。 -对于其他类型的参数,使用特定实现的Hash函数,这是一种快速的非加密的散列函数。 -如果传递了多个参数,则使用CityHash组合这些参数的Hash结果。 -例如,您可以计算整个表的checksum,其结果取决于行的顺序:`SELECT sum(cityHash64(*)) FROM table`。 - -## intHash32 {#inthash32} - -为任何类型的整数计算32位的哈希。 -这是相对高效的非加密Hash函数。 - -## intHash64 {#inthash64} - -从任何类型的整数计算64位哈希码。 -它的工作速度比intHash32函数快。 - -## SHA1 {#sha1} - -## SHA224 {#sha224} - -## SHA256 {#sha256} - -计算字符串的SHA-1,SHA-224或SHA-256,并将结果字节集返回为FixedString(20),FixedString(28)或FixedString(32)。 -该函数相当低效(SHA-1大约500万个短字符串/秒/核心,而SHA-224和SHA-256大约220万个短字符串/秒/核心)。 -我们建议仅在必须使用这些Hash函数且无法更改的情况下使用这些函数。 -即使在这些情况下,我们仍建议将函数采用在写入数据时使用预计算的方式将其计算完毕。而不是在SELECT中计算它们。 - -## URLHash(url\[,N\]) {#urlhashurl-n} - -一种快速的非加密哈希函数,用于规范化的从URL获得的字符串。 -`URLHash(s)` - 从一个字符串计算一个哈希,如果结尾存在尾随符号`/`,`?`或`#`则忽略。 -`URLHash(s,N)` - 计算URL层次结构中字符串到N级别的哈希值,如果末尾存在尾随符号`/`,`?`或`#`则忽略。 -URL的层级与URLHierarchy中的层级相同。 此函数被用于Yandex.Metrica。 - -## farmHash64 {#farmhash64} - -计算字符串的FarmHash64。 -接受一个String类型的参数。返回UInt64。 -有关详细信息,请参阅链接:[FarmHash64](https://github.com/google/farmhash) - -## javaHash {#hash_functions-javahash} - -计算字符串的JavaHash。 -接受一个String类型的参数。返回Int32。 -有关更多信息,请参阅链接:[JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add975b/src/share/classes/java/lang/String.java#l1452) - -## hiveHash {#hivehash} - -计算字符串的HiveHash。 -接受一个String类型的参数。返回Int32。 -与[JavaHash](#hash_functions-javahash)相同,但不会返回负数。 - -## metroHash64 {#metrohash64} - -计算字符串的MetroHash。 -接受一个String类型的参数。返回UInt64。 -有关详细信息,请参阅链接:[MetroHash64](http://www.jandrewrogers.com/2015/05/27/metrohash/) - -## jumpConsistentHash {#jumpconsistenthash} - -计算UInt64的JumpConsistentHash。 -接受UInt64类型的参数。返回Int32。 -有关更多信息,请参见链接:[JumpConsistentHash](https://arxiv.org/pdf/1406.2294.pdf) - -## murmurHash2\_32,murmurHash2\_64 {#murmurhash2-32-murmurhash2-64} - -计算字符串的MurmurHash2。 -接受一个String类型的参数。返回UInt64或UInt32。 -有关更多信息,请参阅链接:[MurmurHash2](https://github.com/aappleby/smhasher) - -## murmurHash3\_32,murmurHash3\_64,murmurHash3\_128 {#murmurhash3-32-murmurhash3-64-murmurhash3-128} - -计算字符串的MurmurHash3。 -接受一个String类型的参数。返回UInt64或UInt32或FixedString(16)。 -有关更多信息,请参阅链接:[MurmurHash3](https://github.com/aappleby/smhasher) - -## xxHash32,xxHash64 {#xxhash32-xxhash64} - -计算字符串的xxHash。 -接受一个String类型的参数。返回UInt64或UInt32。 -有关更多信息,请参见链接:[xxHash](http://cyan4973.github.io/xxHash/) - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) diff --git a/docs/zh/sql_reference/functions/higher_order_functions.md b/docs/zh/sql_reference/functions/higher_order_functions.md deleted file mode 100644 index 6d090e7330d..00000000000 --- a/docs/zh/sql_reference/functions/higher_order_functions.md +++ /dev/null @@ -1,139 +0,0 @@ - -# 高阶函数 {#gao-jie-han-shu} - -## `->` 运算符, lambda(params, expr) 函数 {#yun-suan-fu-lambdaparams-expr-han-shu} - -用于描述一个lambda函数用来传递给其他高阶函数。箭头的左侧有一个形式参数,它可以是一个标识符或多个标识符所组成的元祖。箭头的右侧是一个表达式,在这个表达式中可以使用形式参数列表中的任何一个标识符或表的任何一个列名。 - -示例: `x -> 2 * x, str -> str != Referer.` - -高阶函数只能接受lambda函数作为其参数。 - -高阶函数可以接受多个参数的lambda函数作为其参数,在这种情况下,高阶函数需要同时传递几个长度相等的数组,这些数组将被传递给lambda参数。 - -除了'arrayMap'和'arrayFilter'以外的所有其他函数,都可以省略第一个参数(lambda函数)。在这种情况下,默认返回数组元素本身。 - -### arrayMap(func, arr1, …) {#higher_order_functions-array-map} - -将arr -将从'func'函数的原始应用程序获得的数组返回到'arr'数组中的每个元素。 -返回从原始应用程序获得的数组 ‘func’ 函数中的每个元素 ‘arr’ 阵列。 - -### arrayFilter(func, arr1, …) {#arrayfilterfunc-arr1} - -返回一个仅包含以下元素的数组 ‘arr1’ 对于哪个 ‘func’ 返回0以外的内容。 - -示例: - -``` sql -SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res -``` - - ┌─res───────────┐ - │ ['abc World'] │ - └───────────────┘ - -``` sql -SELECT - arrayFilter( - (i, x) -> x LIKE '%World%', - arrayEnumerate(arr), - ['Hello', 'abc World'] AS arr) - AS res -``` - - ┌─res─┐ - │ [2] │ - └─────┘ - -### arrayCount(\[func,\] arr1, …) {#arraycountfunc-arr1} - -返回数组arr中非零元素的数量,如果指定了'func',则通过'func'的返回值确定元素是否为非零元素。 - -### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1} - -返回数组'arr'中是否存在非零元素,如果指定了'func',则使用'func'的返回值确定元素是否为非零元素。 - -### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1} - -返回数组'arr'中是否存在为零的元素,如果指定了'func',则使用'func'的返回值确定元素是否为零元素。 - -### arraySum(\[func,\] arr1, …) {#arraysumfunc-arr1} - -计算arr数组的总和,如果指定了'func',则通过'func'的返回值计算数组的总和。 - -### arrayFirst(func, arr1, …) {#arrayfirstfunc-arr1} - -返回数组中第一个匹配的元素,函数使用'func'匹配所有元素,直到找到第一个匹配的元素。 - -### arrayFirstIndex(func, arr1, …) {#arrayfirstindexfunc-arr1} - -返回数组中第一个匹配的元素的下标索引,函数使用'func'匹配所有元素,直到找到第一个匹配的元素。 - -### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1} - -返回源数组部分数据的总和,如果指定了`func`函数,则使用`func`的返回值计算总和。 - -示例: - -``` sql -SELECT arrayCumSum([1, 1, 1, 1]) AS res -``` - - ┌─res──────────┐ - │ [1, 2, 3, 4] │ - └──────────────┘ - -### arrayCumSumNonNegative(arr) {#arraycumsumnonnegativearr} - -与arrayCumSum相同,返回源数组部分数据的总和。不同于arrayCumSum,当返回值包含小于零的值时,该值替换为零,后续计算使用零继续计算。例如: - -``` sql -SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res -``` - - ┌─res───────┐ - │ [1,2,0,1] │ - └───────────┘ - -### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1} - -返回升序排序`arr1`的结果。如果指定了`func`函数,则排序顺序由`func`的结果决定。 - -[Schwartzian变换](https://en.wikipedia.org/wiki/Schwartzian_transform)用于提高排序效率。 - -示例: - -``` sql -SELECT arraySort((x, y) -> y, ['hello', 'world'], [2, 1]); -``` - - ┌─res────────────────┐ - │ ['world', 'hello'] │ - └────────────────────┘ - -请注意,NULL和NaN在最后(NaN在NULL之前)。例如: - -``` sql -SELECT arraySort([1, nan, 2, NULL, 3, nan, 4, NULL]) -``` - - ┌─arraySort([1, nan, 2, NULL, 3, nan, 4, NULL])─┐ - │ [1,2,3,4,nan,nan,NULL,NULL] │ - └───────────────────────────────────────────────┘ - -### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1} - -返回降序排序`arr1`的结果。如果指定了`func`函数,则排序顺序由`func`的结果决定。 - -请注意,NULL和NaN在最后(NaN在NULL之前)。例如: - -``` sql -SELECT arrayReverseSort([1, nan, 2, NULL, 3, nan, 4, NULL]) -``` - - ┌─arrayReverseSort([1, nan, 2, NULL, 3, nan, 4, NULL])─┐ - │ [4,3,2,1,nan,nan,NULL,NULL] │ - └──────────────────────────────────────────────────────┘ - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/higher_order_functions/) diff --git a/docs/zh/sql_reference/functions/in_functions.md b/docs/zh/sql_reference/functions/in_functions.md deleted file mode 100644 index f4f358bad9a..00000000000 --- a/docs/zh/sql_reference/functions/in_functions.md +++ /dev/null @@ -1,20 +0,0 @@ - -# IN运算符相关函数 {#inyun-suan-fu-xiang-guan-han-shu} - -## in,notIn,globalIn,globalNotIn {#in-notin-globalin-globalnotin} - -请参阅[IN 运算符](../statements/select.md#select-in-operators)部分。 - -## tuple(x, y, …), operator (x, y, …) {#tuplex-y-operator-x-y} - -函数用于对多个列进行分组。 -对于具有类型T1,T2,…的列,它返回包含这些列的元组(T1,T2,…)。 执行该函数没有任何成本。 -元组通常用作IN运算符的中间参数值,或用于创建lambda函数的形参列表。 元组不能写入表。 - -## 元组元素(元组,n),运算符x.N {#tupleelementtuple-n-operator-x-n} - -函数用于从元组中获取列。 -'N'是列索引,从1开始。N必须是常量正整数常数,并且不大于元组的大小。 -执行该函数没有任何成本。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) diff --git a/docs/zh/sql_reference/functions/index.md b/docs/zh/sql_reference/functions/index.md deleted file mode 100644 index 1f61a1f2919..00000000000 --- a/docs/zh/sql_reference/functions/index.md +++ /dev/null @@ -1,67 +0,0 @@ - -# 函数 {#han-shu} - -ClickHouse中至少存在两种类型的函数 - 常规函数(它们称之为«函数»)和聚合函数。 常规函数的工作就像分别为每一行执行一次函数计算一样(对于每一行,函数的结果不依赖于其他行)。 聚合函数则从各行累积一组值(即函数的结果以来整个结果集)。 - -在本节中,我们将讨论常规函数。 有关聚合函数,请参阅«聚合函数»一节。 - - \* - 'arrayJoin'函数与表函数均属于第三种类型的函数。 \* - -## 强类型 {#qiang-lei-xing} - -与标准SQL相比,ClickHouse具有强类型。 换句话说,它不会在类型之间进行隐式转换。 每个函数适用于特定的一组类型。 这意味着有时您需要使用类型转换函数。 - -## 常见的子表达式消除 {#chang-jian-de-zi-biao-da-shi-xiao-chu} - -查询中具有相同AST(相同语句或语法分析结果相同)的所有表达式都被视为具有相同的值。 这样的表达式被连接并执行一次。 通过这种方式也可以消除相同的子查询。 - -## 结果类型 {#jie-guo-lei-xing} - -所有函数都只能够返回一个返回值。 结果类型通常由参数的类型决定。 但tupleElement函数(a.N运算符)和toFixedString函数是例外的。 - -## 常量 {#chang-liang} - -为了简单起见,某些函数的某些参数只能是常量。 例如,LIKE运算符的右参数必须是常量。 -几乎所有函数都为常量参数返回常量。 除了用于生成随机数的函数。 -'now'函数为在不同时间运行的查询返回不同的值,但结果被视为常量,因为常量在单个查询中很重要。 -常量表达式也被视为常量(例如,LIKE运算符的右半部分可以由多个常量构造)。 - -对于常量和非常量参数,可以以不同方式实现函数(执行不同的代码)。 但是,对于包含相同数据的常量和非常量参数它们的结果应该是一致的。 - -## NULL值处理 {#nullzhi-chu-li} - -函数具有以下行为: - -- 如果函数的参数至少一个是«NULL»,则函数结果也是«NULL»。 -- 在每个函数的描述中单独指定的特殊行为。在ClickHouse源代码中,这些函数具有«UseDefaultImplementationForNulls = false»。 - -## 不可变性 {#bu-ke-bian-xing} - -函数不能更改其参数的值 - 任何更改都将作为结果返回。因此,计算单独函数的结果不依赖于在查询中写入函数的顺序。 - -## 错误处理 {#cuo-wu-chu-li} - -如果数据无效,某些函数可能会抛出异常。在这种情况下,将取消查询并将错误信息返回给客户端。对于分布式处理,当其中一个服务器发生异常时,其他服务器也会尝试中止查询。 - -## 表达式参数的计算 {#biao-da-shi-can-shu-de-ji-suan} - -在几乎所有编程语言中,某些函数可能无法预先计算其中一个参数。这通常是运算符`&&`,`||`和`? :`。 -但是在ClickHouse中,函数(运算符)的参数总是被预先计算。这是因为一次评估列的整个部分,而不是分别计算每一行。 - -## 执行分布式查询处理的功能 {#zhi-xing-fen-bu-shi-cha-xun-chu-li-de-gong-neng} - -对于分布式查询处理,在远程服务器上执行尽可能多的查询处理阶段,并且在请求者服务器上执行其余阶段(合并中间结果和之后的所有内容)。 - -这意味着可以在不同的服务器上执行功能。 -例如,在查询`SELECT f(sum(g(x)))FROM distributed_table GROUP BY h(y)中,` - -- 如果`distributed_table`至少有两个分片,则在远程服务器上执行函数'g'和'h',并在请求服务器上执行函数'f'。 -- 如果`distributed_table`只有一个分片,则在该分片的服务器上执行所有'f','g'和'h'功能。 - -函数的结果通常不依赖于它在哪个服务器上执行。但是,有时这很重要。 -例如,使用字典的函数时将使用运行它们的服务器上存在的字典。 -另一个例子是`hostName`函数,它返回运行它的服务器的名称,以便在`SELECT`查询中对服务器进行`GROUP BY`。 - -如果查询中的函数在请求服务器上执行,但您需要在远程服务器上执行它,则可以将其包装在«any»聚合函数中,或将其添加到«GROUP BY»中。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/) diff --git a/docs/zh/sql_reference/functions/introspection.md b/docs/zh/sql_reference/functions/introspection.md deleted file mode 100644 index f0c907b3e67..00000000000 --- a/docs/zh/sql_reference/functions/introspection.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 65 -toc_title: "\u81EA\u7701" ---- - -# 内省功能 {#introspection-functions} - -您可以使用本章中描述的函数来反省 [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) 和 [DWARF](https://en.wikipedia.org/wiki/DWARF) 用于查询分析。 - -!!! warning "警告" - 这些功能很慢,可能会强加安全考虑。 - -对于内省功能的正确操作: - -- 安装 `clickhouse-common-static-dbg` 包。 - -- 设置 [allow\_introspection\_functions](../../operations/settings/settings.md#settings-allow_introspection_functions) 设置为1。 - - For security reasons introspection functions are disabled by default. - -ClickHouse将探查器报告保存到 [trace\_log](../../operations/system_tables.md#system_tables-trace_log) 系统表. 确保正确配置了表和探查器。 - -## addressToLine {#addresstoline} - -将ClickHouse服务器进程内的虚拟内存地址转换为ClickHouse源代码中的文件名和行号。 - -如果您使用官方的ClickHouse软件包,您需要安装 `clickhouse-common-static-dbg` 包。 - -**语法** - -``` sql -addressToLine(address_of_binary_instruction) -``` - -**参数** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**返回值** - -- 源代码文件名和此文件中用冒号分隔的行号。 - - For example, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, where `199` is a line number. - -- 二进制文件的名称,如果函数找不到调试信息。 - -- 空字符串,如果地址无效。 - -类型: [字符串](../../sql_reference/data_types/string.md). - -**示例** - -启用内省功能: - -``` sql -SET allow_introspection_functions=1 -``` - -从中选择第一个字符串 `trace_log` 系统表: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-19 -event_time: 2019-11-19 18:57:23 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 421b6855-1858-45a5-8f37-f383409d6d72 -trace: [140658411141617,94784174532828,94784076370703,94784076372094,94784076361020,94784175007680,140658411116251,140658403895439] -``` - -该 `trace` 字段包含采样时的堆栈跟踪。 - -获取单个地址的源代码文件名和行号: - -``` sql -SELECT addressToLine(94784076370703) \G -``` - -``` text -Row 1: -────── -addressToLine(94784076370703): /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -``` - -将函数应用于整个堆栈跟踪: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToLine(x), trace), '\n') AS trace_source_code_lines -FROM system.trace_log -LIMIT 1 -\G -``` - -该 [arrayMap](higher_order_functions.md#higher_order_functions-array-map) 功能允许处理的每个单独的元素 `trace` 阵列由 `addressToLine` 功能。 这种处理的结果,你在看 `trace_source_code_lines` 列的输出。 - -``` text -Row 1: -────── -trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so -/usr/lib/debug/usr/bin/clickhouse -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199 -/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:155 -/usr/include/c++/9/bits/atomic_base.h:551 -/usr/lib/debug/usr/bin/clickhouse -/lib/x86_64-linux-gnu/libpthread-2.27.so -/build/glibc-OTsEL5/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97 -``` - -## addressToSymbol {#addresstosymbol} - -将ClickHouse服务器进程内的虚拟内存地址转换为ClickHouse对象文件中的符号。 - -**语法** - -``` sql -addressToSymbol(address_of_binary_instruction) -``` - -**参数** - -- `address_of_binary_instruction` ([UInt64](../../sql_reference/data_types/int_uint.md)) — Address of instruction in a running process. - -**返回值** - -- 来自ClickHouse对象文件的符号。 -- 空字符串,如果地址无效。 - -类型: [字符串](../../sql_reference/data_types/string.md). - -**示例** - -启用内省功能: - -``` sql -SET allow_introspection_functions=1 -``` - -从中选择第一个字符串 `trace_log` 系统表: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -该 `trace` 字段包含采样时的堆栈跟踪。 - -获取单个地址的符号: - -``` sql -SELECT addressToSymbol(94138803686098) \G -``` - -``` text -Row 1: -────── -addressToSymbol(94138803686098): _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -``` - -将函数应用于整个堆栈跟踪: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> addressToSymbol(x), trace), '\n') AS trace_symbols -FROM system.trace_log -LIMIT 1 -\G -``` - -该 [arrayMap](higher_order_functions.md#higher_order_functions-array-map) 功能允许处理的每个单独的元素 `trace` 阵列由 `addressToSymbols` 功能。 这种处理的结果,你在看 `trace_symbols` 列的输出。 - -``` text -Row 1: -────── -trace_symbols: _ZNK2DB24IAggregateFunctionHelperINS_20AggregateFunctionSumImmNS_24AggregateFunctionSumDataImEEEEE19addBatchSinglePlaceEmPcPPKNS_7IColumnEPNS_5ArenaE -_ZNK2DB10Aggregator21executeWithoutKeyImplERPcmPNS0_28AggregateFunctionInstructionEPNS_5ArenaE -_ZN2DB10Aggregator14executeOnBlockESt6vectorIN3COWINS_7IColumnEE13immutable_ptrIS3_EESaIS6_EEmRNS_22AggregatedDataVariantsERS1_IPKS3_SaISC_EERS1_ISE_SaISE_EERb -_ZN2DB10Aggregator14executeOnBlockERKNS_5BlockERNS_22AggregatedDataVariantsERSt6vectorIPKNS_7IColumnESaIS9_EERS6_ISB_SaISB_EERb -_ZN2DB10Aggregator7executeERKSt10shared_ptrINS_17IBlockInputStreamEERNS_22AggregatedDataVariantsE -_ZN2DB27AggregatingBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB26ExpressionBlockInputStream8readImplEv -_ZN2DB17IBlockInputStream4readEv -_ZN2DB28AsynchronousBlockInputStream9calculateEv -_ZNSt17_Function_handlerIFvvEZN2DB28AsynchronousBlockInputStream4nextEvEUlvE_E9_M_invokeERKSt9_Any_data -_ZN14ThreadPoolImplI20ThreadFromGlobalPoolE6workerESt14_List_iteratorIS0_E -_ZZN20ThreadFromGlobalPoolC4IZN14ThreadPoolImplIS_E12scheduleImplIvEET_St8functionIFvvEEiSt8optionalImEEUlvE1_JEEEOS4_DpOT0_ENKUlvE_clEv -_ZN14ThreadPoolImplISt6threadE6workerESt14_List_iteratorIS0_E -execute_native_thread_routine -start_thread -clone -``` - -## demangle {#demangle} - -转换一个符号,您可以使用 [addressToSymbol](#addresstosymbol) 函数到C++函数名。 - -**语法** - -``` sql -demangle(symbol) -``` - -**参数** - -- `symbol` ([字符串](../../sql_reference/data_types/string.md)) — Symbol from an object file. - -**返回值** - -- C++函数的名称。 -- 如果符号无效,则为空字符串。 - -类型: [字符串](../../sql_reference/data_types/string.md). - -**示例** - -启用内省功能: - -``` sql -SET allow_introspection_functions=1 -``` - -从中选择第一个字符串 `trace_log` 系统表: - -``` sql -SELECT * FROM system.trace_log LIMIT 1 \G -``` - -``` text -Row 1: -────── -event_date: 2019-11-20 -event_time: 2019-11-20 16:57:59 -revision: 54429 -timer_type: Real -thread_number: 48 -query_id: 724028bf-f550-45aa-910d-2af6212b94ac -trace: [94138803686098,94138815010911,94138815096522,94138815101224,94138815102091,94138814222988,94138806823642,94138814457211,94138806823642,94138814457211,94138806823642,94138806795179,94138806796144,94138753770094,94138753771646,94138753760572,94138852407232,140399185266395,140399178045583] -``` - -该 `trace` 字段包含采样时的堆栈跟踪。 - -获取单个地址的函数名称: - -``` sql -SELECT demangle(addressToSymbol(94138803686098)) \G -``` - -``` text -Row 1: -────── -demangle(addressToSymbol(94138803686098)): DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -``` - -将函数应用于整个堆栈跟踪: - -``` sql -SELECT - arrayStringConcat(arrayMap(x -> demangle(addressToSymbol(x)), trace), '\n') AS trace_functions -FROM system.trace_log -LIMIT 1 -\G -``` - -该 [arrayMap](higher_order_functions.md#higher_order_functions-array-map) 功能允许处理的每个单独的元素 `trace` 阵列由 `demangle` 功能。 这种处理的结果,你在看 `trace_functions` 列的输出。 - -``` text -Row 1: -────── -trace_functions: DB::IAggregateFunctionHelper > >::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*) const -DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) const -DB::Aggregator::executeOnBlock(std::vector::immutable_ptr, std::allocator::immutable_ptr > >, unsigned long, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::executeOnBlock(DB::Block const&, DB::AggregatedDataVariants&, std::vector >&, std::vector >, std::allocator > > >&, bool&) -DB::Aggregator::execute(std::shared_ptr const&, DB::AggregatedDataVariants&) -DB::AggregatingBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::ExpressionBlockInputStream::readImpl() -DB::IBlockInputStream::read() -DB::AsynchronousBlockInputStream::calculate() -std::_Function_handler::_M_invoke(std::_Any_data const&) -ThreadPoolImpl::worker(std::_List_iterator) -ThreadFromGlobalPool::ThreadFromGlobalPool::scheduleImpl(std::function, int, std::optional)::{lambda()#3}>(ThreadPoolImpl::scheduleImpl(std::function, int, std::optional)::{lambda()#3}&&)::{lambda()#1}::operator()() const -ThreadPoolImpl::worker(std::_List_iterator) -execute_native_thread_routine -start_thread -clone -``` diff --git a/docs/zh/sql_reference/functions/ip_address_functions.md b/docs/zh/sql_reference/functions/ip_address_functions.md deleted file mode 100644 index 17f4c4a5991..00000000000 --- a/docs/zh/sql_reference/functions/ip_address_functions.md +++ /dev/null @@ -1,218 +0,0 @@ - -# IP函数 {#iphan-shu} - -## IPv4NumToString(num) {#ipv4numtostringnum} - -接受一个UInt32(大端)表示的IPv4的地址,返回相应IPv4的字符串表现形式,格式为A.B.C.D(以点分割的十进制数字)。 - -## IPv4StringToNum(s) {#ipv4stringtonums} - -与IPv4NumToString函数相反。如果IPv4地址格式无效,则返回0。 - -## IPv4NumToStringClassC(num) {#ipv4numtostringclasscnum} - -与IPv4NumToString类似,但使用xxx替换最后一个字节。 - -示例: - -``` sql -SELECT - IPv4NumToStringClassC(ClientIP) AS k, - count() AS c -FROM test.hits -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - - ┌─k──────────────┬─────c─┐ - │ 83.149.9.xxx │ 26238 │ - │ 217.118.81.xxx │ 26074 │ - │ 213.87.129.xxx │ 25481 │ - │ 83.149.8.xxx │ 24984 │ - │ 217.118.83.xxx │ 22797 │ - │ 78.25.120.xxx │ 22354 │ - │ 213.87.131.xxx │ 21285 │ - │ 78.25.121.xxx │ 20887 │ - │ 188.162.65.xxx │ 19694 │ - │ 83.149.48.xxx │ 17406 │ - └────────────────┴───────┘ - -由于使用'xxx'是不规范的,因此将来可能会更改。我们建议您不要依赖此格式。 - -### IPv6NumToString(x) {#ipv6numtostringx} - -接受FixedString(16)类型的二进制格式的IPv6地址。以文本格式返回此地址的字符串。 -IPv6映射的IPv4地址以::ffff:111.222.33。例如: - -``` sql -SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr -``` - - ┌─addr─────────┐ - │ 2a02:6b8::11 │ - └──────────────┘ - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() AND substring(ClientIP6, 1, 12) != unhex('00000000000000000000FFFF') -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - - ┌─IPv6NumToString(ClientIP6)──────────────┬─────c─┐ - │ 2a02:2168:aaa:bbbb::2 │ 24695 │ - │ 2a02:2698:abcd:abcd:abcd:abcd:8888:5555 │ 22408 │ - │ 2a02:6b8:0:fff::ff │ 16389 │ - │ 2a01:4f8:111:6666::2 │ 16016 │ - │ 2a02:2168:888:222::1 │ 15896 │ - │ 2a01:7e00::ffff:ffff:ffff:222 │ 14774 │ - │ 2a02:8109:eee:ee:eeee:eeee:eeee:eeee │ 14443 │ - │ 2a02:810b:8888:888:8888:8888:8888:8888 │ 14345 │ - │ 2a02:6b8:0:444:4444:4444:4444:4444 │ 14279 │ - │ 2a01:7e00::ffff:ffff:ffff:ffff │ 13880 │ - └─────────────────────────────────────────┴───────┘ - -``` sql -SELECT - IPv6NumToString(ClientIP6 AS k), - count() AS c -FROM hits_all -WHERE EventDate = today() -GROUP BY k -ORDER BY c DESC -LIMIT 10 -``` - - ┌─IPv6NumToString(ClientIP6)─┬──────c─┐ - │ ::ffff:94.26.111.111 │ 747440 │ - │ ::ffff:37.143.222.4 │ 529483 │ - │ ::ffff:5.166.111.99 │ 317707 │ - │ ::ffff:46.38.11.77 │ 263086 │ - │ ::ffff:79.105.111.111 │ 186611 │ - │ ::ffff:93.92.111.88 │ 176773 │ - │ ::ffff:84.53.111.33 │ 158709 │ - │ ::ffff:217.118.11.22 │ 154004 │ - │ ::ffff:217.118.11.33 │ 148449 │ - │ ::ffff:217.118.11.44 │ 148243 │ - └────────────────────────────┴────────┘ - -## IPv6StringToNum(s) {#ipv6stringtonums} - -与IPv6NumToString的相反。如果IPv6地址格式无效,则返回空字节字符串。 -十六进制可以是大写的或小写的。 - -## IPv4ToIPv6(x) {#ipv4toipv6x} - -接受一个UInt32类型的IPv4地址,返回FixedString(16)类型的IPv6地址。例如: - -``` sql -SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr -``` - - ┌─addr───────────────┐ - │ ::ffff:192.168.0.1 │ - └────────────────────┘ - -## cutIPv6(x,bitsToCutForIPv6,bitsToCutForIPv4) {#cutipv6x-bitstocutforipv6-bitstocutforipv4} - -接受一个FixedString(16)类型的IPv6地址,返回一个String,这个String中包含了删除指定位之后的地址的文本格式。例如: - -``` sql -WITH - IPv6StringToNum('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D') AS ipv6, - IPv4ToIPv6(IPv4StringToNum('192.168.0.1')) AS ipv4 -SELECT - cutIPv6(ipv6, 2, 0), - cutIPv6(ipv4, 0, 2) -``` - - ┌─cutIPv6(ipv6, 2, 0)─────────────────┬─cutIPv6(ipv4, 0, 2)─┐ - │ 2001:db8:ac10:fe01:feed:babe:cafe:0 │ ::ffff:192.168.0.0 │ - └─────────────────────────────────────┴─────────────────────┘ - -## ツ古カツ益ツ催ツ団ツ法ツ人), {#ipv4cidrtorangeipv4-cidr} - -接受一个IPv4地址以及一个UInt8类型的CIDR。返回包含子网最低范围以及最高范围的元组。 - -``` sql -SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16) -``` - - ┌─IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)─┐ - │ ('192.168.0.0','192.168.255.255') │ - └────────────────────────────────────────────┘ - -## ツ暗ェツ氾环催ツ団ツ法ツ人), {#ipv6cidrtorangeipv6-cidr} - -接受一个IPv6地址以及一个UInt8类型的CIDR。返回包含子网最低范围以及最高范围的元组。 - -``` sql -SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32); -``` - - ┌─IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32)─┐ - │ ('2001:db8::','2001:db8:ffff:ffff:ffff:ffff:ffff:ffff') │ - └────────────────────────────────────────────────────────────────────────┘ - -## toIPv4(字符串) {#toipv4string} - -`IPv4StringToNum()`的别名,它采用字符串形式的IPv4地址并返回[IPv4](../../sql_reference/functions/ip_address_functions.md)类型的值,该二进制值等于`IPv4StringToNum()`返回的值。 - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - toTypeName(IPv4StringToNum(IPv4_string)), - toTypeName(toIPv4(IPv4_string)) -``` - - ┌─toTypeName(IPv4StringToNum(IPv4_string))─┬─toTypeName(toIPv4(IPv4_string))─┐ - │ UInt32 │ IPv4 │ - └──────────────────────────────────────────┴─────────────────────────────────┘ - -``` sql -WITH - '171.225.130.45' as IPv4_string -SELECT - hex(IPv4StringToNum(IPv4_string)), - hex(toIPv4(IPv4_string)) -``` - - ┌─hex(IPv4StringToNum(IPv4_string))─┬─hex(toIPv4(IPv4_string))─┐ - │ ABE1822D │ ABE1822D │ - └───────────────────────────────────┴──────────────────────────┘ - -## toIPv6(字符串) {#toipv6string} - -`IPv6StringToNum()`的别名,它采用字符串形式的IPv6地址并返回[IPv6](../../sql_reference/functions/ip_address_functions.md)类型的值,该二进制值等于`IPv6StringToNum()`返回的值。 - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - toTypeName(IPv6StringToNum(IPv6_string)), - toTypeName(toIPv6(IPv6_string)) -``` - - ┌─toTypeName(IPv6StringToNum(IPv6_string))─┬─toTypeName(toIPv6(IPv6_string))─┐ - │ FixedString(16) │ IPv6 │ - └──────────────────────────────────────────┴─────────────────────────────────┘ - -``` sql -WITH - '2001:438:ffff::407d:1bc1' as IPv6_string -SELECT - hex(IPv6StringToNum(IPv6_string)), - hex(toIPv6(IPv6_string)) -``` - - ┌─hex(IPv6StringToNum(IPv6_string))─┬─hex(toIPv6(IPv6_string))─────────┐ - │ 20010438FFFF000000000000407D1BC1 │ 20010438FFFF000000000000407D1BC1 │ - └───────────────────────────────────┴──────────────────────────────────┘ - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) diff --git a/docs/zh/sql_reference/functions/json_functions.md b/docs/zh/sql_reference/functions/json_functions.md deleted file mode 100644 index ca76edde09c..00000000000 --- a/docs/zh/sql_reference/functions/json_functions.md +++ /dev/null @@ -1,175 +0,0 @@ - -# JSON函数 {#jsonhan-shu} - -在Yandex.Metrica中,用户使用JSON作为访问参数。为了处理这些JSON,实现了一些函数。(尽管在大多数情况下,JSON是预先进行额外处理的,并将结果值放在单独的列中。)所有的这些函数都进行了尽可能的假设。以使函数能够尽快的完成工作。 - -我们对JSON格式做了如下假设: - -1. 字段名称(函数的参数)必须使常量。 -2. 字段名称必须使用规范的编码。例如:`visitParamHas('{"abc":"def"}', 'abc') = 1`,但是 `visitParamHas('{"\\u0061\\u0062\\u0063":"def"}', 'abc') = 0` -3. 函数可以随意的在多层嵌套结构下查找字段。如果存在多个匹配字段,则返回第一个匹配字段。 -4. JSON除字符串文本外不存在空格字符。 - -## ツ环板(ョツ嘉ッツ偲青visャツ静ャツ青サツ催ャツ渉) {#visitparamhasparams-name} - -检查是否存在«name»名称的字段 - -## 访问paramextractuint(参数,名称) {#visitparamextractuintparams-name} - -将名为«name»的字段的值解析成UInt64。如果这是一个字符串字段,函数将尝试从字符串的开头解析一个数字。如果该字段不存在,或无法从它中解析到数字,则返回0。 - -## visitParamExtractInt(参数,名称) {#visitparamextractintparams-name} - -与visitParamExtractUInt相同,但返回Int64。 - -## 访问paramextractfloat(参数,名称) {#visitparamextractfloatparams-name} - -与visitParamExtractUInt相同,但返回Float64。 - -## ツ环板(ョツ嘉ッツ偲青妥-ツ姪(不ツ督ョツ産) {#visitparamextractboolparams-name} - -解析true/false值。其结果是UInt8类型的。 - -## 掳胫((禄脢鹿脷露胫鲁隆鹿((酶-11-16""\[脪陆(,,,) {#visitparamextractrawparams-name} - -返回字段的值,包含空格符。 - -示例: - - visitParamExtractRaw('{"abc":"\\n\\u0000"}', 'abc') = '"\\n\\u0000"' - visitParamExtractRaw('{"abc":{"def":[1,2,3]}}', 'abc') = '{"def":[1,2,3]}' - -## visitParamExtractString(参数,名称) {#visitparamextractstringparams-name} - -使用双引号解析字符串。这个值没有进行转义。如果转义失败,它将返回一个空白字符串。 - -示例: - - visitParamExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' - visitParamExtractString('{"abc":"\\u263a"}', 'abc') = '☺' - visitParamExtractString('{"abc":"\\u263"}', 'abc') = '' - visitParamExtractString('{"abc":"hello}', 'abc') = '' - -目前不支持`\uXXXX\uYYYY`这些字符编码,这些编码不在基本多文种平面中(它们被转化为CESU-8而不是UTF-8)。 - -以下函数基于[simdjson](https://github.com/lemire/simdjson),专为更复杂的JSON解析要求而设计。但上述假设2仍然适用。 - -## JSONHas(json\[, indices\_or\_keys\]…) {#jsonhasjson-indices-or-keys} - -如果JSON中存在该值,则返回`1`。 - -如果该值不存在,则返回`0`。 - -示例: - - select JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 1 - select JSONHas('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4) = 0 - -`indices_or_keys`可以是零个或多个参数的列表,每个参数可以是字符串或整数。 - -- String = 按成员名称访问JSON对象成员。 -- 正整数 = 从头开始访问第n个成员/成员名称。 -- 负整数 = 从末尾访问第n个成员/成员名称。 - -您可以使用整数来访问JSON数组和JSON对象。 - -例如: - - select JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'a' - select JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', 2) = 'b' - select JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -1) = 'b' - 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} - -返回JSON数组或JSON对象的长度。 - -如果该值不存在或类型错误,将返回`0`。 - -示例: - - 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} - -返回JSON值的类型。 - -如果该值不存在,将返回`Null`。 - -示例: - - select JSONType('{"a": "hello", "b": [-100, 200.0, 300]}') = 'Object' - 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} - -## JSONExtractInt(json\[, indices\_or\_keys\]…) {#jsonextractintjson-indices-or-keys} - -## JSONExtractFloat(json\[, indices\_or\_keys\]…) {#jsonextractfloatjson-indices-or-keys} - -## JSONExtractBool(json\[, indices\_or\_keys\]…) {#jsonextractbooljson-indices-or-keys} - -解析JSON并提取值。这些函数类似于`visitParam*`函数。 - -如果该值不存在或类型错误,将返回`0`。 - -示例: - - select JSONExtractInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 1) = -100 - 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} - -解析JSON并提取字符串。此函数类似于`visitParamExtractString`函数。 - -如果该值不存在或类型错误,则返回空字符串。 - -该值未转义。如果unescaping失败,则返回一个空字符串。 - -示例: - - select JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'hello' - select JSONExtractString('{"abc":"\\n\\u0000"}', 'abc') = '\n\0' - select JSONExtractString('{"abc":"\\u263a"}', 'abc') = '☺' - select JSONExtractString('{"abc":"\\u263"}', 'abc') = '' - select JSONExtractString('{"abc":"hello}', 'abc') = '' - -## JSONExtract(json\[, indices\_or\_keys…\], return\_type) {#jsonextractjson-indices-or-keys-return-type} - -解析JSON并提取给定ClickHouse数据类型的值。 - -这是以前的`JSONExtract函数的变体。 这意味着`JSONExtract(…, ‘String’)`返回与`JSONExtractString()`返回完全相同。`JSONExtract(…, ‘Float64’)`返回于`JSONExtractFloat()\`返回完全相同。 - -示例: - - SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(String, Array(Float64))') = ('hello',[-100,200,300]) - SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'Tuple(b Array(Float64), a String)') = ([-100,200,300],'hello') - SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 'Array(Nullable(Int8))') = [-100, NULL, NULL] - SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 4, 'Nullable(Int64)') = NULL - SELECT JSONExtract('{"passed": true}', 'passed', 'UInt8') = 1 - 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} - -从JSON中解析键值对,其中值是给定的ClickHouse数据类型。 - -示例: - - 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} - -返回JSON的部分。 - -如果部件不存在或类型错误,将返回空字符串。 - -示例: - - select JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]' - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) diff --git a/docs/zh/sql_reference/functions/logical_functions.md b/docs/zh/sql_reference/functions/logical_functions.md deleted file mode 100644 index 18a383edbdb..00000000000 --- a/docs/zh/sql_reference/functions/logical_functions.md +++ /dev/null @@ -1,16 +0,0 @@ - -# 逻辑函数 {#luo-ji-han-shu} - -逻辑函数可以接受任何数字类型的参数,并返回UInt8类型的0或1。 - -当向函数传递零时,函数将判定为«false»,否则,任何其他非零的值都将被判定为«true»。 - -## 和,和运营商 {#and-and-operator} - -## 或,或运营商 {#or-or-operator} - -## 不是,不是运营商 {#not-not-operator} - -## 异或 {#xor} - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) diff --git a/docs/zh/sql_reference/functions/machine_learning_functions.md b/docs/zh/sql_reference/functions/machine_learning_functions.md deleted file mode 100644 index 0bdea52c59f..00000000000 --- a/docs/zh/sql_reference/functions/machine_learning_functions.md +++ /dev/null @@ -1,16 +0,0 @@ - -# 机器学习函数 {#ji-qi-xue-xi-han-shu} - -## evalMLMethod(预测) {#machine_learning_methods-evalmlmethod} - -使用拟合回归模型的预测请使用`evalMLMethod`函数。 请参阅`linearRegression`中的链接。 - -## 随机线性回归 {#stochastic-linear-regression} - -`stochasticLinearRegression`聚合函数使用线性模型和MSE损失函数实现随机梯度下降法。 使用`evalMLMethod`来预测新数据。 -请参阅示例和注释[此处](../../sql_reference/functions/machine_learning_functions.md#agg_functions-stochasticlinearregression)。 - -## 随机逻辑回归 {#stochastic-logistic-regression} - -`stochasticLogisticRegression`聚合函数实现了二元分类问题的随机梯度下降法。 使用`evalMLMethod`来预测新数据。 -请参阅示例和注释[此处](../../sql_reference/functions/machine_learning_functions.md#agg_functions-stochasticlogisticregression)。 diff --git a/docs/zh/sql_reference/functions/math_functions.md b/docs/zh/sql_reference/functions/math_functions.md deleted file mode 100644 index fef88389b86..00000000000 --- a/docs/zh/sql_reference/functions/math_functions.md +++ /dev/null @@ -1,108 +0,0 @@ - -# 数学函数 {#shu-xue-han-shu} - -以下所有的函数都返回一个Float64类型的数值。返回结果总是以尽可能最大精度返回,但还是可能与机器中可表示最接近该值的数字不同。 - -## e() {#e} - -返回一个接近数学常量e的Float64数字。 - -## pi() {#pi} - -返回一个接近数学常量π的Float64数字。 - -## exp(x) {#expx} - -接受一个数值类型的参数并返回它的指数。 - -## log(x),ln(x) {#logx-lnx} - -接受一个数值类型的参数并返回它的自然对数。 - -## exp2(x) {#exp2x} - -接受一个数值类型的参数并返回它的2的x次幂。 - -## log2(x) {#log2x} - -接受一个数值类型的参数并返回它的底2对数。 - -## exp10(x) {#exp10x} - -接受一个数值类型的参数并返回它的10的x次幂。 - -## log10(x) {#log10x} - -接受一个数值类型的参数并返回它的底10对数。 - -## sqrt(x) {#sqrtx} - -接受一个数值类型的参数并返回它的平方根。 - -## cbrt(x) {#cbrtx} - -接受一个数值类型的参数并返回它的立方根。 - -## erf(x) {#erfx} - -如果'x'是非负数,那么erf(x / σ√2)是具有正态分布且标准偏差为«σ»的随机变量的值与预期值之间的距离大于«x»。 - -示例 (三西格玛准则): - -``` sql -SELECT erf(3 / sqrt(2)) -``` - - ┌─erf(divide(3, sqrt(2)))─┐ - │ 0.9973002039367398 │ - └─────────────────────────┘ - -## erfc(x) {#erfcx} - -接受一个数值参数并返回一个接近1 - erf(x)的Float64数字,但不会丢失大«x»值的精度。 - -## lgamma(x) {#lgammax} - -返回x的绝对值的自然对数的伽玛函数。 - -## tgamma(x) {#tgammax} - -返回x的伽玛函数。 - -## sin(x) {#sinx} - -返回x的三角正弦值。 - -## cos(x) {#cosx} - -返回x的三角余弦值。 - -## 谭(x) {#tanx} - -返回x的三角正切值。 - -## asin(x) {#asinx} - -返回x的反三角正弦值。 - -## acos(x) {#acosx} - -返回x的反三角余弦值。 - -## 阿坦(x) {#atanx} - -返回x的反三角正切值。 - -## pow(x,y),power(x,y) {#powx-y-powerx-y} - -接受x和y两个参数。返回x的y次方。 - -## intExp2 {#intexp2} - -接受一个数值类型的参数并返回它的2的x次幂(UInt64)。 - -## intExp10 {#intexp10} - -接受一个数值类型的参数并返回它的10的x次幂(UInt64)。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) diff --git a/docs/zh/sql_reference/functions/other_functions.md b/docs/zh/sql_reference/functions/other_functions.md deleted file mode 100644 index e0c7e47be58..00000000000 --- a/docs/zh/sql_reference/functions/other_functions.md +++ /dev/null @@ -1,538 +0,0 @@ - -# 其他函数 {#qi-ta-han-shu} - -## 主机名() {#hostname} - -返回一个字符串,其中包含执行此函数的主机的名称。 对于分布式处理,如果在远程服务器上执行此函数,则将返回远程服务器主机的名称。 - -## basename {#basename} - -在最后一个斜杠或反斜杠后的字符串文本。 此函数通常用于从路径中提取文件名。 - - basename( expr ) - -**参数** - -- `expr` — 任何一个返回[字符串](../../sql_reference/functions/other_functions.md)结果的表达式。[字符串](../../sql_reference/functions/other_functions.md) - -**返回值** - -一个String类型的值,其包含: - -- 在最后一个斜杠或反斜杠后的字符串文本内容。 - - 如果输入的字符串以斜杆或反斜杆结尾,例如:`/`或`c:\`,函数将返回一个空字符串。 - -- 如果输入的字符串中不包含斜杆或反斜杠,函数返回输入字符串本身。 - -**示例** - -``` sql -SELECT 'some/long/path/to/file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some\\long\\path\\to\\file' AS a, basename(a) -``` - -``` text -┌─a──────────────────────┬─basename('some\\long\\path\\to\\file')─┐ -│ some\long\path\to\file │ file │ -└────────────────────────┴────────────────────────────────────────┘ -``` - -``` sql -SELECT 'some-file-name' AS a, basename(a) -``` - -``` text -┌─a──────────────┬─basename('some-file-name')─┐ -│ some-file-name │ some-file-name │ -└────────────────┴────────────────────────────┘ -``` - -## visibleWidth(x) {#visiblewidthx} - -以文本格式(以制表符分隔)向控制台输出值时,计算近似宽度。 -系统使用此函数实现Pretty格式。 -以文本格式(制表符分隔)将值输出到控制台时,计算近似宽度。 -这个函数被系统用于实现漂亮的格式。 - -`NULL` 表示为对应于 `NULL` 在 `Pretty` 格式。 - - SELECT visibleWidth(NULL) - - ┌─visibleWidth(NULL)─┐ - │ 4 │ - └────────────────────┘ - -## toTypeName(x) {#totypenamex} - -返回包含参数的类型名称的字符串。 - -如果将`NULL`作为参数传递给函数,那么它返回`Nullable(Nothing)`类型,它对应于ClickHouse中的内部`NULL`。 - -## 块大小() {#function-blocksize} - -获取Block的大小。 -在ClickHouse中,查询始终工作在Block(包含列的部分的集合)上。此函数允许您获取调用其的块的大小。 - -## 实现(x) {#materializex} - -将一个常量列变为一个非常量列。 -在ClickHouse中,非常量列和常量列在内存中的表示方式不同。尽管函数对于常量列和非常量总是返回相同的结果,但它们的工作方式可能完全不同(执行不同的代码)。此函数用于调试这种行为。 - -## ignore(…) {#ignore} - -接受任何参数,包括`NULL`。始终返回0。 -但是,函数的参数总是被计算的。该函数可以用于基准测试。 - -## 睡眠(秒) {#sleepseconds} - -在每个Block上休眠'seconds'秒。可以是整数或浮点数。 - -## sleepEachRow(秒) {#sleepeachrowseconds} - -在每行上休眠'seconds'秒。可以是整数或浮点数。 - -## 当前数据库() {#currentdatabase} - -返回当前数据库的名称。 -当您需要在CREATE TABLE中的表引擎参数中指定数据库,您可以使用此函数。 - -## isFinite(x) {#isfinitex} - -接受Float32或Float64类型的参数,如果参数不是infinite且不是NaN,则返回1,否则返回0。 - -## isInfinite(x) {#isinfinitex} - -接受Float32或Float64类型的参数,如果参数是infinite,则返回1,否则返回0。注意NaN返回0。 - -## isNaN(x) {#isnanx} - -接受Float32或Float64类型的参数,如果参数是Nan,则返回1,否则返回0。 - -## hasColumnInTable(\[‘hostname’\[, ‘username’\[, ‘password’\]\],\] ‘database’, ‘table’, ‘column’) {#hascolumnintablehostname-username-password-database-table-column} - -接受常量字符串:数据库名称、表名称和列名称。 如果存在列,则返回等于1的UInt8常量表达式,否则返回0。 如果设置了hostname参数,则测试将在远程服务器上运行。 -如果表不存在,该函数将引发异常。 -对于嵌套数据结构中的元素,该函数检查是否存在列。 对于嵌套数据结构本身,函数返回0。 - -## 酒吧 {#function-bar} - -使用unicode构建图表。 - -`bar(x, min, max, width)` 当`x = max`时, 绘制一个宽度与`(x - min)`成正比且等于`width`的字符带。 - -参数: - -- `x` — 要显示的尺寸。 -- `min, max` — 整数常量,该值必须是`Int64`。 -- `width` — 常量,可以是正整数或小数。 - -字符带的绘制精度是符号的八分之一。 - -示例: - -``` sql -SELECT - toHour(EventTime) AS h, - count() AS c, - bar(c, 0, 600000, 20) AS bar -FROM test.hits -GROUP BY h -ORDER BY h ASC -``` - - ┌──h─┬──────c─┬─bar────────────────┐ - │ 0 │ 292907 │ █████████▋ │ - │ 1 │ 180563 │ ██████ │ - │ 2 │ 114861 │ ███▋ │ - │ 3 │ 85069 │ ██▋ │ - │ 4 │ 68543 │ ██▎ │ - │ 5 │ 78116 │ ██▌ │ - │ 6 │ 113474 │ ███▋ │ - │ 7 │ 170678 │ █████▋ │ - │ 8 │ 278380 │ █████████▎ │ - │ 9 │ 391053 │ █████████████ │ - │ 10 │ 457681 │ ███████████████▎ │ - │ 11 │ 493667 │ ████████████████▍ │ - │ 12 │ 509641 │ ████████████████▊ │ - │ 13 │ 522947 │ █████████████████▍ │ - │ 14 │ 539954 │ █████████████████▊ │ - │ 15 │ 528460 │ █████████████████▌ │ - │ 16 │ 539201 │ █████████████████▊ │ - │ 17 │ 523539 │ █████████████████▍ │ - │ 18 │ 506467 │ ████████████████▊ │ - │ 19 │ 520915 │ █████████████████▎ │ - │ 20 │ 521665 │ █████████████████▍ │ - │ 21 │ 542078 │ ██████████████████ │ - │ 22 │ 493642 │ ████████████████▍ │ - │ 23 │ 400397 │ █████████████▎ │ - └────┴────────┴────────────────────┘ - -## 变换 {#transform} - -根据定义,将某些元素转换为其他元素。 -此函数有两种使用方式: - -1. `transform(x, array_from, array_to, default)` - -`x` – 要转换的值。 - -`array_from` – 用于转换的常量数组。 - -`array_to` – 将'from'中的值转换为的常量数组。 - -`default` – 如果'x'不等于'from'中的任何值,则默认转换的值。 - -`array_from` 和 `array_to` – 拥有相同大小的数组。 - -类型约束: - -`transform(T, Array(T), Array(U), U) -> U` - -`T`和`U`可以是String,Date,DateTime或任意数值类型的。 -对于相同的字母(T或U),如果数值类型,那么它们不可不完全匹配的,只需要具备共同的类型即可。 -例如,第一个参数是Int64类型,第二个参数是Array(UInt16)类型。 - -如果'x'值等于'array\_from'数组中的一个元素,它将从'array\_to'数组返回一个对应的元素(下标相同)。否则,它返回'default'。如果'array\_from'匹配到了多个元素,则返回第一个匹配的元素。 - -示例: - -``` sql -SELECT - transform(SearchEngineID, [2, 3], ['Yandex', 'Google'], 'Other') AS title, - count() AS c -FROM test.hits -WHERE SearchEngineID != 0 -GROUP BY title -ORDER BY c DESC -``` - - ┌─title─────┬──────c─┐ - │ Yandex │ 498635 │ - │ Google │ 229872 │ - │ Other │ 104472 │ - └───────────┴────────┘ - -1. `transform(x, array_from, array_to)` - -与第一种不同在于省略了'default'参数。 -如果'x'值等于'array\_from'数组中的一个元素,它将从'array\_to'数组返回相应的元素(下标相同)。 否则,它返回'x'。 - -类型约束: - -`transform(T, Array(T), Array(T)) -> T` - -示例: - -``` sql -SELECT - transform(domain(Referer), ['yandex.ru', 'google.ru', 'vk.com'], ['www.yandex', 'example.com']) AS s, - count() AS c -FROM test.hits -GROUP BY domain(Referer) -ORDER BY count() DESC -LIMIT 10 -``` - - ┌─s──────────────┬───────c─┐ - │ │ 2906259 │ - │ www.yandex │ 867767 │ - │ ███████.ru │ 313599 │ - │ mail.yandex.ru │ 107147 │ - │ ██████.ru │ 100355 │ - │ █████████.ru │ 65040 │ - │ news.yandex.ru │ 64515 │ - │ ██████.net │ 59141 │ - │ example.com │ 57316 │ - └────────────────┴─────────┘ - -## formatReadableSize(x) {#formatreadablesizex} - -接受大小(字节数)。返回带有后缀(KiB, MiB等)的字符串。 - -示例: - -``` sql -SELECT - arrayJoin([1, 1024, 1024*1024, 192851925]) AS filesize_bytes, - formatReadableSize(filesize_bytes) AS filesize -``` - - ┌─filesize_bytes─┬─filesize───┐ - │ 1 │ 1.00 B │ - │ 1024 │ 1.00 KiB │ - │ 1048576 │ 1.00 MiB │ - │ 192851925 │ 183.92 MiB │ - └────────────────┴────────────┘ - -## 至少(a,b) {#leasta-b} - -返回a和b中的最小值。 - -## 最伟大(a,b) {#greatesta-b} - -返回a和b的最大值。 - -## 碌莽禄time拢time() {#uptime} - -返回服务正常运行的秒数。 - -## 版本() {#version} - -以字符串形式返回服务器的版本。 - -## 时区() {#timezone} - -返回服务器的时区。 - -## blockNumber {#blocknumber} - -返回行所在的Block的序列号。 - -## rowNumberInBlock {#function-rownumberinblock} - -返回行所在Block中行的序列号。 针对不同的Block始终重新计算。 - -## rowNumberInAllBlocks() {#rownumberinallblocks} - -返回行所在结果集中的序列号。此函数仅考虑受影响的Block。 - -## 运行差异(x) {#other_functions-runningdifference} - -计算数据块中相邻行的值之间的差异。 -对于第一行返回0,并为每个后续行返回与前一行的差异。 - -函数的结果取决于受影响的Block和Block中的数据顺序。 -如果使用ORDER BY创建子查询并从子查询外部调用该函数,则可以获得预期结果。 - -示例: - -``` sql -SELECT - EventID, - EventTime, - runningDifference(EventTime) AS delta -FROM -( - SELECT - EventID, - EventTime - FROM events - WHERE EventDate = '2016-11-24' - ORDER BY EventTime ASC - LIMIT 5 -) -``` - - ┌─EventID─┬───────────EventTime─┬─delta─┐ - │ 1106 │ 2016-11-24 00:00:04 │ 0 │ - │ 1107 │ 2016-11-24 00:00:05 │ 1 │ - │ 1108 │ 2016-11-24 00:00:05 │ 0 │ - │ 1109 │ 2016-11-24 00:00:09 │ 4 │ - │ 1110 │ 2016-11-24 00:00:10 │ 1 │ - └─────────┴─────────────────────┴───────┘ - -## 运行差异启动与第一值 {#runningdifferencestartingwithfirstvalue} - -与[运行差异](./other_functions.md#other_functions-runningdifference)相同,区别在于第一行返回第一行的值,后续每个后续行返回与上一行的差值。 - -## MACNumToString(num) {#macnumtostringnum} - -接受一个UInt64类型的数字。 将其解释为big endian的MAC地址。 返回包含相应MAC地址的字符串,格式为AA:BB:CC:DD:EE:FF(以冒号分隔的十六进制形式的数字)。 - -## MACStringToNum(s) {#macstringtonums} - -与MACNumToString相反。 如果MAC地址格式无效,则返回0。 - -## MACStringToOUI(s) {#macstringtoouis} - -接受格式为AA:BB:CC:DD:EE:FF(十六进制形式的冒号分隔数字)的MAC地址。 返回前三个八位字节作为UInt64编号。 如果MAC地址格式无效,则返回0。 - -## getSizeOfEnumType {#getsizeofenumtype} - -返回[枚举](../../sql_reference/functions/other_functions.md)中的枚举数量。 - - getSizeOfEnumType(value) - -**参数:** - -- `value` — `Enum`类型的值。 - -**返回值** - -- `Enum`的枚举数量。 -- 如果类型不是`Enum`,则抛出异常。 - -**示例** - - SELECT getSizeOfEnumType( CAST('a' AS Enum8('a' = 1, 'b' = 2) ) ) AS x - - ┌─x─┐ - │ 2 │ - └───┘ - -## toColumnTypeName {#tocolumntypename} - -返回在RAM中列的数据类型的名称。 - - toColumnTypeName(value) - -**参数:** - -- `value` — 任何类型的值。 - -**返回值** - -- 一个字符串,其内容是`value`在RAM中的类型名称。 - -**`toTypeName ' 与 ' toColumnTypeName`的区别示例** - - :) select toTypeName(cast('2018-01-01 01:02:03' AS DateTime)) - - SELECT toTypeName(CAST('2018-01-01 01:02:03', 'DateTime')) - - ┌─toTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ - │ DateTime │ - └─────────────────────────────────────────────────────┘ - - 1 rows in set. Elapsed: 0.008 sec. - - :) select toColumnTypeName(cast('2018-01-01 01:02:03' AS DateTime)) - - SELECT toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime')) - - ┌─toColumnTypeName(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ - │ Const(UInt32) │ - └───────────────────────────────────────────────────────────┘ - -该示例显示`DateTime`数据类型作为`Const(UInt32)`存储在内存中。 - -## dumpColumnStructure {#dumpcolumnstructure} - -输出在RAM中的数据结果的详细信息。 - - dumpColumnStructure(value) - -**参数:** - -- `value` — 任何类型的值. - -**返回值** - -- 一个字符串,其内容是`value`在RAM中的数据结构的详细描述。 - -**示例** - - SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime')) - - ┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐ - │ DateTime, Const(size = 1, UInt32(size = 1)) │ - └──────────────────────────────────────────────────────────────┘ - -## defaultValueOfArgumentType {#defaultvalueofargumenttype} - -输出数据类型的默认值。 - -不包括用户设置的自定义列的默认值。 - - defaultValueOfArgumentType(expression) - -**参数:** - -- `expression` — 任意类型的值或导致任意类型值的表达式。 - -**返回值** - -- 数值类型返回`0`。 -- 字符串类型返回空的字符串。 -- [可为空](../../sql_reference/functions/other_functions.md)类型返回`ᴺᵁᴸᴸ`。 - -**示例** - - :) SELECT defaultValueOfArgumentType( CAST(1 AS Int8) ) - - SELECT defaultValueOfArgumentType(CAST(1, 'Int8')) - - ┌─defaultValueOfArgumentType(CAST(1, 'Int8'))─┐ - │ 0 │ - └─────────────────────────────────────────────┘ - - 1 rows in set. Elapsed: 0.002 sec. - - :) SELECT defaultValueOfArgumentType( CAST(1 AS Nullable(Int8) ) ) - - SELECT defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)')) - - ┌─defaultValueOfArgumentType(CAST(1, 'Nullable(Int8)'))─┐ - │ ᴺᵁᴸᴸ │ - └───────────────────────────────────────────────────────┘ - - 1 rows in set. Elapsed: 0.002 sec. - -## 复制 {#replicate} - -使用单个值填充一个数组。 - -用于[arrayJoin](array_join.md#functions_arrayjoin)的内部实现。 - - replicate(x, arr) - -**参数:** - -- `arr` — 原始数组。 ClickHouse创建一个与原始数据长度相同的新数组,并用值`x`填充它。 -- `x` — 生成的数组将被填充的值。 - -**输出** - -- 一个被`x`填充的数组。 - -**示例** - - SELECT replicate(1, ['a', 'b', 'c']) - - ┌─replicate(1, ['a', 'b', 'c'])─┐ - │ [1,1,1] │ - └───────────────────────────────┘ - -## 文件系统可用 {#filesystemavailable} - -返回磁盘的剩余空间信息(以字节为单位)。使用配置文件中的path配置评估此信息。 - -## 文件系统容量 {#filesystemcapacity} - -返回磁盘的容量信息,以字节为单位。使用配置文件中的path配置评估此信息。 - -## 最后聚会 {#function-finalizeaggregation} - -获取聚合函数的状态。返回聚合结果(最终状态)。 - -## 跑累积 {#function-runningaccumulate} - -获取聚合函数的状态并返回其具体的值。这是从第一行到当前行的所有行累计的结果。 - -例如,获取聚合函数的状态(示例runningAccumulate(uniqState(UserID))),对于数据块的每一行,返回所有先前行和当前行的状态合并后的聚合函数的结果。 -因此,函数的结果取决于分区中数据块的顺序以及数据块中行的顺序。 - -## joinGet(‘join\_storage\_table\_name’, ‘get\_column’,join\_key) {#joingetjoin-storage-table-name-get-column-join-key} - -使用指定的连接键从Join类型引擎的表中获取数据。 - -## modelEvaluate(model\_name, …) {#function-modelevaluate} - -使用外部模型计算。 -接受模型的名称以及模型的参数。返回Float64类型的值。 - -## throwIf(x) {#throwifx} - -如果参数不为零则抛出异常。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) diff --git a/docs/zh/sql_reference/functions/random_functions.md b/docs/zh/sql_reference/functions/random_functions.md deleted file mode 100644 index 1db2f4a8438..00000000000 --- a/docs/zh/sql_reference/functions/random_functions.md +++ /dev/null @@ -1,22 +0,0 @@ - -# 随机函数 {#sui-ji-han-shu} - -随机函数使用非加密方式生成伪随机数字。 - -所有随机函数都只接受一个参数或不接受任何参数。 -您可以向它传递任何类型的参数,但传递的参数将不会使用在任何随机数生成过程中。 -此参数的唯一目的是防止公共子表达式消除,以便在相同的查询中使用相同的随机函数生成不同的随机数。 - -## 兰德 {#rand} - -返回一个UInt32类型的随机数字,所有UInt32类型的数字被生成的概率均相等。此函数线性同于的方式生成随机数。 - -## rand64 {#rand64} - -返回一个UInt64类型的随机数字,所有UInt64类型的数字被生成的概率均相等。此函数线性同于的方式生成随机数。 - -## randConstant {#randconstant} - -返回一个UInt32类型的随机数字,该函数不同之处在于仅为每个数据块参数一个随机数。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) diff --git a/docs/zh/sql_reference/functions/rounding_functions.md b/docs/zh/sql_reference/functions/rounding_functions.md deleted file mode 100644 index 773f969090d..00000000000 --- a/docs/zh/sql_reference/functions/rounding_functions.md +++ /dev/null @@ -1,87 +0,0 @@ - -# 取整函数 {#qu-zheng-han-shu} - -## 楼(x\[,N\]) {#floorx-n} - -返回小于或等于x的最大舍入数。该函数使用参数乘1/10N,如果1/10N不精确,则选择最接近的精确的适当数据类型的数。 -'N'是一个整数常量,可选参数。默认为0,这意味着不对其进行舍入。 -'N'可以是负数。 - -示例: `floor(123.45, 1) = 123.4, floor(123.45, -1) = 120.` - -`x`是任何数字类型。结果与其为相同类型。 -对于整数参数,使用负'N'值进行舍入是有意义的(对于非负«N»,该函数不执行任何操作)。 -如果取整导致溢出(例如,floor(-128,-1)),则返回特定于实现的结果。 - -## ceil(x\[,N\]),天花板(x\[,N\]) {#ceilx-n-ceilingx-n} - -返回大于或等于'x'的最小舍入数。在其他方面,它与'floor'功能相同(见上文)。 - -## 圆形(x\[,N\]) {#rounding_functions-round} - -将值取整到指定的小数位数。 - -该函数按顺序返回最近的数字。如果给定数字包含多个最近数字,则函数返回其中最接近偶数的数字(银行的取整方式)。 - - round(expression [, decimal_places]) - -**参数:** - -- `expression` — 要进行取整的数字。可以是任何返回数字[类型](../../sql_reference/functions/rounding_functions.md#data_types)的[表达式](../syntax.md#syntax-expressions)。 -- `decimal-places` — 整数类型。 - - 如果`decimal-places > 0`,则该函数将值舍入小数点右侧。 - - 如果`decimal-places < 0`,则该函数将小数点左侧的值四舍五入。 - - 如果`decimal-places = 0`,则该函数将该值舍入为整数。在这种情况下,可以省略参数。 - -**返回值:** - -与输入数字相同类型的取整后的数字。 - -### 示例 {#shi-li} - -**使用示例** - -``` sql -SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3 -``` - - ┌───x─┬─round(divide(number, 2))─┐ - │ 0 │ 0 │ - │ 0.5 │ 0 │ - │ 1 │ 1 │ - └─────┴──────────────────────────┘ - -**取整的示例** - -取整到最近的数字。 - - round(3.2, 0) = 3 - round(4.1267, 2) = 4.13 - round(22,-1) = 20 - round(467,-2) = 500 - round(-467,-2) = -500 - -银行的取整。 - - round(3.5) = 4 - round(4.5) = 4 - round(3.55, 1) = 3.6 - round(3.65, 1) = 3.6 - -## roundToExp2(num) {#roundtoexp2num} - -接受一个数字。如果数字小于1,则返回0。否则,它将数字向下舍入到最接近的(整个非负)2的x次幂。 - -## 圆形饱和度(num) {#rounddurationnum} - -接受一个数字。如果数字小于1,则返回0。否则,它将数字向下舍入为集合中的数字:1,10,30,60,120,180,240,300,600,1200,1800,3600,7200,18000,36000。此函数用于Yandex.Metrica报表中计算会话的持续时长。 - -## 圆数(num) {#roundagenum} - -接受一个数字。如果数字小于18,则返回0。否则,它将数字向下舍入为集合中的数字:18,25,35,45,55。此函数用于Yandex.Metrica报表中用户年龄的计算。 - -## roundDown(num,arr) {#rounddownnum-arr} - -接受一个数字,将其向下舍入到指定数组中的元素。如果该值小于数组中的最低边界,则返回最低边界。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) diff --git a/docs/zh/sql_reference/functions/splitting_merging_functions.md b/docs/zh/sql_reference/functions/splitting_merging_functions.md deleted file mode 100644 index d217ea19f0d..00000000000 --- a/docs/zh/sql_reference/functions/splitting_merging_functions.md +++ /dev/null @@ -1,30 +0,0 @@ - -# 字符串拆分合并函数 {#zi-fu-chuan-chai-fen-he-bing-han-shu} - -## splitByChar(分隔符,s) {#splitbycharseparator-s} - -将字符串以'separator'拆分成多个子串。'separator'必须为仅包含一个字符的字符串常量。 -返回拆分后的子串的数组。 如果分隔符出现在字符串的开头或结尾,或者如果有多个连续的分隔符,则将在对应位置填充空的子串。 - -## splitByString(分隔符,s) {#splitbystringseparator-s} - -与上面相同,但它使用多个字符的字符串作为分隔符。 该字符串必须为非空。 - -## arrayStringConcat(arr\[,分隔符\]) {#arraystringconcatarr-separator} - -使用separator将数组中列出的字符串拼接起来。'separator'是一个可选参数:一个常量字符串,默认情况下设置为空字符串。 -返回拼接后的字符串。 - -## alphaTokens(s) {#alphatokenss} - -从范围a-z和A-Z中选择连续字节的子字符串。返回子字符串数组。 - -**示例:** - - SELECT alphaTokens('abca1abc') - - ┌─alphaTokens('abca1abc')─┐ - │ ['abca','abc'] │ - └─────────────────────────┘ - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) diff --git a/docs/zh/sql_reference/functions/string_functions.md b/docs/zh/sql_reference/functions/string_functions.md deleted file mode 100644 index c04305b9d67..00000000000 --- a/docs/zh/sql_reference/functions/string_functions.md +++ /dev/null @@ -1,170 +0,0 @@ - -# 字符串函数 {#zi-fu-chuan-han-shu} - -## 空 {#string-functions-empty} - -对于空字符串返回1,对于非空字符串返回0。 -结果类型是UInt8。 -如果字符串包含至少一个字节,则该字符串被视为非空字符串,即使这是一个空格或空字符。 -该函数也适用于数组。 - -## notEmpty {#notempty} - -对于空字符串返回0,对于非空字符串返回1。 -结果类型是UInt8。 -该函数也适用于数组。 - -## 长度 {#length} - -返回字符串的字节长度。 -结果类型是UInt64。 -该函数也适用于数组。 - -## 长度8 {#lengthutf8} - -假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 -结果类型是UInt64。 - -## char\_length,CHAR\_LENGTH {#char-length-char-length} - -假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 -结果类型是UInt64。 - -## 字符长度,字符长度 {#character-length-character-length} - -假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 -结果类型是UInt64。 - -## 低一点 {#lower-lcase} - -将字符串中的ASCII转换为小写。 - -## 上,ucase {#upper-ucase} - -将字符串中的ASCII转换为大写。 - -## lowerUTF8 {#lowerutf8} - -将字符串转换为小写,函数假设字符串是以UTF-8编码文本的字符集。 -同时函数不检测语言。因此对土耳其人来说,结果可能不完全正确。 -如果UTF-8字节序列的长度对于代码点的大写和小写不同,则该代码点的结果可能不正确。 -如果字符串包含一组非UTF-8的字节,则将引发未定义行为。 - -## upperUTF8 {#upperutf8} - -将字符串转换为大写,函数假设字符串是以UTF-8编码文本的字符集。 -同时函数不检测语言。因此对土耳其人来说,结果可能不完全正确。 -如果UTF-8字节序列的长度对于代码点的大写和小写不同,则该代码点的结果可能不正确。 -如果字符串包含一组非UTF-8的字节,则将引发未定义行为。 - -## isValidUTF8 {#isvalidutf8} - -检查字符串是否为有效的UTF-8编码,是则返回1,否则返回0。 - -## toValidUTF8 {#tovalidutf8} - -用`�`(U+FFFD)字符替换无效的UTF-8字符。所有连续的无效字符都会被替换为一个替换字符。 - - toValidUTF8( input_string ) - -参数: - -- input\_string — 任何一个[字符串](../../sql_reference/functions/string_functions.md)类型的对象。 - -返回值: 有效的UTF-8字符串。 - -### 示例 {#shi-li} - -``` sql -SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') -``` - -``` text -┌─toValidUTF8('a����b')─┐ -│ a�b │ -└───────────────────────┘ -``` - -## 反向 {#reverse} - -反转字符串。 - -## reverseUTF8 {#reverseutf8} - -以Unicode字符为单位反转UTF-8编码的字符串。如果字符串不是UTF-8编码,则可能获取到一个非预期的结果(不会抛出异常)。 - -## format(pattern, s0, s1, …) {#formatpattern-s0-s1} - -使用常量字符串`pattern`格式化其他参数。`pattern`字符串中包含由大括号`{}`包围的«替换字段»。 未被包含在大括号中的任何内容都被视为文本内容,它将原样保留在返回值中。 如果你需要在文本内容中包含一个大括号字符,它可以通过加倍来转义:`{{ '{{' }}`和`{{ '{{' }} '}}' }}`。 字段名称可以是数字(从零开始)或空(然后将它们视为连续数字) - -``` sql -SELECT format('{1} {0} {1}', 'World', 'Hello') - -┌─format('{1} {0} {1}', 'World', 'Hello')─┐ -│ Hello World Hello │ -└─────────────────────────────────────────┘ - -SELECT format('{} {}', 'Hello', 'World') - -┌─format('{} {}', 'Hello', 'World')─┐ -│ Hello World │ -└───────────────────────────────────┘ -``` - -## concat(s1, s2, …) {#concats1-s2} - -将参数中的多个字符串拼接,不带分隔符。 - -## concatAssumeInjective(s1, s2, …) {#concatassumeinjectives1-s2} - -与[concat](./string_functions.md#concat-s1-s2)相同,区别在于,你需要保证concat(s1, s2, s3) -\> s4是单射的,它将用于GROUP BY的优化。 - -## 子串(s,offset,length),mid(s,offset,length),substr(s,offset,length) {#substrings-offset-length-mids-offset-length-substrs-offset-length} - -以字节为单位截取指定位置字符串,返回以'offset'位置为开头,长度为'length'的子串。'offset'从1开始(与标准SQL相同)。'offset'和'length'参数必须是常量。 - -## substringf8(s,offset,length) {#substringutf8s-offset-length} - -与'substring'相同,但其操作单位为Unicode字符,函数假设字符串是以UTF-8进行编码的文本。如果不是则可能返回一个预期外的结果(不会抛出异常)。 - -## appendTrailingCharIfAbsent(s,c) {#appendtrailingcharifabsents-c} - -如果's'字符串非空并且末尾不包含'c'字符,则将'c'字符附加到末尾。 - -## convertCharset(s,from,to) {#convertcharsets-from-to} - -返回从'from'中的编码转换为'to'中的编码的字符串's'。 - -## base64Encode(s) {#base64encodes} - -将字符串's'编码成base64 - -## base64Decode(s) {#base64decodes} - -使用base64将字符串解码成原始字符串。如果失败则抛出异常。 - -## tryBase64Decode(s) {#trybase64decodes} - -使用base64将字符串解码成原始字符串。但如果出现错误,将返回空字符串。 - -## endsWith(s,后缀) {#endswiths-suffix} - -返回是否以指定的后缀结尾。如果字符串以指定的后缀结束,则返回1,否则返回0。 - -## 开始使用(s,前缀) {#startswiths-prefix} - -返回是否以指定的前缀开头。如果字符串以指定的前缀开头,则返回1,否则返回0。 - -## trimLeft(s) {#trimlefts} - -返回一个字符串,用于删除左侧的空白字符。 - -## trimRight(s) {#trimrights} - -返回一个字符串,用于删除右侧的空白字符。 - -## trimBoth(s) {#trimboths} - -返回一个字符串,用于删除任一侧的空白字符。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) diff --git a/docs/zh/sql_reference/functions/string_replace_functions.md b/docs/zh/sql_reference/functions/string_replace_functions.md deleted file mode 100644 index 04b110a2cef..00000000000 --- a/docs/zh/sql_reference/functions/string_replace_functions.md +++ /dev/null @@ -1,80 +0,0 @@ - -# 字符串替换函数 {#zi-fu-chuan-ti-huan-han-shu} - -## replaceOne(大海捞针,模式,更换) {#replaceonehaystack-pattern-replacement} - -用'replacement'子串替换'haystack'中与'pattern'子串第一个匹配的匹配项(如果存在)。 -'pattern'和'replacement'必须是常量。 - -## replaceAll(大海捞针,模式,替换),替换(大海捞针,模式,替换) {#replaceallhaystack-pattern-replacement-replacehaystack-pattern-replacement} - -用'replacement'子串替换'haystack'中出现的所有'pattern'子串。 - -## replaceRegexpOne(大海捞针,模式,更换) {#replaceregexponehaystack-pattern-replacement} - -使用'pattern'正则表达式替换。 ‘pattern’可以是任意一个有效的re2正则表达式。 -如果存在与正则表达式匹配的匹配项,仅替换第一个匹配项。 -同时‘replacement’可以指定为正则表达式中的捕获组。可以包含`\0-\9`。 -在这种情况下,函数将使用正则表达式的整个匹配项替换‘\\0’。使用其他与之对应的子模式替换对应的'\\1-\\9'。要在模版中使用''字符,请使用''将其转义。 -另外还请记住,字符串文字需要额外的转义。 - -示例1.将日期转换为美国格式: - -``` sql -SELECT DISTINCT - EventDate, - replaceRegexpOne(toString(EventDate), '(\\d{4})-(\\d{2})-(\\d{2})', '\\2/\\3/\\1') AS res -FROM test.hits -LIMIT 7 -FORMAT TabSeparated -``` - - 2014-03-17 03/17/2014 - 2014-03-18 03/18/2014 - 2014-03-19 03/19/2014 - 2014-03-20 03/20/2014 - 2014-03-21 03/21/2014 - 2014-03-22 03/22/2014 - 2014-03-23 03/23/2014 - -示例2.复制字符串十次: - -``` sql -SELECT replaceRegexpOne('Hello, World!', '.*', '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') AS res -``` - - ┌─res────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World! │ - └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ - -## replaceRegexpAll(大海捞针,模式,替换) {#replaceregexpallhaystack-pattern-replacement} - -与replaceRegexpOne相同,但会替换所有出现的匹配项。例如: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '.', '\\0\\0') AS res -``` - - ┌─res────────────────────────┐ - │ HHeelllloo,, WWoorrlldd!! │ - └────────────────────────────┘ - -例外的是,如果使用正则表达式捕获空白子串,则仅会进行一次替换。 -示例: - -``` sql -SELECT replaceRegexpAll('Hello, World!', '^', 'here: ') AS res -``` - - ┌─res─────────────────┐ - │ here: Hello, World! │ - └─────────────────────┘ - -## regexpQuoteMeta(s) {#regexpquotemetas} - -该函数用于在字符串中的某些预定义字符之前添加反斜杠。 -预定义字符:‘0’,‘\\’,‘\|’,‘(’,‘)’,‘^’,‘$’,‘。’,‘\[’,'\]',‘?’,‘\*’,‘+’,‘{’,‘:’,' - '。 -这个实现与re2 :: RE2 :: QuoteMeta略有不同。它以\\0而不是00转义零字节,它只转义所需的字符。 -有关详细信息,请参阅链接:\[RE2\](https://github.com/google/re2/blob/master/re2/re2.cc\#L473) - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) diff --git a/docs/zh/sql_reference/functions/string_search_functions.md b/docs/zh/sql_reference/functions/string_search_functions.md deleted file mode 100644 index e0f5e06a357..00000000000 --- a/docs/zh/sql_reference/functions/string_search_functions.md +++ /dev/null @@ -1,123 +0,0 @@ - -# 字符串搜索函数 {#zi-fu-chuan-sou-suo-han-shu} - -下列所有函数在默认的情况下区分大小写。对于不区分大小写的搜索,存在单独的变体。 - -## 位置(大海捞针),定位(大海捞针) {#positionhaystack-needle-locatehaystack-needle} - -在字符串`haystack`中搜索子串`needle`。 -返回子串的位置(以字节为单位),从1开始,如果未找到子串,则返回0。 - -对于不区分大小写的搜索,请使用函数`positionCaseInsensitive`。 - -## positionUTF8(大海捞针) {#positionutf8haystack-needle} - -与`position`相同,但位置以Unicode字符返回。此函数工作在UTF-8编码的文本字符集中。如非此编码的字符集,则返回一些非预期结果(他不会抛出异常)。 - -对于不区分大小写的搜索,请使用函数`positionCaseInsensitiveUTF8`。 - -## 多搜索分配(干草堆,\[针1,针2, …, needlen\]) {#multisearchallpositionshaystack-needle1-needle2-needlen} - -与`position`相同,但函数返回一个数组,其中包含所有匹配needle的位置。 - -对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchAllPositionsCaseInsensitive,multiSearchAllPositionsUTF8,multiSearchAllPositionsCaseInsensitiveUTF8`。 - -## multiSearchFirstPosition(大海捞针,\[针1,针2, …, needlen\]) {#multisearchfirstpositionhaystack-needle1-needle2-needlen} - -与`position`相同,但返回在`haystack`中与needles字符串匹配的最左偏移。 - -对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchFirstPositionCaseInsensitive,multiSearchFirstPositionUTF8,multiSearchFirstPositionCaseInsensitiveUTF8`。 - -## multiSearchFirstIndex(大海捞针,\[针1,针2, …, needlen\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen} - -返回在字符串`haystack`中最先查找到的needle的索引`i`(从1开始),没有找到任何匹配项则返回0。 - -对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchFirstIndexCaseInsensitive,multiSearchFirstIndexUTF8,multiSearchFirstIndexCaseInsensitiveUTF8`。 - -## 多搜索(大海捞针,\[针1,针2, …, needlen\]) {#multisearchanyhaystack-needle1-needle2-needlen} - -如果`haystack`中至少存在一个needle匹配则返回1,否则返回0。 - -对于不区分大小写的搜索或/和UTF-8格式,使用函数`multiSearchAnyCaseInsensitive,multiSearchAnyUTF8,multiSearchAnyCaseInsensitiveUTF8`。 - -!!! note "注意" - 在所有`multiSearch*`函数中,由于实现规范,needles的数量应小于28。 - -## 匹配(大海捞针,模式) {#matchhaystack-pattern} - -检查字符串是否与`pattern`正则表达式匹配。`pattern`可以是一个任意的`re2`正则表达式。 `re2`正则表达式的[语法](https://github.com/google/re2/wiki/Syntax)比Perl正则表达式的语法存在更多限制。 - -如果不匹配返回0,否则返回1。 - -请注意,反斜杠符号(`\`)用于在正则表达式中转义。由于字符串中采用相同的符号来进行转义。因此,为了在正则表达式中转义符号,必须在字符串文字中写入两个反斜杠(\\)。 - -正则表达式与字符串一起使用,就像它是一组字节一样。正则表达式中不能包含空字节。 -对于在字符串中搜索子字符串的模式,最好使用LIKE或«position»,因为它们更加高效。 - -## multiMatchAny(大海捞针,\[模式1,模式2, …, patternn\]) {#multimatchanyhaystack-pattern1-pattern2-patternn} - -与`match`相同,但如果所有正则表达式都不匹配,则返回0;如果任何模式匹配,则返回1。它使用[超扫描](https://github.com/intel/hyperscan)库。对于在字符串中搜索子字符串的模式,最好使用«multisearchany»,因为它更高效。 - -!!! note "注意" - 任何`haystack`字符串的长度必须小于232\字节,否则抛出异常。这种限制是因为hyperscan API而产生的。 - -## multiMatchAnyIndex(大海捞针,\[模式1,模式2, …, patternn\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn} - -与`multiMatchAny`相同,但返回与haystack匹配的任何内容的索引位置。 - -## multiFuzzyMatchAny(干草堆,距离,\[模式1,模式2, …, patternn\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn} - -与`multiMatchAny`相同,但如果在haystack能够查找到任何模式匹配能够在指定的[编辑距离](https://en.wikipedia.org/wiki/Edit_distance)内进行匹配,则返回1。此功能也处于实验模式,可能非常慢。有关更多信息,请参阅[hyperscan文档](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching)。 - -## multiFuzzyMatchAnyIndex(大海捞针,距离,\[模式1,模式2, …, patternn\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn} - -与`multiFuzzyMatchAny`相同,但返回匹配项的匹配能容的索引位置。 - -!!! note "注意" - `multiFuzzyMatch*`函数不支持UTF-8正则表达式,由于hyperscan限制,这些表达式被按字节解析。 - -!!! note "注意" - 如要关闭所有hyperscan函数的使用,请设置`SET allow_hyperscan = 0;`。 - -## 提取(大海捞针,图案) {#extracthaystack-pattern} - -使用正则表达式截取字符串。如果'haystack'与'pattern'不匹配,则返回空字符串。如果正则表达式中不包含子模式,它将获取与整个正则表达式匹配的子串。否则,它将获取与第一个子模式匹配的子串。 - -## extractAll(大海捞针,图案) {#extractallhaystack-pattern} - -使用正则表达式提取字符串的所有片段。如果'haystack'与'pattern'正则表达式不匹配,则返回一个空字符串。否则返回所有与正则表达式匹配的字符串数组。通常,行为与'extract'函数相同(它采用第一个子模式,如果没有子模式,则采用整个表达式)。 - -## 像(干草堆,模式),干草堆像模式运算符 {#likehaystack-pattern-haystack-like-pattern-operator} - -检查字符串是否与简单正则表达式匹配。 -正则表达式可以包含的元符号有`%`和`_`。 - -`%` 表示任何字节数(包括零字符)。 - -`_` 表示任何一个字节。 - -可以使用反斜杠(`\`)来对元符号进行转义。请参阅«match»函数说明中有关转义的说明。 - -对于像`%needle%`这样的正则表达式,改函数与`position`函数一样快。 -对于其他正则表达式,函数与'match'函数相同。 - -## 不喜欢(干草堆,模式),干草堆不喜欢模式运算符 {#notlikehaystack-pattern-haystack-not-like-pattern-operator} - -与'like'函数返回相反的结果。 - -## 大海捞针) {#ngramdistancehaystack-needle} - -基于4-gram计算`haystack`和`needle`之间的距离:计算两个4-gram集合之间的对称差异,并用它们的基数和对其进行归一化。返回0到1之间的任何浮点数 – 越接近0则表示越多的字符串彼此相似。如果常量的`needle`或`haystack`超过32KB,函数将抛出异常。如果非常量的`haystack`或`needle`字符串超过32Kb,则距离始终为1。 - -对于不区分大小写的搜索或/和UTF-8格式,使用函数`ngramDistanceCaseInsensitive,ngramDistanceUTF8,ngramDistanceCaseInsensitiveUTF8`。 - -## ツ暗ェツ氾环催ツ団ツ法ツ人) {#ngramsearchhaystack-needle} - -与`ngramDistance`相同,但计算`needle`和`haystack`之间的非对称差异——`needle`的n-gram减去`needle`归一化n-gram。可用于模糊字符串搜索。 - -对于不区分大小写的搜索或/和UTF-8格式,使用函数`ngramSearchCaseInsensitive,ngramSearchUTF8,ngramSearchCaseInsensitiveUTF8`。 - -!!! note "注意" - 对于UTF-8,我们使用3-gram。所有这些都不是完全公平的n-gram距离。我们使用2字节哈希来散列n-gram,然后计算这些哈希表之间的(非)对称差异 - 可能会发生冲突。对于UTF-8不区分大小写的格式,我们不使用公平的`tolower`函数 - 我们将每个Unicode字符字节的第5位(从零开始)和字节的第一位归零 - 这适用于拉丁语,主要用于所有西里尔字母。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) diff --git a/docs/zh/sql_reference/functions/type_conversion_functions.md b/docs/zh/sql_reference/functions/type_conversion_functions.md deleted file mode 100644 index 56375eabc07..00000000000 --- a/docs/zh/sql_reference/functions/type_conversion_functions.md +++ /dev/null @@ -1,170 +0,0 @@ - -# 类型转换函数 {#lei-xing-zhuan-huan-han-shu} - -## toUInt8,toUInt16,toUInt32,toUInt64 {#touint8-touint16-touint32-touint64} - -## toInt8,toInt16,toInt32,toInt64 {#toint8-toint16-toint32-toint64} - -## toFloat32,toFloat64 {#tofloat32-tofloat64} - -## 今天,今天 {#todate-todatetime} - -## toUInt8OrZero,toUInt16OrZero,toUInt32OrZero,toUInt64OrZero,toInt8OrZero,toInt16OrZero,toInt32OrZero,toInt64OrZero,toFloat32OrZero,toFloat64OrZero,toDateOrZero,toDateTimeOrZero {#touint8orzero-touint16orzero-touint32orzero-touint64orzero-toint8orzero-toint16orzero-toint32orzero-toint64orzero-tofloat32orzero-tofloat64orzero-todateorzero-todatetimeorzero} - -## toUInt8OrNull,toUInt16OrNull,toUInt32OrNull,toUInt64OrNull,toInt8OrNull,toInt16OrNull,toInt32OrNull,toInt64OrNull,toFloat32OrNull,toFloat64OrNull,toDateOrNull,toDateTimeOrNull {#touint8ornull-touint16ornull-touint32ornull-touint64ornull-toint8ornull-toint16ornull-toint32ornull-toint64ornull-tofloat32ornull-tofloat64ornull-todateornull-todatetimeornull} - -## toString {#tostring} - -这些函数用于在数字、字符串(不包含FixedString)、Date以及DateTime之间互相转换。 -所有的函数都接受一个参数。 - -当将其他类型转换到字符串或从字符串转换到其他类型时,使用与TabSeparated格式相同的规则对字符串的值进行格式化或解析。如果无法解析字符串则抛出异常并取消查询。 - -当将Date转换为数字或反之,Date对应Unix时间戳的天数。 -将DataTime转换为数字或反之,DateTime对应Unix时间戳的秒数。 - -toDate/toDateTime函数的日期和日期时间格式定义如下: - - YYYY-MM-DD - YYYY-MM-DD hh:mm:ss - -例外的是,如果将UInt32、Int32、UInt64或Int64类型的数值转换为Date类型,并且其对应的值大于等于65536,则该数值将被解析成unix时间戳(而不是对应的天数)。这意味着允许写入'toDate(unix\_timestamp)'这种常见情况,否则这将是错误的,并且需要便携更加繁琐的'toDate(toDateTime(unix\_timestamp))'。 - -Date与DateTime之间的转换以更为自然的方式进行:通过添加空的time或删除time。 - -数值类型之间的转换与C++中不同数字类型之间的赋值相同的规则。 - -此外,DateTime参数的toString函数可以在第二个参数中包含时区名称。 例如:`Asia/Yekaterinburg`在这种情况下,时间根据指定的时区进行格式化。 - -``` sql -SELECT - now() AS now_local, - toString(now(), 'Asia/Yekaterinburg') AS now_yekat -``` - - ┌───────────now_local─┬─now_yekat───────────┐ - │ 2016-06-15 00:11:21 │ 2016-06-15 02:11:21 │ - └─────────────────────┴─────────────────────┘ - -另请参阅`toUnixTimestamp`函数。 - -## toDecimal32(value,S),toDecimal64(value,S),toDecimal128(value,S) {#todecimal32value-s-todecimal64value-s-todecimal128value-s} - -将`value`转换为精度为`S`的[十进制](../../sql_reference/functions/type_conversion_functions.md)。`value`可以是数字或字符串。`S`参数为指定的小数位数。 - -## toFixedString(s,N) {#tofixedstrings-n} - -将String类型的参数转换为FixedString(N)类型的值(具有固定长度N的字符串)。N必须是一个常量。 -如果字符串的字节数少于N,则向右填充空字节。如果字符串的字节数多于N,则抛出异常。 - -## toStringCutToZero(s) {#tostringcuttozeros} - -接受String或FixedString参数。返回String,其内容在找到的第一个零字节处被截断。 - -示例: - -``` sql -SELECT toFixedString('foo', 8) AS s, toStringCutToZero(s) AS s_cut -``` - - ┌─s─────────────┬─s_cut─┐ - │ foo\0\0\0\0\0 │ foo │ - └───────────────┴───────┘ - -``` sql -SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut -``` - - ┌─s──────────┬─s_cut─┐ - │ foo\0bar\0 │ foo │ - └────────────┴───────┘ - -## reinterpretAsUInt8,reinterpretAsUInt16,reinterpretAsUInt32,reinterpretAsUInt64 {#reinterpretasuint8-reinterpretasuint16-reinterpretasuint32-reinterpretasuint64} - -## reinterpretAsInt8,reinterpretAsInt16,reinterpretAsInt32,reinterpretAsInt64 {#reinterpretasint8-reinterpretasint16-reinterpretasint32-reinterpretasint64} - -## reinterpretAsFloat32,reinterpretAsFloat64 {#reinterpretasfloat32-reinterpretasfloat64} - -## 重新解释日期,重新解释日期时间 {#reinterpretasdate-reinterpretasdatetime} - -这些函数接受一个字符串,并将放在字符串开头的字节解释为主机顺序中的数字(little endian)。如果字符串不够长,则函数就像使用必要数量的空字节填充字符串一样。如果字符串比需要的长,则忽略额外的字节。Date被解释为Unix时间戳的天数,DateTime被解释为Unix时间戳。 - -## 重新解释字符串 {#reinterpretasstring} - -此函数接受数字、Date或DateTime,并返回一个字符串,其中包含表示主机顺序(小端)的相应值的字节。从末尾删除空字节。例如,UInt32类型值255是一个字节长的字符串。 - -## reinterpretAsFixedString {#reinterpretasfixedstring} - -此函数接受数字、Date或DateTime,并返回包含表示主机顺序(小端)的相应值的字节的FixedString。从末尾删除空字节。例如,UInt32类型值255是一个长度为一个字节的FixedString。 - -## 演员(x,t) {#type_conversion_function-cast} - -将'x'转换为't'数据类型。还支持语法CAST(x AS t) - -示例: - -``` sql -SELECT - '2016-06-15 23:00:00' AS timestamp, - CAST(timestamp AS DateTime) AS datetime, - CAST(timestamp AS Date) AS date, - CAST(timestamp, 'String') AS string, - CAST(timestamp, 'FixedString(22)') AS fixed_string -``` - - ┌─timestamp───────────┬────────────datetime─┬───────date─┬─string──────────────┬─fixed_string──────────────┐ - │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00 │ 2016-06-15 │ 2016-06-15 23:00:00 │ 2016-06-15 23:00:00\0\0\0 │ - └─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘ - -将参数转换为FixedString(N),仅适用于String或FixedString(N)类型的参数。 - -支持将数据转换为[可为空](../../sql_reference/functions/type_conversion_functions.md)。例如: - - SELECT toTypeName(x) FROM t_null - - ┌─toTypeName(x)─┐ - │ Int8 │ - │ Int8 │ - └───────────────┘ - - SELECT toTypeName(CAST(x, 'Nullable(UInt16)')) FROM t_null - - ┌─toTypeName(CAST(x, 'Nullable(UInt16)'))─┐ - │ Nullable(UInt16) │ - │ Nullable(UInt16) │ - └─────────────────────────────────────────┘ - -## 每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每天每 {#function-tointerval} - -将数字类型参数转换为Interval类型(时间区间)。 -Interval类型实际上是非常有用的,您可以使用此类型的数据直接与Date或DateTime执行算术运算。同时,ClickHouse为Interval类型数据的声明提供了更方便的语法。例如: - -``` sql -WITH - toDate('2019-01-01') AS date, - INTERVAL 1 WEEK AS interval_week, - toIntervalWeek(1) AS interval_to_week -SELECT - date + interval_week, - date + interval_to_week -``` - - ┌─plus(date, interval_week)─┬─plus(date, interval_to_week)─┐ - │ 2019-01-08 │ 2019-01-08 │ - └───────────────────────────┴──────────────────────────────┘ - -## parsedatetimebestefort {#type_conversion_functions-parsedatetimebesteffort} - -将数字类型参数解析为Date或DateTime类型。 -与toDate和toDateTime不同,parseDateTimeBestEffort可以进行更复杂的日期格式。 -有关详细信息,请参阅链接:[复杂日期格式](https://xkcd.com/1179/)。 - -## parsedatetimebestefortornull {#parsedatetimebesteffortornull} - -与[parsedatetimebestefort](#type_conversion_functions-parsedatetimebesteffort)相同,但它遇到无法处理的日期格式时返回null。 - -## parsedatetimebestefortorzero {#parsedatetimebesteffortorzero} - -与[parsedatetimebestefort](#type_conversion_functions-parsedatetimebesteffort)相同,但它遇到无法处理的日期格式时返回零Date或零DateTime。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) diff --git a/docs/zh/sql_reference/functions/url_functions.md b/docs/zh/sql_reference/functions/url_functions.md deleted file mode 100644 index 53295221e51..00000000000 --- a/docs/zh/sql_reference/functions/url_functions.md +++ /dev/null @@ -1,119 +0,0 @@ - -# URL函数 {#urlhan-shu} - -所有这些功能都不遵循RFC。它们被最大程度简化以提高性能。 - -## URL截取函数 {#urljie-qu-han-shu} - -如果URL中没有要截取的内容则返回空字符串。 - -### 协议 {#protocol} - -返回URL的协议。例如: http、ftp、mailto、magnet… - -### 域 {#domain} - -获取域名。 - -### domainwithoutww {#domainwithoutwww} - -返回域名并删除第一个'www.'。 - -### topLevelDomain {#topleveldomain} - -返回顶级域名。例如:.ru。 - -### 第一重要的元素分区域 {#firstsignificantsubdomain} - -返回«第一个有效子域名»。这并不是一个标准概念,仅用于Yandex.Metrica。如果顶级域名为'com',‘net’,‘org’或者‘co’则第一个有效子域名为二级域名。否则则返回三级域名。例如,irstSignificantSubdomain (’https://news.yandex.ru/‘) = ’yandex’, firstSignificantSubdomain (‘https://news.yandex.com.tr/’) = ‘yandex’。一些实现细节在未来可能会进行改变。 - -### cutToFirstSignificantSubdomain {#cuttofirstsignificantsubdomain} - -返回包含顶级域名与第一个有效子域名之间的内容(请参阅上面的内容)。 - -例如, `cutToFirstSignificantSubdomain('https://news.yandex.com.tr/') = 'yandex.com.tr'`. - -### 路径 {#path} - -返回URL路径。例如:`/top/news.html`,不包含请求参数。 - -### pathFull {#pathfull} - -与上面相同,但包括请求参数和fragment。例如:/top/news.html?page=2\#comments - -### 查询字符串 {#querystring} - -返回请求参数。例如:page=1&lr=213。请求参数不包含问号已经\# 以及\# 之后所有的内容。 - -### 片段 {#fragment} - -返回URL的fragment标识。fragment不包含\#。 - -### querystring andfragment {#querystringandfragment} - -返回请求参数和fragment标识。例如:page=1\#29390。 - -### extractURLParameter(URL,name) {#extracturlparameterurl-name} - -返回URL请求参数中名称为'name'的参数。如果不存在则返回一个空字符串。如果存在多个匹配项则返回第一个相匹配的。此函数假设参数名称与参数值在url中的编码方式相同。 - -### extractURLParameters(URL) {#extracturlparametersurl} - -返回一个数组,其中以name=value的字符串形式返回url的所有请求参数。不以任何编码解析任何内容。 - -### extractURLParameterNames(URL) {#extracturlparameternamesurl} - -返回一个数组,其中包含url的所有请求参数的名称。不以任何编码解析任何内容。 - -### URLHierarchy(URL) {#urlhierarchyurl} - -返回一个数组,其中包含以/切割的URL的所有内容。?将被包含在URL路径以及请求参数中。连续的分割符号被记为一个。 - -### Urlpathhierarchy(URL) {#urlpathhierarchyurl} - -与上面相同,但结果不包含协议和host部分。 /element(root)不包括在内。该函数用于在Yandex.Metric中实现导出URL的树形结构。 - - URLPathHierarchy('https://example.com/browse/CONV-6788') = - [ - '/browse/', - '/browse/CONV-6788' - ] - -### decodeURLComponent(URL) {#decodeurlcomponenturl} - -返回已经解码的URL。 -例如: - -``` sql -SELECT decodeURLComponent('http://127.0.0.1:8123/?query=SELECT%201%3B') AS DecodedURL; -``` - - ┌─DecodedURL─────────────────────────────┐ - │ http://127.0.0.1:8123/?query=SELECT 1; │ - └────────────────────────────────────────┘ - -## 删除URL中的部分内容 {#shan-chu-urlzhong-de-bu-fen-nei-rong} - -如果URL中不包含指定的部分,则URL不变。 - -### cutWWW {#cutwww} - -删除开始的第一个'www.'。 - -### cutQueryString {#cutquerystring} - -删除请求参数。问号也将被删除。 - -### cutFragment {#cutfragment} - -删除fragment标识。\#同样也会被删除。 - -### cutquerystring andfragment {#cutquerystringandfragment} - -删除请求参数以及fragment标识。问号以及\#也会被删除。 - -### cutURLParameter(URL,name) {#cuturlparameterurl-name} - -删除URL中名称为'name'的参数。改函数假设参数名称以及参数值经过URL相同的编码。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) diff --git a/docs/zh/sql_reference/functions/uuid_functions.md b/docs/zh/sql_reference/functions/uuid_functions.md deleted file mode 100644 index 306a55f08a0..00000000000 --- a/docs/zh/sql_reference/functions/uuid_functions.md +++ /dev/null @@ -1,108 +0,0 @@ - -# UUID函数 {#uuidhan-shu} - -下面列出了所有UUID的相关函数 - -## generateuidv4 {#uuid-function-generate} - -生成一个UUID([版本4](https://tools.ietf.org/html/rfc4122#section-4.4))。 - -``` sql -generateUUIDv4() -``` - -**返回值** - -UUID类型的值。 - -**使用示例** - -此示例演示如何在表中创建UUID类型的列,并对其写入数据。 - -``` sql -:) CREATE TABLE t_uuid (x UUID) ENGINE=TinyLog - -:) INSERT INTO t_uuid SELECT generateUUIDv4() - -:) SELECT * FROM t_uuid - -┌────────────────────────────────────x─┐ -│ f4bf890f-f9dc-4332-ad5c-0c18e73f28e9 │ -└──────────────────────────────────────┘ -``` - -## toUUID(x) {#touuid-x} - -将String类型的值转换为UUID类型的值。 - -``` sql -toUUID(String) -``` - -**返回值** - -UUID类型的值 - -**使用示例** - -``` sql -:) SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS uuid - -┌─────────────────────────────────uuid─┐ -│ 61f0c404-5cb3-11e7-907b-a6006ad3dba0 │ -└──────────────────────────────────────┘ -``` - -## UUIDStringToNum {#uuidstringtonum} - -接受一个String类型的值,其中包含36个字符且格式为`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,将其转换为UUID的数值并以[固定字符串(16)](../../sql_reference/functions/uuid_functions.md)将其返回。 - -``` sql -UUIDStringToNum(String) -``` - -**返回值** - -固定字符串(16) - -**使用示例** - -``` sql -:) SELECT - '612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, - UUIDStringToNum(uuid) AS bytes - -┌─uuid─────────────────────────────────┬─bytes────────────┐ -│ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ -└──────────────────────────────────────┴──────────────────┘ -``` - -## UUIDNumToString {#uuidnumtostring} - -接受一个[固定字符串(16)](../../sql_reference/functions/uuid_functions.md)类型的值,返回其对应的String表现形式。 - -``` sql -UUIDNumToString(FixedString(16)) -``` - -**返回值** - -字符串。 - -**使用示例** - -``` sql -SELECT - 'a/<@];!~p{jTj={)' AS bytes, - UUIDNumToString(toFixedString(bytes, 16)) AS uuid - -┌─bytes────────────┬─uuid─────────────────────────────────┐ -│ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ -└──────────────────┴──────────────────────────────────────┘ -``` - -## 另请参阅 {#ling-qing-can-yue} - -- [dictgetuid](ext_dict_functions.md) - -[来源文章](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) diff --git a/docs/zh/sql_reference/functions/ym_dict_functions.md b/docs/zh/sql_reference/functions/ym_dict_functions.md deleted file mode 100644 index 87492ec9d12..00000000000 --- a/docs/zh/sql_reference/functions/ym_dict_functions.md +++ /dev/null @@ -1,121 +0,0 @@ - -# 功能与Yandex的工作。梅特里卡词典 {#functions-for-working-with-yandex-metrica-dictionaries} - -为了使下面的功能正常工作,服务器配置必须指定获取所有Yandex的路径和地址。梅特里卡字典. 字典在任何这些函数的第一次调用时加载。 如果无法加载引用列表,则会引发异常。 - -For information about creating reference lists, see the section «Dictionaries». - -## 多个地理基 {#multiple-geobases} - -ClickHouse支持同时使用多个备选地理基(区域层次结构),以支持某些地区所属国家的各种观点。 - -该 ‘clickhouse-server’ config指定具有区域层次结构的文件::`/opt/geo/regions_hierarchy.txt` - -除了这个文件,它还搜索附近有\_符号和任何后缀附加到名称(文件扩展名之前)的文件。 -例如,它还会找到该文件 `/opt/geo/regions_hierarchy_ua.txt`,如果存在。 - -`ua` 被称为字典键。 对于没有后缀的字典,键是空字符串。 - -所有字典都在运行时重新加载(每隔一定数量的秒重新加载一次,如builtin\_dictionaries\_reload\_interval config参数中定义,或默认情况下每小时一次)。 但是,可用字典列表在服务器启动时定义一次。 - -All functions for working with regions have an optional argument at the end – the dictionary key. It is referred to as the geobase. -示例: - - regionToCountry(RegionID) – Uses the default dictionary: /opt/geo/regions_hierarchy.txt - regionToCountry(RegionID, '') – Uses the default dictionary: /opt/geo/regions_hierarchy.txt - regionToCountry(RegionID, 'ua') – Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt - -### ツ环板(ョツ嘉ッツ偲青regionシツ氾カツ鉄ツ工ツ渉\]) {#regiontocityid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0. - -### 虏茅驴麓卤戮碌禄路戮鲁拢\]) {#regiontoareaid-geobase} - -将区域转换为区域(地理数据库中的类型5)。 在所有其他方式,这个功能是一样的 ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - - ┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐ - │ │ - │ Moscow and Moscow region │ - │ St. Petersburg and Leningrad region │ - │ Belgorod region │ - │ Ivanovsk region │ - │ Kaluga region │ - │ Kostroma region │ - │ Kursk region │ - │ Lipetsk region │ - │ Orlov region │ - │ Ryazan region │ - │ Smolensk region │ - │ Tambov region │ - │ Tver region │ - │ Tula region │ - └──────────────────────────────────────────────────────┘ - -### regionToDistrict(id\[,geobase\]) {#regiontodistrictid-geobase} - -将区域转换为联邦区(地理数据库中的类型4)。 在所有其他方式,这个功能是一样的 ‘regionToCity’. - -``` sql -SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua')) -FROM system.numbers -LIMIT 15 -``` - - ┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐ - │ │ - │ Central federal district │ - │ Northwest federal district │ - │ South federal district │ - │ North Caucases federal district │ - │ Privolga federal district │ - │ Ural federal district │ - │ Siberian federal district │ - │ Far East federal district │ - │ Scotland │ - │ Faroe Islands │ - │ Flemish region │ - │ Brussels capital region │ - │ Wallonia │ - │ Federation of Bosnia and Herzegovina │ - └──────────────────────────────────────────────────────────┘ - -### 虏茅驴麓卤戮碌禄路戮鲁拢(陆毛隆隆(803)888-8325\]) {#regiontocountryid-geobase} - -将区域转换为国家。 在所有其他方式,这个功能是一样的 ‘regionToCity’. -示例: `regionToCountry(toUInt32(213)) = 225` 转换莫斯科(213)到俄罗斯(225)。 - -### 掳胫((禄脢鹿脷露胫鲁隆鹿((酶-11-16""\[脪陆,ase\]) {#regiontocontinentid-geobase} - -将区域转换为大陆。 在所有其他方式,这个功能是一样的 ‘regionToCity’. -示例: `regionToContinent(toUInt32(213)) = 10001` 将莫斯科(213)转换为欧亚大陆(10001)。 - -### ツ环板(ョツ嘉ッツ偲青regionャツ静ャツ青サツ催ャツ渉\]) {#regiontopopulationid-geobase} - -获取区域的人口。 -The population can be recorded in files with the geobase. See the section «External dictionaries». -如果没有为该区域记录人口,则返回0。 -在Yandex地理数据库中,可能会为子区域记录人口,但不会为父区域记录人口。 - -### regionIn(lhs,rhs\[,地理数据库\]) {#regioninlhs-rhs-geobase} - -检查是否 ‘lhs’ 属于一个区域 ‘rhs’ 区域。 如果属于UInt8,则返回等于1的数字,如果不属于则返回0。 -The relationship is reflexive – any region also belongs to itself. - -### ツ暗ェツ氾环催ツ団ツ法ツ人\]) {#regionhierarchyid-geobase} - -Accepts a UInt32 number – the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. -示例: `regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000]`. - -### 地区名称(id\[,郎\]) {#regiontonameid-lang} - -Accepts a UInt32 number – the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ‘ru’ is used. If the language is not supported, an exception is thrown. Returns a string – the name of the region in the corresponding language. If the region with the specified ID doesn't exist, an empty string is returned. - -`ua` 和 `uk` 都意味着乌克兰。 - -[原始文章](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) diff --git a/docs/zh/sql_reference/index.md b/docs/zh/sql_reference/index.md deleted file mode 100644 index aed704442ab..00000000000 --- a/docs/zh/sql_reference/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_folder_title: "SQL\u53C2\u8003" -toc_hidden: true -toc_priority: 28 -toc_title: "\u9690\u85CF" ---- - -# SQL参考 {#sql-reference} - -- [SELECT](statements/select.md) -- [INSERT INTO](statements/insert_into.md) -- [CREATE](statements/create.md) -- [ALTER](statements/alter.md#query_language_queries_alter) -- [其他类型的查询](statements/misc.md) - -[原始文章](https://clickhouse.tech/docs/en/query_language/) diff --git a/docs/zh/sql_reference/operators.md b/docs/zh/sql_reference/operators.md deleted file mode 100644 index fb5c7d0ee38..00000000000 --- a/docs/zh/sql_reference/operators.md +++ /dev/null @@ -1,264 +0,0 @@ - -# 操作符 {#cao-zuo-fu} - -所有的操作符(运算符)都会在查询时依据他们的优先级及其结合顺序在被解析时转换为对应的函数。下面按优先级从高到低列出各组运算符及其对应的函数: - -## 下标运算符 {#xia-biao-yun-suan-fu} - -`a[N]` – 数组中的第N个元素; 对应函数 `arrayElement(a, N)` - -`a.N` – 元组中第N个元素; 对应函数 `tupleElement(a, N)` - -## 负号 {#fu-hao} - -`-a` – 对应函数 `negate(a)` - -## 乘号、除号和取余 {#cheng-hao-chu-hao-he-qu-yu} - -`a * b` – 对应函数 `multiply(a, b)` - -`a / b` – 对应函数 `divide(a, b)` - -`a % b` – 对应函数 `modulo(a, b)` - -## 加号和减号 {#jia-hao-he-jian-hao} - -`a + b` – 对应函数 `plus(a, b)` - -`a - b` – 对应函数 `minus(a, b)` - -## 关系运算符 {#guan-xi-yun-suan-fu} - -`a = b` – 对应函数 `equals(a, b)` - -`a == b` – 对应函数 `equals(a, b)` - -`a != b` – 对应函数 `notEquals(a, b)` - -`a <> b` – 对应函数 `notEquals(a, b)` - -`a <= b` – 对应函数 `lessOrEquals(a, b)` - -`a >= b` – 对应函数 `greaterOrEquals(a, b)` - -`a < b` – 对应函数 `less(a, b)` - -`a > b` – 对应函数 `greater(a, b)` - -`a LIKE s` – 对应函数 `like(a, b)` - -`a NOT LIKE s` – 对应函数 `notLike(a, b)` - -`a BETWEEN b AND c` – 等价于 `a >= b AND a <= c` - -## 集合关系运算符 {#ji-he-guan-xi-yun-suan-fu} - -*详见此节 [IN 相关操作符](statements/select.md#select-in-operators) 。* - -`a IN ...` – 对应函数 `in(a, b)` - -`a NOT IN ...` – 对应函数 `notIn(a, b)` - -`a GLOBAL IN ...` – 对应函数 `globalIn(a, b)` - -`a GLOBAL NOT IN ...` – 对应函数 `globalNotIn(a, b)` - -## 逻辑非 {#luo-ji-fei} - -`NOT a` – 对应函数 `not(a)` - -## 逻辑与 {#luo-ji-yu} - -`a AND b` – 对应函数`and(a, b)` - -## 逻辑或 {#luo-ji-huo} - -`a OR b` – 对应函数 `or(a, b)` - -## 条件运算符 {#tiao-jian-yun-suan-fu} - -`a ? b : c` – 对应函数 `if(a, b, c)` - -注意: - -条件运算符会先计算表达式b和表达式c的值,再根据表达式a的真假,返回相应的值。如果表达式b和表达式c是 [arrayJoin()](../sql_reference/functions/array_join.md#functions_arrayjoin) 函数,则不管表达式a是真是假,每行都会被复制展开。 - -## 使用日期和时间的操作员 {#operators-datetime} - -### EXTRACT {#operator-extract} - -``` sql -EXTRACT(part FROM date); -``` - -从给定日期中提取部件。 例如,您可以从给定日期检索一个月,或从时间检索一秒钟。 - -该 `part` 参数指定要检索的日期部分。 以下值可用: - -- `DAY` — The day of the month. Possible values: 1–31. -- `MONTH` — The number of a month. Possible values: 1–12. -- `YEAR` — The year. -- `SECOND` — The second. Possible values: 0–59. -- `MINUTE` — The minute. Possible values: 0–59. -- `HOUR` — The hour. Possible values: 0–23. - -该 `part` 参数不区分大小写。 - -该 `date` 参数指定要处理的日期或时间。 无论是 [日期](../sql_reference/data_types/date.md) 或 [日期时间](../sql_reference/data_types/datetime.md) 支持类型。 - -例: - -``` sql -SELECT EXTRACT(DAY FROM toDate('2017-06-15')); -SELECT EXTRACT(MONTH FROM toDate('2017-06-15')); -SELECT EXTRACT(YEAR FROM toDate('2017-06-15')); -``` - -在下面的例子中,我们创建一个表,并在其中插入一个值 `DateTime` 类型。 - -``` sql -CREATE TABLE test.Orders -( - OrderId UInt64, - OrderName String, - OrderDate DateTime -) -ENGINE = Log; -``` - -``` sql -INSERT INTO test.Orders VALUES (1, 'Jarlsberg Cheese', toDateTime('2008-10-11 13:23:44')); -``` - -``` sql -SELECT - toYear(OrderDate) AS OrderYear, - toMonth(OrderDate) AS OrderMonth, - toDayOfMonth(OrderDate) AS OrderDay, - toHour(OrderDate) AS OrderHour, - toMinute(OrderDate) AS OrderMinute, - toSecond(OrderDate) AS OrderSecond -FROM test.Orders; -``` - -``` text -┌─OrderYear─┬─OrderMonth─┬─OrderDay─┬─OrderHour─┬─OrderMinute─┬─OrderSecond─┐ -│ 2008 │ 10 │ 11 │ 13 │ 23 │ 44 │ -└───────────┴────────────┴──────────┴───────────┴─────────────┴─────────────┘ -``` - -你可以看到更多的例子 [测试](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00619_extract.sql). - -### INTERVAL {#operator-interval} - -创建一个 [间隔](../sql_reference/operators.md)-应在算术运算中使用的类型值 [日期](../sql_reference/data_types/date.md) 和 [日期时间](../sql_reference/data_types/datetime.md)-类型值。 - -示例: - -``` sql -SELECT now() AS current_date_time, current_date_time + INTERVAL 4 DAY + INTERVAL 3 HOUR -``` - -``` text -┌───current_date_time─┬─plus(plus(now(), toIntervalDay(4)), toIntervalHour(3))─┐ -│ 2019-10-23 11:16:28 │ 2019-10-27 14:16:28 │ -└─────────────────────┴────────────────────────────────────────────────────────┘ -``` - -**另请参阅** - -- [间隔](../sql_reference/operators.md) 数据类型 -- [toInterval](../sql_reference/operators.md#function-tointerval) 类型转换函数 - -## CASE条件表达式 {#operator_case} - -``` sql -CASE [x] - WHEN a THEN b - [WHEN ... THEN ...] - [ELSE c] -END -``` - -如果指定了 `x` ,该表达式会转换为 `transform(x, [a, ...], [b, ...], c)` 函数。否则转换为 `multiIf(a, b, ..., c)` - -如果该表达式中没有 `ELSE c` 子句,则默认值就是 `NULL` - -但 `transform` 函数不支持 `NULL` - -## 连接运算符 {#lian-jie-yun-suan-fu} - -`s1 || s2` – 对应函数 `concat(s1, s2)` - -## 创建 Lambda 函数 {#chuang-jian-lambda-han-shu} - -`x -> expr` – 对应函数 `lambda(x, expr)` - -接下来的这些操作符因为其本身是括号没有优先级: - -## 创建数组 {#chuang-jian-shu-zu} - -`[x1, ...]` – 对应函数 `array(x1, ...)` - -## 创建元组 {#chuang-jian-yuan-zu} - -`(x1, x2, ...)` – 对应函数 `tuple(x2, x2, ...)` - -## 结合方式 {#jie-he-fang-shi} - -所有的同级操作符从左到右结合。例如, `1 + 2 + 3` 会转换成 `plus(plus(1, 2), 3)`。 -所以,有时他们会跟我们预期的不太一样。例如, `SELECT 4 > 2 > 3` 的结果是0。 - -为了高效, `and` 和 `or` 函数支持任意多参数,一连串的 `AND` 和 `OR` 运算符会转换成其对应的单个函数。 - -## 判断是否为 `NULL` {#pan-duan-shi-fou-wei-null} - -ClickHouse 支持 `IS NULL` 和 `IS NOT NULL` 。 - -### IS NULL {#operator-is-null} - -- 对于 [可为空](../sql_reference/operators.md) 类型的值, `IS NULL` 会返回: - - `1` 值为 `NULL` - - `0` 否则 -- 对于其他类型的值, `IS NULL` 总会返回 `0` - - - -``` bash -:) SELECT x+100 FROM t_null WHERE y IS NULL - -SELECT x + 100 -FROM t_null -WHERE isNull(y) - -┌─plus(x, 100)─┐ -│ 101 │ -└──────────────┘ - -1 rows in set. Elapsed: 0.002 sec. -``` - -### IS NOT NULL {#is-not-null} - -- 对于 [可为空](../sql_reference/operators.md) 类型的值, `IS NOT NULL` 会返回: - - `0` 值为 `NULL` - - `1` 否则 -- 对于其他类型的值,`IS NOT NULL` 总会返回 `1` - - - -``` bash -:) SELECT * FROM t_null WHERE y IS NOT NULL - -SELECT * -FROM t_null -WHERE isNotNull(y) - -┌─x─┬─y─┐ -│ 2 │ 3 │ -└───┴───┘ - -1 rows in set. Elapsed: 0.002 sec. -``` - -[来源文章](https://clickhouse.tech/docs/en/query_language/operators/) diff --git a/docs/zh/sql_reference/statements/alter.md b/docs/zh/sql_reference/statements/alter.md deleted file mode 100644 index ee8911edea2..00000000000 --- a/docs/zh/sql_reference/statements/alter.md +++ /dev/null @@ -1,505 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 36 -toc_title: ALTER ---- - -## ALTER {#query_language_queries_alter} - -该 `ALTER` 查询仅支持 `*MergeTree` 表,以及 `Merge`和`Distributed`. 查询有几个变体。 - -### 列操作 {#column-manipulations} - -更改表结构。 - -``` sql -ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN ... -``` - -在查询中,指定一个或多个逗号分隔操作的列表。 -每个操作都是对列的操作。 - -支持以下操作: - -- [ADD COLUMN](#alter_add-column) — Adds a new column to the table. -- [DROP COLUMN](#alter_drop-column) — Deletes the column. -- [CLEAR COLUMN](#alter_clear-column) — Resets column values. -- [COMMENT COLUMN](#alter_comment-column) — Adds a text comment to the column. -- [MODIFY COLUMN](#alter_modify-column) — Changes column's type, default expression and TTL. - -下面详细描述这些动作。 - -#### ADD COLUMN {#alter_add-column} - -``` sql -ADD COLUMN [IF NOT EXISTS] name [type] [default_expr] [codec] [AFTER name_after] -``` - -将一个新列添加到表中,并指定 `name`, `type`, [`codec`](create.md#codecs) 和 `default_expr` (请参阅部分 [默认表达式](create.md#create-default-values)). - -如果 `IF NOT EXISTS` 如果列已经存在,则查询不会返回错误。 如果您指定 `AFTER name_after` (另一列的名称),该列被添加在表列表中指定的一列之后。 否则,该列将添加到表的末尾。 请注意,没有办法将列添加到表的开头。 为了一系列的行动, `name_after` 可将该名称一栏,加入一个以前的行动。 - -添加列只是更改表结构,而不对数据执行任何操作。 数据不会出现在磁盘上后 `ALTER`. 如果从表中读取某一列的数据缺失,则将使用默认值填充该列(如果存在默认表达式,则执行默认表达式,或使用零或空字符串)。 合并数据部分后,该列将出现在磁盘上(请参阅 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md)). - -这种方法使我们能够完成 `ALTER` 即时查询,不增加旧数据量。 - -示例: - -``` sql -ALTER TABLE visits ADD COLUMN browser String AFTER user_id -``` - -#### DROP COLUMN {#alter_drop-column} - -``` sql -DROP COLUMN [IF EXISTS] name -``` - -删除具有名称的列 `name`. 如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 - -从文件系统中删除数据。 由于这将删除整个文件,查询几乎立即完成。 - -示例: - -``` sql -ALTER TABLE visits DROP COLUMN browser -``` - -#### CLEAR COLUMN {#alter_clear-column} - -``` sql -CLEAR COLUMN [IF EXISTS] name IN PARTITION partition_name -``` - -重置指定分区的列中的所有数据。 了解有关设置分区名称的详细信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). - -如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 - -示例: - -``` sql -ALTER TABLE visits CLEAR COLUMN browser IN PARTITION tuple() -``` - -#### COMMENT COLUMN {#alter_comment-column} - -``` sql -COMMENT COLUMN [IF EXISTS] name 'comment' -``` - -向列添加注释。 如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 - -每列可以有一个注释。 如果列的注释已存在,则新注释将复盖以前的注释。 - -注释存储在 `comment_expression` 由返回的列 [DESCRIBE TABLE](misc.md#misc-describe-table) 查询。 - -示例: - -``` sql -ALTER TABLE visits COMMENT COLUMN browser 'The table shows the browser used for accessing the site.' -``` - -#### MODIFY COLUMN {#alter_modify-column} - -``` sql -MODIFY COLUMN [IF EXISTS] name [type] [default_expr] [TTL] -``` - -此查询更改 `name` 列属性: - -- 类型 - -- 默认表达式 - -- TTL - - For examples of columns TTL modifying, see [Column TTL](../engines/table_engines/mergetree_family/mergetree.md#mergetree-column-ttl). - -如果 `IF EXISTS` 如果指定了子句,如果该列不存在,则查询不会返回错误。 - -更改类型时,值将被转换为 [toType](../../sql_reference/functions/type_conversion_functions.md) 函数被应用到它们。 如果仅更改默认表达式,则查询不会执行任何复杂的操作,并且几乎立即完成。 - -示例: - -``` sql -ALTER TABLE visits MODIFY COLUMN browser Array(String) -``` - -Changing the column type is the only complex action – it changes the contents of files with data. For large tables, this may take a long time. - -有几个处理阶段: - -- 准备具有修改数据的临时(新)文件。 -- 重命名旧文件。 -- 将临时(新)文件重命名为旧名称。 -- 删除旧文件。 - -只有第一阶段需要时间。 如果在此阶段出现故障,则不会更改数据。 -如果在其中一个连续阶段中出现故障,可以手动恢复数据。 例外情况是,如果旧文件从文件系统中删除,但新文件的数据没有写入磁盘并丢失。 - -该 `ALTER` 复制更改列的查询。 这些指令保存在ZooKeeper中,然后每个副本应用它们。 全部 `ALTER` 查询以相同的顺序运行。 查询等待对其他副本完成适当的操作。 但是,更改复制表中的列的查询可能会中断,并且所有操作都将异步执行。 - -#### 更改查询限制 {#alter-query-limitations} - -该 `ALTER` query允许您在嵌套数据结构中创建和删除单独的元素(列),但不能创建整个嵌套数据结构。 要添加嵌套数据结构,可以添加名称如下的列 `name.nested_name` 和类型 `Array(T)`. 嵌套数据结构等效于名称在点之前具有相同前缀的多个数组列。 - -不支持删除主键或采样键中的列(在主键中使用的列 `ENGINE` 表达式)。 只有在此更改不会导致数据被修改时,才可以更改主键中包含的列的类型(例如,允许您向枚举添加值或更改类型 `DateTime` 到 `UInt32`). - -如果 `ALTER` 查询不足以使您需要的表更改,您可以创建一个新的表,使用 [INSERT SELECT](insert_into.md#insert_query_insert-select) 查询,然后使用切换表 [RENAME](misc.md#misc_operations-rename) 查询并删除旧表。 您可以使用 [ツ环板-ョツ嘉ッツ偲](../../operations/utilities/clickhouse-copier.md) 作为替代 `INSERT SELECT` 查询。 - -该 `ALTER` 查询阻止对表的所有读取和写入。 换句话说,如果长 `SELECT` 正在运行的时间 `ALTER` 查询,该 `ALTER` 查询将等待它完成。 同时,对同一个表的所有新查询将等待 `ALTER` 正在运行。 - -对于本身不存储数据的表(例如 `Merge` 和 `Distributed`), `ALTER` 只是改变了表结构,并且不改变从属表的结构。 例如,当运行ALTER时 `Distributed` 表,你还需要运行 `ALTER` 对于所有远程服务器上的表。 - -### 使用键表达式进行操作 {#manipulations-with-key-expressions} - -支持以下命令: - -``` sql -MODIFY ORDER BY new_expression -``` - -它只适用于在表 [`MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) 家庭(包括 -[复制](../../engines/table_engines/mergetree_family/replication.md) 表)。 该命令更改 -[排序键](../../engines/table_engines/mergetree_family/mergetree.md) 表 -到 `new_expression` (表达式或表达式元组)。 主键保持不变。 - -该命令是轻量级的,因为它只更改元数据。 要保持该数据部分的属性 -行按排序键表达式排序您不能添加包含现有列的表达式 -到排序键(仅由列添加 `ADD COLUMN` 命令在同一个 `ALTER` 查询)。 - -### 使用数据跳过索引进行操作 {#manipulations-with-data-skipping-indices} - -它只适用于在表 [`*MergeTree`](../../engines/table_engines/mergetree_family/mergetree.md) 家庭(包括 -[复制](../../engines/table_engines/mergetree_family/replication.md) 表)。 以下操作 -可用: - -- `ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2]` -将索引描述添加到表元数据。 - -- `ALTER TABLE [db].name DROP INDEX name` -从表元数据中删除索引描述并从磁盘中删除索引文件。 - -这些命令是轻量级的,因为它们只更改元数据或删除文件。 -此外,它们被复制(通过ZooKeeper同步索引元数据)。 - -### 使用约束进行操作 {#manipulations-with-constraints} - -查看更多 [制约因素](create.md#constraints) - -可以使用以下语法添加或删除约束: - -``` sql -ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression; -ALTER TABLE [db].name DROP CONSTRAINT constraint_name; -``` - -查询将从表中添加或删除有关约束的元数据,以便立即处理它们。 - -约束检查 *不会被执行* 在现有数据上,如果它被添加。 - -复制表上的所有更改都广播到ZooKeeper,因此将应用于其他副本。 - -### 操作与分区和零件 {#alter_manipulations-with-partitions} - -下面的操作与 [分区](../../engines/table_engines/mergetree_family/custom_partitioning_key.md) 可用: - -- [DETACH PARTITION](#alter_detach-partition) – Moves a partition to the `detached` 目录和忘记它。 -- [DROP PARTITION](#alter_drop-partition) – Deletes a partition. -- [ATTACH PART\|PARTITION](#alter_attach-partition) – Adds a part or partition from the `detached` 目录到表。 -- [REPLACE PARTITION](#alter_replace-partition) -将数据分区从一个表复制到另一个表。 -- [ATTACH PARTITION FROM](#alter_attach-partition-from) – Copies the data partition from one table to another and adds. -- [REPLACE PARTITION](#alter_replace-partition) -将数据分区从一个表复制到另一个表并替换。 -- [MOVE PARTITION TO TABLE](#alter_move_to_table-partition) (\#alter\_move\_to\_table-partition)-将数据分区从一个表移动到另一个表。 -- [CLEAR COLUMN IN PARTITION](#alter_clear-column-partition) -重置分区中指定列的值。 -- [CLEAR INDEX IN PARTITION](#alter_clear-index-partition) -重置分区中指定的二级索引。 -- [FREEZE PARTITION](#alter_freeze-partition) – Creates a backup of a partition. -- [FETCH PARTITION](#alter_fetch-partition) – Downloads a partition from another server. -- [MOVE PARTITION\|PART](#alter_move-partition) – Move partition/data part to another disk or volume. - - - -#### 分离分区{\#alter\_detach-partition} {#detach-partition-alter-detach-partition} - -``` sql -ALTER TABLE table_name DETACH PARTITION partition_expr -``` - -将指定分区的所有数据移动到 `detached` 目录。 服务器会忘记分离的数据分区,就好像它不存在一样。 服务器不会知道这个数据,直到你做 [ATTACH](#alter_attach-partition) 查询。 - -示例: - -``` sql -ALTER TABLE visits DETACH PARTITION 201901 -``` - -阅读有关在一节中设置分区表达式的信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). - -执行查询后,您可以对查询中的数据进行任何操作 `detached` directory — delete it from the file system, or just leave it. - -This query is replicated – it moves the data to the `detached` 所有副本上的目录。 请注意,您只能对领导副本执行此查询。 要确定副本是否为领导者,请执行 `SELECT` 查询到 [系统。副本](../../operations/system_tables.md#system_tables-replicas) 桌子 或者,它更容易使 `DETACH` 对所有副本进行查询-除了领导副本之外,所有副本都会引发异常。 - -#### DROP PARTITION {#alter_drop-partition} - -``` sql -ALTER TABLE table_name DROP PARTITION partition_expr -``` - -从表中删除指定的分区。 此查询将分区标记为非活动分区,并在大约10分钟内完全删除数据。 - -阅读有关在一节中设置分区表达式的信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). - -The query is replicated – it deletes data on all replicas. - -#### DROP DETACHED PARTITION\|PART {#alter_drop-detached} - -``` sql -ALTER TABLE table_name DROP DETACHED PARTITION|PART partition_expr -``` - -从中删除指定分区的指定部分或所有部分 `detached`. -了解有关在一节中设置分区表达式的详细信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). - -#### ATTACH PARTITION\|PART {#alter_attach-partition} - -``` sql -ALTER TABLE table_name ATTACH PARTITION|PART partition_expr -``` - -将数据从 `detached` 目录。 可以为整个分区或单独的部分添加数据。 例: - -``` sql -ALTER TABLE visits ATTACH PARTITION 201901; -ALTER TABLE visits ATTACH PART 201901_2_2_0; -``` - -了解有关在一节中设置分区表达式的详细信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). - -此查询被复制。 副本发起程序检查是否有数据在 `detached` 目录。 如果数据存在,则查询将检查其完整性。 如果一切正确,则查询将数据添加到表中。 所有其他副本都从副本发起程序下载数据。 - -所以你可以把数据到 `detached` 在一个副本上的目录,并使用 `ALTER ... ATTACH` 查询以将其添加到所有副本上的表中。 - -#### ATTACH PARTITION FROM {#alter_attach-partition-from} - -``` sql -ALTER TABLE table2 ATTACH PARTITION partition_expr FROM table1 -``` - -此查询将数据分区从 `table1` 到 `table2` 将数据添加到存在 `table2`. 请注意,数据不会从中删除 `table1`. - -要使查询成功运行,必须满足以下条件: - -- 两个表必须具有相同的结构。 -- 两个表必须具有相同的分区键。 - -#### REPLACE PARTITION {#alter_replace-partition} - -``` sql -ALTER TABLE table2 REPLACE PARTITION partition_expr FROM table1 -``` - -此查询将数据分区从 `table1` 到 `table2` 并替换在现有的分区 `table2`. 请注意,数据不会从中删除 `table1`. - -要使查询成功运行,必须满足以下条件: - -- 两个表必须具有相同的结构。 -- 两个表必须具有相同的分区键。 - -#### MOVE PARTITION TO TABLE {#alter_move_to_table-partition} - -``` sql -ALTER TABLE table_source MOVE PARTITION partition_expr TO TABLE table_dest -``` - -此查询将数据分区从 `table_source` 到 `table_dest` 删除数据 `table_source`. - -要使查询成功运行,必须满足以下条件: - -- 两个表必须具有相同的结构。 -- 两个表必须具有相同的分区键。 -- 两个表必须是相同的引擎系列。 (已复制或未复制) -- 两个表必须具有相同的存储策略。 - -#### CLEAR COLUMN IN PARTITION {#alter_clear-column-partition} - -``` sql -ALTER TABLE table_name CLEAR COLUMN column_name IN PARTITION partition_expr -``` - -重置分区中指定列中的所有值。 如果 `DEFAULT` 创建表时确定了子句,此查询将列值设置为指定的默认值。 - -示例: - -``` sql -ALTER TABLE visits CLEAR COLUMN hour in PARTITION 201902 -``` - -#### FREEZE PARTITION {#alter_freeze-partition} - -``` sql -ALTER TABLE table_name FREEZE [PARTITION partition_expr] -``` - -此查询创建指定分区的本地备份。 如果 `PARTITION` 子句被省略,查询一次创建所有分区的备份。 - -!!! note "注" - 在不停止服务器的情况下执行整个备份过程。 - -请注意,对于旧式表,您可以指定分区名称的前缀(例如, ‘2019’)-然后查询为所有相应的分区创建备份。 阅读有关在一节中设置分区表达式的信息 [如何指定分区表达式](#alter-how-to-specify-part-expr). - -在执行时,对于数据快照,查询将创建指向表数据的硬链接。 硬链接被放置在目录中 `/var/lib/clickhouse/shadow/N/...`,哪里: - -- `/var/lib/clickhouse/` 是配置中指定的工作ClickHouse目录。 -- `N` 是备份的增量编号。 - -!!! note "注" - 如果您使用 [用于在表中存储数据的一组磁盘](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes),该 `shadow/N` 目录出现在每个磁盘上,存储由匹配的数据部分 `PARTITION` 表达。 - -在备份内部创建的目录结构与在备份内部创建的目录结构相同 `/var/lib/clickhouse/`. 查询执行 ‘chmod’ 对于所有文件,禁止写入它们。 - -创建备份后,您可以从以下位置复制数据 `/var/lib/clickhouse/shadow/` 然后将其从本地服务器中删除。 请注意, `ALTER t FREEZE PARTITION` 不复制查询。 它仅在本地服务器上创建本地备份。 - -查询几乎立即创建备份(但首先它会等待对相应表的当前查询完成运行)。 - -`ALTER TABLE t FREEZE PARTITION` 仅复制数据,而不复制表元数据。 若要备份表元数据,请复制该文件 `/var/lib/clickhouse/metadata/database/table.sql` - -要从备份还原数据,请执行以下操作: - -1. 如果表不存在,则创建该表。 要查看查询,请使用。sql文件(替换 `ATTACH` 在它与 `CREATE`). -2. 从复制数据 `data/database/table/` 目录内的备份到 `/var/lib/clickhouse/data/database/table/detached/` 目录。 -3. 快跑 `ALTER TABLE t ATTACH PARTITION` 将数据添加到表的查询。 - -从备份还原不需要停止服务器。 - -有关备份和还原数据的详细信息,请参阅 [数据备份](../../operations/backup.md) 科。 - -#### CLEAR INDEX IN PARTITION {#alter_clear-index-partition} - -``` sql -ALTER TABLE table_name CLEAR INDEX index_name IN PARTITION partition_expr -``` - -查询的工作原理类似于 `CLEAR COLUMN`,但它重置索引而不是列数据。 - -#### FETCH PARTITION {#alter_fetch-partition} - -``` sql -ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper' -``` - -从另一台服务器下载分区。 此查询仅适用于复制的表。 - -查询执行以下操作: - -1. 从指定的分片下载分区。 在 ‘path-in-zookeeper’ 您必须在ZooKeeper中指定分片的路径。 -2. 然后查询将下载的数据放到 `detached` 的目录 `table_name` 桌子 使用 [ATTACH PARTITION\|PART](#alter_attach-partition) 查询将数据添加到表中。 - -例如: - -``` sql -ALTER TABLE users FETCH PARTITION 201902 FROM '/clickhouse/tables/01-01/visits'; -ALTER TABLE users ATTACH PARTITION 201902; -``` - -请注意: - -- 该 `ALTER ... FETCH PARTITION` 查询不被复制。 它将分区放置在 `detached` 仅在本地服务器上的目录。 -- 该 `ALTER TABLE ... ATTACH` 复制查询。 它将数据添加到所有副本。 数据被添加到从副本之一 `detached` 目录,以及其他-从相邻的副本。 - -在下载之前,系统会检查分区是否存在并且表结构匹配。 从正常副本中自动选择最合适的副本。 - -虽然查询被调用 `ALTER TABLE`,它不会更改表结构,并且不会立即更改表中可用的数据。 - -#### MOVE PARTITION\|PART {#alter_move-partition} - -将分区或数据部分移动到另一个卷或磁盘 `MergeTree`-发动机表。 看 [使用多个块设备进行数据存储](../../engines/table_engines/mergetree_family/mergetree.md#table_engine-mergetree-multiple-volumes). - -``` sql -ALTER TABLE table_name MOVE PARTITION|PART partition_expr TO DISK|VOLUME 'disk_name' -``` - -该 `ALTER TABLE t MOVE` 查询: - -- 不复制,因为不同的副本可能具有不同的存储策略。 -- 如果未配置指定的磁盘或卷,则返回错误。 如果无法应用存储策略中指定的数据移动条件,Query还会返回错误。 -- 可以在返回错误的情况下,当要移动的数据已经被后台进程移动时,并发 `ALTER TABLE t MOVE` 查询或作为后台数据合并的结果。 在这种情况下,用户不应该执行任何其他操作。 - -示例: - -``` sql -ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' -ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' -``` - -#### 如何设置分区表达式 {#alter-how-to-specify-part-expr} - -您可以在以下内容中指定分区表达式 `ALTER ... PARTITION` 以不同方式查询: - -- 作为从值 `partition` 列 `system.parts` 桌子 例如, `ALTER TABLE visits DETACH PARTITION 201901`. -- 作为来自表列的表达式。 支持常量和常量表达式。 例如, `ALTER TABLE visits DETACH PARTITION toYYYYMM(toDate('2019-01-25'))`. -- 使用分区ID。 分区ID是用作文件系统和ZooKeeper中分区名称的分区的字符串标识符(如果可能的话,人类可读)。 分区ID必须在指定 `PARTITION ID` 子句,用单引号。 例如, `ALTER TABLE visits DETACH PARTITION ID '201901'`. -- 在 [ALTER ATTACH PART](#alter_attach-partition) 和 [DROP DETACHED PART](#alter_drop-detached) 查询时,要指定部件的名称,请将字符串文字与来自 `name` 列 [系统。detached\_parts](../../operations/system_tables.md#system_tables-detached_parts) 桌子 例如, `ALTER TABLE visits ATTACH PART '201901_1_1_0'`. - -指定分区时引号的使用取决于分区表达式的类型。 例如,对于 `String` 类型,你必须在引号中指定其名称 (`'`). 为 `Date` 和 `Int*` 类型不需要引号。 - -对于旧式表,您可以将分区指定为数字 `201901` 或者一个字符串 `'201901'`. 对于类型,新样式表的语法更严格(类似于值输入格式的解析器)。 - -上述所有规则也适用于 [OPTIMIZE](misc.md#misc_operations-optimize) 查询。 如果在优化非分区表时需要指定唯一的分区,请设置表达式 `PARTITION tuple()`. 例如: - -``` sql -OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; -``` - -的例子 `ALTER ... PARTITION` 查询在测试中演示 [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) 和 [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). - -### 使用表TTL进行操作 {#manipulations-with-table-ttl} - -你可以改变 [表TTL](../../engines/table_engines/mergetree_family/mergetree.md#mergetree-table-ttl) 请填写以下表格: - -``` sql -ALTER TABLE table-name MODIFY TTL ttl-expression -``` - -### ALTER查询的同步性 {#synchronicity-of-alter-queries} - -对于不可复制的表,所有 `ALTER` 查询是同步执行的。 对于可复制的表,查询仅添加相应操作的说明 `ZooKeeper`,并尽快执行操作本身。 但是,查询可以等待在所有副本上完成这些操作。 - -为 `ALTER ... ATTACH|DETACH|DROP` 查询,您可以使用 `replication_alter_partitions_sync` 设置设置等待。 -可能的值: `0` – do not wait; `1` – only wait for own execution (default); `2` – wait for all. - -### 突变 {#alter-mutations} - -突变是允许更改或删除表中的行的ALTER查询变体。 与标准相比 `UPDATE` 和 `DELETE` 用于点数据更改的查询,mutations适用于更改表中大量行的繁重操作。 支持的 `MergeTree` 表引擎系列,包括具有复制支持的引擎。 - -现有表可以按原样进行突变(无需转换),但是在将第一次突变应用于表之后,其元数据格式将与以前的服务器版本不兼容,并且无法回退到以前的版本。 - -当前可用的命令: - -``` sql -ALTER TABLE [db.]table DELETE WHERE filter_expr -``` - -该 `filter_expr` 必须是类型 `UInt8`. 查询删除表中此表达式采用非零值的行。 - -``` sql -ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr -``` - -该 `filter_expr` 必须是类型 `UInt8`. 此查询将指定列的值更新为行中相应表达式的值。 `filter_expr` 取非零值。 使用以下命令将值转换为列类型 `CAST` 接线员 不支持更新用于计算主键或分区键的列。 - -``` sql -ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name -``` - -查询将重新生成二级索引 `name` 在分区中 `partition_name`. - -一个查询可以包含多个用逗号分隔的命令。 - -For\*MergeTree表的突变通过重写整个数据部分来执行。 没有原子性-部分被取代为突变的部分,只要他们准备好和 `SELECT` 在突变期间开始执行的查询将看到来自已经突变的部件的数据以及来自尚未突变的部件的数据。 - -突变完全按其创建顺序排序,并以该顺序应用于每个部分。 突变也使用插入进行部分排序-在提交突变之前插入到表中的数据将被突变,之后插入的数据将不会被突变。 请注意,突变不会以任何方式阻止插入。 - -Mutation查询在添加mutation条目后立即返回(如果将复制的表复制到ZooKeeper,则将非复制的表复制到文件系统)。 突变本身使用系统配置文件设置异步执行。 要跟踪突变的进度,您可以使用 [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) 桌子 即使重新启动ClickHouse服务器,成功提交的突变仍将继续执行。 一旦提交,没有办法回滚突变,但如果突变由于某种原因被卡住,可以使用 [`KILL MUTATION`](misc.md#kill-mutation) 查询。 - -已完成突变的条目不会立即删除(保留条目的数量由 `finished_mutations_to_keep` 存储引擎参数)。 旧的突变条目将被删除。 - -[原始文章](https://clickhouse.tech/docs/en/query_language/alter/) diff --git a/docs/zh/sql_reference/statements/create.md b/docs/zh/sql_reference/statements/create.md deleted file mode 100644 index 1697df692b5..00000000000 --- a/docs/zh/sql_reference/statements/create.md +++ /dev/null @@ -1,264 +0,0 @@ - -## CREATE DATABASE {#create-database} - -该查询用于根据指定名称创建数据库。 - -``` sql -CREATE DATABASE [IF NOT EXISTS] db_name -``` - -数据库其实只是用于存放表的一个目录。 -如果查询中存在`IF NOT EXISTS`,则当数据库已经存在时,该查询不会返回任何错误。 - -## CREATE TABLE {#create-table-query} - -对于`CREATE TABLE`,存在以下几种方式。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) ENGINE = engine -``` - -在指定的'db'数据库中创建一个名为'name'的表,如果查询中没有包含'db',则默认使用当前选择的数据库作为'db'。后面的是包含在括号中的表结构以及表引擎的声明。 -其中表结构声明是一个包含一组列描述声明的组合。如果表引擎是支持索引的,那么可以在表引擎的参数中对其进行说明。 - -在最简单的情况下,列描述是指`名称 类型`这样的子句。例如: `RegionID UInt32`。 -但是也可以为列另外定义默认值表达式(见后文)。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine] -``` - -创建一个与`db2.name2`具有相同结构的表,同时你可以对其指定不同的表引擎声明。如果没有表引擎声明,则创建的表将与`db2.name2`使用相同的表引擎。 - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... -``` - -使用指定的引擎创建一个与`SELECT`子句的结果具有相同结构的表,并使用`SELECT`子句的结果填充它。 - -以上所有情况,如果指定了`IF NOT EXISTS`,那么在该表已经存在的情况下,查询不会返回任何错误。在这种情况下,查询几乎不会做任何事情。 - -在`ENGINE`子句后还可能存在一些其他的子句,更详细的信息可以参考 [表引擎](../../sql_reference/statements/create.md) 中关于建表的描述。 - -### 默认值 {#create-default-values} - -在列描述中你可以通过以下方式之一为列指定默认表达式:`DEFAULT expr`,`MATERIALIZED expr`,`ALIAS expr`。 -示例:`URLDomain String DEFAULT domain(URL)`。 - -如果在列描述中未定义任何默认表达式,那么系统将会根据类型设置对应的默认值,如:数值类型为零、字符串类型为空字符串、数组类型为空数组、日期类型为'0000-00-00'以及时间类型为'0000-00-00 00:00:00'。不支持使用NULL作为普通类型的默认值。 - -如果定义了默认表达式,则可以不定义列的类型。如果没有明确的定义类的类型,则使用默认表达式的类型。例如:`EventDate DEFAULT toDate(EventTime)` - 最终'EventDate'将使用'Date'作为类型。 - -如果同时指定了默认表达式与列的类型,则将使用类型转换函数将默认表达式转换为指定的类型。例如:`Hits UInt32 DEFAULT 0`与`Hits UInt32 DEFAULT toUInt32(0)`意思相同。 - -默认表达式可以包含常量或表的任意其他列。当创建或更改表结构时,系统将会运行检查,确保不会包含循环依赖。对于INSERT, 它仅检查表达式是否是可以解析的 - 它们可以从中计算出所有需要的列的默认值。 - -`DEFAULT expr` - -普通的默认值,如果INSERT中不包含指定的列,那么将通过表达式计算它的默认值并填充它。 - -`MATERIALIZED expr` - -物化表达式,被该表达式指定的列不能包含在INSERT的列表中,因为它总是被计算出来的。 -对于INSERT而言,不需要考虑这些列。 -另外,在SELECT查询中如果包含星号,此列不会被用来替换星号,这是因为考虑到数据转储,在使用`SELECT *`查询出的结果总能够被'INSERT'回表。 - -`ALIAS expr` - -别名。这样的列不会存储在表中。 -它的值不能够通过INSERT写入,同时使用SELECT查询星号时,这些列也不会被用来替换星号。 -但是它们可以显示的用于SELECT中,在这种情况下,在查询分析中别名将被替换。 - -当使用ALTER查询对添加新的列时,不同于为所有旧数据添加这个列,对于需要在旧数据中查询新列,只会在查询时动态计算这个新列的值。但是如果新列的默认表示中依赖其他列的值进行计算,那么同样会加载这些依赖的列的数据。 - -如果你向表中添加一个新列,并在之后的一段时间后修改它的默认表达式,则旧数据中的值将会被改变。请注意,在运行后台合并时,缺少的列的值将被计算后写入到合并后的数据部分中。 - -不能够为nested类型的列设置默认值。 - -### 制约因素 {#constraints} - -随着列描述约束可以定义: - -``` sql -CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1], - ... - CONSTRAINT constraint_name_1 CHECK boolean_expr_1, - ... -) ENGINE = engine -``` - -`boolean_expr_1` 可以通过任何布尔表达式。 如果为表定义了约束,则将为表中的每一行检查它们中的每一行 `INSERT` query. If any constraint is not satisfied — server will raise an exception with constraint name and checking expression. - -添加大量的约束会对big的性能产生负面影响 `INSERT` 查询。 - -### Ttl表达式 {#ttl-expression} - -定义值的存储时间。 只能为MergeTree系列表指定。 有关详细说明,请参阅 [列和表的TTL](../../sql_reference/statements/create.md#table_engine-mergetree-ttl). - -### 列压缩编解ecs {#codecs} - -默认情况下,ClickHouse应用以下定义的压缩方法 [服务器设置](../../sql_reference/statements/create.md#server-settings-compression),列。 您还可以定义在每个单独的列的压缩方法 `CREATE TABLE` 查询。 - -``` sql -CREATE TABLE codec_example -( - dt Date CODEC(ZSTD), - ts DateTime CODEC(LZ4HC), - float_value Float32 CODEC(NONE), - double_value Float64 CODEC(LZ4HC(9)) - value Float32 CODEC(Delta, ZSTD) -) -ENGINE = -... -``` - -如果指定了编解ec,则默认编解码器不适用。 编解码器可以组合在一个流水线中,例如, `CODEC(Delta, ZSTD)`. 要为您的项目选择最佳的编解码器组合,请通过类似于Altinity中描述的基准测试 [新编码提高ClickHouse效率](https://www.altinity.com/blog/2019/7/new-encodings-to-improve-clickhouse) 文章. - -!!! warning "警告" - 您无法使用外部实用程序解压缩ClickHouse数据库文件,如 `lz4`. 相反,使用特殊的 [ツ环板compressorョツ嘉ッツ偲](https://github.com/ClickHouse/ClickHouse/tree/master/programs/compressor) 实用程序。 - -下表引擎支持压缩: - -- [MergeTree](../../sql_reference/statements/create.md) 家庭 -- [日志](../../sql_reference/statements/create.md) 家庭 -- [设置](../../sql_reference/statements/create.md) -- [加入我们](../../sql_reference/statements/create.md) - -ClickHouse支持通用编解码器和专用编解ecs。 - -#### 专业编解ecs {#create-query-specialized-codecs} - -这些编解码器旨在通过使用数据的特定功能使压缩更有效。 其中一些编解码器不压缩数据本身。 相反,他们准备的数据用于共同目的的编解ec,其压缩它比没有这种准备更好。 - -专业编解ecs: - -- `Delta(delta_bytes)` — Compression approach in which raw values are replaced by the difference of two neighboring values, except for the first value that stays unchanged. Up to `delta_bytes` 用于存储增量值,所以 `delta_bytes` 是原始值的最大大小。 可能 `delta_bytes` 值:1,2,4,8. 默认值 `delta_bytes` 是 `sizeof(type)` 如果等于1,2,4或8。 在所有其他情况下,它是1。 -- `DoubleDelta` — Calculates delta of deltas and writes it in compact binary form. Optimal compression rates are achieved for monotonic sequences with a constant stride, such as time series data. Can be used with any fixed-width type. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. Uses 1 extra bit for 32-byte deltas: 5-bit prefixes instead of 4-bit prefixes. For additional information, see Compressing Time Stamps in [Gorilla:一个快速、可扩展的内存时间序列数据库](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `Gorilla` — Calculates XOR between current and previous value and writes it in compact binary form. Efficient when storing a series of floating point values that change slowly, because the best compression rate is achieved when neighboring values are binary equal. Implements the algorithm used in Gorilla TSDB, extending it to support 64-bit types. For additional information, see Compressing Values in [Gorilla:一个快速、可扩展的内存时间序列数据库](http://www.vldb.org/pvldb/vol8/p1816-teller.pdf). -- `T64` — Compression approach that crops unused high bits of values in integer data types (including `Enum`, `Date` 和 `DateTime`). 在算法的每个步骤中,编解码器采用64个值块,将它们放入64x64位矩阵中,对其进行转置,裁剪未使用的值位并将其余部分作为序列返回。 未使用的位是使用压缩的整个数据部分的最大值和最小值之间没有区别的位。 - -`DoubleDelta` 和 `Gorilla` 编解码器在Gorilla TSDB中用作其压缩算法的组件。 大猩猩的方法是有效的情况下,当有缓慢变化的值与他们的时间戳序列。 时间戳是由有效地压缩 `DoubleDelta` 编解ec,和值有效地由压缩 `Gorilla` 编解ec 例如,要获取有效存储的表,可以在以下配置中创建它: - -``` sql -CREATE TABLE codec_example -( - timestamp DateTime CODEC(DoubleDelta), - slow_values Float32 CODEC(Gorilla) -) -ENGINE = MergeTree() -``` - -#### 通用编解ecs {#create-query-common-purpose-codecs} - -编解ecs: - -- `NONE` — No compression. -- `LZ4` — Lossless [数据压缩算法](https://github.com/lz4/lz4) 默认情况下使用。 应用LZ4快速压缩。 -- `LZ4HC[(level)]` — LZ4 HC (high compression) algorithm with configurable level. Default level: 9. Setting `level <= 0` 应用默认级别。 可能的水平:\[1,12\]。 推荐级别范围:\[4,9\]。 -- `ZSTD[(level)]` — [ZSTD压缩算法](https://en.wikipedia.org/wiki/Zstandard) 可配置 `level`. 可能的水平:\[1,22\]。 默认值:1。 - -高压缩级别对于非对称场景非常有用,例如压缩一次,重复解压缩。 更高的级别意味着更好的压缩和更高的CPU使用率。 - -## 临时表 {#lin-shi-biao} - -ClickHouse支持临时表,其具有以下特征: - -- 当回话结束时,临时表将随会话一起消失,这包含链接中断。 -- 临时表仅能够使用Memory表引擎。 -- 无法为临时表指定数据库。它是在数据库之外创建的。 -- 如果临时表与另一个表名称相同,那么当在查询时没有显示的指定db的情况下,将优先使用临时表。 -- 对于分布式处理,查询中使用的临时表将被传递到远程服务器。 - -可以使用下面的语法创建一个临时表: - -``` sql -CREATE TEMPORARY TABLE [IF NOT EXISTS] table_name [ON CLUSTER cluster] -( - name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1], - name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2], - ... -) -``` - -大多数情况下,临时表不是手动创建的,只有在分布式查询处理中使用`(GLOBAL) IN`时为外部数据创建。更多信息,可以参考相关章节。 - -## 分布式DDL查询 (ON CLUSTER 子句) {#fen-bu-shi-ddlcha-xun-on-cluster-zi-ju} - -对于 `CREATE`, `DROP`, `ALTER`,以及`RENAME`查询,系统支持其运行在整个集群上。 -例如,以下查询将在`cluster`集群的所有节点上创建名为`all_hits`的`Distributed`表: - -``` sql -CREATE TABLE IF NOT EXISTS all_hits ON CLUSTER cluster (p Date, i Int32) ENGINE = Distributed(cluster, default, hits) -``` - -为了能够正确的运行这种查询,每台主机必须具有相同的cluster声明(为了简化配置的同步,你可以使用zookeeper的方式进行配置)。同时这些主机还必须链接到zookeeper服务器。 -这个查询将最终在集群的每台主机上运行,即使一些主机当前处于不可用状态。同时它还保证了所有的查询在单台主机中的执行顺序。 - -## CREATE VIEW {#create-view} - -``` sql -CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ... -``` - -创建一个视图。它存在两种可选择的类型:普通视图与物化视图。 - -普通视图不存储任何数据,只是执行从另一个表中的读取。换句话说,普通视图只是保存了视图的查询,当从视图中查询时,此查询被作为子查询用于替换FROM子句。 - -举个例子,假设你已经创建了一个视图: - -``` sql -CREATE VIEW view AS SELECT ... -``` - -还有一个查询: - -``` sql -SELECT a, b, c FROM view -``` - -这个查询完全等价于: - -``` sql -SELECT a, b, c FROM (SELECT ...) -``` - -物化视图存储的数据是由相应的SELECT查询转换得来的。 - -在创建物化视图时,你还必须指定表的引擎 - 将会使用这个表引擎存储数据。 - -目前物化视图的工作原理:当将数据写入到物化视图中SELECT子句所指定的表时,插入的数据会通过SELECT子句查询进行转换并将最终结果插入到视图中。 - -如果创建物化视图时指定了POPULATE子句,则在创建时将该表的数据插入到物化视图中。就像使用`CREATE TABLE ... AS SELECT ...`一样。否则,物化视图只会包含在物化视图创建后的新写入的数据。我们不推荐使用POPULATE,因为在视图创建期间写入的数据将不会写入其中。 - -当一个`SELECT`子句包含`DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`时,请注意,这些仅会在插入数据时在每个单独的数据块上执行。例如,如果你在其中包含了`GROUP BY`,则只会在查询期间进行聚合,但聚合范围仅限于单个批的写入数据。数据不会进一步被聚合。但是当你使用一些其他数据聚合引擎时这是例外的,如:`SummingMergeTree`。 - -目前对物化视图执行`ALTER`是不支持的,因此这可能是不方便的。如果物化视图是使用的`TO [db.]name`的方式进行构建的,你可以使用`DETACH`语句现将视图剥离,然后使用`ALTER`运行在目标表上,然后使用`ATTACH`将之前剥离的表重新加载进来。 - -视图看起来和普通的表相同。例如,你可以通过`SHOW TABLES`查看到它们。 - -没有单独的删除视图的语法。如果要删除视图,请使用`DROP TABLE`。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/create/) - -## CREATE DICTIONARY {#create-dictionary-query} - -``` sql -CREATE DICTIONARY [IF NOT EXISTS] [db.]dictionary_name [ON CLUSTER cluster] -( - key1 type1 [DEFAULT|EXPRESSION expr1] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - key2 type2 [DEFAULT|EXPRESSION expr2] [HIERARCHICAL|INJECTIVE|IS_OBJECT_ID], - attr1 type2 [DEFAULT|EXPRESSION expr3], - attr2 type2 [DEFAULT|EXPRESSION expr4] -) -PRIMARY KEY key1, key2 -SOURCE(SOURCE_NAME([param1 value1 ... paramN valueN])) -LAYOUT(LAYOUT_NAME([param_name param_value])) -LIFETIME([MIN val1] MAX val2) -``` diff --git a/docs/zh/sql_reference/statements/insert_into.md b/docs/zh/sql_reference/statements/insert_into.md deleted file mode 100644 index a59730f5750..00000000000 --- a/docs/zh/sql_reference/statements/insert_into.md +++ /dev/null @@ -1,68 +0,0 @@ - -## INSERT {#insert} - -INSERT查询主要用于向系统中添加数据. - -查询的基本格式: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), ... -``` - -您可以在查询中指定插入的列的列表,如:`[(c1, c2, c3)]`。对于存在于表结构中但不存在于插入列表中的列,它们将会按照如下方式填充数据: - -- 如果存在`DEFAULT`表达式,根据`DEFAULT`表达式计算被填充的值。 -- 如果没有定义`DEFAULT`表达式,则填充零或空字符串。 - -如果 [strict\_insert\_defaults=1](../../operations/settings/settings.md),你必须在查询中列出所有没有定义`DEFAULT`表达式的列。 - -数据可以以ClickHouse支持的任何 [输入输出格式](../../interfaces/formats.md#formats) 传递给INSERT。格式的名称必须显示的指定在查询中: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT format_name data_set -``` - -例如,下面的查询所使用的输入格式就与上面INSERT … VALUES的中使用的输入格式相同: - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ... -``` - -ClickHouse会清除数据前所有的空白字符与一行摘要信息(如果需要的话)。所以在进行查询时,我们建议您将数据放入到输入输出格式名称后的新的一行中去(如果数据是以空白字符开始的,这将非常重要)。 - -示例: - -``` sql -INSERT INTO t FORMAT TabSeparated -11 Hello, world! -22 Qwerty -``` - -在使用命令行客户端或HTTP客户端时,你可以将具体的查询语句与数据分开发送。更多具体信息,请参考«[客户端](../../interfaces/index.md#interfaces)»部分。 - -### 使用`SELECT`的结果写入 {#insert_query_insert-select} - -``` sql -INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... -``` - -写入与SELECT的列的对应关系是使用位置来进行对应的,尽管它们在SELECT表达式与INSERT中的名称可能是不同的。如果需要,会对它们执行对应的类型转换。 - -除了VALUES格式之外,其他格式中的数据都不允许出现诸如`now()`,`1 + 2`等表达式。VALUES格式允许您有限度的使用这些表达式,但是不建议您这么做,因为执行这些表达式总是低效的。 - -系统不支持的其他用于修改数据的查询:`UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`。 -但是,您可以使用 `ALTER TABLE ... DROP PARTITION`查询来删除一些旧的数据。 - -### 性能的注意事项 {#xing-neng-de-zhu-yi-shi-xiang} - -在进行`INSERT`时将会对写入的数据进行一些处理,按照主键排序,按照月份对数据进行分区等。所以如果在您的写入数据中包含多个月份的混合数据时,将会显著的降低`INSERT`的性能。为了避免这种情况: - -- 数据总是以尽量大的batch进行写入,如每次写入100,000行。 -- 数据在写入ClickHouse前预先的对数据进行分组。 - -在以下的情况下,性能不会下降: - -- 数据总是被实时的写入。 -- 写入的数据已经按照时间排序。 - -[来源文章](https://clickhouse.tech/docs/en/query_language/insert_into/) diff --git a/docs/zh/sql_reference/statements/misc.md b/docs/zh/sql_reference/statements/misc.md deleted file mode 100644 index e50f08464b7..00000000000 --- a/docs/zh/sql_reference/statements/misc.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 39 -toc_title: "\u5176\u4ED6" ---- - -# 杂项查询 {#miscellaneous-queries} - -## ATTACH {#attach} - -这个查询是完全一样的 `CREATE`,但是 - -- 而不是这个词 `CREATE` 它使用这个词 `ATTACH`. -- 查询不会在磁盘上创建数据,但假定数据已经在适当的位置,只是将有关表的信息添加到服务器。 - 执行附加查询后,服务器将知道表的存在。 - -如果表之前已分离 (`DETACH`),意味着其结构是已知的,可以使用速记而不限定该结构。 - -``` sql -ATTACH TABLE [IF NOT EXISTS] [db.]name [ON CLUSTER cluster] -``` - -启动服务器时使用此查询。 服务器将表元数据作为文件存储 `ATTACH` 查询,它只是在启动时运行(除了在服务器上显式创建的系统表)。 - -## CHECK TABLE {#check-table} - -检查表中的数据是否已损坏。 - -``` sql -CHECK TABLE [db.]name -``` - -该 `CHECK TABLE` 查询将实际文件大小与存储在服务器上的预期值进行比较。 如果文件大小与存储的值不匹配,则表示数据已损坏。 例如,这可能是由查询执行期间的系统崩溃引起的。 - -查询响应包含 `result` 具有单行的列。 该行的值为 -[布尔值](../../sql_reference/data_types/boolean.md) 类型: - -- 0-表中的数据已损坏。 -- 1-数据保持完整性。 - -该 `CHECK TABLE` 查询支持下表引擎: - -- [日志](../../engines/table_engines/log_family/log.md) -- [TinyLog](../../engines/table_engines/log_family/tinylog.md) -- [StripeLog](../../engines/table_engines/log_family/stripelog.md) -- [梅树家族](../../engines/table_engines/mergetree_family/mergetree.md) - -使用另一个表引擎对表执行会导致异常。 - -从发动机 `*Log` 家庭不提供故障自动数据恢复。 使用 `CHECK TABLE` 查询以及时跟踪数据丢失。 - -为 `MergeTree` 家庭发动机, `CHECK TABLE` 查询显示本地服务器上表的每个单独数据部分的检查状态。 - -**如果数据已损坏** - -如果表已损坏,则可以将未损坏的数据复制到另一个表。 要做到这一点: - -1. 创建具有与损坏的表相同结构的新表。 要执行此操作,请执行查询 `CREATE TABLE AS `. -2. 设置 [max\_threads](../../operations/settings/settings.md#settings-max_threads) 值为1以在单个线程中处理下一个查询。 要执行此操作,请运行查询 `SET max_threads = 1`. -3. 执行查询 `INSERT INTO SELECT * FROM `. 此请求将未损坏的数据从损坏的表复制到另一个表。 只有损坏部分之前的数据才会被复制。 -4. 重新启动 `clickhouse-client` 要重置 `max_threads` 价值。 - -## DESCRIBE TABLE {#misc-describe-table} - -``` sql -DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -返回以下内容 `String` 类型列: - -- `name` — Column name. -- `type`— Column type. -- `default_type` — Clause that is used in [默认表达式](create.md#create-default-values) (`DEFAULT`, `MATERIALIZED` 或 `ALIAS`). 如果未指定默认表达式,则Column包含一个空字符串。 -- `default_expression` — Value specified in the `DEFAULT` 条款 -- `comment_expression` — Comment text. - -嵌套的数据结构输出 “expanded” 格式。 每列分别显示,名称后面有一个点。 - -## DETACH {#detach} - -删除有关 ‘name’ 表从服务器。 服务器停止了解表的存在。 - -``` sql -DETACH TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -这不会删除表的数据或元数据。 在下一次服务器启动时,服务器将读取元数据并再次查找有关表的信息。 -同样,一个 “detached” 表可以使用重新连接 `ATTACH` 查询(系统表除外,它们没有为它们存储元数据)。 - -没有 `DETACH DATABASE` 查询。 - -## DROP {#drop} - -此查询有两种类型: `DROP DATABASE` 和 `DROP TABLE`. - -``` sql -DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] -``` - -删除内部的所有表 ‘db’ 数据库,然后删除 ‘db’ 数据库本身。 -如果 `IF EXISTS` 如果数据库不存在,则不会返回错误。 - -``` sql -DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -删除表。 -如果 `IF EXISTS` 如果表不存在或数据库不存在,则不会返回错误。 - - DROP DICTIONARY [IF EXISTS] [db.]name - -删除字典。 -如果 `IF EXISTS` 如果表不存在或数据库不存在,则不会返回错误。 - -## EXISTS {#exists} - -``` sql -EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] -``` - -返回单 `UInt8`-type column,其中包含单个值 `0` 如果表或数据库不存在,或 `1` 如果该表存在于指定的数据库中。 - -## KILL QUERY {#kill-query} - -``` sql -KILL QUERY [ON CLUSTER cluster] - WHERE - [SYNC|ASYNC|TEST] - [FORMAT format] -``` - -尝试强制终止当前正在运行的查询。 -要终止的查询是从系统中选择的。使用在定义的标准进程表 `WHERE` 《公约》条款 `KILL` 查询。 - -例: - -``` sql --- Forcibly terminates all queries with the specified query_id: -KILL QUERY WHERE query_id='2-857d-4a57-9ee0-327da5d60a90' - --- Synchronously terminates all queries run by 'username': -KILL QUERY WHERE user='username' SYNC -``` - -只读用户只能停止自己的查询。 - -默认情况下,使用异步版本的查询 (`ASYNC`),不等待确认查询已停止。 - -同步版本 (`SYNC`)等待所有查询停止,并在停止时显示有关每个进程的信息。 -响应包含 `kill_status` 列,它可以采用以下值: - -1. ‘finished’ – The query was terminated successfully. -2. ‘waiting’ – Waiting for the query to end after sending it a signal to terminate. -3. The other values ​​explain why the query can't be stopped. - -测试查询 (`TEST`)仅检查用户的权限并显示要停止的查询列表。 - -## KILL MUTATION {#kill-mutation} - -``` sql -KILL MUTATION [ON CLUSTER cluster] - WHERE - [TEST] - [FORMAT format] -``` - -尝试取消和删除 [突变](alter.md#alter-mutations) 当前正在执行。 要取消的突变选自 [`system.mutations`](../../operations/system_tables.md#system_tables-mutations) 表使用由指定的过滤器 `WHERE` 《公约》条款 `KILL` 查询。 - -测试查询 (`TEST`)仅检查用户的权限并显示要停止的查询列表。 - -例: - -``` sql --- Cancel and remove all mutations of the single table: -KILL MUTATION WHERE database = 'default' AND table = 'table' - --- Cancel the specific mutation: -KILL MUTATION WHERE database = 'default' AND table = 'table' AND mutation_id = 'mutation_3.txt' -``` - -The query is useful when a mutation is stuck and cannot finish (e.g. if some function in the mutation query throws an exception when applied to the data contained in the table). - -已经由突变所做的更改不会回滚。 - -## OPTIMIZE {#misc_operations-optimize} - -``` sql -OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE] -``` - -此查询尝试使用来自表引擎的表初始化表的数据部分的非计划合并 [MergeTree](../../engines/table_engines/mergetree_family/mergetree.md) 家人 - -该 `OPTMIZE` 查询也支持 [MaterializedView](../../engines/table_engines/special/materializedview.md) 和 [缓冲区](../../engines/table_engines/special/buffer.md) 引擎 不支持其他表引擎。 - -当 `OPTIMIZE` 与使用 [ReplicatedMergeTree](../../engines/table_engines/mergetree_family/replication.md) 表引擎的家族,ClickHouse创建合并任务,并等待在所有节点上执行(如果 `replication_alter_partitions_sync` 设置已启用)。 - -- 如果 `OPTIMIZE` 出于任何原因不执行合并,它不通知客户端。 要启用通知,请使用 [optimize\_throw\_if\_noop](../../operations/settings/settings.md#setting-optimize_throw_if_noop) 设置。 -- 如果您指定 `PARTITION`,仅优化指定的分区。 [如何设置分区表达式](alter.md#alter-how-to-specify-part-expr). -- 如果您指定 `FINAL`,即使所有数据已经在一个部分中,也会执行优化。 -- 如果您指定 `DEDUPLICATE`,然后完全相同的行将被重复数据删除(所有列进行比较),这仅适用于MergeTree引擎。 - -!!! warning "警告" - `OPTIMIZE` 无法修复 “Too many parts” 错误 - -## RENAME {#misc_operations-rename} - -重命名一个或多个表。 - -``` sql -RENAME TABLE [db11.]name11 TO [db12.]name12, [db21.]name21 TO [db22.]name22, ... [ON CLUSTER cluster] -``` - -所有表都在全局锁定下重命名。 重命名表是一个轻型操作。 如果您在TO之后指定了另一个数据库,则表将被移动到此数据库。 但是,包含数据库的目录必须位于同一文件系统中(否则,将返回错误)。 - -## SET {#query-set} - -``` sql -SET param = value -``` - -分配 `value` 到 `param` [设置](../../operations/settings/index.md) 对于当前会话。 你不能改变 [服务器设置](../../operations/server_configuration_parameters/index.md) 这边 - -您还可以在单个查询中设置指定设置配置文件中的所有值。 - -``` sql -SET profile = 'profile-name-from-the-settings-file' -``` - -有关详细信息,请参阅 [设置](../../operations/settings/settings.md). - -## TRUNCATE {#truncate} - -``` sql -TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster] -``` - -从表中删除所有数据。 当条款 `IF EXISTS` 如果该表不存在,则查询返回错误。 - -该 `TRUNCATE` 查询不支持 [查看](../../engines/table_engines/special/view.md), [文件](../../engines/table_engines/special/file.md), [URL](../../engines/table_engines/special/url.md) 和 [Null](../../engines/table_engines/special/null.md) 表引擎. - -## USE {#use} - -``` sql -USE db -``` - -用于设置会话的当前数据库。 -当前数据库用于搜索表,如果数据库没有在查询中明确定义与表名之前的点。 -使用HTTP协议时无法进行此查询,因为没有会话的概念。 - -[原始文章](https://clickhouse.tech/docs/en/query_language/misc/) diff --git a/docs/zh/sql_reference/statements/select.md b/docs/zh/sql_reference/statements/select.md deleted file mode 100644 index 9f4e71c3343..00000000000 --- a/docs/zh/sql_reference/statements/select.md +++ /dev/null @@ -1,937 +0,0 @@ - -# SELECT 查询语法 {#select-cha-xun-yu-fa} - -`SELECT` 语句用于执行数据的检索。 - -``` sql -SELECT [DISTINCT] expr_list - [FROM [db.]table | (subquery) | table_function] [FINAL] - [SAMPLE sample_coeff] - [ARRAY JOIN ...] - [GLOBAL] ANY|ALL INNER|LEFT JOIN (subquery)|table USING columns_list - [PREWHERE expr] - [WHERE expr] - [GROUP BY expr_list] [WITH TOTALS] - [HAVING expr] - [ORDER BY expr_list] - [LIMIT n BY columns] - [LIMIT [n, ]m] - [UNION ALL ...] - [INTO OUTFILE filename] - [FORMAT format] -``` - -所有的子句都是可选的,除了SELECT之后的表达式列表(expr\_list)。 -下面将按照查询运行的顺序逐一对各个子句进行说明。 - -如果查询中不包含`DISTINCT`,`GROUP BY`,`ORDER BY`子句以及`IN`和`JOIN`子查询,那么它将仅使用O(1)数量的内存来完全流式的处理查询 -否则,这个查询将消耗大量的内存,除非你指定了这些系统配置:`max_memory_usage`, `max_rows_to_group_by`, `max_rows_to_sort`, `max_rows_in_distinct`, `max_bytes_in_distinct`, `max_rows_in_set`, `max_bytes_in_set`, `max_rows_in_join`, `max_bytes_in_join`, `max_bytes_before_external_sort`, `max_bytes_before_external_group_by`。它们规定了可以使用外部排序(将临时表存储到磁盘中)以及外部聚合,`目前系统不存在关于Join的配置`,更多关于它们的信息,可以参见«配置»部分。 - -### FROM 子句 {#select-from} - -如果查询中不包含FROM子句,那么将读取`system.one`。 -`system.one`中仅包含一行数据(此表实现了与其他数据库管理系统中的DUAL相同的功能)。 - -FROM子句规定了将从哪个表、或子查询、或表函数中读取数据;同时ARRAY JOIN子句和JOIN子句也可以出现在这里(见后文)。 - -可以使用包含在括号里的子查询来替代表。 -在这种情况下,子查询的处理将会构建在外部的查询内部。 -不同于SQL标准,子查询后无需指定别名。为了兼容,你可以在子查询后添加'AS 别名',但是指定的名字不能被使用在任何地方。 - -也可以使用表函数来代替表,有关信息,参见«表函数»。 - -执行查询时,在查询中列出的所有列都将从对应的表中提取数据;如果你使用的是子查询的方式,则任何在外部查询中没有使用的列,子查询将从查询中忽略它们; -如果你的查询没有列出任何的列(例如,SELECT count() FROM t),则将额外的从表中提取一些列(最好的情况下是最小的列),以便计算行数。 - -最后的FINAL修饰符仅能够被使用在SELECT from CollapsingMergeTree场景中。当你为FROM指定了FINAL修饰符时,你的查询结果将会在查询过程中被聚合。需要注意的是,在这种情况下,查询将在单个流中读取所有相关的主键列,同时对需要的数据进行合并。这意味着,当使用FINAL修饰符时,查询将会处理的更慢。在大多数情况下,你应该避免使用FINAL修饰符。更多信息,请参阅«CollapsingMergeTree引擎»部分。 - -### SAMPLE 子句 {#select-sample-clause} - -通过SAMPLE子句用户可以进行近似查询处理,近似查询处理仅能工作在MergeTree\*类型的表中,并且在创建表时需要您指定采样表达式(参见«MergeTree 引擎»部分)。 - -`SAMPLE`子句可以使用`SAMPLE k`来表示,其中k可以是0到1的小数值,或者是一个足够大的正整数值。 - -当k为0到1的小数时,查询将使用'k'作为百分比选取数据。例如,`SAMPLE 0.1`查询只会检索数据总量的10%。 -当k为一个足够大的正整数时,查询将使用'k'作为最大样本数。例如, `SAMPLE 10000000`查询只会检索最多10,000,000行数据。 - -示例: - -``` sql -SELECT - Title, - count() * 10 AS PageViews -FROM hits_distributed -SAMPLE 0.1 -WHERE - CounterID = 34 - AND toDate(EventDate) >= toDate('2013-01-29') - AND toDate(EventDate) <= toDate('2013-02-04') - AND NOT DontCountHits - AND NOT Refresh - AND Title != '' -GROUP BY Title -ORDER BY PageViews DESC LIMIT 1000 -``` - -在这个例子中,查询将检索数据总量的0.1 (10%)的数据。值得注意的是,查询不会自动校正聚合函数最终的结果,所以为了得到更加精确的结果,需要将`count()`的结果手动乘以10。 - -当使用像`SAMPLE 10000000`这样的方式进行近似查询时,由于没有了任何关于将会处理了哪些数据或聚合函数应该被乘以几的信息,所以这种方式不适合在这种场景下使用。 - -使用相同的采样率得到的结果总是一致的:如果我们能够看到所有可能存在在表中的数据,那么相同的采样率总是能够得到相同的结果(在建表时使用相同的采样表达式),换句话说,系统在不同的时间,不同的服务器,不同表上总以相同的方式对数据进行采样。 - -例如,我们可以使用采样的方式获取到与不进行采样相同的用户ID的列表。这将表明,你可以在IN子查询中使用采样,或者使用采样的结果与其他查询进行关联。 - -### ARRAY JOIN 子句 {#select-array-join-clause} - -ARRAY JOIN子句可以帮助查询进行与数组和nested数据类型的连接。它有点类似arrayJoin函数,但它的功能更广泛。 - -`ARRAY JOIN` 本质上等同于`INNERT JOIN`数组。 例如: - - :) CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory - - CREATE TABLE arrays_test - ( - s String, - arr Array(UInt8) - ) ENGINE = Memory - - Ok. - - 0 rows in set. Elapsed: 0.001 sec. - - :) INSERT INTO arrays_test VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []) - - INSERT INTO arrays_test VALUES - - Ok. - - 3 rows in set. Elapsed: 0.001 sec. - - :) SELECT * FROM arrays_test - - SELECT * - FROM arrays_test - - ┌─s───────┬─arr─────┐ - │ Hello │ [1,2] │ - │ World │ [3,4,5] │ - │ Goodbye │ [] │ - └─────────┴─────────┘ - - 3 rows in set. Elapsed: 0.001 sec. - - :) SELECT s, arr FROM arrays_test ARRAY JOIN arr - - SELECT s, arr - FROM arrays_test - ARRAY JOIN arr - - ┌─s─────┬─arr─┐ - │ Hello │ 1 │ - │ Hello │ 2 │ - │ World │ 3 │ - │ World │ 4 │ - │ World │ 5 │ - └───────┴─────┘ - - 5 rows in set. Elapsed: 0.001 sec. - -你还可以为ARRAY JOIN子句指定一个别名,这时你可以通过这个别名来访问数组中的数据,但是数据本身仍然可以通过原来的名称进行访问。例如: - - :) SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a - - SELECT s, arr, a - FROM arrays_test - ARRAY JOIN arr AS a - - ┌─s─────┬─arr─────┬─a─┐ - │ Hello │ [1,2] │ 1 │ - │ Hello │ [1,2] │ 2 │ - │ World │ [3,4,5] │ 3 │ - │ World │ [3,4,5] │ 4 │ - │ World │ [3,4,5] │ 5 │ - └───────┴─────────┴───┘ - - 5 rows in set. Elapsed: 0.001 sec. - -当多个具有相同大小的数组使用逗号分割出现在ARRAY JOIN子句中时,ARRAY JOIN会将它们同时执行(直接合并,而不是它们的笛卡尔积)。例如: - - :) SELECT s, arr, a, num, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped - - SELECT s, arr, a, num, mapped - FROM arrays_test - ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(lambda(tuple(x), plus(x, 1)), arr) AS mapped - - ┌─s─────┬─arr─────┬─a─┬─num─┬─mapped─┐ - │ Hello │ [1,2] │ 1 │ 1 │ 2 │ - │ Hello │ [1,2] │ 2 │ 2 │ 3 │ - │ World │ [3,4,5] │ 3 │ 1 │ 4 │ - │ World │ [3,4,5] │ 4 │ 2 │ 5 │ - │ World │ [3,4,5] │ 5 │ 3 │ 6 │ - └───────┴─────────┴───┴─────┴────────┘ - - 5 rows in set. Elapsed: 0.002 sec. - - :) SELECT s, arr, a, num, arrayEnumerate(arr) FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num - - SELECT s, arr, a, num, arrayEnumerate(arr) - FROM arrays_test - ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num - - ┌─s─────┬─arr─────┬─a─┬─num─┬─arrayEnumerate(arr)─┐ - │ Hello │ [1,2] │ 1 │ 1 │ [1,2] │ - │ Hello │ [1,2] │ 2 │ 2 │ [1,2] │ - │ World │ [3,4,5] │ 3 │ 1 │ [1,2,3] │ - │ World │ [3,4,5] │ 4 │ 2 │ [1,2,3] │ - │ World │ [3,4,5] │ 5 │ 3 │ [1,2,3] │ - └───────┴─────────┴───┴─────┴─────────────────────┘ - - 5 rows in set. Elapsed: 0.002 sec. - -另外ARRAY JOIN也可以工作在nested数据结构上。例如: - - :) CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory - - CREATE TABLE nested_test - ( - s String, - nest Nested( - x UInt8, - y UInt32) - ) ENGINE = Memory - - Ok. - - 0 rows in set. Elapsed: 0.006 sec. - - :) INSERT INTO nested_test VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []) - - INSERT INTO nested_test VALUES - - Ok. - - 3 rows in set. Elapsed: 0.001 sec. - - :) SELECT * FROM nested_test - - SELECT * - FROM nested_test - - ┌─s───────┬─nest.x──┬─nest.y─────┐ - │ Hello │ [1,2] │ [10,20] │ - │ World │ [3,4,5] │ [30,40,50] │ - │ Goodbye │ [] │ [] │ - └─────────┴─────────┴────────────┘ - - 3 rows in set. Elapsed: 0.001 sec. - - :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest - - SELECT s, `nest.x`, `nest.y` - FROM nested_test - ARRAY JOIN nest - - ┌─s─────┬─nest.x─┬─nest.y─┐ - │ Hello │ 1 │ 10 │ - │ Hello │ 2 │ 20 │ - │ World │ 3 │ 30 │ - │ World │ 4 │ 40 │ - │ World │ 5 │ 50 │ - └───────┴────────┴────────┘ - - 5 rows in set. Elapsed: 0.001 sec. - -当你在ARRAY JOIN指定nested数据类型的名称时,其作用与与包含所有数组元素的ARRAY JOIN相同,例如: - - :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y - - SELECT s, `nest.x`, `nest.y` - FROM nested_test - ARRAY JOIN `nest.x`, `nest.y` - - ┌─s─────┬─nest.x─┬─nest.y─┐ - │ Hello │ 1 │ 10 │ - │ Hello │ 2 │ 20 │ - │ World │ 3 │ 30 │ - │ World │ 4 │ 40 │ - │ World │ 5 │ 50 │ - └───────┴────────┴────────┘ - - 5 rows in set. Elapsed: 0.001 sec. - -这种方式也是可以运行的: - - :) SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x - - SELECT s, `nest.x`, `nest.y` - FROM nested_test - ARRAY JOIN `nest.x` - - ┌─s─────┬─nest.x─┬─nest.y─────┐ - │ Hello │ 1 │ [10,20] │ - │ Hello │ 2 │ [10,20] │ - │ World │ 3 │ [30,40,50] │ - │ World │ 4 │ [30,40,50] │ - │ World │ 5 │ [30,40,50] │ - └───────┴────────┴────────────┘ - - 5 rows in set. Elapsed: 0.001 sec. - -为了方便使用原来的nested类型的数组,你可以为nested类型定义一个别名。例如: - - :) SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n - - SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y` - FROM nested_test - ARRAY JOIN nest AS n - - ┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┐ - │ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ - │ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ - │ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ - │ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ - │ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ - └───────┴─────┴─────┴─────────┴────────────┘ - - 5 rows in set. Elapsed: 0.001 sec. - -使用arrayEnumerate函数的示例: - - :) SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num - - SELECT s, `n.x`, `n.y`, `nest.x`, `nest.y`, num - FROM nested_test - ARRAY JOIN nest AS n, arrayEnumerate(`nest.x`) AS num - - ┌─s─────┬─n.x─┬─n.y─┬─nest.x──┬─nest.y─────┬─num─┐ - │ Hello │ 1 │ 10 │ [1,2] │ [10,20] │ 1 │ - │ Hello │ 2 │ 20 │ [1,2] │ [10,20] │ 2 │ - │ World │ 3 │ 30 │ [3,4,5] │ [30,40,50] │ 1 │ - │ World │ 4 │ 40 │ [3,4,5] │ [30,40,50] │ 2 │ - │ World │ 5 │ 50 │ [3,4,5] │ [30,40,50] │ 3 │ - └───────┴─────┴─────┴─────────┴────────────┴─────┘ - - 5 rows in set. Elapsed: 0.002 sec. - -在一个查询中只能出现一个ARRAY JOIN子句。 - -如果在WHERE/PREWHERE子句中使用了ARRAY JOIN子句的结果,它将优先于WHERE/PREWHERE子句执行,否则它将在WHERE/PRWHERE子句之后执行,以便减少计算。 - -### JOIN 子句 {#select-join} - -JOIN子句用于连接数据,作用与[SQL JOIN](https://en.wikipedia.org/wiki/Join_(SQL))的定义相同。 - -!!! info "注意" - 与 [ARRAY JOIN](#select-array-join-clause) 没有关系. - -``` sql -SELECT -FROM -[GLOBAL] [ANY|ALL] INNER|LEFT|RIGHT|FULL|CROSS [OUTER] JOIN -(ON )|(USING ) ... -``` - -可以使用具体的表名来代替``与``。但这与使用`SELECT * FROM table`子查询的方式相同。除非你的表是\[Join\](../operations/table\_engines/join.md -**支持的`JOIN`类型** - -- `INNER JOIN` -- `LEFT OUTER JOIN` -- `RIGHT OUTER JOIN` -- `FULL OUTER JOIN` -- `CROSS JOIN` - -你可以跳过默认的`OUTER`关键字。 - -**`ANY` 与 `ALL`** - -在使用`ALL`修饰符对JOIN进行修饰时,如果右表中存在多个与左表关联的数据,那么系统则将右表中所有可以与左表关联的数据全部返回在结果中。这与SQL标准的JOIN行为相同。 -在使用`ANY`修饰符对JOIN进行修饰时,如果右表中存在多个与左表关联的数据,那么系统仅返回第一个与左表匹配的结果。如果左表与右表一一对应,不存在多余的行时,`ANY`与`ALL`的结果相同。 - -你可以在会话中通过设置 [join\_default\_strictness](../../operations/settings/settings.md) 来指定默认的JOIN修饰符。 - -**`GLOBAL` 分布** - -当使用普通的`JOIN`时,查询将被发送给远程的服务器。并在这些远程服务器上生成右表并与它们关联。换句话说,右表来自于各个服务器本身。 - -当使用`GLOBAL ... JOIN`,首先会在请求服务器上计算右表并以临时表的方式将其发送到所有服务器。这时每台服务器将直接使用它进行计算。 - -使用`GLOBAL`时需要小心。更多信息,参阅 [分布式子查询](#select-distributed-subqueries) 部分。 - -**使用建议** - -从子查询中删除所有`JOIN`不需要的列。 - -当执行`JOIN`查询时,因为与其他阶段相比没有进行执行顺序的优化:JOIN优先于WHERE与聚合执行。因此,为了显示的指定执行顺序,我们推荐你使用子查询的方式执行`JOIN`。 - -示例: - -``` sql -SELECT - CounterID, - hits, - visits -FROM -( - SELECT - CounterID, - count() AS hits - FROM test.hits - GROUP BY CounterID -) ANY LEFT JOIN -( - SELECT - CounterID, - sum(Sign) AS visits - FROM test.visits - GROUP BY CounterID -) USING CounterID -ORDER BY hits DESC -LIMIT 10 -``` - - ┌─CounterID─┬───hits─┬─visits─┐ - │ 1143050 │ 523264 │ 13665 │ - │ 731962 │ 475698 │ 102716 │ - │ 722545 │ 337212 │ 108187 │ - │ 722889 │ 252197 │ 10547 │ - │ 2237260 │ 196036 │ 9522 │ - │ 23057320 │ 147211 │ 7689 │ - │ 722818 │ 90109 │ 17847 │ - │ 48221 │ 85379 │ 4652 │ - │ 19762435 │ 77807 │ 7026 │ - │ 722884 │ 77492 │ 11056 │ - └───────────┴────────┴────────┘ - -子查询不允许您设置别名或在其他地方引用它们。 -`USING`中指定的列必须在两个子查询中具有相同的名称,而其他列必须具有不同的名称。您可以通过使用别名的方式来更改子查询中的列名(示例中就分别使用了'hits'与'visits'别名)。 - -`USING`子句用于指定要进行链接的一个或多个列,系统会将这些列在两张表中相等的值连接起来。如果列是一个列表,不需要使用括号包裹。同时JOIN不支持其他更复杂的Join方式。 - -右表(子查询的结果)将会保存在内存中。如果没有足够的内存,则无法运行`JOIN`。 - -只能在查询中指定一个`JOIN`。若要运行多个`JOIN`,你可以将它们放入子查询中。 - -每次运行相同的`JOIN`查询,总是会再次计算 - 没有缓存结果。 为了避免这种情况,可以使用'Join'引擎,它是一个预处理的Join数据结构,总是保存在内存中。更多信息,参见«Join引擎»部分。 - -在一些场景下,使用`IN`代替`JOIN`将会得到更高的效率。在各种类型的JOIN中,最高效的是`ANY LEFT JOIN`,然后是`ANY INNER JOIN`,效率最差的是`ALL LEFT JOIN`以及`ALL INNER JOIN`。 - -如果你需要使用`JOIN`来关联一些纬度表(包含纬度属性的一些相对比较小的表,例如广告活动的名称),那么`JOIN`可能不是好的选择,因为语法负责,并且每次查询都将重新访问这些表。对于这种情况,您应该使用«外部字典»的功能来替换`JOIN`。更多信息,参见 [外部字典](../../sql_reference/statements/select.md) 部分。 - -#### Null的处理 {#nullde-chu-li} - -JOIN的行为受 [join\_use\_nulls](../../operations/settings/settings.md) 的影响。当`join_use_nulls=1`时,`JOIN`的工作与SQL标准相同。 - -如果JOIN的key是 [可为空](../../sql_reference/statements/select.md) 类型的字段,则其中至少一个存在 [NULL](../syntax.md) 值的key不会被关联。 - -### WHERE 子句 {#select-where} - -如果存在WHERE子句, 则在该子句中必须包含一个UInt8类型的表达式。 这个表达是通常是一个带有比较和逻辑的表达式。 -这个表达式将会在所有数据转换前用来过滤数据。 - -如果在支持索引的数据库表引擎中,这个表达式将被评估是否使用索引。 - -### PREWHERE 子句 {#prewhere-zi-ju} - -这个子句与WHERE子句的意思相同。主要的不同之处在于表数据的读取。 -当使用PREWHERE时,首先只读取PREWHERE表达式中需要的列。然后在根据PREWHERE执行的结果读取其他需要的列。 - -如果在过滤条件中有少量不适合索引过滤的列,但是它们又可以提供很强的过滤能力。这时使用PREWHERE是有意义的,因为它将帮助减少数据的读取。 - -例如,在一个需要提取大量列的查询中为少部分列编写PREWHERE是很有作用的。 - -PREWHERE 仅支持`*MergeTree`系列引擎。 - -在一个查询中可以同时指定PREWHERE和WHERE,在这种情况下,PREWHERE优先于WHERE执行。 - -值得注意的是,PREWHERE不适合用于已经存在于索引中的列,因为当列已经存在于索引中的情况下,只有满足索引的数据块才会被读取。 - -如果将'optimize\_move\_to\_prewhere'设置为1,并且在查询中不包含PREWHERE,则系统将自动的把适合PREWHERE表达式的部分从WHERE中抽离到PREWHERE中。 - -### GROUP BY 子句 {#select-group-by-clause} - -这是列式数据库管理系统中最重要的一部分。 - -如果存在GROUP BY子句,则在该子句中必须包含一个表达式列表。其中每个表达式将会被称之为«key»。 -SELECT,HAVING,ORDER BY子句中的表达式列表必须来自于这些«key»或聚合函数。简而言之,被选择的列中不能包含非聚合函数或key之外的其他列。 - -如果查询表达式列表中仅包含聚合函数,则可以省略GROUP BY子句,这时会假定将所有数据聚合成一组空«key»。 - -示例: - -``` sql -SELECT - count(), - median(FetchTiming > 60 ? 60 : FetchTiming), - count() - sum(Refresh) -FROM hits -``` - -与SQL标准不同的是,如果表中不存在任何数据(可能表本身中就不存在任何数据,或者由于被WHERE条件过滤掉了),将返回一个空结果,而不是一个包含聚合函数初始值的结果。 - -与MySQL不同的是(实际上这是符合SQL标准的),你不能够获得一个不在key中的非聚合函数列(除了常量表达式)。但是你可以使用'any'(返回遇到的第一个值)、max、min等聚合函数使它工作。 - -示例: - -``` sql -SELECT - domainWithoutWWW(URL) AS domain, - count(), - any(Title) AS title -- getting the first occurred page header for each domain. -FROM hits -GROUP BY domain -``` - -GROUP BY子句会为遇到的每一个不同的key计算一组聚合函数的值。 - -在GROUP BY子句中不支持使用Array类型的列。 - -常量不能作为聚合函数的参数传入聚合函数中。例如: sum(1)。这种情况下你可以省略常量。例如:`count()`。 - -#### NULL 处理 {#null-chu-li} - -对于GROUP BY子句,ClickHouse将 [NULL](../syntax.md) 解释为一个值,并且支持`NULL=NULL`。 - -下面这个例子将说明这将意味着什么。 - -假设你有这样一张表: - - ┌─x─┬────y─┐ - │ 1 │ 2 │ - │ 2 │ ᴺᵁᴸᴸ │ - │ 3 │ 2 │ - │ 3 │ 3 │ - │ 3 │ ᴺᵁᴸᴸ │ - └───┴──────┘ - -运行`SELECT sum(x), y FROM t_null_big GROUP BY y`你将得到如下结果: - - ┌─sum(x)─┬────y─┐ - │ 4 │ 2 │ - │ 3 │ 3 │ - │ 5 │ ᴺᵁᴸᴸ │ - └────────┴──────┘ - -你可以看到GROUP BY为`y=NULL`的聚合了x。 - -如果你在向`GROUP BY`中放入几个key,结果将列出所有的组合可能。就像`NULL`是一个特定的值一样。 - -#### WITH TOTALS 修饰符 {#with-totals-xiu-shi-fu} - -如果你指定了WITH TOTALS修饰符,你将会在结果中得到一个被额外计算出的行。在这一行中将包含所有key的默认值(零或者空值),以及所有聚合函数对所有被选择数据行的聚合结果。 - -该行仅在JSON\*, TabSeparated\*, Pretty\*输出格式中与其他行分开输出。 - -在JSON\*输出格式中,这行将出现在Json的'totals'字段中。在TabSeparated\*输出格式中,这行将位于其他结果之后,同时与其他结果使用空白行分隔。在Pretty\*输出格式中,这行将作为单独的表在所有结果之后输出。 - -当`WITH TOTALS`与HAVING子句同时存在时,它的行为受'totals\_mode'配置的影响。 -默认情况下,`totals_mode = 'before_having'`,这时`WITH TOTALS`将会在HAVING前计算最多不超过`max_rows_to_group_by`行的数据。 - -在`group_by_overflow_mode = 'any'`并指定了`max_rows_to_group_by`的情况下,`WITH TOTALS`的行为受`totals_mode`的影响。 - -`after_having_exclusive` - 在HAVING后进行计算,计算不超过`max_rows_to_group_by`行的数据。 - -`after_having_inclusive` - 在HAVING后进行计算,计算不少于`max_rows_to_group_by`行的数据。 - -`after_having_auto` - 在HAVING后进行计算,采用统计通过HAVING的行数,在超过不超过'max\_rows\_to\_group\_by'指定值(默认为50%)的情况下,包含所有行的结果。否则排除这些结果。 - -`totals_auto_threshold` - 默认 0.5,是`after_having_auto`的参数。 - -如果`group_by_overflow_mode != 'any'`并没有指定`max_rows_to_group_by`情况下,所有的模式都与`after_having`相同。 - -你可以在子查询,包含子查询的JOIN子句中使用WITH TOTALS(在这种情况下,它们各自的总值会被组合在一起)。 - -#### GROUP BY 使用外部存储设备 {#select-group-by-in-external-memory} - -你可以在GROUP BY中允许将临时数据转存到磁盘上,以限制对内存的使用。 -`max_bytes_before_external_group_by`这个配置确定了在GROUP BY中启动将临时数据转存到磁盘上的内存阈值。如果你将它设置为0(这是默认值),这项功能将被禁用。 - -当使用`max_bytes_before_external_group_by`时,我们建议将max\_memory\_usage设置为它的两倍。这是因为一个聚合需要两个阶段来完成:(1)读取数据并形成中间数据 (2)合并中间数据。临时数据的转存只会发生在第一个阶段。如果没有发生临时文件的转存,那么阶段二将最多消耗与1阶段相同的内存大小。 - -例如:如果将`max_memory_usage`设置为10000000000并且你想要开启外部聚合,那么你需要将`max_bytes_before_external_group_by`设置为10000000000的同时将`max_memory_usage`设置为20000000000。当外部聚合被触发时(如果刚好只形成了一份临时数据),它的内存使用量将会稍高与`max_bytes_before_external_group_by`。 - -在分布式查询处理中,外部聚合将会在远程的服务器中执行。为了使请求服务器只使用较少的内存,可以设置`distributed_aggregation_memory_efficient`为1。 - -当合并被刷到磁盘的临时数据以及合并远程的服务器返回的结果时,如果在启动`distributed_aggregation_memory_efficient`的情况下,将会消耗1/256 \* 线程数的总内存大小。 - -当启动外部聚合时,如果数据的大小小于`max_bytes_before_external_group_by`设置的值(数据没有被刷到磁盘中),那么数据的聚合速度将会和没有启动外部聚合时一样快。如果有临时数据被刷到了磁盘中,那么这个查询的运行时间将会被延长几倍(大约是3倍)。 - -如果你在GROUP BY后面存在ORDER BY子句,并且ORDER BY后面存在一个极小限制的LIMIT,那么ORDER BY子句将不会使用太多内存。 -否则请不要忘记启动外部排序(`max_bytes_before_external_sort`)。 - -### LIMIT N BY 子句 {#limit-n-by-zi-ju} - -LIMIT N BY子句和LIMIT没有关系, LIMIT N BY COLUMNS 子句可以用来在每一个COLUMNS分组中求得最大的N行数据。我们可以将它们同时用在一个查询中。LIMIT N BY子句中可以包含任意多个分组字段表达式列表。 - -示例: - -``` sql -SELECT - domainWithoutWWW(URL) AS domain, - domainWithoutWWW(REFERRER_URL) AS referrer, - device_type, - count() cnt -FROM hits -GROUP BY domain, referrer, device_type -ORDER BY cnt DESC -LIMIT 5 BY domain, device_type -LIMIT 100 -``` - -查询将会为每个`domain, device_type`的组合选出前5个访问最多的数据,但是结果最多将不超过100行(`LIMIT n BY + LIMIT`)。 - -### HAVING 子句 {#having-zi-ju} - -HAVING子句可以用来过滤GROUP BY之后的数据,类似于WHERE子句。 -WHERE于HAVING不同之处在于WHERE在聚合前(GROUP BY)执行,HAVING在聚合后执行。 -如果不存在聚合,则不能使用HAVING。 - -### ORDER BY 子句 {#select-order-by} - -如果存在ORDER BY 子句,则该子句中必须存在一个表达式列表,表达式列表中每一个表达式都可以分配一个DESC或ASC(排序的方向)。如果没有指明排序的方向,将假定以ASC的方式进行排序。其中ASC表示按照升序排序,DESC按照降序排序。示例:`ORDER BY Visits DESC, SearchPhrase` - -对于字符串的排序来讲,你可以为其指定一个排序规则,在指定排序规则时,排序总是不会区分大小写。并且如果与ASC或DESC同时出现时,排序规则必须在它们的后面指定。例如:`ORDER BY SearchPhrase COLLATE 'tr'` - 使用土耳其字母表对它进行升序排序,同时排序时不会区分大小写,并按照UTF-8字符集进行编码。 - -我们推荐只在少量的数据集中使用COLLATE,因为COLLATE的效率远低于正常的字节排序。 - -针对排序表达式中相同值的行将以任意的顺序进行输出,这是不确定的(每次都可能不同)。 -如果省略ORDER BY子句,则结果的顺序也是不固定的。 - -`NaN` 和 `NULL` 的排序规则: - -- 当使用`NULLS FIRST`修饰符时,将会先输出`NULL`,然后是`NaN`,最后才是其他值。 -- 当使用`NULLS LAST`修饰符时,将会先输出其他值,然后是`NaN`,最后才是`NULL`。 -- 默认情况下与使用`NULLS LAST`修饰符相同。 - -示例: - -假设存在如下一张表 - - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 2 │ 2 │ - │ 1 │ nan │ - │ 2 │ 2 │ - │ 3 │ 4 │ - │ 5 │ 6 │ - │ 6 │ nan │ - │ 7 │ ᴺᵁᴸᴸ │ - │ 6 │ 7 │ - │ 8 │ 9 │ - └───┴──────┘ - -运行查询 `SELECT * FROM t_null_nan ORDER BY y NULLS FIRST` 将获得如下结果: - - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 7 │ ᴺᵁᴸᴸ │ - │ 1 │ nan │ - │ 6 │ nan │ - │ 2 │ 2 │ - │ 2 │ 2 │ - │ 3 │ 4 │ - │ 5 │ 6 │ - │ 6 │ 7 │ - │ 8 │ 9 │ - └───┴──────┘ - -当使用浮点类型的数值进行排序时,不管排序的顺序如何,NaNs总是出现在所有值的后面。换句话说,当你使用升序排列一个浮点数值列时,NaNs好像比所有值都要大。反之,当你使用降序排列一个浮点数值列时,NaNs好像比所有值都小。 - -如果你在ORDER BY子句后面存在LIMIT并给定了较小的数值,则将会使用较少的内存。否则,内存的使用量将与需要排序的数据成正比。对于分布式查询,如果省略了GROUP BY,则在远程服务器上执行部分排序,最后在请求服务器上合并排序结果。这意味这对于分布式查询而言,要排序的数据量可以大于单台服务器的内存。 - -如果没有足够的内存,可以使用外部排序(在磁盘中创建一些临时文件)。可以使用`max_bytes_before_external_sort`来设置外部排序,如果你讲它设置为0(默认),则表示禁用外部排序功能。如果启用该功能。当要排序的数据量达到所指定的字节数时,当前排序的结果会被转存到一个临时文件中去。当全部数据读取完毕后,所有的临时文件将会合并成最终输出结果。这些临时文件将会写到config文件配置的/var/lib/clickhouse/tmp/目录中(默认值,你可以通过修改'tmp\_path'配置调整该目录的位置)。 - -查询运行使用的内存要高于'max\_bytes\_before\_external\_sort',为此,这个配置必须要远远小于'max\_memory\_usage'配置的值。例如,如果你的服务器有128GB的内存去运行一个查询,那么推荐你将'max\_memory\_usage'设置为100GB,'max\_bytes\_before\_external\_sort'设置为80GB。 - -外部排序效率要远低于在内存中排序。 - -### SELECT 子句 {#select-zi-ju} - -在完成上述列出的所有子句后,将对SELECT子句中的表达式进行分析。 -具体来讲,如果在存在聚合函数的情况下,将对聚合函数之前的表达式进行分析。 -聚合函数与聚合函数之前的表达式都将在聚合期间完成计算(GROUP BY)。 -就像他们本身就已经存在结果上一样。 - -### DISTINCT 子句 {#select-distinct} - -如果存在DISTINCT子句,则会对结果中的完全相同的行进行去重。 -在GROUP BY不包含聚合函数,并对全部SELECT部分都包含在GROUP BY中时的作用一样。但该子句还是与GROUP BY子句存在以下几点不同: - -- 可以与GROUP BY配合使用。 -- 当不存在ORDER BY子句并存在LIMIT子句时,查询将在同时满足DISTINCT与LIMIT的情况下立即停止查询。 -- 在处理数据的同时输出结果,并不是等待整个查询全部完成。 - -在SELECT表达式中存在Array类型的列时,不能使用DISTINCT。 - -`DISTINCT`可以与 [NULL](../syntax.md)一起工作,就好像`NULL`仅是一个特殊的值一样,并且`NULL=NULL`。换而言之,在`DISTINCT`的结果中,与`NULL`不同的组合仅能出现一次。 - -### LIMIT 子句 {#limit-zi-ju} - -LIMIT m 用于在查询结果中选择前m行数据。 -LIMIT n, m 用于在查询结果中选择从n行开始的m行数据。 - -'n'与'm'必须是正整数。 - -如果没有指定ORDER BY子句,则结果可能是任意的顺序,并且是不确定的。 - -### UNION ALL 子句 {#union-all-zi-ju} - -UNION ALL子句可以组合任意数量的查询,例如: - -``` sql -SELECT CounterID, 1 AS table, toInt64(count()) AS c - FROM test.hits - GROUP BY CounterID - -UNION ALL - -SELECT CounterID, 2 AS table, sum(Sign) AS c - FROM test.visits - GROUP BY CounterID - HAVING c > 0 -``` - -仅支持UNION ALL,不支持其他UNION规则(UNION DISTINCT)。如果你需要UNION DISTINCT,你可以使用UNION ALL中包含SELECT DISTINCT的子查询的方式。 - -UNION ALL中的查询可以同时运行,它们的结果将被混合到一起。 - -这些查询的结果结果必须相同(列的数量和类型)。列名可以是不同的。在这种情况下,最终结果的列名将从第一个查询中获取。UNION会为查询之间进行类型转换。例如,如果组合的两个查询中包含相同的字段,并且是类型兼容的`Nullable`和non-`Nullable`,则结果将会将该字段转换为`Nullable`类型的字段。 - -作为UNION ALL查询的部分不能包含在括号内。ORDER BY与LIMIT子句应该被应用在每个查询中,而不是最终的查询中。如果你需要做最终结果转换,你可以将UNION ALL作为一个子查询包含在FROM子句中。 - -### INTO OUTFILE 子句 {#into-outfile-zi-ju} - -`INTO OUTFILE filename` 子句用于将查询结果重定向输出到指定文件中(filename是一个字符串类型的值)。 -与MySQL不同,执行的结果文件将在客户端建立,如果文件已存在,查询将会失败。 -此命令可以工作在命令行客户端与clickhouse-local中(通过HTTP借口发送将会失败)。 - -默认的输出格式是TabSeparated(与命令行客户端的批处理模式相同)。 - -### FORMAT 子句 {#format-zi-ju} - -‘FORMAT format’ 子句用于指定返回数据的格式。 -你可以使用它方便的转换或创建数据的转储。 -更多信息,参见«输入输出格式»部分。 -如果不存在FORMAT子句,则使用默认的格式,这将取决与DB的配置以及所使用的客户端。对于批量模式的HTTP客户端和命令行客户端而言,默认的格式是TabSeparated。对于交互模式下的命令行客户端,默认的格式是PrettyCompact(它有更加美观的格式)。 - -当使用命令行客户端时,数据以内部高效的格式在服务器和客户端之间进行传递。客户端将单独的解析FORMAT子句,以帮助数据格式的转换(这将减轻网络和服务器的负载)。 - -### IN 运算符 {#select-in-operators} - -对于`IN`、`NOT IN`、`GLOBAL IN`、`GLOBAL NOT IN`操作符被分别实现,因为它们的功能非常丰富。 - -运算符的左侧是单列或列的元组。 - -示例: - -``` sql -SELECT UserID IN (123, 456) FROM ... -SELECT (CounterID, UserID) IN ((34, 123), (101500, 456)) FROM ... -``` - -如果左侧是单个列并且是一个索引,并且右侧是一组常量时,系统将使用索引来处理查询。 - -不要在列表中列出太多的值(百万)。如果数据集很大,将它们放入临时表中(可以参考«»), 然后使用子查询。 -Don't list too many values explicitly (i.e. millions). If a data set is large, put it in a temporary table (for example, see the section «External data for query processing»), then use a subquery. - -右侧可以是一个由常量表达式组成的元组列表(像上面的例子一样),或者是一个数据库中的表的名称,或是一个包含在括号中的子查询。 - -如果右侧是一个表的名字(例如,`UserID IN users`),这相当于`UserID IN (SELECT * FROM users)`。在查询与外部数据表组合使用时可以使用该方法。例如,查询与包含user IDS的'users'临时表一起被发送的同时需要对结果进行过滤时。 - -如果操作符的右侧是一个Set引擎的表时(数据总是在内存中准备好),则不会每次都为查询创建新的数据集。 - -子查询可以指定一个列以上的元组来进行过滤。 -示例: - -``` sql -SELECT (CounterID, UserID) IN (SELECT CounterID, UserID FROM ...) FROM ... -``` - -IN操作符的左右两侧应具有相同的类型。 - -IN操作符的子查询中可以出现任意子句,包含聚合函数与lambda函数。 -示例: - -``` sql -SELECT - EventDate, - avg(UserID IN - ( - SELECT UserID - FROM test.hits - WHERE EventDate = toDate('2014-03-17') - )) AS ratio -FROM test.hits -GROUP BY EventDate -ORDER BY EventDate ASC -``` - - ┌──EventDate─┬────ratio─┐ - │ 2014-03-17 │ 1 │ - │ 2014-03-18 │ 0.807696 │ - │ 2014-03-19 │ 0.755406 │ - │ 2014-03-20 │ 0.723218 │ - │ 2014-03-21 │ 0.697021 │ - │ 2014-03-22 │ 0.647851 │ - │ 2014-03-23 │ 0.648416 │ - └────────────┴──────────┘ - -为3月17日之后的每一天计算与3月17日访问该网站的用户浏览网页的百分比。 -IN子句中的子查询仅在单个服务器上运行一次。不能够是相关子查询。 - -#### NULL 处理 {#null-chu-li-1} - -在处理中,IN操作符总是假定 [NULL](../syntax.md) 值的操作结果总是等于`0`,而不管`NULL`位于左侧还是右侧。`NULL`值不应该包含在任何数据集中,它们彼此不能够对应,并且不能够比较。 - -下面的示例中有一个`t_null`表: - - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 2 │ 3 │ - └───┴──────┘ - -运行查询`SELECT x FROM t_null WHERE y IN (NULL,3)`将得到如下结果: - - ┌─x─┐ - │ 2 │ - └───┘ - -你可以看到在查询结果中不存在`y = NULL`的结果。这是因为ClickHouse无法确定`NULL`是否包含在`(NULL,3)`数据集中,对于这次比较操作返回了`0`,并且在`SELECT`的最终输出中排除了这行。 - - SELECT y IN (NULL, 3) - FROM t_null - - ┌─in(y, tuple(NULL, 3))─┐ - │ 0 │ - │ 1 │ - └───────────────────────┘ - -#### 分布式子查询 {#select-distributed-subqueries} - -对于带有子查询的(类似与JOINs)IN中,有两种选择:普通的`IN`/`JOIN`与`GLOBAL IN` / `GLOBAL JOIN`。它们对于分布式查询的处理运行方式是不同的。 - -!!! 注意 "注意" - 请记住,下面描述的算法可能因为根据 [设置](../../operations/settings/settings.md) 配置的不同而不同。 - -当使用普通的IN时,查询总是被发送到远程的服务器,并且在每个服务器中运行«IN»或«JOIN»子句中的子查询。 - -当使用`GLOBAL IN` / `GLOBAL JOIN`时,首先会为`GLOBAL IN` / `GLOBAL JOIN`运行所有子查询,并将结果收集到临时表中,并将临时表发送到每个远程服务器,并使用该临时表运行查询。 - -对于非分布式查询,请使用普通的`IN` / `JOIN`。 - -在分布式查询中使用`IN` / `JOIN`子句中使用子查询需要小心。 - -让我们来看一些例子。假设集群中的每个服务器都存在一个正常表**local\_table**。与一个分布式表**distributed\_table**。 - -对于所有查询**distributed\_table**的查询,查询会被发送到所有的远程服务器并使用**local\_table**表运行查询。 - -例如,查询 - -``` sql -SELECT uniq(UserID) FROM distributed_table -``` - -将发送如下查询到所有远程服务器 - -``` sql -SELECT uniq(UserID) FROM local_table -``` - -这时将并行的执行它们,直到达到可以组合数据的中间结果状态。然后中间结果将返回到请求服务器并在请求服务器上进行合并,最终将结果发送给客户端。 - -现在让我运行一个带有IN的查询: - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) -``` - -- 计算两个站点的用户交集。 - -此查询将被发送给所有的远程服务器 - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM local_table WHERE CounterID = 34) -``` - -换句话说,IN子句中的数据集将被在每台服务器上被独立的收集,仅与每台服务器上的本地存储上的数据计算交集。 - -如果您已经将数据分散到了集群的每台服务器上,并且单个UserID的数据完全分布在单个服务器上,那么这将是正确且最佳的查询方式。在这种情况下,所有需要的数据都可以在每台服务器的本地进行获取。否则,结果将是不准确的。我们将这种查询称为«local IN»。 - -为了修正这种在数据随机分布的集群中的工作,你可以在子查询中使用**distributed\_table**。查询将更改为这样: - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -此查询将被发送给所有的远程服务器 - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -子查询将在每个远程服务器上执行。因为子查询使用分布式表,所有每个远程服务器上的子查询将查询再次发送给所有的远程服务器 - -``` sql -SELECT UserID FROM local_table WHERE CounterID = 34 -``` - -例如,如果你拥有100台服务器的集群,执行整个查询将需要10,000次请求,这通常被认为是不可接受的。 - -在这种情况下,你应该使用GLOBAL IN来替代IN。让我们看一下它是如何工作的。 - -``` sql -SELECT uniq(UserID) FROM distributed_table WHERE CounterID = 101500 AND UserID GLOBAL IN (SELECT UserID FROM distributed_table WHERE CounterID = 34) -``` - -在请求服务器上运行子查询 - -``` sql -SELECT UserID FROM distributed_table WHERE CounterID = 34 -``` - -将结果放入内存中的临时表中。然后将请求发送到每一台远程服务器 - -``` sql -SELECT uniq(UserID) FROM local_table WHERE CounterID = 101500 AND UserID GLOBAL IN _data1 -``` - -临时表`_data1`也会随着查询一起发送到每一台远程服务器(临时表的名称由具体实现定义)。 - -这比使用普通的IN更加理想,但是,请注意以下几点: - -1. 创建临时表时,数据不是唯一的,为了减少通过网络传输的数据量,请在子查询中使用DISTINCT(你不需要在普通的IN中这么做) -2. 临时表将发送到所有远程服务器。其中传输不考虑网络的拓扑结构。例如,如果你有10个远程服务器存在与请求服务器非常远的数据中心中,则数据将通过通道发送数据到远程数据中心10次。使用GLOBAL IN时应避免大数据集。 -3. 当向远程服务器发送数据时,网络带宽的限制是不可配置的,这可能会网络的负载造成压力。 -4. 尝试将数据跨服务器分布,这样你将不需要使用GLOBAL IN。 -5. 如果你需要经常使用GLOBAL IN,请规划你的ClickHouse集群位置,以便副本之间不存在跨数据中心,并且它们之间具有快速的网络交换能力,以便查询可以完全在一个数据中心内完成。 - -另外,在`GLOBAL IN`子句中使用本地表也是有用的,比如,本地表仅在请求服务器上可用,并且您希望在远程服务器上使用来自本地表的数据。 - -### 极端值 {#extreme-values} - -除了结果外,你还可以获得结果列的最大值与最小值,可以将**极端**配置设置成1来做到这一点。最大值最小值的计算是针对于数字类型,日期类型进行计算的,对于其他列,将会输出默认值。 - -额外计算的两行结果 - 最大值与最小值,这两行额外的结果仅在JSON\*, TabSeparated\*, and Pretty\* 格式与其他行分开的输出方式输出,不支持其他输出格式。 - -在JSON\*格式中,Extreme值在单独的'extremes'字段中。在TabSeparated\*格式中,在其他结果与'totals'之后输出,并使用空行与其分隔。在Pretty\* 格式中,将在其他结果与'totals'后以单独的表格输出。 - -如果在计算Extreme值的同时包含LIMIT。extremes的计算结果将包含offset跳过的行。在流式的请求中,它可能还包含多余LIMIT的少量行的值。 - -### 注意事项 {#zhu-yi-shi-xiang} - -不同于MySQL, `GROUP BY`与`ORDER BY`子句不支持使用列的位置信息作为参数,但这实际上是符合SQL标准的。 -例如,`GROUP BY 1, 2`将被解释为按照常量进行分组(即,所有的行将会被聚合成一行)。 - -可以在查询的任何部分使用AS。 - -可以在查询的任何部分添加星号,而不仅仅是表达式。在分析查询时,星号被替换为所有的列(不包含`MATERIALIZED`与`ALIAS`的列)。 -只有少数情况下使用星号是合理的: - -- 创建表转储时。 -- 对于仅包含几个列的表,如系统表. -- 获取表中的列信息。在这种情况下应该使用`LIMIT 1`。但是,更好的办法是使用`DESC TABLE`。 -- 当使用`PREWHERE`在少数的几个列上做强过滤时。 -- 在子查询中(因为外部查询不需要的列被排除在子查询之外)。 - -在所有的其他情况下,我们不建议使用星号,因为它是列式数据库的缺点而不是优点。 - -[来源文章](https://clickhouse.tech/docs/zh/query_language/select/) diff --git a/docs/zh/sql_reference/statements/show.md b/docs/zh/sql_reference/statements/show.md deleted file mode 100644 index f60452f97a3..00000000000 --- a/docs/zh/sql_reference/statements/show.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 38 -toc_title: SHOW ---- - -# 显示查询 {#show-queries} - -## SHOW CREATE TABLE {#show-create-table} - -``` sql -SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format] -``` - -返回单 `String`-类型 ‘statement’ column, which contains a single value – the `CREATE` 用于创建指定对象的查询。 - -## SHOW DATABASES {#show-databases} - -``` sql -SHOW DATABASES [INTO OUTFILE filename] [FORMAT format] -``` - -打印所有数据库的列表。 -这个查询是相同的 `SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]`. - -## SHOW PROCESSLIST {#show-processlist} - -``` sql -SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format] -``` - -输出的内容 [系统。流程](../../operations/system_tables.md#system_tables-processes) 表,包含目前正在处理的查询列表,除了 `SHOW PROCESSLIST` 查询。 - -该 `SELECT * FROM system.processes` 查询返回有关所有当前查询的数据。 - -提示(在控制台中执行): - -``` bash -$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'" -``` - -## SHOW TABLES {#show-tables} - -显示表的列表。 - -``` sql -SHOW [TEMPORARY] TABLES [{FROM | IN} ] [LIKE '' | WHERE expr] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -如果 `FROM` 如果未指定子句,则查询返回当前数据库中的表列表。 - -你可以得到相同的结果 `SHOW TABLES` 通过以下方式进行查询: - -``` sql -SELECT name FROM system.tables WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**示例** - -下面的查询从表的列表中选择前两行 `system` 数据库,其名称包含 `co`. - -``` sql -SHOW TABLES FROM system LIKE '%co%' LIMIT 2 -``` - -``` text -┌─name───────────────────────────┐ -│ aggregate_function_combinators │ -│ collations │ -└────────────────────────────────┘ -``` - -## SHOW DICTIONARIES {#show-dictionaries} - -显示列表 [外部字典](../../sql_reference/dictionaries/external_dictionaries/external_dicts.md). - -``` sql -SHOW DICTIONARIES [FROM ] [LIKE ''] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -如果 `FROM` 如果未指定子句,则查询从当前数据库返回字典列表。 - -你可以得到相同的结果 `SHOW DICTIONARIES` 通过以下方式进行查询: - -``` sql -SELECT name FROM system.dictionaries WHERE database = [AND name LIKE ] [LIMIT ] [INTO OUTFILE ] [FORMAT ] -``` - -**示例** - -下面的查询从表的列表中选择前两行 `system` 数据库,其名称包含 `reg`. - -``` sql -SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2 -``` - -``` text -┌─name─────────┐ -│ regions │ -│ region_names │ -└──────────────┘ -``` - -[原始文章](https://clickhouse.tech/docs/en/query_language/show/) diff --git a/docs/zh/sql_reference/statements/system.md b/docs/zh/sql_reference/statements/system.md deleted file mode 100644 index 06d4f6dc1cb..00000000000 --- a/docs/zh/sql_reference/statements/system.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 37 -toc_title: SYSTEM ---- - -# 系统查询 {#query-language-system} - -- [RELOAD DICTIONARIES](#query_language-system-reload-dictionaries) -- [RELOAD DICTIONARY](#query_language-system-reload-dictionary) -- [DROP DNS CACHE](#query_language-system-drop-dns-cache) -- [DROP MARK CACHE](#query_language-system-drop-mark-cache) -- [FLUSH LOGS](#query_language-system-flush_logs) -- [RELOAD CONFIG](#query_language-system-reload-config) -- [SHUTDOWN](#query_language-system-shutdown) -- [KILL](#query_language-system-kill) -- [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends) -- [FLUSH DISTRIBUTED](#query_language-system-flush-distributed) -- [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) -- [STOP MERGES](#query_language-system-stop-merges) -- [START MERGES](#query_language-system-start-merges) - -## RELOAD DICTIONARIES {#query_language-system-reload-dictionaries} - -重新加载之前已成功加载的所有字典。 -默认情况下,字典是懒惰加载的(请参阅 [dictionaries\_lazy\_load](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-dictionaries_lazy_load)),所以不是在启动时自动加载,而是通过dictGet函数在第一次访问时初始化,或者从ENGINE=Dictionary的表中选择。 该 `SYSTEM RELOAD DICTIONARIES` 查询重新加载这样的字典(加载)。 -总是返回 `Ok.` 无论字典更新的结果如何。 - -## 重新加载字典Dictionary\_name {#query_language-system-reload-dictionary} - -完全重新加载字典 `dictionary_name`,与字典的状态无关(LOADED/NOT\_LOADED/FAILED)。 -总是返回 `Ok.` 无论更新字典的结果如何。 -字典的状态可以通过查询 `system.dictionaries` 桌子 - -``` sql -SELECT name, status FROM system.dictionaries; -``` - -## DROP DNS CACHE {#query_language-system-drop-dns-cache} - -重置ClickHouse的内部DNS缓存。 有时(对于旧的ClickHouse版本)在更改基础架构(更改另一个ClickHouse服务器或字典使用的服务器的IP地址)时需要使用此命令。 - -有关更方便(自动)缓存管理,请参阅disable\_internal\_dns\_cache、dns\_cache\_update\_period参数。 - -## DROP MARK CACHE {#query_language-system-drop-mark-cache} - -重置标记缓存。 用于开发ClickHouse和性能测试。 - -## FLUSH LOGS {#query_language-system-flush_logs} - -Flushes buffers of log messages to system tables (e.g. system.query\_log). Allows you to not wait 7.5 seconds when debugging. - -## RELOAD CONFIG {#query_language-system-reload-config} - -重新加载ClickHouse配置。 当配置存储在ZooKeeeper中时使用。 - -## SHUTDOWN {#query_language-system-shutdown} - -通常关闭ClickHouse(如 `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) - -## KILL {#query_language-system-kill} - -中止ClickHouse进程(如 `kill -9 {$ pid_clickhouse-server}`) - -## 管理分布式表 {#query-language-system-distributed} - -ClickHouse可以管理 [分布](../../engines/table_engines/special/distributed.md) 桌子 当用户将数据插入到这些表中时,ClickHouse首先创建应发送到群集节点的数据队列,然后异步发送它。 您可以使用 [STOP DISTRIBUTED SENDS](#query_language-system-stop-distributed-sends), [FLUSH DISTRIBUTED](#query_language-system-flush-distributed),和 [START DISTRIBUTED SENDS](#query_language-system-start-distributed-sends) 查询。 您也可以同步插入分布式数据与 `insert_distributed_sync` 设置。 - -### STOP DISTRIBUTED SENDS {#query_language-system-stop-distributed-sends} - -将数据插入分布式表时禁用后台数据分发。 - -``` sql -SYSTEM STOP DISTRIBUTED SENDS [db.] -``` - -### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} - -强制ClickHouse将数据同步发送到群集节点。 如果任何节点不可用,ClickHouse将引发异常并停止查询执行。 您可以重试查询,直到查询成功,这将在所有节点恢复联机时发生。 - -``` sql -SYSTEM FLUSH DISTRIBUTED [db.] -``` - -### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} - -将数据插入分布式表时启用后台数据分发。 - -``` sql -SYSTEM START DISTRIBUTED SENDS [db.] -``` - -### STOP MERGES {#query_language-system-stop-merges} - -提供停止MergeTree系列中表的后台合并的可能性: - -``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] -``` - -!!! note "注" - `DETACH / ATTACH` 即使在之前所有MergeTree表的合并已停止的情况下,table也会为表启动后台合并。 - -### START MERGES {#query_language-system-start-merges} - -为MergeTree系列中的表提供启动后台合并的可能性: - -``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] -``` - -[原始文章](https://clickhouse.tech/docs/en/query_language/system/) diff --git a/docs/zh/sql_reference/syntax.md b/docs/zh/sql_reference/syntax.md deleted file mode 100644 index ab9009def47..00000000000 --- a/docs/zh/sql_reference/syntax.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 31 -toc_title: "\u8BED\u6CD5" ---- - -# 语法 {#syntax} - -系统中有两种类型的解析器:完整SQL解析器(递归下降解析器)和数据格式解析器(快速流解析器)。 -在所有情况下,除了 `INSERT` 查询时,只使用完整的SQL解析器。 -该 `INSERT` 查询使用的分析程序: - -``` sql -INSERT INTO t VALUES (1, 'Hello, world'), (2, 'abc'), (3, 'def') -``` - -该 `INSERT INTO t VALUES` 片段由完整的解析器解析,并且数据 `(1, 'Hello, world'), (2, 'abc'), (3, 'def')` 由快速流解析器解析。 您也可以通过使用 [input\_format\_values\_interpret\_expressions](../operations/settings/settings.md#settings-input_format_values_interpret_expressions) 设置。 当 `input_format_values_interpret_expressions = 1`,ClickHouse首先尝试使用fast stream解析器解析值。 如果失败,ClickHouse将尝试对数据使用完整的解析器,将其视为SQL [表达式](#syntax-expressions). - -数据可以有任何格式。 当接收到查询时,服务器计算不超过 [max\_query\_size](../operations/settings/settings.md#settings-max_query_size) RAM中请求的字节(默认为1MB),其余的是流解析。 -这意味着系统没有大的问题 `INSERT` 查询,就像MySQL一样。 - -使用时 `Values` 格式为 `INSERT` 查询,它可能看起来数据被解析相同的表达式 `SELECT` 查询,但事实并非如此。 该 `Values` 格式更为有限。 - -接下来我们将介绍完整的解析器。 有关格式解析器的详细信息,请参阅 [格式](../interfaces/formats.md) 科。 - -## 空间 {#spaces} - -语法结构之间可能有任意数量的空格符号(包括查询的开始和结束)。 空格符号包括空格、制表符、换行符、CR和换页符。 - -## 评论 {#comments} - -支持SQL样式和C样式注释。 -SQL风格的评论:来自 `--` 直到最后 后的空间 `--` 可以省略。 -C风格的评论:来自 `/*` 到 `*/`. 这些注释可以是多行。 这里也不需要空格。 - -## 关键词 {#syntax-keywords} - -当关键字对应于以下关键字时,不区分大小写: - -- SQL标准。 例如, `SELECT`, `select` 和 `SeLeCt` 都是有效的。 -- 在一些流行的DBMS(MySQL或Postgres)中实现。 例如, `DateTime` 是一样的 `datetime`. - -数据类型名称是否区分大小写可以在 `system.data_type_families` 桌子 - -与标准SQL相比,所有其他关键字(包括函数名称)都是 **区分大小写**. - -不保留关键字(它们只是在相应的上下文中解析为关键字)。 如果您使用 [标识符](#syntax-identifiers) 与关键字相同,将它们括在引号中。 例如,查询 `SELECT "FROM" FROM table_name` 是有效的,如果表 `table_name` 具有名称的列 `"FROM"`. - -## 标识符 {#syntax-identifiers} - -标识符是: - -- 集群、数据库、表、分区和列名称。 -- 功能。 -- 数据类型。 -- [表达式别名](#syntax-expression_aliases). - -标识符可以是引号或非引号。 建议使用非引号标识符。 - -非引号标识符必须与正则表达式匹配 `^[a-zA-Z_][0-9a-zA-Z_]*$` 并且不能等于 [关键词](#syntax-keywords). 例: `x, _1, X_y__Z123_.` - -如果要使用与关键字相同的标识符,或者要在标识符中使用其他符号,请使用双引号或反引号对其进行引用,例如, `"id"`, `` `id` ``. - -## 文字数 {#literals} - -有:数字,字符串,复合和 `NULL` 文字。 - -### 数字 {#numeric} - -数值文本尝试进行分析: - -- 首先作为一个64位有符号的数字,使用 [strtoull](https://en.cppreference.com/w/cpp/string/byte/strtoul) 功能。 -- 如果不成功,作为64位无符号数,使用 [strtoll](https://en.cppreference.com/w/cpp/string/byte/strtol) 功能。 -- 如果不成功,作为一个浮点数使用 [strtod](https://en.cppreference.com/w/cpp/string/byte/strtof) 功能。 -- 否则,将返回错误。 - -相应的值将具有该值适合的最小类型。 -例如,1被解析为 `UInt8`,但256被解析为 `UInt16`. 有关详细信息,请参阅 [数据类型](../sql_reference/data_types/index.md). - -例: `1`, `18446744073709551615`, `0xDEADBEEF`, `01`, `0.1`, `1e100`, `-1e-100`, `inf`, `nan`. - -### 字符串 {#syntax-string-literal} - -仅支持单引号中的字符串文字。 封闭的字符可以反斜杠转义。 以下转义序列具有相应的特殊值: `\b`, `\f`, `\r`, `\n`, `\t`, `\0`, `\a`, `\v`, `\xHH`. 在所有其他情况下,转义序列的格式为 `\c`,哪里 `c` 是任何字符,被转换为 `c`. 这意味着您可以使用序列 `\'`和`\\`. 该值将具有 [字符串](../sql_reference/data_types/string.md) 类型。 - -在字符串文字中需要转义的最小字符集: `'` 和 `\`. 单引号可以用单引号,文字转义 `'It\'s'` 和 `'It''s'` 是平等的。 - -### 化合物 {#compound} - -数组支持构造: `[1, 2, 3]` 和元组: `(1, 'Hello, world!', 2)`.. -实际上,这些不是文字,而是分别具有数组创建运算符和元组创建运算符的表达式。 -数组必须至少包含一个项目,元组必须至少包含两个项目。 -元组有一个特殊的用途用于 `IN` a条款 `SELECT` 查询。 元组可以作为查询的结果获得,但它们不能保存到数据库(除了 [记忆](../engines/table_engines/special/memory.md) 表)。 - -### NULL {#null-literal} - -指示该值丢失。 - -为了存储 `NULL` 在表字段中,它必须是 [可为空](../sql_reference/data_types/nullable.md) 类型。 - -根据数据格式(输入或输出), `NULL` 可能有不同的表示。 有关详细信息,请参阅以下文档 [数据格式](../interfaces/formats.md#formats). - -处理有许多细微差别 `NULL`. 例如,如果比较操作的至少一个参数是 `NULL`,此操作的结果也将是 `NULL`. 对于乘法,加法和其他操作也是如此。 有关详细信息,请阅读每个操作的文档。 - -在查询中,您可以检查 `NULL` 使用 [IS NULL](operators.md#operator-is-null) 和 [IS NOT NULL](operators.md) 运算符及相关功能 `isNull` 和 `isNotNull`. - -## 功能 {#functions} - -函数像标识符一样写入,并在括号中包含一个参数列表(可能是空的)。 与标准SQL相比,括号是必需的,即使是空的参数列表。 示例: `now()`. -有常规函数和聚合函数(请参阅部分 “Aggregate functions”). 某些聚合函数可以包含括号中的两个参数列表。 示例: `quantile (0.9) (x)`. 这些聚合函数被调用 “parametric” 函数,并在第一个列表中的参数被调用 “parameters”. 不带参数的聚合函数的语法与常规函数的语法相同。 - -## 运营商 {#operators} - -在查询解析过程中,运算符会转换为相应的函数,同时考虑它们的优先级和关联性。 -例如,表达式 `1 + 2 * 3 + 4` 转化为 `plus(plus(1, multiply(2, 3)), 4)`. - -## 数据类型和数据库表引擎 {#data_types-and-database-table-engines} - -数据类型和表引擎 `CREATE` 查询的编写方式与标识符或函数相同。 换句话说,它们可能包含也可能不包含括在括号中的参数列表。 有关详细信息,请参阅部分 “Data types,” “Table engines,” 和 “CREATE”. - -## 表达式别名 {#syntax-expression_aliases} - -别名是查询中表达式的用户定义名称。 - -``` sql -expr AS alias -``` - -- `AS` — The keyword for defining aliases. You can define the alias for a table name or a column name in a `SELECT` 子句不使用 `AS` 关键字。 - - For example, `SELECT table_name_alias.column_name FROM table_name table_name_alias`. - - In the [CAST](sql_reference/functions/type_conversion_functions.md#type_conversion_function-cast) function, the `AS` keyword has another meaning. See the description of the function. - -- `expr` — Any expression supported by ClickHouse. - - For example, `SELECT column_name * 2 AS double FROM some_table`. - -- `alias` — Name for `expr`. 别名应符合 [标识符](#syntax-identifiers) 语法 - - For example, `SELECT "table t".column_name FROM table_name AS "table t"`. - -### 使用注意事项 {#notes-on-usage} - -别名对于查询或子查询是全局的,您可以在查询的任何部分中为任何表达式定义别名。 例如, `SELECT (1 AS n) + 2, n`. - -别名在子查询和子查询之间不可见。 例如,在执行查询时 `SELECT (SELECT sum(b.a) + num FROM b) - a.a AS num FROM a` ClickHouse生成异常 `Unknown identifier: num`. - -如果为结果列定义了别名 `SELECT` 子查询的子句,这些列在外部查询中可见。 例如, `SELECT n + m FROM (SELECT 1 AS n, 2 AS m)`. - -小心使用与列或表名相同的别名。 让我们考虑以下示例: - -``` sql -CREATE TABLE t -( - a Int, - b Int -) -ENGINE = TinyLog() -``` - -``` sql -SELECT - argMax(a, b), - sum(b) AS b -FROM t -``` - -``` text -Received exception from server (version 18.14.17): -Code: 184. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Aggregate function sum(b) is found inside another aggregate function in query. -``` - -在这个例子中,我们声明表 `t` 带柱 `b`. 然后,在选择数据时,我们定义了 `sum(b) AS b` 别名 由于别名是全局的,ClickHouse替换了文字 `b` 在表达式中 `argMax(a, b)` 用表达式 `sum(b)`. 这种替换导致异常。 - -## 星号 {#asterisk} - -在一个 `SELECT` 查询中,星号可以替换表达式。 有关详细信息,请参阅部分 “SELECT”. - -## 表达式 {#syntax-expressions} - -表达式是函数、标识符、文字、运算符的应用程序、括号中的表达式、子查询或星号。 它还可以包含别名。 -表达式列表是一个或多个用逗号分隔的表达式。 -函数和运算符,反过来,可以有表达式作为参数。 - -[原始文章](https://clickhouse.tech/docs/en/query_language/syntax/) diff --git a/docs/zh/sql_reference/table_functions/file.md b/docs/zh/sql_reference/table_functions/file.md deleted file mode 100644 index b3c93f7f1fd..00000000000 --- a/docs/zh/sql_reference/table_functions/file.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 37 -toc_title: "\u6587\u4EF6" ---- - -# 文件 {#file} - -从文件创建表。 此表函数类似于 [url](url.md) 和 [hdfs](hdfs.md) 一些的。 - -``` sql -file(path, format, structure) -``` - -**输入参数** - -- `path` — The relative path to the file from [user\_files\_path](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-user_files_path). 只读模式下的globs后的文件支持路径: `*`, `?`, `{abc,def}` 和 `{N..M}` 哪里 `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [格式](../../interfaces/formats.md#formats) 的文件。 -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**返回值** - -具有指定结构的表,用于读取或写入指定文件中的数据。 - -**示例** - -设置 `user_files_path` 和文件的内容 `test.csv`: - -``` bash -$ grep user_files_path /etc/clickhouse-server/config.xml - /var/lib/clickhouse/user_files/ - -$ cat /var/lib/clickhouse/user_files/test.csv - 1,2,3 - 3,2,1 - 78,43,45 -``` - -表从`test.csv` 并从中选择前两行: - -``` sql -SELECT * -FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -``` sql --- getting the first 10 lines of a table that contains 3 columns of UInt32 type from a CSV file -SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 UInt32') LIMIT 10 -``` - -**路径中的水珠** - -多个路径组件可以具有globs。 对于正在处理的文件应该存在并匹配到整个路径模式(不仅后缀或前缀)。 - -- `*` — Substitutes any number of any characters except `/` 包括空字符串。 -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -建筑与 `{}` 类似于 [远程表功能](../../sql_reference/table_functions/remote.md)). - -**示例** - -1. 假设我们有几个具有以下相对路径的文件: - -- ‘some\_dir/some\_file\_1’ -- ‘some\_dir/some\_file\_2’ -- ‘some\_dir/some\_file\_3’ -- ‘another\_dir/some\_file\_1’ -- ‘another\_dir/some\_file\_2’ -- ‘another\_dir/some\_file\_3’ - -1. 查询这些文件中的行数: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. 查询这两个目录的所有文件中的行数: - - - -``` sql -SELECT count(*) -FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "警告" - 如果您的文件列表包含带前导零的数字范围,请单独使用带大括号的构造或使用 `?`. - -**示例** - -从名为 `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## 虚拟列 {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**另请参阅** - -- [虚拟列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/file/) diff --git a/docs/zh/sql_reference/table_functions/hdfs.md b/docs/zh/sql_reference/table_functions/hdfs.md deleted file mode 100644 index 2cf79c31c83..00000000000 --- a/docs/zh/sql_reference/table_functions/hdfs.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 45 -toc_title: hdfs ---- - -# hdfs {#hdfs} - -从HDFS中的文件创建表。 此表函数类似于 [url](url.md) 和 [文件](file.md) 一些的。 - -``` sql -hdfs(URI, format, structure) -``` - -**输入参数** - -- `URI` — The relative URI to the file in HDFS. Path to file support following globs in readonly mode: `*`, `?`, `{abc,def}` 和 `{N..M}` 哪里 `N`, `M` — numbers, \``'abc', 'def'` — strings. -- `format` — The [格式](../../interfaces/formats.md#formats) 的文件。 -- `structure` — Structure of the table. Format `'column1_name column1_type, column2_name column2_type, ...'`. - -**返回值** - -具有指定结构的表,用于读取或写入指定文件中的数据。 - -**示例** - -表从 `hdfs://hdfs1:9000/test` 并从中选择前两行: - -``` sql -SELECT * -FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') -LIMIT 2 -``` - -``` text -┌─column1─┬─column2─┬─column3─┐ -│ 1 │ 2 │ 3 │ -│ 3 │ 2 │ 1 │ -└─────────┴─────────┴─────────┘ -``` - -**路径中的水珠** - -多个路径组件可以具有globs。 对于正在处理的文件应该存在并匹配到整个路径模式(不仅后缀或前缀)。 - -- `*` — Substitutes any number of any characters except `/` 包括空字符串。 -- `?` — Substitutes any single character. -- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. -- `{N..M}` — Substitutes any number in range from N to M including both borders. - -建筑与 `{}` 类似于 [远程表功能](../../sql_reference/table_functions/remote.md)). - -**示例** - -1. 假设我们在HDFS上有几个具有以下Uri的文件: - -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/some\_dir/some\_file\_3’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_1’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_2’ -- ‘hdfs://hdfs1:9000/another\_dir/some\_file\_3’ - -1. 查询这些文件中的行数: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32') -``` - -1. 查询这两个目录的所有文件中的行数: - - - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32') -``` - -!!! warning "警告" - 如果您的文件列表包含带前导零的数字范围,请单独使用带大括号的构造或使用 `?`. - -**示例** - -从名为 `file000`, `file001`, … , `file999`: - -``` sql -SELECT count(*) -FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32') -``` - -## 虚拟列 {#virtual-columns} - -- `_path` — Path to the file. -- `_file` — Name of the file. - -**另请参阅** - -- [虚拟列](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns) - -[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) diff --git a/docs/zh/sql_reference/table_functions/index.md b/docs/zh/sql_reference/table_functions/index.md deleted file mode 100644 index 38ef9bf1f4b..00000000000 --- a/docs/zh/sql_reference/table_functions/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_folder_title: "\u8868\u51FD\u6570" -toc_priority: 34 -toc_title: "\u5BFC\u8A00" ---- - -# 表函数 {#table-functions} - -表函数是构造表的方法。 - -您可以使用表函数: - -- [FROM](../statements/select.md#select-from) 《公约》条款 `SELECT` 查询。 - - The method for creating a temporary table that is available only in the current query. The table is deleted when the query finishes. - -- [创建表为\](../statements/create.md#create-table-query) 查询。 - - It's one of the methods of creating a table. - -!!! warning "警告" - 你不能使用表函数,如果 [allow\_ddl](../../operations/settings/permissions_for_queries.md#settings_allow_ddl) 设置被禁用。 - -| 功能 | 产品描述 | -|--------------------|--------------------------------------------------------------------------------------------------------| -| [文件](file.md) | 创建一个 [文件](../../engines/table_engines/special/file.md)-发动机表。 | -| [合并](merge.md) | 创建一个 [合并](../../engines/table_engines/special/merge.md)-发动机表。 | -| [数字](numbers.md) | 创建一个包含整数填充的单列的表。 | -| [远程](remote.md) | 允许您访问远程服务器,而无需创建 [分布](../../engines/table_engines/special/distributed.md)-发动机表。 | -| [url](url.md) | 创建一个 [Url](../../engines/table_engines/special/url.md)-发动机表。 | -| [mysql](mysql.md) | 创建一个 [MySQL](../../engines/table_engines/integrations/mysql.md)-发动机表。 | -| [jdbc](jdbc.md) | 创建一个 [JDBC](../../engines/table_engines/integrations/jdbc.md)-发动机表。 | -| [odbc](odbc.md) | 创建一个 [ODBC](../../engines/table_engines/integrations/odbc.md)-发动机表。 | -| [hdfs](hdfs.md) | 创建一个 [HDFS](../../engines/table_engines/integrations/hdfs.md)-发动机表。 | - -[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/) diff --git a/docs/zh/sql_reference/table_functions/mysql.md b/docs/zh/sql_reference/table_functions/mysql.md deleted file mode 100644 index 3cdf3047aac..00000000000 --- a/docs/zh/sql_reference/table_functions/mysql.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 42 -toc_title: mysql ---- - -# mysql {#mysql} - -允许 `SELECT` 要对存储在远程MySQL服务器上的数据执行的查询。 - -``` sql -mysql('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause']); -``` - -**参数** - -- `host:port` — MySQL server address. - -- `database` — Remote database name. - -- `table` — Remote table name. - -- `user` — MySQL user. - -- `password` — User password. - -- `replace_query` — Flag that converts `INSERT INTO` 查询到 `REPLACE INTO`. 如果 `replace_query=1`,查询被替换。 - -- `on_duplicate_clause` — The `ON DUPLICATE KEY on_duplicate_clause` 表达式被添加到 `INSERT` 查询。 - - Example: `INSERT INTO t (c1,c2) VALUES ('a', 2) ON DUPLICATE KEY UPDATE c2 = c2 + 1`, where `on_duplicate_clause` is `UPDATE c2 = c2 + 1`. See the MySQL documentation to find which `on_duplicate_clause` you can use with the `ON DUPLICATE KEY` clause. - - To specify `on_duplicate_clause` you need to pass `0` to the `replace_query` parameter. If you simultaneously pass `replace_query = 1` and `on_duplicate_clause`, ClickHouse generates an exception. - -简单 `WHERE` 条款如 `=, !=, >, >=, <, <=` 当前在MySQL服务器上执行。 - -其余的条件和 `LIMIT` 只有在对MySQL的查询完成后,才会在ClickHouse中执行采样约束。 - -**返回值** - -与原始MySQL表具有相同列的table对象。 - -## 用法示例 {#usage-example} - -MySQL中的表: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -从ClickHouse中选择数据: - -``` sql -SELECT * FROM mysql('localhost:3306', 'test', 'test', 'bayonet', '123') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ ᴺᵁᴸᴸ │ 2 │ ᴺᵁᴸᴸ │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## 另请参阅 {#see-also} - -- [该 ‘MySQL’ 表引擎](../../engines/table_engines/integrations/mysql.md) -- [使用MySQL作为外部字典的来源](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-mysql) - -[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/mysql/) diff --git a/docs/zh/sql_reference/table_functions/odbc.md b/docs/zh/sql_reference/table_functions/odbc.md deleted file mode 100644 index ad7503fd551..00000000000 --- a/docs/zh/sql_reference/table_functions/odbc.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 44 -toc_title: odbc ---- - -# odbc {#table-functions-odbc} - -返回通过连接的表 [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity). - -``` sql -odbc(connection_settings, external_database, external_table) -``` - -参数: - -- `connection_settings` — Name of the section with connection settings in the `odbc.ini` 文件 -- `external_database` — Name of a database in an external DBMS. -- `external_table` — Name of a table in the `external_database`. - -为了安全地实现ODBC连接,ClickHouse使用单独的程序 `clickhouse-odbc-bridge`. 如果直接从ODBC驱动程序加载 `clickhouse-server`,驱动程序问题可能会导致ClickHouse服务器崩溃。 ClickHouse自动启动 `clickhouse-odbc-bridge` 当它是必需的。 ODBC桥程序是从相同的软件包作为安装 `clickhouse-server`. - -与字段 `NULL` 外部表中的值将转换为基数据类型的默认值。 例如,如果远程MySQL表字段具有 `INT NULL` 键入它将转换为0(ClickHouse的默认值 `Int32` 数据类型)。 - -## 用法示例 {#usage-example} - -**通过ODBC从本地MySQL安装获取数据** - -此示例检查Ubuntu Linux18.04和MySQL服务器5.7。 - -确保安装了unixODBC和MySQL连接器。 - -默认情况下(如果从软件包安装),ClickHouse以用户身份启动 `clickhouse`. 因此,您需要在MySQL服务器中创建和配置此用户。 - -``` bash -$ sudo mysql -``` - -``` sql -mysql> CREATE USER 'clickhouse'@'localhost' IDENTIFIED BY 'clickhouse'; -mysql> GRANT ALL PRIVILEGES ON *.* TO 'clickhouse'@'clickhouse' WITH GRANT OPTION; -``` - -然后配置连接 `/etc/odbc.ini`. - -``` bash -$ cat /etc/odbc.ini -[mysqlconn] -DRIVER = /usr/local/lib/libmyodbc5w.so -SERVER = 127.0.0.1 -PORT = 3306 -DATABASE = test -USERNAME = clickhouse -PASSWORD = clickhouse -``` - -您可以使用 `isql` unixodbc安装中的实用程序。 - -``` bash -$ isql -v mysqlconn -+-------------------------+ -| Connected! | -| | -... -``` - -MySQL中的表: - -``` text -mysql> CREATE TABLE `test`.`test` ( - -> `int_id` INT NOT NULL AUTO_INCREMENT, - -> `int_nullable` INT NULL DEFAULT NULL, - -> `float` FLOAT NOT NULL, - -> `float_nullable` FLOAT NULL DEFAULT NULL, - -> PRIMARY KEY (`int_id`)); -Query OK, 0 rows affected (0,09 sec) - -mysql> insert into test (`int_id`, `float`) VALUES (1,2); -Query OK, 1 row affected (0,00 sec) - -mysql> select * from test; -+------+----------+-----+----------+ -| int_id | int_nullable | float | float_nullable | -+------+----------+-----+----------+ -| 1 | NULL | 2 | NULL | -+------+----------+-----+----------+ -1 row in set (0,00 sec) -``` - -从ClickHouse中的MySQL表中检索数据: - -``` sql -SELECT * FROM odbc('DSN=mysqlconn', 'test', 'test') -``` - -``` text -┌─int_id─┬─int_nullable─┬─float─┬─float_nullable─┐ -│ 1 │ 0 │ 2 │ 0 │ -└────────┴──────────────┴───────┴────────────────┘ -``` - -## 另请参阅 {#see-also} - -- [ODBC外部字典](../../sql_reference/dictionaries/external_dictionaries/external_dicts_dict_sources.md#dicts-external_dicts_dict_sources-odbc) -- [ODBC表引擎](../../engines/table_engines/integrations/odbc.md). - -[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) diff --git a/docs/zh/sql_reference/table_functions/remote.md b/docs/zh/sql_reference/table_functions/remote.md deleted file mode 100644 index be6e9138fb4..00000000000 --- a/docs/zh/sql_reference/table_functions/remote.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 40 -toc_title: "\u8FDC\u7A0B" ---- - -# 远程,远程安全 {#remote-remotesecure} - -允许您访问远程服务器,而无需创建 `Distributed` 桌子 - -签名: - -``` sql -remote('addresses_expr', db, table[, 'user'[, 'password']]) -remote('addresses_expr', db.table[, 'user'[, 'password']]) -``` - -`addresses_expr` – An expression that generates addresses of remote servers. This may be just one server address. The server address is `host:port`,或者只是 `host`. 主机可以指定为服务器名称,也可以指定为IPv4或IPv6地址。 IPv6地址在方括号中指定。 端口是远程服务器上的TCP端口。 如果省略端口,它使用 `tcp_port` 从服务器的配置文件(默认情况下,9000)。 - -!!! important "重要事项" - IPv6地址需要该端口。 - -例: - -``` text -example01-01-1 -example01-01-1:9000 -localhost -127.0.0.1 -[::]:9000 -[2a02:6b8:0:1111::11]:9000 -``` - -多个地址可以用逗号分隔。 在这种情况下,ClickHouse将使用分布式处理,因此它将将查询发送到所有指定的地址(如具有不同数据的分片)。 - -示例: - -``` text -example01-01-1,example01-02-1 -``` - -表达式的一部分可以用大括号指定。 前面的示例可以写成如下: - -``` text -example01-0{1,2}-1 -``` - -大括号可以包含由两个点(非负整数)分隔的数字范围。 在这种情况下,范围将扩展为生成分片地址的一组值。 如果第一个数字以零开头,则使用相同的零对齐形成值。 前面的示例可以写成如下: - -``` text -example01-{01..02}-1 -``` - -如果您有多对大括号,它会生成相应集合的直接乘积。 - -大括号中的地址和部分地址可以用管道符号(\|)分隔。 在这种情况下,相应的地址集被解释为副本,并且查询将被发送到第一个正常副本。 但是,副本将按照当前设置的顺序进行迭代 [load\_balancing](../../operations/settings/settings.md) 设置。 - -示例: - -``` text -example01-{01..02}-{1|2} -``` - -此示例指定两个分片,每个分片都有两个副本。 - -生成的地址数由常量限制。 现在这是1000个地址。 - -使用 `remote` 表函数比创建一个不太优化 `Distributed` 表,因为在这种情况下,服务器连接被重新建立为每个请求。 此外,如果设置了主机名,则会解析这些名称,并且在使用各种副本时不会计算错误。 在处理大量查询时,始终创建 `Distributed` 表的时间提前,不要使用 `remote` 表功能。 - -该 `remote` 表函数可以在以下情况下是有用的: - -- 访问特定服务器进行数据比较、调试和测试。 -- 查询之间的各种ClickHouse群集用于研究目的。 -- 手动发出的罕见分布式请求。 -- 每次重新定义服务器集的分布式请求。 - -如果未指定用户, `default` 被使用。 -如果未指定密码,则使用空密码。 - -`remoteSecure` -相同 `remote` but with secured connection. Default port — [tcp\_port\_secure](../../operations/server_configuration_parameters/settings.md#server_configuration_parameters-tcp_port_secure) 从配置或9440. - -[原始文章](https://clickhouse.tech/docs/en/query_language/table_functions/remote/) diff --git a/docs/zh/whats-new/changelog/2017.md b/docs/zh/whats-new/changelog/2017.md new file mode 100644 index 00000000000..b5e1e3c7b18 --- /dev/null +++ b/docs/zh/whats-new/changelog/2017.md @@ -0,0 +1,268 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 79 +toc_title: '2017' +--- + +### ClickHouse释放1.1.54327,2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} + +此版本包含以前版本1.1.54318的错误修复: + +- 修复了可能导致数据丢失的复制中可能存在的争用条件的错误。 此问题影响版本1.1.54310和1.1.54318。 如果将其中一个版本用于复制的表,则强烈建议进行更新。 此问题显示在日志中的警告消息,如 `Part ... from own log doesn't exist.` 即使您在日志中没有看到这些消息,问题也是相关的。 + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54318-2017-11-30} + +此版本包含以前版本1.1.54310的错误修复: + +- 修复了SummingMergeTree引擎中合并过程中错误的行删除 +- 修复了未复制的MergeTree引擎中的内存泄漏 +- 修复了MergeTree引擎中频繁插入的性能下降 +- 修复了导致复制队列停止运行的问题 +- 固定服务器日志的轮换和归档 + +### ClickHouse释放1.1.54310,2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} + +#### 新功能: {#new-features} + +- MergeTree表引擎系列的自定义分区键。 +- [卡夫卡](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) 表引擎。 +- 增加了对加载的支持 [CatBoost](https://catboost.yandex/) 模型并将其应用到ClickHouse中存储的数据。 +- 增加了对UTC非整数偏移的时区的支持。 +- 增加了对具有时间间隔的算术运算的支持。 +- 日期和日期时间类型的值范围扩展到2105年。 +- 添加了 `CREATE MATERIALIZED VIEW x TO y` 查询(指定用于存储实例化视图数据的现有表)。 +- 添加了 `ATTACH TABLE` 不带参数的查询。 +- 将SummingMergeTree表中名称以-Map结尾的嵌套列的处理逻辑提取到sumMap聚合函数中。 现在,您可以显式指定此类列。 +- IP trie字典的最大大小增加到128M条目。 +- 添加了getSizeOfEnumType函数。 +- 添加了sumWithOverflow聚合函数。 +- 增加了对Cap’n Proto输入格式的支持。 +- 使用zstd算法时,您现在可以自定义压缩级别。 + +#### 向后不兼容的更改: {#backward-incompatible-changes} + +- 不允许使用内存以外的引擎创建临时表。 +- 不允许使用View或MaterializedView引擎显式创建表。 +- 在创建表期间,新检查将验证采样键表达式是否包含在主键中。 + +#### 错误修复: {#bug-fixes} + +- 修复了同步插入到分布式表中时的挂断问题。 +- 修复了复制表中部分的非原子添加和删除。 +- 插入到实例化视图中的数据不会遭受不必要的重复数据删除。 +- 对本地副本滞后且远程副本不可用的分布式表执行查询不会再导致错误。 +- 用户不需要访问权限 `default` 数据库创建临时表了。 +- 修复了在指定数组类型时不带参数的崩溃。 +- 修复了包含服务器日志的磁盘卷已满时的挂机问题。 +- 修复了unix时代的第一周toRelativeWeekNum函数的溢出。 + +#### 构建改进: {#build-improvements} + +- 几个第三方库(特别是Poco)被更新并转换为git子模块。 + +### ClickHouse释放1.1.54304,2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} + +#### 新功能: {#new-features-1} + +- 本机协议中的TLS支持(要启用,请设置 `tcp_ssl_port` 在 `config.xml` ). + +#### 错误修复: {#bug-fixes-1} + +- `ALTER` 对于复制的表现在尝试尽快开始运行。 +- 使用设置读取数据时修复崩溃 `preferred_block_size_bytes=0.` +- 固定的崩溃 `clickhouse-client` 按下时 `Page Down` +- 正确解释某些复杂的查询 `GLOBAL IN` 和 `UNION ALL` +- `FREEZE PARTITION` 现在总是以原子方式工作。 +- 空POST请求现在返回代码411的响应。 +- 修正了像表达式的解释错误 `CAST(1 AS Nullable(UInt8)).` +- 修正了读取时的错误 `Array(Nullable(String))` 从列 `MergeTree` 桌子 +- 修正了解析查询时崩溃,如 `SELECT dummy AS dummy, dummy AS b` +- 用户正确更新无效 `users.xml` +- 可执行字典返回非零响应代码时的正确处理。 + +### ClickHouse释放1.1.54292,2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} + +#### 新功能: {#new-features-2} + +- 添加了 `pointInPolygon` 用于处理坐标平面上的坐标的函数。 +- 添加了 `sumMap` 用于计算数组总和的聚合函数,类似于 `SummingMergeTree`. +- 添加了 `trunc` 功能。 改进舍入函数的性能 (`round`, `floor`, `ceil`, `roundToExp2`)并corrected正了他们如何工作的逻辑。 改变的逻辑 `roundToExp2` 分数和负数的功能。 +- ClickHouse可执行文件现在对libc版本的依赖性较低。 同样的ClickHouse可执行文件可以在各种各样的Linux系统上运行。 使用编译的查询(使用设置)时仍然存在依赖关系 `compile = 1` ,默认情况下不使用)。 +- 减少了动态编译查询所需的时间。 + +#### 错误修复: {#bug-fixes-2} + +- 修正了有时产生的错误 `part ... intersects previous part` 消息和副本的一致性减弱。 +- 修正了一个错误,导致服务器锁定,如果ZooKeeper在关闭过程中不可用。 +- 恢复副本时删除了过多的日志记录。 +- 修复了UNION ALL实现中的错误。 +- 修复了在块中的第一列具有数组类型时发生的concat函数中的错误。 +- 进度现在在系统中正确显示。合并表。 + +### ClickHouse释放1.1.54289,2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} + +#### 新功能: {#new-features-3} + +- `SYSTEM` 服务器管理查询: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. +- 添加了用于处理数组的函数: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. +- 已添加 `root` 和 `identity` ZooKeeper配置的参数。 这允许您隔离同一个ZooKeeper集群上的单个用户。 +- 添加聚合函数 `groupBitAnd`, `groupBitOr`,和 `groupBitXor` (为了兼容,它们也可以在名称下使用 `BIT_AND`, `BIT_OR`,和 `BIT_XOR`). +- 通过在文件系统中指定套接字,可以从MySQL加载外部字典。 +- 外部字典可以通过SSL从MySQL加载 (`ssl_cert`, `ssl_key`, `ssl_ca` 参数)。 +- 添加了 `max_network_bandwidth_for_user` 设置为限制每个用户查询的总带宽使用。 +- 支持 `DROP TABLE` 对于临时表。 +- 支持阅读 `DateTime` 从Unix时间戳格式的值 `CSV` 和 `JSONEachRow` 格式。 +- 分布式查询中的滞后副本现在默认排除(默认阈值为5分钟)。 +- 在ALTER期间使用FIFO锁定:对于连续运行的查询,ALTER查询不会无限期地阻止。 +- 选项设置 `umask` 在配置文件中。 +- 改进了查询的性能 `DISTINCT` . + +#### 错误修复: {#bug-fixes-3} + +- 改进了在ZooKeeper中删除旧节点的过程。 以前,如果插入非常频繁,旧节点有时不会被删除,这导致服务器关闭速度缓慢等等。 +- 修正了选择主机连接到ZooKeeper时的随机化。 +- 修复了在分布式查询中排除滞后副本,如果副本是localhost。 +- 修正了一个错误,其中在一个数据部分 `ReplicatedMergeTree` 运行后表可能会被打破 `ALTER MODIFY` 在一个元素 `Nested` 结构。 +- 修复了可能导致SELECT查询执行以下操作的错误 “hang”. +- 对分布式DDL查询的改进。 +- 修正了查询 `CREATE TABLE ... AS `. +- 解决了在僵局 `ALTER ... CLEAR COLUMN IN PARTITION` 查询为 `Buffer` 桌子 +- 修正了无效的默认值 `Enum` s(0,而不是最小)使用时 `JSONEachRow` 和 `TSKV` 格式。 +- 解决了使用字典时僵尸进程的外观 `executable` 资料来源。 +- 修正了HEAD查询的段错误。 + +#### 改进开发和组装ClickHouse的工作流程: {#improved-workflow-for-developing-and-assembling-clickhouse} + +- 您可以使用 `pbuilder` 建造克里克豪斯 +- 您可以使用 `libc++` 而不是 `libstdc++` 对于构建在Linux上。 +- 添加了使用静态代码分析工具的说明: `Coverage`, `clang-tidy`, `cppcheck`. + +#### 升级时请注意: {#please-note-when-upgrading} + +- MergeTree设置现在有一个更高的默认值 `max_bytes_to_merge_at_max_space_in_pool` (要合并的数据部分的最大总大小,以字节为单位):它已从100GiB增加到150GiB。 这可能会导致服务器升级后运行大型合并,这可能会导致磁盘子系统的负载增加。 如果服务器上的可用空间小于正在运行的合并总量的两倍,这将导致所有其他合并停止运行,包括小数据部分的合并。 因此,插入查询将失败,并显示消息 “Merges are processing significantly slower than inserts.” 使用 `SELECT * FROM system.merges` 查询监控情况。 您还可以检查 `DiskSpaceReservedForMerge` 度量在 `system.metrics` 表,或石墨。 你不需要做任何事情来解决这个问题,因为一旦大合并完成,问题就会自行解决。 如果您发现这是不可接受的,则可以恢复以前的值 `max_bytes_to_merge_at_max_space_in_pool` 设置。 要做到这一点,请转到 在配置部分。xml,设置 ``` ``107374182400 ``` 并重新启动服务器。 + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54284-2017-08-29} + +- 这是一个错误修正版本,以前的1.1.54282版本。 它修复了ZooKeeper中部件目录中的泄漏。 + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54282-2017-08-23} + +此版本包含以前版本1.1.54276的错误修复: + +- 固定 `DB::Exception: Assertion violation: !_path.empty()` 当插入到分布式表中。 +- 如果输入数据以“;”开头,则以RowBinary格式插入时修复了解析。 +- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54276-2017-08-16} + +#### 新功能: {#new-features-4} + +- 为选择查询添加了一个可选的WITH部分。 查询示例: `WITH 1+1 AS a SELECT a, a*a` +- INSERT可以在分布式表中同步执行:仅在所有分片上保存所有数据后才返回OK。 这是由设置insert\_distributed\_sync=1激活的。 +- 添加了用于处理16字节标识符的UUID数据类型。 +- 添加了CHAR,FLOAT和其他类型的别名,以便与Tableau兼容。 +- 添加了toyyyymm,toYYYYMMDD和toyyyyymmddhhmmss将时间转换为数字的功能。 +- 您可以使用IP地址(与主机名一起使用)来标识群集DDL查询的服务器。 +- 增加了对函数中非常量参数和负偏移的支持 `substring(str, pos, len).` +- 添加了max\_size参数 `groupArray(max_size)(column)` 聚合函数,并优化了其性能。 + +#### 主要变化: {#main-changes} + +- 安全性改进:所有服务器文件都使用0640权限创建(可以通过更改 配置参数)。 +- 改进了语法无效的查询的错误消息。 +- 在合并mergetree大部分数据时,显着降低了内存消耗并提高了性能。 +- 显着提高了ReplacingMergeTree引擎的数据合并性能。 +- 通过组合多个源插入来改进来自分布式表的异步插入的性能。 要启用此功能,请使用设置distributed\_directory\_monitor\_batch\_inserts=1。 + +#### 向后不兼容的更改: {#backward-incompatible-changes-1} + +- 改变聚合状态的二进制格式 `groupArray(array_column)` 数组的函数。 + +#### 更改的完整列表: {#complete-list-of-changes} + +- 添加了 `output_format_json_quote_denormals` 设置,允许以JSON格式输出nan和inf值。 +- 从分布式表读取时优化流分配。 +- 如果值没有更改,可以在只读模式下配置设置。 +- 添加了检索MergeTree引擎的非整数颗粒的功能,以满足preferred\_block\_size\_bytes设置中指定的块大小的限制。 其目的是在处理来自具有大列的表的查询时减少RAM消耗并增加缓存局部性。 +- 高效使用包含如下表达式的索引 `toStartOfHour(x)` 对于像条件 `toStartOfHour(x) op сonstexpr.` +- 添加了MergeTree引擎的新设置(配置中的merge\_tree部分。xml): + - replicated\_deduplication\_window\_seconds设置复制表中重复数据删除插入所允许的秒数。 + - cleanup\_delay\_period设置启动清理以删除过时数据的频率。 + - replicated\_can\_become\_leader可以防止副本成为领导者(并分配合并)。 +- 加速清理,从ZooKeeper中删除过时的数据。 +- 针对群集DDL查询的多个改进和修复。 特别令人感兴趣的是新设置distributed\_ddl\_task\_timeout,它限制了等待群集中服务器响应的时间。 如果未在所有主机上执行ddl请求,则响应将包含超时错误,并且请求将以异步模式执行。 +- 改进了服务器日志中堆栈跟踪的显示。 +- 添加了 “none” 压缩方法的值。 +- 您可以在config中使用多个dictionaries\_config部分。xml +- 可以通过文件系统中的套接字连接到MySQL。 +- 系统。部件表有一个新的列,其中包含有关标记大小的信息,以字节为单位。 + +#### 错误修复: {#bug-fixes-4} + +- 使用合并表的分布式表现在可以正确地用于具有条件的SELECT查询 `_table` 场。 +- 修复了检查数据部分时ReplicatedMergeTree中罕见的争用条件。 +- 固定可能冻结 “leader election” 启动服务器时。 +- 使用数据源的本地副本时,将忽略max\_replica\_delay\_for\_distributed\_queries设置。 这已被修复。 +- 修正了不正确的行为 `ALTER TABLE CLEAR COLUMN IN PARTITION` 尝试清除不存在的列时。 +- 修复了multif函数中使用空数组或字符串时的异常。 +- 修正了反序列化本机格式时过多的内存分配。 +- 修正了Trie字典的不正确的自动更新。 +- 修复了使用SAMPLE从合并表中使用GROUP BY子句运行查询时的异常。 +- 修复了使用distributed\_aggregation\_memory\_efficient=1时组的崩溃。 +- 现在,您可以指定数据库。表在右侧的IN和JOIN。 +- 用于并行聚合的线程太多。 这已被修复。 +- 固定如何 “if” 函数与FixedString参数一起使用。 +- 为权重为0的分片从分布式表中选择工作不正确。 这已被修复。 +- 运行 `CREATE VIEW IF EXISTS no longer causes crashes.` +- 修正了input\_format\_skip\_unknown\_fields=1设置并且有负数时的不正确行为。 +- 修正了一个无限循环 `dictGetHierarchy()` 如果字典中有一些无效的数据,则函数。 +- 固定 `Syntax error: unexpected (...)` 在IN或JOIN子句和合并表中使用子查询运行分布式查询时出错。 +- 修复了从字典表中选择查询的不正确解释。 +- 修正了 “Cannot mremap” 在IN和JOIN子句中使用包含超过20亿个元素的数组时出错。 +- 修复了以MySQL为源的字典的故障转移。 + +#### 改进开发和组装ClickHouse的工作流程: {#improved-workflow-for-developing-and-assembling-clickhouse-1} + +- 构建可以在阿卡迪亚组装。 +- 您可以使用gcc7来编译ClickHouse。 +- 现在使用ccache+distcc的并行构建速度更快。 + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-1-1-54245-2017-07-04} + +#### 新功能: {#new-features-5} + +- 分布式的DDL(例如, `CREATE TABLE ON CLUSTER`) +- 复制的查询 `ALTER TABLE CLEAR COLUMN IN PARTITION.` +- 字典表的引擎(以表格形式访问字典数据)。 +- 字典数据库引擎(这种类型的数据库会自动为所有连接的外部字典提供字典表)。 +- 您可以通过向源发送请求来检查字典的更新。 +- 限定列名称 +- 使用双引号引用标识符。 +- Http接口中的会话。 +- 复制表的优化查询不仅可以在leader上运行。 + +#### 向后不兼容的更改: {#backward-incompatible-changes-2} + +- 删除设置全局。 + +#### 小的变化: {#minor-changes} + +- 现在,在触发警报之后,日志将打印完整的堆栈跟踪。 +- 在启动时放宽对损坏/额外数据部件数量的验证(有太多误报)。 + +#### 错误修复: {#bug-fixes-5} + +- 修复了连接错误 “sticking” 当插入到分布式表中。 +- GLOBAL IN现在适用于查看分布式表的合并表中的查询。 +- 在Google Compute Engine虚拟机上检测到不正确的内核数。 这已被修复。 +- 缓存外部字典的可执行源如何工作的更改。 +- 修复了包含空字符的字符串的比较。 +- 修正了Float32主键字段与常量的比较。 +- 以前,对字段大小的不正确估计可能导致分配过大。 +- 修复了使用ALTER查询添加到表中的可空列时的崩溃。 +- 修复了按可空列排序时的崩溃,如果行数小于限制。 +- 修复了仅由常量值组成的子查询的顺序。 +- 以前,复制的表在丢弃表失败后可能仍处于无效状态。 +- 具有空结果的标量子查询的别名不再丢失。 +- 现在如果.so文件被损坏,使用编译的查询不会失败并出现错误。 diff --git a/docs/zh/whats_new/changelog/2018.md b/docs/zh/whats-new/changelog/2018.md similarity index 100% rename from docs/zh/whats_new/changelog/2018.md rename to docs/zh/whats-new/changelog/2018.md diff --git a/docs/zh/whats-new/changelog/2019.md b/docs/zh/whats-new/changelog/2019.md new file mode 100644 index 00000000000..05b1ed74bc3 --- /dev/null +++ b/docs/zh/whats-new/changelog/2019.md @@ -0,0 +1,2074 @@ +--- +machine_translated: true +machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 +toc_priority: 77 +toc_title: '2019' +--- + +## 碌莽禄.拢.0755-88888888 {#clickhouse-release-v19-17} + +### ClickHouse释放v19.17.6.36,2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} + +#### 错误修复 {#bug-fix} + +- 在解压缩固定潜在的缓冲区溢出。 恶意用户可以传递制造的压缩数据,可能导致缓冲区后读取。 这个问题是由Yandex信息安全团队的Eldar Zaitov发现的。 [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了可能的服务器崩溃 (`std::terminate`)当服务器不能发送或写入JSON或XML格式的数据与字符串数据类型的值(需要UTF-8验证),或者当压缩结果数据与Brotli算法或在其他一些罕见的情况下。 [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 从clickhouse源固定字典 `VIEW`,现在阅读这样的字典不会导致错误 `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复了用户中指定的host\_regexp是否允许客户端主机的检查。xml [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- `RENAME TABLE` 对于分布式表,现在在发送到分片之前重命名包含插入数据的文件夹。 这解决了连续重命名的问题 `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) +- `range_hashed` DDL查询创建的外部字典现在允许任意数字类型的范围。 [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([阿利沙平](https://github.com/alesapin)) +- 固定 `INSERT INTO table SELECT ... FROM mysql(...)` 表功能。 [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) +- 修复段错误 `INSERT INTO TABLE FUNCTION file()` 同时插入到一个不存在的文件。 现在在这种情况下,文件将被创建,然后插入将被处理。 [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) +- 修正了聚合位图和标量位图相交时的位图和错误。 [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([黄月](https://github.com/moon03432)) +- 修复段错误时 `EXISTS` 查询没有使用 `TABLE` 或 `DICTIONARY` 预选赛,就像 `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 函数的固定返回类型 `rand` 和 `randConstant` 在可为空的参数的情况下。 现在函数总是返回 `UInt32` 而且从来没有 `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 固定 `DROP DICTIONARY IF EXISTS db.dict`,现在它不会抛出异常,如果 `db` 根本不存在 [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 如果由于服务器崩溃而未完全删除表,服务器将尝试恢复并加载它 [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) +- 修正了一个简单的计数查询分布式表,如果有两个以上的分片本地表。 [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) +- 修正了导致DB::BlockStreamProfileInfo::calculateRowsBeforeLimit数据竞赛的错误() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) +- 固定 `ALTER table MOVE part` 在合并指定部件后立即执行,这可能导致移动指定部件合并到的部件。 现在它正确地移动指定的部分。 [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 字典的表达式现在可以指定为字符串。 这对于从非ClickHouse源中提取数据时计算属性非常有用,因为它允许对这些表达式使用非ClickHouse语法。 [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([阿利沙平](https://github.com/alesapin)) +- 修正了一个非常罕见的比赛 `clickhouse-copier` 由于ZXid的溢出。 [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([丁香飞](https://github.com/dingxiangfei2009)) +- 修复了查询失败后的错误(由于 “Too many simultaneous queries” 例如)它不会读取外部表信息,并且 + 下一个请求会将此信息解释为下一个查询的开始,导致如下错误 `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) +- 避免空取消引用后 “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) +- 恢复对所有ICU区域设置的支持,添加对常量表达式应用排序规则的能力,并将语言名称添加到系统。排序规则表。 [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([阿利沙平](https://github.com/alesapin)) +- 用于读取的流数 `StorageFile` 和 `StorageHDFS` 现在是有限的,以避免超过内存限制。 [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([阿利沙平](https://github.com/alesapin)) +- 固定 `CHECK TABLE` 查询为 `*MergeTree` 表没有关键. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([阿利沙平](https://github.com/alesapin)) +- 如果没有突变,则从部件名称中删除突变编号。 这种删除提高了与旧版本的兼容性。 [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([阿利沙平](https://github.com/alesapin)) +- 修复了某些附加部分因data\_version大于表突变版本而跳过突变的问题。 [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([余志昌](https://github.com/yuzhichang)) +- 允许在将部件移动到其他设备后使用冗余副本启动服务器。 [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修正了错误 “Sizes of columns doesn’t match” 使用聚合函数列时可能会出现。 [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) +- 现在在使用WITH TIES和LIMIT BY的情况下,将抛出一个异常。 现在可以使用TOP with LIMIT BY。 [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) +- 修复字典重新加载,如果它有 `invalidate_query`,停止更新,并在以前的更新尝试一些异常。 [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([阿利沙平](https://github.com/alesapin)) + +### ClickHouse释放v19.17.4.11时,2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} + +#### 向后不兼容的更改 {#backward-incompatible-change} + +- 使用列而不是AST来存储标量子查询结果以获得更好的性能。 设置 `enable_scalar_subquery_optimization` 在19.17中添加,默认情况下启用。 它会导致以下错误 [这](https://github.com/ClickHouse/ClickHouse/issues/7851) 在从以前的版本升级到19.17.2或19.17.3期间。 默认情况下,19.17.4中禁用此设置,以便可以从19.16及更早版本升级而不会出现错误。 [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([阿莫斯鸟](https://github.com/amosbird)) + +#### 新功能 {#new-feature} + +- 添加使用DDL查询创建字典的功能。 [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([阿利沙平](https://github.com/alesapin)) +- 赂眉露\>\> `bloom_filter` 支持的索引类型 `LowCardinality` 和 `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 添加功能 `isValidJSON` 要检查传递的字符串是否是有效的json。 [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) +- 执行 `arrayCompact` 功能 [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([备忘录](https://github.com/Joeywzr)) +- 创建函数 `hex` 对于十进制数。 它的工作原理如下 `hex(reinterpretAsString())`,但不会删除最后的零字节。 [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([米哈伊尔\*科罗托夫](https://github.com/millb)) +- 添加 `arrayFill` 和 `arrayReverseFill` 函数,用数组中其他元素替换它们前面/后面的元素。 [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) +- 添加 `CRC32IEEE()`/`CRC64()` 碌莽禄support: [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) +- 执行 `char` 功能类似于一个 [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) +- 添加 `bitmapTransform` 功能。 它将位图中的值数组转换为另一个值数组,结果是一个新的位图 [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([余志昌](https://github.com/yuzhichang)) +- 已实施 `javaHashUTF16LE()` 功能 [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) +- 添加 `_shard_num` 分布式引擎的虚拟列 [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) + +#### 实验特点 {#experimental-feature} + +- 支持处理器(新的查询执行管道) `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) + +#### 错误修复 {#bug-fix-1} + +- 修复不正确的浮点解析 `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) +- 修复启用trace\_log时可能发生的罕见死锁。 [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) +- 当生成Kafka表时有任何从中选择的Mv时,防止消息重复 [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([伊万](https://github.com/abyss7)) +- 支持 `Array(LowCardinality(Nullable(String)))` 在 `IN`. 决定 [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) +- 添加处理 `SQL_TINYINT` 和 `SQL_BIGINT`,并修复处理 `SQL_FLOAT` ODBC桥中的数据源类型。 [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- 修复聚合 (`avg` 和分位数)在空的十进制列 [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([安德烈\*科尼亚耶夫](https://github.com/akonyaev90)) +- 修复 `INSERT` 变成分布式 `MATERIALIZED` 列 [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- 赂眉露\>\> `MOVE PARTITION` 如果分区的某些部分已经在目标磁盘或卷上,则可以工作 [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修正了在突变过程中无法创建硬链接的错误 `ReplicatedMergeTree` 在多磁盘配置。 [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修复了当整个部分保持不变并且在另一个磁盘上找到最佳空间时,MergeTree上出现突变的错误 [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修正错误 `keep_free_space_ratio` 未从磁盘读取配置 [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修正错误与表只包含 `Tuple` 列或具有复杂路径的列。 修复 [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([阿利沙平](https://github.com/alesapin)) +- 在max\_memory\_usage限制中不考虑缓冲区引擎的内存 [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) +- 修复最终标记用法 `MergeTree` 表排序 `tuple()`. 在极少数情况下,它可能会导致 `Can't adjust last granule` 选择时出错。 [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复了需要上下文操作(例如json函数)的谓词突变中的错误,这可能会导致崩溃或奇怪的异常。 [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([阿利沙平](https://github.com/alesapin)) +- 修复转义的数据库和表名称不匹配 `data/` 和 `shadow/` 目录 [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) +- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. 在这种情况下修复崩溃。 [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复 `Not found column in block` 当加入表达式与权利或完全连接。 [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) +- 再次尝试修复无限循环 `PrettySpace` 格式 [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) +- 修复bug `concat` 函数时,所有的参数 `FixedString` 同样大小的 [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([阿利沙平](https://github.com/alesapin)) +- 在定义S3,URL和HDFS存储时使用1个参数的情况下修复了异常。 [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 修复查询视图的InterpreterSelectQuery的范围 [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) + +#### 改进 {#improvement} + +- `Nullable` ODBC-bridge可识别的列和正确处理的NULL值 [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 以原子方式写入分布式发送的当前批次 [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) +- 如果我们无法在查询中检测到列名称的表,则引发异常。 [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) +- 添加 `merge_max_block_size` 设置为 `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) +- 查询与 `HAVING` 而没有 `GROUP BY` 假设按常量分组。 所以, `SELECT 1 HAVING 1` 现在返回一个结果。 [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([阿莫斯鸟](https://github.com/amosbird)) +- 支持解析 `(X,)` 作为类似python的元组。 [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([阿莫斯鸟](https://github.com/amosbird)) +- 赂眉露\>\> `range` 函数行为几乎像pythonic。 [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) +- 添加 `constraints` 列到表 `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- Tcp处理程序的更好的Null格式,以便可以使用 `select ignore() from table format Null` 通过clickhouse-client进行性能测量 [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([阿莫斯鸟](https://github.com/amosbird)) +- 查询如 `CREATE TABLE ... AS (SELECT (1, 2))` 正确解析 [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) + +#### 性能改进 {#performance-improvement} + +- 改进了对短字符串键的聚合性能。 [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [阿莫斯鸟](https://github.com/amosbird)) +- 运行另一次语法/表达式分析以在常量谓词折叠后获得潜在的优化。 [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([阿莫斯鸟](https://github.com/amosbird)) +- 使用存储元信息来评估琐碎 `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([阿莫斯鸟](https://github.com/amosbird), [阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 矢量化处理 `arrayReduce` 与聚合器类似 `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([阿莫斯鸟](https://github.com/amosbird)) +- 在性能的小改进 `Kafka` 消费 [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([伊万](https://github.com/abyss7)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement} + +- 添加对交叉编译的支持到CPU架构AARCH64。 重构打包器脚本。 [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([伊万](https://github.com/abyss7)) +- 在构建软件包时,将darwin-x86\_64和linux-aarch64工具链解压缩到已挂载的Docker卷中 [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([伊万](https://github.com/abyss7)) +- 更新二进制打包器的Docker映像 [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([伊万](https://github.com/abyss7)) +- 修复了MacOS Catalina上的编译错误 [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([欧内斯特\*波列塔耶夫](https://github.com/ernestp)) +- 查询分析逻辑中的一些重构:将复杂的类拆分为几个简单的类。 [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复没有子模块的构建 [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) +- 更好 `add_globs` 在CMake文件中 [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([阿莫斯鸟](https://github.com/amosbird)) +- 删除硬编码路径 `unwind` 目标 [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) +- 允许在没有ssl的情况下使用mysql格式 [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) + +#### 其他 {#other} + +- 为ClickHouse SQL方言添加了ANTLR4语法 [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +## 碌莽禄.拢.0755-88888888 {#clickhouse-release-v19-16} + +#### ClickHouse版本v19.16.14.65,2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} + +- 修复了多个参数(超过10)的三元逻辑运算批量计算中的错误。 [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([亚历山大\*卡扎科夫](https://github.com/Akazz))这个错误修正是由Altinity的特殊要求回移到版本19.16的。 + +#### ClickHouse释放v19.16.14.65,2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} + +- 修复分布式子查询与旧版本的CH不兼容。 修复 [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) + [(tabplubix)](https://github.com/tavplubix) +- 执行时 `CREATE` 查询,在存储引擎参数中折叠常量表达式。 将空数据库名称替换为当前数据库。 修复 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). 还修复检查本地地址 `ClickHouseDictionarySource`. + [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) +- 现在背景合并 `*MergeTree` 表引擎家族更准确地保留存储策略卷顺序。 + [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 防止丢失数据 `Kafka` 在极少数情况下,在读取后缀之后但在提交之前发生异常。 修复 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). 相关: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) + [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(菲利蒙诺夫)](https://github.com/filimonov) +- 修复尝试使用/删除时导致服务器终止的错误 `Kafka` 使用错误的参数创建的表。 修复 [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). 结合 [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). + [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(菲利蒙诺夫)](https://github.com/filimonov) +- 允许使用 `MaterializedView` 与上面的子查询 `Kafka` 桌子 + [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) + +#### 新功能 {#new-feature-1} + +- 添加 `deduplicate_blocks_in_dependent_materialized_views` 用于控制具有实例化视图的表中幂等插入的行为的选项。 这个新功能是由Altinity的特殊要求添加到错误修正版本中的。 + [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) + +### ClickHouse发布版本v19.16.2.2,2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} + +#### 向后不兼容的更改 {#backward-incompatible-change-1} + +- 为count/counIf添加缺失的验证。 + [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) + [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) +- 删除旧版 `asterisk_left_columns_only` 设置(默认情况下禁用)。 + [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([阿尔乔姆 + Zuikov](https://github.com/4ertus2)) +- 模板数据格式的格式字符串现在在文件中指定。 + [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) + +#### 新功能 {#new-feature-2} + +- 引入uniqCombined64()来计算大于UINT\_MAX的基数。 + [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), + [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat + Khuzhin](https://github.com/azat)) +- 支持数组列上的Bloom filter索引。 + [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) + ([achimbab](https://github.com/achimbab)) +- 添加函数 `getMacro(name)` 返回与相应值的字符串 `` + 从服务器配置. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) + ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 为基于HTTP源的字典设置两个配置选项: `credentials` 和 + `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([纪尧姆 + Tassery](https://github.com/YiuRULE)) +- 添加新的ProfileEvent `Merge` 这计算启动的背景合并的数量。 + [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([米哈伊尔 + 科罗托夫](https://github.com/millb)) +- 添加返回完全限定域名的fullHostName函数。 + [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) + [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) +- 添加功能 `arraySplit` 和 `arrayReverseSplit` 通过拆分数组 “cut off” + 条件。 它们在时间序列处理中非常有用。 + [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) +- 添加返回multiMatch函数系列中所有匹配索引的数组的新函数。 + [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila + 库特宁](https://github.com/danlark1)) +- 添加新的数据库引擎 `Lazy` 即针对存储大量小日志进行了优化 + 桌子 [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([尼基塔 + Vasilev](https://github.com/nikvas0)) +- 为位图列添加聚合函数groupBitmapAnd,-或-Xor。 [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([知昌 + 阿优](https://github.com/yuzhichang)) +- 添加聚合函数组合器-OrNull和-OrDefault,它们返回null + 或默认值时没有任何聚合。 + [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) + ([hcz](https://github.com/hczhcz)) +- 引入支持自定义转义的CustomSeparated数据格式 + 分隔符规则。 [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) + ([tavplubix](https://github.com/tavplubix)) +- 支持Redis作为外部字典的来源。 [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [安东 + 波波夫](https://github.com/CurtizJ)) + +#### 错误修复 {#bug-fix-2} + +- 修复错误的查询结果,如果它有 `WHERE IN (SELECT ...)` 部分和 `optimize_read_in_order` 是 + 使用。 [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([安东 + 波波夫](https://github.com/CurtizJ)) +- 禁用MariaDB身份验证插件,这取决于项目之外的文件。 + [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([尤里 + 巴拉诺夫](https://github.com/yurriy)) +- 修复异常 `Cannot convert column ... because it is constant but values of constants are different in source and result` 这可能很少发生,当功能 `now()`, `today()`, + `yesterday()`, `randConstant()` 被使用。 + [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([尼古拉 + Kochetov](https://github.com/KochetovNicolai)) +- 修复了使用HTTP保持活动超时而不是TCP保持活动超时的问题。 + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([瓦西里 + Nemkov](https://github.com/Enmk)) +- 修复了groupBitmapOr中的分段错误(问题 [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). + [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([知昌 + 阿优](https://github.com/yuzhichang)) +- 对于实例化视图,在写入所有数据之后调用kafka的提交。 + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([伊万](https://github.com/abyss7)) +- 修复错误 `duration_ms` 值 `system.part_log` 桌子 这是十次关闭。 + [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([弗拉基米尔 + Chebotarev](https://github.com/excitoon)) +- 快速修复解决实时查看表中的崩溃并重新启用所有实时查看测试。 + [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) + ([vzakaznikov](https://github.com/vzakaznikov)) +- 在MergeTree部件的最小/最大索引中正确序列化NULL值。 + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([亚历山大 + 库兹门科夫](https://github.com/akuzm)) +- 不要把虚拟列。创建表时的sql元数据 `CREATE TABLE AS`. + [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([伊万](https://github.com/abyss7)) +- 修复分段故障 `ATTACH PART` 查询。 + [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) + ([阿利沙平](https://github.com/alesapin)) +- 修复了子查询中empty和empty优化给出的某些查询的错误结果 + INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([尼古拉 + Kochetov](https://github.com/KochetovNicolai)) +- 修复LIVE VIEW getHeader()方法中的AddressSanitizer错误。 + [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) + ([vzakaznikov](https://github.com/vzakaznikov)) + +#### 改进 {#improvement-1} + +- 在queue\_wait\_max\_ms等待发生的情况下添加消息。 + [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat + Khuzhin](https://github.com/azat)) +- 制作设置 `s3_min_upload_part_size` 表级别。 + [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([弗拉基米尔 + Chebotarev](https://github.com/excitoon)) +- 检查Ttl在StorageFactory。 [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) + ([sundyli](https://github.com/sundy-li)) +- 在部分合并连接(优化)中压缩左侧块。 + [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([阿尔乔姆 + Zuikov](https://github.com/4ertus2)) +- 不允许在复制表引擎的突变中使用非确定性函数,因为这 + 可能会在副本之间引入不一致。 + [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([亚历山大 + 卡扎科夫](https://github.com/Akazz)) +- 将异常堆栈跟踪转换为字符串时禁用内存跟踪器。 它可以防止损失 + 类型的错误消息 `Memory limit exceeded` 在服务器上,这导致了 `Attempt to read after eof` 客户端上的例外。 [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) + ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 其他格式改进。 决定 + [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), + [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), + [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), + [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) + [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) + ([tavplubix](https://github.com/tavplubix)) +- ClickHouse将忽略IN运算符右侧不可转换为左侧的值 + side type. Make it work properly for compound types – Array and Tuple. + [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([亚历山大 + 库兹门科夫](https://github.com/akuzm)) +- 支持ASOF加入缺失的不平等。 它可以加入小于或等于变体和严格 + 在语法上,ASOF列的变体越来越多。 + [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([阿尔乔姆 + Zuikov](https://github.com/4ertus2)) +- 优化部分合并连接。 [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) + ([Artem Zuikov](https://github.com/4ertus2)) +- 不要在uniqCombined函数中使用超过98K的内存。 + [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), + [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat + Khuzhin](https://github.com/azat)) +- 在PartialMergeJoin中刷新磁盘上右连接表的部分(如果没有足够的 + 记忆)。 需要时加载数据。 [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) + ([Artem Zuikov](https://github.com/4ertus2)) + +#### 性能改进 {#performance-improvement-1} + +- 通过避免数据重复加快使用const参数的joinGet。 + [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([阿莫斯 + 鸟](https://github.com/amosbird)) +- 如果子查询为空,请提前返回。 + [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) +- 优化值中SQL表达式的解析。 + [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) + ([tavplubix](https://github.com/tavplubix)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-1} + +- 禁用交叉编译到Mac OS的一些贡献。 + [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([伊万](https://github.com/abyss7)) +- 为clickhouse\_common\_io添加与PocoXML缺少的链接。 + [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat + Khuzhin](https://github.com/azat)) +- 在clickhouse-test中接受多个测试过滤器参数。 + [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([亚历山大 + 库兹门科夫](https://github.com/akuzm)) +- 为ARM启用musl和jemalloc。 [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) + ([阿莫斯鸟](https://github.com/amosbird)) +- 已添加 `--client-option` 参数 `clickhouse-test` 将其他参数传递给客户端。 + [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([尼古拉 + Kochetov](https://github.com/KochetovNicolai)) +- 在rpm软件包升级时保留现有配置。 + [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) + ([filimonov](https://github.com/filimonov)) +- 修复PVS检测到的错误。 [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([阿尔乔姆 + Zuikov](https://github.com/4ertus2)) +- 修复达尔文的构建。 [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) + ([伊万](https://github.com/abyss7)) +- glibc2.29兼容性. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([阿莫斯 + 鸟](https://github.com/amosbird)) +- 确保dh\_clean不会触及潜在的源文件。 + [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([阿莫斯 + 鸟](https://github.com/amosbird)) +- 尝试避免从altinity rpm更新时发生冲突-它有单独打包的配置文件 + 在clickhouse服务器-常见. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) + ([filimonov](https://github.com/filimonov)) +- 优化一些头文件,以便更快地重建。 + [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), + [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([亚历山大 + 库兹门科夫](https://github.com/akuzm)) +- 添加日期和日期时间的性能测试。 [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([瓦西里 + Nemkov](https://github.com/Enmk)) +- 修复一些包含非确定性突变的测试。 + [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([亚历山大 + 卡扎科夫](https://github.com/Akazz)) +- 添加构建与MemorySanitizer CI。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) + ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 避免在MetricsTransmitter中使用未初始化的值。 + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat + Khuzhin](https://github.com/azat)) +- 修复MemorySanitizer发现的字段中的一些问题。 + [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), + [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([亚历山大 + 库兹门科夫](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) + ([阿莫斯鸟](https://github.com/amosbird)) +- 修复murmurhash32中未定义的行为。 [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([阿莫斯 + 鸟](https://github.com/amosbird)) +- 修复StoragesInfoStream中未定义的行为。 [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) + ([tavplubix](https://github.com/tavplubix)) +- 固定常量表达式折叠外部数据库引擎(MySQL,ODBC,JDBC)。 在上一页 + 版本它不适用于多个常量表达式,并且根本不适用于日期, + 日期时间和UUID。 这修复 [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) + ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在访问no\_users\_thread变量时修复实时查看中的ThreadSanitizer数据竞争错误。 + [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) + ([vzakaznikov](https://github.com/vzakaznikov)) +- 在libcommon中摆脱malloc符号 + [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), + [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([阿莫斯 + 鸟](https://github.com/amosbird)) +- 添加全局标志ENABLE\_LIBRARY以禁用所有库。 + [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) + ([proller](https://github.com/proller)) + +#### 代码清理 {#code-cleanup} + +- 概括配置存储库以准备字典的DDL。 [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) + ([阿利沙平](https://github.com/alesapin)) +- 解析器字典DDL没有任何语义。 + [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) + ([阿利沙平](https://github.com/alesapin)) +- 将ParserCreateQuery拆分为不同的较小的解析器。 + [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) + ([阿利沙平](https://github.com/alesapin)) +- 在外部字典附近进行小型重构和重命名。 + [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) + ([阿利沙平](https://github.com/alesapin)) +- 重构一些代码以准备基于角色的访问控制。 [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([维塔利 + 巴拉诺夫](https://github.com/vitlibar)) +- DatabaseOrdinary代码中的一些改进。 + [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([尼基塔 + Vasilev](https://github.com/nikvas0)) +- 不要在哈希表的find()和emplace()方法中使用迭代器。 + [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([亚历山大 + 库兹门科夫](https://github.com/akuzm)) +- 修正getMultipleValuesFromConfig的情况下,当参数根不为空。 [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) + ([米哈伊尔\*科罗托夫](https://github.com/millb)) +- 删除一些复制粘贴(TemporaryFile和TemporaryFileStream) + [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([阿尔乔姆 + Zuikov](https://github.com/4ertus2)) +- 改进了代码的可读性一点点 (`MergeTreeData::getActiveContainingPart`). + [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([弗拉基米尔 + Chebotarev](https://github.com/excitoon)) +- 等待使用本地对象的所有计划作业,如果 `ThreadPool::schedule(...)` 投掷 + 一个例外 重命名 `ThreadPool::schedule(...)` 到 `ThreadPool::scheduleOrThrowOnError(...)` 和 + 修复注释,使明显的,它可能会抛出。 + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) + ([tavplubix](https://github.com/tavplubix)) + +## ClickHouse释放19.15 {#clickhouse-release-19-15} + +### ClickHouse释放19.15.4.10,2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} + +#### 错误修复 {#bug-fix-3} + +- 增加了sql\_tinyint和SQL\_BIGINT的处理,并修复了ODBC桥中SQL\_FLOAT数据源类型的处理。 + [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) +- 允许在移动分区中的目标磁盘或卷上有一些部分。 + [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 通过ODBC桥固定可空列中的NULL值。 + [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 固定插入到具体化列的分布式非本地节点。 + [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) +- 固定函数getMultipleValuesFromConfig。 + [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([米哈伊尔\*科罗托夫](https://github.com/millb)) +- 修复了使用HTTP保持活动超时而不是TCP保持活动超时的问题。 + [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 等待所有作业在异常时完成(修复罕见的段错误)。 + [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) +- 在插入Kafka表时不要推送MVs。 + [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([伊万](https://github.com/abyss7)) +- 禁用异常堆栈的内存跟踪器。 + [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复了外部数据库转换查询中的错误代码。 + [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 避免在MetricsTransmitter中使用未初始化的值。 + [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) +- 添加了用于测试的宏的示例配置 ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### ClickHouse释放19.15.3.6,2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} + +#### 错误修复 {#bug-fix-4} + +- 修正了哈希字典中的bad\_variant。 + ([阿利沙平](https://github.com/alesapin)) +- 修复了附加部件查询中分段故障的错误。 + ([阿利沙平](https://github.com/alesapin)) +- 固定时间计算 `MergeTreeData`. + ([Vladimir Chebotarev](https://github.com/excitoon)) +- 写作完成后明确提交给Kafka。 + [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([伊万](https://github.com/abyss7)) +- 在MergeTree部件的最小/最大索引中正确序列化NULL值。 + [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-15-2-2-2019-10-01} + +#### 新功能 {#new-feature-3} + +- 分层存储:支持使用MergeTree引擎对表使用多个存储卷。 可以将新数据存储在SSD上,并自动将旧数据移动到HDD。 ([示例](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([阿利沙平](https://github.com/alesapin)) +- 添加表函数 `input` 用于读取传入的数据 `INSERT SELECT` 查询。 [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([安东\*波波夫](https://github.com/CurtizJ)) +- 添加一个 `sparse_hashed` 字典布局,即在功能上等同于 `hashed` 布局,但更高效的内存。 它使用的内存减少了大约两倍,代价是较慢的值检索。 [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) +- 实现定义用户列表以访问字典的能力。 仅使用当前连接的数据库。 [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 添加 `LIMIT` 选项 `SHOW` 查询。 [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- 添加 `bitmapSubsetLimit(bitmap, range_start, limit)` 函数,返回最小的子集 `limit` 设置中的值不小于 `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([余志昌](https://github.com/yuzhichang)) +- 添加 `bitmapMin` 和 `bitmapMax` 功能。 [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([余志昌](https://github.com/yuzhichang)) +- 添加功能 `repeat` 有关 [问题-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([弗林](https://github.com/ucasFL)) + +#### 实验特点 {#experimental-feature-1} + +- 实现(在内存中)不更改当前管道的合并联接变体。 结果按合并键进行部分排序。 设置 `partial_merge_join = 1` 要使用此功能。 合并联接仍在开发中。 [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) +- 添加 `S3` 发动机和表功能. 它仍在开发中(还没有身份验证支持)。 [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) + +#### 改进 {#improvement-2} + +- 从Kafka读取的每条消息都是以原子方式插入的。 这解决了Kafka引擎的几乎所有已知问题。 [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([伊万](https://github.com/abyss7)) +- 对分布式查询故障转移的改进。 缩短恢复时间,也是现在可配置的,可以看出 `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 直接支持枚举的数值 `IN` 科。 \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) +- 支持(可选,默认情况下禁用)对URL存储进行重定向。 [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) +- 当具有较旧版本的客户端连接到服务器时添加信息消息。 [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) +- 删除在分布式表中发送数据的最大退避睡眠时间限制 [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) +- 添加将配置文件事件(计数器)与累积值发送到graphite的能力。 它可以在启用 `` 在服务器 `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) +- 添加自动转换类型 `T` 到 `LowCardinality(T)` 在类型的列中插入数据 `LowCardinality(T)` 在本机格式通过HTTP。 [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 添加使用功能的能力 `hex` 不使用 `reinterpretAsString` 为 `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([米哈伊尔\*科罗托夫](https://github.com/millb)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-2} + +- 将gdb-index添加到带有调试信息的clickhouse二进制文件。 这将加快启动时间 `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([阿利沙平](https://github.com/alesapin)) +- 加速deb包装与补丁dpkg-deb它使用 `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([阿利沙平](https://github.com/alesapin)) +- 设置 `enable_fuzzing = 1` 启用所有项目代码的libfuzzer检测功能。 [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) +- 在CI中添加拆分构建烟雾测试。 [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([阿利沙平](https://github.com/alesapin)) +- 添加构建与MemorySanitizer CI。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) +- 替换 `libsparsehash` 与 `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) + +#### 错误修复 {#bug-fix-5} + +- 修复了大型表上复杂键的索引分析的性能下降。 这修复了#6924。 [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复从Kafka空主题中选择时导致段错误的逻辑错误。 [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([伊万](https://github.com/abyss7)) +- 修复过早的MySQL连接关闭 `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- 返回对非常旧的Linux内核的支持(修复 [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复可能的数据丢失 `insert select` 在输入流中的空块的情况下进行查询。 \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复功能 `АrrayEnumerateUniqRanked` 在参数中使用空数组 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- 使用数组联接和全局子查询修复复杂的查询。 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([伊万](https://github.com/abyss7)) +- 修复 `Unknown identifier` 按顺序排列和按多个联接分组的错误 [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定 `MSan` 执行函数时发出警告 `LowCardinality` 争论。 [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) + +#### 向后不兼容的更改 {#backward-incompatible-change-2} + +- 更改了位图\*聚合函数状态的序列化格式,以提高性能。 无法读取以前版本的位图\*的序列化状态。 [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([余志昌](https://github.com/yuzhichang)) + +## ClickHouse释放19.14 {#clickhouse-release-19-14} + +### ClickHouse释放19.14.7.15,2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} + +#### 错误修复 {#bug-fix-6} + +- 此版本还包含19.11.12.69的所有错误修复。 +- 修复了19.14和早期版本之间分布式查询的兼容性。 这修复 [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### ClickHouse释放19.14.6.12,2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} + +#### 错误修复 {#bug-fix-7} + +- 修复功能 `АrrayEnumerateUniqRanked` 在参数中使用空数组。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) +- 修复了查询中的子查询名称 `ARRAY JOIN` 和 `GLOBAL IN subquery` 用化名。 如果指定了外部表名,请使用子查询别名。 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([伊万](https://github.com/abyss7)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-3} + +- 修复 [拍打](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) 测试 `00715_fetch_merged_or_mutated_part_zookeeper` 通过将其重写为shell脚本,因为它需要等待突变应用。 [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) +- 修正了UBSan和MemSan功能失败 `groupUniqArray` 使用emtpy数组参数。 这是由于放置空 `PaddedPODArray` 因为没有调用零单元格值的构造函数,所以将其转换为哈希表零单元格。 [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([阿莫斯鸟](https://github.com/amosbird)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-14-3-3-2019-09-10} + +#### 新功能 {#new-feature-4} + +- `WITH FILL` 修饰符 `ORDER BY`. (继续 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([安东\*波波夫](https://github.com/CurtizJ)) +- `WITH TIES` 修饰符 `LIMIT`. (继续 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([安东\*波波夫](https://github.com/CurtizJ)) +- 解析无引号 `NULL` 文字为NULL(如果设置 `format_csv_unquoted_null_literal_as_null=1`). 如果此字段的数据类型不可为空,则使用默认值初始化null字段(如果设置 `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) +- 支持表函数路径中的通配符 `file` 和 `hdfs`. 如果路径包含通配符,则表将为只读。 使用示例: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` 和 `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) +- 新 `system.metric_log` 表存储的值 `system.events` 和 `system.metrics` 具有指定的时间间隔。 [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 允许将ClickHouse文本日志写入 `system.text_log` 桌子 [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在堆栈跟踪中显示私有符号(这是通过解析ELF文件的符号表来完成的)。 如果存在调试信息,则在堆栈跟踪中添加有关文件和行号的信息。 使用程序中存在的索引符号加速符号名称查找。 增加了新的SQL函数的反省: `demangle` 和 `addressToLine`. 重命名函数 `symbolizeAddress` 到 `addressToSymbol` 为了一致性。 功能 `addressToSymbol` 将返回错位的名称出于性能原因,你必须申请 `demangle`. 添加设置 `allow_introspection_functions` 默认情况下,这是关闭的。 [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 表函数 `values` (名称不区分大小写)。 它允许从读取 `VALUES` 建议的名单 [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). 示例: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) +- 增加了改变存储设置的功能。 语法: `ALTER TABLE MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([阿利沙平](https://github.com/alesapin)) +- 用于拆卸分离部件的支撑。 语法: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) +- 表约束。 允许将约束添加到将在插入时检查的表定义。 [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 支持级联实例化视图。 [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([阿莫斯鸟](https://github.com/amosbird)) +- 默认情况下,打开查询探查器以每秒对每个查询执行线程进行一次采样。 [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 输入格式 `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) +- 增加了两个新功能: `sigmoid` 和 `tanh` (这对于机器学习应用程序非常有用)。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 功能 `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` 检查给定的令牌是否在干草堆中。 Token是两个非字母数字ASCII字符(或干草堆的边界)之间的最大长度子串。 Token必须是常量字符串。 由tokenbf\_v1索引专业化支持。 [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 新功能 `neighbor(value, offset[, default_value])`. 允许在一个数据块中的列中达到上一个/下一个值。 [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) +- 创建了一个函数 `currentUser()`,返回授权用户的登录。 添加别名 `user()` 对于与MySQL的兼容性。 [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) +- 新的聚合函数 `quantilesExactInclusive` 和 `quantilesExactExclusive` 这是在提出 [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) +- 功能 `bitmapRange(bitmap, range_begin, range_end)` 返回具有指定范围的新集(不包括 `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([余志昌](https://github.com/yuzhichang)) +- 功能 `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` 它创建了一系列精确的长串geohash盒复盖提供的区域。 [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 实现对插入查询的支持 `Kafka` 桌子 [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([伊万](https://github.com/abyss7)) +- 增加了对 `_partition` 和 `_timestamp` 虚拟列到Kafka引擎。 [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([伊万](https://github.com/abyss7)) +- 可以从中删除敏感数据 `query_log`,服务器日志,基于正则表达式的规则的进程列表。 [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) + +#### 实验特点 {#experimental-feature-2} + +- 输入和输出数据格式 `Template`. 它允许为输入和输出指定自定义格式字符串。 [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) +- 执行 `LIVE VIEW` 最初提出的表 [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898),准备 [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925),然后更新 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). 看 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) 详细描述。 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov))请注意 `LIVE VIEW` 功能可能会在下一个版本中删除。 + +#### 错误修复 {#bug-fix-8} + +- 此版本还包含19.13和19.11的所有错误修复。 +- 修复表有跳过索引和垂直合并发生时的分段错误。 [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([阿利沙平](https://github.com/alesapin)) +- 使用非平凡的列默认值修复每列TTL。 以前在强制TTL合并的情况下 `OPTIMIZE ... FINAL` 查询,过期的值被替换为类型默认值,而不是用户指定的列默认值。 [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复kafka服务器正常重启时的消息重复问题。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([伊万](https://github.com/abyss7)) +- 修正了读取Kafka消息时的无限循环。 根本不要暂停/恢复订阅消费者-否则在某些情况下可能会无限期暂停。 [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([伊万](https://github.com/abyss7)) +- 修复 `Key expression contains comparison between inconvertible types` 例外 `bitmapContains` 功能。 [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) +- 修复已启用的段错误 `optimize_skip_unused_shards` 还丢失了分片钥匙 [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复了可能导致内存损坏的突变中的错误代码。 修复了读取地址的段错误 `0x14c0` 这可能发生由于并发 `DROP TABLE` 和 `SELECT` 从 `system.parts` 或 `system.parts_columns`. 在准备突变查询时修复了竞争条件。 修复了由于 `OPTIMIZE` 复制的表和并发修改操作,如改变。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在MySQL界面中删除了额外的详细日志记录 [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 返回解析布尔设置的能力 ‘true’ 和 ‘false’ 在配置文件中。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([阿利沙平](https://github.com/alesapin)) +- 修复崩溃 `quantile` 和 `median` 功能结束 `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正了可能不完整的结果返回 `SELECT` 查询与 `WHERE` 主键上的条件包含转换为浮点类型。 它是由不正确的单调性检查引起的 `toFloat` 功能。 [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- 检查 `max_expanded_ast_elements` 设置为突变。 明确突变后 `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([张冬](https://github.com/zhang2014)) +- 修复使用键列时的联接结果 `join_use_nulls`. 附加空值而不是列默认值。 [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正了跳过索引与垂直合并和改变。 修复 `Bad size of marks file` 例外。 [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([阿利沙平](https://github.com/alesapin)) +- 修复罕见的崩溃 `ALTER MODIFY COLUMN` 和垂直合并,当合并/改变的部分之一是空的(0行) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([阿利沙平](https://github.com/alesapin)) +- 修正错误的转换 `LowCardinality` 类型 `AggregateFunctionFactory`. 这修复 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复错误的行为和可能的段错误 `topK` 和 `topKWeighted` 聚合函数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([安东\*波波夫](https://github.com/CurtizJ)) +- 固定周围的不安全代码 `getIdentifier` 功能。 [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在MySQL线协议(连接到ClickHouse的形式MySQL客户端时使用)修正了错误。 引起的堆缓冲区溢出 `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 固定内存泄漏 `bitmapSubsetInRange` 功能。 [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([余志昌](https://github.com/yuzhichang)) +- 修复粒度变化后执行突变时的罕见错误。 [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([阿利沙平](https://github.com/alesapin)) +- 默认情况下允许包含所有字段的protobuf消息。 [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 解决错误 `nullIf` 功能,当我们发送 `NULL` 第二个参数的参数。 [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 修正了错误的内存分配/解除分配在复杂的键高速缓存字典与字符串字段,导致无限的内存消耗罕见的错误(看起来像内存泄漏)。 当字符串大小为8(8,16,32等)开始的2的幂时,错误会重现。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([阿利沙平](https://github.com/alesapin)) +- 修复了导致异常的小序列上的大猩猩编码 `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 允许在连接中使用不可为空的类型 `join_use_nulls` 已启用。 [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) +- 禁用 `Poco::AbstractConfiguration` 查询中的替换 `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 避免死锁 `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 使用 `arrayReduce` 对于不变的参数可能会导致段错误。 [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复可能出现的不一致的部分,如果副本恢复后 `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- 固定挂起 `JSONExtractRaw` 功能。 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正错误跳过索引序列化和聚合与自适应粒度。 [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([阿利沙平](https://github.com/alesapin)) +- 修复 `WITH ROLLUP` 和 `WITH CUBE` 修饰符 `GROUP BY` 具有两级聚合。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复编写具有自适应粒度的二级索引标记的错误。 [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([阿利沙平](https://github.com/alesapin)) +- 修复服务器启动时的初始化顺序。 由于 `StorageMergeTree::background_task_handle` 在初始化 `startup()` 该 `MergeTreeBlockOutputStream::write()` 可以尝试在初始化之前使用它。 只需检查它是否被初始化。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([伊万](https://github.com/abyss7)) +- 从以前的读取操作中清除数据缓冲区,该操作完成时出现错误。 [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([尼古拉](https://github.com/bopohaa)) +- 修复为复制\*MergeTree表创建新副本时启用自适应粒度的错误。 [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([阿利沙平](https://github.com/alesapin)) +- 修复了在服务器启动过程中发生异常的情况下可能发生的崩溃 `libunwind` 在异常访问未初始化 `ThreadStatus` 结构。 [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) +- 修复崩溃 `yandexConsistentHash` 功能。 通过模糊测试发现。 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了服务器过载和全局线程池接近满时挂起查询的可能性。 这在具有大量分片(数百个)的集群上发生的机会更高,因为分布式查询为每个分片分配每个连接的线程。 例如,如果集群330分片正在处理30个并发分布式查询,则此问题可能再现。 此问题会影响从19.2开始的所有版本。 [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 的固定逻辑 `arrayEnumerateUniqRanked` 功能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 解码符号表时修复段错误。 [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([阿莫斯鸟](https://github.com/amosbird)) +- 在固定不相关的异常转换 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 删除描述中的额外引用 `system.settings` 桌子 [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 避免可能的死锁 `TRUNCATE` 复制的表。 [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复读取排序键的顺序。 [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复 `ALTER TABLE ... UPDATE` 查询表 `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([阿利沙平](https://github.com/alesapin)) +- 修复错误打开 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (自19.4.0)。 当我们不查询任何列时,在对MergeTree表的分布式表的查询中复制 (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([阿利沙平](https://github.com/alesapin)) +- 在有符号类型的整数划分为无符号类型的固定溢出。 这种行为与C或C++语言(整数升级规则)完全相同,这可能令人惊讶。 请注意,当将大型有符号数字划分为大型无符号数字或反之亦然时,溢出仍然是可能的(但这种情况不太常见)。 所有服务器版本都存在此问题。 [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 限制最大睡眠时间限制时 `max_execution_speed` 或 `max_execution_speed_bytes` 已设置。 修正错误,如 `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 关于使用固定的问题 `MATERIALIZED` 列和别名 `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([阿莫斯鸟](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复 `FormatFactory` 未实现为处理器的输入流的行为。 [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 固定错字。 [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) +- 错字在错误消息(是-\>是)。 [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) +- 修复了从字符串中解析列列表时的错误,如果类型包含逗号(这个问题与 `File`, `URL`, `HDFS` 储存) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) + +#### 安全修复 {#security-fix} + +- 此版本还包含19.13和19.11的所有错误安全修复。 +- 修复了由于SQL解析器中的堆栈溢出而导致服务器崩溃的制造查询的可能性。 修复了合并和分布式表,实例化视图和涉及子查询的行级安全性条件中堆栈溢出的可能性。 [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 改进 {#improvement-3} + +- 三元逻辑的正确实现 `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) +- 现在,值和行与过期的TTL将被删除后 `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` 查询。 添加查询 `SYSTEM STOP/START TTL MERGES` 要禁止/允许使用TTL分配合并,并在所有合并中过滤过期值。 [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([安东\*波波夫](https://github.com/CurtizJ)) +- 可以更改ClickHouse历史文件的位置为客户端使用 `CLICKHOUSE_HISTORY_FILE` env [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) +- 删除 `dry_run` 从标志 `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 碌莽禄Support: `ASOF JOIN` 与 `ON` 科。 [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) +- 更好地支持用于突变和复制的跳过索引。 支持 `MATERIALIZE/CLEAR INDEX ... IN PARTITION` 查询。 `UPDATE x = x` 重新计算使用列的所有索引 `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 允许 `ATTACH` 实时视图(例如,在服务器启动时),无论 `allow_experimental_live_view` 设置。 [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 对于由查询探查器收集的堆栈跟踪,不包括由查询探查器本身生成的堆栈帧。 [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 现在表函数 `values`, `file`, `url`, `hdfs` 支持别名列。 [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 如果抛出异常 `config.d` 文件没有相应的根元素作为配置文件。 [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) +- 在异常消息中打印额外的信息 `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) +- 当确定一个碎片 `Distributed` 要被读取查询复盖的表(用于 `optimize_skip_unused_shards` =1)ClickHouse现在从两个检查条件 `prewhere` 和 `where` select语句的子句。 [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) +- 已启用 `SIMDJSON` 对于没有AVX2,但与SSE4.2和PCLMUL指令集的机器。 [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- ClickHouse可以在文件系统上工作,而无需 `O_DIRECT` 支持(如ZFS和BtrFS),无需额外的调整。 [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 支持最终子查询的下推谓词。 [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 更好 `JOIN ON` 密钥提取 [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) +- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 优化最小列的选择 `SELECT count()` 查询。 [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([阿莫斯鸟](https://github.com/amosbird)) +- 已添加 `strict` 参数in `windowFunnel()`. 当 `strict` 设置,该 `windowFunnel()` 仅对唯一值应用条件。 [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) +- 更安全的界面 `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) +- 执行时选项行大小 `--help` 选项现在与终端大小对应。 [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) +- 禁用 “read in order” 优化无键的聚合。 [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([安东\*波波夫](https://github.com/CurtizJ)) +- Http状态代码 `INCORRECT_DATA` 和 `TYPE_MISMATCH` 错误代码已从默认值更改 `500 Internal Server Error` 到 `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([亚历山大\*罗丹](https://github.com/a-rodin)) +- 从移动连接对象 `ExpressionAction` 成 `AnalyzedJoin`. `ExpressionAnalyzer` 和 `ExpressionAction` 不知道 `Join` 不再上课了 它的逻辑被隐藏 `AnalyzedJoin` 伊菲斯 [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复了当其中一个分片是localhost但查询通过网络连接发送时可能出现的分布式查询死锁。 [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 更改多个表的语义 `RENAME` 为了避免可能的死锁。 [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 重写MySQL兼容性服务器以防止在内存中加载完整的数据包有效负载。 每个连接的内存消耗减少到大约 `2 * DBMS_DEFAULT_BUFFER_SIZE` (读/写缓冲区)。 [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 将AST别名解释逻辑移出不必了解查询语义的解析器。 [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) +- 稍微更安全的解析 `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `clickhouse-copier`:允许使用 `where_condition` 从配置 `partition_key` 查询中用于检查分区存在的别名(以前它仅用于读取数据查询)。 [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) +- 在添加可选的消息参数 `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) +- 在发送插入数据时,服务器异常也正在客户端中处理。 [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) +- 添加了指标 `DistributedFilesToInsert` 这显示了文件系统中选择通过分布式表发送到远程服务器的文件总数。 该数字在所有分片之间相加。 [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 将大部分连接准备逻辑从 `ExpressionAction/ExpressionAnalyzer` 到 `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复曾 [警告](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 关于缺乏Linux功能的更好的信息消息。 记录致命错误 “fatal” 水平,这将使它更容易找到 `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 当启用转储临时数据到磁盘,以限制内存使用期间 `GROUP BY`, `ORDER BY`,它没有检查可用磁盘空间。 修复程序添加新设置 `min_free_disk_space`,当可用磁盘空间小于阈值时,查询将停止并抛出 `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([徐伟清](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 通过线程删除递归rwlock。 这是没有意义的,因为线程在查询之间重用。 `SELECT` 查询可以在一个线程中获取锁,从另一个线程持有锁并从第一个线程退出。 在同一时间,第一个线程可以通过重复使用 `DROP` 查询。 这将导致虚假 “Attempt to acquire exclusive lock recursively” 消息 [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 斯普利特 `ExpressionAnalyzer.appendJoin()`. 准备一个地方 `ExpressionAnalyzer` 为 `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) +- 已添加 `mysql_native_password` mysql兼容性服务器的身份验证插件。 [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 更少的数量 `clock_gettime` 调用;调试/发布之间的固定ABI兼容性 `Allocator` (微不足道的问题)。 [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 移动 `collectUsedColumns` 从 `ExpressionAnalyzer` 到 `SyntaxAnalyzer`. `SyntaxAnalyzer` 赂眉露\>\> `required_source_columns` 现在本身。 [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) +- 添加设置 `joined_subquery_requires_alias` 要求子选择和表函数的别名 `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) +- 提取物 `GetAggregatesVisitor` 从类 `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) +- `system.query_log`:更改数据类型 `type` 列到 `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) +- 静态链接 `sha256_password` 身份验证插件。 [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 避免对设置的额外依赖 `compile` 去工作 在以前的版本中,用户可能会得到如下错误 `cannot open crti.o`, `unable to find library -lc` 等。 [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 对可能来自恶意副本的输入进行更多验证。 [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 现在 `clickhouse-obfuscator` 文件是可用的 `clickhouse-client` 包。 在以前的版本中,它可以作为 `clickhouse obfuscator` (带空格)。 [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) +- 当我们至少有两个查询以不同的顺序读取至少两个表,另一个查询对其中一个表执行DDL操作时,修复了死锁。 修复了另一个非常罕见的死锁。 [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 已添加 `os_thread_ids` 列到 `system.processes` 和 `system.query_log` 为了更好的调试可能性。 [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 当发生PHP mysqlnd扩展错误的解决方法 `sha256_password` 用作默认身份验证插件(在描述 [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 删除不需要的地方与更改为空列。 [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) +- 设置默认值 `queue_max_wait_ms` 为零,因为当前值(五秒)是没有意义的。 在极少数情况下,此设置有任何用途。 添加设置 `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` 和 `connection_pool_max_wait_ms` 用于消除歧义。 [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 提取物 `SelectQueryExpressionAnalyzer` 从 `ExpressionAnalyzer`. 保留最后一个用于非select查询。 [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) +- 删除重复输入和输出格式。 [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 允许用户复盖 `poll_interval` 和 `idle_connection_timeout` 连接设置。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `MergeTree` 现在有一个额外的选项 `ttl_only_drop_parts` (默认情况下禁用),以避免部分的部分修剪,以便在部分中的所有行都过期时完全删除它们。 [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([塞尔吉\*弗拉季金](https://github.com/svladykin)) +- 类型检查set索引函数。 如果函数类型错误,则引发异常。 这修复了模糊测试与UBSan。 [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) + +#### 性能改进 {#performance-improvement-2} + +- 优化查询 `ORDER BY expressions` 条款,其中 `expressions` 有重合前缀与排序键 `MergeTree` 桌子 此优化由以下方式控制 `optimize_read_in_order` 设置。 [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([安东\*波波夫](https://github.com/CurtizJ)) +- 允许在零件装载和拆卸期间使用多个螺纹。 [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 实现了更新聚合函数状态的批处理变体。 这可能导致性能优势。 [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 使用 `FastOps` 函数库 `exp`, `log`, `sigmoid`, `tanh`. FastOps是迈克尔\*帕拉欣(Yandex的首席技术官)的快速矢量数学库。 改进的性能 `exp` 和 `log` 功能超过6倍。 功能 `exp` 和 `log` 从 `Float32` 参数将返回 `Float32` (在以前的版本中,他们总是返回 `Float64`). 现在 `exp(nan)` 可能会回来 `inf`. 的结果 `exp` 和 `log` 函数可能不是最接近机器可代表的数字到真正的答案。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov))使用Danila Kutenin变体使fastops工作 [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 禁用连续密钥优化 `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) +- 改进的性能 `simdjson` 库通过摆脱动态分配 `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 预故障页分配内存时 `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) +- 修复性能错误 `Decimal` 比较。 [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-4} + +- 删除编译器(运行时模板实例化),因为我们已经赢得了它的性能。 [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了性能测试,以显示gcc-9以更隔离的方式性能下降。 [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加表功能 `numbers_mt`,这是多线程版本 `numbers`. 使用哈希函数更新性能测试。 [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 比较模式 `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) +- 尽最大努力打印堆栈痕迹。 还添加了 `SIGPROF` 作为调试信号,打印正在运行的线程的堆栈跟踪。 [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 每个函数都在自己的文件中,第10部分。 [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 删除两倍常量 `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) +- 格式化更改 `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) +- 更好的联接创建子查询 `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) +- 删除冗余条件(由PVS Studio找到)。 [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) +- 分隔散列表接口 `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) +- 重构设置。 [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([阿利沙平](https://github.com/alesapin)) +- 添加注释 `set` 索引函数。 [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 在Linux上的调试版本中增加OOM分数。 [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) +- HDFS HA现在在调试版本中工作。 [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([徐伟清](https://github.com/weiqxu)) +- 添加了一个测试 `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 为Kafka表添加多个实例化视图的测试。 [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([伊万](https://github.com/abyss7)) +- 制定一个更好的构建计划。 [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([伊万](https://github.com/abyss7)) +- 固定 `test_external_dictionaries` 集成的情况下,它是在非root用户下执行。 [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 当写入的数据包的总大小超过 `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 增加了一个测试 `RENAME` 表竞争条件 [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 避免在设置数据竞赛 `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 通过缓存字典添加处理错误的集成测试。 [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 在Mac OS上禁用ELF对象文件的解析,因为这是没有意义的。 [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 尝试使更新日志生成器更好。 [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加 `-Wshadow` 切换到海湾合作委员会。 [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) +- 删除过时的代码 `mimalloc` 支持。 [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `zlib-ng` 确定x86功能并将此信息保存到全局变量。 这是在defalteInit调用中完成的,它可以由不同的线程同时进行。 为了避免多线程写入,请在库启动时执行此操作。 [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) +- 回归测试一个错误,在连接这是固定的 [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) +- 修正MSan报告。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复扑ttl测试。 [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修正了虚假数据竞赛 `MergeTreeDataPart::is_frozen` 场。 [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了模糊测试中的超时。 在以前的版本中,它设法在查询中找到虚假挂断 `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加了调试检查 `static_cast` 列。 [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在官方RPM软件包中支持Oracle Linux。 [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 从更改json perftests `once` 到 `loop` 类型。 [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- `odbc-bridge.cpp` 定义 `main()` 所以它不应该被包括在 `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Origej Desh](https://github.com/orivej)) +- 测试碰撞 `FULL|RIGHT JOIN` 右表的键中有空值。 [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) +- 为了以防万一,增加了对别名扩展限制的测试。 [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 从切换 `boost::filesystem` 到 `std::filesystem` 在适当的情况下。 [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 将RPM包添加到网站。 [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 为固定添加测试 `Unknown identifier` 例外 `IN` 科。 [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) +- 简化操作 `shared_ptr_helper` 因为人们面临困难理解它。 [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了固定大猩猩和DoubleDelta编解码器的性能测试。 [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 拆分集成测试 `test_dictionaries` 分成四个单独的测试。 [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复PVS-Studio中的警告 `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 允许使用 `library` 与ASan字典源. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了从Pr列表生成更新日志的选项。 [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 锁定 `TinyLog` 读取时存储。 [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) +- 检查CI中损坏的符号链接。 [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加超时时间 “stack overflow” 测试,因为它可能需要很长的时间在调试构建。 [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加了双空格检查。 [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复 `new/delete` 使用消毒剂构建时的内存跟踪。 跟踪不清楚。 它只防止测试中的内存限制异常。 [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) +- 启用链接时对未定义符号的检查。 [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([伊万](https://github.com/abyss7)) +- 避免重建 `hyperscan` 每天 [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在固定的瑞银报告 `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 不要允许将查询探查器与消毒器一起使用,因为它不兼容。 [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加测试计时器失败后重新加载字典。 [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复不一致 `PipelineExecutor::prepareProcessor` 参数类型。 [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 添加了对坏Uri的测试。 [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了更多的检查 `CAST` 功能。 这应该获得更多关于模糊测试中分割故障的信息。 [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 已添加 `gcc-9` 支持 `docker/builder` 本地生成映像的容器。 [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) +- 测试主键 `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) +- 修复了缓慢堆栈跟踪打印影响的测试。 [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加崩溃的测试用例 `groupUniqArray` 固定在 [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) +- 固定指数突变测试。 [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 在性能测试中,不要读取我们没有运行的查询的查询日志。 [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) +- 现在可以使用任何低基数类型创建实例化视图,而不考虑关于可疑低基数类型的设置。 [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) +- 更新的测试 `send_logs_level` 设置。 [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复gcc-8.2下的构建。 [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) +- 修复构建与内部libc++。 [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([伊万](https://github.com/abyss7)) +- 修复共享构建 `rdkafka` 图书馆 [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([伊万](https://github.com/abyss7)) +- 修复Mac OS构建(不完整)。 [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) +- 修复 “splitted” 碌莽禄.拢. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 其他构建修复: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([阿莫斯鸟](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([伊万](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) + +#### 向后不兼容的更改 {#backward-incompatible-change-3} + +- 删除很少使用的表函数 `catBoostPool` 和存储 `CatBoostPool`. 如果您使用了此表功能,请写电子邮件至 `clickhouse-feedback@yandex-team.com`. 请注意,CatBoost集成仍然存在,并将受到支持。 [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 禁用 `ANY RIGHT JOIN` 和 `ANY FULL JOIN` 默认情况下。 设置 `any_join_distinct_right_table_keys` 设置启用它们。 [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) + +## ClickHouse释放19.13 {#clickhouse-release-19-13} + +### ClickHouse释放19.13.6.51,2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} + +#### 错误修复 {#bug-fix-9} + +- 此版本还包含19.11.12.69的所有错误修复。 + +### ClickHouse释放19.13.5.44,2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} + +#### 错误修复 {#bug-fix-10} + +- 此版本还包含19.14.6.12的所有错误修复。 +- 修复了在执行时表的可能不一致的状态 `DROP` 在zookeeper无法访问时查询复制的表。 [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) +- 修复了StorageMerge中的数据竞赛 [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复查询分析器中引入的错误,从而导致套接字无休止的recv。 [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([阿利沙平](https://github.com/alesapin)) +- 修复执行时过多的CPU使用率 `JSONExtractRaw` 函数在一个布尔值。 [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 在推送到实例化视图时修复回归。 [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([伊万](https://github.com/abyss7)) +- 表函数 `url` 该漏洞是否允许攻击者在请求中注入任意HTTP头。 这个问题被发现 [尼基塔\*季霍米罗夫](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复无用 `AST` 检查设置索引。 [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 修正了解析 `AggregateFunction` 查询中嵌入的值。 [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([余志昌](https://github.com/yuzhichang)) +- 修正了错误的行为 `trim` 功能家庭。 [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### ClickHouse释放19.13.4.32,2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} + +#### 错误修复 {#bug-fix-11} + +- 此版本还包含19.11.9.52和19.11.10.54的所有错误安全修复。 +- 固定数据竞赛 `system.parts` 表和 `ALTER` 查询。 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了从带有sample和prewhere的空分布式表中读取流中发生的不匹配标题。 [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([钱丽祥](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复使用时的崩溃 `IN` 子句带有一个元组的子查询。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- 修复具有相同列名的大小写 `GLOBAL JOIN ON` 科。 [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复强制转换类型时的崩溃 `Decimal` 这不支持它。 抛出异常代替。 [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复了崩溃 `extractAll()` 功能。 [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) +- 查询转换 `MySQL`, `ODBC`, `JDBC` 表函数现在正常工作 `SELECT WHERE` 具有多个查询 `AND` 表达式。 [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) +- 添加了以前的声明检查MySQL8集成。 [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([拉斐尔\*大卫\*蒂诺科](https://github.com/rafaeldtinoco)) + +#### 安全修复 {#security-fix-1} + +- 修复解压缩阶段编解码器中的两个漏洞(恶意用户可以制造压缩数据,导致解压缩中的缓冲区溢出)。 [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) + +### 碌莽禄,拢,010-68520682\戮漏鹿芦,酶,虏卤赂拢,110102005602 {#clickhouse-release-19-13-3-26-2019-08-22} + +#### 错误修复 {#bug-fix-12} + +- 修复 `ALTER TABLE ... UPDATE` 查询表 `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([阿利沙平](https://github.com/alesapin)) +- 在使用IN子句时修复带有元组的子查询。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- 修复了一个问题,即如果一个陈旧的副本变为活动的,它可能仍然有被删除分区的数据部分。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- 修正了解析CSV的问题 [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- 修正了系统中的数据竞赛。部件表和ALTER查询。 这修复 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了可能导致内存损坏的突变中的错误代码。 修复了读取地址的段错误 `0x14c0` 这可能发生由于并发 `DROP TABLE` 和 `SELECT` 从 `system.parts` 或 `system.parts_columns`. 在准备突变查询时修复了竞争条件。 修复了由于 `OPTIMIZE` 复制的表和并发修改操作,如改变。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复后可能的数据丢失 `ALTER DELETE` 查询表跳过索引。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) + +#### 安全修复 {#security-fix-2} + +- 如果攻击者具有对ZooKeeper的写入访问权限,并且能够从ClickHouse运行的网络中运行可用的自定义服务器,则可以创建自定义构建的恶意服务器,该服务器将充当ClickHouse副本并将其注册到ZooKeeper中。 当另一个副本从恶意副本中获取数据部分时,它可以强制clickhouse-server写入文件系统上的任意路径。 由Yandex的信息安全团队Eldar Zaitov发现。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-13-2-19-2019-08-14} + +#### 新功能 {#new-feature-5} + +- 查询级别上的采样探查器。 [示例](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) +- 允许指定列的列表 `COLUMNS('regexp')` 表达的工作原理就像一个更复杂的变体 `*` 星号 [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `CREATE TABLE AS table_function()` 现在是可能的 [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) +- 亚当优化随机梯度下降默认情况下使用 `stochasticLinearRegression()` 和 `stochasticLogisticRegression()` 聚合函数,因为它显示了良好的质量,几乎没有任何调整。 [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) +- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([杨小姐](https://github.com/andyyzh)) +- `RENAME` 查询现在适用于所有存储。 [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([伊万](https://github.com/abyss7)) +- 现在客户端通过设置从服务器接收任何所需级别的日志 `send_logs_level` 无论服务器设置中指定的日志级别如何。 [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) + +#### 向后不兼容的更改 {#backward-incompatible-change-4} + +- 设置 `input_format_defaults_for_omitted_fields` 默认情况下启用。 分布式表中的插入需要此设置在集群上相同(您需要在滚动更新之前设置它)。 它允许计算复杂的默认表达式的省略字段 `JSONEachRow` 和 `CSV*` 格式。 它应该是预期的行为,但可能导致可忽略不计的性能差异。 [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) + +#### 实验特点 {#experimental-features} + +- 新的查询处理管道。 使用 `experimental_use_processors=1` 选项来启用它。 用你自己的麻烦。 [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) + +#### 错误修复 {#bug-fix-13} + +- Kafka集成已在此版本中修复。 +- 固定 `DoubleDelta` 编码 `Int64` 对于大 `DoubleDelta` 值,改进 `DoubleDelta` 编码为随机数据 `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 固定的高估 `max_rows_to_read` 如果设置 `merge_tree_uniform_read_distribution` 置为0。 [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 改进 {#improvement-4} + +- 如果抛出异常 `config.d` 文件没有相应的根元素作为配置文件 [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) + +#### 性能改进 {#performance-improvement-3} + +- 优化 `count()`. 现在它使用最小的列(如果可能的话)。 [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([阿莫斯鸟](https://github.com/amosbird)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-5} + +- 在性能测试中报告内存使用情况。 [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) +- 修复构建与外部 `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([伊万](https://github.com/abyss7)) +- 修复共享构建 `rdkafka` 图书馆 [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([伊万](https://github.com/abyss7)) + +## ClickHouse释放19.11 {#clickhouse-release-19-11} + +### ClickHouse释放19.11.13.74,2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} + +#### 错误修复 {#bug-fix-14} + +- 修复了罕见的崩溃 `ALTER MODIFY COLUMN` 当合并/更改部分之一为空(0行)时,垂直合并。 [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([阿利沙平](https://github.com/alesapin)) +- 手动更新 `SIMDJSON`. 这修复了stderr文件可能泛滥的错误json诊断消息。 [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) +- 修正错误 `mrk` 突变的文件扩展名 ([阿利沙平](https://github.com/alesapin)) + +### ClickHouse释放19.11.12.69,2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} + +#### 错误修复 {#bug-fix-15} + +- 修复了大型表上复杂键的索引分析的性能下降。 这修复 [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 使用分布式引擎在表中发送数据时避免罕见的SIGSEGV (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) +- 修复 `Unknown identifier` 有多个连接。 这修复 [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-11-57-2019-09-13} + +- 修复从Kafka空主题中选择时导致段错误的逻辑错误。 [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([伊万](https://github.com/abyss7)) +- 修复功能 `АrrayEnumerateUniqRanked` 在参数中使用空数组。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) + +### ClickHouse释放19.11.10.54,2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} + +#### 错误修复 {#bug-fix-16} + +- 手动存储Kafka消息的偏移量,以便能够一次性为所有分区提交它们。 修复潜在的重复 “one consumer - many partitions” 场景。 [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([伊万](https://github.com/abyss7)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682 {#clickhouse-release-19-11-9-52-2019-09-6} + +- 改进缓存字典中的错误处理。 [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 在功能固定错误 `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) +- 修复 `JSONExtract` 功能,同时提取 `Tuple` 从JSON。 [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复后可能的数据丢失 `ALTER DELETE` 查询表跳过索引。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 固定性能测试。 [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 实木复合地板:修复读取布尔列。 [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了错误的行为 `nullIf` 常量参数的函数。 [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复kafka服务器正常重启时的消息重复问题。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([伊万](https://github.com/abyss7)) +- 修正了一个问题,当长 `ALTER UPDATE` 或 `ALTER DELETE` 可能会阻止常规合并运行。 如果没有足够的可用线程,则防止突变执行。 [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) +- 修正了处理错误 “timezone” 在服务器配置文件中。 [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复卡夫卡测试。 [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([伊万](https://github.com/abyss7)) + +#### 安全修复 {#security-fix-3} + +- 如果攻击者具有对ZooKeeper的写入访问权限,并且能够从运行ClickHouse的网络中运行可用的自定义服务器,则可以创建自定义构建的恶意服务器,该服务器将充当ClickHouse副本并将其注册到ZooKeeper中。 当另一个副本从恶意副本中获取数据部分时,它可以强制clickhouse-server写入文件系统上的任意路径。 由Yandex的信息安全团队Eldar Zaitov发现。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-8-46-2019-08-22} + +#### 错误修复 {#bug-fix-17} + +- 修复 `ALTER TABLE ... UPDATE` 查询表 `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([阿利沙平](https://github.com/alesapin)) +- 在使用IN子句时修复带有元组的子查询。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) +- 修复了一个问题,即如果一个陈旧的副本变为活动的,它可能仍然有被删除分区的数据部分。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) +- 修正了解析CSV的问题 [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) +- 修正了系统中的数据竞赛。部件表和ALTER查询。 这修复 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了可能导致内存损坏的突变中的错误代码。 修复了读取地址的段错误 `0x14c0` 这可能发生由于并发 `DROP TABLE` 和 `SELECT` 从 `system.parts` 或 `system.parts_columns`. 在准备突变查询时修复了竞争条件。 修复了由于 `OPTIMIZE` 复制的表和并发修改操作,如改变。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-7-40-2019-08-14} + +#### 错误修复 {#bug-fix-18} + +- Kafka集成已在此版本中修复。 +- 使用时修复段错误 `arrayReduce` 对于不断的参数。 [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定 `toFloat()` 单调性。 [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) +- 修复已启用的段错误 `optimize_skip_unused_shards` 还丢失了分片钥匙 [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) +- 的固定逻辑 `arrayEnumerateUniqRanked` 功能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 从MySQL处理程序中删除了额外的详细日志记录。 [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复错误的行为和可能的段错误 `topK` 和 `topKWeighted` 聚合函数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) +- 不要公开虚拟列 `system.columns` 桌子 这是向后兼容所必需的。 [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复复杂键缓存字典中字符串字段的内存分配错误。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([阿利沙平](https://github.com/alesapin)) +- 修复创建新副本时启用自适应粒度的错误 `Replicated*MergeTree` 桌子 [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([阿利沙平](https://github.com/alesapin)) +- 阅读Kafka消息时修复无限循环。 [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) +- 修复了由于SQL解析器中的堆栈溢出和堆栈溢出的可能性而导致服务器崩溃的编造查询的可能性 `Merge` 和 `Distributed` 表 [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在小序列固定大猩猩编码错误。 [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) + +#### 改进 {#improvement-5} + +- 允许用户复盖 `poll_interval` 和 `idle_connection_timeout` 连接设置。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\戮漏鹿芦,酶,虏卤赂拢,110102003042 {#clickhouse-release-19-11-5-28-2019-08-05} + +#### 错误修复 {#bug-fix-19} + +- 修复了服务器超载时挂起查询的可能性。 [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复yandexConsistentHash函数中的FPE。 这修复 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正错误的转换 `LowCardinality` 类型 `AggregateFunctionFactory`. 这修复 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复解析 `bool` 从设置 `true` 和 `false` 配置文件中的字符串。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([阿利沙平](https://github.com/alesapin)) +- 修复查询中不兼容的流头的罕见错误 `Distributed` 桌子结束 `MergeTree` 表时的一部分 `WHERE` 移动到 `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([阿利沙平](https://github.com/alesapin)) +- 在有符号类型的整数划分为无符号类型的固定溢出。 这修复 [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 向后不兼容的更改 {#backward-incompatible-change-5} + +- `Kafka` 还是坏了 + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-4-24-2019-08-01} + +#### 错误修复 {#bug-fix-20} + +- 修复编写具有自适应粒度的二级索引标记的错误。 [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([阿利沙平](https://github.com/alesapin)) +- 修复 `WITH ROLLUP` 和 `WITH CUBE` 修饰符 `GROUP BY` 具有两级聚合。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([安东\*波波夫](https://github.com/CurtizJ)) +- 固定挂起 `JSONExtractRaw` 功能。 固定 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复ExternalLoader::reloadOutdated()中的段错误。 [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复了服务器可能关闭侦听套接字但不关闭并继续提供剩余查询的情况。 您最终可能会有两个正在运行的clickhouse服务器进程。 有时,服务器可能会返回错误 `bad_function_call` 对于剩余的查询。 [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了通过ODBC,MySQL,ClickHouse和HTTP初始加载外部字典的更新字段无用和不正确的条件。 这修复 [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在固定不相关的异常转换 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn’t contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复非确定性结果 “uniq” 在极少数情况下聚合函数。 该错误存在于所有ClickHouse版本。 [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- Segfault当我们在函数上设置了一点点太高的CIDR `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 修复了服务器从许多不同上下文中抛出许多异常时的小内存泄漏。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复消费者在订阅之前暂停而之后未恢复的情况。 [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([伊万](https://github.com/abyss7))请注意,卡夫卡在这个版本中被打破。 +- 从以前的读取操作中清除Kafka数据缓冲区,并且完成了错误操作 [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([尼古拉](https://github.com/bopohaa))请注意,卡夫卡在这个版本中被打破。 +- 由于 `StorageMergeTree::background_task_handle` 在初始化 `startup()` 该 `MergeTreeBlockOutputStream::write()` 可以尝试在初始化之前使用它。 只需检查它是否被初始化。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([伊万](https://github.com/abyss7)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-6} + +- 新增官方 `rpm` 包. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([阿利沙平](https://github.com/alesapin)) +- 添加构建能力 `.rpm` 和 `.tgz` 包 `packager` 脚本 [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([阿利沙平](https://github.com/alesapin)) +- 修复了 “Arcadia” 构建系统。 [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) + +#### 向后不兼容的更改 {#backward-incompatible-change-6} + +- `Kafka` 在这个版本中被打破。 + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-3-11-2019-07-18} + +#### 新功能 {#new-feature-6} + +- 增加了对准备好的语句的支持。 [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([亚历山大](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `DoubleDelta` 和 `Gorilla` 列编解ecs [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 已添加 `os_thread_priority` 设置,允许控制 “nice” 操作系统用于调整动态调度优先级的查询处理线程的值。 它需要 `CAP_SYS_NICE` 能力的工作。 这实现了 [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 执行 `_topic`, `_offset`, `_key` kafka引擎的列 [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([伊万](https://github.com/abyss7))请注意,卡夫卡在这个版本中被打破。 +- 添加聚合函数组合 `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) +- 聚合函数 `groupArrayMovingSum(win_size)(x)` 和 `groupArrayMovingAvg(win_size)(x)`,计算移动和/平均有或没有窗口大小限制。 [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) +- 添加synonim `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) +- Intergate H3功能 `geoToH3` 从尤伯杯. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 错误修复 {#bug-fix-21} + +- 使用异步更新实现DNS缓存。 单独的线程解析所有主机并更新dns缓存(设置 `dns_cache_update_period`). 当主机的ip频繁更改时,它应该有所帮助。 [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复段错误 `Delta` 影响值小于32位大小的列的编解ec。 该错误导致随机内存损坏。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([阿利沙平](https://github.com/alesapin)) +- 修复ttl合并中的段错误与块中的非物理列。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复在检查部分罕见的错误 `LowCardinality` 列。 前情提要 `checkDataPart` 总是失败的一部分 `LowCardinality` 列。 [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([阿利沙平](https://github.com/alesapin)) +- 避免在服务器线程池已满时挂起连接。 它是从连接重要 `remote` 当连接超时时,表函数或连接到没有副本的分片。 这修复 [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 支持常量参数 `evalMLModel` 功能。 这修复 [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了ClickHouse将默认时区确定为 `UCT` 而不是 `UTC`. 这修复 [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定缓冲区下溢 `visitParamExtractRaw`. 这修复 [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 现在分发 `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` 查询将直接在leader副本上执行。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([阿利沙平](https://github.com/alesapin)) +- 修复 `coalesce` 为 `ColumnConst` 与 `ColumnNullable` +相关变化. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复 `ReadBufferFromKafkaConsumer` 所以它不断阅读新的消息后 `commit()` 即使它之前停滞不前 [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([伊万](https://github.com/abyss7)) +- 修复 `FULL` 和 `RIGHT` 加入时加入结果 `Nullable` 键在右表. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) +- 可能修复低优先级查询的无限休眠。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复争用条件,这导致某些查询可能不会出现在query\_log后 `SYSTEM FLUSH LOGS` 查询。 [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([安东\*波波夫](https://github.com/CurtizJ)) +- 固定 `heap-use-after-free` 由手表引起的ClusterCopier中的警告尝试使用已经删除的复印机对象。 [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复错误 `StringRef` 由一些实现返回的指针 `IColumn::deserializeAndInsertFromArena`. 这个错误只影响单元测试。 [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 防止源数组和中间数组连接掩蔽相同名称列的列。 [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复插入并选择查询MySQL引擎与MySQL样式标识符引用。 [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([张冬](https://github.com/zhang2014)) +- 现在 `CHECK TABLE` 查询可以与MergeTree引擎系列一起使用。 它返回检查状态和消息,如果任何为每个部分(或文件在simplier引擎的情况下)。 此外,修复获取损坏部分的错误。 [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([阿利沙平](https://github.com/alesapin)) +- 修复SPLIT\_SHARED\_LIBRARY运行时 [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) +- 固定时区初始化时 `/etc/localtime` 是一个相对的符号链接,如 `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- clickhouse复印机:修复使用-关机后免费 [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) +- 更新 `simdjson`. 修复了一些无效的零字节Json成功解析的问题。 [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复系统日志的关机 [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复当invalidate\_query中的条件取决于字典时挂起。 [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) + +#### 改进 {#improvement-6} + +- 允许群集配置中的无法解析的地址。 它们将被视为不可用,并尝试在每次连接尝试时解决。 这对Kubernetes特别有用。 这修复 [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 关闭空闲TCP连接(默认情况下为一小时超时)。 这对于每台服务器上具有多个分布式表的大型集群尤其重要,因为每台服务器都可能保留与其他服务器的连接池,并且在高峰查询并发之后,连接将停 这修复 [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 更好的质量 `topK` 功能。 如果新元素具有更大的权重,则更改了SavingSpace set行为以删除最后一个元素。 [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 与域一起使用的URL函数现在可以在没有方案的情况下适用于不完整的Url [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([阿利沙平](https://github.com/alesapin)) +- 校验和添加到 `system.parts_columns` 桌子 [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) +- 已添加 `Enum` 数据类型作为synonim `Enum8` 或 `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) +- 全位转置变种 `T64` 编解ec 可能会导致更好的压缩 `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) +- 条件 `startsWith` 函数现在可以使用主键。 这修复 [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) 和 [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) +- 允许使用 `clickhouse-copier` 通过允许空数据库名称来实现具有交叉复制的群集拓扑。 [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([纳瓦托洛梅](https://github.com/nvartolomei)) +- 使用 `UTC` 作为系统上的默认时区,而不 `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` 被打印并且服务器或客户机拒绝启动。 [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 返回对函数中浮点参数的支持 `quantileTiming` 为了向后兼容性。 [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在错误消息中显示哪个表缺少列。 [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([伊万](https://github.com/abyss7)) +- 不允许不同用户使用相同的query\_id运行查询 [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) +- 用于向Graphite发送指标的更强大的代码。 它甚至可以在长时间的多重工作 `RENAME TABLE` 操作。 [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 当ThreadPool无法计划执行任务时,将显示更多信息错误消息。 这修复 [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 反转ngramSearch更直观 [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) +- 在HDFS引擎生成器中添加用户解析 [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) +- 更新默认值 `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) +- 增加了过时设置的概念。 过时的设置 `allow_experimental_low_cardinality_type` 可以没有效果使用。 [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) + +#### 性能改进 {#performance-improvement-4} + +- 增加从合并表中选择的流数量,以便更均匀地分布线程。 添加设置 `max_streams_multiplier_for_merge_tables`. 这修复 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-7} + +- 为与不同版本的clickhouse的客户端-服务器交互添加向后兼容性测试。 [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([阿利沙平](https://github.com/alesapin)) +- 每个提交和拉取请求中的测试复盖率信息。 [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([阿利沙平](https://github.com/alesapin)) +- 与address sanitizer合作,支持我们的自定义分alloc (`Arena` 和 `ArenaWithFreeLists`)为了更好地调试 “use-after-free” 错误。 [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) +- 切换到 [LLVM libunwind实现](https://github.com/llvm-mirror/libunwind) 用于C++异常处理和堆栈跟踪打印 [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([尼基塔\*拉普科夫](https://github.com/laplab)) +- 添加来自-Weverything的两个警告 [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 允许用内存消毒剂建立ClickHouse。 [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 关于固定的ubsan报告 `bitTest` 在模糊测试功能。 [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- Docker:增加了初始化需要身份验证的ClickHouse实例的可能性。 [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([科尔维亚科夫\*安德烈](https://github.com/shurshun)) +- 将librdkafka更新到版本1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([伊万](https://github.com/abyss7)) +- 为集成测试添加全局超时,并在测试代码中禁用其中一些。 [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([阿利沙平](https://github.com/alesapin)) +- 修复一些ThreadSanitizer故障。 [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) +- 该 `--no-undefined` 选项强制链接器在链接时检查所有外部名称是否存在。 在拆分构建模式下跟踪库之间的真实依赖关系非常有用。 [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([伊万](https://github.com/abyss7)) +- 增加了性能测试 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 与gcc-7固定兼容性。 [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了对gcc-9的支持。 这修复 [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了libunwind链接不正确时的错误。 [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了PVS-Studio发现的一些警告。 [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了初始支持 `clang-tidy` 静态分析仪。 [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 转换BSD/Linux endian宏( ‘be64toh’ 和 ‘htobe64’)到Mac OS x当量 [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([傅辰](https://github.com/fredchenbj)) +- 改进的集成测试指南. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 在macosx+gcc9修复构建 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) +- 修复难以识别的错字:aggreAGte-\>aggregate。 [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) +- 修复freebsd构建 [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) +- 添加链接到实验YouTube频道的网站 [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([伊万\*布林科夫](https://github.com/blinkov)) +- CMake:为复盖率标志添加选项:WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) +- 修复一些内联PODArray的初始大小。 [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) +- clickhouse服务器.postinst:修复centos6的操作系统检测 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) +- 添加Arch linux软件包生成。 [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) +- 拆分常见/配置.h by libs(dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) +- 修复了 “Arcadia” 构建平台 [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) +- 修复了非常规构建(gcc9,没有子模块) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) +- 在unalignedStore中需要显式类型,因为它被证明容易出现错误 [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) +- 修复MacOS构建 [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) +- 关于具有更大数据集的新JIT功能的性能测试,请参阅此处 [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 在压力测试中运行有状态测试 [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([阿利沙平](https://github.com/alesapin)) + +#### 向后不兼容的更改 {#backward-incompatible-change-7} + +- `Kafka` 在这个版本中被打破。 +- 启用 `adaptive_index_granularity` =10mb默认为新 `MergeTree` 桌子 如果您在19.11+版本上创建了新的MergeTree表,则不可能降级到19.6之前的版本。 [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([阿利沙平](https://github.com/alesapin)) +- 删除了Yandex使用的过时无证嵌入式字典。梅特里卡 功能 `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` 不再可用。 如果您正在使用这些功能,请写电子邮件至clickhouse-feedback@yandex-team.com注:在最后时刻,我们决定保持这些功能一段时间。 [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +## ClickHouse释放19.10 {#clickhouse-release-19-10} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-10-1-5-2019-07-12} + +#### 新功能 {#new-feature-7} + +- 添加新列编解ec: `T64`. 为(U)IntX/EnumX/Data(时间)/DecimalX列制作。 它应该适用于具有常量或小范围值的列。 编解码器本身允许放大或缩小数据类型而无需重新压缩。 [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) +- 添加数据库引擎 `MySQL` 允许查看远程MySQL服务器中的所有表 [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([张冬](https://github.com/zhang2014)) +- `bitmapContains` 执行。 这是2倍的速度比 `bitmapHasAny` 如果第二个位图包含一个元素。 [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([余志昌](https://github.com/yuzhichang)) +- 支持 `crc32` 功能(与MySQL或PHP中的行为完全相同)。 如果您需要散列函数,请不要使用它。 [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) +- 已实施 `SYSTEM START/STOP DISTRIBUTED SENDS` 查询控制异步插入到 `Distributed` 桌子 [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([张冬](https://github.com/zhang2014)) + +#### 错误修复 {#bug-fix-22} + +- 在执行突变时忽略查询执行限制和合并限制的最大部件大小。 [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复可能导致重复数据删除正常块(极其罕见)和插入重复块(更常见)的错误。 [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([阿利沙平](https://github.com/alesapin)) +- 功能修复 `arrayEnumerateUniqRanked` 对于具有空数组的参数 [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) +- 不要在没有轮询任何消息的情况下订阅Kafka主题。 [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([伊万](https://github.com/abyss7)) +- 使设置 `join_use_nulls` 对于不能在Nullable内的类型不起作用 [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) +- 固定 `Incorrect size of index granularity` 错误 [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) +- 修正浮动到十进制转换溢出 [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) +- 冲洗缓冲区时 `WriteBufferFromHDFS`的析构函数被调用。 这修复了写入 `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([新东鹏](https://github.com/eejoin)) + +#### 改进 {#improvement-7} + +- 对待空单元格 `CSV` 作为默认值时的设置 `input_format_defaults_for_omitted_fields` 被启用。 [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) +- 外部字典的非阻塞加载。 [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 可以根据设置动态更改已建立的连接的网络超时。 [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) +- 使用 “public\_suffix\_list” 对于功能 `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. 它使用一个完美的哈希表生成 `gperf` 从文件生成的列表:https://publicsuffix.org/list/public\_suffix\_list.dat(例如,现在我们认识到域 `ac.uk` 作为非显着)。 [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 通过 `IPv6` 系统表中的数据类型;统一客户端信息列 `system.processes` 和 `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 使用会话与MySQL兼容性协议的连接。 \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 支持更多 `ALTER` 查询 `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) +- 碌莽禄Support: `` 第1节 `clickhouse-local` 配置文件。 [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) +- 允许运行查询 `remote` 表函数 `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) + +#### 性能改进 {#performance-improvement-5} + +- 添加在MergeTree列末尾写最后标记的可能性。 它允许避免对超出表数据范围的键进行无用的读取。 仅当使用自适应索引粒度时才启用此功能。 [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([阿利沙平](https://github.com/alesapin)) +- 通过减少非常慢的文件系统上的MergeTree表的性能 `stat` syscalls [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了从版本19.6中引入的MergeTree表读取时的性能下降。 修复#5631。 [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-8} + +- 已实施 `TestKeeper` 作为用于测试的ZooKeeper接口的实现 [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) +- 从现在起 `.sql` 测试可以通过服务器隔离,并行运行,并使用随机数据库。 它允许更快地运行它们,使用自定义服务器配置添加新的测试,并确保不同的测试不会相互影响。 [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([伊万](https://github.com/abyss7)) +- 删除 `` 和 `` 从性能测试 [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) +- 固定 “select\_format” 性能测试 `Pretty` 格式 [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +## ClickHouse释放19.9 {#clickhouse-release-19-9} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-9-3-31-2019-07-05} + +#### 错误修复 {#bug-fix-23} + +- 修复增量编解码器中的段错误,这会影响值小于32位大小的列。 该错误导致随机内存损坏。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([阿利沙平](https://github.com/alesapin)) +- 修复在检查部分低心率列中罕见的错误。 [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([阿利沙平](https://github.com/alesapin)) +- 修复ttl合并中的段错误与块中的非物理列。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复低优先级查询的潜在无限休眠。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复ClickHouse如何将默认时区确定为UCT而不是UTC。 [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复在领导者副本之前的跟随者副本上执行分布式删除/更改/截断/优化集群查询的错误。 现在他们将直接在领导者副本上执行。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([阿利沙平](https://github.com/alesapin)) +- 修复了系统刷新日志查询后某些查询可能不会立即出现在query\_log中的竞争条件。 [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([安东\*波波夫](https://github.com/CurtizJ)) +- 增加了对常量参数的缺失支持 `evalMLModel` 功能。 [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-9-2-4-2019-06-24} + +#### 新功能 {#new-feature-8} + +- 打印有关冷冻部件的信息 `system.parts` 桌子 [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) +- 在clickhouse上询问客户端密码-如果未在参数中设置,则在tty上启动客户端 [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) +- 执行 `dictGet` 和 `dictGetOrDefault` 十进制类型的函数。 [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 改进 {#improvement-8} + +- Debian的初始化:添加服务停止超时 [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) +- 默认情况下添加禁止设置,以创建具有可疑类型的表格 [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) +- 当不用作函数中的状态时,回归函数返回模型权重 `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) +- 重命名和改进回归方法。 [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) +- 更清晰的字符串搜索界面。 [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) + +#### 错误修复 {#bug-fix-24} + +- 修复Kafka中潜在的数据丢失 [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([伊万](https://github.com/abyss7)) +- 修复潜在的无限循环 `PrettySpace` 使用零列调用时的格式 [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) +- 修正了线性模型中的UInt32溢出错误。 允许对非常量模型参数的eval ML模型。 [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- `ALTER TABLE ... DROP INDEX IF EXISTS ...` 如果提供的索引不存在,则不应引发异常 [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) +- 修复段错误 `bitmapHasAny` 在标量子查询中 [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([余志昌](https://github.com/yuzhichang)) +- 修复了复制连接池不重试解析主机时的错误,即使删除了DNS缓存。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([阿利沙平](https://github.com/alesapin)) +- 固定 `ALTER ... MODIFY TTL` 在ReplicatedMergeTree上。 [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([安东\*波波夫](https://github.com/CurtizJ)) +- 修复插入到具体化列的分布式表中 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) +- 修复截断联接存储时的错误alloc [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) +- 在最近版本的包tzdata中,现在有些文件是符号链接。 当前用于检测默认时区的机制被打破,并为某些时区提供错误的名称。 现在至少我们强制时区名称到TZ的内容,如果提供。 [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([伊万](https://github.com/abyss7)) +- 修复一些极为罕见的情况下,MultiVolnitsky搜索器时,在总和恒定针至少16KB长。 该算法错过或复盖以前的结果,这可能导致错误的结果 `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) +- 修复ExternalData请求的设置无法使用ClickHouse设置时的问题。 此外,现在,设置 `date_time_input_format` 和 `low_cardinality_allow_in_native_format` 由于名称的歧义,无法使用(在外部数据中,它可以解释为表格式,在查询中它可以是一个设置)。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) +- 修复只从FS中删除部件而不从Zookeeper中删除部件时的错误。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([阿利沙平](https://github.com/alesapin)) +- 从MySQL协议中删除调试日志记录 [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在DDL查询处理过程中跳过ZNONODE [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- 修复混合 `UNION ALL` 结果列类型。 有些情况下,结果列的数据和列类型不一致。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- 在错误的整数上抛出异常 `dictGetT` 功能,而不是崩溃。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复散列字典中错误的element\_count和load\_factor `system.dictionaries` 桌子 [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-9} + +- 固定构建没有 `Brotli` HTTP压缩支持 (`ENABLE_BROTLI=OFF` cmake变量)。 [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) +- 包括ro哮。h为ro哮/咆哮。h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Origej Desh](https://github.com/orivej)) +- 修复超扫描中的gcc9警告(#行指令是邪恶的!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) +- 使用gcc-9编译时修复所有警告。 修复一些contrib问题。 修复gcc9ICE并将其提交给bugzilla。 [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) +- 与lld固定链接 [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 删除字典中未使用的专业化 [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) +- 针对不同类型的文件进行格式化和解析表的改进性能测试 [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) +- 修复并行测试运行 [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) +- Docker:使用clickhouse-test中的configs [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) +- 修复编译为FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) +- 升级提升到1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) +- 修复构建clickhouse作为子模块 [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) +- 改进JSONExtract性能测试 [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) + +## ClickHouse释放19.8 {#clickhouse-release-19-8} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-8-3-8-2019-06-11} + +#### 新功能 {#new-features} + +- 添加了与JSON一起使用的函数 [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 添加一个函数basename,具有类似于basename函数的行为,它存在于许多语言中 (`os.path.basename` 在python中, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 已添加 `LIMIT n, m BY` 或 `LIMIT m OFFSET n BY` 为LIMIT BY子句设置n偏移量的语法。 [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([安东\*波波夫](https://github.com/CurtizJ)) +- 增加了新的数据类型 `SimpleAggregateFunction`,它允许在一个具有光聚集的列 `AggregatingMergeTree`. 这只能用于简单的功能,如 `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) +- 增加了对函数中非常量参数的支持 `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) +- 新增功能 `skewPop`, `skewSamp`, `kurtPop` 和 `kurtSamp` 分别计算序列偏度、样本偏度、峰度和样本峰度。 [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) +- 支持重命名操作 `MaterializeView` 存储。 [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 添加了允许使用MySQL客户端连接到ClickHouse的服务器。 [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 添加 `toDecimal*OrZero` 和 `toDecimal*OrNull` 功能。 [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) +- 支持函数中的十进制类型: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted` 媒体加权。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) +- 已添加 `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) +- 已添加 `format` 功能。 使用参数中列出的字符串格式化常量模式(简化的Python格式模式)。 [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) +- 已添加 `system.detached_parts` 表包含有关分离部分的信息 `MergeTree` 桌子 [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) +- 已添加 `ngramSearch` 函数来计算针和大海捞针之间的非对称差异。 [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) +- 使用聚合函数接口实现基本的机器学习方法(随机线性回归和逻辑回归)。 有不同的策略,用于更新模型权重(简单梯度下降,动量法,涅斯捷罗夫法)。 还支持自定义大小的小批次。 [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) +- 执行 `geohashEncode` 和 `geohashDecode` 功能。 [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 添加聚合功能 `timeSeriesGroupSum`,从而可以聚合不同的时间序列,即采样时间戳不对齐。 它将在两个采样时间戳之间使用线性插值,然后将时间序列和在一起。 添加聚合功能 `timeSeriesGroupRateSum`,它计算时间序列的速率,然后将速率总和在一起。 [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([刘杨宽](https://github.com/LiuYangkuan)) +- 新增功能 `IPv4CIDRtoIPv4Range` 和 `IPv6CIDRtoIPv6Range` 使用CIDR计算子网中IP的下限和上限。 [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) +- 添加一个X-ClickHouse-Summary头,当我们发送查询使用HTTP启用设置 `send_progress_in_http_headers`. 返回X-ClickHouse-Progress的常用信息,以及其他信息,例如在查询中插入了多少行和字节。 [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) + +#### 改进 {#improvements} + +- 已添加 `max_parts_in_total` 设置表的MergeTree家族(默认:100 000)防止分区键的不安全规范\#5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `clickhouse-obfuscator`:通过将初始种子与列名(而不是列位置)组合来派生单个列的种子。 这用于转换具有多个相关表的数据集,以便在转换后表将保持可联接。 [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 新增功能 `JSONExtractRaw`, `JSONExtractKeyAndValues`. 重命名函数 `jsonExtract` 到 `JSONExtract`. 当出现问题时,这些函数返回对应的值,而不是 `NULL`. 修改功能 `JSONExtract`,现在它从最后一个参数中获取返回类型,并且不会注入nullables。 在AVX2指令不可用的情况下实现了回退到RapidJSON。 Simdjson库更新到新版本。 [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 现在 `if` 和 `multiIf` 功能不依赖于条件的 `Nullable`,但依靠分支来实现sql兼容性。 [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([吴健](https://github.com/janplus)) +- `In` 谓词现在生成 `Null` 结果来自 `Null` 输入像 `Equal` 功能。 [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([吴健](https://github.com/janplus)) +- 检查来自Kafka的每个(flush\_interval/poll\_timeout)行数的时间限制。 这允许更频繁地中断Kafka consumer的读取,并检查顶级流的时间限制 [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([伊万](https://github.com/abyss7)) +- 链接rdkafka捆绑的SASL。 它应该允许使用SASL SCRAM身份验证 [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([伊万](https://github.com/abyss7)) +- 所有联接的RowRefList的批处理版本。 [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) +- clickhouse服务器:更多信息侦听错误消息。 [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) +- 在clickhouse-复印机的功能支持字典 `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) +- 添加新设置 `kafka_commit_every_batch` 来规范卡夫卡的承诺政策。 + 它允许设置提交模式:在处理每批消息之后,或者在整个块写入存储之后。 这是在某些极端情况下丢失一些消息或阅读两次之间的权衡。 [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([伊万](https://github.com/abyss7)) +- 赂眉露\>\> `windowFunnel` 支持其他无符号整数类型。 [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) +- 允许对虚拟列进行阴影 `_table` 在合并引擎。 [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([伊万](https://github.com/abyss7)) +- 赂眉露\>\> `sequenceMatch` 聚合函数支持其他无符号整数类型 [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) +- 如果校验和不匹配很可能是由硬件故障引起的,则更好的错误消息。 [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 检查基础表是否支持以下内容的采样 `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([伊万](https://github.com/abyss7)) +- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) +- MySQL线协议的改进。 将格式名称更改为MySQLWire。 使用RAII调用RSA\_free。 如果无法创建上下文,则禁用SSL。 [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) +- 尊重异步插入到分布式表中的查询设置。 [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) +- 重命名函数 `leastSqr` 到 `simpleLinearRegression`, `LinearRegression` 到 `linearRegression`, `LogisticRegression` 到 `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) + +#### 性能改进 {#performance-improvements} + +- 在ALTER MODIFY查询中并行处理非复制MergeTree表的部分。 [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([伊万库什](https://github.com/IvanKush)) +- Regular达式提取中的优化。 [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) +- 如果仅在join on部分中使用,则不要将右连接键列添加到join result。 [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) +- 在第一个空响应之后冻结Kafka缓冲区。 它避免了多次调用 `ReadBuffer::next()` 对于一些行解析流的空结果。 [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([伊万](https://github.com/abyss7)) +- `concat` 多个参数的函数优化。 [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) +- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) +- 使用reference one升级我们的LZ4实现以获得更快的解压缩。 [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) +- 实现了MSD基数排序(基于kxsort)和部分排序。 [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) + +#### 错误修复 {#bug-fixes} + +- 修复推送需要列与联接 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([张冬](https://github.com/zhang2014)) +- 修正了当ClickHouse由systemd运行时,命令 `sudo service clickhouse-server forcerestart` 没有按预期工作。 [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) +- 修复DataPartsExchange中的http错误代码(9009端口上的服务器间http服务器始终返回代码200,即使是错误)。 [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) +- 修复SimpleAggregateFunction字符串长于MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) +- 修复错误 `Decimal` 到 `Nullable(Decimal)` 转换中。 支持其他十进制到十进制转换(包括不同的比例)。 [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正了simdjson库中导致错误计算的FPU clobbering `uniqHLL` 和 `uniqCombined` 聚合函数和数学函数,如 `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定处理JSON函数中的混合常量/非常量情况。 [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复 `retention` 功能。 现在所有满足一行数据的条件都被添加到数据状态。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) +- 修复结果类型 `quantileExact` 用小数。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 文件 {#documentation} + +- 翻译文档 `CollapsingMergeTree` 到中国。 [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) +- 将一些关于表格引擎的文档翻译成中文。 + [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) + [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) + ([永远不会李](https://github.com/neverlee)) + +#### 构建/测试/打包改进 {#buildtestingpackaging-improvements} + +- 修复一些显示可能使用后免费的消毒剂报告。[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([伊万](https://github.com/abyss7)) +- 为了方便起见,将性能测试从单独的目录中移出。 [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复不正确的性能测试。 [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([阿利沙平](https://github.com/alesapin)) +- 增加了一个工具来计算由位翻转引起的校验和,以调试硬件问题。 [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 使亚军脚本更有用。 [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) +- 添加如何编写性能测试的小指令。 [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([阿利沙平](https://github.com/alesapin)) +- 添加在性能测试中创建,填写和删除查询中进行替换的功能 [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) + +## ClickHouse释放19.7 {#clickhouse-release-19-7} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-7-5-29-2019-07-05} + +#### 错误修复 {#bug-fix-25} + +- 使用JOIN修复某些查询中的性能回归。 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([张冬](https://github.com/zhang2014)) + +### 碌莽禄,拢,010-68520682\戮漏鹿芦,酶,虏卤赂拢,110102003042 {#clickhouse-release-19-7-5-27-2019-06-09} + +#### 新功能 {#new-features-1} + +- 添加位图相关功能 `bitmapHasAny` 和 `bitmapHasAll` 类似于 `hasAny` 和 `hasAll` 数组的函数。 [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([塞尔吉\*弗拉季金](https://github.com/svladykin)) + +#### 错误修复 {#bug-fixes-1} + +- 修复段错误 `minmax` 具有空值的索引。 [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 根据需要输出标记“LIMIT BY”中的所有输入列。 它修复 ‘Not found column’ 某些分布式查询中出错。 [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([康斯坦丁\*潘](https://github.com/kvap)) +- 修复 “Column ‘0’ already exists” 错误 `SELECT .. PREWHERE` 在具有默认值的列上 [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) +- 修复 `ALTER MODIFY TTL` 查询开 `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([安东\*波波夫](https://github.com/CurtizJ)) +- 当Kafka消费者无法启动时,不要使服务器崩溃。 [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([伊万](https://github.com/abyss7)) +- 固定位图函数产生错误的结果。 [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([杨小姐](https://github.com/andyyzh)) +- 修复散列字典的element\_count(不包括重复项) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) +- 使用环境变量TZ的内容作为时区的名称。 在某些情况下,它有助于正确检测默认时区。[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([伊万](https://github.com/abyss7)) +- 不要试图将整数转换为 `dictGetT` 功能,因为它不能正常工作。 而是抛出一个异常。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) +- 在ExternalData HTTP请求修复设置。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila + 库特宁](https://github.com/danlark1)) +- 修复只从FS中删除部件而不从Zookeeper中删除部件时的错误。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([阿利沙平](https://github.com/alesapin)) +- 修复分段故障 `bitmapHasAny` 功能。 [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([余志昌](https://github.com/yuzhichang)) +- 修复了复制连接池不重试解析主机时的错误,即使删除了DNS缓存。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([阿利沙平](https://github.com/alesapin)) +- 固定 `DROP INDEX IF EXISTS` 查询。 现在 `ALTER TABLE ... DROP INDEX IF EXISTS ...` 如果提供的索引不存在,查询不会引发异常。 [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) +- 修复联合所有超类型列。 有些情况下,结果列的数据和列类型不一致。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) +- 在DDL查询处理过程中跳过ZNONODE。 之前,如果另一个节点删除znode在任务队列中,那一个 + 没有处理它,但已经得到子列表,将终止DDLWorker线程。 [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) +- 修复插入到具体化列的分布式()表中。 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-7-3-9-2019-05-30} + +#### 新功能 {#new-features-2} + +- 允许限制用户可以指定的设置的范围。 + 这些约束可以在用户设置配置文件中设置。 + [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([维塔利 + 巴拉诺夫](https://github.com/vitlibar)) +- 添加该函数的第二个版本 `groupUniqArray` 用一个可选的 + `max_size` 限制结果数组大小的参数。 这 + 行为类似于 `groupArray(max_size)(x)` 功能。 + [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([纪尧姆 + Tassery](https://github.com/YiuRULE)) +- 对于TSVWithNames/CSVWithNames输入文件格式,列顺序现在可以是 + 从文件头确定。 这是由控制 + `input_format_with_names_use_header` 参数。 + [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) + ([亚历山大](https://github.com/Akazz)) + +#### 错误修复 {#bug-fixes-2} + +- 在合并过程中uncompressed\_cache+JOIN崩溃(#5197) + [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila + 库特宁](https://github.com/danlark1)) +- Clickhouse客户端查询到系统表上的分段错误。 \#5066 + [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) + ([伊万](https://github.com/abyss7)) +- 通过KafkaEngine重负载数据丢失(#4736) + [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) + ([伊万](https://github.com/abyss7)) +- 修复了在执行UNION查询时可能发生的非常罕见的数据争用条件,所有查询都涉及至少两个来自系统的选择。列,系统。表,系统。部件,系统。parts\_tables或Merge系列的表,并同时执行相关表的列的更改。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 性能改进 {#performance-improvements-1} + +- 使用基数排序按单个数字列进行排序 `ORDER BY` 没有 + `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), + [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) + ([Evgenii Pravda](https://github.com/kvinty), + [阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 文件 {#documentation-1} + +- 将某些表格引擎的文档翻译为中文。 + [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), + [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), + [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) + ([张风啸](https://github.com/AlexZFX)), + [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([从来没有 + 李](https://github.com/neverlee)) + +#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-1} + +- 正确打印UTF-8字符 `clickhouse-test`. + [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) + ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 为clickhouse-client添加命令行参数以始终加载建议 + 戴达 [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) + ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 解决一些PVS-Studio警告。 + [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) + ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 更新LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila + 库特宁](https://github.com/danlark1)) +- 添加gperf以构建即将到来的拉取请求#5030的requirements。 + [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) + ([proller](https://github.com/proller)) + +## ClickHouse释放19.6 {#clickhouse-release-19-6} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-6-3-18-2019-06-13} + +#### 错误修复 {#bug-fixes-3} + +- 修复了来自表函数的查询的条件下推 `mysql` 和 `odbc` 和相应的表引擎。 这修复了#3540和#2384。 [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复动物园管理员的死锁。 [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) +- 允许在CSV中引用小数。 [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) +- 禁止从float Inf/NaN转换为小数(抛出异常)。 [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复重命名查询中的数据竞赛。 [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([张冬](https://github.com/zhang2014)) +- 暂时禁用LFAlloc。 使用LFAlloc可能会导致大量MAP\_FAILED在分配UncompressedCache时,并导致高负载服务器上的查询崩溃。 [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-6-2-11-2019-05-13} + +#### 新功能 {#new-features-3} + +- 列和表的TTL表达式。 [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([安东\*波波夫](https://github.com/CurtizJ)) +- 增加了对 `brotli` http响应的压缩(接受编码:br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([米哈伊尔](https://github.com/fandyushin)) +- 增加了新功能 `isValidUTF8` 用于检查一组字节是否被正确地utf-8编码。 [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) +- 添加新的负载平衡策略 `first_or_random` 它将查询发送到第一个指定的主机,如果无法访问,则向分片的随机主机发送查询。 对于跨复制拓扑设置非常有用。 [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([纳瓦托洛梅](https://github.com/nvartolomei)) + +#### 实验特点 {#experimental-features-1} + +- 添加设置 `index_granularity_bytes` (自适应索引粒度)对于MergeTree\*表族. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([阿利沙平](https://github.com/alesapin)) + +#### 改进 {#improvements-1} + +- 增加了对函数的非常量和负大小和长度参数的支持 `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在左联接中禁用向下推到右表,在右联接中禁用左表,并在完全联接中禁用两个表。 在某些情况下,这可以修复错误的连接结果。 [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([伊万](https://github.com/abyss7)) +- `clickhouse-copier`:从自动上传任务配置 `--task-file` 备选案文 [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) +- 为存储工厂和表函数工厂添加了错别字处理程序。 [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) +- 支持不带子查询的多个联接的星号和限定星号 [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) +- 使缺少列错误消息更加用户友好。 [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 性能改进 {#performance-improvements-2} + +- ASOF加速显着 [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) + +#### 向后不兼容的更改 {#backward-incompatible-changes} + +- HTTP头 `Query-Id` 改名为 `X-ClickHouse-Query-Id` 为了一致性。 [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([米哈伊尔](https://github.com/fandyushin)) + +#### 错误修复 {#bug-fixes-4} + +- 修正了潜在的空指针取消引用 `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) +- 修复了使用JOIN+ARRAY JOIN查询的错误 [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) +- 固定挂在服务器的启动时,字典依赖于另一个字典通过引擎数据库=字典。 [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- Partially fix distributed\_product\_mode = local. It’s possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There’s not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复潜在的错误结果 `SELECT DISTINCT` 与 `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复了在执行UNION查询时可能发生的非常罕见的数据争用条件,所有查询都涉及至少两个来自系统的选择。列,系统。表,系统。部件,系统。parts\_tables或Merge系列的表,并同时执行相关表的列的更改。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-2} + +- 在不同的主机上运行clickhouse服务器时修复测试失败 [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- clickhouse-test:在非tty环境中禁用颜色控制序列。 [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([阿利沙平](https://github.com/alesapin)) +- clickhouse-test:允许使用任何测试数据库(删除 `test.` 在可能的情况下获得资格) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) +- 修复ubsan错误 [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- Yandex LFAlloc被添加到ClickHouse中,以不同的方式分配MarkCache和UncompressedCache数据,以更可靠地捕获段错误 [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) +- Python util帮助反向移植和更改日志。 [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([伊万](https://github.com/abyss7)) + +## ClickHouse释放19.5 {#clickhouse-release-19-5} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-5-4-22-2019-05-13} + +#### 错误修复 {#bug-fixes-5} + +- 修正了位图\*功能中可能出现的崩溃 [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([杨小姐](https://github.com/andyyzh)) +- 修复了在执行UNION查询时可能发生的非常罕见的数据争用条件,所有查询都涉及至少两个来自系统的选择。列,系统。表,系统。部件,系统。parts\_tables或Merge系列的表,并同时执行相关表的列的更改。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正错误 `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. 如果lowcardinality列是主键的一部分,则会发生此错误。 \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修改保留函数:如果一行同时满足第一个和第N个条件,则只有第一个满足的条件被添加到数据状态。 现在所有满足一行数据的条件都被添加到数据状态。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-5-3-8-2019-04-18} + +#### 错误修复 {#bug-fixes-6} + +- 固定设置类型 `max_partitions_per_insert_block` 从布尔到UInt64。 [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([2.Mohammad Hossein Sekhavat](https://github.com/mhsekhavat)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-5-2-6-2019-04-15} + +#### 新功能 {#new-features-4} + +- [超扫描](https://github.com/intel/hyperscan) 添加了多个正则表达式匹配(函数 `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) +- `multiSearchFirstPosition` 添加了功能。 [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) +- 为表实现每行的预定义表达式筛选器。 [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([伊万](https://github.com/abyss7)) +- 一种基于bloom过滤器的新型数据跳过索引(可用于 `equal`, `in` 和 `like` 功能)。 [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 已添加 `ASOF JOIN` 它允许运行连接到最新已知值的查询。 [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) +- 重写多个 `COMMA JOIN` 到 `CROSS JOIN`. 然后将它们重写为 `INNER JOIN` 如果可能的话 [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 改进 {#improvement-9} + +- `topK` 和 `topKWeighted` 现在支持自定义 `loadFactor` (修复问题 [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([基里尔丹信](https://github.com/kirillDanshin)) +- 允许使用 `parallel_replicas_count > 1` 即使对于没有采样的表(设置简单地忽略它们)。 在以前的版本中,它导致异常。 [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) +- 支持 `CREATE OR REPLACE VIEW`. 允许在单个语句中创建视图或设置新定义。 [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) +- `Buffer` 表引擎现在支持 `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([刘杨宽](https://github.com/LiuYangkuan)) +- 添加在zookeeper中启动没有元数据的复制表的能力 `readonly` 模式 [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([阿利沙平](https://github.com/alesapin)) +- 在clickhouse客户端固定进度条闪烁。 使用时,这个问题最明显 `FORMAT Null` 随着流查询。 [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 允许禁用功能 `hyperscan` 基于每个用户的库,以限制潜在的过度和不受控制的资源使用。 [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加版本号记录所有错误。 [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) +- 增加了限制 `multiMatch` 需要字符串大小以适应的函数 `unsigned int`. 还增加了参数的数量限制 `multiSearch` 功能。 [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) +- 改进了超扫描暂存空间的使用和错误处理。 [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) +- 填充 `system.graphite_detentions` 从表配置 `*GraphiteMergeTree` 发动机表. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- 重命名 `trigramDistance` 功能 `ngramDistance` 并添加更多的功能 `CaseInsensitive` 和 `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) +- 改进的数据跳过指数计算。 [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 保持平凡, `DEFAULT`, `MATERIALIZED` 和 `ALIAS` 在一个列表中的列(修复问题 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +#### 错误修复 {#bug-fix-26} + +- 避免 `std::terminate` 在内存分配失败的情况下。 现在 `std::bad_alloc` 按预期引发异常。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复capnproto从缓冲区读取。 有时文件没有通过HTTP成功加载。 [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([弗拉季斯拉夫](https://github.com/smirnov-vs)) +- 修复错误 `Unknown log entry type: 0` 后 `OPTIMIZE TABLE FINAL` 查询。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([阿莫斯鸟](https://github.com/amosbird)) +- 错误的参数 `hasAny` 或 `hasAll` 函数可能会导致段错误。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 执行时可能会发生死锁 `DROP DATABASE dictionary` 查询。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复未定义的行为 `median` 和 `quantile` 功能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- 修复压缩级别检测时 `network_compression_method` 小写。 在19.1节中被打破。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- 固定的无知 `UTC` 设置(修复问题 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- 修复 `histogram` 函数行为 `Distributed` 桌子 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- 固定tsan报告 `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了由于系统日志使用中的争用条件而关闭的TSan报告。 修复了当part\_log启用时关机后的潜在使用。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复重新检查零件 `ReplicatedMergeTreeAlterThread` 在错误的情况下。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 对中间聚合函数状态的算术运算不适用于常量参数(如子查询结果)。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 始终在元数据中反引用列名。 否则,不可能创建一个名为列的表 `index` (由于格式错误,服务器无法重新启动 `ATTACH` 元数据中的查询)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复崩溃 `ALTER ... MODIFY ORDER BY` 上 `Distributed` 桌子 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- 修复段错误 `JOIN ON` 已启用 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([张冬](https://github.com/zhang2014)) +- 修复kafka使用protobuf消息后添加无关行的错误。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复崩溃 `JOIN` 在不可为空的vs可为空的列上。 修复 `NULLs` 在右键 `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- 在固定的竞争条件 `SELECT` 从 `system.tables` 如果同时重命名或更改表。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 获取已经过时的数据部分时修复了数据竞赛。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定罕见的数据竞赛,可以在发生 `RENAME` MergeTree家族的表. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正功能中的分段故障 `arrayIntersect`. 如果函数使用常量和普通参数混合调用,则可能会发生分段错误。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([钱丽祥](https://github.com/fancyqlx)) +- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复崩溃 `FULL/RIGHT JOIN` 当我们加入可为空vs不可为空时。 [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复 `No message received` 在副本之间获取部件时出现异常。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([阿利沙平](https://github.com/alesapin)) +- 固定 `arrayIntersect` 函数错误导致在单个数组中的几个重复值的情况下。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 在并发期间修复争用条件 `ALTER COLUMN` 可能导致服务器崩溃的查询(修复问题 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修复不正确的结果 `FULL/RIGHT JOIN` 与常量列。 [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复重复 `GLOBAL JOIN` 用星号。 [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复参数扣除 `ALTER MODIFY` 列 `CODEC` 未指定列类型时。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([阿利沙平](https://github.com/alesapin)) +- 功能 `cutQueryStringAndFragment()` 和 `queryStringAndFragment()` 现在正常工作时 `URL` 包含一个片段,没有查询。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复设置时罕见的错误 `min_bytes_to_use_direct_io` 大于零,这发生在线程必须在列文件中向后寻找时。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([阿利沙平](https://github.com/alesapin)) +- 修复聚合函数的错误参数类型 `LowCardinality` 参数(修复问题 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复错误的名称资格 `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复功能 `toISOWeek` 1970年的结果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复 `DROP`, `TRUNCATE` 和 `OPTIMIZE` 查询重复,在执行时 `ON CLUSTER` 为 `ReplicatedMergeTree*` 表家庭. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([阿利沙平](https://github.com/alesapin)) + +#### 向后不兼容的更改 {#backward-incompatible-change-8} + +- 重命名设置 `insert_sample_with_metadata` 到设置 `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) +- 添加设置 `max_partitions_per_insert_block` (默认值为100)。 如果插入的块包含较大数量的分区,则会引发异常。 如果要删除限制(不推荐),请将其设置为0。 [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 多搜索功能被重命名 (`multiPosition` 到 `multiSearchAllPositions`, `multiSearch` 到 `multiSearchAny`, `firstMatch` 到 `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) + +#### 性能改进 {#performance-improvement-6} + +- 通过内联优化Volnitsky搜索器,为许多针或许多类似bigrams的查询提供约5-10%的搜索改进。 [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) +- 修复设置时的性能问题 `use_uncompressed_cache` 大于零时,即出现在所有读取缓存中包含的数据时。 [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([阿利沙平](https://github.com/alesapin)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-10} + +- 强化调试构建:更精细的内存映射和ASLR;为标记缓存和索引添加内存保护。 这允许在ASan和MSan无法做到这一点的情况下找到更多的内存st脚错误。 [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加对cmake变量的支持 `ENABLE_PROTOBUF`, `ENABLE_PARQUET` 和 `ENABLE_BROTLI` 它允许启用/禁用上述功能(与我们对librdkafka,mysql等所做的相同)。 [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) +- 添加打印进程列表和堆栈跟踪的所有线程的能力,如果一些查询测试运行后挂起。 [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([阿利沙平](https://github.com/alesapin)) +- 添加重试 `Connection loss` 错误 `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([阿利沙平](https://github.com/alesapin)) +- 在打包程序脚本中添加使用vagrant的freebsd build和使用thread sanitizer的build。 [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([阿利沙平](https://github.com/alesapin)) +- 现在用户要求用户密码 `'default'` 在安装过程中。 [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) +- 禁止在警告 `rdkafka` 图书馆. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 允许在没有ssl的情况下构建。 [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) +- 添加从自定义用户启动clickhouse服务器映像的方法。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- 升级contrib升压到1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) +- 禁用使用 `mremap` 使用线程消毒剂编译时。 令人惊讶的是,TSan并没有拦截 `mremap` (虽然它确实拦截 `mmap`, `munmap` 这会导致误报。 修复了有状态测试中的TSan报告。 [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 通过HTTP接口使用格式模式添加测试检查。 [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) + +## ClickHouse释放19.4 {#clickhouse-release-19-4} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-4-33-2019-04-17} + +#### 错误修复 {#bug-fixes-7} + +- 避免 `std::terminate` 在内存分配失败的情况下。 现在 `std::bad_alloc` 按预期引发异常。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复capnproto从缓冲区读取。 有时文件没有通过HTTP成功加载。 [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([弗拉季斯拉夫](https://github.com/smirnov-vs)) +- 修复错误 `Unknown log entry type: 0` 后 `OPTIMIZE TABLE FINAL` 查询。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([阿莫斯鸟](https://github.com/amosbird)) +- 错误的参数 `hasAny` 或 `hasAll` 函数可能会导致段错误。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 执行时可能会发生死锁 `DROP DATABASE dictionary` 查询。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复未定义的行为 `median` 和 `quantile` 功能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) +- 修复压缩级别检测时 `network_compression_method` 小写。 在19.1节中被打破。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) +- 固定的无知 `UTC` 设置(修复问题 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) +- 修复 `histogram` 函数行为 `Distributed` 桌子 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) +- 固定tsan报告 `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了由于系统日志使用中的争用条件而关闭的TSan报告。 修复了当part\_log启用时关机后的潜在使用。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复重新检查零件 `ReplicatedMergeTreeAlterThread` 在错误的情况下。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 对中间聚合函数状态的算术运算不适用于常量参数(如子查询结果)。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 始终在元数据中反引用列名。 否则,不可能创建一个名为列的表 `index` (由于格式错误,服务器无法重新启动 `ATTACH` 元数据中的查询)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复崩溃 `ALTER ... MODIFY ORDER BY` 上 `Distributed` 桌子 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) +- 修复段错误 `JOIN ON` 已启用 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([张冬](https://github.com/zhang2014)) +- 修复kafka使用protobuf消息后添加无关行的错误。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- 在固定的竞争条件 `SELECT` 从 `system.tables` 如果同时重命名或更改表。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 获取已经过时的数据部分时修复了数据竞赛。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定罕见的数据竞赛,可以在发生 `RENAME` MergeTree家族的表. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正功能中的分段故障 `arrayIntersect`. 如果函数使用常量和普通参数混合调用,则可能会发生分段错误。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([钱丽祥](https://github.com/fancyqlx)) +- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复 `No message received` 在副本之间获取部件时出现异常。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([阿利沙平](https://github.com/alesapin)) +- 固定 `arrayIntersect` 函数错误导致在单个数组中的几个重复值的情况下。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 在并发期间修复争用条件 `ALTER COLUMN` 可能导致服务器崩溃的查询(修复问题 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修复参数扣除 `ALTER MODIFY` 列 `CODEC` 未指定列类型时。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([阿利沙平](https://github.com/alesapin)) +- 功能 `cutQueryStringAndFragment()` 和 `queryStringAndFragment()` 现在正常工作时 `URL` 包含一个片段,没有查询。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 修复设置时罕见的错误 `min_bytes_to_use_direct_io` 大于零,这发生在线程必须在列文件中向后寻找时。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([阿利沙平](https://github.com/alesapin)) +- 修复聚合函数的错误参数类型 `LowCardinality` 参数(修复问题 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 修复功能 `toISOWeek` 1970年的结果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复 `DROP`, `TRUNCATE` 和 `OPTIMIZE` 查询重复,在执行时 `ON CLUSTER` 为 `ReplicatedMergeTree*` 表家庭. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([阿利沙平](https://github.com/alesapin)) + +#### 改进 {#improvements-2} + +- 保持平凡, `DEFAULT`, `MATERIALIZED` 和 `ALIAS` 在一个列表中的列(修复问题 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-3-11-2019-04-02} + +#### 错误修复 {#bug-fixes-8} + +- 修复崩溃 `FULL/RIGHT JOIN` 当我们加入可为空vs不可为空时。 [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-11} + +- 添加从自定义用户启动clickhouse服务器映像的方法。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-2-7-2019-03-30} + +#### 错误修复 {#bug-fixes-9} + +- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-1-3-2019-03-19} + +#### 错误修复 {#bug-fixes-10} + +- 包含两个固定的远程查询 `LIMIT BY` 和 `LIMIT`. 以前,如果 `LIMIT BY` 和 `LIMIT` 用于远程查询, `LIMIT` 可能发生之前 `LIMIT BY`,这导致过滤的结果。 [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([康斯坦丁\*潘](https://github.com/kvap)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-0-49-2019-03-09} + +#### 新功能 {#new-features-5} + +- 增加了全面支持 `Protobuf` 格式(输入和输出,嵌套数据结构)。 [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 添加位图功能与Ro哮的位图。 [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([杨小姐](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 实木复合地板格式支持。 [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) +- 为模糊字符串比较添加了N-gram距离。 它类似于R语言中的q-gram指标。 [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) +- 结合专用聚合和保留模式中的石墨汇总规则。 [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) +- 已添加 `max_execution_speed` 和 `max_execution_speed_bytes` 限制资源使用。 已添加 `min_execution_speed_bytes` 设置以补充 `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([张冬](https://github.com/zhang2014)) +- 实现功能 `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) +- 新增功能 `arrayEnumerateDenseRanked` 和 `arrayEnumerateUniqRanked` (这就像 `arrayEnumerateUniq` 但是允许微调数组深度以查看多维数组内部)。 [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 错误修复 {#bug-fixes-11} + +- 此版本还包含19.3和19.1中的所有错误修复。 +- 修正了数据跳过索引的错误:插入后颗粒顺序不正确。 [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 固定 `set` ツ环板forョ `Nullable` 和 `LowCardinality` 列。 在它之前, `set` 索引与 `Nullable` 或 `LowCardinality` 列导致错误 `Data type must be deserialized with multiple streams` 同时选择。 [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 正确设置完整的update\_time `executable` 字典更新. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) +- 修复19.3中损坏的进度条。 [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) +- 在某些情况下,修复了内存区域收缩时MemoryTracker的不一致值。 [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了ThreadPool中未定义的行为。 [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了一个非常罕见的崩溃的消息 `mutex lock failed: Invalid argument` 当MergeTree表与SELECT同时删除时,可能会发生这种情况。 [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) +- ODBC驱动程序兼容 `LowCardinality` 数据类型。 [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) +- FreeBSD:修复程序 `AIOcontextPool: Found io_event with unknown id 0` 错误 [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `system.part_log` 无论配置如何,都会创建表。 [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复未定义的行为 `dictIsIn` 缓存字典功能。 [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([阿利沙平](https://github.com/alesapin)) +- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) +- 默认情况下禁用compile\_expressions,直到我们得到自己 `llvm` contrib并且可以测试它 `clang` 和 `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([阿利沙平](https://github.com/alesapin)) +- 预防 `std::terminate` 当 `invalidate_query` 为 `clickhouse` 外部字典源返回了错误的结果集(空或一行以上或一列以上)。 固定的问题,当 `invalidate_query` 执行每五秒钟,无论到 `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 避免死锁时 `invalidate_query` 对于与字典 `clickhouse` 资料来源涉及 `system.dictionaries` 表或 `Dictionaries` 数据库(罕见的情况)。 [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了交叉连接与空在哪里。 [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) +- 在功能固定段错误 “replicate” 传递常量参数时。 [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 使用谓词优化器修复lambda函数。 [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([张冬](https://github.com/zhang2014)) +- 多个联接多个修复。 [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 改进 {#improvements-3} + +- 在右表列的连接上部分支持别名。 [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) +- 结果多加入了需要正确的结果,名称为使用中子选择. 替换平的别名来源中的名称结果。 [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) +- 改进连接语句的下推逻辑。 [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([伊万](https://github.com/abyss7)) + +#### 性能改进 {#performance-improvements-3} + +- 改进的启发式 “move to PREWHERE” 优化。 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 使用适当的查找表,使用HashTable的api用于8位和16位密钥。 [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([阿莫斯鸟](https://github.com/amosbird)) +- 改进字符串比较的性能。 [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在单独的线程中清理分布式DDL队列,以便它不会减慢处理分布式DDL任务的主循环。 [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) +- 当 `min_bytes_to_use_direct_io` 如果设置为1,则不是每个文件都使用O\_DIRECT模式打开,因为要读取的数据大小有时被一个压缩块的大小所低估。 [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-12} + +- 增加了对clang-9的支持 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复错误 `__asm__` 说明(再次) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) +- 添加指定设置的能力 `clickhouse-performance-test` 从命令行。 [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([阿利沙平](https://github.com/alesapin)) +- 将字典测试添加到集成测试。 [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([阿利沙平](https://github.com/alesapin)) +- 在网站上添加了来自基准测试的查询,以自动化性能测试。 [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `xxhash.h` 在外部lz4中不存在,因为它是一个实现细节,并且它的符号是命名空间的 `XXH_NAMESPACE` 麦克罗 当lz4是外部的,xxHash也必须是外部的,并且依赖者必须链接到它。 [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Origej Desh](https://github.com/orivej)) +- 固定的情况下,当 `quantileTiming` 聚合函数可以用负或浮点参数调用(这修复了使用未定义的行为消毒器的模糊测试)。 [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 拼写错误更正。 [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) +- 在Mac上修复编译。 [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- Freebsd和各种不寻常的构建配置的构建修复程序。 [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) + +## ClickHouse释放19.3 {#clickhouse-release-19-3} + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-3-9-1-2019-04-02} + +#### 错误修复 {#bug-fixes-12} + +- 修复崩溃 `FULL/RIGHT JOIN` 当我们加入可为空vs不可为空时。 [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) +- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) + +#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-13} + +- 添加从自定义用户启动clickhouse服务器映像的方法 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-7-2019-03-12} + +#### 错误修复 {#bug-fixes-13} + +- 修正了#3920中的错误。 此错误表现为随机缓存损坏(消息 `Unknown codec family code`, `Cannot seek through file`)和段错误。 这个错误最早出现在19.1版本中,并且存在于19.1.10和19.3.6之前的版本中。 [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-3-6-2019-03-02} + +#### 错误修复 {#bug-fixes-14} + +- 当线程池中有超过1000个线程时, `std::terminate` 线程退出时可能发生。 [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 现在可以创建 `ReplicatedMergeTree*` 对没有默认值的列进行注释的表和对没有注释和默认值的列进行编解码的表。 还修复编解码器的比较。 [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([阿利沙平](https://github.com/alesapin)) +- 修复了与数组或元组联接时的崩溃。 [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) +- 修复了clickhouse-复印机中的消息崩溃 `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) +- 如果使用分布式Ddl,则在服务器关闭时修复了挂机问题。 [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) +- 错误的列编号打印在有关文本格式分析的列数大于10的错误消息中。 [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-3} + +- 固定构建与启用AVX。 [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 基于已知版本而不是编译它的内核启用扩展记帐和IO记帐。 [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([纳瓦托洛梅](https://github.com/nvartolomei)) +- 允许跳过core\_dump的设置。size\_limit,如果限制设置失败,则警告而不是throw。 [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) +- 删除了 `inline` 标签 `void readBinary(...)` 在 `Field.cpp`. 也合并冗余 `namespace DB` 块。 [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-5-2019-02-21} + +#### 错误修复 {#bug-fixes-15} + +- 修正了大型http插入查询处理的错误。 [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([阿利沙平](https://github.com/alesapin)) +- 修正了向后不兼容的旧版本,由于错误的实现 `send_logs_level` 设置。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了表函数的向后不兼容性 `remote` 与列注释介绍. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-4-2019-02-16} + +#### 改进 {#improvements-4} + +- 执行以下操作时,表索引大小不考虑内存限制 `ATTACH TABLE` 查询。 避免了分离后无法连接表的可能性。 [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 稍微提高了从ZooKeeper接收的最大字符串和数组大小的限制。 它允许继续与增加的尺寸工作 `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` 在动物园管理员。 [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 允许修复被遗弃的副本,即使它已经在其队列中拥有大量的节点。 [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加一个必需的参数 `SET` 索引(最大存储行数)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) + +#### 错误修复 {#bug-fixes-16} + +- 固定 `WITH ROLLUP` 单组结果 `LowCardinality` 钥匙 [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 在设置索引固定错误(删除颗粒,如果它包含超过 `max_rows` 行)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 很多的FreeBSD构建修复。 [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) +- 固定别名替换查询与子查询包含相同的别名(问题 [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-4} + +- 添加运行能力 `clickhouse-server` 对于docker镜像中的无状态测试。 [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([瓦西里\*内姆科夫](https://github.com/Enmk)) + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-3-2019-02-13} + +#### 新功能 {#new-features-6} + +- 添加了 `KILL MUTATION` 允许删除由于某些原因卡住的突变的声明。 已添加 `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` 字段到 `system.mutations` 表更容易排除故障。 [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) +- 添加聚合功能 `entropy` 计算香农熵 [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) +- 添加发送查询的功能 `INSERT INTO tbl VALUES (....` 到服务器而不拆分 `query` 和 `data` 零件。 [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([阿利沙平](https://github.com/alesapin)) +- 通用实现 `arrayWithConstant` 添加了功能。 [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 已实施 `NOT BETWEEN` 比较运算符。 [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) +- 执行 `sumMapFiltered` 为了能够限制其值将被求和的键的数量 `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- 增加了支持 `Nullable` 类型 `mysql` 表功能。 [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) +- 支持任意常量表达式 `LIMIT` 条款 [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) +- 已添加 `topKWeighted` 采用带有(无符号整数)权重的附加参数的聚合函数。 [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([安德鲁\*戈尔曼](https://github.com/andrewgolman)) +- `StorageJoin` 现在支持 `join_any_take_last_row` 允许复盖同一键的现有值的设置。 [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([阿莫斯鸟](https://github.com/amosbird) +- 添加功能 `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 已添加 `RowBinaryWithNamesAndTypes` 格式。 [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V.Kozlyuk](https://github.com/DarkWanderer)) +- 已添加 `IPv4` 和 `IPv6` 数据类型。 更有效的实现 `IPv*` 功能。 [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([瓦西里\*内姆科夫](https://github.com/Enmk)) +- 添加功能 `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 已添加 `Protobuf` 输出格式。 [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) +- 增加了对数据导入(插入)HTTP接口的brotli支持。 [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([米哈伊尔](https://github.com/fandyushin)) +- 增加了提示,而用户做出错字的函数名称或键入命令行客户端。 [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) +- 已添加 `Query-Id` 到服务器的HTTP响应头。 [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([米哈伊尔](https://github.com/fandyushin)) + +#### 实验特点 {#experimental-features-2} + +- 已添加 `minmax` 和 `set` MergeTree表引擎系列的数据跳过索引。 [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- 增加了转换 `CROSS JOIN` 到 `INNER JOIN` 如果可能的话 [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 错误修复 {#bug-fixes-17} + +- 固定 `Not found column` 对于重复的列 `JOIN ON` 科。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- 赂眉露\>\> `START REPLICATED SENDS` 命令开始复制发送。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([纳瓦托洛梅](https://github.com/nvartolomei)) +- 固定聚合函数执行 `Array(LowCardinality)` 争论。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 修正了错误的行为,当做 `INSERT ... SELECT ... FROM file(...)` 查询和文件有 `CSVWithNames` 或 `TSVWIthNames` 格式和第一个数据行丢失。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 如果字典不可用,则修复了字典重新加载时的崩溃。 此错误出现在19.1.6中。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- 固定 `ALL JOIN` 右表中有重复项。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正了分段故障 `use_uncompressed_cache=1` 和异常与错误的未压缩大小。 此错误出现在19.1.6中。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([阿利沙平](https://github.com/alesapin)) +- 固定 `compile_expressions` 错误与大(超过int16)日期的比较。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([阿利沙平](https://github.com/alesapin)) +- 从表函数选择时固定无限循环 `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 暂时禁用谓词优化 `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([张冬](https://github.com/zhang2014)) +- 固定 `Illegal instruction` 在旧Cpu上使用base64函数时出错。 仅当ClickHouse使用gcc-8编译时,才会重现此错误。 [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定 `No message received` 通过TLS连接与PostgreSQL ODBC驱动程序交互时出错。 还修复了使用MySQL ODBC驱动程序时的段错误。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正错误的结果时 `Date` 和 `DateTime` 参数用于条件运算符(函数)的分支 `if`). 增加了函数的通用案例 `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- ClickHouse字典现在加载内 `clickhouse` 过程。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复死锁时 `SELECT` 从一个表 `File` 引擎被重试后 `No such file or directory` 错误 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 从选择时固定的竞争条件 `system.tables` 可能会给 `table doesn't exist` 错误 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `clickhouse-client` 如果在交互模式下运行,则在加载命令行建议的数据时可以在退出时段错误。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了一个错误,当包含突变的执行 `IN` 操作员产生了不正确的结果。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修正错误:如果有一个数据库 `Dictionary` 引擎中,所有字典在服务器启动时强制加载,如果有来自localhost的ClickHouse源字典,则字典无法加载。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了在服务器关闭时尝试再次创建系统日志时的错误。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 正确返回正确的类型和正确处理锁 `joinGet` 功能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([阿莫斯鸟](https://github.com/amosbird)) +- 已添加 `sumMapWithOverflow` 功能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- 固定段错误 `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正错误与不正确 `Date` 和 `DateTime` 比较。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- 在未定义的行为消毒固定模糊测试:增加了参数类型检查 `quantile*Weighted` 家庭的功能。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了在删除旧数据部分时罕见的争用条件可能会失败 `File not found` 错误 [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复缺少/etc/clickhouse-server/config的安装包。xml [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-5} + +- Debian软件包:根据配置正确的/etc/clickhouse-server/预处理链接。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- Freebsd的各种构建修复程序。 [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) +- 增加了在perftest中创建,填充和删除表的能力。 [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([阿利沙平](https://github.com/alesapin)) +- 添加了一个脚本来检查重复的包括。 [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了在性能测试中通过索引运行查询的能力。 [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([阿利沙平](https://github.com/alesapin)) +- 建议安装带有调试符号的软件包。 [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 重构性能测试。 更好的记录和信号处理。 [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([阿利沙平](https://github.com/alesapin)) +- 将文档添加到匿名Yandex。Metrika数据集. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([阿利沙平](https://github.com/alesapin)) +- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) +- 添加了有关s3中两个数据集的文档。 [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([阿利沙平](https://github.com/alesapin)) +- 增加了从拉请求描述创建更新日志的脚本。 [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 为ClickHouse添加了木偶模块。 [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) +- 添加了一组无证函数的文档。 [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([张冬](https://github.com/zhang2014)) +- ARM构建修复。 [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) +- 字典测试现在能够从运行 `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) +- 现在 `/etc/ssl` 用作带有SSL证书的默认目录。 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在开始时添加了检查SSE和AVX指令。 [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) +- 初始化脚本将等待服务器,直到启动。 [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) + +#### 向后不兼容的更改 {#backward-incompatible-changes-1} + +- 已删除 `allow_experimental_low_cardinality_type` 设置。 `LowCardinality` 数据类型已准备就绪。 [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 根据可用内存量减少标记高速缓存大小和未压缩高速缓存大小。 [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) +- 添加关键字 `INDEX` 在 `CREATE TABLE` 查询。 具有名称的列 `index` 必须使用反引号或双引号引用: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) +- `sumMap` 现在提升结果类型而不是溢出。 老 `sumMap` 行为可以通过使用获得 `sumMapWithOverflow` 功能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) + +#### 性能改进 {#performance-improvements-4} + +- `std::sort` 改为 `pdqsort` 对于没有 `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) +- 现在服务器重用全局线程池中的线程。 这会影响某些角落情况下的性能。 [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 改进 {#improvements-5} + +- 实现了对FreeBSD的AIO支持。 [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) +- `SELECT * FROM a JOIN b USING a, b` 现在回来 `a` 和 `b` 列仅从左表。 [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) +- 允许 `-C` 客户端的选项作为工作 `-c` 选项。 [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) +- 现在选项 `--password` 无值使用需要从标准输入的密码。 [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) +- 在包含字符串文字中添加了非转义元字符的突出显示 `LIKE` 表达式或正则表达式。 [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加取消HTTP只读查询,如果客户端套接字消失。 [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([纳瓦托洛梅](https://github.com/nvartolomei)) +- 现在,服务器报告进度,以保持客户端连接活跃。 [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([伊万](https://github.com/abyss7)) +- 稍微好一点的消息与优化查询的原因 `optimize_throw_if_noop` 设置已启用。 [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了支持 `--version` clickhouse服务器的选项。 [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) +- 已添加 `--help/-h` 选项 `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([尤里\*巴拉诺夫](https://github.com/yurriy)) +- 增加了对具有聚合函数状态结果的标量子查询的支持。 [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) +- 改进服务器关闭时间并改变等待时间。 [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 添加了有关replicated\_can\_become\_leader设置到系统的信息。如果副本不会尝试成为领导者,则添加日志记录。 [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) + +## ClickHouse释放19.1 {#clickhouse-release-19-1} + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-14-2019-03-14} + +- 修正错误 `Column ... queried more than once` 这可能发生,如果设置 `asterisk_left_columns_only` 在使用的情况下设置为1 `GLOBAL JOIN` 与 `SELECT *` (罕见的情况)。 该问题在19.3及更新版本中不存在。 [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-13-2019-03-12} + +此版本包含与19.3.7完全相同的补丁集。 + +### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-1-10-2019-03-03} + +此版本包含与19.3.6完全相同的补丁集。 + +## ClickHouse释放19.1 {#clickhouse-release-19-1-1} + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-9-2019-02-21} + +#### 错误修复 {#bug-fixes-18} + +- 修正了向后不兼容的旧版本,由于错误的实现 `send_logs_level` 设置。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了表函数的向后不兼容性 `remote` 与列注释介绍. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-8-2019-02-16} + +#### 错误修复 {#bug-fixes-19} + +- 修复缺少/etc/clickhouse-server/config的安装包。xml [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) + +## ClickHouse释放19.1 {#clickhouse-release-19-1-2} + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-7-2019-02-15} + +#### 错误修复 {#bug-fixes-20} + +- 正确返回正确的类型和正确处理锁 `joinGet` 功能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([阿莫斯鸟](https://github.com/amosbird)) +- 修复了在服务器关闭时尝试再次创建系统日志时的错误。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正错误:如果有一个数据库 `Dictionary` 引擎中,所有字典在服务器启动时强制加载,如果有来自localhost的ClickHouse源字典,则字典无法加载。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了一个错误,当包含突变的执行 `IN` 操作员产生了不正确的结果。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) +- `clickhouse-client` 如果在交互模式下运行,则在加载命令行建议的数据时可以在退出时段错误。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 从选择时固定的竞争条件 `system.tables` 可能会给 `table doesn't exist` 错误 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复死锁时 `SELECT` 从一个表 `File` 引擎被重试后 `No such file or directory` 错误 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了一个问题:本地ClickHouse字典通过TCP加载,但应该在进程中加载。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定 `No message received` 通过TLS连接与PostgreSQL ODBC驱动程序交互时出错。 还修复了使用MySQL ODBC驱动程序时的段错误。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 暂时禁用谓词优化 `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([张冬](https://github.com/zhang2014)) +- 从表函数选择时固定无限循环 `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定 `compile_expressions` 错误与大(超过int16)日期的比较。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([阿利沙平](https://github.com/alesapin)) +- 修正了分段故障 `uncompressed_cache=1` 和异常与错误的未压缩大小。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([阿利沙平](https://github.com/alesapin)) +- 固定 `ALL JOIN` 右表中有重复项。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) +- 修正了错误的行为,当做 `INSERT ... SELECT ... FROM file(...)` 查询和文件有 `CSVWithNames` 或 `TSVWIthNames` 格式和第一个数据行丢失。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 固定聚合函数执行 `Array(LowCardinality)` 争论。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- Debian软件包:根据配置正确的/etc/clickhouse-server/预处理链接。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) +- 在未定义的行为消毒固定模糊测试:增加了参数类型检查 `quantile*Weighted` 家庭的功能。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 赂眉露\>\> `START REPLICATED SENDS` 命令开始复制发送。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([纳瓦托洛梅](https://github.com/nvartolomei)) +- 固定 `Not found column` 对于联接部分中的重复列。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) +- 现在 `/etc/ssl` 用作带有SSL证书的默认目录。 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 如果字典不可用,则修复了字典重新加载时的崩溃。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) +- 修正错误与不正确 `Date` 和 `DateTime` 比较。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) +- 修正错误的结果时 `Date` 和 `DateTime` 参数用于条件运算符(函数)的分支 `if`). 增加了函数的通用案例 `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-6-2019-01-24} + +#### 新功能 {#new-features-7} + +- 自定义每列压缩编解码器的表。 [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([阿利沙平](https://github.com/alesapin), [张冬](https://github.com/zhang2014), [阿纳托利](https://github.com/Sindbag)) +- 添加压缩编解ec `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([阿利沙平](https://github.com/alesapin)) +- 允许 `ALTER` 压缩编解ecs。 [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([阿利沙平](https://github.com/alesapin)) +- 新增功能 `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` 对于SQL标准的兼容性。 [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([伊万\*布林科夫](https://github.com/blinkov)) +- 支持写入 `HDFS` 表和 `hdfs` 表功能。 [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([阿利沙平](https://github.com/alesapin)) +- 增加了从big haystack中搜索多个常量字符串的功能: `multiPosition`, `multiSearch` ,`firstMatch` 也与 `-UTF8`, `-CaseInsensitive`,和 `-CaseInsensitiveUTF8` 变体。 [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) +- 修剪未使用的碎片,如果 `SELECT` 通过分片键查询过滤器(设置 `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [伊万](https://github.com/abyss7)) +- 允许 `Kafka` 引擎忽略每个块的解析错误数。 [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([伊万](https://github.com/abyss7)) +- 增加了对 `CatBoost` 多类模型评估。 功能 `modelEvaluate` 返回带有多类模型的每类原始预测的元组。 `libcatboostmodel.so` 应建立与 [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 新增功能 `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) +- 添加了哈希函数 `xxHash64` 和 `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) +- 已添加 `gccMurmurHash` 散列函数(GCC风味杂音散列),它使用相同的散列种子 [海湾合作委员会](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) +- 添加了哈希函数 `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([上书结365](https://github.com/shangshujie365)) +- 添加表功能 `remoteSecure`. 函数的工作原理为 `remote`,但使用安全连接。 [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) + +#### 实验特点 {#experimental-features-3} + +- 添加了多个联接仿真 (`allow_experimental_multiple_joins_emulation` 设置)。 [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) + +#### 错误修复 {#bug-fixes-21} + +- 赂眉露\>\> `compiled_expression_cache_size` 默认情况下设置有限,以降低内存消耗。 [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([阿利沙平](https://github.com/alesapin)) +- 修复导致执行更改复制表的线程和从ZooKeeper更新配置的线程中挂断的错误。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修复了执行分布式ALTER任务时的争用条件。 争用条件导致多个副本试图执行任务和所有副本,除了一个失败与ZooKeeper错误。 [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修复错误时 `from_zk` 在对ZooKeeper的请求超时后,配置元素没有刷新。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修复IPv4子网掩码错误前缀的错误。 [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([阿利沙平](https://github.com/alesapin)) +- 固定崩溃 (`std::terminate`)在极少数情况下,由于资源耗尽而无法创建新线程。 [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正错误时 `remote` 表函数执行时,错误的限制被用于 `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([阿利沙平](https://github.com/alesapin)) +- 修复netlink套接字的泄漏。 它们被放置在一个池中,在那里它们永远不会被删除,并且当所有当前套接字都在使用时,在新线程开始时创建了新的套接字。 [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) +- 修复关闭错误 `/proc/self/fd` 目录早于所有fds被读取 `/proc` 分叉后 `odbc-bridge` 子进程。 [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([阿利沙平](https://github.com/alesapin)) +- 在主键中使用字符串的情况下,固定字符串到UInt单调转换。 [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([张冬](https://github.com/zhang2014)) +- 整数转换函数单调性计算中的固定误差。 [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复段错误 `arrayEnumerateUniq`, `arrayEnumerateDense` 函数在一些无效的参数的情况下。 [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 在StorageMerge修复UB。 [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([阿莫斯鸟](https://github.com/amosbird)) +- 修正函数中的段错误 `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正错误:功能 `round`, `floor`, `trunc`, `ceil` 在整数参数和大负比例执行时可能会返回虚假结果。 [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了一个错误引起的 ‘kill query sync’ 从而导致核心转储。 [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) +- 修复空复制队列后延迟较长的bug。 [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([阿利沙平](https://github.com/alesapin)) +- 修复了插入到表中的过多内存使用情况 `LowCardinality` 主键。 [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 固定 `LowCardinality` 序列化 `Native` 在空数组的情况下格式化。 [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 固定不正确的结果,而使用distinct通过单LowCardinality数字列。 [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 固定专门的聚合与LowCardinality键(以防万一 `compile` 设置已启用)。 [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 修复复制表查询的用户和密码转发。 [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([阿利沙平](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) +- 修复了在重新加载字典时在字典数据库中列出表时可能发生的非常罕见的争用条件。 [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了与ROLLUP或CUBE一起使用时的错误结果。 [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([周三](https://github.com/reflection)) +- 用于查询的固定列别名 `JOIN ON` 语法和分布式表。 [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([张冬](https://github.com/zhang2014)) +- 在内部实现固定的错误 `quantileTDigest` (由阿尔乔姆Vakhrushev发现)。 这个错误从来没有发生在ClickHouse中,只有那些直接使用ClickHouse代码库作为库的人才有关。 [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 改进 {#improvements-6} + +- 支持 `IF NOT EXISTS` 在 `ALTER TABLE ADD COLUMN` 发言以及 `IF EXISTS` 在 `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) +- 功能 `parseDateTimeBestEffort`:支持格式 `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` 和相似。 [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- `CapnProtoInputStream` 现在支持锯齿结构。 [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) +- 可用性改进:增加了从数据目录的所有者启动服务器进程的检查。 如果数据属于非root用户,则不允许从root用户启动服务器。 [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([谢尔盖-v-加尔采夫](https://github.com/sergey-v-galtsev)) +- 在分析具有联接的查询期间检查所需列的更好的逻辑。 [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) +- 减少在单个服务器中有大量分布式表的情况下的连接数。 [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([张冬](https://github.com/zhang2014)) +- 支持的总计行 `WITH TOTALS` 查询ODBC驱动程序。 [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) +- 允许使用 `Enum`s为if函数内的整数。 [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([伊万](https://github.com/abyss7)) +- 已添加 `low_cardinality_allow_in_native_format` 设置。 如果禁用,请不要使用 `LowCadrinality` 输入 `Native` 格式。 [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) +- 从编译表达式缓存中删除了一些冗余对象以降低内存使用率。 [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([阿利沙平](https://github.com/alesapin)) +- 添加检查 `SET send_logs_level = 'value'` 查询接受适当的值。 [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin马克西姆](https://github.com/s-mx)) +- 固定数据类型检查类型转换功能。 [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([张冬](https://github.com/zhang2014)) + +#### 性能改进 {#performance-improvements-5} + +- 添加MergeTree设置 `use_minimalistic_part_header_in_zookeeper`. 如果启用,复制的表将在单个零件znode中存储紧凑零件元数据。 这可以显着减少ZooKeeper快照大小(特别是如果表有很多列)。 请注意,启用此设置后,您将无法降级到不支持它的版本。 [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) +- 为函数添加基于DFA的实现 `sequenceMatch` 和 `sequenceCount` 以防模式不包含时间。 [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) +- 整数序列化的性能改进。 [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([阿莫斯鸟](https://github.com/amosbird)) +- 零左填充PODArray,使-1元素始终有效并归零。 它用于无分支计算偏移量。 [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([阿莫斯鸟](https://github.com/amosbird)) +- 还原 `jemalloc` 版本导致性能下降。 [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) + +#### 向后不兼容的更改 {#backward-incompatible-changes-2} + +- 删除无证功能 `ALTER MODIFY PRIMARY KEY` 因为它被 `ALTER MODIFY ORDER BY` 指挥部 [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) +- 删除功能 `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 禁止使用具有结果类型的标量子查询 `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([伊万](https://github.com/abyss7)) + +#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-6} + +- 增加了对PowerPC的支持 (`ppc64le`)建设。 [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) +- 有状态功能测试在公共可用数据集上运行。 [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修复了服务器无法启动时的错误 `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` Docker或systemd-nspawn中的消息。 [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 更新 `rdkafka` 库v1.0.0-RC5。 使用cppkafka而不是原始的C接口。 [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([伊万](https://github.com/abyss7)) +- 更新 `mariadb-client` 图书馆. 修复了UBSan发现的问题之一。 [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- UBSan版本的一些修复。 [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了使用UBSan构建的每次提交运行的测试。 +- 增加了PVS-Studio静态分析器的每次提交运行。 +- 修复了PVS-Studio发现的错误。 [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了glibc兼容性问题。 [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 将Docker映像移动到18.10并为glibc\>=2.28添加兼容性文件 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([阿利沙平](https://github.com/alesapin)) +- 如果用户不想在服务器码头镜像中播放目录,请添加env变量。 [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([阿利沙平](https://github.com/alesapin)) +- 启用了大多数来自警告 `-Weverything` 在叮当声。 已启用 `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 增加了一些只在clang8中可用的警告。 [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 链接到 `libLLVM` 在使用共享链接时,而不是单独的LLVM库。 [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Origej Desh](https://github.com/orivej)) +- 为测试图像添加了消毒变量。 [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([阿利沙平](https://github.com/alesapin)) +- `clickhouse-server` debian软件包会推荐 `libcap2-bin` 使用包 `setcap` 设置功能的工具。 这是可选的。 [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 改进的编译时间,固定包括。 [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) +- 添加了哈希函数的性能测试。 [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) +- 固定循环库依赖。 [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) +- 改进的编译与低可用内存。 [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) +- 添加了测试脚本,以重现性能下降 `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) +- 修正了在下面的注释和字符串文字拼写错误 `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) +- 修正了错别字的评论。 [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) + +## [2018年的更新日志](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/zh/whats_new/changelog/index.md b/docs/zh/whats-new/changelog/index.md similarity index 100% rename from docs/zh/whats_new/changelog/index.md rename to docs/zh/whats-new/changelog/index.md diff --git a/docs/zh/whats_new/index.md b/docs/zh/whats-new/index.md similarity index 100% rename from docs/zh/whats_new/index.md rename to docs/zh/whats-new/index.md diff --git a/docs/zh/whats-new/roadmap.md b/docs/zh/whats-new/roadmap.md new file mode 100644 index 00000000000..49532c046f5 --- /dev/null +++ b/docs/zh/whats-new/roadmap.md @@ -0,0 +1,9 @@ +# 规划 {#gui-hua} + +## Q1 2020 {#q1-2020} + +- 更精确的用户资源池,可以在用户之间合理分配集群资源 +- 细粒度的授权管理 +- 与外部认证服务集成 + +[来源文章](https://clickhouse.tech/docs/en/roadmap/) diff --git a/docs/zh/whats-new/security-changelog.md b/docs/zh/whats-new/security-changelog.md new file mode 100644 index 00000000000..e35d6a7c632 --- /dev/null +++ b/docs/zh/whats-new/security-changelog.md @@ -0,0 +1,41 @@ +## 修复于 ClickHouse Release 18.12.13, 2018-09-10 {#xiu-fu-yu-clickhouse-release-18-12-13-2018-09-10} + +### CVE-2018-14672 {#cve-2018-14672} + +加载CatBoost模型的功能,允许遍历路径并通过错误消息读取任意文件。 + +来源: Yandex信息安全团队的Andrey Krasichkov + +## 修复于 ClickHouse Release 18.10.3, 2018-08-13 {#xiu-fu-yu-clickhouse-release-18-10-3-2018-08-13} + +### CVE-2018-14671 {#cve-2018-14671} + +unixODBC允许从文件系统加载任意共享对象,从而导致«远程执行代码»漏洞。 + +来源:Yandex信息安全团队的Andrey Krasichkov和Evgeny Sidorov + +## 修复于 ClickHouse Release 1.1.54388, 2018-06-28 {#xiu-fu-yu-clickhouse-release-1-1-54388-2018-06-28} + +### CVE-2018-14668 {#cve-2018-14668} + +远程表函数功能允许在 «user», «password» 及 «default\_database» 字段中使用任意符号,从而导致跨协议请求伪造攻击。 + +来源:Yandex信息安全团队的Andrey Krasichkov + +## 修复于 ClickHouse Release 1.1.54390, 2018-07-06 {#xiu-fu-yu-clickhouse-release-1-1-54390-2018-07-06} + +### CVE-2018-14669 {#cve-2018-14669} + +ClickHouse MySQL客户端启用了 «LOAD DATA LOCAL INFILE» 功能,该功能允许恶意MySQL数据库从连接的ClickHouse服务器读取任意文件。 + +来源:Yandex信息安全团队的Andrey Krasichkov和Evgeny Sidorov + +## 修复于 ClickHouse Release 1.1.54131, 2017-01-10 {#xiu-fu-yu-clickhouse-release-1-1-54131-2017-01-10} + +### CVE-2018-14670 {#cve-2018-14670} + +deb软件包中的错误配置可能导致使用未经授权的数据库。 + +来源:英国国家网络安全中心(NCSC) + +[来源文章](https://clickhouse.tech/docs/en/security_changelog/) diff --git a/docs/zh/whats_new/changelog/2017.md b/docs/zh/whats_new/changelog/2017.md deleted file mode 100644 index ed77ead9023..00000000000 --- a/docs/zh/whats_new/changelog/2017.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 79 -toc_title: '2017' ---- - -### ClickHouse释放1.1.54327,2017-12-21 {#clickhouse-release-1-1-54327-2017-12-21} - -此版本包含以前版本1.1.54318的错误修复: - -- 修复了可能导致数据丢失的复制中可能存在的争用条件的错误。 此问题影响版本1.1.54310和1.1.54318。 如果将其中一个版本用于复制的表,则强烈建议进行更新。 此问题显示在日志中的警告消息,如 `Part ... from own log doesn't exist.` 即使您在日志中没有看到这些消息,问题也是相关的。 - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54318-2017-11-30} - -此版本包含以前版本1.1.54310的错误修复: - -- 修复了SummingMergeTree引擎中合并过程中错误的行删除 -- 修复了未复制的MergeTree引擎中的内存泄漏 -- 修复了MergeTree引擎中频繁插入的性能下降 -- 修复了导致复制队列停止运行的问题 -- 固定服务器日志的轮换和归档 - -### ClickHouse释放1.1.54310,2017-11-01 {#clickhouse-release-1-1-54310-2017-11-01} - -#### 新功能: {#new-features} - -- MergeTree表引擎系列的自定义分区键。 -- [卡夫卡](https://clickhouse.yandex/docs/en/operations/table_engines/kafka/) 表引擎。 -- 增加了对加载的支持 [CatBoost](https://catboost.yandex/) 模型并将其应用到ClickHouse中存储的数据。 -- 增加了对UTC非整数偏移的时区的支持。 -- 增加了对具有时间间隔的算术运算的支持。 -- 日期和日期时间类型的值范围扩展到2105年。 -- 添加了 `CREATE MATERIALIZED VIEW x TO y` 查询(指定用于存储实例化视图数据的现有表)。 -- 添加了 `ATTACH TABLE` 不带参数的查询。 -- 将SummingMergeTree表中名称以-Map结尾的嵌套列的处理逻辑提取到sumMap聚合函数中。 现在,您可以显式指定此类列。 -- IP trie字典的最大大小增加到128M条目。 -- 添加了getSizeOfEnumType函数。 -- 添加了sumWithOverflow聚合函数。 -- 增加了对Cap'n Proto输入格式的支持。 -- 使用zstd算法时,您现在可以自定义压缩级别。 - -#### 向后不兼容的更改: {#backward-incompatible-changes} - -- 不允许使用内存以外的引擎创建临时表。 -- 不允许使用View或MaterializedView引擎显式创建表。 -- 在创建表期间,新检查将验证采样键表达式是否包含在主键中。 - -#### 错误修复: {#bug-fixes} - -- 修复了同步插入到分布式表中时的挂断问题。 -- 修复了复制表中部分的非原子添加和删除。 -- 插入到实例化视图中的数据不会遭受不必要的重复数据删除。 -- 对本地副本滞后且远程副本不可用的分布式表执行查询不会再导致错误。 -- 用户不需要访问权限 `default` 数据库创建临时表了。 -- 修复了在指定数组类型时不带参数的崩溃。 -- 修复了包含服务器日志的磁盘卷已满时的挂机问题。 -- 修复了unix时代的第一周toRelativeWeekNum函数的溢出。 - -#### 构建改进: {#build-improvements} - -- 几个第三方库(特别是Poco)被更新并转换为git子模块。 - -### ClickHouse释放1.1.54304,2017-10-19 {#clickhouse-release-1-1-54304-2017-10-19} - -#### 新功能: {#new-features-1} - -- 本机协议中的TLS支持(要启用,请设置 `tcp_ssl_port` 在 `config.xml` ). - -#### 错误修复: {#bug-fixes-1} - -- `ALTER` 对于复制的表现在尝试尽快开始运行。 -- 使用设置读取数据时修复崩溃 `preferred_block_size_bytes=0.` -- 固定的崩溃 `clickhouse-client` 按下时 `Page Down` -- 正确解释某些复杂的查询 `GLOBAL IN` 和 `UNION ALL` -- `FREEZE PARTITION` 现在总是以原子方式工作。 -- 空POST请求现在返回代码411的响应。 -- 修正了像表达式的解释错误 `CAST(1 AS Nullable(UInt8)).` -- 修正了读取时的错误 `Array(Nullable(String))` 从列 `MergeTree` 桌子 -- 修正了解析查询时崩溃,如 `SELECT dummy AS dummy, dummy AS b` -- 用户正确更新无效 `users.xml` -- 可执行字典返回非零响应代码时的正确处理。 - -### ClickHouse释放1.1.54292,2017-09-20 {#clickhouse-release-1-1-54292-2017-09-20} - -#### 新功能: {#new-features-2} - -- 添加了 `pointInPolygon` 用于处理坐标平面上的坐标的函数。 -- 添加了 `sumMap` 用于计算数组总和的聚合函数,类似于 `SummingMergeTree`. -- 添加了 `trunc` 功能。 改进舍入函数的性能 (`round`, `floor`, `ceil`, `roundToExp2`)并corrected正了他们如何工作的逻辑。 改变的逻辑 `roundToExp2` 分数和负数的功能。 -- ClickHouse可执行文件现在对libc版本的依赖性较低。 同样的ClickHouse可执行文件可以在各种各样的Linux系统上运行。 使用编译的查询(使用设置)时仍然存在依赖关系 `compile = 1` ,默认情况下不使用)。 -- 减少了动态编译查询所需的时间。 - -#### 错误修复: {#bug-fixes-2} - -- 修正了有时产生的错误 `part ... intersects previous part` 消息和副本的一致性减弱。 -- 修正了一个错误,导致服务器锁定,如果ZooKeeper在关闭过程中不可用。 -- 恢复副本时删除了过多的日志记录。 -- 修复了UNION ALL实现中的错误。 -- 修复了在块中的第一列具有数组类型时发生的concat函数中的错误。 -- 进度现在在系统中正确显示。合并表。 - -### ClickHouse释放1.1.54289,2017-09-13 {#clickhouse-release-1-1-54289-2017-09-13} - -#### 新功能: {#new-features-3} - -- `SYSTEM` 服务器管理查询: `SYSTEM RELOAD DICTIONARY`, `SYSTEM RELOAD DICTIONARIES`, `SYSTEM DROP DNS CACHE`, `SYSTEM SHUTDOWN`, `SYSTEM KILL`. -- 添加了用于处理数组的函数: `concat`, `arraySlice`, `arrayPushBack`, `arrayPushFront`, `arrayPopBack`, `arrayPopFront`. -- 已添加 `root` 和 `identity` ZooKeeper配置的参数。 这允许您隔离同一个ZooKeeper集群上的单个用户。 -- 添加聚合函数 `groupBitAnd`, `groupBitOr`,和 `groupBitXor` (为了兼容,它们也可以在名称下使用 `BIT_AND`, `BIT_OR`,和 `BIT_XOR`). -- 通过在文件系统中指定套接字,可以从MySQL加载外部字典。 -- 外部字典可以通过SSL从MySQL加载 (`ssl_cert`, `ssl_key`, `ssl_ca` 参数)。 -- 添加了 `max_network_bandwidth_for_user` 设置为限制每个用户查询的总带宽使用。 -- 支持 `DROP TABLE` 对于临时表。 -- 支持阅读 `DateTime` 从Unix时间戳格式的值 `CSV` 和 `JSONEachRow` 格式。 -- 分布式查询中的滞后副本现在默认排除(默认阈值为5分钟)。 -- 在ALTER期间使用FIFO锁定:对于连续运行的查询,ALTER查询不会无限期地阻止。 -- 选项设置 `umask` 在配置文件中。 -- 改进了查询的性能 `DISTINCT` . - -#### 错误修复: {#bug-fixes-3} - -- 改进了在ZooKeeper中删除旧节点的过程。 以前,如果插入非常频繁,旧节点有时不会被删除,这导致服务器关闭速度缓慢等等。 -- 修正了选择主机连接到ZooKeeper时的随机化。 -- 修复了在分布式查询中排除滞后副本,如果副本是localhost。 -- 修正了一个错误,其中在一个数据部分 `ReplicatedMergeTree` 运行后表可能会被打破 `ALTER MODIFY` 在一个元素 `Nested` 结构。 -- 修复了可能导致SELECT查询执行以下操作的错误 “hang”. -- 对分布式DDL查询的改进。 -- 修正了查询 `CREATE TABLE ... AS `. -- 解决了在僵局 `ALTER ... CLEAR COLUMN IN PARTITION` 查询为 `Buffer` 桌子 -- 修正了无效的默认值 `Enum` s(0,而不是最小)使用时 `JSONEachRow` 和 `TSKV` 格式。 -- 解决了使用字典时僵尸进程的外观 `executable` 资料来源。 -- 修正了HEAD查询的段错误。 - -#### 改进开发和组装ClickHouse的工作流程: {#improved-workflow-for-developing-and-assembling-clickhouse} - -- 您可以使用 `pbuilder` 建造克里克豪斯 -- 您可以使用 `libc++` 而不是 `libstdc++` 对于构建在Linux上。 -- 添加了使用静态代码分析工具的说明: `Coverage`, `clang-tidy`, `cppcheck`. - -#### 升级时请注意: {#please-note-when-upgrading} - -- MergeTree设置现在有一个更高的默认值 `max_bytes_to_merge_at_max_space_in_pool` (要合并的数据部分的最大总大小,以字节为单位):它已从100GiB增加到150GiB。 这可能会导致服务器升级后运行大型合并,这可能会导致磁盘子系统的负载增加。 如果服务器上的可用空间小于正在运行的合并总量的两倍,这将导致所有其他合并停止运行,包括小数据部分的合并。 因此,插入查询将失败,并显示消息 “Merges are processing significantly slower than inserts.” 使用 `SELECT * FROM system.merges` 查询监控情况。 您还可以检查 `DiskSpaceReservedForMerge` 度量在 `system.metrics` 表,或石墨。 你不需要做任何事情来解决这个问题,因为一旦大合并完成,问题就会自行解决。 如果您发现这是不可接受的,则可以恢复以前的值 `max_bytes_to_merge_at_max_space_in_pool` 设置。 要做到这一点,请转到 在配置部分。xml,设置 ``` ``107374182400 ``` 并重新启动服务器。 - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54284-2017-08-29} - -- 这是一个错误修正版本,以前的1.1.54282版本。 它修复了ZooKeeper中部件目录中的泄漏。 - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54282-2017-08-23} - -此版本包含以前版本1.1.54276的错误修复: - -- 固定 `DB::Exception: Assertion violation: !_path.empty()` 当插入到分布式表中。 -- 如果输入数据以";"开头,则以RowBinary格式插入时修复了解析。 -- Errors during runtime compilation of certain aggregate functions (e.g. `groupArray()`). - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-1-1-54276-2017-08-16} - -#### 新功能: {#new-features-4} - -- 为选择查询添加了一个可选的WITH部分。 查询示例: `WITH 1+1 AS a SELECT a, a*a` -- INSERT可以在分布式表中同步执行:仅在所有分片上保存所有数据后才返回OK。 这是由设置insert\_distributed\_sync=1激活的。 -- 添加了用于处理16字节标识符的UUID数据类型。 -- 添加了CHAR,FLOAT和其他类型的别名,以便与Tableau兼容。 -- 添加了toyyyymm,toYYYYMMDD和toyyyyymmddhhmmss将时间转换为数字的功能。 -- 您可以使用IP地址(与主机名一起使用)来标识群集DDL查询的服务器。 -- 增加了对函数中非常量参数和负偏移的支持 `substring(str, pos, len).` -- 添加了max\_size参数 `groupArray(max_size)(column)` 聚合函数,并优化了其性能。 - -#### 主要变化: {#main-changes} - -- 安全性改进:所有服务器文件都使用0640权限创建(可以通过更改 配置参数)。 -- 改进了语法无效的查询的错误消息。 -- 在合并mergetree大部分数据时,显着降低了内存消耗并提高了性能。 -- 显着提高了ReplacingMergeTree引擎的数据合并性能。 -- 通过组合多个源插入来改进来自分布式表的异步插入的性能。 要启用此功能,请使用设置distributed\_directory\_monitor\_batch\_inserts=1。 - -#### 向后不兼容的更改: {#backward-incompatible-changes-1} - -- 改变聚合状态的二进制格式 `groupArray(array_column)` 数组的函数。 - -#### 更改的完整列表: {#complete-list-of-changes} - -- 添加了 `output_format_json_quote_denormals` 设置,允许以JSON格式输出nan和inf值。 -- 从分布式表读取时优化流分配。 -- 如果值没有更改,可以在只读模式下配置设置。 -- 添加了检索MergeTree引擎的非整数颗粒的功能,以满足preferred\_block\_size\_bytes设置中指定的块大小的限制。 其目的是在处理来自具有大列的表的查询时减少RAM消耗并增加缓存局部性。 -- 高效使用包含如下表达式的索引 `toStartOfHour(x)` 对于像条件 `toStartOfHour(x) op сonstexpr.` -- 添加了MergeTree引擎的新设置(配置中的merge\_tree部分。xml): - - replicated\_deduplication\_window\_seconds设置复制表中重复数据删除插入所允许的秒数。 - - cleanup\_delay\_period设置启动清理以删除过时数据的频率。 - - replicated\_can\_become\_leader可以防止副本成为领导者(并分配合并)。 -- 加速清理,从ZooKeeper中删除过时的数据。 -- 针对群集DDL查询的多个改进和修复。 特别令人感兴趣的是新设置distributed\_ddl\_task\_timeout,它限制了等待群集中服务器响应的时间。 如果未在所有主机上执行ddl请求,则响应将包含超时错误,并且请求将以异步模式执行。 -- 改进了服务器日志中堆栈跟踪的显示。 -- 添加了 “none” 压缩方法的值。 -- 您可以在config中使用多个dictionaries\_config部分。xml -- 可以通过文件系统中的套接字连接到MySQL。 -- 系统。部件表有一个新的列,其中包含有关标记大小的信息,以字节为单位。 - -#### 错误修复: {#bug-fixes-4} - -- 使用合并表的分布式表现在可以正确地用于具有条件的SELECT查询 `_table` 场。 -- 修复了检查数据部分时ReplicatedMergeTree中罕见的争用条件。 -- 固定可能冻结 “leader election” 启动服务器时。 -- 使用数据源的本地副本时,将忽略max\_replica\_delay\_for\_distributed\_queries设置。 这已被修复。 -- 修正了不正确的行为 `ALTER TABLE CLEAR COLUMN IN PARTITION` 尝试清除不存在的列时。 -- 修复了multif函数中使用空数组或字符串时的异常。 -- 修正了反序列化本机格式时过多的内存分配。 -- 修正了Trie字典的不正确的自动更新。 -- 修复了使用SAMPLE从合并表中使用GROUP BY子句运行查询时的异常。 -- 修复了使用distributed\_aggregation\_memory\_efficient=1时组的崩溃。 -- 现在,您可以指定数据库。表在右侧的IN和JOIN。 -- 用于并行聚合的线程太多。 这已被修复。 -- 固定如何 “if” 函数与FixedString参数一起使用。 -- 为权重为0的分片从分布式表中选择工作不正确。 这已被修复。 -- 运行 `CREATE VIEW IF EXISTS no longer causes crashes.` -- 修正了input\_format\_skip\_unknown\_fields=1设置并且有负数时的不正确行为。 -- 修正了一个无限循环 `dictGetHierarchy()` 如果字典中有一些无效的数据,则函数。 -- 固定 `Syntax error: unexpected (...)` 在IN或JOIN子句和合并表中使用子查询运行分布式查询时出错。 -- 修复了从字典表中选择查询的不正确解释。 -- 修正了 “Cannot mremap” 在IN和JOIN子句中使用包含超过20亿个元素的数组时出错。 -- 修复了以MySQL为源的字典的故障转移。 - -#### 改进开发和组装ClickHouse的工作流程: {#improved-workflow-for-developing-and-assembling-clickhouse-1} - -- 构建可以在阿卡迪亚组装。 -- 您可以使用gcc7来编译ClickHouse。 -- 现在使用ccache+distcc的并行构建速度更快。 - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-1-1-54245-2017-07-04} - -#### 新功能: {#new-features-5} - -- 分布式的DDL(例如, `CREATE TABLE ON CLUSTER`) -- 复制的查询 `ALTER TABLE CLEAR COLUMN IN PARTITION.` -- 字典表的引擎(以表格形式访问字典数据)。 -- 字典数据库引擎(这种类型的数据库会自动为所有连接的外部字典提供字典表)。 -- 您可以通过向源发送请求来检查字典的更新。 -- 限定列名称 -- 使用双引号引用标识符。 -- Http接口中的会话。 -- 复制表的优化查询不仅可以在leader上运行。 - -#### 向后不兼容的更改: {#backward-incompatible-changes-2} - -- 删除设置全局。 - -#### 小的变化: {#minor-changes} - -- 现在,在触发警报之后,日志将打印完整的堆栈跟踪。 -- 在启动时放宽对损坏/额外数据部件数量的验证(有太多误报)。 - -#### 错误修复: {#bug-fixes-5} - -- 修复了连接错误 “sticking” 当插入到分布式表中。 -- GLOBAL IN现在适用于查看分布式表的合并表中的查询。 -- 在Google Compute Engine虚拟机上检测到不正确的内核数。 这已被修复。 -- 缓存外部字典的可执行源如何工作的更改。 -- 修复了包含空字符的字符串的比较。 -- 修正了Float32主键字段与常量的比较。 -- 以前,对字段大小的不正确估计可能导致分配过大。 -- 修复了使用ALTER查询添加到表中的可空列时的崩溃。 -- 修复了按可空列排序时的崩溃,如果行数小于限制。 -- 修复了仅由常量值组成的子查询的顺序。 -- 以前,复制的表在丢弃表失败后可能仍处于无效状态。 -- 具有空结果的标量子查询的别名不再丢失。 -- 现在如果.so文件被损坏,使用编译的查询不会失败并出现错误。 diff --git a/docs/zh/whats_new/changelog/2019.md b/docs/zh/whats_new/changelog/2019.md deleted file mode 100644 index f776141b14a..00000000000 --- a/docs/zh/whats_new/changelog/2019.md +++ /dev/null @@ -1,2074 +0,0 @@ ---- -machine_translated: true -machine_translated_rev: b111334d6614a02564cf32f379679e9ff970d9b1 -toc_priority: 77 -toc_title: '2019' ---- - -## 碌莽禄.拢.0755-88888888 {#clickhouse-release-v19-17} - -### ClickHouse释放v19.17.6.36,2019-12-27 {#clickhouse-release-v19-17-6-36-2019-12-27} - -#### 错误修复 {#bug-fix} - -- 在解压缩固定潜在的缓冲区溢出。 恶意用户可以传递制造的压缩数据,可能导致缓冲区后读取。 这个问题是由Yandex信息安全团队的Eldar Zaitov发现的。 [\#8404](https://github.com/ClickHouse/ClickHouse/pull/8404) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了可能的服务器崩溃 (`std::terminate`)当服务器不能发送或写入JSON或XML格式的数据与字符串数据类型的值(需要UTF-8验证),或者当压缩结果数据与Brotli算法或在其他一些罕见的情况下。 [\#8384](https://github.com/ClickHouse/ClickHouse/pull/8384) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 从clickhouse源固定字典 `VIEW`,现在阅读这样的字典不会导致错误 `There is no query`. [\#8351](https://github.com/ClickHouse/ClickHouse/pull/8351) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复了用户中指定的host\_regexp是否允许客户端主机的检查。xml [\#8241](https://github.com/ClickHouse/ClickHouse/pull/8241), [\#8342](https://github.com/ClickHouse/ClickHouse/pull/8342) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- `RENAME TABLE` 对于分布式表,现在在发送到分片之前重命名包含插入数据的文件夹。 这解决了连续重命名的问题 `tableA->tableB`, `tableC->tableA`. [\#8306](https://github.com/ClickHouse/ClickHouse/pull/8306) ([tavplubix](https://github.com/tavplubix)) -- `range_hashed` DDL查询创建的外部字典现在允许任意数字类型的范围。 [\#8275](https://github.com/ClickHouse/ClickHouse/pull/8275) ([阿利沙平](https://github.com/alesapin)) -- 固定 `INSERT INTO table SELECT ... FROM mysql(...)` 表功能。 [\#8234](https://github.com/ClickHouse/ClickHouse/pull/8234) ([tavplubix](https://github.com/tavplubix)) -- 修复段错误 `INSERT INTO TABLE FUNCTION file()` 同时插入到一个不存在的文件。 现在在这种情况下,文件将被创建,然后插入将被处理。 [\#8177](https://github.com/ClickHouse/ClickHouse/pull/8177) ([Olga Khvostikova](https://github.com/stavrolia)) -- 修正了聚合位图和标量位图相交时的位图和错误。 [\#8082](https://github.com/ClickHouse/ClickHouse/pull/8082) ([黄月](https://github.com/moon03432)) -- 修复段错误时 `EXISTS` 查询没有使用 `TABLE` 或 `DICTIONARY` 预选赛,就像 `EXISTS t`. [\#8213](https://github.com/ClickHouse/ClickHouse/pull/8213) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 函数的固定返回类型 `rand` 和 `randConstant` 在可为空的参数的情况下。 现在函数总是返回 `UInt32` 而且从来没有 `Nullable(UInt32)`. [\#8204](https://github.com/ClickHouse/ClickHouse/pull/8204) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 固定 `DROP DICTIONARY IF EXISTS db.dict`,现在它不会抛出异常,如果 `db` 根本不存在 [\#8185](https://github.com/ClickHouse/ClickHouse/pull/8185) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 如果由于服务器崩溃而未完全删除表,服务器将尝试恢复并加载它 [\#8176](https://github.com/ClickHouse/ClickHouse/pull/8176) ([tavplubix](https://github.com/tavplubix)) -- 修正了一个简单的计数查询分布式表,如果有两个以上的分片本地表。 [\#8164](https://github.com/ClickHouse/ClickHouse/pull/8164) ([小路](https://github.com/nicelulu)) -- 修正了导致DB::BlockStreamProfileInfo::calculateRowsBeforeLimit数据竞赛的错误() [\#8143](https://github.com/ClickHouse/ClickHouse/pull/8143) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) -- 固定 `ALTER table MOVE part` 在合并指定部件后立即执行,这可能导致移动指定部件合并到的部件。 现在它正确地移动指定的部分。 [\#8104](https://github.com/ClickHouse/ClickHouse/pull/8104) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 字典的表达式现在可以指定为字符串。 这对于从非ClickHouse源中提取数据时计算属性非常有用,因为它允许对这些表达式使用非ClickHouse语法。 [\#8098](https://github.com/ClickHouse/ClickHouse/pull/8098) ([阿利沙平](https://github.com/alesapin)) -- 修正了一个非常罕见的比赛 `clickhouse-copier` 由于ZXid的溢出。 [\#8088](https://github.com/ClickHouse/ClickHouse/pull/8088) ([丁香飞](https://github.com/dingxiangfei2009)) -- 修复了查询失败后的错误(由于 “Too many simultaneous queries” 例如)它不会读取外部表信息,并且 - 下一个请求会将此信息解释为下一个查询的开始,导致如下错误 `Unknown packet from client`. [\#8084](https://github.com/ClickHouse/ClickHouse/pull/8084) ([Azat Khuzhin](https://github.com/azat)) -- 避免空取消引用后 “Unknown packet X from server” [\#8071](https://github.com/ClickHouse/ClickHouse/pull/8071) ([Azat Khuzhin](https://github.com/azat)) -- 恢复对所有ICU区域设置的支持,添加对常量表达式应用排序规则的能力,并将语言名称添加到系统。排序规则表。 [\#8051](https://github.com/ClickHouse/ClickHouse/pull/8051) ([阿利沙平](https://github.com/alesapin)) -- 用于读取的流数 `StorageFile` 和 `StorageHDFS` 现在是有限的,以避免超过内存限制。 [\#7981](https://github.com/ClickHouse/ClickHouse/pull/7981) ([阿利沙平](https://github.com/alesapin)) -- 固定 `CHECK TABLE` 查询为 `*MergeTree` 表没有关键. [\#7979](https://github.com/ClickHouse/ClickHouse/pull/7979) ([阿利沙平](https://github.com/alesapin)) -- 如果没有突变,则从部件名称中删除突变编号。 这种删除提高了与旧版本的兼容性。 [\#8250](https://github.com/ClickHouse/ClickHouse/pull/8250) ([阿利沙平](https://github.com/alesapin)) -- 修复了某些附加部分因data\_version大于表突变版本而跳过突变的问题。 [\#7812](https://github.com/ClickHouse/ClickHouse/pull/7812) ([余志昌](https://github.com/yuzhichang)) -- 允许在将部件移动到其他设备后使用冗余副本启动服务器。 [\#7810](https://github.com/ClickHouse/ClickHouse/pull/7810) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修正了错误 “Sizes of columns doesn’t match” 使用聚合函数列时可能会出现。 [\#7790](https://github.com/ClickHouse/ClickHouse/pull/7790) ([Boris Granveaud](https://github.com/bgranvea)) -- 现在在使用WITH TIES和LIMIT BY的情况下,将抛出一个异常。 现在可以使用TOP with LIMIT BY。 [\#7637](https://github.com/ClickHouse/ClickHouse/pull/7637) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) -- 修复字典重新加载,如果它有 `invalidate_query`,停止更新,并在以前的更新尝试一些异常。 [\#8029](https://github.com/ClickHouse/ClickHouse/pull/8029) ([阿利沙平](https://github.com/alesapin)) - -### ClickHouse释放v19.17.4.11时,2019-11-22 {#clickhouse-release-v19-17-4-11-2019-11-22} - -#### 向后不兼容的更改 {#backward-incompatible-change} - -- 使用列而不是AST来存储标量子查询结果以获得更好的性能。 设置 `enable_scalar_subquery_optimization` 在19.17中添加,默认情况下启用。 它会导致以下错误 [这](https://github.com/ClickHouse/ClickHouse/issues/7851) 在从以前的版本升级到19.17.2或19.17.3期间。 默认情况下,19.17.4中禁用此设置,以便可以从19.16及更早版本升级而不会出现错误。 [\#7392](https://github.com/ClickHouse/ClickHouse/pull/7392) ([阿莫斯鸟](https://github.com/amosbird)) - -#### 新功能 {#new-feature} - -- 添加使用DDL查询创建字典的功能。 [\#7360](https://github.com/ClickHouse/ClickHouse/pull/7360) ([阿利沙平](https://github.com/alesapin)) -- 赂眉露\>\> `bloom_filter` 支持的索引类型 `LowCardinality` 和 `Nullable` [\#7363](https://github.com/ClickHouse/ClickHouse/issues/7363) [\#7561](https://github.com/ClickHouse/ClickHouse/pull/7561) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 添加功能 `isValidJSON` 要检查传递的字符串是否是有效的json。 [\#5910](https://github.com/ClickHouse/ClickHouse/issues/5910) [\#7293](https://github.com/ClickHouse/ClickHouse/pull/7293) ([Vdimir](https://github.com/Vdimir)) -- 执行 `arrayCompact` 功能 [\#7328](https://github.com/ClickHouse/ClickHouse/pull/7328) ([备忘录](https://github.com/Joeywzr)) -- 创建函数 `hex` 对于十进制数。 它的工作原理如下 `hex(reinterpretAsString())`,但不会删除最后的零字节。 [\#7355](https://github.com/ClickHouse/ClickHouse/pull/7355) ([米哈伊尔\*科罗托夫](https://github.com/millb)) -- 添加 `arrayFill` 和 `arrayReverseFill` 函数,用数组中其他元素替换它们前面/后面的元素。 [\#7380](https://github.com/ClickHouse/ClickHouse/pull/7380) ([hcz](https://github.com/hczhcz)) -- 添加 `CRC32IEEE()`/`CRC64()` 碌莽禄support: [\#7480](https://github.com/ClickHouse/ClickHouse/pull/7480) ([Azat Khuzhin](https://github.com/azat)) -- 执行 `char` 功能类似于一个 [mysql](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char) [\#7486](https://github.com/ClickHouse/ClickHouse/pull/7486) ([sundyli](https://github.com/sundy-li)) -- 添加 `bitmapTransform` 功能。 它将位图中的值数组转换为另一个值数组,结果是一个新的位图 [\#7598](https://github.com/ClickHouse/ClickHouse/pull/7598) ([余志昌](https://github.com/yuzhichang)) -- 已实施 `javaHashUTF16LE()` 功能 [\#7651](https://github.com/ClickHouse/ClickHouse/pull/7651) ([achimbab](https://github.com/achimbab)) -- 添加 `_shard_num` 分布式引擎的虚拟列 [\#7624](https://github.com/ClickHouse/ClickHouse/pull/7624) ([Azat Khuzhin](https://github.com/azat)) - -#### 实验特点 {#experimental-feature} - -- 支持处理器(新的查询执行管道) `MergeTree`. [\#7181](https://github.com/ClickHouse/ClickHouse/pull/7181) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) - -#### 错误修复 {#bug-fix-1} - -- 修复不正确的浮点解析 `Values` [\#7817](https://github.com/ClickHouse/ClickHouse/issues/7817) [\#7870](https://github.com/ClickHouse/ClickHouse/pull/7870) ([tavplubix](https://github.com/tavplubix)) -- 修复启用trace\_log时可能发生的罕见死锁。 [\#7838](https://github.com/ClickHouse/ClickHouse/pull/7838) ([filimonov](https://github.com/filimonov)) -- 当生成Kafka表时有任何从中选择的Mv时,防止消息重复 [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([伊万](https://github.com/abyss7)) -- 支持 `Array(LowCardinality(Nullable(String)))` 在 `IN`. 决定 [\#7364](https://github.com/ClickHouse/ClickHouse/issues/7364) [\#7366](https://github.com/ClickHouse/ClickHouse/pull/7366) ([achimbab](https://github.com/achimbab)) -- 添加处理 `SQL_TINYINT` 和 `SQL_BIGINT`,并修复处理 `SQL_FLOAT` ODBC桥中的数据源类型。 [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- 修复聚合 (`avg` 和分位数)在空的十进制列 [\#7431](https://github.com/ClickHouse/ClickHouse/pull/7431) ([安德烈\*科尼亚耶夫](https://github.com/akonyaev90)) -- 修复 `INSERT` 变成分布式 `MATERIALIZED` 列 [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- 赂眉露\>\> `MOVE PARTITION` 如果分区的某些部分已经在目标磁盘或卷上,则可以工作 [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修正了在突变过程中无法创建硬链接的错误 `ReplicatedMergeTree` 在多磁盘配置。 [\#7558](https://github.com/ClickHouse/ClickHouse/pull/7558) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修复了当整个部分保持不变并且在另一个磁盘上找到最佳空间时,MergeTree上出现突变的错误 [\#7602](https://github.com/ClickHouse/ClickHouse/pull/7602) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修正错误 `keep_free_space_ratio` 未从磁盘读取配置 [\#7645](https://github.com/ClickHouse/ClickHouse/pull/7645) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修正错误与表只包含 `Tuple` 列或具有复杂路径的列。 修复 [7541](https://github.com/ClickHouse/ClickHouse/issues/7541). [\#7545](https://github.com/ClickHouse/ClickHouse/pull/7545) ([阿利沙平](https://github.com/alesapin)) -- 在max\_memory\_usage限制中不考虑缓冲区引擎的内存 [\#7552](https://github.com/ClickHouse/ClickHouse/pull/7552) ([Azat Khuzhin](https://github.com/azat)) -- 修复最终标记用法 `MergeTree` 表排序 `tuple()`. 在极少数情况下,它可能会导致 `Can't adjust last granule` 选择时出错。 [\#7639](https://github.com/ClickHouse/ClickHouse/pull/7639) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复了需要上下文操作(例如json函数)的谓词突变中的错误,这可能会导致崩溃或奇怪的异常。 [\#7664](https://github.com/ClickHouse/ClickHouse/pull/7664) ([阿利沙平](https://github.com/alesapin)) -- 修复转义的数据库和表名称不匹配 `data/` 和 `shadow/` 目录 [\#7575](https://github.com/ClickHouse/ClickHouse/pull/7575) ([Alexander Burmak](https://github.com/Alex-Burmak)) -- Support duplicated keys in RIGHT\|FULL JOINs, e.g. `ON t.x = u.x AND t.x = u.y`. 在这种情况下修复崩溃。 [\#7586](https://github.com/ClickHouse/ClickHouse/pull/7586) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复 `Not found column in block` 当加入表达式与权利或完全连接。 [\#7641](https://github.com/ClickHouse/ClickHouse/pull/7641) ([Artem Zuikov](https://github.com/4ertus2)) -- 再次尝试修复无限循环 `PrettySpace` 格式 [\#7591](https://github.com/ClickHouse/ClickHouse/pull/7591) ([Olga Khvostikova](https://github.com/stavrolia)) -- 修复bug `concat` 函数时,所有的参数 `FixedString` 同样大小的 [\#7635](https://github.com/ClickHouse/ClickHouse/pull/7635) ([阿利沙平](https://github.com/alesapin)) -- 在定义S3,URL和HDFS存储时使用1个参数的情况下修复了异常。 [\#7618](https://github.com/ClickHouse/ClickHouse/pull/7618) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 修复查询视图的InterpreterSelectQuery的范围 [\#7601](https://github.com/ClickHouse/ClickHouse/pull/7601) ([Azat Khuzhin](https://github.com/azat)) - -#### 改进 {#improvement} - -- `Nullable` ODBC-bridge可识别的列和正确处理的NULL值 [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 以原子方式写入分布式发送的当前批次 [\#7600](https://github.com/ClickHouse/ClickHouse/pull/7600) ([Azat Khuzhin](https://github.com/azat)) -- 如果我们无法在查询中检测到列名称的表,则引发异常。 [\#7358](https://github.com/ClickHouse/ClickHouse/pull/7358) ([Artem Zuikov](https://github.com/4ertus2)) -- 添加 `merge_max_block_size` 设置为 `MergeTreeSettings` [\#7412](https://github.com/ClickHouse/ClickHouse/pull/7412) ([Artem Zuikov](https://github.com/4ertus2)) -- 查询与 `HAVING` 而没有 `GROUP BY` 假设按常量分组。 所以, `SELECT 1 HAVING 1` 现在返回一个结果。 [\#7496](https://github.com/ClickHouse/ClickHouse/pull/7496) ([阿莫斯鸟](https://github.com/amosbird)) -- 支持解析 `(X,)` 作为类似python的元组。 [\#7501](https://github.com/ClickHouse/ClickHouse/pull/7501), [\#7562](https://github.com/ClickHouse/ClickHouse/pull/7562) ([阿莫斯鸟](https://github.com/amosbird)) -- 赂眉露\>\> `range` 函数行为几乎像pythonic。 [\#7518](https://github.com/ClickHouse/ClickHouse/pull/7518) ([sundyli](https://github.com/sundy-li)) -- 添加 `constraints` 列到表 `system.settings` [\#7553](https://github.com/ClickHouse/ClickHouse/pull/7553) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- Tcp处理程序的更好的Null格式,以便可以使用 `select ignore() from table format Null` 通过clickhouse-client进行性能测量 [\#7606](https://github.com/ClickHouse/ClickHouse/pull/7606) ([阿莫斯鸟](https://github.com/amosbird)) -- 查询如 `CREATE TABLE ... AS (SELECT (1, 2))` 正确解析 [\#7542](https://github.com/ClickHouse/ClickHouse/pull/7542) ([hcz](https://github.com/hczhcz)) - -#### 性能改进 {#performance-improvement} - -- 改进了对短字符串键的聚合性能。 [\#6243](https://github.com/ClickHouse/ClickHouse/pull/6243) ([Alexander Kuzmenkov](https://github.com/akuzm), [阿莫斯鸟](https://github.com/amosbird)) -- 运行另一次语法/表达式分析以在常量谓词折叠后获得潜在的优化。 [\#7497](https://github.com/ClickHouse/ClickHouse/pull/7497) ([阿莫斯鸟](https://github.com/amosbird)) -- 使用存储元信息来评估琐碎 `SELECT count() FROM table;` [\#7510](https://github.com/ClickHouse/ClickHouse/pull/7510) ([阿莫斯鸟](https://github.com/amosbird), [阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 矢量化处理 `arrayReduce` 与聚合器类似 `addBatch`. [\#7608](https://github.com/ClickHouse/ClickHouse/pull/7608) ([阿莫斯鸟](https://github.com/amosbird)) -- 在性能的小改进 `Kafka` 消费 [\#7475](https://github.com/ClickHouse/ClickHouse/pull/7475) ([伊万](https://github.com/abyss7)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement} - -- 添加对交叉编译的支持到CPU架构AARCH64。 重构打包器脚本。 [\#7370](https://github.com/ClickHouse/ClickHouse/pull/7370) [\#7539](https://github.com/ClickHouse/ClickHouse/pull/7539) ([伊万](https://github.com/abyss7)) -- 在构建软件包时,将darwin-x86\_64和linux-aarch64工具链解压缩到已挂载的Docker卷中 [\#7534](https://github.com/ClickHouse/ClickHouse/pull/7534) ([伊万](https://github.com/abyss7)) -- 更新二进制打包器的Docker映像 [\#7474](https://github.com/ClickHouse/ClickHouse/pull/7474) ([伊万](https://github.com/abyss7)) -- 修复了MacOS Catalina上的编译错误 [\#7585](https://github.com/ClickHouse/ClickHouse/pull/7585) ([欧内斯特\*波列塔耶夫](https://github.com/ernestp)) -- 查询分析逻辑中的一些重构:将复杂的类拆分为几个简单的类。 [\#7454](https://github.com/ClickHouse/ClickHouse/pull/7454) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复没有子模块的构建 [\#7295](https://github.com/ClickHouse/ClickHouse/pull/7295) ([proller](https://github.com/proller)) -- 更好 `add_globs` 在CMake文件中 [\#7418](https://github.com/ClickHouse/ClickHouse/pull/7418) ([阿莫斯鸟](https://github.com/amosbird)) -- 删除硬编码路径 `unwind` 目标 [\#7460](https://github.com/ClickHouse/ClickHouse/pull/7460) ([Konstantin Podshumok](https://github.com/podshumok)) -- 允许在没有ssl的情况下使用mysql格式 [\#7524](https://github.com/ClickHouse/ClickHouse/pull/7524) ([proller](https://github.com/proller)) - -#### 其他 {#other} - -- 为ClickHouse SQL方言添加了ANTLR4语法 [\#7595](https://github.com/ClickHouse/ClickHouse/issues/7595) [\#7596](https://github.com/ClickHouse/ClickHouse/pull/7596) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -## 碌莽禄.拢.0755-88888888 {#clickhouse-release-v19-16} - -#### ClickHouse版本v19.16.14.65,2020-03-25 {#clickhouse-release-v19-16-14-65-2020-03-25} - -- 修复了多个参数(超过10)的三元逻辑运算批量计算中的错误。 [\#8718](https://github.com/ClickHouse/ClickHouse/pull/8718) ([亚历山大\*卡扎科夫](https://github.com/Akazz))这个错误修正是由Altinity的特殊要求回移到版本19.16的。 - -#### ClickHouse释放v19.16.14.65,2020-03-05 {#clickhouse-release-v19-16-14-65-2020-03-05} - -- 修复分布式子查询与旧版本的CH不兼容。 修复 [\#7851](https://github.com/ClickHouse/ClickHouse/issues/7851) - [(tabplubix)](https://github.com/tavplubix) -- 执行时 `CREATE` 查询,在存储引擎参数中折叠常量表达式。 将空数据库名称替换为当前数据库。 修复 [\#6508](https://github.com/ClickHouse/ClickHouse/issues/6508), [\#3492](https://github.com/ClickHouse/ClickHouse/issues/3492). 还修复检查本地地址 `ClickHouseDictionarySource`. - [\#9262](https://github.com/ClickHouse/ClickHouse/pull/9262) [(tabplubix)](https://github.com/tavplubix) -- 现在背景合并 `*MergeTree` 表引擎家族更准确地保留存储策略卷顺序。 - [\#8549](https://github.com/ClickHouse/ClickHouse/pull/8549) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 防止丢失数据 `Kafka` 在极少数情况下,在读取后缀之后但在提交之前发生异常。 修复 [\#9378](https://github.com/ClickHouse/ClickHouse/issues/9378). 相关: [\#7175](https://github.com/ClickHouse/ClickHouse/issues/7175) - [\#9507](https://github.com/ClickHouse/ClickHouse/pull/9507) [(菲利蒙诺夫)](https://github.com/filimonov) -- 修复尝试使用/删除时导致服务器终止的错误 `Kafka` 使用错误的参数创建的表。 修复 [\#9494](https://github.com/ClickHouse/ClickHouse/issues/9494). 结合 [\#9507](https://github.com/ClickHouse/ClickHouse/issues/9507). - [\#9513](https://github.com/ClickHouse/ClickHouse/pull/9513) [(菲利蒙诺夫)](https://github.com/filimonov) -- 允许使用 `MaterializedView` 与上面的子查询 `Kafka` 桌子 - [\#8197](https://github.com/ClickHouse/ClickHouse/pull/8197) ([filimonov](https://github.com/filimonov)) - -#### 新功能 {#new-feature-1} - -- 添加 `deduplicate_blocks_in_dependent_materialized_views` 用于控制具有实例化视图的表中幂等插入的行为的选项。 这个新功能是由Altinity的特殊要求添加到错误修正版本中的。 - [\#9070](https://github.com/ClickHouse/ClickHouse/pull/9070) [(urykhy)](https://github.com/urykhy) - -### ClickHouse发布版本v19.16.2.2,2019-10-30 {#clickhouse-release-v19-16-2-2-2019-10-30} - -#### 向后不兼容的更改 {#backward-incompatible-change-1} - -- 为count/counIf添加缺失的验证。 - [\#7095](https://github.com/ClickHouse/ClickHouse/issues/7095) - [\#7298](https://github.com/ClickHouse/ClickHouse/pull/7298) ([Vdimir](https://github.com/Vdimir)) -- 删除旧版 `asterisk_left_columns_only` 设置(默认情况下禁用)。 - [\#7335](https://github.com/ClickHouse/ClickHouse/pull/7335) ([阿尔乔姆 - Zuikov](https://github.com/4ertus2)) -- 模板数据格式的格式字符串现在在文件中指定。 - [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) - -#### 新功能 {#new-feature-2} - -- 引入uniqCombined64()来计算大于UINT\_MAX的基数。 - [\#7213](https://github.com/ClickHouse/ClickHouse/pull/7213), - [\#7222](https://github.com/ClickHouse/ClickHouse/pull/7222) ([Azat - Khuzhin](https://github.com/azat)) -- 支持数组列上的Bloom filter索引。 - [\#6984](https://github.com/ClickHouse/ClickHouse/pull/6984) - ([achimbab](https://github.com/achimbab)) -- 添加函数 `getMacro(name)` 返回与相应值的字符串 `` - 从服务器配置. [\#7240](https://github.com/ClickHouse/ClickHouse/pull/7240) - ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 为基于HTTP源的字典设置两个配置选项: `credentials` 和 - `http-headers`. [\#7092](https://github.com/ClickHouse/ClickHouse/pull/7092) ([纪尧姆 - Tassery](https://github.com/YiuRULE)) -- 添加新的ProfileEvent `Merge` 这计算启动的背景合并的数量。 - [\#7093](https://github.com/ClickHouse/ClickHouse/pull/7093) ([米哈伊尔 - 科罗托夫](https://github.com/millb)) -- 添加返回完全限定域名的fullHostName函数。 - [\#7263](https://github.com/ClickHouse/ClickHouse/issues/7263) - [\#7291](https://github.com/ClickHouse/ClickHouse/pull/7291) ([sundyli](https://github.com/sundy-li)) -- 添加功能 `arraySplit` 和 `arrayReverseSplit` 通过拆分数组 “cut off” - 条件。 它们在时间序列处理中非常有用。 - [\#7294](https://github.com/ClickHouse/ClickHouse/pull/7294) ([hcz](https://github.com/hczhcz)) -- 添加返回multiMatch函数系列中所有匹配索引的数组的新函数。 - [\#7299](https://github.com/ClickHouse/ClickHouse/pull/7299) ([Danila - 库特宁](https://github.com/danlark1)) -- 添加新的数据库引擎 `Lazy` 即针对存储大量小日志进行了优化 - 桌子 [\#7171](https://github.com/ClickHouse/ClickHouse/pull/7171) ([尼基塔 - Vasilev](https://github.com/nikvas0)) -- 为位图列添加聚合函数groupBitmapAnd,-或-Xor。 [\#7109](https://github.com/ClickHouse/ClickHouse/pull/7109) ([知昌 - 阿优](https://github.com/yuzhichang)) -- 添加聚合函数组合器-OrNull和-OrDefault,它们返回null - 或默认值时没有任何聚合。 - [\#7331](https://github.com/ClickHouse/ClickHouse/pull/7331) - ([hcz](https://github.com/hczhcz)) -- 引入支持自定义转义的CustomSeparated数据格式 - 分隔符规则。 [\#7118](https://github.com/ClickHouse/ClickHouse/pull/7118) - ([tavplubix](https://github.com/tavplubix)) -- 支持Redis作为外部字典的来源。 [\#4361](https://github.com/ClickHouse/ClickHouse/pull/4361) [\#6962](https://github.com/ClickHouse/ClickHouse/pull/6962) ([comunodi](https://github.com/comunodi), [安东 - 波波夫](https://github.com/CurtizJ)) - -#### 错误修复 {#bug-fix-2} - -- 修复错误的查询结果,如果它有 `WHERE IN (SELECT ...)` 部分和 `optimize_read_in_order` 是 - 使用。 [\#7371](https://github.com/ClickHouse/ClickHouse/pull/7371) ([安东 - 波波夫](https://github.com/CurtizJ)) -- 禁用MariaDB身份验证插件,这取决于项目之外的文件。 - [\#7140](https://github.com/ClickHouse/ClickHouse/pull/7140) ([尤里 - 巴拉诺夫](https://github.com/yurriy)) -- 修复异常 `Cannot convert column ... because it is constant but values of constants are different in source and result` 这可能很少发生,当功能 `now()`, `today()`, - `yesterday()`, `randConstant()` 被使用。 - [\#7156](https://github.com/ClickHouse/ClickHouse/pull/7156) ([尼古拉 - Kochetov](https://github.com/KochetovNicolai)) -- 修复了使用HTTP保持活动超时而不是TCP保持活动超时的问题。 - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([瓦西里 - Nemkov](https://github.com/Enmk)) -- 修复了groupBitmapOr中的分段错误(问题 [\#7109](https://github.com/ClickHouse/ClickHouse/issues/7109)). - [\#7289](https://github.com/ClickHouse/ClickHouse/pull/7289) ([知昌 - 阿优](https://github.com/yuzhichang)) -- 对于实例化视图,在写入所有数据之后调用kafka的提交。 - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([伊万](https://github.com/abyss7)) -- 修复错误 `duration_ms` 值 `system.part_log` 桌子 这是十次关闭。 - [\#7172](https://github.com/ClickHouse/ClickHouse/pull/7172) ([弗拉基米尔 - Chebotarev](https://github.com/excitoon)) -- 快速修复解决实时查看表中的崩溃并重新启用所有实时查看测试。 - [\#7201](https://github.com/ClickHouse/ClickHouse/pull/7201) - ([vzakaznikov](https://github.com/vzakaznikov)) -- 在MergeTree部件的最小/最大索引中正确序列化NULL值。 - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([亚历山大 - 库兹门科夫](https://github.com/akuzm)) -- 不要把虚拟列。创建表时的sql元数据 `CREATE TABLE AS`. - [\#7183](https://github.com/ClickHouse/ClickHouse/pull/7183) ([伊万](https://github.com/abyss7)) -- 修复分段故障 `ATTACH PART` 查询。 - [\#7185](https://github.com/ClickHouse/ClickHouse/pull/7185) - ([阿利沙平](https://github.com/alesapin)) -- 修复了子查询中empty和empty优化给出的某些查询的错误结果 - INNER/RIGHT JOIN. [\#7284](https://github.com/ClickHouse/ClickHouse/pull/7284) ([尼古拉 - Kochetov](https://github.com/KochetovNicolai)) -- 修复LIVE VIEW getHeader()方法中的AddressSanitizer错误。 - [\#7271](https://github.com/ClickHouse/ClickHouse/pull/7271) - ([vzakaznikov](https://github.com/vzakaznikov)) - -#### 改进 {#improvement-1} - -- 在queue\_wait\_max\_ms等待发生的情况下添加消息。 - [\#7390](https://github.com/ClickHouse/ClickHouse/pull/7390) ([Azat - Khuzhin](https://github.com/azat)) -- 制作设置 `s3_min_upload_part_size` 表级别。 - [\#7059](https://github.com/ClickHouse/ClickHouse/pull/7059) ([弗拉基米尔 - Chebotarev](https://github.com/excitoon)) -- 检查Ttl在StorageFactory。 [\#7304](https://github.com/ClickHouse/ClickHouse/pull/7304) - ([sundyli](https://github.com/sundy-li)) -- 在部分合并连接(优化)中压缩左侧块。 - [\#7122](https://github.com/ClickHouse/ClickHouse/pull/7122) ([阿尔乔姆 - Zuikov](https://github.com/4ertus2)) -- 不允许在复制表引擎的突变中使用非确定性函数,因为这 - 可能会在副本之间引入不一致。 - [\#7247](https://github.com/ClickHouse/ClickHouse/pull/7247) ([亚历山大 - 卡扎科夫](https://github.com/Akazz)) -- 将异常堆栈跟踪转换为字符串时禁用内存跟踪器。 它可以防止损失 - 类型的错误消息 `Memory limit exceeded` 在服务器上,这导致了 `Attempt to read after eof` 客户端上的例外。 [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) - ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 其他格式改进。 决定 - [\#6033](https://github.com/ClickHouse/ClickHouse/issues/6033), - [\#2633](https://github.com/ClickHouse/ClickHouse/issues/2633), - [\#6611](https://github.com/ClickHouse/ClickHouse/issues/6611), - [\#6742](https://github.com/ClickHouse/ClickHouse/issues/6742) - [\#7215](https://github.com/ClickHouse/ClickHouse/pull/7215) - ([tavplubix](https://github.com/tavplubix)) -- ClickHouse将忽略IN运算符右侧不可转换为左侧的值 - side type. Make it work properly for compound types – Array and Tuple. - [\#7283](https://github.com/ClickHouse/ClickHouse/pull/7283) ([亚历山大 - 库兹门科夫](https://github.com/akuzm)) -- 支持ASOF加入缺失的不平等。 它可以加入小于或等于变体和严格 - 在语法上,ASOF列的变体越来越多。 - [\#7282](https://github.com/ClickHouse/ClickHouse/pull/7282) ([阿尔乔姆 - Zuikov](https://github.com/4ertus2)) -- 优化部分合并连接。 [\#7070](https://github.com/ClickHouse/ClickHouse/pull/7070) - ([Artem Zuikov](https://github.com/4ertus2)) -- 不要在uniqCombined函数中使用超过98K的内存。 - [\#7236](https://github.com/ClickHouse/ClickHouse/pull/7236), - [\#7270](https://github.com/ClickHouse/ClickHouse/pull/7270) ([Azat - Khuzhin](https://github.com/azat)) -- 在PartialMergeJoin中刷新磁盘上右连接表的部分(如果没有足够的 - 记忆)。 需要时加载数据。 [\#7186](https://github.com/ClickHouse/ClickHouse/pull/7186) - ([Artem Zuikov](https://github.com/4ertus2)) - -#### 性能改进 {#performance-improvement-1} - -- 通过避免数据重复加快使用const参数的joinGet。 - [\#7359](https://github.com/ClickHouse/ClickHouse/pull/7359) ([阿莫斯 - 鸟](https://github.com/amosbird)) -- 如果子查询为空,请提前返回。 - [\#7007](https://github.com/ClickHouse/ClickHouse/pull/7007) ([小路](https://github.com/nicelulu)) -- 优化值中SQL表达式的解析。 - [\#6781](https://github.com/ClickHouse/ClickHouse/pull/6781) - ([tavplubix](https://github.com/tavplubix)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-1} - -- 禁用交叉编译到Mac OS的一些贡献。 - [\#7101](https://github.com/ClickHouse/ClickHouse/pull/7101) ([伊万](https://github.com/abyss7)) -- 为clickhouse\_common\_io添加与PocoXML缺少的链接。 - [\#7200](https://github.com/ClickHouse/ClickHouse/pull/7200) ([Azat - Khuzhin](https://github.com/azat)) -- 在clickhouse-test中接受多个测试过滤器参数。 - [\#7226](https://github.com/ClickHouse/ClickHouse/pull/7226) ([亚历山大 - 库兹门科夫](https://github.com/akuzm)) -- 为ARM启用musl和jemalloc。 [\#7300](https://github.com/ClickHouse/ClickHouse/pull/7300) - ([阿莫斯鸟](https://github.com/amosbird)) -- 已添加 `--client-option` 参数 `clickhouse-test` 将其他参数传递给客户端。 - [\#7277](https://github.com/ClickHouse/ClickHouse/pull/7277) ([尼古拉 - Kochetov](https://github.com/KochetovNicolai)) -- 在rpm软件包升级时保留现有配置。 - [\#7103](https://github.com/ClickHouse/ClickHouse/pull/7103) - ([filimonov](https://github.com/filimonov)) -- 修复PVS检测到的错误。 [\#7153](https://github.com/ClickHouse/ClickHouse/pull/7153) ([阿尔乔姆 - Zuikov](https://github.com/4ertus2)) -- 修复达尔文的构建。 [\#7149](https://github.com/ClickHouse/ClickHouse/pull/7149) - ([伊万](https://github.com/abyss7)) -- glibc2.29兼容性. [\#7142](https://github.com/ClickHouse/ClickHouse/pull/7142) ([阿莫斯 - 鸟](https://github.com/amosbird)) -- 确保dh\_clean不会触及潜在的源文件。 - [\#7205](https://github.com/ClickHouse/ClickHouse/pull/7205) ([阿莫斯 - 鸟](https://github.com/amosbird)) -- 尝试避免从altinity rpm更新时发生冲突-它有单独打包的配置文件 - 在clickhouse服务器-常见. [\#7073](https://github.com/ClickHouse/ClickHouse/pull/7073) - ([filimonov](https://github.com/filimonov)) -- 优化一些头文件,以便更快地重建。 - [\#7212](https://github.com/ClickHouse/ClickHouse/pull/7212), - [\#7231](https://github.com/ClickHouse/ClickHouse/pull/7231) ([亚历山大 - 库兹门科夫](https://github.com/akuzm)) -- 添加日期和日期时间的性能测试。 [\#7332](https://github.com/ClickHouse/ClickHouse/pull/7332) ([瓦西里 - Nemkov](https://github.com/Enmk)) -- 修复一些包含非确定性突变的测试。 - [\#7132](https://github.com/ClickHouse/ClickHouse/pull/7132) ([亚历山大 - 卡扎科夫](https://github.com/Akazz)) -- 添加构建与MemorySanitizer CI。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) - ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 避免在MetricsTransmitter中使用未初始化的值。 - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat - Khuzhin](https://github.com/azat)) -- 修复MemorySanitizer发现的字段中的一些问题。 - [\#7135](https://github.com/ClickHouse/ClickHouse/pull/7135), - [\#7179](https://github.com/ClickHouse/ClickHouse/pull/7179) ([亚历山大 - 库兹门科夫](https://github.com/akuzm)), [\#7376](https://github.com/ClickHouse/ClickHouse/pull/7376) - ([阿莫斯鸟](https://github.com/amosbird)) -- 修复murmurhash32中未定义的行为。 [\#7388](https://github.com/ClickHouse/ClickHouse/pull/7388) ([阿莫斯 - 鸟](https://github.com/amosbird)) -- 修复StoragesInfoStream中未定义的行为。 [\#7384](https://github.com/ClickHouse/ClickHouse/pull/7384) - ([tavplubix](https://github.com/tavplubix)) -- 固定常量表达式折叠外部数据库引擎(MySQL,ODBC,JDBC)。 在上一页 - 版本它不适用于多个常量表达式,并且根本不适用于日期, - 日期时间和UUID。 这修复 [\#7245](https://github.com/ClickHouse/ClickHouse/issues/7245) - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) - ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在访问no\_users\_thread变量时修复实时查看中的ThreadSanitizer数据竞争错误。 - [\#7353](https://github.com/ClickHouse/ClickHouse/pull/7353) - ([vzakaznikov](https://github.com/vzakaznikov)) -- 在libcommon中摆脱malloc符号 - [\#7134](https://github.com/ClickHouse/ClickHouse/pull/7134), - [\#7065](https://github.com/ClickHouse/ClickHouse/pull/7065) ([阿莫斯 - 鸟](https://github.com/amosbird)) -- 添加全局标志ENABLE\_LIBRARY以禁用所有库。 - [\#7063](https://github.com/ClickHouse/ClickHouse/pull/7063) - ([proller](https://github.com/proller)) - -#### 代码清理 {#code-cleanup} - -- 概括配置存储库以准备字典的DDL。 [\#7155](https://github.com/ClickHouse/ClickHouse/pull/7155) - ([阿利沙平](https://github.com/alesapin)) -- 解析器字典DDL没有任何语义。 - [\#7209](https://github.com/ClickHouse/ClickHouse/pull/7209) - ([阿利沙平](https://github.com/alesapin)) -- 将ParserCreateQuery拆分为不同的较小的解析器。 - [\#7253](https://github.com/ClickHouse/ClickHouse/pull/7253) - ([阿利沙平](https://github.com/alesapin)) -- 在外部字典附近进行小型重构和重命名。 - [\#7111](https://github.com/ClickHouse/ClickHouse/pull/7111) - ([阿利沙平](https://github.com/alesapin)) -- 重构一些代码以准备基于角色的访问控制。 [\#7235](https://github.com/ClickHouse/ClickHouse/pull/7235) ([维塔利 - 巴拉诺夫](https://github.com/vitlibar)) -- DatabaseOrdinary代码中的一些改进。 - [\#7086](https://github.com/ClickHouse/ClickHouse/pull/7086) ([尼基塔 - Vasilev](https://github.com/nikvas0)) -- 不要在哈希表的find()和emplace()方法中使用迭代器。 - [\#7026](https://github.com/ClickHouse/ClickHouse/pull/7026) ([亚历山大 - 库兹门科夫](https://github.com/akuzm)) -- 修正getMultipleValuesFromConfig的情况下,当参数根不为空。 [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) - ([米哈伊尔\*科罗托夫](https://github.com/millb)) -- 删除一些复制粘贴(TemporaryFile和TemporaryFileStream) - [\#7166](https://github.com/ClickHouse/ClickHouse/pull/7166) ([阿尔乔姆 - Zuikov](https://github.com/4ertus2)) -- 改进了代码的可读性一点点 (`MergeTreeData::getActiveContainingPart`). - [\#7361](https://github.com/ClickHouse/ClickHouse/pull/7361) ([弗拉基米尔 - Chebotarev](https://github.com/excitoon)) -- 等待使用本地对象的所有计划作业,如果 `ThreadPool::schedule(...)` 投掷 - 一个例外 重命名 `ThreadPool::schedule(...)` 到 `ThreadPool::scheduleOrThrowOnError(...)` 和 - 修复注释,使明显的,它可能会抛出。 - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) - ([tavplubix](https://github.com/tavplubix)) - -## ClickHouse释放19.15 {#clickhouse-release-19-15} - -### ClickHouse释放19.15.4.10,2019-10-31 {#clickhouse-release-19-15-4-10-2019-10-31} - -#### 错误修复 {#bug-fix-3} - -- 增加了sql\_tinyint和SQL\_BIGINT的处理,并修复了ODBC桥中SQL\_FLOAT数据源类型的处理。 - [\#7491](https://github.com/ClickHouse/ClickHouse/pull/7491) ([Denis Glazachev](https://github.com/traceon)) -- 允许在移动分区中的目标磁盘或卷上有一些部分。 - [\#7434](https://github.com/ClickHouse/ClickHouse/pull/7434) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 通过ODBC桥固定可空列中的NULL值。 - [\#7402](https://github.com/ClickHouse/ClickHouse/pull/7402) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 固定插入到具体化列的分布式非本地节点。 - [\#7377](https://github.com/ClickHouse/ClickHouse/pull/7377) ([Azat Khuzhin](https://github.com/azat)) -- 固定函数getMultipleValuesFromConfig。 - [\#7374](https://github.com/ClickHouse/ClickHouse/pull/7374) ([米哈伊尔\*科罗托夫](https://github.com/millb)) -- 修复了使用HTTP保持活动超时而不是TCP保持活动超时的问题。 - [\#7351](https://github.com/ClickHouse/ClickHouse/pull/7351) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 等待所有作业在异常时完成(修复罕见的段错误)。 - [\#7350](https://github.com/ClickHouse/ClickHouse/pull/7350) ([tavplubix](https://github.com/tavplubix)) -- 在插入Kafka表时不要推送MVs。 - [\#7265](https://github.com/ClickHouse/ClickHouse/pull/7265) ([伊万](https://github.com/abyss7)) -- 禁用异常堆栈的内存跟踪器。 - [\#7264](https://github.com/ClickHouse/ClickHouse/pull/7264) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复了外部数据库转换查询中的错误代码。 - [\#7252](https://github.com/ClickHouse/ClickHouse/pull/7252) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 避免在MetricsTransmitter中使用未初始化的值。 - [\#7158](https://github.com/ClickHouse/ClickHouse/pull/7158) ([Azat Khuzhin](https://github.com/azat)) -- 添加了用于测试的宏的示例配置 ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### ClickHouse释放19.15.3.6,2019-10-09 {#clickhouse-release-19-15-3-6-2019-10-09} - -#### 错误修复 {#bug-fix-4} - -- 修正了哈希字典中的bad\_variant。 - ([阿利沙平](https://github.com/alesapin)) -- 修复了附加部件查询中分段故障的错误。 - ([阿利沙平](https://github.com/alesapin)) -- 固定时间计算 `MergeTreeData`. - ([Vladimir Chebotarev](https://github.com/excitoon)) -- 写作完成后明确提交给Kafka。 - [\#7175](https://github.com/ClickHouse/ClickHouse/pull/7175) ([伊万](https://github.com/abyss7)) -- 在MergeTree部件的最小/最大索引中正确序列化NULL值。 - [\#7234](https://github.com/ClickHouse/ClickHouse/pull/7234) ([Alexander Kuzmenkov](https://github.com/akuzm)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-15-2-2-2019-10-01} - -#### 新功能 {#new-feature-3} - -- 分层存储:支持使用MergeTree引擎对表使用多个存储卷。 可以将新数据存储在SSD上,并自动将旧数据移动到HDD。 ([示例](https://clickhouse.github.io/clickhouse-presentations/meetup30/new_features/#12)). [\#4918](https://github.com/ClickHouse/ClickHouse/pull/4918) ([Igr](https://github.com/ObjatieGroba)) [\#6489](https://github.com/ClickHouse/ClickHouse/pull/6489) ([阿利沙平](https://github.com/alesapin)) -- 添加表函数 `input` 用于读取传入的数据 `INSERT SELECT` 查询。 [\#5450](https://github.com/ClickHouse/ClickHouse/pull/5450) ([palasonic1](https://github.com/palasonic1)) [\#6832](https://github.com/ClickHouse/ClickHouse/pull/6832) ([安东\*波波夫](https://github.com/CurtizJ)) -- 添加一个 `sparse_hashed` 字典布局,即在功能上等同于 `hashed` 布局,但更高效的内存。 它使用的内存减少了大约两倍,代价是较慢的值检索。 [\#6894](https://github.com/ClickHouse/ClickHouse/pull/6894) ([Azat Khuzhin](https://github.com/azat)) -- 实现定义用户列表以访问字典的能力。 仅使用当前连接的数据库。 [\#6907](https://github.com/ClickHouse/ClickHouse/pull/6907) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 添加 `LIMIT` 选项 `SHOW` 查询。 [\#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- 添加 `bitmapSubsetLimit(bitmap, range_start, limit)` 函数,返回最小的子集 `limit` 设置中的值不小于 `range_start`. [\#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([余志昌](https://github.com/yuzhichang)) -- 添加 `bitmapMin` 和 `bitmapMax` 功能。 [\#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([余志昌](https://github.com/yuzhichang)) -- 添加功能 `repeat` 有关 [问题-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [\#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([弗林](https://github.com/ucasFL)) - -#### 实验特点 {#experimental-feature-1} - -- 实现(在内存中)不更改当前管道的合并联接变体。 结果按合并键进行部分排序。 设置 `partial_merge_join = 1` 要使用此功能。 合并联接仍在开发中。 [\#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2)) -- 添加 `S3` 发动机和表功能. 它仍在开发中(还没有身份验证支持)。 [\#5596](https://github.com/ClickHouse/ClickHouse/pull/5596) ([Vladimir Chebotarev](https://github.com/excitoon)) - -#### 改进 {#improvement-2} - -- 从Kafka读取的每条消息都是以原子方式插入的。 这解决了Kafka引擎的几乎所有已知问题。 [\#6950](https://github.com/ClickHouse/ClickHouse/pull/6950) ([伊万](https://github.com/abyss7)) -- 对分布式查询故障转移的改进。 缩短恢复时间,也是现在可配置的,可以看出 `system.clusters`. [\#6399](https://github.com/ClickHouse/ClickHouse/pull/6399) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 直接支持枚举的数值 `IN` 科。 \#6766 [\#6941](https://github.com/ClickHouse/ClickHouse/pull/6941) ([dimarub2000](https://github.com/dimarub2000)) -- 支持(可选,默认情况下禁用)对URL存储进行重定向。 [\#6914](https://github.com/ClickHouse/ClickHouse/pull/6914) ([maqroll](https://github.com/maqroll)) -- 当具有较旧版本的客户端连接到服务器时添加信息消息。 [\#6893](https://github.com/ClickHouse/ClickHouse/pull/6893) ([Philipp Malkovsky](https://github.com/malkfilipp)) -- 删除在分布式表中发送数据的最大退避睡眠时间限制 [\#6895](https://github.com/ClickHouse/ClickHouse/pull/6895) ([Azat Khuzhin](https://github.com/azat)) -- 添加将配置文件事件(计数器)与累积值发送到graphite的能力。 它可以在启用 `` 在服务器 `config.xml`. [\#6969](https://github.com/ClickHouse/ClickHouse/pull/6969) ([Azat Khuzhin](https://github.com/azat)) -- 添加自动转换类型 `T` 到 `LowCardinality(T)` 在类型的列中插入数据 `LowCardinality(T)` 在本机格式通过HTTP。 [\#6891](https://github.com/ClickHouse/ClickHouse/pull/6891) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 添加使用功能的能力 `hex` 不使用 `reinterpretAsString` 为 `Float32`, `Float64`. [\#7024](https://github.com/ClickHouse/ClickHouse/pull/7024) ([米哈伊尔\*科罗托夫](https://github.com/millb)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-2} - -- 将gdb-index添加到带有调试信息的clickhouse二进制文件。 这将加快启动时间 `gdb`. [\#6947](https://github.com/ClickHouse/ClickHouse/pull/6947) ([阿利沙平](https://github.com/alesapin)) -- 加速deb包装与补丁dpkg-deb它使用 `pigz`. [\#6960](https://github.com/ClickHouse/ClickHouse/pull/6960) ([阿利沙平](https://github.com/alesapin)) -- 设置 `enable_fuzzing = 1` 启用所有项目代码的libfuzzer检测功能。 [\#7042](https://github.com/ClickHouse/ClickHouse/pull/7042) ([kyprizel](https://github.com/kyprizel)) -- 在CI中添加拆分构建烟雾测试。 [\#7061](https://github.com/ClickHouse/ClickHouse/pull/7061) ([阿利沙平](https://github.com/alesapin)) -- 添加构建与MemorySanitizer CI。 [\#7066](https://github.com/ClickHouse/ClickHouse/pull/7066) ([Alexander Kuzmenkov](https://github.com/akuzm)) -- 替换 `libsparsehash` 与 `sparsehash-c11` [\#6965](https://github.com/ClickHouse/ClickHouse/pull/6965) ([Azat Khuzhin](https://github.com/azat)) - -#### 错误修复 {#bug-fix-5} - -- 修复了大型表上复杂键的索引分析的性能下降。 这修复了#6924。 [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复从Kafka空主题中选择时导致段错误的逻辑错误。 [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([伊万](https://github.com/abyss7)) -- 修复过早的MySQL连接关闭 `MySQLBlockInputStream.cpp`. [\#6882](https://github.com/ClickHouse/ClickHouse/pull/6882) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- 返回对非常旧的Linux内核的支持(修复 [\#6841](https://github.com/ClickHouse/ClickHouse/issues/6841)) [\#6853](https://github.com/ClickHouse/ClickHouse/pull/6853) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复可能的数据丢失 `insert select` 在输入流中的空块的情况下进行查询。 \#6834 \#6862 [\#6911](https://github.com/ClickHouse/ClickHouse/pull/6911) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复功能 `АrrayEnumerateUniqRanked` 在参数中使用空数组 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- 使用数组联接和全局子查询修复复杂的查询。 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([伊万](https://github.com/abyss7)) -- 修复 `Unknown identifier` 按顺序排列和按多个联接分组的错误 [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定 `MSan` 执行函数时发出警告 `LowCardinality` 争论。 [\#7062](https://github.com/ClickHouse/ClickHouse/pull/7062) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) - -#### 向后不兼容的更改 {#backward-incompatible-change-2} - -- 更改了位图\*聚合函数状态的序列化格式,以提高性能。 无法读取以前版本的位图\*的序列化状态。 [\#6908](https://github.com/ClickHouse/ClickHouse/pull/6908) ([余志昌](https://github.com/yuzhichang)) - -## ClickHouse释放19.14 {#clickhouse-release-19-14} - -### ClickHouse释放19.14.7.15,2019-10-02 {#clickhouse-release-19-14-7-15-2019-10-02} - -#### 错误修复 {#bug-fix-6} - -- 此版本还包含19.11.12.69的所有错误修复。 -- 修复了19.14和早期版本之间分布式查询的兼容性。 这修复 [\#7068](https://github.com/ClickHouse/ClickHouse/issues/7068). [\#7069](https://github.com/ClickHouse/ClickHouse/pull/7069) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### ClickHouse释放19.14.6.12,2019-09-19 {#clickhouse-release-19-14-6-12-2019-09-19} - -#### 错误修复 {#bug-fix-7} - -- 修复功能 `АrrayEnumerateUniqRanked` 在参数中使用空数组。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) -- 修复了查询中的子查询名称 `ARRAY JOIN` 和 `GLOBAL IN subquery` 用化名。 如果指定了外部表名,请使用子查询别名。 [\#6934](https://github.com/ClickHouse/ClickHouse/pull/6934) ([伊万](https://github.com/abyss7)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-3} - -- 修复 [拍打](https://clickhouse-test-reports.s3.yandex.net/6944/aab95fd5175a513413c7395a73a82044bdafb906/functional_stateless_tests_(debug).html) 测试 `00715_fetch_merged_or_mutated_part_zookeeper` 通过将其重写为shell脚本,因为它需要等待突变应用。 [\#6977](https://github.com/ClickHouse/ClickHouse/pull/6977) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) -- 修正了UBSan和MemSan功能失败 `groupUniqArray` 使用emtpy数组参数。 这是由于放置空 `PaddedPODArray` 因为没有调用零单元格值的构造函数,所以将其转换为哈希表零单元格。 [\#6937](https://github.com/ClickHouse/ClickHouse/pull/6937) ([阿莫斯鸟](https://github.com/amosbird)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-14-3-3-2019-09-10} - -#### 新功能 {#new-feature-4} - -- `WITH FILL` 修饰符 `ORDER BY`. (继续 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([安东\*波波夫](https://github.com/CurtizJ)) -- `WITH TIES` 修饰符 `LIMIT`. (继续 [\#5069](https://github.com/ClickHouse/ClickHouse/issues/5069)) [\#6610](https://github.com/ClickHouse/ClickHouse/pull/6610) ([安东\*波波夫](https://github.com/CurtizJ)) -- 解析无引号 `NULL` 文字为NULL(如果设置 `format_csv_unquoted_null_literal_as_null=1`). 如果此字段的数据类型不可为空,则使用默认值初始化null字段(如果设置 `input_format_null_as_default=1`). [\#5990](https://github.com/ClickHouse/ClickHouse/issues/5990) [\#6055](https://github.com/ClickHouse/ClickHouse/pull/6055) ([tavplubix](https://github.com/tavplubix)) -- 支持表函数路径中的通配符 `file` 和 `hdfs`. 如果路径包含通配符,则表将为只读。 使用示例: `select * from hdfs('hdfs://hdfs1:9000/some_dir/another_dir/*/file{0..9}{0..9}')` 和 `select * from file('some_dir/{some_file,another_file,yet_another}.tsv', 'TSV', 'value UInt32')`. [\#6092](https://github.com/ClickHouse/ClickHouse/pull/6092) ([Olga Khvostikova](https://github.com/stavrolia)) -- 新 `system.metric_log` 表存储的值 `system.events` 和 `system.metrics` 具有指定的时间间隔。 [\#6363](https://github.com/ClickHouse/ClickHouse/issues/6363) [\#6467](https://github.com/ClickHouse/ClickHouse/pull/6467) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) [\#6530](https://github.com/ClickHouse/ClickHouse/pull/6530) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 允许将ClickHouse文本日志写入 `system.text_log` 桌子 [\#6037](https://github.com/ClickHouse/ClickHouse/issues/6037) [\#6103](https://github.com/ClickHouse/ClickHouse/pull/6103) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) [\#6164](https://github.com/ClickHouse/ClickHouse/pull/6164) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在堆栈跟踪中显示私有符号(这是通过解析ELF文件的符号表来完成的)。 如果存在调试信息,则在堆栈跟踪中添加有关文件和行号的信息。 使用程序中存在的索引符号加速符号名称查找。 增加了新的SQL函数的反省: `demangle` 和 `addressToLine`. 重命名函数 `symbolizeAddress` 到 `addressToSymbol` 为了一致性。 功能 `addressToSymbol` 将返回错位的名称出于性能原因,你必须申请 `demangle`. 添加设置 `allow_introspection_functions` 默认情况下,这是关闭的。 [\#6201](https://github.com/ClickHouse/ClickHouse/pull/6201) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 表函数 `values` (名称不区分大小写)。 它允许从读取 `VALUES` 建议的名单 [\#5984](https://github.com/ClickHouse/ClickHouse/issues/5984). 示例: `SELECT * FROM VALUES('a UInt64, s String', (1, 'one'), (2, 'two'), (3, 'three'))`. [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) -- 增加了改变存储设置的功能。 语法: `ALTER TABLE
MODIFY SETTING = `. [\#6366](https://github.com/ClickHouse/ClickHouse/pull/6366) [\#6669](https://github.com/ClickHouse/ClickHouse/pull/6669) [\#6685](https://github.com/ClickHouse/ClickHouse/pull/6685) ([阿利沙平](https://github.com/alesapin)) -- 用于拆卸分离部件的支撑。 语法: `ALTER TABLE DROP DETACHED PART ''`. [\#6158](https://github.com/ClickHouse/ClickHouse/pull/6158) ([tavplubix](https://github.com/tavplubix)) -- 表约束。 允许将约束添加到将在插入时检查的表定义。 [\#5273](https://github.com/ClickHouse/ClickHouse/pull/5273) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) [\#6652](https://github.com/ClickHouse/ClickHouse/pull/6652) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 支持级联实例化视图。 [\#6324](https://github.com/ClickHouse/ClickHouse/pull/6324) ([阿莫斯鸟](https://github.com/amosbird)) -- 默认情况下,打开查询探查器以每秒对每个查询执行线程进行一次采样。 [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 输入格式 `ORC`. [\#6454](https://github.com/ClickHouse/ClickHouse/pull/6454) [\#6703](https://github.com/ClickHouse/ClickHouse/pull/6703) ([akonyaev90](https://github.com/akonyaev90)) -- 增加了两个新功能: `sigmoid` 和 `tanh` (这对于机器学习应用程序非常有用)。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 功能 `hasToken(haystack, token)`, `hasTokenCaseInsensitive(haystack, token)` 检查给定的令牌是否在干草堆中。 Token是两个非字母数字ASCII字符(或干草堆的边界)之间的最大长度子串。 Token必须是常量字符串。 由tokenbf\_v1索引专业化支持。 [\#6596](https://github.com/ClickHouse/ClickHouse/pull/6596), [\#6662](https://github.com/ClickHouse/ClickHouse/pull/6662) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 新功能 `neighbor(value, offset[, default_value])`. 允许在一个数据块中的列中达到上一个/下一个值。 [\#5925](https://github.com/ClickHouse/ClickHouse/pull/5925) ([Alex Krash](https://github.com/alex-krash)) [6685365ab8c5b74f9650492c88a012596eb1b0c6](https://github.com/ClickHouse/ClickHouse/commit/6685365ab8c5b74f9650492c88a012596eb1b0c6) [341e2e4587a18065c2da1ca888c73389f48ce36c](https://github.com/ClickHouse/ClickHouse/commit/341e2e4587a18065c2da1ca888c73389f48ce36c) [Alexey Milovidov](https://github.com/alexey-milovidov) -- 创建了一个函数 `currentUser()`,返回授权用户的登录。 添加别名 `user()` 对于与MySQL的兼容性。 [\#6470](https://github.com/ClickHouse/ClickHouse/pull/6470) ([Alex Krash](https://github.com/alex-krash)) -- 新的聚合函数 `quantilesExactInclusive` 和 `quantilesExactExclusive` 这是在提出 [\#5885](https://github.com/ClickHouse/ClickHouse/issues/5885). [\#6477](https://github.com/ClickHouse/ClickHouse/pull/6477) ([dimarub2000](https://github.com/dimarub2000)) -- 功能 `bitmapRange(bitmap, range_begin, range_end)` 返回具有指定范围的新集(不包括 `range_end`). [\#6314](https://github.com/ClickHouse/ClickHouse/pull/6314) ([余志昌](https://github.com/yuzhichang)) -- 功能 `geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)` 它创建了一系列精确的长串geohash盒复盖提供的区域。 [\#6127](https://github.com/ClickHouse/ClickHouse/pull/6127) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 实现对插入查询的支持 `Kafka` 桌子 [\#6012](https://github.com/ClickHouse/ClickHouse/pull/6012) ([伊万](https://github.com/abyss7)) -- 增加了对 `_partition` 和 `_timestamp` 虚拟列到Kafka引擎。 [\#6400](https://github.com/ClickHouse/ClickHouse/pull/6400) ([伊万](https://github.com/abyss7)) -- 可以从中删除敏感数据 `query_log`,服务器日志,基于正则表达式的规则的进程列表。 [\#5710](https://github.com/ClickHouse/ClickHouse/pull/5710) ([filimonov](https://github.com/filimonov)) - -#### 实验特点 {#experimental-feature-2} - -- 输入和输出数据格式 `Template`. 它允许为输入和输出指定自定义格式字符串。 [\#4354](https://github.com/ClickHouse/ClickHouse/issues/4354) [\#6727](https://github.com/ClickHouse/ClickHouse/pull/6727) ([tavplubix](https://github.com/tavplubix)) -- 执行 `LIVE VIEW` 最初提出的表 [\#2898](https://github.com/ClickHouse/ClickHouse/pull/2898),准备 [\#3925](https://github.com/ClickHouse/ClickHouse/issues/3925),然后更新 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541). 看 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) 详细描述。 [\#5541](https://github.com/ClickHouse/ClickHouse/issues/5541) ([vzakaznikov](https://github.com/vzakaznikov)) [\#6425](https://github.com/ClickHouse/ClickHouse/pull/6425) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) [\#6656](https://github.com/ClickHouse/ClickHouse/pull/6656) ([vzakaznikov](https://github.com/vzakaznikov))请注意 `LIVE VIEW` 功能可能会在下一个版本中删除。 - -#### 错误修复 {#bug-fix-8} - -- 此版本还包含19.13和19.11的所有错误修复。 -- 修复表有跳过索引和垂直合并发生时的分段错误。 [\#6723](https://github.com/ClickHouse/ClickHouse/pull/6723) ([阿利沙平](https://github.com/alesapin)) -- 使用非平凡的列默认值修复每列TTL。 以前在强制TTL合并的情况下 `OPTIMIZE ... FINAL` 查询,过期的值被替换为类型默认值,而不是用户指定的列默认值。 [\#6796](https://github.com/ClickHouse/ClickHouse/pull/6796) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复kafka服务器正常重启时的消息重复问题。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([伊万](https://github.com/abyss7)) -- 修正了读取Kafka消息时的无限循环。 根本不要暂停/恢复订阅消费者-否则在某些情况下可能会无限期暂停。 [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([伊万](https://github.com/abyss7)) -- 修复 `Key expression contains comparison between inconvertible types` 例外 `bitmapContains` 功能。 [\#6136](https://github.com/ClickHouse/ClickHouse/issues/6136) [\#6146](https://github.com/ClickHouse/ClickHouse/issues/6146) [\#6156](https://github.com/ClickHouse/ClickHouse/pull/6156) ([dimarub2000](https://github.com/dimarub2000)) -- 修复已启用的段错误 `optimize_skip_unused_shards` 还丢失了分片钥匙 [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复了可能导致内存损坏的突变中的错误代码。 修复了读取地址的段错误 `0x14c0` 这可能发生由于并发 `DROP TABLE` 和 `SELECT` 从 `system.parts` 或 `system.parts_columns`. 在准备突变查询时修复了竞争条件。 修复了由于 `OPTIMIZE` 复制的表和并发修改操作,如改变。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在MySQL界面中删除了额外的详细日志记录 [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 返回解析布尔设置的能力 ‘true’ 和 ‘false’ 在配置文件中。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([阿利沙平](https://github.com/alesapin)) -- 修复崩溃 `quantile` 和 `median` 功能结束 `Nullable(Decimal128)`. [\#6378](https://github.com/ClickHouse/ClickHouse/pull/6378) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正了可能不完整的结果返回 `SELECT` 查询与 `WHERE` 主键上的条件包含转换为浮点类型。 它是由不正确的单调性检查引起的 `toFloat` 功能。 [\#6248](https://github.com/ClickHouse/ClickHouse/issues/6248) [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- 检查 `max_expanded_ast_elements` 设置为突变。 明确突变后 `TRUNCATE TABLE`. [\#6205](https://github.com/ClickHouse/ClickHouse/pull/6205) ([张冬](https://github.com/zhang2014)) -- 修复使用键列时的联接结果 `join_use_nulls`. 附加空值而不是列默认值。 [\#6249](https://github.com/ClickHouse/ClickHouse/pull/6249) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正了跳过索引与垂直合并和改变。 修复 `Bad size of marks file` 例外。 [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594) [\#6713](https://github.com/ClickHouse/ClickHouse/pull/6713) ([阿利沙平](https://github.com/alesapin)) -- 修复罕见的崩溃 `ALTER MODIFY COLUMN` 和垂直合并,当合并/改变的部分之一是空的(0行) [\#6746](https://github.com/ClickHouse/ClickHouse/issues/6746) [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([阿利沙平](https://github.com/alesapin)) -- 修正错误的转换 `LowCardinality` 类型 `AggregateFunctionFactory`. 这修复 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复错误的行为和可能的段错误 `topK` 和 `topKWeighted` 聚合函数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([安东\*波波夫](https://github.com/CurtizJ)) -- 固定周围的不安全代码 `getIdentifier` 功能。 [\#6401](https://github.com/ClickHouse/ClickHouse/issues/6401) [\#6409](https://github.com/ClickHouse/ClickHouse/pull/6409) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在MySQL线协议(连接到ClickHouse的形式MySQL客户端时使用)修正了错误。 引起的堆缓冲区溢出 `PacketPayloadWriteBuffer`. [\#6212](https://github.com/ClickHouse/ClickHouse/pull/6212) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 固定内存泄漏 `bitmapSubsetInRange` 功能。 [\#6819](https://github.com/ClickHouse/ClickHouse/pull/6819) ([余志昌](https://github.com/yuzhichang)) -- 修复粒度变化后执行突变时的罕见错误。 [\#6816](https://github.com/ClickHouse/ClickHouse/pull/6816) ([阿利沙平](https://github.com/alesapin)) -- 默认情况下允许包含所有字段的protobuf消息。 [\#6132](https://github.com/ClickHouse/ClickHouse/pull/6132) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 解决错误 `nullIf` 功能,当我们发送 `NULL` 第二个参数的参数。 [\#6446](https://github.com/ClickHouse/ClickHouse/pull/6446) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 修正了错误的内存分配/解除分配在复杂的键高速缓存字典与字符串字段,导致无限的内存消耗罕见的错误(看起来像内存泄漏)。 当字符串大小为8(8,16,32等)开始的2的幂时,错误会重现。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([阿利沙平](https://github.com/alesapin)) -- 修复了导致异常的小序列上的大猩猩编码 `Cannot write after end of buffer`. [\#6398](https://github.com/ClickHouse/ClickHouse/issues/6398) [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 允许在连接中使用不可为空的类型 `join_use_nulls` 已启用。 [\#6705](https://github.com/ClickHouse/ClickHouse/pull/6705) ([Artem Zuikov](https://github.com/4ertus2)) -- 禁用 `Poco::AbstractConfiguration` 查询中的替换 `clickhouse-client`. [\#6706](https://github.com/ClickHouse/ClickHouse/pull/6706) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 避免死锁 `REPLACE PARTITION`. [\#6677](https://github.com/ClickHouse/ClickHouse/pull/6677) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 使用 `arrayReduce` 对于不变的参数可能会导致段错误。 [\#6242](https://github.com/ClickHouse/ClickHouse/issues/6242) [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复可能出现的不一致的部分,如果副本恢复后 `DROP PARTITION`. [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- 固定挂起 `JSONExtractRaw` 功能。 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正错误跳过索引序列化和聚合与自适应粒度。 [\#6594](https://github.com/ClickHouse/ClickHouse/issues/6594). [\#6748](https://github.com/ClickHouse/ClickHouse/pull/6748) ([阿利沙平](https://github.com/alesapin)) -- 修复 `WITH ROLLUP` 和 `WITH CUBE` 修饰符 `GROUP BY` 具有两级聚合。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复编写具有自适应粒度的二级索引标记的错误。 [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([阿利沙平](https://github.com/alesapin)) -- 修复服务器启动时的初始化顺序。 由于 `StorageMergeTree::background_task_handle` 在初始化 `startup()` 该 `MergeTreeBlockOutputStream::write()` 可以尝试在初始化之前使用它。 只需检查它是否被初始化。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([伊万](https://github.com/abyss7)) -- 从以前的读取操作中清除数据缓冲区,该操作完成时出现错误。 [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([尼古拉](https://github.com/bopohaa)) -- 修复为复制\*MergeTree表创建新副本时启用自适应粒度的错误。 [\#6394](https://github.com/ClickHouse/ClickHouse/issues/6394) [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([阿利沙平](https://github.com/alesapin)) -- 修复了在服务器启动过程中发生异常的情况下可能发生的崩溃 `libunwind` 在异常访问未初始化 `ThreadStatus` 结构。 [\#6456](https://github.com/ClickHouse/ClickHouse/pull/6456) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) -- 修复崩溃 `yandexConsistentHash` 功能。 通过模糊测试发现。 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304) [\#6305](https://github.com/ClickHouse/ClickHouse/pull/6305) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了服务器过载和全局线程池接近满时挂起查询的可能性。 这在具有大量分片(数百个)的集群上发生的机会更高,因为分布式查询为每个分片分配每个连接的线程。 例如,如果集群330分片正在处理30个并发分布式查询,则此问题可能再现。 此问题会影响从19.2开始的所有版本。 [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 的固定逻辑 `arrayEnumerateUniqRanked` 功能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 解码符号表时修复段错误。 [\#6603](https://github.com/ClickHouse/ClickHouse/pull/6603) ([阿莫斯鸟](https://github.com/amosbird)) -- 在固定不相关的异常转换 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 删除描述中的额外引用 `system.settings` 桌子 [\#6696](https://github.com/ClickHouse/ClickHouse/issues/6696) [\#6699](https://github.com/ClickHouse/ClickHouse/pull/6699) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 避免可能的死锁 `TRUNCATE` 复制的表。 [\#6695](https://github.com/ClickHouse/ClickHouse/pull/6695) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复读取排序键的顺序。 [\#6189](https://github.com/ClickHouse/ClickHouse/pull/6189) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复 `ALTER TABLE ... UPDATE` 查询表 `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([阿利沙平](https://github.com/alesapin)) -- 修复错误打开 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) (自19.4.0)。 当我们不查询任何列时,在对MergeTree表的分布式表的查询中复制 (`SELECT 1`). [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([阿利沙平](https://github.com/alesapin)) -- 在有符号类型的整数划分为无符号类型的固定溢出。 这种行为与C或C++语言(整数升级规则)完全相同,这可能令人惊讶。 请注意,当将大型有符号数字划分为大型无符号数字或反之亦然时,溢出仍然是可能的(但这种情况不太常见)。 所有服务器版本都存在此问题。 [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214) [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 限制最大睡眠时间限制时 `max_execution_speed` 或 `max_execution_speed_bytes` 已设置。 修正错误,如 `Estimated query execution time (inf seconds) is too long`. [\#5547](https://github.com/ClickHouse/ClickHouse/issues/5547) [\#6232](https://github.com/ClickHouse/ClickHouse/pull/6232) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 关于使用固定的问题 `MATERIALIZED` 列和别名 `MaterializedView`. [\#448](https://github.com/ClickHouse/ClickHouse/issues/448) [\#3484](https://github.com/ClickHouse/ClickHouse/issues/3484) [\#3450](https://github.com/ClickHouse/ClickHouse/issues/3450) [\#2878](https://github.com/ClickHouse/ClickHouse/issues/2878) [\#2285](https://github.com/ClickHouse/ClickHouse/issues/2285) [\#3796](https://github.com/ClickHouse/ClickHouse/pull/3796) ([阿莫斯鸟](https://github.com/amosbird)) [\#6316](https://github.com/ClickHouse/ClickHouse/pull/6316) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复 `FormatFactory` 未实现为处理器的输入流的行为。 [\#6495](https://github.com/ClickHouse/ClickHouse/pull/6495) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 固定错字。 [\#6631](https://github.com/ClickHouse/ClickHouse/pull/6631) ([Alex Ryndin](https://github.com/alexryndin)) -- 错字在错误消息(是-\>是)。 [\#6839](https://github.com/ClickHouse/ClickHouse/pull/6839) ([Denis Zhuravlev](https://github.com/den-crane)) -- 修复了从字符串中解析列列表时的错误,如果类型包含逗号(这个问题与 `File`, `URL`, `HDFS` 储存) [\#6217](https://github.com/ClickHouse/ClickHouse/issues/6217). [\#6209](https://github.com/ClickHouse/ClickHouse/pull/6209) ([dimarub2000](https://github.com/dimarub2000)) - -#### 安全修复 {#security-fix} - -- 此版本还包含19.13和19.11的所有错误安全修复。 -- 修复了由于SQL解析器中的堆栈溢出而导致服务器崩溃的制造查询的可能性。 修复了合并和分布式表,实例化视图和涉及子查询的行级安全性条件中堆栈溢出的可能性。 [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 改进 {#improvement-3} - -- 三元逻辑的正确实现 `AND/OR`. [\#6048](https://github.com/ClickHouse/ClickHouse/pull/6048) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) -- 现在,值和行与过期的TTL将被删除后 `OPTIMIZE ... FINAL` query from old parts without TTL infos or with outdated TTL infos, e.g. after `ALTER ... MODIFY TTL` 查询。 添加查询 `SYSTEM STOP/START TTL MERGES` 要禁止/允许使用TTL分配合并,并在所有合并中过滤过期值。 [\#6274](https://github.com/ClickHouse/ClickHouse/pull/6274) ([安东\*波波夫](https://github.com/CurtizJ)) -- 可以更改ClickHouse历史文件的位置为客户端使用 `CLICKHOUSE_HISTORY_FILE` env [\#6840](https://github.com/ClickHouse/ClickHouse/pull/6840) ([filimonov](https://github.com/filimonov)) -- 删除 `dry_run` 从标志 `InterpreterSelectQuery`. … [\#6375](https://github.com/ClickHouse/ClickHouse/pull/6375) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 碌莽禄Support: `ASOF JOIN` 与 `ON` 科。 [\#6211](https://github.com/ClickHouse/ClickHouse/pull/6211) ([Artem Zuikov](https://github.com/4ertus2)) -- 更好地支持用于突变和复制的跳过索引。 支持 `MATERIALIZE/CLEAR INDEX ... IN PARTITION` 查询。 `UPDATE x = x` 重新计算使用列的所有索引 `x`. [\#5053](https://github.com/ClickHouse/ClickHouse/pull/5053) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 允许 `ATTACH` 实时视图(例如,在服务器启动时),无论 `allow_experimental_live_view` 设置。 [\#6754](https://github.com/ClickHouse/ClickHouse/pull/6754) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 对于由查询探查器收集的堆栈跟踪,不包括由查询探查器本身生成的堆栈帧。 [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 现在表函数 `values`, `file`, `url`, `hdfs` 支持别名列。 [\#6255](https://github.com/ClickHouse/ClickHouse/pull/6255) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 如果抛出异常 `config.d` 文件没有相应的根元素作为配置文件。 [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) -- 在异常消息中打印额外的信息 `no space left on device`. [\#6182](https://github.com/ClickHouse/ClickHouse/issues/6182), [\#6252](https://github.com/ClickHouse/ClickHouse/issues/6252) [\#6352](https://github.com/ClickHouse/ClickHouse/pull/6352) ([tavplubix](https://github.com/tavplubix)) -- 当确定一个碎片 `Distributed` 要被读取查询复盖的表(用于 `optimize_skip_unused_shards` =1)ClickHouse现在从两个检查条件 `prewhere` 和 `where` select语句的子句。 [\#6521](https://github.com/ClickHouse/ClickHouse/pull/6521) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) -- 已启用 `SIMDJSON` 对于没有AVX2,但与SSE4.2和PCLMUL指令集的机器。 [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285) [\#6320](https://github.com/ClickHouse/ClickHouse/pull/6320) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- ClickHouse可以在文件系统上工作,而无需 `O_DIRECT` 支持(如ZFS和BtrFS),无需额外的调整。 [\#4449](https://github.com/ClickHouse/ClickHouse/issues/4449) [\#6730](https://github.com/ClickHouse/ClickHouse/pull/6730) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 支持最终子查询的下推谓词。 [\#6120](https://github.com/ClickHouse/ClickHouse/pull/6120) ([TCeason](https://github.com/TCeason)) [\#6162](https://github.com/ClickHouse/ClickHouse/pull/6162) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 更好 `JOIN ON` 密钥提取 [\#6131](https://github.com/ClickHouse/ClickHouse/pull/6131) ([Artem Zuikov](https://github.com/4ertus2)) -- Upated `SIMDJSON`. [\#6285](https://github.com/ClickHouse/ClickHouse/issues/6285). [\#6306](https://github.com/ClickHouse/ClickHouse/pull/6306) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 优化最小列的选择 `SELECT count()` 查询。 [\#6344](https://github.com/ClickHouse/ClickHouse/pull/6344) ([阿莫斯鸟](https://github.com/amosbird)) -- 已添加 `strict` 参数in `windowFunnel()`. 当 `strict` 设置,该 `windowFunnel()` 仅对唯一值应用条件。 [\#6548](https://github.com/ClickHouse/ClickHouse/pull/6548) ([achimbab](https://github.com/achimbab)) -- 更安全的界面 `mysqlxx::Pool`. [\#6150](https://github.com/ClickHouse/ClickHouse/pull/6150) ([avasiliev](https://github.com/avasiliev)) -- 执行时选项行大小 `--help` 选项现在与终端大小对应。 [\#6590](https://github.com/ClickHouse/ClickHouse/pull/6590) ([dimarub2000](https://github.com/dimarub2000)) -- 禁用 “read in order” 优化无键的聚合。 [\#6599](https://github.com/ClickHouse/ClickHouse/pull/6599) ([安东\*波波夫](https://github.com/CurtizJ)) -- Http状态代码 `INCORRECT_DATA` 和 `TYPE_MISMATCH` 错误代码已从默认值更改 `500 Internal Server Error` 到 `400 Bad Request`. [\#6271](https://github.com/ClickHouse/ClickHouse/pull/6271) ([亚历山大\*罗丹](https://github.com/a-rodin)) -- 从移动连接对象 `ExpressionAction` 成 `AnalyzedJoin`. `ExpressionAnalyzer` 和 `ExpressionAction` 不知道 `Join` 不再上课了 它的逻辑被隐藏 `AnalyzedJoin` 伊菲斯 [\#6801](https://github.com/ClickHouse/ClickHouse/pull/6801) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复了当其中一个分片是localhost但查询通过网络连接发送时可能出现的分布式查询死锁。 [\#6759](https://github.com/ClickHouse/ClickHouse/pull/6759) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 更改多个表的语义 `RENAME` 为了避免可能的死锁。 [\#6757](https://github.com/ClickHouse/ClickHouse/issues/6757). [\#6756](https://github.com/ClickHouse/ClickHouse/pull/6756) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 重写MySQL兼容性服务器以防止在内存中加载完整的数据包有效负载。 每个连接的内存消耗减少到大约 `2 * DBMS_DEFAULT_BUFFER_SIZE` (读/写缓冲区)。 [\#5811](https://github.com/ClickHouse/ClickHouse/pull/5811) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 将AST别名解释逻辑移出不必了解查询语义的解析器。 [\#6108](https://github.com/ClickHouse/ClickHouse/pull/6108) ([Artem Zuikov](https://github.com/4ertus2)) -- 稍微更安全的解析 `NamesAndTypesList`. [\#6408](https://github.com/ClickHouse/ClickHouse/issues/6408). [\#6410](https://github.com/ClickHouse/ClickHouse/pull/6410) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `clickhouse-copier`:允许使用 `where_condition` 从配置 `partition_key` 查询中用于检查分区存在的别名(以前它仅用于读取数据查询)。 [\#6577](https://github.com/ClickHouse/ClickHouse/pull/6577) ([proller](https://github.com/proller)) -- 在添加可选的消息参数 `throwIf`. ([\#5772](https://github.com/ClickHouse/ClickHouse/issues/5772)) [\#6329](https://github.com/ClickHouse/ClickHouse/pull/6329) ([Vdimir](https://github.com/Vdimir)) -- 在发送插入数据时,服务器异常也正在客户端中处理。 [\#5891](https://github.com/ClickHouse/ClickHouse/issues/5891) [\#6711](https://github.com/ClickHouse/ClickHouse/pull/6711) ([dimarub2000](https://github.com/dimarub2000)) -- 添加了指标 `DistributedFilesToInsert` 这显示了文件系统中选择通过分布式表发送到远程服务器的文件总数。 该数字在所有分片之间相加。 [\#6600](https://github.com/ClickHouse/ClickHouse/pull/6600) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 将大部分连接准备逻辑从 `ExpressionAction/ExpressionAnalyzer` 到 `AnalyzedJoin`. [\#6785](https://github.com/ClickHouse/ClickHouse/pull/6785) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复曾 [警告](https://clickhouse-test-reports.s3.yandex.net/6399/c1c1d1daa98e199e620766f1bd06a5921050a00d/functional_stateful_tests_(thread).html) ‘lock-order-inversion’. [\#6740](https://github.com/ClickHouse/ClickHouse/pull/6740) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 关于缺乏Linux功能的更好的信息消息。 记录致命错误 “fatal” 水平,这将使它更容易找到 `system.text_log`. [\#6441](https://github.com/ClickHouse/ClickHouse/pull/6441) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 当启用转储临时数据到磁盘,以限制内存使用期间 `GROUP BY`, `ORDER BY`,它没有检查可用磁盘空间。 修复程序添加新设置 `min_free_disk_space`,当可用磁盘空间小于阈值时,查询将停止并抛出 `ErrorCodes::NOT_ENOUGH_SPACE`. [\#6678](https://github.com/ClickHouse/ClickHouse/pull/6678) ([徐伟清](https://github.com/weiqxu)) [\#6691](https://github.com/ClickHouse/ClickHouse/pull/6691) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 通过线程删除递归rwlock。 这是没有意义的,因为线程在查询之间重用。 `SELECT` 查询可以在一个线程中获取锁,从另一个线程持有锁并从第一个线程退出。 在同一时间,第一个线程可以通过重复使用 `DROP` 查询。 这将导致虚假 “Attempt to acquire exclusive lock recursively” 消息 [\#6771](https://github.com/ClickHouse/ClickHouse/pull/6771) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 斯普利特 `ExpressionAnalyzer.appendJoin()`. 准备一个地方 `ExpressionAnalyzer` 为 `MergeJoin`. [\#6524](https://github.com/ClickHouse/ClickHouse/pull/6524) ([Artem Zuikov](https://github.com/4ertus2)) -- 已添加 `mysql_native_password` mysql兼容性服务器的身份验证插件。 [\#6194](https://github.com/ClickHouse/ClickHouse/pull/6194) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 更少的数量 `clock_gettime` 调用;调试/发布之间的固定ABI兼容性 `Allocator` (微不足道的问题)。 [\#6197](https://github.com/ClickHouse/ClickHouse/pull/6197) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 移动 `collectUsedColumns` 从 `ExpressionAnalyzer` 到 `SyntaxAnalyzer`. `SyntaxAnalyzer` 赂眉露\>\> `required_source_columns` 现在本身。 [\#6416](https://github.com/ClickHouse/ClickHouse/pull/6416) ([Artem Zuikov](https://github.com/4ertus2)) -- 添加设置 `joined_subquery_requires_alias` 要求子选择和表函数的别名 `FROM` that more than one table is present (i.e. queries with JOINs). [\#6733](https://github.com/ClickHouse/ClickHouse/pull/6733) ([Artem Zuikov](https://github.com/4ertus2)) -- 提取物 `GetAggregatesVisitor` 从类 `ExpressionAnalyzer`. [\#6458](https://github.com/ClickHouse/ClickHouse/pull/6458) ([Artem Zuikov](https://github.com/4ertus2)) -- `system.query_log`:更改数据类型 `type` 列到 `Enum`. [\#6265](https://github.com/ClickHouse/ClickHouse/pull/6265) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) -- 静态链接 `sha256_password` 身份验证插件。 [\#6512](https://github.com/ClickHouse/ClickHouse/pull/6512) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 避免对设置的额外依赖 `compile` 去工作 在以前的版本中,用户可能会得到如下错误 `cannot open crti.o`, `unable to find library -lc` 等。 [\#6309](https://github.com/ClickHouse/ClickHouse/pull/6309) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 对可能来自恶意副本的输入进行更多验证。 [\#6303](https://github.com/ClickHouse/ClickHouse/pull/6303) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 现在 `clickhouse-obfuscator` 文件是可用的 `clickhouse-client` 包。 在以前的版本中,它可以作为 `clickhouse obfuscator` (带空格)。 [\#5816](https://github.com/ClickHouse/ClickHouse/issues/5816) [\#6609](https://github.com/ClickHouse/ClickHouse/pull/6609) ([dimarub2000](https://github.com/dimarub2000)) -- 当我们至少有两个查询以不同的顺序读取至少两个表,另一个查询对其中一个表执行DDL操作时,修复了死锁。 修复了另一个非常罕见的死锁。 [\#6764](https://github.com/ClickHouse/ClickHouse/pull/6764) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 已添加 `os_thread_ids` 列到 `system.processes` 和 `system.query_log` 为了更好的调试可能性。 [\#6763](https://github.com/ClickHouse/ClickHouse/pull/6763) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 当发生PHP mysqlnd扩展错误的解决方法 `sha256_password` 用作默认身份验证插件(在描述 [\#6031](https://github.com/ClickHouse/ClickHouse/issues/6031)). [\#6113](https://github.com/ClickHouse/ClickHouse/pull/6113) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 删除不需要的地方与更改为空列。 [\#6693](https://github.com/ClickHouse/ClickHouse/pull/6693) ([Artem Zuikov](https://github.com/4ertus2)) -- 设置默认值 `queue_max_wait_ms` 为零,因为当前值(五秒)是没有意义的。 在极少数情况下,此设置有任何用途。 添加设置 `replace_running_query_max_wait_ms`, `kafka_max_wait_ms` 和 `connection_pool_max_wait_ms` 用于消除歧义。 [\#6692](https://github.com/ClickHouse/ClickHouse/pull/6692) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 提取物 `SelectQueryExpressionAnalyzer` 从 `ExpressionAnalyzer`. 保留最后一个用于非select查询。 [\#6499](https://github.com/ClickHouse/ClickHouse/pull/6499) ([Artem Zuikov](https://github.com/4ertus2)) -- 删除重复输入和输出格式。 [\#6239](https://github.com/ClickHouse/ClickHouse/pull/6239) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 允许用户复盖 `poll_interval` 和 `idle_connection_timeout` 连接设置。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `MergeTree` 现在有一个额外的选项 `ttl_only_drop_parts` (默认情况下禁用),以避免部分的部分修剪,以便在部分中的所有行都过期时完全删除它们。 [\#6191](https://github.com/ClickHouse/ClickHouse/pull/6191) ([塞尔吉\*弗拉季金](https://github.com/svladykin)) -- 类型检查set索引函数。 如果函数类型错误,则引发异常。 这修复了模糊测试与UBSan。 [\#6511](https://github.com/ClickHouse/ClickHouse/pull/6511) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) - -#### 性能改进 {#performance-improvement-2} - -- 优化查询 `ORDER BY expressions` 条款,其中 `expressions` 有重合前缀与排序键 `MergeTree` 桌子 此优化由以下方式控制 `optimize_read_in_order` 设置。 [\#6054](https://github.com/ClickHouse/ClickHouse/pull/6054) [\#6629](https://github.com/ClickHouse/ClickHouse/pull/6629) ([安东\*波波夫](https://github.com/CurtizJ)) -- 允许在零件装载和拆卸期间使用多个螺纹。 [\#6372](https://github.com/ClickHouse/ClickHouse/issues/6372) [\#6074](https://github.com/ClickHouse/ClickHouse/issues/6074) [\#6438](https://github.com/ClickHouse/ClickHouse/pull/6438) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 实现了更新聚合函数状态的批处理变体。 这可能导致性能优势。 [\#6435](https://github.com/ClickHouse/ClickHouse/pull/6435) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 使用 `FastOps` 函数库 `exp`, `log`, `sigmoid`, `tanh`. FastOps是迈克尔\*帕拉欣(Yandex的首席技术官)的快速矢量数学库。 改进的性能 `exp` 和 `log` 功能超过6倍。 功能 `exp` 和 `log` 从 `Float32` 参数将返回 `Float32` (在以前的版本中,他们总是返回 `Float64`). 现在 `exp(nan)` 可能会回来 `inf`. 的结果 `exp` 和 `log` 函数可能不是最接近机器可代表的数字到真正的答案。 [\#6254](https://github.com/ClickHouse/ClickHouse/pull/6254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov))使用Danila Kutenin变体使fastops工作 [\#6317](https://github.com/ClickHouse/ClickHouse/pull/6317) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 禁用连续密钥优化 `UInt8/16`. [\#6298](https://github.com/ClickHouse/ClickHouse/pull/6298) [\#6701](https://github.com/ClickHouse/ClickHouse/pull/6701) ([akuzm](https://github.com/akuzm)) -- 改进的性能 `simdjson` 库通过摆脱动态分配 `ParsedJson::Iterator`. [\#6479](https://github.com/ClickHouse/ClickHouse/pull/6479) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 预故障页分配内存时 `mmap()`. [\#6667](https://github.com/ClickHouse/ClickHouse/pull/6667) ([akuzm](https://github.com/akuzm)) -- 修复性能错误 `Decimal` 比较。 [\#6380](https://github.com/ClickHouse/ClickHouse/pull/6380) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-4} - -- 删除编译器(运行时模板实例化),因为我们已经赢得了它的性能。 [\#6646](https://github.com/ClickHouse/ClickHouse/pull/6646) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了性能测试,以显示gcc-9以更隔离的方式性能下降。 [\#6302](https://github.com/ClickHouse/ClickHouse/pull/6302) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加表功能 `numbers_mt`,这是多线程版本 `numbers`. 使用哈希函数更新性能测试。 [\#6554](https://github.com/ClickHouse/ClickHouse/pull/6554) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 比较模式 `clickhouse-benchmark` [\#6220](https://github.com/ClickHouse/ClickHouse/issues/6220) [\#6343](https://github.com/ClickHouse/ClickHouse/pull/6343) ([dimarub2000](https://github.com/dimarub2000)) -- 尽最大努力打印堆栈痕迹。 还添加了 `SIGPROF` 作为调试信号,打印正在运行的线程的堆栈跟踪。 [\#6529](https://github.com/ClickHouse/ClickHouse/pull/6529) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 每个函数都在自己的文件中,第10部分。 [\#6321](https://github.com/ClickHouse/ClickHouse/pull/6321) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 删除两倍常量 `TABLE_IS_READ_ONLY`. [\#6566](https://github.com/ClickHouse/ClickHouse/pull/6566) ([filimonov](https://github.com/filimonov)) -- 格式化更改 `StringHashMap` PR [\#5417](https://github.com/ClickHouse/ClickHouse/issues/5417). [\#6700](https://github.com/ClickHouse/ClickHouse/pull/6700) ([akuzm](https://github.com/akuzm)) -- 更好的联接创建子查询 `ExpressionAnalyzer`. [\#6824](https://github.com/ClickHouse/ClickHouse/pull/6824) ([Artem Zuikov](https://github.com/4ertus2)) -- 删除冗余条件(由PVS Studio找到)。 [\#6775](https://github.com/ClickHouse/ClickHouse/pull/6775) ([akuzm](https://github.com/akuzm)) -- 分隔散列表接口 `ReverseIndex`. [\#6672](https://github.com/ClickHouse/ClickHouse/pull/6672) ([akuzm](https://github.com/akuzm)) -- 重构设置。 [\#6689](https://github.com/ClickHouse/ClickHouse/pull/6689) ([阿利沙平](https://github.com/alesapin)) -- 添加注释 `set` 索引函数。 [\#6319](https://github.com/ClickHouse/ClickHouse/pull/6319) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 在Linux上的调试版本中增加OOM分数。 [\#6152](https://github.com/ClickHouse/ClickHouse/pull/6152) ([akuzm](https://github.com/akuzm)) -- HDFS HA现在在调试版本中工作。 [\#6650](https://github.com/ClickHouse/ClickHouse/pull/6650) ([徐伟清](https://github.com/weiqxu)) -- 添加了一个测试 `transform_query_for_external_database`. [\#6388](https://github.com/ClickHouse/ClickHouse/pull/6388) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 为Kafka表添加多个实例化视图的测试。 [\#6509](https://github.com/ClickHouse/ClickHouse/pull/6509) ([伊万](https://github.com/abyss7)) -- 制定一个更好的构建计划。 [\#6500](https://github.com/ClickHouse/ClickHouse/pull/6500) ([伊万](https://github.com/abyss7)) -- 固定 `test_external_dictionaries` 集成的情况下,它是在非root用户下执行。 [\#6507](https://github.com/ClickHouse/ClickHouse/pull/6507) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 当写入的数据包的总大小超过 `DBMS_DEFAULT_BUFFER_SIZE`. [\#6204](https://github.com/ClickHouse/ClickHouse/pull/6204) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 增加了一个测试 `RENAME` 表竞争条件 [\#6752](https://github.com/ClickHouse/ClickHouse/pull/6752) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 避免在设置数据竞赛 `KILL QUERY`. [\#6753](https://github.com/ClickHouse/ClickHouse/pull/6753) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 通过缓存字典添加处理错误的集成测试。 [\#6755](https://github.com/ClickHouse/ClickHouse/pull/6755) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 在Mac OS上禁用ELF对象文件的解析,因为这是没有意义的。 [\#6578](https://github.com/ClickHouse/ClickHouse/pull/6578) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 尝试使更新日志生成器更好。 [\#6327](https://github.com/ClickHouse/ClickHouse/pull/6327) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加 `-Wshadow` 切换到海湾合作委员会。 [\#6325](https://github.com/ClickHouse/ClickHouse/pull/6325) ([kreuzerkrieg](https://github.com/kreuzerkrieg)) -- 删除过时的代码 `mimalloc` 支持。 [\#6715](https://github.com/ClickHouse/ClickHouse/pull/6715) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `zlib-ng` 确定x86功能并将此信息保存到全局变量。 这是在defalteInit调用中完成的,它可以由不同的线程同时进行。 为了避免多线程写入,请在库启动时执行此操作。 [\#6141](https://github.com/ClickHouse/ClickHouse/pull/6141) ([akuzm](https://github.com/akuzm)) -- 回归测试一个错误,在连接这是固定的 [\#5192](https://github.com/ClickHouse/ClickHouse/issues/5192). [\#6147](https://github.com/ClickHouse/ClickHouse/pull/6147) ([Bakhtiyor Ruziev](https://github.com/theruziev)) -- 修正MSan报告。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复扑ttl测试。 [\#6782](https://github.com/ClickHouse/ClickHouse/pull/6782) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修正了虚假数据竞赛 `MergeTreeDataPart::is_frozen` 场。 [\#6583](https://github.com/ClickHouse/ClickHouse/pull/6583) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了模糊测试中的超时。 在以前的版本中,它设法在查询中找到虚假挂断 `SELECT * FROM numbers_mt(gccMurmurHash(''))`. [\#6582](https://github.com/ClickHouse/ClickHouse/pull/6582) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加了调试检查 `static_cast` 列。 [\#6581](https://github.com/ClickHouse/ClickHouse/pull/6581) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在官方RPM软件包中支持Oracle Linux。 [\#6356](https://github.com/ClickHouse/ClickHouse/issues/6356) [\#6585](https://github.com/ClickHouse/ClickHouse/pull/6585) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 从更改json perftests `once` 到 `loop` 类型。 [\#6536](https://github.com/ClickHouse/ClickHouse/pull/6536) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- `odbc-bridge.cpp` 定义 `main()` 所以它不应该被包括在 `clickhouse-lib`. [\#6538](https://github.com/ClickHouse/ClickHouse/pull/6538) ([Origej Desh](https://github.com/orivej)) -- 测试碰撞 `FULL|RIGHT JOIN` 右表的键中有空值。 [\#6362](https://github.com/ClickHouse/ClickHouse/pull/6362) ([Artem Zuikov](https://github.com/4ertus2)) -- 为了以防万一,增加了对别名扩展限制的测试。 [\#6442](https://github.com/ClickHouse/ClickHouse/pull/6442) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 从切换 `boost::filesystem` 到 `std::filesystem` 在适当的情况下。 [\#6253](https://github.com/ClickHouse/ClickHouse/pull/6253) [\#6385](https://github.com/ClickHouse/ClickHouse/pull/6385) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 将RPM包添加到网站。 [\#6251](https://github.com/ClickHouse/ClickHouse/pull/6251) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 为固定添加测试 `Unknown identifier` 例外 `IN` 科。 [\#6708](https://github.com/ClickHouse/ClickHouse/pull/6708) ([Artem Zuikov](https://github.com/4ertus2)) -- 简化操作 `shared_ptr_helper` 因为人们面临困难理解它。 [\#6675](https://github.com/ClickHouse/ClickHouse/pull/6675) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了固定大猩猩和DoubleDelta编解码器的性能测试。 [\#6179](https://github.com/ClickHouse/ClickHouse/pull/6179) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 拆分集成测试 `test_dictionaries` 分成四个单独的测试。 [\#6776](https://github.com/ClickHouse/ClickHouse/pull/6776) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复PVS-Studio中的警告 `PipelineExecutor`. [\#6777](https://github.com/ClickHouse/ClickHouse/pull/6777) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 允许使用 `library` 与ASan字典源. [\#6482](https://github.com/ClickHouse/ClickHouse/pull/6482) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了从Pr列表生成更新日志的选项。 [\#6350](https://github.com/ClickHouse/ClickHouse/pull/6350) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 锁定 `TinyLog` 读取时存储。 [\#6226](https://github.com/ClickHouse/ClickHouse/pull/6226) ([akuzm](https://github.com/akuzm)) -- 检查CI中损坏的符号链接。 [\#6634](https://github.com/ClickHouse/ClickHouse/pull/6634) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加超时时间 “stack overflow” 测试,因为它可能需要很长的时间在调试构建。 [\#6637](https://github.com/ClickHouse/ClickHouse/pull/6637) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加了双空格检查。 [\#6643](https://github.com/ClickHouse/ClickHouse/pull/6643) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复 `new/delete` 使用消毒剂构建时的内存跟踪。 跟踪不清楚。 它只防止测试中的内存限制异常。 [\#6450](https://github.com/ClickHouse/ClickHouse/pull/6450) ([Artem Zuikov](https://github.com/4ertus2)) -- 启用链接时对未定义符号的检查。 [\#6453](https://github.com/ClickHouse/ClickHouse/pull/6453) ([伊万](https://github.com/abyss7)) -- 避免重建 `hyperscan` 每天 [\#6307](https://github.com/ClickHouse/ClickHouse/pull/6307) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在固定的瑞银报告 `ProtobufWriter`. [\#6163](https://github.com/ClickHouse/ClickHouse/pull/6163) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 不要允许将查询探查器与消毒器一起使用,因为它不兼容。 [\#6769](https://github.com/ClickHouse/ClickHouse/pull/6769) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加测试计时器失败后重新加载字典。 [\#6114](https://github.com/ClickHouse/ClickHouse/pull/6114) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复不一致 `PipelineExecutor::prepareProcessor` 参数类型。 [\#6494](https://github.com/ClickHouse/ClickHouse/pull/6494) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 添加了对坏Uri的测试。 [\#6493](https://github.com/ClickHouse/ClickHouse/pull/6493) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了更多的检查 `CAST` 功能。 这应该获得更多关于模糊测试中分割故障的信息。 [\#6346](https://github.com/ClickHouse/ClickHouse/pull/6346) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 已添加 `gcc-9` 支持 `docker/builder` 本地生成映像的容器。 [\#6333](https://github.com/ClickHouse/ClickHouse/pull/6333) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) -- 测试主键 `LowCardinality(String)`. [\#5044](https://github.com/ClickHouse/ClickHouse/issues/5044) [\#6219](https://github.com/ClickHouse/ClickHouse/pull/6219) ([dimarub2000](https://github.com/dimarub2000)) -- 修复了缓慢堆栈跟踪打印影响的测试。 [\#6315](https://github.com/ClickHouse/ClickHouse/pull/6315) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加崩溃的测试用例 `groupUniqArray` 固定在 [\#6029](https://github.com/ClickHouse/ClickHouse/pull/6029). [\#4402](https://github.com/ClickHouse/ClickHouse/issues/4402) [\#6129](https://github.com/ClickHouse/ClickHouse/pull/6129) ([akuzm](https://github.com/akuzm)) -- 固定指数突变测试。 [\#6645](https://github.com/ClickHouse/ClickHouse/pull/6645) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 在性能测试中,不要读取我们没有运行的查询的查询日志。 [\#6427](https://github.com/ClickHouse/ClickHouse/pull/6427) ([akuzm](https://github.com/akuzm)) -- 现在可以使用任何低基数类型创建实例化视图,而不考虑关于可疑低基数类型的设置。 [\#6428](https://github.com/ClickHouse/ClickHouse/pull/6428) ([Olga Khvostikova](https://github.com/stavrolia)) -- 更新的测试 `send_logs_level` 设置。 [\#6207](https://github.com/ClickHouse/ClickHouse/pull/6207) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复gcc-8.2下的构建。 [\#6196](https://github.com/ClickHouse/ClickHouse/pull/6196) ([Max Akhmedov](https://github.com/zlobober)) -- 修复构建与内部libc++。 [\#6724](https://github.com/ClickHouse/ClickHouse/pull/6724) ([伊万](https://github.com/abyss7)) -- 修复共享构建 `rdkafka` 图书馆 [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([伊万](https://github.com/abyss7)) -- 修复Mac OS构建(不完整)。 [\#6390](https://github.com/ClickHouse/ClickHouse/pull/6390) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) [\#6429](https://github.com/ClickHouse/ClickHouse/pull/6429) ([alex-zaitsev](https://github.com/alex-zaitsev)) -- 修复 “splitted” 碌莽禄.拢. [\#6618](https://github.com/ClickHouse/ClickHouse/pull/6618) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 其他构建修复: [\#6186](https://github.com/ClickHouse/ClickHouse/pull/6186) ([阿莫斯鸟](https://github.com/amosbird)) [\#6486](https://github.com/ClickHouse/ClickHouse/pull/6486) [\#6348](https://github.com/ClickHouse/ClickHouse/pull/6348) ([vxider](https://github.com/Vxider)) [\#6744](https://github.com/ClickHouse/ClickHouse/pull/6744) ([伊万](https://github.com/abyss7)) [\#6016](https://github.com/ClickHouse/ClickHouse/pull/6016) [\#6421](https://github.com/ClickHouse/ClickHouse/pull/6421) [\#6491](https://github.com/ClickHouse/ClickHouse/pull/6491) ([proller](https://github.com/proller)) - -#### 向后不兼容的更改 {#backward-incompatible-change-3} - -- 删除很少使用的表函数 `catBoostPool` 和存储 `CatBoostPool`. 如果您使用了此表功能,请写电子邮件至 `clickhouse-feedback@yandex-team.com`. 请注意,CatBoost集成仍然存在,并将受到支持。 [\#6279](https://github.com/ClickHouse/ClickHouse/pull/6279) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 禁用 `ANY RIGHT JOIN` 和 `ANY FULL JOIN` 默认情况下。 设置 `any_join_distinct_right_table_keys` 设置启用它们。 [\#5126](https://github.com/ClickHouse/ClickHouse/issues/5126) [\#6351](https://github.com/ClickHouse/ClickHouse/pull/6351) ([Artem Zuikov](https://github.com/4ertus2)) - -## ClickHouse释放19.13 {#clickhouse-release-19-13} - -### ClickHouse释放19.13.6.51,2019-10-02 {#clickhouse-release-19-13-6-51-2019-10-02} - -#### 错误修复 {#bug-fix-9} - -- 此版本还包含19.11.12.69的所有错误修复。 - -### ClickHouse释放19.13.5.44,2019-09-20 {#clickhouse-release-19-13-5-44-2019-09-20} - -#### 错误修复 {#bug-fix-10} - -- 此版本还包含19.14.6.12的所有错误修复。 -- 修复了在执行时表的可能不一致的状态 `DROP` 在zookeeper无法访问时查询复制的表。 [\#6045](https://github.com/ClickHouse/ClickHouse/issues/6045) [\#6413](https://github.com/ClickHouse/ClickHouse/pull/6413) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) -- 修复了StorageMerge中的数据竞赛 [\#6717](https://github.com/ClickHouse/ClickHouse/pull/6717) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复查询分析器中引入的错误,从而导致套接字无休止的recv。 [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) ([阿利沙平](https://github.com/alesapin)) -- 修复执行时过多的CPU使用率 `JSONExtractRaw` 函数在一个布尔值。 [\#6208](https://github.com/ClickHouse/ClickHouse/pull/6208) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 在推送到实例化视图时修复回归。 [\#6415](https://github.com/ClickHouse/ClickHouse/pull/6415) ([伊万](https://github.com/abyss7)) -- 表函数 `url` 该漏洞是否允许攻击者在请求中注入任意HTTP头。 这个问题被发现 [尼基塔\*季霍米罗夫](https://github.com/NSTikhomirov). [\#6466](https://github.com/ClickHouse/ClickHouse/pull/6466) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复无用 `AST` 检查设置索引。 [\#6510](https://github.com/ClickHouse/ClickHouse/issues/6510) [\#6651](https://github.com/ClickHouse/ClickHouse/pull/6651) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 修正了解析 `AggregateFunction` 查询中嵌入的值。 [\#6575](https://github.com/ClickHouse/ClickHouse/issues/6575) [\#6773](https://github.com/ClickHouse/ClickHouse/pull/6773) ([余志昌](https://github.com/yuzhichang)) -- 修正了错误的行为 `trim` 功能家庭。 [\#6647](https://github.com/ClickHouse/ClickHouse/pull/6647) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### ClickHouse释放19.13.4.32,2019-09-10 {#clickhouse-release-19-13-4-32-2019-09-10} - -#### 错误修复 {#bug-fix-11} - -- 此版本还包含19.11.9.52和19.11.10.54的所有错误安全修复。 -- 固定数据竞赛 `system.parts` 表和 `ALTER` 查询。 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245) [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了从带有sample和prewhere的空分布式表中读取流中发生的不匹配标题。 [\#6167](https://github.com/ClickHouse/ClickHouse/issues/6167) ([钱丽祥](https://github.com/fancyqlx)) [\#6823](https://github.com/ClickHouse/ClickHouse/pull/6823) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复使用时的崩溃 `IN` 子句带有一个元组的子查询。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- 修复具有相同列名的大小写 `GLOBAL JOIN ON` 科。 [\#6181](https://github.com/ClickHouse/ClickHouse/pull/6181) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复强制转换类型时的崩溃 `Decimal` 这不支持它。 抛出异常代替。 [\#6297](https://github.com/ClickHouse/ClickHouse/pull/6297) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复了崩溃 `extractAll()` 功能。 [\#6644](https://github.com/ClickHouse/ClickHouse/pull/6644) ([Artem Zuikov](https://github.com/4ertus2)) -- 查询转换 `MySQL`, `ODBC`, `JDBC` 表函数现在正常工作 `SELECT WHERE` 具有多个查询 `AND` 表达式。 [\#6381](https://github.com/ClickHouse/ClickHouse/issues/6381) [\#6676](https://github.com/ClickHouse/ClickHouse/pull/6676) ([dimarub2000](https://github.com/dimarub2000)) -- 添加了以前的声明检查MySQL8集成。 [\#6569](https://github.com/ClickHouse/ClickHouse/pull/6569) ([拉斐尔\*大卫\*蒂诺科](https://github.com/rafaeldtinoco)) - -#### 安全修复 {#security-fix-1} - -- 修复解压缩阶段编解码器中的两个漏洞(恶意用户可以制造压缩数据,导致解压缩中的缓冲区溢出)。 [\#6670](https://github.com/ClickHouse/ClickHouse/pull/6670) ([Artem Zuikov](https://github.com/4ertus2)) - -### 碌莽禄,拢,010-68520682\戮漏鹿芦,酶,虏卤赂拢,110102005602 {#clickhouse-release-19-13-3-26-2019-08-22} - -#### 错误修复 {#bug-fix-12} - -- 修复 `ALTER TABLE ... UPDATE` 查询表 `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([阿利沙平](https://github.com/alesapin)) -- 在使用IN子句时修复带有元组的子查询。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- 修复了一个问题,即如果一个陈旧的副本变为活动的,它可能仍然有被删除分区的数据部分。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- 修正了解析CSV的问题 [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- 修正了系统中的数据竞赛。部件表和ALTER查询。 这修复 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了可能导致内存损坏的突变中的错误代码。 修复了读取地址的段错误 `0x14c0` 这可能发生由于并发 `DROP TABLE` 和 `SELECT` 从 `system.parts` 或 `system.parts_columns`. 在准备突变查询时修复了竞争条件。 修复了由于 `OPTIMIZE` 复制的表和并发修改操作,如改变。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复后可能的数据丢失 `ALTER DELETE` 查询表跳过索引。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) - -#### 安全修复 {#security-fix-2} - -- 如果攻击者具有对ZooKeeper的写入访问权限,并且能够从ClickHouse运行的网络中运行可用的自定义服务器,则可以创建自定义构建的恶意服务器,该服务器将充当ClickHouse副本并将其注册到ZooKeeper中。 当另一个副本从恶意副本中获取数据部分时,它可以强制clickhouse-server写入文件系统上的任意路径。 由Yandex的信息安全团队Eldar Zaitov发现。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-13-2-19-2019-08-14} - -#### 新功能 {#new-feature-5} - -- 查询级别上的采样探查器。 [示例](https://gist.github.com/alexey-milovidov/92758583dd41c24c360fdb8d6a4da194). [\#4247](https://github.com/ClickHouse/ClickHouse/issues/4247) ([laplab](https://github.com/laplab)) [\#6124](https://github.com/ClickHouse/ClickHouse/pull/6124) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) [\#6250](https://github.com/ClickHouse/ClickHouse/pull/6250) [\#6283](https://github.com/ClickHouse/ClickHouse/pull/6283) [\#6386](https://github.com/ClickHouse/ClickHouse/pull/6386) -- 允许指定列的列表 `COLUMNS('regexp')` 表达的工作原理就像一个更复杂的变体 `*` 星号 [\#5951](https://github.com/ClickHouse/ClickHouse/pull/5951) ([mfridental](https://github.com/mfridental)), ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `CREATE TABLE AS table_function()` 现在是可能的 [\#6057](https://github.com/ClickHouse/ClickHouse/pull/6057) ([dimarub2000](https://github.com/dimarub2000)) -- 亚当优化随机梯度下降默认情况下使用 `stochasticLinearRegression()` 和 `stochasticLogisticRegression()` 聚合函数,因为它显示了良好的质量,几乎没有任何调整。 [\#6000](https://github.com/ClickHouse/ClickHouse/pull/6000) ([Quid37](https://github.com/Quid37)) -- Added functions for working with the сustom week number [\#5212](https://github.com/ClickHouse/ClickHouse/pull/5212) ([杨小姐](https://github.com/andyyzh)) -- `RENAME` 查询现在适用于所有存储。 [\#5953](https://github.com/ClickHouse/ClickHouse/pull/5953) ([伊万](https://github.com/abyss7)) -- 现在客户端通过设置从服务器接收任何所需级别的日志 `send_logs_level` 无论服务器设置中指定的日志级别如何。 [\#5964](https://github.com/ClickHouse/ClickHouse/pull/5964) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) - -#### 向后不兼容的更改 {#backward-incompatible-change-4} - -- 设置 `input_format_defaults_for_omitted_fields` 默认情况下启用。 分布式表中的插入需要此设置在集群上相同(您需要在滚动更新之前设置它)。 它允许计算复杂的默认表达式的省略字段 `JSONEachRow` 和 `CSV*` 格式。 它应该是预期的行为,但可能导致可忽略不计的性能差异。 [\#6043](https://github.com/ClickHouse/ClickHouse/pull/6043) ([Artem Zuikov](https://github.com/4ertus2)), [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) - -#### 实验特点 {#experimental-features} - -- 新的查询处理管道。 使用 `experimental_use_processors=1` 选项来启用它。 用你自己的麻烦。 [\#4914](https://github.com/ClickHouse/ClickHouse/pull/4914) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) - -#### 错误修复 {#bug-fix-13} - -- Kafka集成已在此版本中修复。 -- 固定 `DoubleDelta` 编码 `Int64` 对于大 `DoubleDelta` 值,改进 `DoubleDelta` 编码为随机数据 `Int32`. [\#5998](https://github.com/ClickHouse/ClickHouse/pull/5998) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 固定的高估 `max_rows_to_read` 如果设置 `merge_tree_uniform_read_distribution` 置为0。 [\#6019](https://github.com/ClickHouse/ClickHouse/pull/6019) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 改进 {#improvement-4} - -- 如果抛出异常 `config.d` 文件没有相应的根元素作为配置文件 [\#6123](https://github.com/ClickHouse/ClickHouse/pull/6123) ([dimarub2000](https://github.com/dimarub2000)) - -#### 性能改进 {#performance-improvement-3} - -- 优化 `count()`. 现在它使用最小的列(如果可能的话)。 [\#6028](https://github.com/ClickHouse/ClickHouse/pull/6028) ([阿莫斯鸟](https://github.com/amosbird)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-5} - -- 在性能测试中报告内存使用情况。 [\#5899](https://github.com/ClickHouse/ClickHouse/pull/5899) ([akuzm](https://github.com/akuzm)) -- 修复构建与外部 `libcxx` [\#6010](https://github.com/ClickHouse/ClickHouse/pull/6010) ([伊万](https://github.com/abyss7)) -- 修复共享构建 `rdkafka` 图书馆 [\#6101](https://github.com/ClickHouse/ClickHouse/pull/6101) ([伊万](https://github.com/abyss7)) - -## ClickHouse释放19.11 {#clickhouse-release-19-11} - -### ClickHouse释放19.11.13.74,2019-11-01 {#clickhouse-release-19-11-13-74-2019-11-01} - -#### 错误修复 {#bug-fix-14} - -- 修复了罕见的崩溃 `ALTER MODIFY COLUMN` 当合并/更改部分之一为空(0行)时,垂直合并。 [\#6780](https://github.com/ClickHouse/ClickHouse/pull/6780) ([阿利沙平](https://github.com/alesapin)) -- 手动更新 `SIMDJSON`. 这修复了stderr文件可能泛滥的错误json诊断消息。 [\#7548](https://github.com/ClickHouse/ClickHouse/pull/7548) ([亚历山大\*卡扎科夫](https://github.com/Akazz)) -- 修正错误 `mrk` 突变的文件扩展名 ([阿利沙平](https://github.com/alesapin)) - -### ClickHouse释放19.11.12.69,2019-10-02 {#clickhouse-release-19-11-12-69-2019-10-02} - -#### 错误修复 {#bug-fix-15} - -- 修复了大型表上复杂键的索引分析的性能下降。 这修复 [\#6924](https://github.com/ClickHouse/ClickHouse/issues/6924). [\#7075](https://github.com/ClickHouse/ClickHouse/pull/7075) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 使用分布式引擎在表中发送数据时避免罕见的SIGSEGV (`Failed to send batch: file with index XXXXX is absent`). [\#7032](https://github.com/ClickHouse/ClickHouse/pull/7032) ([Azat Khuzhin](https://github.com/azat)) -- 修复 `Unknown identifier` 有多个连接。 这修复 [\#5254](https://github.com/ClickHouse/ClickHouse/issues/5254). [\#7022](https://github.com/ClickHouse/ClickHouse/pull/7022) ([Artem Zuikov](https://github.com/4ertus2)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-11-57-2019-09-13} - -- 修复从Kafka空主题中选择时导致段错误的逻辑错误。 [\#6902](https://github.com/ClickHouse/ClickHouse/issues/6902) [\#6909](https://github.com/ClickHouse/ClickHouse/pull/6909) ([伊万](https://github.com/abyss7)) -- 修复功能 `АrrayEnumerateUniqRanked` 在参数中使用空数组。 [\#6928](https://github.com/ClickHouse/ClickHouse/pull/6928) ([proller](https://github.com/proller)) - -### ClickHouse释放19.11.10.54,2019-09-10 {#clickhouse-release-19-11-10-54-2019-09-10} - -#### 错误修复 {#bug-fix-16} - -- 手动存储Kafka消息的偏移量,以便能够一次性为所有分区提交它们。 修复潜在的重复 “one consumer - many partitions” 场景。 [\#6872](https://github.com/ClickHouse/ClickHouse/pull/6872) ([伊万](https://github.com/abyss7)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682 {#clickhouse-release-19-11-9-52-2019-09-6} - -- 改进缓存字典中的错误处理。 [\#6737](https://github.com/ClickHouse/ClickHouse/pull/6737) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 在功能固定错误 `arrayEnumerateUniqRanked`. [\#6779](https://github.com/ClickHouse/ClickHouse/pull/6779) ([proller](https://github.com/proller)) -- 修复 `JSONExtract` 功能,同时提取 `Tuple` 从JSON。 [\#6718](https://github.com/ClickHouse/ClickHouse/pull/6718) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复后可能的数据丢失 `ALTER DELETE` 查询表跳过索引。 [\#6224](https://github.com/ClickHouse/ClickHouse/issues/6224) [\#6282](https://github.com/ClickHouse/ClickHouse/pull/6282) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 固定性能测试。 [\#6392](https://github.com/ClickHouse/ClickHouse/pull/6392) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 实木复合地板:修复读取布尔列。 [\#6579](https://github.com/ClickHouse/ClickHouse/pull/6579) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了错误的行为 `nullIf` 常量参数的函数。 [\#6518](https://github.com/ClickHouse/ClickHouse/pull/6518) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) [\#6580](https://github.com/ClickHouse/ClickHouse/pull/6580) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复kafka服务器正常重启时的消息重复问题。 [\#6597](https://github.com/ClickHouse/ClickHouse/pull/6597) ([伊万](https://github.com/abyss7)) -- 修正了一个问题,当长 `ALTER UPDATE` 或 `ALTER DELETE` 可能会阻止常规合并运行。 如果没有足够的可用线程,则防止突变执行。 [\#6502](https://github.com/ClickHouse/ClickHouse/issues/6502) [\#6617](https://github.com/ClickHouse/ClickHouse/pull/6617) ([tavplubix](https://github.com/tavplubix)) -- 修正了处理错误 “timezone” 在服务器配置文件中。 [\#6709](https://github.com/ClickHouse/ClickHouse/pull/6709) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复卡夫卡测试。 [\#6805](https://github.com/ClickHouse/ClickHouse/pull/6805) ([伊万](https://github.com/abyss7)) - -#### 安全修复 {#security-fix-3} - -- 如果攻击者具有对ZooKeeper的写入访问权限,并且能够从运行ClickHouse的网络中运行可用的自定义服务器,则可以创建自定义构建的恶意服务器,该服务器将充当ClickHouse副本并将其注册到ZooKeeper中。 当另一个副本从恶意副本中获取数据部分时,它可以强制clickhouse-server写入文件系统上的任意路径。 由Yandex的信息安全团队Eldar Zaitov发现。 [\#6247](https://github.com/ClickHouse/ClickHouse/pull/6247) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-8-46-2019-08-22} - -#### 错误修复 {#bug-fix-17} - -- 修复 `ALTER TABLE ... UPDATE` 查询表 `enable_mixed_granularity_parts=1`. [\#6543](https://github.com/ClickHouse/ClickHouse/pull/6543) ([阿利沙平](https://github.com/alesapin)) -- 在使用IN子句时修复带有元组的子查询。 [\#6125](https://github.com/ClickHouse/ClickHouse/issues/6125) [\#6550](https://github.com/ClickHouse/ClickHouse/pull/6550) ([tavplubix](https://github.com/tavplubix)) -- 修复了一个问题,即如果一个陈旧的副本变为活动的,它可能仍然有被删除分区的数据部分。 [\#6522](https://github.com/ClickHouse/ClickHouse/issues/6522) [\#6523](https://github.com/ClickHouse/ClickHouse/pull/6523) ([tavplubix](https://github.com/tavplubix)) -- 修正了解析CSV的问题 [\#6426](https://github.com/ClickHouse/ClickHouse/issues/6426) [\#6559](https://github.com/ClickHouse/ClickHouse/pull/6559) ([tavplubix](https://github.com/tavplubix)) -- 修正了系统中的数据竞赛。部件表和ALTER查询。 这修复 [\#6245](https://github.com/ClickHouse/ClickHouse/issues/6245). [\#6513](https://github.com/ClickHouse/ClickHouse/pull/6513) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了可能导致内存损坏的突变中的错误代码。 修复了读取地址的段错误 `0x14c0` 这可能发生由于并发 `DROP TABLE` 和 `SELECT` 从 `system.parts` 或 `system.parts_columns`. 在准备突变查询时修复了竞争条件。 修复了由于 `OPTIMIZE` 复制的表和并发修改操作,如改变。 [\#6514](https://github.com/ClickHouse/ClickHouse/pull/6514) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-7-40-2019-08-14} - -#### 错误修复 {#bug-fix-18} - -- Kafka集成已在此版本中修复。 -- 使用时修复段错误 `arrayReduce` 对于不断的参数。 [\#6326](https://github.com/ClickHouse/ClickHouse/pull/6326) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定 `toFloat()` 单调性。 [\#6374](https://github.com/ClickHouse/ClickHouse/pull/6374) ([dimarub2000](https://github.com/dimarub2000)) -- 修复已启用的段错误 `optimize_skip_unused_shards` 还丢失了分片钥匙 [\#6384](https://github.com/ClickHouse/ClickHouse/pull/6384) ([CurtizJ](https://github.com/CurtizJ)) -- 的固定逻辑 `arrayEnumerateUniqRanked` 功能。 [\#6423](https://github.com/ClickHouse/ClickHouse/pull/6423) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 从MySQL处理程序中删除了额外的详细日志记录。 [\#6389](https://github.com/ClickHouse/ClickHouse/pull/6389) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复错误的行为和可能的段错误 `topK` 和 `topKWeighted` 聚合函数。 [\#6404](https://github.com/ClickHouse/ClickHouse/pull/6404) ([CurtizJ](https://github.com/CurtizJ)) -- 不要公开虚拟列 `system.columns` 桌子 这是向后兼容所必需的。 [\#6406](https://github.com/ClickHouse/ClickHouse/pull/6406) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复复杂键缓存字典中字符串字段的内存分配错误。 [\#6447](https://github.com/ClickHouse/ClickHouse/pull/6447) ([阿利沙平](https://github.com/alesapin)) -- 修复创建新副本时启用自适应粒度的错误 `Replicated*MergeTree` 桌子 [\#6452](https://github.com/ClickHouse/ClickHouse/pull/6452) ([阿利沙平](https://github.com/alesapin)) -- 阅读Kafka消息时修复无限循环。 [\#6354](https://github.com/ClickHouse/ClickHouse/pull/6354) ([abyss7](https://github.com/abyss7)) -- 修复了由于SQL解析器中的堆栈溢出和堆栈溢出的可能性而导致服务器崩溃的编造查询的可能性 `Merge` 和 `Distributed` 表 [\#6433](https://github.com/ClickHouse/ClickHouse/pull/6433) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在小序列固定大猩猩编码错误。 [\#6444](https://github.com/ClickHouse/ClickHouse/pull/6444) ([Enmk](https://github.com/Enmk)) - -#### 改进 {#improvement-5} - -- 允许用户复盖 `poll_interval` 和 `idle_connection_timeout` 连接设置。 [\#6230](https://github.com/ClickHouse/ClickHouse/pull/6230) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\戮漏鹿芦,酶,虏卤赂拢,110102003042 {#clickhouse-release-19-11-5-28-2019-08-05} - -#### 错误修复 {#bug-fix-19} - -- 修复了服务器超载时挂起查询的可能性。 [\#6301](https://github.com/ClickHouse/ClickHouse/pull/6301) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复yandexConsistentHash函数中的FPE。 这修复 [\#6304](https://github.com/ClickHouse/ClickHouse/issues/6304). [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正错误的转换 `LowCardinality` 类型 `AggregateFunctionFactory`. 这修复 [\#6257](https://github.com/ClickHouse/ClickHouse/issues/6257). [\#6281](https://github.com/ClickHouse/ClickHouse/pull/6281) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复解析 `bool` 从设置 `true` 和 `false` 配置文件中的字符串。 [\#6278](https://github.com/ClickHouse/ClickHouse/pull/6278) ([阿利沙平](https://github.com/alesapin)) -- 修复查询中不兼容的流头的罕见错误 `Distributed` 桌子结束 `MergeTree` 表时的一部分 `WHERE` 移动到 `PREWHERE`. [\#6236](https://github.com/ClickHouse/ClickHouse/pull/6236) ([阿利沙平](https://github.com/alesapin)) -- 在有符号类型的整数划分为无符号类型的固定溢出。 这修复 [\#6214](https://github.com/ClickHouse/ClickHouse/issues/6214). [\#6233](https://github.com/ClickHouse/ClickHouse/pull/6233) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 向后不兼容的更改 {#backward-incompatible-change-5} - -- `Kafka` 还是坏了 - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-4-24-2019-08-01} - -#### 错误修复 {#bug-fix-20} - -- 修复编写具有自适应粒度的二级索引标记的错误。 [\#6126](https://github.com/ClickHouse/ClickHouse/pull/6126) ([阿利沙平](https://github.com/alesapin)) -- 修复 `WITH ROLLUP` 和 `WITH CUBE` 修饰符 `GROUP BY` 具有两级聚合。 [\#6225](https://github.com/ClickHouse/ClickHouse/pull/6225) ([安东\*波波夫](https://github.com/CurtizJ)) -- 固定挂起 `JSONExtractRaw` 功能。 固定 [\#6195](https://github.com/ClickHouse/ClickHouse/issues/6195) [\#6198](https://github.com/ClickHouse/ClickHouse/pull/6198) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复ExternalLoader::reloadOutdated()中的段错误。 [\#6082](https://github.com/ClickHouse/ClickHouse/pull/6082) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复了服务器可能关闭侦听套接字但不关闭并继续提供剩余查询的情况。 您最终可能会有两个正在运行的clickhouse服务器进程。 有时,服务器可能会返回错误 `bad_function_call` 对于剩余的查询。 [\#6231](https://github.com/ClickHouse/ClickHouse/pull/6231) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了通过ODBC,MySQL,ClickHouse和HTTP初始加载外部字典的更新字段无用和不正确的条件。 这修复 [\#6069](https://github.com/ClickHouse/ClickHouse/issues/6069) [\#6083](https://github.com/ClickHouse/ClickHouse/pull/6083) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在固定不相关的异常转换 `LowCardinality(Nullable)` to not-Nullable column in case if it doesn't contain Nulls (e.g. in query like `SELECT CAST(CAST('Hello' AS LowCardinality(Nullable(String))) AS String)`. [\#6094](https://github.com/ClickHouse/ClickHouse/issues/6094) [\#6119](https://github.com/ClickHouse/ClickHouse/pull/6119) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复非确定性结果 “uniq” 在极少数情况下聚合函数。 该错误存在于所有ClickHouse版本。 [\#6058](https://github.com/ClickHouse/ClickHouse/pull/6058) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- Segfault当我们在函数上设置了一点点太高的CIDR `IPv6CIDRToRange`. [\#6068](https://github.com/ClickHouse/ClickHouse/pull/6068) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 修复了服务器从许多不同上下文中抛出许多异常时的小内存泄漏。 [\#6144](https://github.com/ClickHouse/ClickHouse/pull/6144) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复消费者在订阅之前暂停而之后未恢复的情况。 [\#6075](https://github.com/ClickHouse/ClickHouse/pull/6075) ([伊万](https://github.com/abyss7))请注意,卡夫卡在这个版本中被打破。 -- 从以前的读取操作中清除Kafka数据缓冲区,并且完成了错误操作 [\#6026](https://github.com/ClickHouse/ClickHouse/pull/6026) ([尼古拉](https://github.com/bopohaa))请注意,卡夫卡在这个版本中被打破。 -- 由于 `StorageMergeTree::background_task_handle` 在初始化 `startup()` 该 `MergeTreeBlockOutputStream::write()` 可以尝试在初始化之前使用它。 只需检查它是否被初始化。 [\#6080](https://github.com/ClickHouse/ClickHouse/pull/6080) ([伊万](https://github.com/abyss7)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-6} - -- 新增官方 `rpm` 包. [\#5740](https://github.com/ClickHouse/ClickHouse/pull/5740) ([proller](https://github.com/proller)) ([阿利沙平](https://github.com/alesapin)) -- 添加构建能力 `.rpm` 和 `.tgz` 包 `packager` 脚本 [\#5769](https://github.com/ClickHouse/ClickHouse/pull/5769) ([阿利沙平](https://github.com/alesapin)) -- 修复了 “Arcadia” 构建系统。 [\#6223](https://github.com/ClickHouse/ClickHouse/pull/6223) ([proller](https://github.com/proller)) - -#### 向后不兼容的更改 {#backward-incompatible-change-6} - -- `Kafka` 在这个版本中被打破。 - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-11-3-11-2019-07-18} - -#### 新功能 {#new-feature-6} - -- 增加了对准备好的语句的支持。 [\#5331](https://github.com/ClickHouse/ClickHouse/pull/5331/) ([亚历山大](https://github.com/sanych73)) [\#5630](https://github.com/ClickHouse/ClickHouse/pull/5630) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `DoubleDelta` 和 `Gorilla` 列编解ecs [\#5600](https://github.com/ClickHouse/ClickHouse/pull/5600) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 已添加 `os_thread_priority` 设置,允许控制 “nice” 操作系统用于调整动态调度优先级的查询处理线程的值。 它需要 `CAP_SYS_NICE` 能力的工作。 这实现了 [\#5858](https://github.com/ClickHouse/ClickHouse/issues/5858) [\#5909](https://github.com/ClickHouse/ClickHouse/pull/5909) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 执行 `_topic`, `_offset`, `_key` kafka引擎的列 [\#5382](https://github.com/ClickHouse/ClickHouse/pull/5382) ([伊万](https://github.com/abyss7))请注意,卡夫卡在这个版本中被打破。 -- 添加聚合函数组合 `-Resample` [\#5590](https://github.com/ClickHouse/ClickHouse/pull/5590) ([hcz](https://github.com/hczhcz)) -- 聚合函数 `groupArrayMovingSum(win_size)(x)` 和 `groupArrayMovingAvg(win_size)(x)`,计算移动和/平均有或没有窗口大小限制。 [\#5595](https://github.com/ClickHouse/ClickHouse/pull/5595) ([inv2004](https://github.com/inv2004)) -- 添加synonim `arrayFlatten` \<-\> `flatten` [\#5764](https://github.com/ClickHouse/ClickHouse/pull/5764) ([hcz](https://github.com/hczhcz)) -- Intergate H3功能 `geoToH3` 从尤伯杯. [\#4724](https://github.com/ClickHouse/ClickHouse/pull/4724) ([Remen Ivan](https://github.com/BHYCHIK)) [\#5805](https://github.com/ClickHouse/ClickHouse/pull/5805) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 错误修复 {#bug-fix-21} - -- 使用异步更新实现DNS缓存。 单独的线程解析所有主机并更新dns缓存(设置 `dns_cache_update_period`). 当主机的ip频繁更改时,它应该有所帮助。 [\#5857](https://github.com/ClickHouse/ClickHouse/pull/5857) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复段错误 `Delta` 影响值小于32位大小的列的编解ec。 该错误导致随机内存损坏。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([阿利沙平](https://github.com/alesapin)) -- 修复ttl合并中的段错误与块中的非物理列。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复在检查部分罕见的错误 `LowCardinality` 列。 前情提要 `checkDataPart` 总是失败的一部分 `LowCardinality` 列。 [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([阿利沙平](https://github.com/alesapin)) -- 避免在服务器线程池已满时挂起连接。 它是从连接重要 `remote` 当连接超时时,表函数或连接到没有副本的分片。 这修复 [\#5878](https://github.com/ClickHouse/ClickHouse/issues/5878) [\#5881](https://github.com/ClickHouse/ClickHouse/pull/5881) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 支持常量参数 `evalMLModel` 功能。 这修复 [\#5817](https://github.com/ClickHouse/ClickHouse/issues/5817) [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了ClickHouse将默认时区确定为 `UCT` 而不是 `UTC`. 这修复 [\#5804](https://github.com/ClickHouse/ClickHouse/issues/5804). [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定缓冲区下溢 `visitParamExtractRaw`. 这修复 [\#5901](https://github.com/ClickHouse/ClickHouse/issues/5901) [\#5902](https://github.com/ClickHouse/ClickHouse/pull/5902) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 现在分发 `DROP/ALTER/TRUNCATE/OPTIMIZE ON CLUSTER` 查询将直接在leader副本上执行。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([阿利沙平](https://github.com/alesapin)) -- 修复 `coalesce` 为 `ColumnConst` 与 `ColumnNullable` +相关变化. [\#5755](https://github.com/ClickHouse/ClickHouse/pull/5755) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复 `ReadBufferFromKafkaConsumer` 所以它不断阅读新的消息后 `commit()` 即使它之前停滞不前 [\#5852](https://github.com/ClickHouse/ClickHouse/pull/5852) ([伊万](https://github.com/abyss7)) -- 修复 `FULL` 和 `RIGHT` 加入时加入结果 `Nullable` 键在右表. [\#5859](https://github.com/ClickHouse/ClickHouse/pull/5859) ([Artem Zuikov](https://github.com/4ertus2)) -- 可能修复低优先级查询的无限休眠。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复争用条件,这导致某些查询可能不会出现在query\_log后 `SYSTEM FLUSH LOGS` 查询。 [\#5456](https://github.com/ClickHouse/ClickHouse/issues/5456) [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([安东\*波波夫](https://github.com/CurtizJ)) -- 固定 `heap-use-after-free` 由手表引起的ClusterCopier中的警告尝试使用已经删除的复印机对象。 [\#5871](https://github.com/ClickHouse/ClickHouse/pull/5871) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复错误 `StringRef` 由一些实现返回的指针 `IColumn::deserializeAndInsertFromArena`. 这个错误只影响单元测试。 [\#5973](https://github.com/ClickHouse/ClickHouse/pull/5973) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 防止源数组和中间数组连接掩蔽相同名称列的列。 [\#5941](https://github.com/ClickHouse/ClickHouse/pull/5941) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复插入并选择查询MySQL引擎与MySQL样式标识符引用。 [\#5704](https://github.com/ClickHouse/ClickHouse/pull/5704) ([张冬](https://github.com/zhang2014)) -- 现在 `CHECK TABLE` 查询可以与MergeTree引擎系列一起使用。 它返回检查状态和消息,如果任何为每个部分(或文件在simplier引擎的情况下)。 此外,修复获取损坏部分的错误。 [\#5865](https://github.com/ClickHouse/ClickHouse/pull/5865) ([阿利沙平](https://github.com/alesapin)) -- 修复SPLIT\_SHARED\_LIBRARY运行时 [\#5793](https://github.com/ClickHouse/ClickHouse/pull/5793) ([Danila Kutenin](https://github.com/danlark1)) -- 固定时区初始化时 `/etc/localtime` 是一个相对的符号链接,如 `../usr/share/zoneinfo/Europe/Moscow` [\#5922](https://github.com/ClickHouse/ClickHouse/pull/5922) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- clickhouse复印机:修复使用-关机后免费 [\#5752](https://github.com/ClickHouse/ClickHouse/pull/5752) ([proller](https://github.com/proller)) -- 更新 `simdjson`. 修复了一些无效的零字节Json成功解析的问题。 [\#5938](https://github.com/ClickHouse/ClickHouse/pull/5938) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复系统日志的关机 [\#5802](https://github.com/ClickHouse/ClickHouse/pull/5802) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复当invalidate\_query中的条件取决于字典时挂起。 [\#6011](https://github.com/ClickHouse/ClickHouse/pull/6011) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) - -#### 改进 {#improvement-6} - -- 允许群集配置中的无法解析的地址。 它们将被视为不可用,并尝试在每次连接尝试时解决。 这对Kubernetes特别有用。 这修复 [\#5714](https://github.com/ClickHouse/ClickHouse/issues/5714) [\#5924](https://github.com/ClickHouse/ClickHouse/pull/5924) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 关闭空闲TCP连接(默认情况下为一小时超时)。 这对于每台服务器上具有多个分布式表的大型集群尤其重要,因为每台服务器都可能保留与其他服务器的连接池,并且在高峰查询并发之后,连接将停 这修复 [\#5879](https://github.com/ClickHouse/ClickHouse/issues/5879) [\#5880](https://github.com/ClickHouse/ClickHouse/pull/5880) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 更好的质量 `topK` 功能。 如果新元素具有更大的权重,则更改了SavingSpace set行为以删除最后一个元素。 [\#5833](https://github.com/ClickHouse/ClickHouse/issues/5833) [\#5850](https://github.com/ClickHouse/ClickHouse/pull/5850) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 与域一起使用的URL函数现在可以在没有方案的情况下适用于不完整的Url [\#5725](https://github.com/ClickHouse/ClickHouse/pull/5725) ([阿利沙平](https://github.com/alesapin)) -- 校验和添加到 `system.parts_columns` 桌子 [\#5874](https://github.com/ClickHouse/ClickHouse/pull/5874) ([尼基塔\*米哈伊洛夫](https://github.com/nikitamikhaylov)) -- 已添加 `Enum` 数据类型作为synonim `Enum8` 或 `Enum16`. [\#5886](https://github.com/ClickHouse/ClickHouse/pull/5886) ([dimarub2000](https://github.com/dimarub2000)) -- 全位转置变种 `T64` 编解ec 可能会导致更好的压缩 `zstd`. [\#5742](https://github.com/ClickHouse/ClickHouse/pull/5742) ([Artem Zuikov](https://github.com/4ertus2)) -- 条件 `startsWith` 函数现在可以使用主键。 这修复 [\#5310](https://github.com/ClickHouse/ClickHouse/issues/5310) 和 [\#5882](https://github.com/ClickHouse/ClickHouse/issues/5882) [\#5919](https://github.com/ClickHouse/ClickHouse/pull/5919) ([dimarub2000](https://github.com/dimarub2000)) -- 允许使用 `clickhouse-copier` 通过允许空数据库名称来实现具有交叉复制的群集拓扑。 [\#5745](https://github.com/ClickHouse/ClickHouse/pull/5745) ([纳瓦托洛梅](https://github.com/nvartolomei)) -- 使用 `UTC` 作为系统上的默认时区,而不 `tzdata` (e.g. bare Docker container). Before this patch, error message `Could not determine local time zone` 被打印并且服务器或客户机拒绝启动。 [\#5827](https://github.com/ClickHouse/ClickHouse/pull/5827) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 返回对函数中浮点参数的支持 `quantileTiming` 为了向后兼容性。 [\#5911](https://github.com/ClickHouse/ClickHouse/pull/5911) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在错误消息中显示哪个表缺少列。 [\#5768](https://github.com/ClickHouse/ClickHouse/pull/5768) ([伊万](https://github.com/abyss7)) -- 不允许不同用户使用相同的query\_id运行查询 [\#5430](https://github.com/ClickHouse/ClickHouse/pull/5430) ([proller](https://github.com/proller)) -- 用于向Graphite发送指标的更强大的代码。 它甚至可以在长时间的多重工作 `RENAME TABLE` 操作。 [\#5875](https://github.com/ClickHouse/ClickHouse/pull/5875) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 当ThreadPool无法计划执行任务时,将显示更多信息错误消息。 这修复 [\#5305](https://github.com/ClickHouse/ClickHouse/issues/5305) [\#5801](https://github.com/ClickHouse/ClickHouse/pull/5801) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 反转ngramSearch更直观 [\#5807](https://github.com/ClickHouse/ClickHouse/pull/5807) ([Danila Kutenin](https://github.com/danlark1)) -- 在HDFS引擎生成器中添加用户解析 [\#5946](https://github.com/ClickHouse/ClickHouse/pull/5946) ([akonyaev90](https://github.com/akonyaev90)) -- 更新默认值 `max_ast_elements parameter` [\#5933](https://github.com/ClickHouse/ClickHouse/pull/5933) ([Artem Konovalov](https://github.com/izebit)) -- 增加了过时设置的概念。 过时的设置 `allow_experimental_low_cardinality_type` 可以没有效果使用。 [0f15c01c6802f7ce1a1494c12c846be8c98944cd](https://github.com/ClickHouse/ClickHouse/commit/0f15c01c6802f7ce1a1494c12c846be8c98944cd) [Alexey Milovidov](https://github.com/alexey-milovidov) - -#### 性能改进 {#performance-improvement-4} - -- 增加从合并表中选择的流数量,以便更均匀地分布线程。 添加设置 `max_streams_multiplier_for_merge_tables`. 这修复 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5915](https://github.com/ClickHouse/ClickHouse/pull/5915) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-7} - -- 为与不同版本的clickhouse的客户端-服务器交互添加向后兼容性测试。 [\#5868](https://github.com/ClickHouse/ClickHouse/pull/5868) ([阿利沙平](https://github.com/alesapin)) -- 每个提交和拉取请求中的测试复盖率信息。 [\#5896](https://github.com/ClickHouse/ClickHouse/pull/5896) ([阿利沙平](https://github.com/alesapin)) -- 与address sanitizer合作,支持我们的自定义分alloc (`Arena` 和 `ArenaWithFreeLists`)为了更好地调试 “use-after-free” 错误。 [\#5728](https://github.com/ClickHouse/ClickHouse/pull/5728) ([akuzm](https://github.com/akuzm)) -- 切换到 [LLVM libunwind实现](https://github.com/llvm-mirror/libunwind) 用于C++异常处理和堆栈跟踪打印 [\#4828](https://github.com/ClickHouse/ClickHouse/pull/4828) ([尼基塔\*拉普科夫](https://github.com/laplab)) -- 添加来自-Weverything的两个警告 [\#5923](https://github.com/ClickHouse/ClickHouse/pull/5923) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 允许用内存消毒剂建立ClickHouse。 [\#3949](https://github.com/ClickHouse/ClickHouse/pull/3949) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 关于固定的ubsan报告 `bitTest` 在模糊测试功能。 [\#5943](https://github.com/ClickHouse/ClickHouse/pull/5943) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- Docker:增加了初始化需要身份验证的ClickHouse实例的可能性。 [\#5727](https://github.com/ClickHouse/ClickHouse/pull/5727) ([科尔维亚科夫\*安德烈](https://github.com/shurshun)) -- 将librdkafka更新到版本1.1.0 [\#5872](https://github.com/ClickHouse/ClickHouse/pull/5872) ([伊万](https://github.com/abyss7)) -- 为集成测试添加全局超时,并在测试代码中禁用其中一些。 [\#5741](https://github.com/ClickHouse/ClickHouse/pull/5741) ([阿利沙平](https://github.com/alesapin)) -- 修复一些ThreadSanitizer故障。 [\#5854](https://github.com/ClickHouse/ClickHouse/pull/5854) ([akuzm](https://github.com/akuzm)) -- 该 `--no-undefined` 选项强制链接器在链接时检查所有外部名称是否存在。 在拆分构建模式下跟踪库之间的真实依赖关系非常有用。 [\#5855](https://github.com/ClickHouse/ClickHouse/pull/5855) ([伊万](https://github.com/abyss7)) -- 增加了性能测试 [\#5797](https://github.com/ClickHouse/ClickHouse/issues/5797) [\#5914](https://github.com/ClickHouse/ClickHouse/pull/5914) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 与gcc-7固定兼容性。 [\#5840](https://github.com/ClickHouse/ClickHouse/pull/5840) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了对gcc-9的支持。 这修复 [\#5717](https://github.com/ClickHouse/ClickHouse/issues/5717) [\#5774](https://github.com/ClickHouse/ClickHouse/pull/5774) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了libunwind链接不正确时的错误。 [\#5948](https://github.com/ClickHouse/ClickHouse/pull/5948) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了PVS-Studio发现的一些警告。 [\#5921](https://github.com/ClickHouse/ClickHouse/pull/5921) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了初始支持 `clang-tidy` 静态分析仪。 [\#5806](https://github.com/ClickHouse/ClickHouse/pull/5806) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 转换BSD/Linux endian宏( ‘be64toh’ 和 ‘htobe64’)到Mac OS x当量 [\#5785](https://github.com/ClickHouse/ClickHouse/pull/5785) ([傅辰](https://github.com/fredchenbj)) -- 改进的集成测试指南. [\#5796](https://github.com/ClickHouse/ClickHouse/pull/5796) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 在macosx+gcc9修复构建 [\#5822](https://github.com/ClickHouse/ClickHouse/pull/5822) ([filimonov](https://github.com/filimonov)) -- 修复难以识别的错字:aggreAGte-\>aggregate。 [\#5753](https://github.com/ClickHouse/ClickHouse/pull/5753) ([akuzm](https://github.com/akuzm)) -- 修复freebsd构建 [\#5760](https://github.com/ClickHouse/ClickHouse/pull/5760) ([proller](https://github.com/proller)) -- 添加链接到实验YouTube频道的网站 [\#5845](https://github.com/ClickHouse/ClickHouse/pull/5845) ([伊万\*布林科夫](https://github.com/blinkov)) -- CMake:为复盖率标志添加选项:WITH\_COVERAGE [\#5776](https://github.com/ClickHouse/ClickHouse/pull/5776) ([proller](https://github.com/proller)) -- 修复一些内联PODArray的初始大小。 [\#5787](https://github.com/ClickHouse/ClickHouse/pull/5787) ([akuzm](https://github.com/akuzm)) -- clickhouse服务器.postinst:修复centos6的操作系统检测 [\#5788](https://github.com/ClickHouse/ClickHouse/pull/5788) ([proller](https://github.com/proller)) -- 添加Arch linux软件包生成。 [\#5719](https://github.com/ClickHouse/ClickHouse/pull/5719) ([Vladimir Chebotarev](https://github.com/excitoon)) -- 拆分常见/配置.h by libs(dbms) [\#5715](https://github.com/ClickHouse/ClickHouse/pull/5715) ([proller](https://github.com/proller)) -- 修复了 “Arcadia” 构建平台 [\#5795](https://github.com/ClickHouse/ClickHouse/pull/5795) ([proller](https://github.com/proller)) -- 修复了非常规构建(gcc9,没有子模块) [\#5792](https://github.com/ClickHouse/ClickHouse/pull/5792) ([proller](https://github.com/proller)) -- 在unalignedStore中需要显式类型,因为它被证明容易出现错误 [\#5791](https://github.com/ClickHouse/ClickHouse/pull/5791) ([akuzm](https://github.com/akuzm)) -- 修复MacOS构建 [\#5830](https://github.com/ClickHouse/ClickHouse/pull/5830) ([filimonov](https://github.com/filimonov)) -- 关于具有更大数据集的新JIT功能的性能测试,请参阅此处 [\#5263](https://github.com/ClickHouse/ClickHouse/issues/5263) [\#5887](https://github.com/ClickHouse/ClickHouse/pull/5887) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 在压力测试中运行有状态测试 [12693e568722f11e19859742f56428455501fd2a](https://github.com/ClickHouse/ClickHouse/commit/12693e568722f11e19859742f56428455501fd2a) ([阿利沙平](https://github.com/alesapin)) - -#### 向后不兼容的更改 {#backward-incompatible-change-7} - -- `Kafka` 在这个版本中被打破。 -- 启用 `adaptive_index_granularity` =10mb默认为新 `MergeTree` 桌子 如果您在19.11+版本上创建了新的MergeTree表,则不可能降级到19.6之前的版本。 [\#5628](https://github.com/ClickHouse/ClickHouse/pull/5628) ([阿利沙平](https://github.com/alesapin)) -- 删除了Yandex使用的过时无证嵌入式字典。梅特里卡 功能 `OSIn`, `SEIn`, `OSToRoot`, `SEToRoot`, `OSHierarchy`, `SEHierarchy` 不再可用。 如果您正在使用这些功能,请写电子邮件至clickhouse-feedback@yandex-team.com注:在最后时刻,我们决定保持这些功能一段时间。 [\#5780](https://github.com/ClickHouse/ClickHouse/pull/5780) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -## ClickHouse释放19.10 {#clickhouse-release-19-10} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-10-1-5-2019-07-12} - -#### 新功能 {#new-feature-7} - -- 添加新列编解ec: `T64`. 为(U)IntX/EnumX/Data(时间)/DecimalX列制作。 它应该适用于具有常量或小范围值的列。 编解码器本身允许放大或缩小数据类型而无需重新压缩。 [\#5557](https://github.com/ClickHouse/ClickHouse/pull/5557) ([Artem Zuikov](https://github.com/4ertus2)) -- 添加数据库引擎 `MySQL` 允许查看远程MySQL服务器中的所有表 [\#5599](https://github.com/ClickHouse/ClickHouse/pull/5599) ([张冬](https://github.com/zhang2014)) -- `bitmapContains` 执行。 这是2倍的速度比 `bitmapHasAny` 如果第二个位图包含一个元素。 [\#5535](https://github.com/ClickHouse/ClickHouse/pull/5535) ([余志昌](https://github.com/yuzhichang)) -- 支持 `crc32` 功能(与MySQL或PHP中的行为完全相同)。 如果您需要散列函数,请不要使用它。 [\#5661](https://github.com/ClickHouse/ClickHouse/pull/5661) ([Remen Ivan](https://github.com/BHYCHIK)) -- 已实施 `SYSTEM START/STOP DISTRIBUTED SENDS` 查询控制异步插入到 `Distributed` 桌子 [\#4935](https://github.com/ClickHouse/ClickHouse/pull/4935) ([张冬](https://github.com/zhang2014)) - -#### 错误修复 {#bug-fix-22} - -- 在执行突变时忽略查询执行限制和合并限制的最大部件大小。 [\#5659](https://github.com/ClickHouse/ClickHouse/pull/5659) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复可能导致重复数据删除正常块(极其罕见)和插入重复块(更常见)的错误。 [\#5549](https://github.com/ClickHouse/ClickHouse/pull/5549) ([阿利沙平](https://github.com/alesapin)) -- 功能修复 `arrayEnumerateUniqRanked` 对于具有空数组的参数 [\#5559](https://github.com/ClickHouse/ClickHouse/pull/5559) ([proller](https://github.com/proller)) -- 不要在没有轮询任何消息的情况下订阅Kafka主题。 [\#5698](https://github.com/ClickHouse/ClickHouse/pull/5698) ([伊万](https://github.com/abyss7)) -- 使设置 `join_use_nulls` 对于不能在Nullable内的类型不起作用 [\#5700](https://github.com/ClickHouse/ClickHouse/pull/5700) ([Olga Khvostikova](https://github.com/stavrolia)) -- 固定 `Incorrect size of index granularity` 错误 [\#5720](https://github.com/ClickHouse/ClickHouse/pull/5720) ([coraxster](https://github.com/coraxster)) -- 修正浮动到十进制转换溢出 [\#5607](https://github.com/ClickHouse/ClickHouse/pull/5607) ([coraxster](https://github.com/coraxster)) -- 冲洗缓冲区时 `WriteBufferFromHDFS`的析构函数被调用。 这修复了写入 `HDFS`. [\#5684](https://github.com/ClickHouse/ClickHouse/pull/5684) ([新东鹏](https://github.com/eejoin)) - -#### 改进 {#improvement-7} - -- 对待空单元格 `CSV` 作为默认值时的设置 `input_format_defaults_for_omitted_fields` 被启用。 [\#5625](https://github.com/ClickHouse/ClickHouse/pull/5625) ([akuzm](https://github.com/akuzm)) -- 外部字典的非阻塞加载。 [\#5567](https://github.com/ClickHouse/ClickHouse/pull/5567) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 可以根据设置动态更改已建立的连接的网络超时。 [\#4558](https://github.com/ClickHouse/ClickHouse/pull/4558) ([Konstantin Podshumok](https://github.com/podshumok)) -- 使用 “public\_suffix\_list” 对于功能 `firstSignificantSubdomain`, `cutToFirstSignificantSubdomain`. 它使用一个完美的哈希表生成 `gperf` 从文件生成的列表:https://publicsuffix.org/list/public\_suffix\_list.dat(例如,现在我们认识到域 `ac.uk` 作为非显着)。 [\#5030](https://github.com/ClickHouse/ClickHouse/pull/5030) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 通过 `IPv6` 系统表中的数据类型;统一客户端信息列 `system.processes` 和 `system.query_log` [\#5640](https://github.com/ClickHouse/ClickHouse/pull/5640) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 使用会话与MySQL兼容性协议的连接。 \#5476 [\#5646](https://github.com/ClickHouse/ClickHouse/pull/5646) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 支持更多 `ALTER` 查询 `ON CLUSTER`. [\#5593](https://github.com/ClickHouse/ClickHouse/pull/5593) [\#5613](https://github.com/ClickHouse/ClickHouse/pull/5613) ([sundyli](https://github.com/sundy-li)) -- 碌莽禄Support: `` 第1节 `clickhouse-local` 配置文件。 [\#5540](https://github.com/ClickHouse/ClickHouse/pull/5540) ([proller](https://github.com/proller)) -- 允许运行查询 `remote` 表函数 `clickhouse-local` [\#5627](https://github.com/ClickHouse/ClickHouse/pull/5627) ([proller](https://github.com/proller)) - -#### 性能改进 {#performance-improvement-5} - -- 添加在MergeTree列末尾写最后标记的可能性。 它允许避免对超出表数据范围的键进行无用的读取。 仅当使用自适应索引粒度时才启用此功能。 [\#5624](https://github.com/ClickHouse/ClickHouse/pull/5624) ([阿利沙平](https://github.com/alesapin)) -- 通过减少非常慢的文件系统上的MergeTree表的性能 `stat` syscalls [\#5648](https://github.com/ClickHouse/ClickHouse/pull/5648) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了从版本19.6中引入的MergeTree表读取时的性能下降。 修复#5631。 [\#5633](https://github.com/ClickHouse/ClickHouse/pull/5633) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-8} - -- 已实施 `TestKeeper` 作为用于测试的ZooKeeper接口的实现 [\#5643](https://github.com/ClickHouse/ClickHouse/pull/5643) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) ([levushkin aleksej](https://github.com/alexey-milovidov)) -- 从现在起 `.sql` 测试可以通过服务器隔离,并行运行,并使用随机数据库。 它允许更快地运行它们,使用自定义服务器配置添加新的测试,并确保不同的测试不会相互影响。 [\#5554](https://github.com/ClickHouse/ClickHouse/pull/5554) ([伊万](https://github.com/abyss7)) -- 删除 `` 和 `` 从性能测试 [\#5672](https://github.com/ClickHouse/ClickHouse/pull/5672) ([Olga Khvostikova](https://github.com/stavrolia)) -- 固定 “select\_format” 性能测试 `Pretty` 格式 [\#5642](https://github.com/ClickHouse/ClickHouse/pull/5642) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -## ClickHouse释放19.9 {#clickhouse-release-19-9} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-9-3-31-2019-07-05} - -#### 错误修复 {#bug-fix-23} - -- 修复增量编解码器中的段错误,这会影响值小于32位大小的列。 该错误导致随机内存损坏。 [\#5786](https://github.com/ClickHouse/ClickHouse/pull/5786) ([阿利沙平](https://github.com/alesapin)) -- 修复在检查部分低心率列中罕见的错误。 [\#5832](https://github.com/ClickHouse/ClickHouse/pull/5832) ([阿利沙平](https://github.com/alesapin)) -- 修复ttl合并中的段错误与块中的非物理列。 [\#5819](https://github.com/ClickHouse/ClickHouse/pull/5819) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复低优先级查询的潜在无限休眠。 [\#5842](https://github.com/ClickHouse/ClickHouse/pull/5842) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复ClickHouse如何将默认时区确定为UCT而不是UTC。 [\#5828](https://github.com/ClickHouse/ClickHouse/pull/5828) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复在领导者副本之前的跟随者副本上执行分布式删除/更改/截断/优化集群查询的错误。 现在他们将直接在领导者副本上执行。 [\#5757](https://github.com/ClickHouse/ClickHouse/pull/5757) ([阿利沙平](https://github.com/alesapin)) -- 修复了系统刷新日志查询后某些查询可能不会立即出现在query\_log中的竞争条件。 [\#5685](https://github.com/ClickHouse/ClickHouse/pull/5685) ([安东\*波波夫](https://github.com/CurtizJ)) -- 增加了对常量参数的缺失支持 `evalMLModel` 功能。 [\#5820](https://github.com/ClickHouse/ClickHouse/pull/5820) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-9-2-4-2019-06-24} - -#### 新功能 {#new-feature-8} - -- 打印有关冷冻部件的信息 `system.parts` 桌子 [\#5471](https://github.com/ClickHouse/ClickHouse/pull/5471) ([proller](https://github.com/proller)) -- 在clickhouse上询问客户端密码-如果未在参数中设置,则在tty上启动客户端 [\#5092](https://github.com/ClickHouse/ClickHouse/pull/5092) ([proller](https://github.com/proller)) -- 执行 `dictGet` 和 `dictGetOrDefault` 十进制类型的函数。 [\#5394](https://github.com/ClickHouse/ClickHouse/pull/5394) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 改进 {#improvement-8} - -- Debian的初始化:添加服务停止超时 [\#5522](https://github.com/ClickHouse/ClickHouse/pull/5522) ([proller](https://github.com/proller)) -- 默认情况下添加禁止设置,以创建具有可疑类型的表格 [\#5448](https://github.com/ClickHouse/ClickHouse/pull/5448) ([Olga Khvostikova](https://github.com/stavrolia)) -- 当不用作函数中的状态时,回归函数返回模型权重 `evalMLMethod`. [\#5411](https://github.com/ClickHouse/ClickHouse/pull/5411) ([Quid37](https://github.com/Quid37)) -- 重命名和改进回归方法。 [\#5492](https://github.com/ClickHouse/ClickHouse/pull/5492) ([Quid37](https://github.com/Quid37)) -- 更清晰的字符串搜索界面。 [\#5586](https://github.com/ClickHouse/ClickHouse/pull/5586) ([Danila Kutenin](https://github.com/danlark1)) - -#### 错误修复 {#bug-fix-24} - -- 修复Kafka中潜在的数据丢失 [\#5445](https://github.com/ClickHouse/ClickHouse/pull/5445) ([伊万](https://github.com/abyss7)) -- 修复潜在的无限循环 `PrettySpace` 使用零列调用时的格式 [\#5560](https://github.com/ClickHouse/ClickHouse/pull/5560) ([Olga Khvostikova](https://github.com/stavrolia)) -- 修正了线性模型中的UInt32溢出错误。 允许对非常量模型参数的eval ML模型。 [\#5516](https://github.com/ClickHouse/ClickHouse/pull/5516) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- `ALTER TABLE ... DROP INDEX IF EXISTS ...` 如果提供的索引不存在,则不应引发异常 [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) -- 修复段错误 `bitmapHasAny` 在标量子查询中 [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([余志昌](https://github.com/yuzhichang)) -- 修复了复制连接池不重试解析主机时的错误,即使删除了DNS缓存。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([阿利沙平](https://github.com/alesapin)) -- 固定 `ALTER ... MODIFY TTL` 在ReplicatedMergeTree上。 [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539) ([安东\*波波夫](https://github.com/CurtizJ)) -- 修复插入到具体化列的分布式表中 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) -- 修复截断联接存储时的错误alloc [\#5437](https://github.com/ClickHouse/ClickHouse/pull/5437) ([TCeason](https://github.com/TCeason)) -- 在最近版本的包tzdata中,现在有些文件是符号链接。 当前用于检测默认时区的机制被打破,并为某些时区提供错误的名称。 现在至少我们强制时区名称到TZ的内容,如果提供。 [\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([伊万](https://github.com/abyss7)) -- 修复一些极为罕见的情况下,MultiVolnitsky搜索器时,在总和恒定针至少16KB长。 该算法错过或复盖以前的结果,这可能导致错误的结果 `multiSearchAny`. [\#5588](https://github.com/ClickHouse/ClickHouse/pull/5588) ([Danila Kutenin](https://github.com/danlark1)) -- 修复ExternalData请求的设置无法使用ClickHouse设置时的问题。 此外,现在,设置 `date_time_input_format` 和 `low_cardinality_allow_in_native_format` 由于名称的歧义,无法使用(在外部数据中,它可以解释为表格式,在查询中它可以是一个设置)。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila Kutenin](https://github.com/danlark1)) -- 修复只从FS中删除部件而不从Zookeeper中删除部件时的错误。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([阿利沙平](https://github.com/alesapin)) -- 从MySQL协议中删除调试日志记录 [\#5478](https://github.com/ClickHouse/ClickHouse/pull/5478) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在DDL查询处理过程中跳过ZNONODE [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- 修复混合 `UNION ALL` 结果列类型。 有些情况下,结果列的数据和列类型不一致。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- 在错误的整数上抛出异常 `dictGetT` 功能,而不是崩溃。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复散列字典中错误的element\_count和load\_factor `system.dictionaries` 桌子 [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-9} - -- 固定构建没有 `Brotli` HTTP压缩支持 (`ENABLE_BROTLI=OFF` cmake变量)。 [\#5521](https://github.com/ClickHouse/ClickHouse/pull/5521) ([Anton Yuzhaninov](https://github.com/citrin)) -- 包括ro哮。h为ro哮/咆哮。h [\#5523](https://github.com/ClickHouse/ClickHouse/pull/5523) ([Origej Desh](https://github.com/orivej)) -- 修复超扫描中的gcc9警告(#行指令是邪恶的!) [\#5546](https://github.com/ClickHouse/ClickHouse/pull/5546) ([Danila Kutenin](https://github.com/danlark1)) -- 使用gcc-9编译时修复所有警告。 修复一些contrib问题。 修复gcc9ICE并将其提交给bugzilla。 [\#5498](https://github.com/ClickHouse/ClickHouse/pull/5498) ([Danila Kutenin](https://github.com/danlark1)) -- 与lld固定链接 [\#5477](https://github.com/ClickHouse/ClickHouse/pull/5477) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 删除字典中未使用的专业化 [\#5452](https://github.com/ClickHouse/ClickHouse/pull/5452) ([Artem Zuikov](https://github.com/4ertus2)) -- 针对不同类型的文件进行格式化和解析表的改进性能测试 [\#5497](https://github.com/ClickHouse/ClickHouse/pull/5497) ([Olga Khvostikova](https://github.com/stavrolia)) -- 修复并行测试运行 [\#5506](https://github.com/ClickHouse/ClickHouse/pull/5506) ([proller](https://github.com/proller)) -- Docker:使用clickhouse-test中的configs [\#5531](https://github.com/ClickHouse/ClickHouse/pull/5531) ([proller](https://github.com/proller)) -- 修复编译为FreeBSD [\#5447](https://github.com/ClickHouse/ClickHouse/pull/5447) ([proller](https://github.com/proller)) -- 升级提升到1.70 [\#5570](https://github.com/ClickHouse/ClickHouse/pull/5570) ([proller](https://github.com/proller)) -- 修复构建clickhouse作为子模块 [\#5574](https://github.com/ClickHouse/ClickHouse/pull/5574) ([proller](https://github.com/proller)) -- 改进JSONExtract性能测试 [\#5444](https://github.com/ClickHouse/ClickHouse/pull/5444) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) - -## ClickHouse释放19.8 {#clickhouse-release-19-8} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-8-3-8-2019-06-11} - -#### 新功能 {#new-features} - -- 添加了与JSON一起使用的函数 [\#4686](https://github.com/ClickHouse/ClickHouse/pull/4686) ([hcz](https://github.com/hczhcz)) [\#5124](https://github.com/ClickHouse/ClickHouse/pull/5124). ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 添加一个函数basename,具有类似于basename函数的行为,它存在于许多语言中 (`os.path.basename` 在python中, `basename` in PHP, etc…). Work with both an UNIX-like path or a Windows path. [\#5136](https://github.com/ClickHouse/ClickHouse/pull/5136) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 已添加 `LIMIT n, m BY` 或 `LIMIT m OFFSET n BY` 为LIMIT BY子句设置n偏移量的语法。 [\#5138](https://github.com/ClickHouse/ClickHouse/pull/5138) ([安东\*波波夫](https://github.com/CurtizJ)) -- 增加了新的数据类型 `SimpleAggregateFunction`,它允许在一个具有光聚集的列 `AggregatingMergeTree`. 这只能用于简单的功能,如 `any`, `anyLast`, `sum`, `min`, `max`. [\#4629](https://github.com/ClickHouse/ClickHouse/pull/4629) ([Boris Granveaud](https://github.com/bgranvea)) -- 增加了对函数中非常量参数的支持 `ngramDistance` [\#5198](https://github.com/ClickHouse/ClickHouse/pull/5198) ([Danila Kutenin](https://github.com/danlark1)) -- 新增功能 `skewPop`, `skewSamp`, `kurtPop` 和 `kurtSamp` 分别计算序列偏度、样本偏度、峰度和样本峰度。 [\#5200](https://github.com/ClickHouse/ClickHouse/pull/5200) ([hcz](https://github.com/hczhcz)) -- 支持重命名操作 `MaterializeView` 存储。 [\#5209](https://github.com/ClickHouse/ClickHouse/pull/5209) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 添加了允许使用MySQL客户端连接到ClickHouse的服务器。 [\#4715](https://github.com/ClickHouse/ClickHouse/pull/4715) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 添加 `toDecimal*OrZero` 和 `toDecimal*OrNull` 功能。 [\#5291](https://github.com/ClickHouse/ClickHouse/pull/5291) ([Artem Zuikov](https://github.com/4ertus2)) -- 支持函数中的十进制类型: `quantile`, `quantiles`, `median`, `quantileExactWeighted`, `quantilesExactWeighted` 媒体加权。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) -- 已添加 `toValidUTF8` function, which replaces all invalid UTF-8 characters by replacement character � (U+FFFD). [\#5322](https://github.com/ClickHouse/ClickHouse/pull/5322) ([Danila Kutenin](https://github.com/danlark1)) -- 已添加 `format` 功能。 使用参数中列出的字符串格式化常量模式(简化的Python格式模式)。 [\#5330](https://github.com/ClickHouse/ClickHouse/pull/5330) ([Danila Kutenin](https://github.com/danlark1)) -- 已添加 `system.detached_parts` 表包含有关分离部分的信息 `MergeTree` 桌子 [\#5353](https://github.com/ClickHouse/ClickHouse/pull/5353) ([akuzm](https://github.com/akuzm)) -- 已添加 `ngramSearch` 函数来计算针和大海捞针之间的非对称差异。 [\#5418](https://github.com/ClickHouse/ClickHouse/pull/5418)[\#5422](https://github.com/ClickHouse/ClickHouse/pull/5422) ([Danila Kutenin](https://github.com/danlark1)) -- 使用聚合函数接口实现基本的机器学习方法(随机线性回归和逻辑回归)。 有不同的策略,用于更新模型权重(简单梯度下降,动量法,涅斯捷罗夫法)。 还支持自定义大小的小批次。 [\#4943](https://github.com/ClickHouse/ClickHouse/pull/4943) ([Quid37](https://github.com/Quid37)) -- 执行 `geohashEncode` 和 `geohashDecode` 功能。 [\#5003](https://github.com/ClickHouse/ClickHouse/pull/5003) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 添加聚合功能 `timeSeriesGroupSum`,从而可以聚合不同的时间序列,即采样时间戳不对齐。 它将在两个采样时间戳之间使用线性插值,然后将时间序列和在一起。 添加聚合功能 `timeSeriesGroupRateSum`,它计算时间序列的速率,然后将速率总和在一起。 [\#4542](https://github.com/ClickHouse/ClickHouse/pull/4542) ([刘杨宽](https://github.com/LiuYangkuan)) -- 新增功能 `IPv4CIDRtoIPv4Range` 和 `IPv6CIDRtoIPv6Range` 使用CIDR计算子网中IP的下限和上限。 [\#5095](https://github.com/ClickHouse/ClickHouse/pull/5095) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) -- 添加一个X-ClickHouse-Summary头,当我们发送查询使用HTTP启用设置 `send_progress_in_http_headers`. 返回X-ClickHouse-Progress的常用信息,以及其他信息,例如在查询中插入了多少行和字节。 [\#5116](https://github.com/ClickHouse/ClickHouse/pull/5116) ([纪尧姆\*塔瑟里](https://github.com/YiuRULE)) - -#### 改进 {#improvements} - -- 已添加 `max_parts_in_total` 设置表的MergeTree家族(默认:100 000)防止分区键的不安全规范\#5166. [\#5171](https://github.com/ClickHouse/ClickHouse/pull/5171) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `clickhouse-obfuscator`:通过将初始种子与列名(而不是列位置)组合来派生单个列的种子。 这用于转换具有多个相关表的数据集,以便在转换后表将保持可联接。 [\#5178](https://github.com/ClickHouse/ClickHouse/pull/5178) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 新增功能 `JSONExtractRaw`, `JSONExtractKeyAndValues`. 重命名函数 `jsonExtract` 到 `JSONExtract`. 当出现问题时,这些函数返回对应的值,而不是 `NULL`. 修改功能 `JSONExtract`,现在它从最后一个参数中获取返回类型,并且不会注入nullables。 在AVX2指令不可用的情况下实现了回退到RapidJSON。 Simdjson库更新到新版本。 [\#5235](https://github.com/ClickHouse/ClickHouse/pull/5235) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 现在 `if` 和 `multiIf` 功能不依赖于条件的 `Nullable`,但依靠分支来实现sql兼容性。 [\#5238](https://github.com/ClickHouse/ClickHouse/pull/5238) ([吴健](https://github.com/janplus)) -- `In` 谓词现在生成 `Null` 结果来自 `Null` 输入像 `Equal` 功能。 [\#5152](https://github.com/ClickHouse/ClickHouse/pull/5152) ([吴健](https://github.com/janplus)) -- 检查来自Kafka的每个(flush\_interval/poll\_timeout)行数的时间限制。 这允许更频繁地中断Kafka consumer的读取,并检查顶级流的时间限制 [\#5249](https://github.com/ClickHouse/ClickHouse/pull/5249) ([伊万](https://github.com/abyss7)) -- 链接rdkafka捆绑的SASL。 它应该允许使用SASL SCRAM身份验证 [\#5253](https://github.com/ClickHouse/ClickHouse/pull/5253) ([伊万](https://github.com/abyss7)) -- 所有联接的RowRefList的批处理版本。 [\#5267](https://github.com/ClickHouse/ClickHouse/pull/5267) ([Artem Zuikov](https://github.com/4ertus2)) -- clickhouse服务器:更多信息侦听错误消息。 [\#5268](https://github.com/ClickHouse/ClickHouse/pull/5268) ([proller](https://github.com/proller)) -- 在clickhouse-复印机的功能支持字典 `` [\#5270](https://github.com/ClickHouse/ClickHouse/pull/5270) ([proller](https://github.com/proller)) -- 添加新设置 `kafka_commit_every_batch` 来规范卡夫卡的承诺政策。 - 它允许设置提交模式:在处理每批消息之后,或者在整个块写入存储之后。 这是在某些极端情况下丢失一些消息或阅读两次之间的权衡。 [\#5308](https://github.com/ClickHouse/ClickHouse/pull/5308) ([伊万](https://github.com/abyss7)) -- 赂眉露\>\> `windowFunnel` 支持其他无符号整数类型。 [\#5320](https://github.com/ClickHouse/ClickHouse/pull/5320) ([sundyli](https://github.com/sundy-li)) -- 允许对虚拟列进行阴影 `_table` 在合并引擎。 [\#5325](https://github.com/ClickHouse/ClickHouse/pull/5325) ([伊万](https://github.com/abyss7)) -- 赂眉露\>\> `sequenceMatch` 聚合函数支持其他无符号整数类型 [\#5339](https://github.com/ClickHouse/ClickHouse/pull/5339) ([sundyli](https://github.com/sundy-li)) -- 如果校验和不匹配很可能是由硬件故障引起的,则更好的错误消息。 [\#5355](https://github.com/ClickHouse/ClickHouse/pull/5355) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 检查基础表是否支持以下内容的采样 `StorageMerge` [\#5366](https://github.com/ClickHouse/ClickHouse/pull/5366) ([伊万](https://github.com/abyss7)) -- Сlose MySQL connections after their usage in external dictionaries. It is related to issue \#893. [\#5395](https://github.com/ClickHouse/ClickHouse/pull/5395) ([Clément Rodriguez](https://github.com/clemrodriguez)) -- MySQL线协议的改进。 将格式名称更改为MySQLWire。 使用RAII调用RSA\_free。 如果无法创建上下文,则禁用SSL。 [\#5419](https://github.com/ClickHouse/ClickHouse/pull/5419) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- clickhouse-client: allow to run with unaccessable history file (read-only, no disk space, file is directory, …). [\#5431](https://github.com/ClickHouse/ClickHouse/pull/5431) ([proller](https://github.com/proller)) -- 尊重异步插入到分布式表中的查询设置。 [\#4936](https://github.com/ClickHouse/ClickHouse/pull/4936) ([TCeason](https://github.com/TCeason)) -- 重命名函数 `leastSqr` 到 `simpleLinearRegression`, `LinearRegression` 到 `linearRegression`, `LogisticRegression` 到 `logisticRegression`. [\#5391](https://github.com/ClickHouse/ClickHouse/pull/5391) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) - -#### 性能改进 {#performance-improvements} - -- 在ALTER MODIFY查询中并行处理非复制MergeTree表的部分。 [\#4639](https://github.com/ClickHouse/ClickHouse/pull/4639) ([伊万库什](https://github.com/IvanKush)) -- Regular达式提取中的优化。 [\#5193](https://github.com/ClickHouse/ClickHouse/pull/5193) [\#5191](https://github.com/ClickHouse/ClickHouse/pull/5191) ([Danila Kutenin](https://github.com/danlark1)) -- 如果仅在join on部分中使用,则不要将右连接键列添加到join result。 [\#5260](https://github.com/ClickHouse/ClickHouse/pull/5260) ([Artem Zuikov](https://github.com/4ertus2)) -- 在第一个空响应之后冻结Kafka缓冲区。 它避免了多次调用 `ReadBuffer::next()` 对于一些行解析流的空结果。 [\#5283](https://github.com/ClickHouse/ClickHouse/pull/5283) ([伊万](https://github.com/abyss7)) -- `concat` 多个参数的函数优化。 [\#5357](https://github.com/ClickHouse/ClickHouse/pull/5357) ([Danila Kutenin](https://github.com/danlark1)) -- Query optimisation. Allow push down IN statement while rewriting commа/cross join into inner one. [\#5396](https://github.com/ClickHouse/ClickHouse/pull/5396) ([Artem Zuikov](https://github.com/4ertus2)) -- 使用reference one升级我们的LZ4实现以获得更快的解压缩。 [\#5070](https://github.com/ClickHouse/ClickHouse/pull/5070) ([Danila Kutenin](https://github.com/danlark1)) -- 实现了MSD基数排序(基于kxsort)和部分排序。 [\#5129](https://github.com/ClickHouse/ClickHouse/pull/5129) ([Evgenii Pravda](https://github.com/kvinty)) - -#### 错误修复 {#bug-fixes} - -- 修复推送需要列与联接 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([张冬](https://github.com/zhang2014)) -- 修正了当ClickHouse由systemd运行时,命令 `sudo service clickhouse-server forcerestart` 没有按预期工作。 [\#5204](https://github.com/ClickHouse/ClickHouse/pull/5204) ([proller](https://github.com/proller)) -- 修复DataPartsExchange中的http错误代码(9009端口上的服务器间http服务器始终返回代码200,即使是错误)。 [\#5216](https://github.com/ClickHouse/ClickHouse/pull/5216) ([proller](https://github.com/proller)) -- 修复SimpleAggregateFunction字符串长于MAX\_SMALL\_STRING\_SIZE [\#5311](https://github.com/ClickHouse/ClickHouse/pull/5311) ([Azat Khuzhin](https://github.com/azat)) -- 修复错误 `Decimal` 到 `Nullable(Decimal)` 转换中。 支持其他十进制到十进制转换(包括不同的比例)。 [\#5350](https://github.com/ClickHouse/ClickHouse/pull/5350) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正了simdjson库中导致错误计算的FPU clobbering `uniqHLL` 和 `uniqCombined` 聚合函数和数学函数,如 `log`. [\#5354](https://github.com/ClickHouse/ClickHouse/pull/5354) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定处理JSON函数中的混合常量/非常量情况。 [\#5435](https://github.com/ClickHouse/ClickHouse/pull/5435) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复 `retention` 功能。 现在所有满足一行数据的条件都被添加到数据状态。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) -- 修复结果类型 `quantileExact` 用小数。 [\#5304](https://github.com/ClickHouse/ClickHouse/pull/5304) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 文件 {#documentation} - -- 翻译文档 `CollapsingMergeTree` 到中国。 [\#5168](https://github.com/ClickHouse/ClickHouse/pull/5168) ([张风啸](https://github.com/AlexZFX)) -- 将一些关于表格引擎的文档翻译成中文。 - [\#5134](https://github.com/ClickHouse/ClickHouse/pull/5134) - [\#5328](https://github.com/ClickHouse/ClickHouse/pull/5328) - ([永远不会李](https://github.com/neverlee)) - -#### 构建/测试/打包改进 {#buildtestingpackaging-improvements} - -- 修复一些显示可能使用后免费的消毒剂报告。[\#5139](https://github.com/ClickHouse/ClickHouse/pull/5139) [\#5143](https://github.com/ClickHouse/ClickHouse/pull/5143) [\#5393](https://github.com/ClickHouse/ClickHouse/pull/5393) ([伊万](https://github.com/abyss7)) -- 为了方便起见,将性能测试从单独的目录中移出。 [\#5158](https://github.com/ClickHouse/ClickHouse/pull/5158) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复不正确的性能测试。 [\#5255](https://github.com/ClickHouse/ClickHouse/pull/5255) ([阿利沙平](https://github.com/alesapin)) -- 增加了一个工具来计算由位翻转引起的校验和,以调试硬件问题。 [\#5334](https://github.com/ClickHouse/ClickHouse/pull/5334) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 使亚军脚本更有用。 [\#5340](https://github.com/ClickHouse/ClickHouse/pull/5340)[\#5360](https://github.com/ClickHouse/ClickHouse/pull/5360) ([filimonov](https://github.com/filimonov)) -- 添加如何编写性能测试的小指令。 [\#5408](https://github.com/ClickHouse/ClickHouse/pull/5408) ([阿利沙平](https://github.com/alesapin)) -- 添加在性能测试中创建,填写和删除查询中进行替换的功能 [\#5367](https://github.com/ClickHouse/ClickHouse/pull/5367) ([Olga Khvostikova](https://github.com/stavrolia)) - -## ClickHouse释放19.7 {#clickhouse-release-19-7} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-7-5-29-2019-07-05} - -#### 错误修复 {#bug-fix-25} - -- 使用JOIN修复某些查询中的性能回归。 [\#5192](https://github.com/ClickHouse/ClickHouse/pull/5192) ([张冬](https://github.com/zhang2014)) - -### 碌莽禄,拢,010-68520682\戮漏鹿芦,酶,虏卤赂拢,110102003042 {#clickhouse-release-19-7-5-27-2019-06-09} - -#### 新功能 {#new-features-1} - -- 添加位图相关功能 `bitmapHasAny` 和 `bitmapHasAll` 类似于 `hasAny` 和 `hasAll` 数组的函数。 [\#5279](https://github.com/ClickHouse/ClickHouse/pull/5279) ([塞尔吉\*弗拉季金](https://github.com/svladykin)) - -#### 错误修复 {#bug-fixes-1} - -- 修复段错误 `minmax` 具有空值的索引。 [\#5246](https://github.com/ClickHouse/ClickHouse/pull/5246) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 根据需要输出标记"LIMIT BY"中的所有输入列。 它修复 ‘Not found column’ 某些分布式查询中出错。 [\#5407](https://github.com/ClickHouse/ClickHouse/pull/5407) ([康斯坦丁\*潘](https://github.com/kvap)) -- 修复 “Column ‘0’ already exists” 错误 `SELECT .. PREWHERE` 在具有默认值的列上 [\#5397](https://github.com/ClickHouse/ClickHouse/pull/5397) ([proller](https://github.com/proller)) -- 修复 `ALTER MODIFY TTL` 查询开 `ReplicatedMergeTree`. [\#5539](https://github.com/ClickHouse/ClickHouse/pull/5539/commits) ([安东\*波波夫](https://github.com/CurtizJ)) -- 当Kafka消费者无法启动时,不要使服务器崩溃。 [\#5285](https://github.com/ClickHouse/ClickHouse/pull/5285) ([伊万](https://github.com/abyss7)) -- 固定位图函数产生错误的结果。 [\#5359](https://github.com/ClickHouse/ClickHouse/pull/5359) ([杨小姐](https://github.com/andyyzh)) -- 修复散列字典的element\_count(不包括重复项) [\#5440](https://github.com/ClickHouse/ClickHouse/pull/5440) ([Azat Khuzhin](https://github.com/azat)) -- 使用环境变量TZ的内容作为时区的名称。 在某些情况下,它有助于正确检测默认时区。[\#5443](https://github.com/ClickHouse/ClickHouse/pull/5443) ([伊万](https://github.com/abyss7)) -- 不要试图将整数转换为 `dictGetT` 功能,因为它不能正常工作。 而是抛出一个异常。 [\#5446](https://github.com/ClickHouse/ClickHouse/pull/5446) ([Artem Zuikov](https://github.com/4ertus2)) -- 在ExternalData HTTP请求修复设置。 [\#5455](https://github.com/ClickHouse/ClickHouse/pull/5455) ([Danila - 库特宁](https://github.com/danlark1)) -- 修复只从FS中删除部件而不从Zookeeper中删除部件时的错误。 [\#5520](https://github.com/ClickHouse/ClickHouse/pull/5520) ([阿利沙平](https://github.com/alesapin)) -- 修复分段故障 `bitmapHasAny` 功能。 [\#5528](https://github.com/ClickHouse/ClickHouse/pull/5528) ([余志昌](https://github.com/yuzhichang)) -- 修复了复制连接池不重试解析主机时的错误,即使删除了DNS缓存。 [\#5534](https://github.com/ClickHouse/ClickHouse/pull/5534) ([阿利沙平](https://github.com/alesapin)) -- 固定 `DROP INDEX IF EXISTS` 查询。 现在 `ALTER TABLE ... DROP INDEX IF EXISTS ...` 如果提供的索引不存在,查询不会引发异常。 [\#5524](https://github.com/ClickHouse/ClickHouse/pull/5524) ([格列布\*诺维科夫](https://github.com/NanoBjorn)) -- 修复联合所有超类型列。 有些情况下,结果列的数据和列类型不一致。 [\#5503](https://github.com/ClickHouse/ClickHouse/pull/5503) ([Artem Zuikov](https://github.com/4ertus2)) -- 在DDL查询处理过程中跳过ZNONODE。 之前,如果另一个节点删除znode在任务队列中,那一个 - 没有处理它,但已经得到子列表,将终止DDLWorker线程。 [\#5489](https://github.com/ClickHouse/ClickHouse/pull/5489) ([Azat Khuzhin](https://github.com/azat)) -- 修复插入到具体化列的分布式()表中。 [\#5429](https://github.com/ClickHouse/ClickHouse/pull/5429) ([Azat Khuzhin](https://github.com/azat)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-7-3-9-2019-05-30} - -#### 新功能 {#new-features-2} - -- 允许限制用户可以指定的设置的范围。 - 这些约束可以在用户设置配置文件中设置。 - [\#4931](https://github.com/ClickHouse/ClickHouse/pull/4931) ([维塔利 - 巴拉诺夫](https://github.com/vitlibar)) -- 添加该函数的第二个版本 `groupUniqArray` 用一个可选的 - `max_size` 限制结果数组大小的参数。 这 - 行为类似于 `groupArray(max_size)(x)` 功能。 - [\#5026](https://github.com/ClickHouse/ClickHouse/pull/5026) ([纪尧姆 - Tassery](https://github.com/YiuRULE)) -- 对于TSVWithNames/CSVWithNames输入文件格式,列顺序现在可以是 - 从文件头确定。 这是由控制 - `input_format_with_names_use_header` 参数。 - [\#5081](https://github.com/ClickHouse/ClickHouse/pull/5081) - ([亚历山大](https://github.com/Akazz)) - -#### 错误修复 {#bug-fixes-2} - -- 在合并过程中uncompressed\_cache+JOIN崩溃(#5197) - [\#5133](https://github.com/ClickHouse/ClickHouse/pull/5133) ([Danila - 库特宁](https://github.com/danlark1)) -- Clickhouse客户端查询到系统表上的分段错误。 \#5066 - [\#5127](https://github.com/ClickHouse/ClickHouse/pull/5127) - ([伊万](https://github.com/abyss7)) -- 通过KafkaEngine重负载数据丢失(#4736) - [\#5080](https://github.com/ClickHouse/ClickHouse/pull/5080) - ([伊万](https://github.com/abyss7)) -- 修复了在执行UNION查询时可能发生的非常罕见的数据争用条件,所有查询都涉及至少两个来自系统的选择。列,系统。表,系统。部件,系统。parts\_tables或Merge系列的表,并同时执行相关表的列的更改。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 性能改进 {#performance-improvements-1} - -- 使用基数排序按单个数字列进行排序 `ORDER BY` 没有 - `LIMIT`. [\#5106](https://github.com/ClickHouse/ClickHouse/pull/5106), - [\#4439](https://github.com/ClickHouse/ClickHouse/pull/4439) - ([Evgenii Pravda](https://github.com/kvinty), - [阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 文件 {#documentation-1} - -- 将某些表格引擎的文档翻译为中文。 - [\#5107](https://github.com/ClickHouse/ClickHouse/pull/5107), - [\#5094](https://github.com/ClickHouse/ClickHouse/pull/5094), - [\#5087](https://github.com/ClickHouse/ClickHouse/pull/5087) - ([张风啸](https://github.com/AlexZFX)), - [\#5068](https://github.com/ClickHouse/ClickHouse/pull/5068) ([从来没有 - 李](https://github.com/neverlee)) - -#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-1} - -- 正确打印UTF-8字符 `clickhouse-test`. - [\#5084](https://github.com/ClickHouse/ClickHouse/pull/5084) - ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 为clickhouse-client添加命令行参数以始终加载建议 - 戴达 [\#5102](https://github.com/ClickHouse/ClickHouse/pull/5102) - ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 解决一些PVS-Studio警告。 - [\#5082](https://github.com/ClickHouse/ClickHouse/pull/5082) - ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 更新LZ4 [\#5040](https://github.com/ClickHouse/ClickHouse/pull/5040) ([Danila - 库特宁](https://github.com/danlark1)) -- 添加gperf以构建即将到来的拉取请求#5030的requirements。 - [\#5110](https://github.com/ClickHouse/ClickHouse/pull/5110) - ([proller](https://github.com/proller)) - -## ClickHouse释放19.6 {#clickhouse-release-19-6} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-6-3-18-2019-06-13} - -#### 错误修复 {#bug-fixes-3} - -- 修复了来自表函数的查询的条件下推 `mysql` 和 `odbc` 和相应的表引擎。 这修复了#3540和#2384。 [\#5313](https://github.com/ClickHouse/ClickHouse/pull/5313) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复动物园管理员的死锁。 [\#5297](https://github.com/ClickHouse/ClickHouse/pull/5297) ([github1youlc](https://github.com/github1youlc)) -- 允许在CSV中引用小数。 [\#5284](https://github.com/ClickHouse/ClickHouse/pull/5284) ([Artem Zuikov](https://github.com/4ertus2) -- 禁止从float Inf/NaN转换为小数(抛出异常)。 [\#5282](https://github.com/ClickHouse/ClickHouse/pull/5282) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复重命名查询中的数据竞赛。 [\#5247](https://github.com/ClickHouse/ClickHouse/pull/5247) ([张冬](https://github.com/zhang2014)) -- 暂时禁用LFAlloc。 使用LFAlloc可能会导致大量MAP\_FAILED在分配UncompressedCache时,并导致高负载服务器上的查询崩溃。 [cfdba93](https://github.com/ClickHouse/ClickHouse/commit/cfdba938ce22f16efeec504f7f90206a515b1280)([Danila Kutenin](https://github.com/danlark1)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-6-2-11-2019-05-13} - -#### 新功能 {#new-features-3} - -- 列和表的TTL表达式。 [\#4212](https://github.com/ClickHouse/ClickHouse/pull/4212) ([安东\*波波夫](https://github.com/CurtizJ)) -- 增加了对 `brotli` http响应的压缩(接受编码:br) [\#4388](https://github.com/ClickHouse/ClickHouse/pull/4388) ([米哈伊尔](https://github.com/fandyushin)) -- 增加了新功能 `isValidUTF8` 用于检查一组字节是否被正确地utf-8编码。 [\#4934](https://github.com/ClickHouse/ClickHouse/pull/4934) ([Danila Kutenin](https://github.com/danlark1)) -- 添加新的负载平衡策略 `first_or_random` 它将查询发送到第一个指定的主机,如果无法访问,则向分片的随机主机发送查询。 对于跨复制拓扑设置非常有用。 [\#5012](https://github.com/ClickHouse/ClickHouse/pull/5012) ([纳瓦托洛梅](https://github.com/nvartolomei)) - -#### 实验特点 {#experimental-features-1} - -- 添加设置 `index_granularity_bytes` (自适应索引粒度)对于MergeTree\*表族. [\#4826](https://github.com/ClickHouse/ClickHouse/pull/4826) ([阿利沙平](https://github.com/alesapin)) - -#### 改进 {#improvements-1} - -- 增加了对函数的非常量和负大小和长度参数的支持 `substringUTF8`. [\#4989](https://github.com/ClickHouse/ClickHouse/pull/4989) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在左联接中禁用向下推到右表,在右联接中禁用左表,并在完全联接中禁用两个表。 在某些情况下,这可以修复错误的连接结果。 [\#4846](https://github.com/ClickHouse/ClickHouse/pull/4846) ([伊万](https://github.com/abyss7)) -- `clickhouse-copier`:从自动上传任务配置 `--task-file` 备选案文 [\#4876](https://github.com/ClickHouse/ClickHouse/pull/4876) ([proller](https://github.com/proller)) -- 为存储工厂和表函数工厂添加了错别字处理程序。 [\#4891](https://github.com/ClickHouse/ClickHouse/pull/4891) ([Danila Kutenin](https://github.com/danlark1)) -- 支持不带子查询的多个联接的星号和限定星号 [\#4898](https://github.com/ClickHouse/ClickHouse/pull/4898) ([Artem Zuikov](https://github.com/4ertus2)) -- 使缺少列错误消息更加用户友好。 [\#4915](https://github.com/ClickHouse/ClickHouse/pull/4915) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 性能改进 {#performance-improvements-2} - -- ASOF加速显着 [\#4924](https://github.com/ClickHouse/ClickHouse/pull/4924) ([Martijn Bakker](https://github.com/Gladdy)) - -#### 向后不兼容的更改 {#backward-incompatible-changes} - -- HTTP头 `Query-Id` 改名为 `X-ClickHouse-Query-Id` 为了一致性。 [\#4972](https://github.com/ClickHouse/ClickHouse/pull/4972) ([米哈伊尔](https://github.com/fandyushin)) - -#### 错误修复 {#bug-fixes-4} - -- 修正了潜在的空指针取消引用 `clickhouse-copier`. [\#4900](https://github.com/ClickHouse/ClickHouse/pull/4900) ([proller](https://github.com/proller)) -- 修复了使用JOIN+ARRAY JOIN查询的错误 [\#4938](https://github.com/ClickHouse/ClickHouse/pull/4938) ([Artem Zuikov](https://github.com/4ertus2)) -- 固定挂在服务器的启动时,字典依赖于另一个字典通过引擎数据库=字典。 [\#4962](https://github.com/ClickHouse/ClickHouse/pull/4962) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- Partially fix distributed\_product\_mode = local. It's possible to allow columns of local tables in where/having/order by/… via table aliases. Throw exception if table does not have alias. There's not possible to access to the columns without table aliases yet. [\#4986](https://github.com/ClickHouse/ClickHouse/pull/4986) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复潜在的错误结果 `SELECT DISTINCT` 与 `JOIN` [\#5001](https://github.com/ClickHouse/ClickHouse/pull/5001) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复了在执行UNION查询时可能发生的非常罕见的数据争用条件,所有查询都涉及至少两个来自系统的选择。列,系统。表,系统。部件,系统。parts\_tables或Merge系列的表,并同时执行相关表的列的更改。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-2} - -- 在不同的主机上运行clickhouse服务器时修复测试失败 [\#4713](https://github.com/ClickHouse/ClickHouse/pull/4713) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- clickhouse-test:在非tty环境中禁用颜色控制序列。 [\#4937](https://github.com/ClickHouse/ClickHouse/pull/4937) ([阿利沙平](https://github.com/alesapin)) -- clickhouse-test:允许使用任何测试数据库(删除 `test.` 在可能的情况下获得资格) [\#5008](https://github.com/ClickHouse/ClickHouse/pull/5008) ([proller](https://github.com/proller)) -- 修复ubsan错误 [\#5037](https://github.com/ClickHouse/ClickHouse/pull/5037) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- Yandex LFAlloc被添加到ClickHouse中,以不同的方式分配MarkCache和UncompressedCache数据,以更可靠地捕获段错误 [\#4995](https://github.com/ClickHouse/ClickHouse/pull/4995) ([Danila Kutenin](https://github.com/danlark1)) -- Python util帮助反向移植和更改日志。 [\#4949](https://github.com/ClickHouse/ClickHouse/pull/4949) ([伊万](https://github.com/abyss7)) - -## ClickHouse释放19.5 {#clickhouse-release-19-5} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-5-4-22-2019-05-13} - -#### 错误修复 {#bug-fixes-5} - -- 修正了位图\*功能中可能出现的崩溃 [\#5220](https://github.com/ClickHouse/ClickHouse/pull/5220) [\#5228](https://github.com/ClickHouse/ClickHouse/pull/5228) ([杨小姐](https://github.com/andyyzh)) -- 修复了在执行UNION查询时可能发生的非常罕见的数据争用条件,所有查询都涉及至少两个来自系统的选择。列,系统。表,系统。部件,系统。parts\_tables或Merge系列的表,并同时执行相关表的列的更改。 [\#5189](https://github.com/ClickHouse/ClickHouse/pull/5189) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正错误 `Set for IN is not created yet in case of using single LowCardinality column in the left part of IN`. 如果lowcardinality列是主键的一部分,则会发生此错误。 \#5031 [\#5154](https://github.com/ClickHouse/ClickHouse/pull/5154) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修改保留函数:如果一行同时满足第一个和第N个条件,则只有第一个满足的条件被添加到数据状态。 现在所有满足一行数据的条件都被添加到数据状态。 [\#5119](https://github.com/ClickHouse/ClickHouse/pull/5119) ([小路](https://github.com/nicelulu)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-5-3-8-2019-04-18} - -#### 错误修复 {#bug-fixes-6} - -- 固定设置类型 `max_partitions_per_insert_block` 从布尔到UInt64。 [\#5028](https://github.com/ClickHouse/ClickHouse/pull/5028) ([2.Mohammad Hossein Sekhavat](https://github.com/mhsekhavat)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-5-2-6-2019-04-15} - -#### 新功能 {#new-features-4} - -- [超扫描](https://github.com/intel/hyperscan) 添加了多个正则表达式匹配(函数 `multiMatchAny`, `multiMatchAnyIndex`, `multiFuzzyMatchAny`, `multiFuzzyMatchAnyIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780), [\#4841](https://github.com/ClickHouse/ClickHouse/pull/4841) ([Danila Kutenin](https://github.com/danlark1)) -- `multiSearchFirstPosition` 添加了功能。 [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) -- 为表实现每行的预定义表达式筛选器。 [\#4792](https://github.com/ClickHouse/ClickHouse/pull/4792) ([伊万](https://github.com/abyss7)) -- 一种基于bloom过滤器的新型数据跳过索引(可用于 `equal`, `in` 和 `like` 功能)。 [\#4499](https://github.com/ClickHouse/ClickHouse/pull/4499) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 已添加 `ASOF JOIN` 它允许运行连接到最新已知值的查询。 [\#4774](https://github.com/ClickHouse/ClickHouse/pull/4774) [\#4867](https://github.com/ClickHouse/ClickHouse/pull/4867) [\#4863](https://github.com/ClickHouse/ClickHouse/pull/4863) [\#4875](https://github.com/ClickHouse/ClickHouse/pull/4875) ([Martijn Bakker](https://github.com/Gladdy), [Artem Zuikov](https://github.com/4ertus2)) -- 重写多个 `COMMA JOIN` 到 `CROSS JOIN`. 然后将它们重写为 `INNER JOIN` 如果可能的话 [\#4661](https://github.com/ClickHouse/ClickHouse/pull/4661) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 改进 {#improvement-9} - -- `topK` 和 `topKWeighted` 现在支持自定义 `loadFactor` (修复问题 [\#4252](https://github.com/ClickHouse/ClickHouse/issues/4252)). [\#4634](https://github.com/ClickHouse/ClickHouse/pull/4634) ([基里尔丹信](https://github.com/kirillDanshin)) -- 允许使用 `parallel_replicas_count > 1` 即使对于没有采样的表(设置简单地忽略它们)。 在以前的版本中,它导致异常。 [\#4637](https://github.com/ClickHouse/ClickHouse/pull/4637) ([Alexey Elymanov](https://github.com/digitalist)) -- 支持 `CREATE OR REPLACE VIEW`. 允许在单个语句中创建视图或设置新定义。 [\#4654](https://github.com/ClickHouse/ClickHouse/pull/4654) ([Boris Granveaud](https://github.com/bgranvea)) -- `Buffer` 表引擎现在支持 `PREWHERE`. [\#4671](https://github.com/ClickHouse/ClickHouse/pull/4671) ([刘杨宽](https://github.com/LiuYangkuan)) -- 添加在zookeeper中启动没有元数据的复制表的能力 `readonly` 模式 [\#4691](https://github.com/ClickHouse/ClickHouse/pull/4691) ([阿利沙平](https://github.com/alesapin)) -- 在clickhouse客户端固定进度条闪烁。 使用时,这个问题最明显 `FORMAT Null` 随着流查询。 [\#4811](https://github.com/ClickHouse/ClickHouse/pull/4811) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 允许禁用功能 `hyperscan` 基于每个用户的库,以限制潜在的过度和不受控制的资源使用。 [\#4816](https://github.com/ClickHouse/ClickHouse/pull/4816) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加版本号记录所有错误。 [\#4824](https://github.com/ClickHouse/ClickHouse/pull/4824) ([proller](https://github.com/proller)) -- 增加了限制 `multiMatch` 需要字符串大小以适应的函数 `unsigned int`. 还增加了参数的数量限制 `multiSearch` 功能。 [\#4834](https://github.com/ClickHouse/ClickHouse/pull/4834) ([Danila Kutenin](https://github.com/danlark1)) -- 改进了超扫描暂存空间的使用和错误处理。 [\#4866](https://github.com/ClickHouse/ClickHouse/pull/4866) ([Danila Kutenin](https://github.com/danlark1)) -- 填充 `system.graphite_detentions` 从表配置 `*GraphiteMergeTree` 发动机表. [\#4584](https://github.com/ClickHouse/ClickHouse/pull/4584) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- 重命名 `trigramDistance` 功能 `ngramDistance` 并添加更多的功能 `CaseInsensitive` 和 `UTF`. [\#4602](https://github.com/ClickHouse/ClickHouse/pull/4602) ([Danila Kutenin](https://github.com/danlark1)) -- 改进的数据跳过指数计算。 [\#4640](https://github.com/ClickHouse/ClickHouse/pull/4640) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 保持平凡, `DEFAULT`, `MATERIALIZED` 和 `ALIAS` 在一个列表中的列(修复问题 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -#### 错误修复 {#bug-fix-26} - -- 避免 `std::terminate` 在内存分配失败的情况下。 现在 `std::bad_alloc` 按预期引发异常。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复capnproto从缓冲区读取。 有时文件没有通过HTTP成功加载。 [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([弗拉季斯拉夫](https://github.com/smirnov-vs)) -- 修复错误 `Unknown log entry type: 0` 后 `OPTIMIZE TABLE FINAL` 查询。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([阿莫斯鸟](https://github.com/amosbird)) -- 错误的参数 `hasAny` 或 `hasAll` 函数可能会导致段错误。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 执行时可能会发生死锁 `DROP DATABASE dictionary` 查询。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复未定义的行为 `median` 和 `quantile` 功能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- 修复压缩级别检测时 `network_compression_method` 小写。 在19.1节中被打破。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- 固定的无知 `UTC` 设置(修复问题 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- 修复 `histogram` 函数行为 `Distributed` 桌子 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- 固定tsan报告 `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了由于系统日志使用中的争用条件而关闭的TSan报告。 修复了当part\_log启用时关机后的潜在使用。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复重新检查零件 `ReplicatedMergeTreeAlterThread` 在错误的情况下。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 对中间聚合函数状态的算术运算不适用于常量参数(如子查询结果)。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 始终在元数据中反引用列名。 否则,不可能创建一个名为列的表 `index` (由于格式错误,服务器无法重新启动 `ATTACH` 元数据中的查询)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复崩溃 `ALTER ... MODIFY ORDER BY` 上 `Distributed` 桌子 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- 修复段错误 `JOIN ON` 已启用 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([张冬](https://github.com/zhang2014)) -- 修复kafka使用protobuf消息后添加无关行的错误。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复崩溃 `JOIN` 在不可为空的vs可为空的列上。 修复 `NULLs` 在右键 `ANY JOIN` + `join_use_nulls`. [\#4815](https://github.com/ClickHouse/ClickHouse/pull/4815) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- 在固定的竞争条件 `SELECT` 从 `system.tables` 如果同时重命名或更改表。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 获取已经过时的数据部分时修复了数据竞赛。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定罕见的数据竞赛,可以在发生 `RENAME` MergeTree家族的表. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正功能中的分段故障 `arrayIntersect`. 如果函数使用常量和普通参数混合调用,则可能会发生分段错误。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([钱丽祥](https://github.com/fancyqlx)) -- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复崩溃 `FULL/RIGHT JOIN` 当我们加入可为空vs不可为空时。 [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复 `No message received` 在副本之间获取部件时出现异常。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([阿利沙平](https://github.com/alesapin)) -- 固定 `arrayIntersect` 函数错误导致在单个数组中的几个重复值的情况下。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 在并发期间修复争用条件 `ALTER COLUMN` 可能导致服务器崩溃的查询(修复问题 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修复不正确的结果 `FULL/RIGHT JOIN` 与常量列。 [\#4723](https://github.com/ClickHouse/ClickHouse/pull/4723) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复重复 `GLOBAL JOIN` 用星号。 [\#4705](https://github.com/ClickHouse/ClickHouse/pull/4705) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复参数扣除 `ALTER MODIFY` 列 `CODEC` 未指定列类型时。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([阿利沙平](https://github.com/alesapin)) -- 功能 `cutQueryStringAndFragment()` 和 `queryStringAndFragment()` 现在正常工作时 `URL` 包含一个片段,没有查询。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复设置时罕见的错误 `min_bytes_to_use_direct_io` 大于零,这发生在线程必须在列文件中向后寻找时。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([阿利沙平](https://github.com/alesapin)) -- 修复聚合函数的错误参数类型 `LowCardinality` 参数(修复问题 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复错误的名称资格 `GLOBAL JOIN`. [\#4969](https://github.com/ClickHouse/ClickHouse/pull/4969) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复功能 `toISOWeek` 1970年的结果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复 `DROP`, `TRUNCATE` 和 `OPTIMIZE` 查询重复,在执行时 `ON CLUSTER` 为 `ReplicatedMergeTree*` 表家庭. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([阿利沙平](https://github.com/alesapin)) - -#### 向后不兼容的更改 {#backward-incompatible-change-8} - -- 重命名设置 `insert_sample_with_metadata` 到设置 `input_format_defaults_for_omitted_fields`. [\#4771](https://github.com/ClickHouse/ClickHouse/pull/4771) ([Artem Zuikov](https://github.com/4ertus2)) -- 添加设置 `max_partitions_per_insert_block` (默认值为100)。 如果插入的块包含较大数量的分区,则会引发异常。 如果要删除限制(不推荐),请将其设置为0。 [\#4845](https://github.com/ClickHouse/ClickHouse/pull/4845) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 多搜索功能被重命名 (`multiPosition` 到 `multiSearchAllPositions`, `multiSearch` 到 `multiSearchAny`, `firstMatch` 到 `multiSearchFirstIndex`). [\#4780](https://github.com/ClickHouse/ClickHouse/pull/4780) ([Danila Kutenin](https://github.com/danlark1)) - -#### 性能改进 {#performance-improvement-6} - -- 通过内联优化Volnitsky搜索器,为许多针或许多类似bigrams的查询提供约5-10%的搜索改进。 [\#4862](https://github.com/ClickHouse/ClickHouse/pull/4862) ([Danila Kutenin](https://github.com/danlark1)) -- 修复设置时的性能问题 `use_uncompressed_cache` 大于零时,即出现在所有读取缓存中包含的数据时。 [\#4913](https://github.com/ClickHouse/ClickHouse/pull/4913) ([阿利沙平](https://github.com/alesapin)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-10} - -- 强化调试构建:更精细的内存映射和ASLR;为标记缓存和索引添加内存保护。 这允许在ASan和MSan无法做到这一点的情况下找到更多的内存st脚错误。 [\#4632](https://github.com/ClickHouse/ClickHouse/pull/4632) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加对cmake变量的支持 `ENABLE_PROTOBUF`, `ENABLE_PARQUET` 和 `ENABLE_BROTLI` 它允许启用/禁用上述功能(与我们对librdkafka,mysql等所做的相同)。 [\#4669](https://github.com/ClickHouse/ClickHouse/pull/4669) ([Silviu Caragea](https://github.com/silviucpp)) -- 添加打印进程列表和堆栈跟踪的所有线程的能力,如果一些查询测试运行后挂起。 [\#4675](https://github.com/ClickHouse/ClickHouse/pull/4675) ([阿利沙平](https://github.com/alesapin)) -- 添加重试 `Connection loss` 错误 `clickhouse-test`. [\#4682](https://github.com/ClickHouse/ClickHouse/pull/4682) ([阿利沙平](https://github.com/alesapin)) -- 在打包程序脚本中添加使用vagrant的freebsd build和使用thread sanitizer的build。 [\#4712](https://github.com/ClickHouse/ClickHouse/pull/4712) [\#4748](https://github.com/ClickHouse/ClickHouse/pull/4748) ([阿利沙平](https://github.com/alesapin)) -- 现在用户要求用户密码 `'default'` 在安装过程中。 [\#4725](https://github.com/ClickHouse/ClickHouse/pull/4725) ([proller](https://github.com/proller)) -- 禁止在警告 `rdkafka` 图书馆. [\#4740](https://github.com/ClickHouse/ClickHouse/pull/4740) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 允许在没有ssl的情况下构建。 [\#4750](https://github.com/ClickHouse/ClickHouse/pull/4750) ([proller](https://github.com/proller)) -- 添加从自定义用户启动clickhouse服务器映像的方法。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- 升级contrib升压到1.69. [\#4793](https://github.com/ClickHouse/ClickHouse/pull/4793) ([proller](https://github.com/proller)) -- 禁用使用 `mremap` 使用线程消毒剂编译时。 令人惊讶的是,TSan并没有拦截 `mremap` (虽然它确实拦截 `mmap`, `munmap` 这会导致误报。 修复了有状态测试中的TSan报告。 [\#4859](https://github.com/ClickHouse/ClickHouse/pull/4859) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 通过HTTP接口使用格式模式添加测试检查。 [\#4864](https://github.com/ClickHouse/ClickHouse/pull/4864) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) - -## ClickHouse释放19.4 {#clickhouse-release-19-4} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-4-33-2019-04-17} - -#### 错误修复 {#bug-fixes-7} - -- 避免 `std::terminate` 在内存分配失败的情况下。 现在 `std::bad_alloc` 按预期引发异常。 [\#4665](https://github.com/ClickHouse/ClickHouse/pull/4665) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复capnproto从缓冲区读取。 有时文件没有通过HTTP成功加载。 [\#4674](https://github.com/ClickHouse/ClickHouse/pull/4674) ([弗拉季斯拉夫](https://github.com/smirnov-vs)) -- 修复错误 `Unknown log entry type: 0` 后 `OPTIMIZE TABLE FINAL` 查询。 [\#4683](https://github.com/ClickHouse/ClickHouse/pull/4683) ([阿莫斯鸟](https://github.com/amosbird)) -- 错误的参数 `hasAny` 或 `hasAll` 函数可能会导致段错误。 [\#4698](https://github.com/ClickHouse/ClickHouse/pull/4698) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 执行时可能会发生死锁 `DROP DATABASE dictionary` 查询。 [\#4701](https://github.com/ClickHouse/ClickHouse/pull/4701) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复未定义的行为 `median` 和 `quantile` 功能。 [\#4702](https://github.com/ClickHouse/ClickHouse/pull/4702) ([hcz](https://github.com/hczhcz)) -- 修复压缩级别检测时 `network_compression_method` 小写。 在19.1节中被打破。 [\#4706](https://github.com/ClickHouse/ClickHouse/pull/4706) ([proller](https://github.com/proller)) -- 固定的无知 `UTC` 设置(修复问题 [\#4658](https://github.com/ClickHouse/ClickHouse/issues/4658)). [\#4718](https://github.com/ClickHouse/ClickHouse/pull/4718) ([proller](https://github.com/proller)) -- 修复 `histogram` 函数行为 `Distributed` 桌子 [\#4741](https://github.com/ClickHouse/ClickHouse/pull/4741) ([olegkv](https://github.com/olegkv)) -- 固定tsan报告 `destroy of a locked mutex`. [\#4742](https://github.com/ClickHouse/ClickHouse/pull/4742) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了由于系统日志使用中的争用条件而关闭的TSan报告。 修复了当part\_log启用时关机后的潜在使用。 [\#4758](https://github.com/ClickHouse/ClickHouse/pull/4758) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复重新检查零件 `ReplicatedMergeTreeAlterThread` 在错误的情况下。 [\#4772](https://github.com/ClickHouse/ClickHouse/pull/4772) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 对中间聚合函数状态的算术运算不适用于常量参数(如子查询结果)。 [\#4776](https://github.com/ClickHouse/ClickHouse/pull/4776) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 始终在元数据中反引用列名。 否则,不可能创建一个名为列的表 `index` (由于格式错误,服务器无法重新启动 `ATTACH` 元数据中的查询)。 [\#4782](https://github.com/ClickHouse/ClickHouse/pull/4782) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复崩溃 `ALTER ... MODIFY ORDER BY` 上 `Distributed` 桌子 [\#4790](https://github.com/ClickHouse/ClickHouse/pull/4790) ([TCeason](https://github.com/TCeason)) -- 修复段错误 `JOIN ON` 已启用 `enable_optimize_predicate_expression`. [\#4794](https://github.com/ClickHouse/ClickHouse/pull/4794) ([张冬](https://github.com/zhang2014)) -- 修复kafka使用protobuf消息后添加无关行的错误。 [\#4808](https://github.com/ClickHouse/ClickHouse/pull/4808) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- 在固定的竞争条件 `SELECT` 从 `system.tables` 如果同时重命名或更改表。 [\#4836](https://github.com/ClickHouse/ClickHouse/pull/4836) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 获取已经过时的数据部分时修复了数据竞赛。 [\#4839](https://github.com/ClickHouse/ClickHouse/pull/4839) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定罕见的数据竞赛,可以在发生 `RENAME` MergeTree家族的表. [\#4844](https://github.com/ClickHouse/ClickHouse/pull/4844) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正功能中的分段故障 `arrayIntersect`. 如果函数使用常量和普通参数混合调用,则可能会发生分段错误。 [\#4847](https://github.com/ClickHouse/ClickHouse/pull/4847) ([钱丽祥](https://github.com/fancyqlx)) -- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复 `No message received` 在副本之间获取部件时出现异常。 [\#4856](https://github.com/ClickHouse/ClickHouse/pull/4856) ([阿利沙平](https://github.com/alesapin)) -- 固定 `arrayIntersect` 函数错误导致在单个数组中的几个重复值的情况下。 [\#4871](https://github.com/ClickHouse/ClickHouse/pull/4871) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 在并发期间修复争用条件 `ALTER COLUMN` 可能导致服务器崩溃的查询(修复问题 [\#3421](https://github.com/ClickHouse/ClickHouse/issues/3421)). [\#4592](https://github.com/ClickHouse/ClickHouse/pull/4592) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修复参数扣除 `ALTER MODIFY` 列 `CODEC` 未指定列类型时。 [\#4883](https://github.com/ClickHouse/ClickHouse/pull/4883) ([阿利沙平](https://github.com/alesapin)) -- 功能 `cutQueryStringAndFragment()` 和 `queryStringAndFragment()` 现在正常工作时 `URL` 包含一个片段,没有查询。 [\#4894](https://github.com/ClickHouse/ClickHouse/pull/4894) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 修复设置时罕见的错误 `min_bytes_to_use_direct_io` 大于零,这发生在线程必须在列文件中向后寻找时。 [\#4897](https://github.com/ClickHouse/ClickHouse/pull/4897) ([阿利沙平](https://github.com/alesapin)) -- 修复聚合函数的错误参数类型 `LowCardinality` 参数(修复问题 [\#4919](https://github.com/ClickHouse/ClickHouse/issues/4919)). [\#4922](https://github.com/ClickHouse/ClickHouse/pull/4922) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 修复功能 `toISOWeek` 1970年的结果。 [\#4988](https://github.com/ClickHouse/ClickHouse/pull/4988) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复 `DROP`, `TRUNCATE` 和 `OPTIMIZE` 查询重复,在执行时 `ON CLUSTER` 为 `ReplicatedMergeTree*` 表家庭. [\#4991](https://github.com/ClickHouse/ClickHouse/pull/4991) ([阿利沙平](https://github.com/alesapin)) - -#### 改进 {#improvements-2} - -- 保持平凡, `DEFAULT`, `MATERIALIZED` 和 `ALIAS` 在一个列表中的列(修复问题 [\#2867](https://github.com/ClickHouse/ClickHouse/issues/2867)). [\#4707](https://github.com/ClickHouse/ClickHouse/pull/4707) ([Alex Zatelepin](https://github.com/ztlpn)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-3-11-2019-04-02} - -#### 错误修复 {#bug-fixes-8} - -- 修复崩溃 `FULL/RIGHT JOIN` 当我们加入可为空vs不可为空时。 [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-11} - -- 添加从自定义用户启动clickhouse服务器映像的方法。 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-2-7-2019-03-30} - -#### 错误修复 {#bug-fixes-9} - -- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-1-3-2019-03-19} - -#### 错误修复 {#bug-fixes-10} - -- 包含两个固定的远程查询 `LIMIT BY` 和 `LIMIT`. 以前,如果 `LIMIT BY` 和 `LIMIT` 用于远程查询, `LIMIT` 可能发生之前 `LIMIT BY`,这导致过滤的结果。 [\#4708](https://github.com/ClickHouse/ClickHouse/pull/4708) ([康斯坦丁\*潘](https://github.com/kvap)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-4-0-49-2019-03-09} - -#### 新功能 {#new-features-5} - -- 增加了全面支持 `Protobuf` 格式(输入和输出,嵌套数据结构)。 [\#4174](https://github.com/ClickHouse/ClickHouse/pull/4174) [\#4493](https://github.com/ClickHouse/ClickHouse/pull/4493) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 添加位图功能与Ro哮的位图。 [\#4207](https://github.com/ClickHouse/ClickHouse/pull/4207) ([杨小姐](https://github.com/andyyzh)) [\#4568](https://github.com/ClickHouse/ClickHouse/pull/4568) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 实木复合地板格式支持。 [\#4448](https://github.com/ClickHouse/ClickHouse/pull/4448) ([proller](https://github.com/proller)) -- 为模糊字符串比较添加了N-gram距离。 它类似于R语言中的q-gram指标。 [\#4466](https://github.com/ClickHouse/ClickHouse/pull/4466) ([Danila Kutenin](https://github.com/danlark1)) -- 结合专用聚合和保留模式中的石墨汇总规则。 [\#4426](https://github.com/ClickHouse/ClickHouse/pull/4426) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) -- 已添加 `max_execution_speed` 和 `max_execution_speed_bytes` 限制资源使用。 已添加 `min_execution_speed_bytes` 设置以补充 `min_execution_speed`. [\#4430](https://github.com/ClickHouse/ClickHouse/pull/4430) ([张冬](https://github.com/zhang2014)) -- 实现功能 `flatten`. [\#4555](https://github.com/ClickHouse/ClickHouse/pull/4555) [\#4409](https://github.com/ClickHouse/ClickHouse/pull/4409) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov), [kzon](https://github.com/kzon)) -- 新增功能 `arrayEnumerateDenseRanked` 和 `arrayEnumerateUniqRanked` (这就像 `arrayEnumerateUniq` 但是允许微调数组深度以查看多维数组内部)。 [\#4475](https://github.com/ClickHouse/ClickHouse/pull/4475) ([proller](https://github.com/proller)) [\#4601](https://github.com/ClickHouse/ClickHouse/pull/4601) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- Multiple JOINS with some restrictions: no asterisks, no complex aliases in ON/WHERE/GROUP BY/… [\#4462](https://github.com/ClickHouse/ClickHouse/pull/4462) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 错误修复 {#bug-fixes-11} - -- 此版本还包含19.3和19.1中的所有错误修复。 -- 修正了数据跳过索引的错误:插入后颗粒顺序不正确。 [\#4407](https://github.com/ClickHouse/ClickHouse/pull/4407) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 固定 `set` ツ环板forョ `Nullable` 和 `LowCardinality` 列。 在它之前, `set` 索引与 `Nullable` 或 `LowCardinality` 列导致错误 `Data type must be deserialized with multiple streams` 同时选择。 [\#4594](https://github.com/ClickHouse/ClickHouse/pull/4594) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 正确设置完整的update\_time `executable` 字典更新. [\#4551](https://github.com/ClickHouse/ClickHouse/pull/4551) ([Tema Novikov](https://github.com/temoon)) -- 修复19.3中损坏的进度条。 [\#4627](https://github.com/ClickHouse/ClickHouse/pull/4627) ([filimonov](https://github.com/filimonov)) -- 在某些情况下,修复了内存区域收缩时MemoryTracker的不一致值。 [\#4619](https://github.com/ClickHouse/ClickHouse/pull/4619) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了ThreadPool中未定义的行为。 [\#4612](https://github.com/ClickHouse/ClickHouse/pull/4612) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了一个非常罕见的崩溃的消息 `mutex lock failed: Invalid argument` 当MergeTree表与SELECT同时删除时,可能会发生这种情况。 [\#4608](https://github.com/ClickHouse/ClickHouse/pull/4608) ([Alex Zatelepin](https://github.com/ztlpn)) -- ODBC驱动程序兼容 `LowCardinality` 数据类型。 [\#4381](https://github.com/ClickHouse/ClickHouse/pull/4381) ([proller](https://github.com/proller)) -- FreeBSD:修复程序 `AIOcontextPool: Found io_event with unknown id 0` 错误 [\#4438](https://github.com/ClickHouse/ClickHouse/pull/4438) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `system.part_log` 无论配置如何,都会创建表。 [\#4483](https://github.com/ClickHouse/ClickHouse/pull/4483) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复未定义的行为 `dictIsIn` 缓存字典功能。 [\#4515](https://github.com/ClickHouse/ClickHouse/pull/4515) ([阿利沙平](https://github.com/alesapin)) -- Fixed a deadlock when a SELECT query locks the same table multiple times (e.g. from different threads or when executing multiple subqueries) and there is a concurrent DDL query. [\#4535](https://github.com/ClickHouse/ClickHouse/pull/4535) ([Alex Zatelepin](https://github.com/ztlpn)) -- 默认情况下禁用compile\_expressions,直到我们得到自己 `llvm` contrib并且可以测试它 `clang` 和 `asan`. [\#4579](https://github.com/ClickHouse/ClickHouse/pull/4579) ([阿利沙平](https://github.com/alesapin)) -- 预防 `std::terminate` 当 `invalidate_query` 为 `clickhouse` 外部字典源返回了错误的结果集(空或一行以上或一列以上)。 固定的问题,当 `invalidate_query` 执行每五秒钟,无论到 `lifetime`. [\#4583](https://github.com/ClickHouse/ClickHouse/pull/4583) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 避免死锁时 `invalidate_query` 对于与字典 `clickhouse` 资料来源涉及 `system.dictionaries` 表或 `Dictionaries` 数据库(罕见的情况)。 [\#4599](https://github.com/ClickHouse/ClickHouse/pull/4599) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了交叉连接与空在哪里。 [\#4598](https://github.com/ClickHouse/ClickHouse/pull/4598) ([Artem Zuikov](https://github.com/4ertus2)) -- 在功能固定段错误 “replicate” 传递常量参数时。 [\#4603](https://github.com/ClickHouse/ClickHouse/pull/4603) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 使用谓词优化器修复lambda函数。 [\#4408](https://github.com/ClickHouse/ClickHouse/pull/4408) ([张冬](https://github.com/zhang2014)) -- 多个联接多个修复。 [\#4595](https://github.com/ClickHouse/ClickHouse/pull/4595) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 改进 {#improvements-3} - -- 在右表列的连接上部分支持别名。 [\#4412](https://github.com/ClickHouse/ClickHouse/pull/4412) ([Artem Zuikov](https://github.com/4ertus2)) -- 结果多加入了需要正确的结果,名称为使用中子选择. 替换平的别名来源中的名称结果。 [\#4474](https://github.com/ClickHouse/ClickHouse/pull/4474) ([Artem Zuikov](https://github.com/4ertus2)) -- 改进连接语句的下推逻辑。 [\#4387](https://github.com/ClickHouse/ClickHouse/pull/4387) ([伊万](https://github.com/abyss7)) - -#### 性能改进 {#performance-improvements-3} - -- 改进的启发式 “move to PREWHERE” 优化。 [\#4405](https://github.com/ClickHouse/ClickHouse/pull/4405) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 使用适当的查找表,使用HashTable的api用于8位和16位密钥。 [\#4536](https://github.com/ClickHouse/ClickHouse/pull/4536) ([阿莫斯鸟](https://github.com/amosbird)) -- 改进字符串比较的性能。 [\#4564](https://github.com/ClickHouse/ClickHouse/pull/4564) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在单独的线程中清理分布式DDL队列,以便它不会减慢处理分布式DDL任务的主循环。 [\#4502](https://github.com/ClickHouse/ClickHouse/pull/4502) ([Alex Zatelepin](https://github.com/ztlpn)) -- 当 `min_bytes_to_use_direct_io` 如果设置为1,则不是每个文件都使用O\_DIRECT模式打开,因为要读取的数据大小有时被一个压缩块的大小所低估。 [\#4526](https://github.com/ClickHouse/ClickHouse/pull/4526) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-12} - -- 增加了对clang-9的支持 [\#4604](https://github.com/ClickHouse/ClickHouse/pull/4604) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复错误 `__asm__` 说明(再次) [\#4621](https://github.com/ClickHouse/ClickHouse/pull/4621) ([Konstantin Podshumok](https://github.com/podshumok)) -- 添加指定设置的能力 `clickhouse-performance-test` 从命令行。 [\#4437](https://github.com/ClickHouse/ClickHouse/pull/4437) ([阿利沙平](https://github.com/alesapin)) -- 将字典测试添加到集成测试。 [\#4477](https://github.com/ClickHouse/ClickHouse/pull/4477) ([阿利沙平](https://github.com/alesapin)) -- 在网站上添加了来自基准测试的查询,以自动化性能测试。 [\#4496](https://github.com/ClickHouse/ClickHouse/pull/4496) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `xxhash.h` 在外部lz4中不存在,因为它是一个实现细节,并且它的符号是命名空间的 `XXH_NAMESPACE` 麦克罗 当lz4是外部的,xxHash也必须是外部的,并且依赖者必须链接到它。 [\#4495](https://github.com/ClickHouse/ClickHouse/pull/4495) ([Origej Desh](https://github.com/orivej)) -- 固定的情况下,当 `quantileTiming` 聚合函数可以用负或浮点参数调用(这修复了使用未定义的行为消毒器的模糊测试)。 [\#4506](https://github.com/ClickHouse/ClickHouse/pull/4506) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 拼写错误更正。 [\#4531](https://github.com/ClickHouse/ClickHouse/pull/4531) ([sdk2](https://github.com/sdk2)) -- 在Mac上修复编译。 [\#4371](https://github.com/ClickHouse/ClickHouse/pull/4371) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- Freebsd和各种不寻常的构建配置的构建修复程序。 [\#4444](https://github.com/ClickHouse/ClickHouse/pull/4444) ([proller](https://github.com/proller)) - -## ClickHouse释放19.3 {#clickhouse-release-19-3} - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-3-9-1-2019-04-02} - -#### 错误修复 {#bug-fixes-12} - -- 修复崩溃 `FULL/RIGHT JOIN` 当我们加入可为空vs不可为空时。 [\#4855](https://github.com/ClickHouse/ClickHouse/pull/4855) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复分段故障 `clickhouse-copier`. [\#4835](https://github.com/ClickHouse/ClickHouse/pull/4835) ([proller](https://github.com/proller)) -- 固定读取 `Array(LowCardinality)` column在极少数情况下,当column包含一个长序列的空数组时。 [\#4850](https://github.com/ClickHouse/ClickHouse/pull/4850) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) - -#### 构建/测试/包装改进 {#buildtestingpackaging-improvement-13} - -- 添加从自定义用户启动clickhouse服务器映像的方法 [\#4753](https://github.com/ClickHouse/ClickHouse/pull/4753) ([Mikhail f. Shiryaev](https://github.com/Felixoid)) - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-7-2019-03-12} - -#### 错误修复 {#bug-fixes-13} - -- 修正了#3920中的错误。 此错误表现为随机缓存损坏(消息 `Unknown codec family code`, `Cannot seek through file`)和段错误。 这个错误最早出现在19.1版本中,并且存在于19.1.10和19.3.6之前的版本中。 [\#4623](https://github.com/ClickHouse/ClickHouse/pull/4623) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-3-6-2019-03-02} - -#### 错误修复 {#bug-fixes-14} - -- 当线程池中有超过1000个线程时, `std::terminate` 线程退出时可能发生。 [Azat Khuzhin](https://github.com/azat) [\#4485](https://github.com/ClickHouse/ClickHouse/pull/4485) [\#4505](https://github.com/ClickHouse/ClickHouse/pull/4505) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 现在可以创建 `ReplicatedMergeTree*` 对没有默认值的列进行注释的表和对没有注释和默认值的列进行编解码的表。 还修复编解码器的比较。 [\#4523](https://github.com/ClickHouse/ClickHouse/pull/4523) ([阿利沙平](https://github.com/alesapin)) -- 修复了与数组或元组联接时的崩溃。 [\#4552](https://github.com/ClickHouse/ClickHouse/pull/4552) ([Artem Zuikov](https://github.com/4ertus2)) -- 修复了clickhouse-复印机中的消息崩溃 `ThreadStatus not created`. [\#4540](https://github.com/ClickHouse/ClickHouse/pull/4540) ([Artem Zuikov](https://github.com/4ertus2)) -- 如果使用分布式Ddl,则在服务器关闭时修复了挂机问题。 [\#4472](https://github.com/ClickHouse/ClickHouse/pull/4472) ([Alex Zatelepin](https://github.com/ztlpn)) -- 错误的列编号打印在有关文本格式分析的列数大于10的错误消息中。 [\#4484](https://github.com/ClickHouse/ClickHouse/pull/4484) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-3} - -- 固定构建与启用AVX。 [\#4527](https://github.com/ClickHouse/ClickHouse/pull/4527) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 基于已知版本而不是编译它的内核启用扩展记帐和IO记帐。 [\#4541](https://github.com/ClickHouse/ClickHouse/pull/4541) ([纳瓦托洛梅](https://github.com/nvartolomei)) -- 允许跳过core\_dump的设置。size\_limit,如果限制设置失败,则警告而不是throw。 [\#4473](https://github.com/ClickHouse/ClickHouse/pull/4473) ([proller](https://github.com/proller)) -- 删除了 `inline` 标签 `void readBinary(...)` 在 `Field.cpp`. 也合并冗余 `namespace DB` 块。 [\#4530](https://github.com/ClickHouse/ClickHouse/pull/4530) ([hcz](https://github.com/hczhcz)) - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-5-2019-02-21} - -#### 错误修复 {#bug-fixes-15} - -- 修正了大型http插入查询处理的错误。 [\#4454](https://github.com/ClickHouse/ClickHouse/pull/4454) ([阿利沙平](https://github.com/alesapin)) -- 修正了向后不兼容的旧版本,由于错误的实现 `send_logs_level` 设置。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了表函数的向后不兼容性 `remote` 与列注释介绍. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-4-2019-02-16} - -#### 改进 {#improvements-4} - -- 执行以下操作时,表索引大小不考虑内存限制 `ATTACH TABLE` 查询。 避免了分离后无法连接表的可能性。 [\#4396](https://github.com/ClickHouse/ClickHouse/pull/4396) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 稍微提高了从ZooKeeper接收的最大字符串和数组大小的限制。 它允许继续与增加的尺寸工作 `CLIENT_JVMFLAGS=-Djute.maxbuffer=...` 在动物园管理员。 [\#4398](https://github.com/ClickHouse/ClickHouse/pull/4398) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 允许修复被遗弃的副本,即使它已经在其队列中拥有大量的节点。 [\#4399](https://github.com/ClickHouse/ClickHouse/pull/4399) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加一个必需的参数 `SET` 索引(最大存储行数)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) - -#### 错误修复 {#bug-fixes-16} - -- 固定 `WITH ROLLUP` 单组结果 `LowCardinality` 钥匙 [\#4384](https://github.com/ClickHouse/ClickHouse/pull/4384) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 在设置索引固定错误(删除颗粒,如果它包含超过 `max_rows` 行)。 [\#4386](https://github.com/ClickHouse/ClickHouse/pull/4386) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 很多的FreeBSD构建修复。 [\#4397](https://github.com/ClickHouse/ClickHouse/pull/4397) ([proller](https://github.com/proller)) -- 固定别名替换查询与子查询包含相同的别名(问题 [\#4110](https://github.com/ClickHouse/ClickHouse/issues/4110)). [\#4351](https://github.com/ClickHouse/ClickHouse/pull/4351) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-4} - -- 添加运行能力 `clickhouse-server` 对于docker镜像中的无状态测试。 [\#4347](https://github.com/ClickHouse/ClickHouse/pull/4347) ([瓦西里\*内姆科夫](https://github.com/Enmk)) - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-3-3-2019-02-13} - -#### 新功能 {#new-features-6} - -- 添加了 `KILL MUTATION` 允许删除由于某些原因卡住的突变的声明。 已添加 `latest_failed_part`, `latest_fail_time`, `latest_fail_reason` 字段到 `system.mutations` 表更容易排除故障。 [\#4287](https://github.com/ClickHouse/ClickHouse/pull/4287) ([Alex Zatelepin](https://github.com/ztlpn)) -- 添加聚合功能 `entropy` 计算香农熵 [\#4238](https://github.com/ClickHouse/ClickHouse/pull/4238) ([Quid37](https://github.com/Quid37)) -- 添加发送查询的功能 `INSERT INTO tbl VALUES (....` 到服务器而不拆分 `query` 和 `data` 零件。 [\#4301](https://github.com/ClickHouse/ClickHouse/pull/4301) ([阿利沙平](https://github.com/alesapin)) -- 通用实现 `arrayWithConstant` 添加了功能。 [\#4322](https://github.com/ClickHouse/ClickHouse/pull/4322) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 已实施 `NOT BETWEEN` 比较运算符。 [\#4228](https://github.com/ClickHouse/ClickHouse/pull/4228) ([Dmitry Naumov](https://github.com/nezed)) -- 执行 `sumMapFiltered` 为了能够限制其值将被求和的键的数量 `sumMap`. [\#4129](https://github.com/ClickHouse/ClickHouse/pull/4129) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- 增加了支持 `Nullable` 类型 `mysql` 表功能。 [\#4198](https://github.com/ClickHouse/ClickHouse/pull/4198) ([Emmanuel Donin de Rosière](https://github.com/edonin)) -- 支持任意常量表达式 `LIMIT` 条款 [\#4246](https://github.com/ClickHouse/ClickHouse/pull/4246) ([k3box](https://github.com/k3box)) -- 已添加 `topKWeighted` 采用带有(无符号整数)权重的附加参数的聚合函数。 [\#4245](https://github.com/ClickHouse/ClickHouse/pull/4245) ([安德鲁\*戈尔曼](https://github.com/andrewgolman)) -- `StorageJoin` 现在支持 `join_any_take_last_row` 允许复盖同一键的现有值的设置。 [\#3973](https://github.com/ClickHouse/ClickHouse/pull/3973) ([阿莫斯鸟](https://github.com/amosbird) -- 添加功能 `toStartOfInterval`. [\#4304](https://github.com/ClickHouse/ClickHouse/pull/4304) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 已添加 `RowBinaryWithNamesAndTypes` 格式。 [\#4200](https://github.com/ClickHouse/ClickHouse/pull/4200) ([Oleg V.Kozlyuk](https://github.com/DarkWanderer)) -- 已添加 `IPv4` 和 `IPv6` 数据类型。 更有效的实现 `IPv*` 功能。 [\#3669](https://github.com/ClickHouse/ClickHouse/pull/3669) ([瓦西里\*内姆科夫](https://github.com/Enmk)) -- 添加功能 `toStartOfTenMinutes()`. [\#4298](https://github.com/ClickHouse/ClickHouse/pull/4298) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 已添加 `Protobuf` 输出格式。 [\#4005](https://github.com/ClickHouse/ClickHouse/pull/4005) [\#4158](https://github.com/ClickHouse/ClickHouse/pull/4158) ([维塔利\*巴拉诺夫](https://github.com/vitlibar)) -- 增加了对数据导入(插入)HTTP接口的brotli支持。 [\#4235](https://github.com/ClickHouse/ClickHouse/pull/4235) ([米哈伊尔](https://github.com/fandyushin)) -- 增加了提示,而用户做出错字的函数名称或键入命令行客户端。 [\#4239](https://github.com/ClickHouse/ClickHouse/pull/4239) ([Danila Kutenin](https://github.com/danlark1)) -- 已添加 `Query-Id` 到服务器的HTTP响应头。 [\#4231](https://github.com/ClickHouse/ClickHouse/pull/4231) ([米哈伊尔](https://github.com/fandyushin)) - -#### 实验特点 {#experimental-features-2} - -- 已添加 `minmax` 和 `set` MergeTree表引擎系列的数据跳过索引。 [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- 增加了转换 `CROSS JOIN` 到 `INNER JOIN` 如果可能的话 [\#4221](https://github.com/ClickHouse/ClickHouse/pull/4221) [\#4266](https://github.com/ClickHouse/ClickHouse/pull/4266) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 错误修复 {#bug-fixes-17} - -- 固定 `Not found column` 对于重复的列 `JOIN ON` 科。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- 赂眉露\>\> `START REPLICATED SENDS` 命令开始复制发送。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([纳瓦托洛梅](https://github.com/nvartolomei)) -- 固定聚合函数执行 `Array(LowCardinality)` 争论。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 修正了错误的行为,当做 `INSERT ... SELECT ... FROM file(...)` 查询和文件有 `CSVWithNames` 或 `TSVWIthNames` 格式和第一个数据行丢失。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 如果字典不可用,则修复了字典重新加载时的崩溃。 此错误出现在19.1.6中。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- 固定 `ALL JOIN` 右表中有重复项。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正了分段故障 `use_uncompressed_cache=1` 和异常与错误的未压缩大小。 此错误出现在19.1.6中。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([阿利沙平](https://github.com/alesapin)) -- 固定 `compile_expressions` 错误与大(超过int16)日期的比较。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([阿利沙平](https://github.com/alesapin)) -- 从表函数选择时固定无限循环 `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 暂时禁用谓词优化 `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([张冬](https://github.com/zhang2014)) -- 固定 `Illegal instruction` 在旧Cpu上使用base64函数时出错。 仅当ClickHouse使用gcc-8编译时,才会重现此错误。 [\#4275](https://github.com/ClickHouse/ClickHouse/pull/4275) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定 `No message received` 通过TLS连接与PostgreSQL ODBC驱动程序交互时出错。 还修复了使用MySQL ODBC驱动程序时的段错误。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正错误的结果时 `Date` 和 `DateTime` 参数用于条件运算符(函数)的分支 `if`). 增加了函数的通用案例 `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- ClickHouse字典现在加载内 `clickhouse` 过程。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复死锁时 `SELECT` 从一个表 `File` 引擎被重试后 `No such file or directory` 错误 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 从选择时固定的竞争条件 `system.tables` 可能会给 `table doesn't exist` 错误 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `clickhouse-client` 如果在交互模式下运行,则在加载命令行建议的数据时可以在退出时段错误。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了一个错误,当包含突变的执行 `IN` 操作员产生了不正确的结果。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修正错误:如果有一个数据库 `Dictionary` 引擎中,所有字典在服务器启动时强制加载,如果有来自localhost的ClickHouse源字典,则字典无法加载。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了在服务器关闭时尝试再次创建系统日志时的错误。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 正确返回正确的类型和正确处理锁 `joinGet` 功能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([阿莫斯鸟](https://github.com/amosbird)) -- 已添加 `sumMapWithOverflow` 功能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- 固定段错误 `allow_experimental_multiple_joins_emulation`. [52de2c](https://github.com/ClickHouse/ClickHouse/commit/52de2cd927f7b5257dd67e175f0a5560a48840d0) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正错误与不正确 `Date` 和 `DateTime` 比较。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- 在未定义的行为消毒固定模糊测试:增加了参数类型检查 `quantile*Weighted` 家庭的功能。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了在删除旧数据部分时罕见的争用条件可能会失败 `File not found` 错误 [\#4378](https://github.com/ClickHouse/ClickHouse/pull/4378) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复缺少/etc/clickhouse-server/config的安装包。xml [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-5} - -- Debian软件包:根据配置正确的/etc/clickhouse-server/预处理链接。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- Freebsd的各种构建修复程序。 [\#4225](https://github.com/ClickHouse/ClickHouse/pull/4225) ([proller](https://github.com/proller)) -- 增加了在perftest中创建,填充和删除表的能力。 [\#4220](https://github.com/ClickHouse/ClickHouse/pull/4220) ([阿利沙平](https://github.com/alesapin)) -- 添加了一个脚本来检查重复的包括。 [\#4326](https://github.com/ClickHouse/ClickHouse/pull/4326) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了在性能测试中通过索引运行查询的能力。 [\#4264](https://github.com/ClickHouse/ClickHouse/pull/4264) ([阿利沙平](https://github.com/alesapin)) -- 建议安装带有调试符号的软件包。 [\#4274](https://github.com/ClickHouse/ClickHouse/pull/4274) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 重构性能测试。 更好的记录和信号处理。 [\#4171](https://github.com/ClickHouse/ClickHouse/pull/4171) ([阿利沙平](https://github.com/alesapin)) -- 将文档添加到匿名Yandex。Metrika数据集. [\#4164](https://github.com/ClickHouse/ClickHouse/pull/4164) ([阿利沙平](https://github.com/alesapin)) -- Аdded tool for converting an old month-partitioned part to the custom-partitioned format. [\#4195](https://github.com/ClickHouse/ClickHouse/pull/4195) ([Alex Zatelepin](https://github.com/ztlpn)) -- 添加了有关s3中两个数据集的文档。 [\#4144](https://github.com/ClickHouse/ClickHouse/pull/4144) ([阿利沙平](https://github.com/alesapin)) -- 增加了从拉请求描述创建更新日志的脚本。 [\#4169](https://github.com/ClickHouse/ClickHouse/pull/4169) [\#4173](https://github.com/ClickHouse/ClickHouse/pull/4173) ([KochetovNicolai](https://github.com/KochetovNicolai)) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 为ClickHouse添加了木偶模块。 [\#4182](https://github.com/ClickHouse/ClickHouse/pull/4182) ([Maxim Fedotov](https://github.com/MaxFedotov)) -- 添加了一组无证函数的文档。 [\#4168](https://github.com/ClickHouse/ClickHouse/pull/4168) ([张冬](https://github.com/zhang2014)) -- ARM构建修复。 [\#4210](https://github.com/ClickHouse/ClickHouse/pull/4210)[\#4306](https://github.com/ClickHouse/ClickHouse/pull/4306) [\#4291](https://github.com/ClickHouse/ClickHouse/pull/4291) ([proller](https://github.com/proller)) ([proller](https://github.com/proller)) -- 字典测试现在能够从运行 `ctest`. [\#4189](https://github.com/ClickHouse/ClickHouse/pull/4189) ([proller](https://github.com/proller)) -- 现在 `/etc/ssl` 用作带有SSL证书的默认目录。 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在开始时添加了检查SSE和AVX指令。 [\#4234](https://github.com/ClickHouse/ClickHouse/pull/4234) ([Igr](https://github.com/igron99)) -- 初始化脚本将等待服务器,直到启动。 [\#4281](https://github.com/ClickHouse/ClickHouse/pull/4281) ([proller](https://github.com/proller)) - -#### 向后不兼容的更改 {#backward-incompatible-changes-1} - -- 已删除 `allow_experimental_low_cardinality_type` 设置。 `LowCardinality` 数据类型已准备就绪。 [\#4323](https://github.com/ClickHouse/ClickHouse/pull/4323) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 根据可用内存量减少标记高速缓存大小和未压缩高速缓存大小。 [\#4240](https://github.com/ClickHouse/ClickHouse/pull/4240) ([Lopatin Konstantin](https://github.com/k-lopatin) -- 添加关键字 `INDEX` 在 `CREATE TABLE` 查询。 具有名称的列 `index` 必须使用反引号或双引号引用: `` `index` ``. [\#4143](https://github.com/ClickHouse/ClickHouse/pull/4143) ([尼基塔\*瓦西列夫](https://github.com/nikvas0)) -- `sumMap` 现在提升结果类型而不是溢出。 老 `sumMap` 行为可以通过使用获得 `sumMapWithOverflow` 功能。 [\#4151](https://github.com/ClickHouse/ClickHouse/pull/4151) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) - -#### 性能改进 {#performance-improvements-4} - -- `std::sort` 改为 `pdqsort` 对于没有 `LIMIT`. [\#4236](https://github.com/ClickHouse/ClickHouse/pull/4236) ([Evgenii Pravda](https://github.com/kvinty)) -- 现在服务器重用全局线程池中的线程。 这会影响某些角落情况下的性能。 [\#4150](https://github.com/ClickHouse/ClickHouse/pull/4150) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 改进 {#improvements-5} - -- 实现了对FreeBSD的AIO支持。 [\#4305](https://github.com/ClickHouse/ClickHouse/pull/4305) ([urgordeadbeef](https://github.com/urgordeadbeef)) -- `SELECT * FROM a JOIN b USING a, b` 现在回来 `a` 和 `b` 列仅从左表。 [\#4141](https://github.com/ClickHouse/ClickHouse/pull/4141) ([Artem Zuikov](https://github.com/4ertus2)) -- 允许 `-C` 客户端的选项作为工作 `-c` 选项。 [\#4232](https://github.com/ClickHouse/ClickHouse/pull/4232) ([syominsergey](https://github.com/syominsergey)) -- 现在选项 `--password` 无值使用需要从标准输入的密码。 [\#4230](https://github.com/ClickHouse/ClickHouse/pull/4230) ([BSD\_Conqueror](https://github.com/bsd-conqueror)) -- 在包含字符串文字中添加了非转义元字符的突出显示 `LIKE` 表达式或正则表达式。 [\#4327](https://github.com/ClickHouse/ClickHouse/pull/4327) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加取消HTTP只读查询,如果客户端套接字消失。 [\#4213](https://github.com/ClickHouse/ClickHouse/pull/4213) ([纳瓦托洛梅](https://github.com/nvartolomei)) -- 现在,服务器报告进度,以保持客户端连接活跃。 [\#4215](https://github.com/ClickHouse/ClickHouse/pull/4215) ([伊万](https://github.com/abyss7)) -- 稍微好一点的消息与优化查询的原因 `optimize_throw_if_noop` 设置已启用。 [\#4294](https://github.com/ClickHouse/ClickHouse/pull/4294) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了支持 `--version` clickhouse服务器的选项。 [\#4251](https://github.com/ClickHouse/ClickHouse/pull/4251) ([Lopatin Konstantin](https://github.com/k-lopatin)) -- 已添加 `--help/-h` 选项 `clickhouse-server`. [\#4233](https://github.com/ClickHouse/ClickHouse/pull/4233) ([尤里\*巴拉诺夫](https://github.com/yurriy)) -- 增加了对具有聚合函数状态结果的标量子查询的支持。 [\#4348](https://github.com/ClickHouse/ClickHouse/pull/4348) ([尼古拉\*科切托夫](https://github.com/KochetovNicolai)) -- 改进服务器关闭时间并改变等待时间。 [\#4372](https://github.com/ClickHouse/ClickHouse/pull/4372) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 添加了有关replicated\_can\_become\_leader设置到系统的信息。如果副本不会尝试成为领导者,则添加日志记录。 [\#4379](https://github.com/ClickHouse/ClickHouse/pull/4379) ([Alex Zatelepin](https://github.com/ztlpn)) - -## ClickHouse释放19.1 {#clickhouse-release-19-1} - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-14-2019-03-14} - -- 修正错误 `Column ... queried more than once` 这可能发生,如果设置 `asterisk_left_columns_only` 在使用的情况下设置为1 `GLOBAL JOIN` 与 `SELECT *` (罕见的情况)。 该问题在19.3及更新版本中不存在。 [6bac7d8d](https://github.com/ClickHouse/ClickHouse/pull/4692/commits/6bac7d8d11a9b0d6de0b32b53c47eb2f6f8e7062) ([Artem Zuikov](https://github.com/4ertus2)) - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-13-2019-03-12} - -此版本包含与19.3.7完全相同的补丁集。 - -### 碌莽禄,拢,010-68520682\戮卤篓拢,010-68520682\ {#clickhouse-release-19-1-10-2019-03-03} - -此版本包含与19.3.6完全相同的补丁集。 - -## ClickHouse释放19.1 {#clickhouse-release-19-1-1} - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-9-2019-02-21} - -#### 错误修复 {#bug-fixes-18} - -- 修正了向后不兼容的旧版本,由于错误的实现 `send_logs_level` 设置。 [\#4445](https://github.com/ClickHouse/ClickHouse/pull/4445) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了表函数的向后不兼容性 `remote` 与列注释介绍. [\#4446](https://github.com/ClickHouse/ClickHouse/pull/4446) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-8-2019-02-16} - -#### 错误修复 {#bug-fixes-19} - -- 修复缺少/etc/clickhouse-server/config的安装包。xml [\#4343](https://github.com/ClickHouse/ClickHouse/pull/4343) ([proller](https://github.com/proller)) - -## ClickHouse释放19.1 {#clickhouse-release-19-1-2} - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-7-2019-02-15} - -#### 错误修复 {#bug-fixes-20} - -- 正确返回正确的类型和正确处理锁 `joinGet` 功能。 [\#4153](https://github.com/ClickHouse/ClickHouse/pull/4153) ([阿莫斯鸟](https://github.com/amosbird)) -- 修复了在服务器关闭时尝试再次创建系统日志时的错误。 [\#4254](https://github.com/ClickHouse/ClickHouse/pull/4254) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正错误:如果有一个数据库 `Dictionary` 引擎中,所有字典在服务器启动时强制加载,如果有来自localhost的ClickHouse源字典,则字典无法加载。 [\#4255](https://github.com/ClickHouse/ClickHouse/pull/4255) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了一个错误,当包含突变的执行 `IN` 操作员产生了不正确的结果。 [\#4099](https://github.com/ClickHouse/ClickHouse/pull/4099) ([Alex Zatelepin](https://github.com/ztlpn)) -- `clickhouse-client` 如果在交互模式下运行,则在加载命令行建议的数据时可以在退出时段错误。 [\#4317](https://github.com/ClickHouse/ClickHouse/pull/4317) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 从选择时固定的竞争条件 `system.tables` 可能会给 `table doesn't exist` 错误 [\#4313](https://github.com/ClickHouse/ClickHouse/pull/4313) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复死锁时 `SELECT` 从一个表 `File` 引擎被重试后 `No such file or directory` 错误 [\#4161](https://github.com/ClickHouse/ClickHouse/pull/4161) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了一个问题:本地ClickHouse字典通过TCP加载,但应该在进程中加载。 [\#4166](https://github.com/ClickHouse/ClickHouse/pull/4166) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定 `No message received` 通过TLS连接与PostgreSQL ODBC驱动程序交互时出错。 还修复了使用MySQL ODBC驱动程序时的段错误。 [\#4170](https://github.com/ClickHouse/ClickHouse/pull/4170) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 暂时禁用谓词优化 `ORDER BY`. [\#3890](https://github.com/ClickHouse/ClickHouse/pull/3890) ([张冬](https://github.com/zhang2014)) -- 从表函数选择时固定无限循环 `numbers(0)`. [\#4280](https://github.com/ClickHouse/ClickHouse/pull/4280) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定 `compile_expressions` 错误与大(超过int16)日期的比较。 [\#4341](https://github.com/ClickHouse/ClickHouse/pull/4341) ([阿利沙平](https://github.com/alesapin)) -- 修正了分段故障 `uncompressed_cache=1` 和异常与错误的未压缩大小。 [\#4186](https://github.com/ClickHouse/ClickHouse/pull/4186) ([阿利沙平](https://github.com/alesapin)) -- 固定 `ALL JOIN` 右表中有重复项。 [\#4184](https://github.com/ClickHouse/ClickHouse/pull/4184) ([Artem Zuikov](https://github.com/4ertus2)) -- 修正了错误的行为,当做 `INSERT ... SELECT ... FROM file(...)` 查询和文件有 `CSVWithNames` 或 `TSVWIthNames` 格式和第一个数据行丢失。 [\#4297](https://github.com/ClickHouse/ClickHouse/pull/4297) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 固定聚合函数执行 `Array(LowCardinality)` 争论。 [\#4055](https://github.com/ClickHouse/ClickHouse/pull/4055) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- Debian软件包:根据配置正确的/etc/clickhouse-server/预处理链接。 [\#4205](https://github.com/ClickHouse/ClickHouse/pull/4205) ([proller](https://github.com/proller)) -- 在未定义的行为消毒固定模糊测试:增加了参数类型检查 `quantile*Weighted` 家庭的功能。 [\#4145](https://github.com/ClickHouse/ClickHouse/pull/4145) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 赂眉露\>\> `START REPLICATED SENDS` 命令开始复制发送。 [\#4229](https://github.com/ClickHouse/ClickHouse/pull/4229) ([纳瓦托洛梅](https://github.com/nvartolomei)) -- 固定 `Not found column` 对于联接部分中的重复列。 [\#4279](https://github.com/ClickHouse/ClickHouse/pull/4279) ([Artem Zuikov](https://github.com/4ertus2)) -- 现在 `/etc/ssl` 用作带有SSL证书的默认目录。 [\#4167](https://github.com/ClickHouse/ClickHouse/pull/4167) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 如果字典不可用,则修复了字典重新加载时的崩溃。 [\#4188](https://github.com/ClickHouse/ClickHouse/pull/4188) ([proller](https://github.com/proller)) -- 修正错误与不正确 `Date` 和 `DateTime` 比较。 [\#4237](https://github.com/ClickHouse/ClickHouse/pull/4237) ([valexey](https://github.com/valexey)) -- 修正错误的结果时 `Date` 和 `DateTime` 参数用于条件运算符(函数)的分支 `if`). 增加了函数的通用案例 `if`. [\#4243](https://github.com/ClickHouse/ClickHouse/pull/4243) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -### 碌莽禄,拢,010-68520682\ {#clickhouse-release-19-1-6-2019-01-24} - -#### 新功能 {#new-features-7} - -- 自定义每列压缩编解码器的表。 [\#3899](https://github.com/ClickHouse/ClickHouse/pull/3899) [\#4111](https://github.com/ClickHouse/ClickHouse/pull/4111) ([阿利沙平](https://github.com/alesapin), [张冬](https://github.com/zhang2014), [阿纳托利](https://github.com/Sindbag)) -- 添加压缩编解ec `Delta`. [\#4052](https://github.com/ClickHouse/ClickHouse/pull/4052) ([阿利沙平](https://github.com/alesapin)) -- 允许 `ALTER` 压缩编解ecs。 [\#4054](https://github.com/ClickHouse/ClickHouse/pull/4054) ([阿利沙平](https://github.com/alesapin)) -- 新增功能 `left`, `right`, `trim`, `ltrim`, `rtrim`, `timestampadd`, `timestampsub` 对于SQL标准的兼容性。 [\#3826](https://github.com/ClickHouse/ClickHouse/pull/3826) ([伊万\*布林科夫](https://github.com/blinkov)) -- 支持写入 `HDFS` 表和 `hdfs` 表功能。 [\#4084](https://github.com/ClickHouse/ClickHouse/pull/4084) ([阿利沙平](https://github.com/alesapin)) -- 增加了从big haystack中搜索多个常量字符串的功能: `multiPosition`, `multiSearch` ,`firstMatch` 也与 `-UTF8`, `-CaseInsensitive`,和 `-CaseInsensitiveUTF8` 变体。 [\#4053](https://github.com/ClickHouse/ClickHouse/pull/4053) ([Danila Kutenin](https://github.com/danlark1)) -- 修剪未使用的碎片,如果 `SELECT` 通过分片键查询过滤器(设置 `optimize_skip_unused_shards`). [\#3851](https://github.com/ClickHouse/ClickHouse/pull/3851) ([Gleb Kanterov](https://github.com/kanterov), [伊万](https://github.com/abyss7)) -- 允许 `Kafka` 引擎忽略每个块的解析错误数。 [\#4094](https://github.com/ClickHouse/ClickHouse/pull/4094) ([伊万](https://github.com/abyss7)) -- 增加了对 `CatBoost` 多类模型评估。 功能 `modelEvaluate` 返回带有多类模型的每类原始预测的元组。 `libcatboostmodel.so` 应建立与 [\#607](https://github.com/catboost/catboost/pull/607). [\#3959](https://github.com/ClickHouse/ClickHouse/pull/3959) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 新增功能 `filesystemAvailable`, `filesystemFree`, `filesystemCapacity`. [\#4097](https://github.com/ClickHouse/ClickHouse/pull/4097) ([Boris Granveaud](https://github.com/bgranvea)) -- 添加了哈希函数 `xxHash64` 和 `xxHash32`. [\#3905](https://github.com/ClickHouse/ClickHouse/pull/3905) ([filimonov](https://github.com/filimonov)) -- 已添加 `gccMurmurHash` 散列函数(GCC风味杂音散列),它使用相同的散列种子 [海湾合作委员会](https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/libstdc%2B%2B-v3/include/bits/functional_hash.h#L191) [\#4000](https://github.com/ClickHouse/ClickHouse/pull/4000) ([sundyli](https://github.com/sundy-li)) -- 添加了哈希函数 `javaHash`, `hiveHash`. [\#3811](https://github.com/ClickHouse/ClickHouse/pull/3811) ([上书结365](https://github.com/shangshujie365)) -- 添加表功能 `remoteSecure`. 函数的工作原理为 `remote`,但使用安全连接。 [\#4088](https://github.com/ClickHouse/ClickHouse/pull/4088) ([proller](https://github.com/proller)) - -#### 实验特点 {#experimental-features-3} - -- 添加了多个联接仿真 (`allow_experimental_multiple_joins_emulation` 设置)。 [\#3946](https://github.com/ClickHouse/ClickHouse/pull/3946) ([Artem Zuikov](https://github.com/4ertus2)) - -#### 错误修复 {#bug-fixes-21} - -- 赂眉露\>\> `compiled_expression_cache_size` 默认情况下设置有限,以降低内存消耗。 [\#4041](https://github.com/ClickHouse/ClickHouse/pull/4041) ([阿利沙平](https://github.com/alesapin)) -- 修复导致执行更改复制表的线程和从ZooKeeper更新配置的线程中挂断的错误。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3891](https://github.com/ClickHouse/ClickHouse/issues/3891) [\#3934](https://github.com/ClickHouse/ClickHouse/pull/3934) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修复了执行分布式ALTER任务时的争用条件。 争用条件导致多个副本试图执行任务和所有副本,除了一个失败与ZooKeeper错误。 [\#3904](https://github.com/ClickHouse/ClickHouse/pull/3904) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修复错误时 `from_zk` 在对ZooKeeper的请求超时后,配置元素没有刷新。 [\#2947](https://github.com/ClickHouse/ClickHouse/issues/2947) [\#3947](https://github.com/ClickHouse/ClickHouse/pull/3947) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修复IPv4子网掩码错误前缀的错误。 [\#3945](https://github.com/ClickHouse/ClickHouse/pull/3945) ([阿利沙平](https://github.com/alesapin)) -- 固定崩溃 (`std::terminate`)在极少数情况下,由于资源耗尽而无法创建新线程。 [\#3956](https://github.com/ClickHouse/ClickHouse/pull/3956) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正错误时 `remote` 表函数执行时,错误的限制被用于 `getStructureOfRemoteTable`. [\#4009](https://github.com/ClickHouse/ClickHouse/pull/4009) ([阿利沙平](https://github.com/alesapin)) -- 修复netlink套接字的泄漏。 它们被放置在一个池中,在那里它们永远不会被删除,并且当所有当前套接字都在使用时,在新线程开始时创建了新的套接字。 [\#4017](https://github.com/ClickHouse/ClickHouse/pull/4017) ([Alex Zatelepin](https://github.com/ztlpn)) -- 修复关闭错误 `/proc/self/fd` 目录早于所有fds被读取 `/proc` 分叉后 `odbc-bridge` 子进程。 [\#4120](https://github.com/ClickHouse/ClickHouse/pull/4120) ([阿利沙平](https://github.com/alesapin)) -- 在主键中使用字符串的情况下,固定字符串到UInt单调转换。 [\#3870](https://github.com/ClickHouse/ClickHouse/pull/3870) ([张冬](https://github.com/zhang2014)) -- 整数转换函数单调性计算中的固定误差。 [\#3921](https://github.com/ClickHouse/ClickHouse/pull/3921) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复段错误 `arrayEnumerateUniq`, `arrayEnumerateDense` 函数在一些无效的参数的情况下。 [\#3909](https://github.com/ClickHouse/ClickHouse/pull/3909) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 在StorageMerge修复UB。 [\#3910](https://github.com/ClickHouse/ClickHouse/pull/3910) ([阿莫斯鸟](https://github.com/amosbird)) -- 修正函数中的段错误 `addDays`, `subtractDays`. [\#3913](https://github.com/ClickHouse/ClickHouse/pull/3913) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正错误:功能 `round`, `floor`, `trunc`, `ceil` 在整数参数和大负比例执行时可能会返回虚假结果。 [\#3914](https://github.com/ClickHouse/ClickHouse/pull/3914) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了一个错误引起的 ‘kill query sync’ 从而导致核心转储。 [\#3916](https://github.com/ClickHouse/ClickHouse/pull/3916) ([muVulDeePecker](https://github.com/fancyqlx)) -- 修复空复制队列后延迟较长的bug。 [\#3928](https://github.com/ClickHouse/ClickHouse/pull/3928) [\#3932](https://github.com/ClickHouse/ClickHouse/pull/3932) ([阿利沙平](https://github.com/alesapin)) -- 修复了插入到表中的过多内存使用情况 `LowCardinality` 主键。 [\#3955](https://github.com/ClickHouse/ClickHouse/pull/3955) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 固定 `LowCardinality` 序列化 `Native` 在空数组的情况下格式化。 [\#3907](https://github.com/ClickHouse/ClickHouse/issues/3907) [\#4011](https://github.com/ClickHouse/ClickHouse/pull/4011) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 固定不正确的结果,而使用distinct通过单LowCardinality数字列。 [\#3895](https://github.com/ClickHouse/ClickHouse/issues/3895) [\#4012](https://github.com/ClickHouse/ClickHouse/pull/4012) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 固定专门的聚合与LowCardinality键(以防万一 `compile` 设置已启用)。 [\#3886](https://github.com/ClickHouse/ClickHouse/pull/3886) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 修复复制表查询的用户和密码转发。 [\#3957](https://github.com/ClickHouse/ClickHouse/pull/3957) ([阿利沙平](https://github.com/alesapin)) ([小路](https://github.com/nicelulu)) -- 修复了在重新加载字典时在字典数据库中列出表时可能发生的非常罕见的争用条件。 [\#3970](https://github.com/ClickHouse/ClickHouse/pull/3970) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了与ROLLUP或CUBE一起使用时的错误结果。 [\#3756](https://github.com/ClickHouse/ClickHouse/issues/3756) [\#3837](https://github.com/ClickHouse/ClickHouse/pull/3837) ([周三](https://github.com/reflection)) -- 用于查询的固定列别名 `JOIN ON` 语法和分布式表。 [\#3980](https://github.com/ClickHouse/ClickHouse/pull/3980) ([张冬](https://github.com/zhang2014)) -- 在内部实现固定的错误 `quantileTDigest` (由阿尔乔姆Vakhrushev发现)。 这个错误从来没有发生在ClickHouse中,只有那些直接使用ClickHouse代码库作为库的人才有关。 [\#3935](https://github.com/ClickHouse/ClickHouse/pull/3935) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 改进 {#improvements-6} - -- 支持 `IF NOT EXISTS` 在 `ALTER TABLE ADD COLUMN` 发言以及 `IF EXISTS` 在 `DROP/MODIFY/CLEAR/COMMENT COLUMN`. [\#3900](https://github.com/ClickHouse/ClickHouse/pull/3900) ([Boris Granveaud](https://github.com/bgranvea)) -- 功能 `parseDateTimeBestEffort`:支持格式 `DD.MM.YYYY`, `DD.MM.YY`, `DD-MM-YYYY`, `DD-Mon-YYYY`, `DD/Month/YYYY` 和相似。 [\#3922](https://github.com/ClickHouse/ClickHouse/pull/3922) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- `CapnProtoInputStream` 现在支持锯齿结构。 [\#4063](https://github.com/ClickHouse/ClickHouse/pull/4063) ([Odin Hultgren Van Der Horst](https://github.com/Miniwoffer)) -- 可用性改进:增加了从数据目录的所有者启动服务器进程的检查。 如果数据属于非root用户,则不允许从root用户启动服务器。 [\#3785](https://github.com/ClickHouse/ClickHouse/pull/3785) ([谢尔盖-v-加尔采夫](https://github.com/sergey-v-galtsev)) -- 在分析具有联接的查询期间检查所需列的更好的逻辑。 [\#3930](https://github.com/ClickHouse/ClickHouse/pull/3930) ([Artem Zuikov](https://github.com/4ertus2)) -- 减少在单个服务器中有大量分布式表的情况下的连接数。 [\#3726](https://github.com/ClickHouse/ClickHouse/pull/3726) ([张冬](https://github.com/zhang2014)) -- 支持的总计行 `WITH TOTALS` 查询ODBC驱动程序。 [\#3836](https://github.com/ClickHouse/ClickHouse/pull/3836) ([Maksim Koritckiy](https://github.com/nightweb)) -- 允许使用 `Enum`s为if函数内的整数。 [\#3875](https://github.com/ClickHouse/ClickHouse/pull/3875) ([伊万](https://github.com/abyss7)) -- 已添加 `low_cardinality_allow_in_native_format` 设置。 如果禁用,请不要使用 `LowCadrinality` 输入 `Native` 格式。 [\#3879](https://github.com/ClickHouse/ClickHouse/pull/3879) ([KochetovNicolai](https://github.com/KochetovNicolai)) -- 从编译表达式缓存中删除了一些冗余对象以降低内存使用率。 [\#4042](https://github.com/ClickHouse/ClickHouse/pull/4042) ([阿利沙平](https://github.com/alesapin)) -- 添加检查 `SET send_logs_level = 'value'` 查询接受适当的值。 [\#3873](https://github.com/ClickHouse/ClickHouse/pull/3873) ([Sabyanin马克西姆](https://github.com/s-mx)) -- 固定数据类型检查类型转换功能。 [\#3896](https://github.com/ClickHouse/ClickHouse/pull/3896) ([张冬](https://github.com/zhang2014)) - -#### 性能改进 {#performance-improvements-5} - -- 添加MergeTree设置 `use_minimalistic_part_header_in_zookeeper`. 如果启用,复制的表将在单个零件znode中存储紧凑零件元数据。 这可以显着减少ZooKeeper快照大小(特别是如果表有很多列)。 请注意,启用此设置后,您将无法降级到不支持它的版本。 [\#3960](https://github.com/ClickHouse/ClickHouse/pull/3960) ([Alex Zatelepin](https://github.com/ztlpn)) -- 为函数添加基于DFA的实现 `sequenceMatch` 和 `sequenceCount` 以防模式不包含时间。 [\#4004](https://github.com/ClickHouse/ClickHouse/pull/4004) ([Léo Ercolanelli](https://github.com/ercolanelli-leo)) -- 整数序列化的性能改进。 [\#3968](https://github.com/ClickHouse/ClickHouse/pull/3968) ([阿莫斯鸟](https://github.com/amosbird)) -- 零左填充PODArray,使-1元素始终有效并归零。 它用于无分支计算偏移量。 [\#3920](https://github.com/ClickHouse/ClickHouse/pull/3920) ([阿莫斯鸟](https://github.com/amosbird)) -- 还原 `jemalloc` 版本导致性能下降。 [\#4018](https://github.com/ClickHouse/ClickHouse/pull/4018) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) - -#### 向后不兼容的更改 {#backward-incompatible-changes-2} - -- 删除无证功能 `ALTER MODIFY PRIMARY KEY` 因为它被 `ALTER MODIFY ORDER BY` 指挥部 [\#3887](https://github.com/ClickHouse/ClickHouse/pull/3887) ([Alex Zatelepin](https://github.com/ztlpn)) -- 删除功能 `shardByHash`. [\#3833](https://github.com/ClickHouse/ClickHouse/pull/3833) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 禁止使用具有结果类型的标量子查询 `AggregateFunction`. [\#3865](https://github.com/ClickHouse/ClickHouse/pull/3865) ([伊万](https://github.com/abyss7)) - -#### 构建/测试/打包改进 {#buildtestingpackaging-improvements-6} - -- 增加了对PowerPC的支持 (`ppc64le`)建设。 [\#4132](https://github.com/ClickHouse/ClickHouse/pull/4132) ([Danila Kutenin](https://github.com/danlark1)) -- 有状态功能测试在公共可用数据集上运行。 [\#3969](https://github.com/ClickHouse/ClickHouse/pull/3969) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修复了服务器无法启动时的错误 `bash: /usr/bin/clickhouse-extract-from-config: Operation not permitted` Docker或systemd-nspawn中的消息。 [\#4136](https://github.com/ClickHouse/ClickHouse/pull/4136) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 更新 `rdkafka` 库v1.0.0-RC5。 使用cppkafka而不是原始的C接口。 [\#4025](https://github.com/ClickHouse/ClickHouse/pull/4025) ([伊万](https://github.com/abyss7)) -- 更新 `mariadb-client` 图书馆. 修复了UBSan发现的问题之一。 [\#3924](https://github.com/ClickHouse/ClickHouse/pull/3924) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- UBSan版本的一些修复。 [\#3926](https://github.com/ClickHouse/ClickHouse/pull/3926) [\#3021](https://github.com/ClickHouse/ClickHouse/pull/3021) [\#3948](https://github.com/ClickHouse/ClickHouse/pull/3948) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了使用UBSan构建的每次提交运行的测试。 -- 增加了PVS-Studio静态分析器的每次提交运行。 -- 修复了PVS-Studio发现的错误。 [\#4013](https://github.com/ClickHouse/ClickHouse/pull/4013) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了glibc兼容性问题。 [\#4100](https://github.com/ClickHouse/ClickHouse/pull/4100) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 将Docker映像移动到18.10并为glibc\>=2.28添加兼容性文件 [\#3965](https://github.com/ClickHouse/ClickHouse/pull/3965) ([阿利沙平](https://github.com/alesapin)) -- 如果用户不想在服务器码头镜像中播放目录,请添加env变量。 [\#3967](https://github.com/ClickHouse/ClickHouse/pull/3967) ([阿利沙平](https://github.com/alesapin)) -- 启用了大多数来自警告 `-Weverything` 在叮当声。 已启用 `-Wpedantic`. [\#3986](https://github.com/ClickHouse/ClickHouse/pull/3986) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 增加了一些只在clang8中可用的警告。 [\#3993](https://github.com/ClickHouse/ClickHouse/pull/3993) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 链接到 `libLLVM` 在使用共享链接时,而不是单独的LLVM库。 [\#3989](https://github.com/ClickHouse/ClickHouse/pull/3989) ([Origej Desh](https://github.com/orivej)) -- 为测试图像添加了消毒变量。 [\#4072](https://github.com/ClickHouse/ClickHouse/pull/4072) ([阿利沙平](https://github.com/alesapin)) -- `clickhouse-server` debian软件包会推荐 `libcap2-bin` 使用包 `setcap` 设置功能的工具。 这是可选的。 [\#4093](https://github.com/ClickHouse/ClickHouse/pull/4093) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 改进的编译时间,固定包括。 [\#3898](https://github.com/ClickHouse/ClickHouse/pull/3898) ([proller](https://github.com/proller)) -- 添加了哈希函数的性能测试。 [\#3918](https://github.com/ClickHouse/ClickHouse/pull/3918) ([filimonov](https://github.com/filimonov)) -- 固定循环库依赖。 [\#3958](https://github.com/ClickHouse/ClickHouse/pull/3958) ([proller](https://github.com/proller)) -- 改进的编译与低可用内存。 [\#4030](https://github.com/ClickHouse/ClickHouse/pull/4030) ([proller](https://github.com/proller)) -- 添加了测试脚本,以重现性能下降 `jemalloc`. [\#4036](https://github.com/ClickHouse/ClickHouse/pull/4036) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov)) -- 修正了在下面的注释和字符串文字拼写错误 `dbms`. [\#4122](https://github.com/ClickHouse/ClickHouse/pull/4122) ([maiha](https://github.com/maiha)) -- 修正了错别字的评论。 [\#4089](https://github.com/ClickHouse/ClickHouse/pull/4089) ([Evgenii Pravda](https://github.com/kvinty)) - -## [2018年的更新日志](https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/changelog/2018.md) {#changelog-for-2018} diff --git a/docs/zh/whats_new/roadmap.md b/docs/zh/whats_new/roadmap.md deleted file mode 100644 index 47e09bc3c78..00000000000 --- a/docs/zh/whats_new/roadmap.md +++ /dev/null @@ -1,10 +0,0 @@ - -# 规划 {#gui-hua} - -## Q1 2020 {#q1-2020} - -- 更精确的用户资源池,可以在用户之间合理分配集群资源 -- 细粒度的授权管理 -- 与外部认证服务集成 - -[来源文章](https://clickhouse.tech/docs/en/roadmap/) diff --git a/docs/zh/whats_new/security_changelog.md b/docs/zh/whats_new/security_changelog.md deleted file mode 100644 index 6315398371f..00000000000 --- a/docs/zh/whats_new/security_changelog.md +++ /dev/null @@ -1,42 +0,0 @@ - -## 修复于 ClickHouse Release 18.12.13, 2018-09-10 {#xiu-fu-yu-clickhouse-release-18-12-13-2018-09-10} - -### CVE-2018-14672 {#cve-2018-14672} - -加载CatBoost模型的功能,允许遍历路径并通过错误消息读取任意文件。 - -来源: Yandex信息安全团队的Andrey Krasichkov - -## 修复于 ClickHouse Release 18.10.3, 2018-08-13 {#xiu-fu-yu-clickhouse-release-18-10-3-2018-08-13} - -### CVE-2018-14671 {#cve-2018-14671} - -unixODBC允许从文件系统加载任意共享对象,从而导致«远程执行代码»漏洞。 - -来源:Yandex信息安全团队的Andrey Krasichkov和Evgeny Sidorov - -## 修复于 ClickHouse Release 1.1.54388, 2018-06-28 {#xiu-fu-yu-clickhouse-release-1-1-54388-2018-06-28} - -### CVE-2018-14668 {#cve-2018-14668} - -远程表函数功能允许在 «user», «password» 及 «default\_database» 字段中使用任意符号,从而导致跨协议请求伪造攻击。 - -来源:Yandex信息安全团队的Andrey Krasichkov - -## 修复于 ClickHouse Release 1.1.54390, 2018-07-06 {#xiu-fu-yu-clickhouse-release-1-1-54390-2018-07-06} - -### CVE-2018-14669 {#cve-2018-14669} - -ClickHouse MySQL客户端启用了 «LOAD DATA LOCAL INFILE» 功能,该功能允许恶意MySQL数据库从连接的ClickHouse服务器读取任意文件。 - -来源:Yandex信息安全团队的Andrey Krasichkov和Evgeny Sidorov - -## 修复于 ClickHouse Release 1.1.54131, 2017-01-10 {#xiu-fu-yu-clickhouse-release-1-1-54131-2017-01-10} - -### CVE-2018-14670 {#cve-2018-14670} - -deb软件包中的错误配置可能导致使用未经授权的数据库。 - -来源:英国国家网络安全中心(NCSC) - -[来源文章](https://clickhouse.tech/docs/en/security_changelog/) diff --git a/programs/client/Client.cpp b/programs/client/Client.cpp index 64d80eeaee9..0c18301df0c 100644 --- a/programs/client/Client.cpp +++ b/programs/client/Client.cpp @@ -620,13 +620,21 @@ private: << " revision " << server_revision << "." << std::endl << std::endl; - if (std::make_tuple(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) - < std::make_tuple(server_version_major, server_version_minor, server_version_patch)) + auto client_version_tuple = std::make_tuple(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); + auto server_version_tuple = std::make_tuple(server_version_major, server_version_minor, server_version_patch); + + if (client_version_tuple < server_version_tuple) { std::cout << "ClickHouse client version is older than ClickHouse server. " << "It may lack support for new features." << std::endl << std::endl; } + else if (client_version_tuple > server_version_tuple) + { + std::cout << "ClickHouse server version is older than ClickHouse client. " + << "It may indicate that the server is out of date and can be upgraded." + << std::endl << std::endl; + } } } @@ -813,7 +821,7 @@ private: insert->tryFindInputFunction(input_function); /// INSERT query for which data transfer is needed (not an INSERT SELECT or input()) is processed separately. - if (insert && (!insert->select || input_function)) + if (insert && (!insert->select || input_function) && !insert->watch) { if (input_function && insert->format.empty()) throw Exception("FORMAT must be specified for function input()", ErrorCodes::INVALID_USAGE_OF_INPUT); diff --git a/programs/server/CMakeLists.txt b/programs/server/CMakeLists.txt index f6e9d1ff702..a252310cc93 100644 --- a/programs/server/CMakeLists.txt +++ b/programs/server/CMakeLists.txt @@ -4,14 +4,13 @@ set(CLICKHOUSE_SERVER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/InterserverIOHTTPHandler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MetricsTransmitter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/NotFoundHandler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/PingRequestHandler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/PrometheusMetricsWriter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/PrometheusRequestHandler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ReplicasStatusHandler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/RootRequestHandler.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/StaticRequestHandler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Server.cpp ${CMAKE_CURRENT_SOURCE_DIR}/TCPHandler.cpp - ) +) set(CLICKHOUSE_SERVER_SOURCES ${CLICKHOUSE_SERVER_SOURCES} diff --git a/programs/server/HTTPHandler.cpp b/programs/server/HTTPHandler.cpp index 77236210741..1a579e2bff3 100644 --- a/programs/server/HTTPHandler.cpp +++ b/programs/server/HTTPHandler.cpp @@ -1,5 +1,8 @@ #include "HTTPHandler.h" +#include "HTTPHandlerFactory.h" +#include "HTTPHandlerRequestFilter.h" + #include #include #include @@ -7,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +36,7 @@ #include #include #include +#include #include #include @@ -54,6 +59,7 @@ namespace ErrorCodes extern const int CANNOT_PARSE_DATETIME; extern const int CANNOT_PARSE_NUMBER; extern const int CANNOT_OPEN_FILE; + extern const int CANNOT_COMPILE_REGEXP; extern const int UNKNOWN_ELEMENT_IN_AST; extern const int UNKNOWN_TYPE_OF_AST_NODE; @@ -78,6 +84,7 @@ namespace ErrorCodes extern const int UNKNOWN_FORMAT; extern const int UNKNOWN_DATABASE_ENGINE; extern const int UNKNOWN_TYPE_OF_QUERY; + extern const int NO_ELEMENTS_IN_CONFIG; extern const int QUERY_IS_TOO_LARGE; @@ -204,9 +211,9 @@ void HTTPHandler::pushDelayedResults(Output & used_output) } -HTTPHandler::HTTPHandler(IServer & server_) +HTTPHandler::HTTPHandler(IServer & server_, const std::string & name) : server(server_) - , log(&Logger::get("HTTPHandler")) + , log(&Logger::get(name)) { server_display_name = server.config().getString("display_name", getFQDNOrHostName()); } @@ -226,13 +233,6 @@ void HTTPHandler::processQuery( std::istream & istr = request.stream(); - /// Part of the query can be passed in the 'query' parameter and the rest in the request body - /// (http method need not necessarily be POST). In this case the entire query consists of the - /// contents of the 'query' parameter, a line break and the request body. - std::string query_param = params.get("query", ""); - if (!query_param.empty()) - query_param += '\n'; - /// The user and password can be passed by headers (similar to X-Auth-*), /// which is used by load balancers to pass authentication information. std::string user = request.get("X-ClickHouse-User", ""); @@ -390,8 +390,6 @@ void HTTPHandler::processQuery( used_output.out_maybe_delayed_and_compressed = used_output.out_maybe_compressed; } - std::unique_ptr in_param = std::make_unique(query_param); - std::unique_ptr in_post_raw = std::make_unique(istr); /// Request body can be compressed using algorithm specified in the Content-Encoding header. @@ -413,7 +411,7 @@ void HTTPHandler::processQuery( std::unique_ptr in; - static const NameSet reserved_param_names{"query", "compress", "decompress", "user", "password", "quota_key", "query_id", "stacktrace", + static const NameSet reserved_param_names{"compress", "decompress", "user", "password", "quota_key", "query_id", "stacktrace", "buffer_size", "wait_end_of_query", "session_id", "session_timeout", "session_check"}; Names reserved_param_suffixes; @@ -478,16 +476,11 @@ void HTTPHandler::processQuery( else if (param_could_be_skipped(key)) { } - else if (startsWith(key, "param_")) - { - /// Save name and values of substitution in dictionary. - const String parameter_name = key.substr(strlen("param_")); - context.setQueryParameter(parameter_name, value); - } else { - /// All other query parameters are treated as settings. - settings_changes.push_back({key, value}); + /// Other than query parameters are treated as settings. + if (!customizeQueryParam(context, key, value)) + settings_changes.push_back({key, value}); } } @@ -495,25 +488,9 @@ void HTTPHandler::processQuery( context.checkSettingsConstraints(settings_changes); context.applySettingsChanges(settings_changes); - /// Used in case of POST request with form-data, but it isn't expected to be deleted after that scope. - std::string full_query; - - /// Support for "external data for query processing". - if (has_external_data) - { - ExternalTablesHandler handler(context, params); - params.load(request, istr, handler); - - /// Params are of both form params POST and uri (GET params) - for (const auto & it : params) - if (it.first == "query") - full_query += it.second; - - in = std::make_unique(full_query); - } - else - in = std::make_unique(*in_param, *in_post_maybe_compressed); - + const auto & query = getQuery(request, params, context); + std::unique_ptr in_param = std::make_unique(query); + in = has_external_data ? std::move(in_param) : std::make_unique(*in_param, *in_post_maybe_compressed); /// HTTP response compression is turned on only if the client signalled that they support it /// (using Accept-Encoding header) and 'enable_http_compression' setting is turned on. @@ -593,7 +570,7 @@ void HTTPHandler::processQuery( }); } - customizeContext(context); + customizeContext(request, context); executeQuery(*in, *used_output.out_maybe_delayed_and_compressed, /* allow_into_outfile = */ false, context, [&response] (const String & current_query_id, const String & content_type, const String & format, const String & timezone) @@ -731,5 +708,191 @@ void HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Ne } } +DynamicQueryHandler::DynamicQueryHandler(IServer & server_, const std::string & param_name_) + : HTTPHandler(server_, "DynamicQueryHandler"), param_name(param_name_) +{ +} + +bool DynamicQueryHandler::customizeQueryParam(Context & context, const std::string & key, const std::string & value) +{ + if (key == param_name) + return true; /// do nothing + + if (startsWith(key, "param_")) + { + /// Save name and values of substitution in dictionary. + const String parameter_name = key.substr(strlen("param_")); + context.setQueryParameter(parameter_name, value); + return true; + } + + return false; +} + +std::string DynamicQueryHandler::getQuery(Poco::Net::HTTPServerRequest & request, HTMLForm & params, Context & context) +{ + + if (likely(!startsWith(request.getContentType(), "multipart/form-data"))) + { + /// Part of the query can be passed in the 'query' parameter and the rest in the request body + /// (http method need not necessarily be POST). In this case the entire query consists of the + /// contents of the 'query' parameter, a line break and the request body. + std::string query_param = params.get(param_name, ""); + return query_param.empty() ? query_param : query_param + "\n"; + } + + /// Support for "external data for query processing". + /// Used in case of POST request with form-data, but it isn't expected to be deleted after that scope. + ExternalTablesHandler handler(context, params); + params.load(request, request.stream(), handler); + + std::string full_query; + /// Params are of both form params POST and uri (GET params) + for (const auto & it : params) + if (it.first == param_name) + full_query += it.second; + + return full_query; +} + +PredefinedQueryHandler::PredefinedQueryHandler( + IServer & server, const NameSet & receive_params_, const std::string & predefined_query_ + , const CompiledRegexPtr & url_regex_, const std::unordered_map & header_name_with_regex_) + : HTTPHandler(server, "PredefinedQueryHandler"), receive_params(receive_params_), predefined_query(predefined_query_) + , url_regex(url_regex_), header_name_with_capture_regex(header_name_with_regex_) +{ +} + +bool PredefinedQueryHandler::customizeQueryParam(Context & context, const std::string & key, const std::string & value) +{ + if (receive_params.count(key)) + { + context.setQueryParameter(key, value); + return true; + } + + return false; +} + +void PredefinedQueryHandler::customizeContext(Poco::Net::HTTPServerRequest & request, DB::Context & context) +{ + /// If in the configuration file, the handler's header is regex and contains named capture group + /// We will extract regex named capture groups as query parameters + + const auto & set_query_params = [&](const char * begin, const char * end, const CompiledRegexPtr & compiled_regex) + { + int num_captures = compiled_regex->NumberOfCapturingGroups() + 1; + + re2::StringPiece matches[num_captures]; + re2::StringPiece input(begin, end - begin); + if (compiled_regex->Match(input, 0, end - begin, re2::RE2::Anchor::ANCHOR_BOTH, matches, num_captures)) + { + for (const auto & [capturing_name, capturing_index] : compiled_regex->NamedCapturingGroups()) + { + const auto & capturing_value = matches[capturing_index]; + + if (capturing_value.data()) + context.setQueryParameter(capturing_name, String(capturing_value.data(), capturing_value.size())); + } + } + }; + + if (url_regex) + { + const auto & uri = request.getURI(); + set_query_params(uri.data(), find_first_symbols<'?'>(uri.data(), uri.data() + uri.size()), url_regex); + } + + for (const auto & [header_name, regex] : header_name_with_capture_regex) + { + const auto & header_value = request.get(header_name); + set_query_params(header_value.data(), header_value.data() + header_value.size(), regex); + } +} + +std::string PredefinedQueryHandler::getQuery(Poco::Net::HTTPServerRequest & request, HTMLForm & params, Context & context) +{ + if (unlikely(startsWith(request.getContentType(), "multipart/form-data"))) + { + /// Support for "external data for query processing". + ExternalTablesHandler handler(context, params); + params.load(request, request.stream(), handler); + } + + return predefined_query; +} + +Poco::Net::HTTPRequestHandlerFactory * createDynamicHandlerFactory(IServer & server, const std::string & config_prefix) +{ + std::string query_param_name = server.config().getString(config_prefix + ".handler.query_param_name", "query"); + return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory(server, std::move(query_param_name)), server.config(), config_prefix); +} + +static inline bool capturingNamedQueryParam(NameSet receive_params, const CompiledRegexPtr & compiled_regex) +{ + const auto & capturing_names = compiled_regex->NamedCapturingGroups(); + return std::count_if(capturing_names.begin(), capturing_names.end(), [&](const auto & iterator) + { + return std::count_if(receive_params.begin(), receive_params.end(), + [&](const auto & param_name) { return param_name == iterator.first; }); + }); +} + +static inline CompiledRegexPtr getCompiledRegex(const std::string & expression) +{ + auto compiled_regex = std::make_shared(expression); + + if (!compiled_regex->ok()) + throw Exception("Cannot compile re2: " + expression + " for http handling rule, error: " + + compiled_regex->error() + ". Look at https://github.com/google/re2/wiki/Syntax for reference.", ErrorCodes::CANNOT_COMPILE_REGEXP); + + return compiled_regex; +} + +Poco::Net::HTTPRequestHandlerFactory * createPredefinedHandlerFactory(IServer & server, const std::string & config_prefix) +{ + Poco::Util::AbstractConfiguration & configuration = server.config(); + + if (!configuration.has(config_prefix + ".handler.query")) + throw Exception("There is no path '" + config_prefix + ".handler.query" + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG); + + std::string predefined_query = configuration.getString(config_prefix + ".handler.query"); + NameSet analyze_receive_params = analyzeReceiveQueryParams(predefined_query); + + std::unordered_map headers_name_with_regex; + Poco::Util::AbstractConfiguration::Keys headers_name; + configuration.keys(config_prefix + ".headers", headers_name); + + for (const auto & header_name : headers_name) + { + auto expression = configuration.getString(config_prefix + ".headers." + header_name); + + if (!startsWith(expression, "regex:")) + continue; + + expression = expression.substr(6); + auto regex = getCompiledRegex(expression); + if (capturingNamedQueryParam(analyze_receive_params, regex)) + headers_name_with_regex.emplace(std::make_pair(header_name, regex)); + } + + if (configuration.has(config_prefix + ".url")) + { + auto url_expression = configuration.getString(config_prefix + ".url"); + + if (startsWith(url_expression, "regex:")) + url_expression = url_expression.substr(6); + + auto regex = getCompiledRegex(url_expression); + if (capturingNamedQueryParam(analyze_receive_params, regex)) + return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory( + server, std::move(analyze_receive_params), std::move(predefined_query), std::move(regex), + std::move(headers_name_with_regex)), configuration, config_prefix); + } + + return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory( + server, std::move(analyze_receive_params), std::move(predefined_query), CompiledRegexPtr{} ,std::move(headers_name_with_regex)), + configuration, config_prefix); +} } diff --git a/programs/server/HTTPHandler.h b/programs/server/HTTPHandler.h index 681a3cce932..9af5344f70b 100644 --- a/programs/server/HTTPHandler.h +++ b/programs/server/HTTPHandler.h @@ -7,6 +7,7 @@ #include #include +#include namespace CurrentMetrics { @@ -20,16 +21,21 @@ namespace DB class WriteBufferFromHTTPServerResponse; +typedef std::shared_ptr CompiledRegexPtr; class HTTPHandler : public Poco::Net::HTTPRequestHandler { public: - explicit HTTPHandler(IServer & server_); + explicit HTTPHandler(IServer & server_, const std::string & name); void handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) override; /// This method is called right before the query execution. - virtual void customizeContext(DB::Context& /* context */) {} + virtual void customizeContext(Poco::Net::HTTPServerRequest & /*request*/, Context & /* context */) {} + + virtual bool customizeQueryParam(Context & context, const std::string & key, const std::string & value) = 0; + + virtual std::string getQuery(Poco::Net::HTTPServerRequest & request, HTMLForm & params, Context & context) = 0; private: struct Output @@ -80,4 +86,35 @@ private: static void pushDelayedResults(Output & used_output); }; +class DynamicQueryHandler : public HTTPHandler +{ +private: + std::string param_name; +public: + explicit DynamicQueryHandler(IServer & server_, const std::string & param_name_ = "query"); + + std::string getQuery(Poco::Net::HTTPServerRequest & request, HTMLForm & params, Context & context) override; + + bool customizeQueryParam(Context &context, const std::string &key, const std::string &value) override; +}; + +class PredefinedQueryHandler : public HTTPHandler +{ +private: + NameSet receive_params; + std::string predefined_query; + CompiledRegexPtr url_regex; + std::unordered_map header_name_with_capture_regex; +public: + explicit PredefinedQueryHandler( + IServer & server, const NameSet & receive_params_, const std::string & predefined_query_ + , const CompiledRegexPtr & url_regex_, const std::unordered_map & header_name_with_regex_); + + virtual void customizeContext(Poco::Net::HTTPServerRequest & request, Context & context) override; + + std::string getQuery(Poco::Net::HTTPServerRequest & request, HTMLForm & params, Context & context) override; + + bool customizeQueryParam(Context & context, const std::string & key, const std::string & value) override; +}; + } diff --git a/programs/server/HTTPHandlerFactory.cpp b/programs/server/HTTPHandlerFactory.cpp index 7a1bcaf4fc6..91cf9ddf25b 100644 --- a/programs/server/HTTPHandlerFactory.cpp +++ b/programs/server/HTTPHandlerFactory.cpp @@ -1,29 +1,44 @@ #include "HTTPHandlerFactory.h" +#include +#include +#include +#include + +#include "HTTPHandler.h" +#include "NotFoundHandler.h" +#include "StaticRequestHandler.h" +#include "ReplicasStatusHandler.h" +#include "InterserverIOHTTPHandler.h" +#include "PrometheusRequestHandler.h" + namespace DB { -HTTPRequestHandlerFactoryMain::HTTPRequestHandlerFactoryMain(IServer & server_, const std::string & name_) - : server(server_), log(&Logger::get(name_)), name(name_) +namespace ErrorCodes +{ + extern const int LOGICAL_ERROR; + extern const int UNKNOWN_ELEMENT_IN_CONFIG; + extern const int INVALID_CONFIG_PARAMETER; +} + +HTTPRequestHandlerFactoryMain::HTTPRequestHandlerFactoryMain(const std::string & name_) + : log(&Logger::get(name_)), name(name_) { } -Poco::Net::HTTPRequestHandler * HTTPRequestHandlerFactoryMain::createRequestHandler( - const Poco::Net::HTTPServerRequest & request) // override +Poco::Net::HTTPRequestHandler * HTTPRequestHandlerFactoryMain::createRequestHandler(const Poco::Net::HTTPServerRequest & request) // override { LOG_TRACE(log, "HTTP Request for " << name << ". " - << "Method: " - << request.getMethod() - << ", Address: " - << request.clientAddress().toString() - << ", User-Agent: " - << (request.has("User-Agent") ? request.get("User-Agent") : "none") + << "Method: " << request.getMethod() + << ", Address: " << request.clientAddress().toString() + << ", User-Agent: " << (request.has("User-Agent") ? request.get("User-Agent") : "none") << (request.hasContentLength() ? (", Length: " + std::to_string(request.getContentLength())) : ("")) << ", Content Type: " << request.getContentType() << ", Transfer Encoding: " << request.getTransferEncoding()); - for (auto & handler_factory : child_handler_factories) + for (auto & handler_factory : child_factories) { auto handler = handler_factory->createRequestHandler(request); if (handler != nullptr) @@ -40,4 +55,111 @@ Poco::Net::HTTPRequestHandler * HTTPRequestHandlerFactoryMain::createRequestHand return nullptr; } +HTTPRequestHandlerFactoryMain::~HTTPRequestHandlerFactoryMain() +{ + while (!child_factories.empty()) + { + delete child_factories.back(); + child_factories.pop_back(); + } +} + +HTTPRequestHandlerFactoryMain::TThis * HTTPRequestHandlerFactoryMain::addHandler(Poco::Net::HTTPRequestHandlerFactory * child_factory) +{ + child_factories.emplace_back(child_factory); + return this; +} + +static inline auto createHandlersFactoryFromConfig(IServer & server, const std::string & name, const String & prefix) +{ + auto main_handler_factory = new HTTPRequestHandlerFactoryMain(name); + + try + { + Poco::Util::AbstractConfiguration::Keys keys; + server.config().keys(prefix, keys); + + for (const auto & key : keys) + { + if (!startsWith(key, "rule")) + throw Exception("Unknown element in config: " + prefix + "." + key + ", must be 'rule'", ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG); + + const auto & handler_type = server.config().getString(prefix + "." + key + ".handler.type", ""); + + if (handler_type == "static") + main_handler_factory->addHandler(createStaticHandlerFactory(server, prefix + "." + key)); + else if (handler_type == "dynamic_query_handler") + main_handler_factory->addHandler(createDynamicHandlerFactory(server, prefix + "." + key)); + else if (handler_type == "predefined_query_handler") + main_handler_factory->addHandler(createPredefinedHandlerFactory(server, prefix + "." + key)); + else if (handler_type.empty()) + throw Exception("Handler type in config is not specified here: " + + prefix + "." + key + ".handler.type", ErrorCodes::INVALID_CONFIG_PARAMETER); + else + throw Exception("Unknown handler type '" + handler_type +"' in config here: " + + prefix + "." + key + ".handler.type",ErrorCodes::INVALID_CONFIG_PARAMETER); + } + + return main_handler_factory; + } + catch (...) + { + delete main_handler_factory; + throw; + } +} + +static const auto ping_response_expression = "Ok.\n"; +static const auto root_response_expression = "config://http_server_default_response"; + +static inline Poco::Net::HTTPRequestHandlerFactory * createHTTPHandlerFactory(IServer & server, const std::string & name, AsynchronousMetrics & async_metrics) +{ + if (server.config().has("http_handlers")) + return createHandlersFactoryFromConfig(server, name, "http_handlers"); + else + { + auto factory = (new HTTPRequestHandlerFactoryMain(name)) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server, root_response_expression)) + ->attachStrictPath("/")->allowGetAndHeadRequest()) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server, ping_response_expression)) + ->attachStrictPath("/ping")->allowGetAndHeadRequest()) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server)) + ->attachNonStrictPath("/replicas_status")->allowGetAndHeadRequest()) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server, "query"))->allowPostAndGetParamsRequest()); + + if (server.config().has("prometheus") && server.config().getInt("prometheus.port", 0) == 0) + factory->addHandler((new HandlingRuleHTTPHandlerFactory( + server, PrometheusMetricsWriter(server.config(), "prometheus", async_metrics))) + ->attachStrictPath(server.config().getString("prometheus.endpoint", "/metrics"))->allowGetAndHeadRequest()); + + return factory; + } +} + +static inline Poco::Net::HTTPRequestHandlerFactory * createInterserverHTTPHandlerFactory(IServer & server, const std::string & name) +{ + return (new HTTPRequestHandlerFactoryMain(name)) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server, root_response_expression)) + ->attachStrictPath("/")->allowGetAndHeadRequest()) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server, ping_response_expression)) + ->attachStrictPath("/ping")->allowGetAndHeadRequest()) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server)) + ->attachNonStrictPath("/replicas_status")->allowGetAndHeadRequest()) + ->addHandler((new HandlingRuleHTTPHandlerFactory(server))->allowPostAndGetParamsRequest()); +} + +Poco::Net::HTTPRequestHandlerFactory * createHandlerFactory(IServer & server, AsynchronousMetrics & async_metrics, const std::string & name) +{ + if (name == "HTTPHandler-factory" || name == "HTTPSHandler-factory") + return createHTTPHandlerFactory(server, name, async_metrics); + else if (name == "InterserverIOHTTPHandler-factory" || name == "InterserverIOHTTPSHandler-factory") + return createInterserverHTTPHandlerFactory(server, name); + else if (name == "PrometheusHandler-factory") + return (new HTTPRequestHandlerFactoryMain(name))->addHandler((new HandlingRuleHTTPHandlerFactory( + server, PrometheusMetricsWriter(server.config(), "prometheus", async_metrics))) + ->attachStrictPath(server.config().getString("prometheus.endpoint", "/metrics"))->allowGetAndHeadRequest()); + + throw Exception("LOGICAL ERROR: Unknown HTTP handler factory name.", ErrorCodes::LOGICAL_ERROR); +} + } diff --git a/programs/server/HTTPHandlerFactory.h b/programs/server/HTTPHandlerFactory.h index fcd7fb5d4a2..cf061e5b626 100644 --- a/programs/server/HTTPHandlerFactory.h +++ b/programs/server/HTTPHandlerFactory.h @@ -1,127 +1,114 @@ #pragma once -#include +#include "IServer.h" +#include +#include +#include #include #include -#include -#include "IServer.h" -#include "HTTPHandler.h" -#include "InterserverIOHTTPHandler.h" -#include "NotFoundHandler.h" -#include "PingRequestHandler.h" -#include "PrometheusRequestHandler.h" -#include "ReplicasStatusHandler.h" -#include "RootRequestHandler.h" - +#include +#include namespace DB { /// Handle request using child handlers -class HTTPRequestHandlerFactoryMain : public Poco::Net::HTTPRequestHandlerFactory +class HTTPRequestHandlerFactoryMain : public Poco::Net::HTTPRequestHandlerFactory, boost::noncopyable { private: using TThis = HTTPRequestHandlerFactoryMain; - IServer & server; Logger * log; std::string name; - std::vector> child_handler_factories; - + std::vector child_factories; public: - HTTPRequestHandlerFactoryMain(IServer & server_, const std::string & name_); + + ~HTTPRequestHandlerFactoryMain(); + + HTTPRequestHandlerFactoryMain(const std::string & name_); + + TThis * addHandler(Poco::Net::HTTPRequestHandlerFactory * child_factory); Poco::Net::HTTPRequestHandler * createRequestHandler(const Poco::Net::HTTPServerRequest & request) override; +}; - template - TThis * addHandler(TArgs &&... args) +template +class HandlingRuleHTTPHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory +{ +public: + using TThis = HandlingRuleHTTPHandlerFactory; + using Filter = std::function; + + template + HandlingRuleHTTPHandlerFactory(TArgs &&... args) { - child_handler_factories.emplace_back(std::make_unique(server, std::forward(args)...)); + creator = [args = std::tuple(std::forward(args) ...)]() + { + return std::apply([&](auto && ... endpoint_args) + { + return new TEndpoint(std::forward(endpoint_args)...); + }, std::move(args)); + }; + } + + TThis * addFilter(Filter cur_filter) + { + Filter prev_filter = filter; + filter = [prev_filter, cur_filter](const auto & request) + { + return prev_filter ? prev_filter(request) && cur_filter(request) : cur_filter(request); + }; + return this; } -}; + TThis * attachStrictPath(const String & strict_path) + { + return addFilter([strict_path](const auto & request) { return request.getURI() == strict_path; }); + } -/// Handle POST or GET with params -template -class HTTPQueryRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory -{ -private: - IServer & server; + TThis * attachNonStrictPath(const String & non_strict_path) + { + return addFilter([non_strict_path](const auto & request) { return startsWith(request.getURI(), non_strict_path); }); + } -public: - HTTPQueryRequestHandlerFactory(IServer & server_) : server(server_) {} + /// Handle GET or HEAD endpoint on specified path + TThis * allowGetAndHeadRequest() + { + return addFilter([](const auto & request) + { + return request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET + || request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD; + }); + } + + /// Handle POST or GET with params + TThis * allowPostAndGetParamsRequest() + { + return addFilter([](const auto & request) + { + return request.getURI().find('?') != std::string::npos + || request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST; + }); + } Poco::Net::HTTPRequestHandler * createRequestHandler(const Poco::Net::HTTPServerRequest & request) override { - if (request.getURI().find('?') != std::string::npos || request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST) - return new HandleType(server); - return nullptr; + return filter(request) ? creator() : nullptr; } -}; - -/// Handle GET or HEAD endpoint on specified path -template -class HTTPGetRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory -{ private: - IServer & server; -public: - HTTPGetRequestHandlerFactory(IServer & server_) : server(server_) {} - - Poco::Net::HTTPRequestHandler * createRequestHandler(const Poco::Net::HTTPServerRequest & request) override - { - auto & method = request.getMethod(); - if (!(method == Poco::Net::HTTPRequest::HTTP_GET || method == Poco::Net::HTTPRequest::HTTP_HEAD)) - return nullptr; - - auto & uri = request.getURI(); - bool uri_match = TGetEndpoint::strict_path ? uri == TGetEndpoint::path : startsWith(uri, TGetEndpoint::path); - if (uri_match) - return new typename TGetEndpoint::HandleType(server); - - return nullptr; - } + Filter filter; + std::function creator; }; +Poco::Net::HTTPRequestHandlerFactory * createStaticHandlerFactory(IServer & server, const std::string & config_prefix); -struct RootEndpoint -{ - static constexpr auto path = "/"; - static constexpr auto strict_path = true; - using HandleType = RootRequestHandler; -}; +Poco::Net::HTTPRequestHandlerFactory * createDynamicHandlerFactory(IServer & server, const std::string & config_prefix); -struct PingEndpoint -{ - static constexpr auto path = "/ping"; - static constexpr auto strict_path = true; - using HandleType = PingRequestHandler; -}; - -struct ReplicasStatusEndpoint -{ - static constexpr auto path = "/replicas_status"; - static constexpr auto strict_path = false; - using HandleType = ReplicasStatusHandler; -}; - -using HTTPRootRequestHandlerFactory = HTTPGetRequestHandlerFactory; -using HTTPPingRequestHandlerFactory = HTTPGetRequestHandlerFactory; -using HTTPReplicasStatusRequestHandlerFactory = HTTPGetRequestHandlerFactory; - -template -HTTPRequestHandlerFactoryMain * createDefaultHandlerFatory(IServer & server, const std::string & name) -{ - auto handlerFactory = new HTTPRequestHandlerFactoryMain(server, name); - handlerFactory->addHandler() - ->addHandler() - ->addHandler() - ->addHandler>(); - return handlerFactory; -} +Poco::Net::HTTPRequestHandlerFactory * createPredefinedHandlerFactory(IServer & server, const std::string & config_prefix); +Poco::Net::HTTPRequestHandlerFactory * createHandlerFactory(IServer & server, AsynchronousMetrics & async_metrics, const std::string & name); } diff --git a/programs/server/HTTPHandlerRequestFilter.h b/programs/server/HTTPHandlerRequestFilter.h new file mode 100644 index 00000000000..b0b748506e5 --- /dev/null +++ b/programs/server/HTTPHandlerRequestFilter.h @@ -0,0 +1,127 @@ +#pragma once + +#include "HTTPHandlerFactory.h" + +#include +#include +#include +#include + +#include + + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int CANNOT_COMPILE_REGEXP; + extern const int UNKNOWN_ELEMENT_IN_CONFIG; +} + + +typedef std::shared_ptr CompiledRegexPtr; + +static inline bool checkRegexExpression(const StringRef & match_str, const CompiledRegexPtr & compiled_regex) +{ + int num_captures = compiled_regex->NumberOfCapturingGroups() + 1; + + re2::StringPiece matches[num_captures]; + re2::StringPiece match_input(match_str.data, match_str.size); + return compiled_regex->Match(match_input, 0, match_str.size, re2::RE2::Anchor::ANCHOR_BOTH, matches, num_captures); +} + +static inline bool checkExpression(const StringRef & match_str, const std::pair & expression) +{ + if (expression.second) + return checkRegexExpression(match_str, expression.second); + + return match_str == expression.first; +} + +static inline auto methodsFilter(Poco::Util::AbstractConfiguration & config, const std::string & config_path) +{ + std::vector methods; + Poco::StringTokenizer tokenizer(config.getString(config_path), ","); + + for (auto iterator = tokenizer.begin(); iterator != tokenizer.end(); ++iterator) + methods.emplace_back(Poco::toUpper(Poco::trim(*iterator))); + + return [methods](const Poco::Net::HTTPServerRequest & request) { return std::count(methods.begin(), methods.end(), request.getMethod()); }; +} + +static inline auto getExpression(const std::string & expression) +{ + if (!startsWith(expression, "regex:")) + return std::make_pair(expression, CompiledRegexPtr{}); + + auto compiled_regex = std::make_shared(expression.substr(6)); + + if (!compiled_regex->ok()) + throw Exception("cannot compile re2: " + expression + " for http handling rule, error: " + compiled_regex->error() + + ". Look at https://github.com/google/re2/wiki/Syntax for reference.", ErrorCodes::CANNOT_COMPILE_REGEXP); + return std::make_pair(expression, compiled_regex); +} + +static inline auto urlFilter(Poco::Util::AbstractConfiguration & config, const std::string & config_path) +{ + return [expression = getExpression(config.getString(config_path))](const Poco::Net::HTTPServerRequest & request) + { + const auto & uri = request.getURI(); + const auto & end = find_first_symbols<'?'>(uri.data(), uri.data() + uri.size()); + + return checkExpression(StringRef(uri.data(), end - uri.data()), expression); + }; +} + +static inline auto headersFilter(Poco::Util::AbstractConfiguration & config, const std::string & prefix) +{ + std::unordered_map> headers_expression; + Poco::Util::AbstractConfiguration::Keys headers_name; + config.keys(prefix, headers_name); + + for (const auto & header_name : headers_name) + { + const auto & expression = getExpression(config.getString(prefix + "." + header_name)); + checkExpression("", expression); /// Check expression syntax is correct + headers_expression.emplace(std::make_pair(header_name, expression)); + } + + return [headers_expression](const Poco::Net::HTTPServerRequest & request) + { + for (const auto & [header_name, header_expression] : headers_expression) + { + const auto & header_value = request.get(header_name, ""); + if (!checkExpression(StringRef(header_value.data(), header_value.size()), header_expression)) + return false; + } + + return true; + }; +} + +template +static inline Poco::Net::HTTPRequestHandlerFactory * addFiltersFromConfig( + HandlingRuleHTTPHandlerFactory * factory, Poco::Util::AbstractConfiguration & config, const std::string & prefix) +{ + Poco::Util::AbstractConfiguration::Keys filters_type; + config.keys(prefix, filters_type); + + for (const auto & filter_type : filters_type) + { + if (filter_type == "handler") + continue; + else if (filter_type == "url") + factory->addFilter(urlFilter(config, prefix + ".url")); + else if (filter_type == "headers") + factory->addFilter(headersFilter(config, prefix + ".headers")); + else if (filter_type == "methods") + factory->addFilter(methodsFilter(config, prefix + ".methods")); + else + throw Exception("Unknown element in config: " + prefix + "." + filter_type, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG); + } + + return factory; +} + +} diff --git a/programs/server/NotFoundHandler.cpp b/programs/server/NotFoundHandler.cpp index 766e8895784..f9b51719b0d 100644 --- a/programs/server/NotFoundHandler.cpp +++ b/programs/server/NotFoundHandler.cpp @@ -34,4 +34,4 @@ void NotFoundHandler::handleRequest( } } -} +} \ No newline at end of file diff --git a/programs/server/NotFoundHandler.h b/programs/server/NotFoundHandler.h index 7f758e49d0d..0f76fe9c46e 100644 --- a/programs/server/NotFoundHandler.h +++ b/programs/server/NotFoundHandler.h @@ -15,4 +15,4 @@ public: Poco::Net::HTTPServerResponse & response) override; }; -} +} \ No newline at end of file diff --git a/programs/server/PingRequestHandler.cpp b/programs/server/PingRequestHandler.cpp deleted file mode 100644 index 141161ef45c..00000000000 --- a/programs/server/PingRequestHandler.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "PingRequestHandler.h" - -#include - -#include - -#include -#include - -namespace DB -{ - -void PingRequestHandler::handleRequest( - Poco::Net::HTTPServerRequest &, - Poco::Net::HTTPServerResponse & response) -{ - try - { - const auto & config = server.config(); - setResponseDefaultHeaders(response, config.getUInt("keep_alive_timeout", 10)); - - const char * data = "Ok.\n"; - response.sendBuffer(data, strlen(data)); - } - catch (...) - { - tryLogCurrentException("PingRequestHandler"); - } -} - -} diff --git a/programs/server/PingRequestHandler.h b/programs/server/PingRequestHandler.h deleted file mode 100644 index 3728fb40adb..00000000000 --- a/programs/server/PingRequestHandler.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "IServer.h" - -#include - - -namespace DB -{ - -/// Response with "Ok.\n". Used for availability checks. -class PingRequestHandler : public Poco::Net::HTTPRequestHandler -{ -private: - IServer & server; - -public: - explicit PingRequestHandler(IServer & server_) : server(server_) - { - } - - void handleRequest( - Poco::Net::HTTPServerRequest & request, - Poco::Net::HTTPServerResponse & response) override; -}; - -} diff --git a/programs/server/PrometheusRequestHandler.h b/programs/server/PrometheusRequestHandler.h index d3d1dee88b1..47c8adf4774 100644 --- a/programs/server/PrometheusRequestHandler.h +++ b/programs/server/PrometheusRequestHandler.h @@ -18,7 +18,7 @@ private: const PrometheusMetricsWriter & metrics_writer; public: - explicit PrometheusRequestHandler(IServer & server_, PrometheusMetricsWriter & metrics_writer_) + explicit PrometheusRequestHandler(IServer & server_, const PrometheusMetricsWriter & metrics_writer_) : server(server_) , metrics_writer(metrics_writer_) { @@ -29,33 +29,4 @@ public: Poco::Net::HTTPServerResponse & response) override; }; - -template -class PrometheusRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory -{ -private: - IServer & server; - std::string endpoint_path; - PrometheusMetricsWriter metrics_writer; - -public: - PrometheusRequestHandlerFactory(IServer & server_, const AsynchronousMetrics & async_metrics_) - : server(server_) - , endpoint_path(server_.config().getString("prometheus.endpoint", "/metrics")) - , metrics_writer(server_.config(), "prometheus", async_metrics_) - { - } - - Poco::Net::HTTPRequestHandler * createRequestHandler(const Poco::Net::HTTPServerRequest & request) override - { - if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET - && request.getURI() == endpoint_path) - return new HandlerType(server, metrics_writer); - - return nullptr; - } -}; - -using PrometheusHandlerFactory = PrometheusRequestHandlerFactory; - } diff --git a/programs/server/ReplicasStatusHandler.h b/programs/server/ReplicasStatusHandler.h index 479b013cfe8..a32f1ba905f 100644 --- a/programs/server/ReplicasStatusHandler.h +++ b/programs/server/ReplicasStatusHandler.h @@ -17,7 +17,7 @@ private: Context & context; public: - explicit ReplicasStatusHandler(IServer & server); + explicit ReplicasStatusHandler(IServer & server_); void handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) override; }; diff --git a/programs/server/RootRequestHandler.cpp b/programs/server/RootRequestHandler.cpp deleted file mode 100644 index 86b57b63208..00000000000 --- a/programs/server/RootRequestHandler.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "RootRequestHandler.h" - -#include - -#include - -#include -#include - -namespace DB -{ - -void RootRequestHandler::handleRequest( - Poco::Net::HTTPServerRequest &, - Poco::Net::HTTPServerResponse & response) -{ - try - { - const auto & config = server.config(); - setResponseDefaultHeaders(response, config.getUInt("keep_alive_timeout", 10)); - - response.setContentType("text/html; charset=UTF-8"); - - const std::string data = config.getString("http_server_default_response", "Ok.\n"); - response.sendBuffer(data.data(), data.size()); - } - catch (...) - { - tryLogCurrentException("RootRequestHandler"); - } -} - -} diff --git a/programs/server/RootRequestHandler.h b/programs/server/RootRequestHandler.h deleted file mode 100644 index 1b6d53eeeda..00000000000 --- a/programs/server/RootRequestHandler.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "IServer.h" - -#include - - -namespace DB -{ - -/// Response with custom string. Can be used for browser. -class RootRequestHandler : public Poco::Net::HTTPRequestHandler -{ -private: - IServer & server; - -public: - explicit RootRequestHandler(IServer & server_) : server(server_) - { - } - - void handleRequest( - Poco::Net::HTTPServerRequest & request, - Poco::Net::HTTPServerResponse & response) override; -}; - -} diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index 144ddc391de..bc63b8c7a4d 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -674,11 +674,13 @@ int Server::main(const std::vector & /*args*/) } #if defined(OS_LINUX) - if (!TaskStatsInfoGetter::checkPermissions()) + if (!TasksStatsCounters::checkIfAvailable()) { - LOG_INFO(log, "It looks like the process has no CAP_NET_ADMIN capability, 'taskstats' performance statistics will be disabled." + LOG_INFO(log, "It looks like this system does not have procfs mounted at /proc location," + " neither clickhouse-server process has CAP_NET_ADMIN capability." + " 'taskstats' performance statistics will be disabled." " It could happen due to incorrect ClickHouse package installation." - " You could resolve the problem manually with 'sudo setcap cap_net_admin=+ep " << executable_path << "'." + " You can try to resolve the problem manually with 'sudo setcap cap_net_admin=+ep " << executable_path << "'." " Note that it will not work on 'nosuid' mounted filesystems." " It also doesn't work if you run clickhouse-server inside network namespace as it happens in some containers."); } @@ -806,15 +808,9 @@ int Server::main(const std::vector & /*args*/) auto address = socket_bind_listen(socket, listen_host, port); socket.setReceiveTimeout(settings.http_receive_timeout); socket.setSendTimeout(settings.http_send_timeout); - auto handler_factory = createDefaultHandlerFatory(*this, "HTTPHandler-factory"); - if (config().has("prometheus") && config().getInt("prometheus.port", 0) == 0) - handler_factory->addHandler(async_metrics); servers.emplace_back(std::make_unique( - handler_factory, - server_pool, - socket, - http_params)); + createHandlerFactory(*this, async_metrics, "HTTPHandler-factory"), server_pool, socket, http_params)); LOG_INFO(log, "Listening for http://" + address.toString()); }); @@ -828,10 +824,7 @@ int Server::main(const std::vector & /*args*/) socket.setReceiveTimeout(settings.http_receive_timeout); socket.setSendTimeout(settings.http_send_timeout); servers.emplace_back(std::make_unique( - createDefaultHandlerFatory(*this, "HTTPSHandler-factory"), - server_pool, - socket, - http_params)); + createHandlerFactory(*this, async_metrics, "HTTPSHandler-factory"), server_pool, socket, http_params)); LOG_INFO(log, "Listening for https://" + address.toString()); #else @@ -886,10 +879,7 @@ int Server::main(const std::vector & /*args*/) socket.setReceiveTimeout(settings.http_receive_timeout); socket.setSendTimeout(settings.http_send_timeout); servers.emplace_back(std::make_unique( - createDefaultHandlerFatory(*this, "InterserverIOHTTPHandler-factory"), - server_pool, - socket, - http_params)); + createHandlerFactory(*this, async_metrics, "InterserverIOHTTPHandler-factory"), server_pool, socket, http_params)); LOG_INFO(log, "Listening for replica communication (interserver): http://" + address.toString()); }); @@ -902,10 +892,7 @@ int Server::main(const std::vector & /*args*/) socket.setReceiveTimeout(settings.http_receive_timeout); socket.setSendTimeout(settings.http_send_timeout); servers.emplace_back(std::make_unique( - createDefaultHandlerFatory(*this, "InterserverIOHTTPHandler-factory"), - server_pool, - socket, - http_params)); + createHandlerFactory(*this, async_metrics, "InterserverIOHTTPSHandler-factory"), server_pool, socket, http_params)); LOG_INFO(log, "Listening for secure replica communication (interserver): https://" + address.toString()); #else @@ -937,13 +924,8 @@ int Server::main(const std::vector & /*args*/) auto address = socket_bind_listen(socket, listen_host, port); socket.setReceiveTimeout(settings.http_receive_timeout); socket.setSendTimeout(settings.http_send_timeout); - auto handler_factory = new HTTPRequestHandlerFactoryMain(*this, "PrometheusHandler-factory"); - handler_factory->addHandler(async_metrics); servers.emplace_back(std::make_unique( - handler_factory, - server_pool, - socket, - http_params)); + createHandlerFactory(*this, async_metrics, "PrometheusHandler-factory"), server_pool, socket, http_params)); LOG_INFO(log, "Listening for Prometheus: http://" + address.toString()); }); diff --git a/programs/server/StaticRequestHandler.cpp b/programs/server/StaticRequestHandler.cpp new file mode 100644 index 00000000000..22f32e6a0e7 --- /dev/null +++ b/programs/server/StaticRequestHandler.cpp @@ -0,0 +1,168 @@ +#include "StaticRequestHandler.h" + +#include "HTTPHandlerFactory.h" +#include "HTTPHandlerRequestFilter.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int INCORRECT_FILE_NAME; + extern const int HTTP_LENGTH_REQUIRED; + extern const int INVALID_CONFIG_PARAMETER; +} + +static inline WriteBufferPtr responseWriteBuffer(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response, unsigned int keep_alive_timeout) +{ + /// The client can pass a HTTP header indicating supported compression method (gzip or deflate). + String http_response_compression_methods = request.get("Accept-Encoding", ""); + CompressionMethod http_response_compression_method = CompressionMethod::None; + + if (!http_response_compression_methods.empty()) + { + /// If client supports brotli - it's preferred. + /// Both gzip and deflate are supported. If the client supports both, gzip is preferred. + /// NOTE parsing of the list of methods is slightly incorrect. + + if (std::string::npos != http_response_compression_methods.find("br")) + http_response_compression_method = CompressionMethod::Brotli; + else if (std::string::npos != http_response_compression_methods.find("gzip")) + http_response_compression_method = CompressionMethod::Gzip; + else if (std::string::npos != http_response_compression_methods.find("deflate")) + http_response_compression_method = CompressionMethod::Zlib; + } + + bool client_supports_http_compression = http_response_compression_method != CompressionMethod::None; + + return std::make_shared( + request, response, keep_alive_timeout, client_supports_http_compression, http_response_compression_method); +} + +static inline void trySendExceptionToClient( + const std::string & s, int exception_code, + Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response , WriteBuffer & out) +{ + try + { + response.set("X-ClickHouse-Exception-Code", toString(exception_code)); + + /// If HTTP method is POST and Keep-Alive is turned on, we should read the whole request body + /// to avoid reading part of the current request body in the next request. + if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST + && response.getKeepAlive() && !request.stream().eof() && exception_code != ErrorCodes::HTTP_LENGTH_REQUIRED) + request.stream().ignore(std::numeric_limits::max()); + + response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); + + if (!response.sent()) + response.send() << s << std::endl; + else + { + if (out.count() != out.offset()) + out.position() = out.buffer().begin(); + + writeString(s, out); + writeChar('\n', out); + + out.next(); + out.finalize(); + } + } + catch (...) + { + tryLogCurrentException("StaticRequestHandler", "Cannot send exception to client"); + } +} + +void StaticRequestHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) +{ + auto keep_alive_timeout = server.config().getUInt("keep_alive_timeout", 10); + const auto & out = responseWriteBuffer(request, response, keep_alive_timeout); + + try + { + response.setContentType(content_type); + + if (request.getVersion() == Poco::Net::HTTPServerRequest::HTTP_1_1) + response.setChunkedTransferEncoding(true); + + /// Workaround. Poco does not detect 411 Length Required case. + if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST && !request.getChunkedTransferEncoding() && !request.hasContentLength()) + throw Exception("The Transfer-Encoding is not chunked and there is no Content-Length header for POST request", ErrorCodes::HTTP_LENGTH_REQUIRED); + + setResponseDefaultHeaders(response, keep_alive_timeout); + response.setStatusAndReason(Poco::Net::HTTPResponse::HTTPStatus(status)); + writeResponse(*out); + } + catch (...) + { + tryLogCurrentException("StaticRequestHandler"); + + int exception_code = getCurrentExceptionCode(); + std::string exception_message = getCurrentExceptionMessage(false, true); + trySendExceptionToClient(exception_message, exception_code, request, response, *out); + } +} + +void StaticRequestHandler::writeResponse(WriteBuffer & out) +{ + static const String file_prefix = "file://"; + static const String config_prefix = "config://"; + + if (startsWith(response_expression, file_prefix)) + { + const auto & user_files_absolute_path = Poco::Path(server.context().getUserFilesPath()).makeAbsolute().makeDirectory().toString(); + const auto & file_name = response_expression.substr(file_prefix.size(), response_expression.size() - file_prefix.size()); + + const auto & file_path = Poco::Path(user_files_absolute_path, file_name).makeAbsolute().toString(); + if (!Poco::File(file_path).exists()) + throw Exception("Invalid file name " + file_path + " for static HTTPHandler. ", ErrorCodes::INCORRECT_FILE_NAME); + + ReadBufferFromFile in(file_path); + copyData(in, out); + } + else if (startsWith(response_expression, config_prefix)) + { + if (response_expression.size() <= config_prefix.size()) + throw Exception( "Static handling rule handler must contain a complete configuration path, for example: config://config_key", + ErrorCodes::INVALID_CONFIG_PARAMETER); + + const auto & config_path = response_expression.substr(config_prefix.size(), response_expression.size() - config_prefix.size()); + writeString(server.config().getRawString(config_path, "Ok.\n"), out); + } + else + writeString(response_expression, out); +} + +StaticRequestHandler::StaticRequestHandler(IServer & server_, const String & expression, int status_, const String & content_type_) + : server(server_), status(status_), content_type(content_type_), response_expression(expression) +{ +} + +Poco::Net::HTTPRequestHandlerFactory * createStaticHandlerFactory(IServer & server, const std::string & config_prefix) +{ + int status = server.config().getInt(config_prefix + ".handler.status", 200); + std::string response_content = server.config().getRawString(config_prefix + ".handler.response_content", "Ok.\n"); + std::string response_content_type = server.config().getString(config_prefix + ".handler.content_type", "text/plain; charset=UTF-8"); + + return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory( + server, std::move(response_content), std::move(status), std::move(response_content_type)), server.config(), config_prefix); +} + +} diff --git a/programs/server/StaticRequestHandler.h b/programs/server/StaticRequestHandler.h new file mode 100644 index 00000000000..bdbc17f5e00 --- /dev/null +++ b/programs/server/StaticRequestHandler.h @@ -0,0 +1,30 @@ +#pragma once + +#include "IServer.h" + +#include +#include + + +namespace DB +{ + +/// Response with custom string. Can be used for browser. +class StaticRequestHandler : public Poco::Net::HTTPRequestHandler +{ +private: + IServer & server; + + int status; + String content_type; + String response_expression; + +public: + StaticRequestHandler(IServer & server, const String & expression, int status_ = 200, const String & content_type_ = "text/html; charset=UTF-8"); + + void writeResponse(WriteBuffer & out); + + void handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) override; +}; + +} diff --git a/programs/server/config.xml b/programs/server/config.xml index 94a2a04e8db..58c6a77395b 100644 --- a/programs/server/config.xml +++ b/programs/server/config.xml @@ -11,7 +11,37 @@ 1000M 10 + + + + + + + 8123 9000 @@ -535,7 +565,6 @@ --> /var/lib/clickhouse/format_schemas/ - + + diff --git a/programs/server/ya.make b/programs/server/ya.make index 7f0a3969fd2..2c74c01c7cb 100644 --- a/programs/server/ya.make +++ b/programs/server/ya.make @@ -18,11 +18,10 @@ SRCS( MySQLHandler.cpp MySQLHandlerFactory.cpp NotFoundHandler.cpp - PingRequestHandler.cpp PrometheusMetricsWriter.cpp PrometheusRequestHandler.cpp ReplicasStatusHandler.cpp - RootRequestHandler.cpp + StaticRequestHandler.cpp Server.cpp TCPHandler.cpp ) diff --git a/release b/release index b5e3f05cd95..ec762b234fb 100755 --- a/release +++ b/release @@ -106,9 +106,8 @@ elif [[ $BUILD_TYPE == 'debug' ]]; then VERSION_POSTFIX+="+debug" fi -CMAKE_FLAGS=" $MALLOC_OPTS -DSANITIZE=$SANITIZER -DENABLE_EMBEDDED_COMPILER=1 $CMAKE_FLAGS" +CMAKE_FLAGS=" $MALLOC_OPTS -DSANITIZE=$SANITIZER $CMAKE_FLAGS" [[ -n "$CMAKE_BUILD_TYPE" ]] && CMAKE_FLAGS=" -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE $CMAKE_FLAGS" -#[[ "$CMAKE_FLAGS" =~ "USE_INTERNAL_LLVM_LIBRARY" ]] || CMAKE_FLAGS=" -DUSE_INTERNAL_LLVM_LIBRARY=1 $CMAKE_FLAGS" export CMAKE_FLAGS export EXTRAPACKAGES diff --git a/src/Access/AllowedClientHosts.cpp b/src/Access/AllowedClientHosts.cpp index 8ef2a868acc..1db7e6d508d 100644 --- a/src/Access/AllowedClientHosts.cpp +++ b/src/Access/AllowedClientHosts.cpp @@ -93,12 +93,17 @@ namespace return false; } + auto & getIsAddressOfHostCache() + { + static SimpleCache cache; + return cache; + } + /// Whether a specified address is one of the addresses of a specified host. bool isAddressOfHost(const IPAddress & address, const String & host) { /// We need to cache DNS requests. - static SimpleCache cache; - return cache(address, host); + return getIsAddressOfHostCache()(address, host); } /// Helper function for isAddressOfLocalhost(). @@ -160,12 +165,17 @@ namespace return host; } + auto & getHostByAddressCache() + { + static SimpleCache cache; + return cache; + } + /// Returns the host name by its address. String getHostByAddress(const IPAddress & address) { /// We need to cache DNS requests. - static SimpleCache cache; - return cache(address); + return getHostByAddressCache()(address); } @@ -366,4 +376,10 @@ bool AllowedClientHosts::contains(const IPAddress & client_address) const return false; } +void AllowedClientHosts::dropDNSCaches() +{ + getIsAddressOfHostCache().drop(); + getHostByAddressCache().drop(); +} + } diff --git a/src/Access/AllowedClientHosts.h b/src/Access/AllowedClientHosts.h index 2baafb2e04a..4f4d54ce1ac 100644 --- a/src/Access/AllowedClientHosts.h +++ b/src/Access/AllowedClientHosts.h @@ -114,6 +114,8 @@ public: friend bool operator ==(const AllowedClientHosts & lhs, const AllowedClientHosts & rhs); friend bool operator !=(const AllowedClientHosts & lhs, const AllowedClientHosts & rhs) { return !(lhs == rhs); } + static void dropDNSCaches(); + private: std::vector addresses; std::vector subnets; diff --git a/src/AggregateFunctions/AggregateFunctionSumMap.cpp b/src/AggregateFunctions/AggregateFunctionSumMap.cpp index 5bedf72c39b..f4e299fe7c9 100644 --- a/src/AggregateFunctions/AggregateFunctionSumMap.cpp +++ b/src/AggregateFunctions/AggregateFunctionSumMap.cpp @@ -18,85 +18,105 @@ namespace ErrorCodes namespace { -struct WithOverflowPolicy +template +struct SumMap { - /// Overflow, meaning that the returned type is the same as the input type. - static DataTypePtr promoteType(const DataTypePtr & data_type) { return data_type; } + template + using F = AggregateFunctionSumMap; }; -struct WithoutOverflowPolicy +template +struct SumMapFiltered { - /// No overflow, meaning we promote the types if necessary. - static DataTypePtr promoteType(const DataTypePtr & data_type) + template + using F = AggregateFunctionSumMapFiltered; +}; + + +auto parseArguments(const std::string & name, const DataTypes & arguments) +{ + DataTypes args; + bool tuple_argument = false; + + if (arguments.size() == 1) { - if (!data_type->canBePromoted()) - throw Exception{"Values to be summed are expected to be Numeric, Float or Decimal.", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + // sumMap state is fully given by its result, so it can be stored in + // SimpleAggregateFunction columns. There is a caveat: it must support + // sumMap(sumMap(...)), e.g. it must be able to accept its own output as + // an input. This is why it also accepts a Tuple(keys, values) argument. + const auto * tuple_type = checkAndGetDataType(arguments[0].get()); + if (!tuple_type) + throw Exception("When function " + name + " gets one argument it must be a tuple", + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); - return data_type->promoteNumericType(); + const auto elems = tuple_type->getElements(); + args.insert(args.end(), elems.begin(), elems.end()); + tuple_argument = true; + } + else + { + args.insert(args.end(), arguments.begin(), arguments.end()); + tuple_argument = false; } -}; -template -using SumMapWithOverflow = AggregateFunctionSumMap; - -template -using SumMapWithoutOverflow = AggregateFunctionSumMap; - -template -using SumMapFilteredWithOverflow = AggregateFunctionSumMapFiltered; - -template -using SumMapFilteredWithoutOverflow = AggregateFunctionSumMapFiltered; - -using SumMapArgs = std::pair; - -SumMapArgs parseArguments(const std::string & name, const DataTypes & arguments) -{ - if (arguments.size() < 2) - throw Exception("Aggregate function " + name + " requires at least two arguments of Array type.", + if (args.size() < 2) + throw Exception("Aggregate function " + name + " requires at least two arguments of Array type or one argument of tuple of two arrays", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); - const auto * array_type = checkAndGetDataType(arguments[0].get()); + const auto * array_type = checkAndGetDataType(args[0].get()); if (!array_type) - throw Exception("First argument for function " + name + " must be an array.", + throw Exception("First argument for function " + name + " must be an array, not " + args[0]->getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); - DataTypePtr keys_type = array_type->getNestedType(); DataTypes values_types; - values_types.reserve(arguments.size() - 1); - for (size_t i = 1; i < arguments.size(); ++i) + values_types.reserve(args.size() - 1); + for (size_t i = 1; i < args.size(); ++i) { - array_type = checkAndGetDataType(arguments[i].get()); + array_type = checkAndGetDataType(args[i].get()); if (!array_type) throw Exception("Argument #" + toString(i) + " for function " + name + " must be an array.", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); values_types.push_back(array_type->getNestedType()); } - return {std::move(keys_type), std::move(values_types)}; + return std::tuple{std::move(keys_type), std::move(values_types), + tuple_argument}; } -template